[SCM] ffmpeg/ubuntu.extra: remove all sources from branch and rely on libav-source package instead

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Mar 20 11:42:50 UTC 2011


The following commit has been merged in the ubuntu.extra branch:
commit 47af600b192e75b4f5aaf20b872d1cc13d2df76f
Author: Reinhard Tartler <siretart at tauware.de>
Date:   Sun Mar 20 11:29:19 2011 +0100

    remove all sources from branch and rely on libav-source package instead

diff --git a/.gitignore b/.gitignore
index 4ce575b..b408e6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,46 +1 @@
 /.pc
-.config
-.version
-*.o
-*.d
-*.exe
-*.ho
-*-example
-*-test
-*_g
-config.*
-doc/*.1
-doc/*.html
-doc/*.pod
-doxy
-ffmpeg
-ffplay
-ffprobe
-ffserver
-libavcodec/libavcodec*
-libavcore/libavcore*
-libavdevice/libavdevice*
-libavfilter/libavfilter*
-libavformat/libavformat*
-libavutil/avconfig.h
-libavutil/libavutil*
-libpostproc/libpostproc*
-libswscale/libswscale*
-tests/audiogen
-tests/base64
-tests/data
-tests/rotozoom
-tests/seek_test
-tests/tiny_psnr
-tests/videogen
-tests/vsynth1
-tests/vsynth2
-tools/cws2fws
-tools/graph2dot
-tools/lavfi-showfiltfmts
-tools/pktdumper
-tools/probetest
-tools/qt-faststart
-tools/trasher
-tools/trasher*.d
-version.h
diff --git a/COPYING.GPLv2 b/COPYING.GPLv2
deleted file mode 100644
index d159169..0000000
--- a/COPYING.GPLv2
+++ /dev/null
@@ -1,339 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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) <year>  <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.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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) year 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 Lesser General
-Public License instead of this License.
diff --git a/COPYING.GPLv3 b/COPYING.GPLv3
deleted file mode 100644
index 94a9ed0..0000000
--- a/COPYING.GPLv3
+++ /dev/null
@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  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
-them 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 prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  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.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey 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;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If 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 convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU 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 that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  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.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-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.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     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
-state 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) <year>  <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 3 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, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program 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, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU 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 Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/COPYING.LGPLv2.1 b/COPYING.LGPLv2.1
deleted file mode 100644
index 00b4fed..0000000
--- a/COPYING.LGPLv2.1
+++ /dev/null
@@ -1,504 +0,0 @@
-                  GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/COPYING.LGPLv3 b/COPYING.LGPLv3
deleted file mode 100644
index 65c5ca8..0000000
--- a/COPYING.LGPLv3
+++ /dev/null
@@ -1,165 +0,0 @@
-                   GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions.
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
-   a) Give prominent notice with each copy of the Combined Work that
-   the Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
-   document.
-
-   c) For a Combined Work that displays copyright notices during
-   execution, include the copyright notice for the Library among
-   these notices, as well as a reference directing the user to the
-   copies of the GNU GPL and this license document.
-
-   d) Do one of the following:
-
-       0) Convey the Minimal Corresponding Source under the terms of this
-       License, and the Corresponding Application Code in a form
-       suitable for, and under terms that permit, the user to
-       recombine or relink the Application with a modified version of
-       the Linked Version to produce a modified Combined Work, in the
-       manner specified by section 6 of the GNU GPL for conveying
-       Corresponding Source.
-
-       1) Use a suitable shared library mechanism for linking with the
-       Library.  A suitable mechanism is one that (a) uses at run time
-       a copy of the Library already present on the user's computer
-       system, and (b) will operate properly with a modified version
-       of the Library that is interface-compatible with the Linked
-       Version.
-
-   e) Provide Installation Information, but only if you would otherwise
-   be required to provide such information under section 6 of the
-   GNU GPL, and only to the extent that such information is
-   necessary to install and execute a modified version of the
-   Combined Work produced by recombining or relinking the
-   Application with a modified version of the Linked Version. (If
-   you use option 4d0, the Installation Information must accompany
-   the Minimal Corresponding Source and Corresponding Application
-   Code. If you use option 4d1, you must provide the Installation
-   Information in the manner specified by section 6 of the GNU GPL
-   for conveying Corresponding Source.)
-
-  5. Combined Libraries.
-
-  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 that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
-   a) Accompany the combined library with a copy of the same work based
-   on the Library, uncombined with any other library facilities,
-   conveyed under the terms of this License.
-
-   b) Give prominent notice with the combined library that part of it
-   is a work based on the Library, and explaining where to find the
-   accompanying uncombined form of the same work.
-
-  6. Revised Versions of the GNU Lesser General Public License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU 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 as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
-  If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/CREDITS b/CREDITS
deleted file mode 100644
index 4a53778..0000000
--- a/CREDITS
+++ /dev/null
@@ -1,55 +0,0 @@
-This file contains the names of some of the people who have contributed to
-Libav/FFmpeg. The names are sorted alphabetically by last name.  As this file is
-currently quite outdated and git serves as a much better tool for determining
-authorship, it remains here for historical reasons only.
-
-Dénes Balatoni
-Michel Bardiaux
-Fabrice Bellard
-Patrice Bensoussan
-Alex Beregszaszi
-BERO
-Thilo Borgmann
-Mario Brito
-Ronald Bultje
-Alex Converse
-Maarten Daniels
-Reimar Doeffinger
-Tim Ferguson
-Brian Foley
-Arpad Gereoffy
-Philip Gladstone
-Vladimir Gneushev
-Roine Gustafsson
-David Hammerton
-Wolfgang Hesseler
-Marc Hoffman
-Falk Hueffner
-Aurélien Jacobs
-Steven Johnson
-Zdenek Kabelac
-Robin Kay
-Todd Kirby
-Nick Kurshev
-Benjamin Larsson
-Loïc Le Loarer
-Daniel Maas
-Mike Melanson
-Loren Merritt
-Jeff Muizelaar
-Michael Niedermayer
-François Revol
-Peter Ross
-Måns Rullgård
-Stefano Sabatini
-Roman Shaposhnik
-Oded Shimon
-Dieter Shirley
-Konstantin Shishkov
-Juan J. Sierralta
-Ewald Snel
-Sascha Sommer
-Leon van Stuivenberg
-Roberto Togni
-Lionel Ulmer
-Reynaldo Verdejo
diff --git a/Changelog b/Changelog
deleted file mode 100644
index 2e0a99c..0000000
--- a/Changelog
+++ /dev/null
@@ -1,614 +0,0 @@
-Entries are sorted chronologically from oldest to youngest within each release,
-releases are sorted from youngest to oldest.
-
-version 0.6.2:
-
-- Fix invalid reads in VC-1 decoding (related to CVE-2011-0723)
-- Do not attempt to decode APE file with no frames
-  (adresses http://packetstorm.linuxsecurity.com/1103-exploits/vlc105-dos.txt)
-
-
-version 0.6.1:
-
-- fix autodetection of E-AC-3 substream samples
-- performance fix for seekable HTTP
-- backport AAC-HE v2 from trunk
-- add missing VP80 fourcc code for the VP8 codec
-- small documentation fixes
-- fix several potentially exploitable issues in the FLIC decoder
-  (addresses CVE-2010-3429)
-
-
-version 0.6:
-
-- PB-frame decoding for H.263
-- deprecated vhook subsystem removed
-- deprecated old scaler removed
-- VQF demuxer
-- alpha channel scaler
-- PCX encoder
-- RTP packetization of H.263
-- RTP packetization of AMR
-- RTP depacketization of Vorbis
-- CorePNG decoding support
-- Cook multichannel decoding support
-- introduced avlanguage helpers in libavformat
-- 8088flex TMV demuxer and decoder
-- per-stream language-tags extraction in asfdec
-- V210 decoder and encoder
-- remaining GPL parts in AC-3 decoder converted to LGPL
-- QCP demuxer
-- SoX native format muxer and demuxer
-- AMR-NB decoding/encoding, AMR-WB decoding via OpenCORE libraries
-- DPX image decoder
-- Electronic Arts Madcow decoder
-- DivX (XSUB) subtitle encoder
-- nonfree libamr support for AMR-NB/WB decoding/encoding removed
-- experimental AAC encoder
-- RTP depacketization of ASF and RTSP from WMS servers
-- RTMP support in libavformat
-- noX handling for OPT_BOOL X options
-- Wave64 demuxer
-- IEC-61937 compatible Muxer
-- TwinVQ decoder
-- Bluray (PGS) subtitle decoder
-- LPCM support in MPEG-TS (HDMV RID as found on Blu-ray disks)
-- WMA Pro decoder
-- Core Audio Format demuxer
-- Atrac1 decoder
-- MD STUDIO audio demuxer
-- RF64 support in WAV demuxer
-- MPEG-4 Audio Lossless Coding (ALS) decoder
-- -formats option split into -formats, -codecs, -bsfs, and -protocols
-- IV8 demuxer
-- CDG demuxer and decoder
-- R210 decoder
-- Auravision Aura 1 and 2 decoders
-- Deluxe Paint Animation playback system
-- SIPR decoder
-- Adobe Filmstrip muxer and demuxer
-- RTP depacketization of H.263
-- Bink demuxer and audio/video decoders
-- enable symbol versioning by default for linkers that support it
-- IFF PBM/ILBM bitmap decoder
-- concat protocol
-- Indeo 5 decoder
-- RTP depacketization of AMR
-- WMA Voice decoder
-- ffprobe tool
-- AMR-NB decoder
-- RTSP muxer
-- HE-AAC v1 decoder
-- Kega Game Video (KGV1) decoder
-- VorbisComment writing for FLAC, Ogg FLAC and Ogg Speex files
-- RTP depacketization of Theora
-- HTTP Digest authentication
-- RTMP/RTMPT/RTMPS/RTMPE/RTMPTE protocol support via librtmp
-- Psygnosis YOP demuxer and video decoder
-- spectral extension support in the E-AC-3 decoder
-- unsharp video filter
-- RTP hinting in the mov/3gp/mp4 muxer
-- Dirac in Ogg demuxing
-- seek to keyframes in Ogg
-- 4:2:2 and 4:4:4 Theora decoding
-- 35% faster VP3/Theora decoding
-- faster AAC decoding
-- faster H.264 decoding
-- WebM support in Matroska de/muxer
-- low overhead Ogg muxing
-- VP8 de/encoding via libvpx
-- CODEC_CAP_EXPERIMENTAL added
-
-
-
-version 0.5:
-
-- DV50 AKA DVCPRO50 encoder, decoder, muxer and demuxer
-- TechSmith Camtasia (TSCC) video decoder
-- IBM Ultimotion (ULTI) video decoder
-- Sierra Online audio file demuxer and decoder
-- Apple QuickDraw (qdrw) video decoder
-- Creative ADPCM audio decoder (16 bits as well as 8 bits schemes)
-- Electronic Arts Multimedia (WVE/UV2/etc.) file demuxer
-- Miro VideoXL (VIXL) video decoder
-- H.261 video encoder
-- QPEG video decoder
-- Nullsoft Video (NSV) file demuxer
-- Shorten audio decoder
-- LOCO video decoder
-- Apple Lossless Audio Codec (ALAC) decoder
-- Winnov WNV1 video decoder
-- Autodesk Animator Studio Codec (AASC) decoder
-- Indeo 2 video decoder
-- Fraps FPS1 video decoder
-- Snow video encoder/decoder
-- Sonic audio encoder/decoder
-- Vorbis audio decoder
-- Macromedia ADPCM decoder
-- Duck TrueMotion 2 video decoder
-- support for decoding FLX and DTA extensions in FLIC files
-- H.264 custom quantization matrices support
-- ffserver fixed, it should now be usable again
-- QDM2 audio decoder
-- Real Cooker audio decoder
-- TrueSpeech audio decoder
-- WMA2 audio decoder fixed, now all files should play correctly
-- RealAudio 14.4 and 28.8 decoders fixed
-- JPEG-LS decoder
-- build system improvements
-- tabs and trailing whitespace removed from the codebase
-- CamStudio video decoder
-- AIFF/AIFF-C audio format, encoding and decoding
-- ADTS AAC file reading and writing
-- Creative VOC file reading and writing
-- American Laser Games multimedia (*.mm) playback system
-- Zip Motion Blocks Video decoder
-- improved Theora/VP3 decoder
-- True Audio (TTA) decoder
-- AVS demuxer and video decoder
-- JPEG-LS encoder
-- Smacker demuxer and decoder
-- NuppelVideo/MythTV demuxer and RTjpeg decoder
-- KMVC decoder
-- MPEG-2 intra VLC support
-- MPEG-2 4:2:2 encoder
-- Flash Screen Video decoder
-- GXF demuxer
-- Chinese AVS decoder
-- GXF muxer
-- MXF demuxer
-- VC-1/WMV3/WMV9 video decoder
-- MacIntel support
-- AVISynth support
-- VMware video decoder
-- VP5 video decoder
-- VP6 video decoder
-- WavPack lossless audio decoder
-- Targa (.TGA) picture decoder
-- Vorbis audio encoder
-- Delphine Software .cin demuxer/audio and video decoder
-- Tiertex .seq demuxer/video decoder
-- MTV demuxer
-- TIFF picture encoder and decoder
-- GIF picture decoder
-- Intel Music Coder decoder
-- Zip Motion Blocks Video encoder
-- Musepack decoder
-- Flash Screen Video encoder
-- Theora encoding via libtheora
-- BMP encoder
-- WMA encoder
-- GSM-MS encoder and decoder
-- DCA decoder
-- DXA demuxer and decoder
-- DNxHD decoder
-- Gamecube movie (.THP) playback system
-- Blackfin optimizations
-- Interplay C93 demuxer and video decoder
-- Bethsoft VID demuxer and video decoder
-- CRYO APC demuxer
-- Atrac3 decoder
-- V.Flash PTX decoder
-- RoQ muxer, RoQ audio encoder
-- Renderware TXD demuxer and decoder
-- extern C declarations for C++ removed from headers
-- sws_flags command line option
-- codebook generator
-- RoQ video encoder
-- QTRLE encoder
-- OS/2 support removed and restored again
-- AC-3 decoder
-- NUT muxer
-- additional SPARC (VIS) optimizations
-- Matroska muxer
-- slice-based parallel H.264 decoding
-- Monkey's Audio demuxer and decoder
-- AMV audio and video decoder
-- DNxHD encoder
-- H.264 PAFF decoding
-- Nellymoser ASAO decoder
-- Beam Software SIFF demuxer and decoder
-- libvorbis Vorbis decoding removed in favor of native decoder
-- IntraX8 (J-Frame) subdecoder for WMV2 and VC-1
-- Ogg (Theora, Vorbis and FLAC) muxer
-- The "device" muxers and demuxers are now in a new libavdevice library
-- PC Paintbrush PCX decoder
-- Sun Rasterfile decoder
-- TechnoTrend PVA demuxer
-- Linux Media Labs MPEG-4 (LMLM4) demuxer
-- AVM2 (Flash 9) SWF muxer
-- QT variant of IMA ADPCM encoder
-- VFW grabber
-- iPod/iPhone compatible mp4 muxer
-- Mimic decoder
-- MSN TCP Webcam stream demuxer
-- RL2 demuxer / decoder
-- IFF demuxer
-- 8SVX audio decoder
-- non-recursive Makefiles
-- BFI demuxer
-- MAXIS EA XA (.xa) demuxer / decoder
-- BFI video decoder
-- OMA demuxer
-- MLP/TrueHD decoder
-- Electronic Arts CMV decoder
-- Motion Pixels Video decoder
-- Motion Pixels MVI demuxer
-- removed animated GIF decoder/demuxer
-- D-Cinema audio muxer
-- Electronic Arts TGV decoder
-- Apple Lossless Audio Codec (ALAC) encoder
-- AAC decoder
-- floating point PCM encoder/decoder
-- MXF muxer
-- DV100 AKA DVCPRO HD decoder and demuxer
-- E-AC-3 support added to AC-3 decoder
-- Nellymoser ASAO encoder
-- ASS and SSA demuxer and muxer
-- liba52 wrapper removed
-- SVQ3 watermark decoding support
-- Speex decoding via libspeex
-- Electronic Arts TGQ decoder
-- RV40 decoder
-- QCELP / PureVoice decoder
-- RV30 decoder
-- hybrid WavPack support
-- R3D REDCODE demuxer
-- ALSA support for playback and record
-- Electronic Arts TQI decoder
-- OpenJPEG based JPEG 2000 decoder
-- NC (NC4600) camera file demuxer
-- Gopher client support
-- MXF D-10 muxer
-- generic metadata API
-
-
-
-version 0.4.9-pre1:
-
-- DV encoder, DV muxer
-- Microsoft RLE video decoder
-- Microsoft Video-1 decoder
-- Apple Animation (RLE) decoder
-- Apple Graphics (SMC) decoder
-- Apple Video (RPZA) decoder
-- Cinepak decoder
-- Sega FILM (CPK) file demuxer
-- Westwood multimedia support (VQA & AUD files)
-- Id Quake II CIN playback support
-- 8BPS video decoder
-- FLIC playback support
-- RealVideo 2.0 (RV20) decoder
-- Duck TrueMotion v1 (DUCK) video decoder
-- Sierra VMD demuxer and video decoder
-- MSZH and ZLIB decoder support
-- SVQ1 video encoder
-- AMR-WB support
-- PPC optimizations
-- rate distortion optimal cbp support
-- rate distorted optimal ac prediction for MPEG-4
-- rate distorted optimal lambda->qp support
-- AAC encoding with libfaac
-- Sunplus JPEG codec (SP5X) support
-- use Lagrange multipler instead of QP for ratecontrol
-- Theora/VP3 decoding support
-- XA and ADX ADPCM codecs
-- export MPEG-2 active display area / pan scan
-- Add support for configuring with IBM XLC
-- floating point AAN DCT
-- initial support for zygo video (not complete)
-- RGB ffv1 support
-- new audio/video parser API
-- av_log() system
-- av_read_frame() and av_seek_frame() support
-- missing last frame fixes
-- seek by mouse in ffplay
-- noise reduction of DCT coefficients
-- H.263 OBMC & 4MV support
-- H.263 alternative inter vlc support
-- H.263 loop filter
-- H.263 slice structured mode
-- interlaced DCT support for MPEG-2 encoding
-- stuffing to stay above min_bitrate
-- MB type & QP visualization
-- frame stepping for ffplay
-- interlaced motion estimation
-- alternate scantable support
-- SVCD scan offset support
-- closed GOP support
-- SSE2 FDCT
-- quantizer noise shaping
-- G.726 ADPCM audio codec
-- MS ADPCM encoding
-- multithreaded/SMP motion estimation
-- multithreaded/SMP encoding for MPEG-1/MPEG-2/MPEG-4/H.263
-- multithreaded/SMP decoding for MPEG-2
-- FLAC decoder
-- Metrowerks CodeWarrior suppport
-- H.263+ custom pcf support
-- nicer output for 'ffmpeg -formats'
-- Matroska demuxer
-- SGI image format, encoding and decoding
-- H.264 loop filter support
-- H.264 CABAC support
-- nicer looking arrows for the motion vector visualization
-- improved VCD support
-- audio timestamp drift compensation
-- MPEG-2 YUV 422/444 support
-- polyphase kaiser windowed sinc and blackman nuttall windowed sinc audio resample
-- better image scaling
-- H.261 support
-- correctly interleave packets during encoding
-- VIS optimized motion compensation
-- intra_dc_precision>0 encoding support
-- support reuse of motion vectors/MB types/field select values of the source video
-- more accurate deblock filter
-- padding support
-- many optimizations and bugfixes
-- FunCom ISS audio file demuxer and according ADPCM decoding
-
-
-
-version 0.4.8:
-
-- MPEG-2 video encoding (Michael)
-- Id RoQ playback subsystem (Mike Melanson and Tim Ferguson)
-- Wing Commander III Movie (.mve) file playback subsystem (Mike Melanson
-  and Mario Brito)
-- Xan DPCM audio decoder (Mario Brito)
-- Interplay MVE playback subsystem (Mike Melanson)
-- Duck DK3 and DK4 ADPCM audio decoders (Mike Melanson)
-
-
-
-version 0.4.7:
-
-- RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from mplayerhq
-  (originally from public domain player for Amiga at http://www.honeypot.net/audio)
-- current version now also compiles with older GCC (Fabrice)
-- 4X multimedia playback system including 4xm file demuxer (Mike
-  Melanson), and 4X video and audio codecs (Michael)
-- Creative YUV (CYUV) decoder (Mike Melanson)
-- FFV1 codec (our very simple lossless intra only codec, compresses much better
-  than HuffYUV) (Michael)
-- ASV1 (Asus), H.264, Intel indeo3 codecs have been added (various)
-- tiny PNG encoder and decoder, tiny GIF decoder, PAM decoder (PPM with
-  alpha support), JPEG YUV colorspace support. (Fabrice Bellard)
-- ffplay has been replaced with a newer version which uses SDL (optionally)
-  for multiplatform support (Fabrice)
-- Sorenson Version 3 codec (SVQ3) support has been added (decoding only) - donated
-  by anonymous
-- AMR format has been added (Johannes Carlsson)
-- 3GP support has been added (Johannes Carlsson)
-- VP3 codec has been added (Mike Melanson)
-- more MPEG-1/2 fixes
-- better multiplatform support, MS Visual Studio fixes (various)
-- AltiVec optimizations (Magnus Damn and others)
-- SH4 processor support has been added (BERO)
-- new public interfaces (avcodec_get_pix_fmt) (Roman Shaposhnick)
-- VOB streaming support (Brian Foley)
-- better MP3 autodetection (Andriy Rysin)
-- qpel encoding (Michael)
-- 4mv+b frames encoding finally fixed (Michael)
-- chroma ME (Michael)
-- 5 comparison functions for ME (Michael)
-- B-frame encoding speedup (Michael)
-- WMV2 codec (unfinished - Michael)
-- user specified diamond size for EPZS (Michael)
-- Playstation STR playback subsystem, still experimental (Mike and Michael)
-- ASV2 codec (Michael)
-- CLJR decoder (Alex)
-
-.. And lots more new enhancements and fixes.
-
-
-
-version 0.4.6:
-
-- completely new integer only MPEG audio layer 1/2/3 decoder rewritten
-  from scratch
-- Recoded DCT and motion vector search with gcc (no longer depends on nasm)
-- fix quantization bug in AC3 encoder
-- added PCM codecs and format. Corrected WAV/AVI/ASF PCM issues
-- added prototype ffplay program
-- added GOB header parsing on H.263/H.263+ decoder (Juanjo)
-- bug fix on MCBPC tables of H.263 (Juanjo)
-- bug fix on DC coefficients of H.263 (Juanjo)
-- added Advanced Prediction Mode on H.263/H.263+ decoder (Juanjo)
-- now we can decode H.263 streams found in QuickTime files (Juanjo)
-- now we can decode H.263 streams found in VIVO v1 files(Juanjo)
-- preliminary RTP "friendly" mode for H.263/H.263+ coding. (Juanjo)
-- added GOB header for H.263/H.263+ coding on RTP mode (Juanjo)
-- now H.263 picture size is returned on the first decoded frame (Juanjo)
-- added first regression tests
-- added MPEG-2 TS demuxer
-- new demux API for libav
-- more accurate and faster IDCT (Michael)
-- faster and entropy-controlled motion search (Michael)
-- two pass video encoding (Michael)
-- new video rate control (Michael)
-- added MSMPEG4V1, MSMPEGV2 and WMV1 support (Michael)
-- great performance improvement of video encoders and decoders (Michael)
-- new and faster bit readers and vlc parsers (Michael)
-- high quality encoding mode: tries all macroblock/VLC types (Michael)
-- added DV video decoder
-- preliminary RTP/RTSP support in ffserver and libavformat
-- H.263+ AIC decoding/encoding support (Juanjo)
-- VCD MPEG-PS mode (Juanjo)
-- PSNR stuff (Juanjo)
-- simple stats output (Juanjo)
-- 16-bit and 15-bit RGB/BGR/GBR support (Bisqwit)
-
-
-
-version 0.4.5:
-
-- some header fixes (Zdenek Kabelac <kabi at informatics.muni.cz>)
-- many MMX optimizations (Nick Kurshev <nickols_k at mail.ru>)
-- added configure system (actually a small shell script)
-- added MPEG audio layer 1/2/3 decoding using LGPL'ed mpglib by
-  Michael Hipp (temporary solution - waiting for integer only
-  decoder)
-- fixed VIDIOCSYNC interrupt
-- added Intel H.263 decoding support ('I263' AVI fourCC)
-- added Real Video 1.0 decoding (needs further testing)
-- simplified image formats again. Added PGM format (=grey
-  pgm). Renamed old PGM to PGMYUV.
-- fixed msmpeg4 slice issues (tell me if you still find problems)
-- fixed OpenDivX bugs with newer versions (added VOL header decoding)
-- added support for MPlayer interface
-- added macroblock skip optimization
-- added MJPEG decoder
-- added mmx/mmxext IDCT from libmpeg2
-- added pgmyuvpipe, ppm, and ppm_pipe formats (original patch by Celer
-  <celer at shell.scrypt.net>)
-- added pixel format conversion layer (e.g. for MJPEG or PPM)
-- added deinterlacing option
-- MPEG-1/2 fixes
-- MPEG-4 vol header fixes (Jonathan Marsden <snmjbm at pacbell.net>)
-- ARM optimizations (Lionel Ulmer <lionel.ulmer at free.fr>).
-- Windows porting of file converter
-- added MJPEG raw format (input/ouput)
-- added JPEG image format support (input/output)
-
-
-
-version 0.4.4:
-
-- fixed some std header definitions (Bjorn Lindgren
-  <bjorn.e.lindgren at telia.com>).
-- added MPEG demuxer (MPEG-1 and 2 compatible).
-- added ASF demuxer
-- added prototype RM demuxer
-- added AC3 decoding (done with libac3 by Aaron Holtzman)
-- added decoding codec parameter guessing (.e.g. for MPEG, because the
-  header does not include them)
-- fixed header generation in MPEG-1, AVI and ASF muxer: wmplayer can now
-  play them (only tested video)
-- fixed H.263 white bug
-- fixed phase rounding in img resample filter
-- add MMX code for polyphase img resample filter
-- added CPU autodetection
-- added generic title/author/copyright/comment string handling (ASF and RM
-  use them)
-- added SWF demux to extract MP3 track (not usable yet because no MP3
-  decoder)
-- added fractional frame rate support
-- codecs are no longer searched by read_header() (should fix ffserver
-  segfault)
-
-
-
-version 0.4.3:
-
-- BGR24 patch (initial patch by Jeroen Vreeken <pe1rxq at amsat.org>)
-- fixed raw yuv output
-- added motion rounding support in MPEG-4
-- fixed motion bug rounding in MSMPEG4
-- added B-frame handling in video core
-- added full MPEG-1 decoding support
-- added partial (frame only) MPEG-2 support
-- changed the FOURCC code for H.263 to "U263" to be able to see the
-  +AVI/H.263 file with the UB Video H.263+ decoder. MPlayer works with
-  this +codec ;) (JuanJo).
-- Halfpel motion estimation after MB type selection (JuanJo)
-- added pgm and .Y.U.V output format
-- suppressed 'img:' protocol. Simply use: /tmp/test%d.[pgm|Y] as input or
-  output.
-- added pgmpipe I/O format (original patch from Martin Aumueller
-  <lists at reserv.at>, but changed completely since we use a format
-  instead of a protocol)
-
-
-
-version 0.4.2:
-
-- added H.263/MPEG-4/MSMPEG4 decoding support. MPEG-4 decoding support
-  (for OpenDivX) is almost complete: 8x8 MVs and rounding are
-  missing. MSMPEG4 support is complete.
-- added prototype MPEG-1 decoder. Only I- and P-frames handled yet (it
-  can decode ffmpeg MPEGs :-)).
-- added libavcodec API documentation (see apiexample.c).
-- fixed image polyphase bug (the bottom of some images could be
-  greenish)
-- added support for non clipped motion vectors (decoding only)
-  and image sizes non-multiple of 16
-- added support for AC prediction (decoding only)
-- added file overwrite confirmation (can be disabled with -y)
-- added custom size picture to H.263 using H.263+ (Juanjo)
-
-
-version 0.4.1:
-
-- added MSMPEG4 (aka DivX) compatible encoder. Changed default codec
-  of AVI and ASF to DIV3.
-- added -me option to set motion estimation method
-  (default=log). suppressed redundant -hq option.
-- added options -acodec and -vcodec to force a given codec (useful for
-  AVI for example)
-- fixed -an option
-- improved dct_quantize speed
-- factorized some motion estimation code
-
-
-
-version 0.4.0:
-
-- removing grab code from ffserver and moved it to ffmpeg. Added
-  multistream support to ffmpeg.
-- added timeshifting support for live feeds (option ?date=xxx in the
-  URL)
-- added high quality image resize code with polyphase filter (need
-  mmx/see optimization). Enable multiple image size support in ffserver.
-- added multi live feed support in ffserver
-- suppressed master feature from ffserver (it should be done with an
-  external program which opens the .ffm url and writes it to another
-  ffserver)
-- added preliminary support for video stream parsing (WAV and AVI half
-  done). Added proper support for audio/video file conversion in
-  ffmpeg.
-- added preliminary support for video file sending from ffserver
-- redesigning I/O subsystem: now using URL based input and output
-  (see avio.h)
-- added WAV format support
-- added "tty user interface" to ffmpeg to stop grabbing gracefully
-- added MMX/SSE optimizations to SAD (Sums of Absolutes Differences)
-  (Juan J. Sierralta P. a.k.a. "Juanjo" <juanjo at atmlab.utfsm.cl>)
-- added MMX DCT from mpeg2_movie 1.5 (Juanjo)
-- added new motion estimation algorithms, log and phods (Juanjo)
-- changed directories: libav for format handling, libavcodec for
-  codecs
-
-
-
-version 0.3.4:
-
-- added stereo in MPEG audio encoder
-
-
-
-version 0.3.3:
-
-- added 'high quality' mode which use motion vectors. It can be used in
-  real time at low resolution.
-- fixed rounding problems which caused quality problems at high
-  bitrates and large GOP size
-
-
-
-version 0.3.2: small fixes
-
-- ASF fixes
-- put_seek bug fix
-
-
-
-version 0.3.1: added avi/divx support
-
-- added AVI support
-- added MPEG-4 codec compatible with OpenDivX. It is based on the H.263 codec
-- added sound for flash format (not tested)
-
-
-
-version 0.3: initial public release
diff --git a/Doxyfile b/Doxyfile
deleted file mode 100644
index 5e1a405..0000000
--- a/Doxyfile
+++ /dev/null
@@ -1,1037 +0,0 @@
-# Doxyfile 1.3-rc1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-#       TAG = value [value, ...]
-# For lists items can also be appended using:
-#       TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# General configuration options
-#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME           = Libav
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER         =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       = doxy
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
-# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
-# (Japanese with english messages), Korean, Norwegian, Polish, Portuguese,
-# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish and Ukrainian.
-
-OUTPUT_LANGUAGE        = English
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL            = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE        = YES
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC         = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these class will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF           = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
-# members of a class in the documentation of that class as if those members were
-# ordinary class members. Constructors, destructors and assignment operators of
-# the base classes will not be shown.
-
-INLINE_INHERITED_MEMB  = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES        = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. It is allowed to use relative paths in the argument list.
-
-STRIP_FROM_PATH        = .
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower case letters. If set to YES upper case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# users are adviced to set this option to NO.
-
-CASE_SENSE_NAMES       = YES
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES            = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS       = YES
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments  will behave just like the Qt-style comments (thus requiring an
-# explict @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF      = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP         = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# reimplements.
-
-INHERIT_DOCS           = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS       = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE               = 8
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES                =
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS       =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consist of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C.
-# For instance some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C  = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
-# only. Doxygen will then generate output that is more tailored for Java.
-# For instance namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES        = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS               = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE           =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT                  =
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl *.odl
-
-FILE_PATTERNS          =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE                =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
-# that are symbolic links (a Unix filesystem feature) are excluded from the input.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
-EXCLUDE_PATTERNS       = *.svn *.git
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH           =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS       =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE      = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH             =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-
-INPUT_FILTER           =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-
-SOURCE_BROWSER         = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION    = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX     = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX          =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER            =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER            =
-
-# The HTML_STYLESHEET tag can be used to specify a user defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet
-
-HTML_STYLESHEET        =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP      = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output dir.
-
-CHM_FILE               =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non empty doxygen will try to run
-# the html help compiler on the generated index.hhp.
-
-HHC_LOCATION           =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI           = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the Html help documentation and to the tree view.
-
-TOC_EXPAND             = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX          = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
-# or Internet explorer 4.0+). Note that for large projects the tree generation
-# can take a very long time. In such cases it is better to disable this feature.
-# Windows users are probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW      = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH         = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX         = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE             = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES         =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER           =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS         = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX           = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE        = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assigments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE    =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE    =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_XML           = NO
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA             =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD                =
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.  This is useful
-# if you want to understand what is going on.  On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION        = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
-EXPAND_ONLY_PREDEF     = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH           =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS  =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
-PREDEFINED             = __attribute__(x)="" "RENAME(x)=x ## _TMPL" "DEF(x)=x ## _TMPL" \
-                         HAVE_AV_CONFIG_H HAVE_MMX HAVE_MMX2 HAVE_AMD3DNOW \
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-#EXPAND_AS_DEFINED      = FF_COMMON_FRAME
-EXPAND_AS_DEFINED      = declare_idct(idct, table, idct_row_head, idct_row, idct_row_tail, idct_row_mid)
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse the
-# parser if not removed.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tagfiles.
-
-TAGFILES               =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE       =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS        = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH              = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yield more powerful graphs.
-
-CLASS_DIAGRAMS         = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS   = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT               = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH            = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH    = YES
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS     = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH          = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH      = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY    = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT       = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH               =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS           =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_WIDTH    = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT   = 1024
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND        = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermedate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP            = YES
-
-#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE           = NO
-
-# The CGI_NAME tag should be the name of the CGI script that
-# starts the search engine (doxysearch) with the correct parameters.
-# A script with this name will be generated by doxygen.
-
-CGI_NAME               = search.cgi
-
-# The CGI_URL tag should be the absolute URL to the directory where the
-# cgi binaries are located. See the documentation of your http daemon for
-# details.
-
-CGI_URL                =
-
-# The DOC_URL tag should be the absolute URL to the directory where the
-# documentation is located. If left blank the absolute path to the
-# documentation, with file:// prepended to it, will be used.
-
-DOC_URL                =
-
-# The DOC_ABSPATH tag should be the absolute path to the directory where the
-# documentation is located. If left blank the directory on the local machine
-# will be used.
-
-DOC_ABSPATH            =
-
-# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
-# is installed.
-
-BIN_ABSPATH            = /usr/local/bin/
-
-# The EXT_DOC_PATHS tag can be used to specify one or more paths to
-# documentation generated for other projects. This allows doxysearch to search
-# the documentation for these projects as well.
-
-EXT_DOC_PATHS          =
diff --git a/INSTALL b/INSTALL
deleted file mode 100644
index 2ed04ef..0000000
--- a/INSTALL
+++ /dev/null
@@ -1,11 +0,0 @@
-
-1) Type './configure' to create the configuration. A list of configure
-options is printed by running 'configure --help'.
-
-'configure' can be launched from a directory different from the Libav
-sources to build the objects out of tree. To do this, use an absolute
-path when launching 'configure', e.g. '/libavdir/libav/configure'.
-
-2) Then type 'make' to build Libav. GNU Make 3.81 or later is required.
-
-3) Type 'make install' to install all binaries and libraries you built.
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index c6bcbe8..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,50 +0,0 @@
-Libav:
--------
-
-Most files in Libav are under the GNU Lesser General Public License version 2.1
-or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other
-files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to
-Libav.
-
-Some optional parts of Libav are licensed under the GNU General Public License
-version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of
-these parts are used by default, you have to explicitly pass --enable-gpl to
-configure to activate them. In this case, Libav's license changes to GPL v2+.
-
-Specifically, the GPL parts of Libav are
-
-- libpostproc
-- optional MMX optimizations for YUV to RGB colorspace conversion in
-  libswscale/x86/yuv2rgb_template.c
-- optional x86 optimizations in the files
-  libavcodec/x86/h264_deblock_sse2.asm
-  libavcodec/x86/h264_idct_sse2.asm
-  libavcodec/x86/idct_mmx.c
-- the X11 grabber in libavdevice/x11grab.c
-
-There are a handful of files under other licensing terms, namely:
-
-* The files libavcodec/jfdctfst.c, libavcodec/jfdctint.c, libavcodec/jrevdct.c
-  are taken from libjpeg, see the top of the files for licensing details.
-
-Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
-the configure parameter --enable-version3 will activate this licensing option
-for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts,
-COPYING.GPLv3 to learn the exact legal terms that apply in this case.
-
-
-external libraries:
--------------------
-
-Some external libraries, e.g. libx264, are under GPL and can be used in
-conjunction with Libav. They require --enable-gpl to be passed to configure
-as well.
-
-The OpenCORE external libraries are under the Apache License 2.0. That license
-is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of
-those licenses. So to combine the OpenCORE libraries with Libav, the license
-version needs to be upgraded by passing --enable-version3 to configure.
-
-The nonfree external library libfaac can be hooked up in Libav. You need to
-pass --enable-nonfree to configure to enable it. Employ this option with care
-as Libav then becomes nonfree and unredistributable.
diff --git a/MAINTAINERS b/MAINTAINERS
deleted file mode 100644
index f9891fe..0000000
--- a/MAINTAINERS
+++ /dev/null
@@ -1,359 +0,0 @@
-FFmpeg maintainers
-==================
-
-Below is a list of the people maintaining different parts of the
-FFmpeg code.
-
-
-Project Leader
-==============
-
-Michael Niedermayer
-  final design decisions
-
-
-Applications
-============
-
-ffmpeg:
-  ffmpeg.c                              Michael Niedermayer
-
-ffplay:
-  ffplay.c                              Michael Niedermayer
-
-ffserver:
-  ffserver.c, ffserver.h                Baptiste Coudurier
-
-Commandline utility code:
-  cmdutils.c, cmdutils.h                Michael Niedermayer
-
-QuickTime faststart:
-  tools/qt-faststart.c                  Baptiste Coudurier
-
-
-Miscellaneous Areas
-===================
-
-documentation                           Mike Melanson, Diego Biurrun
-website                                 Robert Swain
-build system (configure,Makefiles)      Diego Biurrun, Mans Rullgard
-project server                          Diego Biurrun, Mans Rullgard
-mailinglists                            Michael Niedermayer, Baptiste Coudurier
-presets                                 Robert Swain
-metadata subsystem                      Aurelien Jacobs
-release management                      Diego Biurrun, Reinhard Tartler
-
-
-libavutil
-=========
-
-External Interfaces:
-  libavutil/avutil.h                    Michael Niedermayer
-Internal Interfaces:
-  libavutil/common.h                    Michael Niedermayer
-
-Other:
-  intfloat*                             Michael Niedermayer
-  rational.c, rational.h                Michael Niedermayer
-  mathematics.c, mathematics.h          Michael Niedermayer
-  integer.c, integer.h                  Michael Niedermayer
-  bswap.h
-
-
-libavcodec
-==========
-
-Generic Parts:
-  External Interfaces:
-    avcodec.h                           Michael Niedermayer
-  utility code:
-    utils.c                             Michael Niedermayer
-    mem.c                               Michael Niedermayer
-    opt.c, opt.h                        Michael Niedermayer
-  arithmetic expression evaluator:
-    eval.c                              Michael Niedermayer
-  audio and video frame extraction:
-    parser.c                            Michael Niedermayer
-  bitstream reading:
-    bitstream.c, bitstream.h            Michael Niedermayer
-  CABAC:
-    cabac.h, cabac.c                    Michael Niedermayer
-  DSP utilities:
-    dsputils.c, dsputils.h              Michael Niedermayer
-  entropy coding:
-    rangecoder.c, rangecoder.h          Michael Niedermayer
-    lzw.*                               Michael Niedermayer
-  floating point AAN DCT:
-    faandct.c, faandct.h                Michael Niedermayer
-  Golomb coding:
-    golomb.c, golomb.h                  Michael Niedermayer
-  LPC:
-    lpc.c, lpc.h                        Justin Ruggles
-  motion estimation:
-    motion*                             Michael Niedermayer
-  rate control:
-    ratecontrol.c                       Michael Niedermayer
-    libxvid_rc.c                        Michael Niedermayer
-  simple IDCT:
-    simple_idct.c, simple_idct.h        Michael Niedermayer
-  postprocessing:
-    libpostproc/*                       Michael Niedermayer
-
-Codecs:
-  4xm.c                                 Michael Niedermayer
-  8bps.c                                Roberto Togni
-  8svx.c                                Jaikrishnan Menon
-  aasc.c                                Kostya Shishkov
-  aac*, sbr.h                           Alex Converse
-  ac3*                                  Justin Ruggles
-  alacenc.c                             Jaikrishnan Menon
-  alsdec.c                              Thilo Borgmann
-  apedec.c                              Kostya Shishkov
-  asv*                                  Michael Niedermayer
-  atrac3*                               Benjamin Larsson
-  bgmc.c, bgmc.h                        Thilo Borgmann
-  bink.c                                Kostya Shishkov
-  binkaudio.c                           Peter Ross
-  bmp.c                                 Mans Rullgard, Kostya Shishkov
-  cavs*                                 Stefan Gehrer
-  celp_filters.*                        Vitor Sessak
-  cinepak.c                             Roberto Togni
-  cljr                                  Alex Beregszaszi
-  cook.c, cookdata.h                    Benjamin Larsson
-  cscd.c                                Reimar Doeffinger
-  dca.c                                 Kostya Shishkov, Benjamin Larsson
-  dnxhd*                                Baptiste Coudurier
-  dpcm.c                                Mike Melanson
-  dxa.c                                 Kostya Shishkov
-  dv.c                                  Roman Shaposhnik
-  eacmv*, eaidct*, eat*                 Peter Ross
-  ffv1.c                                Michael Niedermayer
-  flac*                                 Justin Ruggles
-  flashsv*                              Benjamin Larsson
-  flicvideo.c                           Mike Melanson
-  g726.c                                Roman Shaposhnik
-  gifdec.c                              Baptiste Coudurier
-  h264*                                 Loren Merritt, Michael Niedermayer
-  h261*                                 Michael Niedermayer
-  h263*                                 Michael Niedermayer
-  huffyuv.c                             Michael Niedermayer
-  idcinvideo.c                          Mike Melanson
-  imc*                                  Benjamin Larsson
-  indeo2*                               Kostya Shishkov
-  indeo5*                               Kostya Shishkov
-  interplayvideo.c                      Mike Melanson
-  ivi*                                  Kostya Shishkov
-  jpeg_ls.c                             Kostya Shishkov
-  kmvc.c                                Kostya Shishkov
-  lcl*.c                                Roberto Togni, Reimar Doeffinger
-  libgsm.c                              Michel Bardiaux
-  libdirac*                             David Conrad
-  libopenjpeg.c                         Jaikrishnan Menon
-  libschroedinger*                      David Conrad
-  libspeexdec.c                         Justin Ruggles
-  libtheoraenc.c                        David Conrad
-  libx264.c                             Mans Rullgard, Jason Garrett-Glaser
-  loco.c                                Kostya Shishkov
-  lzo.h, lzo.c                          Reimar Doeffinger
-  mdec.c                                Michael Niedermayer
-  mimic.c                               Ramiro Polla
-  mjpeg.c                               Michael Niedermayer
-  mlp*                                  Ramiro Polla
-  mmvideo.c                             Peter Ross
-  mpc*                                  Kostya Shishkov
-  mpeg12.c, mpeg12data.h                Michael Niedermayer
-  mpegvideo.c, mpegvideo.h              Michael Niedermayer
-  msmpeg4.c, msmpeg4data.h              Michael Niedermayer
-  msrle.c                               Mike Melanson
-  msvideo1.c                            Mike Melanson
-  nellymoserdec.c                       Benjamin Larsson
-  nuv.c                                 Reimar Doeffinger
-  pcx.c                                 Ivo van Poorten
-  ptx.c                                 Ivo van Poorten
-  qcelp*                                Reynaldo H. Verdejo Pinochet
-  qdm2.c, qdm2data.h                    Roberto Togni, Benjamin Larsson
-  qdrw.c                                Kostya Shishkov
-  qpeg.c                                Kostya Shishkov
-  qtrle.c                               Mike Melanson
-  ra144.c, ra144.h, ra288.c, ra288.h    Roberto Togni
-  resample2.c                           Michael Niedermayer
-  rl2.c                                 Sascha Sommer
-  rpza.c                                Roberto Togni
-  rtjpeg.c, rtjpeg.h                    Reimar Doeffinger
-  rv10.c                                Michael Niedermayer
-  rv3*                                  Kostya Shishkov
-  rv4*                                  Kostya Shishkov
-  s3tc*                                 Ivo van Poorten
-  smacker.c                             Kostya Shishkov
-  smc.c                                 Mike Melanson
-  snow.c                                Michael Niedermayer, Loren Merritt
-  sonic.c                               Alex Beregszaszi
-  sunrast.c                             Ivo van Poorten
-  svq3.c                                Michael Niedermayer
-  targa.c                               Kostya Shishkov
-  tiff.c                                Kostya Shishkov
-  truemotion1*                          Mike Melanson
-  truemotion2*                          Kostya Shishkov
-  truespeech.c                          Kostya Shishkov
-  tscc.c                                Kostya Shishkov
-  tta.c                                 Alex Beregszaszi, Jaikrishnan Menon
-  txd.c                                 Ivo van Poorten
-  ulti*                                 Kostya Shishkov
-  vb.c                                  Kostya Shishkov
-  vc1*                                  Kostya Shishkov
-  vcr1.c                                Michael Niedermayer
-  vmnc.c                                Kostya Shishkov
-  vorbis_enc.c                          Oded Shimon
-  vorbis_dec.c                          Denes Balatoni
-  vp3*                                  Mike Melanson
-  vp5                                   Aurelien Jacobs
-  vp6                                   Aurelien Jacobs
-  vqavideo.c                            Mike Melanson
-  wavpack.c                             Kostya Shishkov
-  wmaprodec.c                           Sascha Sommer
-  wmavoice.c                            Ronald S. Bultje
-  wmv2.c                                Michael Niedermayer
-  wnv1.c                                Kostya Shishkov
-  xan.c                                 Mike Melanson
-  xl.c                                  Kostya Shishkov
-  xvmc.c                                Ivan Kalvachev
-  zmbv*                                 Kostya Shishkov
-
-Hardware acceleration:
-  dxva2*                                Laurent Aimar
-  vaapi*                                Gwenole Beauchesne
-  vdpau*                                Carl Eugen Hoyos
-
-
-libavdevice
-===========
-  External Interface:
-    libavdevice/avdevice.h
-
-
-  libdc1394.c                           Roman Shaposhnik
-  v4l2.c                                Luca Abeni
-  vfwcap.c                              Ramiro Polla
-
-
-libavformat
-===========
-
-Generic parts:
-  External Interface:
-    libavformat/avformat.h              Michael Niedermayer
-  Utility Code:
-    libavformat/utils.c                 Michael Niedermayer
-
-
-Muxers/Demuxers:
-  4xm.c                                 Mike Melanson
-  adtsenc.c                             Robert Swain
-  aiff.c                                Baptiste Coudurier
-  ape.c                                 Kostya Shishkov
-  avi*                                  Michael Niedermayer
-  bink.c                                Peter Ross
-  crc.c                                 Michael Niedermayer
-  daud.c                                Reimar Doeffinger
-  dv.c                                  Roman Shaposhnik
-  dxa.c                                 Kostya Shishkov
-  electronicarts.c                      Peter Ross
-  ffm*                                  Baptiste Coudurier
-  flac*                                 Justin Ruggles
-  flic.c                                Mike Melanson
-  flvdec.c, flvenc.c                    Michael Niedermayer
-  gxf.c                                 Reimar Doeffinger
-  gxfenc.c                              Baptiste Coudurier
-  idcin.c                               Mike Melanson
-  idroq.c                               Mike Melanson
-  iff.c                                 Jaikrishnan Menon
-  ipmovie.c                             Mike Melanson
-  img2.c                                Michael Niedermayer
-  iss.c                                 Stefan Gehrer
-  libnut.c                              Oded Shimon
-  lmlm4.c                               Ivo van Poorten
-  matroska.c                            Aurelien Jacobs
-  matroskadec.c                         Aurelien Jacobs
-  matroskaenc.c                         David Conrad
-  metadata*                             Aurelien Jacobs
-  mm.c                                  Peter Ross
-  mov.c                                 Michael Niedermayer, Baptiste Coudurier
-  movenc.c                              Michael Niedermayer, Baptiste Coudurier
-  mpc.c                                 Kostya Shishkov
-  mpeg.c                                Michael Niedermayer
-  mpegenc.c                             Michael Niedermayer
-  mpegts*                               Baptiste Coudurier
-  msnwc_tcp.c                           Ramiro Polla
-  mtv.c                                 Reynaldo H. Verdejo Pinochet
-  mxf*                                  Baptiste Coudurier
-  nsvdec.c                              Francois Revol
-  nut.c                                 Michael Niedermayer
-  nuv.c                                 Reimar Doeffinger
-  oggdec.c, oggdec.h                    David Conrad
-  oggenc.c                              Baptiste Coudurier
-  oggparse*.c                           David Conrad
-  psxstr.c                              Mike Melanson
-  pva.c                                 Ivo van Poorten
-  r3d.c                                 Baptiste Coudurier
-  raw.c                                 Michael Niedermayer
-  rdt.c                                 Ronald S. Bultje
-  rl2.c                                 Sascha Sommer
-  rmdec.c, rmenc.c                      Ronald S. Bultje, Kostya Shishkov
-  rtmp*                                 Kostya Shishkov
-  rtp.c, rtpenc.c                       Luca Abeni
-  rtp_asf.*                             Ronald S. Bultje
-  rtp_mpv.*, rtp_aac.*                  Luca Abeni
-  rtsp.c                                Luca Barbato
-  sdp.c                                 Luca Abeni
-  segafilm.c                            Mike Melanson
-  siff.c                                Kostya Shishkov
-  smacker.c                             Kostya Shishkov
-  swf.c                                 Baptiste Coudurier
-  tta.c                                 Alex Beregszaszi
-  txd.c                                 Ivo van Poorten
-  voc.c                                 Aurelien Jacobs
-  wav.c                                 Michael Niedermayer
-  wc3movie.c                            Mike Melanson
-  westwood.c                            Mike Melanson
-  wv.c                                  Kostya Shishkov
-
-Protocols:
-  http.c                                Ronald S. Bultje
-  udp.c                                 Luca Abeni
-
-
-Operating systems / CPU architectures
-=====================================
-
-Alpha                                   Mans Rullgard, Falk Hueffner
-ARM                                     Mans Rullgard
-AVR32                                   Mans Rullgard
-MIPS                                    Mans Rullgard
-BeOS                                    Francois Revol
-Mac OS X / PowerPC                      Romain Dolbeau, Guillaume Poirier
-Amiga / PowerPC                         Colin Ward
-Linux / PowerPC                         Luca Barbato
-Windows MinGW                           Alex Beregszaszi, Ramiro Polla
-Windows Cygwin                          Victor Paesa
-ADI/Blackfin DSP                        Marc Hoffman
-Sparc                                   Roman Shaposhnik
-x86                                     Michael Niedermayer
-
-
-GnuPG Fingerprints of maintainers and others who have svn write access
-======================================================================
-
-Attila Kinali                 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765
-Baptiste Coudurier            8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA
-Benoit Fouet                  B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
-Daniel Verkamp                78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
-Diego Biurrun                 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5
-Jaikrishnan Menon             61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
-Loren Merritt                 ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
-Michael Niedermayer           9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
-Panagiotis Issaris            515C E262 10A8 FDCE 5481 7B9C 3AD7 D9A5 071D B3A9
-Peter Ross                    A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
-Reimar Döffinger              C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
-Reinhard Tartler              9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4
-Reynaldo H. Verdejo Pinochet  6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
-Sascha Sommer                 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 18ab3a6..0000000
--- a/Makefile
+++ /dev/null
@@ -1,353 +0,0 @@
-include config.mak
-
-SRC_DIR = $(SRC_PATH_BARE)
-
-vpath %.texi $(SRC_PATH_BARE)
-
-PROGS-$(CONFIG_FFMPEG)   += ffmpeg
-PROGS-$(CONFIG_FFPLAY)   += ffplay
-PROGS-$(CONFIG_FFPROBE)  += ffprobe
-PROGS-$(CONFIG_FFSERVER) += ffserver
-
-PROGS      := $(addsuffix   $(EXESUF), $(PROGS-yes))
-PROGS_G     = $(addsuffix _g$(EXESUF), $(PROGS-yes))
-OBJS        = $(addsuffix .o,          $(PROGS-yes)) cmdutils.o
-MANPAGES    = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
-TOOLS       = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
-HOSTPROGS   = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
-
-BASENAMES   = ffmpeg ffplay ffprobe ffserver
-ALLPROGS    = $(addsuffix   $(EXESUF), $(BASENAMES))
-ALLPROGS_G  = $(addsuffix _g$(EXESUF), $(BASENAMES))
-ALLMANPAGES = $(addsuffix .1, $(BASENAMES))
-
-FFLIBS-$(CONFIG_AVDEVICE) += avdevice
-FFLIBS-$(CONFIG_AVFILTER) += avfilter
-FFLIBS-$(CONFIG_AVFORMAT) += avformat
-FFLIBS-$(CONFIG_AVCODEC)  += avcodec
-FFLIBS-$(CONFIG_POSTPROC) += postproc
-FFLIBS-$(CONFIG_SWSCALE)  += swscale
-
-FFLIBS := avutil
-
-DATA_FILES := $(wildcard $(SRC_DIR)/ffpresets/*.ffpreset)
-
-SKIPHEADERS = cmdutils_common_opts.h
-
-include common.mak
-
-FF_LDFLAGS   := $(FFLDFLAGS)
-FF_EXTRALIBS := $(FFEXTRALIBS)
-FF_DEP_LIBS  := $(DEP_LIBS)
-
-ALL_TARGETS-$(CONFIG_DOC)       += documentation
-
-ifdef PROGS
-INSTALL_TARGETS-yes             += install-progs install-data
-INSTALL_TARGETS-$(CONFIG_DOC)   += install-man
-endif
-INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
-
-all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
-
-$(PROGS): %$(EXESUF): %_g$(EXESUF)
-	$(CP) $< $@
-	$(STRIP) $@
-
-SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
-               ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
-               HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS
-
-define RESET
-$(1) :=
-$(1)-yes :=
-endef
-
-define DOSUBDIR
-$(foreach V,$(SUBDIR_VARS),$(eval $(call RESET,$(V))))
-SUBDIR := $(1)/
-include $(1)/Makefile
-endef
-
-$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
-
-ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
-ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
-
-%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
-	$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
-
-tools/%$(EXESUF): tools/%.o
-	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
-
-tools/%.o: tools/%.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_O) $<
-
-ffplay.o ffplay.d: CFLAGS += $(SDL_CFLAGS)
-
-VERSION_SH  = $(SRC_PATH_BARE)/version.sh
-GIT_LOG     = $(SRC_PATH_BARE)/.git/logs/HEAD
-SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
-
-.version: $(wildcard $(GIT_LOG) $(SVN_ENTRIES)) $(VERSION_SH) config.mak
-.version: M=@
-
-version.h .version:
-	$(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION)
-	$(Q)touch .version
-
-# force version.sh to run whenever version might have changed
--include .version
-
-alltools: $(TOOLS)
-
-documentation: $(addprefix doc/, developer.html faq.html ffmpeg-doc.html \
-                                 ffplay-doc.html ffprobe-doc.html ffserver-doc.html \
-                                 general.html libavfilter.html $(ALLMANPAGES))
-
-doc/%.html: TAG = HTML
-doc/%.html: doc/%.texi
-	$(M)cd doc && texi2html -monolithic -number $(<:doc/%=%)
-
-doc/%.pod: TAG = POD
-doc/%.pod: doc/%-doc.texi
-	$(M)doc/texi2pod.pl $< $@
-
-doc/%.1: TAG = MAN
-doc/%.1: doc/%.pod
-	$(M)pod2man --section=1 --center=" " --release=" " $< > $@
-
-install: $(INSTALL_TARGETS-yes)
-
-install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
-	$(Q)mkdir -p "$(BINDIR)"
-	$(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
-
-install-data: $(DATA_FILES)
-	$(Q)mkdir -p "$(DATADIR)"
-	$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
-
-install-man: $(MANPAGES)
-	$(Q)mkdir -p "$(MANDIR)/man1"
-	$(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
-
-uninstall: uninstall-progs uninstall-data uninstall-man
-
-uninstall-progs:
-	$(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
-
-uninstall-data:
-	$(RM) -r "$(DATADIR)"
-
-uninstall-man:
-	$(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
-
-testclean:
-	$(RM) -r tests/vsynth1 tests/vsynth2 tests/data
-	$(RM) $(addprefix tests/,$(CLEANSUFFIXES))
-	$(RM) tests/seek_test$(EXESUF) tests/seek_test.o
-	$(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
-
-clean:: testclean
-	$(RM) $(ALLPROGS) $(ALLPROGS_G)
-	$(RM) $(CLEANSUFFIXES)
-	$(RM) doc/*.html doc/*.pod doc/*.1
-	$(RM) $(TOOLS)
-
-distclean::
-	$(RM) $(DISTCLEANSUFFIXES)
-	$(RM) version.h config.* libavutil/avconfig.h
-
-config:
-	$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
-
-# regression tests
-
-check: test checkheaders
-
-fulltest test: codectest lavftest seektest
-
-FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
-SEEK_REFFILE     = $(SRC_PATH)/tests/seek.regression.ref
-
-ENCDEC = $(and $(CONFIG_$(1)_ENCODER),$(CONFIG_$(1)_DECODER))
-MUXDEM = $(and $(CONFIG_$(1)_MUXER),$(CONFIG_$(or $(2),$(1))_DEMUXER))
-
-VCODEC_TESTS =
-VCODEC_TESTS-$(call ENCDEC,ASV1)             += asv1
-VCODEC_TESTS-$(call ENCDEC,ASV2)             += asv2
-VCODEC_TESTS-$(call ENCDEC,DNXHD)            += dnxhd_1080i dnxhd_720p dnxhd_720p_rd
-VCODEC_TESTS-$(call ENCDEC,DVVIDEO)          += dv dv50
-VCODEC_TESTS-$(call ENCDEC,FFV1)             += ffv1
-VCODEC_TESTS-$(call ENCDEC,FLASHSV)          += flashsv
-VCODEC_TESTS-$(call ENCDEC,FLV)              += flv
-VCODEC_TESTS-$(call ENCDEC,H261)             += h261
-VCODEC_TESTS-$(call ENCDEC,H263)             += h263 h263p
-VCODEC_TESTS-$(call ENCDEC,HUFFYUV)          += huffyuv
-VCODEC_TESTS-$(call ENCDEC,JPEGLS)           += jpegls
-VCODEC_TESTS-$(call ENCDEC,MJPEG)            += mjpeg ljpeg
-VCODEC_TESTS-$(call ENCDEC,MPEG1VIDEO)       += mpeg mpeg1b
-VCODEC_TESTS-$(call ENCDEC,MPEG2VIDEO)       += mpeg2 mpeg2thread
-VCODEC_TESTS-$(call ENCDEC,MPEG4)            += mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc
-VCODEC_TESTS-$(call ENCDEC,MSMPEG4V1)        += msmpeg4
-VCODEC_TESTS-$(call ENCDEC,MSMPEG4V2)        += msmpeg4v2
-VCODEC_TESTS-$(call ENCDEC,ROQ)              += roq
-VCODEC_TESTS-$(call ENCDEC,RV10)             += rv10
-VCODEC_TESTS-$(call ENCDEC,RV20)             += rv20
-VCODEC_TESTS-$(call ENCDEC,SNOW)             += snow snowll
-VCODEC_TESTS-$(call ENCDEC,SVQ1)             += svq1
-VCODEC_TESTS-$(call ENCDEC,WMV1)             += wmv1
-VCODEC_TESTS-$(call ENCDEC,WMV2)             += wmv2
-
-ACODEC_TESTS =
-ACODEC_TESTS-$(call ENCDEC,AC3)              += ac3
-ACODEC_TESTS-$(call ENCDEC,ADPCM_G726)       += g726
-ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_QT)     += adpcm_ima_qt
-ACODEC_TESTS-$(call ENCDEC,ADPCM_IMA_WAV)    += adpcm_ima_wav
-ACODEC_TESTS-$(call ENCDEC,ADPCM_MS)         += adpcm_ms
-ACODEC_TESTS-$(call ENCDEC,ADPCM_SWF)        += adpcm_swf
-ACODEC_TESTS-$(call ENCDEC,ADPCM_YAMAHA)     += adpcm_yam
-ACODEC_TESTS-$(call ENCDEC,ALAC)             += alac
-ACODEC_TESTS-$(call ENCDEC,FLAC)             += flac
-ACODEC_TESTS-$(call ENCDEC,MP2)              += mp2
-ACODEC_TESTS-$(call ENCDEC,PCM_S16LE)        += pcm         # fixme
-ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav1
-ACODEC_TESTS-$(call ENCDEC,WMAV1)            += wmav2
-
-LAVF_TESTS =
-LAVF_TESTS-$(call MUXDEM,AIFF)               += aiff
-LAVF_TESTS-$(call MUXDEM,PCM_ALAW)           += alaw
-LAVF_TESTS-$(call MUXDEM,ASF)                += asf
-LAVF_TESTS-$(call MUXDEM,AU)                 += au
-LAVF_TESTS-$(call MUXDEM,AVI)                += avi
-LAVF_TESTS-$(call ENCDEC,BMP)                += bmp
-LAVF_TESTS-$(call MUXDEM,DV)                 += dv_fmt
-LAVF_TESTS-$(call MUXDEM,FFM)                += ffm
-LAVF_TESTS-$(call MUXDEM,FLV)                += flv_fmt
-LAVF_TESTS-$(call ENCDEC,GIF)                += gif
-LAVF_TESTS-$(call MUXDEM,GXF)                += gxf
-LAVF_TESTS-$(call ENCDEC,MJPEG)              += jpg
-LAVF_TESTS-$(call MUXDEM,MATROSKA)           += mkv
-LAVF_TESTS-$(call MUXDEM,MMF)                += mmf
-LAVF_TESTS-$(call MUXDEM,MOV)                += mov
-LAVF_TESTS-$(call MUXDEM,MPEG1SYSTEM,MPEGPS) += mpg
-LAVF_TESTS-$(call MUXDEM,PCM_MULAW)          += mulaw
-LAVF_TESTS-$(call MUXDEM,MXF)                += mxf
-LAVF_TESTS-$(call MUXDEM,NUT)                += nut
-LAVF_TESTS-$(call MUXDEM,OGG)                += ogg
-LAVF_TESTS-$(call ENCDEC,PBM)                += pbmpipe
-LAVF_TESTS-$(call ENCDEC,PCX)                += pcx
-LAVF_TESTS-$(call ENCDEC,PGM)                += pgm pgmpipe
-LAVF_TESTS-$(call MUXDEM,RAWVIDEO)           += pixfmt
-LAVF_TESTS-$(call ENCDEC,PPM)                += ppm ppmpipe
-LAVF_TESTS-$(call MUXDEM,RM)                 += rm
-LAVF_TESTS-$(call ENCDEC,SGI)                += sgi
-LAVF_TESTS-$(call MUXDEM,SWF)                += swf
-LAVF_TESTS-$(call ENCDEC,TARGA)              += tga
-LAVF_TESTS-$(call ENCDEC,TIFF)               += tiff
-LAVF_TESTS-$(call MUXDEM,MPEGTS)             += ts
-LAVF_TESTS-$(call MUXDEM,VOC)                += voc
-LAVF_TESTS-$(call MUXDEM,WAV)                += wav
-LAVF_TESTS-$(call MUXDEM,YUV4MPEGPIPE)       += yuv4mpeg
-
-LAVFI_TESTS =           \
-    crop                \
-    crop_scale          \
-    crop_scale_vflip    \
-    crop_vflip          \
-    null                \
-    scale200            \
-    scale500            \
-    vflip               \
-    vflip_crop          \
-    vflip_vflip         \
-
-ACODEC_TESTS := $(addprefix regtest-, $(ACODEC_TESTS) $(ACODEC_TESTS-yes))
-VCODEC_TESTS := $(addprefix regtest-, $(VCODEC_TESTS) $(VCODEC_TESTS-yes))
-LAVF_TESTS  := $(addprefix regtest-, $(LAVF_TESTS)  $(LAVF_TESTS-yes))
-LAVFI_TESTS := $(addprefix regtest-, $(LAVFI_TESTS) $(LAVFI_TESTS-yes))
-
-CODEC_TESTS = $(VCODEC_TESTS) $(ACODEC_TESTS)
-
-codectest: $(CODEC_TESTS)
-lavftest:  $(LAVF_TESTS)
-lavfitest: $(LAVFI_TESTS)
-
-$(ACODEC_TESTS): regtest-aref
-$(VCODEC_TESTS): regtest-vref
-$(LAVF_TESTS) $(LAVFI_TESTS): regtest-ref
-
-REFFILE = $(SRC_PATH)/tests/ref/$(1)/$(2:regtest-%=%)
-RESFILE = tests/data/$(2:regtest-%=%).$(1).regression
-
-define CODECTEST_CMD
-	$(SRC_PATH)/tests/codec-regression.sh $@ vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
-	$(SRC_PATH)/tests/codec-regression.sh $@ vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
-endef
-
-regtest-ref: regtest-aref regtest-vref
-
-regtest-vref: ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
-	$(CODECTEST_CMD)
-
-regtest-aref: ffmpeg$(EXESUF) tests/data/asynth1.sw
-	@$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
-
-$(VCODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
-	@echo "TEST VCODEC $(@:regtest-%=%)"
-	@$(CODECTEST_CMD)
-	@diff -u -w $(call REFFILE,vsynth1,$@) $(call RESFILE,vsynth1,$@)
-	@diff -u -w $(call REFFILE,vsynth2,$@) $(call RESFILE,vsynth2,$@)
-
-$(ACODEC_TESTS): tests/tiny_psnr$(HOSTEXESUF)
-	@echo "TEST ACODEC $(@:regtest-%=%)"
-	@$(SRC_PATH)/tests/codec-regression.sh $@ acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
-	@diff -u -w $(call REFFILE,acodec,$@) $(call RESFILE,acodec,$@)
-
-$(LAVF_TESTS):
-	@echo "TEST LAVF  $(@:regtest-%=%)"
-	@$(SRC_PATH)/tests/lavf-regression.sh $@ lavf tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
-	@diff -u -w $(call REFFILE,lavf,$@) $(call RESFILE,lavf,$@)
-
-$(LAVFI_TESTS):
-	@echo "TEST LAVFI $(@:regtest-%=%)"
-	@$(SRC_PATH)/tests/lavfi-regression.sh $@ lavfi tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
-	@diff -u -w $(call REFFILE,lavfi,$@) $(call RESFILE,lavfi,$@)
-
-seektest: codectest lavftest tests/seek_test$(EXESUF)
-	$(SRC_PATH)/tests/seek-regression.sh $(SRC_PATH) "$(TARGET_EXEC)" "$(TARGET_PATH)"
-
-ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
-	@echo
-	@echo "Unfortunately ffserver is broken and therefore its regression"
-	@echo "test fails randomly. Treat the results accordingly."
-	@echo
-	$(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
-
-tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
-	mkdir -p tests/vsynth1
-	$(BUILD_ROOT)/$< 'tests/vsynth1/'
-
-tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
-	mkdir -p tests/vsynth2
-	$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
-
-tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
-	mkdir -p tests/data
-	$(BUILD_ROOT)/$< $@
-
-tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS)
-	$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
-
-ifdef SAMPLES
-include $(SRC_PATH_BARE)/tests/fate.mak
-fate: $(FATE_TESTS)
-$(FATE_TESTS): ffmpeg$(EXESUF)
-	@echo "TEST FATE   $(@:fate-%=%)"
-	@$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)'
-else
-fate:
-	@echo "SAMPLES not specified, cannot run FATE"
-endif
-
-.PHONY: documentation *test regtest-* zlib-error alltools check config
diff --git a/README b/README
deleted file mode 100644
index 6346cff..0000000
--- a/README
+++ /dev/null
@@ -1,12 +0,0 @@
-Libav README
--------------
-
-1) Documentation
-----------------
-
-* Read the documentation in the doc/ directory.
-
-2) Licensing
-------------
-
-* See the LICENSE file.
diff --git a/RELEASE b/RELEASE
deleted file mode 100644
index ddd02e0..0000000
--- a/RELEASE
+++ /dev/null
@@ -1,146 +0,0 @@
-Release Notes
-=============
-
-* 0.6 "Works with HTML5" June, 2010
-
-General notes
--------------
-
-This release focuses on improvements for the new multimedia elements in HTML5.
-The H.264 and Theora decoders are now significantly faster, the Vorbis decoder
-has seen important updates and this release supports Google's newly released
-libvpx library for the VP8 codec and WebM container.
-
-Other important changes are additions of decoders including, but not limited to,
-Intel Indeo 5, WMA Pro, WMA Voice and HE-AAC.
-
-See the Changelog file for a list of significant changes.
-
-Please note that our policy on bug reports has not changed. We still only accept
-bug reports against HEAD of the FFmpeg trunk repository. If you are experiencing
-any issues with any formally released version of FFmpeg, please try a current
-version of the development code to check if the issue still exists. If it does,
-make your report against the development code following the usual bug reporting
-guidelines.
-
-
-API and other notable Changes
------------------------------
-
-Please see the file doc/APIchanges for programmer-centric information.
-
-Notable changes:
-- deprecated vhook subsystem removed
-- deprecated old scaler removed
-- nonfree libamr support for AMR-NB/WB decoding/encoding removed
-- RTMP support in libavformat
-- -formats option split into -formats, -codecs, -bsfs, and -protocols
-- ffprobe tool
-- RTMP/RTMPT/RTMPS/RTMPE/RTMPTE protocol support via librtmp
-- CODEC_CAP_EXPERIMENTAL added
-
-
-Added Codecs:
--------------
-
-- VQF demuxer
-- PCX encoder
-- CorePNG decoding support
-- 8088flex TMV demuxer and decoder
-- enable symbol versioning by default for linkers that support it
-- V210 decoder and encoder
-- QCP demuxer
-- SoX native format muxer and demuxer
-- AMR-NB decoding/encoding, AMR-WB decoding via OpenCORE libraries
-- DPX image decoder
-- Electronic Arts Madcow decoder
-- DivX (XSUB) subtitle encoder
-- experimental AAC encoder
-- Wave64 demuxer
-- IEC-61937 compatible Muxer
-- TwinVQ decoder
-- Bluray (PGS) subtitle decoder
-- LPCM support in MPEG-TS (HDMV RID as found on Blu-ray disks)
-- WMA Pro decoder
-- Core Audio Format demuxer
-- Atrac1 decoder
-- MD STUDIO audio demuxer
-- RF64 support in WAV demuxer
-- MPEG-4 Audio Lossless Coding (ALS) decoder
-- IV8 demuxer
-- CDG demuxer and decoder
-- R210 decoder
-- Auravision Aura 1 and 2 decoders
-- Deluxe Paint Animation playback system
-- SIPR decoder
-- Adobe Filmstrip muxer and demuxer
-- RTP packetization and depacketization of H.263 and AMR
-- Bink demuxer and audio/video decoders
-- IFF PBM/ILBM bitmap decoder
-- Indeo 5 decoder
-- WMA Voice decoder
-- AMR-NB decoder
-- RTSP muxer
-- HE-AAC v1 decoder
-- Kega Game Video (KGV1) decoder
-- Psygnosis YOP demuxer and video decoder
-- RTP hinting in the mov/3gp/mp4 muxer
-- VP8 decoding via libvpx
-
-
-Notable license related changes
--------------------------------
-
-- remaining GPL parts in AC-3 decoder converted to LGPL
-- libswscale can now be compiled in LGPL mode
-
-
-
-* 0.6.1
-
-General notes
--------------
-
-This point release includes some updates to make the 0.6 release series usable
-for users that need to retain the existing behavior as closely as possible.
-The changes follow below:
-
-Bugfixes
---------
-
-- fix autodetection of E-AC-3 substream samples
-- performance fix for seekable HTTP
-- add missing VP80 fourcc code for the VP8 codec
-- small documentation fixes
-- fix several potentially exploitable issues in the FLIC decoder
-  (addresses CVE-2010-3429)
-
-
-HE-AAC v2 backport
-------------------
-
-This release includes a backport of the AAC decoder from trunk, which
-enables proper playback of HE-AAC v2 media.
-
-
-* 0.6.2
-
-General notes
--------------
-
-This is a maintenance-only release that addresses a small number of security
-and portability issues. Distributors and system integrators are encouraged
-to update and share their patches against this branch.
-
-Security fixes
---------------
-
-Programming errors in container and codec implementations may lead to
-denial of service or the execution of arbitrary code if the user is
-tricked into opening a malformed media file or stream.
-
-Affected and updated have been the implementations of the following
-codecs and container formats:
-
- - VC1 decoder (Change related to CVE-2011-0723)
- - APE decoder (cf. http://packetstorm.linuxsecurity.com/1103-exploits/vlc105-dos.txt)
diff --git a/VERSION b/VERSION
deleted file mode 100644
index b616048..0000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.6.2
diff --git a/cmdutils.c b/cmdutils.c
deleted file mode 100644
index 23f0efe..0000000
--- a/cmdutils.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
- * Various utilities for command line tools
- * Copyright (c) 2000-2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <math.h>
-
-/* Include only the enabled headers since some compilers (namely, Sun
-   Studio) will not omit unused inline functions and create undefined
-   references to libraries that are not being built. */
-
-#include "config.h"
-#include "libavformat/avformat.h"
-#include "libavfilter/avfilter.h"
-#include "libavdevice/avdevice.h"
-#include "libswscale/swscale.h"
-#include "libpostproc/postprocess.h"
-#include "libavutil/avstring.h"
-#include "libavutil/pixdesc.h"
-#include "libavcodec/opt.h"
-#include "cmdutils.h"
-#include "version.h"
-#if CONFIG_NETWORK
-#include "libavformat/network.h"
-#endif
-#if HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-
-const char **opt_names;
-static int opt_name_count;
-AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
-AVFormatContext *avformat_opts;
-struct SwsContext *sws_opts;
-
-const int this_year = 2010;
-
-double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
-{
-    char *tail;
-    const char *error;
-    double d = strtod(numstr, &tail);
-    if (*tail)
-        error= "Expected number for %s but found: %s\n";
-    else if (d < min || d > max)
-        error= "The value for %s was %s which is not within %f - %f\n";
-    else if(type == OPT_INT64 && (int64_t)d != d)
-        error= "Expected int64 for %s but found %s\n";
-    else
-        return d;
-    fprintf(stderr, error, context, numstr, min, max);
-    exit(1);
-}
-
-int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
-{
-    int64_t us = parse_date(timestr, is_duration);
-    if (us == INT64_MIN) {
-        fprintf(stderr, "Invalid %s specification for %s: %s\n",
-                is_duration ? "duration" : "date", context, timestr);
-        exit(1);
-    }
-    return us;
-}
-
-void show_help_options(const OptionDef *options, const char *msg, int mask, int value)
-{
-    const OptionDef *po;
-    int first;
-
-    first = 1;
-    for(po = options; po->name != NULL; po++) {
-        char buf[64];
-        if ((po->flags & mask) == value) {
-            if (first) {
-                printf("%s", msg);
-                first = 0;
-            }
-            av_strlcpy(buf, po->name, sizeof(buf));
-            if (po->flags & HAS_ARG) {
-                av_strlcat(buf, " ", sizeof(buf));
-                av_strlcat(buf, po->argname, sizeof(buf));
-            }
-            printf("-%-17s  %s\n", buf, po->help);
-        }
-    }
-}
-
-static const OptionDef* find_option(const OptionDef *po, const char *name){
-    while (po->name != NULL) {
-        if (!strcmp(name, po->name))
-            break;
-        po++;
-    }
-    return po;
-}
-
-void parse_options(int argc, char **argv, const OptionDef *options,
-                   void (* parse_arg_function)(const char*))
-{
-    const char *opt, *arg;
-    int optindex, handleoptions=1;
-    const OptionDef *po;
-
-    /* parse options */
-    optindex = 1;
-    while (optindex < argc) {
-        opt = argv[optindex++];
-
-        if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
-            int bool_val = 1;
-            if (opt[1] == '-' && opt[2] == '\0') {
-                handleoptions = 0;
-                continue;
-            }
-            opt++;
-            po= find_option(options, opt);
-            if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
-                /* handle 'no' bool option */
-                po = find_option(options, opt + 2);
-                if (!(po->name && (po->flags & OPT_BOOL)))
-                    goto unknown_opt;
-                bool_val = 0;
-            }
-            if (!po->name)
-                po= find_option(options, "default");
-            if (!po->name) {
-unknown_opt:
-                fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
-                exit(1);
-            }
-            arg = NULL;
-            if (po->flags & HAS_ARG) {
-                arg = argv[optindex++];
-                if (!arg) {
-                    fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);
-                    exit(1);
-                }
-            }
-            if (po->flags & OPT_STRING) {
-                char *str;
-                str = av_strdup(arg);
-                *po->u.str_arg = str;
-            } else if (po->flags & OPT_BOOL) {
-                *po->u.int_arg = bool_val;
-            } else if (po->flags & OPT_INT) {
-                *po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
-            } else if (po->flags & OPT_INT64) {
-                *po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
-            } else if (po->flags & OPT_FLOAT) {
-                *po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
-            } else if (po->flags & OPT_FUNC2) {
-                if (po->u.func2_arg(opt, arg) < 0) {
-                    fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
-                    exit(1);
-                }
-            } else {
-                po->u.func_arg(arg);
-            }
-            if(po->flags & OPT_EXIT)
-                exit(0);
-        } else {
-            if (parse_arg_function)
-                parse_arg_function(opt);
-        }
-    }
-}
-
-int opt_default(const char *opt, const char *arg){
-    int type;
-    int ret= 0;
-    const AVOption *o= NULL;
-    int opt_types[]={AV_OPT_FLAG_VIDEO_PARAM, AV_OPT_FLAG_AUDIO_PARAM, 0, AV_OPT_FLAG_SUBTITLE_PARAM, 0};
-
-    for(type=0; type<AVMEDIA_TYPE_NB && ret>= 0; type++){
-        const AVOption *o2 = av_find_opt(avcodec_opts[0], opt, NULL, opt_types[type], opt_types[type]);
-        if(o2)
-            ret = av_set_string3(avcodec_opts[type], opt, arg, 1, &o);
-    }
-    if(!o)
-        ret = av_set_string3(avformat_opts, opt, arg, 1, &o);
-    if(!o && sws_opts)
-        ret = av_set_string3(sws_opts, opt, arg, 1, &o);
-    if(!o){
-        if(opt[0] == 'a')
-            ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_AUDIO], opt+1, arg, 1, &o);
-        else if(opt[0] == 'v')
-            ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_VIDEO], opt+1, arg, 1, &o);
-        else if(opt[0] == 's')
-            ret = av_set_string3(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], opt+1, arg, 1, &o);
-    }
-    if (o && ret < 0) {
-        fprintf(stderr, "Invalid value '%s' for option '%s'\n", arg, opt);
-        exit(1);
-    }
-    if (!o) {
-        fprintf(stderr, "Unrecognized option '%s'\n", opt);
-        exit(1);
-    }
-
-//    av_log(NULL, AV_LOG_ERROR, "%s:%s: %f 0x%0X\n", opt, arg, av_get_double(avcodec_opts, opt, NULL), (int)av_get_int(avcodec_opts, opt, NULL));
-
-    //FIXME we should always use avcodec_opts, ... for storing options so there will not be any need to keep track of what i set over this
-    opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
-    opt_names[opt_name_count++]= o->name;
-
-    if(avcodec_opts[0]->debug || avformat_opts->debug)
-        av_log_set_level(AV_LOG_DEBUG);
-    return 0;
-}
-
-int opt_loglevel(const char *opt, const char *arg)
-{
-    const struct { const char *name; int level; } log_levels[] = {
-        { "quiet"  , AV_LOG_QUIET   },
-        { "panic"  , AV_LOG_PANIC   },
-        { "fatal"  , AV_LOG_FATAL   },
-        { "error"  , AV_LOG_ERROR   },
-        { "warning", AV_LOG_WARNING },
-        { "info"   , AV_LOG_INFO    },
-        { "verbose", AV_LOG_VERBOSE },
-        { "debug"  , AV_LOG_DEBUG   },
-    };
-    char *tail;
-    int level;
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) {
-        if (!strcmp(log_levels[i].name, arg)) {
-            av_log_set_level(log_levels[i].level);
-            return 0;
-        }
-    }
-
-    level = strtol(arg, &tail, 10);
-    if (*tail) {
-        fprintf(stderr, "Invalid loglevel \"%s\". "
-                        "Possible levels are numbers or:\n", arg);
-        for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
-            fprintf(stderr, "\"%s\"\n", log_levels[i].name);
-        exit(1);
-    }
-    av_log_set_level(level);
-    return 0;
-}
-
-int opt_timelimit(const char *opt, const char *arg)
-{
-#if HAVE_SETRLIMIT
-    int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-    struct rlimit rl = { lim, lim + 1 };
-    if (setrlimit(RLIMIT_CPU, &rl))
-        perror("setrlimit");
-#else
-    fprintf(stderr, "Warning: -%s not implemented on this OS\n", opt);
-#endif
-    return 0;
-}
-
-void set_context_opts(void *ctx, void *opts_ctx, int flags)
-{
-    int i;
-    for(i=0; i<opt_name_count; i++){
-        char buf[256];
-        const AVOption *opt;
-        const char *str= av_get_string(opts_ctx, opt_names[i], &opt, buf, sizeof(buf));
-        /* if an option with name opt_names[i] is present in opts_ctx then str is non-NULL */
-        if(str && ((opt->flags & flags) == flags))
-            av_set_string3(ctx, opt_names[i], str, 1, NULL);
-    }
-}
-
-void print_error(const char *filename, int err)
-{
-    char errbuf[128];
-    const char *errbuf_ptr = errbuf;
-
-    if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
-        errbuf_ptr = strerror(AVUNERROR(err));
-    fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
-}
-
-#define PRINT_LIB_VERSION(outstream,libname,LIBNAME,indent)             \
-    if (CONFIG_##LIBNAME) {                                             \
-        unsigned int version = libname##_version();                     \
-        fprintf(outstream, "%slib%-10s %2d.%2d.%2d / %2d.%2d.%2d\n",    \
-                indent? "  " : "", #libname,                            \
-                LIB##LIBNAME##_VERSION_MAJOR,                           \
-                LIB##LIBNAME##_VERSION_MINOR,                           \
-                LIB##LIBNAME##_VERSION_MICRO,                           \
-                version >> 16, version >> 8 & 0xff, version & 0xff);    \
-    }
-
-static void print_all_lib_versions(FILE* outstream, int indent)
-{
-    PRINT_LIB_VERSION(outstream, avutil,   AVUTIL,   indent);
-    PRINT_LIB_VERSION(outstream, avcodec,  AVCODEC,  indent);
-    PRINT_LIB_VERSION(outstream, avformat, AVFORMAT, indent);
-    PRINT_LIB_VERSION(outstream, avdevice, AVDEVICE, indent);
-    PRINT_LIB_VERSION(outstream, avfilter, AVFILTER, indent);
-    PRINT_LIB_VERSION(outstream, swscale,  SWSCALE,  indent);
-    PRINT_LIB_VERSION(outstream, postproc, POSTPROC, indent);
-}
-
-static void maybe_print_config(const char *lib, const char *cfg)
-{
-    static int warned_cfg;
-
-    if (strcmp(FFMPEG_CONFIGURATION, cfg)) {
-        if (!warned_cfg) {
-            fprintf(stderr, "  WARNING: library configuration mismatch\n");
-            warned_cfg = 1;
-        }
-        fprintf(stderr, "  %-11s configuration: %s\n", lib, cfg);
-    }
-}
-
-#define PRINT_LIB_CONFIG(lib, tag, cfg) do {    \
-        if (CONFIG_##lib)                       \
-            maybe_print_config(tag, cfg);       \
-    } while (0)
-
-void show_banner(void)
-{
-    fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d the Libav developers\n",
-            program_name, program_birth_year, this_year);
-    fprintf(stderr, "  built on %s %s with %s %s\n",
-            __DATE__, __TIME__, CC_TYPE, CC_VERSION);
-    fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
-    PRINT_LIB_CONFIG(AVUTIL,   "libavutil",   avutil_configuration());
-    PRINT_LIB_CONFIG(AVCODEC,  "libavcodec",  avcodec_configuration());
-    PRINT_LIB_CONFIG(AVFORMAT, "libavformat", avformat_configuration());
-    PRINT_LIB_CONFIG(AVDEVICE, "libavdevice", avdevice_configuration());
-    PRINT_LIB_CONFIG(AVFILTER, "libavfilter", avfilter_configuration());
-    PRINT_LIB_CONFIG(SWSCALE,  "libswscale",  swscale_configuration());
-    PRINT_LIB_CONFIG(POSTPROC, "libpostproc", postproc_configuration());
-    print_all_lib_versions(stderr, 1);
-}
-
-void show_version(void) {
-    printf("%s " FFMPEG_VERSION "\n", program_name);
-    print_all_lib_versions(stdout, 0);
-}
-
-void show_license(void)
-{
-    printf(
-#if CONFIG_NONFREE
-    "This version of %s has nonfree parts compiled in.\n"
-    "Therefore it is not legally redistributable.\n",
-    program_name
-#elif CONFIG_GPLV3
-    "%s is free software; you can redistribute it and/or modify\n"
-    "it under the terms of the GNU General Public License as published by\n"
-    "the Free Software Foundation; either version 3 of the License, or\n"
-    "(at your option) any later version.\n"
-    "\n"
-    "%s is distributed in the hope that it will be useful,\n"
-    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
-    "GNU General Public License for more details.\n"
-    "\n"
-    "You should have received a copy of the GNU General Public License\n"
-    "along with %s.  If not, see <http://www.gnu.org/licenses/>.\n",
-    program_name, program_name, program_name
-#elif CONFIG_GPL
-    "%s is free software; you can redistribute it and/or modify\n"
-    "it under the terms of the GNU General Public License as published by\n"
-    "the Free Software Foundation; either version 2 of the License, or\n"
-    "(at your option) any later version.\n"
-    "\n"
-    "%s is distributed in the hope that it will be useful,\n"
-    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
-    "GNU General Public License for more details.\n"
-    "\n"
-    "You should have received a copy of the GNU General Public License\n"
-    "along with %s; if not, write to the Free Software\n"
-    "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
-    program_name, program_name, program_name
-#elif CONFIG_LGPLV3
-    "%s is free software; you can redistribute it and/or modify\n"
-    "it under the terms of the GNU Lesser General Public License as published by\n"
-    "the Free Software Foundation; either version 3 of the License, or\n"
-    "(at your option) any later version.\n"
-    "\n"
-    "%s is distributed in the hope that it will be useful,\n"
-    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
-    "GNU Lesser General Public License for more details.\n"
-    "\n"
-    "You should have received a copy of the GNU Lesser General Public License\n"
-    "along with %s.  If not, see <http://www.gnu.org/licenses/>.\n",
-    program_name, program_name, program_name
-#else
-    "%s is free software; you can redistribute it and/or\n"
-    "modify it under the terms of the GNU Lesser General Public\n"
-    "License as published by the Free Software Foundation; either\n"
-    "version 2.1 of the License, or (at your option) any later version.\n"
-    "\n"
-    "%s is distributed in the hope that it will be useful,\n"
-    "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-    "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
-    "Lesser General Public License for more details.\n"
-    "\n"
-    "You should have received a copy of the GNU Lesser General Public\n"
-    "License along with %s; if not, write to the Free Software\n"
-    "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n",
-    program_name, program_name, program_name
-#endif
-    );
-}
-
-void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts)
-{
-    int i;
-    char fmt_str[128];
-    for (i=-1; i < nb_fmts; i++) {
-        get_fmt_string (fmt_str, sizeof(fmt_str), i);
-        fprintf(stdout, "%s\n", fmt_str);
-    }
-}
-
-void show_formats(void)
-{
-    AVInputFormat *ifmt=NULL;
-    AVOutputFormat *ofmt=NULL;
-    const char *last_name;
-
-    printf(
-        "File formats:\n"
-        " D. = Demuxing supported\n"
-        " .E = Muxing supported\n"
-        " --\n");
-    last_name= "000";
-    for(;;){
-        int decode=0;
-        int encode=0;
-        const char *name=NULL;
-        const char *long_name=NULL;
-
-        while((ofmt= av_oformat_next(ofmt))) {
-            if((name == NULL || strcmp(ofmt->name, name)<0) &&
-                strcmp(ofmt->name, last_name)>0){
-                name= ofmt->name;
-                long_name= ofmt->long_name;
-                encode=1;
-            }
-        }
-        while((ifmt= av_iformat_next(ifmt))) {
-            if((name == NULL || strcmp(ifmt->name, name)<0) &&
-                strcmp(ifmt->name, last_name)>0){
-                name= ifmt->name;
-                long_name= ifmt->long_name;
-                encode=0;
-            }
-            if(name && strcmp(ifmt->name, name)==0)
-                decode=1;
-        }
-        if(name==NULL)
-            break;
-        last_name= name;
-
-        printf(
-            " %s%s %-15s %s\n",
-            decode ? "D":" ",
-            encode ? "E":" ",
-            name,
-            long_name ? long_name:" ");
-    }
-}
-
-void show_codecs(void)
-{
-    AVCodec *p=NULL, *p2;
-    const char *last_name;
-    printf(
-        "Codecs:\n"
-        " D..... = Decoding supported\n"
-        " .E.... = Encoding supported\n"
-        " ..V... = Video codec\n"
-        " ..A... = Audio codec\n"
-        " ..S... = Subtitle codec\n"
-        " ...S.. = Supports draw_horiz_band\n"
-        " ....D. = Supports direct rendering method 1\n"
-        " .....T = Supports weird frame truncation\n"
-        " ------\n");
-    last_name= "000";
-    for(;;){
-        int decode=0;
-        int encode=0;
-        int cap=0;
-        const char *type_str;
-
-        p2=NULL;
-        while((p= av_codec_next(p))) {
-            if((p2==NULL || strcmp(p->name, p2->name)<0) &&
-                strcmp(p->name, last_name)>0){
-                p2= p;
-                decode= encode= cap=0;
-            }
-            if(p2 && strcmp(p->name, p2->name)==0){
-                if(p->decode) decode=1;
-                if(p->encode) encode=1;
-                cap |= p->capabilities;
-            }
-        }
-        if(p2==NULL)
-            break;
-        last_name= p2->name;
-
-        switch(p2->type) {
-        case AVMEDIA_TYPE_VIDEO:
-            type_str = "V";
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            type_str = "A";
-            break;
-        case AVMEDIA_TYPE_SUBTITLE:
-            type_str = "S";
-            break;
-        default:
-            type_str = "?";
-            break;
-        }
-        printf(
-            " %s%s%s%s%s%s %-15s %s",
-            decode ? "D": (/*p2->decoder ? "d":*/" "),
-            encode ? "E":" ",
-            type_str,
-            cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S":" ",
-            cap & CODEC_CAP_DR1 ? "D":" ",
-            cap & CODEC_CAP_TRUNCATED ? "T":" ",
-            p2->name,
-            p2->long_name ? p2->long_name : "");
-       /* if(p2->decoder && decode==0)
-            printf(" use %s for decoding", p2->decoder->name);*/
-        printf("\n");
-    }
-    printf("\n");
-    printf(
-"Note, the names of encoders and decoders do not always match, so there are\n"
-"several cases where the above table shows encoder only or decoder only entries\n"
-"even though both encoding and decoding are supported. For example, the h263\n"
-"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
-"worse.\n");
-}
-
-void show_bsfs(void)
-{
-    AVBitStreamFilter *bsf=NULL;
-
-    printf("Bitstream filters:\n");
-    while((bsf = av_bitstream_filter_next(bsf)))
-        printf("%s\n", bsf->name);
-    printf("\n");
-}
-
-void show_protocols(void)
-{
-    URLProtocol *up=NULL;
-
-    printf("Supported file protocols:\n");
-    while((up = av_protocol_next(up)))
-        printf("%s\n", up->name);
-}
-
-void show_filters(void)
-{
-    AVFilter av_unused(**filter) = NULL;
-
-    printf("Filters:\n");
-#if CONFIG_AVFILTER
-    while ((filter = av_filter_next(filter)) && *filter)
-        printf("%-16s %s\n", (*filter)->name, (*filter)->description);
-#endif
-}
-
-void show_pix_fmts(void)
-{
-    enum PixelFormat pix_fmt;
-
-    printf(
-        "Pixel formats:\n"
-        "I.... = Supported Input  format for conversion\n"
-        ".O... = Supported Output format for conversion\n"
-        "..H.. = Hardware accelerated format\n"
-        "...P. = Paletted format\n"
-        "....B = Bitstream format\n"
-        "FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL\n"
-        "-----\n");
-
-#if !CONFIG_SWSCALE
-#   define sws_isSupportedInput(x)  0
-#   define sws_isSupportedOutput(x) 0
-#endif
-
-    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++) {
-        const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
-        printf("%c%c%c%c%c %-16s       %d            %2d\n",
-               sws_isSupportedInput (pix_fmt)      ? 'I' : '.',
-               sws_isSupportedOutput(pix_fmt)      ? 'O' : '.',
-               pix_desc->flags & PIX_FMT_HWACCEL   ? 'H' : '.',
-               pix_desc->flags & PIX_FMT_PAL       ? 'P' : '.',
-               pix_desc->flags & PIX_FMT_BITSTREAM ? 'B' : '.',
-               pix_desc->name,
-               pix_desc->nb_components,
-               av_get_bits_per_pixel(pix_desc));
-    }
-}
-
-int read_yesno(void)
-{
-    int c = getchar();
-    int yesno = (toupper(c) == 'Y');
-
-    while (c != '\n' && c != EOF)
-        c = getchar();
-
-    return yesno;
-}
-
-int read_file(const char *filename, char **bufptr, size_t *size)
-{
-    FILE *f = fopen(filename, "rb");
-
-    if (!f) {
-        fprintf(stderr, "Cannot read file '%s': %s\n", filename, strerror(errno));
-        return AVERROR(errno);
-    }
-    fseek(f, 0, SEEK_END);
-    *size = ftell(f);
-    fseek(f, 0, SEEK_SET);
-    *bufptr = av_malloc(*size + 1);
-    if (!*bufptr) {
-        fprintf(stderr, "Could not allocate file buffer\n");
-        fclose(f);
-        return AVERROR(ENOMEM);
-    }
-    fread(*bufptr, 1, *size, f);
-    (*bufptr)[*size++] = '\0';
-
-    fclose(f);
-    return 0;
-}
diff --git a/cmdutils.h b/cmdutils.h
deleted file mode 100644
index 5656370..0000000
--- a/cmdutils.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Various utilities for command line tools
- * copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef FFMPEG_CMDUTILS_H
-#define FFMPEG_CMDUTILS_H
-
-#include <inttypes.h>
-#include "libavcodec/avcodec.h"
-#include "libavformat/avformat.h"
-#include "libswscale/swscale.h"
-
-/**
- * program name, defined by the program for show_version().
- */
-extern const char program_name[];
-
-/**
- * program birth year, defined by the program for show_banner()
- */
-extern const int program_birth_year;
-
-extern const int this_year;
-
-extern const char **opt_names;
-extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
-extern AVFormatContext *avformat_opts;
-extern struct SwsContext *sws_opts;
-
-/**
- * Fallback for options that are not explicitly handled, these will be
- * parsed through AVOptions.
- */
-int opt_default(const char *opt, const char *arg);
-
-/**
- * Sets the libav* libraries log level.
- */
-int opt_loglevel(const char *opt, const char *arg);
-
-/**
- * Limit the execution time.
- */
-int opt_timelimit(const char *opt, const char *arg);
-
-/**
- * Parses a string and returns its corresponding value as a double.
- * Exits from the application if the string cannot be correctly
- * parsed or the corresponding value is invalid.
- *
- * @param context the context of the value to be set (e.g. the
- * corresponding commandline option name)
- * @param numstr the string to be parsed
- * @param type the type (OPT_INT64 or OPT_FLOAT) as which the
- * string should be parsed
- * @param min the minimum valid accepted value
- * @param max the maximum valid accepted value
- */
-double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max);
-
-/**
- * Parses a string specifying a time and returns its corresponding
- * value as a number of microseconds. Exits from the application if
- * the string cannot be correctly parsed.
- *
- * @param context the context of the value to be set (e.g. the
- * corresponding commandline option name)
- * @param timestr the string to be parsed
- * @param is_duration a flag which tells how to interpret timestr, if
- * not zero timestr is interpreted as a duration, otherwise as a
- * date
- *
- * @see parse_date()
- */
-int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
-
-typedef struct {
-    const char *name;
-    int flags;
-#define HAS_ARG    0x0001
-#define OPT_BOOL   0x0002
-#define OPT_EXPERT 0x0004
-#define OPT_STRING 0x0008
-#define OPT_VIDEO  0x0010
-#define OPT_AUDIO  0x0020
-#define OPT_GRAB   0x0040
-#define OPT_INT    0x0080
-#define OPT_FLOAT  0x0100
-#define OPT_SUBTITLE 0x0200
-#define OPT_FUNC2  0x0400
-#define OPT_INT64  0x0800
-#define OPT_EXIT   0x1000
-     union {
-        void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
-        int *int_arg;
-        char **str_arg;
-        float *float_arg;
-        int (*func2_arg)(const char *, const char *);
-        int64_t *int64_arg;
-    } u;
-    const char *help;
-    const char *argname;
-} OptionDef;
-
-void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
-
-/**
- * Parses the command line arguments.
- * @param options Array with the definitions required to interpret every
- * option of the form: -<option_name> [<argument>]
- * @param parse_arg_function Name of the function called to process every
- * argument without a leading option name flag. NULL if such arguments do
- * not have to be processed.
- */
-void parse_options(int argc, char **argv, const OptionDef *options,
-                   void (* parse_arg_function)(const char*));
-
-void set_context_opts(void *ctx, void *opts_ctx, int flags);
-
-/**
- * Prints an error message to stderr, indicating filename and a human
- * readable description of the error code err.
- *
- * If strerror_r() is not available the use of this function in a
- * multithreaded application may be unsafe.
- *
- * @see av_strerror()
- */
-void print_error(const char *filename, int err);
-
-void list_fmts(void (*get_fmt_string)(char *buf, int buf_size, int fmt), int nb_fmts);
-
-/**
- * Prints the program banner to stderr. The banner contents depend on the
- * current version of the repository and of the libav* libraries used by
- * the program.
- */
-void show_banner(void);
-
-/**
- * Prints the version of the program to stdout. The version message
- * depends on the current versions of the repository and of the libav*
- * libraries.
- */
-void show_version(void);
-
-/**
- * Prints the license of the program to stdout. The license depends on
- * the license of the libraries compiled into the program.
- */
-void show_license(void);
-
-/**
- * Prints a listing containing all the formats supported by the
- * program.
- */
-void show_formats(void);
-
-/**
- * Prints a listing containing all the codecs supported by the
- * program.
- */
-void show_codecs(void);
-
-/**
- * Prints a listing containing all the filters supported by the
- * program.
- */
-void show_filters(void);
-
-/**
- * Prints a listing containing all the bit stream filters supported by the
- * program.
- */
-void show_bsfs(void);
-
-/**
- * Prints a listing containing all the protocols supported by the
- * program.
- */
-void show_protocols(void);
-
-/**
- * Prints a listing containing all the pixel formats supported by the
- * program.
- */
-void show_pix_fmts(void);
-
-/**
- * Returns a positive value if reads from standard input a line
- * starting with [yY], otherwise returns 0.
- */
-int read_yesno(void);
-
-/**
- * Reads the file with name filename, and puts its content in a newly
- * allocated 0-terminated buffer.
- *
- * @param bufptr puts here the pointer to the newly allocated buffer
- * @param size puts here the size of the newly allocated buffer
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR error code in case of failure.
- */
-int read_file(const char *filename, char **bufptr, size_t *size);
-
-#endif /* FFMPEG_CMDUTILS_H */
diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h
deleted file mode 100644
index da30997..0000000
--- a/cmdutils_common_opts.h
+++ /dev/null
@@ -1,13 +0,0 @@
-    { "L", OPT_EXIT, {(void*)show_license}, "show license" },
-    { "h", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "?", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "help", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "-help", OPT_EXIT, {(void*)show_help}, "show help" },
-    { "version", OPT_EXIT, {(void*)show_version}, "show version" },
-    { "formats"  , OPT_EXIT, {(void*)show_formats  }, "show available formats" },
-    { "codecs"   , OPT_EXIT, {(void*)show_codecs   }, "show available codecs" },
-    { "bsfs"     , OPT_EXIT, {(void*)show_bsfs     }, "show available bit stream filters" },
-    { "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
-    { "filters",   OPT_EXIT, {(void*)show_filters  }, "show available filters" },
-    { "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
-    { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
diff --git a/common.mak b/common.mak
deleted file mode 100644
index 25a5d81..0000000
--- a/common.mak
+++ /dev/null
@@ -1,109 +0,0 @@
-#
-# common bits used by all libraries
-#
-
-# first so "all" becomes default target
-all: all-yes
-
-ifndef SUBDIR
-vpath %.c   $(SRC_DIR)
-vpath %.h   $(SRC_DIR)
-vpath %.S   $(SRC_DIR)
-vpath %.asm $(SRC_DIR)
-vpath %.v   $(SRC_DIR)
-
-ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
-BUILD_ROOT_REL = .
-else
-BUILD_ROOT_REL = ..
-endif
-
-ifndef V
-Q      = @
-ECHO   = printf "$(1)\t%s\n" $(2)
-BRIEF  = CC AS YASM AR LD HOSTCC STRIP CP
-SILENT = DEPCC YASMDEP RM RANLIB
-MSG    = $@
-M      = @$(call ECHO,$(TAG),$@);
-$(foreach VAR,$(BRIEF), \
-    $(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
-$(foreach VAR,$(SILENT),$(eval $(VAR) = @$($(VAR))))
-$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
-endif
-
-ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
-
-CPPFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
-CFLAGS   += $(ECFLAGS)
-
-%.o: %.c
-	$(CCDEP)
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
-
-%.o: %.S
-	$(ASDEP)
-	$(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
-
-%.ho: %.h
-	$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
-
-%$(EXESUF): %.c
-
-%.ver: %.v
-	$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
-
-%.c %.h: TAG = GEN
-
-install: install-libs install-headers
-install-libs: install-libs-yes
-
-uninstall: uninstall-libs uninstall-headers
-
-.PHONY: all depend dep *clean install* uninstall* examples testprogs
-
-# Disable suffix rules.  Most of the builtin rules are suffix rules,
-# so this saves some time on slow systems.
-.SUFFIXES:
-
-# Do not delete intermediate files from chains of implicit rules
-$(OBJS):
-endif
-
-OBJS-$(HAVE_MMX) +=  $(MMX-OBJS-yes)
-
-CFLAGS    += $(CFLAGS-yes)
-OBJS      += $(OBJS-yes)
-FFLIBS    := $(FFLIBS-yes) $(FFLIBS)
-TESTPROGS += $(TESTPROGS-yes)
-
-FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
-FFLDFLAGS   := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
-
-EXAMPLES  := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
-OBJS      := $(addprefix $(SUBDIR),$(sort $(OBJS)))
-TESTOBJS  := $(addprefix $(SUBDIR),$(TESTOBJS))
-TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
-HOSTOBJS  := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
-HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
-
-DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
-
-ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
-SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
-SKIPHEADERS := $(addprefix $(SUBDIR),$(SKIPHEADERS-) $(SKIPHEADERS))
-checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
-
-$(HOSTOBJS): %.o: %.c
-	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
-
-$(HOSTPROGS): %$(HOSTEXESUF): %.o
-	$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS)
-
-DEPS := $(OBJS:.o=.d)
-depend dep: $(DEPS)
-
-CLEANSUFFIXES     = *.d *.o *~ *.ho *.map *.ver
-DISTCLEANSUFFIXES = *.pc
-LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
-
--include $(wildcard $(DEPS))
diff --git a/configure b/configure
deleted file mode 100755
index 3f5176e..0000000
--- a/configure
+++ /dev/null
@@ -1,3172 +0,0 @@
-#!/bin/sh
-#
-# Libav configure script
-#
-# Copyright (c) 2000-2002 Fabrice Bellard
-# Copyright (c) 2005-2008 Diego Biurrun
-# Copyright (c) 2005-2008 Mans Rullgard
-#
-
-# Prevent locale nonsense from breaking basic text processing.
-LC_ALL=C
-export LC_ALL
-
-# make sure we are running under a compatible shell
-# try to make this part work with most shells
-
-try_exec(){
-    echo "Trying shell $1"
-    type "$1" > /dev/null 2>&1 && exec "$@"
-}
-
-unset foo
-(: ${foo%%bar}) 2> /dev/null
-E1="$?"
-
-(: ${foo?}) 2> /dev/null
-E2="$?"
-
-if test "$E1" != 0 || test "$E2" = 0; then
-    echo "Broken shell detected.  Trying alternatives."
-    export FF_CONF_EXEC
-    if test "0$FF_CONF_EXEC" -lt 1; then
-        FF_CONF_EXEC=1
-        try_exec bash "$0" "$@"
-    fi
-    if test "0$FF_CONF_EXEC" -lt 2; then
-        FF_CONF_EXEC=2
-        try_exec ksh "$0" "$@"
-    fi
-    if test "0$FF_CONF_EXEC" -lt 3; then
-        FF_CONF_EXEC=3
-        try_exec /usr/xpg4/bin/sh "$0" "$@"
-    fi
-    echo "No compatible shell script interpreter found."
-    echo "This configure script requires a POSIX-compatible shell"
-    echo "such as bash or ksh."
-    echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
-    echo "Instead, install a working POSIX-compatible shell."
-    echo "Disabling this configure test will create a broken Libav."
-    if test "$BASH_VERSION" = '2.04.0(1)-release'; then
-        echo "This bash version ($BASH_VERSION) is broken on your platform."
-        echo "Upgrade to a later version if available."
-    fi
-    exit 1
-fi
-
-show_help(){
-cat <<EOF
-Usage: configure [options]
-Options: [defaults in brackets after descriptions]
-
-Standard options:
-  --help                   print this message
-  --logfile=FILE           log tests and output to FILE [config.err]
-  --disable-logging        do not log configure debug information
-  --prefix=PREFIX          install in PREFIX [$prefix]
-  --bindir=DIR             install binaries in DIR [PREFIX/bin]
-  --datadir=DIR            install data files in DIR [PREFIX/share/ffmpeg]
-  --libdir=DIR             install libs in DIR [PREFIX/lib]
-  --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]
-  --incdir=DIR             install includes in DIR [PREFIX/include]
-  --mandir=DIR             install man page in DIR [PREFIX/share/man]
-
-Configuration options:
-  --disable-static         do not build static libraries [no]
-  --enable-shared          build shared libraries [no]
-  --enable-gpl             allow use of GPL code, the resulting libs
-                           and binaries will be under GPL [no]
-  --enable-version3        upgrade (L)GPL to version 3 [no]
-  --enable-nonfree         allow use of nonfree code, the resulting libs
-                           and binaries will be unredistributable [no]
-  --disable-doc            do not build documentation
-  --disable-ffmpeg         disable ffmpeg build
-  --disable-ffplay         disable ffplay build
-  --disable-ffprobe        disable ffprobe build
-  --disable-ffserver       disable ffserver build
-  --disable-avdevice       disable libavdevice build
-  --disable-avcodec        disable libavcodec build
-  --disable-avformat       disable libavformat build
-  --disable-swscale        disable libswscale build
-  --enable-postproc        enable GPLed postprocessing support [no]
-  --enable-avfilter        video filter support [no]
-  --enable-avfilter-lavf   video filters dependent on avformat [no]
-  --enable-beosthreads     use BeOS threads [no]
-  --enable-os2threads      use OS/2 threads [no]
-  --enable-pthreads        use pthreads [no]
-  --enable-w32threads      use Win32 threads [no]
-  --enable-x11grab         enable X11 grabbing [no]
-  --disable-network        disable network support [no]
-  --disable-mpegaudio-hp   faster (but less accurate) MPEG audio decoding [no]
-  --enable-gray            enable full grayscale support (slower color)
-  --disable-swscale-alpha  disable alpha channel support in swscale
-  --disable-fastdiv        disable table-based division
-  --enable-small           optimize for size instead of speed
-  --disable-aandct         disable AAN DCT code
-  --disable-dct            disable DCT code
-  --disable-fft            disable FFT code
-  --disable-golomb         disable Golomb code
-  --disable-lpc            disable LPC code
-  --disable-mdct           disable MDCT code
-  --disable-rdft           disable RDFT code
-  --disable-vaapi          disable VAAPI code
-  --disable-vdpau          disable VDPAU code
-  --disable-dxva2          disable DXVA2 code
-  --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
-  --enable-hardcoded-tables use hardcoded tables instead of runtime generation
-  --enable-memalign-hack   emulate memalign, interferes with memory debuggers
-  --enable-beos-netserver  enable BeOS netserver
-  --disable-everything     disable all components listed below
-  --disable-encoder=NAME   disable encoder NAME
-  --enable-encoder=NAME    enable encoder NAME
-  --disable-encoders       disable all encoders
-  --disable-decoder=NAME   disable decoder NAME
-  --enable-decoder=NAME    enable decoder NAME
-  --disable-decoders       disable all decoders
-  --disable-hwaccel=NAME   disable hwaccel NAME
-  --enable-hwaccel=NAME    enable hwaccel NAME
-  --disable-hwaccels       disable all hwaccels
-  --disable-muxer=NAME     disable muxer NAME
-  --enable-muxer=NAME      enable muxer NAME
-  --disable-muxers         disable all muxers
-  --disable-demuxer=NAME   disable demuxer NAME
-  --enable-demuxer=NAME    enable demuxer NAME
-  --disable-demuxers       disable all demuxers
-  --enable-parser=NAME     enable parser NAME
-  --disable-parser=NAME    disable parser NAME
-  --disable-parsers        disable all parsers
-  --enable-bsf=NAME        enable bitstream filter NAME
-  --disable-bsf=NAME       disable bitstream filter NAME
-  --disable-bsfs           disable all bitstream filters
-  --enable-protocol=NAME   enable protocol NAME
-  --disable-protocol=NAME  disable protocol NAME
-  --disable-protocols      disable all protocols
-  --disable-indev=NAME     disable input device NAME
-  --disable-outdev=NAME    disable output device NAME
-  --disable-indevs         disable input devices
-  --disable-outdevs        disable output devices
-  --disable-devices        disable all devices
-  --enable-filter=NAME     enable filter NAME
-  --disable-filter=NAME    disable filter NAME
-  --disable-filters        disable all filters
-  --list-decoders          show all available decoders
-  --list-encoders          show all available encoders
-  --list-hwaccels          show all available hardware accelerators
-  --list-muxers            show all available muxers
-  --list-demuxers          show all available demuxers
-  --list-parsers           show all available parsers
-  --list-protocols         show all available protocols
-  --list-bsfs              show all available bitstream filters
-  --list-indevs            show all available input devices
-  --list-outdevs           show all available output devices
-  --list-filters           show all available filters
-
-External library support:
-  --enable-avisynth        enable reading of AVISynth script files [no]
-  --enable-bzlib           enable bzlib [autodetect]
-  --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
-  --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
-  --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
-                           and libraw1394 [no]
-  --enable-libdirac        enable Dirac support via libdirac [no]
-  --enable-libfaac         enable FAAC support via libfaac [no]
-  --enable-libfaad         enable FAAD support via libfaad [no]
-  --enable-libfaadbin      open libfaad.so.0 at runtime [no]
-  --enable-libgsm          enable GSM support via libgsm [no]
-  --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
-  --enable-libnut          enable NUT (de)muxing via libnut,
-                           native (de)muxer exists [no]
-  --enable-libopenjpeg     enable JPEG 2000 decoding via OpenJPEG [no]
-  --enable-librtmp         enable RTMP[E] support via librtmp [no]
-  --enable-libschroedinger enable Dirac support via libschroedinger [no]
-  --enable-libspeex        enable Speex decoding via libspeex [no]
-  --enable-libtheora       enable Theora encoding via libtheora [no]
-  --enable-libvorbis       enable Vorbis encoding via libvorbis,
-                           native implementation exists [no]
-  --enable-libvpx          enable VP8 support via libvpx [no]
-  --enable-libx264         enable H.264 encoding via x264 [no]
-  --enable-libxvid         enable Xvid encoding via xvidcore,
-                           native MPEG-4/Xvid encoder exists [no]
-  --enable-mlib            enable Sun medialib [no]
-  --enable-zlib            enable zlib [autodetect]
-
-Advanced options (experts only):
-  --source-path=PATH       path to source code [$source_path]
-  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
-  --enable-cross-compile   assume a cross-compiler is used
-  --sysroot=PATH           root of cross-build tree
-  --sysinclude=PATH        location of cross-build system headers
-  --target-os=OS           compiler targets OS [$target_os]
-  --target-exec=CMD        command to run executables on target
-  --target-path=DIR        path to view of build directory on target
-  --nm=NM                  use nm tool
-  --ar=AR                  use archive tool AR [$ar_default]
-  --as=AS                  use assembler AS [$as_default]
-  --cc=CC                  use C compiler CC [$cc_default]
-  --ld=LD                  use linker LD
-  --host-cc=HOSTCC         use host C compiler HOSTCC
-  --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
-  --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
-  --host-libs=HLIBS        use libs HLIBS when linking for host
-  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
-  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
-  --extra-libs=ELIBS       add ELIBS [$ELIBS]
-  --extra-version=STRING   version string suffix []
-  --build-suffix=SUFFIX    library name suffix []
-  --arch=ARCH              select architecture [$arch]
-  --cpu=CPU                select the minimum required CPU (affects
-                           instruction selection, may crash on older CPUs)
-  --enable-powerpc-perf    enable performance report on PPC
-                           (requires enabling PMC)
-  --disable-asm            disable all assembler optimizations
-  --disable-altivec        disable AltiVec optimizations
-  --disable-amd3dnow       disable 3DNow! optimizations
-  --disable-amd3dnowext    disable 3DNow! extended optimizations
-  --disable-mmx            disable MMX optimizations
-  --disable-mmx2           disable MMX2 optimizations
-  --disable-sse            disable SSE optimizations
-  --disable-ssse3          disable SSSE3 optimizations
-  --disable-armv5te        disable armv5te optimizations
-  --disable-armv6          disable armv6 optimizations
-  --disable-armv6t2        disable armv6t2 optimizations
-  --disable-armvfp         disable ARM VFP optimizations
-  --disable-iwmmxt         disable iwmmxt optimizations
-  --disable-mmi            disable MMI optimizations
-  --disable-neon           disable neon optimizations
-  --disable-vis            disable VIS optimizations
-  --disable-yasm           disable use of yasm assembler
-  --enable-pic             build position-independent code
-  --malloc-prefix=PFX      prefix malloc and related names with PFX
-  --enable-sram            allow use of on-chip SRAM
-
-Developer options (useful when working on Libav itself):
-  --disable-debug          disable debugging symbols
-  --enable-debug=LEVEL     set the debug level [$debuglevel]
-  --enable-gprof           enable profiling with gprof [$gprof]
-  --disable-optimizations  disable compiler optimizations
-  --enable-extra-warnings  enable more compiler warnings
-  --disable-stripping      disable stripping of executables and shared libraries
-  --samples=PATH           location of test samples for FATE
-
-NOTE: Object files are built at the place where configure is launched.
-EOF
-  exit 0
-}
-
-quotes='""'
-
-log(){
-    echo "$@" >> $logfile
-}
-
-log_file(){
-    log BEGIN $1
-    pr -n -t $1 >> $logfile
-    log END $1
-}
-
-echolog(){
-    log "$@"
-    echo "$@"
-}
-
-die(){
-    echolog "$@"
-    cat <<EOF
-
-If you think configure made a mistake, make sure you are using the latest
-version from Git.  If the latest version fails, report the problem to the
-libav-user at libav.org mailing list or IRC #libav on irc.freenode.net.
-EOF
-    if disabled logging; then
-        cat <<EOF
-Rerun configure with logging enabled (do not use --disable-logging), and
-include the log this produces with your report.
-EOF
-    else
-cat <<EOF
-Include the log file "$logfile" produced by configure as this will help
-solving the problem.
-EOF
-    fi
-    exit 1
-}
-
-# Avoid locale weirdness, besides we really just want to translate ASCII.
-toupper(){
-    echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
-}
-
-tolower(){
-    echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
-}
-
-c_escape(){
-    echo "$*" | sed 's/["\\]/\\\0/g'
-}
-
-sh_quote(){
-    v=$(echo "$1" | sed "s/'/'\\\\''/g")
-    test "$v" = "${v#*[ |&;<>()$\`\\\"\'*?\[\]#~=%]}" || v="'$v'"
-    echo "$v"
-}
-
-filter(){
-    pat=$1
-    shift
-    for v; do
-        eval "case $v in $pat) echo $v ;; esac"
-    done
-}
-
-map(){
-    m=$1
-    shift
-    for v; do eval $m; done
-}
-
-set_all(){
-    value=$1
-    shift
-    for var in $*; do
-        eval $var=$value
-    done
-}
-
-set_weak(){
-    value=$1
-    shift
-    for var; do
-        eval : \${$var:=$value}
-    done
-}
-
-pushvar(){
-    for var in $*; do
-        eval level=\${${var}_level:=0}
-        eval ${var}_${level}="\$$var"
-        eval ${var}_level=$(($level+1))
-    done
-}
-
-popvar(){
-    for var in $*; do
-        eval level=\${${var}_level:-0}
-        test $level = 0 && continue
-        eval level=$(($level-1))
-        eval $var="\${${var}_${level}}"
-        eval ${var}_level=$level
-        eval unset ${var}_${level}
-    done
-}
-
-enable(){
-    set_all yes $*
-}
-
-disable(){
-    set_all no $*
-}
-
-enable_weak(){
-    set_weak yes $*
-}
-
-disable_weak(){
-    set_weak no $*
-}
-
-enable_safe(){
-    for var; do
-        enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
-    done
-}
-
-disable_safe(){
-    for var; do
-        disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
-    done
-}
-
-do_enable_deep(){
-    for var; do
-        enabled $var && continue
-        eval sel="\$${var}_select"
-        eval sgs="\$${var}_suggest"
-        pushvar var sgs
-        enable_deep $sel
-        popvar sgs
-        enable_deep_weak $sgs
-        popvar var
-    done
-}
-
-enable_deep(){
-    do_enable_deep $*
-    enable $*
-}
-
-enable_deep_weak(){
-    do_enable_deep $*
-    enable_weak $*
-}
-
-enabled(){
-    test "${1#!}" = "$1" && op== || op=!=
-    eval test "x\$${1#!}" $op "xyes"
-}
-
-disabled(){
-    test "${1#!}" = "$1" && op== || op=!=
-    eval test "x\$${1#!}" $op "xno"
-}
-
-enabled_all(){
-    for opt; do
-        enabled $opt || return 1
-    done
-}
-
-disabled_all(){
-    for opt; do
-        disabled $opt || return 1
-    done
-}
-
-enabled_any(){
-    for opt; do
-        enabled $opt && return 0
-    done
-}
-
-disabled_any(){
-    for opt; do
-        disabled $opt && return 0
-    done
-    return 1
-}
-
-set_default(){
-    for opt; do
-        eval : \${$opt:=\$${opt}_default}
-    done
-}
-
-is_in(){
-    value=$1
-    shift
-    for var in $*; do
-        [ $var = $value ] && return 0
-    done
-    return 1
-}
-
-check_deps(){
-    for cfg; do
-        cfg="${cfg#!}"
-        enabled ${cfg}_checking && die "Circular dependency for $cfg."
-        disabled ${cfg}_checking && continue
-        enable ${cfg}_checking
-
-        eval dep_all="\$${cfg}_deps"
-        eval dep_any="\$${cfg}_deps_any"
-        eval dep_sel="\$${cfg}_select"
-        eval dep_sgs="\$${cfg}_suggest"
-        eval dep_ifa="\$${cfg}_if"
-        eval dep_ifn="\$${cfg}_if_any"
-
-        pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
-        check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
-        popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
-
-        [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
-        [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
-        enabled_all  $dep_all || disable $cfg
-        enabled_any  $dep_any || disable $cfg
-        disabled_any $dep_sel && disable $cfg
-
-        if enabled $cfg; then
-            eval dep_extralibs="\$${cfg}_extralibs"
-            test -n "$dep_extralibs" && add_extralibs $dep_extralibs
-            enable_deep $dep_sel
-            enable_deep_weak $dep_sgs
-        fi
-
-        disable ${cfg}_checking
-    done
-}
-
-print_config(){
-    pfx=$1
-    header=$2
-    makefile=$3
-    shift 3
-    for cfg; do
-        ucname="$(toupper $cfg)"
-        if enabled $cfg; then
-            echo "#define ${pfx}${ucname} 1" >> $header
-            echo "${pfx}${ucname}=yes" >> $makefile
-        else
-            echo "#define ${pfx}${ucname} 0" >> $header
-            echo "!${pfx}${ucname}=yes" >> $makefile
-        fi
-    done
-}
-
-flags_saved(){
-    (: ${SAVE_CFLAGS?}) 2> /dev/null
-}
-
-save_flags(){
-    flags_saved && return
-    SAVE_CFLAGS="$CFLAGS"
-    SAVE_LDFLAGS="$LDFLAGS"
-    SAVE_extralibs="$extralibs"
-}
-
-restore_flags(){
-    flags_saved || return
-    CFLAGS="$SAVE_CFLAGS"
-    LDFLAGS="$SAVE_LDFLAGS"
-    extralibs="$SAVE_extralibs"
-    unset SAVE_CFLAGS
-    unset SAVE_LDFLAGS
-    unset SAVE_extralibs
-}
-
-temp_cflags(){
-    save_flags
-    CFLAGS="$CFLAGS $*"
-}
-
-temp_ldflags(){
-    save_flags
-    LDFLAGS="$LDFLAGS $*"
-}
-
-temp_extralibs(){
-    save_flags
-    extralibs="$extralibs $*"
-}
-
-append(){
-    var=$1
-    shift
-    flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
-    eval "$var=\"\$$var $*\""
-}
-
-add_cppflags(){
-    append CPPFLAGS $($filter_cppflags "$@")
-}
-
-add_cflags(){
-    append CFLAGS $($filter_cflags "$@")
-}
-
-add_asflags(){
-    append ASFLAGS $($filter_asflags "$@")
-}
-
-add_ldflags(){
-    append LDFLAGS "$@"
-}
-
-add_extralibs(){
-    append extralibs "$@"
-}
-
-check_cmd(){
-    log "$@"
-    "$@" >> $logfile 2>&1
-}
-
-check_cc(){
-    log check_cc "$@"
-    cat > $TMPC
-    log_file $TMPC
-    check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC
-}
-
-check_cpp(){
-    log check_cpp "$@"
-    cat > $TMPC
-    log_file $TMPC
-    check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC
-}
-
-check_as(){
-    log check_as "$@"
-    cat > $TMPC
-    log_file $TMPC
-    check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC
-}
-
-check_asm(){
-    log check_asm "$@"
-    name="$1"
-    code="$2"
-    shift 2
-    disable $name
-    check_as "$@" <<EOF && enable $name
-void foo(void){ __asm__ volatile($code); }
-EOF
-}
-
-check_yasm(){
-    log check_yasm "$@"
-    echo "$1" > $TMPS
-    log_file $TMPS
-    shift 1
-    check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
-}
-
-check_ld(){
-    log check_ld "$@"
-    flags=''
-    libs=''
-    for f; do
-        test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
-    done
-    check_cc $($filter_cflags $flags) || return
-    check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
-}
-
-check_cppflags(){
-    log check_cppflags "$@"
-    set -- $($filter_cppflags "$@")
-    check_cc "$@" <<EOF && append CPPFLAGS "$@"
-int x;
-EOF
-}
-
-check_cflags(){
-    log check_cflags "$@"
-    set -- $($filter_cflags "$@")
-    check_cc "$@" <<EOF && append CFLAGS "$@"
-int x;
-EOF
-}
-
-test_ldflags(){
-    log test_ldflags "$@"
-    check_ld "$@" <<EOF
-int main(void){ return 0; }
-EOF
-}
-
-check_ldflags(){
-    log check_ldflags "$@"
-    test_ldflags "$@" && add_ldflags "$@"
-}
-
-check_header(){
-    log check_header "$@"
-    header=$1
-    shift
-    disable_safe $header
-    check_cpp "$@" <<EOF && enable_safe $header
-#include <$header>
-int x;
-EOF
-}
-
-check_func(){
-    log check_func "$@"
-    func=$1
-    shift
-    disable $func
-    check_ld "$@" <<EOF && enable $func
-extern int $func();
-int main(void){ $func(); }
-EOF
-}
-
-check_mathfunc(){
-    log check_mathfunc "$@"
-    func=$1
-    shift
-    disable $func
-    check_ld "$@" <<EOF && enable $func
-#include <math.h>
-float foo(float f) { return $func(f); }
-int main(void){ return 0; }
-EOF
-}
-
-check_func_headers(){
-    log check_func_headers "$@"
-    headers=$1
-    func=$2
-    shift 2
-    disable $func
-    incs=""
-    for hdr in $headers; do
-        incs="$incs
-#include <$hdr>"
-    done
-    check_ld "$@" <<EOF && enable $func && enable_safe $headers
-$incs
-int main(int argc, char **argv){
-    return (long) $func;
-}
-EOF
-}
-
-check_cpp_condition(){
-    log check_cpp_condition "$@"
-    header=$1
-    condition=$2
-    shift 2
-    check_cpp $($filter_cppflags "$@") <<EOF
-#include <$header>
-#if !($condition)
-#error "unsatisfied condition: $condition"
-#endif
-EOF
-}
-
-check_lib(){
-    log check_lib "$@"
-    header="$1"
-    func="$2"
-    shift 2
-    temp_extralibs "$@"
-    check_header $header && check_func $func && add_extralibs "$@"
-    err=$?
-    restore_flags
-    return $err
-}
-
-check_lib2(){
-    log check_lib2 "$@"
-    headers="$1"
-    func="$2"
-    shift 2
-    check_func_headers "$headers" $func "$@" && add_extralibs "$@"
-}
-
-check_exec(){
-    check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
-}
-
-check_exec_crash(){
-    code=$(cat)
-
-    # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
-    # are safe but may not be available everywhere.  Thus we use
-    # raise(SIGTERM) instead.  The check is run in a subshell so we
-    # can redirect the "Terminated" message from the shell.  SIGBUS
-    # is not defined by standard C so it is used conditionally.
-
-    (check_exec "$@") >> $logfile 2>&1 <<EOF
-#include <signal.h>
-static void sighandler(int sig){
-    raise(SIGTERM);
-}
-int main(void){
-    signal(SIGILL, sighandler);
-    signal(SIGFPE, sighandler);
-    signal(SIGSEGV, sighandler);
-#ifdef SIGBUS
-    signal(SIGBUS, sighandler);
-#endif
-    { $code }
-}
-EOF
-}
-
-check_type(){
-    log check_type "$@"
-    headers=$1
-    type=$2
-    shift 2
-    disable_safe "$type"
-    incs=""
-    for hdr in $headers; do
-        incs="$incs
-#include <$hdr>"
-    done
-    check_cc "$@" <<EOF && enable_safe "$type"
-$incs
-$type v;
-EOF
-}
-
-check_struct(){
-    log check_type "$@"
-    headers=$1
-    struct=$2
-    member=$3
-    shift 3
-    disable_safe "${struct}_${member}"
-    incs=""
-    for hdr in $headers; do
-        incs="$incs
-#include <$hdr>"
-    done
-    check_cc "$@" <<EOF && enable_safe "${struct}_${member}"
-$incs
-const void *p = &(($struct *)0)->$member;
-EOF
-}
-
-require(){
-    name="$1"
-    header="$2"
-    func="$3"
-    shift 3
-    check_lib $header $func "$@" || die "ERROR: $name not found"
-}
-
-require2(){
-    name="$1"
-    headers="$2"
-    func="$3"
-    shift 3
-    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
-}
-
-check_foo_config(){
-    cfg=$1
-    pkg=$2
-    header=$3
-    func=$4
-    shift 4
-    disable $cfg
-    check_cmd ${pkg}-config --version
-    err=$?
-    if test "$err" = 0; then
-        temp_cflags $(${pkg}-config --cflags)
-        temp_extralibs $(${pkg}-config --libs)
-        check_lib "$@" $header $func && enable $cfg
-    fi
-    return $err
-}
-
-check_host_cc(){
-    log check_host_cc "$@"
-    cat > $TMPC
-    log_file $TMPC
-    check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC
-}
-
-check_host_cflags(){
-    log check_host_cflags "$@"
-    check_host_cc "$@" <<EOF && append host_cflags "$@"
-int x;
-EOF
-}
-
-apply(){
-    file=$1
-    shift
-    "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
-}
-
-cp_if_changed(){
-    cmp -s "$1" "$2" &&
-        echo "$2 is unchanged" ||
-        cp -f "$1" "$2"
-}
-
-# CONFIG_LIST contains configurable options, while HAVE_LIST is for
-# system-dependent things.
-
-COMPONENT_LIST="
-    bsfs
-    decoders
-    demuxers
-    encoders
-    filters
-    hwaccels
-    indevs
-    muxers
-    outdevs
-    parsers
-    protocols
-"
-
-CONFIG_LIST="
-    $COMPONENT_LIST
-    aandct
-    avcodec
-    avdevice
-    avfilter
-    avfilter_lavf
-    avformat
-    avisynth
-    beos_netserver
-    bzlib
-    dct
-    doc
-    dwt
-    dxva2
-    fastdiv
-    ffmpeg
-    ffplay
-    ffprobe
-    ffserver
-    fft
-    golomb
-    gpl
-    gprof
-    gray
-    h264dsp
-    hardcoded_tables
-    libdc1394
-    libdirac
-    libfaac
-    libfaad
-    libfaadbin
-    libgsm
-    libmp3lame
-    libnut
-    libopencore_amrnb
-    libopencore_amrwb
-    libopenjpeg
-    librtmp
-    libschroedinger
-    libspeex
-    libtheora
-    libvorbis
-    libvpx
-    libx264
-    libxvid
-    lpc
-    lsp
-    mdct
-    memalign_hack
-    mlib
-    mpegaudio_hp
-    network
-    nonfree
-    pic
-    postproc
-    powerpc_perf
-    rdft
-    runtime_cpudetect
-    shared
-    small
-    sram
-    static
-    swscale
-    swscale_alpha
-    vaapi
-    vdpau
-    version3
-    x11grab
-    zlib
-"
-
-THREADS_LIST='
-    beosthreads
-    os2threads
-    pthreads
-    w32threads
-'
-
-ARCH_LIST='
-    alpha
-    arm
-    avr32
-    avr32_ap
-    avr32_uc
-    bfin
-    ia64
-    m68k
-    mips
-    mips64
-    parisc
-    ppc
-    ppc64
-    s390
-    sh4
-    sparc
-    sparc64
-    tomi
-    x86
-    x86_32
-    x86_64
-'
-
-ARCH_EXT_LIST='
-    altivec
-    amd3dnow
-    amd3dnowext
-    armv5te
-    armv6
-    armv6t2
-    armvfp
-    iwmmxt
-    mmi
-    mmx
-    mmx2
-    neon
-    ppc4xx
-    sse
-    ssse3
-    vis
-'
-
-HAVE_LIST_PUB='
-    bigendian
-'
-
-HAVE_LIST="
-    $ARCH_EXT_LIST
-    $HAVE_LIST_PUB
-    $THREADS_LIST
-    alsa_asoundlib_h
-    altivec_h
-    arpa_inet_h
-    attribute_may_alias
-    attribute_packed
-    bswap
-    closesocket
-    cmov
-    conio_h
-    dcbzl
-    dev_bktr_ioctl_bt848_h
-    dev_bktr_ioctl_meteor_h
-    dev_ic_bt8xx_h
-    dev_video_meteor_ioctl_meteor_h
-    dev_video_bktr_ioctl_bt848_h
-    dlfcn_h
-    dlopen
-    dos_paths
-    ebp_available
-    ebx_available
-    exp2
-    exp2f
-    fast_64bit
-    fast_clz
-    fast_cmov
-    fast_unaligned
-    fork
-    getaddrinfo
-    gethrtime
-    GetProcessMemoryInfo
-    GetProcessTimes
-    getrusage
-    struct_rusage_ru_maxrss
-    inet_aton
-    inline_asm
-    isatty
-    ldbrx
-    libdc1394_1
-    libdc1394_2
-    llrint
-    llrintf
-    local_aligned_16
-    local_aligned_8
-    log2
-    log2f
-    loongson
-    lrint
-    lrintf
-    lzo1x_999_compress
-    machine_ioctl_bt848_h
-    machine_ioctl_meteor_h
-    malloc_h
-    memalign
-    mkstemp
-    pld
-    posix_memalign
-    round
-    roundf
-    sdl
-    sdl_video_size
-    setmode
-    socklen_t
-    soundcard_h
-    poll_h
-    setrlimit
-    strerror_r
-    struct_addrinfo
-    struct_ipv6_mreq
-    struct_sockaddr_in6
-    struct_sockaddr_sa_len
-    struct_sockaddr_storage
-    symver
-    symver_gnu_asm
-    symver_asm_label
-    sys_mman_h
-    sys_resource_h
-    sys_select_h
-    sys_soundcard_h
-    sys_videoio_h
-    ten_operands
-    termios_h
-    threads
-    truncf
-    vfp_args
-    VirtualAlloc
-    winsock2_h
-    xform_asm
-    yasm
-"
-
-# options emitted with CONFIG_ prefix but not available on command line
-CONFIG_EXTRA="
-    avutil
-    gplv3
-    lgplv3
-"
-
-CMDLINE_SELECT="
-    $ARCH_EXT_LIST
-    $CONFIG_LIST
-    $THREADS_LIST
-    asm
-    cross_compile
-    debug
-    extra_warnings
-    logging
-    optimizations
-    stripping
-    yasm
-"
-
-PATHS_LIST='
-    bindir
-    datadir
-    incdir
-    libdir
-    mandir
-    prefix
-    shlibdir
-'
-
-CMDLINE_SET="
-    $PATHS_LIST
-    ar
-    arch
-    as
-    build_suffix
-    cc
-    cpu
-    cross_prefix
-    dep_cc
-    extra_version
-    host_cc
-    host_cflags
-    host_ldflags
-    host_libs
-    host_os
-    ld
-    logfile
-    malloc_prefix
-    nm
-    samples
-    source_path
-    strip
-    sysinclude
-    sysroot
-    target_exec
-    target_os
-    target_path
-"
-
-CMDLINE_APPEND="
-    extra_cflags
-"
-
-# code dependency declarations
-
-# architecture extensions
-
-armv5te_deps="arm"
-armv6_deps="arm"
-armv6t2_deps="arm"
-armvfp_deps="arm"
-iwmmxt_deps="arm"
-neon_deps="arm"
-
-mmi_deps="mips"
-
-altivec_deps="ppc"
-ppc4xx_deps="ppc"
-
-vis_deps="sparc"
-
-x86_64_suggest="cmov fast_cmov"
-amd3dnow_deps="mmx"
-amd3dnowext_deps="amd3dnow"
-mmx_deps="x86"
-mmx2_deps="mmx"
-sse_deps="mmx"
-ssse3_deps="sse"
-
-fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
-fast_clz_if_any="alpha armv5te avr32 mips ppc x86"
-fast_unaligned_if_any="armv6 ppc x86"
-
-need_memalign="altivec neon sse"
-inline_asm_deps="!tms470"
-
-symver_if_any="symver_asm_label symver_gnu_asm"
-
-# subsystems
-mdct_select="fft"
-rdft_select="fft"
-
-# decoders / encoders / hardware accelerators
-aac_decoder_select="mdct rdft aac_parser"
-aac_encoder_select="mdct"
-ac3_decoder_select="mdct ac3_parser"
-alac_encoder_select="lpc"
-amrnb_decoder_select="lsp"
-atrac1_decoder_select="mdct"
-atrac3_decoder_select="mdct"
-binkaudio_dct_decoder_select="mdct rdft dct"
-binkaudio_rdft_decoder_select="mdct rdft"
-cavs_decoder_select="golomb"
-cook_decoder_select="mdct"
-cscd_decoder_suggest="zlib"
-dca_decoder_select="mdct"
-dnxhd_encoder_select="aandct"
-dxa_decoder_select="zlib"
-eac3_decoder_select="ac3_decoder"
-eamad_decoder_select="aandct"
-eatgq_decoder_select="aandct"
-eatqi_decoder_select="aandct"
-ffv1_decoder_select="golomb"
-flac_decoder_select="golomb"
-flac_encoder_select="golomb lpc"
-flashsv_decoder_select="zlib"
-flashsv_encoder_select="zlib"
-flv_decoder_select="h263_decoder"
-flv_encoder_select="h263_encoder"
-h261_encoder_select="aandct"
-h263_decoder_select="h263_parser"
-h263_encoder_select="aandct"
-h263_vaapi_hwaccel_select="vaapi h263_decoder"
-h263i_decoder_select="h263_decoder"
-h263p_encoder_select="h263_encoder"
-h264_decoder_select="golomb h264dsp"
-h264_dxva2_hwaccel_deps="dxva2api_h"
-h264_dxva2_hwaccel_select="dxva2 h264_decoder"
-h264_vaapi_hwaccel_select="vaapi"
-h264_vdpau_decoder_select="vdpau h264_decoder"
-imc_decoder_select="fft mdct"
-jpegls_decoder_select="golomb"
-jpegls_encoder_select="golomb"
-ljpeg_encoder_select="aandct"
-loco_decoder_select="golomb"
-mjpeg_encoder_select="aandct"
-mlp_decoder_select="mlp_parser"
-mpeg1video_encoder_select="aandct"
-mpeg2video_encoder_select="aandct"
-mpeg4_decoder_select="h263_decoder mpeg4video_parser"
-mpeg4_encoder_select="h263_encoder"
-mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder"
-mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder"
-mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder"
-mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder"
-mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder"
-mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
-mpeg_xvmc_decoder_select="mpegvideo_decoder"
-msmpeg4v1_decoder_select="h263_decoder"
-msmpeg4v1_encoder_select="h263_encoder"
-msmpeg4v2_decoder_select="h263_decoder"
-msmpeg4v2_encoder_select="h263_encoder"
-msmpeg4v3_decoder_select="h263_decoder"
-msmpeg4v3_encoder_select="h263_encoder"
-nellymoser_decoder_select="mdct"
-nellymoser_encoder_select="mdct"
-png_decoder_select="zlib"
-png_encoder_select="zlib"
-qcelp_decoder_select="lsp"
-qdm2_decoder_select="mdct rdft"
-rv10_decoder_select="h263_decoder"
-rv10_encoder_select="h263_encoder"
-rv20_decoder_select="h263_decoder"
-rv20_encoder_select="h263_encoder"
-rv30_decoder_select="golomb h264dsp"
-rv40_decoder_select="golomb h264dsp"
-shorten_decoder_select="golomb"
-sipr_decoder_select="lsp"
-snow_decoder_select="dwt"
-snow_encoder_select="aandct dwt"
-sonic_decoder_select="golomb"
-sonic_encoder_select="golomb"
-sonic_ls_encoder_select="golomb"
-svq1_encoder_select="aandct"
-svq3_decoder_select="golomb h264dsp"
-svq3_decoder_suggest="zlib"
-theora_decoder_select="vp3_decoder"
-tiff_decoder_suggest="zlib"
-tiff_encoder_suggest="zlib"
-truehd_decoder_select="mlp_decoder"
-tscc_decoder_select="zlib"
-twinvq_decoder_select="mdct lsp"
-vc1_decoder_select="h263_decoder"
-vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex"
-vc1_dxva2_hwaccel_select="dxva2 vc1_decoder"
-vc1_vaapi_hwaccel_select="vaapi vc1_decoder"
-vc1_vdpau_decoder_select="vdpau vc1_decoder"
-vorbis_decoder_select="mdct"
-vorbis_encoder_select="mdct"
-vp6a_decoder_select="vp6_decoder"
-vp6f_decoder_select="vp6_decoder"
-wmapro_decoder_select="mdct"
-wmav1_decoder_select="mdct"
-wmav1_encoder_select="mdct"
-wmav2_decoder_select="mdct"
-wmav2_encoder_select="mdct"
-wmavoice_decoder_select="lsp rdft dct"
-wmv1_decoder_select="h263_decoder"
-wmv1_encoder_select="h263_encoder"
-wmv2_decoder_select="h263_decoder"
-wmv2_encoder_select="h263_encoder"
-wmv3_decoder_select="vc1_decoder"
-wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
-wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
-wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
-zlib_decoder_select="zlib"
-zlib_encoder_select="zlib"
-zmbv_decoder_select="zlib"
-zmbv_encoder_select="zlib"
-
-vaapi_deps="va_va_h"
-vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
-
-# parsers
-h264_parser_select="golomb h264dsp"
-
-# bitstream_filters
-aac_adtstoasc_bsf_select="aac_parser"
-
-# external libraries
-libdirac_decoder_deps="libdirac !libschroedinger"
-libdirac_encoder_deps="libdirac"
-libfaac_encoder_deps="libfaac"
-libfaad_decoder_deps="libfaad"
-libfaadbin_extralibs='$ldl'
-libgsm_decoder_deps="libgsm"
-libgsm_encoder_deps="libgsm"
-libgsm_ms_decoder_deps="libgsm"
-libgsm_ms_encoder_deps="libgsm"
-libmp3lame_encoder_deps="libmp3lame"
-libopencore_amrnb_decoder_deps="libopencore_amrnb"
-libopencore_amrnb_encoder_deps="libopencore_amrnb"
-libopencore_amrwb_decoder_deps="libopencore_amrwb"
-libopenjpeg_decoder_deps="libopenjpeg"
-libschroedinger_decoder_deps="libschroedinger"
-libschroedinger_encoder_deps="libschroedinger"
-libspeex_decoder_deps="libspeex"
-libtheora_encoder_deps="libtheora"
-libvorbis_encoder_deps="libvorbis"
-libvpx_decoder_deps="libvpx"
-libvpx_encoder_deps="libvpx"
-libx264_encoder_deps="libx264"
-libxvid_encoder_deps="libxvid"
-
-# demuxers / muxers
-ac3_demuxer_deps="ac3_parser"
-asf_stream_muxer_select="asf_muxer"
-avisynth_demuxer_deps="avisynth"
-dirac_demuxer_deps="dirac_parser"
-eac3_demuxer_select="ac3_parser"
-ipod_muxer_select="mov_muxer"
-libnut_demuxer_deps="libnut"
-libnut_muxer_deps="libnut"
-matroska_audio_muxer_select="matroska_muxer"
-matroska_demuxer_suggest="zlib bzlib"
-mov_demuxer_suggest="zlib"
-mp3_demuxer_deps="mpegaudio_parser"
-mp4_muxer_select="mov_muxer"
-mpegtsraw_demuxer_select="mpegts_demuxer"
-mxf_d10_muxer_select="mxf_muxer"
-ogg_demuxer_select="golomb"
-psp_muxer_select="mov_muxer"
-rtsp_demuxer_deps="sdp_demuxer"
-rtsp_muxer_deps="sdp_demuxer"
-rtsp_muxer_select="rtp_muxer"
-sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
-sdp_demuxer_select="asf_demuxer rm_demuxer"
-spdif_muxer_select="aac_parser"
-tg2_muxer_select="mov_muxer"
-tgp_muxer_select="mov_muxer"
-w64_demuxer_deps="wav_demuxer"
-
-# indevs / outdevs
-alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
-alsa_indev_extralibs="-lasound"
-alsa_outdev_deps="alsa_asoundlib_h"
-alsa_outdev_extralibs="-lasound"
-audio_beos_indev_deps="audio_beos"
-audio_beos_indev_extralibs="-lmedia -lbe"
-audio_beos_outdev_deps="audio_beos"
-audio_beos_outdev_extralibs="-lmedia -lbe"
-bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
-dv1394_indev_deps="dv1394 dv_demuxer"
-jack_indev_deps="jack_jack_h"
-jack_indev_extralibs="-ljack"
-libdc1394_indev_deps="libdc1394"
-oss_indev_deps_any="soundcard_h sys_soundcard_h"
-oss_outdev_deps_any="soundcard_h sys_soundcard_h"
-v4l_indev_deps="linux_videodev_h"
-v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
-vfwcap_indev_deps="capCreateCaptureWindow"
-vfwcap_indev_extralibs="-lavicap32"
-x11_grab_device_indev_deps="x11grab XShmCreateImage"
-x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"
-
-# protocols
-gopher_protocol_deps="network"
-http_protocol_deps="network"
-http_protocol_select="tcp_protocol"
-rtmp_protocol_deps="tcp_protocol"
-rtp_protocol_deps="udp_protocol"
-tcp_protocol_deps="network"
-udp_protocol_deps="network"
-
-# filters
-movie_filter_deps="avfilter_lavf"
-avfilter_lavf_deps="avformat"
-
-# libraries
-avdevice_deps="avcodec avformat"
-avformat_deps="avcodec"
-
-# programs
-ffmpeg_deps="avcodec avformat swscale"
-ffplay_deps="avcodec avformat swscale sdl"
-ffplay_select="rdft"
-ffprobe_deps="avcodec avformat"
-ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer"
-ffserver_extralibs='$ldl'
-
-doc_deps="texi2html"
-
-# default parameters
-
-logfile="config.err"
-
-# installation paths
-prefix_default="/usr/local"
-bindir_default='${prefix}/bin'
-datadir_default='${prefix}/share/ffmpeg'
-incdir_default='${prefix}/include'
-libdir_default='${prefix}/lib'
-mandir_default='${prefix}/share/man'
-shlibdir_default="$libdir_default"
-
-# toolchain
-ar_default="ar"
-cc_default="gcc"
-cc_version=\"unknown\"
-host_cc_default="gcc"
-ln_s="ln -sf"
-nm_default="nm"
-objformat="elf"
-ranlib="ranlib"
-strip_default="strip"
-yasmexe="yasm"
-
-nm_opts='-g'
-
-# machine
-arch_default=$(uname -m)
-cpu="generic"
-
-# OS
-target_os_default=$(tolower $(uname -s))
-host_os=$target_os_default
-
-# configurable options
-enable avcodec
-enable avdevice
-enable avformat
-enable avutil
-enable asm
-enable debug
-enable doc
-enable fastdiv
-enable ffmpeg
-enable ffplay
-enable ffprobe
-enable ffserver
-enable mpegaudio_hp
-enable network
-enable optimizations
-enable protocols
-enable static
-enable stripping
-enable swscale
-enable swscale_alpha
-
-# build settings
-SHFLAGS='-shared -Wl,-soname,$$(@F)'
-FFSERVERLDFLAGS=-Wl,-E
-LIBPREF="lib"
-LIBSUF=".a"
-FULLNAME='$(NAME)$(BUILDSUF)'
-LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
-SLIBPREF="lib"
-SLIBSUF=".so"
-SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
-SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
-SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
-LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
-
-CC_O='-o $@'
-
-host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall'
-host_libs='-lm'
-
-target_path='$(CURDIR)'
-
-# gcc stupidly only outputs the basename of targets with -MM, but we need the
-# full relative path for objects in subdirectories for non-recursive Make.
-DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
-DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
-
-# find source path
-source_path="$(dirname "$0")"
-enable source_path_used
-if test -f configure; then
-    source_path="$(pwd)"
-    disable source_path_used
-else
-    source_path="$(cd "$source_path"; pwd)"
-    echo "$source_path" | grep -q '[[:blank:]]' &&
-        die "Out of tree builds are impossible with whitespace in source path."
-    test -e "$source_path/config.h" &&
-        die "Out of tree builds are impossible with config.h in source dir."
-fi
-
-for v in "$@"; do
-    r=${v#*=}
-    l=${v%"$r"}
-    r=$(sh_quote "$r")
-    FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
-done
-
-find_things(){
-    thing=$1
-    pattern=$2
-    file=$source_path/$3
-    sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
-}
-
-ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
-DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
-HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
-PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
-BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
-MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
-DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
-OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
-INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
-PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
-FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
-
-for n in $COMPONENT_LIST; do
-    v=$(toupper ${n%s})_LIST
-    eval enable \$$v
-    eval ${n}_if_any="\$$v"
-done
-
-enable $ARCH_EXT_LIST
-
-die_unknown(){
-    echo "Unknown option \"$1\"."
-    echo "See $0 --help for available options."
-    exit 1
-}
-
-show_list() {
-    suffix=_$1
-    shift
-    echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t
-    exit 0
-}
-
-for opt do
-    optval="${opt#*=}"
-    case "$opt" in
-    --extra-ldflags=*) add_ldflags $optval
-    ;;
-    --extra-libs=*) add_extralibs $optval
-    ;;
-    --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
-    ;;
-    --enable-debug=*) debuglevel="$optval"
-    ;;
-    --disable-everything)
-    map 'eval disable \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
-    ;;
-    --enable-*=*|--disable-*=*)
-    eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
-    is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
-    eval list=\$$(toupper $thing)_LIST
-    name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
-    $action $(filter "$name" $list)
-    ;;
-    --enable-?*|--disable-?*)
-    eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
-    if is_in $option $COMPONENT_LIST; then
-        test $action = disable && action=unset
-        eval $action \$$(toupper ${option%s})_LIST
-    elif is_in $option $CMDLINE_SELECT; then
-        $action $option
-    else
-        die_unknown $opt
-    fi
-    ;;
-    --list-*)
-        NAME="${opt#--list-}"
-        is_in $NAME $COMPONENT_LIST || die_unknown $opt
-        NAME=${NAME%s}
-        eval show_list $NAME \$$(toupper $NAME)_LIST
-    ;;
-    --help|-h) show_help
-    ;;
-    *)
-    optname="${opt%%=*}"
-    optname="${optname#--}"
-    optname=$(echo "$optname" | sed 's/-/_/g')
-    if is_in $optname $CMDLINE_SET; then
-        eval $optname='$optval'
-    elif is_in $optname $CMDLINE_APPEND; then
-        append $optname "$optval"
-    else
-         die_unknown $opt
-    fi
-    ;;
-    esac
-done
-
-disabled logging && logfile=/dev/null
-
-echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
-set >> $logfile
-
-test -n "$cross_prefix" && enable cross_compile
-
-if enabled cross_compile; then
-    test -n "$arch" && test -n "$target_os" ||
-        die "Must specify target arch and OS when cross-compiling"
-fi
-
-set_default arch target_os
-
-ar_default="${cross_prefix}${ar_default}"
-cc_default="${cross_prefix}${cc_default}"
-nm_default="${cross_prefix}${nm_default}"
-ranlib="${cross_prefix}${ranlib}"
-strip_default="${cross_prefix}${strip_default}"
-
-sysinclude_default="${sysroot}/usr/include"
-
-set_default cc nm strip sysinclude
-enabled cross_compile || host_cc_default=$cc
-set_default host_cc
-
-exesuf() {
-    case $1 in
-        mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;;
-    esac
-}
-
-EXESUF=$(exesuf $target_os)
-HOSTEXESUF=$(exesuf $host_os)
-
-# set temporary file name
-: ${TMPDIR:=$TEMPDIR}
-: ${TMPDIR:=$TMP}
-: ${TMPDIR:=/tmp}
-
-if ! check_cmd type mktemp; then
-    # simple replacement for missing mktemp
-    # NOT SAFE FOR GENERAL USE
-    mktemp(){
-        echo "${2%XXX*}.${HOSTNAME}.${UID}.$$"
-    }
-fi
-
-tmpfile(){
-    tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
-        (set -C; exec > $tmp) 2>/dev/null ||
-        die "Unable to create temporary file in $TMPDIR."
-    append TMPFILES $tmp
-    eval $1=$tmp
-}
-
-trap 'rm -f -- $TMPFILES' EXIT
-trap exit HUP INT TERM
-
-tmpfile TMPC  .c
-tmpfile TMPE  $EXESUF
-tmpfile TMPH  .h
-tmpfile TMPO  .o
-tmpfile TMPS  .S
-tmpfile TMPV  .ver
-tmpfile TMPSH .sh
-
-unset -f mktemp
-
-# make sure we can execute files in $TMPDIR
-cat > $TMPSH 2>> $logfile <<EOF
-#! /bin/sh
-EOF
-chmod +x $TMPSH >> $logfile 2>&1
-if ! $TMPSH >> $logfile 2>&1; then
-    cat <<EOF
-Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
-variable to another directory and make sure that it is not mounted noexec.
-EOF
-    die "Sanity test failed."
-fi
-
-filter_cflags=echo
-filter_cppflags=echo
-filter_asflags=echo
-
-if   $cc -v 2>&1 | grep -qi ^gcc; then
-    cc_type=gcc
-    cc_version=__VERSION__
-    if ! $cc -dumpversion | grep -q '^2\.'; then
-        CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
-        AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
-    fi
-    speed_cflags='-O3'
-    size_cflags='-Os'
-elif $cc --version 2>/dev/null | grep -q Intel; then
-    cc_type=icc
-    cc_version="AV_STRINGIFY(__INTEL_COMPILER)"
-    CC_DEPFLAGS='-MMD'
-    AS_DEPFLAGS='-MMD'
-    speed_cflags='-O3'
-    size_cflags='-Os'
-    noopt_cflags='-O1'
-elif $cc -v 2>&1 | grep -q xlc; then
-    cc_type=xlc
-    cc_version="AV_STRINGIFY(__IBMC__)"
-    speed_cflags='-O5'
-    size_cflags='-O5 -qcompact'
-elif $cc -V 2>/dev/null | grep -q Compaq; then
-    cc_type=ccc
-    cc_version="AV_STRINGIFY(__DECC_VER)"
-    DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
-    debuglevel=3
-    add_ldflags -Wl,-z,now # calls to libots crash without this
-    speed_cflags='-fast'
-    size_cflags='-O1'
-elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
-    test -d "$sysroot" || die "No valid sysroot specified."
-    cc_type=armcc
-    cc_version="AV_STRINGIFY(__ARMCC_VERSION)"
-    armcc_conf="$PWD/armcc.conf"
-    $cc --arm_linux_configure                 \
-        --arm_linux_config_file="$armcc_conf" \
-        --configure_sysroot="$sysroot"        \
-        --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
-        die "Error creating armcc configuration file."
-    cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
-    as_default="${cross_prefix}gcc"
-    CC_DEPFLAGS='-MMD'
-    AS_DEPFLAGS='-MMD'
-    speed_cflags='-O3'
-    size_cflags='-Os'
-elif $cc -version 2>/dev/null | grep -q TMS470; then
-    cc_type=tms470
-    cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)"
-    cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
-    CC_O='-fr=$(@D)'
-    as_default="${cross_prefix}gcc"
-    ld_default="${cross_prefix}gcc"
-    TMPO=$(basename $TMPC .c).o
-    append TMPFILES $TMPO
-    add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
-    CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
-    AS_DEPFLAGS='-MMD'
-    speed_cflags='-O3 -mf=5'
-    size_cflags='-O3 -mf=2'
-    filter_cflags=tms470_flags
-    tms470_flags(){
-        for flag; do
-            case $flag in
-                -march=*|-mcpu=*)
-                    case "${flag#*=}" in
-                        armv7-a|cortex-a*)      echo -mv=7a8 ;;
-                        armv7-r|cortex-r*)      echo -mv=7r4 ;;
-                        armv7-m|cortex-m*)      echo -mv=7m3 ;;
-                        armv6*|arm11*)          echo -mv=6   ;;
-                        armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
-                                                echo -mv=5e  ;;
-                        armv4*|arm7*|arm9[24]*) echo -mv=4   ;;
-                    esac
-                    ;;
-                -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
-                -mfpu=vfp)      echo --float_support=vfpv2        ;;
-                -mfpu=vfpv3)    echo --float_support=vfpv3        ;;
-                -msoft-float)   echo --float_support=vfplib       ;;
-                -O[0-3]|-mf=*)  echo $flag                        ;;
-                -g)             echo -g -mn                       ;;
-                -pds=*)         echo $flag                        ;;
-            esac
-        done
-    }
-elif $cc -v 2>&1 | grep -q clang; then
-    cc_type=clang
-    cc_version=__VERSION__
-    CC_DEPFLAGS='-MMD'
-    AS_DEPFLAGS='-MMD'
-    speed_cflags='-O3'
-    size_cflags='-Os'
-elif $cc -V 2>&1 | grep -q Sun; then
-    cc_type=suncc
-    cc_version="AV_STRINGIFY(__SUNPRO_C)"
-    DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
-    DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1'
-    speed_cflags='-O5'
-    size_cflags='-O5 -xspace'
-    filter_cflags=suncc_flags
-    suncc_flags(){
-        for flag; do
-            case $flag in
-                -march=*|-mcpu=*)
-                    case "${flag#*=}" in
-                        native)                   echo -xtarget=native       ;;
-                        v9)                       echo -xarch=sparc          ;;
-                        ultrasparc)               echo -xarch=sparcvis       ;;
-                        ultrasparc3|niagara*)     echo -xarch=sparcvis2      ;;
-                        i586|pentium)             echo -xchip=pentium        ;;
-                        i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
-                        pentium3*|c3-2)           echo -xtarget=pentium3     ;;
-                        pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
-                        pentium4*)          echo -xtarget=pentium4           ;;
-                        prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
-                        *-sse3)             echo -xarch=sse3                 ;;
-                        core2)              echo -xarch=ssse3 -xchip=core2   ;;
-                        amdfam10|barcelona)       echo -xarch=sse4_1         ;;
-                        athlon-4|athlon-[mx]p)    echo -xarch=ssea           ;;
-                        k8|opteron|athlon64|athlon-fx)
-                                                  echo -xarch=sse2a          ;;
-                        athlon*)                  echo -xarch=pentium_proa   ;;
-                    esac
-                    ;;
-                -std=c99)             echo -xc99              ;;
-                -fomit-frame-pointer) echo -xregs=frameptr    ;;
-                -fPIC)                echo -KPIC -xcode=pic32 ;;
-                -W*,*)                echo $flag              ;;
-                -f*-*|-W*)                                    ;;
-                *)                    echo $flag              ;;
-            esac
-        done
-    }
-fi
-
-test -n "$cc_type" && enable $cc_type || echolog "Unknown C compiler $cc"
-
-: ${as_default:=$cc}
-: ${dep_cc_default:=$cc}
-: ${ld_default:=$cc}
-set_default ar as dep_cc ld
-
-test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
-test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
-
-add_cflags $extra_cflags
-add_asflags $extra_cflags
-
-if test -n "$sysroot"; then
-    case "$cc_type" in
-        gcc)
-            add_cppflags --sysroot="$sysroot"
-            add_ldflags --sysroot="$sysroot"
-        ;;
-        tms470)
-            add_cppflags -I"$sysinclude"
-            add_ldflags  --sysroot="$sysroot"
-        ;;
-        clang)
-            add_cppflags -isysroot "$sysroot"
-            add_ldflags -isysroot "$sysroot"
-        ;;
-    esac
-fi
-
-if test "$cpu" = host; then
-    enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
-
-    case "$cc_type" in
-        gcc)
-            check_native(){
-                $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
-                sed -n "/$1=/{
-                            s/.*$1=\\([^ ]*\\).*/\\1/
-                            p
-                            q
-                        }" $TMPE
-            }
-            cpu=$(check_native -march || check_native -mcpu)
-        ;;
-    esac
-
-    test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
-fi
-
-# Deal with common $arch aliases
-case "$arch" in
-    arm*)
-        arch="arm"
-    ;;
-    mips|mipsel|IP*)
-        arch="mips"
-    ;;
-    mips64*)
-        arch="mips"
-        subarch="mips64"
-    ;;
-    parisc|hppa)
-        arch="parisc"
-    ;;
-    parisc64|hppa64)
-        arch="parisc"
-        subarch="parisc64"
-    ;;
-    "Power Macintosh"|ppc|powerpc)
-        arch="ppc"
-    ;;
-    ppc64|powerpc64)
-        arch="ppc"
-        subarch="ppc64"
-    ;;
-    s390|s390x)
-        arch="s390"
-    ;;
-    sh4|sh)
-        arch="sh4"
-    ;;
-    sun4u|sparc64)
-        arch="sparc"
-        subarch="sparc64"
-    ;;
-    i[3-6]86|i86pc|BePC|x86_64|amd64)
-        arch="x86"
-    ;;
-esac
-
-is_in $arch $ARCH_LIST || echo "WARNING: unknown arch $arch"
-enable $arch
-
-# Add processor-specific flags
-if test "$cpu" = generic; then
-    : do nothing
-elif enabled ppc; then
-
-    case $(tolower $cpu) in
-        601|ppc601|powerpc601)
-            cpuflags="-mcpu=601"
-            disable altivec
-        ;;
-        603*|ppc603*|powerpc603*)
-            cpuflags="-mcpu=603"
-            disable altivec
-        ;;
-        604*|ppc604*|powerpc604*)
-            cpuflags="-mcpu=604"
-            disable altivec
-        ;;
-        g3|75*|ppc75*|powerpc75*)
-            cpuflags="-mcpu=750 -mpowerpc-gfxopt"
-            disable altivec
-        ;;
-        g4|745*|ppc745*|powerpc745*)
-            cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
-        ;;
-        74*|ppc74*|powerpc74*)
-            cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
-        ;;
-        g5|970|ppc970|powerpc970|power4*)
-            cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
-        ;;
-        cell)
-            cpuflags="-mcpu=cell"
-            enable ldbrx
-        ;;
-        e500v2)
-            cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
-            disable altivec
-        ;;
-        e500)
-            cpuflags="-mcpu=8540 -mhard-float"
-            disable altivec
-        ;;
-    esac
-
-elif enabled x86; then
-
-    case $cpu in
-        i[345]86|pentium)
-            cpuflags="-march=$cpu"
-            disable mmx
-        ;;
-        # targets that do NOT support conditional mov (cmov)
-        pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
-            cpuflags="-march=$cpu"
-            disable cmov
-        ;;
-        # targets that do support conditional mov (cmov)
-        i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10)
-            cpuflags="-march=$cpu"
-            enable cmov
-            enable fast_cmov
-        ;;
-        # targets that do support conditional mov but on which it's slow
-        pentium4|pentium4m|prescott|nocona)
-            cpuflags="-march=$cpu"
-            enable cmov
-            disable fast_cmov
-        ;;
-    esac
-
-elif enabled sparc; then
-
-    case $cpu in
-        sparc64)
-            cpuflags="-mcpu=v9"
-        ;;
-    esac
-
-elif enabled arm; then
-
-    case $cpu in
-        armv*)
-            cpuflags="-march=$cpu"
-        ;;
-        *)
-            cpuflags="-mcpu=$cpu"
-        ;;
-    esac
-
-elif enabled alpha; then
-
-    enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
-
-elif enabled bfin; then
-
-    cpuflags="-mcpu=$cpu"
-
-elif enabled mips; then
-
-    cpuflags="-march=$cpu"
-
-elif enabled avr32; then
-
-    case $cpu in
-        ap7[02]0[0-2])
-            subarch="avr32_ap"
-            cpuflags="-mpart=$cpu"
-        ;;
-        ap)
-            subarch="avr32_ap"
-            cpuflags="-march=$cpu"
-        ;;
-        uc3[ab]*)
-            subarch="avr32_uc"
-            cpuflags="-mcpu=$cpu"
-        ;;
-        uc)
-            subarch="avr32_uc"
-            cpuflags="-march=$cpu"
-        ;;
-    esac
-
-fi
-
-add_cflags $cpuflags
-add_asflags $cpuflags
-
-# compiler sanity check
-check_exec <<EOF
-int main(void){ return 0; }
-EOF
-if test "$?" != 0; then
-    echo "$cc is unable to create an executable file."
-    if test -z "$cross_prefix" && ! enabled cross_compile ; then
-        echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
-        echo "Only do this if you know what cross compiling means."
-    fi
-    die "C compiler test failed."
-fi
-
-add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
-check_cflags -std=c99
-check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
-#include <stdlib.h>
-EOF
-check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
-#include <stdlib.h>
-EOF
-
-check_host_cflags -std=c99
-
-case "$arch" in
-    alpha|ia64|mips|parisc|sparc)
-        spic=$shared
-    ;;
-    x86)
-        subarch="x86_32"
-        check_cc <<EOF && subarch="x86_64"
-        int test[(int)sizeof(char*) - 7];
-EOF
-        if test "$subarch" = "x86_64"; then
-            spic=$shared
-        fi
-    ;;
-esac
-
-enable $subarch
-enabled spic && enable pic
-
-# OS specific
-case $target_os in
-    beos|haiku|zeta)
-        prefix_default="$HOME/config"
-        # 3 gcc releases known for BeOS, each with ugly bugs
-        gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
-        case "$gcc_version" in
-          2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
-            disable mmx
-            ;;
-          *20010315*) echo "BeBits gcc"
-            add_cflags -fno-expensive-optimizations
-            ;;
-        esac
-        SHFLAGS=-nostart
-        # enable BeOS things
-        enable audio_beos
-        # no need for libm, but the inet stuff
-        # Check for BONE
-        # XXX: actually should check for NOT net_server
-        if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
-            network_extralibs="-lbind -lsocket"
-        else
-            enable beos_netserver
-            network_extralibs="-lnet"
-        fi ;;
-    sunos)
-        FFSERVERLDFLAGS=""
-        SHFLAGS='-shared -Wl,-h,$$(@F)'
-        enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
-        network_extralibs="-lsocket -lnsl"
-        add_cppflags -D__EXTENSIONS__
-        nm_opts='-P -g'
-        ;;
-    netbsd)
-        oss_indev_extralibs="-lossaudio"
-        oss_outdev_extralibs="-lossaudio"
-        add_cppflags -D_XOPEN_SOURCE=600
-        ;;
-    openbsd)
-        enable malloc_aligned
-        # On OpenBSD 4.5. the compiler does not use PIC unless
-        # explicitly using -fPIC. Libav builds fine without PIC,
-        # however the generated executable will not do anything
-        # (simply quits with exit-code 1, no crash, no output).
-        # Thus explicitly enable PIC here.
-        enable pic
-        SHFLAGS='-shared'
-        oss_indev_extralibs="-lossaudio"
-        oss_outdev_extralibs="-lossaudio"
-        ;;
-    freebsd|dragonfly)
-        enable malloc_aligned
-        ;;
-    bsd/os)
-        osextralibs="-lpoll -lgnugetopt"
-        strip="strip -d"
-        ;;
-    darwin)
-        enable malloc_aligned
-        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
-        strip="strip -x"
-        FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
-        SLIBSUF=".dylib"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
-        FFSERVERLDFLAGS=-Wl,-bind_at_load
-        objformat="macho"
-        enabled x86_64 && objformat="macho64"
-        enabled_any pic shared ||
-            { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
-        ;;
-    mingw32*)
-        if test $target_os = "mingw32ce"; then
-            disable network
-        else
-            target_os=mingw32
-        fi
-        LIBTARGET=i386
-        if enabled x86_64; then
-            enable malloc_aligned
-            LIBTARGET=x64
-        elif enabled arm; then
-            LIBTARGET=arm
-        fi
-        shlibdir_default="$bindir_default"
-        disable ffserver
-        SLIBPREF=""
-        SLIBSUF=".dll"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
-        SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
-        SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
-            install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
-            install -d "$(LIBDIR)"; \
-            install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
-        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
-        SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
-        objformat="win32"
-        enable dos_paths
-        check_cflags -fno-common
-        if ! enabled x86_64; then
-            check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
-                die "ERROR: MinGW runtime version must be >= 3.15."
-            enabled_any avisynth vfwcap_indev &&
-                { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
-                  die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
-        fi
-        ;;
-    cygwin*)
-        target_os=cygwin
-        shlibdir_default="$bindir_default"
-        SLIBPREF="cyg"
-        SLIBSUF=".dll"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
-        SHFLAGS='-shared -Wl,--enable-auto-image-base'
-        objformat="win32"
-        enable dos_paths
-        check_cflags -fno-common
-        ;;
-    *-dos|freedos|opendos)
-        disable ffplay ffserver
-        disable $INDEV_LIST $OUTDEV_LIST
-        network_extralibs="-lsocket"
-        objformat="coff"
-        enable dos_paths
-        ;;
-    linux)
-        enable dv1394
-        ;;
-    irix*)
-        target_os=irix
-        ranlib="echo ignoring ranlib"
-        ;;
-    os/2*)
-        strip="lxlite"
-        ln_s="cp -f"
-        FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
-        SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
-        FFSERVERLDFLAGS=""
-        LIBSUF="_s.a"
-        SLIBPREF=""
-        SLIBSUF=".dll"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
-        SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
-          echo PROTMODE >> $(SUBDIR)$(NAME).def; \
-          echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
-          echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
-          echo EXPORTS >> $(SUBDIR)$(NAME).def; \
-          emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
-        SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
-          emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
-        SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
-        SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
-        enable dos_paths
-        ;;
-    gnu/kfreebsd)
-        ;;
-    gnu)
-        ;;
-    none)
-        ;;
-    *)
-        die "Unknown OS '$target_os'."
-        ;;
-esac
-
-check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic
-
-set_default $PATHS_LIST
-
-add_extralibs $osextralibs
-
-# Combine FFLDFLAGS and the LDFLAGS environment variable.
-LDFLAGS="$FFLDFLAGS $LDFLAGS"
-
-# we need to build at least one lib type
-if ! enabled_any static shared; then
-    cat <<EOF
-At least one library type must be built.
-Specify --enable-static to build the static libraries or --enable-shared to
-build the shared libraries as well. To only build the shared libraries specify
---disable-static in addition to --enable-shared.
-EOF
-    exit 1;
-fi
-
-disabled static && LIBNAME=""
-
-if enabled_any libfaad libfaadbin ; then
-    if check_header faad.h; then
-        check_cc <<EOF
-#include <faad.h>
-#ifndef FAAD2_VERSION
-ok faad1
-#endif
-int main(void) { return 0; }
-EOF
-        test $? = 0 && enable libfaad2
-    else
-        die "FAAD test failed."
-    fi
-fi
-
-
-die_license_disabled() {
-    enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
-}
-
-die_license_disabled gpl libfaad2
-die_license_disabled gpl libx264
-die_license_disabled gpl libxvid
-die_license_disabled gpl postproc
-die_license_disabled gpl x11grab
-
-die_license_disabled nonfree libfaac
-
-die_license_disabled version3 libopencore_amrnb
-die_license_disabled version3 libopencore_amrwb
-
-enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
-
-check_deps $ARCH_EXT_LIST
-
-disabled optimizations || check_cflags -fomit-frame-pointer
-
-enable_pic() {
-    enable pic
-    add_cppflags -DPIC
-    add_cflags   -fPIC
-    add_asflags  -fPIC
-}
-
-enabled pic && enable_pic
-
-check_cc <<EOF || die "Symbol mangling check failed."
-int ff_extern;
-EOF
-sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
-extern_prefix=${sym%%ff_extern*}
-
-check_cc <<EOF && enable inline_asm
-void foo(void) { __asm__ volatile ("" ::); }
-EOF
-
-_restrict=
-for restrict_keyword in restrict __restrict__ __restrict; do
-    check_cc <<EOF && _restrict=$restrict_keyword && break
-void foo(char * $restrict_keyword p);
-EOF
-done
-
-check_cc <<EOF && enable attribute_packed
-struct { int x; } __attribute__((packed)) x;
-EOF
-
-check_cc <<EOF && enable attribute_may_alias
-union { int x; } __attribute__((may_alias)) x;
-EOF
-
-check_cc <<EOF || die "endian test failed"
-unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
-EOF
-od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
-
-if enabled alpha; then
-
-    check_cflags -mieee
-
-elif enabled arm; then
-
-    check_cflags -marm
-
-    check_ld <<EOF && enable vfp_args
-__asm__ (".eabi_attribute 28, 1");
-int main(void) { return 0; }
-EOF
-
-    # We have to check if pld is a nop and disable it.
-    check_asm pld '"pld [r0]"'
-
-    enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
-    enabled armv6   && check_asm armv6   '"sadd16 r0, r0, r0"'
-    enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"'
-    enabled armvfp  && check_asm armvfp  '"fadds s0, s0, s0"'
-    enabled iwmmxt  && check_asm iwmmxt  '"wunpckelub wr6, wr4"'
-    enabled neon    && check_asm neon    '"vadd.i16 q0, q0, q0"'
-
-    enabled_all armv6t2 shared !pic && enable_pic
-
-elif enabled mips; then
-
-    check_asm loongson '"dmult.g $1, $2, $3"'
-    enabled mmi     && check_asm mmi     '"lq $2, 0($2)"'
-
-elif enabled ppc; then
-
-    enable local_aligned_8 local_aligned_16
-
-    check_asm dcbzl     '"dcbzl 0, 1"'
-    check_asm ppc4xx    '"maclhw r10, r11, r12"'
-    check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
-
-    # AltiVec flags: The FSF version of GCC differs from the Apple version
-    if enabled altivec; then
-        check_cflags -maltivec -mabi=altivec &&
-        { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
-        check_cflags -faltivec
-
-        # check if our compiler supports Motorola AltiVec C API
-        check_cc <<EOF || disable altivec
-$inc_altivec_h
-int main(void) {
-    vector signed int v1, v2, v3;
-    v1 = vec_add(v2,v3);
-    return 0;
-}
-EOF
-
-        # check if our compiler supports braces for vector declarations
-        check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
-$inc_altivec_h
-int main (void) { (vector int) {1}; return 0; }
-EOF
-    fi
-
-elif enabled sparc; then
-
-    enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc &&
-        add_cflags -mcpu=ultrasparc -mtune=ultrasparc
-
-elif enabled x86; then
-
-    enable local_aligned_8 local_aligned_16
-
-    # check whether EBP is available on x86
-    # As 'i' is stored on the stack, this program will crash
-    # if the base pointer is used to access it because the
-    # base pointer is cleared in the inline assembly code.
-    check_exec_crash <<EOF && enable ebp_available
-    volatile int i=0;
-    __asm__ volatile (
-        "xorl %%ebp, %%ebp"
-    ::: "%ebp");
-    return i;
-EOF
-
-    # check whether EBX is available on x86
-    check_asm ebx_available '""::"b"(0)' &&
-        check_asm ebx_available '"":::"%ebx"'
-
-    # check whether more than 10 operands are supported
-    check_cc <<EOF && enable ten_operands
-int main(void) {
-    int x=0;
-    __asm__ volatile(
-        ""
-        :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x)
-    );
-    return 0;
-}
-EOF
-
-    # check whether binutils is new enough to compile SSSE3/MMX2
-    enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
-    enabled mmx2  && check_asm mmx2  '"pmaxub %mm0, %mm1"'
-
-    check_asm bswap '"bswap %%eax" ::: "%eax"'
-
-    YASMFLAGS="-f $objformat -DARCH_$(toupper $subarch)"
-    enabled     x86_64        && append YASMFLAGS "-m amd64"
-    enabled     pic           && append YASMFLAGS "-DPIC"
-    test -n "$extern_prefix"  && append YASMFLAGS "-DPREFIX"
-    case "$objformat" in
-        elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
-    esac
-    disabled yasm || { check_yasm "pabsw xmm0, xmm0" && enable yasm; }
-
-    case "$cpu" in
-        athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
-            disable fast_clz
-        ;;
-    esac
-
-fi
-
-if check_func dlopen; then
-    ldl=
-elif check_func dlopen -ldl; then
-    ldl=-ldl
-fi
-
-# Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
-check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
-
-check_func  fork
-check_func  getaddrinfo $network_extralibs
-check_func  gethrtime
-check_func  getrusage
-check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
-check_func  inet_aton $network_extralibs
-check_func  isatty
-check_func  ${malloc_prefix}memalign            && enable memalign
-check_func  mkstemp
-check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
-check_func  setrlimit
-check_func  strerror_r
-check_func_headers io.h setmode
-check_func_headers lzo/lzo1x.h lzo1x_999_compress
-check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
-check_func_headers windows.h GetProcessTimes
-check_func_headers windows.h VirtualAlloc
-
-check_header conio.h
-check_header dlfcn.h
-check_header dxva2api.h
-check_header malloc.h
-check_header poll.h
-check_header sys/mman.h
-check_header sys/resource.h
-check_header sys/select.h
-check_header termios.h
-check_header vdpau/vdpau.h
-check_header vdpau/vdpau_x11.h
-check_header X11/extensions/XvMClib.h
-
-check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
-
-if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
-     enabled_any $need_memalign ; then
-    die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
-fi
-
-disabled  zlib || check_lib   zlib.h      zlibVersion -lz   || disable  zlib
-disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
-
-# check for some common methods of building with pthread support
-# do this before the optional library checks as some of them require pthreads
-if enabled pthreads; then
-    if check_func pthread_create; then
-        :
-    elif check_func pthread_create -pthread; then
-        add_cflags -pthread
-        add_extralibs -pthread
-    elif check_func pthread_create -pthreads; then
-        add_cflags -pthreads
-        add_extralibs -pthreads
-    elif check_func pthread_create -lpthreadGC2; then
-        add_extralibs -lpthreadGC2
-    elif ! check_lib pthread.h pthread_create -lpthread; then
-        die "ERROR: can't find pthreads library"
-    fi
-fi
-
-for thread in $THREADS_LIST; do
-    if enabled $thread; then
-        test -n "$thread_type" &&
-            die "ERROR: Only one thread type must be selected." ||
-            thread_type="$thread"
-    fi
-done
-
-check_lib math.h sin -lm
-check_lib va/va.h vaInitialize -lva
-
-check_mathfunc exp2
-check_mathfunc exp2f
-check_mathfunc llrint
-check_mathfunc llrintf
-check_mathfunc log2
-check_mathfunc log2f
-check_mathfunc lrint
-check_mathfunc lrintf
-check_mathfunc round
-check_mathfunc roundf
-check_mathfunc truncf
-
-# these are off by default, so fail if requested and not available
-enabled avisynth   && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
-enabled libdirac   && add_cflags $(pkg-config --cflags dirac) &&
-                      require  libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
-                      require  libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
-enabled libfaac    && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
-enabled libfaad    && require2 libfaad faad.h faacDecOpen -lfaad
-enabled libgsm     && require  libgsm gsm/gsm.h gsm_create -lgsm
-enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
-enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
-enabled libopencore_amrnb  && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb -lm
-enabled libopencore_amrwb  && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -lm
-enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
-enabled librtmp    && require  librtmp librtmp/rtmp.h RTMP_Init $(pkg-config --libs librtmp)
-enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
-                           require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
-enabled libspeex   && require  libspeex speex/speex.h speex_decoder_init -lspeex
-enabled libtheora  && require  libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
-enabled libvorbis  && require  libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
-enabled libvpx     && require2 libvpx "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver" -lvpx &&
-                      require2 libvpx "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver" -lvpx
-enabled libx264    && require  libx264 x264.h x264_encoder_encode -lx264 -lm &&
-                      { check_cpp_condition x264.h "X264_BUILD >= 83" ||
-                        die "ERROR: libx264 version must be >= 0.83."; }
-enabled libxvid    && require  libxvid xvid.h xvid_global -lxvidcore
-enabled mlib       && require  mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
-
-# libdc1394 check
-if enabled libdc1394; then
-    { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
-        enable libdc1394_2; } ||
-    { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
-        enable libdc1394_1; } ||
-    die "ERROR: No version of libdc1394 found "
-fi
-
-SDL_CONFIG="${cross_prefix}sdl-config"
-if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
-    sdl_cflags=$("${SDL_CONFIG}" --cflags)
-    sdl_libs=$("${SDL_CONFIG}" --libs)
-    check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
-    check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
-    enable sdl &&
-    check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
-fi
-
-texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
-
-if enabled network; then
-    check_type "sys/types.h sys/socket.h" socklen_t
-    check_type netdb.h "struct addrinfo"
-    check_type netinet/in.h "struct ipv6_mreq"
-    check_type netinet/in.h "struct sockaddr_in6"
-    check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
-    check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
-    # Prefer arpa/inet.h over winsock2
-    if check_header arpa/inet.h ; then
-        check_func closesocket
-    elif check_header winsock2.h ; then
-        check_func_headers winsock2.h closesocket -lws2 && \
-            network_extralibs="-lws2" || \
-        { check_func_headers winsock2.h closesocket -lws2_32 && \
-            network_extralibs="-lws2_32"; }
-        check_type ws2tcpip.h socklen_t
-        check_type ws2tcpip.h "struct addrinfo"
-        check_type ws2tcpip.h "struct ipv6_mreq"
-        check_type ws2tcpip.h "struct sockaddr_in6"
-        check_type ws2tcpip.h "struct sockaddr_storage"
-        check_struct winsock2.h "struct sockaddr" sa_len
-    else
-        disable network
-    fi
-fi
-
-check_header linux/videodev.h
-check_header linux/videodev2.h
-check_header sys/videoio.h
-
-check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
-
-# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
-{ check_header dev/bktr/ioctl_meteor.h &&
-  check_header dev/bktr/ioctl_bt848.h; } ||
-{ check_header machine/ioctl_meteor.h &&
-  check_header machine/ioctl_bt848.h; } ||
-{ check_header dev/video/meteor/ioctl_meteor.h &&
-  check_header dev/video/bktr/ioctl_bt848.h; } ||
-check_header dev/ic/bt8xx.h
-
-check_header sys/soundcard.h
-check_header soundcard.h
-
-enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
-
-enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
-
-enabled x11grab                         &&
-check_header X11/Xlib.h                 &&
-check_header X11/extensions/XShm.h      &&
-check_header X11/extensions/Xfixes.h    &&
-check_func XOpenDisplay -lX11           &&
-check_func XShmCreateImage -lX11 -lXext &&
-check_func XFixesGetCursorImage -lX11 -lXext -lXfixes
-
-if ! disabled vdpau && enabled vdpau_vdpau_h; then
-check_cpp_condition \
-    vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
-    { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." &&
-      disable vdpau; }
-fi
-
-enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
-
-# add some useful compiler flags if supported
-check_cflags -Wdeclaration-after-statement
-check_cflags -Wall
-check_cflags -Wno-switch
-check_cflags -Wdisabled-optimization
-check_cflags -Wpointer-arith
-check_cflags -Wredundant-decls
-check_cflags -Wno-pointer-sign
-check_cflags -Wcast-qual
-check_cflags -Wwrite-strings
-check_cflags -Wtype-limits
-check_cflags -Wundef
-check_cflags -Wmissing-prototypes
-enabled extra_warnings && check_cflags -Winline
-
-# add some linker flags
-check_ldflags -Wl,--warn-common
-check_ldflags -Wl,--as-needed
-check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
-check_ldflags -Wl,-Bsymbolic
-
-echo "X{};" > $TMPV
-if test_ldflags -Wl,--version-script,$TMPV; then
-    append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
-    check_cc <<EOF && enable symver_asm_label
-void ff_foo(void) __asm__ ("av_foo at VERSION");
-void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
-EOF
-    check_cc <<EOF && enable symver_gnu_asm
-__asm__(".symver ff_foo,av_foo at VERSION");
-void ff_foo(void) {}
-EOF
-fi
-
-if enabled small; then
-    add_cflags $size_cflags
-    optimizations="small"
-elif enabled optimizations; then
-    add_cflags $speed_cflags
-else
-    add_cflags $noopt_cflags
-fi
-check_cflags -fno-math-errno
-check_cflags -fno-signed-zeros
-
-if enabled icc; then
-    # Just warnings, no remarks
-    check_cflags -w1
-    # -wd: Disable following warnings
-    # 144, 167, 556: -Wno-pointer-sign
-    # 10006: ignoring unknown option -fno-signed-zeros
-    # 10156: ignoring option '-W'; no argument required
-    check_cflags -wd144,167,556,10006,10156
-    # 11030: Warning unknown option --as-needed
-    # 10156: ignoring option '-export'; no argument required
-    check_ldflags -wd10156,11030
-    # Allow to compile with optimizations
-    check_ldflags -march=$cpu
-    # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
-    enable ebp_available
-elif enabled ccc; then
-    # disable some annoying warnings
-    add_cflags -msg_disable cvtu32to64
-    add_cflags -msg_disable embedcomment
-    add_cflags -msg_disable needconstext
-    add_cflags -msg_disable nomainieee
-    add_cflags -msg_disable ptrmismatch1
-    add_cflags -msg_disable unreachcode
-elif enabled gcc; then
-    check_cflags -fno-tree-vectorize
-    check_cflags -Werror=implicit
-    check_cflags -Werror=missing-prototypes
-elif enabled clang; then
-    check_cflags -Qunused-arguments
-elif enabled armcc; then
-    # 2523: use of inline assembler is deprecated
-    add_cflags -Wrvct,--diag_suppress=2523
-    add_cflags -Wrvct,--diag_suppress=1207
-elif enabled tms470; then
-    add_cflags -pds=824 -pds=837
-fi
-
-if enabled gprof; then
-    add_cflags  -p
-    add_ldflags -p
-fi
-
-# Find out if the .align argument is a power of two or not.
-check_asm asmalign_pot '".align 3"'
-
-enabled_any $THREADS_LIST      && enable threads
-
-check_deps $CONFIG_LIST       \
-           $CONFIG_EXTRA      \
-           $HAVE_LIST         \
-           $DECODER_LIST      \
-           $ENCODER_LIST      \
-           $HWACCEL_LIST      \
-           $PARSER_LIST       \
-           $BSF_LIST          \
-           $DEMUXER_LIST      \
-           $MUXER_LIST        \
-           $FILTER_LIST       \
-           $INDEV_LIST        \
-           $OUTDEV_LIST       \
-           $PROTOCOL_LIST     \
-
-enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
-
-echo "install prefix            $prefix"
-echo "source path               $source_path"
-echo "C compiler                $cc"
-echo ".align is power-of-two    $asmalign_pot"
-echo "ARCH                      $arch ($cpu)"
-if test "$build_suffix" != ""; then
-    echo "build suffix              $build_suffix"
-fi
-if test "$extra_version" != ""; then
-    echo "version string suffix     $extra_version"
-fi
-echo "big-endian                ${bigendian-no}"
-echo "runtime cpu detection     ${runtime_cpudetect-no}"
-if enabled x86; then
-    echo "yasm                      ${yasm-no}"
-    echo "MMX enabled               ${mmx-no}"
-    echo "MMX2 enabled              ${mmx2-no}"
-    echo "3DNow! enabled            ${amd3dnow-no}"
-    echo "3DNow! extended enabled   ${amd3dnowext-no}"
-    echo "SSE enabled               ${sse-no}"
-    echo "SSSE3 enabled             ${ssse3-no}"
-    echo "CMOV enabled              ${cmov-no}"
-    echo "CMOV is fast              ${fast_cmov-no}"
-    echo "EBX available             ${ebx_available-no}"
-    echo "EBP available             ${ebp_available-no}"
-    echo "10 operands supported     ${ten_operands-no}"
-fi
-if enabled arm; then
-    echo "ARMv5TE enabled           ${armv5te-no}"
-    echo "ARMv6 enabled             ${armv6-no}"
-    echo "ARMv6T2 enabled           ${armv6t2-no}"
-    echo "ARM VFP enabled           ${armvfp-no}"
-    echo "IWMMXT enabled            ${iwmmxt-no}"
-    echo "NEON enabled              ${neon-no}"
-fi
-if enabled mips; then
-    echo "MMI enabled               ${mmi-no}"
-fi
-if enabled ppc; then
-    echo "AltiVec enabled           ${altivec-no}"
-    echo "PPC 4xx optimizations     ${ppc4xx-no}"
-    echo "dcbzl available           ${dcbzl-no}"
-    echo "performance report        ${powerpc_perf-no}"
-fi
-if enabled sparc; then
-    echo "VIS enabled               ${vis-no}"
-fi
-echo "gprof enabled             ${gprof-no}"
-echo "debug symbols             ${debug-no}"
-echo "strip symbols             ${stripping-no}"
-echo "optimizations             ${optimizations-no}"
-echo "static                    ${static-no}"
-echo "shared                    ${shared-no}"
-echo "postprocessing support    ${postproc-no}"
-echo "new filter support        ${avfilter-no}"
-echo "filters using lavformat   ${avfilter_lavf-no}"
-echo "network support           ${network-no}"
-echo "threading support         ${thread_type-no}"
-echo "SDL support               ${sdl-no}"
-echo "Sun medialib support      ${mlib-no}"
-echo "AVISynth enabled          ${avisynth-no}"
-echo "libdc1394 support         ${libdc1394-no}"
-echo "libdirac enabled          ${libdirac-no}"
-echo "libfaac enabled           ${libfaac-no}"
-echo "libfaad enabled           ${libfaad-no}"
-echo "libfaad dlopened          ${libfaadbin-no}"
-echo "libgsm enabled            ${libgsm-no}"
-echo "libmp3lame enabled        ${libmp3lame-no}"
-echo "libnut enabled            ${libnut-no}"
-echo "libopencore-amrnb support ${libopencore_amrnb-no}"
-echo "libopencore-amrwb support ${libopencore_amrwb-no}"
-echo "libopenjpeg enabled       ${libopenjpeg-no}"
-echo "librtmp enabled           ${librtmp-no}"
-echo "libschroedinger enabled   ${libschroedinger-no}"
-echo "libspeex enabled          ${libspeex-no}"
-echo "libtheora enabled         ${libtheora-no}"
-echo "libvorbis enabled         ${libvorbis-no}"
-echo "libvpx enabled            ${libvpx-no}"
-echo "libx264 enabled           ${libx264-no}"
-echo "libxvid enabled           ${libxvid-no}"
-echo "zlib enabled              ${zlib-no}"
-echo "bzlib enabled             ${bzlib-no}"
-echo
-
-for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
-    echo "Enabled ${type}s:"
-    eval list=\$$(toupper $type)_LIST
-    for part in $list; do
-        enabled $part && echo ${part%_*}
-    done | sort | pr -3 -t
-    echo
-done
-
-license="LGPL version 2.1 or later"
-if enabled nonfree; then
-    license="nonfree and unredistributable"
-elif enabled gplv3; then
-    license="GPL version 3 or later"
-elif enabled lgplv3; then
-    license="LGPL version 3 or later"
-elif enabled gpl; then
-    license="GPL version 2 or later"
-fi
-
-echo "License: $license"
-
-echo "Creating config.mak and config.h..."
-
-# build tree in object directory if source path is different from current one
-if enabled source_path_used; then
-    DIRS="
-        doc
-        libavcodec
-        libavcodec/$arch
-        libavdevice
-        libavfilter
-        libavformat
-        libavutil
-        libavutil/$arch
-        libpostproc
-        libswscale
-        libswscale/$arch
-        tests
-        tools
-    "
-    FILES="
-        Makefile
-        common.mak
-        subdir.mak
-        doc/texi2pod.pl
-        libavcodec/Makefile
-        libavcodec/${arch}/Makefile
-        libavdevice/Makefile
-        libavfilter/Makefile
-        libavformat/Makefile
-        libavutil/Makefile
-        libpostproc/Makefile
-        libswscale/Makefile
-    "
-    map 'mkdir -p $v' $DIRS;
-    map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES
-fi
-
-enabled stripping || strip="echo skipping strip"
-
-cat > config.mak <<EOF
-# Automatically generated by configure - do not modify!
-ifndef FFMPEG_CONFIG_MAK
-FFMPEG_CONFIG_MAK=1
-FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
-prefix=$prefix
-LIBDIR=\$(DESTDIR)$libdir
-SHLIBDIR=\$(DESTDIR)$shlibdir
-INCDIR=\$(DESTDIR)$incdir
-BINDIR=\$(DESTDIR)$bindir
-DATADIR=\$(DESTDIR)$datadir
-MANDIR=\$(DESTDIR)$mandir
-SRC_PATH="$source_path"
-SRC_PATH_BARE=$source_path
-BUILD_ROOT="$PWD"
-ARCH=$arch
-CC=$cc
-AS=$as
-LD=$ld
-DEPCC=$dep_cc
-YASM=$yasmexe
-YASMDEP=$yasmexe
-AR=$ar
-RANLIB=$ranlib
-CP=cp -p
-LN_S=$ln_s
-STRIP=$strip
-CPPFLAGS=$CPPFLAGS
-CFLAGS=$CFLAGS
-ASFLAGS=$ASFLAGS
-CC_O=$CC_O
-LDFLAGS=$LDFLAGS
-FFSERVERLDFLAGS=$FFSERVERLDFLAGS
-SHFLAGS=$SHFLAGS
-YASMFLAGS=$YASMFLAGS
-BUILDSUF=$build_suffix
-FULLNAME=$FULLNAME
-LIBPREF=$LIBPREF
-LIBSUF=$LIBSUF
-LIBNAME=$LIBNAME
-SLIBPREF=$SLIBPREF
-SLIBSUF=$SLIBSUF
-EXESUF=$EXESUF
-EXTRA_VERSION=$extra_version
-DEPFLAGS=$DEPFLAGS
-CCDEP=$CCDEP
-ASDEP=$ASDEP
-CC_DEPFLAGS=$CC_DEPFLAGS
-AS_DEPFLAGS=$AS_DEPFLAGS
-HOSTCC=$host_cc
-HOSTCFLAGS=$host_cflags
-HOSTEXESUF=$HOSTEXESUF
-HOSTLDFLAGS=$host_ldflags
-HOSTLIBS=$host_libs
-TARGET_EXEC=$target_exec
-TARGET_PATH=$target_path
-SDL_LIBS=$sdl_libs
-SDL_CFLAGS=$sdl_cflags
-LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
-EXTRALIBS=$extralibs
-INSTALL=install
-LIBTARGET=${LIBTARGET}
-SLIBNAME=${SLIBNAME}
-SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
-SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
-SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
-SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
-SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
-SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
-SAMPLES=$samples
-EOF
-
-get_version(){
-    name=$1
-    file=$source_path/$2
-    eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
-    eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
-    lcname=$(tolower $name)
-    eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
-    eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
-}
-
-get_version LIBSWSCALE  libswscale/swscale.h
-get_version LIBPOSTPROC libpostproc/postprocess.h
-get_version LIBAVCODEC  libavcodec/avcodec.h
-get_version LIBAVDEVICE libavdevice/avdevice.h
-get_version LIBAVFORMAT libavformat/avformat.h
-get_version LIBAVUTIL   libavutil/avutil.h
-get_version LIBAVFILTER libavfilter/avfilter.h
-
-enabled asmalign_pot || align_shift="1 <<"
-
-cat > $TMPH <<EOF
-/* Automatically generated by configure - do not modify! */
-#ifndef FFMPEG_CONFIG_H
-#define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
-#define FFMPEG_LICENSE "$(c_escape $license)"
-#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
-#define CC_TYPE "$cc_type"
-#define CC_VERSION $cc_version
-#define restrict $_restrict
-#define ASMALIGN(ZEROBITS) ".align $align_shift " #ZEROBITS "\\n\\t"
-#define EXTERN_PREFIX "${extern_prefix}"
-#define EXTERN_ASM ${extern_prefix}
-EOF
-
-test -n "$malloc_prefix" &&
-    echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
-
-if enabled small || disabled optimizations; then
-    echo "#undef  av_always_inline"  >> $TMPH
-    echo "#define av_always_inline"  >> $TMPH
-fi
-
-print_config ARCH_   $TMPH config.mak $ARCH_LIST
-print_config HAVE_   $TMPH config.mak $HAVE_LIST
-print_config CONFIG_ $TMPH config.mak $CONFIG_LIST       \
-                                      $CONFIG_EXTRA      \
-                                      $DECODER_LIST      \
-                                      $ENCODER_LIST      \
-                                      $HWACCEL_LIST      \
-                                      $PARSER_LIST       \
-                                      $BSF_LIST          \
-                                      $DEMUXER_LIST      \
-                                      $MUXER_LIST        \
-                                      $FILTER_LIST       \
-                                      $PROTOCOL_LIST     \
-                                      $INDEV_LIST        \
-                                      $OUTDEV_LIST       \
-
-echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
-echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
-
-# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
-cp_if_changed $TMPH config.h
-
-cat > $TMPH <<EOF
-/* Generated by ffconf */
-#ifndef AVUTIL_AVCONFIG_H
-#define AVUTIL_AVCONFIG_H
-EOF
-
-print_config AV_HAVE_ $TMPH /dev/null $HAVE_LIST_PUB
-
-echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
-
-cp_if_changed $TMPH libavutil/avconfig.h
-
-# build pkg-config files
-
-pkgconfig_generate(){
-name=$1
-shortname=${name#lib}${build_suffix}
-comment=$2
-version=$3
-libs=$4
-requires=$5
-cat <<EOF > $name/$name.pc
-prefix=$prefix
-exec_prefix=\${prefix}
-libdir=$libdir
-includedir=$incdir
-
-Name: $name
-Description: $comment
-Version: $version
-Requires: $(enabled shared || echo $requires)
-Requires.private: $(enabled shared && echo $requires)
-Conflicts:
-Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
-Libs.private: $(enabled shared && echo $libs)
-Cflags: -I\${includedir}
-EOF
-cat <<EOF > $name/$name-uninstalled.pc
-prefix=
-exec_prefix=
-libdir=\${pcfiledir}
-includedir=${source_path}
-
-Name: $name
-Description: $comment
-Version: $version
-Requires: $requires
-Conflicts:
-Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
-Cflags: -I\${includedir}
-EOF
-}
-
-pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION"
-pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
-pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
-pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
-enabled avfilter &&
-    pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
-enabled postproc &&
-    pkgconfig_generate libpostproc "Libav post processing library" "$LIBPOSTPROC_VERSION"
-pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
diff --git a/debian/changelog b/debian/changelog
index 769f227..db505b1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-libav-extra (4:0.6.2-0ubuntu1) natty; urgency=low
+libav-extra (4:0.6.2-1ubuntu1) natty; urgency=low
 
   * rename to libav-extra
 
diff --git a/debian/control b/debian/control
index e837eb9..5cae531 100644
--- a/debian/control
+++ b/debian/control
@@ -16,6 +16,7 @@ Vcs-Browser: http://git.debian.org/?p=pkg-multimedia/libav.git;a=summary
 Homepage: http://libav.org/
 Build-Depends: debhelper (>= 7),
  libasound2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386],
+ libav-source,
  libbz2-dev,
  libdc1394-22-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386],
  libdirac-dev,
@@ -42,7 +43,6 @@ Build-Depends: debhelper (>= 7),
  libxfixes-dev,
  libxvidcore-dev | libxvidcore4-dev,
  libxvmc-dev,
- quilt,
  texi2html,
  yasm [i386 amd64],
  zlib1g-dev
diff --git a/debian/gbp.conf b/debian/gbp.conf
index cc8019e..7056557 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -3,4 +3,4 @@ upstream-branch = upstream
 debian-branch = ubuntu.extra
 upstream-tag = upstream/%(version)s
 debian-tag = extra/debian/%(version)s
-pristine-tar = True
+pristine-tar = False
diff --git a/debian/patches/0002-Tweak-doxygen-config.patch b/debian/patches/0002-Tweak-doxygen-config.patch
deleted file mode 100644
index 0b719af..0000000
--- a/debian/patches/0002-Tweak-doxygen-config.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Reinhard Tartler <siretart at tauware.de>
-Date: Mon, 28 Jun 2010 22:43:55 +0200
-Subject: [PATCH] Tweak doxygen config
-
-exclude some directories we use for packaging from doxygen documentation
----
- Doxyfile |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/Doxyfile b/Doxyfile
-index ee233b9..1251d34 100644
---- a/Doxyfile
-+++ b/Doxyfile
-@@ -359,7 +359,7 @@ RECURSIVE              = YES
- # excluded from the INPUT source files. This way you can easily exclude a
- # subdirectory from a directory tree whose root is specified with the INPUT tag.
- 
--EXCLUDE                =
-+EXCLUDE                = debian debian-shared debian-static debian-cmov .pc .git
- 
- # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
- # that are symbolic links (a Unix filesystem feature) are excluded from the input.
--- 
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index 3949993..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1 +0,0 @@
-0002-Tweak-doxygen-config.patch
diff --git a/debian/rules b/debian/rules
index 3128ec1..fb85cbd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,7 +1,5 @@
 #!/usr/bin/make -f
 
-include /usr/share/quilt/quilt.make
-
 EPOCH=4:
 DEB_SOURCE := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
 DEB_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
@@ -34,11 +32,14 @@ snapshot_version:
 		cp .svnrevision $@
 	touch $@
 
+libav/configure:
+	tar xvf /usr/src/libav-source.tar.gz
+
 configure-%: configure-stamp-%
-configure-stamp-%: $(QUILT_STAMPFN) snapshot_version
+configure-stamp-%: snapshot_version libav/configure
 	dh_testdir
 	mkdir -p debian-$*
-	cd debian-$* && CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(CURDIR)/configure \
+	cd debian-$* && CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(CURDIR)/libav/configure \
 		$($*_build_confflags) $(extra_$*_build_confflags)
 	touch $@
 
@@ -52,7 +53,7 @@ debian-shared/tools/qt-faststart: build-stamp-shared
 	$(MAKE) -C debian-shared tools/qt-faststart V=1
 
 build-doxy: build-doxy-stamp
-build-doxy-stamp: $(QUILT_STAMPFN)
+build-doxy-stamp:
 	dh_testdir
 	doxygen
 	touch $@
@@ -61,14 +62,14 @@ build: build-stamp
 build-stamp: $(addprefix build-stamp-, $(FLAVORS)) debian-shared/tools/qt-faststart
 	touch $@
 
-clean: clean-real unpatch
+clean: clean-real
 clean-real:
 	dh_testdir
 	dh_testroot
 	rm -f build-stamp $(addprefix build-stamp-, $(FLAVORS)) \
 	    $(addprefix configure-stamp-, $(FLAVORS)) patch-stamp \
 	    build-doxy-stamp
-	rm -rf $(addprefix debian-, $(FLAVORS)) doxy
+	rm -rf $(addprefix debian-, $(FLAVORS)) doxy libav
 	dh_clean
 
 get-orig-source:
@@ -103,12 +104,12 @@ binary-indep: install
 binary-arch: build install codecs.txt formats.txt
 	dh_testdir
 	dh_testroot
-	dh_installdocs $(extradoc) doc/optimization.txt
-	dh_installdocs -A MAINTAINERS CREDITS doc/TODO
+	dh_installdocs $(extradoc) libav/doc/optimization.txt
+	dh_installdocs -A libav/CREDITS libav/doc/TODO
 	dh_installdocs -A debian/README.Debian
 	dh_installdocs -p libavcodec-extra-52 codecs.txt
 	dh_installdocs -p libavformat-extra-52 formats.txt
-	dh_installchangelogs Changelog
+	dh_installchangelogs libav/Changelog
 	dh_lintian
 	dh_link
 	dh_compress
diff --git a/debian/source/format b/debian/source/format
index d3827e7..89ae9db 100644
--- a/debian/source/format
+++ b/debian/source/format
@@ -1 +1 @@
-1.0
+3.0 (native)
diff --git a/doc/APIchanges b/doc/APIchanges
deleted file mode 100644
index db69658..0000000
--- a/doc/APIchanges
+++ /dev/null
@@ -1,239 +0,0 @@
-Never assume the API of libav* to be stable unless at least 1 week has passed since
-the last major version increase.
-The last version increases were:
-libavcodec:  ?
-libavdevice: ?
-libavfilter: 2009-10-18
-libavformat: ?
-libpostproc: ?
-libswscale:  ?
-libavutil:   2009-03-08
-
-
-API changes, most recent first:
-
-2010-06-01 - r31301 - lsws 0.11.0 - convertPalette API
-  Add sws_convertPalette8ToPacked32 and sws_convertPalette8ToPacked24
-
-2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
-  Add CODEC_CAP_EXPERIMENTAL flag.
-
-2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
-  Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags
-
-2010-05-01 - r23002 - lavf 52.62.0 - probe function
-  Add av_probe_input_format2 to API, it allows ignoring probe
-  results below given score and returns the actual probe score.
-
-2010-04-01 - r22806 - lavf 52.61.0 - metadata API
-  Add a flag for av_metadata_set2() to disable overwriting of
-  existing tags.
-
-2010-04-01 - r22753 - lavc 52.66.0
-  Add avcodec_get_edge_width()
-
-2010-03-31 - r22750 - lavc 52.65.0
-  Add avcodec_copy_context().
-
-2010-03-31 - r22748 - lavf 52.60.0 - av_match_ext()
-  Make av_match_ext() public.
-
-2010-03-31 - r22736 - lavu 50.14.0 - AVMediaType
-  Move AVMediaType enum from libavcodec to libavutil.
-
-2010-03-31 - r22735 - lavc 52.64.0 - AVMediaType
-  Define AVMediaType enum, and use it instead of enum CodecType, which
-  is deprecated and will be dropped at the next major bump.
-
-2010-03-25 - r22684 - lavu 50.13.0 - av_strerror()
-  Implement av_strerror().
-
-2010-03-23 - r22649 - lavc 52.60.0 - av_dct_init()
-  Support DCT-I and DST-I
-
-2010-03-15 - r22540 - lavf 52.56.0 - AVFormatContext.start_time_realtime
-  Add AVFormatContext.start_time_realtime field.
-
-2010-03-13 - r22506 - lavfi 1.18.0 - AVFilterPicRef.pos
-  Add AVFilterPicRef.pos field.
-
-2010-03-13 - r22501 - lavu 50.12.0 - error.h
-  Move error code definitions from libavcodec/avcodec.h to
-  the new public header libavutil/error.h.
-
-2010-03-07 - r22291 - lavc 52.56.0 - avfft.h
-  Add public FFT interface.
-
-2010-03-06 - r22251 - lavu 50.11.0 - av_stristr()
-  Add av_stristr().
-
-2010-03-03 - r22174 - lavu 50.10.0 - av_tree_enumerate()
-  Add av_tree_enumerate().
-
-2010-02-07 - r21673 - lavu 50.9.0 - av_compare_ts()
-  Add av_compare_ts().
-
-2010-02-05 - r30513 - lsws 0.10.0 - sws_getCoefficients()
-  Add sws_getCoefficients().
-
-2010-02-01 - r21587 - lavf 52.50.0 - metadata API
-  Add a list of generic tag names, change 'author' -> 'artist',
-  'year' -> 'date'.
-
-2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt()
-  Add av_get_pix_fmt().
-
-2010-01-21 - r30381 - lsws 0.9.0 - sws_scale
-  Change constness attributes of sws_scale() parameters.
-
-2010-01-10 - r21121 - lavfi 1.15.0 - avfilter_graph_config_links()
-  Add a log_ctx parameter to avfilter_graph_config_links().
-
-2010-01-07 - r30236 - lsws 0.8.0 - sws_isSupported{In,Out}put
-  Add sws_isSupportedInput() and sws_isSupportedOutput() functions.
-
-2010-01-06 - r21035 - lavfi 1.14.0 - avfilter_add_colorspace()
-  Change the avfilter_add_colorspace() signature, make it accept an
-  (AVFilterFormats **) rather than an (AVFilterFormats *) as before.
-
-2010-01-03 - r21007 - lavfi 1.13.0 - avfilter_add_colorspace()
-  Add avfilter_add_colorspace().
-
-2010-01-02 - r20998 - lavf 52.46.0 - av_match_ext()
-  Add av_match_ext(), it should be used in place of match_ext().
-
-2010-01-01 - r20991 - lavf 52.45.0 - av_guess_format()
-  Add av_guess_format(), it should be used in place of guess_format().
-
-2009-12-13 - r20834 - lavf 52.43.0 - metadata API
-  Add av_metadata_set2(), AV_METADATA_DONT_STRDUP_KEY and AV_METADATA_DONT_STRDUP_VAL.
-
-2009-12-13 - r20829 - lavu 50.7.0 - avstring.h API
-  Add av_d2str().
-
-2009-12-13 - r20826 - lavc 52.42.0 - AVStream
-  Add avg_frame_rate.
-
-2009-12-12 - r20808 - lavu 50.6.0 - av_bmg_next()
-  Introduce the av_bmg_next() function.
-
-2009-12-05 - r20734 - lavfi 1.12.0 - avfilter_draw_slice()
-  Add a slice_dir parameter to avfilter_draw_slice().
-
-2009-11-26 - r20611 - lavfi 1.11.0 - AVFilter
-  Remove the next field from AVFilter, this is not anymore required.
-
-2009-11-25 - r20607 - lavfi 1.10.0 - avfilter_next()
-  Introduce the avfilter_next() function.
-
-2009-11-25 - r20605 - lavfi 1.9.0 - avfilter_register()
-  Change the signature of avfilter_register() to make it return an
-  int. This is required since now the registration operation may fail.
-
-2009-11-25 - r20603 - lavu 50.5.0 - pixdesc.h API
-  Make the pixdesc.h API public.
-
-2009-10-27 - r20385 - lavfi 1.5.0 - AVFilter.next
-  Add a next field to AVFilter, this is used for simplifying the
-  registration and management of the registered filters.
-
-2009-10-23 - r20356 - lavfi 1.4.1 - AVFilter.description
-  Add a description field to AVFilter.
-
-2009-10-19 - r20302 - lavfi 1.3.0 - avfilter_make_format_list()
-  Change the interface of avfilter_make_format_list() from
-  avfilter_make_format_list(int n, ...) to
-  avfilter_make_format_list(enum PixelFormat *pix_fmts).
-
-2009-10-18 - r20272 - lavfi 1.0.0 - avfilter_get_video_buffer()
-  Make avfilter_get_video_buffer() recursive and add the w and h
-  parameters to it.
-
-2009-10-07 - r20189 - lavfi 0.5.1 - AVFilterPic
-  Add w and h fields to AVFilterPic.
-
-2009-06-22 - r19250 - lavf 52.34.1 - AVFormatContext.packet_size
-  This is now an unsigned int instead of a signed int.
-
-2009-06-19 - r19222 - lavc 52.32.0 - AVSubtitle.pts
-  Add a pts field to AVSubtitle which gives the subtitle packet pts
-  in AV_TIME_BASE. Some subtitle de-/encoders (e.g. XSUB) will
-  not work right without this.
-
-2009-06-03 - r19078 - lavc 52.30.2 - AV_PKT_FLAG_KEY
-  PKT_FLAG_KEY has been deprecated and will be dropped at the next
-  major version. Use AV_PKT_FLAG_KEY instead.
-
-2009-06-01 - r19025 - lavc 52.30.0 - av_lockmgr_register()
-  av_lockmgr_register() can be used to register a callback function
-  that lavc (and in the future, libraries that depend on lavc) can use
-  to implement mutexes. The application should provide a callback function
-  that implements the AV_LOCK_* operations described in avcodec.h.
-  When the lock manager is registered, FFmpeg is guaranteed to behave
-  correctly in a multi-threaded application.
-
-2009-04-30 - r18719 - lavc 52.28.0 - av_free_packet
-  av_free_packet() is no longer an inline function. It is now exported.
-
-2009-04-11 - r18431 - lavc 52.25.0 - deprecate av_destruct_packet_nofree
-  Please use NULL instead. This has been supported since r16506
-  (lavf > 52.23.1, lavc > 52.10.0).
-
-2009-04-07 - r18351 - lavc 52.23.0 - avcodec_decode_video/audio/subtitle
-  The old decoding functions are deprecated, all new code should use the
-  new functions avcodec_decode_video2(), avcodec_decode_audio3() and
-  avcodec_decode_subtitle2(). These new functions take an AVPacket *pkt
-  argument instead of a const uint8_t *buf / int buf_size pair.
-
-2009-04-03 - r18321 - lavu 50.3.0 - av_fifo_space
-  Introduce the av_fifo_space() function.
-
-2009-04-02 - r18317 - lavc 52.23.0 - AVPacket
-  Move AVPacket declaration from libavformat/avformat.h to
-  libavcodec/avcodec.h.
-
-2009-03-22 - r18163 - lavu 50.2.0 - RGB32 pixel formats
-  Convert the pixel formats PIX_FMT_ARGB, PIX_FMT_RGBA, PIX_FMT_ABGR,
-  PIX_FMT_BGRA, which were defined as macros, into enum PixelFormat values.
-  Conversely PIX_FMT_RGB32, PIX_FMT_RGB32_1, PIX_FMT_BGR32 and
-  PIX_FMT_BGR32_1 are now macros.
-  avcodec_get_pix_fmt() now recognizes the "rgb32" and "bgr32" aliases.
-  Re-sort the enum PixelFormat list accordingly.
-  This change breaks API/ABI backward compatibility.
-
-2009-03-22 - r18133 - lavu 50.1.0 - PIX_FMT_RGB5X5 endian variants
-  Add the enum PixelFormat values:
-  PIX_FMT_RGB565BE, PIX_FMT_RGB565LE, PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
-  PIX_FMT_BGR565BE, PIX_FMT_BGR565LE, PIX_FMT_BGR555BE, PIX_FMT_BGR555LE.
-
-2009-03-21 - r18116 - lavu 50.0.0  - av_random*
-  The Mersenne Twister PRNG implemented through the av_random* functions
-  was removed. Use the lagged Fibonacci PRNG through the av_lfg* functions
-  instead.
-
-2009-03-08 - r17869 - lavu 50.0.0  - AVFifoBuffer
-  av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped
-  and replaced by av_fifo_alloc, av_fifo_generic_read, av_fifo_generic_write
-  and av_fifo_realloc2.
-  In addition, the order of the function arguments of av_fifo_generic_read
-  was changed to match av_fifo_generic_write.
-  The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by
-  applications, they may not use sizeof() or directly access members.
-
-2009-03-01 - r17682 - lavf 52.31.0 - Generic metadata API
-  Introduce a new metadata API (see av_metadata_get() and friends).
-  The old API is now deprecated and should not be used anymore. This especially
-  includes the following structure fields:
-    - AVFormatContext.title
-    - AVFormatContext.author
-    - AVFormatContext.copyright
-    - AVFormatContext.comment
-    - AVFormatContext.album
-    - AVFormatContext.year
-    - AVFormatContext.track
-    - AVFormatContext.genre
-    - AVStream.language
-    - AVStream.filename
-    - AVProgram.provider_name
-    - AVProgram.name
-    - AVChapter.title
diff --git a/doc/TODO b/doc/TODO
deleted file mode 100644
index f03270e..0000000
--- a/doc/TODO
+++ /dev/null
@@ -1,90 +0,0 @@
-ffmpeg TODO list:
-----------------
-
-Fabrice's TODO list: (unordered)
--------------------
-Short term:
-
-- use AVFMTCTX_DISCARD_PKT in ffplay so that DV has a chance to work
-- add RTSP regression test (both client and server)
-- make ffserver allocate AVFormatContext
-- clean up (incompatible change, for 0.5.0):
-    * AVStream -> AVComponent
-    * AVFormatContext -> AVInputStream/AVOutputStream
-    * suppress rate_emu from AVCodecContext
-- add new float/integer audio filterting and conversion : suppress
-  CODEC_ID_PCM_xxc and use CODEC_ID_RAWAUDIO.
-- fix telecine and frame rate conversion
-
-Long term (ask me if you want to help):
-
-- commit new imgconvert API and new PIX_FMT_xxx alpha formats
-- commit new LGPL'ed float and integer-only AC3 decoder
-- add WMA integer-only decoder
-- add new MPEG4-AAC audio decoder (both integer-only and float version)
-
-Michael's TODO list: (unordered) (if anyone wanna help with sth, just ask)
--------------------
-- optimize H264 CABAC
-- more optimizations
-- simper rate control
-
-Francois' TODO list: (unordered, without any timeframe)
--------------------
-- test MACE decoder against the openquicktime one as suggested by A'rpi
-- BeOS audio input grabbing backend
-- BeOS video input grabbing backend
-- publish my BeOS libposix on BeBits so I can officially support ffserver :)
-- check the whole code for thread-safety (global and init stuff)
-
-Philip'a TODO list: (alphabetically ordered) (please help)
-------------------
-- Add a multi-ffm filetype so that feeds can be recorded into multiple files rather
-  than one big file.
-- Authenticated users support -- where the authentication is in the URL
-- Change ASF files so that the embedded timestamp in the frames is right rather
-  than being an offset from the start of the stream
-- Make ffm files more resilient to changes in the codec structures so that you
-  can play old ffm files.
-
-Baptiste's TODO list:
------------------
-- mov edit list support (AVEditList)
-- YUV 10 bit per component support "2vuy"
-- mxf muxer
-- mpeg2 non linear quantizer
-
-unassigned TODO: (unordered)
----------------
-- use AVFrame for audio codecs too
-- rework aviobuf.c buffering strategy and fix url_fskip
-- generate optimal huffman tables for mjpeg encoding
-- fix ffserver regression tests
-- support xvids motion estimation
-- support x264s motion estimation
-- support x264s rate control
-- SNOW: non translational motion compensation
-- SNOW: more optimal quantization
-- SNOW: 4x4 block support
-- SNOW: 1/8 pel motion compensation support
-- SNOW: iterative motion estimation based on subsampled images
-- SNOW: try B frames and MCTF and see how their PSNR/bitrate/complexity behaves
-- SNOW: try to use the wavelet transformed MC-ed reference frame as context for the entropy coder
-- SNOW: think about/analyize how to make snow use multiple cpus/threads
-- SNOW: finish spec
-- FLAC: lossy encoding (viterbi and naive scalar quantization)
-- libavfilter
-- JPEG2000 decoder & encoder
-- MPEG4 GMC encoding support
-- macroblock based pixel format (better cache locality, somewhat complex, one paper claimed it faster for high res)
-- regression tests for codecs which do not have an encoder (I+P-frame bitstream in svn)
-- add support for using mplayers video filters to ffmpeg
-- H264 encoder
-- per MB ratecontrol (so VCD and such do work better)
-- write a script which iteratively changes all functions between always_inline and noinline and benchmarks the result to find the best set of inlined functions
-- convert all the non SIMD asm into small asm vs. C testcases and submit them to the gcc devels so they can improve gcc
-- generic audio mixing API
-- extract PES packetizer from PS muxer and use it for new TS muxer
-- implement automatic AVBistreamFilter activation
-- make cabac encoder use bytestream (see http://trac.videolan.org/x264/changeset/?format=diff&new=651)
-- merge imdct and windowing, the current code does considerable amounts of redundant work
diff --git a/doc/avutil.txt b/doc/avutil.txt
deleted file mode 100644
index 210bd07..0000000
--- a/doc/avutil.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-AVUtil
-======
-libavutil is a small lightweight library of generally useful functions.
-It is not a library for code needed by both libavcodec and libavformat.
-
-
-Overview:
-=========
-adler32.c               adler32 checksum
-aes.c                   AES encryption and decryption
-fifo.c                  resizeable first in first out buffer
-intfloat_readwrite.c    portable reading and writing of floating point values
-log.c                   "printf" with context and level
-md5.c                   MD5 Message-Digest Algorithm
-rational.c              code to perform exact calculations with rational numbers
-tree.c                  generic AVL tree
-crc.c                   generic CRC checksumming code
-integer.c               128bit integer math
-lls.c
-mathematics.c           greatest common divisor, integer sqrt, integer log2, ...
-mem.c                   memory allocation routines with guaranteed alignment
-softfloat.c
-
-Headers:
-bswap.h                 big/little/native-endian conversion code
-x86_cpu.h               a few useful macros for unifying x86-64 and x86-32 code
-avutil.h
-common.h
-intreadwrite.h          reading and writing of unaligned big/little/native-endian integers
-
-
-Goals:
-======
-* Modular (few interdependencies and the possibility of disabling individual parts during ./configure)
-* Small (source and object)
-* Efficient (low CPU and memory usage)
-* Useful (avoid useless features almost no one needs)
diff --git a/doc/developer.texi b/doc/developer.texi
deleted file mode 100644
index edce7ea..0000000
--- a/doc/developer.texi
+++ /dev/null
@@ -1,436 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle Developer Documentation
- at titlepage
- at sp 7
- at center @titlefont{Developer Documentation}
- at sp 3
- at end titlepage
-
-
- at chapter Developers Guide
-
- at section API
- at itemize @bullet
- at item libavcodec is the library containing the codecs (both encoding and
-decoding). Look at @file{libavcodec/apiexample.c} to see how to use it.
-
- at item libavformat is the library containing the file format handling (mux and
-demux code for several formats). Look at @file{ffplay.c} to use it in a
-player. See @file{libavformat/output-example.c} to use it to generate
-audio or video streams.
-
- at end itemize
-
- at section Integrating libavcodec or libavformat in your program
-
-You can integrate all the source code of the libraries to link them
-statically to avoid any version problem. All you need is to provide a
-'config.mak' and a 'config.h' in the parent directory. See the defines
-generated by ./configure to understand what is needed.
-
-You can use libavcodec or libavformat in your commercial program, but
- at emph{any patch you make must be published}. The best way to proceed is
-to send your patches to the FFmpeg mailing list.
-
- at anchor{Coding Rules}
- at section Coding Rules
-
-FFmpeg is programmed in the ISO C90 language with a few additional
-features from ISO C99, namely:
- at itemize @bullet
- at item
-the @samp{inline} keyword;
- at item
- at samp{//} comments;
- at item
-designated struct initializers (@samp{struct s x = @{ .i = 17 @};})
- at item
-compound literals (@samp{x = (struct s) @{ 17, 23 @};})
- at end itemize
-
-These features are supported by all compilers we care about, so we will not
-accept patches to remove their use unless they absolutely do not impair
-clarity and performance.
-
-All code must compile with GCC 2.95 and GCC 3.3. Currently, FFmpeg also
-compiles with several other compilers, such as the Compaq ccc compiler
-or Sun Studio 9, and we would like to keep it that way unless it would
-be exceedingly involved. To ensure compatibility, please do not use any
-additional C99 features or GCC extensions. Especially watch out for:
- at itemize @bullet
- at item
-mixing statements and declarations;
- at item
- at samp{long long} (use @samp{int64_t} instead);
- at item
- at samp{__attribute__} not protected by @samp{#ifdef __GNUC__} or similar;
- at item
-GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}).
- at end itemize
-
-Indent size is 4.
-The presentation is one inspired by 'indent -i4 -kr -nut'.
-The TAB character is forbidden outside of Makefiles as is any
-form of trailing whitespace. Commits containing either will be
-rejected by the Subversion repository.
-
-The main priority in FFmpeg is simplicity and small code size in order to
-minimize the bug count.
-
-Comments: Use the JavaDoc/Doxygen
-format (see examples below) so that code documentation
-can be generated automatically. All nontrivial functions should have a comment
-above them explaining what the function does, even if it is just one sentence.
-All structures and their member variables should be documented, too.
- at example
-/**
- * @@file mpeg.c
- * MPEG codec.
- * @@author ...
- */
-
-/**
- * Summary sentence.
- * more text ...
- * ...
- */
-typedef struct Foobar@{
-    int var1; /**< var1 description */
-    int var2; ///< var2 description
-    /** var3 description */
-    int var3;
-@} Foobar;
-
-/**
- * Summary sentence.
- * more text ...
- * ...
- * @@param my_parameter description of my_parameter
- * @@return return value description
- */
-int myfunc(int my_parameter)
-...
- at end example
-
-fprintf and printf are forbidden in libavformat and libavcodec,
-please use av_log() instead.
-
-Casts should be used only when necessary. Unneeded parentheses
-should also be avoided if they don't make the code easier to understand.
-
- at section Development Policy
-
- at enumerate
- at item
-   Contributions should be licensed under the LGPL 2.1, including an
-   "or any later version" clause, or the MIT license.  GPL 2 including
-   an "or any later version" clause is also acceptable, but LGPL is
-   preferred.
- at item
-   You must not commit code which breaks FFmpeg! (Meaning unfinished but
-   enabled code which breaks compilation or compiles but does not work or
-   breaks the regression tests)
-   You can commit unfinished stuff (for testing etc), but it must be disabled
-   (#ifdef etc) by default so it does not interfere with other developers'
-   work.
- at item
-   You do not have to over-test things. If it works for you, and you think it
-   should work for others, then commit. If your code has problems
-   (portability, triggers compiler bugs, unusual environment etc) they will be
-   reported and eventually fixed.
- at item
-   Do not commit unrelated changes together, split them into self-contained
-   pieces. Also do not forget that if part B depends on part A, but A does not
-   depend on B, then A can and should be committed first and separate from B.
-   Keeping changes well split into self-contained parts makes reviewing and
-   understanding them on the commit log mailing list easier. This also helps
-   in case of debugging later on.
-   Also if you have doubts about splitting or not splitting, do not hesitate to
-   ask/discuss it on the developer mailing list.
- at item
-   Do not change behavior of the program (renaming options etc) without
-   first discussing it on the ffmpeg-devel mailing list. Do not remove
-   functionality from the code. Just improve!
-
-   Note: Redundant code can be removed.
- at item
-   Do not commit changes to the build system (Makefiles, configure script)
-   which change behavior, defaults etc, without asking first. The same
-   applies to compiler warning fixes, trivial looking fixes and to code
-   maintained by other developers. We usually have a reason for doing things
-   the way we do. Send your changes as patches to the ffmpeg-devel mailing
-   list, and if the code maintainers say OK, you may commit. This does not
-   apply to files you wrote and/or maintain.
- at item
-   We refuse source indentation and other cosmetic changes if they are mixed
-   with functional changes, such commits will be rejected and removed. Every
-   developer has his own indentation style, you should not change it. Of course
-   if you (re)write something, you can use your own style, even though we would
-   prefer if the indentation throughout FFmpeg was consistent (Many projects
-   force a given indentation style - we do not.). If you really need to make
-   indentation changes (try to avoid this), separate them strictly from real
-   changes.
-
-   NOTE: If you had to put if()@{ .. @} over a large (> 5 lines) chunk of code,
-   then either do NOT change the indentation of the inner part within (do not
-   move it to the right)! or do so in a separate commit
- at item
-   Always fill out the commit log message. Describe in a few lines what you
-   changed and why. You can refer to mailing list postings if you fix a
-   particular bug. Comments such as "fixed!" or "Changed it." are unacceptable.
- at item
-   If you apply a patch by someone else, include the name and email address in
-   the log message. Since the ffmpeg-cvslog mailing list is publicly
-   archived you should add some SPAM protection to the email address. Send an
-   answer to ffmpeg-devel (or wherever you got the patch from) saying that
-   you applied the patch.
- at item
-   When applying patches that have been discussed (at length) on the mailing
-   list, reference the thread in the log message.
- at item
-    Do NOT commit to code actively maintained by others without permission.
-    Send a patch to ffmpeg-devel instead. If no one answers within a reasonable
-    timeframe (12h for build failures and security fixes, 3 days small changes,
-    1 week for big patches) then commit your patch if you think it is OK.
-    Also note, the maintainer can simply ask for more time to review!
- at item
-    Subscribe to the ffmpeg-cvslog mailing list. The diffs of all commits
-    are sent there and reviewed by all the other developers. Bugs and possible
-    improvements or general questions regarding commits are discussed there. We
-    expect you to react if problems with your code are uncovered.
- at item
-    Update the documentation if you change behavior or add features. If you are
-    unsure how best to do this, send a patch to ffmpeg-devel, the documentation
-    maintainer(s) will review and commit your stuff.
- at item
-    Try to keep important discussions and requests (also) on the public
-    developer mailing list, so that all developers can benefit from them.
- at item
-    Never write to unallocated memory, never write over the end of arrays,
-    always check values read from some untrusted source before using them
-    as array index or other risky things.
- at item
-    Remember to check if you need to bump versions for the specific libav
-    parts (libavutil, libavcodec, libavformat) you are changing. You need
-    to change the version integer.
-    Incrementing the first component means no backward compatibility to
-    previous versions (e.g. removal of a function from the public API).
-    Incrementing the second component means backward compatible change
-    (e.g. addition of a function to the public API or extension of an
-    existing data structure).
-    Incrementing the third component means a noteworthy binary compatible
-    change (e.g. encoder bug fix that matters for the decoder).
- at item
-    Compiler warnings indicate potential bugs or code with bad style. If a type of
-    warning always points to correct and clean code, that warning should
-    be disabled, not the code changed.
-    Thus the remaining warnings can either be bugs or correct code.
-    If it is a bug, the bug has to be fixed. If it is not, the code should
-    be changed to not generate a warning unless that causes a slowdown
-    or obfuscates the code.
- at item
-    If you add a new file, give it a proper license header. Do not copy and
-    paste it from a random place, use an existing file as template.
- at end enumerate
-
-We think our rules are not too hard. If you have comments, contact us.
-
-Note, these rules are mostly borrowed from the MPlayer project.
-
- at section Submitting patches
-
-First, (@pxref{Coding Rules}) above if you did not yet.
-
-When you submit your patch, try to send a unified diff (diff '-up'
-option). We cannot read other diffs :-)
-
-Also please do not submit a patch which contains several unrelated changes.
-Split it into separate, self-contained pieces. This does not mean splitting
-file by file. Instead, make the patch as small as possible while still
-keeping it as a logical unit that contains an individual change, even
-if it spans multiple files. This makes reviewing your patches much easier
-for us and greatly increases your chances of getting your patch applied.
-
-Use the patcheck tool of FFmpeg to check your patch.
-The tool is located in the tools directory.
-
-Run the regression tests before submitting a patch so that you can
-verify that there are no big problems.
-
-Patches should be posted as base64 encoded attachments (or any other
-encoding which ensures that the patch will not be trashed during
-transmission) to the ffmpeg-devel mailing list, see
- at url{http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel}
-
-It also helps quite a bit if you tell us what the patch does (for example
-'replaces lrint by lrintf'), and why (for example '*BSD isn't C99 compliant
-and has no lrint()')
-
-Also please if you send several patches, send each patch as a separate mail,
-do not attach several unrelated patches to the same mail.
-
-Your patch will be reviewed on the mailing list. You will likely be asked
-to make some changes and are expected to send in an improved version that
-incorporates the requests from the review. This process may go through
-several iterations. Once your patch is deemed good enough, some developer
-will pick it up and commit it to the official FFmpeg tree.
-
-Give us a few days to react. But if some time passes without reaction,
-send a reminder by email. Your patch should eventually be dealt with.
-
-
- at section New codecs or formats checklist
-
- at enumerate
- at item
-    Did you use av_cold for codec initialization and close functions?
- at item
-    Did you add a long_name under NULL_IF_CONFIG_SMALL to the AVCodec or
-    AVInputFormat/AVOutputFormat struct?
- at item
-    Did you bump the minor version number in @file{avcodec.h} or
-    @file{avformat.h}?
- at item
-    Did you register it in @file{allcodecs.c} or @file{allformats.c}?
- at item
-    Did you add the CodecID to @file{avcodec.h}?
- at item
-    If it has a fourcc, did you add it to @file{libavformat/riff.c},
-    even if it is only a decoder?
- at item
-    Did you add a rule to compile the appropriate files in the Makefile?
-    Remember to do this even if you're just adding a format to a file that is
-    already being compiled by some other rule, like a raw demuxer.
- at item
-    Did you add an entry to the table of supported formats or codecs in
-    @file{doc/general.texi}?
- at item
-    Did you add an entry in the Changelog?
- at item
-    If it depends on a parser or a library, did you add that dependency in
-    configure?
- at item
-    Did you "svn add" the appropriate files before commiting?
- at end enumerate
-
- at section patch submission checklist
-
- at enumerate
- at item
-    Do the regression tests pass with the patch applied?
- at item
-    Does @code{make checkheaders} pass with the patch applied?
- at item
-    Is the patch a unified diff?
- at item
-    Is the patch against latest FFmpeg SVN?
- at item
-    Are you subscribed to ffmpeg-dev?
-    (the list is subscribers only due to spam)
- at item
-    Have you checked that the changes are minimal, so that the same cannot be
-    achieved with a smaller patch and/or simpler final code?
- at item
-    If the change is to speed critical code, did you benchmark it?
- at item
-    If you did any benchmarks, did you provide them in the mail?
- at item
-    Have you checked that the patch does not introduce buffer overflows or
-    other security issues?
- at item
-    Did you test your decoder or demuxer against damaged data? If no, see
-    tools/trasher and the noise bitstream filter. Your decoder or demuxer
-    should not crash or end in a (near) infinite loop when fed damaged data.
- at item
-    Is the patch created from the root of the source tree, so it can be
-    applied with @code{patch -p0}?
- at item
-    Does the patch not mix functional and cosmetic changes?
- at item
-    Did you add tabs or trailing whitespace to the code? Both are forbidden.
- at item
-    Is the patch attached to the email you send?
- at item
-    Is the mime type of the patch correct? It should be text/x-diff or
-    text/x-patch or at least text/plain and not application/octet-stream.
- at item
-    If the patch fixes a bug, did you provide a verbose analysis of the bug?
- at item
-    If the patch fixes a bug, did you provide enough information, including
-    a sample, so the bug can be reproduced and the fix can be verified?
-    Note please do not attach samples >100k to mails but rather provide a
-    URL, you can upload to ftp://upload.ffmpeg.org
- at item
-    Did you provide a verbose summary about what the patch does change?
- at item
-    Did you provide a verbose explanation why it changes things like it does?
- at item
-    Did you provide a verbose summary of the user visible advantages and
-    disadvantages if the patch is applied?
- at item
-    Did you provide an example so we can verify the new feature added by the
-    patch easily?
- at item
-    If you added a new file, did you insert a license header? It should be
-    taken from FFmpeg, not randomly copied and pasted from somewhere else.
- at item
-    You should maintain alphabetical order in alphabetically ordered lists as
-    long as doing so does not break API/ABI compatibility.
- at item
-    Lines with similar content should be aligned vertically when doing so
-    improves readability.
- at item
-    Did you provide a suggestion for a clear commit log message?
- at end enumerate
-
- at section Patch review process
-
-All patches posted to ffmpeg-devel will be reviewed, unless they contain a
-clear note that the patch is not for SVN.
-Reviews and comments will be posted as replies to the patch on the
-mailing list. The patch submitter then has to take care of every comment,
-that can be by resubmitting a changed patch or by discussion. Resubmitted
-patches will themselves be reviewed like any other patch. If at some point
-a patch passes review with no comments then it is approved, that can for
-simple and small patches happen immediately while large patches will generally
-have to be changed and reviewed many times before they are approved.
-After a patch is approved it will be committed to the repository.
-
-We will review all submitted patches, but sometimes we are quite busy so
-especially for large patches this can take several weeks.
-
-When resubmitting patches, please do not make any significant changes
-not related to the comments received during review. Such patches will
-be rejected. Instead, submit  significant changes or new features as
-separate patches.
-
- at section Regression tests
-
-Before submitting a patch (or committing to the repository), you should at least
-test that you did not break anything.
-
-The regression tests build a synthetic video stream and a synthetic
-audio stream. These are then encoded and decoded with all codecs or
-formats. The CRC (or MD5) of each generated file is recorded in a
-result file. A 'diff' is launched to compare the reference results and
-the result file. The output is checked immediately after each test
-has run.
-
-The regression tests then go on to test the FFserver code with a
-limited set of streams. It is important that this step runs correctly
-as well.
-
-Run 'make test' to test all the codecs and formats. Commands like
-'make regtest-mpeg2' can be used to run a single test. By default,
-make will abort if any test fails. To run all tests regardless,
-use make -k. To get a more verbose output, use 'make V=1 test' or
-'make V=2 test'.
-
-Run 'make fulltest' to test all the codecs, formats and FFserver.
-
-[Of course, some patches may change the results of the regression tests. In
-this case, the reference results of the regression tests shall be modified
-accordingly].
-
- at bye
diff --git a/doc/faq.texi b/doc/faq.texi
deleted file mode 100644
index ec01b9e..0000000
--- a/doc/faq.texi
+++ /dev/null
@@ -1,503 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle FFmpeg FAQ
- at titlepage
- at sp 7
- at center @titlefont{FFmpeg FAQ}
- at sp 3
- at end titlepage
-
-
- at chapter General Questions
-
- at section When will the next FFmpeg version be released? / Why are FFmpeg releases so few and far between?
-
-Like most open source projects FFmpeg suffers from a certain lack of
-manpower. For this reason the developers have to prioritize the work
-they do and putting out releases is not at the top of the list, fixing
-bugs and reviewing patches takes precedence. Please don't complain or
-request more timely and/or frequent releases unless you are willing to
-help out creating them.
-
- at section I have a problem with an old version of FFmpeg; where should I report it?
-Nowhere. Upgrade to the latest release or if there is no recent release upgrade
-to Subversion HEAD. You could also try to report it. Maybe you will get lucky and
-become the first person in history to get an answer different from "upgrade
-to Subversion HEAD".
-
- at section Why doesn't FFmpeg support feature [xyz]?
-
-Because no one has taken on that task yet. FFmpeg development is
-driven by the tasks that are important to the individual developers.
-If there is a feature that is important to you, the best way to get
-it implemented is to undertake the task yourself or sponsor a developer.
-
- at section FFmpeg does not support codec XXX. Can you include a Windows DLL loader to support it?
-
-No. Windows DLLs are not portable, bloated and often slow.
-Moreover FFmpeg strives to support all codecs natively.
-A DLL loader is not conducive to that goal.
-
- at section My bug report/mail to ffmpeg-devel/user has not received any replies.
-
-Likely reasons
- at itemize
- at item We are busy and haven't had time yet to read your report or
-investigate the issue.
- at item You didn't follow bugreports.html.
- at item You didn't use Subversion HEAD.
- at item You reported a segmentation fault without gdb output.
- at item You describe a problem but not how to reproduce it.
- at item It's unclear if you use ffmpeg as command line tool or use
-libav* from another application.
- at item You speak about a video having problems on playback but
-not what you use to play it.
- at item We have no faint clue what you are talking about besides
-that it is related to FFmpeg.
- at end itemize
-
- at section Is there a forum for FFmpeg? I do not like mailing lists.
-
-You may view our mailing lists with a more forum-alike look here:
- at url{http://dir.gmane.org/gmane.comp.video.ffmpeg.user},
-but, if you post, please remember that our mailing list rules still apply there.
-
- at section I cannot read this file although this format seems to be supported by ffmpeg.
-
-Even if ffmpeg can read the container format, it may not support all its
-codecs. Please consult the supported codec list in the ffmpeg
-documentation.
-
- at section Which codecs are supported by Windows?
-
-Windows does not support standard formats like MPEG very well, unless you
-install some additional codecs.
-
-The following list of video codecs should work on most Windows systems:
- at table @option
- at item msmpeg4v2
-.avi/.asf
- at item msmpeg4
-.asf only
- at item wmv1
-.asf only
- at item wmv2
-.asf only
- at item mpeg4
-Only if you have some MPEG-4 codec like ffdshow or Xvid installed.
- at item mpeg1
-.mpg only
- at end table
-Note, ASF files often have .wmv or .wma extensions in Windows. It should also
-be mentioned that Microsoft claims a patent on the ASF format, and may sue
-or threaten users who create ASF files with non-Microsoft software. It is
-strongly advised to avoid ASF where possible.
-
-The following list of audio codecs should work on most Windows systems:
- at table @option
- at item adpcm_ima_wav
- at item adpcm_ms
- at item pcm
-always
- at item mp3
-If some MP3 codec like LAME is installed.
- at end table
-
-
- at chapter Compilation
-
- at section @code{error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'}
-
-This is a bug in gcc. Do not report it to us. Instead, please report it to
-the gcc developers. Note that we will not add workarounds for gcc bugs.
-
-Also note that (some of) the gcc developers believe this is not a bug or
-not a bug they should fix:
- at url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203}.
-Then again, some of them do not know the difference between an undecidable
-problem and an NP-hard problem...
-
- at chapter Usage
-
- at section ffmpeg does not work; what is wrong?
-
-Try a @code{make distclean} in the ffmpeg source directory before the build. If this does not help see
-(@url{http://ffmpeg.org/bugreports.html}).
-
- at section How do I encode single pictures into movies?
-
-First, rename your pictures to follow a numerical sequence.
-For example, img1.jpg, img2.jpg, img3.jpg,...
-Then you may run:
-
- at example
-  ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
- at end example
-
-Notice that @samp{%d} is replaced by the image number.
-
- at file{img%03d.jpg} means the sequence @file{img001.jpg}, @file{img002.jpg}, etc...
-
-If you have large number of pictures to rename, you can use the
-following command to ease the burden. The command, using the bourne
-shell syntax, symbolically links all files in the current directory
-that match @code{*jpg} to the @file{/tmp} directory in the sequence of
- at file{img001.jpg}, @file{img002.jpg} and so on.
-
- at example
-  x=1; for i in *jpg; do counter=$(printf %03d $x); ln "$i" /tmp/img"$counter".jpg; x=$(($x+1)); done
- at end example
-
-If you want to sequence them by oldest modified first, substitute
- at code{$(ls -r -t *jpg)} in place of @code{*jpg}.
-
-Then run:
-
- at example
-  ffmpeg -f image2 -i /tmp/img%03d.jpg /tmp/a.mpg
- at end example
-
-The same logic is used for any image format that ffmpeg reads.
-
- at section How do I encode movie to single pictures?
-
-Use:
-
- at example
-  ffmpeg -i movie.mpg movie%d.jpg
- at end example
-
-The @file{movie.mpg} used as input will be converted to
- at file{movie1.jpg}, @file{movie2.jpg}, etc...
-
-Instead of relying on file format self-recognition, you may also use
- at table @option
- at item -vcodec ppm
- at item -vcodec png
- at item -vcodec mjpeg
- at end table
-to force the encoding.
-
-Applying that to the previous example:
- at example
-  ffmpeg -i movie.mpg -f image2 -vcodec mjpeg menu%d.jpg
- at end example
-
-Beware that there is no "jpeg" codec. Use "mjpeg" instead.
-
- at section Why do I see a slight quality degradation with multithreaded MPEG* encoding?
-
-For multithreaded MPEG* encoding, the encoded slices must be independent,
-otherwise thread n would practically have to wait for n-1 to finish, so it's
-quite logical that there is a small reduction of quality. This is not a bug.
-
- at section How can I read from the standard input or write to the standard output?
-
-Use @file{-} as file name.
-
- at section Why does the chrominance data seem to be sampled at a different time from the luminance data on bt8x8 captures on Linux?
-
-This is a well-known bug in the bt8x8 driver. For 2.4.26 there is a patch at
-(@url{http://svn.ffmpeg.org/michael/trunk/patches/bttv-420-2.4.26.patch?view=co}). This may also
-apply cleanly to other 2.4-series kernels.
-
- at section How do I avoid the ugly aliasing artifacts in bt8x8 captures on Linux?
-
-Pass 'combfilter=1 lumafilter=1' to the bttv driver. Note though that 'combfilter=1'
-will cause somewhat too strong filtering. A fix is to apply (@url{http://svn.ffmpeg.org/michael/trunk/patches/bttv-comb-2.4.26.patch?view=co})
-or (@url{http://svn.ffmpeg.org/michael/trunk/patches/bttv-comb-2.6.6.patch?view=co})
-and pass 'combfilter=2'.
-
- at section -f jpeg doesn't work.
-
-Try '-f image2 test%d.jpg'.
-
- at section Why can I not change the framerate?
-
-Some codecs, like MPEG-1/2, only allow a small number of fixed framerates.
-Choose a different codec with the -vcodec command line option.
-
- at section How do I encode Xvid or DivX video with ffmpeg?
-
-Both Xvid and DivX (version 4+) are implementations of the ISO MPEG-4
-standard (note that there are many other coding formats that use this
-same standard). Thus, use '-vcodec mpeg4' to encode in these formats. The
-default fourcc stored in an MPEG-4-coded file will be 'FMP4'. If you want
-a different fourcc, use the '-vtag' option. E.g., '-vtag xvid' will
-force the fourcc 'xvid' to be stored as the video fourcc rather than the
-default.
-
- at section How do I encode videos which play on the iPod?
-
- at table @option
- at item needed stuff
--acodec libfaac -vcodec mpeg4 width<=320 height<=240
- at item working stuff
-4mv, title
- at item non-working stuff
-B-frames
- at item example command line
-ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 320x180 -metadata title=X output.mp4
- at end table
-
- at section How do I encode videos which play on the PSP?
-
- at table @option
- at item needed stuff
--acodec libfaac -vcodec mpeg4 width*height<=76800 width%16=0 height%16=0 -ar 24000 -r 30000/1001 or 15000/1001 -f psp
- at item working stuff
-4mv, title
- at item non-working stuff
-B-frames
- at item example command line
-ffmpeg -i input -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -ar 24000 -mbd 2 -flags +4mv -trellis 2 -aic 2 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -metadata title=X -f psp output.mp4
- at item needed stuff for H.264
--acodec libfaac -vcodec libx264 width*height<=76800 width%16=0? height%16=0? -ar 48000 -coder 1 -r 30000/1001 or 15000/1001 -f psp
- at item working stuff for H.264
-title, loop filter
- at item non-working stuff for H.264
-CAVLC
- at item example command line
-ffmpeg -i input -acodec libfaac -ab 128kb -vcodec libx264 -b 1200kb -ar 48000 -mbd 2 -coder 1 -cmp 2 -subcmp 2 -s 368x192 -r 30000/1001 -metadata title=X -f psp -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 output.mp4
- at item higher resolution for newer PSP firmwares, width<=480, height<=272
--vcodec libx264 -level 21 -coder 1 -f psp
- at item example command line
-ffmpeg -i input -acodec libfaac -ab 128kb -ac 2 -ar 48000 -vcodec libx264 -level 21 -b 640kb -coder 1 -f psp -flags +loop -trellis 2 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -g 250 -s 480x272 output.mp4
- at end table
-
- at section Which are good parameters for encoding high quality MPEG-4?
-
-'-mbd rd -flags +4mv+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2',
-things to try: '-bf 2', '-flags qprd', '-flags mv0', '-flags skiprd'.
-
- at section Which are good parameters for encoding high quality MPEG-1/MPEG-2?
-
-'-mbd rd -trellis 2 -cmp 2 -subcmp 2 -g 100 -pass 1/2'
-but beware the '-g 100' might cause problems with some decoders.
-Things to try: '-bf 2', '-flags qprd', '-flags mv0', '-flags skiprd.
-
- at section Interlaced video looks very bad when encoded with ffmpeg, what is wrong?
-
-You should use '-flags +ilme+ildct' and maybe '-flags +alt' for interlaced
-material, and try '-top 0/1' if the result looks really messed-up.
-
- at section How can I read DirectShow files?
-
-If you have built FFmpeg with @code{./configure --enable-avisynth}
-(only possible on MinGW/Cygwin platforms),
-then you may use any file that DirectShow can read as input.
-(Be aware that this feature has been recently added,
-so you will need to help yourself in case of problems.)
-
-Just create an "input.avs" text file with this single line ...
- at example
-  DirectShowSource("C:\path to your file\yourfile.asf")
- at end example
-... and then feed that text file to FFmpeg:
- at example
-  ffmpeg -i input.avs
- at end example
-
-For ANY other help on Avisynth, please visit @url{http://www.avisynth.org/}.
-
- at section How can I join video files?
-
-A few multimedia containers (MPEG-1, MPEG-2 PS, DV) allow to join video files by
-merely concatenating them.
-
-Hence you may concatenate your multimedia files by first transcoding them to
-these privileged formats, then using the humble @code{cat} command (or the
-equally humble @code{copy} under Windows), and finally transcoding back to your
-format of choice.
-
- at example
-ffmpeg -i input1.avi -sameq intermediate1.mpg
-ffmpeg -i input2.avi -sameq intermediate2.mpg
-cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
-ffmpeg -i intermediate_all.mpg -sameq output.avi
- at end example
-
-Notice that you should either use @code{-sameq} or set a reasonably high
-bitrate for your intermediate and output files, if you want to preserve
-video quality.
-
-Also notice that you may avoid the huge intermediate files by taking advantage
-of named pipes, should your platform support it:
-
- at example
-mkfifo intermediate1.mpg
-mkfifo intermediate2.mpg
-ffmpeg -i input1.avi -sameq -y intermediate1.mpg < /dev/null &
-ffmpeg -i input2.avi -sameq -y intermediate2.mpg < /dev/null &
-cat intermediate1.mpg intermediate2.mpg |\
-ffmpeg -f mpeg -i - -sameq -vcodec mpeg4 -acodec libmp3lame output.avi
- at end example
-
-Similarly, the yuv4mpegpipe format, and the raw video, raw audio codecs also
-allow concatenation, and the transcoding step is almost lossless.
-When using multiple yuv4mpegpipe(s), the first line needs to be discarded
-from all but the first stream. This can be accomplished by piping through
- at code{tail} as seen below. Note that when piping through @code{tail} you
-must use command grouping, @code{@{  ;@}}, to background properly.
-
-For example, let's say we want to join two FLV files into an output.flv file:
-
- at example
-mkfifo temp1.a
-mkfifo temp1.v
-mkfifo temp2.a
-mkfifo temp2.v
-mkfifo all.a
-mkfifo all.v
-ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null &
-ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null &
-ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null &
-@{ ffmpeg -i input2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; @} &
-cat temp1.a temp2.a > all.a &
-cat temp1.v temp2.v > all.v &
-ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \
-       -f yuv4mpegpipe -i all.v \
-       -sameq -y output.flv
-rm temp[12].[av] all.[av]
- at end example
-
- at section FFmpeg does not adhere to the -maxrate setting, some frames are bigger than maxrate/fps.
-
-Read the MPEG spec about video buffer verifier.
-
- at section I want CBR, but no matter what I do frame sizes differ.
-
-You do not understand what CBR is, please read the MPEG spec.
-Read about video buffer verifier and constant bitrate.
-The one sentence summary is that there is a buffer and the input rate is
-constant, the output can vary as needed.
-
- at section How do I check if a stream is CBR?
-
-To quote the MPEG-2 spec:
-"There is no way to tell that a bitstream is constant bitrate without
-examining all of the vbv_delay values and making complicated computations."
-
-
- at chapter Development
-
- at section Are there examples illustrating how to use the FFmpeg libraries, particularly libavcodec and libavformat?
-
-Yes. Read the Developers Guide of the FFmpeg documentation. Alternatively,
-examine the source code for one of the many open source projects that
-already incorporate FFmpeg at (@url{projects.html}).
-
- at section Can you support my C compiler XXX?
-
-It depends. If your compiler is C99-compliant, then patches to support
-it are likely to be welcome if they do not pollute the source code
-with @code{#ifdef}s related to the compiler.
-
- at section Is Microsoft Visual C++ supported?
-
-No. Microsoft Visual C++ is not compliant to the C99 standard and does
-not - among other things - support the inline assembly used in FFmpeg.
-If you wish to use MSVC++ for your
-project then you can link the MSVC++ code with libav* as long as
-you compile the latter with a working C compiler. For more information, see
-the @emph{Microsoft Visual C++ compatibility} section in the FFmpeg
-documentation.
-
-There have been efforts to make FFmpeg compatible with MSVC++ in the
-past. However, they have all been rejected as too intrusive, especially
-since MinGW does the job adequately. None of the core developers
-work with MSVC++ and thus this item is low priority. Should you find
-the silver bullet that solves this problem, feel free to shoot it at us.
-
-We strongly recommend you to move over from MSVC++ to MinGW tools.
-
- at section Can I use FFmpeg or libavcodec under Windows?
-
-Yes, but the Cygwin or MinGW tools @emph{must} be used to compile FFmpeg.
-Read the @emph{Windows} section in the FFmpeg documentation to find more
-information.
-
-To get help and instructions for building FFmpeg under Windows, check out
-the FFmpeg Windows Help Forum at
- at url{http://ffmpeg.arrozcru.org/}.
-
- at section Can you add automake, libtool or autoconf support?
-
-No. These tools are too bloated and they complicate the build.
-
- at section Why not rewrite ffmpeg in object-oriented C++?
-
-FFmpeg is already organized in a highly modular manner and does not need to
-be rewritten in a formal object language. Further, many of the developers
-favor straight C; it works for them. For more arguments on this matter,
-read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}).
-
- at section Why are the ffmpeg programs devoid of debugging symbols?
-
-The build process creates ffmpeg_g, ffplay_g, etc. which contain full debug
-information. Those binaries are stripped to create ffmpeg, ffplay, etc. If
-you need the debug information, used the *_g versions.
-
- at section I do not like the LGPL, can I contribute code under the GPL instead?
-
-Yes, as long as the code is optional and can easily and cleanly be placed
-under #if CONFIG_GPL without breaking anything. So for example a new codec
-or filter would be OK under GPL while a bug fix to LGPL code would not.
-
- at section I want to compile xyz.c alone but my compiler produced many errors.
-
-Common code is in its own files in libav* and is used by the individual
-codecs. They will not work without the common parts, you have to compile
-the whole libav*. If you wish, disable some parts with configure switches.
-You can also try to hack it and remove more, but if you had problems fixing
-the compilation failure then you are probably not qualified for this.
-
- at section I'm using libavcodec from within my C++ application but the linker complains about missing symbols which seem to be available.
-
-FFmpeg is a pure C project, so to use the libraries within your C++ application
-you need to explicitly state that you are using a C library. You can do this by
-encompassing your FFmpeg includes using @code{extern "C"}.
-
-See @url{http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3}
-
- at section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat?
-
-You have to implement a URLProtocol, see libavformat/file.c in FFmpeg
-and libmpdemux/demux_lavf.c in MPlayer sources.
-
- at section I get "No compatible shell script interpreter found." in MSys.
-
-The standard MSys bash (2.04) is broken. You need to install 2.05 or later.
-
- at section I get "./configure: line <xxx>: pr: command not found" in MSys.
-
-The standard MSys install doesn't come with pr. You need to get it from the coreutils package.
-
- at section I tried to pass RTP packets into a decoder, but it doesn't work.
-
-RTP is a container format like any other, you must first depacketize the
-codec frames/samples stored in RTP and then feed to the decoder.
-
- at section Where can I find libav* headers for Pascal/Delphi?
-
-see @url{http://www.iversenit.dk/dev/ffmpeg-headers/}
-
- at section Where is the documentation about ffv1, msmpeg4, asv1, 4xm?
-
-see @url{http://svn.ffmpeg.org/michael/trunk/docs/}
-
- at section How do I feed H.263-RTP (and other codecs in RTP) to libavcodec?
-
-Even if peculiar since it is network oriented, RTP is a container like any
-other. You have to @emph{demux} RTP before feeding the payload to libavcodec.
-In this specific case please look at RFC 4629 to see how it should be done.
-
- at section AVStream.r_frame_rate is wrong, it is much larger than the framerate.
-
-r_frame_rate is NOT the average framerate, it is the smallest framerate
-that can accurately represent all timestamps. So no, it is not
-wrong if it is larger than the average!
-For example, if you have mixed 25 and 30 fps content, then r_frame_rate
-will be 150.
-
- at bye
diff --git a/doc/ffmpeg-doc.texi b/doc/ffmpeg-doc.texi
deleted file mode 100644
index 7be11d2..0000000
--- a/doc/ffmpeg-doc.texi
+++ /dev/null
@@ -1,956 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle FFmpeg Documentation
- at titlepage
- at sp 7
- at center @titlefont{FFmpeg Documentation}
- at sp 3
- at end titlepage
-
-
- at chapter Introduction
-
-FFmpeg is a very fast video and audio converter. It can also grab from
-a live audio/video source.
-
-The command line interface is designed to be intuitive, in the sense
-that FFmpeg tries to figure out all parameters that can possibly be
-derived automatically. You usually only have to specify the target
-bitrate you want.
-
-FFmpeg can also convert from any sample rate to any other, and resize
-video on the fly with a high quality polyphase filter.
-
- at chapter Quick Start
-
- at c man begin EXAMPLES
- at section Video and Audio grabbing
-
-FFmpeg can grab video and audio from devices given that you specify the input
-format and device.
-
- at example
-ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
- at end example
-
-Note that you must activate the right video source and channel before
-launching FFmpeg with any TV viewer such as xawtv
-(@url{http://linux.bytesex.org/xawtv/}) by Gerd Knorr. You also
-have to set the audio recording levels correctly with a
-standard mixer.
-
- at section X11 grabbing
-
-FFmpeg can grab the X11 display.
-
- at example
-ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpg
- at end example
-
-0.0 is display.screen number of your X11 server, same as
-the DISPLAY environment variable.
-
- at example
-ffmpeg -f x11grab -s cif -i :0.0+10,20 /tmp/out.mpg
- at end example
-
-0.0 is display.screen number of your X11 server, same as the DISPLAY environment
-variable. 10 is the x-offset and 20 the y-offset for the grabbing.
-
- at section Video and Audio file format conversion
-
-* FFmpeg can use any supported file format and protocol as input:
-
-Examples:
-
-* You can use YUV files as input:
-
- at example
-ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
- at end example
-
-It will use the files:
- at example
-/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
-/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
- at end example
-
-The Y files use twice the resolution of the U and V files. They are
-raw files, without header. They can be generated by all decent video
-decoders. You must specify the size of the image with the @option{-s} option
-if FFmpeg cannot guess it.
-
-* You can input from a raw YUV420P file:
-
- at example
-ffmpeg -i /tmp/test.yuv /tmp/out.avi
- at end example
-
-test.yuv is a file containing raw YUV planar data. Each frame is composed
-of the Y plane followed by the U and V planes at half vertical and
-horizontal resolution.
-
-* You can output to a raw YUV420P file:
-
- at example
-ffmpeg -i mydivx.avi hugefile.yuv
- at end example
-
-* You can set several input files and output files:
-
- at example
-ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
- at end example
-
-Converts the audio file a.wav and the raw YUV video file a.yuv
-to MPEG file a.mpg.
-
-* You can also do audio and video conversions at the same time:
-
- at example
-ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
- at end example
-
-Converts a.wav to MPEG audio at 22050 Hz sample rate.
-
-* You can encode to several formats at the same time and define a
-mapping from input stream to output streams:
-
- at example
-ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
- at end example
-
-Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map
-file:index' specifies which input stream is used for each output
-stream, in the order of the definition of output streams.
-
-* You can transcode decrypted VOBs:
-
- at example
-ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
- at end example
-
-This is a typical DVD ripping example; the input is a VOB file, the
-output an AVI file with MPEG-4 video and MP3 audio. Note that in this
-command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
-GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
-input video. Furthermore, the audio stream is MP3-encoded so you need
-to enable LAME support by passing @code{--enable-libmp3lame} to configure.
-The mapping is particularly useful for DVD transcoding
-to get the desired audio language.
-
-NOTE: To see the supported input formats, use @code{ffmpeg -formats}.
-
-* You can extract images from a video, or create a video from many images:
-
-For extracting images from a video:
- at example
-ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
- at end example
-
-This will extract one video frame per second from the video and will
-output them in files named @file{foo-001.jpeg}, @file{foo-002.jpeg},
-etc. Images will be rescaled to fit the new WxH values.
-
-If you want to extract just a limited number of frames, you can use the
-above command in combination with the -vframes or -t option, or in
-combination with -ss to start extracting from a certain point in time.
-
-For creating a video from many images:
- at example
-ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
- at end example
-
-The syntax @code{foo-%03d.jpeg} specifies to use a decimal number
-composed of three digits padded with zeroes to express the sequence
-number. It is the same syntax supported by the C printf function, but
-only formats accepting a normal integer are suitable.
-
-* You can put many streams of the same type in the output:
-
- at example
-ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
- at end example
-
-In addition to the first video and audio streams, the resulting
-output file @file{test12.avi} will contain the second video
-and the second audio stream found in the input streams list.
-
-The @code{-newvideo}, @code{-newaudio} and @code{-newsubtitle}
-options have to be specified immediately after the name of the output
-file to which you want to add them.
- at c man end
-
- at chapter Invocation
-
- at section Syntax
-
-The generic syntax is:
-
- at example
- at c man begin SYNOPSIS
-ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
- at c man end
- at end example
- at c man begin DESCRIPTION
-As a general rule, options are applied to the next specified
-file. Therefore, order is important, and you can have the same
-option on the command line multiple times. Each occurrence is
-then applied to the next input or output file.
-
-* To set the video bitrate of the output file to 64kbit/s:
- at example
-ffmpeg -i input.avi -b 64k output.avi
- at end example
-
-* To force the frame rate of the output file to 24 fps:
- at example
-ffmpeg -i input.avi -r 24 output.avi
- at end example
-
-* To force the frame rate of the input file (valid for raw formats only)
-to 1 fps and the frame rate of the output file to 24 fps:
- at example
-ffmpeg -r 1 -i input.m2v -r 24 output.avi
- at end example
-
-The format option may be needed for raw input files.
-
-By default, FFmpeg tries to convert as losslessly as possible: It
-uses the same audio and video parameters for the outputs as the one
-specified for the inputs.
- at c man end
-
- at c man begin OPTIONS
-
- at include fftools-common-opts.texi
-
- at section Main options
-
- at table @option
-
- at item -f @var{fmt}
-Force format.
-
- at item -i @var{filename}
-input file name
-
- at item -y
-Overwrite output files.
-
- at item -t @var{duration}
-Restrict the transcoded/captured video sequence
-to the duration specified in seconds.
- at code{hh:mm:ss[.xxx]} syntax is also supported.
-
- at item -fs @var{limit_size}
-Set the file size limit.
-
- at item -ss @var{position}
-Seek to given time position in seconds.
- at code{hh:mm:ss[.xxx]} syntax is also supported.
-
- at item -itsoffset @var{offset}
-Set the input time offset in seconds.
- at code{[-]hh:mm:ss[.xxx]} syntax is also supported.
-This option affects all the input files that follow it.
-The offset is added to the timestamps of the input files.
-Specifying a positive offset means that the corresponding
-streams are delayed by 'offset' seconds.
-
- at item -timestamp @var{time}
-Set the timestamp.
-
- at item -metadata @var{key}=@var{value}
-Set a metadata key/value pair.
-
-For example, for setting the title in the output file:
- at example
-ffmpeg -i in.avi -metadata title="my title" out.flv
- at end example
-
- at item -v @var{number}
-Set the logging verbosity level.
-
- at item -target @var{type}
-Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
-"ntsc-svcd", ... ). All the format options (bitrate, codecs,
-buffer sizes) are then set automatically. You can just type:
-
- at example
-ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
- at end example
-
-Nevertheless you can specify additional options as long as you know
-they do not conflict with the standard, as in:
-
- at example
-ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
- at end example
-
- at item -dframes @var{number}
-Set the number of data frames to record.
-
- at item -scodec @var{codec}
-Force subtitle codec ('copy' to copy stream).
-
- at item -newsubtitle
-Add a new subtitle stream to the current output stream.
-
- at item -slang @var{code}
-Set the ISO 639 language code (3 letters) of the current subtitle stream.
-
- at end table
-
- at section Video Options
-
- at table @option
- at item -b @var{bitrate}
-Set the video bitrate in bit/s (default = 200 kb/s).
- at item -vframes @var{number}
-Set the number of video frames to record.
- at item -r @var{fps}
-Set frame rate (Hz value, fraction or abbreviation), (default = 25).
- at item -s @var{size}
-Set frame size. The format is @samp{wxh} (ffserver default = 160x128, ffmpeg default = same as source).
-The following abbreviations are recognized:
- at table @samp
- at item sqcif
-128x96
- at item qcif
-176x144
- at item cif
-352x288
- at item 4cif
-704x576
- at item 16cif
-1408x1152
- at item qqvga
-160x120
- at item qvga
-320x240
- at item vga
-640x480
- at item svga
-800x600
- at item xga
-1024x768
- at item uxga
-1600x1200
- at item qxga
-2048x1536
- at item sxga
-1280x1024
- at item qsxga
-2560x2048
- at item hsxga
-5120x4096
- at item wvga
-852x480
- at item wxga
-1366x768
- at item wsxga
-1600x1024
- at item wuxga
-1920x1200
- at item woxga
-2560x1600
- at item wqsxga
-3200x2048
- at item wquxga
-3840x2400
- at item whsxga
-6400x4096
- at item whuxga
-7680x4800
- at item cga
-320x200
- at item ega
-640x350
- at item hd480
-852x480
- at item hd720
-1280x720
- at item hd1080
-1920x1080
- at end table
-
- at item -aspect @var{aspect}
-Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
- at item -croptop @var{size}
-Set top crop band size (in pixels).
- at item -cropbottom @var{size}
-Set bottom crop band size (in pixels).
- at item -cropleft @var{size}
-Set left crop band size (in pixels).
- at item -cropright @var{size}
-Set right crop band size (in pixels).
- at item -padtop @var{size}
-Set top pad band size (in pixels).
- at item -padbottom @var{size}
-Set bottom pad band size (in pixels).
- at item -padleft @var{size}
-Set left pad band size (in pixels).
- at item -padright @var{size}
-Set right pad band size (in pixels).
- at item -padcolor @var{hex_color}
-Set color of padded bands. The value for padcolor is expressed
-as a six digit hexadecimal number where the first two digits
-represent red, the middle two digits green and last two digits
-blue (default = 000000 (black)).
- at item -vn
-Disable video recording.
- at item -bt @var{tolerance}
-Set video bitrate tolerance (in bits, default 4000k).
-Has a minimum value of: (target_bitrate/target_framerate).
-In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
-willing to deviate from the target average bitrate value. This is
-not related to min/max bitrate. Lowering tolerance too much has
-an adverse effect on quality.
- at item -maxrate @var{bitrate}
-Set max video bitrate (in bit/s).
-Requires -bufsize to be set.
- at item -minrate @var{bitrate}
-Set min video bitrate (in bit/s).
-Most useful in setting up a CBR encode:
- at example
-ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
- at end example
-It is of little use elsewise.
- at item -bufsize @var{size}
-Set video buffer verifier buffer size (in bits).
- at item -vcodec @var{codec}
-Force video codec to @var{codec}. Use the @code{copy} special value to
-tell that the raw codec data must be copied as is.
- at item -sameq
-Use same video quality as source (implies VBR).
-
- at item -pass @var{n}
-Select the pass number (1 or 2). It is used to do two-pass
-video encoding. The statistics of the video are recorded in the first
-pass into a log file (see also the option -passlogfile),
-and in the second pass that log file is used to generate the video
-at the exact requested bitrate.
-On pass 1, you may just deactivate audio and set output to null,
-examples for Windows and Unix:
- at example
-ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
-ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
- at end example
-
- at item -passlogfile @var{prefix}
-Set two-pass log file name prefix to @var{prefix}, the default file name
-prefix is ``ffmpeg2pass''. The complete file name will be
- at file{PREFIX-N.log}, where N is a number specific to the output
-stream.
-
- at item -newvideo
-Add a new video stream to the current output stream.
-
- at item -vlang @var{code}
-Set the ISO 639 language code (3 letters) of the current video stream.
-
- at end table
-
- at section Advanced Video Options
-
- at table @option
- at item -pix_fmt @var{format}
-Set pixel format. Use 'list' as parameter to show all the supported
-pixel formats.
- at item -sws_flags @var{flags}
-Set SwScaler flags.
- at item -g @var{gop_size}
-Set the group of pictures size.
- at item -intra
-Use only intra frames.
- at item -vdt @var{n}
-Discard threshold.
- at item -qscale @var{q}
-Use fixed video quantizer scale (VBR).
- at item -qmin @var{q}
-minimum video quantizer scale (VBR)
- at item -qmax @var{q}
-maximum video quantizer scale (VBR)
- at item -qdiff @var{q}
-maximum difference between the quantizer scales (VBR)
- at item -qblur @var{blur}
-video quantizer scale blur (VBR) (range 0.0 - 1.0)
- at item -qcomp @var{compression}
-video quantizer scale compression (VBR) (default 0.5).
-Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
-
- at item -lmin @var{lambda}
-minimum video lagrange factor (VBR)
- at item -lmax @var{lambda}
-max video lagrange factor (VBR)
- at item -mblmin @var{lambda}
-minimum macroblock quantizer scale (VBR)
- at item -mblmax @var{lambda}
-maximum macroblock quantizer scale (VBR)
-
-These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
-but you may use the QP2LAMBDA constant to easily convert from 'q' units:
- at example
-ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
- at end example
-
- at item -rc_init_cplx @var{complexity}
-initial complexity for single pass encoding
- at item -b_qfactor @var{factor}
-qp factor between P- and B-frames
- at item -i_qfactor @var{factor}
-qp factor between P- and I-frames
- at item -b_qoffset @var{offset}
-qp offset between P- and B-frames
- at item -i_qoffset @var{offset}
-qp offset between P- and I-frames
- at item -rc_eq @var{equation}
-Set rate control equation (@pxref{FFmpeg formula
-evaluator}) (default = @code{tex^qComp}).
- at item -rc_override @var{override}
-rate control override for specific intervals
- at item -me_method @var{method}
-Set motion estimation method to @var{method}.
-Available methods are (from lowest to best quality):
- at table @samp
- at item zero
-Try just the (0, 0) vector.
- at item phods
- at item log
- at item x1
- at item hex
- at item umh
- at item epzs
-(default method)
- at item full
-exhaustive search (slow and marginally better than epzs)
- at end table
-
- at item -dct_algo @var{algo}
-Set DCT algorithm to @var{algo}. Available values are:
- at table @samp
- at item 0
-FF_DCT_AUTO (default)
- at item 1
-FF_DCT_FASTINT
- at item 2
-FF_DCT_INT
- at item 3
-FF_DCT_MMX
- at item 4
-FF_DCT_MLIB
- at item 5
-FF_DCT_ALTIVEC
- at end table
-
- at item -idct_algo @var{algo}
-Set IDCT algorithm to @var{algo}. Available values are:
- at table @samp
- at item 0
-FF_IDCT_AUTO (default)
- at item 1
-FF_IDCT_INT
- at item 2
-FF_IDCT_SIMPLE
- at item 3
-FF_IDCT_SIMPLEMMX
- at item 4
-FF_IDCT_LIBMPEG2MMX
- at item 5
-FF_IDCT_PS2
- at item 6
-FF_IDCT_MLIB
- at item 7
-FF_IDCT_ARM
- at item 8
-FF_IDCT_ALTIVEC
- at item 9
-FF_IDCT_SH4
- at item 10
-FF_IDCT_SIMPLEARM
- at end table
-
- at item -er @var{n}
-Set error resilience to @var{n}.
- at table @samp
- at item 1
-FF_ER_CAREFUL (default)
- at item 2
-FF_ER_COMPLIANT
- at item 3
-FF_ER_AGGRESSIVE
- at item 4
-FF_ER_VERY_AGGRESSIVE
- at end table
-
- at item -ec @var{bit_mask}
-Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
-the following values:
- at table @samp
- at item 1
-FF_EC_GUESS_MVS (default = enabled)
- at item 2
-FF_EC_DEBLOCK (default = enabled)
- at end table
-
- at item -bf @var{frames}
-Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
- at item -mbd @var{mode}
-macroblock decision
- at table @samp
- at item 0
-FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in FFmpeg).
- at item 1
-FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
- at item 2
-FF_MB_DECISION_RD: rate distortion
- at end table
-
- at item -4mv
-Use four motion vector by macroblock (MPEG-4 only).
- at item -part
-Use data partitioning (MPEG-4 only).
- at item -bug @var{param}
-Work around encoder bugs that are not auto-detected.
- at item -strict @var{strictness}
-How strictly to follow the standards.
- at item -aic
-Enable Advanced intra coding (h263+).
- at item -umv
-Enable Unlimited Motion Vector (h263+)
-
- at item -deinterlace
-Deinterlace pictures.
- at item -ilme
-Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
-Use this option if your input file is interlaced and you want
-to keep the interlaced format for minimum losses.
-The alternative is to deinterlace the input stream with
- at option{-deinterlace}, but deinterlacing introduces losses.
- at item -psnr
-Calculate PSNR of compressed frames.
- at item -vstats
-Dump video coding statistics to @file{vstats_HHMMSS.log}.
- at item -vstats_file @var{file}
-Dump video coding statistics to @var{file}.
- at item -top @var{n}
-top=1/bottom=0/auto=-1 field first
- at item -dc @var{precision}
-Intra_dc_precision.
- at item -vtag @var{fourcc/tag}
-Force video tag/fourcc.
- at item -qphist
-Show QP histogram.
- at item -vbsf @var{bitstream_filter}
-Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump".
- at example
-ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
- at end example
- at end table
-
- at section Audio Options
-
- at table @option
- at item -aframes @var{number}
-Set the number of audio frames to record.
- at item -ar @var{freq}
-Set the audio sampling frequency (default = 44100 Hz).
- at item -ab @var{bitrate}
-Set the audio bitrate in bit/s (default = 64k).
- at item -aq @var{q}
-Set the audio quality (codec-specific, VBR).
- at item -ac @var{channels}
-Set the number of audio channels (default = 1).
- at item -an
-Disable audio recording.
- at item -acodec @var{codec}
-Force audio codec to @var{codec}. Use the @code{copy} special value to
-specify that the raw codec data must be copied as is.
- at item -newaudio
-Add a new audio track to the output file. If you want to specify parameters,
-do so before @code{-newaudio} (@code{-acodec}, @code{-ab}, etc..).
-
-Mapping will be done automatically, if the number of output streams is equal to
-the number of input streams, else it will pick the first one that matches. You
-can override the mapping using @code{-map} as usual.
-
-Example:
- at example
-ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
- at end example
- at item -alang @var{code}
-Set the ISO 639 language code (3 letters) of the current audio stream.
- at end table
-
- at section Advanced Audio options:
-
- at table @option
- at item -atag @var{fourcc/tag}
-Force audio tag/fourcc.
- at item -absf @var{bitstream_filter}
-Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
- at end table
-
- at section Subtitle options:
-
- at table @option
- at item -scodec @var{codec}
-Force subtitle codec ('copy' to copy stream).
- at item -newsubtitle
-Add a new subtitle stream to the current output stream.
- at item -slang @var{code}
-Set the ISO 639 language code (3 letters) of the current subtitle stream.
- at item -sn
-Disable subtitle recording.
- at item -sbsf @var{bitstream_filter}
-Bitstream filters available are "mov2textsub", "text2movsub".
- at example
-ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
- at end example
- at end table
-
- at section Audio/Video grab options
-
- at table @option
- at item -vc @var{channel}
-Set video grab channel (DV1394 only).
- at item -tvstd @var{standard}
-Set television standard (NTSC, PAL (SECAM)).
- at item -isync
-Synchronize read on input.
- at end table
-
- at section Advanced options
-
- at table @option
- at item -map @var{input_stream_id}[:@var{sync_stream_id}]
-Set stream mapping from input streams to output streams.
-Just enumerate the input streams in the order you want them in the output.
- at var{sync_stream_id} if specified sets the input stream to sync
-against.
- at item -map_meta_data @var{outfile}:@var{infile}
-Set meta data information of @var{outfile} from @var{infile}.
- at item -debug
-Print specific debug info.
- at item -benchmark
-Show benchmarking information at the end of an encode.
-Shows CPU time used and maximum memory consumption.
-Maximum memory consumption is not supported on all systems,
-it will usually display as 0 if not supported.
- at item -dump
-Dump each input packet.
- at item -hex
-When dumping packets, also dump the payload.
- at item -bitexact
-Only use bit exact algorithms (for codec testing).
- at item -ps @var{size}
-Set RTP payload size in bytes.
- at item -re
-Read input at native frame rate. Mainly used to simulate a grab device.
- at item -loop_input
-Loop over the input stream. Currently it works only for image
-streams. This option is used for automatic FFserver testing.
- at item -loop_output @var{number_of_times}
-Repeatedly loop output for formats that support looping such as animated GIF
-(0 will loop the output infinitely).
- at item -threads @var{count}
-Thread count.
- at item -vsync @var{parameter}
-Video sync method.
-0   Each frame is passed with its timestamp from the demuxer to the muxer
-1   Frames will be duplicated and dropped to achieve exactly the requested
-    constant framerate.
-2   Frames are passed through with their timestamp or dropped so as to prevent
-    2 frames from having the same timestamp
--1  Chooses between 1 and 2 depending on muxer capabilities. This is the default method.
-
-With -map you can select from
-which stream the timestamps should be taken. You can leave either video or
-audio unchanged and sync the remaining stream(s) to the unchanged one.
- at item -async @var{samples_per_second}
-Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
-the parameter is the maximum samples per second by which the audio is changed.
--async 1 is a special case where only the start of the audio stream is corrected
-without any later correction.
- at item -copyts
-Copy timestamps from input to output.
- at item -shortest
-Finish encoding when the shortest input stream ends.
- at item -dts_delta_threshold
-Timestamp discontinuity delta threshold.
- at item -muxdelay @var{seconds}
-Set the maximum demux-decode delay.
- at item -muxpreload @var{seconds}
-Set the initial demux-decode delay.
- at end table
-
- at section Preset files
-
-A preset file contains a sequence of @var{option}=@var{value} pairs,
-one for each line, specifying a sequence of options which would be
-awkward to specify on the command line. Lines starting with the hash
-('#') character are ignored and are used to provide comments. Check
-the @file{ffpresets} directory in the FFmpeg source tree for examples.
-
-Preset files are specified with the @code{vpre}, @code{apre},
- at code{spre}, and @code{fpre} options. The @code{fpre} option takes the
-filename of the preset instead of a preset name as input and can be
-used for any kind of codec. For the @code{vpre}, @code{apre}, and
- at code{spre} options, the options specified in a preset file are
-applied to the currently selected codec of the same type as the preset
-option.
-
-The argument passed to the @code{vpre}, @code{apre}, and @code{spre}
-preset options identifies the preset file to use according to the
-following rules:
-
-First ffmpeg searches for a file named @var{arg}.ffpreset in the
-directories @file{$FFMPEG_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in
-the datadir defined at configuration time (usually @file{PREFIX/share/ffmpeg})
-in that order. For example, if the argument is @code{libx264-max}, it will
-search for the file @file{libx264-max.ffpreset}.
-
-If no such file is found, then ffmpeg will search for a file named
- at var{codec_name}- at var{arg}.ffpreset in the above-mentioned
-directories, where @var{codec_name} is the name of the codec to which
-the preset file options will be applied. For example, if you select
-the video codec with @code{-vcodec libx264} and use @code{-vpre max},
-then it will search for the file @file{libx264-max.ffpreset}.
-
- at anchor{FFmpeg formula evaluator}
- at section FFmpeg formula evaluator
-
-When evaluating a rate control string, FFmpeg uses an internal formula
-evaluator.
-
-The following binary operators are available: @code{+}, @code{-},
- at code{*}, @code{/}, @code{^}.
-
-The following unary operators are available: @code{+}, @code{-},
- at code{(...)}.
-
-The following statements are available: @code{ld}, @code{st},
- at code{while}.
-
-The following functions are available:
- at table @var
- at item sinh(x)
- at item cosh(x)
- at item tanh(x)
- at item sin(x)
- at item cos(x)
- at item tan(x)
- at item atan(x)
- at item asin(x)
- at item acos(x)
- at item exp(x)
- at item log(x)
- at item abs(x)
- at item squish(x)
- at item gauss(x)
- at item mod(x, y)
- at item max(x, y)
- at item min(x, y)
- at item eq(x, y)
- at item gte(x, y)
- at item gt(x, y)
- at item lte(x, y)
- at item lt(x, y)
- at item bits2qp(bits)
- at item qp2bits(qp)
- at end table
-
-The following constants are available:
- at table @var
- at item PI
- at item E
- at item iTex
- at item pTex
- at item tex
- at item mv
- at item fCode
- at item iCount
- at item mcVar
- at item var
- at item isI
- at item isP
- at item isB
- at item avgQP
- at item qComp
- at item avgIITex
- at item avgPITex
- at item avgPPTex
- at item avgBPTex
- at item avgTex
- at end table
-
- at c man end
-
- at ignore
-
- at setfilename ffmpeg
- at settitle FFmpeg video converter
-
- at c man begin SEEALSO
-ffserver(1), ffplay(1) and the HTML documentation of @file{ffmpeg}.
- at c man end
-
- at c man begin AUTHOR
-Fabrice Bellard
- at c man end
-
- at end ignore
-
- at section Protocols
-
-The file name can be @file{-} to read from standard input or to write
-to standard output.
-
-FFmpeg also handles many protocols specified with an URL syntax.
-
-Use 'ffmpeg -protocols' to see a list of the supported protocols.
-
-The protocol @code{http:} is currently used only to communicate with
-FFserver (see the FFserver documentation). When FFmpeg will be a
-video player it will also be used for streaming :-)
-
- at chapter Tips
-
- at itemize
- at item For streaming at very low bitrate application, use a low frame rate
-and a small GOP size. This is especially true for RealVideo where
-the Linux player does not seem to be very fast, so it can miss
-frames. An example is:
-
- at example
-ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
- at end example
-
- at item  The parameter 'q' which is displayed while encoding is the current
-quantizer. The value 1 indicates that a very good quality could
-be achieved. The value 31 indicates the worst quality. If q=31 appears
-too often, it means that the encoder cannot compress enough to meet
-your bitrate. You must either increase the bitrate, decrease the
-frame rate or decrease the frame size.
-
- at item If your computer is not fast enough, you can speed up the
-compression at the expense of the compression ratio. You can use
-'-me zero' to speed up motion estimation, and '-intra' to disable
-motion estimation completely (you have only I-frames, which means it
-is about as good as JPEG compression).
-
- at item To have very low audio bitrates, reduce the sampling frequency
-(down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
-
- at item To have a constant quality (but a variable bitrate), use the option
-'-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst
-quality).
-
- at item When converting video files, you can use the '-sameq' option which
-uses the same quality factor in the encoder as in the decoder.
-It allows almost lossless encoding.
-
- at end itemize
-
- at bye
diff --git a/doc/ffmpeg_powerpc_performance_evaluation_howto.txt b/doc/ffmpeg_powerpc_performance_evaluation_howto.txt
deleted file mode 100644
index 2eb4ee7..0000000
--- a/doc/ffmpeg_powerpc_performance_evaluation_howto.txt
+++ /dev/null
@@ -1,172 +0,0 @@
-FFmpeg & evaluating performance on the PowerPC Architecture HOWTO
-
-(c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
-
-
-
-I - Introduction
-
-The PowerPC architecture and its SIMD extension AltiVec offer some
-interesting tools to evaluate performance and improve the code.
-This document tries to explain how to use those tools with FFmpeg.
-
-The architecture itself offers two ways to evaluate the performance of
-a given piece of code:
-
-1) The Time Base Registers (TBL)
-2) The Performance Monitor Counter Registers (PMC)
-
-The first ones are always available, always active, but they're not very
-accurate: the registers increment by one every four *bus* cycles. On
-my 667 Mhz tiBook (ppc7450), this means once every twenty *processor*
-cycles. So we won't use that.
-
-The PMC are much more useful: not only can they report cycle-accurate
-timing, but they can also be used to monitor many other parameters,
-such as the number of AltiVec stalls for every kind of instruction,
-or instruction cache misses. The downside is that not all processors
-support the PMC (all G3, all G4 and the 970 do support them), and
-they're inactive by default - you need to activate them with a
-dedicated tool. Also, the number of available PMC depends on the
-procesor: the various 604 have 2, the various 75x (aka. G3) have 4,
-and the various 74xx (aka G4) have 6.
-
-*WARNING*: The PowerPC 970 is not very well documented, and its PMC
-registers are 64 bits wide. To properly notify the code, you *must*
-tune for the 970 (using --tune=970), or the code will assume 32 bit
-registers.
-
-
-II - Enabling FFmpeg PowerPC performance support
-
-This needs to be done by hand. First, you need to configure FFmpeg as
-usual, but add the "--powerpc-perf-enable" option. For instance:
-
-#####
-./configure --prefix=/usr/local/ffmpeg-svn --cc=gcc-3.3 --tune=7450 --powerpc-perf-enable
-#####
-
-This will configure FFmpeg to install inside /usr/local/ffmpeg-svn,
-compiling with gcc-3.3 (you should try to use this one or a newer
-gcc), and tuning for the PowerPC 7450 (i.e. the newer G4; as a rule of
-thumb, those at 550Mhz and more). It will also enable the PMC.
-
-You may also edit the file "config.h" to enable the following line:
-
-#####
-// #define ALTIVEC_USE_REFERENCE_C_CODE 1
-#####
-
-If you enable this line, then the code will not make use of AltiVec,
-but will use the reference C code instead. This is useful to compare
-performance between two versions of the code.
-
-Also, the number of enabled PMC is defined in "libavcodec/ppc/dsputil_ppc.h":
-
-#####
-#define POWERPC_NUM_PMC_ENABLED 4
-#####
-
-If you have a G4 CPU, you can enable all 6 PMC. DO NOT enable more
-PMC than available on your CPU!
-
-Then, simply compile FFmpeg as usual (make && make install).
-
-
-
-III - Using FFmpeg PowerPC performance support
-
-This FFmeg can be used exactly as usual. But before exiting, FFmpeg
-will dump a per-function report that looks like this:
-
-#####
-PowerPC performance report
- Values are from the PMC registers, and represent whatever the
- registers are set to record.
- Function "gmc1_altivec" (pmc1):
-        min: 231
-        max: 1339867
-        avg: 558.25 (255302)
- Function "gmc1_altivec" (pmc2):
-        min: 93
-        max: 2164
-        avg: 267.31 (255302)
- Function "gmc1_altivec" (pmc3):
-        min: 72
-        max: 1987
-        avg: 276.20 (255302)
-(...)
-#####
-
-In this example, PMC1 was set to record CPU cycles, PMC2 was set to
-record AltiVec Permute Stall Cycles, and PMC3 was set to record AltiVec
-Issue Stalls.
-
-The function "gmc1_altivec" was monitored 255302 times, and the
-minimum execution time was 231 processor cycles. The max and average
-aren't much use, as it's very likely the OS interrupted execution for
-reasons of its own :-(
-
-With the exact same settings and source file, but using the reference C
-code we get:
-
-#####
-PowerPC performance report
- Values are from the PMC registers, and represent whatever the
- registers are set to record.
- Function "gmc1_altivec" (pmc1):
-        min: 592
-        max: 2532235
-        avg: 962.88 (255302)
- Function "gmc1_altivec" (pmc2):
-        min: 0
-        max: 33
-        avg: 0.00 (255302)
- Function "gmc1_altivec" (pmc3):
-        min: 0
-        max: 350
-        avg: 0.03 (255302)
-(...)
-#####
-
-592 cycles, so the fastest AltiVec execution is about 2.5x faster than
-the fastest C execution in this example. It's not perfect but it's not
-bad (well I wrote this function so I can't say otherwise :-).
-
-Once you have that kind of report, you can try to improve things by
-finding what goes wrong and fixing it; in the example above, one
-should try to diminish the number of AltiVec stalls, as this *may*
-improve performance.
-
-
-
-IV) Enabling the PMC in Mac OS X
-
-This is easy. Use "Monster" and "monster". Those tools come from
-Apple's CHUD package, and can be found hidden in the developer web
-site & FTP site. "MONster" is the graphical application, use it to
-generate a config file specifying what each register should
-monitor. Then use the command-line application "monster" to use that
-config file, and enjoy the results.
-
-Note that "MONster" can be used for many other things, but it's
-documented by Apple, it's not my subject.
-
-If you are using CHUD 4.4.2 or later, you'll notice that MONster is
-no longer available. It's been superseeded by Shark, where
-configuration of PMCs is available as a plugin.
-
-
-
-V) Enabling the PMC on Linux
-
-On linux you may use oprofile from http://oprofile.sf.net, depending on the
-version and the cpu you may need to apply a patch[1] to access a set of the
-possibile counters from the userspace application. You can always define them
-using the kernel interface /dev/oprofile/* .
-
-[1] http://dev.gentoo.org/~lu_zero/development/oprofile-g4-20060423.patch
-
---
-Romain Dolbeau <romain at dolbeau.org>
-Luca Barbato <lu_zero at gentoo.org>
diff --git a/doc/ffplay-doc.texi b/doc/ffplay-doc.texi
deleted file mode 100644
index e0ca79d..0000000
--- a/doc/ffplay-doc.texi
+++ /dev/null
@@ -1,160 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle FFplay Documentation
- at titlepage
- at sp 7
- at center @titlefont{FFplay Documentation}
- at sp 3
- at end titlepage
-
-
- at chapter Introduction
-
- at c man begin DESCRIPTION
-FFplay is a very simple and portable media player using the FFmpeg
-libraries and the SDL library. It is mostly used as a testbed for the
-various FFmpeg APIs.
- at c man end
-
- at chapter Invocation
-
- at section Syntax
- at example
- at c man begin SYNOPSIS
-ffplay [options] @file{input_file}
- at c man end
- at end example
-
- at c man begin OPTIONS
-
- at include fftools-common-opts.texi
-
- at section Main options
-
- at table @option
- at item -x @var{width}
-Force displayed width.
- at item -y @var{height}
-Force displayed height.
- at item -s @var{size}
-Set frame size (WxH or abbreviation), needed for videos which don't
-contain a header with the frame size like raw YUV.
- at item -an
-Disable audio.
- at item -vn
-Disable video.
- at item -ss @var{pos}
-Seek to a given position in seconds.
- at item -t @var{duration}
-play <duration> seconds of audio/video
- at item -bytes
-Seek by bytes.
- at item -nodisp
-Disable graphical display.
- at item -f @var{fmt}
-Force format.
- at item -window_title @var{title}
-Set window title (default is the input filename).
- at item -loop @var{number}
-Loops movie playback <number> times. 0 means forever.
- at end table
-
- at section Advanced options
- at table @option
- at item -pix_fmt @var{format}
-Set pixel format.
- at item -stats
-Show the stream duration, the codec parameters, the current position in
-the stream and the audio/video synchronisation drift.
- at item -debug
-Print specific debug info.
- at item -bug
-Work around bugs.
- at item -vismv
-Visualize motion vectors.
- at item -fast
-Non-spec-compliant optimizations.
- at item -genpts
-Generate pts.
- at item -rtp_tcp
-Force RTP/TCP protocol usage instead of RTP/UDP. It is only meaningful
-if you are streaming with the RTSP protocol.
- at item -sync @var{type}
-Set the master clock to audio (@code{type=audio}), video
-(@code{type=video}) or external (@code{type=ext}). Default is audio. The
-master clock is used to control audio-video synchronization. Most media
-players use audio as master clock, but in some cases (streaming or high
-quality broadcast) it is necessary to change that. This option is mainly
-used for debugging purposes.
- at item -threads @var{count}
-Set the thread count.
- at item -ast @var{audio_stream_number}
-Select the desired audio stream number, counting from 0. The number
-refers to the list of all the input audio streams. If it is greater
-than the number of audio streams minus one, then the last one is
-selected, if it is negative the audio playback is disabled.
- at item -vst @var{video_stream_number}
-Select the desired video stream number, counting from 0. The number
-refers to the list of all the input video streams. If it is greater
-than the number of video streams minus one, then the last one is
-selected, if it is negative the video playback is disabled.
- at item -sst @var{subtitle_stream_number}
-Select the desired subtitle stream number, counting from 0. The number
-refers to the list of all the input subtitle streams. If it is greater
-than the number of subtitle streams minus one, then the last one is
-selected, if it is negative the subtitle rendering is disabled.
- at end table
-
- at section While playing
-
- at table @key
- at item q, ESC
-Quit.
-
- at item f
-Toggle full screen.
-
- at item p, SPC
-Pause.
-
- at item a
-Cycle audio channel.
-
- at item v
-Cycle video channel.
-
- at item t
-Cycle subtitle channel.
-
- at item w
-Show audio waves.
-
- at item left/right
-Seek backward/forward 10 seconds.
-
- at item down/up
-Seek backward/forward 1 minute.
-
- at item mouse click
-Seek to percentage in file corresponding to fraction of width.
-
- at end table
-
- at c man end
-
- at ignore
-
- at setfilename ffplay
- at settitle FFplay media player
-
- at c man begin SEEALSO
-ffmpeg(1), ffserver(1) and the HTML documentation of @file{ffmpeg}.
- at c man end
-
- at c man begin AUTHOR
-Fabrice Bellard
- at c man end
-
- at end ignore
-
- at bye
diff --git a/doc/ffprobe-doc.texi b/doc/ffprobe-doc.texi
deleted file mode 100644
index 8eb3ed9..0000000
--- a/doc/ffprobe-doc.texi
+++ /dev/null
@@ -1,121 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle FFprobe Documentation
- at titlepage
- at sp 7
- at center @titlefont{FFprobe Documentation}
- at sp 3
- at end titlepage
-
- at chapter Introduction
-
- at c man begin DESCRIPTION
-
-FFprobe gathers information from multimedia streams and prints it in
-human- and machine-readable fashion.
-
-For example it can be used to check the format of the container used
-by a multimedia stream and the format and type of each media stream
-contained in it.
-
-If a filename is specified in input, ffprobe will try to open and
-probe the file content. If the file cannot be opened or recognized as
-a multimedia file, a positive exit code is returned.
-
-FFprobe may be employed both as a standalone application or in
-combination with a textual filter, which may perform more
-sophisticated processing, e.g. statistical processing or plotting.
-
-Options are used to list some of the formats supported by ffprobe or
-for specifying which information to display, and for setting how
-ffprobe will show it.
-
-FFprobe output is designed to be easily parsable by a textual filter,
-and consists of one or more sections of the form:
- at example
-[SECTION]
-key1=val1
-...
-keyN=valN
-[/SECTION]
- at end example
-
-Metadata tags stored in the container or in the streams are recognized
-and printed in the corresponding ``FORMAT'' or ``STREAM'' section, and
-are prefixed by the string ``TAG:''.
-
- at c man end
-
- at chapter Invocation
-
- at section Syntax
-
-The generic syntax is:
-
- at example
- at c man begin SYNOPSIS
-ffprobe [options] [@file{input_file}]
- at c man end
- at end example
-
- at c man begin OPTIONS
-
- at include fftools-common-opts.texi
-
- at section Main options
-
- at table @option
-
- at item -convert_tags
-Convert the tag names in the format container to the generic FFmpeg tag names.
-
- at item -f @var{format}
-Force format to use.
-
- at item -unit
-Show the unit of the displayed values.
-
- at item -prefix
-Show a SI prefixes of the displayed values.
-Unless ``-byte_binary_prefix'' option is used all the prefix
-are decimal.
-
- at item -byte_binary_prefix
-Force the use of binary prefixes for byte values.
-
- at item -sexagesimal
-Use sexagesimal format HH:MM:SS.MICROSECONDS for time values.
-
- at item -pretty
-Prettify the format of the displayed values, it corresponds to the
-options ``-unit -prefix -byte_binary_prefix -sexagesimal''.
-
- at item -show_format
-Show information about the container format of the input multimedia
-stream.
-
-All the container format information is printed within a section with
-name ``FORMAT''.
-
- at item -show_streams
-Show information about each media stream contained in the input
-multimedia stream.
-
-Each media stream information is printed within a dedicated section
-with name ``STREAM''.
-
- at end table
- at c man end
-
- at ignore
-
- at setfilename ffprobe
- at settitle FFprobe media prober
-
- at c man begin SEEALSO
-ffmpeg(1), ffplay(1), ffserver(1)
- at c man end
-
- at end ignore
-
- at bye
diff --git a/doc/ffserver-doc.texi b/doc/ffserver-doc.texi
deleted file mode 100644
index 0a2440a..0000000
--- a/doc/ffserver-doc.texi
+++ /dev/null
@@ -1,274 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle FFserver Documentation
- at titlepage
- at sp 7
- at center @titlefont{FFserver Documentation}
- at sp 3
- at end titlepage
-
-
- at chapter Introduction
-
- at c man begin DESCRIPTION
-FFserver is a streaming server for both audio and video. It supports
-several live feeds, streaming from files and time shifting on live feeds
-(you can seek to positions in the past on each live feed, provided you
-specify a big enough feed storage in ffserver.conf).
-
-FFserver runs in daemon mode by default; that is, it puts itself in
-the background and detaches from its TTY, unless it is launched in
-debug mode or a NoDaemon option is specified in the configuration
-file.
-
-This documentation covers only the streaming aspects of ffserver /
-ffmpeg. All questions about parameters for ffmpeg, codec questions,
-etc. are not covered here. Read @file{ffmpeg-doc.html} for more
-information.
-
- at section How does it work?
-
-FFserver receives prerecorded files or FFM streams from some ffmpeg
-instance as input, then streams them over RTP/RTSP/HTTP.
-
-An ffserver instance will listen on some port as specified in the
-configuration file. You can launch one or more instances of ffmpeg and
-send one or more FFM streams to the port where ffserver is expecting
-to receive them. Alternately, you can make ffserver launch such ffmpeg
-instances at startup.
-
-Input streams are called feeds, and each one is specified by a <Feed>
-section in the configuration file.
-
-For each feed you can have different output streams in various
-formats, each one specified by a <Stream> section in the configuration
-file.
-
- at section Status stream
-
-FFserver supports an HTTP interface which exposes the current status
-of the server.
-
-Simply point your browser to the address of the special status stream
-specified in the configuration file.
-
-For example if you have:
- at example
-<Stream status.html>
-Format status
-
-# Only allow local people to get the status
-ACL allow localhost
-ACL allow 192.168.0.0 192.168.255.255
-</Stream>
- at end example
-
-then the server will post a page with the status information when
-the special stream @file{status.html} is requested.
-
- at section What can this do?
-
-When properly configured and running, you can capture video and audio in real
-time from a suitable capture card, and stream it out over the Internet to
-either Windows Media Player or RealAudio player (with some restrictions).
-
-It can also stream from files, though that is currently broken. Very often, a
-web server can be used to serve up the files just as well.
-
-It can stream prerecorded video from .ffm files, though it is somewhat tricky
-to make it work correctly.
-
- at section What do I need?
-
-I use Linux on a 900 MHz Duron with a cheapo Bt848 based TV capture card. I'm
-using stock Linux 2.4.17 with the stock drivers. [Actually that isn't true,
-I needed some special drivers for my motherboard-based sound card.]
-
-I understand that FreeBSD systems work just fine as well.
-
- at section How do I make it work?
-
-First, build the kit. It *really* helps to have installed LAME first. Then when
-you run the ffserver ./configure, make sure that you have the
- at code{--enable-libmp3lame} flag turned on.
-
-LAME is important as it allows for streaming audio to Windows Media Player.
-Don't ask why the other audio types do not work.
-
-As a simple test, just run the following two command lines where INPUTFILE
-is some file which you can decode with ffmpeg:
-
- at example
-./ffserver -f doc/ffserver.conf &
-./ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm
- at end example
-
-At this point you should be able to go to your Windows machine and fire up
-Windows Media Player (WMP). Go to Open URL and enter
-
- at example
-    http://<linuxbox>:8090/test.asf
- at end example
-
-You should (after a short delay) see video and hear audio.
-
-WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to
-transfer the entire file before starting to play.
-The same is true of AVI files.
-
- at section What happens next?
-
-You should edit the ffserver.conf file to suit your needs (in terms of
-frame rates etc). Then install ffserver and ffmpeg, write a script to start
-them up, and off you go.
-
- at section Troubleshooting
-
- at subsection I don't hear any audio, but video is fine.
-
-Maybe you didn't install LAME, or got your ./configure statement wrong. Check
-the ffmpeg output to see if a line referring to MP3 is present. If not, then
-your configuration was incorrect. If it is, then maybe your wiring is not
-set up correctly. Maybe the sound card is not getting data from the right
-input source. Maybe you have a really awful audio interface (like I do)
-that only captures in stereo and also requires that one channel be flipped.
-If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before
-starting ffmpeg.
-
- at subsection The audio and video loose sync after a while.
-
-Yes, they do.
-
- at subsection After a long while, the video update rate goes way down in WMP.
-
-Yes, it does. Who knows why?
-
- at subsection WMP 6.4 behaves differently to WMP 7.
-
-Yes, it does. Any thoughts on this would be gratefully received. These
-differences extend to embedding WMP into a web page. [There are two
-object IDs that you can use: The old one, which does not play well, and
-the new one, which does (both tested on the same system). However,
-I suspect that the new one is not available unless you have installed WMP 7].
-
- at section What else can it do?
-
-You can replay video from .ffm files that was recorded earlier.
-However, there are a number of caveats, including the fact that the
-ffserver parameters must match the original parameters used to record the
-file. If they do not, then ffserver deletes the file before recording into it.
-(Now that I write this, it seems broken).
-
-You can fiddle with many of the codec choices and encoding parameters, and
-there are a bunch more parameters that you cannot control. Post a message
-to the mailing list if there are some 'must have' parameters. Look in
-ffserver.conf for a list of the currently available controls.
-
-It will automatically generate the ASX or RAM files that are often used
-in browsers. These files are actually redirections to the underlying ASF
-or RM file. The reason for this is that the browser often fetches the
-entire file before starting up the external viewer. The redirection files
-are very small and can be transferred quickly. [The stream itself is
-often 'infinite' and thus the browser tries to download it and never
-finishes.]
-
- at section Tips
-
-* When you connect to a live stream, most players (WMP, RA, etc) want to
-buffer a certain number of seconds of material so that they can display the
-signal continuously. However, ffserver (by default) starts sending data
-in realtime. This means that there is a pause of a few seconds while the
-buffering is being done by the player. The good news is that this can be
-cured by adding a '?buffer=5' to the end of the URL. This means that the
-stream should start 5 seconds in the past -- and so the first 5 seconds
-of the stream are sent as fast as the network will allow. It will then
-slow down to real time. This noticeably improves the startup experience.
-
-You can also add a 'Preroll 15' statement into the ffserver.conf that will
-add the 15 second prebuffering on all requests that do not otherwise
-specify a time. In addition, ffserver will skip frames until a key_frame
-is found. This further reduces the startup delay by not transferring data
-that will be discarded.
-
-* You may want to adjust the MaxBandwidth in the ffserver.conf to limit
-the amount of bandwidth consumed by live streams.
-
- at section Why does the ?buffer / Preroll stop working after a time?
-
-It turns out that (on my machine at least) the number of frames successfully
-grabbed is marginally less than the number that ought to be grabbed. This
-means that the timestamp in the encoded data stream gets behind realtime.
-This means that if you say 'Preroll 10', then when the stream gets 10
-or more seconds behind, there is no Preroll left.
-
-Fixing this requires a change in the internals of how timestamps are
-handled.
-
- at section Does the @code{?date=} stuff work.
-
-Yes (subject to the limitation outlined above). Also note that whenever you
-start ffserver, it deletes the ffm file (if any parameters have changed),
-thus wiping out what you had recorded before.
-
-The format of the @code{?date=xxxxxx} is fairly flexible. You should use one
-of the following formats (the 'T' is literal):
-
- at example
-* YYYY-MM-DDTHH:MM:SS     (localtime)
-* YYYY-MM-DDTHH:MM:SSZ    (UTC)
- at end example
-
-You can omit the YYYY-MM-DD, and then it refers to the current day. However
-note that @samp{?date=16:00:00} refers to 16:00 on the current day -- this
-may be in the future and so is unlikely to be useful.
-
-You use this by adding the ?date= to the end of the URL for the stream.
-For example:   @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}.
- at c man end
-
- at chapter Invocation
- at section Syntax
- at example
- at c man begin SYNOPSIS
-ffserver [options]
- at c man end
- at end example
-
- at section Options
- at c man begin OPTIONS
-
- at include fftools-common-opts.texi
-
- at section Main options
-
- at table @option
- at item -f @var{configfile}
-Use @file{configfile} instead of @file{/etc/ffserver.conf}.
- at item -n
-Enable no-launch mode. This option disables all the Launch directives
-within the various <Stream> sections. FFserver will not launch any
-ffmpeg instance, so you will have to launch them manually.
- at item -d
-Enable debug mode. This option increases log verbosity, directs log
-messages to stdout and causes ffserver to run in the foreground
-rather than as a daemon.
- at end table
- at c man end
-
- at ignore
-
- at setfilename ffserver
- at settitle FFserver video server
-
- at c man begin SEEALSO
-ffmpeg(1), ffplay(1), the @file{ffmpeg/doc/ffserver.conf} example and
-the HTML documentation of @file{ffmpeg}.
- at c man end
-
- at c man begin AUTHOR
-Fabrice Bellard
- at c man end
-
- at end ignore
-
- at bye
diff --git a/doc/ffserver.conf b/doc/ffserver.conf
deleted file mode 100644
index 2fbfecd..0000000
--- a/doc/ffserver.conf
+++ /dev/null
@@ -1,356 +0,0 @@
-# Port on which the server is listening. You must select a different
-# port from your standard HTTP web server if it is running on the same
-# computer.
-Port 8090
-
-# Address on which the server is bound. Only useful if you have
-# several network interfaces.
-BindAddress 0.0.0.0
-
-# Number of simultaneous HTTP connections that can be handled. It has
-# to be defined *before* the MaxClients parameter, since it defines the
-# MaxClients maximum limit.
-MaxHTTPConnections 2000
-
-# Number of simultaneous requests that can be handled. Since FFServer
-# is very fast, it is more likely that you will want to leave this high
-# and use MaxBandwidth, below.
-MaxClients 1000
-
-# This the maximum amount of kbit/sec that you are prepared to
-# consume when streaming to clients.
-MaxBandwidth 1000
-
-# Access log file (uses standard Apache log file format)
-# '-' is the standard output.
-CustomLog -
-
-# Suppress that if you want to launch ffserver as a daemon.
-NoDaemon
-
-
-##################################################################
-# Definition of the live feeds. Each live feed contains one video
-# and/or audio sequence coming from an ffmpeg encoder or another
-# ffserver. This sequence may be encoded simultaneously with several
-# codecs at several resolutions.
-
-<Feed feed1.ffm>
-
-# You must use 'ffmpeg' to send a live feed to ffserver. In this
-# example, you can type:
-#
-# ffmpeg http://localhost:8090/feed1.ffm
-
-# ffserver can also do time shifting. It means that it can stream any
-# previously recorded live stream. The request should contain:
-# "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
-# a path where the feed is stored on disk. You also specify the
-# maximum size of the feed, where zero means unlimited. Default:
-# File=/tmp/feed_name.ffm FileMaxSize=5M
-File /tmp/feed1.ffm
-FileMaxSize 200K
-
-# You could specify
-# ReadOnlyFile /saved/specialvideo.ffm
-# This marks the file as readonly and it will not be deleted or updated.
-
-# Specify launch in order to start ffmpeg automatically.
-# First ffmpeg must be defined with an appropriate path if needed,
-# after that options can follow, but avoid adding the http:// field
-#Launch ffmpeg
-
-# Only allow connections from localhost to the feed.
-ACL allow 127.0.0.1
-
-</Feed>
-
-
-##################################################################
-# Now you can define each stream which will be generated from the
-# original audio and video stream. Each format has a filename (here
-# 'test1.mpg'). FFServer will send this stream when answering a
-# request containing this filename.
-
-<Stream test1.mpg>
-
-# coming from live feed 'feed1'
-Feed feed1.ffm
-
-# Format of the stream : you can choose among:
-# mpeg       : MPEG-1 multiplexed video and audio
-# mpegvideo  : only MPEG-1 video
-# mp2        : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec)
-# ogg        : Ogg format (Vorbis audio codec)
-# rm         : RealNetworks-compatible stream. Multiplexed audio and video.
-# ra         : RealNetworks-compatible stream. Audio only.
-# mpjpeg     : Multipart JPEG (works with Netscape without any plugin)
-# jpeg       : Generate a single JPEG image.
-# asf        : ASF compatible streaming (Windows Media Player format).
-# swf        : Macromedia Flash compatible stream
-# avi        : AVI format (MPEG-4 video, MPEG audio sound)
-Format mpeg
-
-# Bitrate for the audio stream. Codecs usually support only a few
-# different bitrates.
-AudioBitRate 32
-
-# Number of audio channels: 1 = mono, 2 = stereo
-AudioChannels 1
-
-# Sampling frequency for audio. When using low bitrates, you should
-# lower this frequency to 22050 or 11025. The supported frequencies
-# depend on the selected audio codec.
-AudioSampleRate 44100
-
-# Bitrate for the video stream
-VideoBitRate 64
-
-# Ratecontrol buffer size
-VideoBufferSize 40
-
-# Number of frames per second
-VideoFrameRate 3
-
-# Size of the video frame: WxH (default: 160x128)
-# The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga,
-# qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga,
-# wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720,
-# hd1080
-VideoSize 160x128
-
-# Transmit only intra frames (useful for low bitrates, but kills frame rate).
-#VideoIntraOnly
-
-# If non-intra only, an intra frame is transmitted every VideoGopSize
-# frames. Video synchronization can only begin at an intra frame.
-VideoGopSize 12
-
-# More MPEG-4 parameters
-# VideoHighQuality
-# Video4MotionVector
-
-# Choose your codecs:
-#AudioCodec mp2
-#VideoCodec mpeg1video
-
-# Suppress audio
-#NoAudio
-
-# Suppress video
-#NoVideo
-
-#VideoQMin 3
-#VideoQMax 31
-
-# Set this to the number of seconds backwards in time to start. Note that
-# most players will buffer 5-10 seconds of video, and also you need to allow
-# for a keyframe to appear in the data stream.
-#Preroll 15
-
-# ACL:
-
-# You can allow ranges of addresses (or single addresses)
-#ACL ALLOW <first address> <last address>
-
-# You can deny ranges of addresses (or single addresses)
-#ACL DENY <first address> <last address>
-
-# You can repeat the ACL allow/deny as often as you like. It is on a per
-# stream basis. The first match defines the action. If there are no matches,
-# then the default is the inverse of the last ACL statement.
-#
-# Thus 'ACL allow localhost' only allows access from localhost.
-# 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and
-# allow everybody else.
-
-</Stream>
-
-
-##################################################################
-# Example streams
-
-
-# Multipart JPEG
-
-#<Stream test.mjpg>
-#Feed feed1.ffm
-#Format mpjpeg
-#VideoFrameRate 2
-#VideoIntraOnly
-#NoAudio
-#Strict -1
-#</Stream>
-
-
-# Single JPEG
-
-#<Stream test.jpg>
-#Feed feed1.ffm
-#Format jpeg
-#VideoFrameRate 2
-#VideoIntraOnly
-##VideoSize 352x240
-#NoAudio
-#Strict -1
-#</Stream>
-
-
-# Flash
-
-#<Stream test.swf>
-#Feed feed1.ffm
-#Format swf
-#VideoFrameRate 2
-#VideoIntraOnly
-#NoAudio
-#</Stream>
-
-
-# ASF compatible
-
-<Stream test.asf>
-Feed feed1.ffm
-Format asf
-VideoFrameRate 15
-VideoSize 352x240
-VideoBitRate 256
-VideoBufferSize 40
-VideoGopSize 30
-AudioBitRate 64
-StartSendOnKey
-</Stream>
-
-
-# MP3 audio
-
-#<Stream test.mp3>
-#Feed feed1.ffm
-#Format mp2
-#AudioCodec mp3
-#AudioBitRate 64
-#AudioChannels 1
-#AudioSampleRate 44100
-#NoVideo
-#</Stream>
-
-
-# Ogg Vorbis audio
-
-#<Stream test.ogg>
-#Feed feed1.ffm
-#Title "Stream title"
-#AudioBitRate 64
-#AudioChannels 2
-#AudioSampleRate 44100
-#NoVideo
-#</Stream>
-
-
-# Real with audio only at 32 kbits
-
-#<Stream test.ra>
-#Feed feed1.ffm
-#Format rm
-#AudioBitRate 32
-#NoVideo
-#NoAudio
-#</Stream>
-
-
-# Real with audio and video at 64 kbits
-
-#<Stream test.rm>
-#Feed feed1.ffm
-#Format rm
-#AudioBitRate 32
-#VideoBitRate 128
-#VideoFrameRate 25
-#VideoGopSize 25
-#NoAudio
-#</Stream>
-
-
-##################################################################
-# A stream coming from a file: you only need to set the input
-# filename and optionally a new format. Supported conversions:
-#    AVI -> ASF
-
-#<Stream file.rm>
-#File "/usr/local/httpd/htdocs/tlive.rm"
-#NoAudio
-#</Stream>
-
-#<Stream file.asf>
-#File "/usr/local/httpd/htdocs/test.asf"
-#NoAudio
-#Author "Me"
-#Copyright "Super MegaCorp"
-#Title "Test stream from disk"
-#Comment "Test comment"
-#</Stream>
-
-
-##################################################################
-# RTSP examples
-#
-# You can access this stream with the RTSP URL:
-#   rtsp://localhost:5454/test1-rtsp.mpg
-#
-# A non-standard RTSP redirector is also created. Its URL is:
-#   http://localhost:8090/test1-rtsp.rtsp
-
-#<Stream test1-rtsp.mpg>
-#Format rtp
-#File "/usr/local/httpd/htdocs/test1.mpg"
-#</Stream>
-
-
-##################################################################
-# SDP/multicast examples
-#
-# If you want to send your stream in multicast, you must set the
-# multicast address with MulticastAddress. The port and the TTL can
-# also be set.
-#
-# An SDP file is automatically generated by ffserver by adding the
-# 'sdp' extension to the stream name (here
-# http://localhost:8090/test1-sdp.sdp). You should usually give this
-# file to your player to play the stream.
-#
-# The 'NoLoop' option can be used to avoid looping when the stream is
-# terminated.
-
-#<Stream test1-sdp.mpg>
-#Format rtp
-#File "/usr/local/httpd/htdocs/test1.mpg"
-#MulticastAddress 224.124.0.1
-#MulticastPort 5000
-#MulticastTTL 16
-#NoLoop
-#</Stream>
-
-
-##################################################################
-# Special streams
-
-# Server status
-
-<Stream stat.html>
-Format status
-
-# Only allow local people to get the status
-ACL allow localhost
-ACL allow 192.168.0.0 192.168.255.255
-
-#FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico
-</Stream>
-
-
-# Redirect index.html to the appropriate site
-
-<Redirect index.html>
-URL http://www.ffmpeg.org/
-</Redirect>
-
-
diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
deleted file mode 100644
index 4fc271d..0000000
--- a/doc/fftools-common-opts.texi
+++ /dev/null
@@ -1,72 +0,0 @@
- at section Generic options
-
-These options are shared amongst the ff* tools.
-
- at table @option
-
- at item -L
-Show license.
-
- at item -h, -?, -help, --help
-Show help.
-
- at item -version
-Show version.
-
- at item -formats
-Show available formats.
-
-The fields preceding the format names have the following meanings:
- at table @samp
- at item D
-Decoding available
- at item E
-Encoding available
- at end table
-
- at item -codecs
-Show available codecs.
-
-The fields preceding the codec names have the following meanings:
- at table @samp
- at item D
-Decoding available
- at item E
-Encoding available
- at item V/A/S
-Video/audio/subtitle codec
- at item S
-Codec supports slices
- at item D
-Codec supports direct rendering
- at item T
-Codec can handle input truncated at random locations instead of only at frame boundaries
- at end table
-
- at item -bsfs
-Show available bitstream filters.
-
- at item -protocols
-Show available protocols.
-
- at item -filters
-Show available libavfilter filters.
-
- at item -pix_fmts
-Show available pixel formats.
-
- at item -loglevel @var{loglevel}
-Set the logging level used by the library.
- at var{loglevel} is a number or a string containing one of the following values:
- at table @samp
- at item quiet
- at item panic
- at item fatal
- at item error
- at item warning
- at item info
- at item verbose
- at item debug
- at end table
-
- at end table
diff --git a/doc/general.texi b/doc/general.texi
deleted file mode 100644
index dfa5b07..0000000
--- a/doc/general.texi
+++ /dev/null
@@ -1,1061 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle General Documentation
- at titlepage
- at sp 7
- at center @titlefont{General Documentation}
- at sp 3
- at end titlepage
-
-
- at chapter external libraries
-
-FFmpeg can be hooked up with a number of external libraries to add support
-for more formats. None of them are used by default, their use has to be
-explicitly requested by passing the appropriate flags to @file{./configure}.
-
- at section OpenCORE AMR
-
-FFmpeg can make use of the OpenCORE libraries for AMR-NB
-decoding/encoding and AMR-WB decoding.
-
-Go to @url{http://sourceforge.net/projects/opencore-amr/} and follow the instructions for
-installing the libraries. Then pass @code{--enable-libopencore-amrnb} and/or
- at code{--enable-libopencore-amrwb} to configure to enable the libraries.
-
-Note that OpenCORE is under the Apache License 2.0 (see
- at url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is
-incompatible with the LGPL version 2.1 and GPL version 2. You have to
-upgrade FFmpeg's license to LGPL version 3 (or if you have enabled
-GPL components, GPL version 3) to use it.
-
-
- at chapter Supported File Formats and Codecs
-
-You can use the @code{-formats} and @code{-codecs} options to have an exhaustive list.
-
- at section File Formats
-
-FFmpeg supports the following file formats through the @code{libavformat}
-library:
-
- at multitable @columnfractions .4 .1 .1 .4
- at item Name @tab Encoding @tab Decoding @tab Comments
- at item 4xm                       @tab   @tab X
-    @tab 4X Technologies format, used in some games.
- at item 8088flex TMV              @tab   @tab X
- at item Adobe Filmstrip           @tab X @tab X
- at item Audio IFF (AIFF)          @tab X @tab X
- at item American Laser Games MM   @tab   @tab X
-    @tab Multimedia format used in games like Mad Dog McCree.
- at item 3GPP AMR                  @tab X @tab X
- at item ASF                       @tab X @tab X
- at item AVI                       @tab X @tab X
- at item AVISynth                  @tab   @tab X
- at item AVS                       @tab   @tab X
-    @tab Multimedia format used by the Creature Shock game.
- at item Beam Software SIFF        @tab   @tab X
-    @tab Audio and video format used in some games by Beam Software.
- at item Bethesda Softworks VID    @tab   @tab X
-    @tab Used in some games from Bethesda Softworks.
- at item Bink                      @tab   @tab X
-    @tab Multimedia format used by many games.
- at item Brute Force & Ignorance   @tab   @tab X
-    @tab Used in the game Flash Traffic: City of Angels.
- at item Interplay C93             @tab   @tab X
-    @tab Used in the game Cyberia from Interplay.
- at item Delphine Software International CIN @tab   @tab X
-    @tab Multimedia format used by Delphine Software games.
- at item CD+G                      @tab   @tab X
-    @tab Video format used by CD+G karaoke disks
- at item Core Audio Format         @tab   @tab X
-    @tab Apple Core Audio Format
- at item CRC testing format        @tab X @tab
- at item Creative Voice            @tab X @tab X
-    @tab Created for the Sound Blaster Pro.
- at item CRYO APC                  @tab   @tab X
-    @tab Audio format used in some games by CRYO Interactive Entertainment.
- at item D-Cinema audio            @tab X @tab X
- at item Deluxe Paint Animation    @tab   @tab X
- at item DV video                  @tab X @tab X
- at item DXA                       @tab   @tab X
-    @tab This format is used in the non-Windows version of the Feeble Files
-         game and different game cutscenes repacked for use with ScummVM.
- at item Electronic Arts cdata  @tab    @tab X
- at item Electronic Arts Multimedia  @tab    @tab X
-    @tab Used in various EA games; files have extensions like WVE and UV2.
- at item FFM (FFserver live feed)  @tab X @tab X
- at item Flash (SWF)               @tab X @tab X
- at item Flash 9 (AVM2)            @tab X @tab X
-    @tab Only embedded audio is decoded.
- at item FLI/FLC/FLX animation     @tab   @tab X
-    @tab .fli/.flc files
- at item Flash Video (FLV)         @tab   @tab X
-    @tab Macromedia Flash video files
- at item framecrc testing format   @tab X @tab
- at item FunCom ISS                @tab   @tab X
-    @tab Audio format used in various games from FunCom like The Longest Journey.
- at item GIF Animation             @tab X @tab
- at item GXF                       @tab X @tab X
-    @tab General eXchange Format SMPTE 360M, used by Thomson Grass Valley
-         playout servers.
- at item id Quake II CIN video     @tab   @tab X
- at item id RoQ                    @tab X @tab X
-    @tab Used in Quake III, Jedi Knight 2, other computer games.
- at item IEC61937 encapsulation @tab X @tab
- at item IFF                       @tab   @tab X
-    @tab Interchange File Format
- at item Interplay MVE             @tab   @tab X
-    @tab Format used in various Interplay computer games.
- at item IV8                       @tab   @tab X
-    @tab A format generated by IndigoVision 8000 video server.
- at item LMLM4                     @tab   @tab X
-    @tab Used by Linux Media Labs MPEG-4 PCI boards
- at item Matroska                  @tab X @tab X
- at item Matroska audio            @tab X @tab
- at item MAXIS XA                  @tab   @tab X
-    @tab Used in Sim City 3000; file extension .xa.
- at item MD Studio                 @tab   @tab X
- at item Monkey's Audio            @tab   @tab X
- at item Motion Pixels MVI         @tab   @tab X
- at item MOV/QuickTime/MP4         @tab X @tab X
-    @tab 3GP, 3GP2, PSP, iPod variants supported
- at item MP2                       @tab X @tab X
- at item MP3                       @tab X @tab X
- at item MPEG-1 System             @tab X @tab X
-    @tab muxed audio and video, VCD format supported
- at item MPEG-PS (program stream)  @tab X @tab X
-    @tab also known as @code{VOB} file, SVCD and DVD format supported
- at item MPEG-TS (transport stream) @tab X @tab X
-    @tab also known as DVB Transport Stream
- at item MPEG-4                    @tab X @tab X
-    @tab MPEG-4 is a variant of QuickTime.
- at item MIME multipart JPEG       @tab X @tab
- at item MSN TCP webcam            @tab   @tab X
-    @tab Used by MSN Messenger webcam streams.
- at item MTV                       @tab   @tab X
- at item Musepack                  @tab   @tab X
- at item Musepack SV8              @tab   @tab X
- at item Material eXchange Format (MXF) @tab X @tab X
-    @tab SMPTE 377M, used by D-Cinema, broadcast industry.
- at item Material eXchange Format (MXF), D-10 Mapping @tab X @tab X
-    @tab SMPTE 386M, D-10/IMX Mapping.
- at item NC camera feed            @tab   @tab X
-    @tab NC (AVIP NC4600) camera streams
- at item NTT TwinVQ (VQF)          @tab   @tab X
-    @tab Nippon Telegraph and Telephone Corporation TwinVQ.
- at item Nullsoft Streaming Video  @tab   @tab X
- at item NuppelVideo               @tab   @tab X
- at item NUT                       @tab X @tab X
-    @tab NUT Open Container Format
- at item Ogg                       @tab X @tab X
- at item TechnoTrend PVA           @tab   @tab X
-    @tab Used by TechnoTrend DVB PCI boards.
- at item QCP                       @tab   @tab X
- at item raw ADTS (AAC)            @tab X @tab X
- at item raw AC-3                  @tab X @tab X
- at item raw Chinese AVS video     @tab   @tab X
- at item raw CRI ADX               @tab X @tab X
- at item raw Dirac                 @tab X @tab X
- at item raw DNxHD                 @tab X @tab X
- at item raw DTS                   @tab X @tab X
- at item raw E-AC-3                @tab X @tab X
- at item raw FLAC                  @tab X @tab X
- at item raw GSM                   @tab   @tab X
- at item raw H.261                 @tab X @tab X
- at item raw H.263                 @tab X @tab X
- at item raw H.264                 @tab X @tab X
- at item raw Ingenient MJPEG       @tab   @tab X
- at item raw MJPEG                 @tab X @tab X
- at item raw MLP                   @tab   @tab X
- at item raw MPEG                  @tab   @tab X
- at item raw MPEG-1                @tab   @tab X
- at item raw MPEG-2                @tab   @tab X
- at item raw MPEG-4                @tab X @tab X
- at item raw NULL                  @tab X @tab
- at item raw video                 @tab X @tab X
- at item raw id RoQ                @tab X @tab
- at item raw Shorten               @tab   @tab X
- at item raw TrueHD                @tab X @tab X
- at item raw VC-1                  @tab   @tab X
- at item raw PCM A-law             @tab X @tab X
- at item raw PCM mu-law            @tab X @tab X
- at item raw PCM signed 8 bit      @tab X @tab X
- at item raw PCM signed 16 bit big-endian  @tab X @tab X
- at item raw PCM signed 16 bit little-endian  @tab X @tab X
- at item raw PCM signed 24 bit big-endian  @tab X @tab X
- at item raw PCM signed 24 bit little-endian  @tab X @tab X
- at item raw PCM signed 32 bit big-endian  @tab X @tab X
- at item raw PCM signed 32 bit little-endian  @tab X @tab X
- at item raw PCM unsigned 8 bit    @tab X @tab X
- at item raw PCM unsigned 16 bit big-endian  @tab X @tab X
- at item raw PCM unsigned 16 bit little-endian  @tab X @tab X
- at item raw PCM unsigned 24 bit big-endian  @tab X @tab X
- at item raw PCM unsigned 24 bit little-endian  @tab X @tab X
- at item raw PCM unsigned 32 bit big-endian  @tab X @tab X
- at item raw PCM unsigned 32 bit little-endian  @tab X @tab X
- at item raw PCM floating-point 32 bit big-endian  @tab X @tab X
- at item raw PCM floating-point 32 bit little-endian  @tab X @tab X
- at item raw PCM floating-point 64 bit big-endian  @tab X @tab X
- at item raw PCM floating-point 64 bit little-endian  @tab X @tab X
- at item RDT                       @tab   @tab X
- at item REDCODE R3D               @tab   @tab X
-    @tab File format used by RED Digital cameras, contains JPEG 2000 frames and PCM audio.
- at item RealMedia                 @tab X @tab X
- at item Redirector                @tab   @tab X
- at item Renderware TeXture Dictionary @tab   @tab X
- at item RL2                       @tab   @tab X
-    @tab Audio and video format used in some games by Entertainment Software Partners.
- at item RPL/ARMovie               @tab   @tab X
- at item RTMP                      @tab X @tab X
-    @tab Output is performed by publishing stream to RTMP server
- at item RTP                       @tab   @tab X
- at item RTSP                      @tab X @tab X
- at item SDP                       @tab   @tab X
- at item Sega FILM/CPK             @tab   @tab X
-    @tab Used in many Sega Saturn console games.
- at item Sierra SOL                @tab   @tab X
-    @tab .sol files used in Sierra Online games.
- at item Sierra VMD                @tab   @tab X
-    @tab Used in Sierra CD-ROM games.
- at item Smacker                   @tab   @tab X
-    @tab Multimedia format used by many games.
- at item Sony OpenMG (OMA)         @tab   @tab X
-    @tab Audio format used in Sony Sonic Stage and Sony Vegas.
- at item Sony PlayStation STR      @tab   @tab X
- at item Sony Wave64 (W64)         @tab   @tab X
- at item SoX native format         @tab X @tab X
- at item SUN AU format             @tab X @tab X
- at item THP                       @tab   @tab X
-    @tab Used on the Nintendo GameCube.
- at item Tiertex Limited SEQ       @tab   @tab X
-    @tab Tiertex .seq files used in the DOS CD-ROM version of the game Flashback.
- at item True Audio                @tab   @tab X
- at item VC-1 test bitstream       @tab X @tab X
- at item WAV                       @tab X @tab X
- at item WavPack                   @tab   @tab X
- at item WebM                      @tab X @tab X
- at item Wing Commander III movie  @tab   @tab X
-    @tab Multimedia format used in Origin's Wing Commander III computer game.
- at item Westwood Studios audio    @tab   @tab X
-    @tab Multimedia format used in Westwood Studios games.
- at item Westwood Studios VQA      @tab   @tab X
-    @tab Multimedia format used in Westwood Studios games.
- at item YUV4MPEG pipe             @tab X @tab X
- at item Psygnosis YOP             @tab   @tab X
- at end multitable
-
- at code{X} means that encoding (resp. decoding) is supported.
-
- at section Image Formats
-
-FFmpeg can read and write images for each frame of a video sequence. The
-following image formats are supported:
-
- at multitable @columnfractions .4 .1 .1 .4
- at item Name @tab Encoding @tab Decoding @tab Comments
- at item .Y.U.V       @tab X @tab X
-    @tab one raw file per component
- at item animated GIF @tab X @tab X
-    @tab Only uncompressed GIFs are generated.
- at item BMP          @tab X @tab X
-    @tab Microsoft BMP image
- at item DPX          @tab   @tab X
-    @tab Digital Picture Exchange
- at item JPEG         @tab X @tab X
-    @tab Progressive JPEG is not supported.
- at item JPEG 2000    @tab   @tab E
-    @tab decoding supported through external library libopenjpeg
- at item JPEG-LS      @tab X @tab X
- at item LJPEG        @tab X @tab
-    @tab Lossless JPEG
- at item PAM          @tab X @tab X
-    @tab PAM is a PNM extension with alpha support.
- at item PBM          @tab X @tab X
-    @tab Portable BitMap image
- at item PCX          @tab X @tab X
-    @tab PC Paintbrush
- at item PGM          @tab X @tab X
-    @tab Portable GrayMap image
- at item PGMYUV       @tab X @tab X
-    @tab PGM with U and V components in YUV 4:2:0
- at item PNG          @tab X @tab X
-    @tab 2/4 bpp not supported yet
- at item PPM          @tab X @tab X
-    @tab Portable PixelMap image
- at item PTX          @tab   @tab X
-    @tab V.Flash PTX format
- at item SGI          @tab X @tab X
-    @tab SGI RGB image format
- at item Sun Rasterfile  @tab   @tab X
-    @tab Sun RAS image format
- at item TIFF         @tab X @tab X
-    @tab YUV, JPEG and some extension is not supported yet.
- at item Truevision Targa  @tab X @tab X
-    @tab Targa (.TGA) image format
- at end multitable
-
- at code{X} means that encoding (resp. decoding) is supported.
-
- at code{E} means that support is provided through an external library.
-
- at section Video Codecs
-
- at multitable @columnfractions .4 .1 .1 .4
- at item Name @tab Encoding @tab Decoding @tab Comments
- at item 4X Movie               @tab     @tab  X
-    @tab Used in certain computer games.
- at item 8088flex TMV           @tab     @tab  X
- at item 8SVX exponential       @tab     @tab  X
- at item 8SVX fibonacci         @tab     @tab  X
- at item American Laser Games MM  @tab    @tab X
-    @tab Used in games like Mad Dog McCree.
- at item AMV Video              @tab     @tab  X
-    @tab Used in Chinese MP3 players.
- at item Apple MJPEG-B          @tab     @tab  X
- at item Apple QuickDraw        @tab     @tab  X
-    @tab fourcc: qdrw
- at item Asus v1                @tab  X  @tab  X
-    @tab fourcc: ASV1
- at item Asus v2                @tab  X  @tab  X
-    @tab fourcc: ASV2
- at item ATI VCR1               @tab     @tab  X
-    @tab fourcc: VCR1
- at item ATI VCR2               @tab     @tab  X
-    @tab fourcc: VCR2
- at item Auravision Aura        @tab     @tab  X
- at item Auravision Aura 2      @tab     @tab  X
- at item Autodesk Animator Flic video  @tab     @tab  X
- at item Autodesk RLE           @tab     @tab  X
-    @tab fourcc: AASC
- at item AVS (Audio Video Standard) video  @tab     @tab  X
-    @tab Video encoding used by the Creature Shock game.
- at item Beam Software VB       @tab     @tab  X
- at item Bethesda VID video     @tab     @tab  X
-    @tab Used in some games from Bethesda Softworks.
- at item Bink Video             @tab     @tab  X
-    @tab Support for version 'b' is missing.
- at item Brute Force & Ignorance   @tab   @tab X
-    @tab Used in the game Flash Traffic: City of Angels.
- at item C93 video              @tab     @tab  X
-    @tab Codec used in Cyberia game.
- at item CamStudio              @tab     @tab  X
-    @tab fourcc: CSCD
- at item CD+G                   @tab     @tab  X
-    @tab Video codec for CD+G karaoke disks
- at item Chinese AVS video      @tab     @tab  X
-    @tab AVS1-P2, JiZhun profile
- at item Delphine Software International CIN video  @tab     @tab  X
-    @tab Codec used in Delphine Software International games.
- at item Cinepak                @tab     @tab  X
- at item Cirrus Logic AccuPak   @tab     @tab  X
-    @tab fourcc: CLJR
- at item Creative YUV (CYUV)    @tab     @tab  X
- at item Dirac                  @tab  E  @tab  E
-    @tab supported through external libdirac/libschroedinger libraries
- at item Deluxe Paint Animation @tab     @tab  X
- at item DNxHD                  @tab   X @tab  X
-    @tab aka SMPTE VC3
- at item Duck TrueMotion 1.0   @tab     @tab  X
-    @tab fourcc: DUCK
- at item Duck TrueMotion 2.0    @tab     @tab  X
-    @tab fourcc: TM20
- at item DV (Digital Video)     @tab  X  @tab  X
- at item Feeble Files/ScummVM DXA  @tab     @tab  X
-    @tab Codec originally used in Feeble Files game.
- at item Electronic Arts CMV video  @tab     @tab  X
-    @tab Used in NHL 95 game.
- at item Electronic Arts Madcow video  @tab     @tab  X
- at item Electronic Arts TGV video  @tab     @tab  X
- at item Electronic Arts TGQ video  @tab     @tab  X
- at item Electronic Arts TQI video  @tab     @tab  X
- at item Escape 124             @tab     @tab  X
- at item FFmpeg video codec #1  @tab  X  @tab  X
-    @tab experimental lossless codec (fourcc: FFV1)
- at item Flash Screen Video v1  @tab  X  @tab  X
-    @tab fourcc: FSV1
- at item Flash Video (FLV)      @tab  X  @tab  X
-    @tab Sorenson H.263 used in Flash
- at item Fraps                  @tab     @tab  X
- at item H.261                  @tab  X  @tab  X
- at item H.263 / H.263-1996     @tab  X  @tab  X
- at item H.263+ / H.263-1998 / H.263 version 2  @tab  X  @tab  X
- at item H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10  @tab  E  @tab  X
-    @tab encoding supported through external library libx264
- at item H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)  @tab  E  @tab  X
- at item HuffYUV                @tab  X  @tab  X
- at item HuffYUV FFmpeg variant @tab  X  @tab  X
- at item IBM Ultimotion         @tab     @tab  X
-    @tab fourcc: ULTI
- at item id Cinematic video     @tab     @tab  X
-    @tab Used in Quake II.
- at item id RoQ video           @tab  X  @tab  X
-    @tab Used in Quake III, Jedi Knight 2, other computer games.
- at item IFF ILBM               @tab     @tab  X
-    @tab IFF interlaved bitmap
- at item IFF ByteRun1           @tab     @tab  X
-    @tab IFF run length encoded bitmap
- at item Intel H.263            @tab     @tab  X
- at item Intel Indeo 2          @tab     @tab  X
- at item Intel Indeo 3          @tab     @tab  X
- at item Intel Indeo 5          @tab     @tab  X
- at item Interplay C93          @tab     @tab  X
-    @tab Used in the game Cyberia from Interplay.
- at item Interplay MVE video    @tab     @tab  X
-    @tab Used in Interplay .MVE files.
- at item Karl Morton's video codec  @tab     @tab  X
-    @tab Codec used in Worms games.
- at item Kega Game Video (KGV1) @tab      @tab  X
-    @tab Kega emulator screen capture codec.
- at item LCL (LossLess Codec Library) MSZH  @tab     @tab  X
- at item LCL (LossLess Codec Library) ZLIB  @tab  E  @tab  E
- at item LOCO                   @tab     @tab  X
- at item lossless MJPEG         @tab  X  @tab  X
- at item Microsoft RLE          @tab     @tab  X
- at item Microsoft Video 1      @tab     @tab  X
- at item Mimic                  @tab     @tab  X
-    @tab Used in MSN Messenger Webcam streams.
- at item Miro VideoXL           @tab     @tab  X
-    @tab fourcc: VIXL
- at item MJPEG (Motion JPEG)    @tab  X  @tab  X
- at item Motion Pixels video    @tab     @tab  X
- at item MPEG-1 video           @tab  X  @tab  X
- at item MPEG-1/2 video XvMC (X-Video Motion Compensation)  @tab     @tab  X
- at item MPEG-1/2 video (VDPAU acceleration)  @tab     @tab  X
- at item MPEG-2 video           @tab  X  @tab  X
- at item MPEG-4 part 2          @tab  X  @tab  X
-    @ libxvidcore can be used alternatively for encoding.
- at item MPEG-4 part 2 Microsoft variant version 1  @tab  X  @tab  X
- at item MPEG-4 part 2 Microsoft variant version 2  @tab  X  @tab  X
- at item MPEG-4 part 2 Microsoft variant version 3  @tab  X  @tab  X
- at item Nintendo Gamecube THP video  @tab     @tab  X
- at item NuppelVideo/RTjpeg     @tab     @tab  X
-    @tab Video encoding used in NuppelVideo files.
- at item On2 VP3                @tab     @tab  X
-    @tab still experimental
- at item On2 VP5                @tab     @tab  X
-    @tab fourcc: VP50
- at item On2 VP6                @tab     @tab  X
-    @tab fourcc: VP60,VP61,VP62
- at item VP8                    @tab  X  @tab  X
-    @tab fourcc: VP80, de/encoding supported through external library libvpx
- at item planar RGB             @tab     @tab  X
-    @tab fourcc: 8BPS
- at item Q-team QPEG            @tab     @tab  X
-    @tab fourccs: QPEG, Q1.0, Q1.1
- at item QuickTime 8BPS video   @tab     @tab  X
- at item QuickTime Animation (RLE) video  @tab  X  @tab  X
-    @tab fourcc: 'rle '
- at item QuickTime Graphics (SMC)  @tab     @tab  X
-    @tab fourcc: 'smc '
- at item QuickTime video (RPZA) @tab     @tab  X
-    @tab fourcc: rpza
- at item R210 Quicktime Uncompressed RGB 10-bit     @tab     @tab  X
- at item Raw Video              @tab  X  @tab  X
- at item RealVideo 1.0          @tab  X  @tab  X
- at item RealVideo 2.0          @tab  X  @tab  X
- at item RealVideo 3.0          @tab     @tab  X
-    @tab still far from ideal
- at item RealVideo 4.0          @tab     @tab  X
- at item Renderware TXD (TeXture Dictionary)  @tab     @tab  X
-    @tab Texture dictionaries used by the Renderware Engine.
- at item RL2 video              @tab     @tab  X
-    @tab used in some games by Entertainment Software Partners
- at item Sierra VMD video       @tab     @tab  X
-    @tab Used in Sierra VMD files.
- at item Smacker video          @tab     @tab  X
-    @tab Video encoding used in Smacker.
- at item SMPTE VC-1             @tab     @tab  X
- at item Snow                   @tab  X  @tab  X
-    @tab experimental wavelet codec (fourcc: SNOW)
- at item Sony PlayStation MDEC (Motion DECoder)  @tab     @tab  X
- at item Sorenson Vector Quantizer 1  @tab  X  @tab  X
-    @tab fourcc: SVQ1
- at item Sorenson Vector Quantizer 3  @tab     @tab  X
-    @tab fourcc: SVQ3
- at item Sunplus JPEG (SP5X)    @tab     @tab  X
-    @tab fourcc: SP5X
- at item TechSmith Screen Capture Codec  @tab     @tab  X
-    @tab fourcc: TSCC
- at item Theora                 @tab  E  @tab  X
-    @tab encoding supported through external library libtheora
- at item Tiertex Limited SEQ video  @tab     @tab  X
-    @tab Codec used in DOS CD-ROM FlashBack game.
- at item V210 Quicktime Uncompressed 4:2:2 10-bit     @tab  X  @tab  X
- at item VMware Screen Codec / VMware Video  @tab     @tab  X
-    @tab Codec used in videos captured by VMware.
- at item Westwood Studios VQA (Vector Quantized Animation) video  @tab     @tab  X
- at item Windows Media Video 7  @tab  X  @tab  X
- at item Windows Media Video 8  @tab  X  @tab  X
- at item Windows Media Video 9  @tab     @tab  X
-    @tab not completely working
- at item Wing Commander III / Xan  @tab     @tab  X
-    @tab Used in Wing Commander III .MVE files.
- at item Winnov WNV1            @tab     @tab  X
- at item WMV7                   @tab  X  @tab  X
- at item YAMAHA SMAF            @tab  X  @tab  X
- at item Psygnosis YOP Video    @tab     @tab  X
- at item ZLIB                   @tab  X  @tab  X
-    @tab part of LCL, encoder experimental
- at item Zip Motion Blocks Video  @tab   X @tab  X
-    @tab Encoder works only in PAL8.
- at end multitable
-
- at code{X} means that encoding (resp. decoding) is supported.
-
- at code{E} means that support is provided through an external library.
-
- at section Audio Codecs
-
- at multitable @columnfractions .4 .1 .1 .4
- at item Name @tab Encoding @tab Decoding @tab Comments
- at item 8SVX audio             @tab     @tab  X
- at item AAC                    @tab  E  @tab  X
-    @tab encoding supported through external library libfaac
- at item AC-3                   @tab IX  @tab  X
- at item ADPCM 4X Movie         @tab     @tab  X
- at item ADPCM CDROM XA         @tab     @tab  X
- at item ADPCM Creative Technology @tab     @tab  X
-    @tab 16 -> 4, 8 -> 4, 8 -> 3, 8 -> 2
- at item ADPCM Electronic Arts  @tab     @tab  X
-    @tab Used in various EA titles.
- at item ADPCM Electronic Arts Maxis CDROM XS  @tab     @tab  X
-    @tab Used in Sim City 3000.
- at item ADPCM Electronic Arts R1  @tab     @tab  X
- at item ADPCM Electronic Arts R2  @tab     @tab  X
- at item ADPCM Electronic Arts R3  @tab     @tab  X
- at item ADPCM Electronic Arts XAS @tab     @tab  X
- at item ADPCM G.726            @tab  X  @tab  X
- at item ADPCM IMA AMV          @tab     @tab  X
-    @tab Used in AMV files
- at item ADPCM IMA Electronic Arts EACS  @tab     @tab  X
- at item ADPCM IMA Electronic Arts SEAD  @tab     @tab  X
- at item ADPCM IMA Funcom       @tab     @tab  X
- at item ADPCM IMA QuickTime    @tab  X  @tab  X
- at item ADPCM IMA Loki SDL MJPEG  @tab     @tab  X
- at item ADPCM IMA WAV          @tab  X  @tab  X
- at item ADPCM IMA Westwood     @tab     @tab  X
- at item ADPCM ISS IMA          @tab     @tab  X
-    @tab Used in FunCom games.
- at item ADPCM IMA Duck DK3     @tab     @tab  X
-    @tab Used in some Sega Saturn console games.
- at item ADPCM IMA Duck DK4     @tab     @tab  X
-    @tab Used in some Sega Saturn console games.
- at item ADPCM Microsoft        @tab  X  @tab  X
- at item ADPCM MS IMA           @tab  X  @tab  X
- at item ADPCM Nintendo Gamecube THP  @tab     @tab  X
- at item ADPCM QT IMA           @tab  X  @tab  X
- at item ADPCM SEGA CRI ADX     @tab  X  @tab  X
-    @tab Used in Sega Dreamcast games.
- at item ADPCM Shockwave Flash  @tab  X  @tab  X
- at item ADPCM SMJPEG IMA       @tab     @tab  X
-    @tab Used in certain Loki game ports.
- at item ADPCM Sound Blaster Pro 2-bit  @tab     @tab  X
- at item ADPCM Sound Blaster Pro 2.6-bit  @tab     @tab  X
- at item ADPCM Sound Blaster Pro 4-bit  @tab     @tab  X
- at item ADPCM Westwood Studios IMA @tab     @tab  X
-    @tab Used in Westwood Studios games like Command and Conquer.
- at item ADPCM Yamaha           @tab  X  @tab  X
- at item AMR-NB                 @tab  E  @tab  X
-    @tab encoding supported through external library libopencore-amrnb
- at item AMR-WB                 @tab     @tab  E
-    @tab decoding supported through external library libopencore-amrwb
- at item Apple lossless audio   @tab  X  @tab  X
-    @tab QuickTime fourcc 'alac'
- at item Atrac 1                @tab     @tab  X
- at item Atrac 3                @tab     @tab  X
- at item Bink Audio             @tab     @tab  X
-    @tab Used in Bink and Smacker files in many games.
- at item Delphine Software International CIN audio  @tab     @tab  X
-    @tab Codec used in Delphine Software International games.
- at item COOK                   @tab     @tab  X
-    @tab All versions except 5.1 are supported.
- at item DCA (DTS Coherent Acoustics)  @tab     @tab  X
- at item DPCM id RoQ            @tab  X  @tab  X
-    @tab Used in Quake III, Jedi Knight 2, other computer games.
- at item DPCM Interplay         @tab     @tab  X
-    @tab Used in various Interplay computer games.
- at item DPCM Sierra Online     @tab     @tab  X
-    @tab Used in Sierra Online game audio files.
- at item DPCM Sol               @tab     @tab  X
- at item DPCM Xan               @tab     @tab  X
-    @tab Used in Origin's Wing Commander IV AVI files.
- at item DSP Group TrueSpeech   @tab     @tab  X
- at item DV audio               @tab     @tab  X
- at item Enhanced AC-3          @tab     @tab  X
- at item FLAC (Free Lossless Audio Codec)  @tab  X  @tab  IX
- at item G.729                  @tab     @tab  X
- at item GSM                    @tab  E  @tab  E
-    @tab supported through external library libgsm
- at item GSM Microsoft variant  @tab  E  @tab  E
-    @tab supported through external library libgsm
- at item IMC (Intel Music Coder)  @tab     @tab  X
- at item MACE (Macintosh Audio Compression/Expansion) 3:1  @tab     @tab  X
- at item MACE (Macintosh Audio Compression/Expansion) 6:1  @tab     @tab  X
- at item MLP (Meridian Lossless Packing)  @tab     @tab  X
-    @tab Used in DVD-Audio discs.
- at item Monkey's Audio         @tab     @tab  X
-    @tab Only versions 3.97-3.99 are supported.
- at item MP1 (MPEG audio layer 1)  @tab     @tab IX
- at item MP2 (MPEG audio layer 2)  @tab IX  @tab IX
- at item MP3 (MPEG audio layer 3)  @tab  E  @tab IX
-    @tab encoding supported through external library LAME, ADU MP3 and MP3onMP4 also supported
- at item MPEG-4 Audio Lossless Coding (ALS)  @tab     @tab  X
- at item Musepack SV7           @tab     @tab  X
- at item Musepack SV8           @tab     @tab  X
- at item Nellymoser Asao        @tab  X  @tab  X
- at item PCM A-law              @tab  X  @tab  X
- at item PCM mu-law             @tab  X  @tab  X
- at item PCM 16-bit little-endian planar  @tab     @tab  X
- at item PCM 32-bit floating point big-endian  @tab  X  @tab  X
- at item PCM 32-bit floating point little-endian  @tab  X  @tab  X
- at item PCM 64-bit floating point big-endian  @tab  X  @tab  X
- at item PCM 64-bit floating point little-endian  @tab  X  @tab  X
- at item PCM D-Cinema audio signed 24-bit   @tab  X  @tab  X
- at item PCM signed 8-bit       @tab  X  @tab  X
- at item PCM signed 16-bit big-endian  @tab  X  @tab  X
- at item PCM signed 16-bit little-endian  @tab  X  @tab  X
- at item PCM signed 24-bit big-endian  @tab  X  @tab  X
- at item PCM signed 24-bit little-endian  @tab  X  @tab  X
- at item PCM signed 32-bit big-endian  @tab  X  @tab  X
- at item PCM signed 32-bit little-endian  @tab  X  @tab  X
- at item PCM signed 16/20/24-bit big-endian in MPEG-TS  @tab     @tab  X
- at item PCM unsigned 8-bit     @tab  X  @tab  X
- at item PCM unsigned 16-bit big-endian  @tab  X  @tab  X
- at item PCM unsigned 16-bit little-endian  @tab  X  @tab  X
- at item PCM unsigned 24-bit big-endian  @tab  X  @tab  X
- at item PCM unsigned 24-bit little-endian  @tab  X  @tab  X
- at item PCM unsigned 32-bit big-endian  @tab  X  @tab  X
- at item PCM unsigned 32-bit little-endian  @tab  X  @tab  X
- at item PCM Zork               @tab  X  @tab  X
- at item QCELP / PureVoice      @tab     @tab  X
- at item QDesign Music Codec 2  @tab     @tab  X
-    @tab There are still some distortions.
- at item RealAudio 1.0 (14.4K)  @tab     @tab  X
-    @tab Real 14400 bit/s codec
- at item RealAudio 2.0 (28.8K)  @tab     @tab  X
-    @tab Real 28800 bit/s codec
- at item RealAudio 3.0 (dnet)   @tab IX  @tab  X
-    @tab Real low bitrate AC-3 codec
- at item RealAudio SIPR / ACELP.NET @tab     @tab  X
- at item Shorten                @tab     @tab  X
- at item Sierra VMD audio       @tab     @tab  X
-    @tab Used in Sierra VMD files.
- at item Smacker audio          @tab     @tab  X
- at item Sonic                  @tab  X  @tab  X
-    @tab experimental codec
- at item Sonic lossless         @tab  X  @tab  X
-    @tab experimental codec
- at item Speex                  @tab     @tab  E
-    @tab supported through external library libspeex
- at item True Audio (TTA)       @tab     @tab  X
- at item TrueHD                 @tab     @tab  X
-    @tab Used in HD-DVD and Blu-Ray discs.
- at item TwinVQ (VQF flavor)    @tab     @tab  X
- at item Vorbis                 @tab  E  @tab  X
-    @tab A native but very primitive encoder exists.
- at item WavPack                @tab     @tab  X
- at item Westwood Audio (SND1)  @tab     @tab  X
- at item Windows Media Audio 1  @tab  X  @tab  X
- at item Windows Media Audio 2  @tab  X  @tab  X
- at item Windows Media Audio Pro @tab    @tab  X
- at item Windows Media Audio Voice @tab  @tab  X
- at end multitable
-
- at code{X} means that encoding (resp. decoding) is supported.
-
- at code{E} means that support is provided through an external library.
-
- at code{I} means that an integer-only version is available, too (ensures high
-performance on systems without hardware floating point support).
-
- at section Subtitle Formats
-
- at multitable @columnfractions .4 .1 .1 .1 .1
- at item Name @tab Muxing @tab Demuxing @tab Encoding @tab Decoding
- at item SSA/ASS      @tab X @tab X
- at item DVB          @tab X @tab X @tab X @tab X
- at item DVD          @tab X @tab X @tab X @tab X
- at item PGS          @tab   @tab   @tab   @tab X
- at item XSUB         @tab   @tab   @tab X @tab X
- at end multitable
-
- at code{X} means that the feature is supported.
-
- at section Network Protocols
-
- at multitable @columnfractions .4 .1
- at item Name         @tab Support
- at item file         @tab X
- at item Gopher       @tab X
- at item HTTP         @tab X
- at item pipe         @tab X
- at item RTP          @tab X
- at item TCP          @tab X
- at item UDP          @tab X
- at end multitable
-
- at code{X} means that the protocol is supported.
-
-
- at section Input/Output Devices
-
- at multitable @columnfractions .4 .1 .1
- at item Name              @tab Input  @tab Output
- at item ALSA              @tab X      @tab X
- at item BEOS audio        @tab X      @tab X
- at item BKTR              @tab X      @tab
- at item DV1394            @tab X      @tab
- at item JACK              @tab X      @tab
- at item LIBDC1394         @tab X      @tab
- at item OSS               @tab X      @tab X
- at item Video4Linux       @tab X      @tab
- at item Video4Linux2      @tab X      @tab
- at item VfW capture       @tab X      @tab
- at item X11 grabbing      @tab X      @tab
- at end multitable
-
- at code{X} means that input/output is supported.
-
-
- at chapter Platform Specific information
-
- at section BeOS
-
-BeOS support is broken in mysterious ways.
-
- at section DOS
-
-Using a cross-compiler is preferred for various reasons.
-
- at subsection DJGPP
-
-FFmpeg cannot be compiled because of broken system headers, add
- at code{--extra-cflags=-U__STRICT_ANSI__} to the configure options as a
-workaround.
-
- at section OS/2
-
-For information about compiling FFmpeg on OS/2 see
- at url{http://www.edm2.com/index.php/FFmpeg}.
-
- at section Unix-like
-
-Some parts of FFmpeg cannot be built with version 2.15 of the GNU
-assembler which is still provided by a few AMD64 distributions. To
-make sure your compiler really uses the required version of gas
-after a binutils upgrade, run:
-
- at example
-$(gcc -print-prog-name=as) --version
- at end example
-
-If not, then you should install a different compiler that has no
-hard-coded path to gas. In the worst case pass @code{--disable-asm}
-to configure.
-
- at subsection BSD
-
-BSD make will not build FFmpeg, you need to install and use GNU Make
-(@file{gmake}).
-
- at subsubsection FreeBSD
-
-FreeBSD will not compile out-of-the-box due to broken system headers.
-Passing @code{--extra-cflags=-D__BSD_VISIBLE} to configure will work
-around the problem. This may have unexpected sideeffects, so use it at
-your own risk. If you care about FreeBSD, please make an attempt at
-getting the system headers fixed.
-
- at subsection (Open)Solaris
-
-GNU Make is required to build FFmpeg, so you have to invoke (@file{gmake}),
-standard Solaris Make will not work. When building with a non-c99 front-end
-(gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o}
-or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options
-since the libc is not c99-compliant by default. The probes performed by
-configure may raise an exception leading to the death of configure itself
-due to a bug in the system shell. Simply invoke a different shell such as
-bash directly to work around this:
-
- at example
-bash ./configure
- at end example
-
- at section Windows
-
-To get help and instructions for building FFmpeg under Windows, check out
-the FFmpeg Windows Help Forum at
- at url{http://ffmpeg.arrozcru.org/}.
-
- at subsection Native Windows compilation
-
-FFmpeg can be built to run natively on Windows using the MinGW tools. Install
-the latest versions of MSYS and MinGW from @url{http://www.mingw.org/}.
-You can find detailed installation
-instructions in the download section and the FAQ.
-
-FFmpeg does not build out-of-the-box with the packages the automated MinGW
-installer provides. It also requires coreutils to be installed and many other
-packages updated to the latest version. The minimum version for some packages
-are listed below:
-
- at itemize
- at item bash 3.1
- at item msys-make 3.81-2 (note: not mingw32-make)
- at item w32api 3.13
- at item mingw-runtime 3.15
- at end itemize
-
-FFmpeg automatically passes @code{-fno-common} to the compiler to work around
-a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}).
-
-Within the MSYS shell, configure and make with:
-
- at example
-./configure --enable-memalign-hack
-make
-make install
- at end example
-
-This will install @file{ffmpeg.exe} along with many other development files
-to @file{/usr/local}. You may specify another install path using the
- at code{--prefix} option in @file{configure}.
-
-Notes:
-
- at itemize
-
- at item Building natively using MSYS can be sped up by disabling implicit rules
-in the Makefile by calling @code{make -r} instead of plain @code{make}. This
-speed up is close to non-existent for normal one-off builds and is only
-noticeable when running make for a second time (for example in
- at code{make install}).
-
- at item In order to compile FFplay, you must have the MinGW development library
-of SDL. Get it from @url{http://www.libsdl.org}.
-Edit the @file{bin/sdl-config} script so that it points to the correct prefix
-where SDL was installed. Verify that @file{sdl-config} can be launched from
-the MSYS command line.
-
- at item By using @code{./configure --enable-shared} when configuring FFmpeg,
-you can build libavutil, libavcodec and libavformat as DLLs.
-
- at end itemize
-
- at subsection Microsoft Visual C++ compatibility
-
-As stated in the FAQ, FFmpeg will not compile under MSVC++. However, if you
-want to use the libav* libraries in your own applications, you can still
-compile those applications using MSVC++. But the libav* libraries you link
-to @emph{must} be built with MinGW. However, you will not be able to debug
-inside the libav* libraries, since MSVC++ does not recognize the debug
-symbols generated by GCC.
-We strongly recommend you to move over from MSVC++ to MinGW tools.
-
-This description of how to use the FFmpeg libraries with MSVC++ is based on
-Microsoft Visual C++ 2005 Express Edition. If you have a different version,
-you might have to modify the procedures slightly.
-
- at subsubsection Using static libraries
-
-Assuming you have just built and installed FFmpeg in @file{/usr/local}.
-
- at enumerate
-
- at item Create a new console application ("File / New / Project") and then
-select "Win32 Console Application". On the appropriate page of the
-Application Wizard, uncheck the "Precompiled headers" option.
-
- at item Write the source code for your application, or, for testing, just
-copy the code from an existing sample application into the source file
-that MSVC++ has already created for you. For example, you can copy
- at file{libavformat/output-example.c} from the FFmpeg distribution.
-
- at item Open the "Project / Properties" dialog box. In the "Configuration"
-combo box, select "All Configurations" so that the changes you make will
-affect both debug and release builds. In the tree view on the left hand
-side, select "C/C++ / General", then edit the "Additional Include
-Directories" setting to contain the path where the FFmpeg includes were
-installed (i.e. @file{c:\msys\1.0\local\include}).
-Do not add MinGW's include directory here, or the include files will
-conflict with MSVC's.
-
- at item Still in the "Project / Properties" dialog box, select
-"Linker / General" from the tree view and edit the
-"Additional Library Directories" setting to contain the @file{lib}
-directory where FFmpeg was installed (i.e. @file{c:\msys\1.0\local\lib}),
-the directory where MinGW libs are installed (i.e. @file{c:\mingw\lib}),
-and the directory where MinGW's GCC libs are installed
-(i.e. @file{C:\mingw\lib\gcc\mingw32\4.2.1-sjlj}). Then select
-"Linker / Input" from the tree view, and add the files @file{libavformat.a},
- at file{libavcodec.a}, @file{libavutil.a}, @file{libmingwex.a},
- at file{libgcc.a}, and any other libraries you used (i.e. @file{libz.a})
-to the end of "Additional Dependencies".
-
- at item Now, select "C/C++ / Code Generation" from the tree view. Select
-"Debug" in the "Configuration" combo box. Make sure that "Runtime
-Library" is set to "Multi-threaded Debug DLL". Then, select "Release" in
-the "Configuration" combo box and make sure that "Runtime Library" is
-set to "Multi-threaded DLL".
-
- at item Click "OK" to close the "Project / Properties" dialog box.
-
- at item MSVC++ lacks some C99 header files that are fundamental for FFmpeg.
-Get msinttypes from @url{http://code.google.com/p/msinttypes/downloads/list}
-and install it in MSVC++'s include directory
-(i.e. @file{C:\Program Files\Microsoft Visual Studio 8\VC\include}).
-
- at item MSVC++ also does not understand the @code{inline} keyword used by
-FFmpeg, so you must add this line before @code{#include}ing libav*:
- at example
-#define inline _inline
- at end example
-
- at item Build your application, everything should work.
-
- at end enumerate
-
- at subsubsection Using shared libraries
-
-This is how to create DLL and LIB files that are compatible with MSVC++:
-
- at enumerate
-
- at item Add a call to @file{vcvars32.bat} (which sets up the environment
-variables for the Visual C++ tools) as the first line of @file{msys.bat}.
-The standard location for @file{vcvars32.bat} is
- at file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat},
-and the standard location for @file{msys.bat} is @file{C:\msys\1.0\msys.bat}.
-If this corresponds to your setup, add the following line as the first line
-of @file{msys.bat}:
-
- at example
-call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
- at end example
-
-Alternatively, you may start the @file{Visual Studio 2005 Command Prompt},
-and run @file{c:\msys\1.0\msys.bat} from there.
-
- at item Within the MSYS shell, run @code{lib.exe}. If you get a help message
-from @file{Microsoft (R) Library Manager}, this means your environment
-variables are set up correctly, the @file{Microsoft (R) Library Manager}
-is on the path and will be used by FFmpeg to create
-MSVC++-compatible import libraries.
-
- at item Build FFmpeg with
-
- at example
-./configure --enable-shared --enable-memalign-hack
-make
-make install
- at end example
-
-Your install path (@file{/usr/local/} by default) should now have the
-necessary DLL and LIB files under the @file{bin} directory.
-
- at end enumerate
-
-To use those files with MSVC++, do the same as you would do with
-the static libraries, as described above. But in Step 4,
-you should only need to add the directory where the LIB files are installed
-(i.e. @file{c:\msys\usr\local\bin}). This is not a typo, the LIB files are
-installed in the @file{bin} directory. And instead of adding @file{libxx.a}
-files, you should add @file{avcodec.lib}, @file{avformat.lib}, and
- at file{avutil.lib}. There should be no need for @file{libmingwex.a},
- at file{libgcc.a}, and @file{wsock32.lib}, nor any other external library
-statically linked into the DLLs. The @file{bin} directory contains a bunch
-of DLL files, but the ones that are actually used to run your application
-are the ones with a major version number in their filenames
-(i.e. @file{avcodec-51.dll}).
-
- at subsection Cross compilation for Windows with Linux
-
-You must use the MinGW cross compilation tools available at
- at url{http://www.mingw.org/}.
-
-Then configure FFmpeg with the following options:
- at example
-./configure --target-os=mingw32 --cross-prefix=i386-mingw32msvc-
- at end example
-(you can change the cross-prefix according to the prefix chosen for the
-MinGW tools).
-
-Then you can easily test FFmpeg with Wine
-(@url{http://www.winehq.com/}).
-
- at subsection Compilation under Cygwin
-
-Please use Cygwin 1.7.x as the obsolete 1.5.x Cygwin versions lack
-llrint() in its C library.
-
-Install your Cygwin with all the "Base" packages, plus the
-following "Devel" ones:
- at example
-binutils, gcc4-core, make, subversion, mingw-runtime, texi2html
- at end example
-
-And the following "Utils" one:
- at example
-diffutils
- at end example
-
-Then run
-
- at example
-./configure --enable-static --disable-shared
- at end example
-
-to make a static build.
-
-The current @code{gcc4-core} package is buggy and needs this flag to build
-shared libraries:
-
- at example
-./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions
- at end example
-
-If you want to build FFmpeg with additional libraries, download Cygwin
-"Devel" packages for Ogg and Vorbis from any Cygwin packages repository:
- at example
-libogg-devel, libvorbis-devel
- at end example
-
-These library packages are only available from Cygwin Ports
-(@url{http://sourceware.org/cygwinports/}) :
-
- at example
-yasm, libSDL-devel, libdirac-devel, libfaac-devel, libfaad-devel, libgsm-devel,
-libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel,
-libxvidcore-devel
- at end example
-
-The recommendation for libnut and x264 is to build them from source by
-yourself, as they evolve too quickly for Cygwin Ports to be up to date.
-
-Cygwin 1.7.x has IPv6 support. You can add IPv6 to Cygwin 1.5.x by means
-of the @code{libgetaddrinfo-devel} package, available at Cygwin Ports.
-
- at subsection Crosscompilation for Windows under Cygwin
-
-With Cygwin you can create Windows binaries that do not need the cygwin1.dll.
-
-Just install your Cygwin as explained before, plus these additional
-"Devel" packages:
- at example
-gcc-mingw-core, mingw-runtime, mingw-zlib
- at end example
-
-and add some special flags to your configure invocation.
-
-For a static build run
- at example
-./configure --target-os=mingw32 --enable-memalign-hack --enable-static --disable-shared --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
- at end example
-
-and for a build with shared libraries
- at example
-./configure --target-os=mingw32 --enable-memalign-hack --enable-shared --disable-static --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
- at end example
-
- at bye
diff --git a/doc/issue_tracker.txt b/doc/issue_tracker.txt
deleted file mode 100644
index e5a74db..0000000
--- a/doc/issue_tracker.txt
+++ /dev/null
@@ -1,228 +0,0 @@
-FFmpeg's bug/patch/feature request tracker manual
-=================================================
-
-NOTE: This is a draft.
-
-Overview:
----------
-FFmpeg uses Roundup for tracking issues, new issues and changes to
-existing issues can be done through a web interface and through email.
-It is possible to subscribe to individual issues by adding yourself to the
-nosy list or to subscribe to the ffmpeg-issues mailing list which receives
-a mail for every change to every issue. Replies to such mails will also
-be properly added to the respective issue.
-(the above does all work already after light testing)
-The subscription URL for the ffmpeg-issues list is:
-http://live.polito/mailman/listinfo/ffmpeg-issues
-The URL of the webinterface of the tracker is:
-http(s)://roundup.ffmpeg/roundup/ffmpeg/
-Note the URLs in this document are obfuscated, you must append the top level
-domain for non-profit organizations to the tracker, and of Italy to the
-mailing list.
-
-Email Interface:
-----------------
-There is a mailing list to which all new issues and changes to existing issues
-are sent. You can subscribe through
-http://live.polito/mailman/listinfo/ffmpeg-issues
-Replies to messages there will have their text added to the specific issues.
-Attachments will be added as if they had been uploaded via the web interface.
-You can change the status, substatus, topic, ... by changing the subject in
-your reply like:
-Re: [issue94] register_avcodec and allcodecs.h [type=patch;status=open;substatus=approved]
-Roundup will then change things as you requested and remove the [...] from
-the subject before forwarding the mail to the mailing list.
-
-
-NOTE: issue = (bug report || patch || feature request)
-
-Type:
------
-bug
-    An error, flaw, mistake, failure, or fault in FFmpeg or libav* that
-    prevents it from behaving as intended.
-
-feature request
-    Request of support for encoding or decoding of a new codec, container
-    or variant.
-    Request of support for more, less or plain different output or behavior
-    where the current implementation cannot be considered wrong.
-
-patch
-    A patch as generated by diff which conforms to the patch submission and
-    development policy.
-
-
-Priority:
----------
-critical
-    Bugs and patches which deal with data loss and security issues.
-    No feature request can be critical.
-
-important
-    Bugs which make FFmpeg unusable for a significant number of users, and
-    patches fixing them.
-    Examples here might be completely broken MPEG-4 decoding or a build issue
-    on Linux.
-    While broken 4xm decoding or a broken OS/2 build would not be important,
-    the separation to normal is somewhat fuzzy.
-    For feature requests this priority would be used for things many people
-    want.
-
-normal
-
-
-minor
-    Bugs and patches about things like spelling errors, "mp2" instead of
-    "mp3" being shown and such.
-    Feature requests about things few people want or which do not make a big
-    difference.
-
-wish
-    Something that is desirable to have but that there is no urgency at
-    all to implement, e.g. something completely cosmetic like a website
-    restyle or a personalized doxy template or the FFmpeg logo.
-    This priority is not valid for bugs.
-
-
-Status:
--------
-new
-    initial state
-
-open
-    intermediate states
-
-closed
-    final state
-
-
-Type/Status/Substatus:
-----------
-*/new/new
-    Initial state of new bugs, patches and feature requests submitted by
-    users.
-
-*/open/open
-    Issues which have been briefly looked at and which did not look outright
-    invalid.
-    This implicates that no real more detailed state applies yet. Conversely,
-    the more detailed states below implicate that the issue has been briefly
-    looked at.
-
-*/closed/duplicate
-    Bugs, patches or feature requests which are duplicates.
-    Note that patches dealing with the same thing in a different way are not
-    duplicates.
-    Note, if you mark something as duplicate, do not forget setting the
-    superseder so bug reports are properly linked.
-
-*/closed/invalid
-    Bugs caused by user errors, random ineligible or otherwise nonsense stuff.
-
-*/closed/needs_more_info
-    Issues for which some information has been requested by the developers,
-    but which has not been provided by anyone within reasonable time.
-
-bug/open/reproduced
-    Bugs which have been reproduced.
-
-bug/open/analyzed
-    Bugs which have been analyzed and where it is understood what causes them
-    and which exact chain of events triggers them. This analysis should be
-    available as a message in the bug report.
-    Note, do not change the status to analyzed without also providing a clear
-    and understandable analysis.
-    This state implicates that the bug either has been reproduced or that
-    reproduction is not needed as the bug is already understood.
-
-bug/open/needs_more_info
-    Bug reports which are incomplete and or where more information is needed
-    from the submitter or another person who can provide it.
-    This state implicates that the bug has not been analyzed or reproduced.
-    Note, the idea behind needs_more_info is to offload work from the
-    developers to the users whenever possible.
-
-bug/closed/fixed
-    Bugs which have to the best of our knowledge been fixed.
-
-bug/closed/wont_fix
-    Bugs which we will not fix. Possible reasons include legality, high
-    complexity for the sake of supporting obscure corner cases, speed loss
-    for similarly esoteric purposes, et cetera.
-    This also means that we would reject a patch.
-    If we are just too lazy to fix a bug then the correct state is open
-    and unassigned. Closed means that the case is closed which is not
-    the case if we are just waiting for a patch.
-
-bug/closed/works_for_me
-    Bugs for which sufficient information was provided to reproduce but
-    reproduction failed - that is the code seems to work correctly to the
-    best of our knowledge.
-
-patch/open/approved
-    Patches which have been reviewed and approved by a developer.
-    Such patches can be applied anytime by any other developer after some
-    reasonable testing (compile + regression tests + does the patch do
-    what the author claimed).
-
-patch/open/needs_changes
-    Patches which have been reviewed and need changes to be accepted.
-
-patch/closed/applied
-    Patches which have been applied.
-
-patch/closed/rejected
-    Patches which have been rejected.
-
-feature_request/open/needs_more_info
-    Feature requests where it is not clear what exactly is wanted
-    (these also could be closed as invalid ...).
-
-feature_request/closed/implemented
-    Feature requests which have been implemented.
-
-feature_request/closed/wont_implement
-    Feature requests which will not be implemented. The reasons here could
-    be legal, philosophical or others.
-
-Note, please do not use type-status-substatus combinations other than the
-above without asking on ffmpeg-dev first!
-
-Note2, if you provide the requested info do not forget to remove the
-needs_more_info substate.
-
-Topic:
-------
-A topic is a tag you should add to your issue in order to make grouping them
-easier.
-
-avcodec
-    issues in libavcodec/*
-
-avformat
-    issues in libavformat/*
-
-avutil
-    issues in libavutil/*
-
-regression test
-    issues in tests/*
-
-ffmpeg
-    issues in or related to ffmpeg.c
-
-ffplay
-    issues in or related to ffplay.c
-
-ffserver
-    issues in or related to ffserver.c
-
-build system
-    issues in or related to configure/Makefile
-
-regression
-    bugs which were working in a past revision
-
-roundup
-    issues related to our issue tracker
diff --git a/doc/libavfilter.texi b/doc/libavfilter.texi
deleted file mode 100644
index 20ef445..0000000
--- a/doc/libavfilter.texi
+++ /dev/null
@@ -1,307 +0,0 @@
-\input texinfo @c -*- texinfo -*-
-
- at settitle Libavfilter Documentation
- at titlepage
- at sp 7
- at center @titlefont{Libavfilter Documentation}
- at sp 3
- at end titlepage
-
-
- at chapter Introduction
-
-Libavfilter is the filtering API of FFmpeg. It is the substitute of the
-now deprecated 'vhooks' and started as a Google Summer of Code project.
-
-Integrating libavfilter into the main FFmpeg repository is a work in
-progress. If you wish to try the unfinished development code of
-libavfilter then check it out from the libavfilter repository into
-some directory of your choice by:
-
- at example
-   svn checkout svn://svn.ffmpeg.org/soc/libavfilter
- at end example
-
-And then read the README file in the top directory to learn how to
-integrate it into ffmpeg and ffplay.
-
-But note that there may still be serious bugs in the code and its API
-and ABI should not be considered stable yet!
-
- at chapter Tutorial
-
-In libavfilter, it is possible for filters to have multiple inputs and
-multiple outputs.
-To illustrate the sorts of things that are possible, we can
-use a complex filter graph. For example, the following one:
-
- at example
-input --> split --> fifo -----------------------> overlay --> output
-            |                                        ^
-            |                                        |
-            +------> fifo --> crop --> vflip --------+
- at end example
-
-splits the stream in two streams, sends one stream through the crop filter
-and the vflip filter before merging it back with the other stream by
-overlaying it on top. You can use the following command to achieve this:
-
- at example
-./ffmpeg -i in.avi -s 240x320 -vfilters "[in] split [T1], fifo, [T2] overlay= 0:240 [out]; [T1] fifo, crop=0:0:-1:240, vflip [T2]
- at end example
-
-where input_video.avi has a vertical resolution of 480 pixels. The
-result will be that in output the top half of the video is mirrored
-onto the bottom half.
-
-Video filters are loaded using the @var{-vfilters} option passed to
-ffmpeg or to ffplay. Filters in the same linear chain are separated by
-commas. In our example, @var{split, fifo, overlay} are in one linear
-chain, and @var{fifo, crop, vflip} are in another. The points where
-the linear chains join are labeled by names enclosed in square
-brackets. In our example, that is @var{[T1]} and @var{[T2]}. The magic
-labels @var{[in]} and @var{[out]} are the points where video is input
-and output.
-
-Some filters take in input a list of parameters: they are specified
-after the filter name and an equal sign, and are separated each other
-by a semicolon.
-
-There exist so-called @var{source filters} that do not have a video
-input, and we expect in the future some @var{sink filters} that will
-not have video output.
-
- at chapter graph2dot
-
-The @file{graph2dot} program included in the FFmpeg @file{tools}
-directory can be used to parse a filter graph description and issue a
-corresponding textual representation in the dot language.
-
-Invoke the command:
- at example
-graph2dot -h
- at end example
-
-to see how to use @file{graph2dot}.
-
-You can then pass the dot description to the @file{dot} program (from
-the graphviz suite of programs) and obtain a graphical representation
-of the filter graph.
-
-For example the sequence of commands:
- at example
-echo @var{GRAPH_DESCRIPTION} | \
-tools/graph2dot -o graph.tmp && \
-dot -Tpng graph.tmp -o graph.png && \
-display graph.png
- at end example
-
-can be used to create and display an image representing the graph
-described by the @var{GRAPH_DESCRIPTION} string.
-
- at chapter Available video filters
-
-When you configure your FFmpeg build, you can disable any of the
-existing video filters.
-The configure output will show the video filters included in your
-build.
-
-Below is a description of the currently available video filters.
-
- at section crop
-
-Crop the input video to @var{x}:@var{y}:@var{width}:@var{height}.
-
- at example
-./ffmpeg -i in.avi -vfilters "crop=0:0:0:240" out.avi
- at end example
-
- at var{x} and @var{y} specify the position of the top-left corner of the
-output (non-cropped) area.
-
-The default value of @var{x} and @var{y} is 0.
-
-The @var{width} and @var{height} parameters specify the width and height
-of the output (non-cropped) area.
-
-A value of 0 is interpreted as the maximum possible size contained in
-the area delimited by the top-left corner at position x:y.
-
-For example the parameters:
-
- at example
-"crop=100:100:0:0"
- at end example
-
-will delimit the rectangle with the top-left corner placed at position
-100:100 and the right-bottom corner corresponding to the right-bottom
-corner of the input image.
-
-The default value of @var{width} and @var{height} is 0.
-
- at section format
-
-Convert the input video to one of the specified pixel formats.
-Libavfilter will try to pick one that is supported for the input to
-the next filter.
-
-The filter accepts a list of pixel format names, separated by ``:'',
-for example ``yuv420p:monow:rgb24''.
-
-The following command:
-
- at example
-./ffmpeg -i in.avi -vfilters "format=yuv420p" out.avi
- at end example
-
-will convert the input video to the format ``yuv420p''.
-
- at section noformat
-
-Force libavfilter not to use any of the specified pixel formats for the
-input to the next filter.
-
-The filter accepts a list of pixel format names, separated by ``:'',
-for example ``yuv420p:monow:rgb24''.
-
-The following command:
-
- at example
-./ffmpeg -i in.avi -vfilters "noformat=yuv420p, vflip" out.avi
- at end example
-
-will make libavfilter use a format different from ``yuv420p'' for the
-input to the vflip filter.
-
- at section null
-
-Pass the source unchanged to the output.
-
- at section scale
-
-Scale the input video to @var{width}:@var{height} and/or convert the image format.
-
-For example the command:
-
- at example
-./ffmpeg -i in.avi -vfilters "scale=200:100" out.avi
- at end example
-
-will scale the input video to a size of 200x100.
-
-If the input image format is different from the format requested by
-the next filter, the scale filter will convert the input to the
-requested format.
-
-If the value for @var{width} or @var{height} is 0, the respective input
-size is used for the output.
-
-If the value for @var{width} or @var{height} is -1, the scale filter will
-use, for the respective output size, a value that maintains the aspect
-ratio of the input image.
-
-The default value of @var{width} and @var{height} is 0.
-
- at section slicify
-
-Pass the images of input video on to next video filter as multiple
-slices.
-
- at example
-./ffmpeg -i in.avi -vfilters "slicify=32" out.avi
- at end example
-
-The filter accepts the slice height as parameter. If the parameter is
-not specified it will use the default value of 16.
-
-Adding this in the beginning of filter chains should make filtering
-faster due to better use of the memory cache.
-
- at section unsharp
-
-Sharpen or blur the input video. It accepts the following parameters:
-
- at multitable @columnfractions .2 .5 .1 .1 .1
- at headitem Name @tab Description @tab Min @tab Max @tab Default
- at item @var{luma_msize_x}
- at tab Luma matrix horizontal size
- at tab 3
- at tab 13
- at tab 5
- at item @var{luma_msize_y}
- at tab Luma matrix vertical size
- at tab 3
- at tab 13
- at tab 5
- at item @var{luma_amount}
- at tab Luma effect strength
- at tab -2.0
- at tab 5.0
- at tab 1.0
- at item @var{chroma_msize_x}
- at tab Chroma matrix horizontal size
- at tab 3
- at tab 13
- at tab 0
- at item @var{chroma_msize_y}
- at tab Chroma matrix vertical size
- at tab 3
- at tab 13
- at tab 0
- at item @var{chroma_amount}
- at tab Chroma effect strength
- at tab -2.0
- at tab 5.0
- at tab 0.0
- at end multitable
-
-Negative values for the amount will blur the input video, while positive
-values will sharpen. All parameters are optional and default to the
-equivalent of the string '5:5:1.0:0:0:0.0'.
-
- at example
-# Strong luma sharpen effect parameters
-unsharp=7:7:2.5
-
-# Strong blur of both luma and chroma parameters
-unsharp=7:7:-2:7:7:-2
-
-# Use the default values with @command{ffmpeg}
-./ffmpeg -i in.avi -vfilters "unsharp" out.mp4
- at end example
-
- at section vflip
-
-Flip the input video vertically.
-
- at example
-./ffmpeg -i in.avi -vfilters "vflip" out.avi
- at end example
-
- at chapter Available video sources
-
-Below is a description of the currently available video sources.
-
- at section nullsrc
-
-Null video source, never return images. It is mainly useful as a
-template and to be employed in analysis / debugging tools.
-
-It accepts as optional parameter a string of the form
- at var{width}:@var{height}, where @var{width} and @var{height} specify the size of
-the configured source.
-
-The default values of @var{width} and @var{height} are respectively 352
-and 288 (corresponding to the CIF size format).
-
- at chapter Available video sinks
-
-Below is a description of the currently available video sinks.
-
- at section nullsink
-
-Null video sink, do absolutely nothing with the input video. It is
-mainly useful as a template and to be employed in analysis / debugging
-tools.
-
- at bye
diff --git a/doc/optimization.txt b/doc/optimization.txt
deleted file mode 100644
index 5469adc..0000000
--- a/doc/optimization.txt
+++ /dev/null
@@ -1,235 +0,0 @@
-optimization Tips (for libavcodec):
-===================================
-
-What to optimize:
------------------
-If you plan to do non-x86 architecture specific optimizations (SIMD normally),
-then take a look in the x86/ directory, as most important functions are
-already optimized for MMX.
-
-If you want to do x86 optimizations then you can either try to finetune the
-stuff in the x86 directory or find some other functions in the C source to
-optimize, but there aren't many left.
-
-
-Understanding these overoptimized functions:
---------------------------------------------
-As many functions tend to be a bit difficult to understand because
-of optimizations, it can be hard to optimize them further, or write
-architecture-specific versions. It is recommended to look at older
-revisions of the interesting files (for a web frontend try ViewVC at
-http://svn.ffmpeg.org/ffmpeg/trunk/).
-Alternatively, look into the other architecture-specific versions in
-the x86/, ppc/, alpha/ subdirectories. Even if you don't exactly
-comprehend the instructions, it could help understanding the functions
-and how they can be optimized.
-
-NOTE: If you still don't understand some function, ask at our mailing list!!!
-(http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel)
-
-
-When is an optimization justified?
-----------------------------------
-Normally, clean and simple optimizations for widely used codecs are
-justified even if they only achieve an overall speedup of 0.1%. These
-speedups accumulate and can make a big difference after awhile. Also, if
-none of the following factors get worse due to an optimization -- speed,
-binary code size, source size, source readability -- and at least one
-factor improves, then an optimization is always a good idea even if the
-overall gain is less than 0.1%. For obscure codecs that are not often
-used, the goal is more toward keeping the code clean, small, and
-readable instead of making it 1% faster.
-
-
-WTF is that function good for ....:
------------------------------------
-The primary purpose of this list is to avoid wasting time optimizing functions
-which are rarely used.
-
-put(_no_rnd)_pixels{,_x2,_y2,_xy2}
-    Used in motion compensation (en/decoding).
-
-avg_pixels{,_x2,_y2,_xy2}
-    Used in motion compensation of B-frames.
-    These are less important than the put*pixels functions.
-
-avg_no_rnd_pixels*
-    unused
-
-pix_abs16x16{,_x2,_y2,_xy2}
-    Used in motion estimation (encoding) with SAD.
-
-pix_abs8x8{,_x2,_y2,_xy2}
-    Used in motion estimation (encoding) with SAD of MPEG-4 4MV only.
-    These are less important than the pix_abs16x16* functions.
-
-put_mspel8_mc* / wmv2_mspel8*
-    Used only in WMV2.
-    it is not recommended that you waste your time with these, as WMV2
-    is an ugly and relatively useless codec.
-
-mpeg4_qpel* / *qpel_mc*
-    Used in MPEG-4 qpel motion compensation (encoding & decoding).
-    The qpel8 functions are used only for 4mv,
-    the avg_* functions are used only for B-frames.
-    Optimizing them should have a significant impact on qpel
-    encoding & decoding.
-
-qpel{8,16}_mc??_old_c / *pixels{8,16}_l4
-    Just used to work around a bug in an old libavcodec encoder version.
-    Don't optimize them.
-
-tpel_mc_func {put,avg}_tpel_pixels_tab
-    Used only for SVQ3, so only optimize them if you need fast SVQ3 decoding.
-
-add_bytes/diff_bytes
-    For huffyuv only, optimize if you want a faster ffhuffyuv codec.
-
-get_pixels / diff_pixels
-    Used for encoding, easy.
-
-clear_blocks
-    easiest to optimize
-
-gmc
-    Used for MPEG-4 gmc.
-    Optimizing this should have a significant effect on the gmc decoding
-    speed.
-
-gmc1
-    Used for chroma blocks in MPEG-4 gmc with 1 warp point
-    (there are 4 luma & 2 chroma blocks per macroblock, so
-    only 1/3 of the gmc blocks use this, the other 2/3
-    use the normal put_pixel* code, but only if there is
-    just 1 warp point).
-    Note: DivX5 gmc always uses just 1 warp point.
-
-pix_sum
-    Used for encoding.
-
-hadamard8_diff / sse / sad == pix_norm1 / dct_sad / quant_psnr / rd / bit
-    Specific compare functions used in encoding, it depends upon the
-    command line switches which of these are used.
-    Don't waste your time with dct_sad & quant_psnr, they aren't
-    really useful.
-
-put_pixels_clamped / add_pixels_clamped
-    Used for en/decoding in the IDCT, easy.
-    Note, some optimized IDCTs have the add/put clamped code included and
-    then put_pixels_clamped / add_pixels_clamped will be unused.
-
-idct/fdct
-    idct (encoding & decoding)
-    fdct (encoding)
-    difficult to optimize
-
-dct_quantize_trellis
-    Used for encoding with trellis quantization.
-    difficult to optimize
-
-dct_quantize
-    Used for encoding.
-
-dct_unquantize_mpeg1
-    Used in MPEG-1 en/decoding.
-
-dct_unquantize_mpeg2
-    Used in MPEG-2 en/decoding.
-
-dct_unquantize_h263
-    Used in MPEG-4/H.263 en/decoding.
-
-FIXME remaining functions?
-BTW, most of these functions are in dsputil.c/.h, some are in mpegvideo.c/.h.
-
-
-
-Alignment:
-Some instructions on some architectures have strict alignment restrictions,
-for example most SSE/SSE2 instructions on x86.
-The minimum guaranteed alignment is written in the .h files, for example:
-    void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, UINT8 *pixels/*align 8*/, int line_size);
-
-
-General Tips:
--------------
-Use asm loops like:
-__asm__(
-    "1: ....
-    ...
-    "jump_instruciton ....
-Do not use C loops:
-do{
-    __asm__(
-        ...
-}while()
-
-Use __asm__() instead of intrinsics. The latter requires a good optimizing compiler
-which gcc is not.
-
-
-Links:
-======
-http://www.aggregate.org/MAGIC/
-
-x86-specific:
--------------
-http://developer.intel.com/design/pentium4/manuals/248966.htm
-
-The IA-32 Intel Architecture Software Developer's Manual, Volume 2:
-Instruction Set Reference
-http://developer.intel.com/design/pentium4/manuals/245471.htm
-
-http://www.agner.org/assem/
-
-AMD Athlon Processor x86 Code Optimization Guide:
-http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/22007.pdf
-
-
-ARM-specific:
--------------
-ARM Architecture Reference Manual (up to ARMv5TE):
-http://www.arm.com/community/university/eulaarmarm.html
-
-Procedure Call Standard for the ARM Architecture:
-http://www.arm.com/pdfs/aapcs.pdf
-
-Optimization guide for ARM9E (used in Nokia 770 Internet Tablet):
-http://infocenter.arm.com/help/topic/com.arm.doc.ddi0240b/DDI0240A.pdf
-Optimization guide for ARM11 (used in Nokia N800 Internet Tablet):
-http://infocenter.arm.com/help/topic/com.arm.doc.ddi0211j/DDI0211J_arm1136_r1p5_trm.pdf
-Optimization guide for Intel XScale (used in Sharp Zaurus PDA):
-http://download.intel.com/design/intelxscale/27347302.pdf
-Intel Wireless MMX2 Coprocessor: Programmers Reference Manual
-http://download.intel.com/design/intelxscale/31451001.pdf
-
-PowerPC-specific:
------------------
-PowerPC32/AltiVec PIM:
-www.freescale.com/files/32bit/doc/ref_manual/ALTIVECPEM.pdf
-
-PowerPC32/AltiVec PEM:
-www.freescale.com/files/32bit/doc/ref_manual/ALTIVECPIM.pdf
-
-CELL/SPU:
-http://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/30B3520C93F437AB87257060006FFE5E/$file/Language_Extensions_for_CBEA_2.4.pdf
-http://www-01.ibm.com/chips/techlib/techlib.nsf/techdocs/9F820A5FFA3ECE8C8725716A0062585F/$file/CBE_Handbook_v1.1_24APR2007_pub.pdf
-
-SPARC-specific:
----------------
-SPARC Joint Programming Specification (JPS1): Commonality
-http://www.fujitsu.com/downloads/PRMPWR/JPS1-R1.0.4-Common-pub.pdf
-
-UltraSPARC III Processor User's Manual (contains instruction timings)
-http://www.sun.com/processors/manuals/USIIIv2.pdf
-
-VIS Whitepaper (contains optimization guidelines)
-http://www.sun.com/processors/vis/download/vis/vis_whitepaper.pdf
-
-GCC asm links:
---------------
-official doc but quite ugly
-http://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
-
-a bit old (note "+" is valid for input-output, even though the next disagrees)
-http://www.cs.virginia.edu/~clc5q/gcc-inline-asm.pdf
diff --git a/doc/rate_distortion.txt b/doc/rate_distortion.txt
deleted file mode 100644
index a7d2c87..0000000
--- a/doc/rate_distortion.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-A Quick Description Of Rate Distortion Theory.
-
-We want to encode a video, picture or piece of music optimally. What does
-"optimally" really mean? It means that we want to get the best quality at a
-given filesize OR we want to get the smallest filesize at a given quality
-(in practice, these 2 goals are usually the same).
-
-Solving this directly is not practical; trying all byte sequences 1
-megabyte in length and selecting the "best looking" sequence will yield
-256^1000000 cases to try.
-
-But first, a word about quality, which is also called distortion.
-Distortion can be quantified by almost any quality measurement one chooses.
-Commonly, the sum of squared differences is used but more complex methods
-that consider psychovisual effects can be used as well. It makes no
-difference in this discussion.
-
-
-First step: that rate distortion factor called lambda...
-Let's consider the problem of minimizing:
-
-  distortion + lambda*rate
-
-rate is the filesize
-distortion is the quality
-lambda is a fixed value choosen as a tradeoff between quality and filesize
-Is this equivalent to finding the best quality for a given max
-filesize? The answer is yes. For each filesize limit there is some lambda
-factor for which minimizing above will get you the best quality (using your
-chosen quality measurement) at the desired (or lower) filesize.
-
-
-Second step: splitting the problem.
-Directly splitting the problem of finding the best quality at a given
-filesize is hard because we do not know how many bits from the total
-filesize should be allocated to each of the subproblems. But the formula
-from above:
-
-  distortion + lambda*rate
-
-can be trivially split. Consider:
-
-  (distortion0 + distortion1) + lambda*(rate0 + rate1)
-
-This creates a problem made of 2 independent subproblems. The subproblems
-might be 2 16x16 macroblocks in a frame of 32x16 size. To minimize:
-
-  (distortion0 + distortion1) + lambda*(rate0 + rate1)
-
-we just have to minimize:
-
-  distortion0 + lambda*rate0
-
-and
-
-  distortion1 + lambda*rate1
-
-I.e, the 2 problems can be solved independently.
-
-Author: Michael Niedermayer
-Copyright: LGPL
diff --git a/doc/snow.txt b/doc/snow.txt
deleted file mode 100644
index f991339..0000000
--- a/doc/snow.txt
+++ /dev/null
@@ -1,630 +0,0 @@
-=============================================
-Snow Video Codec Specification Draft 20080110
-=============================================
-
-Introduction:
-=============
-This specification describes the Snow bitstream syntax and semantics as
-well as the formal Snow decoding process.
-
-The decoding process is described precisely and any compliant decoder
-MUST produce the exact same output for a spec-conformant Snow stream.
-For encoding, though, any process which generates a stream compliant to
-the syntactical and semantic requirements and which is decodable by
-the process described in this spec shall be considered a conformant
-Snow encoder.
-
-Definitions:
-============
-
-MUST    the specific part must be done to conform to this standard
-SHOULD  it is recommended to be done that way, but not strictly required
-
-ilog2(x) is the rounded down logarithm of x with basis 2
-ilog2(0) = 0
-
-Type definitions:
-=================
-
-b   1-bit range coded
-u   unsigned scalar value range coded
-s   signed scalar value range coded
-
-
-Bitstream syntax:
-=================
-
-frame:
-    header
-    prediction
-    residual
-
-header:
-    keyframe                            b   MID_STATE
-    if(keyframe || always_reset)
-        reset_contexts
-    if(keyframe){
-        version                         u   header_state
-        always_reset                    b   header_state
-        temporal_decomposition_type     u   header_state
-        temporal_decomposition_count    u   header_state
-        spatial_decomposition_count     u   header_state
-        colorspace_type                 u   header_state
-        chroma_h_shift                  u   header_state
-        chroma_v_shift                  u   header_state
-        spatial_scalability             b   header_state
-        max_ref_frames-1                u   header_state
-        qlogs
-    }
-    if(!keyframe){
-        update_mc                       b   header_state
-        if(update_mc){
-            for(plane=0; plane<2; plane++){
-                diag_mc                 b   header_state
-                htaps/2-1               u   header_state
-                for(i= p->htaps/2; i; i--)
-                    |hcoeff[i]|         u   header_state
-            }
-        }
-        update_qlogs                    b   header_state
-        if(update_qlogs){
-            spatial_decomposition_count u   header_state
-            qlogs
-        }
-    }
-
-    spatial_decomposition_type          s   header_state
-    qlog                                s   header_state
-    mv_scale                            s   header_state
-    qbias                               s   header_state
-    block_max_depth                     s   header_state
-
-qlogs:
-    for(plane=0; plane<2; plane++){
-        quant_table[plane][0][0]        s   header_state
-        for(level=0; level < spatial_decomposition_count; level++){
-            quant_table[plane][level][1]s   header_state
-            quant_table[plane][level][3]s   header_state
-        }
-    }
-
-reset_contexts
-    *_state[*]= MID_STATE
-
-prediction:
-    for(y=0; y<block_count_vertical; y++)
-        for(x=0; x<block_count_horizontal; x++)
-            block(0)
-
-block(level):
-    mvx_diff=mvy_diff=y_diff=cb_diff=cr_diff=0
-    if(keyframe){
-        intra=1
-    }else{
-        if(level!=max_block_depth){
-            s_context= 2*left->level + 2*top->level + topleft->level + topright->level
-            leaf                        b   block_state[4 + s_context]
-        }
-        if(level==max_block_depth || leaf){
-            intra                       b   block_state[1 + left->intra + top->intra]
-            if(intra){
-                y_diff                  s   block_state[32]
-                cb_diff                 s   block_state[64]
-                cr_diff                 s   block_state[96]
-            }else{
-                ref_context= ilog2(2*left->ref) + ilog2(2*top->ref)
-                if(ref_frames > 1)
-                    ref                 u   block_state[128 + 1024 + 32*ref_context]
-                mx_context= ilog2(2*abs(left->mx - top->mx))
-                my_context= ilog2(2*abs(left->my - top->my))
-                mvx_diff                s   block_state[128 + 32*(mx_context + 16*!!ref)]
-                mvy_diff                s   block_state[128 + 32*(my_context + 16*!!ref)]
-            }
-        }else{
-            block(level+1)
-            block(level+1)
-            block(level+1)
-            block(level+1)
-        }
-    }
-
-
-residual:
-    residual2(luma)
-    residual2(chroma_cr)
-    residual2(chroma_cb)
-
-residual2:
-    for(level=0; level<spatial_decomposition_count; level++){
-        if(level==0)
-            subband(LL, 0)
-        subband(HL, level)
-        subband(LH, level)
-        subband(HH, level)
-    }
-
-subband:
-    FIXME
-
-
-
-Tag description:
-----------------
-
-version
-    0
-    this MUST NOT change within a bitstream
-
-always_reset
-    if 1 then the range coder contexts will be reset after each frame
-
-temporal_decomposition_type
-    0
-
-temporal_decomposition_count
-    0
-
-spatial_decomposition_count
-    FIXME
-
-colorspace_type
-    0
-    this MUST NOT change within a bitstream
-
-chroma_h_shift
-    log2(luma.width / chroma.width)
-    this MUST NOT change within a bitstream
-
-chroma_v_shift
-    log2(luma.height / chroma.height)
-    this MUST NOT change within a bitstream
-
-spatial_scalability
-    0
-
-max_ref_frames
-    maximum number of reference frames
-    this MUST NOT change within a bitstream
-
-update_mc
-    indicates that motion compensation filter parameters are stored in the
-    header
-
-diag_mc
-    flag to enable faster diagonal interpolation
-    this SHOULD be 1 unless it turns out to be covered by a valid patent
-
-htaps
-    number of half pel interpolation filter taps, MUST be even, >0 and <10
-
-hcoeff
-    half pel interpolation filter coefficients, hcoeff[0] are the 2 middle
-    coefficients [1] are the next outer ones and so on, resulting in a filter
-    like: ...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ...
-    the sign of the coefficients is not explicitly stored but alternates
-    after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,...
-    hcoeff[0] is not explicitly stored but found by subtracting the sum
-    of all stored coefficients with signs from 32
-    hcoeff[0]= 32 - hcoeff[1] - hcoeff[2] - ...
-    a good choice for hcoeff and htaps is
-    htaps= 6
-    hcoeff={40,-10,2}
-    an alternative which requires more computations at both encoder and
-    decoder side and may or may not be better is
-    htaps= 8
-    hcoeff={42,-14,6,-2}
-
-
-ref_frames
-    minimum of the number of available reference frames and max_ref_frames
-    for example the first frame after a key frame always has ref_frames=1
-
-spatial_decomposition_type
-    wavelet type
-    0 is a 9/7 symmetric compact integer wavelet
-    1 is a 5/3 symmetric compact integer wavelet
-    others are reserved
-    stored as delta from last, last is reset to 0 if always_reset || keyframe
-
-qlog
-    quality (logarthmic quantizer scale)
-    stored as delta from last, last is reset to 0 if always_reset || keyframe
-
-mv_scale
-    stored as delta from last, last is reset to 0 if always_reset || keyframe
-    FIXME check that everything works fine if this changes between frames
-
-qbias
-    dequantization bias
-    stored as delta from last, last is reset to 0 if always_reset || keyframe
-
-block_max_depth
-    maximum depth of the block tree
-    stored as delta from last, last is reset to 0 if always_reset || keyframe
-
-quant_table
-    quantiztation table
-
-
-Highlevel bitstream structure:
-=============================
- --------------------------------------------
-|                   Header                   |
- --------------------------------------------
-|    ------------------------------------    |
-|   |               Block0               |   |
-|   |             split?                 |   |
-|   |     yes              no            |   |
-|   |  .........         intra?          |   |
-|   | : Block01 :    yes         no      |   |
-|   | : Block02 :  .......   ..........  |   |
-|   | : Block03 : :  y DC : : ref index: |   |
-|   | : Block04 : : cb DC : : motion x : |   |
-|   |  .........  : cr DC : : motion y : |   |
-|   |              .......   ..........  |   |
-|    ------------------------------------    |
-|    ------------------------------------    |
-|   |               Block1               |   |
-|                    ...                     |
- --------------------------------------------
-| ------------   ------------   ------------ |
-|| Y subbands | | Cb subbands| | Cr subbands||
-||  ---  ---  | |  ---  ---  | |  ---  ---  ||
-|| |LL0||HL0| | | |LL0||HL0| | | |LL0||HL0| ||
-||  ---  ---  | |  ---  ---  | |  ---  ---  ||
-||  ---  ---  | |  ---  ---  | |  ---  ---  ||
-|| |LH0||HH0| | | |LH0||HH0| | | |LH0||HH0| ||
-||  ---  ---  | |  ---  ---  | |  ---  ---  ||
-||  ---  ---  | |  ---  ---  | |  ---  ---  ||
-|| |HL1||LH1| | | |HL1||LH1| | | |HL1||LH1| ||
-||  ---  ---  | |  ---  ---  | |  ---  ---  ||
-||  ---  ---  | |  ---  ---  | |  ---  ---  ||
-|| |HH1||HL2| | | |HH1||HL2| | | |HH1||HL2| ||
-||    ...     | |    ...     | |    ...     ||
-| ------------   ------------   ------------ |
- --------------------------------------------
-
-Decoding process:
-=================
-
-                                         ------------
-                                        |            |
-                                        |  Subbands  |
-                   ------------         |            |
-                  |            |         ------------
-                  |  Intra DC  |               |
-                  |            |    LL0 subband prediction
-                   ------------                |
-                                \        Dequantizaton
- -------------------             \             |
-|  Reference frames |             \           IDWT
-| -------   ------- |    Motion    \           |
-||Frame 0| |Frame 1|| Compensation  .   OBMC   v      -------
-| -------   ------- | --------------. \------> + --->|Frame n|-->output
-| -------   ------- |                                 -------
-||Frame 2| |Frame 3||<----------------------------------/
-|        ...        |
- -------------------
-
-
-Range Coder:
-============
-
-Binary Range Coder:
--------------------
-The implemented range coder is an adapted version based upon "Range encoding:
-an algorithm for removing redundancy from a digitised message." by G. N. N.
-Martin.
-The symbols encoded by the Snow range coder are bits (0|1). The
-associated probabilities are not fix but change depending on the symbol mix
-seen so far.
-
-
-bit seen | new state
----------+-----------------------------------------------
-    0    | 256 - state_transition_table[256 - old_state];
-    1    |       state_transition_table[      old_state];
-
-state_transition_table = {
-  0,   0,   0,   0,   0,   0,   0,   0,  20,  21,  22,  23,  24,  25,  26,  27,
- 28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  37,  38,  39,  40,  41,  42,
- 43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  56,  57,
- 58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,
- 74,  75,  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,
- 89,  90,  91,  92,  93,  94,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103,
-104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118,
-119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133,
-134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
-150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
-165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179,
-180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194,
-195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209,
-210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225,
-226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240,
-241, 242, 243, 244, 245, 246, 247, 248, 248,   0,   0,   0,   0,   0,   0,   0};
-
-FIXME
-
-
-Range Coding of integers:
--------------------------
-FIXME
-
-
-Neighboring Blocks:
-===================
-left and top are set to the respective blocks unless they are outside of
-the image in which case they are set to the Null block
-
-top-left is set to the top left block unless it is outside of the image in
-which case it is set to the left block
-
-if this block has no larger parent block or it is at the left side of its
-parent block and the top right block is not outside of the image then the
-top right block is used for top-right else the top-left block is used
-
-Null block
-y,cb,cr are 128
-level, ref, mx and my are 0
-
-
-Motion Vector Prediction:
-=========================
-1. the motion vectors of all the neighboring blocks are scaled to
-compensate for the difference of reference frames
-
-scaled_mv= (mv * (256 * (current_reference+1) / (mv.reference+1)) + 128)>>8
-
-2. the median of the scaled left, top and top-right vectors is used as
-motion vector prediction
-
-3. the used motion vector is the sum of the predictor and
-   (mvx_diff, mvy_diff)*mv_scale
-
-
-Intra DC Predicton:
-======================
-the luma and chroma values of the left block are used as predictors
-
-the used luma and chroma is the sum of the predictor and y_diff, cb_diff, cr_diff
-to reverse this in the decoder apply the following:
-block[y][x].dc[0] = block[y][x-1].dc[0] +  y_diff;
-block[y][x].dc[1] = block[y][x-1].dc[1] + cb_diff;
-block[y][x].dc[2] = block[y][x-1].dc[2] + cr_diff;
-block[*][-1].dc[*]= 128;
-
-
-Motion Compensation:
-====================
-
-Halfpel interpolation:
-----------------------
-halfpel interpolation is done by convolution with the halfpel filter stored
-in the header:
-
-horizontal halfpel samples are found by
-H1[y][x] =    hcoeff[0]*(F[y][x  ] + F[y][x+1])
-            + hcoeff[1]*(F[y][x-1] + F[y][x+2])
-            + hcoeff[2]*(F[y][x-2] + F[y][x+3])
-            + ...
-h1[y][x] = (H1[y][x] + 32)>>6;
-
-vertical halfpel samples are found by
-H2[y][x] =    hcoeff[0]*(F[y  ][x] + F[y+1][x])
-            + hcoeff[1]*(F[y-1][x] + F[y+2][x])
-            + ...
-h2[y][x] = (H2[y][x] + 32)>>6;
-
-vertical+horizontal halfpel samples are found by
-H3[y][x] =    hcoeff[0]*(H2[y][x  ] + H2[y][x+1])
-            + hcoeff[1]*(H2[y][x-1] + H2[y][x+2])
-            + ...
-H3[y][x] =    hcoeff[0]*(H1[y  ][x] + H1[y+1][x])
-            + hcoeff[1]*(H1[y+1][x] + H1[y+2][x])
-            + ...
-h3[y][x] = (H3[y][x] + 2048)>>12;
-
-
-                   F   H1  F
-                   |   |   |
-                   |   |   |
-                   |   |   |
-                   F   H1  F
-                   |   |   |
-                   |   |   |
-                   |   |   |
-   F-------F-------F-> H1<-F-------F-------F
-                   v   v   v
-                  H2   H3  H2
-                   ^   ^   ^
-   F-------F-------F-> H1<-F-------F-------F
-                   |   |   |
-                   |   |   |
-                   |   |   |
-                   F   H1  F
-                   |   |   |
-                   |   |   |
-                   |   |   |
-                   F   H1  F
-
-
-unavailable fullpel samples (outside the picture for example) shall be equal
-to the closest available fullpel sample
-
-
-Smaller pel interpolation:
---------------------------
-if diag_mc is set then points which lie on a line between 2 vertically,
-horiziontally or diagonally adjacent halfpel points shall be interpolated
-linearls with rounding to nearest and halfway values rounded up.
-points which lie on 2 diagonals at the same time should only use the one
-diagonal not containing the fullpel point
-
-
-
-           F-->O---q---O<--h1->O---q---O<--F
-           v \           / v \           / v
-           O   O       O   O   O       O   O
-           |         /     |     \         |
-           q       q       q       q       q
-           |     /         |         \     |
-           O   O       O   O   O       O   O
-           ^ /           \ ^ /           \ ^
-          h2-->O---q---O<--h3->O---q---O<--h2
-           v \           / v \           / v
-           O   O       O   O   O       O   O
-           |     \         |         /     |
-           q       q       q       q       q
-           |         \     |     /         |
-           O   O       O   O   O       O   O
-           ^ /           \ ^ /           \ ^
-           F-->O---q---O<--h1->O---q---O<--F
-
-
-
-the remaining points shall be bilinearly interpolated from the
-up to 4 surrounding halfpel and fullpel points, again rounding should be to
-nearest and halfway values rounded up
-
-compliant Snow decoders MUST support 1-1/8 pel luma and 1/2-1/16 pel chroma
-interpolation at least
-
-
-Overlapped block motion compensation:
--------------------------------------
-FIXME
-
-LL band prediction:
-===================
-Each sample in the LL0 subband is predicted by the median of the left, top and
-left+top-topleft samples, samples outside the subband shall be considered to
-be 0. To reverse this prediction in the decoder apply the following.
-for(y=0; y<height; y++){
-    for(x=0; x<width; x++){
-        sample[y][x] += median(sample[y-1][x],
-                               sample[y][x-1],
-                               sample[y-1][x]+sample[y][x-1]-sample[y-1][x-1]);
-    }
-}
-sample[-1][*]=sample[*][-1]= 0;
-width,height here are the width and height of the LL0 subband not of the final
-video
-
-
-Dequantizaton:
-==============
-FIXME
-
-Wavelet Transform:
-==================
-
-Snow supports 2 wavelet transforms, the symmetric biorthogonal 5/3 integer
-transform and a integer approximation of the symmetric biorthogonal 9/7
-daubechies wavelet.
-
-2D IDWT (inverse discrete wavelet transform)
---------------------------------------------
-The 2D IDWT applies a 2D filter recursively, each time combining the
-4 lowest frequency subbands into a single subband until only 1 subband
-remains.
-The 2D filter is done by first applying a 1D filter in the vertical direction
-and then applying it in the horizontal one.
- ---------------    ---------------    ---------------    ---------------
-|LL0|HL0|       |  |   |   |       |  |       |       |  |       |       |
-|---+---|  HL1  |  | L0|H0 |  HL1  |  |  LL1  |  HL1  |  |       |       |
-|LH0|HH0|       |  |   |   |       |  |       |       |  |       |       |
-|-------+-------|->|-------+-------|->|-------+-------|->|   L1  |  H1   |->...
-|       |       |  |       |       |  |       |       |  |       |       |
-|  LH1  |  HH1  |  |  LH1  |  HH1  |  |  LH1  |  HH1  |  |       |       |
-|       |       |  |       |       |  |       |       |  |       |       |
- ---------------    ---------------    ---------------    ---------------
-
-
-1D Filter:
-----------
-1. interleave the samples of the low and high frequency subbands like
-s={L0, H0, L1, H1, L2, H2, L3, H3, ... }
-note, this can end with a L or a H, the number of elements shall be w
-s[-1] shall be considered equivalent to s[1  ]
-s[w ] shall be considered equivalent to s[w-2]
-
-2. perform the lifting steps in order as described below
-
-5/3 Integer filter:
-1. s[i] -= (s[i-1] + s[i+1] + 2)>>2; for all even i < w
-2. s[i] += (s[i-1] + s[i+1]    )>>1; for all odd  i < w
-
-\ | /|\ | /|\ | /|\ | /|\
- \|/ | \|/ | \|/ | \|/ |
-  +  |  +  |  +  |  +  |   -1/4
- /|\ | /|\ | /|\ | /|\ |
-/ | \|/ | \|/ | \|/ | \|/
-  |  +  |  +  |  +  |  +   +1/2
-
-
-Snow's 9/7 Integer filter:
-1. s[i] -= (3*(s[i-1] + s[i+1])         + 4)>>3; for all even i < w
-2. s[i] -=     s[i-1] + s[i+1]                 ; for all odd  i < w
-3. s[i] += (   s[i-1] + s[i+1] + 4*s[i] + 8)>>4; for all even i < w
-4. s[i] += (3*(s[i-1] + s[i+1])            )>>1; for all odd  i < w
-
-\ | /|\ | /|\ | /|\ | /|\
- \|/ | \|/ | \|/ | \|/ |
-  +  |  +  |  +  |  +  |   -3/8
- /|\ | /|\ | /|\ | /|\ |
-/ | \|/ | \|/ | \|/ | \|/
- (|  + (|  + (|  + (|  +   -1
-\ + /|\ + /|\ + /|\ + /|\  +1/4
- \|/ | \|/ | \|/ | \|/ |
-  +  |  +  |  +  |  +  |   +1/16
- /|\ | /|\ | /|\ | /|\ |
-/ | \|/ | \|/ | \|/ | \|/
-  |  +  |  +  |  +  |  +   +3/2
-
-optimization tips:
-following are exactly identical
-(3a)>>1 == a + (a>>1)
-(a + 4b + 8)>>4 == ((a>>2) + b + 2)>>2
-
-16bit implementation note:
-The IDWT can be implemented with 16bits, but this requires some care to
-prevent overflows, the following list, lists the minimum number of bits needed
-for some terms
-1. lifting step
-A= s[i-1] + s[i+1]                              16bit
-3*A + 4                                         18bit
-A + (A>>1) + 2                                  17bit
-
-3. lifting step
-s[i-1] + s[i+1]                                 17bit
-
-4. lifiting step
-3*(s[i-1] + s[i+1])                             17bit
-
-
-TODO:
-=====
-Important:
-finetune initial contexts
-flip wavelet?
-try to use the wavelet transformed predicted image (motion compensated image) as context for coding the residual coefficients
-try the MV length as context for coding the residual coefficients
-use extradata for stuff which is in the keyframes now?
-the MV median predictor is patented IIRC
-implement per picture halfpel interpolation
-try different range coder state transition tables for different contexts
-
-Not Important:
-compare the 6 tap and 8 tap hpel filters (psnr/bitrate and subjective quality)
-spatial_scalability b vs u (!= 0 breaks syntax anyway so we can add a u later)
-
-
-Credits:
-========
-Michael Niedermayer
-Loren Merritt
-
-
-Copyright:
-==========
-GPL + GFDL + whatever is needed to make this a RFC
diff --git a/doc/soc.txt b/doc/soc.txt
deleted file mode 100644
index 8b4a86d..0000000
--- a/doc/soc.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Google Summer of Code and similar project guidelines
-
-Summer of Code is a project by Google in which students are paid to implement
-some nice new features for various participating open source projects ...
-
-This text is a collection of things to take care of for the next soc as
-it's a little late for this year's soc (2006).
-
-The Goal:
-Our goal in respect to soc is and must be of course exactly one thing and
-that is to improve FFmpeg, to reach this goal, code must
-* conform to the svn policy and patch submission guidelines
-* must improve FFmpeg somehow (faster, smaller, "better",
-  more codecs supported, fewer bugs, cleaner, ...)
-
-for mentors and other developers to help students to reach that goal it is
-essential that changes to their codebase are publicly visible, clean and
-easy reviewable that again leads us to:
-* use of a revision control system like svn
-* separation of cosmetic from non-cosmetic changes (this is almost entirely
-  ignored by mentors and students in soc 2006 which might lead to a suprise
-  when the code will be reviewed at the end before a possible inclusion in
-  FFmpeg, individual changes were generally not reviewable due to cosmetics).
-* frequent commits, so that comments can be provided early
diff --git a/doc/swscale.txt b/doc/swscale.txt
deleted file mode 100644
index 4c62e67..0000000
--- a/doc/swscale.txt
+++ /dev/null
@@ -1,99 +0,0 @@
-    The official guide to swscale for confused developers.
-   ========================================================
-
-Current (simplified) Architecture:
----------------------------------
-                        Input
-                          v
-                   _______OR_________
-                 /                   \
-               /                       \
-       special converter     [Input to YUV converter]
-              |                         |
-              |          (8bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:0:0 )
-              |                         |
-              |                         v
-              |                  Horizontal scaler
-              |                         |
-              |      (15bit YUV 4:4:4 / 4:2:2 / 4:2:0 / 4:1:1 / 4:0:0 )
-              |                         |
-              |                         v
-              |          Vertical scaler and output converter
-              |                         |
-              v                         v
-                         output
-
-
-Swscale has 2 scaler paths. Each side must be capable of handling
-slices, that is, consecutive non-overlapping rectangles of dimension
-(0,slice_top) - (picture_width, slice_bottom).
-
-special converter
-    These generally are unscaled converters of common
-    formats, like YUV 4:2:0/4:2:2 -> RGB12/15/16/24/32. Though it could also
-    in principle contain scalers optimized for specific common cases.
-
-Main path
-    The main path is used when no special converter can be used. The code
-    is designed as a destination line pull architecture. That is, for each
-    output line the vertical scaler pulls lines from a ring buffer. When
-    the ring buffer does not contain the wanted line, then it is pulled from
-    the input slice through the input converter and horizontal scaler.
-    The result is also stored in the ring buffer to serve future vertical
-    scaler requests.
-    When no more output can be generated because lines from a future slice
-    would be needed, then all remaining lines in the current slice are
-    converted, horizontally scaled and put in the ring buffer.
-    [This is done for luma and chroma, each with possibly different numbers
-     of lines per picture.]
-
-Input to YUV Converter
-    When the input to the main path is not planar 8 bits per component YUV or
-    8-bit gray, it is converted to planar 8-bit YUV. Two sets of converters
-    exist for this currently: One performs horizontal downscaling by 2
-    before the conversion, the other leaves the full chroma resolution,
-    but is slightly slower. The scaler will try to preserve full chroma
-    when the output uses it. It is possible to force full chroma with
-    SWS_FULL_CHR_H_INP even for cases where the scaler thinks it is useless.
-
-Horizontal scaler
-    There are several horizontal scalers. A special case worth mentioning is
-    the fast bilinear scaler that is made of runtime-generated MMX2 code
-    using specially tuned pshufw instructions.
-    The remaining scalers are specially-tuned for various filter lengths.
-    They scale 8-bit unsigned planar data to 16-bit signed planar data.
-    Future >8 bits per component inputs will need to add a new horizontal
-    scaler that preserves the input precision.
-
-Vertical scaler and output converter
-    There is a large number of combined vertical scalers + output converters.
-    Some are:
-    * unscaled output converters
-    * unscaled output converters that average 2 chroma lines
-    * bilinear converters                (C, MMX and accurate MMX)
-    * arbitrary filter length converters (C, MMX and accurate MMX)
-    And
-    * Plain C  8-bit 4:2:2 YUV -> RGB converters using LUTs
-    * Plain C 17-bit 4:4:4 YUV -> RGB converters using multiplies
-    * MMX     11-bit 4:2:2 YUV -> RGB converters
-    * Plain C 16-bit Y -> 16-bit gray
-      ...
-
-    RGB with less than 8 bits per component uses dither to improve the
-    subjective quality and low-frequency accuracy.
-
-
-Filter coefficients:
---------------------
-There are several different scalers (bilinear, bicubic, lanczos, area,
-sinc, ...). Their coefficients are calculated in initFilter().
-Horizontal filter coefficients have a 1.0 point at 1 << 14, vertical ones at
-1 << 12. The 1.0 points have been chosen to maximize precision while leaving
-a little headroom for convolutional filters like sharpening filters and
-minimizing SIMD instructions needed to apply them.
-It would be trivial to use a different 1.0 point if some specific scaler
-would benefit from it.
-Also, as already hinted at, initFilter() accepts an optional convolutional
-filter as input that can be used for contrast, saturation, blur, sharpening
-shift, chroma vs. luma shift, ...
-
diff --git a/doc/tablegen.txt b/doc/tablegen.txt
deleted file mode 100644
index 8dfcd7d..0000000
--- a/doc/tablegen.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-Writing a table generator
-
-This documentation is preliminary.
-Parts of the API are not good and should be changed.
-
-Basic concepts
-
-A table generator consists of two files, *_tablegen.c and *_tablegen.h.
-The .h file will provide the variable declarations and initialization
-code for the tables, the .c calls the initialization code and then prints
-the tables as a header file using the tableprint.h helpers.
-Both of these files will be compiled for the host system, so to avoid
-breakage with cross-compilation neither of them may include, directly
-or indirectly, config.h or avconfig.h.
-Due to this, the .c file or Makefile may have to provide additional defines
-or stubs, though if possible this should be avoided.
-In particular, CONFIG_HARDCODED_TABLES should always be defined to 0.
-
-The .c file
-
-This file should include the *_tablegen.h and tableprint.h files and
-anything else it needs as long as it does not depend on config.h or
-avconfig.h.
-In addition to that it must contain a main() function which initializes
-all tables by calling the init functions from the .h file and then prints
-them.
-The printing code typically looks like this:
-    write_fileheader();
-    printf("static const uint8_t my_array[100] = {\n");
-    write_uint8_array(my_array, 100);
-    printf("};\n");
-
-write_fileheader() adds some minor things like a "this is a generated file"
-comment and some standard includes.
-tablegen.h defines some write functions for one- and two-dimensional arrays
-for standard types - they print only the "core" parts so they are easier
-to reuse for multi-dimensional arrays so the outermost {} must be printed
-separately.
-If there's no standard function for printing the type you need, the
-WRITE_1D_FUNC_ARGV macro is a very quick way to create one.
-See libavcodec/dv_tablegen.c for an example.
-
-
-The .h file
-
-This file should contain:
- - one or more initialization functions
- - the table variable declarations
-If CONFIG_HARDCODED_TABLES is set, the initialization functions should
-not do anything, and instead of the variable declarations the
-generated *_tables.h file should be included.
-Since that will be generated in the build directory, the path must be
-included, i.e.
-#include "libavcodec/example_tables.h"
-not
-#include "example_tables.h"
-
-Makefile changes
-
-To make the automatic table creation work, you must manually declare the
-new dependency.
-For this add a line similar to this:
-$(SUBDIR)example.o: $(SUBDIR)example_tables.h
-under the "ifdef CONFIG_HARDCODED_TABLES" section in the Makefile.
diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl
deleted file mode 100755
index c414ffc..0000000
--- a/doc/texi2pod.pl
+++ /dev/null
@@ -1,427 +0,0 @@
-#! /usr/bin/perl -w
-
-#   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
-
-# This file is part of GNU CC.
-
-# GNU CC 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, or (at your option)
-# any later version.
-
-# GNU CC 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 GNU CC; see the file COPYING.  If not, write to
-# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301 USA
-
-# This does trivial (and I mean _trivial_) conversion of Texinfo
-# markup to Perl POD format.  It's intended to be used to extract
-# something suitable for a manpage from a Texinfo document.
-
-$output = 0;
-$skipping = 0;
-%sects = ();
-$section = "";
- at icstack = ();
- at endwstack = ();
- at skstack = ();
- at instack = ();
-$shift = "";
-%defs = ();
-$fnno = 1;
-$inf = "";
-$ibase = "";
-
-while ($_ = shift) {
-    if (/^-D(.*)$/) {
-        if ($1 ne "") {
-            $flag = $1;
-        } else {
-            $flag = shift;
-        }
-        $value = "";
-        ($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
-        die "no flag specified for -D\n"
-            unless $flag ne "";
-        die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
-            unless $flag =~ /^[a-zA-Z0-9_-]+$/;
-        $defs{$flag} = $value;
-    } elsif (/^-/) {
-        usage();
-    } else {
-        $in = $_, next unless defined $in;
-        $out = $_, next unless defined $out;
-        usage();
-    }
-}
-
-if (defined $in) {
-    $inf = gensym();
-    open($inf, "<$in") or die "opening \"$in\": $!\n";
-    $ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
-} else {
-    $inf = \*STDIN;
-}
-
-if (defined $out) {
-    open(STDOUT, ">$out") or die "opening \"$out\": $!\n";
-}
-
-while(defined $inf) {
-while(<$inf>) {
-    # Certain commands are discarded without further processing.
-    /^\@(?:
-         [a-z]+index            # @*index: useful only in complete manual
-         |need                  # @need: useful only in printed manual
-         |(?:end\s+)?group      # @group .. @end group: ditto
-         |page                  # @page: ditto
-         |node                  # @node: useful only in .info file
-         |(?:end\s+)?ifnottex   # @ifnottex .. @end ifnottex: use contents
-        )\b/x and next;
-
-    chomp;
-
-    # Look for filename and title markers.
-    /^\@setfilename\s+([^.]+)/ and $fn = $1, next;
-    /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
-
-    # Identify a man title but keep only the one we are interested in.
-    /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
-        if (exists $defs{$1}) {
-            $fn = $1;
-            $tl = postprocess($2);
-        }
-        next;
-    };
-
-    # Look for blocks surrounded by @c man begin SECTION ... @c man end.
-    # This really oughta be @ifman ... @end ifman and the like, but such
-    # would require rev'ing all other Texinfo translators.
-    /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
-        $output = 1 if exists $defs{$2};
-        $sect = $1;
-        next;
-    };
-    /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
-    /^\@c\s+man\s+end/ and do {
-        $sects{$sect} = "" unless exists $sects{$sect};
-        $sects{$sect} .= postprocess($section);
-        $section = "";
-        $output = 0;
-        next;
-    };
-
-    # handle variables
-    /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do {
-        $defs{$1} = $2;
-        next;
-    };
-    /^\@clear\s+([a-zA-Z0-9_-]+)/ and do {
-        delete $defs{$1};
-        next;
-    };
-
-    next unless $output;
-
-    # Discard comments.  (Can't do it above, because then we'd never see
-    # @c man lines.)
-    /^\@c\b/ and next;
-
-    # End-block handler goes up here because it needs to operate even
-    # if we are skipping.
-    /^\@end\s+([a-z]+)/ and do {
-        # Ignore @end foo, where foo is not an operation which may
-        # cause us to skip, if we are presently skipping.
-        my $ended = $1;
-        next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/;
-
-        die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
-        die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
-
-        $endw = pop @endwstack;
-
-        if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
-            $skipping = pop @skstack;
-            next;
-        } elsif ($ended =~ /^(?:example|smallexample|display)$/) {
-            $shift = "";
-            $_ = "";        # need a paragraph break
-        } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
-            $_ = "\n=back\n";
-            $ic = pop @icstack;
-        } else {
-            die "unknown command \@end $ended at line $.\n";
-        }
-    };
-
-    # We must handle commands which can cause skipping even while we
-    # are skipping, otherwise we will not process nested conditionals
-    # correctly.
-    /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
-        push @endwstack, $endw;
-        push @skstack, $skipping;
-        $endw = "ifset";
-        $skipping = 1 unless exists $defs{$1};
-        next;
-    };
-
-    /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
-        push @endwstack, $endw;
-        push @skstack, $skipping;
-        $endw = "ifclear";
-        $skipping = 1 if exists $defs{$1};
-        next;
-    };
-
-    /^\@(ignore|menu|iftex)\b/ and do {
-        push @endwstack, $endw;
-        push @skstack, $skipping;
-        $endw = $1;
-        $skipping = 1;
-        next;
-    };
-
-    next if $skipping;
-
-    # Character entities.  First the ones that can be replaced by raw text
-    # or discarded outright:
-    s/\@copyright\{\}/(c)/g;
-    s/\@dots\{\}/.../g;
-    s/\@enddots\{\}/..../g;
-    s/\@([.!? ])/$1/g;
-    s/\@[:-]//g;
-    s/\@bullet(?:\{\})?/*/g;
-    s/\@TeX\{\}/TeX/g;
-    s/\@pounds\{\}/\#/g;
-    s/\@minus(?:\{\})?/-/g;
-    s/\\,/,/g;
-
-    # Now the ones that have to be replaced by special escapes
-    # (which will be turned back into text by unmunge())
-    s/&/&amp;/g;
-    s/\@\{/&lbrace;/g;
-    s/\@\}/&rbrace;/g;
-    s/\@\@/&at;/g;
-
-    # Inside a verbatim block, handle @var specially.
-    if ($shift ne "") {
-        s/\@var\{([^\}]*)\}/<$1>/g;
-    }
-
-    # POD doesn't interpret E<> inside a verbatim block.
-    if ($shift eq "") {
-        s/</&lt;/g;
-        s/>/&gt;/g;
-    } else {
-        s/</&LT;/g;
-        s/>/&GT;/g;
-    }
-
-    # Single line command handlers.
-
-    /^\@include\s+(.+)$/ and do {
-        push @instack, $inf;
-        $inf = gensym();
-
-        # Try cwd and $ibase.
-        open($inf, "<" . $1)
-            or open($inf, "<" . $ibase . "/" . $1)
-                or die "cannot open $1 or $ibase/$1: $!\n";
-        next;
-    };
-
-    /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
-        and $_ = "\n=head2 $1\n";
-    /^\@subsection\s+(.+)$/
-        and $_ = "\n=head3 $1\n";
-
-    # Block command handlers:
-    /^\@itemize\s+(\@[a-z]+|\*|-)/ and do {
-        push @endwstack, $endw;
-        push @icstack, $ic;
-        $ic = $1;
-        $_ = "\n=over 4\n";
-        $endw = "itemize";
-    };
-
-    /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do {
-        push @endwstack, $endw;
-        push @icstack, $ic;
-        if (defined $1) {
-            $ic = $1 . ".";
-        } else {
-            $ic = "1.";
-        }
-        $_ = "\n=over 4\n";
-        $endw = "enumerate";
-    };
-
-    /^\@([fv]?table)\s+(\@[a-z]+)/ and do {
-        push @endwstack, $endw;
-        push @icstack, $ic;
-        $endw = $1;
-        $ic = $2;
-        $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env)/B/;
-        $ic =~ s/\@(?:code|kbd)/C/;
-        $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
-        $ic =~ s/\@(?:file)/F/;
-        $_ = "\n=over 4\n";
-    };
-
-    /^\@((?:small)?example|display)/ and do {
-        push @endwstack, $endw;
-        $endw = $1;
-        $shift = "\t";
-        $_ = "";        # need a paragraph break
-    };
-
-    /^\@itemx?\s*(.+)?$/ and do {
-        if (defined $1) {
-            # Entity escapes prevent munging by the <> processing below.
-            $_ = "\n=item $ic\&LT;$1\&GT;\n";
-        } else {
-            $_ = "\n=item $ic\n";
-            $ic =~ y/A-Ya-y/B-Zb-z/;
-            $ic =~ s/(\d+)/$1 + 1/eg;
-        }
-    };
-
-    $section .= $shift.$_."\n";
-}
-# End of current file.
-close($inf);
-$inf = pop @instack;
-}
-
-die "No filename or title\n" unless defined $fn && defined $tl;
-
-$sects{NAME} = "$fn \- $tl\n";
-$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
-
-for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES ENVIRONMENT FILES
-              BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) {
-    if(exists $sects{$sect}) {
-        $head = $sect;
-        $head =~ s/SEEALSO/SEE ALSO/;
-        print "=head1 $head\n\n";
-        print scalar unmunge ($sects{$sect});
-        print "\n";
-    }
-}
-
-sub usage
-{
-    die "usage: $0 [-D toggle...] [infile [outfile]]\n";
-}
-
-sub postprocess
-{
-    local $_ = $_[0];
-
-    # @value{foo} is replaced by whatever 'foo' is defined as.
-    while (m/(\@value\{([a-zA-Z0-9_-]+)\})/g) {
-        if (! exists $defs{$2}) {
-            print STDERR "Option $2 not defined\n";
-            s/\Q$1\E//;
-        } else {
-            $value = $defs{$2};
-            s/\Q$1\E/$value/;
-        }
-    }
-
-    # Formatting commands.
-    # Temporary escape for @r.
-    s/\@r\{([^\}]*)\}/R<$1>/g;
-    s/\@(?:dfn|var|emph|cite|i)\{([^\}]*)\}/I<$1>/g;
-    s/\@(?:code|kbd)\{([^\}]*)\}/C<$1>/g;
-    s/\@(?:gccoptlist|samp|strong|key|option|env|command|b)\{([^\}]*)\}/B<$1>/g;
-    s/\@sc\{([^\}]*)\}/\U$1/g;
-    s/\@file\{([^\}]*)\}/F<$1>/g;
-    s/\@w\{([^\}]*)\}/S<$1>/g;
-    s/\@(?:dmn|math)\{([^\}]*)\}/$1/g;
-
-    # Cross references are thrown away, as are @noindent and @refill.
-    # (@noindent is impossible in .pod, and @refill is unnecessary.)
-    # @* is also impossible in .pod; we discard it and any newline that
-    # follows it.  Similarly, our macro @gol must be discarded.
-
-    s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
-    s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
-    s/;\s+\@pxref\{(?:[^\}]*)\}//g;
-    s/\@noindent\s*//g;
-    s/\@refill//g;
-    s/\@gol//g;
-    s/\@\*\s*\n?//g;
-
-    # @uref can take one, two, or three arguments, with different
-    # semantics each time.  @url and @email are just like @uref with
-    # one argument, for our purposes.
-    s/\@(?:uref|url|email)\{([^\},]*)\}/&lt;B<$1>&gt;/g;
-    s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
-    s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
-
-    # Turn B<blah I<blah> blah> into B<blah> I<blah> B<blah> to
-    # match Texinfo semantics of @emph inside @samp.  Also handle @r
-    # inside bold.
-    s/&LT;/</g;
-    s/&GT;/>/g;
-    1 while s/B<((?:[^<>]|I<[^<>]*>)*)R<([^>]*)>/B<$1>${2}B</g;
-    1 while (s/B<([^<>]*)I<([^>]+)>/B<$1>I<$2>B</g);
-    1 while (s/I<([^<>]*)B<([^>]+)>/I<$1>B<$2>I</g);
-    s/[BI]<>//g;
-    s/([BI])<(\s+)([^>]+)>/$2$1<$3>/g;
-    s/([BI])<([^>]+?)(\s+)>/$1<$2>$3/g;
-
-    # Extract footnotes.  This has to be done after all other
-    # processing because otherwise the regexp will choke on formatting
-    # inside @footnote.
-    while (/\@footnote/g) {
-        s/\@footnote\{([^\}]+)\}/[$fnno]/;
-        add_footnote($1, $fnno);
-        $fnno++;
-    }
-
-    return $_;
-}
-
-sub unmunge
-{
-    # Replace escaped symbols with their equivalents.
-    local $_ = $_[0];
-
-    s/&lt;/E<lt>/g;
-    s/&gt;/E<gt>/g;
-    s/&lbrace;/\{/g;
-    s/&rbrace;/\}/g;
-    s/&at;/\@/g;
-    s/&amp;/&/g;
-    return $_;
-}
-
-sub add_footnote
-{
-    unless (exists $sects{FOOTNOTES}) {
-        $sects{FOOTNOTES} = "\n=over 4\n\n";
-    }
-
-    $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++;
-    $sects{FOOTNOTES} .= $_[0];
-    $sects{FOOTNOTES} .= "\n\n";
-}
-
-# stolen from Symbol.pm
-{
-    my $genseq = 0;
-    sub gensym
-    {
-        my $name = "GEN" . $genseq++;
-        my $ref = \*{$name};
-        delete $::{$name};
-        return $ref;
-    }
-}
diff --git a/doc/viterbi.txt b/doc/viterbi.txt
deleted file mode 100644
index d9d924f..0000000
--- a/doc/viterbi.txt
+++ /dev/null
@@ -1,110 +0,0 @@
-This is a quick description of the viterbi aka dynamic programing
-algorthm.
-
-Its reason for existence is that wikipedia has become very poor on
-describing algorithms in a way that makes it useable for understanding
-them or anything else actually. It tends now to describe the very same
-algorithm under 50 different names and pages with few understandable
-by even people who fully understand the algorithm and the theory behind.
-
-Problem description: (that is what it can solve)
-assume we have a 2d table, or you could call it a graph or matrix if you
-prefer
-
-    O   O   O   O   O   O   O
-
-    O   O   O   O   O   O   O
-
-    O   O   O   O   O   O   O
-
-    O   O   O   O   O   O   O
-
-
-That table has edges connecting points from each column to the next column
-and each edge has a score like: (only some edge and scores shown to keep it
-readable)
-
-
-    O--5--O-----O-----O-----O-----O
-     2   / 7   / \   / \   / \   /
-      \ /   \ /   \ /   \ /   \ /
-    O7-/--O--/--O--/--O--/--O--/--O
-     \/ \/ 1/ \/ \/ \/ \/ \/ \/ \/
-     /\ /\ 2\ /\ /\ /\ /\ /\ /\ /\
-    O3-/--O--/--O--/--O--/--O--/--O
-      / \   / \   / \   / \   / \
-     1   \ 9   \ /   \ /   \ /   \
-    O--2--O--1--O--5--O--3--O--8--O
-
-
-
-Our goal is to find a path from left to right through it which
-minimizes the sum of the score of all edges.
-(and of course left/right is just a convention here it could be top down too)
-Similarly the minimum could be the maximum by just fliping the sign,
-Example of a path with scores:
-
-    O   O   O   O   O   O   O
-
->---O.  O   O  .O-2-O   O   O
-      5.     .7      .
-    O   O-1-O   O   O 8 O   O
-                       .
-    O   O   O   O   O   O-1-O---> (sum here is 24)
-
-
-The viterbi algorthm now solves this simply column by column
-For the previous column each point has a best path and a associated
-score:
-
-    O-----5     O
-     \
-      \
-    O  \  1     O
-        \/
-        /\
-    O  /  2     O
-      /
-     /
-    O-----2     O
-
-
-To move one column forward we just need to find the best path and associated
-scores for the next column
-here are some edges we could choose from:
-
-
-    O-----5--3--O
-     \      \8
-      \       \
-    O  \  1--9--O
-        \/  \3
-        /\     \
-    O  /  2--1--O
-      /     \2
-     /        \
-    O-----2--4--O
-
-Finding the new best pathes and scores for each point of our new column is
-trivial given we know the previous column best pathes and scores:
-
-    O-----0-----8
-     \
-      \
-    O  \  0----10
-        \/
-        /\
-    O  /  0-----3
-      /     \
-     /        \
-    O     0     4
-
-
-the viterbi algorthm continues exactly like this column for column until the
-end and then just picks the path with the best score (above that would be the
-one with score 3)
-
-
-Author: Michael niedermayer
-Copyright LGPL
-
diff --git a/ffmpeg.c b/ffmpeg.c
deleted file mode 100644
index 6b9380f..0000000
--- a/ffmpeg.c
+++ /dev/null
@@ -1,4173 +0,0 @@
-/*
- * FFmpeg main
- * Copyright (c) 2000-2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* needed for usleep() */
-#define _XOPEN_SOURCE 600
-
-#include "config.h"
-#include <ctype.h>
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <limits.h>
-#include <unistd.h>
-#include "libavformat/avformat.h"
-#include "libavdevice/avdevice.h"
-#include "libswscale/swscale.h"
-#include "libavcodec/opt.h"
-#include "libavcodec/audioconvert.h"
-#include "libavcodec/colorspace.h"
-#include "libavutil/fifo.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/avstring.h"
-#include "libavutil/libm.h"
-#include "libavformat/os_support.h"
-
-#if HAVE_SYS_RESOURCE_H
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#elif HAVE_GETPROCESSTIMES
-#include <windows.h>
-#endif
-#if HAVE_GETPROCESSMEMORYINFO
-#include <windows.h>
-#include <psapi.h>
-#endif
-
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#if HAVE_TERMIOS_H
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <termios.h>
-#elif HAVE_CONIO_H
-#include <conio.h>
-#endif
-#include <time.h>
-
-#include "cmdutils.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-const char program_name[] = "FFmpeg";
-const int program_birth_year = 2000;
-
-/* select an input stream for an output stream */
-typedef struct AVStreamMap {
-    int file_index;
-    int stream_index;
-    int sync_file_index;
-    int sync_stream_index;
-} AVStreamMap;
-
-/** select an input file for an output file */
-typedef struct AVMetaDataMap {
-    int out_file;
-    int in_file;
-} AVMetaDataMap;
-
-static const OptionDef options[];
-
-#define MAX_FILES 100
-
-static const char *last_asked_format = NULL;
-static AVFormatContext *input_files[MAX_FILES];
-static int64_t input_files_ts_offset[MAX_FILES];
-static double input_files_ts_scale[MAX_FILES][MAX_STREAMS];
-static AVCodec *input_codecs[MAX_FILES*MAX_STREAMS];
-static int nb_input_files = 0;
-static int nb_icodecs;
-
-static AVFormatContext *output_files[MAX_FILES];
-static AVCodec *output_codecs[MAX_FILES*MAX_STREAMS];
-static int nb_output_files = 0;
-static int nb_ocodecs;
-
-static AVStreamMap stream_maps[MAX_FILES*MAX_STREAMS];
-static int nb_stream_maps;
-
-static AVMetaDataMap meta_data_maps[MAX_FILES];
-static int nb_meta_data_maps;
-
-static int frame_width  = 0;
-static int frame_height = 0;
-static float frame_aspect_ratio = 0;
-static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
-static enum SampleFormat audio_sample_fmt = SAMPLE_FMT_NONE;
-static int frame_padtop  = 0;
-static int frame_padbottom = 0;
-static int frame_padleft  = 0;
-static int frame_padright = 0;
-static int padcolor[3] = {16,128,128}; /* default to black */
-static int frame_topBand  = 0;
-static int frame_bottomBand = 0;
-static int frame_leftBand  = 0;
-static int frame_rightBand = 0;
-static int max_frames[4] = {INT_MAX, INT_MAX, INT_MAX, INT_MAX};
-static AVRational frame_rate;
-static float video_qscale = 0;
-static uint16_t *intra_matrix = NULL;
-static uint16_t *inter_matrix = NULL;
-static const char *video_rc_override_string=NULL;
-static int video_disable = 0;
-static int video_discard = 0;
-static char *video_codec_name = NULL;
-static int video_codec_tag = 0;
-static char *video_language = NULL;
-static int same_quality = 0;
-static int do_deinterlace = 0;
-static int top_field_first = -1;
-static int me_threshold = 0;
-static int intra_dc_precision = 8;
-static int loop_input = 0;
-static int loop_output = AVFMT_NOOUTPUTLOOP;
-static int qp_hist = 0;
-
-static int intra_only = 0;
-static int audio_sample_rate = 44100;
-static int64_t channel_layout = 0;
-#define QSCALE_NONE -99999
-static float audio_qscale = QSCALE_NONE;
-static int audio_disable = 0;
-static int audio_channels = 1;
-static char  *audio_codec_name = NULL;
-static int audio_codec_tag = 0;
-static char *audio_language = NULL;
-
-static int subtitle_disable = 0;
-static char *subtitle_codec_name = NULL;
-static char *subtitle_language = NULL;
-static int subtitle_codec_tag = 0;
-
-static float mux_preload= 0.5;
-static float mux_max_delay= 0.7;
-
-static int64_t recording_time = INT64_MAX;
-static int64_t start_time = 0;
-static int64_t rec_timestamp = 0;
-static int64_t input_ts_offset = 0;
-static int file_overwrite = 0;
-static int metadata_count;
-static AVMetadataTag *metadata;
-static int do_benchmark = 0;
-static int do_hex_dump = 0;
-static int do_pkt_dump = 0;
-static int do_psnr = 0;
-static int do_pass = 0;
-static char *pass_logfilename_prefix = NULL;
-static int audio_stream_copy = 0;
-static int video_stream_copy = 0;
-static int subtitle_stream_copy = 0;
-static int video_sync_method= -1;
-static int audio_sync_method= 0;
-static float audio_drift_threshold= 0.1;
-static int copy_ts= 0;
-static int opt_shortest = 0;
-static int video_global_header = 0;
-static char *vstats_filename;
-static FILE *vstats_file;
-static int opt_programid = 0;
-static int copy_initial_nonkeyframes = 0;
-
-static int rate_emu = 0;
-
-static int  video_channel = 0;
-static char *video_standard;
-
-static int audio_volume = 256;
-
-static int exit_on_error = 0;
-static int using_stdin = 0;
-static int verbose = 1;
-static int thread_count= 1;
-static int q_pressed = 0;
-static int64_t video_size = 0;
-static int64_t audio_size = 0;
-static int64_t extra_size = 0;
-static int nb_frames_dup = 0;
-static int nb_frames_drop = 0;
-static int input_sync;
-static uint64_t limit_filesize = 0;
-static int force_fps = 0;
-
-static int pgmyuv_compatibility_hack=0;
-static float dts_delta_threshold = 10;
-
-static unsigned int sws_flags = SWS_BICUBIC;
-
-static int64_t timer_start;
-
-static uint8_t *audio_buf;
-static uint8_t *audio_out;
-unsigned int allocated_audio_out_size, allocated_audio_buf_size;
-
-static short *samples;
-
-static AVBitStreamFilterContext *video_bitstream_filters=NULL;
-static AVBitStreamFilterContext *audio_bitstream_filters=NULL;
-static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL;
-static AVBitStreamFilterContext *bitstream_filters[MAX_FILES][MAX_STREAMS];
-
-#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
-
-struct AVInputStream;
-
-typedef struct AVOutputStream {
-    int file_index;          /* file index */
-    int index;               /* stream index in the output file */
-    int source_index;        /* AVInputStream index */
-    AVStream *st;            /* stream in the output file */
-    int encoding_needed;     /* true if encoding needed for this stream */
-    int frame_number;
-    /* input pts and corresponding output pts
-       for A/V sync */
-    //double sync_ipts;        /* dts from the AVPacket of the demuxer in second units */
-    struct AVInputStream *sync_ist; /* input stream to sync against */
-    int64_t sync_opts;       /* output frame counter, could be changed to some true timestamp */ //FIXME look at frame_number
-    /* video only */
-    int video_resample;
-    AVFrame pict_tmp;      /* temporary image for resampling */
-    struct SwsContext *img_resample_ctx; /* for image resampling */
-    int resample_height;
-    int resample_width;
-    int resample_pix_fmt;
-
-    /* full frame size of first frame */
-    int original_height;
-    int original_width;
-
-    /* cropping area sizes */
-    int video_crop;
-    int topBand;
-    int bottomBand;
-    int leftBand;
-    int rightBand;
-
-    /* cropping area of first frame */
-    int original_topBand;
-    int original_bottomBand;
-    int original_leftBand;
-    int original_rightBand;
-
-    /* padding area sizes */
-    int video_pad;
-    int padtop;
-    int padbottom;
-    int padleft;
-    int padright;
-
-    /* audio only */
-    int audio_resample;
-    ReSampleContext *resample; /* for audio resampling */
-    int reformat_pair;
-    AVAudioConvert *reformat_ctx;
-    AVFifoBuffer *fifo;     /* for compression: one audio fifo per codec */
-    FILE *logfile;
-} AVOutputStream;
-
-typedef struct AVInputStream {
-    int file_index;
-    int index;
-    AVStream *st;
-    int discard;             /* true if stream data should be discarded */
-    int decoding_needed;     /* true if the packets must be decoded in 'raw_fifo' */
-    int64_t sample_index;      /* current sample */
-
-    int64_t       start;     /* time when read started */
-    int64_t       next_pts;  /* synthetic pts for cases where pkt.pts
-                                is not defined */
-    int64_t       pts;       /* current pts */
-    int is_start;            /* is 1 at the start and after a discontinuity */
-    int showed_multi_packet_warning;
-    int is_past_recording_time;
-} AVInputStream;
-
-typedef struct AVInputFile {
-    int eof_reached;      /* true if eof reached */
-    int ist_index;        /* index of first stream in ist_table */
-    int buffer_size;      /* current total buffer size */
-    int nb_streams;       /* nb streams we are aware of */
-} AVInputFile;
-
-#if HAVE_TERMIOS_H
-
-/* init terminal so that we can grab keys */
-static struct termios oldtty;
-#endif
-
-static void term_exit(void)
-{
-#if HAVE_TERMIOS_H
-    tcsetattr (0, TCSANOW, &oldtty);
-#endif
-}
-
-static volatile int received_sigterm = 0;
-
-static void
-sigterm_handler(int sig)
-{
-    received_sigterm = sig;
-    term_exit();
-}
-
-static void term_init(void)
-{
-#if HAVE_TERMIOS_H
-    struct termios tty;
-
-    tcgetattr (0, &tty);
-    oldtty = tty;
-    atexit(term_exit);
-
-    tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
-                          |INLCR|IGNCR|ICRNL|IXON);
-    tty.c_oflag |= OPOST;
-    tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
-    tty.c_cflag &= ~(CSIZE|PARENB);
-    tty.c_cflag |= CS8;
-    tty.c_cc[VMIN] = 1;
-    tty.c_cc[VTIME] = 0;
-
-    tcsetattr (0, TCSANOW, &tty);
-    signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */
-#endif
-
-    signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).  */
-    signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */
-#ifdef SIGXCPU
-    signal(SIGXCPU, sigterm_handler);
-#endif
-
-#if CONFIG_BEOS_NETSERVER
-    fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
-#endif
-}
-
-/* read a key without blocking */
-static int read_key(void)
-{
-#if HAVE_TERMIOS_H
-    int n = 1;
-    unsigned char ch;
-#if !CONFIG_BEOS_NETSERVER
-    struct timeval tv;
-    fd_set rfds;
-
-    FD_ZERO(&rfds);
-    FD_SET(0, &rfds);
-    tv.tv_sec = 0;
-    tv.tv_usec = 0;
-    n = select(1, &rfds, NULL, NULL, &tv);
-#endif
-    if (n > 0) {
-        n = read(0, &ch, 1);
-        if (n == 1)
-            return ch;
-
-        return n;
-    }
-#elif HAVE_CONIO_H
-    if(kbhit())
-        return(getch());
-#endif
-    return -1;
-}
-
-static int decode_interrupt_cb(void)
-{
-    return q_pressed || (q_pressed = read_key() == 'q');
-}
-
-static int av_exit(int ret)
-{
-    int i;
-
-    /* close files */
-    for(i=0;i<nb_output_files;i++) {
-        /* maybe av_close_output_file ??? */
-        AVFormatContext *s = output_files[i];
-        int j;
-        if (!(s->oformat->flags & AVFMT_NOFILE) && s->pb)
-            url_fclose(s->pb);
-        for(j=0;j<s->nb_streams;j++) {
-            av_metadata_free(&s->streams[j]->metadata);
-            av_free(s->streams[j]->codec);
-            av_free(s->streams[j]);
-        }
-        for(j=0;j<s->nb_programs;j++) {
-            av_metadata_free(&s->programs[j]->metadata);
-        }
-        for(j=0;j<s->nb_chapters;j++) {
-            av_metadata_free(&s->chapters[j]->metadata);
-        }
-        av_metadata_free(&s->metadata);
-        av_free(s);
-    }
-    for(i=0;i<nb_input_files;i++)
-        av_close_input_file(input_files[i]);
-
-    av_free(intra_matrix);
-    av_free(inter_matrix);
-
-    if (vstats_file)
-        fclose(vstats_file);
-    av_free(vstats_filename);
-
-    av_free(opt_names);
-
-    av_free(video_codec_name);
-    av_free(audio_codec_name);
-    av_free(subtitle_codec_name);
-
-    av_free(video_standard);
-
-#if CONFIG_POWERPC_PERF
-    void powerpc_display_perf_report(void);
-    powerpc_display_perf_report();
-#endif /* CONFIG_POWERPC_PERF */
-
-    for (i=0;i<AVMEDIA_TYPE_NB;i++)
-        av_free(avcodec_opts[i]);
-    av_free(avformat_opts);
-    av_free(sws_opts);
-    av_free(audio_buf);
-    av_free(audio_out);
-    allocated_audio_buf_size= allocated_audio_out_size= 0;
-    av_free(samples);
-
-    if (received_sigterm) {
-        fprintf(stderr,
-            "Received signal %d: terminating.\n",
-            (int) received_sigterm);
-        exit (255);
-    }
-
-    exit(ret); /* not all OS-es handle main() return value */
-    return ret;
-}
-
-static void choose_sample_fmt(AVStream *st, AVCodec *codec)
-{
-    if(codec && codec->sample_fmts){
-        const enum SampleFormat *p= codec->sample_fmts;
-        for(; *p!=-1; p++){
-            if(*p == st->codec->sample_fmt)
-                break;
-        }
-        if(*p == -1)
-            st->codec->sample_fmt = codec->sample_fmts[0];
-    }
-}
-
-static void choose_sample_rate(AVStream *st, AVCodec *codec)
-{
-    if(codec && codec->supported_samplerates){
-        const int *p= codec->supported_samplerates;
-        int best;
-        int best_dist=INT_MAX;
-        for(; *p; p++){
-            int dist= abs(st->codec->sample_rate - *p);
-            if(dist < best_dist){
-                best_dist= dist;
-                best= *p;
-            }
-        }
-        if(best_dist){
-            av_log(st->codec, AV_LOG_WARNING, "Requested sampling rate unsupported using closest supported (%d)\n", best);
-        }
-        st->codec->sample_rate= best;
-    }
-}
-
-static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
-{
-    if(codec && codec->pix_fmts){
-        const enum PixelFormat *p= codec->pix_fmts;
-        for(; *p!=-1; p++){
-            if(*p == st->codec->pix_fmt)
-                break;
-        }
-        if(*p == -1
-           && !(   st->codec->codec_id==CODEC_ID_MJPEG
-                && st->codec->strict_std_compliance <= FF_COMPLIANCE_INOFFICIAL
-                && (   st->codec->pix_fmt == PIX_FMT_YUV420P
-                    || st->codec->pix_fmt == PIX_FMT_YUV422P)))
-            st->codec->pix_fmt = codec->pix_fmts[0];
-    }
-}
-
-static int read_ffserver_streams(AVFormatContext *s, const char *filename)
-{
-    int i, err;
-    AVFormatContext *ic;
-    int nopts = 0;
-
-    err = av_open_input_file(&ic, filename, NULL, FFM_PACKET_SIZE, NULL);
-    if (err < 0)
-        return err;
-    /* copy stream format */
-    s->nb_streams = ic->nb_streams;
-    for(i=0;i<ic->nb_streams;i++) {
-        AVStream *st;
-        AVCodec *codec;
-
-        // FIXME: a more elegant solution is needed
-        st = av_mallocz(sizeof(AVStream));
-        memcpy(st, ic->streams[i], sizeof(AVStream));
-        st->codec = avcodec_alloc_context();
-        if (!st->codec) {
-            print_error(filename, AVERROR(ENOMEM));
-            av_exit(1);
-        }
-        avcodec_copy_context(st->codec, ic->streams[i]->codec);
-        s->streams[i] = st;
-
-        codec = avcodec_find_encoder(st->codec->codec_id);
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if (audio_stream_copy) {
-                st->stream_copy = 1;
-            } else
-                choose_sample_fmt(st, codec);
-        } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            if (video_stream_copy) {
-                st->stream_copy = 1;
-            } else
-                choose_pixel_fmt(st, codec);
-        }
-
-        if(!st->codec->thread_count)
-            st->codec->thread_count = 1;
-        if(st->codec->thread_count>1)
-            avcodec_thread_init(st->codec, st->codec->thread_count);
-
-        if(st->codec->flags & CODEC_FLAG_BITEXACT)
-            nopts = 1;
-    }
-
-    if (!nopts)
-        s->timestamp = av_gettime();
-
-    av_close_input_file(ic);
-    return 0;
-}
-
-static double
-get_sync_ipts(const AVOutputStream *ost)
-{
-    const AVInputStream *ist = ost->sync_ist;
-    return (double)(ist->pts - start_time)/AV_TIME_BASE;
-}
-
-static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx, AVBitStreamFilterContext *bsfc){
-    int ret;
-
-    while(bsfc){
-        AVPacket new_pkt= *pkt;
-        int a= av_bitstream_filter_filter(bsfc, avctx, NULL,
-                                          &new_pkt.data, &new_pkt.size,
-                                          pkt->data, pkt->size,
-                                          pkt->flags & AV_PKT_FLAG_KEY);
-        if(a>0){
-            av_free_packet(pkt);
-            new_pkt.destruct= av_destruct_packet;
-        } else if(a<0){
-            fprintf(stderr, "%s failed for stream %d, codec %s",
-                    bsfc->filter->name, pkt->stream_index,
-                    avctx->codec ? avctx->codec->name : "copy");
-            print_error("", a);
-            if (exit_on_error)
-                av_exit(1);
-        }
-        *pkt= new_pkt;
-
-        bsfc= bsfc->next;
-    }
-
-    ret= av_interleaved_write_frame(s, pkt);
-    if(ret < 0){
-        print_error("av_interleaved_write_frame()", ret);
-        av_exit(1);
-    }
-}
-
-#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
-
-static void do_audio_out(AVFormatContext *s,
-                         AVOutputStream *ost,
-                         AVInputStream *ist,
-                         unsigned char *buf, int size)
-{
-    uint8_t *buftmp;
-    int64_t audio_out_size, audio_buf_size;
-    int64_t allocated_for_size= size;
-
-    int size_out, frame_bytes, ret;
-    AVCodecContext *enc= ost->st->codec;
-    AVCodecContext *dec= ist->st->codec;
-    int osize= av_get_bits_per_sample_format(enc->sample_fmt)/8;
-    int isize= av_get_bits_per_sample_format(dec->sample_fmt)/8;
-    const int coded_bps = av_get_bits_per_sample(enc->codec->id);
-
-need_realloc:
-    audio_buf_size= (allocated_for_size + isize*dec->channels - 1) / (isize*dec->channels);
-    audio_buf_size= (audio_buf_size*enc->sample_rate + dec->sample_rate) / dec->sample_rate;
-    audio_buf_size= audio_buf_size*2 + 10000; //safety factors for the deprecated resampling API
-    audio_buf_size*= osize*enc->channels;
-
-    audio_out_size= FFMAX(audio_buf_size, enc->frame_size * osize * enc->channels);
-    if(coded_bps > 8*osize)
-        audio_out_size= audio_out_size * coded_bps / (8*osize);
-    audio_out_size += FF_MIN_BUFFER_SIZE;
-
-    if(audio_out_size > INT_MAX || audio_buf_size > INT_MAX){
-        fprintf(stderr, "Buffer sizes too large\n");
-        av_exit(1);
-    }
-
-    av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size);
-    av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size);
-    if (!audio_buf || !audio_out){
-        fprintf(stderr, "Out of memory in do_audio_out\n");
-        av_exit(1);
-    }
-
-    if (enc->channels != dec->channels)
-        ost->audio_resample = 1;
-
-    if (ost->audio_resample && !ost->resample) {
-        if (dec->sample_fmt != SAMPLE_FMT_S16)
-            fprintf(stderr, "Warning, using s16 intermediate sample format for resampling\n");
-        ost->resample = av_audio_resample_init(enc->channels,    dec->channels,
-                                               enc->sample_rate, dec->sample_rate,
-                                               enc->sample_fmt,  dec->sample_fmt,
-                                               16, 10, 0, 0.8);
-        if (!ost->resample) {
-            fprintf(stderr, "Can not resample %d channels @ %d Hz to %d channels @ %d Hz\n",
-                    dec->channels, dec->sample_rate,
-                    enc->channels, enc->sample_rate);
-            av_exit(1);
-        }
-    }
-
-#define MAKE_SFMT_PAIR(a,b) ((a)+SAMPLE_FMT_NB*(b))
-    if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt &&
-        MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt)!=ost->reformat_pair) {
-        if (ost->reformat_ctx)
-            av_audio_convert_free(ost->reformat_ctx);
-        ost->reformat_ctx = av_audio_convert_alloc(enc->sample_fmt, 1,
-                                                   dec->sample_fmt, 1, NULL, 0);
-        if (!ost->reformat_ctx) {
-            fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
-                avcodec_get_sample_fmt_name(dec->sample_fmt),
-                avcodec_get_sample_fmt_name(enc->sample_fmt));
-            av_exit(1);
-        }
-        ost->reformat_pair=MAKE_SFMT_PAIR(enc->sample_fmt,dec->sample_fmt);
-    }
-
-    if(audio_sync_method){
-        double delta = get_sync_ipts(ost) * enc->sample_rate - ost->sync_opts
-                - av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2);
-        double idelta= delta*ist->st->codec->sample_rate / enc->sample_rate;
-        int byte_delta= ((int)idelta)*2*ist->st->codec->channels;
-
-        //FIXME resample delay
-        if(fabs(delta) > 50){
-            if(ist->is_start || fabs(delta) > audio_drift_threshold*enc->sample_rate){
-                if(byte_delta < 0){
-                    byte_delta= FFMAX(byte_delta, -size);
-                    size += byte_delta;
-                    buf  -= byte_delta;
-                    if(verbose > 2)
-                        fprintf(stderr, "discarding %d audio samples\n", (int)-delta);
-                    if(!size)
-                        return;
-                    ist->is_start=0;
-                }else{
-                    static uint8_t *input_tmp= NULL;
-                    input_tmp= av_realloc(input_tmp, byte_delta + size);
-
-                    if(byte_delta > allocated_for_size - size){
-                        allocated_for_size= byte_delta + (int64_t)size;
-                        goto need_realloc;
-                    }
-                    ist->is_start=0;
-
-                    memset(input_tmp, 0, byte_delta);
-                    memcpy(input_tmp + byte_delta, buf, size);
-                    buf= input_tmp;
-                    size += byte_delta;
-                    if(verbose > 2)
-                        fprintf(stderr, "adding %d audio samples of silence\n", (int)delta);
-                }
-            }else if(audio_sync_method>1){
-                int comp= av_clip(delta, -audio_sync_method, audio_sync_method);
-                assert(ost->audio_resample);
-                if(verbose > 2)
-                    fprintf(stderr, "compensating audio timestamp drift:%f compensation:%d in:%d\n", delta, comp, enc->sample_rate);
-//                fprintf(stderr, "drift:%f len:%d opts:%"PRId64" ipts:%"PRId64" fifo:%d\n", delta, -1, ost->sync_opts, (int64_t)(get_sync_ipts(ost) * enc->sample_rate), av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2));
-                av_resample_compensate(*(struct AVResampleContext**)ost->resample, comp, enc->sample_rate);
-            }
-        }
-    }else
-        ost->sync_opts= lrintf(get_sync_ipts(ost) * enc->sample_rate)
-                        - av_fifo_size(ost->fifo)/(ost->st->codec->channels * 2); //FIXME wrong
-
-    if (ost->audio_resample) {
-        buftmp = audio_buf;
-        size_out = audio_resample(ost->resample,
-                                  (short *)buftmp, (short *)buf,
-                                  size / (ist->st->codec->channels * isize));
-        size_out = size_out * enc->channels * osize;
-    } else {
-        buftmp = buf;
-        size_out = size;
-    }
-
-    if (!ost->audio_resample && dec->sample_fmt!=enc->sample_fmt) {
-        const void *ibuf[6]= {buftmp};
-        void *obuf[6]= {audio_buf};
-        int istride[6]= {isize};
-        int ostride[6]= {osize};
-        int len= size_out/istride[0];
-        if (av_audio_convert(ost->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) {
-            printf("av_audio_convert() failed\n");
-            if (exit_on_error)
-                av_exit(1);
-            return;
-        }
-        buftmp = audio_buf;
-        size_out = len*osize;
-    }
-
-    /* now encode as many frames as possible */
-    if (enc->frame_size > 1) {
-        /* output resampled raw samples */
-        if (av_fifo_realloc2(ost->fifo, av_fifo_size(ost->fifo) + size_out) < 0) {
-            fprintf(stderr, "av_fifo_realloc2() failed\n");
-            av_exit(1);
-        }
-        av_fifo_generic_write(ost->fifo, buftmp, size_out, NULL);
-
-        frame_bytes = enc->frame_size * osize * enc->channels;
-
-        while (av_fifo_size(ost->fifo) >= frame_bytes) {
-            AVPacket pkt;
-            av_init_packet(&pkt);
-
-            av_fifo_generic_read(ost->fifo, audio_buf, frame_bytes, NULL);
-
-            //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio()
-
-            ret = avcodec_encode_audio(enc, audio_out, audio_out_size,
-                                       (short *)audio_buf);
-            if (ret < 0) {
-                fprintf(stderr, "Audio encoding failed\n");
-                av_exit(1);
-            }
-            audio_size += ret;
-            pkt.stream_index= ost->index;
-            pkt.data= audio_out;
-            pkt.size= ret;
-            if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
-                pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
-            pkt.flags |= AV_PKT_FLAG_KEY;
-            write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
-
-            ost->sync_opts += enc->frame_size;
-        }
-    } else {
-        AVPacket pkt;
-        av_init_packet(&pkt);
-
-        ost->sync_opts += size_out / (osize * enc->channels);
-
-        /* output a pcm frame */
-        /* determine the size of the coded buffer */
-        size_out /= osize;
-        if (coded_bps)
-            size_out = size_out*coded_bps/8;
-
-        if(size_out > audio_out_size){
-            fprintf(stderr, "Internal error, buffer size too small\n");
-            av_exit(1);
-        }
-
-        //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio()
-        ret = avcodec_encode_audio(enc, audio_out, size_out,
-                                   (short *)buftmp);
-        if (ret < 0) {
-            fprintf(stderr, "Audio encoding failed\n");
-            av_exit(1);
-        }
-        audio_size += ret;
-        pkt.stream_index= ost->index;
-        pkt.data= audio_out;
-        pkt.size= ret;
-        if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
-            pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
-        pkt.flags |= AV_PKT_FLAG_KEY;
-        write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
-    }
-}
-
-static void pre_process_video_frame(AVInputStream *ist, AVPicture *picture, void **bufp)
-{
-    AVCodecContext *dec;
-    AVPicture *picture2;
-    AVPicture picture_tmp;
-    uint8_t *buf = 0;
-
-    dec = ist->st->codec;
-
-    /* deinterlace : must be done before any resize */
-    if (do_deinterlace) {
-        int size;
-
-        /* create temporary picture */
-        size = avpicture_get_size(dec->pix_fmt, dec->width, dec->height);
-        buf = av_malloc(size);
-        if (!buf)
-            return;
-
-        picture2 = &picture_tmp;
-        avpicture_fill(picture2, buf, dec->pix_fmt, dec->width, dec->height);
-
-        if(avpicture_deinterlace(picture2, picture,
-                                 dec->pix_fmt, dec->width, dec->height) < 0) {
-            /* if error, do not deinterlace */
-            fprintf(stderr, "Deinterlacing failed\n");
-            av_free(buf);
-            buf = NULL;
-            picture2 = picture;
-        }
-    } else {
-        picture2 = picture;
-    }
-
-    if (picture != picture2)
-        *picture = *picture2;
-    *bufp = buf;
-}
-
-/* we begin to correct av delay at this threshold */
-#define AV_DELAY_MAX 0.100
-
-static void do_subtitle_out(AVFormatContext *s,
-                            AVOutputStream *ost,
-                            AVInputStream *ist,
-                            AVSubtitle *sub,
-                            int64_t pts)
-{
-    static uint8_t *subtitle_out = NULL;
-    int subtitle_out_max_size = 1024 * 1024;
-    int subtitle_out_size, nb, i;
-    AVCodecContext *enc;
-    AVPacket pkt;
-
-    if (pts == AV_NOPTS_VALUE) {
-        fprintf(stderr, "Subtitle packets must have a pts\n");
-        if (exit_on_error)
-            av_exit(1);
-        return;
-    }
-
-    enc = ost->st->codec;
-
-    if (!subtitle_out) {
-        subtitle_out = av_malloc(subtitle_out_max_size);
-    }
-
-    /* Note: DVB subtitle need one packet to draw them and one other
-       packet to clear them */
-    /* XXX: signal it in the codec context ? */
-    if (enc->codec_id == CODEC_ID_DVB_SUBTITLE)
-        nb = 2;
-    else
-        nb = 1;
-
-    for(i = 0; i < nb; i++) {
-        sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q);
-        // start_display_time is required to be 0
-        sub->pts              += av_rescale_q(sub->start_display_time, (AVRational){1, 1000}, AV_TIME_BASE_Q);
-        sub->end_display_time -= sub->start_display_time;
-        sub->start_display_time = 0;
-        subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out,
-                                                    subtitle_out_max_size, sub);
-        if (subtitle_out_size < 0) {
-            fprintf(stderr, "Subtitle encoding failed\n");
-            av_exit(1);
-        }
-
-        av_init_packet(&pkt);
-        pkt.stream_index = ost->index;
-        pkt.data = subtitle_out;
-        pkt.size = subtitle_out_size;
-        pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
-        if (enc->codec_id == CODEC_ID_DVB_SUBTITLE) {
-            /* XXX: the pts correction is handled here. Maybe handling
-               it in the codec would be better */
-            if (i == 0)
-                pkt.pts += 90 * sub->start_display_time;
-            else
-                pkt.pts += 90 * sub->end_display_time;
-        }
-        write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
-    }
-}
-
-static int bit_buffer_size= 1024*256;
-static uint8_t *bit_buffer= NULL;
-
-static void do_video_out(AVFormatContext *s,
-                         AVOutputStream *ost,
-                         AVInputStream *ist,
-                         AVFrame *in_picture,
-                         int *frame_size)
-{
-    int nb_frames, i, ret;
-    int64_t topBand, bottomBand, leftBand, rightBand;
-    AVFrame *final_picture, *formatted_picture, *resampling_dst, *padding_src;
-    AVFrame picture_crop_temp, picture_pad_temp;
-    AVCodecContext *enc, *dec;
-    double sync_ipts;
-
-    avcodec_get_frame_defaults(&picture_crop_temp);
-    avcodec_get_frame_defaults(&picture_pad_temp);
-
-    enc = ost->st->codec;
-    dec = ist->st->codec;
-
-    sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base);
-
-    /* by default, we output a single frame */
-    nb_frames = 1;
-
-    *frame_size = 0;
-
-    if(video_sync_method){
-        double vdelta = sync_ipts - ost->sync_opts;
-        //FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
-        if (vdelta < -1.1)
-            nb_frames = 0;
-        else if (video_sync_method == 2 || (video_sync_method<0 && (s->oformat->flags & AVFMT_VARIABLE_FPS))){
-            if(vdelta<=-0.6){
-                nb_frames=0;
-            }else if(vdelta>0.6)
-            ost->sync_opts= lrintf(sync_ipts);
-        }else if (vdelta > 1.1)
-            nb_frames = lrintf(vdelta);
-//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames);
-        if (nb_frames == 0){
-            ++nb_frames_drop;
-            if (verbose>2)
-                fprintf(stderr, "*** drop!\n");
-        }else if (nb_frames > 1) {
-            nb_frames_dup += nb_frames - 1;
-            if (verbose>2)
-                fprintf(stderr, "*** %d dup!\n", nb_frames-1);
-        }
-    }else
-        ost->sync_opts= lrintf(sync_ipts);
-
-    nb_frames= FFMIN(nb_frames, max_frames[AVMEDIA_TYPE_VIDEO] - ost->frame_number);
-    if (nb_frames <= 0)
-        return;
-
-    if (ost->video_crop) {
-        if (av_picture_crop((AVPicture *)&picture_crop_temp, (AVPicture *)in_picture, dec->pix_fmt, ost->topBand, ost->leftBand) < 0) {
-            fprintf(stderr, "error cropping picture\n");
-            if (exit_on_error)
-                av_exit(1);
-            return;
-        }
-        formatted_picture = &picture_crop_temp;
-    } else {
-        formatted_picture = in_picture;
-    }
-
-    final_picture = formatted_picture;
-    padding_src = formatted_picture;
-    resampling_dst = &ost->pict_tmp;
-    if (ost->video_pad) {
-        final_picture = &ost->pict_tmp;
-        if (ost->video_resample) {
-            if (av_picture_crop((AVPicture *)&picture_pad_temp, (AVPicture *)final_picture, enc->pix_fmt, ost->padtop, ost->padleft) < 0) {
-                fprintf(stderr, "error padding picture\n");
-                if (exit_on_error)
-                    av_exit(1);
-                return;
-            }
-            resampling_dst = &picture_pad_temp;
-        }
-    }
-
-    if(    (ost->resample_height != (ist->st->codec->height - (ost->topBand  + ost->bottomBand)))
-        || (ost->resample_width  != (ist->st->codec->width  - (ost->leftBand + ost->rightBand)))
-        || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
-
-        fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width,     ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt));
-        if(!ost->video_resample)
-            av_exit(1);
-    }
-
-    if (ost->video_resample) {
-        padding_src = NULL;
-        final_picture = &ost->pict_tmp;
-        if(  (ost->resample_height != (ist->st->codec->height - (ost->topBand  + ost->bottomBand)))
-          || (ost->resample_width  != (ist->st->codec->width  - (ost->leftBand + ost->rightBand)))
-          || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
-
-            /* keep bands proportional to the frame size */
-            topBand    = ((int64_t)ist->st->codec->height * ost->original_topBand    / ost->original_height) & ~1;
-            bottomBand = ((int64_t)ist->st->codec->height * ost->original_bottomBand / ost->original_height) & ~1;
-            leftBand   = ((int64_t)ist->st->codec->width  * ost->original_leftBand   / ost->original_width)  & ~1;
-            rightBand  = ((int64_t)ist->st->codec->width  * ost->original_rightBand  / ost->original_width)  & ~1;
-
-            /* sanity check to ensure no bad band sizes sneak in */
-            assert(topBand    <= INT_MAX && topBand    >= 0);
-            assert(bottomBand <= INT_MAX && bottomBand >= 0);
-            assert(leftBand   <= INT_MAX && leftBand   >= 0);
-            assert(rightBand  <= INT_MAX && rightBand  >= 0);
-
-            ost->topBand    = topBand;
-            ost->bottomBand = bottomBand;
-            ost->leftBand   = leftBand;
-            ost->rightBand  = rightBand;
-
-            ost->resample_height = ist->st->codec->height - (ost->topBand  + ost->bottomBand);
-            ost->resample_width  = ist->st->codec->width  - (ost->leftBand + ost->rightBand);
-            ost->resample_pix_fmt= ist->st->codec->pix_fmt;
-
-            /* initialize a new scaler context */
-            sws_freeContext(ost->img_resample_ctx);
-            sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
-            ost->img_resample_ctx = sws_getContext(
-                ist->st->codec->width  - (ost->leftBand + ost->rightBand),
-                ist->st->codec->height - (ost->topBand  + ost->bottomBand),
-                ist->st->codec->pix_fmt,
-                ost->st->codec->width  - (ost->padleft  + ost->padright),
-                ost->st->codec->height - (ost->padtop   + ost->padbottom),
-                ost->st->codec->pix_fmt,
-                sws_flags, NULL, NULL, NULL);
-            if (ost->img_resample_ctx == NULL) {
-                fprintf(stderr, "Cannot get resampling context\n");
-                av_exit(1);
-            }
-        }
-        sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize,
-              0, ost->resample_height, resampling_dst->data, resampling_dst->linesize);
-    }
-
-    if (ost->video_pad) {
-        av_picture_pad((AVPicture*)final_picture, (AVPicture *)padding_src,
-                enc->height, enc->width, enc->pix_fmt,
-                ost->padtop, ost->padbottom, ost->padleft, ost->padright, padcolor);
-    }
-
-    /* duplicates frame if needed */
-    for(i=0;i<nb_frames;i++) {
-        AVPacket pkt;
-        av_init_packet(&pkt);
-        pkt.stream_index= ost->index;
-
-        if (s->oformat->flags & AVFMT_RAWPICTURE) {
-            /* raw pictures are written as AVPicture structure to
-               avoid any copies. We support temorarily the older
-               method. */
-            AVFrame* old_frame = enc->coded_frame;
-            enc->coded_frame = dec->coded_frame; //FIXME/XXX remove this hack
-            pkt.data= (uint8_t *)final_picture;
-            pkt.size=  sizeof(AVPicture);
-            pkt.pts= av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
-            pkt.flags |= AV_PKT_FLAG_KEY;
-
-            write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
-            enc->coded_frame = old_frame;
-        } else {
-            AVFrame big_picture;
-
-            big_picture= *final_picture;
-            /* better than nothing: use input picture interlaced
-               settings */
-            big_picture.interlaced_frame = in_picture->interlaced_frame;
-            if(avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)){
-                if(top_field_first == -1)
-                    big_picture.top_field_first = in_picture->top_field_first;
-                else
-                    big_picture.top_field_first = top_field_first;
-            }
-
-            /* handles sameq here. This is not correct because it may
-               not be a global option */
-            if (same_quality) {
-                big_picture.quality = ist->st->quality;
-            }else
-                big_picture.quality = ost->st->quality;
-            if(!me_threshold)
-                big_picture.pict_type = 0;
-//            big_picture.pts = AV_NOPTS_VALUE;
-            big_picture.pts= ost->sync_opts;
-//            big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den);
-//av_log(NULL, AV_LOG_DEBUG, "%"PRId64" -> encoder\n", ost->sync_opts);
-            ret = avcodec_encode_video(enc,
-                                       bit_buffer, bit_buffer_size,
-                                       &big_picture);
-            if (ret < 0) {
-                fprintf(stderr, "Video encoding failed\n");
-                av_exit(1);
-            }
-
-            if(ret>0){
-                pkt.data= bit_buffer;
-                pkt.size= ret;
-                if(enc->coded_frame->pts != AV_NOPTS_VALUE)
-                    pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
-/*av_log(NULL, AV_LOG_DEBUG, "encoder -> %"PRId64"/%"PRId64"\n",
-   pkt.pts != AV_NOPTS_VALUE ? av_rescale(pkt.pts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1,
-   pkt.dts != AV_NOPTS_VALUE ? av_rescale(pkt.dts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1);*/
-
-                if(enc->coded_frame->key_frame)
-                    pkt.flags |= AV_PKT_FLAG_KEY;
-                write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
-                *frame_size = ret;
-                video_size += ret;
-                //fprintf(stderr,"\nFrame: %3d size: %5d type: %d",
-                //        enc->frame_number-1, ret, enc->pict_type);
-                /* if two pass, output log */
-                if (ost->logfile && enc->stats_out) {
-                    fprintf(ost->logfile, "%s", enc->stats_out);
-                }
-            }
-        }
-        ost->sync_opts++;
-        ost->frame_number++;
-    }
-}
-
-static double psnr(double d){
-    return -10.0*log(d)/log(10.0);
-}
-
-static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
-                           int frame_size)
-{
-    AVCodecContext *enc;
-    int frame_number;
-    double ti1, bitrate, avg_bitrate;
-
-    /* this is executed just the first time do_video_stats is called */
-    if (!vstats_file) {
-        vstats_file = fopen(vstats_filename, "w");
-        if (!vstats_file) {
-            perror("fopen");
-            av_exit(1);
-        }
-    }
-
-    enc = ost->st->codec;
-    if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-        frame_number = ost->frame_number;
-        fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
-        if (enc->flags&CODEC_FLAG_PSNR)
-            fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
-
-        fprintf(vstats_file,"f_size= %6d ", frame_size);
-        /* compute pts value */
-        ti1 = ost->sync_opts * av_q2d(enc->time_base);
-        if (ti1 < 0.01)
-            ti1 = 0.01;
-
-        bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0;
-        avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0;
-        fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
-            (double)video_size / 1024, ti1, bitrate, avg_bitrate);
-        fprintf(vstats_file,"type= %c\n", av_get_pict_type_char(enc->coded_frame->pict_type));
-    }
-}
-
-static void print_report(AVFormatContext **output_files,
-                         AVOutputStream **ost_table, int nb_ostreams,
-                         int is_last_report)
-{
-    char buf[1024];
-    AVOutputStream *ost;
-    AVFormatContext *oc;
-    int64_t total_size;
-    AVCodecContext *enc;
-    int frame_number, vid, i;
-    double bitrate, ti1, pts;
-    static int64_t last_time = -1;
-    static int qp_histogram[52];
-
-    if (!is_last_report) {
-        int64_t cur_time;
-        /* display the report every 0.5 seconds */
-        cur_time = av_gettime();
-        if (last_time == -1) {
-            last_time = cur_time;
-            return;
-        }
-        if ((cur_time - last_time) < 500000)
-            return;
-        last_time = cur_time;
-    }
-
-
-    oc = output_files[0];
-
-    total_size = url_fsize(oc->pb);
-    if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too
-        total_size= url_ftell(oc->pb);
-
-    buf[0] = '\0';
-    ti1 = 1e10;
-    vid = 0;
-    for(i=0;i<nb_ostreams;i++) {
-        ost = ost_table[i];
-        enc = ost->st->codec;
-        if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-            snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ",
-                     !ost->st->stream_copy ?
-                     enc->coded_frame->quality/(float)FF_QP2LAMBDA : -1);
-        }
-        if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-            float t = (av_gettime()-timer_start) / 1000000.0;
-
-            frame_number = ost->frame_number;
-            snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ",
-                     frame_number, (t>1)?(int)(frame_number/t+0.5) : 0,
-                     !ost->st->stream_copy ?
-                     enc->coded_frame->quality/(float)FF_QP2LAMBDA : -1);
-            if(is_last_report)
-                snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
-            if(qp_hist){
-                int j;
-                int qp= lrintf(enc->coded_frame->quality/(float)FF_QP2LAMBDA);
-                if(qp>=0 && qp<FF_ARRAY_ELEMS(qp_histogram))
-                    qp_histogram[qp]++;
-                for(j=0; j<32; j++)
-                    snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j]+1)/log(2)));
-            }
-            if (enc->flags&CODEC_FLAG_PSNR){
-                int j;
-                double error, error_sum=0;
-                double scale, scale_sum=0;
-                char type[3]= {'Y','U','V'};
-                snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR=");
-                for(j=0; j<3; j++){
-                    if(is_last_report){
-                        error= enc->error[j];
-                        scale= enc->width*enc->height*255.0*255.0*frame_number;
-                    }else{
-                        error= enc->coded_frame->error[j];
-                        scale= enc->width*enc->height*255.0*255.0;
-                    }
-                    if(j) scale/=4;
-                    error_sum += error;
-                    scale_sum += scale;
-                    snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], psnr(error/scale));
-                }
-                snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum/scale_sum));
-            }
-            vid = 1;
-        }
-        /* compute min output value */
-        pts = (double)ost->st->pts.val * av_q2d(ost->st->time_base);
-        if ((pts < ti1) && (pts > 0))
-            ti1 = pts;
-    }
-    if (ti1 < 0.01)
-        ti1 = 0.01;
-
-    if (verbose || is_last_report) {
-        bitrate = (double)(total_size * 8) / ti1 / 1000.0;
-
-        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
-            "size=%8.0fkB time=%0.2f bitrate=%6.1fkbits/s",
-            (double)total_size / 1024, ti1, bitrate);
-
-        if (nb_frames_dup || nb_frames_drop)
-          snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d",
-                  nb_frames_dup, nb_frames_drop);
-
-        if (verbose >= 0)
-            fprintf(stderr, "%s    \r", buf);
-
-        fflush(stderr);
-    }
-
-    if (is_last_report && verbose >= 0){
-        int64_t raw= audio_size + video_size + extra_size;
-        fprintf(stderr, "\n");
-        fprintf(stderr, "video:%1.0fkB audio:%1.0fkB global headers:%1.0fkB muxing overhead %f%%\n",
-                video_size/1024.0,
-                audio_size/1024.0,
-                extra_size/1024.0,
-                100.0*(total_size - raw)/raw
-        );
-    }
-}
-
-/* pkt = NULL means EOF (needed to flush decoder buffers) */
-static int output_packet(AVInputStream *ist, int ist_index,
-                         AVOutputStream **ost_table, int nb_ostreams,
-                         const AVPacket *pkt)
-{
-    AVFormatContext *os;
-    AVOutputStream *ost;
-    int ret, i;
-    int got_picture;
-    AVFrame picture;
-    void *buffer_to_free;
-    static unsigned int samples_size= 0;
-    AVSubtitle subtitle, *subtitle_to_free;
-    int got_subtitle;
-    AVPacket avpkt;
-    int bps = av_get_bits_per_sample_format(ist->st->codec->sample_fmt)>>3;
-
-    if(ist->next_pts == AV_NOPTS_VALUE)
-        ist->next_pts= ist->pts;
-
-    if (pkt == NULL) {
-        /* EOF handling */
-        av_init_packet(&avpkt);
-        avpkt.data = NULL;
-        avpkt.size = 0;
-        goto handle_eof;
-    } else {
-        avpkt = *pkt;
-    }
-
-    if(pkt->dts != AV_NOPTS_VALUE)
-        ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
-
-    //while we have more to decode or while the decoder did output something on EOF
-    while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) {
-        uint8_t *data_buf, *decoded_data_buf;
-        int data_size, decoded_data_size;
-    handle_eof:
-        ist->pts= ist->next_pts;
-
-        if(avpkt.size && avpkt.size != pkt->size &&
-           ((!ist->showed_multi_packet_warning && verbose>0) || verbose>1)){
-            fprintf(stderr, "Multiple frames in a packet from stream %d\n", pkt->stream_index);
-            ist->showed_multi_packet_warning=1;
-        }
-
-        /* decode the packet if needed */
-        decoded_data_buf = NULL; /* fail safe */
-        decoded_data_size= 0;
-        data_buf  = avpkt.data;
-        data_size = avpkt.size;
-        subtitle_to_free = NULL;
-        if (ist->decoding_needed) {
-            switch(ist->st->codec->codec_type) {
-            case AVMEDIA_TYPE_AUDIO:{
-                if(pkt && samples_size < FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
-                    samples_size = FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE);
-                    av_free(samples);
-                    samples= av_malloc(samples_size);
-                }
-                decoded_data_size= samples_size;
-                    /* XXX: could avoid copy if PCM 16 bits with same
-                       endianness as CPU */
-                ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size,
-                                            &avpkt);
-                if (ret < 0)
-                    goto fail_decode;
-                avpkt.data += ret;
-                avpkt.size -= ret;
-                data_size   = ret;
-                /* Some bug in mpeg audio decoder gives */
-                /* decoded_data_size < 0, it seems they are overflows */
-                if (decoded_data_size <= 0) {
-                    /* no audio frame */
-                    continue;
-                }
-                decoded_data_buf = (uint8_t *)samples;
-                ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) /
-                    (ist->st->codec->sample_rate * ist->st->codec->channels);
-                break;}
-            case AVMEDIA_TYPE_VIDEO:
-                    decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
-                    /* XXX: allocate picture correctly */
-                    avcodec_get_frame_defaults(&picture);
-
-                    ret = avcodec_decode_video2(ist->st->codec,
-                                                &picture, &got_picture, &avpkt);
-                    ist->st->quality= picture.quality;
-                    if (ret < 0)
-                        goto fail_decode;
-                    if (!got_picture) {
-                        /* no picture yet */
-                        goto discard_packet;
-                    }
-                    if (ist->st->codec->time_base.num != 0) {
-                        int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
-                        ist->next_pts += ((int64_t)AV_TIME_BASE *
-                                          ist->st->codec->time_base.num * ticks) /
-                            ist->st->codec->time_base.den;
-                    }
-                    avpkt.size = 0;
-                    break;
-            case AVMEDIA_TYPE_SUBTITLE:
-                ret = avcodec_decode_subtitle2(ist->st->codec,
-                                               &subtitle, &got_subtitle, &avpkt);
-                if (ret < 0)
-                    goto fail_decode;
-                if (!got_subtitle) {
-                    goto discard_packet;
-                }
-                subtitle_to_free = &subtitle;
-                avpkt.size = 0;
-                break;
-            default:
-                goto fail_decode;
-            }
-        } else {
-            switch(ist->st->codec->codec_type) {
-            case AVMEDIA_TYPE_AUDIO:
-                ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
-                    ist->st->codec->sample_rate;
-                break;
-            case AVMEDIA_TYPE_VIDEO:
-                if (ist->st->codec->time_base.num != 0) {
-                    int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
-                    ist->next_pts += ((int64_t)AV_TIME_BASE *
-                                      ist->st->codec->time_base.num * ticks) /
-                        ist->st->codec->time_base.den;
-                }
-                break;
-            }
-            ret = avpkt.size;
-            avpkt.size = 0;
-        }
-
-        buffer_to_free = NULL;
-        if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            pre_process_video_frame(ist, (AVPicture *)&picture,
-                                    &buffer_to_free);
-        }
-
-        // preprocess audio (volume)
-        if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if (audio_volume != 256) {
-                short *volp;
-                volp = samples;
-                for(i=0;i<(decoded_data_size / sizeof(short));i++) {
-                    int v = ((*volp) * audio_volume + 128) >> 8;
-                    if (v < -32768) v = -32768;
-                    if (v >  32767) v = 32767;
-                    *volp++ = v;
-                }
-            }
-        }
-
-        /* frame rate emulation */
-        if (rate_emu) {
-            int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE);
-            int64_t now = av_gettime() - ist->start;
-            if (pts > now)
-                usleep(pts - now);
-        }
-
-        /* if output time reached then transcode raw format,
-           encode packets and output them */
-        if (start_time == 0 || ist->pts >= start_time)
-            for(i=0;i<nb_ostreams;i++) {
-                int frame_size;
-
-                ost = ost_table[i];
-                if (ost->source_index == ist_index) {
-                    os = output_files[ost->file_index];
-
-                    /* set the input output pts pairs */
-                    //ost->sync_ipts = (double)(ist->pts + input_files_ts_offset[ist->file_index] - start_time)/ AV_TIME_BASE;
-
-                    if (ost->encoding_needed) {
-                        assert(ist->decoding_needed);
-                        switch(ost->st->codec->codec_type) {
-                        case AVMEDIA_TYPE_AUDIO:
-                            do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size);
-                            break;
-                        case AVMEDIA_TYPE_VIDEO:
-                            do_video_out(os, ost, ist, &picture, &frame_size);
-                            if (vstats_filename && frame_size)
-                                do_video_stats(os, ost, frame_size);
-                            break;
-                        case AVMEDIA_TYPE_SUBTITLE:
-                            do_subtitle_out(os, ost, ist, &subtitle,
-                                            pkt->pts);
-                            break;
-                        default:
-                            abort();
-                        }
-                    } else {
-                        AVFrame avframe; //FIXME/XXX remove this
-                        AVPacket opkt;
-                        int64_t ost_tb_start_time= av_rescale_q(start_time, AV_TIME_BASE_Q, ost->st->time_base);
-
-                        av_init_packet(&opkt);
-
-                        if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && !copy_initial_nonkeyframes)
-                            continue;
-
-                        /* no reencoding needed : output the packet directly */
-                        /* force the input stream PTS */
-
-                        avcodec_get_frame_defaults(&avframe);
-                        ost->st->codec->coded_frame= &avframe;
-                        avframe.key_frame = pkt->flags & AV_PKT_FLAG_KEY;
-
-                        if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
-                            audio_size += data_size;
-                        else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-                            video_size += data_size;
-                            ost->sync_opts++;
-                        }
-
-                        opkt.stream_index= ost->index;
-                        if(pkt->pts != AV_NOPTS_VALUE)
-                            opkt.pts= av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time;
-                        else
-                            opkt.pts= AV_NOPTS_VALUE;
-
-                        if (pkt->dts == AV_NOPTS_VALUE)
-                            opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base);
-                        else
-                            opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base);
-                        opkt.dts -= ost_tb_start_time;
-
-                        opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base);
-                        opkt.flags= pkt->flags;
-
-                        //FIXME remove the following 2 lines they shall be replaced by the bitstream filters
-                        if(   ost->st->codec->codec_id != CODEC_ID_H264
-                           && ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO
-                           && ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO
-                           ) {
-                            if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & AV_PKT_FLAG_KEY))
-                                opkt.destruct= av_destruct_packet;
-                        } else {
-                            opkt.data = data_buf;
-                            opkt.size = data_size;
-                        }
-
-                        write_frame(os, &opkt, ost->st->codec, bitstream_filters[ost->file_index][opkt.stream_index]);
-                        ost->st->codec->frame_number++;
-                        ost->frame_number++;
-                        av_free_packet(&opkt);
-                    }
-                }
-            }
-        av_free(buffer_to_free);
-        /* XXX: allocate the subtitles in the codec ? */
-        if (subtitle_to_free) {
-            if (subtitle_to_free->rects != NULL) {
-                for (i = 0; i < subtitle_to_free->num_rects; i++) {
-                    av_freep(&subtitle_to_free->rects[i]->pict.data[0]);
-                    av_freep(&subtitle_to_free->rects[i]->pict.data[1]);
-                    av_freep(&subtitle_to_free->rects[i]);
-                }
-                av_freep(&subtitle_to_free->rects);
-            }
-            subtitle_to_free->num_rects = 0;
-            subtitle_to_free = NULL;
-        }
-    }
- discard_packet:
-    if (pkt == NULL) {
-        /* EOF handling */
-
-        for(i=0;i<nb_ostreams;i++) {
-            ost = ost_table[i];
-            if (ost->source_index == ist_index) {
-                AVCodecContext *enc= ost->st->codec;
-                os = output_files[ost->file_index];
-
-                if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1)
-                    continue;
-                if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
-                    continue;
-
-                if (ost->encoding_needed) {
-                    for(;;) {
-                        AVPacket pkt;
-                        int fifo_bytes;
-                        av_init_packet(&pkt);
-                        pkt.stream_index= ost->index;
-
-                        switch(ost->st->codec->codec_type) {
-                        case AVMEDIA_TYPE_AUDIO:
-                            fifo_bytes = av_fifo_size(ost->fifo);
-                            ret = 0;
-                            /* encode any samples remaining in fifo */
-                            if (fifo_bytes > 0) {
-                                int osize = av_get_bits_per_sample_format(enc->sample_fmt) >> 3;
-                                int fs_tmp = enc->frame_size;
-
-                                av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL);
-                                if (enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
-                                    enc->frame_size = fifo_bytes / (osize * enc->channels);
-                                } else { /* pad */
-                                    int frame_bytes = enc->frame_size*osize*enc->channels;
-                                    if (samples_size < frame_bytes)
-                                        av_exit(1);
-                                    memset((uint8_t*)samples+fifo_bytes, 0, frame_bytes - fifo_bytes);
-                                }
-
-                                ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
-                                pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,
-                                                          ost->st->time_base.num, enc->sample_rate);
-                                enc->frame_size = fs_tmp;
-                            }
-                            if(ret <= 0) {
-                                ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, NULL);
-                            }
-                            if (ret < 0) {
-                                fprintf(stderr, "Audio encoding failed\n");
-                                av_exit(1);
-                            }
-                            audio_size += ret;
-                            pkt.flags |= AV_PKT_FLAG_KEY;
-                            break;
-                        case AVMEDIA_TYPE_VIDEO:
-                            ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
-                            if (ret < 0) {
-                                fprintf(stderr, "Video encoding failed\n");
-                                av_exit(1);
-                            }
-                            video_size += ret;
-                            if(enc->coded_frame && enc->coded_frame->key_frame)
-                                pkt.flags |= AV_PKT_FLAG_KEY;
-                            if (ost->logfile && enc->stats_out) {
-                                fprintf(ost->logfile, "%s", enc->stats_out);
-                            }
-                            break;
-                        default:
-                            ret=-1;
-                        }
-
-                        if(ret<=0)
-                            break;
-                        pkt.data= bit_buffer;
-                        pkt.size= ret;
-                        if(enc->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
-                            pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
-                        write_frame(os, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
-                    }
-                }
-            }
-        }
-    }
-
-    return 0;
- fail_decode:
-    return -1;
-}
-
-static void print_sdp(AVFormatContext **avc, int n)
-{
-    char sdp[2048];
-
-    avf_sdp_create(avc, n, sdp, sizeof(sdp));
-    printf("SDP:\n%s\n", sdp);
-    fflush(stdout);
-}
-
-static int copy_chapters(int infile, int outfile)
-{
-    AVFormatContext *is = input_files[infile];
-    AVFormatContext *os = output_files[outfile];
-    int i;
-
-    for (i = 0; i < is->nb_chapters; i++) {
-        AVChapter *in_ch = is->chapters[i], *out_ch;
-        AVMetadataTag *t = NULL;
-        int64_t ts_off   = av_rescale_q(start_time - input_files_ts_offset[infile],
-                                      AV_TIME_BASE_Q, in_ch->time_base);
-        int64_t rt       = (recording_time == INT64_MAX) ? INT64_MAX :
-                           av_rescale_q(recording_time, AV_TIME_BASE_Q, in_ch->time_base);
-
-
-        if (in_ch->end < ts_off)
-            continue;
-        if (rt != INT64_MAX && in_ch->start > rt + ts_off)
-            break;
-
-        out_ch = av_mallocz(sizeof(AVChapter));
-        if (!out_ch)
-            return AVERROR(ENOMEM);
-
-        out_ch->id        = in_ch->id;
-        out_ch->time_base = in_ch->time_base;
-        out_ch->start     = FFMAX(0,  in_ch->start - ts_off);
-        out_ch->end       = FFMIN(rt, in_ch->end   - ts_off);
-
-        while ((t = av_metadata_get(in_ch->metadata, "", t, AV_METADATA_IGNORE_SUFFIX)))
-            av_metadata_set2(&out_ch->metadata, t->key, t->value, 0);
-
-        os->nb_chapters++;
-        os->chapters = av_realloc(os->chapters, sizeof(AVChapter)*os->nb_chapters);
-        if (!os->chapters)
-            return AVERROR(ENOMEM);
-        os->chapters[os->nb_chapters - 1] = out_ch;
-    }
-    return 0;
-}
-
-/*
- * The following code is the main loop of the file converter
- */
-static int av_transcode(AVFormatContext **output_files,
-                        int nb_output_files,
-                        AVFormatContext **input_files,
-                        int nb_input_files,
-                        AVStreamMap *stream_maps, int nb_stream_maps)
-{
-    int ret = 0, i, j, k, n, nb_istreams = 0, nb_ostreams = 0;
-    AVFormatContext *is, *os;
-    AVCodecContext *codec, *icodec;
-    AVOutputStream *ost, **ost_table = NULL;
-    AVInputStream *ist, **ist_table = NULL;
-    AVInputFile *file_table;
-    char error[1024];
-    int key;
-    int want_sdp = 1;
-    uint8_t no_packet[MAX_FILES]={0};
-    int no_packet_count=0;
-
-    file_table= av_mallocz(nb_input_files * sizeof(AVInputFile));
-    if (!file_table)
-        goto fail;
-
-    /* input stream init */
-    j = 0;
-    for(i=0;i<nb_input_files;i++) {
-        is = input_files[i];
-        file_table[i].ist_index = j;
-        file_table[i].nb_streams = is->nb_streams;
-        j += is->nb_streams;
-    }
-    nb_istreams = j;
-
-    ist_table = av_mallocz(nb_istreams * sizeof(AVInputStream *));
-    if (!ist_table)
-        goto fail;
-
-    for(i=0;i<nb_istreams;i++) {
-        ist = av_mallocz(sizeof(AVInputStream));
-        if (!ist)
-            goto fail;
-        ist_table[i] = ist;
-    }
-    j = 0;
-    for(i=0;i<nb_input_files;i++) {
-        is = input_files[i];
-        for(k=0;k<is->nb_streams;k++) {
-            ist = ist_table[j++];
-            ist->st = is->streams[k];
-            ist->file_index = i;
-            ist->index = k;
-            ist->discard = 1; /* the stream is discarded by default
-                                 (changed later) */
-
-            if (rate_emu) {
-                ist->start = av_gettime();
-            }
-        }
-    }
-
-    /* output stream init */
-    nb_ostreams = 0;
-    for(i=0;i<nb_output_files;i++) {
-        os = output_files[i];
-        if (!os->nb_streams) {
-            dump_format(output_files[i], i, output_files[i]->filename, 1);
-            fprintf(stderr, "Output file #%d does not contain any stream\n", i);
-            av_exit(1);
-        }
-        nb_ostreams += os->nb_streams;
-    }
-    if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) {
-        fprintf(stderr, "Number of stream maps must match number of output streams\n");
-        av_exit(1);
-    }
-
-    /* Sanity check the mapping args -- do the input files & streams exist? */
-    for(i=0;i<nb_stream_maps;i++) {
-        int fi = stream_maps[i].file_index;
-        int si = stream_maps[i].stream_index;
-
-        if (fi < 0 || fi > nb_input_files - 1 ||
-            si < 0 || si > file_table[fi].nb_streams - 1) {
-            fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si);
-            av_exit(1);
-        }
-        fi = stream_maps[i].sync_file_index;
-        si = stream_maps[i].sync_stream_index;
-        if (fi < 0 || fi > nb_input_files - 1 ||
-            si < 0 || si > file_table[fi].nb_streams - 1) {
-            fprintf(stderr,"Could not find sync stream #%d.%d\n", fi, si);
-            av_exit(1);
-        }
-    }
-
-    ost_table = av_mallocz(sizeof(AVOutputStream *) * nb_ostreams);
-    if (!ost_table)
-        goto fail;
-    for(i=0;i<nb_ostreams;i++) {
-        ost = av_mallocz(sizeof(AVOutputStream));
-        if (!ost)
-            goto fail;
-        ost_table[i] = ost;
-    }
-
-    n = 0;
-    for(k=0;k<nb_output_files;k++) {
-        os = output_files[k];
-        for(i=0;i<os->nb_streams;i++,n++) {
-            int found;
-            ost = ost_table[n];
-            ost->file_index = k;
-            ost->index = i;
-            ost->st = os->streams[i];
-            if (nb_stream_maps > 0) {
-                ost->source_index = file_table[stream_maps[n].file_index].ist_index +
-                    stream_maps[n].stream_index;
-
-                /* Sanity check that the stream types match */
-                if (ist_table[ost->source_index]->st->codec->codec_type != ost->st->codec->codec_type) {
-                    int i= ost->file_index;
-                    dump_format(output_files[i], i, output_files[i]->filename, 1);
-                    fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
-                        stream_maps[n].file_index, stream_maps[n].stream_index,
-                        ost->file_index, ost->index);
-                    av_exit(1);
-                }
-
-            } else {
-                int best_nb_frames=-1;
-                    /* get corresponding input stream index : we select the first one with the right type */
-                    found = 0;
-                    for(j=0;j<nb_istreams;j++) {
-                        int skip=0;
-                        ist = ist_table[j];
-                        if(opt_programid){
-                            int pi,si;
-                            AVFormatContext *f= input_files[ ist->file_index ];
-                            skip=1;
-                            for(pi=0; pi<f->nb_programs; pi++){
-                                AVProgram *p= f->programs[pi];
-                                if(p->id == opt_programid)
-                                    for(si=0; si<p->nb_stream_indexes; si++){
-                                        if(f->streams[ p->stream_index[si] ] == ist->st)
-                                            skip=0;
-                                    }
-                            }
-                        }
-                        if (ist->discard && ist->st->discard != AVDISCARD_ALL && !skip &&
-                            ist->st->codec->codec_type == ost->st->codec->codec_type) {
-                            if(best_nb_frames < ist->st->codec_info_nb_frames){
-                                best_nb_frames= ist->st->codec_info_nb_frames;
-                                ost->source_index = j;
-                                found = 1;
-                            }
-                        }
-                    }
-
-                if (!found) {
-                    if(! opt_programid) {
-                        /* try again and reuse existing stream */
-                        for(j=0;j<nb_istreams;j++) {
-                            ist = ist_table[j];
-                            if (   ist->st->codec->codec_type == ost->st->codec->codec_type
-                                && ist->st->discard != AVDISCARD_ALL) {
-                                ost->source_index = j;
-                                found = 1;
-                            }
-                        }
-                    }
-                    if (!found) {
-                        int i= ost->file_index;
-                        dump_format(output_files[i], i, output_files[i]->filename, 1);
-                        fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n",
-                                ost->file_index, ost->index);
-                        av_exit(1);
-                    }
-                }
-            }
-            ist = ist_table[ost->source_index];
-            ist->discard = 0;
-            ost->sync_ist = (nb_stream_maps > 0) ?
-                ist_table[file_table[stream_maps[n].sync_file_index].ist_index +
-                         stream_maps[n].sync_stream_index] : ist;
-        }
-    }
-
-    /* for each output stream, we compute the right encoding parameters */
-    for(i=0;i<nb_ostreams;i++) {
-        AVMetadataTag *t = NULL;
-        ost = ost_table[i];
-        os = output_files[ost->file_index];
-        ist = ist_table[ost->source_index];
-
-        codec = ost->st->codec;
-        icodec = ist->st->codec;
-
-        while ((t = av_metadata_get(ist->st->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
-            av_metadata_set2(&ost->st->metadata, t->key, t->value, AV_METADATA_DONT_OVERWRITE);
-        }
-
-        ost->st->disposition = ist->st->disposition;
-        codec->bits_per_raw_sample= icodec->bits_per_raw_sample;
-        codec->chroma_sample_location = icodec->chroma_sample_location;
-
-        if (ost->st->stream_copy) {
-            /* if stream_copy is selected, no need to decode or encode */
-            codec->codec_id = icodec->codec_id;
-            codec->codec_type = icodec->codec_type;
-
-            if(!codec->codec_tag){
-                if(   !os->oformat->codec_tag
-                   || av_codec_get_id (os->oformat->codec_tag, icodec->codec_tag) == codec->codec_id
-                   || av_codec_get_tag(os->oformat->codec_tag, icodec->codec_id) <= 0)
-                    codec->codec_tag = icodec->codec_tag;
-            }
-
-            codec->bit_rate = icodec->bit_rate;
-            codec->extradata= icodec->extradata;
-            codec->extradata_size= icodec->extradata_size;
-            if(av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){
-                codec->time_base = icodec->time_base;
-                codec->time_base.num *= icodec->ticks_per_frame;
-            }else
-                codec->time_base = ist->st->time_base;
-            switch(codec->codec_type) {
-            case AVMEDIA_TYPE_AUDIO:
-                if(audio_volume != 256) {
-                    fprintf(stderr,"-acodec copy and -vol are incompatible (frames are not decoded)\n");
-                    av_exit(1);
-                }
-                codec->channel_layout = icodec->channel_layout;
-                codec->sample_rate = icodec->sample_rate;
-                codec->channels = icodec->channels;
-                codec->frame_size = icodec->frame_size;
-                codec->block_align= icodec->block_align;
-                if(codec->block_align == 1 && codec->codec_id == CODEC_ID_MP3)
-                    codec->block_align= 0;
-                if(codec->codec_id == CODEC_ID_AC3)
-                    codec->block_align= 0;
-                break;
-            case AVMEDIA_TYPE_VIDEO:
-                codec->pix_fmt = icodec->pix_fmt;
-                codec->width = icodec->width;
-                codec->height = icodec->height;
-                codec->has_b_frames = icodec->has_b_frames;
-                break;
-            case AVMEDIA_TYPE_SUBTITLE:
-                codec->width = icodec->width;
-                codec->height = icodec->height;
-                break;
-            default:
-                abort();
-            }
-        } else {
-            switch(codec->codec_type) {
-            case AVMEDIA_TYPE_AUDIO:
-                ost->fifo= av_fifo_alloc(1024);
-                if(!ost->fifo)
-                    goto fail;
-                ost->reformat_pair = MAKE_SFMT_PAIR(SAMPLE_FMT_NONE,SAMPLE_FMT_NONE);
-                ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1;
-                icodec->request_channels = codec->channels;
-                ist->decoding_needed = 1;
-                ost->encoding_needed = 1;
-                break;
-            case AVMEDIA_TYPE_VIDEO:
-                if (ost->st->codec->pix_fmt == PIX_FMT_NONE) {
-                    fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n");
-                    av_exit(1);
-                }
-                ost->video_crop = ((frame_leftBand + frame_rightBand + frame_topBand + frame_bottomBand) != 0);
-                ost->video_pad = ((frame_padleft + frame_padright + frame_padtop + frame_padbottom) != 0);
-                ost->video_resample = ((codec->width != icodec->width -
-                                (frame_leftBand + frame_rightBand) +
-                                (frame_padleft + frame_padright)) ||
-                        (codec->height != icodec->height -
-                                (frame_topBand  + frame_bottomBand) +
-                                (frame_padtop + frame_padbottom)) ||
-                        (codec->pix_fmt != icodec->pix_fmt));
-                if (ost->video_crop) {
-                    ost->topBand    = ost->original_topBand    = frame_topBand;
-                    ost->bottomBand = ost->original_bottomBand = frame_bottomBand;
-                    ost->leftBand   = ost->original_leftBand   = frame_leftBand;
-                    ost->rightBand  = ost->original_rightBand  = frame_rightBand;
-                }
-                if (ost->video_pad) {
-                    ost->padtop = frame_padtop;
-                    ost->padleft = frame_padleft;
-                    ost->padbottom = frame_padbottom;
-                    ost->padright = frame_padright;
-                    if (!ost->video_resample) {
-                        avcodec_get_frame_defaults(&ost->pict_tmp);
-                        if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
-                                         codec->width, codec->height))
-                            goto fail;
-                    }
-                }
-                if (ost->video_resample) {
-                    avcodec_get_frame_defaults(&ost->pict_tmp);
-                    if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
-                                         codec->width, codec->height)) {
-                        fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
-                        av_exit(1);
-                    }
-                    sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
-                    ost->img_resample_ctx = sws_getContext(
-                            icodec->width - (frame_leftBand + frame_rightBand),
-                            icodec->height - (frame_topBand + frame_bottomBand),
-                            icodec->pix_fmt,
-                            codec->width - (frame_padleft + frame_padright),
-                            codec->height - (frame_padtop + frame_padbottom),
-                            codec->pix_fmt,
-                            sws_flags, NULL, NULL, NULL);
-                    if (ost->img_resample_ctx == NULL) {
-                        fprintf(stderr, "Cannot get resampling context\n");
-                        av_exit(1);
-                    }
-
-                    ost->original_height = icodec->height;
-                    ost->original_width  = icodec->width;
-
-                    codec->bits_per_raw_sample= 0;
-                }
-                ost->resample_height = icodec->height - (frame_topBand  + frame_bottomBand);
-                ost->resample_width  = icodec->width  - (frame_leftBand + frame_rightBand);
-                ost->resample_pix_fmt= icodec->pix_fmt;
-                ost->encoding_needed = 1;
-                ist->decoding_needed = 1;
-                break;
-            case AVMEDIA_TYPE_SUBTITLE:
-                ost->encoding_needed = 1;
-                ist->decoding_needed = 1;
-                break;
-            default:
-                abort();
-                break;
-            }
-            /* two pass mode */
-            if (ost->encoding_needed &&
-                (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
-                char logfilename[1024];
-                FILE *f;
-
-                snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
-                         pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
-                         i);
-                if (codec->flags & CODEC_FLAG_PASS1) {
-                    f = fopen(logfilename, "wb");
-                    if (!f) {
-                        fprintf(stderr, "Cannot write log file '%s' for pass-1 encoding: %s\n", logfilename, strerror(errno));
-                        av_exit(1);
-                    }
-                    ost->logfile = f;
-                } else {
-                    char  *logbuffer;
-                    size_t logbuffer_size;
-                    if (read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
-                        fprintf(stderr, "Error reading log file '%s' for pass-2 encoding\n", logfilename);
-                        av_exit(1);
-                    }
-                    codec->stats_in = logbuffer;
-                }
-            }
-        }
-        if(codec->codec_type == AVMEDIA_TYPE_VIDEO){
-            int size= codec->width * codec->height;
-            bit_buffer_size= FFMAX(bit_buffer_size, 6*size + 200);
-        }
-    }
-
-    if (!bit_buffer)
-        bit_buffer = av_malloc(bit_buffer_size);
-    if (!bit_buffer) {
-        fprintf(stderr, "Cannot allocate %d bytes output buffer\n",
-                bit_buffer_size);
-        ret = AVERROR(ENOMEM);
-        goto fail;
-    }
-
-    /* open each encoder */
-    for(i=0;i<nb_ostreams;i++) {
-        ost = ost_table[i];
-        if (ost->encoding_needed) {
-            AVCodec *codec = output_codecs[i];
-            if (!codec)
-                codec = avcodec_find_encoder(ost->st->codec->codec_id);
-            if (!codec) {
-                snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d.%d",
-                         ost->st->codec->codec_id, ost->file_index, ost->index);
-                ret = AVERROR(EINVAL);
-                goto dump_format;
-            }
-            if (avcodec_open(ost->st->codec, codec) < 0) {
-                snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height",
-                        ost->file_index, ost->index);
-                ret = AVERROR(EINVAL);
-                goto dump_format;
-            }
-            extra_size += ost->st->codec->extradata_size;
-        }
-    }
-
-    /* open each decoder */
-    for(i=0;i<nb_istreams;i++) {
-        ist = ist_table[i];
-        if (ist->decoding_needed) {
-            AVCodec *codec = input_codecs[i];
-            if (!codec)
-                codec = avcodec_find_decoder(ist->st->codec->codec_id);
-            if (!codec) {
-                snprintf(error, sizeof(error), "Decoder (codec id %d) not found for input stream #%d.%d",
-                        ist->st->codec->codec_id, ist->file_index, ist->index);
-                ret = AVERROR(EINVAL);
-                goto dump_format;
-            }
-            if (avcodec_open(ist->st->codec, codec) < 0) {
-                snprintf(error, sizeof(error), "Error while opening decoder for input stream #%d.%d",
-                        ist->file_index, ist->index);
-                ret = AVERROR(EINVAL);
-                goto dump_format;
-            }
-            //if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-            //    ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD;
-        }
-    }
-
-    /* init pts */
-    for(i=0;i<nb_istreams;i++) {
-        AVStream *st;
-        ist = ist_table[i];
-        st= ist->st;
-        ist->pts = st->avg_frame_rate.num ? - st->codec->has_b_frames*AV_TIME_BASE / av_q2d(st->avg_frame_rate) : 0;
-        ist->next_pts = AV_NOPTS_VALUE;
-        ist->is_start = 1;
-    }
-
-    /* set meta data information from input file if required */
-    for (i=0;i<nb_meta_data_maps;i++) {
-        AVFormatContext *out_file;
-        AVFormatContext *in_file;
-        AVMetadataTag *mtag;
-
-        int out_file_index = meta_data_maps[i].out_file;
-        int in_file_index = meta_data_maps[i].in_file;
-        if (out_file_index < 0 || out_file_index >= nb_output_files) {
-            snprintf(error, sizeof(error), "Invalid output file index %d map_meta_data(%d,%d)",
-                     out_file_index, out_file_index, in_file_index);
-            ret = AVERROR(EINVAL);
-            goto dump_format;
-        }
-        if (in_file_index < 0 || in_file_index >= nb_input_files) {
-            snprintf(error, sizeof(error), "Invalid input file index %d map_meta_data(%d,%d)",
-                     in_file_index, out_file_index, in_file_index);
-            ret = AVERROR(EINVAL);
-            goto dump_format;
-        }
-
-        out_file = output_files[out_file_index];
-        in_file = input_files[in_file_index];
-
-
-        mtag=NULL;
-        while((mtag=av_metadata_get(in_file->metadata, "", mtag, AV_METADATA_IGNORE_SUFFIX)))
-            av_metadata_set2(&out_file->metadata, mtag->key, mtag->value, AV_METADATA_DONT_OVERWRITE);
-        av_metadata_conv(out_file, out_file->oformat->metadata_conv,
-                                    in_file->iformat->metadata_conv);
-    }
-
-    /* copy chapters from the first input file that has them*/
-    for (i = 0; i < nb_input_files; i++) {
-        if (!input_files[i]->nb_chapters)
-            continue;
-
-        for (j = 0; j < nb_output_files; j++)
-            if ((ret = copy_chapters(i, j)) < 0)
-                goto dump_format;
-    }
-
-    /* open files and write file headers */
-    for(i=0;i<nb_output_files;i++) {
-        os = output_files[i];
-        if (av_write_header(os) < 0) {
-            snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
-            ret = AVERROR(EINVAL);
-            goto dump_format;
-        }
-        if (strcmp(output_files[i]->oformat->name, "rtp")) {
-            want_sdp = 0;
-        }
-    }
-
- dump_format:
-    /* dump the file output parameters - cannot be done before in case
-       of stream copy */
-    for(i=0;i<nb_output_files;i++) {
-        dump_format(output_files[i], i, output_files[i]->filename, 1);
-    }
-
-    /* dump the stream mapping */
-    if (verbose >= 0) {
-        fprintf(stderr, "Stream mapping:\n");
-        for(i=0;i<nb_ostreams;i++) {
-            ost = ost_table[i];
-            fprintf(stderr, "  Stream #%d.%d -> #%d.%d",
-                    ist_table[ost->source_index]->file_index,
-                    ist_table[ost->source_index]->index,
-                    ost->file_index,
-                    ost->index);
-            if (ost->sync_ist != ist_table[ost->source_index])
-                fprintf(stderr, " [sync #%d.%d]",
-                        ost->sync_ist->file_index,
-                        ost->sync_ist->index);
-            fprintf(stderr, "\n");
-        }
-    }
-
-    if (ret) {
-        fprintf(stderr, "%s\n", error);
-        goto fail;
-    }
-
-    if (want_sdp) {
-        print_sdp(output_files, nb_output_files);
-    }
-
-    if (!using_stdin && verbose >= 0) {
-        fprintf(stderr, "Press [q] to stop encoding\n");
-        url_set_interrupt_cb(decode_interrupt_cb);
-    }
-    term_init();
-
-    timer_start = av_gettime();
-
-    for(; received_sigterm == 0;) {
-        int file_index, ist_index;
-        AVPacket pkt;
-        double ipts_min;
-        double opts_min;
-
-    redo:
-        ipts_min= 1e100;
-        opts_min= 1e100;
-        /* if 'q' pressed, exits */
-        if (!using_stdin) {
-            if (q_pressed)
-                break;
-            /* read_key() returns 0 on EOF */
-            key = read_key();
-            if (key == 'q')
-                break;
-        }
-
-        /* select the stream that we must read now by looking at the
-           smallest output pts */
-        file_index = -1;
-        for(i=0;i<nb_ostreams;i++) {
-            double ipts, opts;
-            ost = ost_table[i];
-            os = output_files[ost->file_index];
-            ist = ist_table[ost->source_index];
-            if(ist->is_past_recording_time || no_packet[ist->file_index])
-                continue;
-                opts = ost->st->pts.val * av_q2d(ost->st->time_base);
-            ipts = (double)ist->pts;
-            if (!file_table[ist->file_index].eof_reached){
-                if(ipts < ipts_min) {
-                    ipts_min = ipts;
-                    if(input_sync ) file_index = ist->file_index;
-                }
-                if(opts < opts_min) {
-                    opts_min = opts;
-                    if(!input_sync) file_index = ist->file_index;
-                }
-            }
-            if(ost->frame_number >= max_frames[ost->st->codec->codec_type]){
-                file_index= -1;
-                break;
-            }
-        }
-        /* if none, if is finished */
-        if (file_index < 0) {
-            if(no_packet_count){
-                no_packet_count=0;
-                memset(no_packet, 0, sizeof(no_packet));
-                usleep(10000);
-                continue;
-            }
-            break;
-        }
-
-        /* finish if limit size exhausted */
-        if (limit_filesize != 0 && limit_filesize < url_ftell(output_files[0]->pb))
-            break;
-
-        /* read a frame from it and output it in the fifo */
-        is = input_files[file_index];
-        ret= av_read_frame(is, &pkt);
-        if(ret == AVERROR(EAGAIN)){
-            no_packet[file_index]=1;
-            no_packet_count++;
-            continue;
-        }
-        if (ret < 0) {
-            file_table[file_index].eof_reached = 1;
-            if (opt_shortest)
-                break;
-            else
-                continue;
-        }
-
-        no_packet_count=0;
-        memset(no_packet, 0, sizeof(no_packet));
-
-        if (do_pkt_dump) {
-            av_pkt_dump_log(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump);
-        }
-        /* the following test is needed in case new streams appear
-           dynamically in stream : we ignore them */
-        if (pkt.stream_index >= file_table[file_index].nb_streams)
-            goto discard_packet;
-        ist_index = file_table[file_index].ist_index + pkt.stream_index;
-        ist = ist_table[ist_index];
-        if (ist->discard)
-            goto discard_packet;
-
-        if (pkt.dts != AV_NOPTS_VALUE)
-            pkt.dts += av_rescale_q(input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ist->st->time_base);
-        if (pkt.pts != AV_NOPTS_VALUE)
-            pkt.pts += av_rescale_q(input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ist->st->time_base);
-
-        if(input_files_ts_scale[file_index][pkt.stream_index]){
-            if(pkt.pts != AV_NOPTS_VALUE)
-                pkt.pts *= input_files_ts_scale[file_index][pkt.stream_index];
-            if(pkt.dts != AV_NOPTS_VALUE)
-                pkt.dts *= input_files_ts_scale[file_index][pkt.stream_index];
-        }
-
-//        fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type);
-        if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE
-            && (is->iformat->flags & AVFMT_TS_DISCONT)) {
-            int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
-            int64_t delta= pkt_dts - ist->next_pts;
-            if((FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE || pkt_dts+1<ist->pts)&& !copy_ts){
-                input_files_ts_offset[ist->file_index]-= delta;
-                if (verbose > 2)
-                    fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files_ts_offset[ist->file_index]);
-                pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
-                if(pkt.pts != AV_NOPTS_VALUE)
-                    pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
-            }
-        }
-
-        /* finish if recording time exhausted */
-        if (recording_time != INT64_MAX &&
-            av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000}) >= 0) {
-            ist->is_past_recording_time = 1;
-            goto discard_packet;
-        }
-
-        //fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size);
-        if (output_packet(ist, ist_index, ost_table, nb_ostreams, &pkt) < 0) {
-
-            if (verbose >= 0)
-                fprintf(stderr, "Error while decoding stream #%d.%d\n",
-                        ist->file_index, ist->index);
-            if (exit_on_error)
-                av_exit(1);
-            av_free_packet(&pkt);
-            goto redo;
-        }
-
-    discard_packet:
-        av_free_packet(&pkt);
-
-        /* dump report by using the output first video and audio streams */
-        print_report(output_files, ost_table, nb_ostreams, 0);
-    }
-
-    /* at the end of stream, we must flush the decoder buffers */
-    for(i=0;i<nb_istreams;i++) {
-        ist = ist_table[i];
-        if (ist->decoding_needed) {
-            output_packet(ist, i, ost_table, nb_ostreams, NULL);
-        }
-    }
-
-    term_exit();
-
-    /* write the trailer if needed and close file */
-    for(i=0;i<nb_output_files;i++) {
-        os = output_files[i];
-        av_write_trailer(os);
-    }
-
-    /* dump report by using the first video and audio streams */
-    print_report(output_files, ost_table, nb_ostreams, 1);
-
-    /* close each encoder */
-    for(i=0;i<nb_ostreams;i++) {
-        ost = ost_table[i];
-        if (ost->encoding_needed) {
-            av_freep(&ost->st->codec->stats_in);
-            avcodec_close(ost->st->codec);
-        }
-    }
-
-    /* close each decoder */
-    for(i=0;i<nb_istreams;i++) {
-        ist = ist_table[i];
-        if (ist->decoding_needed) {
-            avcodec_close(ist->st->codec);
-        }
-    }
-
-    /* finished ! */
-    ret = 0;
-
- fail:
-    av_freep(&bit_buffer);
-    av_free(file_table);
-
-    if (ist_table) {
-        for(i=0;i<nb_istreams;i++) {
-            ist = ist_table[i];
-            av_free(ist);
-        }
-        av_free(ist_table);
-    }
-    if (ost_table) {
-        for(i=0;i<nb_ostreams;i++) {
-            ost = ost_table[i];
-            if (ost) {
-                if (ost->logfile) {
-                    fclose(ost->logfile);
-                    ost->logfile = NULL;
-                }
-                av_fifo_free(ost->fifo); /* works even if fifo is not
-                                             initialized but set to zero */
-                av_free(ost->pict_tmp.data[0]);
-                if (ost->video_resample)
-                    sws_freeContext(ost->img_resample_ctx);
-                if (ost->resample)
-                    audio_resample_close(ost->resample);
-                if (ost->reformat_ctx)
-                    av_audio_convert_free(ost->reformat_ctx);
-                av_free(ost);
-            }
-        }
-        av_free(ost_table);
-    }
-    return ret;
-}
-
-static void opt_format(const char *arg)
-{
-    /* compatibility stuff for pgmyuv */
-    if (!strcmp(arg, "pgmyuv")) {
-        pgmyuv_compatibility_hack=1;
-//        opt_image_format(arg);
-        arg = "image2";
-        fprintf(stderr, "pgmyuv format is deprecated, use image2\n");
-    }
-
-    last_asked_format = arg;
-}
-
-static void opt_video_rc_override_string(const char *arg)
-{
-    video_rc_override_string = arg;
-}
-
-static int opt_me_threshold(const char *opt, const char *arg)
-{
-    me_threshold = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
-    return 0;
-}
-
-static int opt_verbose(const char *opt, const char *arg)
-{
-    verbose = parse_number_or_die(opt, arg, OPT_INT64, -10, 10);
-    return 0;
-}
-
-static int opt_frame_rate(const char *opt, const char *arg)
-{
-    if (av_parse_video_frame_rate(&frame_rate, arg) < 0) {
-        fprintf(stderr, "Incorrect value for %s: %s\n", opt, arg);
-        av_exit(1);
-    }
-    return 0;
-}
-
-static int opt_bitrate(const char *opt, const char *arg)
-{
-    int codec_type = opt[0]=='a' ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO;
-
-    opt_default(opt, arg);
-
-    if (av_get_int(avcodec_opts[codec_type], "b", NULL) < 1000)
-        fprintf(stderr, "WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s\n");
-
-    return 0;
-}
-
-static void opt_frame_crop_top(const char *arg)
-{
-    frame_topBand = atoi(arg);
-    if (frame_topBand < 0) {
-        fprintf(stderr, "Incorrect top crop size\n");
-        av_exit(1);
-    }
-    if ((frame_topBand) >= frame_height){
-        fprintf(stderr, "Vertical crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
-        av_exit(1);
-    }
-    frame_height -= frame_topBand;
-}
-
-static void opt_frame_crop_bottom(const char *arg)
-{
-    frame_bottomBand = atoi(arg);
-    if (frame_bottomBand < 0) {
-        fprintf(stderr, "Incorrect bottom crop size\n");
-        av_exit(1);
-    }
-    if ((frame_bottomBand) >= frame_height){
-        fprintf(stderr, "Vertical crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
-        av_exit(1);
-    }
-    frame_height -= frame_bottomBand;
-}
-
-static void opt_frame_crop_left(const char *arg)
-{
-    frame_leftBand = atoi(arg);
-    if (frame_leftBand < 0) {
-        fprintf(stderr, "Incorrect left crop size\n");
-        av_exit(1);
-    }
-    if ((frame_leftBand) >= frame_width){
-        fprintf(stderr, "Horizontal crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
-        av_exit(1);
-    }
-    frame_width -= frame_leftBand;
-}
-
-static void opt_frame_crop_right(const char *arg)
-{
-    frame_rightBand = atoi(arg);
-    if (frame_rightBand < 0) {
-        fprintf(stderr, "Incorrect right crop size\n");
-        av_exit(1);
-    }
-    if ((frame_rightBand) >= frame_width){
-        fprintf(stderr, "Horizontal crop dimensions are outside the range of the original image.\nRemember to crop first and scale second.\n");
-        av_exit(1);
-    }
-    frame_width -= frame_rightBand;
-}
-
-static void opt_frame_size(const char *arg)
-{
-    if (av_parse_video_frame_size(&frame_width, &frame_height, arg) < 0) {
-        fprintf(stderr, "Incorrect frame size\n");
-        av_exit(1);
-    }
-}
-
-static void opt_pad_color(const char *arg) {
-    /* Input is expected to be six hex digits similar to
-       how colors are expressed in html tags (but without the #) */
-    int rgb = strtol(arg, NULL, 16);
-    int r,g,b;
-
-    r = (rgb >> 16);
-    g = ((rgb >> 8) & 255);
-    b = (rgb & 255);
-
-    padcolor[0] = RGB_TO_Y(r,g,b);
-    padcolor[1] = RGB_TO_U(r,g,b,0);
-    padcolor[2] = RGB_TO_V(r,g,b,0);
-}
-
-static void opt_frame_pad_top(const char *arg)
-{
-    frame_padtop = atoi(arg);
-    if (frame_padtop < 0) {
-        fprintf(stderr, "Incorrect top pad size\n");
-        av_exit(1);
-    }
-}
-
-static void opt_frame_pad_bottom(const char *arg)
-{
-    frame_padbottom = atoi(arg);
-    if (frame_padbottom < 0) {
-        fprintf(stderr, "Incorrect bottom pad size\n");
-        av_exit(1);
-    }
-}
-
-
-static void opt_frame_pad_left(const char *arg)
-{
-    frame_padleft = atoi(arg);
-    if (frame_padleft < 0) {
-        fprintf(stderr, "Incorrect left pad size\n");
-        av_exit(1);
-    }
-}
-
-
-static void opt_frame_pad_right(const char *arg)
-{
-    frame_padright = atoi(arg);
-    if (frame_padright < 0) {
-        fprintf(stderr, "Incorrect right pad size\n");
-        av_exit(1);
-    }
-}
-
-static void opt_frame_pix_fmt(const char *arg)
-{
-    if (strcmp(arg, "list")) {
-        frame_pix_fmt = av_get_pix_fmt(arg);
-        if (frame_pix_fmt == PIX_FMT_NONE) {
-            fprintf(stderr, "Unknown pixel format requested: %s\n", arg);
-            av_exit(1);
-        }
-    } else {
-        show_pix_fmts();
-        av_exit(0);
-    }
-}
-
-static void opt_frame_aspect_ratio(const char *arg)
-{
-    int x = 0, y = 0;
-    double ar = 0;
-    const char *p;
-    char *end;
-
-    p = strchr(arg, ':');
-    if (p) {
-        x = strtol(arg, &end, 10);
-        if (end == p)
-            y = strtol(end+1, &end, 10);
-        if (x > 0 && y > 0)
-            ar = (double)x / (double)y;
-    } else
-        ar = strtod(arg, NULL);
-
-    if (!ar) {
-        fprintf(stderr, "Incorrect aspect ratio specification.\n");
-        av_exit(1);
-    }
-    frame_aspect_ratio = ar;
-}
-
-static int opt_metadata(const char *opt, const char *arg)
-{
-    char *mid= strchr(arg, '=');
-
-    if(!mid){
-        fprintf(stderr, "Missing =\n");
-        av_exit(1);
-    }
-    *mid++= 0;
-
-    metadata_count++;
-    metadata= av_realloc(metadata, sizeof(*metadata)*metadata_count);
-    metadata[metadata_count-1].key  = av_strdup(arg);
-    metadata[metadata_count-1].value= av_strdup(mid);
-
-    return 0;
-}
-
-static void opt_qscale(const char *arg)
-{
-    video_qscale = atof(arg);
-    if (video_qscale <= 0 ||
-        video_qscale > 255) {
-        fprintf(stderr, "qscale must be > 0.0 and <= 255\n");
-        av_exit(1);
-    }
-}
-
-static void opt_top_field_first(const char *arg)
-{
-    top_field_first= atoi(arg);
-}
-
-static int opt_thread_count(const char *opt, const char *arg)
-{
-    thread_count= parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-#if !HAVE_THREADS
-    if (verbose >= 0)
-        fprintf(stderr, "Warning: not compiled with thread support, using thread emulation\n");
-#endif
-    return 0;
-}
-
-static void opt_audio_sample_fmt(const char *arg)
-{
-    if (strcmp(arg, "list"))
-        audio_sample_fmt = avcodec_get_sample_fmt(arg);
-    else {
-        list_fmts(avcodec_sample_fmt_string, SAMPLE_FMT_NB);
-        av_exit(0);
-    }
-}
-
-static int opt_audio_rate(const char *opt, const char *arg)
-{
-    audio_sample_rate = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-    return 0;
-}
-
-static int opt_audio_channels(const char *opt, const char *arg)
-{
-    audio_channels = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-    return 0;
-}
-
-static void opt_video_channel(const char *arg)
-{
-    video_channel = strtol(arg, NULL, 0);
-}
-
-static void opt_video_standard(const char *arg)
-{
-    video_standard = av_strdup(arg);
-}
-
-static void opt_codec(int *pstream_copy, char **pcodec_name,
-                      int codec_type, const char *arg)
-{
-    av_freep(pcodec_name);
-    if (!strcmp(arg, "copy")) {
-        *pstream_copy = 1;
-    } else {
-        *pcodec_name = av_strdup(arg);
-    }
-}
-
-static void opt_audio_codec(const char *arg)
-{
-    opt_codec(&audio_stream_copy, &audio_codec_name, AVMEDIA_TYPE_AUDIO, arg);
-}
-
-static void opt_audio_tag(const char *arg)
-{
-    char *tail;
-    audio_codec_tag= strtol(arg, &tail, 0);
-
-    if(!tail || *tail)
-        audio_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24);
-}
-
-static void opt_video_tag(const char *arg)
-{
-    char *tail;
-    video_codec_tag= strtol(arg, &tail, 0);
-
-    if(!tail || *tail)
-        video_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24);
-}
-
-static void opt_video_codec(const char *arg)
-{
-    opt_codec(&video_stream_copy, &video_codec_name, AVMEDIA_TYPE_VIDEO, arg);
-}
-
-static void opt_subtitle_codec(const char *arg)
-{
-    opt_codec(&subtitle_stream_copy, &subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, arg);
-}
-
-static void opt_subtitle_tag(const char *arg)
-{
-    char *tail;
-    subtitle_codec_tag= strtol(arg, &tail, 0);
-
-    if(!tail || *tail)
-        subtitle_codec_tag= arg[0] + (arg[1]<<8) + (arg[2]<<16) + (arg[3]<<24);
-}
-
-static void opt_map(const char *arg)
-{
-    AVStreamMap *m;
-    char *p;
-
-    m = &stream_maps[nb_stream_maps++];
-
-    m->file_index = strtol(arg, &p, 0);
-    if (*p)
-        p++;
-
-    m->stream_index = strtol(p, &p, 0);
-    if (*p) {
-        p++;
-        m->sync_file_index = strtol(p, &p, 0);
-        if (*p)
-            p++;
-        m->sync_stream_index = strtol(p, &p, 0);
-    } else {
-        m->sync_file_index = m->file_index;
-        m->sync_stream_index = m->stream_index;
-    }
-}
-
-static void opt_map_meta_data(const char *arg)
-{
-    AVMetaDataMap *m;
-    char *p;
-
-    m = &meta_data_maps[nb_meta_data_maps++];
-
-    m->out_file = strtol(arg, &p, 0);
-    if (*p)
-        p++;
-
-    m->in_file = strtol(p, &p, 0);
-}
-
-static void opt_input_ts_scale(const char *arg)
-{
-    unsigned int stream;
-    double scale;
-    char *p;
-
-    stream = strtol(arg, &p, 0);
-    if (*p)
-        p++;
-    scale= strtod(p, &p);
-
-    if(stream >= MAX_STREAMS)
-        av_exit(1);
-
-    input_files_ts_scale[nb_input_files][stream]= scale;
-}
-
-static int opt_recording_time(const char *opt, const char *arg)
-{
-    recording_time = parse_time_or_die(opt, arg, 1);
-    return 0;
-}
-
-static int opt_start_time(const char *opt, const char *arg)
-{
-    start_time = parse_time_or_die(opt, arg, 1);
-    return 0;
-}
-
-static int opt_rec_timestamp(const char *opt, const char *arg)
-{
-    rec_timestamp = parse_time_or_die(opt, arg, 0) / 1000000;
-    return 0;
-}
-
-static int opt_input_ts_offset(const char *opt, const char *arg)
-{
-    input_ts_offset = parse_time_or_die(opt, arg, 1);
-    return 0;
-}
-
-static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict)
-{
-    const char *codec_string = encoder ? "encoder" : "decoder";
-    AVCodec *codec;
-
-    if(!name)
-        return CODEC_ID_NONE;
-    codec = encoder ?
-        avcodec_find_encoder_by_name(name) :
-        avcodec_find_decoder_by_name(name);
-    if(!codec) {
-        fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
-        av_exit(1);
-    }
-    if(codec->type != type) {
-        fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);
-        av_exit(1);
-    }
-    if(codec->capabilities & CODEC_CAP_EXPERIMENTAL &&
-       strict > FF_COMPLIANCE_EXPERIMENTAL) {
-        fprintf(stderr, "%s '%s' is experimental and might produce bad "
-                "results.\nAdd '-strict experimental' if you want to use it.\n",
-                codec_string, codec->name);
-        codec = encoder ?
-            avcodec_find_encoder(codec->id) :
-            avcodec_find_decoder(codec->id);
-        if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL))
-            fprintf(stderr, "Or use the non experimental %s '%s'.\n",
-                    codec_string, codec->name);
-        av_exit(1);
-    }
-    return codec->id;
-}
-
-static void opt_input_file(const char *filename)
-{
-    AVFormatContext *ic;
-    AVFormatParameters params, *ap = &params;
-    AVInputFormat *file_iformat = NULL;
-    int err, i, ret, rfps, rfps_base;
-    int64_t timestamp;
-
-    if (last_asked_format) {
-        if (!(file_iformat = av_find_input_format(last_asked_format))) {
-            fprintf(stderr, "Unknown input format: '%s'\n", last_asked_format);
-            av_exit(1);
-        }
-        last_asked_format = NULL;
-    }
-
-    if (!strcmp(filename, "-"))
-        filename = "pipe:";
-
-    using_stdin |= !strncmp(filename, "pipe:", 5) ||
-                    !strcmp(filename, "/dev/stdin");
-
-    /* get default parameters from command line */
-    ic = avformat_alloc_context();
-    if (!ic) {
-        print_error(filename, AVERROR(ENOMEM));
-        av_exit(1);
-    }
-
-    memset(ap, 0, sizeof(*ap));
-    ap->prealloced_context = 1;
-    ap->sample_rate = audio_sample_rate;
-    ap->channels = audio_channels;
-    ap->time_base.den = frame_rate.num;
-    ap->time_base.num = frame_rate.den;
-    ap->width = frame_width + frame_padleft + frame_padright;
-    ap->height = frame_height + frame_padtop + frame_padbottom;
-    ap->pix_fmt = frame_pix_fmt;
-   // ap->sample_fmt = audio_sample_fmt; //FIXME:not implemented in libavformat
-    ap->channel = video_channel;
-    ap->standard = video_standard;
-
-    set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);
-
-    ic->video_codec_id   =
-        find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0,
-                          avcodec_opts[AVMEDIA_TYPE_VIDEO   ]->strict_std_compliance);
-    ic->audio_codec_id   =
-        find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0,
-                          avcodec_opts[AVMEDIA_TYPE_AUDIO   ]->strict_std_compliance);
-    ic->subtitle_codec_id=
-        find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0,
-                          avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
-    ic->flags |= AVFMT_FLAG_NONBLOCK;
-
-    if(pgmyuv_compatibility_hack)
-        ic->video_codec_id= CODEC_ID_PGMYUV;
-
-    /* open the input file with generic libav function */
-    err = av_open_input_file(&ic, filename, file_iformat, 0, ap);
-    if (err < 0) {
-        print_error(filename, err);
-        av_exit(1);
-    }
-    if(opt_programid) {
-        int i, j;
-        int found=0;
-        for(i=0; i<ic->nb_streams; i++){
-            ic->streams[i]->discard= AVDISCARD_ALL;
-        }
-        for(i=0; i<ic->nb_programs; i++){
-            AVProgram *p= ic->programs[i];
-            if(p->id != opt_programid){
-                p->discard = AVDISCARD_ALL;
-            }else{
-                found=1;
-                for(j=0; j<p->nb_stream_indexes; j++){
-                    ic->streams[p->stream_index[j]]->discard= AVDISCARD_DEFAULT;
-                }
-            }
-        }
-        if(!found){
-            fprintf(stderr, "Specified program id not found\n");
-            av_exit(1);
-        }
-        opt_programid=0;
-    }
-
-    ic->loop_input = loop_input;
-
-    /* If not enough info to get the stream parameters, we decode the
-       first frames to get it. (used in mpeg case for example) */
-    ret = av_find_stream_info(ic);
-    if (ret < 0 && verbose >= 0) {
-        fprintf(stderr, "%s: could not find codec parameters\n", filename);
-        av_exit(1);
-    }
-
-    timestamp = start_time;
-    /* add the stream start time */
-    if (ic->start_time != AV_NOPTS_VALUE)
-        timestamp += ic->start_time;
-
-    /* if seeking requested, we execute it */
-    if (start_time != 0) {
-        ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD);
-        if (ret < 0) {
-            fprintf(stderr, "%s: could not seek to position %0.3f\n",
-                    filename, (double)timestamp / AV_TIME_BASE);
-        }
-        /* reset seek info */
-        start_time = 0;
-    }
-
-    /* update the current parameters so that they match the one of the input stream */
-    for(i=0;i<ic->nb_streams;i++) {
-        AVStream *st = ic->streams[i];
-        AVCodecContext *enc = st->codec;
-        avcodec_thread_init(enc, thread_count);
-        switch(enc->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            set_context_opts(enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
-            //fprintf(stderr, "\nInput Audio channels: %d", enc->channels);
-            channel_layout = enc->channel_layout;
-            audio_channels = enc->channels;
-            audio_sample_rate = enc->sample_rate;
-            audio_sample_fmt = enc->sample_fmt;
-            input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(audio_codec_name);
-            if(audio_disable)
-                st->discard= AVDISCARD_ALL;
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-            set_context_opts(enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM);
-            frame_height = enc->height;
-            frame_width = enc->width;
-            if(ic->streams[i]->sample_aspect_ratio.num)
-                frame_aspect_ratio=av_q2d(ic->streams[i]->sample_aspect_ratio);
-            else
-                frame_aspect_ratio=av_q2d(enc->sample_aspect_ratio);
-            frame_aspect_ratio *= (float) enc->width / enc->height;
-            frame_pix_fmt = enc->pix_fmt;
-            rfps      = ic->streams[i]->r_frame_rate.num;
-            rfps_base = ic->streams[i]->r_frame_rate.den;
-            if(enc->lowres) {
-                enc->flags |= CODEC_FLAG_EMU_EDGE;
-                frame_height >>= enc->lowres;
-                frame_width  >>= enc->lowres;
-            }
-            if(me_threshold)
-                enc->debug |= FF_DEBUG_MV;
-
-            if (enc->time_base.den != rfps*enc->ticks_per_frame || enc->time_base.num != rfps_base) {
-
-                if (verbose >= 0)
-                    fprintf(stderr,"\nSeems stream %d codec frame rate differs from container frame rate: %2.2f (%d/%d) -> %2.2f (%d/%d)\n",
-                            i, (float)enc->time_base.den / enc->time_base.num, enc->time_base.den, enc->time_base.num,
-
-                    (float)rfps / rfps_base, rfps, rfps_base);
-            }
-            /* update the current frame rate to match the stream frame rate */
-            frame_rate.num = rfps;
-            frame_rate.den = rfps_base;
-
-            input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(video_codec_name);
-            if(video_disable)
-                st->discard= AVDISCARD_ALL;
-            else if(video_discard)
-                st->discard= video_discard;
-            break;
-        case AVMEDIA_TYPE_DATA:
-            break;
-        case AVMEDIA_TYPE_SUBTITLE:
-            input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(subtitle_codec_name);
-            if(subtitle_disable)
-                st->discard = AVDISCARD_ALL;
-            break;
-        case AVMEDIA_TYPE_ATTACHMENT:
-        case AVMEDIA_TYPE_UNKNOWN:
-            nb_icodecs++;
-            break;
-        default:
-            abort();
-        }
-    }
-
-    input_files[nb_input_files] = ic;
-    input_files_ts_offset[nb_input_files] = input_ts_offset - (copy_ts ? 0 : timestamp);
-    /* dump the file content */
-    if (verbose >= 0)
-        dump_format(ic, nb_input_files, filename, 0);
-
-    nb_input_files++;
-
-    video_channel = 0;
-
-    av_freep(&video_codec_name);
-    av_freep(&audio_codec_name);
-    av_freep(&subtitle_codec_name);
-}
-
-static void check_audio_video_sub_inputs(int *has_video_ptr, int *has_audio_ptr,
-                                         int *has_subtitle_ptr)
-{
-    int has_video, has_audio, has_subtitle, i, j;
-    AVFormatContext *ic;
-
-    has_video = 0;
-    has_audio = 0;
-    has_subtitle = 0;
-    for(j=0;j<nb_input_files;j++) {
-        ic = input_files[j];
-        for(i=0;i<ic->nb_streams;i++) {
-            AVCodecContext *enc = ic->streams[i]->codec;
-            switch(enc->codec_type) {
-            case AVMEDIA_TYPE_AUDIO:
-                has_audio = 1;
-                break;
-            case AVMEDIA_TYPE_VIDEO:
-                has_video = 1;
-                break;
-            case AVMEDIA_TYPE_SUBTITLE:
-                has_subtitle = 1;
-                break;
-            case AVMEDIA_TYPE_DATA:
-            case AVMEDIA_TYPE_ATTACHMENT:
-            case AVMEDIA_TYPE_UNKNOWN:
-                break;
-            default:
-                abort();
-            }
-        }
-    }
-    *has_video_ptr = has_video;
-    *has_audio_ptr = has_audio;
-    *has_subtitle_ptr = has_subtitle;
-}
-
-static void new_video_stream(AVFormatContext *oc)
-{
-    AVStream *st;
-    AVCodecContext *video_enc;
-    enum CodecID codec_id;
-
-    st = av_new_stream(oc, oc->nb_streams);
-    if (!st) {
-        fprintf(stderr, "Could not alloc stream\n");
-        av_exit(1);
-    }
-    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
-    bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
-    video_bitstream_filters= NULL;
-
-    avcodec_thread_init(st->codec, thread_count);
-
-    video_enc = st->codec;
-
-    if(video_codec_tag)
-        video_enc->codec_tag= video_codec_tag;
-
-    if(   (video_global_header&1)
-       || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
-        video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
-        avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
-    }
-    if(video_global_header&2){
-        video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
-        avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
-    }
-
-    if (video_stream_copy) {
-        st->stream_copy = 1;
-        video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
-        video_enc->sample_aspect_ratio =
-        st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
-    } else {
-        const char *p;
-        int i;
-        AVCodec *codec;
-        AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
-
-        if (video_codec_name) {
-            codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
-                                         video_enc->strict_std_compliance);
-            codec = avcodec_find_encoder_by_name(video_codec_name);
-            output_codecs[nb_ocodecs] = codec;
-        } else {
-            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
-            codec = avcodec_find_encoder(codec_id);
-        }
-
-        video_enc->codec_id = codec_id;
-
-        set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
-
-        if (codec && codec->supported_framerates && !force_fps)
-            fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
-        video_enc->time_base.den = fps.num;
-        video_enc->time_base.num = fps.den;
-
-        video_enc->width = frame_width + frame_padright + frame_padleft;
-        video_enc->height = frame_height + frame_padtop + frame_padbottom;
-        video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);
-        video_enc->pix_fmt = frame_pix_fmt;
-        st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
-
-        choose_pixel_fmt(st, codec);
-
-        if (intra_only)
-            video_enc->gop_size = 0;
-        if (video_qscale || same_quality) {
-            video_enc->flags |= CODEC_FLAG_QSCALE;
-            video_enc->global_quality=
-                st->quality = FF_QP2LAMBDA * video_qscale;
-        }
-
-        if(intra_matrix)
-            video_enc->intra_matrix = intra_matrix;
-        if(inter_matrix)
-            video_enc->inter_matrix = inter_matrix;
-
-        p= video_rc_override_string;
-        for(i=0; p; i++){
-            int start, end, q;
-            int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
-            if(e!=3){
-                fprintf(stderr, "error parsing rc_override\n");
-                av_exit(1);
-            }
-            video_enc->rc_override=
-                av_realloc(video_enc->rc_override,
-                           sizeof(RcOverride)*(i+1));
-            video_enc->rc_override[i].start_frame= start;
-            video_enc->rc_override[i].end_frame  = end;
-            if(q>0){
-                video_enc->rc_override[i].qscale= q;
-                video_enc->rc_override[i].quality_factor= 1.0;
-            }
-            else{
-                video_enc->rc_override[i].qscale= 0;
-                video_enc->rc_override[i].quality_factor= -q/100.0;
-            }
-            p= strchr(p, '/');
-            if(p) p++;
-        }
-        video_enc->rc_override_count=i;
-        if (!video_enc->rc_initial_buffer_occupancy)
-            video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
-        video_enc->me_threshold= me_threshold;
-        video_enc->intra_dc_precision= intra_dc_precision - 8;
-
-        if (do_psnr)
-            video_enc->flags|= CODEC_FLAG_PSNR;
-
-        /* two pass mode */
-        if (do_pass) {
-            if (do_pass == 1) {
-                video_enc->flags |= CODEC_FLAG_PASS1;
-            } else {
-                video_enc->flags |= CODEC_FLAG_PASS2;
-            }
-        }
-    }
-    nb_ocodecs++;
-    if (video_language) {
-        av_metadata_set2(&st->metadata, "language", video_language, 0);
-        av_freep(&video_language);
-    }
-
-    /* reset some key parameters */
-    video_disable = 0;
-    av_freep(&video_codec_name);
-    video_stream_copy = 0;
-    frame_pix_fmt = PIX_FMT_NONE;
-}
-
-static void new_audio_stream(AVFormatContext *oc)
-{
-    AVStream *st;
-    AVCodecContext *audio_enc;
-    enum CodecID codec_id;
-
-    st = av_new_stream(oc, oc->nb_streams);
-    if (!st) {
-        fprintf(stderr, "Could not alloc stream\n");
-        av_exit(1);
-    }
-    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO);
-
-    bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;
-    audio_bitstream_filters= NULL;
-
-    avcodec_thread_init(st->codec, thread_count);
-
-    audio_enc = st->codec;
-    audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
-
-    if(audio_codec_tag)
-        audio_enc->codec_tag= audio_codec_tag;
-
-    if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
-        audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
-        avcodec_opts[AVMEDIA_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
-    }
-    if (audio_stream_copy) {
-        st->stream_copy = 1;
-        audio_enc->channels = audio_channels;
-        audio_enc->sample_rate = audio_sample_rate;
-    } else {
-        AVCodec *codec;
-
-        set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
-
-        if (audio_codec_name) {
-            codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1,
-                                         audio_enc->strict_std_compliance);
-            codec = avcodec_find_encoder_by_name(audio_codec_name);
-            output_codecs[nb_ocodecs] = codec;
-        } else {
-            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO);
-            codec = avcodec_find_encoder(codec_id);
-        }
-        audio_enc->codec_id = codec_id;
-
-        if (audio_qscale > QSCALE_NONE) {
-            audio_enc->flags |= CODEC_FLAG_QSCALE;
-            audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale;
-        }
-        audio_enc->channels = audio_channels;
-        audio_enc->sample_fmt = audio_sample_fmt;
-        audio_enc->sample_rate = audio_sample_rate;
-        audio_enc->channel_layout = channel_layout;
-        if (avcodec_channel_layout_num_channels(channel_layout) != audio_channels)
-            audio_enc->channel_layout = 0;
-        choose_sample_fmt(st, codec);
-        choose_sample_rate(st, codec);
-    }
-    nb_ocodecs++;
-    audio_enc->time_base= (AVRational){1, audio_sample_rate};
-    if (audio_language) {
-        av_metadata_set2(&st->metadata, "language", audio_language, 0);
-        av_freep(&audio_language);
-    }
-
-    /* reset some key parameters */
-    audio_disable = 0;
-    av_freep(&audio_codec_name);
-    audio_stream_copy = 0;
-}
-
-static void new_subtitle_stream(AVFormatContext *oc)
-{
-    AVStream *st;
-    AVCodecContext *subtitle_enc;
-
-    st = av_new_stream(oc, oc->nb_streams);
-    if (!st) {
-        fprintf(stderr, "Could not alloc stream\n");
-        av_exit(1);
-    }
-    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE);
-
-    bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters;
-    subtitle_bitstream_filters= NULL;
-
-    subtitle_enc = st->codec;
-    subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
-
-    if(subtitle_codec_tag)
-        subtitle_enc->codec_tag= subtitle_codec_tag;
-
-    if (subtitle_stream_copy) {
-        st->stream_copy = 1;
-    } else {
-        set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
-        subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
-                                                   subtitle_enc->strict_std_compliance);
-        output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name);
-    }
-    nb_ocodecs++;
-
-    if (subtitle_language) {
-        av_metadata_set2(&st->metadata, "language", subtitle_language, 0);
-        av_freep(&subtitle_language);
-    }
-
-    subtitle_disable = 0;
-    av_freep(&subtitle_codec_name);
-    subtitle_stream_copy = 0;
-}
-
-static void opt_new_audio_stream(void)
-{
-    AVFormatContext *oc;
-    if (nb_output_files <= 0) {
-        fprintf(stderr, "At least one output file must be specified\n");
-        av_exit(1);
-    }
-    oc = output_files[nb_output_files - 1];
-    new_audio_stream(oc);
-}
-
-static void opt_new_video_stream(void)
-{
-    AVFormatContext *oc;
-    if (nb_output_files <= 0) {
-        fprintf(stderr, "At least one output file must be specified\n");
-        av_exit(1);
-    }
-    oc = output_files[nb_output_files - 1];
-    new_video_stream(oc);
-}
-
-static void opt_new_subtitle_stream(void)
-{
-    AVFormatContext *oc;
-    if (nb_output_files <= 0) {
-        fprintf(stderr, "At least one output file must be specified\n");
-        av_exit(1);
-    }
-    oc = output_files[nb_output_files - 1];
-    new_subtitle_stream(oc);
-}
-
-static void opt_output_file(const char *filename)
-{
-    AVFormatContext *oc;
-    int err, use_video, use_audio, use_subtitle;
-    int input_has_video, input_has_audio, input_has_subtitle;
-    AVFormatParameters params, *ap = &params;
-    AVOutputFormat *file_oformat;
-
-    if (!strcmp(filename, "-"))
-        filename = "pipe:";
-
-    oc = avformat_alloc_context();
-    if (!oc) {
-        print_error(filename, AVERROR(ENOMEM));
-        av_exit(1);
-    }
-
-    if (last_asked_format) {
-        file_oformat = av_guess_format(last_asked_format, NULL, NULL);
-        if (!file_oformat) {
-            fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);
-            av_exit(1);
-        }
-        last_asked_format = NULL;
-    } else {
-        file_oformat = av_guess_format(NULL, filename, NULL);
-        if (!file_oformat) {
-            fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
-                    filename);
-            av_exit(1);
-        }
-    }
-
-    oc->oformat = file_oformat;
-    av_strlcpy(oc->filename, filename, sizeof(oc->filename));
-
-    if (!strcmp(file_oformat->name, "ffm") &&
-        av_strstart(filename, "http:", NULL)) {
-        /* special case for files sent to ffserver: we get the stream
-           parameters from ffserver */
-        int err = read_ffserver_streams(oc, filename);
-        if (err < 0) {
-            print_error(filename, err);
-            av_exit(1);
-        }
-    } else {
-        use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
-        use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
-        use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
-
-        /* disable if no corresponding type found and at least one
-           input file */
-        if (nb_input_files > 0) {
-            check_audio_video_sub_inputs(&input_has_video, &input_has_audio,
-                                         &input_has_subtitle);
-            if (!input_has_video)
-                use_video = 0;
-            if (!input_has_audio)
-                use_audio = 0;
-            if (!input_has_subtitle)
-                use_subtitle = 0;
-        }
-
-        /* manual disable */
-        if (audio_disable) {
-            use_audio = 0;
-        }
-        if (video_disable) {
-            use_video = 0;
-        }
-        if (subtitle_disable) {
-            use_subtitle = 0;
-        }
-
-        if (use_video) {
-            new_video_stream(oc);
-        }
-
-        if (use_audio) {
-            new_audio_stream(oc);
-        }
-
-        if (use_subtitle) {
-            new_subtitle_stream(oc);
-        }
-
-        oc->timestamp = rec_timestamp;
-
-        for(; metadata_count>0; metadata_count--){
-            av_metadata_set2(&oc->metadata, metadata[metadata_count-1].key,
-                                            metadata[metadata_count-1].value, 0);
-        }
-        av_metadata_conv(oc, oc->oformat->metadata_conv, NULL);
-    }
-
-    output_files[nb_output_files++] = oc;
-
-    /* check filename in case of an image number is expected */
-    if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
-        if (!av_filename_number_test(oc->filename)) {
-            print_error(oc->filename, AVERROR_NUMEXPECTED);
-            av_exit(1);
-        }
-    }
-
-    if (!(oc->oformat->flags & AVFMT_NOFILE)) {
-        /* test if it already exists to avoid loosing precious files */
-        if (!file_overwrite &&
-            (strchr(filename, ':') == NULL ||
-             filename[1] == ':' ||
-             av_strstart(filename, "file:", NULL))) {
-            if (url_exist(filename)) {
-                if (!using_stdin) {
-                    fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
-                    fflush(stderr);
-                    if (!read_yesno()) {
-                        fprintf(stderr, "Not overwriting - exiting\n");
-                        av_exit(1);
-                    }
-                }
-                else {
-                    fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
-                    av_exit(1);
-                }
-            }
-        }
-
-        /* open the file */
-        if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) {
-            print_error(filename, err);
-            av_exit(1);
-        }
-    }
-
-    memset(ap, 0, sizeof(*ap));
-    if (av_set_parameters(oc, ap) < 0) {
-        fprintf(stderr, "%s: Invalid encoding parameters\n",
-                oc->filename);
-        av_exit(1);
-    }
-
-    oc->preload= (int)(mux_preload*AV_TIME_BASE);
-    oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
-    oc->loop_output = loop_output;
-    oc->flags |= AVFMT_FLAG_NONBLOCK;
-
-    set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM);
-}
-
-/* same option as mencoder */
-static void opt_pass(const char *pass_str)
-{
-    int pass;
-    pass = atoi(pass_str);
-    if (pass != 1 && pass != 2) {
-        fprintf(stderr, "pass number can be only 1 or 2\n");
-        av_exit(1);
-    }
-    do_pass = pass;
-}
-
-static int64_t getutime(void)
-{
-#if HAVE_GETRUSAGE
-    struct rusage rusage;
-
-    getrusage(RUSAGE_SELF, &rusage);
-    return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
-#elif HAVE_GETPROCESSTIMES
-    HANDLE proc;
-    FILETIME c, e, k, u;
-    proc = GetCurrentProcess();
-    GetProcessTimes(proc, &c, &e, &k, &u);
-    return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
-#else
-    return av_gettime();
-#endif
-}
-
-static int64_t getmaxrss(void)
-{
-#if HAVE_GETRUSAGE && HAVE_STRUCT_RUSAGE_RU_MAXRSS
-    struct rusage rusage;
-    getrusage(RUSAGE_SELF, &rusage);
-    return (int64_t)rusage.ru_maxrss * 1024;
-#elif HAVE_GETPROCESSMEMORYINFO
-    HANDLE proc;
-    PROCESS_MEMORY_COUNTERS memcounters;
-    proc = GetCurrentProcess();
-    memcounters.cb = sizeof(memcounters);
-    GetProcessMemoryInfo(proc, &memcounters, sizeof(memcounters));
-    return memcounters.PeakPagefileUsage;
-#else
-    return 0;
-#endif
-}
-
-static void parse_matrix_coeffs(uint16_t *dest, const char *str)
-{
-    int i;
-    const char *p = str;
-    for(i = 0;; i++) {
-        dest[i] = atoi(p);
-        if(i == 63)
-            break;
-        p = strchr(p, ',');
-        if(!p) {
-            fprintf(stderr, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);
-            av_exit(1);
-        }
-        p++;
-    }
-}
-
-static void opt_inter_matrix(const char *arg)
-{
-    inter_matrix = av_mallocz(sizeof(uint16_t) * 64);
-    parse_matrix_coeffs(inter_matrix, arg);
-}
-
-static void opt_intra_matrix(const char *arg)
-{
-    intra_matrix = av_mallocz(sizeof(uint16_t) * 64);
-    parse_matrix_coeffs(intra_matrix, arg);
-}
-
-/**
- * Trivial log callback.
- * Only suitable for show_help and similar since it lacks prefix handling.
- */
-static void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
-{
-    vfprintf(stdout, fmt, vl);
-}
-
-static void show_usage(void)
-{
-    printf("Hyper fast Audio and Video encoder\n");
-    printf("usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...\n");
-    printf("\n");
-}
-
-static void show_help(void)
-{
-    av_log_set_callback(log_callback_help);
-    show_usage();
-    show_help_options(options, "Main options:\n",
-                      OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB, 0);
-    show_help_options(options, "\nAdvanced options:\n",
-                      OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_SUBTITLE | OPT_GRAB,
-                      OPT_EXPERT);
-    show_help_options(options, "\nVideo options:\n",
-                      OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
-                      OPT_VIDEO);
-    show_help_options(options, "\nAdvanced Video options:\n",
-                      OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
-                      OPT_VIDEO | OPT_EXPERT);
-    show_help_options(options, "\nAudio options:\n",
-                      OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
-                      OPT_AUDIO);
-    show_help_options(options, "\nAdvanced Audio options:\n",
-                      OPT_EXPERT | OPT_AUDIO | OPT_VIDEO | OPT_GRAB,
-                      OPT_AUDIO | OPT_EXPERT);
-    show_help_options(options, "\nSubtitle options:\n",
-                      OPT_SUBTITLE | OPT_GRAB,
-                      OPT_SUBTITLE);
-    show_help_options(options, "\nAudio/Video grab options:\n",
-                      OPT_GRAB,
-                      OPT_GRAB);
-    printf("\n");
-    av_opt_show(avcodec_opts[0], NULL);
-    printf("\n");
-    av_opt_show(avformat_opts, NULL);
-    printf("\n");
-    av_opt_show(sws_opts, NULL);
-}
-
-static void opt_target(const char *arg)
-{
-    enum { PAL, NTSC, FILM, UNKNOWN } norm = UNKNOWN;
-    static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"};
-
-    if(!strncmp(arg, "pal-", 4)) {
-        norm = PAL;
-        arg += 4;
-    } else if(!strncmp(arg, "ntsc-", 5)) {
-        norm = NTSC;
-        arg += 5;
-    } else if(!strncmp(arg, "film-", 5)) {
-        norm = FILM;
-        arg += 5;
-    } else {
-        int fr;
-        /* Calculate FR via float to avoid int overflow */
-        fr = (int)(frame_rate.num * 1000.0 / frame_rate.den);
-        if(fr == 25000) {
-            norm = PAL;
-        } else if((fr == 29970) || (fr == 23976)) {
-            norm = NTSC;
-        } else {
-            /* Try to determine PAL/NTSC by peeking in the input files */
-            if(nb_input_files) {
-                int i, j;
-                for(j = 0; j < nb_input_files; j++) {
-                    for(i = 0; i < input_files[j]->nb_streams; i++) {
-                        AVCodecContext *c = input_files[j]->streams[i]->codec;
-                        if(c->codec_type != AVMEDIA_TYPE_VIDEO)
-                            continue;
-                        fr = c->time_base.den * 1000 / c->time_base.num;
-                        if(fr == 25000) {
-                            norm = PAL;
-                            break;
-                        } else if((fr == 29970) || (fr == 23976)) {
-                            norm = NTSC;
-                            break;
-                        }
-                    }
-                    if(norm != UNKNOWN)
-                        break;
-                }
-            }
-        }
-        if(verbose && norm != UNKNOWN)
-            fprintf(stderr, "Assuming %s for target.\n", norm == PAL ? "PAL" : "NTSC");
-    }
-
-    if(norm == UNKNOWN) {
-        fprintf(stderr, "Could not determine norm (PAL/NTSC/NTSC-Film) for target.\n");
-        fprintf(stderr, "Please prefix target with \"pal-\", \"ntsc-\" or \"film-\",\n");
-        fprintf(stderr, "or set a framerate with \"-r xxx\".\n");
-        av_exit(1);
-    }
-
-    if(!strcmp(arg, "vcd")) {
-
-        opt_video_codec("mpeg1video");
-        opt_audio_codec("mp2");
-        opt_format("vcd");
-
-        opt_frame_size(norm == PAL ? "352x288" : "352x240");
-        opt_frame_rate(NULL, frame_rates[norm]);
-        opt_default("g", norm == PAL ? "15" : "18");
-
-        opt_default("b", "1150000");
-        opt_default("maxrate", "1150000");
-        opt_default("minrate", "1150000");
-        opt_default("bufsize", "327680"); // 40*1024*8;
-
-        opt_default("ab", "224000");
-        audio_sample_rate = 44100;
-        audio_channels = 2;
-
-        opt_default("packetsize", "2324");
-        opt_default("muxrate", "1411200"); // 2352 * 75 * 8;
-
-        /* We have to offset the PTS, so that it is consistent with the SCR.
-           SCR starts at 36000, but the first two packs contain only padding
-           and the first pack from the other stream, respectively, may also have
-           been written before.
-           So the real data starts at SCR 36000+3*1200. */
-        mux_preload= (36000+3*1200) / 90000.0; //0.44
-    } else if(!strcmp(arg, "svcd")) {
-
-        opt_video_codec("mpeg2video");
-        opt_audio_codec("mp2");
-        opt_format("svcd");
-
-        opt_frame_size(norm == PAL ? "480x576" : "480x480");
-        opt_frame_rate(NULL, frame_rates[norm]);
-        opt_default("g", norm == PAL ? "15" : "18");
-
-        opt_default("b", "2040000");
-        opt_default("maxrate", "2516000");
-        opt_default("minrate", "0"); //1145000;
-        opt_default("bufsize", "1835008"); //224*1024*8;
-        opt_default("flags", "+scan_offset");
-
-
-        opt_default("ab", "224000");
-        audio_sample_rate = 44100;
-
-        opt_default("packetsize", "2324");
-
-    } else if(!strcmp(arg, "dvd")) {
-
-        opt_video_codec("mpeg2video");
-        opt_audio_codec("ac3");
-        opt_format("dvd");
-
-        opt_frame_size(norm == PAL ? "720x576" : "720x480");
-        opt_frame_rate(NULL, frame_rates[norm]);
-        opt_default("g", norm == PAL ? "15" : "18");
-
-        opt_default("b", "6000000");
-        opt_default("maxrate", "9000000");
-        opt_default("minrate", "0"); //1500000;
-        opt_default("bufsize", "1835008"); //224*1024*8;
-
-        opt_default("packetsize", "2048");  // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
-        opt_default("muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
-
-        opt_default("ab", "448000");
-        audio_sample_rate = 48000;
-
-    } else if(!strncmp(arg, "dv", 2)) {
-
-        opt_format("dv");
-
-        opt_frame_size(norm == PAL ? "720x576" : "720x480");
-        opt_frame_pix_fmt(!strncmp(arg, "dv50", 4) ? "yuv422p" :
-                          (norm == PAL ? "yuv420p" : "yuv411p"));
-        opt_frame_rate(NULL, frame_rates[norm]);
-
-        audio_sample_rate = 48000;
-        audio_channels = 2;
-
-    } else {
-        fprintf(stderr, "Unknown target: %s\n", arg);
-        av_exit(1);
-    }
-}
-
-static void opt_vstats_file (const char *arg)
-{
-    av_free (vstats_filename);
-    vstats_filename=av_strdup (arg);
-}
-
-static void opt_vstats (void)
-{
-    char filename[40];
-    time_t today2 = time(NULL);
-    struct tm *today = localtime(&today2);
-
-    snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
-             today->tm_sec);
-    opt_vstats_file(filename);
-}
-
-static int opt_bsf(const char *opt, const char *arg)
-{
-    AVBitStreamFilterContext *bsfc= av_bitstream_filter_init(arg); //FIXME split name and args for filter at '='
-    AVBitStreamFilterContext **bsfp;
-
-    if(!bsfc){
-        fprintf(stderr, "Unknown bitstream filter %s\n", arg);
-        av_exit(1);
-    }
-
-    bsfp= *opt == 'v' ? &video_bitstream_filters :
-          *opt == 'a' ? &audio_bitstream_filters :
-                        &subtitle_bitstream_filters;
-    while(*bsfp)
-        bsfp= &(*bsfp)->next;
-
-    *bsfp= bsfc;
-
-    return 0;
-}
-
-static int opt_preset(const char *opt, const char *arg)
-{
-    FILE *f=NULL;
-    char filename[1000], tmp[1000], tmp2[1000], line[1000];
-    int i;
-    const char *base[3]= { getenv("FFMPEG_DATADIR"),
-                           getenv("HOME"),
-                           FFMPEG_DATADIR,
-                         };
-
-    if (*opt != 'f') {
-        for(i=0; i<3 && !f; i++){
-            if(!base[i])
-                continue;
-            snprintf(filename, sizeof(filename), "%s%s/%s.ffpreset", base[i], i != 1 ? "" : "/.ffmpeg", arg);
-            f= fopen(filename, "r");
-            if(!f){
-                char *codec_name= *opt == 'v' ? video_codec_name :
-                                  *opt == 'a' ? audio_codec_name :
-                                                subtitle_codec_name;
-                snprintf(filename, sizeof(filename), "%s%s/%s-%s.ffpreset", base[i],  i != 1 ? "" : "/.ffmpeg", codec_name, arg);
-                f= fopen(filename, "r");
-            }
-        }
-    } else {
-        av_strlcpy(filename, arg, sizeof(filename));
-        f= fopen(filename, "r");
-    }
-
-    if(!f){
-        fprintf(stderr, "File for preset '%s' not found\n", arg);
-        av_exit(1);
-    }
-
-    while(!feof(f)){
-        int e= fscanf(f, "%999[^\n]\n", line) - 1;
-        if(line[0] == '#' && !e)
-            continue;
-        e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
-        if(e){
-            fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
-            av_exit(1);
-        }
-        if(!strcmp(tmp, "acodec")){
-            opt_audio_codec(tmp2);
-        }else if(!strcmp(tmp, "vcodec")){
-            opt_video_codec(tmp2);
-        }else if(!strcmp(tmp, "scodec")){
-            opt_subtitle_codec(tmp2);
-        }else if(opt_default(tmp, tmp2) < 0){
-            fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
-            av_exit(1);
-        }
-    }
-
-    fclose(f);
-
-    return 0;
-}
-
-static const OptionDef options[] = {
-    /* main options */
-#include "cmdutils_common_opts.h"
-    { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
-    { "i", HAS_ARG, {(void*)opt_input_file}, "input file name", "filename" },
-    { "y", OPT_BOOL, {(void*)&file_overwrite}, "overwrite output files" },
-    { "map", HAS_ARG | OPT_EXPERT, {(void*)opt_map}, "set input stream mapping", "file:stream[:syncfile:syncstream]" },
-    { "map_meta_data", HAS_ARG | OPT_EXPERT, {(void*)opt_map_meta_data}, "set meta data information of outfile from infile", "outfile:infile" },
-    { "t", OPT_FUNC2 | HAS_ARG, {(void*)opt_recording_time}, "record or transcode \"duration\" seconds of audio/video", "duration" },
-    { "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, //
-    { "ss", OPT_FUNC2 | HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" },
-    { "itsoffset", OPT_FUNC2 | HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts offset", "time_off" },
-    { "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts scale", "stream:scale" },
-    { "timestamp", OPT_FUNC2 | HAS_ARG, {(void*)opt_rec_timestamp}, "set the timestamp ('now' to set the current time)", "time" },
-    { "metadata", OPT_FUNC2 | HAS_ARG, {(void*)opt_metadata}, "add metadata", "string=string" },
-    { "dframes", OPT_INT | HAS_ARG, {(void*)&max_frames[AVMEDIA_TYPE_DATA]}, "set the number of data frames to record", "number" },
-    { "benchmark", OPT_BOOL | OPT_EXPERT, {(void*)&do_benchmark},
-      "add timings for benchmarking" },
-    { "timelimit", OPT_FUNC2 | HAS_ARG, {(void*)opt_timelimit}, "set max runtime in seconds", "limit" },
-    { "dump", OPT_BOOL | OPT_EXPERT, {(void*)&do_pkt_dump},
-      "dump each input packet" },
-    { "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
-      "when dumping packets, also dump the payload" },
-    { "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" },
-    { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" },
-    { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" },
-    { "v", HAS_ARG | OPT_FUNC2, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" },
-    { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
-    { "threads", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
-    { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
-    { "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
-    { "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" },
-    { "vglobal", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_global_header}, "video global header storage type", "" },
-    { "copyts", OPT_BOOL | OPT_EXPERT, {(void*)&copy_ts}, "copy timestamps" },
-    { "shortest", OPT_BOOL | OPT_EXPERT, {(void*)&opt_shortest}, "finish encoding within shortest input" }, //
-    { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&dts_delta_threshold}, "timestamp discontinuity delta threshold", "threshold" },
-    { "programid", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&opt_programid}, "desired program number", "" },
-    { "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" },
-    { "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)&copy_initial_nonkeyframes}, "copy initial non-keyframes" },
-
-    /* video options */
-    { "b", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
-    { "vb", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
-    { "vframes", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&max_frames[AVMEDIA_TYPE_VIDEO]}, "set the number of video frames to record", "number" },
-    { "r", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
-    { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
-    { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
-    { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" },
-    { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_top}, "set top crop band size (in pixels)", "size" },
-    { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_bottom}, "set bottom crop band size (in pixels)", "size" },
-    { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_left}, "set left crop band size (in pixels)", "size" },
-    { "cropright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_right}, "set right crop band size (in pixels)", "size" },
-    { "padtop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_pad_top}, "set top pad band size (in pixels)", "size" },
-    { "padbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_pad_bottom}, "set bottom pad band size (in pixels)", "size" },
-    { "padleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_pad_left}, "set left pad band size (in pixels)", "size" },
-    { "padright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_pad_right}, "set right pad band size (in pixels)", "size" },
-    { "padcolor", HAS_ARG | OPT_VIDEO, {(void*)opt_pad_color}, "set color of pad bands (Hex 000000 thru FFFFFF)", "color" },
-    { "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
-    { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
-    { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
-    { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" },
-    { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
-    { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
-    { "me_threshold", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold",  "threshold" },
-    { "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality},
-      "use same video quality as source (implies VBR)" },
-    { "pass", HAS_ARG | OPT_VIDEO, {(void*)&opt_pass}, "select the pass number (1 or 2)", "n" },
-    { "passlogfile", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void*)&pass_logfilename_prefix}, "select two pass log file name prefix", "prefix" },
-    { "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
-      "deinterlace pictures" },
-    { "psnr", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_psnr}, "calculate PSNR of compressed frames" },
-    { "vstats", OPT_EXPERT | OPT_VIDEO, {(void*)&opt_vstats}, "dump video coding statistics to file" },
-    { "vstats_file", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_vstats_file}, "dump video coding statistics to file", "file" },
-    { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
-    { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
-    { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
-    { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
-    { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" },
-    { "newvideo", OPT_VIDEO, {(void*)opt_new_video_stream}, "add a new video stream to the current output stream" },
-    { "vlang", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void *)&video_language}, "set the ISO 639 language code (3 letters) of the current video stream" , "code" },
-    { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
-    { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&force_fps}, "force the selected framerate, disable the best supported framerate selection" },
-
-    /* audio options */
-    { "ab", OPT_FUNC2 | HAS_ARG | OPT_AUDIO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
-    { "aframes", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&max_frames[AVMEDIA_TYPE_AUDIO]}, "set the number of audio frames to record", "number" },
-    { "aq", OPT_FLOAT | HAS_ARG | OPT_AUDIO, {(void*)&audio_qscale}, "set audio quality (codec-specific)", "quality", },
-    { "ar", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_rate}, "set audio sampling rate (in Hz)", "rate" },
-    { "ac", HAS_ARG | OPT_FUNC2 | OPT_AUDIO, {(void*)opt_audio_channels}, "set number of audio channels", "channels" },
-    { "an", OPT_BOOL | OPT_AUDIO, {(void*)&audio_disable}, "disable audio" },
-    { "acodec", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_codec}, "force audio codec ('copy' to copy stream)", "codec" },
-    { "atag", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_tag}, "force audio tag/fourcc", "fourcc/tag" },
-    { "vol", OPT_INT | HAS_ARG | OPT_AUDIO, {(void*)&audio_volume}, "change audio volume (256=normal)" , "volume" }, //
-    { "newaudio", OPT_AUDIO, {(void*)opt_new_audio_stream}, "add a new audio stream to the current output stream" },
-    { "alang", HAS_ARG | OPT_STRING | OPT_AUDIO, {(void *)&audio_language}, "set the ISO 639 language code (3 letters) of the current audio stream" , "code" },
-    { "sample_fmt", HAS_ARG | OPT_EXPERT | OPT_AUDIO, {(void*)opt_audio_sample_fmt}, "set sample format, 'list' as argument shows all the sample formats supported", "format" },
-
-    /* subtitle options */
-    { "sn", OPT_BOOL | OPT_SUBTITLE, {(void*)&subtitle_disable}, "disable subtitle" },
-    { "scodec", HAS_ARG | OPT_SUBTITLE, {(void*)opt_subtitle_codec}, "force subtitle codec ('copy' to copy stream)", "codec" },
-    { "newsubtitle", OPT_SUBTITLE, {(void*)opt_new_subtitle_stream}, "add a new subtitle stream to the current output stream" },
-    { "slang", HAS_ARG | OPT_STRING | OPT_SUBTITLE, {(void *)&subtitle_language}, "set the ISO 639 language code (3 letters) of the current subtitle stream" , "code" },
-    { "stag", HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_subtitle_tag}, "force subtitle tag/fourcc", "fourcc/tag" },
-
-    /* grab options */
-    { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" },
-    { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_standard}, "set television standard (NTSC, PAL (SECAM))", "standard" },
-    { "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, {(void*)&input_sync}, "sync read on input", "" },
-
-    /* muxer options */
-    { "muxdelay", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_max_delay}, "set the maximum demux-decode delay", "seconds" },
-    { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT, {(void*)&mux_preload}, "set the initial demux-decode delay", "seconds" },
-
-    { "absf", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
-    { "vbsf", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
-    { "sbsf", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_bsf}, "", "bitstream_filter" },
-
-    { "apre", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_EXPERT, {(void*)opt_preset}, "set the audio options to the indicated preset", "preset" },
-    { "vpre", OPT_FUNC2 | HAS_ARG | OPT_VIDEO | OPT_EXPERT, {(void*)opt_preset}, "set the video options to the indicated preset", "preset" },
-    { "spre", OPT_FUNC2 | HAS_ARG | OPT_SUBTITLE | OPT_EXPERT, {(void*)opt_preset}, "set the subtitle options to the indicated preset", "preset" },
-    { "fpre", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_preset}, "set options from indicated preset file", "filename" },
-
-    { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
-    { NULL, },
-};
-
-int main(int argc, char **argv)
-{
-    int i;
-    int64_t ti;
-
-    avcodec_register_all();
-#if CONFIG_AVDEVICE
-    avdevice_register_all();
-#endif
-    av_register_all();
-
-#if HAVE_ISATTY
-    if(isatty(STDIN_FILENO))
-        url_set_interrupt_cb(decode_interrupt_cb);
-#endif
-
-    for(i=0; i<AVMEDIA_TYPE_NB; i++){
-        avcodec_opts[i]= avcodec_alloc_context2(i);
-    }
-    avformat_opts = avformat_alloc_context();
-    sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
-
-    show_banner();
-
-    /* parse options */
-    parse_options(argc, argv, options, opt_output_file);
-
-    if(nb_output_files <= 0 && nb_input_files == 0) {
-        show_usage();
-        fprintf(stderr, "Use -h to get full help or, even better, run 'man ffmpeg'\n");
-        av_exit(1);
-    }
-
-    /* file converter / grab */
-    if (nb_output_files <= 0) {
-        fprintf(stderr, "At least one output file must be specified\n");
-        av_exit(1);
-    }
-
-    if (nb_input_files == 0) {
-        fprintf(stderr, "At least one input file must be specified\n");
-        av_exit(1);
-    }
-
-    ti = getutime();
-    if (av_transcode(output_files, nb_output_files, input_files, nb_input_files,
-                     stream_maps, nb_stream_maps) < 0)
-        av_exit(1);
-    ti = getutime() - ti;
-    if (do_benchmark) {
-        int maxrss = getmaxrss() / 1024;
-        printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss);
-    }
-
-    return av_exit(0);
-}
diff --git a/ffplay.c b/ffplay.c
deleted file mode 100644
index e79e17b..0000000
--- a/ffplay.c
+++ /dev/null
@@ -1,3166 +0,0 @@
-/*
- * FFplay : Simple Media Player based on the FFmpeg libraries
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include <inttypes.h>
-#include <math.h>
-#include <limits.h>
-#include "libavutil/avstring.h"
-#include "libavutil/pixdesc.h"
-#include "libavformat/avformat.h"
-#include "libavdevice/avdevice.h"
-#include "libswscale/swscale.h"
-#include "libavcodec/audioconvert.h"
-#include "libavcodec/colorspace.h"
-#include "libavcodec/opt.h"
-#include "libavcodec/avfft.h"
-
-#if CONFIG_AVFILTER
-# include "libavfilter/avfilter.h"
-# include "libavfilter/avfiltergraph.h"
-# include "libavfilter/graphparser.h"
-#endif
-
-#include "cmdutils.h"
-
-#include <SDL.h>
-#include <SDL_thread.h>
-
-#ifdef __MINGW32__
-#undef main /* We don't want SDL to override our main() */
-#endif
-
-#include <unistd.h>
-#include <assert.h>
-
-const char program_name[] = "FFplay";
-const int program_birth_year = 2003;
-
-//#define DEBUG_SYNC
-
-#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
-#define MIN_AUDIOQ_SIZE (20 * 16 * 1024)
-#define MIN_FRAMES 5
-
-/* SDL audio buffer size, in samples. Should be small to have precise
-   A/V sync as SDL does not have hardware buffer fullness info. */
-#define SDL_AUDIO_BUFFER_SIZE 1024
-
-/* no AV sync correction is done if below the AV sync threshold */
-#define AV_SYNC_THRESHOLD 0.01
-/* no AV correction is done if too big error */
-#define AV_NOSYNC_THRESHOLD 10.0
-
-#define FRAME_SKIP_FACTOR 0.05
-
-/* maximum audio speed change to get correct sync */
-#define SAMPLE_CORRECTION_PERCENT_MAX 10
-
-/* we use about AUDIO_DIFF_AVG_NB A-V differences to make the average */
-#define AUDIO_DIFF_AVG_NB   20
-
-/* NOTE: the size must be big enough to compensate the hardware audio buffersize size */
-#define SAMPLE_ARRAY_SIZE (2*65536)
-
-#if !CONFIG_AVFILTER
-static int sws_flags = SWS_BICUBIC;
-#endif
-
-typedef struct PacketQueue {
-    AVPacketList *first_pkt, *last_pkt;
-    int nb_packets;
-    int size;
-    int abort_request;
-    SDL_mutex *mutex;
-    SDL_cond *cond;
-} PacketQueue;
-
-#define VIDEO_PICTURE_QUEUE_SIZE 2
-#define SUBPICTURE_QUEUE_SIZE 4
-
-typedef struct VideoPicture {
-    double pts;                                  ///<presentation time stamp for this picture
-    double target_clock;                         ///<av_gettime() time at which this should be displayed ideally
-    int64_t pos;                                 ///<byte position in file
-    SDL_Overlay *bmp;
-    int width, height; /* source height & width */
-    int allocated;
-    enum PixelFormat pix_fmt;
-
-#if CONFIG_AVFILTER
-    AVFilterPicRef *picref;
-#endif
-} VideoPicture;
-
-typedef struct SubPicture {
-    double pts; /* presentation time stamp for this picture */
-    AVSubtitle sub;
-} SubPicture;
-
-enum {
-    AV_SYNC_AUDIO_MASTER, /* default choice */
-    AV_SYNC_VIDEO_MASTER,
-    AV_SYNC_EXTERNAL_CLOCK, /* synchronize to an external clock */
-};
-
-typedef struct VideoState {
-    SDL_Thread *parse_tid;
-    SDL_Thread *video_tid;
-    SDL_Thread *refresh_tid;
-    AVInputFormat *iformat;
-    int no_background;
-    int abort_request;
-    int paused;
-    int last_paused;
-    int seek_req;
-    int seek_flags;
-    int64_t seek_pos;
-    int64_t seek_rel;
-    int read_pause_return;
-    AVFormatContext *ic;
-    int dtg_active_format;
-
-    int audio_stream;
-
-    int av_sync_type;
-    double external_clock; /* external clock base */
-    int64_t external_clock_time;
-
-    double audio_clock;
-    double audio_diff_cum; /* used for AV difference average computation */
-    double audio_diff_avg_coef;
-    double audio_diff_threshold;
-    int audio_diff_avg_count;
-    AVStream *audio_st;
-    PacketQueue audioq;
-    int audio_hw_buf_size;
-    /* samples output by the codec. we reserve more space for avsync
-       compensation */
-    DECLARE_ALIGNED(16,uint8_t,audio_buf1)[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2];
-    DECLARE_ALIGNED(16,uint8_t,audio_buf2)[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3) / 2];
-    uint8_t *audio_buf;
-    unsigned int audio_buf_size; /* in bytes */
-    int audio_buf_index; /* in bytes */
-    AVPacket audio_pkt_temp;
-    AVPacket audio_pkt;
-    enum SampleFormat audio_src_fmt;
-    AVAudioConvert *reformat_ctx;
-
-    int show_audio; /* if true, display audio samples */
-    int16_t sample_array[SAMPLE_ARRAY_SIZE];
-    int sample_array_index;
-    int last_i_start;
-    RDFTContext *rdft;
-    int rdft_bits;
-    int xpos;
-
-    SDL_Thread *subtitle_tid;
-    int subtitle_stream;
-    int subtitle_stream_changed;
-    AVStream *subtitle_st;
-    PacketQueue subtitleq;
-    SubPicture subpq[SUBPICTURE_QUEUE_SIZE];
-    int subpq_size, subpq_rindex, subpq_windex;
-    SDL_mutex *subpq_mutex;
-    SDL_cond *subpq_cond;
-
-    double frame_timer;
-    double frame_last_pts;
-    double frame_last_delay;
-    double video_clock;                          ///<pts of last decoded frame / predicted pts of next decoded frame
-    int video_stream;
-    AVStream *video_st;
-    PacketQueue videoq;
-    double video_current_pts;                    ///<current displayed pts (different from video_clock if frame fifos are used)
-    double video_current_pts_drift;              ///<video_current_pts - time (av_gettime) at which we updated video_current_pts - used to have running video pts
-    int64_t video_current_pos;                   ///<current displayed file pos
-    VideoPicture pictq[VIDEO_PICTURE_QUEUE_SIZE];
-    int pictq_size, pictq_rindex, pictq_windex;
-    SDL_mutex *pictq_mutex;
-    SDL_cond *pictq_cond;
-#if !CONFIG_AVFILTER
-    struct SwsContext *img_convert_ctx;
-#endif
-
-    //    QETimer *video_timer;
-    char filename[1024];
-    int width, height, xleft, ytop;
-
-    int64_t faulty_pts;
-    int64_t faulty_dts;
-    int64_t last_dts_for_fault_detection;
-    int64_t last_pts_for_fault_detection;
-
-#if CONFIG_AVFILTER
-    AVFilterContext *out_video_filter;          ///<the last filter in the video chain
-#endif
-
-    float skip_frames;
-    float skip_frames_index;
-    int refresh;
-} VideoState;
-
-static void show_help(void);
-static int audio_write_get_buf_size(VideoState *is);
-
-/* options specified by the user */
-static AVInputFormat *file_iformat;
-static const char *input_filename;
-static const char *window_title;
-static int fs_screen_width;
-static int fs_screen_height;
-static int screen_width = 0;
-static int screen_height = 0;
-static int frame_width = 0;
-static int frame_height = 0;
-static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
-static int audio_disable;
-static int video_disable;
-static int wanted_stream[AVMEDIA_TYPE_NB]={
-    [AVMEDIA_TYPE_AUDIO]=-1,
-    [AVMEDIA_TYPE_VIDEO]=-1,
-    [AVMEDIA_TYPE_SUBTITLE]=-1,
-};
-static int seek_by_bytes=-1;
-static int display_disable;
-static int show_status = 1;
-static int av_sync_type = AV_SYNC_AUDIO_MASTER;
-static int64_t start_time = AV_NOPTS_VALUE;
-static int64_t duration = AV_NOPTS_VALUE;
-static int debug = 0;
-static int debug_mv = 0;
-static int step = 0;
-static int thread_count = 1;
-static int workaround_bugs = 1;
-static int fast = 0;
-static int genpts = 0;
-static int lowres = 0;
-static int idct = FF_IDCT_AUTO;
-static enum AVDiscard skip_frame= AVDISCARD_DEFAULT;
-static enum AVDiscard skip_idct= AVDISCARD_DEFAULT;
-static enum AVDiscard skip_loop_filter= AVDISCARD_DEFAULT;
-static int error_recognition = FF_ER_CAREFUL;
-static int error_concealment = 3;
-static int decoder_reorder_pts= -1;
-static int autoexit;
-static int loop=1;
-static int framedrop=1;
-
-static int rdftspeed=20;
-#if CONFIG_AVFILTER
-static char *vfilters = NULL;
-#endif
-
-/* current context */
-static int is_full_screen;
-static VideoState *cur_stream;
-static int64_t audio_callback_time;
-
-static AVPacket flush_pkt;
-
-#define FF_ALLOC_EVENT   (SDL_USEREVENT)
-#define FF_REFRESH_EVENT (SDL_USEREVENT + 1)
-#define FF_QUIT_EVENT    (SDL_USEREVENT + 2)
-
-static SDL_Surface *screen;
-
-static int packet_queue_put(PacketQueue *q, AVPacket *pkt);
-
-/* packet queue handling */
-static void packet_queue_init(PacketQueue *q)
-{
-    memset(q, 0, sizeof(PacketQueue));
-    q->mutex = SDL_CreateMutex();
-    q->cond = SDL_CreateCond();
-    packet_queue_put(q, &flush_pkt);
-}
-
-static void packet_queue_flush(PacketQueue *q)
-{
-    AVPacketList *pkt, *pkt1;
-
-    SDL_LockMutex(q->mutex);
-    for(pkt = q->first_pkt; pkt != NULL; pkt = pkt1) {
-        pkt1 = pkt->next;
-        av_free_packet(&pkt->pkt);
-        av_freep(&pkt);
-    }
-    q->last_pkt = NULL;
-    q->first_pkt = NULL;
-    q->nb_packets = 0;
-    q->size = 0;
-    SDL_UnlockMutex(q->mutex);
-}
-
-static void packet_queue_end(PacketQueue *q)
-{
-    packet_queue_flush(q);
-    SDL_DestroyMutex(q->mutex);
-    SDL_DestroyCond(q->cond);
-}
-
-static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
-{
-    AVPacketList *pkt1;
-
-    /* duplicate the packet */
-    if (pkt!=&flush_pkt && av_dup_packet(pkt) < 0)
-        return -1;
-
-    pkt1 = av_malloc(sizeof(AVPacketList));
-    if (!pkt1)
-        return -1;
-    pkt1->pkt = *pkt;
-    pkt1->next = NULL;
-
-
-    SDL_LockMutex(q->mutex);
-
-    if (!q->last_pkt)
-
-        q->first_pkt = pkt1;
-    else
-        q->last_pkt->next = pkt1;
-    q->last_pkt = pkt1;
-    q->nb_packets++;
-    q->size += pkt1->pkt.size + sizeof(*pkt1);
-    /* XXX: should duplicate packet data in DV case */
-    SDL_CondSignal(q->cond);
-
-    SDL_UnlockMutex(q->mutex);
-    return 0;
-}
-
-static void packet_queue_abort(PacketQueue *q)
-{
-    SDL_LockMutex(q->mutex);
-
-    q->abort_request = 1;
-
-    SDL_CondSignal(q->cond);
-
-    SDL_UnlockMutex(q->mutex);
-}
-
-/* return < 0 if aborted, 0 if no packet and > 0 if packet.  */
-static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block)
-{
-    AVPacketList *pkt1;
-    int ret;
-
-    SDL_LockMutex(q->mutex);
-
-    for(;;) {
-        if (q->abort_request) {
-            ret = -1;
-            break;
-        }
-
-        pkt1 = q->first_pkt;
-        if (pkt1) {
-            q->first_pkt = pkt1->next;
-            if (!q->first_pkt)
-                q->last_pkt = NULL;
-            q->nb_packets--;
-            q->size -= pkt1->pkt.size + sizeof(*pkt1);
-            *pkt = pkt1->pkt;
-            av_free(pkt1);
-            ret = 1;
-            break;
-        } else if (!block) {
-            ret = 0;
-            break;
-        } else {
-            SDL_CondWait(q->cond, q->mutex);
-        }
-    }
-    SDL_UnlockMutex(q->mutex);
-    return ret;
-}
-
-static inline void fill_rectangle(SDL_Surface *screen,
-                                  int x, int y, int w, int h, int color)
-{
-    SDL_Rect rect;
-    rect.x = x;
-    rect.y = y;
-    rect.w = w;
-    rect.h = h;
-    SDL_FillRect(screen, &rect, color);
-}
-
-#if 0
-/* draw only the border of a rectangle */
-void fill_border(VideoState *s, int x, int y, int w, int h, int color)
-{
-    int w1, w2, h1, h2;
-
-    /* fill the background */
-    w1 = x;
-    if (w1 < 0)
-        w1 = 0;
-    w2 = s->width - (x + w);
-    if (w2 < 0)
-        w2 = 0;
-    h1 = y;
-    if (h1 < 0)
-        h1 = 0;
-    h2 = s->height - (y + h);
-    if (h2 < 0)
-        h2 = 0;
-    fill_rectangle(screen,
-                   s->xleft, s->ytop,
-                   w1, s->height,
-                   color);
-    fill_rectangle(screen,
-                   s->xleft + s->width - w2, s->ytop,
-                   w2, s->height,
-                   color);
-    fill_rectangle(screen,
-                   s->xleft + w1, s->ytop,
-                   s->width - w1 - w2, h1,
-                   color);
-    fill_rectangle(screen,
-                   s->xleft + w1, s->ytop + s->height - h2,
-                   s->width - w1 - w2, h2,
-                   color);
-}
-#endif
-
-#define ALPHA_BLEND(a, oldp, newp, s)\
-((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s))
-
-#define RGBA_IN(r, g, b, a, s)\
-{\
-    unsigned int v = ((const uint32_t *)(s))[0];\
-    a = (v >> 24) & 0xff;\
-    r = (v >> 16) & 0xff;\
-    g = (v >> 8) & 0xff;\
-    b = v & 0xff;\
-}
-
-#define YUVA_IN(y, u, v, a, s, pal)\
-{\
-    unsigned int val = ((const uint32_t *)(pal))[*(const uint8_t*)(s)];\
-    a = (val >> 24) & 0xff;\
-    y = (val >> 16) & 0xff;\
-    u = (val >> 8) & 0xff;\
-    v = val & 0xff;\
-}
-
-#define YUVA_OUT(d, y, u, v, a)\
-{\
-    ((uint32_t *)(d))[0] = (a << 24) | (y << 16) | (u << 8) | v;\
-}
-
-
-#define BPP 1
-
-static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, int imgh)
-{
-    int wrap, wrap3, width2, skip2;
-    int y, u, v, a, u1, v1, a1, w, h;
-    uint8_t *lum, *cb, *cr;
-    const uint8_t *p;
-    const uint32_t *pal;
-    int dstx, dsty, dstw, dsth;
-
-    dstw = av_clip(rect->w, 0, imgw);
-    dsth = av_clip(rect->h, 0, imgh);
-    dstx = av_clip(rect->x, 0, imgw - dstw);
-    dsty = av_clip(rect->y, 0, imgh - dsth);
-    lum = dst->data[0] + dsty * dst->linesize[0];
-    cb = dst->data[1] + (dsty >> 1) * dst->linesize[1];
-    cr = dst->data[2] + (dsty >> 1) * dst->linesize[2];
-
-    width2 = ((dstw + 1) >> 1) + (dstx & ~dstw & 1);
-    skip2 = dstx >> 1;
-    wrap = dst->linesize[0];
-    wrap3 = rect->pict.linesize[0];
-    p = rect->pict.data[0];
-    pal = (const uint32_t *)rect->pict.data[1];  /* Now in YCrCb! */
-
-    if (dsty & 1) {
-        lum += dstx;
-        cb += skip2;
-        cr += skip2;
-
-        if (dstx & 1) {
-            YUVA_IN(y, u, v, a, p, pal);
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
-            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
-            cb++;
-            cr++;
-            lum++;
-            p += BPP;
-        }
-        for(w = dstw - (dstx & 1); w >= 2; w -= 2) {
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 = u;
-            v1 = v;
-            a1 = a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-
-            YUVA_IN(y, u, v, a, p + BPP, pal);
-            u1 += u;
-            v1 += v;
-            a1 += a;
-            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
-            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1);
-            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1);
-            cb++;
-            cr++;
-            p += 2 * BPP;
-            lum += 2;
-        }
-        if (w) {
-            YUVA_IN(y, u, v, a, p, pal);
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
-            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
-            p++;
-            lum++;
-        }
-        p += wrap3 - dstw * BPP;
-        lum += wrap - dstw - dstx;
-        cb += dst->linesize[1] - width2 - skip2;
-        cr += dst->linesize[2] - width2 - skip2;
-    }
-    for(h = dsth - (dsty & 1); h >= 2; h -= 2) {
-        lum += dstx;
-        cb += skip2;
-        cr += skip2;
-
-        if (dstx & 1) {
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 = u;
-            v1 = v;
-            a1 = a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            p += wrap3;
-            lum += wrap;
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 += u;
-            v1 += v;
-            a1 += a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1);
-            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1);
-            cb++;
-            cr++;
-            p += -wrap3 + BPP;
-            lum += -wrap + 1;
-        }
-        for(w = dstw - (dstx & 1); w >= 2; w -= 2) {
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 = u;
-            v1 = v;
-            a1 = a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-
-            YUVA_IN(y, u, v, a, p + BPP, pal);
-            u1 += u;
-            v1 += v;
-            a1 += a;
-            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
-            p += wrap3;
-            lum += wrap;
-
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 += u;
-            v1 += v;
-            a1 += a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-
-            YUVA_IN(y, u, v, a, p + BPP, pal);
-            u1 += u;
-            v1 += v;
-            a1 += a;
-            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
-
-            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 2);
-            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 2);
-
-            cb++;
-            cr++;
-            p += -wrap3 + 2 * BPP;
-            lum += -wrap + 2;
-        }
-        if (w) {
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 = u;
-            v1 = v;
-            a1 = a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            p += wrap3;
-            lum += wrap;
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 += u;
-            v1 += v;
-            a1 += a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1);
-            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1);
-            cb++;
-            cr++;
-            p += -wrap3 + BPP;
-            lum += -wrap + 1;
-        }
-        p += wrap3 + (wrap3 - dstw * BPP);
-        lum += wrap + (wrap - dstw - dstx);
-        cb += dst->linesize[1] - width2 - skip2;
-        cr += dst->linesize[2] - width2 - skip2;
-    }
-    /* handle odd height */
-    if (h) {
-        lum += dstx;
-        cb += skip2;
-        cr += skip2;
-
-        if (dstx & 1) {
-            YUVA_IN(y, u, v, a, p, pal);
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
-            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
-            cb++;
-            cr++;
-            lum++;
-            p += BPP;
-        }
-        for(w = dstw - (dstx & 1); w >= 2; w -= 2) {
-            YUVA_IN(y, u, v, a, p, pal);
-            u1 = u;
-            v1 = v;
-            a1 = a;
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-
-            YUVA_IN(y, u, v, a, p + BPP, pal);
-            u1 += u;
-            v1 += v;
-            a1 += a;
-            lum[1] = ALPHA_BLEND(a, lum[1], y, 0);
-            cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u, 1);
-            cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v, 1);
-            cb++;
-            cr++;
-            p += 2 * BPP;
-            lum += 2;
-        }
-        if (w) {
-            YUVA_IN(y, u, v, a, p, pal);
-            lum[0] = ALPHA_BLEND(a, lum[0], y, 0);
-            cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0);
-            cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0);
-        }
-    }
-}
-
-static void free_subpicture(SubPicture *sp)
-{
-    int i;
-
-    for (i = 0; i < sp->sub.num_rects; i++)
-    {
-        av_freep(&sp->sub.rects[i]->pict.data[0]);
-        av_freep(&sp->sub.rects[i]->pict.data[1]);
-        av_freep(&sp->sub.rects[i]);
-    }
-
-    av_free(sp->sub.rects);
-
-    memset(&sp->sub, 0, sizeof(AVSubtitle));
-}
-
-static void video_image_display(VideoState *is)
-{
-    VideoPicture *vp;
-    SubPicture *sp;
-    AVPicture pict;
-    float aspect_ratio;
-    int width, height, x, y;
-    SDL_Rect rect;
-    int i;
-
-    vp = &is->pictq[is->pictq_rindex];
-    if (vp->bmp) {
-#if CONFIG_AVFILTER
-         if (vp->picref->pixel_aspect.num == 0)
-             aspect_ratio = 0;
-         else
-             aspect_ratio = av_q2d(vp->picref->pixel_aspect);
-#else
-
-        /* XXX: use variable in the frame */
-        if (is->video_st->sample_aspect_ratio.num)
-            aspect_ratio = av_q2d(is->video_st->sample_aspect_ratio);
-        else if (is->video_st->codec->sample_aspect_ratio.num)
-            aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio);
-        else
-            aspect_ratio = 0;
-#endif
-        if (aspect_ratio <= 0.0)
-            aspect_ratio = 1.0;
-        aspect_ratio *= (float)vp->width / (float)vp->height;
-        /* if an active format is indicated, then it overrides the
-           mpeg format */
-#if 0
-        if (is->video_st->codec->dtg_active_format != is->dtg_active_format) {
-            is->dtg_active_format = is->video_st->codec->dtg_active_format;
-            printf("dtg_active_format=%d\n", is->dtg_active_format);
-        }
-#endif
-#if 0
-        switch(is->video_st->codec->dtg_active_format) {
-        case FF_DTG_AFD_SAME:
-        default:
-            /* nothing to do */
-            break;
-        case FF_DTG_AFD_4_3:
-            aspect_ratio = 4.0 / 3.0;
-            break;
-        case FF_DTG_AFD_16_9:
-            aspect_ratio = 16.0 / 9.0;
-            break;
-        case FF_DTG_AFD_14_9:
-            aspect_ratio = 14.0 / 9.0;
-            break;
-        case FF_DTG_AFD_4_3_SP_14_9:
-            aspect_ratio = 14.0 / 9.0;
-            break;
-        case FF_DTG_AFD_16_9_SP_14_9:
-            aspect_ratio = 14.0 / 9.0;
-            break;
-        case FF_DTG_AFD_SP_4_3:
-            aspect_ratio = 4.0 / 3.0;
-            break;
-        }
-#endif
-
-        if (is->subtitle_st)
-        {
-            if (is->subpq_size > 0)
-            {
-                sp = &is->subpq[is->subpq_rindex];
-
-                if (vp->pts >= sp->pts + ((float) sp->sub.start_display_time / 1000))
-                {
-                    SDL_LockYUVOverlay (vp->bmp);
-
-                    pict.data[0] = vp->bmp->pixels[0];
-                    pict.data[1] = vp->bmp->pixels[2];
-                    pict.data[2] = vp->bmp->pixels[1];
-
-                    pict.linesize[0] = vp->bmp->pitches[0];
-                    pict.linesize[1] = vp->bmp->pitches[2];
-                    pict.linesize[2] = vp->bmp->pitches[1];
-
-                    for (i = 0; i < sp->sub.num_rects; i++)
-                        blend_subrect(&pict, sp->sub.rects[i],
-                                      vp->bmp->w, vp->bmp->h);
-
-                    SDL_UnlockYUVOverlay (vp->bmp);
-                }
-            }
-        }
-
-
-        /* XXX: we suppose the screen has a 1.0 pixel ratio */
-        height = is->height;
-        width = ((int)rint(height * aspect_ratio)) & ~1;
-        if (width > is->width) {
-            width = is->width;
-            height = ((int)rint(width / aspect_ratio)) & ~1;
-        }
-        x = (is->width - width) / 2;
-        y = (is->height - height) / 2;
-        if (!is->no_background) {
-            /* fill the background */
-            //            fill_border(is, x, y, width, height, QERGB(0x00, 0x00, 0x00));
-        } else {
-            is->no_background = 0;
-        }
-        rect.x = is->xleft + x;
-        rect.y = is->ytop  + y;
-        rect.w = width;
-        rect.h = height;
-        SDL_DisplayYUVOverlay(vp->bmp, &rect);
-    } else {
-#if 0
-        fill_rectangle(screen,
-                       is->xleft, is->ytop, is->width, is->height,
-                       QERGB(0x00, 0x00, 0x00));
-#endif
-    }
-}
-
-static inline int compute_mod(int a, int b)
-{
-    a = a % b;
-    if (a >= 0)
-        return a;
-    else
-        return a + b;
-}
-
-static void video_audio_display(VideoState *s)
-{
-    int i, i_start, x, y1, y, ys, delay, n, nb_display_channels;
-    int ch, channels, h, h2, bgcolor, fgcolor;
-    int16_t time_diff;
-    int rdft_bits, nb_freq;
-
-    for(rdft_bits=1; (1<<rdft_bits)<2*s->height; rdft_bits++)
-        ;
-    nb_freq= 1<<(rdft_bits-1);
-
-    /* compute display index : center on currently output samples */
-    channels = s->audio_st->codec->channels;
-    nb_display_channels = channels;
-    if (!s->paused) {
-        int data_used= s->show_audio==1 ? s->width : (2*nb_freq);
-        n = 2 * channels;
-        delay = audio_write_get_buf_size(s);
-        delay /= n;
-
-        /* to be more precise, we take into account the time spent since
-           the last buffer computation */
-        if (audio_callback_time) {
-            time_diff = av_gettime() - audio_callback_time;
-            delay -= (time_diff * s->audio_st->codec->sample_rate) / 1000000;
-        }
-
-        delay += 2*data_used;
-        if (delay < data_used)
-            delay = data_used;
-
-        i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE);
-        if(s->show_audio==1){
-            h= INT_MIN;
-            for(i=0; i<1000; i+=channels){
-                int idx= (SAMPLE_ARRAY_SIZE + x - i) % SAMPLE_ARRAY_SIZE;
-                int a= s->sample_array[idx];
-                int b= s->sample_array[(idx + 4*channels)%SAMPLE_ARRAY_SIZE];
-                int c= s->sample_array[(idx + 5*channels)%SAMPLE_ARRAY_SIZE];
-                int d= s->sample_array[(idx + 9*channels)%SAMPLE_ARRAY_SIZE];
-                int score= a-d;
-                if(h<score && (b^c)<0){
-                    h= score;
-                    i_start= idx;
-                }
-            }
-        }
-
-        s->last_i_start = i_start;
-    } else {
-        i_start = s->last_i_start;
-    }
-
-    bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
-    if(s->show_audio==1){
-        fill_rectangle(screen,
-                       s->xleft, s->ytop, s->width, s->height,
-                       bgcolor);
-
-        fgcolor = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff);
-
-        /* total height for one channel */
-        h = s->height / nb_display_channels;
-        /* graph height / 2 */
-        h2 = (h * 9) / 20;
-        for(ch = 0;ch < nb_display_channels; ch++) {
-            i = i_start + ch;
-            y1 = s->ytop + ch * h + (h / 2); /* position of center line */
-            for(x = 0; x < s->width; x++) {
-                y = (s->sample_array[i] * h2) >> 15;
-                if (y < 0) {
-                    y = -y;
-                    ys = y1 - y;
-                } else {
-                    ys = y1;
-                }
-                fill_rectangle(screen,
-                               s->xleft + x, ys, 1, y,
-                               fgcolor);
-                i += channels;
-                if (i >= SAMPLE_ARRAY_SIZE)
-                    i -= SAMPLE_ARRAY_SIZE;
-            }
-        }
-
-        fgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff);
-
-        for(ch = 1;ch < nb_display_channels; ch++) {
-            y = s->ytop + ch * h;
-            fill_rectangle(screen,
-                           s->xleft, y, s->width, 1,
-                           fgcolor);
-        }
-        SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height);
-    }else{
-        nb_display_channels= FFMIN(nb_display_channels, 2);
-        if(rdft_bits != s->rdft_bits){
-            av_rdft_end(s->rdft);
-            s->rdft = av_rdft_init(rdft_bits, DFT_R2C);
-            s->rdft_bits= rdft_bits;
-        }
-        {
-            FFTSample data[2][2*nb_freq];
-            for(ch = 0;ch < nb_display_channels; ch++) {
-                i = i_start + ch;
-                for(x = 0; x < 2*nb_freq; x++) {
-                    double w= (x-nb_freq)*(1.0/nb_freq);
-                    data[ch][x]= s->sample_array[i]*(1.0-w*w);
-                    i += channels;
-                    if (i >= SAMPLE_ARRAY_SIZE)
-                        i -= SAMPLE_ARRAY_SIZE;
-                }
-                av_rdft_calc(s->rdft, data[ch]);
-            }
-            //least efficient way to do this, we should of course directly access it but its more than fast enough
-            for(y=0; y<s->height; y++){
-                double w= 1/sqrt(nb_freq);
-                int a= sqrt(w*sqrt(data[0][2*y+0]*data[0][2*y+0] + data[0][2*y+1]*data[0][2*y+1]));
-                int b= sqrt(w*sqrt(data[1][2*y+0]*data[1][2*y+0] + data[1][2*y+1]*data[1][2*y+1]));
-                a= FFMIN(a,255);
-                b= FFMIN(b,255);
-                fgcolor = SDL_MapRGB(screen->format, a, b, (a+b)/2);
-
-                fill_rectangle(screen,
-                            s->xpos, s->height-y, 1, 1,
-                            fgcolor);
-            }
-        }
-        SDL_UpdateRect(screen, s->xpos, s->ytop, 1, s->height);
-        s->xpos++;
-        if(s->xpos >= s->width)
-            s->xpos= s->xleft;
-    }
-}
-
-static int video_open(VideoState *is){
-    int flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
-    int w,h;
-
-    if(is_full_screen) flags |= SDL_FULLSCREEN;
-    else               flags |= SDL_RESIZABLE;
-
-    if (is_full_screen && fs_screen_width) {
-        w = fs_screen_width;
-        h = fs_screen_height;
-    } else if(!is_full_screen && screen_width){
-        w = screen_width;
-        h = screen_height;
-#if CONFIG_AVFILTER
-    }else if (is->out_video_filter && is->out_video_filter->inputs[0]){
-        w = is->out_video_filter->inputs[0]->w;
-        h = is->out_video_filter->inputs[0]->h;
-#else
-    }else if (is->video_st && is->video_st->codec->width){
-        w = is->video_st->codec->width;
-        h = is->video_st->codec->height;
-#endif
-    } else {
-        w = 640;
-        h = 480;
-    }
-    if(screen && is->width == screen->w && screen->w == w
-       && is->height== screen->h && screen->h == h)
-        return 0;
-
-#ifndef __APPLE__
-    screen = SDL_SetVideoMode(w, h, 0, flags);
-#else
-    /* setting bits_per_pixel = 0 or 32 causes blank video on OS X */
-    screen = SDL_SetVideoMode(w, h, 24, flags);
-#endif
-    if (!screen) {
-        fprintf(stderr, "SDL: could not set video mode - exiting\n");
-        return -1;
-    }
-    if (!window_title)
-        window_title = input_filename;
-    SDL_WM_SetCaption(window_title, window_title);
-
-    is->width = screen->w;
-    is->height = screen->h;
-
-    return 0;
-}
-
-/* display the current picture, if any */
-static void video_display(VideoState *is)
-{
-    if(!screen)
-        video_open(cur_stream);
-    if (is->audio_st && is->show_audio)
-        video_audio_display(is);
-    else if (is->video_st)
-        video_image_display(is);
-}
-
-static int refresh_thread(void *opaque)
-{
-    VideoState *is= opaque;
-    while(!is->abort_request){
-    SDL_Event event;
-    event.type = FF_REFRESH_EVENT;
-    event.user.data1 = opaque;
-        if(!is->refresh){
-            is->refresh=1;
-    SDL_PushEvent(&event);
-        }
-        usleep(is->audio_st && is->show_audio ? rdftspeed*1000 : 5000); //FIXME ideally we should wait the correct time but SDLs event passing is so slow it would be silly
-    }
-    return 0;
-}
-
-/* get the current audio clock value */
-static double get_audio_clock(VideoState *is)
-{
-    double pts;
-    int hw_buf_size, bytes_per_sec;
-    pts = is->audio_clock;
-    hw_buf_size = audio_write_get_buf_size(is);
-    bytes_per_sec = 0;
-    if (is->audio_st) {
-        bytes_per_sec = is->audio_st->codec->sample_rate *
-            2 * is->audio_st->codec->channels;
-    }
-    if (bytes_per_sec)
-        pts -= (double)hw_buf_size / bytes_per_sec;
-    return pts;
-}
-
-/* get the current video clock value */
-static double get_video_clock(VideoState *is)
-{
-    if (is->paused) {
-        return is->video_current_pts;
-    } else {
-        return is->video_current_pts_drift + av_gettime() / 1000000.0;
-    }
-}
-
-/* get the current external clock value */
-static double get_external_clock(VideoState *is)
-{
-    int64_t ti;
-    ti = av_gettime();
-    return is->external_clock + ((ti - is->external_clock_time) * 1e-6);
-}
-
-/* get the current master clock value */
-static double get_master_clock(VideoState *is)
-{
-    double val;
-
-    if (is->av_sync_type == AV_SYNC_VIDEO_MASTER) {
-        if (is->video_st)
-            val = get_video_clock(is);
-        else
-            val = get_audio_clock(is);
-    } else if (is->av_sync_type == AV_SYNC_AUDIO_MASTER) {
-        if (is->audio_st)
-            val = get_audio_clock(is);
-        else
-            val = get_video_clock(is);
-    } else {
-        val = get_external_clock(is);
-    }
-    return val;
-}
-
-/* seek in the stream */
-static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_bytes)
-{
-    if (!is->seek_req) {
-        is->seek_pos = pos;
-        is->seek_rel = rel;
-        is->seek_flags &= ~AVSEEK_FLAG_BYTE;
-        if (seek_by_bytes)
-            is->seek_flags |= AVSEEK_FLAG_BYTE;
-        is->seek_req = 1;
-    }
-}
-
-/* pause or resume the video */
-static void stream_pause(VideoState *is)
-{
-    if (is->paused) {
-        is->frame_timer += av_gettime() / 1000000.0 + is->video_current_pts_drift - is->video_current_pts;
-        if(is->read_pause_return != AVERROR(ENOSYS)){
-            is->video_current_pts = is->video_current_pts_drift + av_gettime() / 1000000.0;
-        }
-        is->video_current_pts_drift = is->video_current_pts - av_gettime() / 1000000.0;
-    }
-    is->paused = !is->paused;
-}
-
-static double compute_target_time(double frame_current_pts, VideoState *is)
-{
-    double delay, sync_threshold, diff;
-
-    /* compute nominal delay */
-    delay = frame_current_pts - is->frame_last_pts;
-    if (delay <= 0 || delay >= 10.0) {
-        /* if incorrect delay, use previous one */
-        delay = is->frame_last_delay;
-    } else {
-        is->frame_last_delay = delay;
-    }
-    is->frame_last_pts = frame_current_pts;
-
-    /* update delay to follow master synchronisation source */
-    if (((is->av_sync_type == AV_SYNC_AUDIO_MASTER && is->audio_st) ||
-         is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) {
-        /* if video is slave, we try to correct big delays by
-           duplicating or deleting a frame */
-        diff = get_video_clock(is) - get_master_clock(is);
-
-        /* skip or repeat frame. We take into account the
-           delay to compute the threshold. I still don't know
-           if it is the best guess */
-        sync_threshold = FFMAX(AV_SYNC_THRESHOLD, delay);
-        if (fabs(diff) < AV_NOSYNC_THRESHOLD) {
-            if (diff <= -sync_threshold)
-                delay = 0;
-            else if (diff >= sync_threshold)
-                delay = 2 * delay;
-        }
-    }
-    is->frame_timer += delay;
-#if defined(DEBUG_SYNC)
-    printf("video: delay=%0.3f actual_delay=%0.3f pts=%0.3f A-V=%f\n",
-            delay, actual_delay, frame_current_pts, -diff);
-#endif
-
-    return is->frame_timer;
-}
-
-/* called to display each frame */
-static void video_refresh_timer(void *opaque)
-{
-    VideoState *is = opaque;
-    VideoPicture *vp;
-
-    SubPicture *sp, *sp2;
-
-    if (is->video_st) {
-retry:
-        if (is->pictq_size == 0) {
-            //nothing to do, no picture to display in the que
-        } else {
-            double time= av_gettime()/1000000.0;
-            double next_target;
-            /* dequeue the picture */
-            vp = &is->pictq[is->pictq_rindex];
-
-            if(time < vp->target_clock)
-                return;
-            /* update current video pts */
-            is->video_current_pts = vp->pts;
-            is->video_current_pts_drift = is->video_current_pts - time;
-            is->video_current_pos = vp->pos;
-            if(is->pictq_size > 1){
-                VideoPicture *nextvp= &is->pictq[(is->pictq_rindex+1)%VIDEO_PICTURE_QUEUE_SIZE];
-                assert(nextvp->target_clock >= vp->target_clock);
-                next_target= nextvp->target_clock;
-            }else{
-                next_target= vp->target_clock + is->video_clock - vp->pts; //FIXME pass durations cleanly
-            }
-            if(framedrop && time > next_target){
-                is->skip_frames *= 1.0 + FRAME_SKIP_FACTOR;
-                if(is->pictq_size > 1 || time > next_target + 0.5){
-                    /* update queue size and signal for next picture */
-                    if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)
-                        is->pictq_rindex = 0;
-
-                    SDL_LockMutex(is->pictq_mutex);
-                    is->pictq_size--;
-                    SDL_CondSignal(is->pictq_cond);
-                    SDL_UnlockMutex(is->pictq_mutex);
-                    goto retry;
-                }
-            }
-
-            if(is->subtitle_st) {
-                if (is->subtitle_stream_changed) {
-                    SDL_LockMutex(is->subpq_mutex);
-
-                    while (is->subpq_size) {
-                        free_subpicture(&is->subpq[is->subpq_rindex]);
-
-                        /* update queue size and signal for next picture */
-                        if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE)
-                            is->subpq_rindex = 0;
-
-                        is->subpq_size--;
-                    }
-                    is->subtitle_stream_changed = 0;
-
-                    SDL_CondSignal(is->subpq_cond);
-                    SDL_UnlockMutex(is->subpq_mutex);
-                } else {
-                    if (is->subpq_size > 0) {
-                        sp = &is->subpq[is->subpq_rindex];
-
-                        if (is->subpq_size > 1)
-                            sp2 = &is->subpq[(is->subpq_rindex + 1) % SUBPICTURE_QUEUE_SIZE];
-                        else
-                            sp2 = NULL;
-
-                        if ((is->video_current_pts > (sp->pts + ((float) sp->sub.end_display_time / 1000)))
-                                || (sp2 && is->video_current_pts > (sp2->pts + ((float) sp2->sub.start_display_time / 1000))))
-                        {
-                            free_subpicture(sp);
-
-                            /* update queue size and signal for next picture */
-                            if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE)
-                                is->subpq_rindex = 0;
-
-                            SDL_LockMutex(is->subpq_mutex);
-                            is->subpq_size--;
-                            SDL_CondSignal(is->subpq_cond);
-                            SDL_UnlockMutex(is->subpq_mutex);
-                        }
-                    }
-                }
-            }
-
-            /* display picture */
-            video_display(is);
-
-            /* update queue size and signal for next picture */
-            if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)
-                is->pictq_rindex = 0;
-
-            SDL_LockMutex(is->pictq_mutex);
-            is->pictq_size--;
-            SDL_CondSignal(is->pictq_cond);
-            SDL_UnlockMutex(is->pictq_mutex);
-        }
-    } else if (is->audio_st) {
-        /* draw the next audio frame */
-
-        /* if only audio stream, then display the audio bars (better
-           than nothing, just to test the implementation */
-
-        /* display picture */
-        video_display(is);
-    }
-    if (show_status) {
-        static int64_t last_time;
-        int64_t cur_time;
-        int aqsize, vqsize, sqsize;
-        double av_diff;
-
-        cur_time = av_gettime();
-        if (!last_time || (cur_time - last_time) >= 30000) {
-            aqsize = 0;
-            vqsize = 0;
-            sqsize = 0;
-            if (is->audio_st)
-                aqsize = is->audioq.size;
-            if (is->video_st)
-                vqsize = is->videoq.size;
-            if (is->subtitle_st)
-                sqsize = is->subtitleq.size;
-            av_diff = 0;
-            if (is->audio_st && is->video_st)
-                av_diff = get_audio_clock(is) - get_video_clock(is);
-            printf("%7.2f A-V:%7.3f s:%3.1f aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64"   \r",
-                   get_master_clock(is), av_diff, FFMAX(is->skip_frames-1, 0), aqsize / 1024, vqsize / 1024, sqsize, is->faulty_dts, is->faulty_pts);
-            fflush(stdout);
-            last_time = cur_time;
-        }
-    }
-}
-
-/* allocate a picture (needs to do that in main thread to avoid
-   potential locking problems */
-static void alloc_picture(void *opaque)
-{
-    VideoState *is = opaque;
-    VideoPicture *vp;
-
-    vp = &is->pictq[is->pictq_windex];
-
-    if (vp->bmp)
-        SDL_FreeYUVOverlay(vp->bmp);
-
-#if CONFIG_AVFILTER
-    if (vp->picref)
-        avfilter_unref_pic(vp->picref);
-    vp->picref = NULL;
-
-    vp->width   = is->out_video_filter->inputs[0]->w;
-    vp->height  = is->out_video_filter->inputs[0]->h;
-    vp->pix_fmt = is->out_video_filter->inputs[0]->format;
-#else
-    vp->width   = is->video_st->codec->width;
-    vp->height  = is->video_st->codec->height;
-    vp->pix_fmt = is->video_st->codec->pix_fmt;
-#endif
-
-    vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height,
-                                   SDL_YV12_OVERLAY,
-                                   screen);
-
-    SDL_LockMutex(is->pictq_mutex);
-    vp->allocated = 1;
-    SDL_CondSignal(is->pictq_cond);
-    SDL_UnlockMutex(is->pictq_mutex);
-}
-
-/**
- *
- * @param pts the dts of the pkt / pts of the frame and guessed if not known
- */
-static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t pos)
-{
-    VideoPicture *vp;
-    int dst_pix_fmt;
-#if CONFIG_AVFILTER
-    AVPicture pict_src;
-#endif
-    /* wait until we have space to put a new picture */
-    SDL_LockMutex(is->pictq_mutex);
-
-    if(is->pictq_size>=VIDEO_PICTURE_QUEUE_SIZE && !is->refresh)
-        is->skip_frames= FFMAX(1.0 - FRAME_SKIP_FACTOR, is->skip_frames * (1.0-FRAME_SKIP_FACTOR));
-
-    while (is->pictq_size >= VIDEO_PICTURE_QUEUE_SIZE &&
-           !is->videoq.abort_request) {
-        SDL_CondWait(is->pictq_cond, is->pictq_mutex);
-    }
-    SDL_UnlockMutex(is->pictq_mutex);
-
-    if (is->videoq.abort_request)
-        return -1;
-
-    vp = &is->pictq[is->pictq_windex];
-
-    /* alloc or resize hardware picture buffer */
-    if (!vp->bmp ||
-#if CONFIG_AVFILTER
-        vp->width  != is->out_video_filter->inputs[0]->w ||
-        vp->height != is->out_video_filter->inputs[0]->h) {
-#else
-        vp->width != is->video_st->codec->width ||
-        vp->height != is->video_st->codec->height) {
-#endif
-        SDL_Event event;
-
-        vp->allocated = 0;
-
-        /* the allocation must be done in the main thread to avoid
-           locking problems */
-        event.type = FF_ALLOC_EVENT;
-        event.user.data1 = is;
-        SDL_PushEvent(&event);
-
-        /* wait until the picture is allocated */
-        SDL_LockMutex(is->pictq_mutex);
-        while (!vp->allocated && !is->videoq.abort_request) {
-            SDL_CondWait(is->pictq_cond, is->pictq_mutex);
-        }
-        SDL_UnlockMutex(is->pictq_mutex);
-
-        if (is->videoq.abort_request)
-            return -1;
-    }
-
-    /* if the frame is not skipped, then display it */
-    if (vp->bmp) {
-        AVPicture pict;
-#if CONFIG_AVFILTER
-        if(vp->picref)
-            avfilter_unref_pic(vp->picref);
-        vp->picref = src_frame->opaque;
-#endif
-
-        /* get a pointer on the bitmap */
-        SDL_LockYUVOverlay (vp->bmp);
-
-        dst_pix_fmt = PIX_FMT_YUV420P;
-        memset(&pict,0,sizeof(AVPicture));
-        pict.data[0] = vp->bmp->pixels[0];
-        pict.data[1] = vp->bmp->pixels[2];
-        pict.data[2] = vp->bmp->pixels[1];
-
-        pict.linesize[0] = vp->bmp->pitches[0];
-        pict.linesize[1] = vp->bmp->pitches[2];
-        pict.linesize[2] = vp->bmp->pitches[1];
-
-#if CONFIG_AVFILTER
-        pict_src.data[0] = src_frame->data[0];
-        pict_src.data[1] = src_frame->data[1];
-        pict_src.data[2] = src_frame->data[2];
-
-        pict_src.linesize[0] = src_frame->linesize[0];
-        pict_src.linesize[1] = src_frame->linesize[1];
-        pict_src.linesize[2] = src_frame->linesize[2];
-
-        //FIXME use direct rendering
-        av_picture_copy(&pict, &pict_src,
-                        vp->pix_fmt, vp->width, vp->height);
-#else
-        sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
-        is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
-            vp->width, vp->height, vp->pix_fmt, vp->width, vp->height,
-            dst_pix_fmt, sws_flags, NULL, NULL, NULL);
-        if (is->img_convert_ctx == NULL) {
-            fprintf(stderr, "Cannot initialize the conversion context\n");
-            exit(1);
-        }
-        sws_scale(is->img_convert_ctx, src_frame->data, src_frame->linesize,
-                  0, vp->height, pict.data, pict.linesize);
-#endif
-        /* update the bitmap content */
-        SDL_UnlockYUVOverlay(vp->bmp);
-
-        vp->pts = pts;
-        vp->pos = pos;
-
-        /* now we can update the picture count */
-        if (++is->pictq_windex == VIDEO_PICTURE_QUEUE_SIZE)
-            is->pictq_windex = 0;
-        SDL_LockMutex(is->pictq_mutex);
-        vp->target_clock= compute_target_time(vp->pts, is);
-
-        is->pictq_size++;
-        SDL_UnlockMutex(is->pictq_mutex);
-    }
-    return 0;
-}
-
-/**
- * compute the exact PTS for the picture if it is omitted in the stream
- * @param pts1 the dts of the pkt / pts of the frame
- */
-static int output_picture2(VideoState *is, AVFrame *src_frame, double pts1, int64_t pos)
-{
-    double frame_delay, pts;
-
-    pts = pts1;
-
-    if (pts != 0) {
-        /* update video clock with pts, if present */
-        is->video_clock = pts;
-    } else {
-        pts = is->video_clock;
-    }
-    /* update video clock for next frame */
-    frame_delay = av_q2d(is->video_st->codec->time_base);
-    /* for MPEG2, the frame can be repeated, so we update the
-       clock accordingly */
-    frame_delay += src_frame->repeat_pict * (frame_delay * 0.5);
-    is->video_clock += frame_delay;
-
-#if defined(DEBUG_SYNC) && 0
-    printf("frame_type=%c clock=%0.3f pts=%0.3f\n",
-           av_get_pict_type_char(src_frame->pict_type), pts, pts1);
-#endif
-    return queue_picture(is, src_frame, pts, pos);
-}
-
-static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt)
-{
-    int len1, got_picture, i;
-
-        if (packet_queue_get(&is->videoq, pkt, 1) < 0)
-            return -1;
-
-        if(pkt->data == flush_pkt.data){
-            avcodec_flush_buffers(is->video_st->codec);
-
-            SDL_LockMutex(is->pictq_mutex);
-            //Make sure there are no long delay timers (ideally we should just flush the que but thats harder)
-            for(i=0; i<VIDEO_PICTURE_QUEUE_SIZE; i++){
-                is->pictq[i].target_clock= 0;
-            }
-            while (is->pictq_size && !is->videoq.abort_request) {
-                SDL_CondWait(is->pictq_cond, is->pictq_mutex);
-            }
-            is->video_current_pos= -1;
-            SDL_UnlockMutex(is->pictq_mutex);
-
-            is->last_dts_for_fault_detection=
-            is->last_pts_for_fault_detection= INT64_MIN;
-            is->frame_last_pts= AV_NOPTS_VALUE;
-            is->frame_last_delay = 0;
-            is->frame_timer = (double)av_gettime() / 1000000.0;
-            is->skip_frames= 1;
-            is->skip_frames_index= 0;
-            return 0;
-        }
-
-        /* NOTE: ipts is the PTS of the _first_ picture beginning in
-           this packet, if any */
-        is->video_st->codec->reordered_opaque= pkt->pts;
-        len1 = avcodec_decode_video2(is->video_st->codec,
-                                    frame, &got_picture,
-                                    pkt);
-
-        if (got_picture) {
-            if(pkt->dts != AV_NOPTS_VALUE){
-                is->faulty_dts += pkt->dts <= is->last_dts_for_fault_detection;
-                is->last_dts_for_fault_detection= pkt->dts;
-            }
-            if(frame->reordered_opaque != AV_NOPTS_VALUE){
-                is->faulty_pts += frame->reordered_opaque <= is->last_pts_for_fault_detection;
-                is->last_pts_for_fault_detection= frame->reordered_opaque;
-            }
-        }
-
-        if(   (   decoder_reorder_pts==1
-               || (decoder_reorder_pts && is->faulty_pts<is->faulty_dts)
-               || pkt->dts == AV_NOPTS_VALUE)
-           && frame->reordered_opaque != AV_NOPTS_VALUE)
-            *pts= frame->reordered_opaque;
-        else if(pkt->dts != AV_NOPTS_VALUE)
-            *pts= pkt->dts;
-        else
-            *pts= 0;
-
-//            if (len1 < 0)
-//                break;
-    if (got_picture){
-        is->skip_frames_index += 1;
-        if(is->skip_frames_index >= is->skip_frames){
-            is->skip_frames_index -= FFMAX(is->skip_frames, 1.0);
-            return 1;
-        }
-
-    }
-    return 0;
-}
-
-#if CONFIG_AVFILTER
-typedef struct {
-    VideoState *is;
-    AVFrame *frame;
-    int use_dr1;
-} FilterPriv;
-
-static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
-{
-    AVFilterContext *ctx = codec->opaque;
-    AVFilterPicRef  *ref;
-    int perms = AV_PERM_WRITE;
-    int w, h, stride[4];
-    unsigned edge;
-
-    if(pic->buffer_hints & FF_BUFFER_HINTS_VALID) {
-        if(pic->buffer_hints & FF_BUFFER_HINTS_READABLE) perms |= AV_PERM_READ;
-        if(pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) perms |= AV_PERM_PRESERVE;
-        if(pic->buffer_hints & FF_BUFFER_HINTS_REUSABLE) perms |= AV_PERM_REUSE2;
-    }
-    if(pic->reference) perms |= AV_PERM_READ | AV_PERM_PRESERVE;
-
-    w = codec->width;
-    h = codec->height;
-    avcodec_align_dimensions2(codec, &w, &h, stride);
-    edge = codec->flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width();
-    w += edge << 1;
-    h += edge << 1;
-
-    if(!(ref = avfilter_get_video_buffer(ctx->outputs[0], perms, w, h)))
-        return -1;
-
-    ref->w = codec->width;
-    ref->h = codec->height;
-    for(int i = 0; i < 3; i ++) {
-        unsigned hshift = i == 0 ? 0 : av_pix_fmt_descriptors[ref->pic->format].log2_chroma_w;
-        unsigned vshift = i == 0 ? 0 : av_pix_fmt_descriptors[ref->pic->format].log2_chroma_h;
-
-        if (ref->data[i]) {
-            ref->data[i]    += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift);
-        }
-        pic->data[i]     = ref->data[i];
-        pic->linesize[i] = ref->linesize[i];
-    }
-    pic->opaque = ref;
-    pic->age    = INT_MAX;
-    pic->type   = FF_BUFFER_TYPE_USER;
-    return 0;
-}
-
-static void input_release_buffer(AVCodecContext *codec, AVFrame *pic)
-{
-    memset(pic->data, 0, sizeof(pic->data));
-    avfilter_unref_pic(pic->opaque);
-}
-
-static int input_init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    FilterPriv *priv = ctx->priv;
-    AVCodecContext *codec;
-    if(!opaque) return -1;
-
-    priv->is = opaque;
-    codec    = priv->is->video_st->codec;
-    codec->opaque = ctx;
-    if(codec->codec->capabilities & CODEC_CAP_DR1) {
-        priv->use_dr1 = 1;
-        codec->get_buffer     = input_get_buffer;
-        codec->release_buffer = input_release_buffer;
-    }
-
-    priv->frame = avcodec_alloc_frame();
-
-    return 0;
-}
-
-static void input_uninit(AVFilterContext *ctx)
-{
-    FilterPriv *priv = ctx->priv;
-    av_free(priv->frame);
-}
-
-static int input_request_frame(AVFilterLink *link)
-{
-    FilterPriv *priv = link->src->priv;
-    AVFilterPicRef *picref;
-    int64_t pts = 0;
-    AVPacket pkt;
-    int ret;
-
-    while (!(ret = get_video_frame(priv->is, priv->frame, &pts, &pkt)))
-        av_free_packet(&pkt);
-    if (ret < 0)
-        return -1;
-
-    if(priv->use_dr1) {
-        picref = avfilter_ref_pic(priv->frame->opaque, ~0);
-    } else {
-        picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
-        av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame,
-                        picref->pic->format, link->w, link->h);
-    }
-    av_free_packet(&pkt);
-
-    picref->pts = pts;
-    picref->pos = pkt.pos;
-    picref->pixel_aspect = priv->is->video_st->codec->sample_aspect_ratio;
-    avfilter_start_frame(link, picref);
-    avfilter_draw_slice(link, 0, link->h, 1);
-    avfilter_end_frame(link);
-
-    return 0;
-}
-
-static int input_query_formats(AVFilterContext *ctx)
-{
-    FilterPriv *priv = ctx->priv;
-    enum PixelFormat pix_fmts[] = {
-        priv->is->video_st->codec->pix_fmt, PIX_FMT_NONE
-    };
-
-    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
-    return 0;
-}
-
-static int input_config_props(AVFilterLink *link)
-{
-    FilterPriv *priv  = link->src->priv;
-    AVCodecContext *c = priv->is->video_st->codec;
-
-    link->w = c->width;
-    link->h = c->height;
-
-    return 0;
-}
-
-static AVFilter input_filter =
-{
-    .name      = "ffplay_input",
-
-    .priv_size = sizeof(FilterPriv),
-
-    .init      = input_init,
-    .uninit    = input_uninit,
-
-    .query_formats = input_query_formats,
-
-    .inputs    = (AVFilterPad[]) {{ .name = NULL }},
-    .outputs   = (AVFilterPad[]) {{ .name = "default",
-                                    .type = AVMEDIA_TYPE_VIDEO,
-                                    .request_frame = input_request_frame,
-                                    .config_props  = input_config_props, },
-                                  { .name = NULL }},
-};
-
-static void output_end_frame(AVFilterLink *link)
-{
-}
-
-static int output_query_formats(AVFilterContext *ctx)
-{
-    enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
-
-    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
-    return 0;
-}
-
-static int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
-                                    int64_t *pts, int64_t *pos)
-{
-    AVFilterPicRef *pic;
-
-    if(avfilter_request_frame(ctx->inputs[0]))
-        return -1;
-    if(!(pic = ctx->inputs[0]->cur_pic))
-        return -1;
-    ctx->inputs[0]->cur_pic = NULL;
-
-    frame->opaque = pic;
-    *pts          = pic->pts;
-    *pos          = pic->pos;
-
-    memcpy(frame->data,     pic->data,     sizeof(frame->data));
-    memcpy(frame->linesize, pic->linesize, sizeof(frame->linesize));
-
-    return 1;
-}
-
-static AVFilter output_filter =
-{
-    .name      = "ffplay_output",
-
-    .query_formats = output_query_formats,
-
-    .inputs    = (AVFilterPad[]) {{ .name          = "default",
-                                    .type          = AVMEDIA_TYPE_VIDEO,
-                                    .end_frame     = output_end_frame,
-                                    .min_perms     = AV_PERM_READ, },
-                                  { .name = NULL }},
-    .outputs   = (AVFilterPad[]) {{ .name = NULL }},
-};
-#endif  /* CONFIG_AVFILTER */
-
-static int video_thread(void *arg)
-{
-    VideoState *is = arg;
-    AVFrame *frame= avcodec_alloc_frame();
-    int64_t pts_int;
-    double pts;
-    int ret;
-
-#if CONFIG_AVFILTER
-    int64_t pos;
-    AVFilterContext *filt_src = NULL, *filt_out = NULL;
-    AVFilterGraph *graph = av_mallocz(sizeof(AVFilterGraph));
-    graph->scale_sws_opts = av_strdup("sws_flags=bilinear");
-
-    if(!(filt_src = avfilter_open(&input_filter,  "src")))   goto the_end;
-    if(!(filt_out = avfilter_open(&output_filter, "out")))   goto the_end;
-
-    if(avfilter_init_filter(filt_src, NULL, is))             goto the_end;
-    if(avfilter_init_filter(filt_out, NULL, frame))          goto the_end;
-
-
-    if(vfilters) {
-        AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
-        AVFilterInOut *inputs  = av_malloc(sizeof(AVFilterInOut));
-
-        outputs->name    = av_strdup("in");
-        outputs->filter  = filt_src;
-        outputs->pad_idx = 0;
-        outputs->next    = NULL;
-
-        inputs->name    = av_strdup("out");
-        inputs->filter  = filt_out;
-        inputs->pad_idx = 0;
-        inputs->next    = NULL;
-
-        if (avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL) < 0)
-            goto the_end;
-        av_freep(&vfilters);
-    } else {
-        if(avfilter_link(filt_src, 0, filt_out, 0) < 0)          goto the_end;
-    }
-    avfilter_graph_add_filter(graph, filt_src);
-    avfilter_graph_add_filter(graph, filt_out);
-
-    if(avfilter_graph_check_validity(graph, NULL))           goto the_end;
-    if(avfilter_graph_config_formats(graph, NULL))           goto the_end;
-    if(avfilter_graph_config_links(graph, NULL))             goto the_end;
-
-    is->out_video_filter = filt_out;
-#endif
-
-    for(;;) {
-#if !CONFIG_AVFILTER
-        AVPacket pkt;
-#endif
-        while (is->paused && !is->videoq.abort_request)
-            SDL_Delay(10);
-#if CONFIG_AVFILTER
-        ret = get_filtered_video_frame(filt_out, frame, &pts_int, &pos);
-#else
-        ret = get_video_frame(is, frame, &pts_int, &pkt);
-#endif
-
-        if (ret < 0) goto the_end;
-
-        if (!ret)
-            continue;
-
-        pts = pts_int*av_q2d(is->video_st->time_base);
-
-#if CONFIG_AVFILTER
-        ret = output_picture2(is, frame, pts, pos);
-#else
-        ret = output_picture2(is, frame, pts,  pkt.pos);
-        av_free_packet(&pkt);
-#endif
-        if (ret < 0)
-            goto the_end;
-
-        if (step)
-            if (cur_stream)
-                stream_pause(cur_stream);
-    }
- the_end:
-#if CONFIG_AVFILTER
-    avfilter_graph_destroy(graph);
-    av_freep(&graph);
-#endif
-    av_free(frame);
-    return 0;
-}
-
-static int subtitle_thread(void *arg)
-{
-    VideoState *is = arg;
-    SubPicture *sp;
-    AVPacket pkt1, *pkt = &pkt1;
-    int len1, got_subtitle;
-    double pts;
-    int i, j;
-    int r, g, b, y, u, v, a;
-
-    for(;;) {
-        while (is->paused && !is->subtitleq.abort_request) {
-            SDL_Delay(10);
-        }
-        if (packet_queue_get(&is->subtitleq, pkt, 1) < 0)
-            break;
-
-        if(pkt->data == flush_pkt.data){
-            avcodec_flush_buffers(is->subtitle_st->codec);
-            continue;
-        }
-        SDL_LockMutex(is->subpq_mutex);
-        while (is->subpq_size >= SUBPICTURE_QUEUE_SIZE &&
-               !is->subtitleq.abort_request) {
-            SDL_CondWait(is->subpq_cond, is->subpq_mutex);
-        }
-        SDL_UnlockMutex(is->subpq_mutex);
-
-        if (is->subtitleq.abort_request)
-            goto the_end;
-
-        sp = &is->subpq[is->subpq_windex];
-
-       /* NOTE: ipts is the PTS of the _first_ picture beginning in
-           this packet, if any */
-        pts = 0;
-        if (pkt->pts != AV_NOPTS_VALUE)
-            pts = av_q2d(is->subtitle_st->time_base)*pkt->pts;
-
-        len1 = avcodec_decode_subtitle2(is->subtitle_st->codec,
-                                    &sp->sub, &got_subtitle,
-                                    pkt);
-//            if (len1 < 0)
-//                break;
-        if (got_subtitle && sp->sub.format == 0) {
-            sp->pts = pts;
-
-            for (i = 0; i < sp->sub.num_rects; i++)
-            {
-                for (j = 0; j < sp->sub.rects[i]->nb_colors; j++)
-                {
-                    RGBA_IN(r, g, b, a, (uint32_t*)sp->sub.rects[i]->pict.data[1] + j);
-                    y = RGB_TO_Y_CCIR(r, g, b);
-                    u = RGB_TO_U_CCIR(r, g, b, 0);
-                    v = RGB_TO_V_CCIR(r, g, b, 0);
-                    YUVA_OUT((uint32_t*)sp->sub.rects[i]->pict.data[1] + j, y, u, v, a);
-                }
-            }
-
-            /* now we can update the picture count */
-            if (++is->subpq_windex == SUBPICTURE_QUEUE_SIZE)
-                is->subpq_windex = 0;
-            SDL_LockMutex(is->subpq_mutex);
-            is->subpq_size++;
-            SDL_UnlockMutex(is->subpq_mutex);
-        }
-        av_free_packet(pkt);
-//        if (step)
-//            if (cur_stream)
-//                stream_pause(cur_stream);
-    }
- the_end:
-    return 0;
-}
-
-/* copy samples for viewing in editor window */
-static void update_sample_display(VideoState *is, short *samples, int samples_size)
-{
-    int size, len, channels;
-
-    channels = is->audio_st->codec->channels;
-
-    size = samples_size / sizeof(short);
-    while (size > 0) {
-        len = SAMPLE_ARRAY_SIZE - is->sample_array_index;
-        if (len > size)
-            len = size;
-        memcpy(is->sample_array + is->sample_array_index, samples, len * sizeof(short));
-        samples += len;
-        is->sample_array_index += len;
-        if (is->sample_array_index >= SAMPLE_ARRAY_SIZE)
-            is->sample_array_index = 0;
-        size -= len;
-    }
-}
-
-/* return the new audio buffer size (samples can be added or deleted
-   to get better sync if video or external master clock) */
-static int synchronize_audio(VideoState *is, short *samples,
-                             int samples_size1, double pts)
-{
-    int n, samples_size;
-    double ref_clock;
-
-    n = 2 * is->audio_st->codec->channels;
-    samples_size = samples_size1;
-
-    /* if not master, then we try to remove or add samples to correct the clock */
-    if (((is->av_sync_type == AV_SYNC_VIDEO_MASTER && is->video_st) ||
-         is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) {
-        double diff, avg_diff;
-        int wanted_size, min_size, max_size, nb_samples;
-
-        ref_clock = get_master_clock(is);
-        diff = get_audio_clock(is) - ref_clock;
-
-        if (diff < AV_NOSYNC_THRESHOLD) {
-            is->audio_diff_cum = diff + is->audio_diff_avg_coef * is->audio_diff_cum;
-            if (is->audio_diff_avg_count < AUDIO_DIFF_AVG_NB) {
-                /* not enough measures to have a correct estimate */
-                is->audio_diff_avg_count++;
-            } else {
-                /* estimate the A-V difference */
-                avg_diff = is->audio_diff_cum * (1.0 - is->audio_diff_avg_coef);
-
-                if (fabs(avg_diff) >= is->audio_diff_threshold) {
-                    wanted_size = samples_size + ((int)(diff * is->audio_st->codec->sample_rate) * n);
-                    nb_samples = samples_size / n;
-
-                    min_size = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n;
-                    max_size = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n;
-                    if (wanted_size < min_size)
-                        wanted_size = min_size;
-                    else if (wanted_size > max_size)
-                        wanted_size = max_size;
-
-                    /* add or remove samples to correction the synchro */
-                    if (wanted_size < samples_size) {
-                        /* remove samples */
-                        samples_size = wanted_size;
-                    } else if (wanted_size > samples_size) {
-                        uint8_t *samples_end, *q;
-                        int nb;
-
-                        /* add samples */
-                        nb = (samples_size - wanted_size);
-                        samples_end = (uint8_t *)samples + samples_size - n;
-                        q = samples_end + n;
-                        while (nb > 0) {
-                            memcpy(q, samples_end, n);
-                            q += n;
-                            nb -= n;
-                        }
-                        samples_size = wanted_size;
-                    }
-                }
-#if 0
-                printf("diff=%f adiff=%f sample_diff=%d apts=%0.3f vpts=%0.3f %f\n",
-                       diff, avg_diff, samples_size - samples_size1,
-                       is->audio_clock, is->video_clock, is->audio_diff_threshold);
-#endif
-            }
-        } else {
-            /* too big difference : may be initial PTS errors, so
-               reset A-V filter */
-            is->audio_diff_avg_count = 0;
-            is->audio_diff_cum = 0;
-        }
-    }
-
-    return samples_size;
-}
-
-/* decode one audio frame and returns its uncompressed size */
-static int audio_decode_frame(VideoState *is, double *pts_ptr)
-{
-    AVPacket *pkt_temp = &is->audio_pkt_temp;
-    AVPacket *pkt = &is->audio_pkt;
-    AVCodecContext *dec= is->audio_st->codec;
-    int n, len1, data_size;
-    double pts;
-
-    for(;;) {
-        /* NOTE: the audio packet can contain several frames */
-        while (pkt_temp->size > 0) {
-            data_size = sizeof(is->audio_buf1);
-            len1 = avcodec_decode_audio3(dec,
-                                        (int16_t *)is->audio_buf1, &data_size,
-                                        pkt_temp);
-            if (len1 < 0) {
-                /* if error, we skip the frame */
-                pkt_temp->size = 0;
-                break;
-            }
-
-            pkt_temp->data += len1;
-            pkt_temp->size -= len1;
-            if (data_size <= 0)
-                continue;
-
-            if (dec->sample_fmt != is->audio_src_fmt) {
-                if (is->reformat_ctx)
-                    av_audio_convert_free(is->reformat_ctx);
-                is->reformat_ctx= av_audio_convert_alloc(SAMPLE_FMT_S16, 1,
-                                                         dec->sample_fmt, 1, NULL, 0);
-                if (!is->reformat_ctx) {
-                    fprintf(stderr, "Cannot convert %s sample format to %s sample format\n",
-                        avcodec_get_sample_fmt_name(dec->sample_fmt),
-                        avcodec_get_sample_fmt_name(SAMPLE_FMT_S16));
-                        break;
-                }
-                is->audio_src_fmt= dec->sample_fmt;
-            }
-
-            if (is->reformat_ctx) {
-                const void *ibuf[6]= {is->audio_buf1};
-                void *obuf[6]= {is->audio_buf2};
-                int istride[6]= {av_get_bits_per_sample_format(dec->sample_fmt)/8};
-                int ostride[6]= {2};
-                int len= data_size/istride[0];
-                if (av_audio_convert(is->reformat_ctx, obuf, ostride, ibuf, istride, len)<0) {
-                    printf("av_audio_convert() failed\n");
-                    break;
-                }
-                is->audio_buf= is->audio_buf2;
-                /* FIXME: existing code assume that data_size equals framesize*channels*2
-                          remove this legacy cruft */
-                data_size= len*2;
-            }else{
-                is->audio_buf= is->audio_buf1;
-            }
-
-            /* if no pts, then compute it */
-            pts = is->audio_clock;
-            *pts_ptr = pts;
-            n = 2 * dec->channels;
-            is->audio_clock += (double)data_size /
-                (double)(n * dec->sample_rate);
-#if defined(DEBUG_SYNC)
-            {
-                static double last_clock;
-                printf("audio: delay=%0.3f clock=%0.3f pts=%0.3f\n",
-                       is->audio_clock - last_clock,
-                       is->audio_clock, pts);
-                last_clock = is->audio_clock;
-            }
-#endif
-            return data_size;
-        }
-
-        /* free the current packet */
-        if (pkt->data)
-            av_free_packet(pkt);
-
-        if (is->paused || is->audioq.abort_request) {
-            return -1;
-        }
-
-        /* read next packet */
-        if (packet_queue_get(&is->audioq, pkt, 1) < 0)
-            return -1;
-        if(pkt->data == flush_pkt.data){
-            avcodec_flush_buffers(dec);
-            continue;
-        }
-
-        pkt_temp->data = pkt->data;
-        pkt_temp->size = pkt->size;
-
-        /* if update the audio clock with the pts */
-        if (pkt->pts != AV_NOPTS_VALUE) {
-            is->audio_clock = av_q2d(is->audio_st->time_base)*pkt->pts;
-        }
-    }
-}
-
-/* get the current audio output buffer size, in samples. With SDL, we
-   cannot have a precise information */
-static int audio_write_get_buf_size(VideoState *is)
-{
-    return is->audio_buf_size - is->audio_buf_index;
-}
-
-
-/* prepare a new audio buffer */
-static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
-{
-    VideoState *is = opaque;
-    int audio_size, len1;
-    double pts;
-
-    audio_callback_time = av_gettime();
-
-    while (len > 0) {
-        if (is->audio_buf_index >= is->audio_buf_size) {
-           audio_size = audio_decode_frame(is, &pts);
-           if (audio_size < 0) {
-                /* if error, just output silence */
-               is->audio_buf = is->audio_buf1;
-               is->audio_buf_size = 1024;
-               memset(is->audio_buf, 0, is->audio_buf_size);
-           } else {
-               if (is->show_audio)
-                   update_sample_display(is, (int16_t *)is->audio_buf, audio_size);
-               audio_size = synchronize_audio(is, (int16_t *)is->audio_buf, audio_size,
-                                              pts);
-               is->audio_buf_size = audio_size;
-           }
-           is->audio_buf_index = 0;
-        }
-        len1 = is->audio_buf_size - is->audio_buf_index;
-        if (len1 > len)
-            len1 = len;
-        memcpy(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1);
-        len -= len1;
-        stream += len1;
-        is->audio_buf_index += len1;
-    }
-}
-
-/* open a given stream. Return 0 if OK */
-static int stream_component_open(VideoState *is, int stream_index)
-{
-    AVFormatContext *ic = is->ic;
-    AVCodecContext *avctx;
-    AVCodec *codec;
-    SDL_AudioSpec wanted_spec, spec;
-
-    if (stream_index < 0 || stream_index >= ic->nb_streams)
-        return -1;
-    avctx = ic->streams[stream_index]->codec;
-
-    /* prepare audio output */
-    if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
-        if (avctx->channels > 0) {
-            avctx->request_channels = FFMIN(2, avctx->channels);
-        } else {
-            avctx->request_channels = 2;
-        }
-    }
-
-    codec = avcodec_find_decoder(avctx->codec_id);
-    avctx->debug_mv = debug_mv;
-    avctx->debug = debug;
-    avctx->workaround_bugs = workaround_bugs;
-    avctx->lowres = lowres;
-    if(lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
-    avctx->idct_algo= idct;
-    if(fast) avctx->flags2 |= CODEC_FLAG2_FAST;
-    avctx->skip_frame= skip_frame;
-    avctx->skip_idct= skip_idct;
-    avctx->skip_loop_filter= skip_loop_filter;
-    avctx->error_recognition= error_recognition;
-    avctx->error_concealment= error_concealment;
-    avcodec_thread_init(avctx, thread_count);
-
-    set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0);
-
-    if (!codec ||
-        avcodec_open(avctx, codec) < 0)
-        return -1;
-
-    /* prepare audio output */
-    if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
-        wanted_spec.freq = avctx->sample_rate;
-        wanted_spec.format = AUDIO_S16SYS;
-        wanted_spec.channels = avctx->channels;
-        wanted_spec.silence = 0;
-        wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
-        wanted_spec.callback = sdl_audio_callback;
-        wanted_spec.userdata = is;
-        if (SDL_OpenAudio(&wanted_spec, &spec) < 0) {
-            fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
-            return -1;
-        }
-        is->audio_hw_buf_size = spec.size;
-        is->audio_src_fmt= SAMPLE_FMT_S16;
-    }
-
-    ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;
-    switch(avctx->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        is->audio_stream = stream_index;
-        is->audio_st = ic->streams[stream_index];
-        is->audio_buf_size = 0;
-        is->audio_buf_index = 0;
-
-        /* init averaging filter */
-        is->audio_diff_avg_coef = exp(log(0.01) / AUDIO_DIFF_AVG_NB);
-        is->audio_diff_avg_count = 0;
-        /* since we do not have a precise anough audio fifo fullness,
-           we correct audio sync only if larger than this threshold */
-        is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / avctx->sample_rate;
-
-        memset(&is->audio_pkt, 0, sizeof(is->audio_pkt));
-        packet_queue_init(&is->audioq);
-        SDL_PauseAudio(0);
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        is->video_stream = stream_index;
-        is->video_st = ic->streams[stream_index];
-
-//        is->video_current_pts_time = av_gettime();
-
-        packet_queue_init(&is->videoq);
-        is->video_tid = SDL_CreateThread(video_thread, is);
-        break;
-    case AVMEDIA_TYPE_SUBTITLE:
-        is->subtitle_stream = stream_index;
-        is->subtitle_st = ic->streams[stream_index];
-        packet_queue_init(&is->subtitleq);
-
-        is->subtitle_tid = SDL_CreateThread(subtitle_thread, is);
-        break;
-    default:
-        break;
-    }
-    return 0;
-}
-
-static void stream_component_close(VideoState *is, int stream_index)
-{
-    AVFormatContext *ic = is->ic;
-    AVCodecContext *avctx;
-
-    if (stream_index < 0 || stream_index >= ic->nb_streams)
-        return;
-    avctx = ic->streams[stream_index]->codec;
-
-    switch(avctx->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        packet_queue_abort(&is->audioq);
-
-        SDL_CloseAudio();
-
-        packet_queue_end(&is->audioq);
-        if (is->reformat_ctx)
-            av_audio_convert_free(is->reformat_ctx);
-        is->reformat_ctx = NULL;
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        packet_queue_abort(&is->videoq);
-
-        /* note: we also signal this mutex to make sure we deblock the
-           video thread in all cases */
-        SDL_LockMutex(is->pictq_mutex);
-        SDL_CondSignal(is->pictq_cond);
-        SDL_UnlockMutex(is->pictq_mutex);
-
-        SDL_WaitThread(is->video_tid, NULL);
-
-        packet_queue_end(&is->videoq);
-        break;
-    case AVMEDIA_TYPE_SUBTITLE:
-        packet_queue_abort(&is->subtitleq);
-
-        /* note: we also signal this mutex to make sure we deblock the
-           video thread in all cases */
-        SDL_LockMutex(is->subpq_mutex);
-        is->subtitle_stream_changed = 1;
-
-        SDL_CondSignal(is->subpq_cond);
-        SDL_UnlockMutex(is->subpq_mutex);
-
-        SDL_WaitThread(is->subtitle_tid, NULL);
-
-        packet_queue_end(&is->subtitleq);
-        break;
-    default:
-        break;
-    }
-
-    ic->streams[stream_index]->discard = AVDISCARD_ALL;
-    avcodec_close(avctx);
-    switch(avctx->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        is->audio_st = NULL;
-        is->audio_stream = -1;
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        is->video_st = NULL;
-        is->video_stream = -1;
-        break;
-    case AVMEDIA_TYPE_SUBTITLE:
-        is->subtitle_st = NULL;
-        is->subtitle_stream = -1;
-        break;
-    default:
-        break;
-    }
-}
-
-/* since we have only one decoding thread, we can use a global
-   variable instead of a thread local variable */
-static VideoState *global_video_state;
-
-static int decode_interrupt_cb(void)
-{
-    return (global_video_state && global_video_state->abort_request);
-}
-
-/* this thread gets the stream from the disk or the network */
-static int decode_thread(void *arg)
-{
-    VideoState *is = arg;
-    AVFormatContext *ic;
-    int err, i, ret;
-    int st_index[AVMEDIA_TYPE_NB];
-    int st_count[AVMEDIA_TYPE_NB]={0};
-    int st_best_packet_count[AVMEDIA_TYPE_NB];
-    AVPacket pkt1, *pkt = &pkt1;
-    AVFormatParameters params, *ap = &params;
-    int eof=0;
-    int pkt_in_play_range = 0;
-
-    ic = avformat_alloc_context();
-
-    memset(st_index, -1, sizeof(st_index));
-    memset(st_best_packet_count, -1, sizeof(st_best_packet_count));
-    is->video_stream = -1;
-    is->audio_stream = -1;
-    is->subtitle_stream = -1;
-
-    global_video_state = is;
-    url_set_interrupt_cb(decode_interrupt_cb);
-
-    memset(ap, 0, sizeof(*ap));
-
-    ap->prealloced_context = 1;
-    ap->width = frame_width;
-    ap->height= frame_height;
-    ap->time_base= (AVRational){1, 25};
-    ap->pix_fmt = frame_pix_fmt;
-
-    set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);
-
-    err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);
-    if (err < 0) {
-        print_error(is->filename, err);
-        ret = -1;
-        goto fail;
-    }
-    is->ic = ic;
-
-    if(genpts)
-        ic->flags |= AVFMT_FLAG_GENPTS;
-
-    err = av_find_stream_info(ic);
-    if (err < 0) {
-        fprintf(stderr, "%s: could not find codec parameters\n", is->filename);
-        ret = -1;
-        goto fail;
-    }
-    if(ic->pb)
-        ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
-
-    if(seek_by_bytes<0)
-        seek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT);
-
-    /* if seeking requested, we execute it */
-    if (start_time != AV_NOPTS_VALUE) {
-        int64_t timestamp;
-
-        timestamp = start_time;
-        /* add the stream start time */
-        if (ic->start_time != AV_NOPTS_VALUE)
-            timestamp += ic->start_time;
-        ret = avformat_seek_file(ic, -1, INT64_MIN, timestamp, INT64_MAX, 0);
-        if (ret < 0) {
-            fprintf(stderr, "%s: could not seek to position %0.3f\n",
-                    is->filename, (double)timestamp / AV_TIME_BASE);
-        }
-    }
-
-    for(i = 0; i < ic->nb_streams; i++) {
-        AVStream *st= ic->streams[i];
-        AVCodecContext *avctx = st->codec;
-        ic->streams[i]->discard = AVDISCARD_ALL;
-        if(avctx->codec_type >= (unsigned)AVMEDIA_TYPE_NB)
-            continue;
-        if(st_count[avctx->codec_type]++ != wanted_stream[avctx->codec_type] && wanted_stream[avctx->codec_type] >= 0)
-            continue;
-
-        if(st_best_packet_count[avctx->codec_type] >= st->codec_info_nb_frames)
-            continue;
-        st_best_packet_count[avctx->codec_type]= st->codec_info_nb_frames;
-
-        switch(avctx->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            if (!audio_disable)
-                st_index[AVMEDIA_TYPE_AUDIO] = i;
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-        case AVMEDIA_TYPE_SUBTITLE:
-            if (!video_disable)
-                st_index[avctx->codec_type] = i;
-            break;
-        default:
-            break;
-        }
-    }
-    if (show_status) {
-        dump_format(ic, 0, is->filename, 0);
-    }
-
-    /* open the streams */
-    if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) {
-        stream_component_open(is, st_index[AVMEDIA_TYPE_AUDIO]);
-    }
-
-    ret=-1;
-    if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) {
-        ret= stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]);
-    }
-    is->refresh_tid = SDL_CreateThread(refresh_thread, is);
-    if(ret<0) {
-        if (!display_disable)
-            is->show_audio = 2;
-    }
-
-    if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) {
-        stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]);
-    }
-
-    if (is->video_stream < 0 && is->audio_stream < 0) {
-        fprintf(stderr, "%s: could not open codecs\n", is->filename);
-        ret = -1;
-        goto fail;
-    }
-
-    for(;;) {
-        if (is->abort_request)
-            break;
-        if (is->paused != is->last_paused) {
-            is->last_paused = is->paused;
-            if (is->paused)
-                is->read_pause_return= av_read_pause(ic);
-            else
-                av_read_play(ic);
-        }
-#if CONFIG_RTSP_DEMUXER
-        if (is->paused && !strcmp(ic->iformat->name, "rtsp")) {
-            /* wait 10 ms to avoid trying to get another packet */
-            /* XXX: horrible */
-            SDL_Delay(10);
-            continue;
-        }
-#endif
-        if (is->seek_req) {
-            int64_t seek_target= is->seek_pos;
-            int64_t seek_min= is->seek_rel > 0 ? seek_target - is->seek_rel + 2: INT64_MIN;
-            int64_t seek_max= is->seek_rel < 0 ? seek_target - is->seek_rel - 2: INT64_MAX;
-//FIXME the +-2 is due to rounding being not done in the correct direction in generation
-//      of the seek_pos/seek_rel variables
-
-            ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags);
-            if (ret < 0) {
-                fprintf(stderr, "%s: error while seeking\n", is->ic->filename);
-            }else{
-                if (is->audio_stream >= 0) {
-                    packet_queue_flush(&is->audioq);
-                    packet_queue_put(&is->audioq, &flush_pkt);
-                }
-                if (is->subtitle_stream >= 0) {
-                    packet_queue_flush(&is->subtitleq);
-                    packet_queue_put(&is->subtitleq, &flush_pkt);
-                }
-                if (is->video_stream >= 0) {
-                    packet_queue_flush(&is->videoq);
-                    packet_queue_put(&is->videoq, &flush_pkt);
-                }
-            }
-            is->seek_req = 0;
-            eof= 0;
-        }
-
-        /* if the queue are full, no need to read more */
-        if (   is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE
-            || (   (is->audioq   .size  > MIN_AUDIOQ_SIZE || is->audio_stream<0)
-                && (is->videoq   .nb_packets > MIN_FRAMES || is->video_stream<0)
-                && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream<0))) {
-            /* wait 10 ms */
-            SDL_Delay(10);
-            continue;
-        }
-        if(url_feof(ic->pb) || eof) {
-            if(is->video_stream >= 0){
-                av_init_packet(pkt);
-                pkt->data=NULL;
-                pkt->size=0;
-                pkt->stream_index= is->video_stream;
-                packet_queue_put(&is->videoq, pkt);
-            }
-            SDL_Delay(10);
-            if(is->audioq.size + is->videoq.size + is->subtitleq.size ==0){
-                if(loop!=1 && (!loop || --loop)){
-                    stream_seek(cur_stream, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0);
-                }else if(autoexit){
-                    ret=AVERROR_EOF;
-                    goto fail;
-                }
-            }
-            continue;
-        }
-        ret = av_read_frame(ic, pkt);
-        if (ret < 0) {
-            if (ret == AVERROR_EOF)
-                eof=1;
-            if (url_ferror(ic->pb))
-                break;
-            SDL_Delay(100); /* wait for user event */
-            continue;
-        }
-        /* check if packet is in play range specified by user, then queue, otherwise discard */
-        pkt_in_play_range = duration == AV_NOPTS_VALUE ||
-                (pkt->pts - ic->streams[pkt->stream_index]->start_time) *
-                av_q2d(ic->streams[pkt->stream_index]->time_base) -
-                (double)(start_time != AV_NOPTS_VALUE ? start_time : 0)/1000000
-                <= ((double)duration/1000000);
-        if (pkt->stream_index == is->audio_stream && pkt_in_play_range) {
-            packet_queue_put(&is->audioq, pkt);
-        } else if (pkt->stream_index == is->video_stream && pkt_in_play_range) {
-            packet_queue_put(&is->videoq, pkt);
-        } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) {
-            packet_queue_put(&is->subtitleq, pkt);
-        } else {
-            av_free_packet(pkt);
-        }
-    }
-    /* wait until the end */
-    while (!is->abort_request) {
-        SDL_Delay(100);
-    }
-
-    ret = 0;
- fail:
-    /* disable interrupting */
-    global_video_state = NULL;
-
-    /* close each stream */
-    if (is->audio_stream >= 0)
-        stream_component_close(is, is->audio_stream);
-    if (is->video_stream >= 0)
-        stream_component_close(is, is->video_stream);
-    if (is->subtitle_stream >= 0)
-        stream_component_close(is, is->subtitle_stream);
-    if (is->ic) {
-        av_close_input_file(is->ic);
-        is->ic = NULL; /* safety */
-    }
-    url_set_interrupt_cb(NULL);
-
-    if (ret != 0) {
-        SDL_Event event;
-
-        event.type = FF_QUIT_EVENT;
-        event.user.data1 = is;
-        SDL_PushEvent(&event);
-    }
-    return 0;
-}
-
-static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
-{
-    VideoState *is;
-
-    is = av_mallocz(sizeof(VideoState));
-    if (!is)
-        return NULL;
-    av_strlcpy(is->filename, filename, sizeof(is->filename));
-    is->iformat = iformat;
-    is->ytop = 0;
-    is->xleft = 0;
-
-    /* start video display */
-    is->pictq_mutex = SDL_CreateMutex();
-    is->pictq_cond = SDL_CreateCond();
-
-    is->subpq_mutex = SDL_CreateMutex();
-    is->subpq_cond = SDL_CreateCond();
-
-    is->av_sync_type = av_sync_type;
-    is->parse_tid = SDL_CreateThread(decode_thread, is);
-    if (!is->parse_tid) {
-        av_free(is);
-        return NULL;
-    }
-    return is;
-}
-
-static void stream_close(VideoState *is)
-{
-    VideoPicture *vp;
-    int i;
-    /* XXX: use a special url_shutdown call to abort parse cleanly */
-    is->abort_request = 1;
-    SDL_WaitThread(is->parse_tid, NULL);
-    SDL_WaitThread(is->refresh_tid, NULL);
-
-    /* free all pictures */
-    for(i=0;i<VIDEO_PICTURE_QUEUE_SIZE; i++) {
-        vp = &is->pictq[i];
-#if CONFIG_AVFILTER
-        if (vp->picref) {
-            avfilter_unref_pic(vp->picref);
-            vp->picref = NULL;
-        }
-#endif
-        if (vp->bmp) {
-            SDL_FreeYUVOverlay(vp->bmp);
-            vp->bmp = NULL;
-        }
-    }
-    SDL_DestroyMutex(is->pictq_mutex);
-    SDL_DestroyCond(is->pictq_cond);
-    SDL_DestroyMutex(is->subpq_mutex);
-    SDL_DestroyCond(is->subpq_cond);
-#if !CONFIG_AVFILTER
-    if (is->img_convert_ctx)
-        sws_freeContext(is->img_convert_ctx);
-#endif
-    av_free(is);
-}
-
-static void stream_cycle_channel(VideoState *is, int codec_type)
-{
-    AVFormatContext *ic = is->ic;
-    int start_index, stream_index;
-    AVStream *st;
-
-    if (codec_type == AVMEDIA_TYPE_VIDEO)
-        start_index = is->video_stream;
-    else if (codec_type == AVMEDIA_TYPE_AUDIO)
-        start_index = is->audio_stream;
-    else
-        start_index = is->subtitle_stream;
-    if (start_index < (codec_type == AVMEDIA_TYPE_SUBTITLE ? -1 : 0))
-        return;
-    stream_index = start_index;
-    for(;;) {
-        if (++stream_index >= is->ic->nb_streams)
-        {
-            if (codec_type == AVMEDIA_TYPE_SUBTITLE)
-            {
-                stream_index = -1;
-                goto the_end;
-            } else
-                stream_index = 0;
-        }
-        if (stream_index == start_index)
-            return;
-        st = ic->streams[stream_index];
-        if (st->codec->codec_type == codec_type) {
-            /* check that parameters are OK */
-            switch(codec_type) {
-            case AVMEDIA_TYPE_AUDIO:
-                if (st->codec->sample_rate != 0 &&
-                    st->codec->channels != 0)
-                    goto the_end;
-                break;
-            case AVMEDIA_TYPE_VIDEO:
-            case AVMEDIA_TYPE_SUBTITLE:
-                goto the_end;
-            default:
-                break;
-            }
-        }
-    }
- the_end:
-    stream_component_close(is, start_index);
-    stream_component_open(is, stream_index);
-}
-
-
-static void toggle_full_screen(void)
-{
-    is_full_screen = !is_full_screen;
-    if (!fs_screen_width) {
-        /* use default SDL method */
-//        SDL_WM_ToggleFullScreen(screen);
-    }
-    video_open(cur_stream);
-}
-
-static void toggle_pause(void)
-{
-    if (cur_stream)
-        stream_pause(cur_stream);
-    step = 0;
-}
-
-static void step_to_next_frame(void)
-{
-    if (cur_stream) {
-        /* if the stream is paused unpause it, then step */
-        if (cur_stream->paused)
-            stream_pause(cur_stream);
-    }
-    step = 1;
-}
-
-static void do_exit(void)
-{
-    int i;
-    if (cur_stream) {
-        stream_close(cur_stream);
-        cur_stream = NULL;
-    }
-    for (i = 0; i < AVMEDIA_TYPE_NB; i++)
-        av_free(avcodec_opts[i]);
-    av_free(avformat_opts);
-    av_free(sws_opts);
-#if CONFIG_AVFILTER
-    avfilter_uninit();
-#endif
-    if (show_status)
-        printf("\n");
-    SDL_Quit();
-    exit(0);
-}
-
-static void toggle_audio_display(void)
-{
-    if (cur_stream) {
-        int bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00);
-        cur_stream->show_audio = (cur_stream->show_audio + 1) % 3;
-        fill_rectangle(screen,
-                    cur_stream->xleft, cur_stream->ytop, cur_stream->width, cur_stream->height,
-                    bgcolor);
-        SDL_UpdateRect(screen, cur_stream->xleft, cur_stream->ytop, cur_stream->width, cur_stream->height);
-    }
-}
-
-/* handle an event sent by the GUI */
-static void event_loop(void)
-{
-    SDL_Event event;
-    double incr, pos, frac;
-
-    for(;;) {
-        double x;
-        SDL_WaitEvent(&event);
-        switch(event.type) {
-        case SDL_KEYDOWN:
-            switch(event.key.keysym.sym) {
-            case SDLK_ESCAPE:
-            case SDLK_q:
-                do_exit();
-                break;
-            case SDLK_f:
-                toggle_full_screen();
-                break;
-            case SDLK_p:
-            case SDLK_SPACE:
-                toggle_pause();
-                break;
-            case SDLK_s: //S: Step to next frame
-                step_to_next_frame();
-                break;
-            case SDLK_a:
-                if (cur_stream)
-                    stream_cycle_channel(cur_stream, AVMEDIA_TYPE_AUDIO);
-                break;
-            case SDLK_v:
-                if (cur_stream)
-                    stream_cycle_channel(cur_stream, AVMEDIA_TYPE_VIDEO);
-                break;
-            case SDLK_t:
-                if (cur_stream)
-                    stream_cycle_channel(cur_stream, AVMEDIA_TYPE_SUBTITLE);
-                break;
-            case SDLK_w:
-                toggle_audio_display();
-                break;
-            case SDLK_LEFT:
-                incr = -10.0;
-                goto do_seek;
-            case SDLK_RIGHT:
-                incr = 10.0;
-                goto do_seek;
-            case SDLK_UP:
-                incr = 60.0;
-                goto do_seek;
-            case SDLK_DOWN:
-                incr = -60.0;
-            do_seek:
-                if (cur_stream) {
-                    if (seek_by_bytes) {
-                        if (cur_stream->video_stream >= 0 && cur_stream->video_current_pos>=0){
-                            pos= cur_stream->video_current_pos;
-                        }else if(cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos>=0){
-                            pos= cur_stream->audio_pkt.pos;
-                        }else
-                            pos = url_ftell(cur_stream->ic->pb);
-                        if (cur_stream->ic->bit_rate)
-                            incr *= cur_stream->ic->bit_rate / 8.0;
-                        else
-                            incr *= 180000.0;
-                        pos += incr;
-                        stream_seek(cur_stream, pos, incr, 1);
-                    } else {
-                        pos = get_master_clock(cur_stream);
-                        pos += incr;
-                        stream_seek(cur_stream, (int64_t)(pos * AV_TIME_BASE), (int64_t)(incr * AV_TIME_BASE), 0);
-                    }
-                }
-                break;
-            default:
-                break;
-            }
-            break;
-        case SDL_MOUSEBUTTONDOWN:
-        case SDL_MOUSEMOTION:
-            if(event.type ==SDL_MOUSEBUTTONDOWN){
-                x= event.button.x;
-            }else{
-                if(event.motion.state != SDL_PRESSED)
-                    break;
-                x= event.motion.x;
-            }
-            if (cur_stream) {
-                if(seek_by_bytes || cur_stream->ic->duration<=0){
-                    uint64_t size=  url_fsize(cur_stream->ic->pb);
-                    stream_seek(cur_stream, size*x/cur_stream->width, 0, 1);
-                }else{
-                    int64_t ts;
-                    int ns, hh, mm, ss;
-                    int tns, thh, tmm, tss;
-                    tns = cur_stream->ic->duration/1000000LL;
-                    thh = tns/3600;
-                    tmm = (tns%3600)/60;
-                    tss = (tns%60);
-                    frac = x/cur_stream->width;
-                    ns = frac*tns;
-                    hh = ns/3600;
-                    mm = (ns%3600)/60;
-                    ss = (ns%60);
-                    fprintf(stderr, "Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d)       \n", frac*100,
-                            hh, mm, ss, thh, tmm, tss);
-                    ts = frac*cur_stream->ic->duration;
-                    if (cur_stream->ic->start_time != AV_NOPTS_VALUE)
-                        ts += cur_stream->ic->start_time;
-                    stream_seek(cur_stream, ts, 0, 0);
-                }
-            }
-            break;
-        case SDL_VIDEORESIZE:
-            if (cur_stream) {
-                screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
-                                          SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
-                screen_width = cur_stream->width = event.resize.w;
-                screen_height= cur_stream->height= event.resize.h;
-            }
-            break;
-        case SDL_QUIT:
-        case FF_QUIT_EVENT:
-            do_exit();
-            break;
-        case FF_ALLOC_EVENT:
-            video_open(event.user.data1);
-            alloc_picture(event.user.data1);
-            break;
-        case FF_REFRESH_EVENT:
-            video_refresh_timer(event.user.data1);
-            cur_stream->refresh=0;
-            break;
-        default:
-            break;
-        }
-    }
-}
-
-static void opt_frame_size(const char *arg)
-{
-    if (av_parse_video_frame_size(&frame_width, &frame_height, arg) < 0) {
-        fprintf(stderr, "Incorrect frame size\n");
-        exit(1);
-    }
-    if ((frame_width % 2) != 0 || (frame_height % 2) != 0) {
-        fprintf(stderr, "Frame size must be a multiple of 2\n");
-        exit(1);
-    }
-}
-
-static int opt_width(const char *opt, const char *arg)
-{
-    screen_width = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
-    return 0;
-}
-
-static int opt_height(const char *opt, const char *arg)
-{
-    screen_height = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX);
-    return 0;
-}
-
-static void opt_format(const char *arg)
-{
-    file_iformat = av_find_input_format(arg);
-    if (!file_iformat) {
-        fprintf(stderr, "Unknown input format: %s\n", arg);
-        exit(1);
-    }
-}
-
-static void opt_frame_pix_fmt(const char *arg)
-{
-    frame_pix_fmt = av_get_pix_fmt(arg);
-}
-
-static int opt_sync(const char *opt, const char *arg)
-{
-    if (!strcmp(arg, "audio"))
-        av_sync_type = AV_SYNC_AUDIO_MASTER;
-    else if (!strcmp(arg, "video"))
-        av_sync_type = AV_SYNC_VIDEO_MASTER;
-    else if (!strcmp(arg, "ext"))
-        av_sync_type = AV_SYNC_EXTERNAL_CLOCK;
-    else {
-        fprintf(stderr, "Unknown value for %s: %s\n", opt, arg);
-        exit(1);
-    }
-    return 0;
-}
-
-static int opt_seek(const char *opt, const char *arg)
-{
-    start_time = parse_time_or_die(opt, arg, 1);
-    return 0;
-}
-
-static int opt_duration(const char *opt, const char *arg)
-{
-    duration = parse_time_or_die(opt, arg, 1);
-    return 0;
-}
-
-static int opt_debug(const char *opt, const char *arg)
-{
-    av_log_set_level(99);
-    debug = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-    return 0;
-}
-
-static int opt_vismv(const char *opt, const char *arg)
-{
-    debug_mv = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
-    return 0;
-}
-
-static int opt_thread_count(const char *opt, const char *arg)
-{
-    thread_count= parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
-#if !HAVE_THREADS
-    fprintf(stderr, "Warning: not compiled with thread support, using thread emulation\n");
-#endif
-    return 0;
-}
-
-static const OptionDef options[] = {
-#include "cmdutils_common_opts.h"
-    { "x", HAS_ARG | OPT_FUNC2, {(void*)opt_width}, "force displayed width", "width" },
-    { "y", HAS_ARG | OPT_FUNC2, {(void*)opt_height}, "force displayed height", "height" },
-    { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
-    { "fs", OPT_BOOL, {(void*)&is_full_screen}, "force full screen" },
-    { "an", OPT_BOOL, {(void*)&audio_disable}, "disable audio" },
-    { "vn", OPT_BOOL, {(void*)&video_disable}, "disable video" },
-    { "ast", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_AUDIO]}, "select desired audio stream", "stream_number" },
-    { "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_VIDEO]}, "select desired video stream", "stream_number" },
-    { "sst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_SUBTITLE]}, "select desired subtitle stream", "stream_number" },
-    { "ss", HAS_ARG | OPT_FUNC2, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
-    { "t", HAS_ARG | OPT_FUNC2, {(void*)&opt_duration}, "play  \"duration\" seconds of audio/video", "duration" },
-    { "bytes", OPT_INT | HAS_ARG, {(void*)&seek_by_bytes}, "seek by bytes 0=off 1=on -1=auto", "val" },
-    { "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
-    { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
-    { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
-    { "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
-    { "debug", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
-    { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },
-    { "vismv", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_vismv}, "visualize motion vectors", "" },
-    { "fast", OPT_BOOL | OPT_EXPERT, {(void*)&fast}, "non spec compliant optimizations", "" },
-    { "genpts", OPT_BOOL | OPT_EXPERT, {(void*)&genpts}, "generate pts", "" },
-    { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&decoder_reorder_pts}, "let decoder reorder pts 0=off 1=on -1=auto", ""},
-    { "lowres", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&lowres}, "", "" },
-    { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&skip_loop_filter}, "", "" },
-    { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&skip_frame}, "", "" },
-    { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&skip_idct}, "", "" },
-    { "idct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&idct}, "set idct algo",  "algo" },
-    { "er", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_recognition}, "set error detection threshold (0-4)",  "threshold" },
-    { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options",  "bit_mask" },
-    { "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
-    { "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
-    { "autoexit", OPT_BOOL | OPT_EXPERT, {(void*)&autoexit}, "exit at the end", "" },
-    { "loop", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&loop}, "set number of times the playback shall be looped", "loop count" },
-    { "framedrop", OPT_BOOL | OPT_EXPERT, {(void*)&framedrop}, "drop frames when cpu is too slow", "" },
-    { "window_title", OPT_STRING | HAS_ARG, {(void*)&window_title}, "set window title", "window title" },
-#if CONFIG_AVFILTER
-    { "vfilters", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" },
-#endif
-    { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" },
-    { "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
-    { NULL, },
-};
-
-static void show_usage(void)
-{
-    printf("Simple media player\n");
-    printf("usage: ffplay [options] input_file\n");
-    printf("\n");
-}
-
-static void show_help(void)
-{
-    show_usage();
-    show_help_options(options, "Main options:\n",
-                      OPT_EXPERT, 0);
-    show_help_options(options, "\nAdvanced options:\n",
-                      OPT_EXPERT, OPT_EXPERT);
-    printf("\nWhile playing:\n"
-           "q, ESC              quit\n"
-           "f                   toggle full screen\n"
-           "p, SPC              pause\n"
-           "a                   cycle audio channel\n"
-           "v                   cycle video channel\n"
-           "t                   cycle subtitle channel\n"
-           "w                   show audio waves\n"
-           "s                   activate frame-step mode\n"
-           "left/right          seek backward/forward 10 seconds\n"
-           "down/up             seek backward/forward 1 minute\n"
-           "mouse click         seek to percentage in file corresponding to fraction of width\n"
-           );
-}
-
-static void opt_input_file(const char *filename)
-{
-    if (input_filename) {
-        fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
-                filename, input_filename);
-        exit(1);
-    }
-    if (!strcmp(filename, "-"))
-        filename = "pipe:";
-    input_filename = filename;
-}
-
-/* Called from the main */
-int main(int argc, char **argv)
-{
-    int flags, i;
-
-    /* register all codecs, demux and protocols */
-    avcodec_register_all();
-#if CONFIG_AVDEVICE
-    avdevice_register_all();
-#endif
-#if CONFIG_AVFILTER
-    avfilter_register_all();
-#endif
-    av_register_all();
-
-    for(i=0; i<AVMEDIA_TYPE_NB; i++){
-        avcodec_opts[i]= avcodec_alloc_context2(i);
-    }
-    avformat_opts = avformat_alloc_context();
-#if !CONFIG_AVFILTER
-    sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
-#endif
-
-    show_banner();
-
-    parse_options(argc, argv, options, opt_input_file);
-
-    if (!input_filename) {
-        show_usage();
-        fprintf(stderr, "An input file must be specified\n");
-        fprintf(stderr, "Use -h to get full help or, even better, run 'man ffplay'\n");
-        exit(1);
-    }
-
-    if (display_disable) {
-        video_disable = 1;
-    }
-    flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
-#if !defined(__MINGW32__) && !defined(__APPLE__)
-    flags |= SDL_INIT_EVENTTHREAD; /* Not supported on Windows or Mac OS X */
-#endif
-    if (SDL_Init (flags)) {
-        fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
-        exit(1);
-    }
-
-    if (!display_disable) {
-#if HAVE_SDL_VIDEO_SIZE
-        const SDL_VideoInfo *vi = SDL_GetVideoInfo();
-        fs_screen_width = vi->current_w;
-        fs_screen_height = vi->current_h;
-#endif
-    }
-
-    SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);
-    SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
-    SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
-
-    av_init_packet(&flush_pkt);
-    flush_pkt.data= "FLUSH";
-
-    cur_stream = stream_open(input_filename, file_iformat);
-
-    event_loop();
-
-    /* never returns */
-
-    return 0;
-}
diff --git a/ffpresets/libx264-baseline.ffpreset b/ffpresets/libx264-baseline.ffpreset
deleted file mode 100644
index ee7654b..0000000
--- a/ffpresets/libx264-baseline.ffpreset
+++ /dev/null
@@ -1,4 +0,0 @@
-coder=0
-bf=0
-flags2=-wpred-dct8x8
-wpredp=0
diff --git a/ffpresets/libx264-default.ffpreset b/ffpresets/libx264-default.ffpreset
deleted file mode 100644
index 75191e2..0000000
--- a/ffpresets/libx264-default.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=hex
-subq=7
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=3
-directpred=1
-trellis=1
-flags2=+mixed_refs+wpred+dct8x8+fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-fast.ffpreset b/ffpresets/libx264-fast.ffpreset
deleted file mode 100644
index cac6534..0000000
--- a/ffpresets/libx264-fast.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=hex
-subq=6
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=2
-directpred=1
-trellis=1
-flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
-wpredp=2
-rc_lookahead=30
diff --git a/ffpresets/libx264-fast_firstpass.ffpreset b/ffpresets/libx264-fast_firstpass.ffpreset
deleted file mode 100644
index 65ec011..0000000
--- a/ffpresets/libx264-fast_firstpass.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=1
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip
-wpredp=2
-rc_lookahead=30
diff --git a/ffpresets/libx264-faster.ffpreset b/ffpresets/libx264-faster.ffpreset
deleted file mode 100644
index a32eed3..0000000
--- a/ffpresets/libx264-faster.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=hex
-subq=4
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=2
-directpred=1
-trellis=1
-flags2=+bpyramid-mixed_refs+wpred+dct8x8+fastpskip
-wpredp=1
-rc_lookahead=20
diff --git a/ffpresets/libx264-faster_firstpass.ffpreset b/ffpresets/libx264-faster_firstpass.ffpreset
deleted file mode 100644
index c777eb4..0000000
--- a/ffpresets/libx264-faster_firstpass.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=1
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip
-wpredp=1
-rc_lookahead=20
diff --git a/ffpresets/libx264-fastfirstpass.ffpreset b/ffpresets/libx264-fastfirstpass.ffpreset
deleted file mode 100644
index 7278f77..0000000
--- a/ffpresets/libx264-fastfirstpass.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8
-me_method=dia
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=3
-trellis=0
-flags2=-bpyramid-wpred-mixed_refs-dct8x8+fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-hq.ffpreset b/ffpresets/libx264-hq.ffpreset
deleted file mode 100644
index 9c14d8f..0000000
--- a/ffpresets/libx264-hq.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=umh
-subq=8
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=4
-directpred=3
-trellis=1
-flags2=+wpred+mixed_refs+dct8x8+fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-ipod320.ffpreset b/ffpresets/libx264-ipod320.ffpreset
deleted file mode 100644
index 943b521..0000000
--- a/ffpresets/libx264-ipod320.ffpreset
+++ /dev/null
@@ -1,7 +0,0 @@
-coder=0
-bf=0
-flags2=-wpred-dct8x8
-level=13
-maxrate=768000
-bufsize=3000000
-wpredp=0
diff --git a/ffpresets/libx264-ipod640.ffpreset b/ffpresets/libx264-ipod640.ffpreset
deleted file mode 100644
index 1ed3d9f..0000000
--- a/ffpresets/libx264-ipod640.ffpreset
+++ /dev/null
@@ -1,8 +0,0 @@
-coder=0
-bf=0
-refs=1
-flags2=-wpred-dct8x8
-level=30
-maxrate=10000000
-bufsize=10000000
-wpredp=0
diff --git a/ffpresets/libx264-lossless_fast.ffpreset b/ffpresets/libx264-lossless_fast.ffpreset
deleted file mode 100644
index ea08d3c..0000000
--- a/ffpresets/libx264-lossless_fast.ffpreset
+++ /dev/null
@@ -1,20 +0,0 @@
-coder=0
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8+parti4x4+partp8x8-partp4x4-partb8x8
-me_method=hex
-subq=3
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-directpred=1
-flags2=+fastpskip
-cqp=0
-wpredp=0
diff --git a/ffpresets/libx264-lossless_max.ffpreset b/ffpresets/libx264-lossless_max.ffpreset
deleted file mode 100644
index 8c049c9..0000000
--- a/ffpresets/libx264-lossless_max.ffpreset
+++ /dev/null
@@ -1,21 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
-me_method=esa
-subq=8
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-refs=16
-directpred=1
-flags2=+mixed_refs+dct8x8+fastpskip
-cqp=0
-wpredp=2
diff --git a/ffpresets/libx264-lossless_medium.ffpreset b/ffpresets/libx264-lossless_medium.ffpreset
deleted file mode 100644
index 558be6c..0000000
--- a/ffpresets/libx264-lossless_medium.ffpreset
+++ /dev/null
@@ -1,20 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
-me_method=hex
-subq=5
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-directpred=1
-flags2=+fastpskip
-cqp=0
-wpredp=2
diff --git a/ffpresets/libx264-lossless_slow.ffpreset b/ffpresets/libx264-lossless_slow.ffpreset
deleted file mode 100644
index ff641cf..0000000
--- a/ffpresets/libx264-lossless_slow.ffpreset
+++ /dev/null
@@ -1,21 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
-me_method=umh
-subq=6
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-refs=2
-directpred=1
-flags2=+dct8x8+fastpskip
-cqp=0
-wpredp=2
diff --git a/ffpresets/libx264-lossless_slower.ffpreset b/ffpresets/libx264-lossless_slower.ffpreset
deleted file mode 100644
index 854f74b..0000000
--- a/ffpresets/libx264-lossless_slower.ffpreset
+++ /dev/null
@@ -1,21 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
-me_method=umh
-subq=8
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-refs=4
-directpred=1
-flags2=+mixed_refs+dct8x8+fastpskip
-cqp=0
-wpredp=2
diff --git a/ffpresets/libx264-lossless_ultrafast.ffpreset b/ffpresets/libx264-lossless_ultrafast.ffpreset
deleted file mode 100644
index 1c429f2..0000000
--- a/ffpresets/libx264-lossless_ultrafast.ffpreset
+++ /dev/null
@@ -1,19 +0,0 @@
-coder=0
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8
-me_method=dia
-subq=0
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-directpred=1
-flags2=+fastpskip
-cqp=0
diff --git a/ffpresets/libx264-main.ffpreset b/ffpresets/libx264-main.ffpreset
deleted file mode 100644
index d1dc7dd..0000000
--- a/ffpresets/libx264-main.ffpreset
+++ /dev/null
@@ -1 +0,0 @@
-flags2=-dct8x8
diff --git a/ffpresets/libx264-max.ffpreset b/ffpresets/libx264-max.ffpreset
deleted file mode 100644
index 667ba85..0000000
--- a/ffpresets/libx264-max.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
-me_method=tesa
-subq=10
-me_range=24
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=16
-directpred=3
-trellis=2
-flags2=+wpred+mixed_refs+dct8x8-fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-medium.ffpreset b/ffpresets/libx264-medium.ffpreset
deleted file mode 100644
index 039f1d6..0000000
--- a/ffpresets/libx264-medium.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=hex
-subq=7
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=3
-directpred=1
-trellis=1
-flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-medium_firstpass.ffpreset b/ffpresets/libx264-medium_firstpass.ffpreset
deleted file mode 100644
index e415989..0000000
--- a/ffpresets/libx264-medium_firstpass.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=1
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-normal.ffpreset b/ffpresets/libx264-normal.ffpreset
deleted file mode 100644
index ee790b6..0000000
--- a/ffpresets/libx264-normal.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=hex
-subq=6
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=2
-directpred=3
-trellis=0
-flags2=+wpred+dct8x8+fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-placebo.ffpreset b/ffpresets/libx264-placebo.ffpreset
deleted file mode 100644
index fae2222..0000000
--- a/ffpresets/libx264-placebo.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
-me_method=tesa
-subq=10
-me_range=24
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=16
-refs=16
-directpred=3
-trellis=2
-flags2=+bpyramid+mixed_refs+wpred+dct8x8-fastpskip
-wpredp=2
-rc_lookahead=60
diff --git a/ffpresets/libx264-placebo_firstpass.ffpreset b/ffpresets/libx264-placebo_firstpass.ffpreset
deleted file mode 100644
index fae2222..0000000
--- a/ffpresets/libx264-placebo_firstpass.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
-me_method=tesa
-subq=10
-me_range=24
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=16
-refs=16
-directpred=3
-trellis=2
-flags2=+bpyramid+mixed_refs+wpred+dct8x8-fastpskip
-wpredp=2
-rc_lookahead=60
diff --git a/ffpresets/libx264-slow.ffpreset b/ffpresets/libx264-slow.ffpreset
deleted file mode 100644
index 0f3f4d4..0000000
--- a/ffpresets/libx264-slow.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=umh
-subq=8
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=5
-directpred=3
-trellis=1
-flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
-wpredp=2
-rc_lookahead=50
diff --git a/ffpresets/libx264-slow_firstpass.ffpreset b/ffpresets/libx264-slow_firstpass.ffpreset
deleted file mode 100644
index 89e74e4..0000000
--- a/ffpresets/libx264-slow_firstpass.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=3
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip
-wpredp=2
-rc_lookahead=50
diff --git a/ffpresets/libx264-slower.ffpreset b/ffpresets/libx264-slower.ffpreset
deleted file mode 100644
index f3a412c..0000000
--- a/ffpresets/libx264-slower.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
-me_method=umh
-subq=9
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=8
-directpred=3
-trellis=2
-flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
-wpredp=2
-rc_lookahead=60
diff --git a/ffpresets/libx264-slower_firstpass.ffpreset b/ffpresets/libx264-slower_firstpass.ffpreset
deleted file mode 100644
index aa1eb1e..0000000
--- a/ffpresets/libx264-slower_firstpass.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=3
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip
-wpredp=2
-rc_lookahead=60
diff --git a/ffpresets/libx264-slowfirstpass.ffpreset b/ffpresets/libx264-slowfirstpass.ffpreset
deleted file mode 100644
index fe07331..0000000
--- a/ffpresets/libx264-slowfirstpass.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=hex
-subq=6
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=3
-trellis=0
-flags2=+wpred+dct8x8+fastpskip
-wpredp=2
diff --git a/ffpresets/libx264-superfast.ffpreset b/ffpresets/libx264-superfast.ffpreset
deleted file mode 100644
index e2cb959..0000000
--- a/ffpresets/libx264-superfast.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=1
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=1
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred+dct8x8+fastpskip-mbtree
-wpredp=0
diff --git a/ffpresets/libx264-superfast_firstpass.ffpreset b/ffpresets/libx264-superfast_firstpass.ffpreset
deleted file mode 100644
index 5f44bea..0000000
--- a/ffpresets/libx264-superfast_firstpass.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=1
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=1
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip-mbtree
-wpredp=0
diff --git a/ffpresets/libx264-ultrafast.ffpreset b/ffpresets/libx264-ultrafast.ffpreset
deleted file mode 100644
index 70acb00..0000000
--- a/ffpresets/libx264-ultrafast.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=0
-flags=-loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=0
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=0
-i_qfactor=0.71
-b_strategy=0
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=0
-refs=1
-directpred=1
-trellis=0
-flags2=-bpyramid-mixed_refs-wpred-dct8x8+fastpskip-mbtree
-wpredp=0
-aq_mode=0
diff --git a/ffpresets/libx264-ultrafast_firstpass.ffpreset b/ffpresets/libx264-ultrafast_firstpass.ffpreset
deleted file mode 100644
index 70acb00..0000000
--- a/ffpresets/libx264-ultrafast_firstpass.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=0
-flags=-loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=0
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=0
-i_qfactor=0.71
-b_strategy=0
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=0
-refs=1
-directpred=1
-trellis=0
-flags2=-bpyramid-mixed_refs-wpred-dct8x8+fastpskip-mbtree
-wpredp=0
-aq_mode=0
diff --git a/ffpresets/libx264-veryfast.ffpreset b/ffpresets/libx264-veryfast.ffpreset
deleted file mode 100644
index a29b115..0000000
--- a/ffpresets/libx264-veryfast.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partb8x8
-me_method=hex
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=1
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred+dct8x8+fastpskip-mbtree
-wpredp=0
diff --git a/ffpresets/libx264-veryfast_firstpass.ffpreset b/ffpresets/libx264-veryfast_firstpass.ffpreset
deleted file mode 100644
index bab5d9b..0000000
--- a/ffpresets/libx264-veryfast_firstpass.ffpreset
+++ /dev/null
@@ -1,22 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=2
-me_range=16
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=1
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=3
-refs=1
-directpred=1
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip-mbtree
-wpredp=0
diff --git a/ffpresets/libx264-veryslow.ffpreset b/ffpresets/libx264-veryslow.ffpreset
deleted file mode 100644
index a060625..0000000
--- a/ffpresets/libx264-veryslow.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8
-me_method=umh
-subq=10
-me_range=24
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=8
-refs=16
-directpred=3
-trellis=2
-flags2=+bpyramid+mixed_refs+wpred+dct8x8+fastpskip
-wpredp=2
-rc_lookahead=60
diff --git a/ffpresets/libx264-veryslow_firstpass.ffpreset b/ffpresets/libx264-veryslow_firstpass.ffpreset
deleted file mode 100644
index 6e7079b..0000000
--- a/ffpresets/libx264-veryslow_firstpass.ffpreset
+++ /dev/null
@@ -1,23 +0,0 @@
-coder=1
-flags=+loop
-cmp=+chroma
-partitions=-parti8x8-parti4x4-partp8x8-partb8x8
-me_method=dia
-subq=2
-me_range=24
-g=250
-keyint_min=25
-sc_threshold=40
-i_qfactor=0.71
-b_strategy=2
-qcomp=0.6
-qmin=10
-qmax=51
-qdiff=4
-bf=8
-refs=1
-directpred=3
-trellis=0
-flags2=+bpyramid-mixed_refs+wpred-dct8x8+fastpskip
-wpredp=2
-rc_lookahead=60
diff --git a/ffprobe.c b/ffprobe.c
deleted file mode 100644
index 7cb6167..0000000
--- a/ffprobe.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * FFprobe : Simple Media Prober based on the FFmpeg libraries
- * Copyright (c) 2007-2010 Stefano Sabatini
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-
-#include "libavformat/avformat.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/opt.h"
-#include "libavutil/pixdesc.h"
-#include "libavdevice/avdevice.h"
-#include "cmdutils.h"
-
-const char program_name[] = "FFprobe";
-const int program_birth_year = 2007;
-
-static int do_show_format  = 0;
-static int do_show_streams = 0;
-
-static int convert_tags                 = 0;
-static int show_value_unit              = 0;
-static int use_value_prefix             = 0;
-static int use_byte_value_binary_prefix = 0;
-static int use_value_sexagesimal_format = 0;
-
-/* globals */
-static const OptionDef options[];
-
-/* FFprobe context */
-static const char *input_filename;
-static AVInputFormat *iformat = NULL;
-
-static const char *binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" };
-static const char *decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P"  };
-
-static const char *unit_second_str          = "s"    ;
-static const char *unit_hertz_str           = "Hz"   ;
-static const char *unit_byte_str            = "byte" ;
-static const char *unit_bit_per_second_str  = "bit/s";
-
-static char *value_string(char *buf, int buf_size, double val, const char *unit)
-{
-    if (unit == unit_second_str && use_value_sexagesimal_format) {
-        double secs;
-        int hours, mins;
-        secs  = val;
-        mins  = (int)secs / 60;
-        secs  = secs - mins * 60;
-        hours = mins / 60;
-        mins %= 60;
-        snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs);
-    } else if (use_value_prefix) {
-        const char *prefix_string;
-        int index;
-
-        if (unit == unit_byte_str && use_byte_value_binary_prefix) {
-            index = (int) (log(val)/log(2)) / 10;
-            index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) -1);
-            val /= pow(2, index*10);
-            prefix_string = binary_unit_prefixes[index];
-        } else {
-            index = (int) (log10(val)) / 3;
-            index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) -1);
-            val /= pow(10, index*3);
-            prefix_string = decimal_unit_prefixes[index];
-        }
-
-        snprintf(buf, buf_size, "%.3f %s%s", val, prefix_string, show_value_unit ? unit : "");
-    } else {
-        snprintf(buf, buf_size, "%f %s", val, show_value_unit ? unit : "");
-    }
-
-    return buf;
-}
-
-static char *time_value_string(char *buf, int buf_size, int64_t val, const AVRational *time_base)
-{
-    if (val == AV_NOPTS_VALUE) {
-        snprintf(buf, buf_size, "N/A");
-    } else {
-        value_string(buf, buf_size, val * av_q2d(*time_base), unit_second_str);
-    }
-
-    return buf;
-}
-
-static const char *media_type_string(enum AVMediaType media_type)
-{
-    switch (media_type) {
-    case AVMEDIA_TYPE_VIDEO:      return "video";
-    case AVMEDIA_TYPE_AUDIO:      return "audio";
-    case AVMEDIA_TYPE_DATA:       return "data";
-    case AVMEDIA_TYPE_SUBTITLE:   return "subtitle";
-    case AVMEDIA_TYPE_ATTACHMENT: return "attachment";
-    default:                      return "unknown";
-    }
-}
-
-static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
-{
-    AVStream *stream = fmt_ctx->streams[stream_idx];
-    AVCodecContext *dec_ctx;
-    AVCodec *dec;
-    char val_str[128];
-    AVMetadataTag *tag = NULL;
-    char a, b, c, d;
-    AVRational display_aspect_ratio;
-
-    printf("[STREAM]\n");
-
-    printf("index=%d\n",        stream->index);
-
-    if ((dec_ctx = stream->codec)) {
-        if ((dec = dec_ctx->codec)) {
-            printf("codec_name=%s\n",         dec->name);
-            printf("codec_long_name=%s\n",    dec->long_name);
-        } else {
-            printf("codec_name=unknown\n");
-        }
-
-        printf("codec_type=%s\n",         media_type_string(dec_ctx->codec_type));
-        printf("codec_time_base=%d/%d\n", dec_ctx->time_base.num, dec_ctx->time_base.den);
-
-        /* print AVI/FourCC tag */
-        a = dec_ctx->codec_tag     & 0xff;
-        b = dec_ctx->codec_tag>>8  & 0xff;
-        c = dec_ctx->codec_tag>>16 & 0xff;
-        d = dec_ctx->codec_tag>>24 & 0xff;
-        printf("codec_tag_string=");
-        if (isprint(a)) printf("%c", a); else printf("[%d]", a);
-        if (isprint(b)) printf("%c", b); else printf("[%d]", b);
-        if (isprint(c)) printf("%c", c); else printf("[%d]", c);
-        if (isprint(d)) printf("%c", d); else printf("[%d]", d);
-        printf("\ncodec_tag=0x%04x\n", dec_ctx->codec_tag);
-
-        switch (dec_ctx->codec_type) {
-        case AVMEDIA_TYPE_VIDEO:
-            printf("width=%d\n",                   dec_ctx->width);
-            printf("height=%d\n",                  dec_ctx->height);
-            printf("has_b_frames=%d\n",            dec_ctx->has_b_frames);
-            if (dec_ctx->sample_aspect_ratio.num) {
-                printf("sample_aspect_ratio=%d:%d\n", dec_ctx->sample_aspect_ratio.num,
-                                                      dec_ctx->sample_aspect_ratio.den);
-                av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
-                          dec_ctx->width  * dec_ctx->sample_aspect_ratio.num,
-                          dec_ctx->height * dec_ctx->sample_aspect_ratio.den,
-                          1024*1024);
-                printf("display_aspect_ratio=%d:%d\n", display_aspect_ratio.num,
-                                                       display_aspect_ratio.den);
-            }
-            printf("pix_fmt=%s\n",                 dec_ctx->pix_fmt != PIX_FMT_NONE ?
-                   av_pix_fmt_descriptors[dec_ctx->pix_fmt].name : "unknown");
-            break;
-
-        case AVMEDIA_TYPE_AUDIO:
-            printf("sample_rate=%s\n",             value_string(val_str, sizeof(val_str),
-                                                                dec_ctx->sample_rate,
-                                                                unit_hertz_str));
-            printf("channels=%d\n",                dec_ctx->channels);
-            printf("bits_per_sample=%d\n",         av_get_bits_per_sample(dec_ctx->codec_id));
-            break;
-        }
-    } else {
-        printf("codec_type=unknown\n");
-    }
-
-    if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS)
-        printf("id=0x%x\n", stream->id);
-    printf("r_frame_rate=%d/%d\n",         stream->r_frame_rate.num,   stream->r_frame_rate.den);
-    printf("avg_frame_rate=%d/%d\n",       stream->avg_frame_rate.num, stream->avg_frame_rate.den);
-    printf("time_base=%d/%d\n",            stream->time_base.num,      stream->time_base.den);
-    if (stream->language[0])
-        printf("language=%s\n",            stream->language);
-    printf("start_time=%s\n",   time_value_string(val_str, sizeof(val_str), stream->start_time,
-                                                  &stream->time_base));
-    printf("duration=%s\n",     time_value_string(val_str, sizeof(val_str), stream->duration,
-                                                  &stream->time_base));
-    if (stream->nb_frames)
-        printf("nb_frames=%"PRId64"\n",    stream->nb_frames);
-
-    while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
-        printf("TAG:%s=%s\n", tag->key, tag->value);
-
-    printf("[/STREAM]\n");
-}
-
-static void show_format(AVFormatContext *fmt_ctx)
-{
-    AVMetadataTag *tag = NULL;
-    char val_str[128];
-
-    printf("[FORMAT]\n");
-
-    printf("filename=%s\n",         fmt_ctx->filename);
-    printf("nb_streams=%d\n",       fmt_ctx->nb_streams);
-    printf("format_name=%s\n",      fmt_ctx->iformat->name);
-    printf("format_long_name=%s\n", fmt_ctx->iformat->long_name);
-    printf("start_time=%s\n",       time_value_string(val_str, sizeof(val_str), fmt_ctx->start_time,
-                                                      &AV_TIME_BASE_Q));
-    printf("duration=%s\n",         time_value_string(val_str, sizeof(val_str), fmt_ctx->duration,
-                                                      &AV_TIME_BASE_Q));
-    printf("size=%s\n",             value_string(val_str, sizeof(val_str), fmt_ctx->file_size,
-                                                 unit_byte_str));
-    printf("bit_rate=%s\n",         value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate,
-                                                 unit_bit_per_second_str));
-
-    if (convert_tags)
-        av_metadata_conv(fmt_ctx, NULL, fmt_ctx->iformat->metadata_conv);
-    while ((tag = av_metadata_get(fmt_ctx->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
-        printf("TAG:%s=%s\n", tag->key, tag->value);
-
-    printf("[/FORMAT]\n");
-}
-
-static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
-{
-    int err, i;
-    AVFormatContext *fmt_ctx;
-
-    fmt_ctx = avformat_alloc_context();
-
-    if ((err = av_open_input_file(&fmt_ctx, filename, iformat, 0, NULL)) < 0) {
-        print_error(filename, err);
-        return err;
-    }
-
-    /* fill the streams in the format context */
-    if ((err = av_find_stream_info(fmt_ctx)) < 0) {
-        print_error(filename, err);
-        return err;
-    }
-
-    dump_format(fmt_ctx, 0, filename, 0);
-
-    /* bind a decoder to each input stream */
-    for (i = 0; i < fmt_ctx->nb_streams; i++) {
-        AVStream *stream = fmt_ctx->streams[i];
-        AVCodec *codec;
-
-        if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {
-            fprintf(stderr, "Unsupported codec (id=%d) for input stream %d\n",
-                    stream->codec->codec_id, stream->index);
-        } else if (avcodec_open(stream->codec, codec) < 0) {
-            fprintf(stderr, "Error while opening codec for input stream %d\n",
-                    stream->index);
-        }
-    }
-
-    *fmt_ctx_ptr = fmt_ctx;
-    return 0;
-}
-
-static int probe_file(const char *filename)
-{
-    AVFormatContext *fmt_ctx;
-    int ret, i;
-
-    if ((ret = open_input_file(&fmt_ctx, filename)))
-        return ret;
-
-    if (do_show_streams)
-        for (i = 0; i < fmt_ctx->nb_streams; i++)
-            show_stream(fmt_ctx, i);
-
-    if (do_show_format)
-        show_format(fmt_ctx);
-
-    av_close_input_file(fmt_ctx);
-    return 0;
-}
-
-static void show_usage(void)
-{
-    printf("Simple multimedia streams analyzer\n");
-    printf("usage: ffprobe [OPTIONS] [INPUT_FILE]\n");
-    printf("\n");
-}
-
-static void opt_format(const char *arg)
-{
-    iformat = av_find_input_format(arg);
-    if (!iformat) {
-        fprintf(stderr, "Unknown input format: %s\n", arg);
-        exit(1);
-    }
-}
-
-static void opt_input_file(const char *arg)
-{
-    if (input_filename) {
-        fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
-                arg, input_filename);
-        exit(1);
-    }
-    if (!strcmp(arg, "-"))
-        arg = "pipe:";
-    input_filename = arg;
-}
-
-static void show_help(void)
-{
-    show_usage();
-    show_help_options(options, "Main options:\n", 0, 0);
-    printf("\n");
-}
-
-static void opt_pretty(void)
-{
-    show_value_unit              = 1;
-    use_value_prefix             = 1;
-    use_byte_value_binary_prefix = 1;
-    use_value_sexagesimal_format = 1;
-}
-
-static const OptionDef options[] = {
-#include "cmdutils_common_opts.h"
-    { "convert_tags", OPT_BOOL, {(void*)&convert_tags}, "convert tag names to the FFmpeg generic tag names" },
-    { "f", HAS_ARG, {(void*)opt_format}, "force format", "format" },
-    { "unit", OPT_BOOL, {(void*)&show_value_unit}, "show unit of the displayed values" },
-    { "prefix", OPT_BOOL, {(void*)&use_value_prefix}, "use SI prefixes for the displayed values" },
-    { "byte_binary_prefix", OPT_BOOL, {(void*)&use_byte_value_binary_prefix},
-      "use binary prefixes for byte units" },
-    { "sexagesimal", OPT_BOOL,  {(void*)&use_value_sexagesimal_format},
-      "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
-    { "pretty", 0, {(void*)&opt_pretty},
-      "prettify the format of displayed values, make it more human readable" },
-    { "show_format",  OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
-    { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
-    { NULL, },
-};
-
-int main(int argc, char **argv)
-{
-    av_register_all();
-#if CONFIG_AVDEVICE
-    avdevice_register_all();
-#endif
-
-    show_banner();
-    parse_options(argc, argv, options, opt_input_file);
-
-    if (!input_filename) {
-        show_usage();
-        fprintf(stderr, "You have to specify one input file.\n");
-        fprintf(stderr, "Use -h to get full help or, even better, run 'man ffprobe'.\n");
-        exit(1);
-    }
-
-    return probe_file(input_filename);
-}
diff --git a/ffserver.c b/ffserver.c
deleted file mode 100644
index a1bd526..0000000
--- a/ffserver.c
+++ /dev/null
@@ -1,4697 +0,0 @@
-/*
- * Multiple format streaming server
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define _XOPEN_SOURCE 600
-
-#include "config.h"
-#if !HAVE_CLOSESOCKET
-#define closesocket close
-#endif
-#include <string.h>
-#include <strings.h>
-#include <stdlib.h>
-#include "libavformat/avformat.h"
-#include "libavformat/network.h"
-#include "libavformat/os_support.h"
-#include "libavformat/rtpdec.h"
-#include "libavformat/rtsp.h"
-#include "libavutil/avstring.h"
-#include "libavutil/lfg.h"
-#include "libavutil/random_seed.h"
-#include "libavcodec/opt.h"
-#include <stdarg.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#if HAVE_POLL_H
-#include <poll.h>
-#endif
-#include <errno.h>
-#include <sys/time.h>
-#include <time.h>
-#include <sys/wait.h>
-#include <signal.h>
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include "cmdutils.h"
-
-const char program_name[] = "FFserver";
-const int program_birth_year = 2000;
-
-static const OptionDef options[];
-
-enum HTTPState {
-    HTTPSTATE_WAIT_REQUEST,
-    HTTPSTATE_SEND_HEADER,
-    HTTPSTATE_SEND_DATA_HEADER,
-    HTTPSTATE_SEND_DATA,          /* sending TCP or UDP data */
-    HTTPSTATE_SEND_DATA_TRAILER,
-    HTTPSTATE_RECEIVE_DATA,
-    HTTPSTATE_WAIT_FEED,          /* wait for data from the feed */
-    HTTPSTATE_READY,
-
-    RTSPSTATE_WAIT_REQUEST,
-    RTSPSTATE_SEND_REPLY,
-    RTSPSTATE_SEND_PACKET,
-};
-
-static const char *http_state[] = {
-    "HTTP_WAIT_REQUEST",
-    "HTTP_SEND_HEADER",
-
-    "SEND_DATA_HEADER",
-    "SEND_DATA",
-    "SEND_DATA_TRAILER",
-    "RECEIVE_DATA",
-    "WAIT_FEED",
-    "READY",
-
-    "RTSP_WAIT_REQUEST",
-    "RTSP_SEND_REPLY",
-    "RTSP_SEND_PACKET",
-};
-
-#define IOBUFFER_INIT_SIZE 8192
-
-/* timeouts are in ms */
-#define HTTP_REQUEST_TIMEOUT (15 * 1000)
-#define RTSP_REQUEST_TIMEOUT (3600 * 24 * 1000)
-
-#define SYNC_TIMEOUT (10 * 1000)
-
-typedef struct RTSPActionServerSetup {
-    uint32_t ipaddr;
-    char transport_option[512];
-} RTSPActionServerSetup;
-
-typedef struct {
-    int64_t count1, count2;
-    int64_t time1, time2;
-} DataRateData;
-
-/* context associated with one connection */
-typedef struct HTTPContext {
-    enum HTTPState state;
-    int fd; /* socket file descriptor */
-    struct sockaddr_in from_addr; /* origin */
-    struct pollfd *poll_entry; /* used when polling */
-    int64_t timeout;
-    uint8_t *buffer_ptr, *buffer_end;
-    int http_error;
-    int post;
-    int chunked_encoding;
-    int chunk_size;               /* 0 if it needs to be read */
-    struct HTTPContext *next;
-    int got_key_frame; /* stream 0 => 1, stream 1 => 2, stream 2=> 4 */
-    int64_t data_count;
-    /* feed input */
-    int feed_fd;
-    /* input format handling */
-    AVFormatContext *fmt_in;
-    int64_t start_time;            /* In milliseconds - this wraps fairly often */
-    int64_t first_pts;            /* initial pts value */
-    int64_t cur_pts;             /* current pts value from the stream in us */
-    int64_t cur_frame_duration;  /* duration of the current frame in us */
-    int cur_frame_bytes;       /* output frame size, needed to compute
-                                  the time at which we send each
-                                  packet */
-    int pts_stream_index;        /* stream we choose as clock reference */
-    int64_t cur_clock;           /* current clock reference value in us */
-    /* output format handling */
-    struct FFStream *stream;
-    /* -1 is invalid stream */
-    int feed_streams[MAX_STREAMS]; /* index of streams in the feed */
-    int switch_feed_streams[MAX_STREAMS]; /* index of streams in the feed */
-    int switch_pending;
-    AVFormatContext fmt_ctx; /* instance of FFStream for one user */
-    int last_packet_sent; /* true if last data packet was sent */
-    int suppress_log;
-    DataRateData datarate;
-    int wmp_client_id;
-    char protocol[16];
-    char method[16];
-    char url[128];
-    int buffer_size;
-    uint8_t *buffer;
-    int is_packetized; /* if true, the stream is packetized */
-    int packet_stream_index; /* current stream for output in state machine */
-
-    /* RTSP state specific */
-    uint8_t *pb_buffer; /* XXX: use that in all the code */
-    ByteIOContext *pb;
-    int seq; /* RTSP sequence number */
-
-    /* RTP state specific */
-    enum RTSPLowerTransport rtp_protocol;
-    char session_id[32]; /* session id */
-    AVFormatContext *rtp_ctx[MAX_STREAMS];
-
-    /* RTP/UDP specific */
-    URLContext *rtp_handles[MAX_STREAMS];
-
-    /* RTP/TCP specific */
-    struct HTTPContext *rtsp_c;
-    uint8_t *packet_buffer, *packet_buffer_ptr, *packet_buffer_end;
-} HTTPContext;
-
-/* each generated stream is described here */
-enum StreamType {
-    STREAM_TYPE_LIVE,
-    STREAM_TYPE_STATUS,
-    STREAM_TYPE_REDIRECT,
-};
-
-enum IPAddressAction {
-    IP_ALLOW = 1,
-    IP_DENY,
-};
-
-typedef struct IPAddressACL {
-    struct IPAddressACL *next;
-    enum IPAddressAction action;
-    /* These are in host order */
-    struct in_addr first;
-    struct in_addr last;
-} IPAddressACL;
-
-/* description of each stream of the ffserver.conf file */
-typedef struct FFStream {
-    enum StreamType stream_type;
-    char filename[1024];     /* stream filename */
-    struct FFStream *feed;   /* feed we are using (can be null if
-                                coming from file) */
-    AVFormatParameters *ap_in; /* input parameters */
-    AVInputFormat *ifmt;       /* if non NULL, force input format */
-    AVOutputFormat *fmt;
-    IPAddressACL *acl;
-    char dynamic_acl[1024];
-    int nb_streams;
-    int prebuffer;      /* Number of millseconds early to start */
-    int64_t max_time;      /* Number of milliseconds to run */
-    int send_on_key;
-    AVStream *streams[MAX_STREAMS];
-    int feed_streams[MAX_STREAMS]; /* index of streams in the feed */
-    char feed_filename[1024]; /* file name of the feed storage, or
-                                 input file name for a stream */
-    char author[512];
-    char title[512];
-    char copyright[512];
-    char comment[512];
-    pid_t pid;  /* Of ffmpeg process */
-    time_t pid_start;  /* Of ffmpeg process */
-    char **child_argv;
-    struct FFStream *next;
-    unsigned bandwidth; /* bandwidth, in kbits/s */
-    /* RTSP options */
-    char *rtsp_option;
-    /* multicast specific */
-    int is_multicast;
-    struct in_addr multicast_ip;
-    int multicast_port; /* first port used for multicast */
-    int multicast_ttl;
-    int loop; /* if true, send the stream in loops (only meaningful if file) */
-
-    /* feed specific */
-    int feed_opened;     /* true if someone is writing to the feed */
-    int is_feed;         /* true if it is a feed */
-    int readonly;        /* True if writing is prohibited to the file */
-    int truncate;        /* True if feeder connection truncate the feed file */
-    int conns_served;
-    int64_t bytes_served;
-    int64_t feed_max_size;      /* maximum storage size, zero means unlimited */
-    int64_t feed_write_index;   /* current write position in feed (it wraps around) */
-    int64_t feed_size;          /* current size of feed */
-    struct FFStream *next_feed;
-} FFStream;
-
-typedef struct FeedData {
-    long long data_count;
-    float avg_frame_size;   /* frame size averaged over last frames with exponential mean */
-} FeedData;
-
-static struct sockaddr_in my_http_addr;
-static struct sockaddr_in my_rtsp_addr;
-
-static char logfilename[1024];
-static HTTPContext *first_http_ctx;
-static FFStream *first_feed;   /* contains only feeds */
-static FFStream *first_stream; /* contains all streams, including feeds */
-
-static void new_connection(int server_fd, int is_rtsp);
-static void close_connection(HTTPContext *c);
-
-/* HTTP handling */
-static int handle_connection(HTTPContext *c);
-static int http_parse_request(HTTPContext *c);
-static int http_send_data(HTTPContext *c);
-static void compute_status(HTTPContext *c);
-static int open_input_stream(HTTPContext *c, const char *info);
-static int http_start_receive_data(HTTPContext *c);
-static int http_receive_data(HTTPContext *c);
-
-/* RTSP handling */
-static int rtsp_parse_request(HTTPContext *c);
-static void rtsp_cmd_describe(HTTPContext *c, const char *url);
-static void rtsp_cmd_options(HTTPContext *c, const char *url);
-static void rtsp_cmd_setup(HTTPContext *c, const char *url, RTSPMessageHeader *h);
-static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPMessageHeader *h);
-static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h);
-static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h);
-
-/* SDP handling */
-static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
-                                   struct in_addr my_ip);
-
-/* RTP handling */
-static HTTPContext *rtp_new_connection(struct sockaddr_in *from_addr,
-                                       FFStream *stream, const char *session_id,
-                                       enum RTSPLowerTransport rtp_protocol);
-static int rtp_new_av_stream(HTTPContext *c,
-                             int stream_index, struct sockaddr_in *dest_addr,
-                             HTTPContext *rtsp_c);
-
-static const char *my_program_name;
-static const char *my_program_dir;
-
-static const char *config_filename = "/etc/ffserver.conf";
-
-static int ffserver_debug;
-static int ffserver_daemon;
-static int no_launch;
-static int need_to_start_children;
-
-/* maximum number of simultaneous HTTP connections */
-static unsigned int nb_max_http_connections = 2000;
-static unsigned int nb_max_connections = 5;
-static unsigned int nb_connections;
-
-static uint64_t max_bandwidth = 1000;
-static uint64_t current_bandwidth;
-
-static int64_t cur_time;           // Making this global saves on passing it around everywhere
-
-static AVLFG random_state;
-
-static FILE *logfile = NULL;
-
-/* FIXME: make ffserver work with IPv6 */
-/* resolve host with also IP address parsing */
-static int resolve_host(struct in_addr *sin_addr, const char *hostname)
-{
-
-    if (!ff_inet_aton(hostname, sin_addr)) {
-#if HAVE_GETADDRINFO
-        struct addrinfo *ai, *cur;
-        struct addrinfo hints;
-        memset(&hints, 0, sizeof(hints));
-        hints.ai_family = AF_INET;
-        if (getaddrinfo(hostname, NULL, &hints, &ai))
-            return -1;
-        /* getaddrinfo returns a linked list of addrinfo structs.
-         * Even if we set ai_family = AF_INET above, make sure
-         * that the returned one actually is of the correct type. */
-        for (cur = ai; cur; cur = cur->ai_next) {
-            if (cur->ai_family == AF_INET) {
-                *sin_addr = ((struct sockaddr_in *)cur->ai_addr)->sin_addr;
-                freeaddrinfo(ai);
-                return 0;
-            }
-        }
-        freeaddrinfo(ai);
-        return -1;
-#else
-        struct hostent *hp;
-        hp = gethostbyname(hostname);
-        if (!hp)
-            return -1;
-        memcpy(sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
-#endif
-    }
-    return 0;
-}
-
-static char *ctime1(char *buf2)
-{
-    time_t ti;
-    char *p;
-
-    ti = time(NULL);
-    p = ctime(&ti);
-    strcpy(buf2, p);
-    p = buf2 + strlen(p) - 1;
-    if (*p == '\n')
-        *p = '\0';
-    return buf2;
-}
-
-static void http_vlog(const char *fmt, va_list vargs)
-{
-    static int print_prefix = 1;
-    if (logfile) {
-        if (print_prefix) {
-            char buf[32];
-            ctime1(buf);
-            fprintf(logfile, "%s ", buf);
-        }
-        print_prefix = strstr(fmt, "\n") != NULL;
-        vfprintf(logfile, fmt, vargs);
-        fflush(logfile);
-    }
-}
-
-static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
-{
-    va_list vargs;
-    va_start(vargs, fmt);
-    http_vlog(fmt, vargs);
-    va_end(vargs);
-}
-
-static void http_av_log(void *ptr, int level, const char *fmt, va_list vargs)
-{
-    static int print_prefix = 1;
-    AVClass *avc = ptr ? *(AVClass**)ptr : NULL;
-    if (level > av_log_get_level())
-        return;
-    if (print_prefix && avc)
-        http_log("[%s @ %p]", avc->item_name(ptr), ptr);
-    print_prefix = strstr(fmt, "\n") != NULL;
-    http_vlog(fmt, vargs);
-}
-
-static void log_connection(HTTPContext *c)
-{
-    if (c->suppress_log)
-        return;
-
-    http_log("%s - - [%s] \"%s %s\" %d %"PRId64"\n",
-             inet_ntoa(c->from_addr.sin_addr), c->method, c->url,
-             c->protocol, (c->http_error ? c->http_error : 200), c->data_count);
-}
-
-static void update_datarate(DataRateData *drd, int64_t count)
-{
-    if (!drd->time1 && !drd->count1) {
-        drd->time1 = drd->time2 = cur_time;
-        drd->count1 = drd->count2 = count;
-    } else if (cur_time - drd->time2 > 5000) {
-        drd->time1 = drd->time2;
-        drd->count1 = drd->count2;
-        drd->time2 = cur_time;
-        drd->count2 = count;
-    }
-}
-
-/* In bytes per second */
-static int compute_datarate(DataRateData *drd, int64_t count)
-{
-    if (cur_time == drd->time1)
-        return 0;
-
-    return ((count - drd->count1) * 1000) / (cur_time - drd->time1);
-}
-
-
-static void start_children(FFStream *feed)
-{
-    if (no_launch)
-        return;
-
-    for (; feed; feed = feed->next) {
-        if (feed->child_argv && !feed->pid) {
-            feed->pid_start = time(0);
-
-            feed->pid = fork();
-
-            if (feed->pid < 0) {
-                http_log("Unable to create children\n");
-                exit(1);
-            }
-            if (!feed->pid) {
-                /* In child */
-                char pathname[1024];
-                char *slash;
-                int i;
-
-                av_strlcpy(pathname, my_program_name, sizeof(pathname));
-
-                slash = strrchr(pathname, '/');
-                if (!slash)
-                    slash = pathname;
-                else
-                    slash++;
-                strcpy(slash, "ffmpeg");
-
-                http_log("Launch commandline: ");
-                http_log("%s ", pathname);
-                for (i = 1; feed->child_argv[i] && feed->child_argv[i][0]; i++)
-                    http_log("%s ", feed->child_argv[i]);
-                http_log("\n");
-
-                for (i = 3; i < 256; i++)
-                    close(i);
-
-                if (!ffserver_debug) {
-                    i = open("/dev/null", O_RDWR);
-                    if (i != -1) {
-                        dup2(i, 0);
-                        dup2(i, 1);
-                        dup2(i, 2);
-                        close(i);
-                    }
-                }
-
-                /* This is needed to make relative pathnames work */
-                chdir(my_program_dir);
-
-                signal(SIGPIPE, SIG_DFL);
-
-                execvp(pathname, feed->child_argv);
-
-                _exit(1);
-            }
-        }
-    }
-}
-
-/* open a listening socket */
-static int socket_open_listen(struct sockaddr_in *my_addr)
-{
-    int server_fd, tmp;
-
-    server_fd = socket(AF_INET,SOCK_STREAM,0);
-    if (server_fd < 0) {
-        perror ("socket");
-        return -1;
-    }
-
-    tmp = 1;
-    setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
-
-    if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) {
-        char bindmsg[32];
-        snprintf(bindmsg, sizeof(bindmsg), "bind(port %d)", ntohs(my_addr->sin_port));
-        perror (bindmsg);
-        closesocket(server_fd);
-        return -1;
-    }
-
-    if (listen (server_fd, 5) < 0) {
-        perror ("listen");
-        closesocket(server_fd);
-        return -1;
-    }
-    ff_socket_nonblock(server_fd, 1);
-
-    return server_fd;
-}
-
-/* start all multicast streams */
-static void start_multicast(void)
-{
-    FFStream *stream;
-    char session_id[32];
-    HTTPContext *rtp_c;
-    struct sockaddr_in dest_addr;
-    int default_port, stream_index;
-
-    default_port = 6000;
-    for(stream = first_stream; stream != NULL; stream = stream->next) {
-        if (stream->is_multicast) {
-            /* open the RTP connection */
-            snprintf(session_id, sizeof(session_id), "%08x%08x",
-                     av_lfg_get(&random_state), av_lfg_get(&random_state));
-
-            /* choose a port if none given */
-            if (stream->multicast_port == 0) {
-                stream->multicast_port = default_port;
-                default_port += 100;
-            }
-
-            dest_addr.sin_family = AF_INET;
-            dest_addr.sin_addr = stream->multicast_ip;
-            dest_addr.sin_port = htons(stream->multicast_port);
-
-            rtp_c = rtp_new_connection(&dest_addr, stream, session_id,
-                                       RTSP_LOWER_TRANSPORT_UDP_MULTICAST);
-            if (!rtp_c)
-                continue;
-
-            if (open_input_stream(rtp_c, "") < 0) {
-                http_log("Could not open input stream for stream '%s'\n",
-                         stream->filename);
-                continue;
-            }
-
-            /* open each RTP stream */
-            for(stream_index = 0; stream_index < stream->nb_streams;
-                stream_index++) {
-                dest_addr.sin_port = htons(stream->multicast_port +
-                                           2 * stream_index);
-                if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, NULL) < 0) {
-                    http_log("Could not open output stream '%s/streamid=%d'\n",
-                             stream->filename, stream_index);
-                    exit(1);
-                }
-            }
-
-            /* change state to send data */
-            rtp_c->state = HTTPSTATE_SEND_DATA;
-        }
-    }
-}
-
-/* main loop of the http server */
-static int http_server(void)
-{
-    int server_fd = 0, rtsp_server_fd = 0;
-    int ret, delay, delay1;
-    struct pollfd *poll_table, *poll_entry;
-    HTTPContext *c, *c_next;
-
-    if(!(poll_table = av_mallocz((nb_max_http_connections + 2)*sizeof(*poll_table)))) {
-        http_log("Impossible to allocate a poll table handling %d connections.\n", nb_max_http_connections);
-        return -1;
-    }
-
-    if (my_http_addr.sin_port) {
-        server_fd = socket_open_listen(&my_http_addr);
-        if (server_fd < 0)
-            return -1;
-    }
-
-    if (my_rtsp_addr.sin_port) {
-        rtsp_server_fd = socket_open_listen(&my_rtsp_addr);
-        if (rtsp_server_fd < 0)
-            return -1;
-    }
-
-    if (!rtsp_server_fd && !server_fd) {
-        http_log("HTTP and RTSP disabled.\n");
-        return -1;
-    }
-
-    http_log("FFserver started.\n");
-
-    start_children(first_feed);
-
-    start_multicast();
-
-    for(;;) {
-        poll_entry = poll_table;
-        if (server_fd) {
-            poll_entry->fd = server_fd;
-            poll_entry->events = POLLIN;
-            poll_entry++;
-        }
-        if (rtsp_server_fd) {
-            poll_entry->fd = rtsp_server_fd;
-            poll_entry->events = POLLIN;
-            poll_entry++;
-        }
-
-        /* wait for events on each HTTP handle */
-        c = first_http_ctx;
-        delay = 1000;
-        while (c != NULL) {
-            int fd;
-            fd = c->fd;
-            switch(c->state) {
-            case HTTPSTATE_SEND_HEADER:
-            case RTSPSTATE_SEND_REPLY:
-            case RTSPSTATE_SEND_PACKET:
-                c->poll_entry = poll_entry;
-                poll_entry->fd = fd;
-                poll_entry->events = POLLOUT;
-                poll_entry++;
-                break;
-            case HTTPSTATE_SEND_DATA_HEADER:
-            case HTTPSTATE_SEND_DATA:
-            case HTTPSTATE_SEND_DATA_TRAILER:
-                if (!c->is_packetized) {
-                    /* for TCP, we output as much as we can (may need to put a limit) */
-                    c->poll_entry = poll_entry;
-                    poll_entry->fd = fd;
-                    poll_entry->events = POLLOUT;
-                    poll_entry++;
-                } else {
-                    /* when ffserver is doing the timing, we work by
-                       looking at which packet need to be sent every
-                       10 ms */
-                    delay1 = 10; /* one tick wait XXX: 10 ms assumed */
-                    if (delay1 < delay)
-                        delay = delay1;
-                }
-                break;
-            case HTTPSTATE_WAIT_REQUEST:
-            case HTTPSTATE_RECEIVE_DATA:
-            case HTTPSTATE_WAIT_FEED:
-            case RTSPSTATE_WAIT_REQUEST:
-                /* need to catch errors */
-                c->poll_entry = poll_entry;
-                poll_entry->fd = fd;
-                poll_entry->events = POLLIN;/* Maybe this will work */
-                poll_entry++;
-                break;
-            default:
-                c->poll_entry = NULL;
-                break;
-            }
-            c = c->next;
-        }
-
-        /* wait for an event on one connection. We poll at least every
-           second to handle timeouts */
-        do {
-            ret = poll(poll_table, poll_entry - poll_table, delay);
-            if (ret < 0 && ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
-                return -1;
-        } while (ret < 0);
-
-        cur_time = av_gettime() / 1000;
-
-        if (need_to_start_children) {
-            need_to_start_children = 0;
-            start_children(first_feed);
-        }
-
-        /* now handle the events */
-        for(c = first_http_ctx; c != NULL; c = c_next) {
-            c_next = c->next;
-            if (handle_connection(c) < 0) {
-                /* close and free the connection */
-                log_connection(c);
-                close_connection(c);
-            }
-        }
-
-        poll_entry = poll_table;
-        if (server_fd) {
-            /* new HTTP connection request ? */
-            if (poll_entry->revents & POLLIN)
-                new_connection(server_fd, 0);
-            poll_entry++;
-        }
-        if (rtsp_server_fd) {
-            /* new RTSP connection request ? */
-            if (poll_entry->revents & POLLIN)
-                new_connection(rtsp_server_fd, 1);
-        }
-    }
-}
-
-/* start waiting for a new HTTP/RTSP request */
-static void start_wait_request(HTTPContext *c, int is_rtsp)
-{
-    c->buffer_ptr = c->buffer;
-    c->buffer_end = c->buffer + c->buffer_size - 1; /* leave room for '\0' */
-
-    if (is_rtsp) {
-        c->timeout = cur_time + RTSP_REQUEST_TIMEOUT;
-        c->state = RTSPSTATE_WAIT_REQUEST;
-    } else {
-        c->timeout = cur_time + HTTP_REQUEST_TIMEOUT;
-        c->state = HTTPSTATE_WAIT_REQUEST;
-    }
-}
-
-static void http_send_too_busy_reply(int fd)
-{
-    char buffer[300];
-    int len = snprintf(buffer, sizeof(buffer),
-                       "HTTP/1.0 200 Server too busy\r\n"
-                       "Content-type: text/html\r\n"
-                       "\r\n"
-                       "<html><head><title>Too busy</title></head><body>\r\n"
-                       "<p>The server is too busy to serve your request at this time.</p>\r\n"
-                       "<p>The number of current connections is %d, and this exceeds the limit of %d.</p>\r\n"
-                       "</body></html>\r\n",
-                       nb_connections, nb_max_connections);
-    send(fd, buffer, len, 0);
-}
-
-
-static void new_connection(int server_fd, int is_rtsp)
-{
-    struct sockaddr_in from_addr;
-    int fd, len;
-    HTTPContext *c = NULL;
-
-    len = sizeof(from_addr);
-    fd = accept(server_fd, (struct sockaddr *)&from_addr,
-                &len);
-    if (fd < 0) {
-        http_log("error during accept %s\n", strerror(errno));
-        return;
-    }
-    ff_socket_nonblock(fd, 1);
-
-    if (nb_connections >= nb_max_connections) {
-        http_send_too_busy_reply(fd);
-        goto fail;
-    }
-
-    /* add a new connection */
-    c = av_mallocz(sizeof(HTTPContext));
-    if (!c)
-        goto fail;
-
-    c->fd = fd;
-    c->poll_entry = NULL;
-    c->from_addr = from_addr;
-    c->buffer_size = IOBUFFER_INIT_SIZE;
-    c->buffer = av_malloc(c->buffer_size);
-    if (!c->buffer)
-        goto fail;
-
-    c->next = first_http_ctx;
-    first_http_ctx = c;
-    nb_connections++;
-
-    start_wait_request(c, is_rtsp);
-
-    return;
-
- fail:
-    if (c) {
-        av_free(c->buffer);
-        av_free(c);
-    }
-    closesocket(fd);
-}
-
-static void close_connection(HTTPContext *c)
-{
-    HTTPContext **cp, *c1;
-    int i, nb_streams;
-    AVFormatContext *ctx;
-    URLContext *h;
-    AVStream *st;
-
-    /* remove connection from list */
-    cp = &first_http_ctx;
-    while ((*cp) != NULL) {
-        c1 = *cp;
-        if (c1 == c)
-            *cp = c->next;
-        else
-            cp = &c1->next;
-    }
-
-    /* remove references, if any (XXX: do it faster) */
-    for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
-        if (c1->rtsp_c == c)
-            c1->rtsp_c = NULL;
-    }
-
-    /* remove connection associated resources */
-    if (c->fd >= 0)
-        closesocket(c->fd);
-    if (c->fmt_in) {
-        /* close each frame parser */
-        for(i=0;i<c->fmt_in->nb_streams;i++) {
-            st = c->fmt_in->streams[i];
-            if (st->codec->codec)
-                avcodec_close(st->codec);
-        }
-        av_close_input_file(c->fmt_in);
-    }
-
-    /* free RTP output streams if any */
-    nb_streams = 0;
-    if (c->stream)
-        nb_streams = c->stream->nb_streams;
-
-    for(i=0;i<nb_streams;i++) {
-        ctx = c->rtp_ctx[i];
-        if (ctx) {
-            av_write_trailer(ctx);
-            av_metadata_free(&ctx->metadata);
-            av_free(ctx->streams[0]);
-            av_free(ctx);
-        }
-        h = c->rtp_handles[i];
-        if (h)
-            url_close(h);
-    }
-
-    ctx = &c->fmt_ctx;
-
-    if (!c->last_packet_sent && c->state == HTTPSTATE_SEND_DATA_TRAILER) {
-        if (ctx->oformat) {
-            /* prepare header */
-            if (url_open_dyn_buf(&ctx->pb) >= 0) {
-                av_write_trailer(ctx);
-                av_freep(&c->pb_buffer);
-                url_close_dyn_buf(ctx->pb, &c->pb_buffer);
-            }
-        }
-    }
-
-    for(i=0; i<ctx->nb_streams; i++)
-        av_free(ctx->streams[i]);
-
-    if (c->stream && !c->post && c->stream->stream_type == STREAM_TYPE_LIVE)
-        current_bandwidth -= c->stream->bandwidth;
-
-    /* signal that there is no feed if we are the feeder socket */
-    if (c->state == HTTPSTATE_RECEIVE_DATA && c->stream) {
-        c->stream->feed_opened = 0;
-        close(c->feed_fd);
-    }
-
-    av_freep(&c->pb_buffer);
-    av_freep(&c->packet_buffer);
-    av_free(c->buffer);
-    av_free(c);
-    nb_connections--;
-}
-
-static int handle_connection(HTTPContext *c)
-{
-    int len, ret;
-
-    switch(c->state) {
-    case HTTPSTATE_WAIT_REQUEST:
-    case RTSPSTATE_WAIT_REQUEST:
-        /* timeout ? */
-        if ((c->timeout - cur_time) < 0)
-            return -1;
-        if (c->poll_entry->revents & (POLLERR | POLLHUP))
-            return -1;
-
-        /* no need to read if no events */
-        if (!(c->poll_entry->revents & POLLIN))
-            return 0;
-        /* read the data */
-    read_loop:
-        len = recv(c->fd, c->buffer_ptr, 1, 0);
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
-                return -1;
-        } else if (len == 0) {
-            return -1;
-        } else {
-            /* search for end of request. */
-            uint8_t *ptr;
-            c->buffer_ptr += len;
-            ptr = c->buffer_ptr;
-            if ((ptr >= c->buffer + 2 && !memcmp(ptr-2, "\n\n", 2)) ||
-                (ptr >= c->buffer + 4 && !memcmp(ptr-4, "\r\n\r\n", 4))) {
-                /* request found : parse it and reply */
-                if (c->state == HTTPSTATE_WAIT_REQUEST) {
-                    ret = http_parse_request(c);
-                } else {
-                    ret = rtsp_parse_request(c);
-                }
-                if (ret < 0)
-                    return -1;
-            } else if (ptr >= c->buffer_end) {
-                /* request too long: cannot do anything */
-                return -1;
-            } else goto read_loop;
-        }
-        break;
-
-    case HTTPSTATE_SEND_HEADER:
-        if (c->poll_entry->revents & (POLLERR | POLLHUP))
-            return -1;
-
-        /* no need to write if no events */
-        if (!(c->poll_entry->revents & POLLOUT))
-            return 0;
-        len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR)) {
-                /* error : close connection */
-                av_freep(&c->pb_buffer);
-                return -1;
-            }
-        } else {
-            c->buffer_ptr += len;
-            if (c->stream)
-                c->stream->bytes_served += len;
-            c->data_count += len;
-            if (c->buffer_ptr >= c->buffer_end) {
-                av_freep(&c->pb_buffer);
-                /* if error, exit */
-                if (c->http_error)
-                    return -1;
-                /* all the buffer was sent : synchronize to the incoming stream */
-                c->state = HTTPSTATE_SEND_DATA_HEADER;
-                c->buffer_ptr = c->buffer_end = c->buffer;
-            }
-        }
-        break;
-
-    case HTTPSTATE_SEND_DATA:
-    case HTTPSTATE_SEND_DATA_HEADER:
-    case HTTPSTATE_SEND_DATA_TRAILER:
-        /* for packetized output, we consider we can always write (the
-           input streams sets the speed). It may be better to verify
-           that we do not rely too much on the kernel queues */
-        if (!c->is_packetized) {
-            if (c->poll_entry->revents & (POLLERR | POLLHUP))
-                return -1;
-
-            /* no need to read if no events */
-            if (!(c->poll_entry->revents & POLLOUT))
-                return 0;
-        }
-        if (http_send_data(c) < 0)
-            return -1;
-        /* close connection if trailer sent */
-        if (c->state == HTTPSTATE_SEND_DATA_TRAILER)
-            return -1;
-        break;
-    case HTTPSTATE_RECEIVE_DATA:
-        /* no need to read if no events */
-        if (c->poll_entry->revents & (POLLERR | POLLHUP))
-            return -1;
-        if (!(c->poll_entry->revents & POLLIN))
-            return 0;
-        if (http_receive_data(c) < 0)
-            return -1;
-        break;
-    case HTTPSTATE_WAIT_FEED:
-        /* no need to read if no events */
-        if (c->poll_entry->revents & (POLLIN | POLLERR | POLLHUP))
-            return -1;
-
-        /* nothing to do, we'll be waken up by incoming feed packets */
-        break;
-
-    case RTSPSTATE_SEND_REPLY:
-        if (c->poll_entry->revents & (POLLERR | POLLHUP)) {
-            av_freep(&c->pb_buffer);
-            return -1;
-        }
-        /* no need to write if no events */
-        if (!(c->poll_entry->revents & POLLOUT))
-            return 0;
-        len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR)) {
-                /* error : close connection */
-                av_freep(&c->pb_buffer);
-                return -1;
-            }
-        } else {
-            c->buffer_ptr += len;
-            c->data_count += len;
-            if (c->buffer_ptr >= c->buffer_end) {
-                /* all the buffer was sent : wait for a new request */
-                av_freep(&c->pb_buffer);
-                start_wait_request(c, 1);
-            }
-        }
-        break;
-    case RTSPSTATE_SEND_PACKET:
-        if (c->poll_entry->revents & (POLLERR | POLLHUP)) {
-            av_freep(&c->packet_buffer);
-            return -1;
-        }
-        /* no need to write if no events */
-        if (!(c->poll_entry->revents & POLLOUT))
-            return 0;
-        len = send(c->fd, c->packet_buffer_ptr,
-                    c->packet_buffer_end - c->packet_buffer_ptr, 0);
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR)) {
-                /* error : close connection */
-                av_freep(&c->packet_buffer);
-                return -1;
-            }
-        } else {
-            c->packet_buffer_ptr += len;
-            if (c->packet_buffer_ptr >= c->packet_buffer_end) {
-                /* all the buffer was sent : wait for a new request */
-                av_freep(&c->packet_buffer);
-                c->state = RTSPSTATE_WAIT_REQUEST;
-            }
-        }
-        break;
-    case HTTPSTATE_READY:
-        /* nothing to do */
-        break;
-    default:
-        return -1;
-    }
-    return 0;
-}
-
-static int extract_rates(char *rates, int ratelen, const char *request)
-{
-    const char *p;
-
-    for (p = request; *p && *p != '\r' && *p != '\n'; ) {
-        if (strncasecmp(p, "Pragma:", 7) == 0) {
-            const char *q = p + 7;
-
-            while (*q && *q != '\n' && isspace(*q))
-                q++;
-
-            if (strncasecmp(q, "stream-switch-entry=", 20) == 0) {
-                int stream_no;
-                int rate_no;
-
-                q += 20;
-
-                memset(rates, 0xff, ratelen);
-
-                while (1) {
-                    while (*q && *q != '\n' && *q != ':')
-                        q++;
-
-                    if (sscanf(q, ":%d:%d", &stream_no, &rate_no) != 2)
-                        break;
-
-                    stream_no--;
-                    if (stream_no < ratelen && stream_no >= 0)
-                        rates[stream_no] = rate_no;
-
-                    while (*q && *q != '\n' && !isspace(*q))
-                        q++;
-                }
-
-                return 1;
-            }
-        }
-        p = strchr(p, '\n');
-        if (!p)
-            break;
-
-        p++;
-    }
-
-    return 0;
-}
-
-static int find_stream_in_feed(FFStream *feed, AVCodecContext *codec, int bit_rate)
-{
-    int i;
-    int best_bitrate = 100000000;
-    int best = -1;
-
-    for (i = 0; i < feed->nb_streams; i++) {
-        AVCodecContext *feed_codec = feed->streams[i]->codec;
-
-        if (feed_codec->codec_id != codec->codec_id ||
-            feed_codec->sample_rate != codec->sample_rate ||
-            feed_codec->width != codec->width ||
-            feed_codec->height != codec->height)
-            continue;
-
-        /* Potential stream */
-
-        /* We want the fastest stream less than bit_rate, or the slowest
-         * faster than bit_rate
-         */
-
-        if (feed_codec->bit_rate <= bit_rate) {
-            if (best_bitrate > bit_rate || feed_codec->bit_rate > best_bitrate) {
-                best_bitrate = feed_codec->bit_rate;
-                best = i;
-            }
-        } else {
-            if (feed_codec->bit_rate < best_bitrate) {
-                best_bitrate = feed_codec->bit_rate;
-                best = i;
-            }
-        }
-    }
-
-    return best;
-}
-
-static int modify_current_stream(HTTPContext *c, char *rates)
-{
-    int i;
-    FFStream *req = c->stream;
-    int action_required = 0;
-
-    /* Not much we can do for a feed */
-    if (!req->feed)
-        return 0;
-
-    for (i = 0; i < req->nb_streams; i++) {
-        AVCodecContext *codec = req->streams[i]->codec;
-
-        switch(rates[i]) {
-            case 0:
-                c->switch_feed_streams[i] = req->feed_streams[i];
-                break;
-            case 1:
-                c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 2);
-                break;
-            case 2:
-                /* Wants off or slow */
-                c->switch_feed_streams[i] = find_stream_in_feed(req->feed, codec, codec->bit_rate / 4);
-#ifdef WANTS_OFF
-                /* This doesn't work well when it turns off the only stream! */
-                c->switch_feed_streams[i] = -2;
-                c->feed_streams[i] = -2;
-#endif
-                break;
-        }
-
-        if (c->switch_feed_streams[i] >= 0 && c->switch_feed_streams[i] != c->feed_streams[i])
-            action_required = 1;
-    }
-
-    return action_required;
-}
-
-
-static void do_switch_stream(HTTPContext *c, int i)
-{
-    if (c->switch_feed_streams[i] >= 0) {
-#ifdef PHILIP
-        c->feed_streams[i] = c->switch_feed_streams[i];
-#endif
-
-        /* Now update the stream */
-    }
-    c->switch_feed_streams[i] = -1;
-}
-
-/* XXX: factorize in utils.c ? */
-/* XXX: take care with different space meaning */
-static void skip_spaces(const char **pp)
-{
-    const char *p;
-    p = *pp;
-    while (*p == ' ' || *p == '\t')
-        p++;
-    *pp = p;
-}
-
-static void get_word(char *buf, int buf_size, const char **pp)
-{
-    const char *p;
-    char *q;
-
-    p = *pp;
-    skip_spaces(&p);
-    q = buf;
-    while (!isspace(*p) && *p != '\0') {
-        if ((q - buf) < buf_size - 1)
-            *q++ = *p;
-        p++;
-    }
-    if (buf_size > 0)
-        *q = '\0';
-    *pp = p;
-}
-
-static void get_arg(char *buf, int buf_size, const char **pp)
-{
-    const char *p;
-    char *q;
-    int quote;
-
-    p = *pp;
-    while (isspace(*p)) p++;
-    q = buf;
-    quote = 0;
-    if (*p == '\"' || *p == '\'')
-        quote = *p++;
-    for(;;) {
-        if (quote) {
-            if (*p == quote)
-                break;
-        } else {
-            if (isspace(*p))
-                break;
-        }
-        if (*p == '\0')
-            break;
-        if ((q - buf) < buf_size - 1)
-            *q++ = *p;
-        p++;
-    }
-    *q = '\0';
-    if (quote && *p == quote)
-        p++;
-    *pp = p;
-}
-
-static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_acl,
-                         const char *p, const char *filename, int line_num)
-{
-    char arg[1024];
-    IPAddressACL acl;
-    int errors = 0;
-
-    get_arg(arg, sizeof(arg), &p);
-    if (strcasecmp(arg, "allow") == 0)
-        acl.action = IP_ALLOW;
-    else if (strcasecmp(arg, "deny") == 0)
-        acl.action = IP_DENY;
-    else {
-        fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n",
-                filename, line_num, arg);
-        errors++;
-    }
-
-    get_arg(arg, sizeof(arg), &p);
-
-    if (resolve_host(&acl.first, arg) != 0) {
-        fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
-                filename, line_num, arg);
-        errors++;
-    } else
-        acl.last = acl.first;
-
-    get_arg(arg, sizeof(arg), &p);
-
-    if (arg[0]) {
-        if (resolve_host(&acl.last, arg) != 0) {
-            fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n",
-                    filename, line_num, arg);
-            errors++;
-        }
-    }
-
-    if (!errors) {
-        IPAddressACL *nacl = av_mallocz(sizeof(*nacl));
-        IPAddressACL **naclp = 0;
-
-        acl.next = 0;
-        *nacl = acl;
-
-        if (stream)
-            naclp = &stream->acl;
-        else if (feed)
-            naclp = &feed->acl;
-        else if (ext_acl)
-            naclp = &ext_acl;
-        else {
-            fprintf(stderr, "%s:%d: ACL found not in <stream> or <feed>\n",
-                    filename, line_num);
-            errors++;
-        }
-
-        if (naclp) {
-            while (*naclp)
-                naclp = &(*naclp)->next;
-
-            *naclp = nacl;
-        }
-    }
-}
-
-
-static IPAddressACL* parse_dynamic_acl(FFStream *stream, HTTPContext *c)
-{
-    FILE* f;
-    char line[1024];
-    char  cmd[1024];
-    IPAddressACL *acl = NULL;
-    int line_num = 0;
-    const char *p;
-
-    f = fopen(stream->dynamic_acl, "r");
-    if (!f) {
-        perror(stream->dynamic_acl);
-        return NULL;
-    }
-
-    acl = av_mallocz(sizeof(IPAddressACL));
-
-    /* Build ACL */
-    for(;;) {
-        if (fgets(line, sizeof(line), f) == NULL)
-            break;
-        line_num++;
-        p = line;
-        while (isspace(*p))
-            p++;
-        if (*p == '\0' || *p == '#')
-            continue;
-        get_arg(cmd, sizeof(cmd), &p);
-
-        if (!strcasecmp(cmd, "ACL"))
-            parse_acl_row(NULL, NULL, acl, p, stream->dynamic_acl, line_num);
-    }
-    fclose(f);
-    return acl;
-}
-
-
-static void free_acl_list(IPAddressACL *in_acl)
-{
-    IPAddressACL *pacl,*pacl2;
-
-    pacl = in_acl;
-    while(pacl) {
-        pacl2 = pacl;
-        pacl = pacl->next;
-        av_freep(pacl2);
-    }
-}
-
-static int validate_acl_list(IPAddressACL *in_acl, HTTPContext *c)
-{
-    enum IPAddressAction last_action = IP_DENY;
-    IPAddressACL *acl;
-    struct in_addr *src = &c->from_addr.sin_addr;
-    unsigned long src_addr = src->s_addr;
-
-    for (acl = in_acl; acl; acl = acl->next) {
-        if (src_addr >= acl->first.s_addr && src_addr <= acl->last.s_addr)
-            return (acl->action == IP_ALLOW) ? 1 : 0;
-        last_action = acl->action;
-    }
-
-    /* Nothing matched, so return not the last action */
-    return (last_action == IP_DENY) ? 1 : 0;
-}
-
-static int validate_acl(FFStream *stream, HTTPContext *c)
-{
-    int ret = 0;
-    IPAddressACL *acl;
-
-
-    /* if stream->acl is null validate_acl_list will return 1 */
-    ret = validate_acl_list(stream->acl, c);
-
-    if (stream->dynamic_acl[0]) {
-        acl = parse_dynamic_acl(stream, c);
-
-        ret = validate_acl_list(acl, c);
-
-        free_acl_list(acl);
-    }
-
-    return ret;
-}
-
-/* compute the real filename of a file by matching it without its
-   extensions to all the stream filenames */
-static void compute_real_filename(char *filename, int max_size)
-{
-    char file1[1024];
-    char file2[1024];
-    char *p;
-    FFStream *stream;
-
-    /* compute filename by matching without the file extensions */
-    av_strlcpy(file1, filename, sizeof(file1));
-    p = strrchr(file1, '.');
-    if (p)
-        *p = '\0';
-    for(stream = first_stream; stream != NULL; stream = stream->next) {
-        av_strlcpy(file2, stream->filename, sizeof(file2));
-        p = strrchr(file2, '.');
-        if (p)
-            *p = '\0';
-        if (!strcmp(file1, file2)) {
-            av_strlcpy(filename, stream->filename, max_size);
-            break;
-        }
-    }
-}
-
-enum RedirType {
-    REDIR_NONE,
-    REDIR_ASX,
-    REDIR_RAM,
-    REDIR_ASF,
-    REDIR_RTSP,
-    REDIR_SDP,
-};
-
-/* parse http request and prepare header */
-static int http_parse_request(HTTPContext *c)
-{
-    char *p;
-    enum RedirType redir_type;
-    char cmd[32];
-    char info[1024], filename[1024];
-    char url[1024], *q;
-    char protocol[32];
-    char msg[1024];
-    const char *mime_type;
-    FFStream *stream;
-    int i;
-    char ratebuf[32];
-    char *useragent = 0;
-
-    p = c->buffer;
-    get_word(cmd, sizeof(cmd), (const char **)&p);
-    av_strlcpy(c->method, cmd, sizeof(c->method));
-
-    if (!strcmp(cmd, "GET"))
-        c->post = 0;
-    else if (!strcmp(cmd, "POST"))
-        c->post = 1;
-    else
-        return -1;
-
-    get_word(url, sizeof(url), (const char **)&p);
-    av_strlcpy(c->url, url, sizeof(c->url));
-
-    get_word(protocol, sizeof(protocol), (const char **)&p);
-    if (strcmp(protocol, "HTTP/1.0") && strcmp(protocol, "HTTP/1.1"))
-        return -1;
-
-    av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
-
-    if (ffserver_debug)
-        http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url);
-
-    /* find the filename and the optional info string in the request */
-    p = strchr(url, '?');
-    if (p) {
-        av_strlcpy(info, p, sizeof(info));
-        *p = '\0';
-    } else
-        info[0] = '\0';
-
-    av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
-
-    for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
-        if (strncasecmp(p, "User-Agent:", 11) == 0) {
-            useragent = p + 11;
-            if (*useragent && *useragent != '\n' && isspace(*useragent))
-                useragent++;
-            break;
-        }
-        p = strchr(p, '\n');
-        if (!p)
-            break;
-
-        p++;
-    }
-
-    redir_type = REDIR_NONE;
-    if (av_match_ext(filename, "asx")) {
-        redir_type = REDIR_ASX;
-        filename[strlen(filename)-1] = 'f';
-    } else if (av_match_ext(filename, "asf") &&
-        (!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) {
-        /* if this isn't WMP or lookalike, return the redirector file */
-        redir_type = REDIR_ASF;
-    } else if (av_match_ext(filename, "rpm,ram")) {
-        redir_type = REDIR_RAM;
-        strcpy(filename + strlen(filename)-2, "m");
-    } else if (av_match_ext(filename, "rtsp")) {
-        redir_type = REDIR_RTSP;
-        compute_real_filename(filename, sizeof(filename) - 1);
-    } else if (av_match_ext(filename, "sdp")) {
-        redir_type = REDIR_SDP;
-        compute_real_filename(filename, sizeof(filename) - 1);
-    }
-
-    // "redirect" / request to index.html
-    if (!strlen(filename))
-        av_strlcpy(filename, "index.html", sizeof(filename) - 1);
-
-    stream = first_stream;
-    while (stream != NULL) {
-        if (!strcmp(stream->filename, filename) && validate_acl(stream, c))
-            break;
-        stream = stream->next;
-    }
-    if (stream == NULL) {
-        snprintf(msg, sizeof(msg), "File '%s' not found", url);
-        http_log("File '%s' not found\n", url);
-        goto send_error;
-    }
-
-    c->stream = stream;
-    memcpy(c->feed_streams, stream->feed_streams, sizeof(c->feed_streams));
-    memset(c->switch_feed_streams, -1, sizeof(c->switch_feed_streams));
-
-    if (stream->stream_type == STREAM_TYPE_REDIRECT) {
-        c->http_error = 301;
-        q = c->buffer;
-        q += snprintf(q, c->buffer_size,
-                      "HTTP/1.0 301 Moved\r\n"
-                      "Location: %s\r\n"
-                      "Content-type: text/html\r\n"
-                      "\r\n"
-                      "<html><head><title>Moved</title></head><body>\r\n"
-                      "You should be <a href=\"%s\">redirected</a>.\r\n"
-                      "</body></html>\r\n", stream->feed_filename, stream->feed_filename);
-        /* prepare output buffer */
-        c->buffer_ptr = c->buffer;
-        c->buffer_end = q;
-        c->state = HTTPSTATE_SEND_HEADER;
-        return 0;
-    }
-
-    /* If this is WMP, get the rate information */
-    if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
-        if (modify_current_stream(c, ratebuf)) {
-            for (i = 0; i < FF_ARRAY_ELEMS(c->feed_streams); i++) {
-                if (c->switch_feed_streams[i] >= 0)
-                    do_switch_stream(c, i);
-            }
-        }
-    }
-
-    if (c->post == 0 && stream->stream_type == STREAM_TYPE_LIVE)
-        current_bandwidth += stream->bandwidth;
-
-    /* If already streaming this feed, do not let start another feeder. */
-    if (stream->feed_opened) {
-        snprintf(msg, sizeof(msg), "This feed is already being received.");
-        http_log("Feed '%s' already being received\n", stream->feed_filename);
-        goto send_error;
-    }
-
-    if (c->post == 0 && max_bandwidth < current_bandwidth) {
-        c->http_error = 200;
-        q = c->buffer;
-        q += snprintf(q, c->buffer_size,
-                      "HTTP/1.0 200 Server too busy\r\n"
-                      "Content-type: text/html\r\n"
-                      "\r\n"
-                      "<html><head><title>Too busy</title></head><body>\r\n"
-                      "<p>The server is too busy to serve your request at this time.</p>\r\n"
-                      "<p>The bandwidth being served (including your stream) is %"PRIu64"kbit/sec, "
-                      "and this exceeds the limit of %"PRIu64"kbit/sec.</p>\r\n"
-                      "</body></html>\r\n", current_bandwidth, max_bandwidth);
-        /* prepare output buffer */
-        c->buffer_ptr = c->buffer;
-        c->buffer_end = q;
-        c->state = HTTPSTATE_SEND_HEADER;
-        return 0;
-    }
-
-    if (redir_type != REDIR_NONE) {
-        char *hostinfo = 0;
-
-        for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
-            if (strncasecmp(p, "Host:", 5) == 0) {
-                hostinfo = p + 5;
-                break;
-            }
-            p = strchr(p, '\n');
-            if (!p)
-                break;
-
-            p++;
-        }
-
-        if (hostinfo) {
-            char *eoh;
-            char hostbuf[260];
-
-            while (isspace(*hostinfo))
-                hostinfo++;
-
-            eoh = strchr(hostinfo, '\n');
-            if (eoh) {
-                if (eoh[-1] == '\r')
-                    eoh--;
-
-                if (eoh - hostinfo < sizeof(hostbuf) - 1) {
-                    memcpy(hostbuf, hostinfo, eoh - hostinfo);
-                    hostbuf[eoh - hostinfo] = 0;
-
-                    c->http_error = 200;
-                    q = c->buffer;
-                    switch(redir_type) {
-                    case REDIR_ASX:
-                        q += snprintf(q, c->buffer_size,
-                                      "HTTP/1.0 200 ASX Follows\r\n"
-                                      "Content-type: video/x-ms-asf\r\n"
-                                      "\r\n"
-                                      "<ASX Version=\"3\">\r\n"
-                                      //"<!-- Autogenerated by ffserver -->\r\n"
-                                      "<ENTRY><REF HREF=\"http://%s/%s%s\"/></ENTRY>\r\n"
-                                      "</ASX>\r\n", hostbuf, filename, info);
-                        break;
-                    case REDIR_RAM:
-                        q += snprintf(q, c->buffer_size,
-                                      "HTTP/1.0 200 RAM Follows\r\n"
-                                      "Content-type: audio/x-pn-realaudio\r\n"
-                                      "\r\n"
-                                      "# Autogenerated by ffserver\r\n"
-                                      "http://%s/%s%s\r\n", hostbuf, filename, info);
-                        break;
-                    case REDIR_ASF:
-                        q += snprintf(q, c->buffer_size,
-                                      "HTTP/1.0 200 ASF Redirect follows\r\n"
-                                      "Content-type: video/x-ms-asf\r\n"
-                                      "\r\n"
-                                      "[Reference]\r\n"
-                                      "Ref1=http://%s/%s%s\r\n", hostbuf, filename, info);
-                        break;
-                    case REDIR_RTSP:
-                        {
-                            char hostname[256], *p;
-                            /* extract only hostname */
-                            av_strlcpy(hostname, hostbuf, sizeof(hostname));
-                            p = strrchr(hostname, ':');
-                            if (p)
-                                *p = '\0';
-                            q += snprintf(q, c->buffer_size,
-                                          "HTTP/1.0 200 RTSP Redirect follows\r\n"
-                                          /* XXX: incorrect mime type ? */
-                                          "Content-type: application/x-rtsp\r\n"
-                                          "\r\n"
-                                          "rtsp://%s:%d/%s\r\n", hostname, ntohs(my_rtsp_addr.sin_port), filename);
-                        }
-                        break;
-                    case REDIR_SDP:
-                        {
-                            uint8_t *sdp_data;
-                            int sdp_data_size, len;
-                            struct sockaddr_in my_addr;
-
-                            q += snprintf(q, c->buffer_size,
-                                          "HTTP/1.0 200 OK\r\n"
-                                          "Content-type: application/sdp\r\n"
-                                          "\r\n");
-
-                            len = sizeof(my_addr);
-                            getsockname(c->fd, (struct sockaddr *)&my_addr, &len);
-
-                            /* XXX: should use a dynamic buffer */
-                            sdp_data_size = prepare_sdp_description(stream,
-                                                                    &sdp_data,
-                                                                    my_addr.sin_addr);
-                            if (sdp_data_size > 0) {
-                                memcpy(q, sdp_data, sdp_data_size);
-                                q += sdp_data_size;
-                                *q = '\0';
-                                av_free(sdp_data);
-                            }
-                        }
-                        break;
-                    default:
-                        abort();
-                        break;
-                    }
-
-                    /* prepare output buffer */
-                    c->buffer_ptr = c->buffer;
-                    c->buffer_end = q;
-                    c->state = HTTPSTATE_SEND_HEADER;
-                    return 0;
-                }
-            }
-        }
-
-        snprintf(msg, sizeof(msg), "ASX/RAM file not handled");
-        goto send_error;
-    }
-
-    stream->conns_served++;
-
-    /* XXX: add there authenticate and IP match */
-
-    if (c->post) {
-        /* if post, it means a feed is being sent */
-        if (!stream->is_feed) {
-            /* However it might be a status report from WMP! Let us log the
-             * data as it might come in handy one day. */
-            char *logline = 0;
-            int client_id = 0;
-
-            for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
-                if (strncasecmp(p, "Pragma: log-line=", 17) == 0) {
-                    logline = p;
-                    break;
-                }
-                if (strncasecmp(p, "Pragma: client-id=", 18) == 0)
-                    client_id = strtol(p + 18, 0, 10);
-                p = strchr(p, '\n');
-                if (!p)
-                    break;
-
-                p++;
-            }
-
-            if (logline) {
-                char *eol = strchr(logline, '\n');
-
-                logline += 17;
-
-                if (eol) {
-                    if (eol[-1] == '\r')
-                        eol--;
-                    http_log("%.*s\n", (int) (eol - logline), logline);
-                    c->suppress_log = 1;
-                }
-            }
-
-#ifdef DEBUG_WMP
-            http_log("\nGot request:\n%s\n", c->buffer);
-#endif
-
-            if (client_id && extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
-                HTTPContext *wmpc;
-
-                /* Now we have to find the client_id */
-                for (wmpc = first_http_ctx; wmpc; wmpc = wmpc->next) {
-                    if (wmpc->wmp_client_id == client_id)
-                        break;
-                }
-
-                if (wmpc && modify_current_stream(wmpc, ratebuf))
-                    wmpc->switch_pending = 1;
-            }
-
-            snprintf(msg, sizeof(msg), "POST command not handled");
-            c->stream = 0;
-            goto send_error;
-        }
-        if (http_start_receive_data(c) < 0) {
-            snprintf(msg, sizeof(msg), "could not open feed");
-            goto send_error;
-        }
-        c->http_error = 0;
-        c->state = HTTPSTATE_RECEIVE_DATA;
-        return 0;
-    }
-
-#ifdef DEBUG_WMP
-    if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0)
-        http_log("\nGot request:\n%s\n", c->buffer);
-#endif
-
-    if (c->stream->stream_type == STREAM_TYPE_STATUS)
-        goto send_status;
-
-    /* open input stream */
-    if (open_input_stream(c, info) < 0) {
-        snprintf(msg, sizeof(msg), "Input stream corresponding to '%s' not found", url);
-        goto send_error;
-    }
-
-    /* prepare http header */
-    q = c->buffer;
-    q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n");
-    mime_type = c->stream->fmt->mime_type;
-    if (!mime_type)
-        mime_type = "application/x-octet-stream";
-    q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Pragma: no-cache\r\n");
-
-    /* for asf, we need extra headers */
-    if (!strcmp(c->stream->fmt->name,"asf_stream")) {
-        /* Need to allocate a client id */
-
-        c->wmp_client_id = av_lfg_get(&random_state);
-
-        q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id);
-    }
-    q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-Type: %s\r\n", mime_type);
-    q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
-
-    /* prepare output buffer */
-    c->http_error = 0;
-    c->buffer_ptr = c->buffer;
-    c->buffer_end = q;
-    c->state = HTTPSTATE_SEND_HEADER;
-    return 0;
- send_error:
-    c->http_error = 404;
-    q = c->buffer;
-    q += snprintf(q, c->buffer_size,
-                  "HTTP/1.0 404 Not Found\r\n"
-                  "Content-type: text/html\r\n"
-                  "\r\n"
-                  "<html>\n"
-                  "<head><title>404 Not Found</title></head>\n"
-                  "<body>%s</body>\n"
-                  "</html>\n", msg);
-    /* prepare output buffer */
-    c->buffer_ptr = c->buffer;
-    c->buffer_end = q;
-    c->state = HTTPSTATE_SEND_HEADER;
-    return 0;
- send_status:
-    compute_status(c);
-    c->http_error = 200; /* horrible : we use this value to avoid
-                            going to the send data state */
-    c->state = HTTPSTATE_SEND_HEADER;
-    return 0;
-}
-
-static void fmt_bytecount(ByteIOContext *pb, int64_t count)
-{
-    static const char *suffix = " kMGTP";
-    const char *s;
-
-    for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++);
-
-    url_fprintf(pb, "%"PRId64"%c", count, *s);
-}
-
-static void compute_status(HTTPContext *c)
-{
-    HTTPContext *c1;
-    FFStream *stream;
-    char *p;
-    time_t ti;
-    int i, len;
-    ByteIOContext *pb;
-
-    if (url_open_dyn_buf(&pb) < 0) {
-        /* XXX: return an error ? */
-        c->buffer_ptr = c->buffer;
-        c->buffer_end = c->buffer;
-        return;
-    }
-
-    url_fprintf(pb, "HTTP/1.0 200 OK\r\n");
-    url_fprintf(pb, "Content-type: %s\r\n", "text/html");
-    url_fprintf(pb, "Pragma: no-cache\r\n");
-    url_fprintf(pb, "\r\n");
-
-    url_fprintf(pb, "<html><head><title>%s Status</title>\n", program_name);
-    if (c->stream->feed_filename[0])
-        url_fprintf(pb, "<link rel=\"shortcut icon\" href=\"%s\">\n", c->stream->feed_filename);
-    url_fprintf(pb, "</head>\n<body>");
-    url_fprintf(pb, "<h1>%s Status</h1>\n", program_name);
-    /* format status */
-    url_fprintf(pb, "<h2>Available Streams</h2>\n");
-    url_fprintf(pb, "<table cellspacing=0 cellpadding=4>\n");
-    url_fprintf(pb, "<tr><th valign=top>Path<th align=left>Served<br>Conns<th><br>bytes<th valign=top>Format<th>Bit rate<br>kbits/s<th align=left>Video<br>kbits/s<th><br>Codec<th align=left>Audio<br>kbits/s<th><br>Codec<th align=left valign=top>Feed\n");
-    stream = first_stream;
-    while (stream != NULL) {
-        char sfilename[1024];
-        char *eosf;
-
-        if (stream->feed != stream) {
-            av_strlcpy(sfilename, stream->filename, sizeof(sfilename) - 10);
-            eosf = sfilename + strlen(sfilename);
-            if (eosf - sfilename >= 4) {
-                if (strcmp(eosf - 4, ".asf") == 0)
-                    strcpy(eosf - 4, ".asx");
-                else if (strcmp(eosf - 3, ".rm") == 0)
-                    strcpy(eosf - 3, ".ram");
-                else if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
-                    /* generate a sample RTSP director if
-                       unicast. Generate an SDP redirector if
-                       multicast */
-                    eosf = strrchr(sfilename, '.');
-                    if (!eosf)
-                        eosf = sfilename + strlen(sfilename);
-                    if (stream->is_multicast)
-                        strcpy(eosf, ".sdp");
-                    else
-                        strcpy(eosf, ".rtsp");
-                }
-            }
-
-            url_fprintf(pb, "<tr><td><a href=\"/%s\">%s</a> ",
-                         sfilename, stream->filename);
-            url_fprintf(pb, "<td align=right> %d <td align=right> ",
-                        stream->conns_served);
-            fmt_bytecount(pb, stream->bytes_served);
-            switch(stream->stream_type) {
-            case STREAM_TYPE_LIVE: {
-                    int audio_bit_rate = 0;
-                    int video_bit_rate = 0;
-                    const char *audio_codec_name = "";
-                    const char *video_codec_name = "";
-                    const char *audio_codec_name_extra = "";
-                    const char *video_codec_name_extra = "";
-
-                    for(i=0;i<stream->nb_streams;i++) {
-                        AVStream *st = stream->streams[i];
-                        AVCodec *codec = avcodec_find_encoder(st->codec->codec_id);
-                        switch(st->codec->codec_type) {
-                        case AVMEDIA_TYPE_AUDIO:
-                            audio_bit_rate += st->codec->bit_rate;
-                            if (codec) {
-                                if (*audio_codec_name)
-                                    audio_codec_name_extra = "...";
-                                audio_codec_name = codec->name;
-                            }
-                            break;
-                        case AVMEDIA_TYPE_VIDEO:
-                            video_bit_rate += st->codec->bit_rate;
-                            if (codec) {
-                                if (*video_codec_name)
-                                    video_codec_name_extra = "...";
-                                video_codec_name = codec->name;
-                            }
-                            break;
-                        case AVMEDIA_TYPE_DATA:
-                            video_bit_rate += st->codec->bit_rate;
-                            break;
-                        default:
-                            abort();
-                        }
-                    }
-                    url_fprintf(pb, "<td align=center> %s <td align=right> %d <td align=right> %d <td> %s %s <td align=right> %d <td> %s %s",
-                                 stream->fmt->name,
-                                 stream->bandwidth,
-                                 video_bit_rate / 1000, video_codec_name, video_codec_name_extra,
-                                 audio_bit_rate / 1000, audio_codec_name, audio_codec_name_extra);
-                    if (stream->feed)
-                        url_fprintf(pb, "<td>%s", stream->feed->filename);
-                    else
-                        url_fprintf(pb, "<td>%s", stream->feed_filename);
-                    url_fprintf(pb, "\n");
-                }
-                break;
-            default:
-                url_fprintf(pb, "<td align=center> - <td align=right> - <td align=right> - <td><td align=right> - <td>\n");
-                break;
-            }
-        }
-        stream = stream->next;
-    }
-    url_fprintf(pb, "</table>\n");
-
-    stream = first_stream;
-    while (stream != NULL) {
-        if (stream->feed == stream) {
-            url_fprintf(pb, "<h2>Feed %s</h2>", stream->filename);
-            if (stream->pid) {
-                url_fprintf(pb, "Running as pid %d.\n", stream->pid);
-
-#if defined(linux) && !defined(CONFIG_NOCUTILS)
-                {
-                    FILE *pid_stat;
-                    char ps_cmd[64];
-
-                    /* This is somewhat linux specific I guess */
-                    snprintf(ps_cmd, sizeof(ps_cmd),
-                             "ps -o \"%%cpu,cputime\" --no-headers %d",
-                             stream->pid);
-
-                    pid_stat = popen(ps_cmd, "r");
-                    if (pid_stat) {
-                        char cpuperc[10];
-                        char cpuused[64];
-
-                        if (fscanf(pid_stat, "%10s %64s", cpuperc,
-                                   cpuused) == 2) {
-                            url_fprintf(pb, "Currently using %s%% of the cpu. Total time used %s.\n",
-                                         cpuperc, cpuused);
-                        }
-                        fclose(pid_stat);
-                    }
-                }
-#endif
-
-                url_fprintf(pb, "<p>");
-            }
-            url_fprintf(pb, "<table cellspacing=0 cellpadding=4><tr><th>Stream<th>type<th>kbits/s<th align=left>codec<th align=left>Parameters\n");
-
-            for (i = 0; i < stream->nb_streams; i++) {
-                AVStream *st = stream->streams[i];
-                AVCodec *codec = avcodec_find_encoder(st->codec->codec_id);
-                const char *type = "unknown";
-                char parameters[64];
-
-                parameters[0] = 0;
-
-                switch(st->codec->codec_type) {
-                case AVMEDIA_TYPE_AUDIO:
-                    type = "audio";
-                    snprintf(parameters, sizeof(parameters), "%d channel(s), %d Hz", st->codec->channels, st->codec->sample_rate);
-                    break;
-                case AVMEDIA_TYPE_VIDEO:
-                    type = "video";
-                    snprintf(parameters, sizeof(parameters), "%dx%d, q=%d-%d, fps=%d", st->codec->width, st->codec->height,
-                                st->codec->qmin, st->codec->qmax, st->codec->time_base.den / st->codec->time_base.num);
-                    break;
-                default:
-                    abort();
-                }
-                url_fprintf(pb, "<tr><td align=right>%d<td>%s<td align=right>%d<td>%s<td>%s\n",
-                        i, type, st->codec->bit_rate/1000, codec ? codec->name : "", parameters);
-            }
-            url_fprintf(pb, "</table>\n");
-
-        }
-        stream = stream->next;
-    }
-
-    /* connection status */
-    url_fprintf(pb, "<h2>Connection Status</h2>\n");
-
-    url_fprintf(pb, "Number of connections: %d / %d<br>\n",
-                 nb_connections, nb_max_connections);
-
-    url_fprintf(pb, "Bandwidth in use: %"PRIu64"k / %"PRIu64"k<br>\n",
-                 current_bandwidth, max_bandwidth);
-
-    url_fprintf(pb, "<table>\n");
-    url_fprintf(pb, "<tr><th>#<th>File<th>IP<th>Proto<th>State<th>Target bits/sec<th>Actual bits/sec<th>Bytes transferred\n");
-    c1 = first_http_ctx;
-    i = 0;
-    while (c1 != NULL) {
-        int bitrate;
-        int j;
-
-        bitrate = 0;
-        if (c1->stream) {
-            for (j = 0; j < c1->stream->nb_streams; j++) {
-                if (!c1->stream->feed)
-                    bitrate += c1->stream->streams[j]->codec->bit_rate;
-                else if (c1->feed_streams[j] >= 0)
-                    bitrate += c1->stream->feed->streams[c1->feed_streams[j]]->codec->bit_rate;
-            }
-        }
-
-        i++;
-        p = inet_ntoa(c1->from_addr.sin_addr);
-        url_fprintf(pb, "<tr><td><b>%d</b><td>%s%s<td>%s<td>%s<td>%s<td align=right>",
-                    i,
-                    c1->stream ? c1->stream->filename : "",
-                    c1->state == HTTPSTATE_RECEIVE_DATA ? "(input)" : "",
-                    p,
-                    c1->protocol,
-                    http_state[c1->state]);
-        fmt_bytecount(pb, bitrate);
-        url_fprintf(pb, "<td align=right>");
-        fmt_bytecount(pb, compute_datarate(&c1->datarate, c1->data_count) * 8);
-        url_fprintf(pb, "<td align=right>");
-        fmt_bytecount(pb, c1->data_count);
-        url_fprintf(pb, "\n");
-        c1 = c1->next;
-    }
-    url_fprintf(pb, "</table>\n");
-
-    /* date */
-    ti = time(NULL);
-    p = ctime(&ti);
-    url_fprintf(pb, "<hr size=1 noshade>Generated at %s", p);
-    url_fprintf(pb, "</body>\n</html>\n");
-
-    len = url_close_dyn_buf(pb, &c->pb_buffer);
-    c->buffer_ptr = c->pb_buffer;
-    c->buffer_end = c->pb_buffer + len;
-}
-
-/* check if the parser needs to be opened for stream i */
-static void open_parser(AVFormatContext *s, int i)
-{
-    AVStream *st = s->streams[i];
-    AVCodec *codec;
-
-    if (!st->codec->codec) {
-        codec = avcodec_find_decoder(st->codec->codec_id);
-        if (codec && (codec->capabilities & CODEC_CAP_PARSE_ONLY)) {
-            st->codec->parse_only = 1;
-            if (avcodec_open(st->codec, codec) < 0)
-                st->codec->parse_only = 0;
-        }
-    }
-}
-
-static int open_input_stream(HTTPContext *c, const char *info)
-{
-    char buf[128];
-    char input_filename[1024];
-    AVFormatContext *s;
-    int buf_size, i, ret;
-    int64_t stream_pos;
-
-    /* find file name */
-    if (c->stream->feed) {
-        strcpy(input_filename, c->stream->feed->feed_filename);
-        buf_size = FFM_PACKET_SIZE;
-        /* compute position (absolute time) */
-        if (find_info_tag(buf, sizeof(buf), "date", info)) {
-            stream_pos = parse_date(buf, 0);
-            if (stream_pos == INT64_MIN)
-                return -1;
-        } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
-            int prebuffer = strtol(buf, 0, 10);
-            stream_pos = av_gettime() - prebuffer * (int64_t)1000000;
-        } else
-            stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000;
-    } else {
-        strcpy(input_filename, c->stream->feed_filename);
-        buf_size = 0;
-        /* compute position (relative time) */
-        if (find_info_tag(buf, sizeof(buf), "date", info)) {
-            stream_pos = parse_date(buf, 1);
-            if (stream_pos == INT64_MIN)
-                return -1;
-        } else
-            stream_pos = 0;
-    }
-    if (input_filename[0] == '\0')
-        return -1;
-
-    /* open stream */
-    if ((ret = av_open_input_file(&s, input_filename, c->stream->ifmt,
-                                  buf_size, c->stream->ap_in)) < 0) {
-        http_log("could not open %s: %d\n", input_filename, ret);
-        return -1;
-    }
-    s->flags |= AVFMT_FLAG_GENPTS;
-    c->fmt_in = s;
-    if (strcmp(s->iformat->name, "ffm") && av_find_stream_info(c->fmt_in) < 0) {
-        http_log("Could not find stream info '%s'\n", input_filename);
-        av_close_input_file(s);
-        return -1;
-    }
-
-    /* open each parser */
-    for(i=0;i<s->nb_streams;i++)
-        open_parser(s, i);
-
-    /* choose stream as clock source (we favorize video stream if
-       present) for packet sending */
-    c->pts_stream_index = 0;
-    for(i=0;i<c->stream->nb_streams;i++) {
-        if (c->pts_stream_index == 0 &&
-            c->stream->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            c->pts_stream_index = i;
-        }
-    }
-
-#if 1
-    if (c->fmt_in->iformat->read_seek)
-        av_seek_frame(c->fmt_in, -1, stream_pos, 0);
-#endif
-    /* set the start time (needed for maxtime and RTP packet timing) */
-    c->start_time = cur_time;
-    c->first_pts = AV_NOPTS_VALUE;
-    return 0;
-}
-
-/* return the server clock (in us) */
-static int64_t get_server_clock(HTTPContext *c)
-{
-    /* compute current pts value from system time */
-    return (cur_time - c->start_time) * 1000;
-}
-
-/* return the estimated time at which the current packet must be sent
-   (in us) */
-static int64_t get_packet_send_clock(HTTPContext *c)
-{
-    int bytes_left, bytes_sent, frame_bytes;
-
-    frame_bytes = c->cur_frame_bytes;
-    if (frame_bytes <= 0)
-        return c->cur_pts;
-    else {
-        bytes_left = c->buffer_end - c->buffer_ptr;
-        bytes_sent = frame_bytes - bytes_left;
-        return c->cur_pts + (c->cur_frame_duration * bytes_sent) / frame_bytes;
-    }
-}
-
-
-static int http_prepare_data(HTTPContext *c)
-{
-    int i, len, ret;
-    AVFormatContext *ctx;
-
-    av_freep(&c->pb_buffer);
-    switch(c->state) {
-    case HTTPSTATE_SEND_DATA_HEADER:
-        memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx));
-        av_metadata_set2(&c->fmt_ctx.metadata, "author"   , c->stream->author   , 0);
-        av_metadata_set2(&c->fmt_ctx.metadata, "comment"  , c->stream->comment  , 0);
-        av_metadata_set2(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0);
-        av_metadata_set2(&c->fmt_ctx.metadata, "title"    , c->stream->title    , 0);
-
-        for(i=0;i<c->stream->nb_streams;i++) {
-            AVStream *st;
-            AVStream *src;
-            st = av_mallocz(sizeof(AVStream));
-            c->fmt_ctx.streams[i] = st;
-            /* if file or feed, then just take streams from FFStream struct */
-            if (!c->stream->feed ||
-                c->stream->feed == c->stream)
-                src = c->stream->streams[i];
-            else
-                src = c->stream->feed->streams[c->stream->feed_streams[i]];
-
-            *st = *src;
-            st->priv_data = 0;
-            st->codec->frame_number = 0; /* XXX: should be done in
-                                           AVStream, not in codec */
-        }
-        /* set output format parameters */
-        c->fmt_ctx.oformat = c->stream->fmt;
-        c->fmt_ctx.nb_streams = c->stream->nb_streams;
-
-        c->got_key_frame = 0;
-
-        /* prepare header and save header data in a stream */
-        if (url_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
-            /* XXX: potential leak */
-            return -1;
-        }
-        c->fmt_ctx.pb->is_streamed = 1;
-
-        /*
-         * HACK to avoid mpeg ps muxer to spit many underflow errors
-         * Default value from FFmpeg
-         * Try to set it use configuration option
-         */
-        c->fmt_ctx.preload   = (int)(0.5*AV_TIME_BASE);
-        c->fmt_ctx.max_delay = (int)(0.7*AV_TIME_BASE);
-
-        av_set_parameters(&c->fmt_ctx, NULL);
-        if (av_write_header(&c->fmt_ctx) < 0) {
-            http_log("Error writing output header\n");
-            return -1;
-        }
-        av_metadata_free(&c->fmt_ctx.metadata);
-
-        len = url_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
-        c->buffer_ptr = c->pb_buffer;
-        c->buffer_end = c->pb_buffer + len;
-
-        c->state = HTTPSTATE_SEND_DATA;
-        c->last_packet_sent = 0;
-        break;
-    case HTTPSTATE_SEND_DATA:
-        /* find a new packet */
-        /* read a packet from the input stream */
-        if (c->stream->feed)
-            ffm_set_write_index(c->fmt_in,
-                                c->stream->feed->feed_write_index,
-                                c->stream->feed->feed_size);
-
-        if (c->stream->max_time &&
-            c->stream->max_time + c->start_time - cur_time < 0)
-            /* We have timed out */
-            c->state = HTTPSTATE_SEND_DATA_TRAILER;
-        else {
-            AVPacket pkt;
-        redo:
-            if (av_read_frame(c->fmt_in, &pkt) < 0) {
-                if (c->stream->feed && c->stream->feed->feed_opened) {
-                    /* if coming from feed, it means we reached the end of the
-                       ffm file, so must wait for more data */
-                    c->state = HTTPSTATE_WAIT_FEED;
-                    return 1; /* state changed */
-                } else {
-                    if (c->stream->loop) {
-                        av_close_input_file(c->fmt_in);
-                        c->fmt_in = NULL;
-                        if (open_input_stream(c, "") < 0)
-                            goto no_loop;
-                        goto redo;
-                    } else {
-                    no_loop:
-                        /* must send trailer now because eof or error */
-                        c->state = HTTPSTATE_SEND_DATA_TRAILER;
-                    }
-                }
-            } else {
-                int source_index = pkt.stream_index;
-                /* update first pts if needed */
-                if (c->first_pts == AV_NOPTS_VALUE) {
-                    c->first_pts = av_rescale_q(pkt.dts, c->fmt_in->streams[pkt.stream_index]->time_base, AV_TIME_BASE_Q);
-                    c->start_time = cur_time;
-                }
-                /* send it to the appropriate stream */
-                if (c->stream->feed) {
-                    /* if coming from a feed, select the right stream */
-                    if (c->switch_pending) {
-                        c->switch_pending = 0;
-                        for(i=0;i<c->stream->nb_streams;i++) {
-                            if (c->switch_feed_streams[i] == pkt.stream_index)
-                                if (pkt.flags & AV_PKT_FLAG_KEY)
-                                    do_switch_stream(c, i);
-                            if (c->switch_feed_streams[i] >= 0)
-                                c->switch_pending = 1;
-                        }
-                    }
-                    for(i=0;i<c->stream->nb_streams;i++) {
-                        if (c->stream->feed_streams[i] == pkt.stream_index) {
-                            AVStream *st = c->fmt_in->streams[source_index];
-                            pkt.stream_index = i;
-                            if (pkt.flags & AV_PKT_FLAG_KEY &&
-                                (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
-                                 c->stream->nb_streams == 1))
-                                c->got_key_frame = 1;
-                            if (!c->stream->send_on_key || c->got_key_frame)
-                                goto send_it;
-                        }
-                    }
-                } else {
-                    AVCodecContext *codec;
-                    AVStream *ist, *ost;
-                send_it:
-                    ist = c->fmt_in->streams[source_index];
-                    /* specific handling for RTP: we use several
-                       output stream (one for each RTP
-                       connection). XXX: need more abstract handling */
-                    if (c->is_packetized) {
-                        /* compute send time and duration */
-                        c->cur_pts = av_rescale_q(pkt.dts, ist->time_base, AV_TIME_BASE_Q);
-                        if (ist->start_time != AV_NOPTS_VALUE)
-                            c->cur_pts -= av_rescale_q(ist->start_time, ist->time_base, AV_TIME_BASE_Q);
-                        c->cur_frame_duration = av_rescale_q(pkt.duration, ist->time_base, AV_TIME_BASE_Q);
-                        /* find RTP context */
-                        c->packet_stream_index = pkt.stream_index;
-                        ctx = c->rtp_ctx[c->packet_stream_index];
-                        if(!ctx) {
-                            av_free_packet(&pkt);
-                            break;
-                        }
-                        codec = ctx->streams[0]->codec;
-                        /* only one stream per RTP connection */
-                        pkt.stream_index = 0;
-                    } else {
-                        ctx = &c->fmt_ctx;
-                        /* Fudge here */
-                        codec = ctx->streams[pkt.stream_index]->codec;
-                    }
-
-                    if (c->is_packetized) {
-                        int max_packet_size;
-                        if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP)
-                            max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
-                        else
-                            max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
-                        ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size);
-                    } else {
-                        ret = url_open_dyn_buf(&ctx->pb);
-                    }
-                    if (ret < 0) {
-                        /* XXX: potential leak */
-                        return -1;
-                    }
-                    ost = ctx->streams[pkt.stream_index];
-
-                    ctx->pb->is_streamed = 1;
-                    if (pkt.dts != AV_NOPTS_VALUE)
-                        pkt.dts = av_rescale_q(pkt.dts, ist->time_base, ost->time_base);
-                    if (pkt.pts != AV_NOPTS_VALUE)
-                        pkt.pts = av_rescale_q(pkt.pts, ist->time_base, ost->time_base);
-                    pkt.duration = av_rescale_q(pkt.duration, ist->time_base, ost->time_base);
-                    if (av_write_frame(ctx, &pkt) < 0) {
-                        http_log("Error writing frame to output\n");
-                        c->state = HTTPSTATE_SEND_DATA_TRAILER;
-                    }
-
-                    len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
-                    c->cur_frame_bytes = len;
-                    c->buffer_ptr = c->pb_buffer;
-                    c->buffer_end = c->pb_buffer + len;
-
-                    codec->frame_number++;
-                    if (len == 0) {
-                        av_free_packet(&pkt);
-                        goto redo;
-                    }
-                }
-                av_free_packet(&pkt);
-            }
-        }
-        break;
-    default:
-    case HTTPSTATE_SEND_DATA_TRAILER:
-        /* last packet test ? */
-        if (c->last_packet_sent || c->is_packetized)
-            return -1;
-        ctx = &c->fmt_ctx;
-        /* prepare header */
-        if (url_open_dyn_buf(&ctx->pb) < 0) {
-            /* XXX: potential leak */
-            return -1;
-        }
-        c->fmt_ctx.pb->is_streamed = 1;
-        av_write_trailer(ctx);
-        len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
-        c->buffer_ptr = c->pb_buffer;
-        c->buffer_end = c->pb_buffer + len;
-
-        c->last_packet_sent = 1;
-        break;
-    }
-    return 0;
-}
-
-/* should convert the format at the same time */
-/* send data starting at c->buffer_ptr to the output connection
-   (either UDP or TCP connection) */
-static int http_send_data(HTTPContext *c)
-{
-    int len, ret;
-
-    for(;;) {
-        if (c->buffer_ptr >= c->buffer_end) {
-            ret = http_prepare_data(c);
-            if (ret < 0)
-                return -1;
-            else if (ret != 0)
-                /* state change requested */
-                break;
-        } else {
-            if (c->is_packetized) {
-                /* RTP data output */
-                len = c->buffer_end - c->buffer_ptr;
-                if (len < 4) {
-                    /* fail safe - should never happen */
-                fail1:
-                    c->buffer_ptr = c->buffer_end;
-                    return 0;
-                }
-                len = (c->buffer_ptr[0] << 24) |
-                    (c->buffer_ptr[1] << 16) |
-                    (c->buffer_ptr[2] << 8) |
-                    (c->buffer_ptr[3]);
-                if (len > (c->buffer_end - c->buffer_ptr))
-                    goto fail1;
-                if ((get_packet_send_clock(c) - get_server_clock(c)) > 0) {
-                    /* nothing to send yet: we can wait */
-                    return 0;
-                }
-
-                c->data_count += len;
-                update_datarate(&c->datarate, c->data_count);
-                if (c->stream)
-                    c->stream->bytes_served += len;
-
-                if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP) {
-                    /* RTP packets are sent inside the RTSP TCP connection */
-                    ByteIOContext *pb;
-                    int interleaved_index, size;
-                    uint8_t header[4];
-                    HTTPContext *rtsp_c;
-
-                    rtsp_c = c->rtsp_c;
-                    /* if no RTSP connection left, error */
-                    if (!rtsp_c)
-                        return -1;
-                    /* if already sending something, then wait. */
-                    if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST)
-                        break;
-                    if (url_open_dyn_buf(&pb) < 0)
-                        goto fail1;
-                    interleaved_index = c->packet_stream_index * 2;
-                    /* RTCP packets are sent at odd indexes */
-                    if (c->buffer_ptr[1] == 200)
-                        interleaved_index++;
-                    /* write RTSP TCP header */
-                    header[0] = '$';
-                    header[1] = interleaved_index;
-                    header[2] = len >> 8;
-                    header[3] = len;
-                    put_buffer(pb, header, 4);
-                    /* write RTP packet data */
-                    c->buffer_ptr += 4;
-                    put_buffer(pb, c->buffer_ptr, len);
-                    size = url_close_dyn_buf(pb, &c->packet_buffer);
-                    /* prepare asynchronous TCP sending */
-                    rtsp_c->packet_buffer_ptr = c->packet_buffer;
-                    rtsp_c->packet_buffer_end = c->packet_buffer + size;
-                    c->buffer_ptr += len;
-
-                    /* send everything we can NOW */
-                    len = send(rtsp_c->fd, rtsp_c->packet_buffer_ptr,
-                                rtsp_c->packet_buffer_end - rtsp_c->packet_buffer_ptr, 0);
-                    if (len > 0)
-                        rtsp_c->packet_buffer_ptr += len;
-                    if (rtsp_c->packet_buffer_ptr < rtsp_c->packet_buffer_end) {
-                        /* if we could not send all the data, we will
-                           send it later, so a new state is needed to
-                           "lock" the RTSP TCP connection */
-                        rtsp_c->state = RTSPSTATE_SEND_PACKET;
-                        break;
-                    } else
-                        /* all data has been sent */
-                        av_freep(&c->packet_buffer);
-                } else {
-                    /* send RTP packet directly in UDP */
-                    c->buffer_ptr += 4;
-                    url_write(c->rtp_handles[c->packet_stream_index],
-                              c->buffer_ptr, len);
-                    c->buffer_ptr += len;
-                    /* here we continue as we can send several packets per 10 ms slot */
-                }
-            } else {
-                /* TCP data output */
-                len = send(c->fd, c->buffer_ptr, c->buffer_end - c->buffer_ptr, 0);
-                if (len < 0) {
-                    if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                        ff_neterrno() != FF_NETERROR(EINTR))
-                        /* error : close connection */
-                        return -1;
-                    else
-                        return 0;
-                } else
-                    c->buffer_ptr += len;
-
-                c->data_count += len;
-                update_datarate(&c->datarate, c->data_count);
-                if (c->stream)
-                    c->stream->bytes_served += len;
-                break;
-            }
-        }
-    } /* for(;;) */
-    return 0;
-}
-
-static int http_start_receive_data(HTTPContext *c)
-{
-    int fd;
-
-    if (c->stream->feed_opened)
-        return -1;
-
-    /* Don't permit writing to this one */
-    if (c->stream->readonly)
-        return -1;
-
-    /* open feed */
-    fd = open(c->stream->feed_filename, O_RDWR);
-    if (fd < 0) {
-        http_log("Error opening feeder file: %s\n", strerror(errno));
-        return -1;
-    }
-    c->feed_fd = fd;
-
-    if (c->stream->truncate) {
-        /* truncate feed file */
-        ffm_write_write_index(c->feed_fd, FFM_PACKET_SIZE);
-        ftruncate(c->feed_fd, FFM_PACKET_SIZE);
-        http_log("Truncating feed file '%s'\n", c->stream->feed_filename);
-    } else {
-        if ((c->stream->feed_write_index = ffm_read_write_index(fd)) < 0) {
-            http_log("Error reading write index from feed file: %s\n", strerror(errno));
-            return -1;
-        }
-    }
-
-    c->stream->feed_write_index = FFMAX(ffm_read_write_index(fd), FFM_PACKET_SIZE);
-    c->stream->feed_size = lseek(fd, 0, SEEK_END);
-    lseek(fd, 0, SEEK_SET);
-
-    /* init buffer input */
-    c->buffer_ptr = c->buffer;
-    c->buffer_end = c->buffer + FFM_PACKET_SIZE;
-    c->stream->feed_opened = 1;
-    c->chunked_encoding = !!av_stristr(c->buffer, "Transfer-Encoding: chunked");
-    return 0;
-}
-
-static int http_receive_data(HTTPContext *c)
-{
-    HTTPContext *c1;
-    int len, loop_run = 0;
-
-    while (c->chunked_encoding && !c->chunk_size &&
-           c->buffer_end > c->buffer_ptr) {
-        /* read chunk header, if present */
-        len = recv(c->fd, c->buffer_ptr, 1, 0);
-
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
-                /* error : close connection */
-                goto fail;
-        } else if (len == 0) {
-            /* end of connection : close it */
-            goto fail;
-        } else if (c->buffer_ptr - c->buffer >= 2 &&
-                   !memcmp(c->buffer_ptr - 1, "\r\n", 2)) {
-            c->chunk_size = strtol(c->buffer, 0, 16);
-            if (c->chunk_size == 0) // end of stream
-                goto fail;
-            c->buffer_ptr = c->buffer;
-            break;
-        } else if (++loop_run > 10) {
-            /* no chunk header, abort */
-            goto fail;
-        } else {
-            c->buffer_ptr++;
-        }
-    }
-
-    if (c->buffer_end > c->buffer_ptr) {
-        len = recv(c->fd, c->buffer_ptr,
-                   FFMIN(c->chunk_size, c->buffer_end - c->buffer_ptr), 0);
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
-                /* error : close connection */
-                goto fail;
-        } else if (len == 0)
-            /* end of connection : close it */
-            goto fail;
-        else {
-            c->chunk_size -= len;
-            c->buffer_ptr += len;
-            c->data_count += len;
-            update_datarate(&c->datarate, c->data_count);
-        }
-    }
-
-    if (c->buffer_ptr - c->buffer >= 2 && c->data_count > FFM_PACKET_SIZE) {
-        if (c->buffer[0] != 'f' ||
-            c->buffer[1] != 'm') {
-            http_log("Feed stream has become desynchronized -- disconnecting\n");
-            goto fail;
-        }
-    }
-
-    if (c->buffer_ptr >= c->buffer_end) {
-        FFStream *feed = c->stream;
-        /* a packet has been received : write it in the store, except
-           if header */
-        if (c->data_count > FFM_PACKET_SIZE) {
-
-            //            printf("writing pos=0x%"PRIx64" size=0x%"PRIx64"\n", feed->feed_write_index, feed->feed_size);
-            /* XXX: use llseek or url_seek */
-            lseek(c->feed_fd, feed->feed_write_index, SEEK_SET);
-            if (write(c->feed_fd, c->buffer, FFM_PACKET_SIZE) < 0) {
-                http_log("Error writing to feed file: %s\n", strerror(errno));
-                goto fail;
-            }
-
-            feed->feed_write_index += FFM_PACKET_SIZE;
-            /* update file size */
-            if (feed->feed_write_index > c->stream->feed_size)
-                feed->feed_size = feed->feed_write_index;
-
-            /* handle wrap around if max file size reached */
-            if (c->stream->feed_max_size && feed->feed_write_index >= c->stream->feed_max_size)
-                feed->feed_write_index = FFM_PACKET_SIZE;
-
-            /* write index */
-            if (ffm_write_write_index(c->feed_fd, feed->feed_write_index) < 0) {
-                http_log("Error writing index to feed file: %s\n", strerror(errno));
-                goto fail;
-            }
-
-            /* wake up any waiting connections */
-            for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
-                if (c1->state == HTTPSTATE_WAIT_FEED &&
-                    c1->stream->feed == c->stream->feed)
-                    c1->state = HTTPSTATE_SEND_DATA;
-            }
-        } else {
-            /* We have a header in our hands that contains useful data */
-            AVFormatContext *s = NULL;
-            ByteIOContext *pb;
-            AVInputFormat *fmt_in;
-            int i;
-
-            /* use feed output format name to find corresponding input format */
-            fmt_in = av_find_input_format(feed->fmt->name);
-            if (!fmt_in)
-                goto fail;
-
-            url_open_buf(&pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY);
-            pb->is_streamed = 1;
-
-            if (av_open_input_stream(&s, pb, c->stream->feed_filename, fmt_in, NULL) < 0) {
-                av_free(pb);
-                goto fail;
-            }
-
-            /* Now we have the actual streams */
-            if (s->nb_streams != feed->nb_streams) {
-                av_close_input_stream(s);
-                av_free(pb);
-                http_log("Feed '%s' stream number does not match registered feed\n",
-                         c->stream->feed_filename);
-                goto fail;
-            }
-
-            for (i = 0; i < s->nb_streams; i++) {
-                AVStream *fst = feed->streams[i];
-                AVStream *st = s->streams[i];
-                memcpy(fst->codec, st->codec, sizeof(AVCodecContext));
-                if (fst->codec->extradata_size) {
-                    fst->codec->extradata = av_malloc(fst->codec->extradata_size);
-                    if (!fst->codec->extradata)
-                        goto fail;
-                    memcpy(fst->codec->extradata, st->codec->extradata,
-                           fst->codec->extradata_size);
-                }
-            }
-
-            av_close_input_stream(s);
-            av_free(pb);
-        }
-        c->buffer_ptr = c->buffer;
-    }
-
-    return 0;
- fail:
-    c->stream->feed_opened = 0;
-    close(c->feed_fd);
-    /* wake up any waiting connections to stop waiting for feed */
-    for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) {
-        if (c1->state == HTTPSTATE_WAIT_FEED &&
-            c1->stream->feed == c->stream->feed)
-            c1->state = HTTPSTATE_SEND_DATA_TRAILER;
-    }
-    return -1;
-}
-
-/********************************************************************/
-/* RTSP handling */
-
-static void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number)
-{
-    const char *str;
-    time_t ti;
-    char *p;
-    char buf2[32];
-
-    switch(error_number) {
-    case RTSP_STATUS_OK:
-        str = "OK";
-        break;
-    case RTSP_STATUS_METHOD:
-        str = "Method Not Allowed";
-        break;
-    case RTSP_STATUS_BANDWIDTH:
-        str = "Not Enough Bandwidth";
-        break;
-    case RTSP_STATUS_SESSION:
-        str = "Session Not Found";
-        break;
-    case RTSP_STATUS_STATE:
-        str = "Method Not Valid in This State";
-        break;
-    case RTSP_STATUS_AGGREGATE:
-        str = "Aggregate operation not allowed";
-        break;
-    case RTSP_STATUS_ONLY_AGGREGATE:
-        str = "Only aggregate operation allowed";
-        break;
-    case RTSP_STATUS_TRANSPORT:
-        str = "Unsupported transport";
-        break;
-    case RTSP_STATUS_INTERNAL:
-        str = "Internal Server Error";
-        break;
-    case RTSP_STATUS_SERVICE:
-        str = "Service Unavailable";
-        break;
-    case RTSP_STATUS_VERSION:
-        str = "RTSP Version not supported";
-        break;
-    default:
-        str = "Unknown Error";
-        break;
-    }
-
-    url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str);
-    url_fprintf(c->pb, "CSeq: %d\r\n", c->seq);
-
-    /* output GMT time */
-    ti = time(NULL);
-    p = ctime(&ti);
-    strcpy(buf2, p);
-    p = buf2 + strlen(p) - 1;
-    if (*p == '\n')
-        *p = '\0';
-    url_fprintf(c->pb, "Date: %s GMT\r\n", buf2);
-}
-
-static void rtsp_reply_error(HTTPContext *c, enum RTSPStatusCode error_number)
-{
-    rtsp_reply_header(c, error_number);
-    url_fprintf(c->pb, "\r\n");
-}
-
-static int rtsp_parse_request(HTTPContext *c)
-{
-    const char *p, *p1, *p2;
-    char cmd[32];
-    char url[1024];
-    char protocol[32];
-    char line[1024];
-    int len;
-    RTSPMessageHeader header1, *header = &header1;
-
-    c->buffer_ptr[0] = '\0';
-    p = c->buffer;
-
-    get_word(cmd, sizeof(cmd), &p);
-    get_word(url, sizeof(url), &p);
-    get_word(protocol, sizeof(protocol), &p);
-
-    av_strlcpy(c->method, cmd, sizeof(c->method));
-    av_strlcpy(c->url, url, sizeof(c->url));
-    av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
-
-    if (url_open_dyn_buf(&c->pb) < 0) {
-        /* XXX: cannot do more */
-        c->pb = NULL; /* safety */
-        return -1;
-    }
-
-    /* check version name */
-    if (strcmp(protocol, "RTSP/1.0") != 0) {
-        rtsp_reply_error(c, RTSP_STATUS_VERSION);
-        goto the_end;
-    }
-
-    /* parse each header line */
-    memset(header, 0, sizeof(*header));
-    /* skip to next line */
-    while (*p != '\n' && *p != '\0')
-        p++;
-    if (*p == '\n')
-        p++;
-    while (*p != '\0') {
-        p1 = memchr(p, '\n', (char *)c->buffer_ptr - p);
-        if (!p1)
-            break;
-        p2 = p1;
-        if (p2 > p && p2[-1] == '\r')
-            p2--;
-        /* skip empty line */
-        if (p2 == p)
-            break;
-        len = p2 - p;
-        if (len > sizeof(line) - 1)
-            len = sizeof(line) - 1;
-        memcpy(line, p, len);
-        line[len] = '\0';
-        ff_rtsp_parse_line(header, line, NULL);
-        p = p1 + 1;
-    }
-
-    /* handle sequence number */
-    c->seq = header->seq;
-
-    if (!strcmp(cmd, "DESCRIBE"))
-        rtsp_cmd_describe(c, url);
-    else if (!strcmp(cmd, "OPTIONS"))
-        rtsp_cmd_options(c, url);
-    else if (!strcmp(cmd, "SETUP"))
-        rtsp_cmd_setup(c, url, header);
-    else if (!strcmp(cmd, "PLAY"))
-        rtsp_cmd_play(c, url, header);
-    else if (!strcmp(cmd, "PAUSE"))
-        rtsp_cmd_pause(c, url, header);
-    else if (!strcmp(cmd, "TEARDOWN"))
-        rtsp_cmd_teardown(c, url, header);
-    else
-        rtsp_reply_error(c, RTSP_STATUS_METHOD);
-
- the_end:
-    len = url_close_dyn_buf(c->pb, &c->pb_buffer);
-    c->pb = NULL; /* safety */
-    if (len < 0) {
-        /* XXX: cannot do more */
-        return -1;
-    }
-    c->buffer_ptr = c->pb_buffer;
-    c->buffer_end = c->pb_buffer + len;
-    c->state = RTSPSTATE_SEND_REPLY;
-    return 0;
-}
-
-static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
-                                   struct in_addr my_ip)
-{
-    AVFormatContext *avc;
-    AVStream avs[MAX_STREAMS];
-    int i;
-
-    avc =  avformat_alloc_context();
-    if (avc == NULL) {
-        return -1;
-    }
-    av_metadata_set2(&avc->metadata, "title",
-                     stream->title[0] ? stream->title : "No Title", 0);
-    avc->nb_streams = stream->nb_streams;
-    if (stream->is_multicast) {
-        snprintf(avc->filename, 1024, "rtp://%s:%d?multicast=1?ttl=%d",
-                 inet_ntoa(stream->multicast_ip),
-                 stream->multicast_port, stream->multicast_ttl);
-    } else {
-        snprintf(avc->filename, 1024, "rtp://0.0.0.0");
-    }
-
-    for(i = 0; i < stream->nb_streams; i++) {
-        avc->streams[i] = &avs[i];
-        avc->streams[i]->codec = stream->streams[i]->codec;
-    }
-    *pbuffer = av_mallocz(2048);
-    avf_sdp_create(&avc, 1, *pbuffer, 2048);
-    av_metadata_free(&avc->metadata);
-    av_free(avc);
-
-    return strlen(*pbuffer);
-}
-
-static void rtsp_cmd_options(HTTPContext *c, const char *url)
-{
-//    rtsp_reply_header(c, RTSP_STATUS_OK);
-    url_fprintf(c->pb, "RTSP/1.0 %d %s\r\n", RTSP_STATUS_OK, "OK");
-    url_fprintf(c->pb, "CSeq: %d\r\n", c->seq);
-    url_fprintf(c->pb, "Public: %s\r\n", "OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE");
-    url_fprintf(c->pb, "\r\n");
-}
-
-static void rtsp_cmd_describe(HTTPContext *c, const char *url)
-{
-    FFStream *stream;
-    char path1[1024];
-    const char *path;
-    uint8_t *content;
-    int content_length, len;
-    struct sockaddr_in my_addr;
-
-    /* find which url is asked */
-    ff_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
-    path = path1;
-    if (*path == '/')
-        path++;
-
-    for(stream = first_stream; stream != NULL; stream = stream->next) {
-        if (!stream->is_feed &&
-            stream->fmt && !strcmp(stream->fmt->name, "rtp") &&
-            !strcmp(path, stream->filename)) {
-            goto found;
-        }
-    }
-    /* no stream found */
-    rtsp_reply_error(c, RTSP_STATUS_SERVICE); /* XXX: right error ? */
-    return;
-
- found:
-    /* prepare the media description in sdp format */
-
-    /* get the host IP */
-    len = sizeof(my_addr);
-    getsockname(c->fd, (struct sockaddr *)&my_addr, &len);
-    content_length = prepare_sdp_description(stream, &content, my_addr.sin_addr);
-    if (content_length < 0) {
-        rtsp_reply_error(c, RTSP_STATUS_INTERNAL);
-        return;
-    }
-    rtsp_reply_header(c, RTSP_STATUS_OK);
-    url_fprintf(c->pb, "Content-Base: %s/\r\n", url);
-    url_fprintf(c->pb, "Content-Type: application/sdp\r\n");
-    url_fprintf(c->pb, "Content-Length: %d\r\n", content_length);
-    url_fprintf(c->pb, "\r\n");
-    put_buffer(c->pb, content, content_length);
-    av_free(content);
-}
-
-static HTTPContext *find_rtp_session(const char *session_id)
-{
-    HTTPContext *c;
-
-    if (session_id[0] == '\0')
-        return NULL;
-
-    for(c = first_http_ctx; c != NULL; c = c->next) {
-        if (!strcmp(c->session_id, session_id))
-            return c;
-    }
-    return NULL;
-}
-
-static RTSPTransportField *find_transport(RTSPMessageHeader *h, enum RTSPLowerTransport lower_transport)
-{
-    RTSPTransportField *th;
-    int i;
-
-    for(i=0;i<h->nb_transports;i++) {
-        th = &h->transports[i];
-        if (th->lower_transport == lower_transport)
-            return th;
-    }
-    return NULL;
-}
-
-static void rtsp_cmd_setup(HTTPContext *c, const char *url,
-                           RTSPMessageHeader *h)
-{
-    FFStream *stream;
-    int stream_index, rtp_port, rtcp_port;
-    char buf[1024];
-    char path1[1024];
-    const char *path;
-    HTTPContext *rtp_c;
-    RTSPTransportField *th;
-    struct sockaddr_in dest_addr;
-    RTSPActionServerSetup setup;
-
-    /* find which url is asked */
-    ff_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
-    path = path1;
-    if (*path == '/')
-        path++;
-
-    /* now check each stream */
-    for(stream = first_stream; stream != NULL; stream = stream->next) {
-        if (!stream->is_feed &&
-            stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
-            /* accept aggregate filenames only if single stream */
-            if (!strcmp(path, stream->filename)) {
-                if (stream->nb_streams != 1) {
-                    rtsp_reply_error(c, RTSP_STATUS_AGGREGATE);
-                    return;
-                }
-                stream_index = 0;
-                goto found;
-            }
-
-            for(stream_index = 0; stream_index < stream->nb_streams;
-                stream_index++) {
-                snprintf(buf, sizeof(buf), "%s/streamid=%d",
-                         stream->filename, stream_index);
-                if (!strcmp(path, buf))
-                    goto found;
-            }
-        }
-    }
-    /* no stream found */
-    rtsp_reply_error(c, RTSP_STATUS_SERVICE); /* XXX: right error ? */
-    return;
- found:
-
-    /* generate session id if needed */
-    if (h->session_id[0] == '\0')
-        snprintf(h->session_id, sizeof(h->session_id), "%08x%08x",
-                 av_lfg_get(&random_state), av_lfg_get(&random_state));
-
-    /* find rtp session, and create it if none found */
-    rtp_c = find_rtp_session(h->session_id);
-    if (!rtp_c) {
-        /* always prefer UDP */
-        th = find_transport(h, RTSP_LOWER_TRANSPORT_UDP);
-        if (!th) {
-            th = find_transport(h, RTSP_LOWER_TRANSPORT_TCP);
-            if (!th) {
-                rtsp_reply_error(c, RTSP_STATUS_TRANSPORT);
-                return;
-            }
-        }
-
-        rtp_c = rtp_new_connection(&c->from_addr, stream, h->session_id,
-                                   th->lower_transport);
-        if (!rtp_c) {
-            rtsp_reply_error(c, RTSP_STATUS_BANDWIDTH);
-            return;
-        }
-
-        /* open input stream */
-        if (open_input_stream(rtp_c, "") < 0) {
-            rtsp_reply_error(c, RTSP_STATUS_INTERNAL);
-            return;
-        }
-    }
-
-    /* test if stream is OK (test needed because several SETUP needs
-       to be done for a given file) */
-    if (rtp_c->stream != stream) {
-        rtsp_reply_error(c, RTSP_STATUS_SERVICE);
-        return;
-    }
-
-    /* test if stream is already set up */
-    if (rtp_c->rtp_ctx[stream_index]) {
-        rtsp_reply_error(c, RTSP_STATUS_STATE);
-        return;
-    }
-
-    /* check transport */
-    th = find_transport(h, rtp_c->rtp_protocol);
-    if (!th || (th->lower_transport == RTSP_LOWER_TRANSPORT_UDP &&
-                th->client_port_min <= 0)) {
-        rtsp_reply_error(c, RTSP_STATUS_TRANSPORT);
-        return;
-    }
-
-    /* setup default options */
-    setup.transport_option[0] = '\0';
-    dest_addr = rtp_c->from_addr;
-    dest_addr.sin_port = htons(th->client_port_min);
-
-    /* setup stream */
-    if (rtp_new_av_stream(rtp_c, stream_index, &dest_addr, c) < 0) {
-        rtsp_reply_error(c, RTSP_STATUS_TRANSPORT);
-        return;
-    }
-
-    /* now everything is OK, so we can send the connection parameters */
-    rtsp_reply_header(c, RTSP_STATUS_OK);
-    /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id);
-
-    switch(rtp_c->rtp_protocol) {
-    case RTSP_LOWER_TRANSPORT_UDP:
-        rtp_port = rtp_get_local_rtp_port(rtp_c->rtp_handles[stream_index]);
-        rtcp_port = rtp_get_local_rtcp_port(rtp_c->rtp_handles[stream_index]);
-        url_fprintf(c->pb, "Transport: RTP/AVP/UDP;unicast;"
-                    "client_port=%d-%d;server_port=%d-%d",
-                    th->client_port_min, th->client_port_max,
-                    rtp_port, rtcp_port);
-        break;
-    case RTSP_LOWER_TRANSPORT_TCP:
-        url_fprintf(c->pb, "Transport: RTP/AVP/TCP;interleaved=%d-%d",
-                    stream_index * 2, stream_index * 2 + 1);
-        break;
-    default:
-        break;
-    }
-    if (setup.transport_option[0] != '\0')
-        url_fprintf(c->pb, ";%s", setup.transport_option);
-    url_fprintf(c->pb, "\r\n");
-
-
-    url_fprintf(c->pb, "\r\n");
-}
-
-
-/* find an rtp connection by using the session ID. Check consistency
-   with filename */
-static HTTPContext *find_rtp_session_with_url(const char *url,
-                                              const char *session_id)
-{
-    HTTPContext *rtp_c;
-    char path1[1024];
-    const char *path;
-    char buf[1024];
-    int s;
-
-    rtp_c = find_rtp_session(session_id);
-    if (!rtp_c)
-        return NULL;
-
-    /* find which url is asked */
-    ff_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
-    path = path1;
-    if (*path == '/')
-        path++;
-    if(!strcmp(path, rtp_c->stream->filename)) return rtp_c;
-    for(s=0; s<rtp_c->stream->nb_streams; ++s) {
-      snprintf(buf, sizeof(buf), "%s/streamid=%d",
-        rtp_c->stream->filename, s);
-      if(!strncmp(path, buf, sizeof(buf))) {
-    // XXX: Should we reply with RTSP_STATUS_ONLY_AGGREGATE if nb_streams>1?
-        return rtp_c;
-      }
-    }
-    return NULL;
-}
-
-static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPMessageHeader *h)
-{
-    HTTPContext *rtp_c;
-
-    rtp_c = find_rtp_session_with_url(url, h->session_id);
-    if (!rtp_c) {
-        rtsp_reply_error(c, RTSP_STATUS_SESSION);
-        return;
-    }
-
-    if (rtp_c->state != HTTPSTATE_SEND_DATA &&
-        rtp_c->state != HTTPSTATE_WAIT_FEED &&
-        rtp_c->state != HTTPSTATE_READY) {
-        rtsp_reply_error(c, RTSP_STATUS_STATE);
-        return;
-    }
-
-    rtp_c->state = HTTPSTATE_SEND_DATA;
-
-    /* now everything is OK, so we can send the connection parameters */
-    rtsp_reply_header(c, RTSP_STATUS_OK);
-    /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id);
-    url_fprintf(c->pb, "\r\n");
-}
-
-static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h)
-{
-    HTTPContext *rtp_c;
-
-    rtp_c = find_rtp_session_with_url(url, h->session_id);
-    if (!rtp_c) {
-        rtsp_reply_error(c, RTSP_STATUS_SESSION);
-        return;
-    }
-
-    if (rtp_c->state != HTTPSTATE_SEND_DATA &&
-        rtp_c->state != HTTPSTATE_WAIT_FEED) {
-        rtsp_reply_error(c, RTSP_STATUS_STATE);
-        return;
-    }
-
-    rtp_c->state = HTTPSTATE_READY;
-    rtp_c->first_pts = AV_NOPTS_VALUE;
-    /* now everything is OK, so we can send the connection parameters */
-    rtsp_reply_header(c, RTSP_STATUS_OK);
-    /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", rtp_c->session_id);
-    url_fprintf(c->pb, "\r\n");
-}
-
-static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h)
-{
-    HTTPContext *rtp_c;
-    char session_id[32];
-
-    rtp_c = find_rtp_session_with_url(url, h->session_id);
-    if (!rtp_c) {
-        rtsp_reply_error(c, RTSP_STATUS_SESSION);
-        return;
-    }
-
-    av_strlcpy(session_id, rtp_c->session_id, sizeof(session_id));
-
-    /* abort the session */
-    close_connection(rtp_c);
-
-    /* now everything is OK, so we can send the connection parameters */
-    rtsp_reply_header(c, RTSP_STATUS_OK);
-    /* session ID */
-    url_fprintf(c->pb, "Session: %s\r\n", session_id);
-    url_fprintf(c->pb, "\r\n");
-}
-
-
-/********************************************************************/
-/* RTP handling */
-
-static HTTPContext *rtp_new_connection(struct sockaddr_in *from_addr,
-                                       FFStream *stream, const char *session_id,
-                                       enum RTSPLowerTransport rtp_protocol)
-{
-    HTTPContext *c = NULL;
-    const char *proto_str;
-
-    /* XXX: should output a warning page when coming
-       close to the connection limit */
-    if (nb_connections >= nb_max_connections)
-        goto fail;
-
-    /* add a new connection */
-    c = av_mallocz(sizeof(HTTPContext));
-    if (!c)
-        goto fail;
-
-    c->fd = -1;
-    c->poll_entry = NULL;
-    c->from_addr = *from_addr;
-    c->buffer_size = IOBUFFER_INIT_SIZE;
-    c->buffer = av_malloc(c->buffer_size);
-    if (!c->buffer)
-        goto fail;
-    nb_connections++;
-    c->stream = stream;
-    av_strlcpy(c->session_id, session_id, sizeof(c->session_id));
-    c->state = HTTPSTATE_READY;
-    c->is_packetized = 1;
-    c->rtp_protocol = rtp_protocol;
-
-    /* protocol is shown in statistics */
-    switch(c->rtp_protocol) {
-    case RTSP_LOWER_TRANSPORT_UDP_MULTICAST:
-        proto_str = "MCAST";
-        break;
-    case RTSP_LOWER_TRANSPORT_UDP:
-        proto_str = "UDP";
-        break;
-    case RTSP_LOWER_TRANSPORT_TCP:
-        proto_str = "TCP";
-        break;
-    default:
-        proto_str = "???";
-        break;
-    }
-    av_strlcpy(c->protocol, "RTP/", sizeof(c->protocol));
-    av_strlcat(c->protocol, proto_str, sizeof(c->protocol));
-
-    current_bandwidth += stream->bandwidth;
-
-    c->next = first_http_ctx;
-    first_http_ctx = c;
-    return c;
-
- fail:
-    if (c) {
-        av_free(c->buffer);
-        av_free(c);
-    }
-    return NULL;
-}
-
-/* add a new RTP stream in an RTP connection (used in RTSP SETUP
-   command). If RTP/TCP protocol is used, TCP connection 'rtsp_c' is
-   used. */
-static int rtp_new_av_stream(HTTPContext *c,
-                             int stream_index, struct sockaddr_in *dest_addr,
-                             HTTPContext *rtsp_c)
-{
-    AVFormatContext *ctx;
-    AVStream *st;
-    char *ipaddr;
-    URLContext *h = NULL;
-    uint8_t *dummy_buf;
-    int max_packet_size;
-
-    /* now we can open the relevant output stream */
-    ctx = avformat_alloc_context();
-    if (!ctx)
-        return -1;
-    ctx->oformat = av_guess_format("rtp", NULL, NULL);
-
-    st = av_mallocz(sizeof(AVStream));
-    if (!st)
-        goto fail;
-    ctx->nb_streams = 1;
-    ctx->streams[0] = st;
-
-    if (!c->stream->feed ||
-        c->stream->feed == c->stream)
-        memcpy(st, c->stream->streams[stream_index], sizeof(AVStream));
-    else
-        memcpy(st,
-               c->stream->feed->streams[c->stream->feed_streams[stream_index]],
-               sizeof(AVStream));
-    st->priv_data = NULL;
-
-    /* build destination RTP address */
-    ipaddr = inet_ntoa(dest_addr->sin_addr);
-
-    switch(c->rtp_protocol) {
-    case RTSP_LOWER_TRANSPORT_UDP:
-    case RTSP_LOWER_TRANSPORT_UDP_MULTICAST:
-        /* RTP/UDP case */
-
-        /* XXX: also pass as parameter to function ? */
-        if (c->stream->is_multicast) {
-            int ttl;
-            ttl = c->stream->multicast_ttl;
-            if (!ttl)
-                ttl = 16;
-            snprintf(ctx->filename, sizeof(ctx->filename),
-                     "rtp://%s:%d?multicast=1&ttl=%d",
-                     ipaddr, ntohs(dest_addr->sin_port), ttl);
-        } else {
-            snprintf(ctx->filename, sizeof(ctx->filename),
-                     "rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
-        }
-
-        if (url_open(&h, ctx->filename, URL_WRONLY) < 0)
-            goto fail;
-        c->rtp_handles[stream_index] = h;
-        max_packet_size = url_get_max_packet_size(h);
-        break;
-    case RTSP_LOWER_TRANSPORT_TCP:
-        /* RTP/TCP case */
-        c->rtsp_c = rtsp_c;
-        max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
-        break;
-    default:
-        goto fail;
-    }
-
-    http_log("%s:%d - - \"PLAY %s/streamid=%d %s\"\n",
-             ipaddr, ntohs(dest_addr->sin_port),
-             c->stream->filename, stream_index, c->protocol);
-
-    /* normally, no packets should be output here, but the packet size may be checked */
-    if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
-        /* XXX: close stream */
-        goto fail;
-    }
-    av_set_parameters(ctx, NULL);
-    if (av_write_header(ctx) < 0) {
-    fail:
-        if (h)
-            url_close(h);
-        av_free(ctx);
-        return -1;
-    }
-    url_close_dyn_buf(ctx->pb, &dummy_buf);
-    av_free(dummy_buf);
-
-    c->rtp_ctx[stream_index] = ctx;
-    return 0;
-}
-
-/********************************************************************/
-/* ffserver initialization */
-
-static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int copy)
-{
-    AVStream *fst;
-
-    fst = av_mallocz(sizeof(AVStream));
-    if (!fst)
-        return NULL;
-    if (copy) {
-        fst->codec= avcodec_alloc_context();
-        memcpy(fst->codec, codec, sizeof(AVCodecContext));
-        if (codec->extradata_size) {
-            fst->codec->extradata = av_malloc(codec->extradata_size);
-            memcpy(fst->codec->extradata, codec->extradata,
-                codec->extradata_size);
-        }
-    } else {
-        /* live streams must use the actual feed's codec since it may be
-         * updated later to carry extradata needed by the streams.
-         */
-        fst->codec = codec;
-    }
-    fst->priv_data = av_mallocz(sizeof(FeedData));
-    fst->index = stream->nb_streams;
-    av_set_pts_info(fst, 33, 1, 90000);
-    stream->streams[stream->nb_streams++] = fst;
-    return fst;
-}
-
-/* return the stream number in the feed */
-static int add_av_stream(FFStream *feed, AVStream *st)
-{
-    AVStream *fst;
-    AVCodecContext *av, *av1;
-    int i;
-
-    av = st->codec;
-    for(i=0;i<feed->nb_streams;i++) {
-        st = feed->streams[i];
-        av1 = st->codec;
-        if (av1->codec_id == av->codec_id &&
-            av1->codec_type == av->codec_type &&
-            av1->bit_rate == av->bit_rate) {
-
-            switch(av->codec_type) {
-            case AVMEDIA_TYPE_AUDIO:
-                if (av1->channels == av->channels &&
-                    av1->sample_rate == av->sample_rate)
-                    goto found;
-                break;
-            case AVMEDIA_TYPE_VIDEO:
-                if (av1->width == av->width &&
-                    av1->height == av->height &&
-                    av1->time_base.den == av->time_base.den &&
-                    av1->time_base.num == av->time_base.num &&
-                    av1->gop_size == av->gop_size)
-                    goto found;
-                break;
-            default:
-                abort();
-            }
-        }
-    }
-
-    fst = add_av_stream1(feed, av, 0);
-    if (!fst)
-        return -1;
-    return feed->nb_streams - 1;
- found:
-    return i;
-}
-
-static void remove_stream(FFStream *stream)
-{
-    FFStream **ps;
-    ps = &first_stream;
-    while (*ps != NULL) {
-        if (*ps == stream)
-            *ps = (*ps)->next;
-        else
-            ps = &(*ps)->next;
-    }
-}
-
-/* specific mpeg4 handling : we extract the raw parameters */
-static void extract_mpeg4_header(AVFormatContext *infile)
-{
-    int mpeg4_count, i, size;
-    AVPacket pkt;
-    AVStream *st;
-    const uint8_t *p;
-
-    mpeg4_count = 0;
-    for(i=0;i<infile->nb_streams;i++) {
-        st = infile->streams[i];
-        if (st->codec->codec_id == CODEC_ID_MPEG4 &&
-            st->codec->extradata_size == 0) {
-            mpeg4_count++;
-        }
-    }
-    if (!mpeg4_count)
-        return;
-
-    printf("MPEG4 without extra data: trying to find header in %s\n", infile->filename);
-    while (mpeg4_count > 0) {
-        if (av_read_packet(infile, &pkt) < 0)
-            break;
-        st = infile->streams[pkt.stream_index];
-        if (st->codec->codec_id == CODEC_ID_MPEG4 &&
-            st->codec->extradata_size == 0) {
-            av_freep(&st->codec->extradata);
-            /* fill extradata with the header */
-            /* XXX: we make hard suppositions here ! */
-            p = pkt.data;
-            while (p < pkt.data + pkt.size - 4) {
-                /* stop when vop header is found */
-                if (p[0] == 0x00 && p[1] == 0x00 &&
-                    p[2] == 0x01 && p[3] == 0xb6) {
-                    size = p - pkt.data;
-                    //                    av_hex_dump_log(infile, AV_LOG_DEBUG, pkt.data, size);
-                    st->codec->extradata = av_malloc(size);
-                    st->codec->extradata_size = size;
-                    memcpy(st->codec->extradata, pkt.data, size);
-                    break;
-                }
-                p++;
-            }
-            mpeg4_count--;
-        }
-        av_free_packet(&pkt);
-    }
-}
-
-/* compute the needed AVStream for each file */
-static void build_file_streams(void)
-{
-    FFStream *stream, *stream_next;
-    AVFormatContext *infile;
-    int i, ret;
-
-    /* gather all streams */
-    for(stream = first_stream; stream != NULL; stream = stream_next) {
-        stream_next = stream->next;
-        if (stream->stream_type == STREAM_TYPE_LIVE &&
-            !stream->feed) {
-            /* the stream comes from a file */
-            /* try to open the file */
-            /* open stream */
-            stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
-            if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
-                /* specific case : if transport stream output to RTP,
-                   we use a raw transport stream reader */
-                stream->ap_in->mpeg2ts_raw = 1;
-                stream->ap_in->mpeg2ts_compute_pcr = 1;
-            }
-
-            http_log("Opening file '%s'\n", stream->feed_filename);
-            if ((ret = av_open_input_file(&infile, stream->feed_filename,
-                                          stream->ifmt, 0, stream->ap_in)) < 0) {
-                http_log("Could not open '%s': %d\n", stream->feed_filename, ret);
-                /* remove stream (no need to spend more time on it) */
-            fail:
-                remove_stream(stream);
-            } else {
-                /* find all the AVStreams inside and reference them in
-                   'stream' */
-                if (av_find_stream_info(infile) < 0) {
-                    http_log("Could not find codec parameters from '%s'\n",
-                             stream->feed_filename);
-                    av_close_input_file(infile);
-                    goto fail;
-                }
-                extract_mpeg4_header(infile);
-
-                for(i=0;i<infile->nb_streams;i++)
-                    add_av_stream1(stream, infile->streams[i]->codec, 1);
-
-                av_close_input_file(infile);
-            }
-        }
-    }
-}
-
-/* compute the needed AVStream for each feed */
-static void build_feed_streams(void)
-{
-    FFStream *stream, *feed;
-    int i;
-
-    /* gather all streams */
-    for(stream = first_stream; stream != NULL; stream = stream->next) {
-        feed = stream->feed;
-        if (feed) {
-            if (!stream->is_feed) {
-                /* we handle a stream coming from a feed */
-                for(i=0;i<stream->nb_streams;i++)
-                    stream->feed_streams[i] = add_av_stream(feed, stream->streams[i]);
-            }
-        }
-    }
-
-    /* gather all streams */
-    for(stream = first_stream; stream != NULL; stream = stream->next) {
-        feed = stream->feed;
-        if (feed) {
-            if (stream->is_feed) {
-                for(i=0;i<stream->nb_streams;i++)
-                    stream->feed_streams[i] = i;
-            }
-        }
-    }
-
-    /* create feed files if needed */
-    for(feed = first_feed; feed != NULL; feed = feed->next_feed) {
-        int fd;
-
-        if (url_exist(feed->feed_filename)) {
-            /* See if it matches */
-            AVFormatContext *s;
-            int matches = 0;
-
-            if (av_open_input_file(&s, feed->feed_filename, NULL, FFM_PACKET_SIZE, NULL) >= 0) {
-                /* Now see if it matches */
-                if (s->nb_streams == feed->nb_streams) {
-                    matches = 1;
-                    for(i=0;i<s->nb_streams;i++) {
-                        AVStream *sf, *ss;
-                        sf = feed->streams[i];
-                        ss = s->streams[i];
-
-                        if (sf->index != ss->index ||
-                            sf->id != ss->id) {
-                            http_log("Index & Id do not match for stream %d (%s)\n",
-                                   i, feed->feed_filename);
-                            matches = 0;
-                        } else {
-                            AVCodecContext *ccf, *ccs;
-
-                            ccf = sf->codec;
-                            ccs = ss->codec;
-#define CHECK_CODEC(x)  (ccf->x != ccs->x)
-
-                            if (CHECK_CODEC(codec_id) || CHECK_CODEC(codec_type)) {
-                                http_log("Codecs do not match for stream %d\n", i);
-                                matches = 0;
-                            } else if (CHECK_CODEC(bit_rate) || CHECK_CODEC(flags)) {
-                                http_log("Codec bitrates do not match for stream %d\n", i);
-                                matches = 0;
-                            } else if (ccf->codec_type == AVMEDIA_TYPE_VIDEO) {
-                                if (CHECK_CODEC(time_base.den) ||
-                                    CHECK_CODEC(time_base.num) ||
-                                    CHECK_CODEC(width) ||
-                                    CHECK_CODEC(height)) {
-                                    http_log("Codec width, height and framerate do not match for stream %d\n", i);
-                                    matches = 0;
-                                }
-                            } else if (ccf->codec_type == AVMEDIA_TYPE_AUDIO) {
-                                if (CHECK_CODEC(sample_rate) ||
-                                    CHECK_CODEC(channels) ||
-                                    CHECK_CODEC(frame_size)) {
-                                    http_log("Codec sample_rate, channels, frame_size do not match for stream %d\n", i);
-                                    matches = 0;
-                                }
-                            } else {
-                                http_log("Unknown codec type\n");
-                                matches = 0;
-                            }
-                        }
-                        if (!matches)
-                            break;
-                    }
-                } else
-                    http_log("Deleting feed file '%s' as stream counts differ (%d != %d)\n",
-                        feed->feed_filename, s->nb_streams, feed->nb_streams);
-
-                av_close_input_file(s);
-            } else
-                http_log("Deleting feed file '%s' as it appears to be corrupt\n",
-                        feed->feed_filename);
-
-            if (!matches) {
-                if (feed->readonly) {
-                    http_log("Unable to delete feed file '%s' as it is marked readonly\n",
-                        feed->feed_filename);
-                    exit(1);
-                }
-                unlink(feed->feed_filename);
-            }
-        }
-        if (!url_exist(feed->feed_filename)) {
-            AVFormatContext s1 = {0}, *s = &s1;
-
-            if (feed->readonly) {
-                http_log("Unable to create feed file '%s' as it is marked readonly\n",
-                    feed->feed_filename);
-                exit(1);
-            }
-
-            /* only write the header of the ffm file */
-            if (url_fopen(&s->pb, feed->feed_filename, URL_WRONLY) < 0) {
-                http_log("Could not open output feed file '%s'\n",
-                         feed->feed_filename);
-                exit(1);
-            }
-            s->oformat = feed->fmt;
-            s->nb_streams = feed->nb_streams;
-            for(i=0;i<s->nb_streams;i++) {
-                AVStream *st;
-                st = feed->streams[i];
-                s->streams[i] = st;
-            }
-            av_set_parameters(s, NULL);
-            if (av_write_header(s) < 0) {
-                http_log("Container doesn't supports the required parameters\n");
-                exit(1);
-            }
-            /* XXX: need better api */
-            av_freep(&s->priv_data);
-            url_fclose(s->pb);
-        }
-        /* get feed size and write index */
-        fd = open(feed->feed_filename, O_RDONLY);
-        if (fd < 0) {
-            http_log("Could not open output feed file '%s'\n",
-                    feed->feed_filename);
-            exit(1);
-        }
-
-        feed->feed_write_index = FFMAX(ffm_read_write_index(fd), FFM_PACKET_SIZE);
-        feed->feed_size = lseek(fd, 0, SEEK_END);
-        /* ensure that we do not wrap before the end of file */
-        if (feed->feed_max_size && feed->feed_max_size < feed->feed_size)
-            feed->feed_max_size = feed->feed_size;
-
-        close(fd);
-    }
-}
-
-/* compute the bandwidth used by each stream */
-static void compute_bandwidth(void)
-{
-    unsigned bandwidth;
-    int i;
-    FFStream *stream;
-
-    for(stream = first_stream; stream != NULL; stream = stream->next) {
-        bandwidth = 0;
-        for(i=0;i<stream->nb_streams;i++) {
-            AVStream *st = stream->streams[i];
-            switch(st->codec->codec_type) {
-            case AVMEDIA_TYPE_AUDIO:
-            case AVMEDIA_TYPE_VIDEO:
-                bandwidth += st->codec->bit_rate;
-                break;
-            default:
-                break;
-            }
-        }
-        stream->bandwidth = (bandwidth + 999) / 1000;
-    }
-}
-
-/* add a codec and set the default parameters */
-static void add_codec(FFStream *stream, AVCodecContext *av)
-{
-    AVStream *st;
-
-    /* compute default parameters */
-    switch(av->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        if (av->bit_rate == 0)
-            av->bit_rate = 64000;
-        if (av->sample_rate == 0)
-            av->sample_rate = 22050;
-        if (av->channels == 0)
-            av->channels = 1;
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        if (av->bit_rate == 0)
-            av->bit_rate = 64000;
-        if (av->time_base.num == 0){
-            av->time_base.den = 5;
-            av->time_base.num = 1;
-        }
-        if (av->width == 0 || av->height == 0) {
-            av->width = 160;
-            av->height = 128;
-        }
-        /* Bitrate tolerance is less for streaming */
-        if (av->bit_rate_tolerance == 0)
-            av->bit_rate_tolerance = FFMAX(av->bit_rate / 4,
-                      (int64_t)av->bit_rate*av->time_base.num/av->time_base.den);
-        if (av->qmin == 0)
-            av->qmin = 3;
-        if (av->qmax == 0)
-            av->qmax = 31;
-        if (av->max_qdiff == 0)
-            av->max_qdiff = 3;
-        av->qcompress = 0.5;
-        av->qblur = 0.5;
-
-        if (!av->nsse_weight)
-            av->nsse_weight = 8;
-
-        av->frame_skip_cmp = FF_CMP_DCTMAX;
-        av->me_method = ME_EPZS;
-        av->rc_buffer_aggressivity = 1.0;
-
-        if (!av->rc_eq)
-            av->rc_eq = "tex^qComp";
-        if (!av->i_quant_factor)
-            av->i_quant_factor = -0.8;
-        if (!av->b_quant_factor)
-            av->b_quant_factor = 1.25;
-        if (!av->b_quant_offset)
-            av->b_quant_offset = 1.25;
-        if (!av->rc_max_rate)
-            av->rc_max_rate = av->bit_rate * 2;
-
-        if (av->rc_max_rate && !av->rc_buffer_size) {
-            av->rc_buffer_size = av->rc_max_rate;
-        }
-
-
-        break;
-    default:
-        abort();
-    }
-
-    st = av_mallocz(sizeof(AVStream));
-    if (!st)
-        return;
-    st->codec = avcodec_alloc_context();
-    stream->streams[stream->nb_streams++] = st;
-    memcpy(st->codec, av, sizeof(AVCodecContext));
-}
-
-static enum CodecID opt_audio_codec(const char *arg)
-{
-    AVCodec *p= avcodec_find_encoder_by_name(arg);
-
-    if (p == NULL || p->type != AVMEDIA_TYPE_AUDIO)
-        return CODEC_ID_NONE;
-
-    return p->id;
-}
-
-static enum CodecID opt_video_codec(const char *arg)
-{
-    AVCodec *p= avcodec_find_encoder_by_name(arg);
-
-    if (p == NULL || p->type != AVMEDIA_TYPE_VIDEO)
-        return CODEC_ID_NONE;
-
-    return p->id;
-}
-
-/* simplistic plugin support */
-
-#if HAVE_DLOPEN
-static void load_module(const char *filename)
-{
-    void *dll;
-    void (*init_func)(void);
-    dll = dlopen(filename, RTLD_NOW);
-    if (!dll) {
-        fprintf(stderr, "Could not load module '%s' - %s\n",
-                filename, dlerror());
-        return;
-    }
-
-    init_func = dlsym(dll, "ffserver_module_init");
-    if (!init_func) {
-        fprintf(stderr,
-                "%s: init function 'ffserver_module_init()' not found\n",
-                filename);
-        dlclose(dll);
-    }
-
-    init_func();
-}
-#endif
-
-static int ffserver_opt_default(const char *opt, const char *arg,
-                       AVCodecContext *avctx, int type)
-{
-    int ret = 0;
-    const AVOption *o = av_find_opt(avctx, opt, NULL, type, type);
-    if(o)
-        ret = av_set_string3(avctx, opt, arg, 1, NULL);
-    return ret;
-}
-
-static AVOutputFormat *ffserver_guess_format(const char *short_name, const char *filename,
-                                             const char *mime_type)
-{
-    AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type);
-
-    if (fmt) {
-        AVOutputFormat *stream_fmt;
-        char stream_format_name[64];
-
-        snprintf(stream_format_name, sizeof(stream_format_name), "%s_stream", fmt->name);
-        stream_fmt = av_guess_format(stream_format_name, NULL, NULL);
-
-        if (stream_fmt)
-            fmt = stream_fmt;
-    }
-
-    return fmt;
-}
-
-static void report_config_error(const char *filename, int line_num, int *errors, const char *fmt, ...)
-{
-    va_list vl;
-    va_start(vl, fmt);
-    fprintf(stderr, "%s:%d: ", filename, line_num);
-    vfprintf(stderr, fmt, vl);
-    va_end(vl);
-
-    (*errors)++;
-}
-
-static int parse_ffconfig(const char *filename)
-{
-    FILE *f;
-    char line[1024];
-    char cmd[64];
-    char arg[1024];
-    const char *p;
-    int val, errors, line_num;
-    FFStream **last_stream, *stream, *redirect;
-    FFStream **last_feed, *feed, *s;
-    AVCodecContext audio_enc, video_enc;
-    enum CodecID audio_id, video_id;
-
-    f = fopen(filename, "r");
-    if (!f) {
-        perror(filename);
-        return -1;
-    }
-
-    errors = 0;
-    line_num = 0;
-    first_stream = NULL;
-    last_stream = &first_stream;
-    first_feed = NULL;
-    last_feed = &first_feed;
-    stream = NULL;
-    feed = NULL;
-    redirect = NULL;
-    audio_id = CODEC_ID_NONE;
-    video_id = CODEC_ID_NONE;
-
-#define ERROR(...) report_config_error(filename, line_num, &errors, __VA_ARGS__)
-    for(;;) {
-        if (fgets(line, sizeof(line), f) == NULL)
-            break;
-        line_num++;
-        p = line;
-        while (isspace(*p))
-            p++;
-        if (*p == '\0' || *p == '#')
-            continue;
-
-        get_arg(cmd, sizeof(cmd), &p);
-
-        if (!strcasecmp(cmd, "Port")) {
-            get_arg(arg, sizeof(arg), &p);
-            val = atoi(arg);
-            if (val < 1 || val > 65536) {
-                ERROR("Invalid_port: %s\n", arg);
-            }
-            my_http_addr.sin_port = htons(val);
-        } else if (!strcasecmp(cmd, "BindAddress")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
-                ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
-            }
-        } else if (!strcasecmp(cmd, "NoDaemon")) {
-            ffserver_daemon = 0;
-        } else if (!strcasecmp(cmd, "RTSPPort")) {
-            get_arg(arg, sizeof(arg), &p);
-            val = atoi(arg);
-            if (val < 1 || val > 65536) {
-                ERROR("%s:%d: Invalid port: %s\n", arg);
-            }
-            my_rtsp_addr.sin_port = htons(atoi(arg));
-        } else if (!strcasecmp(cmd, "RTSPBindAddress")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) {
-                ERROR("Invalid host/IP address: %s\n", arg);
-            }
-        } else if (!strcasecmp(cmd, "MaxHTTPConnections")) {
-            get_arg(arg, sizeof(arg), &p);
-            val = atoi(arg);
-            if (val < 1 || val > 65536) {
-                ERROR("Invalid MaxHTTPConnections: %s\n", arg);
-            }
-            nb_max_http_connections = val;
-        } else if (!strcasecmp(cmd, "MaxClients")) {
-            get_arg(arg, sizeof(arg), &p);
-            val = atoi(arg);
-            if (val < 1 || val > nb_max_http_connections) {
-                ERROR("Invalid MaxClients: %s\n", arg);
-            } else {
-                nb_max_connections = val;
-            }
-        } else if (!strcasecmp(cmd, "MaxBandwidth")) {
-            int64_t llval;
-            get_arg(arg, sizeof(arg), &p);
-            llval = atoll(arg);
-            if (llval < 10 || llval > 10000000) {
-                ERROR("Invalid MaxBandwidth: %s\n", arg);
-            } else
-                max_bandwidth = llval;
-        } else if (!strcasecmp(cmd, "CustomLog")) {
-            if (!ffserver_debug)
-                get_arg(logfilename, sizeof(logfilename), &p);
-        } else if (!strcasecmp(cmd, "<Feed")) {
-            /*********************************************/
-            /* Feed related options */
-            char *q;
-            if (stream || feed) {
-                ERROR("Already in a tag\n");
-            } else {
-                feed = av_mallocz(sizeof(FFStream));
-                get_arg(feed->filename, sizeof(feed->filename), &p);
-                q = strrchr(feed->filename, '>');
-                if (*q)
-                    *q = '\0';
-
-                for (s = first_feed; s; s = s->next) {
-                    if (!strcmp(feed->filename, s->filename)) {
-                        ERROR("Feed '%s' already registered\n", s->filename);
-                    }
-                }
-
-                feed->fmt = av_guess_format("ffm", NULL, NULL);
-                /* defaut feed file */
-                snprintf(feed->feed_filename, sizeof(feed->feed_filename),
-                         "/tmp/%s.ffm", feed->filename);
-                feed->feed_max_size = 5 * 1024 * 1024;
-                feed->is_feed = 1;
-                feed->feed = feed; /* self feeding :-) */
-
-                /* add in stream list */
-                *last_stream = feed;
-                last_stream = &feed->next;
-                /* add in feed list */
-                *last_feed = feed;
-                last_feed = &feed->next_feed;
-            }
-        } else if (!strcasecmp(cmd, "Launch")) {
-            if (feed) {
-                int i;
-
-                feed->child_argv = av_mallocz(64 * sizeof(char *));
-
-                for (i = 0; i < 62; i++) {
-                    get_arg(arg, sizeof(arg), &p);
-                    if (!arg[0])
-                        break;
-
-                    feed->child_argv[i] = av_strdup(arg);
-                }
-
-                feed->child_argv[i] = av_malloc(30 + strlen(feed->filename));
-
-                snprintf(feed->child_argv[i], 30+strlen(feed->filename),
-                    "http://%s:%d/%s",
-                        (my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" :
-                    inet_ntoa(my_http_addr.sin_addr),
-                    ntohs(my_http_addr.sin_port), feed->filename);
-            }
-        } else if (!strcasecmp(cmd, "ReadOnlyFile")) {
-            if (feed) {
-                get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
-                feed->readonly = 1;
-            } else if (stream) {
-                get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
-            }
-        } else if (!strcasecmp(cmd, "File")) {
-            if (feed) {
-                get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
-            } else if (stream)
-                get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
-        } else if (!strcasecmp(cmd, "Truncate")) {
-            if (feed) {
-                get_arg(arg, sizeof(arg), &p);
-                feed->truncate = strtod(arg, NULL);
-            }
-        } else if (!strcasecmp(cmd, "FileMaxSize")) {
-            if (feed) {
-                char *p1;
-                double fsize;
-
-                get_arg(arg, sizeof(arg), &p);
-                p1 = arg;
-                fsize = strtod(p1, &p1);
-                switch(toupper(*p1)) {
-                case 'K':
-                    fsize *= 1024;
-                    break;
-                case 'M':
-                    fsize *= 1024 * 1024;
-                    break;
-                case 'G':
-                    fsize *= 1024 * 1024 * 1024;
-                    break;
-                }
-                feed->feed_max_size = (int64_t)fsize;
-                if (feed->feed_max_size < FFM_PACKET_SIZE*4) {
-                    ERROR("Feed max file size is too small, must be at least %d\n", FFM_PACKET_SIZE*4);
-                }
-            }
-        } else if (!strcasecmp(cmd, "</Feed>")) {
-            if (!feed) {
-                ERROR("No corresponding <Feed> for </Feed>\n");
-            }
-            feed = NULL;
-        } else if (!strcasecmp(cmd, "<Stream")) {
-            /*********************************************/
-            /* Stream related options */
-            char *q;
-            if (stream || feed) {
-                ERROR("Already in a tag\n");
-            } else {
-                FFStream *s;
-                stream = av_mallocz(sizeof(FFStream));
-                get_arg(stream->filename, sizeof(stream->filename), &p);
-                q = strrchr(stream->filename, '>');
-                if (*q)
-                    *q = '\0';
-
-                for (s = first_stream; s; s = s->next) {
-                    if (!strcmp(stream->filename, s->filename)) {
-                        ERROR("Stream '%s' already registered\n", s->filename);
-                    }
-                }
-
-                stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
-                avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);
-                avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);
-                audio_id = CODEC_ID_NONE;
-                video_id = CODEC_ID_NONE;
-                if (stream->fmt) {
-                    audio_id = stream->fmt->audio_codec;
-                    video_id = stream->fmt->video_codec;
-                }
-
-                *last_stream = stream;
-                last_stream = &stream->next;
-            }
-        } else if (!strcasecmp(cmd, "Feed")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                FFStream *sfeed;
-
-                sfeed = first_feed;
-                while (sfeed != NULL) {
-                    if (!strcmp(sfeed->filename, arg))
-                        break;
-                    sfeed = sfeed->next_feed;
-                }
-                if (!sfeed)
-                    ERROR("feed '%s' not defined\n", arg);
-                else
-                    stream->feed = sfeed;
-            }
-        } else if (!strcasecmp(cmd, "Format")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                if (!strcmp(arg, "status")) {
-                    stream->stream_type = STREAM_TYPE_STATUS;
-                    stream->fmt = NULL;
-                } else {
-                    stream->stream_type = STREAM_TYPE_LIVE;
-                    /* jpeg cannot be used here, so use single frame jpeg */
-                    if (!strcmp(arg, "jpeg"))
-                        strcpy(arg, "mjpeg");
-                    stream->fmt = ffserver_guess_format(arg, NULL, NULL);
-                    if (!stream->fmt) {
-                        ERROR("Unknown Format: %s\n", arg);
-                    }
-                }
-                if (stream->fmt) {
-                    audio_id = stream->fmt->audio_codec;
-                    video_id = stream->fmt->video_codec;
-                }
-            }
-        } else if (!strcasecmp(cmd, "InputFormat")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                stream->ifmt = av_find_input_format(arg);
-                if (!stream->ifmt) {
-                    ERROR("Unknown input format: %s\n", arg);
-                }
-            }
-        } else if (!strcasecmp(cmd, "FaviconURL")) {
-            if (stream && stream->stream_type == STREAM_TYPE_STATUS) {
-                get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
-            } else {
-                ERROR("FaviconURL only permitted for status streams\n");
-            }
-        } else if (!strcasecmp(cmd, "Author")) {
-            if (stream)
-                get_arg(stream->author, sizeof(stream->author), &p);
-        } else if (!strcasecmp(cmd, "Comment")) {
-            if (stream)
-                get_arg(stream->comment, sizeof(stream->comment), &p);
-        } else if (!strcasecmp(cmd, "Copyright")) {
-            if (stream)
-                get_arg(stream->copyright, sizeof(stream->copyright), &p);
-        } else if (!strcasecmp(cmd, "Title")) {
-            if (stream)
-                get_arg(stream->title, sizeof(stream->title), &p);
-        } else if (!strcasecmp(cmd, "Preroll")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                stream->prebuffer = atof(arg) * 1000;
-        } else if (!strcasecmp(cmd, "StartSendOnKey")) {
-            if (stream)
-                stream->send_on_key = 1;
-        } else if (!strcasecmp(cmd, "AudioCodec")) {
-            get_arg(arg, sizeof(arg), &p);
-            audio_id = opt_audio_codec(arg);
-            if (audio_id == CODEC_ID_NONE) {
-                ERROR("Unknown AudioCodec: %s\n", arg);
-            }
-        } else if (!strcasecmp(cmd, "VideoCodec")) {
-            get_arg(arg, sizeof(arg), &p);
-            video_id = opt_video_codec(arg);
-            if (video_id == CODEC_ID_NONE) {
-                ERROR("Unknown VideoCodec: %s\n", arg);
-            }
-        } else if (!strcasecmp(cmd, "MaxTime")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                stream->max_time = atof(arg) * 1000;
-        } else if (!strcasecmp(cmd, "AudioBitRate")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                audio_enc.bit_rate = atoi(arg) * 1000;
-        } else if (!strcasecmp(cmd, "AudioChannels")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                audio_enc.channels = atoi(arg);
-        } else if (!strcasecmp(cmd, "AudioSampleRate")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                audio_enc.sample_rate = atoi(arg);
-        } else if (!strcasecmp(cmd, "AudioQuality")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-//                audio_enc.quality = atof(arg) * 1000;
-            }
-        } else if (!strcasecmp(cmd, "VideoBitRateRange")) {
-            if (stream) {
-                int minrate, maxrate;
-
-                get_arg(arg, sizeof(arg), &p);
-
-                if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) {
-                    video_enc.rc_min_rate = minrate * 1000;
-                    video_enc.rc_max_rate = maxrate * 1000;
-                } else {
-                    ERROR("Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", arg);
-                }
-            }
-        } else if (!strcasecmp(cmd, "Debug")) {
-            if (stream) {
-                get_arg(arg, sizeof(arg), &p);
-                video_enc.debug = strtol(arg,0,0);
-            }
-        } else if (!strcasecmp(cmd, "Strict")) {
-            if (stream) {
-                get_arg(arg, sizeof(arg), &p);
-                video_enc.strict_std_compliance = atoi(arg);
-            }
-        } else if (!strcasecmp(cmd, "VideoBufferSize")) {
-            if (stream) {
-                get_arg(arg, sizeof(arg), &p);
-                video_enc.rc_buffer_size = atoi(arg) * 8*1024;
-            }
-        } else if (!strcasecmp(cmd, "VideoBitRateTolerance")) {
-            if (stream) {
-                get_arg(arg, sizeof(arg), &p);
-                video_enc.bit_rate_tolerance = atoi(arg) * 1000;
-            }
-        } else if (!strcasecmp(cmd, "VideoBitRate")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                video_enc.bit_rate = atoi(arg) * 1000;
-            }
-        } else if (!strcasecmp(cmd, "VideoSize")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg);
-                if ((video_enc.width % 16) != 0 ||
-                    (video_enc.height % 16) != 0) {
-                    ERROR("Image size must be a multiple of 16\n");
-                }
-            }
-        } else if (!strcasecmp(cmd, "VideoFrameRate")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                AVRational frame_rate;
-                if (av_parse_video_frame_rate(&frame_rate, arg) < 0) {
-                    ERROR("Incorrect frame rate: %s\n", arg);
-                } else {
-                    video_enc.time_base.num = frame_rate.den;
-                    video_enc.time_base.den = frame_rate.num;
-                }
-            }
-        } else if (!strcasecmp(cmd, "VideoGopSize")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                video_enc.gop_size = atoi(arg);
-        } else if (!strcasecmp(cmd, "VideoIntraOnly")) {
-            if (stream)
-                video_enc.gop_size = 1;
-        } else if (!strcasecmp(cmd, "VideoHighQuality")) {
-            if (stream)
-                video_enc.mb_decision = FF_MB_DECISION_BITS;
-        } else if (!strcasecmp(cmd, "Video4MotionVector")) {
-            if (stream) {
-                video_enc.mb_decision = FF_MB_DECISION_BITS; //FIXME remove
-                video_enc.flags |= CODEC_FLAG_4MV;
-            }
-        } else if (!strcasecmp(cmd, "AVOptionVideo") ||
-                   !strcasecmp(cmd, "AVOptionAudio")) {
-            char arg2[1024];
-            AVCodecContext *avctx;
-            int type;
-            get_arg(arg, sizeof(arg), &p);
-            get_arg(arg2, sizeof(arg2), &p);
-            if (!strcasecmp(cmd, "AVOptionVideo")) {
-                avctx = &video_enc;
-                type = AV_OPT_FLAG_VIDEO_PARAM;
-            } else {
-                avctx = &audio_enc;
-                type = AV_OPT_FLAG_AUDIO_PARAM;
-            }
-            if (ffserver_opt_default(arg, arg2, avctx, type|AV_OPT_FLAG_ENCODING_PARAM)) {
-                ERROR("AVOption error: %s %s\n", arg, arg2);
-            }
-        } else if (!strcasecmp(cmd, "VideoTag")) {
-            get_arg(arg, sizeof(arg), &p);
-            if ((strlen(arg) == 4) && stream)
-                video_enc.codec_tag = MKTAG(arg[0], arg[1], arg[2], arg[3]);
-        } else if (!strcasecmp(cmd, "BitExact")) {
-            if (stream)
-                video_enc.flags |= CODEC_FLAG_BITEXACT;
-        } else if (!strcasecmp(cmd, "DctFastint")) {
-            if (stream)
-                video_enc.dct_algo  = FF_DCT_FASTINT;
-        } else if (!strcasecmp(cmd, "IdctSimple")) {
-            if (stream)
-                video_enc.idct_algo = FF_IDCT_SIMPLE;
-        } else if (!strcasecmp(cmd, "Qscale")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                video_enc.flags |= CODEC_FLAG_QSCALE;
-                video_enc.global_quality = FF_QP2LAMBDA * atoi(arg);
-            }
-        } else if (!strcasecmp(cmd, "VideoQDiff")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                video_enc.max_qdiff = atoi(arg);
-                if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) {
-                    ERROR("VideoQDiff out of range\n");
-                }
-            }
-        } else if (!strcasecmp(cmd, "VideoQMax")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                video_enc.qmax = atoi(arg);
-                if (video_enc.qmax < 1 || video_enc.qmax > 31) {
-                    ERROR("VideoQMax out of range\n");
-                }
-            }
-        } else if (!strcasecmp(cmd, "VideoQMin")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                video_enc.qmin = atoi(arg);
-                if (video_enc.qmin < 1 || video_enc.qmin > 31) {
-                    ERROR("VideoQMin out of range\n");
-                }
-            }
-        } else if (!strcasecmp(cmd, "LumaElim")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                video_enc.luma_elim_threshold = atoi(arg);
-        } else if (!strcasecmp(cmd, "ChromaElim")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                video_enc.chroma_elim_threshold = atoi(arg);
-        } else if (!strcasecmp(cmd, "LumiMask")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                video_enc.lumi_masking = atof(arg);
-        } else if (!strcasecmp(cmd, "DarkMask")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                video_enc.dark_masking = atof(arg);
-        } else if (!strcasecmp(cmd, "NoVideo")) {
-            video_id = CODEC_ID_NONE;
-        } else if (!strcasecmp(cmd, "NoAudio")) {
-            audio_id = CODEC_ID_NONE;
-        } else if (!strcasecmp(cmd, "ACL")) {
-            parse_acl_row(stream, feed, NULL, p, filename, line_num);
-        } else if (!strcasecmp(cmd, "DynamicACL")) {
-            if (stream) {
-                get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), &p);
-            }
-        } else if (!strcasecmp(cmd, "RTSPOption")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                av_freep(&stream->rtsp_option);
-                stream->rtsp_option = av_strdup(arg);
-            }
-        } else if (!strcasecmp(cmd, "MulticastAddress")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream) {
-                if (resolve_host(&stream->multicast_ip, arg) != 0) {
-                    ERROR("Invalid host/IP address: %s\n", arg);
-                }
-                stream->is_multicast = 1;
-                stream->loop = 1; /* default is looping */
-            }
-        } else if (!strcasecmp(cmd, "MulticastPort")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                stream->multicast_port = atoi(arg);
-        } else if (!strcasecmp(cmd, "MulticastTTL")) {
-            get_arg(arg, sizeof(arg), &p);
-            if (stream)
-                stream->multicast_ttl = atoi(arg);
-        } else if (!strcasecmp(cmd, "NoLoop")) {
-            if (stream)
-                stream->loop = 0;
-        } else if (!strcasecmp(cmd, "</Stream>")) {
-            if (!stream) {
-                ERROR("No corresponding <Stream> for </Stream>\n");
-            } else {
-                if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) {
-                    if (audio_id != CODEC_ID_NONE) {
-                        audio_enc.codec_type = AVMEDIA_TYPE_AUDIO;
-                        audio_enc.codec_id = audio_id;
-                        add_codec(stream, &audio_enc);
-                    }
-                    if (video_id != CODEC_ID_NONE) {
-                        video_enc.codec_type = AVMEDIA_TYPE_VIDEO;
-                        video_enc.codec_id = video_id;
-                        add_codec(stream, &video_enc);
-                    }
-                }
-                stream = NULL;
-            }
-        } else if (!strcasecmp(cmd, "<Redirect")) {
-            /*********************************************/
-            char *q;
-            if (stream || feed || redirect) {
-                ERROR("Already in a tag\n");
-            } else {
-                redirect = av_mallocz(sizeof(FFStream));
-                *last_stream = redirect;
-                last_stream = &redirect->next;
-
-                get_arg(redirect->filename, sizeof(redirect->filename), &p);
-                q = strrchr(redirect->filename, '>');
-                if (*q)
-                    *q = '\0';
-                redirect->stream_type = STREAM_TYPE_REDIRECT;
-            }
-        } else if (!strcasecmp(cmd, "URL")) {
-            if (redirect)
-                get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p);
-        } else if (!strcasecmp(cmd, "</Redirect>")) {
-            if (!redirect) {
-                ERROR("No corresponding <Redirect> for </Redirect>\n");
-            } else {
-                if (!redirect->feed_filename[0]) {
-                    ERROR("No URL found for <Redirect>\n");
-                }
-                redirect = NULL;
-            }
-        } else if (!strcasecmp(cmd, "LoadModule")) {
-            get_arg(arg, sizeof(arg), &p);
-#if HAVE_DLOPEN
-            load_module(arg);
-#else
-            ERROR("Module support not compiled into this version: '%s'\n", arg);
-#endif
-        } else {
-            ERROR("Incorrect keyword: '%s'\n", cmd);
-        }
-    }
-#undef ERROR
-
-    fclose(f);
-    if (errors)
-        return -1;
-    else
-        return 0;
-}
-
-static void handle_child_exit(int sig)
-{
-    pid_t pid;
-    int status;
-
-    while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
-        FFStream *feed;
-
-        for (feed = first_feed; feed; feed = feed->next) {
-            if (feed->pid == pid) {
-                int uptime = time(0) - feed->pid_start;
-
-                feed->pid = 0;
-                fprintf(stderr, "%s: Pid %d exited with status %d after %d seconds\n", feed->filename, pid, status, uptime);
-
-                if (uptime < 30)
-                    /* Turn off any more restarts */
-                    feed->child_argv = 0;
-            }
-        }
-    }
-
-    need_to_start_children = 1;
-}
-
-static void opt_debug(void)
-{
-    ffserver_debug = 1;
-    ffserver_daemon = 0;
-    logfilename[0] = '-';
-}
-
-static void show_help(void)
-{
-    printf("usage: ffserver [options]\n"
-           "Hyper fast multi format Audio/Video streaming server\n");
-    printf("\n");
-    show_help_options(options, "Main options:\n", 0, 0);
-}
-
-static const OptionDef options[] = {
-#include "cmdutils_common_opts.h"
-    { "n", OPT_BOOL, {(void *)&no_launch }, "enable no-launch mode" },
-    { "d", 0, {(void*)opt_debug}, "enable debug mode" },
-    { "f", HAS_ARG | OPT_STRING, {(void*)&config_filename }, "use configfile instead of /etc/ffserver.conf", "configfile" },
-    { NULL },
-};
-
-int main(int argc, char **argv)
-{
-    struct sigaction sigact;
-
-    av_register_all();
-
-    show_banner();
-
-    my_program_name = argv[0];
-    my_program_dir = getcwd(0, 0);
-    ffserver_daemon = 1;
-
-    parse_options(argc, argv, options, NULL);
-
-    unsetenv("http_proxy");             /* Kill the http_proxy */
-
-    av_lfg_init(&random_state, ff_random_get_seed());
-
-    memset(&sigact, 0, sizeof(sigact));
-    sigact.sa_handler = handle_child_exit;
-    sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART;
-    sigaction(SIGCHLD, &sigact, 0);
-
-    if (parse_ffconfig(config_filename) < 0) {
-        fprintf(stderr, "Incorrect config file - exiting.\n");
-        exit(1);
-    }
-
-    /* open log file if needed */
-    if (logfilename[0] != '\0') {
-        if (!strcmp(logfilename, "-"))
-            logfile = stdout;
-        else
-            logfile = fopen(logfilename, "a");
-        av_log_set_callback(http_av_log);
-    }
-
-    build_file_streams();
-
-    build_feed_streams();
-
-    compute_bandwidth();
-
-    /* put the process in background and detach it from its TTY */
-    if (ffserver_daemon) {
-        int pid;
-
-        pid = fork();
-        if (pid < 0) {
-            perror("fork");
-            exit(1);
-        } else if (pid > 0) {
-            /* parent : exit */
-            exit(0);
-        } else {
-            /* child */
-            setsid();
-            close(0);
-            open("/dev/null", O_RDWR);
-            if (strcmp(logfilename, "-") != 0) {
-                close(1);
-                dup(0);
-            }
-            close(2);
-            dup(0);
-        }
-    }
-
-    /* signal init */
-    signal(SIGPIPE, SIG_IGN);
-
-    if (ffserver_daemon)
-        chdir("/");
-
-    if (http_server() < 0) {
-        http_log("Could not start server\n");
-        exit(1);
-    }
-
-    return 0;
-}
diff --git a/ffserver.h b/ffserver.h
deleted file mode 100644
index c76752f..0000000
--- a/ffserver.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Multiple format streaming server
- * copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef FFMPEG_FFSERVER_H
-#define FFMPEG_FFSERVER_H
-
-/* interface between ffserver and modules */
-
-void ffserver_module_init(void);
-
-#endif /* FFMPEG_FFSERVER_H */
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
deleted file mode 100644
index 2198503..0000000
--- a/libavcodec/4xm.c
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
- * 4XM codec
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * 4XM codec.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-#include "bytestream.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-#define BLOCK_TYPE_VLC_BITS 5
-#define ACDC_VLC_BITS 9
-
-#define CFRAME_BUFFER_COUNT 100
-
-static const uint8_t block_type_tab[2][4][8][2]={
- {
-  {   //{8,4,2}x{8,4,2}
-    { 0,1}, { 2,2}, { 6,3}, {14,4}, {30,5}, {31,5}, { 0,0}
-  },{ //{8,4}x1
-    { 0,1}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}, { 0,0}
-  },{ //1x{8,4}
-    { 0,1}, { 2,2}, { 0,0}, { 6,3}, {14,4}, {15,4}, { 0,0}
-  },{ //1x2, 2x1
-    { 0,1}, { 0,0}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}
-  }
- },{
-  {  //{8,4,2}x{8,4,2}
-    { 1,2}, { 4,3}, { 5,3}, {0,2}, {6,3}, {7,3}, {0,0}
-  },{//{8,4}x1
-    { 1,2}, { 0,0}, { 2,2}, {0,2}, {6,3}, {7,3}, {0,0}
-  },{//1x{8,4}
-    { 1,2}, { 2,2}, { 0,0}, {0,2}, {6,3}, {7,3}, {0,0}
-  },{//1x2, 2x1
-    { 1,2}, { 0,0}, { 0,0}, {0,2}, {2,2}, {6,3}, {7,3}
-  }
- }
-};
-
-static const uint8_t size2index[4][4]={
-  {-1, 3, 1, 1},
-  { 3, 0, 0, 0},
-  { 2, 0, 0, 0},
-  { 2, 0, 0, 0},
-};
-
-static const int8_t mv[256][2]={
-{  0,  0},{  0, -1},{ -1,  0},{  1,  0},{  0,  1},{ -1, -1},{  1, -1},{ -1,  1},
-{  1,  1},{  0, -2},{ -2,  0},{  2,  0},{  0,  2},{ -1, -2},{  1, -2},{ -2, -1},
-{  2, -1},{ -2,  1},{  2,  1},{ -1,  2},{  1,  2},{ -2, -2},{  2, -2},{ -2,  2},
-{  2,  2},{  0, -3},{ -3,  0},{  3,  0},{  0,  3},{ -1, -3},{  1, -3},{ -3, -1},
-{  3, -1},{ -3,  1},{  3,  1},{ -1,  3},{  1,  3},{ -2, -3},{  2, -3},{ -3, -2},
-{  3, -2},{ -3,  2},{  3,  2},{ -2,  3},{  2,  3},{  0, -4},{ -4,  0},{  4,  0},
-{  0,  4},{ -1, -4},{  1, -4},{ -4, -1},{  4, -1},{  4,  1},{ -1,  4},{  1,  4},
-{ -3, -3},{ -3,  3},{  3,  3},{ -2, -4},{ -4, -2},{  4, -2},{ -4,  2},{ -2,  4},
-{  2,  4},{ -3, -4},{  3, -4},{  4, -3},{ -5,  0},{ -4,  3},{ -3,  4},{  3,  4},
-{ -1, -5},{ -5, -1},{ -5,  1},{ -1,  5},{ -2, -5},{  2, -5},{  5, -2},{  5,  2},
-{ -4, -4},{ -4,  4},{ -3, -5},{ -5, -3},{ -5,  3},{  3,  5},{ -6,  0},{  0,  6},
-{ -6, -1},{ -6,  1},{  1,  6},{  2, -6},{ -6,  2},{  2,  6},{ -5, -4},{  5,  4},
-{  4,  5},{ -6, -3},{  6,  3},{ -7,  0},{ -1, -7},{  5, -5},{ -7,  1},{ -1,  7},
-{  4, -6},{  6,  4},{ -2, -7},{ -7,  2},{ -3, -7},{  7, -3},{  3,  7},{  6, -5},
-{  0, -8},{ -1, -8},{ -7, -4},{ -8,  1},{  4,  7},{  2, -8},{ -2,  8},{  6,  6},
-{ -8,  3},{  5, -7},{ -5,  7},{  8, -4},{  0, -9},{ -9, -1},{  1,  9},{  7, -6},
-{ -7,  6},{ -5, -8},{ -5,  8},{ -9,  3},{  9, -4},{  7, -7},{  8, -6},{  6,  8},
-{ 10,  1},{-10,  2},{  9, -5},{ 10, -3},{ -8, -7},{-10, -4},{  6, -9},{-11,  0},
-{ 11,  1},{-11, -2},{ -2, 11},{  7, -9},{ -7,  9},{ 10,  6},{ -4, 11},{  8, -9},
-{  8,  9},{  5, 11},{  7,-10},{ 12, -3},{ 11,  6},{ -9, -9},{  8, 10},{  5, 12},
-{-11,  7},{ 13,  2},{  6,-12},{ 10,  9},{-11,  8},{ -7, 12},{  0, 14},{ 14, -2},
-{ -9, 11},{ -6, 13},{-14, -4},{ -5,-14},{  5, 14},{-15, -1},{-14, -6},{  3,-15},
-{ 11,-11},{ -7, 14},{ -5, 15},{  8,-14},{ 15,  6},{  3, 16},{  7,-15},{-16,  5},
-{  0, 17},{-16, -6},{-10, 14},{-16,  7},{ 12, 13},{-16,  8},{-17,  6},{-18,  3},
-{ -7, 17},{ 15, 11},{ 16, 10},{  2,-19},{  3,-19},{-11,-16},{-18,  8},{-19, -6},
-{  2,-20},{-17,-11},{-10,-18},{  8, 19},{-21, -1},{-20,  7},{ -4, 21},{ 21,  5},
-{ 15, 16},{  2,-22},{-10,-20},{-22,  5},{ 20,-11},{ -7,-22},{-12, 20},{ 23, -5},
-{ 13,-20},{ 24, -2},{-15, 19},{-11, 22},{ 16, 19},{ 23,-10},{-18,-18},{ -9,-24},
-{ 24,-10},{ -3, 26},{-23, 13},{-18,-20},{ 17, 21},{ -4, 27},{ 27,  6},{  1,-28},
-{-11, 26},{-17,-23},{  7, 28},{ 11,-27},{ 29,  5},{-23,-19},{-28,-11},{-21, 22},
-{-30,  7},{-17, 26},{-27, 16},{ 13, 29},{ 19,-26},{ 10,-31},{-14,-30},{ 20,-27},
-{-29, 18},{-16,-31},{-28,-22},{ 21,-30},{-25, 28},{ 26,-29},{ 25,-32},{-32,-32}
-};
-
-// this is simply the scaled down elementwise product of the standard jpeg quantizer table and the AAN premul table
-static const uint8_t dequant_table[64]={
- 16, 15, 13, 19, 24, 31, 28, 17,
- 17, 23, 25, 31, 36, 63, 45, 21,
- 18, 24, 27, 37, 52, 59, 49, 20,
- 16, 28, 34, 40, 60, 80, 51, 20,
- 18, 31, 48, 66, 68, 86, 56, 21,
- 19, 38, 56, 59, 64, 64, 48, 20,
- 27, 48, 55, 55, 56, 51, 35, 15,
- 20, 35, 34, 32, 31, 22, 15,  8,
-};
-
-static VLC block_type_vlc[2][4];
-
-
-typedef struct CFrameBuffer{
-    unsigned int allocated_size;
-    unsigned int size;
-    int id;
-    uint8_t *data;
-}CFrameBuffer;
-
-typedef struct FourXContext{
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame current_picture, last_picture;
-    GetBitContext pre_gb;          ///< ac/dc prefix
-    GetBitContext gb;
-    const uint8_t *bytestream;
-    const uint16_t *wordstream;
-    int mv[256];
-    VLC pre_vlc;
-    int last_dc;
-    DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
-    void *bitstream_buffer;
-    unsigned int bitstream_buffer_size;
-    int version;
-    CFrameBuffer cfrm[CFRAME_BUFFER_COUNT];
-} FourXContext;
-
-
-#define FIX_1_082392200  70936
-#define FIX_1_414213562  92682
-#define FIX_1_847759065 121095
-#define FIX_2_613125930 171254
-
-#define MULTIPLY(var,const)  (((var)*(const)) >> 16)
-
-static void idct(DCTELEM block[64]){
-    int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-    int tmp10, tmp11, tmp12, tmp13;
-    int z5, z10, z11, z12, z13;
-    int i;
-    int temp[64];
-
-    for(i=0; i<8; i++){
-        tmp10 = block[8*0 + i] + block[8*4 + i];
-        tmp11 = block[8*0 + i] - block[8*4 + i];
-
-        tmp13 =          block[8*2 + i] + block[8*6 + i];
-        tmp12 = MULTIPLY(block[8*2 + i] - block[8*6 + i], FIX_1_414213562) - tmp13;
-
-        tmp0 = tmp10 + tmp13;
-        tmp3 = tmp10 - tmp13;
-        tmp1 = tmp11 + tmp12;
-        tmp2 = tmp11 - tmp12;
-
-        z13 = block[8*5 + i] + block[8*3 + i];
-        z10 = block[8*5 + i] - block[8*3 + i];
-        z11 = block[8*1 + i] + block[8*7 + i];
-        z12 = block[8*1 + i] - block[8*7 + i];
-
-        tmp7  =          z11 + z13;
-        tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
-
-        z5    = MULTIPLY(z10 + z12, FIX_1_847759065);
-        tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
-        tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
-
-        tmp6 = tmp12 - tmp7;
-        tmp5 = tmp11 - tmp6;
-        tmp4 = tmp10 + tmp5;
-
-        temp[8*0 + i] = tmp0 + tmp7;
-        temp[8*7 + i] = tmp0 - tmp7;
-        temp[8*1 + i] = tmp1 + tmp6;
-        temp[8*6 + i] = tmp1 - tmp6;
-        temp[8*2 + i] = tmp2 + tmp5;
-        temp[8*5 + i] = tmp2 - tmp5;
-        temp[8*4 + i] = tmp3 + tmp4;
-        temp[8*3 + i] = tmp3 - tmp4;
-    }
-
-    for(i=0; i<8*8; i+=8){
-        tmp10 = temp[0 + i] + temp[4 + i];
-        tmp11 = temp[0 + i] - temp[4 + i];
-
-        tmp13 = temp[2 + i] + temp[6 + i];
-        tmp12 = MULTIPLY(temp[2 + i] - temp[6 + i], FIX_1_414213562) - tmp13;
-
-        tmp0 = tmp10 + tmp13;
-        tmp3 = tmp10 - tmp13;
-        tmp1 = tmp11 + tmp12;
-        tmp2 = tmp11 - tmp12;
-
-        z13 = temp[5 + i] + temp[3 + i];
-        z10 = temp[5 + i] - temp[3 + i];
-        z11 = temp[1 + i] + temp[7 + i];
-        z12 = temp[1 + i] - temp[7 + i];
-
-        tmp7 = z11 + z13;
-        tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
-
-        z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
-        tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
-        tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
-
-        tmp6 = tmp12 - tmp7;
-        tmp5 = tmp11 - tmp6;
-        tmp4 = tmp10 + tmp5;
-
-        block[0 + i] = (tmp0 + tmp7)>>6;
-        block[7 + i] = (tmp0 - tmp7)>>6;
-        block[1 + i] = (tmp1 + tmp6)>>6;
-        block[6 + i] = (tmp1 - tmp6)>>6;
-        block[2 + i] = (tmp2 + tmp5)>>6;
-        block[5 + i] = (tmp2 - tmp5)>>6;
-        block[4 + i] = (tmp3 + tmp4)>>6;
-        block[3 + i] = (tmp3 - tmp4)>>6;
-    }
-}
-
-static av_cold void init_vlcs(FourXContext *f){
-    static VLC_TYPE table[8][32][2];
-    int i;
-
-    for(i=0; i<8; i++){
-        block_type_vlc[0][i].table= table[i];
-        block_type_vlc[0][i].table_allocated= 32;
-        init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7,
-                 &block_type_tab[0][i][0][1], 2, 1,
-                 &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
-    }
-}
-
-static void init_mv(FourXContext *f){
-    int i;
-
-    for(i=0; i<256; i++){
-        if(f->version>1)
-            f->mv[i] = mv[i][0]   + mv[i][1]  *f->current_picture.linesize[0]/2;
-        else
-            f->mv[i] = (i&15) - 8 + ((i>>4)-8)*f->current_picture.linesize[0]/2;
-    }
-}
-
-static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, int dc){
-   int i;
-   dc*= 0x10001;
-
-   switch(log2w){
-   case 0:
-        for(i=0; i<h; i++){
-            dst[0] = scale*src[0] + dc;
-            if(scale) src += stride;
-            dst += stride;
-        }
-        break;
-    case 1:
-        for(i=0; i<h; i++){
-            ((uint32_t*)dst)[0] = scale*((uint32_t*)src)[0] + dc;
-            if(scale) src += stride;
-            dst += stride;
-        }
-        break;
-    case 2:
-        for(i=0; i<h; i++){
-            ((uint32_t*)dst)[0] = scale*((uint32_t*)src)[0] + dc;
-            ((uint32_t*)dst)[1] = scale*((uint32_t*)src)[1] + dc;
-            if(scale) src += stride;
-            dst += stride;
-        }
-        break;
-    case 3:
-        for(i=0; i<h; i++){
-            ((uint32_t*)dst)[0] = scale*((uint32_t*)src)[0] + dc;
-            ((uint32_t*)dst)[1] = scale*((uint32_t*)src)[1] + dc;
-            ((uint32_t*)dst)[2] = scale*((uint32_t*)src)[2] + dc;
-            ((uint32_t*)dst)[3] = scale*((uint32_t*)src)[3] + dc;
-            if(scale) src += stride;
-            dst += stride;
-        }
-        break;
-    default: assert(0);
-    }
-}
-
-static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int log2w, int log2h, int stride){
-    const int index= size2index[log2h][log2w];
-    const int h= 1<<log2h;
-    int code= get_vlc2(&f->gb, block_type_vlc[1-(f->version>1)][index].table, BLOCK_TYPE_VLC_BITS, 1);
-    uint16_t *start= (uint16_t*)f->last_picture.data[0];
-    uint16_t *end= start + stride*(f->avctx->height-h+1) - (1<<log2w);
-
-    assert(code>=0 && code<=6);
-
-    if(code == 0){
-        src += f->mv[ *f->bytestream++ ];
-        if(start > src || src > end){
-            av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
-            return;
-        }
-        mcdc(dst, src, log2w, h, stride, 1, 0);
-    }else if(code == 1){
-        log2h--;
-        decode_p_block(f, dst                  , src                  , log2w, log2h, stride);
-        decode_p_block(f, dst + (stride<<log2h), src + (stride<<log2h), log2w, log2h, stride);
-    }else if(code == 2){
-        log2w--;
-        decode_p_block(f, dst             , src             , log2w, log2h, stride);
-        decode_p_block(f, dst + (1<<log2w), src + (1<<log2w), log2w, log2h, stride);
-    }else if(code == 3 && f->version<2){
-        mcdc(dst, src, log2w, h, stride, 1, 0);
-    }else if(code == 4){
-        src += f->mv[ *f->bytestream++ ];
-        if(start > src || src > end){
-            av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
-            return;
-        }
-        mcdc(dst, src, log2w, h, stride, 1, le2me_16(*f->wordstream++));
-    }else if(code == 5){
-        mcdc(dst, src, log2w, h, stride, 0, le2me_16(*f->wordstream++));
-    }else if(code == 6){
-        if(log2w){
-            dst[0] = le2me_16(*f->wordstream++);
-            dst[1] = le2me_16(*f->wordstream++);
-        }else{
-            dst[0     ] = le2me_16(*f->wordstream++);
-            dst[stride] = le2me_16(*f->wordstream++);
-        }
-    }
-}
-
-static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
-    int x, y;
-    const int width= f->avctx->width;
-    const int height= f->avctx->height;
-    uint16_t *src= (uint16_t*)f->last_picture.data[0];
-    uint16_t *dst= (uint16_t*)f->current_picture.data[0];
-    const int stride= f->current_picture.linesize[0]>>1;
-    unsigned int bitstream_size, bytestream_size, wordstream_size, extra;
-
-    if(f->version>1){
-        extra=20;
-        bitstream_size= AV_RL32(buf+8);
-        wordstream_size= AV_RL32(buf+12);
-        bytestream_size= AV_RL32(buf+16);
-    }else{
-        extra=0;
-        bitstream_size = AV_RL16(buf-4);
-        wordstream_size= AV_RL16(buf-2);
-        bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0);
-    }
-
-    if(bitstream_size+ bytestream_size+ wordstream_size + extra != length
-       || bitstream_size  > (1<<26)
-       || bytestream_size > (1<<26)
-       || wordstream_size > (1<<26)
-       ){
-        av_log(f->avctx, AV_LOG_ERROR, "lengths %d %d %d %d\n", bitstream_size, bytestream_size, wordstream_size,
-        bitstream_size+ bytestream_size+ wordstream_size - length);
-        return -1;
-    }
-
-    av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!f->bitstream_buffer)
-        return AVERROR(ENOMEM);
-    f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
-    init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
-
-    f->wordstream= (const uint16_t*)(buf + extra + bitstream_size);
-    f->bytestream= buf + extra + bitstream_size + wordstream_size;
-
-    init_mv(f);
-
-    for(y=0; y<height; y+=8){
-        for(x=0; x<width; x+=8){
-            decode_p_block(f, dst + x, src + x, 3, 3, stride);
-        }
-        src += 8*stride;
-        dst += 8*stride;
-    }
-
-    if(   bitstream_size != (get_bits_count(&f->gb)+31)/32*4
-       || (((const char*)f->wordstream - (const char*)buf + 2)&~2) != extra + bitstream_size + wordstream_size
-       || (((const char*)f->bytestream - (const char*)buf + 3)&~3) != extra + bitstream_size + wordstream_size + bytestream_size)
-        av_log(f->avctx, AV_LOG_ERROR, " %d %td %td bytes left\n",
-            bitstream_size - (get_bits_count(&f->gb)+31)/32*4,
-            -(((const char*)f->bytestream - (const char*)buf + 3)&~3) + (extra + bitstream_size + wordstream_size + bytestream_size),
-            -(((const char*)f->wordstream - (const char*)buf + 2)&~2) + (extra + bitstream_size + wordstream_size)
-        );
-
-    return 0;
-}
-
-/**
- * decode block and dequantize.
- * Note this is almost identical to MJPEG.
- */
-static int decode_i_block(FourXContext *f, DCTELEM *block){
-    int code, i, j, level, val;
-
-    /* DC coef */
-    val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
-    if (val>>4){
-        av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n");
-    }
-
-    if(val)
-        val = get_xbits(&f->gb, val);
-
-    val = val * dequant_table[0] + f->last_dc;
-    f->last_dc =
-    block[0] = val;
-    /* AC coefs */
-    i = 1;
-    for(;;) {
-        code = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
-
-        /* EOB */
-        if (code == 0)
-            break;
-        if (code == 0xf0) {
-            i += 16;
-        } else {
-            level = get_xbits(&f->gb, code & 0xf);
-            i += code >> 4;
-            if (i >= 64) {
-                av_log(f->avctx, AV_LOG_ERROR, "run %d oveflow\n", i);
-                return 0;
-            }
-
-            j= ff_zigzag_direct[i];
-            block[j] = level * dequant_table[j];
-            i++;
-            if (i >= 64)
-                break;
-        }
-    }
-
-    return 0;
-}
-
-static inline void idct_put(FourXContext *f, int x, int y){
-    DCTELEM (*block)[64]= f->block;
-    int stride= f->current_picture.linesize[0]>>1;
-    int i;
-    uint16_t *dst = ((uint16_t*)f->current_picture.data[0]) + y * stride + x;
-
-    for(i=0; i<4; i++){
-        block[i][0] += 0x80*8*8;
-        idct(block[i]);
-    }
-
-    if(!(f->avctx->flags&CODEC_FLAG_GRAY)){
-        for(i=4; i<6; i++) idct(block[i]);
-    }
-
-/* Note transform is:
-y= ( 1b + 4g + 2r)/14
-cb=( 3b - 2g - 1r)/14
-cr=(-1b - 4g + 5r)/14
-*/
-    for(y=0; y<8; y++){
-        for(x=0; x<8; x++){
-            DCTELEM *temp= block[(x>>2) + 2*(y>>2)] + 2*(x&3) + 2*8*(y&3); //FIXME optimize
-            int cb= block[4][x + 8*y];
-            int cr= block[5][x + 8*y];
-            int cg= (cb + cr)>>1;
-            int y;
-
-            cb+=cb;
-
-            y = temp[0];
-            dst[0       ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
-            y = temp[1];
-            dst[1       ]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
-            y = temp[8];
-            dst[  stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
-            y = temp[9];
-            dst[1+stride]= ((y+cb)>>3) + (((y-cg)&0xFC)<<3) + (((y+cr)&0xF8)<<8);
-            dst += 2;
-        }
-        dst += 2*stride - 2*8;
-    }
-}
-
-static int decode_i_mb(FourXContext *f){
-    int i;
-
-    f->dsp.clear_blocks(f->block[0]);
-
-    for(i=0; i<6; i++){
-        if(decode_i_block(f, f->block[i]) < 0)
-            return -1;
-    }
-
-    return 0;
-}
-
-static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t * const buf){
-    int frequency[512];
-    uint8_t flag[512];
-    int up[512];
-    uint8_t len_tab[257];
-    int bits_tab[257];
-    int start, end;
-    const uint8_t *ptr= buf;
-    int j;
-
-    memset(frequency, 0, sizeof(frequency));
-    memset(up, -1, sizeof(up));
-
-    start= *ptr++;
-    end= *ptr++;
-    for(;;){
-        int i;
-
-        for(i=start; i<=end; i++){
-            frequency[i]= *ptr++;
-        }
-        start= *ptr++;
-        if(start==0) break;
-
-        end= *ptr++;
-    }
-    frequency[256]=1;
-
-    while((ptr - buf)&3) ptr++; // 4byte align
-
-    for(j=257; j<512; j++){
-        int min_freq[2]= {256*256, 256*256};
-        int smallest[2]= {0, 0};
-        int i;
-        for(i=0; i<j; i++){
-            if(frequency[i] == 0) continue;
-            if(frequency[i] < min_freq[1]){
-                if(frequency[i] < min_freq[0]){
-                    min_freq[1]= min_freq[0]; smallest[1]= smallest[0];
-                    min_freq[0]= frequency[i];smallest[0]= i;
-                }else{
-                    min_freq[1]= frequency[i];smallest[1]= i;
-                }
-            }
-        }
-        if(min_freq[1] == 256*256) break;
-
-        frequency[j]= min_freq[0] + min_freq[1];
-        flag[ smallest[0] ]= 0;
-        flag[ smallest[1] ]= 1;
-        up[ smallest[0] ]=
-        up[ smallest[1] ]= j;
-        frequency[ smallest[0] ]= frequency[ smallest[1] ]= 0;
-    }
-
-    for(j=0; j<257; j++){
-        int node;
-        int len=0;
-        int bits=0;
-
-        for(node= j; up[node] != -1; node= up[node]){
-            bits += flag[node]<<len;
-            len++;
-            if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); //can this happen at all ?
-        }
-
-        bits_tab[j]= bits;
-        len_tab[j]= len;
-    }
-
-    init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257,
-             len_tab , 1, 1,
-             bits_tab, 4, 4, 0);
-
-    return ptr;
-}
-
-static int mix(int c0, int c1){
-    int blue = 2*(c0&0x001F) + (c1&0x001F);
-    int green= (2*(c0&0x03E0) + (c1&0x03E0))>>5;
-    int red  = 2*(c0>>10) + (c1>>10);
-    return red/3*1024 + green/3*32 + blue/3;
-}
-
-static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){
-    int x, y, x2, y2;
-    const int width= f->avctx->width;
-    const int height= f->avctx->height;
-    uint16_t *dst= (uint16_t*)f->current_picture.data[0];
-    const int stride= f->current_picture.linesize[0]>>1;
-
-    for(y=0; y<height; y+=16){
-        for(x=0; x<width; x+=16){
-            unsigned int color[4], bits;
-            memset(color, 0, sizeof(color));
-//warning following is purely guessed ...
-            color[0]= bytestream_get_le16(&buf);
-            color[1]= bytestream_get_le16(&buf);
-
-            if(color[0]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 1\n");
-            if(color[1]&0x8000) av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");
-
-            color[2]= mix(color[0], color[1]);
-            color[3]= mix(color[1], color[0]);
-
-            bits= bytestream_get_le32(&buf);
-            for(y2=0; y2<16; y2++){
-                for(x2=0; x2<16; x2++){
-                    int index= 2*(x2>>2) + 8*(y2>>2);
-                    dst[y2*stride+x2]= color[(bits>>index)&3];
-                }
-            }
-            dst+=16;
-        }
-        dst += 16*stride - width;
-    }
-
-    return 0;
-}
-
-static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
-    int x, y;
-    const int width= f->avctx->width;
-    const int height= f->avctx->height;
-    uint16_t *dst= (uint16_t*)f->current_picture.data[0];
-    const int stride= f->current_picture.linesize[0]>>1;
-    const unsigned int bitstream_size= AV_RL32(buf);
-    const int token_count av_unused = AV_RL32(buf + bitstream_size + 8);
-    unsigned int prestream_size= 4*AV_RL32(buf + bitstream_size + 4);
-    const uint8_t *prestream= buf + bitstream_size + 12;
-
-    if(prestream_size + bitstream_size + 12 != length
-       || bitstream_size > (1<<26)
-       || prestream_size > (1<<26)){
-        av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length);
-        return -1;
-    }
-
-    prestream= read_huffman_tables(f, prestream);
-
-    init_get_bits(&f->gb, buf + 4, 8*bitstream_size);
-
-    prestream_size= length + buf - prestream;
-
-    av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!f->bitstream_buffer)
-        return AVERROR(ENOMEM);
-    f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
-    init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size);
-
-    f->last_dc= 0*128*8*8;
-
-    for(y=0; y<height; y+=16){
-        for(x=0; x<width; x+=16){
-            if(decode_i_mb(f) < 0)
-                return -1;
-
-            idct_put(f, x, y);
-        }
-        dst += 16*stride;
-    }
-
-    if(get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
-        av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n");
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    FourXContext * const f = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame *p, temp;
-    int i, frame_4cc, frame_size;
-
-    frame_4cc= AV_RL32(buf);
-    if(buf_size != AV_RL32(buf+4)+8 || buf_size < 20){
-        av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n", buf_size, AV_RL32(buf+4));
-    }
-
-    if(frame_4cc == AV_RL32("cfrm")){
-        int free_index=-1;
-        const int data_size= buf_size - 20;
-        const int id= AV_RL32(buf+12);
-        const int whole_size= AV_RL32(buf+16);
-        CFrameBuffer *cfrm;
-
-        for(i=0; i<CFRAME_BUFFER_COUNT; i++){
-            if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
-                av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id);
-        }
-
-        for(i=0; i<CFRAME_BUFFER_COUNT; i++){
-            if(f->cfrm[i].id   == id) break;
-            if(f->cfrm[i].size == 0 ) free_index= i;
-        }
-
-        if(i>=CFRAME_BUFFER_COUNT){
-            i= free_index;
-            f->cfrm[i].id= id;
-        }
-        cfrm= &f->cfrm[i];
-
-        cfrm->data= av_fast_realloc(cfrm->data, &cfrm->allocated_size, cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE);
-        if(!cfrm->data){ //explicit check needed as memcpy below might not catch a NULL
-            av_log(f->avctx, AV_LOG_ERROR, "realloc falure");
-            return -1;
-        }
-
-        memcpy(cfrm->data + cfrm->size, buf+20, data_size);
-        cfrm->size += data_size;
-
-        if(cfrm->size >= whole_size){
-            buf= cfrm->data;
-            frame_size= cfrm->size;
-
-            if(id != avctx->frame_number){
-                av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", id, avctx->frame_number);
-            }
-
-            cfrm->size= cfrm->id= 0;
-            frame_4cc= AV_RL32("pfrm");
-        }else
-            return buf_size;
-    }else{
-        buf= buf + 12;
-        frame_size= buf_size - 12;
-    }
-
-    temp= f->current_picture;
-    f->current_picture= f->last_picture;
-    f->last_picture= temp;
-
-    p= &f->current_picture;
-    avctx->coded_frame= p;
-
-    avctx->flags |= CODEC_FLAG_EMU_EDGE; // alternatively we would have to use our own buffer management
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 1;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if(frame_4cc == AV_RL32("ifr2")){
-        p->pict_type= FF_I_TYPE;
-        if(decode_i2_frame(f, buf-4, frame_size) < 0)
-            return -1;
-    }else if(frame_4cc == AV_RL32("ifrm")){
-        p->pict_type= FF_I_TYPE;
-        if(decode_i_frame(f, buf, frame_size) < 0)
-            return -1;
-    }else if(frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")){
-        p->pict_type= FF_P_TYPE;
-        if(decode_p_frame(f, buf, frame_size) < 0)
-            return -1;
-    }else if(frame_4cc == AV_RL32("snd_")){
-        av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", buf_size);
-    }else{
-        av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
-    }
-
-    p->key_frame= p->pict_type == FF_I_TYPE;
-
-    *picture= *p;
-    *data_size = sizeof(AVPicture);
-
-    emms_c();
-
-    return buf_size;
-}
-
-
-static av_cold void common_init(AVCodecContext *avctx){
-    FourXContext * const f = avctx->priv_data;
-
-    dsputil_init(&f->dsp, avctx);
-
-    f->avctx= avctx;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-    FourXContext * const f = avctx->priv_data;
-
-    if(avctx->extradata_size != 4 || !avctx->extradata) {
-        av_log(avctx, AV_LOG_ERROR, "extradata wrong or missing\n");
-        return 1;
-    }
-
-    f->version= AV_RL32(avctx->extradata)>>16;
-    common_init(avctx);
-    init_vlcs(f);
-
-    if(f->version>2) avctx->pix_fmt= PIX_FMT_RGB565;
-    else             avctx->pix_fmt= PIX_FMT_BGR555;
-
-    return 0;
-}
-
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    FourXContext * const f = avctx->priv_data;
-    int i;
-
-    av_freep(&f->bitstream_buffer);
-    f->bitstream_buffer_size=0;
-    for(i=0; i<CFRAME_BUFFER_COUNT; i++){
-        av_freep(&f->cfrm[i].data);
-        f->cfrm[i].allocated_size= 0;
-    }
-    free_vlc(&f->pre_vlc);
-    if(f->current_picture.data[0])
-        avctx->release_buffer(avctx, &f->current_picture);
-    if(f->last_picture.data[0])
-        avctx->release_buffer(avctx, &f->last_picture);
-
-    return 0;
-}
-
-AVCodec fourxm_decoder = {
-    "4xm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_4XM,
-    sizeof(FourXContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
-};
-
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
deleted file mode 100644
index ff57955..0000000
--- a/libavcodec/8bps.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Quicktime Planar RGB (8BPS) Video Decoder
- * Copyright (C) 2003 Roberto Togni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QT 8BPS Video Decoder by Roberto Togni
- * For more information about the 8BPS format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *
- * Supports: PAL8 (RGB 8bpp, paletted)
- *         : BGR24 (RGB 24bpp) (can also output it as RGB32)
- *         : RGB32 (RGB 32bpp, 4th plane is probably alpha and it's ignored)
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-
-static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGB32, PIX_FMT_NONE};
-
-/*
- * Decoder context
- */
-typedef struct EightBpsContext {
-
-        AVCodecContext *avctx;
-        AVFrame pic;
-
-        unsigned char planes;
-        unsigned char planemap[4];
-} EightBpsContext;
-
-
-/*
- *
- * Decode a frame
- *
- */
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-        const uint8_t *buf = avpkt->data;
-        int buf_size = avpkt->size;
-        EightBpsContext * const c = avctx->priv_data;
-        const unsigned char *encoded = buf;
-        unsigned char *pixptr, *pixptr_end;
-        unsigned int height = avctx->height; // Real image height
-        unsigned int dlen, p, row;
-        const unsigned char *lp, *dp;
-        unsigned char count;
-        unsigned int px_inc;
-        unsigned int planes = c->planes;
-        unsigned char *planemap = c->planemap;
-
-        if(c->pic.data[0])
-                avctx->release_buffer(avctx, &c->pic);
-
-        c->pic.reference = 0;
-        c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-        if(avctx->get_buffer(avctx, &c->pic) < 0){
-                av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-                return -1;
-        }
-
-        /* Set data pointer after line lengths */
-        dp = encoded + planes * (height << 1);
-
-        /* Ignore alpha plane, don't know what to do with it */
-        if (planes == 4)
-                planes--;
-
-        px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGB32);
-
-        for (p = 0; p < planes; p++) {
-                /* Lines length pointer for this plane */
-                lp = encoded + p * (height << 1);
-
-                /* Decode a plane */
-                for(row = 0; row < height; row++) {
-                        pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
-                        pixptr_end = pixptr + c->pic.linesize[0];
-                        dlen = be2me_16(*(const unsigned short *)(lp+row*2));
-                        /* Decode a row of this plane */
-                        while(dlen > 0) {
-                                if(dp + 1 >= buf+buf_size) return -1;
-                                if ((count = *dp++) <= 127) {
-                                        count++;
-                                        dlen -= count + 1;
-                                        if (pixptr + count * px_inc > pixptr_end)
-                                            break;
-                                        if(dp + count > buf+buf_size) return -1;
-                                        while(count--) {
-                                                *pixptr = *dp++;
-                                                pixptr += px_inc;
-                                        }
-                                } else {
-                                        count = 257 - count;
-                                        if (pixptr + count * px_inc > pixptr_end)
-                                            break;
-                                        while(count--) {
-                                                *pixptr = *dp;
-                                                pixptr += px_inc;
-                                        }
-                                        dp++;
-                                        dlen -= 2;
-                                }
-                        }
-                }
-        }
-
-        if (avctx->palctrl) {
-                memcpy (c->pic.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
-                if (avctx->palctrl->palette_changed) {
-                        c->pic.palette_has_changed = 1;
-                        avctx->palctrl->palette_changed = 0;
-                } else
-                        c->pic.palette_has_changed = 0;
-        }
-
-        *data_size = sizeof(AVFrame);
-        *(AVFrame*)data = c->pic;
-
-        /* always report that the buffer was completely consumed */
-        return buf_size;
-}
-
-
-/*
- *
- * Init 8BPS decoder
- *
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-        EightBpsContext * const c = avctx->priv_data;
-
-        c->avctx = avctx;
-
-        c->pic.data[0] = NULL;
-
-        switch (avctx->bits_per_coded_sample) {
-                case 8:
-                        avctx->pix_fmt = PIX_FMT_PAL8;
-                        c->planes = 1;
-                        c->planemap[0] = 0; // 1st plane is palette indexes
-                        if (avctx->palctrl == NULL) {
-                                av_log(avctx, AV_LOG_ERROR, "Error: PAL8 format but no palette from demuxer.\n");
-                                return -1;
-                        }
-                        break;
-                case 24:
-                        avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24);
-                        c->planes = 3;
-                        c->planemap[0] = 2; // 1st plane is red
-                        c->planemap[1] = 1; // 2nd plane is green
-                        c->planemap[2] = 0; // 3rd plane is blue
-                        break;
-                case 32:
-                        avctx->pix_fmt = PIX_FMT_RGB32;
-                        c->planes = 4;
-#if HAVE_BIGENDIAN
-                        c->planemap[0] = 1; // 1st plane is red
-                        c->planemap[1] = 2; // 2nd plane is green
-                        c->planemap[2] = 3; // 3rd plane is blue
-                        c->planemap[3] = 0; // 4th plane is alpha???
-#else
-                        c->planemap[0] = 2; // 1st plane is red
-                        c->planemap[1] = 1; // 2nd plane is green
-                        c->planemap[2] = 0; // 3rd plane is blue
-                        c->planemap[3] = 3; // 4th plane is alpha???
-#endif
-                        break;
-                default:
-                        av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample);
-                        return -1;
-        }
-
-  return 0;
-}
-
-
-
-
-/*
- *
- * Uninit 8BPS decoder
- *
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-        EightBpsContext * const c = avctx->priv_data;
-
-        if (c->pic.data[0])
-                avctx->release_buffer(avctx, &c->pic);
-
-        return 0;
-}
-
-
-
-AVCodec eightbps_decoder = {
-        "8bps",
-        AVMEDIA_TYPE_VIDEO,
-        CODEC_ID_8BPS,
-        sizeof(EightBpsContext),
-        decode_init,
-        NULL,
-        decode_end,
-        decode_frame,
-        CODEC_CAP_DR1,
-        .long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
-};
diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
deleted file mode 100644
index 6e09b11..0000000
--- a/libavcodec/8svx.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 8SVX audio decoder
- * Copyright (C) 2008 Jaikrishnan Menon
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * 8svx audio decoder
- * @author Jaikrishnan Menon
- * supports: fibonacci delta encoding
- *         : exponential encoding
- */
-
-#include "avcodec.h"
-
-/** decoder context */
-typedef struct EightSvxContext {
-    int16_t fib_acc;
-    const int16_t *table;
-} EightSvxContext;
-
-static const int16_t fibonacci[16]   = { -34<<8, -21<<8, -13<<8,  -8<<8, -5<<8, -3<<8, -2<<8, -1<<8,
-                                          0, 1<<8, 2<<8, 3<<8, 5<<8, 8<<8, 13<<8, 21<<8 };
-static const int16_t exponential[16] = { -128<<8, -64<<8, -32<<8, -16<<8, -8<<8, -4<<8, -2<<8, -1<<8,
-                                          0, 1<<8, 2<<8, 4<<8, 8<<8, 16<<8, 32<<8, 64<<8 };
-
-/** decode a frame */
-static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    EightSvxContext *esc = avctx->priv_data;
-    int16_t *out_data = data;
-    int consumed = buf_size;
-    const uint8_t *buf_end = buf + buf_size;
-
-    if((*data_size >> 2) < buf_size)
-        return -1;
-
-    if(avctx->frame_number == 0) {
-        esc->fib_acc = buf[1] << 8;
-        buf_size -= 2;
-        buf += 2;
-    }
-
-    *data_size = buf_size << 2;
-
-    while(buf < buf_end) {
-        uint8_t d = *buf++;
-        esc->fib_acc += esc->table[d & 0x0f];
-        *out_data++ = esc->fib_acc;
-        esc->fib_acc += esc->table[d >> 4];
-        *out_data++ = esc->fib_acc;
-    }
-
-    return consumed;
-}
-
-/** initialize 8svx decoder */
-static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
-{
-    EightSvxContext *esc = avctx->priv_data;
-
-    switch(avctx->codec->id) {
-        case CODEC_ID_8SVX_FIB:
-          esc->table = fibonacci;
-          break;
-        case CODEC_ID_8SVX_EXP:
-          esc->table = exponential;
-          break;
-        default:
-          return -1;
-    }
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-AVCodec eightsvx_fib_decoder = {
-  .name           = "8svx_fib",
-  .type           = AVMEDIA_TYPE_AUDIO,
-  .id             = CODEC_ID_8SVX_FIB,
-  .priv_data_size = sizeof (EightSvxContext),
-  .init           = eightsvx_decode_init,
-  .decode         = eightsvx_decode_frame,
-  .long_name      = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
-};
-
-AVCodec eightsvx_exp_decoder = {
-  .name           = "8svx_exp",
-  .type           = AVMEDIA_TYPE_AUDIO,
-  .id             = CODEC_ID_8SVX_EXP,
-  .priv_data_size = sizeof (EightSvxContext),
-  .init           = eightsvx_decode_init,
-  .decode         = eightsvx_decode_frame,
-  .long_name      = NULL_IF_CONFIG_SMALL("8SVX exponential"),
-};
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
deleted file mode 100644
index 4547ef6..0000000
--- a/libavcodec/Makefile
+++ /dev/null
@@ -1,655 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = avcodec
-FFLIBS = avutil
-
-HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vdpau.h xvmc.h
-
-OBJS = allcodecs.o                                                      \
-       audioconvert.o                                                   \
-       avpacket.o                                                       \
-       bitstream.o                                                      \
-       bitstream_filter.o                                               \
-       dsputil.o                                                        \
-       eval.o                                                           \
-       faanidct.o                                                       \
-       imgconvert.o                                                     \
-       jrevdct.o                                                        \
-       opt.o                                                            \
-       options.o                                                        \
-       parser.o                                                         \
-       raw.o                                                            \
-       resample.o                                                       \
-       resample2.o                                                      \
-       simple_idct.o                                                    \
-       utils.o                                                          \
-
-# parts needed for many different codecs
-OBJS-$(CONFIG_AANDCT)                  += aandcttab.o
-OBJS-$(CONFIG_ENCODERS)                += faandct.o jfdctfst.o jfdctint.o
-OBJS-$(CONFIG_DCT)                     += dct.o
-OBJS-$(CONFIG_DWT)                     += dwt.o
-OBJS-$(CONFIG_DXVA2)                   += dxva2.o
-FFT-OBJS-$(CONFIG_HARDCODED_TABLES)    += cos_tables.o
-OBJS-$(CONFIG_FFT)                     += avfft.o fft.o $(FFT-OBJS-yes)
-OBJS-$(CONFIG_GOLOMB)                  += golomb.o
-OBJS-$(CONFIG_H264DSP)                 += h264dsp.o h264idct.o h264pred.o
-OBJS-$(CONFIG_LPC)                     += lpc.o
-OBJS-$(CONFIG_LSP)                     += lsp.o
-OBJS-$(CONFIG_MDCT)                    += mdct.o
-RDFT-OBJS-$(CONFIG_HARDCODED_TABLES)   += sin_tables.o
-OBJS-$(CONFIG_RDFT)                    += rdft.o $(RDFT-OBJS-yes)
-OBJS-$(CONFIG_VAAPI)                   += vaapi.o
-OBJS-$(CONFIG_VDPAU)                   += vdpau.o
-
-# decoders/encoders/hardware accelerators
-OBJS-$(CONFIG_AAC_DECODER)             += aacdec.o aactab.o aacsbr.o aacps.o
-OBJS-$(CONFIG_AAC_ENCODER)             += aacenc.o aaccoder.o    \
-                                          aacpsy.o aactab.o      \
-                                          psymodel.o iirfilter.o \
-                                          mpeg4audio.o
-OBJS-$(CONFIG_AASC_DECODER)            += aasc.o msrledec.o
-OBJS-$(CONFIG_AC3_DECODER)             += ac3dec.o ac3dec_data.o ac3.o
-OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc.o ac3tab.o ac3.o
-OBJS-$(CONFIG_ALAC_DECODER)            += alac.o
-OBJS-$(CONFIG_ALAC_ENCODER)            += alacenc.o
-OBJS-$(CONFIG_ALS_DECODER)             += alsdec.o bgmc.o mpeg4audio.o
-OBJS-$(CONFIG_AMRNB_DECODER)           += amrnbdec.o celp_filters.o   \
-                                          celp_math.o acelp_filters.o \
-                                          acelp_vectors.o             \
-                                          acelp_pitch_delay.o
-OBJS-$(CONFIG_AMV_DECODER)             += sp5xdec.o mjpegdec.o mjpeg.o
-OBJS-$(CONFIG_ANM_DECODER)             += anm.o
-OBJS-$(CONFIG_APE_DECODER)             += apedec.o
-OBJS-$(CONFIG_ASV1_DECODER)            += asv1.o mpeg12data.o
-OBJS-$(CONFIG_ASV1_ENCODER)            += asv1.o mpeg12data.o
-OBJS-$(CONFIG_ASV2_DECODER)            += asv1.o mpeg12data.o
-OBJS-$(CONFIG_ASV2_ENCODER)            += asv1.o mpeg12data.o
-OBJS-$(CONFIG_ATRAC1_DECODER)          += atrac1.o atrac.o
-OBJS-$(CONFIG_ATRAC3_DECODER)          += atrac3.o atrac.o
-OBJS-$(CONFIG_AURA_DECODER)            += cyuv.o
-OBJS-$(CONFIG_AURA2_DECODER)           += aura.o
-OBJS-$(CONFIG_AVS_DECODER)             += avs.o
-OBJS-$(CONFIG_BETHSOFTVID_DECODER)     += bethsoftvideo.o
-OBJS-$(CONFIG_BFI_DECODER)             += bfi.o
-OBJS-$(CONFIG_BINK_DECODER)            += bink.o binkidct.o
-OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER)   += binkaudio.o wma.o
-OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER)  += binkaudio.o wma.o
-OBJS-$(CONFIG_BMP_DECODER)             += bmp.o msrledec.o
-OBJS-$(CONFIG_BMP_ENCODER)             += bmpenc.o
-OBJS-$(CONFIG_C93_DECODER)             += c93.o
-OBJS-$(CONFIG_CAVS_DECODER)            += cavs.o cavsdec.o cavsdsp.o \
-                                          mpeg12data.o mpegvideo.o
-OBJS-$(CONFIG_CDGRAPHICS_DECODER)      += cdgraphics.o
-OBJS-$(CONFIG_CINEPAK_DECODER)         += cinepak.o
-OBJS-$(CONFIG_CLJR_DECODER)            += cljr.o
-OBJS-$(CONFIG_CLJR_ENCODER)            += cljr.o
-OBJS-$(CONFIG_COOK_DECODER)            += cook.o
-OBJS-$(CONFIG_CSCD_DECODER)            += cscd.o
-OBJS-$(CONFIG_CYUV_DECODER)            += cyuv.o
-OBJS-$(CONFIG_DCA_DECODER)             += dca.o synth_filter.o dcadsp.o
-OBJS-$(CONFIG_DNXHD_DECODER)           += dnxhddec.o dnxhddata.o
-OBJS-$(CONFIG_DNXHD_ENCODER)           += dnxhdenc.o dnxhddata.o       \
-                                          mpegvideo_enc.o motion_est.o \
-                                          ratecontrol.o mpeg12data.o   \
-                                          mpegvideo.o
-OBJS-$(CONFIG_DPX_DECODER)             += dpx.o
-OBJS-$(CONFIG_DSICINAUDIO_DECODER)     += dsicinav.o
-OBJS-$(CONFIG_DSICINVIDEO_DECODER)     += dsicinav.o
-OBJS-$(CONFIG_DVBSUB_DECODER)          += dvbsubdec.o
-OBJS-$(CONFIG_DVBSUB_ENCODER)          += dvbsub.o
-OBJS-$(CONFIG_DVDSUB_DECODER)          += dvdsubdec.o
-OBJS-$(CONFIG_DVDSUB_ENCODER)          += dvdsubenc.o
-OBJS-$(CONFIG_DVVIDEO_DECODER)         += dv.o dvdata.o
-OBJS-$(CONFIG_DVVIDEO_ENCODER)         += dv.o dvdata.o
-OBJS-$(CONFIG_DXA_DECODER)             += dxa.o
-OBJS-$(CONFIG_EAC3_DECODER)            += eac3dec.o eac3dec_data.o
-OBJS-$(CONFIG_EACMV_DECODER)           += eacmv.o
-OBJS-$(CONFIG_EAMAD_DECODER)           += eamad.o eaidct.o mpeg12.o \
-                                          mpeg12data.o mpegvideo.o  \
-                                          error_resilience.o
-OBJS-$(CONFIG_EATGQ_DECODER)           += eatgq.o eaidct.o
-OBJS-$(CONFIG_EATGV_DECODER)           += eatgv.o
-OBJS-$(CONFIG_EATQI_DECODER)           += eatqi.o eaidct.o mpeg12.o \
-                                          mpeg12data.o mpegvideo.o  \
-                                          error_resilience.o
-OBJS-$(CONFIG_EIGHTBPS_DECODER)        += 8bps.o
-OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER)    += 8svx.o
-OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER)    += 8svx.o
-OBJS-$(CONFIG_ESCAPE124_DECODER)       += escape124.o
-OBJS-$(CONFIG_FFV1_DECODER)            += ffv1.o rangecoder.o
-OBJS-$(CONFIG_FFV1_ENCODER)            += ffv1.o rangecoder.o
-OBJS-$(CONFIG_FFVHUFF_DECODER)         += huffyuv.o
-OBJS-$(CONFIG_FFVHUFF_ENCODER)         += huffyuv.o
-OBJS-$(CONFIG_FLAC_DECODER)            += flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_FLAC_ENCODER)            += flacenc.o flacdata.o flac.o
-OBJS-$(CONFIG_FLASHSV_DECODER)         += flashsv.o
-OBJS-$(CONFIG_FLASHSV_ENCODER)         += flashsvenc.o
-OBJS-$(CONFIG_FLIC_DECODER)            += flicvideo.o
-OBJS-$(CONFIG_FOURXM_DECODER)          += 4xm.o
-OBJS-$(CONFIG_FRAPS_DECODER)           += fraps.o huffman.o
-OBJS-$(CONFIG_FRWU_DECODER)            += frwu.o
-OBJS-$(CONFIG_GIF_DECODER)             += gifdec.o lzw.o
-OBJS-$(CONFIG_GIF_ENCODER)             += gif.o lzwenc.o
-OBJS-$(CONFIG_H261_DECODER)            += h261dec.o h261.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_H261_ENCODER)            += h261enc.o h261.o             \
-                                          mpegvideo_enc.o motion_est.o \
-                                          ratecontrol.o mpeg12data.o   \
-                                          mpegvideo.o
-OBJS-$(CONFIG_H263_DECODER)            += h263dec.o h263.o ituh263dec.o        \
-                                          mpeg4video.o mpeg4videodec.o flvdec.o\
-                                          intelh263dec.o mpegvideo.o           \
-                                          error_resilience.o
-OBJS-$(CONFIG_H263_VAAPI_HWACCEL)      += vaapi_mpeg4.o
-OBJS-$(CONFIG_H263_ENCODER)            += mpegvideo_enc.o mpeg4video.o      \
-                                          mpeg4videoenc.o motion_est.o      \
-                                          ratecontrol.o h263.o ituh263enc.o \
-                                          flvenc.o mpeg12data.o             \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_H264_DECODER)            += h264.o                               \
-                                          h264_loopfilter.o h264_direct.o      \
-                                          cabac.o h264_sei.o h264_ps.o         \
-                                          h264_refs.o h264_cavlc.o h264_cabac.o\
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_H264_DXVA2_HWACCEL)      += dxva2_h264.o
-OBJS-$(CONFIG_H264_ENCODER)            += h264enc.o h264dspenc.o
-OBJS-$(CONFIG_H264_VAAPI_HWACCEL)      += vaapi_h264.o
-OBJS-$(CONFIG_HUFFYUV_DECODER)         += huffyuv.o
-OBJS-$(CONFIG_HUFFYUV_ENCODER)         += huffyuv.o
-OBJS-$(CONFIG_IDCIN_DECODER)           += idcinvideo.o
-OBJS-$(CONFIG_IFF_BYTERUN1_DECODER)    += iff.o
-OBJS-$(CONFIG_IFF_ILBM_DECODER)        += iff.o
-OBJS-$(CONFIG_IMC_DECODER)             += imc.o
-OBJS-$(CONFIG_INDEO2_DECODER)          += indeo2.o
-OBJS-$(CONFIG_INDEO3_DECODER)          += indeo3.o
-OBJS-$(CONFIG_INDEO5_DECODER)          += indeo5.o ivi_common.o ivi_dsp.o
-OBJS-$(CONFIG_INTERPLAY_DPCM_DECODER)  += dpcm.o
-OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o
-OBJS-$(CONFIG_JPEGLS_DECODER)          += jpeglsdec.o jpegls.o \
-                                          mjpegdec.o mjpeg.o
-OBJS-$(CONFIG_JPEGLS_ENCODER)          += jpeglsenc.o jpegls.o
-OBJS-$(CONFIG_KGV1_DECODER)            += kgv1dec.o
-OBJS-$(CONFIG_KMVC_DECODER)            += kmvc.o
-OBJS-$(CONFIG_LJPEG_ENCODER)           += ljpegenc.o mjpegenc.o mjpeg.o \
-                                          mpegvideo_enc.o motion_est.o  \
-                                          ratecontrol.o mpeg12data.o    \
-                                          mpegvideo.o
-OBJS-$(CONFIG_LOCO_DECODER)            += loco.o
-OBJS-$(CONFIG_MACE3_DECODER)           += mace.o
-OBJS-$(CONFIG_MACE6_DECODER)           += mace.o
-OBJS-$(CONFIG_MDEC_DECODER)            += mdec.o mpeg12.o mpeg12data.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MIMIC_DECODER)           += mimic.o
-OBJS-$(CONFIG_MJPEG_DECODER)           += mjpegdec.o mjpeg.o
-OBJS-$(CONFIG_MJPEG_ENCODER)           += mjpegenc.o mjpeg.o           \
-                                          mpegvideo_enc.o motion_est.o \
-                                          ratecontrol.o mpeg12data.o   \
-                                          mpegvideo.o
-OBJS-$(CONFIG_MJPEGB_DECODER)          += mjpegbdec.o mjpegdec.o mjpeg.o
-OBJS-$(CONFIG_MLP_DECODER)             += mlpdec.o mlpdsp.o
-OBJS-$(CONFIG_MMVIDEO_DECODER)         += mmvideo.o
-OBJS-$(CONFIG_MOTIONPIXELS_DECODER)    += motionpixels.o
-OBJS-$(CONFIG_MP1_DECODER)             += mpegaudiodec.o mpegaudiodecheader.o \
-                                          mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP2_DECODER)             += mpegaudiodec.o mpegaudiodecheader.o \
-                                          mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP2_ENCODER)             += mpegaudioenc.o mpegaudio.o \
-                                          mpegaudiodata.o
-OBJS-$(CONFIG_MP3ADU_DECODER)          += mpegaudiodec.o mpegaudiodecheader.o \
-                                          mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MP3ON4_DECODER)          += mpegaudiodec.o mpegaudiodecheader.o \
-                                          mpegaudio.o mpegaudiodata.o         \
-                                          mpeg4audio.o
-OBJS-$(CONFIG_MP3_DECODER)             += mpegaudiodec.o mpegaudiodecheader.o \
-                                          mpegaudio.o mpegaudiodata.o
-OBJS-$(CONFIG_MPC7_DECODER)            += mpc7.o mpc.o mpegaudiodec.o      \
-                                          mpegaudiodecheader.o mpegaudio.o \
-                                          mpegaudiodata.o
-OBJS-$(CONFIG_MPC8_DECODER)            += mpc8.o mpc.o mpegaudiodec.o      \
-                                          mpegaudiodecheader.o mpegaudio.o \
-                                          mpegaudiodata.o
-OBJS-$(CONFIG_MPEGVIDEO_DECODER)       += mpeg12.o mpeg12data.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MPEG_XVMC_DECODER)       += mpegvideo_xvmc.o
-OBJS-$(CONFIG_MPEG1VIDEO_DECODER)      += mpeg12.o mpeg12data.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MPEG1VIDEO_ENCODER)      += mpeg12enc.o mpegvideo_enc.o \
-                                          motion_est.o ratecontrol.o  \
-                                          mpeg12.o mpeg12data.o       \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MPEG2_VAAPI_HWACCEL)     += vaapi_mpeg2.o
-OBJS-$(CONFIG_MPEG2VIDEO_DECODER)      += mpeg12.o mpeg12data.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MPEG2VIDEO_ENCODER)      += mpeg12enc.o mpegvideo_enc.o \
-                                          motion_est.o ratecontrol.o  \
-                                          mpeg12.o mpeg12data.o       \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL)     += vaapi_mpeg4.o
-OBJS-$(CONFIG_MSMPEG4V1_DECODER)       += msmpeg4.o msmpeg4data.o
-OBJS-$(CONFIG_MSMPEG4V1_ENCODER)       += msmpeg4.o msmpeg4data.o h263dec.o \
-                                          h263.o ituh263dec.o mpeg4videodec.o
-OBJS-$(CONFIG_MSMPEG4V2_DECODER)       += msmpeg4.o msmpeg4data.o h263dec.o \
-                                          h263.o ituh263dec.o mpeg4videodec.o
-OBJS-$(CONFIG_MSMPEG4V2_ENCODER)       += msmpeg4.o msmpeg4data.o h263dec.o \
-                                          h263.o ituh263dec.o mpeg4videodec.o
-OBJS-$(CONFIG_MSMPEG4V3_DECODER)       += msmpeg4.o msmpeg4data.o h263dec.o \
-                                          h263.o ituh263dec.o mpeg4videodec.o
-OBJS-$(CONFIG_MSMPEG4V3_ENCODER)       += msmpeg4.o msmpeg4data.o h263dec.o \
-                                          h263.o ituh263dec.o mpeg4videodec.o
-OBJS-$(CONFIG_MSRLE_DECODER)           += msrle.o msrledec.o
-OBJS-$(CONFIG_MSVIDEO1_DECODER)        += msvideo1.o
-OBJS-$(CONFIG_MSZH_DECODER)            += lcldec.o
-OBJS-$(CONFIG_NELLYMOSER_DECODER)      += nellymoserdec.o nellymoser.o
-OBJS-$(CONFIG_NELLYMOSER_ENCODER)      += nellymoserenc.o nellymoser.o
-OBJS-$(CONFIG_NUV_DECODER)             += nuv.o rtjpeg.o
-OBJS-$(CONFIG_PAM_DECODER)             += pnmdec.o pnm.o
-OBJS-$(CONFIG_PAM_ENCODER)             += pamenc.o pnm.o
-OBJS-$(CONFIG_PBM_DECODER)             += pnmdec.o pnm.o
-OBJS-$(CONFIG_PBM_ENCODER)             += pnmenc.o pnm.o
-OBJS-$(CONFIG_PCX_DECODER)             += pcx.o
-OBJS-$(CONFIG_PCX_ENCODER)             += pcxenc.o
-OBJS-$(CONFIG_PGM_DECODER)             += pnmdec.o pnm.o
-OBJS-$(CONFIG_PGM_ENCODER)             += pnmenc.o pnm.o
-OBJS-$(CONFIG_PGMYUV_DECODER)          += pnmdec.o pnm.o
-OBJS-$(CONFIG_PGMYUV_ENCODER)          += pnmenc.o pnm.o
-OBJS-$(CONFIG_PGSSUB_DECODER)          += pgssubdec.o
-OBJS-$(CONFIG_PNG_DECODER)             += png.o pngdec.o
-OBJS-$(CONFIG_PNG_ENCODER)             += png.o pngenc.o
-OBJS-$(CONFIG_PPM_DECODER)             += pnmdec.o pnm.o
-OBJS-$(CONFIG_PPM_ENCODER)             += pnmenc.o pnm.o
-OBJS-$(CONFIG_PTX_DECODER)             += ptx.o
-OBJS-$(CONFIG_QCELP_DECODER)           += qcelpdec.o celp_math.o         \
-                                          celp_filters.o acelp_vectors.o \
-                                          acelp_filters.o
-OBJS-$(CONFIG_QDM2_DECODER)            += qdm2.o mpegaudiodec.o            \
-                                          mpegaudiodecheader.o mpegaudio.o \
-                                          mpegaudiodata.o
-OBJS-$(CONFIG_QDRAW_DECODER)           += qdrw.o
-OBJS-$(CONFIG_QPEG_DECODER)            += qpeg.o
-OBJS-$(CONFIG_QTRLE_DECODER)           += qtrle.o
-OBJS-$(CONFIG_QTRLE_ENCODER)           += qtrleenc.o
-OBJS-$(CONFIG_R210_DECODER)            += r210dec.o
-OBJS-$(CONFIG_RA_144_DECODER)          += ra144.o celp_filters.o
-OBJS-$(CONFIG_RA_288_DECODER)          += ra288.o celp_math.o celp_filters.o
-OBJS-$(CONFIG_RAWVIDEO_DECODER)        += rawdec.o
-OBJS-$(CONFIG_RAWVIDEO_ENCODER)        += rawenc.o
-OBJS-$(CONFIG_RL2_DECODER)             += rl2.o
-OBJS-$(CONFIG_ROQ_DECODER)             += roqvideodec.o roqvideo.o
-OBJS-$(CONFIG_ROQ_ENCODER)             += roqvideoenc.o roqvideo.o elbg.o
-OBJS-$(CONFIG_ROQ_DPCM_DECODER)        += dpcm.o
-OBJS-$(CONFIG_ROQ_DPCM_ENCODER)        += roqaudioenc.o
-OBJS-$(CONFIG_RPZA_DECODER)            += rpza.o
-OBJS-$(CONFIG_RV10_DECODER)            += rv10.o
-OBJS-$(CONFIG_RV10_ENCODER)            += rv10enc.o
-OBJS-$(CONFIG_RV20_DECODER)            += rv10.o
-OBJS-$(CONFIG_RV20_ENCODER)            += rv20enc.o
-OBJS-$(CONFIG_RV30_DECODER)            += rv30.o rv34.o rv30dsp.o        \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_RV40_DECODER)            += rv40.o rv34.o rv40dsp.o        \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_SGI_DECODER)             += sgidec.o
-OBJS-$(CONFIG_SGI_ENCODER)             += sgienc.o rle.o
-OBJS-$(CONFIG_SHORTEN_DECODER)         += shorten.o
-OBJS-$(CONFIG_SIPR_DECODER)            += sipr.o acelp_pitch_delay.o \
-                                          celp_math.o acelp_vectors.o \
-                                          acelp_filters.o celp_filters.o \
-                                          sipr16k.o
-OBJS-$(CONFIG_SMACKAUD_DECODER)        += smacker.o
-OBJS-$(CONFIG_SMACKER_DECODER)         += smacker.o
-OBJS-$(CONFIG_SMC_DECODER)             += smc.o
-OBJS-$(CONFIG_SNOW_DECODER)            += snow.o rangecoder.o
-OBJS-$(CONFIG_SNOW_ENCODER)            += snow.o rangecoder.o motion_est.o \
-                                          ratecontrol.o h263.o             \
-                                          mpegvideo.o error_resilience.o   \
-                                          ituh263enc.o mpegvideo_enc.o     \
-                                          mpeg12data.o
-OBJS-$(CONFIG_SOL_DPCM_DECODER)        += dpcm.o
-OBJS-$(CONFIG_SONIC_DECODER)           += sonic.o
-OBJS-$(CONFIG_SONIC_ENCODER)           += sonic.o
-OBJS-$(CONFIG_SONIC_LS_ENCODER)        += sonic.o
-OBJS-$(CONFIG_SP5X_DECODER)            += sp5xdec.o mjpegdec.o mjpeg.o
-OBJS-$(CONFIG_SUNRAST_DECODER)         += sunrast.o
-OBJS-$(CONFIG_SVQ1_DECODER)            += svq1dec.o svq1.o h263.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_SVQ1_ENCODER)            += svq1enc.o svq1.o    \
-                                          motion_est.o h263.o \
-                                          mpegvideo.o error_resilience.o \
-                                          ituh263enc.o mpegvideo_enc.o   \
-                                          ratecontrol.o mpeg12data.o
-OBJS-$(CONFIG_SVQ3_DECODER)            += h264.o svq3.o                       \
-                                          h264_loopfilter.o h264_direct.o     \
-                                          h264_sei.o h264_ps.o h264_refs.o    \
-                                          h264_cavlc.o h264_cabac.o cabac.o   \
-                                          mpegvideo.o error_resilience.o      \
-                                          svq1dec.o svq1.o h263.o
-OBJS-$(CONFIG_TARGA_DECODER)           += targa.o
-OBJS-$(CONFIG_TARGA_ENCODER)           += targaenc.o rle.o
-OBJS-$(CONFIG_THEORA_DECODER)          += xiph.o
-OBJS-$(CONFIG_THP_DECODER)             += mjpegdec.o mjpeg.o
-OBJS-$(CONFIG_TIERTEXSEQVIDEO_DECODER) += tiertexseqv.o
-OBJS-$(CONFIG_TIFF_DECODER)            += tiff.o lzw.o faxcompr.o
-OBJS-$(CONFIG_TIFF_ENCODER)            += tiffenc.o rle.o lzwenc.o
-OBJS-$(CONFIG_TMV_DECODER)             += tmv.o cga_data.o
-OBJS-$(CONFIG_TRUEMOTION1_DECODER)     += truemotion1.o
-OBJS-$(CONFIG_TRUEMOTION2_DECODER)     += truemotion2.o
-OBJS-$(CONFIG_TRUESPEECH_DECODER)      += truespeech.o
-OBJS-$(CONFIG_TSCC_DECODER)            += tscc.o msrledec.o
-OBJS-$(CONFIG_TTA_DECODER)             += tta.o
-OBJS-$(CONFIG_TWINVQ_DECODER)          += twinvq.o celp_math.o
-OBJS-$(CONFIG_TXD_DECODER)             += txd.o s3tc.o
-OBJS-$(CONFIG_ULTI_DECODER)            += ulti.o
-OBJS-$(CONFIG_V210_DECODER)            += v210dec.o
-OBJS-$(CONFIG_V210_ENCODER)            += v210enc.o
-OBJS-$(CONFIG_V210X_DECODER)           += v210x.o
-OBJS-$(CONFIG_VB_DECODER)              += vb.o
-OBJS-$(CONFIG_VC1_DECODER)             += vc1dec.o vc1.o vc1data.o vc1dsp.o \
-                                          msmpeg4.o msmpeg4data.o           \
-                                          intrax8.o intrax8dsp.o
-OBJS-$(CONFIG_VC1_DXVA2_HWACCEL)       += dxva2_vc1.o
-OBJS-$(CONFIG_VC1_VAAPI_HWACCEL)       += vaapi_vc1.o
-OBJS-$(CONFIG_VCR1_DECODER)            += vcr1.o
-OBJS-$(CONFIG_VCR1_ENCODER)            += vcr1.o
-OBJS-$(CONFIG_VMDAUDIO_DECODER)        += vmdav.o
-OBJS-$(CONFIG_VMDVIDEO_DECODER)        += vmdav.o
-OBJS-$(CONFIG_VMNC_DECODER)            += vmnc.o
-OBJS-$(CONFIG_VORBIS_DECODER)          += vorbis_dec.o vorbis.o \
-                                          vorbis_data.o xiph.o
-OBJS-$(CONFIG_VORBIS_ENCODER)          += vorbis_enc.o vorbis.o \
-                                          vorbis_data.o
-OBJS-$(CONFIG_VP3_DECODER)             += vp3.o vp3dsp.o
-OBJS-$(CONFIG_VP5_DECODER)             += vp5.o vp56.o vp56data.o vp56dsp.o \
-                                          vp3dsp.o
-OBJS-$(CONFIG_VP6_DECODER)             += vp6.o vp56.o vp56data.o vp56dsp.o \
-                                          vp3dsp.o vp6dsp.o huffman.o
-OBJS-$(CONFIG_VQA_DECODER)             += vqavideo.o
-OBJS-$(CONFIG_WAVPACK_DECODER)         += wavpack.o
-OBJS-$(CONFIG_WMAPRO_DECODER)          += wmaprodec.o wma.o
-OBJS-$(CONFIG_WMAV1_DECODER)           += wmadec.o wma.o aactab.o
-OBJS-$(CONFIG_WMAV1_ENCODER)           += wmaenc.o wma.o aactab.o
-OBJS-$(CONFIG_WMAV2_DECODER)           += wmadec.o wma.o aactab.o
-OBJS-$(CONFIG_WMAV2_ENCODER)           += wmaenc.o wma.o aactab.o
-OBJS-$(CONFIG_WMAVOICE_DECODER)        += wmavoice.o \
-                                          celp_math.o celp_filters.o \
-                                          acelp_vectors.o acelp_filters.o
-OBJS-$(CONFIG_WMV1_DECODER)            += msmpeg4.o msmpeg4data.o
-OBJS-$(CONFIG_WMV2_DECODER)            += wmv2dec.o wmv2.o        \
-                                          msmpeg4.o msmpeg4data.o \
-                                          intrax8.o intrax8dsp.o
-OBJS-$(CONFIG_WMV2_ENCODER)            += wmv2enc.o wmv2.o \
-                                          msmpeg4.o msmpeg4data.o \
-                                          mpeg4videodec.o ituh263dec.o h263dec.o
-OBJS-$(CONFIG_WNV1_DECODER)            += wnv1.o
-OBJS-$(CONFIG_WS_SND1_DECODER)         += ws-snd1.o
-OBJS-$(CONFIG_XAN_DPCM_DECODER)        += dpcm.o
-OBJS-$(CONFIG_XAN_WC3_DECODER)         += xan.o
-OBJS-$(CONFIG_XAN_WC4_DECODER)         += xan.o
-OBJS-$(CONFIG_XL_DECODER)              += xl.o
-OBJS-$(CONFIG_XSUB_DECODER)            += xsubdec.o
-OBJS-$(CONFIG_XSUB_ENCODER)            += xsubenc.o
-OBJS-$(CONFIG_YOP_DECODER)             += yop.o
-OBJS-$(CONFIG_ZLIB_DECODER)            += lcldec.o
-OBJS-$(CONFIG_ZLIB_ENCODER)            += lclenc.o
-OBJS-$(CONFIG_ZMBV_DECODER)            += zmbv.o
-OBJS-$(CONFIG_ZMBV_ENCODER)            += zmbvenc.o
-
-# (AD)PCM decoders/encoders
-OBJS-$(CONFIG_PCM_ALAW_DECODER)           += pcm.o
-OBJS-$(CONFIG_PCM_ALAW_ENCODER)           += pcm.o
-OBJS-$(CONFIG_PCM_BLURAY_DECODER)         += pcm-mpeg.o
-OBJS-$(CONFIG_PCM_DVD_DECODER)            += pcm.o
-OBJS-$(CONFIG_PCM_DVD_ENCODER)            += pcm.o
-OBJS-$(CONFIG_PCM_F32BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_F32BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_F32LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_F32LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_F64BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_F64BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_F64LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_F64LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_MULAW_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_MULAW_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S8_DECODER)             += pcm.o
-OBJS-$(CONFIG_PCM_S8_ENCODER)             += pcm.o
-OBJS-$(CONFIG_PCM_S16BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S16BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S16LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S16LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S16LE_PLANAR_DECODER)   += pcm.o
-OBJS-$(CONFIG_PCM_S24BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S24BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S24DAUD_DECODER)        += pcm.o
-OBJS-$(CONFIG_PCM_S24DAUD_ENCODER)        += pcm.o
-OBJS-$(CONFIG_PCM_S24LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S24LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S32BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S32BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S32LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_S32LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U8_DECODER)             += pcm.o
-OBJS-$(CONFIG_PCM_U8_ENCODER)             += pcm.o
-OBJS-$(CONFIG_PCM_U16BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U16BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U16LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U16LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U24BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U24BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U24LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U24LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U32BE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U32BE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U32LE_DECODER)          += pcm.o
-OBJS-$(CONFIG_PCM_U32LE_ENCODER)          += pcm.o
-OBJS-$(CONFIG_PCM_ZORK_DECODER)           += pcm.o
-OBJS-$(CONFIG_PCM_ZORK_ENCODER)           += pcm.o
-
-OBJS-$(CONFIG_ADPCM_4XM_DECODER)          += adpcm.o
-OBJS-$(CONFIG_ADPCM_ADX_DECODER)          += adxdec.o
-OBJS-$(CONFIG_ADPCM_ADX_ENCODER)          += adxenc.o
-OBJS-$(CONFIG_ADPCM_CT_DECODER)           += adpcm.o
-OBJS-$(CONFIG_ADPCM_EA_DECODER)           += adpcm.o
-OBJS-$(CONFIG_ADPCM_EA_MAXIS_XA_DECODER)  += adpcm.o
-OBJS-$(CONFIG_ADPCM_EA_R1_DECODER)        += adpcm.o
-OBJS-$(CONFIG_ADPCM_EA_R2_DECODER)        += adpcm.o
-OBJS-$(CONFIG_ADPCM_EA_R3_DECODER)        += adpcm.o
-OBJS-$(CONFIG_ADPCM_EA_XAS_DECODER)       += adpcm.o
-OBJS-$(CONFIG_ADPCM_G726_DECODER)         += g726.o
-OBJS-$(CONFIG_ADPCM_G726_ENCODER)         += g726.o
-OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_EA_EACS_DECODER)  += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_EA_SEAD_DECODER)  += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_ISS_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_QT_DECODER)       += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_QT_ENCODER)       += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_SMJPEG_DECODER)   += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_WAV_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_WAV_ENCODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_IMA_WS_DECODER)       += adpcm.o
-OBJS-$(CONFIG_ADPCM_MS_DECODER)           += adpcm.o
-OBJS-$(CONFIG_ADPCM_MS_ENCODER)           += adpcm.o
-OBJS-$(CONFIG_ADPCM_SBPRO_2_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_SBPRO_3_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_SBPRO_4_DECODER)      += adpcm.o
-OBJS-$(CONFIG_ADPCM_SWF_DECODER)          += adpcm.o
-OBJS-$(CONFIG_ADPCM_SWF_ENCODER)          += adpcm.o
-OBJS-$(CONFIG_ADPCM_THP_DECODER)          += adpcm.o
-OBJS-$(CONFIG_ADPCM_XA_DECODER)           += adpcm.o
-OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER)       += adpcm.o
-OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER)       += adpcm.o
-
-# libavformat dependencies
-OBJS-$(CONFIG_ADTS_MUXER)              += mpeg4audio.o
-OBJS-$(CONFIG_CAF_DEMUXER)             += mpeg4audio.o mpegaudiodata.o
-OBJS-$(CONFIG_DV_DEMUXER)              += dvdata.o
-OBJS-$(CONFIG_DV_MUXER)                += dvdata.o
-OBJS-$(CONFIG_FLAC_DEMUXER)            += flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_FLAC_MUXER)              += flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_FLV_DEMUXER)             += mpeg4audio.o
-OBJS-$(CONFIG_GXF_DEMUXER)             += mpeg12data.o
-OBJS-$(CONFIG_IFF_DEMUXER)             += iff.o
-OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER)    += xiph.o mpeg4audio.o \
-                                          flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_MATROSKA_DEMUXER)        += mpeg4audio.o
-OBJS-$(CONFIG_MATROSKA_MUXER)          += xiph.o mpeg4audio.o \
-                                          flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_MOV_DEMUXER)             += mpeg4audio.o mpegaudiodata.o
-OBJS-$(CONFIG_MPEGTS_MUXER)            += mpegvideo.o mpeg4audio.o
-OBJS-$(CONFIG_NUT_MUXER)               += mpegaudiodata.o
-OBJS-$(CONFIG_OGG_DEMUXER)             += flacdec.o flacdata.o flac.o \
-                                          dirac.o mpeg12data.o
-OBJS-$(CONFIG_OGG_MUXER)               += xiph.o flacdec.o flacdata.o flac.o
-OBJS-$(CONFIG_RTP_MUXER)               += mpegvideo.o
-OBJS-$(CONFIG_WEBM_MUXER)              += xiph.o mpeg4audio.o \
-                                          flacdec.o flacdata.o flac.o
-
-# external codec libraries
-OBJS-$(CONFIG_LIBDIRAC_DECODER)           += libdiracdec.o
-OBJS-$(CONFIG_LIBDIRAC_ENCODER)           += libdiracenc.o libdirac_libschro.o
-OBJS-$(CONFIG_LIBFAAC_ENCODER)            += libfaac.o
-OBJS-$(CONFIG_LIBFAAD_DECODER)            += libfaad.o
-OBJS-$(CONFIG_LIBGSM_DECODER)             += libgsm.o
-OBJS-$(CONFIG_LIBGSM_ENCODER)             += libgsm.o
-OBJS-$(CONFIG_LIBGSM_MS_DECODER)          += libgsm.o
-OBJS-$(CONFIG_LIBGSM_MS_ENCODER)          += libgsm.o
-OBJS-$(CONFIG_LIBMP3LAME_ENCODER)         += libmp3lame.o
-OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER)  += libopencore-amr.o
-OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER)  += libopencore-amr.o
-OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER)  += libopencore-amr.o
-OBJS-$(CONFIG_LIBOPENJPEG_DECODER)        += libopenjpeg.o
-OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER)    += libschroedingerdec.o \
-                                             libschroedinger.o    \
-                                             libdirac_libschro.o
-OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER)    += libschroedingerenc.o \
-                                             libschroedinger.o    \
-                                             libdirac_libschro.o
-OBJS-$(CONFIG_LIBSPEEX_DECODER)           += libspeexdec.o
-OBJS-$(CONFIG_LIBTHEORA_ENCODER)          += libtheoraenc.o
-OBJS-$(CONFIG_LIBVORBIS_ENCODER)          += libvorbis.o
-OBJS-$(CONFIG_LIBVPX_DECODER)             += libvpxdec.o
-OBJS-$(CONFIG_LIBVPX_ENCODER)             += libvpxenc.o
-OBJS-$(CONFIG_LIBX264_ENCODER)            += libx264.o
-OBJS-$(CONFIG_LIBXVID_ENCODER)            += libxvidff.o libxvid_rc.o
-
-# parsers
-OBJS-$(CONFIG_AAC_PARSER)              += aac_parser.o aac_ac3_parser.o \
-                                          mpeg4audio.o
-OBJS-$(CONFIG_AC3_PARSER)              += ac3_parser.o ac3tab.o \
-                                          aac_ac3_parser.o
-OBJS-$(CONFIG_CAVSVIDEO_PARSER)        += cavs_parser.o
-OBJS-$(CONFIG_DCA_PARSER)              += dca_parser.o
-OBJS-$(CONFIG_DIRAC_PARSER)            += dirac_parser.o
-OBJS-$(CONFIG_DNXHD_PARSER)            += dnxhd_parser.o
-OBJS-$(CONFIG_DVBSUB_PARSER)           += dvbsub_parser.o
-OBJS-$(CONFIG_DVDSUB_PARSER)           += dvdsub_parser.o
-OBJS-$(CONFIG_H261_PARSER)             += h261_parser.o
-OBJS-$(CONFIG_H263_PARSER)             += h263_parser.o
-OBJS-$(CONFIG_H264_PARSER)             += h264_parser.o h264.o            \
-                                          cabac.o                         \
-                                          h264_refs.o h264_sei.o h264_direct.o \
-                                          h264_loopfilter.o h264_cabac.o \
-                                          h264_cavlc.o h264_ps.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_MJPEG_PARSER)            += mjpeg_parser.o
-OBJS-$(CONFIG_MLP_PARSER)              += mlp_parser.o mlp.o
-OBJS-$(CONFIG_MPEG4VIDEO_PARSER)       += mpeg4video_parser.o h263.o \
-                                          mpegvideo.o error_resilience.o \
-                                          mpeg4videodec.o mpeg4video.o \
-                                          ituh263dec.o h263dec.o
-OBJS-$(CONFIG_MPEGAUDIO_PARSER)        += mpegaudio_parser.o \
-                                          mpegaudiodecheader.o mpegaudiodata.o
-OBJS-$(CONFIG_MPEGVIDEO_PARSER)        += mpegvideo_parser.o    \
-                                          mpeg12.o mpeg12data.o \
-                                          mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_PNM_PARSER)              += pnm_parser.o pnm.o
-OBJS-$(CONFIG_VC1_PARSER)              += vc1_parser.o vc1.o vc1data.o \
-                                          msmpeg4.o msmpeg4data.o mpeg4video.o \
-                                          h263.o mpegvideo.o error_resilience.o
-OBJS-$(CONFIG_VP3_PARSER)              += vp3_parser.o
-
-# bitstream filters
-OBJS-$(CONFIG_AAC_ADTSTOASC_BSF)          += aac_adtstoasc_bsf.o
-OBJS-$(CONFIG_DUMP_EXTRADATA_BSF)         += dump_extradata_bsf.o
-OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF)       += h264_mp4toannexb_bsf.o
-OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF)        += imx_dump_header_bsf.o
-OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF)     += mjpega_dump_header_bsf.o
-OBJS-$(CONFIG_MOV2TEXTSUB_BSF)            += movsub_bsf.o
-OBJS-$(CONFIG_MP3_HEADER_COMPRESS_BSF)    += mp3_header_compress_bsf.o
-OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF)  += mp3_header_decompress_bsf.o \
-                                             mpegaudiodata.o
-OBJS-$(CONFIG_NOISE_BSF)                  += noise_bsf.o
-OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)       += remove_extradata_bsf.o
-OBJS-$(CONFIG_TEXT2MOVSUB_BSF)            += movsub_bsf.o
-
-# thread libraries
-OBJS-$(HAVE_BEOSTHREADS)               += beosthread.o
-OBJS-$(HAVE_OS2THREADS)                += os2thread.o
-OBJS-$(HAVE_PTHREADS)                  += pthread.o
-OBJS-$(HAVE_W32THREADS)                += w32thread.o
-
-OBJS-$(CONFIG_MLIB)                    += mlib/dsputil_mlib.o           \
-
--include $(SUBDIR)$(ARCH)/Makefile
-
-SKIPHEADERS                             = %_tablegen.h
-SKIPHEADERS-$(CONFIG_DXVA2)            += dxva2.h dxva2_internal.h
-SKIPHEADERS-$(CONFIG_LIBDIRAC)         += libdirac.h
-SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER)  += libschroedinger.h
-SKIPHEADERS-$(CONFIG_VAAPI)            += vaapi_internal.h
-SKIPHEADERS-$(CONFIG_VDPAU)            += vdpau.h
-SKIPHEADERS-$(CONFIG_XVMC)             += xvmc.h
-SKIPHEADERS                            += mpegaudio3.h
-
-EXAMPLES = api
-
-TESTPROGS = cabac dct eval fft h264 iirfilter rangecoder snow
-TESTPROGS-$(ARCH_X86) += x86/cpuid
-TESTPROGS-$(HAVE_MMX) += motion
-TESTOBJS = dctref.o
-
-HOSTPROGS = costablegen
-
-DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
-
-CLEANFILES = sin_tables.c cos_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
-
-include $(SUBDIR)../subdir.mak
-
-$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
-
-$(SUBDIR)cos_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-	$(M)./$< > $@
-
-$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
-	$(M)./$< sin > $@
-
-ifdef CONFIG_MPEGAUDIO_HP
-$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=23
-$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=23
-else
-$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=15
-$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=15
-endif
-
-ifdef CONFIG_SMALL
-$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
-else
-$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
-endif
-
-$(SUBDIR)%_tablegen$(HOSTEXESUF): $(SUBDIR)%_tablegen.c $(SUBDIR)tableprint.c
-	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(HOSTLIBS)
-
-$(SUBDIR)%_tables.h: $(SUBDIR)%_tablegen$(HOSTEXESUF)
-	$(M)./$< > $@
-
-ifdef CONFIG_HARDCODED_TABLES
-$(SUBDIR)aac.o: $(SUBDIR)cbrt_tables.h
-$(SUBDIR)dv.o: $(SUBDIR)dv_tables.h
-$(SUBDIR)mdct.o: $(SUBDIR)mdct_tables.h
-$(SUBDIR)mpegaudiodec.o: $(SUBDIR)mpegaudio_tables.h
-$(SUBDIR)motionpixels.o: $(SUBDIR)motionpixels_tables.h
-$(SUBDIR)pcm.o: $(SUBDIR)pcm_tables.h
-$(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h
-endif
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
deleted file mode 100644
index 94f578f..0000000
--- a/libavcodec/aac.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * AAC definitions and structures
- * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
- * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC definitions and structures
- * @author Oded Shimon  ( ods15 ods15 dyndns org )
- * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
- */
-
-#ifndef AVCODEC_AAC_H
-#define AVCODEC_AAC_H
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "fft.h"
-#include "mpeg4audio.h"
-#include "sbr.h"
-
-#include <stdint.h>
-
-#define MAX_CHANNELS 64
-#define MAX_ELEM_ID 16
-
-#define TNS_MAX_ORDER 20
-
-enum RawDataBlockType {
-    TYPE_SCE,
-    TYPE_CPE,
-    TYPE_CCE,
-    TYPE_LFE,
-    TYPE_DSE,
-    TYPE_PCE,
-    TYPE_FIL,
-    TYPE_END,
-};
-
-enum ExtensionPayloadID {
-    EXT_FILL,
-    EXT_FILL_DATA,
-    EXT_DATA_ELEMENT,
-    EXT_DYNAMIC_RANGE = 0xb,
-    EXT_SBR_DATA      = 0xd,
-    EXT_SBR_DATA_CRC  = 0xe,
-};
-
-enum WindowSequence {
-    ONLY_LONG_SEQUENCE,
-    LONG_START_SEQUENCE,
-    EIGHT_SHORT_SEQUENCE,
-    LONG_STOP_SEQUENCE,
-};
-
-enum BandType {
-    ZERO_BT        = 0,     ///< Scalefactors and spectral data are all zero.
-    FIRST_PAIR_BT  = 5,     ///< This and later band types encode two values (rather than four) with one code word.
-    ESC_BT         = 11,    ///< Spectral data are coded with an escape sequence.
-    NOISE_BT       = 13,    ///< Spectral data are scaled white noise not coded in the bitstream.
-    INTENSITY_BT2  = 14,    ///< Scalefactor data are intensity stereo positions.
-    INTENSITY_BT   = 15,    ///< Scalefactor data are intensity stereo positions.
-};
-
-#define IS_CODEBOOK_UNSIGNED(x) ((x - 1) & 10)
-
-enum ChannelPosition {
-    AAC_CHANNEL_FRONT = 1,
-    AAC_CHANNEL_SIDE  = 2,
-    AAC_CHANNEL_BACK  = 3,
-    AAC_CHANNEL_LFE   = 4,
-    AAC_CHANNEL_CC    = 5,
-};
-
-/**
- * The point during decoding at which channel coupling is applied.
- */
-enum CouplingPoint {
-    BEFORE_TNS,
-    BETWEEN_TNS_AND_IMDCT,
-    AFTER_IMDCT = 3,
-};
-
-/**
- * Output configuration status
- */
-enum OCStatus {
-    OC_NONE,        //< Output unconfigured
-    OC_TRIAL_PCE,   //< Output configuration under trial specified by an inband PCE
-    OC_TRIAL_FRAME, //< Output configuration under trial specified by a frame header
-    OC_GLOBAL_HDR,  //< Output configuration set in a global header but not yet locked
-    OC_LOCKED,      //< Output configuration locked in place
-};
-
-/**
- * Predictor State
- */
-typedef struct {
-    float cor0;
-    float cor1;
-    float var0;
-    float var1;
-    float r0;
-    float r1;
-} PredictorState;
-
-#define MAX_PREDICTORS 672
-
-#define SCALE_DIV_512    36    ///< scalefactor difference that corresponds to scale difference in 512 times
-#define SCALE_ONE_POS   140    ///< scalefactor index that corresponds to scale=1.0
-#define SCALE_MAX_POS   255    ///< scalefactor index maximum value
-#define SCALE_MAX_DIFF   60    ///< maximum scalefactor difference allowed by standard
-#define SCALE_DIFF_ZERO  60    ///< codebook index corresponding to zero scalefactor indices difference
-
-/**
- * Individual Channel Stream
- */
-typedef struct {
-    uint8_t max_sfb;            ///< number of scalefactor bands per group
-    enum WindowSequence window_sequence[2];
-    uint8_t use_kb_window[2];   ///< If set, use Kaiser-Bessel window, otherwise use a sinus window.
-    int num_window_groups;
-    uint8_t group_len[8];
-    const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window
-    const uint8_t *swb_sizes;   ///< table of scalefactor band sizes for a particular window
-    int num_swb;                ///< number of scalefactor window bands
-    int num_windows;
-    int tns_max_bands;
-    int predictor_present;
-    int predictor_initialized;
-    int predictor_reset_group;
-    uint8_t prediction_used[41];
-} IndividualChannelStream;
-
-/**
- * Temporal Noise Shaping
- */
-typedef struct {
-    int present;
-    int n_filt[8];
-    int length[8][4];
-    int direction[8][4];
-    int order[8][4];
-    float coef[8][4][TNS_MAX_ORDER];
-} TemporalNoiseShaping;
-
-/**
- * Dynamic Range Control - decoded from the bitstream but not processed further.
- */
-typedef struct {
-    int pce_instance_tag;                           ///< Indicates with which program the DRC info is associated.
-    int dyn_rng_sgn[17];                            ///< DRC sign information; 0 - positive, 1 - negative
-    int dyn_rng_ctl[17];                            ///< DRC magnitude information
-    int exclude_mask[MAX_CHANNELS];                 ///< Channels to be excluded from DRC processing.
-    int band_incr;                                  ///< Number of DRC bands greater than 1 having DRC info.
-    int interpolation_scheme;                       ///< Indicates the interpolation scheme used in the SBR QMF domain.
-    int band_top[17];                               ///< Indicates the top of the i-th DRC band in units of 4 spectral lines.
-    int prog_ref_level;                             /**< A reference level for the long-term program audio level for all
-                                                     *   channels combined.
-                                                     */
-} DynamicRangeControl;
-
-typedef struct {
-    int num_pulse;
-    int start;
-    int pos[4];
-    int amp[4];
-} Pulse;
-
-/**
- * coupling parameters
- */
-typedef struct {
-    enum CouplingPoint coupling_point;  ///< The point during decoding at which coupling is applied.
-    int num_coupled;       ///< number of target elements
-    enum RawDataBlockType type[8];   ///< Type of channel element to be coupled - SCE or CPE.
-    int id_select[8];      ///< element id
-    int ch_select[8];      /**< [0] shared list of gains; [1] list of gains for right channel;
-                            *   [2] list of gains for left channel; [3] lists of gains for both channels
-                            */
-    float gain[16][120];
-} ChannelCoupling;
-
-/**
- * Single Channel Element - used for both SCE and LFE elements.
- */
-typedef struct {
-    IndividualChannelStream ics;
-    TemporalNoiseShaping tns;
-    Pulse pulse;
-    enum BandType band_type[128];             ///< band types
-    int band_type_run_end[120];               ///< band type run end points
-    float sf[120];                            ///< scalefactors
-    int sf_idx[128];                          ///< scalefactor indices (used by encoder)
-    uint8_t zeroes[128];                      ///< band is not coded (used by encoder)
-    DECLARE_ALIGNED(16, float, coeffs)[1024]; ///< coefficients for IMDCT
-    DECLARE_ALIGNED(16, float, saved)[1024];  ///< overlap
-    DECLARE_ALIGNED(16, float, ret)[2048];    ///< PCM output
-    PredictorState predictor_state[MAX_PREDICTORS];
-} SingleChannelElement;
-
-/**
- * channel element - generic struct for SCE/CPE/CCE/LFE
- */
-typedef struct {
-    // CPE specific
-    int common_window;        ///< Set if channels share a common 'IndividualChannelStream' in bitstream.
-    int     ms_mode;          ///< Signals mid/side stereo flags coding mode (used by encoder)
-    uint8_t ms_mask[128];     ///< Set if mid/side stereo is used for each scalefactor window band
-    // shared
-    SingleChannelElement ch[2];
-    // CCE specific
-    ChannelCoupling coup;
-    SpectralBandReplication sbr;
-} ChannelElement;
-
-/**
- * main AAC context
- */
-typedef struct {
-    AVCodecContext *avctx;
-
-    MPEG4AudioConfig m4ac;
-
-    int is_saved;                 ///< Set if elements have stored overlap from previous frame.
-    DynamicRangeControl che_drc;
-
-    /**
-     * @defgroup elements Channel element related data.
-     * @{
-     */
-    enum ChannelPosition che_pos[4][MAX_ELEM_ID]; /**< channel element channel mapping with the
-                                                   *   first index as the first 4 raw data block types
-                                                   */
-    ChannelElement          *che[4][MAX_ELEM_ID];
-    ChannelElement  *tag_che_map[4][MAX_ELEM_ID];
-    uint8_t tags_seen_this_frame[4][MAX_ELEM_ID];
-    int tags_mapped;
-    /** @} */
-
-    /**
-     * @defgroup temporary aligned temporary buffers (We do not want to have these on the stack.)
-     * @{
-     */
-    DECLARE_ALIGNED(16, float, buf_mdct)[1024];
-    /** @} */
-
-    /**
-     * @defgroup tables   Computed / set up during initialization.
-     * @{
-     */
-    FFTContext mdct;
-    FFTContext mdct_small;
-    DSPContext dsp;
-    int random_state;
-    /** @} */
-
-    /**
-     * @defgroup output   Members used for output interleaving.
-     * @{
-     */
-    float *output_data[MAX_CHANNELS];                 ///< Points to each element's 'ret' buffer (PCM output).
-    float add_bias;                                   ///< offset for dsp.float_to_int16
-    float sf_scale;                                   ///< Pre-scale for correct IMDCT and dsp.float_to_int16.
-    int sf_offset;                                    ///< offset into pow2sf_tab as appropriate for dsp.float_to_int16
-    /** @} */
-
-    DECLARE_ALIGNED(16, float, temp)[128];
-
-    enum OCStatus output_configured;
-} AACContext;
-
-#endif /* AVCODEC_AAC_H */
diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
deleted file mode 100644
index 8791161..0000000
--- a/libavcodec/aac_ac3_parser.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Common AAC and AC-3 parser
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-#include "aac_ac3_parser.h"
-
-int ff_aac_ac3_parse(AVCodecParserContext *s1,
-                     AVCodecContext *avctx,
-                     const uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size)
-{
-    AACAC3ParseContext *s = s1->priv_data;
-    ParseContext *pc = &s->pc;
-    int len, i;
-    int new_frame_start;
-
-get_next:
-    i=END_NOT_FOUND;
-    if(s->remaining_size <= buf_size){
-        if(s->remaining_size && !s->need_next_header){
-            i= s->remaining_size;
-            s->remaining_size = 0;
-        }else{ //we need a header first
-            len=0;
-            for(i=s->remaining_size; i<buf_size; i++){
-                s->state = (s->state<<8) + buf[i];
-                if((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
-                    break;
-            }
-            if(len<=0){
-                i=END_NOT_FOUND;
-            }else{
-                s->state=0;
-                i-= s->header_size -1;
-                s->remaining_size = len;
-                if(!new_frame_start || pc->index+i<=0){
-                    s->remaining_size += i;
-                    goto get_next;
-                }
-            }
-        }
-    }
-
-    if(ff_combine_frame(pc, i, &buf, &buf_size)<0){
-        s->remaining_size -= FFMIN(s->remaining_size, buf_size);
-        *poutbuf = NULL;
-        *poutbuf_size = 0;
-        return buf_size;
-    }
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-
-    /* update codec info */
-    if(s->codec_id)
-        avctx->codec_id = s->codec_id;
-
-    /* Due to backwards compatible HE-AAC the sample rate, channel count,
-       and total number of samples found in an AAC ADTS header are not
-       reliable. Bit rate is still accurate because the total frame duration in
-       seconds is still correct (as is the number of bits in the frame). */
-    if (avctx->codec_id != CODEC_ID_AAC) {
-        avctx->sample_rate = s->sample_rate;
-
-        /* allow downmixing to stereo (or mono for AC-3) */
-        if(avctx->request_channels > 0 &&
-                avctx->request_channels < s->channels &&
-                (avctx->request_channels <= 2 ||
-                (avctx->request_channels == 1 &&
-                (avctx->codec_id == CODEC_ID_AC3 ||
-                 avctx->codec_id == CODEC_ID_EAC3)))) {
-            avctx->channels = avctx->request_channels;
-        } else {
-            avctx->channels = s->channels;
-            avctx->channel_layout = s->channel_layout;
-        }
-        avctx->frame_size = s->samples;
-    }
-
-    avctx->bit_rate = s->bit_rate;
-
-    return i;
-}
diff --git a/libavcodec/aac_ac3_parser.h b/libavcodec/aac_ac3_parser.h
deleted file mode 100644
index 75f6d4b..0000000
--- a/libavcodec/aac_ac3_parser.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Common AAC and AC-3 parser prototypes
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AAC_AC3_PARSER_H
-#define AVCODEC_AAC_AC3_PARSER_H
-
-#include <stdint.h>
-#include "avcodec.h"
-#include "parser.h"
-
-typedef enum {
-    AAC_AC3_PARSE_ERROR_SYNC        = -1,
-    AAC_AC3_PARSE_ERROR_BSID        = -2,
-    AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -3,
-    AAC_AC3_PARSE_ERROR_FRAME_SIZE  = -4,
-    AAC_AC3_PARSE_ERROR_FRAME_TYPE  = -5,
-    AAC_AC3_PARSE_ERROR_CRC         = -6,
-    AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -7,
-} AACAC3ParseError;
-
-typedef struct AACAC3ParseContext {
-    ParseContext pc;
-    int frame_size;
-    int header_size;
-    int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info,
-            int *need_next_header, int *new_frame_start);
-
-    int channels;
-    int sample_rate;
-    int bit_rate;
-    int samples;
-    int64_t channel_layout;
-
-    int remaining_size;
-    uint64_t state;
-
-    int need_next_header;
-    enum CodecID codec_id;
-} AACAC3ParseContext;
-
-int ff_aac_ac3_parse(AVCodecParserContext *s1,
-                     AVCodecContext *avctx,
-                     const uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size);
-
-#endif /* AVCODEC_AAC_AC3_PARSER_H */
diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c
deleted file mode 100644
index 9d53a01..0000000
--- a/libavcodec/aac_adtstoasc_bsf.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration bitstream filter
- * Copyright (c) 2009 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "aac_parser.h"
-#include "put_bits.h"
-#include "get_bits.h"
-#include "mpeg4audio.h"
-#include "internal.h"
-
-typedef struct AACBSFContext {
-    int first_frame_done;
-} AACBSFContext;
-
-/**
- * This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4
- * ADTS header and removes the ADTS header.
- */
-static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
-                                AVCodecContext *avctx, const char *args,
-                                uint8_t  **poutbuf, int *poutbuf_size,
-                                const uint8_t *buf, int      buf_size,
-                                int keyframe)
-{
-    GetBitContext gb;
-    PutBitContext pb;
-    AACADTSHeaderInfo hdr;
-
-    AACBSFContext *ctx = bsfc->priv_data;
-
-    init_get_bits(&gb, buf, AAC_ADTS_HEADER_SIZE*8);
-
-    *poutbuf = (uint8_t*) buf;
-    *poutbuf_size = buf_size;
-
-    if (avctx->extradata)
-        if (show_bits(&gb, 12) != 0xfff)
-            return 0;
-
-    if (ff_aac_parse_header(&gb, &hdr) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n");
-        return -1;
-    }
-
-    if (!hdr.crc_absent && hdr.num_aac_frames > 1) {
-        av_log_missing_feature(avctx, "Multiple RDBs per frame with CRC is", 0);
-        return -1;
-    }
-
-    buf      += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
-    buf_size -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
-
-    if (!ctx->first_frame_done) {
-        int            pce_size = 0;
-        uint8_t        pce_data[MAX_PCE_SIZE];
-        if (!hdr.chan_config) {
-            init_get_bits(&gb, buf, buf_size);
-            if (get_bits(&gb, 3) != 5) {
-                av_log_missing_feature(avctx, "PCE based channel configuration, where the PCE is not the first syntax element is", 0);
-                return -1;
-            }
-            init_put_bits(&pb, pce_data, MAX_PCE_SIZE);
-            pce_size = ff_copy_pce_data(&pb, &gb)/8;
-            flush_put_bits(&pb);
-            buf_size -= get_bits_count(&gb)/8;
-            buf      += get_bits_count(&gb)/8;
-        }
-        avctx->extradata_size = 2 + pce_size;
-        avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-        init_put_bits(&pb, avctx->extradata, avctx->extradata_size);
-        put_bits(&pb, 5, hdr.object_type);
-        put_bits(&pb, 4, hdr.sampling_index);
-        put_bits(&pb, 4, hdr.chan_config);
-        put_bits(&pb, 1, 0); //frame length - 1024 samples
-        put_bits(&pb, 1, 0); //does not depend on core coder
-        put_bits(&pb, 1, 0); //is not extension
-        flush_put_bits(&pb);
-        if (pce_size) {
-            memcpy(avctx->extradata + 2, pce_data, pce_size);
-        }
-
-        ctx->first_frame_done = 1;
-    }
-
-    *poutbuf = (uint8_t*) buf;
-    *poutbuf_size = buf_size;
-
-    return 0;
-}
-
-AVBitStreamFilter aac_adtstoasc_bsf = {
-    "aac_adtstoasc",
-    sizeof(AACBSFContext),
-    aac_adtstoasc_filter,
-};
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
deleted file mode 100644
index 30ce04d..0000000
--- a/libavcodec/aac_parser.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Audio and Video frame extraction
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-#include "aac_ac3_parser.h"
-#include "aac_parser.h"
-#include "get_bits.h"
-#include "mpeg4audio.h"
-
-int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
-{
-    int size, rdb, ch, sr;
-    int aot, crc_abs;
-
-    if(get_bits(gbc, 12) != 0xfff)
-        return AAC_AC3_PARSE_ERROR_SYNC;
-
-    skip_bits1(gbc);             /* id */
-    skip_bits(gbc, 2);           /* layer */
-    crc_abs = get_bits1(gbc);    /* protection_absent */
-    aot     = get_bits(gbc, 2);  /* profile_objecttype */
-    sr      = get_bits(gbc, 4);  /* sample_frequency_index */
-    if(!ff_mpeg4audio_sample_rates[sr])
-        return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
-    skip_bits1(gbc);             /* private_bit */
-    ch      = get_bits(gbc, 3);  /* channel_configuration */
-
-    skip_bits1(gbc);             /* original/copy */
-    skip_bits1(gbc);             /* home */
-
-    /* adts_variable_header */
-    skip_bits1(gbc);             /* copyright_identification_bit */
-    skip_bits1(gbc);             /* copyright_identification_start */
-    size    = get_bits(gbc, 13); /* aac_frame_length */
-    if(size < AAC_ADTS_HEADER_SIZE)
-        return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
-
-    skip_bits(gbc, 11);          /* adts_buffer_fullness */
-    rdb = get_bits(gbc, 2);      /* number_of_raw_data_blocks_in_frame */
-
-    hdr->object_type    = aot + 1;
-    hdr->chan_config    = ch;
-    hdr->crc_absent     = crc_abs;
-    hdr->num_aac_frames = rdb + 1;
-    hdr->sampling_index = sr;
-    hdr->sample_rate    = ff_mpeg4audio_sample_rates[sr];
-    hdr->samples        = (rdb + 1) * 1024;
-    hdr->bit_rate       = size * 8 * hdr->sample_rate / hdr->samples;
-
-    return size;
-}
-
-static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
-        int *need_next_header, int *new_frame_start)
-{
-    GetBitContext bits;
-    AACADTSHeaderInfo hdr;
-    int size;
-    union {
-        uint64_t u64;
-        uint8_t  u8[8];
-    } tmp;
-
-    tmp.u64 = be2me_64(state);
-    init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8);
-
-    if ((size = ff_aac_parse_header(&bits, &hdr)) < 0)
-        return 0;
-    *need_next_header = 0;
-    *new_frame_start  = 1;
-    hdr_info->sample_rate = hdr.sample_rate;
-    hdr_info->channels    = ff_mpeg4audio_channels[hdr.chan_config];
-    hdr_info->samples     = hdr.samples;
-    hdr_info->bit_rate    = hdr.bit_rate;
-    return size;
-}
-
-static av_cold int aac_parse_init(AVCodecParserContext *s1)
-{
-    AACAC3ParseContext *s = s1->priv_data;
-    s->header_size = AAC_ADTS_HEADER_SIZE;
-    s->sync = aac_sync;
-    return 0;
-}
-
-
-AVCodecParser aac_parser = {
-    { CODEC_ID_AAC },
-    sizeof(AACAC3ParseContext),
-    aac_parse_init,
-    ff_aac_ac3_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/aac_parser.h b/libavcodec/aac_parser.h
deleted file mode 100644
index 8dd575b..0000000
--- a/libavcodec/aac_parser.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * AAC parser prototypes
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AAC_PARSER_H
-#define AVCODEC_AAC_PARSER_H
-
-#include <stdint.h>
-#include "aac_ac3_parser.h"
-#include "get_bits.h"
-
-#define AAC_ADTS_HEADER_SIZE 7
-
-typedef struct {
-    uint32_t sample_rate;
-    uint32_t samples;
-    uint32_t bit_rate;
-    uint8_t  crc_absent;
-    uint8_t  object_type;
-    uint8_t  sampling_index;
-    uint8_t  chan_config;
-    uint8_t  num_aac_frames;
-} AACADTSHeaderInfo;
-
-/**
- * Parses AAC frame header.
- * Parses the ADTS frame header to the end of the variable header, which is
- * the first 54 bits.
- * @param gbc[in] BitContext containing the first 54 bits of the frame.
- * @param hdr[out] Pointer to struct where header info is written.
- * @return Returns 0 on success, -1 if there is a sync word mismatch,
- * -2 if the version element is invalid, -3 if the sample rate
- * element is invalid, or -4 if the bit rate element is invalid.
- */
-int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr);
-
-#endif /* AVCODEC_AAC_PARSER_H */
diff --git a/libavcodec/aac_tablegen.c b/libavcodec/aac_tablegen.c
deleted file mode 100644
index de1c957..0000000
--- a/libavcodec/aac_tablegen.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Generate a header file for hardcoded AAC tables
- *
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#include "aac_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    ff_aac_tableinit();
-
-    write_fileheader();
-
-    printf("const float ff_aac_pow2sf_tab[428] = {\n");
-    write_float_array(ff_aac_pow2sf_tab, 428);
-    printf("};\n");
-
-    return 0;
-}
diff --git a/libavcodec/aac_tablegen.h b/libavcodec/aac_tablegen.h
deleted file mode 100644
index 630071d..0000000
--- a/libavcodec/aac_tablegen.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Header file for hardcoded AAC tables
- *
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AAC_TABLEGEN_H
-#define AAC_TABLEGEN_H
-
-#include "aac_tablegen_decl.h"
-
-#if CONFIG_HARDCODED_TABLES
-#include "libavcodec/aac_tables.h"
-#else
-#include "../libavutil/mathematics.h"
-float ff_aac_pow2sf_tab[428];
-
-void ff_aac_tableinit(void)
-{
-    int i;
-    for (i = 0; i < 428; i++)
-        ff_aac_pow2sf_tab[i] = pow(2, (i - 200) / 4.);
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* AAC_TABLEGEN_H */
diff --git a/libavcodec/aac_tablegen_decl.h b/libavcodec/aac_tablegen_decl.h
deleted file mode 100644
index 7157c80..0000000
--- a/libavcodec/aac_tablegen_decl.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Header file for hardcoded AAC tables
- *
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AAC_TABLEGEN_INIT_H
-#define AAC_TABLEGEN_INIT_H
-
-#if CONFIG_HARDCODED_TABLES
-#define ff_aac_tableinit()
-extern const float ff_aac_pow2sf_tab[428];
-#else
-void ff_aac_tableinit(void);
-extern       float ff_aac_pow2sf_tab[428];
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* AAC_TABLEGEN_INIT_H */
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
deleted file mode 100644
index 0957469..0000000
--- a/libavcodec/aaccoder.c
+++ /dev/null
@@ -1,960 +0,0 @@
-/*
- * AAC coefficients encoder
- * Copyright (C) 2008-2009 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC coefficients encoder
- */
-
-/***********************************
- *              TODOs:
- * speedup quantizer selection
- * add sane pulse detection
- ***********************************/
-
-#include "avcodec.h"
-#include "put_bits.h"
-#include "aac.h"
-#include "aacenc.h"
-#include "aactab.h"
-
-/** bits needed to code codebook run value for long windows */
-static const uint8_t run_value_bits_long[64] = {
-     5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,
-     5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5, 10,
-    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15
-};
-
-/** bits needed to code codebook run value for short windows */
-static const uint8_t run_value_bits_short[16] = {
-    3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9
-};
-
-static const uint8_t *run_value_bits[2] = {
-    run_value_bits_long, run_value_bits_short
-};
-
-
-/**
- * Quantize one coefficient.
- * @return absolute value of the quantized coefficient
- * @see 3GPP TS26.403 5.6.2 "Scalefactor determination"
- */
-static av_always_inline int quant(float coef, const float Q)
-{
-    float a = coef * Q;
-    return sqrtf(a * sqrtf(a)) + 0.4054;
-}
-
-static void quantize_bands(int (*out)[2], const float *in, const float *scaled,
-                           int size, float Q34, int is_signed, int maxval)
-{
-    int i;
-    double qc;
-    for (i = 0; i < size; i++) {
-        qc = scaled[i] * Q34;
-        out[i][0] = (int)FFMIN(qc,          (double)maxval);
-        out[i][1] = (int)FFMIN(qc + 0.4054, (double)maxval);
-        if (is_signed && in[i] < 0.0f) {
-            out[i][0] = -out[i][0];
-            out[i][1] = -out[i][1];
-        }
-    }
-}
-
-static void abs_pow34_v(float *out, const float *in, const int size)
-{
-#ifndef USE_REALLY_FULL_SEARCH
-    int i;
-    for (i = 0; i < size; i++) {
-        float a = fabsf(in[i]);
-        out[i] = sqrtf(a * sqrtf(a));
-    }
-#endif /* USE_REALLY_FULL_SEARCH */
-}
-
-static const uint8_t aac_cb_range [12] = {0, 3, 3, 3, 3, 9, 9, 8, 8, 13, 13, 17};
-static const uint8_t aac_cb_maxval[12] = {0, 1, 1, 2, 2, 4, 4, 7, 7, 12, 12, 16};
-
-/**
- * Calculate rate distortion cost for quantizing with given codebook
- *
- * @return quantization distortion
- */
-static float quantize_and_encode_band_cost(struct AACEncContext *s,
-                                PutBitContext *pb, const float *in,
-                                const float *scaled, int size, int scale_idx,
-                                int cb, const float lambda, const float uplim,
-                                int *bits)
-{
-    const float IQ = ff_aac_pow2sf_tab[200 + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
-    const float  Q = ff_aac_pow2sf_tab[200 - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
-    const float CLIPPED_ESCAPE = 165140.0f*IQ;
-    int i, j, k;
-    float cost = 0;
-    const int dim = cb < FIRST_PAIR_BT ? 4 : 2;
-    int resbits = 0;
-#ifndef USE_REALLY_FULL_SEARCH
-    const float  Q34 = sqrtf(Q * sqrtf(Q));
-    const int range  = aac_cb_range[cb];
-    const int maxval = aac_cb_maxval[cb];
-    int offs[4];
-#endif /* USE_REALLY_FULL_SEARCH */
-
-    if (!cb) {
-        for (i = 0; i < size; i++)
-            cost += in[i]*in[i];
-        if (bits)
-            *bits = 0;
-        return cost * lambda;
-    }
-#ifndef USE_REALLY_FULL_SEARCH
-    offs[0] = 1;
-    for (i = 1; i < dim; i++)
-        offs[i] = offs[i-1]*range;
-    if (!scaled) {
-        abs_pow34_v(s->scoefs, in, size);
-        scaled = s->scoefs;
-    }
-    quantize_bands(s->qcoefs, in, scaled, size, Q34, !IS_CODEBOOK_UNSIGNED(cb), maxval);
-#endif /* USE_REALLY_FULL_SEARCH */
-    for (i = 0; i < size; i += dim) {
-        float mincost;
-        int minidx  = 0;
-        int minbits = 0;
-        const float *vec;
-#ifndef USE_REALLY_FULL_SEARCH
-        int (*quants)[2] = &s->qcoefs[i];
-        mincost = 0.0f;
-        for (j = 0; j < dim; j++)
-            mincost += in[i+j]*in[i+j];
-        minidx = IS_CODEBOOK_UNSIGNED(cb) ? 0 : 40;
-        minbits = ff_aac_spectral_bits[cb-1][minidx];
-        mincost = mincost * lambda + minbits;
-        for (j = 0; j < (1<<dim); j++) {
-            float rd = 0.0f;
-            int curbits;
-            int curidx = IS_CODEBOOK_UNSIGNED(cb) ? 0 : 40;
-            int same   = 0;
-            for (k = 0; k < dim; k++) {
-                if ((j & (1 << k)) && quants[k][0] == quants[k][1]) {
-                    same = 1;
-                    break;
-                }
-            }
-            if (same)
-                continue;
-            for (k = 0; k < dim; k++)
-                curidx += quants[k][!!(j & (1 << k))] * offs[dim - 1 - k];
-            curbits =  ff_aac_spectral_bits[cb-1][curidx];
-            vec     = &ff_aac_codebook_vectors[cb-1][curidx*dim];
-#else
-        mincost = INFINITY;
-        vec = ff_aac_codebook_vectors[cb-1];
-        for (j = 0; j < ff_aac_spectral_sizes[cb-1]; j++, vec += dim) {
-            float rd = 0.0f;
-            int curbits = ff_aac_spectral_bits[cb-1][j];
-            int curidx = j;
-#endif /* USE_REALLY_FULL_SEARCH */
-            if (IS_CODEBOOK_UNSIGNED(cb)) {
-                for (k = 0; k < dim; k++) {
-                    float t = fabsf(in[i+k]);
-                    float di;
-                    if (vec[k] == 64.0f) { //FIXME: slow
-                        //do not code with escape sequence small values
-                        if (t < 39.0f*IQ) {
-                            rd = INFINITY;
-                            break;
-                        }
-                        if (t >= CLIPPED_ESCAPE) {
-                            di = t - CLIPPED_ESCAPE;
-                            curbits += 21;
-                        } else {
-                            int c = av_clip(quant(t, Q), 0, 8191);
-                            di = t - c*cbrtf(c)*IQ;
-                            curbits += av_log2(c)*2 - 4 + 1;
-                        }
-                    } else {
-                        di = t - vec[k]*IQ;
-                    }
-                    if (vec[k] != 0.0f)
-                        curbits++;
-                    rd += di*di;
-                }
-            } else {
-                for (k = 0; k < dim; k++) {
-                    float di = in[i+k] - vec[k]*IQ;
-                    rd += di*di;
-                }
-            }
-            rd = rd * lambda + curbits;
-            if (rd < mincost) {
-                mincost = rd;
-                minidx  = curidx;
-                minbits = curbits;
-            }
-        }
-        cost    += mincost;
-        resbits += minbits;
-        if (cost >= uplim)
-            return uplim;
-        if (pb) {
-        put_bits(pb, ff_aac_spectral_bits[cb-1][minidx], ff_aac_spectral_codes[cb-1][minidx]);
-        if (IS_CODEBOOK_UNSIGNED(cb))
-            for (j = 0; j < dim; j++)
-                if (ff_aac_codebook_vectors[cb-1][minidx*dim+j] != 0.0f)
-                    put_bits(pb, 1, in[i+j] < 0.0f);
-        if (cb == ESC_BT) {
-            for (j = 0; j < 2; j++) {
-                if (ff_aac_codebook_vectors[cb-1][minidx*2+j] == 64.0f) {
-                    int coef = av_clip(quant(fabsf(in[i+j]), Q), 0, 8191);
-                    int len = av_log2(coef);
-
-                    put_bits(pb, len - 4 + 1, (1 << (len - 4 + 1)) - 2);
-                    put_bits(pb, len, coef & ((1 << len) - 1));
-                }
-            }
-        }
-        }
-    }
-
-    if (bits)
-        *bits = resbits;
-    return cost;
-}
-static float quantize_band_cost(struct AACEncContext *s, const float *in,
-                                const float *scaled, int size, int scale_idx,
-                                int cb, const float lambda, const float uplim,
-                                int *bits)
-{
-    return quantize_and_encode_band_cost(s, NULL, in, scaled, size, scale_idx,
-                                         cb, lambda, uplim, bits);
-}
-
-static void quantize_and_encode_band(struct AACEncContext *s, PutBitContext *pb,
-                                     const float *in, int size, int scale_idx,
-                                     int cb, const float lambda)
-{
-    quantize_and_encode_band_cost(s, pb, in, NULL, size, scale_idx, cb, lambda,
-                                  INFINITY, NULL);
-}
-
-/**
- * structure used in optimal codebook search
- */
-typedef struct BandCodingPath {
-    int prev_idx; ///< pointer to the previous path point
-    float cost;   ///< path cost
-    int run;
-} BandCodingPath;
-
-/**
- * Encode band info for single window group bands.
- */
-static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce,
-                                     int win, int group_len, const float lambda)
-{
-    BandCodingPath path[120][12];
-    int w, swb, cb, start, start2, size;
-    int i, j;
-    const int max_sfb  = sce->ics.max_sfb;
-    const int run_bits = sce->ics.num_windows == 1 ? 5 : 3;
-    const int run_esc  = (1 << run_bits) - 1;
-    int idx, ppos, count;
-    int stackrun[120], stackcb[120], stack_len;
-    float next_minrd = INFINITY;
-    int next_mincb = 0;
-
-    abs_pow34_v(s->scoefs, sce->coeffs, 1024);
-    start = win*128;
-    for (cb = 0; cb < 12; cb++) {
-        path[0][cb].cost     = 0.0f;
-        path[0][cb].prev_idx = -1;
-        path[0][cb].run      = 0;
-    }
-    for (swb = 0; swb < max_sfb; swb++) {
-        start2 = start;
-        size = sce->ics.swb_sizes[swb];
-        if (sce->zeroes[win*16 + swb]) {
-            for (cb = 0; cb < 12; cb++) {
-                path[swb+1][cb].prev_idx = cb;
-                path[swb+1][cb].cost     = path[swb][cb].cost;
-                path[swb+1][cb].run      = path[swb][cb].run + 1;
-            }
-        } else {
-            float minrd = next_minrd;
-            int mincb = next_mincb;
-            next_minrd = INFINITY;
-            next_mincb = 0;
-            for (cb = 0; cb < 12; cb++) {
-                float cost_stay_here, cost_get_here;
-                float rd = 0.0f;
-                for (w = 0; w < group_len; w++) {
-                    FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(win+w)*16+swb];
-                    rd += quantize_band_cost(s, sce->coeffs + start + w*128,
-                                             s->scoefs + start + w*128, size,
-                                             sce->sf_idx[(win+w)*16+swb], cb,
-                                             lambda / band->threshold, INFINITY, NULL);
-                }
-                cost_stay_here = path[swb][cb].cost + rd;
-                cost_get_here  = minrd              + rd + run_bits + 4;
-                if (   run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run]
-                    != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1])
-                    cost_stay_here += run_bits;
-                if (cost_get_here < cost_stay_here) {
-                    path[swb+1][cb].prev_idx = mincb;
-                    path[swb+1][cb].cost     = cost_get_here;
-                    path[swb+1][cb].run      = 1;
-                } else {
-                    path[swb+1][cb].prev_idx = cb;
-                    path[swb+1][cb].cost     = cost_stay_here;
-                    path[swb+1][cb].run      = path[swb][cb].run + 1;
-                }
-                if (path[swb+1][cb].cost < next_minrd) {
-                    next_minrd = path[swb+1][cb].cost;
-                    next_mincb = cb;
-                }
-            }
-        }
-        start += sce->ics.swb_sizes[swb];
-    }
-
-    //convert resulting path from backward-linked list
-    stack_len = 0;
-    idx       = 0;
-    for (cb = 1; cb < 12; cb++)
-        if (path[max_sfb][cb].cost < path[max_sfb][idx].cost)
-            idx = cb;
-    ppos = max_sfb;
-    while (ppos > 0) {
-        cb = idx;
-        stackrun[stack_len] = path[ppos][cb].run;
-        stackcb [stack_len] = cb;
-        idx = path[ppos-path[ppos][cb].run+1][cb].prev_idx;
-        ppos -= path[ppos][cb].run;
-        stack_len++;
-    }
-    //perform actual band info encoding
-    start = 0;
-    for (i = stack_len - 1; i >= 0; i--) {
-        put_bits(&s->pb, 4, stackcb[i]);
-        count = stackrun[i];
-        memset(sce->zeroes + win*16 + start, !stackcb[i], count);
-        //XXX: memset when band_type is also uint8_t
-        for (j = 0; j < count; j++) {
-            sce->band_type[win*16 + start] =  stackcb[i];
-            start++;
-        }
-        while (count >= run_esc) {
-            put_bits(&s->pb, run_bits, run_esc);
-            count -= run_esc;
-        }
-        put_bits(&s->pb, run_bits, count);
-    }
-}
-
-typedef struct TrellisPath {
-    float cost;
-    int prev;
-    int min_val;
-    int max_val;
-} TrellisPath;
-
-#define TRELLIS_STAGES 121
-#define TRELLIS_STATES 256
-
-static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s,
-                                       SingleChannelElement *sce,
-                                       const float lambda)
-{
-    int q, w, w2, g, start = 0;
-    int i, j;
-    int idx;
-    TrellisPath paths[TRELLIS_STAGES][TRELLIS_STATES];
-    int bandaddr[TRELLIS_STAGES];
-    int minq;
-    float mincost;
-
-    for (i = 0; i < TRELLIS_STATES; i++) {
-        paths[0][i].cost    = 0.0f;
-        paths[0][i].prev    = -1;
-        paths[0][i].min_val = i;
-        paths[0][i].max_val = i;
-    }
-    for (j = 1; j < TRELLIS_STAGES; j++) {
-        for (i = 0; i < TRELLIS_STATES; i++) {
-            paths[j][i].cost    = INFINITY;
-            paths[j][i].prev    = -2;
-            paths[j][i].min_val = INT_MAX;
-            paths[j][i].max_val = 0;
-        }
-    }
-    idx = 1;
-    abs_pow34_v(s->scoefs, sce->coeffs, 1024);
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        start = w*128;
-        for (g = 0; g < sce->ics.num_swb; g++) {
-            const float *coefs = sce->coeffs + start;
-            float qmin, qmax;
-            int nz = 0;
-
-            bandaddr[idx] = w * 16 + g;
-            qmin = INT_MAX;
-            qmax = 0.0f;
-            for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
-                FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
-                if (band->energy <= band->threshold || band->threshold == 0.0f) {
-                    sce->zeroes[(w+w2)*16+g] = 1;
-                    continue;
-                }
-                sce->zeroes[(w+w2)*16+g] = 0;
-                nz = 1;
-                for (i = 0; i < sce->ics.swb_sizes[g]; i++) {
-                    float t = fabsf(coefs[w2*128+i]);
-                    if (t > 0.0f)
-                        qmin = FFMIN(qmin, t);
-                    qmax = FFMAX(qmax, t);
-                }
-            }
-            if (nz) {
-                int minscale, maxscale;
-                float minrd = INFINITY;
-                //minimum scalefactor index is when minimum nonzero coefficient after quantizing is not clipped
-                minscale = av_clip_uint8(log2(qmin)*4 - 69 + SCALE_ONE_POS - SCALE_DIV_512);
-                //maximum scalefactor index is when maximum coefficient after quantizing is still not zero
-                maxscale = av_clip_uint8(log2(qmax)*4 +  6 + SCALE_ONE_POS - SCALE_DIV_512);
-                for (q = minscale; q < maxscale; q++) {
-                    float dists[12], dist;
-                    memset(dists, 0, sizeof(dists));
-                    for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
-                        FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
-                        int cb;
-                        for (cb = 0; cb <= ESC_BT; cb++)
-                            dists[cb] += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g],
-                                                            q, cb, lambda / band->threshold, INFINITY, NULL);
-                    }
-                    dist = dists[0];
-                    for (i = 1; i <= ESC_BT; i++)
-                        dist = FFMIN(dist, dists[i]);
-                    minrd = FFMIN(minrd, dist);
-
-                    for (i = FFMAX(q - SCALE_MAX_DIFF, 0); i < FFMIN(q + SCALE_MAX_DIFF, TRELLIS_STATES); i++) {
-                        float cost;
-                        int minv, maxv;
-                        if (isinf(paths[idx - 1][i].cost))
-                            continue;
-                        cost = paths[idx - 1][i].cost + dist
-                               + ff_aac_scalefactor_bits[q - i + SCALE_DIFF_ZERO];
-                        minv = FFMIN(paths[idx - 1][i].min_val, q);
-                        maxv = FFMAX(paths[idx - 1][i].max_val, q);
-                        if (cost < paths[idx][q].cost && maxv-minv < SCALE_MAX_DIFF) {
-                            paths[idx][q].cost    = cost;
-                            paths[idx][q].prev    = i;
-                            paths[idx][q].min_val = minv;
-                            paths[idx][q].max_val = maxv;
-                        }
-                    }
-                }
-            } else {
-                for (q = 0; q < TRELLIS_STATES; q++) {
-                    if (!isinf(paths[idx - 1][q].cost)) {
-                        paths[idx][q].cost = paths[idx - 1][q].cost + 1;
-                        paths[idx][q].prev = q;
-                        paths[idx][q].min_val = FFMIN(paths[idx - 1][q].min_val, q);
-                        paths[idx][q].max_val = FFMAX(paths[idx - 1][q].max_val, q);
-                        continue;
-                    }
-                    for (i = FFMAX(q - SCALE_MAX_DIFF, 0); i < FFMIN(q + SCALE_MAX_DIFF, TRELLIS_STATES); i++) {
-                        float cost;
-                        int minv, maxv;
-                        if (isinf(paths[idx - 1][i].cost))
-                            continue;
-                        cost = paths[idx - 1][i].cost + ff_aac_scalefactor_bits[q - i + SCALE_DIFF_ZERO];
-                        minv = FFMIN(paths[idx - 1][i].min_val, q);
-                        maxv = FFMAX(paths[idx - 1][i].max_val, q);
-                        if (cost < paths[idx][q].cost && maxv-minv < SCALE_MAX_DIFF) {
-                            paths[idx][q].cost    = cost;
-                            paths[idx][q].prev    = i;
-                            paths[idx][q].min_val = minv;
-                            paths[idx][q].max_val = maxv;
-                        }
-                    }
-                }
-            }
-            sce->zeroes[w*16+g] = !nz;
-            start += sce->ics.swb_sizes[g];
-            idx++;
-        }
-    }
-    idx--;
-    mincost = paths[idx][0].cost;
-    minq    = 0;
-    for (i = 1; i < TRELLIS_STATES; i++) {
-        if (paths[idx][i].cost < mincost) {
-            mincost = paths[idx][i].cost;
-            minq = i;
-        }
-    }
-    while (idx) {
-        sce->sf_idx[bandaddr[idx]] = minq;
-        minq = paths[idx][minq].prev;
-        idx--;
-    }
-    //set the same quantizers inside window groups
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
-        for (g = 0;  g < sce->ics.num_swb; g++)
-            for (w2 = 1; w2 < sce->ics.group_len[w]; w2++)
-                sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g];
-}
-
-/**
- * two-loop quantizers search taken from ISO 13818-7 Appendix C
- */
-static void search_for_quantizers_twoloop(AVCodecContext *avctx,
-                                          AACEncContext *s,
-                                          SingleChannelElement *sce,
-                                          const float lambda)
-{
-    int start = 0, i, w, w2, g;
-    int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
-    float dists[128], uplims[128];
-    int fflag, minscaler;
-    int its  = 0;
-    int allz = 0;
-    float minthr = INFINITY;
-
-    //XXX: some heuristic to determine initial quantizers will reduce search time
-    memset(dists, 0, sizeof(dists));
-    //determine zero bands and upper limits
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        for (g = 0;  g < sce->ics.num_swb; g++) {
-            int nz = 0;
-            float uplim = 0.0f;
-            for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
-                FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
-                uplim += band->threshold;
-                if (band->energy <= band->threshold || band->threshold == 0.0f) {
-                    sce->zeroes[(w+w2)*16+g] = 1;
-                    continue;
-                }
-                nz = 1;
-            }
-            uplims[w*16+g] = uplim *512;
-            sce->zeroes[w*16+g] = !nz;
-            if (nz)
-                minthr = FFMIN(minthr, uplim);
-            allz = FFMAX(allz, nz);
-        }
-    }
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        for (g = 0;  g < sce->ics.num_swb; g++) {
-            if (sce->zeroes[w*16+g]) {
-                sce->sf_idx[w*16+g] = SCALE_ONE_POS;
-                continue;
-            }
-            sce->sf_idx[w*16+g] = SCALE_ONE_POS + FFMIN(log2(uplims[w*16+g]/minthr)*4,59);
-        }
-    }
-
-    if (!allz)
-        return;
-    abs_pow34_v(s->scoefs, sce->coeffs, 1024);
-    //perform two-loop search
-    //outer loop - improve quality
-    do {
-        int tbits, qstep;
-        minscaler = sce->sf_idx[0];
-        //inner loop - quantize spectrum to fit into given number of bits
-        qstep = its ? 1 : 32;
-        do {
-            int prev = -1;
-            tbits = 0;
-            fflag = 0;
-            for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-                start = w*128;
-                for (g = 0;  g < sce->ics.num_swb; g++) {
-                    const float *coefs = sce->coeffs + start;
-                    const float *scaled = s->scoefs + start;
-                    int bits = 0;
-                    int cb;
-                    float mindist = INFINITY;
-                    int minbits = 0;
-
-                    if (sce->zeroes[w*16+g] || sce->sf_idx[w*16+g] >= 218) {
-                        start += sce->ics.swb_sizes[g];
-                        continue;
-                    }
-                    minscaler = FFMIN(minscaler, sce->sf_idx[w*16+g]);
-                    for (cb = 0; cb <= ESC_BT; cb++) {
-                        float dist = 0.0f;
-                        int bb = 0;
-                        for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
-                            int b;
-                            dist += quantize_band_cost(s, coefs + w2*128,
-                                                       scaled + w2*128,
-                                                       sce->ics.swb_sizes[g],
-                                                       sce->sf_idx[w*16+g],
-                                                       cb,
-                                                       lambda,
-                                                       INFINITY,
-                                                       &b);
-                            bb += b;
-                        }
-                        if (dist < mindist) {
-                            mindist = dist;
-                            minbits = bb;
-                        }
-                    }
-                    dists[w*16+g] = (mindist - minbits) / lambda;
-                    bits = minbits;
-                    if (prev != -1) {
-                        bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO];
-                    }
-                    tbits += bits;
-                    start += sce->ics.swb_sizes[g];
-                    prev = sce->sf_idx[w*16+g];
-                }
-            }
-            if (tbits > destbits) {
-                for (i = 0; i < 128; i++)
-                    if (sce->sf_idx[i] < 218 - qstep)
-                        sce->sf_idx[i] += qstep;
-            } else {
-                for (i = 0; i < 128; i++)
-                    if (sce->sf_idx[i] > 60 - qstep)
-                        sce->sf_idx[i] -= qstep;
-            }
-            qstep >>= 1;
-            if (!qstep && tbits > destbits*1.02)
-                qstep = 1;
-            if (sce->sf_idx[0] >= 217)
-                break;
-        } while (qstep);
-
-        fflag = 0;
-        minscaler = av_clip(minscaler, 60, 255 - SCALE_MAX_DIFF);
-        for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-            start = w*128;
-            for (g = 0; g < sce->ics.num_swb; g++) {
-                int prevsc = sce->sf_idx[w*16+g];
-                if (dists[w*16+g] > uplims[w*16+g] && sce->sf_idx[w*16+g] > 60)
-                    sce->sf_idx[w*16+g]--;
-                sce->sf_idx[w*16+g] = av_clip(sce->sf_idx[w*16+g], minscaler, minscaler + SCALE_MAX_DIFF);
-                sce->sf_idx[w*16+g] = FFMIN(sce->sf_idx[w*16+g], 219);
-                if (sce->sf_idx[w*16+g] != prevsc)
-                    fflag = 1;
-            }
-        }
-        its++;
-    } while (fflag && its < 10);
-}
-
-static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s,
-                                       SingleChannelElement *sce,
-                                       const float lambda)
-{
-    int start = 0, i, w, w2, g;
-    float uplim[128], maxq[128];
-    int minq, maxsf;
-    float distfact = ((sce->ics.num_windows > 1) ? 85.80 : 147.84) / lambda;
-    int last = 0, lastband = 0, curband = 0;
-    float avg_energy = 0.0;
-    if (sce->ics.num_windows == 1) {
-        start = 0;
-        for (i = 0; i < 1024; i++) {
-            if (i - start >= sce->ics.swb_sizes[curband]) {
-                start += sce->ics.swb_sizes[curband];
-                curband++;
-            }
-            if (sce->coeffs[i]) {
-                avg_energy += sce->coeffs[i] * sce->coeffs[i];
-                last = i;
-                lastband = curband;
-            }
-        }
-    } else {
-        for (w = 0; w < 8; w++) {
-            const float *coeffs = sce->coeffs + w*128;
-            start = 0;
-            for (i = 0; i < 128; i++) {
-                if (i - start >= sce->ics.swb_sizes[curband]) {
-                    start += sce->ics.swb_sizes[curband];
-                    curband++;
-                }
-                if (coeffs[i]) {
-                    avg_energy += coeffs[i] * coeffs[i];
-                    last = FFMAX(last, i);
-                    lastband = FFMAX(lastband, curband);
-                }
-            }
-        }
-    }
-    last++;
-    avg_energy /= last;
-    if (avg_energy == 0.0f) {
-        for (i = 0; i < FF_ARRAY_ELEMS(sce->sf_idx); i++)
-            sce->sf_idx[i] = SCALE_ONE_POS;
-        return;
-    }
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        start = w*128;
-        for (g = 0; g < sce->ics.num_swb; g++) {
-            float *coefs   = sce->coeffs + start;
-            const int size = sce->ics.swb_sizes[g];
-            int start2 = start, end2 = start + size, peakpos = start;
-            float maxval = -1, thr = 0.0f, t;
-            maxq[w*16+g] = 0.0f;
-            if (g > lastband) {
-                maxq[w*16+g] = 0.0f;
-                start += size;
-                for (w2 = 0; w2 < sce->ics.group_len[w]; w2++)
-                    memset(coefs + w2*128, 0, sizeof(coefs[0])*size);
-                continue;
-            }
-            for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
-                for (i = 0; i < size; i++) {
-                    float t = coefs[w2*128+i]*coefs[w2*128+i];
-                    maxq[w*16+g] = FFMAX(maxq[w*16+g], fabsf(coefs[w2*128 + i]));
-                    thr += t;
-                    if (sce->ics.num_windows == 1 && maxval < t) {
-                        maxval  = t;
-                        peakpos = start+i;
-                    }
-                }
-            }
-            if (sce->ics.num_windows == 1) {
-                start2 = FFMAX(peakpos - 2, start2);
-                end2   = FFMIN(peakpos + 3, end2);
-            } else {
-                start2 -= start;
-                end2   -= start;
-            }
-            start += size;
-            thr = pow(thr / (avg_energy * (end2 - start2)), 0.3 + 0.1*(lastband - g) / lastband);
-            t   = 1.0 - (1.0 * start2 / last);
-            uplim[w*16+g] = distfact / (1.4 * thr + t*t*t + 0.075);
-        }
-    }
-    memset(sce->sf_idx, 0, sizeof(sce->sf_idx));
-    abs_pow34_v(s->scoefs, sce->coeffs, 1024);
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        start = w*128;
-        for (g = 0;  g < sce->ics.num_swb; g++) {
-            const float *coefs  = sce->coeffs + start;
-            const float *scaled = s->scoefs   + start;
-            const int size      = sce->ics.swb_sizes[g];
-            int scf, prev_scf, step;
-            int min_scf = -1, max_scf = 256;
-            float curdiff;
-            if (maxq[w*16+g] < 21.544) {
-                sce->zeroes[w*16+g] = 1;
-                start += size;
-                continue;
-            }
-            sce->zeroes[w*16+g] = 0;
-            scf  = prev_scf = av_clip(SCALE_ONE_POS - SCALE_DIV_512 - log2(1/maxq[w*16+g])*16/3, 60, 218);
-            step = 16;
-            for (;;) {
-                float dist = 0.0f;
-                int quant_max;
-
-                for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
-                    int b;
-                    dist += quantize_band_cost(s, coefs + w2*128,
-                                               scaled + w2*128,
-                                               sce->ics.swb_sizes[g],
-                                               scf,
-                                               ESC_BT,
-                                               lambda,
-                                               INFINITY,
-                                               &b);
-                    dist -= b;
-                }
-                dist *= 1.0f / 512.0f / lambda;
-                quant_max = quant(maxq[w*16+g], ff_aac_pow2sf_tab[200 - scf + SCALE_ONE_POS - SCALE_DIV_512]);
-                if (quant_max >= 8191) { // too much, return to the previous quantizer
-                    sce->sf_idx[w*16+g] = prev_scf;
-                    break;
-                }
-                prev_scf = scf;
-                curdiff = fabsf(dist - uplim[w*16+g]);
-                if (curdiff <= 1.0f)
-                    step = 0;
-                else
-                    step = log2(curdiff);
-                if (dist > uplim[w*16+g])
-                    step = -step;
-                scf += step;
-                scf = av_clip_uint8(scf);
-                step = scf - prev_scf;
-                if (FFABS(step) <= 1 || (step > 0 && scf >= max_scf) || (step < 0 && scf <= min_scf)) {
-                    sce->sf_idx[w*16+g] = av_clip(scf, min_scf, max_scf);
-                    break;
-                }
-                if (step > 0)
-                    min_scf = prev_scf;
-                else
-                    max_scf = prev_scf;
-            }
-            start += size;
-        }
-    }
-    minq = sce->sf_idx[0] ? sce->sf_idx[0] : INT_MAX;
-    for (i = 1; i < 128; i++) {
-        if (!sce->sf_idx[i])
-            sce->sf_idx[i] = sce->sf_idx[i-1];
-        else
-            minq = FFMIN(minq, sce->sf_idx[i]);
-    }
-    if (minq == INT_MAX)
-        minq = 0;
-    minq = FFMIN(minq, SCALE_MAX_POS);
-    maxsf = FFMIN(minq + SCALE_MAX_DIFF, SCALE_MAX_POS);
-    for (i = 126; i >= 0; i--) {
-        if (!sce->sf_idx[i])
-            sce->sf_idx[i] = sce->sf_idx[i+1];
-        sce->sf_idx[i] = av_clip(sce->sf_idx[i], minq, maxsf);
-    }
-}
-
-static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
-                                       SingleChannelElement *sce,
-                                       const float lambda)
-{
-    int start = 0, i, w, w2, g;
-    int minq = 255;
-
-    memset(sce->sf_idx, 0, sizeof(sce->sf_idx));
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        start = w*128;
-        for (g = 0; g < sce->ics.num_swb; g++) {
-            for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
-                FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
-                if (band->energy <= band->threshold) {
-                    sce->sf_idx[(w+w2)*16+g] = 218;
-                    sce->zeroes[(w+w2)*16+g] = 1;
-                } else {
-                    sce->sf_idx[(w+w2)*16+g] = av_clip(SCALE_ONE_POS - SCALE_DIV_512 + log2(band->threshold), 80, 218);
-                    sce->zeroes[(w+w2)*16+g] = 0;
-                }
-                minq = FFMIN(minq, sce->sf_idx[(w+w2)*16+g]);
-            }
-        }
-    }
-    for (i = 0; i < 128; i++) {
-        sce->sf_idx[i] = 140;
-        //av_clip(sce->sf_idx[i], minq, minq + SCALE_MAX_DIFF - 1);
-    }
-    //set the same quantizers inside window groups
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
-        for (g = 0;  g < sce->ics.num_swb; g++)
-            for (w2 = 1; w2 < sce->ics.group_len[w]; w2++)
-                sce->sf_idx[(w+w2)*16+g] = sce->sf_idx[w*16+g];
-}
-
-static void search_for_ms(AACEncContext *s, ChannelElement *cpe,
-                          const float lambda)
-{
-    int start = 0, i, w, w2, g;
-    float M[128], S[128];
-    float *L34 = s->scoefs, *R34 = s->scoefs + 128, *M34 = s->scoefs + 128*2, *S34 = s->scoefs + 128*3;
-    SingleChannelElement *sce0 = &cpe->ch[0];
-    SingleChannelElement *sce1 = &cpe->ch[1];
-    if (!cpe->common_window)
-        return;
-    for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) {
-        for (g = 0;  g < sce0->ics.num_swb; g++) {
-            if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {
-                float dist1 = 0.0f, dist2 = 0.0f;
-                for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
-                    FFPsyBand *band0 = &s->psy.psy_bands[(s->cur_channel+0)*PSY_MAX_BANDS+(w+w2)*16+g];
-                    FFPsyBand *band1 = &s->psy.psy_bands[(s->cur_channel+1)*PSY_MAX_BANDS+(w+w2)*16+g];
-                    float minthr = FFMIN(band0->threshold, band1->threshold);
-                    float maxthr = FFMAX(band0->threshold, band1->threshold);
-                    for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
-                        M[i] = (sce0->coeffs[start+w2*128+i]
-                              + sce1->coeffs[start+w2*128+i]) * 0.5;
-                        S[i] =  sce0->coeffs[start+w2*128+i]
-                              - sce1->coeffs[start+w2*128+i];
-                    }
-                    abs_pow34_v(L34, sce0->coeffs+start+w2*128, sce0->ics.swb_sizes[g]);
-                    abs_pow34_v(R34, sce1->coeffs+start+w2*128, sce0->ics.swb_sizes[g]);
-                    abs_pow34_v(M34, M,                         sce0->ics.swb_sizes[g]);
-                    abs_pow34_v(S34, S,                         sce0->ics.swb_sizes[g]);
-                    dist1 += quantize_band_cost(s, sce0->coeffs + start + w2*128,
-                                                L34,
-                                                sce0->ics.swb_sizes[g],
-                                                sce0->sf_idx[(w+w2)*16+g],
-                                                sce0->band_type[(w+w2)*16+g],
-                                                lambda / band0->threshold, INFINITY, NULL);
-                    dist1 += quantize_band_cost(s, sce1->coeffs + start + w2*128,
-                                                R34,
-                                                sce1->ics.swb_sizes[g],
-                                                sce1->sf_idx[(w+w2)*16+g],
-                                                sce1->band_type[(w+w2)*16+g],
-                                                lambda / band1->threshold, INFINITY, NULL);
-                    dist2 += quantize_band_cost(s, M,
-                                                M34,
-                                                sce0->ics.swb_sizes[g],
-                                                sce0->sf_idx[(w+w2)*16+g],
-                                                sce0->band_type[(w+w2)*16+g],
-                                                lambda / maxthr, INFINITY, NULL);
-                    dist2 += quantize_band_cost(s, S,
-                                                S34,
-                                                sce1->ics.swb_sizes[g],
-                                                sce1->sf_idx[(w+w2)*16+g],
-                                                sce1->band_type[(w+w2)*16+g],
-                                                lambda / minthr, INFINITY, NULL);
-                }
-                cpe->ms_mask[w*16+g] = dist2 < dist1;
-            }
-            start += sce0->ics.swb_sizes[g];
-        }
-    }
-}
-
-AACCoefficientsEncoder ff_aac_coders[] = {
-    {
-        search_for_quantizers_faac,
-        encode_window_bands_info,
-        quantize_and_encode_band,
-        search_for_ms,
-    },
-    {
-        search_for_quantizers_anmr,
-        encode_window_bands_info,
-        quantize_and_encode_band,
-        search_for_ms,
-    },
-    {
-        search_for_quantizers_twoloop,
-        encode_window_bands_info,
-        quantize_and_encode_band,
-        search_for_ms,
-    },
-    {
-        search_for_quantizers_fast,
-        encode_window_bands_info,
-        quantize_and_encode_band,
-        search_for_ms,
-    },
-};
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
deleted file mode 100644
index e375d1f..0000000
--- a/libavcodec/aacdec.c
+++ /dev/null
@@ -1,2142 +0,0 @@
-/*
- * AAC decoder
- * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
- * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC decoder
- * @author Oded Shimon  ( ods15 ods15 dyndns org )
- * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
- */
-
-/*
- * supported tools
- *
- * Support?             Name
- * N (code in SoC repo) gain control
- * Y                    block switching
- * Y                    window shapes - standard
- * N                    window shapes - Low Delay
- * Y                    filterbank - standard
- * N (code in SoC repo) filterbank - Scalable Sample Rate
- * Y                    Temporal Noise Shaping
- * N (code in SoC repo) Long Term Prediction
- * Y                    intensity stereo
- * Y                    channel coupling
- * Y                    frequency domain prediction
- * Y                    Perceptual Noise Substitution
- * Y                    Mid/Side stereo
- * N                    Scalable Inverse AAC Quantization
- * N                    Frequency Selective Switch
- * N                    upsampling filter
- * Y                    quantization & coding - AAC
- * N                    quantization & coding - TwinVQ
- * N                    quantization & coding - BSAC
- * N                    AAC Error Resilience tools
- * N                    Error Resilience payload syntax
- * N                    Error Protection tool
- * N                    CELP
- * N                    Silence Compression
- * N                    HVXC
- * N                    HVXC 4kbits/s VR
- * N                    Structured Audio tools
- * N                    Structured Audio Sample Bank Format
- * N                    MIDI
- * N                    Harmonic and Individual Lines plus Noise
- * N                    Text-To-Speech Interface
- * Y                    Spectral Band Replication
- * Y (not in this code) Layer-1
- * Y (not in this code) Layer-2
- * Y (not in this code) Layer-3
- * N                    SinuSoidal Coding (Transient, Sinusoid, Noise)
- * Y                    Parametric Stereo
- * N                    Direct Stream Transfer
- *
- * Note: - HE AAC v1 comprises LC AAC with Spectral Band Replication.
- *       - HE AAC v2 comprises LC AAC with Spectral Band Replication and
-           Parametric Stereo.
- */
-
-
-#include "avcodec.h"
-#include "internal.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-#include "lpc.h"
-
-#include "aac.h"
-#include "aactab.h"
-#include "aacdectab.h"
-#include "cbrt_tablegen.h"
-#include "sbr.h"
-#include "aacsbr.h"
-#include "mpeg4audio.h"
-#include "aac_parser.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <math.h>
-#include <string.h>
-
-#if ARCH_ARM
-#   include "arm/aac.h"
-#endif
-
-union float754 {
-    float f;
-    uint32_t i;
-};
-
-static VLC vlc_scalefactors;
-static VLC vlc_spectral[11];
-
-static const char overread_err[] = "Input buffer exhausted before END element found\n";
-
-static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
-{
-    /* Some buggy encoders appear to set all elem_ids to zero and rely on
-    channels always occurring in the same order. This is expressly forbidden
-    by the spec but we will try to work around it.
-    */
-    int err_printed = 0;
-    while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) {
-        if (ac->output_configured < OC_LOCKED && !err_printed) {
-            av_log(ac->avctx, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n");
-            err_printed = 1;
-        }
-        elem_id++;
-    }
-    if (elem_id == MAX_ELEM_ID)
-        return NULL;
-    ac->tags_seen_this_frame[type][elem_id] = 1;
-
-    if (ac->tag_che_map[type][elem_id]) {
-        return ac->tag_che_map[type][elem_id];
-    }
-    if (ac->tags_mapped >= tags_per_config[ac->m4ac.chan_config]) {
-        return NULL;
-    }
-    switch (ac->m4ac.chan_config) {
-    case 7:
-        if (ac->tags_mapped == 3 && type == TYPE_CPE) {
-            ac->tags_mapped++;
-            return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
-        }
-    case 6:
-        /* Some streams incorrectly code 5.1 audio as SCE[0] CPE[0] CPE[1] SCE[1]
-           instead of SCE[0] CPE[0] CPE[1] LFE[0]. If we seem to have
-           encountered such a stream, transfer the LFE[0] element to the SCE[1]'s mapping */
-        if (ac->tags_mapped == tags_per_config[ac->m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
-            ac->tags_mapped++;
-            return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0];
-        }
-    case 5:
-        if (ac->tags_mapped == 2 && type == TYPE_CPE) {
-            ac->tags_mapped++;
-            return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1];
-        }
-    case 4:
-        if (ac->tags_mapped == 2 && ac->m4ac.chan_config == 4 && type == TYPE_SCE) {
-            ac->tags_mapped++;
-            return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
-        }
-    case 3:
-    case 2:
-        if (ac->tags_mapped == (ac->m4ac.chan_config != 2) && type == TYPE_CPE) {
-            ac->tags_mapped++;
-            return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0];
-        } else if (ac->m4ac.chan_config == 2) {
-            return NULL;
-        }
-    case 1:
-        if (!ac->tags_mapped && type == TYPE_SCE) {
-            ac->tags_mapped++;
-            return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0];
-        }
-    default:
-        return NULL;
-    }
-}
-
-/**
- * Check for the channel element in the current channel position configuration.
- * If it exists, make sure the appropriate element is allocated and map the
- * channel order to match the internal FFmpeg channel layout.
- *
- * @param   che_pos current channel position configuration
- * @param   type channel element type
- * @param   id channel element id
- * @param   channels count of the number of channels in the configuration
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static av_cold int che_configure(AACContext *ac,
-                         enum ChannelPosition che_pos[4][MAX_ELEM_ID],
-                         int type, int id,
-                         int *channels)
-{
-    if (che_pos[type][id]) {
-        if (!ac->che[type][id] && !(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
-            return AVERROR(ENOMEM);
-        ff_aac_sbr_ctx_init(&ac->che[type][id]->sbr);
-        if (type != TYPE_CCE) {
-            ac->output_data[(*channels)++] = ac->che[type][id]->ch[0].ret;
-            if (type == TYPE_CPE ||
-                (type == TYPE_SCE && ac->m4ac.ps == 1)) {
-                ac->output_data[(*channels)++] = ac->che[type][id]->ch[1].ret;
-            }
-        }
-    } else {
-        if (ac->che[type][id])
-            ff_aac_sbr_ctx_close(&ac->che[type][id]->sbr);
-        av_freep(&ac->che[type][id]);
-    }
-    return 0;
-}
-
-/**
- * Configure output channel order based on the current program configuration element.
- *
- * @param   che_pos current channel position configuration
- * @param   new_che_pos New channel position configuration - we only do something if it differs from the current one.
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static av_cold int output_configure(AACContext *ac,
-                            enum ChannelPosition che_pos[4][MAX_ELEM_ID],
-                            enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
-                            int channel_config, enum OCStatus oc_type)
-{
-    AVCodecContext *avctx = ac->avctx;
-    int i, type, channels = 0, ret;
-
-    if (new_che_pos != che_pos)
-    memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
-
-    if (channel_config) {
-        for (i = 0; i < tags_per_config[channel_config]; i++) {
-            if ((ret = che_configure(ac, che_pos,
-                                     aac_channel_layout_map[channel_config - 1][i][0],
-                                     aac_channel_layout_map[channel_config - 1][i][1],
-                                     &channels)))
-                return ret;
-        }
-
-        memset(ac->tag_che_map, 0,       4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
-        ac->tags_mapped = 0;
-
-        avctx->channel_layout = aac_channel_layout[channel_config - 1];
-    } else {
-        /* Allocate or free elements depending on if they are in the
-         * current program configuration.
-         *
-         * Set up default 1:1 output mapping.
-         *
-         * For a 5.1 stream the output order will be:
-         *    [ Center ] [ Front Left ] [ Front Right ] [ LFE ] [ Surround Left ] [ Surround Right ]
-         */
-
-        for (i = 0; i < MAX_ELEM_ID; i++) {
-            for (type = 0; type < 4; type++) {
-                if ((ret = che_configure(ac, che_pos, type, i, &channels)))
-                    return ret;
-            }
-        }
-
-        memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
-        ac->tags_mapped = 4 * MAX_ELEM_ID;
-
-        avctx->channel_layout = 0;
-    }
-
-    avctx->channels = channels;
-
-    ac->output_configured = oc_type;
-
-    return 0;
-}
-
-/**
- * Decode an array of 4 bit element IDs, optionally interleaved with a stereo/mono switching bit.
- *
- * @param cpe_map Stereo (Channel Pair Element) map, NULL if stereo bit is not present.
- * @param sce_map mono (Single Channel Element) map
- * @param type speaker type/position for these channels
- */
-static void decode_channel_map(enum ChannelPosition *cpe_map,
-                               enum ChannelPosition *sce_map,
-                               enum ChannelPosition type,
-                               GetBitContext *gb, int n)
-{
-    while (n--) {
-        enum ChannelPosition *map = cpe_map && get_bits1(gb) ? cpe_map : sce_map; // stereo or mono map
-        map[get_bits(gb, 4)] = type;
-    }
-}
-
-/**
- * Decode program configuration element; reference: table 4.2.
- *
- * @param   new_che_pos New channel position configuration - we only do something if it differs from the current one.
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_pce(AACContext *ac, enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
-                      GetBitContext *gb)
-{
-    int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc, sampling_index;
-    int comment_len;
-
-    skip_bits(gb, 2);  // object_type
-
-    sampling_index = get_bits(gb, 4);
-    if (ac->m4ac.sampling_index != sampling_index)
-        av_log(ac->avctx, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n");
-
-    num_front       = get_bits(gb, 4);
-    num_side        = get_bits(gb, 4);
-    num_back        = get_bits(gb, 4);
-    num_lfe         = get_bits(gb, 2);
-    num_assoc_data  = get_bits(gb, 3);
-    num_cc          = get_bits(gb, 4);
-
-    if (get_bits1(gb))
-        skip_bits(gb, 4); // mono_mixdown_tag
-    if (get_bits1(gb))
-        skip_bits(gb, 4); // stereo_mixdown_tag
-
-    if (get_bits1(gb))
-        skip_bits(gb, 3); // mixdown_coeff_index and pseudo_surround
-
-    decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_FRONT, gb, num_front);
-    decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_SIDE,  gb, num_side );
-    decode_channel_map(new_che_pos[TYPE_CPE], new_che_pos[TYPE_SCE], AAC_CHANNEL_BACK,  gb, num_back );
-    decode_channel_map(NULL,                  new_che_pos[TYPE_LFE], AAC_CHANNEL_LFE,   gb, num_lfe  );
-
-    skip_bits_long(gb, 4 * num_assoc_data);
-
-    decode_channel_map(new_che_pos[TYPE_CCE], new_che_pos[TYPE_CCE], AAC_CHANNEL_CC,    gb, num_cc   );
-
-    align_get_bits(gb);
-
-    /* comment field, first byte is length */
-    comment_len = get_bits(gb, 8) * 8;
-    if (get_bits_left(gb) < comment_len) {
-        av_log(ac->avctx, AV_LOG_ERROR, overread_err);
-        return -1;
-    }
-    skip_bits_long(gb, comment_len);
-    return 0;
-}
-
-/**
- * Set up channel positions based on a default channel configuration
- * as specified in table 1.17.
- *
- * @param   new_che_pos New channel position configuration - we only do something if it differs from the current one.
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static av_cold int set_default_channel_config(AACContext *ac,
-                                      enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
-                                      int channel_config)
-{
-    if (channel_config < 1 || channel_config > 7) {
-        av_log(ac->avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
-               channel_config);
-        return -1;
-    }
-
-    /* default channel configurations:
-     *
-     * 1ch : front center (mono)
-     * 2ch : L + R (stereo)
-     * 3ch : front center + L + R
-     * 4ch : front center + L + R + back center
-     * 5ch : front center + L + R + back stereo
-     * 6ch : front center + L + R + back stereo + LFE
-     * 7ch : front center + L + R + outer front left + outer front right + back stereo + LFE
-     */
-
-    if (channel_config != 2)
-        new_che_pos[TYPE_SCE][0] = AAC_CHANNEL_FRONT; // front center (or mono)
-    if (channel_config > 1)
-        new_che_pos[TYPE_CPE][0] = AAC_CHANNEL_FRONT; // L + R (or stereo)
-    if (channel_config == 4)
-        new_che_pos[TYPE_SCE][1] = AAC_CHANNEL_BACK;  // back center
-    if (channel_config > 4)
-        new_che_pos[TYPE_CPE][(channel_config == 7) + 1]
-        = AAC_CHANNEL_BACK;  // back stereo
-    if (channel_config > 5)
-        new_che_pos[TYPE_LFE][0] = AAC_CHANNEL_LFE;   // LFE
-    if (channel_config == 7)
-        new_che_pos[TYPE_CPE][1] = AAC_CHANNEL_FRONT; // outer front left + outer front right
-
-    return 0;
-}
-
-/**
- * Decode GA "General Audio" specific configuration; reference: table 4.1.
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_ga_specific_config(AACContext *ac, GetBitContext *gb,
-                                     int channel_config)
-{
-    enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
-    int extension_flag, ret;
-
-    if (get_bits1(gb)) { // frameLengthFlag
-        av_log_missing_feature(ac->avctx, "960/120 MDCT window is", 1);
-        return -1;
-    }
-
-    if (get_bits1(gb))       // dependsOnCoreCoder
-        skip_bits(gb, 14);   // coreCoderDelay
-    extension_flag = get_bits1(gb);
-
-    if (ac->m4ac.object_type == AOT_AAC_SCALABLE ||
-        ac->m4ac.object_type == AOT_ER_AAC_SCALABLE)
-        skip_bits(gb, 3);     // layerNr
-
-    memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
-    if (channel_config == 0) {
-        skip_bits(gb, 4);  // element_instance_tag
-        if ((ret = decode_pce(ac, new_che_pos, gb)))
-            return ret;
-    } else {
-        if ((ret = set_default_channel_config(ac, new_che_pos, channel_config)))
-            return ret;
-    }
-    if ((ret = output_configure(ac, ac->che_pos, new_che_pos, channel_config, OC_GLOBAL_HDR)))
-        return ret;
-
-    if (extension_flag) {
-        switch (ac->m4ac.object_type) {
-        case AOT_ER_BSAC:
-            skip_bits(gb, 5);    // numOfSubFrame
-            skip_bits(gb, 11);   // layer_length
-            break;
-        case AOT_ER_AAC_LC:
-        case AOT_ER_AAC_LTP:
-        case AOT_ER_AAC_SCALABLE:
-        case AOT_ER_AAC_LD:
-            skip_bits(gb, 3);  /* aacSectionDataResilienceFlag
-                                    * aacScalefactorDataResilienceFlag
-                                    * aacSpectralDataResilienceFlag
-                                    */
-            break;
-        }
-        skip_bits1(gb);    // extensionFlag3 (TBD in version 3)
-    }
-    return 0;
-}
-
-/**
- * Decode audio specific configuration; reference: table 1.13.
- *
- * @param   data        pointer to AVCodecContext extradata
- * @param   data_size   size of AVCCodecContext extradata
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_audio_specific_config(AACContext *ac, void *data,
-                                        int data_size)
-{
-    GetBitContext gb;
-    int i;
-
-    init_get_bits(&gb, data, data_size * 8);
-
-    if ((i = ff_mpeg4audio_get_config(&ac->m4ac, data, data_size)) < 0)
-        return -1;
-    if (ac->m4ac.sampling_index > 12) {
-        av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
-        return -1;
-    }
-    if (ac->m4ac.sbr == 1 && ac->m4ac.ps == -1)
-        ac->m4ac.ps = 1;
-
-    skip_bits_long(&gb, i);
-
-    switch (ac->m4ac.object_type) {
-    case AOT_AAC_MAIN:
-    case AOT_AAC_LC:
-        if (decode_ga_specific_config(ac, &gb, ac->m4ac.chan_config))
-            return -1;
-        break;
-    default:
-        av_log(ac->avctx, AV_LOG_ERROR, "Audio object type %s%d is not supported.\n",
-               ac->m4ac.sbr == 1? "SBR+" : "", ac->m4ac.object_type);
-        return -1;
-    }
-    return 0;
-}
-
-/**
- * linear congruential pseudorandom number generator
- *
- * @param   previous_val    pointer to the current state of the generator
- *
- * @return  Returns a 32-bit pseudorandom integer
- */
-static av_always_inline int lcg_random(int previous_val)
-{
-    return previous_val * 1664525 + 1013904223;
-}
-
-static av_always_inline void reset_predict_state(PredictorState *ps)
-{
-    ps->r0   = 0.0f;
-    ps->r1   = 0.0f;
-    ps->cor0 = 0.0f;
-    ps->cor1 = 0.0f;
-    ps->var0 = 1.0f;
-    ps->var1 = 1.0f;
-}
-
-static void reset_all_predictors(PredictorState *ps)
-{
-    int i;
-    for (i = 0; i < MAX_PREDICTORS; i++)
-        reset_predict_state(&ps[i]);
-}
-
-static void reset_predictor_group(PredictorState *ps, int group_num)
-{
-    int i;
-    for (i = group_num - 1; i < MAX_PREDICTORS; i += 30)
-        reset_predict_state(&ps[i]);
-}
-
-#define AAC_INIT_VLC_STATIC(num, size) \
-    INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \
-         ff_aac_spectral_bits[num], sizeof( ff_aac_spectral_bits[num][0]), sizeof( ff_aac_spectral_bits[num][0]), \
-        ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
-        size);
-
-static av_cold int aac_decode_init(AVCodecContext *avctx)
-{
-    AACContext *ac = avctx->priv_data;
-
-    ac->avctx = avctx;
-    ac->m4ac.sample_rate = avctx->sample_rate;
-
-    if (avctx->extradata_size > 0) {
-        if (decode_audio_specific_config(ac, avctx->extradata, avctx->extradata_size))
-            return -1;
-    }
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    AAC_INIT_VLC_STATIC( 0, 304);
-    AAC_INIT_VLC_STATIC( 1, 270);
-    AAC_INIT_VLC_STATIC( 2, 550);
-    AAC_INIT_VLC_STATIC( 3, 300);
-    AAC_INIT_VLC_STATIC( 4, 328);
-    AAC_INIT_VLC_STATIC( 5, 294);
-    AAC_INIT_VLC_STATIC( 6, 306);
-    AAC_INIT_VLC_STATIC( 7, 268);
-    AAC_INIT_VLC_STATIC( 8, 510);
-    AAC_INIT_VLC_STATIC( 9, 366);
-    AAC_INIT_VLC_STATIC(10, 462);
-
-    ff_aac_sbr_init();
-
-    dsputil_init(&ac->dsp, avctx);
-
-    ac->random_state = 0x1f2e3d4c;
-
-    // -1024 - Compensate wrong IMDCT method.
-    // 32768 - Required to scale values to the correct range for the bias method
-    //         for float to int16 conversion.
-
-    if (ac->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        ac->add_bias  = 385.0f;
-        ac->sf_scale  = 1. / (-1024. * 32768.);
-        ac->sf_offset = 0;
-    } else {
-        ac->add_bias  = 0.0f;
-        ac->sf_scale  = 1. / -1024.;
-        ac->sf_offset = 60;
-    }
-
-    ff_aac_tableinit();
-
-    INIT_VLC_STATIC(&vlc_scalefactors,7,FF_ARRAY_ELEMS(ff_aac_scalefactor_code),
-                    ff_aac_scalefactor_bits, sizeof(ff_aac_scalefactor_bits[0]), sizeof(ff_aac_scalefactor_bits[0]),
-                    ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]),
-                    352);
-
-    ff_mdct_init(&ac->mdct, 11, 1, 1.0);
-    ff_mdct_init(&ac->mdct_small, 8, 1, 1.0);
-    // window initialization
-    ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
-    ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
-    ff_init_ff_sine_windows(10);
-    ff_init_ff_sine_windows( 7);
-
-    cbrt_tableinit();
-
-    return 0;
-}
-
-/**
- * Skip data_stream_element; reference: table 4.10.
- */
-static int skip_data_stream_element(AACContext *ac, GetBitContext *gb)
-{
-    int byte_align = get_bits1(gb);
-    int count = get_bits(gb, 8);
-    if (count == 255)
-        count += get_bits(gb, 8);
-    if (byte_align)
-        align_get_bits(gb);
-
-    if (get_bits_left(gb) < 8 * count) {
-        av_log(ac->avctx, AV_LOG_ERROR, overread_err);
-        return -1;
-    }
-    skip_bits_long(gb, 8 * count);
-    return 0;
-}
-
-static int decode_prediction(AACContext *ac, IndividualChannelStream *ics,
-                             GetBitContext *gb)
-{
-    int sfb;
-    if (get_bits1(gb)) {
-        ics->predictor_reset_group = get_bits(gb, 5);
-        if (ics->predictor_reset_group == 0 || ics->predictor_reset_group > 30) {
-            av_log(ac->avctx, AV_LOG_ERROR, "Invalid Predictor Reset Group.\n");
-            return -1;
-        }
-    }
-    for (sfb = 0; sfb < FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[ac->m4ac.sampling_index]); sfb++) {
-        ics->prediction_used[sfb] = get_bits1(gb);
-    }
-    return 0;
-}
-
-/**
- * Decode Individual Channel Stream info; reference: table 4.6.
- *
- * @param   common_window   Channels have independent [0], or shared [1], Individual Channel Stream information.
- */
-static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics,
-                           GetBitContext *gb, int common_window)
-{
-    if (get_bits1(gb)) {
-        av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n");
-        memset(ics, 0, sizeof(IndividualChannelStream));
-        return -1;
-    }
-    ics->window_sequence[1] = ics->window_sequence[0];
-    ics->window_sequence[0] = get_bits(gb, 2);
-    ics->use_kb_window[1]   = ics->use_kb_window[0];
-    ics->use_kb_window[0]   = get_bits1(gb);
-    ics->num_window_groups  = 1;
-    ics->group_len[0]       = 1;
-    if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
-        int i;
-        ics->max_sfb = get_bits(gb, 4);
-        for (i = 0; i < 7; i++) {
-            if (get_bits1(gb)) {
-                ics->group_len[ics->num_window_groups - 1]++;
-            } else {
-                ics->num_window_groups++;
-                ics->group_len[ics->num_window_groups - 1] = 1;
-            }
-        }
-        ics->num_windows       = 8;
-        ics->swb_offset        =    ff_swb_offset_128[ac->m4ac.sampling_index];
-        ics->num_swb           =   ff_aac_num_swb_128[ac->m4ac.sampling_index];
-        ics->tns_max_bands     = ff_tns_max_bands_128[ac->m4ac.sampling_index];
-        ics->predictor_present = 0;
-    } else {
-        ics->max_sfb               = get_bits(gb, 6);
-        ics->num_windows           = 1;
-        ics->swb_offset            =    ff_swb_offset_1024[ac->m4ac.sampling_index];
-        ics->num_swb               =   ff_aac_num_swb_1024[ac->m4ac.sampling_index];
-        ics->tns_max_bands         = ff_tns_max_bands_1024[ac->m4ac.sampling_index];
-        ics->predictor_present     = get_bits1(gb);
-        ics->predictor_reset_group = 0;
-        if (ics->predictor_present) {
-            if (ac->m4ac.object_type == AOT_AAC_MAIN) {
-                if (decode_prediction(ac, ics, gb)) {
-                    memset(ics, 0, sizeof(IndividualChannelStream));
-                    return -1;
-                }
-            } else if (ac->m4ac.object_type == AOT_AAC_LC) {
-                av_log(ac->avctx, AV_LOG_ERROR, "Prediction is not allowed in AAC-LC.\n");
-                memset(ics, 0, sizeof(IndividualChannelStream));
-                return -1;
-            } else {
-                av_log_missing_feature(ac->avctx, "Predictor bit set but LTP is", 1);
-                memset(ics, 0, sizeof(IndividualChannelStream));
-                return -1;
-            }
-        }
-    }
-
-    if (ics->max_sfb > ics->num_swb) {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Number of scalefactor bands in group (%d) exceeds limit (%d).\n",
-               ics->max_sfb, ics->num_swb);
-        memset(ics, 0, sizeof(IndividualChannelStream));
-        return -1;
-    }
-
-    return 0;
-}
-
-/**
- * Decode band types (section_data payload); reference: table 4.46.
- *
- * @param   band_type           array of the used band type
- * @param   band_type_run_end   array of the last scalefactor band of a band type run
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_band_types(AACContext *ac, enum BandType band_type[120],
-                             int band_type_run_end[120], GetBitContext *gb,
-                             IndividualChannelStream *ics)
-{
-    int g, idx = 0;
-    const int bits = (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) ? 3 : 5;
-    for (g = 0; g < ics->num_window_groups; g++) {
-        int k = 0;
-        while (k < ics->max_sfb) {
-            uint8_t sect_end = k;
-            int sect_len_incr;
-            int sect_band_type = get_bits(gb, 4);
-            if (sect_band_type == 12) {
-                av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n");
-                return -1;
-            }
-            while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1)
-                sect_end += sect_len_incr;
-            sect_end += sect_len_incr;
-            if (get_bits_left(gb) < 0) {
-                av_log(ac->avctx, AV_LOG_ERROR, overread_err);
-                return -1;
-            }
-            if (sect_end > ics->max_sfb) {
-                av_log(ac->avctx, AV_LOG_ERROR,
-                       "Number of bands (%d) exceeds limit (%d).\n",
-                       sect_end, ics->max_sfb);
-                return -1;
-            }
-            for (; k < sect_end; k++) {
-                band_type        [idx]   = sect_band_type;
-                band_type_run_end[idx++] = sect_end;
-            }
-        }
-    }
-    return 0;
-}
-
-/**
- * Decode scalefactors; reference: table 4.47.
- *
- * @param   global_gain         first scalefactor value as scalefactors are differentially coded
- * @param   band_type           array of the used band type
- * @param   band_type_run_end   array of the last scalefactor band of a band type run
- * @param   sf                  array of scalefactors or intensity stereo positions
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
-                               unsigned int global_gain,
-                               IndividualChannelStream *ics,
-                               enum BandType band_type[120],
-                               int band_type_run_end[120])
-{
-    const int sf_offset = ac->sf_offset + (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE ? 12 : 0);
-    int g, i, idx = 0;
-    int offset[3] = { global_gain, global_gain - 90, 100 };
-    int noise_flag = 1;
-    static const char *sf_str[3] = { "Global gain", "Noise gain", "Intensity stereo position" };
-    for (g = 0; g < ics->num_window_groups; g++) {
-        for (i = 0; i < ics->max_sfb;) {
-            int run_end = band_type_run_end[idx];
-            if (band_type[idx] == ZERO_BT) {
-                for (; i < run_end; i++, idx++)
-                    sf[idx] = 0.;
-            } else if ((band_type[idx] == INTENSITY_BT) || (band_type[idx] == INTENSITY_BT2)) {
-                for (; i < run_end; i++, idx++) {
-                    offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
-                    if (offset[2] > 255U) {
-                        av_log(ac->avctx, AV_LOG_ERROR,
-                               "%s (%d) out of range.\n", sf_str[2], offset[2]);
-                        return -1;
-                    }
-                    sf[idx] = ff_aac_pow2sf_tab[-offset[2] + 300];
-                }
-            } else if (band_type[idx] == NOISE_BT) {
-                for (; i < run_end; i++, idx++) {
-                    if (noise_flag-- > 0)
-                        offset[1] += get_bits(gb, 9) - 256;
-                    else
-                        offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
-                    if (offset[1] > 255U) {
-                        av_log(ac->avctx, AV_LOG_ERROR,
-                               "%s (%d) out of range.\n", sf_str[1], offset[1]);
-                        return -1;
-                    }
-                    sf[idx] = -ff_aac_pow2sf_tab[offset[1] + sf_offset + 100];
-                }
-            } else {
-                for (; i < run_end; i++, idx++) {
-                    offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
-                    if (offset[0] > 255U) {
-                        av_log(ac->avctx, AV_LOG_ERROR,
-                               "%s (%d) out of range.\n", sf_str[0], offset[0]);
-                        return -1;
-                    }
-                    sf[idx] = -ff_aac_pow2sf_tab[ offset[0] + sf_offset];
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-/**
- * Decode pulse data; reference: table 4.7.
- */
-static int decode_pulses(Pulse *pulse, GetBitContext *gb,
-                         const uint16_t *swb_offset, int num_swb)
-{
-    int i, pulse_swb;
-    pulse->num_pulse = get_bits(gb, 2) + 1;
-    pulse_swb        = get_bits(gb, 6);
-    if (pulse_swb >= num_swb)
-        return -1;
-    pulse->pos[0]    = swb_offset[pulse_swb];
-    pulse->pos[0]   += get_bits(gb, 5);
-    if (pulse->pos[0] > 1023)
-        return -1;
-    pulse->amp[0]    = get_bits(gb, 4);
-    for (i = 1; i < pulse->num_pulse; i++) {
-        pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1];
-        if (pulse->pos[i] > 1023)
-            return -1;
-        pulse->amp[i] = get_bits(gb, 4);
-    }
-    return 0;
-}
-
-/**
- * Decode Temporal Noise Shaping data; reference: table 4.48.
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns,
-                      GetBitContext *gb, const IndividualChannelStream *ics)
-{
-    int w, filt, i, coef_len, coef_res, coef_compress;
-    const int is8 = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE;
-    const int tns_max_order = is8 ? 7 : ac->m4ac.object_type == AOT_AAC_MAIN ? 20 : 12;
-    for (w = 0; w < ics->num_windows; w++) {
-        if ((tns->n_filt[w] = get_bits(gb, 2 - is8))) {
-            coef_res = get_bits1(gb);
-
-            for (filt = 0; filt < tns->n_filt[w]; filt++) {
-                int tmp2_idx;
-                tns->length[w][filt] = get_bits(gb, 6 - 2 * is8);
-
-                if ((tns->order[w][filt] = get_bits(gb, 5 - 2 * is8)) > tns_max_order) {
-                    av_log(ac->avctx, AV_LOG_ERROR, "TNS filter order %d is greater than maximum %d.\n",
-                           tns->order[w][filt], tns_max_order);
-                    tns->order[w][filt] = 0;
-                    return -1;
-                }
-                if (tns->order[w][filt]) {
-                    tns->direction[w][filt] = get_bits1(gb);
-                    coef_compress = get_bits1(gb);
-                    coef_len = coef_res + 3 - coef_compress;
-                    tmp2_idx = 2 * coef_compress + coef_res;
-
-                    for (i = 0; i < tns->order[w][filt]; i++)
-                        tns->coef[w][filt][i] = tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)];
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-/**
- * Decode Mid/Side data; reference: table 4.54.
- *
- * @param   ms_present  Indicates mid/side stereo presence. [0] mask is all 0s;
- *                      [1] mask is decoded from bitstream; [2] mask is all 1s;
- *                      [3] reserved for scalable AAC
- */
-static void decode_mid_side_stereo(ChannelElement *cpe, GetBitContext *gb,
-                                   int ms_present)
-{
-    int idx;
-    if (ms_present == 1) {
-        for (idx = 0; idx < cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb; idx++)
-            cpe->ms_mask[idx] = get_bits1(gb);
-    } else if (ms_present == 2) {
-        memset(cpe->ms_mask, 1, cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb * sizeof(cpe->ms_mask[0]));
-    }
-}
-
-#ifndef VMUL2
-static inline float *VMUL2(float *dst, const float *v, unsigned idx,
-                           const float *scale)
-{
-    float s = *scale;
-    *dst++ = v[idx    & 15] * s;
-    *dst++ = v[idx>>4 & 15] * s;
-    return dst;
-}
-#endif
-
-#ifndef VMUL4
-static inline float *VMUL4(float *dst, const float *v, unsigned idx,
-                           const float *scale)
-{
-    float s = *scale;
-    *dst++ = v[idx    & 3] * s;
-    *dst++ = v[idx>>2 & 3] * s;
-    *dst++ = v[idx>>4 & 3] * s;
-    *dst++ = v[idx>>6 & 3] * s;
-    return dst;
-}
-#endif
-
-#ifndef VMUL2S
-static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
-                            unsigned sign, const float *scale)
-{
-    union float754 s0, s1;
-
-    s0.f = s1.f = *scale;
-    s0.i ^= sign >> 1 << 31;
-    s1.i ^= sign      << 31;
-
-    *dst++ = v[idx    & 15] * s0.f;
-    *dst++ = v[idx>>4 & 15] * s1.f;
-
-    return dst;
-}
-#endif
-
-#ifndef VMUL4S
-static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
-                            unsigned sign, const float *scale)
-{
-    unsigned nz = idx >> 12;
-    union float754 s = { .f = *scale };
-    union float754 t;
-
-    t.i = s.i ^ (sign & 1<<31);
-    *dst++ = v[idx    & 3] * t.f;
-
-    sign <<= nz & 1; nz >>= 1;
-    t.i = s.i ^ (sign & 1<<31);
-    *dst++ = v[idx>>2 & 3] * t.f;
-
-    sign <<= nz & 1; nz >>= 1;
-    t.i = s.i ^ (sign & 1<<31);
-    *dst++ = v[idx>>4 & 3] * t.f;
-
-    sign <<= nz & 1; nz >>= 1;
-    t.i = s.i ^ (sign & 1<<31);
-    *dst++ = v[idx>>6 & 3] * t.f;
-
-    return dst;
-}
-#endif
-
-/**
- * Decode spectral data; reference: table 4.50.
- * Dequantize and scale spectral data; reference: 4.6.3.3.
- *
- * @param   coef            array of dequantized, scaled spectral data
- * @param   sf              array of scalefactors or intensity stereo positions
- * @param   pulse_present   set if pulses are present
- * @param   pulse           pointer to pulse data struct
- * @param   band_type       array of the used band type
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
-                                       GetBitContext *gb, const float sf[120],
-                                       int pulse_present, const Pulse *pulse,
-                                       const IndividualChannelStream *ics,
-                                       enum BandType band_type[120])
-{
-    int i, k, g, idx = 0;
-    const int c = 1024 / ics->num_windows;
-    const uint16_t *offsets = ics->swb_offset;
-    float *coef_base = coef;
-    int err_idx;
-
-    for (g = 0; g < ics->num_windows; g++)
-        memset(coef + g * 128 + offsets[ics->max_sfb], 0, sizeof(float) * (c - offsets[ics->max_sfb]));
-
-    for (g = 0; g < ics->num_window_groups; g++) {
-        unsigned g_len = ics->group_len[g];
-
-        for (i = 0; i < ics->max_sfb; i++, idx++) {
-            const unsigned cbt_m1 = band_type[idx] - 1;
-            float *cfo = coef + offsets[i];
-            int off_len = offsets[i + 1] - offsets[i];
-            int group;
-
-            if (cbt_m1 >= INTENSITY_BT2 - 1) {
-                for (group = 0; group < g_len; group++, cfo+=128) {
-                    memset(cfo, 0, off_len * sizeof(float));
-                }
-            } else if (cbt_m1 == NOISE_BT - 1) {
-                for (group = 0; group < g_len; group++, cfo+=128) {
-                    float scale;
-                    float band_energy;
-
-                    for (k = 0; k < off_len; k++) {
-                        ac->random_state  = lcg_random(ac->random_state);
-                        cfo[k] = ac->random_state;
-                    }
-
-                    band_energy = ac->dsp.scalarproduct_float(cfo, cfo, off_len);
-                    scale = sf[idx] / sqrtf(band_energy);
-                    ac->dsp.vector_fmul_scalar(cfo, cfo, scale, off_len);
-                }
-            } else {
-                const float *vq = ff_aac_codebook_vector_vals[cbt_m1];
-                const uint16_t *cb_vector_idx = ff_aac_codebook_vector_idx[cbt_m1];
-                VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table;
-                const int cb_size = ff_aac_spectral_sizes[cbt_m1];
-                OPEN_READER(re, gb);
-
-                switch (cbt_m1 >> 1) {
-                case 0:
-                    for (group = 0; group < g_len; group++, cfo+=128) {
-                        float *cf = cfo;
-                        int len = off_len;
-
-                        do {
-                            int code;
-                            unsigned cb_idx;
-
-                            UPDATE_CACHE(re, gb);
-                            GET_VLC(code, re, gb, vlc_tab, 8, 2);
-
-                            if (code >= cb_size) {
-                                err_idx = code;
-                                goto err_cb_overflow;
-                            }
-
-                            cb_idx = cb_vector_idx[code];
-                            cf = VMUL4(cf, vq, cb_idx, sf + idx);
-                        } while (len -= 4);
-                    }
-                    break;
-
-                case 1:
-                    for (group = 0; group < g_len; group++, cfo+=128) {
-                        float *cf = cfo;
-                        int len = off_len;
-
-                        do {
-                            int code;
-                            unsigned nnz;
-                            unsigned cb_idx;
-                            uint32_t bits;
-
-                            UPDATE_CACHE(re, gb);
-                            GET_VLC(code, re, gb, vlc_tab, 8, 2);
-
-                            if (code >= cb_size) {
-                                err_idx = code;
-                                goto err_cb_overflow;
-                            }
-
-#if MIN_CACHE_BITS < 20
-                            UPDATE_CACHE(re, gb);
-#endif
-                            cb_idx = cb_vector_idx[code];
-                            nnz = cb_idx >> 8 & 15;
-                            bits = SHOW_UBITS(re, gb, nnz) << (32-nnz);
-                            LAST_SKIP_BITS(re, gb, nnz);
-                            cf = VMUL4S(cf, vq, cb_idx, bits, sf + idx);
-                        } while (len -= 4);
-                    }
-                    break;
-
-                case 2:
-                    for (group = 0; group < g_len; group++, cfo+=128) {
-                        float *cf = cfo;
-                        int len = off_len;
-
-                        do {
-                            int code;
-                            unsigned cb_idx;
-
-                            UPDATE_CACHE(re, gb);
-                            GET_VLC(code, re, gb, vlc_tab, 8, 2);
-
-                            if (code >= cb_size) {
-                                err_idx = code;
-                                goto err_cb_overflow;
-                            }
-
-                            cb_idx = cb_vector_idx[code];
-                            cf = VMUL2(cf, vq, cb_idx, sf + idx);
-                        } while (len -= 2);
-                    }
-                    break;
-
-                case 3:
-                case 4:
-                    for (group = 0; group < g_len; group++, cfo+=128) {
-                        float *cf = cfo;
-                        int len = off_len;
-
-                        do {
-                            int code;
-                            unsigned nnz;
-                            unsigned cb_idx;
-                            unsigned sign;
-
-                            UPDATE_CACHE(re, gb);
-                            GET_VLC(code, re, gb, vlc_tab, 8, 2);
-
-                            if (code >= cb_size) {
-                                err_idx = code;
-                                goto err_cb_overflow;
-                            }
-
-                            cb_idx = cb_vector_idx[code];
-                            nnz = cb_idx >> 8 & 15;
-                            sign = SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12);
-                            LAST_SKIP_BITS(re, gb, nnz);
-                            cf = VMUL2S(cf, vq, cb_idx, sign, sf + idx);
-                        } while (len -= 2);
-                    }
-                    break;
-
-                default:
-                    for (group = 0; group < g_len; group++, cfo+=128) {
-                        float *cf = cfo;
-                        uint32_t *icf = (uint32_t *) cf;
-                        int len = off_len;
-
-                        do {
-                            int code;
-                            unsigned nzt, nnz;
-                            unsigned cb_idx;
-                            uint32_t bits;
-                            int j;
-
-                            UPDATE_CACHE(re, gb);
-                            GET_VLC(code, re, gb, vlc_tab, 8, 2);
-
-                            if (!code) {
-                                *icf++ = 0;
-                                *icf++ = 0;
-                                continue;
-                            }
-
-                            if (code >= cb_size) {
-                                err_idx = code;
-                                goto err_cb_overflow;
-                            }
-
-                            cb_idx = cb_vector_idx[code];
-                            nnz = cb_idx >> 12;
-                            nzt = cb_idx >> 8;
-                            bits = SHOW_UBITS(re, gb, nnz) << (32-nnz);
-                            LAST_SKIP_BITS(re, gb, nnz);
-
-                            for (j = 0; j < 2; j++) {
-                                if (nzt & 1<<j) {
-                                    uint32_t b;
-                                    int n;
-                                    /* The total length of escape_sequence must be < 22 bits according
-                                       to the specification (i.e. max is 111111110xxxxxxxxxxxx). */
-                                    UPDATE_CACHE(re, gb);
-                                    b = GET_CACHE(re, gb);
-                                    b = 31 - av_log2(~b);
-
-                                    if (b > 8) {
-                                        av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
-                                        return -1;
-                                    }
-
-#if MIN_CACHE_BITS < 21
-                                    LAST_SKIP_BITS(re, gb, b + 1);
-                                    UPDATE_CACHE(re, gb);
-#else
-                                    SKIP_BITS(re, gb, b + 1);
-#endif
-                                    b += 4;
-                                    n = (1 << b) + SHOW_UBITS(re, gb, b);
-                                    LAST_SKIP_BITS(re, gb, b);
-                                    *icf++ = cbrt_tab[n] | (bits & 1<<31);
-                                    bits <<= 1;
-                                } else {
-                                    unsigned v = ((const uint32_t*)vq)[cb_idx & 15];
-                                    *icf++ = (bits & 1<<31) | v;
-                                    bits <<= !!v;
-                                }
-                                cb_idx >>= 4;
-                            }
-                        } while (len -= 2);
-
-                        ac->dsp.vector_fmul_scalar(cfo, cfo, sf[idx], off_len);
-                    }
-                }
-
-                CLOSE_READER(re, gb);
-            }
-        }
-        coef += g_len << 7;
-    }
-
-    if (pulse_present) {
-        idx = 0;
-        for (i = 0; i < pulse->num_pulse; i++) {
-            float co = coef_base[ pulse->pos[i] ];
-            while (offsets[idx + 1] <= pulse->pos[i])
-                idx++;
-            if (band_type[idx] != NOISE_BT && sf[idx]) {
-                float ico = -pulse->amp[i];
-                if (co) {
-                    co /= sf[idx];
-                    ico = co / sqrtf(sqrtf(fabsf(co))) + (co > 0 ? -ico : ico);
-                }
-                coef_base[ pulse->pos[i] ] = cbrtf(fabsf(ico)) * ico * sf[idx];
-            }
-        }
-    }
-    return 0;
-
-err_cb_overflow:
-    av_log(ac->avctx, AV_LOG_ERROR,
-           "Read beyond end of ff_aac_codebook_vectors[%d][]. index %d >= %d\n",
-           band_type[idx], err_idx, ff_aac_spectral_sizes[band_type[idx]]);
-    return -1;
-}
-
-static av_always_inline float flt16_round(float pf)
-{
-    union float754 tmp;
-    tmp.f = pf;
-    tmp.i = (tmp.i + 0x00008000U) & 0xFFFF0000U;
-    return tmp.f;
-}
-
-static av_always_inline float flt16_even(float pf)
-{
-    union float754 tmp;
-    tmp.f = pf;
-    tmp.i = (tmp.i + 0x00007FFFU + (tmp.i & 0x00010000U >> 16)) & 0xFFFF0000U;
-    return tmp.f;
-}
-
-static av_always_inline float flt16_trunc(float pf)
-{
-    union float754 pun;
-    pun.f = pf;
-    pun.i &= 0xFFFF0000U;
-    return pun.f;
-}
-
-static av_always_inline void predict(AACContext *ac, PredictorState *ps, float *coef,
-                    int output_enable)
-{
-    const float a     = 0.953125; // 61.0 / 64
-    const float alpha = 0.90625;  // 29.0 / 32
-    float e0, e1;
-    float pv;
-    float k1, k2;
-
-    k1 = ps->var0 > 1 ? ps->cor0 * flt16_even(a / ps->var0) : 0;
-    k2 = ps->var1 > 1 ? ps->cor1 * flt16_even(a / ps->var1) : 0;
-
-    pv = flt16_round(k1 * ps->r0 + k2 * ps->r1);
-    if (output_enable)
-        *coef += pv * ac->sf_scale;
-
-    e0 = *coef / ac->sf_scale;
-    e1 = e0 - k1 * ps->r0;
-
-    ps->cor1 = flt16_trunc(alpha * ps->cor1 + ps->r1 * e1);
-    ps->var1 = flt16_trunc(alpha * ps->var1 + 0.5 * (ps->r1 * ps->r1 + e1 * e1));
-    ps->cor0 = flt16_trunc(alpha * ps->cor0 + ps->r0 * e0);
-    ps->var0 = flt16_trunc(alpha * ps->var0 + 0.5 * (ps->r0 * ps->r0 + e0 * e0));
-
-    ps->r1 = flt16_trunc(a * (ps->r0 - k1 * e0));
-    ps->r0 = flt16_trunc(a * e0);
-}
-
-/**
- * Apply AAC-Main style frequency domain prediction.
- */
-static void apply_prediction(AACContext *ac, SingleChannelElement *sce)
-{
-    int sfb, k;
-
-    if (!sce->ics.predictor_initialized) {
-        reset_all_predictors(sce->predictor_state);
-        sce->ics.predictor_initialized = 1;
-    }
-
-    if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
-        for (sfb = 0; sfb < ff_aac_pred_sfb_max[ac->m4ac.sampling_index]; sfb++) {
-            for (k = sce->ics.swb_offset[sfb]; k < sce->ics.swb_offset[sfb + 1]; k++) {
-                predict(ac, &sce->predictor_state[k], &sce->coeffs[k],
-                        sce->ics.predictor_present && sce->ics.prediction_used[sfb]);
-            }
-        }
-        if (sce->ics.predictor_reset_group)
-            reset_predictor_group(sce->predictor_state, sce->ics.predictor_reset_group);
-    } else
-        reset_all_predictors(sce->predictor_state);
-}
-
-/**
- * Decode an individual_channel_stream payload; reference: table 4.44.
- *
- * @param   common_window   Channels have independent [0], or shared [1], Individual Channel Stream information.
- * @param   scale_flag      scalable [1] or non-scalable [0] AAC (Unused until scalable AAC is implemented.)
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_ics(AACContext *ac, SingleChannelElement *sce,
-                      GetBitContext *gb, int common_window, int scale_flag)
-{
-    Pulse pulse;
-    TemporalNoiseShaping    *tns = &sce->tns;
-    IndividualChannelStream *ics = &sce->ics;
-    float *out = sce->coeffs;
-    int global_gain, pulse_present = 0;
-
-    /* This assignment is to silence a GCC warning about the variable being used
-     * uninitialized when in fact it always is.
-     */
-    pulse.num_pulse = 0;
-
-    global_gain = get_bits(gb, 8);
-
-    if (!common_window && !scale_flag) {
-        if (decode_ics_info(ac, ics, gb, 0) < 0)
-            return -1;
-    }
-
-    if (decode_band_types(ac, sce->band_type, sce->band_type_run_end, gb, ics) < 0)
-        return -1;
-    if (decode_scalefactors(ac, sce->sf, gb, global_gain, ics, sce->band_type, sce->band_type_run_end) < 0)
-        return -1;
-
-    pulse_present = 0;
-    if (!scale_flag) {
-        if ((pulse_present = get_bits1(gb))) {
-            if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
-                av_log(ac->avctx, AV_LOG_ERROR, "Pulse tool not allowed in eight short sequence.\n");
-                return -1;
-            }
-            if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) {
-                av_log(ac->avctx, AV_LOG_ERROR, "Pulse data corrupt or invalid.\n");
-                return -1;
-            }
-        }
-        if ((tns->present = get_bits1(gb)) && decode_tns(ac, tns, gb, ics))
-            return -1;
-        if (get_bits1(gb)) {
-            av_log_missing_feature(ac->avctx, "SSR", 1);
-            return -1;
-        }
-    }
-
-    if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present, &pulse, ics, sce->band_type) < 0)
-        return -1;
-
-    if (ac->m4ac.object_type == AOT_AAC_MAIN && !common_window)
-        apply_prediction(ac, sce);
-
-    return 0;
-}
-
-/**
- * Mid/Side stereo decoding; reference: 4.6.8.1.3.
- */
-static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe)
-{
-    const IndividualChannelStream *ics = &cpe->ch[0].ics;
-    float *ch0 = cpe->ch[0].coeffs;
-    float *ch1 = cpe->ch[1].coeffs;
-    int g, i, group, idx = 0;
-    const uint16_t *offsets = ics->swb_offset;
-    for (g = 0; g < ics->num_window_groups; g++) {
-        for (i = 0; i < ics->max_sfb; i++, idx++) {
-            if (cpe->ms_mask[idx] &&
-                    cpe->ch[0].band_type[idx] < NOISE_BT && cpe->ch[1].band_type[idx] < NOISE_BT) {
-                for (group = 0; group < ics->group_len[g]; group++) {
-                    ac->dsp.butterflies_float(ch0 + group * 128 + offsets[i],
-                                              ch1 + group * 128 + offsets[i],
-                                              offsets[i+1] - offsets[i]);
-                }
-            }
-        }
-        ch0 += ics->group_len[g] * 128;
-        ch1 += ics->group_len[g] * 128;
-    }
-}
-
-/**
- * intensity stereo decoding; reference: 4.6.8.2.3
- *
- * @param   ms_present  Indicates mid/side stereo presence. [0] mask is all 0s;
- *                      [1] mask is decoded from bitstream; [2] mask is all 1s;
- *                      [3] reserved for scalable AAC
- */
-static void apply_intensity_stereo(ChannelElement *cpe, int ms_present)
-{
-    const IndividualChannelStream *ics = &cpe->ch[1].ics;
-    SingleChannelElement         *sce1 = &cpe->ch[1];
-    float *coef0 = cpe->ch[0].coeffs, *coef1 = cpe->ch[1].coeffs;
-    const uint16_t *offsets = ics->swb_offset;
-    int g, group, i, k, idx = 0;
-    int c;
-    float scale;
-    for (g = 0; g < ics->num_window_groups; g++) {
-        for (i = 0; i < ics->max_sfb;) {
-            if (sce1->band_type[idx] == INTENSITY_BT || sce1->band_type[idx] == INTENSITY_BT2) {
-                const int bt_run_end = sce1->band_type_run_end[idx];
-                for (; i < bt_run_end; i++, idx++) {
-                    c = -1 + 2 * (sce1->band_type[idx] - 14);
-                    if (ms_present)
-                        c *= 1 - 2 * cpe->ms_mask[idx];
-                    scale = c * sce1->sf[idx];
-                    for (group = 0; group < ics->group_len[g]; group++)
-                        for (k = offsets[i]; k < offsets[i + 1]; k++)
-                            coef1[group * 128 + k] = scale * coef0[group * 128 + k];
-                }
-            } else {
-                int bt_run_end = sce1->band_type_run_end[idx];
-                idx += bt_run_end - i;
-                i    = bt_run_end;
-            }
-        }
-        coef0 += ics->group_len[g] * 128;
-        coef1 += ics->group_len[g] * 128;
-    }
-}
-
-/**
- * Decode a channel_pair_element; reference: table 4.4.
- *
- * @param   elem_id Identifies the instance of a syntax element.
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
-{
-    int i, ret, common_window, ms_present = 0;
-
-    common_window = get_bits1(gb);
-    if (common_window) {
-        if (decode_ics_info(ac, &cpe->ch[0].ics, gb, 1))
-            return -1;
-        i = cpe->ch[1].ics.use_kb_window[0];
-        cpe->ch[1].ics = cpe->ch[0].ics;
-        cpe->ch[1].ics.use_kb_window[1] = i;
-        ms_present = get_bits(gb, 2);
-        if (ms_present == 3) {
-            av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
-            return -1;
-        } else if (ms_present)
-            decode_mid_side_stereo(cpe, gb, ms_present);
-    }
-    if ((ret = decode_ics(ac, &cpe->ch[0], gb, common_window, 0)))
-        return ret;
-    if ((ret = decode_ics(ac, &cpe->ch[1], gb, common_window, 0)))
-        return ret;
-
-    if (common_window) {
-        if (ms_present)
-            apply_mid_side_stereo(ac, cpe);
-        if (ac->m4ac.object_type == AOT_AAC_MAIN) {
-            apply_prediction(ac, &cpe->ch[0]);
-            apply_prediction(ac, &cpe->ch[1]);
-        }
-    }
-
-    apply_intensity_stereo(cpe, ms_present);
-    return 0;
-}
-
-/**
- * Decode coupling_channel_element; reference: table 4.8.
- *
- * @param   elem_id Identifies the instance of a syntax element.
- *
- * @return  Returns error status. 0 - OK, !0 - error
- */
-static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che)
-{
-    int num_gain = 0;
-    int c, g, sfb, ret;
-    int sign;
-    float scale;
-    SingleChannelElement *sce = &che->ch[0];
-    ChannelCoupling     *coup = &che->coup;
-
-    coup->coupling_point = 2 * get_bits1(gb);
-    coup->num_coupled = get_bits(gb, 3);
-    for (c = 0; c <= coup->num_coupled; c++) {
-        num_gain++;
-        coup->type[c] = get_bits1(gb) ? TYPE_CPE : TYPE_SCE;
-        coup->id_select[c] = get_bits(gb, 4);
-        if (coup->type[c] == TYPE_CPE) {
-            coup->ch_select[c] = get_bits(gb, 2);
-            if (coup->ch_select[c] == 3)
-                num_gain++;
-        } else
-            coup->ch_select[c] = 2;
-    }
-    coup->coupling_point += get_bits1(gb) || (coup->coupling_point >> 1);
-
-    sign  = get_bits(gb, 1);
-    scale = pow(2., pow(2., (int)get_bits(gb, 2) - 3));
-
-    if ((ret = decode_ics(ac, sce, gb, 0, 0)))
-        return ret;
-
-    for (c = 0; c < num_gain; c++) {
-        int idx  = 0;
-        int cge  = 1;
-        int gain = 0;
-        float gain_cache = 1.;
-        if (c) {
-            cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
-            gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
-            gain_cache = pow(scale, -gain);
-        }
-        if (coup->coupling_point == AFTER_IMDCT) {
-            coup->gain[c][0] = gain_cache;
-        } else {
-            for (g = 0; g < sce->ics.num_window_groups; g++) {
-                for (sfb = 0; sfb < sce->ics.max_sfb; sfb++, idx++) {
-                    if (sce->band_type[idx] != ZERO_BT) {
-                        if (!cge) {
-                            int t = get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
-                            if (t) {
-                                int s = 1;
-                                t = gain += t;
-                                if (sign) {
-                                    s  -= 2 * (t & 0x1);
-                                    t >>= 1;
-                                }
-                                gain_cache = pow(scale, -t) * s;
-                            }
-                        }
-                        coup->gain[c][idx] = gain_cache;
-                    }
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-/**
- * Parse whether channels are to be excluded from Dynamic Range Compression; reference: table 4.53.
- *
- * @return  Returns number of bytes consumed.
- */
-static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc,
-                                         GetBitContext *gb)
-{
-    int i;
-    int num_excl_chan = 0;
-
-    do {
-        for (i = 0; i < 7; i++)
-            che_drc->exclude_mask[num_excl_chan++] = get_bits1(gb);
-    } while (num_excl_chan < MAX_CHANNELS - 7 && get_bits1(gb));
-
-    return num_excl_chan / 7;
-}
-
-/**
- * Decode dynamic range information; reference: table 4.52.
- *
- * @param   cnt length of TYPE_FIL syntactic element in bytes
- *
- * @return  Returns number of bytes consumed.
- */
-static int decode_dynamic_range(DynamicRangeControl *che_drc,
-                                GetBitContext *gb, int cnt)
-{
-    int n             = 1;
-    int drc_num_bands = 1;
-    int i;
-
-    /* pce_tag_present? */
-    if (get_bits1(gb)) {
-        che_drc->pce_instance_tag  = get_bits(gb, 4);
-        skip_bits(gb, 4); // tag_reserved_bits
-        n++;
-    }
-
-    /* excluded_chns_present? */
-    if (get_bits1(gb)) {
-        n += decode_drc_channel_exclusions(che_drc, gb);
-    }
-
-    /* drc_bands_present? */
-    if (get_bits1(gb)) {
-        che_drc->band_incr            = get_bits(gb, 4);
-        che_drc->interpolation_scheme = get_bits(gb, 4);
-        n++;
-        drc_num_bands += che_drc->band_incr;
-        for (i = 0; i < drc_num_bands; i++) {
-            che_drc->band_top[i] = get_bits(gb, 8);
-            n++;
-        }
-    }
-
-    /* prog_ref_level_present? */
-    if (get_bits1(gb)) {
-        che_drc->prog_ref_level = get_bits(gb, 7);
-        skip_bits1(gb); // prog_ref_level_reserved_bits
-        n++;
-    }
-
-    for (i = 0; i < drc_num_bands; i++) {
-        che_drc->dyn_rng_sgn[i] = get_bits1(gb);
-        che_drc->dyn_rng_ctl[i] = get_bits(gb, 7);
-        n++;
-    }
-
-    return n;
-}
-
-/**
- * Decode extension data (incomplete); reference: table 4.51.
- *
- * @param   cnt length of TYPE_FIL syntactic element in bytes
- *
- * @return Returns number of bytes consumed
- */
-static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt,
-                                    ChannelElement *che, enum RawDataBlockType elem_type)
-{
-    int crc_flag = 0;
-    int res = cnt;
-    switch (get_bits(gb, 4)) { // extension type
-    case EXT_SBR_DATA_CRC:
-        crc_flag++;
-    case EXT_SBR_DATA:
-        if (!che) {
-            av_log(ac->avctx, AV_LOG_ERROR, "SBR was found before the first channel element.\n");
-            return res;
-        } else if (!ac->m4ac.sbr) {
-            av_log(ac->avctx, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n");
-            skip_bits_long(gb, 8 * cnt - 4);
-            return res;
-        } else if (ac->m4ac.sbr == -1 && ac->output_configured == OC_LOCKED) {
-            av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n");
-            skip_bits_long(gb, 8 * cnt - 4);
-            return res;
-        } else if (ac->m4ac.ps == -1 && ac->output_configured < OC_LOCKED && ac->avctx->channels == 1) {
-            ac->m4ac.sbr = 1;
-            ac->m4ac.ps = 1;
-            output_configure(ac, ac->che_pos, ac->che_pos, ac->m4ac.chan_config, ac->output_configured);
-        } else {
-            ac->m4ac.sbr = 1;
-        }
-        res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
-        break;
-    case EXT_DYNAMIC_RANGE:
-        res = decode_dynamic_range(&ac->che_drc, gb, cnt);
-        break;
-    case EXT_FILL:
-    case EXT_FILL_DATA:
-    case EXT_DATA_ELEMENT:
-    default:
-        skip_bits_long(gb, 8 * cnt - 4);
-        break;
-    };
-    return res;
-}
-
-/**
- * Decode Temporal Noise Shaping filter coefficients and apply all-pole filters; reference: 4.6.9.3.
- *
- * @param   decode  1 if tool is used normally, 0 if tool is used in LTP.
- * @param   coef    spectral coefficients
- */
-static void apply_tns(float coef[1024], TemporalNoiseShaping *tns,
-                      IndividualChannelStream *ics, int decode)
-{
-    const int mmm = FFMIN(ics->tns_max_bands, ics->max_sfb);
-    int w, filt, m, i;
-    int bottom, top, order, start, end, size, inc;
-    float lpc[TNS_MAX_ORDER];
-
-    for (w = 0; w < ics->num_windows; w++) {
-        bottom = ics->num_swb;
-        for (filt = 0; filt < tns->n_filt[w]; filt++) {
-            top    = bottom;
-            bottom = FFMAX(0, top - tns->length[w][filt]);
-            order  = tns->order[w][filt];
-            if (order == 0)
-                continue;
-
-            // tns_decode_coef
-            compute_lpc_coefs(tns->coef[w][filt], order, lpc, 0, 0, 0);
-
-            start = ics->swb_offset[FFMIN(bottom, mmm)];
-            end   = ics->swb_offset[FFMIN(   top, mmm)];
-            if ((size = end - start) <= 0)
-                continue;
-            if (tns->direction[w][filt]) {
-                inc = -1;
-                start = end - 1;
-            } else {
-                inc = 1;
-            }
-            start += w * 128;
-
-            // ar filter
-            for (m = 0; m < size; m++, start += inc)
-                for (i = 1; i <= FFMIN(m, order); i++)
-                    coef[start] -= coef[start - i * inc] * lpc[i - 1];
-        }
-    }
-}
-
-/**
- * Conduct IMDCT and windowing.
- */
-static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce, float bias)
-{
-    IndividualChannelStream *ics = &sce->ics;
-    float *in    = sce->coeffs;
-    float *out   = sce->ret;
-    float *saved = sce->saved;
-    const float *swindow      = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
-    const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024;
-    const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
-    float *buf  = ac->buf_mdct;
-    float *temp = ac->temp;
-    int i;
-
-    // imdct
-    if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
-        if (ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE)
-            av_log(ac->avctx, AV_LOG_WARNING,
-                   "Transition from an ONLY_LONG or LONG_STOP to an EIGHT_SHORT sequence detected. "
-                   "If you heard an audible artifact, please submit the sample to the FFmpeg developers.\n");
-        for (i = 0; i < 1024; i += 128)
-            ff_imdct_half(&ac->mdct_small, buf + i, in + i);
-    } else
-        ff_imdct_half(&ac->mdct, buf, in);
-
-    /* window overlapping
-     * NOTE: To simplify the overlapping code, all 'meaningless' short to long
-     * and long to short transitions are considered to be short to short
-     * transitions. This leaves just two cases (long to long and short to short)
-     * with a little special sauce for EIGHT_SHORT_SEQUENCE.
-     */
-    if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) &&
-            (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) {
-        ac->dsp.vector_fmul_window(    out,               saved,            buf,         lwindow_prev, bias, 512);
-    } else {
-        for (i = 0; i < 448; i++)
-            out[i] = saved[i] + bias;
-
-        if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
-            ac->dsp.vector_fmul_window(out + 448 + 0*128, saved + 448,      buf + 0*128, swindow_prev, bias, 64);
-            ac->dsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow,      bias, 64);
-            ac->dsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow,      bias, 64);
-            ac->dsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow,      bias, 64);
-            ac->dsp.vector_fmul_window(temp,              buf + 3*128 + 64, buf + 4*128, swindow,      bias, 64);
-            memcpy(                    out + 448 + 4*128, temp, 64 * sizeof(float));
-        } else {
-            ac->dsp.vector_fmul_window(out + 448,         saved + 448,      buf,         swindow_prev, bias, 64);
-            for (i = 576; i < 1024; i++)
-                out[i] = buf[i-512] + bias;
-        }
-    }
-
-    // buffer update
-    if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) {
-        for (i = 0; i < 64; i++)
-            saved[i] = temp[64 + i] - bias;
-        ac->dsp.vector_fmul_window(saved + 64,  buf + 4*128 + 64, buf + 5*128, swindow, 0, 64);
-        ac->dsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 0, 64);
-        ac->dsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 0, 64);
-        memcpy(                    saved + 448, buf + 7*128 + 64,  64 * sizeof(float));
-    } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) {
-        memcpy(                    saved,       buf + 512,        448 * sizeof(float));
-        memcpy(                    saved + 448, buf + 7*128 + 64,  64 * sizeof(float));
-    } else { // LONG_STOP or ONLY_LONG
-        memcpy(                    saved,       buf + 512,        512 * sizeof(float));
-    }
-}
-
-/**
- * Apply dependent channel coupling (applied before IMDCT).
- *
- * @param   index   index into coupling gain array
- */
-static void apply_dependent_coupling(AACContext *ac,
-                                     SingleChannelElement *target,
-                                     ChannelElement *cce, int index)
-{
-    IndividualChannelStream *ics = &cce->ch[0].ics;
-    const uint16_t *offsets = ics->swb_offset;
-    float *dest = target->coeffs;
-    const float *src = cce->ch[0].coeffs;
-    int g, i, group, k, idx = 0;
-    if (ac->m4ac.object_type == AOT_AAC_LTP) {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Dependent coupling is not supported together with LTP\n");
-        return;
-    }
-    for (g = 0; g < ics->num_window_groups; g++) {
-        for (i = 0; i < ics->max_sfb; i++, idx++) {
-            if (cce->ch[0].band_type[idx] != ZERO_BT) {
-                const float gain = cce->coup.gain[index][idx];
-                for (group = 0; group < ics->group_len[g]; group++) {
-                    for (k = offsets[i]; k < offsets[i + 1]; k++) {
-                        // XXX dsputil-ize
-                        dest[group * 128 + k] += gain * src[group * 128 + k];
-                    }
-                }
-            }
-        }
-        dest += ics->group_len[g] * 128;
-        src  += ics->group_len[g] * 128;
-    }
-}
-
-/**
- * Apply independent channel coupling (applied after IMDCT).
- *
- * @param   index   index into coupling gain array
- */
-static void apply_independent_coupling(AACContext *ac,
-                                       SingleChannelElement *target,
-                                       ChannelElement *cce, int index)
-{
-    int i;
-    const float gain = cce->coup.gain[index][0];
-    const float bias = ac->add_bias;
-    const float *src = cce->ch[0].ret;
-    float *dest = target->ret;
-    const int len = 1024 << (ac->m4ac.sbr == 1);
-
-    for (i = 0; i < len; i++)
-        dest[i] += gain * (src[i] - bias);
-}
-
-/**
- * channel coupling transformation interface
- *
- * @param   index   index into coupling gain array
- * @param   apply_coupling_method   pointer to (in)dependent coupling function
- */
-static void apply_channel_coupling(AACContext *ac, ChannelElement *cc,
-                                   enum RawDataBlockType type, int elem_id,
-                                   enum CouplingPoint coupling_point,
-                                   void (*apply_coupling_method)(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index))
-{
-    int i, c;
-
-    for (i = 0; i < MAX_ELEM_ID; i++) {
-        ChannelElement *cce = ac->che[TYPE_CCE][i];
-        int index = 0;
-
-        if (cce && cce->coup.coupling_point == coupling_point) {
-            ChannelCoupling *coup = &cce->coup;
-
-            for (c = 0; c <= coup->num_coupled; c++) {
-                if (coup->type[c] == type && coup->id_select[c] == elem_id) {
-                    if (coup->ch_select[c] != 1) {
-                        apply_coupling_method(ac, &cc->ch[0], cce, index);
-                        if (coup->ch_select[c] != 0)
-                            index++;
-                    }
-                    if (coup->ch_select[c] != 2)
-                        apply_coupling_method(ac, &cc->ch[1], cce, index++);
-                } else
-                    index += 1 + (coup->ch_select[c] == 3);
-            }
-        }
-    }
-}
-
-/**
- * Convert spectral data to float samples, applying all supported tools as appropriate.
- */
-static void spectral_to_sample(AACContext *ac)
-{
-    int i, type;
-    float imdct_bias = (ac->m4ac.sbr <= 0) ? ac->add_bias : 0.0f;
-    for (type = 3; type >= 0; type--) {
-        for (i = 0; i < MAX_ELEM_ID; i++) {
-            ChannelElement *che = ac->che[type][i];
-            if (che) {
-                if (type <= TYPE_CPE)
-                    apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling);
-                if (che->ch[0].tns.present)
-                    apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1);
-                if (che->ch[1].tns.present)
-                    apply_tns(che->ch[1].coeffs, &che->ch[1].tns, &che->ch[1].ics, 1);
-                if (type <= TYPE_CPE)
-                    apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling);
-                if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) {
-                    imdct_and_windowing(ac, &che->ch[0], imdct_bias);
-                    if (type == TYPE_CPE) {
-                        imdct_and_windowing(ac, &che->ch[1], imdct_bias);
-                    }
-                    if (ac->m4ac.sbr > 0) {
-                        ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret);
-                    }
-                }
-                if (type <= TYPE_CCE)
-                    apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling);
-            }
-        }
-    }
-}
-
-static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
-{
-    int size;
-    AACADTSHeaderInfo hdr_info;
-
-    size = ff_aac_parse_header(gb, &hdr_info);
-    if (size > 0) {
-        if (ac->output_configured != OC_LOCKED && hdr_info.chan_config) {
-            enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
-            memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
-            ac->m4ac.chan_config = hdr_info.chan_config;
-            if (set_default_channel_config(ac, new_che_pos, hdr_info.chan_config))
-                return -7;
-            if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config, OC_TRIAL_FRAME))
-                return -7;
-        } else if (ac->output_configured != OC_LOCKED) {
-            ac->output_configured = OC_NONE;
-        }
-        if (ac->output_configured != OC_LOCKED) {
-            ac->m4ac.sbr = -1;
-            ac->m4ac.ps  = -1;
-        }
-        ac->m4ac.sample_rate     = hdr_info.sample_rate;
-        ac->m4ac.sampling_index  = hdr_info.sampling_index;
-        ac->m4ac.object_type     = hdr_info.object_type;
-        if (!ac->avctx->sample_rate)
-            ac->avctx->sample_rate = hdr_info.sample_rate;
-        if (hdr_info.num_aac_frames == 1) {
-            if (!hdr_info.crc_absent)
-                skip_bits(gb, 16);
-        } else {
-            av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame is", 0);
-            return -1;
-        }
-    }
-    return size;
-}
-
-static int aac_decode_frame(AVCodecContext *avctx, void *data,
-                            int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AACContext *ac = avctx->priv_data;
-    ChannelElement *che = NULL, *che_prev = NULL;
-    GetBitContext gb;
-    enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
-    int err, elem_id, data_size_tmp;
-    int buf_consumed;
-    int samples = 0, multiplier;
-    int buf_offset;
-
-    init_get_bits(&gb, buf, buf_size * 8);
-
-    if (show_bits(&gb, 12) == 0xfff) {
-        if (parse_adts_frame_header(ac, &gb) < 0) {
-            av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
-            return -1;
-        }
-        if (ac->m4ac.sampling_index > 12) {
-            av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->m4ac.sampling_index);
-            return -1;
-        }
-    }
-
-    memset(ac->tags_seen_this_frame, 0, sizeof(ac->tags_seen_this_frame));
-    // parse
-    while ((elem_type = get_bits(&gb, 3)) != TYPE_END) {
-        elem_id = get_bits(&gb, 4);
-
-        if (elem_type < TYPE_DSE) {
-            if (!(che=get_che(ac, elem_type, elem_id))) {
-                av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n",
-                       elem_type, elem_id);
-                return -1;
-            }
-            samples = 1024;
-        }
-
-        switch (elem_type) {
-
-        case TYPE_SCE:
-            err = decode_ics(ac, &che->ch[0], &gb, 0, 0);
-            break;
-
-        case TYPE_CPE:
-            err = decode_cpe(ac, &gb, che);
-            break;
-
-        case TYPE_CCE:
-            err = decode_cce(ac, &gb, che);
-            break;
-
-        case TYPE_LFE:
-            err = decode_ics(ac, &che->ch[0], &gb, 0, 0);
-            break;
-
-        case TYPE_DSE:
-            err = skip_data_stream_element(ac, &gb);
-            break;
-
-        case TYPE_PCE: {
-            enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
-            memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
-            if ((err = decode_pce(ac, new_che_pos, &gb)))
-                break;
-            if (ac->output_configured > OC_TRIAL_PCE)
-                av_log(avctx, AV_LOG_ERROR,
-                       "Not evaluating a further program_config_element as this construct is dubious at best.\n");
-            else
-                err = output_configure(ac, ac->che_pos, new_che_pos, 0, OC_TRIAL_PCE);
-            break;
-        }
-
-        case TYPE_FIL:
-            if (elem_id == 15)
-                elem_id += get_bits(&gb, 8) - 1;
-            if (get_bits_left(&gb) < 8 * elem_id) {
-                    av_log(avctx, AV_LOG_ERROR, overread_err);
-                    return -1;
-            }
-            while (elem_id > 0)
-                elem_id -= decode_extension_payload(ac, &gb, elem_id, che_prev, elem_type_prev);
-            err = 0; /* FIXME */
-            break;
-
-        default:
-            err = -1; /* should not happen, but keeps compiler happy */
-            break;
-        }
-
-        che_prev       = che;
-        elem_type_prev = elem_type;
-
-        if (err)
-            return err;
-
-        if (get_bits_left(&gb) < 3) {
-            av_log(avctx, AV_LOG_ERROR, overread_err);
-            return -1;
-        }
-    }
-
-    spectral_to_sample(ac);
-
-    multiplier = (ac->m4ac.sbr == 1) ? ac->m4ac.ext_sample_rate > ac->m4ac.sample_rate : 0;
-    samples <<= multiplier;
-    if (ac->output_configured < OC_LOCKED) {
-        avctx->sample_rate = ac->m4ac.sample_rate << multiplier;
-        avctx->frame_size = samples;
-    }
-
-    data_size_tmp = samples * avctx->channels * sizeof(int16_t);
-    if (*data_size < data_size_tmp) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
-               *data_size, data_size_tmp);
-        return -1;
-    }
-    *data_size = data_size_tmp;
-
-    if (samples)
-        ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
-
-    if (ac->output_configured)
-        ac->output_configured = OC_LOCKED;
-
-    buf_consumed = (get_bits_count(&gb) + 7) >> 3;
-    for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
-        if (buf[buf_offset])
-            break;
-
-    return buf_size > buf_offset ? buf_consumed : buf_size;
-}
-
-static av_cold int aac_decode_close(AVCodecContext *avctx)
-{
-    AACContext *ac = avctx->priv_data;
-    int i, type;
-
-    for (i = 0; i < MAX_ELEM_ID; i++) {
-        for (type = 0; type < 4; type++) {
-            if (ac->che[type][i])
-                ff_aac_sbr_ctx_close(&ac->che[type][i]->sbr);
-            av_freep(&ac->che[type][i]);
-        }
-    }
-
-    ff_mdct_end(&ac->mdct);
-    ff_mdct_end(&ac->mdct_small);
-    return 0;
-}
-
-AVCodec aac_decoder = {
-    "aac",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AAC,
-    sizeof(AACContext),
-    aac_decode_init,
-    NULL,
-    aac_decode_close,
-    aac_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
-    .sample_fmts = (const enum SampleFormat[]) {
-        SAMPLE_FMT_S16,SAMPLE_FMT_NONE
-    },
-    .channel_layouts = aac_channel_layout,
-};
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
deleted file mode 100644
index b74f100..0000000
--- a/libavcodec/aacdectab.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * AAC decoder data
- * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
- * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC decoder data
- * @author Oded Shimon  ( ods15 ods15 dyndns org )
- * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
- */
-
-#ifndef AVCODEC_AACDECTAB_H
-#define AVCODEC_AACDECTAB_H
-
-#include "aac.h"
-
-#include <stdint.h>
-
-/* @name tns_tmp2_map
- * Tables of the tmp2[] arrays of LPC coefficients used for TNS.
- * The suffix _M_N[] indicate the values of coef_compress and coef_res
- * respectively.
- * @{
- */
-static const float tns_tmp2_map_1_3[4] = {
-     0.00000000, -0.43388373,  0.64278758,  0.34202015,
-};
-
-static const float tns_tmp2_map_0_3[8] = {
-     0.00000000, -0.43388373, -0.78183150, -0.97492790,
-     0.98480773,  0.86602539,  0.64278758,  0.34202015,
-};
-
-static const float tns_tmp2_map_1_4[8] = {
-     0.00000000, -0.20791170, -0.40673664, -0.58778524,
-     0.67369562,  0.52643216,  0.36124167,  0.18374951,
-};
-
-static const float tns_tmp2_map_0_4[16] = {
-     0.00000000, -0.20791170, -0.40673664, -0.58778524,
-    -0.74314481, -0.86602539, -0.95105654, -0.99452192,
-     0.99573416,  0.96182561,  0.89516330,  0.79801720,
-     0.67369562,  0.52643216,  0.36124167,  0.18374951,
-};
-
-static const float * const tns_tmp2_map[4] = {
-    tns_tmp2_map_0_3,
-    tns_tmp2_map_0_4,
-    tns_tmp2_map_1_3,
-    tns_tmp2_map_1_4
-};
-// @}
-
-static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-static const uint8_t aac_channel_layout_map[7][5][2] = {
-    { { TYPE_SCE, 0 }, },
-    { { TYPE_CPE, 0 }, },
-    { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, },
-    { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_SCE, 1 }, },
-    { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_CPE, 1 }, },
-    { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 1 }, },
-    { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 2 }, { TYPE_CPE, 1 }, },
-};
-
-static const int64_t aac_channel_layout[8] = {
-    CH_LAYOUT_MONO,
-    CH_LAYOUT_STEREO,
-    CH_LAYOUT_SURROUND,
-    CH_LAYOUT_4POINT0,
-    CH_LAYOUT_5POINT0_BACK,
-    CH_LAYOUT_5POINT1_BACK,
-    CH_LAYOUT_7POINT1_WIDE,
-    0,
-};
-
-#endif /* AVCODEC_AACDECTAB_H */
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
deleted file mode 100644
index 8c913e0..0000000
--- a/libavcodec/aacenc.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * AAC encoder
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC encoder
- */
-
-/***********************************
- *              TODOs:
- * add sane pulse detection
- * add temporal noise shaping
- ***********************************/
-
-#include "avcodec.h"
-#include "put_bits.h"
-#include "dsputil.h"
-#include "mpeg4audio.h"
-
-#include "aac.h"
-#include "aactab.h"
-#include "aacenc.h"
-
-#include "psymodel.h"
-
-static const uint8_t swb_size_1024_96[] = {
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8,
-    12, 12, 12, 12, 12, 16, 16, 24, 28, 36, 44,
-    64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
-};
-
-static const uint8_t swb_size_1024_64[] = {
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8,
-    12, 12, 12, 16, 16, 16, 20, 24, 24, 28, 36,
-    40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40
-};
-
-static const uint8_t swb_size_1024_48[] = {
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
-    12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28,
-    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-    96
-};
-
-static const uint8_t swb_size_1024_32[] = {
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
-    12, 12, 12, 12, 16, 16, 20, 20, 24, 24, 28, 28,
-    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
-};
-
-static const uint8_t swb_size_1024_24[] = {
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-    12, 12, 12, 12, 16, 16, 16, 20, 20, 24, 24, 28, 28,
-    32, 36, 36, 40, 44, 48, 52, 52, 64, 64, 64, 64, 64
-};
-
-static const uint8_t swb_size_1024_16[] = {
-    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 16, 16, 16, 16, 20, 20, 20, 24, 24, 28, 28,
-    32, 36, 40, 40, 44, 48, 52, 56, 60, 64, 64, 64
-};
-
-static const uint8_t swb_size_1024_8[] = {
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    16, 16, 16, 16, 16, 16, 16, 20, 20, 20, 20, 24, 24, 24, 28, 28,
-    32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80
-};
-
-static const uint8_t *swb_size_1024[] = {
-    swb_size_1024_96, swb_size_1024_96, swb_size_1024_64,
-    swb_size_1024_48, swb_size_1024_48, swb_size_1024_32,
-    swb_size_1024_24, swb_size_1024_24, swb_size_1024_16,
-    swb_size_1024_16, swb_size_1024_16, swb_size_1024_8
-};
-
-static const uint8_t swb_size_128_96[] = {
-    4, 4, 4, 4, 4, 4, 8, 8, 8, 16, 28, 36
-};
-
-static const uint8_t swb_size_128_48[] = {
-    4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16
-};
-
-static const uint8_t swb_size_128_24[] = {
-    4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 20
-};
-
-static const uint8_t swb_size_128_16[] = {
-    4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 12, 12, 16, 20, 20
-};
-
-static const uint8_t swb_size_128_8[] = {
-    4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20
-};
-
-static const uint8_t *swb_size_128[] = {
-    /* the last entry on the following row is swb_size_128_64 but is a
-       duplicate of swb_size_128_96 */
-    swb_size_128_96, swb_size_128_96, swb_size_128_96,
-    swb_size_128_48, swb_size_128_48, swb_size_128_48,
-    swb_size_128_24, swb_size_128_24, swb_size_128_16,
-    swb_size_128_16, swb_size_128_16, swb_size_128_8
-};
-
-/** default channel configurations */
-static const uint8_t aac_chan_configs[6][5] = {
- {1, TYPE_SCE},                               // 1 channel  - single channel element
- {1, TYPE_CPE},                               // 2 channels - channel pair
- {2, TYPE_SCE, TYPE_CPE},                     // 3 channels - center + stereo
- {3, TYPE_SCE, TYPE_CPE, TYPE_SCE},           // 4 channels - front center + stereo + back center
- {3, TYPE_SCE, TYPE_CPE, TYPE_CPE},           // 5 channels - front center + stereo + back stereo
- {4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE
-};
-
-/**
- * Make AAC audio config object.
- * @see 1.6.2.1 "Syntax - AudioSpecificConfig"
- */
-static void put_audio_specific_config(AVCodecContext *avctx)
-{
-    PutBitContext pb;
-    AACEncContext *s = avctx->priv_data;
-
-    init_put_bits(&pb, avctx->extradata, avctx->extradata_size*8);
-    put_bits(&pb, 5, 2); //object type - AAC-LC
-    put_bits(&pb, 4, s->samplerate_index); //sample rate index
-    put_bits(&pb, 4, avctx->channels);
-    //GASpecificConfig
-    put_bits(&pb, 1, 0); //frame length - 1024 samples
-    put_bits(&pb, 1, 0); //does not depend on core coder
-    put_bits(&pb, 1, 0); //is not extension
-    flush_put_bits(&pb);
-}
-
-static av_cold int aac_encode_init(AVCodecContext *avctx)
-{
-    AACEncContext *s = avctx->priv_data;
-    int i;
-    const uint8_t *sizes[2];
-    int lengths[2];
-
-    avctx->frame_size = 1024;
-
-    for (i = 0; i < 16; i++)
-        if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i])
-            break;
-    if (i == 16) {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate);
-        return -1;
-    }
-    if (avctx->channels > 6) {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %d\n", avctx->channels);
-        return -1;
-    }
-    if (avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW) {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported profile %d\n", avctx->profile);
-        return -1;
-    }
-    if (1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * avctx->channels) {
-        av_log(avctx, AV_LOG_ERROR, "Too many bits per frame requested\n");
-        return -1;
-    }
-    s->samplerate_index = i;
-
-    dsputil_init(&s->dsp, avctx);
-    ff_mdct_init(&s->mdct1024, 11, 0, 1.0);
-    ff_mdct_init(&s->mdct128,   8, 0, 1.0);
-    // window init
-    ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
-    ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
-    ff_init_ff_sine_windows(10);
-    ff_init_ff_sine_windows(7);
-
-    s->samples            = av_malloc(2 * 1024 * avctx->channels * sizeof(s->samples[0]));
-    s->cpe                = av_mallocz(sizeof(ChannelElement) * aac_chan_configs[avctx->channels-1][0]);
-    avctx->extradata      = av_malloc(2);
-    avctx->extradata_size = 2;
-    put_audio_specific_config(avctx);
-
-    sizes[0]   = swb_size_1024[i];
-    sizes[1]   = swb_size_128[i];
-    lengths[0] = ff_aac_num_swb_1024[i];
-    lengths[1] = ff_aac_num_swb_128[i];
-    ff_psy_init(&s->psy, avctx, 2, sizes, lengths);
-    s->psypp = ff_psy_preprocess_init(avctx);
-    s->coder = &ff_aac_coders[2];
-
-    s->lambda = avctx->global_quality ? avctx->global_quality : 120;
-
-    ff_aac_tableinit();
-
-    if (avctx->channels > 5)
-        av_log(avctx, AV_LOG_ERROR, "This encoder does not yet enforce the restrictions on LFEs. "
-               "The output will most likely be an illegal bitstream.\n");
-
-    return 0;
-}
-
-static void apply_window_and_mdct(AVCodecContext *avctx, AACEncContext *s,
-                                  SingleChannelElement *sce, short *audio, int channel)
-{
-    int i, j, k;
-    const float * lwindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024;
-    const float * swindow = sce->ics.use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128;
-    const float * pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
-
-    if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
-        memcpy(s->output, sce->saved, sizeof(float)*1024);
-        if (sce->ics.window_sequence[0] == LONG_STOP_SEQUENCE) {
-            memset(s->output, 0, sizeof(s->output[0]) * 448);
-            for (i = 448; i < 576; i++)
-                s->output[i] = sce->saved[i] * pwindow[i - 448];
-            for (i = 576; i < 704; i++)
-                s->output[i] = sce->saved[i];
-        }
-        if (sce->ics.window_sequence[0] != LONG_START_SEQUENCE) {
-            for (i = 0, j = channel; i < 1024; i++, j += avctx->channels) {
-                s->output[i+1024]         = audio[j] * lwindow[1024 - i - 1];
-                sce->saved[i] = audio[j] * lwindow[i];
-            }
-        } else {
-            for (i = 0, j = channel; i < 448; i++, j += avctx->channels)
-                s->output[i+1024]         = audio[j];
-            for (; i < 576; i++, j += avctx->channels)
-                s->output[i+1024]         = audio[j] * swindow[576 - i - 1];
-            memset(s->output+1024+576, 0, sizeof(s->output[0]) * 448);
-            for (i = 0, j = channel; i < 1024; i++, j += avctx->channels)
-                sce->saved[i] = audio[j];
-        }
-        ff_mdct_calc(&s->mdct1024, sce->coeffs, s->output);
-    } else {
-        for (k = 0; k < 1024; k += 128) {
-            for (i = 448 + k; i < 448 + k + 256; i++)
-                s->output[i - 448 - k] = (i < 1024)
-                                         ? sce->saved[i]
-                                         : audio[channel + (i-1024)*avctx->channels];
-            s->dsp.vector_fmul        (s->output,     k ?  swindow : pwindow, 128);
-            s->dsp.vector_fmul_reverse(s->output+128, s->output+128, swindow, 128);
-            ff_mdct_calc(&s->mdct128, sce->coeffs + k, s->output);
-        }
-        for (i = 0, j = channel; i < 1024; i++, j += avctx->channels)
-            sce->saved[i] = audio[j];
-    }
-}
-
-/**
- * Encode ics_info element.
- * @see Table 4.6 (syntax of ics_info)
- */
-static void put_ics_info(AACEncContext *s, IndividualChannelStream *info)
-{
-    int w;
-
-    put_bits(&s->pb, 1, 0);                // ics_reserved bit
-    put_bits(&s->pb, 2, info->window_sequence[0]);
-    put_bits(&s->pb, 1, info->use_kb_window[0]);
-    if (info->window_sequence[0] != EIGHT_SHORT_SEQUENCE) {
-        put_bits(&s->pb, 6, info->max_sfb);
-        put_bits(&s->pb, 1, 0);            // no prediction
-    } else {
-        put_bits(&s->pb, 4, info->max_sfb);
-        for (w = 1; w < 8; w++)
-            put_bits(&s->pb, 1, !info->group_len[w]);
-    }
-}
-
-/**
- * Encode MS data.
- * @see 4.6.8.1 "Joint Coding - M/S Stereo"
- */
-static void encode_ms_info(PutBitContext *pb, ChannelElement *cpe)
-{
-    int i, w;
-
-    put_bits(pb, 2, cpe->ms_mode);
-    if (cpe->ms_mode == 1)
-        for (w = 0; w < cpe->ch[0].ics.num_windows; w += cpe->ch[0].ics.group_len[w])
-            for (i = 0; i < cpe->ch[0].ics.max_sfb; i++)
-                put_bits(pb, 1, cpe->ms_mask[w*16 + i]);
-}
-
-/**
- * Produce integer coefficients from scalefactors provided by the model.
- */
-static void adjust_frame_information(AACEncContext *apc, ChannelElement *cpe, int chans)
-{
-    int i, w, w2, g, ch;
-    int start, sum, maxsfb, cmaxsfb;
-
-    for (ch = 0; ch < chans; ch++) {
-        IndividualChannelStream *ics = &cpe->ch[ch].ics;
-        start = 0;
-        maxsfb = 0;
-        cpe->ch[ch].pulse.num_pulse = 0;
-        for (w = 0; w < ics->num_windows*16; w += 16) {
-            for (g = 0; g < ics->num_swb; g++) {
-                sum = 0;
-                //apply M/S
-                if (!ch && cpe->ms_mask[w + g]) {
-                    for (i = 0; i < ics->swb_sizes[g]; i++) {
-                        cpe->ch[0].coeffs[start+i] = (cpe->ch[0].coeffs[start+i] + cpe->ch[1].coeffs[start+i]) / 2.0;
-                        cpe->ch[1].coeffs[start+i] =  cpe->ch[0].coeffs[start+i] - cpe->ch[1].coeffs[start+i];
-                    }
-                }
-                start += ics->swb_sizes[g];
-            }
-            for (cmaxsfb = ics->num_swb; cmaxsfb > 0 && cpe->ch[ch].zeroes[w+cmaxsfb-1]; cmaxsfb--)
-                ;
-            maxsfb = FFMAX(maxsfb, cmaxsfb);
-        }
-        ics->max_sfb = maxsfb;
-
-        //adjust zero bands for window groups
-        for (w = 0; w < ics->num_windows; w += ics->group_len[w]) {
-            for (g = 0; g < ics->max_sfb; g++) {
-                i = 1;
-                for (w2 = w; w2 < w + ics->group_len[w]; w2++) {
-                    if (!cpe->ch[ch].zeroes[w2*16 + g]) {
-                        i = 0;
-                        break;
-                    }
-                }
-                cpe->ch[ch].zeroes[w*16 + g] = i;
-            }
-        }
-    }
-
-    if (chans > 1 && cpe->common_window) {
-        IndividualChannelStream *ics0 = &cpe->ch[0].ics;
-        IndividualChannelStream *ics1 = &cpe->ch[1].ics;
-        int msc = 0;
-        ics0->max_sfb = FFMAX(ics0->max_sfb, ics1->max_sfb);
-        ics1->max_sfb = ics0->max_sfb;
-        for (w = 0; w < ics0->num_windows*16; w += 16)
-            for (i = 0; i < ics0->max_sfb; i++)
-                if (cpe->ms_mask[w+i])
-                    msc++;
-        if (msc == 0 || ics0->max_sfb == 0)
-            cpe->ms_mode = 0;
-        else
-            cpe->ms_mode = msc < ics0->max_sfb ? 1 : 2;
-    }
-}
-
-/**
- * Encode scalefactor band coding type.
- */
-static void encode_band_info(AACEncContext *s, SingleChannelElement *sce)
-{
-    int w;
-
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w])
-        s->coder->encode_window_bands_info(s, sce, w, sce->ics.group_len[w], s->lambda);
-}
-
-/**
- * Encode scalefactors.
- */
-static void encode_scale_factors(AVCodecContext *avctx, AACEncContext *s,
-                                 SingleChannelElement *sce)
-{
-    int off = sce->sf_idx[0], diff;
-    int i, w;
-
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        for (i = 0; i < sce->ics.max_sfb; i++) {
-            if (!sce->zeroes[w*16 + i]) {
-                diff = sce->sf_idx[w*16 + i] - off + SCALE_DIFF_ZERO;
-                if (diff < 0 || diff > 120)
-                    av_log(avctx, AV_LOG_ERROR, "Scalefactor difference is too big to be coded\n");
-                off = sce->sf_idx[w*16 + i];
-                put_bits(&s->pb, ff_aac_scalefactor_bits[diff], ff_aac_scalefactor_code[diff]);
-            }
-        }
-    }
-}
-
-/**
- * Encode pulse data.
- */
-static void encode_pulses(AACEncContext *s, Pulse *pulse)
-{
-    int i;
-
-    put_bits(&s->pb, 1, !!pulse->num_pulse);
-    if (!pulse->num_pulse)
-        return;
-
-    put_bits(&s->pb, 2, pulse->num_pulse - 1);
-    put_bits(&s->pb, 6, pulse->start);
-    for (i = 0; i < pulse->num_pulse; i++) {
-        put_bits(&s->pb, 5, pulse->pos[i]);
-        put_bits(&s->pb, 4, pulse->amp[i]);
-    }
-}
-
-/**
- * Encode spectral coefficients processed by psychoacoustic model.
- */
-static void encode_spectral_coeffs(AACEncContext *s, SingleChannelElement *sce)
-{
-    int start, i, w, w2;
-
-    for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
-        start = 0;
-        for (i = 0; i < sce->ics.max_sfb; i++) {
-            if (sce->zeroes[w*16 + i]) {
-                start += sce->ics.swb_sizes[i];
-                continue;
-            }
-            for (w2 = w; w2 < w + sce->ics.group_len[w]; w2++)
-                s->coder->quantize_and_encode_band(s, &s->pb, sce->coeffs + start + w2*128,
-                                                   sce->ics.swb_sizes[i],
-                                                   sce->sf_idx[w*16 + i],
-                                                   sce->band_type[w*16 + i],
-                                                   s->lambda);
-            start += sce->ics.swb_sizes[i];
-        }
-    }
-}
-
-/**
- * Encode one channel of audio data.
- */
-static int encode_individual_channel(AVCodecContext *avctx, AACEncContext *s,
-                                     SingleChannelElement *sce,
-                                     int common_window)
-{
-    put_bits(&s->pb, 8, sce->sf_idx[0]);
-    if (!common_window)
-        put_ics_info(s, &sce->ics);
-    encode_band_info(s, sce);
-    encode_scale_factors(avctx, s, sce);
-    encode_pulses(s, &sce->pulse);
-    put_bits(&s->pb, 1, 0); //tns
-    put_bits(&s->pb, 1, 0); //ssr
-    encode_spectral_coeffs(s, sce);
-    return 0;
-}
-
-/**
- * Write some auxiliary information about the created AAC file.
- */
-static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s,
-                               const char *name)
-{
-    int i, namelen, padbits;
-
-    namelen = strlen(name) + 2;
-    put_bits(&s->pb, 3, TYPE_FIL);
-    put_bits(&s->pb, 4, FFMIN(namelen, 15));
-    if (namelen >= 15)
-        put_bits(&s->pb, 8, namelen - 16);
-    put_bits(&s->pb, 4, 0); //extension type - filler
-    padbits = 8 - (put_bits_count(&s->pb) & 7);
-    align_put_bits(&s->pb);
-    for (i = 0; i < namelen - 2; i++)
-        put_bits(&s->pb, 8, name[i]);
-    put_bits(&s->pb, 12 - padbits, 0);
-}
-
-static int aac_encode_frame(AVCodecContext *avctx,
-                            uint8_t *frame, int buf_size, void *data)
-{
-    AACEncContext *s = avctx->priv_data;
-    int16_t *samples = s->samples, *samples2, *la;
-    ChannelElement *cpe;
-    int i, j, chans, tag, start_ch;
-    const uint8_t *chan_map = aac_chan_configs[avctx->channels-1];
-    int chan_el_counter[4];
-    FFPsyWindowInfo windows[avctx->channels];
-
-    if (s->last_frame)
-        return 0;
-    if (data) {
-        if (!s->psypp) {
-            memcpy(s->samples + 1024 * avctx->channels, data,
-                   1024 * avctx->channels * sizeof(s->samples[0]));
-        } else {
-            start_ch = 0;
-            samples2 = s->samples + 1024 * avctx->channels;
-            for (i = 0; i < chan_map[0]; i++) {
-                tag = chan_map[i+1];
-                chans = tag == TYPE_CPE ? 2 : 1;
-                ff_psy_preprocess(s->psypp, (uint16_t*)data + start_ch,
-                                  samples2 + start_ch, start_ch, chans);
-                start_ch += chans;
-            }
-        }
-    }
-    if (!avctx->frame_number) {
-        memcpy(s->samples, s->samples + 1024 * avctx->channels,
-               1024 * avctx->channels * sizeof(s->samples[0]));
-        return 0;
-    }
-
-    start_ch = 0;
-    for (i = 0; i < chan_map[0]; i++) {
-        FFPsyWindowInfo* wi = windows + start_ch;
-        tag      = chan_map[i+1];
-        chans    = tag == TYPE_CPE ? 2 : 1;
-        cpe      = &s->cpe[i];
-        samples2 = samples + start_ch;
-        la       = samples2 + 1024 * avctx->channels + start_ch;
-        if (!data)
-            la = NULL;
-        for (j = 0; j < chans; j++) {
-            IndividualChannelStream *ics = &cpe->ch[j].ics;
-            int k;
-            wi[j] = ff_psy_suggest_window(&s->psy, samples2, la, start_ch + j, ics->window_sequence[0]);
-            ics->window_sequence[1] = ics->window_sequence[0];
-            ics->window_sequence[0] = wi[j].window_type[0];
-            ics->use_kb_window[1]   = ics->use_kb_window[0];
-            ics->use_kb_window[0]   = wi[j].window_shape;
-            ics->num_windows        = wi[j].num_windows;
-            ics->swb_sizes          = s->psy.bands    [ics->num_windows == 8];
-            ics->num_swb            = s->psy.num_bands[ics->num_windows == 8];
-            for (k = 0; k < ics->num_windows; k++)
-                ics->group_len[k] = wi[j].grouping[k];
-
-            s->cur_channel = start_ch + j;
-            apply_window_and_mdct(avctx, s, &cpe->ch[j], samples2, j);
-        }
-        start_ch += chans;
-    }
-    do {
-        int frame_bits;
-        init_put_bits(&s->pb, frame, buf_size*8);
-        if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))
-            put_bitstream_info(avctx, s, LIBAVCODEC_IDENT);
-        start_ch = 0;
-        memset(chan_el_counter, 0, sizeof(chan_el_counter));
-        for (i = 0; i < chan_map[0]; i++) {
-            FFPsyWindowInfo* wi = windows + start_ch;
-            tag      = chan_map[i+1];
-            chans    = tag == TYPE_CPE ? 2 : 1;
-            cpe      = &s->cpe[i];
-            for (j = 0; j < chans; j++) {
-                s->cur_channel = start_ch + j;
-                ff_psy_set_band_info(&s->psy, s->cur_channel, cpe->ch[j].coeffs, &wi[j]);
-                s->coder->search_for_quantizers(avctx, s, &cpe->ch[j], s->lambda);
-            }
-            cpe->common_window = 0;
-            if (chans > 1
-                && wi[0].window_type[0] == wi[1].window_type[0]
-                && wi[0].window_shape   == wi[1].window_shape) {
-
-                cpe->common_window = 1;
-                for (j = 0; j < wi[0].num_windows; j++) {
-                    if (wi[0].grouping[j] != wi[1].grouping[j]) {
-                        cpe->common_window = 0;
-                        break;
-                    }
-                }
-            }
-            s->cur_channel = start_ch;
-            if (cpe->common_window && s->coder->search_for_ms)
-                s->coder->search_for_ms(s, cpe, s->lambda);
-            adjust_frame_information(s, cpe, chans);
-            put_bits(&s->pb, 3, tag);
-            put_bits(&s->pb, 4, chan_el_counter[tag]++);
-            if (chans == 2) {
-                put_bits(&s->pb, 1, cpe->common_window);
-                if (cpe->common_window) {
-                    put_ics_info(s, &cpe->ch[0].ics);
-                    encode_ms_info(&s->pb, cpe);
-                }
-            }
-            for (j = 0; j < chans; j++) {
-                s->cur_channel = start_ch + j;
-                encode_individual_channel(avctx, s, &cpe->ch[j], cpe->common_window);
-            }
-            start_ch += chans;
-        }
-
-        frame_bits = put_bits_count(&s->pb);
-        if (frame_bits <= 6144 * avctx->channels - 3)
-            break;
-
-        s->lambda *= avctx->bit_rate * 1024.0f / avctx->sample_rate / frame_bits;
-
-    } while (1);
-
-    put_bits(&s->pb, 3, TYPE_END);
-    flush_put_bits(&s->pb);
-    avctx->frame_bits = put_bits_count(&s->pb);
-
-    // rate control stuff
-    if (!(avctx->flags & CODEC_FLAG_QSCALE)) {
-        float ratio = avctx->bit_rate * 1024.0f / avctx->sample_rate / avctx->frame_bits;
-        s->lambda *= ratio;
-        s->lambda = FFMIN(s->lambda, 65536.f);
-    }
-
-    if (!data)
-        s->last_frame = 1;
-    memcpy(s->samples, s->samples + 1024 * avctx->channels,
-           1024 * avctx->channels * sizeof(s->samples[0]));
-    return put_bits_count(&s->pb)>>3;
-}
-
-static av_cold int aac_encode_end(AVCodecContext *avctx)
-{
-    AACEncContext *s = avctx->priv_data;
-
-    ff_mdct_end(&s->mdct1024);
-    ff_mdct_end(&s->mdct128);
-    ff_psy_end(&s->psy);
-    ff_psy_preprocess_end(s->psypp);
-    av_freep(&s->samples);
-    av_freep(&s->cpe);
-    return 0;
-}
-
-AVCodec aac_encoder = {
-    "aac",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AAC,
-    sizeof(AACEncContext),
-    aac_encode_init,
-    aac_encode_frame,
-    aac_encode_end,
-    .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
-};
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
deleted file mode 100644
index 86c68d3..0000000
--- a/libavcodec/aacenc.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * AAC encoder
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AACENC_H
-#define AVCODEC_AACENC_H
-
-#include "avcodec.h"
-#include "put_bits.h"
-#include "dsputil.h"
-
-#include "aac.h"
-
-#include "psymodel.h"
-
-struct AACEncContext;
-
-typedef struct AACCoefficientsEncoder {
-    void (*search_for_quantizers)(AVCodecContext *avctx, struct AACEncContext *s,
-                                  SingleChannelElement *sce, const float lambda);
-    void (*encode_window_bands_info)(struct AACEncContext *s, SingleChannelElement *sce,
-                                     int win, int group_len, const float lambda);
-    void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, int size,
-                                     int scale_idx, int cb, const float lambda);
-    void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const float lambda);
-} AACCoefficientsEncoder;
-
-extern AACCoefficientsEncoder ff_aac_coders[];
-
-/**
- * AAC encoder context
- */
-typedef struct AACEncContext {
-    PutBitContext pb;
-    FFTContext mdct1024;                         ///< long (1024 samples) frame transform context
-    FFTContext mdct128;                          ///< short (128 samples) frame transform context
-    DSPContext  dsp;
-    DECLARE_ALIGNED(16, FFTSample, output)[2048]; ///< temporary buffer for MDCT input coefficients
-    int16_t* samples;                            ///< saved preprocessed input
-
-    int samplerate_index;                        ///< MPEG-4 samplerate index
-
-    ChannelElement *cpe;                         ///< channel elements
-    FFPsyContext psy;
-    struct FFPsyPreprocessContext* psypp;
-    AACCoefficientsEncoder *coder;
-    int cur_channel;
-    int last_frame;
-    float lambda;
-    DECLARE_ALIGNED(16, int,   qcoefs)[96];      ///< quantized coefficients
-    DECLARE_ALIGNED(16, float, scoefs)[1024];    ///< scaled coefficients
-} AACEncContext;
-
-#endif /* AVCODEC_AACENC_H */
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
deleted file mode 100644
index fc124d1..0000000
--- a/libavcodec/aacps.c
+++ /dev/null
@@ -1,1037 +0,0 @@
-/*
- * MPEG-4 Parametric Stereo decoding functions
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-#include "libavutil/common.h"
-#include "libavutil/mathematics.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "aacps.h"
-#include "aacps_tablegen.h"
-#include "aacpsdata.c"
-
-#define PS_BASELINE 0  //< Operate in Baseline PS mode
-                       //< Baseline implies 10 or 20 stereo bands,
-                       //< mixing mode A, and no ipd/opd
-
-#define numQMFSlots 32 //numTimeSlots * RATE
-
-static const int8_t num_env_tab[2][4] = {
-    { 0, 1, 2, 4, },
-    { 1, 2, 3, 4, },
-};
-
-static const int8_t nr_iidicc_par_tab[] = {
-    10, 20, 34, 10, 20, 34,
-};
-
-static const int8_t nr_iidopd_par_tab[] = {
-     5, 11, 17,  5, 11, 17,
-};
-
-enum {
-    huff_iid_df1,
-    huff_iid_dt1,
-    huff_iid_df0,
-    huff_iid_dt0,
-    huff_icc_df,
-    huff_icc_dt,
-    huff_ipd_df,
-    huff_ipd_dt,
-    huff_opd_df,
-    huff_opd_dt,
-};
-
-static const int huff_iid[] = {
-    huff_iid_df0,
-    huff_iid_df1,
-    huff_iid_dt0,
-    huff_iid_dt1,
-};
-
-static VLC vlc_ps[10];
-
-/**
- * Read Inter-channel Intensity Difference/Inter-Channel Coherence/
- * Inter-channel Phase Difference/Overall Phase Difference parameters from the
- * bitstream.
- *
- * @param avctx contains the current codec context
- * @param gb    pointer to the input bitstream
- * @param ps    pointer to the Parametric Stereo context
- * @param par   pointer to the parameter to be read
- * @param e     envelope to decode
- * @param dt    1: time delta-coded, 0: frequency delta-coded
- */
-#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION) \
-static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, \
-                        int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \
-{ \
-    int b, num = ps->nr_ ## PAR ## _par; \
-    VLC_TYPE (*vlc_table)[2] = vlc_ps[table_idx].table; \
-    if (dt) { \
-        int e_prev = e ? e - 1 : ps->num_env_old - 1; \
-        e_prev = FFMAX(e_prev, 0); \
-        for (b = 0; b < num; b++) { \
-            int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \
-            if (MASK) val &= MASK; \
-            PAR[e][b] = val; \
-            if (ERR_CONDITION) \
-                goto err; \
-        } \
-    } else { \
-        int val = 0; \
-        for (b = 0; b < num; b++) { \
-            val += get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \
-            if (MASK) val &= MASK; \
-            PAR[e][b] = val; \
-            if (ERR_CONDITION) \
-                goto err; \
-        } \
-    } \
-    return 0; \
-err: \
-    av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \
-    return -1; \
-}
-
-READ_PAR_DATA(iid,    huff_offset[table_idx],    0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant)
-READ_PAR_DATA(icc,    huff_offset[table_idx],    0, ps->icc_par[e][b] > 7U)
-READ_PAR_DATA(ipdopd,                      0, 0x07, 0)
-
-static int ps_read_extension_data(GetBitContext *gb, PSContext *ps, int ps_extension_id)
-{
-    int e;
-    int count = get_bits_count(gb);
-
-    if (ps_extension_id)
-        return 0;
-
-    ps->enable_ipdopd = get_bits1(gb);
-    if (ps->enable_ipdopd) {
-        for (e = 0; e < ps->num_env; e++) {
-            int dt = get_bits1(gb);
-            read_ipdopd_data(NULL, gb, ps, ps->ipd_par, dt ? huff_ipd_dt : huff_ipd_df, e, dt);
-            dt = get_bits1(gb);
-            read_ipdopd_data(NULL, gb, ps, ps->opd_par, dt ? huff_opd_dt : huff_opd_df, e, dt);
-        }
-    }
-    skip_bits1(gb);      //reserved_ps
-    return get_bits_count(gb) - count;
-}
-
-static void ipdopd_reset(int8_t *opd_hist, int8_t *ipd_hist)
-{
-    int i;
-    for (i = 0; i < PS_MAX_NR_IPDOPD; i++) {
-        opd_hist[i] = 0;
-        ipd_hist[i] = 0;
-    }
-}
-
-int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps, int bits_left)
-{
-    int e;
-    int bit_count_start = get_bits_count(gb_host);
-    int header;
-    int bits_consumed;
-    GetBitContext gbc = *gb_host, *gb = &gbc;
-
-    header = get_bits1(gb);
-    if (header) {     //enable_ps_header
-        ps->enable_iid = get_bits1(gb);
-        if (ps->enable_iid) {
-            int iid_mode = get_bits(gb, 3);
-            if (iid_mode > 5) {
-                av_log(avctx, AV_LOG_ERROR, "iid_mode %d is reserved.\n",
-                       iid_mode);
-                goto err;
-            }
-            ps->nr_iid_par    = nr_iidicc_par_tab[iid_mode];
-            ps->iid_quant     = iid_mode > 2;
-            ps->nr_ipdopd_par = nr_iidopd_par_tab[iid_mode];
-        }
-        ps->enable_icc = get_bits1(gb);
-        if (ps->enable_icc) {
-            ps->icc_mode = get_bits(gb, 3);
-            if (ps->icc_mode > 5) {
-                av_log(avctx, AV_LOG_ERROR, "icc_mode %d is reserved.\n",
-                       ps->icc_mode);
-                goto err;
-            }
-            ps->nr_icc_par = nr_iidicc_par_tab[ps->icc_mode];
-        }
-        ps->enable_ext = get_bits1(gb);
-    }
-
-    ps->frame_class = get_bits1(gb);
-    ps->num_env_old = ps->num_env;
-    ps->num_env     = num_env_tab[ps->frame_class][get_bits(gb, 2)];
-
-    ps->border_position[0] = -1;
-    if (ps->frame_class) {
-        for (e = 1; e <= ps->num_env; e++)
-            ps->border_position[e] = get_bits(gb, 5);
-    } else
-        for (e = 1; e <= ps->num_env; e++)
-            ps->border_position[e] = (e * numQMFSlots >> ff_log2_tab[ps->num_env]) - 1;
-
-    if (ps->enable_iid) {
-        for (e = 0; e < ps->num_env; e++) {
-            int dt = get_bits1(gb);
-            if (read_iid_data(avctx, gb, ps, ps->iid_par, huff_iid[2*dt+ps->iid_quant], e, dt))
-                goto err;
-        }
-    } else
-        memset(ps->iid_par, 0, sizeof(ps->iid_par));
-
-    if (ps->enable_icc)
-        for (e = 0; e < ps->num_env; e++) {
-            int dt = get_bits1(gb);
-            if (read_icc_data(avctx, gb, ps, ps->icc_par, dt ? huff_icc_dt : huff_icc_df, e, dt))
-                goto err;
-        }
-    else
-        memset(ps->icc_par, 0, sizeof(ps->icc_par));
-
-    if (ps->enable_ext) {
-        int cnt = get_bits(gb, 4);
-        if (cnt == 15) {
-            cnt += get_bits(gb, 8);
-        }
-        cnt *= 8;
-        while (cnt > 7) {
-            int ps_extension_id = get_bits(gb, 2);
-            cnt -= 2 + ps_read_extension_data(gb, ps, ps_extension_id);
-        }
-        if (cnt < 0) {
-            av_log(avctx, AV_LOG_ERROR, "ps extension overflow %d", cnt);
-            goto err;
-        }
-        skip_bits(gb, cnt);
-    }
-
-    ps->enable_ipdopd &= !PS_BASELINE;
-
-    //Fix up envelopes
-    if (!ps->num_env || ps->border_position[ps->num_env] < numQMFSlots - 1) {
-        //Create a fake envelope
-        int source = ps->num_env ? ps->num_env - 1 : ps->num_env_old - 1;
-        if (source >= 0 && source != ps->num_env) {
-            if (ps->enable_iid) {
-                memcpy(ps->iid_par+ps->num_env, ps->iid_par+source, sizeof(ps->iid_par[0]));
-            }
-            if (ps->enable_icc) {
-                memcpy(ps->icc_par+ps->num_env, ps->icc_par+source, sizeof(ps->icc_par[0]));
-            }
-            if (ps->enable_ipdopd) {
-                memcpy(ps->ipd_par+ps->num_env, ps->ipd_par+source, sizeof(ps->ipd_par[0]));
-                memcpy(ps->opd_par+ps->num_env, ps->opd_par+source, sizeof(ps->opd_par[0]));
-            }
-        }
-        ps->num_env++;
-        ps->border_position[ps->num_env] = numQMFSlots - 1;
-    }
-
-
-    ps->is34bands_old = ps->is34bands;
-    if (!PS_BASELINE && (ps->enable_iid || ps->enable_icc))
-        ps->is34bands = (ps->enable_iid && ps->nr_iid_par == 34) ||
-                        (ps->enable_icc && ps->nr_icc_par == 34);
-
-    //Baseline
-    if (!ps->enable_ipdopd) {
-        memset(ps->ipd_par, 0, sizeof(ps->ipd_par));
-        memset(ps->opd_par, 0, sizeof(ps->opd_par));
-    }
-
-    if (header)
-        ps->start = 1;
-
-    bits_consumed = get_bits_count(gb) - bit_count_start;
-    if (bits_consumed <= bits_left) {
-        skip_bits_long(gb_host, bits_consumed);
-        return bits_consumed;
-    }
-    av_log(avctx, AV_LOG_ERROR, "Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed);
-err:
-    ps->start = 0;
-    skip_bits_long(gb_host, bits_left);
-    return bits_left;
-}
-
-/** Split one subband into 2 subsubbands with a symmetric real filter.
- * The filter must have its non-center even coefficients equal to zero. */
-static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[7], int len, int reverse)
-{
-    int i, j;
-    for (i = 0; i < len; i++, in++) {
-        float re_in = filter[6] * in[6][0];          //real inphase
-        float re_op = 0.0f;                          //real out of phase
-        float im_in = filter[6] * in[6][1];          //imag inphase
-        float im_op = 0.0f;                          //imag out of phase
-        for (j = 0; j < 6; j += 2) {
-            re_op += filter[j+1] * (in[j+1][0] + in[12-j-1][0]);
-            im_op += filter[j+1] * (in[j+1][1] + in[12-j-1][1]);
-        }
-        out[ reverse][i][0] = re_in + re_op;
-        out[ reverse][i][1] = im_in + im_op;
-        out[!reverse][i][0] = re_in - re_op;
-        out[!reverse][i][1] = im_in - im_op;
-    }
-}
-
-/** Split one subband into 6 subsubbands with a complex filter */
-static void hybrid6_cx(float (*in)[2], float (*out)[32][2], const float (*filter)[7][2], int len)
-{
-    int i, j, ssb;
-    int N = 8;
-    float temp[8][2];
-
-    for (i = 0; i < len; i++, in++) {
-        for (ssb = 0; ssb < N; ssb++) {
-            float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
-            for (j = 0; j < 6; j++) {
-                float in0_re = in[j][0];
-                float in0_im = in[j][1];
-                float in1_re = in[12-j][0];
-                float in1_im = in[12-j][1];
-                sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
-                sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
-            }
-            temp[ssb][0] = sum_re;
-            temp[ssb][1] = sum_im;
-        }
-        out[0][i][0] = temp[6][0];
-        out[0][i][1] = temp[6][1];
-        out[1][i][0] = temp[7][0];
-        out[1][i][1] = temp[7][1];
-        out[2][i][0] = temp[0][0];
-        out[2][i][1] = temp[0][1];
-        out[3][i][0] = temp[1][0];
-        out[3][i][1] = temp[1][1];
-        out[4][i][0] = temp[2][0] + temp[5][0];
-        out[4][i][1] = temp[2][1] + temp[5][1];
-        out[5][i][0] = temp[3][0] + temp[4][0];
-        out[5][i][1] = temp[3][1] + temp[4][1];
-    }
-}
-
-static void hybrid4_8_12_cx(float (*in)[2], float (*out)[32][2], const float (*filter)[7][2], int N, int len)
-{
-    int i, j, ssb;
-
-    for (i = 0; i < len; i++, in++) {
-        for (ssb = 0; ssb < N; ssb++) {
-            float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
-            for (j = 0; j < 6; j++) {
-                float in0_re = in[j][0];
-                float in0_im = in[j][1];
-                float in1_re = in[12-j][0];
-                float in1_im = in[12-j][1];
-                sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
-                sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
-            }
-            out[ssb][i][0] = sum_re;
-            out[ssb][i][1] = sum_im;
-        }
-    }
-}
-
-static void hybrid_analysis(float out[91][32][2], float in[5][44][2], float L[2][38][64], int is34, int len)
-{
-    int i, j;
-    for (i = 0; i < 5; i++) {
-        for (j = 0; j < 38; j++) {
-            in[i][j+6][0] = L[0][j][i];
-            in[i][j+6][1] = L[1][j][i];
-        }
-    }
-    if (is34) {
-        hybrid4_8_12_cx(in[0], out,    f34_0_12, 12, len);
-        hybrid4_8_12_cx(in[1], out+12, f34_1_8,   8, len);
-        hybrid4_8_12_cx(in[2], out+20, f34_2_4,   4, len);
-        hybrid4_8_12_cx(in[3], out+24, f34_2_4,   4, len);
-        hybrid4_8_12_cx(in[4], out+28, f34_2_4,   4, len);
-        for (i = 0; i < 59; i++) {
-            for (j = 0; j < len; j++) {
-                out[i+32][j][0] = L[0][j][i+5];
-                out[i+32][j][1] = L[1][j][i+5];
-            }
-        }
-    } else {
-        hybrid6_cx(in[0], out, f20_0_8, len);
-        hybrid2_re(in[1], out+6, g1_Q2, len, 1);
-        hybrid2_re(in[2], out+8, g1_Q2, len, 0);
-        for (i = 0; i < 61; i++) {
-            for (j = 0; j < len; j++) {
-                out[i+10][j][0] = L[0][j][i+3];
-                out[i+10][j][1] = L[1][j][i+3];
-            }
-        }
-    }
-    //update in_buf
-    for (i = 0; i < 5; i++) {
-        memcpy(in[i], in[i]+32, 6 * sizeof(in[i][0]));
-    }
-}
-
-static void hybrid_synthesis(float out[2][38][64], float in[91][32][2], int is34, int len)
-{
-    int i, n;
-    if (is34) {
-        for (n = 0; n < len; n++) {
-            memset(out[0][n], 0, 5*sizeof(out[0][n][0]));
-            memset(out[1][n], 0, 5*sizeof(out[1][n][0]));
-            for (i = 0; i < 12; i++) {
-                out[0][n][0] += in[   i][n][0];
-                out[1][n][0] += in[   i][n][1];
-            }
-            for (i = 0; i < 8; i++) {
-                out[0][n][1] += in[12+i][n][0];
-                out[1][n][1] += in[12+i][n][1];
-            }
-            for (i = 0; i < 4; i++) {
-                out[0][n][2] += in[20+i][n][0];
-                out[1][n][2] += in[20+i][n][1];
-                out[0][n][3] += in[24+i][n][0];
-                out[1][n][3] += in[24+i][n][1];
-                out[0][n][4] += in[28+i][n][0];
-                out[1][n][4] += in[28+i][n][1];
-            }
-        }
-        for (i = 0; i < 59; i++) {
-            for (n = 0; n < len; n++) {
-                out[0][n][i+5] = in[i+32][n][0];
-                out[1][n][i+5] = in[i+32][n][1];
-            }
-        }
-    } else {
-        for (n = 0; n < len; n++) {
-            out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] +
-                           in[3][n][0] + in[4][n][0] + in[5][n][0];
-            out[1][n][0] = in[0][n][1] + in[1][n][1] + in[2][n][1] +
-                           in[3][n][1] + in[4][n][1] + in[5][n][1];
-            out[0][n][1] = in[6][n][0] + in[7][n][0];
-            out[1][n][1] = in[6][n][1] + in[7][n][1];
-            out[0][n][2] = in[8][n][0] + in[9][n][0];
-            out[1][n][2] = in[8][n][1] + in[9][n][1];
-        }
-        for (i = 0; i < 61; i++) {
-            for (n = 0; n < len; n++) {
-                out[0][n][i+3] = in[i+10][n][0];
-                out[1][n][i+3] = in[i+10][n][1];
-            }
-        }
-    }
-}
-
-/// All-pass filter decay slope
-#define DECAY_SLOPE      0.05f
-/// Number of frequency bands that can be addressed by the parameter index, b(k)
-static const int   NR_PAR_BANDS[]      = { 20, 34 };
-/// Number of frequency bands that can be addressed by the sub subband index, k
-static const int   NR_BANDS[]          = { 71, 91 };
-/// Start frequency band for the all-pass filter decay slope
-static const int   DECAY_CUTOFF[]      = { 10, 32 };
-/// Number of all-pass filer bands
-static const int   NR_ALLPASS_BANDS[]  = { 30, 50 };
-/// First stereo band using the short one sample delay
-static const int   SHORT_DELAY_BAND[]  = { 42, 62 };
-
-/** Table 8.46 */
-static void map_idx_10_to_20(int8_t *par_mapped, const int8_t *par, int full)
-{
-    int b;
-    if (full)
-        b = 9;
-    else {
-        b = 4;
-        par_mapped[10] = 0;
-    }
-    for (; b >= 0; b--) {
-        par_mapped[2*b+1] = par_mapped[2*b] = par[b];
-    }
-}
-
-static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
-{
-    par_mapped[ 0] = (2*par[ 0] +   par[ 1]) / 3;
-    par_mapped[ 1] = (  par[ 1] + 2*par[ 2]) / 3;
-    par_mapped[ 2] = (2*par[ 3] +   par[ 4]) / 3;
-    par_mapped[ 3] = (  par[ 4] + 2*par[ 5]) / 3;
-    par_mapped[ 4] = (  par[ 6] +   par[ 7]) / 2;
-    par_mapped[ 5] = (  par[ 8] +   par[ 9]) / 2;
-    par_mapped[ 6] =    par[10];
-    par_mapped[ 7] =    par[11];
-    par_mapped[ 8] = (  par[12] +   par[13]) / 2;
-    par_mapped[ 9] = (  par[14] +   par[15]) / 2;
-    par_mapped[10] =    par[16];
-    if (full) {
-        par_mapped[11] =    par[17];
-        par_mapped[12] =    par[18];
-        par_mapped[13] =    par[19];
-        par_mapped[14] = (  par[20] +   par[21]) / 2;
-        par_mapped[15] = (  par[22] +   par[23]) / 2;
-        par_mapped[16] = (  par[24] +   par[25]) / 2;
-        par_mapped[17] = (  par[26] +   par[27]) / 2;
-        par_mapped[18] = (  par[28] +   par[29] +   par[30] +   par[31]) / 4;
-        par_mapped[19] = (  par[32] +   par[33]) / 2;
-    }
-}
-
-static void map_val_34_to_20(float par[PS_MAX_NR_IIDICC])
-{
-    par[ 0] = (2*par[ 0] +   par[ 1]) * 0.33333333f;
-    par[ 1] = (  par[ 1] + 2*par[ 2]) * 0.33333333f;
-    par[ 2] = (2*par[ 3] +   par[ 4]) * 0.33333333f;
-    par[ 3] = (  par[ 4] + 2*par[ 5]) * 0.33333333f;
-    par[ 4] = (  par[ 6] +   par[ 7]) * 0.5f;
-    par[ 5] = (  par[ 8] +   par[ 9]) * 0.5f;
-    par[ 6] =    par[10];
-    par[ 7] =    par[11];
-    par[ 8] = (  par[12] +   par[13]) * 0.5f;
-    par[ 9] = (  par[14] +   par[15]) * 0.5f;
-    par[10] =    par[16];
-    par[11] =    par[17];
-    par[12] =    par[18];
-    par[13] =    par[19];
-    par[14] = (  par[20] +   par[21]) * 0.5f;
-    par[15] = (  par[22] +   par[23]) * 0.5f;
-    par[16] = (  par[24] +   par[25]) * 0.5f;
-    par[17] = (  par[26] +   par[27]) * 0.5f;
-    par[18] = (  par[28] +   par[29] +   par[30] +   par[31]) * 0.25f;
-    par[19] = (  par[32] +   par[33]) * 0.5f;
-}
-
-static void map_idx_10_to_34(int8_t *par_mapped, const int8_t *par, int full)
-{
-    if (full) {
-        par_mapped[33] = par[9];
-        par_mapped[32] = par[9];
-        par_mapped[31] = par[9];
-        par_mapped[30] = par[9];
-        par_mapped[29] = par[9];
-        par_mapped[28] = par[9];
-        par_mapped[27] = par[8];
-        par_mapped[26] = par[8];
-        par_mapped[25] = par[8];
-        par_mapped[24] = par[8];
-        par_mapped[23] = par[7];
-        par_mapped[22] = par[7];
-        par_mapped[21] = par[7];
-        par_mapped[20] = par[7];
-        par_mapped[19] = par[6];
-        par_mapped[18] = par[6];
-        par_mapped[17] = par[5];
-        par_mapped[16] = par[5];
-    } else {
-        par_mapped[16] =      0;
-    }
-    par_mapped[15] = par[4];
-    par_mapped[14] = par[4];
-    par_mapped[13] = par[4];
-    par_mapped[12] = par[4];
-    par_mapped[11] = par[3];
-    par_mapped[10] = par[3];
-    par_mapped[ 9] = par[2];
-    par_mapped[ 8] = par[2];
-    par_mapped[ 7] = par[2];
-    par_mapped[ 6] = par[2];
-    par_mapped[ 5] = par[1];
-    par_mapped[ 4] = par[1];
-    par_mapped[ 3] = par[1];
-    par_mapped[ 2] = par[0];
-    par_mapped[ 1] = par[0];
-    par_mapped[ 0] = par[0];
-}
-
-static void map_idx_20_to_34(int8_t *par_mapped, const int8_t *par, int full)
-{
-    if (full) {
-        par_mapped[33] =  par[19];
-        par_mapped[32] =  par[19];
-        par_mapped[31] =  par[18];
-        par_mapped[30] =  par[18];
-        par_mapped[29] =  par[18];
-        par_mapped[28] =  par[18];
-        par_mapped[27] =  par[17];
-        par_mapped[26] =  par[17];
-        par_mapped[25] =  par[16];
-        par_mapped[24] =  par[16];
-        par_mapped[23] =  par[15];
-        par_mapped[22] =  par[15];
-        par_mapped[21] =  par[14];
-        par_mapped[20] =  par[14];
-        par_mapped[19] =  par[13];
-        par_mapped[18] =  par[12];
-        par_mapped[17] =  par[11];
-    }
-    par_mapped[16] =  par[10];
-    par_mapped[15] =  par[ 9];
-    par_mapped[14] =  par[ 9];
-    par_mapped[13] =  par[ 8];
-    par_mapped[12] =  par[ 8];
-    par_mapped[11] =  par[ 7];
-    par_mapped[10] =  par[ 6];
-    par_mapped[ 9] =  par[ 5];
-    par_mapped[ 8] =  par[ 5];
-    par_mapped[ 7] =  par[ 4];
-    par_mapped[ 6] =  par[ 4];
-    par_mapped[ 5] =  par[ 3];
-    par_mapped[ 4] = (par[ 2] + par[ 3]) / 2;
-    par_mapped[ 3] =  par[ 2];
-    par_mapped[ 2] =  par[ 1];
-    par_mapped[ 1] = (par[ 0] + par[ 1]) / 2;
-    par_mapped[ 0] =  par[ 0];
-}
-
-static void map_val_20_to_34(float par[PS_MAX_NR_IIDICC])
-{
-    par[33] =  par[19];
-    par[32] =  par[19];
-    par[31] =  par[18];
-    par[30] =  par[18];
-    par[29] =  par[18];
-    par[28] =  par[18];
-    par[27] =  par[17];
-    par[26] =  par[17];
-    par[25] =  par[16];
-    par[24] =  par[16];
-    par[23] =  par[15];
-    par[22] =  par[15];
-    par[21] =  par[14];
-    par[20] =  par[14];
-    par[19] =  par[13];
-    par[18] =  par[12];
-    par[17] =  par[11];
-    par[16] =  par[10];
-    par[15] =  par[ 9];
-    par[14] =  par[ 9];
-    par[13] =  par[ 8];
-    par[12] =  par[ 8];
-    par[11] =  par[ 7];
-    par[10] =  par[ 6];
-    par[ 9] =  par[ 5];
-    par[ 8] =  par[ 5];
-    par[ 7] =  par[ 4];
-    par[ 6] =  par[ 4];
-    par[ 5] =  par[ 3];
-    par[ 4] = (par[ 2] + par[ 3]) * 0.5f;
-    par[ 3] =  par[ 2];
-    par[ 2] =  par[ 1];
-    par[ 1] = (par[ 0] + par[ 1]) * 0.5f;
-    par[ 0] =  par[ 0];
-}
-
-static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[32][2], int is34)
-{
-    float power[34][PS_QMF_TIME_SLOTS] = {{0}};
-    float transient_gain[34][PS_QMF_TIME_SLOTS];
-    float *peak_decay_nrg = ps->peak_decay_nrg;
-    float *power_smooth = ps->power_smooth;
-    float *peak_decay_diff_smooth = ps->peak_decay_diff_smooth;
-    float (*delay)[PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2] = ps->delay;
-    float (*ap_delay)[PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2] = ps->ap_delay;
-    const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;
-    const float peak_decay_factor = 0.76592833836465f;
-    const float transient_impact  = 1.5f;
-    const float a_smooth          = 0.25f; //< Smoothing coefficient
-    int i, k, m, n;
-    int n0 = 0, nL = 32;
-    static const int link_delay[] = { 3, 4, 5 };
-    static const float a[] = { 0.65143905753106f,
-                               0.56471812200776f,
-                               0.48954165955695f };
-
-    if (is34 != ps->is34bands_old) {
-        memset(ps->peak_decay_nrg,         0, sizeof(ps->peak_decay_nrg));
-        memset(ps->power_smooth,           0, sizeof(ps->power_smooth));
-        memset(ps->peak_decay_diff_smooth, 0, sizeof(ps->peak_decay_diff_smooth));
-        memset(ps->delay,                  0, sizeof(ps->delay));
-        memset(ps->ap_delay,               0, sizeof(ps->ap_delay));
-    }
-
-    for (n = n0; n < nL; n++) {
-        for (k = 0; k < NR_BANDS[is34]; k++) {
-            int i = k_to_i[k];
-            power[i][n] += s[k][n][0] * s[k][n][0] + s[k][n][1] * s[k][n][1];
-        }
-    }
-
-    //Transient detection
-    for (i = 0; i < NR_PAR_BANDS[is34]; i++) {
-        for (n = n0; n < nL; n++) {
-            float decayed_peak = peak_decay_factor * peak_decay_nrg[i];
-            float denom;
-            peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]);
-            power_smooth[i] += a_smooth * (power[i][n] - power_smooth[i]);
-            peak_decay_diff_smooth[i] += a_smooth * (peak_decay_nrg[i] - power[i][n] - peak_decay_diff_smooth[i]);
-            denom = transient_impact * peak_decay_diff_smooth[i];
-            transient_gain[i][n]   = (denom > power_smooth[i]) ?
-                                         power_smooth[i] / denom : 1.0f;
-        }
-    }
-
-    //Decorrelation and transient reduction
-    //                         PS_AP_LINKS - 1
-    //                               -----
-    //                                | |  Q_fract_allpass[k][m]*z^-link_delay[m] - a[m]*g_decay_slope[k]
-    //H[k][z] = z^-2 * phi_fract[k] * | | ----------------------------------------------------------------
-    //                                | | 1 - a[m]*g_decay_slope[k]*Q_fract_allpass[k][m]*z^-link_delay[m]
-    //                               m = 0
-    //d[k][z] (out) = transient_gain_mapped[k][z] * H[k][z] * s[k][z]
-    for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) {
-        int b = k_to_i[k];
-        float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
-        float ag[PS_AP_LINKS];
-        g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f);
-        memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
-        memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
-        for (m = 0; m < PS_AP_LINKS; m++) {
-            memcpy(ap_delay[k][m],   ap_delay[k][m]+numQMFSlots,           5*sizeof(ap_delay[k][m][0]));
-            ag[m] = a[m] * g_decay_slope;
-        }
-        for (n = n0; n < nL; n++) {
-            float in_re = delay[k][n+PS_MAX_DELAY-2][0] * phi_fract[is34][k][0] -
-                          delay[k][n+PS_MAX_DELAY-2][1] * phi_fract[is34][k][1];
-            float in_im = delay[k][n+PS_MAX_DELAY-2][0] * phi_fract[is34][k][1] +
-                          delay[k][n+PS_MAX_DELAY-2][1] * phi_fract[is34][k][0];
-            for (m = 0; m < PS_AP_LINKS; m++) {
-                float a_re                = ag[m] * in_re;
-                float a_im                = ag[m] * in_im;
-                float link_delay_re       = ap_delay[k][m][n+5-link_delay[m]][0];
-                float link_delay_im       = ap_delay[k][m][n+5-link_delay[m]][1];
-                float fractional_delay_re = Q_fract_allpass[is34][k][m][0];
-                float fractional_delay_im = Q_fract_allpass[is34][k][m][1];
-                ap_delay[k][m][n+5][0] = in_re;
-                ap_delay[k][m][n+5][1] = in_im;
-                in_re = link_delay_re * fractional_delay_re - link_delay_im * fractional_delay_im - a_re;
-                in_im = link_delay_re * fractional_delay_im + link_delay_im * fractional_delay_re - a_im;
-                ap_delay[k][m][n+5][0] += ag[m] * in_re;
-                ap_delay[k][m][n+5][1] += ag[m] * in_im;
-            }
-            out[k][n][0] = transient_gain[b][n] * in_re;
-            out[k][n][1] = transient_gain[b][n] * in_im;
-        }
-    }
-    for (; k < SHORT_DELAY_BAND[is34]; k++) {
-        memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
-        memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
-        for (n = n0; n < nL; n++) {
-            //H = delay 14
-            out[k][n][0] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-14][0];
-            out[k][n][1] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-14][1];
-        }
-    }
-    for (; k < NR_BANDS[is34]; k++) {
-        memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
-        memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
-        for (n = n0; n < nL; n++) {
-            //H = delay 1
-            out[k][n][0] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-1][0];
-            out[k][n][1] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-1][1];
-        }
-    }
-}
-
-static void remap34(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
-                    int8_t           (*par)[PS_MAX_NR_IIDICC],
-                    int num_par, int num_env, int full)
-{
-    int8_t (*par_mapped)[PS_MAX_NR_IIDICC] = *p_par_mapped;
-    int e;
-    if (num_par == 20 || num_par == 11) {
-        for (e = 0; e < num_env; e++) {
-            map_idx_20_to_34(par_mapped[e], par[e], full);
-        }
-    } else if (num_par == 10 || num_par == 5) {
-        for (e = 0; e < num_env; e++) {
-            map_idx_10_to_34(par_mapped[e], par[e], full);
-        }
-    } else {
-        *p_par_mapped = par;
-    }
-}
-
-static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
-                    int8_t           (*par)[PS_MAX_NR_IIDICC],
-                    int num_par, int num_env, int full)
-{
-    int8_t (*par_mapped)[PS_MAX_NR_IIDICC] = *p_par_mapped;
-    int e;
-    if (num_par == 34 || num_par == 17) {
-        for (e = 0; e < num_env; e++) {
-            map_idx_34_to_20(par_mapped[e], par[e], full);
-        }
-    } else if (num_par == 10 || num_par == 5) {
-        for (e = 0; e < num_env; e++) {
-            map_idx_10_to_20(par_mapped[e], par[e], full);
-        }
-    } else {
-        *p_par_mapped = par;
-    }
-}
-
-static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)
-{
-    int e, b, k, n;
-
-    float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;
-    float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;
-    float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;
-    float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;
-    int8_t *opd_hist = ps->opd_hist;
-    int8_t *ipd_hist = ps->ipd_hist;
-    int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
-    int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
-    int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
-    int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
-    int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;
-    int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;
-    int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
-    int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;
-    const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;
-    const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;
-
-    //Remapping
-    memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));
-    memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));
-    memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));
-    memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));
-    memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));
-    memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));
-    memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));
-    memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));
-    if (is34) {
-        remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
-        remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
-        if (ps->enable_ipdopd) {
-            remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
-            remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
-        }
-        if (!ps->is34bands_old) {
-            map_val_20_to_34(H11[0][0]);
-            map_val_20_to_34(H11[1][0]);
-            map_val_20_to_34(H12[0][0]);
-            map_val_20_to_34(H12[1][0]);
-            map_val_20_to_34(H21[0][0]);
-            map_val_20_to_34(H21[1][0]);
-            map_val_20_to_34(H22[0][0]);
-            map_val_20_to_34(H22[1][0]);
-            ipdopd_reset(ipd_hist, opd_hist);
-        }
-    } else {
-        remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
-        remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
-        if (ps->enable_ipdopd) {
-            remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
-            remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
-        }
-        if (ps->is34bands_old) {
-            map_val_34_to_20(H11[0][0]);
-            map_val_34_to_20(H11[1][0]);
-            map_val_34_to_20(H12[0][0]);
-            map_val_34_to_20(H12[1][0]);
-            map_val_34_to_20(H21[0][0]);
-            map_val_34_to_20(H21[1][0]);
-            map_val_34_to_20(H22[0][0]);
-            map_val_34_to_20(H22[1][0]);
-            ipdopd_reset(ipd_hist, opd_hist);
-        }
-    }
-
-    //Mixing
-    for (e = 0; e < ps->num_env; e++) {
-        for (b = 0; b < NR_PAR_BANDS[is34]; b++) {
-            float h11, h12, h21, h22;
-            h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0];
-            h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];
-            h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];
-            h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];
-            if (!PS_BASELINE && ps->enable_ipdopd && b < ps->nr_ipdopd_par) {
-                //The spec say says to only run this smoother when enable_ipdopd
-                //is set but the reference decoder appears to run it constantly
-                float h11i, h12i, h21i, h22i;
-                float ipd_adj_re, ipd_adj_im;
-                int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];
-                int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];
-                float opd_re = pd_re_smooth[opd_idx];
-                float opd_im = pd_im_smooth[opd_idx];
-                float ipd_re = pd_re_smooth[ipd_idx];
-                float ipd_im = pd_im_smooth[ipd_idx];
-                opd_hist[b] = opd_idx & 0x3F;
-                ipd_hist[b] = ipd_idx & 0x3F;
-
-                ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;
-                ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;
-                h11i = h11 * opd_im;
-                h11  = h11 * opd_re;
-                h12i = h12 * ipd_adj_im;
-                h12  = h12 * ipd_adj_re;
-                h21i = h21 * opd_im;
-                h21  = h21 * opd_re;
-                h22i = h22 * ipd_adj_im;
-                h22  = h22 * ipd_adj_re;
-                H11[1][e+1][b] = h11i;
-                H12[1][e+1][b] = h12i;
-                H21[1][e+1][b] = h21i;
-                H22[1][e+1][b] = h22i;
-            }
-            H11[0][e+1][b] = h11;
-            H12[0][e+1][b] = h12;
-            H21[0][e+1][b] = h21;
-            H22[0][e+1][b] = h22;
-        }
-        for (k = 0; k < NR_BANDS[is34]; k++) {
-            float h11r, h12r, h21r, h22r;
-            float h11i, h12i, h21i, h22i;
-            float h11r_step, h12r_step, h21r_step, h22r_step;
-            float h11i_step, h12i_step, h21i_step, h22i_step;
-            int start = ps->border_position[e];
-            int stop  = ps->border_position[e+1];
-            float width = 1.f / (stop - start);
-            b = k_to_i[k];
-            h11r = H11[0][e][b];
-            h12r = H12[0][e][b];
-            h21r = H21[0][e][b];
-            h22r = H22[0][e][b];
-            if (!PS_BASELINE && ps->enable_ipdopd) {
-            //Is this necessary? ps_04_new seems unchanged
-            if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
-                h11i = -H11[1][e][b];
-                h12i = -H12[1][e][b];
-                h21i = -H21[1][e][b];
-                h22i = -H22[1][e][b];
-            } else {
-                h11i = H11[1][e][b];
-                h12i = H12[1][e][b];
-                h21i = H21[1][e][b];
-                h22i = H22[1][e][b];
-            }
-            }
-            //Interpolation
-            h11r_step = (H11[0][e+1][b] - h11r) * width;
-            h12r_step = (H12[0][e+1][b] - h12r) * width;
-            h21r_step = (H21[0][e+1][b] - h21r) * width;
-            h22r_step = (H22[0][e+1][b] - h22r) * width;
-            if (!PS_BASELINE && ps->enable_ipdopd) {
-                h11i_step = (H11[1][e+1][b] - h11i) * width;
-                h12i_step = (H12[1][e+1][b] - h12i) * width;
-                h21i_step = (H21[1][e+1][b] - h21i) * width;
-                h22i_step = (H22[1][e+1][b] - h22i) * width;
-            }
-            for (n = start + 1; n <= stop; n++) {
-                //l is s, r is d
-                float l_re = l[k][n][0];
-                float l_im = l[k][n][1];
-                float r_re = r[k][n][0];
-                float r_im = r[k][n][1];
-                h11r += h11r_step;
-                h12r += h12r_step;
-                h21r += h21r_step;
-                h22r += h22r_step;
-                if (!PS_BASELINE && ps->enable_ipdopd) {
-                    h11i += h11i_step;
-                    h12i += h12i_step;
-                    h21i += h21i_step;
-                    h22i += h22i_step;
-
-                    l[k][n][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;
-                    l[k][n][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;
-                    r[k][n][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;
-                    r[k][n][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;
-                } else {
-                    l[k][n][0] = h11r*l_re + h21r*r_re;
-                    l[k][n][1] = h11r*l_im + h21r*r_im;
-                    r[k][n][0] = h12r*l_re + h22r*r_re;
-                    r[k][n][1] = h12r*l_im + h22r*r_im;
-                }
-            }
-        }
-    }
-}
-
-int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top)
-{
-    float Lbuf[91][32][2];
-    float Rbuf[91][32][2];
-    const int len = 32;
-    int is34 = ps->is34bands;
-
-    top += NR_BANDS[is34] - 64;
-    memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*sizeof(ps->delay[0]));
-    if (top < NR_ALLPASS_BANDS[is34])
-        memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0]));
-
-    hybrid_analysis(Lbuf, ps->in_buf, L, is34, len);
-    decorrelation(ps, Rbuf, Lbuf, is34);
-    stereo_processing(ps, Lbuf, Rbuf, is34);
-    hybrid_synthesis(L, Lbuf, is34, len);
-    hybrid_synthesis(R, Rbuf, is34, len);
-
-    return 0;
-}
-
-#define PS_INIT_VLC_STATIC(num, size) \
-    INIT_VLC_STATIC(&vlc_ps[num], 9, ps_tmp[num].table_size / ps_tmp[num].elem_size,    \
-                    ps_tmp[num].ps_bits, 1, 1,                                          \
-                    ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \
-                    size);
-
-#define PS_VLC_ROW(name) \
-    { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
-
-av_cold void ff_ps_init(void) {
-    // Syntax initialization
-    static const struct {
-        const void *ps_codes, *ps_bits;
-        const unsigned int table_size, elem_size;
-    } ps_tmp[] = {
-        PS_VLC_ROW(huff_iid_df1),
-        PS_VLC_ROW(huff_iid_dt1),
-        PS_VLC_ROW(huff_iid_df0),
-        PS_VLC_ROW(huff_iid_dt0),
-        PS_VLC_ROW(huff_icc_df),
-        PS_VLC_ROW(huff_icc_dt),
-        PS_VLC_ROW(huff_ipd_df),
-        PS_VLC_ROW(huff_ipd_dt),
-        PS_VLC_ROW(huff_opd_df),
-        PS_VLC_ROW(huff_opd_dt),
-    };
-
-    PS_INIT_VLC_STATIC(0, 1544);
-    PS_INIT_VLC_STATIC(1,  832);
-    PS_INIT_VLC_STATIC(2, 1024);
-    PS_INIT_VLC_STATIC(3, 1036);
-    PS_INIT_VLC_STATIC(4,  544);
-    PS_INIT_VLC_STATIC(5,  544);
-    PS_INIT_VLC_STATIC(6,  512);
-    PS_INIT_VLC_STATIC(7,  512);
-    PS_INIT_VLC_STATIC(8,  512);
-    PS_INIT_VLC_STATIC(9,  512);
-
-    ps_tableinit();
-}
-
-av_cold void ff_ps_ctx_init(PSContext *ps)
-{
-}
diff --git a/libavcodec/aacps.h b/libavcodec/aacps.h
deleted file mode 100644
index 5fc211a..0000000
--- a/libavcodec/aacps.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * MPEG-4 Parametric Stereo definitions and declarations
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PS_H
-#define AVCODEC_PS_H
-
-#include <stdint.h>
-
-#include "avcodec.h"
-#include "get_bits.h"
-
-#define PS_MAX_NUM_ENV 5
-#define PS_MAX_NR_IIDICC 34
-#define PS_MAX_NR_IPDOPD 17
-#define PS_MAX_SSB 91
-#define PS_MAX_AP_BANDS 50
-#define PS_QMF_TIME_SLOTS 32
-#define PS_MAX_DELAY 14
-#define PS_AP_LINKS 3
-#define PS_MAX_AP_DELAY 5
-
-typedef struct {
-    int    start;
-    int    enable_iid;
-    int    iid_quant;
-    int    nr_iid_par;
-    int    nr_ipdopd_par;
-    int    enable_icc;
-    int    icc_mode;
-    int    nr_icc_par;
-    int    enable_ext;
-    int    frame_class;
-    int    num_env_old;
-    int    num_env;
-    int    enable_ipdopd;
-    int    border_position[PS_MAX_NUM_ENV+1];
-    int8_t iid_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-channel Intensity Difference Parameters
-    int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-Channel Coherence Parameters
-    /* ipd/opd is iid/icc sized so that the same functions can handle both */
-    int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-channel Phase Difference Parameters
-    int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Overall Phase Difference Parameters
-    int    is34bands;
-    int    is34bands_old;
-
-    float  in_buf[5][44][2];
-    float  delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2];
-    float  ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2];
-    float  peak_decay_nrg[34];
-    float  power_smooth[34];
-    float  peak_decay_diff_smooth[34];
-    float  H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
-    float  H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
-    float  H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
-    float  H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
-    int8_t opd_hist[PS_MAX_NR_IIDICC];
-    int8_t ipd_hist[PS_MAX_NR_IIDICC];
-} PSContext;
-
-void ff_ps_init(void);
-void ff_ps_ctx_init(PSContext *ps);
-int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int bits_left);
-int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top);
-
-#endif /* AVCODEC_PS_H */
diff --git a/libavcodec/aacps_tablegen.c b/libavcodec/aacps_tablegen.c
deleted file mode 100644
index dc7797f..0000000
--- a/libavcodec/aacps_tablegen.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Generate a header file for hardcoded Parametric Stereo tables
- *
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#include "aacps_tablegen.h"
-#include "tableprint.h"
-
-void write_float_3d_array (const void *p, int b, int c, int d)
-{
-    int i;
-    const float *f = p;
-    for (i = 0; i < b; i++) {
-        printf("{\n");
-        write_float_2d_array(f, c, d);
-        printf("},\n");
-        f += c * d;
-    }
-}
-
-void write_float_4d_array (const void *p, int a, int b, int c, int d)
-{
-    int i;
-    const float *f = p;
-    for (i = 0; i < a; i++) {
-        printf("{\n");
-        write_float_3d_array(f, b, c, d);
-        printf("},\n");
-        f += b * c * d;
-    }
-}
-
-int main(void)
-{
-    ps_tableinit();
-
-    write_fileheader();
-
-    printf("static const float pd_re_smooth[8*8*8] = {\n");
-    write_float_array(pd_re_smooth, 8*8*8);
-    printf("};\n");
-    printf("static const float pd_im_smooth[8*8*8] = {\n");
-    write_float_array(pd_im_smooth, 8*8*8);
-    printf("};\n");
-
-    printf("static const float HA[46][8][4] = {\n");
-    write_float_3d_array(HA, 46, 8, 4);
-    printf("};\n");
-    printf("static const float HB[46][8][4] = {\n");
-    write_float_3d_array(HB, 46, 8, 4);
-    printf("};\n");
-
-    printf("static const float f20_0_8[8][7][2] = {\n");
-    write_float_3d_array(f20_0_8, 8, 7, 2);
-    printf("};\n");
-    printf("static const float f34_0_12[12][7][2] = {\n");
-    write_float_3d_array(f34_0_12, 12, 7, 2);
-    printf("};\n");
-    printf("static const float f34_1_8[8][7][2] = {\n");
-    write_float_3d_array(f34_1_8, 8, 7, 2);
-    printf("};\n");
-    printf("static const float f34_2_4[4][7][2] = {\n");
-    write_float_3d_array(f34_2_4, 4, 7, 2);
-    printf("};\n");
-
-    printf("static const float Q_fract_allpass[2][50][3][2] = {\n");
-    write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2);
-    printf("};\n");
-    printf("static const float phi_fract[2][50][2] = {\n");
-    write_float_3d_array(phi_fract, 2, 50, 2);
-    printf("};\n");
-
-    return 0;
-}
diff --git a/libavcodec/aacps_tablegen.h b/libavcodec/aacps_tablegen.h
deleted file mode 100644
index 3c1b27d..0000000
--- a/libavcodec/aacps_tablegen.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Header file for hardcoded Parametric Stereo tables
- *
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AACPS_TABLEGEN_H
-#define AACPS_TABLEGEN_H
-
-#include <stdint.h>
-
-#if CONFIG_HARDCODED_TABLES
-#define ps_tableinit()
-#include "libavcodec/aacps_tables.h"
-#else
-#include "../libavutil/common.h"
-#include "../libavutil/mathematics.h"
-#define NR_ALLPASS_BANDS20 30
-#define NR_ALLPASS_BANDS34 50
-#define PS_AP_LINKS 3
-static float pd_re_smooth[8*8*8];
-static float pd_im_smooth[8*8*8];
-static float HA[46][8][4];
-static float HB[46][8][4];
-static float f20_0_8 [ 8][7][2];
-static float f34_0_12[12][7][2];
-static float f34_1_8 [ 8][7][2];
-static float f34_2_4 [ 4][7][2];
-static float Q_fract_allpass[2][50][3][2];
-static float phi_fract[2][50][2];
-
-static const float g0_Q8[] = {
-    0.00746082949812f, 0.02270420949825f, 0.04546865930473f, 0.07266113929591f,
-    0.09885108575264f, 0.11793710567217f, 0.125f
-};
-
-static const float g0_Q12[] = {
-    0.04081179924692f, 0.03812810994926f, 0.05144908135699f, 0.06399831151592f,
-    0.07428313801106f, 0.08100347892914f, 0.08333333333333f
-};
-
-static const float g1_Q8[] = {
-    0.01565675600122f, 0.03752716391991f, 0.05417891378782f, 0.08417044116767f,
-    0.10307344158036f, 0.12222452249753f, 0.125f
-};
-
-static const float g2_Q4[] = {
-    -0.05908211155639f, -0.04871498374946f, 0.0f,   0.07778723915851f,
-     0.16486303567403f,  0.23279856662996f, 0.25f
-};
-
-static void make_filters_from_proto(float (*filter)[7][2], const float *proto, int bands)
-{
-    int q, n;
-    for (q = 0; q < bands; q++) {
-        for (n = 0; n < 7; n++) {
-            double theta = 2 * M_PI * (q + 0.5) * (n - 6) / bands;
-            filter[q][n][0] = proto[n] *  cos(theta);
-            filter[q][n][1] = proto[n] * -sin(theta);
-        }
-    }
-}
-
-static void ps_tableinit(void)
-{
-    static const float ipdopd_sin[] = { 0, M_SQRT1_2, 1,  M_SQRT1_2,  0, -M_SQRT1_2, -1, -M_SQRT1_2 };
-    static const float ipdopd_cos[] = { 1, M_SQRT1_2, 0, -M_SQRT1_2, -1, -M_SQRT1_2,  0,  M_SQRT1_2 };
-    int pd0, pd1, pd2;
-
-    static const float iid_par_dequant[] = {
-        //iid_par_dequant_default
-        0.05623413251903, 0.12589254117942, 0.19952623149689, 0.31622776601684,
-        0.44668359215096, 0.63095734448019, 0.79432823472428, 1,
-        1.25892541179417, 1.58489319246111, 2.23872113856834, 3.16227766016838,
-        5.01187233627272, 7.94328234724282, 17.7827941003892,
-        //iid_par_dequant_fine
-        0.00316227766017, 0.00562341325190, 0.01,             0.01778279410039,
-        0.03162277660168, 0.05623413251903, 0.07943282347243, 0.11220184543020,
-        0.15848931924611, 0.22387211385683, 0.31622776601684, 0.39810717055350,
-        0.50118723362727, 0.63095734448019, 0.79432823472428, 1,
-        1.25892541179417, 1.58489319246111, 1.99526231496888, 2.51188643150958,
-        3.16227766016838, 4.46683592150963, 6.30957344480193, 8.91250938133745,
-        12.5892541179417, 17.7827941003892, 31.6227766016838, 56.2341325190349,
-        100,              177.827941003892, 316.227766016837,
-    };
-    static const float icc_invq[] = {
-        1, 0.937,      0.84118,    0.60092,    0.36764,   0,      -0.589,    -1
-    };
-    static const float acos_icc_invq[] = {
-        0, 0.35685527, 0.57133466, 0.92614472, 1.1943263, M_PI/2, 2.2006171, M_PI
-    };
-    int iid, icc;
-
-    int k, m;
-    static const int8_t f_center_20[] = {
-        -3, -1, 1, 3, 5, 7, 10, 14, 18, 22,
-    };
-    static const int8_t f_center_34[] = {
-         2,  6, 10, 14, 18, 22, 26, 30,
-        34,-10, -6, -2, 51, 57, 15, 21,
-        27, 33, 39, 45, 54, 66, 78, 42,
-       102, 66, 78, 90,102,114,126, 90,
-    };
-    static const float fractional_delay_links[] = { 0.43f, 0.75f, 0.347f };
-    const float fractional_delay_gain = 0.39f;
-
-    for (pd0 = 0; pd0 < 8; pd0++) {
-        float pd0_re = ipdopd_cos[pd0];
-        float pd0_im = ipdopd_sin[pd0];
-        for (pd1 = 0; pd1 < 8; pd1++) {
-            float pd1_re = ipdopd_cos[pd1];
-            float pd1_im = ipdopd_sin[pd1];
-            for (pd2 = 0; pd2 < 8; pd2++) {
-                float pd2_re = ipdopd_cos[pd2];
-                float pd2_im = ipdopd_sin[pd2];
-                float re_smooth = 0.25f * pd0_re + 0.5f * pd1_re + pd2_re;
-                float im_smooth = 0.25f * pd0_im + 0.5f * pd1_im + pd2_im;
-                float pd_mag = 1 / sqrt(im_smooth * im_smooth + re_smooth * re_smooth);
-                pd_re_smooth[pd0*64+pd1*8+pd2] = re_smooth * pd_mag;
-                pd_im_smooth[pd0*64+pd1*8+pd2] = im_smooth * pd_mag;
-            }
-        }
-    }
-
-    for (iid = 0; iid < 46; iid++) {
-        float c = iid_par_dequant[iid]; //<Linear Inter-channel Intensity Difference
-        float c1 = (float)M_SQRT2 / sqrtf(1.0f + c*c);
-        float c2 = c * c1;
-        for (icc = 0; icc < 8; icc++) {
-            /*if (PS_BASELINE || ps->icc_mode < 3)*/ {
-                float alpha = 0.5f * acos_icc_invq[icc];
-                float beta  = alpha * (c1 - c2) * (float)M_SQRT1_2;
-                HA[iid][icc][0] = c2 * cosf(beta + alpha);
-                HA[iid][icc][1] = c1 * cosf(beta - alpha);
-                HA[iid][icc][2] = c2 * sinf(beta + alpha);
-                HA[iid][icc][3] = c1 * sinf(beta - alpha);
-            } /* else */ {
-                float alpha, gamma, mu, rho;
-                float alpha_c, alpha_s, gamma_c, gamma_s;
-                rho = FFMAX(icc_invq[icc], 0.05f);
-                alpha = 0.5f * atan2f(2.0f * c * rho, c*c - 1.0f);
-                mu = c + 1.0f / c;
-                mu = sqrtf(1 + (4 * rho * rho - 4)/(mu * mu));
-                gamma = atanf(sqrtf((1.0f - mu)/(1.0f + mu)));
-                if (alpha < 0) alpha += M_PI/2;
-                alpha_c = cosf(alpha);
-                alpha_s = sinf(alpha);
-                gamma_c = cosf(gamma);
-                gamma_s = sinf(gamma);
-                HB[iid][icc][0] =  M_SQRT2 * alpha_c * gamma_c;
-                HB[iid][icc][1] =  M_SQRT2 * alpha_s * gamma_c;
-                HB[iid][icc][2] = -M_SQRT2 * alpha_s * gamma_s;
-                HB[iid][icc][3] =  M_SQRT2 * alpha_c * gamma_s;
-            }
-        }
-    }
-
-    for (k = 0; k < NR_ALLPASS_BANDS20; k++) {
-        double f_center, theta;
-        if (k < FF_ARRAY_ELEMS(f_center_20))
-            f_center = f_center_20[k] * 0.125;
-        else
-            f_center = k - 6.5f;
-        for (m = 0; m < PS_AP_LINKS; m++) {
-            theta = -M_PI * fractional_delay_links[m] * f_center;
-            Q_fract_allpass[0][k][m][0] = cos(theta);
-            Q_fract_allpass[0][k][m][1] = sin(theta);
-        }
-        theta = -M_PI*fractional_delay_gain*f_center;
-        phi_fract[0][k][0] = cos(theta);
-        phi_fract[0][k][1] = sin(theta);
-    }
-    for (k = 0; k < NR_ALLPASS_BANDS34; k++) {
-        double f_center, theta;
-        if (k < FF_ARRAY_ELEMS(f_center_34))
-            f_center = f_center_34[k] / 24.;
-        else
-            f_center = k - 26.5f;
-        for (m = 0; m < PS_AP_LINKS; m++) {
-            theta = -M_PI * fractional_delay_links[m] * f_center;
-            Q_fract_allpass[1][k][m][0] = cos(theta);
-            Q_fract_allpass[1][k][m][1] = sin(theta);
-        }
-        theta = -M_PI*fractional_delay_gain*f_center;
-        phi_fract[1][k][0] = cos(theta);
-        phi_fract[1][k][1] = sin(theta);
-    }
-
-    make_filters_from_proto(f20_0_8,  g0_Q8,   8);
-    make_filters_from_proto(f34_0_12, g0_Q12, 12);
-    make_filters_from_proto(f34_1_8,  g1_Q8,   8);
-    make_filters_from_proto(f34_2_4,  g2_Q4,   4);
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* AACPS_TABLEGEN_H */
diff --git a/libavcodec/aacpsdata.c b/libavcodec/aacpsdata.c
deleted file mode 100644
index 7431cae..0000000
--- a/libavcodec/aacpsdata.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * MPEG-4 Parametric Stereo data tables
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-static const uint8_t huff_iid_df1_bits[] = {
-    18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 18, 17, 17, 16, 16, 15, 14, 14,
-    13, 12, 12, 11, 10, 10,  8,  7,  6,  5,  4,  3,  1,  3,  4,  5,  6,  7,
-     8,  9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16, 17, 17, 18, 17, 18, 18,
-    18, 18, 18, 18, 18, 18, 18,
-};
-
-static const uint32_t huff_iid_df1_codes[] = {
-    0x01FEB4, 0x01FEB5, 0x01FD76, 0x01FD77, 0x01FD74, 0x01FD75, 0x01FE8A,
-    0x01FE8B, 0x01FE88, 0x00FE80, 0x01FEB6, 0x00FE82, 0x00FEB8, 0x007F42,
-    0x007FAE, 0x003FAF, 0x001FD1, 0x001FE9, 0x000FE9, 0x0007EA, 0x0007FB,
-    0x0003FB, 0x0001FB, 0x0001FF, 0x00007C, 0x00003C, 0x00001C, 0x00000C,
-    0x000000, 0x000001, 0x000001, 0x000002, 0x000001, 0x00000D, 0x00001D,
-    0x00003D, 0x00007D, 0x0000FC, 0x0001FC, 0x0003FC, 0x0003F4, 0x0007EB,
-    0x000FEA, 0x001FEA, 0x001FD6, 0x003FD0, 0x007FAF, 0x007F43, 0x00FEB9,
-    0x00FE83, 0x01FEB7, 0x00FE81, 0x01FE89, 0x01FE8E, 0x01FE8F, 0x01FE8C,
-    0x01FE8D, 0x01FEB2, 0x01FEB3, 0x01FEB0, 0x01FEB1,
-};
-
-static const uint8_t huff_iid_dt1_bits[] = {
-    16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 13,
-    13, 13, 12, 12, 11, 10,  9,  9,  7,  6,  5,  3,  1,  2,  5,  6,  7,  8,
-     9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16,
-};
-
-static const uint16_t huff_iid_dt1_codes[] = {
-    0x004ED4, 0x004ED5, 0x004ECE, 0x004ECF, 0x004ECC, 0x004ED6, 0x004ED8,
-    0x004F46, 0x004F60, 0x002718, 0x002719, 0x002764, 0x002765, 0x00276D,
-    0x0027B1, 0x0013B7, 0x0013D6, 0x0009C7, 0x0009E9, 0x0009ED, 0x0004EE,
-    0x0004F7, 0x000278, 0x000139, 0x00009A, 0x00009F, 0x000020, 0x000011,
-    0x00000A, 0x000003, 0x000001, 0x000000, 0x00000B, 0x000012, 0x000021,
-    0x00004C, 0x00009B, 0x00013A, 0x000279, 0x000270, 0x0004EF, 0x0004E2,
-    0x0009EA, 0x0009D8, 0x0013D7, 0x0013D0, 0x0027B2, 0x0027A2, 0x00271A,
-    0x00271B, 0x004F66, 0x004F67, 0x004F61, 0x004F47, 0x004ED9, 0x004ED7,
-    0x004ECD, 0x004ED2, 0x004ED3, 0x004ED0, 0x004ED1,
-};
-
-static const uint8_t huff_iid_df0_bits[] = {
-    17, 17, 17, 17, 16, 15, 13, 10,  9,  7,  6,  5,  4,  3,  1,  3,  4,  5,
-     6,  6,  8, 11, 13, 14, 14, 15, 17, 18, 18,
-};
-
-static const uint32_t huff_iid_df0_codes[] = {
-    0x01FFFB, 0x01FFFC, 0x01FFFD, 0x01FFFA, 0x00FFFC, 0x007FFC, 0x001FFD,
-    0x0003FE, 0x0001FE, 0x00007E, 0x00003C, 0x00001D, 0x00000D, 0x000005,
-    0x000000, 0x000004, 0x00000C, 0x00001C, 0x00003D, 0x00003E, 0x0000FE,
-    0x0007FE, 0x001FFC, 0x003FFC, 0x003FFD, 0x007FFD, 0x01FFFE, 0x03FFFE,
-    0x03FFFF,
-};
-
-static const uint8_t huff_iid_dt0_bits[] = {
-    19, 19, 19, 20, 20, 20, 17, 15, 12, 10,  8,  6,  4,  2,  1,  3,  5,  7,
-     9, 11, 13, 14, 17, 19, 20, 20, 20, 20, 20,
-};
-
-static const uint32_t huff_iid_dt0_codes[] = {
-    0x07FFF9, 0x07FFFA, 0x07FFFB, 0x0FFFF8, 0x0FFFF9, 0x0FFFFA, 0x01FFFD,
-    0x007FFE, 0x000FFE, 0x0003FE, 0x0000FE, 0x00003E, 0x00000E, 0x000002,
-    0x000000, 0x000006, 0x00001E, 0x00007E, 0x0001FE, 0x0007FE, 0x001FFE,
-    0x003FFE, 0x01FFFC, 0x07FFF8, 0x0FFFFB, 0x0FFFFC, 0x0FFFFD, 0x0FFFFE,
-    0x0FFFFF,
-};
-
-static const uint8_t huff_icc_df_bits[] = {
-    14, 14, 12, 10, 7, 5, 3, 1, 2, 4, 6, 8, 9, 11, 13,
-};
-
-static const uint16_t huff_icc_df_codes[] = {
-    0x3FFF, 0x3FFE, 0x0FFE, 0x03FE, 0x007E, 0x001E, 0x0006, 0x0000,
-    0x0002, 0x000E, 0x003E, 0x00FE, 0x01FE, 0x07FE, 0x1FFE,
-};
-
-static const uint8_t huff_icc_dt_bits[] = {
-    14, 13, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12, 14,
-};
-
-static const uint16_t huff_icc_dt_codes[] = {
-    0x3FFE, 0x1FFE, 0x07FE, 0x01FE, 0x007E, 0x001E, 0x0006, 0x0000,
-    0x0002, 0x000E, 0x003E, 0x00FE, 0x03FE, 0x0FFE, 0x3FFF,
-};
-
-static const uint8_t huff_ipd_df_bits[] = {
-    1, 3, 4, 4, 4, 4, 4, 4,
-};
-
-static const uint8_t huff_ipd_df_codes[] = {
-    0x01, 0x00, 0x06, 0x04, 0x02, 0x03, 0x05, 0x07,
-};
-
-static const uint8_t huff_ipd_dt_bits[] = {
-    1, 3, 4, 5, 5, 4, 4, 3,
-};
-
-static const uint8_t huff_ipd_dt_codes[] = {
-    0x01, 0x02, 0x02, 0x03, 0x02, 0x00, 0x03, 0x03,
-};
-
-static const uint8_t huff_opd_df_bits[] = {
-    1, 3, 4, 4, 5, 5, 4, 3,
-};
-
-static const uint8_t huff_opd_df_codes[] = {
-    0x01, 0x01, 0x06, 0x04, 0x0F, 0x0E, 0x05, 0x00,
-};
-
-static const uint8_t huff_opd_dt_bits[] = {
-    1, 3, 4, 5, 5, 4, 4, 3,
-};
-
-static const uint8_t huff_opd_dt_codes[] = {
-    0x01, 0x02, 0x01, 0x07, 0x06, 0x00, 0x02, 0x03,
-};
-
-static const int8_t huff_offset[] = {
-    30, 30,
-    14, 14,
-    7, 7,
-    0, 0,
-    0, 0,
-};
-
-///Table 8.48
-static const int8_t k_to_i_20[] = {
-     1,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 14, 15,
-    15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18,
-    18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19
-};
-///Table 8.49
-static const int8_t k_to_i_34[] = {
-     0,  1,  2,  3,  4,  5,  6,  6,  7,  2,  1,  0, 10, 10,  4,  5,  6,  7,  8,
-     9, 10, 11, 12,  9, 14, 11, 12, 13, 14, 15, 16, 13, 16, 17, 18, 19, 20, 21,
-    22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29,
-    30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33,
-    33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33
-};
-
-static const float g1_Q2[] = {
-    0.0f,  0.01899487526049f, 0.0f, -0.07293139167538f,
-    0.0f,  0.30596630545168f, 0.5f
-};
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
deleted file mode 100644
index 53dac3d..0000000
--- a/libavcodec/aacpsy.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * AAC encoder psychoacoustic model
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC encoder psychoacoustic model
- */
-
-#include "avcodec.h"
-#include "aactab.h"
-#include "psymodel.h"
-
-/***********************************
- *              TODOs:
- * thresholds linearization after their modifications for attaining given bitrate
- * try other bitrate controlling mechanism (maybe use ratecontrol.c?)
- * control quality for quality-based output
- **********************************/
-
-/**
- * constants for 3GPP AAC psychoacoustic model
- * @{
- */
-#define PSY_3GPP_SPREAD_LOW  1.5f // spreading factor for ascending threshold spreading  (15 dB/Bark)
-#define PSY_3GPP_SPREAD_HI   3.0f // spreading factor for descending threshold spreading (30 dB/Bark)
-
-#define PSY_3GPP_RPEMIN      0.01f
-#define PSY_3GPP_RPELEV      2.0f
-/**
- * @}
- */
-
-/**
- * information for single band used by 3GPP TS26.403-inspired psychoacoustic model
- */
-typedef struct Psy3gppBand{
-    float energy;    ///< band energy
-    float ffac;      ///< form factor
-    float thr;       ///< energy threshold
-    float min_snr;   ///< minimal SNR
-    float thr_quiet; ///< threshold in quiet
-}Psy3gppBand;
-
-/**
- * single/pair channel context for psychoacoustic model
- */
-typedef struct Psy3gppChannel{
-    Psy3gppBand band[128];               ///< bands information
-    Psy3gppBand prev_band[128];          ///< bands information from the previous frame
-
-    float       win_energy;              ///< sliding average of channel energy
-    float       iir_state[2];            ///< hi-pass IIR filter state
-    uint8_t     next_grouping;           ///< stored grouping scheme for the next frame (in case of 8 short window sequence)
-    enum WindowSequence next_window_seq; ///< window sequence to be used in the next frame
-}Psy3gppChannel;
-
-/**
- * psychoacoustic model frame type-dependent coefficients
- */
-typedef struct Psy3gppCoeffs{
-    float ath       [64]; ///< absolute threshold of hearing per bands
-    float barks     [64]; ///< Bark value for each spectral band in long frame
-    float spread_low[64]; ///< spreading factor for low-to-high threshold spreading in long frame
-    float spread_hi [64]; ///< spreading factor for high-to-low threshold spreading in long frame
-}Psy3gppCoeffs;
-
-/**
- * 3GPP TS26.403-inspired psychoacoustic model specific data
- */
-typedef struct Psy3gppContext{
-    Psy3gppCoeffs psy_coef[2];
-    Psy3gppChannel *ch;
-}Psy3gppContext;
-
-/**
- * Calculate Bark value for given line.
- */
-static av_cold float calc_bark(float f)
-{
-    return 13.3f * atanf(0.00076f * f) + 3.5f * atanf((f / 7500.0f) * (f / 7500.0f));
-}
-
-#define ATH_ADD 4
-/**
- * Calculate ATH value for given frequency.
- * Borrowed from Lame.
- */
-static av_cold float ath(float f, float add)
-{
-    f /= 1000.0f;
-    return    3.64 * pow(f, -0.8)
-            - 6.8  * exp(-0.6  * (f - 3.4) * (f - 3.4))
-            + 6.0  * exp(-0.15 * (f - 8.7) * (f - 8.7))
-            + (0.6 + 0.04 * add) * 0.001 * f * f * f * f;
-}
-
-static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
-    Psy3gppContext *pctx;
-    float barks[1024];
-    int i, j, g, start;
-    float prev, minscale, minath;
-
-    ctx->model_priv_data = av_mallocz(sizeof(Psy3gppContext));
-    pctx = (Psy3gppContext*) ctx->model_priv_data;
-
-    for (i = 0; i < 1024; i++)
-        barks[i] = calc_bark(i * ctx->avctx->sample_rate / 2048.0);
-    minath = ath(3410, ATH_ADD);
-    for (j = 0; j < 2; j++) {
-        Psy3gppCoeffs *coeffs = &pctx->psy_coef[j];
-        i = 0;
-        prev = 0.0;
-        for (g = 0; g < ctx->num_bands[j]; g++) {
-            i += ctx->bands[j][g];
-            coeffs->barks[g] = (barks[i - 1] + prev) / 2.0;
-            prev = barks[i - 1];
-        }
-        for (g = 0; g < ctx->num_bands[j] - 1; g++) {
-            coeffs->spread_low[g] = pow(10.0, -(coeffs->barks[g+1] - coeffs->barks[g]) * PSY_3GPP_SPREAD_LOW);
-            coeffs->spread_hi [g] = pow(10.0, -(coeffs->barks[g+1] - coeffs->barks[g]) * PSY_3GPP_SPREAD_HI);
-        }
-        start = 0;
-        for (g = 0; g < ctx->num_bands[j]; g++) {
-            minscale = ath(ctx->avctx->sample_rate * start / 1024.0, ATH_ADD);
-            for (i = 1; i < ctx->bands[j][g]; i++)
-                minscale = FFMIN(minscale, ath(ctx->avctx->sample_rate * (start + i) / 1024.0 / 2.0, ATH_ADD));
-            coeffs->ath[g] = minscale - minath;
-            start += ctx->bands[j][g];
-        }
-    }
-
-    pctx->ch = av_mallocz(sizeof(Psy3gppChannel) * ctx->avctx->channels);
-    return 0;
-}
-
-/**
- * IIR filter used in block switching decision
- */
-static float iir_filter(int in, float state[2])
-{
-    float ret;
-
-    ret = 0.7548f * (in - state[0]) + 0.5095f * state[1];
-    state[0] = in;
-    state[1] = ret;
-    return ret;
-}
-
-/**
- * window grouping information stored as bits (0 - new group, 1 - group continues)
- */
-static const uint8_t window_grouping[9] = {
-    0xB6, 0x6C, 0xD8, 0xB2, 0x66, 0xC6, 0x96, 0x36, 0x36
-};
-
-/**
- * Tell encoder which window types to use.
- * @see 3GPP TS26.403 5.4.1 "Blockswitching"
- */
-static FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
-                                       const int16_t *audio, const int16_t *la,
-                                       int channel, int prev_type)
-{
-    int i, j;
-    int br               = ctx->avctx->bit_rate / ctx->avctx->channels;
-    int attack_ratio     = br <= 16000 ? 18 : 10;
-    Psy3gppContext *pctx = (Psy3gppContext*) ctx->model_priv_data;
-    Psy3gppChannel *pch  = &pctx->ch[channel];
-    uint8_t grouping     = 0;
-    FFPsyWindowInfo wi;
-
-    memset(&wi, 0, sizeof(wi));
-    if (la) {
-        float s[8], v;
-        int switch_to_eight = 0;
-        float sum = 0.0, sum2 = 0.0;
-        int attack_n = 0;
-        for (i = 0; i < 8; i++) {
-            for (j = 0; j < 128; j++) {
-                v = iir_filter(audio[(i*128+j)*ctx->avctx->channels], pch->iir_state);
-                sum += v*v;
-            }
-            s[i]  = sum;
-            sum2 += sum;
-        }
-        for (i = 0; i < 8; i++) {
-            if (s[i] > pch->win_energy * attack_ratio) {
-                attack_n        = i + 1;
-                switch_to_eight = 1;
-                break;
-            }
-        }
-        pch->win_energy = pch->win_energy*7/8 + sum2/64;
-
-        wi.window_type[1] = prev_type;
-        switch (prev_type) {
-        case ONLY_LONG_SEQUENCE:
-            wi.window_type[0] = switch_to_eight ? LONG_START_SEQUENCE : ONLY_LONG_SEQUENCE;
-            break;
-        case LONG_START_SEQUENCE:
-            wi.window_type[0] = EIGHT_SHORT_SEQUENCE;
-            grouping = pch->next_grouping;
-            break;
-        case LONG_STOP_SEQUENCE:
-            wi.window_type[0] = ONLY_LONG_SEQUENCE;
-            break;
-        case EIGHT_SHORT_SEQUENCE:
-            wi.window_type[0] = switch_to_eight ? EIGHT_SHORT_SEQUENCE : LONG_STOP_SEQUENCE;
-            grouping = switch_to_eight ? pch->next_grouping : 0;
-            break;
-        }
-        pch->next_grouping = window_grouping[attack_n];
-    } else {
-        for (i = 0; i < 3; i++)
-            wi.window_type[i] = prev_type;
-        grouping = (prev_type == EIGHT_SHORT_SEQUENCE) ? window_grouping[0] : 0;
-    }
-
-    wi.window_shape   = 1;
-    if (wi.window_type[0] != EIGHT_SHORT_SEQUENCE) {
-        wi.num_windows = 1;
-        wi.grouping[0] = 1;
-    } else {
-        int lastgrp = 0;
-        wi.num_windows = 8;
-        for (i = 0; i < 8; i++) {
-            if (!((grouping >> i) & 1))
-                lastgrp = i;
-            wi.grouping[lastgrp]++;
-        }
-    }
-
-    return wi;
-}
-
-/**
- * Calculate band thresholds as suggested in 3GPP TS26.403
- */
-static void psy_3gpp_analyze(FFPsyContext *ctx, int channel,
-                             const float *coefs, FFPsyWindowInfo *wi)
-{
-    Psy3gppContext *pctx = (Psy3gppContext*) ctx->model_priv_data;
-    Psy3gppChannel *pch  = &pctx->ch[channel];
-    int start = 0;
-    int i, w, g;
-    const int num_bands       = ctx->num_bands[wi->num_windows == 8];
-    const uint8_t* band_sizes = ctx->bands[wi->num_windows == 8];
-    Psy3gppCoeffs *coeffs     = &pctx->psy_coef[wi->num_windows == 8];
-
-    //calculate energies, initial thresholds and related values - 5.4.2 "Threshold Calculation"
-    for (w = 0; w < wi->num_windows*16; w += 16) {
-        for (g = 0; g < num_bands; g++) {
-            Psy3gppBand *band = &pch->band[w+g];
-            band->energy = 0.0f;
-            for (i = 0; i < band_sizes[g]; i++)
-                band->energy += coefs[start+i] * coefs[start+i];
-            band->energy *= 1.0f / (512*512);
-            band->thr     = band->energy * 0.001258925f;
-            start        += band_sizes[g];
-
-            ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].energy = band->energy;
-        }
-    }
-    //modify thresholds - spread, threshold in quiet - 5.4.3 "Spreaded Energy Calculation"
-    for (w = 0; w < wi->num_windows*16; w += 16) {
-        Psy3gppBand *band = &pch->band[w];
-        for (g = 1; g < num_bands; g++)
-            band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_low[g-1]);
-        for (g = num_bands - 2; g >= 0; g--)
-            band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_hi [g]);
-        for (g = 0; g < num_bands; g++) {
-            band[g].thr_quiet = FFMAX(band[g].thr, coeffs->ath[g]);
-            if (wi->num_windows != 8 && wi->window_type[1] != EIGHT_SHORT_SEQUENCE)
-                band[g].thr_quiet = FFMAX(PSY_3GPP_RPEMIN*band[g].thr_quiet,
-                                          FFMIN(band[g].thr_quiet,
-                                          PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet));
-            band[g].thr = FFMAX(band[g].thr, band[g].thr_quiet * 0.25);
-
-            ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].threshold = band[g].thr;
-        }
-    }
-    memcpy(pch->prev_band, pch->band, sizeof(pch->band));
-}
-
-static av_cold void psy_3gpp_end(FFPsyContext *apc)
-{
-    Psy3gppContext *pctx = (Psy3gppContext*) apc->model_priv_data;
-    av_freep(&pctx->ch);
-    av_freep(&apc->model_priv_data);
-}
-
-
-const FFPsyModel ff_aac_psy_model =
-{
-    .name    = "3GPP TS 26.403-inspired model",
-    .init    = psy_3gpp_init,
-    .window  = psy_3gpp_window,
-    .analyze = psy_3gpp_analyze,
-    .end     = psy_3gpp_end,
-};
diff --git a/libavcodec/aacpsy.h b/libavcodec/aacpsy.h
deleted file mode 100644
index 05c93cd..0000000
--- a/libavcodec/aacpsy.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * AAC encoder psychoacoustic model
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AACPSY_H
-#define AVCODEC_AACPSY_H
-
-#include "avcodec.h"
-#include "aac.h"
-//#include "lowpass.h"
-
-enum AACPsyModelType{
-    AAC_PSY_TEST,              ///< a sample model to exercise encoder
-    AAC_PSY_3GPP,              ///< model following recommendations from 3GPP TS 26.403
-
-    AAC_NB_PSY_MODELS          ///< total number of psychoacoustic models, since it's not a part of the ABI new models can be added freely
-};
-
-/**
- * context used by psychoacoustic model
- */
-typedef struct AACPsyContext {
-    AVCodecContext *avctx;            ///< encoder context
-}AACPsyContext;
-
-/**
- * Cleanup model context at the end.
- *
- * @param ctx model context
- */
-void ff_aac_psy_end(AACPsyContext *ctx);
-
-#endif /* AVCODEC_AACPSY_H */
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
deleted file mode 100644
index ca5c52c..0000000
--- a/libavcodec/aacsbr.c
+++ /dev/null
@@ -1,1771 +0,0 @@
-/*
- * AAC Spectral Band Replication decoding functions
- * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
- * Copyright (c) 2009-2010 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC Spectral Band Replication decoding functions
- * @author Robert Swain ( rob opendot cl )
- */
-
-#include "aac.h"
-#include "sbr.h"
-#include "aacsbr.h"
-#include "aacsbrdata.h"
-#include "fft.h"
-#include "aacps.h"
-
-#include <stdint.h>
-#include <float.h>
-
-#define ENVELOPE_ADJUSTMENT_OFFSET 2
-#define NOISE_FLOOR_OFFSET 6.0f
-
-/**
- * SBR VLC tables
- */
-enum {
-    T_HUFFMAN_ENV_1_5DB,
-    F_HUFFMAN_ENV_1_5DB,
-    T_HUFFMAN_ENV_BAL_1_5DB,
-    F_HUFFMAN_ENV_BAL_1_5DB,
-    T_HUFFMAN_ENV_3_0DB,
-    F_HUFFMAN_ENV_3_0DB,
-    T_HUFFMAN_ENV_BAL_3_0DB,
-    F_HUFFMAN_ENV_BAL_3_0DB,
-    T_HUFFMAN_NOISE_3_0DB,
-    T_HUFFMAN_NOISE_BAL_3_0DB,
-};
-
-/**
- * bs_frame_class - frame class of current SBR frame (14496-3 sp04 p98)
- */
-enum {
-    FIXFIX,
-    FIXVAR,
-    VARFIX,
-    VARVAR,
-};
-
-enum {
-    EXTENSION_ID_PS = 2,
-};
-
-static VLC vlc_sbr[10];
-static const int8_t vlc_sbr_lav[10] =
-    { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 };
-static const DECLARE_ALIGNED(16, float, zero64)[64];
-
-#define SBR_INIT_VLC_STATIC(num, size) \
-    INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size,     \
-                    sbr_tmp[num].sbr_bits ,                      1,                      1, \
-                    sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \
-                    size)
-
-#define SBR_VLC_ROW(name) \
-    { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) }
-
-av_cold void ff_aac_sbr_init(void)
-{
-    int n;
-    static const struct {
-        const void *sbr_codes, *sbr_bits;
-        const unsigned int table_size, elem_size;
-    } sbr_tmp[] = {
-        SBR_VLC_ROW(t_huffman_env_1_5dB),
-        SBR_VLC_ROW(f_huffman_env_1_5dB),
-        SBR_VLC_ROW(t_huffman_env_bal_1_5dB),
-        SBR_VLC_ROW(f_huffman_env_bal_1_5dB),
-        SBR_VLC_ROW(t_huffman_env_3_0dB),
-        SBR_VLC_ROW(f_huffman_env_3_0dB),
-        SBR_VLC_ROW(t_huffman_env_bal_3_0dB),
-        SBR_VLC_ROW(f_huffman_env_bal_3_0dB),
-        SBR_VLC_ROW(t_huffman_noise_3_0dB),
-        SBR_VLC_ROW(t_huffman_noise_bal_3_0dB),
-    };
-
-    // SBR VLC table initialization
-    SBR_INIT_VLC_STATIC(0, 1098);
-    SBR_INIT_VLC_STATIC(1, 1092);
-    SBR_INIT_VLC_STATIC(2, 768);
-    SBR_INIT_VLC_STATIC(3, 1026);
-    SBR_INIT_VLC_STATIC(4, 1058);
-    SBR_INIT_VLC_STATIC(5, 1052);
-    SBR_INIT_VLC_STATIC(6, 544);
-    SBR_INIT_VLC_STATIC(7, 544);
-    SBR_INIT_VLC_STATIC(8, 592);
-    SBR_INIT_VLC_STATIC(9, 512);
-
-    for (n = 1; n < 320; n++)
-        sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n];
-    sbr_qmf_window_us[384] = -sbr_qmf_window_us[384];
-    sbr_qmf_window_us[512] = -sbr_qmf_window_us[512];
-
-    for (n = 0; n < 320; n++)
-        sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n];
-
-    ff_ps_init();
-}
-
-av_cold void ff_aac_sbr_ctx_init(SpectralBandReplication *sbr)
-{
-    sbr->kx[0] = sbr->kx[1] = 32; //Typo in spec, kx' inits to 32
-    sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1;
-    sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
-    sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
-    ff_mdct_init(&sbr->mdct, 7, 1, 1.0/64);
-    ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0);
-    ff_ps_ctx_init(&sbr->ps);
-}
-
-av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr)
-{
-    ff_mdct_end(&sbr->mdct);
-    ff_mdct_end(&sbr->mdct_ana);
-}
-
-static int qsort_comparison_function_int16(const void *a, const void *b)
-{
-    return *(const int16_t *)a - *(const int16_t *)b;
-}
-
-static inline int in_table_int16(const int16_t *table, int last_el, int16_t needle)
-{
-    int i;
-    for (i = 0; i <= last_el; i++)
-        if (table[i] == needle)
-            return 1;
-    return 0;
-}
-
-/// Limiter Frequency Band Table (14496-3 sp04 p198)
-static void sbr_make_f_tablelim(SpectralBandReplication *sbr)
-{
-    int k;
-    if (sbr->bs_limiter_bands > 0) {
-        static const float bands_warped[3] = { 1.32715174233856803909f,   //2^(0.49/1.2)
-                                               1.18509277094158210129f,   //2^(0.49/2)
-                                               1.11987160404675912501f }; //2^(0.49/3)
-        const float lim_bands_per_octave_warped = bands_warped[sbr->bs_limiter_bands - 1];
-        int16_t patch_borders[7];
-        uint16_t *in = sbr->f_tablelim + 1, *out = sbr->f_tablelim;
-
-        patch_borders[0] = sbr->kx[1];
-        for (k = 1; k <= sbr->num_patches; k++)
-            patch_borders[k] = patch_borders[k-1] + sbr->patch_num_subbands[k-1];
-
-        memcpy(sbr->f_tablelim, sbr->f_tablelow,
-               (sbr->n[0] + 1) * sizeof(sbr->f_tablelow[0]));
-        if (sbr->num_patches > 1)
-            memcpy(sbr->f_tablelim + sbr->n[0] + 1, patch_borders + 1,
-                   (sbr->num_patches - 1) * sizeof(patch_borders[0]));
-
-        qsort(sbr->f_tablelim, sbr->num_patches + sbr->n[0],
-              sizeof(sbr->f_tablelim[0]),
-              qsort_comparison_function_int16);
-
-        sbr->n_lim = sbr->n[0] + sbr->num_patches - 1;
-        while (out < sbr->f_tablelim + sbr->n_lim) {
-            if (*in >= *out * lim_bands_per_octave_warped) {
-                *++out = *in++;
-            } else if (*in == *out ||
-                !in_table_int16(patch_borders, sbr->num_patches, *in)) {
-                in++;
-                sbr->n_lim--;
-            } else if (!in_table_int16(patch_borders, sbr->num_patches, *out)) {
-                *out = *in++;
-                sbr->n_lim--;
-            } else {
-                *++out = *in++;
-            }
-        }
-    } else {
-        sbr->f_tablelim[0] = sbr->f_tablelow[0];
-        sbr->f_tablelim[1] = sbr->f_tablelow[sbr->n[0]];
-        sbr->n_lim = 1;
-    }
-}
-
-static unsigned int read_sbr_header(SpectralBandReplication *sbr, GetBitContext *gb)
-{
-    unsigned int cnt = get_bits_count(gb);
-    uint8_t bs_header_extra_1;
-    uint8_t bs_header_extra_2;
-    int old_bs_limiter_bands = sbr->bs_limiter_bands;
-    SpectrumParameters old_spectrum_params;
-
-    sbr->start = 1;
-
-    // Save last spectrum parameters variables to compare to new ones
-    memcpy(&old_spectrum_params, &sbr->spectrum_params, sizeof(SpectrumParameters));
-
-    sbr->bs_amp_res_header              = get_bits1(gb);
-    sbr->spectrum_params.bs_start_freq  = get_bits(gb, 4);
-    sbr->spectrum_params.bs_stop_freq   = get_bits(gb, 4);
-    sbr->spectrum_params.bs_xover_band  = get_bits(gb, 3);
-                                          skip_bits(gb, 2); // bs_reserved
-
-    bs_header_extra_1 = get_bits1(gb);
-    bs_header_extra_2 = get_bits1(gb);
-
-    if (bs_header_extra_1) {
-        sbr->spectrum_params.bs_freq_scale  = get_bits(gb, 2);
-        sbr->spectrum_params.bs_alter_scale = get_bits1(gb);
-        sbr->spectrum_params.bs_noise_bands = get_bits(gb, 2);
-    } else {
-        sbr->spectrum_params.bs_freq_scale  = 2;
-        sbr->spectrum_params.bs_alter_scale = 1;
-        sbr->spectrum_params.bs_noise_bands = 2;
-    }
-
-    // Check if spectrum parameters changed
-    if (memcmp(&old_spectrum_params, &sbr->spectrum_params, sizeof(SpectrumParameters)))
-        sbr->reset = 1;
-
-    if (bs_header_extra_2) {
-        sbr->bs_limiter_bands  = get_bits(gb, 2);
-        sbr->bs_limiter_gains  = get_bits(gb, 2);
-        sbr->bs_interpol_freq  = get_bits1(gb);
-        sbr->bs_smoothing_mode = get_bits1(gb);
-    } else {
-        sbr->bs_limiter_bands  = 2;
-        sbr->bs_limiter_gains  = 2;
-        sbr->bs_interpol_freq  = 1;
-        sbr->bs_smoothing_mode = 1;
-    }
-
-    if (sbr->bs_limiter_bands != old_bs_limiter_bands && !sbr->reset)
-        sbr_make_f_tablelim(sbr);
-
-    return get_bits_count(gb) - cnt;
-}
-
-static int array_min_int16(const int16_t *array, int nel)
-{
-    int i, min = array[0];
-    for (i = 1; i < nel; i++)
-        min = FFMIN(array[i], min);
-    return min;
-}
-
-static void make_bands(int16_t* bands, int start, int stop, int num_bands)
-{
-    int k, previous, present;
-    float base, prod;
-
-    base = powf((float)stop / start, 1.0f / num_bands);
-    prod = start;
-    previous = start;
-
-    for (k = 0; k < num_bands-1; k++) {
-        prod *= base;
-        present  = lrintf(prod);
-        bands[k] = present - previous;
-        previous = present;
-    }
-    bands[num_bands-1] = stop - previous;
-}
-
-static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band)
-{
-    // Requirements (14496-3 sp04 p205)
-    if (n_master <= 0) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master);
-        return -1;
-    }
-    if (bs_xover_band >= n_master) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Invalid bitstream, crossover band index beyond array bounds: %d\n",
-               bs_xover_band);
-        return -1;
-    }
-    return 0;
-}
-
-/// Master Frequency Band Table (14496-3 sp04 p194)
-static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
-                             SpectrumParameters *spectrum)
-{
-    unsigned int temp, max_qmf_subbands;
-    unsigned int start_min, stop_min;
-    int k;
-    const int8_t *sbr_offset_ptr;
-    int16_t stop_dk[13];
-
-    if (sbr->sample_rate < 32000) {
-        temp = 3000;
-    } else if (sbr->sample_rate < 64000) {
-        temp = 4000;
-    } else
-        temp = 5000;
-
-    start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
-    stop_min  = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
-
-    switch (sbr->sample_rate) {
-    case 16000:
-        sbr_offset_ptr = sbr_offset[0];
-        break;
-    case 22050:
-        sbr_offset_ptr = sbr_offset[1];
-        break;
-    case 24000:
-        sbr_offset_ptr = sbr_offset[2];
-        break;
-    case 32000:
-        sbr_offset_ptr = sbr_offset[3];
-        break;
-    case 44100: case 48000: case 64000:
-        sbr_offset_ptr = sbr_offset[4];
-        break;
-    case 88200: case 96000: case 128000: case 176400: case 192000:
-        sbr_offset_ptr = sbr_offset[5];
-        break;
-    default:
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Unsupported sample rate for SBR: %d\n", sbr->sample_rate);
-        return -1;
-    }
-
-    sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq];
-
-    if (spectrum->bs_stop_freq < 14) {
-        sbr->k[2] = stop_min;
-        make_bands(stop_dk, stop_min, 64, 13);
-        qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16);
-        for (k = 0; k < spectrum->bs_stop_freq; k++)
-            sbr->k[2] += stop_dk[k];
-    } else if (spectrum->bs_stop_freq == 14) {
-        sbr->k[2] = 2*sbr->k[0];
-    } else if (spectrum->bs_stop_freq == 15) {
-        sbr->k[2] = 3*sbr->k[0];
-    } else {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq);
-        return -1;
-    }
-    sbr->k[2] = FFMIN(64, sbr->k[2]);
-
-    // Requirements (14496-3 sp04 p205)
-    if (sbr->sample_rate <= 32000) {
-        max_qmf_subbands = 48;
-    } else if (sbr->sample_rate == 44100) {
-        max_qmf_subbands = 35;
-    } else if (sbr->sample_rate >= 48000)
-        max_qmf_subbands = 32;
-
-    if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]);
-        return -1;
-    }
-
-    if (!spectrum->bs_freq_scale) {
-        int dk, k2diff;
-
-        dk = spectrum->bs_alter_scale + 1;
-        sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1;
-        if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
-            return -1;
-
-        for (k = 1; k <= sbr->n_master; k++)
-            sbr->f_master[k] = dk;
-
-        k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk;
-        if (k2diff < 0) {
-            sbr->f_master[1]--;
-            sbr->f_master[2]-= (k2diff < -1);
-        } else if (k2diff) {
-            sbr->f_master[sbr->n_master]++;
-        }
-
-        sbr->f_master[0] = sbr->k[0];
-        for (k = 1; k <= sbr->n_master; k++)
-            sbr->f_master[k] += sbr->f_master[k - 1];
-
-    } else {
-        int half_bands = 7 - spectrum->bs_freq_scale;      // bs_freq_scale  = {1,2,3}
-        int two_regions, num_bands_0;
-        int vdk0_max, vdk1_min;
-        int16_t vk0[49];
-
-        if (49 * sbr->k[2] > 110 * sbr->k[0]) {
-            two_regions = 1;
-            sbr->k[1] = 2 * sbr->k[0];
-        } else {
-            two_regions = 0;
-            sbr->k[1] = sbr->k[2];
-        }
-
-        num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2;
-
-        if (num_bands_0 <= 0) { // Requirements (14496-3 sp04 p205)
-            av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
-            return -1;
-        }
-
-        vk0[0] = 0;
-
-        make_bands(vk0+1, sbr->k[0], sbr->k[1], num_bands_0);
-
-        qsort(vk0 + 1, num_bands_0, sizeof(vk0[1]), qsort_comparison_function_int16);
-        vdk0_max = vk0[num_bands_0];
-
-        vk0[0] = sbr->k[0];
-        for (k = 1; k <= num_bands_0; k++) {
-            if (vk0[k] <= 0) { // Requirements (14496-3 sp04 p205)
-                av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
-                return -1;
-            }
-            vk0[k] += vk0[k-1];
-        }
-
-        if (two_regions) {
-            int16_t vk1[49];
-            float invwarp = spectrum->bs_alter_scale ? 0.76923076923076923077f
-                                                     : 1.0f; // bs_alter_scale = {0,1}
-            int num_bands_1 = lrintf(half_bands * invwarp *
-                                     log2f(sbr->k[2] / (float)sbr->k[1])) * 2;
-
-            make_bands(vk1+1, sbr->k[1], sbr->k[2], num_bands_1);
-
-            vdk1_min = array_min_int16(vk1 + 1, num_bands_1);
-
-            if (vdk1_min < vdk0_max) {
-                int change;
-                qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16);
-                change = FFMIN(vdk0_max - vk1[1], (vk1[num_bands_1] - vk1[1]) >> 1);
-                vk1[1]           += change;
-                vk1[num_bands_1] -= change;
-            }
-
-            qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16);
-
-            vk1[0] = sbr->k[1];
-            for (k = 1; k <= num_bands_1; k++) {
-                if (vk1[k] <= 0) { // Requirements (14496-3 sp04 p205)
-                    av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
-                    return -1;
-                }
-                vk1[k] += vk1[k-1];
-            }
-
-            sbr->n_master = num_bands_0 + num_bands_1;
-            if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
-                return -1;
-            memcpy(&sbr->f_master[0],               vk0,
-                   (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
-            memcpy(&sbr->f_master[num_bands_0 + 1], vk1 + 1,
-                    num_bands_1      * sizeof(sbr->f_master[0]));
-
-        } else {
-            sbr->n_master = num_bands_0;
-            if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
-                return -1;
-            memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
-        }
-    }
-
-    return 0;
-}
-
-/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46)
-static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
-{
-    int i, k, sb = 0;
-    int msb = sbr->k[0];
-    int usb = sbr->kx[1];
-    int goal_sb = ((1000 << 11) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
-
-    sbr->num_patches = 0;
-
-    if (goal_sb < sbr->kx[1] + sbr->m[1]) {
-        for (k = 0; sbr->f_master[k] < goal_sb; k++) ;
-    } else
-        k = sbr->n_master;
-
-    do {
-        int odd = 0;
-        for (i = k; i == k || sb > (sbr->k[0] - 1 + msb - odd); i--) {
-            sb = sbr->f_master[i];
-            odd = (sb + sbr->k[0]) & 1;
-        }
-
-        // Requirements (14496-3 sp04 p205) sets the maximum number of patches to 5.
-        // After this check the final number of patches can still be six which is
-        // illegal however the Coding Technologies decoder check stream has a final
-        // count of 6 patches
-        if (sbr->num_patches > 5) {
-            av_log(ac->avctx, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches);
-            return -1;
-        }
-
-        sbr->patch_num_subbands[sbr->num_patches]  = FFMAX(sb - usb, 0);
-        sbr->patch_start_subband[sbr->num_patches] = sbr->k[0] - odd - sbr->patch_num_subbands[sbr->num_patches];
-
-        if (sbr->patch_num_subbands[sbr->num_patches] > 0) {
-            usb = sb;
-            msb = sb;
-            sbr->num_patches++;
-        } else
-            msb = sbr->kx[1];
-
-        if (sbr->f_master[k] - sb < 3)
-            k = sbr->n_master;
-    } while (sb != sbr->kx[1] + sbr->m[1]);
-
-    if (sbr->patch_num_subbands[sbr->num_patches-1] < 3 && sbr->num_patches > 1)
-        sbr->num_patches--;
-
-    return 0;
-}
-
-/// Derived Frequency Band Tables (14496-3 sp04 p197)
-static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr)
-{
-    int k, temp;
-
-    sbr->n[1] = sbr->n_master - sbr->spectrum_params.bs_xover_band;
-    sbr->n[0] = (sbr->n[1] + 1) >> 1;
-
-    memcpy(sbr->f_tablehigh, &sbr->f_master[sbr->spectrum_params.bs_xover_band],
-           (sbr->n[1] + 1) * sizeof(sbr->f_master[0]));
-    sbr->m[1] = sbr->f_tablehigh[sbr->n[1]] - sbr->f_tablehigh[0];
-    sbr->kx[1] = sbr->f_tablehigh[0];
-
-    // Requirements (14496-3 sp04 p205)
-    if (sbr->kx[1] + sbr->m[1] > 64) {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Stop frequency border too high: %d\n", sbr->kx[1] + sbr->m[1]);
-        return -1;
-    }
-    if (sbr->kx[1] > 32) {
-        av_log(ac->avctx, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]);
-        return -1;
-    }
-
-    sbr->f_tablelow[0] = sbr->f_tablehigh[0];
-    temp = sbr->n[1] & 1;
-    for (k = 1; k <= sbr->n[0]; k++)
-        sbr->f_tablelow[k] = sbr->f_tablehigh[2 * k - temp];
-
-    sbr->n_q = FFMAX(1, lrintf(sbr->spectrum_params.bs_noise_bands *
-                               log2f(sbr->k[2] / (float)sbr->kx[1]))); // 0 <= bs_noise_bands <= 3
-    if (sbr->n_q > 5) {
-        av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q);
-        return -1;
-    }
-
-    sbr->f_tablenoise[0] = sbr->f_tablelow[0];
-    temp = 0;
-    for (k = 1; k <= sbr->n_q; k++) {
-        temp += (sbr->n[0] - temp) / (sbr->n_q + 1 - k);
-        sbr->f_tablenoise[k] = sbr->f_tablelow[temp];
-    }
-
-    if (sbr_hf_calc_npatches(ac, sbr) < 0)
-        return -1;
-
-    sbr_make_f_tablelim(sbr);
-
-    sbr->data[0].f_indexnoise = 0;
-    sbr->data[1].f_indexnoise = 0;
-
-    return 0;
-}
-
-static av_always_inline void get_bits1_vector(GetBitContext *gb, uint8_t *vec,
-                                              int elements)
-{
-    int i;
-    for (i = 0; i < elements; i++) {
-        vec[i] = get_bits1(gb);
-    }
-}
-
-/** ceil(log2(index+1)) */
-static const int8_t ceil_log2[] = {
-    0, 1, 2, 2, 3, 3,
-};
-
-static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
-                         GetBitContext *gb, SBRData *ch_data)
-{
-    int i;
-    unsigned bs_pointer = 0;
-    // frameLengthFlag ? 15 : 16; 960 sample length frames unsupported; this value is numTimeSlots
-    int abs_bord_trail = 16;
-    int num_rel_lead, num_rel_trail;
-    unsigned bs_num_env_old = ch_data->bs_num_env;
-
-    ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env];
-    ch_data->bs_amp_res = sbr->bs_amp_res_header;
-    ch_data->t_env_num_env_old = ch_data->t_env[bs_num_env_old];
-
-    switch (ch_data->bs_frame_class = get_bits(gb, 2)) {
-    case FIXFIX:
-        ch_data->bs_num_env                 = 1 << get_bits(gb, 2);
-        num_rel_lead                        = ch_data->bs_num_env - 1;
-        if (ch_data->bs_num_env == 1)
-            ch_data->bs_amp_res = 0;
-
-        if (ch_data->bs_num_env > 4) {
-            av_log(ac->avctx, AV_LOG_ERROR,
-                   "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
-                   ch_data->bs_num_env);
-            return -1;
-        }
-
-        ch_data->t_env[0]                   = 0;
-        ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail;
-
-        abs_bord_trail = (abs_bord_trail + (ch_data->bs_num_env >> 1)) /
-                   ch_data->bs_num_env;
-        for (i = 0; i < num_rel_lead; i++)
-            ch_data->t_env[i + 1] = ch_data->t_env[i] + abs_bord_trail;
-
-        ch_data->bs_freq_res[1] = get_bits1(gb);
-        for (i = 1; i < ch_data->bs_num_env; i++)
-            ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1];
-        break;
-    case FIXVAR:
-        abs_bord_trail                     += get_bits(gb, 2);
-        num_rel_trail                       = get_bits(gb, 2);
-        ch_data->bs_num_env                 = num_rel_trail + 1;
-        ch_data->t_env[0]                   = 0;
-        ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail;
-
-        for (i = 0; i < num_rel_trail; i++)
-            ch_data->t_env[ch_data->bs_num_env - 1 - i] =
-                ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
-
-        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env]);
-
-        for (i = 0; i < ch_data->bs_num_env; i++)
-            ch_data->bs_freq_res[ch_data->bs_num_env - i] = get_bits1(gb);
-        break;
-    case VARFIX:
-        ch_data->t_env[0]                   = get_bits(gb, 2);
-        num_rel_lead                        = get_bits(gb, 2);
-        ch_data->bs_num_env                 = num_rel_lead + 1;
-        ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail;
-
-        for (i = 0; i < num_rel_lead; i++)
-            ch_data->t_env[i + 1] = ch_data->t_env[i] + 2 * get_bits(gb, 2) + 2;
-
-        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env]);
-
-        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env);
-        break;
-    case VARVAR:
-        ch_data->t_env[0]                   = get_bits(gb, 2);
-        abs_bord_trail                     += get_bits(gb, 2);
-        num_rel_lead                        = get_bits(gb, 2);
-        num_rel_trail                       = get_bits(gb, 2);
-        ch_data->bs_num_env                 = num_rel_lead + num_rel_trail + 1;
-
-        if (ch_data->bs_num_env > 5) {
-            av_log(ac->avctx, AV_LOG_ERROR,
-                   "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
-                   ch_data->bs_num_env);
-            return -1;
-        }
-
-        ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail;
-
-        for (i = 0; i < num_rel_lead; i++)
-            ch_data->t_env[i + 1] = ch_data->t_env[i] + 2 * get_bits(gb, 2) + 2;
-        for (i = 0; i < num_rel_trail; i++)
-            ch_data->t_env[ch_data->bs_num_env - 1 - i] =
-                ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
-
-        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env]);
-
-        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env);
-        break;
-    }
-
-    if (bs_pointer > ch_data->bs_num_env + 1) {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
-               bs_pointer);
-        return -1;
-    }
-
-    for (i = 1; i <= ch_data->bs_num_env; i++) {
-        if (ch_data->t_env[i-1] > ch_data->t_env[i]) {
-            av_log(ac->avctx, AV_LOG_ERROR, "Non monotone time borders\n");
-            return -1;
-        }
-    }
-
-    ch_data->bs_num_noise = (ch_data->bs_num_env > 1) + 1;
-
-    ch_data->t_q[0]                     = ch_data->t_env[0];
-    ch_data->t_q[ch_data->bs_num_noise] = ch_data->t_env[ch_data->bs_num_env];
-    if (ch_data->bs_num_noise > 1) {
-        unsigned int idx;
-        if (ch_data->bs_frame_class == FIXFIX) {
-            idx = ch_data->bs_num_env >> 1;
-        } else if (ch_data->bs_frame_class & 1) { // FIXVAR or VARVAR
-            idx = ch_data->bs_num_env - FFMAX(bs_pointer - 1, 1);
-        } else { // VARFIX
-            if (!bs_pointer)
-                idx = 1;
-            else if (bs_pointer == 1)
-                idx = ch_data->bs_num_env - 1;
-            else // bs_pointer > 1
-                idx = bs_pointer - 1;
-        }
-        ch_data->t_q[1] = ch_data->t_env[idx];
-    }
-
-    ch_data->e_a[0] = -(ch_data->e_a[1] != bs_num_env_old); // l_APrev
-    ch_data->e_a[1] = -1;
-    if ((ch_data->bs_frame_class & 1) && bs_pointer) { // FIXVAR or VARVAR and bs_pointer != 0
-        ch_data->e_a[1] = ch_data->bs_num_env + 1 - bs_pointer;
-    } else if ((ch_data->bs_frame_class == 2) && (bs_pointer > 1)) // VARFIX and bs_pointer > 1
-        ch_data->e_a[1] = bs_pointer - 1;
-
-    return 0;
-}
-
-static void copy_sbr_grid(SBRData *dst, const SBRData *src) {
-    //These variables are saved from the previous frame rather than copied
-    dst->bs_freq_res[0]    = dst->bs_freq_res[dst->bs_num_env];
-    dst->t_env_num_env_old = dst->t_env[dst->bs_num_env];
-    dst->e_a[0]            = -(dst->e_a[1] != dst->bs_num_env);
-
-    //These variables are read from the bitstream and therefore copied
-    memcpy(dst->bs_freq_res+1, src->bs_freq_res+1, sizeof(dst->bs_freq_res)-sizeof(*dst->bs_freq_res));
-    memcpy(dst->t_env,         src->t_env,         sizeof(dst->t_env));
-    memcpy(dst->t_q,           src->t_q,           sizeof(dst->t_q));
-    dst->bs_num_env        = src->bs_num_env;
-    dst->bs_amp_res        = src->bs_amp_res;
-    dst->bs_num_noise      = src->bs_num_noise;
-    dst->bs_frame_class    = src->bs_frame_class;
-    dst->e_a[1]            = src->e_a[1];
-}
-
-/// Read how the envelope and noise floor data is delta coded
-static void read_sbr_dtdf(SpectralBandReplication *sbr, GetBitContext *gb,
-                          SBRData *ch_data)
-{
-    get_bits1_vector(gb, ch_data->bs_df_env,   ch_data->bs_num_env);
-    get_bits1_vector(gb, ch_data->bs_df_noise, ch_data->bs_num_noise);
-}
-
-/// Read inverse filtering data
-static void read_sbr_invf(SpectralBandReplication *sbr, GetBitContext *gb,
-                          SBRData *ch_data)
-{
-    int i;
-
-    memcpy(ch_data->bs_invf_mode[1], ch_data->bs_invf_mode[0], 5 * sizeof(uint8_t));
-    for (i = 0; i < sbr->n_q; i++)
-        ch_data->bs_invf_mode[0][i] = get_bits(gb, 2);
-}
-
-static void read_sbr_envelope(SpectralBandReplication *sbr, GetBitContext *gb,
-                              SBRData *ch_data, int ch)
-{
-    int bits;
-    int i, j, k;
-    VLC_TYPE (*t_huff)[2], (*f_huff)[2];
-    int t_lav, f_lav;
-    const int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
-    const int odd = sbr->n[1] & 1;
-
-    if (sbr->bs_coupling && ch) {
-        if (ch_data->bs_amp_res) {
-            bits   = 5;
-            t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table;
-            t_lav  = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB];
-            f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
-            f_lav  = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
-        } else {
-            bits   = 6;
-            t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table;
-            t_lav  = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB];
-            f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table;
-            f_lav  = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB];
-        }
-    } else {
-        if (ch_data->bs_amp_res) {
-            bits   = 6;
-            t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table;
-            t_lav  = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB];
-            f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
-            f_lav  = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
-        } else {
-            bits   = 7;
-            t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table;
-            t_lav  = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB];
-            f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table;
-            f_lav  = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB];
-        }
-    }
-
-    for (i = 0; i < ch_data->bs_num_env; i++) {
-        if (ch_data->bs_df_env[i]) {
-            // bs_freq_res[0] == bs_freq_res[bs_num_env] from prev frame
-            if (ch_data->bs_freq_res[i + 1] == ch_data->bs_freq_res[i]) {
-                for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++)
-                    ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][j] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
-            } else if (ch_data->bs_freq_res[i + 1]) {
-                for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
-                    k = (j + odd) >> 1; // find k such that f_tablelow[k] <= f_tablehigh[j] < f_tablelow[k + 1]
-                    ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
-                }
-            } else {
-                for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) {
-                    k = j ? 2*j - odd : 0; // find k such that f_tablehigh[k] == f_tablelow[j]
-                    ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav);
-                }
-            }
-        } else {
-            ch_data->env_facs[i + 1][0] = delta * get_bits(gb, bits); // bs_env_start_value_balance
-            for (j = 1; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++)
-                ch_data->env_facs[i + 1][j] = ch_data->env_facs[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
-        }
-    }
-
-    //assign 0th elements of env_facs from last elements
-    memcpy(ch_data->env_facs[0], ch_data->env_facs[ch_data->bs_num_env],
-           sizeof(ch_data->env_facs[0]));
-}
-
-static void read_sbr_noise(SpectralBandReplication *sbr, GetBitContext *gb,
-                           SBRData *ch_data, int ch)
-{
-    int i, j;
-    VLC_TYPE (*t_huff)[2], (*f_huff)[2];
-    int t_lav, f_lav;
-    int delta = (ch == 1 && sbr->bs_coupling == 1) + 1;
-
-    if (sbr->bs_coupling && ch) {
-        t_huff = vlc_sbr[T_HUFFMAN_NOISE_BAL_3_0DB].table;
-        t_lav  = vlc_sbr_lav[T_HUFFMAN_NOISE_BAL_3_0DB];
-        f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table;
-        f_lav  = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB];
-    } else {
-        t_huff = vlc_sbr[T_HUFFMAN_NOISE_3_0DB].table;
-        t_lav  = vlc_sbr_lav[T_HUFFMAN_NOISE_3_0DB];
-        f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table;
-        f_lav  = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB];
-    }
-
-    for (i = 0; i < ch_data->bs_num_noise; i++) {
-        if (ch_data->bs_df_noise[i]) {
-            for (j = 0; j < sbr->n_q; j++)
-                ch_data->noise_facs[i + 1][j] = ch_data->noise_facs[i][j] + delta * (get_vlc2(gb, t_huff, 9, 2) - t_lav);
-        } else {
-            ch_data->noise_facs[i + 1][0] = delta * get_bits(gb, 5); // bs_noise_start_value_balance or bs_noise_start_value_level
-            for (j = 1; j < sbr->n_q; j++)
-                ch_data->noise_facs[i + 1][j] = ch_data->noise_facs[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav);
-        }
-    }
-
-    //assign 0th elements of noise_facs from last elements
-    memcpy(ch_data->noise_facs[0], ch_data->noise_facs[ch_data->bs_num_noise],
-           sizeof(ch_data->noise_facs[0]));
-}
-
-static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
-                               GetBitContext *gb,
-                               int bs_extension_id, int *num_bits_left)
-{
-    switch (bs_extension_id) {
-    case EXTENSION_ID_PS:
-        if (!ac->m4ac.ps) {
-            av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
-            skip_bits_long(gb, *num_bits_left); // bs_fill_bits
-            *num_bits_left = 0;
-        } else {
-#if 1
-            *num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps, *num_bits_left);
-#else
-            av_log_missing_feature(ac->avctx, "Parametric Stereo is", 0);
-            skip_bits_long(gb, *num_bits_left); // bs_fill_bits
-            *num_bits_left = 0;
-#endif
-        }
-        break;
-    default:
-        av_log_missing_feature(ac->avctx, "Reserved SBR extensions are", 1);
-        skip_bits_long(gb, *num_bits_left); // bs_fill_bits
-        *num_bits_left = 0;
-        break;
-    }
-}
-
-static int read_sbr_single_channel_element(AACContext *ac,
-                                            SpectralBandReplication *sbr,
-                                            GetBitContext *gb)
-{
-    if (get_bits1(gb)) // bs_data_extra
-        skip_bits(gb, 4); // bs_reserved
-
-    if (read_sbr_grid(ac, sbr, gb, &sbr->data[0]))
-        return -1;
-    read_sbr_dtdf(sbr, gb, &sbr->data[0]);
-    read_sbr_invf(sbr, gb, &sbr->data[0]);
-    read_sbr_envelope(sbr, gb, &sbr->data[0], 0);
-    read_sbr_noise(sbr, gb, &sbr->data[0], 0);
-
-    if ((sbr->data[0].bs_add_harmonic_flag = get_bits1(gb)))
-        get_bits1_vector(gb, sbr->data[0].bs_add_harmonic, sbr->n[1]);
-
-    return 0;
-}
-
-static int read_sbr_channel_pair_element(AACContext *ac,
-                                          SpectralBandReplication *sbr,
-                                          GetBitContext *gb)
-{
-    if (get_bits1(gb))    // bs_data_extra
-        skip_bits(gb, 8); // bs_reserved
-
-    if ((sbr->bs_coupling = get_bits1(gb))) {
-        if (read_sbr_grid(ac, sbr, gb, &sbr->data[0]))
-            return -1;
-        copy_sbr_grid(&sbr->data[1], &sbr->data[0]);
-        read_sbr_dtdf(sbr, gb, &sbr->data[0]);
-        read_sbr_dtdf(sbr, gb, &sbr->data[1]);
-        read_sbr_invf(sbr, gb, &sbr->data[0]);
-        memcpy(sbr->data[1].bs_invf_mode[1], sbr->data[1].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0]));
-        memcpy(sbr->data[1].bs_invf_mode[0], sbr->data[0].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0]));
-        read_sbr_envelope(sbr, gb, &sbr->data[0], 0);
-        read_sbr_noise(sbr, gb, &sbr->data[0], 0);
-        read_sbr_envelope(sbr, gb, &sbr->data[1], 1);
-        read_sbr_noise(sbr, gb, &sbr->data[1], 1);
-    } else {
-        if (read_sbr_grid(ac, sbr, gb, &sbr->data[0]) ||
-            read_sbr_grid(ac, sbr, gb, &sbr->data[1]))
-            return -1;
-        read_sbr_dtdf(sbr, gb, &sbr->data[0]);
-        read_sbr_dtdf(sbr, gb, &sbr->data[1]);
-        read_sbr_invf(sbr, gb, &sbr->data[0]);
-        read_sbr_invf(sbr, gb, &sbr->data[1]);
-        read_sbr_envelope(sbr, gb, &sbr->data[0], 0);
-        read_sbr_envelope(sbr, gb, &sbr->data[1], 1);
-        read_sbr_noise(sbr, gb, &sbr->data[0], 0);
-        read_sbr_noise(sbr, gb, &sbr->data[1], 1);
-    }
-
-    if ((sbr->data[0].bs_add_harmonic_flag = get_bits1(gb)))
-        get_bits1_vector(gb, sbr->data[0].bs_add_harmonic, sbr->n[1]);
-    if ((sbr->data[1].bs_add_harmonic_flag = get_bits1(gb)))
-        get_bits1_vector(gb, sbr->data[1].bs_add_harmonic, sbr->n[1]);
-
-    return 0;
-}
-
-static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
-                                  GetBitContext *gb, int id_aac)
-{
-    unsigned int cnt = get_bits_count(gb);
-
-    if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
-        if (read_sbr_single_channel_element(ac, sbr, gb)) {
-            sbr->start = 0;
-            return get_bits_count(gb) - cnt;
-        }
-    } else if (id_aac == TYPE_CPE) {
-        if (read_sbr_channel_pair_element(ac, sbr, gb)) {
-            sbr->start = 0;
-            return get_bits_count(gb) - cnt;
-        }
-    } else {
-        av_log(ac->avctx, AV_LOG_ERROR,
-            "Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);
-        sbr->start = 0;
-        return get_bits_count(gb) - cnt;
-    }
-    if (get_bits1(gb)) { // bs_extended_data
-        int num_bits_left = get_bits(gb, 4); // bs_extension_size
-        if (num_bits_left == 15)
-            num_bits_left += get_bits(gb, 8); // bs_esc_count
-
-        num_bits_left <<= 3;
-        while (num_bits_left > 7) {
-            num_bits_left -= 2;
-            read_sbr_extension(ac, sbr, gb, get_bits(gb, 2), &num_bits_left); // bs_extension_id
-        }
-        if (num_bits_left < 0) {
-            av_log(ac->avctx, AV_LOG_ERROR, "SBR Extension over read.\n");
-        }
-        if (num_bits_left > 0)
-            skip_bits(gb, num_bits_left);
-    }
-
-    return get_bits_count(gb) - cnt;
-}
-
-static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
-{
-    int err;
-    err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params);
-    if (err >= 0)
-        err = sbr_make_f_derived(ac, sbr);
-    if (err < 0) {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "SBR reset failed. Switching SBR to pure upsampling mode.\n");
-        sbr->start = 0;
-    }
-}
-
-/**
- * Decode Spectral Band Replication extension data; reference: table 4.55.
- *
- * @param   crc flag indicating the presence of CRC checksum
- * @param   cnt length of TYPE_FIL syntactic element in bytes
- *
- * @return  Returns number of bytes consumed from the TYPE_FIL element.
- */
-int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
-                            GetBitContext *gb_host, int crc, int cnt, int id_aac)
-{
-    unsigned int num_sbr_bits = 0, num_align_bits;
-    unsigned bytes_read;
-    GetBitContext gbc = *gb_host, *gb = &gbc;
-    skip_bits_long(gb_host, cnt*8 - 4);
-
-    sbr->reset = 0;
-
-    if (!sbr->sample_rate)
-        sbr->sample_rate = 2 * ac->m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support
-    if (!ac->m4ac.ext_sample_rate)
-        ac->m4ac.ext_sample_rate = 2 * ac->m4ac.sample_rate;
-
-    if (crc) {
-        skip_bits(gb, 10); // bs_sbr_crc_bits; TODO - implement CRC check
-        num_sbr_bits += 10;
-    }
-
-    //Save some state from the previous frame.
-    sbr->kx[0] = sbr->kx[1];
-    sbr->m[0] = sbr->m[1];
-
-    num_sbr_bits++;
-    if (get_bits1(gb)) // bs_header_flag
-        num_sbr_bits += read_sbr_header(sbr, gb);
-
-    if (sbr->reset)
-        sbr_reset(ac, sbr);
-
-    if (sbr->start)
-        num_sbr_bits  += read_sbr_data(ac, sbr, gb, id_aac);
-
-    num_align_bits = ((cnt << 3) - 4 - num_sbr_bits) & 7;
-    bytes_read = ((num_sbr_bits + num_align_bits + 4) >> 3);
-
-    if (bytes_read > cnt) {
-        av_log(ac->avctx, AV_LOG_ERROR,
-               "Expected to read %d SBR bytes actually read %d.\n", cnt, bytes_read);
-    }
-    return cnt;
-}
-
-/// Dequantization and stereo decoding (14496-3 sp04 p203)
-static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
-{
-    int k, e;
-    int ch;
-
-    if (id_aac == TYPE_CPE && sbr->bs_coupling) {
-        float alpha      = sbr->data[0].bs_amp_res ?  1.0f :  0.5f;
-        float pan_offset = sbr->data[0].bs_amp_res ? 12.0f : 24.0f;
-        for (e = 1; e <= sbr->data[0].bs_num_env; e++) {
-            for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) {
-                float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f);
-                float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha);
-                float fac   = temp1 / (1.0f + temp2);
-                sbr->data[0].env_facs[e][k] = fac;
-                sbr->data[1].env_facs[e][k] = fac * temp2;
-            }
-        }
-        for (e = 1; e <= sbr->data[0].bs_num_noise; e++) {
-            for (k = 0; k < sbr->n_q; k++) {
-                float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1);
-                float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]);
-                float fac   = temp1 / (1.0f + temp2);
-                sbr->data[0].noise_facs[e][k] = fac;
-                sbr->data[1].noise_facs[e][k] = fac * temp2;
-            }
-        }
-    } else { // SCE or one non-coupled CPE
-        for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) {
-            float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f;
-            for (e = 1; e <= sbr->data[ch].bs_num_env; e++)
-                for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++)
-                    sbr->data[ch].env_facs[e][k] =
-                        exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f);
-            for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)
-                for (k = 0; k < sbr->n_q; k++)
-                    sbr->data[ch].noise_facs[e][k] =
-                        exp2f(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs[e][k]);
-        }
-    }
-}
-
-/**
- * Analysis QMF Bank (14496-3 sp04 p206)
- *
- * @param   x       pointer to the beginning of the first sample window
- * @param   W       array of complex-valued samples split into subbands
- */
-static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x,
-                             float z[320], float W[2][32][32][2],
-                             float scale)
-{
-    int i, k;
-    memcpy(W[0], W[1], sizeof(W[0]));
-    memcpy(x    , x+1024, (320-32)*sizeof(x[0]));
-    if (scale != 1.0f)
-        dsp->vector_fmul_scalar(x+288, in, scale, 1024);
-    else
-        memcpy(x+288, in, 1024*sizeof(*x));
-    for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames
-                               // are not supported
-        dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320);
-        for (k = 0; k < 64; k++) {
-            float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256];
-            z[k] = f;
-        }
-        //Shuffle to IMDCT
-        z[64] = z[0];
-        for (k = 1; k < 32; k++) {
-            z[64+2*k-1] =  z[   k];
-            z[64+2*k  ] = -z[64-k];
-        }
-        z[64+63] = z[32];
-
-        ff_imdct_half(mdct, z, z+64);
-        for (k = 0; k < 32; k++) {
-            W[1][i][k][0] = -z[63-k];
-            W[1][i][k][1] = z[k];
-        }
-        x += 32;
-    }
-}
-
-/**
- * Synthesis QMF Bank (14496-3 sp04 p206) and Downsampled Synthesis QMF Bank
- * (14496-3 sp04 p206)
- */
-static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
-                              float *out, float X[2][38][64],
-                              float mdct_buf[2][64],
-                              float *v0, int *v_off, const unsigned int div,
-                              float bias, float scale)
-{
-    int i, n;
-    const float *sbr_qmf_window = div ? sbr_qmf_window_ds : sbr_qmf_window_us;
-    int scale_and_bias = scale != 1.0f || bias != 0.0f;
-    float *v;
-    for (i = 0; i < 32; i++) {
-        if (*v_off == 0) {
-            int saved_samples = (1280 - 128) >> div;
-            memcpy(&v0[SBR_SYNTHESIS_BUF_SIZE - saved_samples], v0, saved_samples * sizeof(float));
-            *v_off = SBR_SYNTHESIS_BUF_SIZE - saved_samples - (128 >> div);
-        } else {
-            *v_off -= 128 >> div;
-        }
-        v = v0 + *v_off;
-        if (div) {
-            for (n = 0; n < 32; n++) {
-                X[0][i][   n] = -X[0][i][n];
-                X[0][i][32+n] =  X[1][i][31-n];
-            }
-            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
-            for (n = 0; n < 32; n++) {
-                v[     n] =  mdct_buf[0][63 - 2*n];
-                v[63 - n] = -mdct_buf[0][62 - 2*n];
-            }
-        } else {
-            for (n = 1; n < 64; n+=2) {
-                X[1][i][n] = -X[1][i][n];
-            }
-            ff_imdct_half(mdct, mdct_buf[0], X[0][i]);
-            ff_imdct_half(mdct, mdct_buf[1], X[1][i]);
-            for (n = 0; n < 64; n++) {
-                v[      n] = -mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
-                v[127 - n] =  mdct_buf[0][63 -   n] + mdct_buf[1][  n    ];
-            }
-        }
-        dsp->vector_fmul_add(out, v                , sbr_qmf_window               , zero64, 64 >> div);
-        dsp->vector_fmul_add(out, v + ( 192 >> div), sbr_qmf_window + ( 64 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + ( 256 >> div), sbr_qmf_window + (128 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + ( 448 >> div), sbr_qmf_window + (192 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + ( 512 >> div), sbr_qmf_window + (256 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + ( 704 >> div), sbr_qmf_window + (320 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + ( 768 >> div), sbr_qmf_window + (384 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + ( 960 >> div), sbr_qmf_window + (448 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + (1024 >> div), sbr_qmf_window + (512 >> div), out   , 64 >> div);
-        dsp->vector_fmul_add(out, v + (1216 >> div), sbr_qmf_window + (576 >> div), out   , 64 >> div);
-        if (scale_and_bias)
-            for (n = 0; n < 64 >> div; n++)
-                out[n] = out[n] * scale + bias;
-        out += 64 >> div;
-    }
-}
-
-static void autocorrelate(const float x[40][2], float phi[3][2][2], int lag)
-{
-    int i;
-    float real_sum = 0.0f;
-    float imag_sum = 0.0f;
-    if (lag) {
-        for (i = 1; i < 38; i++) {
-            real_sum += x[i][0] * x[i+lag][0] + x[i][1] * x[i+lag][1];
-            imag_sum += x[i][0] * x[i+lag][1] - x[i][1] * x[i+lag][0];
-        }
-        phi[2-lag][1][0] = real_sum + x[ 0][0] * x[lag][0] + x[ 0][1] * x[lag][1];
-        phi[2-lag][1][1] = imag_sum + x[ 0][0] * x[lag][1] - x[ 0][1] * x[lag][0];
-        if (lag == 1) {
-            phi[0][0][0] = real_sum + x[38][0] * x[39][0] + x[38][1] * x[39][1];
-            phi[0][0][1] = imag_sum + x[38][0] * x[39][1] - x[38][1] * x[39][0];
-        }
-    } else {
-        for (i = 1; i < 38; i++) {
-            real_sum += x[i][0] * x[i][0] + x[i][1] * x[i][1];
-        }
-        phi[2][1][0] = real_sum + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1];
-        phi[1][0][0] = real_sum + x[38][0] * x[38][0] + x[38][1] * x[38][1];
-    }
-}
-
-/** High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering
- * (14496-3 sp04 p214)
- * Warning: This routine does not seem numerically stable.
- */
-static void sbr_hf_inverse_filter(float (*alpha0)[2], float (*alpha1)[2],
-                                  const float X_low[32][40][2], int k0)
-{
-    int k;
-    for (k = 0; k < k0; k++) {
-        float phi[3][2][2], dk;
-
-        autocorrelate(X_low[k], phi, 0);
-        autocorrelate(X_low[k], phi, 1);
-        autocorrelate(X_low[k], phi, 2);
-
-        dk =  phi[2][1][0] * phi[1][0][0] -
-             (phi[1][1][0] * phi[1][1][0] + phi[1][1][1] * phi[1][1][1]) / 1.000001f;
-
-        if (!dk) {
-            alpha1[k][0] = 0;
-            alpha1[k][1] = 0;
-        } else {
-            float temp_real, temp_im;
-            temp_real = phi[0][0][0] * phi[1][1][0] -
-                        phi[0][0][1] * phi[1][1][1] -
-                        phi[0][1][0] * phi[1][0][0];
-            temp_im   = phi[0][0][0] * phi[1][1][1] +
-                        phi[0][0][1] * phi[1][1][0] -
-                        phi[0][1][1] * phi[1][0][0];
-
-            alpha1[k][0] = temp_real / dk;
-            alpha1[k][1] = temp_im   / dk;
-        }
-
-        if (!phi[1][0][0]) {
-            alpha0[k][0] = 0;
-            alpha0[k][1] = 0;
-        } else {
-            float temp_real, temp_im;
-            temp_real = phi[0][0][0] + alpha1[k][0] * phi[1][1][0] +
-                                       alpha1[k][1] * phi[1][1][1];
-            temp_im   = phi[0][0][1] + alpha1[k][1] * phi[1][1][0] -
-                                       alpha1[k][0] * phi[1][1][1];
-
-            alpha0[k][0] = -temp_real / phi[1][0][0];
-            alpha0[k][1] = -temp_im   / phi[1][0][0];
-        }
-
-        if (alpha1[k][0] * alpha1[k][0] + alpha1[k][1] * alpha1[k][1] >= 16.0f ||
-           alpha0[k][0] * alpha0[k][0] + alpha0[k][1] * alpha0[k][1] >= 16.0f) {
-            alpha1[k][0] = 0;
-            alpha1[k][1] = 0;
-            alpha0[k][0] = 0;
-            alpha0[k][1] = 0;
-        }
-    }
-}
-
-/// Chirp Factors (14496-3 sp04 p214)
-static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data)
-{
-    int i;
-    float new_bw;
-    static const float bw_tab[] = { 0.0f, 0.75f, 0.9f, 0.98f };
-
-    for (i = 0; i < sbr->n_q; i++) {
-        if (ch_data->bs_invf_mode[0][i] + ch_data->bs_invf_mode[1][i] == 1) {
-            new_bw = 0.6f;
-        } else
-            new_bw = bw_tab[ch_data->bs_invf_mode[0][i]];
-
-        if (new_bw < ch_data->bw_array[i]) {
-            new_bw = 0.75f    * new_bw + 0.25f    * ch_data->bw_array[i];
-        } else
-            new_bw = 0.90625f * new_bw + 0.09375f * ch_data->bw_array[i];
-        ch_data->bw_array[i] = new_bw < 0.015625f ? 0.0f : new_bw;
-    }
-}
-
-/// Generate the subband filtered lowband
-static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr,
-                      float X_low[32][40][2], const float W[2][32][32][2])
-{
-    int i, k;
-    const int t_HFGen = 8;
-    const int i_f = 32;
-    memset(X_low, 0, 32*sizeof(*X_low));
-    for (k = 0; k < sbr->kx[1]; k++) {
-        for (i = t_HFGen; i < i_f + t_HFGen; i++) {
-            X_low[k][i][0] = W[1][i - t_HFGen][k][0];
-            X_low[k][i][1] = W[1][i - t_HFGen][k][1];
-        }
-    }
-    for (k = 0; k < sbr->kx[0]; k++) {
-        for (i = 0; i < t_HFGen; i++) {
-            X_low[k][i][0] = W[0][i + i_f - t_HFGen][k][0];
-            X_low[k][i][1] = W[0][i + i_f - t_HFGen][k][1];
-        }
-    }
-    return 0;
-}
-
-/// High Frequency Generator (14496-3 sp04 p215)
-static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
-                      float X_high[64][40][2], const float X_low[32][40][2],
-                      const float (*alpha0)[2], const float (*alpha1)[2],
-                      const float bw_array[5], const uint8_t *t_env,
-                      int bs_num_env)
-{
-    int i, j, x;
-    int g = 0;
-    int k = sbr->kx[1];
-    for (j = 0; j < sbr->num_patches; j++) {
-        for (x = 0; x < sbr->patch_num_subbands[j]; x++, k++) {
-            float alpha[4];
-            const int p = sbr->patch_start_subband[j] + x;
-            while (g <= sbr->n_q && k >= sbr->f_tablenoise[g])
-                g++;
-            g--;
-
-            if (g < 0) {
-                av_log(ac->avctx, AV_LOG_ERROR,
-                       "ERROR : no subband found for frequency %d\n", k);
-                return -1;
-            }
-
-            alpha[0] = alpha1[p][0] * bw_array[g] * bw_array[g];
-            alpha[1] = alpha1[p][1] * bw_array[g] * bw_array[g];
-            alpha[2] = alpha0[p][0] * bw_array[g];
-            alpha[3] = alpha0[p][1] * bw_array[g];
-
-            for (i = 2 * t_env[0]; i < 2 * t_env[bs_num_env]; i++) {
-                const int idx = i + ENVELOPE_ADJUSTMENT_OFFSET;
-                X_high[k][idx][0] =
-                    X_low[p][idx - 2][0] * alpha[0] -
-                    X_low[p][idx - 2][1] * alpha[1] +
-                    X_low[p][idx - 1][0] * alpha[2] -
-                    X_low[p][idx - 1][1] * alpha[3] +
-                    X_low[p][idx][0];
-                X_high[k][idx][1] =
-                    X_low[p][idx - 2][1] * alpha[0] +
-                    X_low[p][idx - 2][0] * alpha[1] +
-                    X_low[p][idx - 1][1] * alpha[2] +
-                    X_low[p][idx - 1][0] * alpha[3] +
-                    X_low[p][idx][1];
-            }
-        }
-    }
-    if (k < sbr->m[1] + sbr->kx[1])
-        memset(X_high + k, 0, (sbr->m[1] + sbr->kx[1] - k) * sizeof(*X_high));
-
-    return 0;
-}
-
-/// Generate the subband filtered lowband
-static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
-                     const float X_low[32][40][2], const float Y[2][38][64][2],
-                     int ch)
-{
-    int k, i;
-    const int i_f = 32;
-    const int i_Temp = FFMAX(2*sbr->data[ch].t_env_num_env_old - i_f, 0);
-    memset(X, 0, 2*sizeof(*X));
-    for (k = 0; k < sbr->kx[0]; k++) {
-        for (i = 0; i < i_Temp; i++) {
-            X[0][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][0];
-            X[1][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][1];
-        }
-    }
-    for (; k < sbr->kx[0] + sbr->m[0]; k++) {
-        for (i = 0; i < i_Temp; i++) {
-            X[0][i][k] = Y[0][i + i_f][k][0];
-            X[1][i][k] = Y[0][i + i_f][k][1];
-        }
-    }
-
-    for (k = 0; k < sbr->kx[1]; k++) {
-        for (i = i_Temp; i < 38; i++) {
-            X[0][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][0];
-            X[1][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][1];
-        }
-    }
-    for (; k < sbr->kx[1] + sbr->m[1]; k++) {
-        for (i = i_Temp; i < i_f; i++) {
-            X[0][i][k] = Y[1][i][k][0];
-            X[1][i][k] = Y[1][i][k][1];
-        }
-    }
-    return 0;
-}
-
-/** High Frequency Adjustment (14496-3 sp04 p217) and Mapping
- * (14496-3 sp04 p217)
- */
-static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
-                        SBRData *ch_data, int e_a[2])
-{
-    int e, i, m;
-
-    memset(ch_data->s_indexmapped[1], 0, 7*sizeof(ch_data->s_indexmapped[1]));
-    for (e = 0; e < ch_data->bs_num_env; e++) {
-        const unsigned int ilim = sbr->n[ch_data->bs_freq_res[e + 1]];
-        uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
-        int k;
-
-        for (i = 0; i < ilim; i++)
-            for (m = table[i]; m < table[i + 1]; m++)
-                sbr->e_origmapped[e][m - sbr->kx[1]] = ch_data->env_facs[e+1][i];
-
-        // ch_data->bs_num_noise > 1 => 2 noise floors
-        k = (ch_data->bs_num_noise > 1) && (ch_data->t_env[e] >= ch_data->t_q[1]);
-        for (i = 0; i < sbr->n_q; i++)
-            for (m = sbr->f_tablenoise[i]; m < sbr->f_tablenoise[i + 1]; m++)
-                sbr->q_mapped[e][m - sbr->kx[1]] = ch_data->noise_facs[k+1][i];
-
-        for (i = 0; i < sbr->n[1]; i++) {
-            if (ch_data->bs_add_harmonic_flag) {
-                const unsigned int m_midpoint =
-                    (sbr->f_tablehigh[i] + sbr->f_tablehigh[i + 1]) >> 1;
-
-                ch_data->s_indexmapped[e + 1][m_midpoint - sbr->kx[1]] = ch_data->bs_add_harmonic[i] *
-                    (e >= e_a[1] || (ch_data->s_indexmapped[0][m_midpoint - sbr->kx[1]] == 1));
-            }
-        }
-
-        for (i = 0; i < ilim; i++) {
-            int additional_sinusoid_present = 0;
-            for (m = table[i]; m < table[i + 1]; m++) {
-                if (ch_data->s_indexmapped[e + 1][m - sbr->kx[1]]) {
-                    additional_sinusoid_present = 1;
-                    break;
-                }
-            }
-            memset(&sbr->s_mapped[e][table[i] - sbr->kx[1]], additional_sinusoid_present,
-                   (table[i + 1] - table[i]) * sizeof(sbr->s_mapped[e][0]));
-        }
-    }
-
-    memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0]));
-}
-
-/// Estimation of current envelope (14496-3 sp04 p218)
-static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
-                             SpectralBandReplication *sbr, SBRData *ch_data)
-{
-    int e, i, m;
-
-    if (sbr->bs_interpol_freq) {
-        for (e = 0; e < ch_data->bs_num_env; e++) {
-            const float recip_env_size = 0.5f / (ch_data->t_env[e + 1] - ch_data->t_env[e]);
-            int ilb = ch_data->t_env[e]     * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
-            int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
-
-            for (m = 0; m < sbr->m[1]; m++) {
-                float sum = 0.0f;
-
-                for (i = ilb; i < iub; i++) {
-                    sum += X_high[m + sbr->kx[1]][i][0] * X_high[m + sbr->kx[1]][i][0] +
-                           X_high[m + sbr->kx[1]][i][1] * X_high[m + sbr->kx[1]][i][1];
-                }
-                e_curr[e][m] = sum * recip_env_size;
-            }
-        }
-    } else {
-        int k, p;
-
-        for (e = 0; e < ch_data->bs_num_env; e++) {
-            const int env_size = 2 * (ch_data->t_env[e + 1] - ch_data->t_env[e]);
-            int ilb = ch_data->t_env[e]     * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
-            int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
-            const uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
-
-            for (p = 0; p < sbr->n[ch_data->bs_freq_res[e + 1]]; p++) {
-                float sum = 0.0f;
-                const int den = env_size * (table[p + 1] - table[p]);
-
-                for (k = table[p]; k < table[p + 1]; k++) {
-                    for (i = ilb; i < iub; i++) {
-                        sum += X_high[k][i][0] * X_high[k][i][0] +
-                               X_high[k][i][1] * X_high[k][i][1];
-                    }
-                }
-                sum /= den;
-                for (k = table[p]; k < table[p + 1]; k++) {
-                    e_curr[e][k - sbr->kx[1]] = sum;
-                }
-            }
-        }
-    }
-}
-
-/**
- * Calculation of levels of additional HF signal components (14496-3 sp04 p219)
- * and Calculation of gain (14496-3 sp04 p219)
- */
-static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
-                          SBRData *ch_data, const int e_a[2])
-{
-    int e, k, m;
-    // max gain limits : -3dB, 0dB, 3dB, inf dB (limiter off)
-    static const float limgain[4] = { 0.70795, 1.0, 1.41254, 10000000000 };
-
-    for (e = 0; e < ch_data->bs_num_env; e++) {
-        int delta = !((e == e_a[1]) || (e == e_a[0]));
-        for (k = 0; k < sbr->n_lim; k++) {
-            float gain_boost, gain_max;
-            float sum[2] = { 0.0f, 0.0f };
-            for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
-                const float temp = sbr->e_origmapped[e][m] / (1.0f + sbr->q_mapped[e][m]);
-                sbr->q_m[e][m] = sqrtf(temp * sbr->q_mapped[e][m]);
-                sbr->s_m[e][m] = sqrtf(temp * ch_data->s_indexmapped[e + 1][m]);
-                if (!sbr->s_mapped[e][m]) {
-                    sbr->gain[e][m] = sqrtf(sbr->e_origmapped[e][m] /
-                                            ((1.0f + sbr->e_curr[e][m]) *
-                                             (1.0f + sbr->q_mapped[e][m] * delta)));
-                } else {
-                    sbr->gain[e][m] = sqrtf(sbr->e_origmapped[e][m] * sbr->q_mapped[e][m] /
-                                            ((1.0f + sbr->e_curr[e][m]) *
-                                             (1.0f + sbr->q_mapped[e][m])));
-                }
-            }
-            for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
-                sum[0] += sbr->e_origmapped[e][m];
-                sum[1] += sbr->e_curr[e][m];
-            }
-            gain_max = limgain[sbr->bs_limiter_gains] * sqrtf((FLT_EPSILON + sum[0]) / (FLT_EPSILON + sum[1]));
-            gain_max = FFMIN(100000, gain_max);
-            for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
-                float q_m_max   = sbr->q_m[e][m] * gain_max / sbr->gain[e][m];
-                sbr->q_m[e][m]  = FFMIN(sbr->q_m[e][m], q_m_max);
-                sbr->gain[e][m] = FFMIN(sbr->gain[e][m], gain_max);
-            }
-            sum[0] = sum[1] = 0.0f;
-            for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
-                sum[0] += sbr->e_origmapped[e][m];
-                sum[1] += sbr->e_curr[e][m] * sbr->gain[e][m] * sbr->gain[e][m]
-                          + sbr->s_m[e][m] * sbr->s_m[e][m]
-                          + (delta && !sbr->s_m[e][m]) * sbr->q_m[e][m] * sbr->q_m[e][m];
-            }
-            gain_boost = sqrtf((FLT_EPSILON + sum[0]) / (FLT_EPSILON + sum[1]));
-            gain_boost = FFMIN(1.584893192, gain_boost);
-            for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
-                sbr->gain[e][m] *= gain_boost;
-                sbr->q_m[e][m]  *= gain_boost;
-                sbr->s_m[e][m]  *= gain_boost;
-            }
-        }
-    }
-}
-
-/// Assembling HF Signals (14496-3 sp04 p220)
-static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2],
-                            SpectralBandReplication *sbr, SBRData *ch_data,
-                            const int e_a[2])
-{
-    int e, i, j, m;
-    const int h_SL = 4 * !sbr->bs_smoothing_mode;
-    const int kx = sbr->kx[1];
-    const int m_max = sbr->m[1];
-    static const float h_smooth[5] = {
-        0.33333333333333,
-        0.30150283239582,
-        0.21816949906249,
-        0.11516383427084,
-        0.03183050093751,
-    };
-    static const int8_t phi[2][4] = {
-        {  1,  0, -1,  0}, // real
-        {  0,  1,  0, -1}, // imaginary
-    };
-    float (*g_temp)[48] = ch_data->g_temp, (*q_temp)[48] = ch_data->q_temp;
-    int indexnoise = ch_data->f_indexnoise;
-    int indexsine  = ch_data->f_indexsine;
-    memcpy(Y[0], Y[1], sizeof(Y[0]));
-
-    if (sbr->reset) {
-        for (i = 0; i < h_SL; i++) {
-            memcpy(g_temp[i + 2*ch_data->t_env[0]], sbr->gain[0], m_max * sizeof(sbr->gain[0][0]));
-            memcpy(q_temp[i + 2*ch_data->t_env[0]], sbr->q_m[0],  m_max * sizeof(sbr->q_m[0][0]));
-        }
-    } else if (h_SL) {
-        memcpy(g_temp[2*ch_data->t_env[0]], g_temp[2*ch_data->t_env_num_env_old], 4*sizeof(g_temp[0]));
-        memcpy(q_temp[2*ch_data->t_env[0]], q_temp[2*ch_data->t_env_num_env_old], 4*sizeof(q_temp[0]));
-    }
-
-    for (e = 0; e < ch_data->bs_num_env; e++) {
-        for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) {
-            memcpy(g_temp[h_SL + i], sbr->gain[e], m_max * sizeof(sbr->gain[0][0]));
-            memcpy(q_temp[h_SL + i], sbr->q_m[e],  m_max * sizeof(sbr->q_m[0][0]));
-        }
-    }
-
-    for (e = 0; e < ch_data->bs_num_env; e++) {
-        for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) {
-            int phi_sign = (1 - 2*(kx & 1));
-
-            if (h_SL && e != e_a[0] && e != e_a[1]) {
-                for (m = 0; m < m_max; m++) {
-                    const int idx1 = i + h_SL;
-                    float g_filt = 0.0f;
-                    for (j = 0; j <= h_SL; j++)
-                        g_filt += g_temp[idx1 - j][m] * h_smooth[j];
-                    Y[1][i][m + kx][0] =
-                        X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt;
-                    Y[1][i][m + kx][1] =
-                        X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt;
-                }
-            } else {
-                for (m = 0; m < m_max; m++) {
-                    const float g_filt = g_temp[i + h_SL][m];
-                    Y[1][i][m + kx][0] =
-                        X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt;
-                    Y[1][i][m + kx][1] =
-                        X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt;
-                }
-            }
-
-            if (e != e_a[0] && e != e_a[1]) {
-                for (m = 0; m < m_max; m++) {
-                    indexnoise = (indexnoise + 1) & 0x1ff;
-                    if (sbr->s_m[e][m]) {
-                        Y[1][i][m + kx][0] +=
-                            sbr->s_m[e][m] * phi[0][indexsine];
-                        Y[1][i][m + kx][1] +=
-                            sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
-                    } else {
-                        float q_filt;
-                        if (h_SL) {
-                            const int idx1 = i + h_SL;
-                            q_filt = 0.0f;
-                            for (j = 0; j <= h_SL; j++)
-                                q_filt += q_temp[idx1 - j][m] * h_smooth[j];
-                        } else {
-                            q_filt = q_temp[i][m];
-                        }
-                        Y[1][i][m + kx][0] +=
-                            q_filt * sbr_noise_table[indexnoise][0];
-                        Y[1][i][m + kx][1] +=
-                            q_filt * sbr_noise_table[indexnoise][1];
-                    }
-                    phi_sign = -phi_sign;
-                }
-            } else {
-                indexnoise = (indexnoise + m_max) & 0x1ff;
-                for (m = 0; m < m_max; m++) {
-                    Y[1][i][m + kx][0] +=
-                        sbr->s_m[e][m] * phi[0][indexsine];
-                    Y[1][i][m + kx][1] +=
-                        sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
-                    phi_sign = -phi_sign;
-                }
-            }
-            indexsine = (indexsine + 1) & 3;
-        }
-    }
-    ch_data->f_indexnoise = indexnoise;
-    ch_data->f_indexsine  = indexsine;
-}
-
-void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
-                  float* L, float* R)
-{
-    int downsampled = ac->m4ac.ext_sample_rate < sbr->sample_rate;
-    int ch;
-    int nch = (id_aac == TYPE_CPE) ? 2 : 1;
-
-    if (sbr->start) {
-        sbr_dequant(sbr, id_aac);
-    }
-    for (ch = 0; ch < nch; ch++) {
-        /* decode channel */
-        sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
-                         (float*)sbr->qmf_filter_scratch,
-                         sbr->data[ch].W, 1/(-1024 * ac->sf_scale));
-        sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W);
-        if (sbr->start) {
-            sbr_hf_inverse_filter(sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]);
-            sbr_chirp(sbr, &sbr->data[ch]);
-            sbr_hf_gen(ac, sbr, sbr->X_high, sbr->X_low, sbr->alpha0, sbr->alpha1,
-                       sbr->data[ch].bw_array, sbr->data[ch].t_env,
-                       sbr->data[ch].bs_num_env);
-
-            // hf_adj
-            sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
-            sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
-            sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
-            sbr_hf_assemble(sbr->data[ch].Y, sbr->X_high, sbr, &sbr->data[ch],
-                            sbr->data[ch].e_a);
-        }
-
-        /* synthesis */
-        sbr_x_gen(sbr, sbr->X[ch], sbr->X_low, sbr->data[ch].Y, ch);
-    }
-
-    if (ac->m4ac.ps == 1) {
-        if (sbr->ps.start) {
-            ff_ps_apply(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
-        } else {
-            memcpy(sbr->X[1], sbr->X[0], sizeof(sbr->X[0]));
-        }
-        nch = 2;
-    }
-
-    sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X[0], sbr->qmf_filter_scratch,
-                      sbr->data[0].synthesis_filterbank_samples,
-                      &sbr->data[0].synthesis_filterbank_samples_offset,
-                      downsampled,
-                      ac->add_bias, -1024 * ac->sf_scale);
-    if (nch == 2)
-        sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, R, sbr->X[1], sbr->qmf_filter_scratch,
-                          sbr->data[1].synthesis_filterbank_samples,
-                          &sbr->data[1].synthesis_filterbank_samples_offset,
-                          downsampled,
-                          ac->add_bias, -1024 * ac->sf_scale);
-}
diff --git a/libavcodec/aacsbr.h b/libavcodec/aacsbr.h
deleted file mode 100644
index 6b10ed4..0000000
--- a/libavcodec/aacsbr.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * AAC Spectral Band Replication function declarations
- * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
- * Copyright (c) 2010      Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC Spectral Band Replication function declarations
- * @author Robert Swain ( rob opendot cl )
- */
-
-#ifndef AVCODEC_AACSBR_H
-#define AVCODEC_AACSBR_H
-
-#include "get_bits.h"
-#include "aac.h"
-#include "sbr.h"
-
-/** Initialize SBR. */
-av_cold void ff_aac_sbr_init(void);
-/** Initialize one SBR context. */
-av_cold void ff_aac_sbr_ctx_init(SpectralBandReplication *sbr);
-/** Close one SBR context. */
-av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr);
-/** Decode one SBR element. */
-int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
-                            GetBitContext *gb, int crc, int cnt, int id_aac);
-/** Apply one SBR element to one AAC element. */
-void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
-                  float* L, float *R);
-
-#endif /* AVCODEC_AACSBR_H */
diff --git a/libavcodec/aacsbrdata.h b/libavcodec/aacsbrdata.h
deleted file mode 100644
index 5d33a60..0000000
--- a/libavcodec/aacsbrdata.h
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * AAC Spectral Band Replication decoding data
- * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC Spectral Band Replication decoding data
- * @author Robert Swain ( rob opendot cl )
- */
-
-#ifndef AVCODEC_AACSBRDATA_H
-#define AVCODEC_AACSBRDATA_H
-
-#include <stdint.h>
-#include "libavutil/mem.h"
-
-///< Huffman tables for SBR
-
-static const uint8_t t_huffman_env_1_5dB_bits[121] = {
-    18, 18, 18, 18, 18, 18, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 17, 18, 16, 17, 18, 17,
-    16, 16, 16, 16, 15, 14, 14, 13,
-    13, 12, 11, 10,  9,  8,  7,  6,
-     5,  4,  3,  2,  2,  3,  4,  5,
-     6,  7,  8,  9, 10, 12, 13, 14,
-    14, 15, 16, 17, 16, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19,
-};
-
-static const uint32_t t_huffman_env_1_5dB_codes[121] = {
-    0x3ffd6, 0x3ffd7, 0x3ffd8, 0x3ffd9, 0x3ffda, 0x3ffdb, 0x7ffb8, 0x7ffb9,
-    0x7ffba, 0x7ffbb, 0x7ffbc, 0x7ffbd, 0x7ffbe, 0x7ffbf, 0x7ffc0, 0x7ffc1,
-    0x7ffc2, 0x7ffc3, 0x7ffc4, 0x7ffc5, 0x7ffc6, 0x7ffc7, 0x7ffc8, 0x7ffc9,
-    0x7ffca, 0x7ffcb, 0x7ffcc, 0x7ffcd, 0x7ffce, 0x7ffcf, 0x7ffd0, 0x7ffd1,
-    0x7ffd2, 0x7ffd3, 0x1ffe6, 0x3ffd4, 0x0fff0, 0x1ffe9, 0x3ffd5, 0x1ffe7,
-    0x0fff1, 0x0ffec, 0x0ffed, 0x0ffee, 0x07ff4, 0x03ff9, 0x03ff7, 0x01ffa,
-    0x01ff9, 0x00ffb, 0x007fc, 0x003fc, 0x001fd, 0x000fd, 0x0007d, 0x0003d,
-    0x0001d, 0x0000d, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000c, 0x0001c,
-    0x0003c, 0x0007c, 0x000fc, 0x001fc, 0x003fd, 0x00ffa, 0x01ff8, 0x03ff6,
-    0x03ff8, 0x07ff5, 0x0ffef, 0x1ffe8, 0x0fff2, 0x7ffd4, 0x7ffd5, 0x7ffd6,
-    0x7ffd7, 0x7ffd8, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde,
-    0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6,
-    0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x7ffed, 0x7ffee,
-    0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6,
-    0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe,
-    0x7ffff,
-};
-
-static const uint8_t f_huffman_env_1_5dB_bits[121] = {
-    19, 19, 20, 20, 20, 20, 20, 20,
-    20, 19, 20, 20, 20, 20, 19, 20,
-    19, 19, 20, 18, 20, 20, 20, 19,
-    20, 20, 20, 19, 20, 19, 18, 19,
-    18, 18, 17, 18, 17, 17, 17, 16,
-    16, 16, 15, 15, 14, 13, 13, 12,
-    12, 11, 10,  9,  9,  8,  7,  6,
-     5,  4,  3,  2,  2,  3,  4,  5,
-     6,  8,  8,  9, 10, 11, 11, 11,
-    12, 12, 13, 13, 14, 14, 16, 16,
-    17, 17, 18, 18, 18, 18, 18, 18,
-    18, 20, 19, 20, 20, 20, 20, 20,
-    20, 19, 20, 20, 20, 20, 19, 20,
-    18, 20, 20, 19, 19, 20, 20, 20,
-    20, 20, 20, 20, 20, 20, 20, 20,
-    20,
-};
-
-static const uint32_t f_huffman_env_1_5dB_codes[121] = {
-    0x7ffe7, 0x7ffe8, 0xfffd2, 0xfffd3, 0xfffd4, 0xfffd5, 0xfffd6, 0xfffd7,
-    0xfffd8, 0x7ffda, 0xfffd9, 0xfffda, 0xfffdb, 0xfffdc, 0x7ffdb, 0xfffdd,
-    0x7ffdc, 0x7ffdd, 0xfffde, 0x3ffe4, 0xfffdf, 0xfffe0, 0xfffe1, 0x7ffde,
-    0xfffe2, 0xfffe3, 0xfffe4, 0x7ffdf, 0xfffe5, 0x7ffe0, 0x3ffe8, 0x7ffe1,
-    0x3ffe0, 0x3ffe9, 0x1ffef, 0x3ffe5, 0x1ffec, 0x1ffed, 0x1ffee, 0x0fff4,
-    0x0fff3, 0x0fff0, 0x07ff7, 0x07ff6, 0x03ffa, 0x01ffa, 0x01ff9, 0x00ffa,
-    0x00ff8, 0x007f9, 0x003fb, 0x001fc, 0x001fa, 0x000fb, 0x0007c, 0x0003c,
-    0x0001c, 0x0000c, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000d, 0x0001d,
-    0x0003d, 0x000fa, 0x000fc, 0x001fb, 0x003fa, 0x007f8, 0x007fa, 0x007fb,
-    0x00ff9, 0x00ffb, 0x01ff8, 0x01ffb, 0x03ff8, 0x03ff9, 0x0fff1, 0x0fff2,
-    0x1ffea, 0x1ffeb, 0x3ffe1, 0x3ffe2, 0x3ffea, 0x3ffe3, 0x3ffe6, 0x3ffe7,
-    0x3ffeb, 0xfffe6, 0x7ffe2, 0xfffe7, 0xfffe8, 0xfffe9, 0xfffea, 0xfffeb,
-    0xfffec, 0x7ffe3, 0xfffed, 0xfffee, 0xfffef, 0xffff0, 0x7ffe4, 0xffff1,
-    0x3ffec, 0xffff2, 0xffff3, 0x7ffe5, 0x7ffe6, 0xffff4, 0xffff5, 0xffff6,
-    0xffff7, 0xffff8, 0xffff9, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe,
-    0xfffff,
-};
-
-static const uint8_t t_huffman_env_bal_1_5dB_bits[49] = {
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 12, 11,  9,  7,  5,  3,
-     1,  2,  4,  6,  8, 11, 12, 15,
-    16, 16, 16, 16, 16, 16, 16, 17,
-    17, 17, 17, 17, 17, 17, 17, 17,
-    17,
-};
-
-static const uint32_t t_huffman_env_bal_1_5dB_codes[49] = {
-    0x0ffe4, 0x0ffe5, 0x0ffe6, 0x0ffe7, 0x0ffe8, 0x0ffe9, 0x0ffea, 0x0ffeb,
-    0x0ffec, 0x0ffed, 0x0ffee, 0x0ffef, 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3,
-    0x0fff4, 0x0ffe2, 0x00ffc, 0x007fc, 0x001fe, 0x0007e, 0x0001e, 0x00006,
-    0x00000, 0x00002, 0x0000e, 0x0003e, 0x000fe, 0x007fd, 0x00ffd, 0x07ff0,
-    0x0ffe3, 0x0fff5, 0x0fff6, 0x0fff7, 0x0fff8, 0x0fff9, 0x0fffa, 0x1fff6,
-    0x1fff7, 0x1fff8, 0x1fff9, 0x1fffa, 0x1fffb, 0x1fffc, 0x1fffd, 0x1fffe,
-    0x1ffff,
-};
-
-static const uint8_t f_huffman_env_bal_1_5dB_bits[49] = {
-    18, 18, 18, 18, 18, 18, 18, 18,
-    18, 18, 18, 18, 18, 18, 18, 16,
-    17, 14, 11, 11,  8,  7,  4,  2,
-     1,  3,  5,  6,  9, 11, 12, 15,
-    16, 18, 18, 18, 18, 18, 18, 18,
-    18, 18, 18, 18, 18, 18, 18, 19,
-    19,
-};
-
-static const uint32_t f_huffman_env_bal_1_5dB_codes[49] = {
-    0x3ffe2, 0x3ffe3, 0x3ffe4, 0x3ffe5, 0x3ffe6, 0x3ffe7, 0x3ffe8, 0x3ffe9,
-    0x3ffea, 0x3ffeb, 0x3ffec, 0x3ffed, 0x3ffee, 0x3ffef, 0x3fff0, 0x0fff7,
-    0x1fff0, 0x03ffc, 0x007fe, 0x007fc, 0x000fe, 0x0007e, 0x0000e, 0x00002,
-    0x00000, 0x00006, 0x0001e, 0x0003e, 0x001fe, 0x007fd, 0x00ffe, 0x07ffa,
-    0x0fff6, 0x3fff1, 0x3fff2, 0x3fff3, 0x3fff4, 0x3fff5, 0x3fff6, 0x3fff7,
-    0x3fff8, 0x3fff9, 0x3fffa, 0x3fffb, 0x3fffc, 0x3fffd, 0x3fffe, 0x7fffe,
-    0x7ffff,
-};
-
-static const uint8_t t_huffman_env_3_0dB_bits[63] = {
-    18, 18, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 17, 16, 16, 16, 14, 14, 14,
-    13, 12, 11,  8,  6,  4,  2,  1,
-     3,  5,  7,  9, 11, 13, 14, 14,
-    15, 16, 17, 18, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19,
-};
-
-static const uint32_t t_huffman_env_3_0dB_codes[63] = {
-    0x3ffed, 0x3ffee, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3,
-    0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb,
-    0x7ffec, 0x1fff4, 0x0fff7, 0x0fff9, 0x0fff8, 0x03ffb, 0x03ffa, 0x03ff8,
-    0x01ffa, 0x00ffc, 0x007fc, 0x000fe, 0x0003e, 0x0000e, 0x00002, 0x00000,
-    0x00006, 0x0001e, 0x0007e, 0x001fe, 0x007fd, 0x01ffb, 0x03ff9, 0x03ffc,
-    0x07ffa, 0x0fff6, 0x1fff5, 0x3ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0,
-    0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8,
-    0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff,
-};
-
-static const uint8_t f_huffman_env_3_0dB_bits[63] = {
-    20, 20, 20, 20, 20, 20, 20, 18,
-    19, 19, 19, 19, 18, 18, 20, 19,
-    17, 18, 17, 16, 16, 15, 14, 12,
-    11, 10,  9,  8,  6,  4,  2,  1,
-     3,  5,  8,  9, 10, 11, 12, 13,
-    14, 15, 15, 16, 16, 17, 17, 18,
-    18, 18, 20, 19, 19, 19, 20, 19,
-    19, 20, 20, 20, 20, 20, 20,
-};
-
-static const uint32_t f_huffman_env_3_0dB_codes[63] = {
-    0xffff0, 0xffff1, 0xffff2, 0xffff3, 0xffff4, 0xffff5, 0xffff6, 0x3fff3,
-    0x7fff5, 0x7ffee, 0x7ffef, 0x7fff6, 0x3fff4, 0x3fff2, 0xffff7, 0x7fff0,
-    0x1fff5, 0x3fff0, 0x1fff4, 0x0fff7, 0x0fff6, 0x07ff8, 0x03ffb, 0x00ffd,
-    0x007fd, 0x003fd, 0x001fd, 0x000fd, 0x0003e, 0x0000e, 0x00002, 0x00000,
-    0x00006, 0x0001e, 0x000fc, 0x001fc, 0x003fc, 0x007fc, 0x00ffc, 0x01ffc,
-    0x03ffa, 0x07ff9, 0x07ffa, 0x0fff8, 0x0fff9, 0x1fff6, 0x1fff7, 0x3fff5,
-    0x3fff6, 0x3fff1, 0xffff8, 0x7fff1, 0x7fff2, 0x7fff3, 0xffff9, 0x7fff7,
-    0x7fff4, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff,
-};
-
-static const uint8_t t_huffman_env_bal_3_0dB_bits[25] = {
-    13, 13, 13, 13, 13, 13, 13, 12,
-     8,  7,  4,  3,  1,  2,  5,  6,
-     9, 13, 13, 13, 13, 13, 13, 14,
-    14,
-};
-
-static const uint16_t t_huffman_env_bal_3_0dB_codes[25] = {
-    0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x0ff8,
-    0x00fe, 0x007e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x003e,
-    0x01fe, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe,
-    0x3fff,
-};
-
-static const uint8_t f_huffman_env_bal_3_0dB_bits[25] = {
-    13, 13, 13, 13, 13, 14, 14, 11,
-     8,  7,  4,  2,  1,  3,  5,  6,
-     9, 12, 13, 14, 14, 14, 14, 14,
-    14,
-};
-
-static const uint16_t f_huffman_env_bal_3_0dB_codes[25] = {
-    0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x3ff8, 0x3ff9, 0x07fc,
-    0x00fe, 0x007e, 0x000e, 0x0002, 0x0000, 0x0006, 0x001e, 0x003e,
-    0x01fe, 0x0ffa, 0x1ff6, 0x3ffa, 0x3ffb, 0x3ffc, 0x3ffd, 0x3ffe,
-    0x3fff,
-};
-
-static const uint8_t t_huffman_noise_3_0dB_bits[63] = {
-    13, 13, 13, 13, 13, 13, 13, 13,
-    13, 13, 13, 13, 13, 13, 13, 13,
-    13, 13, 13, 13, 13, 13, 13, 13,
-    13, 13, 11,  8,  6,  4,  3,  1,
-     2,  5,  8, 10, 13, 13, 13, 13,
-    13, 13, 13, 13, 13, 13, 13, 13,
-    13, 13, 13, 13, 13, 13, 13, 13,
-    13, 13, 13, 13, 13, 14, 14,
-};
-
-static const uint16_t t_huffman_noise_3_0dB_codes[63] = {
-    0x1fce, 0x1fcf, 0x1fd0, 0x1fd1, 0x1fd2, 0x1fd3, 0x1fd4, 0x1fd5,
-    0x1fd6, 0x1fd7, 0x1fd8, 0x1fd9, 0x1fda, 0x1fdb, 0x1fdc, 0x1fdd,
-    0x1fde, 0x1fdf, 0x1fe0, 0x1fe1, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe5,
-    0x1fe6, 0x1fe7, 0x07f2, 0x00fd, 0x003e, 0x000e, 0x0006, 0x0000,
-    0x0002, 0x001e, 0x00fc, 0x03f8, 0x1fcc, 0x1fe8, 0x1fe9, 0x1fea,
-    0x1feb, 0x1fec, 0x1fcd, 0x1fed, 0x1fee, 0x1fef, 0x1ff0, 0x1ff1,
-    0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x1ff9,
-    0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff,
-};
-
-static const uint8_t t_huffman_noise_bal_3_0dB_bits[25] = {
-    8, 8, 8, 8, 8, 8, 8, 8,
-    8, 8, 5, 2, 1, 3, 6, 8,
-    8, 8, 8, 8, 8, 8, 8, 8,
-    8,
-};
-
-static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = {
-    0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3,
-    0xf4, 0xf5, 0x1c, 0x02, 0x00, 0x06, 0x3a, 0xf6,
-    0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
-    0xff,
-};
-
-static const int8_t sbr_offset[6][16] = {
-    {-8, -7, -6, -5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5,  6,  7}, //             fs_sbr  = 16000 Hz
-    {-5, -4, -3, -2, -1,  0,  1,  2,  3,  4,  5,  6,  7,  9, 11, 13}, //             fs_sbr  = 22050 Hz
-    {-5, -3, -2, -1,  0,  1,  2,  3,  4,  5,  6,  7,  9, 11, 13, 16}, //             fs_sbr  = 24000 Hz
-    {-6, -4, -2, -1,  0,  1,  2,  3,  4,  5,  6,  7,  9, 11, 13, 16}, //             fs_sbr  = 32000 Hz
-    {-4, -2, -1,  0,  1,  2,  3,  4,  5,  6,  7,  9, 11, 13, 16, 20}, // 44100 Hz <= fs_sbr <= 64000 Hz
-    {-2, -1,  0,  1,  2,  3,  4,  5,  6,  7,  9, 11, 13, 16, 20, 24}, // 64000 Hz <  fs_sbr
-};
-
-///< window coefficients for analysis/synthesis QMF banks
-static DECLARE_ALIGNED(16, float, sbr_qmf_window_ds)[320];
-static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = {
-     0.0000000000, -0.0005525286, -0.0005617692, -0.0004947518,
-    -0.0004875227, -0.0004893791, -0.0005040714, -0.0005226564,
-    -0.0005466565, -0.0005677802, -0.0005870930, -0.0006132747,
-    -0.0006312493, -0.0006540333, -0.0006777690, -0.0006941614,
-    -0.0007157736, -0.0007255043, -0.0007440941, -0.0007490598,
-    -0.0007681371, -0.0007724848, -0.0007834332, -0.0007779869,
-    -0.0007803664, -0.0007801449, -0.0007757977, -0.0007630793,
-    -0.0007530001, -0.0007319357, -0.0007215391, -0.0006917937,
-    -0.0006650415, -0.0006341594, -0.0005946118, -0.0005564576,
-    -0.0005145572, -0.0004606325, -0.0004095121, -0.0003501175,
-    -0.0002896981, -0.0002098337, -0.0001446380, -0.0000617334,
-     0.0000134949,  0.0001094383,  0.0002043017,  0.0002949531,
-     0.0004026540,  0.0005107388,  0.0006239376,  0.0007458025,
-     0.0008608443,  0.0009885988,  0.0011250155,  0.0012577884,
-     0.0013902494,  0.0015443219,  0.0016868083,  0.0018348265,
-     0.0019841140,  0.0021461583,  0.0023017254,  0.0024625616,
-     0.0026201758,  0.0027870464,  0.0029469447,  0.0031125420,
-     0.0032739613,  0.0034418874,  0.0036008268,  0.0037603922,
-     0.0039207432,  0.0040819753,  0.0042264269,  0.0043730719,
-     0.0045209852,  0.0046606460,  0.0047932560,  0.0049137603,
-     0.0050393022,  0.0051407353,  0.0052461166,  0.0053471681,
-     0.0054196775,  0.0054876040,  0.0055475714,  0.0055938023,
-     0.0056220643,  0.0056455196,  0.0056389199,  0.0056266114,
-     0.0055917128,  0.0055404363,  0.0054753783,  0.0053838975,
-     0.0052715758,  0.0051382275,  0.0049839687,  0.0048109469,
-     0.0046039530,  0.0043801861,  0.0041251642,  0.0038456408,
-     0.0035401246,  0.0032091885,  0.0028446757,  0.0024508540,
-     0.0020274176,  0.0015784682,  0.0010902329,  0.0005832264,
-     0.0000276045, -0.0005464280, -0.0011568135, -0.0018039472,
-    -0.0024826723, -0.0031933778, -0.0039401124, -0.0047222596,
-    -0.0055337211, -0.0063792293, -0.0072615816, -0.0081798233,
-    -0.0091325329, -0.0101150215, -0.0111315548, -0.0121849995,
-     0.0132718220,  0.0143904666,  0.0155405553,  0.0167324712,
-     0.0179433381,  0.0191872431,  0.0204531793,  0.0217467550,
-     0.0230680169,  0.0244160992,  0.0257875847,  0.0271859429,
-     0.0286072173,  0.0300502657,  0.0315017608,  0.0329754081,
-     0.0344620948,  0.0359697560,  0.0374812850,  0.0390053679,
-     0.0405349170,  0.0420649094,  0.0436097542,  0.0451488405,
-     0.0466843027,  0.0482165720,  0.0497385755,  0.0512556155,
-     0.0527630746,  0.0542452768,  0.0557173648,  0.0571616450,
-     0.0585915683,  0.0599837480,  0.0613455171,  0.0626857808,
-     0.0639715898,  0.0652247106,  0.0664367512,  0.0676075985,
-     0.0687043828,  0.0697630244,  0.0707628710,  0.0717002673,
-     0.0725682583,  0.0733620255,  0.0741003642,  0.0747452558,
-     0.0753137336,  0.0758008358,  0.0761992479,  0.0764992170,
-     0.0767093490,  0.0768173975,  0.0768230011,  0.0767204924,
-     0.0765050718,  0.0761748321,  0.0757305756,  0.0751576255,
-     0.0744664394,  0.0736406005,  0.0726774642,  0.0715826364,
-     0.0703533073,  0.0689664013,  0.0674525021,  0.0657690668,
-     0.0639444805,  0.0619602779,  0.0598166570,  0.0575152691,
-     0.0550460034,  0.0524093821,  0.0495978676,  0.0466303305,
-     0.0434768782,  0.0401458278,  0.0366418116,  0.0329583930,
-     0.0290824006,  0.0250307561,  0.0207997072,  0.0163701258,
-     0.0117623832,  0.0069636862,  0.0019765601, -0.0032086896,
-    -0.0085711749, -0.0141288827, -0.0198834129, -0.0258227288,
-    -0.0319531274, -0.0382776572, -0.0447806821, -0.0514804176,
-    -0.0583705326, -0.0654409853, -0.0726943300, -0.0801372934,
-    -0.0877547536, -0.0955533352, -0.1035329531, -0.1116826931,
-    -0.1200077984, -0.1285002850, -0.1371551761, -0.1459766491,
-    -0.1549607071, -0.1640958855, -0.1733808172, -0.1828172548,
-    -0.1923966745, -0.2021250176, -0.2119735853, -0.2219652696,
-    -0.2320690870, -0.2423016884, -0.2526480309, -0.2631053299,
-    -0.2736634040, -0.2843214189, -0.2950716717, -0.3059098575,
-    -0.3168278913, -0.3278113727, -0.3388722693, -0.3499914122,
-     0.3611589903,  0.3723795546,  0.3836350013,  0.3949211761,
-     0.4062317676,  0.4175696896,  0.4289119920,  0.4402553754,
-     0.4515996535,  0.4629308085,  0.4742453214,  0.4855253091,
-     0.4967708254,  0.5079817500,  0.5191234970,  0.5302240895,
-     0.5412553448,  0.5522051258,  0.5630789140,  0.5738524131,
-     0.5845403235,  0.5951123086,  0.6055783538,  0.6159109932,
-     0.6261242695,  0.6361980107,  0.6461269695,  0.6559016302,
-     0.6655139880,  0.6749663190,  0.6842353293,  0.6933282376,
-     0.7022388719,  0.7109410426,  0.7194462634,  0.7277448900,
-     0.7358211758,  0.7436827863,  0.7513137456,  0.7587080760,
-     0.7658674865,  0.7727780881,  0.7794287519,  0.7858353120,
-     0.7919735841,  0.7978466413,  0.8034485751,  0.8087695004,
-     0.8138191270,  0.8185776004,  0.8230419890,  0.8272275347,
-     0.8311038457,  0.8346937361,  0.8379717337,  0.8409541392,
-     0.8436238281,  0.8459818469,  0.8480315777,  0.8497805198,
-     0.8511971524,  0.8523047035,  0.8531020949,  0.8535720573,
-     0.8537385600,
-};
-
-static const float sbr_noise_table[512][2] = {
-{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647},
-{ 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647},
-{ 0.80705063769351,  0.29653668284408}, {-0.38981478896926,  0.89572605717087},
-{-0.01053049862020, -0.66959058036166}, {-0.91266367957293, -0.11522938140034},
-{ 0.54840422910309,  0.75221367176302}, { 0.40009252867955, -0.98929400334421},
-{-0.99867974711855, -0.88147068645358}, {-0.95531076805040,  0.90908757154593},
-{-0.45725933317144, -0.56716323646760}, {-0.72929675029275, -0.98008272727324},
-{ 0.75622801399036,  0.20950329995549}, { 0.07069442601050, -0.78247898470706},
-{ 0.74496252926055, -0.91169004445807}, {-0.96440182703856, -0.94739918296622},
-{ 0.30424629369539, -0.49438267012479}, { 0.66565033746925,  0.64652935542491},
-{ 0.91697008020594,  0.17514097332009}, {-0.70774918760427,  0.52548653416543},
-{-0.70051415345560, -0.45340028808763}, {-0.99496513054797, -0.90071908066973},
-{ 0.98164490790123, -0.77463155528697}, {-0.54671580548181, -0.02570928536004},
-{-0.01689629065389,  0.00287506445732}, {-0.86110349531986,  0.42548583726477},
-{-0.98892980586032, -0.87881132267556}, { 0.51756627678691,  0.66926784710139},
-{-0.99635026409640, -0.58107730574765}, {-0.99969370862163,  0.98369989360250},
-{ 0.55266258627194,  0.59449057465591}, { 0.34581177741673,  0.94879421061866},
-{ 0.62664209577999, -0.74402970906471}, {-0.77149701404973, -0.33883658042801},
-{-0.91592244254432,  0.03687901376713}, {-0.76285492357887, -0.91371867919124},
-{ 0.79788337195331, -0.93180971199849}, { 0.54473080610200, -0.11919206037186},
-{-0.85639281671058,  0.42429854760451}, {-0.92882402971423,  0.27871809078609},
-{-0.11708371046774, -0.99800843444966}, { 0.21356749817493, -0.90716295627033},
-{-0.76191692573909,  0.99768118356265}, { 0.98111043100884, -0.95854459734407},
-{-0.85913269895572,  0.95766566168880}, {-0.93307242253692,  0.49431757696466},
-{ 0.30485754879632, -0.70540034357529}, { 0.85289650925190,  0.46766131791044},
-{ 0.91328082618125, -0.99839597361769}, {-0.05890199924154,  0.70741827819497},
-{ 0.28398686150148,  0.34633555702188}, { 0.95258164539612, -0.54893416026939},
-{-0.78566324168507, -0.75568541079691}, {-0.95789495447877, -0.20423194696966},
-{ 0.82411158711197,  0.96654618432562}, {-0.65185446735885, -0.88734990773289},
-{-0.93643603134666,  0.99870790442385}, { 0.91427159529618, -0.98290505544444},
-{-0.70395684036886,  0.58796798221039}, { 0.00563771969365,  0.61768196727244},
-{ 0.89065051931895,  0.52783352697585}, {-0.68683707712762,  0.80806944710339},
-{ 0.72165342518718, -0.69259857349564}, {-0.62928247730667,  0.13627037407335},
-{ 0.29938434065514, -0.46051329682246}, {-0.91781958879280, -0.74012716684186},
-{ 0.99298717043688,  0.40816610075661}, { 0.82368298622748, -0.74036047190173},
-{-0.98512833386833, -0.99972330709594}, {-0.95915368242257, -0.99237800466040},
-{-0.21411126572790, -0.93424819052545}, {-0.68821476106884, -0.26892306315457},
-{ 0.91851997982317,  0.09358228901785}, {-0.96062769559127,  0.36099095133739},
-{ 0.51646184922287, -0.71373332873917}, { 0.61130721139669,  0.46950141175917},
-{ 0.47336129371299, -0.27333178296162}, { 0.90998308703519,  0.96715662938132},
-{ 0.44844799194357,  0.99211574628306}, { 0.66614891079092,  0.96590176169121},
-{ 0.74922239129237, -0.89879858826087}, {-0.99571588506485,  0.52785521494349},
-{ 0.97401082477563, -0.16855870075190}, { 0.72683747733879, -0.48060774432251},
-{ 0.95432193457128,  0.68849603408441}, {-0.72962208425191, -0.76608443420917},
-{-0.85359479233537,  0.88738125901579}, {-0.81412430338535, -0.97480768049637},
-{-0.87930772356786,  0.74748307690436}, {-0.71573331064977, -0.98570608178923},
-{ 0.83524300028228,  0.83702537075163}, {-0.48086065601423, -0.98848504923531},
-{ 0.97139128574778,  0.80093621198236}, { 0.51992825347895,  0.80247631400510},
-{-0.00848591195325, -0.76670128000486}, {-0.70294374303036,  0.55359910445577},
-{-0.95894428168140, -0.43265504344783}, { 0.97079252950321,  0.09325857238682},
-{-0.92404293670797,  0.85507704027855}, {-0.69506469500450,  0.98633412625459},
-{ 0.26559203620024,  0.73314307966524}, { 0.28038443336943,  0.14537913654427},
-{-0.74138124825523,  0.99310339807762}, {-0.01752795995444, -0.82616635284178},
-{-0.55126773094930, -0.98898543862153}, { 0.97960898850996, -0.94021446752851},
-{-0.99196309146936,  0.67019017358456}, {-0.67684928085260,  0.12631491649378},
-{ 0.09140039465500, -0.20537731453108}, {-0.71658965751996, -0.97788200391224},
-{ 0.81014640078925,  0.53722648362443}, { 0.40616991671205, -0.26469008598449},
-{-0.67680188682972,  0.94502052337695}, { 0.86849774348749, -0.18333598647899},
-{-0.99500381284851, -0.02634122068550}, { 0.84329189340667,  0.10406957462213},
-{-0.09215968531446,  0.69540012101253}, { 0.99956173327206, -0.12358542001404},
-{-0.79732779473535, -0.91582524736159}, { 0.96349973642406,  0.96640458041000},
-{-0.79942778496547,  0.64323902822857}, {-0.11566039853896,  0.28587846253726},
-{-0.39922954514662,  0.94129601616966}, { 0.99089197565987, -0.92062625581587},
-{ 0.28631285179909, -0.91035047143603}, {-0.83302725605608, -0.67330410892084},
-{ 0.95404443402072,  0.49162765398743}, {-0.06449863579434,  0.03250560813135},
-{-0.99575054486311,  0.42389784469507}, {-0.65501142790847,  0.82546114655624},
-{-0.81254441908887, -0.51627234660629}, {-0.99646369485481,  0.84490533520752},
-{ 0.00287840603348,  0.64768261158166}, { 0.70176989408455, -0.20453028573322},
-{ 0.96361882270190,  0.40706967140989}, {-0.68883758192426,  0.91338958840772},
-{-0.34875585502238,  0.71472290693300}, { 0.91980081243087,  0.66507455644919},
-{-0.99009048343881,  0.85868021604848}, { 0.68865791458395,  0.55660316809678},
-{-0.99484402129368, -0.20052559254934}, { 0.94214511408023, -0.99696425367461},
-{-0.67414626793544,  0.49548221180078}, {-0.47339353684664, -0.85904328834047},
-{ 0.14323651387360, -0.94145598222488}, {-0.29268293575672,  0.05759224927952},
-{ 0.43793861458754, -0.78904969892724}, {-0.36345126374441,  0.64874435357162},
-{-0.08750604656825,  0.97686944362527}, {-0.96495267812511, -0.53960305946511},
-{ 0.55526940659947,  0.78891523734774}, { 0.73538215752630,  0.96452072373404},
-{-0.30889773919437, -0.80664389776860}, { 0.03574995626194, -0.97325616900959},
-{ 0.98720684660488,  0.48409133691962}, {-0.81689296271203, -0.90827703628298},
-{ 0.67866860118215,  0.81284503870856}, {-0.15808569732583,  0.85279555024382},
-{ 0.80723395114371, -0.24717418514605}, { 0.47788757329038, -0.46333147839295},
-{ 0.96367554763201,  0.38486749303242}, {-0.99143875716818, -0.24945277239809},
-{ 0.83081876925833, -0.94780851414763}, {-0.58753191905341,  0.01290772389163},
-{ 0.95538108220960, -0.85557052096538}, {-0.96490920476211, -0.64020970923102},
-{-0.97327101028521,  0.12378128133110}, { 0.91400366022124,  0.57972471346930},
-{-0.99925837363824,  0.71084847864067}, {-0.86875903507313, -0.20291699203564},
-{-0.26240034795124, -0.68264554369108}, {-0.24664412953388, -0.87642273115183},
-{ 0.02416275806869,  0.27192914288905}, { 0.82068619590515, -0.85087787994476},
-{ 0.88547373760759, -0.89636802901469}, {-0.18173078152226, -0.26152145156800},
-{ 0.09355476558534,  0.54845123045604}, {-0.54668414224090,  0.95980774020221},
-{ 0.37050990604091, -0.59910140383171}, {-0.70373594262891,  0.91227665827081},
-{-0.34600785879594, -0.99441426144200}, {-0.68774481731008, -0.30238837956299},
-{-0.26843291251234,  0.83115668004362}, { 0.49072334613242, -0.45359708737775},
-{ 0.38975993093975,  0.95515358099121}, {-0.97757125224150,  0.05305894580606},
-{-0.17325552859616, -0.92770672250494}, { 0.99948035025744,  0.58285545563426},
-{-0.64946246527458,  0.68645507104960}, {-0.12016920576437, -0.57147322153312},
-{-0.58947456517751, -0.34847132454388}, {-0.41815140454465,  0.16276422358861},
-{ 0.99885650204884,  0.11136095490444}, {-0.56649614128386, -0.90494866361587},
-{ 0.94138021032330,  0.35281916733018}, {-0.75725076534641,  0.53650549640587},
-{ 0.20541973692630, -0.94435144369918}, { 0.99980371023351,  0.79835913565599},
-{ 0.29078277605775,  0.35393777921520}, {-0.62858772103030,  0.38765693387102},
-{ 0.43440904467688, -0.98546330463232}, {-0.98298583762390,  0.21021524625209},
-{ 0.19513029146934, -0.94239832251867}, {-0.95476662400101,  0.98364554179143},
-{ 0.93379635304810, -0.70881994583682}, {-0.85235410573336, -0.08342347966410},
-{-0.86425093011245, -0.45795025029466}, { 0.38879779059045,  0.97274429344593},
-{ 0.92045124735495, -0.62433652524220}, { 0.89162532251878,  0.54950955570563},
-{-0.36834336949252,  0.96458298020975}, { 0.93891760988045, -0.89968353740388},
-{ 0.99267657565094, -0.03757034316958}, {-0.94063471614176,  0.41332338538963},
-{ 0.99740224117019, -0.16830494996370}, {-0.35899413170555, -0.46633226649613},
-{ 0.05237237274947, -0.25640361602661}, { 0.36703583957424, -0.38653265641875},
-{ 0.91653180367913, -0.30587628726597}, { 0.69000803499316,  0.90952171386132},
-{-0.38658751133527,  0.99501571208985}, {-0.29250814029851,  0.37444994344615},
-{-0.60182204677608,  0.86779651036123}, {-0.97418588163217,  0.96468523666475},
-{ 0.88461574003963,  0.57508405276414}, { 0.05198933055162,  0.21269661669964},
-{-0.53499621979720,  0.97241553731237}, {-0.49429560226497,  0.98183865291903},
-{-0.98935142339139, -0.40249159006933}, {-0.98081380091130, -0.72856895534041},
-{-0.27338148835532,  0.99950922447209}, { 0.06310802338302, -0.54539587529618},
-{-0.20461677199539, -0.14209977628489}, { 0.66223843141647,  0.72528579940326},
-{-0.84764345483665,  0.02372316801261}, {-0.89039863483811,  0.88866581484602},
-{ 0.95903308477986,  0.76744927173873}, { 0.73504123909879, -0.03747203173192},
-{-0.31744434966056, -0.36834111883652}, {-0.34110827591623,  0.40211222807691},
-{ 0.47803883714199, -0.39423219786288}, { 0.98299195879514,  0.01989791390047},
-{-0.30963073129751, -0.18076720599336}, { 0.99992588229018, -0.26281872094289},
-{-0.93149731080767, -0.98313162570490}, { 0.99923472302773, -0.80142993767554},
-{-0.26024169633417, -0.75999759855752}, {-0.35712514743563,  0.19298963768574},
-{-0.99899084509530,  0.74645156992493}, { 0.86557171579452,  0.55593866696299},
-{ 0.33408042438752,  0.86185953874709}, { 0.99010736374716,  0.04602397576623},
-{-0.66694269691195, -0.91643611810148}, { 0.64016792079480,  0.15649530836856},
-{ 0.99570534804836,  0.45844586038111}, {-0.63431466947340,  0.21079116459234},
-{-0.07706847005931, -0.89581437101329}, { 0.98590090577724,  0.88241721133981},
-{ 0.80099335254678, -0.36851896710853}, { 0.78368131392666,  0.45506999802597},
-{ 0.08707806671691,  0.80938994918745}, {-0.86811883080712,  0.39347308654705},
-{-0.39466529740375, -0.66809432114456}, { 0.97875325649683, -0.72467840967746},
-{-0.95038560288864,  0.89563219587625}, { 0.17005239424212,  0.54683053962658},
-{-0.76910792026848, -0.96226617549298}, { 0.99743281016846,  0.42697157037567},
-{ 0.95437383549973,  0.97002324109952}, { 0.99578905365569, -0.54106826257356},
-{ 0.28058259829990, -0.85361420634036}, { 0.85256524470573, -0.64567607735589},
-{-0.50608540105128, -0.65846015480300}, {-0.97210735183243, -0.23095213067791},
-{ 0.95424048234441, -0.99240147091219}, {-0.96926570524023,  0.73775654896574},
-{ 0.30872163214726,  0.41514960556126}, {-0.24523839572639,  0.63206633394807},
-{-0.33813265086024, -0.38661779441897}, {-0.05826828420146, -0.06940774188029},
-{-0.22898461455054,  0.97054853316316}, {-0.18509915019881,  0.47565762892084},
-{-0.10488238045009, -0.87769947402394}, {-0.71886586182037,  0.78030982480538},
-{ 0.99793873738654,  0.90041310491497}, { 0.57563307626120, -0.91034337352097},
-{ 0.28909646383717,  0.96307783970534}, { 0.42188998312520,  0.48148651230437},
-{ 0.93335049681047, -0.43537023883588}, {-0.97087374418267,  0.86636445711364},
-{ 0.36722871286923,  0.65291654172961}, {-0.81093025665696,  0.08778370229363},
-{-0.26240603062237, -0.92774095379098}, { 0.83996497984604,  0.55839849139647},
-{-0.99909615720225, -0.96024605713970}, { 0.74649464155061,  0.12144893606462},
-{-0.74774595569805, -0.26898062008959}, { 0.95781667469567, -0.79047927052628},
-{ 0.95472308713099, -0.08588776019550}, { 0.48708332746299,  0.99999041579432},
-{ 0.46332038247497,  0.10964126185063}, {-0.76497004940162,  0.89210929242238},
-{ 0.57397389364339,  0.35289703373760}, { 0.75374316974495,  0.96705214651335},
-{-0.59174397685714, -0.89405370422752}, { 0.75087906691890, -0.29612672982396},
-{-0.98607857336230,  0.25034911730023}, {-0.40761056640505, -0.90045573444695},
-{ 0.66929266740477,  0.98629493401748}, {-0.97463695257310, -0.00190223301301},
-{ 0.90145509409859,  0.99781390365446}, {-0.87259289048043,  0.99233587353666},
-{-0.91529461447692, -0.15698707534206}, {-0.03305738840705, -0.37205262859764},
-{ 0.07223051368337, -0.88805001733626}, { 0.99498012188353,  0.97094358113387},
-{-0.74904939500519,  0.99985483641521}, { 0.04585228574211,  0.99812337444082},
-{-0.89054954257993, -0.31791913188064}, {-0.83782144651251,  0.97637632547466},
-{ 0.33454804933804, -0.86231516800408}, {-0.99707579362824,  0.93237990079441},
-{-0.22827527843994,  0.18874759397997}, { 0.67248046289143, -0.03646211390569},
-{-0.05146538187944, -0.92599700120679}, { 0.99947295749905,  0.93625229707912},
-{ 0.66951124390363,  0.98905825623893}, {-0.99602956559179, -0.44654715757688},
-{ 0.82104905483590,  0.99540741724928}, { 0.99186510988782,  0.72023001312947},
-{-0.65284592392918,  0.52186723253637}, { 0.93885443798188, -0.74895312615259},
-{ 0.96735248738388,  0.90891816978629}, {-0.22225968841114,  0.57124029781228},
-{-0.44132783753414, -0.92688840659280}, {-0.85694974219574,  0.88844532719844},
-{ 0.91783042091762, -0.46356892383970}, { 0.72556974415690, -0.99899555770747},
-{-0.99711581834508,  0.58211560180426}, { 0.77638976371966,  0.94321834873819},
-{ 0.07717324253925,  0.58638399856595}, {-0.56049829194163,  0.82522301569036},
-{ 0.98398893639988,  0.39467440420569}, { 0.47546946844938,  0.68613044836811},
-{ 0.65675089314631,  0.18331637134880}, { 0.03273375457980, -0.74933109564108},
-{-0.38684144784738,  0.51337349030406}, {-0.97346267944545, -0.96549364384098},
-{-0.53282156061942, -0.91423265091354}, { 0.99817310731176,  0.61133572482148},
-{-0.50254500772635, -0.88829338134294}, { 0.01995873238855,  0.85223515096765},
-{ 0.99930381973804,  0.94578896296649}, { 0.82907767600783, -0.06323442598128},
-{-0.58660709669728,  0.96840773806582}, {-0.17573736667267, -0.48166920859485},
-{ 0.83434292401346, -0.13023450646997}, { 0.05946491307025,  0.20511047074866},
-{ 0.81505484574602, -0.94685947861369}, {-0.44976380954860,  0.40894572671545},
-{-0.89746474625671,  0.99846578838537}, { 0.39677256130792, -0.74854668609359},
-{-0.07588948563079,  0.74096214084170}, { 0.76343198951445,  0.41746629422634},
-{-0.74490104699626,  0.94725911744610}, { 0.64880119792759,  0.41336660830571},
-{ 0.62319537462542, -0.93098313552599}, { 0.42215817594807, -0.07712787385208},
-{ 0.02704554141885, -0.05417518053666}, { 0.80001773566818,  0.91542195141039},
-{-0.79351832348816, -0.36208897989136}, { 0.63872359151636,  0.08128252493444},
-{ 0.52890520960295,  0.60048872455592}, { 0.74238552914587,  0.04491915291044},
-{ 0.99096131449250, -0.19451182854402}, {-0.80412329643109, -0.88513818199457},
-{-0.64612616129736,  0.72198674804544}, { 0.11657770663191, -0.83662833815041},
-{-0.95053182488101, -0.96939905138082}, {-0.62228872928622,  0.82767262846661},
-{ 0.03004475787316, -0.99738896333384}, {-0.97987214341034,  0.36526129686425},
-{-0.99986980746200, -0.36021610299715}, { 0.89110648599879, -0.97894250343044},
-{ 0.10407960510582,  0.77357793811619}, { 0.95964737821728, -0.35435818285502},
-{ 0.50843233159162,  0.96107691266205}, { 0.17006334670615, -0.76854025314829},
-{ 0.25872675063360,  0.99893303933816}, {-0.01115998681937,  0.98496019742444},
-{-0.79598702973261,  0.97138411318894}, {-0.99264708948101, -0.99542822402536},
-{-0.99829663752818,  0.01877138824311}, {-0.70801016548184,  0.33680685948117},
-{-0.70467057786826,  0.93272777501857}, { 0.99846021905254, -0.98725746254433},
-{-0.63364968534650, -0.16473594423746}, {-0.16258217500792, -0.95939125400802},
-{-0.43645594360633, -0.94805030113284}, {-0.99848471702976,  0.96245166923809},
-{-0.16796458968998, -0.98987511890470}, {-0.87979225745213, -0.71725725041680},
-{ 0.44183099021786, -0.93568974498761}, { 0.93310180125532, -0.99913308068246},
-{-0.93941931782002, -0.56409379640356}, {-0.88590003188677,  0.47624600491382},
-{ 0.99971463703691, -0.83889954253462}, {-0.75376385639978,  0.00814643438625},
-{ 0.93887685615875, -0.11284528204636}, { 0.85126435782309,  0.52349251543547},
-{ 0.39701421446381,  0.81779634174316}, {-0.37024464187437, -0.87071656222959},
-{-0.36024828242896,  0.34655735648287}, {-0.93388812549209, -0.84476541096429},
-{-0.65298804552119, -0.18439575450921}, { 0.11960319006843,  0.99899346780168},
-{ 0.94292565553160,  0.83163906518293}, { 0.75081145286948, -0.35533223142265},
-{ 0.56721979748394, -0.24076836414499}, { 0.46857766746029, -0.30140233457198},
-{ 0.97312313923635, -0.99548191630031}, {-0.38299976567017,  0.98516909715427},
-{ 0.41025800019463,  0.02116736935734}, { 0.09638062008048,  0.04411984381457},
-{-0.85283249275397,  0.91475563922421}, { 0.88866808958124, -0.99735267083226},
-{-0.48202429536989, -0.96805608884164}, { 0.27572582416567,  0.58634753335832},
-{-0.65889129659168,  0.58835634138583}, { 0.98838086953732,  0.99994349600236},
-{-0.20651349620689,  0.54593044066355}, {-0.62126416356920, -0.59893681700392},
-{ 0.20320105410437, -0.86879180355289}, {-0.97790548600584,  0.96290806999242},
-{ 0.11112534735126,  0.21484763313301}, {-0.41368337314182,  0.28216837680365},
-{ 0.24133038992960,  0.51294362630238}, {-0.66393410674885, -0.08249679629081},
-{-0.53697829178752, -0.97649903936228}, {-0.97224737889348,  0.22081333579837},
-{ 0.87392477144549, -0.12796173740361}, { 0.19050361015753,  0.01602615387195},
-{-0.46353441212724, -0.95249041539006}, {-0.07064096339021, -0.94479803205886},
-{-0.92444085484466, -0.10457590187436}, {-0.83822593578728, -0.01695043208885},
-{ 0.75214681811150, -0.99955681042665}, {-0.42102998829339,  0.99720941999394},
-{-0.72094786237696, -0.35008961934255}, { 0.78843311019251,  0.52851398958271},
-{ 0.97394027897442, -0.26695944086561}, { 0.99206463477946, -0.57010120849429},
-{ 0.76789609461795, -0.76519356730966}, {-0.82002421836409, -0.73530179553767},
-{ 0.81924990025724,  0.99698425250579}, {-0.26719850873357,  0.68903369776193},
-{-0.43311260380975,  0.85321815947490}, { 0.99194979673836,  0.91876249766422},
-{-0.80692001248487, -0.32627540663214}, { 0.43080003649976, -0.21919095636638},
-{ 0.67709491937357, -0.95478075822906}, { 0.56151770568316, -0.70693811747778},
-{ 0.10831862810749, -0.08628837174592}, { 0.91229417540436, -0.65987351408410},
-{-0.48972893932274,  0.56289246362686}, {-0.89033658689697, -0.71656563987082},
-{ 0.65269447475094,  0.65916004833932}, { 0.67439478141121, -0.81684380846796},
-{-0.47770832416973, -0.16789556203025}, {-0.99715979260878, -0.93565784007648},
-{-0.90889593602546,  0.62034397054380}, {-0.06618622548177, -0.23812217221359},
-{ 0.99430266919728,  0.18812555317553}, { 0.97686402381843, -0.28664534366620},
-{ 0.94813650221268, -0.97506640027128}, {-0.95434497492853, -0.79607978501983},
-{-0.49104783137150,  0.32895214359663}, { 0.99881175120751,  0.88993983831354},
-{ 0.50449166760303, -0.85995072408434}, { 0.47162891065108, -0.18680204049569},
-{-0.62081581361840,  0.75000676218956}, {-0.43867015250812,  0.99998069244322},
-{ 0.98630563232075, -0.53578899600662}, {-0.61510362277374, -0.89515019899997},
-{-0.03841517601843, -0.69888815681179}, {-0.30102157304644, -0.07667808922205},
-{ 0.41881284182683,  0.02188098922282}, {-0.86135454941237,  0.98947480909359},
-{ 0.67226861393788, -0.13494389011014}, {-0.70737398842068, -0.76547349325992},
-{ 0.94044946687963,  0.09026201157416}, {-0.82386352534327,  0.08924768823676},
-{-0.32070666698656,  0.50143421908753}, { 0.57593163224487, -0.98966422921509},
-{-0.36326018419965,  0.07440243123228}, { 0.99979044674350, -0.14130287347405},
-{-0.92366023326932, -0.97979298068180}, {-0.44607178518598, -0.54233252016394},
-{ 0.44226800932956,  0.71326756742752}, { 0.03671907158312,  0.63606389366675},
-{ 0.52175424682195, -0.85396826735705}, {-0.94701139690956, -0.01826348194255},
-{-0.98759606946049,  0.82288714303073}, { 0.87434794743625,  0.89399495655433},
-{-0.93412041758744,  0.41374052024363}, { 0.96063943315511,  0.93116709541280},
-{ 0.97534253457837,  0.86150930812689}, { 0.99642466504163,  0.70190043427512},
-{-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781},
-};
-
-#endif /* AVCODEC_AACSBRDATA_H */
diff --git a/libavcodec/aactab.c b/libavcodec/aactab.c
deleted file mode 100644
index 17102a6..0000000
--- a/libavcodec/aactab.c
+++ /dev/null
@@ -1,1207 +0,0 @@
-/*
- * AAC data
- * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
- * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC data
- * @author Oded Shimon  ( ods15 ods15 dyndns org )
- * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
- */
-
-#include "libavutil/mem.h"
-#include "aac.h"
-#include "aac_tablegen.h"
-
-#include <stdint.h>
-
-DECLARE_ALIGNED(16, float,  ff_aac_kbd_long_1024)[1024];
-DECLARE_ALIGNED(16, float,  ff_aac_kbd_short_128)[128];
-
-const uint8_t ff_aac_num_swb_1024[] = {
-    41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40
-};
-
-const uint8_t ff_aac_num_swb_128[] = {
-    12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15
-};
-
-const uint8_t ff_aac_pred_sfb_max[] = {
-    33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 34
-};
-
-const uint32_t ff_aac_scalefactor_code[121] = {
-    0x3ffe8, 0x3ffe6, 0x3ffe7, 0x3ffe5, 0x7fff5, 0x7fff1, 0x7ffed, 0x7fff6,
-    0x7ffee, 0x7ffef, 0x7fff0, 0x7fffc, 0x7fffd, 0x7ffff, 0x7fffe, 0x7fff7,
-    0x7fff8, 0x7fffb, 0x7fff9, 0x3ffe4, 0x7fffa, 0x3ffe3, 0x1ffef, 0x1fff0,
-    0x0fff5, 0x1ffee, 0x0fff2, 0x0fff3, 0x0fff4, 0x0fff1, 0x07ff6, 0x07ff7,
-    0x03ff9, 0x03ff5, 0x03ff7, 0x03ff3, 0x03ff6, 0x03ff2, 0x01ff7, 0x01ff5,
-    0x00ff9, 0x00ff7, 0x00ff6, 0x007f9, 0x00ff4, 0x007f8, 0x003f9, 0x003f7,
-    0x003f5, 0x001f8, 0x001f7, 0x000fa, 0x000f8, 0x000f6, 0x00079, 0x0003a,
-    0x00038, 0x0001a, 0x0000b, 0x00004, 0x00000, 0x0000a, 0x0000c, 0x0001b,
-    0x00039, 0x0003b, 0x00078, 0x0007a, 0x000f7, 0x000f9, 0x001f6, 0x001f9,
-    0x003f4, 0x003f6, 0x003f8, 0x007f5, 0x007f4, 0x007f6, 0x007f7, 0x00ff5,
-    0x00ff8, 0x01ff4, 0x01ff6, 0x01ff8, 0x03ff8, 0x03ff4, 0x0fff0, 0x07ff4,
-    0x0fff6, 0x07ff5, 0x3ffe2, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd,
-    0x7ffde, 0x7ffd8, 0x7ffd2, 0x7ffd3, 0x7ffd4, 0x7ffd5, 0x7ffd6, 0x7fff2,
-    0x7ffdf, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffe6, 0x7ffe0,
-    0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffd7, 0x7ffec, 0x7fff4,
-    0x7fff3,
-};
-
-const uint8_t ff_aac_scalefactor_bits[121] = {
-    18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 18, 19, 18, 17, 17, 16, 17, 16, 16, 16, 16, 15, 15,
-    14, 14, 14, 14, 14, 14, 13, 13, 12, 12, 12, 11, 12, 11, 10, 10,
-    10,  9,  9,  8,  8,  8,  7,  6,  6,  5,  4,  3,  1,  4,  4,  5,
-     6,  6,  7,  7,  8,  8,  9,  9, 10, 10, 10, 11, 11, 11, 11, 12,
-    12, 13, 13, 13, 14, 14, 16, 15, 16, 15, 18, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19, 19,
-};
-
-static const uint16_t codes1[81] = {
-    0x7f8, 0x1f1, 0x7fd, 0x3f5, 0x068, 0x3f0, 0x7f7, 0x1ec,
-    0x7f5, 0x3f1, 0x072, 0x3f4, 0x074, 0x011, 0x076, 0x1eb,
-    0x06c, 0x3f6, 0x7fc, 0x1e1, 0x7f1, 0x1f0, 0x061, 0x1f6,
-    0x7f2, 0x1ea, 0x7fb, 0x1f2, 0x069, 0x1ed, 0x077, 0x017,
-    0x06f, 0x1e6, 0x064, 0x1e5, 0x067, 0x015, 0x062, 0x012,
-    0x000, 0x014, 0x065, 0x016, 0x06d, 0x1e9, 0x063, 0x1e4,
-    0x06b, 0x013, 0x071, 0x1e3, 0x070, 0x1f3, 0x7fe, 0x1e7,
-    0x7f3, 0x1ef, 0x060, 0x1ee, 0x7f0, 0x1e2, 0x7fa, 0x3f3,
-    0x06a, 0x1e8, 0x075, 0x010, 0x073, 0x1f4, 0x06e, 0x3f7,
-    0x7f6, 0x1e0, 0x7f9, 0x3f2, 0x066, 0x1f5, 0x7ff, 0x1f7,
-    0x7f4,
-};
-
-static const uint8_t bits1[81] = {
-    11,  9, 11, 10,  7, 10, 11,  9, 11, 10,  7, 10,  7,  5,  7,  9,
-     7, 10, 11,  9, 11,  9,  7,  9, 11,  9, 11,  9,  7,  9,  7,  5,
-     7,  9,  7,  9,  7,  5,  7,  5,  1,  5,  7,  5,  7,  9,  7,  9,
-     7,  5,  7,  9,  7,  9, 11,  9, 11,  9,  7,  9, 11,  9, 11, 10,
-     7,  9,  7,  5,  7,  9,  7, 10, 11,  9, 11, 10,  7,  9, 11,  9,
-    11,
-};
-
-static const uint16_t codes2[81] = {
-    0x1f3, 0x06f, 0x1fd, 0x0eb, 0x023, 0x0ea, 0x1f7, 0x0e8,
-    0x1fa, 0x0f2, 0x02d, 0x070, 0x020, 0x006, 0x02b, 0x06e,
-    0x028, 0x0e9, 0x1f9, 0x066, 0x0f8, 0x0e7, 0x01b, 0x0f1,
-    0x1f4, 0x06b, 0x1f5, 0x0ec, 0x02a, 0x06c, 0x02c, 0x00a,
-    0x027, 0x067, 0x01a, 0x0f5, 0x024, 0x008, 0x01f, 0x009,
-    0x000, 0x007, 0x01d, 0x00b, 0x030, 0x0ef, 0x01c, 0x064,
-    0x01e, 0x00c, 0x029, 0x0f3, 0x02f, 0x0f0, 0x1fc, 0x071,
-    0x1f2, 0x0f4, 0x021, 0x0e6, 0x0f7, 0x068, 0x1f8, 0x0ee,
-    0x022, 0x065, 0x031, 0x002, 0x026, 0x0ed, 0x025, 0x06a,
-    0x1fb, 0x072, 0x1fe, 0x069, 0x02e, 0x0f6, 0x1ff, 0x06d,
-    0x1f6,
-};
-
-static const uint8_t bits2[81] = {
-    9, 7, 9, 8, 6, 8, 9, 8, 9, 8, 6, 7, 6, 5, 6, 7,
-    6, 8, 9, 7, 8, 8, 6, 8, 9, 7, 9, 8, 6, 7, 6, 5,
-    6, 7, 6, 8, 6, 5, 6, 5, 3, 5, 6, 5, 6, 8, 6, 7,
-    6, 5, 6, 8, 6, 8, 9, 7, 9, 8, 6, 8, 8, 7, 9, 8,
-    6, 7, 6, 4, 6, 8, 6, 7, 9, 7, 9, 7, 6, 8, 9, 7,
-    9,
-};
-
-static const uint16_t codes3[81] = {
-    0x0000, 0x0009, 0x00ef, 0x000b, 0x0019, 0x00f0, 0x01eb, 0x01e6,
-    0x03f2, 0x000a, 0x0035, 0x01ef, 0x0034, 0x0037, 0x01e9, 0x01ed,
-    0x01e7, 0x03f3, 0x01ee, 0x03ed, 0x1ffa, 0x01ec, 0x01f2, 0x07f9,
-    0x07f8, 0x03f8, 0x0ff8, 0x0008, 0x0038, 0x03f6, 0x0036, 0x0075,
-    0x03f1, 0x03eb, 0x03ec, 0x0ff4, 0x0018, 0x0076, 0x07f4, 0x0039,
-    0x0074, 0x03ef, 0x01f3, 0x01f4, 0x07f6, 0x01e8, 0x03ea, 0x1ffc,
-    0x00f2, 0x01f1, 0x0ffb, 0x03f5, 0x07f3, 0x0ffc, 0x00ee, 0x03f7,
-    0x7ffe, 0x01f0, 0x07f5, 0x7ffd, 0x1ffb, 0x3ffa, 0xffff, 0x00f1,
-    0x03f0, 0x3ffc, 0x01ea, 0x03ee, 0x3ffb, 0x0ff6, 0x0ffa, 0x7ffc,
-    0x07f2, 0x0ff5, 0xfffe, 0x03f4, 0x07f7, 0x7ffb, 0x0ff7, 0x0ff9,
-    0x7ffa,
-};
-
-static const uint8_t bits3[81] = {
-     1,  4,  8,  4,  5,  8,  9,  9, 10,  4,  6,  9,  6,  6,  9,  9,
-     9, 10,  9, 10, 13,  9,  9, 11, 11, 10, 12,  4,  6, 10,  6,  7,
-    10, 10, 10, 12,  5,  7, 11,  6,  7, 10,  9,  9, 11,  9, 10, 13,
-     8,  9, 12, 10, 11, 12,  8, 10, 15,  9, 11, 15, 13, 14, 16,  8,
-    10, 14,  9, 10, 14, 12, 12, 15, 11, 12, 16, 10, 11, 15, 12, 12,
-    15,
-};
-
-static const uint16_t codes4[81] = {
-    0x007, 0x016, 0x0f6, 0x018, 0x008, 0x0ef, 0x1ef, 0x0f3,
-    0x7f8, 0x019, 0x017, 0x0ed, 0x015, 0x001, 0x0e2, 0x0f0,
-    0x070, 0x3f0, 0x1ee, 0x0f1, 0x7fa, 0x0ee, 0x0e4, 0x3f2,
-    0x7f6, 0x3ef, 0x7fd, 0x005, 0x014, 0x0f2, 0x009, 0x004,
-    0x0e5, 0x0f4, 0x0e8, 0x3f4, 0x006, 0x002, 0x0e7, 0x003,
-    0x000, 0x06b, 0x0e3, 0x069, 0x1f3, 0x0eb, 0x0e6, 0x3f6,
-    0x06e, 0x06a, 0x1f4, 0x3ec, 0x1f0, 0x3f9, 0x0f5, 0x0ec,
-    0x7fb, 0x0ea, 0x06f, 0x3f7, 0x7f9, 0x3f3, 0xfff, 0x0e9,
-    0x06d, 0x3f8, 0x06c, 0x068, 0x1f5, 0x3ee, 0x1f2, 0x7f4,
-    0x7f7, 0x3f1, 0xffe, 0x3ed, 0x1f1, 0x7f5, 0x7fe, 0x3f5,
-    0x7fc,
-};
-
-static const uint8_t bits4[81] = {
-     4,  5,  8,  5,  4,  8,  9,  8, 11,  5,  5,  8,  5,  4,  8,  8,
-     7, 10,  9,  8, 11,  8,  8, 10, 11, 10, 11,  4,  5,  8,  4,  4,
-     8,  8,  8, 10,  4,  4,  8,  4,  4,  7,  8,  7,  9,  8,  8, 10,
-     7,  7,  9, 10,  9, 10,  8,  8, 11,  8,  7, 10, 11, 10, 12,  8,
-     7, 10,  7,  7,  9, 10,  9, 11, 11, 10, 12, 10,  9, 11, 11, 10,
-    11,
-};
-
-static const uint16_t codes5[81] = {
-    0x1fff, 0x0ff7, 0x07f4, 0x07e8, 0x03f1, 0x07ee, 0x07f9, 0x0ff8,
-    0x1ffd, 0x0ffd, 0x07f1, 0x03e8, 0x01e8, 0x00f0, 0x01ec, 0x03ee,
-    0x07f2, 0x0ffa, 0x0ff4, 0x03ef, 0x01f2, 0x00e8, 0x0070, 0x00ec,
-    0x01f0, 0x03ea, 0x07f3, 0x07eb, 0x01eb, 0x00ea, 0x001a, 0x0008,
-    0x0019, 0x00ee, 0x01ef, 0x07ed, 0x03f0, 0x00f2, 0x0073, 0x000b,
-    0x0000, 0x000a, 0x0071, 0x00f3, 0x07e9, 0x07ef, 0x01ee, 0x00ef,
-    0x0018, 0x0009, 0x001b, 0x00eb, 0x01e9, 0x07ec, 0x07f6, 0x03eb,
-    0x01f3, 0x00ed, 0x0072, 0x00e9, 0x01f1, 0x03ed, 0x07f7, 0x0ff6,
-    0x07f0, 0x03e9, 0x01ed, 0x00f1, 0x01ea, 0x03ec, 0x07f8, 0x0ff9,
-    0x1ffc, 0x0ffc, 0x0ff5, 0x07ea, 0x03f3, 0x03f2, 0x07f5, 0x0ffb,
-    0x1ffe,
-};
-
-static const uint8_t bits5[81] = {
-    13, 12, 11, 11, 10, 11, 11, 12, 13, 12, 11, 10,  9,  8,  9, 10,
-    11, 12, 12, 10,  9,  8,  7,  8,  9, 10, 11, 11,  9,  8,  5,  4,
-     5,  8,  9, 11, 10,  8,  7,  4,  1,  4,  7,  8, 11, 11,  9,  8,
-     5,  4,  5,  8,  9, 11, 11, 10,  9,  8,  7,  8,  9, 10, 11, 12,
-    11, 10,  9,  8,  9, 10, 11, 12, 13, 12, 12, 11, 10, 10, 11, 12,
-    13,
-};
-
-static const uint16_t codes6[81] = {
-    0x7fe, 0x3fd, 0x1f1, 0x1eb, 0x1f4, 0x1ea, 0x1f0, 0x3fc,
-    0x7fd, 0x3f6, 0x1e5, 0x0ea, 0x06c, 0x071, 0x068, 0x0f0,
-    0x1e6, 0x3f7, 0x1f3, 0x0ef, 0x032, 0x027, 0x028, 0x026,
-    0x031, 0x0eb, 0x1f7, 0x1e8, 0x06f, 0x02e, 0x008, 0x004,
-    0x006, 0x029, 0x06b, 0x1ee, 0x1ef, 0x072, 0x02d, 0x002,
-    0x000, 0x003, 0x02f, 0x073, 0x1fa, 0x1e7, 0x06e, 0x02b,
-    0x007, 0x001, 0x005, 0x02c, 0x06d, 0x1ec, 0x1f9, 0x0ee,
-    0x030, 0x024, 0x02a, 0x025, 0x033, 0x0ec, 0x1f2, 0x3f8,
-    0x1e4, 0x0ed, 0x06a, 0x070, 0x069, 0x074, 0x0f1, 0x3fa,
-    0x7ff, 0x3f9, 0x1f6, 0x1ed, 0x1f8, 0x1e9, 0x1f5, 0x3fb,
-    0x7fc,
-};
-
-static const uint8_t bits6[81] = {
-    11, 10,  9,  9,  9,  9,  9, 10, 11, 10,  9,  8,  7,  7,  7,  8,
-     9, 10,  9,  8,  6,  6,  6,  6,  6,  8,  9,  9,  7,  6,  4,  4,
-     4,  6,  7,  9,  9,  7,  6,  4,  4,  4,  6,  7,  9,  9,  7,  6,
-     4,  4,  4,  6,  7,  9,  9,  8,  6,  6,  6,  6,  6,  8,  9, 10,
-     9,  8,  7,  7,  7,  7,  8, 10, 11, 10,  9,  9,  9,  9,  9, 10,
-    11,
-};
-
-static const uint16_t codes7[64] = {
-    0x000, 0x005, 0x037, 0x074, 0x0f2, 0x1eb, 0x3ed, 0x7f7,
-    0x004, 0x00c, 0x035, 0x071, 0x0ec, 0x0ee, 0x1ee, 0x1f5,
-    0x036, 0x034, 0x072, 0x0ea, 0x0f1, 0x1e9, 0x1f3, 0x3f5,
-    0x073, 0x070, 0x0eb, 0x0f0, 0x1f1, 0x1f0, 0x3ec, 0x3fa,
-    0x0f3, 0x0ed, 0x1e8, 0x1ef, 0x3ef, 0x3f1, 0x3f9, 0x7fb,
-    0x1ed, 0x0ef, 0x1ea, 0x1f2, 0x3f3, 0x3f8, 0x7f9, 0x7fc,
-    0x3ee, 0x1ec, 0x1f4, 0x3f4, 0x3f7, 0x7f8, 0xffd, 0xffe,
-    0x7f6, 0x3f0, 0x3f2, 0x3f6, 0x7fa, 0x7fd, 0xffc, 0xfff,
-};
-
-static const uint8_t bits7[64] = {
-     1,  3,  6,  7,  8,  9, 10, 11,  3,  4,  6,  7,  8,  8,  9,  9,
-     6,  6,  7,  8,  8,  9,  9, 10,  7,  7,  8,  8,  9,  9, 10, 10,
-     8,  8,  9,  9, 10, 10, 10, 11,  9,  8,  9,  9, 10, 10, 11, 11,
-    10,  9,  9, 10, 10, 11, 12, 12, 11, 10, 10, 10, 11, 11, 12, 12,
-};
-
-static const uint16_t codes8[64] = {
-    0x00e, 0x005, 0x010, 0x030, 0x06f, 0x0f1, 0x1fa, 0x3fe,
-    0x003, 0x000, 0x004, 0x012, 0x02c, 0x06a, 0x075, 0x0f8,
-    0x00f, 0x002, 0x006, 0x014, 0x02e, 0x069, 0x072, 0x0f5,
-    0x02f, 0x011, 0x013, 0x02a, 0x032, 0x06c, 0x0ec, 0x0fa,
-    0x071, 0x02b, 0x02d, 0x031, 0x06d, 0x070, 0x0f2, 0x1f9,
-    0x0ef, 0x068, 0x033, 0x06b, 0x06e, 0x0ee, 0x0f9, 0x3fc,
-    0x1f8, 0x074, 0x073, 0x0ed, 0x0f0, 0x0f6, 0x1f6, 0x1fd,
-    0x3fd, 0x0f3, 0x0f4, 0x0f7, 0x1f7, 0x1fb, 0x1fc, 0x3ff,
-};
-
-static const uint8_t bits8[64] = {
-     5,  4,  5,  6,  7,  8,  9, 10,  4,  3,  4,  5,  6,  7,  7,  8,
-     5,  4,  4,  5,  6,  7,  7,  8,  6,  5,  5,  6,  6,  7,  8,  8,
-     7,  6,  6,  6,  7,  7,  8,  9,  8,  7,  6,  7,  7,  8,  8, 10,
-     9,  7,  7,  8,  8,  8,  9,  9, 10,  8,  8,  8,  9,  9,  9, 10,
-};
-
-static const uint16_t codes9[169] = {
-    0x0000, 0x0005, 0x0037, 0x00e7, 0x01de, 0x03ce, 0x03d9, 0x07c8,
-    0x07cd, 0x0fc8, 0x0fdd, 0x1fe4, 0x1fec, 0x0004, 0x000c, 0x0035,
-    0x0072, 0x00ea, 0x00ed, 0x01e2, 0x03d1, 0x03d3, 0x03e0, 0x07d8,
-    0x0fcf, 0x0fd5, 0x0036, 0x0034, 0x0071, 0x00e8, 0x00ec, 0x01e1,
-    0x03cf, 0x03dd, 0x03db, 0x07d0, 0x0fc7, 0x0fd4, 0x0fe4, 0x00e6,
-    0x0070, 0x00e9, 0x01dd, 0x01e3, 0x03d2, 0x03dc, 0x07cc, 0x07ca,
-    0x07de, 0x0fd8, 0x0fea, 0x1fdb, 0x01df, 0x00eb, 0x01dc, 0x01e6,
-    0x03d5, 0x03de, 0x07cb, 0x07dd, 0x07dc, 0x0fcd, 0x0fe2, 0x0fe7,
-    0x1fe1, 0x03d0, 0x01e0, 0x01e4, 0x03d6, 0x07c5, 0x07d1, 0x07db,
-    0x0fd2, 0x07e0, 0x0fd9, 0x0feb, 0x1fe3, 0x1fe9, 0x07c4, 0x01e5,
-    0x03d7, 0x07c6, 0x07cf, 0x07da, 0x0fcb, 0x0fda, 0x0fe3, 0x0fe9,
-    0x1fe6, 0x1ff3, 0x1ff7, 0x07d3, 0x03d8, 0x03e1, 0x07d4, 0x07d9,
-    0x0fd3, 0x0fde, 0x1fdd, 0x1fd9, 0x1fe2, 0x1fea, 0x1ff1, 0x1ff6,
-    0x07d2, 0x03d4, 0x03da, 0x07c7, 0x07d7, 0x07e2, 0x0fce, 0x0fdb,
-    0x1fd8, 0x1fee, 0x3ff0, 0x1ff4, 0x3ff2, 0x07e1, 0x03df, 0x07c9,
-    0x07d6, 0x0fca, 0x0fd0, 0x0fe5, 0x0fe6, 0x1feb, 0x1fef, 0x3ff3,
-    0x3ff4, 0x3ff5, 0x0fe0, 0x07ce, 0x07d5, 0x0fc6, 0x0fd1, 0x0fe1,
-    0x1fe0, 0x1fe8, 0x1ff0, 0x3ff1, 0x3ff8, 0x3ff6, 0x7ffc, 0x0fe8,
-    0x07df, 0x0fc9, 0x0fd7, 0x0fdc, 0x1fdc, 0x1fdf, 0x1fed, 0x1ff5,
-    0x3ff9, 0x3ffb, 0x7ffd, 0x7ffe, 0x1fe7, 0x0fcc, 0x0fd6, 0x0fdf,
-    0x1fde, 0x1fda, 0x1fe5, 0x1ff2, 0x3ffa, 0x3ff7, 0x3ffc, 0x3ffd,
-    0x7fff,
-};
-
-static const uint8_t bits9[169] = {
-     1,  3,  6,  8,  9, 10, 10, 11, 11, 12, 12, 13, 13,  3,  4,  6,
-     7,  8,  8,  9, 10, 10, 10, 11, 12, 12,  6,  6,  7,  8,  8,  9,
-    10, 10, 10, 11, 12, 12, 12,  8,  7,  8,  9,  9, 10, 10, 11, 11,
-    11, 12, 12, 13,  9,  8,  9,  9, 10, 10, 11, 11, 11, 12, 12, 12,
-    13, 10,  9,  9, 10, 11, 11, 11, 12, 11, 12, 12, 13, 13, 11,  9,
-    10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 11, 10, 10, 11, 11,
-    12, 12, 13, 13, 13, 13, 13, 13, 11, 10, 10, 11, 11, 11, 12, 12,
-    13, 13, 14, 13, 14, 11, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14,
-    14, 14, 12, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 12,
-    11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15, 13, 12, 12, 12,
-    13, 13, 13, 13, 14, 14, 14, 14, 15,
-};
-
-static const uint16_t codes10[169] = {
-    0x022, 0x008, 0x01d, 0x026, 0x05f, 0x0d3, 0x1cf, 0x3d0,
-    0x3d7, 0x3ed, 0x7f0, 0x7f6, 0xffd, 0x007, 0x000, 0x001,
-    0x009, 0x020, 0x054, 0x060, 0x0d5, 0x0dc, 0x1d4, 0x3cd,
-    0x3de, 0x7e7, 0x01c, 0x002, 0x006, 0x00c, 0x01e, 0x028,
-    0x05b, 0x0cd, 0x0d9, 0x1ce, 0x1dc, 0x3d9, 0x3f1, 0x025,
-    0x00b, 0x00a, 0x00d, 0x024, 0x057, 0x061, 0x0cc, 0x0dd,
-    0x1cc, 0x1de, 0x3d3, 0x3e7, 0x05d, 0x021, 0x01f, 0x023,
-    0x027, 0x059, 0x064, 0x0d8, 0x0df, 0x1d2, 0x1e2, 0x3dd,
-    0x3ee, 0x0d1, 0x055, 0x029, 0x056, 0x058, 0x062, 0x0ce,
-    0x0e0, 0x0e2, 0x1da, 0x3d4, 0x3e3, 0x7eb, 0x1c9, 0x05e,
-    0x05a, 0x05c, 0x063, 0x0ca, 0x0da, 0x1c7, 0x1ca, 0x1e0,
-    0x3db, 0x3e8, 0x7ec, 0x1e3, 0x0d2, 0x0cb, 0x0d0, 0x0d7,
-    0x0db, 0x1c6, 0x1d5, 0x1d8, 0x3ca, 0x3da, 0x7ea, 0x7f1,
-    0x1e1, 0x0d4, 0x0cf, 0x0d6, 0x0de, 0x0e1, 0x1d0, 0x1d6,
-    0x3d1, 0x3d5, 0x3f2, 0x7ee, 0x7fb, 0x3e9, 0x1cd, 0x1c8,
-    0x1cb, 0x1d1, 0x1d7, 0x1df, 0x3cf, 0x3e0, 0x3ef, 0x7e6,
-    0x7f8, 0xffa, 0x3eb, 0x1dd, 0x1d3, 0x1d9, 0x1db, 0x3d2,
-    0x3cc, 0x3dc, 0x3ea, 0x7ed, 0x7f3, 0x7f9, 0xff9, 0x7f2,
-    0x3ce, 0x1e4, 0x3cb, 0x3d8, 0x3d6, 0x3e2, 0x3e5, 0x7e8,
-    0x7f4, 0x7f5, 0x7f7, 0xffb, 0x7fa, 0x3ec, 0x3df, 0x3e1,
-    0x3e4, 0x3e6, 0x3f0, 0x7e9, 0x7ef, 0xff8, 0xffe, 0xffc,
-    0xfff,
-};
-
-static const uint8_t bits10[169] = {
-     6,  5,  6,  6,  7,  8,  9, 10, 10, 10, 11, 11, 12,  5,  4,  4,
-     5,  6,  7,  7,  8,  8,  9, 10, 10, 11,  6,  4,  5,  5,  6,  6,
-     7,  8,  8,  9,  9, 10, 10,  6,  5,  5,  5,  6,  7,  7,  8,  8,
-     9,  9, 10, 10,  7,  6,  6,  6,  6,  7,  7,  8,  8,  9,  9, 10,
-    10,  8,  7,  6,  7,  7,  7,  8,  8,  8,  9, 10, 10, 11,  9,  7,
-     7,  7,  7,  8,  8,  9,  9,  9, 10, 10, 11,  9,  8,  8,  8,  8,
-     8,  9,  9,  9, 10, 10, 11, 11,  9,  8,  8,  8,  8,  8,  9,  9,
-    10, 10, 10, 11, 11, 10,  9,  9,  9,  9,  9,  9, 10, 10, 10, 11,
-    11, 12, 10,  9,  9,  9,  9, 10, 10, 10, 10, 11, 11, 11, 12, 11,
-    10,  9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 11, 10, 10, 10,
-    10, 10, 10, 11, 11, 12, 12, 12, 12,
-};
-
-static const uint16_t codes11[289] = {
-    0x000, 0x006, 0x019, 0x03d, 0x09c, 0x0c6, 0x1a7, 0x390,
-    0x3c2, 0x3df, 0x7e6, 0x7f3, 0xffb, 0x7ec, 0xffa, 0xffe,
-    0x38e, 0x005, 0x001, 0x008, 0x014, 0x037, 0x042, 0x092,
-    0x0af, 0x191, 0x1a5, 0x1b5, 0x39e, 0x3c0, 0x3a2, 0x3cd,
-    0x7d6, 0x0ae, 0x017, 0x007, 0x009, 0x018, 0x039, 0x040,
-    0x08e, 0x0a3, 0x0b8, 0x199, 0x1ac, 0x1c1, 0x3b1, 0x396,
-    0x3be, 0x3ca, 0x09d, 0x03c, 0x015, 0x016, 0x01a, 0x03b,
-    0x044, 0x091, 0x0a5, 0x0be, 0x196, 0x1ae, 0x1b9, 0x3a1,
-    0x391, 0x3a5, 0x3d5, 0x094, 0x09a, 0x036, 0x038, 0x03a,
-    0x041, 0x08c, 0x09b, 0x0b0, 0x0c3, 0x19e, 0x1ab, 0x1bc,
-    0x39f, 0x38f, 0x3a9, 0x3cf, 0x093, 0x0bf, 0x03e, 0x03f,
-    0x043, 0x045, 0x09e, 0x0a7, 0x0b9, 0x194, 0x1a2, 0x1ba,
-    0x1c3, 0x3a6, 0x3a7, 0x3bb, 0x3d4, 0x09f, 0x1a0, 0x08f,
-    0x08d, 0x090, 0x098, 0x0a6, 0x0b6, 0x0c4, 0x19f, 0x1af,
-    0x1bf, 0x399, 0x3bf, 0x3b4, 0x3c9, 0x3e7, 0x0a8, 0x1b6,
-    0x0ab, 0x0a4, 0x0aa, 0x0b2, 0x0c2, 0x0c5, 0x198, 0x1a4,
-    0x1b8, 0x38c, 0x3a4, 0x3c4, 0x3c6, 0x3dd, 0x3e8, 0x0ad,
-    0x3af, 0x192, 0x0bd, 0x0bc, 0x18e, 0x197, 0x19a, 0x1a3,
-    0x1b1, 0x38d, 0x398, 0x3b7, 0x3d3, 0x3d1, 0x3db, 0x7dd,
-    0x0b4, 0x3de, 0x1a9, 0x19b, 0x19c, 0x1a1, 0x1aa, 0x1ad,
-    0x1b3, 0x38b, 0x3b2, 0x3b8, 0x3ce, 0x3e1, 0x3e0, 0x7d2,
-    0x7e5, 0x0b7, 0x7e3, 0x1bb, 0x1a8, 0x1a6, 0x1b0, 0x1b2,
-    0x1b7, 0x39b, 0x39a, 0x3ba, 0x3b5, 0x3d6, 0x7d7, 0x3e4,
-    0x7d8, 0x7ea, 0x0ba, 0x7e8, 0x3a0, 0x1bd, 0x1b4, 0x38a,
-    0x1c4, 0x392, 0x3aa, 0x3b0, 0x3bc, 0x3d7, 0x7d4, 0x7dc,
-    0x7db, 0x7d5, 0x7f0, 0x0c1, 0x7fb, 0x3c8, 0x3a3, 0x395,
-    0x39d, 0x3ac, 0x3ae, 0x3c5, 0x3d8, 0x3e2, 0x3e6, 0x7e4,
-    0x7e7, 0x7e0, 0x7e9, 0x7f7, 0x190, 0x7f2, 0x393, 0x1be,
-    0x1c0, 0x394, 0x397, 0x3ad, 0x3c3, 0x3c1, 0x3d2, 0x7da,
-    0x7d9, 0x7df, 0x7eb, 0x7f4, 0x7fa, 0x195, 0x7f8, 0x3bd,
-    0x39c, 0x3ab, 0x3a8, 0x3b3, 0x3b9, 0x3d0, 0x3e3, 0x3e5,
-    0x7e2, 0x7de, 0x7ed, 0x7f1, 0x7f9, 0x7fc, 0x193, 0xffd,
-    0x3dc, 0x3b6, 0x3c7, 0x3cc, 0x3cb, 0x3d9, 0x3da, 0x7d3,
-    0x7e1, 0x7ee, 0x7ef, 0x7f5, 0x7f6, 0xffc, 0xfff, 0x19d,
-    0x1c2, 0x0b5, 0x0a1, 0x096, 0x097, 0x095, 0x099, 0x0a0,
-    0x0a2, 0x0ac, 0x0a9, 0x0b1, 0x0b3, 0x0bb, 0x0c0, 0x18f,
-    0x004,
-};
-
-static const uint8_t bits11[289] = {
-     4,  5,  6,  7,  8,  8,  9, 10, 10, 10, 11, 11, 12, 11, 12, 12,
-    10,  5,  4,  5,  6,  7,  7,  8,  8,  9,  9,  9, 10, 10, 10, 10,
-    11,  8,  6,  5,  5,  6,  7,  7,  8,  8,  8,  9,  9,  9, 10, 10,
-    10, 10,  8,  7,  6,  6,  6,  7,  7,  8,  8,  8,  9,  9,  9, 10,
-    10, 10, 10,  8,  8,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,
-    10, 10, 10, 10,  8,  8,  7,  7,  7,  7,  8,  8,  8,  9,  9,  9,
-     9, 10, 10, 10, 10,  8,  9,  8,  8,  8,  8,  8,  8,  8,  9,  9,
-     9, 10, 10, 10, 10, 10,  8,  9,  8,  8,  8,  8,  8,  8,  9,  9,
-     9, 10, 10, 10, 10, 10, 10,  8, 10,  9,  8,  8,  9,  9,  9,  9,
-     9, 10, 10, 10, 10, 10, 10, 11,  8, 10,  9,  9,  9,  9,  9,  9,
-     9, 10, 10, 10, 10, 10, 10, 11, 11,  8, 11,  9,  9,  9,  9,  9,
-     9, 10, 10, 10, 10, 10, 11, 10, 11, 11,  8, 11, 10,  9,  9, 10,
-     9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,  8, 11, 10, 10, 10,
-    10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,  9, 11, 10,  9,
-     9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,  9, 11, 10,
-    10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,  9, 12,
-    10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12,  9,
-     9,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  9,
-     5,
-};
-
-const uint16_t * const ff_aac_spectral_codes[11] = {
-    codes1,  codes2,  codes3, codes4, codes5, codes6, codes7, codes8,
-    codes9, codes10, codes11,
-};
-
-const uint8_t * const ff_aac_spectral_bits[11] = {
-    bits1,  bits2,  bits3, bits4, bits5, bits6, bits7, bits8,
-    bits9, bits10, bits11,
-};
-
-const uint16_t ff_aac_spectral_sizes[11] = {
-    81, 81, 81, 81, 81, 81, 64, 64, 169, 169, 289,
-};
-
-/* NOTE:
- * 64.0f is a special value indicating the existence of an escape code in the
- * bitstream.
- */
-static const DECLARE_ALIGNED(16, float, codebook_vector0)[324] = {
- -1.0000000, -1.0000000, -1.0000000, -1.0000000,
- -1.0000000, -1.0000000, -1.0000000,  0.0000000,
- -1.0000000, -1.0000000, -1.0000000,  1.0000000,
- -1.0000000, -1.0000000,  0.0000000, -1.0000000,
- -1.0000000, -1.0000000,  0.0000000,  0.0000000,
- -1.0000000, -1.0000000,  0.0000000,  1.0000000,
- -1.0000000, -1.0000000,  1.0000000, -1.0000000,
- -1.0000000, -1.0000000,  1.0000000,  0.0000000,
- -1.0000000, -1.0000000,  1.0000000,  1.0000000,
- -1.0000000,  0.0000000, -1.0000000, -1.0000000,
- -1.0000000,  0.0000000, -1.0000000,  0.0000000,
- -1.0000000,  0.0000000, -1.0000000,  1.0000000,
- -1.0000000,  0.0000000,  0.0000000, -1.0000000,
- -1.0000000,  0.0000000,  0.0000000,  0.0000000,
- -1.0000000,  0.0000000,  0.0000000,  1.0000000,
- -1.0000000,  0.0000000,  1.0000000, -1.0000000,
- -1.0000000,  0.0000000,  1.0000000,  0.0000000,
- -1.0000000,  0.0000000,  1.0000000,  1.0000000,
- -1.0000000,  1.0000000, -1.0000000, -1.0000000,
- -1.0000000,  1.0000000, -1.0000000,  0.0000000,
- -1.0000000,  1.0000000, -1.0000000,  1.0000000,
- -1.0000000,  1.0000000,  0.0000000, -1.0000000,
- -1.0000000,  1.0000000,  0.0000000,  0.0000000,
- -1.0000000,  1.0000000,  0.0000000,  1.0000000,
- -1.0000000,  1.0000000,  1.0000000, -1.0000000,
- -1.0000000,  1.0000000,  1.0000000,  0.0000000,
- -1.0000000,  1.0000000,  1.0000000,  1.0000000,
-  0.0000000, -1.0000000, -1.0000000, -1.0000000,
-  0.0000000, -1.0000000, -1.0000000,  0.0000000,
-  0.0000000, -1.0000000, -1.0000000,  1.0000000,
-  0.0000000, -1.0000000,  0.0000000, -1.0000000,
-  0.0000000, -1.0000000,  0.0000000,  0.0000000,
-  0.0000000, -1.0000000,  0.0000000,  1.0000000,
-  0.0000000, -1.0000000,  1.0000000, -1.0000000,
-  0.0000000, -1.0000000,  1.0000000,  0.0000000,
-  0.0000000, -1.0000000,  1.0000000,  1.0000000,
-  0.0000000,  0.0000000, -1.0000000, -1.0000000,
-  0.0000000,  0.0000000, -1.0000000,  0.0000000,
-  0.0000000,  0.0000000, -1.0000000,  1.0000000,
-  0.0000000,  0.0000000,  0.0000000, -1.0000000,
-  0.0000000,  0.0000000,  0.0000000,  0.0000000,
-  0.0000000,  0.0000000,  0.0000000,  1.0000000,
-  0.0000000,  0.0000000,  1.0000000, -1.0000000,
-  0.0000000,  0.0000000,  1.0000000,  0.0000000,
-  0.0000000,  0.0000000,  1.0000000,  1.0000000,
-  0.0000000,  1.0000000, -1.0000000, -1.0000000,
-  0.0000000,  1.0000000, -1.0000000,  0.0000000,
-  0.0000000,  1.0000000, -1.0000000,  1.0000000,
-  0.0000000,  1.0000000,  0.0000000, -1.0000000,
-  0.0000000,  1.0000000,  0.0000000,  0.0000000,
-  0.0000000,  1.0000000,  0.0000000,  1.0000000,
-  0.0000000,  1.0000000,  1.0000000, -1.0000000,
-  0.0000000,  1.0000000,  1.0000000,  0.0000000,
-  0.0000000,  1.0000000,  1.0000000,  1.0000000,
-  1.0000000, -1.0000000, -1.0000000, -1.0000000,
-  1.0000000, -1.0000000, -1.0000000,  0.0000000,
-  1.0000000, -1.0000000, -1.0000000,  1.0000000,
-  1.0000000, -1.0000000,  0.0000000, -1.0000000,
-  1.0000000, -1.0000000,  0.0000000,  0.0000000,
-  1.0000000, -1.0000000,  0.0000000,  1.0000000,
-  1.0000000, -1.0000000,  1.0000000, -1.0000000,
-  1.0000000, -1.0000000,  1.0000000,  0.0000000,
-  1.0000000, -1.0000000,  1.0000000,  1.0000000,
-  1.0000000,  0.0000000, -1.0000000, -1.0000000,
-  1.0000000,  0.0000000, -1.0000000,  0.0000000,
-  1.0000000,  0.0000000, -1.0000000,  1.0000000,
-  1.0000000,  0.0000000,  0.0000000, -1.0000000,
-  1.0000000,  0.0000000,  0.0000000,  0.0000000,
-  1.0000000,  0.0000000,  0.0000000,  1.0000000,
-  1.0000000,  0.0000000,  1.0000000, -1.0000000,
-  1.0000000,  0.0000000,  1.0000000,  0.0000000,
-  1.0000000,  0.0000000,  1.0000000,  1.0000000,
-  1.0000000,  1.0000000, -1.0000000, -1.0000000,
-  1.0000000,  1.0000000, -1.0000000,  0.0000000,
-  1.0000000,  1.0000000, -1.0000000,  1.0000000,
-  1.0000000,  1.0000000,  0.0000000, -1.0000000,
-  1.0000000,  1.0000000,  0.0000000,  0.0000000,
-  1.0000000,  1.0000000,  0.0000000,  1.0000000,
-  1.0000000,  1.0000000,  1.0000000, -1.0000000,
-  1.0000000,  1.0000000,  1.0000000,  0.0000000,
-  1.0000000,  1.0000000,  1.0000000,  1.0000000,
-};
-
-static const DECLARE_ALIGNED(16, float, codebook_vector2)[324] = {
-  0.0000000,  0.0000000,  0.0000000,  0.0000000,
-  0.0000000,  0.0000000,  0.0000000,  1.0000000,
-  0.0000000,  0.0000000,  0.0000000,  2.5198421,
-  0.0000000,  0.0000000,  1.0000000,  0.0000000,
-  0.0000000,  0.0000000,  1.0000000,  1.0000000,
-  0.0000000,  0.0000000,  1.0000000,  2.5198421,
-  0.0000000,  0.0000000,  2.5198421,  0.0000000,
-  0.0000000,  0.0000000,  2.5198421,  1.0000000,
-  0.0000000,  0.0000000,  2.5198421,  2.5198421,
-  0.0000000,  1.0000000,  0.0000000,  0.0000000,
-  0.0000000,  1.0000000,  0.0000000,  1.0000000,
-  0.0000000,  1.0000000,  0.0000000,  2.5198421,
-  0.0000000,  1.0000000,  1.0000000,  0.0000000,
-  0.0000000,  1.0000000,  1.0000000,  1.0000000,
-  0.0000000,  1.0000000,  1.0000000,  2.5198421,
-  0.0000000,  1.0000000,  2.5198421,  0.0000000,
-  0.0000000,  1.0000000,  2.5198421,  1.0000000,
-  0.0000000,  1.0000000,  2.5198421,  2.5198421,
-  0.0000000,  2.5198421,  0.0000000,  0.0000000,
-  0.0000000,  2.5198421,  0.0000000,  1.0000000,
-  0.0000000,  2.5198421,  0.0000000,  2.5198421,
-  0.0000000,  2.5198421,  1.0000000,  0.0000000,
-  0.0000000,  2.5198421,  1.0000000,  1.0000000,
-  0.0000000,  2.5198421,  1.0000000,  2.5198421,
-  0.0000000,  2.5198421,  2.5198421,  0.0000000,
-  0.0000000,  2.5198421,  2.5198421,  1.0000000,
-  0.0000000,  2.5198421,  2.5198421,  2.5198421,
-  1.0000000,  0.0000000,  0.0000000,  0.0000000,
-  1.0000000,  0.0000000,  0.0000000,  1.0000000,
-  1.0000000,  0.0000000,  0.0000000,  2.5198421,
-  1.0000000,  0.0000000,  1.0000000,  0.0000000,
-  1.0000000,  0.0000000,  1.0000000,  1.0000000,
-  1.0000000,  0.0000000,  1.0000000,  2.5198421,
-  1.0000000,  0.0000000,  2.5198421,  0.0000000,
-  1.0000000,  0.0000000,  2.5198421,  1.0000000,
-  1.0000000,  0.0000000,  2.5198421,  2.5198421,
-  1.0000000,  1.0000000,  0.0000000,  0.0000000,
-  1.0000000,  1.0000000,  0.0000000,  1.0000000,
-  1.0000000,  1.0000000,  0.0000000,  2.5198421,
-  1.0000000,  1.0000000,  1.0000000,  0.0000000,
-  1.0000000,  1.0000000,  1.0000000,  1.0000000,
-  1.0000000,  1.0000000,  1.0000000,  2.5198421,
-  1.0000000,  1.0000000,  2.5198421,  0.0000000,
-  1.0000000,  1.0000000,  2.5198421,  1.0000000,
-  1.0000000,  1.0000000,  2.5198421,  2.5198421,
-  1.0000000,  2.5198421,  0.0000000,  0.0000000,
-  1.0000000,  2.5198421,  0.0000000,  1.0000000,
-  1.0000000,  2.5198421,  0.0000000,  2.5198421,
-  1.0000000,  2.5198421,  1.0000000,  0.0000000,
-  1.0000000,  2.5198421,  1.0000000,  1.0000000,
-  1.0000000,  2.5198421,  1.0000000,  2.5198421,
-  1.0000000,  2.5198421,  2.5198421,  0.0000000,
-  1.0000000,  2.5198421,  2.5198421,  1.0000000,
-  1.0000000,  2.5198421,  2.5198421,  2.5198421,
-  2.5198421,  0.0000000,  0.0000000,  0.0000000,
-  2.5198421,  0.0000000,  0.0000000,  1.0000000,
-  2.5198421,  0.0000000,  0.0000000,  2.5198421,
-  2.5198421,  0.0000000,  1.0000000,  0.0000000,
-  2.5198421,  0.0000000,  1.0000000,  1.0000000,
-  2.5198421,  0.0000000,  1.0000000,  2.5198421,
-  2.5198421,  0.0000000,  2.5198421,  0.0000000,
-  2.5198421,  0.0000000,  2.5198421,  1.0000000,
-  2.5198421,  0.0000000,  2.5198421,  2.5198421,
-  2.5198421,  1.0000000,  0.0000000,  0.0000000,
-  2.5198421,  1.0000000,  0.0000000,  1.0000000,
-  2.5198421,  1.0000000,  0.0000000,  2.5198421,
-  2.5198421,  1.0000000,  1.0000000,  0.0000000,
-  2.5198421,  1.0000000,  1.0000000,  1.0000000,
-  2.5198421,  1.0000000,  1.0000000,  2.5198421,
-  2.5198421,  1.0000000,  2.5198421,  0.0000000,
-  2.5198421,  1.0000000,  2.5198421,  1.0000000,
-  2.5198421,  1.0000000,  2.5198421,  2.5198421,
-  2.5198421,  2.5198421,  0.0000000,  0.0000000,
-  2.5198421,  2.5198421,  0.0000000,  1.0000000,
-  2.5198421,  2.5198421,  0.0000000,  2.5198421,
-  2.5198421,  2.5198421,  1.0000000,  0.0000000,
-  2.5198421,  2.5198421,  1.0000000,  1.0000000,
-  2.5198421,  2.5198421,  1.0000000,  2.5198421,
-  2.5198421,  2.5198421,  2.5198421,  0.0000000,
-  2.5198421,  2.5198421,  2.5198421,  1.0000000,
-  2.5198421,  2.5198421,  2.5198421,  2.5198421,
-};
-
-static const DECLARE_ALIGNED(16, float, codebook_vector4)[162] = {
- -6.3496042, -6.3496042, -6.3496042, -4.3267487,
- -6.3496042, -2.5198421, -6.3496042, -1.0000000,
- -6.3496042,  0.0000000, -6.3496042,  1.0000000,
- -6.3496042,  2.5198421, -6.3496042,  4.3267487,
- -6.3496042,  6.3496042, -4.3267487, -6.3496042,
- -4.3267487, -4.3267487, -4.3267487, -2.5198421,
- -4.3267487, -1.0000000, -4.3267487,  0.0000000,
- -4.3267487,  1.0000000, -4.3267487,  2.5198421,
- -4.3267487,  4.3267487, -4.3267487,  6.3496042,
- -2.5198421, -6.3496042, -2.5198421, -4.3267487,
- -2.5198421, -2.5198421, -2.5198421, -1.0000000,
- -2.5198421,  0.0000000, -2.5198421,  1.0000000,
- -2.5198421,  2.5198421, -2.5198421,  4.3267487,
- -2.5198421,  6.3496042, -1.0000000, -6.3496042,
- -1.0000000, -4.3267487, -1.0000000, -2.5198421,
- -1.0000000, -1.0000000, -1.0000000,  0.0000000,
- -1.0000000,  1.0000000, -1.0000000,  2.5198421,
- -1.0000000,  4.3267487, -1.0000000,  6.3496042,
-  0.0000000, -6.3496042,  0.0000000, -4.3267487,
-  0.0000000, -2.5198421,  0.0000000, -1.0000000,
-  0.0000000,  0.0000000,  0.0000000,  1.0000000,
-  0.0000000,  2.5198421,  0.0000000,  4.3267487,
-  0.0000000,  6.3496042,  1.0000000, -6.3496042,
-  1.0000000, -4.3267487,  1.0000000, -2.5198421,
-  1.0000000, -1.0000000,  1.0000000,  0.0000000,
-  1.0000000,  1.0000000,  1.0000000,  2.5198421,
-  1.0000000,  4.3267487,  1.0000000,  6.3496042,
-  2.5198421, -6.3496042,  2.5198421, -4.3267487,
-  2.5198421, -2.5198421,  2.5198421, -1.0000000,
-  2.5198421,  0.0000000,  2.5198421,  1.0000000,
-  2.5198421,  2.5198421,  2.5198421,  4.3267487,
-  2.5198421,  6.3496042,  4.3267487, -6.3496042,
-  4.3267487, -4.3267487,  4.3267487, -2.5198421,
-  4.3267487, -1.0000000,  4.3267487,  0.0000000,
-  4.3267487,  1.0000000,  4.3267487,  2.5198421,
-  4.3267487,  4.3267487,  4.3267487,  6.3496042,
-  6.3496042, -6.3496042,  6.3496042, -4.3267487,
-  6.3496042, -2.5198421,  6.3496042, -1.0000000,
-  6.3496042,  0.0000000,  6.3496042,  1.0000000,
-  6.3496042,  2.5198421,  6.3496042,  4.3267487,
-  6.3496042,  6.3496042,
-};
-
-static const DECLARE_ALIGNED(16, float, codebook_vector6)[128] = {
-  0.0000000,  0.0000000,  0.0000000,  1.0000000,
-  0.0000000,  2.5198421,  0.0000000,  4.3267487,
-  0.0000000,  6.3496042,  0.0000000,  8.5498797,
-  0.0000000, 10.9027236,  0.0000000, 13.3905183,
-  1.0000000,  0.0000000,  1.0000000,  1.0000000,
-  1.0000000,  2.5198421,  1.0000000,  4.3267487,
-  1.0000000,  6.3496042,  1.0000000,  8.5498797,
-  1.0000000, 10.9027236,  1.0000000, 13.3905183,
-  2.5198421,  0.0000000,  2.5198421,  1.0000000,
-  2.5198421,  2.5198421,  2.5198421,  4.3267487,
-  2.5198421,  6.3496042,  2.5198421,  8.5498797,
-  2.5198421, 10.9027236,  2.5198421, 13.3905183,
-  4.3267487,  0.0000000,  4.3267487,  1.0000000,
-  4.3267487,  2.5198421,  4.3267487,  4.3267487,
-  4.3267487,  6.3496042,  4.3267487,  8.5498797,
-  4.3267487, 10.9027236,  4.3267487, 13.3905183,
-  6.3496042,  0.0000000,  6.3496042,  1.0000000,
-  6.3496042,  2.5198421,  6.3496042,  4.3267487,
-  6.3496042,  6.3496042,  6.3496042,  8.5498797,
-  6.3496042, 10.9027236,  6.3496042, 13.3905183,
-  8.5498797,  0.0000000,  8.5498797,  1.0000000,
-  8.5498797,  2.5198421,  8.5498797,  4.3267487,
-  8.5498797,  6.3496042,  8.5498797,  8.5498797,
-  8.5498797, 10.9027236,  8.5498797, 13.3905183,
- 10.9027236,  0.0000000, 10.9027236,  1.0000000,
- 10.9027236,  2.5198421, 10.9027236,  4.3267487,
- 10.9027236,  6.3496042, 10.9027236,  8.5498797,
- 10.9027236, 10.9027236, 10.9027236, 13.3905183,
- 13.3905183,  0.0000000, 13.3905183,  1.0000000,
- 13.3905183,  2.5198421, 13.3905183,  4.3267487,
- 13.3905183,  6.3496042, 13.3905183,  8.5498797,
- 13.3905183, 10.9027236, 13.3905183, 13.3905183,
-};
-
-static const DECLARE_ALIGNED(16, float, codebook_vector8)[338] = {
-  0.0000000,  0.0000000,  0.0000000,  1.0000000,
-  0.0000000,  2.5198421,  0.0000000,  4.3267487,
-  0.0000000,  6.3496042,  0.0000000,  8.5498797,
-  0.0000000, 10.9027236,  0.0000000, 13.3905183,
-  0.0000000, 16.0000000,  0.0000000, 18.7207544,
-  0.0000000, 21.5443469,  0.0000000, 24.4637810,
-  0.0000000, 27.4731418,  1.0000000,  0.0000000,
-  1.0000000,  1.0000000,  1.0000000,  2.5198421,
-  1.0000000,  4.3267487,  1.0000000,  6.3496042,
-  1.0000000,  8.5498797,  1.0000000, 10.9027236,
-  1.0000000, 13.3905183,  1.0000000, 16.0000000,
-  1.0000000, 18.7207544,  1.0000000, 21.5443469,
-  1.0000000, 24.4637810,  1.0000000, 27.4731418,
-  2.5198421,  0.0000000,  2.5198421,  1.0000000,
-  2.5198421,  2.5198421,  2.5198421,  4.3267487,
-  2.5198421,  6.3496042,  2.5198421,  8.5498797,
-  2.5198421, 10.9027236,  2.5198421, 13.3905183,
-  2.5198421, 16.0000000,  2.5198421, 18.7207544,
-  2.5198421, 21.5443469,  2.5198421, 24.4637810,
-  2.5198421, 27.4731418,  4.3267487,  0.0000000,
-  4.3267487,  1.0000000,  4.3267487,  2.5198421,
-  4.3267487,  4.3267487,  4.3267487,  6.3496042,
-  4.3267487,  8.5498797,  4.3267487, 10.9027236,
-  4.3267487, 13.3905183,  4.3267487, 16.0000000,
-  4.3267487, 18.7207544,  4.3267487, 21.5443469,
-  4.3267487, 24.4637810,  4.3267487, 27.4731418,
-  6.3496042,  0.0000000,  6.3496042,  1.0000000,
-  6.3496042,  2.5198421,  6.3496042,  4.3267487,
-  6.3496042,  6.3496042,  6.3496042,  8.5498797,
-  6.3496042, 10.9027236,  6.3496042, 13.3905183,
-  6.3496042, 16.0000000,  6.3496042, 18.7207544,
-  6.3496042, 21.5443469,  6.3496042, 24.4637810,
-  6.3496042, 27.4731418,  8.5498797,  0.0000000,
-  8.5498797,  1.0000000,  8.5498797,  2.5198421,
-  8.5498797,  4.3267487,  8.5498797,  6.3496042,
-  8.5498797,  8.5498797,  8.5498797, 10.9027236,
-  8.5498797, 13.3905183,  8.5498797, 16.0000000,
-  8.5498797, 18.7207544,  8.5498797, 21.5443469,
-  8.5498797, 24.4637810,  8.5498797, 27.4731418,
- 10.9027236,  0.0000000, 10.9027236,  1.0000000,
- 10.9027236,  2.5198421, 10.9027236,  4.3267487,
- 10.9027236,  6.3496042, 10.9027236,  8.5498797,
- 10.9027236, 10.9027236, 10.9027236, 13.3905183,
- 10.9027236, 16.0000000, 10.9027236, 18.7207544,
- 10.9027236, 21.5443469, 10.9027236, 24.4637810,
- 10.9027236, 27.4731418, 13.3905183,  0.0000000,
- 13.3905183,  1.0000000, 13.3905183,  2.5198421,
- 13.3905183,  4.3267487, 13.3905183,  6.3496042,
- 13.3905183,  8.5498797, 13.3905183, 10.9027236,
- 13.3905183, 13.3905183, 13.3905183, 16.0000000,
- 13.3905183, 18.7207544, 13.3905183, 21.5443469,
- 13.3905183, 24.4637810, 13.3905183, 27.4731418,
- 16.0000000,  0.0000000, 16.0000000,  1.0000000,
- 16.0000000,  2.5198421, 16.0000000,  4.3267487,
- 16.0000000,  6.3496042, 16.0000000,  8.5498797,
- 16.0000000, 10.9027236, 16.0000000, 13.3905183,
- 16.0000000, 16.0000000, 16.0000000, 18.7207544,
- 16.0000000, 21.5443469, 16.0000000, 24.4637810,
- 16.0000000, 27.4731418, 18.7207544,  0.0000000,
- 18.7207544,  1.0000000, 18.7207544,  2.5198421,
- 18.7207544,  4.3267487, 18.7207544,  6.3496042,
- 18.7207544,  8.5498797, 18.7207544, 10.9027236,
- 18.7207544, 13.3905183, 18.7207544, 16.0000000,
- 18.7207544, 18.7207544, 18.7207544, 21.5443469,
- 18.7207544, 24.4637810, 18.7207544, 27.4731418,
- 21.5443469,  0.0000000, 21.5443469,  1.0000000,
- 21.5443469,  2.5198421, 21.5443469,  4.3267487,
- 21.5443469,  6.3496042, 21.5443469,  8.5498797,
- 21.5443469, 10.9027236, 21.5443469, 13.3905183,
- 21.5443469, 16.0000000, 21.5443469, 18.7207544,
- 21.5443469, 21.5443469, 21.5443469, 24.4637810,
- 21.5443469, 27.4731418, 24.4637810,  0.0000000,
- 24.4637810,  1.0000000, 24.4637810,  2.5198421,
- 24.4637810,  4.3267487, 24.4637810,  6.3496042,
- 24.4637810,  8.5498797, 24.4637810, 10.9027236,
- 24.4637810, 13.3905183, 24.4637810, 16.0000000,
- 24.4637810, 18.7207544, 24.4637810, 21.5443469,
- 24.4637810, 24.4637810, 24.4637810, 27.4731418,
- 27.4731418,  0.0000000, 27.4731418,  1.0000000,
- 27.4731418,  2.5198421, 27.4731418,  4.3267487,
- 27.4731418,  6.3496042, 27.4731418,  8.5498797,
- 27.4731418, 10.9027236, 27.4731418, 13.3905183,
- 27.4731418, 16.0000000, 27.4731418, 18.7207544,
- 27.4731418, 21.5443469, 27.4731418, 24.4637810,
- 27.4731418, 27.4731418,
-};
-
-static const DECLARE_ALIGNED(16, float, codebook_vector10)[578] = {
-  0.0000000,  0.0000000,  0.0000000,  1.0000000,
-  0.0000000,  2.5198421,  0.0000000,  4.3267487,
-  0.0000000,  6.3496042,  0.0000000,  8.5498797,
-  0.0000000, 10.9027236,  0.0000000, 13.3905183,
-  0.0000000, 16.0000000,  0.0000000, 18.7207544,
-  0.0000000, 21.5443469,  0.0000000, 24.4637810,
-  0.0000000, 27.4731418,  0.0000000, 30.5673509,
-  0.0000000, 33.7419917,  0.0000000, 36.9931811,
-  0.0000000,      64.0f,  1.0000000,  0.0000000,
-  1.0000000,  1.0000000,  1.0000000,  2.5198421,
-  1.0000000,  4.3267487,  1.0000000,  6.3496042,
-  1.0000000,  8.5498797,  1.0000000, 10.9027236,
-  1.0000000, 13.3905183,  1.0000000, 16.0000000,
-  1.0000000, 18.7207544,  1.0000000, 21.5443469,
-  1.0000000, 24.4637810,  1.0000000, 27.4731418,
-  1.0000000, 30.5673509,  1.0000000, 33.7419917,
-  1.0000000, 36.9931811,  1.0000000,      64.0f,
-  2.5198421,  0.0000000,  2.5198421,  1.0000000,
-  2.5198421,  2.5198421,  2.5198421,  4.3267487,
-  2.5198421,  6.3496042,  2.5198421,  8.5498797,
-  2.5198421, 10.9027236,  2.5198421, 13.3905183,
-  2.5198421, 16.0000000,  2.5198421, 18.7207544,
-  2.5198421, 21.5443469,  2.5198421, 24.4637810,
-  2.5198421, 27.4731418,  2.5198421, 30.5673509,
-  2.5198421, 33.7419917,  2.5198421, 36.9931811,
-  2.5198421,      64.0f,  4.3267487,  0.0000000,
-  4.3267487,  1.0000000,  4.3267487,  2.5198421,
-  4.3267487,  4.3267487,  4.3267487,  6.3496042,
-  4.3267487,  8.5498797,  4.3267487, 10.9027236,
-  4.3267487, 13.3905183,  4.3267487, 16.0000000,
-  4.3267487, 18.7207544,  4.3267487, 21.5443469,
-  4.3267487, 24.4637810,  4.3267487, 27.4731418,
-  4.3267487, 30.5673509,  4.3267487, 33.7419917,
-  4.3267487, 36.9931811,  4.3267487,      64.0f,
-  6.3496042,  0.0000000,  6.3496042,  1.0000000,
-  6.3496042,  2.5198421,  6.3496042,  4.3267487,
-  6.3496042,  6.3496042,  6.3496042,  8.5498797,
-  6.3496042, 10.9027236,  6.3496042, 13.3905183,
-  6.3496042, 16.0000000,  6.3496042, 18.7207544,
-  6.3496042, 21.5443469,  6.3496042, 24.4637810,
-  6.3496042, 27.4731418,  6.3496042, 30.5673509,
-  6.3496042, 33.7419917,  6.3496042, 36.9931811,
-  6.3496042,      64.0f,  8.5498797,  0.0000000,
-  8.5498797,  1.0000000,  8.5498797,  2.5198421,
-  8.5498797,  4.3267487,  8.5498797,  6.3496042,
-  8.5498797,  8.5498797,  8.5498797, 10.9027236,
-  8.5498797, 13.3905183,  8.5498797, 16.0000000,
-  8.5498797, 18.7207544,  8.5498797, 21.5443469,
-  8.5498797, 24.4637810,  8.5498797, 27.4731418,
-  8.5498797, 30.5673509,  8.5498797, 33.7419917,
-  8.5498797, 36.9931811,  8.5498797,      64.0f,
- 10.9027236,  0.0000000, 10.9027236,  1.0000000,
- 10.9027236,  2.5198421, 10.9027236,  4.3267487,
- 10.9027236,  6.3496042, 10.9027236,  8.5498797,
- 10.9027236, 10.9027236, 10.9027236, 13.3905183,
- 10.9027236, 16.0000000, 10.9027236, 18.7207544,
- 10.9027236, 21.5443469, 10.9027236, 24.4637810,
- 10.9027236, 27.4731418, 10.9027236, 30.5673509,
- 10.9027236, 33.7419917, 10.9027236, 36.9931811,
- 10.9027236,      64.0f, 13.3905183,  0.0000000,
- 13.3905183,  1.0000000, 13.3905183,  2.5198421,
- 13.3905183,  4.3267487, 13.3905183,  6.3496042,
- 13.3905183,  8.5498797, 13.3905183, 10.9027236,
- 13.3905183, 13.3905183, 13.3905183, 16.0000000,
- 13.3905183, 18.7207544, 13.3905183, 21.5443469,
- 13.3905183, 24.4637810, 13.3905183, 27.4731418,
- 13.3905183, 30.5673509, 13.3905183, 33.7419917,
- 13.3905183, 36.9931811, 13.3905183,      64.0f,
- 16.0000000,  0.0000000, 16.0000000,  1.0000000,
- 16.0000000,  2.5198421, 16.0000000,  4.3267487,
- 16.0000000,  6.3496042, 16.0000000,  8.5498797,
- 16.0000000, 10.9027236, 16.0000000, 13.3905183,
- 16.0000000, 16.0000000, 16.0000000, 18.7207544,
- 16.0000000, 21.5443469, 16.0000000, 24.4637810,
- 16.0000000, 27.4731418, 16.0000000, 30.5673509,
- 16.0000000, 33.7419917, 16.0000000, 36.9931811,
- 16.0000000,      64.0f, 18.7207544,  0.0000000,
- 18.7207544,  1.0000000, 18.7207544,  2.5198421,
- 18.7207544,  4.3267487, 18.7207544,  6.3496042,
- 18.7207544,  8.5498797, 18.7207544, 10.9027236,
- 18.7207544, 13.3905183, 18.7207544, 16.0000000,
- 18.7207544, 18.7207544, 18.7207544, 21.5443469,
- 18.7207544, 24.4637810, 18.7207544, 27.4731418,
- 18.7207544, 30.5673509, 18.7207544, 33.7419917,
- 18.7207544, 36.9931811, 18.7207544,      64.0f,
- 21.5443469,  0.0000000, 21.5443469,  1.0000000,
- 21.5443469,  2.5198421, 21.5443469,  4.3267487,
- 21.5443469,  6.3496042, 21.5443469,  8.5498797,
- 21.5443469, 10.9027236, 21.5443469, 13.3905183,
- 21.5443469, 16.0000000, 21.5443469, 18.7207544,
- 21.5443469, 21.5443469, 21.5443469, 24.4637810,
- 21.5443469, 27.4731418, 21.5443469, 30.5673509,
- 21.5443469, 33.7419917, 21.5443469, 36.9931811,
- 21.5443469,      64.0f, 24.4637810,  0.0000000,
- 24.4637810,  1.0000000, 24.4637810,  2.5198421,
- 24.4637810,  4.3267487, 24.4637810,  6.3496042,
- 24.4637810,  8.5498797, 24.4637810, 10.9027236,
- 24.4637810, 13.3905183, 24.4637810, 16.0000000,
- 24.4637810, 18.7207544, 24.4637810, 21.5443469,
- 24.4637810, 24.4637810, 24.4637810, 27.4731418,
- 24.4637810, 30.5673509, 24.4637810, 33.7419917,
- 24.4637810, 36.9931811, 24.4637810,      64.0f,
- 27.4731418,  0.0000000, 27.4731418,  1.0000000,
- 27.4731418,  2.5198421, 27.4731418,  4.3267487,
- 27.4731418,  6.3496042, 27.4731418,  8.5498797,
- 27.4731418, 10.9027236, 27.4731418, 13.3905183,
- 27.4731418, 16.0000000, 27.4731418, 18.7207544,
- 27.4731418, 21.5443469, 27.4731418, 24.4637810,
- 27.4731418, 27.4731418, 27.4731418, 30.5673509,
- 27.4731418, 33.7419917, 27.4731418, 36.9931811,
- 27.4731418,      64.0f, 30.5673509,  0.0000000,
- 30.5673509,  1.0000000, 30.5673509,  2.5198421,
- 30.5673509,  4.3267487, 30.5673509,  6.3496042,
- 30.5673509,  8.5498797, 30.5673509, 10.9027236,
- 30.5673509, 13.3905183, 30.5673509, 16.0000000,
- 30.5673509, 18.7207544, 30.5673509, 21.5443469,
- 30.5673509, 24.4637810, 30.5673509, 27.4731418,
- 30.5673509, 30.5673509, 30.5673509, 33.7419917,
- 30.5673509, 36.9931811, 30.5673509,      64.0f,
- 33.7419917,  0.0000000, 33.7419917,  1.0000000,
- 33.7419917,  2.5198421, 33.7419917,  4.3267487,
- 33.7419917,  6.3496042, 33.7419917,  8.5498797,
- 33.7419917, 10.9027236, 33.7419917, 13.3905183,
- 33.7419917, 16.0000000, 33.7419917, 18.7207544,
- 33.7419917, 21.5443469, 33.7419917, 24.4637810,
- 33.7419917, 27.4731418, 33.7419917, 30.5673509,
- 33.7419917, 33.7419917, 33.7419917, 36.9931811,
- 33.7419917,      64.0f, 36.9931811,  0.0000000,
- 36.9931811,  1.0000000, 36.9931811,  2.5198421,
- 36.9931811,  4.3267487, 36.9931811,  6.3496042,
- 36.9931811,  8.5498797, 36.9931811, 10.9027236,
- 36.9931811, 13.3905183, 36.9931811, 16.0000000,
- 36.9931811, 18.7207544, 36.9931811, 21.5443469,
- 36.9931811, 24.4637810, 36.9931811, 27.4731418,
- 36.9931811, 30.5673509, 36.9931811, 33.7419917,
- 36.9931811, 36.9931811, 36.9931811,      64.0f,
-      64.0f,  0.0000000,      64.0f,  1.0000000,
-      64.0f,  2.5198421,      64.0f,  4.3267487,
-      64.0f,  6.3496042,      64.0f,  8.5498797,
-      64.0f, 10.9027236,      64.0f, 13.3905183,
-      64.0f, 16.0000000,      64.0f, 18.7207544,
-      64.0f, 21.5443469,      64.0f, 24.4637810,
-      64.0f, 27.4731418,      64.0f, 30.5673509,
-      64.0f, 33.7419917,      64.0f, 36.9931811,
-      64.0f,      64.0f,
-};
-
-const float * const ff_aac_codebook_vectors[] = {
-    codebook_vector0, codebook_vector0, codebook_vector2,
-    codebook_vector2, codebook_vector4, codebook_vector4,
-    codebook_vector6, codebook_vector6, codebook_vector8,
-    codebook_vector8, codebook_vector10,
-};
-
-static const float codebook_vector0_vals[] = {
-   -1.0000000,  0.0000000,  1.0000000
-};
-
-/*
- * bits  0:1, 2:3, 4:5, 6:7  index into _vals array
- *       8:11                number of non-zero values
- *      12:15                bit mask of non-zero values
- */
-static const uint16_t codebook_vector02_idx[] = {
-    0x0000, 0x8140, 0x8180, 0x4110, 0xc250, 0xc290, 0x4120, 0xc260, 0xc2a0,
-    0x2104, 0xa244, 0xa284, 0x6214, 0xe354, 0xe394, 0x6224, 0xe364, 0xe3a4,
-    0x2108, 0xa248, 0xa288, 0x6218, 0xe358, 0xe398, 0x6228, 0xe368, 0xe3a8,
-    0x1101, 0x9241, 0x9281, 0x5211, 0xd351, 0xd391, 0x5221, 0xd361, 0xd3a1,
-    0x3205, 0xb345, 0xb385, 0x7315, 0xf455, 0xf495, 0x7325, 0xf465, 0xf4a5,
-    0x3209, 0xb349, 0xb389, 0x7319, 0xf459, 0xf499, 0x7329, 0xf469, 0xf4a9,
-    0x1102, 0x9242, 0x9282, 0x5212, 0xd352, 0xd392, 0x5222, 0xd362, 0xd3a2,
-    0x3206, 0xb346, 0xb386, 0x7316, 0xf456, 0xf496, 0x7326, 0xf466, 0xf4a6,
-    0x320a, 0xb34a, 0xb38a, 0x731a, 0xf45a, 0xf49a, 0x732a, 0xf46a, 0xf4aa,
-};
-
-static const float codebook_vector4_vals[] = {
-   -6.3496042, -4.3267487,
-   -2.5198421, -1.0000000,
-    0.0000000,  1.0000000,
-    2.5198421,  4.3267487,
-    6.3496042,
-};
-
-/*
- * bits  0:3, 4:7  index into _vals array
- */
-static const uint16_t codebook_vector4_idx[] = {
-    0x0000, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050, 0x0060, 0x0070, 0x0080,
-    0x0001, 0x0011, 0x0021, 0x0031, 0x0041, 0x0051, 0x0061, 0x0071, 0x0081,
-    0x0002, 0x0012, 0x0022, 0x0032, 0x0042, 0x0052, 0x0062, 0x0072, 0x0082,
-    0x0003, 0x0013, 0x0023, 0x0033, 0x0043, 0x0053, 0x0063, 0x0073, 0x0083,
-    0x0004, 0x0014, 0x0024, 0x0034, 0x0044, 0x0054, 0x0064, 0x0074, 0x0084,
-    0x0005, 0x0015, 0x0025, 0x0035, 0x0045, 0x0055, 0x0065, 0x0075, 0x0085,
-    0x0006, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0076, 0x0086,
-    0x0007, 0x0017, 0x0027, 0x0037, 0x0047, 0x0057, 0x0067, 0x0077, 0x0087,
-    0x0008, 0x0018, 0x0028, 0x0038, 0x0048, 0x0058, 0x0068, 0x0078, 0x0088,
-};
-
-/*
- * bits  0:3, 4:7  index into _vals array
- *       8:11      number of non-zero values
- *      12:15      1: only second value non-zero
- *                 0: other cases
- */
-static const uint16_t codebook_vector6_idx[] = {
-    0x0000, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170,
-    0x1101, 0x0211, 0x0221, 0x0231, 0x0241, 0x0251, 0x0261, 0x0271,
-    0x1102, 0x0212, 0x0222, 0x0232, 0x0242, 0x0252, 0x0262, 0x0272,
-    0x1103, 0x0213, 0x0223, 0x0233, 0x0243, 0x0253, 0x0263, 0x0273,
-    0x1104, 0x0214, 0x0224, 0x0234, 0x0244, 0x0254, 0x0264, 0x0274,
-    0x1105, 0x0215, 0x0225, 0x0235, 0x0245, 0x0255, 0x0265, 0x0275,
-    0x1106, 0x0216, 0x0226, 0x0236, 0x0246, 0x0256, 0x0266, 0x0276,
-    0x1107, 0x0217, 0x0227, 0x0237, 0x0247, 0x0257, 0x0267, 0x0277,
-};
-
-/*
- * bits  0:3, 4:7  index into _vals array
- *       8:11      number of non-zero values
- *      12:15      1: only second value non-zero
- *                 0: other cases
- */
-static const uint16_t codebook_vector8_idx[] = {
-  0x0000, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160,
-  0x0170, 0x0180, 0x0190, 0x01a0, 0x01b0, 0x01c0,
-  0x1101, 0x0211, 0x0221, 0x0231, 0x0241, 0x0251, 0x0261,
-  0x0271, 0x0281, 0x0291, 0x02a1, 0x02b1, 0x02c1,
-  0x1102, 0x0212, 0x0222, 0x0232, 0x0242, 0x0252, 0x0262,
-  0x0272, 0x0282, 0x0292, 0x02a2, 0x02b2, 0x02c2,
-  0x1103, 0x0213, 0x0223, 0x0233, 0x0243, 0x0253, 0x0263,
-  0x0273, 0x0283, 0x0293, 0x02a3, 0x02b3, 0x02c3,
-  0x1104, 0x0214, 0x0224, 0x0234, 0x0244, 0x0254, 0x0264,
-  0x0274, 0x0284, 0x0294, 0x02a4, 0x02b4, 0x02c4,
-  0x1105, 0x0215, 0x0225, 0x0235, 0x0245, 0x0255, 0x0265,
-  0x0275, 0x0285, 0x0295, 0x02a5, 0x02b5, 0x02c5,
-  0x1106, 0x0216, 0x0226, 0x0236, 0x0246, 0x0256, 0x0266,
-  0x0276, 0x0286, 0x0296, 0x02a6, 0x02b6, 0x02c6,
-  0x1107, 0x0217, 0x0227, 0x0237, 0x0247, 0x0257, 0x0267,
-  0x0277, 0x0287, 0x0297, 0x02a7, 0x02b7, 0x02c7,
-  0x1108, 0x0218, 0x0228, 0x0238, 0x0248, 0x0258, 0x0268,
-  0x0278, 0x0288, 0x0298, 0x02a8, 0x02b8, 0x02c8,
-  0x1109, 0x0219, 0x0229, 0x0239, 0x0249, 0x0259, 0x0269,
-  0x0279, 0x0289, 0x0299, 0x02a9, 0x02b9, 0x02c9,
-  0x110a, 0x021a, 0x022a, 0x023a, 0x024a, 0x025a, 0x026a,
-  0x027a, 0x028a, 0x029a, 0x02aa, 0x02ba, 0x02ca,
-  0x110b, 0x021b, 0x022b, 0x023b, 0x024b, 0x025b, 0x026b,
-  0x027b, 0x028b, 0x029b, 0x02ab, 0x02bb, 0x02cb,
-  0x110c, 0x021c, 0x022c, 0x023c, 0x024c, 0x025c, 0x026c,
-  0x027c, 0x028c, 0x029c, 0x02ac, 0x02bc, 0x02cc,
-};
-
-static const float codebook_vector10_vals[] = {
-     0.0000000,  1.0000000,
-     2.5198421,  4.3267487,
-     6.3496042,  8.5498797,
-    10.9027236, 13.3905183,
-    16.0000000, 18.7207544,
-    21.5443469, 24.4637810,
-    27.4731418, 30.5673509,
-    33.7419917, 36.9931811,
-};
-
-/*
- * bits  0:3, 4:7  index into _vals array
- *       8:9       bit mask of escape-coded entries
- *      12:15      number of non-zero values
- */
-static const uint16_t codebook_vector10_idx[] = {
-    0x0000, 0x1010, 0x1020, 0x1030, 0x1040, 0x1050, 0x1060, 0x1070,
-    0x1080, 0x1090, 0x10a0, 0x10b0, 0x10c0, 0x10d0, 0x10e0, 0x10f0, 0x1200,
-    0x1001, 0x2011, 0x2021, 0x2031, 0x2041, 0x2051, 0x2061, 0x2071,
-    0x2081, 0x2091, 0x20a1, 0x20b1, 0x20c1, 0x20d1, 0x20e1, 0x20f1, 0x2201,
-    0x1002, 0x2012, 0x2022, 0x2032, 0x2042, 0x2052, 0x2062, 0x2072,
-    0x2082, 0x2092, 0x20a2, 0x20b2, 0x20c2, 0x20d2, 0x20e2, 0x20f2, 0x2202,
-    0x1003, 0x2013, 0x2023, 0x2033, 0x2043, 0x2053, 0x2063, 0x2073,
-    0x2083, 0x2093, 0x20a3, 0x20b3, 0x20c3, 0x20d3, 0x20e3, 0x20f3, 0x2203,
-    0x1004, 0x2014, 0x2024, 0x2034, 0x2044, 0x2054, 0x2064, 0x2074,
-    0x2084, 0x2094, 0x20a4, 0x20b4, 0x20c4, 0x20d4, 0x20e4, 0x20f4, 0x2204,
-    0x1005, 0x2015, 0x2025, 0x2035, 0x2045, 0x2055, 0x2065, 0x2075,
-    0x2085, 0x2095, 0x20a5, 0x20b5, 0x20c5, 0x20d5, 0x20e5, 0x20f5, 0x2205,
-    0x1006, 0x2016, 0x2026, 0x2036, 0x2046, 0x2056, 0x2066, 0x2076,
-    0x2086, 0x2096, 0x20a6, 0x20b6, 0x20c6, 0x20d6, 0x20e6, 0x20f6, 0x2206,
-    0x1007, 0x2017, 0x2027, 0x2037, 0x2047, 0x2057, 0x2067, 0x2077,
-    0x2087, 0x2097, 0x20a7, 0x20b7, 0x20c7, 0x20d7, 0x20e7, 0x20f7, 0x2207,
-    0x1008, 0x2018, 0x2028, 0x2038, 0x2048, 0x2058, 0x2068, 0x2078,
-    0x2088, 0x2098, 0x20a8, 0x20b8, 0x20c8, 0x20d8, 0x20e8, 0x20f8, 0x2208,
-    0x1009, 0x2019, 0x2029, 0x2039, 0x2049, 0x2059, 0x2069, 0x2079,
-    0x2089, 0x2099, 0x20a9, 0x20b9, 0x20c9, 0x20d9, 0x20e9, 0x20f9, 0x2209,
-    0x100a, 0x201a, 0x202a, 0x203a, 0x204a, 0x205a, 0x206a, 0x207a,
-    0x208a, 0x209a, 0x20aa, 0x20ba, 0x20ca, 0x20da, 0x20ea, 0x20fa, 0x220a,
-    0x100b, 0x201b, 0x202b, 0x203b, 0x204b, 0x205b, 0x206b, 0x207b,
-    0x208b, 0x209b, 0x20ab, 0x20bb, 0x20cb, 0x20db, 0x20eb, 0x20fb, 0x220b,
-    0x100c, 0x201c, 0x202c, 0x203c, 0x204c, 0x205c, 0x206c, 0x207c,
-    0x208c, 0x209c, 0x20ac, 0x20bc, 0x20cc, 0x20dc, 0x20ec, 0x20fc, 0x220c,
-    0x100d, 0x201d, 0x202d, 0x203d, 0x204d, 0x205d, 0x206d, 0x207d,
-    0x208d, 0x209d, 0x20ad, 0x20bd, 0x20cd, 0x20dd, 0x20ed, 0x20fd, 0x220d,
-    0x100e, 0x201e, 0x202e, 0x203e, 0x204e, 0x205e, 0x206e, 0x207e,
-    0x208e, 0x209e, 0x20ae, 0x20be, 0x20ce, 0x20de, 0x20ee, 0x20fe, 0x220e,
-    0x100f, 0x201f, 0x202f, 0x203f, 0x204f, 0x205f, 0x206f, 0x207f,
-    0x208f, 0x209f, 0x20af, 0x20bf, 0x20cf, 0x20df, 0x20ef, 0x20ff, 0x220f,
-    0x1100, 0x2110, 0x2120, 0x2130, 0x2140, 0x2150, 0x2160, 0x2170,
-    0x2180, 0x2190, 0x21a0, 0x21b0, 0x21c0, 0x21d0, 0x21e0, 0x21f0, 0x2300,
-};
-
-const float *const ff_aac_codebook_vector_vals[] = {
-    codebook_vector0_vals,  codebook_vector0_vals,
-    codebook_vector10_vals, codebook_vector10_vals,
-    codebook_vector4_vals,  codebook_vector4_vals,
-    codebook_vector10_vals, codebook_vector10_vals,
-    codebook_vector10_vals, codebook_vector10_vals,
-    codebook_vector10_vals,
-};
-
-const uint16_t *const ff_aac_codebook_vector_idx[] = {
-    codebook_vector02_idx, codebook_vector02_idx,
-    codebook_vector02_idx, codebook_vector02_idx,
-    codebook_vector4_idx,  codebook_vector4_idx,
-    codebook_vector6_idx,  codebook_vector6_idx,
-    codebook_vector8_idx,  codebook_vector8_idx,
-    codebook_vector10_idx,
-};
-
-/* @name swb_offsets
- * Sample offset into the window indicating the beginning of a scalefactor
- * window band
- *
- * scalefactor window band - term for scalefactor bands within a window,
- * given in Table 4.110 to Table 4.128.
- *
- * scalefactor band - a set of spectral coefficients which are scaled by one
- * scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band
- * may contain several scalefactor window bands of corresponding frequency. For
- * all other window_sequences scalefactor bands and scalefactor window bands are
- * identical.
- * @{
- */
-
-static const uint16_t swb_offset_1024_96[] = {
-      0,   4,   8,  12,  16,  20,  24,  28,
-     32,  36,  40,  44,  48,  52,  56,  64,
-     72,  80,  88,  96, 108, 120, 132, 144,
-    156, 172, 188, 212, 240, 276, 320, 384,
-    448, 512, 576, 640, 704, 768, 832, 896,
-    960, 1024
-};
-
-static const uint16_t swb_offset_128_96[] = {
-    0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
-};
-
-static const uint16_t swb_offset_1024_64[] = {
-      0,   4,   8,  12,  16,  20,  24,  28,
-     32,  36,  40,  44,  48,  52,  56,  64,
-     72,  80,  88, 100, 112, 124, 140, 156,
-    172, 192, 216, 240, 268, 304, 344, 384,
-    424, 464, 504, 544, 584, 624, 664, 704,
-    744, 784, 824, 864, 904, 944, 984, 1024
-};
-
-static const uint16_t swb_offset_1024_48[] = {
-      0,   4,   8,  12,  16,  20,  24,  28,
-     32,  36,  40,  48,  56,  64,  72,  80,
-     88,  96, 108, 120, 132, 144, 160, 176,
-    196, 216, 240, 264, 292, 320, 352, 384,
-    416, 448, 480, 512, 544, 576, 608, 640,
-    672, 704, 736, 768, 800, 832, 864, 896,
-    928, 1024
-};
-
-static const uint16_t swb_offset_128_48[] = {
-     0,   4,   8,  12,  16,  20,  28,  36,
-    44,  56,  68,  80,  96, 112, 128
-};
-
-static const uint16_t swb_offset_1024_32[] = {
-      0,   4,   8,  12,  16,  20,  24,  28,
-     32,  36,  40,  48,  56,  64,  72,  80,
-     88,  96, 108, 120, 132, 144, 160, 176,
-    196, 216, 240, 264, 292, 320, 352, 384,
-    416, 448, 480, 512, 544, 576, 608, 640,
-    672, 704, 736, 768, 800, 832, 864, 896,
-    928, 960, 992, 1024
-};
-
-static const uint16_t swb_offset_1024_24[] = {
-      0,   4,   8,  12,  16,  20,  24,  28,
-     32,  36,  40,  44,  52,  60,  68,  76,
-     84,  92, 100, 108, 116, 124, 136, 148,
-    160, 172, 188, 204, 220, 240, 260, 284,
-    308, 336, 364, 396, 432, 468, 508, 552,
-    600, 652, 704, 768, 832, 896, 960, 1024
-};
-
-static const uint16_t swb_offset_128_24[] = {
-     0,   4,   8,  12,  16,  20,  24,  28,
-    36,  44,  52,  64,  76,  92, 108, 128
-};
-
-static const uint16_t swb_offset_1024_16[] = {
-      0,   8,  16,  24,  32,  40,  48,  56,
-     64,  72,  80,  88, 100, 112, 124, 136,
-    148, 160, 172, 184, 196, 212, 228, 244,
-    260, 280, 300, 320, 344, 368, 396, 424,
-    456, 492, 532, 572, 616, 664, 716, 772,
-    832, 896, 960, 1024
-};
-
-static const uint16_t swb_offset_128_16[] = {
-     0,   4,   8,  12,  16,  20,  24,  28,
-    32,  40,  48,  60,  72,  88, 108, 128
-};
-
-static const uint16_t swb_offset_1024_8[] = {
-      0,  12,  24,  36,  48,  60,  72,  84,
-     96, 108, 120, 132, 144, 156, 172, 188,
-    204, 220, 236, 252, 268, 288, 308, 328,
-    348, 372, 396, 420, 448, 476, 508, 544,
-    580, 620, 664, 712, 764, 820, 880, 944,
-    1024
-};
-
-static const uint16_t swb_offset_128_8[] = {
-     0,   4,   8,  12,  16,  20,  24,  28,
-    36,  44,  52,  60,  72,  88, 108, 128
-};
-
-const uint16_t * const ff_swb_offset_1024[] = {
-    swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64,
-    swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32,
-    swb_offset_1024_24, swb_offset_1024_24, swb_offset_1024_16,
-    swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_8,
-    swb_offset_1024_8
-};
-
-const uint16_t * const ff_swb_offset_128[] = {
-    /* The last entry on the following row is swb_offset_128_64 but is a
-       duplicate of swb_offset_128_96. */
-    swb_offset_128_96, swb_offset_128_96, swb_offset_128_96,
-    swb_offset_128_48, swb_offset_128_48, swb_offset_128_48,
-    swb_offset_128_24, swb_offset_128_24, swb_offset_128_16,
-    swb_offset_128_16, swb_offset_128_16, swb_offset_128_8,
-    swb_offset_128_8
-};
-
-// @}
-
-/* @name ff_tns_max_bands
- * The maximum number of scalefactor bands on which TNS can operate for the long
- * and short transforms respectively. The index to these tables is related to
- * the sample rate of the audio.
- * @{
- */
-const uint8_t ff_tns_max_bands_1024[] = {
-    31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39
-};
-
-const uint8_t ff_tns_max_bands_128[] = {
-    9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14
-};
-// @}
diff --git a/libavcodec/aactab.h b/libavcodec/aactab.h
deleted file mode 100644
index c621399..0000000
--- a/libavcodec/aactab.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * AAC data declarations
- * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
- * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC data declarations
- * @author Oded Shimon  ( ods15 ods15 dyndns org )
- * @author Maxim Gavrilov ( maxim.gavrilov gmail com )
- */
-
-#ifndef AVCODEC_AACTAB_H
-#define AVCODEC_AACTAB_H
-
-#include "libavutil/mem.h"
-#include "aac.h"
-#include "aac_tablegen_decl.h"
-
-#include <stdint.h>
-
-/* NOTE:
- * Tables in this file are used by the AAC decoder and will be used by the AAC
- * encoder.
- */
-
-/* @name window coefficients
- * @{
- */
-DECLARE_ALIGNED(16, extern float,  ff_aac_kbd_long_1024)[1024];
-DECLARE_ALIGNED(16, extern float,  ff_aac_kbd_short_128)[128];
-// @}
-
-/* @name number of scalefactor window bands for long and short transform windows respectively
- * @{
- */
-extern const uint8_t ff_aac_num_swb_1024[];
-extern const uint8_t ff_aac_num_swb_128 [];
-// @}
-
-extern const uint8_t ff_aac_pred_sfb_max [];
-
-extern const uint32_t ff_aac_scalefactor_code[121];
-extern const uint8_t  ff_aac_scalefactor_bits[121];
-
-extern const uint16_t * const ff_aac_spectral_codes[11];
-extern const uint8_t  * const ff_aac_spectral_bits [11];
-extern const uint16_t  ff_aac_spectral_sizes[11];
-
-extern const float *ff_aac_codebook_vectors[];
-extern const float *ff_aac_codebook_vector_vals[];
-extern const uint16_t *ff_aac_codebook_vector_idx[];
-
-extern const uint16_t * const ff_swb_offset_1024[13];
-extern const uint16_t * const ff_swb_offset_128 [13];
-
-extern const uint8_t ff_tns_max_bands_1024[13];
-extern const uint8_t ff_tns_max_bands_128 [13];
-
-#endif /* AVCODEC_AACTAB_H */
diff --git a/libavcodec/aandcttab.c b/libavcodec/aandcttab.c
deleted file mode 100644
index 87c50b3..0000000
--- a/libavcodec/aandcttab.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAN (Arai Agui Aakajima) (I)DCT tables
- */
-
-#include <stdint.h>
-
-const uint16_t ff_aanscales[64] = {
-    /* precomputed values scaled up by 14 bits */
-    16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
-    22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
-    21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
-    19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
-    16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
-    12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
-    8867 , 12299, 11585, 10426,  8867,  6967,  4799,  2446,
-    4520 ,  6270,  5906,  5315,  4520,  3552,  2446,  1247
-};
-
-const uint16_t ff_inv_aanscales[64] = {
-  4096,  2953,  3135,  3483,  4096,  5213,  7568, 14846,
-  2953,  2129,  2260,  2511,  2953,  3759,  5457, 10703,
-  3135,  2260,  2399,  2666,  3135,  3990,  5793, 11363,
-  3483,  2511,  2666,  2962,  3483,  4433,  6436, 12625,
-  4096,  2953,  3135,  3483,  4096,  5213,  7568, 14846,
-  5213,  3759,  3990,  4433,  5213,  6635,  9633, 18895,
-  7568,  5457,  5793,  6436,  7568,  9633, 13985, 27432,
- 14846, 10703, 11363, 12625, 14846, 18895, 27432, 53809,
-};
diff --git a/libavcodec/aandcttab.h b/libavcodec/aandcttab.h
deleted file mode 100644
index d774828..0000000
--- a/libavcodec/aandcttab.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAN (Arai Agui Nakajima) (I)DCT tables
- */
-
-#ifndef AVCODEC_AANDCTTAB_H
-#define AVCODEC_AANDCTTAB_H
-
-#include <stdint.h>
-
-extern const uint16_t ff_aanscales[64];
-extern const uint16_t ff_inv_aanscales[64];
-
-#endif /* AVCODEC_AANDCTTAB_H */
diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c
deleted file mode 100644
index 82bd2bf..0000000
--- a/libavcodec/aasc.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Autodesk RLE Decoder
- * Copyright (C) 2005 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Autodesk RLE Video Decoder by Konstantin Shishkov
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "msrledec.h"
-
-typedef struct AascContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-} AascContext;
-
-#define FETCH_NEXT_STREAM_BYTE() \
-    if (stream_ptr >= buf_size) \
-    { \
-      av_log(s->avctx, AV_LOG_ERROR, " AASC: stream ptr just went out of bounds (fetch)\n"); \
-      break; \
-    } \
-    stream_byte = buf[stream_ptr++];
-
-static av_cold int aasc_decode_init(AVCodecContext *avctx)
-{
-    AascContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    avctx->pix_fmt = PIX_FMT_BGR24;
-
-    return 0;
-}
-
-static int aasc_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AascContext *s = avctx->priv_data;
-    int compr, i, stride;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    compr = AV_RL32(buf);
-    buf += 4;
-    buf_size -= 4;
-    switch(compr){
-    case 0:
-        stride = (avctx->width * 3 + 3) & ~3;
-        for(i = avctx->height - 1; i >= 0; i--){
-            memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width*3);
-            buf += stride;
-        }
-        break;
-    case 1:
-        ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, buf - 4, buf_size + 4);
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
-        return -1;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int aasc_decode_end(AVCodecContext *avctx)
-{
-    AascContext *s = avctx->priv_data;
-
-    /* release the last frame */
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec aasc_decoder = {
-    "aasc",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_AASC,
-    sizeof(AascContext),
-    aasc_decode_init,
-    NULL,
-    aasc_decode_end,
-    aasc_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
-};
diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c
deleted file mode 100644
index 3fce5bc..0000000
--- a/libavcodec/ac3.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Common code between the AC-3 encoder and decoder
- * Copyright (c) 2000 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Common code between the AC-3 encoder and decoder.
- */
-
-#include "avcodec.h"
-#include "ac3.h"
-#include "get_bits.h"
-
-#if CONFIG_HARDCODED_TABLES
-
-/**
- * Starting frequency coefficient bin for each critical band.
- */
-static const uint8_t band_start_tab[51] = {
-      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,  31,
-     34,  37, 40,  43,  46,  49,  55,  61,  67,  73,
-     79,  85, 97, 109, 121, 133, 157, 181, 205, 229, 253
-};
-
-/**
- * Maps each frequency coefficient bin to the critical band that contains it.
- */
-static const uint8_t bin_to_band_tab[253] = {
-     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, 28, 28, 29, 29, 29, 30, 30, 30,
-    31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34,
-    35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36,
-    37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38,
-    39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40,
-    41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
-    42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
-    43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
-    44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
-    45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-    45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-    46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
-    46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
-    47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
-    47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
-    48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
-    48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
-    49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
-    49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49
-};
-
-#else /* CONFIG_HARDCODED_TABLES */
-static uint8_t band_start_tab[51];
-static uint8_t bin_to_band_tab[253];
-#endif
-
-static inline int calc_lowcomp1(int a, int b0, int b1, int c)
-{
-    if ((b0 + 256) == b1) {
-        a = c;
-    } else if (b0 > b1) {
-        a = FFMAX(a - 64, 0);
-    }
-    return a;
-}
-
-static inline int calc_lowcomp(int a, int b0, int b1, int bin)
-{
-    if (bin < 7) {
-        return calc_lowcomp1(a, b0, b1, 384);
-    } else if (bin < 20) {
-        return calc_lowcomp1(a, b0, b1, 320);
-    } else {
-        return FFMAX(a - 128, 0);
-    }
-}
-
-void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
-                               int16_t *band_psd)
-{
-    int bin, band;
-
-    /* exponent mapping to PSD */
-    for (bin = start; bin < end; bin++) {
-        psd[bin]=(3072 - (exp[bin] << 7));
-    }
-
-    /* PSD integration */
-    bin  = start;
-    band = bin_to_band_tab[start];
-    do {
-        int v = psd[bin++];
-        int band_end = FFMIN(band_start_tab[band+1], end);
-        for (; bin < band_end; bin++) {
-            int max = FFMAX(v, psd[bin]);
-            /* logadd */
-            int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255);
-            v = max + ff_ac3_log_add_tab[adr];
-        }
-        band_psd[band++] = v;
-    } while (end > band_start_tab[band]);
-}
-
-int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
-                               int start, int end, int fast_gain, int is_lfe,
-                               int dba_mode, int dba_nsegs, uint8_t *dba_offsets,
-                               uint8_t *dba_lengths, uint8_t *dba_values,
-                               int16_t *mask)
-{
-    int16_t excite[50]; /* excitation */
-    int band;
-    int band_start, band_end, begin, end1;
-    int lowcomp, fastleak, slowleak;
-
-    /* excitation function */
-    band_start = bin_to_band_tab[start];
-    band_end   = bin_to_band_tab[end-1] + 1;
-
-    if (band_start == 0) {
-        lowcomp = 0;
-        lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384);
-        excite[0] = band_psd[0] - fast_gain - lowcomp;
-        lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384);
-        excite[1] = band_psd[1] - fast_gain - lowcomp;
-        begin = 7;
-        for (band = 2; band < 7; band++) {
-            if (!(is_lfe && band == 6))
-                lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384);
-            fastleak = band_psd[band] - fast_gain;
-            slowleak = band_psd[band] - s->slow_gain;
-            excite[band] = fastleak - lowcomp;
-            if (!(is_lfe && band == 6)) {
-                if (band_psd[band] <= band_psd[band+1]) {
-                    begin = band + 1;
-                    break;
-                }
-            }
-        }
-
-        end1 = FFMIN(band_end, 22);
-        for (band = begin; band < end1; band++) {
-            if (!(is_lfe && band == 6))
-                lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band);
-            fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
-            slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
-            excite[band] = FFMAX(fastleak - lowcomp, slowleak);
-        }
-        begin = 22;
-    } else {
-        /* coupling channel */
-        begin = band_start;
-        fastleak = (s->cpl_fast_leak << 8) + 768;
-        slowleak = (s->cpl_slow_leak << 8) + 768;
-    }
-
-    for (band = begin; band < band_end; band++) {
-        fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
-        slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
-        excite[band] = FFMAX(fastleak, slowleak);
-    }
-
-    /* compute masking curve */
-
-    for (band = band_start; band < band_end; band++) {
-        int tmp = s->db_per_bit - band_psd[band];
-        if (tmp > 0) {
-            excite[band] += tmp >> 2;
-        }
-        mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
-    }
-
-    /* delta bit allocation */
-
-    if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) {
-        int i, seg, delta;
-        if (dba_nsegs >= 8)
-            return -1;
-        band = 0;
-        for (seg = 0; seg < dba_nsegs; seg++) {
-            band += dba_offsets[seg];
-            if (band >= 50 || dba_lengths[seg] > 50-band)
-                return -1;
-            if (dba_values[seg] >= 4) {
-                delta = (dba_values[seg] - 3) << 7;
-            } else {
-                delta = (dba_values[seg] - 4) << 7;
-            }
-            for (i = 0; i < dba_lengths[seg]; i++) {
-                mask[band++] += delta;
-            }
-        }
-    }
-    return 0;
-}
-
-void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
-                               int snr_offset, int floor,
-                               const uint8_t *bap_tab, uint8_t *bap)
-{
-    int bin, band;
-
-    /* special case, if snr offset is -960, set all bap's to zero */
-    if (snr_offset == -960) {
-        memset(bap, 0, 256);
-        return;
-    }
-
-    bin  = start;
-    band = bin_to_band_tab[start];
-    do {
-        int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor;
-        int band_end = FFMIN(band_start_tab[band+1], end);
-        for (; bin < band_end; bin++) {
-            int address = av_clip((psd[bin] - m) >> 5, 0, 63);
-            bap[bin] = bap_tab[address];
-        }
-    } while (end > band_start_tab[band++]);
-}
-
-/* AC-3 bit allocation. The algorithm is the one described in the AC-3
-   spec. */
-void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
-                                   int8_t *exp, int start, int end,
-                                   int snr_offset, int fast_gain, int is_lfe,
-                                   int dba_mode, int dba_nsegs,
-                                   uint8_t *dba_offsets, uint8_t *dba_lengths,
-                                   uint8_t *dba_values)
-{
-    int16_t psd[256];   /* scaled exponents */
-    int16_t band_psd[50]; /* interpolated exponents */
-    int16_t mask[50];   /* masking value */
-
-    ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd);
-
-    ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe,
-                               dba_mode, dba_nsegs, dba_offsets, dba_lengths,
-                               dba_values, mask);
-
-    ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor,
-                              ff_ac3_bap_tab, bap);
-}
-
-/**
- * Initializes some tables.
- * note: This function must remain thread safe because it is called by the
- *       AVParser init code.
- */
-av_cold void ac3_common_init(void)
-{
-#if !CONFIG_HARDCODED_TABLES
-    /* compute bndtab and masktab from bandsz */
-    int bin = 0, band;
-    for (band = 0; band < 50; band++) {
-        int band_end = bin + ff_ac3_critical_band_size_tab[band];
-        band_start_tab[band] = bin;
-        while (bin < band_end)
-            bin_to_band_tab[bin++] = band;
-    }
-    band_start_tab[50] = bin;
-#endif /* !CONFIG_HARDCODED_TABLES */
-}
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
deleted file mode 100644
index 0def3b0..0000000
--- a/libavcodec/ac3.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Common code between the AC-3 encoder and decoder
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Common code between the AC-3 encoder and decoder.
- */
-
-#ifndef AVCODEC_AC3_H
-#define AVCODEC_AC3_H
-
-#include "ac3tab.h"
-
-#define AC3_MAX_CODED_FRAME_SIZE 3840 /* in bytes */
-#define AC3_MAX_CHANNELS 6 /* including LFE channel */
-
-#define NB_BLOCKS 6 /* number of PCM blocks inside an AC-3 frame */
-#define AC3_FRAME_SIZE (NB_BLOCKS * 256)
-
-/* exponent encoding strategy */
-#define EXP_REUSE 0
-#define EXP_NEW   1
-
-#define EXP_D15   1
-#define EXP_D25   2
-#define EXP_D45   3
-
-/** Delta bit allocation strategy */
-typedef enum {
-    DBA_REUSE = 0,
-    DBA_NEW,
-    DBA_NONE,
-    DBA_RESERVED
-} AC3DeltaStrategy;
-
-/** Channel mode (audio coding mode) */
-typedef enum {
-    AC3_CHMODE_DUALMONO = 0,
-    AC3_CHMODE_MONO,
-    AC3_CHMODE_STEREO,
-    AC3_CHMODE_3F,
-    AC3_CHMODE_2F1R,
-    AC3_CHMODE_3F1R,
-    AC3_CHMODE_2F2R,
-    AC3_CHMODE_3F2R
-} AC3ChannelMode;
-
-typedef struct AC3BitAllocParameters {
-    int sr_code;
-    int sr_shift;
-    int slow_gain, slow_decay, fast_decay, db_per_bit, floor;
-    int cpl_fast_leak, cpl_slow_leak;
-} AC3BitAllocParameters;
-
-/**
- * @struct AC3HeaderInfo
- * Coded AC-3 header values up to the lfeon element, plus derived values.
- */
-typedef struct {
-    /** @defgroup coded Coded elements
-     * @{
-     */
-    uint16_t sync_word;
-    uint16_t crc1;
-    uint8_t sr_code;
-    uint8_t bitstream_id;
-    uint8_t channel_mode;
-    uint8_t lfe_on;
-    uint8_t frame_type;
-    int substreamid;                        ///< substream identification
-    int center_mix_level;                   ///< Center mix level index
-    int surround_mix_level;                 ///< Surround mix level index
-    uint16_t channel_map;
-    int num_blocks;                         ///< number of audio blocks
-    /** @} */
-
-    /** @defgroup derived Derived values
-     * @{
-     */
-    uint8_t sr_shift;
-    uint16_t sample_rate;
-    uint32_t bit_rate;
-    uint8_t channels;
-    uint16_t frame_size;
-    int64_t channel_layout;
-    /** @} */
-} AC3HeaderInfo;
-
-typedef enum {
-    EAC3_FRAME_TYPE_INDEPENDENT = 0,
-    EAC3_FRAME_TYPE_DEPENDENT,
-    EAC3_FRAME_TYPE_AC3_CONVERT,
-    EAC3_FRAME_TYPE_RESERVED
-} EAC3FrameType;
-
-void ac3_common_init(void);
-
-/**
- * Calculates the log power-spectral density of the input signal.
- * This gives a rough estimate of signal power in the frequency domain by using
- * the spectral envelope (exponents).  The psd is also separately grouped
- * into critical bands for use in the calculating the masking curve.
- * 128 units in psd = -6 dB.  The dbknee parameter in AC3BitAllocParameters
- * determines the reference level.
- *
- * @param[in]  exp        frequency coefficient exponents
- * @param[in]  start      starting bin location
- * @param[in]  end        ending bin location
- * @param[out] psd        signal power for each frequency bin
- * @param[out] band_psd   signal power for each critical band
- */
-void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd,
-                               int16_t *band_psd);
-
-/**
- * Calculates the masking curve.
- * First, the excitation is calculated using parameters in s and the signal
- * power in each critical band.  The excitation is compared with a predefined
- * hearing threshold table to produce the masking curve.  If delta bit
- * allocation information is provided, it is used for adjusting the masking
- * curve, usually to give a closer match to a better psychoacoustic model.
- *
- * @param[in]  s            adjustable bit allocation parameters
- * @param[in]  band_psd     signal power for each critical band
- * @param[in]  start        starting bin location
- * @param[in]  end          ending bin location
- * @param[in]  fast_gain    fast gain (estimated signal-to-mask ratio)
- * @param[in]  is_lfe       whether or not the channel being processed is the LFE
- * @param[in]  dba_mode     delta bit allocation mode (none, reuse, or new)
- * @param[in]  dba_nsegs    number of delta segments
- * @param[in]  dba_offsets  location offsets for each segment
- * @param[in]  dba_lengths  length of each segment
- * @param[in]  dba_values   delta bit allocation for each segment
- * @param[out] mask         calculated masking curve
- * @return returns 0 for success, non-zero for error
- */
-int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
-                               int start, int end, int fast_gain, int is_lfe,
-                               int dba_mode, int dba_nsegs, uint8_t *dba_offsets,
-                               uint8_t *dba_lengths, uint8_t *dba_values,
-                               int16_t *mask);
-
-/**
- * Calculates bit allocation pointers.
- * The SNR is the difference between the masking curve and the signal.  AC-3
- * uses this value for each frequency bin to allocate bits.  The snroffset
- * parameter is a global adjustment to the SNR for all bins.
- *
- * @param[in]  mask       masking curve
- * @param[in]  psd        signal power for each frequency bin
- * @param[in]  start      starting bin location
- * @param[in]  end        ending bin location
- * @param[in]  snr_offset SNR adjustment
- * @param[in]  floor      noise floor
- * @param[in]  bap_tab    look-up table for bit allocation pointers
- * @param[out] bap        bit allocation pointers
- */
-void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
-                               int snr_offset, int floor,
-                               const uint8_t *bap_tab, uint8_t *bap);
-
-void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
-                                   int8_t *exp, int start, int end,
-                                   int snr_offset, int fast_gain, int is_lfe,
-                                   int dba_mode, int dba_nsegs,
-                                   uint8_t *dba_offsets, uint8_t *dba_lengths,
-                                   uint8_t *dba_values);
-
-#endif /* AVCODEC_AC3_H */
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
deleted file mode 100644
index 6cd666b..0000000
--- a/libavcodec/ac3_parser.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * AC-3 parser
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-#include "ac3_parser.h"
-#include "aac_ac3_parser.h"
-#include "get_bits.h"
-
-
-#define AC3_HEADER_SIZE 7
-
-
-static const uint8_t eac3_blocks[4] = {
-    1, 2, 3, 6
-};
-
-
-int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
-{
-    int frame_size_code;
-
-    memset(hdr, 0, sizeof(*hdr));
-
-    hdr->sync_word = get_bits(gbc, 16);
-    if(hdr->sync_word != 0x0B77)
-        return AAC_AC3_PARSE_ERROR_SYNC;
-
-    /* read ahead to bsid to distinguish between AC-3 and E-AC-3 */
-    hdr->bitstream_id = show_bits_long(gbc, 29) & 0x1F;
-    if(hdr->bitstream_id > 16)
-        return AAC_AC3_PARSE_ERROR_BSID;
-
-    hdr->num_blocks = 6;
-
-    /* set default mix levels */
-    hdr->center_mix_level   = 1;  // -4.5dB
-    hdr->surround_mix_level = 1;  // -6.0dB
-
-    if(hdr->bitstream_id <= 10) {
-        /* Normal AC-3 */
-        hdr->crc1 = get_bits(gbc, 16);
-        hdr->sr_code = get_bits(gbc, 2);
-        if(hdr->sr_code == 3)
-            return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
-
-        frame_size_code = get_bits(gbc, 6);
-        if(frame_size_code > 37)
-            return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
-
-        skip_bits(gbc, 5); // skip bsid, already got it
-
-        skip_bits(gbc, 3); // skip bitstream mode
-        hdr->channel_mode = get_bits(gbc, 3);
-
-        if(hdr->channel_mode == AC3_CHMODE_STEREO) {
-            skip_bits(gbc, 2); // skip dsurmod
-        } else {
-            if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO)
-                hdr->center_mix_level = get_bits(gbc, 2);
-            if(hdr->channel_mode & 4)
-                hdr->surround_mix_level = get_bits(gbc, 2);
-        }
-        hdr->lfe_on = get_bits1(gbc);
-
-        hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8;
-        hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift;
-        hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift;
-        hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
-        hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
-        hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
-        hdr->substreamid = 0;
-    } else {
-        /* Enhanced AC-3 */
-        hdr->crc1 = 0;
-        hdr->frame_type = get_bits(gbc, 2);
-        if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED)
-            return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
-
-        hdr->substreamid = get_bits(gbc, 3);
-
-        hdr->frame_size = (get_bits(gbc, 11) + 1) << 1;
-        if(hdr->frame_size < AC3_HEADER_SIZE)
-            return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
-
-        hdr->sr_code = get_bits(gbc, 2);
-        if (hdr->sr_code == 3) {
-            int sr_code2 = get_bits(gbc, 2);
-            if(sr_code2 == 3)
-                return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
-            hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
-            hdr->sr_shift = 1;
-        } else {
-            hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
-            hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
-            hdr->sr_shift = 0;
-        }
-
-        hdr->channel_mode = get_bits(gbc, 3);
-        hdr->lfe_on = get_bits1(gbc);
-
-        hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate /
-                        (hdr->num_blocks * 256.0));
-        hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
-    }
-    hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
-    if (hdr->lfe_on)
-        hdr->channel_layout |= CH_LOW_FREQUENCY;
-
-    return 0;
-}
-
-int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr){
-    int ret, i;
-    ret = ff_ac3_parse_header(gbc, hdr);
-    if(!ret){
-        if(hdr->bitstream_id>10){
-            /* Enhanced AC-3 */
-            skip_bits(gbc, 5); // skip bitstream id
-
-            /* skip dialog normalization and compression gain */
-            for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
-                skip_bits(gbc, 5); // skip dialog normalization
-                if (get_bits1(gbc)) {
-                    skip_bits(gbc, 8); //skip Compression gain word
-                }
-            }
-            /* dependent stream channel map */
-            if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc)) {
-                    hdr->channel_map = get_bits(gbc, 16); //custom channel map
-                    return 0;
-            }
-        }
-        //default channel map based on acmod and lfeon
-        hdr->channel_map = ff_eac3_default_chmap[hdr->channel_mode];
-        if(hdr->lfe_on)
-            hdr->channel_map |= AC3_CHMAP_LFE;
-    }
-    return ret;
-}
-
-static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
-        int *need_next_header, int *new_frame_start)
-{
-    int err;
-    union {
-        uint64_t u64;
-        uint8_t  u8[8];
-    } tmp = { be2me_64(state) };
-    AC3HeaderInfo hdr;
-    GetBitContext gbc;
-
-    init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
-    err = ff_ac3_parse_header(&gbc, &hdr);
-
-    if(err < 0)
-        return 0;
-
-    hdr_info->sample_rate = hdr.sample_rate;
-    hdr_info->bit_rate = hdr.bit_rate;
-    hdr_info->channels = hdr.channels;
-    hdr_info->channel_layout = hdr.channel_layout;
-    hdr_info->samples = hdr.num_blocks * 256;
-    if(hdr.bitstream_id>10)
-        hdr_info->codec_id = CODEC_ID_EAC3;
-    else if (hdr_info->codec_id == CODEC_ID_NONE)
-        hdr_info->codec_id = CODEC_ID_AC3;
-
-    *need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);
-    *new_frame_start  = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT);
-    return hdr.frame_size;
-}
-
-static av_cold int ac3_parse_init(AVCodecParserContext *s1)
-{
-    AACAC3ParseContext *s = s1->priv_data;
-    s->header_size = AC3_HEADER_SIZE;
-    s->sync = ac3_sync;
-    return 0;
-}
-
-
-AVCodecParser ac3_parser = {
-    { CODEC_ID_AC3, CODEC_ID_EAC3 },
-    sizeof(AACAC3ParseContext),
-    ac3_parse_init,
-    ff_aac_ac3_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/ac3_parser.h b/libavcodec/ac3_parser.h
deleted file mode 100644
index 766c68b..0000000
--- a/libavcodec/ac3_parser.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * AC-3 parser prototypes
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AC3_PARSER_H
-#define AVCODEC_AC3_PARSER_H
-
-#include "ac3.h"
-#include "get_bits.h"
-
-/**
- * Parses AC-3 frame header.
- * Parses the header up to the lfeon element, which is the first 52 or 54 bits
- * depending on the audio coding mode.
- * @param gbc[in] BitContext containing the first 54 bits of the frame.
- * @param hdr[out] Pointer to struct where header info is written.
- * @return Returns 0 on success, -1 if there is a sync word mismatch,
- * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate)
- * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.
- */
-int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr);
-
-/**
- * Parses AC-3 frame header and sets channel_map
- * Parses the header up to the lfeon (channel_map in E-AC-3)
- * element, which is the first 52, 54 or 104 bits depending
- * on the audio coding mode.
- * @param gbc[in] BitContext containing the first 54 bits of the frame.
- * @param hdr[out] Pointer to struct where header info is written.
- * @return value returned by ff_ac3_parse_header
- */
-int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr);
-
-#endif /* AVCODEC_AC3_PARSER_H */
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
deleted file mode 100644
index f2f6e5c..0000000
--- a/libavcodec/ac3dec.c
+++ /dev/null
@@ -1,1462 +0,0 @@
-/*
- * AC-3 Audio Decoder
- * This code was developed as part of Google Summer of Code 2006.
- * E-AC-3 support was added as part of Google Summer of Code 2007.
- *
- * Copyright (c) 2006 Kartikey Mahendra BHATT (bhattkm at gmail dot com)
- * Copyright (c) 2007-2008 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
- * Copyright (c) 2007 Justin Ruggles <justin.ruggles at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stddef.h>
-#include <math.h>
-#include <string.h>
-
-#include "libavutil/crc.h"
-#include "internal.h"
-#include "aac_ac3_parser.h"
-#include "ac3_parser.h"
-#include "ac3dec.h"
-#include "ac3dec_data.h"
-
-/** Large enough for maximum possible frame size when the specification limit is ignored */
-#define AC3_FRAME_BUFFER_SIZE 32768
-
-/**
- * table for ungrouping 3 values in 7 bits.
- * used for exponents and bap=2 mantissas
- */
-static uint8_t ungroup_3_in_7_bits_tab[128][3];
-
-
-/** tables for ungrouping mantissas */
-static int b1_mantissas[32][3];
-static int b2_mantissas[128][3];
-static int b3_mantissas[8];
-static int b4_mantissas[128][2];
-static int b5_mantissas[16];
-
-/**
- * Quantization table: levels for symmetric. bits for asymmetric.
- * reference: Table 7.18 Mapping of bap to Quantizer
- */
-static const uint8_t quantization_tab[16] = {
-    0, 3, 5, 7, 11, 15,
-    5, 6, 7, 8, 9, 10, 11, 12, 14, 16
-};
-
-/** dynamic range table. converts codes to scale factors. */
-static float dynamic_range_tab[256];
-
-/** Adjustments in dB gain */
-#define LEVEL_PLUS_3DB          1.4142135623730950
-#define LEVEL_PLUS_1POINT5DB    1.1892071150027209
-#define LEVEL_MINUS_1POINT5DB   0.8408964152537145
-#define LEVEL_MINUS_3DB         0.7071067811865476
-#define LEVEL_MINUS_4POINT5DB   0.5946035575013605
-#define LEVEL_MINUS_6DB         0.5000000000000000
-#define LEVEL_MINUS_9DB         0.3535533905932738
-#define LEVEL_ZERO              0.0000000000000000
-#define LEVEL_ONE               1.0000000000000000
-
-static const float gain_levels[9] = {
-    LEVEL_PLUS_3DB,
-    LEVEL_PLUS_1POINT5DB,
-    LEVEL_ONE,
-    LEVEL_MINUS_1POINT5DB,
-    LEVEL_MINUS_3DB,
-    LEVEL_MINUS_4POINT5DB,
-    LEVEL_MINUS_6DB,
-    LEVEL_ZERO,
-    LEVEL_MINUS_9DB
-};
-
-/**
- * Table for center mix levels
- * reference: Section 5.4.2.4 cmixlev
- */
-static const uint8_t center_levels[4] = { 4, 5, 6, 5 };
-
-/**
- * Table for surround mix levels
- * reference: Section 5.4.2.5 surmixlev
- */
-static const uint8_t surround_levels[4] = { 4, 6, 7, 6 };
-
-/**
- * Table for default stereo downmixing coefficients
- * reference: Section 7.8.2 Downmixing Into Two Channels
- */
-static const uint8_t ac3_default_coeffs[8][5][2] = {
-    { { 2, 7 }, { 7, 2 },                               },
-    { { 4, 4 },                                         },
-    { { 2, 7 }, { 7, 2 },                               },
-    { { 2, 7 }, { 5, 5 }, { 7, 2 },                     },
-    { { 2, 7 }, { 7, 2 }, { 6, 6 },                     },
-    { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 8, 8 },           },
-    { { 2, 7 }, { 7, 2 }, { 6, 7 }, { 7, 6 },           },
-    { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, },
-};
-
-/**
- * Symmetrical Dequantization
- * reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization
- *            Tables 7.19 to 7.23
- */
-static inline int
-symmetric_dequant(int code, int levels)
-{
-    return ((code - (levels >> 1)) << 24) / levels;
-}
-
-/*
- * Initialize tables at runtime.
- */
-static av_cold void ac3_tables_init(void)
-{
-    int i;
-
-    /* generate table for ungrouping 3 values in 7 bits
-       reference: Section 7.1.3 Exponent Decoding */
-    for(i=0; i<128; i++) {
-        ungroup_3_in_7_bits_tab[i][0] =  i / 25;
-        ungroup_3_in_7_bits_tab[i][1] = (i % 25) / 5;
-        ungroup_3_in_7_bits_tab[i][2] = (i % 25) % 5;
-    }
-
-    /* generate grouped mantissa tables
-       reference: Section 7.3.5 Ungrouping of Mantissas */
-    for(i=0; i<32; i++) {
-        /* bap=1 mantissas */
-        b1_mantissas[i][0] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][0], 3);
-        b1_mantissas[i][1] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][1], 3);
-        b1_mantissas[i][2] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][2], 3);
-    }
-    for(i=0; i<128; i++) {
-        /* bap=2 mantissas */
-        b2_mantissas[i][0] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][0], 5);
-        b2_mantissas[i][1] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][1], 5);
-        b2_mantissas[i][2] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][2], 5);
-
-        /* bap=4 mantissas */
-        b4_mantissas[i][0] = symmetric_dequant(i / 11, 11);
-        b4_mantissas[i][1] = symmetric_dequant(i % 11, 11);
-    }
-    /* generate ungrouped mantissa tables
-       reference: Tables 7.21 and 7.23 */
-    for(i=0; i<7; i++) {
-        /* bap=3 mantissas */
-        b3_mantissas[i] = symmetric_dequant(i, 7);
-    }
-    for(i=0; i<15; i++) {
-        /* bap=5 mantissas */
-        b5_mantissas[i] = symmetric_dequant(i, 15);
-    }
-
-    /* generate dynamic range table
-       reference: Section 7.7.1 Dynamic Range Control */
-    for(i=0; i<256; i++) {
-        int v = (i >> 5) - ((i >> 7) << 3) - 5;
-        dynamic_range_tab[i] = powf(2.0f, v) * ((i & 0x1F) | 0x20);
-    }
-}
-
-
-/**
- * AVCodec initialization
- */
-static av_cold int ac3_decode_init(AVCodecContext *avctx)
-{
-    AC3DecodeContext *s = avctx->priv_data;
-    s->avctx = avctx;
-
-    ac3_common_init();
-    ac3_tables_init();
-    ff_mdct_init(&s->imdct_256, 8, 1, 1.0);
-    ff_mdct_init(&s->imdct_512, 9, 1, 1.0);
-    ff_kbd_window_init(s->window, 5.0, 256);
-    dsputil_init(&s->dsp, avctx);
-    av_lfg_init(&s->dith_state, 0);
-
-    /* set bias values for float to int16 conversion */
-    if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        s->add_bias = 385.0f;
-        s->mul_bias = 1.0f;
-    } else {
-        s->add_bias = 0.0f;
-        s->mul_bias = 32767.0f;
-    }
-
-    /* allow downmixing to stereo or mono */
-    if (avctx->channels > 0 && avctx->request_channels > 0 &&
-            avctx->request_channels < avctx->channels &&
-            avctx->request_channels <= 2) {
-        avctx->channels = avctx->request_channels;
-    }
-    s->downmixed = 1;
-
-    /* allocate context input buffer */
-    if (avctx->error_recognition >= FF_ER_CAREFUL) {
-        s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
-        if (!s->input_buffer)
-            return AVERROR(ENOMEM);
-    }
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-/**
- * Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream.
- * GetBitContext within AC3DecodeContext must point to
- * the start of the synchronized AC-3 bitstream.
- */
-static int ac3_parse_header(AC3DecodeContext *s)
-{
-    GetBitContext *gbc = &s->gbc;
-    int i;
-
-    /* read the rest of the bsi. read twice for dual mono mode. */
-    i = !(s->channel_mode);
-    do {
-        skip_bits(gbc, 5); // skip dialog normalization
-        if (get_bits1(gbc))
-            skip_bits(gbc, 8); //skip compression
-        if (get_bits1(gbc))
-            skip_bits(gbc, 8); //skip language code
-        if (get_bits1(gbc))
-            skip_bits(gbc, 7); //skip audio production information
-    } while (i--);
-
-    skip_bits(gbc, 2); //skip copyright bit and original bitstream bit
-
-    /* skip the timecodes (or extra bitstream information for Alternate Syntax)
-       TODO: read & use the xbsi1 downmix levels */
-    if (get_bits1(gbc))
-        skip_bits(gbc, 14); //skip timecode1 / xbsi1
-    if (get_bits1(gbc))
-        skip_bits(gbc, 14); //skip timecode2 / xbsi2
-
-    /* skip additional bitstream info */
-    if (get_bits1(gbc)) {
-        i = get_bits(gbc, 6);
-        do {
-            skip_bits(gbc, 8);
-        } while(i--);
-    }
-
-    return 0;
-}
-
-/**
- * Common function to parse AC-3 or E-AC-3 frame header
- */
-static int parse_frame_header(AC3DecodeContext *s)
-{
-    AC3HeaderInfo hdr;
-    int err;
-
-    err = ff_ac3_parse_header(&s->gbc, &hdr);
-    if(err)
-        return err;
-
-    /* get decoding parameters from header info */
-    s->bit_alloc_params.sr_code     = hdr.sr_code;
-    s->channel_mode                 = hdr.channel_mode;
-    s->channel_layout               = hdr.channel_layout;
-    s->lfe_on                       = hdr.lfe_on;
-    s->bit_alloc_params.sr_shift    = hdr.sr_shift;
-    s->sample_rate                  = hdr.sample_rate;
-    s->bit_rate                     = hdr.bit_rate;
-    s->channels                     = hdr.channels;
-    s->fbw_channels                 = s->channels - s->lfe_on;
-    s->lfe_ch                       = s->fbw_channels + 1;
-    s->frame_size                   = hdr.frame_size;
-    s->center_mix_level             = hdr.center_mix_level;
-    s->surround_mix_level           = hdr.surround_mix_level;
-    s->num_blocks                   = hdr.num_blocks;
-    s->frame_type                   = hdr.frame_type;
-    s->substreamid                  = hdr.substreamid;
-
-    if(s->lfe_on) {
-        s->start_freq[s->lfe_ch] = 0;
-        s->end_freq[s->lfe_ch] = 7;
-        s->num_exp_groups[s->lfe_ch] = 2;
-        s->channel_in_cpl[s->lfe_ch] = 0;
-    }
-
-    if (hdr.bitstream_id <= 10) {
-        s->eac3                  = 0;
-        s->snr_offset_strategy   = 2;
-        s->block_switch_syntax   = 1;
-        s->dither_flag_syntax    = 1;
-        s->bit_allocation_syntax = 1;
-        s->fast_gain_syntax      = 0;
-        s->first_cpl_leak        = 0;
-        s->dba_syntax            = 1;
-        s->skip_syntax           = 1;
-        memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
-        return ac3_parse_header(s);
-    } else if (CONFIG_EAC3_DECODER) {
-        s->eac3 = 1;
-        return ff_eac3_parse_header(s);
-    } else {
-        av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n");
-        return -1;
-    }
-}
-
-/**
- * Set stereo downmixing coefficients based on frame header info.
- * reference: Section 7.8.2 Downmixing Into Two Channels
- */
-static void set_downmix_coeffs(AC3DecodeContext *s)
-{
-    int i;
-    float cmix = gain_levels[center_levels[s->center_mix_level]];
-    float smix = gain_levels[surround_levels[s->surround_mix_level]];
-    float norm0, norm1;
-
-    for(i=0; i<s->fbw_channels; i++) {
-        s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]];
-        s->downmix_coeffs[i][1] = gain_levels[ac3_default_coeffs[s->channel_mode][i][1]];
-    }
-    if(s->channel_mode > 1 && s->channel_mode & 1) {
-        s->downmix_coeffs[1][0] = s->downmix_coeffs[1][1] = cmix;
-    }
-    if(s->channel_mode == AC3_CHMODE_2F1R || s->channel_mode == AC3_CHMODE_3F1R) {
-        int nf = s->channel_mode - 2;
-        s->downmix_coeffs[nf][0] = s->downmix_coeffs[nf][1] = smix * LEVEL_MINUS_3DB;
-    }
-    if(s->channel_mode == AC3_CHMODE_2F2R || s->channel_mode == AC3_CHMODE_3F2R) {
-        int nf = s->channel_mode - 4;
-        s->downmix_coeffs[nf][0] = s->downmix_coeffs[nf+1][1] = smix;
-    }
-
-    /* renormalize */
-    norm0 = norm1 = 0.0;
-    for(i=0; i<s->fbw_channels; i++) {
-        norm0 += s->downmix_coeffs[i][0];
-        norm1 += s->downmix_coeffs[i][1];
-    }
-    norm0 = 1.0f / norm0;
-    norm1 = 1.0f / norm1;
-    for(i=0; i<s->fbw_channels; i++) {
-        s->downmix_coeffs[i][0] *= norm0;
-        s->downmix_coeffs[i][1] *= norm1;
-    }
-
-    if(s->output_mode == AC3_CHMODE_MONO) {
-        for(i=0; i<s->fbw_channels; i++)
-            s->downmix_coeffs[i][0] = (s->downmix_coeffs[i][0] + s->downmix_coeffs[i][1]) * LEVEL_MINUS_3DB;
-    }
-}
-
-/**
- * Decode the grouped exponents according to exponent strategy.
- * reference: Section 7.1.3 Exponent Decoding
- */
-static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps,
-                            uint8_t absexp, int8_t *dexps)
-{
-    int i, j, grp, group_size;
-    int dexp[256];
-    int expacc, prevexp;
-
-    /* unpack groups */
-    group_size = exp_strategy + (exp_strategy == EXP_D45);
-    for(grp=0,i=0; grp<ngrps; grp++) {
-        expacc = get_bits(gbc, 7);
-        dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0];
-        dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1];
-        dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2];
-    }
-
-    /* convert to absolute exps and expand groups */
-    prevexp = absexp;
-    for(i=0,j=0; i<ngrps*3; i++) {
-        prevexp += dexp[i] - 2;
-        if (prevexp > 24U)
-            return -1;
-        switch (group_size) {
-            case 4: dexps[j++] = prevexp;
-                    dexps[j++] = prevexp;
-            case 2: dexps[j++] = prevexp;
-            case 1: dexps[j++] = prevexp;
-        }
-    }
-    return 0;
-}
-
-/**
- * Generate transform coefficients for each coupled channel in the coupling
- * range using the coupling coefficients and coupling coordinates.
- * reference: Section 7.4.3 Coupling Coordinate Format
- */
-static void calc_transform_coeffs_cpl(AC3DecodeContext *s)
-{
-    int bin, band, ch;
-
-    bin = s->start_freq[CPL_CH];
-    for (band = 0; band < s->num_cpl_bands; band++) {
-        int band_start = bin;
-        int band_end = bin + s->cpl_band_sizes[band];
-        for (ch = 1; ch <= s->fbw_channels; ch++) {
-            if (s->channel_in_cpl[ch]) {
-                int cpl_coord = s->cpl_coords[ch][band] << 5;
-                for (bin = band_start; bin < band_end; bin++) {
-                    s->fixed_coeffs[ch][bin] = MULH(s->fixed_coeffs[CPL_CH][bin] << 4, cpl_coord);
-                }
-                if (ch == 2 && s->phase_flags[band]) {
-                    for (bin = band_start; bin < band_end; bin++)
-                        s->fixed_coeffs[2][bin] = -s->fixed_coeffs[2][bin];
-                }
-            }
-        }
-        bin = band_end;
-    }
-}
-
-/**
- * Grouped mantissas for 3-level 5-level and 11-level quantization
- */
-typedef struct {
-    int b1_mant[2];
-    int b2_mant[2];
-    int b4_mant;
-    int b1;
-    int b2;
-    int b4;
-} mant_groups;
-
-/**
- * Decode the transform coefficients for a particular channel
- * reference: Section 7.3 Quantization and Decoding of Mantissas
- */
-static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m)
-{
-    int start_freq = s->start_freq[ch_index];
-    int end_freq = s->end_freq[ch_index];
-    uint8_t *baps = s->bap[ch_index];
-    int8_t *exps = s->dexps[ch_index];
-    int *coeffs = s->fixed_coeffs[ch_index];
-    int dither = (ch_index == CPL_CH) || s->dither_flag[ch_index];
-    GetBitContext *gbc = &s->gbc;
-    int freq;
-
-    for(freq = start_freq; freq < end_freq; freq++){
-        int bap = baps[freq];
-        int mantissa;
-        switch(bap){
-            case 0:
-                if (dither)
-                    mantissa = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
-                else
-                    mantissa = 0;
-                break;
-            case 1:
-                if(m->b1){
-                    m->b1--;
-                    mantissa = m->b1_mant[m->b1];
-                }
-                else{
-                    int bits      = get_bits(gbc, 5);
-                    mantissa      = b1_mantissas[bits][0];
-                    m->b1_mant[1] = b1_mantissas[bits][1];
-                    m->b1_mant[0] = b1_mantissas[bits][2];
-                    m->b1         = 2;
-                }
-                break;
-            case 2:
-                if(m->b2){
-                    m->b2--;
-                    mantissa = m->b2_mant[m->b2];
-                }
-                else{
-                    int bits      = get_bits(gbc, 7);
-                    mantissa      = b2_mantissas[bits][0];
-                    m->b2_mant[1] = b2_mantissas[bits][1];
-                    m->b2_mant[0] = b2_mantissas[bits][2];
-                    m->b2         = 2;
-                }
-                break;
-            case 3:
-                mantissa = b3_mantissas[get_bits(gbc, 3)];
-                break;
-            case 4:
-                if(m->b4){
-                    m->b4 = 0;
-                    mantissa = m->b4_mant;
-                }
-                else{
-                    int bits   = get_bits(gbc, 7);
-                    mantissa   = b4_mantissas[bits][0];
-                    m->b4_mant = b4_mantissas[bits][1];
-                    m->b4      = 1;
-                }
-                break;
-            case 5:
-                mantissa = b5_mantissas[get_bits(gbc, 4)];
-                break;
-            default: /* 6 to 15 */
-                mantissa = get_bits(gbc, quantization_tab[bap]);
-                /* Shift mantissa and sign-extend it. */
-                mantissa = (mantissa << (32-quantization_tab[bap]))>>8;
-                break;
-        }
-        coeffs[freq] = mantissa >> exps[freq];
-    }
-}
-
-/**
- * Remove random dithering from coupling range coefficients with zero-bit
- * mantissas for coupled channels which do not use dithering.
- * reference: Section 7.3.4 Dither for Zero Bit Mantissas (bap=0)
- */
-static void remove_dithering(AC3DecodeContext *s) {
-    int ch, i;
-
-    for(ch=1; ch<=s->fbw_channels; ch++) {
-        if(!s->dither_flag[ch] && s->channel_in_cpl[ch]) {
-            for(i = s->start_freq[CPL_CH]; i<s->end_freq[CPL_CH]; i++) {
-                if(!s->bap[CPL_CH][i])
-                    s->fixed_coeffs[ch][i] = 0;
-            }
-        }
-    }
-}
-
-static void decode_transform_coeffs_ch(AC3DecodeContext *s, int blk, int ch,
-                                    mant_groups *m)
-{
-    if (!s->channel_uses_aht[ch]) {
-        ac3_decode_transform_coeffs_ch(s, ch, m);
-    } else {
-        /* if AHT is used, mantissas for all blocks are encoded in the first
-           block of the frame. */
-        int bin;
-        if (!blk && CONFIG_EAC3_DECODER)
-            ff_eac3_decode_transform_coeffs_aht_ch(s, ch);
-        for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
-            s->fixed_coeffs[ch][bin] = s->pre_mantissa[ch][bin][blk] >> s->dexps[ch][bin];
-        }
-    }
-}
-
-/**
- * Decode the transform coefficients.
- */
-static void decode_transform_coeffs(AC3DecodeContext *s, int blk)
-{
-    int ch, end;
-    int got_cplchan = 0;
-    mant_groups m;
-
-    m.b1 = m.b2 = m.b4 = 0;
-
-    for (ch = 1; ch <= s->channels; ch++) {
-        /* transform coefficients for full-bandwidth channel */
-        decode_transform_coeffs_ch(s, blk, ch, &m);
-        /* tranform coefficients for coupling channel come right after the
-           coefficients for the first coupled channel*/
-        if (s->channel_in_cpl[ch])  {
-            if (!got_cplchan) {
-                decode_transform_coeffs_ch(s, blk, CPL_CH, &m);
-                calc_transform_coeffs_cpl(s);
-                got_cplchan = 1;
-            }
-            end = s->end_freq[CPL_CH];
-        } else {
-            end = s->end_freq[ch];
-        }
-        do
-            s->fixed_coeffs[ch][end] = 0;
-        while(++end < 256);
-    }
-
-    /* zero the dithered coefficients for appropriate channels */
-    remove_dithering(s);
-}
-
-/**
- * Stereo rematrixing.
- * reference: Section 7.5.4 Rematrixing : Decoding Technique
- */
-static void do_rematrixing(AC3DecodeContext *s)
-{
-    int bnd, i;
-    int end, bndend;
-
-    end = FFMIN(s->end_freq[1], s->end_freq[2]);
-
-    for(bnd=0; bnd<s->num_rematrixing_bands; bnd++) {
-        if(s->rematrixing_flags[bnd]) {
-            bndend = FFMIN(end, ff_ac3_rematrix_band_tab[bnd+1]);
-            for(i=ff_ac3_rematrix_band_tab[bnd]; i<bndend; i++) {
-                int tmp0 = s->fixed_coeffs[1][i];
-                s->fixed_coeffs[1][i] += s->fixed_coeffs[2][i];
-                s->fixed_coeffs[2][i]  = tmp0 - s->fixed_coeffs[2][i];
-            }
-        }
-    }
-}
-
-/**
- * Inverse MDCT Transform.
- * Convert frequency domain coefficients to time-domain audio samples.
- * reference: Section 7.9.4 Transformation Equations
- */
-static inline void do_imdct(AC3DecodeContext *s, int channels)
-{
-    int ch;
-    float add_bias = s->add_bias;
-    if(s->out_channels==1 && channels>1)
-        add_bias *= LEVEL_MINUS_3DB; // compensate for the gain in downmix
-
-    for (ch=1; ch<=channels; ch++) {
-        if (s->block_switch[ch]) {
-            int i;
-            float *x = s->tmp_output+128;
-            for(i=0; i<128; i++)
-                x[i] = s->transform_coeffs[ch][2*i];
-            ff_imdct_half(&s->imdct_256, s->tmp_output, x);
-            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, add_bias, 128);
-            for(i=0; i<128; i++)
-                x[i] = s->transform_coeffs[ch][2*i+1];
-            ff_imdct_half(&s->imdct_256, s->delay[ch-1], x);
-        } else {
-            ff_imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]);
-            s->dsp.vector_fmul_window(s->output[ch-1], s->delay[ch-1], s->tmp_output, s->window, add_bias, 128);
-            memcpy(s->delay[ch-1], s->tmp_output+128, 128*sizeof(float));
-        }
-    }
-}
-
-/**
- * Downmix the output to mono or stereo.
- */
-void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len)
-{
-    int i, j;
-    float v0, v1;
-    if(out_ch == 2) {
-        for(i=0; i<len; i++) {
-            v0 = v1 = 0.0f;
-            for(j=0; j<in_ch; j++) {
-                v0 += samples[j][i] * matrix[j][0];
-                v1 += samples[j][i] * matrix[j][1];
-            }
-            samples[0][i] = v0;
-            samples[1][i] = v1;
-        }
-    } else if(out_ch == 1) {
-        for(i=0; i<len; i++) {
-            v0 = 0.0f;
-            for(j=0; j<in_ch; j++)
-                v0 += samples[j][i] * matrix[j][0];
-            samples[0][i] = v0;
-        }
-    }
-}
-
-/**
- * Upmix delay samples from stereo to original channel layout.
- */
-static void ac3_upmix_delay(AC3DecodeContext *s)
-{
-    int channel_data_size = sizeof(s->delay[0]);
-    switch(s->channel_mode) {
-        case AC3_CHMODE_DUALMONO:
-        case AC3_CHMODE_STEREO:
-            /* upmix mono to stereo */
-            memcpy(s->delay[1], s->delay[0], channel_data_size);
-            break;
-        case AC3_CHMODE_2F2R:
-            memset(s->delay[3], 0, channel_data_size);
-        case AC3_CHMODE_2F1R:
-            memset(s->delay[2], 0, channel_data_size);
-            break;
-        case AC3_CHMODE_3F2R:
-            memset(s->delay[4], 0, channel_data_size);
-        case AC3_CHMODE_3F1R:
-            memset(s->delay[3], 0, channel_data_size);
-        case AC3_CHMODE_3F:
-            memcpy(s->delay[2], s->delay[1], channel_data_size);
-            memset(s->delay[1], 0, channel_data_size);
-            break;
-    }
-}
-
-/**
- * Decode band structure for coupling, spectral extension, or enhanced coupling.
- * The band structure defines how many subbands are in each band.  For each
- * subband in the range, 1 means it is combined with the previous band, and 0
- * means that it starts a new band.
- *
- * @param[in] gbc bit reader context
- * @param[in] blk block number
- * @param[in] eac3 flag to indicate E-AC-3
- * @param[in] ecpl flag to indicate enhanced coupling
- * @param[in] start_subband subband number for start of range
- * @param[in] end_subband subband number for end of range
- * @param[in] default_band_struct default band structure table
- * @param[out] num_bands number of bands (optionally NULL)
- * @param[out] band_sizes array containing the number of bins in each band (optionally NULL)
- */
-static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
-                                  int ecpl, int start_subband, int end_subband,
-                                  const uint8_t *default_band_struct,
-                                  int *num_bands, uint8_t *band_sizes)
-{
-    int subbnd, bnd, n_subbands, n_bands=0;
-    uint8_t bnd_sz[22];
-    uint8_t coded_band_struct[22];
-    const uint8_t *band_struct;
-
-    n_subbands = end_subband - start_subband;
-
-    /* decode band structure from bitstream or use default */
-    if (!eac3 || get_bits1(gbc)) {
-        for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
-            coded_band_struct[subbnd] = get_bits1(gbc);
-        }
-        band_struct = coded_band_struct;
-    } else if (!blk) {
-        band_struct = &default_band_struct[start_subband+1];
-    } else {
-        /* no change in band structure */
-        return;
-    }
-
-    /* calculate number of bands and band sizes based on band structure.
-       note that the first 4 subbands in enhanced coupling span only 6 bins
-       instead of 12. */
-    if (num_bands || band_sizes ) {
-        n_bands = n_subbands;
-        bnd_sz[0] = ecpl ? 6 : 12;
-        for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) {
-            int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12;
-            if (band_struct[subbnd-1]) {
-                n_bands--;
-                bnd_sz[bnd] += subbnd_size;
-            } else {
-                bnd_sz[++bnd] = subbnd_size;
-            }
-        }
-    }
-
-    /* set optional output params */
-    if (num_bands)
-        *num_bands = n_bands;
-    if (band_sizes)
-        memcpy(band_sizes, bnd_sz, n_bands);
-}
-
-/**
- * Decode a single audio block from the AC-3 bitstream.
- */
-static int decode_audio_block(AC3DecodeContext *s, int blk)
-{
-    int fbw_channels = s->fbw_channels;
-    int channel_mode = s->channel_mode;
-    int i, bnd, seg, ch;
-    int different_transforms;
-    int downmix_output;
-    int cpl_in_use;
-    GetBitContext *gbc = &s->gbc;
-    uint8_t bit_alloc_stages[AC3_MAX_CHANNELS];
-
-    memset(bit_alloc_stages, 0, AC3_MAX_CHANNELS);
-
-    /* block switch flags */
-    different_transforms = 0;
-    if (s->block_switch_syntax) {
-        for (ch = 1; ch <= fbw_channels; ch++) {
-            s->block_switch[ch] = get_bits1(gbc);
-            if(ch > 1 && s->block_switch[ch] != s->block_switch[1])
-                different_transforms = 1;
-        }
-    }
-
-    /* dithering flags */
-    if (s->dither_flag_syntax) {
-        for (ch = 1; ch <= fbw_channels; ch++) {
-            s->dither_flag[ch] = get_bits1(gbc);
-        }
-    }
-
-    /* dynamic range */
-    i = !(s->channel_mode);
-    do {
-        if(get_bits1(gbc)) {
-            s->dynamic_range[i] = ((dynamic_range_tab[get_bits(gbc, 8)]-1.0) *
-                                  s->avctx->drc_scale)+1.0;
-        } else if(blk == 0) {
-            s->dynamic_range[i] = 1.0f;
-        }
-    } while(i--);
-
-    /* spectral extension strategy */
-    if (s->eac3 && (!blk || get_bits1(gbc))) {
-        s->spx_in_use = get_bits1(gbc);
-        if (s->spx_in_use) {
-            int dst_start_freq, dst_end_freq, src_start_freq,
-                start_subband, end_subband;
-
-            /* determine which channels use spx */
-            if (s->channel_mode == AC3_CHMODE_MONO) {
-                s->channel_uses_spx[1] = 1;
-            } else {
-                for (ch = 1; ch <= fbw_channels; ch++)
-                    s->channel_uses_spx[ch] = get_bits1(gbc);
-            }
-
-            /* get the frequency bins of the spx copy region and the spx start
-               and end subbands */
-            dst_start_freq = get_bits(gbc, 2);
-            start_subband  = get_bits(gbc, 3) + 2;
-            if (start_subband > 7)
-                start_subband += start_subband - 7;
-            end_subband    = get_bits(gbc, 3) + 5;
-            if (end_subband   > 7)
-                end_subband   += end_subband   - 7;
-            dst_start_freq = dst_start_freq * 12 + 25;
-            src_start_freq = start_subband  * 12 + 25;
-            dst_end_freq   = end_subband    * 12 + 25;
-
-            /* check validity of spx ranges */
-            if (start_subband >= end_subband) {
-                av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
-                       "range (%d >= %d)\n", start_subband, end_subband);
-                return -1;
-            }
-            if (dst_start_freq >= src_start_freq) {
-                av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
-                       "copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq);
-                return -1;
-            }
-
-            s->spx_dst_start_freq = dst_start_freq;
-            s->spx_src_start_freq = src_start_freq;
-            s->spx_dst_end_freq   = dst_end_freq;
-
-            decode_band_structure(gbc, blk, s->eac3, 0,
-                                  start_subband, end_subband,
-                                  ff_eac3_default_spx_band_struct,
-                                  &s->num_spx_bands,
-                                  s->spx_band_sizes);
-        } else {
-            for (ch = 1; ch <= fbw_channels; ch++) {
-                s->channel_uses_spx[ch] = 0;
-                s->first_spx_coords[ch] = 1;
-            }
-        }
-    }
-
-    /* spectral extension coordinates */
-    if (s->spx_in_use) {
-        for (ch = 1; ch <= fbw_channels; ch++) {
-            if (s->channel_uses_spx[ch]) {
-                if (s->first_spx_coords[ch] || get_bits1(gbc)) {
-                    float spx_blend;
-                    int bin, master_spx_coord;
-
-                    s->first_spx_coords[ch] = 0;
-                    spx_blend = get_bits(gbc, 5) * (1.0f/32);
-                    master_spx_coord = get_bits(gbc, 2) * 3;
-
-                    bin = s->spx_src_start_freq;
-                    for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
-                        int bandsize;
-                        int spx_coord_exp, spx_coord_mant;
-                        float nratio, sblend, nblend, spx_coord;
-
-                        /* calculate blending factors */
-                        bandsize = s->spx_band_sizes[bnd];
-                        nratio = ((float)((bin + (bandsize >> 1))) / s->spx_dst_end_freq) - spx_blend;
-                        nratio = av_clipf(nratio, 0.0f, 1.0f);
-                        nblend = sqrtf(3.0f * nratio); // noise is scaled by sqrt(3) to give unity variance
-                        sblend = sqrtf(1.0f - nratio);
-                        bin += bandsize;
-
-                        /* decode spx coordinates */
-                        spx_coord_exp  = get_bits(gbc, 4);
-                        spx_coord_mant = get_bits(gbc, 2);
-                        if (spx_coord_exp == 15) spx_coord_mant <<= 1;
-                        else                     spx_coord_mant += 4;
-                        spx_coord_mant <<= (25 - spx_coord_exp - master_spx_coord);
-                        spx_coord = spx_coord_mant * (1.0f/(1<<23));
-
-                        /* multiply noise and signal blending factors by spx coordinate */
-                        s->spx_noise_blend [ch][bnd] = nblend * spx_coord;
-                        s->spx_signal_blend[ch][bnd] = sblend * spx_coord;
-                    }
-                }
-            } else {
-                s->first_spx_coords[ch] = 1;
-            }
-        }
-    }
-
-    /* coupling strategy */
-    if (s->eac3 ? s->cpl_strategy_exists[blk] : get_bits1(gbc)) {
-        memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
-        if (!s->eac3)
-            s->cpl_in_use[blk] = get_bits1(gbc);
-        if (s->cpl_in_use[blk]) {
-            /* coupling in use */
-            int cpl_start_subband, cpl_end_subband;
-
-            if (channel_mode < AC3_CHMODE_STEREO) {
-                av_log(s->avctx, AV_LOG_ERROR, "coupling not allowed in mono or dual-mono\n");
-                return -1;
-            }
-
-            /* check for enhanced coupling */
-            if (s->eac3 && get_bits1(gbc)) {
-                /* TODO: parse enhanced coupling strategy info */
-                av_log_missing_feature(s->avctx, "Enhanced coupling", 1);
-                return -1;
-            }
-
-            /* determine which channels are coupled */
-            if (s->eac3 && s->channel_mode == AC3_CHMODE_STEREO) {
-                s->channel_in_cpl[1] = 1;
-                s->channel_in_cpl[2] = 1;
-            } else {
-                for (ch = 1; ch <= fbw_channels; ch++)
-                    s->channel_in_cpl[ch] = get_bits1(gbc);
-            }
-
-            /* phase flags in use */
-            if (channel_mode == AC3_CHMODE_STEREO)
-                s->phase_flags_in_use = get_bits1(gbc);
-
-            /* coupling frequency range */
-            cpl_start_subband = get_bits(gbc, 4);
-            cpl_end_subband = s->spx_in_use ? (s->spx_src_start_freq - 37) / 12 :
-                                              get_bits(gbc, 4) + 3;
-            if (cpl_start_subband >= cpl_end_subband) {
-                av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n",
-                       cpl_start_subband, cpl_end_subband);
-                return -1;
-            }
-            s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37;
-            s->end_freq[CPL_CH]   = cpl_end_subband   * 12 + 37;
-
-            decode_band_structure(gbc, blk, s->eac3, 0, cpl_start_subband,
-                                  cpl_end_subband,
-                                  ff_eac3_default_cpl_band_struct,
-                                  &s->num_cpl_bands, s->cpl_band_sizes);
-        } else {
-            /* coupling not in use */
-            for (ch = 1; ch <= fbw_channels; ch++) {
-                s->channel_in_cpl[ch] = 0;
-                s->first_cpl_coords[ch] = 1;
-            }
-            s->first_cpl_leak = s->eac3;
-            s->phase_flags_in_use = 0;
-        }
-    } else if (!s->eac3) {
-        if(!blk) {
-            av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must be present in block 0\n");
-            return -1;
-        } else {
-            s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
-        }
-    }
-    cpl_in_use = s->cpl_in_use[blk];
-
-    /* coupling coordinates */
-    if (cpl_in_use) {
-        int cpl_coords_exist = 0;
-
-        for (ch = 1; ch <= fbw_channels; ch++) {
-            if (s->channel_in_cpl[ch]) {
-                if ((s->eac3 && s->first_cpl_coords[ch]) || get_bits1(gbc)) {
-                    int master_cpl_coord, cpl_coord_exp, cpl_coord_mant;
-                    s->first_cpl_coords[ch] = 0;
-                    cpl_coords_exist = 1;
-                    master_cpl_coord = 3 * get_bits(gbc, 2);
-                    for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
-                        cpl_coord_exp = get_bits(gbc, 4);
-                        cpl_coord_mant = get_bits(gbc, 4);
-                        if (cpl_coord_exp == 15)
-                            s->cpl_coords[ch][bnd] = cpl_coord_mant << 22;
-                        else
-                            s->cpl_coords[ch][bnd] = (cpl_coord_mant + 16) << 21;
-                        s->cpl_coords[ch][bnd] >>= (cpl_coord_exp + master_cpl_coord);
-                    }
-                } else if (!blk) {
-                    av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must be present in block 0\n");
-                    return -1;
-                }
-            } else {
-                /* channel not in coupling */
-                s->first_cpl_coords[ch] = 1;
-            }
-        }
-        /* phase flags */
-        if (channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) {
-            for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
-                s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0;
-            }
-        }
-    }
-
-    /* stereo rematrixing strategy and band structure */
-    if (channel_mode == AC3_CHMODE_STEREO) {
-        if ((s->eac3 && !blk) || get_bits1(gbc)) {
-            s->num_rematrixing_bands = 4;
-            if (cpl_in_use && s->start_freq[CPL_CH] <= 61) {
-                s->num_rematrixing_bands -= 1 + (s->start_freq[CPL_CH] == 37);
-            } else if (s->spx_in_use && s->spx_src_start_freq <= 61) {
-                s->num_rematrixing_bands--;
-            }
-            for(bnd=0; bnd<s->num_rematrixing_bands; bnd++)
-                s->rematrixing_flags[bnd] = get_bits1(gbc);
-        } else if (!blk) {
-            av_log(s->avctx, AV_LOG_WARNING, "Warning: new rematrixing strategy not present in block 0\n");
-            s->num_rematrixing_bands = 0;
-        }
-    }
-
-    /* exponent strategies for each channel */
-    for (ch = !cpl_in_use; ch <= s->channels; ch++) {
-        if (!s->eac3)
-            s->exp_strategy[blk][ch] = get_bits(gbc, 2 - (ch == s->lfe_ch));
-        if(s->exp_strategy[blk][ch] != EXP_REUSE)
-            bit_alloc_stages[ch] = 3;
-    }
-
-    /* channel bandwidth */
-    for (ch = 1; ch <= fbw_channels; ch++) {
-        s->start_freq[ch] = 0;
-        if (s->exp_strategy[blk][ch] != EXP_REUSE) {
-            int group_size;
-            int prev = s->end_freq[ch];
-            if (s->channel_in_cpl[ch])
-                s->end_freq[ch] = s->start_freq[CPL_CH];
-            else if (s->channel_uses_spx[ch])
-                s->end_freq[ch] = s->spx_src_start_freq;
-            else {
-                int bandwidth_code = get_bits(gbc, 6);
-                if (bandwidth_code > 60) {
-                    av_log(s->avctx, AV_LOG_ERROR, "bandwidth code = %d > 60\n", bandwidth_code);
-                    return -1;
-                }
-                s->end_freq[ch] = bandwidth_code * 3 + 73;
-            }
-            group_size = 3 << (s->exp_strategy[blk][ch] - 1);
-            s->num_exp_groups[ch] = (s->end_freq[ch]+group_size-4) / group_size;
-            if(blk > 0 && s->end_freq[ch] != prev)
-                memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
-        }
-    }
-    if (cpl_in_use && s->exp_strategy[blk][CPL_CH] != EXP_REUSE) {
-        s->num_exp_groups[CPL_CH] = (s->end_freq[CPL_CH] - s->start_freq[CPL_CH]) /
-                                    (3 << (s->exp_strategy[blk][CPL_CH] - 1));
-    }
-
-    /* decode exponents for each channel */
-    for (ch = !cpl_in_use; ch <= s->channels; ch++) {
-        if (s->exp_strategy[blk][ch] != EXP_REUSE) {
-            s->dexps[ch][0] = get_bits(gbc, 4) << !ch;
-            if (decode_exponents(gbc, s->exp_strategy[blk][ch],
-                                 s->num_exp_groups[ch], s->dexps[ch][0],
-                                 &s->dexps[ch][s->start_freq[ch]+!!ch])) {
-                av_log(s->avctx, AV_LOG_ERROR, "exponent out-of-range\n");
-                return -1;
-            }
-            if(ch != CPL_CH && ch != s->lfe_ch)
-                skip_bits(gbc, 2); /* skip gainrng */
-        }
-    }
-
-    /* bit allocation information */
-    if (s->bit_allocation_syntax) {
-        if (get_bits1(gbc)) {
-            s->bit_alloc_params.slow_decay = ff_ac3_slow_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift;
-            s->bit_alloc_params.fast_decay = ff_ac3_fast_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift;
-            s->bit_alloc_params.slow_gain  = ff_ac3_slow_gain_tab[get_bits(gbc, 2)];
-            s->bit_alloc_params.db_per_bit = ff_ac3_db_per_bit_tab[get_bits(gbc, 2)];
-            s->bit_alloc_params.floor  = ff_ac3_floor_tab[get_bits(gbc, 3)];
-            for(ch=!cpl_in_use; ch<=s->channels; ch++)
-                bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
-        } else if (!blk) {
-            av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must be present in block 0\n");
-            return -1;
-        }
-    }
-
-    /* signal-to-noise ratio offsets and fast gains (signal-to-mask ratios) */
-    if(!s->eac3 || !blk){
-        if(s->snr_offset_strategy && get_bits1(gbc)) {
-            int snr = 0;
-            int csnr;
-            csnr = (get_bits(gbc, 6) - 15) << 4;
-            for (i = ch = !cpl_in_use; ch <= s->channels; ch++) {
-                /* snr offset */
-                if (ch == i || s->snr_offset_strategy == 2)
-                    snr = (csnr + get_bits(gbc, 4)) << 2;
-                /* run at least last bit allocation stage if snr offset changes */
-                if(blk && s->snr_offset[ch] != snr) {
-                    bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 1);
-                }
-                s->snr_offset[ch] = snr;
-
-                /* fast gain (normal AC-3 only) */
-                if (!s->eac3) {
-                    int prev = s->fast_gain[ch];
-                    s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
-                    /* run last 2 bit allocation stages if fast gain changes */
-                    if(blk && prev != s->fast_gain[ch])
-                        bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
-                }
-            }
-        } else if (!s->eac3 && !blk) {
-            av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
-            return -1;
-        }
-    }
-
-    /* fast gain (E-AC-3 only) */
-    if (s->fast_gain_syntax && get_bits1(gbc)) {
-        for (ch = !cpl_in_use; ch <= s->channels; ch++) {
-            int prev = s->fast_gain[ch];
-            s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
-            /* run last 2 bit allocation stages if fast gain changes */
-            if(blk && prev != s->fast_gain[ch])
-                bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
-        }
-    } else if (s->eac3 && !blk) {
-        for (ch = !cpl_in_use; ch <= s->channels; ch++)
-            s->fast_gain[ch] = ff_ac3_fast_gain_tab[4];
-    }
-
-    /* E-AC-3 to AC-3 converter SNR offset */
-    if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && get_bits1(gbc)) {
-        skip_bits(gbc, 10); // skip converter snr offset
-    }
-
-    /* coupling leak information */
-    if (cpl_in_use) {
-        if (s->first_cpl_leak || get_bits1(gbc)) {
-            int fl = get_bits(gbc, 3);
-            int sl = get_bits(gbc, 3);
-            /* run last 2 bit allocation stages for coupling channel if
-               coupling leak changes */
-            if(blk && (fl != s->bit_alloc_params.cpl_fast_leak ||
-                       sl != s->bit_alloc_params.cpl_slow_leak)) {
-                bit_alloc_stages[CPL_CH] = FFMAX(bit_alloc_stages[CPL_CH], 2);
-            }
-            s->bit_alloc_params.cpl_fast_leak = fl;
-            s->bit_alloc_params.cpl_slow_leak = sl;
-        } else if (!s->eac3 && !blk) {
-            av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must be present in block 0\n");
-            return -1;
-        }
-        s->first_cpl_leak = 0;
-    }
-
-    /* delta bit allocation information */
-    if (s->dba_syntax && get_bits1(gbc)) {
-        /* delta bit allocation exists (strategy) */
-        for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
-            s->dba_mode[ch] = get_bits(gbc, 2);
-            if (s->dba_mode[ch] == DBA_RESERVED) {
-                av_log(s->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n");
-                return -1;
-            }
-            bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
-        }
-        /* channel delta offset, len and bit allocation */
-        for (ch = !cpl_in_use; ch <= fbw_channels; ch++) {
-            if (s->dba_mode[ch] == DBA_NEW) {
-                s->dba_nsegs[ch] = get_bits(gbc, 3);
-                for (seg = 0; seg <= s->dba_nsegs[ch]; seg++) {
-                    s->dba_offsets[ch][seg] = get_bits(gbc, 5);
-                    s->dba_lengths[ch][seg] = get_bits(gbc, 4);
-                    s->dba_values[ch][seg] = get_bits(gbc, 3);
-                }
-                /* run last 2 bit allocation stages if new dba values */
-                bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
-            }
-        }
-    } else if(blk == 0) {
-        for(ch=0; ch<=s->channels; ch++) {
-            s->dba_mode[ch] = DBA_NONE;
-        }
-    }
-
-    /* Bit allocation */
-    for(ch=!cpl_in_use; ch<=s->channels; ch++) {
-        if(bit_alloc_stages[ch] > 2) {
-            /* Exponent mapping into PSD and PSD integration */
-            ff_ac3_bit_alloc_calc_psd(s->dexps[ch],
-                                      s->start_freq[ch], s->end_freq[ch],
-                                      s->psd[ch], s->band_psd[ch]);
-        }
-        if(bit_alloc_stages[ch] > 1) {
-            /* Compute excitation function, Compute masking curve, and
-               Apply delta bit allocation */
-            if (ff_ac3_bit_alloc_calc_mask(&s->bit_alloc_params, s->band_psd[ch],
-                                           s->start_freq[ch], s->end_freq[ch],
-                                           s->fast_gain[ch], (ch == s->lfe_ch),
-                                           s->dba_mode[ch], s->dba_nsegs[ch],
-                                           s->dba_offsets[ch], s->dba_lengths[ch],
-                                           s->dba_values[ch], s->mask[ch])) {
-                av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n");
-                return -1;
-            }
-        }
-        if(bit_alloc_stages[ch] > 0) {
-            /* Compute bit allocation */
-            const uint8_t *bap_tab = s->channel_uses_aht[ch] ?
-                                     ff_eac3_hebap_tab : ff_ac3_bap_tab;
-            ff_ac3_bit_alloc_calc_bap(s->mask[ch], s->psd[ch],
-                                      s->start_freq[ch], s->end_freq[ch],
-                                      s->snr_offset[ch],
-                                      s->bit_alloc_params.floor,
-                                      bap_tab, s->bap[ch]);
-        }
-    }
-
-    /* unused dummy data */
-    if (s->skip_syntax && get_bits1(gbc)) {
-        int skipl = get_bits(gbc, 9);
-        while(skipl--)
-            skip_bits(gbc, 8);
-    }
-
-    /* unpack the transform coefficients
-       this also uncouples channels if coupling is in use. */
-    decode_transform_coeffs(s, blk);
-
-    /* TODO: generate enhanced coupling coordinates and uncouple */
-
-    /* recover coefficients if rematrixing is in use */
-    if(s->channel_mode == AC3_CHMODE_STEREO)
-        do_rematrixing(s);
-
-    /* apply scaling to coefficients (headroom, dynrng) */
-    for(ch=1; ch<=s->channels; ch++) {
-        float gain = s->mul_bias / 4194304.0f;
-        if(s->channel_mode == AC3_CHMODE_DUALMONO) {
-            gain *= s->dynamic_range[2-ch];
-        } else {
-            gain *= s->dynamic_range[0];
-        }
-        s->dsp.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256);
-    }
-
-    /* apply spectral extension to high frequency bins */
-    if (s->spx_in_use && CONFIG_EAC3_DECODER) {
-        ff_eac3_apply_spectral_extension(s);
-    }
-
-    /* downmix and MDCT. order depends on whether block switching is used for
-       any channel in this block. this is because coefficients for the long
-       and short transforms cannot be mixed. */
-    downmix_output = s->channels != s->out_channels &&
-                     !((s->output_mode & AC3_OUTPUT_LFEON) &&
-                     s->fbw_channels == s->out_channels);
-    if(different_transforms) {
-        /* the delay samples have already been downmixed, so we upmix the delay
-           samples in order to reconstruct all channels before downmixing. */
-        if(s->downmixed) {
-            s->downmixed = 0;
-            ac3_upmix_delay(s);
-        }
-
-        do_imdct(s, s->channels);
-
-        if(downmix_output) {
-            s->dsp.ac3_downmix(s->output, s->downmix_coeffs, s->out_channels, s->fbw_channels, 256);
-        }
-    } else {
-        if(downmix_output) {
-            s->dsp.ac3_downmix(s->transform_coeffs+1, s->downmix_coeffs, s->out_channels, s->fbw_channels, 256);
-        }
-
-        if(downmix_output && !s->downmixed) {
-            s->downmixed = 1;
-            s->dsp.ac3_downmix(s->delay, s->downmix_coeffs, s->out_channels, s->fbw_channels, 128);
-        }
-
-        do_imdct(s, s->out_channels);
-    }
-
-    return 0;
-}
-
-/**
- * Decode a single AC-3 frame.
- */
-static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AC3DecodeContext *s = avctx->priv_data;
-    int16_t *out_samples = (int16_t *)data;
-    int blk, ch, err;
-    const uint8_t *channel_map;
-    const float *output[AC3_MAX_CHANNELS];
-
-    /* initialize the GetBitContext with the start of valid AC-3 Frame */
-    if (s->input_buffer) {
-        /* copy input buffer to decoder context to avoid reading past the end
-           of the buffer, which can be caused by a damaged input stream. */
-        memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
-        init_get_bits(&s->gbc, s->input_buffer, buf_size * 8);
-    } else {
-        init_get_bits(&s->gbc, buf, buf_size * 8);
-    }
-
-    /* parse the syncinfo */
-    *data_size = 0;
-    err = parse_frame_header(s);
-
-    if (err) {
-        switch(err) {
-            case AAC_AC3_PARSE_ERROR_SYNC:
-                av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
-                return -1;
-            case AAC_AC3_PARSE_ERROR_BSID:
-                av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
-                break;
-            case AAC_AC3_PARSE_ERROR_SAMPLE_RATE:
-                av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
-                break;
-            case AAC_AC3_PARSE_ERROR_FRAME_SIZE:
-                av_log(avctx, AV_LOG_ERROR, "invalid frame size\n");
-                break;
-            case AAC_AC3_PARSE_ERROR_FRAME_TYPE:
-                /* skip frame if CRC is ok. otherwise use error concealment. */
-                /* TODO: add support for substreams and dependent frames */
-                if(s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {
-                    av_log(avctx, AV_LOG_ERROR, "unsupported frame type : skipping frame\n");
-                    return s->frame_size;
-                } else {
-                    av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
-                }
-                break;
-            default:
-                av_log(avctx, AV_LOG_ERROR, "invalid header\n");
-                break;
-        }
-    } else {
-        /* check that reported frame size fits in input buffer */
-        if (s->frame_size > buf_size) {
-            av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
-            err = AAC_AC3_PARSE_ERROR_FRAME_SIZE;
-        } else if (avctx->error_recognition >= FF_ER_CAREFUL) {
-            /* check for crc mismatch */
-            if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
-                av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
-                err = AAC_AC3_PARSE_ERROR_CRC;
-            }
-        }
-    }
-
-    /* if frame is ok, set audio parameters */
-    if (!err) {
-        avctx->sample_rate = s->sample_rate;
-        avctx->bit_rate = s->bit_rate;
-
-        /* channel config */
-        s->out_channels = s->channels;
-        s->output_mode = s->channel_mode;
-        if(s->lfe_on)
-            s->output_mode |= AC3_OUTPUT_LFEON;
-        if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
-                avctx->request_channels < s->channels) {
-            s->out_channels = avctx->request_channels;
-            s->output_mode  = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
-            s->channel_layout = ff_ac3_channel_layout_tab[s->output_mode];
-        }
-        avctx->channels = s->out_channels;
-        avctx->channel_layout = s->channel_layout;
-
-        /* set downmixing coefficients if needed */
-        if(s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) &&
-                s->fbw_channels == s->out_channels)) {
-            set_downmix_coeffs(s);
-        }
-    } else if (!s->out_channels) {
-        s->out_channels = avctx->channels;
-        if(s->out_channels < s->channels)
-            s->output_mode  = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
-    }
-
-    /* decode the audio blocks */
-    channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on];
-    for (ch = 0; ch < s->out_channels; ch++)
-        output[ch] = s->output[channel_map[ch]];
-    for (blk = 0; blk < s->num_blocks; blk++) {
-        if (!err && decode_audio_block(s, blk)) {
-            av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
-            err = 1;
-        }
-        s->dsp.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
-        out_samples += 256 * s->out_channels;
-    }
-    *data_size = s->num_blocks * 256 * avctx->channels * sizeof (int16_t);
-    return FFMIN(buf_size, s->frame_size);
-}
-
-/**
- * Uninitialize the AC-3 decoder.
- */
-static av_cold int ac3_decode_end(AVCodecContext *avctx)
-{
-    AC3DecodeContext *s = avctx->priv_data;
-    ff_mdct_end(&s->imdct_512);
-    ff_mdct_end(&s->imdct_256);
-
-    av_freep(&s->input_buffer);
-
-    return 0;
-}
-
-AVCodec ac3_decoder = {
-    .name = "ac3",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_AC3,
-    .priv_data_size = sizeof (AC3DecodeContext),
-    .init = ac3_decode_init,
-    .close = ac3_decode_end,
-    .decode = ac3_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
-};
-
-#if CONFIG_EAC3_DECODER
-AVCodec eac3_decoder = {
-    .name = "eac3",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_EAC3,
-    .priv_data_size = sizeof (AC3DecodeContext),
-    .init = ac3_decode_init,
-    .close = ac3_decode_end,
-    .decode = ac3_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
-};
-#endif
diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h
deleted file mode 100644
index 8c0d442..0000000
--- a/libavcodec/ac3dec.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Common code between the AC-3 and E-AC-3 decoders
- * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Common code between the AC-3 and E-AC-3 decoders.
- *
- * Summary of MDCT Coefficient Grouping:
- * The individual MDCT coefficient indices are often referred to in the
- * (E-)AC-3 specification as frequency bins.  These bins are grouped together
- * into subbands of 12 coefficients each.  The subbands are grouped together
- * into bands as defined in the bitstream by the band structures, which
- * determine the number of bands and the size of each band.  The full spectrum
- * of 256 frequency bins is divided into 1 DC bin + 21 subbands = 253 bins.
- * This system of grouping coefficients is used for channel bandwidth, stereo
- * rematrixing, channel coupling, enhanced coupling, and spectral extension.
- *
- * +-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-+
- * |1|  |12|  |  [12|12|12|12]  |  |  |  |  |  |  |  |  |  |  |  |  |3|
- * +-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-+
- * ~~~  ~~~~     ~~~~~~~~~~~~~                                      ~~~
- *  |     |            |                                             |
- *  |     |            |                    3 unused frequency bins--+
- *  |     |            |
- *  |     |            +--1 band containing 4 subbands
- *  |     |
- *  |     +--1 subband of 12 frequency bins
- *  |
- *  +--DC frequency bin
- */
-
-#ifndef AVCODEC_AC3DEC_H
-#define AVCODEC_AC3DEC_H
-
-#include "libavutil/lfg.h"
-#include "ac3.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-
-/* override ac3.h to include coupling channel */
-#undef AC3_MAX_CHANNELS
-#define AC3_MAX_CHANNELS 7
-#define CPL_CH 0
-
-#define AC3_OUTPUT_LFEON  8
-
-#define AC3_MAX_COEFS   256
-#define AC3_BLOCK_SIZE  256
-#define MAX_BLOCKS        6
-#define SPX_MAX_BANDS    17
-
-typedef struct {
-    AVCodecContext *avctx;                  ///< parent context
-    GetBitContext gbc;                      ///< bitstream reader
-    uint8_t *input_buffer;                  ///< temp buffer to prevent overread
-
-///@defgroup bsi bit stream information
-///@{
-    int frame_type;                         ///< frame type                             (strmtyp)
-    int substreamid;                        ///< substream identification
-    int frame_size;                         ///< current frame size, in bytes
-    int bit_rate;                           ///< stream bit rate, in bits-per-second
-    int sample_rate;                        ///< sample frequency, in Hz
-    int num_blocks;                         ///< number of audio blocks
-    int channel_mode;                       ///< channel mode                           (acmod)
-    int channel_layout;                     ///< channel layout
-    int lfe_on;                             ///< lfe channel in use
-    int channel_map;                        ///< custom channel map
-    int center_mix_level;                   ///< Center mix level index
-    int surround_mix_level;                 ///< Surround mix level index
-    int eac3;                               ///< indicates if current frame is E-AC-3
-///@}
-
-///@defgroup audfrm frame syntax parameters
-    int snr_offset_strategy;                ///< SNR offset strategy                    (snroffststr)
-    int block_switch_syntax;                ///< block switch syntax enabled            (blkswe)
-    int dither_flag_syntax;                 ///< dither flag syntax enabled             (dithflage)
-    int bit_allocation_syntax;              ///< bit allocation model syntax enabled    (bamode)
-    int fast_gain_syntax;                   ///< fast gain codes enabled                (frmfgaincode)
-    int dba_syntax;                         ///< delta bit allocation syntax enabled    (dbaflde)
-    int skip_syntax;                        ///< skip field syntax enabled              (skipflde)
- ///@}
-
-///@defgroup cpl standard coupling
-    int cpl_in_use[MAX_BLOCKS];             ///< coupling in use                        (cplinu)
-    int cpl_strategy_exists[MAX_BLOCKS];    ///< coupling strategy exists               (cplstre)
-    int channel_in_cpl[AC3_MAX_CHANNELS];   ///< channel in coupling                    (chincpl)
-    int phase_flags_in_use;                 ///< phase flags in use                     (phsflginu)
-    int phase_flags[18];                    ///< phase flags                            (phsflg)
-    int num_cpl_bands;                      ///< number of coupling bands               (ncplbnd)
-    uint8_t cpl_band_sizes[18];             ///< number of coeffs in each coupling band
-    int firstchincpl;                       ///< first channel in coupling
-    int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states      (firstcplcos)
-    int cpl_coords[AC3_MAX_CHANNELS][18];   ///< coupling coordinates                   (cplco)
-///@}
-
-///@defgroup spx spectral extension
-///@{
-    int spx_in_use;                             ///< spectral extension in use              (spxinu)
-    uint8_t channel_uses_spx[AC3_MAX_CHANNELS]; ///< channel uses spectral extension        (chinspx)
-    int8_t spx_atten_code[AC3_MAX_CHANNELS];    ///< spx attenuation code                   (spxattencod)
-    int spx_src_start_freq;                     ///< spx start frequency bin
-    int spx_dst_end_freq;                       ///< spx end frequency bin
-    int spx_dst_start_freq;                     ///< spx starting frequency bin for copying (copystartmant)
-                                                ///< the copy region ends at the start of the spx region.
-    int num_spx_bands;                          ///< number of spx bands                    (nspxbnds)
-    uint8_t spx_band_sizes[SPX_MAX_BANDS];      ///< number of bins in each spx band
-    uint8_t first_spx_coords[AC3_MAX_CHANNELS]; ///< first spx coordinates states           (firstspxcos)
-    float spx_noise_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS]; ///< spx noise blending factor  (nblendfact)
-    float spx_signal_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS];///< spx signal blending factor (sblendfact)
-///@}
-
-///@defgroup aht adaptive hybrid transform
-    int channel_uses_aht[AC3_MAX_CHANNELS];                         ///< channel AHT in use (chahtinu)
-    int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][MAX_BLOCKS];  ///< pre-IDCT mantissas
-///@}
-
-///@defgroup channel channel
-    int fbw_channels;                           ///< number of full-bandwidth channels
-    int channels;                               ///< number of total channels
-    int lfe_ch;                                 ///< index of LFE channel
-    float downmix_coeffs[AC3_MAX_CHANNELS][2];  ///< stereo downmix coefficients
-    int downmixed;                              ///< indicates if coeffs are currently downmixed
-    int output_mode;                            ///< output channel configuration
-    int out_channels;                           ///< number of output channels
-///@}
-
-///@defgroup dynrng dynamic range
-    float dynamic_range[2];                 ///< dynamic range
-///@}
-
-///@defgroup bandwidth bandwidth
-    int start_freq[AC3_MAX_CHANNELS];       ///< start frequency bin                    (strtmant)
-    int end_freq[AC3_MAX_CHANNELS];         ///< end frequency bin                      (endmant)
-///@}
-
-///@defgroup rematrixing rematrixing
-    int num_rematrixing_bands;              ///< number of rematrixing bands            (nrematbnd)
-    int rematrixing_flags[4];               ///< rematrixing flags                      (rematflg)
-///@}
-
-///@defgroup exponents exponents
-    int num_exp_groups[AC3_MAX_CHANNELS];           ///< Number of exponent groups      (nexpgrp)
-    int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS];  ///< decoded exponents
-    int exp_strategy[MAX_BLOCKS][AC3_MAX_CHANNELS]; ///< exponent strategies            (expstr)
-///@}
-
-///@defgroup bitalloc bit allocation
-    AC3BitAllocParameters bit_alloc_params;         ///< bit allocation parameters
-    int first_cpl_leak;                             ///< first coupling leak state      (firstcplleak)
-    int snr_offset[AC3_MAX_CHANNELS];               ///< signal-to-noise ratio offsets  (snroffst)
-    int fast_gain[AC3_MAX_CHANNELS];                ///< fast gain values/SMR's         (fgain)
-    uint8_t bap[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< bit allocation pointers
-    int16_t psd[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< scaled exponents
-    int16_t band_psd[AC3_MAX_CHANNELS][50];         ///< interpolated exponents
-    int16_t mask[AC3_MAX_CHANNELS][50];             ///< masking curve values
-    int dba_mode[AC3_MAX_CHANNELS];                 ///< delta bit allocation mode
-    int dba_nsegs[AC3_MAX_CHANNELS];                ///< number of delta segments
-    uint8_t dba_offsets[AC3_MAX_CHANNELS][8];       ///< delta segment offsets
-    uint8_t dba_lengths[AC3_MAX_CHANNELS][8];       ///< delta segment lengths
-    uint8_t dba_values[AC3_MAX_CHANNELS][8];        ///< delta values for each segment
-///@}
-
-///@defgroup dithering zero-mantissa dithering
-    int dither_flag[AC3_MAX_CHANNELS];      ///< dither flags                           (dithflg)
-    AVLFG dith_state;                       ///< for dither generation
-///@}
-
-///@defgroup imdct IMDCT
-    int block_switch[AC3_MAX_CHANNELS];     ///< block switch flags                     (blksw)
-    FFTContext imdct_512;                   ///< for 512 sample IMDCT
-    FFTContext imdct_256;                   ///< for 256 sample IMDCT
-///@}
-
-///@defgroup opt optimization
-    DSPContext dsp;                         ///< for optimization
-    float add_bias;                         ///< offset for float_to_int16 conversion
-    float mul_bias;                         ///< scaling for float_to_int16 conversion
-///@}
-
-///@defgroup arrays aligned arrays
-    DECLARE_ALIGNED(16, int,   fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];       ///> fixed-point transform coefficients
-    DECLARE_ALIGNED(16, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS];   ///< transform coefficients
-    DECLARE_ALIGNED(16, float, delay)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];             ///< delay - added to the next block
-    DECLARE_ALIGNED(16, float, window)[AC3_BLOCK_SIZE];                              ///< window coefficients
-    DECLARE_ALIGNED(16, float, tmp_output)[AC3_BLOCK_SIZE];                          ///< temporary storage for output before windowing
-    DECLARE_ALIGNED(16, float, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];            ///< output after imdct transform and windowing
-///@}
-} AC3DecodeContext;
-
-/**
- * Parse the E-AC-3 frame header.
- * This parses both the bit stream info and audio frame header.
- */
-int ff_eac3_parse_header(AC3DecodeContext *s);
-
-/**
- * Decode mantissas in a single channel for the entire frame.
- * This is used when AHT mode is enabled.
- */
-void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
-
-void ff_ac3_downmix_c(float (*samples)[256], float (*matrix)[2],
-                      int out_ch, int in_ch, int len);
-
-/**
- * Apply spectral extension to each channel by copying lower frequency
- * coefficients to higher frequency bins and applying side information to
- * approximate the original high frequency signal.
- */
-void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
-
-#endif /* AVCODEC_AC3DEC_H */
diff --git a/libavcodec/ac3dec_data.c b/libavcodec/ac3dec_data.c
deleted file mode 100644
index ea13d3d..0000000
--- a/libavcodec/ac3dec_data.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * AC-3 and E-AC-3 decoder tables
- * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Tables taken directly from the AC-3 spec.
- */
-
-#include "ac3dec_data.h"
-#include "ac3.h"
-
-/**
- * Table used to ungroup 3 values stored in 5 bits.
- * Used by bap=1 mantissas and GAQ.
- * ff_ac3_ungroup_3_in_5_bits_tab[i] = { i/9, (i%9)/3, (i%9)%3 }
- */
-const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] = {
-    { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 1, 0 },
-    { 0, 1, 1 }, { 0, 1, 2 }, { 0, 2, 0 }, { 0, 2, 1 },
-    { 0, 2, 2 }, { 1, 0, 0 }, { 1, 0, 1 }, { 1, 0, 2 },
-    { 1, 1, 0 }, { 1, 1, 1 }, { 1, 1, 2 }, { 1, 2, 0 },
-    { 1, 2, 1 }, { 1, 2, 2 }, { 2, 0, 0 }, { 2, 0, 1 },
-    { 2, 0, 2 }, { 2, 1, 0 }, { 2, 1, 1 }, { 2, 1, 2 },
-    { 2, 2, 0 }, { 2, 2, 1 }, { 2, 2, 2 }, { 3, 0, 0 },
-    { 3, 0, 1 }, { 3, 0, 2 }, { 3, 1, 0 }, { 3, 1, 1 }
-};
-
-/**
- * Table of bin locations for rematrixing bands
- * reference: Section 7.5.2 Rematrixing : Frequency Band Definitions
- */
-const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 };
-
-const uint8_t ff_eac3_hebap_tab[64] = {
-    0, 1, 2, 3, 4, 5, 6, 7, 8, 8,
-    8, 8, 9, 9, 9, 10, 10, 10, 10, 11,
-    11, 11, 11, 12, 12, 12, 12, 13, 13, 13,
-    13, 14, 14, 14, 14, 15, 15, 15, 15, 16,
-    16, 16, 16, 17, 17, 17, 17, 18, 18, 18,
-    18, 18, 18, 18, 18, 19, 19, 19, 19, 19,
-    19, 19, 19, 19,
-};
-
-/**
- * Table E2.16 Default Coupling Banding Structure
- */
-const uint8_t ff_eac3_default_cpl_band_struct[18] =
-{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 };
-
-/**
- * Table E2.15 Default Spectral Extension Banding Structure
- */
-const uint8_t ff_eac3_default_spx_band_struct[17] =
-{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
diff --git a/libavcodec/ac3dec_data.h b/libavcodec/ac3dec_data.h
deleted file mode 100644
index 9ed7c73..0000000
--- a/libavcodec/ac3dec_data.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * AC-3 and E-AC-3 decoder tables
- * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AC3DEC_DATA_H
-#define AVCODEC_AC3DEC_DATA_H
-
-#include <stdint.h>
-
-extern const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3];
-extern const uint8_t ff_ac3_rematrix_band_tab[5];
-
-extern const uint8_t ff_eac3_hebap_tab[64];
-extern const uint8_t ff_eac3_default_cpl_band_struct[18];
-extern const uint8_t ff_eac3_default_spx_band_struct[17];
-
-#endif /* AVCODEC_AC3DEC_DATA_H */
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
deleted file mode 100644
index e30e1bd..0000000
--- a/libavcodec/ac3enc.c
+++ /dev/null
@@ -1,1425 +0,0 @@
-/*
- * The simplest AC-3 encoder
- * Copyright (c) 2000 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * The simplest AC-3 encoder.
- */
-//#define DEBUG
-//#define DEBUG_BITALLOC
-#include "libavutil/crc.h"
-#include "avcodec.h"
-#include "libavutil/common.h" /* for av_reverse */
-#include "put_bits.h"
-#include "ac3.h"
-#include "audioconvert.h"
-
-typedef struct AC3EncodeContext {
-    PutBitContext pb;
-    int nb_channels;
-    int nb_all_channels;
-    int lfe_channel;
-    const uint8_t *channel_map;
-    int bit_rate;
-    unsigned int sample_rate;
-    unsigned int bitstream_id;
-    unsigned int frame_size_min; /* minimum frame size in case rounding is necessary */
-    unsigned int frame_size; /* current frame size in words */
-    unsigned int bits_written;
-    unsigned int samples_written;
-    int sr_shift;
-    unsigned int frame_size_code;
-    unsigned int sr_code; /* frequency */
-    unsigned int channel_mode;
-    int lfe;
-    unsigned int bitstream_mode;
-    short last_samples[AC3_MAX_CHANNELS][256];
-    unsigned int chbwcod[AC3_MAX_CHANNELS];
-    int nb_coefs[AC3_MAX_CHANNELS];
-
-    /* bitrate allocation control */
-    int slow_gain_code, slow_decay_code, fast_decay_code, db_per_bit_code, floor_code;
-    AC3BitAllocParameters bit_alloc;
-    int coarse_snr_offset;
-    int fast_gain_code[AC3_MAX_CHANNELS];
-    int fine_snr_offset[AC3_MAX_CHANNELS];
-    /* mantissa encoding */
-    int mant1_cnt, mant2_cnt, mant4_cnt;
-} AC3EncodeContext;
-
-static int16_t costab[64];
-static int16_t sintab[64];
-static int16_t xcos1[128];
-static int16_t xsin1[128];
-
-#define MDCT_NBITS 9
-#define N         (1 << MDCT_NBITS)
-
-/* new exponents are sent if their Norm 1 exceed this number */
-#define EXP_DIFF_THRESHOLD 1000
-
-static inline int16_t fix15(float a)
-{
-    int v;
-    v = (int)(a * (float)(1 << 15));
-    if (v < -32767)
-        v = -32767;
-    else if (v > 32767)
-        v = 32767;
-    return v;
-}
-
-typedef struct IComplex {
-    short re,im;
-} IComplex;
-
-static av_cold void fft_init(int ln)
-{
-    int i, n;
-    float alpha;
-
-    n = 1 << ln;
-
-    for(i=0;i<(n/2);i++) {
-        alpha = 2 * M_PI * (float)i / (float)n;
-        costab[i] = fix15(cos(alpha));
-        sintab[i] = fix15(sin(alpha));
-    }
-}
-
-/* butter fly op */
-#define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) \
-{\
-  int ax, ay, bx, by;\
-  bx=pre1;\
-  by=pim1;\
-  ax=qre1;\
-  ay=qim1;\
-  pre = (bx + ax) >> 1;\
-  pim = (by + ay) >> 1;\
-  qre = (bx - ax) >> 1;\
-  qim = (by - ay) >> 1;\
-}
-
-#define CMUL(pre, pim, are, aim, bre, bim) \
-{\
-   pre = (MUL16(are, bre) - MUL16(aim, bim)) >> 15;\
-   pim = (MUL16(are, bim) + MUL16(bre, aim)) >> 15;\
-}
-
-
-/* do a 2^n point complex fft on 2^ln points. */
-static void fft(IComplex *z, int ln)
-{
-    int        j, l, np, np2;
-    int        nblocks, nloops;
-    register IComplex *p,*q;
-    int tmp_re, tmp_im;
-
-    np = 1 << ln;
-
-    /* reverse */
-    for(j=0;j<np;j++) {
-        int k = av_reverse[j] >> (8 - ln);
-        if (k < j)
-            FFSWAP(IComplex, z[k], z[j]);
-    }
-
-    /* pass 0 */
-
-    p=&z[0];
-    j=(np >> 1);
-    do {
-        BF(p[0].re, p[0].im, p[1].re, p[1].im,
-           p[0].re, p[0].im, p[1].re, p[1].im);
-        p+=2;
-    } while (--j != 0);
-
-    /* pass 1 */
-
-    p=&z[0];
-    j=np >> 2;
-    do {
-        BF(p[0].re, p[0].im, p[2].re, p[2].im,
-           p[0].re, p[0].im, p[2].re, p[2].im);
-        BF(p[1].re, p[1].im, p[3].re, p[3].im,
-           p[1].re, p[1].im, p[3].im, -p[3].re);
-        p+=4;
-    } while (--j != 0);
-
-    /* pass 2 .. ln-1 */
-
-    nblocks = np >> 3;
-    nloops = 1 << 2;
-    np2 = np >> 1;
-    do {
-        p = z;
-        q = z + nloops;
-        for (j = 0; j < nblocks; ++j) {
-
-            BF(p->re, p->im, q->re, q->im,
-               p->re, p->im, q->re, q->im);
-
-            p++;
-            q++;
-            for(l = nblocks; l < np2; l += nblocks) {
-                CMUL(tmp_re, tmp_im, costab[l], -sintab[l], q->re, q->im);
-                BF(p->re, p->im, q->re, q->im,
-                   p->re, p->im, tmp_re, tmp_im);
-                p++;
-                q++;
-            }
-            p += nloops;
-            q += nloops;
-        }
-        nblocks = nblocks >> 1;
-        nloops = nloops << 1;
-    } while (nblocks != 0);
-}
-
-/* do a 512 point mdct */
-static void mdct512(int32_t *out, int16_t *in)
-{
-    int i, re, im, re1, im1;
-    int16_t rot[N];
-    IComplex x[N/4];
-
-    /* shift to simplify computations */
-    for(i=0;i<N/4;i++)
-        rot[i] = -in[i + 3*N/4];
-    for(i=N/4;i<N;i++)
-        rot[i] = in[i - N/4];
-
-    /* pre rotation */
-    for(i=0;i<N/4;i++) {
-        re = ((int)rot[2*i] - (int)rot[N-1-2*i]) >> 1;
-        im = -((int)rot[N/2+2*i] - (int)rot[N/2-1-2*i]) >> 1;
-        CMUL(x[i].re, x[i].im, re, im, -xcos1[i], xsin1[i]);
-    }
-
-    fft(x, MDCT_NBITS - 2);
-
-    /* post rotation */
-    for(i=0;i<N/4;i++) {
-        re = x[i].re;
-        im = x[i].im;
-        CMUL(re1, im1, re, im, xsin1[i], xcos1[i]);
-        out[2*i] = im1;
-        out[N/2-1-2*i] = re1;
-    }
-}
-
-/* XXX: use another norm ? */
-static int calc_exp_diff(uint8_t *exp1, uint8_t *exp2, int n)
-{
-    int sum, i;
-    sum = 0;
-    for(i=0;i<n;i++) {
-        sum += abs(exp1[i] - exp2[i]);
-    }
-    return sum;
-}
-
-static void compute_exp_strategy(uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
-                                 uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
-                                 int ch, int is_lfe)
-{
-    int i, j;
-    int exp_diff;
-
-    /* estimate if the exponent variation & decide if they should be
-       reused in the next frame */
-    exp_strategy[0][ch] = EXP_NEW;
-    for(i=1;i<NB_BLOCKS;i++) {
-        exp_diff = calc_exp_diff(exp[i][ch], exp[i-1][ch], N/2);
-        dprintf(NULL, "exp_diff=%d\n", exp_diff);
-        if (exp_diff > EXP_DIFF_THRESHOLD)
-            exp_strategy[i][ch] = EXP_NEW;
-        else
-            exp_strategy[i][ch] = EXP_REUSE;
-    }
-    if (is_lfe)
-        return;
-
-    /* now select the encoding strategy type : if exponents are often
-       recoded, we use a coarse encoding */
-    i = 0;
-    while (i < NB_BLOCKS) {
-        j = i + 1;
-        while (j < NB_BLOCKS && exp_strategy[j][ch] == EXP_REUSE)
-            j++;
-        switch(j - i) {
-        case 1:
-            exp_strategy[i][ch] = EXP_D45;
-            break;
-        case 2:
-        case 3:
-            exp_strategy[i][ch] = EXP_D25;
-            break;
-        default:
-            exp_strategy[i][ch] = EXP_D15;
-            break;
-        }
-        i = j;
-    }
-}
-
-/* set exp[i] to min(exp[i], exp1[i]) */
-static void exponent_min(uint8_t exp[N/2], uint8_t exp1[N/2], int n)
-{
-    int i;
-
-    for(i=0;i<n;i++) {
-        if (exp1[i] < exp[i])
-            exp[i] = exp1[i];
-    }
-}
-
-/* update the exponents so that they are the ones the decoder will
-   decode. Return the number of bits used to code the exponents */
-static int encode_exp(uint8_t encoded_exp[N/2],
-                      uint8_t exp[N/2],
-                      int nb_exps,
-                      int exp_strategy)
-{
-    int group_size, nb_groups, i, j, k, exp_min;
-    uint8_t exp1[N/2];
-
-    switch(exp_strategy) {
-    case EXP_D15:
-        group_size = 1;
-        break;
-    case EXP_D25:
-        group_size = 2;
-        break;
-    default:
-    case EXP_D45:
-        group_size = 4;
-        break;
-    }
-    nb_groups = ((nb_exps + (group_size * 3) - 4) / (3 * group_size)) * 3;
-
-    /* for each group, compute the minimum exponent */
-    exp1[0] = exp[0]; /* DC exponent is handled separately */
-    k = 1;
-    for(i=1;i<=nb_groups;i++) {
-        exp_min = exp[k];
-        assert(exp_min >= 0 && exp_min <= 24);
-        for(j=1;j<group_size;j++) {
-            if (exp[k+j] < exp_min)
-                exp_min = exp[k+j];
-        }
-        exp1[i] = exp_min;
-        k += group_size;
-    }
-
-    /* constraint for DC exponent */
-    if (exp1[0] > 15)
-        exp1[0] = 15;
-
-    /* Decrease the delta between each groups to within 2
-     * so that they can be differentially encoded */
-    for (i=1;i<=nb_groups;i++)
-        exp1[i] = FFMIN(exp1[i], exp1[i-1] + 2);
-    for (i=nb_groups-1;i>=0;i--)
-        exp1[i] = FFMIN(exp1[i], exp1[i+1] + 2);
-
-    /* now we have the exponent values the decoder will see */
-    encoded_exp[0] = exp1[0];
-    k = 1;
-    for(i=1;i<=nb_groups;i++) {
-        for(j=0;j<group_size;j++) {
-            encoded_exp[k+j] = exp1[i];
-        }
-        k += group_size;
-    }
-
-#if defined(DEBUG)
-    av_log(NULL, AV_LOG_DEBUG, "exponents: strategy=%d\n", exp_strategy);
-    for(i=0;i<=nb_groups * group_size;i++) {
-        av_log(NULL, AV_LOG_DEBUG, "%d ", encoded_exp[i]);
-    }
-    av_log(NULL, AV_LOG_DEBUG, "\n");
-#endif
-
-    return 4 + (nb_groups / 3) * 7;
-}
-
-/* return the size in bits taken by the mantissa */
-static int compute_mantissa_size(AC3EncodeContext *s, uint8_t *m, int nb_coefs)
-{
-    int bits, mant, i;
-
-    bits = 0;
-    for(i=0;i<nb_coefs;i++) {
-        mant = m[i];
-        switch(mant) {
-        case 0:
-            /* nothing */
-            break;
-        case 1:
-            /* 3 mantissa in 5 bits */
-            if (s->mant1_cnt == 0)
-                bits += 5;
-            if (++s->mant1_cnt == 3)
-                s->mant1_cnt = 0;
-            break;
-        case 2:
-            /* 3 mantissa in 7 bits */
-            if (s->mant2_cnt == 0)
-                bits += 7;
-            if (++s->mant2_cnt == 3)
-                s->mant2_cnt = 0;
-            break;
-        case 3:
-            bits += 3;
-            break;
-        case 4:
-            /* 2 mantissa in 7 bits */
-            if (s->mant4_cnt == 0)
-                bits += 7;
-            if (++s->mant4_cnt == 2)
-                s->mant4_cnt = 0;
-            break;
-        case 14:
-            bits += 14;
-            break;
-        case 15:
-            bits += 16;
-            break;
-        default:
-            bits += mant - 1;
-            break;
-        }
-    }
-    return bits;
-}
-
-
-static void bit_alloc_masking(AC3EncodeContext *s,
-                              uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
-                              uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
-                              int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
-                              int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50])
-{
-    int blk, ch;
-    int16_t band_psd[NB_BLOCKS][AC3_MAX_CHANNELS][50];
-
-    for(blk=0; blk<NB_BLOCKS; blk++) {
-        for(ch=0;ch<s->nb_all_channels;ch++) {
-            if(exp_strategy[blk][ch] == EXP_REUSE) {
-                memcpy(psd[blk][ch], psd[blk-1][ch], (N/2)*sizeof(int16_t));
-                memcpy(mask[blk][ch], mask[blk-1][ch], 50*sizeof(int16_t));
-            } else {
-                ff_ac3_bit_alloc_calc_psd(encoded_exp[blk][ch], 0,
-                                          s->nb_coefs[ch],
-                                          psd[blk][ch], band_psd[blk][ch]);
-                ff_ac3_bit_alloc_calc_mask(&s->bit_alloc, band_psd[blk][ch],
-                                           0, s->nb_coefs[ch],
-                                           ff_ac3_fast_gain_tab[s->fast_gain_code[ch]],
-                                           ch == s->lfe_channel,
-                                           DBA_NONE, 0, NULL, NULL, NULL,
-                                           mask[blk][ch]);
-            }
-        }
-    }
-}
-
-static int bit_alloc(AC3EncodeContext *s,
-                     int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50],
-                     int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
-                     uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
-                     int frame_bits, int coarse_snr_offset, int fine_snr_offset)
-{
-    int i, ch;
-    int snr_offset;
-
-    snr_offset = (((coarse_snr_offset - 15) << 4) + fine_snr_offset) << 2;
-
-    /* compute size */
-    for(i=0;i<NB_BLOCKS;i++) {
-        s->mant1_cnt = 0;
-        s->mant2_cnt = 0;
-        s->mant4_cnt = 0;
-        for(ch=0;ch<s->nb_all_channels;ch++) {
-            ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0,
-                                      s->nb_coefs[ch], snr_offset,
-                                      s->bit_alloc.floor, ff_ac3_bap_tab,
-                                      bap[i][ch]);
-            frame_bits += compute_mantissa_size(s, bap[i][ch],
-                                                 s->nb_coefs[ch]);
-        }
-    }
-#if 0
-    printf("csnr=%d fsnr=%d frame_bits=%d diff=%d\n",
-           coarse_snr_offset, fine_snr_offset, frame_bits,
-           16 * s->frame_size - ((frame_bits + 7) & ~7));
-#endif
-    return 16 * s->frame_size - frame_bits;
-}
-
-#define SNR_INC1 4
-
-static int compute_bit_allocation(AC3EncodeContext *s,
-                                  uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
-                                  uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2],
-                                  uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS],
-                                  int frame_bits)
-{
-    int i, ch;
-    int coarse_snr_offset, fine_snr_offset;
-    uint8_t bap1[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
-    int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
-    int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50];
-    static const int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 };
-
-    /* init default parameters */
-    s->slow_decay_code = 2;
-    s->fast_decay_code = 1;
-    s->slow_gain_code = 1;
-    s->db_per_bit_code = 2;
-    s->floor_code = 4;
-    for(ch=0;ch<s->nb_all_channels;ch++)
-        s->fast_gain_code[ch] = 4;
-
-    /* compute real values */
-    s->bit_alloc.sr_code = s->sr_code;
-    s->bit_alloc.sr_shift = s->sr_shift;
-    s->bit_alloc.slow_decay = ff_ac3_slow_decay_tab[s->slow_decay_code] >> s->sr_shift;
-    s->bit_alloc.fast_decay = ff_ac3_fast_decay_tab[s->fast_decay_code] >> s->sr_shift;
-    s->bit_alloc.slow_gain = ff_ac3_slow_gain_tab[s->slow_gain_code];
-    s->bit_alloc.db_per_bit = ff_ac3_db_per_bit_tab[s->db_per_bit_code];
-    s->bit_alloc.floor = ff_ac3_floor_tab[s->floor_code];
-
-    /* header size */
-    frame_bits += 65;
-    // if (s->channel_mode == 2)
-    //    frame_bits += 2;
-    frame_bits += frame_bits_inc[s->channel_mode];
-
-    /* audio blocks */
-    for(i=0;i<NB_BLOCKS;i++) {
-        frame_bits += s->nb_channels * 2 + 2; /* blksw * c, dithflag * c, dynrnge, cplstre */
-        if (s->channel_mode == AC3_CHMODE_STEREO) {
-            frame_bits++; /* rematstr */
-            if(i==0) frame_bits += 4;
-        }
-        frame_bits += 2 * s->nb_channels; /* chexpstr[2] * c */
-        if (s->lfe)
-            frame_bits++; /* lfeexpstr */
-        for(ch=0;ch<s->nb_channels;ch++) {
-            if (exp_strategy[i][ch] != EXP_REUSE)
-                frame_bits += 6 + 2; /* chbwcod[6], gainrng[2] */
-        }
-        frame_bits++; /* baie */
-        frame_bits++; /* snr */
-        frame_bits += 2; /* delta / skip */
-    }
-    frame_bits++; /* cplinu for block 0 */
-    /* bit alloc info */
-    /* sdcycod[2], fdcycod[2], sgaincod[2], dbpbcod[2], floorcod[3] */
-    /* csnroffset[6] */
-    /* (fsnoffset[4] + fgaincod[4]) * c */
-    frame_bits += 2*4 + 3 + 6 + s->nb_all_channels * (4 + 3);
-
-    /* auxdatae, crcrsv */
-    frame_bits += 2;
-
-    /* CRC */
-    frame_bits += 16;
-
-    /* calculate psd and masking curve before doing bit allocation */
-    bit_alloc_masking(s, encoded_exp, exp_strategy, psd, mask);
-
-    /* now the big work begins : do the bit allocation. Modify the snr
-       offset until we can pack everything in the requested frame size */
-
-    coarse_snr_offset = s->coarse_snr_offset;
-    while (coarse_snr_offset >= 0 &&
-           bit_alloc(s, mask, psd, bap, frame_bits, coarse_snr_offset, 0) < 0)
-        coarse_snr_offset -= SNR_INC1;
-    if (coarse_snr_offset < 0) {
-        av_log(NULL, AV_LOG_ERROR, "Bit allocation failed. Try increasing the bitrate.\n");
-        return -1;
-    }
-    while ((coarse_snr_offset + SNR_INC1) <= 63 &&
-           bit_alloc(s, mask, psd, bap1, frame_bits,
-                     coarse_snr_offset + SNR_INC1, 0) >= 0) {
-        coarse_snr_offset += SNR_INC1;
-        memcpy(bap, bap1, sizeof(bap1));
-    }
-    while ((coarse_snr_offset + 1) <= 63 &&
-           bit_alloc(s, mask, psd, bap1, frame_bits, coarse_snr_offset + 1, 0) >= 0) {
-        coarse_snr_offset++;
-        memcpy(bap, bap1, sizeof(bap1));
-    }
-
-    fine_snr_offset = 0;
-    while ((fine_snr_offset + SNR_INC1) <= 15 &&
-           bit_alloc(s, mask, psd, bap1, frame_bits,
-                     coarse_snr_offset, fine_snr_offset + SNR_INC1) >= 0) {
-        fine_snr_offset += SNR_INC1;
-        memcpy(bap, bap1, sizeof(bap1));
-    }
-    while ((fine_snr_offset + 1) <= 15 &&
-           bit_alloc(s, mask, psd, bap1, frame_bits,
-                     coarse_snr_offset, fine_snr_offset + 1) >= 0) {
-        fine_snr_offset++;
-        memcpy(bap, bap1, sizeof(bap1));
-    }
-
-    s->coarse_snr_offset = coarse_snr_offset;
-    for(ch=0;ch<s->nb_all_channels;ch++)
-        s->fine_snr_offset[ch] = fine_snr_offset;
-#if defined(DEBUG_BITALLOC)
-    {
-        int j;
-
-        for(i=0;i<6;i++) {
-            for(ch=0;ch<s->nb_all_channels;ch++) {
-                printf("Block #%d Ch%d:\n", i, ch);
-                printf("bap=");
-                for(j=0;j<s->nb_coefs[ch];j++) {
-                    printf("%d ",bap[i][ch][j]);
-                }
-                printf("\n");
-            }
-        }
-    }
-#endif
-    return 0;
-}
-
-static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
-                                    int64_t *channel_layout)
-{
-    int ch_layout;
-
-    if (channels < 1 || channels > AC3_MAX_CHANNELS)
-        return -1;
-    if ((uint64_t)*channel_layout > 0x7FF)
-        return -1;
-    ch_layout = *channel_layout;
-    if (!ch_layout)
-        ch_layout = avcodec_guess_channel_layout(channels, CODEC_ID_AC3, NULL);
-    if (avcodec_channel_layout_num_channels(ch_layout) != channels)
-        return -1;
-
-    s->lfe = !!(ch_layout & CH_LOW_FREQUENCY);
-    s->nb_all_channels = channels;
-    s->nb_channels = channels - s->lfe;
-    s->lfe_channel = s->lfe ? s->nb_channels : -1;
-    if (s->lfe)
-        ch_layout -= CH_LOW_FREQUENCY;
-
-    switch (ch_layout) {
-    case CH_LAYOUT_MONO:           s->channel_mode = AC3_CHMODE_MONO;   break;
-    case CH_LAYOUT_STEREO:         s->channel_mode = AC3_CHMODE_STEREO; break;
-    case CH_LAYOUT_SURROUND:       s->channel_mode = AC3_CHMODE_3F;     break;
-    case CH_LAYOUT_2_1:            s->channel_mode = AC3_CHMODE_2F1R;   break;
-    case CH_LAYOUT_4POINT0:        s->channel_mode = AC3_CHMODE_3F1R;   break;
-    case CH_LAYOUT_QUAD:
-    case CH_LAYOUT_2_2:            s->channel_mode = AC3_CHMODE_2F2R;   break;
-    case CH_LAYOUT_5POINT0:
-    case CH_LAYOUT_5POINT0_BACK:   s->channel_mode = AC3_CHMODE_3F2R;   break;
-    default:
-        return -1;
-    }
-
-    s->channel_map = ff_ac3_enc_channel_map[s->channel_mode][s->lfe];
-    *channel_layout = ch_layout;
-    if (s->lfe)
-        *channel_layout |= CH_LOW_FREQUENCY;
-
-    return 0;
-}
-
-static av_cold int AC3_encode_init(AVCodecContext *avctx)
-{
-    int freq = avctx->sample_rate;
-    int bitrate = avctx->bit_rate;
-    AC3EncodeContext *s = avctx->priv_data;
-    int i, j, ch;
-    float alpha;
-    int bw_code;
-
-    avctx->frame_size = AC3_FRAME_SIZE;
-
-    ac3_common_init();
-
-    if (!avctx->channel_layout) {
-        av_log(avctx, AV_LOG_WARNING, "No channel layout specified. The "
-                                      "encoder will guess the layout, but it "
-                                      "might be incorrect.\n");
-    }
-    if (set_channel_info(s, avctx->channels, &avctx->channel_layout)) {
-        av_log(avctx, AV_LOG_ERROR, "invalid channel layout\n");
-        return -1;
-    }
-
-    /* frequency */
-    for(i=0;i<3;i++) {
-        for(j=0;j<3;j++)
-            if ((ff_ac3_sample_rate_tab[j] >> i) == freq)
-                goto found;
-    }
-    return -1;
- found:
-    s->sample_rate = freq;
-    s->sr_shift = i;
-    s->sr_code = j;
-    s->bitstream_id = 8 + s->sr_shift;
-    s->bitstream_mode = 0; /* complete main audio service */
-
-    /* bitrate & frame size */
-    for(i=0;i<19;i++) {
-        if ((ff_ac3_bitrate_tab[i] >> s->sr_shift)*1000 == bitrate)
-            break;
-    }
-    if (i == 19)
-        return -1;
-    s->bit_rate = bitrate;
-    s->frame_size_code = i << 1;
-    s->frame_size_min = ff_ac3_frame_size_tab[s->frame_size_code][s->sr_code];
-    s->bits_written = 0;
-    s->samples_written = 0;
-    s->frame_size = s->frame_size_min;
-
-    /* bit allocation init */
-    if(avctx->cutoff) {
-        /* calculate bandwidth based on user-specified cutoff frequency */
-        int cutoff = av_clip(avctx->cutoff, 1, s->sample_rate >> 1);
-        int fbw_coeffs = cutoff * 512 / s->sample_rate;
-        bw_code = av_clip((fbw_coeffs - 73) / 3, 0, 60);
-    } else {
-        /* use default bandwidth setting */
-        /* XXX: should compute the bandwidth according to the frame
-           size, so that we avoid annoying high frequency artifacts */
-        bw_code = 50;
-    }
-    for(ch=0;ch<s->nb_channels;ch++) {
-        /* bandwidth for each channel */
-        s->chbwcod[ch] = bw_code;
-        s->nb_coefs[ch] = bw_code * 3 + 73;
-    }
-    if (s->lfe) {
-        s->nb_coefs[s->lfe_channel] = 7; /* fixed */
-    }
-    /* initial snr offset */
-    s->coarse_snr_offset = 40;
-
-    /* mdct init */
-    fft_init(MDCT_NBITS - 2);
-    for(i=0;i<N/4;i++) {
-        alpha = 2 * M_PI * (i + 1.0 / 8.0) / (float)N;
-        xcos1[i] = fix15(-cos(alpha));
-        xsin1[i] = fix15(-sin(alpha));
-    }
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    return 0;
-}
-
-/* output the AC-3 frame header */
-static void output_frame_header(AC3EncodeContext *s, unsigned char *frame)
-{
-    init_put_bits(&s->pb, frame, AC3_MAX_CODED_FRAME_SIZE);
-
-    put_bits(&s->pb, 16, 0x0b77); /* frame header */
-    put_bits(&s->pb, 16, 0); /* crc1: will be filled later */
-    put_bits(&s->pb, 2, s->sr_code);
-    put_bits(&s->pb, 6, s->frame_size_code + (s->frame_size - s->frame_size_min));
-    put_bits(&s->pb, 5, s->bitstream_id);
-    put_bits(&s->pb, 3, s->bitstream_mode);
-    put_bits(&s->pb, 3, s->channel_mode);
-    if ((s->channel_mode & 0x01) && s->channel_mode != AC3_CHMODE_MONO)
-        put_bits(&s->pb, 2, 1); /* XXX -4.5 dB */
-    if (s->channel_mode & 0x04)
-        put_bits(&s->pb, 2, 1); /* XXX -6 dB */
-    if (s->channel_mode == AC3_CHMODE_STEREO)
-        put_bits(&s->pb, 2, 0); /* surround not indicated */
-    put_bits(&s->pb, 1, s->lfe); /* LFE */
-    put_bits(&s->pb, 5, 31); /* dialog norm: -31 db */
-    put_bits(&s->pb, 1, 0); /* no compression control word */
-    put_bits(&s->pb, 1, 0); /* no lang code */
-    put_bits(&s->pb, 1, 0); /* no audio production info */
-    put_bits(&s->pb, 1, 0); /* no copyright */
-    put_bits(&s->pb, 1, 1); /* original bitstream */
-    put_bits(&s->pb, 1, 0); /* no time code 1 */
-    put_bits(&s->pb, 1, 0); /* no time code 2 */
-    put_bits(&s->pb, 1, 0); /* no additional bit stream info */
-}
-
-/* symetric quantization on 'levels' levels */
-static inline int sym_quant(int c, int e, int levels)
-{
-    int v;
-
-    if (c >= 0) {
-        v = (levels * (c << e)) >> 24;
-        v = (v + 1) >> 1;
-        v = (levels >> 1) + v;
-    } else {
-        v = (levels * ((-c) << e)) >> 24;
-        v = (v + 1) >> 1;
-        v = (levels >> 1) - v;
-    }
-    assert (v >= 0 && v < levels);
-    return v;
-}
-
-/* asymetric quantization on 2^qbits levels */
-static inline int asym_quant(int c, int e, int qbits)
-{
-    int lshift, m, v;
-
-    lshift = e + qbits - 24;
-    if (lshift >= 0)
-        v = c << lshift;
-    else
-        v = c >> (-lshift);
-    /* rounding */
-    v = (v + 1) >> 1;
-    m = (1 << (qbits-1));
-    if (v >= m)
-        v = m - 1;
-    assert(v >= -m);
-    return v & ((1 << qbits)-1);
-}
-
-/* Output one audio block. There are NB_BLOCKS audio blocks in one AC-3
-   frame */
-static void output_audio_block(AC3EncodeContext *s,
-                               uint8_t exp_strategy[AC3_MAX_CHANNELS],
-                               uint8_t encoded_exp[AC3_MAX_CHANNELS][N/2],
-                               uint8_t bap[AC3_MAX_CHANNELS][N/2],
-                               int32_t mdct_coefs[AC3_MAX_CHANNELS][N/2],
-                               int8_t global_exp[AC3_MAX_CHANNELS],
-                               int block_num)
-{
-    int ch, nb_groups, group_size, i, baie, rbnd;
-    uint8_t *p;
-    uint16_t qmant[AC3_MAX_CHANNELS][N/2];
-    int exp0, exp1;
-    int mant1_cnt, mant2_cnt, mant4_cnt;
-    uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr;
-    int delta0, delta1, delta2;
-
-    for(ch=0;ch<s->nb_channels;ch++)
-        put_bits(&s->pb, 1, 0); /* 512 point MDCT */
-    for(ch=0;ch<s->nb_channels;ch++)
-        put_bits(&s->pb, 1, 1); /* no dither */
-    put_bits(&s->pb, 1, 0); /* no dynamic range */
-    if (block_num == 0) {
-        /* for block 0, even if no coupling, we must say it. This is a
-           waste of bit :-) */
-        put_bits(&s->pb, 1, 1); /* coupling strategy present */
-        put_bits(&s->pb, 1, 0); /* no coupling strategy */
-    } else {
-        put_bits(&s->pb, 1, 0); /* no new coupling strategy */
-    }
-
-    if (s->channel_mode == AC3_CHMODE_STEREO)
-      {
-        if(block_num==0)
-          {
-            /* first block must define rematrixing (rematstr)  */
-            put_bits(&s->pb, 1, 1);
-
-            /* dummy rematrixing rematflg(1:4)=0 */
-            for (rbnd=0;rbnd<4;rbnd++)
-              put_bits(&s->pb, 1, 0);
-          }
-        else
-          {
-            /* no matrixing (but should be used in the future) */
-            put_bits(&s->pb, 1, 0);
-          }
-      }
-
-#if defined(DEBUG)
-    {
-      static int count = 0;
-      av_log(NULL, AV_LOG_DEBUG, "Block #%d (%d)\n", block_num, count++);
-    }
-#endif
-    /* exponent strategy */
-    for(ch=0;ch<s->nb_channels;ch++) {
-        put_bits(&s->pb, 2, exp_strategy[ch]);
-    }
-
-    if (s->lfe) {
-        put_bits(&s->pb, 1, exp_strategy[s->lfe_channel]);
-    }
-
-    for(ch=0;ch<s->nb_channels;ch++) {
-        if (exp_strategy[ch] != EXP_REUSE)
-            put_bits(&s->pb, 6, s->chbwcod[ch]);
-    }
-
-    /* exponents */
-    for (ch = 0; ch < s->nb_all_channels; ch++) {
-        switch(exp_strategy[ch]) {
-        case EXP_REUSE:
-            continue;
-        case EXP_D15:
-            group_size = 1;
-            break;
-        case EXP_D25:
-            group_size = 2;
-            break;
-        default:
-        case EXP_D45:
-            group_size = 4;
-            break;
-        }
-        nb_groups = (s->nb_coefs[ch] + (group_size * 3) - 4) / (3 * group_size);
-        p = encoded_exp[ch];
-
-        /* first exponent */
-        exp1 = *p++;
-        put_bits(&s->pb, 4, exp1);
-
-        /* next ones are delta encoded */
-        for(i=0;i<nb_groups;i++) {
-            /* merge three delta in one code */
-            exp0 = exp1;
-            exp1 = p[0];
-            p += group_size;
-            delta0 = exp1 - exp0 + 2;
-
-            exp0 = exp1;
-            exp1 = p[0];
-            p += group_size;
-            delta1 = exp1 - exp0 + 2;
-
-            exp0 = exp1;
-            exp1 = p[0];
-            p += group_size;
-            delta2 = exp1 - exp0 + 2;
-
-            put_bits(&s->pb, 7, ((delta0 * 5 + delta1) * 5) + delta2);
-        }
-
-        if (ch != s->lfe_channel)
-            put_bits(&s->pb, 2, 0); /* no gain range info */
-    }
-
-    /* bit allocation info */
-    baie = (block_num == 0);
-    put_bits(&s->pb, 1, baie);
-    if (baie) {
-        put_bits(&s->pb, 2, s->slow_decay_code);
-        put_bits(&s->pb, 2, s->fast_decay_code);
-        put_bits(&s->pb, 2, s->slow_gain_code);
-        put_bits(&s->pb, 2, s->db_per_bit_code);
-        put_bits(&s->pb, 3, s->floor_code);
-    }
-
-    /* snr offset */
-    put_bits(&s->pb, 1, baie); /* always present with bai */
-    if (baie) {
-        put_bits(&s->pb, 6, s->coarse_snr_offset);
-        for(ch=0;ch<s->nb_all_channels;ch++) {
-            put_bits(&s->pb, 4, s->fine_snr_offset[ch]);
-            put_bits(&s->pb, 3, s->fast_gain_code[ch]);
-        }
-    }
-
-    put_bits(&s->pb, 1, 0); /* no delta bit allocation */
-    put_bits(&s->pb, 1, 0); /* no data to skip */
-
-    /* mantissa encoding : we use two passes to handle the grouping. A
-       one pass method may be faster, but it would necessitate to
-       modify the output stream. */
-
-    /* first pass: quantize */
-    mant1_cnt = mant2_cnt = mant4_cnt = 0;
-    qmant1_ptr = qmant2_ptr = qmant4_ptr = NULL;
-
-    for (ch = 0; ch < s->nb_all_channels; ch++) {
-        int b, c, e, v;
-
-        for(i=0;i<s->nb_coefs[ch];i++) {
-            c = mdct_coefs[ch][i];
-            e = encoded_exp[ch][i] - global_exp[ch];
-            b = bap[ch][i];
-            switch(b) {
-            case 0:
-                v = 0;
-                break;
-            case 1:
-                v = sym_quant(c, e, 3);
-                switch(mant1_cnt) {
-                case 0:
-                    qmant1_ptr = &qmant[ch][i];
-                    v = 9 * v;
-                    mant1_cnt = 1;
-                    break;
-                case 1:
-                    *qmant1_ptr += 3 * v;
-                    mant1_cnt = 2;
-                    v = 128;
-                    break;
-                default:
-                    *qmant1_ptr += v;
-                    mant1_cnt = 0;
-                    v = 128;
-                    break;
-                }
-                break;
-            case 2:
-                v = sym_quant(c, e, 5);
-                switch(mant2_cnt) {
-                case 0:
-                    qmant2_ptr = &qmant[ch][i];
-                    v = 25 * v;
-                    mant2_cnt = 1;
-                    break;
-                case 1:
-                    *qmant2_ptr += 5 * v;
-                    mant2_cnt = 2;
-                    v = 128;
-                    break;
-                default:
-                    *qmant2_ptr += v;
-                    mant2_cnt = 0;
-                    v = 128;
-                    break;
-                }
-                break;
-            case 3:
-                v = sym_quant(c, e, 7);
-                break;
-            case 4:
-                v = sym_quant(c, e, 11);
-                switch(mant4_cnt) {
-                case 0:
-                    qmant4_ptr = &qmant[ch][i];
-                    v = 11 * v;
-                    mant4_cnt = 1;
-                    break;
-                default:
-                    *qmant4_ptr += v;
-                    mant4_cnt = 0;
-                    v = 128;
-                    break;
-                }
-                break;
-            case 5:
-                v = sym_quant(c, e, 15);
-                break;
-            case 14:
-                v = asym_quant(c, e, 14);
-                break;
-            case 15:
-                v = asym_quant(c, e, 16);
-                break;
-            default:
-                v = asym_quant(c, e, b - 1);
-                break;
-            }
-            qmant[ch][i] = v;
-        }
-    }
-
-    /* second pass : output the values */
-    for (ch = 0; ch < s->nb_all_channels; ch++) {
-        int b, q;
-
-        for(i=0;i<s->nb_coefs[ch];i++) {
-            q = qmant[ch][i];
-            b = bap[ch][i];
-            switch(b) {
-            case 0:
-                break;
-            case 1:
-                if (q != 128)
-                    put_bits(&s->pb, 5, q);
-                break;
-            case 2:
-                if (q != 128)
-                    put_bits(&s->pb, 7, q);
-                break;
-            case 3:
-                put_bits(&s->pb, 3, q);
-                break;
-            case 4:
-                if (q != 128)
-                    put_bits(&s->pb, 7, q);
-                break;
-            case 14:
-                put_bits(&s->pb, 14, q);
-                break;
-            case 15:
-                put_bits(&s->pb, 16, q);
-                break;
-            default:
-                put_bits(&s->pb, b - 1, q);
-                break;
-            }
-        }
-    }
-}
-
-#define CRC16_POLY ((1 << 0) | (1 << 2) | (1 << 15) | (1 << 16))
-
-static unsigned int mul_poly(unsigned int a, unsigned int b, unsigned int poly)
-{
-    unsigned int c;
-
-    c = 0;
-    while (a) {
-        if (a & 1)
-            c ^= b;
-        a = a >> 1;
-        b = b << 1;
-        if (b & (1 << 16))
-            b ^= poly;
-    }
-    return c;
-}
-
-static unsigned int pow_poly(unsigned int a, unsigned int n, unsigned int poly)
-{
-    unsigned int r;
-    r = 1;
-    while (n) {
-        if (n & 1)
-            r = mul_poly(r, a, poly);
-        a = mul_poly(a, a, poly);
-        n >>= 1;
-    }
-    return r;
-}
-
-
-/* compute log2(max(abs(tab[]))) */
-static int log2_tab(int16_t *tab, int n)
-{
-    int i, v;
-
-    v = 0;
-    for(i=0;i<n;i++) {
-        v |= abs(tab[i]);
-    }
-    return av_log2(v);
-}
-
-static void lshift_tab(int16_t *tab, int n, int lshift)
-{
-    int i;
-
-    if (lshift > 0) {
-        for(i=0;i<n;i++) {
-            tab[i] <<= lshift;
-        }
-    } else if (lshift < 0) {
-        lshift = -lshift;
-        for(i=0;i<n;i++) {
-            tab[i] >>= lshift;
-        }
-    }
-}
-
-/* fill the end of the frame and compute the two crcs */
-static int output_frame_end(AC3EncodeContext *s)
-{
-    int frame_size, frame_size_58, n, crc1, crc2, crc_inv;
-    uint8_t *frame;
-
-    frame_size = s->frame_size; /* frame size in words */
-    /* align to 8 bits */
-    flush_put_bits(&s->pb);
-    /* add zero bytes to reach the frame size */
-    frame = s->pb.buf;
-    n = 2 * s->frame_size - (put_bits_ptr(&s->pb) - frame) - 2;
-    assert(n >= 0);
-    if(n>0)
-      memset(put_bits_ptr(&s->pb), 0, n);
-
-    /* Now we must compute both crcs : this is not so easy for crc1
-       because it is at the beginning of the data... */
-    frame_size_58 = (frame_size >> 1) + (frame_size >> 3);
-    crc1 = bswap_16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0,
-                           frame + 4, 2 * frame_size_58 - 4));
-    /* XXX: could precompute crc_inv */
-    crc_inv = pow_poly((CRC16_POLY >> 1), (16 * frame_size_58) - 16, CRC16_POLY);
-    crc1 = mul_poly(crc_inv, crc1, CRC16_POLY);
-    AV_WB16(frame+2,crc1);
-
-    crc2 = bswap_16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0,
-                           frame + 2 * frame_size_58,
-                           (frame_size - frame_size_58) * 2 - 2));
-    AV_WB16(frame+2*frame_size-2,crc2);
-
-    //    printf("n=%d frame_size=%d\n", n, frame_size);
-    return frame_size * 2;
-}
-
-static int AC3_encode_frame(AVCodecContext *avctx,
-                            unsigned char *frame, int buf_size, void *data)
-{
-    AC3EncodeContext *s = avctx->priv_data;
-    int16_t *samples = data;
-    int i, j, k, v, ch;
-    int16_t input_samples[N];
-    int32_t mdct_coef[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
-    uint8_t exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
-    uint8_t exp_strategy[NB_BLOCKS][AC3_MAX_CHANNELS];
-    uint8_t encoded_exp[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
-    uint8_t bap[NB_BLOCKS][AC3_MAX_CHANNELS][N/2];
-    int8_t exp_samples[NB_BLOCKS][AC3_MAX_CHANNELS];
-    int frame_bits;
-
-    frame_bits = 0;
-    for(ch=0;ch<s->nb_all_channels;ch++) {
-        int ich = s->channel_map[ch];
-        /* fixed mdct to the six sub blocks & exponent computation */
-        for(i=0;i<NB_BLOCKS;i++) {
-            int16_t *sptr;
-            int sinc;
-
-            /* compute input samples */
-            memcpy(input_samples, s->last_samples[ich], N/2 * sizeof(int16_t));
-            sinc = s->nb_all_channels;
-            sptr = samples + (sinc * (N/2) * i) + ich;
-            for(j=0;j<N/2;j++) {
-                v = *sptr;
-                input_samples[j + N/2] = v;
-                s->last_samples[ich][j] = v;
-                sptr += sinc;
-            }
-
-            /* apply the MDCT window */
-            for(j=0;j<N/2;j++) {
-                input_samples[j] = MUL16(input_samples[j],
-                                         ff_ac3_window[j]) >> 15;
-                input_samples[N-j-1] = MUL16(input_samples[N-j-1],
-                                             ff_ac3_window[j]) >> 15;
-            }
-
-            /* Normalize the samples to use the maximum available
-               precision */
-            v = 14 - log2_tab(input_samples, N);
-            if (v < 0)
-                v = 0;
-            exp_samples[i][ch] = v - 9;
-            lshift_tab(input_samples, N, v);
-
-            /* do the MDCT */
-            mdct512(mdct_coef[i][ch], input_samples);
-
-            /* compute "exponents". We take into account the
-               normalization there */
-            for(j=0;j<N/2;j++) {
-                int e;
-                v = abs(mdct_coef[i][ch][j]);
-                if (v == 0)
-                    e = 24;
-                else {
-                    e = 23 - av_log2(v) + exp_samples[i][ch];
-                    if (e >= 24) {
-                        e = 24;
-                        mdct_coef[i][ch][j] = 0;
-                    }
-                }
-                exp[i][ch][j] = e;
-            }
-        }
-
-        compute_exp_strategy(exp_strategy, exp, ch, ch == s->lfe_channel);
-
-        /* compute the exponents as the decoder will see them. The
-           EXP_REUSE case must be handled carefully : we select the
-           min of the exponents */
-        i = 0;
-        while (i < NB_BLOCKS) {
-            j = i + 1;
-            while (j < NB_BLOCKS && exp_strategy[j][ch] == EXP_REUSE) {
-                exponent_min(exp[i][ch], exp[j][ch], s->nb_coefs[ch]);
-                j++;
-            }
-            frame_bits += encode_exp(encoded_exp[i][ch],
-                                     exp[i][ch], s->nb_coefs[ch],
-                                     exp_strategy[i][ch]);
-            /* copy encoded exponents for reuse case */
-            for(k=i+1;k<j;k++) {
-                memcpy(encoded_exp[k][ch], encoded_exp[i][ch],
-                       s->nb_coefs[ch] * sizeof(uint8_t));
-            }
-            i = j;
-        }
-    }
-
-    /* adjust for fractional frame sizes */
-    while(s->bits_written >= s->bit_rate && s->samples_written >= s->sample_rate) {
-        s->bits_written -= s->bit_rate;
-        s->samples_written -= s->sample_rate;
-    }
-    s->frame_size = s->frame_size_min + (s->bits_written * s->sample_rate < s->samples_written * s->bit_rate);
-    s->bits_written += s->frame_size * 16;
-    s->samples_written += AC3_FRAME_SIZE;
-
-    compute_bit_allocation(s, bap, encoded_exp, exp_strategy, frame_bits);
-    /* everything is known... let's output the frame */
-    output_frame_header(s, frame);
-
-    for(i=0;i<NB_BLOCKS;i++) {
-        output_audio_block(s, exp_strategy[i], encoded_exp[i],
-                           bap[i], mdct_coef[i], exp_samples[i], i);
-    }
-    return output_frame_end(s);
-}
-
-static av_cold int AC3_encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-    return 0;
-}
-
-#if 0
-/*************************************************************************/
-/* TEST */
-
-#undef random
-#define FN (N/4)
-
-void fft_test(void)
-{
-    IComplex in[FN], in1[FN];
-    int k, n, i;
-    float sum_re, sum_im, a;
-
-    /* FFT test */
-
-    for(i=0;i<FN;i++) {
-        in[i].re = random() % 65535 - 32767;
-        in[i].im = random() % 65535 - 32767;
-        in1[i] = in[i];
-    }
-    fft(in, 7);
-
-    /* do it by hand */
-    for(k=0;k<FN;k++) {
-        sum_re = 0;
-        sum_im = 0;
-        for(n=0;n<FN;n++) {
-            a = -2 * M_PI * (n * k) / FN;
-            sum_re += in1[n].re * cos(a) - in1[n].im * sin(a);
-            sum_im += in1[n].re * sin(a) + in1[n].im * cos(a);
-        }
-        printf("%3d: %6d,%6d %6.0f,%6.0f\n",
-               k, in[k].re, in[k].im, sum_re / FN, sum_im / FN);
-    }
-}
-
-void mdct_test(void)
-{
-    int16_t input[N];
-    int32_t output[N/2];
-    float input1[N];
-    float output1[N/2];
-    float s, a, err, e, emax;
-    int i, k, n;
-
-    for(i=0;i<N;i++) {
-        input[i] = (random() % 65535 - 32767) * 9 / 10;
-        input1[i] = input[i];
-    }
-
-    mdct512(output, input);
-
-    /* do it by hand */
-    for(k=0;k<N/2;k++) {
-        s = 0;
-        for(n=0;n<N;n++) {
-            a = (2*M_PI*(2*n+1+N/2)*(2*k+1) / (4 * N));
-            s += input1[n] * cos(a);
-        }
-        output1[k] = -2 * s / N;
-    }
-
-    err = 0;
-    emax = 0;
-    for(i=0;i<N/2;i++) {
-        printf("%3d: %7d %7.0f\n", i, output[i], output1[i]);
-        e = output[i] - output1[i];
-        if (e > emax)
-            emax = e;
-        err += e * e;
-    }
-    printf("err2=%f emax=%f\n", err / (N/2), emax);
-}
-
-void test_ac3(void)
-{
-    AC3EncodeContext ctx;
-    unsigned char frame[AC3_MAX_CODED_FRAME_SIZE];
-    short samples[AC3_FRAME_SIZE];
-    int ret, i;
-
-    AC3_encode_init(&ctx, 44100, 64000, 1);
-
-    fft_test();
-    mdct_test();
-
-    for(i=0;i<AC3_FRAME_SIZE;i++)
-        samples[i] = (int)(sin(2*M_PI*i*1000.0/44100) * 10000);
-    ret = AC3_encode_frame(&ctx, frame, samples);
-    printf("ret=%d\n", ret);
-}
-#endif
-
-AVCodec ac3_encoder = {
-    "ac3",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AC3,
-    sizeof(AC3EncodeContext),
-    AC3_encode_init,
-    AC3_encode_frame,
-    AC3_encode_close,
-    NULL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
-    .channel_layouts = (const int64_t[]){
-        CH_LAYOUT_MONO,
-        CH_LAYOUT_STEREO,
-        CH_LAYOUT_2_1,
-        CH_LAYOUT_SURROUND,
-        CH_LAYOUT_2_2,
-        CH_LAYOUT_QUAD,
-        CH_LAYOUT_4POINT0,
-        CH_LAYOUT_5POINT0,
-        CH_LAYOUT_5POINT0_BACK,
-       (CH_LAYOUT_MONO     | CH_LOW_FREQUENCY),
-       (CH_LAYOUT_STEREO   | CH_LOW_FREQUENCY),
-       (CH_LAYOUT_2_1      | CH_LOW_FREQUENCY),
-       (CH_LAYOUT_SURROUND | CH_LOW_FREQUENCY),
-       (CH_LAYOUT_2_2      | CH_LOW_FREQUENCY),
-       (CH_LAYOUT_QUAD     | CH_LOW_FREQUENCY),
-       (CH_LAYOUT_4POINT0  | CH_LOW_FREQUENCY),
-        CH_LAYOUT_5POINT1,
-        CH_LAYOUT_5POINT1_BACK,
-        0 },
-};
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
deleted file mode 100644
index 4f28fb3..0000000
--- a/libavcodec/ac3tab.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * AC-3 tables
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * tables taken directly from the AC-3 spec.
- */
-
-#include "avcodec.h"
-#include "ac3tab.h"
-
-/**
- * Possible frame sizes.
- * from ATSC A/52 Table 5.18 Frame Size Code Table.
- */
-const uint16_t ff_ac3_frame_size_tab[38][3] = {
-    { 64,   69,   96   },
-    { 64,   70,   96   },
-    { 80,   87,   120  },
-    { 80,   88,   120  },
-    { 96,   104,  144  },
-    { 96,   105,  144  },
-    { 112,  121,  168  },
-    { 112,  122,  168  },
-    { 128,  139,  192  },
-    { 128,  140,  192  },
-    { 160,  174,  240  },
-    { 160,  175,  240  },
-    { 192,  208,  288  },
-    { 192,  209,  288  },
-    { 224,  243,  336  },
-    { 224,  244,  336  },
-    { 256,  278,  384  },
-    { 256,  279,  384  },
-    { 320,  348,  480  },
-    { 320,  349,  480  },
-    { 384,  417,  576  },
-    { 384,  418,  576  },
-    { 448,  487,  672  },
-    { 448,  488,  672  },
-    { 512,  557,  768  },
-    { 512,  558,  768  },
-    { 640,  696,  960  },
-    { 640,  697,  960  },
-    { 768,  835,  1152 },
-    { 768,  836,  1152 },
-    { 896,  975,  1344 },
-    { 896,  976,  1344 },
-    { 1024, 1114, 1536 },
-    { 1024, 1115, 1536 },
-    { 1152, 1253, 1728 },
-    { 1152, 1254, 1728 },
-    { 1280, 1393, 1920 },
-    { 1280, 1394, 1920 },
-};
-
-/**
- * Maps audio coding mode (acmod) to number of full-bandwidth channels.
- * from ATSC A/52 Table 5.8 Audio Coding Mode
- */
-const uint8_t ff_ac3_channels_tab[8] = {
-    2, 1, 2, 3, 3, 4, 4, 5
-};
-
-/**
- * Maps audio coding mode (acmod) to channel layout mask.
- */
-const uint16_t ff_ac3_channel_layout_tab[8] = {
-    CH_LAYOUT_STEREO,
-    CH_LAYOUT_MONO,
-    CH_LAYOUT_STEREO,
-    CH_LAYOUT_SURROUND,
-    CH_LAYOUT_2_1,
-    CH_LAYOUT_4POINT0,
-    CH_LAYOUT_2_2,
-    CH_LAYOUT_5POINT0
-};
-
-#define COMMON_CHANNEL_MAP \
-    { { 0, 1,          }, { 0, 1, 2,         } },\
-    { { 0,             }, { 0, 1,            } },\
-    { { 0, 1,          }, { 0, 1, 2,         } },\
-    { { 0, 2, 1,       }, { 0, 2, 1, 3,      } },\
-    { { 0, 1, 2,       }, { 0, 1, 3, 2,      } },\
-    { { 0, 2, 1, 3,    }, { 0, 2, 1, 4, 3,   } },
-
-/**
- * Table to remap channels from SMPTE order to AC-3 order.
- * [channel_mode][lfe][ch]
- */
-const uint8_t ff_ac3_enc_channel_map[8][2][6] = {
-    COMMON_CHANNEL_MAP
-    { { 0, 1, 2, 3,    }, { 0, 1, 3, 4, 2,   } },
-    { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 4, 5, 3 } },
-};
-
-/**
- * Table to remap channels from from AC-3 order to SMPTE order.
- * [channel_mode][lfe][ch]
- */
-const uint8_t ff_ac3_dec_channel_map[8][2][6] = {
-    COMMON_CHANNEL_MAP
-    { { 0, 1, 2, 3,    }, { 0, 1, 4, 2, 3,   } },
-    { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 5, 3, 4 } },
-};
-
-/* possible frequencies */
-const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };
-
-/* possible bitrates */
-const uint16_t ff_ac3_bitrate_tab[19] = {
-    32, 40, 48, 56, 64, 80, 96, 112, 128,
-    160, 192, 224, 256, 320, 384, 448, 512, 576, 640
-};
-
-/* AC-3 MDCT window */
-
-/* MDCT window */
-const int16_t ff_ac3_window[256] = {
-    4,    7,   12,   16,   21,   28,   34,   42,
-   51,   61,   72,   84,   97,  111,  127,  145,
-  164,  184,  207,  231,  257,  285,  315,  347,
-  382,  419,  458,  500,  544,  591,  641,  694,
-  750,  810,  872,  937, 1007, 1079, 1155, 1235,
- 1318, 1406, 1497, 1593, 1692, 1796, 1903, 2016,
- 2132, 2253, 2379, 2509, 2644, 2783, 2927, 3076,
- 3230, 3389, 3552, 3721, 3894, 4072, 4255, 4444,
- 4637, 4835, 5038, 5246, 5459, 5677, 5899, 6127,
- 6359, 6596, 6837, 7083, 7334, 7589, 7848, 8112,
- 8380, 8652, 8927, 9207, 9491, 9778,10069,10363,
-10660,10960,11264,11570,11879,12190,12504,12820,
-13138,13458,13780,14103,14427,14753,15079,15407,
-15735,16063,16392,16720,17049,17377,17705,18032,
-18358,18683,19007,19330,19651,19970,20287,20602,
-20914,21225,21532,21837,22139,22438,22733,23025,
-23314,23599,23880,24157,24430,24699,24964,25225,
-25481,25732,25979,26221,26459,26691,26919,27142,
-27359,27572,27780,27983,28180,28373,28560,28742,
-28919,29091,29258,29420,29577,29729,29876,30018,
-30155,30288,30415,30538,30657,30771,30880,30985,
-31086,31182,31274,31363,31447,31528,31605,31678,
-31747,31814,31877,31936,31993,32046,32097,32145,
-32190,32232,32272,32310,32345,32378,32409,32438,
-32465,32490,32513,32535,32556,32574,32592,32608,
-32623,32636,32649,32661,32671,32681,32690,32698,
-32705,32712,32718,32724,32729,32733,32737,32741,
-32744,32747,32750,32752,32754,32756,32757,32759,
-32760,32761,32762,32763,32764,32764,32765,32765,
-32766,32766,32766,32766,32767,32767,32767,32767,
-32767,32767,32767,32767,32767,32767,32767,32767,
-32767,32767,32767,32767,32767,32767,32767,32767,
-};
-
-const uint8_t ff_ac3_log_add_tab[260]= {
-0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,
-0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f,
-0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27,
-0x26,0x26,0x25,0x24,0x24,0x23,0x23,0x22,0x21,0x21,
-0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b,
-0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18,0x17,0x17,0x16,
-0x16,0x15,0x15,0x15,0x14,0x14,0x13,0x13,0x13,0x12,
-0x12,0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f,0x0f,
-0x0f,0x0e,0x0e,0x0e,0x0d,0x0d,0x0d,0x0d,0x0c,0x0c,
-0x0c,0x0c,0x0b,0x0b,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a,
-0x0a,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08,
-0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x06,
-0x06,0x06,0x06,0x06,0x06,0x06,0x05,0x05,0x05,0x05,
-0x05,0x05,0x05,0x05,0x04,0x04,0x04,0x04,0x04,0x04,
-0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,
-0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02,
-0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
-0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-
-const uint16_t ff_ac3_hearing_threshold_tab[50][3]= {
-{ 0x04d0,0x04f0,0x0580 },
-{ 0x04d0,0x04f0,0x0580 },
-{ 0x0440,0x0460,0x04b0 },
-{ 0x0400,0x0410,0x0450 },
-{ 0x03e0,0x03e0,0x0420 },
-{ 0x03c0,0x03d0,0x03f0 },
-{ 0x03b0,0x03c0,0x03e0 },
-{ 0x03b0,0x03b0,0x03d0 },
-{ 0x03a0,0x03b0,0x03c0 },
-{ 0x03a0,0x03a0,0x03b0 },
-{ 0x03a0,0x03a0,0x03b0 },
-{ 0x03a0,0x03a0,0x03b0 },
-{ 0x03a0,0x03a0,0x03a0 },
-{ 0x0390,0x03a0,0x03a0 },
-{ 0x0390,0x0390,0x03a0 },
-{ 0x0390,0x0390,0x03a0 },
-{ 0x0380,0x0390,0x03a0 },
-{ 0x0380,0x0380,0x03a0 },
-{ 0x0370,0x0380,0x03a0 },
-{ 0x0370,0x0380,0x03a0 },
-{ 0x0360,0x0370,0x0390 },
-{ 0x0360,0x0370,0x0390 },
-{ 0x0350,0x0360,0x0390 },
-{ 0x0350,0x0360,0x0390 },
-{ 0x0340,0x0350,0x0380 },
-{ 0x0340,0x0350,0x0380 },
-{ 0x0330,0x0340,0x0380 },
-{ 0x0320,0x0340,0x0370 },
-{ 0x0310,0x0320,0x0360 },
-{ 0x0300,0x0310,0x0350 },
-{ 0x02f0,0x0300,0x0340 },
-{ 0x02f0,0x02f0,0x0330 },
-{ 0x02f0,0x02f0,0x0320 },
-{ 0x02f0,0x02f0,0x0310 },
-{ 0x0300,0x02f0,0x0300 },
-{ 0x0310,0x0300,0x02f0 },
-{ 0x0340,0x0320,0x02f0 },
-{ 0x0390,0x0350,0x02f0 },
-{ 0x03e0,0x0390,0x0300 },
-{ 0x0420,0x03e0,0x0310 },
-{ 0x0460,0x0420,0x0330 },
-{ 0x0490,0x0450,0x0350 },
-{ 0x04a0,0x04a0,0x03c0 },
-{ 0x0460,0x0490,0x0410 },
-{ 0x0440,0x0460,0x0470 },
-{ 0x0440,0x0440,0x04a0 },
-{ 0x0520,0x0480,0x0460 },
-{ 0x0800,0x0630,0x0440 },
-{ 0x0840,0x0840,0x0450 },
-{ 0x0840,0x0840,0x04e0 },
-};
-
-const uint8_t ff_ac3_bap_tab[64]= {
-    0, 1, 1, 1, 1, 1, 2, 2, 3, 3,
-    3, 4, 4, 5, 5, 6, 6, 6, 6, 7,
-    7, 7, 7, 8, 8, 8, 8, 9, 9, 9,
-    9, 10, 10, 10, 10, 11, 11, 11, 11, 12,
-    12, 12, 12, 13, 13, 13, 13, 14, 14, 14,
-    14, 14, 14, 14, 14, 15, 15, 15, 15, 15,
-    15, 15, 15, 15,
-};
-
-const uint8_t ff_ac3_slow_decay_tab[4]={
-    0x0f, 0x11, 0x13, 0x15,
-};
-
-const uint8_t ff_ac3_fast_decay_tab[4]={
-    0x3f, 0x53, 0x67, 0x7b,
-};
-
-const uint16_t ff_ac3_slow_gain_tab[4]= {
-    0x540, 0x4d8, 0x478, 0x410,
-};
-
-const uint16_t ff_ac3_db_per_bit_tab[4]= {
-    0x000, 0x700, 0x900, 0xb00,
-};
-
-const int16_t ff_ac3_floor_tab[8]= {
-    0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800,
-};
-
-const uint16_t ff_ac3_fast_gain_tab[8]= {
-    0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400,
-};
-
-const uint8_t ff_ac3_critical_band_size_tab[50]={
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
-    3, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 24, 24, 24, 24, 24
-};
-/**
- * Default channel map for a dependent substream defined by acmod
- */
-const uint16_t ff_eac3_default_chmap[8] = {
-    AC3_CHMAP_L |               AC3_CHMAP_R, // FIXME Ch1+Ch2
-                  AC3_CHMAP_C,
-    AC3_CHMAP_L |               AC3_CHMAP_R,
-    AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R,
-    AC3_CHMAP_L |               AC3_CHMAP_R |                   AC3_CHMAP_C_SUR,
-    AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R |                   AC3_CHMAP_C_SUR,
-    AC3_CHMAP_L |               AC3_CHMAP_R | AC3_CHMAP_L_SUR |                  AC3_CHMAP_R_SUR,
-    AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R | AC3_CHMAP_L_SUR |                  AC3_CHMAP_R_SUR
-};
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
deleted file mode 100644
index b5c2b77..0000000
--- a/libavcodec/ac3tab.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * AC-3 tables
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AC3TAB_H
-#define AVCODEC_AC3TAB_H
-
-#include "libavutil/common.h"
-
-extern const uint16_t ff_ac3_frame_size_tab[38][3];
-extern const uint8_t  ff_ac3_channels_tab[8];
-extern const uint16_t ff_ac3_channel_layout_tab[8];
-extern const uint8_t  ff_ac3_enc_channel_map[8][2][6];
-extern const uint8_t  ff_ac3_dec_channel_map[8][2][6];
-extern const uint16_t ff_ac3_sample_rate_tab[3];
-extern const uint16_t ff_ac3_bitrate_tab[19];
-extern const int16_t  ff_ac3_window[256];
-extern const uint8_t  ff_ac3_log_add_tab[260];
-extern const uint16_t ff_ac3_hearing_threshold_tab[50][3];
-extern const uint8_t  ff_ac3_bap_tab[64];
-extern const uint8_t  ff_ac3_slow_decay_tab[4];
-extern const uint8_t  ff_ac3_fast_decay_tab[4];
-extern const uint16_t ff_ac3_slow_gain_tab[4];
-extern const uint16_t ff_ac3_db_per_bit_tab[4];
-extern const int16_t  ff_ac3_floor_tab[8];
-extern const uint16_t ff_ac3_fast_gain_tab[8];
-extern const uint8_t  ff_ac3_critical_band_size_tab[50];
-extern const uint16_t ff_eac3_default_chmap[8];
-
-/** Custom channel map locations bitmask
- *  Other channels described in documentation:
- *      Lc/Rc pair, Lrs/Rrs pair, Ts, Lsd/Rsd pair,
- *      Lw/Rw pair, Lvh/Rvh pair, Cvh, Reserved, LFE2
- */
-enum CustomChannelMapLocation{
-    AC3_CHMAP_L=        1<<(15-0),
-    AC3_CHMAP_C=        1<<(15-1),
-    AC3_CHMAP_R=        1<<(15-2),
-    AC3_CHMAP_L_SUR=    1<<(15-3),
-    AC3_CHMAP_R_SUR =   1<<(15-4),
-    AC3_CHMAP_C_SUR=    1<<(15-7),
-    AC3_CHMAP_LFE =     1<<(15-15)
-};
-
-#endif /* AVCODEC_AC3TAB_H */
diff --git a/libavcodec/acelp_filters.c b/libavcodec/acelp_filters.c
deleted file mode 100644
index 31f0e86..0000000
--- a/libavcodec/acelp_filters.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * various filters for ACELP-based codecs
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-
-#include "avcodec.h"
-#include "acelp_filters.h"
-
-const int16_t ff_acelp_interp_filter[61] = { /* (0.15) */
-  29443, 28346, 25207, 20449, 14701,  8693,
-   3143, -1352, -4402, -5865, -5850, -4673,
-  -2783,  -672,  1211,  2536,  3130,  2991,
-   2259,  1170,     0, -1001, -1652, -1868,
-  -1666, -1147,  -464,   218,   756,  1060,
-   1099,   904,   550,   135,  -245,  -514,
-   -634,  -602,  -451,  -231,     0,   191,
-    308,   340,   296,   198,    78,   -36,
-   -120,  -163,  -165,  -132,   -79,   -19,
-     34,    73,    91,    89,    70,    38,
-      0,
-};
-
-void ff_acelp_interpolate(int16_t* out, const int16_t* in,
-                          const int16_t* filter_coeffs, int precision,
-                          int frac_pos, int filter_length, int length)
-{
-    int n, i;
-
-    assert(frac_pos >= 0 && frac_pos < precision);
-
-    for (n = 0; n < length; n++) {
-        int idx = 0;
-        int v = 0x4000;
-
-        for (i = 0; i < filter_length;) {
-
-            /* The reference G.729 and AMR fixed point code performs clipping after
-               each of the two following accumulations.
-               Since clipping affects only the synthetic OVERFLOW test without
-               causing an int type overflow, it was moved outside the loop. */
-
-            /*  R(x):=ac_v[-k+x]
-                v += R(n-i)*ff_acelp_interp_filter(t+6i)
-                v += R(n+i+1)*ff_acelp_interp_filter(6-t+6i) */
-
-            v += in[n + i] * filter_coeffs[idx + frac_pos];
-            idx += precision;
-            i++;
-            v += in[n - i] * filter_coeffs[idx - frac_pos];
-        }
-        if (av_clip_int16(v >> 15) != (v >> 15))
-            av_log(NULL, AV_LOG_WARNING, "overflow that would need cliping in ff_acelp_interpolate()\n");
-        out[n] = v >> 15;
-    }
-}
-
-void ff_acelp_interpolatef(float *out, const float *in,
-                           const float *filter_coeffs, int precision,
-                           int frac_pos, int filter_length, int length)
-{
-    int n, i;
-
-    for (n = 0; n < length; n++) {
-        int idx = 0;
-        float v = 0;
-
-        for (i = 0; i < filter_length;) {
-            v += in[n + i] * filter_coeffs[idx + frac_pos];
-            idx += precision;
-            i++;
-            v += in[n - i] * filter_coeffs[idx - frac_pos];
-        }
-        out[n] = v;
-    }
-}
-
-
-void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2],
-                               const int16_t* in, int length)
-{
-    int i;
-    int tmp;
-
-    for (i = 0; i < length; i++) {
-        tmp  = (hpf_f[0]* 15836LL) >> 13;
-        tmp += (hpf_f[1]* -7667LL) >> 13;
-        tmp += 7699 * (in[i] - 2*in[i-1] + in[i-2]);
-
-        /* With "+0x800" rounding, clipping is needed
-           for ALGTHM and SPEECH tests. */
-        out[i] = av_clip_int16((tmp + 0x800) >> 12);
-
-        hpf_f[1] = hpf_f[0];
-        hpf_f[0] = tmp;
-    }
-}
-
-void ff_acelp_apply_order_2_transfer_function(float *out, const float *in,
-                                              const float zero_coeffs[2],
-                                              const float pole_coeffs[2],
-                                              float gain, float mem[2], int n)
-{
-    int i;
-    float tmp;
-
-    for (i = 0; i < n; i++) {
-        tmp = gain * in[i] - pole_coeffs[0] * mem[0] - pole_coeffs[1] * mem[1];
-        out[i] =       tmp + zero_coeffs[0] * mem[0] + zero_coeffs[1] * mem[1];
-
-        mem[1] = mem[0];
-        mem[0] = tmp;
-    }
-}
-
-void ff_tilt_compensation(float *mem, float tilt, float *samples, int size)
-{
-    float new_tilt_mem = samples[size - 1];
-    int i;
-
-    for (i = size - 1; i > 0; i--)
-        samples[i] -= tilt * samples[i - 1];
-
-    samples[0] -= tilt * *mem;
-    *mem = new_tilt_mem;
-}
-
diff --git a/libavcodec/acelp_filters.h b/libavcodec/acelp_filters.h
deleted file mode 100644
index 09b5da4..0000000
--- a/libavcodec/acelp_filters.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * various filters for ACELP-based codecs
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ACELP_FILTERS_H
-#define AVCODEC_ACELP_FILTERS_H
-
-#include <stdint.h>
-
-/**
- * low-pass Finite Impulse Response filter coefficients.
- *
- * Hamming windowed sinc filter with cutoff freq 3/40 of the sampling freq,
- * the coefficients are scaled by 2^15.
- * This array only contains the right half of the filter.
- * This filter is likely identical to the one used in G.729, though this
- * could not be determined from the original comments with certainity.
- */
-extern const int16_t ff_acelp_interp_filter[61];
-
-/**
- * Generic FIR interpolation routine.
- * @param out [out] buffer for interpolated data
- * @param in input data
- * @param filter_coeffs interpolation filter coefficients (0.15)
- * @param precision sub sample factor, that is the precision of the position
- * @param frac_pos fractional part of position [0..precision-1]
- * @param filter_length filter length
- * @param length length of output
- *
- * filter_coeffs contains coefficients of the right half of the symmetric
- * interpolation filter. filter_coeffs[0] should the central (unpaired) coefficient.
- * See ff_acelp_interp_filter for an example.
- *
- */
-void ff_acelp_interpolate(int16_t* out, const int16_t* in,
-                          const int16_t* filter_coeffs, int precision,
-                          int frac_pos, int filter_length, int length);
-
-/**
- * Floating point version of ff_acelp_interpolate()
- */
-void ff_acelp_interpolatef(float *out, const float *in,
-                           const float *filter_coeffs, int precision,
-                           int frac_pos, int filter_length, int length);
-
-
-/**
- * high-pass filtering and upscaling (4.2.5 of G.729).
- * @param out [out] output buffer for filtered speech data
- * @param hpf_f [in/out] past filtered data from previous (2 items long)
- *                       frames (-0x20000000 <= (14.13) < 0x20000000)
- * @param in speech data to process
- * @param length input data size
- *
- * out[i] = 0.93980581 * in[i] - 1.8795834 * in[i-1] + 0.93980581 * in[i-2] +
- *          1.9330735 * out[i-1] - 0.93589199 * out[i-2]
- *
- * The filter has a cut-off frequency of 1/80 of the sampling freq
- *
- * @note Two items before the top of the out buffer must contain two items from the
- *       tail of the previous subframe.
- *
- * @remark It is safe to pass the same array in in and out parameters.
- *
- * @remark AMR uses mostly the same filter (cut-off frequency 60Hz, same formula,
- *         but constants differs in 5th sign after comma). Fortunately in
- *         fixed-point all coefficients are the same as in G.729. Thus this
- *         routine can be used for the fixed-point AMR decoder, too.
- */
-void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2],
-                               const int16_t* in, int length);
-
-/**
- * Apply an order 2 rational transfer function in-place.
- *
- * @param out output buffer for filtered speech samples
- * @param in input buffer containing speech data (may be the same as out)
- * @param zero_coeffs z^-1 and z^-2 coefficients of the numerator
- * @param pole_coeffs z^-1 and z^-2 coefficients of the denominator
- * @param gain scale factor for final output
- * @param mem intermediate values used by filter (should be 0 initially)
- * @param n number of samples
- */
-void ff_acelp_apply_order_2_transfer_function(float *out, const float *in,
-                                              const float zero_coeffs[2],
-                                              const float pole_coeffs[2],
-                                              float gain,
-                                              float mem[2], int n);
-
-/**
- * Apply tilt compensation filter, 1 - tilt * z-1.
- *
- * @param mem pointer to the filter's state (one single float)
- * @param tilt tilt factor
- * @param samples array where the filter is applied
- * @param size the size of the samples array
- */
-void ff_tilt_compensation(float *mem, float tilt, float *samples, int size);
-
-
-#endif /* AVCODEC_ACELP_FILTERS_H */
diff --git a/libavcodec/acelp_pitch_delay.c b/libavcodec/acelp_pitch_delay.c
deleted file mode 100644
index cddf726..0000000
--- a/libavcodec/acelp_pitch_delay.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * gain code, gain pitch and pitch delay decoding
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "acelp_pitch_delay.h"
-#include "celp_math.h"
-
-int ff_acelp_decode_8bit_to_1st_delay3(int ac_index)
-{
-    ac_index += 58;
-    if(ac_index > 254)
-        ac_index = 3 * ac_index - 510;
-    return ac_index;
-}
-
-int ff_acelp_decode_4bit_to_2nd_delay3(
-        int ac_index,
-        int pitch_delay_min)
-{
-    if(ac_index < 4)
-        return 3 * (ac_index + pitch_delay_min);
-    else if(ac_index < 12)
-        return 3 * pitch_delay_min + ac_index + 6;
-    else
-        return 3 * (ac_index + pitch_delay_min) - 18;
-}
-
-int ff_acelp_decode_5_6_bit_to_2nd_delay3(
-        int ac_index,
-        int pitch_delay_min)
-{
-        return 3 * pitch_delay_min + ac_index - 2;
-}
-
-int ff_acelp_decode_9bit_to_1st_delay6(int ac_index)
-{
-    if(ac_index < 463)
-        return ac_index + 105;
-    else
-        return 6 * (ac_index - 368);
-}
-int ff_acelp_decode_6bit_to_2nd_delay6(
-        int ac_index,
-        int pitch_delay_min)
-{
-    return 6 * pitch_delay_min + ac_index - 3;
-}
-
-void ff_acelp_update_past_gain(
-    int16_t* quant_energy,
-    int gain_corr_factor,
-    int log2_ma_pred_order,
-    int erasure)
-{
-    int i;
-    int avg_gain=quant_energy[(1 << log2_ma_pred_order) - 1]; // (5.10)
-
-    for(i=(1 << log2_ma_pred_order) - 1; i>0; i--)
-    {
-        avg_gain       += quant_energy[i-1];
-        quant_energy[i] = quant_energy[i-1];
-    }
-
-    if(erasure)
-        quant_energy[0] = FFMAX(avg_gain >> log2_ma_pred_order, -10240) - 4096; // -10 and -4 in (5.10)
-    else
-        quant_energy[0] = (6165 * ((ff_log2(gain_corr_factor) >> 2) - (13 << 13))) >> 13;
-}
-
-int16_t ff_acelp_decode_gain_code(
-    DSPContext *dsp,
-    int gain_corr_factor,
-    const int16_t* fc_v,
-    int mr_energy,
-    const int16_t* quant_energy,
-    const int16_t* ma_prediction_coeff,
-    int subframe_size,
-    int ma_pred_order)
-{
-    int i;
-
-    mr_energy <<= 10;
-
-    for(i=0; i<ma_pred_order; i++)
-        mr_energy += quant_energy[i] * ma_prediction_coeff[i];
-
-#ifdef G729_BITEXACT
-    mr_energy += (((-6165LL * ff_log2(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0))) >> 3) & ~0x3ff);
-
-    mr_energy = (5439 * (mr_energy >> 15)) >> 8;           // (0.15) = (0.15) * (7.23)
-
-    return bidir_sal(
-               ((ff_exp2(mr_energy & 0x7fff) + 16) >> 5) * (gain_corr_factor >> 1),
-               (mr_energy >> 15) - 25
-           );
-#else
-    mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) /
-                sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0));
-    return mr_energy >> 12;
-#endif
-}
-
-float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy,
-                            float *prediction_error, float energy_mean,
-                            const float *pred_table)
-{
-    // Equations 66-69:
-    // ^g_c = ^gamma_gc * 100.05 (predicted dB + mean dB - dB of fixed vector)
-    // Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)).
-    float val = fixed_gain_factor *
-        exp2f(M_LOG2_10 * 0.05 *
-              (ff_dot_productf(pred_table, prediction_error, 4) +
-               energy_mean)) /
-        sqrtf(fixed_mean_energy);
-
-    // update quantified prediction error energy history
-    memmove(&prediction_error[0], &prediction_error[1],
-            3 * sizeof(prediction_error[0]));
-    prediction_error[3] = 20.0 * log10f(fixed_gain_factor);
-
-    return val;
-}
-
-void ff_decode_pitch_lag(int *lag_int, int *lag_frac, int pitch_index,
-                         const int prev_lag_int, const int subframe,
-                         int third_as_first, int resolution)
-{
-    /* Note n * 10923 >> 15 is floor(x/3) for 0 <= n <= 32767 */
-    if (subframe == 0 || (subframe == 2 && third_as_first)) {
-
-        if (pitch_index < 197)
-            pitch_index += 59;
-        else
-            pitch_index = 3 * pitch_index - 335;
-
-    } else {
-        if (resolution == 4) {
-            int search_range_min = av_clip(prev_lag_int - 5, PITCH_DELAY_MIN,
-                                           PITCH_DELAY_MAX - 9);
-
-            // decoding with 4-bit resolution
-            if (pitch_index < 4) {
-                // integer only precision for [search_range_min, search_range_min+3]
-                pitch_index = 3 * (pitch_index + search_range_min) + 1;
-            } else if (pitch_index < 12) {
-                // 1/3 fractional precision for [search_range_min+3 1/3, search_range_min+5 2/3]
-                pitch_index += 3 * search_range_min + 7;
-            } else {
-                // integer only precision for [search_range_min+6, search_range_min+9]
-                pitch_index = 3 * (pitch_index + search_range_min - 6) + 1;
-            }
-        } else {
-            // decoding with 5 or 6 bit resolution, 1/3 fractional precision
-            pitch_index--;
-
-            if (resolution == 5) {
-                pitch_index += 3 * av_clip(prev_lag_int - 10, PITCH_DELAY_MIN,
-                                           PITCH_DELAY_MAX - 19);
-            } else
-                pitch_index += 3 * av_clip(prev_lag_int - 5, PITCH_DELAY_MIN,
-                                           PITCH_DELAY_MAX - 9);
-        }
-    }
-    *lag_int  = pitch_index * 10923 >> 15;
-    *lag_frac = pitch_index - 3 * *lag_int - 1;
-}
diff --git a/libavcodec/acelp_pitch_delay.h b/libavcodec/acelp_pitch_delay.h
deleted file mode 100644
index 2413145..0000000
--- a/libavcodec/acelp_pitch_delay.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * gain code, gain pitch and pitch delay decoding
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ACELP_PITCH_DELAY_H
-#define AVCODEC_ACELP_PITCH_DELAY_H
-
-#include <stdint.h>
-#include "dsputil.h"
-
-#define PITCH_DELAY_MIN             20
-#define PITCH_DELAY_MAX             143
-
-/**
- * \brief Decode pitch delay of the first subframe encoded by 8 bits with 1/3
- *        resolution.
- * \param ac_index adaptive codebook index (8 bits)
- *
- * \return pitch delay in 1/3 units
- *
- * Pitch delay is coded:
- *    with 1/3 resolution, 19  < pitch_delay <  85
- *    integers only,       85 <= pitch_delay <= 143
- */
-int ff_acelp_decode_8bit_to_1st_delay3(int ac_index);
-
-/**
- * \brief Decode pitch delay of the second subframe encoded by 5 or 6 bits
- *        with 1/3 precision.
- * \param ac_index adaptive codebook index (5 or 6 bits)
- * \param pitch_delay_min lower bound (integer) of pitch delay interval
- *                      for second subframe
- *
- * \return pitch delay in 1/3 units
- *
- * Pitch delay is coded:
- *    with 1/3 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5
- *
- * \remark The routine is used in G.729 @8k, AMR @10.2k, AMR @7.95k,
- *         AMR @7.4k for the second subframe.
- */
-int ff_acelp_decode_5_6_bit_to_2nd_delay3(
-        int ac_index,
-        int pitch_delay_min);
-
-/**
- * \brief Decode pitch delay with 1/3 precision.
- * \param ac_index adaptive codebook index (4 bits)
- * \param pitch_delay_min lower bound (integer) of pitch delay interval for
- *                      second subframe
- *
- * \return pitch delay in 1/3 units
- *
- * Pitch delay is coded:
- *    integers only,          -6  < pitch_delay - int(prev_pitch_delay) <= -2
- *    with 1/3 resolution,    -2  < pitch_delay - int(prev_pitch_delay) <  1
- *    integers only,           1 <= pitch_delay - int(prev_pitch_delay) <  5
- *
- * \remark The routine is used in G.729 @6.4k, AMR @6.7k, AMR @5.9k,
- *         AMR @5.15k, AMR @4.75k for the second subframe.
- */
-int ff_acelp_decode_4bit_to_2nd_delay3(
-        int ac_index,
-        int pitch_delay_min);
-
-/**
- * \brief Decode pitch delay of the first subframe encoded by 9 bits
- *        with 1/6 precision.
- * \param ac_index adaptive codebook index (9 bits)
- * \param pitch_delay_min lower bound (integer) of pitch delay interval for
- *                      second subframe
- *
- * \return pitch delay in 1/6 units
- *
- * Pitch delay is coded:
- *    with 1/6 resolution,  17  < pitch_delay <  95
- *    integers only,        95 <= pitch_delay <= 143
- *
- * \remark The routine is used in AMR @12.2k for the first and third subframes.
- */
-int ff_acelp_decode_9bit_to_1st_delay6(int ac_index);
-
-/**
- * \brief Decode pitch delay of the second subframe encoded by 6 bits
- *        with 1/6 precision.
- * \param ac_index adaptive codebook index (6 bits)
- * \param pitch_delay_min lower bound (integer) of pitch delay interval for
- *                      second subframe
- *
- * \return pitch delay in 1/6 units
- *
- * Pitch delay is coded:
- *    with 1/6 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5
- *
- * \remark The routine is used in AMR @12.2k for the second and fourth subframes.
- */
-int ff_acelp_decode_6bit_to_2nd_delay6(
-        int ac_index,
-        int pitch_delay_min);
-
-/**
- * \brief Update past quantized energies
- * \param quant_energy [in/out] past quantized energies (5.10)
- * \param gain_corr_factor gain correction factor
- * \param log2_ma_pred_order log2() of MA prediction order
- * \param erasure frame erasure flag
- *
- * If frame erasure flag is not equal to zero, memory is updated with
- * averaged energy, attenuated by 4dB:
- *     max(avg(quant_energy[i])-4, -14), i=0,ma_pred_order
- *
- * In normal mode memory is updated with
- *     Er - Ep = 20 * log10(gain_corr_factor)
- *
- * \remark The routine is used in G.729 and AMR (all modes).
- */
-void ff_acelp_update_past_gain(
-        int16_t* quant_energy,
-        int gain_corr_factor,
-        int log2_ma_pred_order,
-        int erasure);
-
-/**
- * \brief Decode the adaptive codebook gain and add
- *        correction (4.1.5 and 3.9.1 of G.729).
- * \param dsp initialized dsputil context
- * \param gain_corr_factor gain correction factor (2.13)
- * \param fc_v fixed-codebook vector (2.13)
- * \param mr_energy mean innovation energy and fixed-point correction (7.13)
- * \param quant_energy [in/out] past quantized energies (5.10)
- * \param subframe_size length of subframe
- * \param ma_pred_order MA prediction order
- *
- * \return quantized fixed-codebook gain (14.1)
- *
- * The routine implements equations 69, 66 and 71 of the G.729 specification (3.9.1)
- *
- *    Em   - mean innovation energy (dB, constant, depends on decoding algorithm)
- *    Ep   - mean-removed predicted energy (dB)
- *    Er   - mean-removed innovation energy (dB)
- *    Ei   - mean energy of the fixed-codebook contribution (dB)
- *    N    - subframe_size
- *    M    - MA (Moving Average) prediction order
- *    gc   - fixed-codebook gain
- *    gc_p - predicted fixed-codebook gain
- *
- *    Fixed codebook gain is computed using predicted gain gc_p and
- *    correction factor gain_corr_factor as shown below:
- *
- *        gc = gc_p * gain_corr_factor
- *
- *    The predicted fixed codebook gain gc_p is found by predicting
- *    the energy of the fixed-codebook contribution from the energy
- *    of previous fixed-codebook contributions.
- *
- *        mean = 1/N * sum(i,0,N){ fc_v[i] * fc_v[i] }
- *
- *        Ei = 10log(mean)
- *
- *        Er = 10log(1/N * gc^2 * mean) - Em = 20log(gc) + Ei - Em
- *
- *    Replacing Er with Ep and gc with gc_p we will receive:
- *
- *        Ep = 10log(1/N * gc_p^2 * mean) - Em = 20log(gc_p) + Ei - Em
- *
- *    and from above:
- *
- *        gc_p = 10^((Ep - Ei + Em) / 20)
- *
- *    Ep is predicted using past energies and prediction coefficients:
- *
- *        Ep = sum(i,0,M){ ma_prediction_coeff[i] * quant_energy[i] }
- *
- *    gc_p in fixed-point arithmetic is calculated as following:
- *
- *        mean = 1/N * sum(i,0,N){ (fc_v[i] / 2^13) * (fc_v[i] / 2^13) } =
- *        = 1/N * sum(i,0,N) { fc_v[i] * fc_v[i] } / 2^26
- *
- *        Ei = 10log(mean) = -10log(N) - 10log(2^26) +
- *        + 10log(sum(i,0,N) { fc_v[i] * fc_v[i] })
- *
- *        Ep - Ei + Em = Ep + Em + 10log(N) + 10log(2^26) -
- *        - 10log(sum(i,0,N) { fc_v[i] * fc_v[i] }) =
- *        = Ep + mr_energy - 10log(sum(i,0,N) { fc_v[i] * fc_v[i] })
- *
- *        gc_p = 10 ^ ((Ep - Ei + Em) / 20) =
- *        = 2 ^ (3.3219 * (Ep - Ei + Em) / 20) = 2 ^ (0.166 * (Ep - Ei + Em))
- *
- *    where
- *
- *        mr_energy = Em + 10log(N) + 10log(2^26)
- *
- * \remark The routine is used in G.729 and AMR (all modes).
- */
-int16_t ff_acelp_decode_gain_code(
-    DSPContext *dsp,
-    int gain_corr_factor,
-    const int16_t* fc_v,
-    int mr_energy,
-    const int16_t* quant_energy,
-    const int16_t* ma_prediction_coeff,
-    int subframe_size,
-    int max_pred_order);
-
-/**
- * Calculate fixed gain (part of section 6.1.3 of AMR spec)
- *
- * @param fixed_gain_factor gain correction factor
- * @param fixed_energy decoded algebraic codebook vector energy
- * @param prediction_error vector of the quantified predictor errors of
- *        the four previous subframes. It is updated by this function.
- * @param energy_mean desired mean innovation energy
- * @param pred_table table of four moving average coefficients
- */
-float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy,
-                            float *prediction_error, float energy_mean,
-                            const float *pred_table);
-
-
-/**
- * Decode the adaptive codebook index to the integer and fractional parts
- * of the pitch lag for one subframe at 1/3 fractional precision.
- *
- * The choice of pitch lag is described in 3GPP TS 26.090 section 5.6.1.
- *
- * @param lag_int             integer part of pitch lag of the current subframe
- * @param lag_frac            fractional part of pitch lag of the current subframe
- * @param pitch_index         parsed adaptive codebook (pitch) index
- * @param prev_lag_int        integer part of pitch lag for the previous subframe
- * @param subframe            current subframe number
- * @param third_as_first      treat the third frame the same way as the first
- */
-void ff_decode_pitch_lag(int *lag_int, int *lag_frac, int pitch_index,
-                         const int prev_lag_int, const int subframe,
-                         int third_as_first, int resolution);
-
-#endif /* AVCODEC_ACELP_PITCH_DELAY_H */
diff --git a/libavcodec/acelp_vectors.c b/libavcodec/acelp_vectors.c
deleted file mode 100644
index e41e5fa..0000000
--- a/libavcodec/acelp_vectors.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * adaptive and fixed codebook vector operations for ACELP-based codecs
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-#include "avcodec.h"
-#include "acelp_vectors.h"
-#include "celp_math.h"
-
-const uint8_t ff_fc_2pulses_9bits_track1[16] =
-{
-    1,  3,
-    6,  8,
-    11, 13,
-    16, 18,
-    21, 23,
-    26, 28,
-    31, 33,
-    36, 38
-};
-const uint8_t ff_fc_2pulses_9bits_track1_gray[16] =
-{
-  1,  3,
-  8,  6,
-  18, 16,
-  11, 13,
-  38, 36,
-  31, 33,
-  21, 23,
-  28, 26,
-};
-
-const uint8_t ff_fc_2pulses_9bits_track2_gray[32] =
-{
-  0,  2,
-  5,  4,
-  12, 10,
-  7,  9,
-  25, 24,
-  20, 22,
-  14, 15,
-  19, 17,
-  36, 31,
-  21, 26,
-  1,  6,
-  16, 11,
-  27, 29,
-  32, 30,
-  39, 37,
-  34, 35,
-};
-
-const uint8_t ff_fc_4pulses_8bits_tracks_13[16] =
-{
-  0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75,
-};
-
-const uint8_t ff_fc_4pulses_8bits_track_4[32] =
-{
-    3,  4,
-    8,  9,
-    13, 14,
-    18, 19,
-    23, 24,
-    28, 29,
-    33, 34,
-    38, 39,
-    43, 44,
-    48, 49,
-    53, 54,
-    58, 59,
-    63, 64,
-    68, 69,
-    73, 74,
-    78, 79,
-};
-
-#if 0
-static uint8_t gray_decode[32] =
-{
-    0,  1,  3,  2,  7,  6,  4,  5,
-   15, 14, 12, 13,  8,  9, 11, 10,
-   31, 30, 28, 29, 24, 25, 27, 26,
-   16, 17, 19, 18, 23, 22, 20, 21
-};
-#endif
-
-const float ff_pow_0_7[10] = {
-    0.700000, 0.490000, 0.343000, 0.240100, 0.168070,
-    0.117649, 0.082354, 0.057648, 0.040354, 0.028248
-};
-
-const float ff_pow_0_75[10] = {
-    0.750000, 0.562500, 0.421875, 0.316406, 0.237305,
-    0.177979, 0.133484, 0.100113, 0.075085, 0.056314
-};
-
-const float ff_pow_0_55[10] = {
-    0.550000, 0.302500, 0.166375, 0.091506, 0.050328,
-    0.027681, 0.015224, 0.008373, 0.004605, 0.002533
-};
-
-const float ff_b60_sinc[61] = {
- 0.898529  ,  0.865051  ,  0.769257  ,  0.624054  ,  0.448639  ,  0.265289   ,
- 0.0959167 , -0.0412598 , -0.134338  , -0.178986  , -0.178528  , -0.142609   ,
--0.0849304 , -0.0205078 ,  0.0369568 ,  0.0773926 ,  0.0955200 ,  0.0912781  ,
- 0.0689392 ,  0.0357056 ,  0.        , -0.0305481 , -0.0504150 , -0.0570068  ,
--0.0508423 , -0.0350037 , -0.0141602 ,  0.00665283,  0.0230713 ,  0.0323486  ,
- 0.0335388 ,  0.0275879 ,  0.0167847 ,  0.00411987, -0.00747681, -0.0156860  ,
--0.0193481 , -0.0183716 , -0.0137634 , -0.00704956,  0.        ,  0.00582886 ,
- 0.00939941,  0.0103760 ,  0.00903320,  0.00604248,  0.00238037, -0.00109863 ,
--0.00366211, -0.00497437, -0.00503540, -0.00402832, -0.00241089, -0.000579834,
- 0.00103760,  0.00222778,  0.00277710,  0.00271606,  0.00213623,  0.00115967 ,
- 0.
-};
-
-void ff_acelp_fc_pulse_per_track(
-        int16_t* fc_v,
-        const uint8_t *tab1,
-        const uint8_t *tab2,
-        int pulse_indexes,
-        int pulse_signs,
-        int pulse_count,
-        int bits)
-{
-    int mask = (1 << bits) - 1;
-    int i;
-
-    for(i=0; i<pulse_count; i++)
-    {
-        fc_v[i + tab1[pulse_indexes & mask]] +=
-                (pulse_signs & 1) ? 8191 : -8192; // +/-1 in (2.13)
-
-        pulse_indexes >>= bits;
-        pulse_signs >>= 1;
-    }
-
-    fc_v[tab2[pulse_indexes]] += (pulse_signs & 1) ? 8191 : -8192;
-}
-
-void ff_decode_10_pulses_35bits(const int16_t *fixed_index,
-                                AMRFixed *fixed_sparse,
-                                const uint8_t *gray_decode,
-                                int half_pulse_count, int bits)
-{
-    int i;
-    int mask = (1 << bits) - 1;
-
-    fixed_sparse->no_repeat_mask = 0;
-    fixed_sparse->n = 2 * half_pulse_count;
-    for (i = 0; i < half_pulse_count; i++) {
-        const int pos1   = gray_decode[fixed_index[2*i+1] & mask] + i;
-        const int pos2   = gray_decode[fixed_index[2*i  ] & mask] + i;
-        const float sign = (fixed_index[2*i+1] & (1 << bits)) ? -1.0 : 1.0;
-        fixed_sparse->x[2*i+1] = pos1;
-        fixed_sparse->x[2*i  ] = pos2;
-        fixed_sparse->y[2*i+1] = sign;
-        fixed_sparse->y[2*i  ] = pos2 < pos1 ? -sign : sign;
-    }
-}
-
-void ff_acelp_weighted_vector_sum(
-        int16_t* out,
-        const int16_t *in_a,
-        const int16_t *in_b,
-        int16_t weight_coeff_a,
-        int16_t weight_coeff_b,
-        int16_t rounder,
-        int shift,
-        int length)
-{
-    int i;
-
-    // Clipping required here; breaks OVERFLOW test.
-    for(i=0; i<length; i++)
-        out[i] = av_clip_int16((
-                 in_a[i] * weight_coeff_a +
-                 in_b[i] * weight_coeff_b +
-                 rounder) >> shift);
-}
-
-void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b,
-                             float weight_coeff_a, float weight_coeff_b, int length)
-{
-    int i;
-
-    for(i=0; i<length; i++)
-        out[i] = weight_coeff_a * in_a[i]
-               + weight_coeff_b * in_b[i];
-}
-
-void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
-                              int size, float alpha, float *gain_mem)
-{
-    int i;
-    float postfilter_energ = ff_dot_productf(in, in, size);
-    float gain_scale_factor = 1.0;
-    float mem = *gain_mem;
-
-    if (postfilter_energ)
-        gain_scale_factor = sqrt(speech_energ / postfilter_energ);
-
-    gain_scale_factor *= 1.0 - alpha;
-
-    for (i = 0; i < size; i++) {
-        mem = alpha * mem + gain_scale_factor;
-        out[i] = in[i] * mem;
-    }
-
-    *gain_mem = mem;
-}
-
-void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in,
-                                             float sum_of_squares, const int n)
-{
-    int i;
-    float scalefactor = ff_dot_productf(in, in, n);
-    if (scalefactor)
-        scalefactor = sqrt(sum_of_squares / scalefactor);
-    for (i = 0; i < n; i++)
-        out[i] = in[i] * scalefactor;
-}
-
-void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size)
-{
-    int i;
-
-    for (i=0; i < in->n; i++) {
-        int x   = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
-        float y = in->y[i] * scale;
-
-        do {
-            out[x] += y;
-            y *= in->pitch_fac;
-            x += in->pitch_lag;
-        } while (x < size && repeats);
-    }
-}
-
-void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size)
-{
-    int i;
-
-    for (i=0; i < in->n; i++) {
-        int x  = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1);
-
-        do {
-            out[x] = 0.0;
-            x += in->pitch_lag;
-        } while (x < size && repeats);
-    }
-}
diff --git a/libavcodec/acelp_vectors.h b/libavcodec/acelp_vectors.h
deleted file mode 100644
index ba3437f..0000000
--- a/libavcodec/acelp_vectors.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * adaptive and fixed codebook vector operations for ACELP-based codecs
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ACELP_VECTORS_H
-#define AVCODEC_ACELP_VECTORS_H
-
-#include <stdint.h>
-
-/** Sparse representation for the algebraic codebook (fixed) vector */
-typedef struct {
-    int      n;
-    int      x[10];
-    float    y[10];
-    int      no_repeat_mask;
-    int      pitch_lag;
-    float    pitch_fac;
-} AMRFixed;
-
-/**
- * Track|Pulse|        Positions
- * -------------------------------------------------------------------------
- *  1   | 0   | 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75
- * -------------------------------------------------------------------------
- *  2   | 1   | 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76
- * -------------------------------------------------------------------------
- *  3   | 2   | 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 57, 62, 67, 72, 77
- * -------------------------------------------------------------------------
- *
- * Table contains only first the pulse indexes.
- *
- * Used in G.729 @8k, G.729 @4.4k, AMR @7.95k, AMR @7.40k
- */
-extern const uint8_t ff_fc_4pulses_8bits_tracks_13[16];
-
-/**
- * Track|Pulse|        Positions
- * -------------------------------------------------------------------------
- *  4   | 3   | 3, 8, 13, 18, 23, 28, 33, 38, 43, 48, 53, 58, 63, 68, 73, 78
- *      |     | 4, 9, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59, 64, 69, 74, 79
- * -------------------------------------------------------------------------
- *
- * @remark Track in the table should be read top-to-bottom, left-to-right.
- *
- * Used in G.729 @8k, G.729 @4.4k, AMR @7.95k, AMR @7.40k
- */
-extern const uint8_t ff_fc_4pulses_8bits_track_4[32];
-
-/**
- * Track|Pulse|        Positions
- * -----------------------------------------
- *  1   | 0   | 1, 6, 11, 16, 21, 26, 31, 36
- *      |     | 3, 8, 13, 18, 23, 28, 33, 38
- * -----------------------------------------
- *
- * @remark Track in the table should be read top-to-bottom, left-to-right.
- *
- * @note (EE) Reference G.729D code also uses gray decoding for each
- *            pulse index before looking up the value in the table.
- *
- * Used in G.729 @6.4k (with gray coding), AMR @5.9k (without gray coding)
- */
-extern const uint8_t ff_fc_2pulses_9bits_track1[16];
-extern const uint8_t ff_fc_2pulses_9bits_track1_gray[16];
-
-/**
- * Track|Pulse|        Positions
- * -----------------------------------------
- *  2   | 1   | 0, 7, 14, 20, 27, 34,  1, 21
- *      |     | 2, 9, 15, 22, 29, 35,  6, 26
- *      |     | 4,10, 17, 24, 30, 37, 11, 31
- *      |     | 5,12, 19, 25, 32, 39, 16, 36
- * -----------------------------------------
- *
- * @remark Track in the table should be read top-to-bottom, left-to-right.
- *
- * @note (EE.1) This table (from the reference code) does not comply with
- *              the specification.
- *              The specification contains the following table:
- *
- * Track|Pulse|        Positions
- * -----------------------------------------
- *  2   | 1   | 0, 5, 10, 15, 20, 25, 30, 35
- *      |     | 1, 6, 11, 16, 21, 26, 31, 36
- *      |     | 2, 7, 12, 17, 22, 27, 32, 37
- *      |     | 4, 9, 14, 19, 24, 29, 34, 39
- *
- * -----------------------------------------
- *
- * @note (EE.2) Reference G.729D code also uses gray decoding for each
- *              pulse index before looking up the value in the table.
- *
- * Used in G.729 @6.4k (with gray coding)
- */
-extern const uint8_t ff_fc_2pulses_9bits_track2_gray[32];
-
-/**
- * b60 hamming windowed sinc function coefficients
- */
-extern const float ff_b60_sinc[61];
-
-/**
- * Table of pow(0.7,n)
- */
-extern const float ff_pow_0_7[10];
-
-/**
- * Table of pow(0.75,n)
- */
-extern const float ff_pow_0_75[10];
-
-/**
- * Table of pow(0.55,n)
- */
-extern const float ff_pow_0_55[10];
-
-/**
- * Decode fixed-codebook vector (3.8 and D.5.8 of G.729, 5.7.1 of AMR).
- * @param fc_v [out] decoded fixed codebook vector (2.13)
- * @param tab1 table used for first pulse_count pulses
- * @param tab2 table used for last pulse
- * @param pulse_indexes fixed codebook indexes
- * @param pulse_signs signs of the excitation pulses (0 bit value
- *                     means negative sign)
- * @param bits number of bits per one pulse index
- * @param pulse_count number of pulses decoded using first table
- * @param bits length of one pulse index in bits
- *
- * Used in G.729 @8k, G.729 @4.4k, G.729 @6.4k, AMR @7.95k, AMR @7.40k
- */
-void ff_acelp_fc_pulse_per_track(int16_t* fc_v,
-                                 const uint8_t *tab1,
-                                 const uint8_t *tab2,
-                                 int pulse_indexes,
-                                 int pulse_signs,
-                                 int pulse_count,
-                                 int bits);
-
-/**
- * Decode the algebraic codebook index to pulse positions and signs and
- * construct the algebraic codebook vector for MODE_12k2.
- *
- * @note: The positions and signs are explicitly coded in MODE_12k2.
- *
- * @param fixed_index          positions of the ten pulses
- * @param fixed_sparse         pointer to the algebraic codebook vector
- * @param gray_decode          gray decoding table
- * @param half_pulse_count     number of couples of pulses
- * @param bits                 length of one pulse index in bits
- */
-void ff_decode_10_pulses_35bits(const int16_t *fixed_index,
-                                AMRFixed *fixed_sparse,
-                                const uint8_t *gray_decode,
-                                int half_pulse_count, int bits);
-
-
-/**
- * weighted sum of two vectors with rounding.
- * @param out [out] result of addition
- * @param in_a first vector
- * @param in_b second vector
- * @param weight_coeff_a first vector weight coefficient
- * @param weight_coeff_a second vector weight coefficient
- * @param rounder this value will be added to the sum of the two vectors
- * @param shift result will be shifted to right by this value
- * @param length vectors length
- *
- * @note It is safe to pass the same buffer for out and in_a or in_b.
- *
- *  out[i] = (in_a[i]*weight_a + in_b[i]*weight_b + rounder) >> shift
- */
-void ff_acelp_weighted_vector_sum(int16_t* out,
-                                  const int16_t *in_a,
-                                  const int16_t *in_b,
-                                  int16_t weight_coeff_a,
-                                  int16_t weight_coeff_b,
-                                  int16_t rounder,
-                                  int shift,
-                                  int length);
-
-/**
- * float implementation of weighted sum of two vectors.
- * @param out [out] result of addition
- * @param in_a first vector
- * @param in_b second vector
- * @param weight_coeff_a first vector weight coefficient
- * @param weight_coeff_a second vector weight coefficient
- * @param length vectors length
- *
- * @note It is safe to pass the same buffer for out and in_a or in_b.
- */
-void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b,
-                             float weight_coeff_a, float weight_coeff_b,
-                             int length);
-
-/**
- * Adaptive gain control (as used in AMR postfiltering)
- *
- * @param out output buffer for filtered speech data
- * @param in the input speech buffer (may be the same as out)
- * @param speech_energ input energy
- * @param size the input buffer size
- * @param alpha exponential filter factor
- * @param gain_mem a pointer to the filter memory (single float of size)
- */
-void ff_adaptive_gain_control(float *out, const float *in, float speech_energ,
-                              int size, float alpha, float *gain_mem);
-
-/**
- * Set the sum of squares of a signal by scaling
- *
- * @param out output samples
- * @param in input samples
- * @param sum_of_squares new sum of squares
- * @param n number of samples
- *
- * @note If the input is zero (or its energy underflows), the output is zero.
- *       This is the behavior of AGC in the AMR reference decoder. The QCELP
- *       reference decoder seems to have undefined behavior.
- *
- * TIA/EIA/IS-733 2.4.8.3-2/3/4/5, 2.4.8.6
- * 3GPP TS 26.090 6.1 (6)
- */
-void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in,
-                                             float sum_of_squares, const int n);
-
-/**
- * Add fixed vector to an array from a sparse representation
- *
- * @param out fixed vector with pitch sharpening
- * @param in sparse fixed vector
- * @param scale number to multiply the fixed vector by
- * @param size the output vector size
- */
-void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size);
-
-/**
- * Clear array values set by set_fixed_vector
- *
- * @param out fixed vector to be cleared
- * @param in sparse fixed vector
- * @param size the output vector size
- */
-void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size);
-
-#endif /* AVCODEC_ACELP_VECTORS_H */
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
deleted file mode 100644
index 68bd656..0000000
--- a/libavcodec/adpcm.c
+++ /dev/null
@@ -1,1701 +0,0 @@
-/*
- * ADPCM codecs
- * Copyright (c) 2001-2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "bytestream.h"
-
-/**
- * @file
- * ADPCM codecs.
- * First version by Francois Revol (revol at free.fr)
- * Fringe ADPCM codecs (e.g., DK3, DK4, Westwood)
- *   by Mike Melanson (melanson at pcisys.net)
- * CD-ROM XA ADPCM codec by BERO
- * EA ADPCM decoder by Robin Kay (komadori at myrealbox.com)
- * EA ADPCM R1/R2/R3 decoder by Peter Ross (pross at xvid.org)
- * EA IMA EACS decoder by Peter Ross (pross at xvid.org)
- * EA IMA SEAD decoder by Peter Ross (pross at xvid.org)
- * EA ADPCM XAS decoder by Peter Ross (pross at xvid.org)
- * MAXIS EA ADPCM decoder by Robert Marston (rmarston at gmail.com)
- * THP ADPCM decoder by Marco Gerards (mgerards at xs4all.nl)
- *
- * Features and limitations:
- *
- * Reference documents:
- * http://www.pcisys.net/~melanson/codecs/simpleaudio.html
- * http://www.geocities.com/SiliconValley/8682/aud3.txt
- * http://openquicktime.sourceforge.net/plugins.htm
- * XAnim sources (xa_codec.c) http://www.rasnaimaging.com/people/lapus/download.html
- * http://www.cs.ucla.edu/~leec/mediabench/applications.html
- * SoX source code http://home.sprynet.com/~cbagwell/sox.html
- *
- * CD-ROM XA:
- * http://ku-www.ss.titech.ac.jp/~yatsushi/xaadpcm.html
- * vagpack & depack http://homepages.compuserve.de/bITmASTER32/psx-index.html
- * readstr http://www.geocities.co.jp/Playtown/2004/
- */
-
-#define BLKSIZE 1024
-
-/* step_table[] and index_table[] are from the ADPCM reference source */
-/* This is the index table: */
-static const int index_table[16] = {
-    -1, -1, -1, -1, 2, 4, 6, 8,
-    -1, -1, -1, -1, 2, 4, 6, 8,
-};
-
-/**
- * This is the step table. Note that many programs use slight deviations from
- * this table, but such deviations are negligible:
- */
-static const int step_table[89] = {
-    7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
-    19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
-    50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
-    130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
-    337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
-    876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
-    2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
-    5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
-    15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
-};
-
-/* These are for MS-ADPCM */
-/* AdaptationTable[], AdaptCoeff1[], and AdaptCoeff2[] are from libsndfile */
-static const int AdaptationTable[] = {
-        230, 230, 230, 230, 307, 409, 512, 614,
-        768, 614, 512, 409, 307, 230, 230, 230
-};
-
-/** Divided by 4 to fit in 8-bit integers */
-static const uint8_t AdaptCoeff1[] = {
-        64, 128, 0, 48, 60, 115, 98
-};
-
-/** Divided by 4 to fit in 8-bit integers */
-static const int8_t AdaptCoeff2[] = {
-        0, -64, 0, 16, 0, -52, -58
-};
-
-/* These are for CD-ROM XA ADPCM */
-static const int xa_adpcm_table[5][2] = {
-   {   0,   0 },
-   {  60,   0 },
-   { 115, -52 },
-   {  98, -55 },
-   { 122, -60 }
-};
-
-static const int ea_adpcm_table[] = {
-    0, 240, 460, 392, 0, 0, -208, -220, 0, 1,
-    3, 4, 7, 8, 10, 11, 0, -1, -3, -4
-};
-
-// padded to zero where table size is less then 16
-static const int swf_index_tables[4][16] = {
-    /*2*/ { -1, 2 },
-    /*3*/ { -1, -1, 2, 4 },
-    /*4*/ { -1, -1, -1, -1, 2, 4, 6, 8 },
-    /*5*/ { -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 }
-};
-
-static const int yamaha_indexscale[] = {
-    230, 230, 230, 230, 307, 409, 512, 614,
-    230, 230, 230, 230, 307, 409, 512, 614
-};
-
-static const int yamaha_difflookup[] = {
-    1, 3, 5, 7, 9, 11, 13, 15,
-    -1, -3, -5, -7, -9, -11, -13, -15
-};
-
-/* end of tables */
-
-typedef struct ADPCMChannelStatus {
-    int predictor;
-    short int step_index;
-    int step;
-    /* for encoding */
-    int prev_sample;
-
-    /* MS version */
-    short sample1;
-    short sample2;
-    int coeff1;
-    int coeff2;
-    int idelta;
-} ADPCMChannelStatus;
-
-typedef struct ADPCMContext {
-    ADPCMChannelStatus status[6];
-} ADPCMContext;
-
-/* XXX: implement encoding */
-
-#if CONFIG_ENCODERS
-static av_cold int adpcm_encode_init(AVCodecContext *avctx)
-{
-    uint8_t *extradata;
-    int i;
-    if (avctx->channels > 2)
-        return -1; /* only stereo or mono =) */
-
-    if(avctx->trellis && (unsigned)avctx->trellis > 16U){
-        av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
-        return -1;
-    }
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_ADPCM_IMA_WAV:
-        avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; /* each 16 bits sample gives one nibble */
-                                                             /* and we have 4 bytes per channel overhead */
-        avctx->block_align = BLKSIZE;
-        /* seems frame_size isn't taken into account... have to buffer the samples :-( */
-        break;
-    case CODEC_ID_ADPCM_IMA_QT:
-        avctx->frame_size = 64;
-        avctx->block_align = 34 * avctx->channels;
-        break;
-    case CODEC_ID_ADPCM_MS:
-        avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; /* each 16 bits sample gives one nibble */
-                                                             /* and we have 7 bytes per channel overhead */
-        avctx->block_align = BLKSIZE;
-        avctx->extradata_size = 32;
-        extradata = avctx->extradata = av_malloc(avctx->extradata_size);
-        if (!extradata)
-            return AVERROR(ENOMEM);
-        bytestream_put_le16(&extradata, avctx->frame_size);
-        bytestream_put_le16(&extradata, 7); /* wNumCoef */
-        for (i = 0; i < 7; i++) {
-            bytestream_put_le16(&extradata, AdaptCoeff1[i] * 4);
-            bytestream_put_le16(&extradata, AdaptCoeff2[i] * 4);
-        }
-        break;
-    case CODEC_ID_ADPCM_YAMAHA:
-        avctx->frame_size = BLKSIZE * avctx->channels;
-        avctx->block_align = BLKSIZE;
-        break;
-    case CODEC_ID_ADPCM_SWF:
-        if (avctx->sample_rate != 11025 &&
-            avctx->sample_rate != 22050 &&
-            avctx->sample_rate != 44100) {
-            av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, 22050 or 44100\n");
-            return -1;
-        }
-        avctx->frame_size = 512 * (avctx->sample_rate / 11025);
-        break;
-    default:
-        return -1;
-    }
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    return 0;
-}
-
-static av_cold int adpcm_encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-
-static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c, short sample)
-{
-    int delta = sample - c->prev_sample;
-    int nibble = FFMIN(7, abs(delta)*4/step_table[c->step_index]) + (delta<0)*8;
-    c->prev_sample += ((step_table[c->step_index] * yamaha_difflookup[nibble]) / 8);
-    c->prev_sample = av_clip_int16(c->prev_sample);
-    c->step_index = av_clip(c->step_index + index_table[nibble], 0, 88);
-    return nibble;
-}
-
-static inline unsigned char adpcm_ms_compress_sample(ADPCMChannelStatus *c, short sample)
-{
-    int predictor, nibble, bias;
-
-    predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64;
-
-    nibble= sample - predictor;
-    if(nibble>=0) bias= c->idelta/2;
-    else          bias=-c->idelta/2;
-
-    nibble= (nibble + bias) / c->idelta;
-    nibble= av_clip(nibble, -8, 7)&0x0F;
-
-    predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;
-
-    c->sample2 = c->sample1;
-    c->sample1 = av_clip_int16(predictor);
-
-    c->idelta = (AdaptationTable[(int)nibble] * c->idelta) >> 8;
-    if (c->idelta < 16) c->idelta = 16;
-
-    return nibble;
-}
-
-static inline unsigned char adpcm_yamaha_compress_sample(ADPCMChannelStatus *c, short sample)
-{
-    int nibble, delta;
-
-    if(!c->step) {
-        c->predictor = 0;
-        c->step = 127;
-    }
-
-    delta = sample - c->predictor;
-
-    nibble = FFMIN(7, abs(delta)*4/c->step) + (delta<0)*8;
-
-    c->predictor += ((c->step * yamaha_difflookup[nibble]) / 8);
-    c->predictor = av_clip_int16(c->predictor);
-    c->step = (c->step * yamaha_indexscale[nibble]) >> 8;
-    c->step = av_clip(c->step, 127, 24567);
-
-    return nibble;
-}
-
-typedef struct TrellisPath {
-    int nibble;
-    int prev;
-} TrellisPath;
-
-typedef struct TrellisNode {
-    uint32_t ssd;
-    int path;
-    int sample1;
-    int sample2;
-    int step;
-} TrellisNode;
-
-static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
-                                   uint8_t *dst, ADPCMChannelStatus *c, int n)
-{
-#define FREEZE_INTERVAL 128
-    //FIXME 6% faster if frontier is a compile-time constant
-    const int frontier = 1 << avctx->trellis;
-    const int stride = avctx->channels;
-    const int version = avctx->codec->id;
-    const int max_paths = frontier*FREEZE_INTERVAL;
-    TrellisPath paths[max_paths], *p;
-    TrellisNode node_buf[2][frontier];
-    TrellisNode *nodep_buf[2][frontier];
-    TrellisNode **nodes = nodep_buf[0]; // nodes[] is always sorted by .ssd
-    TrellisNode **nodes_next = nodep_buf[1];
-    int pathn = 0, froze = -1, i, j, k;
-
-    assert(!(max_paths&(max_paths-1)));
-
-    memset(nodep_buf, 0, sizeof(nodep_buf));
-    nodes[0] = &node_buf[1][0];
-    nodes[0]->ssd = 0;
-    nodes[0]->path = 0;
-    nodes[0]->step = c->step_index;
-    nodes[0]->sample1 = c->sample1;
-    nodes[0]->sample2 = c->sample2;
-    if((version == CODEC_ID_ADPCM_IMA_WAV) || (version == CODEC_ID_ADPCM_IMA_QT) || (version == CODEC_ID_ADPCM_SWF))
-        nodes[0]->sample1 = c->prev_sample;
-    if(version == CODEC_ID_ADPCM_MS)
-        nodes[0]->step = c->idelta;
-    if(version == CODEC_ID_ADPCM_YAMAHA) {
-        if(c->step == 0) {
-            nodes[0]->step = 127;
-            nodes[0]->sample1 = 0;
-        } else {
-            nodes[0]->step = c->step;
-            nodes[0]->sample1 = c->predictor;
-        }
-    }
-
-    for(i=0; i<n; i++) {
-        TrellisNode *t = node_buf[i&1];
-        TrellisNode **u;
-        int sample = samples[i*stride];
-        memset(nodes_next, 0, frontier*sizeof(TrellisNode*));
-        for(j=0; j<frontier && nodes[j]; j++) {
-            // higher j have higher ssd already, so they're unlikely to use a suboptimal next sample too
-            const int range = (j < frontier/2) ? 1 : 0;
-            const int step = nodes[j]->step;
-            int nidx;
-            if(version == CODEC_ID_ADPCM_MS) {
-                const int predictor = ((nodes[j]->sample1 * c->coeff1) + (nodes[j]->sample2 * c->coeff2)) / 64;
-                const int div = (sample - predictor) / step;
-                const int nmin = av_clip(div-range, -8, 6);
-                const int nmax = av_clip(div+range, -7, 7);
-                for(nidx=nmin; nidx<=nmax; nidx++) {
-                    const int nibble = nidx & 0xf;
-                    int dec_sample = predictor + nidx * step;
-#define STORE_NODE(NAME, STEP_INDEX)\
-                    int d;\
-                    uint32_t ssd;\
-                    dec_sample = av_clip_int16(dec_sample);\
-                    d = sample - dec_sample;\
-                    ssd = nodes[j]->ssd + d*d;\
-                    if(nodes_next[frontier-1] && ssd >= nodes_next[frontier-1]->ssd)\
-                        continue;\
-                    /* Collapse any two states with the same previous sample value. \
-                     * One could also distinguish states by step and by 2nd to last
-                     * sample, but the effects of that are negligible. */\
-                    for(k=0; k<frontier && nodes_next[k]; k++) {\
-                        if(dec_sample == nodes_next[k]->sample1) {\
-                            assert(ssd >= nodes_next[k]->ssd);\
-                            goto next_##NAME;\
-                        }\
-                    }\
-                    for(k=0; k<frontier; k++) {\
-                        if(!nodes_next[k] || ssd < nodes_next[k]->ssd) {\
-                            TrellisNode *u = nodes_next[frontier-1];\
-                            if(!u) {\
-                                assert(pathn < max_paths);\
-                                u = t++;\
-                                u->path = pathn++;\
-                            }\
-                            u->ssd = ssd;\
-                            u->step = STEP_INDEX;\
-                            u->sample2 = nodes[j]->sample1;\
-                            u->sample1 = dec_sample;\
-                            paths[u->path].nibble = nibble;\
-                            paths[u->path].prev = nodes[j]->path;\
-                            memmove(&nodes_next[k+1], &nodes_next[k], (frontier-k-1)*sizeof(TrellisNode*));\
-                            nodes_next[k] = u;\
-                            break;\
-                        }\
-                    }\
-                    next_##NAME:;
-                    STORE_NODE(ms, FFMAX(16, (AdaptationTable[nibble] * step) >> 8));
-                }
-            } else if((version == CODEC_ID_ADPCM_IMA_WAV)|| (version == CODEC_ID_ADPCM_IMA_QT)|| (version == CODEC_ID_ADPCM_SWF)) {
-#define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)\
-                const int predictor = nodes[j]->sample1;\
-                const int div = (sample - predictor) * 4 / STEP_TABLE;\
-                int nmin = av_clip(div-range, -7, 6);\
-                int nmax = av_clip(div+range, -6, 7);\
-                if(nmin<=0) nmin--; /* distinguish -0 from +0 */\
-                if(nmax<0) nmax--;\
-                for(nidx=nmin; nidx<=nmax; nidx++) {\
-                    const int nibble = nidx<0 ? 7-nidx : nidx;\
-                    int dec_sample = predictor + (STEP_TABLE * yamaha_difflookup[nibble]) / 8;\
-                    STORE_NODE(NAME, STEP_INDEX);\
-                }
-                LOOP_NODES(ima, step_table[step], av_clip(step + index_table[nibble], 0, 88));
-            } else { //CODEC_ID_ADPCM_YAMAHA
-                LOOP_NODES(yamaha, step, av_clip((step * yamaha_indexscale[nibble]) >> 8, 127, 24567));
-#undef LOOP_NODES
-#undef STORE_NODE
-            }
-        }
-
-        u = nodes;
-        nodes = nodes_next;
-        nodes_next = u;
-
-        // prevent overflow
-        if(nodes[0]->ssd > (1<<28)) {
-            for(j=1; j<frontier && nodes[j]; j++)
-                nodes[j]->ssd -= nodes[0]->ssd;
-            nodes[0]->ssd = 0;
-        }
-
-        // merge old paths to save memory
-        if(i == froze + FREEZE_INTERVAL) {
-            p = &paths[nodes[0]->path];
-            for(k=i; k>froze; k--) {
-                dst[k] = p->nibble;
-                p = &paths[p->prev];
-            }
-            froze = i;
-            pathn = 0;
-            // other nodes might use paths that don't coincide with the frozen one.
-            // checking which nodes do so is too slow, so just kill them all.
-            // this also slightly improves quality, but I don't know why.
-            memset(nodes+1, 0, (frontier-1)*sizeof(TrellisNode*));
-        }
-    }
-
-    p = &paths[nodes[0]->path];
-    for(i=n-1; i>froze; i--) {
-        dst[i] = p->nibble;
-        p = &paths[p->prev];
-    }
-
-    c->predictor = nodes[0]->sample1;
-    c->sample1 = nodes[0]->sample1;
-    c->sample2 = nodes[0]->sample2;
-    c->step_index = nodes[0]->step;
-    c->step = nodes[0]->step;
-    c->idelta = nodes[0]->step;
-}
-
-static int adpcm_encode_frame(AVCodecContext *avctx,
-                            unsigned char *frame, int buf_size, void *data)
-{
-    int n, i, st;
-    short *samples;
-    unsigned char *dst;
-    ADPCMContext *c = avctx->priv_data;
-
-    dst = frame;
-    samples = (short *)data;
-    st= avctx->channels == 2;
-/*    n = (BLKSIZE - 4 * avctx->channels) / (2 * 8 * avctx->channels); */
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_ADPCM_IMA_WAV:
-        n = avctx->frame_size / 8;
-            c->status[0].prev_sample = (signed short)samples[0]; /* XXX */
-/*            c->status[0].step_index = 0; *//* XXX: not sure how to init the state machine */
-            bytestream_put_le16(&dst, c->status[0].prev_sample);
-            *dst++ = (unsigned char)c->status[0].step_index;
-            *dst++ = 0; /* unknown */
-            samples++;
-            if (avctx->channels == 2) {
-                c->status[1].prev_sample = (signed short)samples[0];
-/*                c->status[1].step_index = 0; */
-                bytestream_put_le16(&dst, c->status[1].prev_sample);
-                *dst++ = (unsigned char)c->status[1].step_index;
-                *dst++ = 0;
-                samples++;
-            }
-
-            /* stereo: 4 bytes (8 samples) for left, 4 bytes for right, 4 bytes left, ... */
-            if(avctx->trellis > 0) {
-                uint8_t buf[2][n*8];
-                adpcm_compress_trellis(avctx, samples, buf[0], &c->status[0], n*8);
-                if(avctx->channels == 2)
-                    adpcm_compress_trellis(avctx, samples+1, buf[1], &c->status[1], n*8);
-                for(i=0; i<n; i++) {
-                    *dst++ = buf[0][8*i+0] | (buf[0][8*i+1] << 4);
-                    *dst++ = buf[0][8*i+2] | (buf[0][8*i+3] << 4);
-                    *dst++ = buf[0][8*i+4] | (buf[0][8*i+5] << 4);
-                    *dst++ = buf[0][8*i+6] | (buf[0][8*i+7] << 4);
-                    if (avctx->channels == 2) {
-                        *dst++ = buf[1][8*i+0] | (buf[1][8*i+1] << 4);
-                        *dst++ = buf[1][8*i+2] | (buf[1][8*i+3] << 4);
-                        *dst++ = buf[1][8*i+4] | (buf[1][8*i+5] << 4);
-                        *dst++ = buf[1][8*i+6] | (buf[1][8*i+7] << 4);
-                    }
-                }
-            } else
-            for (; n>0; n--) {
-                *dst = adpcm_ima_compress_sample(&c->status[0], samples[0]);
-                *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels]) << 4;
-                dst++;
-                *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 2]);
-                *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 3]) << 4;
-                dst++;
-                *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 4]);
-                *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 5]) << 4;
-                dst++;
-                *dst = adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 6]);
-                *dst |= adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels * 7]) << 4;
-                dst++;
-                /* right channel */
-                if (avctx->channels == 2) {
-                    *dst = adpcm_ima_compress_sample(&c->status[1], samples[1]);
-                    *dst |= adpcm_ima_compress_sample(&c->status[1], samples[3]) << 4;
-                    dst++;
-                    *dst = adpcm_ima_compress_sample(&c->status[1], samples[5]);
-                    *dst |= adpcm_ima_compress_sample(&c->status[1], samples[7]) << 4;
-                    dst++;
-                    *dst = adpcm_ima_compress_sample(&c->status[1], samples[9]);
-                    *dst |= adpcm_ima_compress_sample(&c->status[1], samples[11]) << 4;
-                    dst++;
-                    *dst = adpcm_ima_compress_sample(&c->status[1], samples[13]);
-                    *dst |= adpcm_ima_compress_sample(&c->status[1], samples[15]) << 4;
-                    dst++;
-                }
-                samples += 8 * avctx->channels;
-            }
-        break;
-    case CODEC_ID_ADPCM_IMA_QT:
-    {
-        int ch, i;
-        PutBitContext pb;
-        init_put_bits(&pb, dst, buf_size*8);
-
-        for(ch=0; ch<avctx->channels; ch++){
-            put_bits(&pb, 9, (c->status[ch].prev_sample + 0x10000) >> 7);
-            put_bits(&pb, 7, c->status[ch].step_index);
-            if(avctx->trellis > 0) {
-                uint8_t buf[64];
-                adpcm_compress_trellis(avctx, samples+ch, buf, &c->status[ch], 64);
-                for(i=0; i<64; i++)
-                    put_bits(&pb, 4, buf[i^1]);
-                c->status[ch].prev_sample = c->status[ch].predictor & ~0x7F;
-            } else {
-                for (i=0; i<64; i+=2){
-                    int t1, t2;
-                    t1 = adpcm_ima_compress_sample(&c->status[ch], samples[avctx->channels*(i+0)+ch]);
-                    t2 = adpcm_ima_compress_sample(&c->status[ch], samples[avctx->channels*(i+1)+ch]);
-                    put_bits(&pb, 4, t2);
-                    put_bits(&pb, 4, t1);
-                }
-                c->status[ch].prev_sample &= ~0x7F;
-            }
-        }
-
-        dst += put_bits_count(&pb)>>3;
-        break;
-    }
-    case CODEC_ID_ADPCM_SWF:
-    {
-        int i;
-        PutBitContext pb;
-        init_put_bits(&pb, dst, buf_size*8);
-
-        n = avctx->frame_size-1;
-
-        //Store AdpcmCodeSize
-        put_bits(&pb, 2, 2);                //Set 4bits flash adpcm format
-
-        //Init the encoder state
-        for(i=0; i<avctx->channels; i++){
-            c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63); // clip step so it fits 6 bits
-            put_sbits(&pb, 16, samples[i]);
-            put_bits(&pb, 6, c->status[i].step_index);
-            c->status[i].prev_sample = (signed short)samples[i];
-        }
-
-        if(avctx->trellis > 0) {
-            uint8_t buf[2][n];
-            adpcm_compress_trellis(avctx, samples+2, buf[0], &c->status[0], n);
-            if (avctx->channels == 2)
-                adpcm_compress_trellis(avctx, samples+3, buf[1], &c->status[1], n);
-            for(i=0; i<n; i++) {
-                put_bits(&pb, 4, buf[0][i]);
-                if (avctx->channels == 2)
-                    put_bits(&pb, 4, buf[1][i]);
-            }
-        } else {
-            for (i=1; i<avctx->frame_size; i++) {
-                put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels*i]));
-                if (avctx->channels == 2)
-                    put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[1], samples[2*i+1]));
-            }
-        }
-        flush_put_bits(&pb);
-        dst += put_bits_count(&pb)>>3;
-        break;
-    }
-    case CODEC_ID_ADPCM_MS:
-        for(i=0; i<avctx->channels; i++){
-            int predictor=0;
-
-            *dst++ = predictor;
-            c->status[i].coeff1 = AdaptCoeff1[predictor];
-            c->status[i].coeff2 = AdaptCoeff2[predictor];
-        }
-        for(i=0; i<avctx->channels; i++){
-            if (c->status[i].idelta < 16)
-                c->status[i].idelta = 16;
-
-            bytestream_put_le16(&dst, c->status[i].idelta);
-        }
-        for(i=0; i<avctx->channels; i++){
-            c->status[i].sample2= *samples++;
-        }
-        for(i=0; i<avctx->channels; i++){
-            c->status[i].sample1= *samples++;
-
-            bytestream_put_le16(&dst, c->status[i].sample1);
-        }
-        for(i=0; i<avctx->channels; i++)
-            bytestream_put_le16(&dst, c->status[i].sample2);
-
-        if(avctx->trellis > 0) {
-            int n = avctx->block_align - 7*avctx->channels;
-            uint8_t buf[2][n];
-            if(avctx->channels == 1) {
-                n *= 2;
-                adpcm_compress_trellis(avctx, samples, buf[0], &c->status[0], n);
-                for(i=0; i<n; i+=2)
-                    *dst++ = (buf[0][i] << 4) | buf[0][i+1];
-            } else {
-                adpcm_compress_trellis(avctx, samples, buf[0], &c->status[0], n);
-                adpcm_compress_trellis(avctx, samples+1, buf[1], &c->status[1], n);
-                for(i=0; i<n; i++)
-                    *dst++ = (buf[0][i] << 4) | buf[1][i];
-            }
-        } else
-        for(i=7*avctx->channels; i<avctx->block_align; i++) {
-            int nibble;
-            nibble = adpcm_ms_compress_sample(&c->status[ 0], *samples++)<<4;
-            nibble|= adpcm_ms_compress_sample(&c->status[st], *samples++);
-            *dst++ = nibble;
-        }
-        break;
-    case CODEC_ID_ADPCM_YAMAHA:
-        n = avctx->frame_size / 2;
-        if(avctx->trellis > 0) {
-            uint8_t buf[2][n*2];
-            n *= 2;
-            if(avctx->channels == 1) {
-                adpcm_compress_trellis(avctx, samples, buf[0], &c->status[0], n);
-                for(i=0; i<n; i+=2)
-                    *dst++ = buf[0][i] | (buf[0][i+1] << 4);
-            } else {
-                adpcm_compress_trellis(avctx, samples, buf[0], &c->status[0], n);
-                adpcm_compress_trellis(avctx, samples+1, buf[1], &c->status[1], n);
-                for(i=0; i<n; i++)
-                    *dst++ = buf[0][i] | (buf[1][i] << 4);
-            }
-        } else
-            for (n *= avctx->channels; n>0; n--) {
-                int nibble;
-                nibble  = adpcm_yamaha_compress_sample(&c->status[ 0], *samples++);
-                nibble |= adpcm_yamaha_compress_sample(&c->status[st], *samples++) << 4;
-                *dst++ = nibble;
-            }
-        break;
-    default:
-        return -1;
-    }
-    return dst - frame;
-}
-#endif //CONFIG_ENCODERS
-
-static av_cold int adpcm_decode_init(AVCodecContext * avctx)
-{
-    ADPCMContext *c = avctx->priv_data;
-    unsigned int max_channels = 2;
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_ADPCM_EA_R1:
-    case CODEC_ID_ADPCM_EA_R2:
-    case CODEC_ID_ADPCM_EA_R3:
-        max_channels = 6;
-        break;
-    }
-    if(avctx->channels > max_channels){
-        return -1;
-    }
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_ADPCM_CT:
-        c->status[0].step = c->status[1].step = 511;
-        break;
-    case CODEC_ID_ADPCM_IMA_WS:
-        if (avctx->extradata && avctx->extradata_size == 2 * 4) {
-            c->status[0].predictor = AV_RL32(avctx->extradata);
-            c->status[1].predictor = AV_RL32(avctx->extradata + 4);
-        }
-        break;
-    default:
-        break;
-    }
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble, int shift)
-{
-    int step_index;
-    int predictor;
-    int sign, delta, diff, step;
-
-    step = step_table[c->step_index];
-    step_index = c->step_index + index_table[(unsigned)nibble];
-    if (step_index < 0) step_index = 0;
-    else if (step_index > 88) step_index = 88;
-
-    sign = nibble & 8;
-    delta = nibble & 7;
-    /* perform direct multiplication instead of series of jumps proposed by
-     * the reference ADPCM implementation since modern CPUs can do the mults
-     * quickly enough */
-    diff = ((2 * delta + 1) * step) >> shift;
-    predictor = c->predictor;
-    if (sign) predictor -= diff;
-    else predictor += diff;
-
-    c->predictor = av_clip_int16(predictor);
-    c->step_index = step_index;
-
-    return (short)c->predictor;
-}
-
-static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, char nibble)
-{
-    int predictor;
-
-    predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64;
-    predictor += (signed)((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta;
-
-    c->sample2 = c->sample1;
-    c->sample1 = av_clip_int16(predictor);
-    c->idelta = (AdaptationTable[(int)nibble] * c->idelta) >> 8;
-    if (c->idelta < 16) c->idelta = 16;
-
-    return c->sample1;
-}
-
-static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble)
-{
-    int sign, delta, diff;
-    int new_step;
-
-    sign = nibble & 8;
-    delta = nibble & 7;
-    /* perform direct multiplication instead of series of jumps proposed by
-     * the reference ADPCM implementation since modern CPUs can do the mults
-     * quickly enough */
-    diff = ((2 * delta + 1) * c->step) >> 3;
-    /* predictor update is not so trivial: predictor is multiplied on 254/256 before updating */
-    c->predictor = ((c->predictor * 254) >> 8) + (sign ? -diff : diff);
-    c->predictor = av_clip_int16(c->predictor);
-    /* calculate new step and clamp it to range 511..32767 */
-    new_step = (AdaptationTable[nibble & 7] * c->step) >> 8;
-    c->step = av_clip(new_step, 511, 32767);
-
-    return (short)c->predictor;
-}
-
-static inline short adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, char nibble, int size, int shift)
-{
-    int sign, delta, diff;
-
-    sign = nibble & (1<<(size-1));
-    delta = nibble & ((1<<(size-1))-1);
-    diff = delta << (7 + c->step + shift);
-
-    /* clamp result */
-    c->predictor = av_clip(c->predictor + (sign ? -diff : diff), -16384,16256);
-
-    /* calculate new step */
-    if (delta >= (2*size - 3) && c->step < 3)
-        c->step++;
-    else if (delta == 0 && c->step > 0)
-        c->step--;
-
-    return (short) c->predictor;
-}
-
-static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned char nibble)
-{
-    if(!c->step) {
-        c->predictor = 0;
-        c->step = 127;
-    }
-
-    c->predictor += (c->step * yamaha_difflookup[nibble]) / 8;
-    c->predictor = av_clip_int16(c->predictor);
-    c->step = (c->step * yamaha_indexscale[nibble]) >> 8;
-    c->step = av_clip(c->step, 127, 24567);
-    return c->predictor;
-}
-
-static void xa_decode(short *out, const unsigned char *in,
-    ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc)
-{
-    int i, j;
-    int shift,filter,f0,f1;
-    int s_1,s_2;
-    int d,s,t;
-
-    for(i=0;i<4;i++) {
-
-        shift  = 12 - (in[4+i*2] & 15);
-        filter = in[4+i*2] >> 4;
-        f0 = xa_adpcm_table[filter][0];
-        f1 = xa_adpcm_table[filter][1];
-
-        s_1 = left->sample1;
-        s_2 = left->sample2;
-
-        for(j=0;j<28;j++) {
-            d = in[16+i+j*4];
-
-            t = (signed char)(d<<4)>>4;
-            s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
-            s_2 = s_1;
-            s_1 = av_clip_int16(s);
-            *out = s_1;
-            out += inc;
-        }
-
-        if (inc==2) { /* stereo */
-            left->sample1 = s_1;
-            left->sample2 = s_2;
-            s_1 = right->sample1;
-            s_2 = right->sample2;
-            out = out + 1 - 28*2;
-        }
-
-        shift  = 12 - (in[5+i*2] & 15);
-        filter = in[5+i*2] >> 4;
-
-        f0 = xa_adpcm_table[filter][0];
-        f1 = xa_adpcm_table[filter][1];
-
-        for(j=0;j<28;j++) {
-            d = in[16+i+j*4];
-
-            t = (signed char)d >> 4;
-            s = ( t<<shift ) + ((s_1*f0 + s_2*f1+32)>>6);
-            s_2 = s_1;
-            s_1 = av_clip_int16(s);
-            *out = s_1;
-            out += inc;
-        }
-
-        if (inc==2) { /* stereo */
-            right->sample1 = s_1;
-            right->sample2 = s_2;
-            out -= 1;
-        } else {
-            left->sample1 = s_1;
-            left->sample2 = s_2;
-        }
-    }
-}
-
-
-/* DK3 ADPCM support macro */
-#define DK3_GET_NEXT_NIBBLE() \
-    if (decode_top_nibble_next) \
-    { \
-        nibble = last_byte >> 4; \
-        decode_top_nibble_next = 0; \
-    } \
-    else \
-    { \
-        last_byte = *src++; \
-        if (src >= buf + buf_size) break; \
-        nibble = last_byte & 0x0F; \
-        decode_top_nibble_next = 1; \
-    }
-
-static int adpcm_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    ADPCMContext *c = avctx->priv_data;
-    ADPCMChannelStatus *cs;
-    int n, m, channel, i;
-    int block_predictor[2];
-    short *samples;
-    short *samples_end;
-    const uint8_t *src;
-    int st; /* stereo */
-
-    /* DK3 ADPCM accounting variables */
-    unsigned char last_byte = 0;
-    unsigned char nibble;
-    int decode_top_nibble_next = 0;
-    int diff_channel;
-
-    /* EA ADPCM state variables */
-    uint32_t samples_in_chunk;
-    int32_t previous_left_sample, previous_right_sample;
-    int32_t current_left_sample, current_right_sample;
-    int32_t next_left_sample, next_right_sample;
-    int32_t coeff1l, coeff2l, coeff1r, coeff2r;
-    uint8_t shift_left, shift_right;
-    int count1, count2;
-    int coeff[2][2], shift[2];//used in EA MAXIS ADPCM
-
-    if (!buf_size)
-        return 0;
-
-    //should protect all 4bit ADPCM variants
-    //8 is needed for CODEC_ID_ADPCM_IMA_WAV with 2 channels
-    //
-    if(*data_size/4 < buf_size + 8)
-        return -1;
-
-    samples = data;
-    samples_end= samples + *data_size/2;
-    *data_size= 0;
-    src = buf;
-
-    st = avctx->channels == 2 ? 1 : 0;
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_ADPCM_IMA_QT:
-        n = buf_size - 2*avctx->channels;
-        for (channel = 0; channel < avctx->channels; channel++) {
-            cs = &(c->status[channel]);
-            /* (pppppp) (piiiiiii) */
-
-            /* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */
-            cs->predictor = (*src++) << 8;
-            cs->predictor |= (*src & 0x80);
-            cs->predictor &= 0xFF80;
-
-            /* sign extension */
-            if(cs->predictor & 0x8000)
-                cs->predictor -= 0x10000;
-
-            cs->predictor = av_clip_int16(cs->predictor);
-
-            cs->step_index = (*src++) & 0x7F;
-
-            if (cs->step_index > 88){
-                av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
-                cs->step_index = 88;
-            }
-
-            cs->step = step_table[cs->step_index];
-
-            samples = (short*)data + channel;
-
-            for(m=32; n>0 && m>0; n--, m--) { /* in QuickTime, IMA is encoded by chuncks of 34 bytes (=64 samples) */
-                *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3);
-                samples += avctx->channels;
-                *samples = adpcm_ima_expand_nibble(cs, src[0] >> 4  , 3);
-                samples += avctx->channels;
-                src ++;
-            }
-        }
-        if (st)
-            samples--;
-        break;
-    case CODEC_ID_ADPCM_IMA_WAV:
-        if (avctx->block_align != 0 && buf_size > avctx->block_align)
-            buf_size = avctx->block_align;
-
-//        samples_per_block= (block_align-4*chanels)*8 / (bits_per_sample * chanels) + 1;
-
-        for(i=0; i<avctx->channels; i++){
-            cs = &(c->status[i]);
-            cs->predictor = *samples++ = (int16_t)bytestream_get_le16(&src);
-
-            cs->step_index = *src++;
-            if (cs->step_index > 88){
-                av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
-                cs->step_index = 88;
-            }
-            if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); /* unused */
-        }
-
-        while(src < buf + buf_size){
-            for(m=0; m<4; m++){
-                for(i=0; i<=st; i++)
-                    *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3);
-                for(i=0; i<=st; i++)
-                    *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4  , 3);
-                src++;
-            }
-            src += 4*st;
-        }
-        break;
-    case CODEC_ID_ADPCM_4XM:
-        cs = &(c->status[0]);
-        c->status[0].predictor= (int16_t)bytestream_get_le16(&src);
-        if(st){
-            c->status[1].predictor= (int16_t)bytestream_get_le16(&src);
-        }
-        c->status[0].step_index= (int16_t)bytestream_get_le16(&src);
-        if(st){
-            c->status[1].step_index= (int16_t)bytestream_get_le16(&src);
-        }
-        if (cs->step_index < 0) cs->step_index = 0;
-        if (cs->step_index > 88) cs->step_index = 88;
-
-        m= (buf_size - (src - buf))>>st;
-        for(i=0; i<m; i++) {
-            *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] & 0x0F, 4);
-            if (st)
-                *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] & 0x0F, 4);
-            *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] >> 4, 4);
-            if (st)
-                *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] >> 4, 4);
-        }
-
-        src += m<<st;
-
-        break;
-    case CODEC_ID_ADPCM_MS:
-        if (avctx->block_align != 0 && buf_size > avctx->block_align)
-            buf_size = avctx->block_align;
-        n = buf_size - 7 * avctx->channels;
-        if (n < 0)
-            return -1;
-        block_predictor[0] = av_clip(*src++, 0, 6);
-        block_predictor[1] = 0;
-        if (st)
-            block_predictor[1] = av_clip(*src++, 0, 6);
-        c->status[0].idelta = (int16_t)bytestream_get_le16(&src);
-        if (st){
-            c->status[1].idelta = (int16_t)bytestream_get_le16(&src);
-        }
-        c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]];
-        c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]];
-        c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]];
-        c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]];
-
-        c->status[0].sample1 = bytestream_get_le16(&src);
-        if (st) c->status[1].sample1 = bytestream_get_le16(&src);
-        c->status[0].sample2 = bytestream_get_le16(&src);
-        if (st) c->status[1].sample2 = bytestream_get_le16(&src);
-
-        *samples++ = c->status[0].sample2;
-        if (st) *samples++ = c->status[1].sample2;
-        *samples++ = c->status[0].sample1;
-        if (st) *samples++ = c->status[1].sample1;
-        for(;n>0;n--) {
-            *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], src[0] >> 4  );
-            *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);
-            src ++;
-        }
-        break;
-    case CODEC_ID_ADPCM_IMA_DK4:
-        if (avctx->block_align != 0 && buf_size > avctx->block_align)
-            buf_size = avctx->block_align;
-
-        c->status[0].predictor  = (int16_t)bytestream_get_le16(&src);
-        c->status[0].step_index = *src++;
-        src++;
-        *samples++ = c->status[0].predictor;
-        if (st) {
-            c->status[1].predictor  = (int16_t)bytestream_get_le16(&src);
-            c->status[1].step_index = *src++;
-            src++;
-            *samples++ = c->status[1].predictor;
-        }
-        while (src < buf + buf_size) {
-
-            /* take care of the top nibble (always left or mono channel) */
-            *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                src[0] >> 4, 3);
-
-            /* take care of the bottom nibble, which is right sample for
-             * stereo, or another mono sample */
-            if (st)
-                *samples++ = adpcm_ima_expand_nibble(&c->status[1],
-                    src[0] & 0x0F, 3);
-            else
-                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                    src[0] & 0x0F, 3);
-
-            src++;
-        }
-        break;
-    case CODEC_ID_ADPCM_IMA_DK3:
-        if (avctx->block_align != 0 && buf_size > avctx->block_align)
-            buf_size = avctx->block_align;
-
-        if(buf_size + 16 > (samples_end - samples)*3/8)
-            return -1;
-
-        c->status[0].predictor  = (int16_t)AV_RL16(src + 10);
-        c->status[1].predictor  = (int16_t)AV_RL16(src + 12);
-        c->status[0].step_index = src[14];
-        c->status[1].step_index = src[15];
-        /* sign extend the predictors */
-        src += 16;
-        diff_channel = c->status[1].predictor;
-
-        /* the DK3_GET_NEXT_NIBBLE macro issues the break statement when
-         * the buffer is consumed */
-        while (1) {
-
-            /* for this algorithm, c->status[0] is the sum channel and
-             * c->status[1] is the diff channel */
-
-            /* process the first predictor of the sum channel */
-            DK3_GET_NEXT_NIBBLE();
-            adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
-
-            /* process the diff channel predictor */
-            DK3_GET_NEXT_NIBBLE();
-            adpcm_ima_expand_nibble(&c->status[1], nibble, 3);
-
-            /* process the first pair of stereo PCM samples */
-            diff_channel = (diff_channel + c->status[1].predictor) / 2;
-            *samples++ = c->status[0].predictor + c->status[1].predictor;
-            *samples++ = c->status[0].predictor - c->status[1].predictor;
-
-            /* process the second predictor of the sum channel */
-            DK3_GET_NEXT_NIBBLE();
-            adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
-
-            /* process the second pair of stereo PCM samples */
-            diff_channel = (diff_channel + c->status[1].predictor) / 2;
-            *samples++ = c->status[0].predictor + c->status[1].predictor;
-            *samples++ = c->status[0].predictor - c->status[1].predictor;
-        }
-        break;
-    case CODEC_ID_ADPCM_IMA_ISS:
-        c->status[0].predictor  = (int16_t)AV_RL16(src + 0);
-        c->status[0].step_index = src[2];
-        src += 4;
-        if(st) {
-            c->status[1].predictor  = (int16_t)AV_RL16(src + 0);
-            c->status[1].step_index = src[2];
-            src += 4;
-        }
-
-        while (src < buf + buf_size) {
-
-            if (st) {
-                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                    src[0] >> 4  , 3);
-                *samples++ = adpcm_ima_expand_nibble(&c->status[1],
-                    src[0] & 0x0F, 3);
-            } else {
-                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                    src[0] & 0x0F, 3);
-                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                    src[0] >> 4  , 3);
-            }
-
-            src++;
-        }
-        break;
-    case CODEC_ID_ADPCM_IMA_WS:
-        /* no per-block initialization; just start decoding the data */
-        while (src < buf + buf_size) {
-
-            if (st) {
-                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                    src[0] >> 4  , 3);
-                *samples++ = adpcm_ima_expand_nibble(&c->status[1],
-                    src[0] & 0x0F, 3);
-            } else {
-                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                    src[0] >> 4  , 3);
-                *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                    src[0] & 0x0F, 3);
-            }
-
-            src++;
-        }
-        break;
-    case CODEC_ID_ADPCM_XA:
-        while (buf_size >= 128) {
-            xa_decode(samples, src, &c->status[0], &c->status[1],
-                avctx->channels);
-            src += 128;
-            samples += 28 * 8;
-            buf_size -= 128;
-        }
-        break;
-    case CODEC_ID_ADPCM_IMA_EA_EACS:
-        samples_in_chunk = bytestream_get_le32(&src) >> (1-st);
-
-        if (samples_in_chunk > buf_size-4-(8<<st)) {
-            src += buf_size - 4;
-            break;
-        }
-
-        for (i=0; i<=st; i++)
-            c->status[i].step_index = bytestream_get_le32(&src);
-        for (i=0; i<=st; i++)
-            c->status[i].predictor  = bytestream_get_le32(&src);
-
-        for (; samples_in_chunk; samples_in_chunk--, src++) {
-            *samples++ = adpcm_ima_expand_nibble(&c->status[0],  *src>>4,   3);
-            *samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3);
-        }
-        break;
-    case CODEC_ID_ADPCM_IMA_EA_SEAD:
-        for (; src < buf+buf_size; src++) {
-            *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6);
-            *samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6);
-        }
-        break;
-    case CODEC_ID_ADPCM_EA:
-        if (buf_size < 4 || AV_RL32(src) >= ((buf_size - 12) * 2)) {
-            src += buf_size;
-            break;
-        }
-        samples_in_chunk = AV_RL32(src);
-        src += 4;
-        current_left_sample   = (int16_t)bytestream_get_le16(&src);
-        previous_left_sample  = (int16_t)bytestream_get_le16(&src);
-        current_right_sample  = (int16_t)bytestream_get_le16(&src);
-        previous_right_sample = (int16_t)bytestream_get_le16(&src);
-
-        for (count1 = 0; count1 < samples_in_chunk/28;count1++) {
-            coeff1l = ea_adpcm_table[ *src >> 4       ];
-            coeff2l = ea_adpcm_table[(*src >> 4  ) + 4];
-            coeff1r = ea_adpcm_table[*src & 0x0F];
-            coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
-            src++;
-
-            shift_left  = (*src >> 4  ) + 8;
-            shift_right = (*src & 0x0F) + 8;
-            src++;
-
-            for (count2 = 0; count2 < 28; count2++) {
-                next_left_sample  = (int32_t)((*src & 0xF0) << 24) >> shift_left;
-                next_right_sample = (int32_t)((*src & 0x0F) << 28) >> shift_right;
-                src++;
-
-                next_left_sample = (next_left_sample +
-                    (current_left_sample * coeff1l) +
-                    (previous_left_sample * coeff2l) + 0x80) >> 8;
-                next_right_sample = (next_right_sample +
-                    (current_right_sample * coeff1r) +
-                    (previous_right_sample * coeff2r) + 0x80) >> 8;
-
-                previous_left_sample = current_left_sample;
-                current_left_sample = av_clip_int16(next_left_sample);
-                previous_right_sample = current_right_sample;
-                current_right_sample = av_clip_int16(next_right_sample);
-                *samples++ = (unsigned short)current_left_sample;
-                *samples++ = (unsigned short)current_right_sample;
-            }
-        }
-
-        if (src - buf == buf_size - 2)
-            src += 2; // Skip terminating 0x0000
-
-        break;
-    case CODEC_ID_ADPCM_EA_MAXIS_XA:
-        for(channel = 0; channel < avctx->channels; channel++) {
-            for (i=0; i<2; i++)
-                coeff[channel][i] = ea_adpcm_table[(*src >> 4) + 4*i];
-            shift[channel] = (*src & 0x0F) + 8;
-            src++;
-        }
-        for (count1 = 0; count1 < (buf_size - avctx->channels) / avctx->channels; count1++) {
-            for(i = 4; i >= 0; i-=4) { /* Pairwise samples LL RR (st) or LL LL (mono) */
-                for(channel = 0; channel < avctx->channels; channel++) {
-                    int32_t sample = (int32_t)(((*(src+channel) >> i) & 0x0F) << 0x1C) >> shift[channel];
-                    sample = (sample +
-                             c->status[channel].sample1 * coeff[channel][0] +
-                             c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8;
-                    c->status[channel].sample2 = c->status[channel].sample1;
-                    c->status[channel].sample1 = av_clip_int16(sample);
-                    *samples++ = c->status[channel].sample1;
-                }
-            }
-            src+=avctx->channels;
-        }
-        break;
-    case CODEC_ID_ADPCM_EA_R1:
-    case CODEC_ID_ADPCM_EA_R2:
-    case CODEC_ID_ADPCM_EA_R3: {
-        /* channel numbering
-           2chan: 0=fl, 1=fr
-           4chan: 0=fl, 1=rl, 2=fr, 3=rr
-           6chan: 0=fl, 1=c,  2=fr, 3=rl,  4=rr, 5=sub */
-        const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3;
-        int32_t previous_sample, current_sample, next_sample;
-        int32_t coeff1, coeff2;
-        uint8_t shift;
-        unsigned int channel;
-        uint16_t *samplesC;
-        const uint8_t *srcC;
-        const uint8_t *src_end = buf + buf_size;
-
-        samples_in_chunk = (big_endian ? bytestream_get_be32(&src)
-                                       : bytestream_get_le32(&src)) / 28;
-        if (samples_in_chunk > UINT32_MAX/(28*avctx->channels) ||
-            28*samples_in_chunk*avctx->channels > samples_end-samples) {
-            src += buf_size - 4;
-            break;
-        }
-
-        for (channel=0; channel<avctx->channels; channel++) {
-            int32_t offset = (big_endian ? bytestream_get_be32(&src)
-                                         : bytestream_get_le32(&src))
-                           + (avctx->channels-channel-1) * 4;
-
-            if ((offset < 0) || (offset >= src_end - src - 4)) break;
-            srcC  = src + offset;
-            samplesC = samples + channel;
-
-            if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) {
-                current_sample  = (int16_t)bytestream_get_le16(&srcC);
-                previous_sample = (int16_t)bytestream_get_le16(&srcC);
-            } else {
-                current_sample  = c->status[channel].predictor;
-                previous_sample = c->status[channel].prev_sample;
-            }
-
-            for (count1=0; count1<samples_in_chunk; count1++) {
-                if (*srcC == 0xEE) {  /* only seen in R2 and R3 */
-                    srcC++;
-                    if (srcC > src_end - 30*2) break;
-                    current_sample  = (int16_t)bytestream_get_be16(&srcC);
-                    previous_sample = (int16_t)bytestream_get_be16(&srcC);
-
-                    for (count2=0; count2<28; count2++) {
-                        *samplesC = (int16_t)bytestream_get_be16(&srcC);
-                        samplesC += avctx->channels;
-                    }
-                } else {
-                    coeff1 = ea_adpcm_table[ *srcC>>4     ];
-                    coeff2 = ea_adpcm_table[(*srcC>>4) + 4];
-                    shift = (*srcC++ & 0x0F) + 8;
-
-                    if (srcC > src_end - 14) break;
-                    for (count2=0; count2<28; count2++) {
-                        if (count2 & 1)
-                            next_sample = (int32_t)((*srcC++ & 0x0F) << 28) >> shift;
-                        else
-                            next_sample = (int32_t)((*srcC   & 0xF0) << 24) >> shift;
-
-                        next_sample += (current_sample  * coeff1) +
-                                       (previous_sample * coeff2);
-                        next_sample = av_clip_int16(next_sample >> 8);
-
-                        previous_sample = current_sample;
-                        current_sample  = next_sample;
-                        *samplesC = current_sample;
-                        samplesC += avctx->channels;
-                    }
-                }
-            }
-
-            if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) {
-                c->status[channel].predictor   = current_sample;
-                c->status[channel].prev_sample = previous_sample;
-            }
-        }
-
-        src = src + buf_size - (4 + 4*avctx->channels);
-        samples += 28 * samples_in_chunk * avctx->channels;
-        break;
-    }
-    case CODEC_ID_ADPCM_EA_XAS:
-        if (samples_end-samples < 32*4*avctx->channels
-            || buf_size < (4+15)*4*avctx->channels) {
-            src += buf_size;
-            break;
-        }
-        for (channel=0; channel<avctx->channels; channel++) {
-            int coeff[2][4], shift[4];
-            short *s2, *s = &samples[channel];
-            for (n=0; n<4; n++, s+=32*avctx->channels) {
-                for (i=0; i<2; i++)
-                    coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i];
-                shift[n] = (src[2]&0x0F) + 8;
-                for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels)
-                    s2[0] = (src[0]&0xF0) + (src[1]<<8);
-            }
-
-            for (m=2; m<32; m+=2) {
-                s = &samples[m*avctx->channels + channel];
-                for (n=0; n<4; n++, src++, s+=32*avctx->channels) {
-                    for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) {
-                        int level = (int32_t)((*src & (0xF0>>i)) << (24+i)) >> shift[n];
-                        int pred  = s2[-1*avctx->channels] * coeff[0][n]
-                                  + s2[-2*avctx->channels] * coeff[1][n];
-                        s2[0] = av_clip_int16((level + pred + 0x80) >> 8);
-                    }
-                }
-            }
-        }
-        samples += 32*4*avctx->channels;
-        break;
-    case CODEC_ID_ADPCM_IMA_AMV:
-    case CODEC_ID_ADPCM_IMA_SMJPEG:
-        c->status[0].predictor = (int16_t)bytestream_get_le16(&src);
-        c->status[0].step_index = bytestream_get_le16(&src);
-
-        if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
-            src+=4;
-
-        while (src < buf + buf_size) {
-            char hi, lo;
-            lo = *src & 0x0F;
-            hi = *src >> 4;
-
-            if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
-                FFSWAP(char, hi, lo);
-
-            *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                lo, 3);
-            *samples++ = adpcm_ima_expand_nibble(&c->status[0],
-                hi, 3);
-            src++;
-        }
-        break;
-    case CODEC_ID_ADPCM_CT:
-        while (src < buf + buf_size) {
-            if (st) {
-                *samples++ = adpcm_ct_expand_nibble(&c->status[0],
-                    src[0] >> 4);
-                *samples++ = adpcm_ct_expand_nibble(&c->status[1],
-                    src[0] & 0x0F);
-            } else {
-                *samples++ = adpcm_ct_expand_nibble(&c->status[0],
-                    src[0] >> 4);
-                *samples++ = adpcm_ct_expand_nibble(&c->status[0],
-                    src[0] & 0x0F);
-            }
-            src++;
-        }
-        break;
-    case CODEC_ID_ADPCM_SBPRO_4:
-    case CODEC_ID_ADPCM_SBPRO_3:
-    case CODEC_ID_ADPCM_SBPRO_2:
-        if (!c->status[0].step_index) {
-            /* the first byte is a raw sample */
-            *samples++ = 128 * (*src++ - 0x80);
-            if (st)
-              *samples++ = 128 * (*src++ - 0x80);
-            c->status[0].step_index = 1;
-        }
-        if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) {
-            while (src < buf + buf_size) {
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
-                    src[0] >> 4, 4, 0);
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
-                    src[0] & 0x0F, 4, 0);
-                src++;
-            }
-        } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) {
-            while (src < buf + buf_size && samples + 2 < samples_end) {
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
-                     src[0] >> 5        , 3, 0);
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
-                    (src[0] >> 2) & 0x07, 3, 0);
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
-                    src[0] & 0x03, 2, 0);
-                src++;
-            }
-        } else {
-            while (src < buf + buf_size && samples + 3 < samples_end) {
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
-                     src[0] >> 6        , 2, 2);
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
-                    (src[0] >> 4) & 0x03, 2, 2);
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
-                    (src[0] >> 2) & 0x03, 2, 2);
-                *samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
-                    src[0] & 0x03, 2, 2);
-                src++;
-            }
-        }
-        break;
-    case CODEC_ID_ADPCM_SWF:
-    {
-        GetBitContext gb;
-        const int *table;
-        int k0, signmask, nb_bits, count;
-        int size = buf_size*8;
-
-        init_get_bits(&gb, buf, size);
-
-        //read bits & initial values
-        nb_bits = get_bits(&gb, 2)+2;
-        //av_log(NULL,AV_LOG_INFO,"nb_bits: %d\n", nb_bits);
-        table = swf_index_tables[nb_bits-2];
-        k0 = 1 << (nb_bits-2);
-        signmask = 1 << (nb_bits-1);
-
-        while (get_bits_count(&gb) <= size - 22*avctx->channels) {
-            for (i = 0; i < avctx->channels; i++) {
-                *samples++ = c->status[i].predictor = get_sbits(&gb, 16);
-                c->status[i].step_index = get_bits(&gb, 6);
-            }
-
-            for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
-                int i;
-
-                for (i = 0; i < avctx->channels; i++) {
-                    // similar to IMA adpcm
-                    int delta = get_bits(&gb, nb_bits);
-                    int step = step_table[c->status[i].step_index];
-                    long vpdiff = 0; // vpdiff = (delta+0.5)*step/4
-                    int k = k0;
-
-                    do {
-                        if (delta & k)
-                            vpdiff += step;
-                        step >>= 1;
-                        k >>= 1;
-                    } while(k);
-                    vpdiff += step;
-
-                    if (delta & signmask)
-                        c->status[i].predictor -= vpdiff;
-                    else
-                        c->status[i].predictor += vpdiff;
-
-                    c->status[i].step_index += table[delta & (~signmask)];
-
-                    c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
-                    c->status[i].predictor = av_clip_int16(c->status[i].predictor);
-
-                    *samples++ = c->status[i].predictor;
-                    if (samples >= samples_end) {
-                        av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n");
-                        return -1;
-                    }
-                }
-            }
-        }
-        src += buf_size;
-        break;
-    }
-    case CODEC_ID_ADPCM_YAMAHA:
-        while (src < buf + buf_size) {
-            if (st) {
-                *samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
-                        src[0] & 0x0F);
-                *samples++ = adpcm_yamaha_expand_nibble(&c->status[1],
-                        src[0] >> 4  );
-            } else {
-                *samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
-                        src[0] & 0x0F);
-                *samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
-                        src[0] >> 4  );
-            }
-            src++;
-        }
-        break;
-    case CODEC_ID_ADPCM_THP:
-    {
-        int table[2][16];
-        unsigned int samplecnt;
-        int prev[2][2];
-        int ch;
-
-        if (buf_size < 80) {
-            av_log(avctx, AV_LOG_ERROR, "frame too small\n");
-            return -1;
-        }
-
-        src+=4;
-        samplecnt = bytestream_get_be32(&src);
-
-        for (i = 0; i < 32; i++)
-            table[0][i] = (int16_t)bytestream_get_be16(&src);
-
-        /* Initialize the previous sample.  */
-        for (i = 0; i < 4; i++)
-            prev[0][i] = (int16_t)bytestream_get_be16(&src);
-
-        if (samplecnt >= (samples_end - samples) /  (st + 1)) {
-            av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n");
-            return -1;
-        }
-
-        for (ch = 0; ch <= st; ch++) {
-            samples = (unsigned short *) data + ch;
-
-            /* Read in every sample for this channel.  */
-            for (i = 0; i < samplecnt / 14; i++) {
-                int index = (*src >> 4) & 7;
-                unsigned int exp = 28 - (*src++ & 15);
-                int factor1 = table[ch][index * 2];
-                int factor2 = table[ch][index * 2 + 1];
-
-                /* Decode 14 samples.  */
-                for (n = 0; n < 14; n++) {
-                    int32_t sampledat;
-                    if(n&1) sampledat=  *src++    <<28;
-                    else    sampledat= (*src&0xF0)<<24;
-
-                    sampledat = ((prev[ch][0]*factor1
-                                + prev[ch][1]*factor2) >> 11) + (sampledat>>exp);
-                    *samples = av_clip_int16(sampledat);
-                    prev[ch][1] = prev[ch][0];
-                    prev[ch][0] = *samples++;
-
-                    /* In case of stereo, skip one sample, this sample
-                       is for the other channel.  */
-                    samples += st;
-                }
-            }
-        }
-
-        /* In the previous loop, in case stereo is used, samples is
-           increased exactly one time too often.  */
-        samples -= st;
-        break;
-    }
-
-    default:
-        return -1;
-    }
-    *data_size = (uint8_t *)samples - (uint8_t *)data;
-    return src - buf;
-}
-
-
-
-#if CONFIG_ENCODERS
-#define ADPCM_ENCODER(id,name,long_name_)       \
-AVCodec name ## _encoder = {                    \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    sizeof(ADPCMContext),                       \
-    adpcm_encode_init,                          \
-    adpcm_encode_frame,                         \
-    adpcm_encode_close,                         \
-    NULL,                                       \
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
-#else
-#define ADPCM_ENCODER(id,name,long_name_)
-#endif
-
-#if CONFIG_DECODERS
-#define ADPCM_DECODER(id,name,long_name_)       \
-AVCodec name ## _decoder = {                    \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    sizeof(ADPCMContext),                       \
-    adpcm_decode_init,                          \
-    NULL,                                       \
-    NULL,                                       \
-    adpcm_decode_frame,                         \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
-#else
-#define ADPCM_DECODER(id,name,long_name_)
-#endif
-
-#define ADPCM_CODEC(id,name,long_name_)         \
-    ADPCM_ENCODER(id,name,long_name_) ADPCM_DECODER(id,name,long_name_)
-
-/* Note: Do not forget to add new entries to the Makefile as well. */
-ADPCM_DECODER(CODEC_ID_ADPCM_4XM, adpcm_4xm, "ADPCM 4X Movie");
-ADPCM_DECODER(CODEC_ID_ADPCM_CT, adpcm_ct, "ADPCM Creative Technology");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA, adpcm_ea, "ADPCM Electronic Arts");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa, "ADPCM Electronic Arts Maxis CDROM XA");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_R1, adpcm_ea_r1, "ADPCM Electronic Arts R1");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2, "ADPCM Electronic Arts R2");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3, "ADPCM Electronic Arts R3");
-ADPCM_DECODER(CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas, "ADPCM Electronic Arts XAS");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv, "ADPCM IMA AMV");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3, "ADPCM IMA Duck DK3");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4, "ADPCM IMA Duck DK4");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_ISS, adpcm_ima_iss, "ADPCM IMA Funcom ISS");
-ADPCM_CODEC  (CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG");
-ADPCM_CODEC  (CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, "ADPCM IMA WAV");
-ADPCM_DECODER(CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws, "ADPCM IMA Westwood");
-ADPCM_CODEC  (CODEC_ID_ADPCM_MS, adpcm_ms, "ADPCM Microsoft");
-ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2, "ADPCM Sound Blaster Pro 2-bit");
-ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3, "ADPCM Sound Blaster Pro 2.6-bit");
-ADPCM_DECODER(CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4, "ADPCM Sound Blaster Pro 4-bit");
-ADPCM_CODEC  (CODEC_ID_ADPCM_SWF, adpcm_swf, "ADPCM Shockwave Flash");
-ADPCM_DECODER(CODEC_ID_ADPCM_THP, adpcm_thp, "ADPCM Nintendo Gamecube THP");
-ADPCM_DECODER(CODEC_ID_ADPCM_XA, adpcm_xa, "ADPCM CDROM XA");
-ADPCM_CODEC  (CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, "ADPCM Yamaha");
diff --git a/libavcodec/adx.h b/libavcodec/adx.h
deleted file mode 100644
index 0fa1003..0000000
--- a/libavcodec/adx.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ADX ADPCM codecs
- * Copyright (c) 2001,2003 BERO
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * SEGA CRI adx codecs.
- *
- * Reference documents:
- * http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html
- * adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/
- */
-
-#ifndef AVCODEC_ADX_H
-#define AVCODEC_ADX_H
-
-typedef struct {
-    int s1,s2;
-} PREV;
-
-typedef struct {
-    PREV prev[2];
-    int header_parsed;
-    unsigned char dec_temp[18*2];
-    int in_temp;
-} ADXContext;
-
-#define    BASEVOL   0x4000
-#define    SCALE1    0x7298
-#define    SCALE2    0x3350
-
-#endif /* AVCODEC_ADX_H */
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
deleted file mode 100644
index adb22fc..0000000
--- a/libavcodec/adxdec.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * ADX ADPCM codecs
- * Copyright (c) 2001,2003 BERO
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "adx.h"
-
-/**
- * @file
- * SEGA CRI adx codecs.
- *
- * Reference documents:
- * http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html
- * adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/
- */
-
-static av_cold int adx_decode_init(AVCodecContext *avctx)
-{
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-/* 18 bytes <-> 32 samples */
-
-static void adx_decode(short *out,const unsigned char *in,PREV *prev)
-{
-    int scale = AV_RB16(in);
-    int i;
-    int s0,s1,s2,d;
-
-//    printf("%x ",scale);
-
-    in+=2;
-    s1 = prev->s1;
-    s2 = prev->s2;
-    for(i=0;i<16;i++) {
-        d = in[i];
-        // d>>=4; if (d&8) d-=16;
-        d = ((signed char)d >> 4);
-        s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14;
-        s2 = s1;
-        s1 = av_clip_int16(s0);
-        *out++=s1;
-
-        d = in[i];
-        //d&=15; if (d&8) d-=16;
-        d = ((signed char)(d<<4) >> 4);
-        s0 = (BASEVOL*d*scale + SCALE1*s1 - SCALE2*s2)>>14;
-        s2 = s1;
-        s1 = av_clip_int16(s0);
-        *out++=s1;
-    }
-    prev->s1 = s1;
-    prev->s2 = s2;
-
-}
-
-static void adx_decode_stereo(short *out,const unsigned char *in,PREV *prev)
-{
-    short tmp[32*2];
-    int i;
-
-    adx_decode(tmp   ,in   ,prev);
-    adx_decode(tmp+32,in+18,prev+1);
-    for(i=0;i<32;i++) {
-        out[i*2]   = tmp[i];
-        out[i*2+1] = tmp[i+32];
-    }
-}
-
-/* return data offset or 0 */
-static int adx_decode_header(AVCodecContext *avctx,const unsigned char *buf,size_t bufsize)
-{
-    int offset;
-
-    if (buf[0]!=0x80) return 0;
-    offset = (AV_RB32(buf)^0x80000000)+4;
-    if (bufsize<offset || memcmp(buf+offset-6,"(c)CRI",6)) return 0;
-
-    avctx->channels    = buf[7];
-    avctx->sample_rate = AV_RB32(buf+8);
-    avctx->bit_rate    = avctx->sample_rate*avctx->channels*18*8/32;
-
-    return offset;
-}
-
-static int adx_decode_frame(AVCodecContext *avctx,
-                void *data, int *data_size,
-                AVPacket *avpkt)
-{
-    const uint8_t *buf0 = avpkt->data;
-    int buf_size = avpkt->size;
-    ADXContext *c = avctx->priv_data;
-    short *samples = data;
-    const uint8_t *buf = buf0;
-    int rest = buf_size;
-
-    if (!c->header_parsed) {
-        int hdrsize = adx_decode_header(avctx,buf,rest);
-        if (hdrsize==0) return -1;
-        c->header_parsed = 1;
-        buf  += hdrsize;
-        rest -= hdrsize;
-    }
-
-    /* 18 bytes of data are expanded into 32*2 bytes of audio,
-       so guard against buffer overflows */
-    if(rest/18 > *data_size/64)
-        rest = (*data_size/64) * 18;
-
-    if (c->in_temp) {
-        int copysize = 18*avctx->channels - c->in_temp;
-        memcpy(c->dec_temp+c->in_temp,buf,copysize);
-        rest -= copysize;
-        buf  += copysize;
-        if (avctx->channels==1) {
-            adx_decode(samples,c->dec_temp,c->prev);
-            samples += 32;
-        } else {
-            adx_decode_stereo(samples,c->dec_temp,c->prev);
-            samples += 32*2;
-        }
-    }
-    //
-    if (avctx->channels==1) {
-        while(rest>=18) {
-            adx_decode(samples,buf,c->prev);
-            rest-=18;
-            buf+=18;
-            samples+=32;
-        }
-    } else {
-        while(rest>=18*2) {
-            adx_decode_stereo(samples,buf,c->prev);
-            rest-=18*2;
-            buf+=18*2;
-            samples+=32*2;
-        }
-    }
-    //
-    c->in_temp = rest;
-    if (rest) {
-        memcpy(c->dec_temp,buf,rest);
-        buf+=rest;
-    }
-    *data_size = (uint8_t*)samples - (uint8_t*)data;
-//    printf("%d:%d ",buf-buf0,*data_size); fflush(stdout);
-    return buf-buf0;
-}
-
-AVCodec adpcm_adx_decoder = {
-    "adpcm_adx",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_ADPCM_ADX,
-    sizeof(ADXContext),
-    adx_decode_init,
-    NULL,
-    NULL,
-    adx_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
-};
-
diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
deleted file mode 100644
index 116b746..0000000
--- a/libavcodec/adxenc.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * ADX ADPCM codecs
- * Copyright (c) 2001,2003 BERO
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "adx.h"
-
-/**
- * @file
- * SEGA CRI adx codecs.
- *
- * Reference documents:
- * http://ku-www.ss.titech.ac.jp/~yatsushi/adx.html
- * adx2wav & wav2adx http://www.geocities.co.jp/Playtown/2004/
- */
-
-/* 18 bytes <-> 32 samples */
-
-static void adx_encode(unsigned char *adx,const short *wav,PREV *prev)
-{
-    int scale;
-    int i;
-    int s0,s1,s2,d;
-    int max=0;
-    int min=0;
-    int data[32];
-
-    s1 = prev->s1;
-    s2 = prev->s2;
-    for(i=0;i<32;i++) {
-        s0 = wav[i];
-        d = ((s0<<14) - SCALE1*s1 + SCALE2*s2)/BASEVOL;
-        data[i]=d;
-        if (max<d) max=d;
-        if (min>d) min=d;
-        s2 = s1;
-        s1 = s0;
-    }
-    prev->s1 = s1;
-    prev->s2 = s2;
-
-    /* -8..+7 */
-
-    if (max==0 && min==0) {
-        memset(adx,0,18);
-        return;
-    }
-
-    if (max/7>-min/8) scale = max/7;
-    else scale = -min/8;
-
-    if (scale==0) scale=1;
-
-    AV_WB16(adx, scale);
-
-    for(i=0;i<16;i++) {
-        adx[i+2] = ((data[i*2]/scale)<<4) | ((data[i*2+1]/scale)&0xf);
-    }
-}
-
-static int adx_encode_header(AVCodecContext *avctx,unsigned char *buf,size_t bufsize)
-{
-#if 0
-    struct {
-        uint32_t offset; /* 0x80000000 + sample start - 4 */
-        unsigned char unknown1[3]; /* 03 12 04 */
-        unsigned char channel; /* 1 or 2 */
-        uint32_t freq;
-        uint32_t size;
-        uint32_t unknown2; /* 01 f4 03 00 */
-        uint32_t unknown3; /* 00 00 00 00 */
-        uint32_t unknown4; /* 00 00 00 00 */
-
-    /* if loop
-        unknown3 00 15 00 01
-        unknown4 00 00 00 01
-        long loop_start_sample;
-        long loop_start_byte;
-        long loop_end_sample;
-        long loop_end_byte;
-        long
-    */
-    } adxhdr; /* big endian */
-    /* offset-6 "(c)CRI" */
-#endif
-    AV_WB32(buf+0x00,0x80000000|0x20);
-    AV_WB32(buf+0x04,0x03120400|avctx->channels);
-    AV_WB32(buf+0x08,avctx->sample_rate);
-    AV_WB32(buf+0x0c,0); /* FIXME: set after */
-    AV_WB32(buf+0x10,0x01040300);
-    AV_WB32(buf+0x14,0x00000000);
-    AV_WB32(buf+0x18,0x00000000);
-    memcpy(buf+0x1c,"\0\0(c)CRI",8);
-    return 0x20+4;
-}
-
-static av_cold int adx_encode_init(AVCodecContext *avctx)
-{
-    if (avctx->channels > 2)
-        return -1; /* only stereo or mono =) */
-    avctx->frame_size = 32;
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-//    avctx->bit_rate = avctx->sample_rate*avctx->channels*18*8/32;
-
-    av_log(avctx, AV_LOG_DEBUG, "adx encode init\n");
-
-    return 0;
-}
-
-static av_cold int adx_encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-static int adx_encode_frame(AVCodecContext *avctx,
-                uint8_t *frame, int buf_size, void *data)
-{
-    ADXContext *c = avctx->priv_data;
-    const short *samples = data;
-    unsigned char *dst = frame;
-    int rest = avctx->frame_size;
-
-/*
-    input data size =
-    ffmpeg.c: do_audio_out()
-    frame_bytes = enc->frame_size * 2 * enc->channels;
-*/
-
-//    printf("sz=%d ",buf_size); fflush(stdout);
-    if (!c->header_parsed) {
-        int hdrsize = adx_encode_header(avctx,dst,buf_size);
-        dst+=hdrsize;
-        c->header_parsed = 1;
-    }
-
-    if (avctx->channels==1) {
-        while(rest>=32) {
-            adx_encode(dst,samples,c->prev);
-            dst+=18;
-            samples+=32;
-            rest-=32;
-        }
-    } else {
-        while(rest>=32*2) {
-            short tmpbuf[32*2];
-            int i;
-
-            for(i=0;i<32;i++) {
-                tmpbuf[i] = samples[i*2];
-                tmpbuf[i+32] = samples[i*2+1];
-            }
-
-            adx_encode(dst,tmpbuf,c->prev);
-            adx_encode(dst+18,tmpbuf+32,c->prev+1);
-            dst+=18*2;
-            samples+=32*2;
-            rest-=32*2;
-        }
-    }
-    return dst-frame;
-}
-
-AVCodec adpcm_adx_encoder = {
-    "adpcm_adx",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_ADPCM_ADX,
-    sizeof(ADXContext),
-    adx_encode_init,
-    adx_encode_frame,
-    adx_encode_close,
-    NULL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
-};
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
deleted file mode 100644
index 50fc7a1..0000000
--- a/libavcodec/alac.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
- * ALAC (Apple Lossless Audio Codec) decoder
- * Copyright (c) 2005 David Hammerton
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * ALAC (Apple Lossless Audio Codec) decoder
- * @author 2005 David Hammerton
- *
- * For more information on the ALAC format, visit:
- *  http://crazney.net/programs/itunes/alac.html
- *
- * Note: This decoder expects a 36- (0x24-)byte QuickTime atom to be
- * passed through the extradata[_size] fields. This atom is tacked onto
- * the end of an 'alac' stsd atom and has the following format:
- *  bytes 0-3   atom size (0x24), big-endian
- *  bytes 4-7   atom type ('alac', not the 'alac' tag from start of stsd)
- *  bytes 8-35  data bytes needed by decoder
- *
- * Extradata:
- * 32bit  size
- * 32bit  tag (=alac)
- * 32bit  zero?
- * 32bit  max sample per frame
- *  8bit  ?? (zero?)
- *  8bit  sample size
- *  8bit  history mult
- *  8bit  initial history
- *  8bit  kmodifier
- *  8bit  channels?
- * 16bit  ??
- * 32bit  max coded frame size
- * 32bit  bitrate?
- * 32bit  samplerate
- */
-
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "bytestream.h"
-#include "unary.h"
-#include "mathops.h"
-
-#define ALAC_EXTRADATA_SIZE 36
-#define MAX_CHANNELS 2
-
-typedef struct {
-
-    AVCodecContext *avctx;
-    GetBitContext gb;
-    /* init to 0; first frame decode should initialize from extradata and
-     * set this to 1 */
-    int context_initialized;
-
-    int numchannels;
-    int bytespersample;
-
-    /* buffers */
-    int32_t *predicterror_buffer[MAX_CHANNELS];
-
-    int32_t *outputsamples_buffer[MAX_CHANNELS];
-
-    int32_t *wasted_bits_buffer[MAX_CHANNELS];
-
-    /* stuff from setinfo */
-    uint32_t setinfo_max_samples_per_frame; /* 0x1000 = 4096 */    /* max samples per frame? */
-    uint8_t setinfo_sample_size; /* 0x10 */
-    uint8_t setinfo_rice_historymult; /* 0x28 */
-    uint8_t setinfo_rice_initialhistory; /* 0x0a */
-    uint8_t setinfo_rice_kmodifier; /* 0x0e */
-    /* end setinfo stuff */
-
-    int wasted_bits;
-} ALACContext;
-
-static void allocate_buffers(ALACContext *alac)
-{
-    int chan;
-    for (chan = 0; chan < MAX_CHANNELS; chan++) {
-        alac->predicterror_buffer[chan] =
-            av_malloc(alac->setinfo_max_samples_per_frame * 4);
-
-        alac->outputsamples_buffer[chan] =
-            av_malloc(alac->setinfo_max_samples_per_frame * 4);
-
-        alac->wasted_bits_buffer[chan] = av_malloc(alac->setinfo_max_samples_per_frame * 4);
-    }
-}
-
-static int alac_set_info(ALACContext *alac)
-{
-    const unsigned char *ptr = alac->avctx->extradata;
-
-    ptr += 4; /* size */
-    ptr += 4; /* alac */
-    ptr += 4; /* 0 ? */
-
-    if(AV_RB32(ptr) >= UINT_MAX/4){
-        av_log(alac->avctx, AV_LOG_ERROR, "setinfo_max_samples_per_frame too large\n");
-        return -1;
-    }
-
-    /* buffer size / 2 ? */
-    alac->setinfo_max_samples_per_frame = bytestream_get_be32(&ptr);
-    ptr++;                          /* ??? */
-    alac->setinfo_sample_size           = *ptr++;
-    if (alac->setinfo_sample_size > 32) {
-        av_log(alac->avctx, AV_LOG_ERROR, "setinfo_sample_size too large\n");
-        return -1;
-    }
-    alac->setinfo_rice_historymult      = *ptr++;
-    alac->setinfo_rice_initialhistory   = *ptr++;
-    alac->setinfo_rice_kmodifier        = *ptr++;
-    ptr++;                         /* channels? */
-    bytestream_get_be16(&ptr);      /* ??? */
-    bytestream_get_be32(&ptr);      /* max coded frame size */
-    bytestream_get_be32(&ptr);      /* bitrate ? */
-    bytestream_get_be32(&ptr);      /* samplerate */
-
-    allocate_buffers(alac);
-
-    return 0;
-}
-
-static inline int decode_scalar(GetBitContext *gb, int k, int limit, int readsamplesize){
-    /* read x - number of 1s before 0 represent the rice */
-    int x = get_unary_0_9(gb);
-
-    if (x > 8) { /* RICE THRESHOLD */
-        /* use alternative encoding */
-        x = get_bits(gb, readsamplesize);
-    } else {
-        if (k >= limit)
-            k = limit;
-
-        if (k != 1) {
-            int extrabits = show_bits(gb, k);
-
-            /* multiply x by 2^k - 1, as part of their strange algorithm */
-            x = (x << k) - x;
-
-            if (extrabits > 1) {
-                x += extrabits - 1;
-                skip_bits(gb, k);
-            } else
-                skip_bits(gb, k - 1);
-        }
-    }
-    return x;
-}
-
-static void bastardized_rice_decompress(ALACContext *alac,
-                                 int32_t *output_buffer,
-                                 int output_size,
-                                 int readsamplesize, /* arg_10 */
-                                 int rice_initialhistory, /* arg424->b */
-                                 int rice_kmodifier, /* arg424->d */
-                                 int rice_historymult, /* arg424->c */
-                                 int rice_kmodifier_mask /* arg424->e */
-        )
-{
-    int output_count;
-    unsigned int history = rice_initialhistory;
-    int sign_modifier = 0;
-
-    for (output_count = 0; output_count < output_size; output_count++) {
-        int32_t x;
-        int32_t x_modified;
-        int32_t final_val;
-
-        /* standard rice encoding */
-        int k; /* size of extra bits */
-
-        /* read k, that is bits as is */
-        k = av_log2((history >> 9) + 3);
-        x= decode_scalar(&alac->gb, k, rice_kmodifier, readsamplesize);
-
-        x_modified = sign_modifier + x;
-        final_val = (x_modified + 1) / 2;
-        if (x_modified & 1) final_val *= -1;
-
-        output_buffer[output_count] = final_val;
-
-        sign_modifier = 0;
-
-        /* now update the history */
-        history += x_modified * rice_historymult
-                   - ((history * rice_historymult) >> 9);
-
-        if (x_modified > 0xffff)
-            history = 0xffff;
-
-        /* special case: there may be compressed blocks of 0 */
-        if ((history < 128) && (output_count+1 < output_size)) {
-            int k;
-            unsigned int block_size;
-
-            sign_modifier = 1;
-
-            k = 7 - av_log2(history) + ((history + 16) >> 6 /* / 64 */);
-
-            block_size= decode_scalar(&alac->gb, k, rice_kmodifier, 16);
-
-            if (block_size > 0) {
-                if(block_size >= output_size - output_count){
-                    av_log(alac->avctx, AV_LOG_ERROR, "invalid zero block size of %d %d %d\n", block_size, output_size, output_count);
-                    block_size= output_size - output_count - 1;
-                }
-                memset(&output_buffer[output_count+1], 0, block_size * 4);
-                output_count += block_size;
-            }
-
-            if (block_size > 0xffff)
-                sign_modifier = 0;
-
-            history = 0;
-        }
-    }
-}
-
-static inline int sign_only(int v)
-{
-    return v ? FFSIGN(v) : 0;
-}
-
-static void predictor_decompress_fir_adapt(int32_t *error_buffer,
-                                           int32_t *buffer_out,
-                                           int output_size,
-                                           int readsamplesize,
-                                           int16_t *predictor_coef_table,
-                                           int predictor_coef_num,
-                                           int predictor_quantitization)
-{
-    int i;
-
-    /* first sample always copies */
-    *buffer_out = *error_buffer;
-
-    if (!predictor_coef_num) {
-        if (output_size <= 1)
-            return;
-
-        memcpy(buffer_out+1, error_buffer+1, (output_size-1) * 4);
-        return;
-    }
-
-    if (predictor_coef_num == 0x1f) { /* 11111 - max value of predictor_coef_num */
-      /* second-best case scenario for fir decompression,
-       * error describes a small difference from the previous sample only
-       */
-        if (output_size <= 1)
-            return;
-        for (i = 0; i < output_size - 1; i++) {
-            int32_t prev_value;
-            int32_t error_value;
-
-            prev_value = buffer_out[i];
-            error_value = error_buffer[i+1];
-            buffer_out[i+1] =
-                sign_extend((prev_value + error_value), readsamplesize);
-        }
-        return;
-    }
-
-    /* read warm-up samples */
-    if (predictor_coef_num > 0)
-        for (i = 0; i < predictor_coef_num; i++) {
-            int32_t val;
-
-            val = buffer_out[i] + error_buffer[i+1];
-            val = sign_extend(val, readsamplesize);
-            buffer_out[i+1] = val;
-        }
-
-#if 0
-    /* 4 and 8 are very common cases (the only ones i've seen). these
-     * should be unrolled and optimized
-     */
-    if (predictor_coef_num == 4) {
-        /* FIXME: optimized general case */
-        return;
-    }
-
-    if (predictor_coef_table == 8) {
-        /* FIXME: optimized general case */
-        return;
-    }
-#endif
-
-    /* general case */
-    if (predictor_coef_num > 0) {
-        for (i = predictor_coef_num + 1; i < output_size; i++) {
-            int j;
-            int sum = 0;
-            int outval;
-            int error_val = error_buffer[i];
-
-            for (j = 0; j < predictor_coef_num; j++) {
-                sum += (buffer_out[predictor_coef_num-j] - buffer_out[0]) *
-                       predictor_coef_table[j];
-            }
-
-            outval = (1 << (predictor_quantitization-1)) + sum;
-            outval = outval >> predictor_quantitization;
-            outval = outval + buffer_out[0] + error_val;
-            outval = sign_extend(outval, readsamplesize);
-
-            buffer_out[predictor_coef_num+1] = outval;
-
-            if (error_val > 0) {
-                int predictor_num = predictor_coef_num - 1;
-
-                while (predictor_num >= 0 && error_val > 0) {
-                    int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
-                    int sign = sign_only(val);
-
-                    predictor_coef_table[predictor_num] -= sign;
-
-                    val *= sign; /* absolute value */
-
-                    error_val -= ((val >> predictor_quantitization) *
-                                  (predictor_coef_num - predictor_num));
-
-                    predictor_num--;
-                }
-            } else if (error_val < 0) {
-                int predictor_num = predictor_coef_num - 1;
-
-                while (predictor_num >= 0 && error_val < 0) {
-                    int val = buffer_out[0] - buffer_out[predictor_coef_num - predictor_num];
-                    int sign = - sign_only(val);
-
-                    predictor_coef_table[predictor_num] -= sign;
-
-                    val *= sign; /* neg value */
-
-                    error_val -= ((val >> predictor_quantitization) *
-                                  (predictor_coef_num - predictor_num));
-
-                    predictor_num--;
-                }
-            }
-
-            buffer_out++;
-        }
-    }
-}
-
-static void reconstruct_stereo_16(int32_t *buffer[MAX_CHANNELS],
-                                  int16_t *buffer_out,
-                                  int numchannels, int numsamples,
-                                  uint8_t interlacing_shift,
-                                  uint8_t interlacing_leftweight)
-{
-    int i;
-    if (numsamples <= 0)
-        return;
-
-    /* weighted interlacing */
-    if (interlacing_leftweight) {
-        for (i = 0; i < numsamples; i++) {
-            int32_t a, b;
-
-            a = buffer[0][i];
-            b = buffer[1][i];
-
-            a -= (b * interlacing_leftweight) >> interlacing_shift;
-            b += a;
-
-            buffer_out[i*numchannels] = b;
-            buffer_out[i*numchannels + 1] = a;
-        }
-
-        return;
-    }
-
-    /* otherwise basic interlacing took place */
-    for (i = 0; i < numsamples; i++) {
-        int16_t left, right;
-
-        left = buffer[0][i];
-        right = buffer[1][i];
-
-        buffer_out[i*numchannels] = left;
-        buffer_out[i*numchannels + 1] = right;
-    }
-}
-
-static void decorrelate_stereo_24(int32_t *buffer[MAX_CHANNELS],
-                                  int32_t *buffer_out,
-                                  int32_t *wasted_bits_buffer[MAX_CHANNELS],
-                                  int wasted_bits,
-                                  int numchannels, int numsamples,
-                                  uint8_t interlacing_shift,
-                                  uint8_t interlacing_leftweight)
-{
-    int i;
-
-    if (numsamples <= 0)
-        return;
-
-    /* weighted interlacing */
-    if (interlacing_leftweight) {
-        for (i = 0; i < numsamples; i++) {
-            int32_t a, b;
-
-            a = buffer[0][i];
-            b = buffer[1][i];
-
-            a -= (b * interlacing_leftweight) >> interlacing_shift;
-            b += a;
-
-            if (wasted_bits) {
-                b  = (b  << wasted_bits) | wasted_bits_buffer[0][i];
-                a  = (a  << wasted_bits) | wasted_bits_buffer[1][i];
-            }
-
-            buffer_out[i * numchannels]     = b << 8;
-            buffer_out[i * numchannels + 1] = a << 8;
-        }
-    } else {
-        for (i = 0; i < numsamples; i++) {
-            int32_t left, right;
-
-            left  = buffer[0][i];
-            right = buffer[1][i];
-
-            if (wasted_bits) {
-                left   = (left   << wasted_bits) | wasted_bits_buffer[0][i];
-                right  = (right  << wasted_bits) | wasted_bits_buffer[1][i];
-            }
-
-            buffer_out[i * numchannels]     = left  << 8;
-            buffer_out[i * numchannels + 1] = right << 8;
-        }
-    }
-}
-
-static int alac_decode_frame(AVCodecContext *avctx,
-                             void *outbuffer, int *outputsize,
-                             AVPacket *avpkt)
-{
-    const uint8_t *inbuffer = avpkt->data;
-    int input_buffer_size = avpkt->size;
-    ALACContext *alac = avctx->priv_data;
-
-    int channels;
-    unsigned int outputsamples;
-    int hassize;
-    unsigned int readsamplesize;
-    int isnotcompressed;
-    uint8_t interlacing_shift;
-    uint8_t interlacing_leftweight;
-
-    /* short-circuit null buffers */
-    if (!inbuffer || !input_buffer_size)
-        return input_buffer_size;
-
-    /* initialize from the extradata */
-    if (!alac->context_initialized) {
-        if (alac->avctx->extradata_size != ALAC_EXTRADATA_SIZE) {
-            av_log(avctx, AV_LOG_ERROR, "alac: expected %d extradata bytes\n",
-                ALAC_EXTRADATA_SIZE);
-            return input_buffer_size;
-        }
-        if (alac_set_info(alac)) {
-            av_log(avctx, AV_LOG_ERROR, "alac: set_info failed\n");
-            return input_buffer_size;
-        }
-        alac->context_initialized = 1;
-    }
-
-    init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8);
-
-    channels = get_bits(&alac->gb, 3) + 1;
-    if (channels > MAX_CHANNELS) {
-        av_log(avctx, AV_LOG_ERROR, "channels > %d not supported\n",
-               MAX_CHANNELS);
-        return input_buffer_size;
-    }
-
-    /* 2^result = something to do with output waiting.
-     * perhaps matters if we read > 1 frame in a pass?
-     */
-    skip_bits(&alac->gb, 4);
-
-    skip_bits(&alac->gb, 12); /* unknown, skip 12 bits */
-
-    /* the output sample size is stored soon */
-    hassize = get_bits1(&alac->gb);
-
-    alac->wasted_bits = get_bits(&alac->gb, 2) << 3;
-
-    /* whether the frame is compressed */
-    isnotcompressed = get_bits1(&alac->gb);
-
-    if (hassize) {
-        /* now read the number of samples as a 32bit integer */
-        outputsamples = get_bits_long(&alac->gb, 32);
-        if(outputsamples > alac->setinfo_max_samples_per_frame){
-            av_log(avctx, AV_LOG_ERROR, "outputsamples %d > %d\n", outputsamples, alac->setinfo_max_samples_per_frame);
-            return -1;
-        }
-    } else
-        outputsamples = alac->setinfo_max_samples_per_frame;
-
-    switch (alac->setinfo_sample_size) {
-    case 16: avctx->sample_fmt    = SAMPLE_FMT_S16;
-             alac->bytespersample = channels << 1;
-             break;
-    case 24: avctx->sample_fmt    = SAMPLE_FMT_S32;
-             alac->bytespersample = channels << 2;
-             break;
-    default: av_log(avctx, AV_LOG_ERROR, "Sample depth %d is not supported.\n",
-                    alac->setinfo_sample_size);
-             return -1;
-    }
-
-    if(outputsamples > *outputsize / alac->bytespersample){
-        av_log(avctx, AV_LOG_ERROR, "sample buffer too small\n");
-        return -1;
-    }
-
-    *outputsize = outputsamples * alac->bytespersample;
-    readsamplesize = alac->setinfo_sample_size - (alac->wasted_bits) + channels - 1;
-    if (readsamplesize > MIN_CACHE_BITS) {
-        av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize);
-        return -1;
-    }
-
-    if (!isnotcompressed) {
-        /* so it is compressed */
-        int16_t predictor_coef_table[channels][32];
-        int predictor_coef_num[channels];
-        int prediction_type[channels];
-        int prediction_quantitization[channels];
-        int ricemodifier[channels];
-        int i, chan;
-
-        interlacing_shift = get_bits(&alac->gb, 8);
-        interlacing_leftweight = get_bits(&alac->gb, 8);
-
-        for (chan = 0; chan < channels; chan++) {
-            prediction_type[chan] = get_bits(&alac->gb, 4);
-            prediction_quantitization[chan] = get_bits(&alac->gb, 4);
-
-            ricemodifier[chan] = get_bits(&alac->gb, 3);
-            predictor_coef_num[chan] = get_bits(&alac->gb, 5);
-
-            /* read the predictor table */
-            for (i = 0; i < predictor_coef_num[chan]; i++)
-                predictor_coef_table[chan][i] = (int16_t)get_bits(&alac->gb, 16);
-        }
-
-        if (alac->wasted_bits) {
-            int i, ch;
-            for (i = 0; i < outputsamples; i++) {
-                for (ch = 0; ch < channels; ch++)
-                    alac->wasted_bits_buffer[ch][i] = get_bits(&alac->gb, alac->wasted_bits);
-            }
-        }
-        for (chan = 0; chan < channels; chan++) {
-            bastardized_rice_decompress(alac,
-                                        alac->predicterror_buffer[chan],
-                                        outputsamples,
-                                        readsamplesize,
-                                        alac->setinfo_rice_initialhistory,
-                                        alac->setinfo_rice_kmodifier,
-                                        ricemodifier[chan] * alac->setinfo_rice_historymult / 4,
-                                        (1 << alac->setinfo_rice_kmodifier) - 1);
-
-            if (prediction_type[chan] == 0) {
-                /* adaptive fir */
-                predictor_decompress_fir_adapt(alac->predicterror_buffer[chan],
-                                               alac->outputsamples_buffer[chan],
-                                               outputsamples,
-                                               readsamplesize,
-                                               predictor_coef_table[chan],
-                                               predictor_coef_num[chan],
-                                               prediction_quantitization[chan]);
-            } else {
-                av_log(avctx, AV_LOG_ERROR, "FIXME: unhandled prediction type: %i\n", prediction_type[chan]);
-                /* I think the only other prediction type (or perhaps this is
-                 * just a boolean?) runs adaptive fir twice.. like:
-                 * predictor_decompress_fir_adapt(predictor_error, tempout, ...)
-                 * predictor_decompress_fir_adapt(predictor_error, outputsamples ...)
-                 * little strange..
-                 */
-            }
-        }
-    } else {
-        /* not compressed, easy case */
-        int i, chan;
-        if (alac->setinfo_sample_size <= 16) {
-        for (i = 0; i < outputsamples; i++)
-            for (chan = 0; chan < channels; chan++) {
-                int32_t audiobits;
-
-                audiobits = get_sbits_long(&alac->gb, alac->setinfo_sample_size);
-
-                alac->outputsamples_buffer[chan][i] = audiobits;
-            }
-        } else {
-            for (i = 0; i < outputsamples; i++) {
-                for (chan = 0; chan < channels; chan++) {
-                    alac->outputsamples_buffer[chan][i] = get_bits(&alac->gb,
-                                                          alac->setinfo_sample_size);
-                    alac->outputsamples_buffer[chan][i] = sign_extend(alac->outputsamples_buffer[chan][i],
-                                                                      alac->setinfo_sample_size);
-                }
-            }
-        }
-        alac->wasted_bits = 0;
-        interlacing_shift = 0;
-        interlacing_leftweight = 0;
-    }
-    if (get_bits(&alac->gb, 3) != 7)
-        av_log(avctx, AV_LOG_ERROR, "Error : Wrong End Of Frame\n");
-
-    switch(alac->setinfo_sample_size) {
-    case 16:
-        if (channels == 2) {
-            reconstruct_stereo_16(alac->outputsamples_buffer,
-                                  (int16_t*)outbuffer,
-                                  alac->numchannels,
-                                  outputsamples,
-                                  interlacing_shift,
-                                  interlacing_leftweight);
-        } else {
-            int i;
-            for (i = 0; i < outputsamples; i++) {
-                ((int16_t*)outbuffer)[i] = alac->outputsamples_buffer[0][i];
-            }
-        }
-        break;
-    case 24:
-        if (channels == 2) {
-            decorrelate_stereo_24(alac->outputsamples_buffer,
-                                  outbuffer,
-                                  alac->wasted_bits_buffer,
-                                  alac->wasted_bits,
-                                  alac->numchannels,
-                                  outputsamples,
-                                  interlacing_shift,
-                                  interlacing_leftweight);
-        } else {
-            int i;
-            for (i = 0; i < outputsamples; i++)
-                ((int32_t *)outbuffer)[i] = alac->outputsamples_buffer[0][i] << 8;
-        }
-        break;
-    }
-
-    if (input_buffer_size * 8 - get_bits_count(&alac->gb) > 8)
-        av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n", input_buffer_size * 8 - get_bits_count(&alac->gb));
-
-    return input_buffer_size;
-}
-
-static av_cold int alac_decode_init(AVCodecContext * avctx)
-{
-    ALACContext *alac = avctx->priv_data;
-    alac->avctx = avctx;
-    alac->context_initialized = 0;
-
-    alac->numchannels = alac->avctx->channels;
-
-    return 0;
-}
-
-static av_cold int alac_decode_close(AVCodecContext *avctx)
-{
-    ALACContext *alac = avctx->priv_data;
-
-    int chan;
-    for (chan = 0; chan < MAX_CHANNELS; chan++) {
-        av_freep(&alac->predicterror_buffer[chan]);
-        av_freep(&alac->outputsamples_buffer[chan]);
-        av_freep(&alac->wasted_bits_buffer[chan]);
-    }
-
-    return 0;
-}
-
-AVCodec alac_decoder = {
-    "alac",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_ALAC,
-    sizeof(ALACContext),
-    alac_decode_init,
-    NULL,
-    alac_decode_close,
-    alac_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
-};
diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c
deleted file mode 100644
index 0876633..0000000
--- a/libavcodec/alacenc.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/**
- * ALAC audio encoder
- * Copyright (c) 2008  Jaikrishnan Menon <realityman at gmx.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "put_bits.h"
-#include "dsputil.h"
-#include "lpc.h"
-#include "mathops.h"
-
-#define DEFAULT_FRAME_SIZE        4096
-#define DEFAULT_SAMPLE_SIZE       16
-#define MAX_CHANNELS              8
-#define ALAC_EXTRADATA_SIZE       36
-#define ALAC_FRAME_HEADER_SIZE    55
-#define ALAC_FRAME_FOOTER_SIZE    3
-
-#define ALAC_ESCAPE_CODE          0x1FF
-#define ALAC_MAX_LPC_ORDER        30
-#define DEFAULT_MAX_PRED_ORDER    6
-#define DEFAULT_MIN_PRED_ORDER    4
-#define ALAC_MAX_LPC_PRECISION    9
-#define ALAC_MAX_LPC_SHIFT        9
-
-#define ALAC_CHMODE_LEFT_RIGHT    0
-#define ALAC_CHMODE_LEFT_SIDE     1
-#define ALAC_CHMODE_RIGHT_SIDE    2
-#define ALAC_CHMODE_MID_SIDE      3
-
-typedef struct RiceContext {
-    int history_mult;
-    int initial_history;
-    int k_modifier;
-    int rice_modifier;
-} RiceContext;
-
-typedef struct LPCContext {
-    int lpc_order;
-    int lpc_coeff[ALAC_MAX_LPC_ORDER+1];
-    int lpc_quant;
-} LPCContext;
-
-typedef struct AlacEncodeContext {
-    int compression_level;
-    int min_prediction_order;
-    int max_prediction_order;
-    int max_coded_frame_size;
-    int write_sample_size;
-    int32_t sample_buf[MAX_CHANNELS][DEFAULT_FRAME_SIZE];
-    int32_t predictor_buf[DEFAULT_FRAME_SIZE];
-    int interlacing_shift;
-    int interlacing_leftweight;
-    PutBitContext pbctx;
-    RiceContext rc;
-    LPCContext lpc[MAX_CHANNELS];
-    DSPContext dspctx;
-    AVCodecContext *avctx;
-} AlacEncodeContext;
-
-
-static void init_sample_buffers(AlacEncodeContext *s, int16_t *input_samples)
-{
-    int ch, i;
-
-    for(ch=0;ch<s->avctx->channels;ch++) {
-        int16_t *sptr = input_samples + ch;
-        for(i=0;i<s->avctx->frame_size;i++) {
-            s->sample_buf[ch][i] = *sptr;
-            sptr += s->avctx->channels;
-        }
-    }
-}
-
-static void encode_scalar(AlacEncodeContext *s, int x, int k, int write_sample_size)
-{
-    int divisor, q, r;
-
-    k = FFMIN(k, s->rc.k_modifier);
-    divisor = (1<<k) - 1;
-    q = x / divisor;
-    r = x % divisor;
-
-    if(q > 8) {
-        // write escape code and sample value directly
-        put_bits(&s->pbctx, 9, ALAC_ESCAPE_CODE);
-        put_bits(&s->pbctx, write_sample_size, x);
-    } else {
-        if(q)
-            put_bits(&s->pbctx, q, (1<<q) - 1);
-        put_bits(&s->pbctx, 1, 0);
-
-        if(k != 1) {
-            if(r > 0)
-                put_bits(&s->pbctx, k, r+1);
-            else
-                put_bits(&s->pbctx, k-1, 0);
-        }
-    }
-}
-
-static void write_frame_header(AlacEncodeContext *s, int is_verbatim)
-{
-    put_bits(&s->pbctx, 3,  s->avctx->channels-1);          // No. of channels -1
-    put_bits(&s->pbctx, 16, 0);                             // Seems to be zero
-    put_bits(&s->pbctx, 1,  1);                             // Sample count is in the header
-    put_bits(&s->pbctx, 2,  0);                             // FIXME: Wasted bytes field
-    put_bits(&s->pbctx, 1,  is_verbatim);                   // Audio block is verbatim
-    put_bits32(&s->pbctx, s->avctx->frame_size);            // No. of samples in the frame
-}
-
-static void calc_predictor_params(AlacEncodeContext *s, int ch)
-{
-    int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER];
-    int shift[MAX_LPC_ORDER];
-    int opt_order;
-
-    if (s->compression_level == 1) {
-        s->lpc[ch].lpc_order = 6;
-        s->lpc[ch].lpc_quant = 6;
-        s->lpc[ch].lpc_coeff[0] =  160;
-        s->lpc[ch].lpc_coeff[1] = -190;
-        s->lpc[ch].lpc_coeff[2] =  170;
-        s->lpc[ch].lpc_coeff[3] = -130;
-        s->lpc[ch].lpc_coeff[4] =   80;
-        s->lpc[ch].lpc_coeff[5] =  -25;
-    } else {
-        opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch],
-                                      s->avctx->frame_size,
-                                      s->min_prediction_order,
-                                      s->max_prediction_order,
-                                      ALAC_MAX_LPC_PRECISION, coefs, shift, 1,
-                                      ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1);
-
-        s->lpc[ch].lpc_order = opt_order;
-        s->lpc[ch].lpc_quant = shift[opt_order-1];
-        memcpy(s->lpc[ch].lpc_coeff, coefs[opt_order-1], opt_order*sizeof(int));
-    }
-}
-
-static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
-{
-    int i, best;
-    int32_t lt, rt;
-    uint64_t sum[4];
-    uint64_t score[4];
-
-    /* calculate sum of 2nd order residual for each channel */
-    sum[0] = sum[1] = sum[2] = sum[3] = 0;
-    for(i=2; i<n; i++) {
-        lt = left_ch[i] - 2*left_ch[i-1] + left_ch[i-2];
-        rt = right_ch[i] - 2*right_ch[i-1] + right_ch[i-2];
-        sum[2] += FFABS((lt + rt) >> 1);
-        sum[3] += FFABS(lt - rt);
-        sum[0] += FFABS(lt);
-        sum[1] += FFABS(rt);
-    }
-
-    /* calculate score for each mode */
-    score[0] = sum[0] + sum[1];
-    score[1] = sum[0] + sum[3];
-    score[2] = sum[1] + sum[3];
-    score[3] = sum[2] + sum[3];
-
-    /* return mode with lowest score */
-    best = 0;
-    for(i=1; i<4; i++) {
-        if(score[i] < score[best]) {
-            best = i;
-        }
-    }
-    return best;
-}
-
-static void alac_stereo_decorrelation(AlacEncodeContext *s)
-{
-    int32_t *left = s->sample_buf[0], *right = s->sample_buf[1];
-    int i, mode, n = s->avctx->frame_size;
-    int32_t tmp;
-
-    mode = estimate_stereo_mode(left, right, n);
-
-    switch(mode)
-    {
-        case ALAC_CHMODE_LEFT_RIGHT:
-            s->interlacing_leftweight = 0;
-            s->interlacing_shift = 0;
-            break;
-
-        case ALAC_CHMODE_LEFT_SIDE:
-            for(i=0; i<n; i++) {
-                right[i] = left[i] - right[i];
-            }
-            s->interlacing_leftweight = 1;
-            s->interlacing_shift = 0;
-            break;
-
-        case ALAC_CHMODE_RIGHT_SIDE:
-            for(i=0; i<n; i++) {
-                tmp = right[i];
-                right[i] = left[i] - right[i];
-                left[i] = tmp + (right[i] >> 31);
-            }
-            s->interlacing_leftweight = 1;
-            s->interlacing_shift = 31;
-            break;
-
-        default:
-            for(i=0; i<n; i++) {
-                tmp = left[i];
-                left[i] = (tmp + right[i]) >> 1;
-                right[i] = tmp - right[i];
-            }
-            s->interlacing_leftweight = 1;
-            s->interlacing_shift = 1;
-            break;
-    }
-}
-
-static void alac_linear_predictor(AlacEncodeContext *s, int ch)
-{
-    int i;
-    LPCContext lpc = s->lpc[ch];
-
-    if(lpc.lpc_order == 31) {
-        s->predictor_buf[0] = s->sample_buf[ch][0];
-
-        for(i=1; i<s->avctx->frame_size; i++)
-            s->predictor_buf[i] = s->sample_buf[ch][i] - s->sample_buf[ch][i-1];
-
-        return;
-    }
-
-    // generalised linear predictor
-
-    if(lpc.lpc_order > 0) {
-        int32_t *samples  = s->sample_buf[ch];
-        int32_t *residual = s->predictor_buf;
-
-        // generate warm-up samples
-        residual[0] = samples[0];
-        for(i=1;i<=lpc.lpc_order;i++)
-            residual[i] = samples[i] - samples[i-1];
-
-        // perform lpc on remaining samples
-        for(i = lpc.lpc_order + 1; i < s->avctx->frame_size; i++) {
-            int sum = 1 << (lpc.lpc_quant - 1), res_val, j;
-
-            for (j = 0; j < lpc.lpc_order; j++) {
-                sum += (samples[lpc.lpc_order-j] - samples[0]) *
-                        lpc.lpc_coeff[j];
-            }
-
-            sum >>= lpc.lpc_quant;
-            sum += samples[0];
-            residual[i] = sign_extend(samples[lpc.lpc_order+1] - sum,
-                                      s->write_sample_size);
-            res_val = residual[i];
-
-            if(res_val) {
-                int index = lpc.lpc_order - 1;
-                int neg = (res_val < 0);
-
-                while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) {
-                    int val = samples[0] - samples[lpc.lpc_order - index];
-                    int sign = (val ? FFSIGN(val) : 0);
-
-                    if(neg)
-                        sign*=-1;
-
-                    lpc.lpc_coeff[index] -= sign;
-                    val *= sign;
-                    res_val -= ((val >> lpc.lpc_quant) *
-                            (lpc.lpc_order - index));
-                    index--;
-                }
-            }
-            samples++;
-        }
-    }
-}
-
-static void alac_entropy_coder(AlacEncodeContext *s)
-{
-    unsigned int history = s->rc.initial_history;
-    int sign_modifier = 0, i, k;
-    int32_t *samples = s->predictor_buf;
-
-    for(i=0;i < s->avctx->frame_size;) {
-        int x;
-
-        k = av_log2((history >> 9) + 3);
-
-        x = -2*(*samples)-1;
-        x ^= (x>>31);
-
-        samples++;
-        i++;
-
-        encode_scalar(s, x - sign_modifier, k, s->write_sample_size);
-
-        history += x * s->rc.history_mult
-                   - ((history * s->rc.history_mult) >> 9);
-
-        sign_modifier = 0;
-        if(x > 0xFFFF)
-            history = 0xFFFF;
-
-        if((history < 128) && (i < s->avctx->frame_size)) {
-            unsigned int block_size = 0;
-
-            k = 7 - av_log2(history) + ((history + 16) >> 6);
-
-            while((*samples == 0) && (i < s->avctx->frame_size)) {
-                samples++;
-                i++;
-                block_size++;
-            }
-            encode_scalar(s, block_size, k, 16);
-
-            sign_modifier = (block_size <= 0xFFFF);
-
-            history = 0;
-        }
-
-    }
-}
-
-static void write_compressed_frame(AlacEncodeContext *s)
-{
-    int i, j;
-
-    if(s->avctx->channels == 2)
-        alac_stereo_decorrelation(s);
-    put_bits(&s->pbctx, 8, s->interlacing_shift);
-    put_bits(&s->pbctx, 8, s->interlacing_leftweight);
-
-    for(i=0;i<s->avctx->channels;i++) {
-
-        calc_predictor_params(s, i);
-
-        put_bits(&s->pbctx, 4, 0);  // prediction type : currently only type 0 has been RE'd
-        put_bits(&s->pbctx, 4, s->lpc[i].lpc_quant);
-
-        put_bits(&s->pbctx, 3, s->rc.rice_modifier);
-        put_bits(&s->pbctx, 5, s->lpc[i].lpc_order);
-        // predictor coeff. table
-        for(j=0;j<s->lpc[i].lpc_order;j++) {
-            put_sbits(&s->pbctx, 16, s->lpc[i].lpc_coeff[j]);
-        }
-    }
-
-    // apply lpc and entropy coding to audio samples
-
-    for(i=0;i<s->avctx->channels;i++) {
-        alac_linear_predictor(s, i);
-        alac_entropy_coder(s);
-    }
-}
-
-static av_cold int alac_encode_init(AVCodecContext *avctx)
-{
-    AlacEncodeContext *s    = avctx->priv_data;
-    uint8_t *alac_extradata = av_mallocz(ALAC_EXTRADATA_SIZE+1);
-
-    avctx->frame_size      = DEFAULT_FRAME_SIZE;
-    avctx->bits_per_coded_sample = DEFAULT_SAMPLE_SIZE;
-
-    if(avctx->sample_fmt != SAMPLE_FMT_S16) {
-        av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n");
-        return -1;
-    }
-
-    // Set default compression level
-    if(avctx->compression_level == FF_COMPRESSION_DEFAULT)
-        s->compression_level = 2;
-    else
-        s->compression_level = av_clip(avctx->compression_level, 0, 2);
-
-    // Initialize default Rice parameters
-    s->rc.history_mult    = 40;
-    s->rc.initial_history = 10;
-    s->rc.k_modifier      = 14;
-    s->rc.rice_modifier   = 4;
-
-    s->max_coded_frame_size = 8 + (avctx->frame_size*avctx->channels*avctx->bits_per_coded_sample>>3);
-
-    s->write_sample_size  = avctx->bits_per_coded_sample + avctx->channels - 1; // FIXME: consider wasted_bytes
-
-    AV_WB32(alac_extradata,    ALAC_EXTRADATA_SIZE);
-    AV_WB32(alac_extradata+4,  MKBETAG('a','l','a','c'));
-    AV_WB32(alac_extradata+12, avctx->frame_size);
-    AV_WB8 (alac_extradata+17, avctx->bits_per_coded_sample);
-    AV_WB8 (alac_extradata+21, avctx->channels);
-    AV_WB32(alac_extradata+24, s->max_coded_frame_size);
-    AV_WB32(alac_extradata+28, avctx->sample_rate*avctx->channels*avctx->bits_per_coded_sample); // average bitrate
-    AV_WB32(alac_extradata+32, avctx->sample_rate);
-
-    // Set relevant extradata fields
-    if(s->compression_level > 0) {
-        AV_WB8(alac_extradata+18, s->rc.history_mult);
-        AV_WB8(alac_extradata+19, s->rc.initial_history);
-        AV_WB8(alac_extradata+20, s->rc.k_modifier);
-    }
-
-    s->min_prediction_order = DEFAULT_MIN_PRED_ORDER;
-    if(avctx->min_prediction_order >= 0) {
-        if(avctx->min_prediction_order < MIN_LPC_ORDER ||
-           avctx->min_prediction_order > ALAC_MAX_LPC_ORDER) {
-            av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n", avctx->min_prediction_order);
-                return -1;
-        }
-
-        s->min_prediction_order = avctx->min_prediction_order;
-    }
-
-    s->max_prediction_order = DEFAULT_MAX_PRED_ORDER;
-    if(avctx->max_prediction_order >= 0) {
-        if(avctx->max_prediction_order < MIN_LPC_ORDER ||
-           avctx->max_prediction_order > ALAC_MAX_LPC_ORDER) {
-            av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n", avctx->max_prediction_order);
-                return -1;
-        }
-
-        s->max_prediction_order = avctx->max_prediction_order;
-    }
-
-    if(s->max_prediction_order < s->min_prediction_order) {
-        av_log(avctx, AV_LOG_ERROR, "invalid prediction orders: min=%d max=%d\n",
-               s->min_prediction_order, s->max_prediction_order);
-        return -1;
-    }
-
-    avctx->extradata = alac_extradata;
-    avctx->extradata_size = ALAC_EXTRADATA_SIZE;
-
-    avctx->coded_frame = avcodec_alloc_frame();
-    avctx->coded_frame->key_frame = 1;
-
-    s->avctx = avctx;
-    dsputil_init(&s->dspctx, avctx);
-
-    return 0;
-}
-
-static int alac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
-                             int buf_size, void *data)
-{
-    AlacEncodeContext *s = avctx->priv_data;
-    PutBitContext *pb = &s->pbctx;
-    int i, out_bytes, verbatim_flag = 0;
-
-    if(avctx->frame_size > DEFAULT_FRAME_SIZE) {
-        av_log(avctx, AV_LOG_ERROR, "input frame size exceeded\n");
-        return -1;
-    }
-
-    if(buf_size < 2*s->max_coded_frame_size) {
-        av_log(avctx, AV_LOG_ERROR, "buffer size is too small\n");
-        return -1;
-    }
-
-verbatim:
-    init_put_bits(pb, frame, buf_size);
-
-    if((s->compression_level == 0) || verbatim_flag) {
-        // Verbatim mode
-        int16_t *samples = data;
-        write_frame_header(s, 1);
-        for(i=0; i<avctx->frame_size*avctx->channels; i++) {
-            put_sbits(pb, 16, *samples++);
-        }
-    } else {
-        init_sample_buffers(s, data);
-        write_frame_header(s, 0);
-        write_compressed_frame(s);
-    }
-
-    put_bits(pb, 3, 7);
-    flush_put_bits(pb);
-    out_bytes = put_bits_count(pb) >> 3;
-
-    if(out_bytes > s->max_coded_frame_size) {
-        /* frame too large. use verbatim mode */
-        if(verbatim_flag || (s->compression_level == 0)) {
-            /* still too large. must be an error. */
-            av_log(avctx, AV_LOG_ERROR, "error encoding frame\n");
-            return -1;
-        }
-        verbatim_flag = 1;
-        goto verbatim;
-    }
-
-    return out_bytes;
-}
-
-static av_cold int alac_encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->extradata);
-    avctx->extradata_size = 0;
-    av_freep(&avctx->coded_frame);
-    return 0;
-}
-
-AVCodec alac_encoder = {
-    "alac",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_ALAC,
-    sizeof(AlacEncodeContext),
-    alac_encode_init,
-    alac_encode_frame,
-    alac_encode_close,
-    .capabilities = CODEC_CAP_SMALL_LAST_FRAME,
-    .sample_fmts = (const enum SampleFormat[]){ SAMPLE_FMT_S16, SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
-};
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
deleted file mode 100644
index aa3001c..0000000
--- a/libavcodec/allcodecs.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * Provides registration of all codecs, parsers and bitstream filters for libavcodec.
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Provides registration of all codecs, parsers and bitstream filters for libavcodec.
- */
-
-#include "avcodec.h"
-
-#define REGISTER_HWACCEL(X,x) { \
-          extern AVHWAccel x##_hwaccel; \
-          if(CONFIG_##X##_HWACCEL) av_register_hwaccel(&x##_hwaccel); }
-
-#define REGISTER_ENCODER(X,x) { \
-          extern AVCodec x##_encoder; \
-          if(CONFIG_##X##_ENCODER)  avcodec_register(&x##_encoder); }
-#define REGISTER_DECODER(X,x) { \
-          extern AVCodec x##_decoder; \
-          if(CONFIG_##X##_DECODER)  avcodec_register(&x##_decoder); }
-#define REGISTER_ENCDEC(X,x)  REGISTER_ENCODER(X,x); REGISTER_DECODER(X,x)
-
-#define REGISTER_PARSER(X,x) { \
-          extern AVCodecParser x##_parser; \
-          if(CONFIG_##X##_PARSER)  av_register_codec_parser(&x##_parser); }
-#define REGISTER_BSF(X,x) { \
-          extern AVBitStreamFilter x##_bsf; \
-          if(CONFIG_##X##_BSF)     av_register_bitstream_filter(&x##_bsf); }
-
-void avcodec_register_all(void)
-{
-    static int initialized;
-
-    if (initialized)
-        return;
-    initialized = 1;
-
-    /* hardware accelerators */
-    REGISTER_HWACCEL (H263_VAAPI, h263_vaapi);
-    REGISTER_HWACCEL (H264_DXVA2, h264_dxva2);
-    REGISTER_HWACCEL (H264_VAAPI, h264_vaapi);
-    REGISTER_HWACCEL (MPEG2_VAAPI, mpeg2_vaapi);
-    REGISTER_HWACCEL (MPEG4_VAAPI, mpeg4_vaapi);
-    REGISTER_HWACCEL (VC1_DXVA2, vc1_dxva2);
-    REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi);
-    REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2);
-    REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi);
-
-    /* video codecs */
-    REGISTER_DECODER (AASC, aasc);
-    REGISTER_DECODER (AMV, amv);
-    REGISTER_DECODER (ANM, anm);
-    REGISTER_ENCDEC  (ASV1, asv1);
-    REGISTER_ENCDEC  (ASV2, asv2);
-    REGISTER_DECODER (AURA, aura);
-    REGISTER_DECODER (AURA2, aura2);
-    REGISTER_DECODER (AVS, avs);
-    REGISTER_DECODER (BETHSOFTVID, bethsoftvid);
-    REGISTER_DECODER (BFI, bfi);
-    REGISTER_DECODER (BINK, bink);
-    REGISTER_ENCDEC  (BMP, bmp);
-    REGISTER_DECODER (C93, c93);
-    REGISTER_DECODER (CAVS, cavs);
-    REGISTER_DECODER (CDGRAPHICS, cdgraphics);
-    REGISTER_DECODER (CINEPAK, cinepak);
-    REGISTER_DECODER (CLJR, cljr);
-    REGISTER_DECODER (CSCD, cscd);
-    REGISTER_DECODER (CYUV, cyuv);
-    REGISTER_ENCDEC  (DNXHD, dnxhd);
-    REGISTER_DECODER (DPX, dpx);
-    REGISTER_DECODER (DSICINVIDEO, dsicinvideo);
-    REGISTER_ENCDEC  (DVVIDEO, dvvideo);
-    REGISTER_DECODER (DXA, dxa);
-    REGISTER_DECODER (EACMV, eacmv);
-    REGISTER_DECODER (EAMAD, eamad);
-    REGISTER_DECODER (EATGQ, eatgq);
-    REGISTER_DECODER (EATGV, eatgv);
-    REGISTER_DECODER (EATQI, eatqi);
-    REGISTER_DECODER (EIGHTBPS, eightbps);
-    REGISTER_DECODER (EIGHTSVX_EXP, eightsvx_exp);
-    REGISTER_DECODER (EIGHTSVX_FIB, eightsvx_fib);
-    REGISTER_DECODER (ESCAPE124, escape124);
-    REGISTER_ENCDEC  (FFV1, ffv1);
-    REGISTER_ENCDEC  (FFVHUFF, ffvhuff);
-    REGISTER_ENCDEC  (FLASHSV, flashsv);
-    REGISTER_DECODER (FLIC, flic);
-    REGISTER_ENCDEC  (FLV, flv);
-    REGISTER_DECODER (FOURXM, fourxm);
-    REGISTER_DECODER (FRAPS, fraps);
-    REGISTER_DECODER (FRWU, frwu);
-    REGISTER_ENCDEC  (GIF, gif);
-    REGISTER_ENCDEC  (H261, h261);
-    REGISTER_ENCDEC  (H263, h263);
-    REGISTER_DECODER (H263I, h263i);
-    REGISTER_ENCODER (H263P, h263p);
-    REGISTER_DECODER (H264, h264);
-    REGISTER_DECODER (H264_VDPAU, h264_vdpau);
-    REGISTER_ENCDEC  (HUFFYUV, huffyuv);
-    REGISTER_DECODER (IDCIN, idcin);
-    REGISTER_DECODER (IFF_BYTERUN1, iff_byterun1);
-    REGISTER_DECODER (IFF_ILBM, iff_ilbm);
-    REGISTER_DECODER (INDEO2, indeo2);
-    REGISTER_DECODER (INDEO3, indeo3);
-    REGISTER_DECODER (INDEO5, indeo5);
-    REGISTER_DECODER (INTERPLAY_VIDEO, interplay_video);
-    REGISTER_ENCDEC  (JPEGLS, jpegls);
-    REGISTER_DECODER (KGV1, kgv1);
-    REGISTER_DECODER (KMVC, kmvc);
-    REGISTER_ENCODER (LJPEG, ljpeg);
-    REGISTER_DECODER (LOCO, loco);
-    REGISTER_DECODER (MDEC, mdec);
-    REGISTER_DECODER (MIMIC, mimic);
-    REGISTER_ENCDEC  (MJPEG, mjpeg);
-    REGISTER_DECODER (MJPEGB, mjpegb);
-    REGISTER_DECODER (MMVIDEO, mmvideo);
-    REGISTER_DECODER (MOTIONPIXELS, motionpixels);
-    REGISTER_DECODER (MPEG_XVMC, mpeg_xvmc);
-    REGISTER_ENCDEC  (MPEG1VIDEO, mpeg1video);
-    REGISTER_ENCDEC  (MPEG2VIDEO, mpeg2video);
-    REGISTER_ENCDEC  (MPEG4, mpeg4);
-    REGISTER_DECODER (MPEG4_VDPAU, mpeg4_vdpau);
-    REGISTER_DECODER (MPEGVIDEO, mpegvideo);
-    REGISTER_DECODER (MPEG_VDPAU, mpeg_vdpau);
-    REGISTER_DECODER (MPEG1_VDPAU, mpeg1_vdpau);
-    REGISTER_ENCDEC  (MSMPEG4V1, msmpeg4v1);
-    REGISTER_ENCDEC  (MSMPEG4V2, msmpeg4v2);
-    REGISTER_ENCDEC  (MSMPEG4V3, msmpeg4v3);
-    REGISTER_DECODER (MSRLE, msrle);
-    REGISTER_DECODER (MSVIDEO1, msvideo1);
-    REGISTER_DECODER (MSZH, mszh);
-    REGISTER_DECODER (NUV, nuv);
-    REGISTER_ENCDEC  (PAM, pam);
-    REGISTER_ENCDEC  (PBM, pbm);
-    REGISTER_ENCDEC  (PCX, pcx);
-    REGISTER_ENCDEC  (PGM, pgm);
-    REGISTER_ENCDEC  (PGMYUV, pgmyuv);
-    REGISTER_ENCDEC  (PNG, png);
-    REGISTER_ENCDEC  (PPM, ppm);
-    REGISTER_DECODER (PTX, ptx);
-    REGISTER_DECODER (QDRAW, qdraw);
-    REGISTER_DECODER (QPEG, qpeg);
-    REGISTER_ENCDEC  (QTRLE, qtrle);
-    REGISTER_DECODER (R210,  r210);
-    REGISTER_ENCDEC  (RAWVIDEO, rawvideo);
-    REGISTER_DECODER (RL2, rl2);
-    REGISTER_ENCDEC  (ROQ, roq);
-    REGISTER_DECODER (RPZA, rpza);
-    REGISTER_ENCDEC  (RV10, rv10);
-    REGISTER_ENCDEC  (RV20, rv20);
-    REGISTER_DECODER (RV30, rv30);
-    REGISTER_DECODER (RV40, rv40);
-    REGISTER_ENCDEC  (SGI, sgi);
-    REGISTER_DECODER (SMACKER, smacker);
-    REGISTER_DECODER (SMC, smc);
-    REGISTER_ENCDEC  (SNOW, snow);
-    REGISTER_DECODER (SP5X, sp5x);
-    REGISTER_DECODER (SUNRAST, sunrast);
-    REGISTER_ENCDEC  (SVQ1, svq1);
-    REGISTER_DECODER (SVQ3, svq3);
-    REGISTER_ENCDEC  (TARGA, targa);
-    REGISTER_DECODER (THEORA, theora);
-    REGISTER_DECODER (THP, thp);
-    REGISTER_DECODER (TIERTEXSEQVIDEO, tiertexseqvideo);
-    REGISTER_ENCDEC  (TIFF, tiff);
-    REGISTER_DECODER (TMV, tmv);
-    REGISTER_DECODER (TRUEMOTION1, truemotion1);
-    REGISTER_DECODER (TRUEMOTION2, truemotion2);
-    REGISTER_DECODER (TSCC, tscc);
-    REGISTER_DECODER (TXD, txd);
-    REGISTER_DECODER (ULTI, ulti);
-    REGISTER_ENCDEC  (V210,  v210);
-    REGISTER_DECODER (V210X, v210x);
-    REGISTER_DECODER (VB, vb);
-    REGISTER_DECODER (VC1, vc1);
-    REGISTER_DECODER (VC1_VDPAU, vc1_vdpau);
-    REGISTER_DECODER (VCR1, vcr1);
-    REGISTER_DECODER (VMDVIDEO, vmdvideo);
-    REGISTER_DECODER (VMNC, vmnc);
-    REGISTER_DECODER (VP3, vp3);
-    REGISTER_DECODER (VP5, vp5);
-    REGISTER_DECODER (VP6, vp6);
-    REGISTER_DECODER (VP6A, vp6a);
-    REGISTER_DECODER (VP6F, vp6f);
-    REGISTER_DECODER (VQA, vqa);
-    REGISTER_ENCDEC  (WMV1, wmv1);
-    REGISTER_ENCDEC  (WMV2, wmv2);
-    REGISTER_DECODER (WMV3, wmv3);
-    REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau);
-    REGISTER_DECODER (WNV1, wnv1);
-    REGISTER_DECODER (XAN_WC3, xan_wc3);
-    REGISTER_DECODER (XL, xl);
-    REGISTER_DECODER (YOP, yop);
-    REGISTER_ENCDEC  (ZLIB, zlib);
-    REGISTER_ENCDEC  (ZMBV, zmbv);
-
-    /* audio codecs */
-    REGISTER_ENCDEC  (AAC, aac);
-    REGISTER_ENCDEC  (AC3, ac3);
-    REGISTER_ENCDEC  (ALAC, alac);
-    REGISTER_DECODER (ALS, als);
-    REGISTER_DECODER (AMRNB, amrnb);
-    REGISTER_DECODER (APE, ape);
-    REGISTER_DECODER (ATRAC1, atrac1);
-    REGISTER_DECODER (ATRAC3, atrac3);
-    REGISTER_DECODER (BINKAUDIO_DCT, binkaudio_dct);
-    REGISTER_DECODER (BINKAUDIO_RDFT, binkaudio_rdft);
-    REGISTER_DECODER (COOK, cook);
-    REGISTER_DECODER (DCA, dca);
-    REGISTER_DECODER (DSICINAUDIO, dsicinaudio);
-    REGISTER_DECODER (EAC3, eac3);
-    REGISTER_ENCDEC  (FLAC, flac);
-    REGISTER_DECODER (IMC, imc);
-    REGISTER_DECODER (MACE3, mace3);
-    REGISTER_DECODER (MACE6, mace6);
-    REGISTER_DECODER (MLP, mlp);
-    REGISTER_DECODER (MP1, mp1);
-    REGISTER_ENCDEC  (MP2, mp2);
-    REGISTER_DECODER (MP3, mp3);
-    REGISTER_DECODER (MP3ADU, mp3adu);
-    REGISTER_DECODER (MP3ON4, mp3on4);
-    REGISTER_DECODER (MPC7, mpc7);
-    REGISTER_DECODER (MPC8, mpc8);
-    REGISTER_ENCDEC  (NELLYMOSER, nellymoser);
-    REGISTER_DECODER (QCELP, qcelp);
-    REGISTER_DECODER (QDM2, qdm2);
-    REGISTER_DECODER (RA_144, ra_144);
-    REGISTER_DECODER (RA_288, ra_288);
-    REGISTER_DECODER (SHORTEN, shorten);
-    REGISTER_DECODER (SIPR, sipr);
-    REGISTER_DECODER (SMACKAUD, smackaud);
-    REGISTER_ENCDEC  (SONIC, sonic);
-    REGISTER_ENCODER (SONIC_LS, sonic_ls);
-    REGISTER_DECODER (TRUEHD, truehd);
-    REGISTER_DECODER (TRUESPEECH, truespeech);
-    REGISTER_DECODER (TTA, tta);
-    REGISTER_DECODER (TWINVQ, twinvq);
-    REGISTER_DECODER (VMDAUDIO, vmdaudio);
-    REGISTER_DECODER  (VORBIS, vorbis);
-    REGISTER_DECODER (WAVPACK, wavpack);
-    REGISTER_DECODER (WMAPRO, wmapro);
-    REGISTER_ENCDEC  (WMAV1, wmav1);
-    REGISTER_ENCDEC  (WMAV2, wmav2);
-    REGISTER_DECODER (WMAVOICE, wmavoice);
-    REGISTER_DECODER (WS_SND1, ws_snd1);
-
-    /* PCM codecs */
-    REGISTER_ENCDEC  (PCM_ALAW, pcm_alaw);
-    REGISTER_DECODER (PCM_BLURAY, pcm_bluray);
-    REGISTER_DECODER (PCM_DVD, pcm_dvd);
-    REGISTER_ENCDEC  (PCM_F32BE, pcm_f32be);
-    REGISTER_ENCDEC  (PCM_F32LE, pcm_f32le);
-    REGISTER_ENCDEC  (PCM_F64BE, pcm_f64be);
-    REGISTER_ENCDEC  (PCM_F64LE, pcm_f64le);
-    REGISTER_ENCDEC  (PCM_MULAW, pcm_mulaw);
-    REGISTER_ENCDEC  (PCM_S8, pcm_s8);
-    REGISTER_ENCDEC  (PCM_S16BE, pcm_s16be);
-    REGISTER_ENCDEC  (PCM_S16LE, pcm_s16le);
-    REGISTER_DECODER (PCM_S16LE_PLANAR, pcm_s16le_planar);
-    REGISTER_ENCDEC  (PCM_S24BE, pcm_s24be);
-    REGISTER_ENCDEC  (PCM_S24DAUD, pcm_s24daud);
-    REGISTER_ENCDEC  (PCM_S24LE, pcm_s24le);
-    REGISTER_ENCDEC  (PCM_S32BE, pcm_s32be);
-    REGISTER_ENCDEC  (PCM_S32LE, pcm_s32le);
-    REGISTER_ENCDEC  (PCM_U8, pcm_u8);
-    REGISTER_ENCDEC  (PCM_U16BE, pcm_u16be);
-    REGISTER_ENCDEC  (PCM_U16LE, pcm_u16le);
-    REGISTER_ENCDEC  (PCM_U24BE, pcm_u24be);
-    REGISTER_ENCDEC  (PCM_U24LE, pcm_u24le);
-    REGISTER_ENCDEC  (PCM_U32BE, pcm_u32be);
-    REGISTER_ENCDEC  (PCM_U32LE, pcm_u32le);
-    REGISTER_ENCDEC  (PCM_ZORK , pcm_zork);
-
-    /* DPCM codecs */
-    REGISTER_DECODER (INTERPLAY_DPCM, interplay_dpcm);
-    REGISTER_ENCDEC  (ROQ_DPCM, roq_dpcm);
-    REGISTER_DECODER (SOL_DPCM, sol_dpcm);
-    REGISTER_DECODER (XAN_DPCM, xan_dpcm);
-
-    /* ADPCM codecs */
-    REGISTER_DECODER (ADPCM_4XM, adpcm_4xm);
-    REGISTER_ENCDEC  (ADPCM_ADX, adpcm_adx);
-    REGISTER_DECODER (ADPCM_CT, adpcm_ct);
-    REGISTER_DECODER (ADPCM_EA, adpcm_ea);
-    REGISTER_DECODER (ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
-    REGISTER_DECODER (ADPCM_EA_R1, adpcm_ea_r1);
-    REGISTER_DECODER (ADPCM_EA_R2, adpcm_ea_r2);
-    REGISTER_DECODER (ADPCM_EA_R3, adpcm_ea_r3);
-    REGISTER_DECODER (ADPCM_EA_XAS, adpcm_ea_xas);
-    REGISTER_ENCDEC  (ADPCM_G726, adpcm_g726);
-    REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv);
-    REGISTER_DECODER (ADPCM_IMA_DK3, adpcm_ima_dk3);
-    REGISTER_DECODER (ADPCM_IMA_DK4, adpcm_ima_dk4);
-    REGISTER_DECODER (ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
-    REGISTER_DECODER (ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
-    REGISTER_DECODER (ADPCM_IMA_ISS, adpcm_ima_iss);
-    REGISTER_ENCDEC  (ADPCM_IMA_QT, adpcm_ima_qt);
-    REGISTER_DECODER (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
-    REGISTER_ENCDEC  (ADPCM_IMA_WAV, adpcm_ima_wav);
-    REGISTER_DECODER (ADPCM_IMA_WS, adpcm_ima_ws);
-    REGISTER_ENCDEC  (ADPCM_MS, adpcm_ms);
-    REGISTER_DECODER (ADPCM_SBPRO_2, adpcm_sbpro_2);
-    REGISTER_DECODER (ADPCM_SBPRO_3, adpcm_sbpro_3);
-    REGISTER_DECODER (ADPCM_SBPRO_4, adpcm_sbpro_4);
-    REGISTER_ENCDEC  (ADPCM_SWF, adpcm_swf);
-    REGISTER_DECODER (ADPCM_THP, adpcm_thp);
-    REGISTER_DECODER (ADPCM_XA, adpcm_xa);
-    REGISTER_ENCDEC  (ADPCM_YAMAHA, adpcm_yamaha);
-
-    /* subtitles */
-    REGISTER_ENCDEC  (DVBSUB, dvbsub);
-    REGISTER_ENCDEC  (DVDSUB, dvdsub);
-    REGISTER_DECODER (PGSSUB, pgssub);
-    REGISTER_ENCDEC  (XSUB, xsub);
-
-    /* external libraries */
-    REGISTER_ENCDEC  (LIBDIRAC, libdirac);
-    REGISTER_ENCODER (LIBFAAC, libfaac);
-    REGISTER_DECODER (LIBFAAD, libfaad);
-    REGISTER_ENCDEC  (LIBGSM, libgsm);
-    REGISTER_ENCDEC  (LIBGSM_MS, libgsm_ms);
-    REGISTER_ENCODER (LIBMP3LAME, libmp3lame);
-    REGISTER_ENCDEC  (LIBOPENCORE_AMRNB, libopencore_amrnb);
-    REGISTER_DECODER (LIBOPENCORE_AMRWB, libopencore_amrwb);
-    REGISTER_DECODER (LIBOPENJPEG, libopenjpeg);
-    REGISTER_ENCDEC  (LIBSCHROEDINGER, libschroedinger);
-    REGISTER_DECODER (LIBSPEEX, libspeex);
-    REGISTER_ENCODER (LIBTHEORA, libtheora);
-    REGISTER_ENCODER (LIBVORBIS, libvorbis);
-    REGISTER_ENCDEC  (LIBVPX, libvpx);
-    REGISTER_ENCODER (LIBX264, libx264);
-    REGISTER_ENCODER (LIBXVID, libxvid);
-
-    /* parsers */
-    REGISTER_PARSER  (AAC, aac);
-    REGISTER_PARSER  (AC3, ac3);
-    REGISTER_PARSER  (CAVSVIDEO, cavsvideo);
-    REGISTER_PARSER  (DCA, dca);
-    REGISTER_PARSER  (DIRAC, dirac);
-    REGISTER_PARSER  (DNXHD, dnxhd);
-    REGISTER_PARSER  (DVBSUB, dvbsub);
-    REGISTER_PARSER  (DVDSUB, dvdsub);
-    REGISTER_PARSER  (H261, h261);
-    REGISTER_PARSER  (H263, h263);
-    REGISTER_PARSER  (H264, h264);
-    REGISTER_PARSER  (MJPEG, mjpeg);
-    REGISTER_PARSER  (MLP, mlp);
-    REGISTER_PARSER  (MPEG4VIDEO, mpeg4video);
-    REGISTER_PARSER  (MPEGAUDIO, mpegaudio);
-    REGISTER_PARSER  (MPEGVIDEO, mpegvideo);
-    REGISTER_PARSER  (PNM, pnm);
-    REGISTER_PARSER  (VC1, vc1);
-    REGISTER_PARSER  (VP3, vp3);
-
-    /* bitstream filters */
-    REGISTER_BSF     (AAC_ADTSTOASC, aac_adtstoasc);
-    REGISTER_BSF     (DUMP_EXTRADATA, dump_extradata);
-    REGISTER_BSF     (H264_MP4TOANNEXB, h264_mp4toannexb);
-    REGISTER_BSF     (IMX_DUMP_HEADER, imx_dump_header);
-    REGISTER_BSF     (MJPEGA_DUMP_HEADER, mjpega_dump_header);
-    REGISTER_BSF     (MP3_HEADER_COMPRESS, mp3_header_compress);
-    REGISTER_BSF     (MP3_HEADER_DECOMPRESS, mp3_header_decompress);
-    REGISTER_BSF     (MOV2TEXTSUB, mov2textsub);
-    REGISTER_BSF     (NOISE, noise);
-    REGISTER_BSF     (REMOVE_EXTRADATA, remove_extradata);
-    REGISTER_BSF     (TEXT2MOVSUB, text2movsub);
-}
-
diff --git a/libavcodec/alpha/Makefile b/libavcodec/alpha/Makefile
deleted file mode 100644
index 2779a23..0000000
--- a/libavcodec/alpha/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-OBJS                                   += alpha/dsputil_alpha.o         \
-                                          alpha/dsputil_alpha_asm.o     \
-                                          alpha/motion_est_alpha.o      \
-                                          alpha/motion_est_mvi_asm.o    \
-                                          alpha/mpegvideo_alpha.o       \
-                                          alpha/simple_idct_alpha.o     \
diff --git a/libavcodec/alpha/asm.h b/libavcodec/alpha/asm.h
deleted file mode 100644
index 827721e..0000000
--- a/libavcodec/alpha/asm.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Alpha optimized DSP utils
- * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ALPHA_ASM_H
-#define AVCODEC_ALPHA_ASM_H
-
-#include <inttypes.h>
-
-#include "libavutil/common.h"
-
-#if AV_GCC_VERSION_AT_LEAST(2,96)
-# define likely(x)      __builtin_expect((x) != 0, 1)
-# define unlikely(x)    __builtin_expect((x) != 0, 0)
-#else
-# define likely(x)      (x)
-# define unlikely(x)    (x)
-#endif
-
-#define AMASK_BWX (1 << 0)
-#define AMASK_FIX (1 << 1)
-#define AMASK_CIX (1 << 2)
-#define AMASK_MVI (1 << 8)
-
-static inline uint64_t BYTE_VEC(uint64_t x)
-{
-    x |= x <<  8;
-    x |= x << 16;
-    x |= x << 32;
-    return x;
-}
-static inline uint64_t WORD_VEC(uint64_t x)
-{
-    x |= x << 16;
-    x |= x << 32;
-    return x;
-}
-
-#define sextw(x) ((int16_t) (x))
-
-#ifdef __GNUC__
-#define ldq(p)                                                  \
-    (((const union {                                            \
-        uint64_t __l;                                           \
-        __typeof__(*(p)) __s[sizeof (uint64_t) / sizeof *(p)];  \
-    } *) (p))->__l)
-#define ldl(p)                                                  \
-    (((const union {                                            \
-        int32_t __l;                                            \
-        __typeof__(*(p)) __s[sizeof (int32_t) / sizeof *(p)];   \
-    } *) (p))->__l)
-#define stq(l, p)                                                       \
-    do {                                                                \
-        (((union {                                                      \
-            uint64_t __l;                                               \
-            __typeof__(*(p)) __s[sizeof (uint64_t) / sizeof *(p)];      \
-        } *) (p))->__l) = l;                                            \
-    } while (0)
-#define stl(l, p)                                                       \
-    do {                                                                \
-        (((union {                                                      \
-            int32_t __l;                                                \
-            __typeof__(*(p)) __s[sizeof (int32_t) / sizeof *(p)];       \
-        } *) (p))->__l) = l;                                            \
-    } while (0)
-struct unaligned_long { uint64_t l; } __attribute__((packed));
-#define ldq_u(p)        (*(const uint64_t *) (((uint64_t) (p)) & ~7ul))
-#define uldq(a)         (((const struct unaligned_long *) (a))->l)
-
-#if AV_GCC_VERSION_AT_LEAST(3,3)
-#define prefetch(p)     __builtin_prefetch((p), 0, 1)
-#define prefetch_en(p)  __builtin_prefetch((p), 0, 0)
-#define prefetch_m(p)   __builtin_prefetch((p), 1, 1)
-#define prefetch_men(p) __builtin_prefetch((p), 1, 0)
-#define cmpbge          __builtin_alpha_cmpbge
-/* Avoid warnings.  */
-#define extql(a, b)     __builtin_alpha_extql(a, (uint64_t) (b))
-#define extwl(a, b)     __builtin_alpha_extwl(a, (uint64_t) (b))
-#define extqh(a, b)     __builtin_alpha_extqh(a, (uint64_t) (b))
-#define zap             __builtin_alpha_zap
-#define zapnot          __builtin_alpha_zapnot
-#define amask           __builtin_alpha_amask
-#define implver         __builtin_alpha_implver
-#define rpcc            __builtin_alpha_rpcc
-#else
-#define prefetch(p)     __asm__ volatile("ldl $31,%0"  : : "m"(*(const char *) (p)) : "memory")
-#define prefetch_en(p)  __asm__ volatile("ldq $31,%0"  : : "m"(*(const char *) (p)) : "memory")
-#define prefetch_m(p)   __asm__ volatile("lds $f31,%0" : : "m"(*(const char *) (p)) : "memory")
-#define prefetch_men(p) __asm__ volatile("ldt $f31,%0" : : "m"(*(const char *) (p)) : "memory")
-#define cmpbge(a, b) ({ uint64_t __r; __asm__ ("cmpbge  %r1,%2,%0"  : "=r" (__r) : "rJ"  (a), "rI" (b)); __r; })
-#define extql(a, b)  ({ uint64_t __r; __asm__ ("extql   %r1,%2,%0"  : "=r" (__r) : "rJ"  (a), "rI" (b)); __r; })
-#define extwl(a, b)  ({ uint64_t __r; __asm__ ("extwl   %r1,%2,%0"  : "=r" (__r) : "rJ"  (a), "rI" (b)); __r; })
-#define extqh(a, b)  ({ uint64_t __r; __asm__ ("extqh   %r1,%2,%0"  : "=r" (__r) : "rJ"  (a), "rI" (b)); __r; })
-#define zap(a, b)    ({ uint64_t __r; __asm__ ("zap     %r1,%2,%0"  : "=r" (__r) : "rJ"  (a), "rI" (b)); __r; })
-#define zapnot(a, b) ({ uint64_t __r; __asm__ ("zapnot  %r1,%2,%0"  : "=r" (__r) : "rJ"  (a), "rI" (b)); __r; })
-#define amask(a)     ({ uint64_t __r; __asm__ ("amask   %1,%0"      : "=r" (__r) : "rI"  (a));           __r; })
-#define implver()    ({ uint64_t __r; __asm__ ("implver %0"         : "=r" (__r));                       __r; })
-#define rpcc()       ({ uint64_t __r; __asm__ volatile ("rpcc %0"   : "=r" (__r));                       __r; })
-#endif
-#define wh64(p) __asm__ volatile("wh64 (%0)" : : "r"(p) : "memory")
-
-#if AV_GCC_VERSION_AT_LEAST(3,3) && defined(__alpha_max__)
-#define minub8  __builtin_alpha_minub8
-#define minsb8  __builtin_alpha_minsb8
-#define minuw4  __builtin_alpha_minuw4
-#define minsw4  __builtin_alpha_minsw4
-#define maxub8  __builtin_alpha_maxub8
-#define maxsb8  __builtin_alpha_maxsb8
-#define maxuw4  __builtin_alpha_maxuw4
-#define maxsw4  __builtin_alpha_maxsw4
-#define perr    __builtin_alpha_perr
-#define pklb    __builtin_alpha_pklb
-#define pkwb    __builtin_alpha_pkwb
-#define unpkbl  __builtin_alpha_unpkbl
-#define unpkbw  __builtin_alpha_unpkbw
-#else
-#define minub8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minub8  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define minsb8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minsb8  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define minuw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minuw4  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define minsw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; minsw4  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxub8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxub8  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxsb8(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxsb8  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxuw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxuw4  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define maxsw4(a, b) ({ uint64_t __r; __asm__ (".arch ev6; maxsw4  %r1,%2,%0"  : "=r" (__r) : "%rJ" (a), "rI" (b)); __r; })
-#define perr(a, b)   ({ uint64_t __r; __asm__ (".arch ev6; perr    %r1,%r2,%0" : "=r" (__r) : "%rJ" (a), "rJ" (b)); __r; })
-#define pklb(a)      ({ uint64_t __r; __asm__ (".arch ev6; pklb    %r1,%0"     : "=r" (__r) : "rJ"  (a));           __r; })
-#define pkwb(a)      ({ uint64_t __r; __asm__ (".arch ev6; pkwb    %r1,%0"     : "=r" (__r) : "rJ"  (a));           __r; })
-#define unpkbl(a)    ({ uint64_t __r; __asm__ (".arch ev6; unpkbl  %r1,%0"     : "=r" (__r) : "rJ"  (a));           __r; })
-#define unpkbw(a)    ({ uint64_t __r; __asm__ (".arch ev6; unpkbw  %r1,%0"     : "=r" (__r) : "rJ"  (a));           __r; })
-#endif
-
-#elif defined(__DECC)           /* Digital/Compaq/hp "ccc" compiler */
-
-#include <c_asm.h>
-#define ldq(p) (*(const uint64_t *) (p))
-#define ldl(p) (*(const int32_t *)  (p))
-#define stq(l, p) do { *(uint64_t *) (p) = (l); } while (0)
-#define stl(l, p) do { *(int32_t *)  (p) = (l); } while (0)
-#define ldq_u(a)     asm ("ldq_u   %v0,0(%a0)", a)
-#define uldq(a)      (*(const __unaligned uint64_t *) (a))
-#define cmpbge(a, b) asm ("cmpbge  %a0,%a1,%v0", a, b)
-#define extql(a, b)  asm ("extql   %a0,%a1,%v0", a, b)
-#define extwl(a, b)  asm ("extwl   %a0,%a1,%v0", a, b)
-#define extqh(a, b)  asm ("extqh   %a0,%a1,%v0", a, b)
-#define zap(a, b)    asm ("zap     %a0,%a1,%v0", a, b)
-#define zapnot(a, b) asm ("zapnot  %a0,%a1,%v0", a, b)
-#define amask(a)     asm ("amask   %a0,%v0", a)
-#define implver()    asm ("implver %v0")
-#define rpcc()       asm ("rpcc           %v0")
-#define minub8(a, b) asm ("minub8  %a0,%a1,%v0", a, b)
-#define minsb8(a, b) asm ("minsb8  %a0,%a1,%v0", a, b)
-#define minuw4(a, b) asm ("minuw4  %a0,%a1,%v0", a, b)
-#define minsw4(a, b) asm ("minsw4  %a0,%a1,%v0", a, b)
-#define maxub8(a, b) asm ("maxub8  %a0,%a1,%v0", a, b)
-#define maxsb8(a, b) asm ("maxsb8  %a0,%a1,%v0", a, b)
-#define maxuw4(a, b) asm ("maxuw4  %a0,%a1,%v0", a, b)
-#define maxsw4(a, b) asm ("maxsw4  %a0,%a1,%v0", a, b)
-#define perr(a, b)   asm ("perr    %a0,%a1,%v0", a, b)
-#define pklb(a)      asm ("pklb    %a0,%v0", a)
-#define pkwb(a)      asm ("pkwb    %a0,%v0", a)
-#define unpkbl(a)    asm ("unpkbl  %a0,%v0", a)
-#define unpkbw(a)    asm ("unpkbw  %a0,%v0", a)
-#define wh64(a)      asm ("wh64    %a0", a)
-
-#else
-#error "Unknown compiler!"
-#endif
-
-#endif /* AVCODEC_ALPHA_ASM_H */
diff --git a/libavcodec/alpha/dsputil_alpha.c b/libavcodec/alpha/dsputil_alpha.c
deleted file mode 100644
index b87367f..0000000
--- a/libavcodec/alpha/dsputil_alpha.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Alpha optimized DSP utils
- * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_alpha.h"
-#include "asm.h"
-
-void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
-                                 int line_size);
-void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
-                                 int line_size);
-
-#if 0
-/* These functions were the base for the optimized assembler routines,
-   and remain here for documentation purposes.  */
-static void put_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels,
-                                   int line_size)
-{
-    int i = 8;
-    uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */
-
-    do {
-        uint64_t shorts0, shorts1;
-
-        shorts0 = ldq(block);
-        shorts0 = maxsw4(shorts0, 0);
-        shorts0 = minsw4(shorts0, clampmask);
-        stl(pkwb(shorts0), pixels);
-
-        shorts1 = ldq(block + 4);
-        shorts1 = maxsw4(shorts1, 0);
-        shorts1 = minsw4(shorts1, clampmask);
-        stl(pkwb(shorts1), pixels + 4);
-
-        pixels += line_size;
-        block += 8;
-    } while (--i);
-}
-
-void add_pixels_clamped_mvi(const DCTELEM *block, uint8_t *pixels,
-                            int line_size)
-{
-    int h = 8;
-    /* Keep this function a leaf function by generating the constants
-       manually (mainly for the hack value ;-).  */
-    uint64_t clampmask = zap(-1, 0xaa); /* 0x00ff00ff00ff00ff */
-    uint64_t signmask  = zap(-1, 0x33);
-    signmask ^= signmask >> 1;  /* 0x8000800080008000 */
-
-    do {
-        uint64_t shorts0, pix0, signs0;
-        uint64_t shorts1, pix1, signs1;
-
-        shorts0 = ldq(block);
-        shorts1 = ldq(block + 4);
-
-        pix0    = unpkbw(ldl(pixels));
-        /* Signed subword add (MMX paddw).  */
-        signs0  = shorts0 & signmask;
-        shorts0 &= ~signmask;
-        shorts0 += pix0;
-        shorts0 ^= signs0;
-        /* Clamp. */
-        shorts0 = maxsw4(shorts0, 0);
-        shorts0 = minsw4(shorts0, clampmask);
-
-        /* Next 4.  */
-        pix1    = unpkbw(ldl(pixels + 4));
-        signs1  = shorts1 & signmask;
-        shorts1 &= ~signmask;
-        shorts1 += pix1;
-        shorts1 ^= signs1;
-        shorts1 = maxsw4(shorts1, 0);
-        shorts1 = minsw4(shorts1, clampmask);
-
-        stl(pkwb(shorts0), pixels);
-        stl(pkwb(shorts1), pixels + 4);
-
-        pixels += line_size;
-        block += 8;
-    } while (--h);
-}
-#endif
-
-static void clear_blocks_axp(DCTELEM *blocks) {
-    uint64_t *p = (uint64_t *) blocks;
-    int n = sizeof(DCTELEM) * 6 * 64;
-
-    do {
-        p[0] = 0;
-        p[1] = 0;
-        p[2] = 0;
-        p[3] = 0;
-        p[4] = 0;
-        p[5] = 0;
-        p[6] = 0;
-        p[7] = 0;
-        p += 8;
-        n -= 8 * 8;
-    } while (n);
-}
-
-static inline uint64_t avg2_no_rnd(uint64_t a, uint64_t b)
-{
-    return (a & b) + (((a ^ b) & BYTE_VEC(0xfe)) >> 1);
-}
-
-static inline uint64_t avg2(uint64_t a, uint64_t b)
-{
-    return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1);
-}
-
-#if 0
-/* The XY2 routines basically utilize this scheme, but reuse parts in
-   each iteration.  */
-static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4)
-{
-    uint64_t r1 = ((l1 & ~BYTE_VEC(0x03)) >> 2)
-                + ((l2 & ~BYTE_VEC(0x03)) >> 2)
-                + ((l3 & ~BYTE_VEC(0x03)) >> 2)
-                + ((l4 & ~BYTE_VEC(0x03)) >> 2);
-    uint64_t r2 = ((  (l1 & BYTE_VEC(0x03))
-                    + (l2 & BYTE_VEC(0x03))
-                    + (l3 & BYTE_VEC(0x03))
-                    + (l4 & BYTE_VEC(0x03))
-                    + BYTE_VEC(0x02)) >> 2) & BYTE_VEC(0x03);
-    return r1 + r2;
-}
-#endif
-
-#define OP(LOAD, STORE)                         \
-    do {                                        \
-        STORE(LOAD(pixels), block);             \
-        pixels += line_size;                    \
-        block += line_size;                     \
-    } while (--h)
-
-#define OP_X2(LOAD, STORE)                                      \
-    do {                                                        \
-        uint64_t pix1, pix2;                                    \
-                                                                \
-        pix1 = LOAD(pixels);                                    \
-        pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56);        \
-        STORE(AVG2(pix1, pix2), block);                         \
-        pixels += line_size;                                    \
-        block += line_size;                                     \
-    } while (--h)
-
-#define OP_Y2(LOAD, STORE)                      \
-    do {                                        \
-        uint64_t pix = LOAD(pixels);            \
-        do {                                    \
-            uint64_t next_pix;                  \
-                                                \
-            pixels += line_size;                \
-            next_pix = LOAD(pixels);            \
-            STORE(AVG2(pix, next_pix), block);  \
-            block += line_size;                 \
-            pix = next_pix;                     \
-        } while (--h);                          \
-    } while (0)
-
-#define OP_XY2(LOAD, STORE)                                                 \
-    do {                                                                    \
-        uint64_t pix1 = LOAD(pixels);                                       \
-        uint64_t pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56);           \
-        uint64_t pix_l = (pix1 & BYTE_VEC(0x03))                            \
-                       + (pix2 & BYTE_VEC(0x03));                           \
-        uint64_t pix_h = ((pix1 & ~BYTE_VEC(0x03)) >> 2)                    \
-                       + ((pix2 & ~BYTE_VEC(0x03)) >> 2);                   \
-                                                                            \
-        do {                                                                \
-            uint64_t npix1, npix2;                                          \
-            uint64_t npix_l, npix_h;                                        \
-            uint64_t avg;                                                   \
-                                                                            \
-            pixels += line_size;                                            \
-            npix1 = LOAD(pixels);                                           \
-            npix2 = npix1 >> 8 | ((uint64_t) pixels[8] << 56);              \
-            npix_l = (npix1 & BYTE_VEC(0x03))                               \
-                   + (npix2 & BYTE_VEC(0x03));                              \
-            npix_h = ((npix1 & ~BYTE_VEC(0x03)) >> 2)                       \
-                   + ((npix2 & ~BYTE_VEC(0x03)) >> 2);                      \
-            avg = (((pix_l + npix_l + AVG4_ROUNDER) >> 2) & BYTE_VEC(0x03)) \
-                + pix_h + npix_h;                                           \
-            STORE(avg, block);                                              \
-                                                                            \
-            block += line_size;                                             \
-            pix_l = npix_l;                                                 \
-            pix_h = npix_h;                                                 \
-        } while (--h);                                                      \
-    } while (0)
-
-#define MAKE_OP(OPNAME, SUFF, OPKIND, STORE)                                \
-static void OPNAME ## _pixels ## SUFF ## _axp                               \
-        (uint8_t *restrict block, const uint8_t *restrict pixels,           \
-         int line_size, int h)                                              \
-{                                                                           \
-    if ((size_t) pixels & 0x7) {                                            \
-        OPKIND(uldq, STORE);                                                \
-    } else {                                                                \
-        OPKIND(ldq, STORE);                                                 \
-    }                                                                       \
-}                                                                           \
-                                                                            \
-static void OPNAME ## _pixels16 ## SUFF ## _axp                             \
-        (uint8_t *restrict block, const uint8_t *restrict pixels,           \
-         int line_size, int h)                                              \
-{                                                                           \
-    OPNAME ## _pixels ## SUFF ## _axp(block,     pixels,     line_size, h); \
-    OPNAME ## _pixels ## SUFF ## _axp(block + 8, pixels + 8, line_size, h); \
-}
-
-#define PIXOP(OPNAME, STORE)                    \
-    MAKE_OP(OPNAME, ,     OP,     STORE)        \
-    MAKE_OP(OPNAME, _x2,  OP_X2,  STORE)        \
-    MAKE_OP(OPNAME, _y2,  OP_Y2,  STORE)        \
-    MAKE_OP(OPNAME, _xy2, OP_XY2, STORE)
-
-/* Rounding primitives.  */
-#define AVG2 avg2
-#define AVG4 avg4
-#define AVG4_ROUNDER BYTE_VEC(0x02)
-#define STORE(l, b) stq(l, b)
-PIXOP(put, STORE);
-
-#undef STORE
-#define STORE(l, b) stq(AVG2(l, ldq(b)), b);
-PIXOP(avg, STORE);
-
-/* Not rounding primitives.  */
-#undef AVG2
-#undef AVG4
-#undef AVG4_ROUNDER
-#undef STORE
-#define AVG2 avg2_no_rnd
-#define AVG4 avg4_no_rnd
-#define AVG4_ROUNDER BYTE_VEC(0x01)
-#define STORE(l, b) stq(l, b)
-PIXOP(put_no_rnd, STORE);
-
-#undef STORE
-#define STORE(l, b) stq(AVG2(l, ldq(b)), b);
-PIXOP(avg_no_rnd, STORE);
-
-static void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels,
-                                 int line_size, int h)
-{
-    put_pixels_axp_asm(block,     pixels,     line_size, h);
-    put_pixels_axp_asm(block + 8, pixels + 8, line_size, h);
-}
-
-void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
-{
-    c->put_pixels_tab[0][0] = put_pixels16_axp_asm;
-    c->put_pixels_tab[0][1] = put_pixels16_x2_axp;
-    c->put_pixels_tab[0][2] = put_pixels16_y2_axp;
-    c->put_pixels_tab[0][3] = put_pixels16_xy2_axp;
-
-    c->put_no_rnd_pixels_tab[0][0] = put_pixels16_axp_asm;
-    c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_axp;
-    c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_axp;
-    c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_axp;
-
-    c->avg_pixels_tab[0][0] = avg_pixels16_axp;
-    c->avg_pixels_tab[0][1] = avg_pixels16_x2_axp;
-    c->avg_pixels_tab[0][2] = avg_pixels16_y2_axp;
-    c->avg_pixels_tab[0][3] = avg_pixels16_xy2_axp;
-
-    c->avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_axp;
-    c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_axp;
-    c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_axp;
-    c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_axp;
-
-    c->put_pixels_tab[1][0] = put_pixels_axp_asm;
-    c->put_pixels_tab[1][1] = put_pixels_x2_axp;
-    c->put_pixels_tab[1][2] = put_pixels_y2_axp;
-    c->put_pixels_tab[1][3] = put_pixels_xy2_axp;
-
-    c->put_no_rnd_pixels_tab[1][0] = put_pixels_axp_asm;
-    c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels_x2_axp;
-    c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels_y2_axp;
-    c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels_xy2_axp;
-
-    c->avg_pixels_tab[1][0] = avg_pixels_axp;
-    c->avg_pixels_tab[1][1] = avg_pixels_x2_axp;
-    c->avg_pixels_tab[1][2] = avg_pixels_y2_axp;
-    c->avg_pixels_tab[1][3] = avg_pixels_xy2_axp;
-
-    c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels_axp;
-    c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels_x2_axp;
-    c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels_y2_axp;
-    c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels_xy2_axp;
-
-    c->clear_blocks = clear_blocks_axp;
-
-    /* amask clears all bits that correspond to present features.  */
-    if (amask(AMASK_MVI) == 0) {
-        c->put_pixels_clamped = put_pixels_clamped_mvi_asm;
-        c->add_pixels_clamped = add_pixels_clamped_mvi_asm;
-
-        c->get_pixels       = get_pixels_mvi;
-        c->diff_pixels      = diff_pixels_mvi;
-        c->sad[0]           = pix_abs16x16_mvi_asm;
-        c->sad[1]           = pix_abs8x8_mvi;
-        c->pix_abs[0][0]    = pix_abs16x16_mvi_asm;
-        c->pix_abs[1][0]    = pix_abs8x8_mvi;
-        c->pix_abs[0][1]    = pix_abs16x16_x2_mvi;
-        c->pix_abs[0][2]    = pix_abs16x16_y2_mvi;
-        c->pix_abs[0][3]    = pix_abs16x16_xy2_mvi;
-    }
-
-    put_pixels_clamped_axp_p = c->put_pixels_clamped;
-    add_pixels_clamped_axp_p = c->add_pixels_clamped;
-
-    if (!avctx->lowres &&
-        (avctx->idct_algo == FF_IDCT_AUTO ||
-         avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
-        c->idct_put = ff_simple_idct_put_axp;
-        c->idct_add = ff_simple_idct_add_axp;
-        c->idct =     ff_simple_idct_axp;
-    }
-}
diff --git a/libavcodec/alpha/dsputil_alpha.h b/libavcodec/alpha/dsputil_alpha.h
deleted file mode 100644
index a3fa3dd..0000000
--- a/libavcodec/alpha/dsputil_alpha.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ALPHA_DSPUTIL_ALPHA_H
-#define AVCODEC_ALPHA_DSPUTIL_ALPHA_H
-
-#include "libavcodec/dsputil.h"
-
-void ff_simple_idct_axp(DCTELEM *block);
-void ff_simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block);
-
-void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels,
-                        int line_size, int h);
-void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels,
-                                int line_size);
-void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels,
-                                int line_size);
-extern void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
-                                        int line_size);
-extern void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
-                                        int line_size);
-
-void get_pixels_mvi(DCTELEM *restrict block,
-                    const uint8_t *restrict pixels, int line_size);
-void diff_pixels_mvi(DCTELEM *block, const uint8_t *s1, const uint8_t *s2,
-                     int stride);
-int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
-int pix_abs16x16_mvi_asm(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
-int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
-int pix_abs16x16_y2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
-int pix_abs16x16_xy2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
-
-
-#endif /* AVCODEC_ALPHA_DSPUTIL_ALPHA_H */
diff --git a/libavcodec/alpha/dsputil_alpha_asm.S b/libavcodec/alpha/dsputil_alpha_asm.S
deleted file mode 100644
index 57b21fc..0000000
--- a/libavcodec/alpha/dsputil_alpha_asm.S
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Alpha optimized DSP utils
- * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * These functions are scheduled for pca56. They should work
- * reasonably on ev6, though.
- */
-
-#include "regdef.h"
-
-/* Some nicer register names.  */
-#define ta t10
-#define tb t11
-#define tc t12
-#define td AT
-/* Danger: these overlap with the argument list and the return value */
-#define te a5
-#define tf a4
-#define tg a3
-#define th v0
-
-        .set noat
-        .set noreorder
-        .arch pca56
-        .text
-
-/************************************************************************
- * void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels,
- *                         int line_size, int h)
- */
-        .align 6
-        .globl put_pixels_axp_asm
-        .ent put_pixels_axp_asm
-put_pixels_axp_asm:
-        .frame sp, 0, ra
-        .prologue 0
-
-#if CONFIG_GPROF
-        lda     AT, _mcount
-        jsr     AT, (AT), _mcount
-#endif
-
-        and     a1, 7, t0
-        beq     t0, $aligned
-
-        .align 4
-$unaligned:
-        ldq_u   t0, 0(a1)
-        ldq_u   t1, 8(a1)
-        addq    a1, a2, a1
-        nop
-
-        ldq_u   t2, 0(a1)
-        ldq_u   t3, 8(a1)
-        addq    a1, a2, a1
-        nop
-
-        ldq_u   t4, 0(a1)
-        ldq_u   t5, 8(a1)
-        addq    a1, a2, a1
-        nop
-
-        ldq_u   t6, 0(a1)
-        ldq_u   t7, 8(a1)
-        extql   t0, a1, t0
-        addq    a1, a2, a1
-
-        extqh   t1, a1, t1
-        addq    a0, a2, t8
-        extql   t2, a1, t2
-        addq    t8, a2, t9
-
-        extqh   t3, a1, t3
-        addq    t9, a2, ta
-        extql   t4, a1, t4
-        or      t0, t1, t0
-
-        extqh   t5, a1, t5
-        or      t2, t3, t2
-        extql   t6, a1, t6
-        or      t4, t5, t4
-
-        extqh   t7, a1, t7
-        or      t6, t7, t6
-        stq     t0, 0(a0)
-        stq     t2, 0(t8)
-
-        stq     t4, 0(t9)
-        subq    a3, 4, a3
-        stq     t6, 0(ta)
-        addq    ta, a2, a0
-
-        bne     a3, $unaligned
-        ret
-
-        .align 4
-$aligned:
-        ldq     t0, 0(a1)
-        addq    a1, a2, a1
-        ldq     t1, 0(a1)
-        addq    a1, a2, a1
-
-        ldq     t2, 0(a1)
-        addq    a1, a2, a1
-        ldq     t3, 0(a1)
-
-        addq    a0, a2, t4
-        addq    a1, a2, a1
-        addq    t4, a2, t5
-        subq    a3, 4, a3
-
-        stq     t0, 0(a0)
-        addq    t5, a2, t6
-        stq     t1, 0(t4)
-        addq    t6, a2, a0
-
-        stq     t2, 0(t5)
-        stq     t3, 0(t6)
-
-        bne     a3, $aligned
-        ret
-        .end put_pixels_axp_asm
-
-/************************************************************************
- * void put_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels,
- *                                 int line_size)
- */
-        .align 6
-        .globl put_pixels_clamped_mvi_asm
-        .ent put_pixels_clamped_mvi_asm
-put_pixels_clamped_mvi_asm:
-        .frame sp, 0, ra
-        .prologue 0
-
-#if CONFIG_GPROF
-        lda     AT, _mcount
-        jsr     AT, (AT), _mcount
-#endif
-
-        lda     t8, -1
-        lda     t9, 8           # loop counter
-        zap     t8, 0xaa, t8    # 00ff00ff00ff00ff
-
-        .align 4
-1:      ldq     t0,  0(a0)
-        ldq     t1,  8(a0)
-        ldq     t2, 16(a0)
-        ldq     t3, 24(a0)
-
-        maxsw4  t0, zero, t0
-        subq    t9, 2, t9
-        maxsw4  t1, zero, t1
-        lda     a0, 32(a0)
-
-        maxsw4  t2, zero, t2
-        addq    a1, a2, ta
-        maxsw4  t3, zero, t3
-        minsw4  t0, t8, t0
-
-        minsw4  t1, t8, t1
-        minsw4  t2, t8, t2
-        minsw4  t3, t8, t3
-        pkwb    t0, t0
-
-        pkwb    t1, t1
-        pkwb    t2, t2
-        pkwb    t3, t3
-        stl     t0, 0(a1)
-
-        stl     t1, 4(a1)
-        addq    ta, a2, a1
-        stl     t2, 0(ta)
-        stl     t3, 4(ta)
-
-        bne     t9, 1b
-        ret
-        .end put_pixels_clamped_mvi_asm
-
-/************************************************************************
- * void add_pixels_clamped_mvi_asm(const DCTELEM *block, uint8_t *pixels,
- *                                 int line_size)
- */
-        .align 6
-        .globl add_pixels_clamped_mvi_asm
-        .ent add_pixels_clamped_mvi_asm
-add_pixels_clamped_mvi_asm:
-        .frame sp, 0, ra
-        .prologue 0
-
-#if CONFIG_GPROF
-        lda     AT, _mcount
-        jsr     AT, (AT), _mcount
-#endif
-
-        lda     t1, -1
-        lda     th, 8
-        zap     t1, 0x33, tg
-        nop
-
-        srl     tg, 1, t0
-        xor     tg, t0, tg      # 0x8000800080008000
-        zap     t1, 0xaa, tf    # 0x00ff00ff00ff00ff
-
-        .align 4
-1:      ldl     t1, 0(a1)       # pix0 (try to hit cache line soon)
-        ldl     t4, 4(a1)       # pix1
-        addq    a1, a2, te      # pixels += line_size
-        ldq     t0, 0(a0)       # shorts0
-
-        ldl     t7, 0(te)       # pix2 (try to hit cache line soon)
-        ldl     ta, 4(te)       # pix3
-        ldq     t3, 8(a0)       # shorts1
-        ldq     t6, 16(a0)      # shorts2
-
-        ldq     t9, 24(a0)      # shorts3
-        unpkbw  t1, t1          # 0 0 (quarter/op no.)
-        and     t0, tg, t2      # 0 1
-        unpkbw  t4, t4          # 1 0
-
-        bic     t0, tg, t0      # 0 2
-        unpkbw  t7, t7          # 2 0
-        and     t3, tg, t5      # 1 1
-        addq    t0, t1, t0      # 0 3
-
-        xor     t0, t2, t0      # 0 4
-        unpkbw  ta, ta          # 3 0
-        and     t6, tg, t8      # 2 1
-        maxsw4  t0, zero, t0    # 0 5
-
-        bic     t3, tg, t3      # 1 2
-        bic     t6, tg, t6      # 2 2
-        minsw4  t0, tf, t0      # 0 6
-        addq    t3, t4, t3      # 1 3
-
-        pkwb    t0, t0          # 0 7
-        xor     t3, t5, t3      # 1 4
-        maxsw4  t3, zero, t3    # 1 5
-        addq    t6, t7, t6      # 2 3
-
-        xor     t6, t8, t6      # 2 4
-        and     t9, tg, tb      # 3 1
-        minsw4  t3, tf, t3      # 1 6
-        bic     t9, tg, t9      # 3 2
-
-        maxsw4  t6, zero, t6    # 2 5
-        addq    t9, ta, t9      # 3 3
-        stl     t0, 0(a1)       # 0 8
-        minsw4  t6, tf, t6      # 2 6
-
-        xor     t9, tb, t9      # 3 4
-        maxsw4  t9, zero, t9    # 3 5
-        lda     a0, 32(a0)      # block += 16;
-        pkwb    t3, t3          # 1 7
-
-        minsw4  t9, tf, t9      # 3 6
-        subq    th, 2, th
-        pkwb    t6, t6          # 2 7
-        pkwb    t9, t9          # 3 7
-
-        stl     t3, 4(a1)       # 1 8
-        addq    te, a2, a1      # pixels += line_size
-        stl     t6, 0(te)       # 2 8
-        stl     t9, 4(te)       # 3 8
-
-        bne     th, 1b
-        ret
-        .end add_pixels_clamped_mvi_asm
diff --git a/libavcodec/alpha/motion_est_alpha.c b/libavcodec/alpha/motion_est_alpha.c
deleted file mode 100644
index 863dd23..0000000
--- a/libavcodec/alpha/motion_est_alpha.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Alpha optimized DSP utils
- * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_alpha.h"
-#include "asm.h"
-
-void get_pixels_mvi(DCTELEM *restrict block,
-                    const uint8_t *restrict pixels, int line_size)
-{
-    int h = 8;
-
-    do {
-        uint64_t p;
-
-        p = ldq(pixels);
-        stq(unpkbw(p),       block);
-        stq(unpkbw(p >> 32), block + 4);
-
-        pixels += line_size;
-        block += 8;
-    } while (--h);
-}
-
-void diff_pixels_mvi(DCTELEM *block, const uint8_t *s1, const uint8_t *s2,
-                     int stride) {
-    int h = 8;
-    uint64_t mask = 0x4040;
-
-    mask |= mask << 16;
-    mask |= mask << 32;
-    do {
-        uint64_t x, y, c, d, a;
-        uint64_t signs;
-
-        x = ldq(s1);
-        y = ldq(s2);
-        c = cmpbge(x, y);
-        d = x - y;
-        a = zap(mask, c);       /* We use 0x4040404040404040 here...  */
-        d += 4 * a;             /* ...so we can use s4addq here.      */
-        signs = zap(-1, c);
-
-        stq(unpkbw(d)       | (unpkbw(signs)       << 8), block);
-        stq(unpkbw(d >> 32) | (unpkbw(signs >> 32) << 8), block + 4);
-
-        s1 += stride;
-        s2 += stride;
-        block += 8;
-    } while (--h);
-}
-
-static inline uint64_t avg2(uint64_t a, uint64_t b)
-{
-    return (a | b) - (((a ^ b) & BYTE_VEC(0xfe)) >> 1);
-}
-
-static inline uint64_t avg4(uint64_t l1, uint64_t l2, uint64_t l3, uint64_t l4)
-{
-    uint64_t r1 = ((l1 & ~BYTE_VEC(0x03)) >> 2)
-                + ((l2 & ~BYTE_VEC(0x03)) >> 2)
-                + ((l3 & ~BYTE_VEC(0x03)) >> 2)
-                + ((l4 & ~BYTE_VEC(0x03)) >> 2);
-    uint64_t r2 = ((  (l1 & BYTE_VEC(0x03))
-                    + (l2 & BYTE_VEC(0x03))
-                    + (l3 & BYTE_VEC(0x03))
-                    + (l4 & BYTE_VEC(0x03))
-                    + BYTE_VEC(0x02)) >> 2) & BYTE_VEC(0x03);
-    return r1 + r2;
-}
-
-int pix_abs8x8_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int result = 0;
-
-    if ((size_t) pix2 & 0x7) {
-        /* works only when pix2 is actually unaligned */
-        do {                    /* do 8 pixel a time */
-            uint64_t p1, p2;
-
-            p1  = ldq(pix1);
-            p2  = uldq(pix2);
-            result += perr(p1, p2);
-
-            pix1 += line_size;
-            pix2 += line_size;
-        } while (--h);
-    } else {
-        do {
-            uint64_t p1, p2;
-
-            p1 = ldq(pix1);
-            p2 = ldq(pix2);
-            result += perr(p1, p2);
-
-            pix1 += line_size;
-            pix2 += line_size;
-        } while (--h);
-    }
-
-    return result;
-}
-
-#if 0                           /* now done in assembly */
-int pix_abs16x16_mvi(uint8_t *pix1, uint8_t *pix2, int line_size)
-{
-    int result = 0;
-    int h = 16;
-
-    if ((size_t) pix2 & 0x7) {
-        /* works only when pix2 is actually unaligned */
-        do {                    /* do 16 pixel a time */
-            uint64_t p1_l, p1_r, p2_l, p2_r;
-            uint64_t t;
-
-            p1_l  = ldq(pix1);
-            p1_r  = ldq(pix1 + 8);
-            t     = ldq_u(pix2 + 8);
-            p2_l  = extql(ldq_u(pix2), pix2) | extqh(t, pix2);
-            p2_r  = extql(t, pix2) | extqh(ldq_u(pix2 + 16), pix2);
-            pix1 += line_size;
-            pix2 += line_size;
-
-            result += perr(p1_l, p2_l)
-                    + perr(p1_r, p2_r);
-        } while (--h);
-    } else {
-        do {
-            uint64_t p1_l, p1_r, p2_l, p2_r;
-
-            p1_l = ldq(pix1);
-            p1_r = ldq(pix1 + 8);
-            p2_l = ldq(pix2);
-            p2_r = ldq(pix2 + 8);
-            pix1 += line_size;
-            pix2 += line_size;
-
-            result += perr(p1_l, p2_l)
-                    + perr(p1_r, p2_r);
-        } while (--h);
-    }
-
-    return result;
-}
-#endif
-
-int pix_abs16x16_x2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int result = 0;
-    uint64_t disalign = (size_t) pix2 & 0x7;
-
-    switch (disalign) {
-    case 0:
-        do {
-            uint64_t p1_l, p1_r, p2_l, p2_r;
-            uint64_t l, r;
-
-            p1_l = ldq(pix1);
-            p1_r = ldq(pix1 + 8);
-            l    = ldq(pix2);
-            r    = ldq(pix2 + 8);
-            p2_l = avg2(l, (l >> 8) | ((uint64_t) r << 56));
-            p2_r = avg2(r, (r >> 8) | ((uint64_t) pix2[16] << 56));
-            pix1 += line_size;
-            pix2 += line_size;
-
-            result += perr(p1_l, p2_l)
-                    + perr(p1_r, p2_r);
-        } while (--h);
-        break;
-    case 7:
-        /* |.......l|lllllllr|rrrrrrr*|
-           This case is special because disalign1 would be 8, which
-           gets treated as 0 by extqh.  At least it is a bit faster
-           that way :)  */
-        do {
-            uint64_t p1_l, p1_r, p2_l, p2_r;
-            uint64_t l, m, r;
-
-            p1_l = ldq(pix1);
-            p1_r = ldq(pix1 + 8);
-            l     = ldq_u(pix2);
-            m     = ldq_u(pix2 + 8);
-            r     = ldq_u(pix2 + 16);
-            p2_l  = avg2(extql(l, disalign) | extqh(m, disalign), m);
-            p2_r  = avg2(extql(m, disalign) | extqh(r, disalign), r);
-            pix1 += line_size;
-            pix2 += line_size;
-
-            result += perr(p1_l, p2_l)
-                    + perr(p1_r, p2_r);
-        } while (--h);
-        break;
-    default:
-        do {
-            uint64_t disalign1 = disalign + 1;
-            uint64_t p1_l, p1_r, p2_l, p2_r;
-            uint64_t l, m, r;
-
-            p1_l  = ldq(pix1);
-            p1_r  = ldq(pix1 + 8);
-            l     = ldq_u(pix2);
-            m     = ldq_u(pix2 + 8);
-            r     = ldq_u(pix2 + 16);
-            p2_l  = avg2(extql(l, disalign) | extqh(m, disalign),
-                         extql(l, disalign1) | extqh(m, disalign1));
-            p2_r  = avg2(extql(m, disalign) | extqh(r, disalign),
-                         extql(m, disalign1) | extqh(r, disalign1));
-            pix1 += line_size;
-            pix2 += line_size;
-
-            result += perr(p1_l, p2_l)
-                    + perr(p1_r, p2_r);
-        } while (--h);
-        break;
-    }
-    return result;
-}
-
-int pix_abs16x16_y2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int result = 0;
-
-    if ((size_t) pix2 & 0x7) {
-        uint64_t t, p2_l, p2_r;
-        t     = ldq_u(pix2 + 8);
-        p2_l  = extql(ldq_u(pix2), pix2) | extqh(t, pix2);
-        p2_r  = extql(t, pix2) | extqh(ldq_u(pix2 + 16), pix2);
-
-        do {
-            uint64_t p1_l, p1_r, np2_l, np2_r;
-            uint64_t t;
-
-            p1_l  = ldq(pix1);
-            p1_r  = ldq(pix1 + 8);
-            pix2 += line_size;
-            t     = ldq_u(pix2 + 8);
-            np2_l = extql(ldq_u(pix2), pix2) | extqh(t, pix2);
-            np2_r = extql(t, pix2) | extqh(ldq_u(pix2 + 16), pix2);
-
-            result += perr(p1_l, avg2(p2_l, np2_l))
-                    + perr(p1_r, avg2(p2_r, np2_r));
-
-            pix1 += line_size;
-            p2_l  = np2_l;
-            p2_r  = np2_r;
-
-        } while (--h);
-    } else {
-        uint64_t p2_l, p2_r;
-        p2_l = ldq(pix2);
-        p2_r = ldq(pix2 + 8);
-        do {
-            uint64_t p1_l, p1_r, np2_l, np2_r;
-
-            p1_l = ldq(pix1);
-            p1_r = ldq(pix1 + 8);
-            pix2 += line_size;
-            np2_l = ldq(pix2);
-            np2_r = ldq(pix2 + 8);
-
-            result += perr(p1_l, avg2(p2_l, np2_l))
-                    + perr(p1_r, avg2(p2_r, np2_r));
-
-            pix1 += line_size;
-            p2_l  = np2_l;
-            p2_r  = np2_r;
-        } while (--h);
-    }
-    return result;
-}
-
-int pix_abs16x16_xy2_mvi(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int result = 0;
-
-    uint64_t p1_l, p1_r;
-    uint64_t p2_l, p2_r, p2_x;
-
-    p1_l = ldq(pix1);
-    p1_r = ldq(pix1 + 8);
-
-    if ((size_t) pix2 & 0x7) { /* could be optimized a lot */
-        p2_l = uldq(pix2);
-        p2_r = uldq(pix2 + 8);
-        p2_x = (uint64_t) pix2[16] << 56;
-    } else {
-        p2_l = ldq(pix2);
-        p2_r = ldq(pix2 + 8);
-        p2_x = ldq(pix2 + 16) << 56;
-    }
-
-    do {
-        uint64_t np1_l, np1_r;
-        uint64_t np2_l, np2_r, np2_x;
-
-        pix1 += line_size;
-        pix2 += line_size;
-
-        np1_l = ldq(pix1);
-        np1_r = ldq(pix1 + 8);
-
-        if ((size_t) pix2 & 0x7) { /* could be optimized a lot */
-            np2_l = uldq(pix2);
-            np2_r = uldq(pix2 + 8);
-            np2_x = (uint64_t) pix2[16] << 56;
-        } else {
-            np2_l = ldq(pix2);
-            np2_r = ldq(pix2 + 8);
-            np2_x = ldq(pix2 + 16) << 56;
-        }
-
-        result += perr(p1_l,
-                       avg4( p2_l, ( p2_l >> 8) | ((uint64_t)  p2_r << 56),
-                            np2_l, (np2_l >> 8) | ((uint64_t) np2_r << 56)))
-                + perr(p1_r,
-                       avg4( p2_r, ( p2_r >> 8) | ((uint64_t)  p2_x),
-                            np2_r, (np2_r >> 8) | ((uint64_t) np2_x)));
-
-        p1_l = np1_l;
-        p1_r = np1_r;
-        p2_l = np2_l;
-        p2_r = np2_r;
-        p2_x = np2_x;
-    } while (--h);
-
-    return result;
-}
diff --git a/libavcodec/alpha/motion_est_mvi_asm.S b/libavcodec/alpha/motion_est_mvi_asm.S
deleted file mode 100644
index 2a08b07..0000000
--- a/libavcodec/alpha/motion_est_mvi_asm.S
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Alpha optimized DSP utils
- * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "regdef.h"
-
-/* Some nicer register names.  */
-#define ta t10
-#define tb t11
-#define tc t12
-#define td AT
-/* Danger: these overlap with the argument list and the return value */
-#define te a5
-#define tf a4
-#define tg a3
-#define th v0
-
-        .set noat
-        .set noreorder
-        .arch pca56
-        .text
-
-/*****************************************************************************
- * int pix_abs16x16_mvi_asm(uint8_t *pix1, uint8_t *pix2, int line_size)
- *
- * This code is written with a pca56 in mind. For ev6, one should
- * really take the increased latency of 3 cycles for MVI instructions
- * into account.
- *
- * It is important to keep the loading and first use of a register as
- * far apart as possible, because if a register is accessed before it
- * has been fetched from memory, the CPU will stall.
- */
-        .align 4
-        .globl pix_abs16x16_mvi_asm
-        .ent pix_abs16x16_mvi_asm
-pix_abs16x16_mvi_asm:
-        .frame sp, 0, ra, 0
-        .prologue 0
-
-#if CONFIG_GPROF
-        lda     AT, _mcount
-        jsr     AT, (AT), _mcount
-#endif
-
-        and     a2, 7, t0
-        clr     v0
-        beq     t0, $aligned
-        .align 4
-$unaligned:
-        /* Registers:
-           line 0:
-           t0:  left_u -> left lo -> left
-           t1:  mid
-           t2:  right_u -> right hi -> right
-           t3:  ref left
-           t4:  ref right
-           line 1:
-           t5:  left_u -> left lo -> left
-           t6:  mid
-           t7:  right_u -> right hi -> right
-           t8:  ref left
-           t9:  ref right
-           temp:
-           ta:  left hi
-           tb:  right lo
-           tc:  error left
-           td:  error right  */
-
-        /* load line 0 */
-        ldq_u   t0, 0(a2)       # left_u
-        ldq_u   t1, 8(a2)       # mid
-        ldq_u   t2, 16(a2)      # right_u
-        ldq     t3, 0(a1)       # ref left
-        ldq     t4, 8(a1)       # ref right
-        addq    a1, a3, a1      # pix1
-        addq    a2, a3, a2      # pix2
-        /* load line 1 */
-        ldq_u   t5, 0(a2)       # left_u
-        ldq_u   t6, 8(a2)       # mid
-        ldq_u   t7, 16(a2)      # right_u
-        ldq     t8, 0(a1)       # ref left
-        ldq     t9, 8(a1)       # ref right
-        addq    a1, a3, a1      # pix1
-        addq    a2, a3, a2      # pix2
-        /* calc line 0 */
-        extql   t0, a2, t0      # left lo
-        extqh   t1, a2, ta      # left hi
-        extql   t1, a2, tb      # right lo
-        or      t0, ta, t0      # left
-        extqh   t2, a2, t2      # right hi
-        perr    t3, t0, tc      # error left
-        or      t2, tb, t2      # right
-        perr    t4, t2, td      # error right
-        addq    v0, tc, v0      # add error left
-        addq    v0, td, v0      # add error left
-        /* calc line 1 */
-        extql   t5, a2, t5      # left lo
-        extqh   t6, a2, ta      # left hi
-        extql   t6, a2, tb      # right lo
-        or      t5, ta, t5      # left
-        extqh   t7, a2, t7      # right hi
-        perr    t8, t5, tc      # error left
-        or      t7, tb, t7      # right
-        perr    t9, t7, td      # error right
-        addq    v0, tc, v0      # add error left
-        addq    v0, td, v0      # add error left
-        /* loop */
-        subq    a4,  2, a4      # h -= 2
-        bne     a4, $unaligned
-        ret
-
-        .align 4
-$aligned:
-        /* load line 0 */
-        ldq     t0, 0(a2)       # left
-        ldq     t1, 8(a2)       # right
-        addq    a2, a3, a2      # pix2
-        ldq     t2, 0(a1)       # ref left
-        ldq     t3, 8(a1)       # ref right
-        addq    a1, a3, a1      # pix1
-        /* load line 1 */
-        ldq     t4, 0(a2)       # left
-        ldq     t5, 8(a2)       # right
-        addq    a2, a3, a2      # pix2
-        ldq     t6, 0(a1)       # ref left
-        ldq     t7, 8(a1)       # ref right
-        addq    a1, a3, a1      # pix1
-        /* load line 2 */
-        ldq     t8, 0(a2)       # left
-        ldq     t9, 8(a2)       # right
-        addq    a2, a3, a2      # pix2
-        ldq     ta, 0(a1)       # ref left
-        ldq     tb, 8(a1)       # ref right
-        addq    a1, a3, a1      # pix1
-        /* load line 3 */
-        ldq     tc, 0(a2)       # left
-        ldq     td, 8(a2)       # right
-        addq    a2, a3, a2      # pix2
-        ldq     te, 0(a1)       # ref left
-        ldq     a0, 8(a1)       # ref right
-        /* calc line 0 */
-        perr    t0, t2, t0      # error left
-        addq    a1, a3, a1      # pix1
-        perr    t1, t3, t1      # error right
-        addq    v0, t0, v0      # add error left
-        /* calc line 1 */
-        perr    t4, t6, t0      # error left
-        addq    v0, t1, v0      # add error right
-        perr    t5, t7, t1      # error right
-        addq    v0, t0, v0      # add error left
-        /* calc line 2 */
-        perr    t8, ta, t0      # error left
-        addq    v0, t1, v0      # add error right
-        perr    t9, tb, t1      # error right
-        addq    v0, t0, v0      # add error left
-        /* calc line 3 */
-        perr    tc, te, t0      # error left
-        addq    v0, t1, v0      # add error right
-        perr    td, a0, t1      # error right
-        addq    v0, t0, v0      # add error left
-        addq    v0, t1, v0      # add error right
-        /* loop */
-        subq    a4,  4, a4      # h -= 4
-        bne     a4, $aligned
-        ret
-        .end pix_abs16x16_mvi_asm
diff --git a/libavcodec/alpha/mpegvideo_alpha.c b/libavcodec/alpha/mpegvideo_alpha.c
deleted file mode 100644
index de32545..0000000
--- a/libavcodec/alpha/mpegvideo_alpha.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Alpha optimized DSP utils
- * Copyright (c) 2002 Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "asm.h"
-
-static void dct_unquantize_h263_axp(DCTELEM *block, int n_coeffs,
-                                    uint64_t qscale, uint64_t qadd)
-{
-    uint64_t qmul = qscale << 1;
-    uint64_t correction = WORD_VEC(qmul * 255 >> 8);
-    int i;
-
-    qadd = WORD_VEC(qadd);
-
-    for(i = 0; i <= n_coeffs; block += 4, i += 4) {
-        uint64_t levels, negmask, zeros, add, sub;
-
-        levels = ldq(block);
-        if (levels == 0)
-            continue;
-
-#ifdef __alpha_max__
-        /* I don't think the speed difference justifies runtime
-           detection.  */
-        negmask = maxsw4(levels, -1); /* negative -> ffff (-1) */
-        negmask = minsw4(negmask, 0); /* positive -> 0000 (0) */
-#else
-        negmask = cmpbge(WORD_VEC(0x7fff), levels);
-        negmask &= (negmask >> 1) | (1 << 7);
-        negmask = zap(-1, negmask);
-#endif
-
-        zeros = cmpbge(0, levels);
-        zeros &= zeros >> 1;
-        /* zeros |= zeros << 1 is not needed since qadd <= 255, so
-           zapping the lower byte suffices.  */
-
-        levels *= qmul;
-        levels -= correction & (negmask << 16);
-
-        add = qadd & ~negmask;
-        sub = qadd &  negmask;
-        /* Set qadd to 0 for levels == 0.  */
-        add = zap(add, zeros);
-        levels += add;
-        levels -= sub;
-
-        stq(levels, block);
-    }
-}
-
-static void dct_unquantize_h263_intra_axp(MpegEncContext *s, DCTELEM *block,
-                                    int n, int qscale)
-{
-    int n_coeffs;
-    uint64_t qadd;
-    DCTELEM block0 = block[0];
-
-    if (!s->h263_aic) {
-        if (n < 4)
-            block0 *= s->y_dc_scale;
-        else
-            block0 *= s->c_dc_scale;
-        qadd = (qscale - 1) | 1;
-    } else {
-        qadd = 0;
-    }
-
-    if(s->ac_pred)
-        n_coeffs = 63;
-    else
-        n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
-
-    dct_unquantize_h263_axp(block, n_coeffs, qscale, qadd);
-
-    block[0] = block0;
-}
-
-static void dct_unquantize_h263_inter_axp(MpegEncContext *s, DCTELEM *block,
-                                    int n, int qscale)
-{
-    int n_coeffs = s->inter_scantable.raster_end[s->block_last_index[n]];
-    dct_unquantize_h263_axp(block, n_coeffs, qscale, (qscale - 1) | 1);
-}
-
-void MPV_common_init_axp(MpegEncContext *s)
-{
-    s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_axp;
-    s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_axp;
-}
diff --git a/libavcodec/alpha/regdef.h b/libavcodec/alpha/regdef.h
deleted file mode 100644
index aa1959f..0000000
--- a/libavcodec/alpha/regdef.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Alpha optimized DSP utils
- * copyright (c) 2002 Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* Some BSDs don't seem to have regdef.h... sigh  */
-#ifndef AVCODEC_ALPHA_REGDEF_H
-#define AVCODEC_ALPHA_REGDEF_H
-
-#define v0      $0      /* function return value */
-
-#define t0      $1      /* temporary registers (caller-saved) */
-#define t1      $2
-#define t2      $3
-#define t3      $4
-#define t4      $5
-#define t5      $6
-#define t6      $7
-#define t7      $8
-
-#define s0      $9      /* saved-registers (callee-saved registers) */
-#define s1      $10
-#define s2      $11
-#define s3      $12
-#define s4      $13
-#define s5      $14
-#define s6      $15
-#define fp      s6      /* frame-pointer (s6 in frame-less procedures) */
-
-#define a0      $16     /* argument registers (caller-saved) */
-#define a1      $17
-#define a2      $18
-#define a3      $19
-#define a4      $20
-#define a5      $21
-
-#define t8      $22     /* more temps (caller-saved) */
-#define t9      $23
-#define t10     $24
-#define t11     $25
-#define ra      $26     /* return address register */
-#define t12     $27
-
-#define pv      t12     /* procedure-variable register */
-#define AT      $at     /* assembler temporary */
-#define gp      $29     /* global pointer */
-#define sp      $30     /* stack pointer */
-#define zero    $31     /* reads as zero, writes are noops */
-
-#endif /* AVCODEC_ALPHA_REGDEF_H */
diff --git a/libavcodec/alpha/simple_idct_alpha.c b/libavcodec/alpha/simple_idct_alpha.c
deleted file mode 100644
index 0c0689a..0000000
--- a/libavcodec/alpha/simple_idct_alpha.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Simple IDCT (Alpha optimized)
- *
- * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
- *
- * based upon some outcommented C code from mpeg2dec (idct_mmx.c
- * written by Aaron Holtzman <aholtzma at ess.engr.uvic.ca>)
- *
- * Alpha optimizations by Måns Rullgård <mans at mansr.com>
- *                     and Falk Hueffner <falk at debian.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_alpha.h"
-#include "asm.h"
-
-// cos(i * M_PI / 16) * sqrt(2) * (1 << 14)
-// W4 is actually exactly 16384, but using 16383 works around
-// accumulating rounding errors for some encoders
-#define W1 ((int_fast32_t) 22725)
-#define W2 ((int_fast32_t) 21407)
-#define W3 ((int_fast32_t) 19266)
-#define W4 ((int_fast32_t) 16383)
-#define W5 ((int_fast32_t) 12873)
-#define W6 ((int_fast32_t)  8867)
-#define W7 ((int_fast32_t)  4520)
-#define ROW_SHIFT 11
-#define COL_SHIFT 20
-
-/* 0: all entries 0, 1: only first entry nonzero, 2: otherwise  */
-static inline int idct_row(DCTELEM *row)
-{
-    int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3, t;
-    uint64_t l, r, t2;
-    l = ldq(row);
-    r = ldq(row + 4);
-
-    if (l == 0 && r == 0)
-        return 0;
-
-    a0 = W4 * sextw(l) + (1 << (ROW_SHIFT - 1));
-
-    if (((l & ~0xffffUL) | r) == 0) {
-        a0 >>= ROW_SHIFT;
-        t2 = (uint16_t) a0;
-        t2 |= t2 << 16;
-        t2 |= t2 << 32;
-
-        stq(t2, row);
-        stq(t2, row + 4);
-        return 1;
-    }
-
-    a1 = a0;
-    a2 = a0;
-    a3 = a0;
-
-    t = extwl(l, 4);            /* row[2] */
-    if (t != 0) {
-        t = sextw(t);
-        a0 += W2 * t;
-        a1 += W6 * t;
-        a2 -= W6 * t;
-        a3 -= W2 * t;
-    }
-
-    t = extwl(r, 0);            /* row[4] */
-    if (t != 0) {
-        t = sextw(t);
-        a0 += W4 * t;
-        a1 -= W4 * t;
-        a2 -= W4 * t;
-        a3 += W4 * t;
-    }
-
-    t = extwl(r, 4);            /* row[6] */
-    if (t != 0) {
-        t = sextw(t);
-        a0 += W6 * t;
-        a1 -= W2 * t;
-        a2 += W2 * t;
-        a3 -= W6 * t;
-    }
-
-    t = extwl(l, 2);            /* row[1] */
-    if (t != 0) {
-        t = sextw(t);
-        b0 = W1 * t;
-        b1 = W3 * t;
-        b2 = W5 * t;
-        b3 = W7 * t;
-    } else {
-        b0 = 0;
-        b1 = 0;
-        b2 = 0;
-        b3 = 0;
-    }
-
-    t = extwl(l, 6);            /* row[3] */
-    if (t) {
-        t = sextw(t);
-        b0 += W3 * t;
-        b1 -= W7 * t;
-        b2 -= W1 * t;
-        b3 -= W5 * t;
-    }
-
-
-    t = extwl(r, 2);            /* row[5] */
-    if (t) {
-        t = sextw(t);
-        b0 += W5 * t;
-        b1 -= W1 * t;
-        b2 += W7 * t;
-        b3 += W3 * t;
-    }
-
-    t = extwl(r, 6);            /* row[7] */
-    if (t) {
-        t = sextw(t);
-        b0 += W7 * t;
-        b1 -= W5 * t;
-        b2 += W3 * t;
-        b3 -= W1 * t;
-    }
-
-    row[0] = (a0 + b0) >> ROW_SHIFT;
-    row[1] = (a1 + b1) >> ROW_SHIFT;
-    row[2] = (a2 + b2) >> ROW_SHIFT;
-    row[3] = (a3 + b3) >> ROW_SHIFT;
-    row[4] = (a3 - b3) >> ROW_SHIFT;
-    row[5] = (a2 - b2) >> ROW_SHIFT;
-    row[6] = (a1 - b1) >> ROW_SHIFT;
-    row[7] = (a0 - b0) >> ROW_SHIFT;
-
-    return 2;
-}
-
-static inline void idct_col(DCTELEM *col)
-{
-    int_fast32_t a0, a1, a2, a3, b0, b1, b2, b3;
-
-    col[0] += (1 << (COL_SHIFT - 1)) / W4;
-
-    a0 = W4 * col[8 * 0];
-    a1 = W4 * col[8 * 0];
-    a2 = W4 * col[8 * 0];
-    a3 = W4 * col[8 * 0];
-
-    if (col[8 * 2]) {
-        a0 += W2 * col[8 * 2];
-        a1 += W6 * col[8 * 2];
-        a2 -= W6 * col[8 * 2];
-        a3 -= W2 * col[8 * 2];
-    }
-
-    if (col[8 * 4]) {
-        a0 += W4 * col[8 * 4];
-        a1 -= W4 * col[8 * 4];
-        a2 -= W4 * col[8 * 4];
-        a3 += W4 * col[8 * 4];
-    }
-
-    if (col[8 * 6]) {
-        a0 += W6 * col[8 * 6];
-        a1 -= W2 * col[8 * 6];
-        a2 += W2 * col[8 * 6];
-        a3 -= W6 * col[8 * 6];
-    }
-
-    if (col[8 * 1]) {
-        b0 = W1 * col[8 * 1];
-        b1 = W3 * col[8 * 1];
-        b2 = W5 * col[8 * 1];
-        b3 = W7 * col[8 * 1];
-    } else {
-        b0 = 0;
-        b1 = 0;
-        b2 = 0;
-        b3 = 0;
-    }
-
-    if (col[8 * 3]) {
-        b0 += W3 * col[8 * 3];
-        b1 -= W7 * col[8 * 3];
-        b2 -= W1 * col[8 * 3];
-        b3 -= W5 * col[8 * 3];
-    }
-
-    if (col[8 * 5]) {
-        b0 += W5 * col[8 * 5];
-        b1 -= W1 * col[8 * 5];
-        b2 += W7 * col[8 * 5];
-        b3 += W3 * col[8 * 5];
-    }
-
-    if (col[8 * 7]) {
-        b0 += W7 * col[8 * 7];
-        b1 -= W5 * col[8 * 7];
-        b2 += W3 * col[8 * 7];
-        b3 -= W1 * col[8 * 7];
-    }
-
-    col[8 * 0] = (a0 + b0) >> COL_SHIFT;
-    col[8 * 7] = (a0 - b0) >> COL_SHIFT;
-    col[8 * 1] = (a1 + b1) >> COL_SHIFT;
-    col[8 * 6] = (a1 - b1) >> COL_SHIFT;
-    col[8 * 2] = (a2 + b2) >> COL_SHIFT;
-    col[8 * 5] = (a2 - b2) >> COL_SHIFT;
-    col[8 * 3] = (a3 + b3) >> COL_SHIFT;
-    col[8 * 4] = (a3 - b3) >> COL_SHIFT;
-}
-
-/* If all rows but the first one are zero after row transformation,
-   all rows will be identical after column transformation.  */
-static inline void idct_col2(DCTELEM *col)
-{
-    int i;
-    uint64_t l, r;
-
-    for (i = 0; i < 8; ++i) {
-        int_fast32_t a0 = col[i] + (1 << (COL_SHIFT - 1)) / W4;
-
-        a0 *= W4;
-        col[i] = a0 >> COL_SHIFT;
-    }
-
-    l = ldq(col + 0 * 4); r = ldq(col + 1 * 4);
-    stq(l, col +  2 * 4); stq(r, col +  3 * 4);
-    stq(l, col +  4 * 4); stq(r, col +  5 * 4);
-    stq(l, col +  6 * 4); stq(r, col +  7 * 4);
-    stq(l, col +  8 * 4); stq(r, col +  9 * 4);
-    stq(l, col + 10 * 4); stq(r, col + 11 * 4);
-    stq(l, col + 12 * 4); stq(r, col + 13 * 4);
-    stq(l, col + 14 * 4); stq(r, col + 15 * 4);
-}
-
-void ff_simple_idct_axp(DCTELEM *block)
-{
-
-    int i;
-    int rowsZero = 1;           /* all rows except row 0 zero */
-    int rowsConstant = 1;       /* all rows consist of a constant value */
-
-    for (i = 0; i < 8; i++) {
-        int sparseness = idct_row(block + 8 * i);
-
-        if (i > 0 && sparseness > 0)
-            rowsZero = 0;
-        if (sparseness == 2)
-            rowsConstant = 0;
-    }
-
-    if (rowsZero) {
-        idct_col2(block);
-    } else if (rowsConstant) {
-        idct_col(block);
-        for (i = 0; i < 8; i += 2) {
-            uint64_t v = (uint16_t) block[0];
-            uint64_t w = (uint16_t) block[8];
-
-            v |= v << 16;
-            w |= w << 16;
-            v |= v << 32;
-            w |= w << 32;
-            stq(v, block + 0 * 4);
-            stq(v, block + 1 * 4);
-            stq(w, block + 2 * 4);
-            stq(w, block + 3 * 4);
-            block += 4 * 4;
-        }
-    } else {
-        for (i = 0; i < 8; i++)
-            idct_col(block + i);
-    }
-}
-
-void ff_simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_simple_idct_axp(block);
-    put_pixels_clamped_axp_p(block, dest, line_size);
-}
-
-void ff_simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_simple_idct_axp(block);
-    add_pixels_clamped_axp_p(block, dest, line_size);
-}
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
deleted file mode 100644
index 2058a85..0000000
--- a/libavcodec/alsdec.c
+++ /dev/null
@@ -1,1636 +0,0 @@
-/*
- * MPEG-4 ALS decoder
- * Copyright (c) 2009 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG-4 ALS decoder
- * @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
- */
-
-
-//#define DEBUG
-
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "unary.h"
-#include "mpeg4audio.h"
-#include "bytestream.h"
-#include "bgmc.h"
-
-#include <stdint.h>
-
-/** Rice parameters and corresponding index offsets for decoding the
- *  indices of scaled PARCOR values. The table choosen is set globally
- *  by the encoder and stored in ALSSpecificConfig.
- */
-static const int8_t parcor_rice_table[3][20][2] = {
-    { {-52, 4}, {-29, 5}, {-31, 4}, { 19, 4}, {-16, 4},
-      { 12, 3}, { -7, 3}, {  9, 3}, { -5, 3}, {  6, 3},
-      { -4, 3}, {  3, 3}, { -3, 2}, {  3, 2}, { -2, 2},
-      {  3, 2}, { -1, 2}, {  2, 2}, { -1, 2}, {  2, 2} },
-    { {-58, 3}, {-42, 4}, {-46, 4}, { 37, 5}, {-36, 4},
-      { 29, 4}, {-29, 4}, { 25, 4}, {-23, 4}, { 20, 4},
-      {-17, 4}, { 16, 4}, {-12, 4}, { 12, 3}, {-10, 4},
-      {  7, 3}, { -4, 4}, {  3, 3}, { -1, 3}, {  1, 3} },
-    { {-59, 3}, {-45, 5}, {-50, 4}, { 38, 4}, {-39, 4},
-      { 32, 4}, {-30, 4}, { 25, 3}, {-23, 3}, { 20, 3},
-      {-20, 3}, { 16, 3}, {-13, 3}, { 10, 3}, { -7, 3},
-      {  3, 3}, {  0, 3}, { -1, 3}, {  2, 3}, { -1, 2} }
-};
-
-
-/** Scaled PARCOR values used for the first two PARCOR coefficients.
- *  To be indexed by the Rice coded indices.
- *  Generated by: parcor_scaled_values[i] = 32 + ((i * (i+1)) << 7) - (1 << 20)
- *  Actual values are divided by 32 in order to be stored in 16 bits.
- */
-static const int16_t parcor_scaled_values[] = {
-    -1048544 / 32, -1048288 / 32, -1047776 / 32, -1047008 / 32,
-    -1045984 / 32, -1044704 / 32, -1043168 / 32, -1041376 / 32,
-    -1039328 / 32, -1037024 / 32, -1034464 / 32, -1031648 / 32,
-    -1028576 / 32, -1025248 / 32, -1021664 / 32, -1017824 / 32,
-    -1013728 / 32, -1009376 / 32, -1004768 / 32,  -999904 / 32,
-     -994784 / 32,  -989408 / 32,  -983776 / 32,  -977888 / 32,
-     -971744 / 32,  -965344 / 32,  -958688 / 32,  -951776 / 32,
-     -944608 / 32,  -937184 / 32,  -929504 / 32,  -921568 / 32,
-     -913376 / 32,  -904928 / 32,  -896224 / 32,  -887264 / 32,
-     -878048 / 32,  -868576 / 32,  -858848 / 32,  -848864 / 32,
-     -838624 / 32,  -828128 / 32,  -817376 / 32,  -806368 / 32,
-     -795104 / 32,  -783584 / 32,  -771808 / 32,  -759776 / 32,
-     -747488 / 32,  -734944 / 32,  -722144 / 32,  -709088 / 32,
-     -695776 / 32,  -682208 / 32,  -668384 / 32,  -654304 / 32,
-     -639968 / 32,  -625376 / 32,  -610528 / 32,  -595424 / 32,
-     -580064 / 32,  -564448 / 32,  -548576 / 32,  -532448 / 32,
-     -516064 / 32,  -499424 / 32,  -482528 / 32,  -465376 / 32,
-     -447968 / 32,  -430304 / 32,  -412384 / 32,  -394208 / 32,
-     -375776 / 32,  -357088 / 32,  -338144 / 32,  -318944 / 32,
-     -299488 / 32,  -279776 / 32,  -259808 / 32,  -239584 / 32,
-     -219104 / 32,  -198368 / 32,  -177376 / 32,  -156128 / 32,
-     -134624 / 32,  -112864 / 32,   -90848 / 32,   -68576 / 32,
-      -46048 / 32,   -23264 / 32,     -224 / 32,    23072 / 32,
-       46624 / 32,    70432 / 32,    94496 / 32,   118816 / 32,
-      143392 / 32,   168224 / 32,   193312 / 32,   218656 / 32,
-      244256 / 32,   270112 / 32,   296224 / 32,   322592 / 32,
-      349216 / 32,   376096 / 32,   403232 / 32,   430624 / 32,
-      458272 / 32,   486176 / 32,   514336 / 32,   542752 / 32,
-      571424 / 32,   600352 / 32,   629536 / 32,   658976 / 32,
-      688672 / 32,   718624 / 32,   748832 / 32,   779296 / 32,
-      810016 / 32,   840992 / 32,   872224 / 32,   903712 / 32,
-      935456 / 32,   967456 / 32,   999712 / 32,  1032224 / 32
-};
-
-
-/** Gain values of p(0) for long-term prediction.
- *  To be indexed by the Rice coded indices.
- */
-static const uint8_t ltp_gain_values [4][4] = {
-    { 0,  8, 16,  24},
-    {32, 40, 48,  56},
-    {64, 70, 76,  82},
-    {88, 92, 96, 100}
-};
-
-
-/** Inter-channel weighting factors for multi-channel correlation.
- *  To be indexed by the Rice coded indices.
- */
-static const int16_t mcc_weightings[] = {
-    204,  192,  179,  166,  153,  140,  128,  115,
-    102,   89,   76,   64,   51,   38,   25,   12,
-      0,  -12,  -25,  -38,  -51,  -64,  -76,  -89,
-   -102, -115, -128, -140, -153, -166, -179, -192
-};
-
-
-/** Tail codes used in arithmetic coding using block Gilbert-Moore codes.
- */
-static const uint8_t tail_code[16][6] = {
-    { 74, 44, 25, 13,  7, 3},
-    { 68, 42, 24, 13,  7, 3},
-    { 58, 39, 23, 13,  7, 3},
-    {126, 70, 37, 19, 10, 5},
-    {132, 70, 37, 20, 10, 5},
-    {124, 70, 38, 20, 10, 5},
-    {120, 69, 37, 20, 11, 5},
-    {116, 67, 37, 20, 11, 5},
-    {108, 66, 36, 20, 10, 5},
-    {102, 62, 36, 20, 10, 5},
-    { 88, 58, 34, 19, 10, 5},
-    {162, 89, 49, 25, 13, 7},
-    {156, 87, 49, 26, 14, 7},
-    {150, 86, 47, 26, 14, 7},
-    {142, 84, 47, 26, 14, 7},
-    {131, 79, 46, 26, 14, 7}
-};
-
-
-enum RA_Flag {
-    RA_FLAG_NONE,
-    RA_FLAG_FRAMES,
-    RA_FLAG_HEADER
-};
-
-
-typedef struct {
-    uint32_t samples;         ///< number of samples, 0xFFFFFFFF if unknown
-    int resolution;           ///< 000 = 8-bit; 001 = 16-bit; 010 = 24-bit; 011 = 32-bit
-    int floating;             ///< 1 = IEEE 32-bit floating-point, 0 = integer
-    int frame_length;         ///< frame length for each frame (last frame may differ)
-    int ra_distance;          ///< distance between RA frames (in frames, 0...255)
-    enum RA_Flag ra_flag;     ///< indicates where the size of ra units is stored
-    int adapt_order;          ///< adaptive order: 1 = on, 0 = off
-    int coef_table;           ///< table index of Rice code parameters
-    int long_term_prediction; ///< long term prediction (LTP): 1 = on, 0 = off
-    int max_order;            ///< maximum prediction order (0..1023)
-    int block_switching;      ///< number of block switching levels
-    int bgmc;                 ///< "Block Gilbert-Moore Code": 1 = on, 0 = off (Rice coding only)
-    int sb_part;              ///< sub-block partition
-    int joint_stereo;         ///< joint stereo: 1 = on, 0 = off
-    int mc_coding;            ///< extended inter-channel coding (multi channel coding): 1 = on, 0 = off
-    int chan_config;          ///< indicates that a chan_config_info field is present
-    int chan_sort;            ///< channel rearrangement: 1 = on, 0 = off
-    int rlslms;               ///< use "Recursive Least Square-Least Mean Square" predictor: 1 = on, 0 = off
-    int chan_config_info;     ///< mapping of channels to loudspeaker locations. Unused until setting channel configuration is implemented.
-    int *chan_pos;            ///< original channel positions
-} ALSSpecificConfig;
-
-
-typedef struct {
-    int stop_flag;
-    int master_channel;
-    int time_diff_flag;
-    int time_diff_sign;
-    int time_diff_index;
-    int weighting[6];
-} ALSChannelData;
-
-
-typedef struct {
-    AVCodecContext *avctx;
-    ALSSpecificConfig sconf;
-    GetBitContext gb;
-    unsigned int cur_frame_length;  ///< length of the current frame to decode
-    unsigned int frame_id;          ///< the frame ID / number of the current frame
-    unsigned int js_switch;         ///< if true, joint-stereo decoding is enforced
-    unsigned int num_blocks;        ///< number of blocks used in the current frame
-    unsigned int s_max;             ///< maximum Rice parameter allowed in entropy coding
-    uint8_t *bgmc_lut;              ///< pointer at lookup tables used for BGMC
-    unsigned int *bgmc_lut_status;  ///< pointer at lookup table status flags used for BGMC
-    int ltp_lag_length;             ///< number of bits used for ltp lag value
-    int *use_ltp;                   ///< contains use_ltp flags for all channels
-    int *ltp_lag;                   ///< contains ltp lag values for all channels
-    int **ltp_gain;                 ///< gain values for ltp 5-tap filter for a channel
-    int *ltp_gain_buffer;           ///< contains all gain values for ltp 5-tap filter
-    int32_t **quant_cof;            ///< quantized parcor coefficients for a channel
-    int32_t *quant_cof_buffer;      ///< contains all quantized parcor coefficients
-    int32_t **lpc_cof;              ///< coefficients of the direct form prediction filter for a channel
-    int32_t *lpc_cof_buffer;        ///< contains all coefficients of the direct form prediction filter
-    int32_t *lpc_cof_reversed_buffer; ///< temporary buffer to set up a reversed versio of lpc_cof_buffer
-    ALSChannelData **chan_data;     ///< channel data for multi-channel correlation
-    ALSChannelData *chan_data_buffer; ///< contains channel data for all channels
-    int *reverted_channels;         ///< stores a flag for each reverted channel
-    int32_t *prev_raw_samples;      ///< contains unshifted raw samples from the previous block
-    int32_t **raw_samples;          ///< decoded raw samples for each channel
-    int32_t *raw_buffer;            ///< contains all decoded raw samples including carryover samples
-} ALSDecContext;
-
-
-typedef struct {
-    unsigned int block_length;      ///< number of samples within the block
-    unsigned int ra_block;          ///< if true, this is a random access block
-    int          const_block;       ///< if true, this is a constant value block
-    int32_t      const_val;         ///< the sample value of a constant block
-    int          js_blocks;         ///< true if this block contains a difference signal
-    unsigned int shift_lsbs;        ///< shift of values for this block
-    unsigned int opt_order;         ///< prediction order of this block
-    int          store_prev_samples;///< if true, carryover samples have to be stored
-    int          *use_ltp;          ///< if true, long-term prediction is used
-    int          *ltp_lag;          ///< lag value for long-term prediction
-    int          *ltp_gain;         ///< gain values for ltp 5-tap filter
-    int32_t      *quant_cof;        ///< quantized parcor coefficients
-    int32_t      *lpc_cof;          ///< coefficients of the direct form prediction
-    int32_t      *raw_samples;      ///< decoded raw samples / residuals for this block
-    int32_t      *prev_raw_samples; ///< contains unshifted raw samples from the previous block
-    int32_t      *raw_other;        ///< decoded raw samples of the other channel of a channel pair
-} ALSBlockData;
-
-
-static av_cold void dprint_specific_config(ALSDecContext *ctx)
-{
-#ifdef DEBUG
-    AVCodecContext *avctx    = ctx->avctx;
-    ALSSpecificConfig *sconf = &ctx->sconf;
-
-    dprintf(avctx, "resolution = %i\n",           sconf->resolution);
-    dprintf(avctx, "floating = %i\n",             sconf->floating);
-    dprintf(avctx, "frame_length = %i\n",         sconf->frame_length);
-    dprintf(avctx, "ra_distance = %i\n",          sconf->ra_distance);
-    dprintf(avctx, "ra_flag = %i\n",              sconf->ra_flag);
-    dprintf(avctx, "adapt_order = %i\n",          sconf->adapt_order);
-    dprintf(avctx, "coef_table = %i\n",           sconf->coef_table);
-    dprintf(avctx, "long_term_prediction = %i\n", sconf->long_term_prediction);
-    dprintf(avctx, "max_order = %i\n",            sconf->max_order);
-    dprintf(avctx, "block_switching = %i\n",      sconf->block_switching);
-    dprintf(avctx, "bgmc = %i\n",                 sconf->bgmc);
-    dprintf(avctx, "sb_part = %i\n",              sconf->sb_part);
-    dprintf(avctx, "joint_stereo = %i\n",         sconf->joint_stereo);
-    dprintf(avctx, "mc_coding = %i\n",            sconf->mc_coding);
-    dprintf(avctx, "chan_config = %i\n",          sconf->chan_config);
-    dprintf(avctx, "chan_sort = %i\n",            sconf->chan_sort);
-    dprintf(avctx, "RLSLMS = %i\n",               sconf->rlslms);
-    dprintf(avctx, "chan_config_info = %i\n",     sconf->chan_config_info);
-#endif
-}
-
-
-/** Reads an ALSSpecificConfig from a buffer into the output struct.
- */
-static av_cold int read_specific_config(ALSDecContext *ctx)
-{
-    GetBitContext gb;
-    uint64_t ht_size;
-    int i, config_offset, crc_enabled;
-    MPEG4AudioConfig m4ac;
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    AVCodecContext *avctx    = ctx->avctx;
-    uint32_t als_id, header_size, trailer_size;
-
-    init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8);
-
-    config_offset = ff_mpeg4audio_get_config(&m4ac, avctx->extradata,
-                                             avctx->extradata_size);
-
-    if (config_offset < 0)
-        return -1;
-
-    skip_bits_long(&gb, config_offset);
-
-    if (get_bits_left(&gb) < (30 << 3))
-        return -1;
-
-    // read the fixed items
-    als_id                      = get_bits_long(&gb, 32);
-    avctx->sample_rate          = m4ac.sample_rate;
-    skip_bits_long(&gb, 32); // sample rate already known
-    sconf->samples              = get_bits_long(&gb, 32);
-    avctx->channels             = m4ac.channels;
-    skip_bits(&gb, 16);      // number of channels already knwon
-    skip_bits(&gb, 3);       // skip file_type
-    sconf->resolution           = get_bits(&gb, 3);
-    sconf->floating             = get_bits1(&gb);
-    skip_bits1(&gb);         // skip msb_first
-    sconf->frame_length         = get_bits(&gb, 16) + 1;
-    sconf->ra_distance          = get_bits(&gb, 8);
-    sconf->ra_flag              = get_bits(&gb, 2);
-    sconf->adapt_order          = get_bits1(&gb);
-    sconf->coef_table           = get_bits(&gb, 2);
-    sconf->long_term_prediction = get_bits1(&gb);
-    sconf->max_order            = get_bits(&gb, 10);
-    sconf->block_switching      = get_bits(&gb, 2);
-    sconf->bgmc                 = get_bits1(&gb);
-    sconf->sb_part              = get_bits1(&gb);
-    sconf->joint_stereo         = get_bits1(&gb);
-    sconf->mc_coding            = get_bits1(&gb);
-    sconf->chan_config          = get_bits1(&gb);
-    sconf->chan_sort            = get_bits1(&gb);
-    crc_enabled                 = get_bits1(&gb);
-    sconf->rlslms               = get_bits1(&gb);
-    skip_bits(&gb, 5);       // skip 5 reserved bits
-    skip_bits1(&gb);         // skip aux_data_enabled
-
-
-    // check for ALSSpecificConfig struct
-    if (als_id != MKBETAG('A','L','S','\0'))
-        return -1;
-
-    ctx->cur_frame_length = sconf->frame_length;
-
-    // read channel config
-    if (sconf->chan_config)
-        sconf->chan_config_info = get_bits(&gb, 16);
-    // TODO: use this to set avctx->channel_layout
-
-
-    // read channel sorting
-    if (sconf->chan_sort && avctx->channels > 1) {
-        int chan_pos_bits = av_ceil_log2(avctx->channels);
-        int bits_needed  = avctx->channels * chan_pos_bits + 7;
-        if (get_bits_left(&gb) < bits_needed)
-            return -1;
-
-        if (!(sconf->chan_pos = av_malloc(avctx->channels * sizeof(*sconf->chan_pos))))
-            return AVERROR(ENOMEM);
-
-        for (i = 0; i < avctx->channels; i++)
-            sconf->chan_pos[i] = get_bits(&gb, chan_pos_bits);
-
-        align_get_bits(&gb);
-        // TODO: use this to actually do channel sorting
-    } else {
-        sconf->chan_sort = 0;
-    }
-
-
-    // read fixed header and trailer sizes,
-    // if size = 0xFFFFFFFF then there is no data field!
-    if (get_bits_left(&gb) < 64)
-        return -1;
-
-    header_size  = get_bits_long(&gb, 32);
-    trailer_size = get_bits_long(&gb, 32);
-    if (header_size  == 0xFFFFFFFF)
-        header_size  = 0;
-    if (trailer_size == 0xFFFFFFFF)
-        trailer_size = 0;
-
-    ht_size = ((int64_t)(header_size) + (int64_t)(trailer_size)) << 3;
-
-
-    // skip the header and trailer data
-    if (get_bits_left(&gb) < ht_size)
-        return -1;
-
-    if (ht_size > INT32_MAX)
-        return -1;
-
-    skip_bits_long(&gb, ht_size);
-
-
-    // skip the crc data
-    if (crc_enabled) {
-        if (get_bits_left(&gb) < 32)
-            return -1;
-
-        skip_bits_long(&gb, 32);
-    }
-
-
-    // no need to read the rest of ALSSpecificConfig (ra_unit_size & aux data)
-
-    dprint_specific_config(ctx);
-
-    return 0;
-}
-
-
-/** Checks the ALSSpecificConfig for unsupported features.
- */
-static int check_specific_config(ALSDecContext *ctx)
-{
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    int error = 0;
-
-    // report unsupported feature and set error value
-    #define MISSING_ERR(cond, str, errval)              \
-    {                                                   \
-        if (cond) {                                     \
-            av_log_missing_feature(ctx->avctx, str, 0); \
-            error = errval;                             \
-        }                                               \
-    }
-
-    MISSING_ERR(sconf->floating,             "Floating point decoding",     -1);
-    MISSING_ERR(sconf->rlslms,               "Adaptive RLS-LMS prediction", -1);
-    MISSING_ERR(sconf->chan_sort,            "Channel sorting",              0);
-
-    return error;
-}
-
-
-/** Parses the bs_info field to extract the block partitioning used in
- *  block switching mode, refer to ISO/IEC 14496-3, section 11.6.2.
- */
-static void parse_bs_info(const uint32_t bs_info, unsigned int n,
-                          unsigned int div, unsigned int **div_blocks,
-                          unsigned int *num_blocks)
-{
-    if (n < 31 && ((bs_info << n) & 0x40000000)) {
-        // if the level is valid and the investigated bit n is set
-        // then recursively check both children at bits (2n+1) and (2n+2)
-        n   *= 2;
-        div += 1;
-        parse_bs_info(bs_info, n + 1, div, div_blocks, num_blocks);
-        parse_bs_info(bs_info, n + 2, div, div_blocks, num_blocks);
-    } else {
-        // else the bit is not set or the last level has been reached
-        // (bit implicitly not set)
-        **div_blocks = div;
-        (*div_blocks)++;
-        (*num_blocks)++;
-    }
-}
-
-
-/** Reads and decodes a Rice codeword.
- */
-static int32_t decode_rice(GetBitContext *gb, unsigned int k)
-{
-    int max = get_bits_left(gb) - k;
-    int q   = get_unary(gb, 0, max);
-    int r   = k ? get_bits1(gb) : !(q & 1);
-
-    if (k > 1) {
-        q <<= (k - 1);
-        q  += get_bits_long(gb, k - 1);
-    } else if (!k) {
-        q >>= 1;
-    }
-    return r ? q : ~q;
-}
-
-
-/** Converts PARCOR coefficient k to direct filter coefficient.
- */
-static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof)
-{
-    int i, j;
-
-    for (i = 0, j = k - 1; i < j; i++, j--) {
-        int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
-        cof[j]  += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20);
-        cof[i]  += tmp1;
-    }
-    if (i == j)
-        cof[i] += ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20);
-
-    cof[k] = par[k];
-}
-
-
-/** Reads block switching field if necessary and sets actual block sizes.
- *  Also assures that the block sizes of the last frame correspond to the
- *  actual number of samples.
- */
-static void get_block_sizes(ALSDecContext *ctx, unsigned int *div_blocks,
-                            uint32_t *bs_info)
-{
-    ALSSpecificConfig *sconf     = &ctx->sconf;
-    GetBitContext *gb            = &ctx->gb;
-    unsigned int *ptr_div_blocks = div_blocks;
-    unsigned int b;
-
-    if (sconf->block_switching) {
-        unsigned int bs_info_len = 1 << (sconf->block_switching + 2);
-        *bs_info = get_bits_long(gb, bs_info_len);
-        *bs_info <<= (32 - bs_info_len);
-    }
-
-    ctx->num_blocks = 0;
-    parse_bs_info(*bs_info, 0, 0, &ptr_div_blocks, &ctx->num_blocks);
-
-    // The last frame may have an overdetermined block structure given in
-    // the bitstream. In that case the defined block structure would need
-    // more samples than available to be consistent.
-    // The block structure is actually used but the block sizes are adapted
-    // to fit the actual number of available samples.
-    // Example: 5 samples, 2nd level block sizes: 2 2 2 2.
-    // This results in the actual block sizes:    2 2 1 0.
-    // This is not specified in 14496-3 but actually done by the reference
-    // codec RM22 revision 2.
-    // This appears to happen in case of an odd number of samples in the last
-    // frame which is actually not allowed by the block length switching part
-    // of 14496-3.
-    // The ALS conformance files feature an odd number of samples in the last
-    // frame.
-
-    for (b = 0; b < ctx->num_blocks; b++)
-        div_blocks[b] = ctx->sconf.frame_length >> div_blocks[b];
-
-    if (ctx->cur_frame_length != ctx->sconf.frame_length) {
-        unsigned int remaining = ctx->cur_frame_length;
-
-        for (b = 0; b < ctx->num_blocks; b++) {
-            if (remaining <= div_blocks[b]) {
-                div_blocks[b] = remaining;
-                ctx->num_blocks = b + 1;
-                break;
-            }
-
-            remaining -= div_blocks[b];
-        }
-    }
-}
-
-
-/** Reads the block data for a constant block
- */
-static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
-{
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    AVCodecContext *avctx    = ctx->avctx;
-    GetBitContext *gb        = &ctx->gb;
-
-    bd->const_val    = 0;
-    bd->const_block  = get_bits1(gb);    // 1 = constant value, 0 = zero block (silence)
-    bd->js_blocks    = get_bits1(gb);
-
-    // skip 5 reserved bits
-    skip_bits(gb, 5);
-
-    if (bd->const_block) {
-        unsigned int const_val_bits = sconf->floating ? 24 : avctx->bits_per_raw_sample;
-        bd->const_val = get_sbits_long(gb, const_val_bits);
-    }
-
-    // ensure constant block decoding by reusing this field
-    bd->const_block = 1;
-}
-
-
-/** Decodes the block data for a constant block
- */
-static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
-{
-    int      smp = bd->block_length;
-    int32_t  val = bd->const_val;
-    int32_t *dst = bd->raw_samples;
-
-    // write raw samples into buffer
-    for (; smp; smp--)
-        *dst++ = val;
-}
-
-
-/** Reads the block data for a non-constant block
- */
-static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
-{
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    AVCodecContext *avctx    = ctx->avctx;
-    GetBitContext *gb        = &ctx->gb;
-    unsigned int k;
-    unsigned int s[8];
-    unsigned int sx[8];
-    unsigned int sub_blocks, log2_sub_blocks, sb_length;
-    unsigned int start      = 0;
-    unsigned int opt_order;
-    int          sb;
-    int32_t      *quant_cof = bd->quant_cof;
-    int32_t      *current_res;
-
-
-    // ensure variable block decoding by reusing this field
-    bd->const_block = 0;
-
-    bd->opt_order   = 1;
-    bd->js_blocks   = get_bits1(gb);
-
-    opt_order       = bd->opt_order;
-
-    // determine the number of subblocks for entropy decoding
-    if (!sconf->bgmc && !sconf->sb_part) {
-        log2_sub_blocks = 0;
-    } else {
-        if (sconf->bgmc && sconf->sb_part)
-            log2_sub_blocks = get_bits(gb, 2);
-        else
-            log2_sub_blocks = 2 * get_bits1(gb);
-    }
-
-    sub_blocks = 1 << log2_sub_blocks;
-
-    // do not continue in case of a damaged stream since
-    // block_length must be evenly divisible by sub_blocks
-    if (bd->block_length & (sub_blocks - 1)) {
-        av_log(avctx, AV_LOG_WARNING,
-               "Block length is not evenly divisible by the number of subblocks.\n");
-        return -1;
-    }
-
-    sb_length = bd->block_length >> log2_sub_blocks;
-
-    if (sconf->bgmc) {
-        s[0] = get_bits(gb, 8 + (sconf->resolution > 1));
-        for (k = 1; k < sub_blocks; k++)
-            s[k] = s[k - 1] + decode_rice(gb, 2);
-
-        for (k = 0; k < sub_blocks; k++) {
-            sx[k]   = s[k] & 0x0F;
-            s [k] >>= 4;
-        }
-    } else {
-        s[0] = get_bits(gb, 4 + (sconf->resolution > 1));
-        for (k = 1; k < sub_blocks; k++)
-            s[k] = s[k - 1] + decode_rice(gb, 0);
-    }
-
-    if (get_bits1(gb))
-        bd->shift_lsbs = get_bits(gb, 4) + 1;
-
-    bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || bd->shift_lsbs;
-
-
-    if (!sconf->rlslms) {
-        if (sconf->adapt_order) {
-            int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,
-                                                2, sconf->max_order + 1));
-            bd->opt_order        = get_bits(gb, opt_order_length);
-        } else {
-            bd->opt_order = sconf->max_order;
-        }
-
-        opt_order = bd->opt_order;
-
-        if (opt_order) {
-            int add_base;
-
-            if (sconf->coef_table == 3) {
-                add_base = 0x7F;
-
-                // read coefficient 0
-                quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)];
-
-                // read coefficient 1
-                if (opt_order > 1)
-                    quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)];
-
-                // read coefficients 2 to opt_order
-                for (k = 2; k < opt_order; k++)
-                    quant_cof[k] = get_bits(gb, 7);
-            } else {
-                int k_max;
-                add_base = 1;
-
-                // read coefficient 0 to 19
-                k_max = FFMIN(opt_order, 20);
-                for (k = 0; k < k_max; k++) {
-                    int rice_param = parcor_rice_table[sconf->coef_table][k][1];
-                    int offset     = parcor_rice_table[sconf->coef_table][k][0];
-                    quant_cof[k] = decode_rice(gb, rice_param) + offset;
-                }
-
-                // read coefficients 20 to 126
-                k_max = FFMIN(opt_order, 127);
-                for (; k < k_max; k++)
-                    quant_cof[k] = decode_rice(gb, 2) + (k & 1);
-
-                // read coefficients 127 to opt_order
-                for (; k < opt_order; k++)
-                    quant_cof[k] = decode_rice(gb, 1);
-
-                quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64];
-
-                if (opt_order > 1)
-                    quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64];
-            }
-
-            for (k = 2; k < opt_order; k++)
-                quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13);
-        }
-    }
-
-    // read LTP gain and lag values
-    if (sconf->long_term_prediction) {
-        *bd->use_ltp = get_bits1(gb);
-
-        if (*bd->use_ltp) {
-            int r, c;
-
-            bd->ltp_gain[0]   = decode_rice(gb, 1) << 3;
-            bd->ltp_gain[1]   = decode_rice(gb, 2) << 3;
-
-            r                 = get_unary(gb, 0, 4);
-            c                 = get_bits(gb, 2);
-            bd->ltp_gain[2]   = ltp_gain_values[r][c];
-
-            bd->ltp_gain[3]   = decode_rice(gb, 2) << 3;
-            bd->ltp_gain[4]   = decode_rice(gb, 1) << 3;
-
-            *bd->ltp_lag      = get_bits(gb, ctx->ltp_lag_length);
-            *bd->ltp_lag     += FFMAX(4, opt_order + 1);
-        }
-    }
-
-    // read first value and residuals in case of a random access block
-    if (bd->ra_block) {
-        if (opt_order)
-            bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);
-        if (opt_order > 1)
-            bd->raw_samples[1] = decode_rice(gb, FFMIN(s[0] + 3, ctx->s_max));
-        if (opt_order > 2)
-            bd->raw_samples[2] = decode_rice(gb, FFMIN(s[0] + 1, ctx->s_max));
-
-        start = FFMIN(opt_order, 3);
-    }
-
-    // read all residuals
-    if (sconf->bgmc) {
-        unsigned int delta[sub_blocks];
-        unsigned int k    [sub_blocks];
-        unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5);
-        unsigned int i = start;
-
-        // read most significant bits
-        unsigned int high;
-        unsigned int low;
-        unsigned int value;
-
-        ff_bgmc_decode_init(gb, &high, &low, &value);
-
-        current_res = bd->raw_samples + start;
-
-        for (sb = 0; sb < sub_blocks; sb++, i = 0) {
-            k    [sb] = s[sb] > b ? s[sb] - b : 0;
-            delta[sb] = 5 - s[sb] + k[sb];
-
-            ff_bgmc_decode(gb, sb_length, current_res,
-                        delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status);
-
-            current_res += sb_length;
-        }
-
-        ff_bgmc_decode_end(gb);
-
-
-        // read least significant bits and tails
-        i = start;
-        current_res = bd->raw_samples + start;
-
-        for (sb = 0; sb < sub_blocks; sb++, i = 0) {
-            unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]];
-            unsigned int cur_k         = k[sb];
-            unsigned int cur_s         = s[sb];
-
-            for (; i < sb_length; i++) {
-                int32_t res = *current_res;
-
-                if (res == cur_tail_code) {
-                    unsigned int max_msb =   (2 + (sx[sb] > 2) + (sx[sb] > 10))
-                                          << (5 - delta[sb]);
-
-                    res = decode_rice(gb, cur_s);
-
-                    if (res >= 0) {
-                        res += (max_msb    ) << cur_k;
-                    } else {
-                        res -= (max_msb - 1) << cur_k;
-                    }
-                } else {
-                    if (res > cur_tail_code)
-                        res--;
-
-                    if (res & 1)
-                        res = -res;
-
-                    res >>= 1;
-
-                    if (cur_k) {
-                        res <<= cur_k;
-                        res  |= get_bits_long(gb, cur_k);
-                    }
-                }
-
-                *current_res++ = res;
-            }
-        }
-    } else {
-        current_res = bd->raw_samples + start;
-
-        for (sb = 0; sb < sub_blocks; sb++, start = 0)
-            for (; start < sb_length; start++)
-                *current_res++ = decode_rice(gb, s[sb]);
-     }
-
-    if (!sconf->mc_coding || ctx->js_switch)
-        align_get_bits(gb);
-
-    return 0;
-}
-
-
-/** Decodes the block data for a non-constant block
- */
-static int decode_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
-{
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    unsigned int block_length = bd->block_length;
-    unsigned int smp = 0;
-    unsigned int k;
-    int opt_order             = bd->opt_order;
-    int sb;
-    int64_t y;
-    int32_t *quant_cof        = bd->quant_cof;
-    int32_t *lpc_cof          = bd->lpc_cof;
-    int32_t *raw_samples      = bd->raw_samples;
-    int32_t *raw_samples_end  = bd->raw_samples + bd->block_length;
-    int32_t *lpc_cof_reversed = ctx->lpc_cof_reversed_buffer;
-
-    // reverse long-term prediction
-    if (*bd->use_ltp) {
-        int ltp_smp;
-
-        for (ltp_smp = FFMAX(*bd->ltp_lag - 2, 0); ltp_smp < block_length; ltp_smp++) {
-            int center = ltp_smp - *bd->ltp_lag;
-            int begin  = FFMAX(0, center - 2);
-            int end    = center + 3;
-            int tab    = 5 - (end - begin);
-            int base;
-
-            y = 1 << 6;
-
-            for (base = begin; base < end; base++, tab++)
-                y += MUL64(bd->ltp_gain[tab], raw_samples[base]);
-
-            raw_samples[ltp_smp] += y >> 7;
-        }
-    }
-
-    // reconstruct all samples from residuals
-    if (bd->ra_block) {
-        for (smp = 0; smp < opt_order; smp++) {
-            y = 1 << 19;
-
-            for (sb = 0; sb < smp; sb++)
-                y += MUL64(lpc_cof[sb], raw_samples[-(sb + 1)]);
-
-            *raw_samples++ -= y >> 20;
-            parcor_to_lpc(smp, quant_cof, lpc_cof);
-        }
-    } else {
-        for (k = 0; k < opt_order; k++)
-            parcor_to_lpc(k, quant_cof, lpc_cof);
-
-        // store previous samples in case that they have to be altered
-        if (bd->store_prev_samples)
-            memcpy(bd->prev_raw_samples, raw_samples - sconf->max_order,
-                   sizeof(*bd->prev_raw_samples) * sconf->max_order);
-
-        // reconstruct difference signal for prediction (joint-stereo)
-        if (bd->js_blocks && bd->raw_other) {
-            int32_t *left, *right;
-
-            if (bd->raw_other > raw_samples) {  // D = R - L
-                left  = raw_samples;
-                right = bd->raw_other;
-            } else {                                // D = R - L
-                left  = bd->raw_other;
-                right = raw_samples;
-            }
-
-            for (sb = -1; sb >= -sconf->max_order; sb--)
-                raw_samples[sb] = right[sb] - left[sb];
-        }
-
-        // reconstruct shifted signal
-        if (bd->shift_lsbs)
-            for (sb = -1; sb >= -sconf->max_order; sb--)
-                raw_samples[sb] >>= bd->shift_lsbs;
-    }
-
-    // reverse linear prediction coefficients for efficiency
-    lpc_cof = lpc_cof + opt_order;
-
-    for (sb = 0; sb < opt_order; sb++)
-        lpc_cof_reversed[sb] = lpc_cof[-(sb + 1)];
-
-    // reconstruct raw samples
-    raw_samples = bd->raw_samples + smp;
-    lpc_cof     = lpc_cof_reversed + opt_order;
-
-    for (; raw_samples < raw_samples_end; raw_samples++) {
-        y = 1 << 19;
-
-        for (sb = -opt_order; sb < 0; sb++)
-            y += MUL64(lpc_cof[sb], raw_samples[sb]);
-
-        *raw_samples -= y >> 20;
-    }
-
-    raw_samples = bd->raw_samples;
-
-    // restore previous samples in case that they have been altered
-    if (bd->store_prev_samples)
-        memcpy(raw_samples - sconf->max_order, bd->prev_raw_samples,
-               sizeof(*raw_samples) * sconf->max_order);
-
-    return 0;
-}
-
-
-/** Reads the block data.
- */
-static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
-{
-    GetBitContext *gb        = &ctx->gb;
-
-    // read block type flag and read the samples accordingly
-    if (get_bits1(gb)) {
-        if (read_var_block_data(ctx, bd))
-            return -1;
-    } else {
-        read_const_block_data(ctx, bd);
-    }
-
-    return 0;
-}
-
-
-/** Decodes the block data.
- */
-static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)
-{
-    unsigned int smp;
-
-    // read block type flag and read the samples accordingly
-    if (bd->const_block)
-        decode_const_block_data(ctx, bd);
-    else if (decode_var_block_data(ctx, bd))
-        return -1;
-
-    // TODO: read RLSLMS extension data
-
-    if (bd->shift_lsbs)
-        for (smp = 0; smp < bd->block_length; smp++)
-            bd->raw_samples[smp] <<= bd->shift_lsbs;
-
-    return 0;
-}
-
-
-/** Reads and decodes block data successively.
- */
-static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd)
-{
-    int ret;
-
-    ret = read_block(ctx, bd);
-
-    if (ret)
-        return ret;
-
-    ret = decode_block(ctx, bd);
-
-    return ret;
-}
-
-
-/** Computes the number of samples left to decode for the current frame and
- *  sets these samples to zero.
- */
-static void zero_remaining(unsigned int b, unsigned int b_max,
-                           const unsigned int *div_blocks, int32_t *buf)
-{
-    unsigned int count = 0;
-
-    while (b < b_max)
-        count += div_blocks[b];
-
-    if (count)
-        memset(buf, 0, sizeof(*buf) * count);
-}
-
-
-/** Decodes blocks independently.
- */
-static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame,
-                             unsigned int c, const unsigned int *div_blocks,
-                             unsigned int *js_blocks)
-{
-    unsigned int b;
-    ALSBlockData bd;
-
-    memset(&bd, 0, sizeof(ALSBlockData));
-
-    bd.ra_block         = ra_frame;
-    bd.use_ltp          = ctx->use_ltp;
-    bd.ltp_lag          = ctx->ltp_lag;
-    bd.ltp_gain         = ctx->ltp_gain[0];
-    bd.quant_cof        = ctx->quant_cof[0];
-    bd.lpc_cof          = ctx->lpc_cof[0];
-    bd.prev_raw_samples = ctx->prev_raw_samples;
-    bd.raw_samples      = ctx->raw_samples[c];
-
-
-    for (b = 0; b < ctx->num_blocks; b++) {
-        bd.shift_lsbs       = 0;
-        bd.block_length     = div_blocks[b];
-
-        if (read_decode_block(ctx, &bd)) {
-            // damaged block, write zero for the rest of the frame
-            zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples);
-            return -1;
-        }
-        bd.raw_samples += div_blocks[b];
-        bd.ra_block     = 0;
-    }
-
-    return 0;
-}
-
-
-/** Decodes blocks dependently.
- */
-static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame,
-                         unsigned int c, const unsigned int *div_blocks,
-                         unsigned int *js_blocks)
-{
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    unsigned int offset = 0;
-    unsigned int b;
-    ALSBlockData bd[2];
-
-    memset(bd, 0, 2 * sizeof(ALSBlockData));
-
-    bd[0].ra_block         = ra_frame;
-    bd[0].use_ltp          = ctx->use_ltp;
-    bd[0].ltp_lag          = ctx->ltp_lag;
-    bd[0].ltp_gain         = ctx->ltp_gain[0];
-    bd[0].quant_cof        = ctx->quant_cof[0];
-    bd[0].lpc_cof          = ctx->lpc_cof[0];
-    bd[0].prev_raw_samples = ctx->prev_raw_samples;
-    bd[0].js_blocks        = *js_blocks;
-
-    bd[1].ra_block         = ra_frame;
-    bd[1].use_ltp          = ctx->use_ltp;
-    bd[1].ltp_lag          = ctx->ltp_lag;
-    bd[1].ltp_gain         = ctx->ltp_gain[0];
-    bd[1].quant_cof        = ctx->quant_cof[0];
-    bd[1].lpc_cof          = ctx->lpc_cof[0];
-    bd[1].prev_raw_samples = ctx->prev_raw_samples;
-    bd[1].js_blocks        = *(js_blocks + 1);
-
-    // decode all blocks
-    for (b = 0; b < ctx->num_blocks; b++) {
-        unsigned int s;
-
-        bd[0].shift_lsbs   = 0;
-        bd[1].shift_lsbs   = 0;
-
-        bd[0].block_length = div_blocks[b];
-        bd[1].block_length = div_blocks[b];
-
-        bd[0].raw_samples  = ctx->raw_samples[c    ] + offset;
-        bd[1].raw_samples  = ctx->raw_samples[c + 1] + offset;
-
-        bd[0].raw_other    = bd[1].raw_samples;
-        bd[1].raw_other    = bd[0].raw_samples;
-
-        if(read_decode_block(ctx, &bd[0]) || read_decode_block(ctx, &bd[1])) {
-            // damaged block, write zero for the rest of the frame
-            zero_remaining(b, ctx->num_blocks, div_blocks, bd[0].raw_samples);
-            zero_remaining(b, ctx->num_blocks, div_blocks, bd[1].raw_samples);
-            return -1;
-        }
-
-        // reconstruct joint-stereo blocks
-        if (bd[0].js_blocks) {
-            if (bd[1].js_blocks)
-                av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel pair!\n");
-
-            for (s = 0; s < div_blocks[b]; s++)
-                bd[0].raw_samples[s] = bd[1].raw_samples[s] - bd[0].raw_samples[s];
-        } else if (bd[1].js_blocks) {
-            for (s = 0; s < div_blocks[b]; s++)
-                bd[1].raw_samples[s] = bd[1].raw_samples[s] + bd[0].raw_samples[s];
-        }
-
-        offset  += div_blocks[b];
-        bd[0].ra_block = 0;
-        bd[1].ra_block = 0;
-    }
-
-    // store carryover raw samples,
-    // the others channel raw samples are stored by the calling function.
-    memmove(ctx->raw_samples[c] - sconf->max_order,
-            ctx->raw_samples[c] - sconf->max_order + sconf->frame_length,
-            sizeof(*ctx->raw_samples[c]) * sconf->max_order);
-
-    return 0;
-}
-
-
-/** Reads the channel data.
-  */
-static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c)
-{
-    GetBitContext *gb       = &ctx->gb;
-    ALSChannelData *current = cd;
-    unsigned int channels   = ctx->avctx->channels;
-    int entries             = 0;
-
-    while (entries < channels && !(current->stop_flag = get_bits1(gb))) {
-        current->master_channel = get_bits_long(gb, av_ceil_log2(channels));
-
-        if (current->master_channel >= channels) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel!\n");
-            return -1;
-        }
-
-        if (current->master_channel != c) {
-            current->time_diff_flag = get_bits1(gb);
-            current->weighting[0]   = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
-            current->weighting[1]   = mcc_weightings[av_clip(decode_rice(gb, 2) + 14, 0, 32)];
-            current->weighting[2]   = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
-
-            if (current->time_diff_flag) {
-                current->weighting[3] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
-                current->weighting[4] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
-                current->weighting[5] = mcc_weightings[av_clip(decode_rice(gb, 1) + 16, 0, 32)];
-
-                current->time_diff_sign  = get_bits1(gb);
-                current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3;
-            }
-        }
-
-        current++;
-        entries++;
-    }
-
-    if (entries == channels) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data!\n");
-        return -1;
-    }
-
-    align_get_bits(gb);
-    return 0;
-}
-
-
-/** Recursively reverts the inter-channel correlation for a block.
- */
-static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd,
-                                       ALSChannelData **cd, int *reverted,
-                                       unsigned int offset, int c)
-{
-    ALSChannelData *ch = cd[c];
-    unsigned int   dep = 0;
-    unsigned int channels = ctx->avctx->channels;
-
-    if (reverted[c])
-        return 0;
-
-    reverted[c] = 1;
-
-    while (dep < channels && !ch[dep].stop_flag) {
-        revert_channel_correlation(ctx, bd, cd, reverted, offset,
-                                   ch[dep].master_channel);
-
-        dep++;
-    }
-
-    if (dep == channels) {
-        av_log(ctx->avctx, AV_LOG_WARNING, "Invalid channel correlation!\n");
-        return -1;
-    }
-
-    bd->use_ltp     = ctx->use_ltp + c;
-    bd->ltp_lag     = ctx->ltp_lag + c;
-    bd->ltp_gain    = ctx->ltp_gain[c];
-    bd->lpc_cof     = ctx->lpc_cof[c];
-    bd->quant_cof   = ctx->quant_cof[c];
-    bd->raw_samples = ctx->raw_samples[c] + offset;
-
-    dep = 0;
-    while (!ch[dep].stop_flag) {
-        unsigned int smp;
-        unsigned int begin = 1;
-        unsigned int end   = bd->block_length - 1;
-        int64_t y;
-        int32_t *master = ctx->raw_samples[ch[dep].master_channel] + offset;
-
-        if (ch[dep].time_diff_flag) {
-            int t = ch[dep].time_diff_index;
-
-            if (ch[dep].time_diff_sign) {
-                t      = -t;
-                begin -= t;
-            } else {
-                end   -= t;
-            }
-
-            for (smp = begin; smp < end; smp++) {
-                y  = (1 << 6) +
-                     MUL64(ch[dep].weighting[0], master[smp - 1    ]) +
-                     MUL64(ch[dep].weighting[1], master[smp        ]) +
-                     MUL64(ch[dep].weighting[2], master[smp + 1    ]) +
-                     MUL64(ch[dep].weighting[3], master[smp - 1 + t]) +
-                     MUL64(ch[dep].weighting[4], master[smp     + t]) +
-                     MUL64(ch[dep].weighting[5], master[smp + 1 + t]);
-
-                bd->raw_samples[smp] += y >> 7;
-            }
-        } else {
-            for (smp = begin; smp < end; smp++) {
-                y  = (1 << 6) +
-                     MUL64(ch[dep].weighting[0], master[smp - 1]) +
-                     MUL64(ch[dep].weighting[1], master[smp    ]) +
-                     MUL64(ch[dep].weighting[2], master[smp + 1]);
-
-                bd->raw_samples[smp] += y >> 7;
-            }
-        }
-
-        dep++;
-    }
-
-    return 0;
-}
-
-
-/** Reads the frame data.
- */
-static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
-{
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    AVCodecContext *avctx    = ctx->avctx;
-    GetBitContext *gb = &ctx->gb;
-    unsigned int div_blocks[32];                ///< block sizes.
-    unsigned int c;
-    unsigned int js_blocks[2];
-
-    uint32_t bs_info = 0;
-
-    // skip the size of the ra unit if present in the frame
-    if (sconf->ra_flag == RA_FLAG_FRAMES && ra_frame)
-        skip_bits_long(gb, 32);
-
-    if (sconf->mc_coding && sconf->joint_stereo) {
-        ctx->js_switch = get_bits1(gb);
-        align_get_bits(gb);
-    }
-
-    if (!sconf->mc_coding || ctx->js_switch) {
-        int independent_bs = !sconf->joint_stereo;
-
-        for (c = 0; c < avctx->channels; c++) {
-            js_blocks[0] = 0;
-            js_blocks[1] = 0;
-
-            get_block_sizes(ctx, div_blocks, &bs_info);
-
-            // if joint_stereo and block_switching is set, independent decoding
-            // is signaled via the first bit of bs_info
-            if (sconf->joint_stereo && sconf->block_switching)
-                if (bs_info >> 31)
-                    independent_bs = 2;
-
-            // if this is the last channel, it has to be decoded independently
-            if (c == avctx->channels - 1)
-                independent_bs = 1;
-
-            if (independent_bs) {
-                if (decode_blocks_ind(ctx, ra_frame, c, div_blocks, js_blocks))
-                    return -1;
-
-                independent_bs--;
-            } else {
-                if (decode_blocks(ctx, ra_frame, c, div_blocks, js_blocks))
-                    return -1;
-
-                c++;
-            }
-
-            // store carryover raw samples
-            memmove(ctx->raw_samples[c] - sconf->max_order,
-                    ctx->raw_samples[c] - sconf->max_order + sconf->frame_length,
-                    sizeof(*ctx->raw_samples[c]) * sconf->max_order);
-        }
-    } else { // multi-channel coding
-        ALSBlockData   bd;
-        int            b;
-        int            *reverted_channels = ctx->reverted_channels;
-        unsigned int   offset             = 0;
-
-        for (c = 0; c < avctx->channels; c++)
-            if (ctx->chan_data[c] < ctx->chan_data_buffer) {
-                av_log(ctx->avctx, AV_LOG_ERROR, "Invalid channel data!\n");
-                return -1;
-            }
-
-        memset(&bd,               0, sizeof(ALSBlockData));
-        memset(reverted_channels, 0, sizeof(*reverted_channels) * avctx->channels);
-
-        bd.ra_block         = ra_frame;
-        bd.prev_raw_samples = ctx->prev_raw_samples;
-
-        get_block_sizes(ctx, div_blocks, &bs_info);
-
-        for (b = 0; b < ctx->num_blocks; b++) {
-            bd.shift_lsbs   = 0;
-            bd.block_length = div_blocks[b];
-
-            for (c = 0; c < avctx->channels; c++) {
-                bd.use_ltp     = ctx->use_ltp + c;
-                bd.ltp_lag     = ctx->ltp_lag + c;
-                bd.ltp_gain    = ctx->ltp_gain[c];
-                bd.lpc_cof     = ctx->lpc_cof[c];
-                bd.quant_cof   = ctx->quant_cof[c];
-                bd.raw_samples = ctx->raw_samples[c] + offset;
-                bd.raw_other   = NULL;
-
-                read_block(ctx, &bd);
-                if (read_channel_data(ctx, ctx->chan_data[c], c))
-                    return -1;
-            }
-
-            for (c = 0; c < avctx->channels; c++)
-                if (revert_channel_correlation(ctx, &bd, ctx->chan_data,
-                                               reverted_channels, offset, c))
-                    return -1;
-
-            for (c = 0; c < avctx->channels; c++) {
-                bd.use_ltp     = ctx->use_ltp + c;
-                bd.ltp_lag     = ctx->ltp_lag + c;
-                bd.ltp_gain    = ctx->ltp_gain[c];
-                bd.lpc_cof     = ctx->lpc_cof[c];
-                bd.quant_cof   = ctx->quant_cof[c];
-                bd.raw_samples = ctx->raw_samples[c] + offset;
-                decode_block(ctx, &bd);
-            }
-
-            memset(reverted_channels, 0, avctx->channels * sizeof(*reverted_channels));
-            offset      += div_blocks[b];
-            bd.ra_block  = 0;
-        }
-
-        // store carryover raw samples
-        for (c = 0; c < avctx->channels; c++)
-            memmove(ctx->raw_samples[c] - sconf->max_order,
-                    ctx->raw_samples[c] - sconf->max_order + sconf->frame_length,
-                    sizeof(*ctx->raw_samples[c]) * sconf->max_order);
-    }
-
-    // TODO: read_diff_float_data
-
-    return 0;
-}
-
-
-/** Decodes an ALS frame.
- */
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    ALSDecContext *ctx       = avctx->priv_data;
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    const uint8_t *buffer    = avpkt->data;
-    int buffer_size          = avpkt->size;
-    int invalid_frame, size;
-    unsigned int c, sample, ra_frame, bytes_read, shift;
-
-    init_get_bits(&ctx->gb, buffer, buffer_size * 8);
-
-    // In the case that the distance between random access frames is set to zero
-    // (sconf->ra_distance == 0) no frame is treated as a random access frame.
-    // For the first frame, if prediction is used, all samples used from the
-    // previous frame are assumed to be zero.
-    ra_frame = sconf->ra_distance && !(ctx->frame_id % sconf->ra_distance);
-
-    // the last frame to decode might have a different length
-    if (sconf->samples != 0xFFFFFFFF)
-        ctx->cur_frame_length = FFMIN(sconf->samples - ctx->frame_id * (uint64_t) sconf->frame_length,
-                                      sconf->frame_length);
-    else
-        ctx->cur_frame_length = sconf->frame_length;
-
-    // decode the frame data
-    if ((invalid_frame = read_frame_data(ctx, ra_frame) < 0))
-        av_log(ctx->avctx, AV_LOG_WARNING,
-               "Reading frame data failed. Skipping RA unit.\n");
-
-    ctx->frame_id++;
-
-    // check for size of decoded data
-    size = ctx->cur_frame_length * avctx->channels *
-           (av_get_bits_per_sample_format(avctx->sample_fmt) >> 3);
-
-    if (size > *data_size) {
-        av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n");
-        return -1;
-    }
-
-    *data_size = size;
-
-    // transform decoded frame into output format
-    #define INTERLEAVE_OUTPUT(bps)                                 \
-    {                                                              \
-        int##bps##_t *dest = (int##bps##_t*) data;                 \
-        shift = bps - ctx->avctx->bits_per_raw_sample;             \
-        for (sample = 0; sample < ctx->cur_frame_length; sample++) \
-            for (c = 0; c < avctx->channels; c++)                  \
-                *dest++ = ctx->raw_samples[c][sample] << shift;    \
-    }
-
-    if (ctx->avctx->bits_per_raw_sample <= 16) {
-        INTERLEAVE_OUTPUT(16)
-    } else {
-        INTERLEAVE_OUTPUT(32)
-    }
-
-    bytes_read = invalid_frame ? buffer_size :
-                                 (get_bits_count(&ctx->gb) + 7) >> 3;
-
-    return bytes_read;
-}
-
-
-/** Uninitializes the ALS decoder.
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    ALSDecContext *ctx = avctx->priv_data;
-
-    av_freep(&ctx->sconf.chan_pos);
-
-    ff_bgmc_end(&ctx->bgmc_lut, &ctx->bgmc_lut_status);
-
-    av_freep(&ctx->use_ltp);
-    av_freep(&ctx->ltp_lag);
-    av_freep(&ctx->ltp_gain);
-    av_freep(&ctx->ltp_gain_buffer);
-    av_freep(&ctx->quant_cof);
-    av_freep(&ctx->lpc_cof);
-    av_freep(&ctx->quant_cof_buffer);
-    av_freep(&ctx->lpc_cof_buffer);
-    av_freep(&ctx->lpc_cof_reversed_buffer);
-    av_freep(&ctx->prev_raw_samples);
-    av_freep(&ctx->raw_samples);
-    av_freep(&ctx->raw_buffer);
-    av_freep(&ctx->chan_data);
-    av_freep(&ctx->chan_data_buffer);
-    av_freep(&ctx->reverted_channels);
-
-    return 0;
-}
-
-
-/** Initializes the ALS decoder.
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    unsigned int c;
-    unsigned int channel_size;
-    int num_buffers;
-    ALSDecContext *ctx = avctx->priv_data;
-    ALSSpecificConfig *sconf = &ctx->sconf;
-    ctx->avctx = avctx;
-
-    if (!avctx->extradata) {
-        av_log(avctx, AV_LOG_ERROR, "Missing required ALS extradata.\n");
-        return -1;
-    }
-
-    if (read_specific_config(ctx)) {
-        av_log(avctx, AV_LOG_ERROR, "Reading ALSSpecificConfig failed.\n");
-        decode_end(avctx);
-        return -1;
-    }
-
-    if (check_specific_config(ctx)) {
-        decode_end(avctx);
-        return -1;
-    }
-
-    if (sconf->bgmc)
-        ff_bgmc_init(avctx, &ctx->bgmc_lut, &ctx->bgmc_lut_status);
-
-    if (sconf->floating) {
-        avctx->sample_fmt          = SAMPLE_FMT_FLT;
-        avctx->bits_per_raw_sample = 32;
-    } else {
-        avctx->sample_fmt          = sconf->resolution > 1
-                                     ? SAMPLE_FMT_S32 : SAMPLE_FMT_S16;
-        avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
-    }
-
-    // set maximum Rice parameter for progressive decoding based on resolution
-    // This is not specified in 14496-3 but actually done by the reference
-    // codec RM22 revision 2.
-    ctx->s_max = sconf->resolution > 1 ? 31 : 15;
-
-    // set lag value for long-term prediction
-    ctx->ltp_lag_length = 8 + (avctx->sample_rate >=  96000) +
-                              (avctx->sample_rate >= 192000);
-
-    // allocate quantized parcor coefficient buffer
-    num_buffers = sconf->mc_coding ? avctx->channels : 1;
-
-    ctx->quant_cof        = av_malloc(sizeof(*ctx->quant_cof) * num_buffers);
-    ctx->lpc_cof          = av_malloc(sizeof(*ctx->lpc_cof)   * num_buffers);
-    ctx->quant_cof_buffer = av_malloc(sizeof(*ctx->quant_cof_buffer) *
-                                      num_buffers * sconf->max_order);
-    ctx->lpc_cof_buffer   = av_malloc(sizeof(*ctx->lpc_cof_buffer) *
-                                      num_buffers * sconf->max_order);
-    ctx->lpc_cof_reversed_buffer = av_malloc(sizeof(*ctx->lpc_cof_buffer) *
-                                             sconf->max_order);
-
-    if (!ctx->quant_cof              || !ctx->lpc_cof        ||
-        !ctx->quant_cof_buffer       || !ctx->lpc_cof_buffer ||
-        !ctx->lpc_cof_reversed_buffer) {
-        av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
-        return AVERROR(ENOMEM);
-    }
-
-    // assign quantized parcor coefficient buffers
-    for (c = 0; c < num_buffers; c++) {
-        ctx->quant_cof[c] = ctx->quant_cof_buffer + c * sconf->max_order;
-        ctx->lpc_cof[c]   = ctx->lpc_cof_buffer   + c * sconf->max_order;
-    }
-
-    // allocate and assign lag and gain data buffer for ltp mode
-    ctx->use_ltp         = av_mallocz(sizeof(*ctx->use_ltp)  * num_buffers);
-    ctx->ltp_lag         = av_malloc (sizeof(*ctx->ltp_lag)  * num_buffers);
-    ctx->ltp_gain        = av_malloc (sizeof(*ctx->ltp_gain) * num_buffers);
-    ctx->ltp_gain_buffer = av_malloc (sizeof(*ctx->ltp_gain_buffer) *
-                                      num_buffers * 5);
-
-    if (!ctx->use_ltp  || !ctx->ltp_lag ||
-        !ctx->ltp_gain || !ctx->ltp_gain_buffer) {
-        av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
-        decode_end(avctx);
-        return AVERROR(ENOMEM);
-    }
-
-    for (c = 0; c < num_buffers; c++)
-        ctx->ltp_gain[c] = ctx->ltp_gain_buffer + c * 5;
-
-    // allocate and assign channel data buffer for mcc mode
-    if (sconf->mc_coding) {
-        ctx->chan_data_buffer  = av_malloc(sizeof(*ctx->chan_data_buffer) *
-                                           num_buffers * num_buffers);
-        ctx->chan_data         = av_malloc(sizeof(*ctx->chan_data) *
-                                           num_buffers);
-        ctx->reverted_channels = av_malloc(sizeof(*ctx->reverted_channels) *
-                                           num_buffers);
-
-        if (!ctx->chan_data_buffer || !ctx->chan_data || !ctx->reverted_channels) {
-            av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
-            decode_end(avctx);
-            return AVERROR(ENOMEM);
-        }
-
-        for (c = 0; c < num_buffers; c++)
-            ctx->chan_data[c] = ctx->chan_data_buffer + c * num_buffers;
-    } else {
-        ctx->chan_data         = NULL;
-        ctx->chan_data_buffer  = NULL;
-        ctx->reverted_channels = NULL;
-    }
-
-    avctx->frame_size = sconf->frame_length;
-    channel_size      = sconf->frame_length + sconf->max_order;
-
-    ctx->prev_raw_samples = av_malloc (sizeof(*ctx->prev_raw_samples) * sconf->max_order);
-    ctx->raw_buffer       = av_mallocz(sizeof(*ctx->     raw_buffer)  * avctx->channels * channel_size);
-    ctx->raw_samples      = av_malloc (sizeof(*ctx->     raw_samples) * avctx->channels);
-
-    // allocate previous raw sample buffer
-    if (!ctx->prev_raw_samples || !ctx->raw_buffer|| !ctx->raw_samples) {
-        av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
-        decode_end(avctx);
-        return AVERROR(ENOMEM);
-    }
-
-    // assign raw samples buffers
-    ctx->raw_samples[0] = ctx->raw_buffer + sconf->max_order;
-    for (c = 1; c < avctx->channels; c++)
-        ctx->raw_samples[c] = ctx->raw_samples[c - 1] + channel_size;
-
-    return 0;
-}
-
-
-/** Flushes (resets) the frame ID after seeking.
- */
-static av_cold void flush(AVCodecContext *avctx)
-{
-    ALSDecContext *ctx = avctx->priv_data;
-
-    ctx->frame_id = 0;
-}
-
-
-AVCodec als_decoder = {
-    "als",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP4ALS,
-    sizeof(ALSDecContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    .flush = flush,
-    .capabilities = CODEC_CAP_SUBFRAMES,
-    .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"),
-};
-
diff --git a/libavcodec/amrnbdata.h b/libavcodec/amrnbdata.h
deleted file mode 100644
index 2f21439..0000000
--- a/libavcodec/amrnbdata.h
+++ /dev/null
@@ -1,1672 +0,0 @@
-/*
- * AMR narrowband data and definitions
- * Copyright (c) 2006-2007 Robert Swain
- * Copyright (c) 2009 Colin McQuillan
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-/**
- * @file
- * AMR narrowband data and definitions
- */
-
-#ifndef AVCODEC_AMRNBDATA_H
-#define AVCODEC_AMRNBDATA_H
-
-#include <stdint.h>
-
-#include "libavutil/common.h"      /* offsetof */
-
-#define AMR_SUBFRAME_SIZE            40   ///< samples per subframe
-
-/** Frame type (Table 1a in 3GPP TS 26.101) */
-enum Mode {
-    MODE_4k75 = 0,                        ///< 4.75 kbit/s
-    MODE_5k15,                            ///< 5.15 kbit/s
-    MODE_5k9,                             ///< 5.90 kbit/s
-    MODE_6k7,                             ///< 6.70 kbit/s
-    MODE_7k4,                             ///< 7.40 kbit/s
-    MODE_7k95,                            ///< 7.95 kbit/s
-    MODE_10k2,                            ///< 10.2 kbit/s
-    MODE_12k2,                            ///< 12.2 kbit/s
-    MODE_DTX,                             ///< silent frame
-    N_MODES,                              ///< number of modes
-    NO_DATA = 15                          ///< no transmission
-};
-
-#define LP_FILTER_ORDER 10        ///< linear predictive coding filter order
-
-/**
- * AMRNB unpacked data subframe
- */
-typedef struct {
-    uint16_t p_lag;      ///< index to decode the pitch lag
-    uint16_t p_gain;     ///< index to decode the pitch gain
-    uint16_t fixed_gain; ///< index to decode the fixed gain factor, for MODE_12k2 and MODE_7k95
-    uint16_t pulses[10]; ///< pulses: 10 for MODE_12k2, 7 for MODE_10k2, and index and sign for others
-} AMRNBSubframe;
-
-/**
- * AMRNB unpacked data frame
- */
-typedef struct {
-    uint16_t lsf[5];           ///< lsf parameters: 5 parameters for MODE_12k2, only 3 for other modes
-    AMRNBSubframe subframe[4]; ///< unpacked data for each subframe
-} AMRNBFrame;
-
-/** The index of a frame parameter */
-#define AMR_BIT(field)                  (offsetof(AMRNBFrame, field) >> 1)
-/** The index of a subframe-specific parameter */
-#define AMR_OF(frame_num, variable)     AMR_BIT(subframe[frame_num].variable)
-
-// The following order* tables are used to convert AMR frame parameters to and
-// from a bitstream. See 3GPP TS 26.101 for more information.
-// Each field in AMRNBFrame is stored as:
-// * one byte for the number of bits in the field
-// * one byte for the field index
-// * then, one byte for each bit of the field (from most-significant to least)
-//         of the position of that bit in the AMR frame.
-static const uint8_t order_MODE_4k75[] = {
-     8, AMR_BIT(lsf[0]),        7,   6,   5,   4,   3,   2,   1,   0,
-     8, AMR_BIT(lsf[1]),       15,  14,  13,  12,  11,  10,   9,   8,
-     7, AMR_BIT(lsf[2]),       51,  35,  34,  50,  33,  49,  32,
-     8, AMR_OF(0,p_lag),       23,  22,  21,  20,  19,  18,  43,  42,
-     8, AMR_OF(0,p_gain),      54,  55,  40,  41,  24,  25,  26,  27,
-     7, AMR_OF(0,pulses[0]),   92,  68,  67,  84,  66,  65,  80,
-     2, AMR_OF(0,pulses[1]),   53,  52,
-     4, AMR_OF(1,p_lag),       17,  16,  48,  63,
-     7, AMR_OF(1,pulses[0]),   91,  64,  79,  83,  78,  77,  95,
-     2, AMR_OF(1,pulses[1]),   62,  61,
-     4, AMR_OF(2,p_lag),       31,  30,  60,  59,
-     8, AMR_OF(2,p_gain),      44,  45,  46,  47,  36,  37,  38,  39,
-     7, AMR_OF(2,pulses[0]),   90,  76,  75,  82,  74,  73,  94,
-     2, AMR_OF(2,pulses[1]),   58,  57,
-     4, AMR_OF(3,p_lag),       29,  28,  56,  71,
-     7, AMR_OF(3,pulses[0]),   89,  72,  87,  81,  86,  85,  93,
-     2, AMR_OF(3,pulses[1]),   70,  69,
-     0
-};
-
-static const uint8_t order_MODE_5k15[] = {
-     8, AMR_BIT(lsf[0]),        0,   1,   2,   3,   4,   5,   6,   7,
-     8, AMR_BIT(lsf[1]),        8,   9,  10,  11,  12,  13,  14,  15,
-     7, AMR_BIT(lsf[2]),       70,  51,  43,  71,  50,  60,  49,
-     8, AMR_OF(0,p_lag),       23,  22,  21,  20,  19,  47,  54,  59,
-     6, AMR_OF(0,p_gain),      48,  42,  35,  29,  30,  31,
-     7, AMR_OF(0,pulses[0]),   92,  84,  82, 100,  79,  72,  88,
-     2, AMR_OF(0,pulses[1]),   67,  68,
-     4, AMR_OF(1,p_lag),       18,  46,  53,  58,
-     6, AMR_OF(1,p_gain),      63,  41,  34,  26,  27,  28,
-     7, AMR_OF(1,pulses[0]),   91,  83,  81,  99,  78,  87, 103,
-     2, AMR_OF(1,pulses[1]),   65,  66,
-     4, AMR_OF(2,p_lag),       17,  45,  52,  57,
-     6, AMR_OF(2,p_gain),      62,  40,  33,  39,  24,  25,
-     7, AMR_OF(2,pulses[0]),   90,  80,  95,  98,  77,  86, 102,
-     2, AMR_OF(2,pulses[1]),   75,  64,
-     4, AMR_OF(3,p_lag),       16,  44,  56,  69,
-     6, AMR_OF(3,p_gain),      61,  55,  32,  36,  37,  38,
-     7, AMR_OF(3,pulses[0]),   89,  94,  93,  97,  76,  85, 101,
-     2, AMR_OF(3,pulses[1]),   73,  74,
-     0
-};
-
-static const uint8_t order_MODE_5k9[] = {
-     8, AMR_BIT(lsf[0]),        7,   6,   0,   3,   5,   4,   2,   1,
-     9, AMR_BIT(lsf[1]),       13,  12,   8,  11,  10,  15,   9,  14,  23,
-     9, AMR_BIT(lsf[2]),       71,  56,  60,  70,  59,  57,  58,  69,  76,
-     8, AMR_OF(0,p_lag),       16,  18,  22,  20,  30,  38,  44,  42,
-     6, AMR_OF(0,p_gain),      75,  48,  52,  40,  34,  26,
-     9, AMR_OF(0,pulses[0]),  101,  89,  93, 117, 105,  81,  85, 109,  97,
-     2, AMR_OF(0,pulses[1]),   67,  78,
-     4, AMR_OF(1,p_lag),       28,  36,  46,  87,
-     6, AMR_OF(1,p_gain),      74,  63,  51,  55,  33,  25,
-     9, AMR_OF(1,pulses[0]),  100,  88,  92, 116, 104,  80,  84, 108,  96,
-     2, AMR_OF(1,pulses[1]),   64,  79,
-     8, AMR_OF(2,p_lag),       31,  17,  21,  19,  29,  37,  43,  41,
-     6, AMR_OF(2,p_gain),      73,  62,  50,  54,  32,  24,
-     9, AMR_OF(2,pulses[0]),   99, 103,  91, 115, 119,  95,  83, 107, 111,
-     2, AMR_OF(2,pulses[1]),   66,  77,
-     4, AMR_OF(3,p_lag),       27,  35,  45,  86,
-     6, AMR_OF(3,p_gain),      72,  61,  49,  53,  47,  39,
-     9, AMR_OF(3,pulses[0]),   98, 102,  90, 114, 118,  94,  82, 106, 110,
-     2, AMR_OF(3,pulses[1]),   65,  68,
-     0
-};
-
-static const uint8_t order_MODE_6k7[] = {
-     8, AMR_BIT(lsf[0]),        7,   6,  15,   4,   5,   3,   2,   0,
-     9, AMR_BIT(lsf[1]),       14,  13,   8,  12,  10,   1,   9,  11,  29,
-     9, AMR_BIT(lsf[2]),       57,  58,  50,  56,  60,  59,  49,  71,  70,
-     8, AMR_OF(0,p_lag),       17,  19,  23,  21,  31,  24,  32,  52,
-     7, AMR_OF(0,p_gain),      36,  82,  69,  46,  42,  48,  77,
-    11, AMR_OF(0,pulses[0]),  109,  97, 133, 121, 101,  89, 125, 113,  93, 117,
-                              105,
-     3, AMR_OF(0,pulses[1]),   81,  73,  65,
-     4, AMR_OF(1,p_lag),       28,  26,  38,  54,
-     7, AMR_OF(1,p_gain),      35,  83,  68,  45,  41,  63,  76,
-    11, AMR_OF(1,pulses[0]),  108,  96, 132, 120, 100,  88, 124, 112,  92, 116,
-                              104,
-     3, AMR_OF(1,pulses[1]),   80,  72,  64,
-     8, AMR_OF(2,p_lag),       16,  18,  22,  20,  30,  39,  47,  51,
-     7, AMR_OF(2,p_gain),      34,  84,  67,  44,  40,  62,  75,
-    11, AMR_OF(2,pulses[0]),  107, 111, 131, 135,  99, 103, 123, 127,  91, 115,
-                              119,
-     3, AMR_OF(2,pulses[1]),   95,  87,  79,
-     4, AMR_OF(3,p_lag),       27,  25,  37,  53,
-     7, AMR_OF(3,p_gain),      33,  85,  66,  43,  55,  61,  74,
-    11, AMR_OF(3,pulses[0]),  106, 110, 130, 134,  98, 102, 122, 126,  90, 114,
-                              118,
-     3, AMR_OF(3,pulses[1]),   94,  86,  78,
-     0
-};
-
-static const uint8_t order_MODE_7k4[] = {
-     8, AMR_BIT(lsf[0]),        7,   6,   5,   4,   3,   2,   1,   0,
-     9, AMR_BIT(lsf[1]),       15,  14,  13,  12,  11,  10,   9,   8,  23,
-     9, AMR_BIT(lsf[2]),       53,  52,  51,  58,  40,  55,  54,  57,  56,
-     8, AMR_OF(0,p_lag),       22,  20,  18,  16,  30,  50,  95,  94,
-     7, AMR_OF(0,p_gain),      28,  24,  73,  36,  32,  62,  67,
-    13, AMR_OF(0,pulses[0]),  127, 123, 135, 131, 143, 139, 151, 103, 102, 101,
-                              100,  99,  98,
-     4, AMR_OF(0,pulses[1]),   83,  75,  79,  71,
-     5, AMR_OF(1,p_lag),       44,  42,  49,  93,  92,
-     7, AMR_OF(1,p_gain),      27,  39,  72,  35,  47,  61,  66,
-    13, AMR_OF(1,pulses[0]),  126, 122, 134, 130, 142, 138, 150,  97,  96, 111,
-                              110, 109, 108,
-     4, AMR_OF(1,pulses[1]),   82,  74,  78,  70,
-     8, AMR_OF(2,p_lag),       21,  19,  17,  31,  29,  48,  91,  90,
-     7, AMR_OF(2,p_gain),      26,  38,  87,  34,  46,  60,  65,
-    13, AMR_OF(2,pulses[0]),  125, 121, 133, 129, 141, 137, 149, 107, 106, 105,
-                              104, 119, 118,
-     4, AMR_OF(2,pulses[1]),   81,  85,  77,  69,
-     5, AMR_OF(3,p_lag),       43,  41,  63,  89,  88,
-     7, AMR_OF(3,p_gain),      25,  37,  86,  33,  45,  59,  64,
-    13, AMR_OF(3,pulses[0]),  124, 120, 132, 128, 140, 136, 148, 117, 116, 115,
-                              114, 113, 112,
-     4, AMR_OF(3,pulses[1]),   80,  84,  76,  68,
-     0
-};
-
-static const uint8_t order_MODE_7k95[] = {
-     9, AMR_BIT(lsf[0]),       67,  68,   1,   2,   3,   4,   5,   6,   7,
-     9, AMR_BIT(lsf[1]),       14,  13,   9,  12,  11,   0,  10,  15,   8,
-     9, AMR_BIT(lsf[2]),       18,  19,  23,  17,  22,  20,  21,  66,  65,
-     8, AMR_OF(0,p_lag),       44,  42,  40,  54,  52,  56,  64,  78,
-     4, AMR_OF(0,p_gain),      36,  32,  72,  80,
-     5, AMR_OF(0,fixed_gain),  16,  28,  24,  60,  84,
-    13, AMR_OF(0,pulses[0]),  135, 109, 144, 156, 120,  97, 148, 121, 101, 122,
-                              123,  89, 124,
-     4, AMR_OF(0,pulses[1]),  125, 126, 127, 112,
-     6, AMR_OF(1,p_lag),       50,  48,  62,  70,  76,  74,
-     4, AMR_OF(1,p_gain),      35,  47,  87,  95,
-     5, AMR_OF(1,fixed_gain),  31,  27,  39,  59,  83,
-    13, AMR_OF(1,pulses[0]),  129, 108, 159, 155, 130,  96, 147, 131, 100, 132,
-                              133,  88, 134,
-     4, AMR_OF(1,pulses[1]),  113, 114, 115, 116,
-     8, AMR_OF(2,p_lag),       43,  41,  55,  53,  51,  71,  79,  77,
-     4, AMR_OF(2,p_gain),      34,  46,  86,  94,
-     5, AMR_OF(2,fixed_gain),  30,  26,  38,  58,  82,
-    13, AMR_OF(2,pulses[0]),  139, 107, 158, 154, 140, 111, 146, 141,  99, 142,
-                              143, 103, 128,
-     4, AMR_OF(2,pulses[1]),  105,  90,  91,  92,
-     6, AMR_OF(3,p_lag),       49,  63,  61,  69,  75,  73,
-     4, AMR_OF(3,p_gain),      33,  45,  85,  93,
-     5, AMR_OF(3,fixed_gain),  29,  25,  37,  57,  81,
-    13, AMR_OF(3,pulses[0]),  149, 106, 157, 153, 150, 110, 145, 151,  98, 136,
-                              137, 102, 138,
-     4, AMR_OF(3,pulses[1]),  117, 118, 119, 104,
-     0
-};
-
-static const uint8_t order_MODE_10k2[] = {
-     8, AMR_BIT(lsf[0]),        0,   1,   2,   3,   4,   5,   6,   7,
-     9, AMR_BIT(lsf[1]),       23,   8,   9,  10,  11,  12,  13,  14,  15,
-     9, AMR_BIT(lsf[2]),       57,  58,  62,  56,  60,  59,  61,  71,  70,
-     8, AMR_OF(0,p_lag),       22,  21,  20,  19,  18,  17,  42,  41,
-     7, AMR_OF(0,p_gain),      38,  50,  84,  37,  36,  85,  83,
-     1, AMR_OF(0,pulses[0]),   66,
-     1, AMR_OF(0,pulses[1]),   67,
-     1, AMR_OF(0,pulses[2]),   68,
-     1, AMR_OF(0,pulses[3]),   69,
-    10, AMR_OF(0,pulses[4]),  145, 144, 156, 153, 154, 163, 161, 192, 206, 195,
-    10, AMR_OF(0,pulses[5]),  158, 159, 157, 152, 155, 165, 160, 205, 204, 194,
-     7, AMR_OF(0,pulses[6]),  167, 166, 162, 164, 196, 207, 193,
-     5, AMR_OF(1,p_lag),       26,  25,  54,  53,  89,
-     7, AMR_OF(1,p_gain),      35,  49,  81,  34,  33,  82,  80,
-     1, AMR_OF(1,pulses[0]),   78,
-     1, AMR_OF(1,pulses[1]),   79,
-     1, AMR_OF(1,pulses[2]),   64,
-     1, AMR_OF(1,pulses[3]),   65,
-    10, AMR_OF(1,pulses[4]),  103, 102,  98, 111,  96, 105, 119, 185, 199, 188,
-    10, AMR_OF(1,pulses[5]),  100, 101,  99, 110,  97, 107, 118, 198, 197, 187,
-     7, AMR_OF(1,pulses[6]),  109, 108, 104, 106, 189, 184, 186,
-     8, AMR_OF(2,p_lag),       16,  31,  30,  29,  28,  27,  40,  55,
-     7, AMR_OF(2,p_gain),      32,  48,  94,  47,  46,  95,  93,
-     1, AMR_OF(2,pulses[0]),   74,
-     1, AMR_OF(2,pulses[1]),   75,
-     1, AMR_OF(2,pulses[2]),   76,
-     1, AMR_OF(2,pulses[3]),   77,
-    10, AMR_OF(2,pulses[4]),  117, 116, 112, 125, 126, 135, 133, 178, 176, 181,
-    10, AMR_OF(2,pulses[5]),  114, 115, 113, 124, 127, 121, 132, 191, 190, 180,
-     7, AMR_OF(2,pulses[6]),  123, 122, 134, 120, 182, 177, 179,
-     5, AMR_OF(3,p_lag),       24,  39,  52,  51,  88,
-     7, AMR_OF(3,p_gain),      45,  63,  91,  44,  43,  92,  90,
-     1, AMR_OF(3,pulses[0]),   86,
-     1, AMR_OF(3,pulses[1]),   87,
-     1, AMR_OF(3,pulses[2]),   72,
-     1, AMR_OF(3,pulses[3]),   73,
-    10, AMR_OF(3,pulses[4]),  131, 130, 142, 139, 140, 149, 147, 171, 169, 174,
-    10, AMR_OF(3,pulses[5]),  128, 129, 143, 138, 141, 151, 146, 168, 183, 173,
-     7, AMR_OF(3,pulses[6]),  137, 136, 148, 150, 175, 170, 172,
-     0
-};
-
-static const uint8_t order_MODE_12k2[] = {
-     7, AMR_BIT(lsf[0]),        7,   6,   5,   4,   3,   2,   1,
-     8, AMR_BIT(lsf[1]),        0,  15,  14,  13,  12,  11,  10,   9,
-     9, AMR_BIT(lsf[2]),       23,  22,  21,  20,  19,  18,  17,  16,   8,
-     8, AMR_BIT(lsf[3]),       31,  30,  29,  28,  27,  86,  85,  84,
-     6, AMR_BIT(lsf[4]),       83,  82,  81,  80, 127, 126,
-     9, AMR_OF(0,p_lag),       26,  24,  38,  36,  34,  32,  46,  44,  42,
-     4, AMR_OF(0,p_gain),      40,  52,  48,  95,
-     5, AMR_OF(0,fixed_gain),  60,  56,  68,  91, 111,
-     3, AMR_OF(0,pulses[0]),  191, 176, 177,
-     4, AMR_OF(0,pulses[1]),  103, 123, 124, 125,
-     3, AMR_OF(0,pulses[2]),  188, 189, 190,
-     4, AMR_OF(0,pulses[3]),   99, 120, 121, 122,
-     3, AMR_OF(0,pulses[4]),  185, 186, 187,
-     4, AMR_OF(0,pulses[5]),  107, 133, 134, 135,
-     3, AMR_OF(0,pulses[6]),  198, 199, 184,
-     4, AMR_OF(0,pulses[7]),  119, 130, 131, 132,
-     3, AMR_OF(0,pulses[8]),  195, 196, 197,
-     4, AMR_OF(0,pulses[9]),  115, 143, 128, 129,
-     6, AMR_OF(1,p_lag),       64,  78,  76,  74,  72, 245,
-     4, AMR_OF(1,p_gain),      55,  51,  63,  94,
-     5, AMR_OF(1,fixed_gain),  59,  71,  67,  90, 110,
-     3, AMR_OF(1,pulses[0]),  192, 193, 194,
-     4, AMR_OF(1,pulses[1]),  102, 140, 141, 142,
-     3, AMR_OF(1,pulses[2]),  205, 206, 207,
-     4, AMR_OF(1,pulses[3]),   98, 137, 138, 139,
-     3, AMR_OF(1,pulses[4]),  202, 203, 204,
-     4, AMR_OF(1,pulses[5]),  106, 150, 151, 136,
-     3, AMR_OF(1,pulses[6]),  215, 200, 201,
-     4, AMR_OF(1,pulses[7]),  118, 147, 148, 149,
-     3, AMR_OF(1,pulses[8]),  212, 213, 214,
-     4, AMR_OF(1,pulses[9]),  114, 144, 145, 146,
-     9, AMR_OF(2,p_lag),       25,  39,  37,  35,  33,  47,  45,  43,  41,
-     4, AMR_OF(2,p_gain),      54,  50,  62,  93,
-     5, AMR_OF(2,fixed_gain),  58,  70,  66,  89, 109,
-     3, AMR_OF(2,pulses[0]),  209, 210, 211,
-     4, AMR_OF(2,pulses[1]),  101, 157, 158, 159,
-     3, AMR_OF(2,pulses[2]),  222, 223, 208,
-     4, AMR_OF(2,pulses[3]),   97, 154, 155, 156,
-     3, AMR_OF(2,pulses[4]),  219, 220, 221,
-     4, AMR_OF(2,pulses[5]),  105, 167, 152, 153,
-     3, AMR_OF(2,pulses[6]),  216, 217, 218,
-     4, AMR_OF(2,pulses[7]),  117, 164, 165, 166,
-     3, AMR_OF(2,pulses[8]),  229, 230, 231,
-     4, AMR_OF(2,pulses[9]),  113, 161, 162, 163,
-     6, AMR_OF(3,p_lag),       79,  77,  75,  73,  87, 244,
-     4, AMR_OF(3,p_gain),      53,  49,  61,  92,
-     5, AMR_OF(3,fixed_gain),  57,  69,  65,  88, 108,
-     3, AMR_OF(3,pulses[0]),  226, 227, 228,
-     4, AMR_OF(3,pulses[1]),  100, 174, 175, 160,
-     3, AMR_OF(3,pulses[2]),  239, 224, 225,
-     4, AMR_OF(3,pulses[3]),   96, 171, 172, 173,
-     3, AMR_OF(3,pulses[4]),  236, 237, 238,
-     4, AMR_OF(3,pulses[5]),  104, 168, 169, 170,
-     3, AMR_OF(3,pulses[6]),  233, 234, 235,
-     4, AMR_OF(3,pulses[7]),  116, 181, 182, 183,
-     3, AMR_OF(3,pulses[8]),  246, 247, 232,
-     4, AMR_OF(3,pulses[9]),  112, 178, 179, 180,
-     0
-};
-
-/**
- * position of the bitmapping data for each packet type in
- * the AMRNBFrame
- */
-static const uint8_t * const amr_unpacking_bitmaps_per_mode[N_MODES] = {
-    order_MODE_4k75,
-    order_MODE_5k15,
-    order_MODE_5k9,
-    order_MODE_6k7,
-    order_MODE_7k4,
-    order_MODE_7k95,
-    order_MODE_10k2,
-    order_MODE_12k2,
-};
-
-/** number of bytes for each mode */
-static const uint8_t frame_sizes_nb[N_MODES] = {
-    12, 13, 15, 17, 19, 20, 26, 31, 5
-};
-
-/**
- * Base-5 representation for values 0-124
- *
- * This is useful for decoding pulse positions in 10.2 kbit/s frames.
- * Safe values are provided for out of range positions 125-127.
- */
-static const uint8_t base_five_table[128][3] = {
- {0, 0, 0}, {0, 0, 1}, {0, 0, 2}, {0, 0, 3}, {0, 0, 4}, {0, 1, 0}, {0, 1, 1},
- {0, 1, 2}, {0, 1, 3}, {0, 1, 4}, {0, 2, 0}, {0, 2, 1}, {0, 2, 2}, {0, 2, 3},
- {0, 2, 4}, {0, 3, 0}, {0, 3, 1}, {0, 3, 2}, {0, 3, 3}, {0, 3, 4}, {0, 4, 0},
- {0, 4, 1}, {0, 4, 2}, {0, 4, 3}, {0, 4, 4}, {1, 0, 0}, {1, 0, 1}, {1, 0, 2},
- {1, 0, 3}, {1, 0, 4}, {1, 1, 0}, {1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {1, 1, 4},
- {1, 2, 0}, {1, 2, 1}, {1, 2, 2}, {1, 2, 3}, {1, 2, 4}, {1, 3, 0}, {1, 3, 1},
- {1, 3, 2}, {1, 3, 3}, {1, 3, 4}, {1, 4, 0}, {1, 4, 1}, {1, 4, 2}, {1, 4, 3},
- {1, 4, 4}, {2, 0, 0}, {2, 0, 1}, {2, 0, 2}, {2, 0, 3}, {2, 0, 4}, {2, 1, 0},
- {2, 1, 1}, {2, 1, 2}, {2, 1, 3}, {2, 1, 4}, {2, 2, 0}, {2, 2, 1}, {2, 2, 2},
- {2, 2, 3}, {2, 2, 4}, {2, 3, 0}, {2, 3, 1}, {2, 3, 2}, {2, 3, 3}, {2, 3, 4},
- {2, 4, 0}, {2, 4, 1}, {2, 4, 2}, {2, 4, 3}, {2, 4, 4}, {3, 0, 0}, {3, 0, 1},
- {3, 0, 2}, {3, 0, 3}, {3, 0, 4}, {3, 1, 0}, {3, 1, 1}, {3, 1, 2}, {3, 1, 3},
- {3, 1, 4}, {3, 2, 0}, {3, 2, 1}, {3, 2, 2}, {3, 2, 3}, {3, 2, 4}, {3, 3, 0},
- {3, 3, 1}, {3, 3, 2}, {3, 3, 3}, {3, 3, 4}, {3, 4, 0}, {3, 4, 1}, {3, 4, 2},
- {3, 4, 3}, {3, 4, 4}, {4, 0, 0}, {4, 0, 1}, {4, 0, 2}, {4, 0, 3}, {4, 0, 4},
- {4, 1, 0}, {4, 1, 1}, {4, 1, 2}, {4, 1, 3}, {4, 1, 4}, {4, 2, 0}, {4, 2, 1},
- {4, 2, 2}, {4, 2, 3}, {4, 2, 4}, {4, 3, 0}, {4, 3, 1}, {4, 3, 2}, {4, 3, 3},
- {4, 3, 4}, {4, 4, 0}, {4, 4, 1}, {4, 4, 2}, {4, 4, 3}, {4, 4, 4}, {0, 0, 0},
- {0, 0, 0}, {0, 0, 0}
-};
-
-/**
- * Values for the lsp vector from the 4th subframe of the
- * previous subframe values.
- *
- * @note: Taken from Decoder_amr_reset in Q15 using val/1000
- */
-static const int8_t lsp_sub4_init[LP_FILTER_ORDER] = {
-    30, 26, 21, 15, 8, 0, -8, -15, -21, -26
-};
-
-/**
- * Mean lsp values.
- *
- * @note: Taken from Decoder_amr_reset in Q15
- */
-static const int16_t lsp_avg_init[LP_FILTER_ORDER] = {
-    1384, 2077, 3420, 5108, 6742, 8122, 9863, 11092, 12714, 13701
-};
-
-// LSF tables
-
-// These are stored as integers to save space. The values are taken from
-// q_plsf_3.tab and q_plsf_5.tab in 3GPP TS 26.090.
-
-static const int16_t lsf_3_3_MODE_5k15[128][4] = {
-{  419,  163,  -30, -262}, { -455, -789,-1430, -721}, { 1006,  664,  269,   25},
-{  619,  260,  183,   96}, { -968,-1358, -388,  135}, { -693,  835,  456,  154},
-{ 1105,  703,  569,  363}, { 1625, 1326,  985,  748}, { -220,  219,   76, -208},
-{-1455,-1662,   49,  149}, { -964, -172, -752, -336}, {  625,  209, -250,  -66},
-{-1017, -838,   -2,  317}, {-2168,-1485, -138,  123}, {-1876,-2099, -521,   85},
-{ -967, -366, -695, -881}, { -921,-1011, -763, -949}, { -124, -256, -352, -660},
-{  178,  463,  354,  304}, {-1744, -591, -282,   79}, {-2249,  175,  867,  499},
-{ -138, -180, -181,  -21}, {-2291,-1241, -460, -520}, { -771,  451,  -10, -308},
-{  271,  -65,    4,  214}, { -279, -435,  -43, -348}, { -670,   35,  -65, -211},
-{  806,  535,   85,  297}, {   57,  239,  722,  493}, {  225,  661,  840,  547},
-{ -540, -376,   14,  349}, {  469,  721,  331,  162}, { -544, -752,  -62,  -10},
-{  398,  -88,  724,  701}, {  -19, -533,  -94,  601}, {  136,  -71, -681, -747},
-{ -166, -344,  261,  -50}, {  161,  -52,  485,  337}, {-1675,   50,  190,  -93},
-{-2282, -231, -194,  -82}, {  -95, -595, -154,  128}, {  894,  501,  588,  457},
-{ -345,  206,  122,  110}, { -631, -227, -569,    3}, {  408,  239,  397,  226},
-{ -197,   -2,  128,  491}, { 1281,  904,  292,  215}, {  538,  306,  259,  509},
-{ -677,-1047,   13,  321}, { -679, -588, -358, -212}, { -558,  243,  646,  479},
-{  486,  342,  634,  532}, {  107,  802,  331,  136}, { -112, -398,-1031, -286},
-{ -326, -705,  288,  272}, { 1299, 1144, 1178,  860}, { -423,  121, -385, -148},
-{ -295, -302, -834, -819}, {   16,  -24, -201, -476}, {  555,   91, -245,  294},
-{  -38, -379, -962,-1221}, {-1191,-1518, -273, -395}, { -390,-1013, -645,  573},
-{-1843,-1030,  505,  468}, {  744,  947,  609,  493}, { -689,-1172, -628, -135},
-{-1026,  195,  411,  196}, { 1582, 1147,  575,  337}, {-1239, -777, -648, -142},
-{  595,  825,  967,  735}, {-1206, -970,  -81, -342}, { -745,   13,  -72,  375},
-{  454,   19, 1407,  921}, {-1647, -172,  861,  562}, {  928, 1537, 1063,  740},
-{-2472, -952,  264,   82}, { -502, -965,-1334,  123}, {  867, 1236,  534,  171},
-{-2320, -460,  780,  363}, {-1190, -617,  252,  -61}, { -174,   34, 1011,  788},
-{-2333,  247,  423,  153}, {  -16, -355,  262,  449}, {-1576,-1073, -544, -371},
-{ -615, -305, 1051,  805}, {  687,  528,    6, -182}, {  935,  875, 1002,  809},
-{  199,  257,  126,   76}, { -584,-1138,  599,  556}, {-1105,-1391,-1591, -519},
-{ -977,-1325,  108,  347}, { -722, -975,  365,  101}, { -145,  681,  249, -153},
-{    0, -334, -570,  159}, {  412,  285, -336, -617}, { -953, -966,  887,  689},
-{-1251,   84, -185, -398}, { -592,  433, 1044,  653}, {   85,  329,  -40,  361},
-{ -433, -705,  466,  574}, { -154,  654,  592,  290}, { -167,   72,  349,  175},
-{  674,  297,  977,  720}, { 1235, 1204,  757,  488}, { -400, -269,  538,  372},
-{-1350,-1387,-1194,  -91}, { 1262,  876,  775,  700}, { -599,  -38, -430, -722},
-{ 1976, 1630,  991,  608}, {  111,  276, -226,  -96}, { -947, -388,  -11,   -7},
-{ -303, -531, -839,  338}, { 1734, 1710, 1405, 1013}, { -516, -855, -645,  210},
-{ -688, -416,  513,  230}, { -822, -637,-1146, -320}, { -952, -658, -694,  183},
-{ -114, -623,  818,  674}, { -191, -204,  731,  635}, {   51, 1221,  883,  576},
-{ -954, -431,  826,  598}, { -342, -755, -900, -407}, {-1126, -354, -206, -512},
-{ -547, -810, -357, -620}, {   66,  515,  -73, -410}, { -872, -945,-1444,-1227},
-{  191,  -17, -544, -231}, {-1540, -544, -901, -886}
-};
-
-static const int16_t lsf_3_1_MODE_7k95[512][3] = {
-{ -890,-1550,-2541}, { -819, -970,  175}, { -826,-1234, -762},
-{ -599,  -22,  634}, { -811, -987, -902}, { -323,  203,   26},
-{ -383, -235, -781}, { -399, 1262,  906}, { -932,-1399,-1380},
-{ -624,   93,   87}, { -414, -539, -691}, {   37,  633,  510},
-{ -387, -476,-1330}, {  399,   66,  263}, { -407,  -49, -335},
-{ -417, 1041, 1865}, { -779,-1089,-1440}, { -746, -858,  832},
-{ -581, -759, -371}, { -673, -506, 2088}, { -560, -634,-1179},
-{  271,  241,   14}, { -438, -244, -397}, {  463, 1202, 1047},
-{ -606, -797,-1438}, {  -51, -323,  481}, { -224, -584, -527},
-{  494,  881,  682}, { -433, -306,-1002}, {  554,  659,  222},
-{  171, -160, -353}, {  681, 1798, 1565}, { -852,-1181,-1695},
-{ -336, -666,  114}, { -581, -756, -744}, { -195,  375,  497},
-{ -465, -804,-1098}, {  154,  282, -131}, {  -50, -191, -719},
-{  323,  732, 1542}, { -722, -819,-1404}, {  105, -250,  185},
-{ -178, -502, -742}, {  321,  510, 1111}, { -323, -567, -966},
-{  127,  484,  338}, { -160,   52, -338}, {  732, 1367, 1554},
-{ -626, -802,-1696}, { -286, -586,  676}, { -695, -343, -370},
-{ -490,  295, 1893}, { -630, -574,-1014}, {  -80,  645,  -69},
-{   -6, -318, -364}, {  782, 1450, 1038}, { -313, -733,-1395},
-{  120,   60,  477}, { -264, -585, -123}, {  711, 1245,  633},
-{  -91, -355,-1016}, {  771,  758,  261}, {  253,   81, -474},
-{  930, 2215, 1720}, { -808,-1099,-1925}, { -560, -782,  169},
-{ -804,-1074, -188}, { -626,  -55, 1405}, { -694, -716,-1194},
-{ -660,  354,  329}, { -514,  -55, -543}, {  366, 1033, 1182},
-{ -658, -959,-1357}, {  -55, -184,   93}, { -605, -286, -662},
-{  404,  449,  827}, { -286, -350,-1263}, {  628,  306,  227},
-{  -16,  147, -623}, {  186,  923, 2146}, { -674, -890,-1606},
-{ -443, -228,  339}, { -369, -790, -409}, {  231,   86, 1469},
-{ -448, -581,-1061}, {  594,  450, -177}, { -124, -170, -447},
-{  671, 1159, 1404}, { -476, -667,-1511}, {  -77, -138,  716},
-{ -177, -372, -381}, {  451,  934,  915}, { -250, -432, -822},
-{  272,  828,  446}, {   26,   19,  -31}, {  698, 1692, 2168},
-{ -646, -977,-1924}, { -179, -473,  268}, { -379, -745, -691},
-{   11,  127, 1033}, { -488, -917, -825}, {   61,  323,  135},
-{  147, -145, -686}, {  685,  786, 1682}, { -506, -848,-1297},
-{   35,   90,  222}, {  -23, -346, -670}, {  455,  591, 1287},
-{ -203, -593,-1086}, {  652,  352,  437}, {   39,   63, -457},
-{  841, 1265, 2105}, { -520, -882,-1584}, { -328, -711, 1421},
-{ -596, -342,  -70}, {  209,  173, 1928}, { -423, -598, -921},
-{  421,  605,  -38}, {   -2, -245, -127}, {  896, 1969, 1135},
-{ -379, -518,-1579}, {  173,  118,  753}, {  -55, -381,  -52},
-{  985, 1021,  753}, {   -2, -291, -891}, {  753,  992,  423},
-{  264,  131, -196}, {  895, 2274, 2543}, { -635,-1088,-2499},
-{ -529, -982,  526}, { -764, -830, -548}, { -436,  316,  599},
-{ -675, -940, -746}, {  -57,  236,  -11}, { -201,  -81, -798},
-{   16,  845, 1558}, { -737, -985,-1212}, { -468,   17,  290},
-{ -279, -584, -700}, {  183,  822,  705}, { -265, -492,-1187},
-{  421,  152,  468}, { -390,  166, -268}, {   39, 1550, 1868},
-{ -635, -966,-1571}, { -453, -492,  910}, { -284,-1027,  -75},
-{ -181, -133, 1852}, { -445, -624,-1174}, {  420,  367,  -49},
-{ -389, -212, -169}, {  707, 1073, 1208}, { -539, -710,-1449},
-{   83, -163,  484}, { -236, -543, -355}, {  338, 1175,  814},
-{ -246, -309, -958}, {  606,  760,   60}, {  166,   -8, -163},
-{ -306, 1849, 2563}, { -747,-1025,-1783}, { -419, -446,  209},
-{ -718, -566, -534}, { -506,  693,  857}, { -463, -697,-1082},
-{  325,  431, -206}, {  -15,   -8, -763}, {  545,  919, 1518},
-{ -611, -783,-1313}, {  256,  -55,  208}, { -165, -348, -662},
-{  321,  680,  930}, { -326, -429, -951}, {  484,  446,  570},
-{ -197,   72,  -73}, {  909, 1455, 1741}, { -563, -737,-1974},
-{ -124, -416,  718}, { -478, -404, -314}, {  -16,  446, 1636},
-{ -551, -537, -750}, {  -58,  638,  214}, {   55, -185, -271},
-{ 1148, 1301, 1212}, { -483, -671,-1264}, {  117,  285,  543},
-{ -204, -391, -111}, {  513, 1538,  854}, { -114, -190, -978},
-{  877,  595,  464}, {  260,  260, -311}, {  748, 2283, 2216},
-{ -517, -945,-2171}, { -326, -708,  378}, { -812, -691, -232},
-{ -560,  687, 1409}, { -732, -690, -836}, { -359,  645,  386},
-{ -265,   62, -678}, {  145, 1644, 1208}, { -555, -988,-1233},
-{  -78,   14,  114}, { -327, -358, -489}, {  392,  677,  697},
-{ -201, -236,-1140}, {  693,  449,  178}, { -243,  256, -433},
-{  611, 1385, 2456}, { -612, -901,-1464}, { -307,  -17,  499},
-{ -315, -667, -254}, {  256,  428, 1463}, { -486, -422,-1056},
-{  655,  370,   18}, { -102, -185, -276}, {  755, 1578, 1335},
-{ -488, -603,-1418}, {  182,  -93,  870}, {  -73, -458, -348},
-{  835,  862,  957}, { -282, -333, -746}, {  547,  839,  428},
-{  273,  -89,   13}, {  940, 1708, 2576}, { -418,-1084,-1758},
-{  -44, -358,  259}, { -497, -643, -560}, {   99,  557,  961},
-{ -421, -766, -917}, {  295,  326,  184}, {  175,   15, -626},
-{  532,  878, 1981}, { -443, -768,-1275}, {  221,  156,  268},
-{   39, -363, -505}, {  695,  772, 1140}, { -162, -459, -912},
-{  709,  444,  658}, {   25,  303, -312}, { 1268, 1410, 1715},
-{ -297, -766,-1836}, { -263, -108, 1070}, { -406,  -13, -129},
-{   57,  438, 2734}, { -374, -487, -835}, {  304,  696,  164},
-{  104, -235,    5}, { 1611, 1900, 1399}, { -229, -582,-1325},
-{  405,  192,  817}, {  -87, -438,  111}, { 1028, 1199,  993},
-{   68, -175, -934}, { 1033, 1117,  451}, {  478,  200, -248},
-{ 2127, 2696, 2042}, { -835,-1323,-2131}, { -799, -692,  466},
-{ -812,-1032, -469}, { -622,  288,  920}, { -701, -841,-1070},
-{ -411,  512,    8}, { -390,  -91, -744}, {  -30, 1043, 1161},
-{ -822,-1148,-1156}, { -294,  -46,  110}, { -411, -374, -678},
-{  214,  531,  668}, { -406, -420,-1194}, {  487,  232,  303},
-{ -318,   91, -472}, {  123, 1232, 2445}, { -722, -952,-1495},
-{ -738, -675, 1332}, { -543, -606, -211}, {  -95,  -98, 1508},
-{ -549, -514,-1193}, {  473,  211,   73}, { -288, -112, -389},
-{  537, 1332, 1258}, { -567, -755,-1545}, {   71, -283,  632},
-{ -170, -481, -493}, {  681, 1002,  817}, { -356, -331, -877},
-{  419,  706,  346}, {  241,  -34, -326}, {  377, 1950, 1883},
-{ -727,-1075,-1625}, { -233, -543,  116}, { -524, -806, -585},
-{  -73,  478,  729}, { -288, -925,-1143}, {  173,  447,  -52},
-{   68, -229, -606}, {  449,  529, 1797}, { -591, -875,-1363},
-{  183, -144,  324}, { -103, -452, -666}, {  623,  488, 1176},
-{ -238, -511,-1004}, {  326,  552,  458}, {  136,  108, -319},
-{  626, 1343, 1883}, { -490, -646,-1730}, { -186, -449,  984},
-{ -738,  -76, -170}, { -550,  755, 2560}, { -496, -510, -947},
-{  210,  694,  -52}, {   84, -322, -199}, { 1090, 1625, 1224},
-{ -376, -603,-1396}, {  343,   74,  632}, { -175, -502,  -32},
-{  972, 1332,  734}, {   52, -295,-1113}, { 1065,  918,  160},
-{  393,  107, -397}, { 1214, 2649, 1741}, { -632,-1201,-1891},
-{ -719, -277,  353}, { -651, -880, -122}, { -211,  209, 1338},
-{ -562, -714,-1059}, { -208,  388,  159}, { -320,  -61, -551},
-{  293, 1092, 1443}, { -648, -865,-1253}, {  -49, -143,  305},
-{ -401, -227, -585}, {  561,  532,  927}, { -117, -443,-1188},
-{  507,  436,  292}, {  -79,  233, -458}, {  671, 1025, 2396},
-{ -633, -842,-1525}, { -308, -286,  640}, { -373, -621, -407},
-{  418,  253, 1305}, { -315, -581,-1137}, {  572,  685, -281},
-{   61,  -68, -371}, {  991, 1101, 1498}, { -493, -683,-1362},
-{  -47,  164,  704}, { -256, -314, -268}, {  631,  949, 1052},
-{ -118, -348, -833}, {   68, 1180,  568}, {  152,  117,   34},
-{ 1113, 1902, 2239}, { -601, -959,-1706}, { -143, -489,  480},
-{ -332, -655, -574}, {   54,  353, 1192}, { -462, -652, -796},
-{  150,  549,  112}, {  195, -111, -515}, {  679, 1108, 1647},
-{ -558, -749,-1217}, {   -9,  272,  341}, {  -53, -265, -535},
-{  489,  843, 1298}, { -120, -482,-1032}, {  632,  543,  408},
-{  179,  306, -526}, { 1124, 1464, 2244}, { -417, -786,-1562},
-{ -224, -384, 1364}, { -377, -459,  -25}, {  385,  489, 2174},
-{ -332, -651, -829}, {  544,  553,   61}, {   22, -113,  -89},
-{ 1128, 1725, 1524}, { -216, -373,-1653}, {  161,  316,  908},
-{ -165, -222,  -67}, { 1362, 1175,  789}, {   73, -252, -767},
-{  738,  932,  616}, {  362,  246, -126}, {  787, 2654, 3027},
-{ -691,-1106,-2190}, { -565, -588,  524}, { -590, -979, -490},
-{ -263,  397,  982}, { -577, -837, -945}, {  -22,  435,  -49},
-{ -190, -118, -629}, {  -88, 1240, 1513}, { -636,-1051,-1019},
-{ -291,  189,  259}, { -257, -470, -629}, {  145,  945,  894},
-{ -326, -364,-1094}, {  543,  260,  630}, { -202,  189, -209},
-{  357, 1379, 2091}, { -569,-1075,-1449}, { -714, -239,  919},
-{ -420, -705,  -84}, { -109, -114, 2407}, { -413, -529,-1177},
-{  482,  368,  131}, { -186,  -72, -131}, {  861, 1255, 1220},
-{ -611, -658,-1341}, {  227, -121,  631}, { -176, -489, -218},
-{  745, 1175,  957}, { -321, -148, -936}, {  671,  966,  216},
-{  340,   -3, -143}, {  469, 1848, 2437}, { -729, -961,-1683},
-{ -213, -254,  321}, { -511, -438, -521}, { -126,  725,  903},
-{ -340, -685,-1032}, {  316,  480,   20}, {   23,  -89, -551},
-{  353, 1051, 1789}, { -544, -757,-1364}, {  298,  -25,  436},
-{ -100, -392, -519}, {  467,  754, 1078}, { -210, -398,-1078},
-{  620,  658,  630}, {   33,  147, -178}, {  921, 1687, 1921},
-{ -325, -528,-1978}, {    2, -285,  910}, { -371, -490, -230},
-{    0,  597, 2010}, { -496, -395, -834}, {   37,  945,  245},
-{  181, -160, -144}, { 1481, 1373, 1357}, { -355, -601,-1270},
-{  298,  322,  672}, { -193, -336,   77}, { 1089, 1533,  922},
-{  177,  -39,-1125}, {  996,  781,  536}, {  456,  366, -432},
-{ 1415, 2440, 2279}, { -466, -758,-2325}, { -303, -509,  387},
-{ -727, -557,   66}, { -145,  643, 1248}, { -544, -676, -916},
-{ -225,  862,  588}, { -152,   40, -533}, {  423, 1423, 1558},
-{ -572, -843,-1145}, { -128,   85,  461}, { -238, -257, -584},
-{  605,  748,  861}, {   24, -202,-1409}, {  797,  487,  303},
-{ -181,  364, -182}, {  616, 1378, 2942}, { -494, -852,-1441},
-{ -292,   61,  812}, {  -84, -723, -182}, {  555,  532, 1506},
-{ -365, -493,-1057}, {  822,  588,   11}, {  -14,  -18, -230},
-{ 1001, 1401, 1451}, { -474, -569,-1292}, {  302,   62, 1062},
-{  -70, -376, -222}, {  982,  974, 1149}, { -196, -234, -795},
-{  479, 1098,  499}, {  362,   58,   70}, { 1147, 2069, 2857},
-{ -487, -878,-1824}, {   73, -288,  348}, { -358, -500, -508},
-{  199,  721, 1242}, {  -78, -697, -795}, {  361,  536,  196},
-{  374,  110, -735}, {  847, 1051, 1896}, { -366, -713,-1182},
-{  315,  320,  429}, {   72, -215, -450}, {  759,  886, 1363},
-{  -30, -428, -834}, {  861,  627,  796}, {  118,  468, -279},
-{ 1355, 1883, 1893}, { -188, -642,-1612}, {   63, -175, 1198},
-{ -418, -211,   51}, {  414,  587, 2601}, { -234, -557, -858},
-{  424,  889,  222}, {  136, -101,   83}, { 1413, 2278, 1383},
-{  -84, -445,-1389}, {  414,  313, 1045}, {   29, -343,   65},
-{ 1552, 1647,  980}, {  183,  -91, -829}, { 1273, 1413,  360},
-{  553,  272, -107}, { 1587, 3149, 2603}
-};
-
-static const int16_t lsf_3_1[256][3] = {
-{    6,   82, -131}, {  154,  -56, -735}, {  183,  -65, -265},
-{    9, -210, -361}, {  113,  718, 1817}, { 1010, 1214, 1573},
-{  857, 1333, 2276}, {  827, 1568, 1933}, {  717, 1989, 2206},
-{  838, 1172, 1823}, {  721, 1000, 2154}, {  286,  476, 1509},
-{ -247, -531,  230}, {  147,  -82,  569}, {   26, -177, -944},
-{  -27, -273,  692}, { -164, -264, -183}, {  224,  790, 1039},
-{  899,  946,  601}, {  485,  771, 1150}, {  524,  677,  903},
-{ -140,  375,  778}, {  410,  676,  429}, {  301,  530, 1009},
-{  719,  646,   38}, {  226,  367,   40}, {  145,  -45, -505},
-{  290,  121, -121}, {  302,  127,  166}, { -124, -383, -956},
-{ -358, -455, -977}, {  715,  878,  894}, {  978,  923,  211},
-{  477,  272,   64}, {  188,  -78,   17}, { -143,  -65,   38},
-{  643,  586,  621}, { -134, -426, -651}, {  347,  545, 2820},
-{ 1188, 2726, 2442}, {  142,  -80, 1735}, {  283,  130,  461},
-{ -262, -399,-1145}, { -411,  155,  430}, {  329,  375,  779},
-{   53, -226, -139}, { -129, -236, 1682}, {  285,  744, 1327},
-{  738,  697, 1664}, {  312,  409,  266}, {  325,  720,  135},
-{    1,  221,  453}, {    8,  203,  145}, {  299,  640,  760},
-{   29,  468,  638}, {  103,  429,  379}, {  420,  954,  932},
-{ 1326, 1210, 1258}, {  704, 1012, 1152}, { -166, -444, -266},
-{ -316, -130, -376}, {  191, 1151, 1904}, { -240, -543,-1260},
-{ -112,  268, 1207}, {   70, 1062, 1583}, {  278, 1360, 1574},
-{ -258, -272, -768}, {   19,  563, 2240}, {   -3, -265,  135},
-{ -295, -591, -388}, {  140,  354, -206}, { -260, -504, -795},
-{ -433, -718,-1319}, {  109,  331,  962}, { -429,  -87,  652},
-{ -296,  426, 1019}, { -239,  775,  851}, {  489, 1334, 1073},
-{ -334, -332,   25}, {  543, 1206, 1807}, {  326,   61,  727},
-{  578,  849, 1405}, { -208, -277,  329}, { -152,   64,  669},
-{ -434, -678, -727}, { -454,  -71,  251}, {  605,  480,  254},
-{ -482,   11,  996}, { -289,  395,  486}, {  722, 1049, 1440},
-{  -30, -316, -786}, { -106, -115, -619}, {  861, 1474, 1412},
-{ 1055, 1366, 1184}, {  812, 1237,  925}, {   42, -251, -576},
-{  342,  141, -454}, { -168,  -80, 1359}, { -342, -656,-1763},
-{  100,  821,  725}, {  990,  747,  800}, {  332,  440,  568},
-{  663,  379,  852}, {  112,  165, -369}, {  597,  910,  282},
-{   -8,  834, 1281}, { -352,  572,  695}, {  462, 2246, 1806},
-{  345,  190, 1374}, {  416,  915, 2166}, {  168,  -82,  280},
-{ -516, -446,  840}, {   47,  533,   44}, { -362, -711,-1143},
-{   22,  193, 1472}, {  -85,  233, 1813}, {  -62,  579, 1504},
-{  550,  944, 1749}, {  723,  650, 1148}, {  972,  884, 1395},
-{ -425,  643,    0}, { 1000,  952, 1098}, {  249, 1446,  672},
-{ -334,  -87, 2172}, { -554, 1882, 2672}, {  140, 1826, 1853},
-{  920, 1749, 2590}, { 1076, 1933, 2038}, { -137, -443,-1555},
-{ 1269, 1174,  468}, { -493, -122, 1521}, { -451, 1033, 1214},
-{  482, 1695, 1118}, {  815,  649,  384}, { -446, -692,  107},
-{ -319, -605, -118}, { -207, -505,  525}, { -468,  -12, 2736},
-{   75, 1934, 1305}, {  880, 2358, 2267}, { 1285, 1575, 2004},
-{  -48, -304,-1186}, { -435, -461, -251}, { -366, -404, -547},
-{ -289, -605, -597}, { -538, -810, -165}, { -120,    3,  356},
-{  639, 1241, 1502}, {   96,  177,  750}, { -435, -585,-1174},
-{ -356,  109,  -79}, { -485,  288, 2005}, {    9, 1116,  731},
-{  880, 2134,  946}, { -265, 1585, 1065}, { 1157, 1210,  843},
-{ -498, -668,  431}, {  374,  321, -229}, { 1440, 2101, 1381},
-{  449,  461, 1155}, { -105,   39, -384}, { -263,  367,  182},
-{ -371, -660,  773}, { -188, 1151,  971}, { 1333, 1632, 1435},
-{  774, 1267, 1221}, { -482, -832,-1489}, { -237, -210,  860},
-{  890, 1615, 1064}, {  472, 1062, 1192}, {  185, 1077,  989},
-{ -568, -992,-1704}, { -449, -902,-2043}, { -142, -377, -458},
-{ -210, -554,-1029}, {  -11, 1133, 2265}, { -329, -675, -893},
-{ -250,  657, 1187}, {  519, 1510, 1779}, {  520,  539, 1403},
-{  527, 1421, 1302}, { -563, -871,-1248}, { -147, -463,  879},
-{  -76, 2334, 2840}, {  563, 2573, 2385}, {  632, 1926, 2920},
-{  719, 2023, 1840}, { -545, -723, 1108}, {  129, -125,  884},
-{ 1417, 1632,  925}, {  -94, 1566, 1751}, { -341, 1533, 1551},
-{  591,  395, -274}, {  -76,  981, 2831}, {  153, 2985, 1844},
-{ 1032, 2565, 2749}, { 1508, 2832, 1879}, {  791, 1199,  538},
-{ -190, -453, 1489}, { -278, -548, 1158}, { -245, 1941, 2044},
-{ 1024, 1560, 1650}, {  512,  253,  466}, {  -62, -323, 1151},
-{ -473, -376,  507}, { -433, 1380, 2162}, {  899, 1943, 1445},
-{  134,  704,  440}, {  460,  525,  -28}, { -450,  279, 1338},
-{    0,  971,  252}, { -445, -627, -991}, { -348, -602,-1424},
-{  398,  712, 1656}, { -107,  314, -178}, {   93, 2226, 2238},
-{  518,  849,  656}, { -462, -711, -447}, {  174,  -34, 1191},
-{ -119,   42, 1005}, { -372,  274,  758}, { 1036, 2352, 1838},
-{  675, 1724, 1498}, {  430, 1286, 2133}, { -129, -439,    0},
-{ -373,  800, 2144}, {    6, 1587, 2478}, {  478,  596, 2128},
-{ -428, -736, 1505}, {  385,  178,  980}, {  139,  449, 1225},
-{ -526, -842, -982}, {  145, 1554, 1242}, {  623, 1448,  656},
-{  349, 1016, 1482}, {   31, -280,  415}, { -316,  724, 1641},
-{  360, 1058,  556}, { -436, -358, 1201}, { -355, 1123, 1939},
-{  401, 1584, 2248}, { -527,-1012,  355}, {  233,  238, 2233},
-{ -550, -897, -639}, { -365, -501, 1957}, {  389, 1860, 1621},
-{  162, 1132, 1264}, { -237, 1174, 1390}, { -640, -411,  116},
-{ -228, 1694, 2298}, { 1639, 2186, 2267}, {  562, 1273, 2658},
-{  323,  338, 1774}, {  578, 1107,  852}, {   22,  594,  934},
-{ -143,  718,  446}
-};
-
-
-static const int16_t lsf_3_2[512][3] = {
-{   50,   71,   -9}, { -338, -698,-1407}, {  102, -138, -820},
-{ -310, -469,-1147}, {  414,   67, -267}, { 1060,  814, 1441},
-{ 1548, 1360, 1272}, { 1754, 1895, 1661}, { 2019, 2133, 1820},
-{ 1808, 2318, 1845}, {  644,  -93,  454}, {  858,  329, -136},
-{  489, -258, -128}, { -198, -745,  -41}, {  -52, -265, -985},
-{  346,  137,  479}, {-1741, -748, -684}, {-1163,-1725, -367},
-{ -895,-1145, -784}, { -488, -946, -968}, {  -85, -390, -725},
-{  215, -340, -171}, { 1020,  916, 1969}, {  564,  179,  746},
-{  662,  977, 1734}, {  887,  622,  914}, {  939,  856, 1165},
-{  309,  688,  803}, {  917,  161,  570}, {  118,  -20, -283},
-{ -816,  -42,  204}, {-1228, -325, -462}, { -963, -202, -143},
-{ -988, -484, -361}, { -702, -978, -477}, { -302, -790,-1188},
-{ -100, -786,-1088}, {-1054, -947,-1684}, { -202, -843, -782},
-{-1039,-1378, -901}, { -624, -110,  -85}, {  356,  213,  -10},
-{ -493,  364,  774}, {  425,  822,  479}, {  -83,  557,  520},
-{ -992,-1560, -572}, { -603, -741,  -26}, { -502, -638, -903},
-{  209,  306,  147}, { -316, -593, -596}, {  -85, -211, -225},
-{ -918, -529,  117}, {  233, -439, -738}, { 1101,  751,  633},
-{ 1457, 1716, 1511}, { 1765, 1457,  910}, { 1122, 1156,  849},
-{ 1354,  868,  470}, { -871,-1150,-1796}, { -871, -861, -992},
-{ -118,  155,  212}, {-1051, -849, -606}, {-1117,-1849,-2750},
-{-1019,-1427,-1869}, {  370, -184, -414}, {  959,  493,  104},
-{  958, 1039,  543}, {  154,  653,  201}, { 1249,  507,  150},
-{  663,  503,  230}, {  623,  777,  675}, {  659,   88, -110},
-{  843,  244,  224}, {  382,  541,  302}, {  724,  433,  666},
-{ 1166,  734,  341}, { -138,   20, -397}, {-1183, -424,  -46},
-{ -321, -352, -124}, { 1333, 1021, 1080}, {  262,  366,  723},
-{  922,  283, -551}, {   31, -636, -611}, { -689, -697, -415},
-{ -952, -779, -201}, {-1329, -598, -359}, { -953,-1285,  166},
-{  493,  305,  221}, {  846,  703,  610}, {  840,  936,  774},
-{ -723,-1324,-1261}, { -357,-1025,-1388}, {-1096,-1376, -365},
-{-1416,-1881, -608}, {-1798,-1727, -674}, { -545,-1173, -703},
-{  678,  786,  148}, { -123,  696, 1288}, {  644,  350,  -10},
-{  414,  614,   15}, {  137,  344, -211}, { -814,-1512, -819},
-{ -391, -930, -588}, {   47, -591, -898}, { -909,-1097, -163},
-{-1272,-1167, -157}, {-1464,-1525, -389}, {-1274,-1188, -624},
-{  671,  213,  454}, {  124, -274, -525}, { -729, -496, -152},
-{-1344,  122,  135}, {-2905, -589, -394}, {-1728,  441,  -50},
-{ 1476,  904,  787}, {  316,  236, -440}, { -347,  217,  413},
-{ -911, -917,  121}, { -455, -932,  202}, {  -92, -465, -375},
-{  488,  390,  474}, {  876,  729,  316}, {-1815,-1312, -669},
-{   87,  962,  432}, {  563, -249,-1058}, {  250,  285, 1105},
-{ 1141,  427,  696}, {-1038,-1664,-1582}, { -948,  346,  160},
-{ -309, -272, -858}, {  670,  624, 1250}, { -944, -408, -666},
-{ -606, -320, -384}, { -492,  230,   65}, {  334,  -50,  -16},
-{  -16, -690,-1397}, { 1791, 1716, 1399}, { 2478, 2063, 1404},
-{ 1245, 1471, 1426}, { -382,-1037,   -2}, {  173, -398, 1145},
-{ 1491, 2024, 1801}, {  772, 1274, 1506}, { 1429, 1735, 2001},
-{ 1079, 1218, 1273}, {-1154,-1851,-1329}, { -808,-1133,-1096},
-{ -451,-1033,-1722}, {   65,  578,  -84}, {-1476,-2434,-1778},
-{ -765,-1366, -494}, { -218, -594, -931}, {  337, -236,  562},
-{ 2357, 2662, 1938}, { 1489, 1276,  874}, {  189,  358,  374},
-{-1519,-2281,-2346}, { -967,-1271,-2095}, { -628,-1188,-1542},
-{ 1661, 1043,  546}, {  565, 1061,  732}, {  -64, -836, -434},
-{ -436,  -96,  203}, { 1078, 1216, 1636}, {  907, 1534,  986},
-{  326,  965,  845}, {  142,  -84,  197}, {  470, 2379, 1570},
-{ 1133,  470, 1214}, {  395, 1376, 1200}, { 1125, 1042,  348},
-{ -543,-1234, -376}, { -215, -181,  481}, {-1947,-1621, -210},
-{ -750,-1185,  390}, {   29, -399,   27}, {  820, 1236,  755},
-{  695,  979,  409}, { -174, 1197, 1035}, {  912, 1356, 1846},
-{ -992,-1437,  484}, {-1485,-1700,  208}, { -412, 1204, 1432},
-{ -271,  896, 1144}, { -416, 1777, 1434}, {-1696,-2644, -204},
-{-1789,-1551, 1033}, {-1656,-1559, 1303}, {-1253,-1589, 1081},
-{ -669,-1095,  -66}, { -682,  320, -345}, {  659,  305, 1069},
-{-1292, -804,  -19}, {-1635,-1291,   29}, {-1683, -497,   71},
-{ -287,   -7, -100}, { -494, -962, -237}, {  852, 1881, 1740},
-{-1217,-1387,  227}, { -660,  302,  373}, {   96, 1087, 1257},
-{-1074,-1669,  160}, {  485, 2076, 1798}, { -934, -220,  552},
-{ -596, -612,  237}, {  336, 1720,  879}, {  643,  629,  434},
-{ 1267,  522, 1633}, {   15,  244, -441}, { 1475,  717,  184},
-{ 1819, 1590, 1709}, {  988,  261,  937}, { 2093, 2345, 1520},
-{ 2139, 1858, 1606}, { -577, -579,-1203}, { -956,  135, -488},
-{ -464,   51, -338}, { -629, -348, -723}, { 1146, 2073, 1442},
-{ 2192, 1466,  911}, {-1444,-1572,-2278}, { 1400,  710, 1297},
-{ 1335,  633,  928}, { 1434, 2194, 2594}, { 2422, 2204, 1881},
-{  982, 2242, 1854}, {  380,  792, 1145}, {  -63, -539,  414},
-{ -252, -964, -314}, {-1261, -683, -780}, { -831, -526,-1005},
-{-1666,-1135, -424}, {-1611, -452, -299}, { 1268, 1048,  642},
-{ 1147,  853,  856}, { -675, -336,  139}, { 2268, 1343, 1418},
-{   29,  768,  797}, {-1224,  423,  564}, {-1318,-1082,  245},
-{-1302, -812,  573}, {-1298,-1617,  646}, { -968,  834,  723},
-{  993, 1652, 2027}, { -191, -817,  432}, {  662,   60,  198},
-{  626,  997, 1330}, { 1648, 1963, 1289}, {-1597,  -93,  -45},
-{-1088,   37,  -84}, { 1653, 2607, 2337}, { 1065, 2040, 2377},
-{ 1139, 2326, 2118}, {  859,  357, 1510}, {  664, 1227, 1099},
-{  479, 1360,  912}, { 1897, 1754, 2019}, { 1168, 1909, 1784},
-{  399,   34,  256}, { -593, -304,-1053}, {  547, 1694, 1407},
-{  647,  -99, -341}, { 1492, 1647, 1190}, {   38, -644, -212},
-{  395,  846,  222}, { -704, -765, -716}, { -724,-1964,-2804},
-{ -150,  291,  -82}, { 1233, 1459, 1007}, { -140, -155,  153},
-{  439,  297, 1568}, {-1529, -410, -636}, { 1536,  455, -237},
-{-1328, -139, -260}, {  531,  554,  868}, {  269, 1264,  606},
-{ -233,  883,  463}, {  742,  600, -120}, {  -73,  421,  212},
-{ -439,  -58,  804}, {-1286,-1241,  728}, {  294, -490,   50},
-{ -591, -905,-1254}, {   42, -687,  147}, {  -25,  273,  596},
-{ -311, 1213,  601}, { -754,  849,  584}, {  429,  607,  587},
-{ -602, -166,  461}, { -796, -823,  777}, { 1380,  910, 1755},
-{  119, 1417,  972}, { -219, -880,-1596}, {-1049,-1010,  438},
-{ -713,-1379,   78}, {    0, -447,-1179}, {-1136,-1319,-1573},
-{ 2248, 1767, 1309}, {  946, 1583, 1432}, { 1150,  482,  436},
-{ -469,-1108,  618}, { -447, -966, 1088}, {-1252,-1515, -114},
-{-1104,-2008, -579}, {  210,  613,  497}, {-1975,-1437,  642},
-{-1269, -856, 1011}, {-1646,-1185, 1063}, {-1555, -672, 1204},
-{-1692,-1114,  623}, { -979,-1326,-1277}, {  539, -147,  894},
-{-1354, -897, -434}, {  888,  475,  428}, {  153, -384,  338},
-{-1492, -511,  359}, { -974,-1115, -470}, {  105, -550,  677},
-{ -937,-1145,  877}, {  380, -260,  210}, { 1685,  924, 1256},
-{ 1775, 1190, 1095}, { 1419,  631,  533}, {  627,  299, -347},
-{ -411, -534,  647}, { -650,   29, -595}, { -378,-1367, 1563},
-{ 1402, 1121, 1465}, { 1089, 1410,  648}, {-2096,-1090,   -6},
-{  311, -194, -869}, { -639, -831,  416}, {-1162,-1224, 1349},
-{-1247, -941, 1813}, {-2193,-1987,  453}, { -619,-1367, -956},
-{-1606,-1972,-1507}, {-1175,-1057,-1104}, { -377,  601,  201},
-{ 1876,  825,  374}, { -430,-1323,   29}, {-1397,-1249,-1331},
-{-1007,-1504,  960}, {-1401,-2009,  197}, {-1379,-1949, -236},
-{-1077,  123,  422}, {  615, 1269,  546}, { -306, 1526,  904},
-{ 1194, 1788, 1177}, { -626, -884,-1526}, {  199,  766, 1504},
-{-1065,  862,  197}, {-1034,-1773, -887}, { -800,  145,  599},
-{-1134, -519,  626}, {-1205,-1926,  500}, { -910,-1041,-1395},
-{-1476,-1567, -969}, { -523,  842,   34}, { 1794,  646,  862},
-{-1207,-1888,-1002}, {  -78,   -9, -672}, { 1044,  759,   80},
-{ -600, 1139, 1019}, {   57, 2000, 1422}, { -833, 1414, 1121},
-{-1202, 1630, 1260}, { -461, 1420, 1244}, { 1537,  975,  253},
-{ -283,  324, -359}, {  599, -195,  106}, {  588,   62, -587},
-{ -757,  645,  205}, {   51, 1201,  758}, {-1209,  673, -390},
-{ -624, 1581,  941}, { -151, 1023,  735}, { 2820, 1301,  690},
-{ -302,  524,  -99}, { -900,-1588,-1189}, { 1084,  251,  238},
-{ 2014, 1792, 1010}, { 1245, 1633, 1741}, {-1227,-1540,-1208},
-{ -621,  456, -109}, {   40,  -65,  788}, { -805, -699,-1350},
-{ -583,  904,  832}, { -801,  532,  594}, { 1972, 1408, 1351},
-{-1177,-1880,-2114}, { -773,  568,  948}, {-1015, 1079, 1260},
-{-1111,  482, -130}, { 1778, 1044,  780}, {-1491,  245,  912},
-{ -316,-1141, -917}, { -536,-1442,-2346}, { -785,-1546,-1988},
-{-2003,  257,  909}, {-1849, -633,-1209}, {-1538,-1918,-1054},
-{ 1606, 2239, 1576}, { -567,-1500,-1544}, {-1279,  195, 1369},
-{ -817,  293, 1219}, { -525,  630, 1197}, {-1698,-2425,-1840},
-{ -303,  731,  747}, {-1169, -251,  269}, { -950,  -75, 1684},
-{-1182, -453, 1005}, {-1599,  585,  378}, {-2075, -571, -427},
-{ -529,-1159,-1171}, { -283, -205, -564}, { -796, 1246,  717},
-{ 2277,  927,  539}, { -454,  559,  440}, { -717, 1460, 1615},
-{-1030, 1052, 1610}, {-1169, -138,  847}, {  226,   39, -612},
-{-1251, -106, -729}, { -651,  968, 1302}, { -714, -636, 1727},
-{  353, 1069,  410}, { -798, -156, 1099}, { -574,  918,  446},
-{-1310, 1012,  466}, { 1408, 1591,  765}, { 1429, 1380, 1757},
-{ 1949, 1956, 2378}, { 1578, 2047, 2148}, {  916,   98,   -7},
-{ 1893, 1418, 2141}, {  348, 1405, 1579}, {  152, 1134, 1801},
-{ -267,  154, 1395}, {-1166,  469, 1054}, {-1142, -405,-1073},
-{-1341,-2264,-1581}, { -364,  869, 1706}, {-1162,  549, 1550},
-{-1225,-1932,-1666}, {-1485,-1977,-2055}, {-1727, -906,  -98},
-{-1897,  233, 1492}, {  892,  108, -331}, {-1728,-1170,-1700},
-{-1060, 1980, 1790}, {-1070,-1741,-1909}, {  -11, 1539, 1317},
-{-1600,   94,  497}, {  421,  443, -197}, {-1578, -349, -994},
-{ -599, -539, 1140}, { -965,-1419, -129}, {-1341,  175, -447},
-{ -375, 1311, 2055}, { -371, -650, -307}, {-1073,  605,  365},
-{-2057, -113,  430}, {  652,  914,  967}, {-1012,-1586,-2323},
-{ 1505, 1248,  559}, {  262, -486, -401}, {-1727, 1342, 1546},
-{   50,   56,  432}, { -330,  119, -604}, {-1517,-1080, -810},
-{  946, 1127, 1055}, {-1400,-1703,-1712}, {-1270, -704,-1317},
-{  807, 1821, 1143}, { 2760, 1606, 2171}, { 1120,  409, -150},
-{ -147,  404,  959}, { 2439, 1911, 2189}, { -906, -141, -866},
-{ -904, -142, -458}, { -557, -708,-1679}, { -830,-1431,-1583},
-{-1842,-1346,-1086}, {-1604, -272,  915}, {-1196,  772, 1056},
-{ -638,-1234,-1897}, { -500,  -81, -822}, {-1289,-1613, -735},
-{ -117,  785,  168}, {-1090, 1133,  922}, {-1096, -746, 1384},
-{  287, -547,-1063}, {-1376,-2201,-1204}, {-2176,-1570,-1757},
-{-1511,-2241, -771}, {-1737, 1099,  830}, {-1588,  724, 1243},
-{-1542,  693,  805}, {-1690, -240, 1665}, {-1700,   -4, -668},
-{ 2149,  816, 1042}, { -818,-1841,   22}, { -764, -507,  449},
-{-1151, -617,  289}, { -843,-1596, -240}, {  498, -234, -657},
-{ -752,  480, 1678}, { -319, -481,  193}, { -811,  171, -119},
-{-2128, -202, -848}, { 1717, 1140, 1700}
-};
-
-static const int16_t lsf_3_3[512][4] = {
-{   67,  -17,   66,  -12}, {-1690, -581, -104, -272}, {-1076,-1186,-1845, -376},
-{-1140, -926, -420,  -58}, { -259, -656,-1134, -553}, { 1788, 1227,  455,  129},
-{  462,  441, -240, -528}, {  840,  514,  130,  -75}, { 1114,  623,  153,  216},
-{ 1068,  564,   -6, -276}, { 1119,  727,  190,  -68}, {  704,  306,  119, -264},
-{  329,   61, -100,  156}, {  364,  123,  183, -208}, { -171, -123,  220,  -65},
-{ -306,  -62,  402,   17}, { -660, -938, -266,    0}, {  385,  235,  276,  285},
-{  320,  268, -336, -200}, { -724,   17,  -84,  381}, { -544,  429,  494,  519},
-{ -117,  288,  304,  329}, {  643,  157,  701,  508}, { 1200,  625,  796,  608},
-{  998,  421,  492,  632}, { 1204,  780,  446,  132}, { 1257,  844,  547,  449},
-{  829,  658,  541,  470}, { 1132, 1258,  918,  639}, {  547,   51,  423,  279},
-{    9,  392,   83,   94}, {  542,  543,  229, -147}, { -198,  129,  194, -185},
-{ -863,-1321, -302,   30}, { -597, -629,  -19,  114}, { -900,-1081,  466,  353},
-{-1483,-1573,   15, -143}, {-1708,-2059, -751,  196}, {-1876,-2067, -642, -258},
-{-2335,-1470, -450, -564}, { -584, -186, -872, -414}, {-1805, -988,-1125,-1310},
-{ -726,-1129,   28,  169}, {-1039, -864, -718, -246}, {  484,   36, -233,  -49},
-{  265,   67,  289,  467}, {  178,  543,  810,  540}, {   84,  282,  672,  703},
-{ -975, -777,  129,  287}, { -938, -227,  955,  595}, {-1617, -289,  836,  649},
-{-1847, -215, 1106,  718}, {-2034,-1085,  650,  440}, {-2101, -529,  907,  575},
-{-2011, -336,  670,  204}, {-2389, -692,  360,  137}, {-2156,-2204,   -9,  280},
-{ -266,  119,   39,  193}, {   78,  -59, -120,  226}, { -975, -858, -781,-1095},
-{ -619, -413, -451, -842}, {-1216,-1321, -813, -883}, {-1376,-1615, -394, -428},
-{ -737,-1113, -549, -790}, { -880, -975, -967, -642}, { -985, -886,-1273,-1361},
-{ -473, -804,-1401,-1407}, {  160, -265, -919, -275}, { -248, -250, -718, -380},
-{   97, -103, -375, -229}, { -415, -193, -135, -555}, {  628,  361,  119,  216},
-{  579,  364,  391,  209}, {  634,  522, -154, -148}, {  526,  389,  170,   33},
-{  105,  267,   64,  380}, {-1503,-1000,  -30, -369}, {-1070,   58,  647,  223},
-{-1520, -291,  621,  307}, {-1531,  156,  762,  404}, {-2029,  141,  734,  499},
-{-1849, -650,  306,  512}, { -187, -104,  -59,  438}, {  134, -230,  156, -186},
-{  -61, -260,  -16,   10}, { -569,   -3, -421, -297}, {-1725, -521, -346,  178},
-{-1362,  -59,  -44,  157}, {-2146, -461, -470, -349}, {-2170,   -1, -369, -121},
-{-1579, -373, -900,-1015}, {-1117, -591, -613, -784}, { -561,  122,  -75, -449},
-{   -4, -171, -123, -372}, {  192,  168,  -76, -132}, {  252, -107,  340,  210},
-{  392,  509,  272,  181}, { -109,  145,  218,  119}, { -416, -263,  485,  265},
-{ -181,   -8, -286,  226}, { -244, -218,   69, -290}, { -158,  191,   -1,  -64},
-{ -592,  -90,  213,  -96}, {  255,  435,  178,  -80}, { -369,  -18,  -33,  -80},
-{  -42,  415,  140, -222}, { 1143,  651,  649,  329}, {  767,  556,  249,  235},
-{  948,  413,  442,  279}, {  141,  339,  356,  557}, { -470, -170,   99,  237},
-{ -569, -800,  352,  565}, {  282,  473,  470,  332}, { -199, -690,-1284, -917},
-{ -193, -426, -800,-1122}, {  -26, -371, -490, -193}, {  637,  595,  519,  330},
-{  408, -115,   79,   12}, {  477,   87, -103, -376}, { -666, -347, -277, -291},
-{ -510, -481,  169,  297}, { -829, -738, -205, -171}, { -320, -540,  328,  283},
-{ -859, -958,  442,   -2}, {  556,  686,  130,   56}, { 1383, 1012,  755,  427},
-{  612,  741,  628,  553}, { -339, -796,  134,  277}, { -633,-1085,   -2, -246},
-{ -880,-1035,-1607,-1064}, { -994, -474,-1138, -488}, { -414, -795,   73, -206},
-{   -8, -139,  439,  204}, { -176, -578,   23,  131}, { -269, -757, -191,  245},
-{ -109, -338,  112,  316}, {  120, -406, -118,  611}, { -180, -186, -645,  115},
-{ -173,   34, -518, -489}, { -151,   61, -583, -844}, {  220, -138, -681,-1020},
-{  391,  -17, -598, -321}, {  157, -295,  129,  155}, { -926, -875, -987,  285},
-{  241,  -83, -125, -125}, {  620,  597,  432,   92}, {  393,   78,  409,   61},
-{ -393, -739, -413, -748}, {   83,   54,  361,   27}, {-1084,  130, -337, -694},
-{-1565,  297,  318,  -19}, {-1873,   36,   51, -317}, {-2323, -246,  231,  -84},
-{-2306, -783,   40, -179}, {-2233, -930, -474, -462}, { -754,  -86, -288, -626},
-{-2411, -455,  -63,  171}, {-1099,-1094,  -26, -143}, {-1193, -455, -406, -381},
-{ -605, -210,  -96,  -51}, { -580, -476, -276,  -15}, {-1195, -634,-1203, -881},
-{ -378, -221, -669, -952}, {  594,  178, -403, -676}, {  763,  327,  601,  290},
-{  172,  300,  203,  157}, {  -56, -336,  356,   24}, { -228, -296, -259,  -29},
-{ -186,  263,  416,   14}, { -353,  373,  -12, -216}, {  257,   96,  174,   57},
-{-1526, -616, -954, -499}, { -497, -152, -333,  125}, {  105,  200,  179,  -97},
-{ -331, -224,  765,  697}, {  760,  256,  301,   59}, {  455,  -85,  204,  288},
-{ -514,  240,  251, -109}, {  256,  417,  -34, -413}, {  101,  430,  384,  156},
-{  -31,  -10,  206,  426}, {  589,  145,  143,   71}, {  808,  906,  333,  349},
-{  986,  938,  589,  331}, { 1300,  824,  187,  509}, { 1062,  653,  379,  466},
-{ 1462,  937,  401,  274}, {  787,  861,  265,    2}, {  609,  553,   28,  305},
-{  926,  340,  106,  386}, {  241, -267, -147,  225}, { -178, -534,  347,  502},
-{ -643, -381,  397,   30}, { -651, -733, -435,  398}, { -407, -726, -484, -248},
-{ -789, -914, -438, -476}, { -498, -390,   75, -295}, { -964, -590, -606,  150},
-{ -121,  -49, -155,  -78}, {  935,  550,  389,   38}, { -321,  127,  424,  315},
-{ -285, -113,  283,  259}, {  658,  203,  322,  486}, {  903,  505,  748,  417},
-{  611,  423,  555,  512}, {  239,  -83, -578,  -19}, { -339, -731,  349,   13},
-{ -934,-1399, -114, -360}, {  107,  692,  182,   90}, {-1243,-1538,-1551, -725},
-{ -568, -903,-1363, -525}, { -517, -853, -861,-1004}, { -168, -690, -835,   63},
-{ -137, -556, -547,  144}, { -286, -817,  485,  319}, { -147, -408,  526,  246},
-{ -347, -434,  297,  -28}, { -290, -471,-1110,-1285}, { -460, -359, -988, -794},
-{ 1347, 1299,  690,  523}, { 1216, 1068, 1094,  757}, {  825, 1140,  752,  494},
-{ 1252, 1365, 1195,  898}, {  521, 1053,  532,  432}, { -334, -216, -313, -263},
-{ -160,   52, -472, -155}, {  127,  136, -380,   44}, {  851,  410, -162, -489},
-{  123, -255, -796, -667}, { 1090,  917,  789,  493}, { 1397, 1197,  558,  202},
-{  -51, -118, -342, -701}, {   83,  108,  -42, -441}, {   61,   95,  287,  256},
-{  -27,   89,  524,  531}, {  351,  227,  592,  545}, {  697,  155, -164,  307},
-{  638,  274, -489,  -50}, {  754,  240, -166, -124}, { -116, -579,-1212,  -63},
-{  190, -295,-1040,-1296}, {  147, -376, -177, -113}, {  841, 1241, 1051,  668},
-{    2,  293,  551,  304}, {-1096, -953, -248,  376}, { -750, -965,   87,  516},
-{ -275, -516,  689,  391}, { -379, -643,  876,  594}, { -390,-1013, -645,  573},
-{ -107, -568, -689, -826}, {-1025,  -27, -328, -203}, {  861,  749,  548,  233},
-{-1660,-1043,  451,  108}, { -660, -620,  430,  236}, {   21, -396,-1158, -631},
-{ 1372, 1298,  967,  577}, { 1125, 1125,  589,  454}, { -323, -865, -467,  153},
-{ -468, -699, -804, -509}, { -392, -718, -204,  -35}, { -603,-1093, -567, -162},
-{ -505,-1004, -102,  350}, {  219,  224,  423,  252}, {  395,  591,  608,  363},
-{ -746,  -96,  373,  172}, {  171,  295,  714,  339}, {  233,   77,  107,  277},
-{  157,  153, -499, -356}, { 1547, 1073,  576,  494}, { -292, -339, -504, -592},
-{ -903,  -72, -619, -481}, {-1594,-1117, -567, -254}, { -793, -507, -564, -291},
-{ -492, -532,  502,  560}, { -382,  427,  600,  230}, { -227,  477,  251,   75},
-{  285,  842,  813,  476}, {-1310,-1333,  186,  377}, { -587, -917,  643,  381},
-{-1186, -553,  411,   82}, {-1127, -820, -174, -540}, { -604,  119,  543,  205},
-{ -380,  657,  909,  567}, {  112, -298, -374,  114}, { -857, -251,   56,  159},
-{  401,  345,  -34, -140}, { -111, -607,   41,  614}, {  355, -114,  -77,  474},
-{  578,   56, 1450,  924}, { 1098, 1420,  741,  400}, {  246,   22,  588,  313},
-{ -121,  327,  831,  472}, {-1138, -608,  856,  552}, {-1241,-1072,  638,  600},
-{ -358,  254, -333, -303}, { -646,  739,  358,   74}, { 1226, 1671, 1221,  849},
-{ 2241, 1624,  983,  636}, { 1841, 1477,  749,  384}, {  350,  263,   87,  128},
-{-1902, -941, -144,  -64}, {-1734, -255,  288,  -31}, {-2644,-1238,  366,  235},
-{-1643,-1092,-1344, -304}, { -541,-1075,-1116,  123}, {-1178, -252, -816, -180},
-{-1016,  533,  565,  233}, { -487, -430, -188,  334}, {  867, 1236,  534,  171},
-{-1590,-1607,  635,  630}, {-2196,  310,  924,  412}, {-2358, -328,  956,  529},
-{-2639, -377,  630,  278}, {-2602,  317,  799,  299}, {-2406,  133,  340,   31},
-{-2156,-1468,  131,  125}, {-1184, -490, -139,   46}, { -744,  447,  891,  564},
-{   67, -451,  646,  604}, { -553, -429, -876,  396}, {  162,  -66, 1305,  915},
-{  479,  579, 1088,  794}, {  450,  278,  566,  324}, {-1057, -154,  148, -177},
-{-2545,  168, 1070,  592}, {-2351,  -42,  819,  345}, {-2344, -707,  721,  250},
-{-2175,-1497, -309,  122}, {  -78,  -73,  120,  173}, {   -4,  262, -263, -261},
-{ -431,  -64, -405, -732}, {-2609,  116,  -83, -193}, {-1525, -944, -477, -725},
-{ -508,  307,  170,  172}, {  832,  417,  832,  686}, { -225,  177,  894,  818},
-{ -482, -389, 1279, 1039}, { -383,  201, -350,   40}, {  730,  635,  226,  526},
-{  503,  462,  338,  398}, {  535,  714,   40, -282}, { 1482, 1471, 1085,  731},
-{ 1561, 1072,  909,  693}, { 1419, 1282,  889,  879}, { 1153,  728, 1186,  840},
-{ -226, 1130,  949,  689}, { -494, -986,-1556, -128}, { -568, -721, -713,  -26},
-{  317,  524,   70,  135}, { -405, -865,-1766, -652}, { -174, -801,  885,  773},
-{ -153,  -91, 1099,  751}, { -506,-1149,  853,  646}, {  241,  782,  519,  539},
-{ 1853, 1700, 1101,  684}, {-1249,-1486, -464,  188}, { -893,-1409,-1312, -341},
-{ -135,  438, -175,   18}, { 1111,  976,  319,  208}, {-1430,-1768,   83,  458},
-{ -530,-1000,  307,  129}, { -840,  -15,  -29, -356}, { -911, -924,-1147, -242},
-{ -119, -528,  127, -133}, { -761, -765,  190,  -83}, { -315,  895,  522,  231},
-{ -222,  102,  -63, -428}, {  316,  699,  379,   70}, {   25,  716,  314, -108},
-{  507,  874,  566,  238}, {  108,  941,  519,  195}, {  425,  -60, -427,  257},
-{  139, -103, -630,  446}, {  334,  370,  412,   48}, { -172, -690, -283,  557},
-{  187, -286,  158,  483}, {  140,  270, -344, -631}, {  924,  579, -116,  132},
-{  142,  466,  -68,  -64}, {  230, -145, -302, -542}, { -803, -912, 1018,  737},
-{ -773, 1015,  630,  297}, {-2596,   95,  445,  336}, {-2122,  491,  510,  191},
-{-1253,  161,   -2, -324}, {-1450, -633, -712, -105}, { -842, -254, -411,  100},
-{ -640, -290, 1010,  763}, { -650,  313, 1169,  730}, {  140,  505, 1030,  766},
-{  772,  287, 1067,  823}, {  495,  749,  305,  323}, { -164,  462,   78,  399},
-{ -342, -874,   69,  597}, {  -16,  620,  621,  337}, { -138, -444, -265,  218},
-{   84, -450,  953,  666}, { -222, -803,  541,  604}, { -921,-1376,  244,  116},
-{ -841, -723,  630,  588}, {  140,  663,  294,  368}, {  935, 1046,  881,  759},
-{ 1746, 1464,  916,  628}, {  436,  963,  281,    1}, { -119,   74,  542,  213},
-{    1, -567,  301,  241}, {  260,  435,  222,  396}, {  936,  957, 1108,  703},
-{  510,  506,  808,  478}, {  601,  694,  960,  620}, {  972,  741,  980,  600},
-{  834,  717,  767,  684}, {  643,  972,  935,  638}, {  501,  661,  720,  851},
-{ -105, -632, -303, -117}, { -429,  130,  789,  442}, { -522, -188,  704,  373},
-{ -759,   42,  814,  523}, { -531,-1137,  373,  578}, { -682,-1203, -455,  285},
-{-1163,-1577,-1098,   44}, {   81,  -82,  712,  363}, {  477,  246,  954,  622},
-{ 1604, 1622, 1277,  891}, { 1409,  859,  924,  892}, {  774, 1041,  947, 1142},
-{   40, -546,  -75,  288}, { -616, -106, -697,  -26}, { -169, -160, -891, -739},
-{ -279, -384,-1029, -350}, { 1781, 1308, 1046,  816}, { 1580, 1533, 1472, 1178},
-{ 1505, 1076, 1216,  899}, {  890,  904,  564,  654}, {  920,  692, 1021,  856},
-{ -493,  132,  177,  505}, {   71,  195,  -28,   97}, {  456,  351, -164,   88},
-{  439,  278,  -40,  350}, { 1395,  949,  234,  -95}, { -805, -472,   38, -163},
-{  367,  -98,  489,  523}, { 1025, 1178, 1212,  906}, {  319, 1314,  814,  461},
-{ -123, -543, -804,  447}, { -748, -324, -897,-1127}, { -737, -501, -789, -713},
-{  715,  777, 1239,  922}, { 1949, 1939, 1368,  865}, {  730,  880,  758,  388},
-{ -871,  454,   17, -251}, { -381, -810,-1583,  239}, { -521, -966, -792,  259},
-{ -890,-1358, -770,  -73}, {  166,  349, -212,  323}, { -840, -301,  473,  435},
-{ -679, -464,  728,  351}, { -156, -199,  667,  432}, {   29, -252,  415,  480},
-{ -731, -379,  145,  559}, { -528, -631,-1158, -159}, {  445,  273,  123,  639},
-{  373, -126,  800,  568}, {   84, -162,  720,  712}, { -830, -536, -185,  222},
-{  408,  452,  501,  771}, { -897,-1355,  -67,  442}, { -792,-1406,  566,  602},
-{  167, -326,  509,  330}, {  -95, -626, -730, -344}, { 1668, 1217,  779,  455},
-{ 1316,  828,  584,  719}, {  404,  -31, 1013,  789}, {   89,  107,  891,  549},
-{  871, 1581,  917,  671}, {  866, 1479, 1289,  854}, {  391, 1068, 1122,  812},
-{   78, -562,  345,  563}, {  429, -103,  417,  787}, { -122, -437,  411,  788},
-{ -913, -417,  602,  754}, { -226,  -16,  151,  760}, { -700,  118, -104,  -14},
-{-1128,   48,  284,  393}, { -390, -419, -639, -116}, { -910,  306,  316,  -13},
-{ 1207,  984,  821,  669}, {-1195, -693,  140, -213}, { -884, -416, -199, -558},
-{ -616,  245, -404, -664}, {  262,   56, -617, -724}, {  -85, -491, -320, -656},
-{ -570, -831, -129, -528}, {-1506,  -63, -367, -385}, { -358, -321,    4,   51},
-{ -366, -214,  319,  511}, {  146,  671,  -17, -291}, { -110,  464, -139, -496},
-{ -202,  220, -312, -631}, { -660,  -73, -655, -820}, { -662, -653,-1288, -857},
-{ -430, -953, -959, -264}, {  -49, -468,  -72, -381}, { -350, -563, -193, -407},
-{   55, -408, -803,   11}, { -309,  649,  188, -198}, { -512,  461,  -79, -458},
-{-1318, -263, -134, -523}, {-1657, -435, -495, -765}, {   57, -347, -414,  434},
-{-1141, -242, -664, -857}, {   34,  -68, -707, -338}
-};
-
-static const int16_t lsf_5_1[128][4] = {
-{ -451,-1065, -529,-1305}, { -450, -756, -497, -863}, { -384, -619, -413, -669},
-{ -317, -538, -331, -556}, { -414, -508, -424, -378}, { -274, -324, -434, -614},
-{ -226, -500, -232, -514}, { -263, -377, -298, -410}, { -151, -710, -174, -818},
-{ -149, -412, -156, -429}, { -288, -462, -186, -203}, { -170, -302, -191, -321},
-{ -131, -147, -297, -395}, { -228, -214, -245, -192}, {  -67, -316,  -71, -327},
-{ -104, -205,  -94, -183}, { -143,  -38, -193,  -95}, {   16,  -76, -124, -248},
-{   23, -237,   24, -244}, {   18, -136,   44, -111}, {  -33,  -24,  -25,    0},
-{  149,   19,   23, -143}, {  158, -169,  174, -181}, {  133,  -55,  165,  -26},
-{  111,   84,   98,   75}, {   87,  183, -115,  -11}, {   -8,  130,   11,  170},
-{  254,   77,  205,   17}, {  183,  112,  262,  194}, {  202,  287,   95,  189},
-{  -42, -105,  234,  179}, {   39,  186,  163,  345}, {  332,  199,  299,  161},
-{  -54,  285,  -78,  281}, { -133,  141, -182,  111}, {  249,  341,  271,  364},
-{   93,  403,   75,  391}, {   92,  510, -138,  220}, { -185,  -29,  -34,  361},
-{ -115,  320,    3,  554}, {   99,  286,  218,  591}, { -245,  406, -268,  453},
-{    0,  580,   25,  606}, {  275,  532,  148,  450}, {  -73,  739, -285,  518},
-{ -288,   94, -203,  674}, { -140,  -74,  205,  714}, { -114,  299,  176,  923},
-{  182,  557,  240,  705}, {  -16,  513,  485,  593}, {  293,  384,  451,  617},
-{  -38,   50,  563,  529}, {  303,  209,  459,  363}, {  433,  452,  450,  454},
-{  367,  606,  477,  741}, {  432,  353,  368,  267}, {  361,  716,  273,  583},
-{  453,  166,  510,  172}, {  201,  629,  274,  191}, {  568,  639,  302,  298},
-{  634,  387,  643,  350}, {  587,  560,  612,  565}, {  600,  788,  487,  672},
-{  512, 1015,  321,  333}, {  357,  854, -125,  413}, {  474,  712,   17, -151},
-{  564,  285,  270, -241}, {  971,  889,  489,  220}, {  510,  896,  549,  924},
-{  327,  825,  290,  911}, {  540, 1108,  158,  805}, {  199,  957,  511,  730},
-{  100,  874,   13,  791}, {  435,  632,  676,  972}, {  249,  900,  467, 1218},
-{  781, 1074,  585,  785}, {  -23,  669,  267, 1043}, {  619, 1084,  615, 1145},
-{  622,  905,  916, 1049}, {   80,  331,  584, 1075}, {   89,  639,  988,  961},
-{  770,  720,  798,  699}, {  492,  447,  899,  627}, {  271, 1188,  725, 1333},
-{   87,  603,  832, 1603}, {  616, 1127,  890, 1505}, { 1000, 1156,  866, 1009},
-{  995,  827, 1149,  858}, {  817, 1450,  773, 1320}, {  500, 1389,  312, 1153},
-{  -20, 1084,   64, 1283}, {    2, 1172,  399, 1869}, {  514, 1706,  502, 1636},
-{  886, 1522,  416,  600}, { 1131, 1350, 1275, 1390}, {  889, 1795,  914, 1766},
-{  227, 1183, 1250, 1826}, {  505, 1854,  919, 2353}, { -199,  431,  152, 1735},
-{ -213,  -28,  392, 1334}, { -153,  -52,  978, 1151}, { -323, -400,  813, 1703},
-{ -136,   84, 1449, 2015}, { -331, -143, -137, 1192}, { -256,  534, -157, 1031},
-{ -307, -439,  542,  731}, { -329, -420,  -97,  616}, { -362, -168, -322,  366},
-{ -247, -110, -211,   89}, { -196, -309,   20,   59}, { -364, -463, -286,   89},
-{ -336,  175, -432,  141}, { -379, -190, -434, -196}, {  -79,  150, -278, -227},
-{ -280,  166, -555, -422}, { -155,  541, -366,   54}, {  -29,  -83, -301, -774},
-{  186,  628, -397, -264}, {  242,  293, -197, -585}, {  124,  410,   53, -133},
-{   10,  340, -570,-1065}, {   65, -446,   68, -493}, {  383,  937, -357, -711},
-{ -359, -250, -677,-1068}, {  292,  -26,  363,    6}, {  607, 1313, -127,  -10},
-{ 1513, 1886,  713,  972}, { 1469, 2181, 1443, 2016}
-};
-
-static const int16_t lsf_5_2[256][4] = {
-{-1631,-1600,-1796,-2290}, {-1027,-1770,-1100,-2025}, {-1277,-1388,-1367,-1534},
-{ -947,-1461, -972,-1524}, { -999,-1222,-1020,-1172}, { -815, -987, -992,-1371},
-{-1216,-1006,-1289,-1094}, { -744,-1268, -755,-1293}, { -862, -923, -905, -984},
-{ -678,-1051, -685,-1050}, {-1087, -985,-1062, -679}, { -989, -641,-1127, -976},
-{ -762, -654, -890, -806}, { -833,-1091, -706, -629}, { -621, -806, -640, -812},
-{ -775, -634, -779, -543}, { -996, -565,-1075, -580}, { -546, -611, -572, -619},
-{ -760, -290, -879, -526}, { -823, -462, -795, -253}, { -553, -415, -589, -439},
-{ -533, -340, -692, -935}, { -505, -772, -702,-1131}, { -263, -306, -971, -483},
-{ -445,  -74, -555, -548}, { -614, -129, -693, -234}, { -396, -246, -475, -250},
-{ -265, -404, -376, -514}, { -417, -510, -300, -313}, { -334, -664, -463, -814},
-{ -386, -704, -337, -615}, { -234, -201, -233, -239}, { -167, -567, -203, -619},
-{ -147, -415, -115, -352}, { -166, -750, -171, -761}, { -270, -879, -264, -903},
-{ -367, -744,   43, -475}, {   14, -653,   43, -670}, {   11, -448,  -59, -521},
-{ -126, -119, -155, -613}, {  -42, -863,  -27, -931}, {  136, -483,  183, -468},
-{   55, -298,   55, -304}, {  313, -609,  313, -720}, {  322, -167,  100, -541},
-{   -3, -119, -111, -187}, {  233, -236,  260, -234}, {   26, -165,  134,  -45},
-{  -40, -549,  360, -203}, {  378, -388,  450, -383}, {  275,   20,  182, -103},
-{  246, -111,  431,   37}, {  462, -146,  487, -157}, { -284,  -59,  503, -184},
-{   24,   53,   -3,   54}, {  122,  259,  333,   66}, {  484,  104,  436,   68},
-{  195,  116,  190,  206}, {  269,   -9,  482,  352}, {  382,  285,  399,  277},
-{  452,  256,   69,  186}, {   13,  297,  -13,  259}, {  -95,   30,   56,  394},
-{  196,  425,  205,  456}, {  281,  577,   15,  191}, {  375,  290,  407,  576},
-{  -56,  227,  544,  405}, {    0,  549,  -92,  528}, { -229,  351, -245,  338},
-{ -362,  435,  167,  527}, {  -75,  302,   91,  824}, {  129,  599,  496,  679},
-{  186,  749,  153,  737}, { -281,  600, -348,  615}, { -236,  769,   41,  881},
-{   38,  890, -220,  841}, { -357,  883, -393,  903}, { -634,  474, -444,  850},
-{ -175,  678, -493,  242}, { -519,  785, -714,  582}, { -541,  366, -543,  434},
-{ -597,  500, -765,  222}, { -702,  917, -743,  962}, { -869,  501, -899,  548},
-{ -379,  200, -435,  157}, { -819,  214, -861,  157}, { -614,   40, -632,   94},
-{ -883,  -54, -741,  516}, { -501,  298, -614, -171}, { -870, -161, -865,  -23},
-{ -818,   93,-1015, -267}, { -662, -359, -549,    2}, { -442, -121, -377,    0},
-{ -227,   33, -414, -126}, { -129,  212, -934,   34}, {-1082, -282,-1119, -268},
-{ -710, -825, -420, -191}, {-1076, -928, -917,  -93}, { -628, -358,   97,    7},
-{ -206, -393, -101,   24}, { -203,   38, -168,   83}, { -599, -423, -279,  426},
-{ -700,  118,  -75,  206}, { -981, -673, -680,  417}, { -367,   37, -279,  474},
-{ -129, -318,  319,  296}, { -626,  -39,  343,  602}, { -696,  -39, -303,  940},
-{  104,  233, -380,  137}, {  -36,  269,  -75, -214}, {  120,   43, -529, -477},
-{  459,  164, -202, -229}, {  -49, -167,  609,  792}, {   98, -220,  915,  148},
-{  293,  283,  869,   91}, {  575,  394,  326,  -78}, {  717,   67,  365, -323},
-{  616,  -36,  731,   27}, {  619,  238,  632,  273}, {  448,   99,  801,  476},
-{  869,  273,  685,   64}, {  789,   72, 1021,  217}, {  793,  459,  734,  360},
-{  646,  480,  360,  322}, {  429,  464,  638,  430}, {  756,  363, 1000,  404},
-{  683,  528,  602,  615}, {  655,  413,  946,  687}, {  937,  602,  904,  604},
-{  555,  737,  786,  662}, {  467,  654,  362,  589}, {  929,  710,  498,  478},
-{  415,  420,  693,  883}, {  813,  683,  781,  925}, {  913,  939,  726,  732},
-{  491,  853,  531,  948}, {  734,  963,  315,  808}, {  761,  755, 1144,  760},
-{  655, 1076,  826, 1057}, { 1091,  838, 1003,  808}, { 1047, 1133,  659, 1101},
-{  992, 1050, 1074, 1075}, {  971,  694, 1226, 1054}, {  571,  841,  884, 1404},
-{ 1379, 1096, 1080,  861}, { 1231,  735, 1284,  760}, { 1272,  991, 1367, 1053},
-{ 1257,  700, 1050,  534}, {  988,  453, 1264,  599}, { 1140,  679, 1621,  815},
-{ 1384,  521, 1317,  393}, { 1564,  805, 1448,  686}, { 1068,  648,  875,  307},
-{ 1083,  361, 1047,  317}, { 1417,  964,  675,  571}, { 1152,   79, 1114,  -47},
-{ 1530,  311, 1721,  314}, { 1166,  689,  514,  -94}, {  349,  282, 1412,  328},
-{ 1025,  487,  -65,   57}, {  805,  970,   36,   62}, {  769, -263,  791, -346},
-{  637,  699, -137,  620}, {  534,  541, -735,  194}, {  711,  300, -268, -863},
-{  926,  769, -708, -428}, {  506,  174, -892, -630}, {  435,  547,-1435, -258},
-{  621,  471,-1018,-1368}, { -393,  521, -920, -686}, {  -25,   20, -982,-1156},
-{  340,    9,-1558,-1135}, { -352,   48,-1579, -402}, { -887,    6,-1156, -888},
-{ -548, -352,-1643,-1168}, { -159,  610,-2024, -963}, { -225,  193,-1656,-1960},
-{ -245, -493, -964,-1680}, { -936, -635,-1299,-1744}, {-1388, -604,-1540, -835},
-{-1397, -135,-1588, -290}, {-1670, -712,-2011,-1632}, {-1663,  -27,-2258, -811},
-{-1157,  184,-1265,  189}, {-1367,  586,-2011,  201}, { -790,  712,-1210,    3},
-{-1033,  808,-1251,  830}, { -111,  635,-1636,  447}, { -463, -949, -445, -928},
-{ -504,-1162, -501,-1211}, {  144, -351, -372,-1052}, { -283,-1059, -279,-1123},
-{ -575,-1438, -587,-1614}, { -935, -984,  229,  690}, { -921, -719, -403, 1362},
-{ -685, -465,  874,  397}, { -509,  -46,  317, 1334}, { -485,  456,  813,  439},
-{ -411,  339,  898, 1067}, { -425,   46, 1441,  497}, { -909, -800, 1465, 1046},
-{ -254, -321, 1430, 1165}, {   68,  350, 1034,  666}, {  370,   11, 1311,  790},
-{  143,  232, 1041, 1562}, { -114,  663, 1616, 1078}, {  454,  579, 1275, 1040},
-{  -76,  909,  752, 1067}, {  153,  512,  348, 1214}, {  614,  385, 1843,  808},
-{  269, 1034,  203, 1086}, {  652, 1017, 1783, 1130}, {  429, 1327,  387, 1384},
-{  -49, 1183,  -72, 1215}, { -416, 1001,  544, 1749}, { -352, 1223, -502, 1199},
-{ -589,  569, -227, 1630}, { -142, 1578, -230, 1715}, { -714, 1288, -838, 1398},
-{ 1131, 1357, -208, 1232}, {  437,  965, -929,  818}, {  811, 1410,  859, 1507},
-{  164, 1212, 1387, 1793}, {  484, 1874,  456, 2063}, {  996, 1170, 1326, 1402},
-{ 1316, 1360, 1135, 1262}, { 1234, 1618, 1361, 1768}, { 1421, 1227, 1584, 1347},
-{  854,  672, 1685, 1566}, { 1139, 1270, 2016, 1825}, { 1773, 1581, 1532, 1460},
-{ 1487,  946, 1659, 1021}, { 1744, 1212, 1392,  977}, { 1772, 1161, 1826, 1164},
-{ 1718, 1429, 1973, 1591}, { 1185,  864, 2132, 1061}, { 1799,  814, 1838,  757},
-{ 2104, 1315, 2054, 1258}, { 2113,  915, 2331,  930}, { 1467, 1147, 2590, 1439},
-{ 2245, 1744, 2090, 1620}, { 2358, 1454, 2666, 1506}, { 1876, 1837, 2070, 1975},
-{ 1739, 1577,  682, 1289}, { 1584, 2045, 1454, 2098}, { 2498, 2004, 2711, 2066},
-{  726, 1588, 2756, 2336}, {  228,  847, 2456, 1659}, {   36,  301, 1942, 1957},
-{ -446,  -96, 2154, 1396}, { 1533, 1101,   14,  608}, { -923, -732, 1383, 1982},
-{ 1345,  952, -680,  321}, { 1281, 1268,-1594,  365}, {  941,  946,-1737, -822},
-{ 2374, 2787, 1821, 2788}
-};
-
-static const int16_t lsf_5_3[256][4] = {
-{-1812,-2275,-1879,-2537}, {-1640,-1848,-1695,-2004}, {-1220,-1912,-1221,-2106},
-{-1559,-1588,-1573,-1556}, {-1195,-1615,-1224,-1727}, {-1359,-1151,-1616,-1948},
-{-1274,-1391,-1305,-1403}, {-1607,-1179,-1676,-1311}, {-1443,-1478,-1367, -898},
-{-1256,-1059,-1331,-1134}, { -982,-1133,-1149,-1504}, {-1080,-1308,-1020,-1183},
-{ -980,-1486, -967,-1495}, { -988, -922,-1047,-1077}, { -838,-1179, -858,-1222},
-{-1131,-1041,-1064, -767}, { -872,-1157, -701, -880}, { -706, -906, -774,-1016},
-{ -578,-1080, -801,-1478}, { -591,-1111, -592,-1146}, { -713,-1388, -640,-1376},
-{ -597,-1059, -416, -903}, { -686, -832, -661, -708}, { -444, -868, -490, -921},
-{ -374, -776, -619,-1170}, { -585, -549, -769, -795}, { -435, -659, -530, -741},
-{ -498, -837, -357, -597}, { -279, -871, -243, -887}, { -282, -665, -280, -667},
-{ -165, -560, -394, -903}, { -362, -410, -448, -583}, { -409, -574, -313, -357},
-{ -637, -548, -570, -436}, { -896, -504, -382, -757}, {  -58, -481, -165, -618},
-{ -191, -374, -234, -382}, { -222, -683,  -25, -480}, { -418, -359, -730, -353},
-{ -324, -157, -432, -322}, { -394, -303, -284, -104}, { -601, -289, -556, -196},
-{ -588, -150, -659, -608}, { -473,  -24,  -68, -448}, { -474,   -8, -506,  -45},
-{ -748, -184, -844, -252}, { -901,  -91, -584,  -97}, { -652,  138, -764, -131},
-{ -678,  -12, -670,  165}, { -259,   -3, -840, -107}, { -909,   37, -992,   44},
-{ -854, -415, -839,   13}, {-1001, -271,-1026, -309}, { -798, -478, -832, -488},
-{ -943,  168,-1112, -387}, {-1185, -101,-1183,  -40}, { -941, -316,-1030, -770},
-{-1044, -625,-1081, -538}, {-1224, -299,-1312, -436}, {-1197, -663,-1167, -161},
-{-1216, -690,-1237, -831}, {-1432, -720,-1403, -493}, { -898, -740, -922, -801},
-{-1102, -402,-1579, -964}, {-1061, -638,-1269,-1438}, {-1499, -934,-1502, -895},
-{-1598, -564,-1723, -717}, { -606, -597,-1166,-1085}, {-1369, -468,-1946,-1493},
-{-1838, -953,-1932, -931}, {-1499, -188,-1635, -421}, {-1457, -338,-1448,  -22},
-{-1942, -422,-2006, -249}, { -496, -114,-1910, -755}, {-1289,  174,-1451, -109},
-{ -482, -257,-1221, -508}, {-1617,  151,-1694,  208}, { -654,  107,-1651,   29},
-{-1141,  279,-1215,  306}, {-1228, -506, -730, -175}, {-1236, -101, -969,  551},
-{ -870,  278, -823,  315}, { -563,  376,-1051,  228}, { -507,  280, -599,  281},
-{ -758,  253, -305,  379}, { -755, -134, -611,  660}, { -824,  536, -817,  646},
-{ -413,   49, -341,  177}, { -453,  526, -482,  589}, {  -71,  339, -657,  264},
-{ -244,  295, -237,  315}, { -387,  569, -506,   -9}, { -377,   14, -160,  661},
-{ -216,   40, -308,  -46}, {   95,  214, -242,  167}, {  -86,  192,  -56,   27},
-{  -76,   31,   36,  309}, { -106, -182, -113,   74}, { -441,  -22,   23,  139},
-{   81,  -11,   44,   15}, {  -87, -137, -118, -207}, { -158,  -58,  272,  -92},
-{ -156, -441,    8, -136}, {  128, -221,  101, -218}, {   40, -197,  -76, -456},
-{    9, -445,   33, -423}, {  226,   60,   73, -222}, {  156, -399,  280, -318},
-{  245, -341,  166, -499}, {  339, -190,  327, -219}, {  325, -137,  -89, -596},
-{  100, -627,  144, -677}, {  487,   28,  252, -391}, {  214,  -41,  282,  -28},
-{   99, -286,  331,   49}, {  459, -388,  565, -369}, {  436,   28,  336,   -9},
-{  397, -167,  618,   34}, {  596,  -17,  561, -140}, {  299,   79,  522,  125},
-{  203,    2,  244,  288}, {  255,  211,  175,   82}, {  596,  187,  517,  108},
-{  381,  255,  365,  297}, {  497,  352,  327,  -82}, {   25,  210,  371,  245},
-{  261,    3,  545,  449}, {  140,  294,   44,  295}, {  212,  347,  244,  494},
-{  331,  528,  201,  307}, {  349,  411,  613,  284}, {  614,  413,  464,  322},
-{  624,  397,   97,  200}, { -160,  384,  149,  362}, {  495,  525,  269,  585},
-{   33,  491, -121,  433}, {  427,  611,  498,  516}, {  171,  443,  497,  666},
-{  440,  275,  566,  575}, {  146,  639,  155,  670}, {  -33,  173,  212,  696},
-{ -166,  601, -191,  695}, { -489,  503,  175,  742}, {  214,  476,  372, 1083},
-{  578,  530,  586,  777}, {  425,  874,  315,  841}, {  374,  848, -165,  565},
-{   35,  991,  -39, 1062}, {  329,  712,  786,  840}, {  645,  795,  661,  676},
-{  571,  918,  632, 1079}, {  673,  817,  318,  388}, {  874, 1012,  564,  848},
-{  880,  620,  557,  479}, {  671,  453,  692,  468}, {  840,  642,  844,  645},
-{  506,  428,  897,  567}, {  837,  387,  962,  499}, {  691,  561,  939,  926},
-{  783,  296,  790,  268}, { 1028,  530,  874,  329}, {  548,  143,  675,  291},
-{  503,   66, 1041,  359}, {  786,   97,  805,   33}, {  837,  470,  511,   49},
-{ 1092,  327, 1174,  323}, {    3,  242,  872,  474}, {  689,  429, 1329,  678},
-{ 1042,  620, 1109,  664}, {  321,  193,  889,  950}, { 1153,  874,  893,  635},
-{  877,  862,  948,  913}, { 1293,  665, 1320,  639}, {  997,  793, 1402, 1030},
-{ 1176, 1012, 1110,  959}, { 1410,  925, 1403,  915}, {  543,  862, 1116, 1222},
-{  835, 1190,  835, 1190}, {  959, 1148, 1147, 1376}, { 1300, 1193, 1415, 1231},
-{ 1335, 1341,  746, 1092}, { 1711, 1283, 1389, 1073}, { 1334, 1566, 1153, 1475},
-{ 1645, 1137, 1825, 1220}, { 1056, 1382, 1521, 1730}, { 1632, 1545, 1620, 1542},
-{  855, 1596,  865, 1667}, {  693,  885, 1716, 1519}, { 1167, 1296, 2209, 1760},
-{ 1952, 1493, 2020, 1482}, { 1534, 1866, 1694, 2008}, { 1566,  748, 1761,  825},
-{  294, 1392, 1084, 2058}, {  621, 1315,  365, 1287}, {  198, 1028,  488, 1408},
-{  249,  403, 1014, 1561}, {  324,  363, 1645, 1044}, {  193,  367, 2034, 1859},
-{ -251,  579,  750,  994}, { -243,   30, 1325,  879}, {  -28, -169,  624,  917},
-{ -453,  159,  186, 1370}, { -614,    6,  537,  392}, {  -94, -291,  781,  229},
-{ -128, -298,  245,  491}, { -701, -648,  972,  789}, { -501, -640,  178,  255},
-{ -365, -390, -255,  317}, { -958, -294, -191,  228}, { -775, -447,  157, -237},
-{ -657, -720, -407,   92}, { -117, -611,  334, -230}, { -679,-1084, -144, -317},
-{ -901, -861, -738, -360}, {  -85, -727,  -90, -787}, {  100,  -22, -391, -263},
-{  -56,  -73, -337, -754}, {    5, -189, -706, -624}, {   89, -344, -135,-1113},
-{ -353, -237, -684,-1135}, { -275,-1102, -269,-1203}, {  152,  145, -722,-1232},
-{   49,   80,-1248, -776}, { -248,  391, -732, -547}, {  469,  218, -255, -864},
-{   69,  366, -166, -485}, { -688,  191,-1212,-1196}, { -170, -169,-1308,-1631},
-{  321,  470,-1419,-1243}, {  -64,  272,-1361, -248}, {  492,  565, -721, -609},
-{  195,  485, -573, -133}, {  427,  202, -171, -118}, {  199,  575,    2,  -31},
-{  694,  755,-1366,  -39}, {  552,  557, -489,  271}, {  680,  537,   13, -453},
-{  855,  954, -133,  -52}, {  -81,  738,-1169,  637}, { 1055, 1059,  -95,  676},
-{ 1259, 1081,  489,  305}, { -449,  954, -534,  996}, { -969,  866,-1058, 1059},
-{-1294,  618,-1416,  617}, { -458, 1366, -159, 1821}, { -774, -528,  -14, 1110},
-{-1202, -901, -772,  433}, {-1256,-1255,-1011, -302}, { -602, -585, -759,-1618},
-{ -760,-1549, -840,-1921}, { -816, -539,-1769,-2235}, { -227,  -36,-2034,-1831},
-{-2107,-1126,-2471,-1816}, {-1470,  252,-2701, -415}, { -571, -467, 1509, 1554},
-{ 2180, 1975, 2326, 2020}
-};
-
-static const int16_t lsf_5_4[256][4] = {
-{-1857,-1681,-1857,-1755}, {-2056,-1150,-2134,-1654}, {-1619,-1099,-1704,-1131},
-{-1345,-1608,-1359,-1638}, {-1338,-1293,-1325,-1265}, {-1664,-1649,-1487, -851},
-{-1346,-1832,-1413,-2188}, {-1282, -681,-1785,-1649}, { -966,-1082,-1183,-1676},
-{-1054,-1073,-1142,-1158}, {-1207, -744,-1274, -997}, { -934,-1383, -927,-1416},
-{-1010,-1305, -783, -955}, {-1049, -900, -993, -817}, { -737, -823, -972,-1189},
-{ -738,-1094, -738,-1154}, { -784, -801, -810, -786}, { -892, -520,-1000, -818},
-{ -644, -965, -577, -882}, { -541, -694, -671, -917}, { -595, -642, -646, -615},
-{ -956, -621, -925, -515}, { -727, -483, -815, -485}, { -840, -578, -440, -713},
-{ -578, -325, -657, -670}, { -386, -570, -441, -666}, { -514, -787, -392, -529},
-{ -522, -453, -487, -423}, { -616, -585, -617, -157}, { -662, -268, -680, -348},
-{ -322, -323, -632, -444}, { -304, -430, -332, -458}, { -277, -468, -659, -793},
-{ -319, -636, -227, -554}, { -373, -347, -334, -210}, { -456, -192, -530, -242},
-{ -216, -198, -366, -370}, { -338, -161, -409, -748}, { -107, -380, -294, -643},
-{ -223, -665, -234, -741}, { -141, -496, -130, -510}, { -139, -327, -172, -305},
-{ -306, -580, -164, -263}, { -262, -172,  -67, -402}, {   31, -366,  -10, -436},
-{  -86, -527,   71, -377}, {  -22, -609,  -12, -678}, {  -67, -319,   63, -191},
-{   35, -181,  -39, -242}, {  126, -167, -140, -544}, {  155, -297,  174, -297},
-{   38,   -8,  117, -380}, {  197, -452,  240, -522}, {  223, -103,  110, -187},
-{   87, -155,  169,  -47}, {  157,   26,  -83, -100}, {  128,   80,  209,  -62},
-{    6,    7,   22,    5}, {  318,  -20,  248,  -45}, { -200,  -63,  156,  -69},
-{  250, -183,  369, -126}, { -113,  -76, -142, -122}, {  -64, -254,  -31,   35},
-{ -177,  -71,   -7,  171}, {   93,   27,  108,  212}, { -330, -209, -123,  -70},
-{ -279,   95,  -96,   20}, { -188,  -61, -314,   87}, { -300,  -78, -354, -134},
-{   11,  122, -140,  122}, { -275,  152, -293,  140}, {  -82,  138, -321, -111},
-{ -480, -156, -359,   76}, { -254,  -40, -635,  -96}, { -522,   79, -507,    8},
-{ -268,  303, -539,   68}, { -446,   61, -522,  306}, {  111,  189, -435,  122},
-{ -379,  166, -571, -398}, { -632,  -74, -747,  -95}, { -455,  194, -952,   83},
-{ -798,  192, -755,  192}, { -781, -162, -619,  234}, { -663, -297, -488, -109},
-{ -964, -132, -838,  -68}, { -843,   58,-1112,  -86}, { -805, -299, -944, -253},
-{ -778,  -50, -965, -549}, { -352,  -98, -992, -343}, {-1117, -315,-1117, -307},
-{-1155, -374, -637, -230}, {-1166,  -43,-1299, -100}, { -925, -393,-1274, -600},
-{ -689, -130,-1479, -312}, {-1321, -254,-1464, -442}, {-1292, -613,-1261, -503},
-{-1501, -368,-1322,   26}, {-1432,  -66,-1743, -161}, {-1644, -467,-1760, -548},
-{-1393, -568,-1556, -871}, {-1495,-1034,-1387, -571}, {-1917, -528,-1783, -123},
-{-1897, -231,-2054, -323}, {-2052, -906,-1976, -567}, {-1917, -620,-2047, -989},
-{-1077, -370,-2031, -704}, {-2355, -749,-2740,-1089}, {-1909,  159,-2012,  248},
-{ -626, -123,-2339, -962}, { -669, -408,-1379,-1174}, { -452, -364,-1044, -735},
-{ -132,  183,-1620, -752}, { -547, -307, -777,-1261}, {  -98,   41, -880,-1091},
-{ -257,   97,-1602,-1833}, {   31,  -26, -644, -561}, { -180, -546, -385,-1095},
-{ -410, -802, -414, -827}, { -457, -970, -490,-1109}, { -215, -916, -144, -937},
-{ -493,-1269, -517,-1507}, {  181,  101, -332, -889}, { -836, -937, -559, -429},
-{ -629, -547, -183, -337}, { -545,  -82, -250, -286}, {    5, -132, -348, -252},
-{ -293, -472, -158,  100}, {  -29,  197, -236, -424}, { -861, -213, -140,   -7},
-{ -427, -443,  187,  -97}, { -684, -736, -293,  258}, { -368, -152, -150,  392},
-{ -609,  175, -142,  299}, { -138,  152, -119,  329}, { -486,  -52,  293,  198},
-{ -183,  117,  175,  331}, {  -58, -274,  231,  300}, { -288,  330, -305,  372},
-{ -111,  409,   -9,  423}, {   83,  256,   67,  367}, {  -19,  248,   91,  113},
-{  -35,  406, -191,  154}, {  238,  296,    5,  197}, {  141,  221,  313,  198},
-{  211,  421,  244,  334}, {   88,  426, -243,  454}, {  202,  552,   -5,  403},
-{  291,  185,  219,  301}, {  251,  138,  128,   69}, {  197,  288, -140,  -61},
-{  188,  361,  197,  598}, {  442,  273,  290,  143}, {  472,  482,  157,  370},
-{  415,  321,  372,  385}, {  402,  552,  155,   24}, {  550,  263,  -11,   21},
-{  360,  227,  147, -254}, {  424,   97,  366,  -13}, {  375,  141,  449,  232},
-{  396,  507,  474,  272}, {  701,  324,  362,  -47}, {  587,  148,  543,   69},
-{  400,  -51,  561,   59}, {  220,  -10,  352,  147}, {  206,  211,  653,  185},
-{  563,  297,  565,  284}, {  594,  121,  766,  192}, {  398,  118,  642,  434},
-{  233,  264,  481,  467}, {  129, -165,  699,  239}, {   90,   26,  342,  474},
-{  -55,   27,  388,   94}, { -172,    0,  725,  379}, {  -60,  337,  370,  465},
-{   95,  319,  806,  595}, {   78,  260,  497,  851}, {  210,  560,  458,  574},
-{ -464,  202,  497,  625}, { -202,  152,   48,  712}, {  -20,  566,  100,  715},
-{  455,  468,  411,  605}, {  319,  646,  195,  615}, {  401,  538,  680,  739},
-{  201,  667,  434,  954}, {  454,  425,  646,  491}, {  606,  681,  416,  508},
-{  497,  822,  426,  815}, {  660,  647,  628,  716}, {  697,  466,  618,  457},
-{  685,  460,  365,  309}, {  721,  567,  836,  601}, {  609,  300,  825,  459},
-{  943,  687,  681,  533}, {  915,  598,  591,  243}, {  876,  451,  874,  420},
-{  786,  317,  732,  220}, {  922,  317, 1108,  367}, {  531,  466, 1028,  649},
-{ 1053,  615, 1034,  553}, {  829,  602, 1021,  799}, {  927,  803,  878,  763},
-{  799,  496, 1373,  773}, {  585,  770,  803,  930}, { 1099,  793, 1222,  862},
-{ 1209,  895, 1025,  727}, {  772,  845, 1172, 1115}, {  867, 1021,  830, 1013},
-{  841,  910,  506,  703}, { 1239, 1077,  620,  819}, { 1196, 1083, 1155, 1081},
-{ 1142,  907, 1547, 1121}, { 1309,  648, 1343,  612}, { 1484,  988, 1479,  937},
-{  985, 1328,  955, 1341}, {  429,  910,  841, 1338}, {  564, 1179,  412, 1156},
-{ 1427, 1320, 1434, 1330}, {  640,  760, 1726, 1410}, {  190,  555, 1073, 1005},
-{  426,  257,  839,  980}, {  235,  231, 1520, 1167}, {  109,  293, 1014, 1569},
-{  305,  142, 1148,  539}, { -291, -108, 1213,  972}, {   22, -216,  667,  828},
-{ -482,  438,  453, 1431}, { -581, -422,  789,  387}, { -358, -454,  174,  780},
-{  -36, -372,  390, -134}, { -629,  160, -306,  751}, {-1258, -331,  177,  522},
-{ -248,  574, -251,  639}, { -531,  407, -596,  394}, { -419,  789, -617,  801},
-{ -986,  399, -857,  727}, {   -7,  518, -703,  310}, {-1143,  -24,-1002,  287},
-{ -960,  363,-1299,  312}, {-1534,  245,-1557,  305}, {   28,  153, -859, -175},
-{  -33,  332,-1398, -154}, {  212,  410, -593, -197}, {-1092, -704, -904,  -65},
-{  282,  367, -918, -686}, {  345,   93, -258, -357}, {  696,  644, -693,  -28},
-{  448,  493, -273,  193}, {  527,  546, -243, -513}, {  384, -136,  273, -353},
-{  512, -142,  537, -198}, {  941,  750,   83,  248}, {  578,  861,  -56,  592},
-{  842,   44,  892,   24}, {   33,  890,  -16,  982}, {  831, 1398, 1535, 1898},
-{ 1716, 1376, 1948, 1465}
-};
-
-static const int16_t lsf_5_5[64][4] = {
-{-1002, -929,-1096,-1203}, { -641, -931, -604, -961}, { -779, -673, -835, -788},
-{ -416, -664, -458, -766}, { -652, -521, -662, -495}, {-1023, -509,-1023, -428},
-{ -444, -552, -368, -449}, { -479, -211,-1054, -903}, { -316, -249, -569, -591},
-{ -569, -275, -541, -191}, { -716, -188, -842, -264}, { -333, -248, -318, -228},
-{ -275,    1, -567, -228}, { -115, -221, -238, -374}, { -197, -507, -222, -579},
-{ -258, -432,  -61, -244}, { -345,    2, -338,   39}, { -215, -169,  -58,    0},
-{  -56,   -6, -203, -131}, {    1, -186,   -5, -211}, {    6, -380,   11, -418},
-{ -116,  131, -134,  113}, {   89,   -4,   71,   -2}, {  -19, -192,  262,   24},
-{  189,  151, -133, -109}, {  186, -153,  166, -219}, {   37,  139,  193,  171},
-{  337,  124,  158,  -61}, {  141,  226,  -13,  190}, {  231,   34,  354,  109},
-{  316,  201,  244,  164}, {  330,  -85,  390,  -84}, {  254,  327,  257,  335},
-{  491,  147,  476,  105}, {   54,   77,  437,  370}, {  421,  314,  449,  342},
-{  329,  126,  673,  292}, {  571,  388,  243,  193}, {  653,  320,  621,  280},
-{  194,  380,  517,  581}, {   45,  323,  111,  422}, {  489,  395,  734,  534},
-{  622,  546,  486,  502}, {  318,  572,  189,  550}, {  385,  422, -157,  153},
-{ -125,  382, -197,  386}, { -263,  334,  228,  697}, { -188,    1,   51,  297},
-{ -507,  213, -376,  397}, {  -24,  255, -547,   89}, { -502,  -94,  387,  179},
-{ -620,   68, -684,  112}, { -642, -350, -260,  172}, { -438, -324,  264,  648},
-{ -964,   -4,-1121,    7}, { -134,  134,-1133, -306}, {  143,   96, -420, -497},
-{-1221, -350,-1527, -685}, { -161,   72,  873,  691}, {  732,  283,  921,  353},
-{  334,  475, 1095,  821}, {  864,  524,  843,  497}, {  714,  711,  788,  750},
-{ 1076,  714, 1204,  753}
-};
-
-static const float lsf_3_mean[LP_FILTER_ORDER] = {
-     377.441,  554.688,  922.363, 1339.84, 1702.15,
-    2046.390, 2452.880, 2741.460, 3116.70, 3348.14
-};
-
-static const float lsf_5_mean[LP_FILTER_ORDER] = {
-     337.891,  507.080,  834.961, 1247.07, 1646.00,
-    1982.910, 2407.960, 2708.010, 3104.00, 3344.97
-};
-
-/** Prediction factor table for modes other than 12.2kbit/s */
-static const float pred_fac[LP_FILTER_ORDER] = {
-    0.291626, 0.328644, 0.383636, 0.405640, 0.438873,
-    0.355560, 0.323120, 0.298065, 0.262238, 0.197876,
-};
-
-// fixed tables
-
-/**
- * number of pulses per mode
- */
-static const uint8_t pulses_nb_per_mode[] = {2, 2, 2, 3, 4, 4, 8, 10};
-
-/** track start positions for algebraic code book routines */
-static const uint8_t track_position[16] = {
-    0, 2, 0, 3, 0, 2, 0, 3, 1, 3, 2, 4, 1, 4, 1, 4
-};
-
-/** 3-bit Gray code to binary lookup table */
-static const uint8_t gray_decode[8] = { 0, 5, 15, 10, 25, 30, 20, 35 };
-
-
-// gain tables
-
-/** scalar quantized pitch gain table for 7.95 and 12.2 kbps modes */
-static const uint16_t qua_gain_pit[16] = {
-     0,  3277,  6556,  8192,  9830, 11469, 12288, 13107,
- 13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661
-};
-
-/** scalar quantized fixed gain table for 7.95 and 12.2 kbps modes */
-static const uint16_t qua_gain_code[32] = {
-   159,   206,   268,   349,   419,   482,   554,   637,
-   733,   842,   969,  1114,  1281,  1473,  1694,  1948,
-  2241,  2577,  2963,  3408,  3919,  4507,  5183,  5960,
-  6855,  7883,  9065, 10425, 12510, 16263, 21142, 27485
-};
-
-/** desired mean innovation energy, indexed by active mode */
-static const float energy_mean[8] = {
-    33.0, 33.0, 33.0, 28.75, 30.0, 36.0, 33.0, 36.0
-};
-
-/** 4-tap moving average prediction coefficients in reverse order */
-static const float energy_pred_fac[4] = { 0.19, 0.34, 0.58, 0.68 };
-
-/** gain table for 4.75 kbps mode
- *
- * first index has even/odd indexes for subframes 0,2/1,3
- * second index is {pitch_gain, fixed_gain_factor} */
-static const uint16_t gains_MODE_4k75[512][2] = {
-{  812,  128}, {  542,  140}, { 2873, 1135}, { 2266, 3402}, { 2067,  563},
-{12677,  647}, { 4132, 1798}, { 5601, 5285}, { 7689,  374}, { 3735,  441},
-{10912, 2638}, {11807, 2494}, {20490,  797}, { 5218,  675}, { 6724, 8354},
-{ 5282, 1696}, { 1488,  428}, { 5882,  452}, { 5332, 4072}, { 3583, 1268},
-{ 2469,  901}, {15894, 1005}, {14982, 3271}, {10331, 4858}, { 3635, 2021},
-{ 2596,  835}, {12360, 4892}, {12206, 1704}, {13432, 1604}, { 9118, 2341},
-{ 3968, 1538}, { 5479, 9936}, { 3795,  417}, { 1359,  414}, { 3640, 1569},
-{ 7995, 3541}, {11405,  645}, { 8552,  635}, { 4056, 1377}, {16608, 6124},
-{11420,  700}, { 2007,  607}, {12415, 1578}, {11119, 4654}, {13680, 1708},
-{11990, 1229}, { 7996, 7297}, {13231, 5715}, { 2428, 1159}, { 2073, 1941},
-{ 6218, 6121}, { 3546, 1804}, { 8925, 1802}, { 8679, 1580}, {13935, 3576},
-{13313, 6237}, { 6142, 1130}, { 5994, 1734}, {14141, 4662}, {11271, 3321},
-{12226, 1551}, {13931, 3015}, { 5081,10464}, { 9444, 6706}, { 1689,  683},
-{ 1436, 1306}, { 7212, 3933}, { 4082, 2713}, { 7793,  704}, {15070,  802},
-{ 6299, 5212}, { 4337, 5357}, { 6676,  541}, { 6062,  626}, {13651, 3700},
-{11498, 2408}, {16156,  716}, {12177,  751}, { 8065,11489}, { 6314, 2256},
-{ 4466,  496}, { 7293,  523}, {10213, 3833}, { 8394, 3037}, { 8403,  966},
-{14228, 1880}, { 8703, 5409}, {16395, 4863}, { 7420, 1979}, { 6089, 1230},
-{ 9371, 4398}, {14558, 3363}, {13559, 2873}, {13163, 1465}, { 5534, 1678},
-{13138,14771}, { 7338,  600}, { 1318,  548}, { 4252, 3539}, {10044, 2364},
-{10587,  622}, {13088,  669}, {14126, 3526}, { 5039, 9784}, {15338,  619},
-{ 3115,  590}, {16442, 3013}, {15542, 4168}, {15537, 1611}, {15405, 1228},
-{16023, 9299}, { 7534, 4976}, { 1990, 1213}, {11447, 1157}, {12512, 5519},
-{ 9475, 2644}, { 7716, 2034}, {13280, 2239}, {16011, 5093}, { 8066, 6761},
-{10083, 1413}, { 5002, 2347}, {12523, 5975}, {15126, 2899}, {18264, 2289},
-{15827, 2527}, {16265,10254}, {14651,11319}, { 1797,  337}, { 3115,  397},
-{ 3510, 2928}, { 4592, 2670}, { 7519,  628}, {11415,  656}, { 5946, 2435},
-{ 6544, 7367}, { 8238,  829}, { 4000,  863}, {10032, 2492}, {16057, 3551},
-{18204, 1054}, { 6103, 1454}, { 5884, 7900}, {18752, 3468}, { 1864,  544},
-{ 9198,  683}, {11623, 4160}, { 4594, 1644}, { 3158, 1157}, {15953, 2560},
-{12349, 3733}, {17420, 5260}, { 6106, 2004}, { 2917, 1742}, {16467, 5257},
-{16787, 1680}, {17205, 1759}, { 4773, 3231}, { 7386, 6035}, {14342,10012},
-{ 4035,  442}, { 4194,  458}, { 9214, 2242}, { 7427, 4217}, {12860,  801},
-{11186,  825}, {12648, 2084}, {12956, 6554}, { 9505,  996}, { 6629,  985},
-{10537, 2502}, {15289, 5006}, {12602, 2055}, {15484, 1653}, {16194, 6921},
-{14231, 5790}, { 2626,  828}, { 5615, 1686}, {13663, 5778}, { 3668, 1554},
-{11313, 2633}, { 9770, 1459}, {14003, 4733}, {15897, 6291}, { 6278, 1870},
-{ 7910, 2285}, {16978, 4571}, {16576, 3849}, {15248, 2311}, {16023, 3244},
-{14459,17808}, {11847, 2763}, { 1981, 1407}, { 1400,  876}, { 4335, 3547},
-{ 4391, 4210}, { 5405,  680}, {17461,  781}, { 6501, 5118}, { 8091, 7677},
-{ 7355,  794}, { 8333, 1182}, {15041, 3160}, {14928, 3039}, {20421,  880},
-{14545,  852}, {12337,14708}, { 6904, 1920}, { 4225,  933}, { 8218, 1087},
-{10659, 4084}, {10082, 4533}, { 2735,  840}, {20657, 1081}, {16711, 5966},
-{15873, 4578}, {10871, 2574}, { 3773, 1166}, {14519, 4044}, {20699, 2627},
-{15219, 2734}, {15274, 2186}, { 6257, 3226}, {13125,19480}, { 7196,  930},
-{ 2462, 1618}, { 4515, 3092}, {13852, 4277}, {10460,  833}, {17339,  810},
-{16891, 2289}, {15546, 8217}, {13603, 1684}, { 3197, 1834}, {15948, 2820},
-{15812, 5327}, {17006, 2438}, {16788, 1326}, {15671, 8156}, {11726, 8556},
-{ 3762, 2053}, { 9563, 1317}, {13561, 6790}, {12227, 1936}, { 8180, 3550},
-{13287, 1778}, {16299, 6599}, {16291, 7758}, { 8521, 2551}, { 7225, 2645},
-{18269, 7489}, {16885, 2248}, {17882, 2884}, {17265, 3328}, { 9417,20162},
-{11042, 8320}, { 1286,  620}, { 1431,  583}, { 5993, 2289}, { 3978, 3626},
-{ 5144,  752}, {13409,  830}, { 5553, 2860}, {11764, 5908}, {10737,  560},
-{ 5446,  564}, {13321, 3008}, {11946, 3683}, {19887,  798}, { 9825,  728},
-{13663, 8748}, { 7391, 3053}, { 2515,  778}, { 6050,  833}, { 6469, 5074},
-{ 8305, 2463}, { 6141, 1865}, {15308, 1262}, {14408, 4547}, {13663, 4515},
-{ 3137, 2983}, { 2479, 1259}, {15088, 4647}, {15382, 2607}, {14492, 2392},
-{12462, 2537}, { 7539, 2949}, {12909,12060}, { 5468,  684}, { 3141,  722},
-{ 5081, 1274}, {12732, 4200}, {15302,  681}, { 7819,  592}, { 6534, 2021},
-{16478, 8737}, {13364,  882}, { 5397,  899}, {14656, 2178}, {14741, 4227},
-{14270, 1298}, {13929, 2029}, {15477, 7482}, {15815, 4572}, { 2521, 2013},
-{ 5062, 1804}, { 5159, 6582}, { 7130, 3597}, {10920, 1611}, {11729, 1708},
-{16903, 3455}, {16268, 6640}, { 9306, 1007}, { 9369, 2106}, {19182, 5037},
-{12441, 4269}, {15919, 1332}, {15357, 3512}, {11898,14141}, {16101, 6854},
-{ 2010,  737}, { 3779,  861}, {11454, 2880}, { 3564, 3540}, { 9057, 1241},
-{12391,  896}, { 8546, 4629}, {11561, 5776}, { 8129,  589}, { 8218,  588},
-{18728, 3755}, {12973, 3149}, {15729,  758}, {16634,  754}, {15222,11138},
-{15871, 2208}, { 4673,  610}, {10218,  678}, {15257, 4146}, { 5729, 3327},
-{ 8377, 1670}, {19862, 2321}, {15450, 5511}, {14054, 5481}, { 5728, 2888},
-{ 7580, 1346}, {14384, 5325}, {16236, 3950}, {15118, 3744}, {15306, 1435},
-{14597, 4070}, {12301,15696}, { 7617, 1699}, { 2170,  884}, { 4459, 4567},
-{18094, 3306}, {12742,  815}, {14926,  907}, {15016, 4281}, {15518, 8368},
-{17994, 1087}, { 2358,  865}, {16281, 3787}, {15679, 4596}, {16356, 1534},
-{16584, 2210}, {16833, 9697}, {15929, 4513}, { 3277, 1085}, { 9643, 2187},
-{11973, 6068}, { 9199, 4462}, { 8955, 1629}, {10289, 3062}, {16481, 5155},
-{15466, 7066}, {13678, 2543}, { 5273, 2277}, {16746, 6213}, {16655, 3408},
-{20304, 3363}, {18688, 1985}, {14172,12867}, {15154,15703}, { 4473, 1020},
-{ 1681,  886}, { 4311, 4301}, { 8952, 3657}, { 5893, 1147}, {11647, 1452},
-{15886, 2227}, { 4582, 6644}, { 6929, 1205}, { 6220,  799}, {12415, 3409},
-{15968, 3877}, {19859, 2109}, { 9689, 2141}, {14742, 8830}, {14480, 2599},
-{ 1817, 1238}, { 7771,  813}, {19079, 4410}, { 5554, 2064}, { 3687, 2844},
-{17435, 2256}, {16697, 4486}, {16199, 5388}, { 8028, 2763}, { 3405, 2119},
-{17426, 5477}, {13698, 2786}, {19879, 2720}, { 9098, 3880}, {18172, 4833},
-{17336,12207}, { 5116,  996}, { 4935,  988}, { 9888, 3081}, { 6014, 5371},
-{15881, 1667}, { 8405, 1183}, {15087, 2366}, {19777, 7002}, {11963, 1562},
-{ 7279, 1128}, {16859, 1532}, {15762, 5381}, {14708, 2065}, {20105, 2155},
-{17158, 8245}, {17911, 6318}, { 5467, 1504}, { 4100, 2574}, {17421, 6810},
-{ 5673, 2888}, {16636, 3382}, { 8975, 1831}, {20159, 4737}, {19550, 7294},
-{ 6658, 2781}, {11472, 3321}, {19397, 5054}, {18878, 4722}, {16439, 2373},
-{20430, 4386}, {11353,26526}, {11593, 3068}, { 2866, 1566}, { 5108, 1070},
-{ 9614, 4915}, { 4939, 3536}, { 7541,  878}, {20717,  851}, { 6938, 4395},
-{16799, 7733}, {10137, 1019}, { 9845,  964}, {15494, 3955}, {15459, 3430},
-{18863,  982}, {20120,  963}, {16876,12887}, {14334, 4200}, { 6599, 1220},
-{ 9222,  814}, {16942, 5134}, { 5661, 4898}, { 5488, 1798}, {20258, 3962},
-{17005, 6178}, {17929, 5929}, { 9365, 3420}, { 7474, 1971}, {19537, 5177},
-{19003, 3006}, {16454, 3788}, {16070, 2367}, { 8664, 2743}, { 9445,26358},
-{10856, 1287}, { 3555, 1009}, { 5606, 3622}, {19453, 5512}, {12453,  797},
-{20634,  911}, {15427, 3066}, {17037,10275}, {18883, 2633}, { 3913, 1268},
-{19519, 3371}, {18052, 5230}, {19291, 1678}, {19508, 3172}, {18072,10754},
-{16625, 6845}, { 3134, 2298}, {10869, 2437}, {15580, 6913}, {12597, 3381},
-{11116, 3297}, {16762, 2424}, {18853, 6715}, {17171, 9887}, {12743, 2605},
-{ 8937, 3140}, {19033, 7764}, {18347, 3880}, {20475, 3682}, {19602, 3380},
-{13044,19373}, {10526,23124}
-};
-
-/** gain table for 6.70, 7.40 and 10.2 kbps modes
- *
- * second index is {pitch_gain, fixed_gain_factor} */
-static const uint16_t gains_high[128][2] = {
-{  577,  662}, {  806, 1836}, { 3109, 1052}, { 4181, 1387}, { 2373, 1425},
-{ 3248, 1985}, { 1827, 2320}, {  941, 3314}, { 2351, 2977}, { 3616, 2420},
-{ 3451, 3096}, { 2955, 4301}, { 1848, 4500}, { 3884, 5416}, { 1187, 7210},
-{ 3083, 9000}, { 7384,  883}, { 5962, 1506}, { 5155, 2134}, { 7944, 2009},
-{ 6507, 2250}, { 7670, 2752}, { 5952, 3016}, { 4898, 3764}, { 6989, 3588},
-{ 8174, 3978}, { 6064, 4404}, { 7709, 5087}, { 5523, 6021}, { 7769, 7126},
-{ 6060, 7938}, { 5594,11487}, {10581, 1356}, { 9049, 1597}, { 9794, 2035},
-{ 8946, 2415}, {10296, 2584}, { 9407, 2734}, { 8700, 3218}, { 9757, 3395},
-{10177, 3892}, { 9170, 4528}, {10152, 5004}, { 9114, 5735}, {10500, 6266},
-{10110, 7631}, { 8844, 8727}, { 8956,12496}, {12924,  976}, {11435, 1755},
-{12138, 2328}, {11388, 2368}, {10700, 3064}, {12332, 2861}, {11722, 3327},
-{11270, 3700}, {10861, 4413}, {12082, 4533}, {11283, 5205}, {11960, 6305},
-{11167, 7534}, {12128, 8329}, {10969,10777}, {10300,17376}, {13899, 1681},
-{12580, 2045}, {13265, 2439}, {14033, 2989}, {13452, 3098}, {12396, 3658},
-{13510, 3780}, {12880, 4272}, {13533, 4861}, {12667, 5457}, {13854, 6106},
-{13031, 6483}, {13557, 7721}, {12957, 9311}, {13714,11551}, {12591,15206},
-{15113, 1540}, {15072, 2333}, {14527, 2511}, {14692, 3199}, {15382, 3560},
-{14133, 3960}, {15102, 4236}, {14332, 4824}, {14846, 5451}, {15306, 6083},
-{14329, 6888}, {15060, 7689}, {14406, 9426}, {15387, 9741}, {14824,14271},
-{13600,24939}, {16396, 1969}, {16817, 2832}, {15713, 2843}, {16104, 3336},
-{16384, 3963}, {16940, 4579}, {15711, 4599}, {16222, 5448}, {16832, 6382},
-{15745, 7141}, {16326, 7469}, {16611, 8624}, {17028,10418}, {15905,11817},
-{16878,14690}, {16515,20870}, {18142, 2083}, {19401, 3178}, {17508, 3426},
-{20054, 4027}, {18069, 4249}, {18952, 5066}, {17711, 5402}, {19835, 6192},
-{17950, 7014}, {21318, 7877}, {17910, 9289}, {19144, 9290}, {20517,11381},
-{18075,14485}, {19999,17882}, {18842,32764}
-};
-
-/** gain table for 5.15 and 5.90 kbps modes
- *
- * second index is {pitch_gain, fixed_gain_factor} */
-static const uint16_t gains_low[64][2] = {
-{10813,28753}, {20480, 2785}, {18841, 6594}, { 6225, 7413}, {17203,10444},
-{21626, 1269}, {21135, 4423}, {11304, 1556}, {19005,12820}, {17367, 2498},
-{17858, 4833}, { 9994, 2498}, {17530, 7864}, {14254, 1884}, {15892, 3153},
-{ 6717, 1802}, {18186,20193}, {18022, 3031}, {16711, 5857}, { 8847, 4014},
-{15892, 8970}, {18022, 1392}, {16711, 4096}, { 8192,  655}, {15237,13926},
-{14254, 3112}, {14090, 4669}, { 5406, 2703}, {13434, 6553}, {12451,  901},
-{12451, 2662}, { 3768,  655}, {14745,23511}, {19169, 2457}, {20152, 5079},
-{ 6881, 4096}, {20480, 8560}, {19660,  737}, {19005, 4259}, { 7864, 2088},
-{11468,12288}, {15892, 1474}, {15728, 4628}, { 9175, 1433}, {16056, 7004},
-{14827,  737}, {15073, 2252}, { 5079, 1228}, {13271,17326}, {16547, 2334},
-{15073, 5816}, { 3932, 3686}, {14254, 8601}, {16875,  778}, {15073, 3809},
-{ 6062,  614}, { 9338, 9256}, {13271, 1761}, {13271, 3522}, { 2457, 1966},
-{11468, 5529}, {10485,  737}, {11632, 3194}, { 1474,  778}
-};
-
-
-// pre-processing tables
-
-/** impulse response filter tables converted to float from Q15 int32_t
- * used for anti-sparseness processing */
-static const float ir_filter_strong_MODE_7k95[AMR_SUBFRAME_SIZE] = {
- 0.817169,  0.024445,  0.076447, -0.020844, -0.042175,  0.017761,  0.018433,
--0.038879,  0.107147, -0.179871,  0.138367, -0.015228, -0.059204,  0.091888,
--0.154358,  0.171326, -0.060730, -0.032379, -0.044525,  0.135559, -0.021362,
--0.162811,  0.140656,  0.013794, -0.017975, -0.102295,  0.090118,  0.038666,
--0.036987, -0.079041,  0.052826,  0.112000, -0.136566, -0.029755,  0.134003,
--0.077423,  0.028961, -0.041595, -0.029877,  0.174988,
-};
-
-static const float ir_filter_strong[AMR_SUBFRAME_SIZE] = {
- 0.448303,  0.351501,  0.038696, -0.084259, -0.173065,  0.229309, -0.001068,
--0.085663, -0.092773,  0.147186,  0.090088, -0.257080,  0.115509,  0.044403,
- 0.066498, -0.263580,  0.245697, -0.064178, -0.044373,  0.023712,  0.033813,
--0.072784,  0.068787, -0.011078, -0.020569, -0.064178,  0.184509, -0.173370,
- 0.032715,  0.095306, -0.154358,  0.162109, -0.071075, -0.113770,  0.211304,
--0.118683,  0.020599, -0.054169,  0.000885,  0.309601,
-};
-
-static const float ir_filter_medium[AMR_SUBFRAME_SIZE] = {
- 0.923889,  0.116913, -0.123169,  0.090698, -0.031982, -0.030579,  0.075592,
--0.092865,  0.085907, -0.068085,  0.053497, -0.049164,  0.052307, -0.054169,
- 0.047089, -0.030762,  0.013092, -0.005157,  0.014404, -0.038574,  0.066406,
--0.082581,  0.076996, -0.049469,  0.010498,  0.025208, -0.046661,  0.052612,
--0.050568,  0.051910, -0.062958,  0.080688, -0.093384,  0.088409, -0.060364,
- 0.016998,  0.023804, -0.041779,  0.025696,  0.019989,
-};
-
-static const float *ir_filters_lookup[2]           = {
-    ir_filter_strong,           ir_filter_medium
-};
-static const float *ir_filters_lookup_MODE_7k95[2] = {
-    ir_filter_strong_MODE_7k95, ir_filter_medium
-};
-
-// High-pass coefficients
-
-static const float highpass_zeros[2] = { -2.0, 1.0 };
-static const float highpass_poles[2] = { -1.933105469, 0.935913085 };
-static const float highpass_gain     = 0.939819335;
-
-#endif /* AVCODEC_AMRNBDATA_H */
-
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
deleted file mode 100644
index d3fa765..0000000
--- a/libavcodec/amrnbdec.c
+++ /dev/null
@@ -1,1076 +0,0 @@
-/*
- * AMR narrowband decoder
- * Copyright (c) 2006-2007 Robert Swain
- * Copyright (c) 2009 Colin McQuillan
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-/**
- * @file
- * AMR narrowband decoder
- *
- * This decoder uses floats for simplicity and so is not bit-exact. One
- * difference is that differences in phase can accumulate. The test sequences
- * in 3GPP TS 26.074 can still be useful.
- *
- * - Comparing this file's output to the output of the ref decoder gives a
- *   PSNR of 30 to 80. Plotting the output samples shows a difference in
- *   phase in some areas.
- *
- * - Comparing both decoders against their input, this decoder gives a similar
- *   PSNR. If the test sequence homing frames are removed (this decoder does
- *   not detect them), the PSNR is at least as good as the reference on 140
- *   out of 169 tests.
- */
-
-
-#include <string.h>
-#include <math.h>
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "libavutil/common.h"
-#include "celp_math.h"
-#include "celp_filters.h"
-#include "acelp_filters.h"
-#include "acelp_vectors.h"
-#include "acelp_pitch_delay.h"
-#include "lsp.h"
-
-#include "amrnbdata.h"
-
-#define AMR_BLOCK_SIZE              160   ///< samples per frame
-#define AMR_SAMPLE_BOUND        32768.0   ///< threshold for synthesis overflow
-
-/**
- * Scale from constructed speech to [-1,1]
- *
- * AMR is designed to produce 16-bit PCM samples (3GPP TS 26.090 4.2) but
- * upscales by two (section 6.2.2).
- *
- * Fundamentally, this scale is determined by energy_mean through
- * the fixed vector contribution to the excitation vector.
- */
-#define AMR_SAMPLE_SCALE  (2.0 / 32768.0)
-
-/** Prediction factor for 12.2kbit/s mode */
-#define PRED_FAC_MODE_12k2             0.65
-
-#define LSF_R_FAC          (8000.0 / 32768.0) ///< LSF residual tables to Hertz
-#define MIN_LSF_SPACING    (50.0488 / 8000.0) ///< Ensures stability of LPC filter
-#define PITCH_LAG_MIN_MODE_12k2          18   ///< Lower bound on decoded lag search in 12.2kbit/s mode
-
-/** Initial energy in dB. Also used for bad frames (unimplemented). */
-#define MIN_ENERGY -14.0
-
-/** Maximum sharpening factor
- *
- * The specification says 0.8, which should be 13107, but the reference C code
- * uses 13017 instead. (Amusingly the same applies to SHARP_MAX in g729dec.c.)
- */
-#define SHARP_MAX 0.79449462890625
-
-/** Number of impulse response coefficients used for tilt factor */
-#define AMR_TILT_RESPONSE   22
-/** Tilt factor = 1st reflection coefficient * gamma_t */
-#define AMR_TILT_GAMMA_T   0.8
-/** Adaptive gain control factor used in post-filter */
-#define AMR_AGC_ALPHA      0.9
-
-typedef struct AMRContext {
-    AMRNBFrame                        frame; ///< decoded AMR parameters (lsf coefficients, codebook indexes, etc)
-    uint8_t             bad_frame_indicator; ///< bad frame ? 1 : 0
-    enum Mode                cur_frame_mode;
-
-    int16_t     prev_lsf_r[LP_FILTER_ORDER]; ///< residual LSF vector from previous subframe
-    double          lsp[4][LP_FILTER_ORDER]; ///< lsp vectors from current frame
-    double   prev_lsp_sub4[LP_FILTER_ORDER]; ///< lsp vector for the 4th subframe of the previous frame
-
-    float         lsf_q[4][LP_FILTER_ORDER]; ///< Interpolated LSF vector for fixed gain smoothing
-    float          lsf_avg[LP_FILTER_ORDER]; ///< vector of averaged lsf vector
-
-    float           lpc[4][LP_FILTER_ORDER]; ///< lpc coefficient vectors for 4 subframes
-
-    uint8_t                   pitch_lag_int; ///< integer part of pitch lag from current subframe
-
-    float excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1 + AMR_SUBFRAME_SIZE]; ///< current excitation and all necessary excitation history
-    float                       *excitation; ///< pointer to the current excitation vector in excitation_buf
-
-    float   pitch_vector[AMR_SUBFRAME_SIZE]; ///< adaptive code book (pitch) vector
-    float   fixed_vector[AMR_SUBFRAME_SIZE]; ///< algebraic codebook (fixed) vector (must be kept zero between frames)
-
-    float               prediction_error[4]; ///< quantified prediction errors {20log10(^gamma_gc)} for previous four subframes
-    float                     pitch_gain[5]; ///< quantified pitch gains for the current and previous four subframes
-    float                     fixed_gain[5]; ///< quantified fixed gains for the current and previous four subframes
-
-    float                              beta; ///< previous pitch_gain, bounded by [0.0,SHARP_MAX]
-    uint8_t                      diff_count; ///< the number of subframes for which diff has been above 0.65
-    uint8_t                      hang_count; ///< the number of subframes since a hangover period started
-
-    float            prev_sparse_fixed_gain; ///< previous fixed gain; used by anti-sparseness processing to determine "onset"
-    uint8_t               prev_ir_filter_nr; ///< previous impulse response filter "impNr": 0 - strong, 1 - medium, 2 - none
-    uint8_t                 ir_filter_onset; ///< flag for impulse response filter strength
-
-    float                postfilter_mem[10]; ///< previous intermediate values in the formant filter
-    float                          tilt_mem; ///< previous input to tilt compensation filter
-    float                    postfilter_agc; ///< previous factor used for adaptive gain control
-    float                  high_pass_mem[2]; ///< previous intermediate values in the high-pass filter
-
-    float samples_in[LP_FILTER_ORDER + AMR_SUBFRAME_SIZE]; ///< floating point samples
-
-} AMRContext;
-
-/** Double version of ff_weighted_vector_sumf() */
-static void weighted_vector_sumd(double *out, const double *in_a,
-                                 const double *in_b, double weight_coeff_a,
-                                 double weight_coeff_b, int length)
-{
-    int i;
-
-    for (i = 0; i < length; i++)
-        out[i] = weight_coeff_a * in_a[i]
-               + weight_coeff_b * in_b[i];
-}
-
-static av_cold int amrnb_decode_init(AVCodecContext *avctx)
-{
-    AMRContext *p = avctx->priv_data;
-    int i;
-
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
-
-    // p->excitation always points to the same position in p->excitation_buf
-    p->excitation = &p->excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1];
-
-    for (i = 0; i < LP_FILTER_ORDER; i++) {
-        p->prev_lsp_sub4[i] =    lsp_sub4_init[i] * 1000 / (float)(1 << 15);
-        p->lsf_avg[i] = p->lsf_q[3][i] = lsp_avg_init[i] / (float)(1 << 15);
-    }
-
-    for (i = 0; i < 4; i++)
-        p->prediction_error[i] = MIN_ENERGY;
-
-    return 0;
-}
-
-
-/**
- * Unpack an RFC4867 speech frame into the AMR frame mode and parameters.
- *
- * The order of speech bits is specified by 3GPP TS 26.101.
- *
- * @param p the context
- * @param buf               pointer to the input buffer
- * @param buf_size          size of the input buffer
- *
- * @return the frame mode
- */
-static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf,
-                                  int buf_size)
-{
-    GetBitContext gb;
-    enum Mode mode;
-
-    init_get_bits(&gb, buf, buf_size * 8);
-
-    // Decode the first octet.
-    skip_bits(&gb, 1);                        // padding bit
-    mode = get_bits(&gb, 4);                  // frame type
-    p->bad_frame_indicator = !get_bits1(&gb); // quality bit
-    skip_bits(&gb, 2);                        // two padding bits
-
-    if (mode < MODE_DTX) {
-        uint16_t *data = (uint16_t *)&p->frame;
-        const uint8_t *order = amr_unpacking_bitmaps_per_mode[mode];
-        int field_size;
-
-        memset(&p->frame, 0, sizeof(AMRNBFrame));
-        buf++;
-        while ((field_size = *order++)) {
-            int field = 0;
-            int field_offset = *order++;
-            while (field_size--) {
-               int bit = *order++;
-               field <<= 1;
-               field |= buf[bit >> 3] >> (bit & 7) & 1;
-            }
-            data[field_offset] = field;
-        }
-    }
-
-    return mode;
-}
-
-
-/// @defgroup amr_lpc_decoding AMR pitch LPC coefficient decoding functions
-/// @{
-
-/**
- * Convert an lsf vector into an lsp vector.
- *
- * @param lsf               input lsf vector
- * @param lsp               output lsp vector
- */
-static void lsf2lsp(const float *lsf, double *lsp)
-{
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        lsp[i] = cos(2.0 * M_PI * lsf[i]);
-}
-
-/**
- * Interpolate the LSF vector (used for fixed gain smoothing).
- * The interpolation is done over all four subframes even in MODE_12k2.
- *
- * @param[in,out] lsf_q     LSFs in [0,1] for each subframe
- * @param[in]     lsf_new   New LSFs in [0,1] for subframe 4
- */
-static void interpolate_lsf(float lsf_q[4][LP_FILTER_ORDER], float *lsf_new)
-{
-    int i;
-
-    for (i = 0; i < 4; i++)
-        ff_weighted_vector_sumf(lsf_q[i], lsf_q[3], lsf_new,
-                                0.25 * (3 - i), 0.25 * (i + 1),
-                                LP_FILTER_ORDER);
-}
-
-/**
- * Decode a set of 5 split-matrix quantized lsf indexes into an lsp vector.
- *
- * @param p the context
- * @param lsp output LSP vector
- * @param lsf_no_r LSF vector without the residual vector added
- * @param lsf_quantizer pointers to LSF dictionary tables
- * @param quantizer_offset offset in tables
- * @param sign for the 3 dictionary table
- * @param update store data for computing the next frame's LSFs
- */
-static void lsf2lsp_for_mode12k2(AMRContext *p, double lsp[LP_FILTER_ORDER],
-                                 const float lsf_no_r[LP_FILTER_ORDER],
-                                 const int16_t *lsf_quantizer[5],
-                                 const int quantizer_offset,
-                                 const int sign, const int update)
-{
-    int16_t lsf_r[LP_FILTER_ORDER]; // residual LSF vector
-    float lsf_q[LP_FILTER_ORDER]; // quantified LSF vector
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER >> 1; i++)
-        memcpy(&lsf_r[i << 1], &lsf_quantizer[i][quantizer_offset],
-               2 * sizeof(*lsf_r));
-
-    if (sign) {
-        lsf_r[4] *= -1;
-        lsf_r[5] *= -1;
-    }
-
-    if (update)
-        memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(float));
-
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        lsf_q[i] = lsf_r[i] * (LSF_R_FAC / 8000.0) + lsf_no_r[i] * (1.0 / 8000.0);
-
-    ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER);
-
-    if (update)
-        interpolate_lsf(p->lsf_q, lsf_q);
-
-    lsf2lsp(lsf_q, lsp);
-}
-
-/**
- * Decode a set of 5 split-matrix quantized lsf indexes into 2 lsp vectors.
- *
- * @param p                 pointer to the AMRContext
- */
-static void lsf2lsp_5(AMRContext *p)
-{
-    const uint16_t *lsf_param = p->frame.lsf;
-    float lsf_no_r[LP_FILTER_ORDER]; // LSFs without the residual vector
-    const int16_t *lsf_quantizer[5];
-    int i;
-
-    lsf_quantizer[0] = lsf_5_1[lsf_param[0]];
-    lsf_quantizer[1] = lsf_5_2[lsf_param[1]];
-    lsf_quantizer[2] = lsf_5_3[lsf_param[2] >> 1];
-    lsf_quantizer[3] = lsf_5_4[lsf_param[3]];
-    lsf_quantizer[4] = lsf_5_5[lsf_param[4]];
-
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        lsf_no_r[i] = p->prev_lsf_r[i] * LSF_R_FAC * PRED_FAC_MODE_12k2 + lsf_5_mean[i];
-
-    lsf2lsp_for_mode12k2(p, p->lsp[1], lsf_no_r, lsf_quantizer, 0, lsf_param[2] & 1, 0);
-    lsf2lsp_for_mode12k2(p, p->lsp[3], lsf_no_r, lsf_quantizer, 2, lsf_param[2] & 1, 1);
-
-    // interpolate LSP vectors at subframes 1 and 3
-    weighted_vector_sumd(p->lsp[0], p->prev_lsp_sub4, p->lsp[1], 0.5, 0.5, LP_FILTER_ORDER);
-    weighted_vector_sumd(p->lsp[2], p->lsp[1]       , p->lsp[3], 0.5, 0.5, LP_FILTER_ORDER);
-}
-
-/**
- * Decode a set of 3 split-matrix quantized lsf indexes into an lsp vector.
- *
- * @param p                 pointer to the AMRContext
- */
-static void lsf2lsp_3(AMRContext *p)
-{
-    const uint16_t *lsf_param = p->frame.lsf;
-    int16_t lsf_r[LP_FILTER_ORDER]; // residual LSF vector
-    float lsf_q[LP_FILTER_ORDER]; // quantified LSF vector
-    const int16_t *lsf_quantizer;
-    int i, j;
-
-    lsf_quantizer = (p->cur_frame_mode == MODE_7k95 ? lsf_3_1_MODE_7k95 : lsf_3_1)[lsf_param[0]];
-    memcpy(lsf_r, lsf_quantizer, 3 * sizeof(*lsf_r));
-
-    lsf_quantizer = lsf_3_2[lsf_param[1] << (p->cur_frame_mode <= MODE_5k15)];
-    memcpy(lsf_r + 3, lsf_quantizer, 3 * sizeof(*lsf_r));
-
-    lsf_quantizer = (p->cur_frame_mode <= MODE_5k15 ? lsf_3_3_MODE_5k15 : lsf_3_3)[lsf_param[2]];
-    memcpy(lsf_r + 6, lsf_quantizer, 4 * sizeof(*lsf_r));
-
-    // calculate mean-removed LSF vector and add mean
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        lsf_q[i] = (lsf_r[i] + p->prev_lsf_r[i] * pred_fac[i]) * (LSF_R_FAC / 8000.0) + lsf_3_mean[i] * (1.0 / 8000.0);
-
-    ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER);
-
-    // store data for computing the next frame's LSFs
-    interpolate_lsf(p->lsf_q, lsf_q);
-    memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r));
-
-    lsf2lsp(lsf_q, p->lsp[3]);
-
-    // interpolate LSP vectors at subframes 1, 2 and 3
-    for (i = 1; i <= 3; i++)
-        for(j = 0; j < LP_FILTER_ORDER; j++)
-            p->lsp[i-1][j] = p->prev_lsp_sub4[j] +
-                (p->lsp[3][j] - p->prev_lsp_sub4[j]) * 0.25 * i;
-}
-
-/// @}
-
-
-/// @defgroup amr_pitch_vector_decoding AMR pitch vector decoding functions
-/// @{
-
-/**
- * Like ff_decode_pitch_lag(), but with 1/6 resolution
- */
-static void decode_pitch_lag_1_6(int *lag_int, int *lag_frac, int pitch_index,
-                                 const int prev_lag_int, const int subframe)
-{
-    if (subframe == 0 || subframe == 2) {
-        if (pitch_index < 463) {
-            *lag_int  = (pitch_index + 107) * 10923 >> 16;
-            *lag_frac = pitch_index - *lag_int * 6 + 105;
-        } else {
-            *lag_int  = pitch_index - 368;
-            *lag_frac = 0;
-        }
-    } else {
-        *lag_int  = ((pitch_index + 5) * 10923 >> 16) - 1;
-        *lag_frac = pitch_index - *lag_int * 6 - 3;
-        *lag_int += av_clip(prev_lag_int - 5, PITCH_LAG_MIN_MODE_12k2,
-                            PITCH_DELAY_MAX - 9);
-    }
-}
-
-static void decode_pitch_vector(AMRContext *p,
-                                const AMRNBSubframe *amr_subframe,
-                                const int subframe)
-{
-    int pitch_lag_int, pitch_lag_frac;
-    enum Mode mode = p->cur_frame_mode;
-
-    if (p->cur_frame_mode == MODE_12k2) {
-        decode_pitch_lag_1_6(&pitch_lag_int, &pitch_lag_frac,
-                             amr_subframe->p_lag, p->pitch_lag_int,
-                             subframe);
-    } else
-        ff_decode_pitch_lag(&pitch_lag_int, &pitch_lag_frac,
-                            amr_subframe->p_lag,
-                            p->pitch_lag_int, subframe,
-                            mode != MODE_4k75 && mode != MODE_5k15,
-                            mode <= MODE_6k7 ? 4 : (mode == MODE_7k95 ? 5 : 6));
-
-    p->pitch_lag_int = pitch_lag_int; // store previous lag in a uint8_t
-
-    pitch_lag_frac <<= (p->cur_frame_mode != MODE_12k2);
-
-    pitch_lag_int += pitch_lag_frac > 0;
-
-    /* Calculate the pitch vector by interpolating the past excitation at the
-       pitch lag using a b60 hamming windowed sinc function.   */
-    ff_acelp_interpolatef(p->excitation, p->excitation + 1 - pitch_lag_int,
-                          ff_b60_sinc, 6,
-                          pitch_lag_frac + 6 - 6*(pitch_lag_frac > 0),
-                          10, AMR_SUBFRAME_SIZE);
-
-    memcpy(p->pitch_vector, p->excitation, AMR_SUBFRAME_SIZE * sizeof(float));
-}
-
-/// @}
-
-
-/// @defgroup amr_algebraic_code_book AMR algebraic code book (fixed) vector decoding functions
-/// @{
-
-/**
- * Decode a 10-bit algebraic codebook index from a 10.2 kbit/s frame.
- */
-static void decode_10bit_pulse(int code, int pulse_position[8],
-                               int i1, int i2, int i3)
-{
-    // coded using 7+3 bits with the 3 LSBs being, individually, the LSB of 1 of
-    // the 3 pulses and the upper 7 bits being coded in base 5
-    const uint8_t *positions = base_five_table[code >> 3];
-    pulse_position[i1] = (positions[2] << 1) + ( code       & 1);
-    pulse_position[i2] = (positions[1] << 1) + ((code >> 1) & 1);
-    pulse_position[i3] = (positions[0] << 1) + ((code >> 2) & 1);
-}
-
-/**
- * Decode the algebraic codebook index to pulse positions and signs and
- * construct the algebraic codebook vector for MODE_10k2.
- *
- * @param fixed_index          positions of the eight pulses
- * @param fixed_sparse         pointer to the algebraic codebook vector
- */
-static void decode_8_pulses_31bits(const int16_t *fixed_index,
-                                   AMRFixed *fixed_sparse)
-{
-    int pulse_position[8];
-    int i, temp;
-
-    decode_10bit_pulse(fixed_index[4], pulse_position, 0, 4, 1);
-    decode_10bit_pulse(fixed_index[5], pulse_position, 2, 6, 5);
-
-    // coded using 5+2 bits with the 2 LSBs being, individually, the LSB of 1 of
-    // the 2 pulses and the upper 5 bits being coded in base 5
-    temp = ((fixed_index[6] >> 2) * 25 + 12) >> 5;
-    pulse_position[3] = temp % 5;
-    pulse_position[7] = temp / 5;
-    if (pulse_position[7] & 1)
-        pulse_position[3] = 4 - pulse_position[3];
-    pulse_position[3] = (pulse_position[3] << 1) + ( fixed_index[6]       & 1);
-    pulse_position[7] = (pulse_position[7] << 1) + ((fixed_index[6] >> 1) & 1);
-
-    fixed_sparse->n = 8;
-    for (i = 0; i < 4; i++) {
-        const int pos1   = (pulse_position[i]     << 2) + i;
-        const int pos2   = (pulse_position[i + 4] << 2) + i;
-        const float sign = fixed_index[i] ? -1.0 : 1.0;
-        fixed_sparse->x[i    ] = pos1;
-        fixed_sparse->x[i + 4] = pos2;
-        fixed_sparse->y[i    ] = sign;
-        fixed_sparse->y[i + 4] = pos2 < pos1 ? -sign : sign;
-    }
-}
-
-/**
- * Decode the algebraic codebook index to pulse positions and signs,
- * then construct the algebraic codebook vector.
- *
- *                              nb of pulses | bits encoding pulses
- * For MODE_4k75 or MODE_5k15,             2 | 1-3, 4-6, 7
- *                  MODE_5k9,              2 | 1,   2-4, 5-6, 7-9
- *                  MODE_6k7,              3 | 1-3, 4,   5-7, 8,  9-11
- *      MODE_7k4 or MODE_7k95,             4 | 1-3, 4-6, 7-9, 10, 11-13
- *
- * @param fixed_sparse pointer to the algebraic codebook vector
- * @param pulses       algebraic codebook indexes
- * @param mode         mode of the current frame
- * @param subframe     current subframe number
- */
-static void decode_fixed_sparse(AMRFixed *fixed_sparse, const uint16_t *pulses,
-                                const enum Mode mode, const int subframe)
-{
-    assert(MODE_4k75 <= mode && mode <= MODE_12k2);
-
-    if (mode == MODE_12k2) {
-        ff_decode_10_pulses_35bits(pulses, fixed_sparse, gray_decode, 5, 3);
-    } else if (mode == MODE_10k2) {
-        decode_8_pulses_31bits(pulses, fixed_sparse);
-    } else {
-        int *pulse_position = fixed_sparse->x;
-        int i, pulse_subset;
-        const int fixed_index = pulses[0];
-
-        if (mode <= MODE_5k15) {
-            pulse_subset      = ((fixed_index >> 3) & 8)     + (subframe << 1);
-            pulse_position[0] = ( fixed_index       & 7) * 5 + track_position[pulse_subset];
-            pulse_position[1] = ((fixed_index >> 3) & 7) * 5 + track_position[pulse_subset + 1];
-            fixed_sparse->n = 2;
-        } else if (mode == MODE_5k9) {
-            pulse_subset      = ((fixed_index & 1) << 1) + 1;
-            pulse_position[0] = ((fixed_index >> 1) & 7) * 5 + pulse_subset;
-            pulse_subset      = (fixed_index  >> 4) & 3;
-            pulse_position[1] = ((fixed_index >> 6) & 7) * 5 + pulse_subset + (pulse_subset == 3 ? 1 : 0);
-            fixed_sparse->n = pulse_position[0] == pulse_position[1] ? 1 : 2;
-        } else if (mode == MODE_6k7) {
-            pulse_position[0] = (fixed_index        & 7) * 5;
-            pulse_subset      = (fixed_index  >> 2) & 2;
-            pulse_position[1] = ((fixed_index >> 4) & 7) * 5 + pulse_subset + 1;
-            pulse_subset      = (fixed_index  >> 6) & 2;
-            pulse_position[2] = ((fixed_index >> 8) & 7) * 5 + pulse_subset + 2;
-            fixed_sparse->n = 3;
-        } else { // mode <= MODE_7k95
-            pulse_position[0] = gray_decode[ fixed_index        & 7];
-            pulse_position[1] = gray_decode[(fixed_index >> 3)  & 7] + 1;
-            pulse_position[2] = gray_decode[(fixed_index >> 6)  & 7] + 2;
-            pulse_subset      = (fixed_index >> 9) & 1;
-            pulse_position[3] = gray_decode[(fixed_index >> 10) & 7] + pulse_subset + 3;
-            fixed_sparse->n = 4;
-        }
-        for (i = 0; i < fixed_sparse->n; i++)
-            fixed_sparse->y[i] = (pulses[1] >> i) & 1 ? 1.0 : -1.0;
-    }
-}
-
-/**
- * Apply pitch lag to obtain the sharpened fixed vector (section 6.1.2)
- *
- * @param p the context
- * @param subframe unpacked amr subframe
- * @param mode mode of the current frame
- * @param fixed_sparse sparse respresentation of the fixed vector
- */
-static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode,
-                             AMRFixed *fixed_sparse)
-{
-    // The spec suggests the current pitch gain is always used, but in other
-    // modes the pitch and codebook gains are joinly quantized (sec 5.8.2)
-    // so the codebook gain cannot depend on the quantized pitch gain.
-    if (mode == MODE_12k2)
-        p->beta = FFMIN(p->pitch_gain[4], 1.0);
-
-    fixed_sparse->pitch_lag  = p->pitch_lag_int;
-    fixed_sparse->pitch_fac  = p->beta;
-
-    // Save pitch sharpening factor for the next subframe
-    // MODE_4k75 only updates on the 2nd and 4th subframes - this follows from
-    // the fact that the gains for two subframes are jointly quantized.
-    if (mode != MODE_4k75 || subframe & 1)
-        p->beta = av_clipf(p->pitch_gain[4], 0.0, SHARP_MAX);
-}
-/// @}
-
-
-/// @defgroup amr_gain_decoding AMR gain decoding functions
-/// @{
-
-/**
- * fixed gain smoothing
- * Note that where the spec specifies the "spectrum in the q domain"
- * in section 6.1.4, in fact frequencies should be used.
- *
- * @param p the context
- * @param lsf LSFs for the current subframe, in the range [0,1]
- * @param lsf_avg averaged LSFs
- * @param mode mode of the current frame
- *
- * @return fixed gain smoothed
- */
-static float fixed_gain_smooth(AMRContext *p , const float *lsf,
-                               const float *lsf_avg, const enum Mode mode)
-{
-    float diff = 0.0;
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        diff += fabs(lsf_avg[i] - lsf[i]) / lsf_avg[i];
-
-    // If diff is large for ten subframes, disable smoothing for a 40-subframe
-    // hangover period.
-    p->diff_count++;
-    if (diff <= 0.65)
-        p->diff_count = 0;
-
-    if (p->diff_count > 10) {
-        p->hang_count = 0;
-        p->diff_count--; // don't let diff_count overflow
-    }
-
-    if (p->hang_count < 40) {
-        p->hang_count++;
-    } else if (mode < MODE_7k4 || mode == MODE_10k2) {
-        const float smoothing_factor = av_clipf(4.0 * diff - 1.6, 0.0, 1.0);
-        const float fixed_gain_mean = (p->fixed_gain[0] + p->fixed_gain[1] +
-                                       p->fixed_gain[2] + p->fixed_gain[3] +
-                                       p->fixed_gain[4]) * 0.2;
-        return smoothing_factor * p->fixed_gain[4] +
-               (1.0 - smoothing_factor) * fixed_gain_mean;
-    }
-    return p->fixed_gain[4];
-}
-
-/**
- * Decode pitch gain and fixed gain factor (part of section 6.1.3).
- *
- * @param p the context
- * @param amr_subframe unpacked amr subframe
- * @param mode mode of the current frame
- * @param subframe current subframe number
- * @param fixed_gain_factor decoded gain correction factor
- */
-static void decode_gains(AMRContext *p, const AMRNBSubframe *amr_subframe,
-                         const enum Mode mode, const int subframe,
-                         float *fixed_gain_factor)
-{
-    if (mode == MODE_12k2 || mode == MODE_7k95) {
-        p->pitch_gain[4]   = qua_gain_pit [amr_subframe->p_gain    ]
-            * (1.0 / 16384.0);
-        *fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain]
-            * (1.0 /  2048.0);
-    } else {
-        const uint16_t *gains;
-
-        if (mode >= MODE_6k7) {
-            gains = gains_high[amr_subframe->p_gain];
-        } else if (mode >= MODE_5k15) {
-            gains = gains_low [amr_subframe->p_gain];
-        } else {
-            // gain index is only coded in subframes 0,2 for MODE_4k75
-            gains = gains_MODE_4k75[(p->frame.subframe[subframe & 2].p_gain << 1) + (subframe & 1)];
-        }
-
-        p->pitch_gain[4]   = gains[0] * (1.0 / 16384.0);
-        *fixed_gain_factor = gains[1] * (1.0 /  4096.0);
-    }
-}
-
-/// @}
-
-
-/// @defgroup amr_pre_processing AMR pre-processing functions
-/// @{
-
-/**
- * Circularly convolve a sparse fixed vector with a phase dispersion impulse
- * response filter (D.6.2 of G.729 and 6.1.5 of AMR).
- *
- * @param out vector with filter applied
- * @param in source vector
- * @param filter phase filter coefficients
- *
- *  out[n] = sum(i,0,len-1){ in[i] * filter[(len + n - i)%len] }
- */
-static void apply_ir_filter(float *out, const AMRFixed *in,
-                            const float *filter)
-{
-    float filter1[AMR_SUBFRAME_SIZE],     //!< filters at pitch lag*1 and *2
-          filter2[AMR_SUBFRAME_SIZE];
-    int   lag = in->pitch_lag;
-    float fac = in->pitch_fac;
-    int i;
-
-    if (lag < AMR_SUBFRAME_SIZE) {
-        ff_celp_circ_addf(filter1, filter, filter, lag, fac,
-                          AMR_SUBFRAME_SIZE);
-
-        if (lag < AMR_SUBFRAME_SIZE >> 1)
-            ff_celp_circ_addf(filter2, filter, filter1, lag, fac,
-                              AMR_SUBFRAME_SIZE);
-    }
-
-    memset(out, 0, sizeof(float) * AMR_SUBFRAME_SIZE);
-    for (i = 0; i < in->n; i++) {
-        int   x = in->x[i];
-        float y = in->y[i];
-        const float *filterp;
-
-        if (x >= AMR_SUBFRAME_SIZE - lag) {
-            filterp = filter;
-        } else if (x >= AMR_SUBFRAME_SIZE - (lag << 1)) {
-            filterp = filter1;
-        } else
-            filterp = filter2;
-
-        ff_celp_circ_addf(out, out, filterp, x, y, AMR_SUBFRAME_SIZE);
-    }
-}
-
-/**
- * Reduce fixed vector sparseness by smoothing with one of three IR filters.
- * Also know as "adaptive phase dispersion".
- *
- * This implements 3GPP TS 26.090 section 6.1(5).
- *
- * @param p the context
- * @param fixed_sparse algebraic codebook vector
- * @param fixed_vector unfiltered fixed vector
- * @param fixed_gain smoothed gain
- * @param out space for modified vector if necessary
- */
-static const float *anti_sparseness(AMRContext *p, AMRFixed *fixed_sparse,
-                                    const float *fixed_vector,
-                                    float fixed_gain, float *out)
-{
-    int ir_filter_nr;
-
-    if (p->pitch_gain[4] < 0.6) {
-        ir_filter_nr = 0;      // strong filtering
-    } else if (p->pitch_gain[4] < 0.9) {
-        ir_filter_nr = 1;      // medium filtering
-    } else
-        ir_filter_nr = 2;      // no filtering
-
-    // detect 'onset'
-    if (fixed_gain > 2.0 * p->prev_sparse_fixed_gain) {
-        p->ir_filter_onset = 2;
-    } else if (p->ir_filter_onset)
-        p->ir_filter_onset--;
-
-    if (!p->ir_filter_onset) {
-        int i, count = 0;
-
-        for (i = 0; i < 5; i++)
-            if (p->pitch_gain[i] < 0.6)
-                count++;
-        if (count > 2)
-            ir_filter_nr = 0;
-
-        if (ir_filter_nr > p->prev_ir_filter_nr + 1)
-            ir_filter_nr--;
-    } else if (ir_filter_nr < 2)
-        ir_filter_nr++;
-
-    // Disable filtering for very low level of fixed_gain.
-    // Note this step is not specified in the technical description but is in
-    // the reference source in the function Ph_disp.
-    if (fixed_gain < 5.0)
-        ir_filter_nr = 2;
-
-    if (p->cur_frame_mode != MODE_7k4 && p->cur_frame_mode < MODE_10k2
-         && ir_filter_nr < 2) {
-        apply_ir_filter(out, fixed_sparse,
-                        (p->cur_frame_mode == MODE_7k95 ?
-                             ir_filters_lookup_MODE_7k95 :
-                             ir_filters_lookup)[ir_filter_nr]);
-        fixed_vector = out;
-    }
-
-    // update ir filter strength history
-    p->prev_ir_filter_nr       = ir_filter_nr;
-    p->prev_sparse_fixed_gain  = fixed_gain;
-
-    return fixed_vector;
-}
-
-/// @}
-
-
-/// @defgroup amr_synthesis AMR synthesis functions
-/// @{
-
-/**
- * Conduct 10th order linear predictive coding synthesis.
- *
- * @param p             pointer to the AMRContext
- * @param lpc           pointer to the LPC coefficients
- * @param fixed_gain    fixed codebook gain for synthesis
- * @param fixed_vector  algebraic codebook vector
- * @param samples       pointer to the output speech samples
- * @param overflow      16-bit overflow flag
- */
-static int synthesis(AMRContext *p, float *lpc,
-                     float fixed_gain, const float *fixed_vector,
-                     float *samples, uint8_t overflow)
-{
-    int i;
-    float excitation[AMR_SUBFRAME_SIZE];
-
-    // if an overflow has been detected, the pitch vector is scaled down by a
-    // factor of 4
-    if (overflow)
-        for (i = 0; i < AMR_SUBFRAME_SIZE; i++)
-            p->pitch_vector[i] *= 0.25;
-
-    ff_weighted_vector_sumf(excitation, p->pitch_vector, fixed_vector,
-                            p->pitch_gain[4], fixed_gain, AMR_SUBFRAME_SIZE);
-
-    // emphasize pitch vector contribution
-    if (p->pitch_gain[4] > 0.5 && !overflow) {
-        float energy = ff_dot_productf(excitation, excitation,
-                                       AMR_SUBFRAME_SIZE);
-        float pitch_factor =
-            p->pitch_gain[4] *
-            (p->cur_frame_mode == MODE_12k2 ?
-                0.25 * FFMIN(p->pitch_gain[4], 1.0) :
-                0.5  * FFMIN(p->pitch_gain[4], SHARP_MAX));
-
-        for (i = 0; i < AMR_SUBFRAME_SIZE; i++)
-            excitation[i] += pitch_factor * p->pitch_vector[i];
-
-        ff_scale_vector_to_given_sum_of_squares(excitation, excitation, energy,
-                                                AMR_SUBFRAME_SIZE);
-    }
-
-    ff_celp_lp_synthesis_filterf(samples, lpc, excitation, AMR_SUBFRAME_SIZE,
-                                 LP_FILTER_ORDER);
-
-    // detect overflow
-    for (i = 0; i < AMR_SUBFRAME_SIZE; i++)
-        if (fabsf(samples[i]) > AMR_SAMPLE_BOUND) {
-            return 1;
-        }
-
-    return 0;
-}
-
-/// @}
-
-
-/// @defgroup amr_update AMR update functions
-/// @{
-
-/**
- * Update buffers and history at the end of decoding a subframe.
- *
- * @param p             pointer to the AMRContext
- */
-static void update_state(AMRContext *p)
-{
-    memcpy(p->prev_lsp_sub4, p->lsp[3], LP_FILTER_ORDER * sizeof(p->lsp[3][0]));
-
-    memmove(&p->excitation_buf[0], &p->excitation_buf[AMR_SUBFRAME_SIZE],
-            (PITCH_DELAY_MAX + LP_FILTER_ORDER + 1) * sizeof(float));
-
-    memmove(&p->pitch_gain[0], &p->pitch_gain[1], 4 * sizeof(float));
-    memmove(&p->fixed_gain[0], &p->fixed_gain[1], 4 * sizeof(float));
-
-    memmove(&p->samples_in[0], &p->samples_in[AMR_SUBFRAME_SIZE],
-            LP_FILTER_ORDER * sizeof(float));
-}
-
-/// @}
-
-
-/// @defgroup amr_postproc AMR Post processing functions
-/// @{
-
-/**
- * Get the tilt factor of a formant filter from its transfer function
- *
- * @param lpc_n LP_FILTER_ORDER coefficients of the numerator
- * @param lpc_d LP_FILTER_ORDER coefficients of the denominator
- */
-static float tilt_factor(float *lpc_n, float *lpc_d)
-{
-    float rh0, rh1; // autocorrelation at lag 0 and 1
-
-    // LP_FILTER_ORDER prior zeros are needed for ff_celp_lp_synthesis_filterf
-    float impulse_buffer[LP_FILTER_ORDER + AMR_TILT_RESPONSE] = { 0 };
-    float *hf = impulse_buffer + LP_FILTER_ORDER; // start of impulse response
-
-    hf[0] = 1.0;
-    memcpy(hf + 1, lpc_n, sizeof(float) * LP_FILTER_ORDER);
-    ff_celp_lp_synthesis_filterf(hf, lpc_d, hf, AMR_TILT_RESPONSE,
-                                 LP_FILTER_ORDER);
-
-    rh0 = ff_dot_productf(hf, hf,     AMR_TILT_RESPONSE);
-    rh1 = ff_dot_productf(hf, hf + 1, AMR_TILT_RESPONSE - 1);
-
-    // The spec only specifies this check for 12.2 and 10.2 kbit/s
-    // modes. But in the ref source the tilt is always non-negative.
-    return rh1 >= 0.0 ? rh1 / rh0 * AMR_TILT_GAMMA_T : 0.0;
-}
-
-/**
- * Perform adaptive post-filtering to enhance the quality of the speech.
- * See section 6.2.1.
- *
- * @param p             pointer to the AMRContext
- * @param lpc           interpolated LP coefficients for this subframe
- * @param buf_out       output of the filter
- */
-static void postfilter(AMRContext *p, float *lpc, float *buf_out)
-{
-    int i;
-    float *samples          = p->samples_in + LP_FILTER_ORDER; // Start of input
-
-    float speech_gain       = ff_dot_productf(samples, samples,
-                                              AMR_SUBFRAME_SIZE);
-
-    float pole_out[AMR_SUBFRAME_SIZE + LP_FILTER_ORDER];  // Output of pole filter
-    const float *gamma_n, *gamma_d;                       // Formant filter factor table
-    float lpc_n[LP_FILTER_ORDER], lpc_d[LP_FILTER_ORDER]; // Transfer function coefficients
-
-    if (p->cur_frame_mode == MODE_12k2 || p->cur_frame_mode == MODE_10k2) {
-        gamma_n = ff_pow_0_7;
-        gamma_d = ff_pow_0_75;
-    } else {
-        gamma_n = ff_pow_0_55;
-        gamma_d = ff_pow_0_7;
-    }
-
-    for (i = 0; i < LP_FILTER_ORDER; i++) {
-         lpc_n[i] = lpc[i] * gamma_n[i];
-         lpc_d[i] = lpc[i] * gamma_d[i];
-    }
-
-    memcpy(pole_out, p->postfilter_mem, sizeof(float) * LP_FILTER_ORDER);
-    ff_celp_lp_synthesis_filterf(pole_out + LP_FILTER_ORDER, lpc_d, samples,
-                                 AMR_SUBFRAME_SIZE, LP_FILTER_ORDER);
-    memcpy(p->postfilter_mem, pole_out + AMR_SUBFRAME_SIZE,
-           sizeof(float) * LP_FILTER_ORDER);
-
-    ff_celp_lp_zero_synthesis_filterf(buf_out, lpc_n,
-                                      pole_out + LP_FILTER_ORDER,
-                                      AMR_SUBFRAME_SIZE, LP_FILTER_ORDER);
-
-    ff_tilt_compensation(&p->tilt_mem, tilt_factor(lpc_n, lpc_d), buf_out,
-                         AMR_SUBFRAME_SIZE);
-
-    ff_adaptive_gain_control(buf_out, buf_out, speech_gain, AMR_SUBFRAME_SIZE,
-                             AMR_AGC_ALPHA, &p->postfilter_agc);
-}
-
-/// @}
-
-static int amrnb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-
-    AMRContext *p = avctx->priv_data;        // pointer to private data
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    float *buf_out = data;                   // pointer to the output data buffer
-    int i, subframe;
-    float fixed_gain_factor;
-    AMRFixed fixed_sparse = {0};             // fixed vector up to anti-sparseness processing
-    float spare_vector[AMR_SUBFRAME_SIZE];   // extra stack space to hold result from anti-sparseness processing
-    float synth_fixed_gain;                  // the fixed gain that synthesis should use
-    const float *synth_fixed_vector;         // pointer to the fixed vector that synthesis should use
-
-    p->cur_frame_mode = unpack_bitstream(p, buf, buf_size);
-    if (p->cur_frame_mode == MODE_DTX) {
-        av_log_missing_feature(avctx, "dtx mode", 1);
-        return -1;
-    }
-
-    if (p->cur_frame_mode == MODE_12k2) {
-        lsf2lsp_5(p);
-    } else
-        lsf2lsp_3(p);
-
-    for (i = 0; i < 4; i++)
-        ff_acelp_lspd2lpc(p->lsp[i], p->lpc[i], 5);
-
-    for (subframe = 0; subframe < 4; subframe++) {
-        const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe];
-
-        decode_pitch_vector(p, amr_subframe, subframe);
-
-        decode_fixed_sparse(&fixed_sparse, amr_subframe->pulses,
-                            p->cur_frame_mode, subframe);
-
-        // The fixed gain (section 6.1.3) depends on the fixed vector
-        // (section 6.1.2), but the fixed vector calculation uses
-        // pitch sharpening based on the on the pitch gain (section 6.1.3).
-        // So the correct order is: pitch gain, pitch sharpening, fixed gain.
-        decode_gains(p, amr_subframe, p->cur_frame_mode, subframe,
-                     &fixed_gain_factor);
-
-        pitch_sharpening(p, subframe, p->cur_frame_mode, &fixed_sparse);
-
-        ff_set_fixed_vector(p->fixed_vector, &fixed_sparse, 1.0,
-                            AMR_SUBFRAME_SIZE);
-
-        p->fixed_gain[4] =
-            ff_amr_set_fixed_gain(fixed_gain_factor,
-                       ff_dot_productf(p->fixed_vector, p->fixed_vector,
-                                       AMR_SUBFRAME_SIZE)/AMR_SUBFRAME_SIZE,
-                       p->prediction_error,
-                       energy_mean[p->cur_frame_mode], energy_pred_fac);
-
-        // The excitation feedback is calculated without any processing such
-        // as fixed gain smoothing. This isn't mentioned in the specification.
-        for (i = 0; i < AMR_SUBFRAME_SIZE; i++)
-            p->excitation[i] *= p->pitch_gain[4];
-        ff_set_fixed_vector(p->excitation, &fixed_sparse, p->fixed_gain[4],
-                            AMR_SUBFRAME_SIZE);
-
-        // In the ref decoder, excitation is stored with no fractional bits.
-        // This step prevents buzz in silent periods. The ref encoder can
-        // emit long sequences with pitch factor greater than one. This
-        // creates unwanted feedback if the excitation vector is nonzero.
-        // (e.g. test sequence T19_795.COD in 3GPP TS 26.074)
-        for (i = 0; i < AMR_SUBFRAME_SIZE; i++)
-            p->excitation[i] = truncf(p->excitation[i]);
-
-        // Smooth fixed gain.
-        // The specification is ambiguous, but in the reference source, the
-        // smoothed value is NOT fed back into later fixed gain smoothing.
-        synth_fixed_gain = fixed_gain_smooth(p, p->lsf_q[subframe],
-                                             p->lsf_avg, p->cur_frame_mode);
-
-        synth_fixed_vector = anti_sparseness(p, &fixed_sparse, p->fixed_vector,
-                                             synth_fixed_gain, spare_vector);
-
-        if (synthesis(p, p->lpc[subframe], synth_fixed_gain,
-                      synth_fixed_vector, &p->samples_in[LP_FILTER_ORDER], 0))
-            // overflow detected -> rerun synthesis scaling pitch vector down
-            // by a factor of 4, skipping pitch vector contribution emphasis
-            // and adaptive gain control
-            synthesis(p, p->lpc[subframe], synth_fixed_gain,
-                      synth_fixed_vector, &p->samples_in[LP_FILTER_ORDER], 1);
-
-        postfilter(p, p->lpc[subframe], buf_out + subframe * AMR_SUBFRAME_SIZE);
-
-        // update buffers and history
-        ff_clear_fixed_vector(p->fixed_vector, &fixed_sparse, AMR_SUBFRAME_SIZE);
-        update_state(p);
-    }
-
-    ff_acelp_apply_order_2_transfer_function(buf_out, buf_out, highpass_zeros,
-                                             highpass_poles,
-                                             highpass_gain * AMR_SAMPLE_SCALE,
-                                             p->high_pass_mem, AMR_BLOCK_SIZE);
-
-    /* Update averaged lsf vector (used for fixed gain smoothing).
-     *
-     * Note that lsf_avg should not incorporate the current frame's LSFs
-     * for fixed_gain_smooth.
-     * The specification has an incorrect formula: the reference decoder uses
-     * qbar(n-1) rather than qbar(n) in section 6.1(4) equation 71. */
-    ff_weighted_vector_sumf(p->lsf_avg, p->lsf_avg, p->lsf_q[3],
-                            0.84, 0.16, LP_FILTER_ORDER);
-
-    /* report how many samples we got */
-    *data_size = AMR_BLOCK_SIZE * sizeof(float);
-
-    /* return the amount of bytes consumed if everything was OK */
-    return frame_sizes_nb[p->cur_frame_mode] + 1; // +7 for rounding and +8 for TOC
-}
-
-
-AVCodec amrnb_decoder = {
-    .name           = "amrnb",
-    .type           = AVMEDIA_TYPE_AUDIO,
-    .id             = CODEC_ID_AMR_NB,
-    .priv_data_size = sizeof(AMRContext),
-    .init           = amrnb_decode_init,
-    .decode         = amrnb_decode_frame,
-    .long_name      = NULL_IF_CONFIG_SMALL("Adaptive Multi-Rate NarrowBand"),
-    .sample_fmts    = (enum SampleFormat[]){SAMPLE_FMT_FLT,SAMPLE_FMT_NONE},
-};
diff --git a/libavcodec/anm.c b/libavcodec/anm.c
deleted file mode 100644
index f384861..0000000
--- a/libavcodec/anm.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Deluxe Paint Animation decoder
- * Copyright (c) 2009 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Deluxe Paint Animation decoder
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-typedef struct AnmContext {
-    AVFrame frame;
-    int x;  ///< x coordinate position
-} AnmContext;
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    AnmContext *s = avctx->priv_data;
-    const uint8_t *buf;
-    int i;
-
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    if (avctx->extradata_size != 16*8 + 4*256)
-        return -1;
-
-    s->frame.reference = 1;
-    if (avctx->get_buffer(avctx, &s->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    buf = avctx->extradata + 16*8;
-    for (i = 0; i < 256; i++)
-        ((uint32_t*)s->frame.data[1])[i] = bytestream_get_le32(&buf);
-
-    return 0;
-}
-
-/**
- * Perform decode operation
- * @param dst, dst_end Destination image buffer
- * @param buf, buf_end Source buffer (optional, see below)
- * @param pixel Fill color (optional, see below)
- * @param count Pixel count
- * @param x Pointer to x-axis counter
- * @param width Image width
- * @param linesize Destination image buffer linesize
- * @return non-zero if destination buffer is exhausted
- *
- * a copy operation is achieved when 'buf' is set
- * a fill operation is acheived when 'buf' is null and pixel is >= 0
- * a skip operation is acheived when 'buf' is null and pixel is < 0
- */
-static inline int op(uint8_t **dst, const uint8_t *dst_end,
-                     const uint8_t **buf, const uint8_t *buf_end,
-                     int pixel, int count,
-                     int *x, int width, int linesize)
-{
-    int remaining = width - *x;
-    while(count > 0) {
-        int striplen = FFMIN(count, remaining);
-        if (buf) {
-            striplen = FFMIN(striplen, buf_end - *buf);
-            memcpy(*dst, *buf, striplen);
-            *buf += striplen;
-        } else if (pixel >= 0)
-            memset(*dst, pixel, striplen);
-        *dst      += striplen;
-        remaining -= striplen;
-        count     -= striplen;
-        if (remaining <= 0) {
-            *dst      += linesize - width;
-            remaining  = width;
-        }
-        if (linesize > 0) {
-            if (*dst >= dst_end) goto exhausted;
-        } else {
-            if (*dst <= dst_end) goto exhausted;
-        }
-    }
-    *x = width - remaining;
-    return 0;
-
-exhausted:
-    *x = width - remaining;
-    return 1;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    AnmContext *s = avctx->priv_data;
-    const uint8_t *buf = avpkt->data;
-    const int buf_size = avpkt->size;
-    const uint8_t *buf_end = buf + buf_size;
-    uint8_t *dst, *dst_end;
-    int count;
-
-    if(avctx->reget_buffer(avctx, &s->frame) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    dst     = s->frame.data[0];
-    dst_end = s->frame.data[0] + s->frame.linesize[0]*avctx->height;
-
-    if (buf[0] != 0x42) {
-        av_log_ask_for_sample(avctx, "unknown record type\n");
-        return buf_size;
-    }
-    if (buf[1]) {
-        av_log_ask_for_sample(avctx, "padding bytes not supported\n");
-        return buf_size;
-    }
-    buf += 4;
-
-    s->x = 0;
-    do {
-        /* if statements are ordered by probability */
-#define OP(buf, pixel, count) \
-    op(&dst, dst_end, (buf), buf_end, (pixel), (count), &s->x, avctx->width, s->frame.linesize[0])
-
-        int type = bytestream_get_byte(&buf);
-        count = type & 0x7F;
-        type >>= 7;
-        if (count) {
-            if (OP(type ? NULL : &buf, -1, count)) break;
-        } else if (!type) {
-            int pixel;
-            count = bytestream_get_byte(&buf);  /* count==0 gives nop */
-            pixel = bytestream_get_byte(&buf);
-            if (OP(NULL, pixel, count)) break;
-        } else {
-            int pixel;
-            type = bytestream_get_le16(&buf);
-            count = type & 0x3FFF;
-            type >>= 14;
-            if (!count) {
-                if (type == 0)
-                    break; // stop
-                if (type == 2) {
-                    av_log_ask_for_sample(avctx, "unknown opcode");
-                    return AVERROR_INVALIDDATA;
-                }
-                continue;
-            }
-            pixel = type == 3 ? bytestream_get_byte(&buf) : -1;
-            if (type == 1) count += 0x4000;
-            if (OP(type == 2 ? &buf : NULL, pixel, count)) break;
-        }
-    } while (buf + 1 < buf_end);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-    return buf_size;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    AnmContext *s = avctx->priv_data;
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-    return 0;
-}
-
-AVCodec anm_decoder = {
-    "anm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ANM,
-    sizeof(AnmContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
-};
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
deleted file mode 100644
index a90a07f..0000000
--- a/libavcodec/apedec.c
+++ /dev/null
@@ -1,891 +0,0 @@
-/*
- * Monkey's Audio lossless audio decoder
- * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
- *  based upon libdemac from Dave Chapman.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-#include "bytestream.h"
-
-/**
- * @file
- * Monkey's Audio lossless audio decoder
- */
-
-#define BLOCKS_PER_LOOP     4608
-#define MAX_CHANNELS        2
-#define MAX_BYTESPERSAMPLE  3
-
-#define APE_FRAMECODE_MONO_SILENCE    1
-#define APE_FRAMECODE_STEREO_SILENCE  3
-#define APE_FRAMECODE_PSEUDO_STEREO   4
-
-#define HISTORY_SIZE 512
-#define PREDICTOR_ORDER 8
-/** Total size of all predictor histories */
-#define PREDICTOR_SIZE 50
-
-#define YDELAYA (18 + PREDICTOR_ORDER*4)
-#define YDELAYB (18 + PREDICTOR_ORDER*3)
-#define XDELAYA (18 + PREDICTOR_ORDER*2)
-#define XDELAYB (18 + PREDICTOR_ORDER)
-
-#define YADAPTCOEFFSA 18
-#define XADAPTCOEFFSA 14
-#define YADAPTCOEFFSB 10
-#define XADAPTCOEFFSB 5
-
-/**
- * Possible compression levels
- * @{
- */
-enum APECompressionLevel {
-    COMPRESSION_LEVEL_FAST       = 1000,
-    COMPRESSION_LEVEL_NORMAL     = 2000,
-    COMPRESSION_LEVEL_HIGH       = 3000,
-    COMPRESSION_LEVEL_EXTRA_HIGH = 4000,
-    COMPRESSION_LEVEL_INSANE     = 5000
-};
-/** @} */
-
-#define APE_FILTER_LEVELS 3
-
-/** Filter orders depending on compression level */
-static const uint16_t ape_filter_orders[5][APE_FILTER_LEVELS] = {
-    {  0,   0,    0 },
-    { 16,   0,    0 },
-    { 64,   0,    0 },
-    { 32, 256,    0 },
-    { 16, 256, 1280 }
-};
-
-/** Filter fraction bits depending on compression level */
-static const uint8_t ape_filter_fracbits[5][APE_FILTER_LEVELS] = {
-    {  0,  0,  0 },
-    { 11,  0,  0 },
-    { 11,  0,  0 },
-    { 10, 13,  0 },
-    { 11, 13, 15 }
-};
-
-
-/** Filters applied to the decoded data */
-typedef struct APEFilter {
-    int16_t *coeffs;        ///< actual coefficients used in filtering
-    int16_t *adaptcoeffs;   ///< adaptive filter coefficients used for correcting of actual filter coefficients
-    int16_t *historybuffer; ///< filter memory
-    int16_t *delay;         ///< filtered values
-
-    int avg;
-} APEFilter;
-
-typedef struct APERice {
-    uint32_t k;
-    uint32_t ksum;
-} APERice;
-
-typedef struct APERangecoder {
-    uint32_t low;           ///< low end of interval
-    uint32_t range;         ///< length of interval
-    uint32_t help;          ///< bytes_to_follow resp. intermediate value
-    unsigned int buffer;    ///< buffer for input/output
-} APERangecoder;
-
-/** Filter histories */
-typedef struct APEPredictor {
-    int32_t *buf;
-
-    int32_t lastA[2];
-
-    int32_t filterA[2];
-    int32_t filterB[2];
-
-    int32_t coeffsA[2][4];  ///< adaption coefficients
-    int32_t coeffsB[2][5];  ///< adaption coefficients
-    int32_t historybuffer[HISTORY_SIZE + PREDICTOR_SIZE];
-} APEPredictor;
-
-/** Decoder context */
-typedef struct APEContext {
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    int channels;
-    int samples;                             ///< samples left to decode in current frame
-
-    int fileversion;                         ///< codec version, very important in decoding process
-    int compression_level;                   ///< compression levels
-    int fset;                                ///< which filter set to use (calculated from compression level)
-    int flags;                               ///< global decoder flags
-
-    uint32_t CRC;                            ///< frame CRC
-    int frameflags;                          ///< frame flags
-    int currentframeblocks;                  ///< samples (per channel) in current frame
-    int blocksdecoded;                       ///< count of decoded samples in current frame
-    APEPredictor predictor;                  ///< predictor used for final reconstruction
-
-    int32_t decoded0[BLOCKS_PER_LOOP];       ///< decoded data for the first channel
-    int32_t decoded1[BLOCKS_PER_LOOP];       ///< decoded data for the second channel
-
-    int16_t* filterbuf[APE_FILTER_LEVELS];   ///< filter memory
-
-    APERangecoder rc;                        ///< rangecoder used to decode actual values
-    APERice riceX;                           ///< rice code parameters for the second channel
-    APERice riceY;                           ///< rice code parameters for the first channel
-    APEFilter filters[APE_FILTER_LEVELS][2]; ///< filters used for reconstruction
-
-    uint8_t *data;                           ///< current frame data
-    uint8_t *data_end;                       ///< frame data end
-    const uint8_t *ptr;                      ///< current position in frame data
-    const uint8_t *last_ptr;                 ///< position where last 4608-sample block ended
-
-    int error;
-} APEContext;
-
-// TODO: dsputilize
-
-static av_cold int ape_decode_init(AVCodecContext * avctx)
-{
-    APEContext *s = avctx->priv_data;
-    int i;
-
-    if (avctx->extradata_size != 6) {
-        av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n");
-        return -1;
-    }
-    if (avctx->bits_per_coded_sample != 16) {
-        av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n");
-        return -1;
-    }
-    if (avctx->channels > 2) {
-        av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n");
-        return -1;
-    }
-    s->avctx             = avctx;
-    s->channels          = avctx->channels;
-    s->fileversion       = AV_RL16(avctx->extradata);
-    s->compression_level = AV_RL16(avctx->extradata + 2);
-    s->flags             = AV_RL16(avctx->extradata + 4);
-
-    av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", s->compression_level, s->flags);
-    if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) {
-        av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", s->compression_level);
-        return -1;
-    }
-    s->fset = s->compression_level / 1000 - 1;
-    for (i = 0; i < APE_FILTER_LEVELS; i++) {
-        if (!ape_filter_orders[s->fset][i])
-            break;
-        s->filterbuf[i] = av_malloc((ape_filter_orders[s->fset][i] * 3 + HISTORY_SIZE) * 4);
-    }
-
-    dsputil_init(&s->dsp, avctx);
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
-    return 0;
-}
-
-static av_cold int ape_decode_close(AVCodecContext * avctx)
-{
-    APEContext *s = avctx->priv_data;
-    int i;
-
-    for (i = 0; i < APE_FILTER_LEVELS; i++)
-        av_freep(&s->filterbuf[i]);
-
-    av_freep(&s->data);
-    return 0;
-}
-
-/**
- * @defgroup rangecoder APE range decoder
- * @{
- */
-
-#define CODE_BITS    32
-#define TOP_VALUE    ((unsigned int)1 << (CODE_BITS-1))
-#define SHIFT_BITS   (CODE_BITS - 9)
-#define EXTRA_BITS   ((CODE_BITS-2) % 8 + 1)
-#define BOTTOM_VALUE (TOP_VALUE >> 8)
-
-/** Start the decoder */
-static inline void range_start_decoding(APEContext * ctx)
-{
-    ctx->rc.buffer = bytestream_get_byte(&ctx->ptr);
-    ctx->rc.low    = ctx->rc.buffer >> (8 - EXTRA_BITS);
-    ctx->rc.range  = (uint32_t) 1 << EXTRA_BITS;
-}
-
-/** Perform normalization */
-static inline void range_dec_normalize(APEContext * ctx)
-{
-    while (ctx->rc.range <= BOTTOM_VALUE) {
-        ctx->rc.buffer <<= 8;
-        if(ctx->ptr < ctx->data_end)
-            ctx->rc.buffer += *ctx->ptr;
-        ctx->ptr++;
-        ctx->rc.low    = (ctx->rc.low << 8)    | ((ctx->rc.buffer >> 1) & 0xFF);
-        ctx->rc.range  <<= 8;
-    }
-}
-
-/**
- * Calculate culmulative frequency for next symbol. Does NO update!
- * @param ctx decoder context
- * @param tot_f is the total frequency or (code_value)1<<shift
- * @return the culmulative frequency
- */
-static inline int range_decode_culfreq(APEContext * ctx, int tot_f)
-{
-    range_dec_normalize(ctx);
-    ctx->rc.help = ctx->rc.range / tot_f;
-    return ctx->rc.low / ctx->rc.help;
-}
-
-/**
- * Decode value with given size in bits
- * @param ctx decoder context
- * @param shift number of bits to decode
- */
-static inline int range_decode_culshift(APEContext * ctx, int shift)
-{
-    range_dec_normalize(ctx);
-    ctx->rc.help = ctx->rc.range >> shift;
-    return ctx->rc.low / ctx->rc.help;
-}
-
-
-/**
- * Update decoding state
- * @param ctx decoder context
- * @param sy_f the interval length (frequency of the symbol)
- * @param lt_f the lower end (frequency sum of < symbols)
- */
-static inline void range_decode_update(APEContext * ctx, int sy_f, int lt_f)
-{
-    ctx->rc.low  -= ctx->rc.help * lt_f;
-    ctx->rc.range = ctx->rc.help * sy_f;
-}
-
-/** Decode n bits (n <= 16) without modelling */
-static inline int range_decode_bits(APEContext * ctx, int n)
-{
-    int sym = range_decode_culshift(ctx, n);
-    range_decode_update(ctx, 1, sym);
-    return sym;
-}
-
-
-#define MODEL_ELEMENTS 64
-
-/**
- * Fixed probabilities for symbols in Monkey Audio version 3.97
- */
-static const uint16_t counts_3970[22] = {
-        0, 14824, 28224, 39348, 47855, 53994, 58171, 60926,
-    62682, 63786, 64463, 64878, 65126, 65276, 65365, 65419,
-    65450, 65469, 65480, 65487, 65491, 65493,
-};
-
-/**
- * Probability ranges for symbols in Monkey Audio version 3.97
- */
-static const uint16_t counts_diff_3970[21] = {
-    14824, 13400, 11124, 8507, 6139, 4177, 2755, 1756,
-    1104, 677, 415, 248, 150, 89, 54, 31,
-    19, 11, 7, 4, 2,
-};
-
-/**
- * Fixed probabilities for symbols in Monkey Audio version 3.98
- */
-static const uint16_t counts_3980[22] = {
-        0, 19578, 36160, 48417, 56323, 60899, 63265, 64435,
-    64971, 65232, 65351, 65416, 65447, 65466, 65476, 65482,
-    65485, 65488, 65490, 65491, 65492, 65493,
-};
-
-/**
- * Probability ranges for symbols in Monkey Audio version 3.98
- */
-static const uint16_t counts_diff_3980[21] = {
-    19578, 16582, 12257, 7906, 4576, 2366, 1170, 536,
-    261, 119, 65, 31, 19, 10, 6, 3,
-    3, 2, 1, 1, 1,
-};
-
-/**
- * Decode symbol
- * @param ctx decoder context
- * @param counts probability range start position
- * @param counts_diff probability range widths
- */
-static inline int range_get_symbol(APEContext * ctx,
-                                   const uint16_t counts[],
-                                   const uint16_t counts_diff[])
-{
-    int symbol, cf;
-
-    cf = range_decode_culshift(ctx, 16);
-
-    if(cf > 65492){
-        symbol= cf - 65535 + 63;
-        range_decode_update(ctx, 1, cf);
-        if(cf > 65535)
-            ctx->error=1;
-        return symbol;
-    }
-    /* figure out the symbol inefficiently; a binary search would be much better */
-    for (symbol = 0; counts[symbol + 1] <= cf; symbol++);
-
-    range_decode_update(ctx, counts_diff[symbol], counts[symbol]);
-
-    return symbol;
-}
-/** @} */ // group rangecoder
-
-static inline void update_rice(APERice *rice, int x)
-{
-    int lim = rice->k ? (1 << (rice->k + 4)) : 0;
-    rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5);
-
-    if (rice->ksum < lim)
-        rice->k--;
-    else if (rice->ksum >= (1 << (rice->k + 5)))
-        rice->k++;
-}
-
-static inline int ape_decode_value(APEContext * ctx, APERice *rice)
-{
-    int x, overflow;
-
-    if (ctx->fileversion < 3990) {
-        int tmpk;
-
-        overflow = range_get_symbol(ctx, counts_3970, counts_diff_3970);
-
-        if (overflow == (MODEL_ELEMENTS - 1)) {
-            tmpk = range_decode_bits(ctx, 5);
-            overflow = 0;
-        } else
-            tmpk = (rice->k < 1) ? 0 : rice->k - 1;
-
-        if (tmpk <= 16)
-            x = range_decode_bits(ctx, tmpk);
-        else {
-            x = range_decode_bits(ctx, 16);
-            x |= (range_decode_bits(ctx, tmpk - 16) << 16);
-        }
-        x += overflow << tmpk;
-    } else {
-        int base, pivot;
-
-        pivot = rice->ksum >> 5;
-        if (pivot == 0)
-            pivot = 1;
-
-        overflow = range_get_symbol(ctx, counts_3980, counts_diff_3980);
-
-        if (overflow == (MODEL_ELEMENTS - 1)) {
-            overflow  = range_decode_bits(ctx, 16) << 16;
-            overflow |= range_decode_bits(ctx, 16);
-        }
-
-        if (pivot < 0x10000) {
-            base = range_decode_culfreq(ctx, pivot);
-            range_decode_update(ctx, 1, base);
-        } else {
-            int base_hi = pivot, base_lo;
-            int bbits = 0;
-
-            while (base_hi & ~0xFFFF) {
-                base_hi >>= 1;
-                bbits++;
-            }
-            base_hi = range_decode_culfreq(ctx, base_hi + 1);
-            range_decode_update(ctx, 1, base_hi);
-            base_lo = range_decode_culfreq(ctx, 1 << bbits);
-            range_decode_update(ctx, 1, base_lo);
-
-            base = (base_hi << bbits) + base_lo;
-        }
-
-        x = base + overflow * pivot;
-    }
-
-    update_rice(rice, x);
-
-    /* Convert to signed */
-    if (x & 1)
-        return (x >> 1) + 1;
-    else
-        return -(x >> 1);
-}
-
-static void entropy_decode(APEContext * ctx, int blockstodecode, int stereo)
-{
-    int32_t *decoded0 = ctx->decoded0;
-    int32_t *decoded1 = ctx->decoded1;
-
-    ctx->blocksdecoded = blockstodecode;
-
-    if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
-        /* We are pure silence, just memset the output buffer. */
-        memset(decoded0, 0, blockstodecode * sizeof(int32_t));
-        memset(decoded1, 0, blockstodecode * sizeof(int32_t));
-    } else {
-        while (blockstodecode--) {
-            *decoded0++ = ape_decode_value(ctx, &ctx->riceY);
-            if (stereo)
-                *decoded1++ = ape_decode_value(ctx, &ctx->riceX);
-        }
-    }
-
-    if (ctx->blocksdecoded == ctx->currentframeblocks)
-        range_dec_normalize(ctx);   /* normalize to use up all bytes */
-}
-
-static void init_entropy_decoder(APEContext * ctx)
-{
-    /* Read the CRC */
-    ctx->CRC = bytestream_get_be32(&ctx->ptr);
-
-    /* Read the frame flags if they exist */
-    ctx->frameflags = 0;
-    if ((ctx->fileversion > 3820) && (ctx->CRC & 0x80000000)) {
-        ctx->CRC &= ~0x80000000;
-
-        ctx->frameflags = bytestream_get_be32(&ctx->ptr);
-    }
-
-    /* Keep a count of the blocks decoded in this frame */
-    ctx->blocksdecoded = 0;
-
-    /* Initialize the rice structs */
-    ctx->riceX.k = 10;
-    ctx->riceX.ksum = (1 << ctx->riceX.k) * 16;
-    ctx->riceY.k = 10;
-    ctx->riceY.ksum = (1 << ctx->riceY.k) * 16;
-
-    /* The first 8 bits of input are ignored. */
-    ctx->ptr++;
-
-    range_start_decoding(ctx);
-}
-
-static const int32_t initial_coeffs[4] = {
-    360, 317, -109, 98
-};
-
-static void init_predictor_decoder(APEContext * ctx)
-{
-    APEPredictor *p = &ctx->predictor;
-
-    /* Zero the history buffers */
-    memset(p->historybuffer, 0, PREDICTOR_SIZE * sizeof(int32_t));
-    p->buf = p->historybuffer;
-
-    /* Initialize and zero the coefficients */
-    memcpy(p->coeffsA[0], initial_coeffs, sizeof(initial_coeffs));
-    memcpy(p->coeffsA[1], initial_coeffs, sizeof(initial_coeffs));
-    memset(p->coeffsB, 0, sizeof(p->coeffsB));
-
-    p->filterA[0] = p->filterA[1] = 0;
-    p->filterB[0] = p->filterB[1] = 0;
-    p->lastA[0]   = p->lastA[1]   = 0;
-}
-
-/** Get inverse sign of integer (-1 for positive, 1 for negative and 0 for zero) */
-static inline int APESIGN(int32_t x) {
-    return (x < 0) - (x > 0);
-}
-
-static av_always_inline int predictor_update_filter(APEPredictor *p, const int decoded, const int filter, const int delayA, const int delayB, const int adaptA, const int adaptB)
-{
-    int32_t predictionA, predictionB, sign;
-
-    p->buf[delayA]     = p->lastA[filter];
-    p->buf[adaptA]     = APESIGN(p->buf[delayA]);
-    p->buf[delayA - 1] = p->buf[delayA] - p->buf[delayA - 1];
-    p->buf[adaptA - 1] = APESIGN(p->buf[delayA - 1]);
-
-    predictionA = p->buf[delayA    ] * p->coeffsA[filter][0] +
-                  p->buf[delayA - 1] * p->coeffsA[filter][1] +
-                  p->buf[delayA - 2] * p->coeffsA[filter][2] +
-                  p->buf[delayA - 3] * p->coeffsA[filter][3];
-
-    /*  Apply a scaled first-order filter compression */
-    p->buf[delayB]     = p->filterA[filter ^ 1] - ((p->filterB[filter] * 31) >> 5);
-    p->buf[adaptB]     = APESIGN(p->buf[delayB]);
-    p->buf[delayB - 1] = p->buf[delayB] - p->buf[delayB - 1];
-    p->buf[adaptB - 1] = APESIGN(p->buf[delayB - 1]);
-    p->filterB[filter] = p->filterA[filter ^ 1];
-
-    predictionB = p->buf[delayB    ] * p->coeffsB[filter][0] +
-                  p->buf[delayB - 1] * p->coeffsB[filter][1] +
-                  p->buf[delayB - 2] * p->coeffsB[filter][2] +
-                  p->buf[delayB - 3] * p->coeffsB[filter][3] +
-                  p->buf[delayB - 4] * p->coeffsB[filter][4];
-
-    p->lastA[filter] = decoded + ((predictionA + (predictionB >> 1)) >> 10);
-    p->filterA[filter] = p->lastA[filter] + ((p->filterA[filter] * 31) >> 5);
-
-    sign = APESIGN(decoded);
-    p->coeffsA[filter][0] += p->buf[adaptA    ] * sign;
-    p->coeffsA[filter][1] += p->buf[adaptA - 1] * sign;
-    p->coeffsA[filter][2] += p->buf[adaptA - 2] * sign;
-    p->coeffsA[filter][3] += p->buf[adaptA - 3] * sign;
-    p->coeffsB[filter][0] += p->buf[adaptB    ] * sign;
-    p->coeffsB[filter][1] += p->buf[adaptB - 1] * sign;
-    p->coeffsB[filter][2] += p->buf[adaptB - 2] * sign;
-    p->coeffsB[filter][3] += p->buf[adaptB - 3] * sign;
-    p->coeffsB[filter][4] += p->buf[adaptB - 4] * sign;
-
-    return p->filterA[filter];
-}
-
-static void predictor_decode_stereo(APEContext * ctx, int count)
-{
-    APEPredictor *p = &ctx->predictor;
-    int32_t *decoded0 = ctx->decoded0;
-    int32_t *decoded1 = ctx->decoded1;
-
-    while (count--) {
-        /* Predictor Y */
-        *decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB, YADAPTCOEFFSA, YADAPTCOEFFSB);
-        decoded0++;
-        *decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB, XADAPTCOEFFSA, XADAPTCOEFFSB);
-        decoded1++;
-
-        /* Combined */
-        p->buf++;
-
-        /* Have we filled the history buffer? */
-        if (p->buf == p->historybuffer + HISTORY_SIZE) {
-            memmove(p->historybuffer, p->buf, PREDICTOR_SIZE * sizeof(int32_t));
-            p->buf = p->historybuffer;
-        }
-    }
-}
-
-static void predictor_decode_mono(APEContext * ctx, int count)
-{
-    APEPredictor *p = &ctx->predictor;
-    int32_t *decoded0 = ctx->decoded0;
-    int32_t predictionA, currentA, A, sign;
-
-    currentA = p->lastA[0];
-
-    while (count--) {
-        A = *decoded0;
-
-        p->buf[YDELAYA] = currentA;
-        p->buf[YDELAYA - 1] = p->buf[YDELAYA] - p->buf[YDELAYA - 1];
-
-        predictionA = p->buf[YDELAYA    ] * p->coeffsA[0][0] +
-                      p->buf[YDELAYA - 1] * p->coeffsA[0][1] +
-                      p->buf[YDELAYA - 2] * p->coeffsA[0][2] +
-                      p->buf[YDELAYA - 3] * p->coeffsA[0][3];
-
-        currentA = A + (predictionA >> 10);
-
-        p->buf[YADAPTCOEFFSA]     = APESIGN(p->buf[YDELAYA    ]);
-        p->buf[YADAPTCOEFFSA - 1] = APESIGN(p->buf[YDELAYA - 1]);
-
-        sign = APESIGN(A);
-        p->coeffsA[0][0] += p->buf[YADAPTCOEFFSA    ] * sign;
-        p->coeffsA[0][1] += p->buf[YADAPTCOEFFSA - 1] * sign;
-        p->coeffsA[0][2] += p->buf[YADAPTCOEFFSA - 2] * sign;
-        p->coeffsA[0][3] += p->buf[YADAPTCOEFFSA - 3] * sign;
-
-        p->buf++;
-
-        /* Have we filled the history buffer? */
-        if (p->buf == p->historybuffer + HISTORY_SIZE) {
-            memmove(p->historybuffer, p->buf, PREDICTOR_SIZE * sizeof(int32_t));
-            p->buf = p->historybuffer;
-        }
-
-        p->filterA[0] = currentA + ((p->filterA[0] * 31) >> 5);
-        *(decoded0++) = p->filterA[0];
-    }
-
-    p->lastA[0] = currentA;
-}
-
-static void do_init_filter(APEFilter *f, int16_t * buf, int order)
-{
-    f->coeffs = buf;
-    f->historybuffer = buf + order;
-    f->delay       = f->historybuffer + order * 2;
-    f->adaptcoeffs = f->historybuffer + order;
-
-    memset(f->historybuffer, 0, (order * 2) * sizeof(int16_t));
-    memset(f->coeffs, 0, order * sizeof(int16_t));
-    f->avg = 0;
-}
-
-static void init_filter(APEContext * ctx, APEFilter *f, int16_t * buf, int order)
-{
-    do_init_filter(&f[0], buf, order);
-    do_init_filter(&f[1], buf + order * 3 + HISTORY_SIZE, order);
-}
-
-static void do_apply_filter(APEContext * ctx, int version, APEFilter *f, int32_t *data, int count, int order, int fracbits)
-{
-    int res;
-    int absres;
-
-    while (count--) {
-        /* round fixedpoint scalar product */
-        res = ctx->dsp.scalarproduct_and_madd_int16(f->coeffs, f->delay - order, f->adaptcoeffs - order, order, APESIGN(*data));
-        res = (res + (1 << (fracbits - 1))) >> fracbits;
-        res += *data;
-        *data++ = res;
-
-        /* Update the output history */
-        *f->delay++ = av_clip_int16(res);
-
-        if (version < 3980) {
-            /* Version ??? to < 3.98 files (untested) */
-            f->adaptcoeffs[0]  = (res == 0) ? 0 : ((res >> 28) & 8) - 4;
-            f->adaptcoeffs[-4] >>= 1;
-            f->adaptcoeffs[-8] >>= 1;
-        } else {
-            /* Version 3.98 and later files */
-
-            /* Update the adaption coefficients */
-            absres = FFABS(res);
-            if (absres)
-                *f->adaptcoeffs = ((res & (1<<31)) - (1<<30)) >> (25 + (absres <= f->avg*3) + (absres <= f->avg*4/3));
-            else
-                *f->adaptcoeffs = 0;
-
-            f->avg += (absres - f->avg) / 16;
-
-            f->adaptcoeffs[-1] >>= 1;
-            f->adaptcoeffs[-2] >>= 1;
-            f->adaptcoeffs[-8] >>= 1;
-        }
-
-        f->adaptcoeffs++;
-
-        /* Have we filled the history buffer? */
-        if (f->delay == f->historybuffer + HISTORY_SIZE + (order * 2)) {
-            memmove(f->historybuffer, f->delay - (order * 2),
-                    (order * 2) * sizeof(int16_t));
-            f->delay = f->historybuffer + order * 2;
-            f->adaptcoeffs = f->historybuffer + order;
-        }
-    }
-}
-
-static void apply_filter(APEContext * ctx, APEFilter *f,
-                         int32_t * data0, int32_t * data1,
-                         int count, int order, int fracbits)
-{
-    do_apply_filter(ctx, ctx->fileversion, &f[0], data0, count, order, fracbits);
-    if (data1)
-        do_apply_filter(ctx, ctx->fileversion, &f[1], data1, count, order, fracbits);
-}
-
-static void ape_apply_filters(APEContext * ctx, int32_t * decoded0,
-                              int32_t * decoded1, int count)
-{
-    int i;
-
-    for (i = 0; i < APE_FILTER_LEVELS; i++) {
-        if (!ape_filter_orders[ctx->fset][i])
-            break;
-        apply_filter(ctx, ctx->filters[i], decoded0, decoded1, count, ape_filter_orders[ctx->fset][i], ape_filter_fracbits[ctx->fset][i]);
-    }
-}
-
-static void init_frame_decoder(APEContext * ctx)
-{
-    int i;
-    init_entropy_decoder(ctx);
-    init_predictor_decoder(ctx);
-
-    for (i = 0; i < APE_FILTER_LEVELS; i++) {
-        if (!ape_filter_orders[ctx->fset][i])
-            break;
-        init_filter(ctx, ctx->filters[i], ctx->filterbuf[i], ape_filter_orders[ctx->fset][i]);
-    }
-}
-
-static void ape_unpack_mono(APEContext * ctx, int count)
-{
-    int32_t left;
-    int32_t *decoded0 = ctx->decoded0;
-    int32_t *decoded1 = ctx->decoded1;
-
-    if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
-        entropy_decode(ctx, count, 0);
-        /* We are pure silence, so we're done. */
-        av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n");
-        return;
-    }
-
-    entropy_decode(ctx, count, 0);
-    ape_apply_filters(ctx, decoded0, NULL, count);
-
-    /* Now apply the predictor decoding */
-    predictor_decode_mono(ctx, count);
-
-    /* Pseudo-stereo - just copy left channel to right channel */
-    if (ctx->channels == 2) {
-        while (count--) {
-            left = *decoded0;
-            *(decoded1++) = *(decoded0++) = left;
-        }
-    }
-}
-
-static void ape_unpack_stereo(APEContext * ctx, int count)
-{
-    int32_t left, right;
-    int32_t *decoded0 = ctx->decoded0;
-    int32_t *decoded1 = ctx->decoded1;
-
-    if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) {
-        /* We are pure silence, so we're done. */
-        av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n");
-        return;
-    }
-
-    entropy_decode(ctx, count, 1);
-    ape_apply_filters(ctx, decoded0, decoded1, count);
-
-    /* Now apply the predictor decoding */
-    predictor_decode_stereo(ctx, count);
-
-    /* Decorrelate and scale to output depth */
-    while (count--) {
-        left = *decoded1 - (*decoded0 / 2);
-        right = left + *decoded0;
-
-        *(decoded0++) = left;
-        *(decoded1++) = right;
-    }
-}
-
-static int ape_decode_frame(AVCodecContext * avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    APEContext *s = avctx->priv_data;
-    int16_t *samples = data;
-    int nblocks;
-    int i, n;
-    int blockstodecode;
-    int bytes_used;
-
-    if (buf_size == 0 && !s->samples) {
-        *data_size = 0;
-        return 0;
-    }
-
-    /* should not happen but who knows */
-    if (BLOCKS_PER_LOOP * 2 * avctx->channels > *data_size) {
-        av_log (avctx, AV_LOG_ERROR, "Packet size is too big to be handled in lavc! (max is %d where you have %d)\n", *data_size, s->samples * 2 * avctx->channels);
-        return -1;
-    }
-
-    if(!s->samples){
-        s->data = av_realloc(s->data, (buf_size + 3) & ~3);
-        s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2);
-        s->ptr = s->last_ptr = s->data;
-        s->data_end = s->data + buf_size;
-
-        nblocks = s->samples = bytestream_get_be32(&s->ptr);
-        n =  bytestream_get_be32(&s->ptr);
-        if(n < 0 || n > 3){
-            av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n");
-            s->data = NULL;
-            return -1;
-        }
-        s->ptr += n;
-
-        s->currentframeblocks = nblocks;
-        buf += 4;
-        if (s->samples <= 0) {
-            *data_size = 0;
-            return buf_size;
-        }
-
-        memset(s->decoded0,  0, sizeof(s->decoded0));
-        memset(s->decoded1,  0, sizeof(s->decoded1));
-
-        /* Initialize the frame decoder */
-        init_frame_decoder(s);
-    }
-
-    if (!s->data) {
-        *data_size = 0;
-        return buf_size;
-    }
-
-    nblocks = s->samples;
-    blockstodecode = FFMIN(BLOCKS_PER_LOOP, nblocks);
-
-    s->error=0;
-
-    if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO))
-        ape_unpack_mono(s, blockstodecode);
-    else
-        ape_unpack_stereo(s, blockstodecode);
-    emms_c();
-
-    if(s->error || s->ptr > s->data_end){
-        s->samples=0;
-        av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n");
-        return -1;
-    }
-
-    for (i = 0; i < blockstodecode; i++) {
-        *samples++ = s->decoded0[i];
-        if(s->channels == 2)
-            *samples++ = s->decoded1[i];
-    }
-
-    s->samples -= blockstodecode;
-
-    *data_size = blockstodecode * 2 * s->channels;
-    bytes_used = s->samples ? s->ptr - s->last_ptr : buf_size;
-    s->last_ptr = s->ptr;
-    return bytes_used;
-}
-
-AVCodec ape_decoder = {
-    "ape",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_APE,
-    sizeof(APEContext),
-    ape_decode_init,
-    NULL,
-    ape_decode_close,
-    ape_decode_frame,
-    .capabilities = CODEC_CAP_SUBFRAMES,
-    .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
-};
diff --git a/libavcodec/api-example.c b/libavcodec/api-example.c
deleted file mode 100644
index f34075e..0000000
--- a/libavcodec/api-example.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * avcodec API use example.
- *
- * Note that this library only handles codecs (mpeg, mpeg4, etc...),
- * not file formats (avi, vob, etc...). See library 'libavformat' for the
- * format handling
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifdef HAVE_AV_CONFIG_H
-#undef HAVE_AV_CONFIG_H
-#endif
-
-#include "libavcodec/avcodec.h"
-#include "libavutil/mathematics.h"
-
-#define INBUF_SIZE 4096
-#define AUDIO_INBUF_SIZE 20480
-#define AUDIO_REFILL_THRESH 4096
-
-/*
- * Audio encoding example
- */
-static void audio_encode_example(const char *filename)
-{
-    AVCodec *codec;
-    AVCodecContext *c= NULL;
-    int frame_size, i, j, out_size, outbuf_size;
-    FILE *f;
-    short *samples;
-    float t, tincr;
-    uint8_t *outbuf;
-
-    printf("Audio encoding\n");
-
-    /* find the MP2 encoder */
-    codec = avcodec_find_encoder(CODEC_ID_MP2);
-    if (!codec) {
-        fprintf(stderr, "codec not found\n");
-        exit(1);
-    }
-
-    c= avcodec_alloc_context();
-
-    /* put sample parameters */
-    c->bit_rate = 64000;
-    c->sample_rate = 44100;
-    c->channels = 2;
-
-    /* open it */
-    if (avcodec_open(c, codec) < 0) {
-        fprintf(stderr, "could not open codec\n");
-        exit(1);
-    }
-
-    /* the codec gives us the frame size, in samples */
-    frame_size = c->frame_size;
-    samples = malloc(frame_size * 2 * c->channels);
-    outbuf_size = 10000;
-    outbuf = malloc(outbuf_size);
-
-    f = fopen(filename, "wb");
-    if (!f) {
-        fprintf(stderr, "could not open %s\n", filename);
-        exit(1);
-    }
-
-    /* encode a single tone sound */
-    t = 0;
-    tincr = 2 * M_PI * 440.0 / c->sample_rate;
-    for(i=0;i<200;i++) {
-        for(j=0;j<frame_size;j++) {
-            samples[2*j] = (int)(sin(t) * 10000);
-            samples[2*j+1] = samples[2*j];
-            t += tincr;
-        }
-        /* encode the samples */
-        out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples);
-        fwrite(outbuf, 1, out_size, f);
-    }
-    fclose(f);
-    free(outbuf);
-    free(samples);
-
-    avcodec_close(c);
-    av_free(c);
-}
-
-/*
- * Audio decoding.
- */
-static void audio_decode_example(const char *outfilename, const char *filename)
-{
-    AVCodec *codec;
-    AVCodecContext *c= NULL;
-    int out_size, len;
-    FILE *f, *outfile;
-    uint8_t *outbuf;
-    uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
-    AVPacket avpkt;
-
-    av_init_packet(&avpkt);
-
-    printf("Audio decoding\n");
-
-    /* find the mpeg audio decoder */
-    codec = avcodec_find_decoder(CODEC_ID_MP2);
-    if (!codec) {
-        fprintf(stderr, "codec not found\n");
-        exit(1);
-    }
-
-    c= avcodec_alloc_context();
-
-    /* open it */
-    if (avcodec_open(c, codec) < 0) {
-        fprintf(stderr, "could not open codec\n");
-        exit(1);
-    }
-
-    outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
-
-    f = fopen(filename, "rb");
-    if (!f) {
-        fprintf(stderr, "could not open %s\n", filename);
-        exit(1);
-    }
-    outfile = fopen(outfilename, "wb");
-    if (!outfile) {
-        av_free(c);
-        exit(1);
-    }
-
-    /* decode until eof */
-    avpkt.data = inbuf;
-    avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
-
-    while (avpkt.size > 0) {
-        out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
-        len = avcodec_decode_audio3(c, (short *)outbuf, &out_size, &avpkt);
-        if (len < 0) {
-            fprintf(stderr, "Error while decoding\n");
-            exit(1);
-        }
-        if (out_size > 0) {
-            /* if a frame has been decoded, output it */
-            fwrite(outbuf, 1, out_size, outfile);
-        }
-        avpkt.size -= len;
-        avpkt.data += len;
-        if (avpkt.size < AUDIO_REFILL_THRESH) {
-            /* Refill the input buffer, to avoid trying to decode
-             * incomplete frames. Instead of this, one could also use
-             * a parser, or use a proper container format through
-             * libavformat. */
-            memmove(inbuf, avpkt.data, avpkt.size);
-            avpkt.data = inbuf;
-            len = fread(avpkt.data + avpkt.size, 1,
-                        AUDIO_INBUF_SIZE - avpkt.size, f);
-            if (len > 0)
-                avpkt.size += len;
-        }
-    }
-
-    fclose(outfile);
-    fclose(f);
-    free(outbuf);
-
-    avcodec_close(c);
-    av_free(c);
-}
-
-/*
- * Video encoding example
- */
-static void video_encode_example(const char *filename)
-{
-    AVCodec *codec;
-    AVCodecContext *c= NULL;
-    int i, out_size, size, x, y, outbuf_size;
-    FILE *f;
-    AVFrame *picture;
-    uint8_t *outbuf, *picture_buf;
-
-    printf("Video encoding\n");
-
-    /* find the mpeg1 video encoder */
-    codec = avcodec_find_encoder(CODEC_ID_MPEG1VIDEO);
-    if (!codec) {
-        fprintf(stderr, "codec not found\n");
-        exit(1);
-    }
-
-    c= avcodec_alloc_context();
-    picture= avcodec_alloc_frame();
-
-    /* put sample parameters */
-    c->bit_rate = 400000;
-    /* resolution must be a multiple of two */
-    c->width = 352;
-    c->height = 288;
-    /* frames per second */
-    c->time_base= (AVRational){1,25};
-    c->gop_size = 10; /* emit one intra frame every ten frames */
-    c->max_b_frames=1;
-    c->pix_fmt = PIX_FMT_YUV420P;
-
-    /* open it */
-    if (avcodec_open(c, codec) < 0) {
-        fprintf(stderr, "could not open codec\n");
-        exit(1);
-    }
-
-    f = fopen(filename, "wb");
-    if (!f) {
-        fprintf(stderr, "could not open %s\n", filename);
-        exit(1);
-    }
-
-    /* alloc image and output buffer */
-    outbuf_size = 100000;
-    outbuf = malloc(outbuf_size);
-    size = c->width * c->height;
-    picture_buf = malloc((size * 3) / 2); /* size for YUV 420 */
-
-    picture->data[0] = picture_buf;
-    picture->data[1] = picture->data[0] + size;
-    picture->data[2] = picture->data[1] + size / 4;
-    picture->linesize[0] = c->width;
-    picture->linesize[1] = c->width / 2;
-    picture->linesize[2] = c->width / 2;
-
-    /* encode 1 second of video */
-    for(i=0;i<25;i++) {
-        fflush(stdout);
-        /* prepare a dummy image */
-        /* Y */
-        for(y=0;y<c->height;y++) {
-            for(x=0;x<c->width;x++) {
-                picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
-            }
-        }
-
-        /* Cb and Cr */
-        for(y=0;y<c->height/2;y++) {
-            for(x=0;x<c->width/2;x++) {
-                picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
-                picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
-            }
-        }
-
-        /* encode the image */
-        out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
-        printf("encoding frame %3d (size=%5d)\n", i, out_size);
-        fwrite(outbuf, 1, out_size, f);
-    }
-
-    /* get the delayed frames */
-    for(; out_size; i++) {
-        fflush(stdout);
-
-        out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
-        printf("write frame %3d (size=%5d)\n", i, out_size);
-        fwrite(outbuf, 1, out_size, f);
-    }
-
-    /* add sequence end code to have a real mpeg file */
-    outbuf[0] = 0x00;
-    outbuf[1] = 0x00;
-    outbuf[2] = 0x01;
-    outbuf[3] = 0xb7;
-    fwrite(outbuf, 1, 4, f);
-    fclose(f);
-    free(picture_buf);
-    free(outbuf);
-
-    avcodec_close(c);
-    av_free(c);
-    av_free(picture);
-    printf("\n");
-}
-
-/*
- * Video decoding example
- */
-
-static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize,
-                     char *filename)
-{
-    FILE *f;
-    int i;
-
-    f=fopen(filename,"w");
-    fprintf(f,"P5\n%d %d\n%d\n",xsize,ysize,255);
-    for(i=0;i<ysize;i++)
-        fwrite(buf + i * wrap,1,xsize,f);
-    fclose(f);
-}
-
-static void video_decode_example(const char *outfilename, const char *filename)
-{
-    AVCodec *codec;
-    AVCodecContext *c= NULL;
-    int frame, got_picture, len;
-    FILE *f;
-    AVFrame *picture;
-    uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
-    char buf[1024];
-    AVPacket avpkt;
-
-    av_init_packet(&avpkt);
-
-    /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
-    memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
-    printf("Video decoding\n");
-
-    /* find the mpeg1 video decoder */
-    codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO);
-    if (!codec) {
-        fprintf(stderr, "codec not found\n");
-        exit(1);
-    }
-
-    c= avcodec_alloc_context();
-    picture= avcodec_alloc_frame();
-
-    if(codec->capabilities&CODEC_CAP_TRUNCATED)
-        c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */
-
-    /* For some codecs, such as msmpeg4 and mpeg4, width and height
-       MUST be initialized there because this information is not
-       available in the bitstream. */
-
-    /* open it */
-    if (avcodec_open(c, codec) < 0) {
-        fprintf(stderr, "could not open codec\n");
-        exit(1);
-    }
-
-    /* the codec gives us the frame size, in samples */
-
-    f = fopen(filename, "rb");
-    if (!f) {
-        fprintf(stderr, "could not open %s\n", filename);
-        exit(1);
-    }
-
-    frame = 0;
-    for(;;) {
-        avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);
-        if (avpkt.size == 0)
-            break;
-
-        /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio)
-           and this is the only method to use them because you cannot
-           know the compressed data size before analysing it.
-
-           BUT some other codecs (msmpeg4, mpeg4) are inherently frame
-           based, so you must call them with all the data for one
-           frame exactly. You must also initialize 'width' and
-           'height' before initializing them. */
-
-        /* NOTE2: some codecs allow the raw parameters (frame size,
-           sample rate) to be changed at any frame. We handle this, so
-           you should also take care of it */
-
-        /* here, we use a stream based decoder (mpeg1video), so we
-           feed decoder and see if it could decode a frame */
-        avpkt.data = inbuf;
-        while (avpkt.size > 0) {
-            len = avcodec_decode_video2(c, picture, &got_picture, &avpkt);
-            if (len < 0) {
-                fprintf(stderr, "Error while decoding frame %d\n", frame);
-                exit(1);
-            }
-            if (got_picture) {
-                printf("saving frame %3d\n", frame);
-                fflush(stdout);
-
-                /* the picture is allocated by the decoder. no need to
-                   free it */
-                snprintf(buf, sizeof(buf), outfilename, frame);
-                pgm_save(picture->data[0], picture->linesize[0],
-                         c->width, c->height, buf);
-                frame++;
-            }
-            avpkt.size -= len;
-            avpkt.data += len;
-        }
-    }
-
-    /* some codecs, such as MPEG, transmit the I and P frame with a
-       latency of one frame. You must do the following to have a
-       chance to get the last frame of the video */
-    avpkt.data = NULL;
-    avpkt.size = 0;
-    len = avcodec_decode_video2(c, picture, &got_picture, &avpkt);
-    if (got_picture) {
-        printf("saving last frame %3d\n", frame);
-        fflush(stdout);
-
-        /* the picture is allocated by the decoder. no need to
-           free it */
-        snprintf(buf, sizeof(buf), outfilename, frame);
-        pgm_save(picture->data[0], picture->linesize[0],
-                 c->width, c->height, buf);
-        frame++;
-    }
-
-    fclose(f);
-
-    avcodec_close(c);
-    av_free(c);
-    av_free(picture);
-    printf("\n");
-}
-
-int main(int argc, char **argv)
-{
-    const char *filename;
-
-    /* must be called before using avcodec lib */
-    avcodec_init();
-
-    /* register all the codecs */
-    avcodec_register_all();
-
-    if (argc <= 1) {
-        audio_encode_example("/tmp/test.mp2");
-        audio_decode_example("/tmp/test.sw", "/tmp/test.mp2");
-
-        video_encode_example("/tmp/test.mpg");
-        filename = "/tmp/test.mpg";
-    } else {
-        filename = argv[1];
-    }
-
-    //    audio_decode_example("/tmp/test.sw", filename);
-    video_decode_example("/tmp/test%d.pgm", filename);
-
-    return 0;
-}
diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
deleted file mode 100644
index 46bfc75..0000000
--- a/libavcodec/arm/Makefile
+++ /dev/null
@@ -1,53 +0,0 @@
-OBJS-$(CONFIG_DCA_DECODER)             += arm/dcadsp_init_arm.o         \
-
-OBJS-$(CONFIG_VP5_DECODER)             += arm/vp56dsp_init_arm.o
-OBJS-$(CONFIG_VP6_DECODER)             += arm/vp56dsp_init_arm.o
-
-OBJS-$(CONFIG_H264DSP)                 += arm/h264dsp_init_arm.o        \
-                                          arm/h264pred_init_arm.o       \
-
-OBJS                                   += arm/dsputil_init_arm.o        \
-                                          arm/dsputil_arm.o             \
-                                          arm/fft_init_arm.o            \
-                                          arm/jrevdct_arm.o             \
-                                          arm/mpegvideo_arm.o           \
-                                          arm/simple_idct_arm.o         \
-
-OBJS-$(HAVE_ARMV5TE)                   += arm/dsputil_init_armv5te.o    \
-                                          arm/mpegvideo_armv5te.o       \
-                                          arm/mpegvideo_armv5te_s.o     \
-                                          arm/simple_idct_armv5te.o     \
-
-OBJS-$(HAVE_ARMV6)                     += arm/dsputil_init_armv6.o      \
-                                          arm/dsputil_armv6.o           \
-                                          arm/simple_idct_armv6.o       \
-
-OBJS-$(HAVE_ARMVFP)                    += arm/dsputil_vfp.o             \
-                                          arm/dsputil_init_vfp.o        \
-
-OBJS-$(HAVE_IWMMXT)                    += arm/dsputil_iwmmxt.o          \
-                                          arm/mpegvideo_iwmmxt.o        \
-
-NEON-OBJS-$(CONFIG_FFT)                += arm/fft_neon.o                \
-
-NEON-OBJS-$(CONFIG_MDCT)               += arm/mdct_neon.o               \
-
-NEON-OBJS-$(CONFIG_RDFT)               += arm/rdft_neon.o               \
-
-NEON-OBJS-$(CONFIG_H264DSP)            += arm/h264dsp_neon.o            \
-                                          arm/h264idct_neon.o           \
-                                          arm/h264pred_neon.o           \
-
-NEON-OBJS-$(CONFIG_DCA_DECODER)        += arm/dcadsp_neon.o             \
-                                          arm/synth_filter_neon.o       \
-
-NEON-OBJS-$(CONFIG_VP3_DECODER)        += arm/vp3dsp_neon.o
-
-NEON-OBJS-$(CONFIG_VP5_DECODER)        += arm/vp56dsp_neon.o
-NEON-OBJS-$(CONFIG_VP6_DECODER)        += arm/vp56dsp_neon.o
-
-OBJS-$(HAVE_NEON)                      += arm/dsputil_init_neon.o       \
-                                          arm/dsputil_neon.o            \
-                                          arm/int_neon.o                \
-                                          arm/simple_idct_neon.o        \
-                                          $(NEON-OBJS-yes)
diff --git a/libavcodec/arm/aac.h b/libavcodec/arm/aac.h
deleted file mode 100644
index 390cdbf..0000000
--- a/libavcodec/arm/aac.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ARM_AAC_H
-#define AVCODEC_ARM_AAC_H
-
-#include "config.h"
-
-#if HAVE_NEON && HAVE_INLINE_ASM
-
-#define VMUL2 VMUL2
-static inline float *VMUL2(float *dst, const float *v, unsigned idx,
-                           const float *scale)
-{
-    unsigned v0, v1;
-    __asm__ volatile ("ubfx     %0,  %4,  #0, #4      \n\t"
-                      "ubfx     %1,  %4,  #4, #4      \n\t"
-                      "ldr      %0,  [%3, %0, lsl #2] \n\t"
-                      "ldr      %1,  [%3, %1, lsl #2] \n\t"
-                      "vld1.32  {d1[]},   [%5,:32]    \n\t"
-                      "vmov     d0,  %0,  %1          \n\t"
-                      "vmul.f32 d0,  d0,  d1          \n\t"
-                      "vst1.32  {d0},     [%2,:64]!   \n\t"
-                      : "=&r"(v0), "=&r"(v1), "+r"(dst)
-                      : "r"(v), "r"(idx), "r"(scale)
-                      : "d0", "d1");
-    return dst;
-}
-
-#define VMUL4 VMUL4
-static inline float *VMUL4(float *dst, const float *v, unsigned idx,
-                           const float *scale)
-{
-    unsigned v0, v1, v2, v3;
-    __asm__ volatile ("ubfx     %0,  %6,  #0, #2      \n\t"
-                      "ubfx     %1,  %6,  #2, #2      \n\t"
-                      "ldr      %0,  [%5, %0, lsl #2] \n\t"
-                      "ubfx     %2,  %6,  #4, #2      \n\t"
-                      "ldr      %1,  [%5, %1, lsl #2] \n\t"
-                      "ubfx     %3,  %6,  #6, #2      \n\t"
-                      "ldr      %2,  [%5, %2, lsl #2] \n\t"
-                      "vmov     d0,  %0,  %1          \n\t"
-                      "ldr      %3,  [%5, %3, lsl #2] \n\t"
-                      "vld1.32  {d2[],d3[]},[%7,:32]  \n\t"
-                      "vmov     d1,  %2,  %3          \n\t"
-                      "vmul.f32 q0,  q0,  q1          \n\t"
-                      "vst1.32  {q0},     [%4,:128]!  \n\t"
-                      : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst)
-                      : "r"(v), "r"(idx), "r"(scale)
-                      : "d0", "d1", "d2", "d3");
-    return dst;
-}
-
-#define VMUL2S VMUL2S
-static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
-                            unsigned sign, const float *scale)
-{
-    unsigned v0, v1, v2, v3;
-    __asm__ volatile ("ubfx     %0,  %6,  #0, #4      \n\t"
-                      "ubfx     %1,  %6,  #4, #4      \n\t"
-                      "ldr      %0,  [%5, %0, lsl #2] \n\t"
-                      "lsl      %2,  %8,  #30         \n\t"
-                      "ldr      %1,  [%5, %1, lsl #2] \n\t"
-                      "lsl      %3,  %8,  #31         \n\t"
-                      "vmov     d0,  %0,  %1          \n\t"
-                      "bic      %2,  %2,  #1<<30      \n\t"
-                      "vld1.32  {d1[]},   [%7,:32]    \n\t"
-                      "vmov     d2,  %2,  %3          \n\t"
-                      "veor     d0,  d0,  d2          \n\t"
-                      "vmul.f32 d0,  d0,  d1          \n\t"
-                      "vst1.32  {d0},     [%4,:64]!   \n\t"
-                      : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst)
-                      : "r"(v), "r"(idx), "r"(scale), "r"(sign)
-                      : "d0", "d1", "d2");
-    return dst;
-}
-
-#define VMUL4S VMUL4S
-static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
-                            unsigned sign, const float *scale)
-{
-    unsigned v0, v1, v2, v3, nz;
-    __asm__ volatile ("vld1.32  {d2[],d3[]},[%9,:32]  \n\t"
-                      "ubfx     %0,  %8,  #0, #2      \n\t"
-                      "ubfx     %1,  %8,  #2, #2      \n\t"
-                      "ldr      %0,  [%7, %0, lsl #2] \n\t"
-                      "ubfx     %2,  %8,  #4, #2      \n\t"
-                      "ldr      %1,  [%7, %1, lsl #2] \n\t"
-                      "ubfx     %3,  %8,  #6, #2      \n\t"
-                      "ldr      %2,  [%7, %2, lsl #2] \n\t"
-                      "vmov     d0,  %0,  %1          \n\t"
-                      "ldr      %3,  [%7, %3, lsl #2] \n\t"
-                      "lsr      %6,  %8,  #12         \n\t"
-                      "rbit     %6,  %6               \n\t"
-                      "vmov     d1,  %2,  %3          \n\t"
-                      "lsls     %6,  %6,  #1          \n\t"
-                      "and      %0,  %5,  #1<<31      \n\t"
-                      "lslcs    %5,  %5,  #1          \n\t"
-                      "lsls     %6,  %6,  #1          \n\t"
-                      "and      %1,  %5,  #1<<31      \n\t"
-                      "lslcs    %5,  %5,  #1          \n\t"
-                      "lsls     %6,  %6,  #1          \n\t"
-                      "and      %2,  %5,  #1<<31      \n\t"
-                      "lslcs    %5,  %5,  #1          \n\t"
-                      "vmov     d4,  %0,  %1          \n\t"
-                      "and      %3,  %5,  #1<<31      \n\t"
-                      "vmov     d5,  %2,  %3          \n\t"
-                      "veor     q0,  q0,  q2          \n\t"
-                      "vmul.f32 q0,  q0,  q1          \n\t"
-                      "vst1.32  {q0},     [%4,:128]!  \n\t"
-                      : "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
-                        "+r"(sign), "=r"(nz)
-                      : "r"(v), "r"(idx), "r"(scale)
-                      : "d0", "d1", "d2", "d3", "d4", "d5");
-    return dst;
-}
-
-#endif /* HAVE_NEON && HAVE_INLINE_ASM */
-
-#endif /* AVCODEC_ARM_AAC_H */
diff --git a/libavcodec/arm/asm.S b/libavcodec/arm/asm.S
deleted file mode 100644
index 17139b4..0000000
--- a/libavcodec/arm/asm.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-
-#ifdef __ELF__
-#   define ELF
-#else
-#   define ELF @
-#endif
-
-        .macro require8, val=1
-ELF     .eabi_attribute 24, \val
-        .endm
-
-        .macro preserve8, val=1
-ELF     .eabi_attribute 25, \val
-        .endm
-
-        .macro function name, export=0
-        .macro endfunc
-ELF     .size   \name, . - \name
-        .endfunc
-        .purgem endfunc
-        .endm
-.if \export
-        .global EXTERN_ASM\name
-EXTERN_ASM\name:
-.endif
-ELF     .type   \name, %function
-        .func   \name
-\name:
-        .endm
-
-        .macro movrel rd, val
-#if HAVE_ARMV6T2 && !CONFIG_PIC
-        movw            \rd, #:lower16:\val
-        movt            \rd, #:upper16:\val
-#else
-        ldr             \rd, =\val
-#endif
-        .endm
-
-#if HAVE_VFP_ARGS
-        .eabi_attribute 28, 1
-#   define VFP
-#   define NOVFP @
-#else
-#   define VFP   @
-#   define NOVFP
-#endif
-
-#define GLUE(a, b) a ## b
-#define JOIN(a, b) GLUE(a, b)
-#define X(s) JOIN(EXTERN_ASM, s)
diff --git a/libavcodec/arm/dcadsp_init_arm.c b/libavcodec/arm/dcadsp_init_arm.c
deleted file mode 100644
index 816718d..0000000
--- a/libavcodec/arm/dcadsp_init_arm.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "libavutil/attributes.h"
-#include "libavcodec/dcadsp.h"
-
-void ff_dca_lfe_fir_neon(float *out, const float *in, const float *coefs,
-                         int decifactor, float scale, float bias);
-
-void av_cold ff_dcadsp_init_arm(DCADSPContext *s)
-{
-    if (HAVE_NEON)
-        s->lfe_fir = ff_dca_lfe_fir_neon;
-}
diff --git a/libavcodec/arm/dcadsp_neon.S b/libavcodec/arm/dcadsp_neon.S
deleted file mode 100644
index 19960ab..0000000
--- a/libavcodec/arm/dcadsp_neon.S
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-function ff_dca_lfe_fir_neon, export=1
-        push            {r4-r6,lr}
-
-        add             r4,  r0,  r3,  lsl #2   @ out2
-        add             r5,  r2,  #256*4-16     @ cf1
-        sub             r1,  r1,  #12
-        cmp             r3,  #32
-        moveq           r6,  #256/32
-        movne           r6,  #256/64
-NOVFP   vldr            d0,  [sp, #16]          @ scale, bias
-        mov             lr,  #-16
-1:
-        vmov.f32        q2,  #0.0               @ v0
-        vmov.f32        q3,  #0.0               @ v1
-        mov             r12, r6
-2:
-        vld1.32         {q8},     [r2,:128]!    @ cf0
-        vld1.32         {q9},     [r5,:128], lr @ cf1
-        vld1.32         {q1},     [r1], lr      @ in
-        subs            r12, r12, #4
-        vrev64.32       q10, q8
-        vmla.f32        q3,  q1,  q9
-        vmla.f32        d4,  d2,  d21
-        vmla.f32        d5,  d3,  d20
-        bne             2b
-
-        add             r1,  r1,  r6,  lsl #2
-        subs            r3,  r3,  #1
-        vadd.f32        d4,  d4,  d5
-        vadd.f32        d6,  d6,  d7
-        vpadd.f32       d4,  d4,  d6
-        vdup.32         d5,  d0[1]
-        vmla.f32        d5,  d4,  d0[0]
-        vst1.32         {d5[0]},  [r0,:32]!
-        vst1.32         {d5[1]},  [r4,:32]!
-        bne             1b
-
-        pop             {r4-r6,pc}
-endfunc
diff --git a/libavcodec/arm/dsputil_arm.S b/libavcodec/arm/dsputil_arm.S
deleted file mode 100644
index 7ee85e8..0000000
--- a/libavcodec/arm/dsputil_arm.S
+++ /dev/null
@@ -1,712 +0,0 @@
-@
-@ ARMv4 optimized DSP utils
-@ Copyright (c) 2004 AGAWA Koji <i (AT) atty (DOT) jp>
-@
-@ This file is part of FFmpeg.
-@
-@ FFmpeg 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.
-@
-@ FFmpeg 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 FFmpeg; if not, write to the Free Software
-@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-@
-
-#include "config.h"
-#include "asm.S"
-
-        preserve8
-
-#if !HAVE_PLD
-.macro pld reg
-.endm
-#endif
-
-#if HAVE_ARMV5TE
-function ff_prefetch_arm, export=1
-        subs            r2,  r2,  #1
-        pld             [r0]
-        add             r0,  r0,  r1
-        bne             ff_prefetch_arm
-        bx              lr
-endfunc
-#endif
-
-.macro  ALIGN_QWORD_D shift, Rd0, Rd1, Rd2, Rd3, Rn0, Rn1, Rn2, Rn3, Rn4
-        mov             \Rd0, \Rn0, lsr #(\shift * 8)
-        mov             \Rd1, \Rn1, lsr #(\shift * 8)
-        mov             \Rd2, \Rn2, lsr #(\shift * 8)
-        mov             \Rd3, \Rn3, lsr #(\shift * 8)
-        orr             \Rd0, \Rd0, \Rn1, lsl #(32 - \shift * 8)
-        orr             \Rd1, \Rd1, \Rn2, lsl #(32 - \shift * 8)
-        orr             \Rd2, \Rd2, \Rn3, lsl #(32 - \shift * 8)
-        orr             \Rd3, \Rd3, \Rn4, lsl #(32 - \shift * 8)
-.endm
-.macro  ALIGN_DWORD shift, R0, R1, R2
-        mov             \R0, \R0, lsr #(\shift * 8)
-        orr             \R0, \R0, \R1, lsl #(32 - \shift * 8)
-        mov             \R1, \R1, lsr #(\shift * 8)
-        orr             \R1, \R1, \R2, lsl #(32 - \shift * 8)
-.endm
-.macro  ALIGN_DWORD_D shift, Rdst0, Rdst1, Rsrc0, Rsrc1, Rsrc2
-        mov             \Rdst0, \Rsrc0, lsr #(\shift * 8)
-        mov             \Rdst1, \Rsrc1, lsr #(\shift * 8)
-        orr             \Rdst0, \Rdst0, \Rsrc1, lsl #(32 - (\shift * 8))
-        orr             \Rdst1, \Rdst1, \Rsrc2, lsl #(32 - (\shift * 8))
-.endm
-
-.macro  RND_AVG32 Rd0, Rd1, Rn0, Rn1, Rm0, Rm1, Rmask
-        @ Rd = (Rn | Rm) - (((Rn ^ Rm) & ~0x01010101) >> 1)
-        @ Rmask = 0xFEFEFEFE
-        @ Rn = destroy
-        eor             \Rd0, \Rn0, \Rm0
-        eor             \Rd1, \Rn1, \Rm1
-        orr             \Rn0, \Rn0, \Rm0
-        orr             \Rn1, \Rn1, \Rm1
-        and             \Rd0, \Rd0, \Rmask
-        and             \Rd1, \Rd1, \Rmask
-        sub             \Rd0, \Rn0, \Rd0, lsr #1
-        sub             \Rd1, \Rn1, \Rd1, lsr #1
-.endm
-
-.macro  NO_RND_AVG32 Rd0, Rd1, Rn0, Rn1, Rm0, Rm1, Rmask
-        @ Rd = (Rn & Rm) - (((Rn ^ Rm) & ~0x01010101) >> 1)
-        @ Rmask = 0xFEFEFEFE
-        @ Rn = destroy
-        eor             \Rd0, \Rn0, \Rm0
-        eor             \Rd1, \Rn1, \Rm1
-        and             \Rn0, \Rn0, \Rm0
-        and             \Rn1, \Rn1, \Rm1
-        and             \Rd0, \Rd0, \Rmask
-        and             \Rd1, \Rd1, \Rmask
-        add             \Rd0, \Rn0, \Rd0, lsr #1
-        add             \Rd1, \Rn1, \Rd1, lsr #1
-.endm
-
-.macro  JMP_ALIGN tmp, reg
-        ands            \tmp, \reg, #3
-        bic             \reg, \reg, #3
-        beq             1f
-        subs            \tmp, \tmp, #1
-        beq             2f
-        subs            \tmp, \tmp, #1
-        beq             3f
-        b    4f
-.endm
-
-@ ----------------------------------------------------------------
-        .align 5
-function ff_put_pixels16_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r11, lr}
-        JMP_ALIGN       r5,  r1
-1:
-        ldm             r1,  {r4-r7}
-        add             r1,  r1,  r2
-        stm             r0,  {r4-r7}
-        pld             [r1]
-        subs            r3,  r3,  #1
-        add             r0,  r0,  r2
-        bne             1b
-        pop             {r4-r11, pc}
-        .align 5
-2:
-        ldm             r1,  {r4-r8}
-        add             r1,  r1,  r2
-        ALIGN_QWORD_D   1,   r9,  r10, r11, r12, r4,  r5,  r6,  r7,  r8
-        pld             [r1]
-        subs            r3,  r3,  #1
-        stm             r0,  {r9-r12}
-        add             r0,  r0,  r2
-        bne             2b
-        pop             {r4-r11, pc}
-        .align 5
-3:
-        ldm             r1,  {r4-r8}
-        add             r1,  r1,  r2
-        ALIGN_QWORD_D   2,   r9,  r10, r11, r12, r4,  r5,  r6,  r7,  r8
-        pld             [r1]
-        subs            r3,  r3,  #1
-        stm             r0,  {r9-r12}
-        add             r0,  r0,  r2
-        bne             3b
-        pop             {r4-r11, pc}
-        .align 5
-4:
-        ldm             r1,  {r4-r8}
-        add             r1,  r1,  r2
-        ALIGN_QWORD_D   3,   r9,  r10, r11, r12, r4,  r5,  r6,  r7,  r8
-        pld             [r1]
-        subs            r3,  r3,  #1
-        stm             r0,  {r9-r12}
-        add             r0,  r0,  r2
-        bne             4b
-        pop             {r4-r11,pc}
-endfunc
-
-@ ----------------------------------------------------------------
-        .align 5
-function ff_put_pixels8_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r5,lr}
-        JMP_ALIGN       r5,  r1
-1:
-        ldm             r1,  {r4-r5}
-        add             r1,  r1,  r2
-        subs            r3,  r3,  #1
-        pld             [r1]
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             1b
-        pop             {r4-r5,pc}
-        .align 5
-2:
-        ldm             r1,  {r4-r5, r12}
-        add             r1,  r1,  r2
-        ALIGN_DWORD     1,   r4,  r5,  r12
-        pld             [r1]
-        subs            r3,  r3,  #1
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             2b
-        pop             {r4-r5,pc}
-        .align 5
-3:
-        ldm             r1,  {r4-r5, r12}
-        add             r1,  r1,  r2
-        ALIGN_DWORD     2,   r4,  r5,  r12
-        pld             [r1]
-        subs            r3,  r3,  #1
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             3b
-        pop             {r4-r5,pc}
-        .align 5
-4:
-        ldm             r1,  {r4-r5, r12}
-        add             r1,  r1,  r2
-        ALIGN_DWORD     3,   r4,  r5,  r12
-        pld             [r1]
-        subs            r3,  r3,  #1
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             4b
-        pop             {r4-r5,pc}
-endfunc
-
-@ ----------------------------------------------------------------
-        .align 5
-function ff_put_pixels8_x2_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r10,lr}
-        ldr             r12, =0xfefefefe
-        JMP_ALIGN       r5,  r1
-1:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   1,   r6,  r7,  r4,  r5,  r10
-        pld             [r1]
-        RND_AVG32       r8,  r9,  r4,  r5,  r6,  r7,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        bne             1b
-        pop             {r4-r10,pc}
-        .align 5
-2:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   1,   r6,  r7,  r4,  r5,  r10
-        ALIGN_DWORD_D   2,   r8,  r9,  r4,  r5,  r10
-        pld             [r1]
-        RND_AVG32       r4,  r5,  r6,  r7,  r8,  r9,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             2b
-        pop             {r4-r10,pc}
-        .align 5
-3:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   2,   r6,  r7,  r4,  r5,  r10
-        ALIGN_DWORD_D   3,   r8,  r9,  r4,  r5,  r10
-        pld             [r1]
-        RND_AVG32       r4,  r5,  r6,  r7,  r8,  r9,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             3b
-        pop             {r4-r10,pc}
-        .align 5
-4:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   3,   r6,  r7,  r4,  r5,  r10
-        pld             [r1]
-        RND_AVG32       r8,  r9,  r6,  r7,  r5,  r10, r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        bne             4b
-        pop             {r4-r10,pc}
-endfunc
-
-        .align 5
-function ff_put_no_rnd_pixels8_x2_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r10,lr}
-        ldr             r12, =0xfefefefe
-        JMP_ALIGN       r5,  r1
-1:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   1,   r6,  r7,  r4,  r5,  r10
-        pld             [r1]
-        NO_RND_AVG32    r8,  r9,  r4,  r5,  r6,  r7,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        bne             1b
-        pop             {r4-r10,pc}
-        .align 5
-2:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   1,   r6,  r7,  r4,  r5,  r10
-        ALIGN_DWORD_D   2,   r8,  r9,  r4,  r5,  r10
-        pld             [r1]
-        NO_RND_AVG32    r4,  r5,  r6,  r7,  r8,  r9,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             2b
-        pop             {r4-r10,pc}
-        .align 5
-3:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   2,   r6,  r7,  r4,  r5,  r10
-        ALIGN_DWORD_D   3,   r8,  r9,  r4,  r5,  r10
-        pld             [r1]
-        NO_RND_AVG32    r4,  r5,  r6,  r7,  r8,  r9,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bne             3b
-        pop             {r4-r10,pc}
-        .align 5
-4:
-        ldm             r1,  {r4-r5, r10}
-        add             r1,  r1,  r2
-        ALIGN_DWORD_D   3,   r6,  r7,  r4,  r5,  r10
-        pld             [r1]
-        NO_RND_AVG32    r8,  r9,  r6,  r7,  r5,  r10, r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        bne             4b
-        pop             {r4-r10,pc}
-endfunc
-
-
-@ ----------------------------------------------------------------
-        .align 5
-function ff_put_pixels8_y2_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r11,lr}
-        mov             r3,  r3,  lsr #1
-        ldr             r12, =0xfefefefe
-        JMP_ALIGN       r5,  r1
-1:
-        ldm             r1,  {r4-r5}
-        add             r1,  r1,  r2
-6:      ldm             r1,  {r6-r7}
-        add             r1,  r1,  r2
-        pld             [r1]
-        RND_AVG32       r8,  r9,  r4,  r5,  r6,  r7,  r12
-        ldm             r1,  {r4-r5}
-        add             r1,  r1,  r2
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        pld             [r1]
-        RND_AVG32       r8,  r9,  r6,  r7,  r4,  r5,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-        .align 5
-2:
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     1,   r4,  r5,  r6
-6:      ldm             r1,  {r7-r9}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     1,   r7,  r8,  r9
-        RND_AVG32       r10, r11, r4,  r5,  r7,  r8,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     1,   r4,  r5,  r6
-        subs            r3,  r3,  #1
-        RND_AVG32       r10, r11, r7,  r8,  r4,  r5,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-        .align 5
-3:
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     2,   r4,  r5,  r6
-6:      ldm             r1,  {r7-r9}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     2,   r7,  r8,  r9
-        RND_AVG32       r10, r11, r4,  r5,  r7,  r8,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     2,   r4,  r5,  r6
-        subs            r3,  r3,  #1
-        RND_AVG32       r10, r11, r7,  r8,  r4,  r5,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-        .align 5
-4:
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     3,   r4,  r5,  r6
-6:      ldm             r1,  {r7-r9}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     3,   r7,  r8,  r9
-        RND_AVG32       r10, r11, r4,  r5,  r7,  r8,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     3,   r4,  r5,  r6
-        subs            r3,  r3,  #1
-        RND_AVG32       r10, r11, r7,  r8,  r4,  r5,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-endfunc
-
-        .align 5
-function ff_put_no_rnd_pixels8_y2_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r11,lr}
-        mov             r3,  r3,  lsr #1
-        ldr             r12, =0xfefefefe
-        JMP_ALIGN       r5,  r1
-1:
-        ldm             r1,  {r4-r5}
-        add             r1,  r1,  r2
-6:      ldm             r1,  {r6-r7}
-        add             r1,  r1,  r2
-        pld             [r1]
-        NO_RND_AVG32    r8,  r9,  r4,  r5,  r6,  r7,  r12
-        ldm             r1,  {r4-r5}
-        add             r1,  r1,  r2
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        pld             [r1]
-        NO_RND_AVG32    r8,  r9,  r6,  r7,  r4,  r5,  r12
-        subs            r3,  r3,  #1
-        stm             r0,  {r8-r9}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-        .align 5
-2:
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     1,   r4,  r5,  r6
-6:      ldm             r1,  {r7-r9}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     1,   r7,  r8,  r9
-        NO_RND_AVG32    r10, r11, r4,  r5,  r7,  r8,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     1,   r4,  r5,  r6
-        subs            r3,  r3,  #1
-        NO_RND_AVG32    r10, r11, r7,  r8,  r4,  r5,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-        .align 5
-3:
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     2,   r4,  r5,  r6
-6:      ldm             r1,  {r7-r9}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     2,   r7,  r8,  r9
-        NO_RND_AVG32    r10, r11, r4,  r5,  r7,  r8,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     2,   r4,  r5,  r6
-        subs            r3,  r3,  #1
-        NO_RND_AVG32    r10, r11, r7,  r8,  r4,  r5,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-        .align 5
-4:
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     3,   r4,  r5,  r6
-6:      ldm             r1,  {r7-r9}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     3,   r7,  r8,  r9
-        NO_RND_AVG32    r10, r11, r4,  r5,  r7,  r8,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        ldm             r1,  {r4-r6}
-        add             r1,  r1,  r2
-        pld             [r1]
-        ALIGN_DWORD     3,   r4,  r5,  r6
-        subs            r3,  r3,  #1
-        NO_RND_AVG32    r10, r11, r7,  r8,  r4,  r5,  r12
-        stm             r0,  {r10-r11}
-        add             r0,  r0,  r2
-        bne             6b
-        pop             {r4-r11,pc}
-endfunc
-
-        .ltorg
-
-@ ----------------------------------------------------------------
-.macro  RND_XY2_IT align, rnd
-        @ l1=  (a & 0x03030303) + (b & 0x03030303) ?(+ 0x02020202)
-        @ h1= ((a & 0xFCFCFCFCUL) >> 2) + ((b & 0xFCFCFCFCUL) >> 2)
-.if \align == 0
-        ldm             r1,  {r6-r8}
-.elseif \align == 3
-        ldm             r1,  {r5-r7}
-.else
-        ldm             r1,  {r8-r10}
-.endif
-        add             r1,  r1,  r2
-        pld             [r1]
-.if \align == 0
-        ALIGN_DWORD_D   1,   r4,  r5,  r6,  r7,  r8
-.elseif \align == 1
-        ALIGN_DWORD_D   1,   r4,  r5,  r8,  r9,  r10
-        ALIGN_DWORD_D   2,   r6,  r7,  r8,  r9,  r10
-.elseif \align == 2
-        ALIGN_DWORD_D   2,   r4,  r5,  r8,  r9,  r10
-        ALIGN_DWORD_D   3,   r6,  r7,  r8,  r9,  r10
-.elseif \align == 3
-        ALIGN_DWORD_D   3,   r4,  r5,  r5,  r6,  r7
-.endif
-        ldr             r14, =0x03030303
-        tst             r3,  #1
-        and             r8,  r4,  r14
-        and             r9,  r5,  r14
-        and             r10, r6,  r14
-        and             r11, r7,  r14
-        andeq           r14, r14, r14, \rnd #1
-        add             r8,  r8,  r10
-        add             r9,  r9,  r11
-        ldr             r12, =0xfcfcfcfc >> 2
-        addeq           r8,  r8,  r14
-        addeq           r9,  r9,  r14
-        and             r4,  r12, r4,  lsr #2
-        and             r5,  r12, r5,  lsr #2
-        and             r6,  r12, r6,  lsr #2
-        and             r7,  r12, r7,  lsr #2
-        add             r10, r4,  r6
-        add             r11, r5,  r7
-        subs            r3,  r3,  #1
-.endm
-
-.macro RND_XY2_EXPAND align, rnd
-        RND_XY2_IT      \align, \rnd
-6:      push            {r8-r11}
-        RND_XY2_IT      \align, \rnd
-        pop             {r4-r7}
-        add             r4,  r4,  r8
-        add             r5,  r5,  r9
-        ldr             r14, =0x0f0f0f0f
-        add             r6,  r6,  r10
-        add             r7,  r7,  r11
-        and             r4,  r14, r4,  lsr #2
-        and             r5,  r14, r5,  lsr #2
-        add             r4,  r4,  r6
-        add             r5,  r5,  r7
-        stm             r0,  {r4-r5}
-        add             r0,  r0,  r2
-        bge             6b
-        pop             {r4-r11,pc}
-.endm
-
-        .align 5
-function ff_put_pixels8_xy2_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r11,lr} @ R14 is also called LR
-        JMP_ALIGN       r5,  r1
-1:      RND_XY2_EXPAND  0, lsl
-        .align 5
-2:      RND_XY2_EXPAND  1, lsl
-        .align 5
-3:      RND_XY2_EXPAND  2, lsl
-        .align 5
-4:      RND_XY2_EXPAND  3, lsl
-endfunc
-
-        .align 5
-function ff_put_no_rnd_pixels8_xy2_arm, export=1
-        @ void func(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-        @ block = word aligned, pixles = unaligned
-        pld             [r1]
-        push            {r4-r11,lr}
-        JMP_ALIGN       r5,  r1
-1:      RND_XY2_EXPAND  0, lsr
-        .align 5
-2:      RND_XY2_EXPAND  1, lsr
-        .align 5
-3:      RND_XY2_EXPAND  2, lsr
-        .align 5
-4:      RND_XY2_EXPAND  3, lsr
-endfunc
-
-        .align 5
-@ void ff_add_pixels_clamped_arm(int16_t *block, uint8_t *dest, int stride)
-function ff_add_pixels_clamped_arm, export=1
-        push            {r4-r10}
-        mov             r10, #8
-1:
-        ldr             r4,  [r1]               /* load dest */
-        /* block[0] and block[1]*/
-        ldrsh           r5,  [r0]
-        ldrsh           r7,  [r0, #2]
-        and             r6,  r4,  #0xFF
-        and             r8,  r4,  #0xFF00
-        add             r6,  r5,  r6
-        add             r8,  r7,  r8,  lsr #8
-        mvn             r5,  r5
-        mvn             r7,  r7
-        tst             r6,  #0x100
-        movne           r6,  r5,  lsr #24
-        tst             r8,  #0x100
-        movne           r8,  r7,  lsr #24
-        mov             r9,  r6
-        ldrsh           r5,  [r0, #4]           /* moved form [A] */
-        orr             r9,  r9,  r8,  lsl #8
-        /* block[2] and block[3] */
-        /* [A] */
-        ldrsh           r7,  [r0, #6]
-        and             r6,  r4,  #0xFF0000
-        and             r8,  r4,  #0xFF000000
-        add             r6,  r5,  r6,  lsr #16
-        add             r8,  r7,  r8,  lsr #24
-        mvn             r5,  r5
-        mvn             r7,  r7
-        tst             r6,  #0x100
-        movne           r6,  r5,  lsr #24
-        tst             r8,  #0x100
-        movne           r8,  r7,  lsr #24
-        orr             r9,  r9,  r6,  lsl #16
-        ldr             r4,  [r1, #4]           /* moved form [B] */
-        orr             r9,  r9,  r8,  lsl #24
-        /* store dest */
-        ldrsh           r5,  [r0, #8]           /* moved form [C] */
-        str             r9,  [r1]
-
-        /* load dest */
-        /* [B] */
-        /* block[4] and block[5] */
-        /* [C] */
-        ldrsh           r7,  [r0, #10]
-        and             r6,  r4,  #0xFF
-        and             r8,  r4,  #0xFF00
-        add             r6,  r5,  r6
-        add             r8,  r7,  r8,  lsr #8
-        mvn             r5,  r5
-        mvn             r7,  r7
-        tst             r6,  #0x100
-        movne           r6,  r5,  lsr #24
-        tst             r8,  #0x100
-        movne           r8,  r7,  lsr #24
-        mov             r9,  r6
-        ldrsh           r5,  [r0, #12]          /* moved from [D] */
-        orr             r9,  r9,  r8,  lsl #8
-        /* block[6] and block[7] */
-        /* [D] */
-        ldrsh           r7,  [r0, #14]
-        and             r6,  r4,  #0xFF0000
-        and             r8,  r4,  #0xFF000000
-        add             r6,  r5,  r6,  lsr #16
-        add             r8,  r7,  r8,  lsr #24
-        mvn             r5,  r5
-        mvn             r7,  r7
-        tst             r6,  #0x100
-        movne           r6,  r5,  lsr #24
-        tst             r8,  #0x100
-        movne           r8,  r7,  lsr #24
-        orr             r9,  r9,  r6,  lsl #16
-        add             r0,  r0,  #16           /* moved from [E] */
-        orr             r9,  r9,  r8,  lsl #24
-        subs            r10, r10, #1            /* moved from [F] */
-        /* store dest */
-        str             r9,  [r1, #4]
-
-        /* [E] */
-        /* [F] */
-        add             r1,  r1,  r2
-        bne             1b
-
-        pop             {r4-r10}
-        bx              lr
-endfunc
diff --git a/libavcodec/arm/dsputil_arm.h b/libavcodec/arm/dsputil_arm.h
deleted file mode 100644
index 7f8579d..0000000
--- a/libavcodec/arm/dsputil_arm.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ARM_DSPUTIL_H
-#define AVCODEC_ARM_DSPUTIL_H
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-
-void ff_dsputil_init_armv5te(DSPContext* c, AVCodecContext *avctx);
-void ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx);
-void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx);
-void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx);
-void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx);
-
-#endif
diff --git a/libavcodec/arm/dsputil_armv6.S b/libavcodec/arm/dsputil_armv6.S
deleted file mode 100644
index 214d947..0000000
--- a/libavcodec/arm/dsputil_armv6.S
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        preserve8
-
-        .text
-
-.macro  call_2x_pixels  type, subp
-function ff_\type\()_pixels16\subp\()_armv6, export=1
-        push            {r0-r3, lr}
-        bl              ff_\type\()_pixels8\subp\()_armv6
-        pop             {r0-r3, lr}
-        add             r0,  r0,  #8
-        add             r1,  r1,  #8
-        b               ff_\type\()_pixels8\subp\()_armv6
-endfunc
-.endm
-
-call_2x_pixels          avg
-call_2x_pixels          put, _x2
-call_2x_pixels          put, _y2
-call_2x_pixels          put, _x2_no_rnd
-call_2x_pixels          put, _y2_no_rnd
-
-function ff_put_pixels16_armv6, export=1
-        push            {r4-r11}
-1:
-        ldr             r5,  [r1, #4]
-        ldr             r6,  [r1, #8]
-        ldr             r7,  [r1, #12]
-        ldr             r4,  [r1], r2
-        strd            r6,  r7,  [r0, #8]
-        ldr             r9,  [r1, #4]
-        strd            r4,  r5,  [r0],  r2
-        ldr             r10, [r1, #8]
-        ldr             r11, [r1, #12]
-        ldr             r8,  [r1], r2
-        strd            r10, r11, [r0, #8]
-        subs            r3,  r3,  #2
-        strd            r8,  r9,  [r0],  r2
-        bne             1b
-
-        pop             {r4-r11}
-        bx              lr
-endfunc
-
-function ff_put_pixels8_armv6, export=1
-        push            {r4-r7}
-1:
-        ldr             r5,  [r1, #4]
-        ldr             r4,  [r1], r2
-        ldr             r7,  [r1, #4]
-        strd            r4,  r5,  [r0],  r2
-        ldr             r6,  [r1], r2
-        subs            r3,  r3,  #2
-        strd            r6,  r7,  [r0],  r2
-        bne             1b
-
-        pop             {r4-r7}
-        bx              lr
-endfunc
-
-function ff_put_pixels8_x2_armv6, export=1
-        push            {r4-r11, lr}
-        mov             r12, #1
-        orr             r12, r12, r12, lsl #8
-        orr             r12, r12, r12, lsl #16
-1:
-        ldr             r4,  [r1]
-        subs            r3,  r3,  #2
-        ldr             r5,  [r1, #4]
-        ldr             r7,  [r1, #5]
-        lsr             r6,  r4,  #8
-        ldr             r8,  [r1, r2]!
-        orr             r6,  r6,  r5,  lsl #24
-        ldr             r9,  [r1, #4]
-        ldr             r11, [r1, #5]
-        lsr             r10, r8,  #8
-        add             r1,  r1,  r2
-        orr             r10, r10, r9,  lsl #24
-        eor             r14, r4,  r6
-        uhadd8          r4,  r4,  r6
-        eor             r6,  r5,  r7
-        uhadd8          r5,  r5,  r7
-        and             r14, r14, r12
-        and             r6,  r6,  r12
-        uadd8           r4,  r4,  r14
-        eor             r14, r8,  r10
-        uadd8           r5,  r5,  r6
-        eor             r6,  r9,  r11
-        uhadd8          r8,  r8,  r10
-        and             r14, r14, r12
-        uhadd8          r9,  r9,  r11
-        and             r6,  r6,  r12
-        uadd8           r8,  r8,  r14
-        strd            r4,  r5,  [r0],  r2
-        uadd8           r9,  r9,  r6
-        strd            r8,  r9,  [r0],  r2
-        bne             1b
-
-        pop             {r4-r11, pc}
-endfunc
-
-function ff_put_pixels8_y2_armv6, export=1
-        push            {r4-r11}
-        mov             r12, #1
-        orr             r12, r12, r12, lsl #8
-        orr             r12, r12, r12, lsl #16
-        ldr             r4,  [r1]
-        ldr             r5,  [r1, #4]
-        ldr             r6,  [r1, r2]!
-        ldr             r7,  [r1, #4]
-1:
-        subs            r3,  r3,  #2
-        uhadd8          r8,  r4,  r6
-        eor             r10, r4,  r6
-        uhadd8          r9,  r5,  r7
-        eor             r11, r5,  r7
-        and             r10, r10, r12
-        ldr             r4,  [r1, r2]!
-        uadd8           r8,  r8,  r10
-        and             r11, r11, r12
-        uadd8           r9,  r9,  r11
-        ldr             r5,  [r1, #4]
-        uhadd8          r10, r4,  r6
-        eor             r6,  r4,  r6
-        uhadd8          r11, r5,  r7
-        and             r6,  r6,  r12
-        eor             r7,  r5,  r7
-        uadd8           r10, r10, r6
-        and             r7,  r7,  r12
-        ldr             r6,  [r1, r2]!
-        uadd8           r11, r11, r7
-        strd            r8,  r9,  [r0],  r2
-        ldr             r7,  [r1, #4]
-        strd            r10, r11, [r0],  r2
-        bne             1b
-
-        pop             {r4-r11}
-        bx              lr
-endfunc
-
-function ff_put_pixels8_x2_no_rnd_armv6, export=1
-        push            {r4-r9, lr}
-1:
-        subs            r3,  r3,  #2
-        ldr             r4,  [r1]
-        ldr             r5,  [r1, #4]
-        ldr             r7,  [r1, #5]
-        ldr             r8,  [r1, r2]!
-        ldr             r9,  [r1, #4]
-        ldr             r14, [r1, #5]
-        add             r1,  r1,  r2
-        lsr             r6,  r4,  #8
-        orr             r6,  r6,  r5,  lsl #24
-        lsr             r12, r8,  #8
-        orr             r12, r12, r9,  lsl #24
-        uhadd8          r4,  r4,  r6
-        uhadd8          r5,  r5,  r7
-        uhadd8          r8,  r8,  r12
-        uhadd8          r9,  r9,  r14
-        stm             r0,  {r4,r5}
-        add             r0,  r0,  r2
-        stm             r0,  {r8,r9}
-        add             r0,  r0,  r2
-        bne             1b
-
-        pop             {r4-r9, pc}
-endfunc
-
-function ff_put_pixels8_y2_no_rnd_armv6, export=1
-        push            {r4-r9, lr}
-        ldr             r4,  [r1]
-        ldr             r5,  [r1, #4]
-        ldr             r6,  [r1, r2]!
-        ldr             r7,  [r1, #4]
-1:
-        subs            r3,  r3,  #2
-        uhadd8          r8,  r4,  r6
-        ldr             r4,  [r1, r2]!
-        uhadd8          r9,  r5,  r7
-        ldr             r5,  [r1, #4]
-        uhadd8          r12, r4,  r6
-        ldr             r6,  [r1, r2]!
-        uhadd8          r14, r5,  r7
-        ldr             r7,  [r1, #4]
-        stm             r0,  {r8,r9}
-        add             r0,  r0,  r2
-        stm             r0,  {r12,r14}
-        add             r0,  r0,  r2
-        bne             1b
-
-        pop             {r4-r9, pc}
-endfunc
-
-function ff_avg_pixels8_armv6, export=1
-        pld             [r1, r2]
-        push            {r4-r10, lr}
-        mov             lr,  #1
-        orr             lr,  lr,  lr,  lsl #8
-        orr             lr,  lr,  lr,  lsl #16
-        ldrd            r4,  r5,  [r0]
-        ldr             r10, [r1, #4]
-        ldr             r9,  [r1], r2
-        subs            r3,  r3,  #2
-1:
-        pld             [r1, r2]
-        eor             r8,  r4,  r9
-        uhadd8          r4,  r4,  r9
-        eor             r12, r5,  r10
-        ldrd            r6,  r7,  [r0, r2]
-        uhadd8          r5,  r5,  r10
-        and             r8,  r8,  lr
-        ldr             r10, [r1, #4]
-        and             r12, r12, lr
-        uadd8           r4,  r4,  r8
-        ldr             r9,  [r1], r2
-        eor             r8,  r6,  r9
-        uadd8           r5,  r5,  r12
-        pld             [r1, r2,  lsl #1]
-        eor             r12, r7,  r10
-        uhadd8          r6,  r6,  r9
-        strd            r4,  r5,  [r0], r2
-        uhadd8          r7,  r7,  r10
-        beq             2f
-        and             r8,  r8,  lr
-        ldrd            r4,  r5,  [r0, r2]
-        uadd8           r6,  r6,  r8
-        ldr             r10, [r1, #4]
-        and             r12, r12, lr
-        subs            r3,  r3,  #2
-        uadd8           r7,  r7,  r12
-        ldr             r9,  [r1], r2
-        strd            r6,  r7,  [r0], r2
-        b               1b
-2:
-        and             r8,  r8,  lr
-        and             r12, r12, lr
-        uadd8           r6,  r6,  r8
-        uadd8           r7,  r7,  r12
-        strd            r6,  r7,  [r0], r2
-
-        pop             {r4-r10, pc}
-endfunc
-
-function ff_add_pixels_clamped_armv6, export=1
-        push            {r4-r8,lr}
-        mov             r3,  #8
-1:
-        ldm             r0!, {r4,r5,r12,lr}
-        ldrd            r6,  r7,  [r1]
-        pkhbt           r8,  r4,  r5,  lsl #16
-        pkhtb           r5,  r5,  r4,  asr #16
-        pkhbt           r4,  r12, lr,  lsl #16
-        pkhtb           lr,  lr,  r12, asr #16
-        pld             [r1, r2]
-        uxtab16         r8,  r8,  r6
-        uxtab16         r5,  r5,  r6,  ror #8
-        uxtab16         r4,  r4,  r7
-        uxtab16         lr,  lr,  r7,  ror #8
-        usat16          r8,  #8,  r8
-        usat16          r5,  #8,  r5
-        usat16          r4,  #8,  r4
-        usat16          lr,  #8,  lr
-        orr             r6,  r8,  r5,  lsl #8
-        orr             r7,  r4,  lr,  lsl #8
-        subs            r3,  r3,  #1
-        strd            r6,  r7,  [r1],  r2
-        bgt             1b
-        pop             {r4-r8,pc}
-endfunc
-
-function ff_get_pixels_armv6, export=1
-        pld             [r1, r2]
-        push            {r4-r8, lr}
-        mov             lr,  #8
-1:
-        ldrd            r4,  r5,  [r1],  r2
-        subs            lr,  lr,  #1
-        uxtb16          r6,  r4
-        uxtb16          r4,  r4,  ror #8
-        uxtb16          r12, r5
-        uxtb16          r8,  r5,  ror #8
-        pld             [r1, r2]
-        pkhbt           r5,  r6,  r4,  lsl #16
-        pkhtb           r6,  r4,  r6,  asr #16
-        pkhbt           r7,  r12, r8,  lsl #16
-        pkhtb           r12, r8,  r12, asr #16
-        stm             r0!, {r5,r6,r7,r12}
-        bgt             1b
-
-        pop             {r4-r8, pc}
-endfunc
-
-function ff_diff_pixels_armv6, export=1
-        pld             [r1, r3]
-        pld             [r2, r3]
-        push            {r4-r9, lr}
-        mov             lr,  #8
-1:
-        ldrd            r4,  r5,  [r1],  r3
-        ldrd            r6,  r7,  [r2],  r3
-        uxtb16          r8,  r4
-        uxtb16          r4,  r4,  ror #8
-        uxtb16          r9,  r6
-        uxtb16          r6,  r6,  ror #8
-        pld             [r1, r3]
-        ssub16          r9,  r8,  r9
-        ssub16          r6,  r4,  r6
-        uxtb16          r8,  r5
-        uxtb16          r5,  r5,  ror #8
-        pld             [r2, r3]
-        pkhbt           r4,  r9,  r6,  lsl #16
-        pkhtb           r6,  r6,  r9,  asr #16
-        uxtb16          r9,  r7
-        uxtb16          r7,  r7,  ror #8
-        ssub16          r9,  r8,  r9
-        ssub16          r5,  r5,  r7
-        subs            lr,  lr,  #1
-        pkhbt           r8,  r9,  r5,  lsl #16
-        pkhtb           r9,  r5,  r9,  asr #16
-        stm             r0!, {r4,r6,r8,r9}
-        bgt             1b
-
-        pop             {r4-r9, pc}
-endfunc
-
-function ff_pix_abs16_armv6, export=1
-        ldr             r0,  [sp]
-        push            {r4-r9, lr}
-        mov             r12, #0
-        mov             lr,  #0
-        ldm             r1,  {r4-r7}
-        ldr             r8,  [r2]
-1:
-        ldr             r9,  [r2, #4]
-        pld             [r1, r3]
-        usada8          r12, r4,  r8,  r12
-        ldr             r8,  [r2, #8]
-        pld             [r2, r3]
-        usada8          lr,  r5,  r9,  lr
-        ldr             r9,  [r2, #12]
-        usada8          r12, r6,  r8,  r12
-        subs            r0,  r0,  #1
-        usada8          lr,  r7,  r9,  lr
-        beq             2f
-        add             r1,  r1,  r3
-        ldm             r1,  {r4-r7}
-        add             r2,  r2,  r3
-        ldr             r8,  [r2]
-        b               1b
-2:
-        add             r0,  r12, lr
-        pop             {r4-r9, pc}
-endfunc
-
-function ff_pix_abs16_x2_armv6, export=1
-        ldr             r12, [sp]
-        push            {r4-r11, lr}
-        mov             r0,  #0
-        mov             lr,  #1
-        orr             lr,  lr,  lr,  lsl #8
-        orr             lr,  lr,  lr,  lsl #16
-1:
-        ldr             r8,  [r2]
-        ldr             r9,  [r2, #4]
-        lsr             r10, r8,  #8
-        ldr             r4,  [r1]
-        lsr             r6,  r9,  #8
-        orr             r10, r10, r9,  lsl #24
-        ldr             r5,  [r2, #8]
-        eor             r11, r8,  r10
-        uhadd8          r7,  r8,  r10
-        orr             r6,  r6,  r5,  lsl #24
-        and             r11, r11, lr
-        uadd8           r7,  r7,  r11
-        ldr             r8,  [r1, #4]
-        usada8          r0,  r4,  r7,  r0
-        eor             r7,  r9,  r6
-        lsr             r10, r5,  #8
-        and             r7,  r7,  lr
-        uhadd8          r4,  r9,  r6
-        ldr             r6,  [r2, #12]
-        uadd8           r4,  r4,  r7
-        pld             [r1, r3]
-        orr             r10, r10, r6,  lsl #24
-        usada8          r0,  r8,  r4,  r0
-        ldr             r4,  [r1, #8]
-        eor             r11, r5,  r10
-        ldrb            r7,  [r2, #16]
-        and             r11, r11, lr
-        uhadd8          r8,  r5,  r10
-        ldr             r5,  [r1, #12]
-        uadd8           r8,  r8,  r11
-        pld             [r2, r3]
-        lsr             r10, r6,  #8
-        usada8          r0,  r4,  r8,  r0
-        orr             r10, r10, r7,  lsl #24
-        subs            r12,  r12,  #1
-        eor             r11, r6,  r10
-        add             r1,  r1,  r3
-        uhadd8          r9,  r6,  r10
-        and             r11, r11, lr
-        uadd8           r9,  r9,  r11
-        add             r2,  r2,  r3
-        usada8          r0,  r5,  r9,  r0
-        bgt             1b
-
-        pop             {r4-r11, pc}
-endfunc
-
-.macro  usad_y2         p0,  p1,  p2,  p3,  n0,  n1,  n2,  n3
-        ldr             \n0, [r2]
-        eor             \n1, \p0, \n0
-        uhadd8          \p0, \p0, \n0
-        and             \n1, \n1, lr
-        ldr             \n2, [r1]
-        uadd8           \p0, \p0, \n1
-        ldr             \n1, [r2, #4]
-        usada8          r0,  \p0, \n2, r0
-        pld             [r1,  r3]
-        eor             \n3, \p1, \n1
-        uhadd8          \p1, \p1, \n1
-        and             \n3, \n3, lr
-        ldr             \p0, [r1, #4]
-        uadd8           \p1, \p1, \n3
-        ldr             \n2, [r2, #8]
-        usada8          r0,  \p1, \p0, r0
-        pld             [r2,  r3]
-        eor             \p0, \p2, \n2
-        uhadd8          \p2, \p2, \n2
-        and             \p0, \p0, lr
-        ldr             \p1, [r1, #8]
-        uadd8           \p2, \p2, \p0
-        ldr             \n3, [r2, #12]
-        usada8          r0,  \p2, \p1, r0
-        eor             \p1, \p3, \n3
-        uhadd8          \p3, \p3, \n3
-        and             \p1, \p1, lr
-        ldr             \p0,  [r1, #12]
-        uadd8           \p3, \p3, \p1
-        add             r1,  r1,  r3
-        usada8          r0,  \p3, \p0,  r0
-        add             r2,  r2,  r3
-.endm
-
-function ff_pix_abs16_y2_armv6, export=1
-        pld             [r1]
-        pld             [r2]
-        ldr             r12, [sp]
-        push            {r4-r11, lr}
-        mov             r0,  #0
-        mov             lr,  #1
-        orr             lr,  lr,  lr,  lsl #8
-        orr             lr,  lr,  lr,  lsl #16
-        ldr             r4,  [r2]
-        ldr             r5,  [r2, #4]
-        ldr             r6,  [r2, #8]
-        ldr             r7,  [r2, #12]
-        add             r2,  r2,  r3
-1:
-        usad_y2         r4,  r5,  r6,  r7,  r8,  r9,  r10, r11
-        subs            r12, r12, #2
-        usad_y2         r8,  r9,  r10, r11, r4,  r5,  r6,  r7
-        bgt             1b
-
-        pop             {r4-r11, pc}
-endfunc
-
-function ff_pix_abs8_armv6, export=1
-        pld             [r2, r3]
-        ldr             r12, [sp]
-        push            {r4-r9, lr}
-        mov             r0,  #0
-        mov             lr,  #0
-        ldrd            r4,  r5,  [r1], r3
-1:
-        subs            r12, r12, #2
-        ldr             r7,  [r2, #4]
-        ldr             r6,  [r2], r3
-        ldrd            r8,  r9,  [r1], r3
-        usada8          r0,  r4,  r6,  r0
-        pld             [r2, r3]
-        usada8          lr,  r5,  r7,  lr
-        ldr             r7,  [r2, #4]
-        ldr             r6,  [r2], r3
-        beq             2f
-        ldrd            r4,  r5,  [r1], r3
-        usada8          r0,  r8,  r6,  r0
-        pld             [r2, r3]
-        usada8          lr,  r9,  r7,  lr
-        b               1b
-2:
-        usada8          r0,  r8,  r6,  r0
-        usada8          lr,  r9,  r7,  lr
-        add             r0,  r0,  lr
-        pop             {r4-r9, pc}
-endfunc
-
-function ff_sse16_armv6, export=1
-        ldr             r12, [sp]
-        push            {r4-r9, lr}
-        mov             r0,  #0
-1:
-        ldrd            r4,  r5,  [r1]
-        ldr             r8,  [r2]
-        uxtb16          lr,  r4
-        uxtb16          r4,  r4,  ror #8
-        uxtb16          r9,  r8
-        uxtb16          r8,  r8,  ror #8
-        ldr             r7,  [r2, #4]
-        usub16          lr,  lr,  r9
-        usub16          r4,  r4,  r8
-        smlad           r0,  lr,  lr,  r0
-        uxtb16          r6,  r5
-        uxtb16          lr,  r5,  ror #8
-        uxtb16          r8,  r7
-        uxtb16          r9,  r7,  ror #8
-        smlad           r0,  r4,  r4,  r0
-        ldrd            r4,  r5,  [r1, #8]
-        usub16          r6,  r6,  r8
-        usub16          r8,  lr,  r9
-        ldr             r7,  [r2, #8]
-        smlad           r0,  r6,  r6,  r0
-        uxtb16          lr,  r4
-        uxtb16          r4,  r4,  ror #8
-        uxtb16          r9,  r7
-        uxtb16          r7,  r7, ror #8
-        smlad           r0,  r8,  r8,  r0
-        ldr             r8,  [r2, #12]
-        usub16          lr,  lr,  r9
-        usub16          r4,  r4,  r7
-        smlad           r0,  lr,  lr,  r0
-        uxtb16          r6,  r5
-        uxtb16          r5,  r5,  ror #8
-        uxtb16          r9,  r8
-        uxtb16          r8,  r8,  ror #8
-        smlad           r0,  r4,  r4,  r0
-        usub16          r6,  r6,  r9
-        usub16          r5,  r5,  r8
-        smlad           r0,  r6,  r6,  r0
-        add             r1,  r1,  r3
-        add             r2,  r2,  r3
-        subs            r12, r12, #1
-        smlad           r0,  r5,  r5,  r0
-        bgt             1b
-
-        pop             {r4-r9, pc}
-endfunc
-
-function ff_pix_norm1_armv6, export=1
-        push            {r4-r6, lr}
-        mov             r12, #16
-        mov             lr,  #0
-1:
-        ldm             r0,  {r2-r5}
-        uxtb16          r6,  r2
-        uxtb16          r2,  r2,  ror #8
-        smlad           lr,  r6,  r6,  lr
-        uxtb16          r6,  r3
-        smlad           lr,  r2,  r2,  lr
-        uxtb16          r3,  r3,  ror #8
-        smlad           lr,  r6,  r6,  lr
-        uxtb16          r6,  r4
-        smlad           lr,  r3,  r3,  lr
-        uxtb16          r4,  r4,  ror #8
-        smlad           lr,  r6,  r6,  lr
-        uxtb16          r6,  r5
-        smlad           lr,  r4,  r4,  lr
-        uxtb16          r5,  r5,  ror #8
-        smlad           lr,  r6,  r6,  lr
-        subs            r12, r12, #1
-        add             r0,  r0,  r1
-        smlad           lr,  r5,  r5,  lr
-        bgt             1b
-
-        mov             r0,  lr
-        pop             {r4-r6, pc}
-endfunc
-
-function ff_pix_sum_armv6, export=1
-        push            {r4-r7, lr}
-        mov             r12, #16
-        mov             r2,  #0
-        mov             r3,  #0
-        mov             lr,  #0
-        ldr             r4,  [r0]
-1:
-        subs            r12, r12, #1
-        ldr             r5,  [r0, #4]
-        usada8          r2,  r4,  lr,  r2
-        ldr             r6,  [r0, #8]
-        usada8          r3,  r5,  lr,  r3
-        ldr             r7,  [r0, #12]
-        usada8          r2,  r6,  lr,  r2
-        beq             2f
-        ldr             r4,  [r0, r1]!
-        usada8          r3,  r7,  lr,  r3
-        bgt             1b
-2:
-        usada8          r3,  r7,  lr,  r3
-        add             r0,  r2,  r3
-        pop             {r4-r7, pc}
-endfunc
diff --git a/libavcodec/arm/dsputil_init_arm.c b/libavcodec/arm/dsputil_init_arm.c
deleted file mode 100644
index c9c3351..0000000
--- a/libavcodec/arm/dsputil_init_arm.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * ARM optimized DSP utils
- * Copyright (c) 2001 Lionel Ulmer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_arm.h"
-
-void ff_j_rev_dct_arm(DCTELEM *data);
-void ff_simple_idct_arm(DCTELEM *data);
-
-/* XXX: local hack */
-static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
-static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
-
-void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-void ff_put_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-void ff_put_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-
-void ff_put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-void ff_put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-void ff_put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-
-void ff_put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-
-CALL_2X_PIXELS(ff_put_pixels16_x2_arm,         ff_put_pixels8_x2_arm,        8)
-CALL_2X_PIXELS(ff_put_pixels16_y2_arm,         ff_put_pixels8_y2_arm,        8)
-CALL_2X_PIXELS(ff_put_pixels16_xy2_arm,        ff_put_pixels8_xy2_arm,       8)
-CALL_2X_PIXELS(ff_put_no_rnd_pixels16_x2_arm,  ff_put_no_rnd_pixels8_x2_arm, 8)
-CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm,  ff_put_no_rnd_pixels8_y2_arm, 8)
-CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8)
-
-void ff_add_pixels_clamped_arm(const DCTELEM *block, uint8_t *dest,
-                               int line_size);
-
-/* XXX: those functions should be suppressed ASAP when all IDCTs are
-   converted */
-static void j_rev_dct_arm_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_j_rev_dct_arm (block);
-    ff_put_pixels_clamped(block, dest, line_size);
-}
-static void j_rev_dct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_j_rev_dct_arm (block);
-    ff_add_pixels_clamped(block, dest, line_size);
-}
-static void simple_idct_arm_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_simple_idct_arm (block);
-    ff_put_pixels_clamped(block, dest, line_size);
-}
-static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_simple_idct_arm (block);
-    ff_add_pixels_clamped(block, dest, line_size);
-}
-
-int mm_support(void)
-{
-    return HAVE_IWMMXT * FF_MM_IWMMXT;
-}
-
-void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
-{
-    ff_put_pixels_clamped = c->put_pixels_clamped;
-    ff_add_pixels_clamped = c->add_pixels_clamped;
-
-    if (!avctx->lowres) {
-        if(avctx->idct_algo == FF_IDCT_AUTO ||
-           avctx->idct_algo == FF_IDCT_ARM){
-            c->idct_put              = j_rev_dct_arm_put;
-            c->idct_add              = j_rev_dct_arm_add;
-            c->idct                  = ff_j_rev_dct_arm;
-            c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
-        } else if (avctx->idct_algo == FF_IDCT_SIMPLEARM){
-            c->idct_put              = simple_idct_arm_put;
-            c->idct_add              = simple_idct_arm_add;
-            c->idct                  = ff_simple_idct_arm;
-            c->idct_permutation_type = FF_NO_IDCT_PERM;
-        }
-    }
-
-    c->add_pixels_clamped = ff_add_pixels_clamped_arm;
-
-    c->put_pixels_tab[0][0] = ff_put_pixels16_arm;
-    c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm;
-    c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm;
-    c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_arm;
-    c->put_pixels_tab[1][0] = ff_put_pixels8_arm;
-    c->put_pixels_tab[1][1] = ff_put_pixels8_x2_arm;
-    c->put_pixels_tab[1][2] = ff_put_pixels8_y2_arm;
-    c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_arm;
-
-    c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_arm;
-    c->put_no_rnd_pixels_tab[0][1] = ff_put_no_rnd_pixels16_x2_arm;
-    c->put_no_rnd_pixels_tab[0][2] = ff_put_no_rnd_pixels16_y2_arm;
-    c->put_no_rnd_pixels_tab[0][3] = ff_put_no_rnd_pixels16_xy2_arm;
-    c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_arm;
-    c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_arm;
-    c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_arm;
-    c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm;
-
-    if (HAVE_ARMV5TE) ff_dsputil_init_armv5te(c, avctx);
-    if (HAVE_ARMV6)   ff_dsputil_init_armv6(c, avctx);
-    if (HAVE_IWMMXT)  ff_dsputil_init_iwmmxt(c, avctx);
-    if (HAVE_ARMVFP)  ff_dsputil_init_vfp(c, avctx);
-    if (HAVE_NEON)    ff_dsputil_init_neon(c, avctx);
-}
diff --git a/libavcodec/arm/dsputil_init_armv5te.c b/libavcodec/arm/dsputil_init_armv5te.c
deleted file mode 100644
index 750e514..0000000
--- a/libavcodec/arm/dsputil_init_armv5te.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_arm.h"
-
-void ff_simple_idct_armv5te(DCTELEM *data);
-void ff_simple_idct_put_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_simple_idct_add_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
-
-void ff_prefetch_arm(void *mem, int stride, int h);
-
-void av_cold ff_dsputil_init_armv5te(DSPContext* c, AVCodecContext *avctx)
-{
-    if (!avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO ||
-                           avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {
-        c->idct_put              = ff_simple_idct_put_armv5te;
-        c->idct_add              = ff_simple_idct_add_armv5te;
-        c->idct                  = ff_simple_idct_armv5te;
-        c->idct_permutation_type = FF_NO_IDCT_PERM;
-    }
-
-    c->prefetch = ff_prefetch_arm;
-}
diff --git a/libavcodec/arm/dsputil_init_armv6.c b/libavcodec/arm/dsputil_init_armv6.c
deleted file mode 100644
index 3209062..0000000
--- a/libavcodec/arm/dsputil_init_armv6.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_arm.h"
-
-void ff_simple_idct_armv6(DCTELEM *data);
-void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, DCTELEM *data);
-
-void ff_put_pixels16_armv6(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_x2_armv6(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_y2_armv6(uint8_t *, const uint8_t *, int, int);
-
-void ff_put_pixels16_x2_no_rnd_armv6(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_y2_no_rnd_armv6(uint8_t *, const uint8_t *, int, int);
-
-void ff_avg_pixels16_armv6(uint8_t *, const uint8_t *, int, int);
-
-void ff_put_pixels8_armv6(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_x2_armv6(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_y2_armv6(uint8_t *, const uint8_t *, int, int);
-
-void ff_put_pixels8_x2_no_rnd_armv6(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_y2_no_rnd_armv6(uint8_t *, const uint8_t *, int, int);
-
-void ff_avg_pixels8_armv6(uint8_t *, const uint8_t *, int, int);
-
-void ff_add_pixels_clamped_armv6(const DCTELEM *block,
-                                 uint8_t *restrict pixels,
-                                 int line_size);
-
-void ff_get_pixels_armv6(DCTELEM *block, const uint8_t *pixels, int stride);
-void ff_diff_pixels_armv6(DCTELEM *block, const uint8_t *s1,
-                          const uint8_t *s2, int stride);
-
-int ff_pix_abs16_armv6(void *s, uint8_t *blk1, uint8_t *blk2,
-                       int line_size, int h);
-int ff_pix_abs16_x2_armv6(void *s, uint8_t *blk1, uint8_t *blk2,
-                          int line_size, int h);
-int ff_pix_abs16_y2_armv6(void *s, uint8_t *blk1, uint8_t *blk2,
-                          int line_size, int h);
-
-int ff_pix_abs8_armv6(void *s, uint8_t *blk1, uint8_t *blk2,
-                       int line_size, int h);
-
-int ff_sse16_armv6(void *s, uint8_t *blk1, uint8_t *blk2,
-                   int line_size, int h);
-
-int ff_pix_norm1_armv6(uint8_t *pix, int line_size);
-int ff_pix_sum_armv6(uint8_t *pix, int line_size);
-
-void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
-{
-    if (!avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO ||
-                           avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
-        c->idct_put              = ff_simple_idct_put_armv6;
-        c->idct_add              = ff_simple_idct_add_armv6;
-        c->idct                  = ff_simple_idct_armv6;
-        c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
-    }
-
-    c->put_pixels_tab[0][0] = ff_put_pixels16_armv6;
-    c->put_pixels_tab[0][1] = ff_put_pixels16_x2_armv6;
-    c->put_pixels_tab[0][2] = ff_put_pixels16_y2_armv6;
-/*     c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_armv6; */
-    c->put_pixels_tab[1][0] = ff_put_pixels8_armv6;
-    c->put_pixels_tab[1][1] = ff_put_pixels8_x2_armv6;
-    c->put_pixels_tab[1][2] = ff_put_pixels8_y2_armv6;
-/*     c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_armv6; */
-
-    c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_armv6;
-    c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_armv6;
-    c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_armv6;
-/*     c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_armv6; */
-    c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_armv6;
-    c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_armv6;
-    c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_armv6;
-/*     c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_armv6; */
-
-    c->avg_pixels_tab[0][0] = ff_avg_pixels16_armv6;
-    c->avg_pixels_tab[1][0] = ff_avg_pixels8_armv6;
-
-    c->add_pixels_clamped = ff_add_pixels_clamped_armv6;
-    c->get_pixels = ff_get_pixels_armv6;
-    c->diff_pixels = ff_diff_pixels_armv6;
-
-    c->pix_abs[0][0] = ff_pix_abs16_armv6;
-    c->pix_abs[0][1] = ff_pix_abs16_x2_armv6;
-    c->pix_abs[0][2] = ff_pix_abs16_y2_armv6;
-
-    c->pix_abs[1][0] = ff_pix_abs8_armv6;
-
-    c->sad[0] = ff_pix_abs16_armv6;
-    c->sad[1] = ff_pix_abs8_armv6;
-
-    c->sse[0] = ff_sse16_armv6;
-
-    c->pix_norm1 = ff_pix_norm1_armv6;
-    c->pix_sum   = ff_pix_sum_armv6;
-}
diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c
deleted file mode 100644
index 0e44160..0000000
--- a/libavcodec/arm/dsputil_init_neon.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * ARM NEON optimised DSP functions
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_arm.h"
-
-void ff_simple_idct_neon(DCTELEM *data);
-void ff_simple_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_simple_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data);
-
-void ff_vp3_idct_neon(DCTELEM *data);
-void ff_vp3_idct_put_neon(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_vp3_idct_add_neon(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_vp3_idct_dc_add_neon(uint8_t *dest, int line_size, const DCTELEM *data);
-
-void ff_put_pixels16_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_x2_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_y2_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_xy2_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_x2_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_y2_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_xy2_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_x2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
-void ff_put_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, int, int);
-
-void ff_avg_pixels16_neon(uint8_t *, const uint8_t *, int, int);
-void ff_avg_pixels8_neon(uint8_t *, const uint8_t *, int, int);
-
-void ff_add_pixels_clamped_neon(const DCTELEM *, uint8_t *, int);
-void ff_put_pixels_clamped_neon(const DCTELEM *, uint8_t *, int);
-void ff_put_signed_pixels_clamped_neon(const DCTELEM *, uint8_t *, int);
-
-void ff_put_h264_qpel16_mc00_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc10_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc20_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc30_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc01_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc11_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc21_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc31_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc02_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc12_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc22_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc32_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc03_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc13_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc23_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel16_mc33_neon(uint8_t *, uint8_t *, int);
-
-void ff_put_h264_qpel8_mc00_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc10_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc20_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc30_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc01_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc11_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc21_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc31_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc02_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc12_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc22_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc32_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc03_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc13_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc23_neon(uint8_t *, uint8_t *, int);
-void ff_put_h264_qpel8_mc33_neon(uint8_t *, uint8_t *, int);
-
-void ff_avg_h264_qpel16_mc00_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc10_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc20_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc30_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc01_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc11_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc21_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc31_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc02_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc12_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc22_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc32_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc03_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc13_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc23_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel16_mc33_neon(uint8_t *, uint8_t *, int);
-
-void ff_avg_h264_qpel8_mc00_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc10_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc20_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc30_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc01_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc11_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc21_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc31_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc02_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc12_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc22_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc32_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc03_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc13_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc23_neon(uint8_t *, uint8_t *, int);
-void ff_avg_h264_qpel8_mc33_neon(uint8_t *, uint8_t *, int);
-
-void ff_put_h264_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
-void ff_put_h264_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
-void ff_put_h264_chroma_mc2_neon(uint8_t *, uint8_t *, int, int, int, int);
-
-void ff_avg_h264_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
-void ff_avg_h264_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
-void ff_avg_h264_chroma_mc2_neon(uint8_t *, uint8_t *, int, int, int, int);
-
-void ff_vp3_v_loop_filter_neon(uint8_t *, int, int *);
-void ff_vp3_h_loop_filter_neon(uint8_t *, int, int *);
-
-void ff_vector_fmul_neon(float *dst, const float *src, int len);
-void ff_vector_fmul_window_neon(float *dst, const float *src0,
-                                const float *src1, const float *win,
-                                float add_bias, int len);
-void ff_vector_fmul_scalar_neon(float *dst, const float *src, float mul,
-                                int len);
-void ff_vector_fmul_sv_scalar_2_neon(float *dst, const float *src,
-                                     const float **vp, float mul, int len);
-void ff_vector_fmul_sv_scalar_4_neon(float *dst, const float *src,
-                                     const float **vp, float mul, int len);
-void ff_sv_fmul_scalar_2_neon(float *dst, const float **vp, float mul,
-                              int len);
-void ff_sv_fmul_scalar_4_neon(float *dst, const float **vp, float mul,
-                              int len);
-void ff_butterflies_float_neon(float *v1, float *v2, int len);
-float ff_scalarproduct_float_neon(const float *v1, const float *v2, int len);
-void ff_int32_to_float_fmul_scalar_neon(float *dst, const int *src,
-                                        float mul, int len);
-void ff_vector_fmul_reverse_neon(float *dst, const float *src0,
-                                 const float *src1, int len);
-void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1,
-                             const float *src2, int len);
-
-void ff_vector_clipf_neon(float *dst, const float *src, float min, float max,
-                          int len);
-void ff_float_to_int16_neon(int16_t *, const float *, long);
-void ff_float_to_int16_interleave_neon(int16_t *, const float **, long, int);
-
-void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize);
-
-int32_t ff_scalarproduct_int16_neon(int16_t *v1, int16_t *v2, int len,
-                                    int shift);
-int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, int16_t *v2,
-                                             int16_t *v3, int len, int mul);
-
-void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
-{
-    if (!avctx->lowres) {
-        if (avctx->idct_algo == FF_IDCT_AUTO ||
-            avctx->idct_algo == FF_IDCT_SIMPLENEON) {
-            c->idct_put              = ff_simple_idct_put_neon;
-            c->idct_add              = ff_simple_idct_add_neon;
-            c->idct                  = ff_simple_idct_neon;
-            c->idct_permutation_type = FF_PARTTRANS_IDCT_PERM;
-        } else if ((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER ||
-                    CONFIG_VP6_DECODER) &&
-                   avctx->idct_algo == FF_IDCT_VP3) {
-            c->idct_put              = ff_vp3_idct_put_neon;
-            c->idct_add              = ff_vp3_idct_add_neon;
-            c->idct                  = ff_vp3_idct_neon;
-            c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
-        }
-    }
-
-    c->put_pixels_tab[0][0] = ff_put_pixels16_neon;
-    c->put_pixels_tab[0][1] = ff_put_pixels16_x2_neon;
-    c->put_pixels_tab[0][2] = ff_put_pixels16_y2_neon;
-    c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_neon;
-    c->put_pixels_tab[1][0] = ff_put_pixels8_neon;
-    c->put_pixels_tab[1][1] = ff_put_pixels8_x2_neon;
-    c->put_pixels_tab[1][2] = ff_put_pixels8_y2_neon;
-    c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_neon;
-
-    c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_neon;
-    c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_neon;
-    c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_neon;
-    c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_neon;
-    c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_neon;
-    c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_neon;
-    c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_neon;
-    c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_neon;
-
-    c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon;
-    c->avg_pixels_tab[1][0] = ff_avg_pixels8_neon;
-
-    c->add_pixels_clamped = ff_add_pixels_clamped_neon;
-    c->put_pixels_clamped = ff_put_pixels_clamped_neon;
-    c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_neon;
-
-    if (CONFIG_H264_DECODER) {
-        c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon;
-        c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon;
-        c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon;
-
-        c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_neon;
-        c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_neon;
-        c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_neon;
-
-        c->put_h264_qpel_pixels_tab[0][ 0] = ff_put_h264_qpel16_mc00_neon;
-        c->put_h264_qpel_pixels_tab[0][ 1] = ff_put_h264_qpel16_mc10_neon;
-        c->put_h264_qpel_pixels_tab[0][ 2] = ff_put_h264_qpel16_mc20_neon;
-        c->put_h264_qpel_pixels_tab[0][ 3] = ff_put_h264_qpel16_mc30_neon;
-        c->put_h264_qpel_pixels_tab[0][ 4] = ff_put_h264_qpel16_mc01_neon;
-        c->put_h264_qpel_pixels_tab[0][ 5] = ff_put_h264_qpel16_mc11_neon;
-        c->put_h264_qpel_pixels_tab[0][ 6] = ff_put_h264_qpel16_mc21_neon;
-        c->put_h264_qpel_pixels_tab[0][ 7] = ff_put_h264_qpel16_mc31_neon;
-        c->put_h264_qpel_pixels_tab[0][ 8] = ff_put_h264_qpel16_mc02_neon;
-        c->put_h264_qpel_pixels_tab[0][ 9] = ff_put_h264_qpel16_mc12_neon;
-        c->put_h264_qpel_pixels_tab[0][10] = ff_put_h264_qpel16_mc22_neon;
-        c->put_h264_qpel_pixels_tab[0][11] = ff_put_h264_qpel16_mc32_neon;
-        c->put_h264_qpel_pixels_tab[0][12] = ff_put_h264_qpel16_mc03_neon;
-        c->put_h264_qpel_pixels_tab[0][13] = ff_put_h264_qpel16_mc13_neon;
-        c->put_h264_qpel_pixels_tab[0][14] = ff_put_h264_qpel16_mc23_neon;
-        c->put_h264_qpel_pixels_tab[0][15] = ff_put_h264_qpel16_mc33_neon;
-
-        c->put_h264_qpel_pixels_tab[1][ 0] = ff_put_h264_qpel8_mc00_neon;
-        c->put_h264_qpel_pixels_tab[1][ 1] = ff_put_h264_qpel8_mc10_neon;
-        c->put_h264_qpel_pixels_tab[1][ 2] = ff_put_h264_qpel8_mc20_neon;
-        c->put_h264_qpel_pixels_tab[1][ 3] = ff_put_h264_qpel8_mc30_neon;
-        c->put_h264_qpel_pixels_tab[1][ 4] = ff_put_h264_qpel8_mc01_neon;
-        c->put_h264_qpel_pixels_tab[1][ 5] = ff_put_h264_qpel8_mc11_neon;
-        c->put_h264_qpel_pixels_tab[1][ 6] = ff_put_h264_qpel8_mc21_neon;
-        c->put_h264_qpel_pixels_tab[1][ 7] = ff_put_h264_qpel8_mc31_neon;
-        c->put_h264_qpel_pixels_tab[1][ 8] = ff_put_h264_qpel8_mc02_neon;
-        c->put_h264_qpel_pixels_tab[1][ 9] = ff_put_h264_qpel8_mc12_neon;
-        c->put_h264_qpel_pixels_tab[1][10] = ff_put_h264_qpel8_mc22_neon;
-        c->put_h264_qpel_pixels_tab[1][11] = ff_put_h264_qpel8_mc32_neon;
-        c->put_h264_qpel_pixels_tab[1][12] = ff_put_h264_qpel8_mc03_neon;
-        c->put_h264_qpel_pixels_tab[1][13] = ff_put_h264_qpel8_mc13_neon;
-        c->put_h264_qpel_pixels_tab[1][14] = ff_put_h264_qpel8_mc23_neon;
-        c->put_h264_qpel_pixels_tab[1][15] = ff_put_h264_qpel8_mc33_neon;
-
-        c->avg_h264_qpel_pixels_tab[0][ 0] = ff_avg_h264_qpel16_mc00_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 1] = ff_avg_h264_qpel16_mc10_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 2] = ff_avg_h264_qpel16_mc20_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 3] = ff_avg_h264_qpel16_mc30_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 4] = ff_avg_h264_qpel16_mc01_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 5] = ff_avg_h264_qpel16_mc11_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 6] = ff_avg_h264_qpel16_mc21_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 7] = ff_avg_h264_qpel16_mc31_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 8] = ff_avg_h264_qpel16_mc02_neon;
-        c->avg_h264_qpel_pixels_tab[0][ 9] = ff_avg_h264_qpel16_mc12_neon;
-        c->avg_h264_qpel_pixels_tab[0][10] = ff_avg_h264_qpel16_mc22_neon;
-        c->avg_h264_qpel_pixels_tab[0][11] = ff_avg_h264_qpel16_mc32_neon;
-        c->avg_h264_qpel_pixels_tab[0][12] = ff_avg_h264_qpel16_mc03_neon;
-        c->avg_h264_qpel_pixels_tab[0][13] = ff_avg_h264_qpel16_mc13_neon;
-        c->avg_h264_qpel_pixels_tab[0][14] = ff_avg_h264_qpel16_mc23_neon;
-        c->avg_h264_qpel_pixels_tab[0][15] = ff_avg_h264_qpel16_mc33_neon;
-
-        c->avg_h264_qpel_pixels_tab[1][ 0] = ff_avg_h264_qpel8_mc00_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 1] = ff_avg_h264_qpel8_mc10_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 2] = ff_avg_h264_qpel8_mc20_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 3] = ff_avg_h264_qpel8_mc30_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 4] = ff_avg_h264_qpel8_mc01_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 5] = ff_avg_h264_qpel8_mc11_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 6] = ff_avg_h264_qpel8_mc21_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 7] = ff_avg_h264_qpel8_mc31_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 8] = ff_avg_h264_qpel8_mc02_neon;
-        c->avg_h264_qpel_pixels_tab[1][ 9] = ff_avg_h264_qpel8_mc12_neon;
-        c->avg_h264_qpel_pixels_tab[1][10] = ff_avg_h264_qpel8_mc22_neon;
-        c->avg_h264_qpel_pixels_tab[1][11] = ff_avg_h264_qpel8_mc32_neon;
-        c->avg_h264_qpel_pixels_tab[1][12] = ff_avg_h264_qpel8_mc03_neon;
-        c->avg_h264_qpel_pixels_tab[1][13] = ff_avg_h264_qpel8_mc13_neon;
-        c->avg_h264_qpel_pixels_tab[1][14] = ff_avg_h264_qpel8_mc23_neon;
-        c->avg_h264_qpel_pixels_tab[1][15] = ff_avg_h264_qpel8_mc33_neon;
-    }
-
-    if (CONFIG_VP3_DECODER) {
-        c->vp3_v_loop_filter = ff_vp3_v_loop_filter_neon;
-        c->vp3_h_loop_filter = ff_vp3_h_loop_filter_neon;
-        c->vp3_idct_dc_add   = ff_vp3_idct_dc_add_neon;
-    }
-
-    c->vector_fmul                = ff_vector_fmul_neon;
-    c->vector_fmul_window         = ff_vector_fmul_window_neon;
-    c->vector_fmul_scalar         = ff_vector_fmul_scalar_neon;
-    c->butterflies_float          = ff_butterflies_float_neon;
-    c->scalarproduct_float        = ff_scalarproduct_float_neon;
-    c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_neon;
-    c->vector_fmul_reverse        = ff_vector_fmul_reverse_neon;
-    c->vector_fmul_add            = ff_vector_fmul_add_neon;
-    c->vector_clipf               = ff_vector_clipf_neon;
-
-    c->vector_fmul_sv_scalar[0] = ff_vector_fmul_sv_scalar_2_neon;
-    c->vector_fmul_sv_scalar[1] = ff_vector_fmul_sv_scalar_4_neon;
-
-    c->sv_fmul_scalar[0] = ff_sv_fmul_scalar_2_neon;
-    c->sv_fmul_scalar[1] = ff_sv_fmul_scalar_4_neon;
-
-    if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
-        c->float_to_int16            = ff_float_to_int16_neon;
-        c->float_to_int16_interleave = ff_float_to_int16_interleave_neon;
-    }
-
-    if (CONFIG_VORBIS_DECODER)
-        c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon;
-
-    c->scalarproduct_int16 = ff_scalarproduct_int16_neon;
-    c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_neon;
-}
diff --git a/libavcodec/arm/dsputil_init_vfp.c b/libavcodec/arm/dsputil_init_vfp.c
deleted file mode 100644
index 9f8c1b7..0000000
--- a/libavcodec/arm/dsputil_init_vfp.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2008 Siarhei Siamashka <ssvb at users.sourceforge.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_arm.h"
-
-void ff_vector_fmul_vfp(float *dst, const float *src, int len);
-void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
-                                const float *src1, int len);
-void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len);
-
-void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx)
-{
-    c->vector_fmul = ff_vector_fmul_vfp;
-    c->vector_fmul_reverse = ff_vector_fmul_reverse_vfp;
-#if HAVE_ARMV6
-    c->float_to_int16 = ff_float_to_int16_vfp;
-#endif
-}
diff --git a/libavcodec/arm/dsputil_iwmmxt.c b/libavcodec/arm/dsputil_iwmmxt.c
deleted file mode 100644
index 6a23732..0000000
--- a/libavcodec/arm/dsputil_iwmmxt.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * iWMMXt optimized DSP utils
- * Copyright (c) 2004 AGAWA Koji
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-
-#define DEF(x, y) x ## _no_rnd_ ## y ##_iwmmxt
-#define SET_RND(regd)  __asm__ volatile ("mov r12, #1 \n\t tbcsth " #regd ", r12":::"r12");
-#define WAVG2B "wavg2b"
-#include "dsputil_iwmmxt_rnd_template.c"
-#undef DEF
-#undef SET_RND
-#undef WAVG2B
-
-#define DEF(x, y) x ## _ ## y ##_iwmmxt
-#define SET_RND(regd)  __asm__ volatile ("mov r12, #2 \n\t tbcsth " #regd ", r12":::"r12");
-#define WAVG2B "wavg2br"
-#include "dsputil_iwmmxt_rnd_template.c"
-#undef DEF
-#undef SET_RND
-#undef WAVG2BR
-
-// need scheduling
-#define OP(AVG)                                         \
-    __asm__ volatile (                                      \
-        /* alignment */                                 \
-        "and r12, %[pixels], #7 \n\t"                   \
-        "bic %[pixels], %[pixels], #7 \n\t"             \
-        "tmcr wcgr1, r12 \n\t"                          \
-                                                        \
-        "wldrd wr0, [%[pixels]] \n\t"                   \
-        "wldrd wr1, [%[pixels], #8] \n\t"               \
-        "add %[pixels], %[pixels], %[line_size] \n\t"   \
-        "walignr1 wr4, wr0, wr1 \n\t"                   \
-                                                        \
-        "1: \n\t"                                       \
-                                                        \
-        "wldrd wr2, [%[pixels]] \n\t"                   \
-        "wldrd wr3, [%[pixels], #8] \n\t"               \
-        "add %[pixels], %[pixels], %[line_size] \n\t"   \
-        "pld [%[pixels]] \n\t"                          \
-        "walignr1 wr5, wr2, wr3 \n\t"                   \
-        AVG " wr6, wr4, wr5 \n\t"                       \
-        "wstrd wr6, [%[block]] \n\t"                    \
-        "add %[block], %[block], %[line_size] \n\t"     \
-                                                        \
-        "wldrd wr0, [%[pixels]] \n\t"                   \
-        "wldrd wr1, [%[pixels], #8] \n\t"               \
-        "add %[pixels], %[pixels], %[line_size] \n\t"   \
-        "walignr1 wr4, wr0, wr1 \n\t"                   \
-        "pld [%[pixels]] \n\t"                          \
-        AVG " wr6, wr4, wr5 \n\t"                       \
-        "wstrd wr6, [%[block]] \n\t"                    \
-        "add %[block], %[block], %[line_size] \n\t"     \
-                                                        \
-        "subs %[h], %[h], #2 \n\t"                      \
-        "bne 1b \n\t"                                   \
-        : [block]"+r"(block), [pixels]"+r"(pixels), [h]"+r"(h)  \
-        : [line_size]"r"(line_size) \
-        : "memory", "r12");
-void put_pixels8_y2_iwmmxt(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    OP("wavg2br");
-}
-void put_no_rnd_pixels8_y2_iwmmxt(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    OP("wavg2b");
-}
-#undef OP
-
-void add_pixels_clamped_iwmmxt(const DCTELEM *block, uint8_t *pixels, int line_size)
-{
-    uint8_t *pixels2 = pixels + line_size;
-
-    __asm__ volatile (
-        "mov            r12, #4                 \n\t"
-        "1:                                     \n\t"
-        "pld            [%[pixels], %[line_size2]]              \n\t"
-        "pld            [%[pixels2], %[line_size2]]             \n\t"
-        "wldrd          wr4, [%[pixels]]        \n\t"
-        "wldrd          wr5, [%[pixels2]]       \n\t"
-        "pld            [%[block], #32]         \n\t"
-        "wunpckelub     wr6, wr4                \n\t"
-        "wldrd          wr0, [%[block]]         \n\t"
-        "wunpckehub     wr7, wr4                \n\t"
-        "wldrd          wr1, [%[block], #8]     \n\t"
-        "wunpckelub     wr8, wr5                \n\t"
-        "wldrd          wr2, [%[block], #16]    \n\t"
-        "wunpckehub     wr9, wr5                \n\t"
-        "wldrd          wr3, [%[block], #24]    \n\t"
-        "add            %[block], %[block], #32 \n\t"
-        "waddhss        wr10, wr0, wr6          \n\t"
-        "waddhss        wr11, wr1, wr7          \n\t"
-        "waddhss        wr12, wr2, wr8          \n\t"
-        "waddhss        wr13, wr3, wr9          \n\t"
-        "wpackhus       wr14, wr10, wr11        \n\t"
-        "wpackhus       wr15, wr12, wr13        \n\t"
-        "wstrd          wr14, [%[pixels]]       \n\t"
-        "add            %[pixels], %[pixels], %[line_size2]     \n\t"
-        "subs           r12, r12, #1            \n\t"
-        "wstrd          wr15, [%[pixels2]]      \n\t"
-        "add            %[pixels2], %[pixels2], %[line_size2]   \n\t"
-        "bne            1b                      \n\t"
-        : [block]"+r"(block), [pixels]"+r"(pixels), [pixels2]"+r"(pixels2)
-        : [line_size2]"r"(line_size << 1)
-        : "cc", "memory", "r12");
-}
-
-static void clear_blocks_iwmmxt(DCTELEM *blocks)
-{
-    __asm__ volatile(
-                "wzero wr0                      \n\t"
-                "mov r1, #(128 * 6 / 32)        \n\t"
-                "1:                             \n\t"
-                "wstrd wr0, [%0]                \n\t"
-                "wstrd wr0, [%0, #8]            \n\t"
-                "wstrd wr0, [%0, #16]           \n\t"
-                "wstrd wr0, [%0, #24]           \n\t"
-                "subs r1, r1, #1                \n\t"
-                "add %0, %0, #32                \n\t"
-                "bne 1b                         \n\t"
-                : "+r"(blocks)
-                :
-                : "r1"
-        );
-}
-
-static void nop(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    return;
-}
-
-/* A run time test is not simple. If this file is compiled in
- * then we should install the functions
- */
-int mm_flags = FF_MM_IWMMXT; /* multimedia extension flags */
-
-void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx)
-{
-    if (avctx->dsp_mask) {
-        if (avctx->dsp_mask & FF_MM_FORCE)
-            mm_flags |= (avctx->dsp_mask & 0xffff);
-        else
-            mm_flags &= ~(avctx->dsp_mask & 0xffff);
-    }
-
-    if (!(mm_flags & FF_MM_IWMMXT)) return;
-
-    c->add_pixels_clamped = add_pixels_clamped_iwmmxt;
-
-    c->clear_blocks = clear_blocks_iwmmxt;
-
-    c->put_pixels_tab[0][0] = put_pixels16_iwmmxt;
-    c->put_pixels_tab[0][1] = put_pixels16_x2_iwmmxt;
-    c->put_pixels_tab[0][2] = put_pixels16_y2_iwmmxt;
-    c->put_pixels_tab[0][3] = put_pixels16_xy2_iwmmxt;
-    c->put_no_rnd_pixels_tab[0][0] = put_pixels16_iwmmxt;
-    c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_iwmmxt;
-    c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_iwmmxt;
-    c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_iwmmxt;
-
-    c->put_pixels_tab[1][0] = put_pixels8_iwmmxt;
-    c->put_pixels_tab[1][1] = put_pixels8_x2_iwmmxt;
-    c->put_pixels_tab[1][2] = put_pixels8_y2_iwmmxt;
-    c->put_pixels_tab[1][3] = put_pixels8_xy2_iwmmxt;
-    c->put_no_rnd_pixels_tab[1][0] = put_pixels8_iwmmxt;
-    c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_iwmmxt;
-    c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_iwmmxt;
-    c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_iwmmxt;
-
-    c->avg_pixels_tab[0][0] = avg_pixels16_iwmmxt;
-    c->avg_pixels_tab[0][1] = avg_pixels16_x2_iwmmxt;
-    c->avg_pixels_tab[0][2] = avg_pixels16_y2_iwmmxt;
-    c->avg_pixels_tab[0][3] = avg_pixels16_xy2_iwmmxt;
-    c->avg_no_rnd_pixels_tab[0][0] = avg_pixels16_iwmmxt;
-    c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_iwmmxt;
-    c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_iwmmxt;
-    c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_iwmmxt;
-
-    c->avg_pixels_tab[1][0] = avg_pixels8_iwmmxt;
-    c->avg_pixels_tab[1][1] = avg_pixels8_x2_iwmmxt;
-    c->avg_pixels_tab[1][2] = avg_pixels8_y2_iwmmxt;
-    c->avg_pixels_tab[1][3] = avg_pixels8_xy2_iwmmxt;
-    c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_iwmmxt;
-    c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_iwmmxt;
-    c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_iwmmxt;
-    c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_iwmmxt;
-}
diff --git a/libavcodec/arm/dsputil_iwmmxt_rnd_template.c b/libavcodec/arm/dsputil_iwmmxt_rnd_template.c
deleted file mode 100644
index 35a5a9b..0000000
--- a/libavcodec/arm/dsputil_iwmmxt_rnd_template.c
+++ /dev/null
@@ -1,1114 +0,0 @@
-/*
- * iWMMXt optimized DSP utils
- * copyright (c) 2004 AGAWA Koji
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-void DEF(put, pixels8)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    __asm__ volatile (
-        "and r12, %[pixels], #7 \n\t"
-        "bic %[pixels], %[pixels], #7 \n\t"
-        "tmcr wcgr1, r12 \n\t"
-        "add r4, %[pixels], %[line_size] \n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-        "1: \n\t"
-        "wldrd wr0, [%[pixels]] \n\t"
-        "subs %[h], %[h], #2 \n\t"
-        "wldrd wr1, [%[pixels], #8] \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr3, [r4] \n\t"
-        "pld [%[pixels]] \n\t"
-        "pld [%[pixels], #32] \n\t"
-        "wldrd wr4, [r4, #8] \n\t"
-        "add r4, r4, %[line_size] \n\t"
-        "walignr1 wr8, wr0, wr1 \n\t"
-        "pld [r4] \n\t"
-        "pld [r4, #32] \n\t"
-        "walignr1 wr10, wr3, wr4 \n\t"
-        "wstrd wr8, [%[block]] \n\t"
-        "add %[block], %[block], %[line_size] \n\t"
-        "wstrd wr10, [r5] \n\t"
-        "add r5, r5, %[line_size] \n\t"
-        "bne 1b \n\t"
-        : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
-        :
-        : "memory", "r4", "r5", "r12");
-}
-
-void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    __asm__ volatile (
-        "and r12, %[pixels], #7 \n\t"
-        "bic %[pixels], %[pixels], #7 \n\t"
-        "tmcr wcgr1, r12 \n\t"
-        "add r4, %[pixels], %[line_size] \n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-        "1: \n\t"
-        "wldrd wr0, [%[pixels]] \n\t"
-        "subs %[h], %[h], #2 \n\t"
-        "wldrd wr1, [%[pixels], #8] \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr3, [r4] \n\t"
-        "pld [%[pixels]] \n\t"
-        "pld [%[pixels], #32] \n\t"
-        "wldrd wr4, [r4, #8] \n\t"
-        "add r4, r4, %[line_size] \n\t"
-        "walignr1 wr8, wr0, wr1 \n\t"
-        "wldrd wr0, [%[block]] \n\t"
-        "wldrd wr2, [r5] \n\t"
-        "pld [r4] \n\t"
-        "pld [r4, #32] \n\t"
-        "walignr1 wr10, wr3, wr4 \n\t"
-        WAVG2B" wr8, wr8, wr0 \n\t"
-        WAVG2B" wr10, wr10, wr2 \n\t"
-        "wstrd wr8, [%[block]] \n\t"
-        "add %[block], %[block], %[line_size] \n\t"
-        "wstrd wr10, [r5] \n\t"
-        "pld [%[block]] \n\t"
-        "pld [%[block], #32] \n\t"
-        "add r5, r5, %[line_size] \n\t"
-        "pld [r5] \n\t"
-        "pld [r5, #32] \n\t"
-        "bne 1b \n\t"
-        : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
-        :
-        : "memory", "r4", "r5", "r12");
-}
-
-void DEF(put, pixels16)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    __asm__ volatile (
-        "and r12, %[pixels], #7 \n\t"
-        "bic %[pixels], %[pixels], #7 \n\t"
-        "tmcr wcgr1, r12 \n\t"
-        "add r4, %[pixels], %[line_size] \n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-        "1: \n\t"
-        "wldrd wr0, [%[pixels]] \n\t"
-        "wldrd wr1, [%[pixels], #8] \n\t"
-        "subs %[h], %[h], #2 \n\t"
-        "wldrd wr2, [%[pixels], #16] \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr3, [r4] \n\t"
-        "pld [%[pixels]] \n\t"
-        "pld [%[pixels], #32] \n\t"
-        "walignr1 wr8, wr0, wr1 \n\t"
-        "wldrd wr4, [r4, #8] \n\t"
-        "walignr1 wr9, wr1, wr2 \n\t"
-        "wldrd wr5, [r4, #16] \n\t"
-        "add r4, r4, %[line_size] \n\t"
-        "pld [r4] \n\t"
-        "pld [r4, #32] \n\t"
-        "walignr1 wr10, wr3, wr4 \n\t"
-        "wstrd wr8, [%[block]] \n\t"
-        "walignr1 wr11, wr4, wr5 \n\t"
-        "wstrd wr9, [%[block], #8] \n\t"
-        "add %[block], %[block], %[line_size] \n\t"
-        "wstrd wr10, [r5] \n\t"
-        "wstrd wr11, [r5, #8] \n\t"
-        "add r5, r5, %[line_size] \n\t"
-        "bne 1b \n\t"
-        : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
-        :
-        : "memory", "r4", "r5", "r12");
-}
-
-void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    __asm__ volatile (
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "add r4, %[pixels], %[line_size]\n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-        "1:                             \n\t"
-        "wldrd wr0, [%[pixels]]         \n\t"
-        "wldrd wr1, [%[pixels], #8]     \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        "wldrd wr2, [%[pixels], #16]    \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr3, [r4]                \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr8, wr0, wr1         \n\t"
-        "wldrd wr4, [r4, #8]            \n\t"
-        "walignr1 wr9, wr1, wr2         \n\t"
-        "wldrd wr5, [r4, #16]           \n\t"
-        "add r4, r4, %[line_size]       \n\t"
-        "wldrd wr0, [%[block]]          \n\t"
-        "pld [r4]                       \n\t"
-        "wldrd wr1, [%[block], #8]      \n\t"
-        "pld [r4, #32]                  \n\t"
-        "wldrd wr2, [r5]                \n\t"
-        "walignr1 wr10, wr3, wr4        \n\t"
-        "wldrd wr3, [r5, #8]            \n\t"
-        WAVG2B" wr8, wr8, wr0           \n\t"
-        WAVG2B" wr9, wr9, wr1           \n\t"
-        WAVG2B" wr10, wr10, wr2         \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "walignr1 wr11, wr4, wr5        \n\t"
-        WAVG2B" wr11, wr11, wr3         \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size] \n\t"
-        "wstrd wr10, [r5]               \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "wstrd wr11, [r5, #8]           \n\t"
-        "add r5, r5, %[line_size]       \n\t"
-        "pld [r5]                       \n\t"
-        "pld [r5, #32]                  \n\t"
-        "bne 1b \n\t"
-        : [block]"+r"(block), [pixels]"+r"(pixels), [line_size]"+r"(stride), [h]"+r"(h)
-        :
-        : "memory", "r4", "r5", "r12");
-}
-
-void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "add r12, r12, #1               \n\t"
-        "add r4, %[pixels], %[line_size]\n\t"
-        "tmcr wcgr2, r12                \n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-
-        "1:                             \n\t"
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr13, [r4]               \n\t"
-        "pld [%[pixels]]                \n\t"
-        "wldrd wr14, [r4, #8]           \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "add r4, r4, %[line_size]       \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "pld [r4]                       \n\t"
-        "pld [r4, #32]                  \n\t"
-        "walignr1 wr2, wr13, wr14       \n\t"
-        "wmoveq wr4, wr11               \n\t"
-        "wmoveq wr6, wr14               \n\t"
-        "walignr2ne wr4, wr10, wr11     \n\t"
-        "walignr2ne wr6, wr13, wr14     \n\t"
-        WAVG2B" wr0, wr0, wr4           \n\t"
-        WAVG2B" wr2, wr2, wr6           \n\t"
-        "wstrd wr0, [%[block]]          \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        "wstrd wr2, [r5]                \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "add r5, r5, %[line_size]       \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
-        :
-        : "r4", "r5", "r12", "memory");
-}
-
-void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "add r12, r12, #1               \n\t"
-        "add r4, %[pixels], %[line_size]\n\t"
-        "tmcr wcgr2, r12                \n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-
-        "1:                             \n\t"
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr13, [r4]               \n\t"
-        "pld [%[pixels]]                \n\t"
-        "wldrd wr14, [r4, #8]           \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "wldrd wr15, [r4, #16]          \n\t"
-        "add r4, r4, %[line_size]       \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "pld [r4]                       \n\t"
-        "pld [r4, #32]                  \n\t"
-        "walignr1 wr1, wr11, wr12       \n\t"
-        "walignr1 wr2, wr13, wr14       \n\t"
-        "walignr1 wr3, wr14, wr15       \n\t"
-        "wmoveq wr4, wr11               \n\t"
-        "wmoveq wr5, wr12               \n\t"
-        "wmoveq wr6, wr14               \n\t"
-        "wmoveq wr7, wr15               \n\t"
-        "walignr2ne wr4, wr10, wr11     \n\t"
-        "walignr2ne wr5, wr11, wr12     \n\t"
-        "walignr2ne wr6, wr13, wr14     \n\t"
-        "walignr2ne wr7, wr14, wr15     \n\t"
-        WAVG2B" wr0, wr0, wr4           \n\t"
-        WAVG2B" wr1, wr1, wr5           \n\t"
-        "wstrd wr0, [%[block]]          \n\t"
-        WAVG2B" wr2, wr2, wr6           \n\t"
-        "wstrd wr1, [%[block], #8]      \n\t"
-        WAVG2B" wr3, wr3, wr7           \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "wstrd wr2, [r5]                \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        "wstrd wr3, [r5, #8]            \n\t"
-        "add r5, r5, %[line_size]       \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
-        :
-        : "r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "add r12, r12, #1               \n\t"
-        "add r4, %[pixels], %[line_size]\n\t"
-        "tmcr wcgr2, r12                \n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-        "pld [r5]                       \n\t"
-        "pld [r5, #32]                  \n\t"
-
-        "1:                             \n\t"
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr13, [r4]               \n\t"
-        "pld [%[pixels]]                \n\t"
-        "wldrd wr14, [r4, #8]           \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "add r4, r4, %[line_size]       \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "pld [r4]                       \n\t"
-        "pld [r4, #32]                  \n\t"
-        "walignr1 wr2, wr13, wr14       \n\t"
-        "wmoveq wr4, wr11               \n\t"
-        "wmoveq wr6, wr14               \n\t"
-        "walignr2ne wr4, wr10, wr11     \n\t"
-        "wldrd wr10, [%[block]]         \n\t"
-        "walignr2ne wr6, wr13, wr14     \n\t"
-        "wldrd wr12, [r5]               \n\t"
-        WAVG2B" wr0, wr0, wr4           \n\t"
-        WAVG2B" wr2, wr2, wr6           \n\t"
-        WAVG2B" wr0, wr0, wr10          \n\t"
-        WAVG2B" wr2, wr2, wr12          \n\t"
-        "wstrd wr0, [%[block]]          \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        "wstrd wr2, [r5]                \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "add r5, r5, %[line_size]       \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "pld [r5]                       \n\t"
-        "pld [r5, #32]                  \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
-        :
-        : "r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "add r12, r12, #1               \n\t"
-        "add r4, %[pixels], %[line_size]\n\t"
-        "tmcr wcgr2, r12                \n\t"
-        "add r5, %[block], %[line_size] \n\t"
-        "mov %[line_size], %[line_size], lsl #1 \n\t"
-        "pld [r5]                       \n\t"
-        "pld [r5, #32]                  \n\t"
-
-        "1:                             \n\t"
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "wldrd wr13, [r4]               \n\t"
-        "pld [%[pixels]]                \n\t"
-        "wldrd wr14, [r4, #8]           \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "wldrd wr15, [r4, #16]          \n\t"
-        "add r4, r4, %[line_size]       \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "pld [r4]                       \n\t"
-        "pld [r4, #32]                  \n\t"
-        "walignr1 wr1, wr11, wr12       \n\t"
-        "walignr1 wr2, wr13, wr14       \n\t"
-        "walignr1 wr3, wr14, wr15       \n\t"
-        "wmoveq wr4, wr11               \n\t"
-        "wmoveq wr5, wr12               \n\t"
-        "wmoveq wr6, wr14               \n\t"
-        "wmoveq wr7, wr15               \n\t"
-        "walignr2ne wr4, wr10, wr11     \n\t"
-        "walignr2ne wr5, wr11, wr12     \n\t"
-        "walignr2ne wr6, wr13, wr14     \n\t"
-        "walignr2ne wr7, wr14, wr15     \n\t"
-        "wldrd wr10, [%[block]]         \n\t"
-        WAVG2B" wr0, wr0, wr4           \n\t"
-        "wldrd wr11, [%[block], #8]     \n\t"
-        WAVG2B" wr1, wr1, wr5           \n\t"
-        "wldrd wr12, [r5]               \n\t"
-        WAVG2B" wr2, wr2, wr6           \n\t"
-        "wldrd wr13, [r5, #8]           \n\t"
-        WAVG2B" wr3, wr3, wr7           \n\t"
-        WAVG2B" wr0, wr0, wr10          \n\t"
-        WAVG2B" wr1, wr1, wr11          \n\t"
-        WAVG2B" wr2, wr2, wr12          \n\t"
-        WAVG2B" wr3, wr3, wr13          \n\t"
-        "wstrd wr0, [%[block]]          \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        "wstrd wr1, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "wstrd wr2, [r5]                \n\t"
-        "pld [%[block]]                 \n\t"
-        "wstrd wr3, [r5, #8]            \n\t"
-        "add r5, r5, %[line_size]       \n\t"
-        "pld [%[block], #32]            \n\t"
-        "pld [r5]                       \n\t"
-        "pld [r5, #32]                  \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
-        :
-        :"r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    __asm__ volatile(
-        "pld            [%[pixels]]                             \n\t"
-        "pld            [%[pixels], #32]                        \n\t"
-        "and            r12, %[pixels], #7                      \n\t"
-        "tmcr           wcgr1, r12                              \n\t"
-        "bic            %[pixels], %[pixels], #7                \n\t"
-
-        "wldrd          wr10, [%[pixels]]                       \n\t"
-        "wldrd          wr11, [%[pixels], #8]                   \n\t"
-        "pld            [%[block]]                              \n\t"
-        "add            %[pixels], %[pixels], %[line_size]      \n\t"
-        "walignr1       wr0, wr10, wr11                         \n\t"
-        "pld            [%[pixels]]                             \n\t"
-        "pld            [%[pixels], #32]                        \n\t"
-
-      "1:                                                       \n\t"
-        "wldrd          wr10, [%[pixels]]                       \n\t"
-        "wldrd          wr11, [%[pixels], #8]                   \n\t"
-        "add            %[pixels], %[pixels], %[line_size]      \n\t"
-        "pld            [%[pixels]]                             \n\t"
-        "pld            [%[pixels], #32]                        \n\t"
-        "walignr1       wr4, wr10, wr11                         \n\t"
-        "wldrd          wr10, [%[block]]                        \n\t"
-         WAVG2B"        wr8, wr0, wr4                           \n\t"
-         WAVG2B"        wr8, wr8, wr10                          \n\t"
-        "wstrd          wr8, [%[block]]                         \n\t"
-        "add            %[block], %[block], %[line_size]        \n\t"
-
-        "wldrd          wr10, [%[pixels]]                       \n\t"
-        "wldrd          wr11, [%[pixels], #8]                   \n\t"
-        "pld            [%[block]]                              \n\t"
-        "add            %[pixels], %[pixels], %[line_size]      \n\t"
-        "pld            [%[pixels]]                             \n\t"
-        "pld            [%[pixels], #32]                        \n\t"
-        "walignr1       wr0, wr10, wr11                         \n\t"
-        "wldrd          wr10, [%[block]]                        \n\t"
-         WAVG2B"        wr8, wr0, wr4                           \n\t"
-         WAVG2B"        wr8, wr8, wr10                          \n\t"
-        "wstrd          wr8, [%[block]]                         \n\t"
-        "add            %[block], %[block], %[line_size]        \n\t"
-
-        "subs           %[h], %[h], #2                          \n\t"
-        "pld            [%[block]]                              \n\t"
-        "bne            1b                                      \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
-        :
-        : "cc", "memory", "r12");
-}
-
-void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "and r12, %[pixels], #7         \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "walignr1 wr1, wr11, wr12       \n\t"
-
-        "1:                             \n\t"
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr4, wr10, wr11       \n\t"
-        "walignr1 wr5, wr11, wr12       \n\t"
-        WAVG2B" wr8, wr0, wr4           \n\t"
-        WAVG2B" wr9, wr1, wr5           \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "walignr1 wr1, wr11, wr12       \n\t"
-        WAVG2B" wr8, wr0, wr4           \n\t"
-        WAVG2B" wr9, wr1, wr5           \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        "subs %[h], %[h], #2            \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
-        :
-        : "r4", "r5", "r12", "memory");
-}
-
-void DEF(avg, pixels16_y2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    int stride = line_size;
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "and r12, %[pixels], #7         \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "pld [%[block]]                 \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "walignr1 wr1, wr11, wr12       \n\t"
-
-        "1:                             \n\t"
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr4, wr10, wr11       \n\t"
-        "walignr1 wr5, wr11, wr12       \n\t"
-        "wldrd wr10, [%[block]]         \n\t"
-        "wldrd wr11, [%[block], #8]     \n\t"
-        WAVG2B" wr8, wr0, wr4           \n\t"
-        WAVG2B" wr9, wr1, wr5           \n\t"
-        WAVG2B" wr8, wr8, wr10          \n\t"
-        WAVG2B" wr9, wr9, wr11          \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        "wldrd wr10, [%[pixels]]        \n\t"
-        "wldrd wr11, [%[pixels], #8]    \n\t"
-        "pld [%[block]]                 \n\t"
-        "wldrd wr12, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr0, wr10, wr11       \n\t"
-        "walignr1 wr1, wr11, wr12       \n\t"
-        "wldrd wr10, [%[block]]         \n\t"
-        "wldrd wr11, [%[block], #8]     \n\t"
-        WAVG2B" wr8, wr0, wr4           \n\t"
-        WAVG2B" wr9, wr1, wr5           \n\t"
-        WAVG2B" wr8, wr8, wr10          \n\t"
-        WAVG2B" wr9, wr9, wr11          \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        "subs %[h], %[h], #2            \n\t"
-        "pld [%[block]]                 \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block), [line_size]"+r"(stride)
-        :
-        : "r4", "r5", "r12", "memory");
-}
-
-void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "mov r12, #2                    \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "tmcr wcgr0, r12                \n\t" /* for shift value */
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "add r12, r12, #1               \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "tmcr wcgr2, r12                \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "cmp r12, #8                    \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-
-        "1:                             \n\t"
-        // [wr0 wr1 wr2 wr3]
-        // [wr4 wr5 wr6 wr7] <= *
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr6, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "wunpckelub wr4, wr6            \n\t"
-        "wunpckehub wr5, wr6            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "waddhus wr4, wr4, wr8          \n\t"
-        "waddhus wr5, wr5, wr9          \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
-        : [line_size]"r"(line_size)
-        : "r12", "memory");
-}
-
-void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[pixels]]                \n\t"
-        "mov r12, #2                    \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "tmcr wcgr0, r12                \n\t" /* for shift value */
-        /* alignment */
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "add r12, r12, #1               \n\t"
-        "tmcr wcgr2, r12                \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "wldrd wr14, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr3, wr13, wr14       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "wmoveq wr11, wr14              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "walignr2ne wr11, wr13, wr14    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr2, wr3            \n\t"
-        "wunpckehub wr3, wr3            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "wunpckelub wr10, wr11          \n\t"
-        "wunpckehub wr11, wr11          \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-        "waddhus wr2, wr2, wr10         \n\t"
-        "waddhus wr3, wr3, wr11         \n\t"
-
-        "1:                             \n\t"
-        // [wr0 wr1 wr2 wr3]
-        // [wr4 wr5 wr6 wr7] <= *
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "wldrd wr14, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr6, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr7, wr13, wr14       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "wmoveq wr11, wr14              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "walignr2ne wr11, wr13, wr14    \n\t"
-        "wunpckelub wr4, wr6            \n\t"
-        "wunpckehub wr5, wr6            \n\t"
-        "wunpckelub wr6, wr7            \n\t"
-        "wunpckehub wr7, wr7            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "wunpckelub wr10, wr11          \n\t"
-        "wunpckehub wr11, wr11          \n\t"
-        "waddhus wr4, wr4, wr8          \n\t"
-        "waddhus wr5, wr5, wr9          \n\t"
-        "waddhus wr6, wr6, wr10         \n\t"
-        "waddhus wr7, wr7, wr11         \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr10, wr2, wr6         \n\t"
-        "waddhus wr11, wr3, wr7         \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "waddhus wr10, wr10, wr15       \n\t"
-        "waddhus wr11, wr11, wr15       \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wsrlhg wr10, wr10, wcgr0       \n\t"
-        "wsrlhg wr11, wr11, wcgr0       \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        "wpackhus wr9, wr10, wr11       \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "wldrd wr14, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr3, wr13, wr14       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "wmoveq wr11, wr14              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "walignr2ne wr11, wr13, wr14    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr2, wr3            \n\t"
-        "wunpckehub wr3, wr3            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "wunpckelub wr10, wr11          \n\t"
-        "wunpckehub wr11, wr11          \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-        "waddhus wr2, wr2, wr10         \n\t"
-        "waddhus wr3, wr3, wr11         \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr10, wr2, wr6         \n\t"
-        "waddhus wr11, wr3, wr7         \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "waddhus wr10, wr10, wr15       \n\t"
-        "waddhus wr11, wr11, wr15       \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wsrlhg wr10, wr10, wcgr0       \n\t"
-        "wsrlhg wr11, wr11, wcgr0       \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        "wpackhus wr9, wr10, wr11       \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        "subs %[h], %[h], #2            \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
-        : [line_size]"r"(line_size)
-        : "r12", "memory");
-}
-
-void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "pld [%[pixels]]                \n\t"
-        "mov r12, #2                    \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "tmcr wcgr0, r12                \n\t" /* for shift value */
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7   \n\t"
-        "tmcr wcgr1, r12                \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "add r12, r12, #1               \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "tmcr wcgr2, r12                \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "cmp r12, #8                    \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-
-        "1:                             \n\t"
-        // [wr0 wr1 wr2 wr3]
-        // [wr4 wr5 wr6 wr7] <= *
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr6, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "wunpckelub wr4, wr6            \n\t"
-        "wunpckehub wr5, wr6            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "waddhus wr4, wr4, wr8          \n\t"
-        "waddhus wr5, wr5, wr9          \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "wldrd wr12, [%[block]]         \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        WAVG2B" wr8, wr8, wr12          \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "wldrd wr12, [%[block]]         \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        WAVG2B" wr8, wr8, wr12          \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
-        : [line_size]"r"(line_size)
-        : "r12", "memory");
-}
-
-void DEF(avg, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, const int line_size, int h)
-{
-    // [wr0 wr1 wr2 wr3] for previous line
-    // [wr4 wr5 wr6 wr7] for current line
-    SET_RND(wr15); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "pld [%[pixels]]                \n\t"
-        "mov r12, #2                    \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "tmcr wcgr0, r12                \n\t" /* for shift value */
-        /* alignment */
-        "and r12, %[pixels], #7         \n\t"
-        "bic %[pixels], %[pixels], #7           \n\t"
-        "tmcr wcgr1, r12                \n\t"
-        "add r12, r12, #1               \n\t"
-        "tmcr wcgr2, r12                \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "wldrd wr14, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "pld [%[pixels]]                \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr3, wr13, wr14       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "wmoveq wr11, wr14              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "walignr2ne wr11, wr13, wr14    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr2, wr3            \n\t"
-        "wunpckehub wr3, wr3            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "wunpckelub wr10, wr11          \n\t"
-        "wunpckehub wr11, wr11          \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-        "waddhus wr2, wr2, wr10         \n\t"
-        "waddhus wr3, wr3, wr11         \n\t"
-
-        "1:                             \n\t"
-        // [wr0 wr1 wr2 wr3]
-        // [wr4 wr5 wr6 wr7] <= *
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "cmp r12, #8                    \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "wldrd wr14, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr6, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr7, wr13, wr14       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "wmoveq wr11, wr14              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "walignr2ne wr11, wr13, wr14    \n\t"
-        "wunpckelub wr4, wr6            \n\t"
-        "wunpckehub wr5, wr6            \n\t"
-        "wunpckelub wr6, wr7            \n\t"
-        "wunpckehub wr7, wr7            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "wunpckelub wr10, wr11          \n\t"
-        "wunpckehub wr11, wr11          \n\t"
-        "waddhus wr4, wr4, wr8          \n\t"
-        "waddhus wr5, wr5, wr9          \n\t"
-        "waddhus wr6, wr6, wr10         \n\t"
-        "waddhus wr7, wr7, wr11         \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr10, wr2, wr6         \n\t"
-        "waddhus wr11, wr3, wr7         \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "waddhus wr10, wr10, wr15       \n\t"
-        "waddhus wr11, wr11, wr15       \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wldrd wr12, [%[block]]         \n\t"
-        "wldrd wr13, [%[block], #8]     \n\t"
-        "wsrlhg wr10, wr10, wcgr0       \n\t"
-        "wsrlhg wr11, wr11, wcgr0       \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        "wpackhus wr9, wr10, wr11       \n\t"
-        WAVG2B" wr8, wr8, wr12          \n\t"
-        WAVG2B" wr9, wr9, wr13          \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-
-        // [wr0 wr1 wr2 wr3] <= *
-        // [wr4 wr5 wr6 wr7]
-        "wldrd wr12, [%[pixels]]        \n\t"
-        "pld [%[block]]                 \n\t"
-        "wldrd wr13, [%[pixels], #8]    \n\t"
-        "pld [%[block], #32]            \n\t"
-        "wldrd wr14, [%[pixels], #16]   \n\t"
-        "add %[pixels], %[pixels], %[line_size] \n\t"
-        "walignr1 wr2, wr12, wr13       \n\t"
-        "pld [%[pixels]]                \n\t"
-        "pld [%[pixels], #32]           \n\t"
-        "walignr1 wr3, wr13, wr14       \n\t"
-        "wmoveq wr10, wr13              \n\t"
-        "wmoveq wr11, wr14              \n\t"
-        "walignr2ne wr10, wr12, wr13    \n\t"
-        "walignr2ne wr11, wr13, wr14    \n\t"
-        "wunpckelub wr0, wr2            \n\t"
-        "wunpckehub wr1, wr2            \n\t"
-        "wunpckelub wr2, wr3            \n\t"
-        "wunpckehub wr3, wr3            \n\t"
-        "wunpckelub wr8, wr10           \n\t"
-        "wunpckehub wr9, wr10           \n\t"
-        "wunpckelub wr10, wr11          \n\t"
-        "wunpckehub wr11, wr11          \n\t"
-        "waddhus wr0, wr0, wr8          \n\t"
-        "waddhus wr1, wr1, wr9          \n\t"
-        "waddhus wr2, wr2, wr10         \n\t"
-        "waddhus wr3, wr3, wr11         \n\t"
-        "waddhus wr8, wr0, wr4          \n\t"
-        "waddhus wr9, wr1, wr5          \n\t"
-        "waddhus wr10, wr2, wr6         \n\t"
-        "waddhus wr11, wr3, wr7         \n\t"
-        "waddhus wr8, wr8, wr15         \n\t"
-        "waddhus wr9, wr9, wr15         \n\t"
-        "waddhus wr10, wr10, wr15       \n\t"
-        "waddhus wr11, wr11, wr15       \n\t"
-        "wsrlhg wr8, wr8, wcgr0         \n\t"
-        "wsrlhg wr9, wr9, wcgr0         \n\t"
-        "wldrd wr12, [%[block]]         \n\t"
-        "wldrd wr13, [%[block], #8]     \n\t"
-        "wsrlhg wr10, wr10, wcgr0       \n\t"
-        "wsrlhg wr11, wr11, wcgr0       \n\t"
-        "wpackhus wr8, wr8, wr9         \n\t"
-        "wpackhus wr9, wr10, wr11       \n\t"
-        WAVG2B" wr8, wr8, wr12          \n\t"
-        WAVG2B" wr9, wr9, wr13          \n\t"
-        "wstrd wr8, [%[block]]          \n\t"
-        "wstrd wr9, [%[block], #8]      \n\t"
-        "add %[block], %[block], %[line_size]   \n\t"
-        "subs %[h], %[h], #2            \n\t"
-        "pld [%[block]]                 \n\t"
-        "pld [%[block], #32]            \n\t"
-        "bne 1b                         \n\t"
-        : [h]"+r"(h), [pixels]"+r"(pixels), [block]"+r"(block)
-        : [line_size]"r"(line_size)
-        : "r12", "memory");
-}
diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S
deleted file mode 100644
index 722ed78..0000000
--- a/libavcodec/arm/dsputil_neon.S
+++ /dev/null
@@ -1,1146 +0,0 @@
-/*
- * ARM NEON optimised DSP functions
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "asm.S"
-
-        preserve8
-        .text
-
-        .macro pixels16 avg=0
-.if \avg
-        mov             ip,  r0
-.endif
-1:      vld1.64         {d0, d1},  [r1], r2
-        vld1.64         {d2, d3},  [r1], r2
-        vld1.64         {d4, d5},  [r1], r2
-        pld             [r1, r2, lsl #2]
-        vld1.64         {d6, d7},  [r1], r2
-        pld             [r1]
-        pld             [r1, r2]
-        pld             [r1, r2, lsl #1]
-.if \avg
-        vld1.64         {d16,d17}, [ip,:128], r2
-        vrhadd.u8       q0,  q0,  q8
-        vld1.64         {d18,d19}, [ip,:128], r2
-        vrhadd.u8       q1,  q1,  q9
-        vld1.64         {d20,d21}, [ip,:128], r2
-        vrhadd.u8       q2,  q2,  q10
-        vld1.64         {d22,d23}, [ip,:128], r2
-        vrhadd.u8       q3,  q3,  q11
-.endif
-        subs            r3,  r3,  #4
-        vst1.64         {d0, d1},  [r0,:128], r2
-        vst1.64         {d2, d3},  [r0,:128], r2
-        vst1.64         {d4, d5},  [r0,:128], r2
-        vst1.64         {d6, d7},  [r0,:128], r2
-        bne             1b
-        bx              lr
-        .endm
-
-        .macro pixels16_x2 vhadd=vrhadd.u8
-1:      vld1.64         {d0-d2},   [r1], r2
-        vld1.64         {d4-d6},   [r1], r2
-        pld             [r1]
-        pld             [r1, r2]
-        subs            r3,  r3,  #2
-        vext.8          q1,  q0,  q1,  #1
-        \vhadd          q0,  q0,  q1
-        vext.8          q3,  q2,  q3,  #1
-        \vhadd          q2,  q2,  q3
-        vst1.64         {d0, d1},  [r0,:128], r2
-        vst1.64         {d4, d5},  [r0,:128], r2
-        bne             1b
-        bx              lr
-        .endm
-
-        .macro pixels16_y2 vhadd=vrhadd.u8
-        vld1.64         {d0, d1},  [r1], r2
-        vld1.64         {d2, d3},  [r1], r2
-1:      subs            r3,  r3,  #2
-        \vhadd          q2,  q0,  q1
-        vld1.64         {d0, d1},  [r1], r2
-        \vhadd          q3,  q0,  q1
-        vld1.64         {d2, d3},  [r1], r2
-        pld             [r1]
-        pld             [r1, r2]
-        vst1.64         {d4, d5},  [r0,:128], r2
-        vst1.64         {d6, d7},  [r0,:128], r2
-        bne             1b
-        bx              lr
-        .endm
-
-        .macro pixels16_xy2 vshrn=vrshrn.u16 no_rnd=0
-        vld1.64         {d0-d2},   [r1], r2
-        vld1.64         {d4-d6},   [r1], r2
-.if \no_rnd
-        vmov.i16        q13, #1
-.endif
-        pld             [r1]
-        pld             [r1, r2]
-        vext.8          q1,  q0,  q1,  #1
-        vext.8          q3,  q2,  q3,  #1
-        vaddl.u8        q8,  d0,  d2
-        vaddl.u8        q10, d1,  d3
-        vaddl.u8        q9,  d4,  d6
-        vaddl.u8        q11, d5,  d7
-1:      subs            r3,  r3,  #2
-        vld1.64         {d0-d2},   [r1], r2
-        vadd.u16        q12, q8,  q9
-        pld             [r1]
-.if \no_rnd
-        vadd.u16        q12, q12, q13
-.endif
-        vext.8          q15, q0,  q1,  #1
-        vadd.u16        q1 , q10, q11
-        \vshrn          d28, q12, #2
-.if \no_rnd
-        vadd.u16        q1,  q1,  q13
-.endif
-        \vshrn          d29, q1,  #2
-        vaddl.u8        q8,  d0,  d30
-        vld1.64         {d2-d4},   [r1], r2
-        vaddl.u8        q10, d1,  d31
-        vst1.64         {d28,d29}, [r0,:128], r2
-        vadd.u16        q12, q8,  q9
-        pld             [r1, r2]
-.if \no_rnd
-        vadd.u16        q12, q12, q13
-.endif
-        vext.8          q2,  q1,  q2,  #1
-        vadd.u16        q0,  q10, q11
-        \vshrn          d30, q12, #2
-.if \no_rnd
-        vadd.u16        q0,  q0,  q13
-.endif
-        \vshrn          d31, q0,  #2
-        vaddl.u8        q9,  d2,  d4
-        vaddl.u8        q11, d3,  d5
-        vst1.64         {d30,d31}, [r0,:128], r2
-        bgt             1b
-        bx              lr
-        .endm
-
-        .macro pixels8 avg=0
-1:      vld1.64         {d0}, [r1], r2
-        vld1.64         {d1}, [r1], r2
-        vld1.64         {d2}, [r1], r2
-        pld             [r1, r2, lsl #2]
-        vld1.64         {d3}, [r1], r2
-        pld             [r1]
-        pld             [r1, r2]
-        pld             [r1, r2, lsl #1]
-.if \avg
-        vld1.64         {d4}, [r0,:64], r2
-        vrhadd.u8       d0,  d0,  d4
-        vld1.64         {d5}, [r0,:64], r2
-        vrhadd.u8       d1,  d1,  d5
-        vld1.64         {d6}, [r0,:64], r2
-        vrhadd.u8       d2,  d2,  d6
-        vld1.64         {d7}, [r0,:64], r2
-        vrhadd.u8       d3,  d3,  d7
-        sub             r0,  r0,  r2,  lsl #2
-.endif
-        subs            r3,  r3,  #4
-        vst1.64         {d0}, [r0,:64], r2
-        vst1.64         {d1}, [r0,:64], r2
-        vst1.64         {d2}, [r0,:64], r2
-        vst1.64         {d3}, [r0,:64], r2
-        bne             1b
-        bx              lr
-        .endm
-
-        .macro pixels8_x2 vhadd=vrhadd.u8
-1:      vld1.64         {d0, d1},  [r1], r2
-        vext.8          d1,  d0,  d1,  #1
-        vld1.64         {d2, d3},  [r1], r2
-        vext.8          d3,  d2,  d3,  #1
-        pld             [r1]
-        pld             [r1, r2]
-        subs            r3,  r3,  #2
-        vswp            d1,  d2
-        \vhadd          q0,  q0,  q1
-        vst1.64         {d0},      [r0,:64], r2
-        vst1.64         {d1},      [r0,:64], r2
-        bne             1b
-        bx              lr
-        .endm
-
-        .macro pixels8_y2 vhadd=vrhadd.u8
-        vld1.64         {d0},      [r1], r2
-        vld1.64         {d1},      [r1], r2
-1:      subs            r3,  r3,  #2
-        \vhadd          d4,  d0,  d1
-        vld1.64         {d0},      [r1], r2
-        \vhadd          d5,  d0,  d1
-        vld1.64         {d1},      [r1], r2
-        pld             [r1]
-        pld             [r1, r2]
-        vst1.64         {d4},      [r0,:64], r2
-        vst1.64         {d5},      [r0,:64], r2
-        bne             1b
-        bx              lr
-        .endm
-
-        .macro pixels8_xy2 vshrn=vrshrn.u16 no_rnd=0
-        vld1.64         {d0, d1},  [r1], r2
-        vld1.64         {d2, d3},  [r1], r2
-.if \no_rnd
-        vmov.i16        q11, #1
-.endif
-        pld             [r1]
-        pld             [r1, r2]
-        vext.8          d4,  d0,  d1,  #1
-        vext.8          d6,  d2,  d3,  #1
-        vaddl.u8        q8,  d0,  d4
-        vaddl.u8        q9,  d2,  d6
-1:      subs            r3,  r3,  #2
-        vld1.64         {d0, d1},  [r1], r2
-        pld             [r1]
-        vadd.u16        q10, q8,  q9
-        vext.8          d4,  d0,  d1,  #1
-.if \no_rnd
-        vadd.u16        q10, q10, q11
-.endif
-        vaddl.u8        q8,  d0,  d4
-        \vshrn          d5,  q10, #2
-        vld1.64         {d2, d3},  [r1], r2
-        vadd.u16        q10, q8,  q9
-        pld             [r1, r2]
-.if \no_rnd
-        vadd.u16        q10, q10, q11
-.endif
-        vst1.64         {d5},      [r0,:64], r2
-        \vshrn          d7,  q10, #2
-        vext.8          d6,  d2,  d3,  #1
-        vaddl.u8        q9,  d2,  d6
-        vst1.64         {d7},      [r0,:64], r2
-        bgt             1b
-        bx              lr
-        .endm
-
-        .macro pixfunc pfx name suf rnd_op args:vararg
-function ff_\pfx\name\suf\()_neon, export=1
-        \name \rnd_op \args
-endfunc
-        .endm
-
-        .macro pixfunc2 pfx name args:vararg
-        pixfunc \pfx \name
-        pixfunc \pfx \name \args
-        .endm
-
-function ff_put_h264_qpel16_mc00_neon, export=1
-        mov             r3,  #16
-endfunc
-
-        pixfunc  put_ pixels16
-        pixfunc2 put_ pixels16_x2,  _no_rnd, vhadd.u8
-        pixfunc2 put_ pixels16_y2,  _no_rnd, vhadd.u8
-        pixfunc2 put_ pixels16_xy2, _no_rnd, vshrn.u16, 1
-
-function ff_avg_h264_qpel16_mc00_neon, export=1
-        mov             r3,  #16
-endfunc
-
-        pixfunc  avg_ pixels16,, 1
-
-function ff_put_h264_qpel8_mc00_neon, export=1
-        mov             r3,  #8
-endfunc
-
-        pixfunc  put_ pixels8
-        pixfunc2 put_ pixels8_x2,   _no_rnd, vhadd.u8
-        pixfunc2 put_ pixels8_y2,   _no_rnd, vhadd.u8
-        pixfunc2 put_ pixels8_xy2,  _no_rnd, vshrn.u16, 1
-
-function ff_avg_h264_qpel8_mc00_neon, export=1
-        mov             r3,  #8
-endfunc
-
-        pixfunc  avg_ pixels8,, 1
-
-function ff_put_pixels_clamped_neon, export=1
-        vld1.64         {d16-d19}, [r0,:128]!
-        vqmovun.s16     d0, q8
-        vld1.64         {d20-d23}, [r0,:128]!
-        vqmovun.s16     d1, q9
-        vld1.64         {d24-d27}, [r0,:128]!
-        vqmovun.s16     d2, q10
-        vld1.64         {d28-d31}, [r0,:128]!
-        vqmovun.s16     d3, q11
-        vst1.64         {d0},      [r1,:64], r2
-        vqmovun.s16     d4, q12
-        vst1.64         {d1},      [r1,:64], r2
-        vqmovun.s16     d5, q13
-        vst1.64         {d2},      [r1,:64], r2
-        vqmovun.s16     d6, q14
-        vst1.64         {d3},      [r1,:64], r2
-        vqmovun.s16     d7, q15
-        vst1.64         {d4},      [r1,:64], r2
-        vst1.64         {d5},      [r1,:64], r2
-        vst1.64         {d6},      [r1,:64], r2
-        vst1.64         {d7},      [r1,:64], r2
-        bx              lr
-endfunc
-
-function ff_put_signed_pixels_clamped_neon, export=1
-        vmov.u8         d31, #128
-        vld1.64         {d16-d17}, [r0,:128]!
-        vqmovn.s16      d0, q8
-        vld1.64         {d18-d19}, [r0,:128]!
-        vqmovn.s16      d1, q9
-        vld1.64         {d16-d17}, [r0,:128]!
-        vqmovn.s16      d2, q8
-        vld1.64         {d18-d19}, [r0,:128]!
-        vadd.u8         d0, d0, d31
-        vld1.64         {d20-d21}, [r0,:128]!
-        vadd.u8         d1, d1, d31
-        vld1.64         {d22-d23}, [r0,:128]!
-        vadd.u8         d2, d2, d31
-        vst1.64         {d0},      [r1,:64], r2
-        vqmovn.s16      d3, q9
-        vst1.64         {d1},      [r1,:64], r2
-        vqmovn.s16      d4, q10
-        vst1.64         {d2},      [r1,:64], r2
-        vqmovn.s16      d5, q11
-        vld1.64         {d24-d25}, [r0,:128]!
-        vadd.u8         d3, d3, d31
-        vld1.64         {d26-d27}, [r0,:128]!
-        vadd.u8         d4, d4, d31
-        vadd.u8         d5, d5, d31
-        vst1.64         {d3},      [r1,:64], r2
-        vqmovn.s16      d6, q12
-        vst1.64         {d4},      [r1,:64], r2
-        vqmovn.s16      d7, q13
-        vst1.64         {d5},      [r1,:64], r2
-        vadd.u8         d6, d6, d31
-        vadd.u8         d7, d7, d31
-        vst1.64         {d6},      [r1,:64], r2
-        vst1.64         {d7},      [r1,:64], r2
-        bx              lr
-endfunc
-
-function ff_add_pixels_clamped_neon, export=1
-        mov             r3, r1
-        vld1.64         {d16},   [r1,:64], r2
-        vld1.64         {d0-d1}, [r0,:128]!
-        vaddw.u8        q0, q0, d16
-        vld1.64         {d17},   [r1,:64], r2
-        vld1.64         {d2-d3}, [r0,:128]!
-        vqmovun.s16     d0, q0
-        vld1.64         {d18},   [r1,:64], r2
-        vaddw.u8        q1, q1, d17
-        vld1.64         {d4-d5}, [r0,:128]!
-        vaddw.u8        q2, q2, d18
-        vst1.64         {d0},    [r3,:64], r2
-        vqmovun.s16     d2, q1
-        vld1.64         {d19},   [r1,:64], r2
-        vld1.64         {d6-d7}, [r0,:128]!
-        vaddw.u8        q3, q3, d19
-        vqmovun.s16     d4, q2
-        vst1.64         {d2},    [r3,:64], r2
-        vld1.64         {d16},   [r1,:64], r2
-        vqmovun.s16     d6, q3
-        vld1.64         {d0-d1}, [r0,:128]!
-        vaddw.u8        q0, q0, d16
-        vst1.64         {d4},    [r3,:64], r2
-        vld1.64         {d17},   [r1,:64], r2
-        vld1.64         {d2-d3}, [r0,:128]!
-        vaddw.u8        q1, q1, d17
-        vst1.64         {d6},    [r3,:64], r2
-        vqmovun.s16     d0, q0
-        vld1.64         {d18},   [r1,:64], r2
-        vld1.64         {d4-d5}, [r0,:128]!
-        vaddw.u8        q2, q2, d18
-        vst1.64         {d0},    [r3,:64], r2
-        vqmovun.s16     d2, q1
-        vld1.64         {d19},   [r1,:64], r2
-        vqmovun.s16     d4, q2
-        vld1.64         {d6-d7}, [r0,:128]!
-        vaddw.u8        q3, q3, d19
-        vst1.64         {d2},    [r3,:64], r2
-        vqmovun.s16     d6, q3
-        vst1.64         {d4},    [r3,:64], r2
-        vst1.64         {d6},    [r3,:64], r2
-        bx              lr
-endfunc
-
-function ff_float_to_int16_neon, export=1
-        subs            r2,  r2,  #8
-        vld1.64         {d0-d1},  [r1,:128]!
-        vcvt.s32.f32    q8,  q0,  #16
-        vld1.64         {d2-d3},  [r1,:128]!
-        vcvt.s32.f32    q9,  q1,  #16
-        beq             3f
-        bics            ip,  r2,  #15
-        beq             2f
-1:      subs            ip,  ip,  #16
-        vshrn.s32       d4,  q8,  #16
-        vld1.64         {d0-d1},  [r1,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vshrn.s32       d5,  q9,  #16
-        vld1.64         {d2-d3},  [r1,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vshrn.s32       d6,  q0,  #16
-        vst1.64         {d4-d5},  [r0,:128]!
-        vshrn.s32       d7,  q1,  #16
-        vld1.64         {d16-d17},[r1,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r1,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.64         {d6-d7},  [r0,:128]!
-        bne             1b
-        ands            r2,  r2,  #15
-        beq             3f
-2:      vld1.64         {d0-d1},  [r1,:128]!
-        vshrn.s32       d4,  q8,  #16
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r1,:128]!
-        vshrn.s32       d5,  q9,  #16
-        vcvt.s32.f32    q1,  q1,  #16
-        vshrn.s32       d6,  q0,  #16
-        vst1.64         {d4-d5},  [r0,:128]!
-        vshrn.s32       d7,  q1,  #16
-        vst1.64         {d6-d7},  [r0,:128]!
-        bx              lr
-3:      vshrn.s32       d4,  q8,  #16
-        vshrn.s32       d5,  q9,  #16
-        vst1.64         {d4-d5},  [r0,:128]!
-        bx              lr
-endfunc
-
-function ff_float_to_int16_interleave_neon, export=1
-        cmp             r3, #2
-        ldrlt           r1, [r1]
-        blt             ff_float_to_int16_neon
-        bne             4f
-
-        ldr             r3, [r1]
-        ldr             r1, [r1, #4]
-
-        subs            r2,  r2,  #8
-        vld1.64         {d0-d1},  [r3,:128]!
-        vcvt.s32.f32    q8,  q0,  #16
-        vld1.64         {d2-d3},  [r3,:128]!
-        vcvt.s32.f32    q9,  q1,  #16
-        vld1.64         {d20-d21},[r1,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r1,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        beq             3f
-        bics            ip,  r2,  #15
-        beq             2f
-1:      subs            ip,  ip,  #16
-        vld1.64         {d0-d1},  [r3,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vsri.32         q10, q8,  #16
-        vld1.64         {d2-d3},  [r3,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vld1.64         {d24-d25},[r1,:128]!
-        vcvt.s32.f32    q12, q12, #16
-        vld1.64         {d26-d27},[r1,:128]!
-        vsri.32         q11, q9,  #16
-        vst1.64         {d20-d21},[r0,:128]!
-        vcvt.s32.f32    q13, q13, #16
-        vst1.64         {d22-d23},[r0,:128]!
-        vsri.32         q12, q0,  #16
-        vld1.64         {d16-d17},[r3,:128]!
-        vsri.32         q13, q1,  #16
-        vst1.64         {d24-d25},[r0,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r3,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vld1.64         {d20-d21},[r1,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r1,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        vst1.64         {d26-d27},[r0,:128]!
-        bne             1b
-        ands            r2,  r2,  #15
-        beq             3f
-2:      vsri.32         q10, q8,  #16
-        vld1.64         {d0-d1},  [r3,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r3,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vld1.64         {d24-d25},[r1,:128]!
-        vcvt.s32.f32    q12, q12, #16
-        vsri.32         q11, q9,  #16
-        vld1.64         {d26-d27},[r1,:128]!
-        vcvt.s32.f32    q13, q13, #16
-        vst1.64         {d20-d21},[r0,:128]!
-        vsri.32         q12, q0,  #16
-        vst1.64         {d22-d23},[r0,:128]!
-        vsri.32         q13, q1,  #16
-        vst1.64         {d24-d27},[r0,:128]!
-        bx              lr
-3:      vsri.32         q10, q8,  #16
-        vsri.32         q11, q9,  #16
-        vst1.64         {d20-d23},[r0,:128]!
-        bx              lr
-
-4:      push            {r4-r8,lr}
-        cmp             r3,  #4
-        lsl             ip,  r3,  #1
-        blt             4f
-
-        @ 4 channels
-5:      ldmia           r1!, {r4-r7}
-        mov             lr,  r2
-        mov             r8,  r0
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vld1.64         {d20-d21},[r6,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r7,:128]!
-        vcvt.s32.f32    q11, q11, #16
-6:      subs            lr,  lr,  #8
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vsri.32         q9,  q8,  #16
-        vld1.64         {d2-d3},  [r5,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vsri.32         q11, q10, #16
-        vld1.64         {d4-d5},  [r6,:128]!
-        vcvt.s32.f32    q2,  q2,  #16
-        vzip.32         d18, d22
-        vld1.64         {d6-d7},  [r7,:128]!
-        vcvt.s32.f32    q3,  q3,  #16
-        vzip.32         d19, d23
-        vst1.64         {d18},    [r8], ip
-        vsri.32         q1,  q0,  #16
-        vst1.64         {d22},    [r8], ip
-        vsri.32         q3,  q2,  #16
-        vst1.64         {d19},    [r8], ip
-        vzip.32         d2,  d6
-        vst1.64         {d23},    [r8], ip
-        vzip.32         d3,  d7
-        beq             7f
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vst1.64         {d2},     [r8], ip
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.64         {d6},     [r8], ip
-        vld1.64         {d20-d21},[r6,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vst1.64         {d3},     [r8], ip
-        vld1.64         {d22-d23},[r7,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        vst1.64         {d7},     [r8], ip
-        b               6b
-7:      vst1.64         {d2},     [r8], ip
-        vst1.64         {d6},     [r8], ip
-        vst1.64         {d3},     [r8], ip
-        vst1.64         {d7},     [r8], ip
-        subs            r3,  r3,  #4
-        popeq           {r4-r8,pc}
-        cmp             r3,  #4
-        add             r0,  r0,  #8
-        bge             5b
-
-        @ 2 channels
-4:      cmp             r3,  #2
-        blt             4f
-        ldmia           r1!, {r4-r5}
-        mov             lr,  r2
-        mov             r8,  r0
-        tst             lr,  #8
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vld1.64         {d20-d21},[r4,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vld1.64         {d22-d23},[r5,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        beq             6f
-        subs            lr,  lr,  #8
-        beq             7f
-        vsri.32         d18, d16, #16
-        vsri.32         d19, d17, #16
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vst1.32         {d18[0]}, [r8], ip
-        vsri.32         d22, d20, #16
-        vst1.32         {d18[1]}, [r8], ip
-        vsri.32         d23, d21, #16
-        vst1.32         {d19[0]}, [r8], ip
-        vst1.32         {d19[1]}, [r8], ip
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.32         {d22[0]}, [r8], ip
-        vst1.32         {d22[1]}, [r8], ip
-        vld1.64         {d20-d21},[r4,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vst1.32         {d23[0]}, [r8], ip
-        vst1.32         {d23[1]}, [r8], ip
-        vld1.64         {d22-d23},[r5,:128]!
-        vcvt.s32.f32    q11, q11, #16
-6:      subs            lr,  lr,  #16
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vsri.32         d18, d16, #16
-        vld1.64         {d2-d3},  [r5,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        vsri.32         d19, d17, #16
-        vld1.64         {d4-d5},  [r4,:128]!
-        vcvt.s32.f32    q2,  q2,  #16
-        vld1.64         {d6-d7},  [r5,:128]!
-        vcvt.s32.f32    q3,  q3,  #16
-        vst1.32         {d18[0]}, [r8], ip
-        vsri.32         d22, d20, #16
-        vst1.32         {d18[1]}, [r8], ip
-        vsri.32         d23, d21, #16
-        vst1.32         {d19[0]}, [r8], ip
-        vsri.32         d2,  d0,  #16
-        vst1.32         {d19[1]}, [r8], ip
-        vsri.32         d3,  d1,  #16
-        vst1.32         {d22[0]}, [r8], ip
-        vsri.32         d6,  d4,  #16
-        vst1.32         {d22[1]}, [r8], ip
-        vsri.32         d7,  d5,  #16
-        vst1.32         {d23[0]}, [r8], ip
-        vst1.32         {d23[1]}, [r8], ip
-        beq             6f
-        vld1.64         {d16-d17},[r4,:128]!
-        vcvt.s32.f32    q8,  q8,  #16
-        vst1.32         {d2[0]},  [r8], ip
-        vst1.32         {d2[1]},  [r8], ip
-        vld1.64         {d18-d19},[r5,:128]!
-        vcvt.s32.f32    q9,  q9,  #16
-        vst1.32         {d3[0]},  [r8], ip
-        vst1.32         {d3[1]},  [r8], ip
-        vld1.64         {d20-d21},[r4,:128]!
-        vcvt.s32.f32    q10, q10, #16
-        vst1.32         {d6[0]},  [r8], ip
-        vst1.32         {d6[1]},  [r8], ip
-        vld1.64         {d22-d23},[r5,:128]!
-        vcvt.s32.f32    q11, q11, #16
-        vst1.32         {d7[0]},  [r8], ip
-        vst1.32         {d7[1]},  [r8], ip
-        bgt             6b
-6:      vst1.32         {d2[0]},  [r8], ip
-        vst1.32         {d2[1]},  [r8], ip
-        vst1.32         {d3[0]},  [r8], ip
-        vst1.32         {d3[1]},  [r8], ip
-        vst1.32         {d6[0]},  [r8], ip
-        vst1.32         {d6[1]},  [r8], ip
-        vst1.32         {d7[0]},  [r8], ip
-        vst1.32         {d7[1]},  [r8], ip
-        b               8f
-7:      vsri.32         d18, d16, #16
-        vsri.32         d19, d17, #16
-        vst1.32         {d18[0]}, [r8], ip
-        vsri.32         d22, d20, #16
-        vst1.32         {d18[1]}, [r8], ip
-        vsri.32         d23, d21, #16
-        vst1.32         {d19[0]}, [r8], ip
-        vst1.32         {d19[1]}, [r8], ip
-        vst1.32         {d22[0]}, [r8], ip
-        vst1.32         {d22[1]}, [r8], ip
-        vst1.32         {d23[0]}, [r8], ip
-        vst1.32         {d23[1]}, [r8], ip
-8:      subs            r3,  r3,  #2
-        add             r0,  r0,  #4
-        popeq           {r4-r8,pc}
-
-        @ 1 channel
-4:      ldr             r4,  [r1],#4
-        tst             r2,  #8
-        mov             lr,  r2
-        mov             r5,  r0
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r4,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        bne             8f
-6:      subs            lr,  lr,  #16
-        vld1.64         {d4-d5},  [r4,:128]!
-        vcvt.s32.f32    q2,  q2,  #16
-        vld1.64         {d6-d7},  [r4,:128]!
-        vcvt.s32.f32    q3,  q3,  #16
-        vst1.16         {d0[1]},  [r5,:16], ip
-        vst1.16         {d0[3]},  [r5,:16], ip
-        vst1.16         {d1[1]},  [r5,:16], ip
-        vst1.16         {d1[3]},  [r5,:16], ip
-        vst1.16         {d2[1]},  [r5,:16], ip
-        vst1.16         {d2[3]},  [r5,:16], ip
-        vst1.16         {d3[1]},  [r5,:16], ip
-        vst1.16         {d3[3]},  [r5,:16], ip
-        beq             7f
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r4,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-7:      vst1.16         {d4[1]},  [r5,:16], ip
-        vst1.16         {d4[3]},  [r5,:16], ip
-        vst1.16         {d5[1]},  [r5,:16], ip
-        vst1.16         {d5[3]},  [r5,:16], ip
-        vst1.16         {d6[1]},  [r5,:16], ip
-        vst1.16         {d6[3]},  [r5,:16], ip
-        vst1.16         {d7[1]},  [r5,:16], ip
-        vst1.16         {d7[3]},  [r5,:16], ip
-        bgt             6b
-        pop             {r4-r8,pc}
-8:      subs            lr,  lr,  #8
-        vst1.16         {d0[1]},  [r5,:16], ip
-        vst1.16         {d0[3]},  [r5,:16], ip
-        vst1.16         {d1[1]},  [r5,:16], ip
-        vst1.16         {d1[3]},  [r5,:16], ip
-        vst1.16         {d2[1]},  [r5,:16], ip
-        vst1.16         {d2[3]},  [r5,:16], ip
-        vst1.16         {d3[1]},  [r5,:16], ip
-        vst1.16         {d3[3]},  [r5,:16], ip
-        popeq           {r4-r8,pc}
-        vld1.64         {d0-d1},  [r4,:128]!
-        vcvt.s32.f32    q0,  q0,  #16
-        vld1.64         {d2-d3},  [r4,:128]!
-        vcvt.s32.f32    q1,  q1,  #16
-        b               6b
-endfunc
-
-function ff_vector_fmul_neon, export=1
-        mov             r3,  r0
-        subs            r2,  r2,  #8
-        vld1.64         {d0-d3},  [r0,:128]!
-        vld1.64         {d4-d7},  [r1,:128]!
-        vmul.f32        q8,  q0,  q2
-        vmul.f32        q9,  q1,  q3
-        beq             3f
-        bics            ip,  r2,  #15
-        beq             2f
-1:      subs            ip,  ip,  #16
-        vld1.64         {d0-d1},  [r0,:128]!
-        vld1.64         {d4-d5},  [r1,:128]!
-        vmul.f32        q10, q0,  q2
-        vld1.64         {d2-d3},  [r0,:128]!
-        vld1.64         {d6-d7},  [r1,:128]!
-        vmul.f32        q11, q1,  q3
-        vst1.64         {d16-d19},[r3,:128]!
-        vld1.64         {d0-d1},  [r0,:128]!
-        vld1.64         {d4-d5},  [r1,:128]!
-        vmul.f32        q8,  q0,  q2
-        vld1.64         {d2-d3},  [r0,:128]!
-        vld1.64         {d6-d7},  [r1,:128]!
-        vmul.f32        q9,  q1,  q3
-        vst1.64         {d20-d23},[r3,:128]!
-        bne             1b
-        ands            r2,  r2,  #15
-        beq             3f
-2:      vld1.64         {d0-d1},  [r0,:128]!
-        vld1.64         {d4-d5},  [r1,:128]!
-        vst1.64         {d16-d17},[r3,:128]!
-        vmul.f32        q8,  q0,  q2
-        vld1.64         {d2-d3},  [r0,:128]!
-        vld1.64         {d6-d7},  [r1,:128]!
-        vst1.64         {d18-d19},[r3,:128]!
-        vmul.f32        q9,  q1,  q3
-3:      vst1.64         {d16-d19},[r3,:128]!
-        bx              lr
-endfunc
-
-function ff_vector_fmul_window_neon, export=1
-VFP     vdup.32         q8,  d0[0]
-NOVFP   vld1.32         {d16[],d17[]}, [sp,:32]
-        push            {r4,r5,lr}
-VFP     ldr             lr,  [sp, #12]
-NOVFP   ldr             lr,  [sp, #16]
-        sub             r2,  r2,  #8
-        sub             r5,  lr,  #2
-        add             r2,  r2,  r5, lsl #2
-        add             r4,  r3,  r5, lsl #3
-        add             ip,  r0,  r5, lsl #3
-        mov             r5,  #-16
-        vld1.64         {d0,d1},  [r1,:128]!
-        vld1.64         {d2,d3},  [r2,:128], r5
-        vld1.64         {d4,d5},  [r3,:128]!
-        vld1.64         {d6,d7},  [r4,:128], r5
-1:      subs            lr,  lr,  #4
-        vmov            q11, q8
-        vmla.f32        d22, d0,  d4
-        vmov            q10, q8
-        vmla.f32        d23, d1,  d5
-        vrev64.32       q3,  q3
-        vmla.f32        d20, d0,  d7
-        vrev64.32       q1,  q1
-        vmla.f32        d21, d1,  d6
-        beq             2f
-        vmla.f32        d22, d3,  d7
-        vld1.64         {d0,d1},  [r1,:128]!
-        vmla.f32        d23, d2,  d6
-        vld1.64         {d18,d19},[r2,:128], r5
-        vmls.f32        d20, d3,  d4
-        vld1.64         {d24,d25},[r3,:128]!
-        vmls.f32        d21, d2,  d5
-        vld1.64         {d6,d7},  [r4,:128], r5
-        vmov            q1,  q9
-        vrev64.32       q11, q11
-        vmov            q2,  q12
-        vswp            d22, d23
-        vst1.64         {d20,d21},[r0,:128]!
-        vst1.64         {d22,d23},[ip,:128], r5
-        b               1b
-2:      vmla.f32        d22, d3,  d7
-        vmla.f32        d23, d2,  d6
-        vmls.f32        d20, d3,  d4
-        vmls.f32        d21, d2,  d5
-        vrev64.32       q11, q11
-        vswp            d22, d23
-        vst1.64         {d20,d21},[r0,:128]!
-        vst1.64         {d22,d23},[ip,:128], r5
-        pop             {r4,r5,pc}
-endfunc
-
-#if CONFIG_VORBIS_DECODER
-function ff_vorbis_inverse_coupling_neon, export=1
-        vmov.i32        q10, #1<<31
-        subs            r2,  r2,  #4
-        mov             r3,  r0
-        mov             r12, r1
-        beq             3f
-
-        vld1.32         {d24-d25},[r1,:128]!
-        vld1.32         {d22-d23},[r0,:128]!
-        vcle.s32        q8,  q12, #0
-        vand            q9,  q11, q10
-        veor            q12, q12, q9
-        vand            q2,  q12, q8
-        vbic            q3,  q12, q8
-        vadd.f32        q12, q11, q2
-        vsub.f32        q11, q11, q3
-1:      vld1.32         {d2-d3},  [r1,:128]!
-        vld1.32         {d0-d1},  [r0,:128]!
-        vcle.s32        q8,  q1,  #0
-        vand            q9,  q0,  q10
-        veor            q1,  q1,  q9
-        vst1.32         {d24-d25},[r3, :128]!
-        vst1.32         {d22-d23},[r12,:128]!
-        vand            q2,  q1,  q8
-        vbic            q3,  q1,  q8
-        vadd.f32        q1,  q0,  q2
-        vsub.f32        q0,  q0,  q3
-        subs            r2,  r2,  #8
-        ble             2f
-        vld1.32         {d24-d25},[r1,:128]!
-        vld1.32         {d22-d23},[r0,:128]!
-        vcle.s32        q8,  q12, #0
-        vand            q9,  q11, q10
-        veor            q12, q12, q9
-        vst1.32         {d2-d3},  [r3, :128]!
-        vst1.32         {d0-d1},  [r12,:128]!
-        vand            q2,  q12, q8
-        vbic            q3,  q12, q8
-        vadd.f32        q12, q11, q2
-        vsub.f32        q11, q11, q3
-        b               1b
-
-2:      vst1.32         {d2-d3},  [r3, :128]!
-        vst1.32         {d0-d1},  [r12,:128]!
-        bxlt            lr
-
-3:      vld1.32         {d2-d3},  [r1,:128]
-        vld1.32         {d0-d1},  [r0,:128]
-        vcle.s32        q8,  q1,  #0
-        vand            q9,  q0,  q10
-        veor            q1,  q1,  q9
-        vand            q2,  q1,  q8
-        vbic            q3,  q1,  q8
-        vadd.f32        q1,  q0,  q2
-        vsub.f32        q0,  q0,  q3
-        vst1.32         {d2-d3},  [r0,:128]!
-        vst1.32         {d0-d1},  [r1,:128]!
-        bx              lr
-endfunc
-#endif
-
-function ff_vector_fmul_scalar_neon, export=1
-VFP     len .req r2
-NOVFP   len .req r3
-VFP     vdup.32         q8,  d0[0]
-NOVFP   vdup.32         q8,  r2
-        bics            r12, len, #15
-        beq             3f
-        vld1.32         {q0},[r1,:128]!
-        vld1.32         {q1},[r1,:128]!
-1:      vmul.f32        q0,  q0,  q8
-        vld1.32         {q2},[r1,:128]!
-        vmul.f32        q1,  q1,  q8
-        vld1.32         {q3},[r1,:128]!
-        vmul.f32        q2,  q2,  q8
-        vst1.32         {q0},[r0,:128]!
-        vmul.f32        q3,  q3,  q8
-        vst1.32         {q1},[r0,:128]!
-        subs            r12, r12, #16
-        beq             2f
-        vld1.32         {q0},[r1,:128]!
-        vst1.32         {q2},[r0,:128]!
-        vld1.32         {q1},[r1,:128]!
-        vst1.32         {q3},[r0,:128]!
-        b               1b
-2:      vst1.32         {q2},[r0,:128]!
-        vst1.32         {q3},[r0,:128]!
-        ands            len, len, #15
-        bxeq            lr
-3:      vld1.32         {q0},[r1,:128]!
-        vmul.f32        q0,  q0,  q8
-        vst1.32         {q0},[r0,:128]!
-        subs            len, len, #4
-        bgt             3b
-        bx              lr
-        .unreq          len
-endfunc
-
-function ff_vector_fmul_sv_scalar_2_neon, export=1
-VFP     vdup.32         d16, d0[0]
-NOVFP   vdup.32         d16, r3
-NOVFP   ldr             r3,  [sp]
-        vld1.32         {d0},[r1,:64]!
-        vld1.32         {d1},[r1,:64]!
-1:      subs            r3,  r3,  #4
-        vmul.f32        d4,  d0,  d16
-        vmul.f32        d5,  d1,  d16
-        ldr             r12, [r2], #4
-        vld1.32         {d2},[r12,:64]
-        ldr             r12, [r2], #4
-        vld1.32         {d3},[r12,:64]
-        vmul.f32        d4,  d4,  d2
-        vmul.f32        d5,  d5,  d3
-        beq             2f
-        vld1.32         {d0},[r1,:64]!
-        vld1.32         {d1},[r1,:64]!
-        vst1.32         {d4},[r0,:64]!
-        vst1.32         {d5},[r0,:64]!
-        b               1b
-2:      vst1.32         {d4},[r0,:64]!
-        vst1.32         {d5},[r0,:64]!
-        bx              lr
-endfunc
-
-function ff_vector_fmul_sv_scalar_4_neon, export=1
-VFP     vdup.32         q10, d0[0]
-NOVFP   vdup.32         q10, r3
-NOVFP   ldr             r3,  [sp]
-        push            {lr}
-        bics            lr,  r3,  #7
-        beq             3f
-        vld1.32         {q0},[r1,:128]!
-        vld1.32         {q2},[r1,:128]!
-1:      ldr             r12, [r2], #4
-        vld1.32         {q1},[r12,:128]
-        ldr             r12, [r2], #4
-        vld1.32         {q3},[r12,:128]
-        vmul.f32        q8,  q0,  q10
-        vmul.f32        q8,  q8,  q1
-        vmul.f32        q9,  q2,  q10
-        vmul.f32        q9,  q9,  q3
-        subs            lr,  lr,  #8
-        beq             2f
-        vld1.32         {q0},[r1,:128]!
-        vld1.32         {q2},[r1,:128]!
-        vst1.32         {q8},[r0,:128]!
-        vst1.32         {q9},[r0,:128]!
-        b               1b
-2:      vst1.32         {q8},[r0,:128]!
-        vst1.32         {q9},[r0,:128]!
-        ands            r3,  r3,  #7
-        popeq           {pc}
-3:      vld1.32         {q0},[r1,:128]!
-        ldr             r12, [r2], #4
-        vld1.32         {q1},[r12,:128]
-        vmul.f32        q0,  q0,  q10
-        vmul.f32        q0,  q0,  q1
-        vst1.32         {q0},[r0,:128]!
-        subs            r3,  r3,  #4
-        bgt             3b
-        pop             {pc}
-endfunc
-
-function ff_sv_fmul_scalar_2_neon, export=1
-VFP     len .req r2
-NOVFP   len .req r3
-VFP     vdup.32         q8,  d0[0]
-NOVFP   vdup.32         q8,  r2
-        ldr             r12, [r1], #4
-        vld1.32         {d0},[r12,:64]
-        ldr             r12, [r1], #4
-        vld1.32         {d1},[r12,:64]
-1:      vmul.f32        q1,  q0,  q8
-        subs            len, len, #4
-        beq             2f
-        ldr             r12, [r1], #4
-        vld1.32         {d0},[r12,:64]
-        ldr             r12, [r1], #4
-        vld1.32         {d1},[r12,:64]
-        vst1.32         {q1},[r0,:128]!
-        b               1b
-2:      vst1.32         {q1},[r0,:128]!
-        bx              lr
-        .unreq          len
-endfunc
-
-function ff_sv_fmul_scalar_4_neon, export=1
-VFP     len .req r2
-NOVFP   len .req r3
-VFP     vdup.32         q8,  d0[0]
-NOVFP   vdup.32         q8,  r2
-1:      ldr             r12, [r1], #4
-        vld1.32         {q0},[r12,:128]
-        vmul.f32        q0,  q0,  q8
-        vst1.32         {q0},[r0,:128]!
-        subs            len, len, #4
-        bgt             1b
-        bx              lr
-        .unreq          len
-endfunc
-
-function ff_butterflies_float_neon, export=1
-1:      vld1.32         {q0},[r0,:128]
-        vld1.32         {q1},[r1,:128]
-        vsub.f32        q2,  q0,  q1
-        vadd.f32        q1,  q0,  q1
-        vst1.32         {q2},[r1,:128]!
-        vst1.32         {q1},[r0,:128]!
-        subs            r2,  r2,  #4
-        bgt             1b
-        bx              lr
-endfunc
-
-function ff_scalarproduct_float_neon, export=1
-        vmov.f32        q2,  #0.0
-1:      vld1.32         {q0},[r0,:128]!
-        vld1.32         {q1},[r1,:128]!
-        vmla.f32        q2,  q0,  q1
-        subs            r2,  r2,  #4
-        bgt             1b
-        vadd.f32        d0,  d4,  d5
-        vpadd.f32       d0,  d0,  d0
-NOVFP   vmov.32         r0,  d0[0]
-        bx              lr
-endfunc
-
-function ff_int32_to_float_fmul_scalar_neon, export=1
-VFP     vdup.32         q0,  d0[0]
-VFP     len     .req    r2
-NOVFP   vdup.32         q0,  r2
-NOVFP   len     .req    r3
-
-        vld1.32         {q1},[r1,:128]!
-        vcvt.f32.s32    q3,  q1
-        vld1.32         {q2},[r1,:128]!
-        vcvt.f32.s32    q8,  q2
-1:      subs            len, len, #8
-        pld             [r1, #16]
-        vmul.f32        q9,  q3,  q0
-        vmul.f32        q10, q8,  q0
-        beq             2f
-        vld1.32         {q1},[r1,:128]!
-        vcvt.f32.s32    q3,  q1
-        vld1.32         {q2},[r1,:128]!
-        vcvt.f32.s32    q8,  q2
-        vst1.32         {q9}, [r0,:128]!
-        vst1.32         {q10},[r0,:128]!
-        b               1b
-2:      vst1.32         {q9}, [r0,:128]!
-        vst1.32         {q10},[r0,:128]!
-        bx              lr
-        .unreq  len
-endfunc
-
-function ff_vector_fmul_reverse_neon, export=1
-        add             r2,  r2,  r3,  lsl #2
-        sub             r2,  r2,  #32
-        mov             r12, #-32
-        vld1.32         {q0-q1},  [r1,:128]!
-        vld1.32         {q2-q3},  [r2,:128], r12
-1:      pld             [r1, #32]
-        vrev64.32       q3,  q3
-        vmul.f32        d16, d0,  d7
-        vmul.f32        d17, d1,  d6
-        pld             [r2, #-32]
-        vrev64.32       q2,  q2
-        vmul.f32        d18, d2,  d5
-        vmul.f32        d19, d3,  d4
-        subs            r3,  r3,  #8
-        beq             2f
-        vld1.32         {q0-q1},  [r1,:128]!
-        vld1.32         {q2-q3},  [r2,:128], r12
-        vst1.32         {q8-q9},  [r0,:128]!
-        b               1b
-2:      vst1.32         {q8-q9},  [r0,:128]!
-        bx              lr
-endfunc
-
-function ff_vector_fmul_add_neon, export=1
-        ldr             r12, [sp]
-        vld1.32         {q0-q1},  [r1,:128]!
-        vld1.32         {q8-q9},  [r2,:128]!
-        vld1.32         {q2-q3},  [r3,:128]!
-        vmul.f32        q10, q0,  q8
-        vmul.f32        q11, q1,  q9
-1:      vadd.f32        q12, q2,  q10
-        vadd.f32        q13, q3,  q11
-        pld             [r1, #16]
-        pld             [r2, #16]
-        pld             [r3, #16]
-        subs            r12, r12, #8
-        beq             2f
-        vld1.32         {q0},     [r1,:128]!
-        vld1.32         {q8},     [r2,:128]!
-        vmul.f32        q10, q0,  q8
-        vld1.32         {q1},     [r1,:128]!
-        vld1.32         {q9},     [r2,:128]!
-        vmul.f32        q11, q1,  q9
-        vld1.32         {q2-q3},  [r3,:128]!
-        vst1.32         {q12-q13},[r0,:128]!
-        b               1b
-2:      vst1.32         {q12-q13},[r0,:128]!
-        bx              lr
-endfunc
-
-function ff_vector_clipf_neon, export=1
-VFP     vdup.32         q1,  d0[1]
-VFP     vdup.32         q0,  d0[0]
-NOVFP   vdup.32         q0,  r2
-NOVFP   vdup.32         q1,  r3
-NOVFP   ldr             r2,  [sp]
-        vld1.f32        {q2},[r1,:128]!
-        vmin.f32        q10, q2,  q1
-        vld1.f32        {q3},[r1,:128]!
-        vmin.f32        q11, q3,  q1
-1:      vmax.f32        q8,  q10, q0
-        vmax.f32        q9,  q11, q0
-        subs            r2,  r2,  #8
-        beq             2f
-        vld1.f32        {q2},[r1,:128]!
-        vmin.f32        q10, q2,  q1
-        vld1.f32        {q3},[r1,:128]!
-        vmin.f32        q11, q3,  q1
-        vst1.f32        {q8},[r0,:128]!
-        vst1.f32        {q9},[r0,:128]!
-        b               1b
-2:      vst1.f32        {q8},[r0,:128]!
-        vst1.f32        {q9},[r0,:128]!
-        bx              lr
-endfunc
diff --git a/libavcodec/arm/dsputil_vfp.S b/libavcodec/arm/dsputil_vfp.S
deleted file mode 100644
index b704ba9..0000000
--- a/libavcodec/arm/dsputil_vfp.S
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2008 Siarhei Siamashka <ssvb at users.sourceforge.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "asm.S"
-
-        .syntax unified
-/*
- * VFP is a floating point coprocessor used in some ARM cores. VFP11 has 1 cycle
- * throughput for almost all the instructions (except for double precision
- * arithmetics), but rather high latency. Latency is 4 cycles for loads and 8 cycles
- * for arithmetic operations. Scheduling code to avoid pipeline stalls is very
- * important for performance. One more interesting feature is that VFP has
- * independent load/store and arithmetics pipelines, so it is possible to make
- * them work simultaneously and get more than 1 operation per cycle. Load/store
- * pipeline can process 2 single precision floating point values per cycle and
- * supports bulk loads and stores for large sets of registers. Arithmetic operations
- * can be done on vectors, which allows to keep the arithmetics pipeline busy,
- * while the processor may issue and execute other instructions. Detailed
- * optimization manuals can be found at http://www.arm.com
- */
-
-/**
- * ARM VFP optimized implementation of 'vector_fmul_c' function.
- * Assume that len is a positive number and is multiple of 8
- */
-@ void ff_vector_fmul_vfp(float *dst, const float *src, int len)
-function ff_vector_fmul_vfp, export=1
-        vpush           {d8-d15}
-        mov             r3,  r0
-        fmrx            r12, fpscr
-        orr             r12, r12, #(3 << 16) /* set vector size to 4 */
-        fmxr            fpscr, r12
-
-        vldmia          r3!, {s0-s3}
-        vldmia          r1!, {s8-s11}
-        vldmia          r3!, {s4-s7}
-        vldmia          r1!, {s12-s15}
-        vmul.f32        s8,  s0,  s8
-1:
-        subs            r2,  r2,  #16
-        vmul.f32        s12, s4,  s12
-        vldmiage        r3!, {s16-s19}
-        vldmiage        r1!, {s24-s27}
-        vldmiage        r3!, {s20-s23}
-        vldmiage        r1!, {s28-s31}
-        vmulge.f32      s24, s16, s24
-        vstmia          r0!, {s8-s11}
-        vstmia          r0!, {s12-s15}
-        vmulge.f32      s28, s20, s28
-        vldmiagt        r3!, {s0-s3}
-        vldmiagt        r1!, {s8-s11}
-        vldmiagt        r3!, {s4-s7}
-        vldmiagt        r1!, {s12-s15}
-        vmulge.f32      s8,  s0,  s8
-        vstmiage        r0!, {s24-s27}
-        vstmiage        r0!, {s28-s31}
-        bgt             1b
-
-        bic             r12, r12, #(7 << 16) /* set vector size back to 1 */
-        fmxr            fpscr, r12
-        vpop            {d8-d15}
-        bx              lr
-endfunc
-
-/**
- * ARM VFP optimized implementation of 'vector_fmul_reverse_c' function.
- * Assume that len is a positive number and is multiple of 8
- */
-@ void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
-@                                 const float *src1, int len)
-function ff_vector_fmul_reverse_vfp, export=1
-        vpush           {d8-d15}
-        add             r2,  r2,  r3, lsl #2
-        vldmdb          r2!, {s0-s3}
-        vldmia          r1!, {s8-s11}
-        vldmdb          r2!, {s4-s7}
-        vldmia          r1!, {s12-s15}
-        vmul.f32        s8,  s3,  s8
-        vmul.f32        s9,  s2,  s9
-        vmul.f32        s10, s1,  s10
-        vmul.f32        s11, s0,  s11
-1:
-        subs            r3,  r3,  #16
-        vldmdbge        r2!, {s16-s19}
-        vmul.f32        s12, s7,  s12
-        vldmiage        r1!, {s24-s27}
-        vmul.f32        s13, s6,  s13
-        vldmdbge        r2!, {s20-s23}
-        vmul.f32        s14, s5,  s14
-        vldmiage        r1!, {s28-s31}
-        vmul.f32        s15, s4,  s15
-        vmulge.f32      s24, s19, s24
-        vldmdbgt        r2!, {s0-s3}
-        vmulge.f32      s25, s18, s25
-        vstmia          r0!, {s8-s13}
-        vmulge.f32      s26, s17, s26
-        vldmiagt        r1!, {s8-s11}
-        vmulge.f32      s27, s16, s27
-        vmulge.f32      s28, s23, s28
-        vldmdbgt        r2!, {s4-s7}
-        vmulge.f32      s29, s22, s29
-        vstmia          r0!, {s14-s15}
-        vmulge.f32      s30, s21, s30
-        vmulge.f32      s31, s20, s31
-        vmulge.f32      s8,  s3,  s8
-        vldmiagt        r1!, {s12-s15}
-        vmulge.f32      s9,  s2,  s9
-        vmulge.f32      s10, s1,  s10
-        vstmiage        r0!, {s24-s27}
-        vmulge.f32      s11, s0,  s11
-        vstmiage        r0!, {s28-s31}
-        bgt             1b
-
-        vpop            {d8-d15}
-        bx              lr
-endfunc
-
-#if HAVE_ARMV6
-/**
- * ARM VFP optimized float to int16 conversion.
- * Assume that len is a positive number and is multiple of 8, destination
- * buffer is at least 4 bytes aligned (8 bytes alignment is better for
- * performance), little endian byte sex
- */
-@ void ff_float_to_int16_vfp(int16_t *dst, const float *src, int len)
-function ff_float_to_int16_vfp, export=1
-        push            {r4-r8,lr}
-        vpush           {d8-d11}
-        vldmia          r1!, {s16-s23}
-        vcvt.s32.f32    s0,  s16
-        vcvt.s32.f32    s1,  s17
-        vcvt.s32.f32    s2,  s18
-        vcvt.s32.f32    s3,  s19
-        vcvt.s32.f32    s4,  s20
-        vcvt.s32.f32    s5,  s21
-        vcvt.s32.f32    s6,  s22
-        vcvt.s32.f32    s7,  s23
-1:
-        subs            r2,  r2,  #8
-        vmov            r3,  r4,  s0, s1
-        vmov            r5,  r6,  s2, s3
-        vmov            r7,  r8,  s4, s5
-        vmov            ip,  lr,  s6, s7
-        vldmiagt        r1!, {s16-s23}
-        ssat            r4,  #16, r4
-        ssat            r3,  #16, r3
-        ssat            r6,  #16, r6
-        ssat            r5,  #16, r5
-        pkhbt           r3,  r3,  r4, lsl #16
-        pkhbt           r4,  r5,  r6, lsl #16
-        vcvtgt.s32.f32  s0,  s16
-        vcvtgt.s32.f32  s1,  s17
-        vcvtgt.s32.f32  s2,  s18
-        vcvtgt.s32.f32  s3,  s19
-        vcvtgt.s32.f32  s4,  s20
-        vcvtgt.s32.f32  s5,  s21
-        vcvtgt.s32.f32  s6,  s22
-        vcvtgt.s32.f32  s7,  s23
-        ssat            r8,  #16, r8
-        ssat            r7,  #16, r7
-        ssat            lr,  #16, lr
-        ssat            ip,  #16, ip
-        pkhbt           r5,  r7,  r8, lsl #16
-        pkhbt           r6,  ip,  lr, lsl #16
-        stmia           r0!, {r3-r6}
-        bgt             1b
-
-        vpop            {d8-d11}
-        pop             {r4-r8,pc}
-endfunc
-#endif
diff --git a/libavcodec/arm/fft_init_arm.c b/libavcodec/arm/fft_init_arm.c
deleted file mode 100644
index bde1240..0000000
--- a/libavcodec/arm/fft_init_arm.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/fft.h"
-#include "libavcodec/synth_filter.h"
-
-void ff_fft_permute_neon(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_neon(FFTContext *s, FFTComplex *z);
-
-void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input);
-
-void ff_rdft_calc_neon(struct RDFTContext *s, FFTSample *z);
-
-void ff_synth_filter_float_neon(FFTContext *imdct,
-                                float *synth_buf_ptr, int *synth_buf_offset,
-                                float synth_buf2[32], const float window[512],
-                                float out[32], const float in[32],
-                                float scale, float bias);
-
-av_cold void ff_fft_init_arm(FFTContext *s)
-{
-    if (HAVE_NEON) {
-        s->fft_permute  = ff_fft_permute_neon;
-        s->fft_calc     = ff_fft_calc_neon;
-        s->imdct_calc   = ff_imdct_calc_neon;
-        s->imdct_half   = ff_imdct_half_neon;
-        s->mdct_calc    = ff_mdct_calc_neon;
-        s->permutation  = FF_MDCT_PERM_INTERLEAVE;
-    }
-}
-
-#if CONFIG_RDFT
-av_cold void ff_rdft_init_arm(RDFTContext *s)
-{
-    if (HAVE_NEON)
-        s->rdft_calc    = ff_rdft_calc_neon;
-}
-#endif
-
-#if CONFIG_DCA_DECODER
-av_cold void ff_synth_filter_init_arm(SynthFilterContext *s)
-{
-    if (HAVE_NEON)
-        s->synth_filter_float = ff_synth_filter_float_neon;
-}
-#endif
diff --git a/libavcodec/arm/fft_neon.S b/libavcodec/arm/fft_neon.S
deleted file mode 100644
index 08589db..0000000
--- a/libavcodec/arm/fft_neon.S
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * ARM NEON optimised FFT
- *
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- * Copyright (c) 2009 Naotoshi Nojiri
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-#define M_SQRT1_2 0.70710678118654752440
-
-        .text
-
-function fft4_neon
-        vld1.32         {d0-d3}, [r0,:128]
-
-        vext.32         q8,  q1,  q1,  #1       @ i2,r3 d3=i3,r2
-        vsub.f32        d6,  d0,  d1            @ r0-r1,i0-i1
-        vsub.f32        d7,  d16, d17           @ r3-r2,i2-i3
-        vadd.f32        d4,  d0,  d1            @ r0+r1,i0+i1
-        vadd.f32        d5,  d2,  d3            @ i2+i3,r2+r3
-        vadd.f32        d1,  d6,  d7
-        vsub.f32        d3,  d6,  d7
-        vadd.f32        d0,  d4,  d5
-        vsub.f32        d2,  d4,  d5
-
-        vst1.32         {d0-d3}, [r0,:128]
-
-        bx              lr
-endfunc
-
-function fft8_neon
-        mov             r1,  r0
-        vld1.32         {d0-d3},   [r1,:128]!
-        vld1.32         {d16-d19}, [r1,:128]
-
-        movw            r2,  #0x04f3            @ sqrt(1/2)
-        movt            r2,  #0x3f35
-        eor             r3,  r2,  #1<<31
-        vdup.32         d31, r2
-
-        vext.32         q11, q1,  q1,  #1       @ i2,r3,i3,r2
-        vadd.f32        d4,  d16, d17           @ r4+r5,i4+i5
-        vmov            d28, r3,  r2
-        vadd.f32        d5,  d18, d19           @ r6+r7,i6+i7
-        vsub.f32        d17, d16, d17           @ r4-r5,i4-i5
-        vsub.f32        d19, d18, d19           @ r6-r7,i6-i7
-        vrev64.32       d29, d28
-        vadd.f32        d20, d0,  d1            @ r0+r1,i0+i1
-        vadd.f32        d21, d2,  d3            @ r2+r3,i2+i3
-        vmul.f32        d26, d17, d28           @ -a2r*w,a2i*w
-        vext.32         q3,  q2,  q2,  #1
-        vmul.f32        d27, d19, d29           @ a3r*w,-a3i*w
-        vsub.f32        d23, d22, d23           @ i2-i3,r3-r2
-        vsub.f32        d22, d0,  d1            @ r0-r1,i0-i1
-        vmul.f32        d24, d17, d31           @ a2r*w,a2i*w
-        vmul.f32        d25, d19, d31           @ a3r*w,a3i*w
-        vadd.f32        d0,  d20, d21
-        vsub.f32        d2,  d20, d21
-        vadd.f32        d1,  d22, d23
-        vrev64.32       q13, q13
-        vsub.f32        d3,  d22, d23
-        vsub.f32        d6,  d6,  d7
-        vadd.f32        d24, d24, d26           @ a2r+a2i,a2i-a2r   t1,t2
-        vadd.f32        d25, d25, d27           @ a3r-a3i,a3i+a3r   t5,t6
-        vadd.f32        d7,  d4,  d5
-        vsub.f32        d18, d2,  d6
-        vext.32         q13, q12, q12, #1
-        vadd.f32        d2,  d2,  d6
-        vsub.f32        d16, d0,  d7
-        vadd.f32        d5,  d25, d24
-        vsub.f32        d4,  d26, d27
-        vadd.f32        d0,  d0,  d7
-        vsub.f32        d17, d1,  d5
-        vsub.f32        d19, d3,  d4
-        vadd.f32        d3,  d3,  d4
-        vadd.f32        d1,  d1,  d5
-
-        vst1.32         {d16-d19}, [r1,:128]
-        vst1.32         {d0-d3},   [r0,:128]
-
-        bx              lr
-endfunc
-
-function fft16_neon
-        movrel          r1, mppm
-        vld1.32         {d16-d19}, [r0,:128]!   @ q8{r0,i0,r1,i1} q9{r2,i2,r3,i3}
-        pld             [r0, #32]
-        vld1.32         {d2-d3}, [r1,:128]
-        vext.32         q13, q9,  q9,  #1
-        vld1.32         {d22-d25}, [r0,:128]!   @ q11{r4,i4,r5,i5} q12{r6,i5,r7,i7}
-        vadd.f32        d4,  d16, d17
-        vsub.f32        d5,  d16, d17
-        vadd.f32        d18, d18, d19
-        vsub.f32        d19, d26, d27
-
-        vadd.f32        d20, d22, d23
-        vsub.f32        d22, d22, d23
-        vsub.f32        d23, d24, d25
-        vadd.f32        q8,  q2,  q9            @ {r0,i0,r1,i1}
-        vadd.f32        d21, d24, d25
-        vmul.f32        d24, d22, d2
-        vsub.f32        q9,  q2,  q9            @ {r2,i2,r3,i3}
-        vmul.f32        d25, d23, d3
-        vuzp.32         d16, d17                @ {r0,r1,i0,i1}
-        vmul.f32        q1,  q11, d2[1]
-        vuzp.32         d18, d19                @ {r2,r3,i2,i3}
-        vrev64.32       q12, q12
-        vadd.f32        q11, q12, q1            @ {t1a,t2a,t5,t6}
-        vld1.32         {d24-d27}, [r0,:128]!   @ q12{r8,i8,r9,i9} q13{r10,i10,r11,i11}
-        vzip.32         q10, q11
-        vld1.32         {d28-d31}, [r0,:128]    @ q14{r12,i12,r13,i13} q15{r14,i14,r15,i15}
-        vadd.f32        d0,  d22, d20
-        vadd.f32        d1,  d21, d23
-        vsub.f32        d2,  d21, d23
-        vsub.f32        d3,  d22, d20
-        sub             r0,  r0,  #96
-        vext.32         q13, q13, q13, #1
-        vsub.f32        q10, q8,  q0            @ {r4,r5,i4,i5}
-        vadd.f32        q8,  q8,  q0            @ {r0,r1,i0,i1}
-        vext.32         q15, q15, q15, #1
-        vsub.f32        q11, q9,  q1            @ {r6,r7,i6,i7}
-        vswp            d25, d26                @ q12{r8,i8,i10,r11} q13{r9,i9,i11,r10}
-        vadd.f32        q9,  q9,  q1            @ {r2,r3,i2,i3}
-        vswp            d29, d30                @ q14{r12,i12,i14,r15} q15{r13,i13,i15,r14}
-        vadd.f32        q0,  q12, q13           @ {t1,t2,t5,t6}
-        vadd.f32        q1,  q14, q15           @ {t1a,t2a,t5a,t6a}
-        movrel          r2,  X(ff_cos_16)
-        vsub.f32        q13, q12, q13           @ {t3,t4,t7,t8}
-        vrev64.32       d1,  d1
-        vsub.f32        q15, q14, q15           @ {t3a,t4a,t7a,t8a}
-        vrev64.32       d3,  d3
-        movrel          r3,  pmmp
-        vswp            d1,  d26                @ q0{t1,t2,t3,t4} q13{t6,t5,t7,t8}
-        vswp            d3,  d30                @ q1{t1a,t2a,t3a,t4a} q15{t6a,t5a,t7a,t8a}
-        vadd.f32        q12, q0,  q13           @ {r8,i8,r9,i9}
-        vadd.f32        q14, q1,  q15           @ {r12,i12,r13,i13}
-        vld1.32         {d4-d5},  [r2,:64]
-        vsub.f32        q13, q0,  q13           @ {r10,i10,r11,i11}
-        vsub.f32        q15, q1,  q15           @ {r14,i14,r15,i15}
-        vswp            d25, d28                @ q12{r8,i8,r12,i12} q14{r9,i9,r13,i13}
-        vld1.32         {d6-d7},  [r3,:128]
-        vrev64.32       q1,  q14
-        vmul.f32        q14, q14, d4[1]
-        vmul.f32        q1,  q1,  q3
-        vmla.f32        q14, q1,  d5[1]         @ {t1a,t2a,t5a,t6a}
-        vswp            d27, d30                @ q13{r10,i10,r14,i14} q15{r11,i11,r15,i15}
-        vzip.32         q12, q14
-        vadd.f32        d0,  d28, d24
-        vadd.f32        d1,  d25, d29
-        vsub.f32        d2,  d25, d29
-        vsub.f32        d3,  d28, d24
-        vsub.f32        q12, q8,  q0            @ {r8,r9,i8,i9}
-        vadd.f32        q8,  q8,  q0            @ {r0,r1,i0,i1}
-        vsub.f32        q14, q10, q1            @ {r12,r13,i12,i13}
-        mov             r1,  #32
-        vadd.f32        q10, q10, q1            @ {r4,r5,i4,i5}
-        vrev64.32       q0,  q13
-        vmul.f32        q13, q13, d5[0]
-        vrev64.32       q1,  q15
-        vmul.f32        q15, q15, d5[1]
-        vst2.32         {d16-d17},[r0,:128], r1
-        vmul.f32        q0,  q0,  q3
-        vst2.32         {d20-d21},[r0,:128], r1
-        vmul.f32        q1,  q1,  q3
-        vmla.f32        q13, q0,  d5[0]         @ {t1,t2,t5,t6}
-        vmla.f32        q15, q1,  d4[1]         @ {t1a,t2a,t5a,t6a}
-        vst2.32         {d24-d25},[r0,:128], r1
-        vst2.32         {d28-d29},[r0,:128]
-        vzip.32         q13, q15
-        sub             r0, r0, #80
-        vadd.f32        d0,  d30, d26
-        vadd.f32        d1,  d27, d31
-        vsub.f32        d2,  d27, d31
-        vsub.f32        d3,  d30, d26
-        vsub.f32        q13, q9,  q0            @ {r10,r11,i10,i11}
-        vadd.f32        q9,  q9,  q0            @ {r2,r3,i2,i3}
-        vsub.f32        q15, q11, q1            @ {r14,r15,i14,i15}
-        vadd.f32        q11, q11, q1            @ {r6,r7,i6,i7}
-        vst2.32         {d18-d19},[r0,:128], r1
-        vst2.32         {d22-d23},[r0,:128], r1
-        vst2.32         {d26-d27},[r0,:128], r1
-        vst2.32         {d30-d31},[r0,:128]
-        bx              lr
-endfunc
-
-function fft_pass_neon
-        push            {r4-r6,lr}
-        mov             r6,  r2                 @ n
-        lsl             r5,  r2,  #3            @ 2 * n * sizeof FFTSample
-        lsl             r4,  r2,  #4            @ 2 * n * sizeof FFTComplex
-        lsl             r2,  r2,  #5            @ 4 * n * sizeof FFTComplex
-        add             r3,  r2,  r4
-        add             r4,  r4,  r0            @ &z[o1]
-        add             r2,  r2,  r0            @ &z[o2]
-        add             r3,  r3,  r0            @ &z[o3]
-        vld1.32         {d20-d21},[r2,:128]     @ {z[o2],z[o2+1]}
-        movrel          r12, pmmp
-        vld1.32         {d22-d23},[r3,:128]     @ {z[o3],z[o3+1]}
-        add             r5,  r5,  r1            @ wim
-        vld1.32         {d6-d7},  [r12,:128]    @ pmmp
-        vswp            d21, d22
-        vld1.32         {d4},     [r1,:64]!     @ {wre[0],wre[1]}
-        sub             r5,  r5,  #4            @ wim--
-        vrev64.32       q1,  q11
-        vmul.f32        q11, q11, d4[1]
-        vmul.f32        q1,  q1,  q3
-        vld1.32         {d5[0]},  [r5,:32]      @ d5[0] = wim[-1]
-        vmla.f32        q11, q1,  d5[0]         @ {t1a,t2a,t5a,t6a}
-        vld2.32         {d16-d17},[r0,:128]     @ {z[0],z[1]}
-        sub             r6, r6, #1              @ n--
-        vld2.32         {d18-d19},[r4,:128]     @ {z[o1],z[o1+1]}
-        vzip.32         q10, q11
-        vadd.f32        d0,  d22, d20
-        vadd.f32        d1,  d21, d23
-        vsub.f32        d2,  d21, d23
-        vsub.f32        d3,  d22, d20
-        vsub.f32        q10, q8,  q0
-        vadd.f32        q8,  q8,  q0
-        vsub.f32        q11, q9,  q1
-        vadd.f32        q9,  q9,  q1
-        vst2.32         {d20-d21},[r2,:128]!    @ {z[o2],z[o2+1]}
-        vst2.32         {d16-d17},[r0,:128]!    @ {z[0],z[1]}
-        vst2.32         {d22-d23},[r3,:128]!    @ {z[o3],z[o3+1]}
-        vst2.32         {d18-d19},[r4,:128]!    @ {z[o1],z[o1+1]}
-        sub             r5,  r5,  #8            @ wim -= 2
-1:
-        vld1.32         {d20-d21},[r2,:128]     @ {z[o2],z[o2+1]}
-        vld1.32         {d22-d23},[r3,:128]     @ {z[o3],z[o3+1]}
-        vswp            d21, d22
-        vld1.32         {d4}, [r1]!             @ {wre[0],wre[1]}
-        vrev64.32       q0,  q10
-        vmul.f32        q10, q10, d4[0]
-        vrev64.32       q1,  q11
-        vmul.f32        q11, q11, d4[1]
-        vld1.32         {d5}, [r5]              @ {wim[-1],wim[0]}
-        vmul.f32        q0,  q0,  q3
-        sub             r5,  r5,  #8            @ wim -= 2
-        vmul.f32        q1,  q1,  q3
-        vmla.f32        q10, q0,  d5[1]         @ {t1,t2,t5,t6}
-        vmla.f32        q11, q1,  d5[0]         @ {t1a,t2a,t5a,t6a}
-        vld2.32         {d16-d17},[r0,:128]     @ {z[0],z[1]}
-        subs            r6,  r6,  #1            @ n--
-        vld2.32         {d18-d19},[r4,:128]     @ {z[o1],z[o1+1]}
-        vzip.32         q10, q11
-        vadd.f32        d0,  d22, d20
-        vadd.f32        d1,  d21, d23
-        vsub.f32        d2,  d21, d23
-        vsub.f32        d3,  d22, d20
-        vsub.f32        q10, q8,  q0
-        vadd.f32        q8,  q8,  q0
-        vsub.f32        q11, q9,  q1
-        vadd.f32        q9,  q9,  q1
-        vst2.32         {d20-d21}, [r2,:128]!   @ {z[o2],z[o2+1]}
-        vst2.32         {d16-d17}, [r0,:128]!   @ {z[0],z[1]}
-        vst2.32         {d22-d23}, [r3,:128]!   @ {z[o3],z[o3+1]}
-        vst2.32         {d18-d19}, [r4,:128]!   @ {z[o1],z[o1+1]}
-        bne             1b
-
-        pop             {r4-r6,pc}
-endfunc
-
-.macro  def_fft n, n2, n4
-        .align 6
-function fft\n\()_neon
-        push            {r4, lr}
-        mov             r4,  r0
-        bl              fft\n2\()_neon
-        add             r0,  r4,  #\n4*2*8
-        bl              fft\n4\()_neon
-        add             r0,  r4,  #\n4*3*8
-        bl              fft\n4\()_neon
-        mov             r0,  r4
-        pop             {r4, lr}
-        movrel          r1,  X(ff_cos_\n)
-        mov             r2,  #\n4/2
-        b               fft_pass_neon
-endfunc
-.endm
-
-        def_fft    32,    16,     8
-        def_fft    64,    32,    16
-        def_fft   128,    64,    32
-        def_fft   256,   128,    64
-        def_fft   512,   256,   128
-        def_fft  1024,   512,   256
-        def_fft  2048,  1024,   512
-        def_fft  4096,  2048,  1024
-        def_fft  8192,  4096,  2048
-        def_fft 16384,  8192,  4096
-        def_fft 32768, 16384,  8192
-        def_fft 65536, 32768, 16384
-
-function ff_fft_calc_neon, export=1
-        ldr             r2,  [r0]
-        sub             r2,  r2,  #2
-        movrel          r3,  fft_tab_neon
-        ldr             r3,  [r3, r2, lsl #2]
-        mov             r0,  r1
-        bx              r3
-endfunc
-
-function ff_fft_permute_neon, export=1
-        push            {r4,lr}
-        mov             r12, #1
-        ldr             r2,  [r0]       @ nbits
-        ldr             r3,  [r0, #20]  @ tmp_buf
-        ldr             r0,  [r0, #8]   @ revtab
-        lsl             r12, r12, r2
-        mov             r2,  r12
-1:
-        vld1.32         {d0-d1}, [r1,:128]!
-        ldr             r4,  [r0], #4
-        uxth            lr,  r4
-        uxth            r4,  r4,  ror #16
-        add             lr,  r3,  lr,  lsl #3
-        add             r4,  r3,  r4,  lsl #3
-        vst1.32         {d0}, [lr,:64]
-        vst1.32         {d1}, [r4,:64]
-        subs            r12, r12, #2
-        bgt             1b
-
-        sub             r1,  r1,  r2,  lsl #3
-1:
-        vld1.32         {d0-d3}, [r3,:128]!
-        vst1.32         {d0-d3}, [r1,:128]!
-        subs            r2,  r2,  #4
-        bgt             1b
-
-        pop             {r4,pc}
-endfunc
-
-        .section .rodata
-        .align 4
-fft_tab_neon:
-        .word fft4_neon
-        .word fft8_neon
-        .word fft16_neon
-        .word fft32_neon
-        .word fft64_neon
-        .word fft128_neon
-        .word fft256_neon
-        .word fft512_neon
-        .word fft1024_neon
-        .word fft2048_neon
-        .word fft4096_neon
-        .word fft8192_neon
-        .word fft16384_neon
-        .word fft32768_neon
-        .word fft65536_neon
-        .size fft_tab_neon, . - fft_tab_neon
-
-        .align 4
-pmmp:   .float  +1.0, -1.0, -1.0, +1.0
-mppm:   .float  -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
diff --git a/libavcodec/arm/h264dsp_init_arm.c b/libavcodec/arm/h264dsp_init_arm.c
deleted file mode 100644
index c06c3d0..0000000
--- a/libavcodec/arm/h264dsp_init_arm.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-#include "libavcodec/dsputil.h"
-#include "libavcodec/h264dsp.h"
-
-void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
-                                     int beta, int8_t *tc0);
-void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha,
-                                     int beta, int8_t *tc0);
-void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
-                                       int beta, int8_t *tc0);
-void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, int stride, int alpha,
-                                       int beta, int8_t *tc0);
-
-void ff_weight_h264_pixels_16x16_neon(uint8_t *ds, int stride, int log2_den,
-                                      int weight, int offset);
-void ff_weight_h264_pixels_16x8_neon(uint8_t *ds, int stride, int log2_den,
-                                     int weight, int offset);
-void ff_weight_h264_pixels_8x16_neon(uint8_t *ds, int stride, int log2_den,
-                                     int weight, int offset);
-void ff_weight_h264_pixels_8x8_neon(uint8_t *ds, int stride, int log2_den,
-                                    int weight, int offset);
-void ff_weight_h264_pixels_8x4_neon(uint8_t *ds, int stride, int log2_den,
-                                    int weight, int offset);
-void ff_weight_h264_pixels_4x8_neon(uint8_t *ds, int stride, int log2_den,
-                                    int weight, int offset);
-void ff_weight_h264_pixels_4x4_neon(uint8_t *ds, int stride, int log2_den,
-                                    int weight, int offset);
-void ff_weight_h264_pixels_4x2_neon(uint8_t *ds, int stride, int log2_den,
-                                    int weight, int offset);
-
-void ff_biweight_h264_pixels_16x16_neon(uint8_t *dst, uint8_t *src, int stride,
-                                        int log2_den, int weightd, int weights,
-                                        int offset);
-void ff_biweight_h264_pixels_16x8_neon(uint8_t *dst, uint8_t *src, int stride,
-                                       int log2_den, int weightd, int weights,
-                                       int offset);
-void ff_biweight_h264_pixels_8x16_neon(uint8_t *dst, uint8_t *src, int stride,
-                                       int log2_den, int weightd, int weights,
-                                       int offset);
-void ff_biweight_h264_pixels_8x8_neon(uint8_t *dst, uint8_t *src, int stride,
-                                      int log2_den, int weightd, int weights,
-                                      int offset);
-void ff_biweight_h264_pixels_8x4_neon(uint8_t *dst, uint8_t *src, int stride,
-                                      int log2_den, int weightd, int weights,
-                                      int offset);
-void ff_biweight_h264_pixels_4x8_neon(uint8_t *dst, uint8_t *src, int stride,
-                                      int log2_den, int weightd, int weights,
-                                      int offset);
-void ff_biweight_h264_pixels_4x4_neon(uint8_t *dst, uint8_t *src, int stride,
-                                      int log2_den, int weightd, int weights,
-                                      int offset);
-void ff_biweight_h264_pixels_4x2_neon(uint8_t *dst, uint8_t *src, int stride,
-                                      int log2_den, int weightd, int weights,
-                                      int offset);
-
-void ff_h264_idct_add_neon(uint8_t *dst, DCTELEM *block, int stride);
-void ff_h264_idct_dc_add_neon(uint8_t *dst, DCTELEM *block, int stride);
-void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset,
-                             DCTELEM *block, int stride,
-                             const uint8_t nnzc[6*8]);
-void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset,
-                                  DCTELEM *block, int stride,
-                                  const uint8_t nnzc[6*8]);
-void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset,
-                            DCTELEM *block, int stride,
-                            const uint8_t nnzc[6*8]);
-
-#if HAVE_NEON
-static void ff_h264dsp_init_neon(H264DSPContext *c)
-{
-    c->h264_v_loop_filter_luma   = ff_h264_v_loop_filter_luma_neon;
-    c->h264_h_loop_filter_luma   = ff_h264_h_loop_filter_luma_neon;
-    c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
-    c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
-
-    c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16x16_neon;
-    c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_16x8_neon;
-    c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_8x16_neon;
-    c->weight_h264_pixels_tab[3] = ff_weight_h264_pixels_8x8_neon;
-    c->weight_h264_pixels_tab[4] = ff_weight_h264_pixels_8x4_neon;
-    c->weight_h264_pixels_tab[5] = ff_weight_h264_pixels_4x8_neon;
-    c->weight_h264_pixels_tab[6] = ff_weight_h264_pixels_4x4_neon;
-    c->weight_h264_pixels_tab[7] = ff_weight_h264_pixels_4x2_neon;
-
-    c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16x16_neon;
-    c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_16x8_neon;
-    c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_8x16_neon;
-    c->biweight_h264_pixels_tab[3] = ff_biweight_h264_pixels_8x8_neon;
-    c->biweight_h264_pixels_tab[4] = ff_biweight_h264_pixels_8x4_neon;
-    c->biweight_h264_pixels_tab[5] = ff_biweight_h264_pixels_4x8_neon;
-    c->biweight_h264_pixels_tab[6] = ff_biweight_h264_pixels_4x4_neon;
-    c->biweight_h264_pixels_tab[7] = ff_biweight_h264_pixels_4x2_neon;
-
-    c->h264_idct_add        = ff_h264_idct_add_neon;
-    c->h264_idct_dc_add     = ff_h264_idct_dc_add_neon;
-    c->h264_idct_add16      = ff_h264_idct_add16_neon;
-    c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;
-    c->h264_idct_add8       = ff_h264_idct_add8_neon;
-}
-#endif
-
-void ff_h264dsp_init_arm(H264DSPContext *c)
-{
-    if (HAVE_NEON) ff_h264dsp_init_neon(c);
-}
diff --git a/libavcodec/arm/h264dsp_neon.S b/libavcodec/arm/h264dsp_neon.S
deleted file mode 100644
index d9cdad8..0000000
--- a/libavcodec/arm/h264dsp_neon.S
+++ /dev/null
@@ -1,1883 +0,0 @@
-/*
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        .macro transpose_8x8 r0 r1 r2 r3 r4 r5 r6 r7
-        vtrn.32         \r0, \r4
-        vtrn.32         \r1, \r5
-        vtrn.32         \r2, \r6
-        vtrn.32         \r3, \r7
-        vtrn.16         \r0, \r2
-        vtrn.16         \r1, \r3
-        vtrn.16         \r4, \r6
-        vtrn.16         \r5, \r7
-        vtrn.8          \r0, \r1
-        vtrn.8          \r2, \r3
-        vtrn.8          \r4, \r5
-        vtrn.8          \r6, \r7
-        .endm
-
-        .macro transpose_4x4 r0 r1 r2 r3
-        vtrn.16         \r0, \r2
-        vtrn.16         \r1, \r3
-        vtrn.8          \r0, \r1
-        vtrn.8          \r2, \r3
-        .endm
-
-        .macro swap4 r0 r1 r2 r3 r4 r5 r6 r7
-        vswp            \r0, \r4
-        vswp            \r1, \r5
-        vswp            \r2, \r6
-        vswp            \r3, \r7
-        .endm
-
-        .macro transpose16_4x4 r0 r1 r2 r3 r4 r5 r6 r7
-        vtrn.32         \r0, \r2
-        vtrn.32         \r1, \r3
-        vtrn.32         \r4, \r6
-        vtrn.32         \r5, \r7
-        vtrn.16         \r0, \r1
-        vtrn.16         \r2, \r3
-        vtrn.16         \r4, \r5
-        vtrn.16         \r6, \r7
-        .endm
-
-/* chroma_mc8(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) */
-        .macro  h264_chroma_mc8 type
-function ff_\type\()_h264_chroma_mc8_neon, export=1
-        push            {r4-r7, lr}
-        ldrd            r4,  [sp, #20]
-.ifc \type,avg
-        mov             lr,  r0
-.endif
-        pld             [r1]
-        pld             [r1, r2]
-
-        muls            r7,  r4,  r5
-        rsb             r6,  r7,  r5,  lsl #3
-        rsb             ip,  r7,  r4,  lsl #3
-        sub             r4,  r7,  r4,  lsl #3
-        sub             r4,  r4,  r5,  lsl #3
-        add             r4,  r4,  #64
-
-        beq             2f
-
-        add             r5,  r1,  r2
-
-        vdup.8          d0,  r4
-        lsl             r4,  r2,  #1
-        vdup.8          d1,  ip
-        vld1.64         {d4, d5}, [r1], r4
-        vdup.8          d2,  r6
-        vld1.64         {d6, d7}, [r5], r4
-        vdup.8          d3,  r7
-
-        vext.8          d5,  d4,  d5,  #1
-        vext.8          d7,  d6,  d7,  #1
-
-1:      pld             [r5]
-        vmull.u8        q8,  d4,  d0
-        vmlal.u8        q8,  d5,  d1
-        vld1.64         {d4, d5}, [r1], r4
-        vmlal.u8        q8,  d6,  d2
-        vext.8          d5,  d4,  d5,  #1
-        vmlal.u8        q8,  d7,  d3
-        vmull.u8        q9,  d6,  d0
-        subs            r3,  r3,  #2
-        vmlal.u8        q9,  d7,  d1
-        vmlal.u8        q9,  d4,  d2
-        vmlal.u8        q9,  d5,  d3
-        vrshrn.u16      d16, q8,  #6
-        vld1.64         {d6, d7}, [r5], r4
-        pld             [r1]
-        vrshrn.u16      d17, q9,  #6
-.ifc \type,avg
-        vld1.64         {d20}, [lr,:64], r2
-        vld1.64         {d21}, [lr,:64], r2
-        vrhadd.u8       q8,  q8,  q10
-.endif
-        vext.8          d7,  d6,  d7,  #1
-        vst1.64         {d16}, [r0,:64], r2
-        vst1.64         {d17}, [r0,:64], r2
-        bgt             1b
-
-        pop             {r4-r7, pc}
-
-2:      tst             r6,  r6
-        add             ip,  ip,  r6
-        vdup.8          d0,  r4
-        vdup.8          d1,  ip
-
-        beq             4f
-
-        add             r5,  r1,  r2
-        lsl             r4,  r2,  #1
-        vld1.64         {d4}, [r1], r4
-        vld1.64         {d6}, [r5], r4
-
-3:      pld             [r5]
-        vmull.u8        q8,  d4,  d0
-        vmlal.u8        q8,  d6,  d1
-        vld1.64         {d4}, [r1], r4
-        vmull.u8        q9,  d6,  d0
-        vmlal.u8        q9,  d4,  d1
-        vld1.64         {d6}, [r5], r4
-        vrshrn.u16      d16, q8,  #6
-        vrshrn.u16      d17, q9,  #6
-.ifc \type,avg
-        vld1.64         {d20}, [lr,:64], r2
-        vld1.64         {d21}, [lr,:64], r2
-        vrhadd.u8       q8,  q8,  q10
-.endif
-        subs            r3,  r3,  #2
-        pld             [r1]
-        vst1.64         {d16}, [r0,:64], r2
-        vst1.64         {d17}, [r0,:64], r2
-        bgt             3b
-
-        pop             {r4-r7, pc}
-
-4:      vld1.64         {d4, d5}, [r1], r2
-        vld1.64         {d6, d7}, [r1], r2
-        vext.8          d5,  d4,  d5,  #1
-        vext.8          d7,  d6,  d7,  #1
-
-5:      pld             [r1]
-        subs            r3,  r3,  #2
-        vmull.u8        q8,  d4,  d0
-        vmlal.u8        q8,  d5,  d1
-        vld1.64         {d4, d5}, [r1], r2
-        vmull.u8        q9,  d6,  d0
-        vmlal.u8        q9,  d7,  d1
-        pld             [r1]
-        vext.8          d5,  d4,  d5,  #1
-        vrshrn.u16      d16, q8,  #6
-        vrshrn.u16      d17, q9,  #6
-.ifc \type,avg
-        vld1.64         {d20}, [lr,:64], r2
-        vld1.64         {d21}, [lr,:64], r2
-        vrhadd.u8       q8,  q8,  q10
-.endif
-        vld1.64         {d6, d7}, [r1], r2
-        vext.8          d7,  d6,  d7,  #1
-        vst1.64         {d16}, [r0,:64], r2
-        vst1.64         {d17}, [r0,:64], r2
-        bgt             5b
-
-        pop             {r4-r7, pc}
-endfunc
-        .endm
-
-/* chroma_mc4(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) */
-        .macro  h264_chroma_mc4 type
-function ff_\type\()_h264_chroma_mc4_neon, export=1
-        push            {r4-r7, lr}
-        ldrd            r4,  [sp, #20]
-.ifc \type,avg
-        mov             lr,  r0
-.endif
-        pld             [r1]
-        pld             [r1, r2]
-
-        muls            r7,  r4,  r5
-        rsb             r6,  r7,  r5,  lsl #3
-        rsb             ip,  r7,  r4,  lsl #3
-        sub             r4,  r7,  r4,  lsl #3
-        sub             r4,  r4,  r5,  lsl #3
-        add             r4,  r4,  #64
-
-        beq             2f
-
-        add             r5,  r1,  r2
-
-        vdup.8          d0,  r4
-        lsl             r4,  r2,  #1
-        vdup.8          d1,  ip
-        vld1.64         {d4},     [r1], r4
-        vdup.8          d2,  r6
-        vld1.64         {d6},     [r5], r4
-        vdup.8          d3,  r7
-
-        vext.8          d5,  d4,  d5,  #1
-        vext.8          d7,  d6,  d7,  #1
-        vtrn.32         d4,  d5
-        vtrn.32         d6,  d7
-
-        vtrn.32         d0,  d1
-        vtrn.32         d2,  d3
-
-1:      pld             [r5]
-        vmull.u8        q8,  d4,  d0
-        vmlal.u8        q8,  d6,  d2
-        vld1.64         {d4},     [r1], r4
-        vext.8          d5,  d4,  d5,  #1
-        vtrn.32         d4,  d5
-        vmull.u8        q9,  d6,  d0
-        vmlal.u8        q9,  d4,  d2
-        vld1.64         {d6},     [r5], r4
-        vadd.i16        d16, d16, d17
-        vadd.i16        d17, d18, d19
-        vrshrn.u16      d16, q8,  #6
-        subs            r3,  r3,  #2
-        pld             [r1]
-.ifc \type,avg
-        vld1.32         {d20[0]}, [lr,:32], r2
-        vld1.32         {d20[1]}, [lr,:32], r2
-        vrhadd.u8       d16, d16, d20
-.endif
-        vext.8          d7,  d6,  d7,  #1
-        vtrn.32         d6,  d7
-        vst1.32         {d16[0]}, [r0,:32], r2
-        vst1.32         {d16[1]}, [r0,:32], r2
-        bgt             1b
-
-        pop             {r4-r7, pc}
-
-2:      tst             r6,  r6
-        add             ip,  ip,  r6
-        vdup.8          d0,  r4
-        vdup.8          d1,  ip
-        vtrn.32         d0,  d1
-
-        beq             4f
-
-        vext.32         d1,  d0,  d1,  #1
-        add             r5,  r1,  r2
-        lsl             r4,  r2,  #1
-        vld1.32         {d4[0]},  [r1], r4
-        vld1.32         {d4[1]},  [r5], r4
-
-3:      pld             [r5]
-        vmull.u8        q8,  d4,  d0
-        vld1.32         {d4[0]},  [r1], r4
-        vmull.u8        q9,  d4,  d1
-        vld1.32         {d4[1]},  [r5], r4
-        vadd.i16        d16, d16, d17
-        vadd.i16        d17, d18, d19
-        vrshrn.u16      d16, q8,  #6
-.ifc \type,avg
-        vld1.32         {d20[0]}, [lr,:32], r2
-        vld1.32         {d20[1]}, [lr,:32], r2
-        vrhadd.u8       d16, d16, d20
-.endif
-        subs            r3,  r3,  #2
-        pld             [r1]
-        vst1.32         {d16[0]}, [r0,:32], r2
-        vst1.32         {d16[1]}, [r0,:32], r2
-        bgt             3b
-
-        pop             {r4-r7, pc}
-
-4:      vld1.64         {d4},     [r1], r2
-        vld1.64         {d6},     [r1], r2
-        vext.8          d5,  d4,  d5,  #1
-        vext.8          d7,  d6,  d7,  #1
-        vtrn.32         d4,  d5
-        vtrn.32         d6,  d7
-
-5:      vmull.u8        q8,  d4,  d0
-        vmull.u8        q9,  d6,  d0
-        subs            r3,  r3,  #2
-        vld1.64         {d4},     [r1], r2
-        vext.8          d5,  d4,  d5,  #1
-        vtrn.32         d4,  d5
-        vadd.i16        d16, d16, d17
-        vadd.i16        d17, d18, d19
-        pld             [r1]
-        vrshrn.u16      d16, q8,  #6
-.ifc \type,avg
-        vld1.32         {d20[0]}, [lr,:32], r2
-        vld1.32         {d20[1]}, [lr,:32], r2
-        vrhadd.u8       d16, d16, d20
-.endif
-        vld1.64         {d6},     [r1], r2
-        vext.8          d7,  d6,  d7,  #1
-        vtrn.32         d6,  d7
-        pld             [r1]
-        vst1.32         {d16[0]}, [r0,:32], r2
-        vst1.32         {d16[1]}, [r0,:32], r2
-        bgt             5b
-
-        pop             {r4-r7, pc}
-endfunc
-        .endm
-
-        .macro  h264_chroma_mc2 type
-function ff_\type\()_h264_chroma_mc2_neon, export=1
-        push            {r4-r6, lr}
-        ldr             r4,  [sp, #16]
-        ldr             lr,  [sp, #20]
-        pld             [r1]
-        pld             [r1, r2]
-        orrs            r5,  r4,  lr
-        beq             2f
-
-        mul             r5,  r4,  lr
-        rsb             r6,  r5,  lr,  lsl #3
-        rsb             r12, r5,  r4,  lsl #3
-        sub             r4,  r5,  r4,  lsl #3
-        sub             r4,  r4,  lr,  lsl #3
-        add             r4,  r4,  #64
-        vdup.8          d0,  r4
-        vdup.8          d2,  r12
-        vdup.8          d1,  r6
-        vdup.8          d3,  r5
-        vtrn.16         q0,  q1
-1:
-        vld1.32         {d4[0]},  [r1], r2
-        vld1.32         {d4[1]},  [r1], r2
-        vrev64.32       d5,  d4
-        vld1.32         {d5[1]},  [r1]
-        vext.8          q3,  q2,  q2,  #1
-        vtrn.16         q2,  q3
-        vmull.u8        q8,  d4,  d0
-        vmlal.u8        q8,  d5,  d1
-.ifc \type,avg
-        vld1.16         {d18[0]}, [r0,:16], r2
-        vld1.16         {d18[1]}, [r0,:16]
-        sub             r0,  r0,  r2
-.endif
-        vtrn.32         d16, d17
-        vadd.i16        d16, d16, d17
-        vrshrn.u16      d16, q8,  #6
-.ifc \type,avg
-        vrhadd.u8       d16, d16, d18
-.endif
-        vst1.16         {d16[0]}, [r0,:16], r2
-        vst1.16         {d16[1]}, [r0,:16], r2
-        subs            r3,  r3,  #2
-        bgt             1b
-        pop             {r4-r6, pc}
-2:
-.ifc \type,put
-        ldrh            r5,  [r1], r2
-        strh            r5,  [r0], r2
-        ldrh            r6,  [r1], r2
-        strh            r6,  [r0], r2
-.else
-        vld1.16         {d16[0]}, [r1], r2
-        vld1.16         {d16[1]}, [r1], r2
-        vld1.16         {d18[0]}, [r0,:16], r2
-        vld1.16         {d18[1]}, [r0,:16]
-        sub             r0,  r0,  r2
-        vrhadd.u8       d16, d16, d18
-        vst1.16         {d16[0]}, [r0,:16], r2
-        vst1.16         {d16[1]}, [r0,:16], r2
-.endif
-        subs            r3,  r3,  #2
-        bgt             2b
-        pop             {r4-r6, pc}
-endfunc
-.endm
-
-        .text
-        .align
-
-        h264_chroma_mc8 put
-        h264_chroma_mc8 avg
-        h264_chroma_mc4 put
-        h264_chroma_mc4 avg
-        h264_chroma_mc2 put
-        h264_chroma_mc2 avg
-
-        /* H.264 loop filter */
-
-        .macro h264_loop_filter_start
-        ldr             ip,  [sp]
-        tst             r2,  r2
-        ldr             ip,  [ip]
-        tstne           r3,  r3
-        vmov.32         d24[0], ip
-        and             ip,  ip,  ip, lsl #16
-        bxeq            lr
-        ands            ip,  ip,  ip, lsl #8
-        bxlt            lr
-        .endm
-
-        .macro align_push_regs
-        and             ip,  sp,  #15
-        add             ip,  ip,  #32
-        sub             sp,  sp,  ip
-        vst1.64         {d12-d15}, [sp,:128]
-        sub             sp,  sp,  #32
-        vst1.64         {d8-d11},  [sp,:128]
-        .endm
-
-        .macro align_pop_regs
-        vld1.64         {d8-d11},  [sp,:128]!
-        vld1.64         {d12-d15}, [sp,:128], ip
-        .endm
-
-        .macro h264_loop_filter_luma
-        vdup.8          q11, r2         @ alpha
-        vmovl.u8        q12, d24
-        vabd.u8         q6,  q8,  q0    @ abs(p0 - q0)
-        vmovl.u16       q12, d24
-        vabd.u8         q14, q9,  q8    @ abs(p1 - p0)
-        vsli.16         q12, q12, #8
-        vabd.u8         q15, q1,  q0    @ abs(q1 - q0)
-        vsli.32         q12, q12, #16
-        vclt.u8         q6,  q6,  q11   @ < alpha
-        vdup.8          q11, r3         @ beta
-        vclt.s8         q7,  q12, #0
-        vclt.u8         q14, q14, q11   @ < beta
-        vclt.u8         q15, q15, q11   @ < beta
-        vbic            q6,  q6,  q7
-        vabd.u8         q4,  q10, q8    @ abs(p2 - p0)
-        vand            q6,  q6,  q14
-        vabd.u8         q5,  q2,  q0    @ abs(q2 - q0)
-        vclt.u8         q4,  q4,  q11   @ < beta
-        vand            q6,  q6,  q15
-        vclt.u8         q5,  q5,  q11   @ < beta
-        vand            q4,  q4,  q6
-        vand            q5,  q5,  q6
-        vand            q12, q12, q6
-        vrhadd.u8       q14, q8,  q0
-        vsub.i8         q6,  q12, q4
-        vqadd.u8        q7,  q9,  q12
-        vhadd.u8        q10, q10, q14
-        vsub.i8         q6,  q6,  q5
-        vhadd.u8        q14, q2,  q14
-        vmin.u8         q7,  q7,  q10
-        vqsub.u8        q11, q9,  q12
-        vqadd.u8        q2,  q1,  q12
-        vmax.u8         q7,  q7,  q11
-        vqsub.u8        q11, q1,  q12
-        vmin.u8         q14, q2,  q14
-        vmovl.u8        q2,  d0
-        vmax.u8         q14, q14, q11
-        vmovl.u8        q10, d1
-        vsubw.u8        q2,  q2,  d16
-        vsubw.u8        q10, q10, d17
-        vshl.i16        q2,  q2,  #2
-        vshl.i16        q10, q10, #2
-        vaddw.u8        q2,  q2,  d18
-        vaddw.u8        q10, q10, d19
-        vsubw.u8        q2,  q2,  d2
-        vsubw.u8        q10, q10, d3
-        vrshrn.i16      d4,  q2,  #3
-        vrshrn.i16      d5,  q10, #3
-        vbsl            q4,  q7,  q9
-        vbsl            q5,  q14, q1
-        vneg.s8         q7,  q6
-        vmovl.u8        q14, d16
-        vmin.s8         q2,  q2,  q6
-        vmovl.u8        q6,  d17
-        vmax.s8         q2,  q2,  q7
-        vmovl.u8        q11, d0
-        vmovl.u8        q12, d1
-        vaddw.s8        q14, q14, d4
-        vaddw.s8        q6,  q6,  d5
-        vsubw.s8        q11, q11, d4
-        vsubw.s8        q12, q12, d5
-        vqmovun.s16     d16, q14
-        vqmovun.s16     d17, q6
-        vqmovun.s16     d0,  q11
-        vqmovun.s16     d1,  q12
-        .endm
-
-function ff_h264_v_loop_filter_luma_neon, export=1
-        h264_loop_filter_start
-
-        vld1.64         {d0, d1},  [r0,:128], r1
-        vld1.64         {d2, d3},  [r0,:128], r1
-        vld1.64         {d4, d5},  [r0,:128], r1
-        sub             r0,  r0,  r1, lsl #2
-        sub             r0,  r0,  r1, lsl #1
-        vld1.64         {d20,d21}, [r0,:128], r1
-        vld1.64         {d18,d19}, [r0,:128], r1
-        vld1.64         {d16,d17}, [r0,:128], r1
-
-        align_push_regs
-
-        h264_loop_filter_luma
-
-        sub             r0,  r0,  r1, lsl #1
-        vst1.64         {d8, d9},  [r0,:128], r1
-        vst1.64         {d16,d17}, [r0,:128], r1
-        vst1.64         {d0, d1},  [r0,:128], r1
-        vst1.64         {d10,d11}, [r0,:128]
-
-        align_pop_regs
-        bx              lr
-endfunc
-
-function ff_h264_h_loop_filter_luma_neon, export=1
-        h264_loop_filter_start
-
-        sub             r0,  r0,  #4
-        vld1.64         {d6},  [r0], r1
-        vld1.64         {d20}, [r0], r1
-        vld1.64         {d18}, [r0], r1
-        vld1.64         {d16}, [r0], r1
-        vld1.64         {d0},  [r0], r1
-        vld1.64         {d2},  [r0], r1
-        vld1.64         {d4},  [r0], r1
-        vld1.64         {d26}, [r0], r1
-        vld1.64         {d7},  [r0], r1
-        vld1.64         {d21}, [r0], r1
-        vld1.64         {d19}, [r0], r1
-        vld1.64         {d17}, [r0], r1
-        vld1.64         {d1},  [r0], r1
-        vld1.64         {d3},  [r0], r1
-        vld1.64         {d5},  [r0], r1
-        vld1.64         {d27}, [r0], r1
-
-        transpose_8x8   q3, q10, q9, q8, q0, q1, q2, q13
-
-        align_push_regs
-
-        h264_loop_filter_luma
-
-        transpose_4x4   q4, q8, q0, q5
-
-        sub             r0,  r0,  r1, lsl #4
-        add             r0,  r0,  #2
-        vst1.32         {d8[0]},  [r0], r1
-        vst1.32         {d16[0]}, [r0], r1
-        vst1.32         {d0[0]},  [r0], r1
-        vst1.32         {d10[0]}, [r0], r1
-        vst1.32         {d8[1]},  [r0], r1
-        vst1.32         {d16[1]}, [r0], r1
-        vst1.32         {d0[1]},  [r0], r1
-        vst1.32         {d10[1]}, [r0], r1
-        vst1.32         {d9[0]},  [r0], r1
-        vst1.32         {d17[0]}, [r0], r1
-        vst1.32         {d1[0]},  [r0], r1
-        vst1.32         {d11[0]}, [r0], r1
-        vst1.32         {d9[1]},  [r0], r1
-        vst1.32         {d17[1]}, [r0], r1
-        vst1.32         {d1[1]},  [r0], r1
-        vst1.32         {d11[1]}, [r0], r1
-
-        align_pop_regs
-        bx              lr
-endfunc
-
-        .macro h264_loop_filter_chroma
-        vdup.8          d22, r2         @ alpha
-        vmovl.u8        q12, d24
-        vabd.u8         d26, d16, d0    @ abs(p0 - q0)
-        vmovl.u8        q2,  d0
-        vabd.u8         d28, d18, d16   @ abs(p1 - p0)
-        vsubw.u8        q2,  q2,  d16
-        vsli.16         d24, d24, #8
-        vshl.i16        q2,  q2,  #2
-        vabd.u8         d30, d2,  d0    @ abs(q1 - q0)
-        vaddw.u8        q2,  q2,  d18
-        vclt.u8         d26, d26, d22   @ < alpha
-        vsubw.u8        q2,  q2,  d2
-        vdup.8          d22, r3         @ beta
-        vclt.s8         d25, d24, #0
-        vrshrn.i16      d4,  q2,  #3
-        vclt.u8         d28, d28, d22   @ < beta
-        vbic            d26, d26, d25
-        vclt.u8         d30, d30, d22   @ < beta
-        vand            d26, d26, d28
-        vneg.s8         d25, d24
-        vand            d26, d26, d30
-        vmin.s8         d4,  d4,  d24
-        vmovl.u8        q14, d16
-        vand            d4,  d4,  d26
-        vmax.s8         d4,  d4,  d25
-        vmovl.u8        q11, d0
-        vaddw.s8        q14, q14, d4
-        vsubw.s8        q11, q11, d4
-        vqmovun.s16     d16, q14
-        vqmovun.s16     d0,  q11
-        .endm
-
-function ff_h264_v_loop_filter_chroma_neon, export=1
-        h264_loop_filter_start
-
-        sub             r0,  r0,  r1, lsl #1
-        vld1.64         {d18}, [r0,:64], r1
-        vld1.64         {d16}, [r0,:64], r1
-        vld1.64         {d0},  [r0,:64], r1
-        vld1.64         {d2},  [r0,:64]
-
-        h264_loop_filter_chroma
-
-        sub             r0,  r0,  r1, lsl #1
-        vst1.64         {d16}, [r0,:64], r1
-        vst1.64         {d0},  [r0,:64], r1
-
-        bx              lr
-endfunc
-
-function ff_h264_h_loop_filter_chroma_neon, export=1
-        h264_loop_filter_start
-
-        sub             r0,  r0,  #2
-        vld1.32         {d18[0]}, [r0], r1
-        vld1.32         {d16[0]}, [r0], r1
-        vld1.32         {d0[0]},  [r0], r1
-        vld1.32         {d2[0]},  [r0], r1
-        vld1.32         {d18[1]}, [r0], r1
-        vld1.32         {d16[1]}, [r0], r1
-        vld1.32         {d0[1]},  [r0], r1
-        vld1.32         {d2[1]},  [r0], r1
-
-        vtrn.16         d18, d0
-        vtrn.16         d16, d2
-        vtrn.8          d18, d16
-        vtrn.8          d0,  d2
-
-        h264_loop_filter_chroma
-
-        vtrn.16         d18, d0
-        vtrn.16         d16, d2
-        vtrn.8          d18, d16
-        vtrn.8          d0,  d2
-
-        sub             r0,  r0,  r1, lsl #3
-        vst1.32         {d18[0]}, [r0], r1
-        vst1.32         {d16[0]}, [r0], r1
-        vst1.32         {d0[0]},  [r0], r1
-        vst1.32         {d2[0]},  [r0], r1
-        vst1.32         {d18[1]}, [r0], r1
-        vst1.32         {d16[1]}, [r0], r1
-        vst1.32         {d0[1]},  [r0], r1
-        vst1.32         {d2[1]},  [r0], r1
-
-        bx              lr
-endfunc
-
-        /* H.264 qpel MC */
-
-        .macro  lowpass_const r
-        movw            \r,  #5
-        movt            \r,  #20
-        vmov.32         d6[0], \r
-        .endm
-
-        .macro  lowpass_8 r0, r1, r2, r3, d0, d1, narrow=1
-.if \narrow
-        t0 .req q0
-        t1 .req q8
-.else
-        t0 .req \d0
-        t1 .req \d1
-.endif
-        vext.8          d2,  \r0, \r1, #2
-        vext.8          d3,  \r0, \r1, #3
-        vaddl.u8        q1,  d2,  d3
-        vext.8          d4,  \r0, \r1, #1
-        vext.8          d5,  \r0, \r1, #4
-        vaddl.u8        q2,  d4,  d5
-        vext.8          d30, \r0, \r1, #5
-        vaddl.u8        t0,  \r0, d30
-        vext.8          d18, \r2, \r3, #2
-        vmla.i16        t0,  q1,  d6[1]
-        vext.8          d19, \r2, \r3, #3
-        vaddl.u8        q9,  d18, d19
-        vext.8          d20, \r2, \r3, #1
-        vmls.i16        t0,  q2,  d6[0]
-        vext.8          d21, \r2, \r3, #4
-        vaddl.u8        q10, d20, d21
-        vext.8          d31, \r2, \r3, #5
-        vaddl.u8        t1,  \r2, d31
-        vmla.i16        t1,  q9,  d6[1]
-        vmls.i16        t1,  q10, d6[0]
-.if \narrow
-        vqrshrun.s16    \d0, t0,  #5
-        vqrshrun.s16    \d1, t1,  #5
-.endif
-        .unreq  t0
-        .unreq  t1
-        .endm
-
-        .macro  lowpass_8_1 r0, r1, d0, narrow=1
-.if \narrow
-        t0 .req q0
-.else
-        t0 .req \d0
-.endif
-        vext.8          d2,  \r0, \r1, #2
-        vext.8          d3,  \r0, \r1, #3
-        vaddl.u8        q1,  d2,  d3
-        vext.8          d4,  \r0, \r1, #1
-        vext.8          d5,  \r0, \r1, #4
-        vaddl.u8        q2,  d4,  d5
-        vext.8          d30, \r0, \r1, #5
-        vaddl.u8        t0,  \r0, d30
-        vmla.i16        t0,  q1,  d6[1]
-        vmls.i16        t0,  q2,  d6[0]
-.if \narrow
-        vqrshrun.s16    \d0, t0,  #5
-.endif
-        .unreq  t0
-        .endm
-
-        .macro  lowpass_8.16 r0, r1, l0, h0, l1, h1, d
-        vext.16         q1,  \r0, \r1, #2
-        vext.16         q0,  \r0, \r1, #3
-        vaddl.s16       q9,  d2,  d0
-        vext.16         q2,  \r0, \r1, #1
-        vaddl.s16       q1,  d3,  d1
-        vext.16         q3,  \r0, \r1, #4
-        vaddl.s16       q10, d4,  d6
-        vext.16         \r1, \r0, \r1, #5
-        vaddl.s16       q2,  d5,  d7
-        vaddl.s16       q0,  \h0, \h1
-        vaddl.s16       q8,  \l0, \l1
-
-        vshl.i32        q3,  q9,  #4
-        vshl.i32        q9,  q9,  #2
-        vshl.i32        q15, q10, #2
-        vadd.i32        q9,  q9,  q3
-        vadd.i32        q10, q10, q15
-
-        vshl.i32        q3,  q1,  #4
-        vshl.i32        q1,  q1,  #2
-        vshl.i32        q15, q2,  #2
-        vadd.i32        q1,  q1,  q3
-        vadd.i32        q2,  q2,  q15
-
-        vadd.i32        q9,  q9,  q8
-        vsub.i32        q9,  q9,  q10
-
-        vadd.i32        q1,  q1,  q0
-        vsub.i32        q1,  q1,  q2
-
-        vrshrn.s32      d18, q9,  #10
-        vrshrn.s32      d19, q1,  #10
-
-        vqmovun.s16     \d,  q9
-        .endm
-
-function put_h264_qpel16_h_lowpass_neon_packed
-        mov             r4,  lr
-        mov             ip,  #16
-        mov             r3,  #8
-        bl              put_h264_qpel8_h_lowpass_neon
-        sub             r1,  r1,  r2, lsl #4
-        add             r1,  r1,  #8
-        mov             ip,  #16
-        mov             lr,  r4
-        b               put_h264_qpel8_h_lowpass_neon
-endfunc
-
-        .macro h264_qpel_h_lowpass type
-function \type\()_h264_qpel16_h_lowpass_neon
-        push            {lr}
-        mov             ip,  #16
-        bl              \type\()_h264_qpel8_h_lowpass_neon
-        sub             r0,  r0,  r3, lsl #4
-        sub             r1,  r1,  r2, lsl #4
-        add             r0,  r0,  #8
-        add             r1,  r1,  #8
-        mov             ip,  #16
-        pop             {lr}
-endfunc
-
-function \type\()_h264_qpel8_h_lowpass_neon
-1:      vld1.64         {d0, d1},  [r1], r2
-        vld1.64         {d16,d17}, [r1], r2
-        subs            ip,  ip,  #2
-        lowpass_8       d0,  d1,  d16, d17, d0,  d16
-.ifc \type,avg
-        vld1.8          {d2},     [r0,:64], r3
-        vrhadd.u8       d0,  d0,  d2
-        vld1.8          {d3},     [r0,:64]
-        vrhadd.u8       d16, d16, d3
-        sub             r0,  r0,  r3
-.endif
-        vst1.64         {d0},     [r0,:64], r3
-        vst1.64         {d16},    [r0,:64], r3
-        bne             1b
-        bx              lr
-endfunc
-        .endm
-
-        h264_qpel_h_lowpass put
-        h264_qpel_h_lowpass avg
-
-        .macro h264_qpel_h_lowpass_l2 type
-function \type\()_h264_qpel16_h_lowpass_l2_neon
-        push            {lr}
-        mov             ip,  #16
-        bl              \type\()_h264_qpel8_h_lowpass_l2_neon
-        sub             r0,  r0,  r2, lsl #4
-        sub             r1,  r1,  r2, lsl #4
-        sub             r3,  r3,  r2, lsl #4
-        add             r0,  r0,  #8
-        add             r1,  r1,  #8
-        add             r3,  r3,  #8
-        mov             ip,  #16
-        pop             {lr}
-endfunc
-
-function \type\()_h264_qpel8_h_lowpass_l2_neon
-1:      vld1.64         {d0, d1},  [r1], r2
-        vld1.64         {d16,d17}, [r1], r2
-        vld1.64         {d28},     [r3], r2
-        vld1.64         {d29},     [r3], r2
-        subs            ip,  ip,  #2
-        lowpass_8       d0,  d1,  d16, d17, d0,  d1
-        vrhadd.u8       q0,  q0,  q14
-.ifc \type,avg
-        vld1.8          {d2},      [r0,:64], r2
-        vrhadd.u8       d0,  d0,  d2
-        vld1.8          {d3},      [r0,:64]
-        vrhadd.u8       d1,  d1,  d3
-        sub             r0,  r0,  r2
-.endif
-        vst1.64         {d0},      [r0,:64], r2
-        vst1.64         {d1},      [r0,:64], r2
-        bne             1b
-        bx              lr
-endfunc
-        .endm
-
-        h264_qpel_h_lowpass_l2 put
-        h264_qpel_h_lowpass_l2 avg
-
-function put_h264_qpel16_v_lowpass_neon_packed
-        mov             r4,  lr
-        mov             r2,  #8
-        bl              put_h264_qpel8_v_lowpass_neon
-        sub             r1,  r1,  r3, lsl #2
-        bl              put_h264_qpel8_v_lowpass_neon
-        sub             r1,  r1,  r3, lsl #4
-        sub             r1,  r1,  r3, lsl #2
-        add             r1,  r1,  #8
-        bl              put_h264_qpel8_v_lowpass_neon
-        sub             r1,  r1,  r3, lsl #2
-        mov             lr,  r4
-        b               put_h264_qpel8_v_lowpass_neon
-endfunc
-
-        .macro h264_qpel_v_lowpass type
-function \type\()_h264_qpel16_v_lowpass_neon
-        mov             r4,  lr
-        bl              \type\()_h264_qpel8_v_lowpass_neon
-        sub             r1,  r1,  r3, lsl #2
-        bl              \type\()_h264_qpel8_v_lowpass_neon
-        sub             r0,  r0,  r2, lsl #4
-        add             r0,  r0,  #8
-        sub             r1,  r1,  r3, lsl #4
-        sub             r1,  r1,  r3, lsl #2
-        add             r1,  r1,  #8
-        bl              \type\()_h264_qpel8_v_lowpass_neon
-        sub             r1,  r1,  r3, lsl #2
-        mov             lr,  r4
-endfunc
-
-function \type\()_h264_qpel8_v_lowpass_neon
-        vld1.64         {d8},  [r1], r3
-        vld1.64         {d10}, [r1], r3
-        vld1.64         {d12}, [r1], r3
-        vld1.64         {d14}, [r1], r3
-        vld1.64         {d22}, [r1], r3
-        vld1.64         {d24}, [r1], r3
-        vld1.64         {d26}, [r1], r3
-        vld1.64         {d28}, [r1], r3
-        vld1.64         {d9},  [r1], r3
-        vld1.64         {d11}, [r1], r3
-        vld1.64         {d13}, [r1], r3
-        vld1.64         {d15}, [r1], r3
-        vld1.64         {d23}, [r1]
-
-        transpose_8x8   q4,  q5,  q6,  q7,  q11, q12, q13, q14
-        lowpass_8       d8,  d9,  d10, d11, d8,  d10
-        lowpass_8       d12, d13, d14, d15, d12, d14
-        lowpass_8       d22, d23, d24, d25, d22, d24
-        lowpass_8       d26, d27, d28, d29, d26, d28
-        transpose_8x8   d8,  d10, d12, d14, d22, d24, d26, d28
-
-.ifc \type,avg
-        vld1.8          {d9},  [r0,:64], r2
-        vrhadd.u8       d8,  d8,  d9
-        vld1.8          {d11}, [r0,:64], r2
-        vrhadd.u8       d10, d10, d11
-        vld1.8          {d13}, [r0,:64], r2
-        vrhadd.u8       d12, d12, d13
-        vld1.8          {d15}, [r0,:64], r2
-        vrhadd.u8       d14, d14, d15
-        vld1.8          {d23}, [r0,:64], r2
-        vrhadd.u8       d22, d22, d23
-        vld1.8          {d25}, [r0,:64], r2
-        vrhadd.u8       d24, d24, d25
-        vld1.8          {d27}, [r0,:64], r2
-        vrhadd.u8       d26, d26, d27
-        vld1.8          {d29}, [r0,:64], r2
-        vrhadd.u8       d28, d28, d29
-        sub             r0,  r0,  r2,  lsl #3
-.endif
-
-        vst1.64         {d8},  [r0,:64], r2
-        vst1.64         {d10}, [r0,:64], r2
-        vst1.64         {d12}, [r0,:64], r2
-        vst1.64         {d14}, [r0,:64], r2
-        vst1.64         {d22}, [r0,:64], r2
-        vst1.64         {d24}, [r0,:64], r2
-        vst1.64         {d26}, [r0,:64], r2
-        vst1.64         {d28}, [r0,:64], r2
-
-        bx              lr
-endfunc
-        .endm
-
-        h264_qpel_v_lowpass put
-        h264_qpel_v_lowpass avg
-
-        .macro h264_qpel_v_lowpass_l2 type
-function \type\()_h264_qpel16_v_lowpass_l2_neon
-        mov             r4,  lr
-        bl              \type\()_h264_qpel8_v_lowpass_l2_neon
-        sub             r1,  r1,  r3, lsl #2
-        bl              \type\()_h264_qpel8_v_lowpass_l2_neon
-        sub             r0,  r0,  r3, lsl #4
-        sub             ip,  ip,  r2, lsl #4
-        add             r0,  r0,  #8
-        add             ip,  ip,  #8
-        sub             r1,  r1,  r3, lsl #4
-        sub             r1,  r1,  r3, lsl #2
-        add             r1,  r1,  #8
-        bl              \type\()_h264_qpel8_v_lowpass_l2_neon
-        sub             r1,  r1,  r3, lsl #2
-        mov             lr,  r4
-endfunc
-
-function \type\()_h264_qpel8_v_lowpass_l2_neon
-        vld1.64         {d8},  [r1], r3
-        vld1.64         {d10}, [r1], r3
-        vld1.64         {d12}, [r1], r3
-        vld1.64         {d14}, [r1], r3
-        vld1.64         {d22}, [r1], r3
-        vld1.64         {d24}, [r1], r3
-        vld1.64         {d26}, [r1], r3
-        vld1.64         {d28}, [r1], r3
-        vld1.64         {d9},  [r1], r3
-        vld1.64         {d11}, [r1], r3
-        vld1.64         {d13}, [r1], r3
-        vld1.64         {d15}, [r1], r3
-        vld1.64         {d23}, [r1]
-
-        transpose_8x8   q4,  q5,  q6,  q7,  q11, q12, q13, q14
-        lowpass_8       d8,  d9,  d10, d11, d8,  d9
-        lowpass_8       d12, d13, d14, d15, d12, d13
-        lowpass_8       d22, d23, d24, d25, d22, d23
-        lowpass_8       d26, d27, d28, d29, d26, d27
-        transpose_8x8   d8,  d9,  d12, d13, d22, d23, d26, d27
-
-        vld1.64         {d0},  [ip], r2
-        vld1.64         {d1},  [ip], r2
-        vld1.64         {d2},  [ip], r2
-        vld1.64         {d3},  [ip], r2
-        vld1.64         {d4},  [ip], r2
-        vrhadd.u8       q0,  q0,  q4
-        vld1.64         {d5},  [ip], r2
-        vrhadd.u8       q1,  q1,  q6
-        vld1.64         {d10}, [ip], r2
-        vrhadd.u8       q2,  q2,  q11
-        vld1.64         {d11}, [ip], r2
-        vrhadd.u8       q5,  q5,  q13
-
-.ifc \type,avg
-        vld1.8          {d16}, [r0,:64], r3
-        vrhadd.u8       d0,  d0,  d16
-        vld1.8          {d17}, [r0,:64], r3
-        vrhadd.u8       d1,  d1,  d17
-        vld1.8          {d16}, [r0,:64], r3
-        vrhadd.u8       d2,  d2,  d16
-        vld1.8          {d17}, [r0,:64], r3
-        vrhadd.u8       d3,  d3,  d17
-        vld1.8          {d16}, [r0,:64], r3
-        vrhadd.u8       d4,  d4,  d16
-        vld1.8          {d17}, [r0,:64], r3
-        vrhadd.u8       d5,  d5,  d17
-        vld1.8          {d16}, [r0,:64], r3
-        vrhadd.u8       d10, d10, d16
-        vld1.8          {d17}, [r0,:64], r3
-        vrhadd.u8       d11, d11, d17
-        sub             r0,  r0,  r3,  lsl #3
-.endif
-
-        vst1.64         {d0},  [r0,:64], r3
-        vst1.64         {d1},  [r0,:64], r3
-        vst1.64         {d2},  [r0,:64], r3
-        vst1.64         {d3},  [r0,:64], r3
-        vst1.64         {d4},  [r0,:64], r3
-        vst1.64         {d5},  [r0,:64], r3
-        vst1.64         {d10}, [r0,:64], r3
-        vst1.64         {d11}, [r0,:64], r3
-
-        bx              lr
-endfunc
-        .endm
-
-        h264_qpel_v_lowpass_l2 put
-        h264_qpel_v_lowpass_l2 avg
-
-function put_h264_qpel8_hv_lowpass_neon_top
-        lowpass_const   ip
-        mov             ip,  #12
-1:      vld1.64         {d0, d1},  [r1], r3
-        vld1.64         {d16,d17}, [r1], r3
-        subs            ip,  ip,  #2
-        lowpass_8       d0,  d1,  d16, d17, q11, q12, narrow=0
-        vst1.64         {d22-d25}, [r4,:128]!
-        bne             1b
-
-        vld1.64         {d0, d1},  [r1]
-        lowpass_8_1     d0,  d1,  q12, narrow=0
-
-        mov             ip,  #-16
-        add             r4,  r4,  ip
-        vld1.64         {d30,d31}, [r4,:128], ip
-        vld1.64         {d20,d21}, [r4,:128], ip
-        vld1.64         {d18,d19}, [r4,:128], ip
-        vld1.64         {d16,d17}, [r4,:128], ip
-        vld1.64         {d14,d15}, [r4,:128], ip
-        vld1.64         {d12,d13}, [r4,:128], ip
-        vld1.64         {d10,d11}, [r4,:128], ip
-        vld1.64         {d8, d9},  [r4,:128], ip
-        vld1.64         {d6, d7},  [r4,:128], ip
-        vld1.64         {d4, d5},  [r4,:128], ip
-        vld1.64         {d2, d3},  [r4,:128], ip
-        vld1.64         {d0, d1},  [r4,:128]
-
-        swap4           d1,  d3,  d5,  d7,  d8,  d10, d12, d14
-        transpose16_4x4 q0,  q1,  q2,  q3,  q4,  q5,  q6,  q7
-
-        swap4           d17, d19, d21, d31, d24, d26, d28, d22
-        transpose16_4x4 q8,  q9,  q10, q15, q12, q13, q14, q11
-
-        vst1.64         {d30,d31}, [r4,:128]!
-        vst1.64         {d6, d7},  [r4,:128]!
-        vst1.64         {d20,d21}, [r4,:128]!
-        vst1.64         {d4, d5},  [r4,:128]!
-        vst1.64         {d18,d19}, [r4,:128]!
-        vst1.64         {d2, d3},  [r4,:128]!
-        vst1.64         {d16,d17}, [r4,:128]!
-        vst1.64         {d0, d1},  [r4,:128]
-
-        lowpass_8.16    q4,  q12, d8,  d9,  d24, d25, d8
-        lowpass_8.16    q5,  q13, d10, d11, d26, d27, d9
-        lowpass_8.16    q6,  q14, d12, d13, d28, d29, d10
-        lowpass_8.16    q7,  q11, d14, d15, d22, d23, d11
-
-        vld1.64         {d16,d17}, [r4,:128], ip
-        vld1.64         {d30,d31}, [r4,:128], ip
-        lowpass_8.16    q8,  q15, d16, d17, d30, d31, d12
-        vld1.64         {d16,d17}, [r4,:128], ip
-        vld1.64         {d30,d31}, [r4,:128], ip
-        lowpass_8.16    q8,  q15, d16, d17, d30, d31, d13
-        vld1.64         {d16,d17}, [r4,:128], ip
-        vld1.64         {d30,d31}, [r4,:128], ip
-        lowpass_8.16    q8,  q15, d16, d17, d30, d31, d14
-        vld1.64         {d16,d17}, [r4,:128], ip
-        vld1.64         {d30,d31}, [r4,:128]
-        lowpass_8.16    q8,  q15, d16, d17, d30, d31, d15
-
-        transpose_8x8   d12, d13, d14, d15, d8,  d9,  d10, d11
-
-        bx              lr
-endfunc
-
-        .macro h264_qpel8_hv_lowpass type
-function \type\()_h264_qpel8_hv_lowpass_neon
-        mov             r10, lr
-        bl              put_h264_qpel8_hv_lowpass_neon_top
-.ifc \type,avg
-        vld1.8          {d0},      [r0,:64], r2
-        vrhadd.u8       d12, d12, d0
-        vld1.8          {d1},      [r0,:64], r2
-        vrhadd.u8       d13, d13, d1
-        vld1.8          {d2},      [r0,:64], r2
-        vrhadd.u8       d14, d14, d2
-        vld1.8          {d3},      [r0,:64], r2
-        vrhadd.u8       d15, d15, d3
-        vld1.8          {d4},      [r0,:64], r2
-        vrhadd.u8       d8,  d8,  d4
-        vld1.8          {d5},      [r0,:64], r2
-        vrhadd.u8       d9,  d9,  d5
-        vld1.8          {d6},      [r0,:64], r2
-        vrhadd.u8       d10, d10, d6
-        vld1.8          {d7},      [r0,:64], r2
-        vrhadd.u8       d11, d11, d7
-        sub             r0,  r0,  r2,  lsl #3
-.endif
-        vst1.64         {d12},     [r0,:64], r2
-        vst1.64         {d13},     [r0,:64], r2
-        vst1.64         {d14},     [r0,:64], r2
-        vst1.64         {d15},     [r0,:64], r2
-        vst1.64         {d8},      [r0,:64], r2
-        vst1.64         {d9},      [r0,:64], r2
-        vst1.64         {d10},     [r0,:64], r2
-        vst1.64         {d11},     [r0,:64], r2
-
-        mov             lr,  r10
-        bx              lr
-endfunc
-        .endm
-
-        h264_qpel8_hv_lowpass put
-        h264_qpel8_hv_lowpass avg
-
-        .macro h264_qpel8_hv_lowpass_l2 type
-function \type\()_h264_qpel8_hv_lowpass_l2_neon
-        mov             r10, lr
-        bl              put_h264_qpel8_hv_lowpass_neon_top
-
-        vld1.64         {d0, d1},  [r2,:128]!
-        vld1.64         {d2, d3},  [r2,:128]!
-        vrhadd.u8       q0,  q0,  q6
-        vld1.64         {d4, d5},  [r2,:128]!
-        vrhadd.u8       q1,  q1,  q7
-        vld1.64         {d6, d7},  [r2,:128]!
-        vrhadd.u8       q2,  q2,  q4
-        vrhadd.u8       q3,  q3,  q5
-.ifc \type,avg
-        vld1.8          {d16},     [r0,:64], r3
-        vrhadd.u8       d0,  d0,  d16
-        vld1.8          {d17},     [r0,:64], r3
-        vrhadd.u8       d1,  d1,  d17
-        vld1.8          {d18},     [r0,:64], r3
-        vrhadd.u8       d2,  d2,  d18
-        vld1.8          {d19},     [r0,:64], r3
-        vrhadd.u8       d3,  d3,  d19
-        vld1.8          {d20},     [r0,:64], r3
-        vrhadd.u8       d4,  d4,  d20
-        vld1.8          {d21},     [r0,:64], r3
-        vrhadd.u8       d5,  d5,  d21
-        vld1.8          {d22},     [r0,:64], r3
-        vrhadd.u8       d6,  d6,  d22
-        vld1.8          {d23},     [r0,:64], r3
-        vrhadd.u8       d7,  d7,  d23
-        sub             r0,  r0,  r3,  lsl #3
-.endif
-        vst1.64         {d0},      [r0,:64], r3
-        vst1.64         {d1},      [r0,:64], r3
-        vst1.64         {d2},      [r0,:64], r3
-        vst1.64         {d3},      [r0,:64], r3
-        vst1.64         {d4},      [r0,:64], r3
-        vst1.64         {d5},      [r0,:64], r3
-        vst1.64         {d6},      [r0,:64], r3
-        vst1.64         {d7},      [r0,:64], r3
-
-        mov             lr,  r10
-        bx              lr
-endfunc
-        .endm
-
-        h264_qpel8_hv_lowpass_l2 put
-        h264_qpel8_hv_lowpass_l2 avg
-
-        .macro h264_qpel16_hv type
-function \type\()_h264_qpel16_hv_lowpass_neon
-        mov             r9,  lr
-        bl              \type\()_h264_qpel8_hv_lowpass_neon
-        sub             r1,  r1,  r3, lsl #2
-        bl              \type\()_h264_qpel8_hv_lowpass_neon
-        sub             r1,  r1,  r3, lsl #4
-        sub             r1,  r1,  r3, lsl #2
-        add             r1,  r1,  #8
-        sub             r0,  r0,  r2, lsl #4
-        add             r0,  r0,  #8
-        bl              \type\()_h264_qpel8_hv_lowpass_neon
-        sub             r1,  r1,  r3, lsl #2
-        mov             lr,  r9
-        b               \type\()_h264_qpel8_hv_lowpass_neon
-endfunc
-
-function \type\()_h264_qpel16_hv_lowpass_l2_neon
-        mov             r9,  lr
-        sub             r2,  r4,  #256
-        bl              \type\()_h264_qpel8_hv_lowpass_l2_neon
-        sub             r1,  r1,  r3, lsl #2
-        bl              \type\()_h264_qpel8_hv_lowpass_l2_neon
-        sub             r1,  r1,  r3, lsl #4
-        sub             r1,  r1,  r3, lsl #2
-        add             r1,  r1,  #8
-        sub             r0,  r0,  r3, lsl #4
-        add             r0,  r0,  #8
-        bl              \type\()_h264_qpel8_hv_lowpass_l2_neon
-        sub             r1,  r1,  r3, lsl #2
-        mov             lr,  r9
-        b               \type\()_h264_qpel8_hv_lowpass_l2_neon
-endfunc
-        .endm
-
-        h264_qpel16_hv put
-        h264_qpel16_hv avg
-
-        .macro h264_qpel8 type
-function ff_\type\()_h264_qpel8_mc10_neon, export=1
-        lowpass_const   r3
-        mov             r3,  r1
-        sub             r1,  r1,  #2
-        mov             ip,  #8
-        b               \type\()_h264_qpel8_h_lowpass_l2_neon
-endfunc
-
-function ff_\type\()_h264_qpel8_mc20_neon, export=1
-        lowpass_const   r3
-        sub             r1,  r1,  #2
-        mov             r3,  r2
-        mov             ip,  #8
-        b               \type\()_h264_qpel8_h_lowpass_neon
-endfunc
-
-function ff_\type\()_h264_qpel8_mc30_neon, export=1
-        lowpass_const   r3
-        add             r3,  r1,  #1
-        sub             r1,  r1,  #2
-        mov             ip,  #8
-        b               \type\()_h264_qpel8_h_lowpass_l2_neon
-endfunc
-
-function ff_\type\()_h264_qpel8_mc01_neon, export=1
-        push            {lr}
-        mov             ip,  r1
-\type\()_h264_qpel8_mc01:
-        lowpass_const   r3
-        mov             r3,  r2
-        sub             r1,  r1,  r2, lsl #1
-        vpush           {d8-d15}
-        bl              \type\()_h264_qpel8_v_lowpass_l2_neon
-        vpop            {d8-d15}
-        pop             {pc}
-endfunc
-
-function ff_\type\()_h264_qpel8_mc11_neon, export=1
-        push            {r0, r1, r11, lr}
-\type\()_h264_qpel8_mc11:
-        lowpass_const   r3
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             sp,  sp,  #64
-        mov             r0,  sp
-        sub             r1,  r1,  #2
-        mov             r3,  #8
-        mov             ip,  #8
-        vpush           {d8-d15}
-        bl              put_h264_qpel8_h_lowpass_neon
-        ldrd            r0,  [r11]
-        mov             r3,  r2
-        add             ip,  sp,  #64
-        sub             r1,  r1,  r2, lsl #1
-        mov             r2,  #8
-        bl              \type\()_h264_qpel8_v_lowpass_l2_neon
-        vpop            {d8-d15}
-        add             sp,  r11, #8
-        pop             {r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel8_mc21_neon, export=1
-        push            {r0, r1, r4, r10, r11, lr}
-\type\()_h264_qpel8_mc21:
-        lowpass_const   r3
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             sp,  sp,  #(8*8+16*12)
-        sub             r1,  r1,  #2
-        mov             r3,  #8
-        mov             r0,  sp
-        mov             ip,  #8
-        vpush           {d8-d15}
-        bl              put_h264_qpel8_h_lowpass_neon
-        mov             r4,  r0
-        ldrd            r0,  [r11]
-        sub             r1,  r1,  r2, lsl #1
-        sub             r1,  r1,  #2
-        mov             r3,  r2
-        sub             r2,  r4,  #64
-        bl              \type\()_h264_qpel8_hv_lowpass_l2_neon
-        vpop            {d8-d15}
-        add             sp,  r11,  #8
-        pop             {r4, r10, r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel8_mc31_neon, export=1
-        add             r1,  r1,  #1
-        push            {r0, r1, r11, lr}
-        sub             r1,  r1,  #1
-        b               \type\()_h264_qpel8_mc11
-endfunc
-
-function ff_\type\()_h264_qpel8_mc02_neon, export=1
-        push            {lr}
-        lowpass_const   r3
-        sub             r1,  r1,  r2, lsl #1
-        mov             r3,  r2
-        vpush           {d8-d15}
-        bl              \type\()_h264_qpel8_v_lowpass_neon
-        vpop            {d8-d15}
-        pop             {pc}
-endfunc
-
-function ff_\type\()_h264_qpel8_mc12_neon, export=1
-        push            {r0, r1, r4, r10, r11, lr}
-\type\()_h264_qpel8_mc12:
-        lowpass_const   r3
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             sp,  sp,  #(8*8+16*12)
-        sub             r1,  r1,  r2, lsl #1
-        mov             r3,  r2
-        mov             r2,  #8
-        mov             r0,  sp
-        vpush           {d8-d15}
-        bl              put_h264_qpel8_v_lowpass_neon
-        mov             r4,  r0
-        ldrd            r0,  [r11]
-        sub             r1,  r1,  r3, lsl #1
-        sub             r1,  r1,  #2
-        sub             r2,  r4,  #64
-        bl              \type\()_h264_qpel8_hv_lowpass_l2_neon
-        vpop            {d8-d15}
-        add             sp,  r11,  #8
-        pop             {r4, r10, r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel8_mc22_neon, export=1
-        push            {r4, r10, r11, lr}
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             r1,  r1,  r2, lsl #1
-        sub             r1,  r1,  #2
-        mov             r3,  r2
-        sub             sp,  sp,  #(16*12)
-        mov             r4,  sp
-        vpush           {d8-d15}
-        bl              \type\()_h264_qpel8_hv_lowpass_neon
-        vpop            {d8-d15}
-        mov             sp,  r11
-        pop             {r4, r10, r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel8_mc32_neon, export=1
-        push            {r0, r1, r4, r10, r11, lr}
-        add             r1,  r1,  #1
-        b               \type\()_h264_qpel8_mc12
-endfunc
-
-function ff_\type\()_h264_qpel8_mc03_neon, export=1
-        push            {lr}
-        add             ip,  r1,  r2
-        b               \type\()_h264_qpel8_mc01
-endfunc
-
-function ff_\type\()_h264_qpel8_mc13_neon, export=1
-        push            {r0, r1, r11, lr}
-        add             r1,  r1,  r2
-        b               \type\()_h264_qpel8_mc11
-endfunc
-
-function ff_\type\()_h264_qpel8_mc23_neon, export=1
-        push            {r0, r1, r4, r10, r11, lr}
-        add             r1,  r1,  r2
-        b               \type\()_h264_qpel8_mc21
-endfunc
-
-function ff_\type\()_h264_qpel8_mc33_neon, export=1
-        add             r1,  r1,  #1
-        push            {r0, r1, r11, lr}
-        add             r1,  r1,  r2
-        sub             r1,  r1,  #1
-        b               \type\()_h264_qpel8_mc11
-endfunc
-        .endm
-
-        h264_qpel8 put
-        h264_qpel8 avg
-
-        .macro h264_qpel16 type
-function ff_\type\()_h264_qpel16_mc10_neon, export=1
-        lowpass_const   r3
-        mov             r3,  r1
-        sub             r1,  r1,  #2
-        b               \type\()_h264_qpel16_h_lowpass_l2_neon
-endfunc
-
-function ff_\type\()_h264_qpel16_mc20_neon, export=1
-        lowpass_const   r3
-        sub             r1,  r1,  #2
-        mov             r3,  r2
-        b               \type\()_h264_qpel16_h_lowpass_neon
-endfunc
-
-function ff_\type\()_h264_qpel16_mc30_neon, export=1
-        lowpass_const   r3
-        add             r3,  r1,  #1
-        sub             r1,  r1,  #2
-        b               \type\()_h264_qpel16_h_lowpass_l2_neon
-endfunc
-
-function ff_\type\()_h264_qpel16_mc01_neon, export=1
-        push            {r4, lr}
-        mov             ip,  r1
-\type\()_h264_qpel16_mc01:
-        lowpass_const   r3
-        mov             r3,  r2
-        sub             r1,  r1,  r2, lsl #1
-        vpush           {d8-d15}
-        bl              \type\()_h264_qpel16_v_lowpass_l2_neon
-        vpop            {d8-d15}
-        pop             {r4, pc}
-endfunc
-
-function ff_\type\()_h264_qpel16_mc11_neon, export=1
-        push            {r0, r1, r4, r11, lr}
-\type\()_h264_qpel16_mc11:
-        lowpass_const   r3
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             sp,  sp,  #256
-        mov             r0,  sp
-        sub             r1,  r1,  #2
-        mov             r3,  #16
-        vpush           {d8-d15}
-        bl              put_h264_qpel16_h_lowpass_neon
-        ldrd            r0,  [r11]
-        mov             r3,  r2
-        add             ip,  sp,  #64
-        sub             r1,  r1,  r2, lsl #1
-        mov             r2,  #16
-        bl              \type\()_h264_qpel16_v_lowpass_l2_neon
-        vpop            {d8-d15}
-        add             sp,  r11, #8
-        pop             {r4, r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel16_mc21_neon, export=1
-        push            {r0, r1, r4-r5, r9-r11, lr}
-\type\()_h264_qpel16_mc21:
-        lowpass_const   r3
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             sp,  sp,  #(16*16+16*12)
-        sub             r1,  r1,  #2
-        mov             r0,  sp
-        vpush           {d8-d15}
-        bl              put_h264_qpel16_h_lowpass_neon_packed
-        mov             r4,  r0
-        ldrd            r0,  [r11]
-        sub             r1,  r1,  r2, lsl #1
-        sub             r1,  r1,  #2
-        mov             r3,  r2
-        bl              \type\()_h264_qpel16_hv_lowpass_l2_neon
-        vpop            {d8-d15}
-        add             sp,  r11,  #8
-        pop             {r4-r5, r9-r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel16_mc31_neon, export=1
-        add             r1,  r1,  #1
-        push            {r0, r1, r4, r11, lr}
-        sub             r1,  r1,  #1
-        b               \type\()_h264_qpel16_mc11
-endfunc
-
-function ff_\type\()_h264_qpel16_mc02_neon, export=1
-        push            {r4, lr}
-        lowpass_const   r3
-        sub             r1,  r1,  r2, lsl #1
-        mov             r3,  r2
-        vpush           {d8-d15}
-        bl              \type\()_h264_qpel16_v_lowpass_neon
-        vpop            {d8-d15}
-        pop             {r4, pc}
-endfunc
-
-function ff_\type\()_h264_qpel16_mc12_neon, export=1
-        push            {r0, r1, r4-r5, r9-r11, lr}
-\type\()_h264_qpel16_mc12:
-        lowpass_const   r3
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             sp,  sp,  #(16*16+16*12)
-        sub             r1,  r1,  r2, lsl #1
-        mov             r0,  sp
-        mov             r3,  r2
-        vpush           {d8-d15}
-        bl              put_h264_qpel16_v_lowpass_neon_packed
-        mov             r4,  r0
-        ldrd            r0,  [r11]
-        sub             r1,  r1,  r3, lsl #1
-        sub             r1,  r1,  #2
-        mov             r2,  r3
-        bl              \type\()_h264_qpel16_hv_lowpass_l2_neon
-        vpop            {d8-d15}
-        add             sp,  r11,  #8
-        pop             {r4-r5, r9-r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel16_mc22_neon, export=1
-        push            {r4, r9-r11, lr}
-        lowpass_const   r3
-        mov             r11, sp
-        bic             sp,  sp,  #15
-        sub             r1,  r1,  r2, lsl #1
-        sub             r1,  r1,  #2
-        mov             r3,  r2
-        sub             sp,  sp,  #(16*12)
-        mov             r4,  sp
-        vpush           {d8-d15}
-        bl              \type\()_h264_qpel16_hv_lowpass_neon
-        vpop            {d8-d15}
-        mov             sp,  r11
-        pop             {r4, r9-r11, pc}
-endfunc
-
-function ff_\type\()_h264_qpel16_mc32_neon, export=1
-        push            {r0, r1, r4-r5, r9-r11, lr}
-        add             r1,  r1,  #1
-        b               \type\()_h264_qpel16_mc12
-endfunc
-
-function ff_\type\()_h264_qpel16_mc03_neon, export=1
-        push            {r4, lr}
-        add             ip,  r1,  r2
-        b               \type\()_h264_qpel16_mc01
-endfunc
-
-function ff_\type\()_h264_qpel16_mc13_neon, export=1
-        push            {r0, r1, r4, r11, lr}
-        add             r1,  r1,  r2
-        b               \type\()_h264_qpel16_mc11
-endfunc
-
-function ff_\type\()_h264_qpel16_mc23_neon, export=1
-        push            {r0, r1, r4-r5, r9-r11, lr}
-        add             r1,  r1,  r2
-        b               \type\()_h264_qpel16_mc21
-endfunc
-
-function ff_\type\()_h264_qpel16_mc33_neon, export=1
-        add             r1,  r1,  #1
-        push            {r0, r1, r4, r11, lr}
-        add             r1,  r1,  r2
-        sub             r1,  r1,  #1
-        b               \type\()_h264_qpel16_mc11
-endfunc
-        .endm
-
-        h264_qpel16 put
-        h264_qpel16 avg
-
-@ Biweighted prediction
-
-        .macro  biweight_16 macs, macd
-        vdup.8          d0,  r4
-        vdup.8          d1,  r5
-        vmov            q2,  q8
-        vmov            q3,  q8
-1:      subs            ip,  ip,  #2
-        vld1.8          {d20-d21},[r0,:128], r2
-        \macd           q2,  d0,  d20
-        pld             [r0]
-        \macd           q3,  d0,  d21
-        vld1.8          {d22-d23},[r1,:128], r2
-        \macs           q2,  d1,  d22
-        pld             [r1]
-        \macs           q3,  d1,  d23
-        vmov            q12, q8
-        vld1.8          {d28-d29},[r0,:128], r2
-        vmov            q13, q8
-        \macd           q12, d0,  d28
-        pld             [r0]
-        \macd           q13, d0,  d29
-        vld1.8          {d30-d31},[r1,:128], r2
-        \macs           q12, d1,  d30
-        pld             [r1]
-        \macs           q13, d1,  d31
-        vshl.s16        q2,  q2,  q9
-        vshl.s16        q3,  q3,  q9
-        vqmovun.s16     d4,  q2
-        vqmovun.s16     d5,  q3
-        vshl.s16        q12, q12, q9
-        vshl.s16        q13, q13, q9
-        vqmovun.s16     d24, q12
-        vqmovun.s16     d25, q13
-        vmov            q3,  q8
-        vst1.8          {d4- d5}, [r6,:128], r2
-        vmov            q2,  q8
-        vst1.8          {d24-d25},[r6,:128], r2
-        bne             1b
-        pop             {r4-r6, pc}
-        .endm
-
-        .macro  biweight_8 macs, macd
-        vdup.8          d0,  r4
-        vdup.8          d1,  r5
-        vmov            q1,  q8
-        vmov            q10, q8
-1:      subs            ip,  ip,  #2
-        vld1.8          {d4},[r0,:64], r2
-        \macd           q1,  d0,  d4
-        pld             [r0]
-        vld1.8          {d5},[r1,:64], r2
-        \macs           q1,  d1,  d5
-        pld             [r1]
-        vld1.8          {d6},[r0,:64], r2
-        \macd           q10, d0,  d6
-        pld             [r0]
-        vld1.8          {d7},[r1,:64], r2
-        \macs           q10, d1,  d7
-        pld             [r1]
-        vshl.s16        q1,  q1,  q9
-        vqmovun.s16     d2,  q1
-        vshl.s16        q10, q10, q9
-        vqmovun.s16     d4,  q10
-        vmov            q10, q8
-        vst1.8          {d2},[r6,:64], r2
-        vmov            q1,  q8
-        vst1.8          {d4},[r6,:64], r2
-        bne             1b
-        pop             {r4-r6, pc}
-        .endm
-
-        .macro  biweight_4 macs, macd
-        vdup.8          d0,  r4
-        vdup.8          d1,  r5
-        vmov            q1,  q8
-        vmov            q10, q8
-1:      subs            ip,  ip,  #4
-        vld1.32         {d4[0]},[r0,:32], r2
-        vld1.32         {d4[1]},[r0,:32], r2
-        \macd           q1,  d0,  d4
-        pld             [r0]
-        vld1.32         {d5[0]},[r1,:32], r2
-        vld1.32         {d5[1]},[r1,:32], r2
-        \macs           q1,  d1,  d5
-        pld             [r1]
-        blt             2f
-        vld1.32         {d6[0]},[r0,:32], r2
-        vld1.32         {d6[1]},[r0,:32], r2
-        \macd           q10, d0,  d6
-        pld             [r0]
-        vld1.32         {d7[0]},[r1,:32], r2
-        vld1.32         {d7[1]},[r1,:32], r2
-        \macs           q10, d1,  d7
-        pld             [r1]
-        vshl.s16        q1,  q1,  q9
-        vqmovun.s16     d2,  q1
-        vshl.s16        q10, q10, q9
-        vqmovun.s16     d4,  q10
-        vmov            q10, q8
-        vst1.32         {d2[0]},[r6,:32], r2
-        vst1.32         {d2[1]},[r6,:32], r2
-        vmov            q1,  q8
-        vst1.32         {d4[0]},[r6,:32], r2
-        vst1.32         {d4[1]},[r6,:32], r2
-        bne             1b
-        pop             {r4-r6, pc}
-2:      vshl.s16        q1,  q1,  q9
-        vqmovun.s16     d2,  q1
-        vst1.32         {d2[0]},[r6,:32], r2
-        vst1.32         {d2[1]},[r6,:32], r2
-        pop             {r4-r6, pc}
-        .endm
-
-        .macro  biweight_func w
-function biweight_h264_pixels_\w\()_neon
-        push            {r4-r6, lr}
-        add             r4,  sp,  #16
-        ldm             r4,  {r4-r6}
-        lsr             lr,  r4,  #31
-        add             r6,  r6,  #1
-        eors            lr,  lr,  r5,  lsr #30
-        orr             r6,  r6,  #1
-        vdup.16         q9,  r3
-        lsl             r6,  r6,  r3
-        vmvn            q9,  q9
-        vdup.16         q8,  r6
-        mov             r6,  r0
-        beq             10f
-        subs            lr,  lr,  #1
-        beq             20f
-        subs            lr,  lr,  #1
-        beq             30f
-        b               40f
-10:     biweight_\w     vmlal.u8, vmlal.u8
-20:     rsb             r4,  r4,  #0
-        biweight_\w     vmlal.u8, vmlsl.u8
-30:     rsb             r4,  r4,  #0
-        rsb             r5,  r5,  #0
-        biweight_\w     vmlsl.u8, vmlsl.u8
-40:     rsb             r5,  r5,  #0
-        biweight_\w     vmlsl.u8, vmlal.u8
-endfunc
-        .endm
-
-        .macro  biweight_entry w, h, b=1
-function ff_biweight_h264_pixels_\w\()x\h\()_neon, export=1
-        mov             ip,  #\h
-.if \b
-        b               biweight_h264_pixels_\w\()_neon
-.endif
-endfunc
-        .endm
-
-        biweight_entry  16, 8
-        biweight_entry  16, 16, b=0
-        biweight_func   16
-
-        biweight_entry  8,  16
-        biweight_entry  8,  4
-        biweight_entry  8,  8,  b=0
-        biweight_func   8
-
-        biweight_entry  4,  8
-        biweight_entry  4,  2
-        biweight_entry  4,  4,  b=0
-        biweight_func   4
-
-@ Weighted prediction
-
-        .macro  weight_16 add
-        vdup.8          d0,  r3
-1:      subs            ip,  ip,  #2
-        vld1.8          {d20-d21},[r0,:128], r1
-        vmull.u8        q2,  d0,  d20
-        pld             [r0]
-        vmull.u8        q3,  d0,  d21
-        vld1.8          {d28-d29},[r0,:128], r1
-        vmull.u8        q12, d0,  d28
-        pld             [r0]
-        vmull.u8        q13, d0,  d29
-        \add            q2,  q8,  q2
-        vrshl.s16       q2,  q2,  q9
-        \add            q3,  q8,  q3
-        vrshl.s16       q3,  q3,  q9
-        vqmovun.s16     d4,  q2
-        vqmovun.s16     d5,  q3
-        \add            q12, q8,  q12
-        vrshl.s16       q12, q12, q9
-        \add            q13, q8,  q13
-        vrshl.s16       q13, q13, q9
-        vqmovun.s16     d24, q12
-        vqmovun.s16     d25, q13
-        vst1.8          {d4- d5}, [r4,:128], r1
-        vst1.8          {d24-d25},[r4,:128], r1
-        bne             1b
-        pop             {r4, pc}
-        .endm
-
-        .macro  weight_8 add
-        vdup.8          d0,  r3
-1:      subs            ip,  ip,  #2
-        vld1.8          {d4},[r0,:64], r1
-        vmull.u8        q1,  d0,  d4
-        pld             [r0]
-        vld1.8          {d6},[r0,:64], r1
-        vmull.u8        q10, d0,  d6
-        \add            q1,  q8,  q1
-        pld             [r0]
-        vrshl.s16       q1,  q1,  q9
-        vqmovun.s16     d2,  q1
-        \add            q10, q8,  q10
-        vrshl.s16       q10, q10, q9
-        vqmovun.s16     d4,  q10
-        vst1.8          {d2},[r4,:64], r1
-        vst1.8          {d4},[r4,:64], r1
-        bne             1b
-        pop             {r4, pc}
-        .endm
-
-        .macro  weight_4 add
-        vdup.8          d0,  r3
-        vmov            q1,  q8
-        vmov            q10, q8
-1:      subs            ip,  ip,  #4
-        vld1.32         {d4[0]},[r0,:32], r1
-        vld1.32         {d4[1]},[r0,:32], r1
-        vmull.u8        q1,  d0,  d4
-        pld             [r0]
-        blt             2f
-        vld1.32         {d6[0]},[r0,:32], r1
-        vld1.32         {d6[1]},[r0,:32], r1
-        vmull.u8        q10, d0,  d6
-        pld             [r0]
-        \add            q1,  q8,  q1
-        vrshl.s16       q1,  q1,  q9
-        vqmovun.s16     d2,  q1
-        \add            q10, q8,  q10
-        vrshl.s16       q10, q10, q9
-        vqmovun.s16     d4,  q10
-        vmov            q10, q8
-        vst1.32         {d2[0]},[r4,:32], r1
-        vst1.32         {d2[1]},[r4,:32], r1
-        vmov            q1,  q8
-        vst1.32         {d4[0]},[r4,:32], r1
-        vst1.32         {d4[1]},[r4,:32], r1
-        bne             1b
-        pop             {r4, pc}
-2:      \add            q1,  q8,  q1
-        vrshl.s16       q1,  q1,  q9
-        vqmovun.s16     d2,  q1
-        vst1.32         {d2[0]},[r4,:32], r1
-        vst1.32         {d2[1]},[r4,:32], r1
-        pop             {r4, pc}
-        .endm
-
-        .macro  weight_func w
-function weight_h264_pixels_\w\()_neon
-        push            {r4, lr}
-        ldr             r4,  [sp, #8]
-        cmp             r2,  #1
-        lsl             r4,  r4,  r2
-        vdup.16         q8,  r4
-        mov             r4,  r0
-        ble             20f
-        rsb             lr,  r2,  #1
-        vdup.16         q9,  lr
-        cmp             r3,  #0
-        blt             10f
-        weight_\w       vhadd.s16
-10:     rsb             r3,  r3,  #0
-        weight_\w       vhsub.s16
-20:     rsb             lr,  r2,  #0
-        vdup.16         q9,  lr
-        cmp             r3,  #0
-        blt             10f
-        weight_\w       vadd.s16
-10:     rsb             r3,  r3,  #0
-        weight_\w       vsub.s16
-endfunc
-        .endm
-
-        .macro  weight_entry w, h, b=1
-function ff_weight_h264_pixels_\w\()x\h\()_neon, export=1
-        mov             ip,  #\h
-.if \b
-        b               weight_h264_pixels_\w\()_neon
-.endif
-endfunc
-        .endm
-
-        weight_entry    16, 8
-        weight_entry    16, 16, b=0
-        weight_func     16
-
-        weight_entry    8,  16
-        weight_entry    8,  4
-        weight_entry    8,  8,  b=0
-        weight_func     8
-
-        weight_entry    4,  8
-        weight_entry    4,  2
-        weight_entry    4,  4,  b=0
-        weight_func     4
diff --git a/libavcodec/arm/h264idct_neon.S b/libavcodec/arm/h264idct_neon.S
deleted file mode 100644
index 0ba4880..0000000
--- a/libavcodec/arm/h264idct_neon.S
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        preserve8
-        .text
-
-function ff_h264_idct_add_neon, export=1
-        vld1.64         {d0-d3},  [r1,:128]
-
-        vswp            d1,  d2
-        vadd.i16        d4,  d0,  d1
-        vshr.s16        q8,  q1,  #1
-        vsub.i16        d5,  d0,  d1
-        vadd.i16        d6,  d2,  d17
-        vsub.i16        d7,  d16, d3
-        vadd.i16        q0,  q2,  q3
-        vsub.i16        q1,  q2,  q3
-
-        vtrn.16         d0,  d1
-        vtrn.16         d3,  d2
-        vtrn.32         d0,  d3
-        vtrn.32         d1,  d2
-
-        vadd.i16        d4,  d0,  d3
-        vld1.32         {d18[0]}, [r0,:32], r2
-        vswp            d1,  d3
-        vshr.s16        q8,  q1,  #1
-        vld1.32         {d19[1]}, [r0,:32], r2
-        vsub.i16        d5,  d0,  d1
-        vld1.32         {d18[1]}, [r0,:32], r2
-        vadd.i16        d6,  d16, d3
-        vld1.32         {d19[0]}, [r0,:32], r2
-        vsub.i16        d7,  d2,  d17
-        sub             r0,  r0,  r2, lsl #2
-        vadd.i16        q0,  q2,  q3
-        vsub.i16        q1,  q2,  q3
-
-        vrshr.s16       q0,  q0,  #6
-        vrshr.s16       q1,  q1,  #6
-
-        vaddw.u8        q0,  q0,  d18
-        vaddw.u8        q1,  q1,  d19
-
-        vqmovun.s16     d0,  q0
-        vqmovun.s16     d1,  q1
-
-        vst1.32         {d0[0]},  [r0,:32], r2
-        vst1.32         {d1[1]},  [r0,:32], r2
-        vst1.32         {d0[1]},  [r0,:32], r2
-        vst1.32         {d1[0]},  [r0,:32], r2
-
-        bx              lr
-endfunc
-
-function ff_h264_idct_dc_add_neon, export=1
-        vld1.16         {d2[],d3[]}, [r1,:16]
-        vrshr.s16       q1,  q1,  #6
-        vld1.32         {d0[0]},  [r0,:32], r2
-        vld1.32         {d0[1]},  [r0,:32], r2
-        vaddw.u8        q2,  q1,  d0
-        vld1.32         {d1[0]},  [r0,:32], r2
-        vld1.32         {d1[1]},  [r0,:32], r2
-        vaddw.u8        q1,  q1,  d1
-        vqmovun.s16     d0,  q2
-        vqmovun.s16     d1,  q1
-        sub             r0,  r0,  r2, lsl #2
-        vst1.32         {d0[0]},  [r0,:32], r2
-        vst1.32         {d0[1]},  [r0,:32], r2
-        vst1.32         {d1[0]},  [r0,:32], r2
-        vst1.32         {d1[1]},  [r0,:32], r2
-        bx              lr
-endfunc
-
-function ff_h264_idct_add16_neon, export=1
-        push            {r4-r8,lr}
-        mov             r4,  r0
-        mov             r5,  r1
-        mov             r1,  r2
-        mov             r2,  r3
-        ldr             r6,  [sp, #24]
-        movrel          r7,  scan8
-        mov             ip,  #16
-1:      ldrb            r8,  [r7], #1
-        ldr             r0,  [r5], #4
-        ldrb            r8,  [r6, r8]
-        subs            r8,  r8,  #1
-        blt             2f
-        ldrsh           lr,  [r1]
-        add             r0,  r0,  r4
-        movne           lr,  #0
-        cmp             lr,  #0
-        adrne           lr,  ff_h264_idct_dc_add_neon
-        adreq           lr,  ff_h264_idct_add_neon
-        blx             lr
-2:      subs            ip,  ip,  #1
-        add             r1,  r1,  #32
-        bne             1b
-        pop             {r4-r8,pc}
-endfunc
-
-function ff_h264_idct_add16intra_neon, export=1
-        push            {r4-r8,lr}
-        mov             r4,  r0
-        mov             r5,  r1
-        mov             r1,  r2
-        mov             r2,  r3
-        ldr             r6,  [sp, #24]
-        movrel          r7,  scan8
-        mov             ip,  #16
-1:      ldrb            r8,  [r7], #1
-        ldr             r0,  [r5], #4
-        ldrb            r8,  [r6, r8]
-        add             r0,  r0,  r4
-        cmp             r8,  #0
-        ldrsh           r8,  [r1]
-        adrne           lr,  ff_h264_idct_add_neon
-        adreq           lr,  ff_h264_idct_dc_add_neon
-        cmpeq           r8,  #0
-        blxne           lr
-        subs            ip,  ip,  #1
-        add             r1,  r1,  #32
-        bne             1b
-        pop             {r4-r8,pc}
-endfunc
-
-function ff_h264_idct_add8_neon, export=1
-        push            {r4-r10,lr}
-        ldm             r0,  {r4,r9}
-        add             r5,  r1,  #16*4
-        add             r1,  r2,  #16*32
-        mov             r2,  r3
-        ldr             r6,  [sp, #32]
-        movrel          r7,  scan8+16
-        mov             ip,  #8
-1:      ldrb            r8,  [r7], #1
-        ldr             r0,  [r5], #4
-        ldrb            r8,  [r6, r8]
-        tst             ip,  #4
-        addeq           r0,  r0,  r4
-        addne           r0,  r0,  r9
-        cmp             r8,  #0
-        ldrsh           r8,  [r1]
-        adrne           lr,  ff_h264_idct_add_neon
-        adreq           lr,  ff_h264_idct_dc_add_neon
-        cmpeq           r8,  #0
-        blxne           lr
-        subs            ip,  ip,  #1
-        add             r1,  r1,  #32
-        bne             1b
-        pop             {r4-r10,pc}
-endfunc
-
-        .section .rodata
-scan8:  .byte           4+1*8, 5+1*8, 4+2*8, 5+2*8
-        .byte           6+1*8, 7+1*8, 6+2*8, 7+2*8
-        .byte           4+3*8, 5+3*8, 4+4*8, 5+4*8
-        .byte           6+3*8, 7+3*8, 6+4*8, 7+4*8
-        .byte           1+1*8, 2+1*8
-        .byte           1+2*8, 2+2*8
-        .byte           1+4*8, 2+4*8
-        .byte           1+5*8, 2+5*8
diff --git a/libavcodec/arm/h264pred_init_arm.c b/libavcodec/arm/h264pred_init_arm.c
deleted file mode 100644
index a7d9960..0000000
--- a/libavcodec/arm/h264pred_init_arm.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-#include "libavcodec/h264pred.h"
-
-void ff_pred16x16_vert_neon(uint8_t *src, int stride);
-void ff_pred16x16_hor_neon(uint8_t *src, int stride);
-void ff_pred16x16_plane_neon(uint8_t *src, int stride);
-void ff_pred16x16_dc_neon(uint8_t *src, int stride);
-void ff_pred16x16_128_dc_neon(uint8_t *src, int stride);
-void ff_pred16x16_left_dc_neon(uint8_t *src, int stride);
-void ff_pred16x16_top_dc_neon(uint8_t *src, int stride);
-
-void ff_pred8x8_vert_neon(uint8_t *src, int stride);
-void ff_pred8x8_hor_neon(uint8_t *src, int stride);
-void ff_pred8x8_plane_neon(uint8_t *src, int stride);
-void ff_pred8x8_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_128_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_left_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_top_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_l0t_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_0lt_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_l00_dc_neon(uint8_t *src, int stride);
-void ff_pred8x8_0l0_dc_neon(uint8_t *src, int stride);
-
-#if HAVE_NEON
-static void ff_h264_pred_init_neon(H264PredContext *h, int codec_id)
-{
-    h->pred8x8[VERT_PRED8x8     ] = ff_pred8x8_vert_neon;
-    h->pred8x8[HOR_PRED8x8      ] = ff_pred8x8_hor_neon;
-    h->pred8x8[PLANE_PRED8x8    ] = ff_pred8x8_plane_neon;
-    h->pred8x8[DC_128_PRED8x8   ] = ff_pred8x8_128_dc_neon;
-    if (codec_id != CODEC_ID_RV40) {
-        h->pred8x8[DC_PRED8x8     ] = ff_pred8x8_dc_neon;
-        h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon;
-        h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon;
-        h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] = ff_pred8x8_l0t_dc_neon;
-        h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] = ff_pred8x8_0lt_dc_neon;
-        h->pred8x8[ALZHEIMER_DC_L00_PRED8x8] = ff_pred8x8_l00_dc_neon;
-        h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8] = ff_pred8x8_0l0_dc_neon;
-    }
-
-    h->pred16x16[DC_PRED8x8     ] = ff_pred16x16_dc_neon;
-    h->pred16x16[VERT_PRED8x8   ] = ff_pred16x16_vert_neon;
-    h->pred16x16[HOR_PRED8x8    ] = ff_pred16x16_hor_neon;
-    h->pred16x16[LEFT_DC_PRED8x8] = ff_pred16x16_left_dc_neon;
-    h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon;
-    h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_neon;
-    if (codec_id != CODEC_ID_SVQ3 && codec_id != CODEC_ID_RV40)
-        h->pred16x16[PLANE_PRED8x8  ] = ff_pred16x16_plane_neon;
-}
-#endif
-
-void ff_h264_pred_init_arm(H264PredContext *h, int codec_id)
-{
-    if (HAVE_NEON)    ff_h264_pred_init_neon(h, codec_id);
-}
diff --git a/libavcodec/arm/h264pred_neon.S b/libavcodec/arm/h264pred_neon.S
deleted file mode 100644
index e2c69e1..0000000
--- a/libavcodec/arm/h264pred_neon.S
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        .macro ldcol.8  rd,  rs,  rt,  n=8,  hi=0
-.if \n == 8 || \hi == 0
-        vld1.8          {\rd[0]}, [\rs], \rt
-        vld1.8          {\rd[1]}, [\rs], \rt
-        vld1.8          {\rd[2]}, [\rs], \rt
-        vld1.8          {\rd[3]}, [\rs], \rt
-.endif
-.if \n == 8 || \hi == 1
-        vld1.8          {\rd[4]}, [\rs], \rt
-        vld1.8          {\rd[5]}, [\rs], \rt
-        vld1.8          {\rd[6]}, [\rs], \rt
-        vld1.8          {\rd[7]}, [\rs], \rt
-.endif
-        .endm
-
-        .macro add16x8  dq,  dl,  dh,  rl,  rh
-        vaddl.u8        \dq, \rl, \rh
-        vadd.u16        \dl, \dl, \dh
-        vpadd.u16       \dl, \dl, \dl
-        vpadd.u16       \dl, \dl, \dl
-        .endm
-
-function ff_pred16x16_128_dc_neon, export=1
-        vmov.i8         q0,  #128
-        b               .L_pred16x16_dc_end
-endfunc
-
-function ff_pred16x16_top_dc_neon, export=1
-        sub             r2,  r0,  r1
-        vld1.8          {q0},     [r2,:128]
-        add16x8         q0,  d0,  d1,  d0,  d1
-        vrshrn.u16      d0,  q0,  #4
-        vdup.8          q0,  d0[0]
-        b               .L_pred16x16_dc_end
-endfunc
-
-function ff_pred16x16_left_dc_neon, export=1
-        sub             r2,  r0,  #1
-        ldcol.8         d0,  r2,  r1
-        ldcol.8         d1,  r2,  r1
-        add16x8         q0,  d0,  d1,  d0,  d1
-        vrshrn.u16      d0,  q0,  #4
-        vdup.8          q0,  d0[0]
-        b               .L_pred16x16_dc_end
-endfunc
-
-function ff_pred16x16_dc_neon, export=1
-        sub             r2,  r0,  r1
-        vld1.8          {q0},     [r2,:128]
-        sub             r2,  r0,  #1
-        ldcol.8         d2,  r2,  r1
-        ldcol.8         d3,  r2,  r1
-        vaddl.u8        q0,  d0,  d1
-        vaddl.u8        q1,  d2,  d3
-        vadd.u16        q0,  q0,  q1
-        vadd.u16        d0,  d0,  d1
-        vpadd.u16       d0,  d0,  d0
-        vpadd.u16       d0,  d0,  d0
-        vrshrn.u16      d0,  q0,  #5
-        vdup.8          q0,  d0[0]
-.L_pred16x16_dc_end:
-        mov             r3,  #8
-6:      vst1.8          {q0},     [r0,:128], r1
-        vst1.8          {q0},     [r0,:128], r1
-        subs            r3,  r3,  #1
-        bne             6b
-        bx              lr
-endfunc
-
-function ff_pred16x16_hor_neon, export=1
-        sub             r2,  r0,  #1
-        mov             r3,  #16
-1:      vld1.8          {d0[],d1[]},[r2],      r1
-        vst1.8          {q0},       [r0,:128], r1
-        subs            r3,  r3,  #1
-        bne             1b
-        bx              lr
-endfunc
-
-function ff_pred16x16_vert_neon, export=1
-        sub             r0,  r0,  r1
-        vld1.8          {q0},     [r0,:128], r1
-        mov             r3,  #8
-1:      vst1.8          {q0},     [r0,:128], r1
-        vst1.8          {q0},     [r0,:128], r1
-        subs            r3,  r3,  #1
-        bne             1b
-        bx              lr
-endfunc
-
-function ff_pred16x16_plane_neon, export=1
-        sub             r3,  r0,  r1
-        add             r2,  r3,  #8
-        sub             r3,  r3,  #1
-        vld1.8          {d0},     [r3]
-        vld1.8          {d2},     [r2,:64], r1
-        ldcol.8         d1,  r3,  r1
-        add             r3,  r3,  r1
-        ldcol.8         d3,  r3,  r1
-        vrev64.8        q0,  q0
-        vaddl.u8        q8,  d2,  d3
-        vsubl.u8        q2,  d2,  d0
-        vsubl.u8        q3,  d3,  d1
-        movrel          r3,  p16weight
-        vld1.8          {q0},     [r3,:128]
-        vmul.s16        q2,  q2,  q0
-        vmul.s16        q3,  q3,  q0
-        vadd.i16        d4,  d4,  d5
-        vadd.i16        d5,  d6,  d7
-        vpadd.i16       d4,  d4,  d5
-        vpadd.i16       d4,  d4,  d4
-        vshl.i16        d5,  d4,  #2
-        vaddl.s16       q2,  d4,  d5
-        vrshrn.s32      d4,  q2,  #6
-        mov             r3,  #0
-        vtrn.16         d4,  d5
-        vadd.i16        d2,  d4,  d5
-        vshl.i16        d3,  d2,  #3
-        vrev64.16       d16, d17
-        vsub.i16        d3,  d3,  d2
-        vadd.i16        d16, d16, d0
-        vshl.i16        d2,  d16, #4
-        vsub.i16        d2,  d2,  d3
-        vshl.i16        d3,  d4,  #4
-        vext.16         q0,  q0,  q0,  #7
-        vsub.i16        d6,  d5,  d3
-        vmov.16         d0[0], r3
-        vmul.i16        q0,  q0,  d4[0]
-        vdup.16         q1,  d2[0]
-        vdup.16         q2,  d4[0]
-        vdup.16         q3,  d6[0]
-        vshl.i16        q2,  q2,  #3
-        vadd.i16        q1,  q1,  q0
-        vadd.i16        q3,  q3,  q2
-        mov             r3,  #16
-1:
-        vqshrun.s16     d0,  q1,  #5
-        vadd.i16        q1,  q1,  q2
-        vqshrun.s16     d1,  q1,  #5
-        vadd.i16        q1,  q1,  q3
-        vst1.8          {q0},     [r0,:128], r1
-        subs            r3,  r3,  #1
-        bne             1b
-        bx              lr
-endfunc
-
-        .section        .rodata
-        .align          4
-p16weight:
-        .short          1,2,3,4,5,6,7,8
-
-        .text
-
-function ff_pred8x8_hor_neon, export=1
-        sub             r2,  r0,  #1
-        mov             r3,  #8
-1:      vld1.8          {d0[]},   [r2],     r1
-        vst1.8          {d0},     [r0,:64], r1
-        subs            r3,  r3,  #1
-        bne             1b
-        bx              lr
-endfunc
-
-function ff_pred8x8_vert_neon, export=1
-        sub             r0,  r0,  r1
-        vld1.8          {d0},     [r0,:64], r1
-        mov             r3,  #4
-1:      vst1.8          {d0},     [r0,:64], r1
-        vst1.8          {d0},     [r0,:64], r1
-        subs            r3,  r3,  #1
-        bne             1b
-        bx              lr
-endfunc
-
-function ff_pred8x8_plane_neon, export=1
-        sub             r3,  r0,  r1
-        add             r2,  r3,  #4
-        sub             r3,  r3,  #1
-        vld1.32         {d0[0]},  [r3]
-        vld1.32         {d2[0]},  [r2,:32], r1
-        ldcol.8         d0,  r3,  r1,  4,  hi=1
-        add             r3,  r3,  r1
-        ldcol.8         d3,  r3,  r1,  4
-        vaddl.u8        q8,  d2,  d3
-        vrev32.8        d0,  d0
-        vtrn.32         d2,  d3
-        vsubl.u8        q2,  d2,  d0
-        movrel          r3,  p16weight
-        vld1.16         {q0},     [r3,:128]
-        vmul.s16        d4,  d4,  d0
-        vmul.s16        d5,  d5,  d0
-        vpadd.i16       d4,  d4,  d5
-        vpaddl.s16      d4,  d4
-        vshl.i32        d5,  d4,  #4
-        vadd.s32        d4,  d4,  d5
-        vrshrn.s32      d4,  q2,  #5
-        mov             r3,  #0
-        vtrn.16         d4,  d5
-        vadd.i16        d2,  d4,  d5
-        vshl.i16        d3,  d2,  #2
-        vrev64.16       d16, d16
-        vsub.i16        d3,  d3,  d2
-        vadd.i16        d16, d16, d0
-        vshl.i16        d2,  d16, #4
-        vsub.i16        d2,  d2,  d3
-        vshl.i16        d3,  d4,  #3
-        vext.16         q0,  q0,  q0,  #7
-        vsub.i16        d6,  d5,  d3
-        vmov.16         d0[0], r3
-        vmul.i16        q0,  q0,  d4[0]
-        vdup.16         q1,  d2[0]
-        vdup.16         q2,  d4[0]
-        vdup.16         q3,  d6[0]
-        vshl.i16        q2,  q2,  #3
-        vadd.i16        q1,  q1,  q0
-        vadd.i16        q3,  q3,  q2
-        mov             r3,  #8
-1:
-        vqshrun.s16     d0,  q1,  #5
-        vadd.i16        q1,  q1,  q3
-        vst1.8          {d0},     [r0,:64], r1
-        subs            r3,  r3,  #1
-        bne             1b
-        bx              lr
-endfunc
-
-function ff_pred8x8_128_dc_neon, export=1
-        vmov.i8         q0,  #128
-        b               .L_pred8x8_dc_end
-endfunc
-
-function ff_pred8x8_top_dc_neon, export=1
-        sub             r2,  r0,  r1
-        vld1.8          {d0},     [r2,:64]
-        vpaddl.u8       d0,  d0
-        vpadd.u16       d0,  d0,  d0
-        vrshrn.u16      d0,  q0,  #2
-        vdup.8          d1,  d0[1]
-        vdup.8          d0,  d0[0]
-        vtrn.32         d0,  d1
-        b               .L_pred8x8_dc_end
-endfunc
-
-function ff_pred8x8_left_dc_neon, export=1
-        sub             r2,  r0,  #1
-        ldcol.8         d0,  r2,  r1
-        vpaddl.u8       d0,  d0
-        vpadd.u16       d0,  d0,  d0
-        vrshrn.u16      d0,  q0,  #2
-        vdup.8          d1,  d0[1]
-        vdup.8          d0,  d0[0]
-        b               .L_pred8x8_dc_end
-endfunc
-
-function ff_pred8x8_dc_neon, export=1
-        sub             r2,  r0,  r1
-        vld1.8          {d0},     [r2,:64]
-        sub             r2,  r0,  #1
-        ldcol.8         d1,  r2,  r1
-        vtrn.32         d0,  d1
-        vpaddl.u8       q0,  q0
-        vpadd.u16       d0,  d0,  d1
-        vpadd.u16       d1,  d0,  d0
-        vrshrn.u16      d2,  q0,  #3
-        vrshrn.u16      d3,  q0,  #2
-        vdup.8          d0,  d2[4]
-        vdup.8          d1,  d3[3]
-        vdup.8          d4,  d3[2]
-        vdup.8          d5,  d2[5]
-        vtrn.32         q0,  q2
-.L_pred8x8_dc_end:
-        mov             r3,  #4
-        add             r2,  r0,  r1,  lsl #2
-6:      vst1.8          {d0},     [r0,:64], r1
-        vst1.8          {d1},     [r2,:64], r1
-        subs            r3,  r3,  #1
-        bne             6b
-        bx              lr
-endfunc
-
-function ff_pred8x8_l0t_dc_neon, export=1
-        sub             r2,  r0,  r1
-        vld1.8          {d0},     [r2,:64]
-        sub             r2,  r0,  #1
-        ldcol.8         d1,  r2,  r1,  4
-        vtrn.32         d0,  d1
-        vpaddl.u8       q0,  q0
-        vpadd.u16       d0,  d0,  d1
-        vpadd.u16       d1,  d0,  d0
-        vrshrn.u16      d2,  q0,  #3
-        vrshrn.u16      d3,  q0,  #2
-        vdup.8          d0,  d2[4]
-        vdup.8          d1,  d3[0]
-        vdup.8          q2,  d3[2]
-        vtrn.32         q0,  q2
-        b               .L_pred8x8_dc_end
-endfunc
-
-function ff_pred8x8_l00_dc_neon, export=1
-        sub             r2,  r0,  #1
-        ldcol.8         d0,  r2,  r1,  4
-        vpaddl.u8       d0,  d0
-        vpadd.u16       d0,  d0,  d0
-        vrshrn.u16      d0,  q0,  #2
-        vmov.i8         d1,  #128
-        vdup.8          d0,  d0[0]
-        b               .L_pred8x8_dc_end
-endfunc
-
-function ff_pred8x8_0lt_dc_neon, export=1
-        sub             r2,  r0,  r1
-        vld1.8          {d0},     [r2,:64]
-        add             r2,  r0,  r1,  lsl #2
-        sub             r2,  r2,  #1
-        ldcol.8         d1,  r2,  r1,  4,  hi=1
-        vtrn.32         d0,  d1
-        vpaddl.u8       q0,  q0
-        vpadd.u16       d0,  d0,  d1
-        vpadd.u16       d1,  d0,  d0
-        vrshrn.u16      d3,  q0,  #2
-        vrshrn.u16      d2,  q0,  #3
-        vdup.8          d0,  d3[0]
-        vdup.8          d1,  d3[3]
-        vdup.8          d4,  d3[2]
-        vdup.8          d5,  d2[5]
-        vtrn.32         q0,  q2
-        b               .L_pred8x8_dc_end
-endfunc
-
-function ff_pred8x8_0l0_dc_neon, export=1
-        add             r2,  r0,  r1,  lsl #2
-        sub             r2,  r2,  #1
-        ldcol.8         d1,  r2,  r1,  4
-        vpaddl.u8       d2,  d1
-        vpadd.u16       d2,  d2,  d2
-        vrshrn.u16      d1,  q1,  #2
-        vmov.i8         d0,  #128
-        vdup.8          d1,  d1[0]
-        b               .L_pred8x8_dc_end
-endfunc
diff --git a/libavcodec/arm/int_neon.S b/libavcodec/arm/int_neon.S
deleted file mode 100644
index e8023e0..0000000
--- a/libavcodec/arm/int_neon.S
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * ARM NEON optimised integer operations
- * Copyright (c) 2009 Kostya Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        preserve8
-        .fpu neon
-        .text
-
-function ff_scalarproduct_int16_neon, export=1
-        vmov.i16        q0,  #0
-        vmov.i16        q1,  #0
-        vmov.i16        q2,  #0
-        vmov.i16        q3,  #0
-        negs            r3,  r3
-        beq             2f
-
-        vdup.s32        q12, r3
-1:      vld1.16         {d16-d17}, [r0]!
-        vld1.16         {d20-d21}, [r1,:128]!
-        vmull.s16       q12, d16,  d20
-        vld1.16         {d18-d19}, [r0]!
-        vmull.s16       q13, d17,  d21
-        vld1.16         {d22-d23}, [r1,:128]!
-        vmull.s16       q14, d18,  d22
-        vmull.s16       q15, d19,  d23
-        vshl.s32        q8,  q12,  q12
-        vshl.s32        q9,  q13,  q12
-        vadd.s32        q0,  q0,   q8
-        vshl.s32        q10, q14,  q12
-        vadd.s32        q1,  q1,   q9
-        vshl.s32        q11, q15,  q12
-        vadd.s32        q2,  q2,   q10
-        vadd.s32        q3,  q3,   q11
-        subs            r2,  r2,   #16
-        bne             1b
-        b               3f
-
-2:      vld1.16         {d16-d17}, [r0]!
-        vld1.16         {d20-d21}, [r1,:128]!
-        vmlal.s16       q0,  d16,  d20
-        vld1.16         {d18-d19}, [r0]!
-        vmlal.s16       q1,  d17,  d21
-        vld1.16         {d22-d23}, [r1,:128]!
-        vmlal.s16       q2,  d18,  d22
-        vmlal.s16       q3,  d19,  d23
-        subs            r2,  r2,   #16
-        bne             2b
-
-3:      vpadd.s32       d16, d0,   d1
-        vpadd.s32       d17, d2,   d3
-        vpadd.s32       d10, d4,   d5
-        vpadd.s32       d11, d6,   d7
-        vpadd.s32       d0,  d16,  d17
-        vpadd.s32       d1,  d10,  d11
-        vpadd.s32       d2,  d0,   d1
-        vpaddl.s32      d3,  d2
-        vmov.32         r0,  d3[0]
-        bx              lr
-endfunc
-
-@ scalarproduct_and_madd_int16(/*aligned*/v0,v1,v2,order,mul)
-function ff_scalarproduct_and_madd_int16_neon, export=1
-        vld1.16         {d28[],d29[]}, [sp]
-        vmov.i16        q0,  #0
-        vmov.i16        q1,  #0
-        vmov.i16        q2,  #0
-        vmov.i16        q3,  #0
-        mov             r12, r0
-
-1:      vld1.16         {d16-d17}, [r0,:128]!
-        vld1.16         {d18-d19}, [r1]!
-        vld1.16         {d20-d21}, [r2]!
-        vld1.16         {d22-d23}, [r0,:128]!
-        vld1.16         {d24-d25}, [r1]!
-        vld1.16         {d26-d27}, [r2]!
-        vmul.s16        q10, q10,  q14
-        vmul.s16        q13, q13,  q14
-        vmlal.s16       q0,  d16,  d18
-        vmlal.s16       q1,  d17,  d19
-        vadd.s16        q10, q8,   q10
-        vadd.s16        q13, q11,  q13
-        vmlal.s16       q2,  d22,  d24
-        vmlal.s16       q3,  d23,  d25
-        vst1.16         {q10},     [r12,:128]!
-        subs            r3,  r3,   #16
-        vst1.16         {q13},     [r12,:128]!
-        bne             1b
-
-        vpadd.s32       d16, d0,   d1
-        vpadd.s32       d17, d2,   d3
-        vpadd.s32       d10, d4,   d5
-        vpadd.s32       d11, d6,   d7
-        vpadd.s32       d0,  d16,  d17
-        vpadd.s32       d1,  d10,  d11
-        vpadd.s32       d2,  d0,   d1
-        vpaddl.s32      d3,  d2
-        vmov.32         r0,  d3[0]
-        bx              lr
-endfunc
diff --git a/libavcodec/arm/jrevdct_arm.S b/libavcodec/arm/jrevdct_arm.S
deleted file mode 100644
index 4fcf351..0000000
--- a/libavcodec/arm/jrevdct_arm.S
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
-   C-like prototype :
-        void j_rev_dct_arm(DCTBLOCK data)
-
-   With DCTBLOCK being a pointer to an array of 64 'signed shorts'
-
-   Copyright (c) 2001 Lionel Ulmer (lionel.ulmer at free.fr / bbrox at bbrox.org)
-
-   Permission is hereby granted, free of charge, to any person obtaining a copy
-   of this software and associated documentation files (the "Software"), to deal
-   in the Software without restriction, including without limitation the rights
-   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-   copies of the Software, and to permit persons to whom the Software is
-   furnished to do so, subject to the following conditions:
-
-   The above copyright notice and this permission notice shall be included in
-   all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-   COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-   IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*/
-
-#include "asm.S"
-
-#define FIX_0_298631336 2446
-#define FIX_0_541196100 4433
-#define FIX_0_765366865 6270
-#define FIX_1_175875602 9633
-#define FIX_1_501321110 12299
-#define FIX_2_053119869 16819
-#define FIX_3_072711026 25172
-#define FIX_M_0_390180644 -3196
-#define FIX_M_0_899976223 -7373
-#define FIX_M_1_847759065 -15137
-#define FIX_M_1_961570560 -16069
-#define FIX_M_2_562915447 -20995
-#define FIX_0xFFFF 0xFFFF
-
-#define FIX_0_298631336_ID      0
-#define FIX_0_541196100_ID      4
-#define FIX_0_765366865_ID      8
-#define FIX_1_175875602_ID     12
-#define FIX_1_501321110_ID     16
-#define FIX_2_053119869_ID     20
-#define FIX_3_072711026_ID     24
-#define FIX_M_0_390180644_ID   28
-#define FIX_M_0_899976223_ID   32
-#define FIX_M_1_847759065_ID   36
-#define FIX_M_1_961570560_ID   40
-#define FIX_M_2_562915447_ID   44
-#define FIX_0xFFFF_ID          48
-        .text
-        .align
-
-function ff_j_rev_dct_arm, export=1
-        stmdb   sp!, { r4 - r12, lr }   @ all callee saved regs
-
-        sub sp, sp, #4                  @ reserve some space on the stack
-        str r0, [ sp ]                  @ save the DCT pointer to the stack
-
-        mov lr, r0                      @ lr = pointer to the current row
-        mov r12, #8                     @ r12 = row-counter
-        adr r11, const_array            @ r11 = base pointer to the constants array
-row_loop:
-        ldrsh r0, [lr, # 0]             @ r0 = 'd0'
-        ldrsh r2, [lr, # 2]             @ r2 = 'd2'
-
-        @ Optimization for row that have all items except the first set to 0
-        @ (this works as the DCTELEMS are always 4-byte aligned)
-        ldr r5, [lr, # 0]
-        ldr r6, [lr, # 4]
-        ldr r3, [lr, # 8]
-        ldr r4, [lr, #12]
-        orr r3, r3, r4
-        orr r3, r3, r6
-        orrs r5, r3, r5
-        beq end_of_row_loop             @ nothing to be done as ALL of them are '0'
-        orrs r3, r3, r2
-        beq empty_row
-
-        ldrsh r1, [lr, # 8]             @ r1 = 'd1'
-        ldrsh r4, [lr, # 4]             @ r4 = 'd4'
-        ldrsh r6, [lr, # 6]             @ r6 = 'd6'
-
-        ldr r3, [r11, #FIX_0_541196100_ID]
-        add r7, r2, r6
-        ldr r5, [r11, #FIX_M_1_847759065_ID]
-        mul r7, r3, r7                      @ r7 = z1
-        ldr r3, [r11, #FIX_0_765366865_ID]
-        mla r6, r5, r6, r7                  @ r6 = tmp2
-        add r5, r0, r4                      @ r5 = tmp0
-        mla r2, r3, r2, r7                  @ r2 = tmp3
-        sub r3, r0, r4                      @ r3 = tmp1
-
-        add r0, r2, r5, lsl #13             @ r0 = tmp10
-        rsb r2, r2, r5, lsl #13             @ r2 = tmp13
-        add r4, r6, r3, lsl #13             @ r4 = tmp11
-        rsb r3, r6, r3, lsl #13             @ r3 = tmp12
-
-        stmdb   sp!, { r0, r2, r3, r4 } @ save on the stack tmp10, tmp13, tmp12, tmp11
-
-        ldrsh r3, [lr, #10]             @ r3 = 'd3'
-        ldrsh r5, [lr, #12]             @ r5 = 'd5'
-        ldrsh r7, [lr, #14]             @ r7 = 'd7'
-
-        add r0, r3, r5                        @ r0 = 'z2'
-        add r2, r1, r7                  @ r2 = 'z1'
-        add r4, r3, r7                  @ r4 = 'z3'
-        add r6, r1, r5                  @ r6 = 'z4'
-        ldr r9, [r11, #FIX_1_175875602_ID]
-        add r8, r4, r6                  @ r8 = z3 + z4
-        ldr r10, [r11, #FIX_M_0_899976223_ID]
-        mul r8, r9, r8                  @ r8 = 'z5'
-        ldr r9, [r11, #FIX_M_2_562915447_ID]
-        mul r2, r10, r2                 @ r2 = 'z1'
-        ldr r10, [r11, #FIX_M_1_961570560_ID]
-        mul r0, r9, r0                  @ r0 = 'z2'
-        ldr r9, [r11, #FIX_M_0_390180644_ID]
-        mla r4, r10, r4, r8             @ r4 = 'z3'
-        ldr r10, [r11, #FIX_0_298631336_ID]
-        mla r6, r9, r6, r8              @ r6 = 'z4'
-        ldr r9, [r11, #FIX_2_053119869_ID]
-        mla r7, r10, r7, r2             @ r7 = tmp0 + z1
-        ldr r10, [r11, #FIX_3_072711026_ID]
-        mla r5, r9, r5, r0              @ r5 = tmp1 + z2
-        ldr r9, [r11, #FIX_1_501321110_ID]
-        mla r3, r10, r3, r0             @ r3 = tmp2 + z2
-        add r7, r7, r4                  @ r7 = tmp0
-        mla r1, r9, r1, r2              @ r1 = tmp3 + z1
-        add r5,        r5, r6                  @ r5 = tmp1
-        add r3, r3, r4                  @ r3 = tmp2
-        add r1, r1, r6                  @ r1 = tmp3
-
-        ldmia sp!, { r0, r2, r4, r6 } @ r0 = tmp10 / r2 = tmp13 / r4 = tmp12 / r6 = tmp11
-                                      @ r1 = tmp3  / r3 = tmp2  / r5 = tmp1  / r7 = tmp0
-
-        @ Compute DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS)
-        add r8, r0, r1
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, # 0]
-
-        @ Compute DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS)
-        sub r8, r0, r1
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, #14]
-
-        @ Compute DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS)
-        add r8, r6, r3
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, # 2]
-
-        @ Compute DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS)
-        sub r8, r6, r3
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, #12]
-
-        @ Compute DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS)
-        add r8, r4, r5
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, # 4]
-
-        @ Compute DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS)
-        sub r8, r4, r5
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, #10]
-
-        @ Compute DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS)
-        add r8, r2, r7
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, # 6]
-
-        @ Compute DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS)
-        sub r8, r2, r7
-        add r8, r8, #(1<<10)
-        mov r8, r8, asr #11
-        strh r8, [lr, # 8]
-
-        @ End of row loop
-        add lr, lr, #16
-        subs r12, r12, #1
-        bne row_loop
-        beq start_column_loop
-
-empty_row:
-        ldr r1, [r11, #FIX_0xFFFF_ID]
-        mov r0, r0, lsl #2
-        and r0, r0, r1
-        add r0, r0, r0, lsl #16
-        str r0, [lr, # 0]
-        str r0, [lr, # 4]
-        str r0, [lr, # 8]
-        str r0, [lr, #12]
-
-end_of_row_loop:
-        @ End of loop
-        add lr, lr, #16
-        subs r12, r12, #1
-        bne row_loop
-
-start_column_loop:
-        @ Start of column loop
-        ldr lr, [ sp ]
-        mov r12, #8
-column_loop:
-        ldrsh r0, [lr, #( 0*8)]             @ r0 = 'd0'
-        ldrsh r2, [lr, #( 4*8)]             @ r2 = 'd2'
-        ldrsh r4, [lr, #( 8*8)]             @ r4 = 'd4'
-        ldrsh r6, [lr, #(12*8)]             @ r6 = 'd6'
-
-        ldr r3, [r11, #FIX_0_541196100_ID]
-        add r1, r2, r6
-        ldr r5, [r11, #FIX_M_1_847759065_ID]
-        mul r1, r3, r1                      @ r1 = z1
-        ldr r3, [r11, #FIX_0_765366865_ID]
-        mla r6, r5, r6, r1                  @ r6 = tmp2
-        add r5, r0, r4                      @ r5 = tmp0
-        mla r2, r3, r2, r1                  @ r2 = tmp3
-        sub r3, r0, r4                      @ r3 = tmp1
-
-        add r0, r2, r5, lsl #13             @ r0 = tmp10
-        rsb r2, r2, r5, lsl #13             @ r2 = tmp13
-        add r4, r6, r3, lsl #13             @ r4 = tmp11
-        rsb r6, r6, r3, lsl #13             @ r6 = tmp12
-
-        ldrsh r1, [lr, #( 2*8)]             @ r1 = 'd1'
-        ldrsh r3, [lr, #( 6*8)]             @ r3 = 'd3'
-        ldrsh r5, [lr, #(10*8)]             @ r5 = 'd5'
-        ldrsh r7, [lr, #(14*8)]             @ r7 = 'd7'
-
-        @ Check for empty odd column (happens about 20 to 25 % of the time according to my stats)
-        orr r9, r1, r3
-        orr r10, r5, r7
-        orrs r10, r9, r10
-        beq empty_odd_column
-
-        stmdb   sp!, { r0, r2, r4, r6 } @ save on the stack tmp10, tmp13, tmp12, tmp11
-
-        add r0, r3, r5                  @ r0 = 'z2'
-        add r2, r1, r7                  @ r2 = 'z1'
-        add r4, r3, r7                  @ r4 = 'z3'
-        add r6, r1, r5                  @ r6 = 'z4'
-        ldr r9, [r11, #FIX_1_175875602_ID]
-        add r8, r4, r6
-        ldr r10, [r11, #FIX_M_0_899976223_ID]
-        mul r8, r9, r8                  @ r8 = 'z5'
-        ldr r9, [r11, #FIX_M_2_562915447_ID]
-        mul r2, r10, r2                 @ r2 = 'z1'
-        ldr r10, [r11, #FIX_M_1_961570560_ID]
-        mul r0, r9, r0                  @ r0 = 'z2'
-        ldr r9, [r11, #FIX_M_0_390180644_ID]
-        mla r4, r10, r4, r8             @ r4 = 'z3'
-        ldr r10, [r11, #FIX_0_298631336_ID]
-        mla r6, r9, r6, r8              @ r6 = 'z4'
-        ldr r9, [r11, #FIX_2_053119869_ID]
-        mla r7, r10, r7, r2             @ r7 = tmp0 + z1
-        ldr r10, [r11, #FIX_3_072711026_ID]
-        mla r5, r9, r5, r0              @ r5 = tmp1 + z2
-        ldr r9, [r11, #FIX_1_501321110_ID]
-        mla r3, r10, r3, r0             @ r3 = tmp2 + z2
-        add r7, r7, r4                  @ r7 = tmp0
-        mla r1, r9, r1, r2              @ r1 = tmp3 + z1
-        add r5,        r5, r6                  @ r5 = tmp1
-        add r3, r3, r4                  @ r3 = tmp2
-        add r1, r1, r6                  @ r1 = tmp3
-
-        ldmia sp!, { r0, r2, r4, r6 } @ r0 = tmp10 / r2 = tmp13 / r4 = tmp11 / r6 = tmp12
-                                      @ r1 = tmp3  / r3 = tmp2  / r5 = tmp1  / r7 = tmp0
-
-        @ Compute DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3)
-        add r8, r0, r1
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #( 0*8)]
-
-        @ Compute DESCALE(tmp10 - tmp3, CONST_BITS+PASS1_BITS+3)
-        sub r8, r0, r1
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #(14*8)]
-
-        @ Compute DESCALE(tmp11 + tmp2, CONST_BITS+PASS1_BITS+3)
-        add r8, r4, r3
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #( 2*8)]
-
-        @ Compute DESCALE(tmp11 - tmp2, CONST_BITS+PASS1_BITS+3)
-        sub r8, r4, r3
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #(12*8)]
-
-        @ Compute DESCALE(tmp12 + tmp1, CONST_BITS+PASS1_BITS+3)
-        add r8, r6, r5
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #( 4*8)]
-
-        @ Compute DESCALE(tmp12 - tmp1, CONST_BITS+PASS1_BITS+3)
-        sub r8, r6, r5
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #(10*8)]
-
-        @ Compute DESCALE(tmp13 + tmp0, CONST_BITS+PASS1_BITS+3)
-        add r8, r2, r7
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #( 6*8)]
-
-        @ Compute DESCALE(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3)
-        sub r8, r2, r7
-        add r8, r8, #(1<<17)
-        mov r8, r8, asr #18
-        strh r8, [lr, #( 8*8)]
-
-        @ End of row loop
-        add lr, lr, #2
-        subs r12, r12, #1
-        bne column_loop
-        beq the_end
-
-empty_odd_column:
-        @ Compute DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3)
-        @ Compute DESCALE(tmp10 - tmp3, CONST_BITS+PASS1_BITS+3)
-        add r0, r0, #(1<<17)
-        mov r0, r0, asr #18
-        strh r0, [lr, #( 0*8)]
-        strh r0, [lr, #(14*8)]
-
-        @ Compute DESCALE(tmp11 + tmp2, CONST_BITS+PASS1_BITS+3)
-        @ Compute DESCALE(tmp11 - tmp2, CONST_BITS+PASS1_BITS+3)
-        add r4, r4, #(1<<17)
-        mov r4, r4, asr #18
-        strh r4, [lr, #( 2*8)]
-        strh r4, [lr, #(12*8)]
-
-        @ Compute DESCALE(tmp12 + tmp1, CONST_BITS+PASS1_BITS+3)
-        @ Compute DESCALE(tmp12 - tmp1, CONST_BITS+PASS1_BITS+3)
-        add r6, r6, #(1<<17)
-        mov r6, r6, asr #18
-        strh r6, [lr, #( 4*8)]
-        strh r6, [lr, #(10*8)]
-
-        @ Compute DESCALE(tmp13 + tmp0, CONST_BITS+PASS1_BITS+3)
-        @ Compute DESCALE(tmp13 - tmp0, CONST_BITS+PASS1_BITS+3)
-        add r2, r2, #(1<<17)
-        mov r2, r2, asr #18
-        strh r2, [lr, #( 6*8)]
-        strh r2, [lr, #( 8*8)]
-
-        @ End of row loop
-        add lr, lr, #2
-        subs r12, r12, #1
-        bne column_loop
-
-the_end:
-        @ The end....
-        add sp, sp, #4
-        ldmia   sp!, { r4 - r12, pc }   @ restore callee saved regs and return
-
-const_array:
-        .align
-        .word FIX_0_298631336
-        .word FIX_0_541196100
-        .word FIX_0_765366865
-        .word FIX_1_175875602
-        .word FIX_1_501321110
-        .word FIX_2_053119869
-        .word FIX_3_072711026
-        .word FIX_M_0_390180644
-        .word FIX_M_0_899976223
-        .word FIX_M_1_847759065
-        .word FIX_M_1_961570560
-        .word FIX_M_2_562915447
-        .word FIX_0xFFFF
diff --git a/libavcodec/arm/mathops.h b/libavcodec/arm/mathops.h
deleted file mode 100644
index 2244fa1..0000000
--- a/libavcodec/arm/mathops.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * simple math operations
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ARM_MATHOPS_H
-#define AVCODEC_ARM_MATHOPS_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/common.h"
-
-#if HAVE_INLINE_ASM
-
-#   define MULL MULL
-static inline av_const int MULL(int a, int b, unsigned shift)
-{
-    int lo, hi;
-    __asm__("smull %0, %1, %2, %3     \n\t"
-            "mov   %0, %0,     lsr %4 \n\t"
-            "add   %1, %0, %1, lsl %5 \n\t"
-            : "=&r"(lo), "=&r"(hi)
-            : "r"(b), "r"(a), "ir"(shift), "ir"(32-shift));
-    return hi;
-}
-
-#define MULH MULH
-#if HAVE_ARMV6
-static inline av_const int MULH(int a, int b)
-{
-    int r;
-    __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
-    return r;
-}
-#else
-static inline av_const int MULH(int a, int b)
-{
-    int lo, hi;
-    __asm__ ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b), "r"(a));
-    return hi;
-}
-#endif
-
-static inline av_const int64_t MUL64(int a, int b)
-{
-    union { uint64_t x; unsigned hl[2]; } x;
-    __asm__ ("smull %0, %1, %2, %3"
-             : "=r"(x.hl[0]), "=r"(x.hl[1]) : "r"(a), "r"(b));
-    return x.x;
-}
-#define MUL64 MUL64
-
-static inline av_const int64_t MAC64(int64_t d, int a, int b)
-{
-    union { uint64_t x; unsigned hl[2]; } x = { d };
-    __asm__ ("smlal %0, %1, %2, %3"
-             : "+r"(x.hl[0]), "+r"(x.hl[1]) : "r"(a), "r"(b));
-    return x.x;
-}
-#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
-#define MLS64(d, a, b) MAC64(d, -(a), b)
-
-#if HAVE_ARMV5TE
-
-/* signed 16x16 -> 32 multiply add accumulate */
-#   define MAC16(rt, ra, rb)                                            \
-    __asm__ ("smlabb %0, %1, %2, %0" : "+r"(rt) : "r"(ra), "r"(rb));
-
-/* signed 16x16 -> 32 multiply */
-#   define MUL16 MUL16
-static inline av_const int MUL16(int ra, int rb)
-{
-    int rt;
-    __asm__ ("smulbb %0, %1, %2" : "=r"(rt) : "r"(ra), "r"(rb));
-    return rt;
-}
-
-#endif
-
-#define mid_pred mid_pred
-static inline av_const int mid_pred(int a, int b, int c)
-{
-    int m;
-    __asm__ volatile (
-        "mov   %0, %2  \n\t"
-        "cmp   %1, %2  \n\t"
-        "movgt %0, %1  \n\t"
-        "movgt %1, %2  \n\t"
-        "cmp   %1, %3  \n\t"
-        "movle %1, %3  \n\t"
-        "cmp   %0, %1  \n\t"
-        "movgt %0, %1  \n\t"
-        : "=&r"(m), "+r"(a)
-        : "r"(b), "r"(c));
-    return m;
-}
-
-#endif /* HAVE_INLINE_ASM */
-
-#endif /* AVCODEC_ARM_MATHOPS_H */
diff --git a/libavcodec/arm/mdct_neon.S b/libavcodec/arm/mdct_neon.S
deleted file mode 100644
index fac75be..0000000
--- a/libavcodec/arm/mdct_neon.S
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * ARM NEON optimised MDCT
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        preserve8
-
-        .text
-
-#define ff_fft_calc_neon X(ff_fft_calc_neon)
-
-function ff_imdct_half_neon, export=1
-        push            {r4-r8,lr}
-
-        mov             r12, #1
-        ldr             lr,  [r0, #28]          @ mdct_bits
-        ldr             r4,  [r0, #32]          @ tcos
-        ldr             r3,  [r0, #8]           @ revtab
-        lsl             r12, r12, lr            @ n  = 1 << nbits
-        lsr             lr,  r12, #2            @ n4 = n >> 2
-        add             r7,  r2,  r12,  lsl #1
-        mov             r12, #-16
-        sub             r7,  r7,  #16
-
-        vld2.32         {d16-d17},[r7,:128],r12 @ d16=x,n1 d17=x,n0
-        vld2.32         {d0-d1},  [r2,:128]!    @ d0 =m0,x d1 =m1,x
-        vrev64.32       d17, d17
-        vld2.32         {d2,d3},  [r4,:128]!    @ d2=c0,c1 d3=s0,s2
-        vmul.f32        d6,  d17, d2
-        vmul.f32        d7,  d0,  d2
-1:
-        subs            lr,  lr,  #2
-        ldr             r6,  [r3], #4
-        vmul.f32        d4,  d0,  d3
-        vmul.f32        d5,  d17, d3
-        vsub.f32        d4,  d6,  d4
-        vadd.f32        d5,  d5,  d7
-        uxth            r8,  r6,  ror #16
-        uxth            r6,  r6
-        add             r8,  r1,  r8,  lsl #3
-        add             r6,  r1,  r6,  lsl #3
-        beq             1f
-        vld2.32         {d16-d17},[r7,:128],r12
-        vld2.32         {d0-d1},  [r2,:128]!
-        vrev64.32       d17, d17
-        vld2.32         {d2,d3},  [r4,:128]!    @ d2=c0,c1 d3=s0,s2
-        vmul.f32        d6,  d17, d2
-        vmul.f32        d7,  d0,  d2
-        vst2.32         {d4[0],d5[0]}, [r6,:64]
-        vst2.32         {d4[1],d5[1]}, [r8,:64]
-        b               1b
-1:
-        vst2.32         {d4[0],d5[0]}, [r6,:64]
-        vst2.32         {d4[1],d5[1]}, [r8,:64]
-
-        mov             r4,  r0
-        mov             r6,  r1
-        bl              ff_fft_calc_neon
-
-        mov             r12, #1
-        ldr             lr,  [r4, #28]          @ mdct_bits
-        ldr             r4,  [r4, #32]          @ tcos
-        lsl             r12, r12, lr            @ n  = 1 << nbits
-        lsr             lr,  r12, #3            @ n8 = n >> 3
-
-        add             r4,  r4,  lr,  lsl #3
-        add             r6,  r6,  lr,  lsl #3
-        sub             r1,  r4,  #16
-        sub             r3,  r6,  #16
-
-        mov             r7,  #-16
-        mov             r8,  r6
-        mov             r0,  r3
-
-        vld2.32         {d0-d1},  [r3,:128], r7 @ d0 =i1,r1 d1 =i0,r0
-        vld2.32         {d20-d21},[r6,:128]!    @ d20=i2,r2 d21=i3,r3
-        vld2.32         {d16,d18},[r1,:128], r7 @ d16=c1,c0 d18=s1,s0
-1:
-        subs            lr,  lr,  #2
-        vmul.f32        d7,  d0,  d18
-        vld2.32         {d17,d19},[r4,:128]!    @ d17=c2,c3 d19=s2,s3
-        vmul.f32        d4,  d1,  d18
-        vmul.f32        d5,  d21, d19
-        vmul.f32        d6,  d20, d19
-        vmul.f32        d22, d1,  d16
-        vmul.f32        d23, d21, d17
-        vmul.f32        d24, d0,  d16
-        vmul.f32        d25, d20, d17
-        vadd.f32        d7,  d7,  d22
-        vadd.f32        d6,  d6,  d23
-        vsub.f32        d4,  d4,  d24
-        vsub.f32        d5,  d5,  d25
-        beq             1f
-        vld2.32         {d0-d1},  [r3,:128], r7
-        vld2.32         {d20-d21},[r6,:128]!
-        vld2.32         {d16,d18},[r1,:128], r7 @ d16=c1,c0 d18=s1,s0
-        vrev64.32       q3,  q3
-        vst2.32         {d4,d6},  [r0,:128], r7
-        vst2.32         {d5,d7},  [r8,:128]!
-        b               1b
-1:
-        vrev64.32       q3,  q3
-        vst2.32         {d4,d6},  [r0,:128]
-        vst2.32         {d5,d7},  [r8,:128]
-
-        pop             {r4-r8,pc}
-endfunc
-
-function ff_imdct_calc_neon, export=1
-        push            {r4-r6,lr}
-
-        ldr             r3,  [r0, #28]
-        mov             r4,  #1
-        mov             r5,  r1
-        lsl             r4,  r4,  r3
-        add             r1,  r1,  r4
-
-        bl              ff_imdct_half_neon
-
-        add             r0,  r5,  r4,  lsl #2
-        add             r1,  r5,  r4,  lsl #1
-        sub             r0,  r0,  #8
-        sub             r2,  r1,  #16
-        mov             r3,  #-16
-        mov             r6,  #-8
-        vmov.i32        d30, #1<<31
-1:
-        vld1.32         {d0-d1},  [r2,:128], r3
-        pld             [r0, #-16]
-        vrev64.32       q0,  q0
-        vld1.32         {d2-d3},  [r1,:128]!
-        veor            d4,  d1,  d30
-        pld             [r2, #-16]
-        vrev64.32       q1,  q1
-        veor            d5,  d0,  d30
-        vst1.32         {d2},     [r0,:64], r6
-        vst1.32         {d3},     [r0,:64], r6
-        vst1.32         {d4-d5},  [r5,:128]!
-        subs            r4,  r4,  #16
-        bgt             1b
-
-        pop             {r4-r6,pc}
-endfunc
-
-function ff_mdct_calc_neon, export=1
-        push            {r4-r10,lr}
-
-        mov             r12, #1
-        ldr             lr,  [r0, #28]          @ mdct_bits
-        ldr             r4,  [r0, #32]          @ tcos
-        ldr             r3,  [r0, #8]           @ revtab
-        lsl             lr,  r12, lr            @ n  = 1 << nbits
-        add             r7,  r2,  lr            @ in4u
-        sub             r9,  r7,  #16           @ in4d
-        add             r2,  r7,  lr,  lsl #1   @ in3u
-        add             r8,  r9,  lr,  lsl #1   @ in3d
-        add             r5,  r4,  lr,  lsl #1
-        sub             r5,  r5,  #16
-        sub             r3,  r3,  #4
-        mov             r12, #-16
-
-        vld2.32         {d16,d18},[r9,:128],r12 @ in0u0,in0u1 in4d1,in4d0
-        vld2.32         {d17,d19},[r8,:128],r12 @ in2u0,in2u1 in3d1,in3d0
-        vld2.32         {d0, d2}, [r7,:128]!    @ in4u0,in4u1 in2d1,in2d0
-        vrev64.32       q9,  q9                 @ in4d0,in4d1 in3d0,in3d1
-        vld2.32         {d1, d3}, [r2,:128]!    @ in3u0,in3u1 in1d1,in1d0
-        vsub.f32        d0,  d18, d0            @ in4d-in4u      I
-        vld2.32         {d20,d21},[r4,:128]!    @ c0,c1 s0,s1
-        vrev64.32       q1,  q1                 @ in2d0,in2d1 in1d0,in1d1
-        vld2.32         {d30,d31},[r5,:128],r12 @ c2,c3 s2,s3
-        vadd.f32        d1,  d1,  d19           @ in3u+in3d     -R
-        vsub.f32        d16, d16, d2            @ in0u-in2d      R
-        vadd.f32        d17, d17, d3            @ in2u+in1d     -I
-1:
-        vmul.f32        d7,  d0,  d21           @  I*s
-        ldr             r10, [r3, lr, lsr #1]
-        vmul.f32        d6,  d1,  d20           @ -R*c
-        ldr             r6,  [r3, #4]!
-        vmul.f32        d4,  d1,  d21           @ -R*s
-        vmul.f32        d5,  d0,  d20           @  I*c
-        vmul.f32        d24, d16, d30           @  R*c
-        vmul.f32        d25, d17, d31           @ -I*s
-        vmul.f32        d22, d16, d31           @  R*s
-        vmul.f32        d23, d17, d30           @  I*c
-        subs            lr,  lr,  #16
-        vsub.f32        d6,  d6,  d7            @ -R*c-I*s
-        vadd.f32        d7,  d4,  d5            @ -R*s+I*c
-        vsub.f32        d24, d25, d24           @ I*s-R*c
-        vadd.f32        d25, d22, d23           @ R*s-I*c
-        beq             1f
-        mov             r12, #-16
-        vld2.32         {d16,d18},[r9,:128],r12 @ in0u0,in0u1 in4d1,in4d0
-        vld2.32         {d17,d19},[r8,:128],r12 @ in2u0,in2u1 in3d1,in3d0
-        vneg.f32        d7,  d7                 @  R*s-I*c
-        vld2.32         {d0, d2}, [r7,:128]!    @ in4u0,in4u1 in2d1,in2d0
-        vrev64.32       q9,  q9                 @ in4d0,in4d1 in3d0,in3d1
-        vld2.32         {d1, d3}, [r2,:128]!    @ in3u0,in3u1 in1d1,in1d0
-        vsub.f32        d0,  d18, d0            @ in4d-in4u      I
-        vld2.32         {d20,d21},[r4,:128]!    @ c0,c1 s0,s1
-        vrev64.32       q1,  q1                 @ in2d0,in2d1 in1d0,in1d1
-        vld2.32         {d30,d31},[r5,:128],r12 @ c2,c3 s2,s3
-        vadd.f32        d1,  d1,  d19           @ in3u+in3d     -R
-        vsub.f32        d16, d16, d2            @ in0u-in2d      R
-        vadd.f32        d17, d17, d3            @ in2u+in1d     -I
-        uxth            r12, r6,  ror #16
-        uxth            r6,  r6
-        add             r12, r1,  r12, lsl #3
-        add             r6,  r1,  r6,  lsl #3
-        vst2.32         {d6[0],d7[0]}, [r6,:64]
-        vst2.32         {d6[1],d7[1]}, [r12,:64]
-        uxth            r6,  r10, ror #16
-        uxth            r10, r10
-        add             r6 , r1,  r6,  lsl #3
-        add             r10, r1,  r10, lsl #3
-        vst2.32         {d24[0],d25[0]},[r10,:64]
-        vst2.32         {d24[1],d25[1]},[r6,:64]
-        b               1b
-1:
-        vneg.f32        d7,  d7                 @  R*s-I*c
-        uxth            r12, r6,  ror #16
-        uxth            r6,  r6
-        add             r12, r1,  r12, lsl #3
-        add             r6,  r1,  r6,  lsl #3
-        vst2.32         {d6[0],d7[0]}, [r6,:64]
-        vst2.32         {d6[1],d7[1]}, [r12,:64]
-        uxth            r6,  r10, ror #16
-        uxth            r10, r10
-        add             r6 , r1,  r6,  lsl #3
-        add             r10, r1,  r10, lsl #3
-        vst2.32         {d24[0],d25[0]},[r10,:64]
-        vst2.32         {d24[1],d25[1]},[r6,:64]
-
-        mov             r4,  r0
-        mov             r6,  r1
-        bl              ff_fft_calc_neon
-
-        mov             r12, #1
-        ldr             lr,  [r4, #28]          @ mdct_bits
-        ldr             r4,  [r4, #32]          @ tcos
-        lsl             r12, r12, lr            @ n  = 1 << nbits
-        lsr             lr,  r12, #3            @ n8 = n >> 3
-
-        add             r4,  r4,  lr,  lsl #3
-        add             r6,  r6,  lr,  lsl #3
-        sub             r1,  r4,  #16
-        sub             r3,  r6,  #16
-
-        mov             r7,  #-16
-        mov             r8,  r6
-        mov             r0,  r3
-
-        vld2.32         {d0-d1},  [r3,:128], r7 @ d0 =r1,i1 d1 =r0,i0
-        vld2.32         {d20-d21},[r6,:128]!    @ d20=r2,i2 d21=r3,i3
-        vld2.32         {d16,d18},[r1,:128], r7 @ c1,c0 s1,s0
-1:
-        subs            lr,  lr,  #2
-        vmul.f32        d7,  d0,  d18           @ r1*s1,r0*s0
-        vld2.32         {d17,d19},[r4,:128]!    @ c2,c3 s2,s3
-        vmul.f32        d4,  d1,  d18           @ i1*s1,i0*s0
-        vmul.f32        d5,  d21, d19           @ i2*s2,i3*s3
-        vmul.f32        d6,  d20, d19           @ r2*s2,r3*s3
-        vmul.f32        d24, d0,  d16           @ r1*c1,r0*c0
-        vmul.f32        d25, d20, d17           @ r2*c2,r3*c3
-        vmul.f32        d22, d21, d17           @ i2*c2,i3*c3
-        vmul.f32        d23, d1,  d16           @ i1*c1,i0*c0
-        vadd.f32        d4,  d4,  d24           @ i1*s1+r1*c1,i0*s0+r0*c0
-        vadd.f32        d5,  d5,  d25           @ i2*s2+r2*c2,i3*s3+r3*c3
-        vsub.f32        d6,  d22, d6            @ i2*c2-r2*s2,i3*c3-r3*s3
-        vsub.f32        d7,  d23, d7            @ i1*c1-r1*s1,i0*c0-r0*s0
-        vneg.f32        q2,  q2
-        beq             1f
-        vld2.32         {d0-d1},  [r3,:128], r7
-        vld2.32         {d20-d21},[r6,:128]!
-        vld2.32         {d16,d18},[r1,:128], r7 @ c1,c0 s1,s0
-        vrev64.32       q3,  q3
-        vst2.32         {d4,d6},  [r0,:128], r7
-        vst2.32         {d5,d7},  [r8,:128]!
-        b               1b
-1:
-        vrev64.32       q3,  q3
-        vst2.32         {d4,d6},  [r0,:128]
-        vst2.32         {d5,d7},  [r8,:128]
-
-        pop             {r4-r10,pc}
-endfunc
diff --git a/libavcodec/arm/mpegvideo_arm.c b/libavcodec/arm/mpegvideo_arm.c
deleted file mode 100644
index 06eacdf..0000000
--- a/libavcodec/arm/mpegvideo_arm.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2002 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "mpegvideo_arm.h"
-
-void MPV_common_init_arm(MpegEncContext *s)
-{
-    /* IWMMXT support is a superset of armv5te, so
-     * allow optimized functions for armv5te unless
-     * a better iwmmxt function exists
-     */
-#if HAVE_ARMV5TE
-    MPV_common_init_armv5te(s);
-#endif
-#if HAVE_IWMMXT
-    MPV_common_init_iwmmxt(s);
-#endif
-}
diff --git a/libavcodec/arm/mpegvideo_arm.h b/libavcodec/arm/mpegvideo_arm.h
deleted file mode 100644
index 4cc25fd..0000000
--- a/libavcodec/arm/mpegvideo_arm.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ARM_MPEGVIDEO_H
-#define AVCODEC_ARM_MPEGVIDEO_H
-
-#include "libavcodec/mpegvideo.h"
-
-void MPV_common_init_iwmmxt(MpegEncContext *s);
-void MPV_common_init_armv5te(MpegEncContext *s);
-
-#endif
diff --git a/libavcodec/arm/mpegvideo_armv5te.c b/libavcodec/arm/mpegvideo_armv5te.c
deleted file mode 100644
index 1d383ca..0000000
--- a/libavcodec/arm/mpegvideo_armv5te.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Optimization of some functions from mpegvideo.c for armv5te
- * Copyright (c) 2007 Siarhei Siamashka <ssvb at users.sourceforge.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "mpegvideo_arm.h"
-
-void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int count);
-
-#ifdef ENABLE_ARM_TESTS
-/**
- * h263 dequantizer supplementary function, it is performance critical and needs to
- * have optimized implementations for each architecture. Is also used as a reference
- * implementation in regression tests
- */
-static inline void dct_unquantize_h263_helper_c(DCTELEM *block, int qmul, int qadd, int count)
-{
-    int i, level;
-    for (i = 0; i < count; i++) {
-        level = block[i];
-        if (level) {
-            if (level < 0) {
-                level = level * qmul - qadd;
-            } else {
-                level = level * qmul + qadd;
-            }
-            block[i] = level;
-        }
-    }
-}
-#endif
-
-static void dct_unquantize_h263_intra_armv5te(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    int level, qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    qmul = qscale << 1;
-
-    if (!s->h263_aic) {
-        if (n < 4)
-            level = block[0] * s->y_dc_scale;
-        else
-            level = block[0] * s->c_dc_scale;
-        qadd = (qscale - 1) | 1;
-    }else{
-        qadd = 0;
-        level = block[0];
-    }
-    if(s->ac_pred)
-        nCoeffs=63;
-    else
-        nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
-    block[0] = level;
-}
-
-static void dct_unquantize_h263_inter_armv5te(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    int qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    qadd = (qscale - 1) | 1;
-    qmul = qscale << 1;
-
-    nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    ff_dct_unquantize_h263_armv5te(block, qmul, qadd, nCoeffs + 1);
-}
-
-void MPV_common_init_armv5te(MpegEncContext *s)
-{
-    s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_armv5te;
-    s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_armv5te;
-}
diff --git a/libavcodec/arm/mpegvideo_armv5te_s.S b/libavcodec/arm/mpegvideo_armv5te_s.S
deleted file mode 100644
index c8cb2c6..0000000
--- a/libavcodec/arm/mpegvideo_armv5te_s.S
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Optimization of some functions from mpegvideo.c for armv5te
- * Copyright (c) 2007 Siarhei Siamashka <ssvb at users.sourceforge.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "asm.S"
-
-/*
- * Special optimized version of dct_unquantize_h263_helper_c, it
- * requires the block to be at least 8 bytes aligned, and may process
- * more elements than requested.  But it is guaranteed to never
- * process more than 64 elements provided that count argument is <= 64,
- * so it is safe. This function is optimized for a common distribution
- * of values for nCoeffs (they are mostly multiple of 8 plus one or
- * two extra elements). So this function processes data as 8 elements
- * per loop iteration and contains optional 2 elements processing in
- * the end.
- *
- * Inner loop should take 6 cycles per element on arm926ej-s (Nokia 770)
- */
-function ff_dct_unquantize_h263_armv5te, export=1
-        push            {r4-r9,lr}
-        mov             ip, #0
-        subs            r3, r3, #2
-        ble             2f
-        ldrd            r4, [r0, #0]
-1:
-        ldrd            r6, [r0, #8]
-
-        rsbs            r9, ip, r4, asr #16
-        addgt           r9, r2, #0
-        rsblt           r9, r2, #0
-        smlatbne        r9, r4, r1, r9
-
-        rsbs            lr, ip, r5, asr #16
-        addgt           lr, r2, #0
-        rsblt           lr, r2, #0
-        smlatbne        lr, r5, r1, lr
-
-        rsbs            r8, ip, r4, asl #16
-        addgt           r8, r2, #0
-        rsblt           r8, r2, #0
-        smlabbne        r4, r4, r1, r8
-
-        rsbs            r8, ip, r5, asl #16
-        addgt           r8, r2, #0
-        rsblt           r8, r2, #0
-        smlabbne        r5, r5, r1, r8
-
-        strh            r4, [r0], #2
-        strh            r9, [r0], #2
-        strh            r5, [r0], #2
-        strh            lr, [r0], #2
-
-        rsbs            r9, ip, r6, asr #16
-        addgt           r9, r2, #0
-        rsblt           r9, r2, #0
-        smlatbne        r9, r6, r1, r9
-
-        rsbs            lr, ip, r7, asr #16
-        addgt           lr, r2, #0
-        rsblt           lr, r2, #0
-        smlatbne        lr, r7, r1, lr
-
-        rsbs            r8, ip, r6, asl #16
-        addgt           r8, r2, #0
-        rsblt           r8, r2, #0
-        smlabbne        r6, r6, r1, r8
-
-        rsbs            r8, ip, r7, asl #16
-        addgt           r8, r2, #0
-        rsblt           r8, r2, #0
-        smlabbne        r7, r7, r1, r8
-
-        strh            r6, [r0], #2
-        strh            r9, [r0], #2
-        strh            r7, [r0], #2
-        strh            lr, [r0], #2
-
-        subs            r3, r3, #8
-        ldrgtd          r4, [r0, #0] /* load data early to avoid load/use pipeline stall */
-        bgt             1b
-
-        adds            r3, r3, #2
-        pople           {r4-r9,pc}
-2:
-        ldrsh           r9, [r0, #0]
-        ldrsh           lr, [r0, #2]
-        mov             r8, r2
-        cmp             r9, #0
-        rsblt           r8, r2, #0
-        smlabbne        r9, r9, r1, r8
-        mov             r8, r2
-        cmp             lr, #0
-        rsblt           r8, r2, #0
-        smlabbne        lr, lr, r1, r8
-        strh            r9, [r0], #2
-        strh            lr, [r0], #2
-        pop             {r4-r9,pc}
-endfunc
diff --git a/libavcodec/arm/mpegvideo_iwmmxt.c b/libavcodec/arm/mpegvideo_iwmmxt.c
deleted file mode 100644
index 9e3878f..0000000
--- a/libavcodec/arm/mpegvideo_iwmmxt.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * copyright (c) 2004 AGAWA Koji
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "mpegvideo_arm.h"
-
-static void dct_unquantize_h263_intra_iwmmxt(MpegEncContext *s,
-                                             DCTELEM *block, int n, int qscale)
-{
-    int level, qmul, qadd;
-    int nCoeffs;
-    DCTELEM *block_orig = block;
-
-    assert(s->block_last_index[n]>=0);
-
-    qmul = qscale << 1;
-
-    if (!s->h263_aic) {
-        if (n < 4)
-            level = block[0] * s->y_dc_scale;
-        else
-            level = block[0] * s->c_dc_scale;
-        qadd = (qscale - 1) | 1;
-    }else{
-        qadd = 0;
-        level = block[0];
-    }
-    if(s->ac_pred)
-        nCoeffs=63;
-    else
-        nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    __asm__ volatile (
-/*      "movd %1, %%mm6                 \n\t" //qmul */
-/*      "packssdw %%mm6, %%mm6          \n\t" */
-/*      "packssdw %%mm6, %%mm6          \n\t" */
-        "tbcsth wr6, %[qmul]            \n\t"
-/*      "movd %2, %%mm5                 \n\t" //qadd */
-/*      "packssdw %%mm5, %%mm5          \n\t" */
-/*      "packssdw %%mm5, %%mm5          \n\t" */
-        "tbcsth wr5, %[qadd]            \n\t"
-        "wzero wr7                      \n\t" /* "pxor %%mm7, %%mm7             \n\t" */
-        "wzero wr4                      \n\t" /* "pxor %%mm4, %%mm4             \n\t" */
-        "wsubh wr7, wr5, wr7            \n\t" /* "psubw %%mm5, %%mm7            \n\t" */
-        "1:                             \n\t"
-        "wldrd wr2, [%[block]]          \n\t" /* "movq (%0, %3), %%mm0          \n\t" */
-        "wldrd wr3, [%[block], #8]      \n\t" /* "movq 8(%0, %3), %%mm1         \n\t" */
-        "wmulsl wr0, wr6, wr2           \n\t" /* "pmullw %%mm6, %%mm0           \n\t" */
-        "wmulsl wr1, wr6, wr3           \n\t" /* "pmullw %%mm6, %%mm1           \n\t" */
-/*      "movq (%0, %3), %%mm2           \n\t" */
-/*      "movq 8(%0, %3), %%mm3          \n\t" */
-        "wcmpgtsh wr2, wr4, wr2         \n\t" /* "pcmpgtw %%mm4, %%mm2          \n\t" // block[i] < 0 ? -1 : 0 */
-        "wcmpgtsh wr3, wr4, wr2         \n\t" /* "pcmpgtw %%mm4, %%mm3          \n\t" // block[i] < 0 ? -1 : 0 */
-        "wxor wr0, wr2, wr0             \n\t" /* "pxor %%mm2, %%mm0             \n\t" */
-        "wxor wr1, wr3, wr1             \n\t" /* "pxor %%mm3, %%mm1             \n\t" */
-        "waddh wr0, wr7, wr0            \n\t" /* "paddw %%mm7, %%mm0            \n\t" */
-        "waddh wr1, wr7, wr1            \n\t" /* "paddw %%mm7, %%mm1            \n\t" */
-        "wxor wr2, wr0, wr2             \n\t" /* "pxor %%mm0, %%mm2             \n\t" */
-        "wxor wr3, wr1, wr3             \n\t" /* "pxor %%mm1, %%mm3             \n\t" */
-        "wcmpeqh wr0, wr7, wr0          \n\t" /* "pcmpeqw %%mm7, %%mm0          \n\t" // block[i] == 0 ? -1 : 0 */
-        "wcmpeqh wr1, wr7, wr1          \n\t" /* "pcmpeqw %%mm7, %%mm1          \n\t" // block[i] == 0 ? -1 : 0 */
-        "wandn wr0, wr2, wr0            \n\t" /* "pandn %%mm2, %%mm0            \n\t" */
-        "wandn wr1, wr3, wr1            \n\t" /* "pandn %%mm3, %%mm1            \n\t" */
-        "wstrd wr0, [%[block]]          \n\t" /* "movq %%mm0, (%0, %3)          \n\t" */
-        "wstrd wr1, [%[block], #8]      \n\t" /* "movq %%mm1, 8(%0, %3)         \n\t" */
-        "add %[block], %[block], #16    \n\t" /* "addl $16, %3                  \n\t" */
-        "subs %[i], %[i], #1            \n\t"
-        "bne 1b                         \n\t" /* "jng 1b                                \n\t" */
-        :[block]"+r"(block)
-        :[i]"r"((nCoeffs + 8) / 8), [qmul]"r"(qmul), [qadd]"r"(qadd)
-        :"memory");
-
-    block_orig[0] = level;
-}
-
-#if 0
-static void dct_unquantize_h263_inter_iwmmxt(MpegEncContext *s,
-                                             DCTELEM *block, int n, int qscale)
-{
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    if(s->ac_pred)
-        nCoeffs=63;
-    else
-        nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    ippiQuantInvInter_Compact_H263_16s_I(block, nCoeffs+1, qscale);
-}
-#endif
-
-void MPV_common_init_iwmmxt(MpegEncContext *s)
-{
-    if (!(mm_flags & FF_MM_IWMMXT)) return;
-
-    s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_iwmmxt;
-#if 0
-    s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_iwmmxt;
-#endif
-}
diff --git a/libavcodec/arm/rdft_neon.S b/libavcodec/arm/rdft_neon.S
deleted file mode 100644
index 4f8a103..0000000
--- a/libavcodec/arm/rdft_neon.S
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * ARM NEON optimised RDFT
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        preserve8
-
-function ff_rdft_calc_neon, export=1
-        push            {r4-r8,lr}
-
-        ldr             r6,  [r0, #4]           @ inverse
-        mov             r4,  r0
-        mov             r5,  r1
-
-        lsls            r6,  r6,  #31
-        bne             1f
-        add             r0,  r4,  #20
-        bl              X(ff_fft_permute_neon)
-        add             r0,  r4,  #20
-        mov             r1,  r5
-        bl              X(ff_fft_calc_neon)
-1:
-        ldr             r12, [r4, #0]           @ nbits
-        mov             r2,  #1
-        lsl             r12, r2,  r12
-        add             r0,  r5,  #8
-        add             r1,  r5,  r12, lsl #2
-        lsr             r12, r12, #2
-        ldr             r2,  [r4, #12]          @ tcos
-        sub             r12, r12, #2
-        ldr             r3,  [r4, #16]          @ tsin
-        mov             r7,  r0
-        sub             r1,  r1,  #8
-        mov             lr,  r1
-        mov             r8,  #-8
-        vld1.32         {d0},     [r0,:64]!     @ d1[0,1]
-        vld1.32         {d1},     [r1,:64], r8  @ d2[0,1]
-        vld1.32         {d4},     [r2,:64]!     @ tcos[i]
-        vld1.32         {d5},     [r3,:64]!     @ tsin[i]
-        vmov.f32        d18, #0.5               @ k1
-        vdup.32         d19, r6
-        pld             [r0, #32]
-        veor            d19, d18, d19           @ k2
-        vmov.i32        d16, #0
-        vmov.i32        d17, #1<<31
-        pld             [r1, #-32]
-        vtrn.32         d16, d17
-        pld             [r2, #32]
-        vrev64.32       d16, d16                @ d16=1,0 d17=0,1
-        pld             [r3, #32]
-2:
-        veor            q1,  q0,  q8            @ -d1[0],d1[1], d2[0],-d2[1]
-        vld1.32         {d24},    [r0,:64]!     @  d1[0,1]
-        vadd.f32        d0,  d0,  d3            @  d1[0]+d2[0], d1[1]-d2[1]
-        vld1.32         {d25},    [r1,:64], r8  @  d2[0,1]
-        vadd.f32        d1,  d2,  d1            @ -d1[0]+d2[0], d1[1]+d2[1]
-        veor            q3,  q12, q8            @ -d1[0],d1[1], d2[0],-d2[1]
-        pld             [r0, #32]
-        vmul.f32        q10, q0,  q9            @  ev.re, ev.im, od.im, od.re
-        pld             [r1, #-32]
-        vadd.f32        d0,  d24, d7            @  d1[0]+d2[0], d1[1]-d2[1]
-        vadd.f32        d1,  d6,  d25           @ -d1[0]+d2[0], d1[1]+d2[1]
-        vmul.f32        q11, q0,  q9            @  ev.re, ev.im, od.im, od.re
-        veor            d7,  d21, d16           @ -od.im, od.re
-        vrev64.32       d3,  d21                @  od.re, od.im
-        veor            d6,  d20, d17           @  ev.re,-ev.im
-        veor            d2,  d3,  d16           @ -od.re, od.im
-        vmla.f32        d20, d3,  d4[1]
-        vmla.f32        d20, d7,  d5[1]
-        vmla.f32        d6,  d2,  d4[1]
-        vmla.f32        d6,  d21, d5[1]
-        vld1.32         {d4},     [r2,:64]!     @  tcos[i]
-        veor            d7,  d23, d16           @ -od.im, od.re
-        vld1.32         {d5},     [r3,:64]!     @  tsin[i]
-        veor            d24, d22, d17           @  ev.re,-ev.im
-        vrev64.32       d3,  d23                @  od.re, od.im
-        pld             [r2, #32]
-        veor            d2,  d3,  d16           @ -od.re, od.im
-        pld             [r3, #32]
-        vmla.f32        d22, d3,  d4[0]
-        vmla.f32        d22, d7,  d5[0]
-        vmla.f32        d24, d2,  d4[0]
-        vmla.f32        d24, d23, d5[0]
-        vld1.32         {d0},     [r0,:64]!     @  d1[0,1]
-        vld1.32         {d1},     [r1,:64], r8  @  d2[0,1]
-        vst1.32         {d20},    [r7,:64]!
-        vst1.32         {d6},     [lr,:64], r8
-        vst1.32         {d22},    [r7,:64]!
-        vst1.32         {d24},    [lr,:64], r8
-        subs            r12, r12, #2
-        bgt             2b
-
-        veor            q1,  q0,  q8            @ -d1[0],d1[1], d2[0],-d2[1]
-        vadd.f32        d0,  d0,  d3            @  d1[0]+d2[0], d1[1]-d2[1]
-        vadd.f32        d1,  d2,  d1            @ -d1[0]+d2[0], d1[1]+d2[1]
-        ldr             r2,  [r4, #8]           @  sign_convention
-        vmul.f32        q10, q0,  q9            @  ev.re, ev.im, od.im, od.re
-        add             r0,  r0,  #4
-        bfc             r2,  #0,  #31
-        vld1.32         {d0[0]},  [r0,:32]
-        veor            d7,  d21, d16           @ -od.im, od.re
-        vrev64.32       d3,  d21                @  od.re, od.im
-        veor            d6,  d20, d17           @  ev.re,-ev.im
-        vld1.32         {d22},    [r5,:64]
-        vdup.32         d1,  r2
-        vmov            d23, d22
-        veor            d2,  d3,  d16           @ -od.re, od.im
-        vtrn.32         d22, d23
-        veor            d0,  d0,  d1
-        veor            d23, d23, d17
-        vmla.f32        d20, d3,  d4[1]
-        vmla.f32        d20, d7,  d5[1]
-        vmla.f32        d6,  d2,  d4[1]
-        vmla.f32        d6,  d21, d5[1]
-        vadd.f32        d22, d22, d23
-        vst1.32         {d20},    [r7,:64]
-        vst1.32         {d6},     [lr,:64]
-        vst1.32         {d0[0]},  [r0,:32]
-        vst1.32         {d22},    [r5,:64]
-
-        cmp             r6,  #0
-        popeq           {r4-r8,pc}
-
-        vmul.f32        d22, d22, d18
-        vst1.32         {d22},    [r5,:64]
-        add             r0,  r4,  #20
-        mov             r1,  r5
-        bl              X(ff_fft_permute_neon)
-        add             r0,  r4,  #20
-        mov             r1,  r5
-        pop             {r4-r8,lr}
-        b               X(ff_fft_calc_neon)
-endfunc
diff --git a/libavcodec/arm/simple_idct_arm.S b/libavcodec/arm/simple_idct_arm.S
deleted file mode 100644
index ecb83d2..0000000
--- a/libavcodec/arm/simple_idct_arm.S
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- * simple_idct_arm.S
- * Copyright (C) 2002 Frederic 'dilb' Boulay
- *
- * Author: Frederic Boulay <dilb at handhelds.org>
- *
- * The function defined in this file is derived from the simple_idct function
- * from the libavcodec library part of the FFmpeg project.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-/* useful constants for the algorithm, they are save in __constant_ptr__ at */
-/* the end of the source code.*/
-#define W1  22725
-#define W2  21407
-#define W3  19266
-#define W4  16383
-#define W5  12873
-#define W6  8867
-#define W7  4520
-#define MASK_MSHW 0xFFFF0000
-
-/* offsets of the constants in the vector */
-#define offW1  0
-#define offW2  4
-#define offW3  8
-#define offW4  12
-#define offW5  16
-#define offW6  20
-#define offW7  24
-#define offMASK_MSHW 28
-
-#define ROW_SHIFT 11
-#define ROW_SHIFT2MSHW (16-11)
-#define COL_SHIFT 20
-#define ROW_SHIFTED_1 1024 /* 1<< (ROW_SHIFT-1) */
-#define COL_SHIFTED_1 524288 /* 1<< (COL_SHIFT-1) */
-
-
-        .text
-
-function ff_simple_idct_arm, export=1
-        @@ void simple_idct_arm(int16_t *block)
-        @@ save stack for reg needed (take all of them),
-        @@ R0-R3 are scratch regs, so no need to save them, but R0 contains the pointer to block
-        @@ so it must not be overwritten, if it is not saved!!
-        @@ R12 is another scratch register, so it should not be saved too
-        @@ save all registers
-        stmfd sp!, {r4-r11, r14} @ R14 is also called LR
-        @@ at this point, R0=block, other registers are free.
-        add r14, r0, #112        @ R14=&block[8*7], better start from the last row, and decrease the value until row=0, i.e. R12=block.
-        adr r12, __constant_ptr__ @ R12=__constant_ptr__, the vector containing the constants, probably not necessary to reserve a register for it
-        @@ add 2 temporary variables in the stack: R0 and R14
-        sub sp, sp, #8          @ allow 2 local variables
-        str r0, [sp, #0]        @ save block in sp[0]
-        @@ stack status
-        @@ sp+4   free
-        @@ sp+0   R0  (block)
-
-
-        @@ at this point, R0=block, R14=&block[56], R12=__const_ptr_, R1-R11 free
-
-
-__row_loop:
-        @@ read the row and check if it is null, almost null, or not, according to strongarm specs, it is not necessary to optimize ldr accesses (i.e. split 32bits in 2 16bits words), at least it gives more usable registers :)
-        ldr r1, [r14, #0]        @ R1=(int32)(R12)[0]=ROWr32[0] (relative row cast to a 32b pointer)
-        ldr r2, [r14, #4]        @ R2=(int32)(R12)[1]=ROWr32[1]
-        ldr r3, [r14, #8]        @ R3=ROWr32[2]
-        ldr r4, [r14, #12]       @ R4=ROWr32[3]
-        @@ check if the words are null, if all of them are null, then proceed with next row (branch __end_row_loop),
-        @@ if ROWr16[0] is the only one not null, then proceed with this special case (branch __almost_empty_row)
-        @@ else follow the complete algorithm.
-        @@ at this point, R0=block, R14=&block[n], R12=__const_ptr_, R1=ROWr32[0], R2=ROWr32[1],
-        @@                R3=ROWr32[2], R4=ROWr32[3], R5-R11 free
-        orr r5, r4, r3           @ R5=R4 | R3
-        orr r5, r5, r2           @ R5=R4 | R3 | R2
-        orrs r6, r5, r1          @ Test R5 | R1 (the aim is to check if everything is null)
-        beq __end_row_loop
-        mov r7, r1, asr #16      @ R7=R1>>16=ROWr16[1] (evaluate it now, as it could be useful later)
-        ldrsh r6, [r14, #0]      @ R6=ROWr16[0]
-        orrs r5, r5, r7          @ R5=R4 | R3 | R2 | R7
-        beq __almost_empty_row
-
-__b_evaluation:
-        @@ at this point, R0=block (temp),  R1(free), R2=ROWr32[1], R3=ROWr32[2], R4=ROWr32[3],
-        @@     R5=(temp), R6=ROWr16[0], R7=ROWr16[1], R8-R11 free,
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ to save some registers/calls, proceed with b0-b3 first, followed by a0-a3
-
-        @@ MUL16(b0, W1, row[1]);
-        @@ MUL16(b1, W3, row[1]);
-        @@ MUL16(b2, W5, row[1]);
-        @@ MUL16(b3, W7, row[1]);
-        @@ MAC16(b0, W3, row[3]);
-        @@ MAC16(b1, -W7, row[3]);
-        @@ MAC16(b2, -W1, row[3]);
-        @@ MAC16(b3, -W5, row[3]);
-        ldr r8, [r12, #offW1]    @ R8=W1
-        mov r2, r2, asr #16      @ R2=ROWr16[3]
-        mul r0, r8, r7           @ R0=W1*ROWr16[1]=b0 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-        ldr r9, [r12, #offW3]    @ R9=W3
-        ldr r10, [r12, #offW5]   @ R10=W5
-        mul r1, r9, r7           @ R1=W3*ROWr16[1]=b1 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-        ldr r11, [r12, #offW7]   @ R11=W7
-        mul r5, r10, r7          @ R5=W5*ROWr16[1]=b2 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-        mul r7, r11, r7          @ R7=W7*ROWr16[1]=b3 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-                teq r2, #0               @ if null avoid muls
-                mlane r0, r9, r2, r0     @ R0+=W3*ROWr16[3]=b0 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-        rsbne r2, r2, #0         @ R2=-ROWr16[3]
-        mlane r1, r11, r2, r1    @ R1-=W7*ROWr16[3]=b1 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-        mlane r5, r8, r2, r5     @ R5-=W1*ROWr16[3]=b2 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-        mlane r7, r10, r2, r7    @ R7-=W5*ROWr16[3]=b3 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-
-        @@ at this point, R0=b0,  R1=b1, R2 (free), R3=ROWr32[2], R4=ROWr32[3],
-        @@     R5=b2, R6=ROWr16[0], R7=b3, R8=W1, R9=W3, R10=W5, R11=W7,
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
-        @@ if (temp != 0) {}
-        orrs r2, r3, r4          @ R2=ROWr32[2] | ROWr32[3]
-        beq __end_b_evaluation
-
-        @@ at this point, R0=b0,  R1=b1, R2 (free), R3=ROWr32[2], R4=ROWr32[3],
-        @@     R5=b2, R6=ROWr16[0], R7=b3, R8=W1, R9=W3, R10=W5, R11=W7,
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ MAC16(b0, W5, row[5]);
-        @@ MAC16(b2, W7, row[5]);
-        @@ MAC16(b3, W3, row[5]);
-        @@ MAC16(b1, -W1, row[5]);
-        @@ MAC16(b0, W7, row[7]);
-        @@ MAC16(b2, W3, row[7]);
-        @@ MAC16(b3, -W1, row[7]);
-        @@ MAC16(b1, -W5, row[7]);
-        mov r3, r3, asr #16      @ R3=ROWr16[5]
-                teq r3, #0               @ if null avoid muls
-        mlane r0, r10, r3, r0    @ R0+=W5*ROWr16[5]=b0
-        mov r4, r4, asr #16      @ R4=ROWr16[7]
-        mlane r5, r11, r3, r5    @ R5+=W7*ROWr16[5]=b2
-        mlane r7, r9, r3, r7     @ R7+=W3*ROWr16[5]=b3
-        rsbne r3, r3, #0         @ R3=-ROWr16[5]
-        mlane r1, r8, r3, r1     @ R7-=W1*ROWr16[5]=b1
-        @@ R3 is free now
-                teq r4, #0               @ if null avoid muls
-        mlane r0, r11, r4, r0    @ R0+=W7*ROWr16[7]=b0
-        mlane r5, r9, r4, r5     @ R5+=W3*ROWr16[7]=b2
-        rsbne r4, r4, #0         @ R4=-ROWr16[7]
-        mlane r7, r8, r4, r7     @ R7-=W1*ROWr16[7]=b3
-        mlane r1, r10, r4, r1    @ R1-=W5*ROWr16[7]=b1
-        @@ R4 is free now
-__end_b_evaluation:
-        @@ at this point, R0=b0,  R1=b1, R2=ROWr32[2] | ROWr32[3] (tmp), R3 (free), R4 (free),
-        @@     R5=b2, R6=ROWr16[0], R7=b3, R8 (free), R9 (free), R10 (free), R11 (free),
-        @@     R12=__const_ptr_, R14=&block[n]
-
-__a_evaluation:
-        @@ a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
-        @@ a1 = a0 + W6 * row[2];
-        @@ a2 = a0 - W6 * row[2];
-        @@ a3 = a0 - W2 * row[2];
-        @@ a0 = a0 + W2 * row[2];
-        ldr r9, [r12, #offW4]    @ R9=W4
-        mul r6, r9, r6           @ R6=W4*ROWr16[0]
-        ldr r10, [r12, #offW6]   @ R10=W6
-        ldrsh r4, [r14, #4]      @ R4=ROWr16[2] (a3 not defined yet)
-        add r6, r6, #ROW_SHIFTED_1 @ R6=W4*ROWr16[0] + 1<<(ROW_SHIFT-1) (a0)
-
-        mul r11, r10, r4         @ R11=W6*ROWr16[2]
-        ldr r8, [r12, #offW2]    @ R8=W2
-        sub r3, r6, r11          @ R3=a0-W6*ROWr16[2] (a2)
-        @@ temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
-        @@ if (temp != 0) {}
-        teq r2, #0
-        beq __end_bef_a_evaluation
-
-        add r2, r6, r11          @ R2=a0+W6*ROWr16[2] (a1)
-        mul r11, r8, r4          @ R11=W2*ROWr16[2]
-        sub r4, r6, r11          @ R4=a0-W2*ROWr16[2] (a3)
-        add r6, r6, r11          @ R6=a0+W2*ROWr16[2] (a0)
-
-
-        @@ at this point, R0=b0,  R1=b1, R2=a1, R3=a2, R4=a3,
-        @@     R5=b2, R6=a0, R7=b3, R8=W2, R9=W4, R10=W6, R11 (free),
-        @@     R12=__const_ptr_, R14=&block[n]
-
-
-        @@ a0 += W4*row[4]
-        @@ a1 -= W4*row[4]
-        @@ a2 -= W4*row[4]
-        @@ a3 += W4*row[4]
-        ldrsh r11, [r14, #8]     @ R11=ROWr16[4]
-                teq r11, #0              @ if null avoid muls
-        mulne r11, r9, r11       @ R11=W4*ROWr16[4]
-        @@ R9 is free now
-        ldrsh r9, [r14, #12]     @ R9=ROWr16[6]
-        addne r6, r6, r11        @ R6+=W4*ROWr16[4] (a0)
-        subne r2, r2, r11        @ R2-=W4*ROWr16[4] (a1)
-        subne r3, r3, r11        @ R3-=W4*ROWr16[4] (a2)
-        addne r4, r4, r11        @ R4+=W4*ROWr16[4] (a3)
-        @@ W6 alone is no more useful, save W2*ROWr16[6] in it instead
-                teq r9, #0               @ if null avoid muls
-        mulne r11, r10, r9       @ R11=W6*ROWr16[6]
-        addne r6, r6, r11        @ R6+=W6*ROWr16[6] (a0)
-        mulne r10, r8, r9        @ R10=W2*ROWr16[6]
-        @@ a0 += W6*row[6];
-        @@ a3 -= W6*row[6];
-        @@ a1 -= W2*row[6];
-        @@ a2 += W2*row[6];
-        subne r4, r4, r11        @ R4-=W6*ROWr16[6] (a3)
-        subne r2, r2, r10        @ R2-=W2*ROWr16[6] (a1)
-        addne r3, r3, r10        @ R3+=W2*ROWr16[6] (a2)
-
-__end_a_evaluation:
-        @@ at this point, R0=b0,  R1=b1, R2=a1, R3=a2, R4=a3,
-        @@     R5=b2, R6=a0, R7=b3, R8 (free), R9 (free), R10 (free), R11 (free),
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ row[0] = (a0 + b0) >> ROW_SHIFT;
-        @@ row[1] = (a1 + b1) >> ROW_SHIFT;
-        @@ row[2] = (a2 + b2) >> ROW_SHIFT;
-        @@ row[3] = (a3 + b3) >> ROW_SHIFT;
-        @@ row[4] = (a3 - b3) >> ROW_SHIFT;
-        @@ row[5] = (a2 - b2) >> ROW_SHIFT;
-        @@ row[6] = (a1 - b1) >> ROW_SHIFT;
-        @@ row[7] = (a0 - b0) >> ROW_SHIFT;
-        add r8, r6, r0           @ R8=a0+b0
-        add r9, r2, r1           @ R9=a1+b1
-        @@ put 2 16 bits half-words in a 32bits word
-        @@ ROWr32[0]=ROWr16[0] | (ROWr16[1]<<16) (only Little Endian compliant then!!!)
-        ldr r10, [r12, #offMASK_MSHW] @ R10=0xFFFF0000
-        and r9, r10, r9, lsl #ROW_SHIFT2MSHW @ R9=0xFFFF0000 & ((a1+b1)<<5)
-        mvn r11, r10             @ R11= NOT R10= 0x0000FFFF
-        and r8, r11, r8, asr #ROW_SHIFT @ R8=0x0000FFFF & ((a0+b0)>>11)
-        orr r8, r8, r9
-        str r8, [r14, #0]
-
-        add r8, r3, r5           @ R8=a2+b2
-        add r9, r4, r7           @ R9=a3+b3
-        and r9, r10, r9, lsl #ROW_SHIFT2MSHW @ R9=0xFFFF0000 & ((a3+b3)<<5)
-        and r8, r11, r8, asr #ROW_SHIFT @ R8=0x0000FFFF & ((a2+b2)>>11)
-        orr r8, r8, r9
-        str r8, [r14, #4]
-
-        sub r8, r4, r7           @ R8=a3-b3
-        sub r9, r3, r5           @ R9=a2-b2
-        and r9, r10, r9, lsl #ROW_SHIFT2MSHW @ R9=0xFFFF0000 & ((a2-b2)<<5)
-        and r8, r11, r8, asr #ROW_SHIFT @ R8=0x0000FFFF & ((a3-b3)>>11)
-        orr r8, r8, r9
-        str r8, [r14, #8]
-
-        sub r8, r2, r1           @ R8=a1-b1
-        sub r9, r6, r0           @ R9=a0-b0
-        and r9, r10, r9, lsl #ROW_SHIFT2MSHW @ R9=0xFFFF0000 & ((a0-b0)<<5)
-        and r8, r11, r8, asr #ROW_SHIFT @ R8=0x0000FFFF & ((a1-b1)>>11)
-        orr r8, r8, r9
-        str r8, [r14, #12]
-
-        bal __end_row_loop
-
-__almost_empty_row:
-        @@ the row was empty, except ROWr16[0], now, management of this special case
-        @@ at this point, R0=block, R14=&block[n], R12=__const_ptr_, R1=ROWr32[0], R2=ROWr32[1],
-        @@                R3=ROWr32[2], R4=ROWr32[3], R5=(temp), R6=ROWr16[0], R7=ROWr16[1],
-        @@                R8=0xFFFF (temp), R9-R11 free
-        mov r8, #0x10000         @ R8=0xFFFF (2 steps needed!) it saves a ldr call (because of delay run).
-        sub r8, r8, #1           @ R8 is now ready.
-        and r5, r8, r6, lsl #3   @ R5=R8 & (R6<<3)= (ROWr16[0]<<3) & 0xFFFF
-        orr r5, r5, r5, lsl #16  @ R5=R5 | (R5<<16)
-        str r5, [r14, #0]        @ R14[0]=ROWr32[0]=R5
-        str r5, [r14, #4]        @ R14[4]=ROWr32[1]=R5
-        str r5, [r14, #8]        @ R14[8]=ROWr32[2]=R5
-        str r5, [r14, #12]       @ R14[12]=ROWr32[3]=R5
-
-__end_row_loop:
-        @@ at this point, R0-R11 (free)
-        @@     R12=__const_ptr_, R14=&block[n]
-        ldr r0, [sp, #0]         @ R0=block
-        teq r0, r14              @ compare current &block[8*n] to block, when block is reached, the loop is finished.
-        sub r14, r14, #16
-        bne __row_loop
-
-
-
-        @@ at this point, R0=block, R1-R11 (free)
-        @@     R12=__const_ptr_, R14=&block[n]
-        add r14, r0, #14        @ R14=&block[7], better start from the last col, and decrease the value until col=0, i.e. R14=block.
-__col_loop:
-
-__b_evaluation2:
-        @@ at this point, R0=block (temp),  R1-R11 (free)
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ proceed with b0-b3 first, followed by a0-a3
-        @@ MUL16(b0, W1, col[8x1]);
-        @@ MUL16(b1, W3, col[8x1]);
-        @@ MUL16(b2, W5, col[8x1]);
-        @@ MUL16(b3, W7, col[8x1]);
-        @@ MAC16(b0, W3, col[8x3]);
-        @@ MAC16(b1, -W7, col[8x3]);
-        @@ MAC16(b2, -W1, col[8x3]);
-        @@ MAC16(b3, -W5, col[8x3]);
-        ldr r8, [r12, #offW1]    @ R8=W1
-        ldrsh r7, [r14, #16]
-        mul r0, r8, r7           @ R0=W1*ROWr16[1]=b0 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-        ldr r9, [r12, #offW3]    @ R9=W3
-        ldr r10, [r12, #offW5]   @ R10=W5
-        mul r1, r9, r7           @ R1=W3*ROWr16[1]=b1 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-        ldr r11, [r12, #offW7]   @ R11=W7
-        mul r5, r10, r7          @ R5=W5*ROWr16[1]=b2 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-        ldrsh r2, [r14, #48]
-        mul r7, r11, r7          @ R7=W7*ROWr16[1]=b3 (ROWr16[1] must be the second arg, to have the possibility to save 1 cycle)
-        teq r2, #0               @ if 0, then avoid muls
-        mlane r0, r9, r2, r0     @ R0+=W3*ROWr16[3]=b0 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-        rsbne r2, r2, #0         @ R2=-ROWr16[3]
-        mlane r1, r11, r2, r1    @ R1-=W7*ROWr16[3]=b1 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-        mlane r5, r8, r2, r5     @ R5-=W1*ROWr16[3]=b2 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-        mlane r7, r10, r2, r7    @ R7-=W5*ROWr16[3]=b3 (ROWr16[3] must be the second arg, to have the possibility to save 1 cycle)
-
-        @@ at this point, R0=b0,  R1=b1, R2 (free), R3 (free), R4 (free),
-        @@     R5=b2, R6 (free), R7=b3, R8=W1, R9=W3, R10=W5, R11=W7,
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ MAC16(b0, W5, col[5x8]);
-        @@ MAC16(b2, W7, col[5x8]);
-        @@ MAC16(b3, W3, col[5x8]);
-        @@ MAC16(b1, -W1, col[5x8]);
-        @@ MAC16(b0, W7, col[7x8]);
-        @@ MAC16(b2, W3, col[7x8]);
-        @@ MAC16(b3, -W1, col[7x8]);
-        @@ MAC16(b1, -W5, col[7x8]);
-        ldrsh r3, [r14, #80]     @ R3=COLr16[5x8]
-        teq r3, #0               @ if 0 then avoid muls
-        mlane r0, r10, r3, r0    @ R0+=W5*ROWr16[5x8]=b0
-        mlane r5, r11, r3, r5    @ R5+=W7*ROWr16[5x8]=b2
-        mlane r7, r9, r3, r7     @ R7+=W3*ROWr16[5x8]=b3
-        rsbne r3, r3, #0         @ R3=-ROWr16[5x8]
-        ldrsh r4, [r14, #112]    @ R4=COLr16[7x8]
-        mlane r1, r8, r3, r1     @ R7-=W1*ROWr16[5x8]=b1
-        @@ R3 is free now
-        teq r4, #0               @ if 0 then avoid muls
-        mlane r0, r11, r4, r0    @ R0+=W7*ROWr16[7x8]=b0
-        mlane r5, r9, r4, r5     @ R5+=W3*ROWr16[7x8]=b2
-        rsbne r4, r4, #0         @ R4=-ROWr16[7x8]
-        mlane r7, r8, r4, r7     @ R7-=W1*ROWr16[7x8]=b3
-        mlane r1, r10, r4, r1    @ R1-=W5*ROWr16[7x8]=b1
-        @@ R4 is free now
-__end_b_evaluation2:
-        @@ at this point, R0=b0,  R1=b1, R2 (free), R3 (free), R4 (free),
-        @@     R5=b2, R6 (free), R7=b3, R8 (free), R9 (free), R10 (free), R11 (free),
-        @@     R12=__const_ptr_, R14=&block[n]
-
-__a_evaluation2:
-        @@ a0 = (W4 * col[8x0]) + (1 << (COL_SHIFT - 1));
-        @@ a1 = a0 + W6 * row[2];
-        @@ a2 = a0 - W6 * row[2];
-        @@ a3 = a0 - W2 * row[2];
-        @@ a0 = a0 + W2 * row[2];
-        ldrsh r6, [r14, #0]
-        ldr r9, [r12, #offW4]    @ R9=W4
-        mul r6, r9, r6           @ R6=W4*ROWr16[0]
-        ldr r10, [r12, #offW6]   @ R10=W6
-        ldrsh r4, [r14, #32]     @ R4=ROWr16[2] (a3 not defined yet)
-        add r6, r6, #COL_SHIFTED_1 @ R6=W4*ROWr16[0] + 1<<(COL_SHIFT-1) (a0)
-        mul r11, r10, r4         @ R11=W6*ROWr16[2]
-        ldr r8, [r12, #offW2]    @ R8=W2
-        add r2, r6, r11          @ R2=a0+W6*ROWr16[2] (a1)
-        sub r3, r6, r11          @ R3=a0-W6*ROWr16[2] (a2)
-        mul r11, r8, r4          @ R11=W2*ROWr16[2]
-        sub r4, r6, r11          @ R4=a0-W2*ROWr16[2] (a3)
-        add r6, r6, r11          @ R6=a0+W2*ROWr16[2] (a0)
-
-        @@ at this point, R0=b0,  R1=b1, R2=a1, R3=a2, R4=a3,
-        @@     R5=b2, R6=a0, R7=b3, R8=W2, R9=W4, R10=W6, R11 (free),
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ a0 += W4*row[4]
-        @@ a1 -= W4*row[4]
-        @@ a2 -= W4*row[4]
-        @@ a3 += W4*row[4]
-        ldrsh r11, [r14, #64]    @ R11=ROWr16[4]
-        teq r11, #0              @ if null avoid muls
-        mulne r11, r9, r11       @ R11=W4*ROWr16[4]
-        @@ R9 is free now
-        addne r6, r6, r11        @ R6+=W4*ROWr16[4] (a0)
-        subne r2, r2, r11        @ R2-=W4*ROWr16[4] (a1)
-        subne r3, r3, r11        @ R3-=W4*ROWr16[4] (a2)
-        ldrsh r9, [r14, #96]     @ R9=ROWr16[6]
-        addne r4, r4, r11        @ R4+=W4*ROWr16[4] (a3)
-        @@ W6 alone is no more useful, save W2*ROWr16[6] in it instead
-        teq r9, #0               @ if null avoid muls
-        mulne r11, r10, r9       @ R11=W6*ROWr16[6]
-        addne r6, r6, r11        @ R6+=W6*ROWr16[6] (a0)
-        mulne r10, r8, r9        @ R10=W2*ROWr16[6]
-        @@ a0 += W6*row[6];
-        @@ a3 -= W6*row[6];
-        @@ a1 -= W2*row[6];
-        @@ a2 += W2*row[6];
-        subne r4, r4, r11        @ R4-=W6*ROWr16[6] (a3)
-        subne r2, r2, r10        @ R2-=W2*ROWr16[6] (a1)
-        addne r3, r3, r10        @ R3+=W2*ROWr16[6] (a2)
-__end_a_evaluation2:
-        @@ at this point, R0=b0,  R1=b1, R2=a1, R3=a2, R4=a3,
-        @@     R5=b2, R6=a0, R7=b3, R8 (free), R9 (free), R10 (free), R11 (free),
-        @@     R12=__const_ptr_, R14=&block[n]
-        @@ col[0 ] = ((a0 + b0) >> COL_SHIFT);
-        @@ col[8 ] = ((a1 + b1) >> COL_SHIFT);
-        @@ col[16] = ((a2 + b2) >> COL_SHIFT);
-        @@ col[24] = ((a3 + b3) >> COL_SHIFT);
-        @@ col[32] = ((a3 - b3) >> COL_SHIFT);
-        @@ col[40] = ((a2 - b2) >> COL_SHIFT);
-        @@ col[48] = ((a1 - b1) >> COL_SHIFT);
-        @@ col[56] = ((a0 - b0) >> COL_SHIFT);
-        @@@@@ no optimization here @@@@@
-        add r8, r6, r0           @ R8=a0+b0
-        add r9, r2, r1           @ R9=a1+b1
-        mov r8, r8, asr #COL_SHIFT
-        mov r9, r9, asr #COL_SHIFT
-        strh r8, [r14, #0]
-        strh r9, [r14, #16]
-        add r8, r3, r5           @ R8=a2+b2
-        add r9, r4, r7           @ R9=a3+b3
-        mov r8, r8, asr #COL_SHIFT
-        mov r9, r9, asr #COL_SHIFT
-        strh r8, [r14, #32]
-        strh r9, [r14, #48]
-        sub r8, r4, r7           @ R8=a3-b3
-        sub r9, r3, r5           @ R9=a2-b2
-        mov r8, r8, asr #COL_SHIFT
-        mov r9, r9, asr #COL_SHIFT
-        strh r8, [r14, #64]
-        strh r9, [r14, #80]
-        sub r8, r2, r1           @ R8=a1-b1
-        sub r9, r6, r0           @ R9=a0-b0
-        mov r8, r8, asr #COL_SHIFT
-        mov r9, r9, asr #COL_SHIFT
-        strh r8, [r14, #96]
-        strh r9, [r14, #112]
-
-__end_col_loop:
-        @@ at this point, R0-R11 (free)
-        @@     R12=__const_ptr_, R14=&block[n]
-        ldr r0, [sp, #0]         @ R0=block
-        teq r0, r14              @ compare current &block[n] to block, when block is reached, the loop is finished.
-        sub r14, r14, #2
-        bne __col_loop
-
-
-
-
-__end_simple_idct_arm:
-        @@ restore registers to previous status!
-        add sp, sp, #8 @@ the local variables!
-        ldmfd sp!, {r4-r11, r15} @@ update PC with LR content.
-
-
-
-@@ kind of sub-function, here not to overload the common case.
-__end_bef_a_evaluation:
-        add r2, r6, r11          @ R2=a0+W6*ROWr16[2] (a1)
-        mul r11, r8, r4          @ R11=W2*ROWr16[2]
-        sub r4, r6, r11          @ R4=a0-W2*ROWr16[2] (a3)
-        add r6, r6, r11          @ R6=a0+W2*ROWr16[2] (a0)
-        bal __end_a_evaluation
-
-
-__constant_ptr__:  @@ see #defines at the beginning of the source code for values.
-        .align
-        .word   W1
-        .word   W2
-        .word   W3
-        .word   W4
-        .word   W5
-        .word   W6
-        .word   W7
-        .word   MASK_MSHW
diff --git a/libavcodec/arm/simple_idct_armv5te.S b/libavcodec/arm/simple_idct_armv5te.S
deleted file mode 100644
index 27aeca4..0000000
--- a/libavcodec/arm/simple_idct_armv5te.S
+++ /dev/null
@@ -1,703 +0,0 @@
-/*
- * Simple IDCT
- *
- * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2006 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-#define W1  22725   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W2  21407   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W3  19266   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W4  16383   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W5  12873   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W6  8867    /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W7  4520    /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define ROW_SHIFT 11
-#define COL_SHIFT 20
-
-#define W13 (W1 | (W3 << 16))
-#define W26 (W2 | (W6 << 16))
-#define W57 (W5 | (W7 << 16))
-
-        .text
-        .align
-w13:    .long W13
-w26:    .long W26
-w57:    .long W57
-
-function idct_row_armv5te
-        str    lr, [sp, #-4]!
-
-        ldrd   v1, [a1, #8]
-        ldrd   a3, [a1]              /* a3 = row[1:0], a4 = row[3:2] */
-        orrs   v1, v1, v2
-        cmpeq  v1, a4
-        cmpeq  v1, a3, lsr #16
-        beq    row_dc_only
-
-        mov    v1, #(1<<(ROW_SHIFT-1))
-        mov    ip, #16384
-        sub    ip, ip, #1            /* ip = W4 */
-        smlabb v1, ip, a3, v1        /* v1 = W4*row[0]+(1<<(RS-1)) */
-        ldr    ip, w26               /* ip = W2 | (W6 << 16) */
-        smultb a2, ip, a4
-        smulbb lr, ip, a4
-        add    v2, v1, a2
-        sub    v3, v1, a2
-        sub    v4, v1, lr
-        add    v1, v1, lr
-
-        ldr    ip, w13               /* ip = W1 | (W3 << 16) */
-        ldr    lr, w57               /* lr = W5 | (W7 << 16) */
-        smulbt v5, ip, a3
-        smultt v6, lr, a4
-        smlatt v5, ip, a4, v5
-        smultt a2, ip, a3
-        smulbt v7, lr, a3
-        sub    v6, v6, a2
-        smulbt a2, ip, a4
-        smultt fp, lr, a3
-        sub    v7, v7, a2
-        smulbt a2, lr, a4
-        ldrd   a3, [a1, #8]          /* a3=row[5:4] a4=row[7:6] */
-        sub    fp, fp, a2
-
-        orrs   a2, a3, a4
-        beq    1f
-
-        smlabt v5, lr, a3, v5
-        smlabt v6, ip, a3, v6
-        smlatt v5, lr, a4, v5
-        smlabt v6, lr, a4, v6
-        smlatt v7, lr, a3, v7
-        smlatt fp, ip, a3, fp
-        smulbt a2, ip, a4
-        smlatt v7, ip, a4, v7
-        sub    fp, fp, a2
-
-        ldr    ip, w26               /* ip = W2 | (W6 << 16) */
-        mov    a2, #16384
-        sub    a2, a2, #1            /* a2 =  W4 */
-        smulbb a2, a2, a3            /* a2 =  W4*row[4] */
-        smultb lr, ip, a4            /* lr =  W6*row[6] */
-        add    v1, v1, a2            /* v1 += W4*row[4] */
-        add    v1, v1, lr            /* v1 += W6*row[6] */
-        add    v4, v4, a2            /* v4 += W4*row[4] */
-        sub    v4, v4, lr            /* v4 -= W6*row[6] */
-        smulbb lr, ip, a4            /* lr =  W2*row[6] */
-        sub    v2, v2, a2            /* v2 -= W4*row[4] */
-        sub    v2, v2, lr            /* v2 -= W2*row[6] */
-        sub    v3, v3, a2            /* v3 -= W4*row[4] */
-        add    v3, v3, lr            /* v3 += W2*row[6] */
-
-1:      add    a2, v1, v5
-        mov    a3, a2, lsr #11
-        bic    a3, a3, #0x1f0000
-        sub    a2, v2, v6
-        mov    a2, a2, lsr #11
-        add    a3, a3, a2, lsl #16
-        add    a2, v3, v7
-        mov    a4, a2, lsr #11
-        bic    a4, a4, #0x1f0000
-        add    a2, v4, fp
-        mov    a2, a2, lsr #11
-        add    a4, a4, a2, lsl #16
-        strd   a3, [a1]
-
-        sub    a2, v4, fp
-        mov    a3, a2, lsr #11
-        bic    a3, a3, #0x1f0000
-        sub    a2, v3, v7
-        mov    a2, a2, lsr #11
-        add    a3, a3, a2, lsl #16
-        add    a2, v2, v6
-        mov    a4, a2, lsr #11
-        bic    a4, a4, #0x1f0000
-        sub    a2, v1, v5
-        mov    a2, a2, lsr #11
-        add    a4, a4, a2, lsl #16
-        strd   a3, [a1, #8]
-
-        ldr    pc, [sp], #4
-
-row_dc_only:
-        orr    a3, a3, a3, lsl #16
-        bic    a3, a3, #0xe000
-        mov    a3, a3, lsl #3
-        mov    a4, a3
-        strd   a3, [a1]
-        strd   a3, [a1, #8]
-
-        ldr    pc, [sp], #4
-endfunc
-
-        .macro idct_col
-        ldr    a4, [a1]              /* a4 = col[1:0] */
-        mov    ip, #16384
-        sub    ip, ip, #1            /* ip = W4 */
-#if 0
-        mov    v1, #(1<<(COL_SHIFT-1))
-        smlabt v2, ip, a4, v1        /* v2 = W4*col[1] + (1<<(COL_SHIFT-1)) */
-        smlabb v1, ip, a4, v1        /* v1 = W4*col[0] + (1<<(COL_SHIFT-1)) */
-        ldr    a4, [a1, #(16*4)]
-#else
-        mov    v1, #((1<<(COL_SHIFT-1))/W4) /* this matches the C version */
-        add    v2, v1, a4, asr #16
-        rsb    v2, v2, v2, lsl #14
-        mov    a4, a4, lsl #16
-        add    v1, v1, a4, asr #16
-        ldr    a4, [a1, #(16*4)]
-        rsb    v1, v1, v1, lsl #14
-#endif
-
-        smulbb lr, ip, a4
-        smulbt a3, ip, a4
-        sub    v3, v1, lr
-        sub    v5, v1, lr
-        add    v7, v1, lr
-        add    v1, v1, lr
-        sub    v4, v2, a3
-        sub    v6, v2, a3
-        add    fp, v2, a3
-        ldr    ip, w26
-        ldr    a4, [a1, #(16*2)]
-        add    v2, v2, a3
-
-        smulbb lr, ip, a4
-        smultb a3, ip, a4
-        add    v1, v1, lr
-        sub    v7, v7, lr
-        add    v3, v3, a3
-        sub    v5, v5, a3
-        smulbt lr, ip, a4
-        smultt a3, ip, a4
-        add    v2, v2, lr
-        sub    fp, fp, lr
-        add    v4, v4, a3
-        ldr    a4, [a1, #(16*6)]
-        sub    v6, v6, a3
-
-        smultb lr, ip, a4
-        smulbb a3, ip, a4
-        add    v1, v1, lr
-        sub    v7, v7, lr
-        sub    v3, v3, a3
-        add    v5, v5, a3
-        smultt lr, ip, a4
-        smulbt a3, ip, a4
-        add    v2, v2, lr
-        sub    fp, fp, lr
-        sub    v4, v4, a3
-        add    v6, v6, a3
-
-        stmfd  sp!, {v1, v2, v3, v4, v5, v6, v7, fp}
-
-        ldr    ip, w13
-        ldr    a4, [a1, #(16*1)]
-        ldr    lr, w57
-        smulbb v1, ip, a4
-        smultb v3, ip, a4
-        smulbb v5, lr, a4
-        smultb v7, lr, a4
-        smulbt v2, ip, a4
-        smultt v4, ip, a4
-        smulbt v6, lr, a4
-        smultt fp, lr, a4
-        rsb    v4, v4, #0
-        ldr    a4, [a1, #(16*3)]
-        rsb    v3, v3, #0
-
-        smlatb v1, ip, a4, v1
-        smlatb v3, lr, a4, v3
-        smulbb a3, ip, a4
-        smulbb a2, lr, a4
-        sub    v5, v5, a3
-        sub    v7, v7, a2
-        smlatt v2, ip, a4, v2
-        smlatt v4, lr, a4, v4
-        smulbt a3, ip, a4
-        smulbt a2, lr, a4
-        sub    v6, v6, a3
-        ldr    a4, [a1, #(16*5)]
-        sub    fp, fp, a2
-
-        smlabb v1, lr, a4, v1
-        smlabb v3, ip, a4, v3
-        smlatb v5, lr, a4, v5
-        smlatb v7, ip, a4, v7
-        smlabt v2, lr, a4, v2
-        smlabt v4, ip, a4, v4
-        smlatt v6, lr, a4, v6
-        ldr    a3, [a1, #(16*7)]
-        smlatt fp, ip, a4, fp
-
-        smlatb v1, lr, a3, v1
-        smlabb v3, lr, a3, v3
-        smlatb v5, ip, a3, v5
-        smulbb a4, ip, a3
-        smlatt v2, lr, a3, v2
-        sub    v7, v7, a4
-        smlabt v4, lr, a3, v4
-        smulbt a4, ip, a3
-        smlatt v6, ip, a3, v6
-        sub    fp, fp, a4
-        .endm
-
-function idct_col_armv5te
-        str    lr, [sp, #-4]!
-
-        idct_col
-
-        ldmfd  sp!, {a3, a4}
-        adds   a2, a3, v1
-        mov    a2, a2, lsr #20
-        orrmi  a2, a2, #0xf000
-        add    ip, a4, v2
-        mov    ip, ip, asr #20
-        orr    a2, a2, ip, lsl #16
-        str    a2, [a1]
-        subs   a3, a3, v1
-        mov    a2, a3, lsr #20
-        orrmi  a2, a2, #0xf000
-        sub    a4, a4, v2
-        mov    a4, a4, asr #20
-        orr    a2, a2, a4, lsl #16
-        ldmfd  sp!, {a3, a4}
-        str    a2, [a1, #(16*7)]
-
-        subs   a2, a3, v3
-        mov    a2, a2, lsr #20
-        orrmi  a2, a2, #0xf000
-        sub    ip, a4, v4
-        mov    ip, ip, asr #20
-        orr    a2, a2, ip, lsl #16
-        str    a2, [a1, #(16*1)]
-        adds   a3, a3, v3
-        mov    a2, a3, lsr #20
-        orrmi  a2, a2, #0xf000
-        add    a4, a4, v4
-        mov    a4, a4, asr #20
-        orr    a2, a2, a4, lsl #16
-        ldmfd  sp!, {a3, a4}
-        str    a2, [a1, #(16*6)]
-
-        adds   a2, a3, v5
-        mov    a2, a2, lsr #20
-        orrmi  a2, a2, #0xf000
-        add    ip, a4, v6
-        mov    ip, ip, asr #20
-        orr    a2, a2, ip, lsl #16
-        str    a2, [a1, #(16*2)]
-        subs   a3, a3, v5
-        mov    a2, a3, lsr #20
-        orrmi  a2, a2, #0xf000
-        sub    a4, a4, v6
-        mov    a4, a4, asr #20
-        orr    a2, a2, a4, lsl #16
-        ldmfd  sp!, {a3, a4}
-        str    a2, [a1, #(16*5)]
-
-        adds   a2, a3, v7
-        mov    a2, a2, lsr #20
-        orrmi  a2, a2, #0xf000
-        add    ip, a4, fp
-        mov    ip, ip, asr #20
-        orr    a2, a2, ip, lsl #16
-        str    a2, [a1, #(16*3)]
-        subs   a3, a3, v7
-        mov    a2, a3, lsr #20
-        orrmi  a2, a2, #0xf000
-        sub    a4, a4, fp
-        mov    a4, a4, asr #20
-        orr    a2, a2, a4, lsl #16
-        str    a2, [a1, #(16*4)]
-
-        ldr    pc, [sp], #4
-endfunc
-
-function idct_col_put_armv5te
-        str    lr, [sp, #-4]!
-
-        idct_col
-
-        ldmfd  sp!, {a3, a4}
-        ldr    lr, [sp, #32]
-        add    a2, a3, v1
-        movs   a2, a2, asr #20
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        add    ip, a4, v2
-        movs   ip, ip, asr #20
-        movmi  ip, #0
-        cmp    ip, #255
-        movgt  ip, #255
-        orr    a2, a2, ip, lsl #8
-        sub    a3, a3, v1
-        movs   a3, a3, asr #20
-        movmi  a3, #0
-        cmp    a3, #255
-        movgt  a3, #255
-        sub    a4, a4, v2
-        movs   a4, a4, asr #20
-        movmi  a4, #0
-        cmp    a4, #255
-        ldr    v1, [sp, #28]
-        movgt  a4, #255
-        strh   a2, [v1]
-        add    a2, v1, #2
-        str    a2, [sp, #28]
-        orr    a2, a3, a4, lsl #8
-        rsb    v2, lr, lr, lsl #3
-        ldmfd  sp!, {a3, a4}
-        strh   a2, [v2, v1]!
-
-        sub    a2, a3, v3
-        movs   a2, a2, asr #20
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        sub    ip, a4, v4
-        movs   ip, ip, asr #20
-        movmi  ip, #0
-        cmp    ip, #255
-        movgt  ip, #255
-        orr    a2, a2, ip, lsl #8
-        strh   a2, [v1, lr]!
-        add    a3, a3, v3
-        movs   a2, a3, asr #20
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        add    a4, a4, v4
-        movs   a4, a4, asr #20
-        movmi  a4, #0
-        cmp    a4, #255
-        movgt  a4, #255
-        orr    a2, a2, a4, lsl #8
-        ldmfd  sp!, {a3, a4}
-        strh   a2, [v2, -lr]!
-
-        add    a2, a3, v5
-        movs   a2, a2, asr #20
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        add    ip, a4, v6
-        movs   ip, ip, asr #20
-        movmi  ip, #0
-        cmp    ip, #255
-        movgt  ip, #255
-        orr    a2, a2, ip, lsl #8
-        strh   a2, [v1, lr]!
-        sub    a3, a3, v5
-        movs   a2, a3, asr #20
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        sub    a4, a4, v6
-        movs   a4, a4, asr #20
-        movmi  a4, #0
-        cmp    a4, #255
-        movgt  a4, #255
-        orr    a2, a2, a4, lsl #8
-        ldmfd  sp!, {a3, a4}
-        strh   a2, [v2, -lr]!
-
-        add    a2, a3, v7
-        movs   a2, a2, asr #20
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        add    ip, a4, fp
-        movs   ip, ip, asr #20
-        movmi  ip, #0
-        cmp    ip, #255
-        movgt  ip, #255
-        orr    a2, a2, ip, lsl #8
-        strh   a2, [v1, lr]
-        sub    a3, a3, v7
-        movs   a2, a3, asr #20
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        sub    a4, a4, fp
-        movs   a4, a4, asr #20
-        movmi  a4, #0
-        cmp    a4, #255
-        movgt  a4, #255
-        orr    a2, a2, a4, lsl #8
-        strh   a2, [v2, -lr]
-
-        ldr    pc, [sp], #4
-endfunc
-
-function idct_col_add_armv5te
-        str    lr, [sp, #-4]!
-
-        idct_col
-
-        ldr    lr, [sp, #36]
-
-        ldmfd  sp!, {a3, a4}
-        ldrh   ip, [lr]
-        add    a2, a3, v1
-        mov    a2, a2, asr #20
-        sub    a3, a3, v1
-        and    v1, ip, #255
-        adds   a2, a2, v1
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        add    v1, a4, v2
-        mov    v1, v1, asr #20
-        adds   v1, v1, ip, lsr #8
-        movmi  v1, #0
-        cmp    v1, #255
-        movgt  v1, #255
-        orr    a2, a2, v1, lsl #8
-        ldr    v1, [sp, #32]
-        sub    a4, a4, v2
-        rsb    v2, v1, v1, lsl #3
-        ldrh   ip, [v2, lr]!
-        strh   a2, [lr]
-        mov    a3, a3, asr #20
-        and    a2, ip, #255
-        adds   a3, a3, a2
-        movmi  a3, #0
-        cmp    a3, #255
-        movgt  a3, #255
-        mov    a4, a4, asr #20
-        adds   a4, a4, ip, lsr #8
-        movmi  a4, #0
-        cmp    a4, #255
-        movgt  a4, #255
-        add    a2, lr, #2
-        str    a2, [sp, #28]
-        orr    a2, a3, a4, lsl #8
-        strh   a2, [v2]
-
-        ldmfd  sp!, {a3, a4}
-        ldrh   ip, [lr, v1]!
-        sub    a2, a3, v3
-        mov    a2, a2, asr #20
-        add    a3, a3, v3
-        and    v3, ip, #255
-        adds   a2, a2, v3
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        sub    v3, a4, v4
-        mov    v3, v3, asr #20
-        adds   v3, v3, ip, lsr #8
-        movmi  v3, #0
-        cmp    v3, #255
-        movgt  v3, #255
-        orr    a2, a2, v3, lsl #8
-        add    a4, a4, v4
-        ldrh   ip, [v2, -v1]!
-        strh   a2, [lr]
-        mov    a3, a3, asr #20
-        and    a2, ip, #255
-        adds   a3, a3, a2
-        movmi  a3, #0
-        cmp    a3, #255
-        movgt  a3, #255
-        mov    a4, a4, asr #20
-        adds   a4, a4, ip, lsr #8
-        movmi  a4, #0
-        cmp    a4, #255
-        movgt  a4, #255
-        orr    a2, a3, a4, lsl #8
-        strh   a2, [v2]
-
-        ldmfd  sp!, {a3, a4}
-        ldrh   ip, [lr, v1]!
-        add    a2, a3, v5
-        mov    a2, a2, asr #20
-        sub    a3, a3, v5
-        and    v3, ip, #255
-        adds   a2, a2, v3
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        add    v3, a4, v6
-        mov    v3, v3, asr #20
-        adds   v3, v3, ip, lsr #8
-        movmi  v3, #0
-        cmp    v3, #255
-        movgt  v3, #255
-        orr    a2, a2, v3, lsl #8
-        sub    a4, a4, v6
-        ldrh   ip, [v2, -v1]!
-        strh   a2, [lr]
-        mov    a3, a3, asr #20
-        and    a2, ip, #255
-        adds   a3, a3, a2
-        movmi  a3, #0
-        cmp    a3, #255
-        movgt  a3, #255
-        mov    a4, a4, asr #20
-        adds   a4, a4, ip, lsr #8
-        movmi  a4, #0
-        cmp    a4, #255
-        movgt  a4, #255
-        orr    a2, a3, a4, lsl #8
-        strh   a2, [v2]
-
-        ldmfd  sp!, {a3, a4}
-        ldrh   ip, [lr, v1]!
-        add    a2, a3, v7
-        mov    a2, a2, asr #20
-        sub    a3, a3, v7
-        and    v3, ip, #255
-        adds   a2, a2, v3
-        movmi  a2, #0
-        cmp    a2, #255
-        movgt  a2, #255
-        add    v3, a4, fp
-        mov    v3, v3, asr #20
-        adds   v3, v3, ip, lsr #8
-        movmi  v3, #0
-        cmp    v3, #255
-        movgt  v3, #255
-        orr    a2, a2, v3, lsl #8
-        sub    a4, a4, fp
-        ldrh   ip, [v2, -v1]!
-        strh   a2, [lr]
-        mov    a3, a3, asr #20
-        and    a2, ip, #255
-        adds   a3, a3, a2
-        movmi  a3, #0
-        cmp    a3, #255
-        movgt  a3, #255
-        mov    a4, a4, asr #20
-        adds   a4, a4, ip, lsr #8
-        movmi  a4, #0
-        cmp    a4, #255
-        movgt  a4, #255
-        orr    a2, a3, a4, lsl #8
-        strh   a2, [v2]
-
-        ldr    pc, [sp], #4
-endfunc
-
-function ff_simple_idct_armv5te, export=1
-        stmfd  sp!, {v1, v2, v3, v4, v5, v6, v7, fp, lr}
-
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-
-        sub    a1, a1, #(16*7)
-
-        bl     idct_col_armv5te
-        add    a1, a1, #4
-        bl     idct_col_armv5te
-        add    a1, a1, #4
-        bl     idct_col_armv5te
-        add    a1, a1, #4
-        bl     idct_col_armv5te
-
-        ldmfd  sp!, {v1, v2, v3, v4, v5, v6, v7, fp, pc}
-endfunc
-
-function ff_simple_idct_add_armv5te, export=1
-        stmfd  sp!, {a1, a2, v1, v2, v3, v4, v5, v6, v7, fp, lr}
-
-        mov    a1, a3
-
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-
-        sub    a1, a1, #(16*7)
-
-        bl     idct_col_add_armv5te
-        add    a1, a1, #4
-        bl     idct_col_add_armv5te
-        add    a1, a1, #4
-        bl     idct_col_add_armv5te
-        add    a1, a1, #4
-        bl     idct_col_add_armv5te
-
-        add    sp, sp, #8
-        ldmfd  sp!, {v1, v2, v3, v4, v5, v6, v7, fp, pc}
-endfunc
-
-function ff_simple_idct_put_armv5te, export=1
-        stmfd  sp!, {a1, a2, v1, v2, v3, v4, v5, v6, v7, fp, lr}
-
-        mov    a1, a3
-
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-        add    a1, a1, #16
-        bl     idct_row_armv5te
-
-        sub    a1, a1, #(16*7)
-
-        bl     idct_col_put_armv5te
-        add    a1, a1, #4
-        bl     idct_col_put_armv5te
-        add    a1, a1, #4
-        bl     idct_col_put_armv5te
-        add    a1, a1, #4
-        bl     idct_col_put_armv5te
-
-        add    sp, sp, #8
-        ldmfd  sp!, {v1, v2, v3, v4, v5, v6, v7, fp, pc}
-endfunc
diff --git a/libavcodec/arm/simple_idct_armv6.S b/libavcodec/arm/simple_idct_armv6.S
deleted file mode 100644
index d61c1fd..0000000
--- a/libavcodec/arm/simple_idct_armv6.S
+++ /dev/null
@@ -1,433 +0,0 @@
-/*
- * Simple IDCT
- *
- * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2007 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-#define W1  22725   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W2  21407   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W3  19266   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W4  16383   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W5  12873   /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W6  8867    /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define W7  4520    /* cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 */
-#define ROW_SHIFT 11
-#define COL_SHIFT 20
-
-#define W13 (W1 | (W3 << 16))
-#define W26 (W2 | (W6 << 16))
-#define W42 (W4 | (W2 << 16))
-#define W42n (-W4&0xffff | (-W2 << 16))
-#define W46 (W4 | (W6 << 16))
-#define W57 (W5 | (W7 << 16))
-
-        .text
-        .align
-w13:    .long W13
-w26:    .long W26
-w42:    .long W42
-w42n:   .long W42n
-w46:    .long W46
-w57:    .long W57
-
-/*
-  Compute partial IDCT of single row.
-  shift = left-shift amount
-  r0 = source address
-  r2 = row[2,0] <= 2 cycles
-  r3 = row[3,1]
-  ip = w42      <= 2 cycles
-
-  Output in registers r4--r11
-*/
-        .macro idct_row shift
-        ldr    lr, w46               /* lr  = W4 | (W6 << 16) */
-        mov    r1, #(1<<(\shift-1))
-        smlad  r4, r2, ip, r1
-        smlsd  r7, r2, ip, r1
-        ldr    ip, w13               /* ip  = W1 | (W3 << 16) */
-        ldr    r10,w57               /* r10 = W5 | (W7 << 16) */
-        smlad  r5, r2, lr, r1
-        smlsd  r6, r2, lr, r1
-
-        smuad  r8, r3, ip            /* r8  =  B0 = W1*row[1] + W3*row[3] */
-        smusdx r11,r3, r10           /* r11 =  B3 = W7*row[1] - W5*row[3] */
-        ldr    lr, [r0, #12]         /* lr  =  row[7,5] */
-        pkhtb  r2, ip, r10,asr #16   /* r3  =  W7 | (W3 << 16) */
-        pkhbt  r1, ip, r10,lsl #16   /* r1  =  W1 | (W5 << 16) */
-        smusdx r9, r2, r3            /* r9  = -B1 = W7*row[3] - W3*row[1] */
-        smlad  r8, lr, r10,r8        /* B0  +=      W5*row[5] + W7*row[7] */
-        smusdx r10,r3, r1            /* r10 =  B2 = W5*row[1] - W1*row[3] */
-
-        ldr    r3, w42n              /* r3 =  -W4 | (-W2 << 16) */
-        smlad  r10,lr, r2, r10       /* B2 +=  W7*row[5] + W3*row[7] */
-        ldr    r2, [r0, #4]          /* r2 =   row[6,4] */
-        smlsdx r11,lr, ip, r11       /* B3 +=  W3*row[5] - W1*row[7] */
-        ldr    ip, w46               /* ip =   W4 | (W6 << 16) */
-        smlad  r9, lr, r1, r9        /* B1 -=  W1*row[5] + W5*row[7] */
-
-        smlad  r5, r2, r3, r5        /* A1 += -W4*row[4] - W2*row[6] */
-        smlsd  r6, r2, r3, r6        /* A2 += -W4*row[4] + W2*row[6] */
-        smlad  r4, r2, ip, r4        /* A0 +=  W4*row[4] + W6*row[6] */
-        smlsd  r7, r2, ip, r7        /* A3 +=  W4*row[4] - W6*row[6] */
-        .endm
-
-/*
-  Compute partial IDCT of half row.
-  shift = left-shift amount
-  r2 = row[2,0]
-  r3 = row[3,1]
-  ip = w42
-
-  Output in registers r4--r11
-*/
-        .macro idct_row4 shift
-        ldr    lr, w46               /* lr =  W4 | (W6 << 16) */
-        ldr    r10,w57               /* r10 = W5 | (W7 << 16) */
-        mov    r1, #(1<<(\shift-1))
-        smlad  r4, r2, ip, r1
-        smlsd  r7, r2, ip, r1
-        ldr    ip, w13               /* ip =  W1 | (W3 << 16) */
-        smlad  r5, r2, lr, r1
-        smlsd  r6, r2, lr, r1
-        smusdx r11,r3, r10           /* r11 =  B3 = W7*row[1] - W5*row[3] */
-        smuad  r8, r3, ip            /* r8  =  B0 = W1*row[1] + W3*row[3] */
-        pkhtb  r2, ip, r10,asr #16   /* r3  =  W7 | (W3 << 16) */
-        pkhbt  r1, ip, r10,lsl #16   /* r1  =  W1 | (W5 << 16) */
-        smusdx r9, r2, r3            /* r9  = -B1 = W7*row[3] - W3*row[1] */
-        smusdx r10,r3, r1            /* r10 =  B2 = W5*row[1] - W1*row[3] */
-        .endm
-
-/*
-  Compute final part of IDCT single row without shift.
-  Input in registers r4--r11
-  Output in registers ip, r4--r6, lr, r8--r10
-*/
-        .macro idct_finish
-        add    ip, r4, r8            /* r1 = A0 + B0 */
-        sub    lr, r4, r8            /* r2 = A0 - B0 */
-        sub    r4, r5, r9            /* r2 = A1 + B1 */
-        add    r8, r5, r9            /* r2 = A1 - B1 */
-        add    r5, r6, r10           /* r1 = A2 + B2 */
-        sub    r9, r6, r10           /* r1 = A2 - B2 */
-        add    r6, r7, r11           /* r2 = A3 + B3 */
-        sub    r10,r7, r11           /* r2 = A3 - B3 */
-        .endm
-
-/*
-  Compute final part of IDCT single row.
-  shift = right-shift amount
-  Input/output in registers r4--r11
-*/
-        .macro idct_finish_shift shift
-        add    r3, r4, r8            /* r3 = A0 + B0 */
-        sub    r2, r4, r8            /* r2 = A0 - B0 */
-        mov    r4, r3, asr #\shift
-        mov    r8, r2, asr #\shift
-
-        sub    r3, r5, r9            /* r3 = A1 + B1 */
-        add    r2, r5, r9            /* r2 = A1 - B1 */
-        mov    r5, r3, asr #\shift
-        mov    r9, r2, asr #\shift
-
-        add    r3, r6, r10           /* r3 = A2 + B2 */
-        sub    r2, r6, r10           /* r2 = A2 - B2 */
-        mov    r6, r3, asr #\shift
-        mov    r10,r2, asr #\shift
-
-        add    r3, r7, r11           /* r3 = A3 + B3 */
-        sub    r2, r7, r11           /* r2 = A3 - B3 */
-        mov    r7, r3, asr #\shift
-        mov    r11,r2, asr #\shift
-        .endm
-
-/*
-  Compute final part of IDCT single row, saturating results at 8 bits.
-  shift = right-shift amount
-  Input/output in registers r4--r11
-*/
-        .macro idct_finish_shift_sat shift
-        add    r3, r4, r8            /* r3 = A0 + B0 */
-        sub    ip, r4, r8            /* ip = A0 - B0 */
-        usat   r4, #8, r3, asr #\shift
-        usat   r8, #8, ip, asr #\shift
-
-        sub    r3, r5, r9            /* r3 = A1 + B1 */
-        add    ip, r5, r9            /* ip = A1 - B1 */
-        usat   r5, #8, r3, asr #\shift
-        usat   r9, #8, ip, asr #\shift
-
-        add    r3, r6, r10           /* r3 = A2 + B2 */
-        sub    ip, r6, r10           /* ip = A2 - B2 */
-        usat   r6, #8, r3, asr #\shift
-        usat   r10,#8, ip, asr #\shift
-
-        add    r3, r7, r11           /* r3 = A3 + B3 */
-        sub    ip, r7, r11           /* ip = A3 - B3 */
-        usat   r7, #8, r3, asr #\shift
-        usat   r11,#8, ip, asr #\shift
-        .endm
-
-/*
-  Compute IDCT of single row, storing as column.
-  r0 = source
-  r1 = dest
-*/
-function idct_row_armv6
-        push   {lr}
-
-        ldr    lr, [r0, #12]         /* lr = row[7,5] */
-        ldr    ip, [r0, #4]          /* ip = row[6,4] */
-        ldr    r3, [r0, #8]          /* r3 = row[3,1] */
-        ldr    r2, [r0]              /* r2 = row[2,0] */
-        orrs   lr, lr, ip
-        cmpeq  lr, r3
-        cmpeq  lr, r2, lsr #16
-        beq    1f
-        push   {r1}
-        ldr    ip, w42               /* ip = W4 | (W2 << 16) */
-        cmp    lr, #0
-        beq    2f
-
-        idct_row   ROW_SHIFT
-        b      3f
-
-2:      idct_row4  ROW_SHIFT
-
-3:      pop    {r1}
-        idct_finish_shift ROW_SHIFT
-
-        strh   r4, [r1]
-        strh   r5, [r1, #(16*2)]
-        strh   r6, [r1, #(16*4)]
-        strh   r7, [r1, #(16*6)]
-        strh   r11,[r1, #(16*1)]
-        strh   r10,[r1, #(16*3)]
-        strh   r9, [r1, #(16*5)]
-        strh   r8, [r1, #(16*7)]
-
-        pop    {pc}
-
-1:      mov    r2, r2, lsl #3
-        strh   r2, [r1]
-        strh   r2, [r1, #(16*2)]
-        strh   r2, [r1, #(16*4)]
-        strh   r2, [r1, #(16*6)]
-        strh   r2, [r1, #(16*1)]
-        strh   r2, [r1, #(16*3)]
-        strh   r2, [r1, #(16*5)]
-        strh   r2, [r1, #(16*7)]
-        pop    {pc}
-endfunc
-
-/*
-  Compute IDCT of single column, read as row.
-  r0 = source
-  r1 = dest
-*/
-function idct_col_armv6
-        push   {r1, lr}
-
-        ldr    r2, [r0]              /* r2 = row[2,0] */
-        ldr    ip, w42               /* ip = W4 | (W2 << 16) */
-        ldr    r3, [r0, #8]          /* r3 = row[3,1] */
-        idct_row COL_SHIFT
-        pop    {r1}
-        idct_finish_shift COL_SHIFT
-
-        strh   r4, [r1]
-        strh   r5, [r1, #(16*1)]
-        strh   r6, [r1, #(16*2)]
-        strh   r7, [r1, #(16*3)]
-        strh   r11,[r1, #(16*4)]
-        strh   r10,[r1, #(16*5)]
-        strh   r9, [r1, #(16*6)]
-        strh   r8, [r1, #(16*7)]
-
-        pop    {pc}
-endfunc
-
-/*
-  Compute IDCT of single column, read as row, store saturated 8-bit.
-  r0 = source
-  r1 = dest
-  r2 = line size
-*/
-function idct_col_put_armv6
-        push   {r1, r2, lr}
-
-        ldr    r2, [r0]              /* r2 = row[2,0] */
-        ldr    ip, w42               /* ip = W4 | (W2 << 16) */
-        ldr    r3, [r0, #8]          /* r3 = row[3,1] */
-        idct_row COL_SHIFT
-        pop    {r1, r2}
-        idct_finish_shift_sat COL_SHIFT
-
-        strb   r4, [r1], r2
-        strb   r5, [r1], r2
-        strb   r6, [r1], r2
-        strb   r7, [r1], r2
-        strb   r11,[r1], r2
-        strb   r10,[r1], r2
-        strb   r9, [r1], r2
-        strb   r8, [r1], r2
-
-        sub    r1, r1, r2, lsl #3
-
-        pop    {pc}
-endfunc
-
-/*
-  Compute IDCT of single column, read as row, add/store saturated 8-bit.
-  r0 = source
-  r1 = dest
-  r2 = line size
-*/
-function idct_col_add_armv6
-        push   {r1, r2, lr}
-
-        ldr    r2, [r0]              /* r2 = row[2,0] */
-        ldr    ip, w42               /* ip = W4 | (W2 << 16) */
-        ldr    r3, [r0, #8]          /* r3 = row[3,1] */
-        idct_row COL_SHIFT
-        pop    {r1, r2}
-        idct_finish
-
-        ldrb   r3, [r1]
-        ldrb   r7, [r1, r2]
-        ldrb   r11,[r1, r2, lsl #2]
-        add    ip, r3, ip, asr #COL_SHIFT
-        usat   ip, #8, ip
-        add    r4, r7, r4, asr #COL_SHIFT
-        strb   ip, [r1], r2
-        ldrb   ip, [r1, r2]
-        usat   r4, #8, r4
-        ldrb   r11,[r1, r2, lsl #2]
-        add    r5, ip, r5, asr #COL_SHIFT
-        usat   r5, #8, r5
-        strb   r4, [r1], r2
-        ldrb   r3, [r1, r2]
-        ldrb   ip, [r1, r2, lsl #2]
-        strb   r5, [r1], r2
-        ldrb   r7, [r1, r2]
-        ldrb   r4, [r1, r2, lsl #2]
-        add    r6, r3, r6, asr #COL_SHIFT
-        usat   r6, #8, r6
-        add    r10,r7, r10,asr #COL_SHIFT
-        usat   r10,#8, r10
-        add    r9, r11,r9, asr #COL_SHIFT
-        usat   r9, #8, r9
-        add    r8, ip, r8, asr #COL_SHIFT
-        usat   r8, #8, r8
-        add    lr, r4, lr, asr #COL_SHIFT
-        usat   lr, #8, lr
-        strb   r6, [r1], r2
-        strb   r10,[r1], r2
-        strb   r9, [r1], r2
-        strb   r8, [r1], r2
-        strb   lr, [r1], r2
-
-        sub    r1, r1, r2, lsl #3
-
-        pop    {pc}
-endfunc
-
-/*
-  Compute 8 IDCT row transforms.
-  func = IDCT row->col function
-  width = width of columns in bytes
-*/
-        .macro idct_rows func width
-        bl     \func
-        add    r0, r0, #(16*2)
-        add    r1, r1, #\width
-        bl     \func
-        add    r0, r0, #(16*2)
-        add    r1, r1, #\width
-        bl     \func
-        add    r0, r0, #(16*2)
-        add    r1, r1, #\width
-        bl     \func
-        sub    r0, r0, #(16*5)
-        add    r1, r1, #\width
-        bl     \func
-        add    r0, r0, #(16*2)
-        add    r1, r1, #\width
-        bl     \func
-        add    r0, r0, #(16*2)
-        add    r1, r1, #\width
-        bl     \func
-        add    r0, r0, #(16*2)
-        add    r1, r1, #\width
-        bl     \func
-
-        sub    r0, r0, #(16*7)
-        .endm
-
-/* void ff_simple_idct_armv6(DCTELEM *data); */
-function ff_simple_idct_armv6, export=1
-        push   {r4-r11, lr}
-        sub    sp, sp, #128
-
-        mov    r1, sp
-        idct_rows idct_row_armv6, 2
-        mov    r1, r0
-        mov    r0, sp
-        idct_rows idct_col_armv6, 2
-
-        add    sp, sp, #128
-        pop    {r4-r11, pc}
-endfunc
-
-/* ff_simple_idct_add_armv6(uint8_t *dest, int line_size, DCTELEM *data); */
-function ff_simple_idct_add_armv6, export=1
-        push   {r0, r1, r4-r11, lr}
-        sub    sp, sp, #128
-
-        mov    r0, r2
-        mov    r1, sp
-        idct_rows idct_row_armv6, 2
-        mov    r0, sp
-        ldr    r1, [sp, #128]
-        ldr    r2, [sp, #(128+4)]
-        idct_rows idct_col_add_armv6, 1
-
-        add    sp, sp, #(128+8)
-        pop    {r4-r11, pc}
-endfunc
-
-/* ff_simple_idct_put_armv6(uint8_t *dest, int line_size, DCTELEM *data); */
-function ff_simple_idct_put_armv6, export=1
-        push   {r0, r1, r4-r11, lr}
-        sub    sp, sp, #128
-
-        mov    r0, r2
-        mov    r1, sp
-        idct_rows idct_row_armv6, 2
-        mov    r0, sp
-        ldr    r1, [sp, #128]
-        ldr    r2, [sp, #(128+4)]
-        idct_rows idct_col_put_armv6, 1
-
-        add    sp, sp, #(128+8)
-        pop    {r4-r11, pc}
-endfunc
diff --git a/libavcodec/arm/simple_idct_neon.S b/libavcodec/arm/simple_idct_neon.S
deleted file mode 100644
index f27208e..0000000
--- a/libavcodec/arm/simple_idct_neon.S
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * ARM NEON IDCT
- *
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * Based on Simple IDCT
- * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-#define W1  22725  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W2  21407  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W3  19266  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W4  16383  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W5  12873  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W6  8867   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W7  4520   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W4c ((1<<(COL_SHIFT-1))/W4)
-#define ROW_SHIFT 11
-#define COL_SHIFT 20
-
-#define w1 d0[0]
-#define w2 d0[1]
-#define w3 d0[2]
-#define w4 d0[3]
-#define w5 d1[0]
-#define w6 d1[1]
-#define w7 d1[2]
-#define w4c d1[3]
-
-        .macro idct_col4_top
-        vmull.s16       q7,  d6,  w2    /* q9   = W2 * col[2] */
-        vmull.s16       q8,  d6,  w6    /* q10  = W6 * col[2] */
-        vmull.s16       q9,  d4,  w1    /* q9   = W1 * col[1] */
-        vadd.i32        q11, q15, q7
-        vmull.s16       q10, d4,  w3    /* q10  = W3 * col[1] */
-        vadd.i32        q12, q15, q8
-        vmull.s16       q5,  d4,  w5    /* q5   = W5 * col[1] */
-        vsub.i32        q13, q15, q8
-        vmull.s16       q6,  d4,  w7    /* q6   = W7 * col[1] */
-        vsub.i32        q14, q15, q7
-
-        vmlal.s16       q9,  d8,  w3    /* q9  += W3 * col[3] */
-        vmlsl.s16       q10, d8,  w7    /* q10 -= W7 * col[3] */
-        vmlsl.s16       q5,  d8,  w1    /* q5  -= W1 * col[3] */
-        vmlsl.s16       q6,  d8,  w5    /* q6  -= W5 * col[3] */
-        .endm
-
-        .text
-        .align 6
-
-function idct_row4_pld_neon
-        pld             [r0]
-        add             r3,  r0,  r1,  lsl #2
-        pld             [r0, r1]
-        pld             [r0, r1, lsl #1]
-        pld             [r3, -r1]
-        pld             [r3]
-        pld             [r3, r1]
-        add             r3,  r3,  r1,  lsl #1
-        pld             [r3]
-        pld             [r3, r1]
-endfunc
-
-function idct_row4_neon
-        vmov.i32        q15, #(1<<(ROW_SHIFT-1))
-        vld1.64         {d2-d5},  [r2,:128]!
-        vmlal.s16       q15, d2,  w4    /* q15  += W4 * col[0] */
-        vld1.64         {d6,d7},  [r2,:128]!
-        vorr            d10, d3,  d5
-        vld1.64         {d8,d9},  [r2,:128]!
-        add             r2,  r2,  #-64
-
-        vorr            d11, d7,  d9
-        vorr            d10, d10, d11
-        vmov            r3,  r4,  d10
-
-        idct_col4_top
-
-        orrs            r3,  r3,  r4
-        beq             1f
-
-        vmull.s16       q7,  d3,  w4    /* q7   = W4 * col[4] */
-        vmlal.s16       q9,  d5,  w5    /* q9  += W5 * col[5] */
-        vmlsl.s16       q10, d5,  w1    /* q10 -= W1 * col[5] */
-        vmull.s16       q8,  d7,  w2    /* q8   = W2 * col[6] */
-        vmlal.s16       q5,  d5,  w7    /* q5  += W7 * col[5] */
-        vadd.i32        q11, q11, q7
-        vsub.i32        q12, q12, q7
-        vsub.i32        q13, q13, q7
-        vadd.i32        q14, q14, q7
-        vmlal.s16       q6,  d5,  w3    /* q6  += W3 * col[5] */
-        vmull.s16       q7,  d7,  w6    /* q7   = W6 * col[6] */
-        vmlal.s16       q9,  d9,  w7
-        vmlsl.s16       q10, d9,  w5
-        vmlal.s16       q5,  d9,  w3
-        vmlsl.s16       q6,  d9,  w1
-        vadd.i32        q11, q11, q7
-        vsub.i32        q12, q12, q8
-        vadd.i32        q13, q13, q8
-        vsub.i32        q14, q14, q7
-
-1:      vadd.i32        q3,  q11, q9
-        vadd.i32        q4,  q12, q10
-        vshrn.i32       d2,  q3,  #ROW_SHIFT
-        vshrn.i32       d4,  q4,  #ROW_SHIFT
-        vadd.i32        q7,  q13, q5
-        vadd.i32        q8,  q14, q6
-        vtrn.16         d2,  d4
-        vshrn.i32       d6,  q7,  #ROW_SHIFT
-        vshrn.i32       d8,  q8,  #ROW_SHIFT
-        vsub.i32        q14, q14, q6
-        vsub.i32        q11, q11, q9
-        vtrn.16         d6,  d8
-        vsub.i32        q13, q13, q5
-        vshrn.i32       d3,  q14, #ROW_SHIFT
-        vtrn.32         d2,  d6
-        vsub.i32        q12, q12, q10
-        vtrn.32         d4,  d8
-        vshrn.i32       d5,  q13, #ROW_SHIFT
-        vshrn.i32       d7,  q12, #ROW_SHIFT
-        vshrn.i32       d9,  q11, #ROW_SHIFT
-
-        vtrn.16         d3,  d5
-        vtrn.16         d7,  d9
-        vtrn.32         d3,  d7
-        vtrn.32         d5,  d9
-
-        vst1.64         {d2-d5},  [r2,:128]!
-        vst1.64         {d6-d9},  [r2,:128]!
-
-        bx              lr
-endfunc
-
-function idct_col4_neon
-        mov             ip,  #16
-        vld1.64         {d2}, [r2,:64], ip /* d2 = col[0] */
-        vdup.16         d30, w4c
-        vld1.64         {d4}, [r2,:64], ip /* d3 = col[1] */
-        vadd.i16        d30, d30, d2
-        vld1.64         {d6}, [r2,:64], ip /* d4 = col[2] */
-        vmull.s16       q15, d30, w4 /* q15 = W4*(col[0]+(1<<COL_SHIFT-1)/W4)*/
-        vld1.64         {d8}, [r2,:64], ip /* d5 = col[3] */
-
-        ldrd            r4,  [r2]
-        ldrd            r6,  [r2, #16]
-        orrs            r4,  r4,  r5
-
-        idct_col4_top
-        addeq           r2,  r2,  #16
-        beq             1f
-
-        vld1.64         {d3}, [r2,:64], ip /* d6 = col[4] */
-        vmull.s16       q7,  d3,  w4    /* q7   = W4 * col[4] */
-        vadd.i32        q11, q11, q7
-        vsub.i32        q12, q12, q7
-        vsub.i32        q13, q13, q7
-        vadd.i32        q14, q14, q7
-
-1:      orrs            r6,  r6,  r7
-        ldrd            r4,  [r2, #16]
-        addeq           r2,  r2,  #16
-        beq             2f
-
-        vld1.64         {d5}, [r2,:64], ip /* d7 = col[5] */
-        vmlal.s16       q9,  d5,  w5    /* q9  += W5 * col[5] */
-        vmlsl.s16       q10, d5,  w1    /* q10 -= W1 * col[5] */
-        vmlal.s16       q5,  d5,  w7    /* q5  += W7 * col[5] */
-        vmlal.s16       q6,  d5,  w3    /* q6  += W3 * col[5] */
-
-2:      orrs            r4,  r4,  r5
-        ldrd            r4,  [r2, #16]
-        addeq           r2,  r2,  #16
-        beq             3f
-
-        vld1.64         {d7}, [r2,:64], ip /* d8 = col[6] */
-        vmull.s16       q7,  d7,  w6    /* q7   = W6 * col[6] */
-        vmull.s16       q8,  d7,  w2    /* q8   = W2 * col[6] */
-        vadd.i32        q11, q11, q7
-        vsub.i32        q14, q14, q7
-        vsub.i32        q12, q12, q8
-        vadd.i32        q13, q13, q8
-
-3:      orrs            r4,  r4,  r5
-        addeq           r2,  r2,  #16
-        beq             4f
-
-        vld1.64         {d9}, [r2,:64], ip /* d9 = col[7] */
-        vmlal.s16       q9,  d9,  w7
-        vmlsl.s16       q10, d9,  w5
-        vmlal.s16       q5,  d9,  w3
-        vmlsl.s16       q6,  d9,  w1
-
-4:      vaddhn.i32      d2,  q11, q9
-        vaddhn.i32      d3,  q12, q10
-        vaddhn.i32      d4,  q13, q5
-        vaddhn.i32      d5,  q14, q6
-        vsubhn.i32      d9,  q11, q9
-        vsubhn.i32      d8,  q12, q10
-        vsubhn.i32      d7,  q13, q5
-        vsubhn.i32      d6,  q14, q6
-
-        bx              lr
-endfunc
-
-        .align 6
-
-function idct_col4_st8_neon
-        vqshrun.s16     d2,  q1,  #COL_SHIFT-16
-        vqshrun.s16     d3,  q2,  #COL_SHIFT-16
-        vqshrun.s16     d4,  q3,  #COL_SHIFT-16
-        vqshrun.s16     d5,  q4,  #COL_SHIFT-16
-        vst1.32         {d2[0]}, [r0,:32], r1
-        vst1.32         {d2[1]}, [r0,:32], r1
-        vst1.32         {d3[0]}, [r0,:32], r1
-        vst1.32         {d3[1]}, [r0,:32], r1
-        vst1.32         {d4[0]}, [r0,:32], r1
-        vst1.32         {d4[1]}, [r0,:32], r1
-        vst1.32         {d5[0]}, [r0,:32], r1
-        vst1.32         {d5[1]}, [r0,:32], r1
-
-        bx              lr
-endfunc
-
-        .section .rodata
-        .align 4
-idct_coeff_neon:
-        .short W1, W2, W3, W4, W5, W6, W7, W4c
-        .previous
-
-        .macro idct_start data
-        push            {r4-r7, lr}
-        pld             [\data]
-        pld             [\data, #64]
-        vpush           {d8-d15}
-        movrel          r3,  idct_coeff_neon
-        vld1.64         {d0,d1}, [r3,:128]
-        .endm
-
-        .macro idct_end
-        vpop            {d8-d15}
-        pop             {r4-r7, pc}
-        .endm
-
-/* void ff_simple_idct_put_neon(uint8_t *dst, int line_size, DCTELEM *data); */
-function ff_simple_idct_put_neon, export=1
-        idct_start      r2
-
-        bl              idct_row4_pld_neon
-        bl              idct_row4_neon
-        add             r2,  r2,  #-128
-        bl              idct_col4_neon
-        bl              idct_col4_st8_neon
-        sub             r0,  r0,  r1, lsl #3
-        add             r0,  r0,  #4
-        add             r2,  r2,  #-120
-        bl              idct_col4_neon
-        bl              idct_col4_st8_neon
-
-        idct_end
-endfunc
-
-        .align 6
-
-function idct_col4_add8_neon
-        mov             ip,  r0
-
-        vld1.32         {d10[0]}, [r0,:32], r1
-        vshr.s16        q1,  q1,  #COL_SHIFT-16
-        vld1.32         {d10[1]}, [r0,:32], r1
-        vshr.s16        q2,  q2,  #COL_SHIFT-16
-        vld1.32         {d11[0]}, [r0,:32], r1
-        vshr.s16        q3,  q3,  #COL_SHIFT-16
-        vld1.32         {d11[1]}, [r0,:32], r1
-        vshr.s16        q4,  q4,  #COL_SHIFT-16
-        vld1.32         {d12[0]}, [r0,:32], r1
-        vaddw.u8        q1,  q1,  d10
-        vld1.32         {d12[1]}, [r0,:32], r1
-        vaddw.u8        q2,  q2,  d11
-        vld1.32         {d13[0]}, [r0,:32], r1
-        vqmovun.s16     d2,  q1
-        vld1.32         {d13[1]}, [r0,:32], r1
-        vaddw.u8        q3,  q3,  d12
-        vst1.32         {d2[0]},  [ip,:32], r1
-        vqmovun.s16     d3,  q2
-        vst1.32         {d2[1]},  [ip,:32], r1
-        vaddw.u8        q4,  q4,  d13
-        vst1.32         {d3[0]},  [ip,:32], r1
-        vqmovun.s16     d4,  q3
-        vst1.32         {d3[1]},  [ip,:32], r1
-        vqmovun.s16     d5,  q4
-        vst1.32         {d4[0]},  [ip,:32], r1
-        vst1.32         {d4[1]},  [ip,:32], r1
-        vst1.32         {d5[0]},  [ip,:32], r1
-        vst1.32         {d5[1]},  [ip,:32], r1
-
-        bx              lr
-endfunc
-
-/* void ff_simple_idct_add_neon(uint8_t *dst, int line_size, DCTELEM *data); */
-function ff_simple_idct_add_neon, export=1
-        idct_start      r2
-
-        bl              idct_row4_pld_neon
-        bl              idct_row4_neon
-        add             r2,  r2,  #-128
-        bl              idct_col4_neon
-        bl              idct_col4_add8_neon
-        sub             r0,  r0,  r1, lsl #3
-        add             r0,  r0,  #4
-        add             r2,  r2,  #-120
-        bl              idct_col4_neon
-        bl              idct_col4_add8_neon
-
-        idct_end
-endfunc
-
-        .align 6
-
-function idct_col4_st16_neon
-        mov             ip,  #16
-
-        vshr.s16        q1,  q1,  #COL_SHIFT-16
-        vshr.s16        q2,  q2,  #COL_SHIFT-16
-        vst1.64         {d2}, [r2,:64], ip
-        vshr.s16        q3,  q3,  #COL_SHIFT-16
-        vst1.64         {d3}, [r2,:64], ip
-        vshr.s16        q4,  q4,  #COL_SHIFT-16
-        vst1.64         {d4}, [r2,:64], ip
-        vst1.64         {d5}, [r2,:64], ip
-        vst1.64         {d6}, [r2,:64], ip
-        vst1.64         {d7}, [r2,:64], ip
-        vst1.64         {d8}, [r2,:64], ip
-        vst1.64         {d9}, [r2,:64], ip
-
-        bx              lr
-endfunc
-
-/* void ff_simple_idct_neon(DCTELEM *data); */
-function ff_simple_idct_neon, export=1
-        idct_start      r0
-
-        mov             r2,  r0
-        bl              idct_row4_neon
-        bl              idct_row4_neon
-        add             r2,  r2,  #-128
-        bl              idct_col4_neon
-        add             r2,  r2,  #-128
-        bl              idct_col4_st16_neon
-        add             r2,  r2,  #-120
-        bl              idct_col4_neon
-        add             r2,  r2,  #-128
-        bl              idct_col4_st16_neon
-
-        idct_end
-endfunc
diff --git a/libavcodec/arm/synth_filter_neon.S b/libavcodec/arm/synth_filter_neon.S
deleted file mode 100644
index c168d73..0000000
--- a/libavcodec/arm/synth_filter_neon.S
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-        preserve8
-
-function ff_synth_filter_float_neon, export=1
-        push            {r3-r11,lr}
-
-        ldr             r4,  [r2]               @ synth_buf_offset
-        add             r1,  r1,  r4,  lsl #2   @ synth_buf
-        sub             r12, r4,  #32
-        bfc             r12, #9,  #23
-        bic             r4,  r4,  #63
-        str             r12, [r2]
-
-        ldr             r2,  [sp, #12*4]        @ in
-        mov             r9,  r1                 @ synth_buf
-
-VFP     vpush           {d0}
-        bl              ff_imdct_half_neon
-VFP     vpop            {d0}
-        pop             {r3}
-
-        ldr             r5,  [sp, #9*4]         @ window
-        ldr             r2,  [sp, #10*4]        @ out
-NOVFP   vldr            d0,  [sp, #12*4]        @ scale, bias
-        add             r8,  r9,  #12*4
-
-        mov             lr,  #64*4
-        mov             r1,  #4
-1:
-        add             r10, r9,  #16*4         @ synth_buf
-        add             r11, r8,  #16*4
-        add             r0,  r5,  #16*4         @ window
-        add             r6,  r5,  #32*4
-        add             r7,  r5,  #48*4
-
-        vld1.32         {q10},    [r3,:128]     @ a
-        add             r3,  r3,  #16*4
-        vld1.32         {q1},     [r3,:128]     @ b
-        vmov.f32        q2,  #0.0               @ c
-        vmov.f32        q3,  #0.0               @ d
-
-        mov             r12, #512
-2:
-        vld1.32         {q9},     [r8, :128], lr
-        vrev64.32       q9,  q9
-        vld1.32         {q8},     [r5, :128], lr
-        vmls.f32        d20, d16, d19
-        vld1.32         {q11},    [r0, :128], lr
-        vmls.f32        d21, d17, d18
-        vld1.32         {q12},    [r9, :128], lr
-        vmla.f32        d2,  d22, d24
-        vld1.32         {q8},     [r6, :128], lr
-        vmla.f32        d3,  d23, d25
-        vld1.32         {q9},     [r10,:128], lr
-        vmla.f32        d4,  d16, d18
-        vld1.32         {q12},    [r11,:128], lr
-        vmla.f32        d5,  d17, d19
-        vrev64.32       q12, q12
-        vld1.32         {q11},    [r7, :128], lr
-        vmla.f32        d6,  d22, d25
-        vmla.f32        d7,  d23, d24
-        subs            r12, r12, #64
-        beq             3f
-        cmp             r12, r4
-        bne             2b
-        sub             r8,  r8,  #512*4
-        sub             r9,  r9,  #512*4
-        sub             r10, r10, #512*4
-        sub             r11, r11, #512*4
-        b               2b
-3:
-        vdup.32         q8,  d0[1]
-        vdup.32         q9,  d0[1]
-        vmla.f32        q8,  q10, d0[0]
-        vmla.f32        q9,  q1,  d0[0]
-        vst1.32         {q3},     [r3,:128]
-        sub             r3,  r3,  #16*4
-        vst1.32         {q2},     [r3,:128]
-        vst1.32         {q8},     [r2,:128]
-        add             r2,  r2,  #16*4
-        vst1.32         {q9},     [r2,:128]
-
-        subs            r1,  r1,  #1
-        popeq           {r4-r11,pc}
-
-        cmp             r4,  #0
-        subeq           r8,  r8,  #512*4
-        subeq           r9,  r9,  #512*4
-        sub             r5,  r5,  #512*4
-        sub             r2,  r2,  #12*4         @ out
-        add             r3,  r3,  #4*4          @ synth_buf2
-        add             r5,  r5,  #4*4          @ window
-        add             r9,  r9,  #4*4          @ synth_buf
-        sub             r8,  r8,  #4*4          @ synth_buf
-        b               1b
-endfunc
diff --git a/libavcodec/arm/vp3dsp_neon.S b/libavcodec/arm/vp3dsp_neon.S
deleted file mode 100644
index ade1998..0000000
--- a/libavcodec/arm/vp3dsp_neon.S
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * Copyright (c) 2009 David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-.section .rodata
-.align 4
-
-vp3_idct_constants:
-.short 64277, 60547, 54491, 46341, 36410, 25080, 12785
-
-#define xC1S7 d0[0]
-#define xC2S6 d0[1]
-#define xC3S5 d0[2]
-#define xC4S4 d0[3]
-#define xC5S3 d1[0]
-#define xC6S2 d1[1]
-#define xC7S1 d1[2]
-
-.text
-
-.macro vp3_loop_filter
-    vsubl.u8        q3,  d18, d17
-    vsubl.u8        q2,  d16, d19
-    vadd.i16        q1,  q3,  q3
-    vadd.i16        q2,  q2,  q3
-    vadd.i16        q0,  q1,  q2
-    vrshr.s16       q0,  q0,  #3
-    vmovl.u8        q9,  d18
-    vdup.u16        q15, r2
-
-    vabs.s16        q1,  q0
-    vshr.s16        q0,  q0,  #15
-    vqsub.u16       q2,  q15, q1
-    vqsub.u16       q3,  q2,  q1
-    vsub.i16        q1,  q2,  q3
-    veor            q1,  q1,  q0
-    vsub.i16        q0,  q1,  q0
-
-    vaddw.u8        q2,  q0,  d17
-    vsub.i16        q3,  q9,  q0
-    vqmovun.s16     d0,  q2
-    vqmovun.s16     d1,  q3
-.endm
-
-function ff_vp3_v_loop_filter_neon, export=1
-    sub             ip,  r0,  r1
-    sub             r0,  r0,  r1,  lsl #1
-    vld1.64         {d16}, [r0,:64], r1
-    vld1.64         {d17}, [r0,:64], r1
-    vld1.64         {d18}, [r0,:64], r1
-    vld1.64         {d19}, [r0,:64], r1
-    ldrb            r2,    [r2, #129*4]
-
-    vp3_loop_filter
-
-    vst1.64         {d0},  [ip,:64], r1
-    vst1.64         {d1},  [ip,:64], r1
-    bx              lr
-endfunc
-
-function ff_vp3_h_loop_filter_neon, export=1
-    sub             ip,  r0,  #1
-    sub             r0,  r0,  #2
-    vld1.32         {d16[]},  [r0], r1
-    vld1.32         {d17[]},  [r0], r1
-    vld1.32         {d18[]},  [r0], r1
-    vld1.32         {d19[]},  [r0], r1
-    vld1.32         {d16[1]}, [r0], r1
-    vld1.32         {d17[1]}, [r0], r1
-    vld1.32         {d18[1]}, [r0], r1
-    vld1.32         {d19[1]}, [r0], r1
-    ldrb            r2,  [r2, #129*4]
-
-    vtrn.8          d16, d17
-    vtrn.8          d18, d19
-    vtrn.16         d16, d18
-    vtrn.16         d17, d19
-
-    vp3_loop_filter
-
-    vtrn.8          d0,  d1
-
-    vst1.16         {d0[0]}, [ip], r1
-    vst1.16         {d1[0]}, [ip], r1
-    vst1.16         {d0[1]}, [ip], r1
-    vst1.16         {d1[1]}, [ip], r1
-    vst1.16         {d0[2]}, [ip], r1
-    vst1.16         {d1[2]}, [ip], r1
-    vst1.16         {d0[3]}, [ip], r1
-    vst1.16         {d1[3]}, [ip], r1
-    bx              lr
-endfunc
-
-
-function vp3_idct_start_neon
-    vpush           {d8-d15}
-    movrel          r3,  vp3_idct_constants
-    vld1.64         {d0-d1},   [r3,:128]
-    vld1.64         {d16-d19}, [r2,:128]!
-    vld1.64         {d20-d23}, [r2,:128]!
-    vld1.64         {d24-d27}, [r2,:128]!
-    vadd.s16        q1,  q8,  q12
-    vsub.s16        q8,  q8,  q12
-    vld1.64         {d28-d31}, [r2,:128]!
-endfunc
-
-function vp3_idct_core_neon
-    vmull.s16       q2,  d18, xC1S7     // (ip[1] * C1) << 16
-    vmull.s16       q3,  d19, xC1S7
-    vmull.s16       q4,  d2,  xC4S4     // ((ip[0] + ip[4]) * C4) << 16
-    vmull.s16       q5,  d3,  xC4S4
-    vmull.s16       q6,  d16, xC4S4     // ((ip[0] - ip[4]) * C4) << 16
-    vmull.s16       q7,  d17, xC4S4
-    vshrn.s32       d4,  q2,  #16
-    vshrn.s32       d5,  q3,  #16
-    vshrn.s32       d6,  q4,  #16
-    vshrn.s32       d7,  q5,  #16
-    vshrn.s32       d8,  q6,  #16
-    vshrn.s32       d9,  q7,  #16
-    vadd.s16        q12, q1,  q3        // E = (ip[0] + ip[4]) * C4
-    vadd.s16        q8,  q8,  q4        // F = (ip[0] - ip[4]) * C4
-    vadd.s16        q1,  q2,  q9        // ip[1] * C1
-
-    vmull.s16       q2,  d30, xC1S7     // (ip[7] * C1) << 16
-    vmull.s16       q3,  d31, xC1S7
-    vmull.s16       q4,  d30, xC7S1     // (ip[7] * C7) << 16
-    vmull.s16       q5,  d31, xC7S1
-    vmull.s16       q6,  d18, xC7S1     // (ip[1] * C7) << 16
-    vmull.s16       q7,  d19, xC7S1
-    vshrn.s32       d4,  q2,  #16
-    vshrn.s32       d5,  q3,  #16
-    vshrn.s32       d6,  q4,  #16       // ip[7] * C7
-    vshrn.s32       d7,  q5,  #16
-    vshrn.s32       d8,  q6,  #16       // ip[1] * C7
-    vshrn.s32       d9,  q7,  #16
-    vadd.s16        q2,  q2,  q15       // ip[7] * C1
-    vadd.s16        q9,  q1,  q3        // A = ip[1] * C1 + ip[7] * C7
-    vsub.s16        q15, q4,  q2        // B = ip[1] * C7 - ip[7] * C1
-
-    vmull.s16       q2,  d22, xC5S3     // (ip[3] * C5) << 16
-    vmull.s16       q3,  d23, xC5S3
-    vmull.s16       q4,  d22, xC3S5     // (ip[3] * C3) << 16
-    vmull.s16       q5,  d23, xC3S5
-    vmull.s16       q6,  d26, xC5S3     // (ip[5] * C5) << 16
-    vmull.s16       q7,  d27, xC5S3
-    vshrn.s32       d4,  q2,  #16
-    vshrn.s32       d5,  q3,  #16
-    vshrn.s32       d6,  q4,  #16
-    vshrn.s32       d7,  q5,  #16
-    vshrn.s32       d8,  q6,  #16
-    vshrn.s32       d9,  q7,  #16
-    vadd.s16        q3,  q3,  q11       // ip[3] * C3
-    vadd.s16        q4,  q4,  q13       // ip[5] * C5
-    vadd.s16        q1,  q2,  q11       // ip[3] * C5
-    vadd.s16        q11, q3,  q4        // C = ip[3] * C3 + ip[5] * C5
-
-    vmull.s16       q2,  d26, xC3S5     // (ip[5] * C3) << 16
-    vmull.s16       q3,  d27, xC3S5
-    vmull.s16       q4,  d20, xC2S6     // (ip[2] * C2) << 16
-    vmull.s16       q5,  d21, xC2S6
-    vmull.s16       q6,  d28, xC6S2     // (ip[6] * C6) << 16
-    vmull.s16       q7,  d29, xC6S2
-    vshrn.s32       d4,  q2,  #16
-    vshrn.s32       d5,  q3,  #16
-    vshrn.s32       d6,  q4,  #16
-    vshrn.s32       d7,  q5,  #16
-    vshrn.s32       d8,  q6,  #16       // ip[6] * C6
-    vshrn.s32       d9,  q7,  #16
-    vadd.s16        q2,  q2,  q13       // ip[5] * C3
-    vadd.s16        q3,  q3,  q10       // ip[2] * C2
-    vsub.s16        q13, q2,  q1        // D = ip[5] * C3 - ip[3] * C5
-    vsub.s16        q1,  q9,  q11       // (A - C)
-    vadd.s16        q11, q9,  q11       // Cd = A + C
-    vsub.s16        q9,  q15, q13       // (B - D)
-    vadd.s16        q13, q15, q13       // Dd = B + D
-    vadd.s16        q15, q3,  q4        // G = ip[2] * C2 + ip[6] * C6
-
-    vmull.s16       q2,  d2,  xC4S4     // ((A - C) * C4) << 16
-    vmull.s16       q3,  d3,  xC4S4
-    vmull.s16       q4,  d28, xC2S6     // (ip[6] * C2) << 16
-    vmull.s16       q5,  d29, xC2S6
-    vmull.s16       q6,  d20, xC6S2     // (ip[2] * C6) << 16
-    vmull.s16       q7,  d21, xC6S2
-    vshrn.s32       d4,  q2,  #16
-    vshrn.s32       d5,  q3,  #16
-    vshrn.s32       d6,  q4,  #16
-    vshrn.s32       d7,  q5,  #16
-    vshrn.s32       d8,  q6,  #16       // ip[2] * C6
-    vmull.s16       q5,  d18, xC4S4     // ((B - D) * C4) << 16
-    vmull.s16       q6,  d19, xC4S4
-    vshrn.s32       d9,  q7,  #16
-    vadd.s16        q3,  q3,  q14       // ip[6] * C2
-    vadd.s16        q10, q1,  q2        // Ad = (A - C) * C4
-    vsub.s16        q14, q4,  q3        // H = ip[2] * C6 - ip[6] * C2
-    bx              lr
-endfunc
-
-.macro VP3_IDCT_END type
-function vp3_idct_end_\type\()_neon
-.ifc \type, col
-    vdup.16         q0,  r3
-    vadd.s16        q12, q12, q0
-    vadd.s16        q8,  q8,  q0
-.endif
-
-    vshrn.s32       d2,  q5,  #16
-    vshrn.s32       d3,  q6,  #16
-    vadd.s16        q2,  q12, q15       // Gd  = E + G
-    vadd.s16        q9,  q1,  q9        // (B - D) * C4
-    vsub.s16        q12, q12, q15       // Ed  = E - G
-    vsub.s16        q3,  q8,  q10       // Fd  = F - Ad
-    vadd.s16        q10, q8,  q10       // Add = F + Ad
-    vadd.s16        q4,  q9,  q14       // Hd  = Bd + H
-    vsub.s16        q14, q9,  q14       // Bdd = Bd - H
-    vadd.s16        q8,  q2,  q11       // [0] = Gd + Cd
-    vsub.s16        q15, q2,  q11       // [7] = Gd - Cd
-    vadd.s16        q9,  q10, q4        // [1] = Add + Hd
-    vsub.s16        q10, q10, q4        // [2] = Add - Hd
-    vadd.s16        q11, q12, q13       // [3] = Ed + Dd
-    vsub.s16        q12, q12, q13       // [4] = Ed - Dd
-.ifc \type, row
-    vtrn.16         q8,  q9
-.endif
-    vadd.s16        q13, q3,  q14       // [5] = Fd + Bdd
-    vsub.s16        q14, q3,  q14       // [6] = Fd - Bdd
-
-.ifc \type, row
-    // 8x8 transpose
-    vtrn.16         q10, q11
-    vtrn.16         q12, q13
-    vtrn.16         q14, q15
-    vtrn.32         q8,  q10
-    vtrn.32         q9,  q11
-    vtrn.32         q12, q14
-    vtrn.32         q13, q15
-    vswp            d17, d24
-    vswp            d19, d26
-    vadd.s16        q1,  q8,  q12
-    vswp            d21, d28
-    vsub.s16        q8,  q8,  q12
-    vswp            d23, d30
-.endif
-    bx              lr
-endfunc
-.endm
-
-VP3_IDCT_END row
-VP3_IDCT_END col
-
-function ff_vp3_idct_neon, export=1
-    mov             ip,  lr
-    mov             r2,  r0
-    bl              vp3_idct_start_neon
-    bl              vp3_idct_end_row_neon
-    mov             r3,  #8
-    bl              vp3_idct_core_neon
-    bl              vp3_idct_end_col_neon
-    mov             lr,  ip
-    vpop            {d8-d15}
-
-    vshr.s16        q8,  q8,  #4
-    vshr.s16        q9,  q9,  #4
-    vshr.s16        q10, q10, #4
-    vshr.s16        q11, q11, #4
-    vshr.s16        q12, q12, #4
-    vst1.64         {d16-d19}, [r0,:128]!
-    vshr.s16        q13, q13, #4
-    vshr.s16        q14, q14, #4
-    vst1.64         {d20-d23}, [r0,:128]!
-    vshr.s16        q15, q15, #4
-    vst1.64         {d24-d27}, [r0,:128]!
-    vst1.64         {d28-d31}, [r0,:128]!
-    bx              lr
-endfunc
-
-function ff_vp3_idct_put_neon, export=1
-    mov             ip,  lr
-    bl              vp3_idct_start_neon
-    bl              vp3_idct_end_row_neon
-    mov             r3,  #8
-    add             r3,  r3,  #2048         // convert signed pixel to unsigned
-    bl              vp3_idct_core_neon
-    bl              vp3_idct_end_col_neon
-    mov             lr,  ip
-    vpop            {d8-d15}
-
-    vqshrun.s16     d0,  q8,  #4
-    vqshrun.s16     d1,  q9,  #4
-    vqshrun.s16     d2,  q10, #4
-    vqshrun.s16     d3,  q11, #4
-    vst1.64         {d0}, [r0,:64], r1
-    vqshrun.s16     d4,  q12, #4
-    vst1.64         {d1}, [r0,:64], r1
-    vqshrun.s16     d5,  q13, #4
-    vst1.64         {d2}, [r0,:64], r1
-    vqshrun.s16     d6,  q14, #4
-    vst1.64         {d3}, [r0,:64], r1
-    vqshrun.s16     d7,  q15, #4
-    vst1.64         {d4}, [r0,:64], r1
-    vst1.64         {d5}, [r0,:64], r1
-    vst1.64         {d6}, [r0,:64], r1
-    vst1.64         {d7}, [r0,:64], r1
-    bx              lr
-endfunc
-
-function ff_vp3_idct_add_neon, export=1
-    mov             ip,  lr
-    bl              vp3_idct_start_neon
-    bl              vp3_idct_end_row_neon
-    mov             r3,  #8
-    bl              vp3_idct_core_neon
-    bl              vp3_idct_end_col_neon
-    mov             lr,  ip
-    vpop            {d8-d15}
-    mov             r2,  r0
-
-    vld1.64         {d0}, [r0,:64], r1
-    vshr.s16        q8,  q8,  #4
-    vld1.64         {d1}, [r0,:64], r1
-    vshr.s16        q9,  q9,  #4
-    vld1.64         {d2}, [r0,:64], r1
-    vaddw.u8        q8,  q8,  d0
-    vld1.64         {d3}, [r0,:64], r1
-    vaddw.u8        q9,  q9,  d1
-    vld1.64         {d4}, [r0,:64], r1
-    vshr.s16        q10, q10, #4
-    vld1.64         {d5}, [r0,:64], r1
-    vshr.s16        q11, q11, #4
-    vld1.64         {d6}, [r0,:64], r1
-    vqmovun.s16     d0,  q8
-    vld1.64         {d7}, [r0,:64], r1
-    vqmovun.s16     d1,  q9
-    vaddw.u8        q10, q10, d2
-    vaddw.u8        q11, q11, d3
-    vshr.s16        q12, q12, #4
-    vshr.s16        q13, q13, #4
-    vqmovun.s16     d2,  q10
-    vqmovun.s16     d3,  q11
-    vaddw.u8        q12, q12, d4
-    vaddw.u8        q13, q13, d5
-    vshr.s16        q14, q14, #4
-    vshr.s16        q15, q15, #4
-    vst1.64         {d0}, [r2,:64], r1
-    vqmovun.s16     d4,  q12
-    vst1.64         {d1}, [r2,:64], r1
-    vqmovun.s16     d5,  q13
-    vst1.64         {d2}, [r2,:64], r1
-    vaddw.u8        q14, q14, d6
-    vst1.64         {d3}, [r2,:64], r1
-    vaddw.u8        q15, q15, d7
-    vst1.64         {d4}, [r2,:64], r1
-    vqmovun.s16     d6,  q14
-    vst1.64         {d5}, [r2,:64], r1
-    vqmovun.s16     d7,  q15
-    vst1.64         {d6}, [r2,:64], r1
-    vst1.64         {d7}, [r2,:64], r1
-    bx              lr
-endfunc
-
-function ff_vp3_idct_dc_add_neon, export=1
-    ldrsh           r2,  [r2]
-    movw            r3,  #46341
-    mul             r2,  r3,  r2
-    smulwt          r2,  r3,  r2
-    mov             r3,  r0
-    vdup.16         q15, r2
-    vrshr.s16       q15, q15, #4
-
-    vld1.8          {d0}, [r0,:64], r1
-    vld1.8          {d1}, [r0,:64], r1
-    vld1.8          {d2}, [r0,:64], r1
-    vaddw.u8        q8,  q15, d0
-    vld1.8          {d3}, [r0,:64], r1
-    vaddw.u8        q9,  q15, d1
-    vld1.8          {d4}, [r0,:64], r1
-    vaddw.u8        q10, q15, d2
-    vld1.8          {d5}, [r0,:64], r1
-    vaddw.u8        q11, q15, d3
-    vld1.8          {d6}, [r0,:64], r1
-    vaddw.u8        q12, q15, d4
-    vld1.8          {d7}, [r0,:64], r1
-    vaddw.u8        q13, q15, d5
-    vqmovun.s16     d0,  q8
-    vaddw.u8        q14, q15, d6
-    vqmovun.s16     d1,  q9
-    vaddw.u8        q15, q15, d7
-    vqmovun.s16     d2,  q10
-    vst1.8          {d0}, [r3,:64], r1
-    vqmovun.s16     d3,  q11
-    vst1.8          {d1}, [r3,:64], r1
-    vqmovun.s16     d4,  q12
-    vst1.8          {d2}, [r3,:64], r1
-    vqmovun.s16     d5,  q13
-    vst1.8          {d3}, [r3,:64], r1
-    vqmovun.s16     d6,  q14
-    vst1.8          {d4}, [r3,:64], r1
-    vqmovun.s16     d7,  q15
-    vst1.8          {d5}, [r3,:64], r1
-    vst1.8          {d6}, [r3,:64], r1
-    vst1.8          {d7}, [r3,:64], r1
-    bx              lr
-endfunc
diff --git a/libavcodec/arm/vp56dsp_init_arm.c b/libavcodec/arm/vp56dsp_init_arm.c
deleted file mode 100644
index ceab9a8..0000000
--- a/libavcodec/arm/vp56dsp_init_arm.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-#include "libavcodec/avcodec.h"
-#include "libavcodec/vp56dsp.h"
-
-void ff_vp6_edge_filter_hor_neon(uint8_t *yuv, int stride, int t);
-void ff_vp6_edge_filter_ver_neon(uint8_t *yuv, int stride, int t);
-
-void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec)
-{
-    if (codec != CODEC_ID_VP5 && HAVE_NEON) {
-        s->edge_filter_hor = ff_vp6_edge_filter_hor_neon;
-        s->edge_filter_ver = ff_vp6_edge_filter_ver_neon;
-    }
-}
diff --git a/libavcodec/arm/vp56dsp_neon.S b/libavcodec/arm/vp56dsp_neon.S
deleted file mode 100644
index 0353661..0000000
--- a/libavcodec/arm/vp56dsp_neon.S
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asm.S"
-
-.macro  vp6_edge_filter
-        vdup.16         q3,  r2                 @ t
-        vmov.i16        q13, #1
-        vsubl.u8        q0,  d20, d18           @ p[   0] - p[-s]
-        vsubl.u8        q1,  d16, d22           @ p[-2*s] - p[ s]
-        vsubl.u8        q14, d21, d19
-        vsubl.u8        q15, d17, d23
-        vadd.i16        q2,  q0,  q0            @ 2*(p[0]-p[-s])
-        vadd.i16        d29, d28, d28
-        vadd.i16        q0,  q0,  q1            @    p[0]-p[-s]  + p[-2*s]-p[s]
-        vadd.i16        d28, d28, d30
-        vadd.i16        q0,  q0,  q2            @ 3*(p[0]-p[-s]) + p[-2*s]-p[s]
-        vadd.i16        d28, d28, d29
-        vrshr.s16       q0,  q0,  #3            @ v
-        vrshr.s16       d28, d28, #3
-        vsub.i16        q8,  q3,  q13           @ t-1
-        vabs.s16        q1,  q0                 @ V
-        vshr.s16        q2,  q0,  #15           @ s
-        vabs.s16        d30, d28
-        vshr.s16        d29, d28, #15
-        vsub.i16        q12, q1,  q3            @ V-t
-        vsub.i16        d31, d30, d6
-        vsub.i16        q12, q12, q13           @ V-t-1
-        vsub.i16        d31, d31, d26
-        vcge.u16        q12, q12, q8            @ V-t-1 >= t-1
-        vcge.u16        d31, d31, d16
-        vadd.i16        q13, q3,  q3            @ 2*t
-        vadd.i16        d16, d6,  d6
-        vsub.i16        q13, q13, q1            @ 2*t - V
-        vsub.i16        d16, d16, d30
-        vadd.i16        q13, q13, q2            @ += s
-        vadd.i16        d16, d16, d29
-        veor            q13, q13, q2            @ ^= s
-        veor            d16, d16, d29
-        vbif            q0,  q13, q12
-        vbif            d28, d16, d31
-        vmovl.u8        q1,  d20
-        vmovl.u8        q15, d21
-        vaddw.u8        q2,  q0,  d18
-        vaddw.u8        q3,  q14, d19
-        vsub.i16        q1,  q1,  q0
-        vsub.i16        d30, d30, d28
-        vqmovun.s16     d18, q2
-        vqmovun.s16     d19, q3
-        vqmovun.s16     d20, q1
-        vqmovun.s16     d21, q15
-.endm
-
-function ff_vp6_edge_filter_ver_neon, export=1
-        sub             r0,  r0,  r1,  lsl #1
-        vld1.8          {q8},     [r0], r1      @ p[-2*s]
-        vld1.8          {q9},     [r0], r1      @ p[-s]
-        vld1.8          {q10},    [r0], r1      @ p[0]
-        vld1.8          {q11},    [r0]          @ p[s]
-        vp6_edge_filter
-        sub             r0,  r0,  r1,  lsl #1
-        sub             r1,  r1,  #8
-        vst1.8          {d18},    [r0]!
-        vst1.32         {d19[0]}, [r0], r1
-        vst1.8          {d20},    [r0]!
-        vst1.32         {d21[0]}, [r0]
-        bx              lr
-endfunc
-
-function ff_vp6_edge_filter_hor_neon, export=1
-        sub             r3,  r0,  #1
-        sub             r0,  r0,  #2
-        vld1.32         {d16[0]}, [r0], r1
-        vld1.32         {d18[0]}, [r0], r1
-        vld1.32         {d20[0]}, [r0], r1
-        vld1.32         {d22[0]}, [r0], r1
-        vld1.32         {d16[1]}, [r0], r1
-        vld1.32         {d18[1]}, [r0], r1
-        vld1.32         {d20[1]}, [r0], r1
-        vld1.32         {d22[1]}, [r0], r1
-        vld1.32         {d17[0]}, [r0], r1
-        vld1.32         {d19[0]}, [r0], r1
-        vld1.32         {d21[0]}, [r0], r1
-        vld1.32         {d23[0]}, [r0], r1
-        vtrn.8          q8,  q9
-        vtrn.8          q10, q11
-        vtrn.16         q8,  q10
-        vtrn.16         q9,  q11
-        vp6_edge_filter
-        vtrn.8          q9,  q10
-        vst1.16         {d18[0]}, [r3], r1
-        vst1.16         {d20[0]}, [r3], r1
-        vst1.16         {d18[1]}, [r3], r1
-        vst1.16         {d20[1]}, [r3], r1
-        vst1.16         {d18[2]}, [r3], r1
-        vst1.16         {d20[2]}, [r3], r1
-        vst1.16         {d18[3]}, [r3], r1
-        vst1.16         {d20[3]}, [r3], r1
-        vst1.16         {d19[0]}, [r3], r1
-        vst1.16         {d21[0]}, [r3], r1
-        vst1.16         {d19[1]}, [r3], r1
-        vst1.16         {d21[1]}, [r3], r1
-        bx              lr
-endfunc
diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c
deleted file mode 100644
index 211a13f..0000000
--- a/libavcodec/asv1.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * ASUS V1/V2 codec
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * ASUS V1/V2 codec.
- */
-
-#include "avcodec.h"
-#include "libavutil/common.h"
-#include "put_bits.h"
-#include "dsputil.h"
-#include "mpeg12data.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-#define VLC_BITS 6
-#define ASV2_LEVEL_VLC_BITS 10
-
-typedef struct ASV1Context{
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame picture;
-    PutBitContext pb;
-    GetBitContext gb;
-    ScanTable scantable;
-    int inv_qscale;
-    int mb_width;
-    int mb_height;
-    int mb_width2;
-    int mb_height2;
-    DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
-    uint16_t intra_matrix[64];
-    int q_intra_matrix[64];
-    uint8_t *bitstream_buffer;
-    unsigned int bitstream_buffer_size;
-} ASV1Context;
-
-static const uint8_t scantab[64]={
-    0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19,
-    0x02,0x0A,0x03,0x0B,0x12,0x1A,0x13,0x1B,
-    0x04,0x0C,0x05,0x0D,0x20,0x28,0x21,0x29,
-    0x06,0x0E,0x07,0x0F,0x14,0x1C,0x15,0x1D,
-    0x22,0x2A,0x23,0x2B,0x30,0x38,0x31,0x39,
-    0x16,0x1E,0x17,0x1F,0x24,0x2C,0x25,0x2D,
-    0x32,0x3A,0x33,0x3B,0x26,0x2E,0x27,0x2F,
-    0x34,0x3C,0x35,0x3D,0x36,0x3E,0x37,0x3F,
-};
-
-
-static const uint8_t ccp_tab[17][2]={
-    {0x2,2}, {0x7,5}, {0xB,5}, {0x3,5},
-    {0xD,5}, {0x5,5}, {0x9,5}, {0x1,5},
-    {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5},
-    {0xC,5}, {0x4,5}, {0x8,5}, {0x3,2},
-    {0xF,5}, //EOB
-};
-
-static const uint8_t level_tab[7][2]={
-    {3,4}, {3,3}, {3,2}, {0,3}, {2,2}, {2,3}, {2,4}
-};
-
-static const uint8_t dc_ccp_tab[8][2]={
-    {0x1,2}, {0xD,4}, {0xF,4}, {0xC,4},
-    {0x5,3}, {0xE,4}, {0x4,3}, {0x0,2},
-};
-
-static const uint8_t ac_ccp_tab[16][2]={
-    {0x00,2}, {0x3B,6}, {0x0A,4}, {0x3A,6},
-    {0x02,3}, {0x39,6}, {0x3C,6}, {0x38,6},
-    {0x03,3}, {0x3D,6}, {0x08,4}, {0x1F,5},
-    {0x09,4}, {0x0B,4}, {0x0D,4}, {0x0C,4},
-};
-
-static const uint8_t asv2_level_tab[63][2]={
-    {0x3F,10},{0x2F,10},{0x37,10},{0x27,10},{0x3B,10},{0x2B,10},{0x33,10},{0x23,10},
-    {0x3D,10},{0x2D,10},{0x35,10},{0x25,10},{0x39,10},{0x29,10},{0x31,10},{0x21,10},
-    {0x1F, 8},{0x17, 8},{0x1B, 8},{0x13, 8},{0x1D, 8},{0x15, 8},{0x19, 8},{0x11, 8},
-    {0x0F, 6},{0x0B, 6},{0x0D, 6},{0x09, 6},
-    {0x07, 4},{0x05, 4},
-    {0x03, 2},
-    {0x00, 5},
-    {0x02, 2},
-    {0x04, 4},{0x06, 4},
-    {0x08, 6},{0x0C, 6},{0x0A, 6},{0x0E, 6},
-    {0x10, 8},{0x18, 8},{0x14, 8},{0x1C, 8},{0x12, 8},{0x1A, 8},{0x16, 8},{0x1E, 8},
-    {0x20,10},{0x30,10},{0x28,10},{0x38,10},{0x24,10},{0x34,10},{0x2C,10},{0x3C,10},
-    {0x22,10},{0x32,10},{0x2A,10},{0x3A,10},{0x26,10},{0x36,10},{0x2E,10},{0x3E,10},
-};
-
-
-static VLC ccp_vlc;
-static VLC level_vlc;
-static VLC dc_ccp_vlc;
-static VLC ac_ccp_vlc;
-static VLC asv2_level_vlc;
-
-static av_cold void init_vlcs(ASV1Context *a){
-    static int done = 0;
-
-    if (!done) {
-        done = 1;
-
-        INIT_VLC_STATIC(&ccp_vlc, VLC_BITS, 17,
-                 &ccp_tab[0][1], 2, 1,
-                 &ccp_tab[0][0], 2, 1, 64);
-        INIT_VLC_STATIC(&dc_ccp_vlc, VLC_BITS, 8,
-                 &dc_ccp_tab[0][1], 2, 1,
-                 &dc_ccp_tab[0][0], 2, 1, 64);
-        INIT_VLC_STATIC(&ac_ccp_vlc, VLC_BITS, 16,
-                 &ac_ccp_tab[0][1], 2, 1,
-                 &ac_ccp_tab[0][0], 2, 1, 64);
-        INIT_VLC_STATIC(&level_vlc,  VLC_BITS, 7,
-                 &level_tab[0][1], 2, 1,
-                 &level_tab[0][0], 2, 1, 64);
-        INIT_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63,
-                 &asv2_level_tab[0][1], 2, 1,
-                 &asv2_level_tab[0][0], 2, 1, 1024);
-    }
-}
-
-//FIXME write a reversed bitstream reader to avoid the double reverse
-static inline int asv2_get_bits(GetBitContext *gb, int n){
-    return av_reverse[ get_bits(gb, n) << (8-n) ];
-}
-
-static inline void asv2_put_bits(PutBitContext *pb, int n, int v){
-    put_bits(pb, n, av_reverse[ v << (8-n) ]);
-}
-
-static inline int asv1_get_level(GetBitContext *gb){
-    int code= get_vlc2(gb, level_vlc.table, VLC_BITS, 1);
-
-    if(code==3) return get_sbits(gb, 8);
-    else        return code - 3;
-}
-
-static inline int asv2_get_level(GetBitContext *gb){
-    int code= get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1);
-
-    if(code==31) return (int8_t)asv2_get_bits(gb, 8);
-    else         return code - 31;
-}
-
-static inline void asv1_put_level(PutBitContext *pb, int level){
-    unsigned int index= level + 3;
-
-    if(index <= 6) put_bits(pb, level_tab[index][1], level_tab[index][0]);
-    else{
-        put_bits(pb, level_tab[3][1], level_tab[3][0]);
-        put_sbits(pb, 8, level);
-    }
-}
-
-static inline void asv2_put_level(PutBitContext *pb, int level){
-    unsigned int index= level + 31;
-
-    if(index <= 62) put_bits(pb, asv2_level_tab[index][1], asv2_level_tab[index][0]);
-    else{
-        put_bits(pb, asv2_level_tab[31][1], asv2_level_tab[31][0]);
-        asv2_put_bits(pb, 8, level&0xFF);
-    }
-}
-
-static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){
-    int i;
-
-    block[0]= 8*get_bits(&a->gb, 8);
-
-    for(i=0; i<11; i++){
-        const int ccp= get_vlc2(&a->gb, ccp_vlc.table, VLC_BITS, 1);
-
-        if(ccp){
-            if(ccp == 16) break;
-            if(ccp < 0 || i>=10){
-                av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
-                return -1;
-            }
-
-            if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4;
-            if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4;
-            if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4;
-            if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4;
-        }
-    }
-
-    return 0;
-}
-
-static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]){
-    int i, count, ccp;
-
-    count= asv2_get_bits(&a->gb, 4);
-
-    block[0]= 8*asv2_get_bits(&a->gb, 8);
-
-    ccp= get_vlc2(&a->gb, dc_ccp_vlc.table, VLC_BITS, 1);
-    if(ccp){
-        if(ccp&4) block[a->scantable.permutated[1]]= (asv2_get_level(&a->gb) * a->intra_matrix[1])>>4;
-        if(ccp&2) block[a->scantable.permutated[2]]= (asv2_get_level(&a->gb) * a->intra_matrix[2])>>4;
-        if(ccp&1) block[a->scantable.permutated[3]]= (asv2_get_level(&a->gb) * a->intra_matrix[3])>>4;
-    }
-
-    for(i=1; i<count+1; i++){
-        const int ccp= get_vlc2(&a->gb, ac_ccp_vlc.table, VLC_BITS, 1);
-
-        if(ccp){
-            if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4;
-            if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4;
-            if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4;
-            if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4;
-        }
-    }
-
-    return 0;
-}
-
-static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){
-    int i;
-    int nc_count=0;
-
-    put_bits(&a->pb, 8, (block[0] + 32)>>6);
-    block[0]= 0;
-
-    for(i=0; i<10; i++){
-        const int index= scantab[4*i];
-        int ccp=0;
-
-        if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
-        if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
-        if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
-        if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
-
-        if(ccp){
-            for(;nc_count; nc_count--)
-                put_bits(&a->pb, ccp_tab[0][1], ccp_tab[0][0]);
-
-            put_bits(&a->pb, ccp_tab[ccp][1], ccp_tab[ccp][0]);
-
-            if(ccp&8) asv1_put_level(&a->pb, block[index + 0]);
-            if(ccp&4) asv1_put_level(&a->pb, block[index + 8]);
-            if(ccp&2) asv1_put_level(&a->pb, block[index + 1]);
-            if(ccp&1) asv1_put_level(&a->pb, block[index + 9]);
-        }else{
-            nc_count++;
-        }
-    }
-    put_bits(&a->pb, ccp_tab[16][1], ccp_tab[16][0]);
-}
-
-static inline void asv2_encode_block(ASV1Context *a, DCTELEM block[64]){
-    int i;
-    int count=0;
-
-    for(count=63; count>3; count--){
-        const int index= scantab[count];
-
-        if( (block[index]*a->q_intra_matrix[index] + (1<<15))>>16 )
-            break;
-    }
-
-    count >>= 2;
-
-    asv2_put_bits(&a->pb, 4, count);
-    asv2_put_bits(&a->pb, 8, (block[0] + 32)>>6);
-    block[0]= 0;
-
-    for(i=0; i<=count; i++){
-        const int index= scantab[4*i];
-        int ccp=0;
-
-        if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8;
-        if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4;
-        if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2;
-        if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1;
-
-        assert(i || ccp<8);
-        if(i) put_bits(&a->pb, ac_ccp_tab[ccp][1], ac_ccp_tab[ccp][0]);
-        else  put_bits(&a->pb, dc_ccp_tab[ccp][1], dc_ccp_tab[ccp][0]);
-
-        if(ccp){
-            if(ccp&8) asv2_put_level(&a->pb, block[index + 0]);
-            if(ccp&4) asv2_put_level(&a->pb, block[index + 8]);
-            if(ccp&2) asv2_put_level(&a->pb, block[index + 1]);
-            if(ccp&1) asv2_put_level(&a->pb, block[index + 9]);
-        }
-    }
-}
-
-static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
-    int i;
-
-    a->dsp.clear_blocks(block[0]);
-
-    if(a->avctx->codec_id == CODEC_ID_ASV1){
-        for(i=0; i<6; i++){
-            if( asv1_decode_block(a, block[i]) < 0)
-                return -1;
-        }
-    }else{
-        for(i=0; i<6; i++){
-            if( asv2_decode_block(a, block[i]) < 0)
-                return -1;
-        }
-    }
-    return 0;
-}
-
-static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){
-    int i;
-
-    if(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < 30*16*16*3/2/8){
-        av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-
-    if(a->avctx->codec_id == CODEC_ID_ASV1){
-        for(i=0; i<6; i++)
-            asv1_encode_block(a, block[i]);
-    }else{
-        for(i=0; i<6; i++)
-            asv2_encode_block(a, block[i]);
-    }
-    return 0;
-}
-
-static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){
-    DCTELEM (*block)[64]= a->block;
-    int linesize= a->picture.linesize[0];
-
-    uint8_t *dest_y  = a->picture.data[0] + (mb_y * 16* linesize              ) + mb_x * 16;
-    uint8_t *dest_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8;
-    uint8_t *dest_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8;
-
-    a->dsp.idct_put(dest_y                 , linesize, block[0]);
-    a->dsp.idct_put(dest_y              + 8, linesize, block[1]);
-    a->dsp.idct_put(dest_y + 8*linesize    , linesize, block[2]);
-    a->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
-
-    if(!(a->avctx->flags&CODEC_FLAG_GRAY)){
-        a->dsp.idct_put(dest_cb, a->picture.linesize[1], block[4]);
-        a->dsp.idct_put(dest_cr, a->picture.linesize[2], block[5]);
-    }
-}
-
-static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){
-    DCTELEM (*block)[64]= a->block;
-    int linesize= a->picture.linesize[0];
-    int i;
-
-    uint8_t *ptr_y  = a->picture.data[0] + (mb_y * 16* linesize              ) + mb_x * 16;
-    uint8_t *ptr_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8;
-    uint8_t *ptr_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8;
-
-    a->dsp.get_pixels(block[0], ptr_y                 , linesize);
-    a->dsp.get_pixels(block[1], ptr_y              + 8, linesize);
-    a->dsp.get_pixels(block[2], ptr_y + 8*linesize    , linesize);
-    a->dsp.get_pixels(block[3], ptr_y + 8*linesize + 8, linesize);
-    for(i=0; i<4; i++)
-        a->dsp.fdct(block[i]);
-
-    if(!(a->avctx->flags&CODEC_FLAG_GRAY)){
-        a->dsp.get_pixels(block[4], ptr_cb, a->picture.linesize[1]);
-        a->dsp.get_pixels(block[5], ptr_cr, a->picture.linesize[2]);
-        for(i=4; i<6; i++)
-            a->dsp.fdct(block[i]);
-    }
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    ASV1Context * const a = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p= &a->picture;
-    int mb_x, mb_y;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!a->bitstream_buffer)
-        return AVERROR(ENOMEM);
-
-    if(avctx->codec_id == CODEC_ID_ASV1)
-        a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4);
-    else{
-        int i;
-        for(i=0; i<buf_size; i++)
-            a->bitstream_buffer[i]= av_reverse[ buf[i] ];
-    }
-
-    init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8);
-
-    for(mb_y=0; mb_y<a->mb_height2; mb_y++){
-        for(mb_x=0; mb_x<a->mb_width2; mb_x++){
-            if( decode_mb(a, a->block) <0)
-                return -1;
-
-            idct_put(a, mb_x, mb_y);
-        }
-    }
-
-    if(a->mb_width2 != a->mb_width){
-        mb_x= a->mb_width2;
-        for(mb_y=0; mb_y<a->mb_height2; mb_y++){
-            if( decode_mb(a, a->block) <0)
-                return -1;
-
-            idct_put(a, mb_x, mb_y);
-        }
-    }
-
-    if(a->mb_height2 != a->mb_height){
-        mb_y= a->mb_height2;
-        for(mb_x=0; mb_x<a->mb_width; mb_x++){
-            if( decode_mb(a, a->block) <0)
-                return -1;
-
-            idct_put(a, mb_x, mb_y);
-        }
-    }
-#if 0
-int i;
-printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb));
-for(i=get_bits_count(&a->gb); i<8*buf_size; i++){
-    printf("%d", get_bits1(&a->gb));
-}
-
-for(i=0; i<s->avctx->extradata_size; i++){
-    printf("%c\n", ((uint8_t*)s->avctx->extradata)[i]);
-}
-#endif
-
-    *picture= *(AVFrame*)&a->picture;
-    *data_size = sizeof(AVPicture);
-
-    emms_c();
-
-    return (get_bits_count(&a->gb)+31)/32*4;
-}
-
-#if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    ASV1Context * const a = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= &a->picture;
-    int size;
-    int mb_x, mb_y;
-
-    init_put_bits(&a->pb, buf, buf_size);
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    for(mb_y=0; mb_y<a->mb_height2; mb_y++){
-        for(mb_x=0; mb_x<a->mb_width2; mb_x++){
-            dct_get(a, mb_x, mb_y);
-            encode_mb(a, a->block);
-        }
-    }
-
-    if(a->mb_width2 != a->mb_width){
-        mb_x= a->mb_width2;
-        for(mb_y=0; mb_y<a->mb_height2; mb_y++){
-            dct_get(a, mb_x, mb_y);
-            encode_mb(a, a->block);
-        }
-    }
-
-    if(a->mb_height2 != a->mb_height){
-        mb_y= a->mb_height2;
-        for(mb_x=0; mb_x<a->mb_width; mb_x++){
-            dct_get(a, mb_x, mb_y);
-            encode_mb(a, a->block);
-        }
-    }
-    emms_c();
-
-    align_put_bits(&a->pb);
-    while(put_bits_count(&a->pb)&31)
-        put_bits(&a->pb, 8, 0);
-
-    size= put_bits_count(&a->pb)/32;
-
-    if(avctx->codec_id == CODEC_ID_ASV1)
-        a->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size);
-    else{
-        int i;
-        for(i=0; i<4*size; i++)
-            buf[i]= av_reverse[ buf[i] ];
-    }
-
-    return size*4;
-}
-#endif /* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */
-
-static av_cold void common_init(AVCodecContext *avctx){
-    ASV1Context * const a = avctx->priv_data;
-
-    dsputil_init(&a->dsp, avctx);
-
-    a->mb_width   = (avctx->width  + 15) / 16;
-    a->mb_height  = (avctx->height + 15) / 16;
-    a->mb_width2  = (avctx->width  + 0) / 16;
-    a->mb_height2 = (avctx->height + 0) / 16;
-
-    avctx->coded_frame= &a->picture;
-    a->avctx= avctx;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-    ASV1Context * const a = avctx->priv_data;
-    AVFrame *p= &a->picture;
-    int i;
-    const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2;
-
-    common_init(avctx);
-    init_vlcs(a);
-    ff_init_scantable(a->dsp.idct_permutation, &a->scantable, scantab);
-    avctx->pix_fmt= PIX_FMT_YUV420P;
-
-    a->inv_qscale= avctx->extradata[0];
-    if(a->inv_qscale == 0){
-        av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n");
-        if(avctx->codec_id == CODEC_ID_ASV1)
-            a->inv_qscale= 6;
-        else
-            a->inv_qscale= 10;
-    }
-
-    for(i=0; i<64; i++){
-        int index= scantab[i];
-
-        a->intra_matrix[i]= 64*scale*ff_mpeg1_default_intra_matrix[index] / a->inv_qscale;
-    }
-
-    p->qstride= a->mb_width;
-    p->qscale_table= av_malloc( p->qstride * a->mb_height);
-    p->quality= (32*scale + a->inv_qscale/2)/a->inv_qscale;
-    memset(p->qscale_table, p->quality, p->qstride*a->mb_height);
-
-    return 0;
-}
-
-#if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER
-static av_cold int encode_init(AVCodecContext *avctx){
-    ASV1Context * const a = avctx->priv_data;
-    int i;
-    const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2;
-
-    common_init(avctx);
-
-    if(avctx->global_quality == 0) avctx->global_quality= 4*FF_QUALITY_SCALE;
-
-    a->inv_qscale= (32*scale*FF_QUALITY_SCALE +  avctx->global_quality/2) / avctx->global_quality;
-
-    avctx->extradata= av_mallocz(8);
-    avctx->extradata_size=8;
-    ((uint32_t*)avctx->extradata)[0]= le2me_32(a->inv_qscale);
-    ((uint32_t*)avctx->extradata)[1]= le2me_32(AV_RL32("ASUS"));
-
-    for(i=0; i<64; i++){
-        int q= 32*scale*ff_mpeg1_default_intra_matrix[i];
-        a->q_intra_matrix[i]= ((a->inv_qscale<<16) + q/2) / q;
-    }
-
-    return 0;
-}
-#endif /* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    ASV1Context * const a = avctx->priv_data;
-
-    av_freep(&a->bitstream_buffer);
-    av_freep(&a->picture.qscale_table);
-    a->bitstream_buffer_size=0;
-
-    if(a->picture.data[0])
-        avctx->release_buffer(avctx, &a->picture);
-
-    return 0;
-}
-
-AVCodec asv1_decoder = {
-    "asv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ASV1,
-    sizeof(ASV1Context),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
-};
-
-AVCodec asv2_decoder = {
-    "asv2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ASV2,
-    sizeof(ASV1Context),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
-};
-
-#if CONFIG_ASV1_ENCODER
-AVCodec asv1_encoder = {
-    "asv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ASV1,
-    sizeof(ASV1Context),
-    encode_init,
-    encode_frame,
-    //encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
-};
-#endif
-
-#if CONFIG_ASV2_ENCODER
-AVCodec asv2_encoder = {
-    "asv2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ASV2,
-    sizeof(ASV1Context),
-    encode_init,
-    encode_frame,
-    //encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
-};
-#endif
diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c
deleted file mode 100644
index e398cee..0000000
--- a/libavcodec/atrac.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Atrac common functions
- * Copyright (c) 2006-2008 Maxim Poliakovski
- * Copyright (c) 2006-2008 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- */
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "atrac.h"
-
-float sf_table[64];
-float qmf_window[48];
-
-static const float qmf_48tap_half[24] = {
-   -0.00001461907, -0.00009205479,-0.000056157569,0.00030117269,
-    0.0002422519,  -0.00085293897,-0.0005205574,  0.0020340169,
-    0.00078333891, -0.0042153862, -0.00075614988, 0.0078402944,
-   -0.000061169922,-0.01344162,    0.0024626821,  0.021736089,
-   -0.007801671,   -0.034090221,   0.01880949,    0.054326009,
-   -0.043596379,   -0.099384367,   0.13207909,    0.46424159
-};
-
-/**
- * Generate common tables
- */
-
-void atrac_generate_tables(void)
-{
-    int i;
-    float s;
-
-    /* Generate scale factors */
-    if (!sf_table[63])
-        for (i=0 ; i<64 ; i++)
-            sf_table[i] = pow(2.0, (i - 15) / 3.0);
-
-    /* Generate the QMF window. */
-    if (!qmf_window[47])
-        for (i=0 ; i<24; i++) {
-            s = qmf_48tap_half[i] * 2.0;
-            qmf_window[i] = qmf_window[47 - i] = s;
-        }
-}
-
-
-/**
- * Quadrature mirror synthesis filter.
- *
- * @param inlo      lower part of spectrum
- * @param inhi      higher part of spectrum
- * @param nIn       size of spectrum buffer
- * @param pOut      out buffer
- * @param delayBuf  delayBuf buffer
- * @param temp      temp buffer
- */
-
-
-void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp)
-{
-    int   i, j;
-    float   *p1, *p3;
-
-    memcpy(temp, delayBuf, 46*sizeof(float));
-
-    p3 = temp + 46;
-
-    /* loop1 */
-    for(i=0; i<nIn; i+=2){
-        p3[2*i+0] = inlo[i  ] + inhi[i  ];
-        p3[2*i+1] = inlo[i  ] - inhi[i  ];
-        p3[2*i+2] = inlo[i+1] + inhi[i+1];
-        p3[2*i+3] = inlo[i+1] - inhi[i+1];
-    }
-
-    /* loop2 */
-    p1 = temp;
-    for (j = nIn; j != 0; j--) {
-        float s1 = 0.0;
-        float s2 = 0.0;
-
-        for (i = 0; i < 48; i += 2) {
-            s1 += p1[i] * qmf_window[i];
-            s2 += p1[i+1] * qmf_window[i+1];
-        }
-
-        pOut[0] = s2;
-        pOut[1] = s1;
-
-        p1 += 2;
-        pOut += 2;
-    }
-
-    /* Update the delay buffer. */
-    memcpy(delayBuf, temp + nIn*2, 46*sizeof(float));
-}
-
diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h
deleted file mode 100644
index 0732da0..0000000
--- a/libavcodec/atrac.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Atrac common data
- * Copyright (c) 2009 Maxim Poliakovski
- * Copyright (c) 2009 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Atrac common header
- */
-
-#ifndef AVCODEC_ATRAC_H
-#define AVCODEC_ATRAC_H
-
-
-extern float sf_table[64];
-extern float qmf_window[48];
-
-void atrac_generate_tables(void);
-void atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp);
-
-#endif /* AVCODEC_ATRAC_H */
diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
deleted file mode 100644
index 5ff8816..0000000
--- a/libavcodec/atrac1.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Atrac 1 compatible decoder
- * Copyright (c) 2009 Maxim Poliakovski
- * Copyright (c) 2009 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Atrac 1 compatible decoder.
- * This decoder handles raw ATRAC1 data and probably SDDS data.
- */
-
-/* Many thanks to Tim Craig for all the help! */
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-
-#include "atrac.h"
-#include "atrac1data.h"
-
-#define AT1_MAX_BFU      52                 ///< max number of block floating units in a sound unit
-#define AT1_SU_SIZE      212                ///< number of bytes in a sound unit
-#define AT1_SU_SAMPLES   512                ///< number of samples in a sound unit
-#define AT1_FRAME_SIZE   AT1_SU_SIZE * 2
-#define AT1_SU_MAX_BITS  AT1_SU_SIZE * 8
-#define AT1_MAX_CHANNELS 2
-
-#define AT1_QMF_BANDS    3
-#define IDX_LOW_BAND     0
-#define IDX_MID_BAND     1
-#define IDX_HIGH_BAND    2
-
-/**
- * Sound unit struct, one unit is used per channel
- */
-typedef struct {
-    int                 log2_block_count[AT1_QMF_BANDS];    ///< log2 number of blocks in a band
-    int                 num_bfus;                           ///< number of Block Floating Units
-    float*              spectrum[2];
-    DECLARE_ALIGNED(16, float, spec1)[AT1_SU_SAMPLES];     ///< mdct buffer
-    DECLARE_ALIGNED(16, float, spec2)[AT1_SU_SAMPLES];     ///< mdct buffer
-    DECLARE_ALIGNED(16, float, fst_qmf_delay)[46];         ///< delay line for the 1st stacked QMF filter
-    DECLARE_ALIGNED(16, float, snd_qmf_delay)[46];         ///< delay line for the 2nd stacked QMF filter
-    DECLARE_ALIGNED(16, float, last_qmf_delay)[256+23];    ///< delay line for the last stacked QMF filter
-} AT1SUCtx;
-
-/**
- * The atrac1 context, holds all needed parameters for decoding
- */
-typedef struct {
-    AT1SUCtx            SUs[AT1_MAX_CHANNELS];              ///< channel sound unit
-    DECLARE_ALIGNED(16, float, spec)[AT1_SU_SAMPLES];      ///< the mdct spectrum buffer
-
-    DECLARE_ALIGNED(16, float,  low)[256];
-    DECLARE_ALIGNED(16, float,  mid)[256];
-    DECLARE_ALIGNED(16, float, high)[512];
-    float*              bands[3];
-    DECLARE_ALIGNED(16, float, out_samples)[AT1_MAX_CHANNELS][AT1_SU_SAMPLES];
-    FFTContext          mdct_ctx[3];
-    int                 channels;
-    DSPContext          dsp;
-} AT1Ctx;
-
-/** size of the transform in samples in the long mode for each QMF band */
-static const uint16_t samples_per_band[3] = {128, 128, 256};
-static const uint8_t   mdct_long_nbits[3] = {7, 7, 8};
-
-
-static void at1_imdct(AT1Ctx *q, float *spec, float *out, int nbits,
-                      int rev_spec)
-{
-    FFTContext* mdct_context = &q->mdct_ctx[nbits - 5 - (nbits > 6)];
-    int transf_size = 1 << nbits;
-
-    if (rev_spec) {
-        int i;
-        for (i = 0; i < transf_size / 2; i++)
-            FFSWAP(float, spec[i], spec[transf_size - 1 - i]);
-    }
-    ff_imdct_half(mdct_context, out, spec);
-}
-
-
-static int at1_imdct_block(AT1SUCtx* su, AT1Ctx *q)
-{
-    int          band_num, band_samples, log2_block_count, nbits, num_blocks, block_size;
-    unsigned int start_pos, ref_pos = 0, pos = 0;
-
-    for (band_num = 0; band_num < AT1_QMF_BANDS; band_num++) {
-        float *prev_buf;
-        int j;
-
-        band_samples = samples_per_band[band_num];
-        log2_block_count = su->log2_block_count[band_num];
-
-        /* number of mdct blocks in the current QMF band: 1 - for long mode */
-        /* 4 for short mode(low/middle bands) and 8 for short mode(high band)*/
-        num_blocks = 1 << log2_block_count;
-
-        if (num_blocks == 1) {
-            /* mdct block size in samples: 128 (long mode, low & mid bands), */
-            /* 256 (long mode, high band) and 32 (short mode, all bands) */
-            block_size = band_samples >> log2_block_count;
-
-            /* calc transform size in bits according to the block_size_mode */
-            nbits = mdct_long_nbits[band_num] - log2_block_count;
-
-            if (nbits != 5 && nbits != 7 && nbits != 8)
-                return -1;
-        } else {
-            block_size = 32;
-            nbits = 5;
-        }
-
-        start_pos = 0;
-        prev_buf = &su->spectrum[1][ref_pos + band_samples - 16];
-        for (j=0; j < num_blocks; j++) {
-            at1_imdct(q, &q->spec[pos], &su->spectrum[0][ref_pos + start_pos], nbits, band_num);
-
-            /* overlap and window */
-            q->dsp.vector_fmul_window(&q->bands[band_num][start_pos], prev_buf,
-                                      &su->spectrum[0][ref_pos + start_pos], ff_sine_32, 0, 16);
-
-            prev_buf = &su->spectrum[0][ref_pos+start_pos + 16];
-            start_pos += block_size;
-            pos += block_size;
-        }
-
-        if (num_blocks == 1)
-            memcpy(q->bands[band_num] + 32, &su->spectrum[0][ref_pos + 16], 240 * sizeof(float));
-
-        ref_pos += band_samples;
-    }
-
-    /* Swap buffers so the mdct overlap works */
-    FFSWAP(float*, su->spectrum[0], su->spectrum[1]);
-
-    return 0;
-}
-
-/**
- * Parse the block size mode byte
- */
-
-static int at1_parse_bsm(GetBitContext* gb, int log2_block_cnt[AT1_QMF_BANDS])
-{
-    int log2_block_count_tmp, i;
-
-    for (i = 0; i < 2; i++) {
-        /* low and mid band */
-        log2_block_count_tmp = get_bits(gb, 2);
-        if (log2_block_count_tmp & 1)
-            return -1;
-        log2_block_cnt[i] = 2 - log2_block_count_tmp;
-    }
-
-    /* high band */
-    log2_block_count_tmp = get_bits(gb, 2);
-    if (log2_block_count_tmp != 0 && log2_block_count_tmp != 3)
-        return -1;
-    log2_block_cnt[IDX_HIGH_BAND] = 3 - log2_block_count_tmp;
-
-    skip_bits(gb, 2);
-    return 0;
-}
-
-
-static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su,
-                              float spec[AT1_SU_SAMPLES])
-{
-    int bits_used, band_num, bfu_num, i;
-    uint8_t idwls[AT1_MAX_BFU];                 ///< the word length indexes for each BFU
-    uint8_t idsfs[AT1_MAX_BFU];                 ///< the scalefactor indexes for each BFU
-
-    /* parse the info byte (2nd byte) telling how much BFUs were coded */
-    su->num_bfus = bfu_amount_tab1[get_bits(gb, 3)];
-
-    /* calc number of consumed bits:
-        num_BFUs * (idwl(4bits) + idsf(6bits)) + log2_block_count(8bits) + info_byte(8bits)
-        + info_byte_copy(8bits) + log2_block_count_copy(8bits) */
-    bits_used = su->num_bfus * 10 + 32 +
-                bfu_amount_tab2[get_bits(gb, 2)] +
-                (bfu_amount_tab3[get_bits(gb, 3)] << 1);
-
-    /* get word length index (idwl) for each BFU */
-    for (i = 0; i < su->num_bfus; i++)
-        idwls[i] = get_bits(gb, 4);
-
-    /* get scalefactor index (idsf) for each BFU */
-    for (i = 0; i < su->num_bfus; i++)
-        idsfs[i] = get_bits(gb, 6);
-
-    /* zero idwl/idsf for empty BFUs */
-    for (i = su->num_bfus; i < AT1_MAX_BFU; i++)
-        idwls[i] = idsfs[i] = 0;
-
-    /* read in the spectral data and reconstruct MDCT spectrum of this channel */
-    for (band_num = 0; band_num < AT1_QMF_BANDS; band_num++) {
-        for (bfu_num = bfu_bands_t[band_num]; bfu_num < bfu_bands_t[band_num+1]; bfu_num++) {
-            int pos;
-
-            int num_specs = specs_per_bfu[bfu_num];
-            int word_len  = !!idwls[bfu_num] + idwls[bfu_num];
-            float scale_factor = sf_table[idsfs[bfu_num]];
-            bits_used += word_len * num_specs; /* add number of bits consumed by current BFU */
-
-            /* check for bitstream overflow */
-            if (bits_used > AT1_SU_MAX_BITS)
-                return -1;
-
-            /* get the position of the 1st spec according to the block size mode */
-            pos = su->log2_block_count[band_num] ? bfu_start_short[bfu_num] : bfu_start_long[bfu_num];
-
-            if (word_len) {
-                float   max_quant = 1.0 / (float)((1 << (word_len - 1)) - 1);
-
-                for (i = 0; i < num_specs; i++) {
-                    /* read in a quantized spec and convert it to
-                     * signed int and then inverse quantization
-                     */
-                    spec[pos+i] = get_sbits(gb, word_len) * scale_factor * max_quant;
-                }
-            } else { /* word_len = 0 -> empty BFU, zero all specs in the emty BFU */
-                memset(&spec[pos], 0, num_specs * sizeof(float));
-            }
-        }
-    }
-
-    return 0;
-}
-
-
-static void at1_subband_synthesis(AT1Ctx *q, AT1SUCtx* su, float *pOut)
-{
-    float temp[256];
-    float iqmf_temp[512 + 46];
-
-    /* combine low and middle bands */
-    atrac_iqmf(q->bands[0], q->bands[1], 128, temp, su->fst_qmf_delay, iqmf_temp);
-
-    /* delay the signal of the high band by 23 samples */
-    memcpy( su->last_qmf_delay,    &su->last_qmf_delay[256], sizeof(float) *  23);
-    memcpy(&su->last_qmf_delay[23], q->bands[2],             sizeof(float) * 256);
-
-    /* combine (low + middle) and high bands */
-    atrac_iqmf(temp, su->last_qmf_delay, 256, pOut, su->snd_qmf_delay, iqmf_temp);
-}
-
-
-static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
-                               int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    AT1Ctx *q          = avctx->priv_data;
-    int ch, ret, i;
-    GetBitContext gb;
-    float* samples = data;
-
-
-    if (buf_size < 212 * q->channels) {
-        av_log(q,AV_LOG_ERROR,"Not enought data to decode!\n");
-        return -1;
-    }
-
-    for (ch = 0; ch < q->channels; ch++) {
-        AT1SUCtx* su = &q->SUs[ch];
-
-        init_get_bits(&gb, &buf[212 * ch], 212 * 8);
-
-        /* parse block_size_mode, 1st byte */
-        ret = at1_parse_bsm(&gb, su->log2_block_count);
-        if (ret < 0)
-            return ret;
-
-        ret = at1_unpack_dequant(&gb, su, q->spec);
-        if (ret < 0)
-            return ret;
-
-        ret = at1_imdct_block(su, q);
-        if (ret < 0)
-            return ret;
-        at1_subband_synthesis(q, su, q->out_samples[ch]);
-    }
-
-    /* interleave; FIXME, should create/use a DSP function */
-    if (q->channels == 1) {
-        /* mono */
-        memcpy(samples, q->out_samples[0], AT1_SU_SAMPLES * 4);
-    } else {
-        /* stereo */
-        for (i = 0; i < AT1_SU_SAMPLES; i++) {
-            samples[i * 2]     = q->out_samples[0][i];
-            samples[i * 2 + 1] = q->out_samples[1][i];
-        }
-    }
-
-    *data_size = q->channels * AT1_SU_SAMPLES * sizeof(*samples);
-    return avctx->block_align;
-}
-
-
-static av_cold int atrac1_decode_init(AVCodecContext *avctx)
-{
-    AT1Ctx *q = avctx->priv_data;
-
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
-
-    q->channels = avctx->channels;
-
-    /* Init the mdct transforms */
-    ff_mdct_init(&q->mdct_ctx[0], 6, 1, -1.0/ (1 << 15));
-    ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15));
-    ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1 << 15));
-
-    ff_init_ff_sine_windows(5);
-
-    atrac_generate_tables();
-
-    dsputil_init(&q->dsp, avctx);
-
-    q->bands[0] = q->low;
-    q->bands[1] = q->mid;
-    q->bands[2] = q->high;
-
-    /* Prepare the mdct overlap buffers */
-    q->SUs[0].spectrum[0] = q->SUs[0].spec1;
-    q->SUs[0].spectrum[1] = q->SUs[0].spec2;
-    q->SUs[1].spectrum[0] = q->SUs[1].spec1;
-    q->SUs[1].spectrum[1] = q->SUs[1].spec2;
-
-    return 0;
-}
-
-
-static av_cold int atrac1_decode_end(AVCodecContext * avctx) {
-    AT1Ctx *q = avctx->priv_data;
-
-    ff_mdct_end(&q->mdct_ctx[0]);
-    ff_mdct_end(&q->mdct_ctx[1]);
-    ff_mdct_end(&q->mdct_ctx[2]);
-    return 0;
-}
-
-
-AVCodec atrac1_decoder = {
-    .name = "atrac1",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_ATRAC1,
-    .priv_data_size = sizeof(AT1Ctx),
-    .init = atrac1_decode_init,
-    .close = atrac1_decode_end,
-    .decode = atrac1_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Atrac 1 (Adaptive TRansform Acoustic Coding)"),
-};
diff --git a/libavcodec/atrac1data.h b/libavcodec/atrac1data.h
deleted file mode 100644
index ebebe4b..0000000
--- a/libavcodec/atrac1data.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Atrac 1 compatible decoder data
- * Copyright (c) 2009 Maxim Poliakovski
- * Copyright (c) 2009 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Atrac 1 compatible decoder data
- */
-
-#ifndef AVCODEC_ATRAC1DATA_H
-#define AVCODEC_ATRAC1DATA_H
-
-#include <stdint.h>
-
-static const uint8_t bfu_amount_tab1[8] = {20,  28,  32,  36, 40, 44, 48, 52};
-static const uint8_t bfu_amount_tab2[4] = { 0, 112, 176, 208};
-static const uint8_t bfu_amount_tab3[8] = { 0,  24,  36,  48, 72, 108, 132, 156};
-
-/** number of BFUs in each QMF band */
-static const uint8_t bfu_bands_t[4]  = {0, 20, 36, 52};
-
-/** number of spectral lines in each BFU
- *  block floating unit = group of spectral frequencies having the
- *  same quantization parameters like word length and scale factor
- */
-static const uint8_t specs_per_bfu[52] = {
-     8,  8,  8,  8,  4,  4,  4,  4,  8,  8,  8,  8,  6,  6,  6,  6, 6, 6, 6, 6, // low band
-     6,  6,  6,  6,  7,  7,  7,  7,  9,  9,  9,  9, 10, 10, 10, 10,             // midle band
-    12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 20, 20, 20, 20, 20, 20              // high band
-};
-
-/** start position of each BFU in the MDCT spectrum for the long mode */
-static const uint16_t bfu_start_long[52] = {
-      0,   8,  16,  24,  32,  36,  40,  44,  48,  56,  64,  72,  80,  86,  92,  98, 104, 110, 116, 122,
-    128, 134, 140, 146, 152, 159, 166, 173, 180, 189, 198, 207, 216, 226, 236, 246,
-    256, 268, 280, 292, 304, 316, 328, 340, 352, 372, 392, 412, 432, 452, 472, 492,
-};
-
-/** start position of each BFU in the MDCT spectrum for the short mode */
-static const uint16_t bfu_start_short[52] = {
-      0,  32,  64,  96,   8,  40,  72, 104,  12,  44,  76, 108,  20,  52,  84, 116, 26, 58, 90, 122,
-    128, 160, 192, 224, 134, 166, 198, 230, 141, 173, 205, 237, 150, 182, 214, 246,
-    256, 288, 320, 352, 384, 416, 448, 480, 268, 300, 332, 364, 396, 428, 460, 492
-};
-
-#endif /* AVCODEC_ATRAC1DATA_H */
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
deleted file mode 100644
index 5179c34..0000000
--- a/libavcodec/atrac3.c
+++ /dev/null
@@ -1,1026 +0,0 @@
-/*
- * Atrac 3 compatible decoder
- * Copyright (c) 2006-2008 Maxim Poliakovski
- * Copyright (c) 2006-2008 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Atrac 3 compatible decoder.
- * This decoder handles Sony's ATRAC3 data.
- *
- * Container formats used to store atrac 3 data:
- * RealMedia (.rm), RIFF WAV (.wav, .at3), Sony OpenMG (.oma, .aa3).
- *
- * To use this decoder, a calling application must supply the extradata
- * bytes provided in the containers above.
- */
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "bytestream.h"
-#include "fft.h"
-
-#include "atrac.h"
-#include "atrac3data.h"
-
-#define JOINT_STEREO    0x12
-#define STEREO          0x2
-
-
-/* These structures are needed to store the parsed gain control data. */
-typedef struct {
-    int   num_gain_data;
-    int   levcode[8];
-    int   loccode[8];
-} gain_info;
-
-typedef struct {
-    gain_info   gBlock[4];
-} gain_block;
-
-typedef struct {
-    int     pos;
-    int     numCoefs;
-    float   coef[8];
-} tonal_component;
-
-typedef struct {
-    int               bandsCoded;
-    int               numComponents;
-    tonal_component   components[64];
-    float             prevFrame[1024];
-    int               gcBlkSwitch;
-    gain_block        gainBlock[2];
-
-    DECLARE_ALIGNED(16, float, spectrum)[1024];
-    DECLARE_ALIGNED(16, float, IMDCT_buf)[1024];
-
-    float             delayBuf1[46]; ///<qmf delay buffers
-    float             delayBuf2[46];
-    float             delayBuf3[46];
-} channel_unit;
-
-typedef struct {
-    GetBitContext       gb;
-    //@{
-    /** stream data */
-    int                 channels;
-    int                 codingMode;
-    int                 bit_rate;
-    int                 sample_rate;
-    int                 samples_per_channel;
-    int                 samples_per_frame;
-
-    int                 bits_per_frame;
-    int                 bytes_per_frame;
-    int                 pBs;
-    channel_unit*       pUnits;
-    //@}
-    //@{
-    /** joint-stereo related variables */
-    int                 matrix_coeff_index_prev[4];
-    int                 matrix_coeff_index_now[4];
-    int                 matrix_coeff_index_next[4];
-    int                 weighting_delay[6];
-    //@}
-    //@{
-    /** data buffers */
-    float               outSamples[2048];
-    uint8_t*            decoded_bytes_buffer;
-    float               tempBuf[1070];
-    //@}
-    //@{
-    /** extradata */
-    int                 atrac3version;
-    int                 delay;
-    int                 scrambled_stream;
-    int                 frame_factor;
-    //@}
-} ATRAC3Context;
-
-static DECLARE_ALIGNED(16, float,mdct_window)[512];
-static VLC              spectral_coeff_tab[7];
-static float            gain_tab1[16];
-static float            gain_tab2[31];
-static FFTContext       mdct_ctx;
-static DSPContext       dsp;
-
-
-/**
- * Regular 512 points IMDCT without overlapping, with the exception of the swapping of odd bands
- * caused by the reverse spectra of the QMF.
- *
- * @param pInput    float input
- * @param pOutput   float output
- * @param odd_band  1 if the band is an odd band
- */
-
-static void IMLT(float *pInput, float *pOutput, int odd_band)
-{
-    int     i;
-
-    if (odd_band) {
-        /**
-        * Reverse the odd bands before IMDCT, this is an effect of the QMF transform
-        * or it gives better compression to do it this way.
-        * FIXME: It should be possible to handle this in ff_imdct_calc
-        * for that to happen a modification of the prerotation step of
-        * all SIMD code and C code is needed.
-        * Or fix the functions before so they generate a pre reversed spectrum.
-        */
-
-        for (i=0; i<128; i++)
-            FFSWAP(float, pInput[i], pInput[255-i]);
-    }
-
-    ff_imdct_calc(&mdct_ctx,pOutput,pInput);
-
-    /* Perform windowing on the output. */
-    dsp.vector_fmul(pOutput,mdct_window,512);
-
-}
-
-
-/**
- * Atrac 3 indata descrambling, only used for data coming from the rm container
- *
- * @param in        pointer to 8 bit array of indata
- * @param bits      amount of bits
- * @param out       pointer to 8 bit array of outdata
- */
-
-static int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
-    int i, off;
-    uint32_t c;
-    const uint32_t* buf;
-    uint32_t* obuf = (uint32_t*) out;
-
-    off = (intptr_t)inbuffer & 3;
-    buf = (const uint32_t*) (inbuffer - off);
-    c = be2me_32((0x537F6103 >> (off*8)) | (0x537F6103 << (32-(off*8))));
-    bytes += 3 + off;
-    for (i = 0; i < bytes/4; i++)
-        obuf[i] = c ^ buf[i];
-
-    if (off)
-        av_log(NULL,AV_LOG_DEBUG,"Offset of %d not handled, post sample on ffmpeg-dev.\n",off);
-
-    return off;
-}
-
-
-static av_cold void init_atrac3_transforms(ATRAC3Context *q) {
-    float enc_window[256];
-    int i;
-
-    /* Generate the mdct window, for details see
-     * http://wiki.multimedia.cx/index.php?title=RealAudio_atrc#Windows */
-    for (i=0 ; i<256; i++)
-        enc_window[i] = (sin(((i + 0.5) / 256.0 - 0.5) * M_PI) + 1.0) * 0.5;
-
-    if (!mdct_window[0])
-        for (i=0 ; i<256; i++) {
-            mdct_window[i] = enc_window[i]/(enc_window[i]*enc_window[i] + enc_window[255-i]*enc_window[255-i]);
-            mdct_window[511-i] = mdct_window[i];
-        }
-
-    /* Initialize the MDCT transform. */
-    ff_mdct_init(&mdct_ctx, 9, 1, 1.0);
-}
-
-/**
- * Atrac3 uninit, free all allocated memory
- */
-
-static av_cold int atrac3_decode_close(AVCodecContext *avctx)
-{
-    ATRAC3Context *q = avctx->priv_data;
-
-    av_free(q->pUnits);
-    av_free(q->decoded_bytes_buffer);
-
-    return 0;
-}
-
-/**
-/ * Mantissa decoding
- *
- * @param gb            the GetBit context
- * @param selector      what table is the output values coded with
- * @param codingFlag    constant length coding or variable length coding
- * @param mantissas     mantissa output table
- * @param numCodes      amount of values to get
- */
-
-static void readQuantSpectralCoeffs (GetBitContext *gb, int selector, int codingFlag, int* mantissas, int numCodes)
-{
-    int   numBits, cnt, code, huffSymb;
-
-    if (selector == 1)
-        numCodes /= 2;
-
-    if (codingFlag != 0) {
-        /* constant length coding (CLC) */
-        numBits = CLCLengthTab[selector];
-
-        if (selector > 1) {
-            for (cnt = 0; cnt < numCodes; cnt++) {
-                if (numBits)
-                    code = get_sbits(gb, numBits);
-                else
-                    code = 0;
-                mantissas[cnt] = code;
-            }
-        } else {
-            for (cnt = 0; cnt < numCodes; cnt++) {
-                if (numBits)
-                    code = get_bits(gb, numBits); //numBits is always 4 in this case
-                else
-                    code = 0;
-                mantissas[cnt*2] = seTab_0[code >> 2];
-                mantissas[cnt*2+1] = seTab_0[code & 3];
-            }
-        }
-    } else {
-        /* variable length coding (VLC) */
-        if (selector != 1) {
-            for (cnt = 0; cnt < numCodes; cnt++) {
-                huffSymb = get_vlc2(gb, spectral_coeff_tab[selector-1].table, spectral_coeff_tab[selector-1].bits, 3);
-                huffSymb += 1;
-                code = huffSymb >> 1;
-                if (huffSymb & 1)
-                    code = -code;
-                mantissas[cnt] = code;
-            }
-        } else {
-            for (cnt = 0; cnt < numCodes; cnt++) {
-                huffSymb = get_vlc2(gb, spectral_coeff_tab[selector-1].table, spectral_coeff_tab[selector-1].bits, 3);
-                mantissas[cnt*2] = decTable1[huffSymb*2];
-                mantissas[cnt*2+1] = decTable1[huffSymb*2+1];
-            }
-        }
-    }
-}
-
-/**
- * Restore the quantized band spectrum coefficients
- *
- * @param gb            the GetBit context
- * @param pOut          decoded band spectrum
- * @return outSubbands   subband counter, fix for broken specification/files
- */
-
-static int decodeSpectrum (GetBitContext *gb, float *pOut)
-{
-    int   numSubbands, codingMode, cnt, first, last, subbWidth, *pIn;
-    int   subband_vlc_index[32], SF_idxs[32];
-    int   mantissas[128];
-    float SF;
-
-    numSubbands = get_bits(gb, 5); // number of coded subbands
-    codingMode = get_bits1(gb); // coding Mode: 0 - VLC/ 1-CLC
-
-    /* Get the VLC selector table for the subbands, 0 means not coded. */
-    for (cnt = 0; cnt <= numSubbands; cnt++)
-        subband_vlc_index[cnt] = get_bits(gb, 3);
-
-    /* Read the scale factor indexes from the stream. */
-    for (cnt = 0; cnt <= numSubbands; cnt++) {
-        if (subband_vlc_index[cnt] != 0)
-            SF_idxs[cnt] = get_bits(gb, 6);
-    }
-
-    for (cnt = 0; cnt <= numSubbands; cnt++) {
-        first = subbandTab[cnt];
-        last = subbandTab[cnt+1];
-
-        subbWidth = last - first;
-
-        if (subband_vlc_index[cnt] != 0) {
-            /* Decode spectral coefficients for this subband. */
-            /* TODO: This can be done faster is several blocks share the
-             * same VLC selector (subband_vlc_index) */
-            readQuantSpectralCoeffs (gb, subband_vlc_index[cnt], codingMode, mantissas, subbWidth);
-
-            /* Decode the scale factor for this subband. */
-            SF = sf_table[SF_idxs[cnt]] * iMaxQuant[subband_vlc_index[cnt]];
-
-            /* Inverse quantize the coefficients. */
-            for (pIn=mantissas ; first<last; first++, pIn++)
-                pOut[first] = *pIn * SF;
-        } else {
-            /* This subband was not coded, so zero the entire subband. */
-            memset(pOut+first, 0, subbWidth*sizeof(float));
-        }
-    }
-
-    /* Clear the subbands that were not coded. */
-    first = subbandTab[cnt];
-    memset(pOut+first, 0, (1024 - first) * sizeof(float));
-    return numSubbands;
-}
-
-/**
- * Restore the quantized tonal components
- *
- * @param gb            the GetBit context
- * @param pComponent    tone component
- * @param numBands      amount of coded bands
- */
-
-static int decodeTonalComponents (GetBitContext *gb, tonal_component *pComponent, int numBands)
-{
-    int i,j,k,cnt;
-    int   components, coding_mode_selector, coding_mode, coded_values_per_component;
-    int   sfIndx, coded_values, max_coded_values, quant_step_index, coded_components;
-    int   band_flags[4], mantissa[8];
-    float  *pCoef;
-    float  scalefactor;
-    int   component_count = 0;
-
-    components = get_bits(gb,5);
-
-    /* no tonal components */
-    if (components == 0)
-        return 0;
-
-    coding_mode_selector = get_bits(gb,2);
-    if (coding_mode_selector == 2)
-        return -1;
-
-    coding_mode = coding_mode_selector & 1;
-
-    for (i = 0; i < components; i++) {
-        for (cnt = 0; cnt <= numBands; cnt++)
-            band_flags[cnt] = get_bits1(gb);
-
-        coded_values_per_component = get_bits(gb,3);
-
-        quant_step_index = get_bits(gb,3);
-        if (quant_step_index <= 1)
-            return -1;
-
-        if (coding_mode_selector == 3)
-            coding_mode = get_bits1(gb);
-
-        for (j = 0; j < (numBands + 1) * 4; j++) {
-            if (band_flags[j >> 2] == 0)
-                continue;
-
-            coded_components = get_bits(gb,3);
-
-            for (k=0; k<coded_components; k++) {
-                sfIndx = get_bits(gb,6);
-                pComponent[component_count].pos = j * 64 + (get_bits(gb,6));
-                max_coded_values = 1024 - pComponent[component_count].pos;
-                coded_values = coded_values_per_component + 1;
-                coded_values = FFMIN(max_coded_values,coded_values);
-
-                scalefactor = sf_table[sfIndx] * iMaxQuant[quant_step_index];
-
-                readQuantSpectralCoeffs(gb, quant_step_index, coding_mode, mantissa, coded_values);
-
-                pComponent[component_count].numCoefs = coded_values;
-
-                /* inverse quant */
-                pCoef = pComponent[component_count].coef;
-                for (cnt = 0; cnt < coded_values; cnt++)
-                    pCoef[cnt] = mantissa[cnt] * scalefactor;
-
-                component_count++;
-            }
-        }
-    }
-
-    return component_count;
-}
-
-/**
- * Decode gain parameters for the coded bands
- *
- * @param gb            the GetBit context
- * @param pGb           the gainblock for the current band
- * @param numBands      amount of coded bands
- */
-
-static int decodeGainControl (GetBitContext *gb, gain_block *pGb, int numBands)
-{
-    int   i, cf, numData;
-    int   *pLevel, *pLoc;
-
-    gain_info   *pGain = pGb->gBlock;
-
-    for (i=0 ; i<=numBands; i++)
-    {
-        numData = get_bits(gb,3);
-        pGain[i].num_gain_data = numData;
-        pLevel = pGain[i].levcode;
-        pLoc = pGain[i].loccode;
-
-        for (cf = 0; cf < numData; cf++){
-            pLevel[cf]= get_bits(gb,4);
-            pLoc  [cf]= get_bits(gb,5);
-            if(cf && pLoc[cf] <= pLoc[cf-1])
-                return -1;
-        }
-    }
-
-    /* Clear the unused blocks. */
-    for (; i<4 ; i++)
-        pGain[i].num_gain_data = 0;
-
-    return 0;
-}
-
-/**
- * Apply gain parameters and perform the MDCT overlapping part
- *
- * @param pIn           input float buffer
- * @param pPrev         previous float buffer to perform overlap against
- * @param pOut          output float buffer
- * @param pGain1        current band gain info
- * @param pGain2        next band gain info
- */
-
-static void gainCompensateAndOverlap (float *pIn, float *pPrev, float *pOut, gain_info *pGain1, gain_info *pGain2)
-{
-    /* gain compensation function */
-    float  gain1, gain2, gain_inc;
-    int   cnt, numdata, nsample, startLoc, endLoc;
-
-
-    if (pGain2->num_gain_data == 0)
-        gain1 = 1.0;
-    else
-        gain1 = gain_tab1[pGain2->levcode[0]];
-
-    if (pGain1->num_gain_data == 0) {
-        for (cnt = 0; cnt < 256; cnt++)
-            pOut[cnt] = pIn[cnt] * gain1 + pPrev[cnt];
-    } else {
-        numdata = pGain1->num_gain_data;
-        pGain1->loccode[numdata] = 32;
-        pGain1->levcode[numdata] = 4;
-
-        nsample = 0; // current sample = 0
-
-        for (cnt = 0; cnt < numdata; cnt++) {
-            startLoc = pGain1->loccode[cnt] * 8;
-            endLoc = startLoc + 8;
-
-            gain2 = gain_tab1[pGain1->levcode[cnt]];
-            gain_inc = gain_tab2[(pGain1->levcode[cnt+1] - pGain1->levcode[cnt])+15];
-
-            /* interpolate */
-            for (; nsample < startLoc; nsample++)
-                pOut[nsample] = (pIn[nsample] * gain1 + pPrev[nsample]) * gain2;
-
-            /* interpolation is done over eight samples */
-            for (; nsample < endLoc; nsample++) {
-                pOut[nsample] = (pIn[nsample] * gain1 + pPrev[nsample]) * gain2;
-                gain2 *= gain_inc;
-            }
-        }
-
-        for (; nsample < 256; nsample++)
-            pOut[nsample] = (pIn[nsample] * gain1) + pPrev[nsample];
-    }
-
-    /* Delay for the overlapping part. */
-    memcpy(pPrev, &pIn[256], 256*sizeof(float));
-}
-
-/**
- * Combine the tonal band spectrum and regular band spectrum
- * Return position of the last tonal coefficient
- *
- * @param pSpectrum     output spectrum buffer
- * @param numComponents amount of tonal components
- * @param pComponent    tonal components for this band
- */
-
-static int addTonalComponents (float *pSpectrum, int numComponents, tonal_component *pComponent)
-{
-    int   cnt, i, lastPos = -1;
-    float   *pIn, *pOut;
-
-    for (cnt = 0; cnt < numComponents; cnt++){
-        lastPos = FFMAX(pComponent[cnt].pos + pComponent[cnt].numCoefs, lastPos);
-        pIn = pComponent[cnt].coef;
-        pOut = &(pSpectrum[pComponent[cnt].pos]);
-
-        for (i=0 ; i<pComponent[cnt].numCoefs ; i++)
-            pOut[i] += pIn[i];
-    }
-
-    return lastPos;
-}
-
-
-#define INTERPOLATE(old,new,nsample) ((old) + (nsample)*0.125*((new)-(old)))
-
-static void reverseMatrixing(float *su1, float *su2, int *pPrevCode, int *pCurrCode)
-{
-    int    i, band, nsample, s1, s2;
-    float    c1, c2;
-    float    mc1_l, mc1_r, mc2_l, mc2_r;
-
-    for (i=0,band = 0; band < 4*256; band+=256,i++) {
-        s1 = pPrevCode[i];
-        s2 = pCurrCode[i];
-        nsample = 0;
-
-        if (s1 != s2) {
-            /* Selector value changed, interpolation needed. */
-            mc1_l = matrixCoeffs[s1*2];
-            mc1_r = matrixCoeffs[s1*2+1];
-            mc2_l = matrixCoeffs[s2*2];
-            mc2_r = matrixCoeffs[s2*2+1];
-
-            /* Interpolation is done over the first eight samples. */
-            for(; nsample < 8; nsample++) {
-                c1 = su1[band+nsample];
-                c2 = su2[band+nsample];
-                c2 = c1 * INTERPOLATE(mc1_l,mc2_l,nsample) + c2 * INTERPOLATE(mc1_r,mc2_r,nsample);
-                su1[band+nsample] = c2;
-                su2[band+nsample] = c1 * 2.0 - c2;
-            }
-        }
-
-        /* Apply the matrix without interpolation. */
-        switch (s2) {
-            case 0:     /* M/S decoding */
-                for (; nsample < 256; nsample++) {
-                    c1 = su1[band+nsample];
-                    c2 = su2[band+nsample];
-                    su1[band+nsample] = c2 * 2.0;
-                    su2[band+nsample] = (c1 - c2) * 2.0;
-                }
-                break;
-
-            case 1:
-                for (; nsample < 256; nsample++) {
-                    c1 = su1[band+nsample];
-                    c2 = su2[band+nsample];
-                    su1[band+nsample] = (c1 + c2) * 2.0;
-                    su2[band+nsample] = c2 * -2.0;
-                }
-                break;
-            case 2:
-            case 3:
-                for (; nsample < 256; nsample++) {
-                    c1 = su1[band+nsample];
-                    c2 = su2[band+nsample];
-                    su1[band+nsample] = c1 + c2;
-                    su2[band+nsample] = c1 - c2;
-                }
-                break;
-            default:
-                assert(0);
-        }
-    }
-}
-
-static void getChannelWeights (int indx, int flag, float ch[2]){
-
-    if (indx == 7) {
-        ch[0] = 1.0;
-        ch[1] = 1.0;
-    } else {
-        ch[0] = (float)(indx & 7) / 7.0;
-        ch[1] = sqrt(2 - ch[0]*ch[0]);
-        if(flag)
-            FFSWAP(float, ch[0], ch[1]);
-    }
-}
-
-static void channelWeighting (float *su1, float *su2, int *p3)
-{
-    int   band, nsample;
-    /* w[x][y] y=0 is left y=1 is right */
-    float w[2][2];
-
-    if (p3[1] != 7 || p3[3] != 7){
-        getChannelWeights(p3[1], p3[0], w[0]);
-        getChannelWeights(p3[3], p3[2], w[1]);
-
-        for(band = 1; band < 4; band++) {
-            /* scale the channels by the weights */
-            for(nsample = 0; nsample < 8; nsample++) {
-                su1[band*256+nsample] *= INTERPOLATE(w[0][0], w[0][1], nsample);
-                su2[band*256+nsample] *= INTERPOLATE(w[1][0], w[1][1], nsample);
-            }
-
-            for(; nsample < 256; nsample++) {
-                su1[band*256+nsample] *= w[1][0];
-                su2[band*256+nsample] *= w[1][1];
-            }
-        }
-    }
-}
-
-
-/**
- * Decode a Sound Unit
- *
- * @param gb            the GetBit context
- * @param pSnd          the channel unit to be used
- * @param pOut          the decoded samples before IQMF in float representation
- * @param channelNum    channel number
- * @param codingMode    the coding mode (JOINT_STEREO or regular stereo/mono)
- */
-
-
-static int decodeChannelSoundUnit (ATRAC3Context *q, GetBitContext *gb, channel_unit *pSnd, float *pOut, int channelNum, int codingMode)
-{
-    int   band, result=0, numSubbands, lastTonal, numBands;
-
-    if (codingMode == JOINT_STEREO && channelNum == 1) {
-        if (get_bits(gb,2) != 3) {
-            av_log(NULL,AV_LOG_ERROR,"JS mono Sound Unit id != 3.\n");
-            return -1;
-        }
-    } else {
-        if (get_bits(gb,6) != 0x28) {
-            av_log(NULL,AV_LOG_ERROR,"Sound Unit id != 0x28.\n");
-            return -1;
-        }
-    }
-
-    /* number of coded QMF bands */
-    pSnd->bandsCoded = get_bits(gb,2);
-
-    result = decodeGainControl (gb, &(pSnd->gainBlock[pSnd->gcBlkSwitch]), pSnd->bandsCoded);
-    if (result) return result;
-
-    pSnd->numComponents = decodeTonalComponents (gb, pSnd->components, pSnd->bandsCoded);
-    if (pSnd->numComponents == -1) return -1;
-
-    numSubbands = decodeSpectrum (gb, pSnd->spectrum);
-
-    /* Merge the decoded spectrum and tonal components. */
-    lastTonal = addTonalComponents (pSnd->spectrum, pSnd->numComponents, pSnd->components);
-
-
-    /* calculate number of used MLT/QMF bands according to the amount of coded spectral lines */
-    numBands = (subbandTab[numSubbands] - 1) >> 8;
-    if (lastTonal >= 0)
-        numBands = FFMAX((lastTonal + 256) >> 8, numBands);
-
-
-    /* Reconstruct time domain samples. */
-    for (band=0; band<4; band++) {
-        /* Perform the IMDCT step without overlapping. */
-        if (band <= numBands) {
-            IMLT(&(pSnd->spectrum[band*256]), pSnd->IMDCT_buf, band&1);
-        } else
-            memset(pSnd->IMDCT_buf, 0, 512 * sizeof(float));
-
-        /* gain compensation and overlapping */
-        gainCompensateAndOverlap (pSnd->IMDCT_buf, &(pSnd->prevFrame[band*256]), &(pOut[band*256]),
-                                    &((pSnd->gainBlock[1 - (pSnd->gcBlkSwitch)]).gBlock[band]),
-                                    &((pSnd->gainBlock[pSnd->gcBlkSwitch]).gBlock[band]));
-    }
-
-    /* Swap the gain control buffers for the next frame. */
-    pSnd->gcBlkSwitch ^= 1;
-
-    return 0;
-}
-
-/**
- * Frame handling
- *
- * @param q             Atrac3 private context
- * @param databuf       the input data
- */
-
-static int decodeFrame(ATRAC3Context *q, const uint8_t* databuf)
-{
-    int   result, i;
-    float   *p1, *p2, *p3, *p4;
-    uint8_t *ptr1;
-
-    if (q->codingMode == JOINT_STEREO) {
-
-        /* channel coupling mode */
-        /* decode Sound Unit 1 */
-        init_get_bits(&q->gb,databuf,q->bits_per_frame);
-
-        result = decodeChannelSoundUnit(q,&q->gb, q->pUnits, q->outSamples, 0, JOINT_STEREO);
-        if (result != 0)
-            return (result);
-
-        /* Framedata of the su2 in the joint-stereo mode is encoded in
-         * reverse byte order so we need to swap it first. */
-        if (databuf == q->decoded_bytes_buffer) {
-            uint8_t *ptr2 = q->decoded_bytes_buffer+q->bytes_per_frame-1;
-            ptr1 = q->decoded_bytes_buffer;
-            for (i = 0; i < (q->bytes_per_frame/2); i++, ptr1++, ptr2--) {
-                FFSWAP(uint8_t,*ptr1,*ptr2);
-            }
-        } else {
-            const uint8_t *ptr2 = databuf+q->bytes_per_frame-1;
-            for (i = 0; i < q->bytes_per_frame; i++)
-                q->decoded_bytes_buffer[i] = *ptr2--;
-        }
-
-        /* Skip the sync codes (0xF8). */
-        ptr1 = q->decoded_bytes_buffer;
-        for (i = 4; *ptr1 == 0xF8; i++, ptr1++) {
-            if (i >= q->bytes_per_frame)
-                return -1;
-        }
-
-
-        /* set the bitstream reader at the start of the second Sound Unit*/
-        init_get_bits(&q->gb,ptr1,q->bits_per_frame);
-
-        /* Fill the Weighting coeffs delay buffer */
-        memmove(q->weighting_delay,&(q->weighting_delay[2]),4*sizeof(int));
-        q->weighting_delay[4] = get_bits1(&q->gb);
-        q->weighting_delay[5] = get_bits(&q->gb,3);
-
-        for (i = 0; i < 4; i++) {
-            q->matrix_coeff_index_prev[i] = q->matrix_coeff_index_now[i];
-            q->matrix_coeff_index_now[i] = q->matrix_coeff_index_next[i];
-            q->matrix_coeff_index_next[i] = get_bits(&q->gb,2);
-        }
-
-        /* Decode Sound Unit 2. */
-        result = decodeChannelSoundUnit(q,&q->gb, &q->pUnits[1], &q->outSamples[1024], 1, JOINT_STEREO);
-        if (result != 0)
-            return (result);
-
-        /* Reconstruct the channel coefficients. */
-        reverseMatrixing(q->outSamples, &q->outSamples[1024], q->matrix_coeff_index_prev, q->matrix_coeff_index_now);
-
-        channelWeighting(q->outSamples, &q->outSamples[1024], q->weighting_delay);
-
-    } else {
-        /* normal stereo mode or mono */
-        /* Decode the channel sound units. */
-        for (i=0 ; i<q->channels ; i++) {
-
-            /* Set the bitstream reader at the start of a channel sound unit. */
-            init_get_bits(&q->gb, databuf+((i*q->bytes_per_frame)/q->channels), (q->bits_per_frame)/q->channels);
-
-            result = decodeChannelSoundUnit(q,&q->gb, &q->pUnits[i], &q->outSamples[i*1024], i, q->codingMode);
-            if (result != 0)
-                return (result);
-        }
-    }
-
-    /* Apply the iQMF synthesis filter. */
-    p1= q->outSamples;
-    for (i=0 ; i<q->channels ; i++) {
-        p2= p1+256;
-        p3= p2+256;
-        p4= p3+256;
-        atrac_iqmf (p1, p2, 256, p1, q->pUnits[i].delayBuf1, q->tempBuf);
-        atrac_iqmf (p4, p3, 256, p3, q->pUnits[i].delayBuf2, q->tempBuf);
-        atrac_iqmf (p1, p3, 512, p1, q->pUnits[i].delayBuf3, q->tempBuf);
-        p1 +=1024;
-    }
-
-    return 0;
-}
-
-
-/**
- * Atrac frame decoding
- *
- * @param avctx     pointer to the AVCodecContext
- */
-
-static int atrac3_decode_frame(AVCodecContext *avctx,
-            void *data, int *data_size,
-            AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    ATRAC3Context *q = avctx->priv_data;
-    int result = 0, i;
-    const uint8_t* databuf;
-    int16_t* samples = data;
-
-    if (buf_size < avctx->block_align)
-        return buf_size;
-
-    /* Check if we need to descramble and what buffer to pass on. */
-    if (q->scrambled_stream) {
-        decode_bytes(buf, q->decoded_bytes_buffer, avctx->block_align);
-        databuf = q->decoded_bytes_buffer;
-    } else {
-        databuf = buf;
-    }
-
-    result = decodeFrame(q, databuf);
-
-    if (result != 0) {
-        av_log(NULL,AV_LOG_ERROR,"Frame decoding error!\n");
-        return -1;
-    }
-
-    if (q->channels == 1) {
-        /* mono */
-        for (i = 0; i<1024; i++)
-            samples[i] = av_clip_int16(round(q->outSamples[i]));
-        *data_size = 1024 * sizeof(int16_t);
-    } else {
-        /* stereo */
-        for (i = 0; i < 1024; i++) {
-            samples[i*2] = av_clip_int16(round(q->outSamples[i]));
-            samples[i*2+1] = av_clip_int16(round(q->outSamples[1024+i]));
-        }
-        *data_size = 2048 * sizeof(int16_t);
-    }
-
-    return avctx->block_align;
-}
-
-
-/**
- * Atrac3 initialization
- *
- * @param avctx     pointer to the AVCodecContext
- */
-
-static av_cold int atrac3_decode_init(AVCodecContext *avctx)
-{
-    int i;
-    const uint8_t *edata_ptr = avctx->extradata;
-    ATRAC3Context *q = avctx->priv_data;
-    static VLC_TYPE atrac3_vlc_table[4096][2];
-    static int vlcs_initialized = 0;
-
-    /* Take data from the AVCodecContext (RM container). */
-    q->sample_rate = avctx->sample_rate;
-    q->channels = avctx->channels;
-    q->bit_rate = avctx->bit_rate;
-    q->bits_per_frame = avctx->block_align * 8;
-    q->bytes_per_frame = avctx->block_align;
-
-    /* Take care of the codec-specific extradata. */
-    if (avctx->extradata_size == 14) {
-        /* Parse the extradata, WAV format */
-        av_log(avctx,AV_LOG_DEBUG,"[0-1] %d\n",bytestream_get_le16(&edata_ptr));  //Unknown value always 1
-        q->samples_per_channel = bytestream_get_le32(&edata_ptr);
-        q->codingMode = bytestream_get_le16(&edata_ptr);
-        av_log(avctx,AV_LOG_DEBUG,"[8-9] %d\n",bytestream_get_le16(&edata_ptr));  //Dupe of coding mode
-        q->frame_factor = bytestream_get_le16(&edata_ptr);  //Unknown always 1
-        av_log(avctx,AV_LOG_DEBUG,"[12-13] %d\n",bytestream_get_le16(&edata_ptr));  //Unknown always 0
-
-        /* setup */
-        q->samples_per_frame = 1024 * q->channels;
-        q->atrac3version = 4;
-        q->delay = 0x88E;
-        if (q->codingMode)
-            q->codingMode = JOINT_STEREO;
-        else
-            q->codingMode = STEREO;
-
-        q->scrambled_stream = 0;
-
-        if ((q->bytes_per_frame == 96*q->channels*q->frame_factor) || (q->bytes_per_frame == 152*q->channels*q->frame_factor) || (q->bytes_per_frame == 192*q->channels*q->frame_factor)) {
-        } else {
-            av_log(avctx,AV_LOG_ERROR,"Unknown frame/channel/frame_factor configuration %d/%d/%d\n", q->bytes_per_frame, q->channels, q->frame_factor);
-            return -1;
-        }
-
-    } else if (avctx->extradata_size == 10) {
-        /* Parse the extradata, RM format. */
-        q->atrac3version = bytestream_get_be32(&edata_ptr);
-        q->samples_per_frame = bytestream_get_be16(&edata_ptr);
-        q->delay = bytestream_get_be16(&edata_ptr);
-        q->codingMode = bytestream_get_be16(&edata_ptr);
-
-        q->samples_per_channel = q->samples_per_frame / q->channels;
-        q->scrambled_stream = 1;
-
-    } else {
-        av_log(NULL,AV_LOG_ERROR,"Unknown extradata size %d.\n",avctx->extradata_size);
-    }
-    /* Check the extradata. */
-
-    if (q->atrac3version != 4) {
-        av_log(avctx,AV_LOG_ERROR,"Version %d != 4.\n",q->atrac3version);
-        return -1;
-    }
-
-    if (q->samples_per_frame != 1024 && q->samples_per_frame != 2048) {
-        av_log(avctx,AV_LOG_ERROR,"Unknown amount of samples per frame %d.\n",q->samples_per_frame);
-        return -1;
-    }
-
-    if (q->delay != 0x88E) {
-        av_log(avctx,AV_LOG_ERROR,"Unknown amount of delay %x != 0x88E.\n",q->delay);
-        return -1;
-    }
-
-    if (q->codingMode == STEREO) {
-        av_log(avctx,AV_LOG_DEBUG,"Normal stereo detected.\n");
-    } else if (q->codingMode == JOINT_STEREO) {
-        av_log(avctx,AV_LOG_DEBUG,"Joint stereo detected.\n");
-    } else {
-        av_log(avctx,AV_LOG_ERROR,"Unknown channel coding mode %x!\n",q->codingMode);
-        return -1;
-    }
-
-    if (avctx->channels <= 0 || avctx->channels > 2 /*|| ((avctx->channels * 1024) != q->samples_per_frame)*/) {
-        av_log(avctx,AV_LOG_ERROR,"Channel configuration error!\n");
-        return -1;
-    }
-
-
-    if(avctx->block_align >= UINT_MAX/2)
-        return -1;
-
-    /* Pad the data buffer with FF_INPUT_BUFFER_PADDING_SIZE,
-     * this is for the bitstream reader. */
-    if ((q->decoded_bytes_buffer = av_mallocz((avctx->block_align+(4-avctx->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE)))  == NULL)
-        return AVERROR(ENOMEM);
-
-
-    /* Initialize the VLC tables. */
-    if (!vlcs_initialized) {
-        for (i=0 ; i<7 ; i++) {
-            spectral_coeff_tab[i].table = &atrac3_vlc_table[atrac3_vlc_offs[i]];
-            spectral_coeff_tab[i].table_allocated = atrac3_vlc_offs[i + 1] - atrac3_vlc_offs[i];
-            init_vlc (&spectral_coeff_tab[i], 9, huff_tab_sizes[i],
-                huff_bits[i], 1, 1,
-                huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-        }
-        vlcs_initialized = 1;
-    }
-
-    init_atrac3_transforms(q);
-
-    atrac_generate_tables();
-
-    /* Generate gain tables. */
-    for (i=0 ; i<16 ; i++)
-        gain_tab1[i] = powf (2.0, (4 - i));
-
-    for (i=-15 ; i<16 ; i++)
-        gain_tab2[i+15] = powf (2.0, i * -0.125);
-
-    /* init the joint-stereo decoding data */
-    q->weighting_delay[0] = 0;
-    q->weighting_delay[1] = 7;
-    q->weighting_delay[2] = 0;
-    q->weighting_delay[3] = 7;
-    q->weighting_delay[4] = 0;
-    q->weighting_delay[5] = 7;
-
-    for (i=0; i<4; i++) {
-        q->matrix_coeff_index_prev[i] = 3;
-        q->matrix_coeff_index_now[i] = 3;
-        q->matrix_coeff_index_next[i] = 3;
-    }
-
-    dsputil_init(&dsp, avctx);
-
-    q->pUnits = av_mallocz(sizeof(channel_unit)*q->channels);
-    if (!q->pUnits) {
-        av_free(q->decoded_bytes_buffer);
-        return AVERROR(ENOMEM);
-    }
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-
-AVCodec atrac3_decoder =
-{
-    .name = "atrac3",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_ATRAC3,
-    .priv_data_size = sizeof(ATRAC3Context),
-    .init = atrac3_decode_init,
-    .close = atrac3_decode_close,
-    .decode = atrac3_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Coding 3)"),
-};
diff --git a/libavcodec/atrac3data.h b/libavcodec/atrac3data.h
deleted file mode 100644
index b5aa71f..0000000
--- a/libavcodec/atrac3data.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Atrac 3 compatible decoder data
- * Copyright (c) 2006-2007 Maxim Poliakovski
- * Copyright (c) 2006-2007 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Atrac 3 AKA RealAudio 8 compatible decoder data
- */
-
-#ifndef AVCODEC_ATRAC3DATA_H
-#define AVCODEC_ATRAC3DATA_H
-
-#include <stdint.h>
-
-/* VLC tables */
-
-static const uint8_t huffcode1[9] = {
-  0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F,
-};
-
-static const uint8_t huffbits1[9] = {
-  1,3,3,4,4,5,5,5,5,
-};
-
-static const uint8_t huffcode2[5] = {
-  0x0,0x4,0x5,0x6,0x7,
-};
-
-static const uint8_t huffbits2[5] = {
-  1,3,3,3,3,
-};
-
-static const uint8_t huffcode3[7] = {
-0x0,0x4,0x5,0xC,0xD,0xE,0xF,
-};
-
-static const uint8_t huffbits3[7] = {
-  1,3,3,4,4,4,4,
-};
-
-static const uint8_t huffcode4[9] = {
-  0x0,0x4,0x5,0xC,0xD,0x1C,0x1D,0x1E,0x1F,
-};
-
-static const uint8_t huffbits4[9] = {
-  1,3,3,4,4,5,5,5,5,
-};
-
-static const uint8_t huffcode5[15] = {
-  0x0,0x2,0x3,0x8,0x9,0xA,0xB,0x1C,0x1D,0x3C,0x3D,0x3E,0x3F,0xC,0xD,
-};
-
-static const uint8_t huffbits5[15] = {
-  2,3,3,4,4,4,4,5,5,6,6,6,6,4,4
-};
-
-static const uint8_t huffcode6[31] = {
-  0x0,0x2,0x3,0x4,0x5,0x6,0x7,0x14,0x15,0x16,0x17,0x18,0x19,0x34,0x35,
-  0x36,0x37,0x38,0x39,0x3A,0x3B,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,0x8,0x9,
-};
-
-static const uint8_t huffbits6[31] = {
-  3,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,4,4
-};
-
-static const uint8_t huffcode7[63] = {
-  0x0,0x8,0x9,0xA,0xB,0xC,0xD,0xE,0xF,0x10,0x11,0x24,0x25,0x26,0x27,0x28,
-  0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x68,0x69,0x6A,0x6B,0x6C,
-  0x6D,0x6E,0x6F,0x70,0x71,0x72,0x73,0x74,0x75,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,
-  0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF,0x2,0x3,
-};
-
-static const uint8_t huffbits7[63] = {
-  3,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,4,4
-};
-
-static const uint8_t huff_tab_sizes[7] = {
-  9, 5, 7, 9, 15, 31, 63,
-};
-
-static const uint8_t* const huff_codes[7] = {
-  huffcode1,huffcode2,huffcode3,huffcode4,huffcode5,huffcode6,huffcode7,
-};
-
-static const uint8_t* const huff_bits[7] = {
-  huffbits1,huffbits2,huffbits3,huffbits4,huffbits5,huffbits6,huffbits7,
-};
-
-static const uint16_t atrac3_vlc_offs[] = {
-    0,512,1024,1536,2048,2560,3072,3584,4096
-};
-
-/* selector tables */
-
-static const uint8_t CLCLengthTab[8] = {0, 4, 3, 3, 4, 4, 5, 6};
-static const int8_t seTab_0[4] = {0, 1, -2, -1};
-static const int8_t decTable1[18] = {0,0, 0,1, 0,-1, 1,0, -1,0, 1,1, 1,-1, -1,1, -1,-1};
-
-
-/* tables for the scalefactor decoding */
-
-static const float iMaxQuant[8] = {
-  0.0, 1.0/1.5, 1.0/2.5, 1.0/3.5, 1.0/4.5, 1.0/7.5, 1.0/15.5, 1.0/31.5
-};
-
-static const uint16_t subbandTab[33] = {
-  0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224,
-  256, 288, 320, 352, 384, 416, 448, 480, 512, 576, 640, 704, 768, 896, 1024
-};
-
-/* joint stereo related tables */
-static const float matrixCoeffs[8] = {0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0};
-
-#endif /* AVCODEC_ATRAC3DATA_H */
diff --git a/libavcodec/audioconvert.c b/libavcodec/audioconvert.c
deleted file mode 100644
index d022bc9..0000000
--- a/libavcodec/audioconvert.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * audio conversion
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * audio conversion
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "libavutil/avstring.h"
-#include "libavutil/libm.h"
-#include "avcodec.h"
-#include "audioconvert.h"
-
-typedef struct SampleFmtInfo {
-    const char *name;
-    int bits;
-} SampleFmtInfo;
-
-/** this table gives more information about formats */
-static const SampleFmtInfo sample_fmt_info[SAMPLE_FMT_NB] = {
-    [SAMPLE_FMT_U8]  = { .name = "u8",  .bits = 8 },
-    [SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 },
-    [SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 },
-    [SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 },
-    [SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 },
-};
-
-const char *avcodec_get_sample_fmt_name(int sample_fmt)
-{
-    if (sample_fmt < 0 || sample_fmt >= SAMPLE_FMT_NB)
-        return NULL;
-    return sample_fmt_info[sample_fmt].name;
-}
-
-enum SampleFormat avcodec_get_sample_fmt(const char* name)
-{
-    int i;
-
-    for (i=0; i < SAMPLE_FMT_NB; i++)
-        if (!strcmp(sample_fmt_info[i].name, name))
-            return i;
-    return SAMPLE_FMT_NONE;
-}
-
-void avcodec_sample_fmt_string (char *buf, int buf_size, int sample_fmt)
-{
-    /* print header */
-    if (sample_fmt < 0)
-        snprintf (buf, buf_size, "name  " " depth");
-    else if (sample_fmt < SAMPLE_FMT_NB) {
-        SampleFmtInfo info= sample_fmt_info[sample_fmt];
-        snprintf (buf, buf_size, "%-6s" "   %2d ", info.name, info.bits);
-    }
-}
-
-static const char* const channel_names[]={
-    "FL", "FR", "FC", "LFE", "BL",  "BR",  "FLC", "FRC",
-    "BC", "SL", "SR", "TC",  "TFL", "TFC", "TFR", "TBL",
-    "TBC", "TBR",
-    [29] = "DL",
-    [30] = "DR",
-};
-
-static const char *get_channel_name(int channel_id)
-{
-    if (channel_id<0 || channel_id>=FF_ARRAY_ELEMS(channel_names))
-        return NULL;
-    return channel_names[channel_id];
-}
-
-int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name)
-{
-    switch(nb_channels) {
-    case 1: return CH_LAYOUT_MONO;
-    case 2: return CH_LAYOUT_STEREO;
-    case 3: return CH_LAYOUT_SURROUND;
-    case 4: return CH_LAYOUT_QUAD;
-    case 5: return CH_LAYOUT_5POINT0;
-    case 6: return CH_LAYOUT_5POINT1;
-    case 8: return CH_LAYOUT_7POINT1;
-    default: return 0;
-    }
-}
-
-static const struct {
-    const char *name;
-    int         nb_channels;
-    int64_t     layout;
-} channel_layout_map[] = {
-    { "mono",        1,  CH_LAYOUT_MONO },
-    { "stereo",      2,  CH_LAYOUT_STEREO },
-    { "4.0",         4,  CH_LAYOUT_4POINT0 },
-    { "quad",        4,  CH_LAYOUT_QUAD },
-    { "5.0",         5,  CH_LAYOUT_5POINT0 },
-    { "5.0",         5,  CH_LAYOUT_5POINT0_BACK },
-    { "5.1",         6,  CH_LAYOUT_5POINT1 },
-    { "5.1",         6,  CH_LAYOUT_5POINT1_BACK },
-    { "5.1+downmix", 8,  CH_LAYOUT_5POINT1|CH_LAYOUT_STEREO_DOWNMIX, },
-    { "7.1",         8,  CH_LAYOUT_7POINT1 },
-    { "7.1(wide)",   8,  CH_LAYOUT_7POINT1_WIDE },
-    { "7.1+downmix", 10, CH_LAYOUT_7POINT1|CH_LAYOUT_STEREO_DOWNMIX, },
-    { 0 }
-};
-
-void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout)
-{
-    int i;
-
-    for (i=0; channel_layout_map[i].name; i++)
-        if (nb_channels    == channel_layout_map[i].nb_channels &&
-            channel_layout == channel_layout_map[i].layout) {
-            av_strlcpy(buf, channel_layout_map[i].name, buf_size);
-            return;
-        }
-
-    snprintf(buf, buf_size, "%d channels", nb_channels);
-    if (channel_layout) {
-        int i,ch;
-        av_strlcat(buf, " (", buf_size);
-        for(i=0,ch=0; i<64; i++) {
-            if ((channel_layout & (1L<<i))) {
-                const char *name = get_channel_name(i);
-                if (name) {
-                    if (ch>0) av_strlcat(buf, "|", buf_size);
-                    av_strlcat(buf, name, buf_size);
-                }
-                ch++;
-            }
-        }
-        av_strlcat(buf, ")", buf_size);
-    }
-}
-
-int avcodec_channel_layout_num_channels(int64_t channel_layout)
-{
-    int count;
-    uint64_t x = channel_layout;
-    for (count = 0; x; count++)
-        x &= x-1; // unset lowest set bit
-    return count;
-}
-
-struct AVAudioConvert {
-    int in_channels, out_channels;
-    int fmt_pair;
-};
-
-AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels,
-                                       enum SampleFormat in_fmt, int in_channels,
-                                       const float *matrix, int flags)
-{
-    AVAudioConvert *ctx;
-    if (in_channels!=out_channels)
-        return NULL;  /* FIXME: not supported */
-    ctx = av_malloc(sizeof(AVAudioConvert));
-    if (!ctx)
-        return NULL;
-    ctx->in_channels = in_channels;
-    ctx->out_channels = out_channels;
-    ctx->fmt_pair = out_fmt + SAMPLE_FMT_NB*in_fmt;
-    return ctx;
-}
-
-void av_audio_convert_free(AVAudioConvert *ctx)
-{
-    av_free(ctx);
-}
-
-int av_audio_convert(AVAudioConvert *ctx,
-                           void * const out[6], const int out_stride[6],
-                     const void * const  in[6], const int  in_stride[6], int len)
-{
-    int ch;
-
-    //FIXME optimize common cases
-
-    for(ch=0; ch<ctx->out_channels; ch++){
-        const int is=  in_stride[ch];
-        const int os= out_stride[ch];
-        const uint8_t *pi=  in[ch];
-        uint8_t *po= out[ch];
-        uint8_t *end= po + os*len;
-        if(!out[ch])
-            continue;
-
-#define CONV(ofmt, otype, ifmt, expr)\
-if(ctx->fmt_pair == ofmt + SAMPLE_FMT_NB*ifmt){\
-    do{\
-        *(otype*)po = expr; pi += is; po += os;\
-    }while(po < end);\
-}
-
-//FIXME put things below under ifdefs so we do not waste space for cases no codec will need
-//FIXME rounding ?
-
-             CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_U8 ,  *(const uint8_t*)pi)
-        else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<8)
-        else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)<<24)
-        else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
-        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
-        else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_S16, (*(const int16_t*)pi>>8) + 0x80)
-        else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S16,  *(const int16_t*)pi)
-        else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_S16,  *(const int16_t*)pi<<16)
-        else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_S16,  *(const int16_t*)pi*(1.0 / (1<<15)))
-        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_S16,  *(const int16_t*)pi*(1.0 / (1<<15)))
-        else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_S32, (*(const int32_t*)pi>>24) + 0x80)
-        else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_S32,  *(const int32_t*)pi>>16)
-        else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_S32,  *(const int32_t*)pi)
-        else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_S32,  *(const int32_t*)pi*(1.0 / (1<<31)))
-        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_S32,  *(const int32_t*)pi*(1.0 / (1<<31)))
-        else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_FLT, av_clip_uint8(  lrintf(*(const float*)pi * (1<<7)) + 0x80))
-        else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_FLT, av_clip_int16(  lrintf(*(const float*)pi * (1<<15))))
-        else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float*)pi * (1U<<31))))
-        else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_FLT, *(const float*)pi)
-        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_FLT, *(const float*)pi)
-        else CONV(SAMPLE_FMT_U8 , uint8_t, SAMPLE_FMT_DBL, av_clip_uint8(  lrint(*(const double*)pi * (1<<7)) + 0x80))
-        else CONV(SAMPLE_FMT_S16, int16_t, SAMPLE_FMT_DBL, av_clip_int16(  lrint(*(const double*)pi * (1<<15))))
-        else CONV(SAMPLE_FMT_S32, int32_t, SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double*)pi * (1U<<31))))
-        else CONV(SAMPLE_FMT_FLT, float  , SAMPLE_FMT_DBL, *(const double*)pi)
-        else CONV(SAMPLE_FMT_DBL, double , SAMPLE_FMT_DBL, *(const double*)pi)
-        else return -1;
-    }
-    return 0;
-}
diff --git a/libavcodec/audioconvert.h b/libavcodec/audioconvert.h
deleted file mode 100644
index 81b6cde..0000000
--- a/libavcodec/audioconvert.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * audio conversion
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2008 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AUDIOCONVERT_H
-#define AVCODEC_AUDIOCONVERT_H
-
-/**
- * @file
- * Audio format conversion routines
- */
-
-
-#include "avcodec.h"
-
-
-/**
- * Generate string corresponding to the sample format with
- * number sample_fmt, or a header if sample_fmt is negative.
- *
- * @param[in] buf the buffer where to write the string
- * @param[in] buf_size the size of buf
- * @param[in] sample_fmt the number of the sample format to print the corresponding info string, or
- * a negative value to print the corresponding header.
- * Meaningful values for obtaining a sample format info vary from 0 to SAMPLE_FMT_NB -1.
- */
-void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt);
-
-/**
- * @return NULL on error
- */
-const char *avcodec_get_sample_fmt_name(int sample_fmt);
-
-/**
- * @return SAMPLE_FMT_NONE on error
- */
-enum SampleFormat avcodec_get_sample_fmt(const char* name);
-
-/**
- * @return NULL on error
- */
-const char *avcodec_get_channel_name(int channel_id);
-
-/**
- * Return description of channel layout
- */
-void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout);
-
-/**
- * Guess the channel layout
- * @param nb_channels
- * @param codec_id Codec identifier, or CODEC_ID_NONE if unknown
- * @param fmt_name Format name, or NULL if unknown
- * @return Channel layout mask
- */
-int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name);
-
-/**
- * @return the number of channels in the channel layout.
- */
-int avcodec_channel_layout_num_channels(int64_t channel_layout);
-
-struct AVAudioConvert;
-typedef struct AVAudioConvert AVAudioConvert;
-
-/**
- * Create an audio sample format converter context
- * @param out_fmt Output sample format
- * @param out_channels Number of output channels
- * @param in_fmt Input sample format
- * @param in_channels Number of input channels
- * @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels). Set to NULL to ignore.
- * @param flags See FF_MM_xx
- * @return NULL on error
- */
-AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels,
-                                       enum SampleFormat in_fmt, int in_channels,
-                                       const float *matrix, int flags);
-
-/**
- * Free audio sample format converter context
- */
-void av_audio_convert_free(AVAudioConvert *ctx);
-
-/**
- * Convert between audio sample formats
- * @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel.
- * @param[in] out_stride distance between consecutive output samples (measured in bytes)
- * @param[in] in array of input buffers for each channel
- * @param[in] in_stride distance between consecutive input samples (measured in bytes)
- * @param len length of audio frame size (measured in samples)
- */
-int av_audio_convert(AVAudioConvert *ctx,
-                           void * const out[6], const int out_stride[6],
-                     const void * const  in[6], const int  in_stride[6], int len);
-
-#endif /* AVCODEC_AUDIOCONVERT_H */
diff --git a/libavcodec/aura.c b/libavcodec/aura.c
deleted file mode 100644
index 8942cdd..0000000
--- a/libavcodec/aura.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Aura 2 decoder
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Aura 2 decoder
- */
-
-#include "avcodec.h"
-
-typedef struct AuraDecodeContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-} AuraDecodeContext;
-
-static av_cold int aura_decode_init(AVCodecContext *avctx)
-{
-    AuraDecodeContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    /* width needs to be divisible by 4 for this codec to work */
-    if (avctx->width & 0x3)
-        return -1;
-    avctx->pix_fmt = PIX_FMT_YUV422P;
-
-    return 0;
-}
-
-static int aura_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *pkt)
-{
-    AuraDecodeContext *s=avctx->priv_data;
-
-    uint8_t *Y, *U, *V;
-    uint8_t val;
-    int x, y;
-    const uint8_t *buf = pkt->data;
-
-    /* prediction error tables (make it clear that they are signed values) */
-    const int8_t *delta_table = (const int8_t*)buf + 16;
-
-    if (pkt->size != 48 + avctx->height * avctx->width) {
-        av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n",
-               pkt->size, 48 + avctx->height * avctx->width);
-        return -1;
-    }
-
-    /* pixel data starts 48 bytes in, after 3x16-byte tables */
-    buf += 48;
-
-    if(s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
-    s->frame.reference = 0;
-    if(avctx->get_buffer(avctx, &s->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    Y = s->frame.data[0];
-    U = s->frame.data[1];
-    V = s->frame.data[2];
-
-    /* iterate through each line in the height */
-    for (y = 0; y < avctx->height; y++) {
-        /* reset predictors */
-        val = *buf++;
-        U[0] = val & 0xF0;
-        Y[0] = val << 4;
-        val = *buf++;
-        V[0] = val & 0xF0;
-        Y[1] = Y[0] + delta_table[val & 0xF];
-        Y += 2; U++; V++;
-
-        /* iterate through the remaining pixel groups (4 pixels/group) */
-        for (x = 1; x < (avctx->width >> 1); x++) {
-            val = *buf++;
-            U[0] = U[-1] + delta_table[val >> 4];
-            Y[0] = Y[-1] + delta_table[val & 0xF];
-            val = *buf++;
-            V[0] = V[-1] + delta_table[val >> 4];
-            Y[1] = Y[ 0] + delta_table[val & 0xF];
-            Y += 2; U++; V++;
-        }
-        Y += s->frame.linesize[0] -  avctx->width;
-        U += s->frame.linesize[1] - (avctx->width >> 1);
-        V += s->frame.linesize[2] - (avctx->width >> 1);
-    }
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data= s->frame;
-
-    return pkt->size;
-}
-
-static av_cold int aura_decode_end(AVCodecContext *avctx)
-{
-    AuraDecodeContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec aura2_decoder = {
-    "aura2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_AURA2,
-    sizeof(AuraDecodeContext),
-    aura_decode_init,
-    NULL,
-    aura_decode_end,
-    aura_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"),
-};
-
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
deleted file mode 100644
index 974e87c..0000000
--- a/libavcodec/avcodec.h
+++ /dev/null
@@ -1,3968 +0,0 @@
-/*
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AVCODEC_H
-#define AVCODEC_AVCODEC_H
-
-/**
- * @file
- * external API header
- */
-
-#include <errno.h>
-#include "libavutil/avutil.h"
-
-#define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 72
-#define LIBAVCODEC_VERSION_MICRO  2
-
-#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-                                               LIBAVCODEC_VERSION_MINOR, \
-                                               LIBAVCODEC_VERSION_MICRO)
-#define LIBAVCODEC_VERSION      AV_VERSION(LIBAVCODEC_VERSION_MAJOR,    \
-                                           LIBAVCODEC_VERSION_MINOR,    \
-                                           LIBAVCODEC_VERSION_MICRO)
-#define LIBAVCODEC_BUILD        LIBAVCODEC_VERSION_INT
-
-#define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION)
-
-#define AV_NOPTS_VALUE          INT64_C(0x8000000000000000)
-#define AV_TIME_BASE            1000000
-#define AV_TIME_BASE_Q          (AVRational){1, AV_TIME_BASE}
-
-/**
- * Identifies the syntax and semantics of the bitstream.
- * The principle is roughly:
- * Two decoders with the same ID can decode the same streams.
- * Two encoders with the same ID can encode compatible streams.
- * There may be slight deviations from the principle due to implementation
- * details.
- *
- * If you add a codec ID to this list, add it so that
- * 1. no value of a existing codec ID changes (that would break ABI),
- * 2. it is as close as possible to similar codecs.
- */
-enum CodecID {
-    CODEC_ID_NONE,
-
-    /* video codecs */
-    CODEC_ID_MPEG1VIDEO,
-    CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
-    CODEC_ID_MPEG2VIDEO_XVMC,
-    CODEC_ID_H261,
-    CODEC_ID_H263,
-    CODEC_ID_RV10,
-    CODEC_ID_RV20,
-    CODEC_ID_MJPEG,
-    CODEC_ID_MJPEGB,
-    CODEC_ID_LJPEG,
-    CODEC_ID_SP5X,
-    CODEC_ID_JPEGLS,
-    CODEC_ID_MPEG4,
-    CODEC_ID_RAWVIDEO,
-    CODEC_ID_MSMPEG4V1,
-    CODEC_ID_MSMPEG4V2,
-    CODEC_ID_MSMPEG4V3,
-    CODEC_ID_WMV1,
-    CODEC_ID_WMV2,
-    CODEC_ID_H263P,
-    CODEC_ID_H263I,
-    CODEC_ID_FLV1,
-    CODEC_ID_SVQ1,
-    CODEC_ID_SVQ3,
-    CODEC_ID_DVVIDEO,
-    CODEC_ID_HUFFYUV,
-    CODEC_ID_CYUV,
-    CODEC_ID_H264,
-    CODEC_ID_INDEO3,
-    CODEC_ID_VP3,
-    CODEC_ID_THEORA,
-    CODEC_ID_ASV1,
-    CODEC_ID_ASV2,
-    CODEC_ID_FFV1,
-    CODEC_ID_4XM,
-    CODEC_ID_VCR1,
-    CODEC_ID_CLJR,
-    CODEC_ID_MDEC,
-    CODEC_ID_ROQ,
-    CODEC_ID_INTERPLAY_VIDEO,
-    CODEC_ID_XAN_WC3,
-    CODEC_ID_XAN_WC4,
-    CODEC_ID_RPZA,
-    CODEC_ID_CINEPAK,
-    CODEC_ID_WS_VQA,
-    CODEC_ID_MSRLE,
-    CODEC_ID_MSVIDEO1,
-    CODEC_ID_IDCIN,
-    CODEC_ID_8BPS,
-    CODEC_ID_SMC,
-    CODEC_ID_FLIC,
-    CODEC_ID_TRUEMOTION1,
-    CODEC_ID_VMDVIDEO,
-    CODEC_ID_MSZH,
-    CODEC_ID_ZLIB,
-    CODEC_ID_QTRLE,
-    CODEC_ID_SNOW,
-    CODEC_ID_TSCC,
-    CODEC_ID_ULTI,
-    CODEC_ID_QDRAW,
-    CODEC_ID_VIXL,
-    CODEC_ID_QPEG,
-#if LIBAVCODEC_VERSION_MAJOR < 53
-    CODEC_ID_XVID,
-#endif
-    CODEC_ID_PNG,
-    CODEC_ID_PPM,
-    CODEC_ID_PBM,
-    CODEC_ID_PGM,
-    CODEC_ID_PGMYUV,
-    CODEC_ID_PAM,
-    CODEC_ID_FFVHUFF,
-    CODEC_ID_RV30,
-    CODEC_ID_RV40,
-    CODEC_ID_VC1,
-    CODEC_ID_WMV3,
-    CODEC_ID_LOCO,
-    CODEC_ID_WNV1,
-    CODEC_ID_AASC,
-    CODEC_ID_INDEO2,
-    CODEC_ID_FRAPS,
-    CODEC_ID_TRUEMOTION2,
-    CODEC_ID_BMP,
-    CODEC_ID_CSCD,
-    CODEC_ID_MMVIDEO,
-    CODEC_ID_ZMBV,
-    CODEC_ID_AVS,
-    CODEC_ID_SMACKVIDEO,
-    CODEC_ID_NUV,
-    CODEC_ID_KMVC,
-    CODEC_ID_FLASHSV,
-    CODEC_ID_CAVS,
-    CODEC_ID_JPEG2000,
-    CODEC_ID_VMNC,
-    CODEC_ID_VP5,
-    CODEC_ID_VP6,
-    CODEC_ID_VP6F,
-    CODEC_ID_TARGA,
-    CODEC_ID_DSICINVIDEO,
-    CODEC_ID_TIERTEXSEQVIDEO,
-    CODEC_ID_TIFF,
-    CODEC_ID_GIF,
-    CODEC_ID_FFH264,
-    CODEC_ID_DXA,
-    CODEC_ID_DNXHD,
-    CODEC_ID_THP,
-    CODEC_ID_SGI,
-    CODEC_ID_C93,
-    CODEC_ID_BETHSOFTVID,
-    CODEC_ID_PTX,
-    CODEC_ID_TXD,
-    CODEC_ID_VP6A,
-    CODEC_ID_AMV,
-    CODEC_ID_VB,
-    CODEC_ID_PCX,
-    CODEC_ID_SUNRAST,
-    CODEC_ID_INDEO4,
-    CODEC_ID_INDEO5,
-    CODEC_ID_MIMIC,
-    CODEC_ID_RL2,
-    CODEC_ID_8SVX_EXP,
-    CODEC_ID_8SVX_FIB,
-    CODEC_ID_ESCAPE124,
-    CODEC_ID_DIRAC,
-    CODEC_ID_BFI,
-    CODEC_ID_CMV,
-    CODEC_ID_MOTIONPIXELS,
-    CODEC_ID_TGV,
-    CODEC_ID_TGQ,
-    CODEC_ID_TQI,
-    CODEC_ID_AURA,
-    CODEC_ID_AURA2,
-    CODEC_ID_V210X,
-    CODEC_ID_TMV,
-    CODEC_ID_V210,
-    CODEC_ID_DPX,
-    CODEC_ID_MAD,
-    CODEC_ID_FRWU,
-    CODEC_ID_FLASHSV2,
-    CODEC_ID_CDGRAPHICS,
-    CODEC_ID_R210,
-    CODEC_ID_ANM,
-    CODEC_ID_BINKVIDEO,
-    CODEC_ID_IFF_ILBM,
-    CODEC_ID_IFF_BYTERUN1,
-    CODEC_ID_KGV1,
-    CODEC_ID_YOP,
-    CODEC_ID_VP8,
-
-    /* various PCM "codecs" */
-    CODEC_ID_PCM_S16LE= 0x10000,
-    CODEC_ID_PCM_S16BE,
-    CODEC_ID_PCM_U16LE,
-    CODEC_ID_PCM_U16BE,
-    CODEC_ID_PCM_S8,
-    CODEC_ID_PCM_U8,
-    CODEC_ID_PCM_MULAW,
-    CODEC_ID_PCM_ALAW,
-    CODEC_ID_PCM_S32LE,
-    CODEC_ID_PCM_S32BE,
-    CODEC_ID_PCM_U32LE,
-    CODEC_ID_PCM_U32BE,
-    CODEC_ID_PCM_S24LE,
-    CODEC_ID_PCM_S24BE,
-    CODEC_ID_PCM_U24LE,
-    CODEC_ID_PCM_U24BE,
-    CODEC_ID_PCM_S24DAUD,
-    CODEC_ID_PCM_ZORK,
-    CODEC_ID_PCM_S16LE_PLANAR,
-    CODEC_ID_PCM_DVD,
-    CODEC_ID_PCM_F32BE,
-    CODEC_ID_PCM_F32LE,
-    CODEC_ID_PCM_F64BE,
-    CODEC_ID_PCM_F64LE,
-    CODEC_ID_PCM_BLURAY,
-
-    /* various ADPCM codecs */
-    CODEC_ID_ADPCM_IMA_QT= 0x11000,
-    CODEC_ID_ADPCM_IMA_WAV,
-    CODEC_ID_ADPCM_IMA_DK3,
-    CODEC_ID_ADPCM_IMA_DK4,
-    CODEC_ID_ADPCM_IMA_WS,
-    CODEC_ID_ADPCM_IMA_SMJPEG,
-    CODEC_ID_ADPCM_MS,
-    CODEC_ID_ADPCM_4XM,
-    CODEC_ID_ADPCM_XA,
-    CODEC_ID_ADPCM_ADX,
-    CODEC_ID_ADPCM_EA,
-    CODEC_ID_ADPCM_G726,
-    CODEC_ID_ADPCM_CT,
-    CODEC_ID_ADPCM_SWF,
-    CODEC_ID_ADPCM_YAMAHA,
-    CODEC_ID_ADPCM_SBPRO_4,
-    CODEC_ID_ADPCM_SBPRO_3,
-    CODEC_ID_ADPCM_SBPRO_2,
-    CODEC_ID_ADPCM_THP,
-    CODEC_ID_ADPCM_IMA_AMV,
-    CODEC_ID_ADPCM_EA_R1,
-    CODEC_ID_ADPCM_EA_R3,
-    CODEC_ID_ADPCM_EA_R2,
-    CODEC_ID_ADPCM_IMA_EA_SEAD,
-    CODEC_ID_ADPCM_IMA_EA_EACS,
-    CODEC_ID_ADPCM_EA_XAS,
-    CODEC_ID_ADPCM_EA_MAXIS_XA,
-    CODEC_ID_ADPCM_IMA_ISS,
-
-    /* AMR */
-    CODEC_ID_AMR_NB= 0x12000,
-    CODEC_ID_AMR_WB,
-
-    /* RealAudio codecs*/
-    CODEC_ID_RA_144= 0x13000,
-    CODEC_ID_RA_288,
-
-    /* various DPCM codecs */
-    CODEC_ID_ROQ_DPCM= 0x14000,
-    CODEC_ID_INTERPLAY_DPCM,
-    CODEC_ID_XAN_DPCM,
-    CODEC_ID_SOL_DPCM,
-
-    /* audio codecs */
-    CODEC_ID_MP2= 0x15000,
-    CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
-    CODEC_ID_AAC,
-    CODEC_ID_AC3,
-    CODEC_ID_DTS,
-    CODEC_ID_VORBIS,
-    CODEC_ID_DVAUDIO,
-    CODEC_ID_WMAV1,
-    CODEC_ID_WMAV2,
-    CODEC_ID_MACE3,
-    CODEC_ID_MACE6,
-    CODEC_ID_VMDAUDIO,
-    CODEC_ID_SONIC,
-    CODEC_ID_SONIC_LS,
-    CODEC_ID_FLAC,
-    CODEC_ID_MP3ADU,
-    CODEC_ID_MP3ON4,
-    CODEC_ID_SHORTEN,
-    CODEC_ID_ALAC,
-    CODEC_ID_WESTWOOD_SND1,
-    CODEC_ID_GSM, ///< as in Berlin toast format
-    CODEC_ID_QDM2,
-    CODEC_ID_COOK,
-    CODEC_ID_TRUESPEECH,
-    CODEC_ID_TTA,
-    CODEC_ID_SMACKAUDIO,
-    CODEC_ID_QCELP,
-    CODEC_ID_WAVPACK,
-    CODEC_ID_DSICINAUDIO,
-    CODEC_ID_IMC,
-    CODEC_ID_MUSEPACK7,
-    CODEC_ID_MLP,
-    CODEC_ID_GSM_MS, /* as found in WAV */
-    CODEC_ID_ATRAC3,
-    CODEC_ID_VOXWARE,
-    CODEC_ID_APE,
-    CODEC_ID_NELLYMOSER,
-    CODEC_ID_MUSEPACK8,
-    CODEC_ID_SPEEX,
-    CODEC_ID_WMAVOICE,
-    CODEC_ID_WMAPRO,
-    CODEC_ID_WMALOSSLESS,
-    CODEC_ID_ATRAC3P,
-    CODEC_ID_EAC3,
-    CODEC_ID_SIPR,
-    CODEC_ID_MP1,
-    CODEC_ID_TWINVQ,
-    CODEC_ID_TRUEHD,
-    CODEC_ID_MP4ALS,
-    CODEC_ID_ATRAC1,
-    CODEC_ID_BINKAUDIO_RDFT,
-    CODEC_ID_BINKAUDIO_DCT,
-
-    /* subtitle codecs */
-    CODEC_ID_DVD_SUBTITLE= 0x17000,
-    CODEC_ID_DVB_SUBTITLE,
-    CODEC_ID_TEXT,  ///< raw UTF-8 text
-    CODEC_ID_XSUB,
-    CODEC_ID_SSA,
-    CODEC_ID_MOV_TEXT,
-    CODEC_ID_HDMV_PGS_SUBTITLE,
-    CODEC_ID_DVB_TELETEXT,
-
-    /* other specific kind of codecs (generally used for attachments) */
-    CODEC_ID_TTF= 0x18000,
-
-    CODEC_ID_PROBE= 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
-
-    CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
-                                * stream (only used by libavformat) */
-};
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-#define CodecType AVMediaType
-
-#define CODEC_TYPE_UNKNOWN    AVMEDIA_TYPE_UNKNOWN
-#define CODEC_TYPE_VIDEO      AVMEDIA_TYPE_VIDEO
-#define CODEC_TYPE_AUDIO      AVMEDIA_TYPE_AUDIO
-#define CODEC_TYPE_DATA       AVMEDIA_TYPE_DATA
-#define CODEC_TYPE_SUBTITLE   AVMEDIA_TYPE_SUBTITLE
-#define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT
-#define CODEC_TYPE_NB         AVMEDIA_TYPE_NB
-#endif
-
-/**
- * all in native-endian format
- */
-enum SampleFormat {
-    SAMPLE_FMT_NONE = -1,
-    SAMPLE_FMT_U8,              ///< unsigned 8 bits
-    SAMPLE_FMT_S16,             ///< signed 16 bits
-    SAMPLE_FMT_S32,             ///< signed 32 bits
-    SAMPLE_FMT_FLT,             ///< float
-    SAMPLE_FMT_DBL,             ///< double
-    SAMPLE_FMT_NB               ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
-};
-
-/* Audio channel masks */
-#define CH_FRONT_LEFT             0x00000001
-#define CH_FRONT_RIGHT            0x00000002
-#define CH_FRONT_CENTER           0x00000004
-#define CH_LOW_FREQUENCY          0x00000008
-#define CH_BACK_LEFT              0x00000010
-#define CH_BACK_RIGHT             0x00000020
-#define CH_FRONT_LEFT_OF_CENTER   0x00000040
-#define CH_FRONT_RIGHT_OF_CENTER  0x00000080
-#define CH_BACK_CENTER            0x00000100
-#define CH_SIDE_LEFT              0x00000200
-#define CH_SIDE_RIGHT             0x00000400
-#define CH_TOP_CENTER             0x00000800
-#define CH_TOP_FRONT_LEFT         0x00001000
-#define CH_TOP_FRONT_CENTER       0x00002000
-#define CH_TOP_FRONT_RIGHT        0x00004000
-#define CH_TOP_BACK_LEFT          0x00008000
-#define CH_TOP_BACK_CENTER        0x00010000
-#define CH_TOP_BACK_RIGHT         0x00020000
-#define CH_STEREO_LEFT            0x20000000  ///< Stereo downmix.
-#define CH_STEREO_RIGHT           0x40000000  ///< See CH_STEREO_LEFT.
-
-/** Channel mask value used for AVCodecContext.request_channel_layout
-    to indicate that the user requests the channel order of the decoder output
-    to be the native codec channel order. */
-#define CH_LAYOUT_NATIVE          0x8000000000000000LL
-
-/* Audio channel convenience macros */
-#define CH_LAYOUT_MONO              (CH_FRONT_CENTER)
-#define CH_LAYOUT_STEREO            (CH_FRONT_LEFT|CH_FRONT_RIGHT)
-#define CH_LAYOUT_2_1               (CH_LAYOUT_STEREO|CH_BACK_CENTER)
-#define CH_LAYOUT_SURROUND          (CH_LAYOUT_STEREO|CH_FRONT_CENTER)
-#define CH_LAYOUT_4POINT0           (CH_LAYOUT_SURROUND|CH_BACK_CENTER)
-#define CH_LAYOUT_2_2               (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT)
-#define CH_LAYOUT_QUAD              (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_5POINT0           (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT)
-#define CH_LAYOUT_5POINT1           (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY)
-#define CH_LAYOUT_5POINT0_BACK      (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_5POINT1_BACK      (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY)
-#define CH_LAYOUT_7POINT0           (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_7POINT1           (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_7POINT1_WIDE      (CH_LAYOUT_5POINT1_BACK|\
-                                          CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER)
-#define CH_LAYOUT_STEREO_DOWNMIX    (CH_STEREO_LEFT|CH_STEREO_RIGHT)
-
-/* in bytes */
-#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
-
-/**
- * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
- * This is mainly needed because some optimized bitstream readers read
- * 32 or 64 bit at once and could read over the end.<br>
- * Note: If the first 23 bits of the additional bytes are not 0, then damaged
- * MPEG bitstreams could cause overread and segfault.
- */
-#define FF_INPUT_BUFFER_PADDING_SIZE 8
-
-/**
- * minimum encoding buffer size
- * Used to avoid some checks during header writing.
- */
-#define FF_MIN_BUFFER_SIZE 16384
-
-
-/**
- * motion estimation type.
- */
-enum Motion_Est_ID {
-    ME_ZERO = 1,    ///< no search, that is use 0,0 vector whenever one is needed
-    ME_FULL,
-    ME_LOG,
-    ME_PHODS,
-    ME_EPZS,        ///< enhanced predictive zonal search
-    ME_X1,          ///< reserved for experiments
-    ME_HEX,         ///< hexagon based search
-    ME_UMH,         ///< uneven multi-hexagon search
-    ME_ITER,        ///< iterative search
-    ME_TESA,        ///< transformed exhaustive search algorithm
-};
-
-enum AVDiscard{
-    /* We leave some space between them for extensions (drop some
-     * keyframes for intra-only or drop just some bidir frames). */
-    AVDISCARD_NONE   =-16, ///< discard nothing
-    AVDISCARD_DEFAULT=  0, ///< discard useless packets like 0 size packets in avi
-    AVDISCARD_NONREF =  8, ///< discard all non reference
-    AVDISCARD_BIDIR  = 16, ///< discard all bidirectional frames
-    AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes
-    AVDISCARD_ALL    = 48, ///< discard all
-};
-
-enum AVColorPrimaries{
-    AVCOL_PRI_BT709      =1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
-    AVCOL_PRI_UNSPECIFIED=2,
-    AVCOL_PRI_BT470M     =4,
-    AVCOL_PRI_BT470BG    =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
-    AVCOL_PRI_SMPTE170M  =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
-    AVCOL_PRI_SMPTE240M  =7, ///< functionally identical to above
-    AVCOL_PRI_FILM       =8,
-    AVCOL_PRI_NB           , ///< Not part of ABI
-};
-
-enum AVColorTransferCharacteristic{
-    AVCOL_TRC_BT709      =1, ///< also ITU-R BT1361
-    AVCOL_TRC_UNSPECIFIED=2,
-    AVCOL_TRC_GAMMA22    =4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
-    AVCOL_TRC_GAMMA28    =5, ///< also ITU-R BT470BG
-    AVCOL_TRC_NB           , ///< Not part of ABI
-};
-
-enum AVColorSpace{
-    AVCOL_SPC_RGB        =0,
-    AVCOL_SPC_BT709      =1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
-    AVCOL_SPC_UNSPECIFIED=2,
-    AVCOL_SPC_FCC        =4,
-    AVCOL_SPC_BT470BG    =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
-    AVCOL_SPC_SMPTE170M  =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
-    AVCOL_SPC_SMPTE240M  =7,
-    AVCOL_SPC_NB           , ///< Not part of ABI
-};
-
-enum AVColorRange{
-    AVCOL_RANGE_UNSPECIFIED=0,
-    AVCOL_RANGE_MPEG       =1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
-    AVCOL_RANGE_JPEG       =2, ///< the normal     2^n-1   "JPEG" YUV ranges
-    AVCOL_RANGE_NB           , ///< Not part of ABI
-};
-
-/**
- *  X   X      3 4 X      X are luma samples,
- *             1 2        1-6 are possible chroma positions
- *  X   X      5 6 X      0 is undefined/unknown position
- */
-enum AVChromaLocation{
-    AVCHROMA_LOC_UNSPECIFIED=0,
-    AVCHROMA_LOC_LEFT       =1, ///< mpeg2/4, h264 default
-    AVCHROMA_LOC_CENTER     =2, ///< mpeg1, jpeg, h263
-    AVCHROMA_LOC_TOPLEFT    =3, ///< DV
-    AVCHROMA_LOC_TOP        =4,
-    AVCHROMA_LOC_BOTTOMLEFT =5,
-    AVCHROMA_LOC_BOTTOM     =6,
-    AVCHROMA_LOC_NB           , ///< Not part of ABI
-};
-
-typedef struct RcOverride{
-    int start_frame;
-    int end_frame;
-    int qscale; // If this is 0 then quality_factor will be used instead.
-    float quality_factor;
-} RcOverride;
-
-#define FF_MAX_B_FRAMES 16
-
-/* encoding support
-   These flags can be passed in AVCodecContext.flags before initialization.
-   Note: Not everything is supported yet.
-*/
-
-#define CODEC_FLAG_QSCALE 0x0002  ///< Use fixed qscale.
-#define CODEC_FLAG_4MV    0x0004  ///< 4 MV per MB allowed / advanced prediction for H.263.
-#define CODEC_FLAG_QPEL   0x0010  ///< Use qpel MC.
-#define CODEC_FLAG_GMC    0x0020  ///< Use GMC.
-#define CODEC_FLAG_MV0    0x0040  ///< Always try a MB with MV=<0,0>.
-#define CODEC_FLAG_PART   0x0080  ///< Use data partitioning.
-/**
- * The parent program guarantees that the input for B-frames containing
- * streams is not written to for at least s->max_b_frames+1 frames, if
- * this is not set the input will be copied.
- */
-#define CODEC_FLAG_INPUT_PRESERVED 0x0100
-#define CODEC_FLAG_PASS1           0x0200   ///< Use internal 2pass ratecontrol in first pass mode.
-#define CODEC_FLAG_PASS2           0x0400   ///< Use internal 2pass ratecontrol in second pass mode.
-#define CODEC_FLAG_EXTERN_HUFF     0x1000   ///< Use external Huffman table (for MJPEG).
-#define CODEC_FLAG_GRAY            0x2000   ///< Only decode/encode grayscale.
-#define CODEC_FLAG_EMU_EDGE        0x4000   ///< Don't draw edges.
-#define CODEC_FLAG_PSNR            0x8000   ///< error[?] variables will be set during encoding.
-#define CODEC_FLAG_TRUNCATED       0x00010000 /** Input bitstream might be truncated at a random
-                                                  location instead of only at frame boundaries. */
-#define CODEC_FLAG_NORMALIZE_AQP  0x00020000 ///< Normalize adaptive quantization.
-#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
-#define CODEC_FLAG_LOW_DELAY      0x00080000 ///< Force low delay.
-#define CODEC_FLAG_ALT_SCAN       0x00100000 ///< Use alternate scan.
-#define CODEC_FLAG_GLOBAL_HEADER  0x00400000 ///< Place global headers in extradata instead of every keyframe.
-#define CODEC_FLAG_BITEXACT       0x00800000 ///< Use only bitexact stuff (except (I)DCT).
-/* Fx : Flag for h263+ extra options */
-#define CODEC_FLAG_AC_PRED        0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction
-#define CODEC_FLAG_H263P_UMV      0x02000000 ///< unlimited motion vector
-#define CODEC_FLAG_CBP_RD         0x04000000 ///< Use rate distortion optimization for cbp.
-#define CODEC_FLAG_QP_RD          0x08000000 ///< Use rate distortion optimization for qp selectioon.
-#define CODEC_FLAG_H263P_AIV      0x00000008 ///< H.263 alternative inter VLC
-#define CODEC_FLAG_OBMC           0x00000001 ///< OBMC
-#define CODEC_FLAG_LOOP_FILTER    0x00000800 ///< loop filter
-#define CODEC_FLAG_H263P_SLICE_STRUCT 0x10000000
-#define CODEC_FLAG_INTERLACED_ME  0x20000000 ///< interlaced motion estimation
-#define CODEC_FLAG_SVCD_SCAN_OFFSET 0x40000000 ///< Will reserve space for SVCD scan offset user data.
-#define CODEC_FLAG_CLOSED_GOP     0x80000000
-#define CODEC_FLAG2_FAST          0x00000001 ///< Allow non spec compliant speedup tricks.
-#define CODEC_FLAG2_STRICT_GOP    0x00000002 ///< Strictly enforce GOP size.
-#define CODEC_FLAG2_NO_OUTPUT     0x00000004 ///< Skip bitstream encoding.
-#define CODEC_FLAG2_LOCAL_HEADER  0x00000008 ///< Place global headers at every keyframe instead of in extradata.
-#define CODEC_FLAG2_BPYRAMID      0x00000010 ///< H.264 allow B-frames to be used as references.
-#define CODEC_FLAG2_WPRED         0x00000020 ///< H.264 weighted biprediction for B-frames
-#define CODEC_FLAG2_MIXED_REFS    0x00000040 ///< H.264 one reference per partition, as opposed to one reference per macroblock
-#define CODEC_FLAG2_8X8DCT        0x00000080 ///< H.264 high profile 8x8 transform
-#define CODEC_FLAG2_FASTPSKIP     0x00000100 ///< H.264 fast pskip
-#define CODEC_FLAG2_AUD           0x00000200 ///< H.264 access unit delimiters
-#define CODEC_FLAG2_BRDO          0x00000400 ///< B-frame rate-distortion optimization
-#define CODEC_FLAG2_INTRA_VLC     0x00000800 ///< Use MPEG-2 intra VLC table.
-#define CODEC_FLAG2_MEMC_ONLY     0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
-#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
-#define CODEC_FLAG2_SKIP_RD       0x00004000 ///< RD optimal MB level residual skipping
-#define CODEC_FLAG2_CHUNKS        0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
-#define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer.
-#define CODEC_FLAG2_BIT_RESERVOIR 0x00020000 ///< Use a bit reservoir when encoding if possible
-#define CODEC_FLAG2_MBTREE        0x00040000 ///< Use macroblock tree ratecontrol (x264 only)
-#define CODEC_FLAG2_PSY           0x00080000 ///< Use psycho visual optimizations.
-#define CODEC_FLAG2_SSIM          0x00100000 ///< Compute SSIM during encoding, error[] values are undefined.
-
-/* Unsupported options :
- *              Syntax Arithmetic coding (SAC)
- *              Reference Picture Selection
- *              Independent Segment Decoding */
-/* /Fx */
-/* codec capabilities */
-
-#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback.
-/**
- * Codec uses get_buffer() for allocating buffers and supports custom allocators.
- * If not set, it might not use get_buffer() at all or use operations that
- * assume the buffer was allocated by avcodec_default_get_buffer.
- */
-#define CODEC_CAP_DR1             0x0002
-/* If 'parse_only' field is true, then avcodec_parse_frame() can be used. */
-#define CODEC_CAP_PARSE_ONLY      0x0004
-#define CODEC_CAP_TRUNCATED       0x0008
-/* Codec can export data for HW decoding (XvMC). */
-#define CODEC_CAP_HWACCEL         0x0010
-/**
- * Codec has a nonzero delay and needs to be fed with NULL at the end to get the delayed data.
- * If this is not set, the codec is guaranteed to never be fed with NULL data.
- */
-#define CODEC_CAP_DELAY           0x0020
-/**
- * Codec can be fed a final frame with a smaller size.
- * This can be used to prevent truncation of the last audio samples.
- */
-#define CODEC_CAP_SMALL_LAST_FRAME 0x0040
-/**
- * Codec can export data for HW decoding (VDPAU).
- */
-#define CODEC_CAP_HWACCEL_VDPAU    0x0080
-/**
- * Codec can output multiple frames per AVPacket
- * Normally demuxers return one frame at a time, demuxers which do not do
- * are connected to a parser to split what they return into proper frames.
- * This flag is reserved to the very rare category of codecs which have a
- * bitstream that cannot be split into frames without timeconsuming
- * operations like full decoding. Demuxers carring such bitstreams thus
- * may return multiple frames in a packet. This has many disadvantages like
- * prohibiting stream copy in many cases thus it should only be considered
- * as a last resort.
- */
-#define CODEC_CAP_SUBFRAMES        0x0100
-/**
- * Codec is experimental and is thus avoided in favor of non experimental
- * encoders
- */
-#define CODEC_CAP_EXPERIMENTAL     0x0200
-
-//The following defines may change, don't expect compatibility if you use them.
-#define MB_TYPE_INTRA4x4   0x0001
-#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific
-#define MB_TYPE_INTRA_PCM  0x0004 //FIXME H.264-specific
-#define MB_TYPE_16x16      0x0008
-#define MB_TYPE_16x8       0x0010
-#define MB_TYPE_8x16       0x0020
-#define MB_TYPE_8x8        0x0040
-#define MB_TYPE_INTERLACED 0x0080
-#define MB_TYPE_DIRECT2    0x0100 //FIXME
-#define MB_TYPE_ACPRED     0x0200
-#define MB_TYPE_GMC        0x0400
-#define MB_TYPE_SKIP       0x0800
-#define MB_TYPE_P0L0       0x1000
-#define MB_TYPE_P1L0       0x2000
-#define MB_TYPE_P0L1       0x4000
-#define MB_TYPE_P1L1       0x8000
-#define MB_TYPE_L0         (MB_TYPE_P0L0 | MB_TYPE_P1L0)
-#define MB_TYPE_L1         (MB_TYPE_P0L1 | MB_TYPE_P1L1)
-#define MB_TYPE_L0L1       (MB_TYPE_L0   | MB_TYPE_L1)
-#define MB_TYPE_QUANT      0x00010000
-#define MB_TYPE_CBP        0x00020000
-//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...)
-
-/**
- * Pan Scan area.
- * This specifies the area which should be displayed.
- * Note there may be multiple such areas for one frame.
- */
-typedef struct AVPanScan{
-    /**
-     * id
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-    int id;
-
-    /**
-     * width and height in 1/16 pel
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-    int width;
-    int height;
-
-    /**
-     * position of the top left corner in 1/16 pel for up to 3 fields/frames
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-    int16_t position[3][2];
-}AVPanScan;
-
-#define FF_COMMON_FRAME \
-    /**\
-     * pointer to the picture planes.\
-     * This might be different from the first allocated byte\
-     * - encoding: \
-     * - decoding: \
-     */\
-    uint8_t *data[4];\
-    int linesize[4];\
-    /**\
-     * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.\
-     * This isn't used by libavcodec unless the default get/release_buffer() is used.\
-     * - encoding: \
-     * - decoding: \
-     */\
-    uint8_t *base[4];\
-    /**\
-     * 1 -> keyframe, 0-> not\
-     * - encoding: Set by libavcodec.\
-     * - decoding: Set by libavcodec.\
-     */\
-    int key_frame;\
-\
-    /**\
-     * Picture type of the frame, see ?_TYPE below.\
-     * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
-     * - decoding: Set by libavcodec.\
-     */\
-    int pict_type;\
-\
-    /**\
-     * presentation timestamp in time_base units (time when frame should be shown to user)\
-     * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
-     * - encoding: MUST be set by user.\
-     * - decoding: Set by libavcodec.\
-     */\
-    int64_t pts;\
-\
-    /**\
-     * picture number in bitstream order\
-     * - encoding: set by\
-     * - decoding: Set by libavcodec.\
-     */\
-    int coded_picture_number;\
-    /**\
-     * picture number in display order\
-     * - encoding: set by\
-     * - decoding: Set by libavcodec.\
-     */\
-    int display_picture_number;\
-\
-    /**\
-     * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) \
-     * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\
-     * - decoding: Set by libavcodec.\
-     */\
-    int quality; \
-\
-    /**\
-     * buffer age (1->was last buffer and dint change, 2->..., ...).\
-     * Set to INT_MAX if the buffer has not been used yet.\
-     * - encoding: unused\
-     * - decoding: MUST be set by get_buffer().\
-     */\
-    int age;\
-\
-    /**\
-     * is this picture used as reference\
-     * The values for this are the same as the MpegEncContext.picture_structure\
-     * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.\
-     * Set to 4 for delayed, non-reference frames.\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec. (before get_buffer() call)).\
-     */\
-    int reference;\
-\
-    /**\
-     * QP table\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec.\
-     */\
-    int8_t *qscale_table;\
-    /**\
-     * QP store stride\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec.\
-     */\
-    int qstride;\
-\
-    /**\
-     * mbskip_table[mb]>=1 if MB didn't change\
-     * stride= mb_width = (width+15)>>4\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec.\
-     */\
-    uint8_t *mbskip_table;\
-\
-    /**\
-     * motion vector table\
-     * @code\
-     * example:\
-     * int mv_sample_log2= 4 - motion_subsample_log2;\
-     * int mb_width= (width+15)>>4;\
-     * int mv_stride= (mb_width << mv_sample_log2) + 1;\
-     * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];\
-     * @endcode\
-     * - encoding: Set by user.\
-     * - decoding: Set by libavcodec.\
-     */\
-    int16_t (*motion_val[2])[2];\
-\
-    /**\
-     * macroblock type table\
-     * mb_type_base + mb_width + 2\
-     * - encoding: Set by user.\
-     * - decoding: Set by libavcodec.\
-     */\
-    uint32_t *mb_type;\
-\
-    /**\
-     * log2 of the size of the block which a single vector in motion_val represents: \
-     * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec.\
-     */\
-    uint8_t motion_subsample_log2;\
-\
-    /**\
-     * for some private data of the user\
-     * - encoding: unused\
-     * - decoding: Set by user.\
-     */\
-    void *opaque;\
-\
-    /**\
-     * error\
-     * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.\
-     * - decoding: unused\
-     */\
-    uint64_t error[4];\
-\
-    /**\
-     * type of the buffer (to keep track of who has to deallocate data[*])\
-     * - encoding: Set by the one who allocates it.\
-     * - decoding: Set by the one who allocates it.\
-     * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.\
-     */\
-    int type;\
-    \
-    /**\
-     * When decoding, this signals how much the picture must be delayed.\
-     * extra_delay = repeat_pict / (2*fps)\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec.\
-     */\
-    int repeat_pict;\
-    \
-    /**\
-     * \
-     */\
-    int qscale_type;\
-    \
-    /**\
-     * The content of the picture is interlaced.\
-     * - encoding: Set by user.\
-     * - decoding: Set by libavcodec. (default 0)\
-     */\
-    int interlaced_frame;\
-    \
-    /**\
-     * If the content is interlaced, is top field displayed first.\
-     * - encoding: Set by user.\
-     * - decoding: Set by libavcodec.\
-     */\
-    int top_field_first;\
-    \
-    /**\
-     * Pan scan.\
-     * - encoding: Set by user.\
-     * - decoding: Set by libavcodec.\
-     */\
-    AVPanScan *pan_scan;\
-    \
-    /**\
-     * Tell user application that palette has changed from previous frame.\
-     * - encoding: ??? (no palette-enabled encoder yet)\
-     * - decoding: Set by libavcodec. (default 0).\
-     */\
-    int palette_has_changed;\
-    \
-    /**\
-     * codec suggestion on buffer type if != 0\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec. (before get_buffer() call)).\
-     */\
-    int buffer_hints;\
-\
-    /**\
-     * DCT coefficients\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec.\
-     */\
-    short *dct_coeff;\
-\
-    /**\
-     * motion reference frame index\
-     * the order in which these are stored can depend on the codec.\
-     * - encoding: Set by user.\
-     * - decoding: Set by libavcodec.\
-     */\
-    int8_t *ref_index[2];\
-\
-    /**\
-     * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reordered_opaque\
-     * output in AVFrame.reordered_opaque\
-     * - encoding: unused\
-     * - decoding: Read by user.\
-     */\
-    int64_t reordered_opaque;\
-\
-    /**\
-     * hardware accelerator private data (FFmpeg allocated)\
-     * - encoding: unused\
-     * - decoding: Set by libavcodec\
-     */\
-    void *hwaccel_picture_private;\
-
-
-#define FF_QSCALE_TYPE_MPEG1 0
-#define FF_QSCALE_TYPE_MPEG2 1
-#define FF_QSCALE_TYPE_H264  2
-#define FF_QSCALE_TYPE_VP56  3
-
-#define FF_BUFFER_TYPE_INTERNAL 1
-#define FF_BUFFER_TYPE_USER     2 ///< direct rendering buffers (image is (de)allocated by user)
-#define FF_BUFFER_TYPE_SHARED   4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared.
-#define FF_BUFFER_TYPE_COPY     8 ///< Just a (modified) copy of some other buffer, don't deallocate anything.
-
-
-#define FF_I_TYPE  1 ///< Intra
-#define FF_P_TYPE  2 ///< Predicted
-#define FF_B_TYPE  3 ///< Bi-dir predicted
-#define FF_S_TYPE  4 ///< S(GMC)-VOP MPEG4
-#define FF_SI_TYPE 5 ///< Switching Intra
-#define FF_SP_TYPE 6 ///< Switching Predicted
-#define FF_BI_TYPE 7
-
-#define FF_BUFFER_HINTS_VALID    0x01 // Buffer hints value is meaningful (if 0 ignore).
-#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer.
-#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
-#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
-
-typedef struct AVPacket {
-    /**
-     * Presentation timestamp in AVStream->time_base units; the time at which
-     * the decompressed packet will be presented to the user.
-     * Can be AV_NOPTS_VALUE if it is not stored in the file.
-     * pts MUST be larger or equal to dts as presentation cannot happen before
-     * decompression, unless one wants to view hex dumps. Some formats misuse
-     * the terms dts and pts/cts to mean something different. Such timestamps
-     * must be converted to true pts/dts before they are stored in AVPacket.
-     */
-    int64_t pts;
-    /**
-     * Decompression timestamp in AVStream->time_base units; the time at which
-     * the packet is decompressed.
-     * Can be AV_NOPTS_VALUE if it is not stored in the file.
-     */
-    int64_t dts;
-    uint8_t *data;
-    int   size;
-    int   stream_index;
-    int   flags;
-    /**
-     * Duration of this packet in AVStream->time_base units, 0 if unknown.
-     * Equals next_pts - this_pts in presentation order.
-     */
-    int   duration;
-    void  (*destruct)(struct AVPacket *);
-    void  *priv;
-    int64_t pos;                            ///< byte position in stream, -1 if unknown
-
-    /**
-     * Time difference in AVStream->time_base units from the pts of this
-     * packet to the point at which the output from the decoder has converged
-     * independent from the availability of previous frames. That is, the
-     * frames are virtually identical no matter if decoding started from
-     * the very first frame or from this keyframe.
-     * Is AV_NOPTS_VALUE if unknown.
-     * This field is not the display duration of the current packet.
-     *
-     * The purpose of this field is to allow seeking in streams that have no
-     * keyframes in the conventional sense. It corresponds to the
-     * recovery point SEI in H.264 and match_time_delta in NUT. It is also
-     * essential for some types of subtitle streams to ensure that all
-     * subtitles are correctly displayed after seeking.
-     */
-    int64_t convergence_duration;
-} AVPacket;
-#define AV_PKT_FLAG_KEY   0x0001
-#if LIBAVCODEC_VERSION_MAJOR < 53
-#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
-#endif
-
-/**
- * Audio Video Frame.
- * New fields can be added to the end of FF_COMMON_FRAME with minor version
- * bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump. No fields should be added into AVFrame before or after
- * FF_COMMON_FRAME!
- * sizeof(AVFrame) must not be used outside libav*.
- */
-typedef struct AVFrame {
-    FF_COMMON_FRAME
-} AVFrame;
-
-/**
- * main external API structure.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(AVCodecContext) must not be used outside libav*.
- */
-typedef struct AVCodecContext {
-    /**
-     * information on struct for av_log
-     * - set by avcodec_alloc_context
-     */
-    const AVClass *av_class;
-    /**
-     * the average bitrate
-     * - encoding: Set by user; unused for constant quantizer encoding.
-     * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream.
-     */
-    int bit_rate;
-
-    /**
-     * number of bits the bitstream is allowed to diverge from the reference.
-     *           the reference can be CBR (for CBR pass1) or VBR (for pass2)
-     * - encoding: Set by user; unused for constant quantizer encoding.
-     * - decoding: unused
-     */
-    int bit_rate_tolerance;
-
-    /**
-     * CODEC_FLAG_*.
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     */
-    int flags;
-
-    /**
-     * Some codecs need additional format info. It is stored here.
-     * If any muxer uses this then ALL demuxers/parsers AND encoders for the
-     * specific codec MUST set it correctly otherwise stream copy breaks.
-     * In general use of this field by muxers is not recommanded.
-     * - encoding: Set by libavcodec.
-     * - decoding: Set by libavcodec. (FIXME: Is this OK?)
-     */
-    int sub_id;
-
-    /**
-     * Motion estimation algorithm used for video coding.
-     * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex),
-     * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific]
-     * - encoding: MUST be set by user.
-     * - decoding: unused
-     */
-    int me_method;
-
-    /**
-     * some codecs need / can use extradata like Huffman tables.
-     * mjpeg: Huffman tables
-     * rv10: additional flags
-     * mpeg4: global headers (they can be in the bitstream or here)
-     * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger
-     * than extradata_size to avoid prolems if it is read with the bitstream reader.
-     * The bytewise contents of extradata must not depend on the architecture or CPU endianness.
-     * - encoding: Set/allocated/freed by libavcodec.
-     * - decoding: Set/allocated/freed by user.
-     */
-    uint8_t *extradata;
-    int extradata_size;
-
-    /**
-     * This is the fundamental unit of time (in seconds) in terms
-     * of which frame timestamps are represented. For fixed-fps content,
-     * timebase should be 1/framerate and timestamp increments should be
-     * identically 1.
-     * - encoding: MUST be set by user.
-     * - decoding: Set by libavcodec.
-     */
-    AVRational time_base;
-
-    /* video only */
-    /**
-     * picture width / height.
-     * - encoding: MUST be set by user.
-     * - decoding: Set by libavcodec.
-     * Note: For compatibility it is possible to set this instead of
-     * coded_width/height before decoding.
-     */
-    int width, height;
-
-#define FF_ASPECT_EXTENDED 15
-
-    /**
-     * the number of pictures in a group of pictures, or 0 for intra_only
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int gop_size;
-
-    /**
-     * Pixel format, see PIX_FMT_xxx.
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-    enum PixelFormat pix_fmt;
-
-    /**
-     * Frame rate emulation. If not zero, the lower layer (i.e. format handler)
-     * has to read frames at native frame rate.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int rate_emu;
-
-    /**
-     * If non NULL, 'draw_horiz_band' is called by the libavcodec
-     * decoder to draw a horizontal band. It improves cache usage. Not
-     * all codecs can do that. You must check the codec capabilities
-     * beforehand.
-     * The function is also used by hardware acceleration APIs.
-     * It is called at least once during frame decoding to pass
-     * the data needed for hardware render.
-     * In that mode instead of pixel data, AVFrame points to
-     * a structure specific to the acceleration API. The application
-     * reads the structure and can change some fields to indicate progress
-     * or mark state.
-     * - encoding: unused
-     * - decoding: Set by user.
-     * @param height the height of the slice
-     * @param y the y position of the slice
-     * @param type 1->top field, 2->bottom field, 3->frame
-     * @param offset offset into the AVFrame.data from which the slice should be read
-     */
-    void (*draw_horiz_band)(struct AVCodecContext *s,
-                            const AVFrame *src, int offset[4],
-                            int y, int type, int height);
-
-    /* audio only */
-    int sample_rate; ///< samples per second
-    int channels;    ///< number of audio channels
-
-    /**
-     * audio sample format
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-    enum SampleFormat sample_fmt;  ///< sample format
-
-    /* The following data should not be initialized. */
-    /**
-     * Samples per packet, initialized when calling 'init'.
-     */
-    int frame_size;
-    int frame_number;   ///< audio or video frame number
-#if LIBAVCODEC_VERSION_MAJOR < 53
-    int real_pict_num;  ///< Returns the real picture number of previous encoded frame.
-#endif
-
-    /**
-     * Number of frames the decoded output will be delayed relative to
-     * the encoded input.
-     * - encoding: Set by libavcodec.
-     * - decoding: unused
-     */
-    int delay;
-
-    /* - encoding parameters */
-    float qcompress;  ///< amount of qscale change between easy & hard scenes (0.0-1.0)
-    float qblur;      ///< amount of qscale smoothing over time (0.0-1.0)
-
-    /**
-     * minimum quantizer
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int qmin;
-
-    /**
-     * maximum quantizer
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int qmax;
-
-    /**
-     * maximum quantizer difference between frames
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int max_qdiff;
-
-    /**
-     * maximum number of B-frames between non-B-frames
-     * Note: The output will be delayed by max_b_frames+1 relative to the input.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int max_b_frames;
-
-    /**
-     * qscale factor between IP and B-frames
-     * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset).
-     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float b_quant_factor;
-
-    /** obsolete FIXME remove */
-    int rc_strategy;
-#define FF_RC_STRATEGY_XVID 1
-
-    int b_frame_strategy;
-
-    /**
-     * hurry up amount
-     * - encoding: unused
-     * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
-     * @deprecated Deprecated in favor of skip_idct and skip_frame.
-     */
-    int hurry_up;
-
-    struct AVCodec *codec;
-
-    void *priv_data;
-
-    int rtp_payload_size;   /* The size of the RTP payload: the coder will  */
-                            /* do its best to deliver a chunk with size     */
-                            /* below rtp_payload_size, the chunk will start */
-                            /* with a start code on some codecs like H.263. */
-                            /* This doesn't take account of any particular  */
-                            /* headers inside the transmitted RTP payload.  */
-
-
-    /* The RTP callback: This function is called    */
-    /* every time the encoder has a packet to send. */
-    /* It depends on the encoder if the data starts */
-    /* with a Start Code (it should). H.263 does.   */
-    /* mb_nb contains the number of macroblocks     */
-    /* encoded in the RTP payload.                  */
-    void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb);
-
-    /* statistics, used for 2-pass encoding */
-    int mv_bits;
-    int header_bits;
-    int i_tex_bits;
-    int p_tex_bits;
-    int i_count;
-    int p_count;
-    int skip_count;
-    int misc_bits;
-
-    /**
-     * number of bits used for the previously encoded frame
-     * - encoding: Set by libavcodec.
-     * - decoding: unused
-     */
-    int frame_bits;
-
-    /**
-     * Private data of the user, can be used to carry app specific stuff.
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     */
-    void *opaque;
-
-    char codec_name[32];
-    enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */
-    enum CodecID codec_id; /* see CODEC_ID_xxx */
-
-    /**
-     * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
-     * This is used to work around some encoder bugs.
-     * A demuxer should set this to what is stored in the field used to identify the codec.
-     * If there are multiple such fields in a container then the demuxer should choose the one
-     * which maximizes the information about the used codec.
-     * If the codec tag field in a container is larger then 32 bits then the demuxer should
-     * remap the longer ID to 32 bits with a table or other structure. Alternatively a new
-     * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
-     * first.
-     * - encoding: Set by user, if not then the default based on codec_id will be used.
-     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
-     */
-    unsigned int codec_tag;
-
-    /**
-     * Work around bugs in encoders which sometimes cannot be detected automatically.
-     * - encoding: Set by user
-     * - decoding: Set by user
-     */
-    int workaround_bugs;
-#define FF_BUG_AUTODETECT       1  ///< autodetection
-#define FF_BUG_OLD_MSMPEG4      2
-#define FF_BUG_XVID_ILACE       4
-#define FF_BUG_UMP4             8
-#define FF_BUG_NO_PADDING       16
-#define FF_BUG_AMV              32
-#define FF_BUG_AC_VLC           0  ///< Will be removed, libavcodec can now handle these non-compliant files by default.
-#define FF_BUG_QPEL_CHROMA      64
-#define FF_BUG_STD_QPEL         128
-#define FF_BUG_QPEL_CHROMA2     256
-#define FF_BUG_DIRECT_BLOCKSIZE 512
-#define FF_BUG_EDGE             1024
-#define FF_BUG_HPEL_CHROMA      2048
-#define FF_BUG_DC_CLIP          4096
-#define FF_BUG_MS               8192 ///< Work around various bugs in Microsoft's broken decoders.
-#define FF_BUG_TRUNCATED       16384
-//#define FF_BUG_FAKE_SCALABILITY 16 //Autodetection should work 100%.
-
-    /**
-     * luma single coefficient elimination threshold
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int luma_elim_threshold;
-
-    /**
-     * chroma single coeff elimination threshold
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int chroma_elim_threshold;
-
-    /**
-     * strictly follow the standard (MPEG4, ...).
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     * Setting this to STRICT or higher means the encoder and decoder will
-     * generally do stupid things. While setting it to inofficial or lower
-     * will mean the encoder might use things that are not supported by all
-     * spec compliant decoders. Decoders make no difference between normal,
-     * inofficial and experimental, that is they always try to decode things
-     * when they can unless they are explicitly asked to behave stupid
-     * (=strictly conform to the specs)
-     */
-    int strict_std_compliance;
-#define FF_COMPLIANCE_VERY_STRICT   2 ///< Strictly conform to a older more strict version of the spec or reference software.
-#define FF_COMPLIANCE_STRICT        1 ///< Strictly conform to all the things in the spec no matter what consequences.
-#define FF_COMPLIANCE_NORMAL        0
-#define FF_COMPLIANCE_INOFFICIAL   -1 ///< Allow inofficial extensions.
-#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things.
-
-    /**
-     * qscale offset between IP and B-frames
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float b_quant_offset;
-
-    /**
-     * Error recognization; higher values will detect more errors but may
-     * misdetect some more or less valid parts as errors.
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    int error_recognition;
-#define FF_ER_CAREFUL         1
-#define FF_ER_COMPLIANT       2
-#define FF_ER_AGGRESSIVE      3
-#define FF_ER_VERY_AGGRESSIVE 4
-
-    /**
-     * Called at the beginning of each frame to get a buffer for it.
-     * If pic.reference is set then the frame will be read later by libavcodec.
-     * avcodec_align_dimensions2() should be used to find the required width and
-     * height, as they normally need to be rounded up to the next multiple of 16.
-     * if CODEC_CAP_DR1 is not set then get_buffer() must call
-     * avcodec_default_get_buffer() instead of providing buffers allocated by
-     * some other means.
-     * - encoding: unused
-     * - decoding: Set by libavcodec., user can override.
-     */
-    int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic);
-
-    /**
-     * Called to release buffers which were allocated with get_buffer.
-     * A released buffer can be reused in get_buffer().
-     * pic.data[*] must be set to NULL.
-     * - encoding: unused
-     * - decoding: Set by libavcodec., user can override.
-     */
-    void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic);
-
-    /**
-     * Size of the frame reordering buffer in the decoder.
-     * For MPEG-2 it is 1 IPB or 0 low delay IP.
-     * - encoding: Set by libavcodec.
-     * - decoding: Set by libavcodec.
-     */
-    int has_b_frames;
-
-    /**
-     * number of bytes per packet if constant and known or 0
-     * Used by some WAV based audio codecs.
-     */
-    int block_align;
-
-    int parse_only; /* - decoding only: If true, only parsing is done
-                       (function avcodec_parse_frame()). The frame
-                       data is returned. Only MPEG codecs support this now. */
-
-    /**
-     * 0-> h263 quant 1-> mpeg quant
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int mpeg_quant;
-
-    /**
-     * pass1 encoding statistics output buffer
-     * - encoding: Set by libavcodec.
-     * - decoding: unused
-     */
-    char *stats_out;
-
-    /**
-     * pass2 encoding statistics input buffer
-     * Concatenated stuff from stats_out of pass1 should be placed here.
-     * - encoding: Allocated/set/freed by user.
-     * - decoding: unused
-     */
-    char *stats_in;
-
-    /**
-     * ratecontrol qmin qmax limiting method
-     * 0-> clipping, 1-> use a nice continous function to limit qscale wthin qmin/qmax.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float rc_qsquish;
-
-    float rc_qmod_amp;
-    int rc_qmod_freq;
-
-    /**
-     * ratecontrol override, see RcOverride
-     * - encoding: Allocated/set/freed by user.
-     * - decoding: unused
-     */
-    RcOverride *rc_override;
-    int rc_override_count;
-
-    /**
-     * rate control equation
-     * - encoding: Set by user
-     * - decoding: unused
-     */
-    const char *rc_eq;
-
-    /**
-     * maximum bitrate
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int rc_max_rate;
-
-    /**
-     * minimum bitrate
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int rc_min_rate;
-
-    /**
-     * decoder bitstream buffer size
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int rc_buffer_size;
-    float rc_buffer_aggressivity;
-
-    /**
-     * qscale factor between P and I-frames
-     * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset).
-     * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float i_quant_factor;
-
-    /**
-     * qscale offset between P and I-frames
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float i_quant_offset;
-
-    /**
-     * initial complexity for pass1 ratecontrol
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float rc_initial_cplx;
-
-    /**
-     * DCT algorithm, see FF_DCT_* below
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int dct_algo;
-#define FF_DCT_AUTO    0
-#define FF_DCT_FASTINT 1
-#define FF_DCT_INT     2
-#define FF_DCT_MMX     3
-#define FF_DCT_MLIB    4
-#define FF_DCT_ALTIVEC 5
-#define FF_DCT_FAAN    6
-
-    /**
-     * luminance masking (0-> disabled)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float lumi_masking;
-
-    /**
-     * temporary complexity masking (0-> disabled)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float temporal_cplx_masking;
-
-    /**
-     * spatial complexity masking (0-> disabled)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float spatial_cplx_masking;
-
-    /**
-     * p block masking (0-> disabled)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float p_masking;
-
-    /**
-     * darkness masking (0-> disabled)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float dark_masking;
-
-    /**
-     * IDCT algorithm, see FF_IDCT_* below.
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     */
-    int idct_algo;
-#define FF_IDCT_AUTO          0
-#define FF_IDCT_INT           1
-#define FF_IDCT_SIMPLE        2
-#define FF_IDCT_SIMPLEMMX     3
-#define FF_IDCT_LIBMPEG2MMX   4
-#define FF_IDCT_PS2           5
-#define FF_IDCT_MLIB          6
-#define FF_IDCT_ARM           7
-#define FF_IDCT_ALTIVEC       8
-#define FF_IDCT_SH4           9
-#define FF_IDCT_SIMPLEARM     10
-#define FF_IDCT_H264          11
-#define FF_IDCT_VP3           12
-#define FF_IDCT_IPP           13
-#define FF_IDCT_XVIDMMX       14
-#define FF_IDCT_CAVS          15
-#define FF_IDCT_SIMPLEARMV5TE 16
-#define FF_IDCT_SIMPLEARMV6   17
-#define FF_IDCT_SIMPLEVIS     18
-#define FF_IDCT_WMV2          19
-#define FF_IDCT_FAAN          20
-#define FF_IDCT_EA            21
-#define FF_IDCT_SIMPLENEON    22
-#define FF_IDCT_SIMPLEALPHA   23
-#define FF_IDCT_BINK          24
-
-    /**
-     * slice count
-     * - encoding: Set by libavcodec.
-     * - decoding: Set by user (or 0).
-     */
-    int slice_count;
-    /**
-     * slice offsets in the frame in bytes
-     * - encoding: Set/allocated by libavcodec.
-     * - decoding: Set/allocated by user (or NULL).
-     */
-    int *slice_offset;
-
-    /**
-     * error concealment flags
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    int error_concealment;
-#define FF_EC_GUESS_MVS   1
-#define FF_EC_DEBLOCK     2
-
-    /**
-     * dsp_mask could be add used to disable unwanted CPU features
-     * CPU features (i.e. MMX, SSE. ...)
-     *
-     * With the FORCE flag you may instead enable given CPU features.
-     * (Dangerous: Usable in case of misdetection, improper usage however will
-     * result into program crash.)
-     */
-    unsigned dsp_mask;
-#define FF_MM_FORCE    0x80000000 /* Force usage of selected flags (OR) */
-    /* lower 16 bits - CPU features */
-#define FF_MM_MMX      0x0001 ///< standard MMX
-#define FF_MM_3DNOW    0x0004 ///< AMD 3DNOW
-#if LIBAVCODEC_VERSION_MAJOR < 53
-#define FF_MM_MMXEXT   0x0002 ///< SSE integer functions or AMD MMX ext
-#endif
-#define FF_MM_MMX2     0x0002 ///< SSE integer functions or AMD MMX ext
-#define FF_MM_SSE      0x0008 ///< SSE functions
-#define FF_MM_SSE2     0x0010 ///< PIV SSE2 functions
-#define FF_MM_3DNOWEXT 0x0020 ///< AMD 3DNowExt
-#define FF_MM_SSE3     0x0040 ///< Prescott SSE3 functions
-#define FF_MM_SSSE3    0x0080 ///< Conroe SSSE3 functions
-#define FF_MM_SSE4     0x0100 ///< Penryn SSE4.1 functions
-#define FF_MM_SSE42    0x0200 ///< Nehalem SSE4.2 functions
-#define FF_MM_IWMMXT   0x0100 ///< XScale IWMMXT
-#define FF_MM_ALTIVEC  0x0001 ///< standard AltiVec
-
-    /**
-     * bits per sample/pixel from the demuxer (needed for huffyuv).
-     * - encoding: Set by libavcodec.
-     * - decoding: Set by user.
-     */
-     int bits_per_coded_sample;
-
-    /**
-     * prediction method (needed for huffyuv)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-     int prediction_method;
-#define FF_PRED_LEFT   0
-#define FF_PRED_PLANE  1
-#define FF_PRED_MEDIAN 2
-
-    /**
-     * sample aspect ratio (0 if unknown)
-     * That is the width of a pixel divided by the height of the pixel.
-     * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-    AVRational sample_aspect_ratio;
-
-    /**
-     * the picture in the bitstream
-     * - encoding: Set by libavcodec.
-     * - decoding: Set by libavcodec.
-     */
-    AVFrame *coded_frame;
-
-    /**
-     * debug
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     */
-    int debug;
-#define FF_DEBUG_PICT_INFO   1
-#define FF_DEBUG_RC          2
-#define FF_DEBUG_BITSTREAM   4
-#define FF_DEBUG_MB_TYPE     8
-#define FF_DEBUG_QP          16
-#define FF_DEBUG_MV          32
-#define FF_DEBUG_DCT_COEFF   0x00000040
-#define FF_DEBUG_SKIP        0x00000080
-#define FF_DEBUG_STARTCODE   0x00000100
-#define FF_DEBUG_PTS         0x00000200
-#define FF_DEBUG_ER          0x00000400
-#define FF_DEBUG_MMCO        0x00000800
-#define FF_DEBUG_BUGS        0x00001000
-#define FF_DEBUG_VIS_QP      0x00002000
-#define FF_DEBUG_VIS_MB_TYPE 0x00004000
-#define FF_DEBUG_BUFFERS     0x00008000
-
-    /**
-     * debug
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     */
-    int debug_mv;
-#define FF_DEBUG_VIS_MV_P_FOR  0x00000001 //visualize forward predicted MVs of P frames
-#define FF_DEBUG_VIS_MV_B_FOR  0x00000002 //visualize forward predicted MVs of B frames
-#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
-
-    /**
-     * error
-     * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR.
-     * - decoding: unused
-     */
-    uint64_t error[4];
-
-    /**
-     * minimum MB quantizer
-     * - encoding: unused
-     * - decoding: unused
-     */
-    int mb_qmin;
-
-    /**
-     * maximum MB quantizer
-     * - encoding: unused
-     * - decoding: unused
-     */
-    int mb_qmax;
-
-    /**
-     * motion estimation comparison function
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int me_cmp;
-    /**
-     * subpixel motion estimation comparison function
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int me_sub_cmp;
-    /**
-     * macroblock comparison function (not supported yet)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int mb_cmp;
-    /**
-     * interlaced DCT comparison function
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int ildct_cmp;
-#define FF_CMP_SAD    0
-#define FF_CMP_SSE    1
-#define FF_CMP_SATD   2
-#define FF_CMP_DCT    3
-#define FF_CMP_PSNR   4
-#define FF_CMP_BIT    5
-#define FF_CMP_RD     6
-#define FF_CMP_ZERO   7
-#define FF_CMP_VSAD   8
-#define FF_CMP_VSSE   9
-#define FF_CMP_NSSE   10
-#define FF_CMP_W53    11
-#define FF_CMP_W97    12
-#define FF_CMP_DCTMAX 13
-#define FF_CMP_DCT264 14
-#define FF_CMP_CHROMA 256
-
-    /**
-     * ME diamond size & shape
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int dia_size;
-
-    /**
-     * amount of previous MV predictors (2a+1 x 2a+1 square)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int last_predictor_count;
-
-    /**
-     * prepass for motion estimation
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int pre_me;
-
-    /**
-     * motion estimation prepass comparison function
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int me_pre_cmp;
-
-    /**
-     * ME prepass diamond size & shape
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int pre_dia_size;
-
-    /**
-     * subpel ME quality
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int me_subpel_quality;
-
-    /**
-     * callback to negotiate the pixelFormat
-     * @param fmt is the list of formats which are supported by the codec,
-     * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality.
-     * The first is always the native one.
-     * @return the chosen format
-     * - encoding: unused
-     * - decoding: Set by user, if not set the native format will be chosen.
-     */
-    enum PixelFormat (*get_format)(struct AVCodecContext *s, const enum PixelFormat * fmt);
-
-    /**
-     * DTG active format information (additional aspect ratio
-     * information only used in DVB MPEG-2 transport streams)
-     * 0 if not set.
-     *
-     * - encoding: unused
-     * - decoding: Set by decoder.
-     */
-    int dtg_active_format;
-#define FF_DTG_AFD_SAME         8
-#define FF_DTG_AFD_4_3          9
-#define FF_DTG_AFD_16_9         10
-#define FF_DTG_AFD_14_9         11
-#define FF_DTG_AFD_4_3_SP_14_9  13
-#define FF_DTG_AFD_16_9_SP_14_9 14
-#define FF_DTG_AFD_SP_4_3       15
-
-    /**
-     * maximum motion estimation search range in subpel units
-     * If 0 then no limit.
-     *
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int me_range;
-
-    /**
-     * intra quantizer bias
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int intra_quant_bias;
-#define FF_DEFAULT_QUANT_BIAS 999999
-
-    /**
-     * inter quantizer bias
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int inter_quant_bias;
-
-    /**
-     * color table ID
-     * - encoding: unused
-     * - decoding: Which clrtable should be used for 8bit RGB images.
-     *             Tables have to be stored somewhere. FIXME
-     */
-    int color_table_id;
-
-    /**
-     * internal_buffer count
-     * Don't touch, used by libavcodec default_get_buffer().
-     */
-    int internal_buffer_count;
-
-    /**
-     * internal_buffers
-     * Don't touch, used by libavcodec default_get_buffer().
-     */
-    void *internal_buffer;
-
-#define FF_LAMBDA_SHIFT 7
-#define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
-#define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
-#define FF_LAMBDA_MAX (256*128-1)
-
-#define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove
-    /**
-     * Global quality for codecs which cannot change it per frame.
-     * This should be proportional to MPEG-1/2/4 qscale.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int global_quality;
-
-#define FF_CODER_TYPE_VLC       0
-#define FF_CODER_TYPE_AC        1
-#define FF_CODER_TYPE_RAW       2
-#define FF_CODER_TYPE_RLE       3
-#define FF_CODER_TYPE_DEFLATE   4
-    /**
-     * coder type
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int coder_type;
-
-    /**
-     * context model
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int context_model;
-#if 0
-    /**
-     *
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    uint8_t * (*realloc)(struct AVCodecContext *s, uint8_t *buf, int buf_size);
-#endif
-
-    /**
-     * slice flags
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    int slice_flags;
-#define SLICE_FLAG_CODED_ORDER    0x0001 ///< draw_horiz_band() is called in coded order instead of display
-#define SLICE_FLAG_ALLOW_FIELD    0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics)
-#define SLICE_FLAG_ALLOW_PLANE    0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
-
-    /**
-     * XVideo Motion Acceleration
-     * - encoding: forbidden
-     * - decoding: set by decoder
-     */
-    int xvmc_acceleration;
-
-    /**
-     * macroblock decision mode
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int mb_decision;
-#define FF_MB_DECISION_SIMPLE 0        ///< uses mb_cmp
-#define FF_MB_DECISION_BITS   1        ///< chooses the one which needs the fewest bits
-#define FF_MB_DECISION_RD     2        ///< rate distortion
-
-    /**
-     * custom intra quantization matrix
-     * - encoding: Set by user, can be NULL.
-     * - decoding: Set by libavcodec.
-     */
-    uint16_t *intra_matrix;
-
-    /**
-     * custom inter quantization matrix
-     * - encoding: Set by user, can be NULL.
-     * - decoding: Set by libavcodec.
-     */
-    uint16_t *inter_matrix;
-
-    /**
-     * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
-     * This is used to work around some encoder bugs.
-     * - encoding: unused
-     * - decoding: Set by user, will be converted to uppercase by libavcodec during init.
-     */
-    unsigned int stream_codec_tag;
-
-    /**
-     * scene change detection threshold
-     * 0 is default, larger means fewer detected scene changes.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int scenechange_threshold;
-
-    /**
-     * minimum Lagrange multipler
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int lmin;
-
-    /**
-     * maximum Lagrange multipler
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int lmax;
-
-    /**
-     * palette control structure
-     * - encoding: ??? (no palette-enabled encoder yet)
-     * - decoding: Set by user.
-     */
-    struct AVPaletteControl *palctrl;
-
-    /**
-     * noise reduction strength
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int noise_reduction;
-
-    /**
-     * Called at the beginning of a frame to get cr buffer for it.
-     * Buffer type (size, hints) must be the same. libavcodec won't check it.
-     * libavcodec will pass previous buffer in pic, function should return
-     * same buffer or new buffer with old frame "painted" into it.
-     * If pic.data[0] == NULL must behave like get_buffer().
-     * if CODEC_CAP_DR1 is not set then reget_buffer() must call
-     * avcodec_default_reget_buffer() instead of providing buffers allocated by
-     * some other means.
-     * - encoding: unused
-     * - decoding: Set by libavcodec., user can override
-     */
-    int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
-
-    /**
-     * Number of bits which should be loaded into the rc buffer before decoding starts.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int rc_initial_buffer_occupancy;
-
-    /**
-     *
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int inter_threshold;
-
-    /**
-     * CODEC_FLAG2_*
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     */
-    int flags2;
-
-    /**
-     * Simulates errors in the bitstream to test error concealment.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int error_rate;
-
-    /**
-     * MP3 antialias algorithm, see FF_AA_* below.
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    int antialias_algo;
-#define FF_AA_AUTO    0
-#define FF_AA_FASTINT 1 //not implemented yet
-#define FF_AA_INT     2
-#define FF_AA_FLOAT   3
-    /**
-     * quantizer noise shaping
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int quantizer_noise_shaping;
-
-    /**
-     * thread count
-     * is used to decide how many independent tasks should be passed to execute()
-     * - encoding: Set by user.
-     * - decoding: Set by user.
-     */
-    int thread_count;
-
-    /**
-     * The codec may call this to execute several independent things.
-     * It will return only after finishing all tasks.
-     * The user may replace this with some multithreaded implementation,
-     * the default implementation will execute the parts serially.
-     * @param count the number of things to execute
-     * - encoding: Set by libavcodec, user can override.
-     * - decoding: Set by libavcodec, user can override.
-     */
-    int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size);
-
-    /**
-     * thread opaque
-     * Can be used by execute() to store some per AVCodecContext stuff.
-     * - encoding: set by execute()
-     * - decoding: set by execute()
-     */
-    void *thread_opaque;
-
-    /**
-     * Motion estimation threshold below which no motion estimation is
-     * performed, but instead the user specified motion vectors are used.
-     *
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-     int me_threshold;
-
-    /**
-     * Macroblock threshold below which the user specified macroblock types will be used.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-     int mb_threshold;
-
-    /**
-     * precision of the intra DC coefficient - 8
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-     int intra_dc_precision;
-
-    /**
-     * noise vs. sse weight for the nsse comparsion function
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-     int nsse_weight;
-
-    /**
-     * Number of macroblock rows at the top which are skipped.
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-     int skip_top;
-
-    /**
-     * Number of macroblock rows at the bottom which are skipped.
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-     int skip_bottom;
-
-    /**
-     * profile
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-     int profile;
-#define FF_PROFILE_UNKNOWN -99
-
-#define FF_PROFILE_AAC_MAIN 0
-#define FF_PROFILE_AAC_LOW  1
-#define FF_PROFILE_AAC_SSR  2
-#define FF_PROFILE_AAC_LTP  3
-
-#define FF_PROFILE_H264_BASELINE    66
-#define FF_PROFILE_H264_MAIN        77
-#define FF_PROFILE_H264_EXTENDED    88
-#define FF_PROFILE_H264_HIGH        100
-#define FF_PROFILE_H264_HIGH_10     110
-#define FF_PROFILE_H264_HIGH_422    122
-#define FF_PROFILE_H264_HIGH_444    244
-#define FF_PROFILE_H264_CAVLC_444   44
-
-    /**
-     * level
-     * - encoding: Set by user.
-     * - decoding: Set by libavcodec.
-     */
-     int level;
-#define FF_LEVEL_UNKNOWN -99
-
-    /**
-     * low resolution decoding, 1-> 1/2 size, 2->1/4 size
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-     int lowres;
-
-    /**
-     * Bitstream width / height, may be different from width/height if lowres
-     * or other things are used.
-     * - encoding: unused
-     * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
-     */
-    int coded_width, coded_height;
-
-    /**
-     * frame skip threshold
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int frame_skip_threshold;
-
-    /**
-     * frame skip factor
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int frame_skip_factor;
-
-    /**
-     * frame skip exponent
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int frame_skip_exp;
-
-    /**
-     * frame skip comparison function
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int frame_skip_cmp;
-
-    /**
-     * Border processing masking, raises the quantizer for mbs on the borders
-     * of the picture.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float border_masking;
-
-    /**
-     * minimum MB lagrange multipler
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int mb_lmin;
-
-    /**
-     * maximum MB lagrange multipler
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int mb_lmax;
-
-    /**
-     *
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int me_penalty_compensation;
-
-    /**
-     *
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    enum AVDiscard skip_loop_filter;
-
-    /**
-     *
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    enum AVDiscard skip_idct;
-
-    /**
-     *
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    enum AVDiscard skip_frame;
-
-    /**
-     *
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int bidir_refine;
-
-    /**
-     *
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int brd_scale;
-
-    /**
-     * constant rate factor - quality-based VBR - values ~correspond to qps
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float crf;
-
-    /**
-     * constant quantization parameter rate control method
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int cqp;
-
-    /**
-     * minimum GOP size
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int keyint_min;
-
-    /**
-     * number of reference frames
-     * - encoding: Set by user.
-     * - decoding: Set by lavc.
-     */
-    int refs;
-
-    /**
-     * chroma qp offset from luma
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int chromaoffset;
-
-    /**
-     * Influences how often B-frames are used.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int bframebias;
-
-    /**
-     * trellis RD quantization
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int trellis;
-
-    /**
-     * Reduce fluctuations in qp (before curve compression).
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    float complexityblur;
-
-    /**
-     * in-loop deblocking filter alphac0 parameter
-     * alpha is in the range -6...6
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int deblockalpha;
-
-    /**
-     * in-loop deblocking filter beta parameter
-     * beta is in the range -6...6
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int deblockbeta;
-
-    /**
-     * macroblock subpartition sizes to consider - p8x8, p4x4, b8x8, i8x8, i4x4
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int partitions;
-#define X264_PART_I4X4 0x001  /* Analyze i4x4 */
-#define X264_PART_I8X8 0x002  /* Analyze i8x8 (requires 8x8 transform) */
-#define X264_PART_P8X8 0x010  /* Analyze p16x8, p8x16 and p8x8 */
-#define X264_PART_P4X4 0x020  /* Analyze p8x4, p4x8, p4x4 */
-#define X264_PART_B8X8 0x100  /* Analyze b16x8, b8x16 and b8x8 */
-
-    /**
-     * direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int directpred;
-
-    /**
-     * Audio cutoff bandwidth (0 means "automatic")
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int cutoff;
-
-    /**
-     * Multiplied by qscale for each frame and added to scene_change_score.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int scenechange_factor;
-
-    /**
-     *
-     * Note: Value depends upon the compare function used for fullpel ME.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int mv0_threshold;
-
-    /**
-     * Adjusts sensitivity of b_frame_strategy 1.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int b_sensitivity;
-
-    /**
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int compression_level;
-#define FF_COMPRESSION_DEFAULT -1
-
-    /**
-     * Sets whether to use LPC mode - used by FLAC encoder.
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int use_lpc;
-
-    /**
-     * LPC coefficient precision - used by FLAC encoder
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int lpc_coeff_precision;
-
-    /**
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int min_prediction_order;
-
-    /**
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int max_prediction_order;
-
-    /**
-     * search method for selecting prediction order
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int prediction_order_method;
-
-    /**
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int min_partition_order;
-
-    /**
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int max_partition_order;
-
-    /**
-     * GOP timecode frame start number, in non drop frame format
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int64_t timecode_frame_start;
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-    /**
-     * Decoder should decode to this many channels if it can (0 for default)
-     * - encoding: unused
-     * - decoding: Set by user.
-     * @deprecated Deprecated in favor of request_channel_layout.
-     */
-    int request_channels;
-#endif
-
-    /**
-     * Percentage of dynamic range compression to be applied by the decoder.
-     * The default value is 1.0, corresponding to full compression.
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    float drc_scale;
-
-    /**
-     * opaque 64bit number (generally a PTS) that will be reordered and
-     * output in AVFrame.reordered_opaque
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    int64_t reordered_opaque;
-
-    /**
-     * Bits per sample/pixel of internal libavcodec pixel/sample format.
-     * This field is applicable only when sample_fmt is SAMPLE_FMT_S32.
-     * - encoding: set by user.
-     * - decoding: set by libavcodec.
-     */
-    int bits_per_raw_sample;
-
-    /**
-     * Audio channel layout.
-     * - encoding: set by user.
-     * - decoding: set by libavcodec.
-     */
-    int64_t channel_layout;
-
-    /**
-     * Request decoder to use this channel layout if it can (0 for default)
-     * - encoding: unused
-     * - decoding: Set by user.
-     */
-    int64_t request_channel_layout;
-
-    /**
-     * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow.
-     * - encoding: Set by user.
-     * - decoding: unused.
-     */
-    float rc_max_available_vbv_use;
-
-    /**
-     * Ratecontrol attempt to use, at least, <value> times the amount needed to prevent a vbv overflow.
-     * - encoding: Set by user.
-     * - decoding: unused.
-     */
-    float rc_min_vbv_overflow_use;
-
-    /**
-     * Hardware accelerator in use
-     * - encoding: unused.
-     * - decoding: Set by libavcodec
-     */
-    struct AVHWAccel *hwaccel;
-
-    /**
-     * For some codecs, the time base is closer to the field rate than the frame rate.
-     * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
-     * if no telecine is used ...
-     *
-     * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
-     */
-    int ticks_per_frame;
-
-    /**
-     * Hardware accelerator context.
-     * For some hardware accelerators, a global context needs to be
-     * provided by the user. In that case, this holds display-dependent
-     * data FFmpeg cannot instantiate itself. Please refer to the
-     * FFmpeg HW accelerator documentation to know how to fill this
-     * is. e.g. for VA API, this is a struct vaapi_context.
-     * - encoding: unused
-     * - decoding: Set by user
-     */
-    void *hwaccel_context;
-
-    /**
-     * Chromaticity coordinates of the source primaries.
-     * - encoding: Set by user
-     * - decoding: Set by libavcodec
-     */
-    enum AVColorPrimaries color_primaries;
-
-    /**
-     * Color Transfer Characteristic.
-     * - encoding: Set by user
-     * - decoding: Set by libavcodec
-     */
-    enum AVColorTransferCharacteristic color_trc;
-
-    /**
-     * YUV colorspace type.
-     * - encoding: Set by user
-     * - decoding: Set by libavcodec
-     */
-    enum AVColorSpace colorspace;
-
-    /**
-     * MPEG vs JPEG YUV range.
-     * - encoding: Set by user
-     * - decoding: Set by libavcodec
-     */
-    enum AVColorRange color_range;
-
-    /**
-     * This defines the location of chroma samples.
-     * - encoding: Set by user
-     * - decoding: Set by libavcodec
-     */
-    enum AVChromaLocation chroma_sample_location;
-
-    /**
-     * The codec may call this to execute several independent things.
-     * It will return only after finishing all tasks.
-     * The user may replace this with some multithreaded implementation,
-     * the default implementation will execute the parts serially.
-     * Also see avcodec_thread_init and e.g. the --enable-pthread configure option.
-     * @param c context passed also to func
-     * @param count the number of things to execute
-     * @param arg2 argument passed unchanged to func
-     * @param ret return values of executed functions, must have space for "count" values. May be NULL.
-     * @param func function that will be called count times, with jobnr from 0 to count-1.
-     *             threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no
-     *             two instances of func executing at the same time will have the same threadnr.
-     * @return always 0 currently, but code should handle a future improvement where when any call to func
-     *         returns < 0 no further calls to func may be done and < 0 is returned.
-     * - encoding: Set by libavcodec, user can override.
-     * - decoding: Set by libavcodec, user can override.
-     */
-    int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
-
-    /**
-     * explicit P-frame weighted prediction analysis method
-     * 0: off
-     * 1: fast blind weighting (one reference duplicate with -1 offset)
-     * 2: smart weighting (full fade detection analysis)
-     * - encoding: Set by user.
-     * - decoding: unused
-     */
-    int weighted_p_pred;
-
-    /**
-     * AQ mode
-     * 0: Disabled
-     * 1: Variance AQ (complexity mask)
-     * 2: Auto-variance AQ (experimental)
-     * - encoding: Set by user
-     * - decoding: unused
-     */
-    int aq_mode;
-
-    /**
-     * AQ strength
-     * Reduces blocking and blurring in flat and textured areas.
-     * - encoding: Set by user
-     * - decoding: unused
-     */
-    float aq_strength;
-
-    /**
-     * PSY RD
-     * Strength of psychovisual optimization
-     * - encoding: Set by user
-     * - decoding: unused
-     */
-    float psy_rd;
-
-    /**
-     * PSY trellis
-     * Strength of psychovisual optimization
-     * - encoding: Set by user
-     * - decoding: unused
-     */
-    float psy_trellis;
-
-    /**
-     * RC lookahead
-     * Number of frames for frametype and ratecontrol lookahead
-     * - encoding: Set by user
-     * - decoding: unused
-     */
-    int rc_lookahead;
-} AVCodecContext;
-
-/**
- * AVCodec.
- */
-typedef struct AVCodec {
-    /**
-     * Name of the codec implementation.
-     * The name is globally unique among encoders and among decoders (but an
-     * encoder and a decoder can share the same name).
-     * This is the primary way to find a codec from the user perspective.
-     */
-    const char *name;
-    enum AVMediaType type;
-    enum CodecID id;
-    int priv_data_size;
-    int (*init)(AVCodecContext *);
-    int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
-    int (*close)(AVCodecContext *);
-    int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
-    /**
-     * Codec capabilities.
-     * see CODEC_CAP_*
-     */
-    int capabilities;
-    struct AVCodec *next;
-    /**
-     * Flush buffers.
-     * Will be called when seeking
-     */
-    void (*flush)(AVCodecContext *);
-    const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
-    const enum PixelFormat *pix_fmts;       ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
-    /**
-     * Descriptive name for the codec, meant to be more human readable than name.
-     * You should use the NULL_IF_CONFIG_SMALL() macro to define it.
-     */
-    const char *long_name;
-    const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
-    const enum SampleFormat *sample_fmts;   ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
-    const int64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
-} AVCodec;
-
-/**
- * AVHWAccel.
- */
-typedef struct AVHWAccel {
-    /**
-     * Name of the hardware accelerated codec.
-     * The name is globally unique among encoders and among decoders (but an
-     * encoder and a decoder can share the same name).
-     */
-    const char *name;
-
-    /**
-     * Type of codec implemented by the hardware accelerator.
-     *
-     * See AVMEDIA_TYPE_xxx
-     */
-    enum AVMediaType type;
-
-    /**
-     * Codec implemented by the hardware accelerator.
-     *
-     * See CODEC_ID_xxx
-     */
-    enum CodecID id;
-
-    /**
-     * Supported pixel format.
-     *
-     * Only hardware accelerated formats are supported here.
-     */
-    enum PixelFormat pix_fmt;
-
-    /**
-     * Hardware accelerated codec capabilities.
-     * see FF_HWACCEL_CODEC_CAP_*
-     */
-    int capabilities;
-
-    struct AVHWAccel *next;
-
-    /**
-     * Called at the beginning of each frame or field picture.
-     *
-     * Meaningful frame information (codec specific) is guaranteed to
-     * be parsed at this point. This function is mandatory.
-     *
-     * Note that buf can be NULL along with buf_size set to 0.
-     * Otherwise, this means the whole frame is available at this point.
-     *
-     * @param avctx the codec context
-     * @param buf the frame data buffer base
-     * @param buf_size the size of the frame in bytes
-     * @return zero if successful, a negative value otherwise
-     */
-    int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
-
-    /**
-     * Callback for each slice.
-     *
-     * Meaningful slice information (codec specific) is guaranteed to
-     * be parsed at this point. This function is mandatory.
-     *
-     * @param avctx the codec context
-     * @param buf the slice data buffer base
-     * @param buf_size the size of the slice in bytes
-     * @return zero if successful, a negative value otherwise
-     */
-    int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size);
-
-    /**
-     * Called at the end of each frame or field picture.
-     *
-     * The whole picture is parsed at this point and can now be sent
-     * to the hardware accelerator. This function is mandatory.
-     *
-     * @param avctx the codec context
-     * @return zero if successful, a negative value otherwise
-     */
-    int (*end_frame)(AVCodecContext *avctx);
-
-    /**
-     * Size of HW accelerator private data.
-     *
-     * Private data is allocated with av_mallocz() before
-     * AVCodecContext.get_buffer() and deallocated after
-     * AVCodecContext.release_buffer().
-     */
-    int priv_data_size;
-} AVHWAccel;
-
-/**
- * four components are given, that's all.
- * the last component is alpha
- */
-typedef struct AVPicture {
-    uint8_t *data[4];
-    int linesize[4];       ///< number of bytes per line
-} AVPicture;
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/**
- * AVPaletteControl
- * This structure defines a method for communicating palette changes
- * between and demuxer and a decoder.
- *
- * @deprecated Use AVPacket to send palette changes instead.
- * This is totally broken.
- */
-#define AVPALETTE_SIZE 1024
-#define AVPALETTE_COUNT 256
-typedef struct AVPaletteControl {
-
-    /* Demuxer sets this to 1 to indicate the palette has changed;
-     * decoder resets to 0. */
-    int palette_changed;
-
-    /* 4-byte ARGB palette entries, stored in native byte order; note that
-     * the individual palette components should be on a 8-bit scale; if
-     * the palette data comes from an IBM VGA native format, the component
-     * data is probably 6 bits in size and needs to be scaled. */
-    unsigned int palette[AVPALETTE_COUNT];
-
-} AVPaletteControl attribute_deprecated;
-#endif
-
-enum AVSubtitleType {
-    SUBTITLE_NONE,
-
-    SUBTITLE_BITMAP,                ///< A bitmap, pict will be set
-
-    /**
-     * Plain text, the text field must be set by the decoder and is
-     * authoritative. ass and pict fields may contain approximations.
-     */
-    SUBTITLE_TEXT,
-
-    /**
-     * Formatted text, the ass field must be set by the decoder and is
-     * authoritative. pict and text fields may contain approximations.
-     */
-    SUBTITLE_ASS,
-};
-
-typedef struct AVSubtitleRect {
-    int x;         ///< top left corner  of pict, undefined when pict is not set
-    int y;         ///< top left corner  of pict, undefined when pict is not set
-    int w;         ///< width            of pict, undefined when pict is not set
-    int h;         ///< height           of pict, undefined when pict is not set
-    int nb_colors; ///< number of colors in pict, undefined when pict is not set
-
-    /**
-     * data+linesize for the bitmap of this subtitle.
-     * can be set for text/ass as well once they where rendered
-     */
-    AVPicture pict;
-    enum AVSubtitleType type;
-
-    char *text;                     ///< 0 terminated plain UTF-8 text
-
-    /**
-     * 0 terminated ASS/SSA compatible event line.
-     * The pressentation of this is unaffected by the other values in this
-     * struct.
-     */
-    char *ass;
-} AVSubtitleRect;
-
-typedef struct AVSubtitle {
-    uint16_t format; /* 0 = graphics */
-    uint32_t start_display_time; /* relative to packet pts, in ms */
-    uint32_t end_display_time; /* relative to packet pts, in ms */
-    unsigned num_rects;
-    AVSubtitleRect **rects;
-    int64_t pts;    ///< Same as packet pts, in AV_TIME_BASE
-} AVSubtitle;
-
-/* packet functions */
-
-/**
- * @deprecated use NULL instead
- */
-attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
-
-/**
- * Default packet destructor.
- */
-void av_destruct_packet(AVPacket *pkt);
-
-/**
- * Initialize optional fields of a packet with default values.
- *
- * @param pkt packet
- */
-void av_init_packet(AVPacket *pkt);
-
-/**
- * Allocate the payload of a packet and initialize its fields with
- * default values.
- *
- * @param pkt packet
- * @param size wanted payload size
- * @return 0 if OK, AVERROR_xxx otherwise
- */
-int av_new_packet(AVPacket *pkt, int size);
-
-/**
- * Reduce packet size, correctly zeroing padding
- *
- * @param pkt packet
- * @param size new size
- */
-void av_shrink_packet(AVPacket *pkt, int size);
-
-/**
- * @warning This is a hack - the packet memory allocation stuff is broken. The
- * packet is allocated if it was not really allocated.
- */
-int av_dup_packet(AVPacket *pkt);
-
-/**
- * Free a packet.
- *
- * @param pkt packet to free
- */
-void av_free_packet(AVPacket *pkt);
-
-/* resample.c */
-
-struct ReSampleContext;
-struct AVResampleContext;
-
-typedef struct ReSampleContext ReSampleContext;
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/**
- * @deprecated Use av_audio_resample_init() instead.
- */
-attribute_deprecated ReSampleContext *audio_resample_init(int output_channels, int input_channels,
-                                                          int output_rate, int input_rate);
-#endif
-/**
- *  Initializes audio resampling context
- *
- * @param output_channels  number of output channels
- * @param input_channels   number of input channels
- * @param output_rate      output sample rate
- * @param input_rate       input sample rate
- * @param sample_fmt_out   requested output sample format
- * @param sample_fmt_in    input sample format
- * @param filter_length    length of each FIR filter in the filterbank relative to the cutoff freq
- * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
- * @param linear           If 1 then the used FIR filter will be linearly interpolated
-                           between the 2 closest, if 0 the closest will be used
- * @param cutoff           cutoff frequency, 1.0 corresponds to half the output sampling rate
- * @return allocated ReSampleContext, NULL if error occured
- */
-ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
-                                        int output_rate, int input_rate,
-                                        enum SampleFormat sample_fmt_out,
-                                        enum SampleFormat sample_fmt_in,
-                                        int filter_length, int log2_phase_count,
-                                        int linear, double cutoff);
-
-int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
-void audio_resample_close(ReSampleContext *s);
-
-
-/**
- * Initializes an audio resampler.
- * Note, if either rate is not an integer then simply scale both rates up so they are.
- * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
- * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
- * @param linear If 1 then the used FIR filter will be linearly interpolated
-                 between the 2 closest, if 0 the closest will be used
- * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
- */
-struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
-
-/**
- * resamples.
- * @param src an array of unconsumed samples
- * @param consumed the number of samples of src which have been consumed are returned here
- * @param src_size the number of unconsumed samples available
- * @param dst_size the amount of space in samples available in dst
- * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
- * @return the number of samples written in dst or -1 if an error occurred
- */
-int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
-
-
-/**
- * Compensates samplerate/timestamp drift. The compensation is done by changing
- * the resampler parameters, so no audible clicks or similar distortions occur
- * @param compensation_distance distance in output samples over which the compensation should be performed
- * @param sample_delta number of output samples which should be output less
- *
- * example: av_resample_compensate(c, 10, 500)
- * here instead of 510 samples only 500 samples would be output
- *
- * note, due to rounding the actual compensation might be slightly different,
- * especially if the compensation_distance is large and the in_rate used during init is small
- */
-void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
-void av_resample_close(struct AVResampleContext *c);
-
-/**
- * Allocate memory for a picture.  Call avpicture_free to free it.
- *
- * @param picture the picture to be filled in
- * @param pix_fmt the format of the picture
- * @param width the width of the picture
- * @param height the height of the picture
- * @return zero if successful, a negative value if not
- */
-int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
-
-/**
- * Free a picture previously allocated by avpicture_alloc().
- *
- * @param picture the AVPicture to be freed
- */
-void avpicture_free(AVPicture *picture);
-
-/**
- * Fill in the AVPicture fields.
- * The fields of the given AVPicture are filled in by using the 'ptr' address
- * which points to the image data buffer. Depending on the specified picture
- * format, one or multiple image data pointers and line sizes will be set.
- * If a planar format is specified, several pointers will be set pointing to
- * the different picture planes and the line sizes of the different planes
- * will be stored in the lines_sizes array.
- * Call with ptr == NULL to get the required size for the ptr buffer.
- *
- * @param picture AVPicture whose fields are to be filled in
- * @param ptr Buffer which will contain or contains the actual image data
- * @param pix_fmt The format in which the picture data is stored.
- * @param width the width of the image in pixels
- * @param height the height of the image in pixels
- * @return size of the image data in bytes
- */
-int avpicture_fill(AVPicture *picture, uint8_t *ptr,
-                   enum PixelFormat pix_fmt, int width, int height);
-int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
-                     unsigned char *dest, int dest_size);
-
-/**
- * Calculate the size in bytes that a picture of the given width and height
- * would occupy if stored in the given picture format.
- * Note that this returns the size of a compact representation as generated
- * by avpicture_layout, which can be smaller than the size required for e.g.
- * avpicture_fill.
- *
- * @param pix_fmt the given picture format
- * @param width the width of the image
- * @param height the height of the image
- * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
- */
-int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
-void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
-const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
-void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/**
- * Returns the pixel format corresponding to the name name.
- *
- * If there is no pixel format with name name, then looks for a
- * pixel format with the name corresponding to the native endian
- * format of name.
- * For example in a little-endian system, first looks for "gray16",
- * then for "gray16le".
- *
- * Finally if no pixel format has been found, returns PIX_FMT_NONE.
- *
- * @deprecated Deprecated in favor of av_get_pix_fmt().
- */
-attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name);
-#endif
-
-/**
- * Returns a value representing the fourCC code associated to the
- * pixel format pix_fmt, or 0 if no associated fourCC code can be
- * found.
- */
-unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat pix_fmt);
-
-#define FF_LOSS_RESOLUTION  0x0001 /**< loss due to resolution change */
-#define FF_LOSS_DEPTH       0x0002 /**< loss due to color depth change */
-#define FF_LOSS_COLORSPACE  0x0004 /**< loss due to color space conversion */
-#define FF_LOSS_ALPHA       0x0008 /**< loss of alpha bits */
-#define FF_LOSS_COLORQUANT  0x0010 /**< loss due to color quantization */
-#define FF_LOSS_CHROMA      0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */
-
-/**
- * Computes what kind of losses will occur when converting from one specific
- * pixel format to another.
- * When converting from one pixel format to another, information loss may occur.
- * For example, when converting from RGB24 to GRAY, the color information will
- * be lost. Similarly, other losses occur when converting from some formats to
- * other formats. These losses can involve loss of chroma, but also loss of
- * resolution, loss of color depth, loss due to the color space conversion, loss
- * of the alpha bits or loss due to color quantization.
- * avcodec_get_fix_fmt_loss() informs you about the various types of losses
- * which will occur when converting from one pixel format to another.
- *
- * @param[in] dst_pix_fmt destination pixel format
- * @param[in] src_pix_fmt source pixel format
- * @param[in] has_alpha Whether the source pixel format alpha channel is used.
- * @return Combination of flags informing you what kind of losses will occur.
- */
-int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
-                             int has_alpha);
-
-/**
- * Finds the best pixel format to convert to given a certain source pixel
- * format.  When converting from one pixel format to another, information loss
- * may occur.  For example, when converting from RGB24 to GRAY, the color
- * information will be lost. Similarly, other losses occur when converting from
- * some formats to other formats. avcodec_find_best_pix_fmt() searches which of
- * the given pixel formats should be used to suffer the least amount of loss.
- * The pixel formats from which it chooses one, are determined by the
- * pix_fmt_mask parameter.
- *
- * @code
- * src_pix_fmt = PIX_FMT_YUV420P;
- * pix_fmt_mask = (1 << PIX_FMT_YUV422P) || (1 << PIX_FMT_RGB24);
- * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
- * @endcode
- *
- * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from
- * @param[in] src_pix_fmt source pixel format
- * @param[in] has_alpha Whether the source pixel format alpha channel is used.
- * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
- * @return The best pixel format to convert to or -1 if none was found.
- */
-enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
-                              int has_alpha, int *loss_ptr);
-
-
-/**
- * Print in buf the string corresponding to the pixel format with
- * number pix_fmt, or an header if pix_fmt is negative.
- *
- * @param[in] buf the buffer where to write the string
- * @param[in] buf_size the size of buf
- * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or
- * a negative value to print the corresponding header.
- * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1.
- */
-void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
-
-#define FF_ALPHA_TRANSP       0x0001 /* image has some totally transparent pixels */
-#define FF_ALPHA_SEMI_TRANSP  0x0002 /* image has some transparent pixels */
-
-/**
- * Tell if an image really has transparent alpha values.
- * @return ored mask of FF_ALPHA_xxx constants
- */
-int img_get_alpha_info(const AVPicture *src,
-                       enum PixelFormat pix_fmt, int width, int height);
-
-/* deinterlace a picture */
-/* deinterlace - if not supported return -1 */
-int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
-                          enum PixelFormat pix_fmt, int width, int height);
-
-/* external high level API */
-
-/**
- * If c is NULL, returns the first registered codec,
- * if c is non-NULL, returns the next registered codec after c,
- * or NULL if c is the last one.
- */
-AVCodec *av_codec_next(AVCodec *c);
-
-/**
- * Returns the LIBAVCODEC_VERSION_INT constant.
- */
-unsigned avcodec_version(void);
-
-/**
- * Returns the libavcodec build-time configuration.
- */
-const char *avcodec_configuration(void);
-
-/**
- * Returns the libavcodec license.
- */
-const char *avcodec_license(void);
-
-/**
- * Initializes libavcodec.
- *
- * @warning This function must be called before any other libavcodec
- * function.
- */
-void avcodec_init(void);
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/**
- * @deprecated Deprecated in favor of avcodec_register().
- */
-attribute_deprecated void register_avcodec(AVCodec *codec);
-#endif
-
-/**
- * Register the codec codec and initialize libavcodec.
- *
- * @see avcodec_init()
- */
-void avcodec_register(AVCodec *codec);
-
-/**
- * Finds a registered encoder with a matching codec ID.
- *
- * @param id CodecID of the requested encoder
- * @return An encoder if one was found, NULL otherwise.
- */
-AVCodec *avcodec_find_encoder(enum CodecID id);
-
-/**
- * Finds a registered encoder with the specified name.
- *
- * @param name name of the requested encoder
- * @return An encoder if one was found, NULL otherwise.
- */
-AVCodec *avcodec_find_encoder_by_name(const char *name);
-
-/**
- * Finds a registered decoder with a matching codec ID.
- *
- * @param id CodecID of the requested decoder
- * @return A decoder if one was found, NULL otherwise.
- */
-AVCodec *avcodec_find_decoder(enum CodecID id);
-
-/**
- * Finds a registered decoder with the specified name.
- *
- * @param name name of the requested decoder
- * @return A decoder if one was found, NULL otherwise.
- */
-AVCodec *avcodec_find_decoder_by_name(const char *name);
-void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
-
-/**
- * Sets the fields of the given AVCodecContext to default values.
- *
- * @param s The AVCodecContext of which the fields should be set to default values.
- */
-void avcodec_get_context_defaults(AVCodecContext *s);
-
-/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
- *  we WILL change its arguments and name a few times! */
-void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
-
-/**
- * Allocates an AVCodecContext and sets its fields to default values.  The
- * resulting struct can be deallocated by simply calling av_free().
- *
- * @return An AVCodecContext filled with default values or NULL on failure.
- * @see avcodec_get_context_defaults
- */
-AVCodecContext *avcodec_alloc_context(void);
-
-/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
- *  we WILL change its arguments and name a few times! */
-AVCodecContext *avcodec_alloc_context2(enum AVMediaType);
-
-/**
- * Copy the settings of the source AVCodecContext into the destination
- * AVCodecContext. The resulting destination codec context will be
- * unopened, i.e. you are required to call avcodec_open() before you
- * can use this AVCodecContext to decode/encode video/audio data.
- *
- * @param dest target codec context, should be initialized with
- *             avcodec_alloc_context(), but otherwise uninitialized
- * @param src source codec context
- * @return AVERROR() on error (e.g. memory allocation error), 0 on success
- */
-int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
-
-/**
- * Sets the fields of the given AVFrame to default values.
- *
- * @param pic The AVFrame of which the fields should be set to default values.
- */
-void avcodec_get_frame_defaults(AVFrame *pic);
-
-/**
- * Allocates an AVFrame and sets its fields to default values.  The resulting
- * struct can be deallocated by simply calling av_free().
- *
- * @return An AVFrame filled with default values or NULL on failure.
- * @see avcodec_get_frame_defaults
- */
-AVFrame *avcodec_alloc_frame(void);
-
-int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
-void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
-int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
-
-/**
- * Returns the amount of padding in pixels which the get_buffer callback must
- * provide around the edge of the image for codecs which do not have the
- * CODEC_FLAG_EMU_EDGE flag.
- *
- * @return Required padding in pixels.
- */
-unsigned avcodec_get_edge_width(void);
-/**
- * Modifies width and height values so that they will result in a memory
- * buffer that is acceptable for the codec if you do not use any horizontal
- * padding.
- *
- * May only be used if a codec with CODEC_CAP_DR1 has been opened.
- * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
- * according to avcodec_get_edge_width() before.
- */
-void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
-/**
- * Modifies width and height values so that they will result in a memory
- * buffer that is acceptable for the codec if you also ensure that all
- * line sizes are a multiple of the respective linesize_align[i].
- *
- * May only be used if a codec with CODEC_CAP_DR1 has been opened.
- * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
- * according to avcodec_get_edge_width() before.
- */
-void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
-                               int linesize_align[4]);
-
-/**
- * Checks if the given dimension of a picture is valid, meaning that all
- * bytes of the picture can be addressed with a signed int.
- *
- * @param[in] w Width of the picture.
- * @param[in] h Height of the picture.
- * @return Zero if valid, a negative value if invalid.
- */
-int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h);
-enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt);
-
-int avcodec_thread_init(AVCodecContext *s, int thread_count);
-void avcodec_thread_free(AVCodecContext *s);
-int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
-int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
-//FIXME func typedef
-
-/**
- * Initializes the AVCodecContext to use the given AVCodec. Prior to using this
- * function the context has to be allocated.
- *
- * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(),
- * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
- * retrieving a codec.
- *
- * @warning This function is not thread safe!
- *
- * @code
- * avcodec_register_all();
- * codec = avcodec_find_decoder(CODEC_ID_H264);
- * if (!codec)
- *     exit(1);
- *
- * context = avcodec_alloc_context();
- *
- * if (avcodec_open(context, codec) < 0)
- *     exit(1);
- * @endcode
- *
- * @param avctx The context which will be set up to use the given codec.
- * @param codec The codec to use within the context.
- * @return zero on success, a negative value on error
- * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder
- */
-int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/**
- * Decodes an audio frame from buf into samples.
- * Wrapper function which calls avcodec_decode_audio3.
- *
- * @deprecated Use avcodec_decode_audio3 instead.
- * @param avctx the codec context
- * @param[out] samples the output buffer
- * @param[in,out] frame_size_ptr the output buffer size in bytes
- * @param[in] buf the input buffer
- * @param[in] buf_size the input buffer size in bytes
- * @return On error a negative value is returned, otherwise the number of bytes
- * used or zero if no frame could be decompressed.
- */
-attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
-                         int *frame_size_ptr,
-                         const uint8_t *buf, int buf_size);
-#endif
-
-/**
- * Decodes the audio frame of size avpkt->size from avpkt->data into samples.
- * Some decoders may support multiple frames in a single AVPacket, such
- * decoders would then just decode the first frame. In this case,
- * avcodec_decode_audio3 has to be called again with an AVPacket that contains
- * the remaining data in order to decode the second frame etc.
- * If no frame
- * could be outputted, frame_size_ptr is zero. Otherwise, it is the
- * decompressed frame size in bytes.
- *
- * @warning You must set frame_size_ptr to the allocated size of the
- * output buffer before calling avcodec_decode_audio3().
- *
- * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
- * the actual read bytes because some optimized bitstream readers read 32 or 64
- * bits at once and could read over the end.
- *
- * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that
- * no overreading happens for damaged MPEG streams.
- *
- * @note You might have to align the input buffer avpkt->data and output buffer
- * samples. The alignment requirements depend on the CPU: On some CPUs it isn't
- * necessary at all, on others it won't work at all if not aligned and on others
- * it will work but it will have an impact on performance.
- *
- * In practice, avpkt->data should have 4 byte alignment at minimum and
- * samples should be 16 byte aligned unless the CPU doesn't need it
- * (AltiVec and SSE do).
- *
- * @param avctx the codec context
- * @param[out] samples the output buffer, sample type in avctx->sample_fmt
- * @param[in,out] frame_size_ptr the output buffer size in bytes
- * @param[in] avpkt The input AVPacket containing the input buffer.
- *            You can create such packet with av_init_packet() and by then setting
- *            data and size, some decoders might in addition need other fields.
- *            All decoders are designed to use the least fields possible though.
- * @return On error a negative value is returned, otherwise the number of bytes
- * used or zero if no frame data was decompressed (used) from the input AVPacket.
- */
-int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
-                         int *frame_size_ptr,
-                         AVPacket *avpkt);
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/**
- * Decodes a video frame from buf into picture.
- * Wrapper function which calls avcodec_decode_video2.
- *
- * @deprecated Use avcodec_decode_video2 instead.
- * @param avctx the codec context
- * @param[out] picture The AVFrame in which the decoded video frame will be stored.
- * @param[in] buf the input buffer
- * @param[in] buf_size the size of the input buffer in bytes
- * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
- * @return On error a negative value is returned, otherwise the number of bytes
- * used or zero if no frame could be decompressed.
- */
-attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
-                         int *got_picture_ptr,
-                         const uint8_t *buf, int buf_size);
-#endif
-
-/**
- * Decodes the video frame of size avpkt->size from avpkt->data into picture.
- * Some decoders may support multiple frames in a single AVPacket, such
- * decoders would then just decode the first frame.
- *
- * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than
- * the actual read bytes because some optimized bitstream readers read 32 or 64
- * bits at once and could read over the end.
- *
- * @warning The end of the input buffer buf should be set to 0 to ensure that
- * no overreading happens for damaged MPEG streams.
- *
- * @note You might have to align the input buffer avpkt->data.
- * The alignment requirements depend on the CPU: on some CPUs it isn't
- * necessary at all, on others it won't work at all if not aligned and on others
- * it will work but it will have an impact on performance.
- *
- * In practice, avpkt->data should have 4 byte alignment at minimum.
- *
- * @note Some codecs have a delay between input and output, these need to be
- * fed with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames.
- *
- * @param avctx the codec context
- * @param[out] picture The AVFrame in which the decoded video frame will be stored.
- *             Use avcodec_alloc_frame to get an AVFrame, the codec will
- *             allocate memory for the actual bitmap.
- * @param[in] avpkt The input AVpacket containing the input buffer.
- *            You can create such packet with av_init_packet() and by then setting
- *            data and size, some decoders might in addition need other fields like
- *            flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least
- *            fields possible.
- * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero.
- * @return On error a negative value is returned, otherwise the number of bytes
- * used or zero if no frame could be decompressed.
- */
-int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
-                         int *got_picture_ptr,
-                         AVPacket *avpkt);
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/* Decode a subtitle message. Return -1 if error, otherwise return the
- * number of bytes used. If no subtitle could be decompressed,
- * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */
-attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
-                            int *got_sub_ptr,
-                            const uint8_t *buf, int buf_size);
-#endif
-
-/**
- * Decodes a subtitle message.
- * Returns a negative value on error, otherwise returns the number of bytes used.
- * If no subtitle could be decompressed, got_sub_ptr is zero.
- * Otherwise, the subtitle is stored in *sub.
- *
- * @param avctx the codec context
- * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored.
- * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero.
- * @param[in] avpkt The input AVPacket containing the input buffer.
- */
-int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
-                            int *got_sub_ptr,
-                            AVPacket *avpkt);
-int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
-                        int *data_size_ptr,
-                        uint8_t *buf, int buf_size);
-
-/**
- * Encodes an audio frame from samples into buf.
- *
- * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
- * However, for PCM audio the user will know how much space is needed
- * because it depends on the value passed in buf_size as described
- * below. In that case a lower value can be used.
- *
- * @param avctx the codec context
- * @param[out] buf the output buffer
- * @param[in] buf_size the output buffer size
- * @param[in] samples the input buffer containing the samples
- * The number of samples read from this buffer is frame_size*channels,
- * both of which are defined in avctx.
- * For PCM audio the number of samples read from samples is equal to
- * buf_size * input_sample_size / output_sample_size.
- * @return On error a negative value is returned, on success zero or the number
- * of bytes used to encode the data read from the input buffer.
- */
-int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                         const short *samples);
-
-/**
- * Encodes a video frame from pict into buf.
- * The input picture should be
- * stored using a specific format, namely avctx.pix_fmt.
- *
- * @param avctx the codec context
- * @param[out] buf the output buffer for the bitstream of encoded frame
- * @param[in] buf_size the size of the output buffer in bytes
- * @param[in] pict the input picture to encode
- * @return On error a negative value is returned, on success zero or the number
- * of bytes used from the output buffer.
- */
-int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                         const AVFrame *pict);
-int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                            const AVSubtitle *sub);
-
-int avcodec_close(AVCodecContext *avctx);
-
-/**
- * Register all the codecs, parsers and bitstream filters which were enabled at
- * configuration time. If you do not call this function you can select exactly
- * which formats you want to support, by using the individual registration
- * functions.
- *
- * @see avcodec_register
- * @see av_register_codec_parser
- * @see av_register_bitstream_filter
- */
-void avcodec_register_all(void);
-
-/**
- * Flush buffers, should be called when seeking or when switching to a different stream.
- */
-void avcodec_flush_buffers(AVCodecContext *avctx);
-
-void avcodec_default_free_buffers(AVCodecContext *s);
-
-/* misc useful functions */
-
-/**
- * Returns a single letter to describe the given picture type pict_type.
- *
- * @param[in] pict_type the picture type
- * @return A single character representing the picture type.
- */
-char av_get_pict_type_char(int pict_type);
-
-/**
- * Returns codec bits per sample.
- *
- * @param[in] codec_id the codec
- * @return Number of bits per sample or zero if unknown for the given codec.
- */
-int av_get_bits_per_sample(enum CodecID codec_id);
-
-/**
- * Returns sample format bits per sample.
- *
- * @param[in] sample_fmt the sample format
- * @return Number of bits per sample or zero if unknown for the given sample format.
- */
-int av_get_bits_per_sample_format(enum SampleFormat sample_fmt);
-
-/* frame parsing */
-typedef struct AVCodecParserContext {
-    void *priv_data;
-    struct AVCodecParser *parser;
-    int64_t frame_offset; /* offset of the current frame */
-    int64_t cur_offset; /* current offset
-                           (incremented by each av_parser_parse()) */
-    int64_t next_frame_offset; /* offset of the next frame */
-    /* video info */
-    int pict_type; /* XXX: Put it back in AVCodecContext. */
-    /**
-     * This field is used for proper frame duration computation in lavf.
-     * It signals, how much longer the frame duration of the current frame
-     * is compared to normal frame duration.
-     *
-     * frame_duration = (1 + repeat_pict) * time_base
-     *
-     * It is used by codecs like H.264 to display telecined material.
-     */
-    int repeat_pict; /* XXX: Put it back in AVCodecContext. */
-    int64_t pts;     /* pts of the current frame */
-    int64_t dts;     /* dts of the current frame */
-
-    /* private data */
-    int64_t last_pts;
-    int64_t last_dts;
-    int fetch_timestamp;
-
-#define AV_PARSER_PTS_NB 4
-    int cur_frame_start_index;
-    int64_t cur_frame_offset[AV_PARSER_PTS_NB];
-    int64_t cur_frame_pts[AV_PARSER_PTS_NB];
-    int64_t cur_frame_dts[AV_PARSER_PTS_NB];
-
-    int flags;
-#define PARSER_FLAG_COMPLETE_FRAMES           0x0001
-
-    int64_t offset;      ///< byte offset from starting packet start
-    int64_t cur_frame_end[AV_PARSER_PTS_NB];
-
-    /*!
-     * Set by parser to 1 for key frames and 0 for non-key frames.
-     * It is initialized to -1, so if the parser doesn't set this flag,
-     * old-style fallback using FF_I_TYPE picture type as key frames
-     * will be used.
-     */
-    int key_frame;
-
-    /**
-     * Time difference in stream time base units from the pts of this
-     * packet to the point at which the output from the decoder has converged
-     * independent from the availability of previous frames. That is, the
-     * frames are virtually identical no matter if decoding started from
-     * the very first frame or from this keyframe.
-     * Is AV_NOPTS_VALUE if unknown.
-     * This field is not the display duration of the current frame.
-     *
-     * The purpose of this field is to allow seeking in streams that have no
-     * keyframes in the conventional sense. It corresponds to the
-     * recovery point SEI in H.264 and match_time_delta in NUT. It is also
-     * essential for some types of subtitle streams to ensure that all
-     * subtitles are correctly displayed after seeking.
-     */
-    int64_t convergence_duration;
-
-    // Timestamp generation support:
-    /**
-     * Synchronization point for start of timestamp generation.
-     *
-     * Set to >0 for sync point, 0 for no sync point and <0 for undefined
-     * (default).
-     *
-     * For example, this corresponds to presence of H.264 buffering period
-     * SEI message.
-     */
-    int dts_sync_point;
-
-    /**
-     * Offset of the current timestamp against last timestamp sync point in
-     * units of AVCodecContext.time_base.
-     *
-     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
-     * contain a valid timestamp offset.
-     *
-     * Note that the timestamp of sync point has usually a nonzero
-     * dts_ref_dts_delta, which refers to the previous sync point. Offset of
-     * the next frame after timestamp sync point will be usually 1.
-     *
-     * For example, this corresponds to H.264 cpb_removal_delay.
-     */
-    int dts_ref_dts_delta;
-
-    /**
-     * Presentation delay of current frame in units of AVCodecContext.time_base.
-     *
-     * Set to INT_MIN when dts_sync_point unused. Otherwise, it must
-     * contain valid non-negative timestamp delta (presentation time of a frame
-     * must not lie in the past).
-     *
-     * This delay represents the difference between decoding and presentation
-     * time of the frame.
-     *
-     * For example, this corresponds to H.264 dpb_output_delay.
-     */
-    int pts_dts_delta;
-
-    /**
-     * Position of the packet in file.
-     *
-     * Analogous to cur_frame_pts/dts
-     */
-    int64_t cur_frame_pos[AV_PARSER_PTS_NB];
-
-    /**
-     * Byte position of currently parsed frame in stream.
-     */
-    int64_t pos;
-
-    /**
-     * Previous frame byte position.
-     */
-    int64_t last_pos;
-} AVCodecParserContext;
-
-typedef struct AVCodecParser {
-    int codec_ids[5]; /* several codec IDs are permitted */
-    int priv_data_size;
-    int (*parser_init)(AVCodecParserContext *s);
-    int (*parser_parse)(AVCodecParserContext *s,
-                        AVCodecContext *avctx,
-                        const uint8_t **poutbuf, int *poutbuf_size,
-                        const uint8_t *buf, int buf_size);
-    void (*parser_close)(AVCodecParserContext *s);
-    int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
-    struct AVCodecParser *next;
-} AVCodecParser;
-
-AVCodecParser *av_parser_next(AVCodecParser *c);
-
-void av_register_codec_parser(AVCodecParser *parser);
-AVCodecParserContext *av_parser_init(int codec_id);
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-attribute_deprecated
-int av_parser_parse(AVCodecParserContext *s,
-                    AVCodecContext *avctx,
-                    uint8_t **poutbuf, int *poutbuf_size,
-                    const uint8_t *buf, int buf_size,
-                    int64_t pts, int64_t dts);
-#endif
-
-/**
- * Parse a packet.
- *
- * @param s             parser context.
- * @param avctx         codec context.
- * @param poutbuf       set to pointer to parsed buffer or NULL if not yet finished.
- * @param poutbuf_size  set to size of parsed buffer or zero if not yet finished.
- * @param buf           input buffer.
- * @param buf_size      input length, to signal EOF, this should be 0 (so that the last frame can be output).
- * @param pts           input presentation timestamp.
- * @param dts           input decoding timestamp.
- * @param pos           input byte position in stream.
- * @return the number of bytes of the input bitstream used.
- *
- * Example:
- * @code
- *   while(in_len){
- *       len = av_parser_parse2(myparser, AVCodecContext, &data, &size,
- *                                        in_data, in_len,
- *                                        pts, dts, pos);
- *       in_data += len;
- *       in_len  -= len;
- *
- *       if(size)
- *          decode_frame(data, size);
- *   }
- * @endcode
- */
-int av_parser_parse2(AVCodecParserContext *s,
-                     AVCodecContext *avctx,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size,
-                     int64_t pts, int64_t dts,
-                     int64_t pos);
-
-int av_parser_change(AVCodecParserContext *s,
-                     AVCodecContext *avctx,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe);
-void av_parser_close(AVCodecParserContext *s);
-
-
-typedef struct AVBitStreamFilterContext {
-    void *priv_data;
-    struct AVBitStreamFilter *filter;
-    AVCodecParserContext *parser;
-    struct AVBitStreamFilterContext *next;
-} AVBitStreamFilterContext;
-
-
-typedef struct AVBitStreamFilter {
-    const char *name;
-    int priv_data_size;
-    int (*filter)(AVBitStreamFilterContext *bsfc,
-                  AVCodecContext *avctx, const char *args,
-                  uint8_t **poutbuf, int *poutbuf_size,
-                  const uint8_t *buf, int buf_size, int keyframe);
-    void (*close)(AVBitStreamFilterContext *bsfc);
-    struct AVBitStreamFilter *next;
-} AVBitStreamFilter;
-
-void av_register_bitstream_filter(AVBitStreamFilter *bsf);
-AVBitStreamFilterContext *av_bitstream_filter_init(const char *name);
-int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
-                               AVCodecContext *avctx, const char *args,
-                               uint8_t **poutbuf, int *poutbuf_size,
-                               const uint8_t *buf, int buf_size, int keyframe);
-void av_bitstream_filter_close(AVBitStreamFilterContext *bsf);
-
-AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
-
-/* memory */
-
-/**
- * Reallocates the given block if it is not large enough, otherwise it
- * does nothing.
- *
- * @see av_realloc
- */
-void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
-
-/**
- * Allocates a buffer, reusing the given one if large enough.
- *
- * Contrary to av_fast_realloc the current buffer contents might not be
- * preserved and on error the old buffer is freed, thus no special
- * handling to avoid memleaks is necessary.
- *
- * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
- * @param size size of the buffer *ptr points to
- * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
- *                 *size 0 if an error occurred.
- */
-void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size);
-
-/**
- * Copy image 'src' to 'dst'.
- */
-void av_picture_copy(AVPicture *dst, const AVPicture *src,
-                     enum PixelFormat pix_fmt, int width, int height);
-
-/**
- * Crop image top and left side.
- */
-int av_picture_crop(AVPicture *dst, const AVPicture *src,
-                    enum PixelFormat pix_fmt, int top_band, int left_band);
-
-/**
- * Pad image.
- */
-int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
-            int padtop, int padbottom, int padleft, int padright, int *color);
-
-/**
- * Encodes extradata length to a buffer. Used by xiph codecs.
- *
- * @param s buffer to write to; must be at least (v/255+1) bytes long
- * @param v size of extradata in bytes
- * @return number of bytes written to the buffer.
- */
-unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
-
-/**
- * Parses str and put in width_ptr and height_ptr the detected values.
- *
- * @return 0 in case of a successful parsing, a negative value otherwise
- * @param[in] str the string to parse: it has to be a string in the format
- * <width>x<height> or a valid video frame size abbreviation.
- * @param[in,out] width_ptr pointer to the variable which will contain the detected
- * frame width value
- * @param[in,out] height_ptr pointer to the variable which will contain the detected
- * frame height value
- */
-int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
-
-/**
- * Parses str and put in frame_rate the detected values.
- *
- * @return 0 in case of a successful parsing, a negative value otherwise
- * @param[in] str the string to parse: it has to be a string in the format
- * <frame_rate_num>/<frame_rate_den>, a float number or a valid video rate abbreviation
- * @param[in,out] frame_rate pointer to the AVRational which will contain the detected
- * frame rate
- */
-int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
-
-/**
- * Logs a generic warning message about a missing feature. This function is
- * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
- * only, and would normally not be used by applications.
- * @param[in] avc a pointer to an arbitrary struct of which the first field is
- * a pointer to an AVClass struct
- * @param[in] feature string containing the name of the missing feature
- * @param[in] want_sample indicates if samples are wanted which exhibit this feature.
- * If want_sample is non-zero, additional verbage will be added to the log
- * message which tells the user how to report samples to the development
- * mailing list.
- */
-void av_log_missing_feature(void *avc, const char *feature, int want_sample);
-
-/**
- * Logs a generic warning message asking for a sample. This function is
- * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.)
- * only, and would normally not be used by applications.
- * @param[in] avc a pointer to an arbitrary struct of which the first field is
- * a pointer to an AVClass struct
- * @param[in] msg string containing an optional message, or NULL if no message
- */
-void av_log_ask_for_sample(void *avc, const char *msg);
-
-/**
- * Registers the hardware accelerator hwaccel.
- */
-void av_register_hwaccel(AVHWAccel *hwaccel);
-
-/**
- * If hwaccel is NULL, returns the first registered hardware accelerator,
- * if hwaccel is non-NULL, returns the next registered hardware accelerator
- * after hwaccel, or NULL if hwaccel is the last one.
- */
-AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel);
-
-
-/**
- * Lock operation used by lockmgr
- */
-enum AVLockOp {
-  AV_LOCK_CREATE,  ///< Create a mutex
-  AV_LOCK_OBTAIN,  ///< Lock the mutex
-  AV_LOCK_RELEASE, ///< Unlock the mutex
-  AV_LOCK_DESTROY, ///< Free mutex resources
-};
-
-/**
- * Register a user provided lock manager supporting the operations
- * specified by AVLockOp. mutex points to a (void *) where the
- * lockmgr should store/get a pointer to a user allocated mutex. It's
- * NULL upon AV_LOCK_CREATE and != NULL for all other ops.
- *
- * @param cb User defined callback. Note: FFmpeg may invoke calls to this
- *           callback during the call to av_lockmgr_register().
- *           Thus, the application must be prepared to handle that.
- *           If cb is set to NULL the lockmgr will be unregistered.
- *           Also note that during unregistration the previously registered
- *           lockmgr callback may also be invoked.
- */
-int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
-
-#endif /* AVCODEC_AVCODEC_H */
diff --git a/libavcodec/avfft.c b/libavcodec/avfft.c
deleted file mode 100644
index 25fc4e0..0000000
--- a/libavcodec/avfft.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/mem.h"
-#include "avfft.h"
-#include "fft.h"
-
-/* FFT */
-
-FFTContext *av_fft_init(int nbits, int inverse)
-{
-    FFTContext *s = av_malloc(sizeof(*s));
-
-    if (s)
-        ff_fft_init(s, nbits, inverse);
-
-    return s;
-}
-
-void av_fft_permute(FFTContext *s, FFTComplex *z)
-{
-    s->fft_permute(s, z);
-}
-
-void av_fft_calc(FFTContext *s, FFTComplex *z)
-{
-    s->fft_calc(s, z);
-}
-
-void av_fft_end(FFTContext *s)
-{
-    if (s) {
-        ff_fft_end(s);
-        av_free(s);
-    }
-}
-
-#if CONFIG_MDCT
-
-FFTContext *av_mdct_init(int nbits, int inverse, double scale)
-{
-    FFTContext *s = av_malloc(sizeof(*s));
-
-    if (s)
-        ff_mdct_init(s, nbits, inverse, scale);
-
-    return s;
-}
-
-void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    s->imdct_calc(s, output, input);
-}
-
-void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    s->imdct_half(s, output, input);
-}
-
-void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    s->mdct_calc(s, output, input);
-}
-
-void av_mdct_end(FFTContext *s)
-{
-    if (s) {
-        ff_mdct_end(s);
-        av_free(s);
-    }
-}
-
-#endif /* CONFIG_MDCT */
-
-#if CONFIG_RDFT
-
-RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
-{
-    RDFTContext *s = av_malloc(sizeof(*s));
-
-    if (s)
-        ff_rdft_init(s, nbits, trans);
-
-    return s;
-}
-
-void av_rdft_calc(RDFTContext *s, FFTSample *data)
-{
-    ff_rdft_calc(s, data);
-}
-
-void av_rdft_end(RDFTContext *s)
-{
-    if (s) {
-        ff_rdft_end(s);
-        av_free(s);
-    }
-}
-
-#endif /* CONFIG_RDFT */
-
-#if CONFIG_DCT
-
-DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
-{
-    DCTContext *s = av_malloc(sizeof(*s));
-
-    if (s)
-        ff_dct_init(s, nbits, inverse);
-
-    return s;
-}
-
-void av_dct_calc(DCTContext *s, FFTSample *data)
-{
-    ff_dct_calc(s, data);
-}
-
-void av_dct_end(DCTContext *s)
-{
-    if (s) {
-        ff_dct_end(s);
-        av_free(s);
-    }
-}
-
-#endif /* CONFIG_DCT */
diff --git a/libavcodec/avfft.h b/libavcodec/avfft.h
deleted file mode 100644
index 623f0a3..0000000
--- a/libavcodec/avfft.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AVFFT_H
-#define AVCODEC_AVFFT_H
-
-typedef float FFTSample;
-
-typedef struct FFTComplex {
-    FFTSample re, im;
-} FFTComplex;
-
-typedef struct FFTContext FFTContext;
-
-/**
- * Set up a complex FFT.
- * @param nbits           log2 of the length of the input array
- * @param inverse         if 0 perform the forward transform, if 1 perform the inverse
- */
-FFTContext *av_fft_init(int nbits, int inverse);
-
-/**
- * Do the permutation needed BEFORE calling ff_fft_calc().
- */
-void av_fft_permute(FFTContext *s, FFTComplex *z);
-
-/**
- * Do a complex FFT with the parameters defined in av_fft_init(). The
- * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
- */
-void av_fft_calc(FFTContext *s, FFTComplex *z);
-
-void av_fft_end(FFTContext *s);
-
-FFTContext *av_mdct_init(int nbits, int inverse, double scale);
-void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
-void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
-void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
-void av_mdct_end(FFTContext *s);
-
-/* Real Discrete Fourier Transform */
-
-enum RDFTransformType {
-    DFT_R2C,
-    IDFT_C2R,
-    IDFT_R2C,
-    DFT_C2R,
-};
-
-typedef struct RDFTContext RDFTContext;
-
-/**
- * Set up a real FFT.
- * @param nbits           log2 of the length of the input array
- * @param trans           the type of transform
- */
-RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
-void av_rdft_calc(RDFTContext *s, FFTSample *data);
-void av_rdft_end(RDFTContext *s);
-
-/* Discrete Cosine Transform */
-
-typedef struct DCTContext DCTContext;
-
-enum DCTTransformType {
-    DCT_II = 0,
-    DCT_III,
-    DCT_I,
-    DST_I,
-};
-
-/**
- * Sets up DCT.
- * @param nbits           size of the input array:
- *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
- *                        (1 << nbits) + 1 for DCT-I
- *
- * @note the first element of the input of DST-I is ignored
- */
-DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
-void av_dct_calc(DCTContext *s, FFTSample *data);
-void av_dct_end (DCTContext *s);
-
-#endif /* AVCODEC_AVFFT_H */
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
deleted file mode 100644
index c51260f..0000000
--- a/libavcodec/avpacket.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * AVPacket functions for libavcodec
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-
-
-void av_destruct_packet_nofree(AVPacket *pkt)
-{
-    pkt->data = NULL; pkt->size = 0;
-}
-
-void av_destruct_packet(AVPacket *pkt)
-{
-    av_free(pkt->data);
-    pkt->data = NULL; pkt->size = 0;
-}
-
-void av_init_packet(AVPacket *pkt)
-{
-    pkt->pts   = AV_NOPTS_VALUE;
-    pkt->dts   = AV_NOPTS_VALUE;
-    pkt->pos   = -1;
-    pkt->duration = 0;
-    pkt->convergence_duration = 0;
-    pkt->flags = 0;
-    pkt->stream_index = 0;
-    pkt->destruct= NULL;
-}
-
-int av_new_packet(AVPacket *pkt, int size)
-{
-    uint8_t *data= NULL;
-    if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
-        data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (data){
-        memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-    }else
-        size=0;
-
-    av_init_packet(pkt);
-    pkt->data = data;
-    pkt->size = size;
-    pkt->destruct = av_destruct_packet;
-    if(!data)
-        return AVERROR(ENOMEM);
-    return 0;
-}
-
-void av_shrink_packet(AVPacket *pkt, int size)
-{
-    if (pkt->size <= size) return;
-    pkt->size = size;
-    memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-}
-
-int av_dup_packet(AVPacket *pkt)
-{
-    if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) {
-        uint8_t *data;
-        /* We duplicate the packet and don't forget to add the padding again. */
-        if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)
-            return AVERROR(ENOMEM);
-        data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
-        if (!data) {
-            return AVERROR(ENOMEM);
-        }
-        memcpy(data, pkt->data, pkt->size);
-        memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-        pkt->data = data;
-        pkt->destruct = av_destruct_packet;
-    }
-    return 0;
-}
-
-void av_free_packet(AVPacket *pkt)
-{
-    if (pkt) {
-        if (pkt->destruct) pkt->destruct(pkt);
-        pkt->data = NULL; pkt->size = 0;
-    }
-}
diff --git a/libavcodec/avr32/mathops.h b/libavcodec/avr32/mathops.h
deleted file mode 100644
index 85f42b5..0000000
--- a/libavcodec/avr32/mathops.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Simple math operations
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AVR32_MATHOPS_H
-#define AVCODEC_AVR32_MATHOPS_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/common.h"
-
-#if HAVE_INLINE_ASM
-
-#define MULL MULL
-static inline av_const int MULL(int a, int b, unsigned shift)
-{
-    union { int64_t x; int hl[2]; } x;
-    __asm__ ("muls.d %0, %1, %2       \n\t"
-             "lsr    %0, %3           \n\t"
-             "or     %0, %0, %m0<<%4  \n\t"
-             : "=r"(x) : "r"(b), "r"(a), "i"(shift), "i"(32-shift));
-    return x.hl[1];
-}
-
-#define MULH MULH
-static inline av_const int MULH(int a, int b)
-{
-    union { int64_t x; int hl[2]; } x;
-    __asm__ ("muls.d %0, %1, %2" : "=r"(x.x) : "r"(a), "r"(b));
-    return x.hl[0];
-}
-
-#define MUL64 MUL64
-static inline av_const int64_t MUL64(int a, int b)
-{
-    int64_t x;
-    __asm__ ("muls.d %0, %1, %2" : "=r"(x) : "r"(a), "r"(b));
-    return x;
-}
-
-static inline av_const int64_t MAC64(int64_t d, int a, int b)
-{
-    __asm__ ("macs.d %0, %1, %2" : "+r"(d) : "r"(a), "r"(b));
-    return d;
-}
-#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
-#define MLS64(d, a, b) MAC64(d, -(a), b)
-
-static inline av_const int MAC16(int d, int a, int b)
-{
-    __asm__ ("machh.w %0, %1:b, %2:b" : "+r"(d) : "r"(a), "r"(b));
-    return d;
-}
-#define MAC16(d, a, b) ((d) = MAC16(d, a, b))
-#define MLS16(d, a, b) MAC16(d, -(a), b)
-
-#define MUL16 MUL16
-static inline av_const int MUL16(int a, int b)
-{
-    int d;
-    __asm__ ("mulhh.w %0, %1:b, %2:b" : "=r"(d) : "r"(a), "r"(b));
-    return d;
-}
-
-#define mid_pred mid_pred
-static inline av_const int mid_pred(int a, int b, int c)
-{
-    int m;
-    __asm__ ("mov   %0, %2  \n\t"
-             "cp.w  %1, %2  \n\t"
-             "movgt %0, %1  \n\t"
-             "movgt %1, %2  \n\t"
-             "cp.w  %1, %3  \n\t"
-             "movle %1, %3  \n\t"
-             "cp.w  %0, %1  \n\t"
-             "movgt %0, %1  \n\t"
-             : "=&r"(m), "+r"(a)
-             : "r"(b), "r"(c));
-    return m;
-}
-
-#endif /* HAVE_INLINE_ASM */
-
-#endif /* AVCODEC_AVR32_MATHOPS_H */
diff --git a/libavcodec/avs.c b/libavcodec/avs.c
deleted file mode 100644
index f65a25a..0000000
--- a/libavcodec/avs.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * AVS video decoder.
- * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-
-
-typedef struct {
-    AVFrame picture;
-} AvsContext;
-
-typedef enum {
-    AVS_VIDEO     = 0x01,
-    AVS_AUDIO     = 0x02,
-    AVS_PALETTE   = 0x03,
-    AVS_GAME_DATA = 0x04,
-} AvsBlockType;
-
-typedef enum {
-    AVS_I_FRAME     = 0x00,
-    AVS_P_FRAME_3X3 = 0x01,
-    AVS_P_FRAME_2X2 = 0x02,
-    AVS_P_FRAME_2X3 = 0x03,
-} AvsVideoSubType;
-
-
-static int
-avs_decode_frame(AVCodecContext * avctx,
-                 void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AvsContext *const avs = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame *const p = (AVFrame *) & avs->picture;
-    const uint8_t *table, *vect;
-    uint8_t *out;
-    int i, j, x, y, stride, vect_w = 3, vect_h = 3;
-    AvsVideoSubType sub_type;
-    AvsBlockType type;
-    GetBitContext change_map;
-
-    if (avctx->reget_buffer(avctx, p)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-    p->reference = 1;
-    p->pict_type = FF_P_TYPE;
-    p->key_frame = 0;
-
-    out = avs->picture.data[0];
-    stride = avs->picture.linesize[0];
-
-    sub_type = buf[0];
-    type = buf[1];
-    buf += 4;
-
-    if (type == AVS_PALETTE) {
-        int first, last;
-        uint32_t *pal = (uint32_t *) avs->picture.data[1];
-
-        first = AV_RL16(buf);
-        last = first + AV_RL16(buf + 2);
-        buf += 4;
-        for (i=first; i<last; i++, buf+=3)
-            pal[i] = (buf[0] << 18) | (buf[1] << 10) | (buf[2] << 2);
-
-        sub_type = buf[0];
-        type = buf[1];
-        buf += 4;
-    }
-
-    if (type != AVS_VIDEO)
-        return -1;
-
-    switch (sub_type) {
-    case AVS_I_FRAME:
-        p->pict_type = FF_I_TYPE;
-        p->key_frame = 1;
-    case AVS_P_FRAME_3X3:
-        vect_w = 3;
-        vect_h = 3;
-        break;
-
-    case AVS_P_FRAME_2X2:
-        vect_w = 2;
-        vect_h = 2;
-        break;
-
-    case AVS_P_FRAME_2X3:
-        vect_w = 2;
-        vect_h = 3;
-        break;
-
-    default:
-      return -1;
-    }
-
-    table = buf + (256 * vect_w * vect_h);
-    if (sub_type != AVS_I_FRAME) {
-        int map_size = ((318 / vect_w + 7) / 8) * (198 / vect_h);
-        init_get_bits(&change_map, table, map_size);
-        table += map_size;
-    }
-
-    for (y=0; y<198; y+=vect_h) {
-        for (x=0; x<318; x+=vect_w) {
-            if (sub_type == AVS_I_FRAME || get_bits1(&change_map)) {
-                vect = &buf[*table++ * (vect_w * vect_h)];
-                for (j=0; j<vect_w; j++) {
-                    out[(y + 0) * stride + x + j] = vect[(0 * vect_w) + j];
-                    out[(y + 1) * stride + x + j] = vect[(1 * vect_w) + j];
-                    if (vect_h == 3)
-                        out[(y + 2) * stride + x + j] =
-                            vect[(2 * vect_w) + j];
-                }
-            }
-        }
-        if (sub_type != AVS_I_FRAME)
-            align_get_bits(&change_map);
-    }
-
-    *picture = *(AVFrame *) & avs->picture;
-    *data_size = sizeof(AVPicture);
-
-    return buf_size;
-}
-
-static av_cold int avs_decode_init(AVCodecContext * avctx)
-{
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    return 0;
-}
-
-AVCodec avs_decoder = {
-    "avs",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_AVS,
-    sizeof(AvsContext),
-    avs_decode_init,
-    NULL,
-    NULL,
-    avs_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"),
-};
diff --git a/libavcodec/beosthread.c b/libavcodec/beosthread.c
deleted file mode 100644
index 44fe492..0000000
--- a/libavcodec/beosthread.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2004 François Revol <revol at free.fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-//#define DEBUG
-
-#include "avcodec.h"
-
-#include <OS.h>
-
-typedef struct ThreadContext{
-    AVCodecContext *avctx;
-    thread_id thread;
-    sem_id work_sem;
-    sem_id done_sem;
-    int (*func)(AVCodecContext *c, void *arg);
-    void *arg;
-    int ret;
-}ThreadContext;
-
-// it's odd Be never patented that :D
-struct benaphore {
-        vint32 atom;
-        sem_id sem;
-};
-static inline int lock_ben(struct benaphore *ben)
-{
-        if (atomic_add(&ben->atom, 1) > 0)
-                return acquire_sem(ben->sem);
-        return B_OK;
-}
-static inline int unlock_ben(struct benaphore *ben)
-{
-        if (atomic_add(&ben->atom, -1) > 1)
-                return release_sem(ben->sem);
-        return B_OK;
-}
-
-static struct benaphore av_thread_lib_ben;
-
-static int32 ff_thread_func(void *v){
-    ThreadContext *c= v;
-
-    for(;;){
-//printf("thread_func %X enter wait\n", (int)v); fflush(stdout);
-        acquire_sem(c->work_sem);
-//printf("thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout);
-        if(c->func)
-            c->ret= c->func(c->avctx, c->arg);
-        else
-            return 0;
-//printf("thread_func %X signal complete\n", (int)v); fflush(stdout);
-        release_sem(c->done_sem);
-    }
-
-    return B_OK;
-}
-
-/**
- * Free what has been allocated by avcodec_thread_init().
- * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running.
- */
-void avcodec_thread_free(AVCodecContext *s){
-    ThreadContext *c= s->thread_opaque;
-    int i;
-    int32 ret;
-
-    for(i=0; i<s->thread_count; i++){
-
-        c[i].func= NULL;
-        release_sem(c[i].work_sem);
-        wait_for_thread(c[i].thread, &ret);
-        if(c[i].work_sem > B_OK) delete_sem(c[i].work_sem);
-        if(c[i].done_sem > B_OK) delete_sem(c[i].done_sem);
-    }
-
-    av_freep(&s->thread_opaque);
-}
-
-static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
-    ThreadContext *c= s->thread_opaque;
-    int i;
-
-    assert(s == c->avctx);
-    assert(count <= s->thread_count);
-
-    /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */
-
-    for(i=0; i<count; i++){
-        c[i].arg= (char*)arg + i*size;
-        c[i].func= func;
-        c[i].ret= 12345;
-
-        release_sem(c[i].work_sem);
-    }
-    for(i=0; i<count; i++){
-        acquire_sem(c[i].done_sem);
-
-        c[i].func= NULL;
-        if(ret) ret[i]= c[i].ret;
-    }
-    return 0;
-}
-
-int avcodec_thread_init(AVCodecContext *s, int thread_count){
-    int i;
-    ThreadContext *c;
-
-    s->thread_count= thread_count;
-
-    if (thread_count <= 1)
-        return 0;
-
-    assert(!s->thread_opaque);
-    c= av_mallocz(sizeof(ThreadContext)*thread_count);
-    s->thread_opaque= c;
-
-    for(i=0; i<thread_count; i++){
-//printf("init semaphors %d\n", i); fflush(stdout);
-        c[i].avctx= s;
-
-        if((c[i].work_sem = create_sem(0, "ff work sem")) < B_OK)
-            goto fail;
-        if((c[i].done_sem = create_sem(0, "ff done sem")) < B_OK)
-            goto fail;
-
-//printf("create thread %d\n", i); fflush(stdout);
-        c[i].thread = spawn_thread(ff_thread_func, "libavcodec thread", B_LOW_PRIORITY, &c[i] );
-        if( c[i].thread < B_OK ) goto fail;
-        resume_thread(c[i].thread );
-    }
-//printf("init done\n"); fflush(stdout);
-
-    s->execute= avcodec_thread_execute;
-
-    return 0;
-fail:
-    avcodec_thread_free(s);
-    return -1;
-}
-
-/* provide a mean to serialize calls to avcodec_*() for thread safety. */
-
-int avcodec_thread_lock_lib(void)
-{
-        return lock_ben(&av_thread_lib_ben);
-}
-
-int avcodec_thread_unlock_lib(void)
-{
-        return unlock_ben(&av_thread_lib_ben);
-}
-
-/* our versions of _init and _fini (which are called by those actually from crt.o) */
-
-void initialize_after(void)
-{
-        av_thread_lib_ben.atom = 0;
-        av_thread_lib_ben.sem = create_sem(0, "libavcodec benaphore");
-}
-
-void uninitialize_before(void)
-{
-        delete_sem(av_thread_lib_ben.sem);
-}
-
-
-
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c
deleted file mode 100644
index 0ba39e6..0000000
--- a/libavcodec/bethsoftvideo.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Bethesda VID video decoder
- * Copyright (C) 2007 Nicholas Tung
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Bethesda Softworks VID Video Decoder
- * @author Nicholas Tung [ntung (at. ntung com] (2007-03)
- * @sa http://wiki.multimedia.cx/index.php?title=Bethsoft_VID
- * @sa http://www.svatopluk.com/andux/docs/dfvid.html
- */
-
-#include "libavutil/common.h"
-#include "dsputil.h"
-#include "bethsoftvideo.h"
-#include "bytestream.h"
-
-typedef struct BethsoftvidContext {
-    AVFrame frame;
-} BethsoftvidContext;
-
-static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
-{
-    BethsoftvidContext *vid = avctx->priv_data;
-    vid->frame.reference = 1;
-    vid->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
-        FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    return 0;
-}
-
-static void set_palette(AVFrame * frame, const uint8_t * palette_buffer)
-{
-    uint32_t * palette = (uint32_t *)frame->data[1];
-    int a;
-    for(a = 0; a < 256; a++){
-        palette[a] = AV_RB24(&palette_buffer[a * 3]) * 4;
-    }
-    frame->palette_has_changed = 1;
-}
-
-static int bethsoftvid_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    BethsoftvidContext * vid = avctx->priv_data;
-    char block_type;
-    uint8_t * dst;
-    uint8_t * frame_end;
-    int remaining = avctx->width;          // number of bytes remaining on a line
-    const int wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
-    int code;
-    int yoffset;
-
-    if (avctx->reget_buffer(avctx, &vid->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-    dst = vid->frame.data[0];
-    frame_end = vid->frame.data[0] + vid->frame.linesize[0] * avctx->height;
-
-    switch(block_type = *buf++){
-        case PALETTE_BLOCK:
-            set_palette(&vid->frame, buf);
-            return 0;
-        case VIDEO_YOFF_P_FRAME:
-            yoffset = bytestream_get_le16(&buf);
-            if(yoffset >= avctx->height)
-                return -1;
-            dst += vid->frame.linesize[0] * yoffset;
-    }
-
-    // main code
-    while((code = *buf++)){
-        int length = code & 0x7f;
-
-        // copy any bytes starting at the current position, and ending at the frame width
-        while(length > remaining){
-            if(code < 0x80)
-                bytestream_get_buffer(&buf, dst, remaining);
-            else if(block_type == VIDEO_I_FRAME)
-                memset(dst, buf[0], remaining);
-            length -= remaining;      // decrement the number of bytes to be copied
-            dst += remaining + wrap_to_next_line;    // skip over extra bytes at end of frame
-            remaining = avctx->width;
-            if(dst == frame_end)
-                goto end;
-        }
-
-        // copy any remaining bytes after / if line overflows
-        if(code < 0x80)
-            bytestream_get_buffer(&buf, dst, length);
-        else if(block_type == VIDEO_I_FRAME)
-            memset(dst, *buf++, length);
-        remaining -= length;
-        dst += length;
-    }
-    end:
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = vid->frame;
-
-    return buf_size;
-}
-
-static av_cold int bethsoftvid_decode_end(AVCodecContext *avctx)
-{
-    BethsoftvidContext * vid = avctx->priv_data;
-    if(vid->frame.data[0])
-        avctx->release_buffer(avctx, &vid->frame);
-    return 0;
-}
-
-AVCodec bethsoftvid_decoder = {
-    .name = "bethsoftvid",
-    .type = AVMEDIA_TYPE_VIDEO,
-    .id = CODEC_ID_BETHSOFTVID,
-    .priv_data_size = sizeof(BethsoftvidContext),
-    .init = bethsoftvid_decode_init,
-    .close = bethsoftvid_decode_end,
-    .decode = bethsoftvid_decode_frame,
-    .capabilities = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Bethesda VID video"),
-};
diff --git a/libavcodec/bethsoftvideo.h b/libavcodec/bethsoftvideo.h
deleted file mode 100644
index d5b5d0a..0000000
--- a/libavcodec/bethsoftvideo.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Bethesda VID video decoder
- * Copyright (C) 2007 Nicholas Tung
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_BETHSOFTVIDEO_H
-#define AVCODEC_BETHSOFTVIDEO_H
-
-enum BethsoftVidBlockType
-{
-    PALETTE_BLOCK       = 0x02,
-    FIRST_AUDIO_BLOCK   = 0x7c,
-    AUDIO_BLOCK         = 0x7d,
-    VIDEO_I_FRAME       = 0x03,
-    VIDEO_P_FRAME       = 0x01,
-    VIDEO_YOFF_P_FRAME  = 0x04,
-    EOF_BLOCK           = 0x14,
-};
-
-#endif /* AVCODEC_BETHSOFTVIDEO_H */
diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c
deleted file mode 100644
index 91c8f6d..0000000
--- a/libavcodec/bfi.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Brute Force & Ignorance (BFI) video decoder
- * Copyright (c) 2008 Sisir Koppaka
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Brute Force & Ignorance (.bfi) video decoder
- * @author Sisir Koppaka ( sisir.koppaka at gmail dot com )
- * @sa http://wiki.multimedia.cx/index.php?title=BFI
- */
-
-#include "libavutil/common.h"
-#include "avcodec.h"
-#include "bytestream.h"
-
-typedef struct BFIContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    uint8_t *dst;
-} BFIContext;
-
-static av_cold int bfi_decode_init(AVCodecContext * avctx)
-{
-    BFIContext *bfi = avctx->priv_data;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    bfi->dst = av_mallocz(avctx->width * avctx->height);
-    return 0;
-}
-
-static int bfi_decode_frame(AVCodecContext * avctx, void *data,
-                            int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    BFIContext *bfi = avctx->priv_data;
-    uint8_t *dst = bfi->dst;
-    uint8_t *src, *dst_offset, colour1, colour2;
-    uint8_t *frame_end = bfi->dst + avctx->width * avctx->height;
-    uint32_t *pal;
-    int i, j, height = avctx->height;
-
-    if (bfi->frame.data[0])
-        avctx->release_buffer(avctx, &bfi->frame);
-
-    bfi->frame.reference = 1;
-
-    if (avctx->get_buffer(avctx, &bfi->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    /* Set frame parameters and palette, if necessary */
-    if (!avctx->frame_number) {
-        bfi->frame.pict_type = FF_I_TYPE;
-        bfi->frame.key_frame = 1;
-        /* Setting the palette */
-        if(avctx->extradata_size>768) {
-            av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n");
-            return -1;
-        }
-        pal = (uint32_t *) bfi->frame.data[1];
-        for (i = 0; i < avctx->extradata_size / 3; i++) {
-            int shift = 16;
-            *pal = 0;
-            for (j = 0; j < 3; j++, shift -= 8)
-                *pal +=
-                    ((avctx->extradata[i * 3 + j] << 2) |
-                    (avctx->extradata[i * 3 + j] >> 4)) << shift;
-            pal++;
-        }
-        bfi->frame.palette_has_changed = 1;
-    } else {
-        bfi->frame.pict_type = FF_P_TYPE;
-        bfi->frame.key_frame = 0;
-    }
-
-    buf += 4; //Unpacked size, not required.
-
-    while (dst != frame_end) {
-        static const uint8_t lentab[4]={0,2,0,1};
-        unsigned int byte = *buf++, av_uninit(offset);
-        unsigned int code = byte >> 6;
-        unsigned int length = byte & ~0xC0;
-
-        /* Get length and offset(if required) */
-        if (length == 0) {
-            if (code == 1) {
-                length = bytestream_get_byte(&buf);
-                offset = bytestream_get_le16(&buf);
-            } else {
-                length = bytestream_get_le16(&buf);
-                if (code == 2 && length == 0)
-                    break;
-            }
-        } else {
-            if (code == 1)
-                offset = bytestream_get_byte(&buf);
-        }
-
-        /* Do boundary check */
-        if (dst + (length<<lentab[code]) > frame_end)
-            break;
-
-        switch (code) {
-
-        case 0:                //Normal Chain
-            bytestream_get_buffer(&buf, dst, length);
-            dst += length;
-            break;
-
-        case 1:                //Back Chain
-            dst_offset = dst - offset;
-            length *= 4;        //Convert dwords to bytes.
-            if (dst_offset < bfi->dst)
-                break;
-            while (length--)
-                *dst++ = *dst_offset++;
-            break;
-
-        case 2:                //Skip Chain
-            dst += length;
-            break;
-
-        case 3:                //Fill Chain
-            colour1 = bytestream_get_byte(&buf);
-            colour2 = bytestream_get_byte(&buf);
-            while (length--) {
-                *dst++ = colour1;
-                *dst++ = colour2;
-            }
-            break;
-
-        }
-    }
-
-    src = bfi->dst;
-    dst = bfi->frame.data[0];
-    while (height--) {
-        memcpy(dst, src, avctx->width);
-        src += avctx->width;
-        dst += bfi->frame.linesize[0];
-    }
-    *data_size = sizeof(AVFrame);
-    *(AVFrame *) data = bfi->frame;
-    return buf_size;
-}
-
-static av_cold int bfi_decode_close(AVCodecContext * avctx)
-{
-    BFIContext *bfi = avctx->priv_data;
-    if (bfi->frame.data[0])
-        avctx->release_buffer(avctx, &bfi->frame);
-    av_free(bfi->dst);
-    return 0;
-}
-
-AVCodec bfi_decoder = {
-    .name = "bfi",
-    .type = AVMEDIA_TYPE_VIDEO,
-    .id = CODEC_ID_BFI,
-    .priv_data_size = sizeof(BFIContext),
-    .init = bfi_decode_init,
-    .close = bfi_decode_close,
-    .decode = bfi_decode_frame,
-    .capabilities = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
-};
diff --git a/libavcodec/bfin/Makefile b/libavcodec/bfin/Makefile
deleted file mode 100644
index e50e3cd..0000000
--- a/libavcodec/bfin/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-OBJS                                   += bfin/dsputil_bfin.o           \
-                                          bfin/fdct_bfin.o              \
-                                          bfin/idct_bfin.o              \
-                                          bfin/mpegvideo_bfin.o         \
-                                          bfin/pixels_bfin.o            \
-                                          bfin/vp3_bfin.o               \
-                                          bfin/vp3_idct_bfin.o          \
diff --git a/libavcodec/bfin/config_bfin.h b/libavcodec/bfin/config_bfin.h
deleted file mode 100644
index f3a2c6e..0000000
--- a/libavcodec/bfin/config_bfin.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-/*
-   low level assembler interface wrapper
-
-DEFUN(put_pixels_clamped,mL1,
-        (DCTELEM *block, uint8_t *dest, int line_size)):
-
-      body
-
-      rts;
-*/
-
-#ifndef AVCODEC_BFIN_CONFIG_BFIN_H
-#define AVCODEC_BFIN_CONFIG_BFIN_H
-
-#include "config.h"
-
-#ifndef DEFUN
-
-#define mL3 .text
-#ifndef mL1
-#if defined(__FDPIC__) && CONFIG_SRAM
-#define mL1 .l1.text
-#else
-#define mL1 mL3
-#endif
-#endif
-
-#define DEFUN(fname,where,interface) \
-        .section where;              \
-        .global _ff_bfin_ ## fname ; \
-        .type _ff_bfin_ ## fname, STT_FUNC; \
-        .align 8;                    \
-        _ff_bfin_ ## fname
-
-#define DEFUN_END(fname) \
-        .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname
-
-#ifdef __FDPIC__
-#define RELOC(reg,got,obj) reg = [got + obj at GOT17M4]
-#else
-#define RELOC(reg,got,obj) reg.L = obj; reg.H = obj
-#endif
-
-#endif
-
-#endif /* AVCODEC_BFIN_CONFIG_BFIN_H */
diff --git a/libavcodec/bfin/dsputil_bfin.c b/libavcodec/bfin/dsputil_bfin.c
deleted file mode 100644
index 161d2da..0000000
--- a/libavcodec/bfin/dsputil_bfin.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * BlackFin DSPUTILS
- *
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- * Copyright (c) 2006 Michael Benjamin <michael.benjamin at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_bfin.h"
-
-int off;
-
-static void bfin_idct_add (uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_bfin_idct (block);
-    ff_bfin_add_pixels_clamped (block, dest, line_size);
-}
-
-static void bfin_idct_put (uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_bfin_idct (block);
-    ff_bfin_put_pixels_clamped (block, dest, line_size);
-}
-
-
-static void bfin_clear_blocks (DCTELEM *blocks)
-{
-    // This is just a simple memset.
-    //
-    __asm__("P0=192; "
-        "I0=%0;  "
-        "R0=0;   "
-        "LSETUP(clear_blocks_blkfn_lab,clear_blocks_blkfn_lab)LC0=P0;"
-        "clear_blocks_blkfn_lab:"
-        "[I0++]=R0;"
-        ::"a" (blocks):"P0","I0","R0");
-}
-
-
-
-static void bfin_put_pixels8 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc (block, pixels, pixels, line_size, line_size, h);
-}
-
-static void bfin_put_pixels8_x2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc (block, pixels, pixels+1, line_size, line_size, h);
-}
-
-static void bfin_put_pixels8_y2 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc (block, pixels, pixels+line_size, line_size, line_size, h);
-}
-
-static void bfin_put_pixels8_xy2 (uint8_t *block, const uint8_t *s0, int line_size, int h)
-{
-    ff_bfin_z_put_pixels8_xy2 (block,s0,line_size, line_size, h);
-}
-
-static void bfin_put_pixels16 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc (block, pixels, pixels, line_size, line_size, h);
-}
-
-static void bfin_put_pixels16_x2 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc (block, pixels, pixels+1, line_size, line_size, h);
-}
-
-static void bfin_put_pixels16_y2 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc (block, pixels, pixels+line_size, line_size, line_size, h);
-}
-
-static void bfin_put_pixels16_xy2 (uint8_t *block, const uint8_t *s0, int line_size, int h)
-{
-    ff_bfin_z_put_pixels16_xy2 (block,s0,line_size, line_size, h);
-}
-
-static void bfin_put_pixels8_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc_nornd (block, pixels, pixels, line_size, h);
-}
-
-static void bfin_put_pixels8_x2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc_nornd (block, pixels, pixels+1, line_size, h);
-}
-
-static void bfin_put_pixels8_y2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc_nornd (block, pixels, pixels+line_size, line_size, h);
-}
-
-
-static void bfin_put_pixels16_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc_nornd (block, pixels, pixels, line_size, h);
-}
-
-static void bfin_put_pixels16_x2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc_nornd (block, pixels, pixels+1, line_size, h);
-}
-
-static void bfin_put_pixels16_y2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc_nornd (block, pixels, pixels+line_size, line_size, h);
-}
-
-static int bfin_pix_abs16 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    return ff_bfin_z_sad16x16 (blk1,blk2,line_size,line_size,h);
-}
-
-static int bfin_vsad_intra16 (void *c, uint8_t *blk1, uint8_t *dummy, int stride, int h) {
-    return ff_bfin_z_sad16x16 (blk1,blk1+stride,stride<<1,stride<<1,h);
-}
-
-static int bfin_vsad (void *c, uint8_t *blk1, uint8_t *blk2, int stride, int h) {
-    return ff_bfin_z_sad16x16 (blk1,blk1+stride,stride<<1,stride<<1,h)
-        + ff_bfin_z_sad16x16 (blk2,blk2+stride,stride<<1,stride<<1,h);
-}
-
-static uint8_t vtmp_blk[256] attribute_l1_data_b;
-
-static int bfin_pix_abs16_x2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc (vtmp_blk, blk2, blk2+1, 16, line_size, h);
-    return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h);
-}
-
-static int bfin_pix_abs16_y2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    ff_bfin_put_pixels16uc (vtmp_blk, blk2, blk2+line_size, 16, line_size, h);
-    return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h);
-}
-
-static int bfin_pix_abs16_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    ff_bfin_z_put_pixels16_xy2 (vtmp_blk, blk2, 16, line_size, h);
-    return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h);
-}
-
-static int bfin_pix_abs8 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    return ff_bfin_z_sad8x8 (blk1,blk2,line_size,line_size, h);
-}
-
-static int bfin_pix_abs8_x2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc (vtmp_blk, blk2, blk2+1, 8, line_size, h);
-    return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h);
-}
-
-static int bfin_pix_abs8_y2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    ff_bfin_put_pixels8uc (vtmp_blk, blk2, blk2+line_size, 8, line_size, h);
-    return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h);
-}
-
-static int bfin_pix_abs8_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
-{
-    ff_bfin_z_put_pixels8_xy2 (vtmp_blk, blk2, 8, line_size, h);
-    return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h);
-}
-
-
-/*
-  decoder optimization
-  start on 2/11 100 frames of 352x240 at 25 compiled with no optimization -g debugging
-  9.824s ~ 2.44x off
-  6.360s ~ 1.58x off with -O2
-  5.740s ~ 1.43x off with idcts
-
-  2.64s    2/20 same sman.mp4 decode only
-
-*/
-
-void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
-{
-    c->get_pixels         = ff_bfin_get_pixels;
-    c->diff_pixels        = ff_bfin_diff_pixels;
-    c->put_pixels_clamped = ff_bfin_put_pixels_clamped;
-    c->add_pixels_clamped = ff_bfin_add_pixels_clamped;
-
-    c->clear_blocks       = bfin_clear_blocks;
-    c->pix_sum            = ff_bfin_pix_sum;
-    c->pix_norm1          = ff_bfin_pix_norm1;
-
-    c->sad[0]             = bfin_pix_abs16;
-    c->sad[1]             = bfin_pix_abs8;
-
-/*     c->vsad[0]            = bfin_vsad; */
-/*     c->vsad[4]            = bfin_vsad_intra16; */
-
-    /* TODO [0] 16  [1] 8 */
-    c->pix_abs[0][0] = bfin_pix_abs16;
-    c->pix_abs[0][1] = bfin_pix_abs16_x2;
-    c->pix_abs[0][2] = bfin_pix_abs16_y2;
-    c->pix_abs[0][3] = bfin_pix_abs16_xy2;
-
-    c->pix_abs[1][0] = bfin_pix_abs8;
-    c->pix_abs[1][1] = bfin_pix_abs8_x2;
-    c->pix_abs[1][2] = bfin_pix_abs8_y2;
-    c->pix_abs[1][3] = bfin_pix_abs8_xy2;
-
-
-    c->sse[0] = ff_bfin_sse16;
-    c->sse[1] = ff_bfin_sse8;
-    c->sse[2] = ff_bfin_sse4;
-
-
-    /**
-     * Halfpel motion compensation with rounding (a+b+1)>>1.
-     * This is an array[4][4] of motion compensation functions for 4
-     * horizontal blocksizes (8,16) and the 4 halfpel positions
-     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
-     * @param block destination where the result is stored
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-     */
-
-    c->put_pixels_tab[0][0] = bfin_put_pixels16;
-    c->put_pixels_tab[0][1] = bfin_put_pixels16_x2;
-    c->put_pixels_tab[0][2] = bfin_put_pixels16_y2;
-    c->put_pixels_tab[0][3] = bfin_put_pixels16_xy2;
-
-    c->put_pixels_tab[1][0] = bfin_put_pixels8;
-    c->put_pixels_tab[1][1] = bfin_put_pixels8_x2;
-    c->put_pixels_tab[1][2] = bfin_put_pixels8_y2;
-    c->put_pixels_tab[1][3] = bfin_put_pixels8_xy2;
-
-    c->put_no_rnd_pixels_tab[1][0] = bfin_put_pixels8_nornd;
-    c->put_no_rnd_pixels_tab[1][1] = bfin_put_pixels8_x2_nornd;
-    c->put_no_rnd_pixels_tab[1][2] = bfin_put_pixels8_y2_nornd;
-/*     c->put_no_rnd_pixels_tab[1][3] = ff_bfin_put_pixels8_xy2_nornd; */
-
-    c->put_no_rnd_pixels_tab[0][0] = bfin_put_pixels16_nornd;
-    c->put_no_rnd_pixels_tab[0][1] = bfin_put_pixels16_x2_nornd;
-    c->put_no_rnd_pixels_tab[0][2] = bfin_put_pixels16_y2_nornd;
-/*     c->put_no_rnd_pixels_tab[0][3] = ff_bfin_put_pixels16_xy2_nornd; */
-
-    if (avctx->dct_algo == FF_DCT_AUTO)
-        c->fdct               = ff_bfin_fdct;
-
-    if (avctx->idct_algo==FF_IDCT_VP3) {
-        c->idct_permutation_type = FF_NO_IDCT_PERM;
-        c->idct               = ff_bfin_vp3_idct;
-        c->idct_add           = ff_bfin_vp3_idct_add;
-        c->idct_put           = ff_bfin_vp3_idct_put;
-    } else if (avctx->idct_algo == FF_IDCT_AUTO) {
-        c->idct_permutation_type = FF_NO_IDCT_PERM;
-        c->idct               = ff_bfin_idct;
-        c->idct_add           = bfin_idct_add;
-        c->idct_put           = bfin_idct_put;
-    }
-}
-
-
-
diff --git a/libavcodec/bfin/dsputil_bfin.h b/libavcodec/bfin/dsputil_bfin.h
deleted file mode 100644
index 7edcf97..0000000
--- a/libavcodec/bfin/dsputil_bfin.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * BlackFin DSPUTILS COMMON OPTIMIZATIONS HEADER
- *
- * Copyright (C) 2007 Marc Hoffman <mmh at pleasantst.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#ifndef AVCODEC_BFIN_DSPUTIL_BFIN_H
-#define AVCODEC_BFIN_DSPUTIL_BFIN_H
-
-#include "config.h"
-#include "libavcodec/dsputil.h"
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-#define attribute_l1_text  __attribute__ ((l1_text))
-#define attribute_l1_data_b __attribute__((l1_data_B))
-#else
-#define attribute_l1_text
-#define attribute_l1_data_b
-#endif
-
-void ff_bfin_idct (DCTELEM *block) attribute_l1_text;
-void ff_bfin_fdct (DCTELEM *block) attribute_l1_text;
-void ff_bfin_vp3_idct (DCTELEM *block);
-void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block);
-void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block);
-void ff_bfin_add_pixels_clamped (const DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text;
-void ff_bfin_put_pixels_clamped (const DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text;
-void ff_bfin_diff_pixels (DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride)  attribute_l1_text;
-void ff_bfin_get_pixels  (DCTELEM *restrict block, const uint8_t *pixels, int line_size) attribute_l1_text;
-int  ff_bfin_pix_norm1  (uint8_t * pix, int line_size) attribute_l1_text;
-int  ff_bfin_z_sad8x8   (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text;
-int  ff_bfin_z_sad16x16 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text;
-
-void ff_bfin_z_put_pixels16_xy2     (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h) attribute_l1_text;
-void ff_bfin_z_put_pixels8_xy2      (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h) attribute_l1_text;
-void ff_bfin_put_pixels16_xy2_nornd (uint8_t *block, const uint8_t *s0, int line_size, int h) attribute_l1_text;
-void ff_bfin_put_pixels8_xy2_nornd  (uint8_t *block, const uint8_t *s0, int line_size, int h) attribute_l1_text;
-
-
-int  ff_bfin_pix_sum (uint8_t *p, int stride) attribute_l1_text;
-
-void ff_bfin_put_pixels8uc        (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h) attribute_l1_text;
-void ff_bfin_put_pixels16uc       (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h) attribute_l1_text;
-void ff_bfin_put_pixels8uc_nornd  (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h) attribute_l1_text;
-void ff_bfin_put_pixels16uc_nornd (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h) attribute_l1_text;
-
-int ff_bfin_sse4  (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text;
-int ff_bfin_sse8  (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text;
-int ff_bfin_sse16 (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text;
-
-
-#ifdef BFIN_PROFILE
-
-static double Telem[16];
-static char  *TelemNames[16];
-static int    TelemCnt;
-
-#define PROF(lab,e) { int xx_e = e; char*xx_lab = lab; uint64_t xx_t0 = read_time();
-#define EPROF()       xx_t0 = read_time()-xx_t0; Telem[xx_e] = Telem[xx_e] + xx_t0; TelemNames[xx_e] = xx_lab; }
-
-static void prof_report (void)
-{
-    int i;
-    double s = 0;
-    for (i=0;i<16;i++) {
-        double v;
-        if (TelemNames[i]) {
-            v = Telem[i]/TelemCnt;
-            av_log (NULL,AV_LOG_DEBUG,"%-20s: %12.4f\t%12.4f\n", TelemNames[i],v,v/64);
-            s = s + Telem[i];
-        }
-    }
-    av_log (NULL,AV_LOG_DEBUG,"%-20s: %12.4f\t%12.4f\n%20.4f\t%d\n",
-            "total",s/TelemCnt,s/TelemCnt/64,s,TelemCnt);
-}
-
-static void bfprof (void)
-{
-    static int init;
-    if (!init) atexit (prof_report);
-    init=1;
-    TelemCnt++;
-}
-
-#else
-#define PROF(a,b)
-#define EPROF()
-#define bfprof()
-#endif
-
-#endif /* AVCODEC_BFIN_DSPUTIL_BFIN_H */
diff --git a/libavcodec/bfin/fdct_bfin.S b/libavcodec/bfin/fdct_bfin.S
deleted file mode 100644
index 0eac7a3..0000000
--- a/libavcodec/bfin/fdct_bfin.S
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * fdct BlackFin
- *
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-/*
-  void ff_bfin_fdct (DCTELEM *buf);
-
-  This implementation works only for 8x8 input. The range of input
-  must be -256 to 255 i.e. 8bit input represented in a 16bit data
-  word. The original data must be sign extended into the 16bit data
-  words.
-
-
-   Chen factorization of
-
-           8
-   X(m) = sum (x(n) * cos ((2n+1)*m*pi/16))
-          n=0
-
-                                             C4
- 0  --*-------------*0+7---*-----*0+3-------*-*-------------------> 0
-       \           /        \   /            X S4,S4
- 1  --*-\---------/-*1+6---*-\-/-*1+2-------*-*-------------------> 4
-         \       /            \              -C4     C3
- 2  --*---\-----/---*2+5---*-/-\-*1-2---------------*-*-----------> 2
-           \   /            /   \                    X S3,-S3
- 3  --*-----\-/-----*3+4---*-----*0-3---------------*-*-----------> 6
-             /                                  C7   C3
- 4  --*-----/-\-----*3-4------------*-*4+5--*-----*---------------> 1
-           /   \            -C4      X       \   /S7    C3
- 5  --*---/-----\---*2-5---*-*------*=*4-5----\-/------*-*--------> 5
-         /       \          X S4,S4            /        X S3,-S3
- 6  --*-/---------\-*1-6---*-*------*=*7-6----/-\------*-*--------> 3
-       /           \        C4       X       /   \-S7   C3
-    --*-------------*0-7------------*-*7+6--*-----*---------------> 7
-                                                C7
-
-Notation
-        Cn = cos(n*pi/8) used throughout the code.
-
-
-  Registers used:
-        R0, R1, R2, R3, R4, R5, R6,R7,  P0, P1, P2, P3, P4, P5, A0, A1.
-  Other registers used:
-        I0, I1, I2, I3, B0, B2, B3, M0, M1, L3 registers and LC0.
-
-  Input - r0 - pointer to start of DCTELEM *block
-
-  Output - The DCT output coefficients in the DCTELEM *block
-
-  Register constraint:
-               This code is called from jpeg_encode.
-               R6, R5, R4 if modified should be stored and restored.
-
-
-  Performance: (Timer version 0.6.33)
-               Code Size : 240 Bytes.
-               Memory Required :
-               Input Matrix : 8 * 8 * 2 Bytes.
-               Coefficients : 16 Bytes
-               Temporary matrix: 8 * 8 * 2 Bytes.
-               Cycle Count :26+{18+8*(14+2S)}*2  where S -> Stalls
-                            (7.45 c/pel)
-        -----------------------------------------
-        |  Size  |  Forward DCT  |  Inverse DCT |
-        -----------------------------------------
-        |  8x8   |   284 Cycles  |  311 Cycles  |
-        -----------------------------------------
-
-Ck = int16(cos(k/16*pi)*32767+.5)/2
-#define C4 23170
-#define C3 13623
-#define C6 6270
-#define C7 3196
-
-Sk = int16(sin(k/16*pi)*32767+.5)/2
-#define S4 11585
-#define S3 9102
-#define S6 15137
-#define S7 16069
-
-the coefficients are ordered as follows:
-short dct_coef[]
-  C4,S4,
-  C6,S6,
-  C7,S7,
-  S3,C3,
-
------------------------------------------------------------
-FFMPEG conformance testing results
------------------------------------------------------------
-dct-test: modified with the following
-            dct_error("BFINfdct", 0, ff_bfin_fdct, fdct, test);
-produces the following output:
-
-root:/u/ffmpeg/bhead/libavcodec> ./dct-test
-ffmpeg DCT/IDCT test
-
-    2  -131    -6   -48   -36    33   -83    24
-   34    52   -24   -15     5    92    57   143
-  -67   -43    -1    74   -16     5   -71    32
-  -78   106    92   -34   -38    81    20   -18
-    7   -62    40     2   -15    90   -62   -83
-  -83     1  -104   -13    43   -19     7    11
-  -63    31    12   -29    83    72    21    10
-  -17   -63   -15    73    50   -91   159   -14
-DCT BFINfdct: err_inf=2 err2=0.16425938 syserr=0.00795000 maxout=2098 blockSumErr=27
-DCT BFINfdct: 92.1 kdct/s
-root:/u/ffmpeg/bhead/libavcodec>
-
-*/
-
-#include "config.h"
-#include "config_bfin.h"
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-.section .l1.data.B,"aw", at progbits
-#else
-.data
-#endif
-.align 4;
-dct_coeff:
-.short 0x5a82, 0x2d41, 0x187e, 0x3b21, 0x0c7c, 0x3ec5, 0x238e, 0x3537;
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-.section .l1.data.A,"aw", at progbits
-#endif
-.align 4
-vtmp:   .space 128
-
-.text
-DEFUN(fdct,mL1,
-        (DCTELEM *block)):
-    [--SP] = (R7:4, P5:3);          // Push the registers onto the stack.
-
-    b0 = r0;
-    RELOC(r0, P3, dct_coeff);
-    b3 = r0;
-    RELOC(r0, P3, vtmp);
-    b2 = r0;
-
-    L3 = 16;                        // L3 is set to 16 to make the coefficient
-                                    // array Circular.
-
-
-//----------------------------------------------------------------------------
-
-/*
- * I0, I1, and I2 registers are used to read the input data. I3 register is used
- * to read the coefficients. P0 and P1 registers are used for writing the output
- * data.
- */
-    M0 = 12 (X);                    // All these initializations are used in the
-    M1 = 16 (X);                    // modification of address offsets.
-
-    M2 = 128 (X);
-
-    P2 = 16;
-    P3 = 32 (X);
-    P4 = -110 (X);
-    P5 = -62 (X);
-    P0 = 2(X);
-
-
-    // Prescale the input to get the correct precision.
-    i0=b0;
-    i1=b0;
-
-    lsetup (.0, .1) LC0 = P3;
-    r0=[i0++];
-.0:     r1=r0<<3 (v) || r0=[i0++] ;
-.1:     [i1++]=r1;
-
-        /*
-         * B0 points to the "in" buffer.
-         * B2 points to "temp" buffer in the first iteration.
-         */
-
-    lsetup (.2, .3) LC0 = P0;
-.2:
-        I0 = B0;                        // I0 points to Input Element (0, 0).
-        I1 = B0;                        // Element 1 and 0 is read in R0.
-        I1 += M0  || R0 = [I0++];       // I1 points to Input Element (0, 6).
-        I2 = I1;                        // Element 6 is read into R3.H.
-        I2 -= 4   || R3.H = W[I1++];    // I2 points to Input Element (0, 4).
-
-        I3 = B3;                        // I3 points to Coefficients.
-        P0 = B2;                        // P0 points to temporary array Element
-                                        //   (0, 0).
-        P1 = B2;                        // P1 points to temporary array.
-        R7 = [P1++P2] || R2 = [I2++];   // P1 points to temporary array
-                                        //   Element (1, 0).
-                                        // R7 is a dummy read. X4,X5
-                                        //   are read into R2.
-        R3.L = W[I1--];                 // X7 is read into R3.L.
-        R1.H = W[I0++];                 // X2 is read into R1.H.
-
-
-        /*
-         *  X0 = (X0 + X7) / 2.
-         *  X1 = (X1 + X6) / 2.
-         *  X6 = (X1 - X6) / 2.
-         *  X7 = (X0 - X7) / 2.
-         *  It reads the data 3 in R1.L.
-         */
-
-        R0 = R0 +|+ R3, R3 = R0 -|- R3 || R1.L = W[I0++] || NOP;
-
-        /*
-         *       X2 = (X2 + X5) / 2.
-         *       X3 = (X3 + X4) / 2.
-         *       X4 = (X3 - X4) / 2.
-         *       X5 = (X2 - X5) / 2.
-         *          R7 = C4 = cos(4*pi/16)
-         */
-
-        R1 = R1 +|+ R2, R2 = R1 -|- R2 (CO) || NOP      ||  R7 = [I3++];
-
-        /*
-         * At the end of stage 1 R0 has (1,0), R1 has (2,3), R2 has (4, 5) and
-         * R3 has (6,7).
-         * Where the notation (x, y) represents uper/lower half pairs.
-         */
-
-        /*
-         *       X0 = X0 + X3.
-         *       X1 = X1 + X2.
-         *       X2 = X1 - X2.
-         *       X3 = X0 - X3.
-         */
-        R0 = R0 +|+ R1, R1 = R0 -|- R1;
-
-        lsetup (.row0, .row1) LC1 = P2 >> 1;  // 1d dct, loops 8x
-.row0:
-
-        /*
-         *       This is part 2 computation continued.....
-         *       A1 =      X6 * cos(pi/4)
-         *       A0 =      X6 * cos(pi/4)
-         *       A1 = A1 - X5 * cos(pi/4)
-         *       A0 = A0 + X5 * cos(pi/4).
-         *       The instruction W[I0] = R3.L is used for packing it to R2.L.
-         */
-
-        A1=R3.H*R7.l,         A0=R3.H*R7.l            ||  I1+=M1 || W[I0] = R3.L;
-        R4.H=(A1-=R2.L*R7.l), R4.L=(A0+=R2.L*R7.l)    ||  I2+=M0 || NOP;
-
-        /*       R0 = (X1,X0)      R1 = (X2,X3)       R4 = (X5, X6). */
-
-        /*
-         *       A1 =      X0 * cos(pi/4)
-         *       A0 =      X0 * cos(pi/4)
-         *       A1 = A1 - X1 * cos(pi/4)
-         *       A0 = A0 + X1 * cos(pi/4)
-         *       R7 = (C2,C6)
-         */
-        A1=R0.L*R7.h,        A0=R0.L*R7.h             || NOP       || R3.H=W[I1++];
-        R5.H=(A1-=R0.H*R7.h),R5.L=(A0+=R0.H*R7.h)     || R7=[I3++] || NOP;
-
-        /*
-         *       A1 =      X2 * cos(3pi/8)
-         *       A0 =      X3 * cos(3pi/8)
-         *       A1 = A1 + X3 * cos(pi/8)
-         *       A0 = A0 - X2 * cos(pi/8)
-         *         R3 = cos(pi/4)
-         *         R7 = (cos(7pi/8),cos(pi/8))
-         *       X4 = X4 + X5.
-         *       X5 = X4 - X5.
-         *       X6 = X7 - X6.
-         *       X7 = X7 + X6.
-         */
-        A1=R1.H*R7.L,        A0=R1.L*R7.L             || W[P0++P3]=R5.L || R2.L=W[I0];
-        R2=R2+|+R4,          R4=R2-|-R4               || I0+=4          || R3.L=W[I1--];
-        R6.H=(A1+=R1.L*R7.H),R6.L=(A0 -= R1.H * R7.H) || I0+=4          || R7=[I3++];
-
-        /*         R2 = (X4, X7)        R4 = (X5,X6)      R5 = (X1, X0)       R6 = (X2,X3). */
-
-        /*
-         *       A1 =      X4 * cos(7pi/16)
-         *       A0 =      X7 * cos(7pi/16)
-         *       A1 = A1 + X7 * cos(pi/16)
-         *       A0 = A0 - X4 * cos(pi/16)
-         */
-
-        A1=R2.H*R7.L,        A0=R2.L*R7.L             || W[P0++P3]=R6.H || R0=[I0++];
-        R2.H=(A1+=R2.L*R7.H),R2.L=(A0-=R2.H*R7.H)     || W[P0++P3]=R5.H || R7=[I3++];
-
-        /*
-         *       A1 =      X5 * cos(3pi/16)
-         *       A0 =      X6 * cos(3pi/16)
-         *       A1 = A1 + X6 * cos(5pi/16)
-         *       A0 = A0 - X5 * cos(5pi/16)
-         *       The output values are written.
-         */
-
-        A1=R4.H*R7.H,        A0=R4.L*R7.H             || W[P0++P2]=R6.L || R1.H=W[I0++];
-        R4.H=(A1+=R4.L*R7.L),R4.L=(A0-=R4.H*R7.L)     || W[P0++P4]=R2.L || R1.L=W[I0++];
-
-
-        /* Beginning of next stage, **pipelined** + drain and store the
-           rest of the column store. */
-
-        R0=R0+|+R3,R3=R0-|-R3                         || W[P1++P3]=R2.H || R2=[I2++];
-        R1=R1+|+R2,R2=R1-|-R2 (CO)                    || W[P1++P3]=R4.L || R7=[I3++];
-.row1:  R0=R0+|+R1,R1=R0-|-R1                         || W[P1++P5]=R4.H || NOP;
-
-        // Exchange input with output.
-        B1 = B0;
-        B0 = B2;
-.3:     B2 = B1;
-
-        L3=0;
-        (r7:4,p5:3) = [sp++];
-        RTS;
-DEFUN_END(fdct)
-
diff --git a/libavcodec/bfin/idct_bfin.S b/libavcodec/bfin/idct_bfin.S
deleted file mode 100644
index 04f9159..0000000
--- a/libavcodec/bfin/idct_bfin.S
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * idct BlackFin
- *
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-/*
-   This blackfin DSP code implements an 8x8 inverse type II DCT.
-
-Prototype       : void ff_bfin_idct(DCTELEM *in)
-
-Registers Used  : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0.
-
-Performance     :
-                    Code Size   : 498 Bytes.
-                    Cycle Count : 417 Cycles
-
-
------------------------------------------------------------
-FFMPEG conformance testing results
------------------------------------------------------------
-
-dct-test: modified with the following
-            dct_error("BFINidct", 1, ff_bfin_idct, idct, test);
-produces the following output
-
-root:/u/ffmpeg/bhead/libavcodec> ./dct-test -i
-ffmpeg DCT/IDCT test
-
-    8    15    -2    21    24    17     0    10
-    2   -10    -5    -5    -3     7   -14    -3
-    2   -13   -10   -19    18    -6     6    -2
-    9     4    16    -3     9    12    10    15
-   15    -9    -2    10     1    16     0   -15
-  -15     5     7     3    13     0    13    20
-   -6   -15    24     9   -18     1     9   -22
-   -8    25    23     2    -7     0    30    13
-IDCT BFINidct: err_inf=1 err2=0.01002344 syserr=0.00150000 maxout=266 blockSumErr=64
-IDCT BFINidct: 88.3 kdct/s
-
-*/
-
-#include "config.h"
-#include "config_bfin.h"
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-.section .l1.data.B,"aw", at progbits
-#else
-.data
-#endif
-
-.align 4;
-coefs:
-.short 0x5a82;           //  C4
-.short 0x5a82;           //  C4
-.short 0x30FC;           //cos(3pi/8)  C6
-.short 0x7642;           //cos(pi/8)   C2
-.short 0x18F9;           //cos(7pi/16)
-.short 0x7D8A;           //cos(pi/16)
-.short 0x471D;           //cos(5pi/16)
-.short 0x6A6E;           //cos(3pi/16)
-.short 0x18F9;           //cos(7pi/16)
-.short 0x7D8A;           //cos(pi/16)
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-.section .l1.data.A,"aw", at progbits
-#endif
-
-vtmp: .space 256
-
-#define TMP0 FP-8
-#define TMP1 FP-12
-#define TMP2 FP-16
-
-
-.text
-DEFUN(idct,mL1,
-        (DCTELEM *block)):
-
-/********************** Function Prologue *********************************/
-    link 16;
-    [--SP] = (R7:4, P5:3);   // Push the registers onto the stack.
-    B0 = R0;                 // Pointer to Input matrix
-    RELOC(R1, P3, coefs);    // Pointer to Coefficients
-    RELOC(R2, P3, vtmp);     // Pointer to Temporary matrix
-    B3 = R1;
-    B2 = R2;
-    L3 = 20;                // L3 is used for making the coefficient array
-                            // circular.
-                            // MUST BE RESTORED TO ZERO at function exit.
-    M1 = 16 (X);            // All these registers are initialized for
-    M3 = 8(X);              // modifying address offsets.
-
-    I0 = B0;                // I0 points to Input Element (0, 0).
-    I2 = B0;                // I2 points to Input Element (0, 0).
-    I2 += M3 || R0.H = W[I0];
-                            // Element 0 is read into R0.H
-    I1 = I2;                // I1 points to input Element (0, 6).
-    I1 += 4  || R0.L = W[I2++];
-                            // I2 points to input Element (0, 4).
-                            // Element 4 is read into R0.L.
-    P2 = 8 (X);
-    P3 = 32 (X);
-    P4 = -32 (X);
-    P5 = 98 (X);
-    R7 = 0x8000(Z);
-    I3 = B3;                // I3 points to Coefficients
-    P0 = B2;                // P0 points to array Element (0, 0) of temp
-    P1 = B2;
-    R7 = [I3++] || [TMP2]=R7;            // Coefficient C4 is read into R7.H and R7.L.
-    MNOP;
-    NOP;
-
-    /*
-     *   A1 =      Y0 * cos(pi/4)
-     *   A0 =      Y0 * cos(pi/4)
-     *   A1 = A1 + Y4 * cos(pi/4)
-     *   A0 = A0 - Y4 * cos(pi/4)
-     *   load:
-     *     R1=(Y2,Y6)
-     *     R7=(C2,C6)
-     *   res:
-     *     R3=Y0, R2=Y4
-     */
-    A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || I0+= 4       || R1.L=W[I1++];
-    R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++];
-
-    LSETUP (.0, .1) LC0 = P2; // perform 8 1d idcts
-
-    P2 = 112 (X);
-    P1 = P1 + P2;           // P1 points to element (7, 0) of temp buffer.
-    P2 = -94(X);
-
-.0:
-       /*
-        *   A1 =      Y2 * cos(3pi/8)
-        *   A0 =      Y2 * cos(pi/8)
-        *   A1 = A1 - Y6 * cos(pi/8)
-        *   A0 = A0 + Y6 * cos(3pi/8)
-        *      R5 = (Y1,Y7)
-        *      R7 = (C1,C7)
-        *   res:
-        *      R1=Y2, R0=Y6
-        */
-        A1=R7.L*R1.H,       A0=R7.H*R1.H (IS)        || I0+=4        || R5.H=W[I0];
-        R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS)  || R5.L=W[I1--] || R7=[I3++];
-        /*
-        *   Y0 = Y0 + Y6.
-        *   Y4 = Y4 + Y2.
-        *   Y2 = Y4 - Y2.
-        *   Y6 = Y0 - Y6.
-        *     R3 is saved
-        *     R6.l=Y3
-        * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6
-        */
-        R3=R3+R0, R0=R3-R0;
-        R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--];
-        /*
-         *  Compute the odd portion (1,3,5,7) even is done.
-         *
-         *  Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3.
-         *  Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3.
-         *  Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3.
-         *  Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3.
-         */
-        //  R5=(Y1,Y7)  R6=(Y5,Y3)                                                   // R7=(C1,C7)
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || [TMP1]=R2 || R6.H=W[I2--];
-        A1-=R7.H*R5.L,       A0+=R7.L*R5.L (IS)       || I0-=4     || R7=[I3++];
-        A1+=R7.H*R6.H,       A0+=R7.L*R6.H (IS)       || I0+=M1;                     // R7=(C3,C5)
-        R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS);
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || R4=[TMP0];
-        A1+=R7.H*R5.L,       A0-=R7.L*R5.L (IS)       || I1+=M1    || R7=[I3++];     // R7=(C1,C7)
-        A1+=R7.L*R6.H,       A0-=R7.H*R6.H (IS);
-        R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1;
-        // R3=Y1, R2=Y7, R7=Y5, R6=Y3
-
-        /* Transpose write column. */
-        R5.H=R4+R2 (RND12);                                   // Y0=Y0+Y7
-        R5.L=R4-R2 (RND12) || R4 = [TMP1];                    // Y7=Y7-Y0
-        R2.H=R1+R7 (RND12) || W[P0++P3]=R5.H;                 // Y2=Y2+Y5 st Y0
-        R2.L=R1-R7 (RND12) || W[P1++P4]=R5.L || R7=[I3++];    // Y5=Y2-Y5 st Y7
-        R5.H=R0-R3 (RND12) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2
-        R5.L=R0+R3 (RND12) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5
-        R3.H=R4-R6 (RND12) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1
-        R3.L=R4+R6 (RND12) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6
-
-        /* pipeline loop start, + drain Y3, Y4 */
-        A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || W[P0++P2]= R3.H || R1.H = W[I0--];
-.1:     R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++];
-
-
-
-    I0 = B2;                // I0 points to Input Element (0, 0)
-    I2 = B2;                // I2 points to Input Element (0, 0)
-    I2 += M3 || R0.H = W[I0];
-                            // Y0 is read in R0.H
-    I1 = I2;                // I1 points to input Element (0, 6)
-    I1 += 4  || R0.L = W[I2++];
-                            // I2 points to input Element (0, 4)
-                            // Y4 is read in R0.L
-    P2 = 8 (X);
-    I3 = B3;                // I3 points to Coefficients
-    P0 = B0;                // P0 points to array Element (0, 0) for writing
-                            // output
-    P1 = B0;
-    R7 = [I3++];            // R7.H = C4 and R7.L = C4
-    NOP;
-
-    /*
-     *   A1 =      Y0 * cos(pi/4)
-     *   A0 =      Y0 * cos(pi/4)
-     *   A1 = A1 + Y4 * cos(pi/4)
-     *   A0 = A0 - Y4 * cos(pi/4)
-     *   load:
-     *     R1=(Y2,Y6)
-     *     R7=(C2,C6)
-     *   res:
-     *     R3=Y0, R2=Y4
-     */
-    A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || I0+=4        || R1.L=W[I1++];
-    R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++];
-
-    LSETUP (.2, .3) LC0 = P2; // peform 8 1d idcts
-    P2 = 112 (X);
-    P1 = P1 + P2;
-    P2 = -94(X);
-
-.2:
-        /*
-         *   A1 =      Y2 * cos(3pi/8)
-         *   A0 =      Y2 * cos(pi/8)
-         *   A1 = A1 - Y6 * cos(pi/8)
-         *   A0 = A0 + Y6 * cos(3pi/8)
-         *      R5 = (Y1,Y7)
-         *      R7 = (C1,C7)
-         *   res:
-         *      R1=Y2, R0=Y6
-         */
-        A1=R7.L*R1.H,       A0=R7.H*R1.H (IS)        || I0+=4        || R5.H=W[I0];
-        R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS)  || R5.L=W[I1--] || R7=[I3++];
-        /*
-        *   Y0 = Y0 + Y6.
-        *   Y4 = Y4 + Y2.
-        *   Y2 = Y4 - Y2.
-        *   Y6 = Y0 - Y6.
-        *     R3 is saved
-        *     R6.l=Y3
-        * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6
-        */
-        R3=R3+R0, R0=R3-R0;
-        R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--];
-        /*
-         *  Compute the odd portion (1,3,5,7) even is done.
-         *
-         *  Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3.
-         *  Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3.
-         *  Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3.
-         *  Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3.
-         */
-        //  R5=(Y1,Y7)  R6=(Y5,Y3)                                                   // R7=(C1,C7)
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || [TMP1]=R2 || R6.H=W[I2--];
-        A1-=R7.H*R5.L,       A0+=R7.L*R5.L (IS)       || I0-=4     || R7=[I3++];
-        A1+=R7.H*R6.H,       A0+=R7.L*R6.H (IS)       || I0+=M1;                     // R7=(C3,C5)
-        R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS);
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || R4=[TMP0];
-        A1+=R7.H*R5.L,       A0-=R7.L*R5.L (IS)       || I1+=M1    || R7=[I3++];     // R7=(C1,C7)
-        A1+=R7.L*R6.H,       A0-=R7.H*R6.H (IS);
-        R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1;
-        // R3=Y1, R2=Y7, R7=Y5, R6=Y3
-
-        /* Transpose write column. */
-        R5.H=R4+R2 (RND20);                                   // Y0=Y0+Y7
-        R5.L=R4-R2 (RND20) || R4 = [TMP1];                    // Y7=Y7-Y0
-        R2.H=R1+R7 (RND20) || W[P0++P3]=R5.H;                 // Y2=Y2+Y5 st Y0
-        R2.L=R1-R7 (RND20) || W[P1++P4]=R5.L || R7=[I3++];    // Y5=Y2-Y5 st Y7
-        R5.H=R0-R3 (RND20) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2
-        R5.L=R0+R3 (RND20) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5
-        R3.H=R4-R6 (RND20) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1
-        R3.L=R4+R6 (RND20) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6
-
-        /* pipeline loop start, + drain Y3, Y4 */
-        A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || W[P0++P2]= R3.H || R1.H = W[I0--];
-.3:     R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++];
-
-    L3 = 0;
-    (R7:4,P5:3)=[SP++];
-    unlink;
-    RTS;
-DEFUN_END(idct)
-
-
diff --git a/libavcodec/bfin/mathops.h b/libavcodec/bfin/mathops.h
deleted file mode 100644
index a0e808c..0000000
--- a/libavcodec/bfin/mathops.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * simple math operations
- *
- * Copyright (C) 2007 Marc Hoffman <mmhoffm at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVCODEC_BFIN_MATHOPS_H
-#define AVCODEC_BFIN_MATHOPS_H
-
-#include "config.h"
-
-#if CONFIG_MPEGAUDIO_HP
-#define MULH(X,Y) ({ int xxo;                           \
-    __asm__ (                                               \
-        "a1 = %2.L * %1.L (FU);\n\t"                    \
-        "a1 = a1 >> 16;\n\t"                            \
-        "a1 += %2.H * %1.L (IS,M);\n\t"                 \
-        "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\
-        "a1 = a1 >>> 16;\n\t"                           \
-        "%0 = (a0 += a1);\n\t"                          \
-        : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
-#else
-#define MULH(X,Y) ({ int xxo;                           \
-    __asm__ (                                               \
-        "a1 = %2.H * %1.L (IS,M);\n\t"                  \
-        "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\
-        "a1 = a1 >>> 16;\n\t"                           \
-        "%0 = (a0 += a1);\n\t"                          \
-        : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
-#endif
-
-/* signed 16x16 -> 32 multiply */
-#define MUL16(a, b) ({ int xxo;                         \
-    __asm__ (                                               \
-       "%0 = %1.l*%2.l (is);\n\t"                       \
-       : "=W" (xxo) : "d" (a), "d" (b) : "A1");         \
-    xxo; })
-
-#endif /* AVCODEC_BFIN_MATHOPS_H */
diff --git a/libavcodec/bfin/mpegvideo_bfin.c b/libavcodec/bfin/mpegvideo_bfin.c
deleted file mode 100644
index 0373e22..0000000
--- a/libavcodec/bfin/mpegvideo_bfin.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * BlackFin MPEGVIDEO OPTIMIZATIONS
- *
- * Copyright (C) 2007 Marc Hoffman <mmh at pleasantst.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "dsputil_bfin.h"
-
-static int dct_quantize_bfin (MpegEncContext *s,
-                              DCTELEM *block, int n,
-                              int qscale, int *overflow)
-{
-    int last_non_zero, q, start_i;
-    const short *qmat;
-    short *bias;
-    const uint8_t *scantable= s->intra_scantable.scantable;
-    short dc;
-    int   max=0;
-
-    PROF("fdct",0);
-    s->dsp.fdct(block);
-    EPROF();
-
-    PROF("denoise",1);
-    if(s->dct_error_sum)
-        s->denoise_dct(s, block);
-    EPROF();
-
-    PROF("quant-init",2);
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                q = s->y_dc_scale;
-            else
-                q = s->c_dc_scale;
-            q = q << 3;
-        } else
-            /* For AIC we skip quant/dequant of INTRADC */
-            q = 1 << 3;
-
-        /* note: block[0] is assumed to be positive */
-        dc = block[0] = (block[0] + (q >> 1)) / q;
-        start_i = 1;
-        last_non_zero = 0;
-        bias = s->q_intra_matrix16[qscale][1];
-        qmat = s->q_intra_matrix16[qscale][0];
-
-    } else {
-        start_i = 0;
-        last_non_zero = -1;
-        bias = s->q_inter_matrix16[qscale][1];
-        qmat = s->q_inter_matrix16[qscale][0];
-
-    }
-    EPROF();
-
-    PROF("quantize",4);
-
-    /*  for(i=start_i; i<64; i++) {                           */
-    /*      sign     = (block[i]>>15)|1;                      */
-    /*      level    = ((abs(block[i])+bias[0])*qmat[i])>>16; */
-    /*      if (level < 0) level = 0;                         */
-    /*      max     |= level;                                 */
-    /*      level    = level * sign;                          */
-    /*      block[i] = level;                                 */
-    /*  } */
-
-    __asm__ volatile
-        ("i2=%1;\n\t"
-         "r1=[%1++];                                                         \n\t"
-         "r0=r1>>>15 (v);                                                    \n\t"
-         "lsetup (0f,1f) lc0=%3;                                             \n\t"
-         "0:   r0=r0|%4;                                                     \n\t"
-         "     r1=abs r1 (v)                                    || r2=[%2++];\n\t"
-         "     r1=r1+|+%5;                                                   \n\t"
-         "     r1=max(r1,%6) (v);                                            \n\t"
-         "     r1.h=(a1 =r1.h*r2.h), r1.l=(a0 =r1.l*r2.l) (tfu);             \n\t"
-         "     %0=%0|r1;                                                     \n\t"
-         "     r0.h=(a1 =r1.h*r0.h), r0.l=(a0 =r1.l*r0.l) (is)  || r1=[%1++];\n\t"
-         "1:   r0=r1>>>15 (v)                                   || [i2++]=r0;\n\t"
-         "r1=%0>>16;                                                         \n\t"
-         "%0=%0|r1;                                                          \n\t"
-         "%0.h=0;                                                            \n\t"
-         : "=&d" (max)
-         : "b" (block), "b" (qmat), "a" (32), "d" (0x00010001), "d" (bias[0]*0x10001), "d" (0)
-         : "R0","R1","R2", "I2");
-    if (start_i == 1) block[0] = dc;
-
-    EPROF();
-
-
-    PROF("zzscan",5);
-
-    __asm__ volatile
-        ("r0=b[%1--] (x);         \n\t"
-         "lsetup (0f,1f) lc0=%3;  \n\t"     /*    for(i=63; i>=start_i; i--) { */
-         "0: p0=r0;               \n\t"     /*        j = scantable[i];        */
-         "   p0=%2+(p0<<1);       \n\t"     /*        if (block[j]) {          */
-         "   r0=w[p0];            \n\t"     /*           last_non_zero = i;    */
-         "   cc=r0==0;            \n\t"     /*           break;                */
-         "   if !cc jump 2f;      \n\t"     /*        }                        */
-         "1: r0=b[%1--] (x);      \n\t"     /*    }                            */
-         "   %0=%4;               \n\t"
-         "   jump 3f;             \n\t"
-         "2: %0=lc0;              \n\t"
-         "3:\n\t"
-
-         : "=d" (last_non_zero)
-         : "a" (scantable+63), "a" (block), "a" (63), "d" (last_non_zero)
-         : "P0","R0");
-
-    EPROF();
-
-    *overflow= s->max_qcoeff < max; //overflow might have happened
-
-    bfprof();
-
-    /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */
-    if (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM)
-        ff_block_permute(block, s->dsp.idct_permutation, scantable, last_non_zero);
-
-    return last_non_zero;
-}
-
-void MPV_common_init_bfin (MpegEncContext *s)
-{
-/*     s->dct_quantize= dct_quantize_bfin; */
-}
-
diff --git a/libavcodec/bfin/pixels_bfin.S b/libavcodec/bfin/pixels_bfin.S
deleted file mode 100644
index 69b493b..0000000
--- a/libavcodec/bfin/pixels_bfin.S
+++ /dev/null
@@ -1,741 +0,0 @@
-/*
- * Blackfin Pixel Operations
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "config_bfin.h"
-
-DEFUN(put_pixels_clamped,mL1,
-        (DCTELEM *block, uint8_t *dest, int line_size)):
-    [--SP] = (R7:4);
-    R4 = 0;
-    R5.l = 0x00ff;
-    R5.h = 0x00ff;
-    I0 = R0;         // block
-    I1 = R1;         // dest
-    R2 += -4;        // line_size
-    M1 = R2;
-    P0 = 8;
-    R0 = [I0++];
-    R1 = [I0++];
-    R2 = MAX(R0, R4) (V);
-    LSETUP (ppc$0,ppc$1) LC0=P0;
-ppc$0: R2 = MIN(R2, R5) (V);
-       R3 = MAX(R1, R4) (V);
-       R3 = MIN(R3, R5) (V)      || R0 = [I0++];
-       R6 = BYTEPACK (R2,R3)     || R1 = [I0++];
-       R2 = MAX(R0, R4) (V)      || [I1++] = R6;
-       R2 = MIN(R2, R5) (V);
-       R3 = MAX(R1, R4) (V);
-       R3 = MIN(R3, R5) (V)      || R0 = [I0++];
-       R6 = BYTEPACK (R2,R3)     || R1 = [I0++];
-ppc$1: R2 = Max(R0, R4) (V)      || [I1++M1] = R6;
-
-    (R7:4) = [SP++];
-    RTS;
-DEFUN_END(put_pixels_clamped)
-
-DEFUN(add_pixels_clamped,mL1,
-        (DCTELEM *block, uint8_t *dest, int line_size)):
-    [-- SP] = (R7:4);
-    R4 = 0;
-    I0 = 0;
-    R2 += -4;        // line_size
-    M0 = R2;
-    I1 = R1;         // dest
-    I3 = R0;         // block
-    I2 = R1;         // dest
-    P0 = 8;
-    M3 = 2;
-    R0 = [I3++]  || R2 = [I1];
-    R2 = R2 << 8                      || R0.H = W[I3--]  || R3 = [I1++];
-    R3 = R3 >> 8                      || R1.L = W[I3]    || I3 += 4;
-    R6 = BYTEOP3P(R1:0, R3:2) (LO)    || R1.H = W[I3++]  || R2 = [I1];
-
-    LSETUP(apc$2,apc$3) LC1 = P0;
-apc$2: R7 = BYTEOP3P(R1:0, R3:2) (HI, R) || R0 = [I3++]     || R3 = [I1++M0];
-       R2 = R2 << 8                      || R0.H = W[I3--];
-       R3 = R3 >> 8                      || R1.L = W[I3]    || I3 += 4;
-       R6 = R6 + R7 (S)                  || R1.H = W[I3];
-       R6 = BYTEOP3P(R1:0, R3:2) (LO)    || I3+=M3          || [I2++]=R6;
-       R7 = BYTEOP3P(R1:0, R3:2) (HI, R) || R0 = [I3++]     || R2 = [I1];
-       R2 = R2 << 8                      || R0.H = W[I3--]  || R3 = [I1++];
-       R3 = R3 >> 8                      || R1.L = W[I3]    || I3 += 4;
-       R6 = R6 + R7 (S)                  || R1.H = W[I3++];
-apc$3: R6 = BYTEOP3P(R1:0, R3:2) (LO)    || [I2++M0] = R6   || R2 = [I1];
-
-    (R7:4) = [SP++];
-    RTS;
-DEFUN_END(add_pixels_clamped)
-
-
-/*
-  motion compensation
-  primitives
-
-     * Halfpel motion compensation with rounding (a+b+1)>>1.
-     * This is an array[4][4] of motion compensation funcions for 4
-     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
-     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
-     * @param block destination where the result is stored
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-
-*/
-
-DEFUN(put_pixels8uc,mL1,
-        (uint8_t *block, const uint8_t *s0, const uint8_t *s1,
-                 int dest_size, int line_size, int h)):
-        i3=r0;        // dest
-        i0=r1;        // src0
-        i1=r2;        // src1
-        r0=[sp+12];   // dest_size
-        r2=[sp+16];   // line_size
-        p0=[sp+20];   // h
-        [--sp] = (r7:6);
-        r0+=-4;
-        m3=r0;
-        r2+=-8;
-        m0=r2;
-        LSETUP(pp8$0,pp8$1) LC0=P0;
-        DISALGNEXCPT                || R0 = [I0++]  || R2  =[I1++];
-
-pp8$0:  DISALGNEXCPT                || R1 = [I0++]  || R3  =[I1++];
-        R6 = BYTEOP1P(R1:0,R3:2)    || R0 = [I0++M0]|| R2  =[I1++M0];
-        R7 = BYTEOP1P(R1:0,R3:2)(R) || R0 = [I0++]  || [I3++] = R6 ;
-pp8$1:  DISALGNEXCPT                || R2 = [I1++]  || [I3++M3] = R7;
-
-        (r7:6) = [sp++];
-        RTS;
-DEFUN_END(put_pixels8uc)
-
-DEFUN(put_pixels16uc,mL1,
-        (uint8_t *block, const uint8_t *s0, const uint8_t *s1,
-                 int dest_size, int line_size, int h)):
-        link 0;
-        [--sp] = (r7:6);
-        i3=r0;        // dest
-        i0=r1;        // src0
-        i1=r2;        // src1
-        r0=[fp+20];   // dest_size
-        r2=[fp+24];   // line_size
-        p0=[fp+28];   // h
-
-
-        r0+=-12;
-        m3=r0;        // line_size
-        r2+=-16;
-        m0=r2;
-
-        LSETUP(pp16$0,pp16$1) LC0=P0;
-         DISALGNEXCPT                || R0 = [I0++]   || R2  =[I1++];
-
-pp16$0:  DISALGNEXCPT                || R1 = [I0++]   || R3  =[I1++];
-         R6 = BYTEOP1P(R1:0,R3:2)    || R0 = [I0++]   || R2  =[I1++];
-         R7 = BYTEOP1P(R1:0,R3:2)(R) || R1 = [I0++]   || R3  =[I1++];
-         [I3++] = R6;
-         R6 = BYTEOP1P(R1:0,R3:2)    || R0 = [I0++M0] || R2  =[I1++M0];
-         R7 = BYTEOP1P(R1:0,R3:2)(R) || R0 = [I0++]   || [I3++] = R7 ;
-         [I3++] = R6;
-pp16$1:  DISALGNEXCPT                || R2 = [I1++]   || [I3++M3] = R7;
-
-        (r7:6) = [sp++];
-        unlink;
-        RTS;
-DEFUN_END(put_pixels16uc)
-
-
-
-
-
-
-DEFUN(put_pixels8uc_nornd,mL1,
-        (uint8_t *block, const uint8_t *s0, const uint8_t *s1,
-                 int line_size, int h)):
-        i3=r0;        // dest
-        i0=r1;        // src0
-        i1=r2;        // src1
-        r2=[sp+12];   // line_size
-        p0=[sp+16];   // h
-        [--sp] = (r7:6);
-        r2+=-4;
-        m3=r2;
-        r2+=-4;
-        m0=r2;
-        LSETUP(pp8$2,pp8$3) LC0=P0;
-        DISALGNEXCPT                || R0 = [I0++]  || R2  =[I1++];
-
-pp8$2:  DISALGNEXCPT                || R1 = [I0++]  || R3  =[I1++];
-        R6 = BYTEOP1P(R1:0,R3:2)(T)  || R0 = [I0++M0]|| R2  =[I1++M0];
-        R7 = BYTEOP1P(R1:0,R3:2)(T,R) || R0 = [I0++]  || [I3++] = R6 ;
-pp8$3:  DISALGNEXCPT                || R2 = [I1++]  || [I3++M3] = R7;
-
-        (r7:6) = [sp++];
-        RTS;
-DEFUN_END(put_pixels8uc_nornd)
-
-DEFUN(put_pixels16uc_nornd,mL1,
-        (uint8_t *block, const uint8_t *s0, const uint8_t *s1,
-                 int line_size, int h)):
-        i3=r0;        // dest
-        i0=r1;        // src0
-        i1=r2;        // src1
-        r2=[sp+12];   // line_size
-        p0=[sp+16];   // h
-
-        [--sp] = (r7:6);
-        r2+=-12;
-        m3=r2;        // line_size
-        r2+=-4;
-        m0=r2;
-
-        LSETUP(pp16$2,pp16$3) LC0=P0;
-        DISALGNEXCPT                || R0 = [I0++]   || R2  =[I1++];
-
-pp16$2:
-        DISALGNEXCPT                || R1 = [I0++]   || R3  =[I1++];
-        R6 = BYTEOP1P(R1:0,R3:2)(T)    || R0 = [I0++]   || R2  =[I1++];
-        R7 = BYTEOP1P(R1:0,R3:2)(T,R) || R1 = [I0++]   || R3  =[I1++];
-        [I3++] = R6;
-
-        R6 = BYTEOP1P(R1:0,R3:2)(T)    || R0 = [I0++M0] || R2  =[I1++M0];
-        R7 = BYTEOP1P(R1:0,R3:2)(T,R) || R0 = [I0++]   || [I3++] = R7 ;
-        [I3++] = R6;
-pp16$3: DISALGNEXCPT                || R2 = [I1++]   || [I3++M3] = R7;
-
-        (r7:6) = [sp++];
-
-        RTS;
-DEFUN_END(put_pixels16uc_nornd)
-
-DEFUN(z_put_pixels16_xy2,mL1,
-        (uint8_t *block, const uint8_t *s0,
-                 int dest_size, int line_size, int h)):
-        link 0;
-        [--sp] = (r7:4);
-        i3=r0;        // dest
-        i0=r1;        // src0--> pixels
-        i1=r1;        // src1--> pixels + line_size
-        r2+=-12;
-        m2=r2;        // m2=dest_width-4
-        r2=[fp+20];
-        m3=r2;        // line_size
-        p0=[fp+24];   // h
-        r2+=-16;
-        i1+=m3;       /* src1 + line_size */
-        m0=r2;        /* line-size - 20 */
-
-        B0 = I0;
-        B1 = I1;
-        B3 = I3;
-
-        DISALGNEXCPT                       || R0 = [I0++] || R2  =[I1++];
-
-        LSETUP(LS$16E,LE$16E) LC0=P0;
-LS$16E: DISALGNEXCPT                       || R1 = [I0++] || R3  =[I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (RNDL)   || R0 = [I0++] || R2  =[I1++];
-        R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R1 = [I0++] || [I3++] = R4 ;
-        DISALGNEXCPT                       || R3 = [I1++] || [I3++] = R5;
-        R4 = BYTEOP2P (R3:2,R1:0) (RNDL)   || R0 = [I0++M0]|| R2  = [I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R0 = [I0++] || [I3++] = R4 ;
-LE$16E: DISALGNEXCPT                       || R2 = [I1++] || [I3++M2] = R5;
-
-        M1 = 1;
-        I3 = B3;
-        I1 = B1;
-        I0 = B0;
-
-        I0 += M1;
-        I1 += M1;
-
-        DISALGNEXCPT                       || R0 = [I0++] || R2  =[I1++];
-        LSETUP(LS$16O,LE$16O) LC0=P0;
-LS$16O: DISALGNEXCPT                       || R1 = [I0++] || R3  =[I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (RNDH)   || R0 = [I0++] || R2  =[I1++];
-        R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R1 = [I0++] || R6  =[I3++];
-        R4 = R4 +|+ R6                       || R7 = [I3--];
-        R5 = R5 +|+ R7                       || [I3++] = R4;
-        DISALGNEXCPT                       || R3  =[I1++] || [I3++] = R5;
-        R4 = BYTEOP2P (R3:2,R1:0) (RNDH)   || R0 = [I0++M0]|| R2  = [I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R0 = [I0++] || R6 = [I3++];
-        R4 = R4 +|+ R6                       || R7 = [I3--];
-        R5 = R5 +|+ R7                       || [I3++] = R4;
-LE$16O: DISALGNEXCPT                       || R2 = [I1++] || [I3++M2] = R5;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(z_put_pixels16_xy2)
-
-DEFUN(put_pixels16_xy2_nornd,mL1,
-        (uint8_t *block, const uint8_t *s0,
-                 int line_size, int h)):
-        link 0;
-        [--sp] = (r7:4);
-        i3=r0;        // dest
-        i0=r1;        // src0--> pixels
-        i1=r1;        // src1--> pixels + line_size
-        m3=r2;
-        r2+=-12;
-        m2=r2;
-        r2+=-4;
-        i1+=m3;       /* src1 + line_size */
-        m0=r2;        /* line-size - 20 */
-        p0=[fp+20];   // h
-
-        B0=I0;
-        B1=I1;
-        B3=I3;
-
-        DISALGNEXCPT                       || R0 = [I0++] || R2  =[I1++];
-
-        LSETUP(LS$16ET,LE$16ET) LC0=P0;
-LS$16ET:DISALGNEXCPT                       || R1 = [I0++] || R3  =[I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (TL)     || R0 = [I0++] || R2  =[I1++];
-        R5 = BYTEOP2P (R3:2,R1:0) (TL,R)   || R1 = [I0++] || [I3++] = R4 ;
-        DISALGNEXCPT                       || R3 = [I1++] || [I3++] = R5;
-        R4 = BYTEOP2P (R3:2,R1:0) (TL)     || R0 = [I0++M0]|| R2  = [I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (TL,R)   || R0 = [I0++] || [I3++] = R4 ;
-LE$16ET:DISALGNEXCPT                       || R2 = [I1++] || [I3++M2] = R5;
-
-        M1 = 1;
-        I3=B3;
-        I1=B1;
-        I0=B0;
-
-        I0 += M1;
-        I1 += M1;
-
-        DISALGNEXCPT                       || R0 = [I0++] || R2  =[I1++];
-        LSETUP(LS$16OT,LE$16OT) LC0=P0;
-LS$16OT:DISALGNEXCPT                       || R1 = [I0++] || R3  =[I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (TH)     || R0 = [I0++] || R2  =[I1++];
-        R5 = BYTEOP2P (R3:2,R1:0) (TH,R)   || R1 = [I0++] || R6  =[I3++];
-        R4 = R4 +|+ R6                                    || R7 = [I3--];
-        R5 = R5 +|+ R7                                    || [I3++] = R4;
-        DISALGNEXCPT                       || R3  =[I1++] || [I3++] = R5;
-        R4 = BYTEOP2P (R3:2,R1:0) (TH)     || R0 = [I0++M0]|| R2  = [I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (TH,R)   || R0 = [I0++] || R6 = [I3++];
-        R4 = R4 +|+ R6                                    || R7 = [I3--];
-        R5 = R5 +|+ R7                                    || [I3++] = R4;
-LE$16OT:DISALGNEXCPT                       || R2 = [I1++] || [I3++M2] = R5;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(put_pixels16_xy2_nornd)
-
-DEFUN(z_put_pixels8_xy2,mL1,
-        (uint8_t *block, const uint8_t *s0,
-                 int dest_size, int line_size, int h)):
-        link 0;
-        [--sp] = (r7:4);
-        i3=r0;        // dest
-        i0=r1;        // src0--> pixels
-        i1=r1;        // src1--> pixels + line_size
-        r2+=-4;
-        m2=r2;        // m2=dest_width-4
-        r2=[fp+20];
-        m3=r2;        // line_size
-        p0=[fp+24];   // h
-        r2+=-8;
-        i1+=m3;       /* src1 + line_size */
-        m0=r2;        /* line-size - 20 */
-
-        b0 = I0;
-        b1 = I1;
-        b3 = I3;
-
-        LSETUP(LS$8E,LE$8E) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-LS$8E:  DISALGNEXCPT                       || R1 = [I0++]   || R3  =[I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (RNDL)   || R0 = [I0++M0] || R2  =[I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R0 = [I0++]   || [I3++] = R4 ;
-LE$8E:  DISALGNEXCPT                       || R2 = [I1++]   || [I3++M2] = R5;
-
-        M1 = 1;
-        I3 = b3;
-        I1 = b1;
-        I0 = b0;
-
-        I0 += M1;
-        I1 += M1;
-
-        LSETUP(LS$8O,LE$8O) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-LS$8O:  DISALGNEXCPT                       || R1 = [I0++]   || R3  =[I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (RNDH)   || R0 = [I0++M0] || R2  =[I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R0 = [I0++]   || R6  =[I3++];
-        R4 = R4 +|+ R6                                      || R7 = [I3--];
-        R5 = R5 +|+ R7                                      || [I3++] = R4;
-LE$8O:  DISALGNEXCPT                       || R2  =[I1++]   || [I3++M2] = R5;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(z_put_pixels8_xy2)
-
-DEFUN(put_pixels8_xy2_nornd,mL1,
-        (uint8_t *block, const uint8_t *s0, int line_size, int h)):
-        link 0;
-        [--sp] = (r7:4);
-        i3=r0;        // dest
-        i0=r1;        // src0--> pixels
-        i1=r1;        // src1--> pixels + line_size
-        m3=r2;
-        r2+=-4;
-        m2=r2;
-        r2+=-4;
-        i1+=m3;       /* src1 + line_size */
-        m0=r2;        /* line-size - 20 */
-        p0=[fp+20];   // h
-
-
-        b0 = I0;
-        b1 = I1;
-        b3 = I3;
-
-        LSETUP(LS$8ET,LE$8ET) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-
-LS$8ET: DISALGNEXCPT                       || R1 = [I0++]   || R3 = [I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (TL)     || R0 = [I0++M0] || R2 = [I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (TL,R)   || R0 = [I0++]   || [I3++] = R4 ;
-LE$8ET: DISALGNEXCPT                       || R2 = [I1++]   || [I3++M2] = R5;
-
-        M1 = 1;
-        I3 = b3;
-        I1 = b1;
-        I0 = b0;
-
-        I0 += M1;
-        I1 += M1;
-
-        LSETUP(LS$8OT,LE$8OT) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2 = [I1++];
-
-LS$8OT: DISALGNEXCPT                       || R1 = [I0++]   || R3 = [I1++];
-        R4 = BYTEOP2P (R3:2,R1:0) (TH)     || R0 = [I0++M0] || R2 = [I1++M0];
-        R5 = BYTEOP2P (R3:2,R1:0) (TH,R)   || R0 = [I0++]   || R6 = [I3++];
-        R4 = R4 +|+ R6                                      || R7 = [I3--];
-        R5 = R5 +|+ R7                                      || [I3++] = R4;
-LE$8OT: DISALGNEXCPT                       || R2  =[I1++]   || [I3++M2] = R5;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-
-DEFUN(diff_pixels,mL1,
-       (DCTELEM *block, uint8_t *s1, uint8_t *s2, int stride)):
-        link 0;
-        [--sp] = (r7:4);
-        p0=8;
-        i3=r0;        // block
-        i0=r1;        // s1
-        i1=r2;        // s2
-        r2=[fp+20];   // stride
-        r2+=-8;
-        m0=r2;
-
-
-        LSETUP(.LS0,.LE0) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-
-.LS0:   DISALGNEXCPT                       || R1 = [I0++]   || R3 = [I1++];
-        (R5,R4) = BYTEOP16M (R1:0,R3:2)    || R0 = [I0++M0] || R2 = [I1++M0];
-        (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R0 = [I0++]   || [I3++] = R4;
-        DISALGNEXCPT                       || R2 = [I1++]   || [I3++] = R5;
-        [i3++]=r6;
-.LE0:  [i3++]=r7;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(put_pixels8_xy2_nornd)
-
-/*
-    for (i = 0; i < 16; i++) {
-        for (j = 0; j < 16; j++) {
-          sum += pix[j];
-        }
-        pix += line_size;
-    }
-*/
-DEFUN(pix_sum,mL1,
-        (uint8_t *p, int stride)):
-        link 0;
-        [--sp] = (r7:4);
-        p0=8;
-        i0=r0;        // s1
-        i1=r0;
-        m1=r1;
-        r1=r1+r1;
-        r1+=-16;       // stride
-        m0=r1;
-        i1+=m1;
-
-        r6=0;
-
-        LSETUP(LS$PS,LE$PS) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-
-LS$PS:  DISALGNEXCPT                       || R1 = [I0++]   || R3 = [I1++];
-        (R5,R4) = BYTEOP16P (R3:2,R1:0)    || R0 = [I0++]   || R2 = [I1++];
-        r6=r6+|+r5;
-        r6=r6+|+r4;
-        (R5,R4) = BYTEOP16P (R3:2,R1:0) (R)|| R1 = [I0++]   || R3 = [I1++];
-        r6=r6+|+r5;
-        r6=r6+|+r4;
-        (R5,R4) = BYTEOP16P (R3:2,R1:0)    || R0 = [I0++m0] || R2 = [I1++m0];
-        r6=r6+|+r5;
-        r6=r6+|+r4;
-        (R5,R4) = BYTEOP16P (R3:2,R1:0) (R)|| R0 = [I0++]   || R2 = [I1++];
-        r6=r6+|+r5;
-LE$PS:  r6=r6+|+r4;
-        r0.l=r6.l+r6.h;
-        r0.h=0;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(pix_sum)
-
-
-DEFUN(get_pixels,mL1,
-        (DCTELEM *restrict block, const uint8_t *pixels, int line_size)):
-        [--sp] = (r7:4);
-        i3=r0;        // dest
-        i0=r1;        // src0
-        p0=8;
-        r2+=-8;
-        m0=r2;
-        LSETUP(gp8$0,gp8$1) LC0=P0;
-
-        DISALGNEXCPT                   || R0 = [I0++];
-        DISALGNEXCPT                   || R1 = [I0++];
-
-gp8$0:  (R7,R6) = byteunpack R1:0      || R0 = [I0++M0];
-        (R5,R4) = byteunpack R1:0 (R)  || R0 = [I0++]    || [I3++]=R6;
-        DISALGNEXCPT                   || R1 = [I0++]    || [I3++]=R7;
-        [I3++]=R4;
-gp8$1:  [I3++]=R5
-
-
-        (r7:4) = [sp++];
-        RTS;
-DEFUN_END(get_pixels)
-
-
-/* sad = sad16x16 (ubyte *mb, ubyte *refwin, srcwidth, refwinwidth, h) */
-/* 91 cycles */
-DEFUN(z_sad16x16,mL1,
-        (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h)):
-        link 0;
-        I0 = R0;
-        I1 = R1;
-
-        A1 = A0 = 0;
-        R0 = [sp+20]; // rwidth
-        P2 = [sp+24]; // height
-        R3 = 16;
-        R0 = R0 - R3;
-        R3 = R2 - R3;
-        M1 = R0;
-        M0 = R3;
-
-        DISALGNEXCPT         || R0 = [I0++]    || R2 = [I1++];
-        LSETUP (s$16, e$16) LC0=P2;
-s$16:   DISALGNEXCPT         || R1 = [I0++]    || R3 = [I1++];
-        SAA (R1:0,R3:2)      || R0 = [I0++]    || R2 = [I1++];
-        SAA (R1:0,R3:2) (R)  || R1 = [I0++]    || R3 = [I1++];
-        SAA (R1:0,R3:2)      || R0 = [I0++M0]  || R2 = [I1++M1];
-e$16:   SAA (R1:0,R3:2) (R)  || R0 = [I0++]    || R2 = [I1++];
-
-        R3=A1.L+A1.H,  R2=A0.L+A0.H ;
-        R0 = R2 + R3 ;
-        unlink;
-        RTS;
-DEFUN_END(z_sad16x16)
-
-/* sad = sad8x8 (ubyte *mb, ubyte *refwin, int srcwidth, int refwinwidth, int h) */
-/* 36 cycles */
-DEFUN(z_sad8x8,mL1,
-        (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h)):
-        I0 = R0;
-        I1 = R1;
-
-        A1 = A0 = 0;
-        r0 = [sp+12]; // rwidth
-        P2 = [sp+16]; //height
-        R3 = 8;
-        R0 = R0 - R3;
-        R3 = R2 - R3;
-        M0 = R3;
-        M1 = R0;
-
-        LSETUP (s$8, e$8) LC0=P2;
-        DISALGNEXCPT         || R0 = [I0++]   || R2 = [I1++];
-        DISALGNEXCPT         || R1 = [I0++]   || R3 = [I1++];
-s$8:    SAA (R1:0,R3:2)      || R0 = [I0++M0] || R2 = [I1++M1];
-        SAA (R1:0,R3:2) (R)  || R0 = [I0++]   || R2 = [I1++];
-e$8:    DISALGNEXCPT         || R1 = [I0++]   || R3 = [I1++];
-
-        R3=A1.L+A1.H,  R2=A0.L+A0.H ;
-        R0 = R2 + R3 ;
-        RTS;
-DEFUN_END(z_sad8x8)
-
-DEFUN(pix_norm1,mL1,
-        (uint8_t * pix, int line_size)):
-        [--SP]=(R7:4,P5:3);
-
-        // Fetch the input arguments.
-        P1 = R0;  // pix
-        P0 = R1;  // line_size
-        P5 = 16;  // loop ctr.
-        P0 -= P5;
-        M0 = P0;  // M0 = line_size-16;
-        // Now for the real work.
-        A1 = A0 = 0;
-        lsetup(_pix_norm1_blkfn_loopStart, _pix_norm1_blkfn_loopEnd) LC1 = P5;
-        I0 = P1;
-        DISALGNEXCPT || r0 = [i0++];
-
-_pix_norm1_blkfn_loopStart:
-        // following unpacks pix1[0..15] pix1+line_size[0..15]
-        DISALGNEXCPT || r1 = [i0++];
-
-        (r5, r4) = byteunpack r1:0 || r0 = [i0++];
-        a1 += r5.h * r5.h, a0 += r5.l * r5.l (is);
-        a1 += r4.h * r4.h, a0 += r4.l * r4.l (is);
-        (r5, r4) = byteunpack r1:0(r) || r1 = [i0++];
-        a1 += r5.h * r5.h, a0 += r5.l * r5.l (is);
-        a1 += r4.h * r4.h, a0 += r4.l * r4.l (is);
-        (r5, r4) = byteunpack r1:0 || r0 = [i0++M0];
-        a1 += r5.h * r5.h, a0 += r5.l * r5.l (is);
-        a1 += r4.h * r4.h, a0 += r4.l * r4.l (is);
-        (r5, r4) = byteunpack r1:0(r) || r0 = [i0++];
-        a1 += r5.h * r5.h, a0 += r5.l * r5.l (is);
-_pix_norm1_blkfn_loopEnd:
-        a1 += r4.h * r4.h, a0 += r4.l * r4.l (is);
-
-
-// Clean up at the end:
-        R2 = A0, R3 = A1;
-        R0 = R2 + R3 (S);
-
-        (R7:4,P5:3)=[SP++];
-
-        RTS;
-DEFUN_END(pix_norm1)
-
-DEFUN(sse4,mL1,
-        (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)):
-        link 0;
-        [--sp] = (r7:6);
-        p0=[fp+24];   // h
-        i0=r1;        // pix1
-        i1=r2;        // pix2
-        r2=[fp+20];   // line_size
-        r2+=-4;
-        m0=r2;
-
-        a0=a1=0;
-        LSETUP(.S40,.E40) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-
-.S40:   DISALGNEXCPT                       || R1 = [I0++M0] || R3 = [I1++M0];
-        (R7,R6) = BYTEOP16M (R1:0,R3:2);
-        a0 += r7.l * r7.l, a1 += r7.h * r7.h (is);
-.E40:   a0 += r6.l * r6.l, a1 += r6.h * r6.h (is);
-        a0 += a1;
-        r0 = a0;
-
-        (r7:6) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(sse4)
-
-DEFUN(sse8,mL1,
-        (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)):
-        link 0;
-        [--sp] = (r7:6);
-        p0=[fp+24];   // h
-        i0=r1;        // pix1
-        i1=r2;        // pix2
-        r2=[fp+20];   // line_size
-        r2+=-8;
-        m0=r2;
-
-        a0=a1=0;
-        LSETUP(.S80,.E80) LC0=P0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-
-.S80:   DISALGNEXCPT                       || R1 = [I0++]   || R3 = [I1++];
-        (R7,R6) = BYTEOP16M (R1:0,R3:2)    || R0 = [I0++M0] || R2 = [I1++M0];
-        a0 += r7.l * r7.l, a1 += r7.h * r7.h (is);
-        a0 += r6.l * r6.l, a1 += r6.h * r6.h (is);
-        (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R0 = [I0++]   || R2 = [I1++];
-        a0 += r7.l * r7.l, a1 += r7.h * r7.h (is);
-.E80:   a0 += r6.l * r6.l, a1 += r6.h * r6.h (is);
-        a0 += a1;
-        r0 = a0;
-
-        (r7:6) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(sse8)
-
-DEFUN(sse16,mL1,
-        (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)):
-        link 0;
-        [--sp] = (r7:6);
-        p0=[fp+24];   // h
-        i0=r1;        // pix1
-        i1=r2;        // pix2
-        r2=[fp+20];   // line_size
-        r2+=-16;
-        m0=r2;
-
-        a0=a1=0;
-        DISALGNEXCPT                       || R0 = [I0++]   || R2  =[I1++];
-        LSETUP(.S160,.E160) LC0=P0;
-
-.S160:  DISALGNEXCPT                       || R1 = [I0++]   || R3 = [I1++];
-        (R7,R6) = BYTEOP16M (R1:0,R3:2)    || R0 = [I0++]   || R2 = [I1++];
-        a0 += r7.l * r7.l, a1 += r7.h * r7.h (is);
-        a0 += r6.l * r6.l, a1 += r6.h * r6.h (is);
-        (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R1 = [I0++]   || R3 = [I1++];
-        a0 += r7.l * r7.l, a1 += r7.h * r7.h (is);
-        a0 += r6.l * r6.l, a1 += r6.h * r6.h (is);
-        (R7,R6) = BYTEOP16M (R1:0,R3:2)    || R0 = [I0++M0] || R2 = [I1++M0];
-        a0 += r7.l * r7.l, a1 += r7.h * r7.h (is);
-        a0 += r6.l * r6.l, a1 += r6.h * r6.h (is);
-        (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R0 = [I0++]   || R2 = [I1++];
-        a0 += r7.l * r7.l, a1 += r7.h * r7.h (is);
-.E160:  a0 += r6.l * r6.l, a1 += r6.h * r6.h (is);
-        a0 += a1;
-        r0 = a0;
-
-        (r7:6) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(sse16)
-
-
diff --git a/libavcodec/bfin/vp3_bfin.c b/libavcodec/bfin/vp3_bfin.c
deleted file mode 100644
index b010178..0000000
--- a/libavcodec/bfin/vp3_bfin.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_bfin.h"
-
-/* Intra iDCT offset 128 */
-void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block)
-{
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int i,j;
-
-    ff_bfin_vp3_idct (block);
-
-    for (i=0;i<8;i++)
-        for (j=0;j<8;j++)
-            dest[line_size*i+j]=cm[128+block[i*8+j]];
-}
-
-/* Inter iDCT */
-void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_bfin_vp3_idct (block);
-    ff_bfin_add_pixels_clamped (block, dest, line_size);
-}
-
-
diff --git a/libavcodec/bfin/vp3_idct_bfin.S b/libavcodec/bfin/vp3_idct_bfin.S
deleted file mode 100644
index 21f732c..0000000
--- a/libavcodec/bfin/vp3_idct_bfin.S
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * vp3_idct BlackFin
- *
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-/*
-   This blackfin DSP code implements an 8x8 inverse type II DCT.
-
-Prototype       : void ff_bfin_vp3_idct(DCTELEM *in)
-
-Registers Used  : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0.
-
-*/
-
-#include "config.h"
-#include "config_bfin.h"
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-.section .l1.data.B,"aw", at progbits
-#else
-.data
-#endif
-
-.align 4;
-coefs:
-.short 0x5a82;           //  C4
-.short 0x5a82;           //  C4
-.short 0x30FC;           //cos(3pi/8)  C6
-.short 0x7642;           //cos(pi/8)   C2
-.short 0x18F9;           //cos(7pi/16)
-.short 0x7D8A;           //cos(pi/16)
-.short 0x471D;           //cos(5pi/16)
-.short 0x6A6E;           //cos(3pi/16)
-.short 0x18F9;           //cos(7pi/16)
-.short 0x7D8A;           //cos(pi/16)
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-.section .l1.data.A
-#endif
-
-vtmp: .space 256
-
-#define TMP0 FP-8
-#define TMP1 FP-12
-#define TMP2 FP-16
-
-
-.text
-DEFUN(vp3_idct,mL1,
-        (DCTELEM *block)):
-
-/********************** Function Prologue *********************************/
-    link 16;
-    [--SP] = (R7:4, P5:3);   // Push the registers onto the stack.
-    B0 = R0;                 // Pointer to Input matrix
-    RELOC(R1, P3, coefs);    // Pointer to Coefficients
-    RELOC(R2, P3, vtmp);     // Pointer to Temporary matrix
-    B3 = R1;
-    B2 = R2;
-    L3 = 20;                // L3 is used for making the coefficient array
-                            // circular.
-                            // MUST BE RESTORED TO ZERO at function exit.
-    M1 = 16 (X);            // All these registers are initialized for
-    M3 = 8(X);              // modifying address offsets.
-
-    I0 = B0;                // I0 points to Input Element (0, 0).
-    I2 = B0;                // I2 points to Input Element (0, 0).
-    I2 += M3 || R0.H = W[I0];
-                            // Element 0 is read into R0.H
-    I1 = I2;                // I1 points to input Element (0, 6).
-    I1 += 4  || R0.L = W[I2++];
-                            // I2 points to input Element (0, 4).
-                            // Element 4 is read into R0.L.
-    P2 = 8 (X);
-    P3 = 32 (X);
-    P4 = -32 (X);
-    P5 = 98 (X);
-    R7 = 0x8000(Z);
-    I3 = B3;                // I3 points to Coefficients
-    P0 = B2;                // P0 points to array Element (0, 0) of temp
-    P1 = B2;
-    R7 = [I3++] || [TMP2]=R7;            // Coefficient C4 is read into R7.H and R7.L.
-    MNOP;
-    NOP;
-
-    /*
-     *   A1 =      Y0 * cos(pi/4)
-     *   A0 =      Y0 * cos(pi/4)
-     *   A1 = A1 + Y4 * cos(pi/4)
-     *   A0 = A0 - Y4 * cos(pi/4)
-     *   load:
-     *     R1=(Y2,Y6)
-     *     R7=(C2,C6)
-     *   res:
-     *     R3=Y0, R2=Y4
-     */
-    A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || I0+= 4       || R1.L=W[I1++];
-    R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++];
-
-    LSETUP (.0, .1) LC0 = P2; // perform 8 1d idcts
-
-    P2 = 112 (X);
-    P1 = P1 + P2;           // P1 points to element (7, 0) of temp buffer.
-    P2 = -94(X);
-
-.0:
-       /*
-        *   A1 =      Y2 * cos(3pi/8)
-        *   A0 =      Y2 * cos(pi/8)
-        *   A1 = A1 - Y6 * cos(pi/8)
-        *   A0 = A0 + Y6 * cos(3pi/8)
-        *      R5 = (Y1,Y7)
-        *      R7 = (C1,C7)
-        *   res:
-        *      R1=Y2, R0=Y6
-        */
-        A1=R7.L*R1.H,       A0=R7.H*R1.H (IS)        || I0+=4        || R5.H=W[I0];
-        R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS)  || R5.L=W[I1--] || R7=[I3++];
-        /*
-        *   Y0 = Y0 + Y6.
-        *   Y4 = Y4 + Y2.
-        *   Y2 = Y4 - Y2.
-        *   Y6 = Y0 - Y6.
-        *     R3 is saved
-        *     R6.l=Y3
-        * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6
-        */
-        R3=R3+R0, R0=R3-R0;
-        R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--];
-        /*
-         *  Compute the odd portion (1,3,5,7) even is done.
-         *
-         *  Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3.
-         *  Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3.
-         *  Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3.
-         *  Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3.
-         */
-        //  R5=(Y1,Y7)  R6=(Y5,Y3)                                                   // R7=(C1,C7)
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || [TMP1]=R2 || R6.H=W[I2--];
-        A1-=R7.H*R5.L,       A0+=R7.L*R5.L (IS)       || I0-=4     || R7=[I3++];
-        A1+=R7.H*R6.H,       A0+=R7.L*R6.H (IS)       || I0+=M1;                     // R7=(C3,C5)
-        R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS);
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || R4=[TMP0];
-        A1+=R7.H*R5.L,       A0-=R7.L*R5.L (IS)       || I1+=M1    || R7=[I3++];     // R7=(C1,C7)
-        A1+=R7.L*R6.H,       A0-=R7.H*R6.H (IS);
-        R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1;
-        // R3=Y1, R2=Y7, R7=Y5, R6=Y3
-
-        /* Transpose write column. */
-        R5.H=R4+R2 (RND12);                                   // Y0=Y0+Y7
-        R5.L=R4-R2 (RND12) || R4 = [TMP1];                    // Y7=Y7-Y0
-        R2.H=R1+R7 (RND12) || W[P0++P3]=R5.H;                 // Y2=Y2+Y5 st Y0
-        R2.L=R1-R7 (RND12) || W[P1++P4]=R5.L || R7=[I3++];    // Y5=Y2-Y5 st Y7
-        R5.H=R0-R3 (RND12) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2
-        R5.L=R0+R3 (RND12) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5
-        R3.H=R4-R6 (RND12) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1
-        R3.L=R4+R6 (RND12) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6
-
-        /* pipeline loop start, + drain Y3, Y4 */
-        A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || W[P0++P2]= R3.H || R1.H = W[I0--];
-.1:     R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++];
-
-
-
-    I0 = B2;                // I0 points to Input Element (0, 0)
-    I2 = B2;                // I2 points to Input Element (0, 0)
-    I2 += M3 || R0.H = W[I0];
-                            // Y0 is read in R0.H
-    I1 = I2;                // I1 points to input Element (0, 6)
-    I1 += 4  || R0.L = W[I2++];
-                            // I2 points to input Element (0, 4)
-                            // Y4 is read in R0.L
-    P2 = 8 (X);
-    I3 = B3;                // I3 points to Coefficients
-    P0 = B0;                // P0 points to array Element (0, 0) for writing
-                            // output
-    P1 = B0;
-    R7 = [I3++];            // R7.H = C4 and R7.L = C4
-    NOP;
-
-    /*
-     *   A1 =      Y0 * cos(pi/4)
-     *   A0 =      Y0 * cos(pi/4)
-     *   A1 = A1 + Y4 * cos(pi/4)
-     *   A0 = A0 - Y4 * cos(pi/4)
-     *   load:
-     *     R1=(Y2,Y6)
-     *     R7=(C2,C6)
-     *   res:
-     *     R3=Y0, R2=Y4
-     */
-    A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || I0+=4        || R1.L=W[I1++];
-    R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++];
-
-    LSETUP (.2, .3) LC0 = P2; // peform 8 1d idcts
-    P2 = 112 (X);
-    P1 = P1 + P2;
-    P2 = -94(X);
-
-.2:
-        /*
-         *   A1 =      Y2 * cos(3pi/8)
-         *   A0 =      Y2 * cos(pi/8)
-         *   A1 = A1 - Y6 * cos(pi/8)
-         *   A0 = A0 + Y6 * cos(3pi/8)
-         *      R5 = (Y1,Y7)
-         *      R7 = (C1,C7)
-         *   res:
-         *      R1=Y2, R0=Y6
-         */
-        A1=R7.L*R1.H,       A0=R7.H*R1.H (IS)        || I0+=4        || R5.H=W[I0];
-        R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS)  || R5.L=W[I1--] || R7=[I3++];
-        /*
-        *   Y0 = Y0 + Y6.
-        *   Y4 = Y4 + Y2.
-        *   Y2 = Y4 - Y2.
-        *   Y6 = Y0 - Y6.
-        *     R3 is saved
-        *     R6.l=Y3
-        * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6
-        */
-        R3=R3+R0, R0=R3-R0;
-        R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--];
-        /*
-         *  Compute the odd portion (1,3,5,7) even is done.
-         *
-         *  Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3.
-         *  Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3.
-         *  Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3.
-         *  Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3.
-         */
-        //  R5=(Y1,Y7)  R6=(Y5,Y3)                                                   // R7=(C1,C7)
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || [TMP1]=R2 || R6.H=W[I2--];
-        A1-=R7.H*R5.L,       A0+=R7.L*R5.L (IS)       || I0-=4     || R7=[I3++];
-        A1+=R7.H*R6.H,       A0+=R7.L*R6.H (IS)       || I0+=M1;                     // R7=(C3,C5)
-        R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS);
-        A1 =R7.L*R5.H,       A0 =R7.H*R5.H (IS)       || R4=[TMP0];
-        A1+=R7.H*R5.L,       A0-=R7.L*R5.L (IS)       || I1+=M1    || R7=[I3++];     // R7=(C1,C7)
-        A1+=R7.L*R6.H,       A0-=R7.H*R6.H (IS);
-        R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1;
-        // R3=Y1, R2=Y7, R7=Y5, R6=Y3
-
-        /* Transpose write column. */
-        R5.H=R4+R2 (RND20);                                   // Y0=Y0+Y7
-        R5.L=R4-R2 (RND20) || R4 = [TMP1];                    // Y7=Y7-Y0
-        R5=R5>>>2(v);
-        R2.H=R1+R7 (RND20) || W[P0++P3]=R5.H;                 // Y2=Y2+Y5 st Y0
-        R2.L=R1-R7 (RND20) || W[P1++P4]=R5.L || R7=[I3++];    // Y5=Y2-Y5 st Y7
-        R2=R2>>>2(v);
-        R5.H=R0-R3 (RND20) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2
-        R5.L=R0+R3 (RND20) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5
-        R5=R5>>>2(v);
-        R3.H=R4-R6 (RND20) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1
-        R3.L=R4+R6 (RND20) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6
-        R3=R3>>>2(v);
-        /* pipeline loop start, + drain Y3, Y4 */
-        A1=R7.H*R0.H,       A0=R7.H*R0.H (IS)       || W[P0++P2]= R3.H || R1.H = W[I0--];
-.3:     R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++];
-
-    L3 = 0;
-    (R7:4,P5:3)=[SP++];
-    unlink;
-    RTS;
-DEFUN_END(vp3_idct)
-
-
diff --git a/libavcodec/bgmc.c b/libavcodec/bgmc.c
deleted file mode 100644
index 86b807b..0000000
--- a/libavcodec/bgmc.c
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * Block Gilbert-Moore decoder
- * Copyright (c) 2010 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Block Gilbert-Moore decoder as used by MPEG-4 ALS
- * @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
- */
-
-
-#include "bgmc.h"
-
-
-#define FREQ_BITS  14                      // bits used by frequency counters
-#define VALUE_BITS 18                      // bits used to represent the values
-#define TOP_VALUE  ((1 << VALUE_BITS) - 1) // maximum value
-#define FIRST_QTR  (TOP_VALUE / 4 + 1)     // first quarter of values maximum value
-#define HALF       (2 * FIRST_QTR)         // first half of values maximum value
-#define THIRD_QTR  (3 * FIRST_QTR)         // third quarter of values maximum value
-
-#define LUT_BITS   (FREQ_BITS - 8)         // number of bits used to index lookup tables
-#define LUT_SIZE   (1 << LUT_BITS)         // size of the lookup tables
-#define LUT_BUFF   4                       // number of buffered lookup tables
-
-
-/** Cumulative frequency tables for block Gilbert-Moore coding.
- */
-static const uint16_t cf_tables_1[3][129] = {
-    {
-    16384, 16066, 15748, 15431, 15114, 14799, 14485, 14173, 13861, 13552,
-    13243, 12939, 12635, 12336, 12038, 11745, 11452, 11161, 10870, 10586,
-    10303, 10027,  9751,  9483,  9215,  8953,  8692,  8440,  8189,  7946,
-     7704,  7472,  7240,  7008,  6776,  6554,  6333,  6122,  5912,  5711,
-     5512,  5320,  5128,  4947,  4766,  4595,  4425,  4264,  4104,  3946,
-     3788,  3640,  3493,  3355,  3218,  3090,  2963,  2842,  2721,  2609,
-     2498,  2395,  2292,  2196,  2100,  2004,  1908,  1820,  1732,  1651,
-     1570,  1497,  1424,  1355,  1287,  1223,  1161,  1100,  1044,   988,
-      938,   888,   839,   790,   746,   702,   662,   623,   588,   553,
-      520,   488,   459,   431,   405,   380,   357,   334,   311,   288,
-      268,   248,   230,   213,   197,   182,   168,   154,   142,   130,
-      119,   108,    99,    90,    81,    72,    64,    56,    49,    42,
-       36,    30,    25,    20,    15,    11,     7,     3,     0
-   },
-   {
-    16384, 16080, 15776, 15473, 15170, 14868, 14567, 14268, 13970, 13674,
-    13378, 13086, 12794, 12505, 12218, 11936, 11654, 11373, 11092, 10818,
-    10544, 10276, 10008,  9749,  9490,  9236,  8982,  8737,  8492,  8256,
-     8020,  7792,  7564,  7336,  7108,  6888,  6669,  6459,  6249,  6050,
-     5852,  5660,  5468,  5286,  5104,  4931,  4760,  4598,  4436,  4275,
-     4115,  3965,  3816,  3674,  3534,  3403,  3272,  3147,  3023,  2907,
-     2792,  2684,  2577,  2476,  2375,  2274,  2173,  2079,  1986,  1897,
-     1810,  1724,  1645,  1567,  1493,  1419,  1351,  1284,  1222,  1161,
-     1105,  1050,   995,   941,   891,   842,   797,   753,   713,   673,
-      636,   599,   566,   533,   503,   473,   446,   419,   392,   365,
-      340,   316,   294,   272,   253,   234,   216,   199,   184,   169,
-      155,   142,   130,   118,   106,    95,    85,    75,    66,    57,
-       49,    41,    34,    27,    21,    15,    10,     5,     0
-   },
-   {
-    16384, 16092, 15801, 15510, 15219, 14930, 14641, 14355, 14069, 13785,
-    13501, 13219, 12938, 12661, 12384, 12112, 11841, 11571, 11301, 11037,
-    10773, 10514, 10256, 10005,  9754,  9508,  9263,  9025,  8787,  8557,
-     8327,  8103,  7879,  7655,  7431,  7215,  7000,  6792,  6585,  6387,
-     6190,  5998,  5807,  5625,  5445,  5272,  5100,  4937,  4774,  4613,
-     4452,  4301,  4150,  4007,  3865,  3731,  3597,  3469,  3341,  3218,
-     3099,  2981,  2869,  2758,  2652,  2546,  2440,  2334,  2234,  2134,
-     2041,  1949,  1864,  1779,  1699,  1620,  1547,  1474,  1407,  1340,
-     1278,  1217,  1157,  1097,  1043,   989,   940,   891,   846,   801,
-      759,   718,   680,   643,   609,   575,   543,   511,   479,   447,
-      418,   389,   363,   337,   314,   291,   270,   249,   230,   212,
-      195,   179,   164,   149,   135,   121,   108,    96,    85,    74,
-       64,    54,    45,    36,    28,    20,    13,     6,     0
-   }
-};
-
-
-static const uint16_t cf_tables_2[8][193] = {
-    {
-    16384, 16104, 15825, 15546, 15268, 14991, 14714, 14439, 14164, 13891,
-    13620, 13350, 13081, 12815, 12549, 12287, 12025, 11765, 11505, 11250,
-    10996, 10746, 10497, 10254, 10011,  9772,  9534,  9303,  9072,  8848,
-     8624,  8406,  8188,  7970,  7752,  7539,  7327,  7123,  6919,  6724,
-     6529,  6339,  6150,  5970,  5790,  5618,  5446,  5282,  5119,  4957,
-     4795,  4642,  4490,  4345,  4201,  4065,  3929,  3798,  3669,  3547,
-     3425,  3310,  3196,  3086,  2976,  2866,  2756,  2650,  2545,  2447,
-     2350,  2260,  2170,  2085,  2000,  1921,  1843,  1770,  1698,  1632,
-     1566,  1501,  1436,  1376,  1316,  1261,  1207,  1157,  1108,  1061,
-     1015,   973,   931,   893,   855,   819,   783,   747,   711,   677,
-      644,   614,   584,   557,   530,   505,   480,   458,   436,   416,
-      396,   378,   360,   343,   326,   310,   295,   281,   267,   255,
-      243,   232,   221,   211,   201,   192,   183,   174,   166,   158,
-      150,   142,   134,   126,   119,   112,   106,   100,    95,    90,
-       85,    80,    76,    72,    69,    66,    63,    60,    57,    54,
-       51,    48,    46,    44,    42,    40,    38,    36,    34,    33,
-       32,    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
-    },
-    {
-    16384, 16116, 15849, 15582, 15316, 15050, 14785, 14521, 14257, 13995,
-    13734, 13476, 13218, 12963, 12708, 12457, 12206, 11956, 11706, 11460,
-    11215, 10975, 10735, 10500, 10265, 10034,  9803,  9579,  9355,  9136,
-     8917,  8703,  8489,  8275,  8061,  7853,  7645,  7444,  7244,  7051,
-     6858,  6671,  6484,  6305,  6127,  5956,  5785,  5622,  5459,  5298,
-     5137,  4983,  4830,  4684,  4539,  4401,  4263,  4131,  3999,  3874,
-     3750,  3632,  3515,  3401,  3287,  3173,  3059,  2949,  2840,  2737,
-     2635,  2539,  2444,  2354,  2264,  2181,  2098,  2020,  1943,  1872,
-     1801,  1731,  1661,  1596,  1532,  1472,  1412,  1357,  1303,  1251,
-     1200,  1153,  1106,  1063,  1020,   979,   938,   897,   856,   818,
-      780,   746,   712,   681,   650,   621,   592,   566,   540,   517,
-      494,   473,   452,   431,   410,   391,   373,   356,   340,   325,
-      310,   296,   282,   270,   258,   247,   236,   225,   214,   203,
-      192,   182,   172,   162,   153,   144,   136,   128,   121,   114,
-      108,   102,    97,    92,    87,    82,    77,    73,    69,    65,
-       62,    59,    56,    53,    50,    47,    45,    43,    41,    39,
-       37,    35,    33,    31,    29,    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
-    },
-    {
-    16384, 16128, 15872, 15617, 15362, 15107, 14853, 14600, 14347, 14096,
-    13846, 13597, 13350, 13105, 12860, 12618, 12376, 12135, 11894, 11657,
-    11421, 11189, 10957, 10730, 10503, 10279, 10056,  9838,  9620,  9407,
-     9195,  8987,  8779,  8571,  8363,  8159,  7955,  7758,  7561,  7371,
-     7182,  6997,  6812,  6635,  6459,  6289,  6120,  5957,  5795,  5634,
-     5473,  5319,  5165,  5018,  4871,  4732,  4593,  4458,  4324,  4197,
-     4071,  3951,  3831,  3714,  3597,  3480,  3363,  3250,  3138,  3032,
-     2927,  2828,  2729,  2635,  2541,  2453,  2366,  2284,  2202,  2126,
-     2050,  1975,  1900,  1830,  1761,  1697,  1633,  1574,  1515,  1459,
-     1403,  1351,  1300,  1252,  1205,  1160,  1115,  1070,  1025,   982,
-      939,   899,   860,   824,   789,   756,   723,   693,   663,   636,
-      609,   584,   559,   535,   511,   489,   467,   447,   427,   409,
-      391,   374,   358,   343,   328,   313,   300,   287,   274,   261,
-      248,   235,   223,   211,   200,   189,   179,   169,   160,   151,
-      143,   135,   128,   121,   115,   109,   103,    97,    92,    87,
-       82,    77,    73,    69,    65,    61,    58,    55,    52,    49,
-       46,    43,    40,    37,    35,    33,    31,    29,    27,    25,
-       23,    21,    20,    19,    18,    17,    16,    15,    14,    13,
-       12,    11,    10,     9,     8,     7,     6,     5,     4,     3,
-        2,     1,     0
-    },
-    {
-    16384, 16139, 15894, 15649, 15405, 15162, 14919, 14677, 14435, 14195,
-    13955, 13717, 13479, 13243, 13008, 12775, 12542, 12310, 12079, 11851,
-    11623, 11399, 11176, 10956, 10737, 10521, 10305, 10094,  9883,  9677,
-     9471,  9268,  9065,  8862,  8659,  8459,  8260,  8067,  7874,  7688,
-     7502,  7321,  7140,  6965,  6790,  6621,  6452,  6290,  6128,  5968,
-     5808,  5655,  5503,  5356,  5209,  5069,  4929,  4794,  4660,  4532,
-     4404,  4282,  4160,  4041,  3922,  3803,  3684,  3568,  3452,  3343,
-     3234,  3131,  3029,  2931,  2833,  2741,  2649,  2563,  2477,  2396,
-     2316,  2236,  2157,  2083,  2009,  1940,  1871,  1807,  1743,  1683,
-     1623,  1567,  1511,  1459,  1407,  1357,  1307,  1257,  1207,  1159,
-     1111,  1067,  1023,   983,   943,   905,   868,   834,   800,   769,
-      738,   709,   681,   653,   625,   600,   575,   552,   529,   508,
-      487,   466,   447,   428,   410,   392,   376,   360,   344,   328,
-      313,   298,   283,   268,   255,   242,   230,   218,   207,   196,
-      186,   176,   167,   158,   150,   142,   135,   128,   121,   114,
-      108,   102,    97,    92,    87,    82,    78,    74,    70,    66,
-       62,    58,    54,    50,    47,    44,    41,    38,    35,    32,
-       30,    28,    26,    24,    22,    20,    18,    16,    14,    13,
-       12,    11,    10,     9,     8,     7,     6,     5,     4,     3,
-        2,     1,     0
-    },
-    {
-    16384, 16149, 15915, 15681, 15447, 15214, 14981, 14749, 14517, 14286,
-    14055, 13827, 13599, 13373, 13147, 12923, 12699, 12476, 12253, 12034,
-    11815, 11599, 11383, 11171, 10959, 10750, 10541, 10337, 10133,  9933,
-     9733,  9536,  9339,  9142,  8945,  8751,  8557,  8369,  8181,  7998,
-     7816,  7638,  7460,  7288,  7116,  6950,  6785,  6625,  6465,  6306,
-     6147,  5995,  5843,  5697,  5551,  5411,  5271,  5135,  5000,  4871,
-     4742,  4618,  4495,  4374,  4253,  4132,  4011,  3893,  3775,  3663,
-     3552,  3446,  3340,  3239,  3138,  3043,  2948,  2858,  2768,  2684,
-     2600,  2516,  2433,  2355,  2278,  2205,  2133,  2065,  1997,  1932,
-     1867,  1807,  1747,  1690,  1634,  1580,  1526,  1472,  1418,  1366,
-     1314,  1266,  1218,  1174,  1130,  1088,  1047,  1009,   971,   936,
-      901,   868,   836,   804,   772,   743,   714,   685,   658,   631,
-      606,   582,   559,   536,   515,   494,   475,   456,   437,   418,
-      399,   380,   362,   344,   328,   312,   297,   283,   270,   257,
-      245,   233,   222,   211,   201,   191,   181,   172,   163,   155,
-      147,   139,   132,   125,   119,   113,   107,   101,    96,    91,
-       86,    81,    76,    71,    66,    62,    58,    54,    50,    46,
-       43,    40,    37,    34,    31,    28,    26,    24,    22,    20,
-       18,    16,    14,    12,    10,     8,     6,     5,     4,     3,
-        2,     1,     0
-    },
-    {
-    16384, 16159, 15934, 15709, 15485, 15261, 15038, 14816, 14594, 14373,
-    14152, 13933, 13714, 13497, 13280, 13065, 12850, 12636, 12422, 12211,
-    12000, 11791, 11583, 11378, 11173, 10971, 10769, 10571, 10373, 10179,
-     9985,  9793,  9601,  9409,  9217,  9029,  8842,  8658,  8475,  8297,
-     8120,  7946,  7773,  7604,  7435,  7271,  7108,  6950,  6792,  6634,
-     6477,  6326,  6175,  6029,  5883,  5742,  5602,  5466,  5330,  5199,
-     5068,  4943,  4818,  4696,  4574,  4452,  4330,  4211,  4093,  3979,
-     3866,  3759,  3652,  3549,  3446,  3348,  3250,  3157,  3065,  2977,
-     2889,  2802,  2716,  2634,  2553,  2476,  2399,  2326,  2254,  2185,
-     2117,  2052,  1987,  1926,  1866,  1808,  1750,  1692,  1634,  1578,
-     1522,  1470,  1418,  1369,  1321,  1275,  1229,  1187,  1145,  1105,
-     1066,  1027,   991,   955,   919,   883,   850,   817,   786,   756,
-      728,   700,   674,   648,   624,   600,   578,   556,   534,   512,
-      490,   468,   447,   426,   407,   388,   371,   354,   338,   322,
-      307,   293,   280,   267,   255,   243,   231,   219,   209,   199,
-      189,   179,   170,   161,   153,   145,   138,   131,   124,   117,
-      111,   105,    99,    93,    87,    81,    76,    71,    66,    61,
-       57,    53,    49,    45,    42,    39,    36,    33,    30,    27,
-       24,    21,    19,    17,    15,    13,    11,     9,     7,     5,
-        3,     1,     0
-    },
-    {
-    16384, 16169, 15954, 15739, 15524, 15310, 15096, 14883, 14670, 14458,
-    14246, 14035, 13824, 13614, 13405, 13198, 12991, 12785, 12579, 12376,
-    12173, 11972, 11772, 11574, 11377, 11182, 10987, 10795, 10603, 10414,
-    10226, 10040,  9854,  9668,  9482,  9299,  9116,  8937,  8759,  8585,
-     8411,  8241,  8071,  7906,  7741,  7580,  7419,  7263,  7107,  6952,
-     6797,  6647,  6497,  6353,  6209,  6070,  5931,  5796,  5661,  5531,
-     5401,  5275,  5150,  5027,  4904,  4781,  4658,  4538,  4419,  4304,
-     4190,  4081,  3972,  3867,  3762,  3662,  3562,  3467,  3372,  3281,
-     3191,  3101,  3012,  2928,  2844,  2764,  2684,  2608,  2533,  2460,
-     2387,  2318,  2250,  2185,  2121,  2059,  1997,  1935,  1873,  1813,
-     1754,  1698,  1642,  1588,  1535,  1483,  1433,  1384,  1338,  1292,
-     1249,  1206,  1165,  1125,  1085,  1045,  1008,   971,   937,   903,
-      871,   840,   810,   780,   752,   724,   698,   672,   647,   622,
-      597,   572,   548,   524,   502,   480,   460,   440,   421,   403,
-      386,   369,   353,   337,   323,   309,   295,   281,   268,   255,
-      243,   231,   220,   209,   199,   189,   180,   171,   163,   155,
-      147,   139,   131,   123,   116,   109,   102,    95,    89,    83,
-       77,    72,    67,    62,    57,    52,    48,    44,    40,    36,
-       32,    28,    25,    22,    19,    16,    13,    10,     8,     6,
-        4,     2,     0
-    },
-    {
-    16384, 16177, 15970, 15764, 15558, 15353, 15148, 14944, 14740, 14537,
-    14334, 14132, 13930, 13729, 13529, 13330, 13131, 12933, 12735, 12539,
-    12343, 12150, 11957, 11766, 11576, 11388, 11200, 11015, 10830, 10647,
-    10465, 10285, 10105,  9925,  9745,  9568,  9391,  9218,  9045,  8876,
-     8707,  8541,  8375,  8213,  8051,  7894,  7737,  7583,  7429,  7277,
-     7125,  6977,  6830,  6687,  6544,  6406,  6268,  6133,  5998,  5868,
-     5738,  5612,  5487,  5364,  5241,  5118,  4995,  4875,  4755,  4640,
-     4525,  4414,  4304,  4198,  4092,  3990,  3888,  3790,  3693,  3600,
-     3507,  3415,  3323,  3235,  3147,  3064,  2981,  2902,  2823,  2746,
-     2670,  2594,  2522,  2450,  2382,  2314,  2248,  2182,  2116,  2050,
-     1987,  1924,  1864,  1804,  1748,  1692,  1638,  1585,  1534,  1484,
-     1437,  1390,  1346,  1302,  1258,  1215,  1174,  1133,  1095,  1057,
-     1021,   986,   952,   918,   887,   856,   827,   798,   770,   742,
-      714,   686,   659,   632,   607,   582,   559,   536,   514,   492,
-      472,   452,   433,   415,   398,   381,   364,   348,   333,   318,
-      304,   290,   277,   264,   252,   240,   229,   218,   208,   198,
-      188,   178,   168,   158,   149,   140,   132,   124,   116,   108,
-      101,    94,    87,    81,    75,    69,    64,    59,    54,    49,
-       44,    39,    35,    31,    27,    23,    19,    15,    12,     9,
-        6,     3,     0
-    }
-};
-
-
-static const uint16_t cf_tables_3[5][257] = {
-    {
-    16384, 16187, 15990, 15793, 15597, 15401, 15205, 15009, 14813, 14618,
-    14423, 14230, 14037, 13845, 13653, 13463, 13273, 13083, 12894, 12706,
-    12518, 12332, 12146, 11962, 11778, 11597, 11416, 11237, 11059, 10882,
-    10706, 10532, 10358, 10184, 10010,  9838,  9666,  9497,  9328,  9163,
-     8999,  8837,  8675,  8517,  8359,  8205,  8051,  7901,  7751,  7602,
-     7453,  7308,  7163,  7022,  6882,  6745,  6609,  6476,  6343,  6214,
-     6085,  5960,  5835,  5712,  5589,  5466,  5343,  5223,  5103,  4987,
-     4872,  4761,  4650,  4542,  4435,  4332,  4229,  4130,  4031,  3936,
-     3841,  3747,  3653,  3563,  3473,  3387,  3302,  3220,  3138,  3059,
-     2980,  2905,  2830,  2759,  2688,  2619,  2550,  2481,  2412,  2345,
-     2278,  2215,  2152,  2092,  2032,  1974,  1917,  1863,  1809,  1758,
-     1707,  1659,  1611,  1564,  1517,  1473,  1429,  1387,  1346,  1307,
-     1268,  1230,  1193,  1158,  1123,  1090,  1058,  1026,   994,   962,
-      930,   899,   869,   841,   813,   786,   760,   735,   710,   687,
-      664,   643,   622,   602,   582,   562,   543,   525,   507,   490,
-      473,   457,   442,   427,   412,   398,   385,   373,   361,   349,
-      337,   325,   313,   301,   290,   279,   269,   259,   249,   240,
-      231,   222,   214,   206,   199,   192,   185,   178,   171,   165,
-      159,   153,   148,   143,   138,   133,   128,   123,   119,   115,
-      111,   107,   103,    99,    95,    91,    87,    83,    80,    77,
-       74,    71,    68,    65,    63,    61,    59,    57,    55,    53,
-       51,    49,    47,    45,    43,    41,    40,    39,    38,    37,
-       36,    35,    34,    33,    32,    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
-    },
-    {
-    16384, 16195, 16006, 15817, 15629, 15441, 15253, 15065, 14878, 14692,
-    14506, 14321, 14136, 13952, 13768, 13585, 13402, 13219, 13037, 12857,
-    12677, 12499, 12321, 12144, 11967, 11792, 11617, 11444, 11271, 11100,
-    10930, 10762, 10594, 10426, 10258, 10091,  9925,  9761,  9598,  9438,
-     9278,  9120,  8963,  8809,  8655,  8504,  8354,  8207,  8060,  7914,
-     7769,  7627,  7485,  7347,  7209,  7074,  6939,  6807,  6676,  6548,
-     6420,  6296,  6172,  6050,  5928,  5806,  5684,  5564,  5444,  5328,
-     5212,  5100,  4988,  4879,  4771,  4667,  4563,  4462,  4362,  4265,
-     4169,  4073,  3978,  3886,  3795,  3707,  3619,  3535,  3451,  3369,
-     3288,  3210,  3133,  3059,  2985,  2913,  2841,  2769,  2697,  2627,
-     2557,  2490,  2424,  2360,  2297,  2237,  2177,  2119,  2062,  2007,
-     1953,  1901,  1849,  1798,  1748,  1700,  1652,  1607,  1562,  1519,
-     1476,  1435,  1394,  1355,  1317,  1281,  1245,  1210,  1175,  1140,
-     1105,  1071,  1037,  1005,   973,   943,   913,   885,   857,   830,
-      804,   779,   754,   731,   708,   685,   663,   642,   621,   601,
-      581,   563,   545,   528,   511,   495,   479,   463,   448,   433,
-      419,   405,   391,   377,   364,   351,   338,   326,   314,   302,
-      291,   280,   270,   260,   251,   242,   234,   226,   218,   210,
-      202,   195,   188,   181,   174,   168,   162,   156,   150,   144,
-      139,   134,   129,   124,   119,   114,   109,   104,   100,    96,
-       92,    88,    84,    80,    77,    74,    71,    68,    65,    62,
-       59,    56,    54,    52,    50,    48,    46,    44,    42,    40,
-       38,    36,    34,    33,    32,    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
-    },
-    {
-    16384, 16203, 16022, 15842, 15662, 15482, 15302, 15122, 14942, 14763,
-    14584, 14406, 14228, 14051, 13874, 13698, 13522, 13347, 13172, 12998,
-    12824, 12652, 12480, 12310, 12140, 11971, 11803, 11637, 11471, 11307,
-    11143, 10980, 10817, 10654, 10491, 10330, 10169, 10011,  9853,  9697,
-     9542,  9389,  9236,  9086,  8936,  8789,  8642,  8498,  8355,  8212,
-     8070,  7931,  7792,  7656,  7520,  7388,  7256,  7126,  6996,  6870,
-     6744,  6621,  6498,  6377,  6256,  6135,  6014,  5895,  5776,  5660,
-     5545,  5433,  5321,  5212,  5104,  4999,  4895,  4793,  4692,  4594,
-     4496,  4400,  4304,  4211,  4118,  4028,  3939,  3853,  3767,  3684,
-     3601,  3521,  3441,  3364,  3287,  3212,  3137,  3062,  2987,  2915,
-     2843,  2773,  2704,  2638,  2572,  2508,  2445,  2384,  2324,  2266,
-     2208,  2153,  2098,  2044,  1990,  1939,  1888,  1839,  1791,  1745,
-     1699,  1655,  1611,  1569,  1527,  1487,  1448,  1409,  1370,  1331,
-     1292,  1255,  1218,  1183,  1148,  1115,  1082,  1051,  1020,   990,
-      960,   932,   904,   878,   852,   826,   801,   777,   753,   731,
-      709,   687,   666,   645,   625,   605,   586,   567,   550,   533,
-      516,   499,   482,   465,   449,   433,   418,   403,   389,   375,
-      362,   349,   337,   325,   314,   303,   293,   283,   273,   263,
-      254,   245,   236,   227,   219,   211,   204,   197,   190,   183,
-      177,   171,   165,   159,   153,   147,   141,   135,   130,   125,
-      120,   115,   110,   105,   101,    97,    93,    89,    85,    81,
-       77,    74,    71,    68,    65,    62,    59,    56,    53,    51,
-       49,    47,    45,    43,    41,    39,    37,    35,    33,    31,
-       29,    27,    25,    23,    22,    21,    20,    19,    18,    17,
-       16,    15,    14,    13,    12,    11,    10,     9,     8,     7,
-        6,     5,     4,     3,     2,     1,     0
-    },
-    {
-    16384, 16210, 16036, 15863, 15690, 15517, 15344, 15172, 15000, 14828,
-    14656, 14485, 14314, 14145, 13976, 13808, 13640, 13472, 13304, 13137,
-    12970, 12804, 12639, 12475, 12312, 12149, 11987, 11827, 11667, 11508,
-    11349, 11192, 11035, 10878, 10721, 10565, 10410, 10257, 10104,  9953,
-     9802,  9654,  9506,  9359,  9213,  9070,  8927,  8787,  8647,  8508,
-     8369,  8233,  8097,  7964,  7831,  7700,  7570,  7442,  7315,  7190,
-     7065,  6943,  6821,  6701,  6581,  6461,  6341,  6223,  6105,  5990,
-     5876,  5764,  5653,  5545,  5437,  5331,  5226,  5124,  5022,  4924,
-     4826,  4729,  4632,  4538,  4444,  4353,  4262,  4174,  4087,  4002,
-     3917,  3835,  3753,  3674,  3595,  3518,  3441,  3364,  3287,  3212,
-     3138,  3066,  2995,  2926,  2858,  2792,  2726,  2662,  2599,  2538,
-     2478,  2420,  2362,  2305,  2249,  2195,  2141,  2089,  2037,  1988,
-     1939,  1891,  1844,  1799,  1754,  1711,  1668,  1626,  1584,  1542,
-     1500,  1459,  1418,  1380,  1342,  1305,  1269,  1234,  1199,  1166,
-     1133,  1102,  1071,  1041,  1012,   983,   954,   926,   899,   872,
-      847,   822,   798,   774,   751,   728,   707,   686,   666,   646,
-      627,   608,   589,   570,   552,   534,   517,   500,   484,   468,
-      453,   438,   424,   410,   397,   384,   372,   360,   348,   336,
-      325,   314,   303,   293,   283,   273,   264,   255,   246,   237,
-      229,   221,   213,   205,   197,   189,   181,   174,   167,   160,
-      154,   148,   142,   136,   131,   126,   121,   116,   111,   106,
-      101,    97,    93,    89,    85,    81,    77,    73,    70,    67,
-       64,    61,    58,    55,    52,    49,    46,    43,    40,    37,
-       35,    33,    31,    29,    27,    25,    23,    21,    19,    17,
-       16,    15,    14,    13,    12,    11,    10,     9,     8,     7,
-        6,     5,     4,     3,     2,     1,     0
-    },
-    {
-    16384, 16218, 16052, 15886, 15720, 15554, 15389, 15224, 15059, 14895,
-    14731, 14567, 14403, 14240, 14077, 13915, 13753, 13591, 13429, 13269,
-    13109, 12950, 12791, 12633, 12476, 12320, 12164, 12009, 11854, 11701,
-    11548, 11396, 11244, 11092, 10940, 10790, 10640, 10492, 10344, 10198,
-    10052,  9908,  9764,  9622,  9481,  9342,  9203,  9066,  8929,  8793,
-     8657,  8524,  8391,  8261,  8131,  8003,  7875,  7749,  7624,  7502,
-     7380,  7260,  7140,  7022,  6904,  6786,  6668,  6551,  6435,  6322,
-     6209,  6099,  5989,  5881,  5773,  5668,  5563,  5461,  5359,  5260,
-     5161,  5063,  4965,  4871,  4777,  4686,  4595,  4506,  4417,  4331,
-     4245,  4162,  4079,  3999,  3919,  3841,  3763,  3685,  3607,  3530,
-     3454,  3380,  3307,  3236,  3166,  3097,  3029,  2963,  2897,  2834,
-     2771,  2710,  2650,  2591,  2532,  2475,  2418,  2363,  2309,  2257,
-     2205,  2155,  2105,  2057,  2009,  1963,  1918,  1873,  1828,  1783,
-     1738,  1694,  1650,  1607,  1565,  1524,  1484,  1445,  1407,  1369,
-     1333,  1297,  1263,  1229,  1197,  1165,  1134,  1103,  1073,  1043,
-     1015,   987,   960,   933,   907,   882,   858,   834,   811,   788,
-      766,   744,   722,   700,   679,   658,   638,   618,   599,   581,
-      563,   545,   528,   511,   495,   480,   465,   451,   437,   423,
-      410,   397,   384,   372,   360,   348,   337,   326,   315,   305,
-      295,   285,   275,   265,   255,   245,   236,   227,   219,   211,
-      203,   195,   188,   181,   174,   167,   161,   155,   149,   143,
-      137,   131,   126,   121,   116,   111,   106,   101,    97,    93,
-       89,    85,    81,    77,    73,    69,    65,    61,    58,    55,
-       52,    49,    46,    43,    40,    37,    34,    32,    30,    28,
-       26,    24,    22,    20,    18,    16,    14,    12,    10,     8,
-        6,     5,     4,     3,     2,     1,     0
-    }
-};
-
-
-static const uint16_t * const cf_table[16] = {
-    cf_tables_1[0], cf_tables_1[1], cf_tables_1[2], cf_tables_2[0],
-    cf_tables_2[1], cf_tables_2[2], cf_tables_2[3], cf_tables_2[4],
-    cf_tables_2[5], cf_tables_2[6], cf_tables_2[7], cf_tables_3[0],
-    cf_tables_3[1], cf_tables_3[2], cf_tables_3[3], cf_tables_3[4]
-};
-
-
-/** Initializes a given lookup table using a given delta
- */
-static void bgmc_lut_fillp(uint8_t *lut, unsigned int *lut_status,
-                           unsigned int delta)
-{
-    unsigned int sx, i;
-
-    for (sx = 0; sx < 16; sx++)
-        for (i = 0; i < LUT_SIZE; i++) {
-            unsigned int target = (i + 1) << (FREQ_BITS - LUT_BITS);
-            unsigned int symbol = 1 << delta;
-
-            while (cf_table[sx][symbol] > target)
-                symbol += 1 << delta;
-
-            *lut++ = symbol >> delta;
-        }
-
-    *lut_status = delta;
-}
-
-
-/** Retunes the index of a suitable lookup table for a given delta
- */
-static uint8_t* bgmc_lut_getp(uint8_t *lut, unsigned int *lut_status,
-                              unsigned int delta)
-{
-    unsigned int i = av_clip(delta, 0, LUT_BUFF - 1);
-
-    lut += (i * LUT_SIZE) << 4;
-
-    if (lut_status[i] != delta)
-        bgmc_lut_fillp(lut, &lut_status[i], delta);
-
-    return lut;
-}
-
-
-/** Initializes the lookup table arrays
- */
-int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, unsigned int **cf_lut_status)
-{
-    *cf_lut        = av_malloc(sizeof(*cf_lut       ) * LUT_BUFF * 16 * LUT_SIZE);
-    *cf_lut_status = av_malloc(sizeof(*cf_lut_status) * LUT_BUFF);
-
-    if (!cf_lut || !cf_lut_status) {
-        ff_bgmc_end(cf_lut, cf_lut_status);
-        av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
-        return AVERROR(ENOMEM);
-    }
-
-    return 0;
-}
-
-
-/** Releases the lookup table arrays
- */
-void ff_bgmc_end(uint8_t **cf_lut, unsigned int **cf_lut_status)
-{
-    av_freep(cf_lut);
-    av_freep(cf_lut_status);
-}
-
-
-/** Initializes decoding and reads the first value
- */
-void ff_bgmc_decode_init(GetBitContext *gb,
-                      unsigned int *h, unsigned int *l, unsigned int *v)
-{
-    *h = TOP_VALUE;
-    *l = 0;
-    *v = get_bits_long(gb, VALUE_BITS);
-}
-
-
-/** Finish decoding
- */
-void ff_bgmc_decode_end(GetBitContext *gb)
-{
-    skip_bits_long(gb, -(VALUE_BITS - 2));
-}
-
-
-/** Reads and decodes a block Gilbert-Moore coded symbol
- */
-void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
-                 unsigned int delta, unsigned int sx,
-                 unsigned int *h, unsigned int *l, unsigned int *v,
-                 uint8_t *cf_lut, unsigned int *cf_lut_status)
-{
-    unsigned int i;
-    uint8_t *lut = bgmc_lut_getp(cf_lut, cf_lut_status, delta);
-
-    // read current state
-    unsigned int high   = *h;
-    unsigned int low    = *l;
-    unsigned int value  = *v;
-
-    lut += sx * LUT_SIZE;
-
-    // decode num samples
-    for (i = 0; i < num; i++) {
-        unsigned int range  = high - low + 1;
-        unsigned int target = (((value - low + 1) << FREQ_BITS) - 1) / range;
-        unsigned int symbol = lut[target >> (FREQ_BITS - LUT_BITS)] << delta;
-
-        while (cf_table[sx][symbol] > target)
-            symbol += 1 << delta;
-
-        symbol = (symbol >> delta) - 1;
-
-        high = low + ((range * cf_table[sx][(symbol    ) << delta] - (1 << FREQ_BITS)) >> FREQ_BITS);
-        low  = low + ((range * cf_table[sx][(symbol + 1) << delta]                   ) >> FREQ_BITS);
-
-        while (1) {
-            if (high >= HALF) {
-                if        (low >= HALF) {
-                    value -= HALF;
-                    low   -= HALF;
-                    high  -= HALF;
-                } else if (low >= FIRST_QTR && high < THIRD_QTR) {
-                    value -= FIRST_QTR;
-                    low   -= FIRST_QTR;
-                    high  -= FIRST_QTR;
-                } else break;
-            }
-
-            low   *= 2;
-            high   = 2 * high  + 1;
-            value  = 2 * value + get_bits1(gb);
-        }
-
-        *dst++ = symbol;
-    }
-
-    // save current state
-    *h = high;
-    *l = low;
-    *v = value;
-}
-
diff --git a/libavcodec/bgmc.h b/libavcodec/bgmc.h
deleted file mode 100644
index eab413b..0000000
--- a/libavcodec/bgmc.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Block Gilbert-Moore decoder
- * Copyright (c) 2010 Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Block Gilbert-Moore decoder header
- * @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com>
- */
-
-
-#ifndef AVCODEC_BGMC_H
-#define AVCODEC_BGMC_H
-
-
-#include "avcodec.h"
-#include "get_bits.h"
-
-
-int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, unsigned int **cf_lut_status);
-
-
-void ff_bgmc_end(uint8_t **cf_lut, unsigned int **cf_lut_status);
-
-
-void ff_bgmc_decode_init(GetBitContext *gb,
-                      unsigned int *h, unsigned int *l, unsigned int *v);
-
-
-void ff_bgmc_decode_end(GetBitContext *gb);
-
-
-void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst,
-                 unsigned int delta, unsigned int sx,
-                 unsigned int *h, unsigned int *l, unsigned int *v,
-                 uint8_t *cf_lut, unsigned int *cf_lut_status);
-
-
-#endif /* AVCODEC_BGMC_H */
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
deleted file mode 100644
index a988a34..0000000
--- a/libavcodec/bink.c
+++ /dev/null
@@ -1,1012 +0,0 @@
-/*
- * Bink video decoder
- * Copyright (c) 2009 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "binkdata.h"
-#include "mathops.h"
-
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-
-#define BINK_FLAG_ALPHA 0x00100000
-#define BINK_FLAG_GRAY  0x00020000
-
-static VLC bink_trees[16];
-
-/**
- * IDs for different data types used in Bink video codec
- */
-enum Sources {
-    BINK_SRC_BLOCK_TYPES = 0, ///< 8x8 block types
-    BINK_SRC_SUB_BLOCK_TYPES, ///< 16x16 block types (a subset of 8x8 block types)
-    BINK_SRC_COLORS,          ///< pixel values used for different block types
-    BINK_SRC_PATTERN,         ///< 8-bit values for 2-colour pattern fill
-    BINK_SRC_X_OFF,           ///< X components of motion value
-    BINK_SRC_Y_OFF,           ///< Y components of motion value
-    BINK_SRC_INTRA_DC,        ///< DC values for intrablocks with DCT
-    BINK_SRC_INTER_DC,        ///< DC values for interblocks with DCT
-    BINK_SRC_RUN,             ///< run lengths for special fill block
-
-    BINK_NB_SRC
-};
-
-/**
- * data needed to decode 4-bit Huffman-coded value
- */
-typedef struct Tree {
-    int     vlc_num;  ///< tree number (in bink_trees[])
-    uint8_t syms[16]; ///< leaf value to symbol mapping
-} Tree;
-
-#define GET_HUFF(gb, tree)  (tree).syms[get_vlc2(gb, bink_trees[(tree).vlc_num].table,\
-                                                 bink_trees[(tree).vlc_num].bits, 1)]
-
-/**
- * data structure used for decoding single Bink data type
- */
-typedef struct Bundle {
-    int     len;       ///< length of number of entries to decode (in bits)
-    Tree    tree;      ///< Huffman tree-related data
-    uint8_t *data;     ///< buffer for decoded symbols
-    uint8_t *data_end; ///< buffer end
-    uint8_t *cur_dec;  ///< pointer to the not yet decoded part of the buffer
-    uint8_t *cur_ptr;  ///< pointer to the data that is not read from buffer yet
-} Bundle;
-
-/*
- * Decoder context
- */
-typedef struct BinkContext {
-    AVCodecContext *avctx;
-    DSPContext     dsp;
-    AVFrame        pic, last;
-    int            version;              ///< internal Bink file version
-    int            has_alpha;
-    int            swap_planes;
-    ScanTable      scantable;            ///< permutated scantable for DCT coeffs decoding
-
-    Bundle         bundle[BINK_NB_SRC];  ///< bundles for decoding all data types
-    Tree           col_high[16];         ///< trees for decoding high nibble in "colours" data type
-    int            col_lastval;          ///< value of last decoded high nibble in "colours" data type
-} BinkContext;
-
-/**
- * Bink video block types
- */
-enum BlockTypes {
-    SKIP_BLOCK = 0, ///< skipped block
-    SCALED_BLOCK,   ///< block has size 16x16
-    MOTION_BLOCK,   ///< block is copied from previous frame with some offset
-    RUN_BLOCK,      ///< block is composed from runs of colours with custom scan order
-    RESIDUE_BLOCK,  ///< motion block with some difference added
-    INTRA_BLOCK,    ///< intra DCT block
-    FILL_BLOCK,     ///< block is filled with single colour
-    INTER_BLOCK,    ///< motion block with DCT applied to the difference
-    PATTERN_BLOCK,  ///< block is filled with two colours following custom pattern
-    RAW_BLOCK,      ///< uncoded 8x8 block
-};
-
-/**
- * Initializes length length in all bundles.
- *
- * @param c     decoder context
- * @param width plane width
- * @param bw    plane width in 8x8 blocks
- */
-static void init_lengths(BinkContext *c, int width, int bw)
-{
-    c->bundle[BINK_SRC_BLOCK_TYPES].len = av_log2((width >> 3) + 511) + 1;
-
-    c->bundle[BINK_SRC_SUB_BLOCK_TYPES].len = av_log2((width >> 4) + 511) + 1;
-
-    c->bundle[BINK_SRC_COLORS].len = av_log2((width >> 3)*64 + 511) + 1;
-
-    c->bundle[BINK_SRC_INTRA_DC].len =
-    c->bundle[BINK_SRC_INTER_DC].len =
-    c->bundle[BINK_SRC_X_OFF].len =
-    c->bundle[BINK_SRC_Y_OFF].len = av_log2((width >> 3) + 511) + 1;
-
-    c->bundle[BINK_SRC_PATTERN].len = av_log2((bw << 3) + 511) + 1;
-
-    c->bundle[BINK_SRC_RUN].len = av_log2((width >> 3)*48 + 511) + 1;
-}
-
-/**
- * Allocates memory for bundles.
- *
- * @param c decoder context
- */
-static av_cold void init_bundles(BinkContext *c)
-{
-    int bw, bh, blocks;
-    int i;
-
-    bw = (c->avctx->width  + 7) >> 3;
-    bh = (c->avctx->height + 7) >> 3;
-    blocks = bw * bh;
-
-    for (i = 0; i < BINK_NB_SRC; i++) {
-        c->bundle[i].data = av_malloc(blocks * 64);
-        c->bundle[i].data_end = c->bundle[i].data + blocks * 64;
-    }
-}
-
-/**
- * Frees memory used by bundles.
- *
- * @param c decoder context
- */
-static av_cold void free_bundles(BinkContext *c)
-{
-    int i;
-    for (i = 0; i < BINK_NB_SRC; i++)
-        av_freep(&c->bundle[i].data);
-}
-
-/**
- * Merges two consequent lists of equal size depending on bits read.
- *
- * @param gb   context for reading bits
- * @param dst  buffer where merged list will be written to
- * @param src  pointer to the head of the first list (the second lists starts at src+size)
- * @param size input lists size
- */
-static void merge(GetBitContext *gb, uint8_t *dst, uint8_t *src, int size)
-{
-    uint8_t *src2 = src + size;
-    int size2 = size;
-
-    do {
-        if (!get_bits1(gb)) {
-            *dst++ = *src++;
-            size--;
-        } else {
-            *dst++ = *src2++;
-            size2--;
-        }
-    } while (size && size2);
-
-    while (size--)
-        *dst++ = *src++;
-    while (size2--)
-        *dst++ = *src2++;
-}
-
-/**
- * Reads information about Huffman tree used to decode data.
- *
- * @param gb   context for reading bits
- * @param tree pointer for storing tree data
- */
-static void read_tree(GetBitContext *gb, Tree *tree)
-{
-    uint8_t tmp1[16], tmp2[16], *in = tmp1, *out = tmp2;
-    int i, t, len;
-
-    tree->vlc_num = get_bits(gb, 4);
-    if (!tree->vlc_num) {
-        for (i = 0; i < 16; i++)
-            tree->syms[i] = i;
-        return;
-    }
-    if (get_bits1(gb)) {
-        len = get_bits(gb, 3);
-        memset(tmp1, 0, sizeof(tmp1));
-        for (i = 0; i <= len; i++) {
-            tree->syms[i] = get_bits(gb, 4);
-            tmp1[tree->syms[i]] = 1;
-        }
-        for (i = 0; i < 16; i++)
-            if (!tmp1[i])
-                tree->syms[++len] = i;
-    } else {
-        len = get_bits(gb, 2);
-        for (i = 0; i < 16; i++)
-            in[i] = i;
-        for (i = 0; i <= len; i++) {
-            int size = 1 << i;
-            for (t = 0; t < 16; t += size << 1)
-                merge(gb, out + t, in + t, size);
-            FFSWAP(uint8_t*, in, out);
-        }
-        memcpy(tree->syms, in, 16);
-    }
-}
-
-/**
- * Prepares bundle for decoding data.
- *
- * @param gb          context for reading bits
- * @param c           decoder context
- * @param bundle_num  number of the bundle to initialize
- */
-static void read_bundle(GetBitContext *gb, BinkContext *c, int bundle_num)
-{
-    int i;
-
-    if (bundle_num == BINK_SRC_COLORS) {
-        for (i = 0; i < 16; i++)
-            read_tree(gb, &c->col_high[i]);
-        c->col_lastval = 0;
-    }
-    if (bundle_num != BINK_SRC_INTRA_DC && bundle_num != BINK_SRC_INTER_DC)
-        read_tree(gb, &c->bundle[bundle_num].tree);
-    c->bundle[bundle_num].cur_dec =
-    c->bundle[bundle_num].cur_ptr = c->bundle[bundle_num].data;
-}
-
-/**
- * common check before starting decoding bundle data
- *
- * @param gb context for reading bits
- * @param b  bundle
- * @param t  variable where number of elements to decode will be stored
- */
-#define CHECK_READ_VAL(gb, b, t) \
-    if (!b->cur_dec || (b->cur_dec > b->cur_ptr)) \
-        return 0; \
-    t = get_bits(gb, b->len); \
-    if (!t) { \
-        b->cur_dec = NULL; \
-        return 0; \
-    } \
-
-static int read_runs(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
-{
-    int t, v;
-    const uint8_t *dec_end;
-
-    CHECK_READ_VAL(gb, b, t);
-    dec_end = b->cur_dec + t;
-    if (dec_end > b->data_end) {
-        av_log(avctx, AV_LOG_ERROR, "Run value went out of bounds\n");
-        return -1;
-    }
-    if (get_bits1(gb)) {
-        v = get_bits(gb, 4);
-        memset(b->cur_dec, v, t);
-        b->cur_dec += t;
-    } else {
-        while (b->cur_dec < dec_end)
-            *b->cur_dec++ = GET_HUFF(gb, b->tree);
-    }
-    return 0;
-}
-
-static int read_motion_values(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
-{
-    int t, sign, v;
-    const uint8_t *dec_end;
-
-    CHECK_READ_VAL(gb, b, t);
-    dec_end = b->cur_dec + t;
-    if (dec_end > b->data_end) {
-        av_log(avctx, AV_LOG_ERROR, "Too many motion values\n");
-        return -1;
-    }
-    if (get_bits1(gb)) {
-        v = get_bits(gb, 4);
-        if (v) {
-            sign = -get_bits1(gb);
-            v = (v ^ sign) - sign;
-        }
-        memset(b->cur_dec, v, t);
-        b->cur_dec += t;
-    } else {
-        do {
-            v = GET_HUFF(gb, b->tree);
-            if (v) {
-                sign = -get_bits1(gb);
-                v = (v ^ sign) - sign;
-            }
-            *b->cur_dec++ = v;
-        } while (b->cur_dec < dec_end);
-    }
-    return 0;
-}
-
-const uint8_t bink_rlelens[4] = { 4, 8, 12, 32 };
-
-static int read_block_types(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
-{
-    int t, v;
-    int last = 0;
-    const uint8_t *dec_end;
-
-    CHECK_READ_VAL(gb, b, t);
-    dec_end = b->cur_dec + t;
-    if (dec_end > b->data_end) {
-        av_log(avctx, AV_LOG_ERROR, "Too many block type values\n");
-        return -1;
-    }
-    if (get_bits1(gb)) {
-        v = get_bits(gb, 4);
-        memset(b->cur_dec, v, t);
-        b->cur_dec += t;
-    } else {
-        do {
-            v = GET_HUFF(gb, b->tree);
-            if (v < 12) {
-                last = v;
-                *b->cur_dec++ = v;
-            } else {
-                int run = bink_rlelens[v - 12];
-
-                memset(b->cur_dec, last, run);
-                b->cur_dec += run;
-            }
-        } while (b->cur_dec < dec_end);
-    }
-    return 0;
-}
-
-static int read_patterns(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
-{
-    int t, v;
-    const uint8_t *dec_end;
-
-    CHECK_READ_VAL(gb, b, t);
-    dec_end = b->cur_dec + t;
-    if (dec_end > b->data_end) {
-        av_log(avctx, AV_LOG_ERROR, "Too many pattern values\n");
-        return -1;
-    }
-    while (b->cur_dec < dec_end) {
-        v  = GET_HUFF(gb, b->tree);
-        v |= GET_HUFF(gb, b->tree) << 4;
-        *b->cur_dec++ = v;
-    }
-
-    return 0;
-}
-
-static int read_colors(GetBitContext *gb, Bundle *b, BinkContext *c)
-{
-    int t, sign, v;
-    const uint8_t *dec_end;
-
-    CHECK_READ_VAL(gb, b, t);
-    dec_end = b->cur_dec + t;
-    if (dec_end > b->data_end) {
-        av_log(c->avctx, AV_LOG_ERROR, "Too many color values\n");
-        return -1;
-    }
-    if (get_bits1(gb)) {
-        c->col_lastval = GET_HUFF(gb, c->col_high[c->col_lastval]);
-        v = GET_HUFF(gb, b->tree);
-        v = (c->col_lastval << 4) | v;
-        if (c->version < 'i') {
-            sign = ((int8_t) v) >> 7;
-            v = ((v & 0x7F) ^ sign) - sign;
-            v += 0x80;
-        }
-        memset(b->cur_dec, v, t);
-        b->cur_dec += t;
-    } else {
-        while (b->cur_dec < dec_end) {
-            c->col_lastval = GET_HUFF(gb, c->col_high[c->col_lastval]);
-            v = GET_HUFF(gb, b->tree);
-            v = (c->col_lastval << 4) | v;
-            if (c->version < 'i') {
-                sign = ((int8_t) v) >> 7;
-                v = ((v & 0x7F) ^ sign) - sign;
-                v += 0x80;
-            }
-            *b->cur_dec++ = v;
-        }
-    }
-    return 0;
-}
-
-/** number of bits used to store first DC value in bundle */
-#define DC_START_BITS 11
-
-static int read_dcs(AVCodecContext *avctx, GetBitContext *gb, Bundle *b,
-                    int start_bits, int has_sign)
-{
-    int i, j, len, len2, bsize, sign, v, v2;
-    int16_t *dst = (int16_t*)b->cur_dec;
-
-    CHECK_READ_VAL(gb, b, len);
-    v = get_bits(gb, start_bits - has_sign);
-    if (v && has_sign) {
-        sign = -get_bits1(gb);
-        v = (v ^ sign) - sign;
-    }
-    *dst++ = v;
-    len--;
-    for (i = 0; i < len; i += 8) {
-        len2 = FFMIN(len - i, 8);
-        bsize = get_bits(gb, 4);
-        if (bsize) {
-            for (j = 0; j < len2; j++) {
-                v2 = get_bits(gb, bsize);
-                if (v2) {
-                    sign = -get_bits1(gb);
-                    v2 = (v2 ^ sign) - sign;
-                }
-                v += v2;
-                *dst++ = v;
-                if (v < -32768 || v > 32767) {
-                    av_log(avctx, AV_LOG_ERROR, "DC value went out of bounds: %d\n", v);
-                    return -1;
-                }
-            }
-        } else {
-            for (j = 0; j < len2; j++)
-                *dst++ = v;
-        }
-    }
-
-    b->cur_dec = (uint8_t*)dst;
-    return 0;
-}
-
-/**
- * Retrieves next value from bundle.
- *
- * @param c      decoder context
- * @param bundle bundle number
- */
-static inline int get_value(BinkContext *c, int bundle)
-{
-    int16_t ret;
-
-    if (bundle < BINK_SRC_X_OFF || bundle == BINK_SRC_RUN)
-        return *c->bundle[bundle].cur_ptr++;
-    if (bundle == BINK_SRC_X_OFF || bundle == BINK_SRC_Y_OFF)
-        return (int8_t)*c->bundle[bundle].cur_ptr++;
-    ret = *(int16_t*)c->bundle[bundle].cur_ptr;
-    c->bundle[bundle].cur_ptr += 2;
-    return ret;
-}
-
-/**
- * Reads 8x8 block of DCT coefficients.
- *
- * @param gb       context for reading bits
- * @param block    place for storing coefficients
- * @param scan     scan order table
- * @param is_intra tells what set of quantizer matrices to use
- * @return 0 for success, negative value in other cases
- */
-static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *scan,
-                           int is_intra)
-{
-    int coef_list[128];
-    int mode_list[128];
-    int i, t, mask, bits, ccoef, mode, sign;
-    int list_start = 64, list_end = 64, list_pos;
-    int coef_count = 0;
-    int coef_idx[64];
-    int quant_idx;
-    const uint32_t *quant;
-
-    coef_list[list_end] = 4;  mode_list[list_end++] = 0;
-    coef_list[list_end] = 24; mode_list[list_end++] = 0;
-    coef_list[list_end] = 44; mode_list[list_end++] = 0;
-    coef_list[list_end] = 1;  mode_list[list_end++] = 3;
-    coef_list[list_end] = 2;  mode_list[list_end++] = 3;
-    coef_list[list_end] = 3;  mode_list[list_end++] = 3;
-
-    bits = get_bits(gb, 4) - 1;
-    for (mask = 1 << bits; bits >= 0; mask >>= 1, bits--) {
-        list_pos = list_start;
-        while (list_pos < list_end) {
-            if (!(mode_list[list_pos] | coef_list[list_pos]) || !get_bits1(gb)) {
-                list_pos++;
-                continue;
-            }
-            ccoef = coef_list[list_pos];
-            mode  = mode_list[list_pos];
-            switch (mode) {
-            case 0:
-                coef_list[list_pos] = ccoef + 4;
-                mode_list[list_pos] = 1;
-            case 2:
-                if (mode == 2) {
-                    coef_list[list_pos]   = 0;
-                    mode_list[list_pos++] = 0;
-                }
-                for (i = 0; i < 4; i++, ccoef++) {
-                    if (get_bits1(gb)) {
-                        coef_list[--list_start] = ccoef;
-                        mode_list[  list_start] = 3;
-                    } else {
-                        int t;
-                        if (!bits) {
-                            t = 1 - (get_bits1(gb) << 1);
-                        } else {
-                            t = get_bits(gb, bits) | mask;
-                            sign = -get_bits1(gb);
-                            t = (t ^ sign) - sign;
-                        }
-                        block[scan[ccoef]] = t;
-                        coef_idx[coef_count++] = ccoef;
-                    }
-                }
-                break;
-            case 1:
-                mode_list[list_pos] = 2;
-                for (i = 0; i < 3; i++) {
-                    ccoef += 4;
-                    coef_list[list_end]   = ccoef;
-                    mode_list[list_end++] = 2;
-                }
-                break;
-            case 3:
-                if (!bits) {
-                    t = 1 - (get_bits1(gb) << 1);
-                } else {
-                    t = get_bits(gb, bits) | mask;
-                    sign = -get_bits1(gb);
-                    t = (t ^ sign) - sign;
-                }
-                block[scan[ccoef]] = t;
-                coef_idx[coef_count++] = ccoef;
-                coef_list[list_pos]   = 0;
-                mode_list[list_pos++] = 0;
-                break;
-            }
-        }
-    }
-
-    quant_idx = get_bits(gb, 4);
-    quant = is_intra ? bink_intra_quant[quant_idx]
-                     : bink_inter_quant[quant_idx];
-    block[0] = (block[0] * quant[0]) >> 11;
-    for (i = 0; i < coef_count; i++) {
-        int idx = coef_idx[i];
-        block[scan[idx]] = (block[scan[idx]] * quant[idx]) >> 11;
-    }
-
-    return 0;
-}
-
-/**
- * Reads 8x8 block with residue after motion compensation.
- *
- * @param gb          context for reading bits
- * @param block       place to store read data
- * @param masks_count number of masks to decode
- * @return 0 on success, negative value in other cases
- */
-static int read_residue(GetBitContext *gb, DCTELEM block[64], int masks_count)
-{
-    int coef_list[128];
-    int mode_list[128];
-    int i, sign, mask, ccoef, mode;
-    int list_start = 64, list_end = 64, list_pos;
-    int nz_coeff[64];
-    int nz_coeff_count = 0;
-
-    coef_list[list_end] =  4; mode_list[list_end++] = 0;
-    coef_list[list_end] = 24; mode_list[list_end++] = 0;
-    coef_list[list_end] = 44; mode_list[list_end++] = 0;
-    coef_list[list_end] =  0; mode_list[list_end++] = 2;
-
-    for (mask = 1 << get_bits(gb, 3); mask; mask >>= 1) {
-        for (i = 0; i < nz_coeff_count; i++) {
-            if (!get_bits1(gb))
-                continue;
-            if (block[nz_coeff[i]] < 0)
-                block[nz_coeff[i]] -= mask;
-            else
-                block[nz_coeff[i]] += mask;
-            masks_count--;
-            if (masks_count < 0)
-                return 0;
-        }
-        list_pos = list_start;
-        while (list_pos < list_end) {
-            if (!(coef_list[list_pos] | mode_list[list_pos]) || !get_bits1(gb)) {
-                list_pos++;
-                continue;
-            }
-            ccoef = coef_list[list_pos];
-            mode  = mode_list[list_pos];
-            switch (mode) {
-            case 0:
-                coef_list[list_pos] = ccoef + 4;
-                mode_list[list_pos] = 1;
-            case 2:
-                if (mode == 2) {
-                    coef_list[list_pos]   = 0;
-                    mode_list[list_pos++] = 0;
-                }
-                for (i = 0; i < 4; i++, ccoef++) {
-                    if (get_bits1(gb)) {
-                        coef_list[--list_start] = ccoef;
-                        mode_list[  list_start] = 3;
-                    } else {
-                        nz_coeff[nz_coeff_count++] = bink_scan[ccoef];
-                        sign = -get_bits1(gb);
-                        block[bink_scan[ccoef]] = (mask ^ sign) - sign;
-                        masks_count--;
-                        if (masks_count < 0)
-                            return 0;
-                    }
-                }
-                break;
-            case 1:
-                mode_list[list_pos] = 2;
-                for (i = 0; i < 3; i++) {
-                    ccoef += 4;
-                    coef_list[list_end]   = ccoef;
-                    mode_list[list_end++] = 2;
-                }
-                break;
-            case 3:
-                nz_coeff[nz_coeff_count++] = bink_scan[ccoef];
-                sign = -get_bits1(gb);
-                block[bink_scan[ccoef]] = (mask ^ sign) - sign;
-                coef_list[list_pos]   = 0;
-                mode_list[list_pos++] = 0;
-                masks_count--;
-                if (masks_count < 0)
-                    return 0;
-                break;
-            }
-        }
-    }
-
-    return 0;
-}
-
-static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx,
-                             int is_chroma)
-{
-    int blk;
-    int i, j, bx, by;
-    uint8_t *dst, *prev, *ref, *ref_start, *ref_end;
-    int v, col[2];
-    const uint8_t *scan;
-    int xoff, yoff;
-    DECLARE_ALIGNED(16, DCTELEM, block[64]);
-    DECLARE_ALIGNED(16, uint8_t, ublock[64]);
-    int coordmap[64];
-
-    const int stride = c->pic.linesize[plane_idx];
-    int bw = is_chroma ? (c->avctx->width  + 15) >> 4 : (c->avctx->width  + 7) >> 3;
-    int bh = is_chroma ? (c->avctx->height + 15) >> 4 : (c->avctx->height + 7) >> 3;
-    int width = c->avctx->width >> is_chroma;
-
-    init_lengths(c, FFMAX(width, 8), bw);
-    for (i = 0; i < BINK_NB_SRC; i++)
-        read_bundle(gb, c, i);
-
-    ref_start = c->last.data[plane_idx];
-    ref_end   = c->last.data[plane_idx]
-                + (bw - 1 + c->last.linesize[plane_idx] * (bh - 1)) * 8;
-
-    for (i = 0; i < 64; i++)
-        coordmap[i] = (i & 7) + (i >> 3) * stride;
-
-    for (by = 0; by < bh; by++) {
-        if (read_block_types(c->avctx, gb, &c->bundle[BINK_SRC_BLOCK_TYPES]) < 0)
-            return -1;
-        if (read_block_types(c->avctx, gb, &c->bundle[BINK_SRC_SUB_BLOCK_TYPES]) < 0)
-            return -1;
-        if (read_colors(gb, &c->bundle[BINK_SRC_COLORS], c) < 0)
-            return -1;
-        if (read_patterns(c->avctx, gb, &c->bundle[BINK_SRC_PATTERN]) < 0)
-            return -1;
-        if (read_motion_values(c->avctx, gb, &c->bundle[BINK_SRC_X_OFF]) < 0)
-            return -1;
-        if (read_motion_values(c->avctx, gb, &c->bundle[BINK_SRC_Y_OFF]) < 0)
-            return -1;
-        if (read_dcs(c->avctx, gb, &c->bundle[BINK_SRC_INTRA_DC], DC_START_BITS, 0) < 0)
-            return -1;
-        if (read_dcs(c->avctx, gb, &c->bundle[BINK_SRC_INTER_DC], DC_START_BITS, 1) < 0)
-            return -1;
-        if (read_runs(c->avctx, gb, &c->bundle[BINK_SRC_RUN]) < 0)
-            return -1;
-
-        if (by == bh)
-            break;
-        dst  = c->pic.data[plane_idx]  + 8*by*stride;
-        prev = c->last.data[plane_idx] + 8*by*stride;
-        for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) {
-            blk = get_value(c, BINK_SRC_BLOCK_TYPES);
-            // 16x16 block type on odd line means part of the already decoded block, so skip it
-            if ((by & 1) && blk == SCALED_BLOCK) {
-                bx++;
-                dst  += 8;
-                prev += 8;
-                continue;
-            }
-            switch (blk) {
-            case SKIP_BLOCK:
-                c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8);
-                break;
-            case SCALED_BLOCK:
-                blk = get_value(c, BINK_SRC_SUB_BLOCK_TYPES);
-                switch (blk) {
-                case RUN_BLOCK:
-                    scan = bink_patterns[get_bits(gb, 4)];
-                    i = 0;
-                    do {
-                        int run = get_value(c, BINK_SRC_RUN) + 1;
-
-                        i += run;
-                        if (i > 64) {
-                            av_log(c->avctx, AV_LOG_ERROR, "Run went out of bounds\n");
-                            return -1;
-                        }
-                        if (get_bits1(gb)) {
-                            v = get_value(c, BINK_SRC_COLORS);
-                            for (j = 0; j < run; j++)
-                                ublock[*scan++] = v;
-                        } else {
-                            for (j = 0; j < run; j++)
-                                ublock[*scan++] = get_value(c, BINK_SRC_COLORS);
-                        }
-                    } while (i < 63);
-                    if (i == 63)
-                        ublock[*scan++] = get_value(c, BINK_SRC_COLORS);
-                    break;
-                case INTRA_BLOCK:
-                    c->dsp.clear_block(block);
-                    block[0] = get_value(c, BINK_SRC_INTRA_DC);
-                    read_dct_coeffs(gb, block, c->scantable.permutated, 1);
-                    c->dsp.idct(block);
-                    c->dsp.put_pixels_nonclamped(block, ublock, 8);
-                    break;
-                case FILL_BLOCK:
-                    v = get_value(c, BINK_SRC_COLORS);
-                    c->dsp.fill_block_tab[0](dst, v, stride, 16);
-                    break;
-                case PATTERN_BLOCK:
-                    for (i = 0; i < 2; i++)
-                        col[i] = get_value(c, BINK_SRC_COLORS);
-                    for (j = 0; j < 8; j++) {
-                        v = get_value(c, BINK_SRC_PATTERN);
-                        for (i = 0; i < 8; i++, v >>= 1)
-                            ublock[i + j*8] = col[v & 1];
-                    }
-                    break;
-                case RAW_BLOCK:
-                    for (j = 0; j < 8; j++)
-                        for (i = 0; i < 8; i++)
-                            ublock[i + j*8] = get_value(c, BINK_SRC_COLORS);
-                    break;
-                default:
-                    av_log(c->avctx, AV_LOG_ERROR, "Incorrect 16x16 block type %d\n", blk);
-                    return -1;
-                }
-                if (blk != FILL_BLOCK)
-                c->dsp.scale_block(ublock, dst, stride);
-                bx++;
-                dst  += 8;
-                prev += 8;
-                break;
-            case MOTION_BLOCK:
-                xoff = get_value(c, BINK_SRC_X_OFF);
-                yoff = get_value(c, BINK_SRC_Y_OFF);
-                ref = prev + xoff + yoff * stride;
-                if (ref < ref_start || ref > ref_end) {
-                    av_log(c->avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n",
-                           bx*8 + xoff, by*8 + yoff);
-                    return -1;
-                }
-                c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
-                break;
-            case RUN_BLOCK:
-                scan = bink_patterns[get_bits(gb, 4)];
-                i = 0;
-                do {
-                    int run = get_value(c, BINK_SRC_RUN) + 1;
-
-                    i += run;
-                    if (i > 64) {
-                        av_log(c->avctx, AV_LOG_ERROR, "Run went out of bounds\n");
-                        return -1;
-                    }
-                    if (get_bits1(gb)) {
-                        v = get_value(c, BINK_SRC_COLORS);
-                        for (j = 0; j < run; j++)
-                            dst[coordmap[*scan++]] = v;
-                    } else {
-                        for (j = 0; j < run; j++)
-                            dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS);
-                    }
-                } while (i < 63);
-                if (i == 63)
-                    dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS);
-                break;
-            case RESIDUE_BLOCK:
-                xoff = get_value(c, BINK_SRC_X_OFF);
-                yoff = get_value(c, BINK_SRC_Y_OFF);
-                ref = prev + xoff + yoff * stride;
-                if (ref < ref_start || ref > ref_end) {
-                    av_log(c->avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n",
-                           bx*8 + xoff, by*8 + yoff);
-                    return -1;
-                }
-                c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
-                c->dsp.clear_block(block);
-                v = get_bits(gb, 7);
-                read_residue(gb, block, v);
-                c->dsp.add_pixels8(dst, block, stride);
-                break;
-            case INTRA_BLOCK:
-                c->dsp.clear_block(block);
-                block[0] = get_value(c, BINK_SRC_INTRA_DC);
-                read_dct_coeffs(gb, block, c->scantable.permutated, 1);
-                c->dsp.idct_put(dst, stride, block);
-                break;
-            case FILL_BLOCK:
-                v = get_value(c, BINK_SRC_COLORS);
-                c->dsp.fill_block_tab[1](dst, v, stride, 8);
-                break;
-            case INTER_BLOCK:
-                xoff = get_value(c, BINK_SRC_X_OFF);
-                yoff = get_value(c, BINK_SRC_Y_OFF);
-                ref = prev + xoff + yoff * stride;
-                c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
-                c->dsp.clear_block(block);
-                block[0] = get_value(c, BINK_SRC_INTER_DC);
-                read_dct_coeffs(gb, block, c->scantable.permutated, 0);
-                c->dsp.idct_add(dst, stride, block);
-                break;
-            case PATTERN_BLOCK:
-                for (i = 0; i < 2; i++)
-                    col[i] = get_value(c, BINK_SRC_COLORS);
-                for (i = 0; i < 8; i++) {
-                    v = get_value(c, BINK_SRC_PATTERN);
-                    for (j = 0; j < 8; j++, v >>= 1)
-                        dst[i*stride + j] = col[v & 1];
-                }
-                break;
-            case RAW_BLOCK:
-                for (i = 0; i < 8; i++)
-                    memcpy(dst + i*stride, c->bundle[BINK_SRC_COLORS].cur_ptr + i*8, 8);
-                c->bundle[BINK_SRC_COLORS].cur_ptr += 64;
-                break;
-            default:
-                av_log(c->avctx, AV_LOG_ERROR, "Unknown block type %d\n", blk);
-                return -1;
-            }
-        }
-    }
-    if (get_bits_count(gb) & 0x1F) //next plane data starts at 32-bit boundary
-        skip_bits_long(gb, 32 - (get_bits_count(gb) & 0x1F));
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt)
-{
-    BinkContext * const c = avctx->priv_data;
-    GetBitContext gb;
-    int plane, plane_idx;
-    int bits_count = pkt->size << 3;
-
-    if(c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    init_get_bits(&gb, pkt->data, bits_count);
-    if (c->has_alpha) {
-        if (c->version >= 'i')
-            skip_bits_long(&gb, 32);
-        if (bink_decode_plane(c, &gb, 3, 0) < 0)
-            return -1;
-    }
-    if (c->version >= 'i')
-        skip_bits_long(&gb, 32);
-
-    for (plane = 0; plane < 3; plane++) {
-        plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3);
-
-        if (bink_decode_plane(c, &gb, plane_idx, !!plane) < 0)
-            return -1;
-        if (get_bits_count(&gb) >= bits_count)
-            break;
-    }
-    emms_c();
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    FFSWAP(AVFrame, c->pic, c->last);
-
-    /* always report that the buffer was completely consumed */
-    return pkt->size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    BinkContext * const c = avctx->priv_data;
-    static VLC_TYPE table[16 * 128][2];
-    int i;
-    int flags;
-
-    c->version = avctx->codec_tag >> 24;
-    if (c->version < 'c') {
-        av_log(avctx, AV_LOG_ERROR, "Too old version '%c'\n", c->version);
-        return -1;
-    }
-    if (avctx->extradata_size < 4) {
-        av_log(avctx, AV_LOG_ERROR, "Extradata missing or too short\n");
-        return -1;
-    }
-    flags = AV_RL32(avctx->extradata);
-    c->has_alpha = flags & BINK_FLAG_ALPHA;
-    c->swap_planes = c->version >= 'h';
-    if (!bink_trees[15].table) {
-        for (i = 0; i < 16; i++) {
-            const int maxbits = bink_tree_lens[i][15];
-            bink_trees[i].table = table + i*128;
-            bink_trees[i].table_allocated = 1 << maxbits;
-            init_vlc(&bink_trees[i], maxbits, 16,
-                     bink_tree_lens[i], 1, 1,
-                     bink_tree_bits[i], 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-        }
-    }
-    c->avctx = avctx;
-
-    c->pic.data[0] = NULL;
-
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
-
-    avctx->pix_fmt = c->has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
-
-    avctx->idct_algo = FF_IDCT_BINK;
-    dsputil_init(&c->dsp, avctx);
-    ff_init_scantable(c->dsp.idct_permutation, &c->scantable, bink_scan);
-
-    init_bundles(c);
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    BinkContext * const c = avctx->priv_data;
-
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    if (c->last.data[0])
-        avctx->release_buffer(avctx, &c->last);
-
-    free_bundles(c);
-    return 0;
-}
-
-AVCodec bink_decoder = {
-    "binkvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_BINKVIDEO,
-    sizeof(BinkContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Bink video"),
-};
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
deleted file mode 100644
index 295b351..0000000
--- a/libavcodec/binkaudio.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Bink Audio decoder
- * Copyright (c) 2007-2010 Peter Ross (pross at xvid.org)
- * Copyright (c) 2009 Daniel Verkamp (daniel at drv.nu)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Bink Audio decoder
- *
- * Technical details here:
- *  http://wiki.multimedia.cx/index.php?title=Bink_Audio
- */
-
-#include "avcodec.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-
-extern const uint16_t ff_wma_critical_freqs[25];
-
-#define MAX_CHANNELS 2
-#define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11)
-
-typedef struct {
-    AVCodecContext *avctx;
-    GetBitContext gb;
-    DSPContext dsp;
-    int first;
-    int channels;
-    int frame_len;          ///< transform size (samples)
-    int overlap_len;        ///< overlap size (samples)
-    int block_size;
-    int num_bands;
-    unsigned int *bands;
-    float root;
-    DECLARE_ALIGNED(16, FFTSample, coeffs)[BINK_BLOCK_MAX_SIZE];
-    DECLARE_ALIGNED(16, short, previous)[BINK_BLOCK_MAX_SIZE / 16];  ///< coeffs from previous audio block
-    float *coeffs_ptr[MAX_CHANNELS]; ///< pointers to the coeffs arrays for float_to_int16_interleave
-    union {
-        RDFTContext rdft;
-        DCTContext dct;
-    } trans;
-} BinkAudioContext;
-
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    BinkAudioContext *s = avctx->priv_data;
-    int sample_rate = avctx->sample_rate;
-    int sample_rate_half;
-    int i;
-    int frame_len_bits;
-
-    s->avctx = avctx;
-    dsputil_init(&s->dsp, avctx);
-
-    /* determine frame length */
-    if (avctx->sample_rate < 22050) {
-        frame_len_bits = 9;
-    } else if (avctx->sample_rate < 44100) {
-        frame_len_bits = 10;
-    } else {
-        frame_len_bits = 11;
-    }
-    s->frame_len = 1 << frame_len_bits;
-
-    if (s->channels > MAX_CHANNELS) {
-        av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
-        return -1;
-    }
-
-    if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) {
-        // audio is already interleaved for the RDFT format variant
-        sample_rate  *= avctx->channels;
-        s->frame_len *= avctx->channels;
-        s->channels = 1;
-        if (avctx->channels == 2)
-            frame_len_bits++;
-    } else {
-        s->channels = avctx->channels;
-    }
-
-    s->overlap_len   = s->frame_len / 16;
-    s->block_size    = (s->frame_len - s->overlap_len) * s->channels;
-    sample_rate_half = (sample_rate + 1) / 2;
-    s->root          = 2.0 / sqrt(s->frame_len);
-
-    /* calculate number of bands */
-    for (s->num_bands = 1; s->num_bands < 25; s->num_bands++)
-        if (sample_rate_half <= ff_wma_critical_freqs[s->num_bands - 1])
-            break;
-
-    s->bands = av_malloc((s->num_bands + 1) * sizeof(*s->bands));
-    if (!s->bands)
-        return AVERROR(ENOMEM);
-
-    /* populate bands data */
-    s->bands[0] = 1;
-    for (i = 1; i < s->num_bands; i++)
-        s->bands[i] = ff_wma_critical_freqs[i - 1] * (s->frame_len / 2) / sample_rate_half;
-    s->bands[s->num_bands] = s->frame_len / 2;
-
-    s->first = 1;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    for (i = 0; i < s->channels; i++)
-        s->coeffs_ptr[i] = s->coeffs + i * s->frame_len;
-
-    if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT)
-        ff_rdft_init(&s->trans.rdft, frame_len_bits, DFT_C2R);
-    else if (CONFIG_BINKAUDIO_DCT_DECODER)
-        ff_dct_init(&s->trans.dct, frame_len_bits, DCT_III);
-    else
-        return -1;
-
-    return 0;
-}
-
-static float get_float(GetBitContext *gb)
-{
-    int power = get_bits(gb, 5);
-    float f = ldexpf(get_bits_long(gb, 23), power - 23);
-    if (get_bits1(gb))
-        f = -f;
-    return f;
-}
-
-static const uint8_t rle_length_tab[16] = {
-    2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
-};
-
-/**
- * Decode Bink Audio block
- * @param[out] out Output buffer (must contain s->block_size elements)
- */
-static void decode_block(BinkAudioContext *s, short *out, int use_dct)
-{
-    int ch, i, j, k;
-    float q, quant[25];
-    int width, coeff;
-    GetBitContext *gb = &s->gb;
-
-    if (use_dct)
-        skip_bits(gb, 2);
-
-    for (ch = 0; ch < s->channels; ch++) {
-        FFTSample *coeffs = s->coeffs_ptr[ch];
-        q = 0.0f;
-        coeffs[0] = get_float(gb) * s->root;
-        coeffs[1] = get_float(gb) * s->root;
-
-        for (i = 0; i < s->num_bands; i++) {
-            /* constant is result of 0.066399999/log10(M_E) */
-            int value = get_bits(gb, 8);
-            quant[i] = expf(FFMIN(value, 95) * 0.15289164787221953823f) * s->root;
-        }
-
-        // find band (k)
-        for (k = 0; s->bands[k] < 1; k++) {
-            q = quant[k];
-        }
-
-        // parse coefficients
-        i = 2;
-        while (i < s->frame_len) {
-            if (get_bits1(gb)) {
-                j = i + rle_length_tab[get_bits(gb, 4)] * 8;
-            } else {
-                j = i + 8;
-            }
-
-            j = FFMIN(j, s->frame_len);
-
-            width = get_bits(gb, 4);
-            if (width == 0) {
-                memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
-                i = j;
-                while (s->bands[k] * 2 < i)
-                    q = quant[k++];
-            } else {
-                while (i < j) {
-                    if (s->bands[k] * 2 == i)
-                        q = quant[k++];
-                    coeff = get_bits(gb, width);
-                    if (coeff) {
-                        if (get_bits1(gb))
-                            coeffs[i] = -q * coeff;
-                        else
-                            coeffs[i] =  q * coeff;
-                    } else {
-                        coeffs[i] = 0.0f;
-                    }
-                    i++;
-                }
-            }
-        }
-
-        if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {
-            coeffs[0] /= 0.5;
-            ff_dct_calc (&s->trans.dct,  coeffs);
-            s->dsp.vector_fmul_scalar(coeffs, coeffs, s->frame_len / 2, s->frame_len);
-        }
-        else if (CONFIG_BINKAUDIO_RDFT_DECODER)
-            ff_rdft_calc(&s->trans.rdft, coeffs);
-    }
-
-    if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        for (i = 0; i < s->channels; i++)
-            for (j = 0; j < s->frame_len; j++)
-                s->coeffs_ptr[i][j] = 385.0 + s->coeffs_ptr[i][j]*(1.0/32767.0);
-    }
-    s->dsp.float_to_int16_interleave(out, (const float **)s->coeffs_ptr, s->frame_len, s->channels);
-
-    if (!s->first) {
-        int count = s->overlap_len * s->channels;
-        int shift = av_log2(count);
-        for (i = 0; i < count; i++) {
-            out[i] = (s->previous[i] * (count - i) + out[i] * i) >> shift;
-        }
-    }
-
-    memcpy(s->previous, out + s->block_size,
-           s->overlap_len * s->channels * sizeof(*out));
-
-    s->first = 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    BinkAudioContext * s = avctx->priv_data;
-    av_freep(&s->bands);
-    if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT)
-        ff_rdft_end(&s->trans.rdft);
-    else if (CONFIG_BINKAUDIO_DCT_DECODER)
-        ff_dct_end(&s->trans.dct);
-    return 0;
-}
-
-static void get_bits_align32(GetBitContext *s)
-{
-    int n = (-get_bits_count(s)) & 31;
-    if (n) skip_bits(s, n);
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    BinkAudioContext *s = avctx->priv_data;
-    const uint8_t *buf  = avpkt->data;
-    int buf_size        = avpkt->size;
-    short *samples      = data;
-    short *samples_end  = (short*)((uint8_t*)data + *data_size);
-    int reported_size;
-    GetBitContext *gb = &s->gb;
-
-    init_get_bits(gb, buf, buf_size * 8);
-
-    reported_size = get_bits_long(gb, 32);
-    while (get_bits_count(gb) / 8 < buf_size &&
-           samples + s->block_size <= samples_end) {
-        decode_block(s, samples, avctx->codec->id == CODEC_ID_BINKAUDIO_DCT);
-        samples += s->block_size;
-        get_bits_align32(gb);
-    }
-
-    *data_size = FFMIN(reported_size, (uint8_t*)samples - (uint8_t*)data);
-    return buf_size;
-}
-
-AVCodec binkaudio_rdft_decoder = {
-    "binkaudio_rdft",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_BINKAUDIO_RDFT,
-    sizeof(BinkAudioContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)")
-};
-
-AVCodec binkaudio_dct_decoder = {
-    "binkaudio_dct",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_BINKAUDIO_DCT,
-    sizeof(BinkAudioContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)")
-};
diff --git a/libavcodec/binkdata.h b/libavcodec/binkdata.h
deleted file mode 100644
index 1ca34a6..0000000
--- a/libavcodec/binkdata.h
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * Bink video decoder
- * Copyright (C) 2009 Kostya Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_BINKDATA_H
-#define AVCODEC_BINKDATA_H
-
-#include <stdint.h>
-
-/** Bink DCT and residue 8x8 block scan order */
-static const uint8_t bink_scan[64] = {
-     0,  1,  8,  9,  2,  3, 10, 11,
-     4,  5, 12, 13,  6,  7, 14, 15,
-    20, 21, 28, 29, 22, 23, 30, 31,
-    16, 17, 24, 25, 32, 33, 40, 41,
-    34, 35, 42, 43, 48, 49, 56, 57,
-    50, 51, 58, 59, 18, 19, 26, 27,
-    36, 37, 44, 45, 38, 39, 46, 47,
-    52, 53, 60, 61, 54, 55, 62, 63
-};
-
-static const uint8_t bink_tree_bits[16][16] = {
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-    },
-    {
-        0x00, 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D,
-        0x0F, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,
-    },
-    {
-        0x00, 0x02, 0x01, 0x09, 0x05, 0x15, 0x0D, 0x1D,
-        0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F,
-    },
-    {
-        0x00, 0x02, 0x06, 0x01, 0x09, 0x05, 0x0D, 0x1D,
-        0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F,
-    },
-    {
-        0x00, 0x04, 0x02, 0x06, 0x01, 0x09, 0x05, 0x0D,
-        0x03, 0x13, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F,
-    },
-    {
-        0x00, 0x04, 0x02, 0x0A, 0x06, 0x0E, 0x01, 0x09,
-        0x05, 0x0D, 0x03, 0x0B, 0x07, 0x17, 0x0F, 0x1F,
-    },
-    {
-        0x00, 0x02, 0x0A, 0x06, 0x0E, 0x01, 0x09, 0x05,
-        0x0D, 0x03, 0x0B, 0x1B, 0x07, 0x17, 0x0F, 0x1F,
-    },
-    {
-        0x00, 0x01, 0x05, 0x03, 0x13, 0x0B, 0x1B, 0x3B,
-        0x07, 0x27, 0x17, 0x37, 0x0F, 0x2F, 0x1F, 0x3F,
-    },
-    {
-        0x00, 0x01, 0x03, 0x13, 0x0B, 0x2B, 0x1B, 0x3B,
-        0x07, 0x27, 0x17, 0x37, 0x0F, 0x2F, 0x1F, 0x3F,
-    },
-    {
-        0x00, 0x01, 0x05, 0x0D, 0x03, 0x13, 0x0B, 0x1B,
-        0x07, 0x27, 0x17, 0x37, 0x0F, 0x2F, 0x1F, 0x3F,
-    },
-    {
-        0x00, 0x02, 0x01, 0x05, 0x0D, 0x03, 0x13, 0x0B,
-        0x1B, 0x07, 0x17, 0x37, 0x0F, 0x2F, 0x1F, 0x3F,
-    },
-    {
-        0x00, 0x01, 0x09, 0x05, 0x0D, 0x03, 0x13, 0x0B,
-        0x1B, 0x07, 0x17, 0x37, 0x0F, 0x2F, 0x1F, 0x3F,
-    },
-    {
-        0x00, 0x02, 0x01, 0x03, 0x13, 0x0B, 0x1B, 0x3B,
-        0x07, 0x27, 0x17, 0x37, 0x0F, 0x2F, 0x1F, 0x3F,
-    },
-    {
-        0x00, 0x01, 0x05, 0x03, 0x07, 0x27, 0x17, 0x37,
-        0x0F, 0x4F, 0x2F, 0x6F, 0x1F, 0x5F, 0x3F, 0x7F,
-    },
-    {
-        0x00, 0x01, 0x05, 0x03, 0x07, 0x17, 0x37, 0x77,
-        0x0F, 0x4F, 0x2F, 0x6F, 0x1F, 0x5F, 0x3F, 0x7F,
-    },
-    {
-        0x00, 0x02, 0x01, 0x05, 0x03, 0x07, 0x27, 0x17,
-        0x37, 0x0F, 0x2F, 0x6F, 0x1F, 0x5F, 0x3F, 0x7F,
-    },
-};
-
-static const uint8_t bink_tree_lens[16][16] = {
-    { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 },
-    { 1, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 },
-    { 2, 2, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 },
-    { 2, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 },
-    { 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5 },
-    { 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5 },
-    { 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5 },
-    { 1, 3, 3, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
-    { 1, 2, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
-    { 1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6 },
-    { 2, 2, 3, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 },
-    { 1, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 },
-    { 2, 2, 2, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
-    { 1, 3, 3, 3, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7 },
-    { 1, 3, 3, 3, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 },
-    { 2, 2, 3, 3, 3, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7 },
-};
-
-static const uint8_t bink_patterns[16][64] = {
-    {
-        0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,
-        0x39, 0x31, 0x29, 0x21, 0x19, 0x11, 0x09, 0x01,
-        0x02, 0x0A, 0x12, 0x1A, 0x22, 0x2A, 0x32, 0x3A,
-        0x3B, 0x33, 0x2B, 0x23, 0x1B, 0x13, 0x0B, 0x03,
-        0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C,
-        0x3D, 0x35, 0x2D, 0x25, 0x1D, 0x15, 0x0D, 0x05,
-        0x06, 0x0E, 0x16, 0x1E, 0x26, 0x2E, 0x36, 0x3E,
-        0x3F, 0x37, 0x2F, 0x27, 0x1F, 0x17, 0x0F, 0x07,
-    },
-    {
-        0x3B, 0x3A, 0x39, 0x38, 0x30, 0x31, 0x32, 0x33,
-        0x2B, 0x2A, 0x29, 0x28, 0x20, 0x21, 0x22, 0x23,
-        0x1B, 0x1A, 0x19, 0x18, 0x10, 0x11, 0x12, 0x13,
-        0x0B, 0x0A, 0x09, 0x08, 0x00, 0x01, 0x02, 0x03,
-        0x04, 0x05, 0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x0C,
-        0x14, 0x15, 0x16, 0x17, 0x1F, 0x1E, 0x1D, 0x1C,
-        0x24, 0x25, 0x26, 0x27, 0x2F, 0x2E, 0x2D, 0x2C,
-        0x34, 0x35, 0x36, 0x37, 0x3F, 0x3E, 0x3D, 0x3C,
-    },
-    {
-        0x19, 0x11, 0x12, 0x1A, 0x1B, 0x13, 0x0B, 0x03,
-        0x02, 0x0A, 0x09, 0x01, 0x00, 0x08, 0x10, 0x18,
-        0x20, 0x28, 0x30, 0x38, 0x39, 0x31, 0x29, 0x2A,
-        0x32, 0x3A, 0x3B, 0x33, 0x2B, 0x23, 0x22, 0x21,
-        0x1D, 0x15, 0x16, 0x1E, 0x1F, 0x17, 0x0F, 0x07,
-        0x06, 0x0E, 0x0D, 0x05, 0x04, 0x0C, 0x14, 0x1C,
-        0x24, 0x2C, 0x34, 0x3C, 0x3D, 0x35, 0x2D, 0x2E,
-        0x36, 0x3E, 0x3F, 0x37, 0x2F, 0x27, 0x26, 0x25,
-    },
-    {
-        0x03, 0x0B, 0x02, 0x0A, 0x01, 0x09, 0x00, 0x08,
-        0x10, 0x18, 0x11, 0x19, 0x12, 0x1A, 0x13, 0x1B,
-        0x23, 0x2B, 0x22, 0x2A, 0x21, 0x29, 0x20, 0x28,
-        0x30, 0x38, 0x31, 0x39, 0x32, 0x3A, 0x33, 0x3B,
-        0x3C, 0x34, 0x3D, 0x35, 0x3E, 0x36, 0x3F, 0x37,
-        0x2F, 0x27, 0x2E, 0x26, 0x2D, 0x25, 0x2C, 0x24,
-        0x1C, 0x14, 0x1D, 0x15, 0x1E, 0x16, 0x1F, 0x17,
-        0x0F, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
-    },
-    {
-        0x18, 0x19, 0x10, 0x11, 0x08, 0x09, 0x00, 0x01,
-        0x02, 0x03, 0x0A, 0x0B, 0x12, 0x13, 0x1A, 0x1B,
-        0x1C, 0x1D, 0x14, 0x15, 0x0C, 0x0D, 0x04, 0x05,
-        0x06, 0x07, 0x0E, 0x0F, 0x16, 0x17, 0x1E, 0x1F,
-        0x27, 0x26, 0x2F, 0x2E, 0x37, 0x36, 0x3F, 0x3E,
-        0x3D, 0x3C, 0x35, 0x34, 0x2D, 0x2C, 0x25, 0x24,
-        0x23, 0x22, 0x2B, 0x2A, 0x33, 0x32, 0x3B, 0x3A,
-        0x39, 0x38, 0x31, 0x30, 0x29, 0x28, 0x21, 0x20,
-    },
-    {
-        0x00, 0x01, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B,
-        0x10, 0x11, 0x12, 0x13, 0x18, 0x19, 0x1A, 0x1B,
-        0x20, 0x21, 0x22, 0x23, 0x28, 0x29, 0x2A, 0x2B,
-        0x30, 0x31, 0x32, 0x33, 0x38, 0x39, 0x3A, 0x3B,
-        0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F,
-        0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F,
-        0x24, 0x25, 0x26, 0x27, 0x2C, 0x2D, 0x2E, 0x2F,
-        0x34, 0x35, 0x36, 0x37, 0x3C, 0x3D, 0x3E, 0x3F,
-    },
-    {
-        0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x05, 0x0C, 0x04,
-        0x03, 0x0B, 0x02, 0x0A, 0x09, 0x01, 0x00, 0x08,
-        0x10, 0x18, 0x11, 0x19, 0x12, 0x1A, 0x13, 0x1B,
-        0x14, 0x1C, 0x15, 0x1D, 0x16, 0x1E, 0x17, 0x1F,
-        0x27, 0x2F, 0x26, 0x2E, 0x25, 0x2D, 0x24, 0x2C,
-        0x23, 0x2B, 0x22, 0x2A, 0x21, 0x29, 0x20, 0x28,
-        0x31, 0x30, 0x38, 0x39, 0x3A, 0x32, 0x3B, 0x33,
-        0x3C, 0x34, 0x3D, 0x35, 0x36, 0x37, 0x3F, 0x3E,
-    },
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-        0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
-        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-        0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18,
-        0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
-        0x2F, 0x2E, 0x2D, 0x2C, 0x2B, 0x2A, 0x29, 0x28,
-        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-        0x3F, 0x3E, 0x3D, 0x3C, 0x3B, 0x3A, 0x39, 0x38,
-    },
-    {
-        0x00, 0x08, 0x09, 0x01, 0x02, 0x03, 0x0B, 0x0A,
-        0x12, 0x13, 0x1B, 0x1A, 0x19, 0x11, 0x10, 0x18,
-        0x20, 0x28, 0x29, 0x21, 0x22, 0x23, 0x2B, 0x2A,
-        0x32, 0x31, 0x30, 0x38, 0x39, 0x3A, 0x3B, 0x33,
-        0x34, 0x3C, 0x3D, 0x3E, 0x3F, 0x37, 0x36, 0x35,
-        0x2D, 0x2C, 0x24, 0x25, 0x26, 0x2E, 0x2F, 0x27,
-        0x1F, 0x17, 0x16, 0x1E, 0x1D, 0x1C, 0x14, 0x15,
-        0x0D, 0x0C, 0x04, 0x05, 0x06, 0x0E, 0x0F, 0x07,
-    },
-    {
-        0x18, 0x19, 0x10, 0x11, 0x08, 0x09, 0x00, 0x01,
-        0x02, 0x03, 0x0A, 0x0B, 0x12, 0x13, 0x1A, 0x1B,
-        0x1C, 0x1D, 0x14, 0x15, 0x0C, 0x0D, 0x04, 0x05,
-        0x06, 0x07, 0x0E, 0x0F, 0x16, 0x17, 0x1E, 0x1F,
-        0x26, 0x27, 0x2E, 0x2F, 0x36, 0x37, 0x3E, 0x3F,
-        0x3C, 0x3D, 0x34, 0x35, 0x2C, 0x2D, 0x24, 0x25,
-        0x22, 0x23, 0x2A, 0x2B, 0x32, 0x33, 0x3A, 0x3B,
-        0x38, 0x39, 0x30, 0x31, 0x28, 0x29, 0x20, 0x21,
-    },
-    {
-        0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
-        0x13, 0x1B, 0x12, 0x1A, 0x11, 0x19, 0x10, 0x18,
-        0x20, 0x28, 0x21, 0x29, 0x22, 0x2A, 0x23, 0x2B,
-        0x33, 0x3B, 0x32, 0x3A, 0x31, 0x39, 0x30, 0x38,
-        0x3C, 0x34, 0x3D, 0x35, 0x3E, 0x36, 0x3F, 0x37,
-        0x2F, 0x27, 0x2E, 0x26, 0x2D, 0x25, 0x2C, 0x24,
-        0x1F, 0x17, 0x1E, 0x16, 0x1D, 0x15, 0x1C, 0x14,
-        0x0C, 0x04, 0x0D, 0x05, 0x0E, 0x06, 0x0F, 0x07,
-    },
-    {
-        0x00, 0x08, 0x10, 0x18, 0x19, 0x1A, 0x1B, 0x13,
-        0x0B, 0x03, 0x02, 0x01, 0x09, 0x11, 0x12, 0x0A,
-        0x04, 0x0C, 0x14, 0x1C, 0x1D, 0x1E, 0x1F, 0x17,
-        0x0F, 0x07, 0x06, 0x05, 0x0D, 0x15, 0x16, 0x0E,
-        0x24, 0x2C, 0x34, 0x3C, 0x3D, 0x3E, 0x3F, 0x37,
-        0x2F, 0x27, 0x26, 0x25, 0x2D, 0x35, 0x36, 0x2E,
-        0x20, 0x28, 0x30, 0x38, 0x39, 0x3A, 0x3B, 0x33,
-        0x2B, 0x23, 0x22, 0x21, 0x29, 0x31, 0x32, 0x2A,
-    },
-    {
-        0x00, 0x08, 0x09, 0x01, 0x02, 0x03, 0x0B, 0x0A,
-        0x13, 0x1B, 0x1A, 0x12, 0x11, 0x10, 0x18, 0x19,
-        0x21, 0x20, 0x28, 0x29, 0x2A, 0x22, 0x23, 0x2B,
-        0x33, 0x3B, 0x3A, 0x32, 0x31, 0x39, 0x38, 0x30,
-        0x34, 0x3C, 0x3D, 0x35, 0x36, 0x3E, 0x3F, 0x37,
-        0x2F, 0x27, 0x26, 0x2E, 0x2D, 0x2C, 0x24, 0x25,
-        0x1D, 0x1C, 0x14, 0x15, 0x16, 0x1E, 0x1F, 0x17,
-        0x0E, 0x0F, 0x07, 0x06, 0x05, 0x0D, 0x0C, 0x04,
-    },
-    {
-        0x18, 0x10, 0x08, 0x00, 0x01, 0x02, 0x03, 0x0B,
-        0x13, 0x1B, 0x1A, 0x19, 0x11, 0x0A, 0x09, 0x12,
-        0x1C, 0x14, 0x0C, 0x04, 0x05, 0x06, 0x07, 0x0F,
-        0x17, 0x1F, 0x1E, 0x1D, 0x15, 0x0E, 0x0D, 0x16,
-        0x3C, 0x34, 0x2C, 0x24, 0x25, 0x26, 0x27, 0x2F,
-        0x37, 0x3F, 0x3E, 0x3D, 0x35, 0x2E, 0x2D, 0x36,
-        0x38, 0x30, 0x28, 0x20, 0x21, 0x22, 0x23, 0x2B,
-        0x33, 0x3B, 0x3A, 0x39, 0x31, 0x2A, 0x29, 0x32,
-    },
-    {
-        0x00, 0x08, 0x09, 0x01, 0x02, 0x0A, 0x12, 0x11,
-        0x10, 0x18, 0x19, 0x1A, 0x1B, 0x13, 0x0B, 0x03,
-        0x07, 0x06, 0x0E, 0x0F, 0x17, 0x16, 0x15, 0x0D,
-        0x05, 0x04, 0x0C, 0x14, 0x1C, 0x1D, 0x1E, 0x1F,
-        0x3F, 0x3E, 0x36, 0x37, 0x2F, 0x2E, 0x2D, 0x35,
-        0x3D, 0x3C, 0x34, 0x2C, 0x24, 0x25, 0x26, 0x27,
-        0x38, 0x30, 0x31, 0x39, 0x3A, 0x32, 0x2A, 0x29,
-        0x28, 0x20, 0x21, 0x22, 0x23, 0x2B, 0x33, 0x3B,
-    },
-    {
-        0x00, 0x01, 0x08, 0x09, 0x10, 0x11, 0x18, 0x19,
-        0x20, 0x21, 0x28, 0x29, 0x30, 0x31, 0x38, 0x39,
-        0x3A, 0x3B, 0x32, 0x33, 0x2A, 0x2B, 0x22, 0x23,
-        0x1A, 0x1B, 0x12, 0x13, 0x0A, 0x0B, 0x02, 0x03,
-        0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D,
-        0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x3C, 0x3D,
-        0x3E, 0x3F, 0x36, 0x37, 0x2E, 0x2F, 0x26, 0x27,
-        0x1E, 0x1F, 0x16, 0x17, 0x0E, 0x0F, 0x06, 0x07,
-    }
-};
-
-static const uint32_t bink_intra_quant[16][64] = {
-{
- 0x010000, 0x016315, 0x01E83D, 0x02A535, 0x014E7B, 0x016577, 0x02F1E6, 0x02724C,
- 0x010000, 0x00EEDA, 0x024102, 0x017F9B, 0x00BE80, 0x00611E, 0x01083C, 0x00A552,
- 0x021F88, 0x01DC53, 0x027FAD, 0x01F697, 0x014819, 0x00A743, 0x015A31, 0x009688,
- 0x02346F, 0x030EE5, 0x01FBFA, 0x02C096, 0x01D000, 0x028396, 0x019247, 0x01F9AA,
- 0x02346F, 0x01FBFA, 0x01DC53, 0x0231B8, 0x012F12, 0x01E06C, 0x00CB10, 0x0119A8,
- 0x01C48C, 0x019748, 0x014E86, 0x0122AF, 0x02C628, 0x027F20, 0x0297B5, 0x023F32,
- 0x025000, 0x01AB6B, 0x01D122, 0x0159B3, 0x012669, 0x008D43, 0x00EE1F, 0x0075ED,
- 0x01490C, 0x010288, 0x00F735, 0x00EF51, 0x00E0F1, 0x0072AD, 0x00A4D8, 0x006517,
-},
-{
- 0x015555, 0x01D971, 0x028AFC, 0x0386F1, 0x01BDF9, 0x01DC9F, 0x03ED33, 0x034311,
- 0x015555, 0x013E78, 0x030158, 0x01FF7A, 0x00FE00, 0x00817D, 0x01604F, 0x00DC6D,
- 0x02D4B5, 0x027B19, 0x0354E7, 0x029E1F, 0x01B577, 0x00DF04, 0x01CD96, 0x00C8B6,
- 0x02F095, 0x0413DC, 0x02A54E, 0x03AB73, 0x026AAB, 0x035A1E, 0x02185E, 0x02A238,
- 0x02F095, 0x02A54E, 0x027B19, 0x02ECF5, 0x019418, 0x028090, 0x010EC0, 0x01778A,
- 0x025B66, 0x021F0B, 0x01BE09, 0x018394, 0x03B2E0, 0x03542A, 0x0374F1, 0x02FEEE,
- 0x031555, 0x0239E4, 0x026C2D, 0x01CCEE, 0x01888C, 0x00BC59, 0x013D7E, 0x009D3C,
- 0x01B6BB, 0x0158B5, 0x01499C, 0x013F17, 0x012BEC, 0x0098E6, 0x00DBCB, 0x0086C9,
-},
-{
- 0x01AAAB, 0x024FCE, 0x032DBB, 0x0468AD, 0x022D78, 0x0253C7, 0x04E87F, 0x0413D5,
- 0x01AAAB, 0x018E16, 0x03C1AE, 0x027F58, 0x013D80, 0x00A1DC, 0x01B863, 0x011388,
- 0x0389E2, 0x0319DF, 0x042A21, 0x0345A7, 0x0222D4, 0x0116C5, 0x0240FC, 0x00FAE3,
- 0x03ACBA, 0x0518D3, 0x034EA1, 0x04964F, 0x030555, 0x0430A5, 0x029E76, 0x034AC5,
- 0x03ACBA, 0x034EA1, 0x0319DF, 0x03A833, 0x01F91E, 0x0320B4, 0x015270, 0x01D56D,
- 0x02F23F, 0x02A6CE, 0x022D8B, 0x01E479, 0x049F98, 0x042935, 0x04522D, 0x03BEA9,
- 0x03DAAB, 0x02C85D, 0x030738, 0x02402A, 0x01EAAF, 0x00EB6F, 0x018CDE, 0x00C48A,
- 0x022469, 0x01AEE2, 0x019C02, 0x018EDD, 0x0176E7, 0x00BF20, 0x0112BE, 0x00A87B,
-},
-{
- 0x020000, 0x02C62A, 0x03D07A, 0x054A69, 0x029CF6, 0x02CAEF, 0x05E3CC, 0x04E499,
- 0x020000, 0x01DDB4, 0x048204, 0x02FF36, 0x017D01, 0x00C23C, 0x021077, 0x014AA3,
- 0x043F0F, 0x03B8A6, 0x04FF5A, 0x03ED2E, 0x029032, 0x014E86, 0x02B461, 0x012D11,
- 0x0468DF, 0x061DCA, 0x03F7F5, 0x05812C, 0x03A000, 0x05072C, 0x03248D, 0x03F353,
- 0x0468DF, 0x03F7F5, 0x03B8A6, 0x046370, 0x025E24, 0x03C0D8, 0x019620, 0x02334F,
- 0x038919, 0x032E91, 0x029D0D, 0x02455E, 0x058C50, 0x04FE3F, 0x052F69, 0x047E65,
- 0x04A000, 0x0356D6, 0x03A243, 0x02B365, 0x024CD2, 0x011A85, 0x01DC3E, 0x00EBD9,
- 0x029218, 0x020510, 0x01EE69, 0x01DEA2, 0x01C1E2, 0x00E559, 0x0149B0, 0x00CA2D,
-},
-{
- 0x02AAAB, 0x03B2E3, 0x0515F8, 0x070DE2, 0x037BF2, 0x03B93E, 0x07DA65, 0x068621,
- 0x02AAAB, 0x027CF0, 0x0602B1, 0x03FEF3, 0x01FC01, 0x0102FA, 0x02C09F, 0x01B8DA,
- 0x05A96A, 0x04F632, 0x06A9CE, 0x053C3E, 0x036AED, 0x01BE09, 0x039B2D, 0x01916B,
- 0x05E129, 0x0827B8, 0x054A9C, 0x0756E5, 0x04D555, 0x06B43B, 0x0430BC, 0x05446F,
- 0x05E129, 0x054A9C, 0x04F632, 0x05D9EB, 0x032830, 0x050121, 0x021D80, 0x02EF14,
- 0x04B6CC, 0x043E16, 0x037C11, 0x030728, 0x0765C0, 0x06A855, 0x06E9E2, 0x05FDDB,
- 0x062AAB, 0x0473C8, 0x04D85A, 0x0399DC, 0x031118, 0x0178B2, 0x027AFD, 0x013A77,
- 0x036D76, 0x02B16A, 0x029337, 0x027E2E, 0x0257D8, 0x0131CC, 0x01B796, 0x010D91,
-},
-{
- 0x038000, 0x04DACA, 0x06ACD5, 0x094238, 0x0492AE, 0x04E322, 0x0A4EA5, 0x08900C,
- 0x038000, 0x0343FB, 0x07E388, 0x053E9F, 0x029AC1, 0x0153E8, 0x039CD0, 0x02429E,
- 0x076E5B, 0x068322, 0x08BEDE, 0x06DF11, 0x047C57, 0x02496B, 0x04BBAB, 0x020EDD,
- 0x07B786, 0x0AB421, 0x06F1ED, 0x09A20D, 0x065800, 0x08CC8E, 0x057FF7, 0x06E9D2,
- 0x07B786, 0x06F1ED, 0x068322, 0x07AE04, 0x0424BF, 0x06917B, 0x02C6B8, 0x03D9CB,
- 0x062FEB, 0x05917D, 0x0492D7, 0x03F964, 0x09B58C, 0x08BCEF, 0x0912F8, 0x07DD30,
- 0x081800, 0x05D7F7, 0x065BF6, 0x04B9F1, 0x040670, 0x01EE69, 0x03416C, 0x019CBC,
- 0x047FAA, 0x0388DC, 0x036138, 0x03459C, 0x03134C, 0x01915C, 0x0240F5, 0x0161CF,
-},
-{
- 0x040000, 0x058C54, 0x07A0F4, 0x0A94D3, 0x0539EC, 0x0595DD, 0x0BC798, 0x09C932,
- 0x040000, 0x03BB68, 0x090409, 0x05FE6D, 0x02FA01, 0x018477, 0x0420EE, 0x029547,
- 0x087E1F, 0x07714C, 0x09FEB5, 0x07DA5D, 0x052064, 0x029D0D, 0x0568C3, 0x025A21,
- 0x08D1BE, 0x0C3B94, 0x07EFEA, 0x0B0258, 0x074000, 0x0A0E59, 0x06491A, 0x07E6A7,
- 0x08D1BE, 0x07EFEA, 0x07714C, 0x08C6E0, 0x04BC48, 0x0781B1, 0x032C3F, 0x04669F,
- 0x071232, 0x065D22, 0x053A1A, 0x048ABC, 0x0B18A0, 0x09FC7F, 0x0A5ED3, 0x08FCC9,
- 0x094000, 0x06ADAC, 0x074487, 0x0566CA, 0x0499A5, 0x02350B, 0x03B87B, 0x01D7B3,
- 0x052430, 0x040A20, 0x03DCD3, 0x03BD45, 0x0383C5, 0x01CAB3, 0x029361, 0x01945A,
-},
-{
- 0x050000, 0x06EF69, 0x098931, 0x0D3A07, 0x068867, 0x06FB55, 0x0EB97E, 0x0C3B7E,
- 0x050000, 0x04AA42, 0x0B450B, 0x077E08, 0x03B881, 0x01E595, 0x05292A, 0x033A99,
- 0x0A9DA7, 0x094D9F, 0x0C7E62, 0x09D0F4, 0x06687D, 0x034450, 0x06C2F4, 0x02F0AA,
- 0x0B062D, 0x0F4A78, 0x09EBE4, 0x0DC2EE, 0x091000, 0x0C91EF, 0x07DB61, 0x09E050,
- 0x0B062D, 0x09EBE4, 0x094D9F, 0x0AF898, 0x05EB59, 0x09621D, 0x03F74F, 0x058046,
- 0x08D6BE, 0x07F46A, 0x0688A0, 0x05AD6B, 0x0DDEC8, 0x0C7B9F, 0x0CF687, 0x0B3BFB,
- 0x0B9000, 0x085917, 0x0915A8, 0x06C07D, 0x05C00E, 0x02C24D, 0x04A69A, 0x024D9F,
- 0x066D3C, 0x050CA7, 0x04D407, 0x04AC96, 0x0464B6, 0x023D5F, 0x033839, 0x01F971,
-},
-{
- 0x060000, 0x08527E, 0x0B716E, 0x0FDF3C, 0x07D6E1, 0x0860CC, 0x11AB63, 0x0EADCB,
- 0x060000, 0x05991C, 0x0D860D, 0x08FDA3, 0x047702, 0x0246B3, 0x063165, 0x03DFEA,
- 0x0CBD2E, 0x0B29F1, 0x0EFE0F, 0x0BC78B, 0x07B096, 0x03EB93, 0x081D24, 0x038732,
- 0x0D3A9C, 0x12595D, 0x0BE7DF, 0x108384, 0x0AE000, 0x0F1585, 0x096DA8, 0x0BD9FA,
- 0x0D3A9C, 0x0BE7DF, 0x0B29F1, 0x0D2A50, 0x071A6B, 0x0B4289, 0x04C25F, 0x0699EE,
- 0x0A9B4A, 0x098BB2, 0x07D727, 0x06D01A, 0x10A4F0, 0x0EFABE, 0x0F8E3C, 0x0D7B2E,
- 0x0DE000, 0x0A0482, 0x0AE6CA, 0x081A2F, 0x06E677, 0x034F90, 0x0594B9, 0x02C38C,
- 0x07B649, 0x060F2F, 0x05CB3C, 0x059BE7, 0x0545A7, 0x02B00C, 0x03DD11, 0x025E87,
-},
-{
- 0x080000, 0x0B18A8, 0x0F41E8, 0x1529A5, 0x0A73D7, 0x0B2BBB, 0x178F2F, 0x139264,
- 0x080000, 0x0776CF, 0x120812, 0x0BFCD9, 0x05F402, 0x0308EF, 0x0841DC, 0x052A8E,
- 0x10FC3E, 0x0EE297, 0x13FD69, 0x0FB4B9, 0x0A40C8, 0x053A1A, 0x0AD186, 0x04B442,
- 0x11A37B, 0x187727, 0x0FDFD4, 0x1604B0, 0x0E8000, 0x141CB1, 0x0C9235, 0x0FCD4D,
- 0x11A37B, 0x0FDFD4, 0x0EE297, 0x118DC0, 0x09788F, 0x0F0362, 0x06587F, 0x08CD3D,
- 0x0E2463, 0x0CBA43, 0x0A7434, 0x091577, 0x163140, 0x13F8FE, 0x14BDA5, 0x11F992,
- 0x128000, 0x0D5B58, 0x0E890D, 0x0ACD94, 0x093349, 0x046A15, 0x0770F7, 0x03AF65,
- 0x0A4861, 0x08143F, 0x07B9A6, 0x077A89, 0x070789, 0x039565, 0x0526C2, 0x0328B4,
-},
-{
- 0x0C0000, 0x10A4FD, 0x16E2DB, 0x1FBE78, 0x0FADC3, 0x10C198, 0x2356C7, 0x1D5B96,
- 0x0C0000, 0x0B3237, 0x1B0C1A, 0x11FB46, 0x08EE03, 0x048D66, 0x0C62CA, 0x07BFD5,
- 0x197A5D, 0x1653E3, 0x1DFC1E, 0x178F16, 0x0F612C, 0x07D727, 0x103A49, 0x070E64,
- 0x1A7539, 0x24B2BB, 0x17CFBD, 0x210709, 0x15C000, 0x1E2B0A, 0x12DB4F, 0x17B3F4,
- 0x1A7539, 0x17CFBD, 0x1653E3, 0x1A54A0, 0x0E34D7, 0x168513, 0x0984BE, 0x0D33DC,
- 0x153695, 0x131765, 0x0FAE4E, 0x0DA033, 0x2149E1, 0x1DF57D, 0x1F1C78, 0x1AF65B,
- 0x1BC000, 0x140904, 0x15CD94, 0x10345E, 0x0DCCEE, 0x069F20, 0x0B2972, 0x058718,
- 0x0F6C91, 0x0C1E5E, 0x0B9678, 0x0B37CE, 0x0A8B4E, 0x056018, 0x07BA22, 0x04BD0E,
-},
-{
- 0x110000, 0x179466, 0x206C0C, 0x2CF87F, 0x16362A, 0x17BCED, 0x321044, 0x299714,
- 0x110000, 0x0FDC79, 0x265125, 0x19794E, 0x0CA685, 0x0672FB, 0x118BF4, 0x0AFA6D,
- 0x241804, 0x1FA181, 0x2A7A80, 0x21600A, 0x15C9A9, 0x0B1B77, 0x16FD3C, 0x09FF0D,
- 0x257B66, 0x33FD33, 0x21BBA2, 0x2EC9F7, 0x1ED000, 0x2ABCF9, 0x1AB6B0, 0x219444,
- 0x257B66, 0x21BBA2, 0x1FA181, 0x254D38, 0x142030, 0x1FE730, 0x0D7C0E, 0x12B423,
- 0x1E0D52, 0x1B0BCF, 0x1636EE, 0x134D9E, 0x2F28A9, 0x2A711B, 0x2C12FF, 0x263256,
- 0x275000, 0x1C621B, 0x1EE33C, 0x16F4DB, 0x138CFB, 0x09616E, 0x0FD00C, 0x07D4B7,
- 0x15D9CE, 0x112B06, 0x106A80, 0x0FE464, 0x0EF004, 0x079D77, 0x0AF25B, 0x06B67F,
-},
-{
- 0x160000, 0x1E83CF, 0x29F53D, 0x3A3286, 0x1CBE90, 0x1EB842, 0x40C9C2, 0x35D293,
- 0x160000, 0x1486BA, 0x319630, 0x20F756, 0x105F06, 0x085891, 0x16B51E, 0x0E3506,
- 0x2EB5AA, 0x28EF20, 0x36F8E1, 0x2B30FE, 0x1C3225, 0x0E5FC7, 0x1DC030, 0x0CEFB7,
- 0x308193, 0x4347AC, 0x2BA786, 0x3C8CE5, 0x27E000, 0x374EE7, 0x229212, 0x2B7494,
- 0x308193, 0x2BA786, 0x28EF20, 0x3045D0, 0x1A0B89, 0x29494D, 0x11735D, 0x183469,
- 0x26E410, 0x230039, 0x1CBF8F, 0x18FB09, 0x3D0771, 0x36ECBA, 0x390986, 0x316E52,
- 0x32E000, 0x24BB33, 0x27F8E4, 0x1DB557, 0x194D09, 0x0C23BB, 0x1476A6, 0x0A2256,
- 0x1C470A, 0x1637AD, 0x153E87, 0x1490FA, 0x1354B9, 0x09DAD6, 0x0E2A94, 0x08AFF0,
-},
-{
- 0x1C0000, 0x26D64D, 0x3566AA, 0x4A11C2, 0x249572, 0x27190E, 0x527525, 0x44805E,
- 0x1C0000, 0x1A1FD6, 0x3F1C3E, 0x29F4F9, 0x14D607, 0x0A9F44, 0x1CE683, 0x1214F0,
- 0x3B72D9, 0x341911, 0x45F6F0, 0x36F889, 0x23E2BB, 0x124B5B, 0x25DD54, 0x1076E9,
- 0x3DBC30, 0x55A109, 0x378F64, 0x4D1069, 0x32C000, 0x46646C, 0x2BFFB9, 0x374E8E,
- 0x3DBC30, 0x378F64, 0x341911, 0x3D7020, 0x2125F5, 0x348BD6, 0x1635BC, 0x1ECE57,
- 0x317F5B, 0x2C8BEB, 0x2496B6, 0x1FCB22, 0x4DAC61, 0x45E778, 0x4897C2, 0x3EE97F,
- 0x40C000, 0x2EBFB5, 0x32DFAE, 0x25CF86, 0x203380, 0x0F734B, 0x1A0B5F, 0x0CE5E2,
- 0x23FD53, 0x1C46DC, 0x1B09C4, 0x1A2CE1, 0x189A60, 0x0C8AE2, 0x1207A5, 0x0B0E77,
-},
-{
- 0x220000, 0x2F28CC, 0x40D818, 0x59F0FE, 0x2C6C53, 0x2F79DA, 0x642089, 0x532E29,
- 0x220000, 0x1FB8F1, 0x4CA24B, 0x32F29C, 0x194D09, 0x0CE5F7, 0x2317E8, 0x15F4DB,
- 0x483007, 0x3F4303, 0x54F4FF, 0x42C014, 0x2B9351, 0x1636EE, 0x2DFA79, 0x13FE1A,
- 0x4AF6CC, 0x67FA67, 0x437743, 0x5D93EE, 0x3DA000, 0x5579F1, 0x356D61, 0x432888,
- 0x4AF6CC, 0x437743, 0x3F4303, 0x4A9A70, 0x284060, 0x3FCE60, 0x1AF81B, 0x256845,
- 0x3C1AA5, 0x36179D, 0x2C6DDD, 0x269B3C, 0x5E5152, 0x54E237, 0x5825FE, 0x4C64AD,
- 0x4EA000, 0x38C437, 0x3DC678, 0x2DE9B5, 0x2719F7, 0x12C2DB, 0x1FA018, 0x0FA96E,
- 0x2BB39B, 0x22560C, 0x20D500, 0x1FC8C8, 0x1DE007, 0x0F3AEE, 0x15E4B7, 0x0D6CFE,
-},
-{
- 0x2C0000, 0x3D079E, 0x53EA79, 0x74650C, 0x397D20, 0x3D7083, 0x819383, 0x6BA525,
- 0x2C0000, 0x290D75, 0x632C61, 0x41EEAC, 0x20BE0C, 0x10B121, 0x2D6A3B, 0x1C6A0C,
- 0x5D6B54, 0x51DE40, 0x6DF1C2, 0x5661FB, 0x38644B, 0x1CBF8F, 0x3B8060, 0x19DF6D,
- 0x610326, 0x868F57, 0x574F0B, 0x7919CA, 0x4FC000, 0x6E9DCE, 0x452423, 0x56E928,
- 0x610326, 0x574F0B, 0x51DE40, 0x608BA0, 0x341713, 0x52929A, 0x22E6BA, 0x3068D2,
- 0x4DC821, 0x460071, 0x397F1E, 0x31F611, 0x7A0EE2, 0x6DD974, 0x72130C, 0x62DCA3,
- 0x65C000, 0x497665, 0x4FF1C9, 0x3B6AAE, 0x329A12, 0x184776, 0x28ED4D, 0x1444AC,
- 0x388E14, 0x2C6F5A, 0x2A7D0F, 0x2921F4, 0x26A973, 0x13B5AD, 0x1C5528, 0x115FDF,
-},
-};
-
-static const uint32_t bink_inter_quant[16][64] = {
-{
- 0x010000, 0x017946, 0x01A5A9, 0x0248DC, 0x016363, 0x0152A7, 0x0243EC, 0x0209EA,
- 0x012000, 0x00E248, 0x01BBDA, 0x015CBC, 0x00A486, 0x0053E0, 0x00F036, 0x008095,
- 0x01B701, 0x016959, 0x01B0B9, 0x0153FD, 0x00F8E7, 0x007EE4, 0x00EA30, 0x007763,
- 0x01B701, 0x0260EB, 0x019DE9, 0x023E1B, 0x017000, 0x01FE6E, 0x012DB5, 0x01A27B,
- 0x01E0D1, 0x01B0B9, 0x018A33, 0x01718D, 0x00D87A, 0x014449, 0x007B9A, 0x00AB71,
- 0x013178, 0x0112EA, 0x00AD08, 0x009BB9, 0x023D97, 0x020437, 0x021CCC, 0x01E6B4,
- 0x018000, 0x012DB5, 0x0146D9, 0x0100CE, 0x00CFD2, 0x006E5C, 0x00B0E4, 0x005A2D,
- 0x00E9CC, 0x00B7B1, 0x00846F, 0x006B85, 0x008337, 0x0042E5, 0x004A10, 0x002831,
-},
-{
- 0x015555, 0x01F708, 0x023237, 0x030BD0, 0x01D9D9, 0x01C389, 0x03053B, 0x02B7E3,
- 0x018000, 0x012DB5, 0x024FCE, 0x01D0FA, 0x00DB5D, 0x006FD5, 0x014048, 0x00AB71,
- 0x024957, 0x01E1CC, 0x0240F7, 0x01C551, 0x014BDE, 0x00A92F, 0x013840, 0x009F2F,
- 0x024957, 0x032BE4, 0x0227E1, 0x02FD7A, 0x01EAAB, 0x02A893, 0x019247, 0x022DF9,
- 0x028116, 0x0240F7, 0x020D99, 0x01ECBC, 0x0120A3, 0x01B061, 0x00A4CE, 0x00E497,
- 0x01974B, 0x016E8E, 0x00E6B5, 0x00CFA2, 0x02FCC9, 0x02B04A, 0x02D110, 0x0288F1,
- 0x020000, 0x019247, 0x01B3CC, 0x015668, 0x011518, 0x009325, 0x00EBDA, 0x00783D,
- 0x0137BB, 0x00F4ED, 0x00B093, 0x008F5C, 0x00AEF4, 0x005931, 0x0062BF, 0x003597,
-},
-{
- 0x01AAAB, 0x0274CB, 0x02BEC4, 0x03CEC4, 0x02504F, 0x02346C, 0x03C689, 0x0365DC,
- 0x01E000, 0x017922, 0x02E3C1, 0x024539, 0x011235, 0x008BCA, 0x01905A, 0x00D64D,
- 0x02DBAD, 0x025A40, 0x02D134, 0x0236A5, 0x019ED6, 0x00D37B, 0x018650, 0x00C6FB,
- 0x02DBAD, 0x03F6DD, 0x02B1D9, 0x03BCD8, 0x026555, 0x0352B8, 0x01F6D8, 0x02B977,
- 0x03215C, 0x02D134, 0x029100, 0x0267EB, 0x0168CC, 0x021C7A, 0x00CE01, 0x011DBD,
- 0x01FD1E, 0x01CA31, 0x012062, 0x01038A, 0x03BBFB, 0x035C5C, 0x038554, 0x032B2D,
- 0x028000, 0x01F6D8, 0x0220C0, 0x01AC02, 0x015A5E, 0x00B7EF, 0x0126D1, 0x00964C,
- 0x0185A9, 0x013228, 0x00DCB8, 0x00B333, 0x00DAB2, 0x006F7D, 0x007B6F, 0x0042FC,
-},
-{
- 0x020000, 0x02F28D, 0x034B52, 0x0491B8, 0x02C6C5, 0x02A54E, 0x0487D8, 0x0413D5,
- 0x024000, 0x01C48F, 0x0377B5, 0x02B977, 0x01490C, 0x00A7BF, 0x01E06C, 0x01012A,
- 0x036E03, 0x02D2B3, 0x036172, 0x02A7FA, 0x01F1CE, 0x00FDC7, 0x01D460, 0x00EEC7,
- 0x036E03, 0x04C1D6, 0x033BD1, 0x047C37, 0x02E000, 0x03FCDD, 0x025B6A, 0x0344F5,
- 0x03C1A1, 0x036172, 0x031466, 0x02E31B, 0x01B0F5, 0x028892, 0x00F735, 0x0156E2,
- 0x0262F1, 0x0225D5, 0x015A10, 0x013772, 0x047B2D, 0x04086E, 0x043998, 0x03CD69,
- 0x030000, 0x025B6A, 0x028DB3, 0x02019B, 0x019FA3, 0x00DCB8, 0x0161C7, 0x00B45B,
- 0x01D398, 0x016F63, 0x0108DD, 0x00D70A, 0x01066F, 0x0085C9, 0x00941F, 0x005062,
-},
-{
- 0x02AAAB, 0x03EE11, 0x04646D, 0x0617A0, 0x03B3B2, 0x038713, 0x060A75, 0x056FC6,
- 0x030000, 0x025B6A, 0x049F9B, 0x03A1F4, 0x01B6BB, 0x00DFAA, 0x028090, 0x0156E2,
- 0x0492AE, 0x03C399, 0x0481ED, 0x038AA2, 0x0297BD, 0x01525F, 0x027080, 0x013E5E,
- 0x0492AE, 0x0657C8, 0x044FC1, 0x05FAF4, 0x03D555, 0x055126, 0x03248D, 0x045BF2,
- 0x05022D, 0x0481ED, 0x041B33, 0x03D979, 0x024147, 0x0360C3, 0x01499C, 0x01C92E,
- 0x032E96, 0x02DD1C, 0x01CD6A, 0x019F43, 0x05F991, 0x056093, 0x05A220, 0x0511E1,
- 0x040000, 0x03248D, 0x036799, 0x02ACCF, 0x022A2F, 0x01264B, 0x01D7B5, 0x00F079,
- 0x026F75, 0x01E9D9, 0x016127, 0x011EB8, 0x015DE9, 0x00B262, 0x00C57F, 0x006B2D,
-},
-{
- 0x038000, 0x052876, 0x05C3CF, 0x07FF02, 0x04DBD9, 0x04A148, 0x07EDBA, 0x0722B4,
- 0x03F000, 0x0317FB, 0x06117C, 0x04C491, 0x023FD5, 0x01258F, 0x0348BD, 0x01C209,
- 0x060085, 0x04F0B9, 0x05EA87, 0x04A5F5, 0x036728, 0x01BC1C, 0x0333A8, 0x01A1DB,
- 0x060085, 0x085336, 0x05A8AE, 0x07D960, 0x050800, 0x06FA82, 0x041FF9, 0x05B8AE,
- 0x0692DA, 0x05EA87, 0x0563B2, 0x050D6E, 0x02F5AD, 0x046F00, 0x01B09C, 0x02580C,
- 0x042D25, 0x03C235, 0x025D9B, 0x022108, 0x07D78F, 0x070EC1, 0x0764CA, 0x06A777,
- 0x054000, 0x041FF9, 0x0477F9, 0x0382D0, 0x02D75E, 0x018242, 0x026B1D, 0x013B9F,
- 0x03324A, 0x0282ED, 0x01CF83, 0x017851, 0x01CB42, 0x00EA21, 0x010336, 0x008CAC,
-},
-{
- 0x040000, 0x05E519, 0x0696A4, 0x092370, 0x058D8A, 0x054A9C, 0x090FB0, 0x0827AA,
- 0x048000, 0x03891F, 0x06EF69, 0x0572EE, 0x029218, 0x014F7E, 0x03C0D8, 0x020254,
- 0x06DC05, 0x05A565, 0x06C2E4, 0x054FF3, 0x03E39B, 0x01FB8E, 0x03A8C0, 0x01DD8D,
- 0x06DC05, 0x0983AC, 0x0677A2, 0x08F86E, 0x05C000, 0x07F9B9, 0x04B6D4, 0x0689EB,
- 0x078343, 0x06C2E4, 0x0628CC, 0x05C635, 0x0361EA, 0x051124, 0x01EE69, 0x02ADC5,
- 0x04C5E1, 0x044BAA, 0x02B41F, 0x026EE5, 0x08F65A, 0x0810DD, 0x087330, 0x079AD1,
- 0x060000, 0x04B6D4, 0x051B65, 0x040337, 0x033F47, 0x01B970, 0x02C38F, 0x0168B6,
- 0x03A730, 0x02DEC6, 0x0211BA, 0x01AE14, 0x020CDD, 0x010B93, 0x01283E, 0x00A0C4,
-},
-{
- 0x050000, 0x075E60, 0x083C4D, 0x0B6C4C, 0x06F0ED, 0x069D43, 0x0B539C, 0x0A3194,
- 0x05A000, 0x046B67, 0x08AB44, 0x06CFAA, 0x03369E, 0x01A35E, 0x04B10F, 0x0282E8,
- 0x089307, 0x070EBF, 0x08739C, 0x06A3F0, 0x04DC82, 0x027A72, 0x0492F0, 0x0254F0,
- 0x089307, 0x0BE497, 0x08158B, 0x0B3689, 0x073000, 0x09F827, 0x05E489, 0x082C66,
- 0x096413, 0x08739C, 0x07B2FF, 0x0737C2, 0x043A64, 0x06556D, 0x026A04, 0x035936,
- 0x05F75A, 0x055E94, 0x036127, 0x030A9E, 0x0B33F1, 0x0A1514, 0x0A8FFC, 0x098186,
- 0x078000, 0x05E489, 0x06623F, 0x050405, 0x040F19, 0x0227CC, 0x037473, 0x01C2E3,
- 0x0490FC, 0x039677, 0x029629, 0x021999, 0x029015, 0x014E78, 0x01724E, 0x00C8F5,
-},
-{
- 0x060000, 0x08D7A6, 0x09E1F6, 0x0DB528, 0x085450, 0x07EFEA, 0x0D9788, 0x0C3B7E,
- 0x06C000, 0x054DAE, 0x0A671E, 0x082C66, 0x03DB24, 0x01F73E, 0x05A145, 0x03037D,
- 0x0A4A08, 0x087818, 0x0A2455, 0x07F7ED, 0x05D569, 0x02F955, 0x057D20, 0x02CC54,
- 0x0A4A08, 0x0E4582, 0x09B373, 0x0D74A5, 0x08A000, 0x0BF696, 0x07123E, 0x09CEE0,
- 0x0B44E4, 0x0A2455, 0x093D32, 0x08A950, 0x0512DF, 0x0799B6, 0x02E59E, 0x0404A7,
- 0x0728D2, 0x06717F, 0x040E2F, 0x03A657, 0x0D7187, 0x0C194B, 0x0CACC8, 0x0B683A,
- 0x090000, 0x07123E, 0x07A918, 0x0604D2, 0x04DEEA, 0x029629, 0x042556, 0x021D11,
- 0x057AC8, 0x044E28, 0x031A97, 0x02851E, 0x03134C, 0x01915C, 0x01BC5D, 0x00F126,
-},
-{
- 0x080000, 0x0BCA33, 0x0D2D48, 0x1246E0, 0x0B1B15, 0x0A9538, 0x121F5F, 0x104F53,
- 0x090000, 0x07123E, 0x0DDED2, 0x0AE5DD, 0x052430, 0x029EFD, 0x0781B1, 0x0404A7,
- 0x0DB80B, 0x0B4ACB, 0x0D85C7, 0x0A9FE7, 0x07C736, 0x03F71D, 0x075180, 0x03BB1A,
- 0x0DB80B, 0x130757, 0x0CEF44, 0x11F0DC, 0x0B8000, 0x0FF372, 0x096DA8, 0x0D13D6,
- 0x0F0686, 0x0D85C7, 0x0C5198, 0x0B8C6A, 0x06C3D4, 0x0A2248, 0x03DCD3, 0x055B8A,
- 0x098BC3, 0x089754, 0x05683E, 0x04DDC9, 0x11ECB4, 0x1021B9, 0x10E661, 0x0F35A3,
- 0x0C0000, 0x096DA8, 0x0A36CB, 0x08066E, 0x067E8E, 0x0372E1, 0x05871E, 0x02D16B,
- 0x074E60, 0x05BD8B, 0x042374, 0x035C28, 0x0419BB, 0x021726, 0x02507C, 0x014188,
-},
-{
- 0x0C0000, 0x11AF4C, 0x13C3EC, 0x1B6A50, 0x10A89F, 0x0FDFD4, 0x1B2F0F, 0x1876FD,
- 0x0D8000, 0x0A9B5D, 0x14CE3C, 0x1058CB, 0x07B649, 0x03EE7B, 0x0B4289, 0x0606FB,
- 0x149410, 0x10F030, 0x1448AB, 0x0FEFDA, 0x0BAAD2, 0x05F2AB, 0x0AFA40, 0x0598A7,
- 0x149410, 0x1C8B03, 0x1366E6, 0x1AE949, 0x114000, 0x17ED2B, 0x0E247C, 0x139DC1,
- 0x1689C8, 0x1448AB, 0x127A63, 0x11529F, 0x0A25BE, 0x0F336D, 0x05CB3C, 0x08094E,
- 0x0E51A4, 0x0CE2FE, 0x081C5D, 0x074CAE, 0x1AE30E, 0x183296, 0x195991, 0x16D074,
- 0x120000, 0x0E247C, 0x0F5230, 0x0C09A5, 0x09BDD5, 0x052C51, 0x084AAC, 0x043A21,
- 0x0AF590, 0x089C51, 0x06352E, 0x050A3B, 0x062698, 0x0322B9, 0x0378BA, 0x01E24D,
-},
-{
- 0x110000, 0x190DAC, 0x1C0039, 0x26D69C, 0x17998C, 0x167D16, 0x2682AB, 0x22A891,
- 0x132000, 0x0F06C3, 0x1D797F, 0x172876, 0x0AECE7, 0x0591D9, 0x0FF398, 0x0889E3,
- 0x1D2717, 0x17FEEF, 0x1CBC47, 0x1693CA, 0x108754, 0x086D1D, 0x0F8D30, 0x07ED98,
- 0x1D2717, 0x286F9A, 0x1B7C71, 0x261FD3, 0x187000, 0x21E552, 0x140904, 0x1BCA27,
- 0x1FEDDC, 0x1CBC47, 0x1A2D62, 0x188A62, 0x0E6022, 0x1588DA, 0x083540, 0x0B6284,
- 0x1448FE, 0x124192, 0x0B7D84, 0x0A574B, 0x2616FF, 0x2247AA, 0x23E98D, 0x2051FA,
- 0x198000, 0x140904, 0x15B46F, 0x110DAA, 0x0DCCEE, 0x07541E, 0x0BBF1F, 0x05FD04,
- 0x0F868B, 0x0C32C8, 0x08CB57, 0x0723D4, 0x08B6AD, 0x047130, 0x04EB08, 0x02AB42,
-},
-{
- 0x160000, 0x206C0C, 0x243C86, 0x3242E8, 0x1E8A79, 0x1D1A59, 0x31D646, 0x2CDA25,
- 0x18C000, 0x13722A, 0x2624C3, 0x1DF820, 0x0E2385, 0x073537, 0x14A4A7, 0x0B0CCC,
- 0x25BA1D, 0x1F0DAE, 0x252FE4, 0x1D37BB, 0x1563D6, 0x0AE78E, 0x142021, 0x0A4288,
- 0x25BA1D, 0x345430, 0x2391FB, 0x31565C, 0x1FA000, 0x2BDD7A, 0x19ED8D, 0x23F68C,
- 0x2951EF, 0x252FE4, 0x21E061, 0x1FC224, 0x129A87, 0x1BDE47, 0x0A9F44, 0x0EBBBA,
- 0x1A4058, 0x17A026, 0x0EDEAB, 0x0D61E9, 0x314AEF, 0x2C5CBE, 0x2E798A, 0x29D380,
- 0x210000, 0x19ED8D, 0x1C16AE, 0x1611AE, 0x11DC06, 0x097BEA, 0x0F3391, 0x07BFE7,
- 0x141787, 0x0FC93E, 0x0B617F, 0x093D6D, 0x0B46C1, 0x05BFA8, 0x065D55, 0x037437,
-},
-{
- 0x1C0000, 0x2943B2, 0x2E1E7C, 0x3FF810, 0x26DEC9, 0x250A43, 0x3F6DCE, 0x3915A3,
- 0x1F8000, 0x18BFD8, 0x308BE1, 0x262485, 0x11FEA9, 0x092C75, 0x1A45EB, 0x0E1049,
- 0x300425, 0x2785C6, 0x2F5439, 0x252FA8, 0x1B393F, 0x0DE0E4, 0x199D41, 0x0D0EDC,
- 0x300425, 0x4299B2, 0x2D456E, 0x3ECB00, 0x284000, 0x37D40F, 0x20FFCB, 0x2DC56D,
- 0x3496D3, 0x2F5439, 0x2B1D93, 0x286B74, 0x17AD66, 0x2377FE, 0x0D84E2, 0x12C062,
- 0x21692A, 0x1E11A5, 0x12ECDA, 0x110840, 0x3EBC76, 0x387608, 0x3B2652, 0x353BBA,
- 0x2A0000, 0x20FFCB, 0x23BFC6, 0x1C1681, 0x16BAF1, 0x0C1213, 0x1358E8, 0x09DCF8,
- 0x19924F, 0x141767, 0x0E7C16, 0x0BC28A, 0x0E5A0D, 0x075104, 0x0819B2, 0x04655D,
-},
-{
- 0x220000, 0x321B58, 0x380072, 0x4DAD38, 0x2F3318, 0x2CFA2D, 0x4D0556, 0x455122,
- 0x264000, 0x1E0D86, 0x3AF2FE, 0x2E50EB, 0x15D9CE, 0x0B23B2, 0x1FE730, 0x1113C7,
- 0x3A4E2D, 0x2FFDDF, 0x39788E, 0x2D2795, 0x210EA8, 0x10DA39, 0x1F1A61, 0x0FDB2F,
- 0x3A4E2D, 0x50DF33, 0x36F8E1, 0x4C3FA5, 0x30E000, 0x43CAA5, 0x281209, 0x37944D,
- 0x3FDBB7, 0x39788E, 0x345AC4, 0x3114C3, 0x1CC044, 0x2B11B4, 0x106A80, 0x16C509,
- 0x2891FC, 0x248324, 0x16FB08, 0x14AE97, 0x4C2DFD, 0x448F54, 0x47D31B, 0x40A3F5,
- 0x330000, 0x281209, 0x2B68DF, 0x221B53, 0x1B99DB, 0x0EA83B, 0x177E3E, 0x0BFA09,
- 0x1F0D17, 0x18658F, 0x1196AE, 0x0E47A8, 0x116D5A, 0x08E260, 0x09D60F, 0x055684,
-},
-{
- 0x2C0000, 0x40D818, 0x48790C, 0x6485D0, 0x3D14F2, 0x3A34B2, 0x63AC8D, 0x59B44A,
- 0x318000, 0x26E454, 0x4C4986, 0x3BF03F, 0x1C470A, 0x0E6A6E, 0x29494D, 0x161998,
- 0x4B743A, 0x3E1B5C, 0x4A5FC7, 0x3A6F75, 0x2AC7AC, 0x15CF1D, 0x284041, 0x148510,
- 0x4B743A, 0x68A861, 0x4723F6, 0x62ACB8, 0x3F4000, 0x57BAF3, 0x33DB1A, 0x47ED19,
- 0x52A3DE, 0x4A5FC7, 0x43C0C2, 0x3F8448, 0x25350D, 0x37BC8E, 0x153E87, 0x1D7775,
- 0x3480B0, 0x2F404C, 0x1DBD56, 0x1AC3D2, 0x6295DE, 0x58B97B, 0x5CF313, 0x53A701,
- 0x420000, 0x33DB1A, 0x382D5C, 0x2C235D, 0x23B80D, 0x12F7D4, 0x1E6723, 0x0F7FCF,
- 0x282F0E, 0x1F927D, 0x16C2FF, 0x127AD9, 0x168D83, 0x0B7F50, 0x0CBAAA, 0x06E86E,
-},
-};
-
-#endif /* AVCODEC_BINKDATA_H */
diff --git a/libavcodec/binkidct.c b/libavcodec/binkidct.c
deleted file mode 100644
index 160926e..0000000
--- a/libavcodec/binkidct.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Bink IDCT algorithm
- * Copyright (c) 2009 Kostya Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Bink IDCT algorithm
- */
-
-#include "dsputil.h"
-
-#define A1  2896 /* (1/sqrt(2))<<12 */
-#define A2  2217
-#define A3  3784
-#define A4 -5352
-
-#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\
-    const int a0 = (src)[s0] + (src)[s4]; \
-    const int a1 = (src)[s0] - (src)[s4]; \
-    const int a2 = (src)[s2] + (src)[s6]; \
-    const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \
-    const int a4 = (src)[s5] + (src)[s3]; \
-    const int a5 = (src)[s5] - (src)[s3]; \
-    const int a6 = (src)[s1] + (src)[s7]; \
-    const int a7 = (src)[s1] - (src)[s7]; \
-    const int b0 = a4 + a6; \
-    const int b1 = (A3*(a5 + a7)) >> 11; \
-    const int b2 = ((A4*a5) >> 11) - b0 + b1; \
-    const int b3 = (A1*(a6 - a4) >> 11) - b2; \
-    const int b4 = ((A2*a7) >> 11) + b3 - b1; \
-    (dest)[d0] = munge(a0+a2   +b0); \
-    (dest)[d1] = munge(a1+a3-a2+b2); \
-    (dest)[d2] = munge(a1-a3+a2+b3); \
-    (dest)[d3] = munge(a0-a2   -b4); \
-    (dest)[d4] = munge(a0-a2   +b4); \
-    (dest)[d5] = munge(a1-a3+a2-b3); \
-    (dest)[d6] = munge(a1+a3-a2-b2); \
-    (dest)[d7] = munge(a0+a2   -b0); \
-}
-/* end IDCT_TRANSFORM macro */
-
-#define MUNGE_NONE(x) (x)
-#define IDCT_COL(dest,src) IDCT_TRANSFORM(dest,0,8,16,24,32,40,48,56,0,8,16,24,32,40,48,56,MUNGE_NONE,src)
-
-#define MUNGE_ROW(x) (((x) + 0x7F)>>8)
-#define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src)
-
-static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src)
-{
-    if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) {
-        dest[0]  =
-        dest[8]  =
-        dest[16] =
-        dest[24] =
-        dest[32] =
-        dest[40] =
-        dest[48] =
-        dest[56] = src[0];
-    } else {
-        IDCT_COL(dest, src);
-    }
-}
-
-void ff_bink_idct_c(DCTELEM *block)
-{
-    int i;
-    DCTELEM temp[64];
-
-    for (i = 0; i < 8; i++)
-        bink_idct_col(&temp[i], &block[i]);
-    for (i = 0; i < 8; i++) {
-        IDCT_ROW( (&block[8*i]), (&temp[8*i]) );
-    }
-}
-
-void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i, j;
-
-    ff_bink_idct_c(block);
-    for (i = 0; i < 8; i++, dest += linesize, block += 8)
-        for (j = 0; j < 8; j++)
-             dest[j] += block[j];
-}
-
-void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    DCTELEM temp[64];
-    for (i = 0; i < 8; i++)
-        bink_idct_col(&temp[i], &block[i]);
-    for (i = 0; i < 8; i++) {
-        IDCT_ROW( (&dest[i*linesize]), (&temp[8*i]) );
-    }
-}
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
deleted file mode 100644
index 0d7a2db..0000000
--- a/libavcodec/bitstream.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Common bit i/o utils
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2010 Loren Merritt
- *
- * alternative bitstream reader & writer by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * bitstream api.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-
-const uint8_t ff_log2_run[32]={
- 0, 0, 0, 0, 1, 1, 1, 1,
- 2, 2, 2, 2, 3, 3, 3, 3,
- 4, 4, 5, 5, 6, 6, 7, 7,
- 8, 9,10,11,12,13,14,15
-};
-
-void align_put_bits(PutBitContext *s)
-{
-#ifdef ALT_BITSTREAM_WRITER
-    put_bits(s,(  - s->index) & 7,0);
-#else
-    put_bits(s,s->bit_left & 7,0);
-#endif
-}
-
-void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
-{
-    while(*string){
-        put_bits(pb, 8, *string);
-        string++;
-    }
-    if(terminate_string)
-        put_bits(pb, 8, 0);
-}
-
-void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
-{
-    int words= length>>4;
-    int bits= length&15;
-    int i;
-
-    if(length==0) return;
-
-    if(CONFIG_SMALL || words < 16 || put_bits_count(pb)&7){
-        for(i=0; i<words; i++) put_bits(pb, 16, AV_RB16(src + 2*i));
-    }else{
-        for(i=0; put_bits_count(pb)&31; i++)
-            put_bits(pb, 8, src[i]);
-        flush_put_bits(pb);
-        memcpy(put_bits_ptr(pb), src+i, 2*words-i);
-        skip_put_bytes(pb, 2*words-i);
-    }
-
-    put_bits(pb, bits, AV_RB16(src + 2*words)>>(16-bits));
-}
-
-/* VLC decoding */
-
-//#define DEBUG_VLC
-
-#define GET_DATA(v, table, i, wrap, size) \
-{\
-    const uint8_t *ptr = (const uint8_t *)table + i * wrap;\
-    switch(size) {\
-    case 1:\
-        v = *(const uint8_t *)ptr;\
-        break;\
-    case 2:\
-        v = *(const uint16_t *)ptr;\
-        break;\
-    default:\
-        v = *(const uint32_t *)ptr;\
-        break;\
-    }\
-}
-
-
-static int alloc_table(VLC *vlc, int size, int use_static)
-{
-    int index;
-    index = vlc->table_size;
-    vlc->table_size += size;
-    if (vlc->table_size > vlc->table_allocated) {
-        if(use_static)
-            abort(); //cant do anything, init_vlc() is used with too little memory
-        vlc->table_allocated += (1 << vlc->bits);
-        vlc->table = av_realloc(vlc->table,
-                                sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
-        if (!vlc->table)
-            return -1;
-    }
-    return index;
-}
-
-static av_always_inline uint32_t bitswap_32(uint32_t x) {
-    return av_reverse[x&0xFF]<<24
-         | av_reverse[(x>>8)&0xFF]<<16
-         | av_reverse[(x>>16)&0xFF]<<8
-         | av_reverse[x>>24];
-}
-
-typedef struct {
-    uint8_t bits;
-    uint16_t symbol;
-    /** codeword, with the first bit-to-be-read in the msb
-     * (even if intended for a little-endian bitstream reader) */
-    uint32_t code;
-} VLCcode;
-
-static int compare_vlcspec(const void *a, const void *b)
-{
-    const VLCcode *sa=a, *sb=b;
-    return (sa->code >> 1) - (sb->code >> 1);
-}
-
-/**
- * Build VLC decoding tables suitable for use with get_vlc().
- *
- * @param vlc            the context to be initted
- *
- * @param table_nb_bits  max length of vlc codes to store directly in this table
- *                       (Longer codes are delegated to subtables.)
- *
- * @param nb_codes       number of elements in codes[]
- *
- * @param codes          descriptions of the vlc codes
- *                       These must be ordered such that codes going into the same subtable are contiguous.
- *                       Sorting by VLCcode.code is sufficient, though not necessary.
- */
-static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
-                       VLCcode *codes, int flags)
-{
-    int table_size, table_index, index, code_prefix, symbol, subtable_bits;
-    int i, j, k, n, nb, inc;
-    uint32_t code;
-    VLC_TYPE (*table)[2];
-
-    table_size = 1 << table_nb_bits;
-    table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
-#ifdef DEBUG_VLC
-    av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d\n",
-           table_index, table_size);
-#endif
-    if (table_index < 0)
-        return -1;
-    table = &vlc->table[table_index];
-
-    for (i = 0; i < table_size; i++) {
-        table[i][1] = 0; //bits
-        table[i][0] = -1; //codes
-    }
-
-    /* first pass: map codes and compute auxillary table sizes */
-    for (i = 0; i < nb_codes; i++) {
-        n = codes[i].bits;
-        code = codes[i].code;
-        symbol = codes[i].symbol;
-#if defined(DEBUG_VLC) && 0
-        av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code);
-#endif
-        if (n <= table_nb_bits) {
-            /* no need to add another table */
-            j = code >> (32 - table_nb_bits);
-            nb = 1 << (table_nb_bits - n);
-            inc = 1;
-            if (flags & INIT_VLC_LE) {
-                j = bitswap_32(code);
-                inc = 1 << n;
-            }
-            for (k = 0; k < nb; k++) {
-#ifdef DEBUG_VLC
-                av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
-                       j, i, n);
-#endif
-                if (table[j][1] /*bits*/ != 0) {
-                    av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
-                    return -1;
-                }
-                table[j][1] = n; //bits
-                table[j][0] = symbol;
-                j += inc;
-            }
-        } else {
-            /* fill auxiliary table recursively */
-            n -= table_nb_bits;
-            code_prefix = code >> (32 - table_nb_bits);
-            subtable_bits = n;
-            codes[i].bits = n;
-            codes[i].code = code << table_nb_bits;
-            for (k = i+1; k < nb_codes; k++) {
-                n = codes[k].bits - table_nb_bits;
-                if (n <= 0)
-                    break;
-                code = codes[k].code;
-                if (code >> (32 - table_nb_bits) != code_prefix)
-                    break;
-                codes[k].bits = n;
-                codes[k].code = code << table_nb_bits;
-                subtable_bits = FFMAX(subtable_bits, n);
-            }
-            subtable_bits = FFMIN(subtable_bits, table_nb_bits);
-            j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
-            table[j][1] = -subtable_bits;
-#ifdef DEBUG_VLC
-            av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n",
-                   j, codes[i].bits + table_nb_bits);
-#endif
-            index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
-            if (index < 0)
-                return -1;
-            /* note: realloc has been done, so reload tables */
-            table = &vlc->table[table_index];
-            table[j][0] = index; //code
-            i = k-1;
-        }
-    }
-    return table_index;
-}
-
-
-/* Build VLC decoding tables suitable for use with get_vlc().
-
-   'nb_bits' set thee decoding table size (2^nb_bits) entries. The
-   bigger it is, the faster is the decoding. But it should not be too
-   big to save memory and L1 cache. '9' is a good compromise.
-
-   'nb_codes' : number of vlcs codes
-
-   'bits' : table which gives the size (in bits) of each vlc code.
-
-   'codes' : table which gives the bit pattern of of each vlc code.
-
-   'symbols' : table which gives the values to be returned from get_vlc().
-
-   'xxx_wrap' : give the number of bytes between each entry of the
-   'bits' or 'codes' tables.
-
-   'xxx_size' : gives the number of bytes of each entry of the 'bits'
-   or 'codes' tables.
-
-   'wrap' and 'size' allows to use any memory configuration and types
-   (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables.
-
-   'use_static' should be set to 1 for tables, which should be freed
-   with av_free_static(), 0 if free_vlc() will be used.
-*/
-int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
-             const void *bits, int bits_wrap, int bits_size,
-             const void *codes, int codes_wrap, int codes_size,
-             const void *symbols, int symbols_wrap, int symbols_size,
-             int flags)
-{
-    VLCcode buf[nb_codes];
-    int i, j;
-
-    vlc->bits = nb_bits;
-    if(flags & INIT_VLC_USE_NEW_STATIC){
-        if(vlc->table_size && vlc->table_size == vlc->table_allocated){
-            return 0;
-        }else if(vlc->table_size){
-            abort(); // fatal error, we are called on a partially initialized table
-        }
-    }else {
-        vlc->table = NULL;
-        vlc->table_allocated = 0;
-        vlc->table_size = 0;
-    }
-
-#ifdef DEBUG_VLC
-    av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes);
-#endif
-
-    assert(symbols_size <= 2 || !symbols);
-    j = 0;
-#define COPY(condition)\
-    for (i = 0; i < nb_codes; i++) {\
-        GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size);\
-        if (!(condition))\
-            continue;\
-        GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size);\
-        if (flags & INIT_VLC_LE)\
-            buf[j].code = bitswap_32(buf[j].code);\
-        else\
-            buf[j].code <<= 32 - buf[j].bits;\
-        if (symbols)\
-            GET_DATA(buf[j].symbol, symbols, i, symbols_wrap, symbols_size)\
-        else\
-            buf[j].symbol = i;\
-        j++;\
-    }
-    COPY(buf[j].bits > nb_bits);
-    // qsort is the slowest part of init_vlc, and could probably be improved or avoided
-    qsort(buf, j, sizeof(VLCcode), compare_vlcspec);
-    COPY(buf[j].bits && buf[j].bits <= nb_bits);
-    nb_codes = j;
-
-    if (build_table(vlc, nb_bits, nb_codes, buf, flags) < 0) {
-        av_freep(&vlc->table);
-        return -1;
-    }
-    if((flags & INIT_VLC_USE_NEW_STATIC) && vlc->table_size != vlc->table_allocated)
-        av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated);
-    return 0;
-}
-
-
-void free_vlc(VLC *vlc)
-{
-    av_freep(&vlc->table);
-}
-
diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c
deleted file mode 100644
index 1a6ba39..0000000
--- a/libavcodec/bitstream_filter.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-
-static AVBitStreamFilter *first_bitstream_filter= NULL;
-
-AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f){
-    if(f) return f->next;
-    else  return first_bitstream_filter;
-}
-
-void av_register_bitstream_filter(AVBitStreamFilter *bsf){
-    bsf->next = first_bitstream_filter;
-    first_bitstream_filter= bsf;
-}
-
-AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){
-    AVBitStreamFilter *bsf= first_bitstream_filter;
-
-    while(bsf){
-        if(!strcmp(name, bsf->name)){
-            AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext));
-            bsfc->filter= bsf;
-            bsfc->priv_data= av_mallocz(bsf->priv_data_size);
-            return bsfc;
-        }
-        bsf= bsf->next;
-    }
-    return NULL;
-}
-
-void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc){
-    if(bsfc->filter->close)
-        bsfc->filter->close(bsfc);
-    av_freep(&bsfc->priv_data);
-    av_parser_close(bsfc->parser);
-    av_free(bsfc);
-}
-
-int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
-                               AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    *poutbuf= (uint8_t *) buf;
-    *poutbuf_size= buf_size;
-    return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, buf, buf_size, keyframe);
-}
diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c
deleted file mode 100644
index da7bb78..0000000
--- a/libavcodec/bmp.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * BMP image format decoder
- * Copyright (c) 2005 Mans Rullgard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "bmp.h"
-#include "msrledec.h"
-
-static av_cold int bmp_decode_init(AVCodecContext *avctx){
-    BMPContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults((AVFrame*)&s->picture);
-    avctx->coded_frame = (AVFrame*)&s->picture;
-
-    return 0;
-}
-
-static int bmp_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    BMPContext *s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame *p = &s->picture;
-    unsigned int fsize, hsize;
-    int width, height;
-    unsigned int depth;
-    BiCompression comp;
-    unsigned int ihsize;
-    int i, j, n, linesize;
-    uint32_t rgb[3];
-    uint8_t *ptr;
-    int dsize;
-    const uint8_t *buf0 = buf;
-
-    if(buf_size < 14){
-        av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size);
-        return -1;
-    }
-
-    if(bytestream_get_byte(&buf) != 'B' ||
-       bytestream_get_byte(&buf) != 'M') {
-        av_log(avctx, AV_LOG_ERROR, "bad magic number\n");
-        return -1;
-    }
-
-    fsize = bytestream_get_le32(&buf);
-    if(buf_size < fsize){
-        av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d), trying to decode anyway\n",
-               buf_size, fsize);
-        fsize = buf_size;
-    }
-
-    buf += 2; /* reserved1 */
-    buf += 2; /* reserved2 */
-
-    hsize = bytestream_get_le32(&buf); /* header size */
-    ihsize = bytestream_get_le32(&buf);       /* more header size */
-    if(ihsize + 14 > hsize){
-        av_log(avctx, AV_LOG_ERROR, "invalid header size %d\n", hsize);
-        return -1;
-    }
-
-    /* sometimes file size is set to some headers size, set a real size in that case */
-    if(fsize == 14 || fsize == ihsize + 14)
-        fsize = buf_size - 2;
-
-    if(fsize <= hsize){
-        av_log(avctx, AV_LOG_ERROR, "declared file size is less than header size (%d < %d)\n",
-               fsize, hsize);
-        return -1;
-    }
-
-    switch(ihsize){
-    case  40: // windib v3
-    case  64: // OS/2 v2
-    case 108: // windib v4
-    case 124: // windib v5
-        width = bytestream_get_le32(&buf);
-        height = bytestream_get_le32(&buf);
-        break;
-    case  12: // OS/2 v1
-        width  = bytestream_get_le16(&buf);
-        height = bytestream_get_le16(&buf);
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "unsupported BMP file, patch welcome\n");
-        return -1;
-    }
-
-    if(bytestream_get_le16(&buf) != 1){ /* planes */
-        av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n");
-        return -1;
-    }
-
-    depth = bytestream_get_le16(&buf);
-
-    if(ihsize == 40)
-        comp = bytestream_get_le32(&buf);
-    else
-        comp = BMP_RGB;
-
-    if(comp != BMP_RGB && comp != BMP_BITFIELDS && comp != BMP_RLE4 && comp != BMP_RLE8){
-        av_log(avctx, AV_LOG_ERROR, "BMP coding %d not supported\n", comp);
-        return -1;
-    }
-
-    if(comp == BMP_BITFIELDS){
-        buf += 20;
-        rgb[0] = bytestream_get_le32(&buf);
-        rgb[1] = bytestream_get_le32(&buf);
-        rgb[2] = bytestream_get_le32(&buf);
-    }
-
-    avctx->width = width;
-    avctx->height = height > 0? height: -height;
-
-    avctx->pix_fmt = PIX_FMT_NONE;
-
-    switch(depth){
-    case 32:
-        if(comp == BMP_BITFIELDS){
-            rgb[0] = (rgb[0] >> 15) & 3;
-            rgb[1] = (rgb[1] >> 15) & 3;
-            rgb[2] = (rgb[2] >> 15) & 3;
-
-            if(rgb[0] + rgb[1] + rgb[2] != 3 ||
-               rgb[0] == rgb[1] || rgb[0] == rgb[2] || rgb[1] == rgb[2]){
-                break;
-            }
-        } else {
-            rgb[0] = 2;
-            rgb[1] = 1;
-            rgb[2] = 0;
-        }
-
-        avctx->pix_fmt = PIX_FMT_BGR24;
-        break;
-    case 24:
-        avctx->pix_fmt = PIX_FMT_BGR24;
-        break;
-    case 16:
-        if(comp == BMP_RGB)
-            avctx->pix_fmt = PIX_FMT_RGB555;
-        if(comp == BMP_BITFIELDS)
-            avctx->pix_fmt = rgb[1] == 0x07E0 ? PIX_FMT_RGB565 : PIX_FMT_RGB555;
-        break;
-    case 8:
-        if(hsize - ihsize - 14 > 0)
-            avctx->pix_fmt = PIX_FMT_PAL8;
-        else
-            avctx->pix_fmt = PIX_FMT_GRAY8;
-        break;
-    case 4:
-        if(hsize - ihsize - 14 > 0){
-            avctx->pix_fmt = PIX_FMT_PAL8;
-        }else{
-            av_log(avctx, AV_LOG_ERROR, "Unknown palette for 16-colour BMP\n");
-            return -1;
-        }
-        break;
-    case 1:
-        avctx->pix_fmt = PIX_FMT_MONOBLACK;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "depth %d not supported\n", depth);
-        return -1;
-    }
-
-    if(avctx->pix_fmt == PIX_FMT_NONE){
-        av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");
-        return -1;
-    }
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-
-    buf = buf0 + hsize;
-    dsize = buf_size - hsize;
-
-    /* Line size in file multiple of 4 */
-    n = ((avctx->width * depth) / 8 + 3) & ~3;
-
-    if(n * avctx->height > dsize && comp != BMP_RLE4 && comp != BMP_RLE8){
-        av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
-               dsize, n * avctx->height);
-        return -1;
-    }
-
-    // RLE may skip decoding some picture areas, so blank picture before decoding
-    if(comp == BMP_RLE4 || comp == BMP_RLE8)
-        memset(p->data[0], 0, avctx->height * p->linesize[0]);
-
-    if(depth == 4 || depth == 8)
-        memset(p->data[1], 0, 1024);
-
-    if(height > 0){
-        ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
-        linesize = -p->linesize[0];
-    } else {
-        ptr = p->data[0];
-        linesize = p->linesize[0];
-    }
-
-    if(avctx->pix_fmt == PIX_FMT_PAL8){
-        int colors = 1 << depth;
-        if(ihsize >= 36){
-            int t;
-            buf = buf0 + 46;
-            t = bytestream_get_le32(&buf);
-            if(t < 0 || t > (1 << depth)){
-                av_log(avctx, AV_LOG_ERROR, "Incorrect number of colors - %X for bitdepth %d\n", t, depth);
-            }else if(t){
-                colors = t;
-            }
-        }
-        buf = buf0 + 14 + ihsize; //palette location
-        if((hsize-ihsize-14) < (colors << 2)){ // OS/2 bitmap, 3 bytes per palette entry
-            for(i = 0; i < colors; i++)
-                ((uint32_t*)p->data[1])[i] = bytestream_get_le24(&buf);
-        }else{
-            for(i = 0; i < colors; i++)
-                ((uint32_t*)p->data[1])[i] = bytestream_get_le32(&buf);
-        }
-        buf = buf0 + hsize;
-    }
-    if(comp == BMP_RLE4 || comp == BMP_RLE8){
-        if(height < 0){
-            p->data[0] += p->linesize[0] * (avctx->height - 1);
-            p->linesize[0] = -p->linesize[0];
-        }
-        ff_msrle_decode(avctx, (AVPicture*)p, depth, buf, dsize);
-        if(height < 0){
-            p->data[0] += p->linesize[0] * (avctx->height - 1);
-            p->linesize[0] = -p->linesize[0];
-        }
-    }else{
-        switch(depth){
-        case 1:
-        case 8:
-        case 24:
-            for(i = 0; i < avctx->height; i++){
-                memcpy(ptr, buf, n);
-                buf += n;
-                ptr += linesize;
-            }
-            break;
-        case 4:
-            for(i = 0; i < avctx->height; i++){
-                int j;
-                for(j = 0; j < n; j++){
-                    ptr[j*2+0] = (buf[j] >> 4) & 0xF;
-                    ptr[j*2+1] = buf[j] & 0xF;
-                }
-                buf += n;
-                ptr += linesize;
-            }
-            break;
-        case 16:
-            for(i = 0; i < avctx->height; i++){
-                const uint16_t *src = (const uint16_t *) buf;
-                uint16_t *dst = (uint16_t *) ptr;
-
-                for(j = 0; j < avctx->width; j++)
-                    *dst++ = le2me_16(*src++);
-
-                buf += n;
-                ptr += linesize;
-            }
-            break;
-        case 32:
-            for(i = 0; i < avctx->height; i++){
-                const uint8_t *src = buf;
-                uint8_t *dst = ptr;
-
-                for(j = 0; j < avctx->width; j++){
-                    dst[0] = src[rgb[2]];
-                    dst[1] = src[rgb[1]];
-                    dst[2] = src[rgb[0]];
-                    dst += 3;
-                    src += 4;
-                }
-
-                buf += n;
-                ptr += linesize;
-            }
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "BMP decoder is broken\n");
-            return -1;
-        }
-    }
-
-    *picture = s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return buf_size;
-}
-
-static av_cold int bmp_decode_end(AVCodecContext *avctx)
-{
-    BMPContext* c = avctx->priv_data;
-
-    if (c->picture.data[0])
-        avctx->release_buffer(avctx, &c->picture);
-
-    return 0;
-}
-
-AVCodec bmp_decoder = {
-    "bmp",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_BMP,
-    sizeof(BMPContext),
-    bmp_decode_init,
-    NULL,
-    bmp_decode_end,
-    bmp_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("BMP image"),
-};
diff --git a/libavcodec/bmp.h b/libavcodec/bmp.h
deleted file mode 100644
index b24a1fa..0000000
--- a/libavcodec/bmp.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * internals for BMP codecs
- * Copyright (c) 2005 Mans Rullgard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_BMP_H
-#define AVCODEC_BMP_H
-
-#include "avcodec.h"
-
-typedef struct BMPContext {
-    AVFrame picture;
-} BMPContext;
-
-typedef enum {
-    BMP_RGB         =0,
-    BMP_RLE8        =1,
-    BMP_RLE4        =2,
-    BMP_BITFIELDS   =3,
-} BiCompression;
-
-#endif /* AVCODEC_BMP_H */
diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c
deleted file mode 100644
index ee85f3c..0000000
--- a/libavcodec/bmpenc.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * BMP image format encoder
- * Copyright (c) 2006, 2007 Michel Bardiaux
- * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "bmp.h"
-
-static const uint32_t monoblack_pal[] = { 0x000000, 0xFFFFFF };
-static const uint32_t rgb565_masks[]  = { 0xF800, 0x07E0, 0x001F };
-
-static av_cold int bmp_encode_init(AVCodecContext *avctx){
-    BMPContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults((AVFrame*)&s->picture);
-    avctx->coded_frame = (AVFrame*)&s->picture;
-
-    return 0;
-}
-
-static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    BMPContext *s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= (AVFrame*)&s->picture;
-    int n_bytes_image, n_bytes_per_row, n_bytes, i, n, hsize;
-    const uint32_t *pal = NULL;
-    int pad_bytes_per_row, bit_count, pal_entries = 0, compression = BMP_RGB;
-    uint8_t *ptr;
-    unsigned char* buf0 = buf;
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_BGR24:
-        bit_count = 24;
-        break;
-    case PIX_FMT_RGB555:
-        bit_count = 16;
-        break;
-    case PIX_FMT_RGB565:
-        bit_count = 16;
-        compression = BMP_BITFIELDS;
-        pal = rgb565_masks; // abuse pal to hold color masks
-        pal_entries = 3;
-        break;
-    case PIX_FMT_RGB8:
-    case PIX_FMT_BGR8:
-    case PIX_FMT_RGB4_BYTE:
-    case PIX_FMT_BGR4_BYTE:
-    case PIX_FMT_GRAY8:
-    case PIX_FMT_PAL8:
-        bit_count = 8;
-        pal = (uint32_t *)p->data[1];
-        break;
-    case PIX_FMT_MONOBLACK:
-        bit_count = 1;
-        pal = monoblack_pal;
-        break;
-    default:
-        return -1;
-    }
-    if (pal && !pal_entries) pal_entries = 1 << bit_count;
-    n_bytes_per_row = ((int64_t)avctx->width * (int64_t)bit_count + 7LL) >> 3LL;
-    pad_bytes_per_row = (4 - n_bytes_per_row) & 3;
-    n_bytes_image = avctx->height * (n_bytes_per_row + pad_bytes_per_row);
-
-    // STRUCTURE.field refer to the MSVC documentation for BITMAPFILEHEADER
-    // and related pages.
-#define SIZE_BITMAPFILEHEADER 14
-#define SIZE_BITMAPINFOHEADER 40
-    hsize = SIZE_BITMAPFILEHEADER + SIZE_BITMAPINFOHEADER + (pal_entries << 2);
-    n_bytes = n_bytes_image + hsize;
-    if(n_bytes>buf_size) {
-        av_log(avctx, AV_LOG_ERROR, "buf size too small (need %d, got %d)\n", n_bytes, buf_size);
-        return -1;
-    }
-    bytestream_put_byte(&buf, 'B');                   // BITMAPFILEHEADER.bfType
-    bytestream_put_byte(&buf, 'M');                   // do.
-    bytestream_put_le32(&buf, n_bytes);               // BITMAPFILEHEADER.bfSize
-    bytestream_put_le16(&buf, 0);                     // BITMAPFILEHEADER.bfReserved1
-    bytestream_put_le16(&buf, 0);                     // BITMAPFILEHEADER.bfReserved2
-    bytestream_put_le32(&buf, hsize);                 // BITMAPFILEHEADER.bfOffBits
-    bytestream_put_le32(&buf, SIZE_BITMAPINFOHEADER); // BITMAPINFOHEADER.biSize
-    bytestream_put_le32(&buf, avctx->width);          // BITMAPINFOHEADER.biWidth
-    bytestream_put_le32(&buf, avctx->height);         // BITMAPINFOHEADER.biHeight
-    bytestream_put_le16(&buf, 1);                     // BITMAPINFOHEADER.biPlanes
-    bytestream_put_le16(&buf, bit_count);             // BITMAPINFOHEADER.biBitCount
-    bytestream_put_le32(&buf, compression);           // BITMAPINFOHEADER.biCompression
-    bytestream_put_le32(&buf, n_bytes_image);         // BITMAPINFOHEADER.biSizeImage
-    bytestream_put_le32(&buf, 0);                     // BITMAPINFOHEADER.biXPelsPerMeter
-    bytestream_put_le32(&buf, 0);                     // BITMAPINFOHEADER.biYPelsPerMeter
-    bytestream_put_le32(&buf, 0);                     // BITMAPINFOHEADER.biClrUsed
-    bytestream_put_le32(&buf, 0);                     // BITMAPINFOHEADER.biClrImportant
-    for (i = 0; i < pal_entries; i++)
-        bytestream_put_le32(&buf, pal[i] & 0xFFFFFF);
-    // BMP files are bottom-to-top so we start from the end...
-    ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
-    buf = buf0 + hsize;
-    for(i = 0; i < avctx->height; i++) {
-        if (bit_count == 16) {
-            const uint16_t *src = (const uint16_t *) ptr;
-            uint16_t *dst = (uint16_t *) buf;
-            for(n = 0; n < avctx->width; n++)
-                AV_WL16(dst + n, src[n]);
-        } else {
-            memcpy(buf, ptr, n_bytes_per_row);
-        }
-        buf += n_bytes_per_row;
-        memset(buf, 0, pad_bytes_per_row);
-        buf += pad_bytes_per_row;
-        ptr -= p->linesize[0]; // ... and go back
-    }
-    return n_bytes;
-}
-
-AVCodec bmp_encoder = {
-    "bmp",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_BMP,
-    sizeof(BMPContext),
-    bmp_encode_init,
-    bmp_encode_frame,
-    NULL, //encode_end,
-    .pix_fmts = (const enum PixelFormat[]){
-        PIX_FMT_BGR24,
-        PIX_FMT_RGB555, PIX_FMT_RGB565,
-        PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8,
-        PIX_FMT_MONOBLACK,
-        PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("BMP image"),
-};
diff --git a/libavcodec/bytestream.h b/libavcodec/bytestream.h
deleted file mode 100644
index b56f6ce..0000000
--- a/libavcodec/bytestream.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Bytestream functions
- * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at free.fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_BYTESTREAM_H
-#define AVCODEC_BYTESTREAM_H
-
-#include <string.h>
-#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-
-#define DEF_T(type, name, bytes, read, write)                             \
-static av_always_inline type bytestream_get_ ## name(const uint8_t **b){\
-    (*b) += bytes;\
-    return read(*b - bytes);\
-}\
-static av_always_inline void bytestream_put_ ##name(uint8_t **b, const type value){\
-    write(*b, value);\
-    (*b) += bytes;\
-}
-
-#define DEF(name, bytes, read, write) \
-    DEF_T(unsigned int, name, bytes, read, write)
-#define DEF64(name, bytes, read, write) \
-    DEF_T(uint64_t, name, bytes, read, write)
-
-DEF64(le64, 8, AV_RL64, AV_WL64)
-DEF  (le32, 4, AV_RL32, AV_WL32)
-DEF  (le24, 3, AV_RL24, AV_WL24)
-DEF  (le16, 2, AV_RL16, AV_WL16)
-DEF64(be64, 8, AV_RB64, AV_WB64)
-DEF  (be32, 4, AV_RB32, AV_WB32)
-DEF  (be24, 3, AV_RB24, AV_WB24)
-DEF  (be16, 2, AV_RB16, AV_WB16)
-DEF  (byte, 1, AV_RB8 , AV_WB8 )
-
-#undef DEF
-#undef DEF64
-#undef DEF_T
-
-static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
-{
-    memcpy(dst, *b, size);
-    (*b) += size;
-    return size;
-}
-
-static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
-{
-    memcpy(*b, src, size);
-    (*b) += size;
-}
-
-#endif /* AVCODEC_BYTESTREAM_H */
diff --git a/libavcodec/c93.c b/libavcodec/c93.c
deleted file mode 100644
index d713ff8..0000000
--- a/libavcodec/c93.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Interplay C93 video decoder
- * Copyright (c) 2007 Anssi Hannula <anssi.hannula at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-typedef struct {
-    AVFrame pictures[2];
-    int currentpic;
-} C93DecoderContext;
-
-typedef enum {
-    C93_8X8_FROM_PREV  = 0x02,
-    C93_4X4_FROM_PREV  = 0x06,
-    C93_4X4_FROM_CURR  = 0x07,
-    C93_8X8_2COLOR     = 0x08,
-    C93_4X4_2COLOR     = 0x0A,
-    C93_4X4_4COLOR_GRP = 0x0B,
-    C93_4X4_4COLOR     = 0x0D,
-    C93_NOOP           = 0x0E,
-    C93_8X8_INTRA      = 0x0F,
-} C93BlockType;
-
-#define WIDTH   320
-#define HEIGHT  192
-
-#define C93_HAS_PALETTE 0x01
-#define C93_FIRST_FRAME 0x02
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    C93DecoderContext * const c93 = avctx->priv_data;
-
-    if (c93->pictures[0].data[0])
-        avctx->release_buffer(avctx, &c93->pictures[0]);
-    if (c93->pictures[1].data[0])
-        avctx->release_buffer(avctx, &c93->pictures[1]);
-    return 0;
-}
-
-static inline int copy_block(AVCodecContext *avctx, uint8_t *to,
-        uint8_t *from, int offset, int height, int stride)
-{
-    int i;
-    int width = height;
-    int from_x = offset % WIDTH;
-    int from_y = offset / WIDTH;
-    int overflow = from_x + width - WIDTH;
-
-    if (!from) {
-        /* silently ignoring predictive blocks in first frame */
-        return 0;
-    }
-
-    if (from_y + height > HEIGHT) {
-        av_log(avctx, AV_LOG_ERROR, "invalid offset %d during C93 decoding\n",
-               offset);
-        return -1;
-    }
-
-    if (overflow > 0) {
-        width -= overflow;
-        for (i = 0; i < height; i++) {
-            memcpy(&to[i*stride+width], &from[(from_y+i)*stride], overflow);
-        }
-    }
-
-    for (i = 0; i < height; i++) {
-        memcpy(&to[i*stride], &from[(from_y+i)*stride+from_x], width);
-    }
-
-    return 0;
-}
-
-static inline void draw_n_color(uint8_t *out, int stride, int width,
-         int height, int bpp, uint8_t cols[4], uint8_t grps[4], uint32_t col)
-{
-    int x, y;
-    for (y = 0; y < height; y++) {
-        if (grps)
-            cols[0] = grps[3 * (y >> 1)];
-        for (x = 0; x < width; x++) {
-            if (grps)
-                cols[1]= grps[(x >> 1) + 1];
-            out[x + y*stride] = cols[col & ((1 << bpp) - 1)];
-            col >>= bpp;
-        }
-    }
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data,
-                            int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    C93DecoderContext * const c93 = avctx->priv_data;
-    AVFrame * const newpic = &c93->pictures[c93->currentpic];
-    AVFrame * const oldpic = &c93->pictures[c93->currentpic^1];
-    AVFrame *picture = data;
-    uint8_t *out;
-    int stride, i, x, y, bt = 0;
-
-    c93->currentpic ^= 1;
-
-    newpic->reference = 1;
-    newpic->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
-                         FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
-    if (avctx->reget_buffer(avctx, newpic)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    stride = newpic->linesize[0];
-
-    if (buf[0] & C93_FIRST_FRAME) {
-        newpic->pict_type = FF_I_TYPE;
-        newpic->key_frame = 1;
-    } else {
-        newpic->pict_type = FF_P_TYPE;
-        newpic->key_frame = 0;
-    }
-
-    if (*buf++ & C93_HAS_PALETTE) {
-        uint32_t *palette = (uint32_t *) newpic->data[1];
-        const uint8_t *palbuf = buf + buf_size - 768 - 1;
-        for (i = 0; i < 256; i++) {
-            palette[i] = bytestream_get_be24(&palbuf);
-        }
-    } else {
-        if (oldpic->data[1])
-            memcpy(newpic->data[1], oldpic->data[1], 256 * 4);
-    }
-
-    for (y = 0; y < HEIGHT; y += 8) {
-        out = newpic->data[0] + y * stride;
-        for (x = 0; x < WIDTH; x += 8) {
-            uint8_t *copy_from = oldpic->data[0];
-            unsigned int offset, j;
-            uint8_t cols[4], grps[4];
-            C93BlockType block_type;
-
-            if (!bt)
-                bt = *buf++;
-
-            block_type= bt & 0x0F;
-            switch (block_type) {
-            case C93_8X8_FROM_PREV:
-                offset = bytestream_get_le16(&buf);
-                if (copy_block(avctx, out, copy_from, offset, 8, stride))
-                    return -1;
-                break;
-
-            case C93_4X4_FROM_CURR:
-                copy_from = newpic->data[0];
-            case C93_4X4_FROM_PREV:
-                for (j = 0; j < 8; j += 4) {
-                    for (i = 0; i < 8; i += 4) {
-                        offset = bytestream_get_le16(&buf);
-                        if (copy_block(avctx, &out[j*stride+i],
-                                           copy_from, offset, 4, stride))
-                            return -1;
-                    }
-                }
-                break;
-
-            case C93_8X8_2COLOR:
-                bytestream_get_buffer(&buf, cols, 2);
-                for (i = 0; i < 8; i++) {
-                    draw_n_color(out + i*stride, stride, 8, 1, 1, cols,
-                                     NULL, *buf++);
-                }
-
-                break;
-
-            case C93_4X4_2COLOR:
-            case C93_4X4_4COLOR:
-            case C93_4X4_4COLOR_GRP:
-                for (j = 0; j < 8; j += 4) {
-                    for (i = 0; i < 8; i += 4) {
-                        if (block_type == C93_4X4_2COLOR) {
-                            bytestream_get_buffer(&buf, cols, 2);
-                            draw_n_color(out + i + j*stride, stride, 4, 4,
-                                    1, cols, NULL, bytestream_get_le16(&buf));
-                        } else if (block_type == C93_4X4_4COLOR) {
-                            bytestream_get_buffer(&buf, cols, 4);
-                            draw_n_color(out + i + j*stride, stride, 4, 4,
-                                    2, cols, NULL, bytestream_get_le32(&buf));
-                        } else {
-                            bytestream_get_buffer(&buf, grps, 4);
-                            draw_n_color(out + i + j*stride, stride, 4, 4,
-                                    1, cols, grps, bytestream_get_le16(&buf));
-                        }
-                    }
-                }
-                break;
-
-            case C93_NOOP:
-                break;
-
-            case C93_8X8_INTRA:
-                for (j = 0; j < 8; j++)
-                    bytestream_get_buffer(&buf, out + j*stride, 8);
-                break;
-
-            default:
-                av_log(avctx, AV_LOG_ERROR, "unexpected type %x at %dx%d\n",
-                       block_type, x, y);
-                return -1;
-            }
-            bt >>= 4;
-            out += 8;
-        }
-    }
-
-    *picture = *newpic;
-    *data_size = sizeof(AVFrame);
-
-    return buf_size;
-}
-
-AVCodec c93_decoder = {
-    "c93",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_C93,
-    sizeof(C93DecoderContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Interplay C93"),
-};
diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
deleted file mode 100644
index 7b5e5b1..0000000
--- a/libavcodec/cabac.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Context Adaptive Binary Arithmetic Coder.
- */
-
-#include <string.h>
-
-#include "libavutil/common.h"
-#include "get_bits.h"
-#include "cabac.h"
-
-static const uint8_t lps_range[64][4]= {
-{128,176,208,240}, {128,167,197,227}, {128,158,187,216}, {123,150,178,205},
-{116,142,169,195}, {111,135,160,185}, {105,128,152,175}, {100,122,144,166},
-{ 95,116,137,158}, { 90,110,130,150}, { 85,104,123,142}, { 81, 99,117,135},
-{ 77, 94,111,128}, { 73, 89,105,122}, { 69, 85,100,116}, { 66, 80, 95,110},
-{ 62, 76, 90,104}, { 59, 72, 86, 99}, { 56, 69, 81, 94}, { 53, 65, 77, 89},
-{ 51, 62, 73, 85}, { 48, 59, 69, 80}, { 46, 56, 66, 76}, { 43, 53, 63, 72},
-{ 41, 50, 59, 69}, { 39, 48, 56, 65}, { 37, 45, 54, 62}, { 35, 43, 51, 59},
-{ 33, 41, 48, 56}, { 32, 39, 46, 53}, { 30, 37, 43, 50}, { 29, 35, 41, 48},
-{ 27, 33, 39, 45}, { 26, 31, 37, 43}, { 24, 30, 35, 41}, { 23, 28, 33, 39},
-{ 22, 27, 32, 37}, { 21, 26, 30, 35}, { 20, 24, 29, 33}, { 19, 23, 27, 31},
-{ 18, 22, 26, 30}, { 17, 21, 25, 28}, { 16, 20, 23, 27}, { 15, 19, 22, 25},
-{ 14, 18, 21, 24}, { 14, 17, 20, 23}, { 13, 16, 19, 22}, { 12, 15, 18, 21},
-{ 12, 14, 17, 20}, { 11, 14, 16, 19}, { 11, 13, 15, 18}, { 10, 12, 15, 17},
-{ 10, 12, 14, 16}, {  9, 11, 13, 15}, {  9, 11, 12, 14}, {  8, 10, 12, 14},
-{  8,  9, 11, 13}, {  7,  9, 11, 12}, {  7,  9, 10, 12}, {  7,  8, 10, 11},
-{  6,  8,  9, 11}, {  6,  7,  9, 10}, {  6,  7,  8,  9}, {  2,  2,  2,  2},
-};
-
-uint8_t ff_h264_mlps_state[4*64];
-uint8_t ff_h264_lps_range[4*2*64];
-uint8_t ff_h264_lps_state[2*64];
-uint8_t ff_h264_mps_state[2*64];
-
-static const uint8_t mps_state[64]= {
-  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,
- 57,58,59,60,61,62,62,63,
-};
-
-static const uint8_t lps_state[64]= {
-  0, 0, 1, 2, 2, 4, 4, 5,
-  6, 7, 8, 9, 9,11,11,12,
- 13,13,15,15,16,16,18,18,
- 19,19,21,21,22,22,23,24,
- 24,25,26,26,27,27,28,29,
- 29,30,30,30,31,32,32,33,
- 33,33,34,34,35,35,35,36,
- 36,36,37,37,37,38,38,63,
-};
-#if 0
-const uint8_t ff_h264_norm_shift_old[128]= {
- 7,6,5,5,4,4,4,4,3,3,3,3,3,3,3,3,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-#endif
-const uint8_t ff_h264_norm_shift[512]= {
- 9,8,7,7,6,6,6,6,5,5,5,5,5,5,5,5,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-};
-
-/**
- *
- * @param buf_size size of buf in bits
- */
-void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){
-    init_put_bits(&c->pb, buf, buf_size);
-
-    c->low= 0;
-    c->range= 0x1FE;
-    c->outstanding_count= 0;
-#ifdef STRICT_LIMITS
-    c->sym_count =0;
-#endif
-
-    c->pb.bit_left++; //avoids firstBitFlag
-}
-
-/**
- *
- * @param buf_size size of buf in bits
- */
-void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){
-    c->bytestream_start=
-    c->bytestream= buf;
-    c->bytestream_end= buf + buf_size;
-
-#if CABAC_BITS == 16
-    c->low =  (*c->bytestream++)<<18;
-    c->low+=  (*c->bytestream++)<<10;
-#else
-    c->low =  (*c->bytestream++)<<10;
-#endif
-    c->low+= ((*c->bytestream++)<<2) + 2;
-    c->range= 0x1FE;
-}
-
-void ff_init_cabac_states(CABACContext *c){
-    int i, j;
-
-    for(i=0; i<64; i++){
-        for(j=0; j<4; j++){ //FIXME check if this is worth the 1 shift we save
-            ff_h264_lps_range[j*2*64+2*i+0]=
-            ff_h264_lps_range[j*2*64+2*i+1]= lps_range[i][j];
-        }
-
-        ff_h264_mlps_state[128+2*i+0]=
-        ff_h264_mps_state[2*i+0]= 2*mps_state[i]+0;
-        ff_h264_mlps_state[128+2*i+1]=
-        ff_h264_mps_state[2*i+1]= 2*mps_state[i]+1;
-
-        if( i ){
-#ifdef BRANCHLESS_CABAC_DECODER
-            ff_h264_mlps_state[128-2*i-1]= 2*lps_state[i]+0;
-            ff_h264_mlps_state[128-2*i-2]= 2*lps_state[i]+1;
-        }else{
-            ff_h264_mlps_state[128-2*i-1]= 1;
-            ff_h264_mlps_state[128-2*i-2]= 0;
-#else
-            ff_h264_lps_state[2*i+0]= 2*lps_state[i]+0;
-            ff_h264_lps_state[2*i+1]= 2*lps_state[i]+1;
-        }else{
-            ff_h264_lps_state[2*i+0]= 1;
-            ff_h264_lps_state[2*i+1]= 0;
-#endif
-        }
-    }
-}
-
-#ifdef TEST
-#define SIZE 10240
-
-#include "libavutil/lfg.h"
-#include "avcodec.h"
-#include "cabac.h"
-
-int main(void){
-    CABACContext c;
-    uint8_t b[9*SIZE];
-    uint8_t r[9*SIZE];
-    int i;
-    uint8_t state[10]= {0};
-    AVLFG prng;
-
-    av_lfg_init(&prng, 1);
-    ff_init_cabac_encoder(&c, b, SIZE);
-    ff_init_cabac_states(&c);
-
-    for(i=0; i<SIZE; i++){
-        r[i] = av_lfg_get(&prng) % 7;
-    }
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        put_cabac_bypass(&c, r[i]&1);
-STOP_TIMER("put_cabac_bypass")
-    }
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        put_cabac(&c, state, r[i]&1);
-STOP_TIMER("put_cabac")
-    }
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        put_cabac_u(&c, state, r[i], 6, 3, i&1);
-STOP_TIMER("put_cabac_u")
-    }
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        put_cabac_ueg(&c, state, r[i], 3, 0, 1, 2);
-STOP_TIMER("put_cabac_ueg")
-    }
-
-    put_cabac_terminate(&c, 1);
-
-    ff_init_cabac_decoder(&c, b, SIZE);
-
-    memset(state, 0, sizeof(state));
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        if( (r[i]&1) != get_cabac_bypass(&c) )
-            av_log(NULL, AV_LOG_ERROR, "CABAC bypass failure at %d\n", i);
-STOP_TIMER("get_cabac_bypass")
-    }
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        if( (r[i]&1) != get_cabac(&c, state) )
-            av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
-STOP_TIMER("get_cabac")
-    }
-#if 0
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        if( r[i] != get_cabac_u(&c, state, (i&1) ? 6 : 7, 3, i&1) )
-            av_log(NULL, AV_LOG_ERROR, "CABAC unary (truncated) binarization failure at %d\n", i);
-STOP_TIMER("get_cabac_u")
-    }
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        if( r[i] != get_cabac_ueg(&c, state, 3, 0, 1, 2))
-            av_log(NULL, AV_LOG_ERROR, "CABAC unary (truncated) binarization failure at %d\n", i);
-STOP_TIMER("get_cabac_ueg")
-    }
-#endif
-    if(!get_cabac_terminate(&c))
-        av_log(NULL, AV_LOG_ERROR, "where's the Terminator?\n");
-
-    return 0;
-}
-
-#endif /* TEST */
diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h
deleted file mode 100644
index 0af77e4..0000000
--- a/libavcodec/cabac.h
+++ /dev/null
@@ -1,758 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Context Adaptive Binary Arithmetic Coder.
- */
-
-#ifndef AVCODEC_CABAC_H
-#define AVCODEC_CABAC_H
-
-#include "put_bits.h"
-
-//#undef NDEBUG
-#include <assert.h>
-#include "libavutil/x86_cpu.h"
-
-#define CABAC_BITS 16
-#define CABAC_MASK ((1<<CABAC_BITS)-1)
-#define BRANCHLESS_CABAC_DECODER 1
-//#define ARCH_X86_DISABLED 1
-
-typedef struct CABACContext{
-    int low;
-    int range;
-    int outstanding_count;
-#ifdef STRICT_LIMITS
-    int symCount;
-#endif
-    const uint8_t *bytestream_start;
-    const uint8_t *bytestream;
-    const uint8_t *bytestream_end;
-    PutBitContext pb;
-}CABACContext;
-
-extern uint8_t ff_h264_mlps_state[4*64];
-extern uint8_t ff_h264_lps_range[4*2*64];  ///< rangeTabLPS
-extern uint8_t ff_h264_mps_state[2*64];     ///< transIdxMPS
-extern uint8_t ff_h264_lps_state[2*64];     ///< transIdxLPS
-extern const uint8_t ff_h264_norm_shift[512];
-
-
-void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size);
-void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size);
-void ff_init_cabac_states(CABACContext *c);
-
-
-static inline void put_cabac_bit(CABACContext *c, int b){
-    put_bits(&c->pb, 1, b);
-    for(;c->outstanding_count; c->outstanding_count--){
-        put_bits(&c->pb, 1, 1-b);
-    }
-}
-
-static inline void renorm_cabac_encoder(CABACContext *c){
-    while(c->range < 0x100){
-        //FIXME optimize
-        if(c->low<0x100){
-            put_cabac_bit(c, 0);
-        }else if(c->low<0x200){
-            c->outstanding_count++;
-            c->low -= 0x100;
-        }else{
-            put_cabac_bit(c, 1);
-            c->low -= 0x200;
-        }
-
-        c->range+= c->range;
-        c->low += c->low;
-    }
-}
-
-#ifdef TEST
-static void put_cabac(CABACContext *c, uint8_t * const state, int bit){
-    int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + *state];
-
-    if(bit == ((*state)&1)){
-        c->range -= RangeLPS;
-        *state= ff_h264_mps_state[*state];
-    }else{
-        c->low += c->range - RangeLPS;
-        c->range = RangeLPS;
-        *state= ff_h264_lps_state[*state];
-    }
-
-    renorm_cabac_encoder(c);
-
-#ifdef STRICT_LIMITS
-    c->symCount++;
-#endif
-}
-
-static void put_cabac_static(CABACContext *c, int RangeLPS, int bit){
-    assert(c->range > RangeLPS);
-
-    if(!bit){
-        c->range -= RangeLPS;
-    }else{
-        c->low += c->range - RangeLPS;
-        c->range = RangeLPS;
-    }
-
-    renorm_cabac_encoder(c);
-
-#ifdef STRICT_LIMITS
-    c->symCount++;
-#endif
-}
-
-/**
- * @param bit 0 -> write zero bit, !=0 write one bit
- */
-static void put_cabac_bypass(CABACContext *c, int bit){
-    c->low += c->low;
-
-    if(bit){
-        c->low += c->range;
-    }
-//FIXME optimize
-    if(c->low<0x200){
-        put_cabac_bit(c, 0);
-    }else if(c->low<0x400){
-        c->outstanding_count++;
-        c->low -= 0x200;
-    }else{
-        put_cabac_bit(c, 1);
-        c->low -= 0x400;
-    }
-
-#ifdef STRICT_LIMITS
-    c->symCount++;
-#endif
-}
-
-/**
- *
- * @return the number of bytes written
- */
-static int put_cabac_terminate(CABACContext *c, int bit){
-    c->range -= 2;
-
-    if(!bit){
-        renorm_cabac_encoder(c);
-    }else{
-        c->low += c->range;
-        c->range= 2;
-
-        renorm_cabac_encoder(c);
-
-        assert(c->low <= 0x1FF);
-        put_cabac_bit(c, c->low>>9);
-        put_bits(&c->pb, 2, ((c->low>>7)&3)|1);
-
-        flush_put_bits(&c->pb); //FIXME FIXME FIXME XXX wrong
-    }
-
-#ifdef STRICT_LIMITS
-    c->symCount++;
-#endif
-
-    return (put_bits_count(&c->pb)+7)>>3;
-}
-
-/**
- * put (truncated) unary binarization.
- */
-static void put_cabac_u(CABACContext *c, uint8_t * state, int v, int max, int max_index, int truncated){
-    int i;
-
-    assert(v <= max);
-
-#if 1
-    for(i=0; i<v; i++){
-        put_cabac(c, state, 1);
-        if(i < max_index) state++;
-    }
-    if(truncated==0 || v<max)
-        put_cabac(c, state, 0);
-#else
-    if(v <= max_index){
-        for(i=0; i<v; i++){
-            put_cabac(c, state+i, 1);
-        }
-        if(truncated==0 || v<max)
-            put_cabac(c, state+i, 0);
-    }else{
-        for(i=0; i<=max_index; i++){
-            put_cabac(c, state+i, 1);
-        }
-        for(; i<v; i++){
-            put_cabac(c, state+max_index, 1);
-        }
-        if(truncated==0 || v<max)
-            put_cabac(c, state+max_index, 0);
-    }
-#endif
-}
-
-/**
- * put unary exp golomb k-th order binarization.
- */
-static void put_cabac_ueg(CABACContext *c, uint8_t * state, int v, int max, int is_signed, int k, int max_index){
-    int i;
-
-    if(v==0)
-        put_cabac(c, state, 0);
-    else{
-        const int sign= v < 0;
-
-        if(is_signed) v= FFABS(v);
-
-        if(v<max){
-            for(i=0; i<v; i++){
-                put_cabac(c, state, 1);
-                if(i < max_index) state++;
-            }
-
-            put_cabac(c, state, 0);
-        }else{
-            int m= 1<<k;
-
-            for(i=0; i<max; i++){
-                put_cabac(c, state, 1);
-                if(i < max_index) state++;
-            }
-
-            v -= max;
-            while(v >= m){ //FIXME optimize
-                put_cabac_bypass(c, 1);
-                v-= m;
-                m+= m;
-            }
-            put_cabac_bypass(c, 0);
-            while(m>>=1){
-                put_cabac_bypass(c, v&m);
-            }
-        }
-
-        if(is_signed)
-            put_cabac_bypass(c, sign);
-    }
-}
-#endif /* TEST */
-
-static void refill(CABACContext *c){
-#if CABAC_BITS == 16
-        c->low+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
-#else
-        c->low+= c->bytestream[0]<<1;
-#endif
-    c->low -= CABAC_MASK;
-    c->bytestream+= CABAC_BITS/8;
-}
-
-#if ! ( ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) )
-static void refill2(CABACContext *c){
-    int i, x;
-
-    x= c->low ^ (c->low-1);
-    i= 7 - ff_h264_norm_shift[x>>(CABAC_BITS-1)];
-
-    x= -CABAC_MASK;
-
-#if CABAC_BITS == 16
-        x+= (c->bytestream[0]<<9) + (c->bytestream[1]<<1);
-#else
-        x+= c->bytestream[0]<<1;
-#endif
-
-    c->low += x<<i;
-    c->bytestream+= CABAC_BITS/8;
-}
-#endif
-
-static inline void renorm_cabac_decoder(CABACContext *c){
-    while(c->range < 0x100){
-        c->range+= c->range;
-        c->low+= c->low;
-        if(!(c->low & CABAC_MASK))
-            refill(c);
-    }
-}
-
-static inline void renorm_cabac_decoder_once(CABACContext *c){
-#ifdef ARCH_X86_DISABLED
-    int temp;
-#if 0
-    //P3:683    athlon:475
-    __asm__(
-        "lea -0x100(%0), %2         \n\t"
-        "shr $31, %2                \n\t"  //FIXME 31->63 for x86-64
-        "shl %%cl, %0               \n\t"
-        "shl %%cl, %1               \n\t"
-        : "+r"(c->range), "+r"(c->low), "+c"(temp)
-    );
-#elif 0
-    //P3:680    athlon:474
-    __asm__(
-        "cmp $0x100, %0             \n\t"
-        "setb %%cl                  \n\t"  //FIXME 31->63 for x86-64
-        "shl %%cl, %0               \n\t"
-        "shl %%cl, %1               \n\t"
-        : "+r"(c->range), "+r"(c->low), "+c"(temp)
-    );
-#elif 1
-    int temp2;
-    //P3:665    athlon:517
-    __asm__(
-        "lea -0x100(%0), %%eax      \n\t"
-        "cltd                       \n\t"
-        "mov %0, %%eax              \n\t"
-        "and %%edx, %0              \n\t"
-        "and %1, %%edx              \n\t"
-        "add %%eax, %0              \n\t"
-        "add %%edx, %1              \n\t"
-        : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2)
-    );
-#elif 0
-    int temp2;
-    //P3:673    athlon:509
-    __asm__(
-        "cmp $0x100, %0             \n\t"
-        "sbb %%edx, %%edx           \n\t"
-        "mov %0, %%eax              \n\t"
-        "and %%edx, %0              \n\t"
-        "and %1, %%edx              \n\t"
-        "add %%eax, %0              \n\t"
-        "add %%edx, %1              \n\t"
-        : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2)
-    );
-#else
-    int temp2;
-    //P3:677    athlon:511
-    __asm__(
-        "cmp $0x100, %0             \n\t"
-        "lea (%0, %0), %%eax        \n\t"
-        "lea (%1, %1), %%edx        \n\t"
-        "cmovb %%eax, %0            \n\t"
-        "cmovb %%edx, %1            \n\t"
-        : "+r"(c->range), "+r"(c->low), "+a"(temp), "+d"(temp2)
-    );
-#endif
-#else
-    //P3:675    athlon:476
-    int shift= (uint32_t)(c->range - 0x100)>>31;
-    c->range<<= shift;
-    c->low  <<= shift;
-#endif
-    if(!(c->low & CABAC_MASK))
-        refill(c);
-}
-
-static av_always_inline int get_cabac_inline(CABACContext *c, uint8_t * const state){
-    //FIXME gcc generates duplicate load/stores for c->low and c->range
-#define LOW          "0"
-#define RANGE        "4"
-#if ARCH_X86_64
-#define BYTESTART   "16"
-#define BYTE        "24"
-#define BYTEEND     "32"
-#else
-#define BYTESTART   "12"
-#define BYTE        "16"
-#define BYTEEND     "20"
-#endif
-#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
-    int bit;
-
-#ifndef BRANCHLESS_CABAC_DECODER
-    __asm__ volatile(
-        "movzbl (%1), %0                        \n\t"
-        "movl "RANGE    "(%2), %%ebx            \n\t"
-        "movl "RANGE    "(%2), %%edx            \n\t"
-        "andl $0xC0, %%ebx                      \n\t"
-        "movzbl "MANGLE(ff_h264_lps_range)"(%0, %%ebx, 2), %%esi\n\t"
-        "movl "LOW      "(%2), %%ebx            \n\t"
-//eax:state ebx:low, edx:range, esi:RangeLPS
-        "subl %%esi, %%edx                      \n\t"
-        "movl %%edx, %%ecx                      \n\t"
-        "shll $17, %%ecx                        \n\t"
-        "cmpl %%ecx, %%ebx                      \n\t"
-        " ja 1f                                 \n\t"
-
-#if 1
-        //athlon:4067 P3:4110
-        "lea -0x100(%%edx), %%ecx               \n\t"
-        "shr $31, %%ecx                         \n\t"
-        "shl %%cl, %%edx                        \n\t"
-        "shl %%cl, %%ebx                        \n\t"
-#else
-        //athlon:4057 P3:4130
-        "cmp $0x100, %%edx                      \n\t" //FIXME avoidable
-        "setb %%cl                              \n\t"
-        "shl %%cl, %%edx                        \n\t"
-        "shl %%cl, %%ebx                        \n\t"
-#endif
-        "movzbl "MANGLE(ff_h264_mps_state)"(%0), %%ecx   \n\t"
-        "movb %%cl, (%1)                        \n\t"
-//eax:state ebx:low, edx:range, esi:RangeLPS
-        "test %%bx, %%bx                        \n\t"
-        " jnz 2f                                \n\t"
-        "mov  "BYTE     "(%2), %%"REG_S"        \n\t"
-        "subl $0xFFFF, %%ebx                    \n\t"
-        "movzwl (%%"REG_S"), %%ecx              \n\t"
-        "bswap %%ecx                            \n\t"
-        "shrl $15, %%ecx                        \n\t"
-        "add  $2, %%"REG_S"                     \n\t"
-        "addl %%ecx, %%ebx                      \n\t"
-        "mov  %%"REG_S", "BYTE    "(%2)         \n\t"
-        "jmp 2f                                 \n\t"
-        "1:                                     \n\t"
-//eax:state ebx:low, edx:range, esi:RangeLPS
-        "subl %%ecx, %%ebx                      \n\t"
-        "movl %%esi, %%edx                      \n\t"
-        "movzbl " MANGLE(ff_h264_norm_shift) "(%%esi), %%ecx   \n\t"
-        "shll %%cl, %%ebx                       \n\t"
-        "shll %%cl, %%edx                       \n\t"
-        "movzbl "MANGLE(ff_h264_lps_state)"(%0), %%ecx   \n\t"
-        "movb %%cl, (%1)                        \n\t"
-        "add  $1, %0                            \n\t"
-        "test %%bx, %%bx                        \n\t"
-        " jnz 2f                                \n\t"
-
-        "mov  "BYTE     "(%2), %%"REG_c"        \n\t"
-        "movzwl (%%"REG_c"), %%esi              \n\t"
-        "bswap %%esi                            \n\t"
-        "shrl $15, %%esi                        \n\t"
-        "subl $0xFFFF, %%esi                    \n\t"
-        "add  $2, %%"REG_c"                     \n\t"
-        "mov  %%"REG_c", "BYTE    "(%2)         \n\t"
-
-        "leal -1(%%ebx), %%ecx                  \n\t"
-        "xorl %%ebx, %%ecx                      \n\t"
-        "shrl $15, %%ecx                        \n\t"
-        "movzbl " MANGLE(ff_h264_norm_shift) "(%%ecx), %%ecx   \n\t"
-        "neg %%ecx                              \n\t"
-        "add $7, %%ecx                          \n\t"
-
-        "shll %%cl , %%esi                      \n\t"
-        "addl %%esi, %%ebx                      \n\t"
-        "2:                                     \n\t"
-        "movl %%edx, "RANGE    "(%2)            \n\t"
-        "movl %%ebx, "LOW      "(%2)            \n\t"
-        :"=&a"(bit) //FIXME this is fragile gcc either runs out of registers or miscompiles it (for example if "+a"(bit) or "+m"(*state) is used
-        :"r"(state), "r"(c)
-        : "%"REG_c, "%ebx", "%edx", "%"REG_S, "memory"
-    );
-    bit&=1;
-#else /* BRANCHLESS_CABAC_DECODER */
-
-
-#if HAVE_FAST_CMOV
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\
-        "mov    "tmp"       , %%ecx                                     \n\t"\
-        "shl    $17         , "tmp"                                     \n\t"\
-        "cmp    "low"       , "tmp"                                     \n\t"\
-        "cmova  %%ecx       , "range"                                   \n\t"\
-        "sbb    %%ecx       , %%ecx                                     \n\t"\
-        "and    %%ecx       , "tmp"                                     \n\t"\
-        "sub    "tmp"       , "low"                                     \n\t"\
-        "xor    %%ecx       , "ret"                                     \n\t"
-#else /* HAVE_FAST_CMOV */
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\
-        "mov    "tmp"       , %%ecx                                     \n\t"\
-        "shl    $17         , "tmp"                                     \n\t"\
-        "sub    "low"       , "tmp"                                     \n\t"\
-        "sar    $31         , "tmp"                                     \n\t" /*lps_mask*/\
-        "sub    %%ecx       , "range"                                   \n\t" /*RangeLPS - range*/\
-        "and    "tmp"       , "range"                                   \n\t" /*(RangeLPS - range)&lps_mask*/\
-        "add    %%ecx       , "range"                                   \n\t" /*new range*/\
-        "shl    $17         , %%ecx                                     \n\t"\
-        "and    "tmp"       , %%ecx                                     \n\t"\
-        "sub    %%ecx       , "low"                                     \n\t"\
-        "xor    "tmp"       , "ret"                                     \n\t"
-#endif /* HAVE_FAST_CMOV */
-
-
-#define BRANCHLESS_GET_CABAC(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\
-        "movzbl "statep"    , "ret"                                     \n\t"\
-        "mov    "range"     , "tmp"                                     \n\t"\
-        "and    $0xC0       , "range"                                   \n\t"\
-        "movzbl "MANGLE(ff_h264_lps_range)"("ret", "range", 2), "range" \n\t"\
-        "sub    "range"     , "tmp"                                     \n\t"\
-        BRANCHLESS_GET_CABAC_UPDATE(ret, cabac, statep, low, lowword, range, tmp, tmpbyte)\
-        "movzbl " MANGLE(ff_h264_norm_shift) "("range"), %%ecx          \n\t"\
-        "shl    %%cl        , "range"                                   \n\t"\
-        "movzbl "MANGLE(ff_h264_mlps_state)"+128("ret"), "tmp"          \n\t"\
-        "mov    "tmpbyte"   , "statep"                                  \n\t"\
-        "shl    %%cl        , "low"                                     \n\t"\
-        "test   "lowword"   , "lowword"                                 \n\t"\
-        " jnz   1f                                                      \n\t"\
-        "mov "BYTE"("cabac"), %%"REG_c"                                 \n\t"\
-        "movzwl (%%"REG_c")     , "tmp"                                 \n\t"\
-        "bswap  "tmp"                                                   \n\t"\
-        "shr    $15         , "tmp"                                     \n\t"\
-        "sub    $0xFFFF     , "tmp"                                     \n\t"\
-        "add    $2          , %%"REG_c"                                 \n\t"\
-        "mov    %%"REG_c"   , "BYTE    "("cabac")                       \n\t"\
-        "lea    -1("low")   , %%ecx                                     \n\t"\
-        "xor    "low"       , %%ecx                                     \n\t"\
-        "shr    $15         , %%ecx                                     \n\t"\
-        "movzbl " MANGLE(ff_h264_norm_shift) "(%%ecx), %%ecx            \n\t"\
-        "neg    %%ecx                                                   \n\t"\
-        "add    $7          , %%ecx                                     \n\t"\
-        "shl    %%cl        , "tmp"                                     \n\t"\
-        "add    "tmp"       , "low"                                     \n\t"\
-        "1:                                                             \n\t"
-
-    __asm__ volatile(
-        "movl "RANGE    "(%2), %%esi            \n\t"
-        "movl "LOW      "(%2), %%ebx            \n\t"
-        BRANCHLESS_GET_CABAC("%0", "%2", "(%1)", "%%ebx", "%%bx", "%%esi", "%%edx", "%%dl")
-        "movl %%esi, "RANGE    "(%2)            \n\t"
-        "movl %%ebx, "LOW      "(%2)            \n\t"
-
-        :"=&a"(bit)
-        :"r"(state), "r"(c)
-        : "%"REG_c, "%ebx", "%edx", "%esi", "memory"
-    );
-    bit&=1;
-#endif /* BRANCHLESS_CABAC_DECODER */
-#else /* ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) */
-    int s = *state;
-    int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s];
-    int bit, lps_mask av_unused;
-
-    c->range -= RangeLPS;
-#ifndef BRANCHLESS_CABAC_DECODER
-    if(c->low < (c->range<<(CABAC_BITS+1))){
-        bit= s&1;
-        *state= ff_h264_mps_state[s];
-        renorm_cabac_decoder_once(c);
-    }else{
-        bit= ff_h264_norm_shift[RangeLPS];
-        c->low -= (c->range<<(CABAC_BITS+1));
-        *state= ff_h264_lps_state[s];
-        c->range = RangeLPS<<bit;
-        c->low <<= bit;
-        bit= (s&1)^1;
-
-        if(!(c->low & CABAC_MASK)){
-            refill2(c);
-        }
-    }
-#else /* BRANCHLESS_CABAC_DECODER */
-    lps_mask= ((c->range<<(CABAC_BITS+1)) - c->low)>>31;
-
-    c->low -= (c->range<<(CABAC_BITS+1)) & lps_mask;
-    c->range += (RangeLPS - c->range) & lps_mask;
-
-    s^=lps_mask;
-    *state= (ff_h264_mlps_state+128)[s];
-    bit= s&1;
-
-    lps_mask= ff_h264_norm_shift[c->range];
-    c->range<<= lps_mask;
-    c->low  <<= lps_mask;
-    if(!(c->low & CABAC_MASK))
-        refill2(c);
-#endif /* BRANCHLESS_CABAC_DECODER */
-#endif /* ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS) */
-    return bit;
-}
-
-static int av_noinline av_unused get_cabac_noinline(CABACContext *c, uint8_t * const state){
-    return get_cabac_inline(c,state);
-}
-
-static int av_unused get_cabac(CABACContext *c, uint8_t * const state){
-    return get_cabac_inline(c,state);
-}
-
-static int av_unused get_cabac_bypass(CABACContext *c){
-#if 0 //not faster
-    int bit;
-    __asm__ volatile(
-        "movl "RANGE    "(%1), %%ebx            \n\t"
-        "movl "LOW      "(%1), %%eax            \n\t"
-        "shl $17, %%ebx                         \n\t"
-        "add %%eax, %%eax                       \n\t"
-        "sub %%ebx, %%eax                       \n\t"
-        "cltd                                   \n\t"
-        "and %%edx, %%ebx                       \n\t"
-        "add %%ebx, %%eax                       \n\t"
-        "test %%ax, %%ax                        \n\t"
-        " jnz 1f                                \n\t"
-        "movl "BYTE     "(%1), %%"REG_b"        \n\t"
-        "subl $0xFFFF, %%eax                    \n\t"
-        "movzwl (%%"REG_b"), %%ecx              \n\t"
-        "bswap %%ecx                            \n\t"
-        "shrl $15, %%ecx                        \n\t"
-        "addl $2, %%"REG_b"                     \n\t"
-        "addl %%ecx, %%eax                      \n\t"
-        "movl %%"REG_b", "BYTE     "(%1)        \n\t"
-        "1:                                     \n\t"
-        "movl %%eax, "LOW      "(%1)            \n\t"
-
-        :"=&d"(bit)
-        :"r"(c)
-        : "%eax", "%"REG_b, "%ecx", "memory"
-    );
-    return bit+1;
-#else
-    int range;
-    c->low += c->low;
-
-    if(!(c->low & CABAC_MASK))
-        refill(c);
-
-    range= c->range<<(CABAC_BITS+1);
-    if(c->low < range){
-        return 0;
-    }else{
-        c->low -= range;
-        return 1;
-    }
-#endif
-}
-
-
-static av_always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
-#if ARCH_X86 && HAVE_EBX_AVAILABLE
-    __asm__ volatile(
-        "movl "RANGE    "(%1), %%ebx            \n\t"
-        "movl "LOW      "(%1), %%eax            \n\t"
-        "shl $17, %%ebx                         \n\t"
-        "add %%eax, %%eax                       \n\t"
-        "sub %%ebx, %%eax                       \n\t"
-        "cltd                                   \n\t"
-        "and %%edx, %%ebx                       \n\t"
-        "add %%ebx, %%eax                       \n\t"
-        "xor %%edx, %%ecx                       \n\t"
-        "sub %%edx, %%ecx                       \n\t"
-        "test %%ax, %%ax                        \n\t"
-        " jnz 1f                                \n\t"
-        "mov  "BYTE     "(%1), %%"REG_b"        \n\t"
-        "subl $0xFFFF, %%eax                    \n\t"
-        "movzwl (%%"REG_b"), %%edx              \n\t"
-        "bswap %%edx                            \n\t"
-        "shrl $15, %%edx                        \n\t"
-        "add  $2, %%"REG_b"                     \n\t"
-        "addl %%edx, %%eax                      \n\t"
-        "mov  %%"REG_b", "BYTE     "(%1)        \n\t"
-        "1:                                     \n\t"
-        "movl %%eax, "LOW      "(%1)            \n\t"
-
-        :"+c"(val)
-        :"r"(c)
-        : "%eax", "%"REG_b, "%edx", "memory"
-    );
-    return val;
-#else
-    int range, mask;
-    c->low += c->low;
-
-    if(!(c->low & CABAC_MASK))
-        refill(c);
-
-    range= c->range<<(CABAC_BITS+1);
-    c->low -= range;
-    mask= c->low >> 31;
-    range &= mask;
-    c->low += range;
-    return (val^mask)-mask;
-#endif
-}
-
-/**
- *
- * @return the number of bytes read or 0 if no end
- */
-static int av_unused get_cabac_terminate(CABACContext *c){
-    c->range -= 2;
-    if(c->low < c->range<<(CABAC_BITS+1)){
-        renorm_cabac_decoder_once(c);
-        return 0;
-    }else{
-        return c->bytestream - c->bytestream_start;
-    }
-}
-
-#if 0
-/**
- * Get (truncated) unary binarization.
- */
-static int get_cabac_u(CABACContext *c, uint8_t * state, int max, int max_index, int truncated){
-    int i;
-
-    for(i=0; i<max; i++){
-        if(get_cabac(c, state)==0)
-            return i;
-
-        if(i< max_index) state++;
-    }
-
-    return truncated ? max : -1;
-}
-
-/**
- * get unary exp golomb k-th order binarization.
- */
-static int get_cabac_ueg(CABACContext *c, uint8_t * state, int max, int is_signed, int k, int max_index){
-    int i, v;
-    int m= 1<<k;
-
-    if(get_cabac(c, state)==0)
-        return 0;
-
-    if(0 < max_index) state++;
-
-    for(i=1; i<max; i++){
-        if(get_cabac(c, state)==0){
-            if(is_signed && get_cabac_bypass(c)){
-                return -i;
-            }else
-                return i;
-        }
-
-        if(i < max_index) state++;
-    }
-
-    while(get_cabac_bypass(c)){
-        i+= m;
-        m+= m;
-    }
-
-    v=0;
-    while(m>>=1){
-        v+= v + get_cabac_bypass(c);
-    }
-    i += v;
-
-    if(is_signed && get_cabac_bypass(c)){
-        return -i;
-    }else
-        return i;
-}
-#endif /* 0 */
-
-#endif /* AVCODEC_CABAC_H */
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
deleted file mode 100644
index ff6c869..0000000
--- a/libavcodec/cavs.c
+++ /dev/null
@@ -1,715 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
- * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder
- * @author Stefan Gehrer <stefan.gehrer at gmx.de>
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-#include "mathops.h"
-#include "cavs.h"
-#include "cavsdata.h"
-
-/*****************************************************************************
- *
- * in-loop deblocking filter
- *
- ****************************************************************************/
-
-static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) {
-    if((mvP->ref == REF_INTRA) || (mvQ->ref == REF_INTRA))
-        return 2;
-    if( (abs(mvP->x - mvQ->x) >= 4) ||  (abs(mvP->y - mvQ->y) >= 4) )
-        return 1;
-    if(b){
-        mvP += MV_BWD_OFFS;
-        mvQ += MV_BWD_OFFS;
-        if( (abs(mvP->x - mvQ->x) >= 4) ||  (abs(mvP->y - mvQ->y) >= 4) )
-            return 1;
-    }else{
-        if(mvP->ref != mvQ->ref)
-            return 1;
-    }
-    return 0;
-}
-
-#define SET_PARAMS                                            \
-    alpha = alpha_tab[av_clip(qp_avg + h->alpha_offset,0,63)];   \
-    beta  =  beta_tab[av_clip(qp_avg + h->beta_offset, 0,63)];   \
-    tc    =    tc_tab[av_clip(qp_avg + h->alpha_offset,0,63)];
-
-/**
- * in-loop deblocking filter for a single macroblock
- *
- * boundary strength (bs) mapping:
- *
- * --4---5--
- * 0   2   |
- * | 6 | 7 |
- * 1   3   |
- * ---------
- *
- */
-void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) {
-    uint8_t bs[8];
-    int qp_avg, alpha, beta, tc;
-    int i;
-
-    /* save un-deblocked lines */
-    h->topleft_border_y = h->top_border_y[h->mbx*16+15];
-    h->topleft_border_u = h->top_border_u[h->mbx*10+8];
-    h->topleft_border_v = h->top_border_v[h->mbx*10+8];
-    memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16);
-    memcpy(&h->top_border_u[h->mbx*10+1], h->cu +  7* h->c_stride,8);
-    memcpy(&h->top_border_v[h->mbx*10+1], h->cv +  7* h->c_stride,8);
-    for(i=0;i<8;i++) {
-        h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+0)*h->l_stride);
-        h->left_border_y[i*2+2] = *(h->cy + 15 + (i*2+1)*h->l_stride);
-        h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride);
-        h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride);
-    }
-    if(!h->loop_filter_disable) {
-        /* determine bs */
-        if(mb_type == I_8X8)
-            memset(bs,2,8);
-        else{
-            memset(bs,0,8);
-            if(ff_cavs_partition_flags[mb_type] & SPLITV){
-                bs[2] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X1], mb_type > P_8X8);
-                bs[3] = get_bs(&h->mv[MV_FWD_X2], &h->mv[MV_FWD_X3], mb_type > P_8X8);
-            }
-            if(ff_cavs_partition_flags[mb_type] & SPLITH){
-                bs[6] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X2], mb_type > P_8X8);
-                bs[7] = get_bs(&h->mv[MV_FWD_X1], &h->mv[MV_FWD_X3], mb_type > P_8X8);
-            }
-            bs[0] = get_bs(&h->mv[MV_FWD_A1], &h->mv[MV_FWD_X0], mb_type > P_8X8);
-            bs[1] = get_bs(&h->mv[MV_FWD_A3], &h->mv[MV_FWD_X2], mb_type > P_8X8);
-            bs[4] = get_bs(&h->mv[MV_FWD_B2], &h->mv[MV_FWD_X0], mb_type > P_8X8);
-            bs[5] = get_bs(&h->mv[MV_FWD_B3], &h->mv[MV_FWD_X1], mb_type > P_8X8);
-        }
-        if(AV_RN64(bs)) {
-            if(h->flags & A_AVAIL) {
-                qp_avg = (h->qp + h->left_qp + 1) >> 1;
-                SET_PARAMS;
-                h->s.dsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs[1]);
-                h->s.dsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
-                h->s.dsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs[1]);
-            }
-            qp_avg = h->qp;
-            SET_PARAMS;
-            h->s.dsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs[3]);
-            h->s.dsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc,
-                           bs[6],bs[7]);
-
-            if(h->flags & B_AVAIL) {
-                qp_avg = (h->qp + h->top_qp[h->mbx] + 1) >> 1;
-                SET_PARAMS;
-                h->s.dsp.cavs_filter_lh(h->cy,h->l_stride,alpha,beta,tc,bs[4],bs[5]);
-                h->s.dsp.cavs_filter_ch(h->cu,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
-                h->s.dsp.cavs_filter_ch(h->cv,h->c_stride,alpha,beta,tc,bs[4],bs[5]);
-            }
-        }
-    }
-    h->left_qp = h->qp;
-    h->top_qp[h->mbx] = h->qp;
-}
-
-#undef SET_PARAMS
-
-/*****************************************************************************
- *
- * spatial intra prediction
- *
- ****************************************************************************/
-
-void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top,
-                                        uint8_t **left, int block) {
-    int i;
-
-    switch(block) {
-    case 0:
-        *left = h->left_border_y;
-        h->left_border_y[0] = h->left_border_y[1];
-        memset(&h->left_border_y[17],h->left_border_y[16],9);
-        memcpy(&top[1],&h->top_border_y[h->mbx*16],16);
-        top[17] = top[16];
-        top[0] = top[1];
-        if((h->flags & A_AVAIL) && (h->flags & B_AVAIL))
-            h->left_border_y[0] = top[0] = h->topleft_border_y;
-        break;
-    case 1:
-        *left = h->intern_border_y;
-        for(i=0;i<8;i++)
-            h->intern_border_y[i+1] = *(h->cy + 7 + i*h->l_stride);
-        memset(&h->intern_border_y[9],h->intern_border_y[8],9);
-        h->intern_border_y[0] = h->intern_border_y[1];
-        memcpy(&top[1],&h->top_border_y[h->mbx*16+8],8);
-        if(h->flags & C_AVAIL)
-            memcpy(&top[9],&h->top_border_y[(h->mbx + 1)*16],8);
-        else
-            memset(&top[9],top[8],9);
-        top[17] = top[16];
-        top[0] = top[1];
-        if(h->flags & B_AVAIL)
-            h->intern_border_y[0] = top[0] = h->top_border_y[h->mbx*16+7];
-        break;
-    case 2:
-        *left = &h->left_border_y[8];
-        memcpy(&top[1],h->cy + 7*h->l_stride,16);
-        top[17] = top[16];
-        top[0] = top[1];
-        if(h->flags & A_AVAIL)
-            top[0] = h->left_border_y[8];
-        break;
-    case 3:
-        *left = &h->intern_border_y[8];
-        for(i=0;i<8;i++)
-            h->intern_border_y[i+9] = *(h->cy + 7 + (i+8)*h->l_stride);
-        memset(&h->intern_border_y[17],h->intern_border_y[16],9);
-        memcpy(&top[0],h->cy + 7 + 7*h->l_stride,9);
-        memset(&top[9],top[8],9);
-        break;
-    }
-}
-
-void ff_cavs_load_intra_pred_chroma(AVSContext *h) {
-    /* extend borders by one pixel */
-    h->left_border_u[9] = h->left_border_u[8];
-    h->left_border_v[9] = h->left_border_v[8];
-    h->top_border_u[h->mbx*10+9] = h->top_border_u[h->mbx*10+8];
-    h->top_border_v[h->mbx*10+9] = h->top_border_v[h->mbx*10+8];
-    if(h->mbx && h->mby) {
-        h->top_border_u[h->mbx*10] = h->left_border_u[0] = h->topleft_border_u;
-        h->top_border_v[h->mbx*10] = h->left_border_v[0] = h->topleft_border_v;
-    } else {
-        h->left_border_u[0] = h->left_border_u[1];
-        h->left_border_v[0] = h->left_border_v[1];
-        h->top_border_u[h->mbx*10] = h->top_border_u[h->mbx*10+1];
-        h->top_border_v[h->mbx*10] = h->top_border_v[h->mbx*10+1];
-    }
-}
-
-static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int y;
-    uint64_t a = AV_RN64(&top[1]);
-    for(y=0;y<8;y++) {
-        *((uint64_t *)(d+y*stride)) = a;
-    }
-}
-
-static void intra_pred_horiz(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int y;
-    uint64_t a;
-    for(y=0;y<8;y++) {
-        a = left[y+1] * 0x0101010101010101ULL;
-        *((uint64_t *)(d+y*stride)) = a;
-    }
-}
-
-static void intra_pred_dc_128(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int y;
-    uint64_t a = 0x8080808080808080ULL;
-    for(y=0;y<8;y++)
-        *((uint64_t *)(d+y*stride)) = a;
-}
-
-static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int x,y,ia;
-    int ih = 0;
-    int iv = 0;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    for(x=0; x<4; x++) {
-        ih += (x+1)*(top[5+x]-top[3-x]);
-        iv += (x+1)*(left[5+x]-left[3-x]);
-    }
-    ia = (top[8]+left[8])<<4;
-    ih = (17*ih+16)>>5;
-    iv = (17*iv+16)>>5;
-    for(y=0; y<8; y++)
-        for(x=0; x<8; x++)
-            d[y*stride+x] = cm[(ia+(x-3)*ih+(y-3)*iv+16)>>5];
-}
-
-#define LOWPASS(ARRAY,INDEX)                                            \
-    (( ARRAY[(INDEX)-1] + 2*ARRAY[(INDEX)] + ARRAY[(INDEX)+1] + 2) >> 2)
-
-static void intra_pred_lp(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int x,y;
-    for(y=0; y<8; y++)
-        for(x=0; x<8; x++)
-            d[y*stride+x] = (LOWPASS(top,x+1) + LOWPASS(left,y+1)) >> 1;
-}
-
-static void intra_pred_down_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int x,y;
-    for(y=0; y<8; y++)
-        for(x=0; x<8; x++)
-            d[y*stride+x] = (LOWPASS(top,x+y+2) + LOWPASS(left,x+y+2)) >> 1;
-}
-
-static void intra_pred_down_right(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int x,y;
-    for(y=0; y<8; y++)
-        for(x=0; x<8; x++)
-            if(x==y)
-                d[y*stride+x] = (left[1]+2*top[0]+top[1]+2)>>2;
-            else if(x>y)
-                d[y*stride+x] = LOWPASS(top,x-y);
-            else
-                d[y*stride+x] = LOWPASS(left,y-x);
-}
-
-static void intra_pred_lp_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int x,y;
-    for(y=0; y<8; y++)
-        for(x=0; x<8; x++)
-            d[y*stride+x] = LOWPASS(left,y+1);
-}
-
-static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride) {
-    int x,y;
-    for(y=0; y<8; y++)
-        for(x=0; x<8; x++)
-            d[y*stride+x] = LOWPASS(top,x+1);
-}
-
-#undef LOWPASS
-
-void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) {
-    /* save pred modes before they get modified */
-    h->pred_mode_Y[3] =  h->pred_mode_Y[5];
-    h->pred_mode_Y[6] =  h->pred_mode_Y[8];
-    h->top_pred_Y[h->mbx*2+0] = h->pred_mode_Y[7];
-    h->top_pred_Y[h->mbx*2+1] = h->pred_mode_Y[8];
-
-    /* modify pred modes according to availability of neighbour samples */
-    if(!(h->flags & A_AVAIL)) {
-        modify_pred(ff_left_modifier_l, &h->pred_mode_Y[4] );
-        modify_pred(ff_left_modifier_l, &h->pred_mode_Y[7] );
-        modify_pred(ff_left_modifier_c, pred_mode_uv );
-    }
-    if(!(h->flags & B_AVAIL)) {
-        modify_pred(ff_top_modifier_l, &h->pred_mode_Y[4] );
-        modify_pred(ff_top_modifier_l, &h->pred_mode_Y[5] );
-        modify_pred(ff_top_modifier_c, pred_mode_uv );
-    }
-}
-
-/*****************************************************************************
- *
- * motion compensation
- *
- ****************************************************************************/
-
-static inline void mc_dir_part(AVSContext *h,Picture *pic,int square,
-                        int chroma_height,int delta,int list,uint8_t *dest_y,
-                        uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset,
-                        int src_y_offset,qpel_mc_func *qpix_op,
-                        h264_chroma_mc_func chroma_op,cavs_vector *mv){
-    MpegEncContext * const s = &h->s;
-    const int mx= mv->x + src_x_offset*8;
-    const int my= mv->y + src_y_offset*8;
-    const int luma_xy= (mx&3) + ((my&3)<<2);
-    uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->l_stride;
-    uint8_t * src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->c_stride;
-    uint8_t * src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->c_stride;
-    int extra_width= 0; //(s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16;
-    int extra_height= extra_width;
-    int emu=0;
-    const int full_mx= mx>>2;
-    const int full_my= my>>2;
-    const int pic_width  = 16*h->mb_width;
-    const int pic_height = 16*h->mb_height;
-
-    if(!pic->data[0])
-        return;
-    if(mx&7) extra_width -= 3;
-    if(my&7) extra_height -= 3;
-
-    if(   full_mx < 0-extra_width
-          || full_my < 0-extra_height
-          || full_mx + 16/*FIXME*/ > pic_width + extra_width
-          || full_my + 16/*FIXME*/ > pic_height + extra_height){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride,
-                            16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
-        src_y= s->edge_emu_buffer + 2 + 2*h->l_stride;
-        emu=1;
-    }
-
-    qpix_op[luma_xy](dest_y, src_y, h->l_stride); //FIXME try variable height perhaps?
-    if(!square){
-        qpix_op[luma_xy](dest_y + delta, src_y + delta, h->l_stride);
-    }
-
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride,
-                            9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
-        src_cb= s->edge_emu_buffer;
-    }
-    chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7);
-
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride,
-                            9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
-        src_cr= s->edge_emu_buffer;
-    }
-    chroma_op(dest_cr, src_cr, h->c_stride, chroma_height, mx&7, my&7);
-}
-
-static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int delta,
-                        uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr,
-                        int x_offset, int y_offset,qpel_mc_func *qpix_put,
-                        h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg,
-                        h264_chroma_mc_func chroma_avg, cavs_vector *mv){
-    qpel_mc_func *qpix_op=  qpix_put;
-    h264_chroma_mc_func chroma_op= chroma_put;
-
-    dest_y  += 2*x_offset + 2*y_offset*h->l_stride;
-    dest_cb +=   x_offset +   y_offset*h->c_stride;
-    dest_cr +=   x_offset +   y_offset*h->c_stride;
-    x_offset += 8*h->mbx;
-    y_offset += 8*h->mby;
-
-    if(mv->ref >= 0){
-        Picture *ref= &h->DPB[mv->ref];
-        mc_dir_part(h, ref, square, chroma_height, delta, 0,
-                    dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                    qpix_op, chroma_op, mv);
-
-        qpix_op=  qpix_avg;
-        chroma_op= chroma_avg;
-    }
-
-    if((mv+MV_BWD_OFFS)->ref >= 0){
-        Picture *ref= &h->DPB[0];
-        mc_dir_part(h, ref, square, chroma_height, delta, 1,
-                    dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                    qpix_op, chroma_op, mv+MV_BWD_OFFS);
-    }
-}
-
-void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) {
-    if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16
-        mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0,
-                h->s.dsp.put_cavs_qpel_pixels_tab[0],
-                h->s.dsp.put_h264_chroma_pixels_tab[0],
-                h->s.dsp.avg_cavs_qpel_pixels_tab[0],
-                h->s.dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]);
-    }else{
-        mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 0,
-                h->s.dsp.put_cavs_qpel_pixels_tab[1],
-                h->s.dsp.put_h264_chroma_pixels_tab[1],
-                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
-                h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]);
-        mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 0,
-                h->s.dsp.put_cavs_qpel_pixels_tab[1],
-                h->s.dsp.put_h264_chroma_pixels_tab[1],
-                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
-                h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]);
-        mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 4,
-                h->s.dsp.put_cavs_qpel_pixels_tab[1],
-                h->s.dsp.put_h264_chroma_pixels_tab[1],
-                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
-                h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]);
-        mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 4,
-                h->s.dsp.put_cavs_qpel_pixels_tab[1],
-                h->s.dsp.put_h264_chroma_pixels_tab[1],
-                h->s.dsp.avg_cavs_qpel_pixels_tab[1],
-                h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X3]);
-    }
-}
-
-/*****************************************************************************
- *
- * motion vector prediction
- *
- ****************************************************************************/
-
-static inline void scale_mv(AVSContext *h, int *d_x, int *d_y, cavs_vector *src, int distp) {
-    int den = h->scale_den[src->ref];
-
-    *d_x = (src->x*distp*den + 256 + (src->x>>31)) >> 9;
-    *d_y = (src->y*distp*den + 256 + (src->y>>31)) >> 9;
-}
-
-static inline void mv_pred_median(AVSContext *h, cavs_vector *mvP,
-                        cavs_vector *mvA, cavs_vector *mvB, cavs_vector *mvC) {
-    int ax, ay, bx, by, cx, cy;
-    int len_ab, len_bc, len_ca, len_mid;
-
-    /* scale candidates according to their temporal span */
-    scale_mv(h, &ax, &ay, mvA, mvP->dist);
-    scale_mv(h, &bx, &by, mvB, mvP->dist);
-    scale_mv(h, &cx, &cy, mvC, mvP->dist);
-    /* find the geometrical median of the three candidates */
-    len_ab = abs(ax - bx) + abs(ay - by);
-    len_bc = abs(bx - cx) + abs(by - cy);
-    len_ca = abs(cx - ax) + abs(cy - ay);
-    len_mid = mid_pred(len_ab, len_bc, len_ca);
-    if(len_mid == len_ab) {
-        mvP->x = cx;
-        mvP->y = cy;
-    } else if(len_mid == len_bc) {
-        mvP->x = ax;
-        mvP->y = ay;
-    } else {
-        mvP->x = bx;
-        mvP->y = by;
-    }
-}
-
-void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC,
-                enum cavs_mv_pred mode, enum cavs_block size, int ref) {
-    cavs_vector *mvP = &h->mv[nP];
-    cavs_vector *mvA = &h->mv[nP-1];
-    cavs_vector *mvB = &h->mv[nP-4];
-    cavs_vector *mvC = &h->mv[nC];
-    const cavs_vector *mvP2 = NULL;
-
-    mvP->ref = ref;
-    mvP->dist = h->dist[mvP->ref];
-    if(mvC->ref == NOT_AVAIL)
-        mvC = &h->mv[nP-5]; // set to top-left (mvD)
-    if((mode == MV_PRED_PSKIP) &&
-       ((mvA->ref == NOT_AVAIL) || (mvB->ref == NOT_AVAIL) ||
-           ((mvA->x | mvA->y | mvA->ref) == 0)  ||
-           ((mvB->x | mvB->y | mvB->ref) == 0) )) {
-        mvP2 = &ff_cavs_un_mv;
-    /* if there is only one suitable candidate, take it */
-    } else if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) {
-        mvP2= mvA;
-    } else if((mvA->ref < 0) && (mvB->ref >= 0) && (mvC->ref < 0)) {
-        mvP2= mvB;
-    } else if((mvA->ref < 0) && (mvB->ref < 0) && (mvC->ref >= 0)) {
-        mvP2= mvC;
-    } else if(mode == MV_PRED_LEFT     && mvA->ref == ref){
-        mvP2= mvA;
-    } else if(mode == MV_PRED_TOP      && mvB->ref == ref){
-        mvP2= mvB;
-    } else if(mode == MV_PRED_TOPRIGHT && mvC->ref == ref){
-        mvP2= mvC;
-    }
-    if(mvP2){
-        mvP->x = mvP2->x;
-        mvP->y = mvP2->y;
-    }else
-        mv_pred_median(h, mvP, mvA, mvB, mvC);
-
-    if(mode < MV_PRED_PSKIP) {
-        mvP->x += get_se_golomb(&h->s.gb);
-        mvP->y += get_se_golomb(&h->s.gb);
-    }
-    set_mvs(mvP,size);
-}
-
-/*****************************************************************************
- *
- * macroblock level
- *
- ****************************************************************************/
-
-/**
- * initialise predictors for motion vectors and intra prediction
- */
-void ff_cavs_init_mb(AVSContext *h) {
-    int i;
-
-    /* copy predictors from top line (MB B and C) into cache */
-    for(i=0;i<3;i++) {
-        h->mv[MV_FWD_B2+i] = h->top_mv[0][h->mbx*2+i];
-        h->mv[MV_BWD_B2+i] = h->top_mv[1][h->mbx*2+i];
-    }
-    h->pred_mode_Y[1] = h->top_pred_Y[h->mbx*2+0];
-    h->pred_mode_Y[2] = h->top_pred_Y[h->mbx*2+1];
-    /* clear top predictors if MB B is not available */
-    if(!(h->flags & B_AVAIL)) {
-        h->mv[MV_FWD_B2] = ff_cavs_un_mv;
-        h->mv[MV_FWD_B3] = ff_cavs_un_mv;
-        h->mv[MV_BWD_B2] = ff_cavs_un_mv;
-        h->mv[MV_BWD_B3] = ff_cavs_un_mv;
-        h->pred_mode_Y[1] = h->pred_mode_Y[2] = NOT_AVAIL;
-        h->flags &= ~(C_AVAIL|D_AVAIL);
-    } else if(h->mbx) {
-        h->flags |= D_AVAIL;
-    }
-    if(h->mbx == h->mb_width-1) //MB C not available
-        h->flags &= ~C_AVAIL;
-    /* clear top-right predictors if MB C is not available */
-    if(!(h->flags & C_AVAIL)) {
-        h->mv[MV_FWD_C2] = ff_cavs_un_mv;
-        h->mv[MV_BWD_C2] = ff_cavs_un_mv;
-    }
-    /* clear top-left predictors if MB D is not available */
-    if(!(h->flags & D_AVAIL)) {
-        h->mv[MV_FWD_D3] = ff_cavs_un_mv;
-        h->mv[MV_BWD_D3] = ff_cavs_un_mv;
-    }
-}
-
-/**
- * save predictors for later macroblocks and increase
- * macroblock address
- * @return 0 if end of frame is reached, 1 otherwise
- */
-int ff_cavs_next_mb(AVSContext *h) {
-    int i;
-
-    h->flags |= A_AVAIL;
-    h->cy += 16;
-    h->cu += 8;
-    h->cv += 8;
-    /* copy mvs as predictors to the left */
-    for(i=0;i<=20;i+=4)
-        h->mv[i] = h->mv[i+2];
-    /* copy bottom mvs from cache to top line */
-    h->top_mv[0][h->mbx*2+0] = h->mv[MV_FWD_X2];
-    h->top_mv[0][h->mbx*2+1] = h->mv[MV_FWD_X3];
-    h->top_mv[1][h->mbx*2+0] = h->mv[MV_BWD_X2];
-    h->top_mv[1][h->mbx*2+1] = h->mv[MV_BWD_X3];
-    /* next MB address */
-    h->mbidx++;
-    h->mbx++;
-    if(h->mbx == h->mb_width) { //new mb line
-        h->flags = B_AVAIL|C_AVAIL;
-        /* clear left pred_modes */
-        h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
-        /* clear left mv predictors */
-        for(i=0;i<=20;i+=4)
-            h->mv[i] = ff_cavs_un_mv;
-        h->mbx = 0;
-        h->mby++;
-        /* re-calculate sample pointers */
-        h->cy = h->picture.data[0] + h->mby*16*h->l_stride;
-        h->cu = h->picture.data[1] + h->mby*8*h->c_stride;
-        h->cv = h->picture.data[2] + h->mby*8*h->c_stride;
-        if(h->mby == h->mb_height) { //frame end
-            return 0;
-        }
-    }
-    return 1;
-}
-
-/*****************************************************************************
- *
- * frame level
- *
- ****************************************************************************/
-
-void ff_cavs_init_pic(AVSContext *h) {
-    int i;
-
-    /* clear some predictors */
-    for(i=0;i<=20;i+=4)
-        h->mv[i] = ff_cavs_un_mv;
-    h->mv[MV_BWD_X0] = ff_cavs_dir_mv;
-    set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
-    h->mv[MV_FWD_X0] = ff_cavs_dir_mv;
-    set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
-    h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
-    h->cy = h->picture.data[0];
-    h->cu = h->picture.data[1];
-    h->cv = h->picture.data[2];
-    h->l_stride = h->picture.linesize[0];
-    h->c_stride = h->picture.linesize[1];
-    h->luma_scan[2] = 8*h->l_stride;
-    h->luma_scan[3] = 8*h->l_stride+8;
-    h->mbx = h->mby = h->mbidx = 0;
-    h->flags = 0;
-}
-
-/*****************************************************************************
- *
- * headers and interface
- *
- ****************************************************************************/
-
-/**
- * some predictions require data from the top-neighbouring macroblock.
- * this data has to be stored for one complete row of macroblocks
- * and this storage space is allocated here
- */
-void ff_cavs_init_top_lines(AVSContext *h) {
-    /* alloc top line of predictors */
-    h->top_qp       = av_malloc( h->mb_width);
-    h->top_mv[0]    = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector));
-    h->top_mv[1]    = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector));
-    h->top_pred_Y   = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y));
-    h->top_border_y = av_malloc((h->mb_width+1)*16);
-    h->top_border_u = av_malloc((h->mb_width)*10);
-    h->top_border_v = av_malloc((h->mb_width)*10);
-
-    /* alloc space for co-located MVs and types */
-    h->col_mv       = av_malloc( h->mb_width*h->mb_height*4*sizeof(cavs_vector));
-    h->col_type_base = av_malloc(h->mb_width*h->mb_height);
-    h->block        = av_mallocz(64*sizeof(DCTELEM));
-}
-
-av_cold int ff_cavs_init(AVCodecContext *avctx) {
-    AVSContext *h = avctx->priv_data;
-    MpegEncContext * const s = &h->s;
-
-    MPV_decode_defaults(s);
-    s->avctx = avctx;
-
-    avctx->pix_fmt= PIX_FMT_YUV420P;
-
-    h->luma_scan[0] = 0;
-    h->luma_scan[1] = 8;
-    h->intra_pred_l[      INTRA_L_VERT] = intra_pred_vert;
-    h->intra_pred_l[     INTRA_L_HORIZ] = intra_pred_horiz;
-    h->intra_pred_l[        INTRA_L_LP] = intra_pred_lp;
-    h->intra_pred_l[ INTRA_L_DOWN_LEFT] = intra_pred_down_left;
-    h->intra_pred_l[INTRA_L_DOWN_RIGHT] = intra_pred_down_right;
-    h->intra_pred_l[   INTRA_L_LP_LEFT] = intra_pred_lp_left;
-    h->intra_pred_l[    INTRA_L_LP_TOP] = intra_pred_lp_top;
-    h->intra_pred_l[    INTRA_L_DC_128] = intra_pred_dc_128;
-    h->intra_pred_c[        INTRA_C_LP] = intra_pred_lp;
-    h->intra_pred_c[     INTRA_C_HORIZ] = intra_pred_horiz;
-    h->intra_pred_c[      INTRA_C_VERT] = intra_pred_vert;
-    h->intra_pred_c[     INTRA_C_PLANE] = intra_pred_plane;
-    h->intra_pred_c[   INTRA_C_LP_LEFT] = intra_pred_lp_left;
-    h->intra_pred_c[    INTRA_C_LP_TOP] = intra_pred_lp_top;
-    h->intra_pred_c[    INTRA_C_DC_128] = intra_pred_dc_128;
-    h->mv[ 7] = ff_cavs_un_mv;
-    h->mv[19] = ff_cavs_un_mv;
-    return 0;
-}
-
-av_cold int ff_cavs_end(AVCodecContext *avctx) {
-    AVSContext *h = avctx->priv_data;
-
-    av_free(h->top_qp);
-    av_free(h->top_mv[0]);
-    av_free(h->top_mv[1]);
-    av_free(h->top_pred_Y);
-    av_free(h->top_border_y);
-    av_free(h->top_border_u);
-    av_free(h->top_border_v);
-    av_free(h->col_mv);
-    av_free(h->col_type_base);
-    av_free(h->block);
-    return 0;
-}
diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
deleted file mode 100644
index 729c83e..0000000
--- a/libavcodec/cavs.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
- * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_CAVS_H
-#define AVCODEC_CAVS_H
-
-#include "dsputil.h"
-#include "mpegvideo.h"
-
-#define SLICE_MAX_START_CODE    0x000001af
-#define EXT_START_CODE          0x000001b5
-#define USER_START_CODE         0x000001b2
-#define CAVS_START_CODE         0x000001b0
-#define PIC_I_START_CODE        0x000001b3
-#define PIC_PB_START_CODE       0x000001b6
-
-#define A_AVAIL                          1
-#define B_AVAIL                          2
-#define C_AVAIL                          4
-#define D_AVAIL                          8
-#define NOT_AVAIL                       -1
-#define REF_INTRA                       -2
-#define REF_DIR                         -3
-
-#define ESCAPE_CODE                     59
-
-#define FWD0                          0x01
-#define FWD1                          0x02
-#define BWD0                          0x04
-#define BWD1                          0x08
-#define SYM0                          0x10
-#define SYM1                          0x20
-#define SPLITH                        0x40
-#define SPLITV                        0x80
-
-#define MV_BWD_OFFS                     12
-#define MV_STRIDE                        4
-
-enum cavs_mb {
-  I_8X8 = 0,
-  P_SKIP,
-  P_16X16,
-  P_16X8,
-  P_8X16,
-  P_8X8,
-  B_SKIP,
-  B_DIRECT,
-  B_FWD_16X16,
-  B_BWD_16X16,
-  B_SYM_16X16,
-  B_8X8 = 29
-};
-
-enum cavs_sub_mb {
-  B_SUB_DIRECT,
-  B_SUB_FWD,
-  B_SUB_BWD,
-  B_SUB_SYM
-};
-
-enum cavs_intra_luma {
-  INTRA_L_VERT,
-  INTRA_L_HORIZ,
-  INTRA_L_LP,
-  INTRA_L_DOWN_LEFT,
-  INTRA_L_DOWN_RIGHT,
-  INTRA_L_LP_LEFT,
-  INTRA_L_LP_TOP,
-  INTRA_L_DC_128
-};
-
-enum cavs_intra_chroma {
-  INTRA_C_LP,
-  INTRA_C_HORIZ,
-  INTRA_C_VERT,
-  INTRA_C_PLANE,
-  INTRA_C_LP_LEFT,
-  INTRA_C_LP_TOP,
-  INTRA_C_DC_128,
-};
-
-enum cavs_mv_pred {
-  MV_PRED_MEDIAN,
-  MV_PRED_LEFT,
-  MV_PRED_TOP,
-  MV_PRED_TOPRIGHT,
-  MV_PRED_PSKIP,
-  MV_PRED_BSKIP
-};
-
-enum cavs_block {
-  BLK_16X16,
-  BLK_16X8,
-  BLK_8X16,
-  BLK_8X8
-};
-
-enum cavs_mv_loc {
-  MV_FWD_D3 = 0,
-  MV_FWD_B2,
-  MV_FWD_B3,
-  MV_FWD_C2,
-  MV_FWD_A1,
-  MV_FWD_X0,
-  MV_FWD_X1,
-  MV_FWD_A3 = 8,
-  MV_FWD_X2,
-  MV_FWD_X3,
-  MV_BWD_D3 = MV_BWD_OFFS,
-  MV_BWD_B2,
-  MV_BWD_B3,
-  MV_BWD_C2,
-  MV_BWD_A1,
-  MV_BWD_X0,
-  MV_BWD_X1,
-  MV_BWD_A3 = MV_BWD_OFFS+8,
-  MV_BWD_X2,
-  MV_BWD_X3
-};
-
-DECLARE_ALIGNED(8, typedef, struct) {
-    int16_t x;
-    int16_t y;
-    int16_t dist;
-    int16_t ref;
-} cavs_vector;
-
-struct dec_2dvlc {
-  int8_t rltab[59][3];
-  int8_t level_add[27];
-  int8_t golomb_order;
-  int inc_limit;
-  int8_t max_run;
-};
-
-typedef struct {
-    MpegEncContext s;
-    Picture picture; ///< currently decoded frame
-    Picture DPB[2];  ///< reference frames
-    int dist[2];     ///< temporal distances from current frame to ref frames
-    int profile, level;
-    int aspect_ratio;
-    int mb_width, mb_height;
-    int pic_type;
-    int stream_revision; ///<0 for samples from 2006, 1 for rm52j encoder
-    int progressive;
-    int pic_structure;
-    int skip_mode_flag; ///< select between skip_count or one skip_flag per MB
-    int loop_filter_disable;
-    int alpha_offset, beta_offset;
-    int ref_flag;
-    int mbx, mby, mbidx; ///< macroblock coordinates
-    int flags;         ///< availability flags of neighbouring macroblocks
-    int stc;           ///< last start code
-    uint8_t *cy, *cu, *cv; ///< current MB sample pointers
-    int left_qp;
-    uint8_t *top_qp;
-
-    /** mv motion vector cache
-       0:    D3  B2  B3  C2
-       4:    A1  X0  X1   -
-       8:    A3  X2  X3   -
-
-       X are the vectors in the current macroblock (5,6,9,10)
-       A is the macroblock to the left (4,8)
-       B is the macroblock to the top (1,2)
-       C is the macroblock to the top-right (3)
-       D is the macroblock to the top-left (0)
-
-       the same is repeated for backward motion vectors */
-    cavs_vector mv[2*4*3];
-    cavs_vector *top_mv[2];
-    cavs_vector *col_mv;
-
-    /** luma pred mode cache
-       0:    --  B2  B3
-       3:    A1  X0  X1
-       6:    A3  X2  X3   */
-    int pred_mode_Y[3*3];
-    int *top_pred_Y;
-    int l_stride, c_stride;
-    int luma_scan[4];
-    int qp;
-    int qp_fixed;
-    int cbp;
-    ScanTable scantable;
-
-    /** intra prediction is done with un-deblocked samples
-     they are saved here before deblocking the MB  */
-    uint8_t *top_border_y, *top_border_u, *top_border_v;
-    uint8_t left_border_y[26], left_border_u[10], left_border_v[10];
-    uint8_t intern_border_y[26];
-    uint8_t topleft_border_y, topleft_border_u, topleft_border_v;
-
-    void (*intra_pred_l[8])(uint8_t *d,uint8_t *top,uint8_t *left,int stride);
-    void (*intra_pred_c[7])(uint8_t *d,uint8_t *top,uint8_t *left,int stride);
-    uint8_t *col_type_base;
-
-    /* scaling factors for MV prediction */
-    int sym_factor;    ///< for scaling in symmetrical B block
-    int direct_den[2]; ///< for scaling in direct B block
-    int scale_den[2];  ///< for scaling neighbouring MVs
-
-    int got_keyframe;
-    DCTELEM *block;
-} AVSContext;
-
-extern const uint8_t     ff_cavs_dequant_shift[64];
-extern const uint16_t    ff_cavs_dequant_mul[64];
-extern const struct dec_2dvlc ff_cavs_intra_dec[7];
-extern const struct dec_2dvlc ff_cavs_inter_dec[7];
-extern const struct dec_2dvlc ff_cavs_chroma_dec[5];
-extern const uint8_t     ff_cavs_chroma_qp[64];
-extern const uint8_t     ff_cavs_scan3x3[4];
-extern const uint8_t     ff_cavs_partition_flags[30];
-extern const int_fast8_t ff_left_modifier_l[8];
-extern const int_fast8_t ff_top_modifier_l[8];
-extern const int_fast8_t ff_left_modifier_c[7];
-extern const int_fast8_t ff_top_modifier_c[7];
-extern const cavs_vector ff_cavs_intra_mv;
-extern const cavs_vector ff_cavs_un_mv;
-extern const cavs_vector ff_cavs_dir_mv;
-
-static inline void modify_pred(const int_fast8_t *mod_table, int *mode) {
-    *mode = mod_table[*mode];
-    if(*mode < 0) {
-        av_log(NULL, AV_LOG_ERROR, "Illegal intra prediction mode\n");
-        *mode = 0;
-    }
-}
-
-static inline void set_intra_mode_default(AVSContext *h) {
-    if(h->stream_revision > 0) {
-        h->pred_mode_Y[3] =  h->pred_mode_Y[6] = NOT_AVAIL;
-        h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = NOT_AVAIL;
-    } else {
-        h->pred_mode_Y[3] =  h->pred_mode_Y[6] = INTRA_L_LP;
-        h->top_pred_Y[h->mbx*2+0] = h->top_pred_Y[h->mbx*2+1] = INTRA_L_LP;
-    }
-}
-
-static inline void set_mvs(cavs_vector *mv, enum cavs_block size) {
-    switch(size) {
-    case BLK_16X16:
-        mv[MV_STRIDE  ] = mv[0];
-        mv[MV_STRIDE+1] = mv[0];
-    case BLK_16X8:
-        mv[1] = mv[0];
-        break;
-    case BLK_8X16:
-        mv[MV_STRIDE] = mv[0];
-        break;
-    }
-}
-
-static inline void set_mv_intra(AVSContext *h) {
-    h->mv[MV_FWD_X0] = ff_cavs_intra_mv;
-    set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
-    h->mv[MV_BWD_X0] = ff_cavs_intra_mv;
-    set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
-    if(h->pic_type != FF_B_TYPE)
-        h->col_type_base[h->mbidx] = I_8X8;
-}
-
-static inline int dequant(AVSContext *h, DCTELEM *level_buf, uint8_t *run_buf,
-                          DCTELEM *dst, int mul, int shift, int coeff_num) {
-    int round = 1 << (shift - 1);
-    int pos = -1;
-    const uint8_t *scantab = h->scantable.permutated;
-
-    /* inverse scan and dequantization */
-    while(--coeff_num >= 0){
-        pos += run_buf[coeff_num];
-        if(pos > 63) {
-            av_log(h->s.avctx, AV_LOG_ERROR,
-                "position out of block bounds at pic %d MB(%d,%d)\n",
-                h->picture.poc, h->mbx, h->mby);
-            return -1;
-        }
-        dst[scantab[pos]] = (level_buf[coeff_num]*mul + round) >> shift;
-    }
-    return 0;
-}
-
-void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type);
-void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top, uint8_t **left,
-                                  int block);
-void ff_cavs_load_intra_pred_chroma(AVSContext *h);
-void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv);
-void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type);
-void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC,
-                enum cavs_mv_pred mode, enum cavs_block size, int ref);
-void ff_cavs_init_mb(AVSContext *h);
-int  ff_cavs_next_mb(AVSContext *h);
-void ff_cavs_init_pic(AVSContext *h);
-void ff_cavs_init_top_lines(AVSContext *h);
-int ff_cavs_init(AVCodecContext *avctx);
-int ff_cavs_end (AVCodecContext *avctx);
-
-#endif /* AVCODEC_CAVS_H */
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
deleted file mode 100644
index 8e9c35b..0000000
--- a/libavcodec/cavs_parser.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) parser.
- * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Chinese AVS video (AVS1-P2, JiZhun profile) parser
- * @author Stefan Gehrer <stefan.gehrer at gmx.de>
- */
-
-#include "parser.h"
-#include "cavs.h"
-
-
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf,
-                               int buf_size) {
-    int pic_found, i;
-    uint32_t state;
-
-    pic_found= pc->frame_start_found;
-    state= pc->state;
-
-    i=0;
-    if(!pic_found){
-        for(i=0; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(state == PIC_I_START_CODE || state == PIC_PB_START_CODE){
-                i++;
-                pic_found=1;
-                break;
-            }
-        }
-    }
-
-    if(pic_found){
-        /* EOF considered as end of frame */
-        if (buf_size == 0)
-            return 0;
-        for(; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if((state&0xFFFFFF00) == 0x100){
-                if(state > SLICE_MAX_START_CODE){
-                    pc->frame_start_found=0;
-                    pc->state=-1;
-                    return i-3;
-                }
-            }
-        }
-    }
-    pc->frame_start_found= pic_found;
-    pc->state= state;
-    return END_NOT_FOUND;
-}
-
-static int cavsvideo_parse(AVCodecParserContext *s,
-                           AVCodecContext *avctx,
-                           const uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size)
-{
-    ParseContext *pc = s->priv_data;
-    int next;
-
-    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
-        next= buf_size;
-    }else{
-        next= cavs_find_frame_end(pc, buf, buf_size);
-
-        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-    }
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-AVCodecParser cavsvideo_parser = {
-    { CODEC_ID_CAVS },
-    sizeof(ParseContext1),
-    NULL,
-    cavsvideo_parse,
-    ff_parse1_close,
-    ff_mpeg4video_split,
-};
diff --git a/libavcodec/cavsdata.h b/libavcodec/cavsdata.h
deleted file mode 100644
index b597da1..0000000
--- a/libavcodec/cavsdata.h
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
- * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_CAVSDATA_H
-#define AVCODEC_CAVSDATA_H
-
-#include "cavs.h"
-
-const uint8_t ff_cavs_partition_flags[30] = {
-  0,                                 //I_8X8
-  0,                                 //P_SKIP
-  0,                                 //P_16X16
-                      SPLITH,        //P_16X8
-                             SPLITV, //P_8X16
-                      SPLITH|SPLITV, //P_8X8
-                      SPLITH|SPLITV, //B_SKIP
-                      SPLITH|SPLITV, //B_DIRECT
-  0,                                 //B_FWD_16X16
-  0,                                 //B_BWD_16X16
-  0,                                 //B_SYM_16X16
-  FWD0|FWD1          |SPLITH,
-  FWD0|FWD1                 |SPLITV,
-  BWD0|BWD1          |SPLITH,
-  BWD0|BWD1                 |SPLITV,
-  FWD0|BWD1          |SPLITH,
-  FWD0|BWD1                 |SPLITV,
-  BWD0|FWD1          |SPLITH,
-  BWD0|FWD1                 |SPLITV,
-  FWD0|FWD1     |SYM1|SPLITH,
-  FWD0|FWD1     |SYM1       |SPLITV,
-  BWD0|FWD1     |SYM1|SPLITH,
-  BWD0|FWD1     |SYM1       |SPLITV,
-  FWD0|FWD1|SYM0     |SPLITH,
-  FWD0|FWD1|SYM0            |SPLITV,
-  FWD0|BWD1|SYM0     |SPLITH,
-  FWD0|BWD1|SYM0            |SPLITV,
-  FWD0|FWD1|SYM0|SYM1|SPLITH,
-  FWD0|FWD1|SYM0|SYM1       |SPLITV,
-                      SPLITH|SPLITV, //B_8X8 = 29
-};
-
-const uint8_t ff_cavs_scan3x3[4] = {4,5,7,8};
-
-const uint8_t ff_cavs_chroma_qp[64] = {
-  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,42,43,43,44,44,
-  45,45,46,46,47,47,48,48,48,49,49,49,50,50,50,51
-};
-
-const uint8_t ff_cavs_dequant_shift[64] = {
-  14,14,14,14,14,14,14,14,
-  13,13,13,13,13,13,13,13,
-  13,12,12,12,12,12,12,12,
-  11,11,11,11,11,11,11,11,
-  11,10,10,10,10,10,10,10,
-  10, 9, 9, 9, 9, 9, 9, 9,
-  9, 8, 8, 8, 8, 8, 8, 8,
-  7, 7, 7, 7, 7, 7, 7, 7
-};
-
-const uint16_t ff_cavs_dequant_mul[64] = {
-  32768,36061,38968,42495,46341,50535,55437,60424,
-  32932,35734,38968,42495,46177,50535,55109,59933,
-  65535,35734,38968,42577,46341,50617,55027,60097,
-  32809,35734,38968,42454,46382,50576,55109,60056,
-  65535,35734,38968,42495,46320,50515,55109,60076,
-  65535,35744,38968,42495,46341,50535,55099,60087,
-  65535,35734,38973,42500,46341,50535,55109,60097,
-  32771,35734,38965,42497,46341,50535,55109,60099
-};
-
-/** marks block as unavailable, i.e. out of picture
-    or not yet decoded */
-const cavs_vector ff_cavs_un_mv    = {0,0,1,NOT_AVAIL};
-
-/** marks block as "no prediction from this direction"
-    e.g. forward motion vector in BWD partition */
-const cavs_vector ff_cavs_dir_mv   = {0,0,1,REF_DIR};
-
-/** marks block as using intra prediction */
-const cavs_vector ff_cavs_intra_mv = {0,0,1,REF_INTRA};
-
-#define EOB 0,0,0
-
-const struct dec_2dvlc ff_cavs_intra_dec[7] = {
-  {
-    { //level / run / table_inc
-      {  1, 1, 1},{ -1, 1, 1},{  1, 2, 1},{ -1, 2, 1},{  1, 3, 1},{ -1, 3, 1},
-      {  1, 4, 1},{ -1, 4, 1},{  1, 5, 1},{ -1, 5, 1},{  1, 6, 1},{ -1, 6, 1},
-      {  1, 7, 1},{ -1, 7, 1},{  1, 8, 1},{ -1, 8, 1},{  1, 9, 1},{ -1, 9, 1},
-      {  1,10, 1},{ -1,10, 1},{  1,11, 1},{ -1,11, 1},{  2, 1, 2},{ -2, 1, 2},
-      {  1,12, 1},{ -1,12, 1},{  1,13, 1},{ -1,13, 1},{  1,14, 1},{ -1,14, 1},
-      {  1,15, 1},{ -1,15, 1},{  2, 2, 2},{ -2, 2, 2},{  1,16, 1},{ -1,16, 1},
-      {  1,17, 1},{ -1,17, 1},{  3, 1, 3},{ -3, 1, 3},{  1,18, 1},{ -1,18, 1},
-      {  1,19, 1},{ -1,19, 1},{  2, 3, 2},{ -2, 3, 2},{  1,20, 1},{ -1,20, 1},
-      {  1,21, 1},{ -1,21, 1},{  2, 4, 2},{ -2, 4, 2},{  1,22, 1},{ -1,22, 1},
-      {  2, 5, 2},{ -2, 5, 2},{  1,23, 1},{ -1,23, 1},{   EOB   }
-    },
-    //level_add
-    { 0, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-      2, 2, 2, 2, 2, 2, 2,-1,-1,-1},
-    2, //golomb_order
-    0, //inc_limit
-    23, //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{  1, 2, 0},{ -1, 2, 0},{  2, 1, 1},{ -2, 1, 1},
-      {  1, 3, 0},{ -1, 3, 0},{   EOB   },{  1, 4, 0},{ -1, 4, 0},{  1, 5, 0},
-      { -1, 5, 0},{  1, 6, 0},{ -1, 6, 0},{  3, 1, 2},{ -3, 1, 2},{  2, 2, 1},
-      { -2, 2, 1},{  1, 7, 0},{ -1, 7, 0},{  1, 8, 0},{ -1, 8, 0},{  1, 9, 0},
-      { -1, 9, 0},{  2, 3, 1},{ -2, 3, 1},{  4, 1, 2},{ -4, 1, 2},{  1,10, 0},
-      { -1,10, 0},{  1,11, 0},{ -1,11, 0},{  2, 4, 1},{ -2, 4, 1},{  3, 2, 2},
-      { -3, 2, 2},{  1,12, 0},{ -1,12, 0},{  2, 5, 1},{ -2, 5, 1},{  5, 1, 3},
-      { -5, 1, 3},{  1,13, 0},{ -1,13, 0},{  2, 6, 1},{ -2, 6, 1},{  1,14, 0},
-      { -1,14, 0},{  2, 7, 1},{ -2, 7, 1},{  2, 8, 1},{ -2, 8, 1},{  3, 3, 2},
-      { -3, 3, 2},{  6, 1, 3},{ -6, 1, 3},{  1,15, 0},{ -1,15, 0}
-    },
-    //level_add
-    { 0, 7, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,
-      -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    1, //inc_limit
-    15, //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  1, 2, 0},{ -1, 2, 0},
-      {  3, 1, 1},{ -3, 1, 1},{   EOB   },{  1, 3, 0},{ -1, 3, 0},{  2, 2, 0},
-      { -2, 2, 0},{  4, 1, 1},{ -4, 1, 1},{  1, 4, 0},{ -1, 4, 0},{  5, 1, 2},
-      { -5, 1, 2},{  1, 5, 0},{ -1, 5, 0},{  3, 2, 1},{ -3, 2, 1},{  2, 3, 0},
-      { -2, 3, 0},{  1, 6, 0},{ -1, 6, 0},{  6, 1, 2},{ -6, 1, 2},{  2, 4, 0},
-      { -2, 4, 0},{  1, 7, 0},{ -1, 7, 0},{  4, 2, 1},{ -4, 2, 1},{  7, 1, 2},
-      { -7, 1, 2},{  3, 3, 1},{ -3, 3, 1},{  2, 5, 0},{ -2, 5, 0},{  1, 8, 0},
-      { -1, 8, 0},{  2, 6, 0},{ -2, 6, 0},{  8, 1, 3},{ -8, 1, 3},{  1, 9, 0},
-      { -1, 9, 0},{  5, 2, 2},{ -5, 2, 2},{  3, 4, 1},{ -3, 4, 1},{  2, 7, 0},
-      { -2, 7, 0},{  9, 1, 3},{ -9, 1, 3},{  1,10, 0},{ -1,10, 0}
-    },
-    //level_add
-    { 0,10, 6, 4, 4, 3, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    2, //inc_limit
-    10, //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},{ -3, 1, 0},
-      {  1, 2, 0},{ -1, 2, 0},{   EOB   },{  4, 1, 0},{ -4, 1, 0},{  5, 1, 1},
-      { -5, 1, 1},{  2, 2, 0},{ -2, 2, 0},{  1, 3, 0},{ -1, 3, 0},{  6, 1, 1},
-      { -6, 1, 1},{  3, 2, 0},{ -3, 2, 0},{  7, 1, 1},{ -7, 1, 1},{  1, 4, 0},
-      { -1, 4, 0},{  8, 1, 2},{ -8, 1, 2},{  2, 3, 0},{ -2, 3, 0},{  4, 2, 0},
-      { -4, 2, 0},{  1, 5, 0},{ -1, 5, 0},{  9, 1, 2},{ -9, 1, 2},{  5, 2, 1},
-      { -5, 2, 1},{  2, 4, 0},{ -2, 4, 0},{ 10, 1, 2},{-10, 1, 2},{  3, 3, 0},
-      { -3, 3, 0},{  1, 6, 0},{ -1, 6, 0},{ 11, 1, 3},{-11, 1, 3},{  6, 2, 1},
-      { -6, 2, 1},{  1, 7, 0},{ -1, 7, 0},{  2, 5, 0},{ -2, 5, 0},{  3, 4, 0},
-      { -3, 4, 0},{ 12, 1, 3},{-12, 1, 3},{  4, 3, 0},{ -4, 3, 0}
-    },
-    //level_add
-    { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1 -1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    4, //inc_limit
-    7, //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},{ -3, 1, 0},
-      {   EOB   },{  4, 1, 0},{ -4, 1, 0},{  5, 1, 0},{ -5, 1, 0},{  6, 1, 0},
-      { -6, 1, 0},{  1, 2, 0},{ -1, 2, 0},{  7, 1, 0},{ -7, 1, 0},{  8, 1, 1},
-      { -8, 1, 1},{  2, 2, 0},{ -2, 2, 0},{  9, 1, 1},{ -9, 1, 1},{ 10, 1, 1},
-      {-10, 1, 1},{  1, 3, 0},{ -1, 3, 0},{  3, 2, 0},{ -3, 2, 0},{ 11, 1, 2},
-      {-11, 1, 2},{  4, 2, 0},{ -4, 2, 0},{ 12, 1, 2},{-12, 1, 2},{ 13, 1, 2},
-      {-13, 1, 2},{  5, 2, 0},{ -5, 2, 0},{  1, 4, 0},{ -1, 4, 0},{  2, 3, 0},
-      { -2, 3, 0},{ 14, 1, 2},{-14, 1, 2},{  6, 2, 0},{ -6, 2, 0},{ 15, 1, 2},
-      {-15, 1, 2},{ 16, 1, 2},{-16, 1, 2},{  3, 3, 0},{ -3, 3, 0},{  1, 5, 0},
-      { -1, 5, 0},{  7, 2, 0},{ -7, 2, 0},{ 17, 1, 2},{-17, 1, 2}
-    },
-    //level_add
-    { 0,18, 8, 4, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    7, //inc_limit
-    5, //max_run
-  },{
-    { //level / run
-      {   EOB   },{  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},
-      { -3, 1, 0},{  4, 1, 0},{ -4, 1, 0},{  5, 1, 0},{ -5, 1, 0},{  6, 1, 0},
-      { -6, 1, 0},{  7, 1, 0},{ -7, 1, 0},{  8, 1, 0},{ -8, 1, 0},{  9, 1, 0},
-      { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{  1, 2, 0},{ -1, 2, 0},{ 11, 1, 1},
-      {-11, 1, 1},{ 12, 1, 1},{-12, 1, 1},{ 13, 1, 1},{-13, 1, 1},{  2, 2, 0},
-      { -2, 2, 0},{ 14, 1, 1},{-14, 1, 1},{ 15, 1, 1},{-15, 1, 1},{  3, 2, 0},
-      { -3, 2, 0},{ 16, 1, 1},{-16, 1, 1},{  1, 3, 0},{ -1, 3, 0},{ 17, 1, 1},
-      {-17, 1, 1},{  4, 2, 0},{ -4, 2, 0},{ 18, 1, 1},{-18, 1, 1},{  5, 2, 0},
-      { -5, 2, 0},{ 19, 1, 1},{-19, 1, 1},{ 20, 1, 1},{-20, 1, 1},{  6, 2, 0},
-      { -6, 2, 0},{ 21, 1, 1},{-21, 1, 1},{  2, 3, 0},{ -2, 3, 0}
-    },
-    //level_add
-    { 0,22, 7, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    10, //inc_limit
-    3, //max_run
-  },{
-    { //level / run
-      {   EOB   },{  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},
-      { -3, 1, 0},{  4, 1, 0},{ -4, 1, 0},{  5, 1, 0},{ -5, 1, 0},{  6, 1, 0},
-      { -6, 1, 0},{  7, 1, 0},{ -7, 1, 0},{  8, 1, 0},{ -8, 1, 0},{  9, 1, 0},
-      { -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},{-11, 1, 0},{ 12, 1, 0},
-      {-12, 1, 0},{ 13, 1, 0},{-13, 1, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
-      {-15, 1, 0},{ 16, 1, 0},{-16, 1, 0},{  1, 2, 0},{ -1, 2, 0},{ 17, 1, 0},
-      {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{ 19, 1, 0},{-19, 1, 0},{ 20, 1, 0},
-      {-20, 1, 0},{ 21, 1, 0},{-21, 1, 0},{  2, 2, 0},{ -2, 2, 0},{ 22, 1, 0},
-      {-22, 1, 0},{ 23, 1, 0},{-23, 1, 0},{ 24, 1, 0},{-24, 1, 0},{ 25, 1, 0},
-      {-25, 1, 0},{  3, 2, 0},{ -3, 2, 0},{ 26, 1, 0},{-26, 1, 0}
-    },
-    //level_add
-    { 0,27, 4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    INT_MAX, //inc_limit
-    2, //max_run
-  }
-};
-
-const struct dec_2dvlc ff_cavs_inter_dec[7] = {
-  {
-    { //level / run
-      {  1, 1, 1},{ -1, 1, 1},{  1, 2, 1},{ -1, 2, 1},{  1, 3, 1},{ -1, 3, 1},
-      {  1, 4, 1},{ -1, 4, 1},{  1, 5, 1},{ -1, 5, 1},{  1, 6, 1},{ -1, 6, 1},
-      {  1, 7, 1},{ -1, 7, 1},{  1, 8, 1},{ -1, 8, 1},{  1, 9, 1},{ -1, 9, 1},
-      {  1,10, 1},{ -1,10, 1},{  1,11, 1},{ -1,11, 1},{  1,12, 1},{ -1,12, 1},
-      {  1,13, 1},{ -1,13, 1},{  2, 1, 2},{ -2, 1, 2},{  1,14, 1},{ -1,14, 1},
-      {  1,15, 1},{ -1,15, 1},{  1,16, 1},{ -1,16, 1},{  1,17, 1},{ -1,17, 1},
-      {  1,18, 1},{ -1,18, 1},{  1,19, 1},{ -1,19, 1},{  3, 1, 3},{ -3, 1, 3},
-      {  1,20, 1},{ -1,20, 1},{  1,21, 1},{ -1,21, 1},{  2, 2, 2},{ -2, 2, 2},
-      {  1,22, 1},{ -1,22, 1},{  1,23, 1},{ -1,23, 1},{  1,24, 1},{ -1,24, 1},
-      {  1,25, 1},{ -1,25, 1},{  1,26, 1},{ -1,26, 1},{   EOB   }
-    },
-    //level_add
-    { 0, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-      2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
-    3, //golomb_order
-    0, //inc_limit
-    26 //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{   EOB   },{  1, 2, 0},{ -1, 2, 0},{  1, 3, 0},
-      { -1, 3, 0},{  1, 4, 0},{ -1, 4, 0},{  1, 5, 0},{ -1, 5, 0},{  1, 6, 0},
-      { -1, 6, 0},{  2, 1, 1},{ -2, 1, 1},{  1, 7, 0},{ -1, 7, 0},{  1, 8, 0},
-      { -1, 8, 0},{  1, 9, 0},{ -1, 9, 0},{  1,10, 0},{ -1,10, 0},{  2, 2, 1},
-      { -2, 2, 1},{  1,11, 0},{ -1,11, 0},{  1,12, 0},{ -1,12, 0},{  3, 1, 2},
-      { -3, 1, 2},{  1,13, 0},{ -1,13, 0},{  1,14, 0},{ -1,14, 0},{  2, 3, 1},
-      { -2, 3, 1},{  1,15, 0},{ -1,15, 0},{  2, 4, 1},{ -2, 4, 1},{  1,16, 0},
-      { -1,16, 0},{  2, 5, 1},{ -2, 5, 1},{  1,17, 0},{ -1,17, 0},{  4, 1, 3},
-      { -4, 1, 3},{  2, 6, 1},{ -2, 6, 1},{  1,18, 0},{ -1,18, 0},{  1,19, 0},
-      { -1,19, 0},{  2, 7, 1},{ -2, 7, 1},{  3, 2, 2},{ -3, 2, 2}
-    },
-    //level_add
-    { 0, 5, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-      2, 2, 2,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    1, //inc_limit
-    19 //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{   EOB   },{  1, 2, 0},{ -1, 2, 0},{  2, 1, 0},
-      { -2, 1, 0},{  1, 3, 0},{ -1, 3, 0},{  1, 4, 0},{ -1, 4, 0},{  3, 1, 1},
-      { -3, 1, 1},{  2, 2, 0},{ -2, 2, 0},{  1, 5, 0},{ -1, 5, 0},{  1, 6, 0},
-      { -1, 6, 0},{  1, 7, 0},{ -1, 7, 0},{  2, 3, 0},{ -2, 3, 0},{  4, 1, 2},
-      { -4, 1, 2},{  1, 8, 0},{ -1, 8, 0},{  3, 2, 1},{ -3, 2, 1},{  2, 4, 0},
-      { -2, 4, 0},{  1, 9, 0},{ -1, 9, 0},{  1,10, 0},{ -1,10, 0},{  5, 1, 2},
-      { -5, 1, 2},{  2, 5, 0},{ -2, 5, 0},{  1,11, 0},{ -1,11, 0},{  2, 6, 0},
-      { -2, 6, 0},{  1,12, 0},{ -1,12, 0},{  3, 3, 1},{ -3, 3, 1},{  6, 1, 2},
-      { -6, 1, 2},{  4, 2, 2},{ -4, 2, 2},{  1,13, 0},{ -1,13, 0},{  2, 7, 0},
-      { -2, 7, 0},{  3, 4, 1},{ -3, 4, 1},{  1,14, 0},{ -1,14, 0}
-    },
-    //level_add
-    { 0, 7, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2,-1,-1,
-      -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    2, //inc_limit
-    14 //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{   EOB   },{  2, 1, 0},{ -2, 1, 0},{  1, 2, 0},
-      { -1, 2, 0},{  3, 1, 0},{ -3, 1, 0},{  1, 3, 0},{ -1, 3, 0},{  2, 2, 0},
-      { -2, 2, 0},{  4, 1, 1},{ -4, 1, 1},{  1, 4, 0},{ -1, 4, 0},{  5, 1, 1},
-      { -5, 1, 1},{  1, 5, 0},{ -1, 5, 0},{  3, 2, 0},{ -3, 2, 0},{  2, 3, 0},
-      { -2, 3, 0},{  1, 6, 0},{ -1, 6, 0},{  6, 1, 1},{ -6, 1, 1},{  2, 4, 0},
-      { -2, 4, 0},{  1, 7, 0},{ -1, 7, 0},{  4, 2, 1},{ -4, 2, 1},{  7, 1, 2},
-      { -7, 1, 2},{  3, 3, 0},{ -3, 3, 0},{  1, 8, 0},{ -1, 8, 0},{  2, 5, 0},
-      { -2, 5, 0},{  8, 1, 2},{ -8, 1, 2},{  1, 9, 0},{ -1, 9, 0},{  3, 4, 0},
-      { -3, 4, 0},{  2, 6, 0},{ -2, 6, 0},{  5, 2, 1},{ -5, 2, 1},{  1,10, 0},
-      { -1,10, 0},{  9, 1, 2},{ -9, 1, 2},{  4, 3, 1},{ -4, 3, 1}
-    },
-    //level_add
-    { 0,10, 6, 5, 4, 3, 3, 2, 2, 2, 2,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    3, //inc_limit
-    10 //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{   EOB   },{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},
-      { -3, 1, 0},{  1, 2, 0},{ -1, 2, 0},{  4, 1, 0},{ -4, 1, 0},{  5, 1, 0},
-      { -5, 1, 0},{  2, 2, 0},{ -2, 2, 0},{  1, 3, 0},{ -1, 3, 0},{  6, 1, 0},
-      { -6, 1, 0},{  3, 2, 0},{ -3, 2, 0},{  7, 1, 1},{ -7, 1, 1},{  1, 4, 0},
-      { -1, 4, 0},{  8, 1, 1},{ -8, 1, 1},{  2, 3, 0},{ -2, 3, 0},{  4, 2, 0},
-      { -4, 2, 0},{  1, 5, 0},{ -1, 5, 0},{  9, 1, 1},{ -9, 1, 1},{  5, 2, 0},
-      { -5, 2, 0},{  2, 4, 0},{ -2, 4, 0},{  1, 6, 0},{ -1, 6, 0},{ 10, 1, 2},
-      {-10, 1, 2},{  3, 3, 0},{ -3, 3, 0},{ 11, 1, 2},{-11, 1, 2},{  1, 7, 0},
-      { -1, 7, 0},{  6, 2, 0},{ -6, 2, 0},{  3, 4, 0},{ -3, 4, 0},{  2, 5, 0},
-      { -2, 5, 0},{ 12, 1, 2},{-12, 1, 2},{  4, 3, 0},{ -4, 3, 0}
-    },
-    //level_add
-    { 0,13, 7, 5, 4, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    6, //inc_limit
-    7  //max_run
-  },{
-    { //level / run
-      {   EOB   },{  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},
-      { -3, 1, 0},{  4, 1, 0},{ -4, 1, 0},{  5, 1, 0},{ -5, 1, 0},{  1, 2, 0},
-      { -1, 2, 0},{  6, 1, 0},{ -6, 1, 0},{  7, 1, 0},{ -7, 1, 0},{  8, 1, 0},
-      { -8, 1, 0},{  2, 2, 0},{ -2, 2, 0},{  9, 1, 0},{ -9, 1, 0},{  1, 3, 0},
-      { -1, 3, 0},{ 10, 1, 1},{-10, 1, 1},{  3, 2, 0},{ -3, 2, 0},{ 11, 1, 1},
-      {-11, 1, 1},{  4, 2, 0},{ -4, 2, 0},{ 12, 1, 1},{-12, 1, 1},{  1, 4, 0},
-      { -1, 4, 0},{  2, 3, 0},{ -2, 3, 0},{ 13, 1, 1},{-13, 1, 1},{  5, 2, 0},
-      { -5, 2, 0},{ 14, 1, 1},{-14, 1, 1},{  6, 2, 0},{ -6, 2, 0},{  1, 5, 0},
-      { -1, 5, 0},{ 15, 1, 1},{-15, 1, 1},{  3, 3, 0},{ -3, 3, 0},{ 16, 1, 1},
-      {-16, 1, 1},{  2, 4, 0},{ -2, 4, 0},{  7, 2, 0},{ -7, 2, 0}
-    },
-    //level_add
-    { 0,17, 8, 4, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    9, //inc_limit
-    5  //max_run
-  },{
-    { //level / run
-      {   EOB   },{  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},
-      { -3, 1, 0},{  4, 1, 0},{ -4, 1, 0},{  5, 1, 0},{ -5, 1, 0},{  6, 1, 0},
-      { -6, 1, 0},{  7, 1, 0},{ -7, 1, 0},{  1, 2, 0},{ -1, 2, 0},{  8, 1, 0},
-      { -8, 1, 0},{  9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
-      {-11, 1, 0},{ 12, 1, 0},{-12, 1, 0},{  2, 2, 0},{ -2, 2, 0},{ 13, 1, 0},
-      {-13, 1, 0},{  1, 3, 0},{ -1, 3, 0},{ 14, 1, 0},{-14, 1, 0},{ 15, 1, 0},
-      {-15, 1, 0},{  3, 2, 0},{ -3, 2, 0},{ 16, 1, 0},{-16, 1, 0},{ 17, 1, 0},
-      {-17, 1, 0},{ 18, 1, 0},{-18, 1, 0},{  4, 2, 0},{ -4, 2, 0},{ 19, 1, 0},
-      {-19, 1, 0},{ 20, 1, 0},{-20, 1, 0},{  2, 3, 0},{ -2, 3, 0},{  1, 4, 0},
-      { -1, 4, 0},{  5, 2, 0},{ -5, 2, 0},{ 21, 1, 0},{-21, 1, 0}
-    },
-    //level_add
-    { 0,22, 6, 3, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    2, //golomb_order
-    INT_MAX, //inc_limit
-    4 //max_run
-  }
-};
-
-const struct dec_2dvlc ff_cavs_chroma_dec[5] = {
-  {
-    { //level / run
-      {  1, 1, 1},{ -1, 1, 1},{  1, 2, 1},{ -1, 2, 1},{  1, 3, 1},{ -1, 3, 1},
-      {  1, 4, 1},{ -1, 4, 1},{  1, 5, 1},{ -1, 5, 1},{  1, 6, 1},{ -1, 6, 1},
-      {  1, 7, 1},{ -1, 7, 1},{  2, 1, 2},{ -2, 1, 2},{  1, 8, 1},{ -1, 8, 1},
-      {  1, 9, 1},{ -1, 9, 1},{  1,10, 1},{ -1,10, 1},{  1,11, 1},{ -1,11, 1},
-      {  1,12, 1},{ -1,12, 1},{  1,13, 1},{ -1,13, 1},{  1,14, 1},{ -1,14, 1},
-      {  1,15, 1},{ -1,15, 1},{  3, 1, 3},{ -3, 1, 3},{  1,16, 1},{ -1,16, 1},
-      {  1,17, 1},{ -1,17, 1},{  1,18, 1},{ -1,18, 1},{  1,19, 1},{ -1,19, 1},
-      {  1,20, 1},{ -1,20, 1},{  1,21, 1},{ -1,21, 1},{  1,22, 1},{ -1,22, 1},
-      {  2, 2, 2},{ -2, 2, 2},{  1,23, 1},{ -1,23, 1},{  1,24, 1},{ -1,24, 1},
-      {  1,25, 1},{ -1,25, 1},{  4, 1, 3},{ -4, 1, 3},{   EOB   }
-    },
-    //level_add
-    { 0, 5, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-      2, 2, 2, 2, 2, 2, 2, 2, 2,-1},
-    2, //golomb_order
-    0, //inc_limit
-    25 //max_run
-  },{
-    { //level / run
-      {   EOB   },{  1, 1, 0},{ -1, 1, 0},{  1, 2, 0},{ -1, 2, 0},{  2, 1, 1},
-      { -2, 1, 1},{  1, 3, 0},{ -1, 3, 0},{  1, 4, 0},{ -1, 4, 0},{  1, 5, 0},
-      { -1, 5, 0},{  1, 6, 0},{ -1, 6, 0},{  3, 1, 2},{ -3, 1, 2},{  1, 7, 0},
-      { -1, 7, 0},{  1, 8, 0},{ -1, 8, 0},{  2, 2, 1},{ -2, 2, 1},{  1, 9, 0},
-      { -1, 9, 0},{  1,10, 0},{ -1,10, 0},{  1,11, 0},{ -1,11, 0},{  4, 1, 2},
-      { -4, 1, 2},{  1,12, 0},{ -1,12, 0},{  1,13, 0},{ -1,13, 0},{  1,14, 0},
-      { -1,14, 0},{  2, 3, 1},{ -2, 3, 1},{  1,15, 0},{ -1,15, 0},{  2, 4, 1},
-      { -2, 4, 1},{  5, 1, 3},{ -5, 1, 3},{  3, 2, 2},{ -3, 2, 2},{  1,16, 0},
-      { -1,16, 0},{  1,17, 0},{ -1,17, 0},{  1,18, 0},{ -1,18, 0},{  2, 5, 1},
-      { -2, 5, 1},{  1,19, 0},{ -1,19, 0},{  1,20, 0},{ -1,20, 0}
-    },
-    //level_add
-    { 0, 6, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-      2, 2, 2, 2,-1,-1,-1,-1,-1,-1},
-    0, //golomb_order
-    1, //inc_limit
-    20 //max_run
-  },{
-    { //level / run
-      {  1, 1, 0},{ -1, 1, 0},{   EOB   },{  2, 1, 0},{ -2, 1, 0},{  1, 2, 0},
-      { -1, 2, 0},{  3, 1, 1},{ -3, 1, 1},{  1, 3, 0},{ -1, 3, 0},{  4, 1, 1},
-      { -4, 1, 1},{  2, 2, 0},{ -2, 2, 0},{  1, 4, 0},{ -1, 4, 0},{  5, 1, 2},
-      { -5, 1, 2},{  1, 5, 0},{ -1, 5, 0},{  3, 2, 1},{ -3, 2, 1},{  2, 3, 0},
-      { -2, 3, 0},{  1, 6, 0},{ -1, 6, 0},{  6, 1, 2},{ -6, 1, 2},{  1, 7, 0},
-      { -1, 7, 0},{  2, 4, 0},{ -2, 4, 0},{  7, 1, 2},{ -7, 1, 2},{  1, 8, 0},
-      { -1, 8, 0},{  4, 2, 1},{ -4, 2, 1},{  1, 9, 0},{ -1, 9, 0},{  3, 3, 1},
-      { -3, 3, 1},{  2, 5, 0},{ -2, 5, 0},{  2, 6, 0},{ -2, 6, 0},{  8, 1, 2},
-      { -8, 1, 2},{  1,10, 0},{ -1,10, 0},{  1,11, 0},{ -1,11, 0},{  9, 1, 2},
-      { -9, 1, 2},{  5, 2, 2},{ -5, 2, 2},{  3, 4, 1},{ -3, 4, 1},
-    },
-    //level_add
-    { 0,10, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    1, //golomb_order
-    2, //inc_limit
-    11 //max_run
-  },{
-    { //level / run
-      {   EOB   },{  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},
-      { -3, 1, 0},{  4, 1, 0},{ -4, 1, 0},{  1, 2, 0},{ -1, 2, 0},{  5, 1, 1},
-      { -5, 1, 1},{  2, 2, 0},{ -2, 2, 0},{  6, 1, 1},{ -6, 1, 1},{  1, 3, 0},
-      { -1, 3, 0},{  7, 1, 1},{ -7, 1, 1},{  3, 2, 0},{ -3, 2, 0},{  8, 1, 1},
-      { -8, 1, 1},{  1, 4, 0},{ -1, 4, 0},{  2, 3, 0},{ -2, 3, 0},{  9, 1, 1},
-      { -9, 1, 1},{  4, 2, 0},{ -4, 2, 0},{  1, 5, 0},{ -1, 5, 0},{ 10, 1, 1},
-      {-10, 1, 1},{  3, 3, 0},{ -3, 3, 0},{  5, 2, 1},{ -5, 2, 1},{  2, 4, 0},
-      { -2, 4, 0},{ 11, 1, 1},{-11, 1, 1},{  1, 6, 0},{ -1, 6, 0},{ 12, 1, 1},
-      {-12, 1, 1},{  1, 7, 0},{ -1, 7, 0},{  6, 2, 1},{ -6, 2, 1},{ 13, 1, 1},
-      {-13, 1, 1},{  2, 5, 0},{ -2, 5, 0},{  1, 8, 0},{ -1, 8, 0},
-    },
-    //level_add
-    { 0,14, 7, 4, 3, 3, 2, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    1, //golomb_order
-    4, //inc_limit
-    8  //max_run
-  },{
-    { //level / run
-      {   EOB   },{  1, 1, 0},{ -1, 1, 0},{  2, 1, 0},{ -2, 1, 0},{  3, 1, 0},
-      { -3, 1, 0},{  4, 1, 0},{ -4, 1, 0},{  5, 1, 0},{ -5, 1, 0},{  6, 1, 0},
-      { -6, 1, 0},{  7, 1, 0},{ -7, 1, 0},{  8, 1, 0},{ -8, 1, 0},{  1, 2, 0},
-      { -1, 2, 0},{  9, 1, 0},{ -9, 1, 0},{ 10, 1, 0},{-10, 1, 0},{ 11, 1, 0},
-      {-11, 1, 0},{  2, 2, 0},{ -2, 2, 0},{ 12, 1, 0},{-12, 1, 0},{ 13, 1, 0},
-      {-13, 1, 0},{  3, 2, 0},{ -3, 2, 0},{ 14, 1, 0},{-14, 1, 0},{  1, 3, 0},
-      { -1, 3, 0},{ 15, 1, 0},{-15, 1, 0},{  4, 2, 0},{ -4, 2, 0},{ 16, 1, 0},
-      {-16, 1, 0},{ 17, 1, 0},{-17, 1, 0},{  5, 2, 0},{ -5, 2, 0},{  1, 4, 0},
-      { -1, 4, 0},{  2, 3, 0},{ -2, 3, 0},{ 18, 1, 0},{-18, 1, 0},{  6, 2, 0},
-      { -6, 2, 0},{ 19, 1, 0},{-19, 1, 0},{  1, 5, 0},{ -1, 5, 0},
-    },
-    //level_add
-    { 0,20, 7, 3, 2, 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-     -1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
-    0, //golomb_order
-    INT_MAX, //inc_limit
-    5, //max_run
-  }
-};
-
-#undef EOB
-
-static const uint8_t alpha_tab[64] = {
-   0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  2,  2,  2,  3,  3,
-   4,  4,  5,  5,  6,  7,  8,  9, 10, 11, 12, 13, 15, 16, 18, 20,
-  22, 24, 26, 28, 30, 33, 33, 35, 35, 36, 37, 37, 39, 39, 42, 44,
-  46, 48, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
-};
-
-static const uint8_t beta_tab[64] = {
-   0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  2,  2,  2,
-   2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,
-   6,  7,  7,  7,  8,  8,  8,  9,  9, 10, 10, 11, 11, 12, 13, 14,
-  15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27
-};
-
-static const uint8_t tc_tab[64] = {
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
-  2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4,
-  5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9
-};
-
-const int_fast8_t ff_left_modifier_l[8] = { 0,-1, 6,-1,-1, 7, 6, 7};
-const int_fast8_t ff_top_modifier_l[8]  = {-1, 1, 5,-1,-1, 5, 7, 7};
-const int_fast8_t ff_left_modifier_c[7] = { 5,-1, 2,-1, 6, 5, 6};
-const int_fast8_t ff_top_modifier_c[7]  = { 4, 1,-1,-1, 4, 6, 6};
-
-#endif /* AVCODEC_CAVSDATA_H */
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
deleted file mode 100644
index 9d6307c..0000000
--- a/libavcodec/cavsdec.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
- * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder
- * @author Stefan Gehrer <stefan.gehrer at gmx.de>
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-#include "cavs.h"
-
-static const uint8_t mv_scan[4] = {
-    MV_FWD_X0,MV_FWD_X1,
-    MV_FWD_X2,MV_FWD_X3
-};
-
-static const uint8_t cbp_tab[64][2] = {
-  {63, 0},{15,15},{31,63},{47,31},{ 0,16},{14,32},{13,47},{11,13},
-  { 7,14},{ 5,11},{10,12},{ 8, 5},{12,10},{61, 7},{ 4,48},{55, 3},
-  { 1, 2},{ 2, 8},{59, 4},{ 3, 1},{62,61},{ 9,55},{ 6,59},{29,62},
-  {45,29},{51,27},{23,23},{39,19},{27,30},{46,28},{53, 9},{30, 6},
-  {43,60},{37,21},{60,44},{16,26},{21,51},{28,35},{19,18},{35,20},
-  {42,24},{26,53},{44,17},{32,37},{58,39},{24,45},{20,58},{17,43},
-  {18,42},{48,46},{22,36},{33,33},{25,34},{49,40},{40,52},{36,49},
-  {34,50},{50,56},{52,25},{54,22},{41,54},{56,57},{38,41},{57,38}
-};
-
-/*****************************************************************************
- *
- * motion vector prediction
- *
- ****************************************************************************/
-
-static inline void store_mvs(AVSContext *h) {
-    h->col_mv[h->mbidx*4 + 0] = h->mv[MV_FWD_X0];
-    h->col_mv[h->mbidx*4 + 1] = h->mv[MV_FWD_X1];
-    h->col_mv[h->mbidx*4 + 2] = h->mv[MV_FWD_X2];
-    h->col_mv[h->mbidx*4 + 3] = h->mv[MV_FWD_X3];
-}
-
-static inline void mv_pred_direct(AVSContext *h, cavs_vector *pmv_fw,
-                                  cavs_vector *col_mv) {
-    cavs_vector *pmv_bw = pmv_fw + MV_BWD_OFFS;
-    int den = h->direct_den[col_mv->ref];
-    int m = col_mv->x >> 31;
-
-    pmv_fw->dist = h->dist[1];
-    pmv_bw->dist = h->dist[0];
-    pmv_fw->ref = 1;
-    pmv_bw->ref = 0;
-    /* scale the co-located motion vector according to its temporal span */
-    pmv_fw->x = (((den+(den*col_mv->x*pmv_fw->dist^m)-m-1)>>14)^m)-m;
-    pmv_bw->x = m-(((den+(den*col_mv->x*pmv_bw->dist^m)-m-1)>>14)^m);
-    m = col_mv->y >> 31;
-    pmv_fw->y = (((den+(den*col_mv->y*pmv_fw->dist^m)-m-1)>>14)^m)-m;
-    pmv_bw->y = m-(((den+(den*col_mv->y*pmv_bw->dist^m)-m-1)>>14)^m);
-}
-
-static inline void mv_pred_sym(AVSContext *h, cavs_vector *src, enum cavs_block size) {
-    cavs_vector *dst = src + MV_BWD_OFFS;
-
-    /* backward mv is the scaled and negated forward mv */
-    dst->x = -((src->x * h->sym_factor + 256) >> 9);
-    dst->y = -((src->y * h->sym_factor + 256) >> 9);
-    dst->ref = 0;
-    dst->dist = h->dist[0];
-    set_mvs(dst, size);
-}
-
-/*****************************************************************************
- *
- * residual data decoding
- *
- ****************************************************************************/
-
-/** kth-order exponential golomb code */
-static inline int get_ue_code(GetBitContext *gb, int order) {
-    if(order) {
-        int ret = get_ue_golomb(gb) << order;
-        return ret + get_bits(gb,order);
-    }
-    return get_ue_golomb(gb);
-}
-
-/**
- * decode coefficients from one 8x8 block, dequantize, inverse transform
- *  and add them to sample block
- * @param r pointer to 2D VLC table
- * @param esc_golomb_order escape codes are k-golomb with this order k
- * @param qp quantizer
- * @param dst location of sample block
- * @param stride line stride in frame buffer
- */
-static int decode_residual_block(AVSContext *h, GetBitContext *gb,
-                                 const struct dec_2dvlc *r, int esc_golomb_order,
-                                 int qp, uint8_t *dst, int stride) {
-    int i, level_code, esc_code, level, run, mask;
-    DCTELEM level_buf[65];
-    uint8_t run_buf[65];
-    DCTELEM *block = h->block;
-
-    for(i=0;i<65;i++) {
-        level_code = get_ue_code(gb,r->golomb_order);
-        if(level_code >= ESCAPE_CODE) {
-            run = ((level_code - ESCAPE_CODE) >> 1) + 1;
-            esc_code = get_ue_code(gb,esc_golomb_order);
-            level = esc_code + (run > r->max_run ? 1 : r->level_add[run]);
-            while(level > r->inc_limit)
-                r++;
-            mask = -(level_code & 1);
-            level = (level^mask) - mask;
-        } else {
-            level = r->rltab[level_code][0];
-            if(!level) //end of block signal
-                break;
-            run   = r->rltab[level_code][1];
-            r += r->rltab[level_code][2];
-        }
-        level_buf[i] = level;
-        run_buf[i] = run;
-    }
-    if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp],
-               ff_cavs_dequant_shift[qp], i))
-        return -1;
-    h->s.dsp.cavs_idct8_add(dst,block,stride);
-    h->s.dsp.clear_block(block);
-    return 0;
-}
-
-
-static inline void decode_residual_chroma(AVSContext *h) {
-    if(h->cbp & (1<<4))
-        decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,
-                              ff_cavs_chroma_qp[h->qp],h->cu,h->c_stride);
-    if(h->cbp & (1<<5))
-        decode_residual_block(h,&h->s.gb,ff_cavs_chroma_dec,0,
-                              ff_cavs_chroma_qp[h->qp],h->cv,h->c_stride);
-}
-
-static inline int decode_residual_inter(AVSContext *h) {
-    int block;
-
-    /* get coded block pattern */
-    int cbp= get_ue_golomb(&h->s.gb);
-    if(cbp > 63){
-        av_log(h->s.avctx, AV_LOG_ERROR, "illegal inter cbp\n");
-        return -1;
-    }
-    h->cbp = cbp_tab[cbp][1];
-
-    /* get quantizer */
-    if(h->cbp && !h->qp_fixed)
-        h->qp = (h->qp + get_se_golomb(&h->s.gb)) & 63;
-    for(block=0;block<4;block++)
-        if(h->cbp & (1<<block))
-            decode_residual_block(h,&h->s.gb,ff_cavs_inter_dec,0,h->qp,
-                                  h->cy + h->luma_scan[block], h->l_stride);
-    decode_residual_chroma(h);
-
-    return 0;
-}
-
-/*****************************************************************************
- *
- * macroblock level
- *
- ****************************************************************************/
-
-static int decode_mb_i(AVSContext *h, int cbp_code) {
-    GetBitContext *gb = &h->s.gb;
-    int block, pred_mode_uv;
-    uint8_t top[18];
-    uint8_t *left = NULL;
-    uint8_t *d;
-
-    ff_cavs_init_mb(h);
-
-    /* get intra prediction modes from stream */
-    for(block=0;block<4;block++) {
-        int nA,nB,predpred;
-        int pos = ff_cavs_scan3x3[block];
-
-        nA = h->pred_mode_Y[pos-1];
-        nB = h->pred_mode_Y[pos-3];
-        predpred = FFMIN(nA,nB);
-        if(predpred == NOT_AVAIL) // if either is not available
-            predpred = INTRA_L_LP;
-        if(!get_bits1(gb)){
-            int rem_mode= get_bits(gb, 2);
-            predpred = rem_mode + (rem_mode >= predpred);
-        }
-        h->pred_mode_Y[pos] = predpred;
-    }
-    pred_mode_uv = get_ue_golomb(gb);
-    if(pred_mode_uv > 6) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra chroma pred mode\n");
-        return -1;
-    }
-    ff_cavs_modify_mb_i(h, &pred_mode_uv);
-
-    /* get coded block pattern */
-    if(h->pic_type == FF_I_TYPE)
-        cbp_code = get_ue_golomb(gb);
-    if(cbp_code > 63){
-        av_log(h->s.avctx, AV_LOG_ERROR, "illegal intra cbp\n");
-        return -1;
-    }
-    h->cbp = cbp_tab[cbp_code][0];
-    if(h->cbp && !h->qp_fixed)
-        h->qp = (h->qp + get_se_golomb(gb)) & 63; //qp_delta
-
-    /* luma intra prediction interleaved with residual decode/transform/add */
-    for(block=0;block<4;block++) {
-        d = h->cy + h->luma_scan[block];
-        ff_cavs_load_intra_pred_luma(h, top, &left, block);
-        h->intra_pred_l[h->pred_mode_Y[ff_cavs_scan3x3[block]]]
-            (d, top, left, h->l_stride);
-        if(h->cbp & (1<<block))
-            decode_residual_block(h,gb,ff_cavs_intra_dec,1,h->qp,d,h->l_stride);
-    }
-
-    /* chroma intra prediction */
-    ff_cavs_load_intra_pred_chroma(h);
-    h->intra_pred_c[pred_mode_uv](h->cu, &h->top_border_u[h->mbx*10],
-                                  h->left_border_u, h->c_stride);
-    h->intra_pred_c[pred_mode_uv](h->cv, &h->top_border_v[h->mbx*10],
-                                  h->left_border_v, h->c_stride);
-
-    decode_residual_chroma(h);
-    ff_cavs_filter(h,I_8X8);
-    set_mv_intra(h);
-    return 0;
-}
-
-static void decode_mb_p(AVSContext *h, enum cavs_mb mb_type) {
-    GetBitContext *gb = &h->s.gb;
-    int ref[4];
-
-    ff_cavs_init_mb(h);
-    switch(mb_type) {
-    case P_SKIP:
-        ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_PSKIP,  BLK_16X16, 0);
-        break;
-    case P_16X16:
-        ref[0] = h->ref_flag ? 0 : get_bits1(gb);
-        ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16,ref[0]);
-        break;
-    case P_16X8:
-        ref[0] = h->ref_flag ? 0 : get_bits1(gb);
-        ref[2] = h->ref_flag ? 0 : get_bits1(gb);
-        ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP,    BLK_16X8, ref[0]);
-        ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT,   BLK_16X8, ref[2]);
-        break;
-    case P_8X16:
-        ref[0] = h->ref_flag ? 0 : get_bits1(gb);
-        ref[1] = h->ref_flag ? 0 : get_bits1(gb);
-        ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT,   BLK_8X16, ref[0]);
-        ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_TOPRIGHT,BLK_8X16, ref[1]);
-        break;
-    case P_8X8:
-        ref[0] = h->ref_flag ? 0 : get_bits1(gb);
-        ref[1] = h->ref_flag ? 0 : get_bits1(gb);
-        ref[2] = h->ref_flag ? 0 : get_bits1(gb);
-        ref[3] = h->ref_flag ? 0 : get_bits1(gb);
-        ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_MEDIAN,   BLK_8X8, ref[0]);
-        ff_cavs_mv(h, MV_FWD_X1, MV_FWD_C2, MV_PRED_MEDIAN,   BLK_8X8, ref[1]);
-        ff_cavs_mv(h, MV_FWD_X2, MV_FWD_X1, MV_PRED_MEDIAN,   BLK_8X8, ref[2]);
-        ff_cavs_mv(h, MV_FWD_X3, MV_FWD_X0, MV_PRED_MEDIAN,   BLK_8X8, ref[3]);
-    }
-    ff_cavs_inter(h, mb_type);
-    set_intra_mode_default(h);
-    store_mvs(h);
-    if(mb_type != P_SKIP)
-        decode_residual_inter(h);
-    ff_cavs_filter(h,mb_type);
-    h->col_type_base[h->mbidx] = mb_type;
-}
-
-static void decode_mb_b(AVSContext *h, enum cavs_mb mb_type) {
-    int block;
-    enum cavs_sub_mb sub_type[4];
-    int flags;
-
-    ff_cavs_init_mb(h);
-
-    /* reset all MVs */
-    h->mv[MV_FWD_X0] = ff_cavs_dir_mv;
-    set_mvs(&h->mv[MV_FWD_X0], BLK_16X16);
-    h->mv[MV_BWD_X0] = ff_cavs_dir_mv;
-    set_mvs(&h->mv[MV_BWD_X0], BLK_16X16);
-    switch(mb_type) {
-    case B_SKIP:
-    case B_DIRECT:
-        if(!h->col_type_base[h->mbidx]) {
-            /* intra MB at co-location, do in-plane prediction */
-            ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_BSKIP, BLK_16X16, 1);
-            ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_BSKIP, BLK_16X16, 0);
-        } else
-            /* direct prediction from co-located P MB, block-wise */
-            for(block=0;block<4;block++)
-                mv_pred_direct(h,&h->mv[mv_scan[block]],
-                                 &h->col_mv[h->mbidx*4 + block]);
-        break;
-    case B_FWD_16X16:
-        ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1);
-        break;
-    case B_SYM_16X16:
-        ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_MEDIAN, BLK_16X16, 1);
-        mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X16);
-        break;
-    case B_BWD_16X16:
-        ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_MEDIAN, BLK_16X16, 0);
-        break;
-    case B_8X8:
-        for(block=0;block<4;block++)
-            sub_type[block] = get_bits(&h->s.gb,2);
-        for(block=0;block<4;block++) {
-            switch(sub_type[block]) {
-            case B_SUB_DIRECT:
-                if(!h->col_type_base[h->mbidx]) {
-                    /* intra MB at co-location, do in-plane prediction */
-                    ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
-                            MV_PRED_BSKIP, BLK_8X8, 1);
-                    ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS,
-                            mv_scan[block]-3+MV_BWD_OFFS,
-                            MV_PRED_BSKIP, BLK_8X8, 0);
-                } else
-                    mv_pred_direct(h,&h->mv[mv_scan[block]],
-                                   &h->col_mv[h->mbidx*4 + block]);
-                break;
-            case B_SUB_FWD:
-                ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
-                        MV_PRED_MEDIAN, BLK_8X8, 1);
-                break;
-            case B_SUB_SYM:
-                ff_cavs_mv(h, mv_scan[block], mv_scan[block]-3,
-                        MV_PRED_MEDIAN, BLK_8X8, 1);
-                mv_pred_sym(h, &h->mv[mv_scan[block]], BLK_8X8);
-                break;
-            }
-        }
-        for(block=0;block<4;block++) {
-            if(sub_type[block] == B_SUB_BWD)
-                ff_cavs_mv(h, mv_scan[block]+MV_BWD_OFFS,
-                        mv_scan[block]+MV_BWD_OFFS-3,
-                        MV_PRED_MEDIAN, BLK_8X8, 0);
-        }
-        break;
-    default:
-        assert((mb_type > B_SYM_16X16) && (mb_type < B_8X8));
-        flags = ff_cavs_partition_flags[mb_type];
-        if(mb_type & 1) { /* 16x8 macroblock types */
-            if(flags & FWD0)
-                ff_cavs_mv(h, MV_FWD_X0, MV_FWD_C2, MV_PRED_TOP,  BLK_16X8, 1);
-            if(flags & SYM0)
-                mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_16X8);
-            if(flags & FWD1)
-                ff_cavs_mv(h, MV_FWD_X2, MV_FWD_A1, MV_PRED_LEFT, BLK_16X8, 1);
-            if(flags & SYM1)
-                mv_pred_sym(h, &h->mv[MV_FWD_X2], BLK_16X8);
-            if(flags & BWD0)
-                ff_cavs_mv(h, MV_BWD_X0, MV_BWD_C2, MV_PRED_TOP,  BLK_16X8, 0);
-            if(flags & BWD1)
-                ff_cavs_mv(h, MV_BWD_X2, MV_BWD_A1, MV_PRED_LEFT, BLK_16X8, 0);
-        } else {          /* 8x16 macroblock types */
-            if(flags & FWD0)
-                ff_cavs_mv(h, MV_FWD_X0, MV_FWD_B3, MV_PRED_LEFT, BLK_8X16, 1);
-            if(flags & SYM0)
-                mv_pred_sym(h, &h->mv[MV_FWD_X0], BLK_8X16);
-            if(flags & FWD1)
-                ff_cavs_mv(h,MV_FWD_X1,MV_FWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,1);
-            if(flags & SYM1)
-                mv_pred_sym(h, &h->mv[MV_FWD_X1], BLK_8X16);
-            if(flags & BWD0)
-                ff_cavs_mv(h, MV_BWD_X0, MV_BWD_B3, MV_PRED_LEFT, BLK_8X16, 0);
-            if(flags & BWD1)
-                ff_cavs_mv(h,MV_BWD_X1,MV_BWD_C2,MV_PRED_TOPRIGHT,BLK_8X16,0);
-        }
-    }
-    ff_cavs_inter(h, mb_type);
-    set_intra_mode_default(h);
-    if(mb_type != B_SKIP)
-        decode_residual_inter(h);
-    ff_cavs_filter(h,mb_type);
-}
-
-/*****************************************************************************
- *
- * slice level
- *
- ****************************************************************************/
-
-static inline int decode_slice_header(AVSContext *h, GetBitContext *gb) {
-    if(h->stc > 0xAF)
-        av_log(h->s.avctx, AV_LOG_ERROR, "unexpected start code 0x%02x\n", h->stc);
-    h->mby = h->stc;
-    h->mbidx = h->mby*h->mb_width;
-
-    /* mark top macroblocks as unavailable */
-    h->flags &= ~(B_AVAIL|C_AVAIL);
-    if((h->mby == 0) && (!h->qp_fixed)){
-        h->qp_fixed = get_bits1(gb);
-        h->qp = get_bits(gb,6);
-    }
-    /* inter frame or second slice can have weighting params */
-    if((h->pic_type != FF_I_TYPE) || (!h->pic_structure && h->mby >= h->mb_width/2))
-        if(get_bits1(gb)) { //slice_weighting_flag
-            av_log(h->s.avctx, AV_LOG_ERROR,
-                   "weighted prediction not yet supported\n");
-        }
-    return 0;
-}
-
-static inline int check_for_slice(AVSContext *h) {
-    GetBitContext *gb = &h->s.gb;
-    int align;
-
-    if(h->mbx)
-        return 0;
-    align = (-get_bits_count(gb)) & 7;
-    /* check for stuffing byte */
-    if(!align && (show_bits(gb,8) == 0x80))
-        align = 8;
-    if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) {
-        skip_bits_long(gb,24+align);
-        h->stc = get_bits(gb,8);
-        decode_slice_header(h,gb);
-        return 1;
-    }
-    return 0;
-}
-
-/*****************************************************************************
- *
- * frame level
- *
- ****************************************************************************/
-
-static int decode_pic(AVSContext *h) {
-    MpegEncContext *s = &h->s;
-    int skip_count = -1;
-    enum cavs_mb mb_type;
-
-    if (!s->context_initialized) {
-        s->avctx->idct_algo = FF_IDCT_CAVS;
-        if (MPV_common_init(s) < 0)
-            return -1;
-        ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct);
-    }
-    skip_bits(&s->gb,16);//bbv_dwlay
-    if(h->stc == PIC_PB_START_CODE) {
-        h->pic_type = get_bits(&s->gb,2) + FF_I_TYPE;
-        if(h->pic_type > FF_B_TYPE) {
-            av_log(s->avctx, AV_LOG_ERROR, "illegal picture type\n");
-            return -1;
-        }
-        /* make sure we have the reference frames we need */
-        if(!h->DPB[0].data[0] ||
-          (!h->DPB[1].data[0] && h->pic_type == FF_B_TYPE))
-            return -1;
-    } else {
-        h->pic_type = FF_I_TYPE;
-        if(get_bits1(&s->gb))
-            skip_bits(&s->gb,24);//time_code
-        /* old sample clips were all progressive and no low_delay,
-           bump stream revision if detected otherwise */
-        if((s->low_delay) || !(show_bits(&s->gb,9) & 1))
-            h->stream_revision = 1;
-        /* similarly test top_field_first and repeat_first_field */
-        else if(show_bits(&s->gb,11) & 3)
-            h->stream_revision = 1;
-        if(h->stream_revision > 0)
-            skip_bits(&s->gb,1); //marker_bit
-    }
-    /* release last B frame */
-    if(h->picture.data[0])
-        s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture);
-
-    s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture);
-    ff_cavs_init_pic(h);
-    h->picture.poc = get_bits(&s->gb,8)*2;
-
-    /* get temporal distances and MV scaling factors */
-    if(h->pic_type != FF_B_TYPE) {
-        h->dist[0] = (h->picture.poc - h->DPB[0].poc  + 512) % 512;
-    } else {
-        h->dist[0] = (h->DPB[0].poc  - h->picture.poc + 512) % 512;
-    }
-    h->dist[1] = (h->picture.poc - h->DPB[1].poc  + 512) % 512;
-    h->scale_den[0] = h->dist[0] ? 512/h->dist[0] : 0;
-    h->scale_den[1] = h->dist[1] ? 512/h->dist[1] : 0;
-    if(h->pic_type == FF_B_TYPE) {
-        h->sym_factor = h->dist[0]*h->scale_den[1];
-    } else {
-        h->direct_den[0] = h->dist[0] ? 16384/h->dist[0] : 0;
-        h->direct_den[1] = h->dist[1] ? 16384/h->dist[1] : 0;
-    }
-
-    if(s->low_delay)
-        get_ue_golomb(&s->gb); //bbv_check_times
-    h->progressive             = get_bits1(&s->gb);
-    h->pic_structure = 1;
-    if(!h->progressive)
-        h->pic_structure = get_bits1(&s->gb);
-    if(!h->pic_structure && h->stc == PIC_PB_START_CODE)
-        skip_bits1(&s->gb);     //advanced_pred_mode_disable
-    skip_bits1(&s->gb);        //top_field_first
-    skip_bits1(&s->gb);        //repeat_first_field
-    h->qp_fixed                = get_bits1(&s->gb);
-    h->qp                      = get_bits(&s->gb,6);
-    if(h->pic_type == FF_I_TYPE) {
-        if(!h->progressive && !h->pic_structure)
-            skip_bits1(&s->gb);//what is this?
-        skip_bits(&s->gb,4);   //reserved bits
-    } else {
-        if(!(h->pic_type == FF_B_TYPE && h->pic_structure == 1))
-            h->ref_flag        = get_bits1(&s->gb);
-        skip_bits(&s->gb,4);   //reserved bits
-        h->skip_mode_flag      = get_bits1(&s->gb);
-    }
-    h->loop_filter_disable     = get_bits1(&s->gb);
-    if(!h->loop_filter_disable && get_bits1(&s->gb)) {
-        h->alpha_offset        = get_se_golomb(&s->gb);
-        h->beta_offset         = get_se_golomb(&s->gb);
-    } else {
-        h->alpha_offset = h->beta_offset  = 0;
-    }
-    if(h->pic_type == FF_I_TYPE) {
-        do {
-            check_for_slice(h);
-            decode_mb_i(h, 0);
-        } while(ff_cavs_next_mb(h));
-    } else if(h->pic_type == FF_P_TYPE) {
-        do {
-            if(check_for_slice(h))
-                skip_count = -1;
-            if(h->skip_mode_flag && (skip_count < 0))
-                skip_count = get_ue_golomb(&s->gb);
-            if(h->skip_mode_flag && skip_count--) {
-                decode_mb_p(h,P_SKIP);
-            } else {
-                mb_type = get_ue_golomb(&s->gb) + P_SKIP + h->skip_mode_flag;
-                if(mb_type > P_8X8)
-                    decode_mb_i(h, mb_type - P_8X8 - 1);
-                else
-                    decode_mb_p(h,mb_type);
-            }
-        } while(ff_cavs_next_mb(h));
-    } else { /* FF_B_TYPE */
-        do {
-            if(check_for_slice(h))
-                skip_count = -1;
-            if(h->skip_mode_flag && (skip_count < 0))
-                skip_count = get_ue_golomb(&s->gb);
-            if(h->skip_mode_flag && skip_count--) {
-                decode_mb_b(h,B_SKIP);
-            } else {
-                mb_type = get_ue_golomb(&s->gb) + B_SKIP + h->skip_mode_flag;
-                if(mb_type > B_8X8)
-                    decode_mb_i(h, mb_type - B_8X8 - 1);
-                else
-                    decode_mb_b(h,mb_type);
-            }
-        } while(ff_cavs_next_mb(h));
-    }
-    if(h->pic_type != FF_B_TYPE) {
-        if(h->DPB[1].data[0])
-            s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);
-        h->DPB[1] = h->DPB[0];
-        h->DPB[0] = h->picture;
-        memset(&h->picture,0,sizeof(Picture));
-    }
-    return 0;
-}
-
-/*****************************************************************************
- *
- * headers and interface
- *
- ****************************************************************************/
-
-static int decode_seq_header(AVSContext *h) {
-    MpegEncContext *s = &h->s;
-    int frame_rate_code;
-
-    h->profile =         get_bits(&s->gb,8);
-    h->level =           get_bits(&s->gb,8);
-    skip_bits1(&s->gb); //progressive sequence
-    s->width =           get_bits(&s->gb,14);
-    s->height =          get_bits(&s->gb,14);
-    skip_bits(&s->gb,2); //chroma format
-    skip_bits(&s->gb,3); //sample_precision
-    h->aspect_ratio =    get_bits(&s->gb,4);
-    frame_rate_code =    get_bits(&s->gb,4);
-    skip_bits(&s->gb,18);//bit_rate_lower
-    skip_bits1(&s->gb);  //marker_bit
-    skip_bits(&s->gb,12);//bit_rate_upper
-    s->low_delay =       get_bits1(&s->gb);
-    h->mb_width  = (s->width  + 15) >> 4;
-    h->mb_height = (s->height + 15) >> 4;
-    h->s.avctx->time_base.den = ff_frame_rate_tab[frame_rate_code].num;
-    h->s.avctx->time_base.num = ff_frame_rate_tab[frame_rate_code].den;
-    h->s.avctx->width  = s->width;
-    h->s.avctx->height = s->height;
-    if(!h->top_qp)
-        ff_cavs_init_top_lines(h);
-    return 0;
-}
-
-static void cavs_flush(AVCodecContext * avctx) {
-    AVSContext *h = avctx->priv_data;
-    h->got_keyframe = 0;
-}
-
-static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
-                             AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AVSContext *h = avctx->priv_data;
-    MpegEncContext *s = &h->s;
-    int input_size;
-    const uint8_t *buf_end;
-    const uint8_t *buf_ptr;
-    AVFrame *picture = data;
-    uint32_t stc = -1;
-
-    s->avctx = avctx;
-
-    if (buf_size == 0) {
-        if(!s->low_delay && h->DPB[0].data[0]) {
-            *data_size = sizeof(AVPicture);
-            *picture = *(AVFrame *) &h->DPB[0];
-        }
-        return 0;
-    }
-
-    buf_ptr = buf;
-    buf_end = buf + buf_size;
-    for(;;) {
-        buf_ptr = ff_find_start_code(buf_ptr,buf_end, &stc);
-        if(stc & 0xFFFFFE00)
-            return FFMAX(0, buf_ptr - buf - s->parse_context.last_index);
-        input_size = (buf_end - buf_ptr)*8;
-        switch(stc) {
-        case CAVS_START_CODE:
-            init_get_bits(&s->gb, buf_ptr, input_size);
-            decode_seq_header(h);
-            break;
-        case PIC_I_START_CODE:
-            if(!h->got_keyframe) {
-                if(h->DPB[0].data[0])
-                    avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]);
-                if(h->DPB[1].data[0])
-                    avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]);
-                h->got_keyframe = 1;
-            }
-        case PIC_PB_START_CODE:
-            *data_size = 0;
-            if(!h->got_keyframe)
-                break;
-            init_get_bits(&s->gb, buf_ptr, input_size);
-            h->stc = stc;
-            if(decode_pic(h))
-                break;
-            *data_size = sizeof(AVPicture);
-            if(h->pic_type != FF_B_TYPE) {
-                if(h->DPB[1].data[0]) {
-                    *picture = *(AVFrame *) &h->DPB[1];
-                } else {
-                    *data_size = 0;
-                }
-            } else
-                *picture = *(AVFrame *) &h->picture;
-            break;
-        case EXT_START_CODE:
-            //mpeg_decode_extension(avctx,buf_ptr, input_size);
-            break;
-        case USER_START_CODE:
-            //mpeg_decode_user_data(avctx,buf_ptr, input_size);
-            break;
-        default:
-            if (stc <= SLICE_MAX_START_CODE) {
-                init_get_bits(&s->gb, buf_ptr, input_size);
-                decode_slice_header(h, &s->gb);
-            }
-            break;
-        }
-    }
-}
-
-AVCodec cavs_decoder = {
-    "cavs",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CAVS,
-    sizeof(AVSContext),
-    ff_cavs_init,
-    NULL,
-    ff_cavs_end,
-    cavs_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    .flush= cavs_flush,
-    .long_name= NULL_IF_CONFIG_SMALL("Chinese AVS video (AVS1-P2, JiZhun profile)"),
-};
diff --git a/libavcodec/cavsdsp.c b/libavcodec/cavsdsp.c
deleted file mode 100644
index 808f62b..0000000
--- a/libavcodec/cavsdsp.c
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
- *
- * DSP functions
- *
- * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include "dsputil.h"
-
-/*****************************************************************************
- *
- * in-loop deblocking filter
- *
- ****************************************************************************/
-
-#define P2 p0_p[-3*stride]
-#define P1 p0_p[-2*stride]
-#define P0 p0_p[-1*stride]
-#define Q0 p0_p[ 0*stride]
-#define Q1 p0_p[ 1*stride]
-#define Q2 p0_p[ 2*stride]
-
-static inline void loop_filter_l2(uint8_t *p0_p,int stride,int alpha, int beta) {
-    int p0 = P0;
-    int q0 = Q0;
-
-    if(abs(p0-q0)<alpha && abs(P1-p0)<beta && abs(Q1-q0)<beta) {
-        int s = p0 + q0 + 2;
-        alpha = (alpha>>2) + 2;
-        if(abs(P2-p0) < beta && abs(p0-q0) < alpha) {
-            P0 = (P1 + p0 + s) >> 2;
-            P1 = (2*P1 + s) >> 2;
-        } else
-            P0 = (2*P1 + s) >> 2;
-        if(abs(Q2-q0) < beta && abs(q0-p0) < alpha) {
-            Q0 = (Q1 + q0 + s) >> 2;
-            Q1 = (2*Q1 + s) >> 2;
-        } else
-            Q0 = (2*Q1 + s) >> 2;
-    }
-}
-
-static inline void loop_filter_l1(uint8_t *p0_p, int stride, int alpha, int beta, int tc) {
-    int p0 = P0;
-    int q0 = Q0;
-
-    if(abs(p0-q0)<alpha && abs(P1-p0)<beta && abs(Q1-q0)<beta) {
-        int delta = av_clip(((q0-p0)*3+P1-Q1+4)>>3,-tc, tc);
-        P0 = av_clip_uint8(p0+delta);
-        Q0 = av_clip_uint8(q0-delta);
-        if(abs(P2-p0)<beta) {
-            delta = av_clip(((P0-P1)*3+P2-Q0+4)>>3, -tc, tc);
-            P1 = av_clip_uint8(P1+delta);
-        }
-        if(abs(Q2-q0)<beta) {
-            delta = av_clip(((Q1-Q0)*3+P0-Q2+4)>>3, -tc, tc);
-            Q1 = av_clip_uint8(Q1-delta);
-        }
-    }
-}
-
-static inline void loop_filter_c2(uint8_t *p0_p,int stride,int alpha, int beta) {
-    int p0 = P0;
-    int q0 = Q0;
-
-    if(abs(p0-q0)<alpha && abs(P1-p0)<beta && abs(Q1-q0)<beta) {
-        int s = p0 + q0 + 2;
-        alpha = (alpha>>2) + 2;
-        if(abs(P2-p0) < beta && abs(p0-q0) < alpha) {
-            P0 = (P1 + p0 + s) >> 2;
-        } else
-            P0 = (2*P1 + s) >> 2;
-        if(abs(Q2-q0) < beta && abs(q0-p0) < alpha) {
-            Q0 = (Q1 + q0 + s) >> 2;
-        } else
-            Q0 = (2*Q1 + s) >> 2;
-    }
-}
-
-static inline void loop_filter_c1(uint8_t *p0_p,int stride,int alpha, int beta,
-                                  int tc) {
-    if(abs(P0-Q0)<alpha && abs(P1-P0)<beta && abs(Q1-Q0)<beta) {
-        int delta = av_clip(((Q0-P0)*3+P1-Q1+4)>>3, -tc, tc);
-        P0 = av_clip_uint8(P0+delta);
-        Q0 = av_clip_uint8(Q0-delta);
-    }
-}
-
-#undef P0
-#undef P1
-#undef P2
-#undef Q0
-#undef Q1
-#undef Q2
-
-static void cavs_filter_lv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
-                           int bs1, int bs2) {
-    int i;
-    if(bs1==2)
-        for(i=0;i<16;i++)
-            loop_filter_l2(d + i*stride,1,alpha,beta);
-    else {
-        if(bs1)
-            for(i=0;i<8;i++)
-                loop_filter_l1(d + i*stride,1,alpha,beta,tc);
-        if (bs2)
-            for(i=8;i<16;i++)
-                loop_filter_l1(d + i*stride,1,alpha,beta,tc);
-    }
-}
-
-static void cavs_filter_lh_c(uint8_t *d, int stride, int alpha, int beta, int tc,
-                           int bs1, int bs2) {
-    int i;
-    if(bs1==2)
-        for(i=0;i<16;i++)
-            loop_filter_l2(d + i,stride,alpha,beta);
-    else {
-        if(bs1)
-            for(i=0;i<8;i++)
-                loop_filter_l1(d + i,stride,alpha,beta,tc);
-        if (bs2)
-            for(i=8;i<16;i++)
-                loop_filter_l1(d + i,stride,alpha,beta,tc);
-    }
-}
-
-static void cavs_filter_cv_c(uint8_t *d, int stride, int alpha, int beta, int tc,
-                           int bs1, int bs2) {
-    int i;
-    if(bs1==2)
-        for(i=0;i<8;i++)
-            loop_filter_c2(d + i*stride,1,alpha,beta);
-    else {
-        if(bs1)
-            for(i=0;i<4;i++)
-                loop_filter_c1(d + i*stride,1,alpha,beta,tc);
-        if (bs2)
-            for(i=4;i<8;i++)
-                loop_filter_c1(d + i*stride,1,alpha,beta,tc);
-    }
-}
-
-static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc,
-                           int bs1, int bs2) {
-    int i;
-    if(bs1==2)
-        for(i=0;i<8;i++)
-            loop_filter_c2(d + i,stride,alpha,beta);
-    else {
-        if(bs1)
-            for(i=0;i<4;i++)
-                loop_filter_c1(d + i,stride,alpha,beta,tc);
-        if (bs2)
-            for(i=4;i<8;i++)
-                loop_filter_c1(d + i,stride,alpha,beta,tc);
-    }
-}
-
-/*****************************************************************************
- *
- * inverse transform
- *
- ****************************************************************************/
-
-static void cavs_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride) {
-    int i;
-    DCTELEM (*src)[8] = (DCTELEM(*)[8])block;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    src[0][0] += 8;
-
-    for( i = 0; i < 8; i++ ) {
-        const int a0 =  3*src[i][1] - (src[i][7]<<1);
-        const int a1 =  3*src[i][3] + (src[i][5]<<1);
-        const int a2 =  (src[i][3]<<1) - 3*src[i][5];
-        const int a3 =  (src[i][1]<<1) + 3*src[i][7];
-
-        const int b4 = ((a0 + a1 + a3)<<1) + a1;
-        const int b5 = ((a0 - a1 + a2)<<1) + a0;
-        const int b6 = ((a3 - a2 - a1)<<1) + a3;
-        const int b7 = ((a0 - a2 - a3)<<1) - a2;
-
-        const int a7 = (src[i][2]<<2) - 10*src[i][6];
-        const int a6 = (src[i][6]<<2) + 10*src[i][2];
-        const int a5 = ((src[i][0] - src[i][4]) << 3) + 4;
-        const int a4 = ((src[i][0] + src[i][4]) << 3) + 4;
-
-        const int b0 = a4 + a6;
-        const int b1 = a5 + a7;
-        const int b2 = a5 - a7;
-        const int b3 = a4 - a6;
-
-        src[i][0] = (b0 + b4) >> 3;
-        src[i][1] = (b1 + b5) >> 3;
-        src[i][2] = (b2 + b6) >> 3;
-        src[i][3] = (b3 + b7) >> 3;
-        src[i][4] = (b3 - b7) >> 3;
-        src[i][5] = (b2 - b6) >> 3;
-        src[i][6] = (b1 - b5) >> 3;
-        src[i][7] = (b0 - b4) >> 3;
-    }
-    for( i = 0; i < 8; i++ ) {
-        const int a0 =  3*src[1][i] - (src[7][i]<<1);
-        const int a1 =  3*src[3][i] + (src[5][i]<<1);
-        const int a2 =  (src[3][i]<<1) - 3*src[5][i];
-        const int a3 =  (src[1][i]<<1) + 3*src[7][i];
-
-        const int b4 = ((a0 + a1 + a3)<<1) + a1;
-        const int b5 = ((a0 - a1 + a2)<<1) + a0;
-        const int b6 = ((a3 - a2 - a1)<<1) + a3;
-        const int b7 = ((a0 - a2 - a3)<<1) - a2;
-
-        const int a7 = (src[2][i]<<2) - 10*src[6][i];
-        const int a6 = (src[6][i]<<2) + 10*src[2][i];
-        const int a5 = (src[0][i] - src[4][i]) << 3;
-        const int a4 = (src[0][i] + src[4][i]) << 3;
-
-        const int b0 = a4 + a6;
-        const int b1 = a5 + a7;
-        const int b2 = a5 - a7;
-        const int b3 = a4 - a6;
-
-        dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b4) >> 7)];
-        dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b1 + b5) >> 7)];
-        dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b2 + b6) >> 7)];
-        dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b3 + b7) >> 7)];
-        dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b3 - b7) >> 7)];
-        dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b2 - b6) >> 7)];
-        dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b1 - b5) >> 7)];
-        dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b4) >> 7)];
-    }
-}
-
-/*****************************************************************************
- *
- * motion compensation
- *
- ****************************************************************************/
-
-#define CAVS_SUBPIX(OPNAME, OP, NAME, A, B, C, D, E, F) \
-static void OPNAME ## cavs_filt8_h_ ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int h=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[0], A*src[-2] + B*src[-1] + C*src[0] + D*src[1] + E*src[2] + F*src[3]);\
-        OP(dst[1], A*src[-1] + B*src[ 0] + C*src[1] + D*src[2] + E*src[3] + F*src[4]);\
-        OP(dst[2], A*src[ 0] + B*src[ 1] + C*src[2] + D*src[3] + E*src[4] + F*src[5]);\
-        OP(dst[3], A*src[ 1] + B*src[ 2] + C*src[3] + D*src[4] + E*src[5] + F*src[6]);\
-        OP(dst[4], A*src[ 2] + B*src[ 3] + C*src[4] + D*src[5] + E*src[6] + F*src[7]);\
-        OP(dst[5], A*src[ 3] + B*src[ 4] + C*src[5] + D*src[6] + E*src[7] + F*src[8]);\
-        OP(dst[6], A*src[ 4] + B*src[ 5] + C*src[6] + D*src[7] + E*src[8] + F*src[9]);\
-        OP(dst[7], A*src[ 5] + B*src[ 6] + C*src[7] + D*src[8] + E*src[9] + F*src[10]);\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## cavs_filt8_v_  ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<w; i++)\
-    {\
-        const int srcB= src[-2*srcStride];\
-        const int srcA= src[-1*srcStride];\
-        const int src0= src[0 *srcStride];\
-        const int src1= src[1 *srcStride];\
-        const int src2= src[2 *srcStride];\
-        const int src3= src[3 *srcStride];\
-        const int src4= src[4 *srcStride];\
-        const int src5= src[5 *srcStride];\
-        const int src6= src[6 *srcStride];\
-        const int src7= src[7 *srcStride];\
-        const int src8= src[8 *srcStride];\
-        const int src9= src[9 *srcStride];\
-        const int src10= src[10 *srcStride];\
-        OP(dst[0*dstStride], A*srcB + B*srcA + C*src0 + D*src1 + E*src2 + F*src3);\
-        OP(dst[1*dstStride], A*srcA + B*src0 + C*src1 + D*src2 + E*src3 + F*src4);\
-        OP(dst[2*dstStride], A*src0 + B*src1 + C*src2 + D*src3 + E*src4 + F*src5);\
-        OP(dst[3*dstStride], A*src1 + B*src2 + C*src3 + D*src4 + E*src5 + F*src6);\
-        OP(dst[4*dstStride], A*src2 + B*src3 + C*src4 + D*src5 + E*src6 + F*src7);\
-        OP(dst[5*dstStride], A*src3 + B*src4 + C*src5 + D*src6 + E*src7 + F*src8);\
-        OP(dst[6*dstStride], A*src4 + B*src5 + C*src6 + D*src7 + E*src8 + F*src9);\
-        OP(dst[7*dstStride], A*src5 + B*src6 + C*src7 + D*src8 + E*src9 + F*src10);\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static void OPNAME ## cavs_filt16_v_ ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_filt8_v_ ## NAME(dst  , src  , dstStride, srcStride);\
-    OPNAME ## cavs_filt8_v_ ## NAME(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## cavs_filt8_v_ ## NAME(dst  , src  , dstStride, srcStride);\
-    OPNAME ## cavs_filt8_v_ ## NAME(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static void OPNAME ## cavs_filt16_h_ ## NAME(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_filt8_h_ ## NAME(dst  , src  , dstStride, srcStride);\
-    OPNAME ## cavs_filt8_h_ ## NAME(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## cavs_filt8_h_ ## NAME(dst  , src  , dstStride, srcStride);\
-    OPNAME ## cavs_filt8_h_ ## NAME(dst+8, src+8, dstStride, srcStride);\
-}\
-
-#define CAVS_SUBPIX_HV(OPNAME, OP, NAME, AH, BH, CH, DH, EH, FH, AV, BV, CV, DV, EV, FV, FULL) \
-static void OPNAME ## cavs_filt8_hv_ ## NAME(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int srcStride){\
-    int16_t temp[8*(8+5)];\
-    int16_t *tmp = temp;\
-    const int h=8;\
-    const int w=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    src1 -= 2*srcStride;\
-    for(i=0; i<h+5; i++)\
-    {\
-        tmp[0]= AH*src1[-2] + BH*src1[-1] + CH*src1[0] + DH*src1[1] + EH*src1[2] + FH*src1[3];\
-        tmp[1]= AH*src1[-1] + BH*src1[ 0] + CH*src1[1] + DH*src1[2] + EH*src1[3] + FH*src1[4];\
-        tmp[2]= AH*src1[ 0] + BH*src1[ 1] + CH*src1[2] + DH*src1[3] + EH*src1[4] + FH*src1[5];\
-        tmp[3]= AH*src1[ 1] + BH*src1[ 2] + CH*src1[3] + DH*src1[4] + EH*src1[5] + FH*src1[6];\
-        tmp[4]= AH*src1[ 2] + BH*src1[ 3] + CH*src1[4] + DH*src1[5] + EH*src1[6] + FH*src1[7];\
-        tmp[5]= AH*src1[ 3] + BH*src1[ 4] + CH*src1[5] + DH*src1[6] + EH*src1[7] + FH*src1[8];\
-        tmp[6]= AH*src1[ 4] + BH*src1[ 5] + CH*src1[6] + DH*src1[7] + EH*src1[8] + FH*src1[9];\
-        tmp[7]= AH*src1[ 5] + BH*src1[ 6] + CH*src1[7] + DH*src1[8] + EH*src1[9] + FH*src1[10];\
-        tmp+=8;\
-        src1+=srcStride;\
-    }\
-    if(FULL) {\
-      tmp = temp+8*2;                           \
-      for(i=0; i<w; i++)                        \
-        {                                       \
-          const int tmpB= tmp[-2*8];    \
-          const int tmpA= tmp[-1*8];    \
-          const int tmp0= tmp[0 *8];    \
-          const int tmp1= tmp[1 *8];    \
-          const int tmp2= tmp[2 *8];    \
-          const int tmp3= tmp[3 *8];    \
-          const int tmp4= tmp[4 *8];    \
-          const int tmp5= tmp[5 *8];    \
-          const int tmp6= tmp[6 *8];    \
-          const int tmp7= tmp[7 *8];    \
-          const int tmp8= tmp[8 *8];    \
-          const int tmp9= tmp[9 *8];    \
-          const int tmp10=tmp[10*8];                            \
-          OP(dst[0*dstStride], AV*tmpB + BV*tmpA + CV*tmp0 + DV*tmp1 + EV*tmp2 + FV*tmp3 + 64*src2[0*srcStride]); \
-          OP(dst[1*dstStride], AV*tmpA + BV*tmp0 + CV*tmp1 + DV*tmp2 + EV*tmp3 + FV*tmp4 + 64*src2[1*srcStride]); \
-          OP(dst[2*dstStride], AV*tmp0 + BV*tmp1 + CV*tmp2 + DV*tmp3 + EV*tmp4 + FV*tmp5 + 64*src2[2*srcStride]); \
-          OP(dst[3*dstStride], AV*tmp1 + BV*tmp2 + CV*tmp3 + DV*tmp4 + EV*tmp5 + FV*tmp6 + 64*src2[3*srcStride]); \
-          OP(dst[4*dstStride], AV*tmp2 + BV*tmp3 + CV*tmp4 + DV*tmp5 + EV*tmp6 + FV*tmp7 + 64*src2[4*srcStride]); \
-          OP(dst[5*dstStride], AV*tmp3 + BV*tmp4 + CV*tmp5 + DV*tmp6 + EV*tmp7 + FV*tmp8 + 64*src2[5*srcStride]); \
-          OP(dst[6*dstStride], AV*tmp4 + BV*tmp5 + CV*tmp6 + DV*tmp7 + EV*tmp8 + FV*tmp9 + 64*src2[6*srcStride]); \
-          OP(dst[7*dstStride], AV*tmp5 + BV*tmp6 + CV*tmp7 + DV*tmp8 + EV*tmp9 + FV*tmp10 + 64*src2[7*srcStride]); \
-          dst++;                                                        \
-          tmp++;                                                        \
-          src2++;                                                       \
-        }                                                               \
-    } else {\
-      tmp = temp+8*2;                           \
-      for(i=0; i<w; i++)                        \
-        {                                       \
-          const int tmpB= tmp[-2*8];    \
-          const int tmpA= tmp[-1*8];    \
-          const int tmp0= tmp[0 *8];    \
-          const int tmp1= tmp[1 *8];    \
-          const int tmp2= tmp[2 *8];    \
-          const int tmp3= tmp[3 *8];    \
-          const int tmp4= tmp[4 *8];    \
-          const int tmp5= tmp[5 *8];    \
-          const int tmp6= tmp[6 *8];    \
-          const int tmp7= tmp[7 *8];    \
-          const int tmp8= tmp[8 *8];    \
-          const int tmp9= tmp[9 *8];    \
-          const int tmp10=tmp[10*8];                            \
-          OP(dst[0*dstStride], AV*tmpB + BV*tmpA + CV*tmp0 + DV*tmp1 + EV*tmp2 + FV*tmp3); \
-          OP(dst[1*dstStride], AV*tmpA + BV*tmp0 + CV*tmp1 + DV*tmp2 + EV*tmp3 + FV*tmp4); \
-          OP(dst[2*dstStride], AV*tmp0 + BV*tmp1 + CV*tmp2 + DV*tmp3 + EV*tmp4 + FV*tmp5); \
-          OP(dst[3*dstStride], AV*tmp1 + BV*tmp2 + CV*tmp3 + DV*tmp4 + EV*tmp5 + FV*tmp6); \
-          OP(dst[4*dstStride], AV*tmp2 + BV*tmp3 + CV*tmp4 + DV*tmp5 + EV*tmp6 + FV*tmp7); \
-          OP(dst[5*dstStride], AV*tmp3 + BV*tmp4 + CV*tmp5 + DV*tmp6 + EV*tmp7 + FV*tmp8); \
-          OP(dst[6*dstStride], AV*tmp4 + BV*tmp5 + CV*tmp6 + DV*tmp7 + EV*tmp8 + FV*tmp9); \
-          OP(dst[7*dstStride], AV*tmp5 + BV*tmp6 + CV*tmp7 + DV*tmp8 + EV*tmp9 + FV*tmp10); \
-          dst++;                                                        \
-          tmp++;                                                        \
-        }                                                               \
-    }\
-}\
-\
-static void OPNAME ## cavs_filt16_hv_ ## NAME(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int srcStride){ \
-    OPNAME ## cavs_filt8_hv_ ## NAME(dst  , src1,   src2  , dstStride, srcStride); \
-    OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, src2+8, dstStride, srcStride); \
-    src1 += 8*srcStride;\
-    src2 += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## cavs_filt8_hv_ ## NAME(dst  , src1,   src2  , dstStride, srcStride); \
-    OPNAME ## cavs_filt8_hv_ ## NAME(dst+8, src1+8, src2+8, dstStride, srcStride); \
-}\
-
-#define CAVS_MC(OPNAME, SIZE) \
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_filt ## SIZE ## _h_qpel_l(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_filt ## SIZE ## _h_hpel(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_filt ## SIZE ## _h_qpel_r(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_filt ## SIZE ## _v_qpel_l(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_filt ## SIZE ## _v_hpel(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_filt ## SIZE ## _v_qpel_r(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_jj(dst, src, NULL, stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src, stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride, stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+1, stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_egpr(dst, src, src+stride+1,stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_ff(dst, src, src+stride+1,stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_ii(dst, src, src+stride+1,stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_kk(dst, src, src+stride+1,stride, stride); \
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
-  OPNAME ## cavs_filt ## SIZE ## _hv_qq(dst, src, src+stride+1,stride, stride); \
-}\
-
-#define op_put1(a, b)  a = cm[((b)+4)>>3]
-#define op_put2(a, b)  a = cm[((b)+64)>>7]
-#define op_put3(a, b)  a = cm[((b)+32)>>6]
-#define op_put4(a, b)  a = cm[((b)+512)>>10]
-#define op_avg1(a, b)  a = ((a)+cm[((b)+4)>>3]   +1)>>1
-#define op_avg2(a, b)  a = ((a)+cm[((b)+64)>>7]  +1)>>1
-#define op_avg3(a, b)  a = ((a)+cm[((b)+32)>>6]  +1)>>1
-#define op_avg4(a, b)  a = ((a)+cm[((b)+512)>>10]+1)>>1
-CAVS_SUBPIX(put_   , op_put1, hpel,    0, -1,  5,  5, -1,  0)
-CAVS_SUBPIX(put_   , op_put2, qpel_l, -1, -2, 96, 42, -7,  0)
-CAVS_SUBPIX(put_   , op_put2, qpel_r,  0, -7, 42, 96, -2, -1)
-CAVS_SUBPIX_HV(put_, op_put3, jj,      0, -1,  5,  5, -1,  0,  0, -1,  5,  5, -1, 0, 0)
-CAVS_SUBPIX_HV(put_, op_put4, ff,      0, -1,  5,  5, -1,  0, -1, -2, 96, 42, -7, 0, 0)
-CAVS_SUBPIX_HV(put_, op_put4, ii,     -1, -2, 96, 42, -7,  0,  0, -1,  5,  5, -1, 0, 0)
-CAVS_SUBPIX_HV(put_, op_put4, kk,      0, -7, 42, 96, -2, -1,  0, -1,  5,  5, -1, 0, 0)
-CAVS_SUBPIX_HV(put_, op_put4, qq,      0, -1,  5,  5, -1,  0,  0, -7, 42, 96, -2,-1, 0)
-CAVS_SUBPIX_HV(put_, op_put2, egpr,    0, -1,  5,  5, -1,  0,  0, -1,  5,  5, -1, 0, 1)
-CAVS_SUBPIX(avg_   , op_avg1, hpel,    0, -1,  5,  5, -1,  0)
-CAVS_SUBPIX(avg_   , op_avg2, qpel_l, -1, -2, 96, 42, -7,  0)
-CAVS_SUBPIX(avg_   , op_avg2, qpel_r,  0, -7, 42, 96, -2, -1)
-CAVS_SUBPIX_HV(avg_, op_avg3, jj,      0, -1,  5,  5, -1,  0,  0, -1,  5,  5, -1, 0, 0)
-CAVS_SUBPIX_HV(avg_, op_avg4, ff,      0, -1,  5,  5, -1,  0, -1, -2, 96, 42, -7, 0, 0)
-CAVS_SUBPIX_HV(avg_, op_avg4, ii,     -1, -2, 96, 42, -7,  0,  0, -1,  5,  5, -1, 0, 0)
-CAVS_SUBPIX_HV(avg_, op_avg4, kk,      0, -7, 42, 96, -2, -1,  0, -1,  5,  5, -1, 0, 0)
-CAVS_SUBPIX_HV(avg_, op_avg4, qq,      0, -1,  5,  5, -1,  0,  0, -7, 42, 96, -2,-1, 0)
-CAVS_SUBPIX_HV(avg_, op_avg2, egpr,    0, -1,  5,  5, -1,  0,  0, -1,  5,  5, -1, 0, 1)
-CAVS_MC(put_, 8)
-CAVS_MC(put_, 16)
-CAVS_MC(avg_, 8)
-CAVS_MC(avg_, 16)
-
-av_cold void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx) {
-#define dspfunc(PFX, IDX, NUM) \
-    c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_c; \
-    c->PFX ## _pixels_tab[IDX][ 1] = ff_ ## PFX ## NUM ## _mc10_c; \
-    c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_c; \
-    c->PFX ## _pixels_tab[IDX][ 3] = ff_ ## PFX ## NUM ## _mc30_c; \
-    c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_c; \
-    c->PFX ## _pixels_tab[IDX][ 5] = ff_ ## PFX ## NUM ## _mc11_c; \
-    c->PFX ## _pixels_tab[IDX][ 6] = ff_ ## PFX ## NUM ## _mc21_c; \
-    c->PFX ## _pixels_tab[IDX][ 7] = ff_ ## PFX ## NUM ## _mc31_c; \
-    c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_c; \
-    c->PFX ## _pixels_tab[IDX][ 9] = ff_ ## PFX ## NUM ## _mc12_c; \
-    c->PFX ## _pixels_tab[IDX][10] = ff_ ## PFX ## NUM ## _mc22_c; \
-    c->PFX ## _pixels_tab[IDX][11] = ff_ ## PFX ## NUM ## _mc32_c; \
-    c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_c; \
-    c->PFX ## _pixels_tab[IDX][13] = ff_ ## PFX ## NUM ## _mc13_c; \
-    c->PFX ## _pixels_tab[IDX][14] = ff_ ## PFX ## NUM ## _mc23_c; \
-    c->PFX ## _pixels_tab[IDX][15] = ff_ ## PFX ## NUM ## _mc33_c
-    dspfunc(put_cavs_qpel, 0, 16);
-    dspfunc(put_cavs_qpel, 1, 8);
-    dspfunc(avg_cavs_qpel, 0, 16);
-    dspfunc(avg_cavs_qpel, 1, 8);
-    c->cavs_filter_lv = cavs_filter_lv_c;
-    c->cavs_filter_lh = cavs_filter_lh_c;
-    c->cavs_filter_cv = cavs_filter_cv_c;
-    c->cavs_filter_ch = cavs_filter_ch_c;
-    c->cavs_idct8_add = cavs_idct8_add_c;
-}
diff --git a/libavcodec/cbrt_tablegen.c b/libavcodec/cbrt_tablegen.c
deleted file mode 100644
index dbbd632..0000000
--- a/libavcodec/cbrt_tablegen.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Generate a header file for hardcoded AAC cube-root table
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#include "cbrt_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    cbrt_tableinit();
-
-    write_fileheader();
-
-    printf("static const uint32_t cbrt_tab[1<<13] = {\n");
-    write_uint32_array(cbrt_tab, 1 << 13);
-    printf("};\n");
-
-    return 0;
-}
diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
deleted file mode 100644
index 930e513..0000000
--- a/libavcodec/cbrt_tablegen.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Header file for hardcoded AAC cube-root table
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef CBRT_TABLEGEN_H
-#define CBRT_TABLEGEN_H
-
-#include <stdint.h>
-#include <math.h>
-
-#if CONFIG_HARDCODED_TABLES
-#define cbrt_tableinit()
-#include "libavcodec/cbrt_tables.h"
-#else
-static uint32_t cbrt_tab[1 << 13];
-
-static void cbrt_tableinit(void)
-{
-    if (!cbrt_tab[(1<<13) - 1]) {
-        int i;
-        for (i = 0; i < 1<<13; i++) {
-            union {
-                float f;
-                uint32_t i;
-            } f;
-            f.f = cbrtf(i) * i;
-            cbrt_tab[i] = f.i;
-        }
-    }
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* CBRT_TABLEGEN_H */
diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c
deleted file mode 100644
index c174aa9..0000000
--- a/libavcodec/cdgraphics.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * CD Graphics Video Decoder
- * Copyright (c) 2009 Michael Tison
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-/**
- * @file
- * @brief CD Graphics Video Decoder
- * @author Michael Tison
- * @sa http://wiki.multimedia.cx/index.php?title=CD_Graphics
- * @sa http://www.ccs.neu.edu/home/bchafy/cdb/info/cdg
- */
-
-/// default screen sizes
-#define CDG_FULL_WIDTH           300
-#define CDG_FULL_HEIGHT          216
-#define CDG_DISPLAY_WIDTH        294
-#define CDG_DISPLAY_HEIGHT       204
-#define CDG_BORDER_WIDTH           6
-#define CDG_BORDER_HEIGHT         12
-
-/// masks
-#define CDG_COMMAND             0x09
-#define CDG_MASK                0x3F
-
-/// instruction codes
-#define CDG_INST_MEMORY_PRESET     1
-#define CDG_INST_BORDER_PRESET     2
-#define CDG_INST_TILE_BLOCK        6
-#define CDG_INST_SCROLL_PRESET    20
-#define CDG_INST_SCROLL_COPY      24
-#define CDG_INST_LOAD_PAL_LO      30
-#define CDG_INST_LOAD_PAL_HIGH    31
-#define CDG_INST_TILE_BLOCK_XOR   38
-
-/// data sizes
-#define CDG_PACKET_SIZE           24
-#define CDG_DATA_SIZE             16
-#define CDG_TILE_HEIGHT           12
-#define CDG_TILE_WIDTH             6
-#define CDG_MINIMUM_PKT_SIZE       6
-#define CDG_MINIMUM_SCROLL_SIZE    3
-#define CDG_HEADER_SIZE            8
-#define CDG_PALETTE_SIZE          16
-
-typedef struct CDGraphicsContext {
-    AVFrame frame;
-    int hscroll;
-    int vscroll;
-} CDGraphicsContext;
-
-static void cdg_init_frame(AVFrame *frame)
-{
-    avcodec_get_frame_defaults(frame);
-    frame->reference = 3;
-    frame->buffer_hints = FF_BUFFER_HINTS_VALID    |
-                          FF_BUFFER_HINTS_READABLE |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-}
-
-static av_cold int cdg_decode_init(AVCodecContext *avctx)
-{
-    CDGraphicsContext *cc = avctx->priv_data;
-
-    cdg_init_frame(&cc->frame);
-
-    avctx->width   = CDG_FULL_WIDTH;
-    avctx->height  = CDG_FULL_HEIGHT;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    return 0;
-}
-
-static void cdg_border_preset(CDGraphicsContext *cc, uint8_t *data)
-{
-    int y;
-    int lsize    = cc->frame.linesize[0];
-    uint8_t *buf = cc->frame.data[0];
-    int color    = data[0] & 0x0F;
-
-    if (!(data[1] & 0x0F)) {
-        /// fill the top and bottom borders
-        memset(buf, color, CDG_BORDER_HEIGHT * lsize);
-        memset(buf + (CDG_FULL_HEIGHT - CDG_BORDER_HEIGHT) * lsize,
-               color, CDG_BORDER_HEIGHT * lsize);
-
-        /// fill the side borders
-        for (y = CDG_BORDER_HEIGHT; y < CDG_FULL_HEIGHT - CDG_BORDER_HEIGHT; y++) {
-            memset(buf + y * lsize, color, CDG_BORDER_WIDTH);
-            memset(buf + CDG_FULL_WIDTH - CDG_BORDER_WIDTH + y * lsize,
-                   color, CDG_BORDER_WIDTH);
-        }
-    }
-}
-
-static void cdg_load_palette(CDGraphicsContext *cc, uint8_t *data, int low)
-{
-    uint8_t r, g, b;
-    uint16_t color;
-    int i;
-    int array_offset  = low ? 0 : 8;
-    uint32_t *palette = (uint32_t *) cc->frame.data[1];
-
-    for (i = 0; i < 8; i++) {
-        color = (data[2 * i] << 6) + (data[2 * i + 1] & 0x3F);
-        r = ((color >> 8) & 0x000F) * 17;
-        g = ((color >> 4) & 0x000F) * 17;
-        b = ((color     ) & 0x000F) * 17;
-        palette[i + array_offset] = r << 16 | g << 8 | b;
-    }
-    cc->frame.palette_has_changed = 1;
-}
-
-static int cdg_tile_block(CDGraphicsContext *cc, uint8_t *data, int b)
-{
-    unsigned ci, ri;
-    int color;
-    int x, y;
-    int ai;
-    int stride   = cc->frame.linesize[0];
-    uint8_t *buf = cc->frame.data[0];
-
-    ri = (data[2] & 0x1F) * CDG_TILE_HEIGHT + cc->vscroll;
-    ci = (data[3] & 0x3F) * CDG_TILE_WIDTH  + cc->hscroll;
-
-    if (ri > (CDG_FULL_HEIGHT - CDG_TILE_HEIGHT))
-        return AVERROR(EINVAL);
-    if (ci > (CDG_FULL_WIDTH - CDG_TILE_WIDTH))
-        return AVERROR(EINVAL);
-
-    for (y = 0; y < CDG_TILE_HEIGHT; y++) {
-        for (x = 0; x < CDG_TILE_WIDTH; x++) {
-            if (!((data[4 + y] >> (5 - x)) & 0x01))
-                color = data[0] & 0x0F;
-            else
-                color = data[1] & 0x0F;
-
-            ai = ci + x + (stride * (ri + y));
-            if (b)
-                color ^= buf[ai];
-            buf[ai] = color;
-        }
-    }
-
-    return 0;
-}
-
-#define UP    2
-#define DOWN  1
-#define LEFT  2
-#define RIGHT 1
-
-static void cdg_copy_rect_buf(int out_tl_x, int out_tl_y, uint8_t *out,
-                              int in_tl_x, int in_tl_y, uint8_t *in,
-                              int w, int h, int stride)
-{
-    int y;
-
-    in  += in_tl_x  + in_tl_y  * stride;
-    out += out_tl_x + out_tl_y * stride;
-    for (y = 0; y < h; y++)
-        memcpy(out + y * stride, in + y * stride, w);
-}
-
-static void cdg_fill_rect_preset(int tl_x, int tl_y, uint8_t *out,
-                                 int color, int w, int h, int stride)
-{
-    int y;
-
-    for (y = tl_y; y < tl_y + h; y++)
-        memset(out + tl_x + y * stride, color, w);
-}
-
-static void cdg_fill_wrapper(int out_tl_x, int out_tl_y, uint8_t *out,
-                             int in_tl_x, int in_tl_y, uint8_t *in,
-                             int color, int w, int h, int stride, int roll)
-{
-    if (roll) {
-        cdg_copy_rect_buf(out_tl_x, out_tl_y, out, in_tl_x, in_tl_y,
-                          in, w, h, stride);
-    } else {
-        cdg_fill_rect_preset(out_tl_x, out_tl_y, out, color, w, h, stride);
-    }
-}
-
-static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
-                       AVFrame *new_frame, int roll_over)
-{
-    int color;
-    int hscmd, h_off, hinc, vscmd, v_off, vinc;
-    int y;
-    int stride   = cc->frame.linesize[0];
-    uint8_t *in  = cc->frame.data[0];
-    uint8_t *out = new_frame->data[0];
-
-    color =  data[0] & 0x0F;
-    hscmd = (data[1] & 0x30) >> 4;
-    vscmd = (data[2] & 0x30) >> 4;
-
-    h_off =  FFMIN(data[1] & 0x07, CDG_BORDER_WIDTH  - 1);
-    v_off =  FFMIN(data[2] & 0x07, CDG_BORDER_HEIGHT - 1);
-
-    /// find the difference and save the offset for cdg_tile_block usage
-    hinc = h_off - cc->hscroll;
-    vinc = v_off - cc->vscroll;
-    cc->hscroll = h_off;
-    cc->vscroll = v_off;
-
-    if (vscmd == UP)
-        vinc -= 12;
-    if (vscmd == DOWN)
-        vinc += 12;
-    if (hscmd == LEFT)
-        hinc -= 6;
-    if (hscmd == RIGHT)
-        hinc += 6;
-
-    if (!hinc && !vinc)
-        return;
-
-    memcpy(new_frame->data[1], cc->frame.data[1], CDG_PALETTE_SIZE * 4);
-
-    for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, CDG_FULL_HEIGHT); y++)
-        memcpy(out + FFMAX(0, hinc) + stride * y,
-               in + FFMAX(0, hinc) - hinc + (y - vinc) * stride,
-               FFMIN(stride + hinc, stride));
-
-    if (vinc > 0)
-        cdg_fill_wrapper(0, 0, out,
-                         0, CDG_FULL_HEIGHT - vinc, in, color,
-                         stride, vinc, stride, roll_over);
-    else if (vinc < 0)
-        cdg_fill_wrapper(0, CDG_FULL_HEIGHT + vinc, out,
-                         0, 0, in, color,
-                         stride, -1 * vinc, stride, roll_over);
-
-    if (hinc > 0)
-        cdg_fill_wrapper(0, 0, out,
-                         CDG_FULL_WIDTH - hinc, 0, in, color,
-                         hinc, CDG_FULL_HEIGHT, stride, roll_over);
-    else if (hinc < 0)
-        cdg_fill_wrapper(CDG_FULL_WIDTH + hinc, 0, out,
-                         0, 0, in, color,
-                         -1 * hinc, CDG_FULL_HEIGHT, stride, roll_over);
-
-}
-
-static int cdg_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    int ret;
-    uint8_t command, inst;
-    uint8_t cdg_data[CDG_DATA_SIZE];
-    AVFrame new_frame;
-    CDGraphicsContext *cc = avctx->priv_data;
-
-    if (buf_size < CDG_MINIMUM_PKT_SIZE) {
-        av_log(avctx, AV_LOG_ERROR, "buffer too small for decoder\n");
-        return AVERROR(EINVAL);
-    }
-
-    ret = avctx->reget_buffer(avctx, &cc->frame);
-    if (ret) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return ret;
-    }
-
-    command = bytestream_get_byte(&buf);
-    inst    = bytestream_get_byte(&buf);
-    inst    &= CDG_MASK;
-    buf += 2;  /// skipping 2 unneeded bytes
-    bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE);
-
-    if ((command & CDG_MASK) == CDG_COMMAND) {
-        switch (inst) {
-        case CDG_INST_MEMORY_PRESET:
-            if (!(cdg_data[1] & 0x0F))
-                memset(cc->frame.data[0], cdg_data[0] & 0x0F,
-                       cc->frame.linesize[0] * CDG_FULL_HEIGHT);
-            break;
-        case CDG_INST_LOAD_PAL_LO:
-        case CDG_INST_LOAD_PAL_HIGH:
-            if (buf_size - CDG_HEADER_SIZE < CDG_DATA_SIZE) {
-                av_log(avctx, AV_LOG_ERROR, "buffer too small for loading palette\n");
-                return AVERROR(EINVAL);
-            }
-
-            cdg_load_palette(cc, cdg_data, inst == CDG_INST_LOAD_PAL_LO);
-            break;
-        case CDG_INST_BORDER_PRESET:
-            cdg_border_preset(cc, cdg_data);
-            break;
-        case CDG_INST_TILE_BLOCK_XOR:
-        case CDG_INST_TILE_BLOCK:
-            if (buf_size - CDG_HEADER_SIZE < CDG_DATA_SIZE) {
-                av_log(avctx, AV_LOG_ERROR, "buffer too small for drawing tile\n");
-                return AVERROR(EINVAL);
-            }
-
-            ret = cdg_tile_block(cc, cdg_data, inst == CDG_INST_TILE_BLOCK_XOR);
-            if (ret) {
-                av_log(avctx, AV_LOG_ERROR, "tile is out of range\n");
-                return ret;
-            }
-            break;
-        case CDG_INST_SCROLL_PRESET:
-        case CDG_INST_SCROLL_COPY:
-            if (buf_size - CDG_HEADER_SIZE < CDG_MINIMUM_SCROLL_SIZE) {
-                av_log(avctx, AV_LOG_ERROR, "buffer too small for scrolling\n");
-                return AVERROR(EINVAL);
-            }
-
-            cdg_init_frame(&new_frame);
-            ret = avctx->get_buffer(avctx, &new_frame);
-            if (ret) {
-                av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-                return ret;
-            }
-
-            cdg_scroll(cc, cdg_data, &new_frame, inst == CDG_INST_SCROLL_COPY);
-            avctx->release_buffer(avctx, &cc->frame);
-            cc->frame = new_frame;
-            break;
-        default:
-            break;
-        }
-
-        *data_size = sizeof(AVFrame);
-    } else {
-        *data_size = 0;
-        buf_size   = 0;
-    }
-
-    *(AVFrame *) data = cc->frame;
-    return buf_size;
-}
-
-static av_cold int cdg_decode_end(AVCodecContext *avctx)
-{
-    CDGraphicsContext *cc = avctx->priv_data;
-
-    if (cc->frame.data[0])
-        avctx->release_buffer(avctx, &cc->frame);
-
-    return 0;
-}
-
-AVCodec cdgraphics_decoder = {
-    "cdgraphics",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CDGRAPHICS,
-    sizeof(CDGraphicsContext),
-    cdg_decode_init,
-    NULL,
-    cdg_decode_end,
-    cdg_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"),
-};
diff --git a/libavcodec/celp_filters.c b/libavcodec/celp_filters.c
deleted file mode 100644
index 26a62ee..0000000
--- a/libavcodec/celp_filters.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * various filters for ACELP-based codecs
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-
-#include "avcodec.h"
-#include "celp_filters.h"
-
-void ff_celp_convolve_circ(int16_t* fc_out, const int16_t* fc_in,
-                           const int16_t* filter, int len)
-{
-    int i, k;
-
-    memset(fc_out, 0, len * sizeof(int16_t));
-
-    /* Since there are few pulses over an entire subframe (i.e. almost
-       all fc_in[i] are zero) it is faster to loop over fc_in first. */
-    for (i = 0; i < len; i++) {
-        if (fc_in[i]) {
-            for (k = 0; k < i; k++)
-                fc_out[k] += (fc_in[i] * filter[len + k - i]) >> 15;
-
-            for (k = i; k < len; k++)
-                fc_out[k] += (fc_in[i] * filter[      k - i]) >> 15;
-        }
-    }
-}
-
-void ff_celp_circ_addf(float *out, const float *in,
-                       const float *lagged, int lag, float fac, int n)
-{
-    int k;
-    for (k = 0; k < lag; k++)
-        out[k] = in[k] + fac * lagged[n + k - lag];
-    for (; k < n; k++)
-        out[k] = in[k] + fac * lagged[    k - lag];
-}
-
-int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs,
-                                const int16_t *in, int buffer_length,
-                                int filter_length, int stop_on_overflow,
-                                int rounder)
-{
-    int i,n;
-
-    for (n = 0; n < buffer_length; n++) {
-        int sum = rounder;
-        for (i = 1; i <= filter_length; i++)
-            sum -= filter_coeffs[i-1] * out[n-i];
-
-        sum = (sum >> 12) + in[n];
-
-        if (sum + 0x8000 > 0xFFFFU) {
-            if (stop_on_overflow)
-                return 1;
-            sum = (sum >> 31) ^ 32767;
-        }
-        out[n] = sum;
-    }
-
-    return 0;
-}
-
-void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs,
-                                  const float* in, int buffer_length,
-                                  int filter_length)
-{
-    int i,n;
-
-#if 0 // Unoptimized code path for improved readability
-    for (n = 0; n < buffer_length; n++) {
-        out[n] = in[n];
-        for (i = 1; i <= filter_length; i++)
-            out[n] -= filter_coeffs[i-1] * out[n-i];
-    }
-#else
-    float out0, out1, out2, out3;
-    float old_out0, old_out1, old_out2, old_out3;
-    float a,b,c;
-
-    a = filter_coeffs[0];
-    b = filter_coeffs[1];
-    c = filter_coeffs[2];
-    b -= filter_coeffs[0] * filter_coeffs[0];
-    c -= filter_coeffs[1] * filter_coeffs[0];
-    c -= filter_coeffs[0] * b;
-
-    old_out0 = out[-4];
-    old_out1 = out[-3];
-    old_out2 = out[-2];
-    old_out3 = out[-1];
-    for (n = 0; n <= buffer_length - 4; n+=4) {
-        float tmp0,tmp1,tmp2,tmp3;
-        float val;
-
-        out0 = in[0];
-        out1 = in[1];
-        out2 = in[2];
-        out3 = in[3];
-
-        out0 -= filter_coeffs[2] * old_out1;
-        out1 -= filter_coeffs[2] * old_out2;
-        out2 -= filter_coeffs[2] * old_out3;
-
-        out0 -= filter_coeffs[1] * old_out2;
-        out1 -= filter_coeffs[1] * old_out3;
-
-        out0 -= filter_coeffs[0] * old_out3;
-
-        val = filter_coeffs[3];
-
-        out0 -= val * old_out0;
-        out1 -= val * old_out1;
-        out2 -= val * old_out2;
-        out3 -= val * old_out3;
-
-        old_out3 = out[-5];
-
-        for (i = 5; i <= filter_length; i += 2) {
-            val = filter_coeffs[i-1];
-
-            out0 -= val * old_out3;
-            out1 -= val * old_out0;
-            out2 -= val * old_out1;
-            out3 -= val * old_out2;
-
-            old_out2 = out[-i-1];
-
-            val = filter_coeffs[i];
-
-            out0 -= val * old_out2;
-            out1 -= val * old_out3;
-            out2 -= val * old_out0;
-            out3 -= val * old_out1;
-
-            FFSWAP(float, old_out0, old_out2);
-            old_out1 = old_out3;
-            old_out3 = out[-i-2];
-        }
-
-        tmp0 = out0;
-        tmp1 = out1;
-        tmp2 = out2;
-        tmp3 = out3;
-
-        out3 -= a * tmp2;
-        out2 -= a * tmp1;
-        out1 -= a * tmp0;
-
-        out3 -= b * tmp1;
-        out2 -= b * tmp0;
-
-        out3 -= c * tmp0;
-
-
-        out[0] = out0;
-        out[1] = out1;
-        out[2] = out2;
-        out[3] = out3;
-
-        old_out0 = out0;
-        old_out1 = out1;
-        old_out2 = out2;
-        old_out3 = out3;
-
-        out += 4;
-        in  += 4;
-    }
-
-    out -= n;
-    in -= n;
-    for (; n < buffer_length; n++) {
-        out[n] = in[n];
-        for (i = 1; i <= filter_length; i++)
-            out[n] -= filter_coeffs[i-1] * out[n-i];
-    }
-#endif
-}
-
-void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs,
-                                       const float *in, int buffer_length,
-                                       int filter_length)
-{
-    int i,n;
-
-    for (n = 0; n < buffer_length; n++) {
-        out[n] = in[n];
-        for (i = 1; i <= filter_length; i++)
-            out[n] += filter_coeffs[i-1] * in[n-i];
-    }
-}
diff --git a/libavcodec/celp_filters.h b/libavcodec/celp_filters.h
deleted file mode 100644
index 7b64fc0..0000000
--- a/libavcodec/celp_filters.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * various filters for CELP-based codecs
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_CELP_FILTERS_H
-#define AVCODEC_CELP_FILTERS_H
-
-#include <stdint.h>
-
-/**
- * Circularly convolve fixed vector with a phase dispersion impulse
- *        response filter (D.6.2 of G.729 and 6.1.5 of AMR).
- * @param fc_out vector with filter applied
- * @param fc_in source vector
- * @param filter phase filter coefficients
- *
- *  fc_out[n] = sum(i,0,len-1){ fc_in[i] * filter[(len + n - i)%len] }
- *
- * \note fc_in and fc_out should not overlap!
- */
-void ff_celp_convolve_circ(int16_t *fc_out, const int16_t *fc_in,
-                           const int16_t *filter, int len);
-
-/**
- * Add an array to a rotated array.
- *
- * out[k] = in[k] + fac * lagged[k-lag] with wrap-around
- *
- * @param out result vector
- * @param in samples to be added unfiltered
- * @param lagged samples to be rotated, multiplied and added
- * @param lag lagged vector delay in the range [0, n]
- * @param fac scalefactor for lagged samples
- * @param n number of samples
- */
-void ff_celp_circ_addf(float *out, const float *in,
-                       const float *lagged, int lag, float fac, int n);
-
-/**
- * LP synthesis filter.
- * @param out [out] pointer to output buffer
- * @param filter_coeffs filter coefficients (-0x8000 <= (3.12) < 0x8000)
- * @param in input signal
- * @param buffer_length amount of data to process
- * @param filter_length filter length (10 for 10th order LP filter)
- * @param stop_on_overflow   1 - return immediately if overflow occurs
- *                           0 - ignore overflows
- * @param rounder the amount to add for rounding (usually 0x800 or 0xfff)
- *
- * @return 1 if overflow occurred, 0 - otherwise
- *
- * @note Output buffer must contain filter_length samples of past
- *       speech data before pointer.
- *
- * Routine applies 1/A(z) filter to given speech data.
- */
-int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs,
-                                const int16_t *in, int buffer_length,
-                                int filter_length, int stop_on_overflow,
-                                int rounder);
-
-/**
- * LP synthesis filter.
- * @param out [out] pointer to output buffer
- *        - the array out[-filter_length, -1] must
- *        contain the previous result of this filter
- * @param filter_coeffs filter coefficients.
- * @param in input signal
- * @param buffer_length amount of data to process
- * @param filter_length filter length (10 for 10th order LP filter). Must be
- *                      greater than 4 and even.
- *
- * @note Output buffer must contain filter_length samples of past
- *       speech data before pointer.
- *
- * Routine applies 1/A(z) filter to given speech data.
- */
-void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs,
-                                  const float *in, int buffer_length,
-                                  int filter_length);
-
-/**
- * LP zero synthesis filter.
- * @param out [out] pointer to output buffer
- * @param filter_coeffs filter coefficients.
- * @param in input signal
- *        - the array in[-filter_length, -1] must
- *        contain the previous input of this filter
- * @param buffer_length amount of data to process
- * @param filter_length filter length (10 for 10th order LP filter)
- *
- * @note Output buffer must contain filter_length samples of past
- *       speech data before pointer.
- *
- * Routine applies A(z) filter to given speech data.
- */
-void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs,
-                                       const float *in, int buffer_length,
-                                       int filter_length);
-
-#endif /* AVCODEC_CELP_FILTERS_H */
diff --git a/libavcodec/celp_math.c b/libavcodec/celp_math.c
deleted file mode 100644
index 09111da..0000000
--- a/libavcodec/celp_math.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Various fixed-point math operations
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-#include <limits.h>
-#include <assert.h>
-
-#include "avcodec.h"
-#include "celp_math.h"
-
-#ifdef G729_BITEXACT
-/**
- * Cosine table: base_cos[i] = (1<<15) * cos(i*PI/64)
- */
-static const int16_t base_cos[64] =
-{
-  32767,  32729,  32610,  32413,  32138,  31786,  31357,  30853,
-  30274,  29622,  28899,  28106,  27246,  26320,  25330,  24279,
-  23170,  22006,  20788,  19520,  18205,  16846,  15447,  14010,
-  12540,  11039,   9512,   7962,   6393,   4808,   3212,   1608,
-      0,  -1608,  -3212,  -4808,  -6393,  -7962,  -9512, -11039,
- -12540, -14010, -15447, -16846, -18205, -19520, -20788, -22006,
- -23170, -24279, -25330, -26320, -27246, -28106, -28899, -29622,
- -30274, -30853, -31357, -31786, -32138, -32413, -32610, -32729
-};
-
-/**
- * Slope used to compute cos(x)
- *
- * cos(ind*64+offset) = base_cos[ind]+offset*slope_cos[ind]
- * values multiplied by 1<<19
- */
-static const int16_t slope_cos[64] =
-{
-   -632,  -1893,  -3150,  -4399,  -5638,  -6863,  -8072,  -9261,
- -10428, -11570, -12684, -13767, -14817, -15832, -16808, -17744,
- -18637, -19486, -20287, -21039, -21741, -22390, -22986, -23526,
- -24009, -24435, -24801, -25108, -25354, -25540, -25664, -25726,
- -25726, -25664, -25540, -25354, -25108, -24801, -24435, -24009,
- -23526, -22986, -22390, -21741, -21039, -20287, -19486, -18637,
- -17744, -16808, -15832, -14817, -13767, -12684, -11570, -10428,
-  -9261,  -8072,  -6863,  -5638,  -4399,  -3150,  -1893,   -632
-};
-
-/**
- * Table used to compute exp2(x)
- *
- * tab_exp2[i] = (1<<14) * exp2(i/32) = 2^(i/32) i=0..32
- */
-static const uint16_t tab_exp2[33] =
-{
-  16384, 16743, 17109, 17484, 17867, 18258, 18658, 19066, 19484, 19911,
-  20347, 20792, 21247, 21713, 22188, 22674, 23170, 23678, 24196, 24726,
-  25268, 25821, 26386, 26964, 27554, 28158, 28774, 29405, 30048, 30706,
-  31379, 32066, 32767
-};
-
-int16_t ff_cos(uint16_t arg)
-{
-    uint8_t offset= arg;
-    uint8_t ind = arg >> 8;
-
-    assert(arg < 0x4000);
-
-    return FFMAX(base_cos[ind] + ((slope_cos[ind] * offset) >> 12), -0x8000);
-}
-
-int ff_exp2(uint16_t power)
-{
-    uint16_t frac_x0;
-    uint16_t frac_dx;
-    int result;
-
-    assert(power <= 0x7fff);
-
-    frac_x0 = power >> 10;
-    frac_dx = (power & 0x03ff) << 5;
-
-    result = tab_exp2[frac_x0] << 15;
-    result += frac_dx * (tab_exp2[frac_x0+1] - tab_exp2[frac_x0]);
-
-    return result >> 10;
-}
-
-#else // G729_BITEXACT
-
-/**
- * Cosine table: base_cos[i] = (1<<15) * cos(i*PI/64)
- */
-static const int16_t tab_cos[65] =
-{
-  32767,  32738,  32617,  32421,  32145,  31793,  31364,  30860,
-  30280,  29629,  28905,  28113,  27252,  26326,  25336,  24285,
-  23176,  22011,  20793,  19525,  18210,  16851,  15451,  14014,
-  12543,  11043,   9515,   7965,   6395,   4810,   3214,   1609,
-      1,  -1607,  -3211,  -4808,  -6393,  -7962,  -9513, -11040,
- -12541, -14012, -15449, -16848, -18207, -19523, -20791, -22009,
- -23174, -24283, -25334, -26324, -27250, -28111, -28904, -29627,
- -30279, -30858, -31363, -31792, -32144, -32419, -32616, -32736, -32768,
-};
-
-static const uint16_t exp2a[]=
-{
-     0,  1435,  2901,  4400,  5931,  7496,  9096, 10730,
- 12400, 14106, 15850, 17632, 19454, 21315, 23216, 25160,
- 27146, 29175, 31249, 33368, 35534, 37747, 40009, 42320,
- 44682, 47095, 49562, 52082, 54657, 57289, 59979, 62727,
-};
-
-static const uint16_t exp2b[]=
-{
-     3,   712,  1424,  2134,  2845,  3557,  4270,  4982,
-  5696,  6409,  7124,  7839,  8554,  9270,  9986, 10704,
- 11421, 12138, 12857, 13576, 14295, 15014, 15734, 16455,
- 17176, 17898, 18620, 19343, 20066, 20790, 21514, 22238,
-};
-
-int16_t ff_cos(uint16_t arg)
-{
-    uint8_t offset= arg;
-    uint8_t ind = arg >> 8;
-
-    assert(arg <= 0x3fff);
-
-    return tab_cos[ind] + (offset * (tab_cos[ind+1] - tab_cos[ind]) >> 8);
-}
-
-int ff_exp2(uint16_t power)
-{
-    unsigned int result= exp2a[power>>10] + 0x10000;
-
-    assert(power <= 0x7fff);
-
-    result= (result<<3) + ((result*exp2b[(power>>5)&31])>>17);
-    return result + ((result*(power&31)*89)>>22);
-}
-
-#endif // else G729_BITEXACT
-
-/**
- * Table used to compute log2(x)
- *
- * tab_log2[i] = (1<<15) * log2(1 + i/32), i=0..32
- */
-static const uint16_t tab_log2[33] =
-{
-#ifdef G729_BITEXACT
-      0,   1455,   2866,   4236,   5568,   6863,   8124,   9352,
-  10549,  11716,  12855,  13967,  15054,  16117,  17156,  18172,
-  19167,  20142,  21097,  22033,  22951,  23852,  24735,  25603,
-  26455,  27291,  28113,  28922,  29716,  30497,  31266,  32023,  32767,
-#else
-      4,   1459,   2870,   4240,   5572,   6867,   8127,   9355,
-  10552,  11719,  12858,  13971,  15057,  16120,  17158,  18175,
-  19170,  20145,  21100,  22036,  22954,  23854,  24738,  25605,
-  26457,  27294,  28116,  28924,  29719,  30500,  31269,  32025,  32769,
-#endif
-};
-
-int ff_log2(uint32_t value)
-{
-    uint8_t  power_int;
-    uint8_t  frac_x0;
-    uint16_t frac_dx;
-
-    // Stripping zeros from beginning
-    power_int = av_log2(value);
-    value <<= (31 - power_int);
-
-    // b31 is always non-zero now
-    frac_x0 = (value & 0x7c000000) >> 26; // b26-b31 and [32..63] -> [0..31]
-    frac_dx = (value & 0x03fff800) >> 11;
-
-    value = tab_log2[frac_x0];
-    value += (frac_dx * (tab_log2[frac_x0+1] - tab_log2[frac_x0])) >> 15;
-
-    return (power_int << 15) + value;
-}
-
-float ff_dot_productf(const float* a, const float* b, int length)
-{
-    float sum = 0;
-    int i;
-
-    for(i=0; i<length; i++)
-        sum += a[i] * b[i];
-
-    return sum;
-}
diff --git a/libavcodec/celp_math.h b/libavcodec/celp_math.h
deleted file mode 100644
index 7cf7861..0000000
--- a/libavcodec/celp_math.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Various fixed-point math operations
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_CELP_MATH_H
-#define AVCODEC_CELP_MATH_H
-
-#include <stdint.h>
-
-/**
- * fixed-point implementation of cosine in [0; PI) domain.
- * @param arg fixed-point cosine argument, 0 <= arg < 0x4000
- *
- * @return value of (1<<15) * cos(arg * PI / (1<<14)), -0x8000 <= result <= 0x7fff
- */
-int16_t ff_cos(uint16_t arg);
-
-/**
- * fixed-point implementation of exp2(x) in [0; 1] domain.
- * @param power argument to exp2, 0 <= power <= 0x7fff
- *
- * @return value of (1<<20) * exp2(power / (1<<15))
- *         0x8000c <= result <= 0xfffea
- */
-int ff_exp2(uint16_t power);
-
-/**
- * Calculates log2(x).
- * @param value function argument, 0 < value <= 7fff ffff
- *
- * @return value of (1<<15) * log2(value)
- */
-int ff_log2(uint32_t value);
-
-/**
- * Shift value left or right depending on sign of offset parameter.
- * @param value value to shift
- * @param offset shift offset
- *
- * @return value << offset, if offset>=0; value >> -offset - otherwise
- */
-static inline int bidir_sal(int value, int offset)
-{
-    if(offset < 0) return value >> -offset;
-    else           return value <<  offset;
-}
-
-/**
- * returns the dot product.
- * @param a input data array
- * @param b input data array
- * @param length number of elements
- *
- * @return dot product = sum of elementwise products
- */
-float ff_dot_productf(const float* a, const float* b, int length);
-
-#endif /* AVCODEC_CELP_MATH_H */
diff --git a/libavcodec/cga_data.c b/libavcodec/cga_data.c
deleted file mode 100644
index 2d1f89c..0000000
--- a/libavcodec/cga_data.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * CGA ROM data
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-const uint8_t ff_cga_font[2048] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e,
- 0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e, 0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00,
- 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x7c, 0x38, 0x7c,
- 0x10, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00,
- 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,
- 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78,
- 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0,
- 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0, 0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99,
- 0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00, 0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00,
- 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00,
- 0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00, 0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0xcc, 0x78,
- 0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff,
- 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00,
- 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00,
- 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00,
- 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0x78, 0x30, 0x30, 0x00, 0x30, 0x00,
- 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00,
- 0x30, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x30, 0x00, 0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00,
- 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00,
- 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00,
- 0x7c, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0x7c, 0x00, 0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00,
- 0x78, 0xcc, 0x0c, 0x38, 0x60, 0xcc, 0xfc, 0x00, 0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00,
- 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00, 0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00,
- 0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00, 0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00,
- 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00, 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00,
- 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x30, 0x30, 0x60,
- 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xfc, 0x00, 0x00,
- 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x78, 0xcc, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00,
- 0x7c, 0xc6, 0xde, 0xde, 0xde, 0xc0, 0x78, 0x00, 0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00,
- 0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00, 0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00,
- 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00,
- 0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00, 0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3e, 0x00,
- 0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
- 0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00, 0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00,
- 0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00,
- 0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00,
- 0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xdc, 0x78, 0x1c, 0x00,
- 0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00, 0x78, 0xcc, 0xe0, 0x70, 0x1c, 0xcc, 0x78, 0x00,
- 0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00,
- 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00,
- 0xc6, 0xc6, 0x6c, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00,
- 0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00, 0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00,
- 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00,
- 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
- 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
- 0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00,
- 0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
- 0x38, 0x6c, 0x60, 0xf0, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
- 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00, 0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
- 0x0c, 0x00, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00,
- 0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00,
- 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
- 0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e,
- 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x00,
- 0x10, 0x30, 0x7c, 0x30, 0x30, 0x34, 0x18, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
- 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, 0x00, 0x00, 0xc6, 0xd6, 0xfe, 0xfe, 0x6c, 0x00,
- 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
- 0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00, 0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00,
- 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00,
- 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00,
- 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x18, 0x0c, 0x78, 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00,
- 0x1c, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, 0x7e, 0xc3, 0x3c, 0x06, 0x3e, 0x66, 0x3f, 0x00,
- 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00, 0xe0, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00,
- 0x30, 0x30, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00, 0x00, 0x00, 0x78, 0xc0, 0xc0, 0x78, 0x0c, 0x38,
- 0x7e, 0xc3, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, 0xcc, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
- 0xe0, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, 0xcc, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
- 0x7c, 0xc6, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00, 0xe0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
- 0xc6, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00, 0x30, 0x30, 0x00, 0x78, 0xcc, 0xfc, 0xcc, 0x00,
- 0x1c, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00, 0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00,
- 0x3e, 0x6c, 0xcc, 0xfe, 0xcc, 0xcc, 0xce, 0x00, 0x78, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
- 0x00, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0xe0, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
- 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00, 0x00, 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00,
- 0x00, 0xcc, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8, 0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x00,
- 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x18, 0x18, 0x7e, 0xc0, 0xc0, 0x7e, 0x18, 0x18,
- 0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00, 0xcc, 0xcc, 0x78, 0xfc, 0x30, 0xfc, 0x30, 0x30,
- 0xf8, 0xcc, 0xcc, 0xfa, 0xc6, 0xcf, 0xc6, 0xc7, 0x0e, 0x1b, 0x18, 0x3c, 0x18, 0x18, 0xd8, 0x70,
- 0x1c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7e, 0x00, 0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
- 0x00, 0x1c, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0x7e, 0x00,
- 0x00, 0xf8, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0x00, 0xfc, 0x00, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x00,
- 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00,
- 0x30, 0x00, 0x30, 0x60, 0xc0, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc0, 0xc0, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00, 0xc3, 0xc6, 0xcc, 0xde, 0x33, 0x66, 0xcc, 0x0f,
- 0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6f, 0xcf, 0x03, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00,
- 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00,
- 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
- 0xdb, 0x77, 0xdb, 0xee, 0xdb, 0x77, 0xdb, 0xee, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18,
- 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36,
- 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00,
- 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18,
- 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
- 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00,
- 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36,
- 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
- 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x76, 0xdc, 0xc8, 0xdc, 0x76, 0x00, 0x00, 0x78, 0xcc, 0xf8, 0xcc, 0xf8, 0xc0, 0xc0,
- 0x00, 0xfc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00,
- 0xfc, 0xcc, 0x60, 0x30, 0x60, 0xcc, 0xfc, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0x70, 0x00,
- 0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x00,
- 0xfc, 0x30, 0x78, 0xcc, 0xcc, 0x78, 0x30, 0xfc, 0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x6c, 0x38, 0x00,
- 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x6c, 0xee, 0x00, 0x1c, 0x30, 0x18, 0x7c, 0xcc, 0xcc, 0x78, 0x00,
- 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x06, 0x0c, 0x7e, 0xdb, 0xdb, 0x7e, 0x60, 0xc0,
- 0x38, 0x60, 0xc0, 0xf8, 0xc0, 0x60, 0x38, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00,
- 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x00, 0xfc, 0x00,
- 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xfc, 0x00, 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xfc, 0x00,
- 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70,
- 0x30, 0x30, 0x00, 0xfc, 0x00, 0x30, 0x30, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00,
- 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c,
- 0x78, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x70, 0x18, 0x30, 0x60, 0x78, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-const uint32_t ff_cga_palette[16] = {
-    0x000000, 0x0000AA, 0x00AA00, 0x00AAAA, 0xAA0000, 0xAA00AA, 0xAA5500, 0xAAAAAA,
-    0x555555, 0x5555FF, 0x55FF55, 0x55FFFF, 0xFF5555, 0xFF55FF, 0xFFFF55, 0xFFFFFF,
-};
diff --git a/libavcodec/cga_data.h b/libavcodec/cga_data.h
deleted file mode 100644
index c3f69f1..0000000
--- a/libavcodec/cga_data.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * CGA ROM data
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_CGA_DATA_H
-#define AVCODEC_CGA_DATA_H
-
-#include <stdint.h>
-
-extern const uint8_t ff_cga_font[2048];
-extern const uint32_t ff_cga_palette[16];
-
-#endif
diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c
deleted file mode 100644
index 8e7aa5a..0000000
--- a/libavcodec/cinepak.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Cinepak Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Cinepak video decoder
- * by Ewald Snel <ewald at rambo.its.tudelft.nl>
- * For more information on the Cinepak algorithm, visit:
- *   http://www.csse.monash.edu.au/~timf/
- * For more information on the quirky data inside Sega FILM/CPK files, visit:
- *   http://wiki.multimedia.cx/index.php?title=Sega_FILM
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-
-typedef struct {
-    uint8_t  y0, y1, y2, y3;
-    uint8_t  u, v;
-} cvid_codebook;
-
-#define MAX_STRIPS      32
-
-typedef struct {
-    uint16_t          id;
-    uint16_t          x1, y1;
-    uint16_t          x2, y2;
-    cvid_codebook     v4_codebook[256];
-    cvid_codebook     v1_codebook[256];
-} cvid_strip;
-
-typedef struct CinepakContext {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *data;
-    int size;
-
-    int width, height;
-
-    int palette_video;
-    cvid_strip strips[MAX_STRIPS];
-
-    int sega_film_skip_bytes;
-
-} CinepakContext;
-
-static void cinepak_decode_codebook (cvid_codebook *codebook,
-                                     int chunk_id, int size, const uint8_t *data)
-{
-    const uint8_t *eod = (data + size);
-    uint32_t flag, mask;
-    int      i, n;
-
-    /* check if this chunk contains 4- or 6-element vectors */
-    n    = (chunk_id & 0x04) ? 4 : 6;
-    flag = 0;
-    mask = 0;
-
-    for (i=0; i < 256; i++) {
-        if ((chunk_id & 0x01) && !(mask >>= 1)) {
-            if ((data + 4) > eod)
-                break;
-
-            flag  = AV_RB32 (data);
-            data += 4;
-            mask  = 0x80000000;
-        }
-
-        if (!(chunk_id & 0x01) || (flag & mask)) {
-            if ((data + n) > eod)
-                break;
-
-            if (n == 6) {
-                codebook[i].y0 = *data++;
-                codebook[i].y1 = *data++;
-                codebook[i].y2 = *data++;
-                codebook[i].y3 = *data++;
-                codebook[i].u  = 128 + *data++;
-                codebook[i].v  = 128 + *data++;
-            } else {
-                /* this codebook type indicates either greyscale or
-                 * palettized video; if palettized, U & V components will
-                 * not be used so it is safe to set them to 128 for the
-                 * benefit of greyscale rendering in YUV420P */
-                codebook[i].y0 = *data++;
-                codebook[i].y1 = *data++;
-                codebook[i].y2 = *data++;
-                codebook[i].y3 = *data++;
-                codebook[i].u  = 128;
-                codebook[i].v  = 128;
-            }
-        }
-    }
-}
-
-static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip,
-                                   int chunk_id, int size, const uint8_t *data)
-{
-    const uint8_t   *eod = (data + size);
-    uint32_t         flag, mask;
-    cvid_codebook   *codebook;
-    unsigned int     x, y;
-    uint32_t         iy[4];
-    uint32_t         iu[2];
-    uint32_t         iv[2];
-
-    flag = 0;
-    mask = 0;
-
-    for (y=strip->y1; y < strip->y2; y+=4) {
-
-        iy[0] = strip->x1 + (y * s->frame.linesize[0]);
-        iy[1] = iy[0] + s->frame.linesize[0];
-        iy[2] = iy[1] + s->frame.linesize[0];
-        iy[3] = iy[2] + s->frame.linesize[0];
-        iu[0] = (strip->x1/2) + ((y/2) * s->frame.linesize[1]);
-        iu[1] = iu[0] + s->frame.linesize[1];
-        iv[0] = (strip->x1/2) + ((y/2) * s->frame.linesize[2]);
-        iv[1] = iv[0] + s->frame.linesize[2];
-
-        for (x=strip->x1; x < strip->x2; x+=4) {
-            if ((chunk_id & 0x01) && !(mask >>= 1)) {
-                if ((data + 4) > eod)
-                    return -1;
-
-                flag  = AV_RB32 (data);
-                data += 4;
-                mask  = 0x80000000;
-            }
-
-            if (!(chunk_id & 0x01) || (flag & mask)) {
-                if (!(chunk_id & 0x02) && !(mask >>= 1)) {
-                    if ((data + 4) > eod)
-                        return -1;
-
-                    flag  = AV_RB32 (data);
-                    data += 4;
-                    mask  = 0x80000000;
-                }
-
-                if ((chunk_id & 0x02) || (~flag & mask)) {
-                    if (data >= eod)
-                        return -1;
-
-                    codebook = &strip->v1_codebook[*data++];
-                    s->frame.data[0][iy[0] + 0] = codebook->y0;
-                    s->frame.data[0][iy[0] + 1] = codebook->y0;
-                    s->frame.data[0][iy[1] + 0] = codebook->y0;
-                    s->frame.data[0][iy[1] + 1] = codebook->y0;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[0]] = codebook->u;
-                        s->frame.data[2][iv[0]] = codebook->v;
-                    }
-
-                    s->frame.data[0][iy[0] + 2] = codebook->y1;
-                    s->frame.data[0][iy[0] + 3] = codebook->y1;
-                    s->frame.data[0][iy[1] + 2] = codebook->y1;
-                    s->frame.data[0][iy[1] + 3] = codebook->y1;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[0] + 1] = codebook->u;
-                        s->frame.data[2][iv[0] + 1] = codebook->v;
-                    }
-
-                    s->frame.data[0][iy[2] + 0] = codebook->y2;
-                    s->frame.data[0][iy[2] + 1] = codebook->y2;
-                    s->frame.data[0][iy[3] + 0] = codebook->y2;
-                    s->frame.data[0][iy[3] + 1] = codebook->y2;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[1]] = codebook->u;
-                        s->frame.data[2][iv[1]] = codebook->v;
-                    }
-
-                    s->frame.data[0][iy[2] + 2] = codebook->y3;
-                    s->frame.data[0][iy[2] + 3] = codebook->y3;
-                    s->frame.data[0][iy[3] + 2] = codebook->y3;
-                    s->frame.data[0][iy[3] + 3] = codebook->y3;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[1] + 1] = codebook->u;
-                        s->frame.data[2][iv[1] + 1] = codebook->v;
-                    }
-
-                } else if (flag & mask) {
-                    if ((data + 4) > eod)
-                        return -1;
-
-                    codebook = &strip->v4_codebook[*data++];
-                    s->frame.data[0][iy[0] + 0] = codebook->y0;
-                    s->frame.data[0][iy[0] + 1] = codebook->y1;
-                    s->frame.data[0][iy[1] + 0] = codebook->y2;
-                    s->frame.data[0][iy[1] + 1] = codebook->y3;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[0]] = codebook->u;
-                        s->frame.data[2][iv[0]] = codebook->v;
-                    }
-
-                    codebook = &strip->v4_codebook[*data++];
-                    s->frame.data[0][iy[0] + 2] = codebook->y0;
-                    s->frame.data[0][iy[0] + 3] = codebook->y1;
-                    s->frame.data[0][iy[1] + 2] = codebook->y2;
-                    s->frame.data[0][iy[1] + 3] = codebook->y3;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[0] + 1] = codebook->u;
-                        s->frame.data[2][iv[0] + 1] = codebook->v;
-                    }
-
-                    codebook = &strip->v4_codebook[*data++];
-                    s->frame.data[0][iy[2] + 0] = codebook->y0;
-                    s->frame.data[0][iy[2] + 1] = codebook->y1;
-                    s->frame.data[0][iy[3] + 0] = codebook->y2;
-                    s->frame.data[0][iy[3] + 1] = codebook->y3;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[1]] = codebook->u;
-                        s->frame.data[2][iv[1]] = codebook->v;
-                    }
-
-                    codebook = &strip->v4_codebook[*data++];
-                    s->frame.data[0][iy[2] + 2] = codebook->y0;
-                    s->frame.data[0][iy[2] + 3] = codebook->y1;
-                    s->frame.data[0][iy[3] + 2] = codebook->y2;
-                    s->frame.data[0][iy[3] + 3] = codebook->y3;
-                    if (!s->palette_video) {
-                        s->frame.data[1][iu[1] + 1] = codebook->u;
-                        s->frame.data[2][iv[1] + 1] = codebook->v;
-                    }
-
-                }
-            }
-
-            iy[0] += 4;  iy[1] += 4;
-            iy[2] += 4;  iy[3] += 4;
-            iu[0] += 2;  iu[1] += 2;
-            iv[0] += 2;  iv[1] += 2;
-        }
-    }
-
-    return 0;
-}
-
-static int cinepak_decode_strip (CinepakContext *s,
-                                 cvid_strip *strip, const uint8_t *data, int size)
-{
-    const uint8_t *eod = (data + size);
-    int      chunk_id, chunk_size;
-
-    /* coordinate sanity checks */
-    if (strip->x1 >= s->width  || strip->x2 > s->width  ||
-        strip->y1 >= s->height || strip->y2 > s->height ||
-        strip->x1 >= strip->x2 || strip->y1 >= strip->y2)
-        return -1;
-
-    while ((data + 4) <= eod) {
-        chunk_id   = data[0];
-        chunk_size = AV_RB24 (&data[1]) - 4;
-        if(chunk_size < 0)
-            return -1;
-
-        data      += 4;
-        chunk_size = ((data + chunk_size) > eod) ? (eod - data) : chunk_size;
-
-        switch (chunk_id) {
-
-        case 0x20:
-        case 0x21:
-        case 0x24:
-        case 0x25:
-            cinepak_decode_codebook (strip->v4_codebook, chunk_id,
-                chunk_size, data);
-            break;
-
-        case 0x22:
-        case 0x23:
-        case 0x26:
-        case 0x27:
-            cinepak_decode_codebook (strip->v1_codebook, chunk_id,
-                chunk_size, data);
-            break;
-
-        case 0x30:
-        case 0x31:
-        case 0x32:
-            return cinepak_decode_vectors (s, strip, chunk_id,
-                chunk_size, data);
-        }
-
-        data += chunk_size;
-    }
-
-    return -1;
-}
-
-static int cinepak_decode (CinepakContext *s)
-{
-    const uint8_t  *eod = (s->data + s->size);
-    int           i, result, strip_size, frame_flags, num_strips;
-    int           y0 = 0;
-    int           encoded_buf_size;
-
-    if (s->size < 10)
-        return -1;
-
-    frame_flags = s->data[0];
-    num_strips  = AV_RB16 (&s->data[8]);
-    encoded_buf_size = ((s->data[1] << 16) | AV_RB16 (&s->data[2]));
-
-    /* if this is the first frame, check for deviant Sega FILM data */
-    if (s->sega_film_skip_bytes == -1) {
-        if (encoded_buf_size != s->size) {
-            /* If the encoded frame size differs from the frame size as indicated
-             * by the container file, this data likely comes from a Sega FILM/CPK file.
-             * If the frame header is followed by the bytes FE 00 00 06 00 00 then
-             * this is probably one of the two known files that have 6 extra bytes
-             * after the frame header. Else, assume 2 extra bytes. */
-            if ((s->data[10] == 0xFE) &&
-                (s->data[11] == 0x00) &&
-                (s->data[12] == 0x00) &&
-                (s->data[13] == 0x06) &&
-                (s->data[14] == 0x00) &&
-                (s->data[15] == 0x00))
-                s->sega_film_skip_bytes = 6;
-            else
-                s->sega_film_skip_bytes = 2;
-        } else
-            s->sega_film_skip_bytes = 0;
-    }
-
-    s->data += 10 + s->sega_film_skip_bytes;
-
-    if (num_strips > MAX_STRIPS)
-        num_strips = MAX_STRIPS;
-
-    for (i=0; i < num_strips; i++) {
-        if ((s->data + 12) > eod)
-            return -1;
-
-        s->strips[i].id = s->data[0];
-        s->strips[i].y1 = y0;
-        s->strips[i].x1 = 0;
-        s->strips[i].y2 = y0 + AV_RB16 (&s->data[8]);
-        s->strips[i].x2 = s->avctx->width;
-
-        strip_size = AV_RB24 (&s->data[1]) - 12;
-        s->data   += 12;
-        strip_size = ((s->data + strip_size) > eod) ? (eod - s->data) : strip_size;
-
-        if ((i > 0) && !(frame_flags & 0x01)) {
-            memcpy (s->strips[i].v4_codebook, s->strips[i-1].v4_codebook,
-                sizeof(s->strips[i].v4_codebook));
-            memcpy (s->strips[i].v1_codebook, s->strips[i-1].v1_codebook,
-                sizeof(s->strips[i].v1_codebook));
-        }
-
-        result = cinepak_decode_strip (s, &s->strips[i], s->data, strip_size);
-
-        if (result != 0)
-            return result;
-
-        s->data += strip_size;
-        y0    = s->strips[i].y2;
-    }
-    return 0;
-}
-
-static av_cold int cinepak_decode_init(AVCodecContext *avctx)
-{
-    CinepakContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->width = (avctx->width + 3) & ~3;
-    s->height = (avctx->height + 3) & ~3;
-    s->sega_film_skip_bytes = -1;  /* uninitialized state */
-
-    // check for paletted data
-    if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) {
-        s->palette_video = 0;
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-    } else {
-        s->palette_video = 1;
-        avctx->pix_fmt = PIX_FMT_PAL8;
-    }
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int cinepak_decode_frame(AVCodecContext *avctx,
-                                void *data, int *data_size,
-                                AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CinepakContext *s = avctx->priv_data;
-
-    s->data = buf;
-    s->size = buf_size;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
-                            FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    cinepak_decode(s);
-
-    if (s->palette_video) {
-        memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
-        if (avctx->palctrl->palette_changed) {
-            s->frame.palette_has_changed = 1;
-            avctx->palctrl->palette_changed = 0;
-        } else
-            s->frame.palette_has_changed = 0;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int cinepak_decode_end(AVCodecContext *avctx)
-{
-    CinepakContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec cinepak_decoder = {
-    "cinepak",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CINEPAK,
-    sizeof(CinepakContext),
-    cinepak_decode_init,
-    NULL,
-    cinepak_decode_end,
-    cinepak_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Cinepak"),
-};
diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c
deleted file mode 100644
index 47809c0..0000000
--- a/libavcodec/cljr.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Cirrus Logic AccuPak (CLJR) codec
- * Copyright (c) 2003 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Cirrus Logic AccuPak codec.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-
-/* Disable the encoder. */
-#undef CONFIG_CLJR_ENCODER
-#define CONFIG_CLJR_ENCODER 0
-
-typedef struct CLJRContext{
-    AVCodecContext *avctx;
-    AVFrame picture;
-    int delta[16];
-    int offset[4];
-    GetBitContext gb;
-} CLJRContext;
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CLJRContext * const a = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p= (AVFrame*)&a->picture;
-    int x, y;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    init_get_bits(&a->gb, buf, buf_size);
-
-    for(y=0; y<avctx->height; y++){
-        uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
-        uint8_t *cb= &a->picture.data[1][ y*a->picture.linesize[1] ];
-        uint8_t *cr= &a->picture.data[2][ y*a->picture.linesize[2] ];
-        for(x=0; x<avctx->width; x+=4){
-                luma[3] = get_bits(&a->gb, 5) << 3;
-            luma[2] = get_bits(&a->gb, 5) << 3;
-            luma[1] = get_bits(&a->gb, 5) << 3;
-            luma[0] = get_bits(&a->gb, 5) << 3;
-            luma+= 4;
-            *(cb++) = get_bits(&a->gb, 6) << 2;
-            *(cr++) = get_bits(&a->gb, 6) << 2;
-        }
-    }
-
-    *picture= *(AVFrame*)&a->picture;
-    *data_size = sizeof(AVPicture);
-
-    emms_c();
-
-    return buf_size;
-}
-
-#if CONFIG_CLJR_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    CLJRContext * const a = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= (AVFrame*)&a->picture;
-    int size;
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    emms_c();
-
-    align_put_bits(&a->pb);
-    while(get_bit_count(&a->pb)&31)
-        put_bits(&a->pb, 8, 0);
-
-    size= get_bit_count(&a->pb)/32;
-
-    return size*4;
-}
-#endif
-
-static av_cold void common_init(AVCodecContext *avctx){
-    CLJRContext * const a = avctx->priv_data;
-
-    avctx->coded_frame= (AVFrame*)&a->picture;
-    a->avctx= avctx;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-
-    common_init(avctx);
-
-    avctx->pix_fmt= PIX_FMT_YUV411P;
-
-    return 0;
-}
-
-#if CONFIG_CLJR_ENCODER
-static av_cold int encode_init(AVCodecContext *avctx){
-
-    common_init(avctx);
-
-    return 0;
-}
-#endif
-
-AVCodec cljr_decoder = {
-    "cljr",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CLJR,
-    sizeof(CLJRContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
-};
-
-#if CONFIG_CLJR_ENCODER
-AVCodec cljr_encoder = {
-    "cljr",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CLJR,
-    sizeof(CLJRContext),
-    encode_init,
-    encode_frame,
-    //encode_end,
-    .long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"),
-};
-#endif
diff --git a/libavcodec/colorspace.h b/libavcodec/colorspace.h
deleted file mode 100644
index 4ec081e..0000000
--- a/libavcodec/colorspace.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Colorspace conversion defines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Various defines for YUV<->RGB conversion
- */
-
-#ifndef AVCODEC_COLORSPACE_H
-#define AVCODEC_COLORSPACE_H
-
-#define SCALEBITS 10
-#define ONE_HALF  (1 << (SCALEBITS - 1))
-#define FIX(x)    ((int) ((x) * (1<<SCALEBITS) + 0.5))
-
-#define YUV_TO_RGB1_CCIR(cb1, cr1)\
-{\
-    cb = (cb1) - 128;\
-    cr = (cr1) - 128;\
-    r_add = FIX(1.40200*255.0/224.0) * cr + ONE_HALF;\
-    g_add = - FIX(0.34414*255.0/224.0) * cb - FIX(0.71414*255.0/224.0) * cr + \
-            ONE_HALF;\
-    b_add = FIX(1.77200*255.0/224.0) * cb + ONE_HALF;\
-}
-
-#define YUV_TO_RGB2_CCIR(r, g, b, y1)\
-{\
-    y = ((y1) - 16) * FIX(255.0/219.0);\
-    r = cm[(y + r_add) >> SCALEBITS];\
-    g = cm[(y + g_add) >> SCALEBITS];\
-    b = cm[(y + b_add) >> SCALEBITS];\
-}
-
-#define YUV_TO_RGB1(cb1, cr1)\
-{\
-    cb = (cb1) - 128;\
-    cr = (cr1) - 128;\
-    r_add = FIX(1.40200) * cr + ONE_HALF;\
-    g_add = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;\
-    b_add = FIX(1.77200) * cb + ONE_HALF;\
-}
-
-#define YUV_TO_RGB2(r, g, b, y1)\
-{\
-    y = (y1) << SCALEBITS;\
-    r = cm[(y + r_add) >> SCALEBITS];\
-    g = cm[(y + g_add) >> SCALEBITS];\
-    b = cm[(y + b_add) >> SCALEBITS];\
-}
-
-#define Y_CCIR_TO_JPEG(y)\
- cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS]
-
-#define Y_JPEG_TO_CCIR(y)\
- (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
-
-#define C_CCIR_TO_JPEG(y)\
- cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS]
-
-/* NOTE: the clamp is really necessary! */
-static inline int C_JPEG_TO_CCIR(int y) {
-    y = (((y - 128) * FIX(112.0/127.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS);
-    if (y < 16)
-        y = 16;
-    return y;
-}
-
-
-#define RGB_TO_Y(r, g, b) \
-((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \
-  FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS)
-
-#define RGB_TO_U(r1, g1, b1, shift)\
-(((- FIX(0.16874) * r1 - FIX(0.33126) * g1 +         \
-     FIX(0.50000) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_V(r1, g1, b1, shift)\
-(((FIX(0.50000) * r1 - FIX(0.41869) * g1 -           \
-   FIX(0.08131) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_Y_CCIR(r, g, b) \
-((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \
-  FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS)
-
-#define RGB_TO_U_CCIR(r1, g1, b1, shift)\
-(((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 +         \
-     FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#define RGB_TO_V_CCIR(r1, g1, b1, shift)\
-(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 -           \
-   FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128)
-
-#endif /* AVCODEC_COLORSPACE_H */
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
deleted file mode 100644
index e406e65..0000000
--- a/libavcodec/cook.c
+++ /dev/null
@@ -1,1298 +0,0 @@
-/*
- * COOK compatible decoder
- * Copyright (c) 2003 Sascha Sommer
- * Copyright (c) 2005 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Cook compatible decoder. Bastardization of the G.722.1 standard.
- * This decoder handles RealNetworks, RealAudio G2 data.
- * Cook is identified by the codec name cook in RM files.
- *
- * To use this decoder, a calling application must supply the extradata
- * bytes provided from the RM container; 8+ bytes for mono streams and
- * 16+ for stereo streams (maybe more).
- *
- * Codec technicalities (all this assume a buffer length of 1024):
- * Cook works with several different techniques to achieve its compression.
- * In the timedomain the buffer is divided into 8 pieces and quantized. If
- * two neighboring pieces have different quantization index a smooth
- * quantization curve is used to get a smooth overlap between the different
- * pieces.
- * To get to the transformdomain Cook uses a modulated lapped transform.
- * The transform domain has 50 subbands with 20 elements each. This
- * means only a maximum of 50*20=1000 coefficients are used out of the 1024
- * available.
- */
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include "libavutil/lfg.h"
-#include "libavutil/random_seed.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "bytestream.h"
-#include "fft.h"
-
-#include "cookdata.h"
-
-/* the different Cook versions */
-#define MONO            0x1000001
-#define STEREO          0x1000002
-#define JOINT_STEREO    0x1000003
-#define MC_COOK         0x2000000   //multichannel Cook, not supported
-
-#define SUBBAND_SIZE    20
-#define MAX_SUBPACKETS   5
-//#define COOKDEBUG
-
-typedef struct {
-    int *now;
-    int *previous;
-} cook_gains;
-
-typedef struct {
-    int                 ch_idx;
-    int                 size;
-    int                 num_channels;
-    int                 cookversion;
-    int                 samples_per_frame;
-    int                 subbands;
-    int                 js_subband_start;
-    int                 js_vlc_bits;
-    int                 samples_per_channel;
-    int                 log2_numvector_size;
-    unsigned int        channel_mask;
-    VLC                 ccpl;                 ///< channel coupling
-    int                 joint_stereo;
-    int                 bits_per_subpacket;
-    int                 bits_per_subpdiv;
-    int                 total_subbands;
-    int                 numvector_size;       ///< 1 << log2_numvector_size;
-
-    float               mono_previous_buffer1[1024];
-    float               mono_previous_buffer2[1024];
-    /** gain buffers */
-    cook_gains          gains1;
-    cook_gains          gains2;
-    int                 gain_1[9];
-    int                 gain_2[9];
-    int                 gain_3[9];
-    int                 gain_4[9];
-} COOKSubpacket;
-
-typedef struct cook {
-    /*
-     * The following 5 functions provide the lowlevel arithmetic on
-     * the internal audio buffers.
-     */
-    void (* scalar_dequant)(struct cook *q, int index, int quant_index,
-                            int* subband_coef_index, int* subband_coef_sign,
-                            float* mlt_p);
-
-    void (* decouple) (struct cook *q,
-                       COOKSubpacket *p,
-                       int subband,
-                       float f1, float f2,
-                       float *decode_buffer,
-                       float *mlt_buffer1, float *mlt_buffer2);
-
-    void (* imlt_window) (struct cook *q, float *buffer1,
-                          cook_gains *gains_ptr, float *previous_buffer);
-
-    void (* interpolate) (struct cook *q, float* buffer,
-                          int gain_index, int gain_index_next);
-
-    void (* saturate_output) (struct cook *q, int chan, int16_t *out);
-
-    AVCodecContext*     avctx;
-    GetBitContext       gb;
-    /* stream data */
-    int                 nb_channels;
-    int                 bit_rate;
-    int                 sample_rate;
-    int                 num_vectors;
-    int                 samples_per_channel;
-    /* states */
-    AVLFG               random_state;
-
-    /* transform data */
-    FFTContext          mdct_ctx;
-    float*              mlt_window;
-
-    /* VLC data */
-    VLC                 envelope_quant_index[13];
-    VLC                 sqvh[7];          //scalar quantization
-
-    /* generatable tables and related variables */
-    int                 gain_size_factor;
-    float               gain_table[23];
-
-    /* data buffers */
-
-    uint8_t*            decoded_bytes_buffer;
-    DECLARE_ALIGNED(16, float,mono_mdct_output)[2048];
-    float               decode_buffer_1[1024];
-    float               decode_buffer_2[1024];
-    float               decode_buffer_0[1060]; /* static allocation for joint decode */
-
-    const float         *cplscales[5];
-    int                 num_subpackets;
-    COOKSubpacket       subpacket[MAX_SUBPACKETS];
-} COOKContext;
-
-static float     pow2tab[127];
-static float rootpow2tab[127];
-
-/* debug functions */
-
-#ifdef COOKDEBUG
-static void dump_float_table(float* table, int size, int delimiter) {
-    int i=0;
-    av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
-    for (i=0 ; i<size ; i++) {
-        av_log(NULL, AV_LOG_ERROR, "%5.1f, ", table[i]);
-        if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
-    }
-}
-
-static void dump_int_table(int* table, int size, int delimiter) {
-    int i=0;
-    av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
-    for (i=0 ; i<size ; i++) {
-        av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
-        if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
-    }
-}
-
-static void dump_short_table(short* table, int size, int delimiter) {
-    int i=0;
-    av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
-    for (i=0 ; i<size ; i++) {
-        av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
-        if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
-    }
-}
-
-#endif
-
-/*************** init functions ***************/
-
-/* table generator */
-static av_cold void init_pow2table(void){
-    int i;
-    for (i=-63 ; i<64 ; i++){
-            pow2tab[63+i]=     pow(2, i);
-        rootpow2tab[63+i]=sqrt(pow(2, i));
-    }
-}
-
-/* table generator */
-static av_cold void init_gain_table(COOKContext *q) {
-    int i;
-    q->gain_size_factor = q->samples_per_channel/8;
-    for (i=0 ; i<23 ; i++) {
-        q->gain_table[i] = pow(pow2tab[i+52] ,
-                               (1.0/(double)q->gain_size_factor));
-    }
-}
-
-
-static av_cold int init_cook_vlc_tables(COOKContext *q) {
-    int i, result;
-
-    result = 0;
-    for (i=0 ; i<13 ; i++) {
-        result |= init_vlc (&q->envelope_quant_index[i], 9, 24,
-            envelope_quant_index_huffbits[i], 1, 1,
-            envelope_quant_index_huffcodes[i], 2, 2, 0);
-    }
-    av_log(q->avctx,AV_LOG_DEBUG,"sqvh VLC init\n");
-    for (i=0 ; i<7 ; i++) {
-        result |= init_vlc (&q->sqvh[i], vhvlcsize_tab[i], vhsize_tab[i],
-            cvh_huffbits[i], 1, 1,
-            cvh_huffcodes[i], 2, 2, 0);
-    }
-
-    for(i=0;i<q->num_subpackets;i++){
-        if (q->subpacket[i].joint_stereo==1){
-            result |= init_vlc (&q->subpacket[i].ccpl, 6, (1<<q->subpacket[i].js_vlc_bits)-1,
-                ccpl_huffbits[q->subpacket[i].js_vlc_bits-2], 1, 1,
-                ccpl_huffcodes[q->subpacket[i].js_vlc_bits-2], 2, 2, 0);
-            av_log(q->avctx,AV_LOG_DEBUG,"subpacket %i Joint-stereo VLC used.\n",i);
-        }
-    }
-
-    av_log(q->avctx,AV_LOG_DEBUG,"VLC tables initialized.\n");
-    return result;
-}
-
-static av_cold int init_cook_mlt(COOKContext *q) {
-    int j;
-    int mlt_size = q->samples_per_channel;
-
-    if ((q->mlt_window = av_malloc(sizeof(float)*mlt_size)) == 0)
-      return -1;
-
-    /* Initialize the MLT window: simple sine window. */
-    ff_sine_window_init(q->mlt_window, mlt_size);
-    for(j=0 ; j<mlt_size ; j++)
-        q->mlt_window[j] *= sqrt(2.0 / q->samples_per_channel);
-
-    /* Initialize the MDCT. */
-    if (ff_mdct_init(&q->mdct_ctx, av_log2(mlt_size)+1, 1, 1.0)) {
-      av_free(q->mlt_window);
-      return -1;
-    }
-    av_log(q->avctx,AV_LOG_DEBUG,"MDCT initialized, order = %d.\n",
-           av_log2(mlt_size)+1);
-
-    return 0;
-}
-
-static const float *maybe_reformat_buffer32 (COOKContext *q, const float *ptr, int n)
-{
-    if (1)
-        return ptr;
-}
-
-static av_cold void init_cplscales_table (COOKContext *q) {
-    int i;
-    for (i=0;i<5;i++)
-        q->cplscales[i] = maybe_reformat_buffer32 (q, cplscales[i], (1<<(i+2))-1);
-}
-
-/*************** init functions end ***********/
-
-/**
- * Cook indata decoding, every 32 bits are XORed with 0x37c511f2.
- * Why? No idea, some checksum/error detection method maybe.
- *
- * Out buffer size: extra bytes are needed to cope with
- * padding/misalignment.
- * Subpackets passed to the decoder can contain two, consecutive
- * half-subpackets, of identical but arbitrary size.
- *          1234 1234 1234 1234  extraA extraB
- * Case 1:  AAAA BBBB              0      0
- * Case 2:  AAAA ABBB BB--         3      3
- * Case 3:  AAAA AABB BBBB         2      2
- * Case 4:  AAAA AAAB BBBB BB--    1      5
- *
- * Nice way to waste CPU cycles.
- *
- * @param inbuffer  pointer to byte array of indata
- * @param out       pointer to byte array of outdata
- * @param bytes     number of bytes
- */
-#define DECODE_BYTES_PAD1(bytes) (3 - ((bytes)+3) % 4)
-#define DECODE_BYTES_PAD2(bytes) ((bytes) % 4 + DECODE_BYTES_PAD1(2 * (bytes)))
-
-static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
-    int i, off;
-    uint32_t c;
-    const uint32_t* buf;
-    uint32_t* obuf = (uint32_t*) out;
-    /* FIXME: 64 bit platforms would be able to do 64 bits at a time.
-     * I'm too lazy though, should be something like
-     * for(i=0 ; i<bitamount/64 ; i++)
-     *     (int64_t)out[i] = 0x37c511f237c511f2^be2me_64(int64_t)in[i]);
-     * Buffer alignment needs to be checked. */
-
-    off = (intptr_t)inbuffer & 3;
-    buf = (const uint32_t*) (inbuffer - off);
-    c = be2me_32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));
-    bytes += 3 + off;
-    for (i = 0; i < bytes/4; i++)
-        obuf[i] = c ^ buf[i];
-
-    return off;
-}
-
-/**
- * Cook uninit
- */
-
-static av_cold int cook_decode_close(AVCodecContext *avctx)
-{
-    int i;
-    COOKContext *q = avctx->priv_data;
-    av_log(avctx,AV_LOG_DEBUG, "Deallocating memory.\n");
-
-    /* Free allocated memory buffers. */
-    av_free(q->mlt_window);
-    av_free(q->decoded_bytes_buffer);
-
-    /* Free the transform. */
-    ff_mdct_end(&q->mdct_ctx);
-
-    /* Free the VLC tables. */
-    for (i=0 ; i<13 ; i++) {
-        free_vlc(&q->envelope_quant_index[i]);
-    }
-    for (i=0 ; i<7 ; i++) {
-        free_vlc(&q->sqvh[i]);
-    }
-    for (i=0 ; i<q->num_subpackets ; i++) {
-        free_vlc(&q->subpacket[i].ccpl);
-    }
-
-    av_log(avctx,AV_LOG_DEBUG,"Memory deallocated.\n");
-
-    return 0;
-}
-
-/**
- * Fill the gain array for the timedomain quantization.
- *
- * @param q                 pointer to the COOKContext
- * @param gaininfo[9]       array of gain indexes
- */
-
-static void decode_gain_info(GetBitContext *gb, int *gaininfo)
-{
-    int i, n;
-
-    while (get_bits1(gb)) {}
-    n = get_bits_count(gb) - 1;     //amount of elements*2 to update
-
-    i = 0;
-    while (n--) {
-        int index = get_bits(gb, 3);
-        int gain = get_bits1(gb) ? get_bits(gb, 4) - 7 : -1;
-
-        while (i <= index) gaininfo[i++] = gain;
-    }
-    while (i <= 8) gaininfo[i++] = 0;
-}
-
-/**
- * Create the quant index table needed for the envelope.
- *
- * @param q                 pointer to the COOKContext
- * @param quant_index_table pointer to the array
- */
-
-static void decode_envelope(COOKContext *q, COOKSubpacket *p, int* quant_index_table) {
-    int i,j, vlc_index;
-
-    quant_index_table[0]= get_bits(&q->gb,6) - 6;       //This is used later in categorize
-
-    for (i=1 ; i < p->total_subbands ; i++){
-        vlc_index=i;
-        if (i >= p->js_subband_start * 2) {
-            vlc_index-=p->js_subband_start;
-        } else {
-            vlc_index/=2;
-            if(vlc_index < 1) vlc_index = 1;
-        }
-        if (vlc_index>13) vlc_index = 13;           //the VLC tables >13 are identical to No. 13
-
-        j = get_vlc2(&q->gb, q->envelope_quant_index[vlc_index-1].table,
-                     q->envelope_quant_index[vlc_index-1].bits,2);
-        quant_index_table[i] = quant_index_table[i-1] + j - 12;    //differential encoding
-    }
-}
-
-/**
- * Calculate the category and category_index vector.
- *
- * @param q                     pointer to the COOKContext
- * @param quant_index_table     pointer to the array
- * @param category              pointer to the category array
- * @param category_index        pointer to the category_index array
- */
-
-static void categorize(COOKContext *q, COOKSubpacket *p, int* quant_index_table,
-                       int* category, int* category_index){
-    int exp_idx, bias, tmpbias1, tmpbias2, bits_left, num_bits, index, v, i, j;
-    int exp_index2[102];
-    int exp_index1[102];
-
-    int tmp_categorize_array[128*2];
-    int tmp_categorize_array1_idx=p->numvector_size;
-    int tmp_categorize_array2_idx=p->numvector_size;
-
-    bits_left =  p->bits_per_subpacket - get_bits_count(&q->gb);
-
-    if(bits_left > q->samples_per_channel) {
-        bits_left = q->samples_per_channel +
-                    ((bits_left - q->samples_per_channel)*5)/8;
-        //av_log(q->avctx, AV_LOG_ERROR, "bits_left = %d\n",bits_left);
-    }
-
-    memset(&exp_index1,0,102*sizeof(int));
-    memset(&exp_index2,0,102*sizeof(int));
-    memset(&tmp_categorize_array,0,128*2*sizeof(int));
-
-    bias=-32;
-
-    /* Estimate bias. */
-    for (i=32 ; i>0 ; i=i/2){
-        num_bits = 0;
-        index = 0;
-        for (j=p->total_subbands ; j>0 ; j--){
-            exp_idx = av_clip((i - quant_index_table[index] + bias) / 2, 0, 7);
-            index++;
-            num_bits+=expbits_tab[exp_idx];
-        }
-        if(num_bits >= bits_left - 32){
-            bias+=i;
-        }
-    }
-
-    /* Calculate total number of bits. */
-    num_bits=0;
-    for (i=0 ; i<p->total_subbands ; i++) {
-        exp_idx = av_clip((bias - quant_index_table[i]) / 2, 0, 7);
-        num_bits += expbits_tab[exp_idx];
-        exp_index1[i] = exp_idx;
-        exp_index2[i] = exp_idx;
-    }
-    tmpbias1 = tmpbias2 = num_bits;
-
-    for (j = 1 ; j < p->numvector_size ; j++) {
-        if (tmpbias1 + tmpbias2 > 2*bits_left) {  /* ---> */
-            int max = -999999;
-            index=-1;
-            for (i=0 ; i<p->total_subbands ; i++){
-                if (exp_index1[i] < 7) {
-                    v = (-2*exp_index1[i]) - quant_index_table[i] + bias;
-                    if ( v >= max) {
-                        max = v;
-                        index = i;
-                    }
-                }
-            }
-            if(index==-1)break;
-            tmp_categorize_array[tmp_categorize_array1_idx++] = index;
-            tmpbias1 -= expbits_tab[exp_index1[index]] -
-                        expbits_tab[exp_index1[index]+1];
-            ++exp_index1[index];
-        } else {  /* <--- */
-            int min = 999999;
-            index=-1;
-            for (i=0 ; i<p->total_subbands ; i++){
-                if(exp_index2[i] > 0){
-                    v = (-2*exp_index2[i])-quant_index_table[i]+bias;
-                    if ( v < min) {
-                        min = v;
-                        index = i;
-                    }
-                }
-            }
-            if(index == -1)break;
-            tmp_categorize_array[--tmp_categorize_array2_idx] = index;
-            tmpbias2 -= expbits_tab[exp_index2[index]] -
-                        expbits_tab[exp_index2[index]-1];
-            --exp_index2[index];
-        }
-    }
-
-    for(i=0 ; i<p->total_subbands ; i++)
-        category[i] = exp_index2[i];
-
-    for(i=0 ; i<p->numvector_size-1 ; i++)
-        category_index[i] = tmp_categorize_array[tmp_categorize_array2_idx++];
-
-}
-
-
-/**
- * Expand the category vector.
- *
- * @param q                     pointer to the COOKContext
- * @param category              pointer to the category array
- * @param category_index        pointer to the category_index array
- */
-
-static inline void expand_category(COOKContext *q, int* category,
-                                   int* category_index){
-    int i;
-    for(i=0 ; i<q->num_vectors ; i++){
-        ++category[category_index[i]];
-    }
-}
-
-/**
- * The real requantization of the mltcoefs
- *
- * @param q                     pointer to the COOKContext
- * @param index                 index
- * @param quant_index           quantisation index
- * @param subband_coef_index    array of indexes to quant_centroid_tab
- * @param subband_coef_sign     signs of coefficients
- * @param mlt_p                 pointer into the mlt buffer
- */
-
-static void scalar_dequant_float(COOKContext *q, int index, int quant_index,
-                           int* subband_coef_index, int* subband_coef_sign,
-                           float* mlt_p){
-    int i;
-    float f1;
-
-    for(i=0 ; i<SUBBAND_SIZE ; i++) {
-        if (subband_coef_index[i]) {
-            f1 = quant_centroid_tab[index][subband_coef_index[i]];
-            if (subband_coef_sign[i]) f1 = -f1;
-        } else {
-            /* noise coding if subband_coef_index[i] == 0 */
-            f1 = dither_tab[index];
-            if (av_lfg_get(&q->random_state) < 0x80000000) f1 = -f1;
-        }
-        mlt_p[i] = f1 * rootpow2tab[quant_index+63];
-    }
-}
-/**
- * Unpack the subband_coef_index and subband_coef_sign vectors.
- *
- * @param q                     pointer to the COOKContext
- * @param category              pointer to the category array
- * @param subband_coef_index    array of indexes to quant_centroid_tab
- * @param subband_coef_sign     signs of coefficients
- */
-
-static int unpack_SQVH(COOKContext *q, COOKSubpacket *p, int category, int* subband_coef_index,
-                       int* subband_coef_sign) {
-    int i,j;
-    int vlc, vd ,tmp, result;
-
-    vd = vd_tab[category];
-    result = 0;
-    for(i=0 ; i<vpr_tab[category] ; i++){
-        vlc = get_vlc2(&q->gb, q->sqvh[category].table, q->sqvh[category].bits, 3);
-        if (p->bits_per_subpacket < get_bits_count(&q->gb)){
-            vlc = 0;
-            result = 1;
-        }
-        for(j=vd-1 ; j>=0 ; j--){
-            tmp = (vlc * invradix_tab[category])/0x100000;
-            subband_coef_index[vd*i+j] = vlc - tmp * (kmax_tab[category]+1);
-            vlc = tmp;
-        }
-        for(j=0 ; j<vd ; j++){
-            if (subband_coef_index[i*vd + j]) {
-                if(get_bits_count(&q->gb) < p->bits_per_subpacket){
-                    subband_coef_sign[i*vd+j] = get_bits1(&q->gb);
-                } else {
-                    result=1;
-                    subband_coef_sign[i*vd+j]=0;
-                }
-            } else {
-                subband_coef_sign[i*vd+j]=0;
-            }
-        }
-    }
-    return result;
-}
-
-
-/**
- * Fill the mlt_buffer with mlt coefficients.
- *
- * @param q                 pointer to the COOKContext
- * @param category          pointer to the category array
- * @param quant_index_table pointer to the array
- * @param mlt_buffer        pointer to mlt coefficients
- */
-
-
-static void decode_vectors(COOKContext* q, COOKSubpacket* p, int* category,
-                           int *quant_index_table, float* mlt_buffer){
-    /* A zero in this table means that the subband coefficient is
-       random noise coded. */
-    int subband_coef_index[SUBBAND_SIZE];
-    /* A zero in this table means that the subband coefficient is a
-       positive multiplicator. */
-    int subband_coef_sign[SUBBAND_SIZE];
-    int band, j;
-    int index=0;
-
-    for(band=0 ; band<p->total_subbands ; band++){
-        index = category[band];
-        if(category[band] < 7){
-            if(unpack_SQVH(q, p, category[band], subband_coef_index, subband_coef_sign)){
-                index=7;
-                for(j=0 ; j<p->total_subbands ; j++) category[band+j]=7;
-            }
-        }
-        if(index>=7) {
-            memset(subband_coef_index, 0, sizeof(subband_coef_index));
-            memset(subband_coef_sign, 0, sizeof(subband_coef_sign));
-        }
-        q->scalar_dequant(q, index, quant_index_table[band],
-                          subband_coef_index, subband_coef_sign,
-                          &mlt_buffer[band * SUBBAND_SIZE]);
-    }
-
-    if(p->total_subbands*SUBBAND_SIZE >= q->samples_per_channel){
-        return;
-    } /* FIXME: should this be removed, or moved into loop above? */
-}
-
-
-/**
- * function for decoding mono data
- *
- * @param q                 pointer to the COOKContext
- * @param mlt_buffer        pointer to mlt coefficients
- */
-
-static void mono_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer) {
-
-    int category_index[128];
-    int quant_index_table[102];
-    int category[128];
-
-    memset(&category, 0, 128*sizeof(int));
-    memset(&category_index, 0, 128*sizeof(int));
-
-    decode_envelope(q, p, quant_index_table);
-    q->num_vectors = get_bits(&q->gb,p->log2_numvector_size);
-    categorize(q, p, quant_index_table, category, category_index);
-    expand_category(q, category, category_index);
-    decode_vectors(q, p, category, quant_index_table, mlt_buffer);
-}
-
-
-/**
- * the actual requantization of the timedomain samples
- *
- * @param q                 pointer to the COOKContext
- * @param buffer            pointer to the timedomain buffer
- * @param gain_index        index for the block multiplier
- * @param gain_index_next   index for the next block multiplier
- */
-
-static void interpolate_float(COOKContext *q, float* buffer,
-                        int gain_index, int gain_index_next){
-    int i;
-    float fc1, fc2;
-    fc1 = pow2tab[gain_index+63];
-
-    if(gain_index == gain_index_next){              //static gain
-        for(i=0 ; i<q->gain_size_factor ; i++){
-            buffer[i]*=fc1;
-        }
-        return;
-    } else {                                        //smooth gain
-        fc2 = q->gain_table[11 + (gain_index_next-gain_index)];
-        for(i=0 ; i<q->gain_size_factor ; i++){
-            buffer[i]*=fc1;
-            fc1*=fc2;
-        }
-        return;
-    }
-}
-
-/**
- * Apply transform window, overlap buffers.
- *
- * @param q                 pointer to the COOKContext
- * @param inbuffer          pointer to the mltcoefficients
- * @param gains_ptr         current and previous gains
- * @param previous_buffer   pointer to the previous buffer to be used for overlapping
- */
-
-static void imlt_window_float (COOKContext *q, float *buffer1,
-                               cook_gains *gains_ptr, float *previous_buffer)
-{
-    const float fc = pow2tab[gains_ptr->previous[0] + 63];
-    int i;
-    /* The weird thing here, is that the two halves of the time domain
-     * buffer are swapped. Also, the newest data, that we save away for
-     * next frame, has the wrong sign. Hence the subtraction below.
-     * Almost sounds like a complex conjugate/reverse data/FFT effect.
-     */
-
-    /* Apply window and overlap */
-    for(i = 0; i < q->samples_per_channel; i++){
-        buffer1[i] = buffer1[i] * fc * q->mlt_window[i] -
-          previous_buffer[i] * q->mlt_window[q->samples_per_channel - 1 - i];
-    }
-}
-
-/**
- * The modulated lapped transform, this takes transform coefficients
- * and transforms them into timedomain samples.
- * Apply transform window, overlap buffers, apply gain profile
- * and buffer management.
- *
- * @param q                 pointer to the COOKContext
- * @param inbuffer          pointer to the mltcoefficients
- * @param gains_ptr         current and previous gains
- * @param previous_buffer   pointer to the previous buffer to be used for overlapping
- */
-
-static void imlt_gain(COOKContext *q, float *inbuffer,
-                      cook_gains *gains_ptr, float* previous_buffer)
-{
-    float *buffer0 = q->mono_mdct_output;
-    float *buffer1 = q->mono_mdct_output + q->samples_per_channel;
-    int i;
-
-    /* Inverse modified discrete cosine transform */
-    ff_imdct_calc(&q->mdct_ctx, q->mono_mdct_output, inbuffer);
-
-    q->imlt_window (q, buffer1, gains_ptr, previous_buffer);
-
-    /* Apply gain profile */
-    for (i = 0; i < 8; i++) {
-        if (gains_ptr->now[i] || gains_ptr->now[i + 1])
-            q->interpolate(q, &buffer1[q->gain_size_factor * i],
-                           gains_ptr->now[i], gains_ptr->now[i + 1]);
-    }
-
-    /* Save away the current to be previous block. */
-    memcpy(previous_buffer, buffer0, sizeof(float)*q->samples_per_channel);
-}
-
-
-/**
- * function for getting the jointstereo coupling information
- *
- * @param q                 pointer to the COOKContext
- * @param decouple_tab      decoupling array
- *
- */
-
-static void decouple_info(COOKContext *q, COOKSubpacket *p, int* decouple_tab){
-    int length, i;
-
-    if(get_bits1(&q->gb)) {
-        if(cplband[p->js_subband_start] > cplband[p->subbands-1]) return;
-
-        length = cplband[p->subbands-1] - cplband[p->js_subband_start] + 1;
-        for (i=0 ; i<length ; i++) {
-            decouple_tab[cplband[p->js_subband_start] + i] = get_vlc2(&q->gb, p->ccpl.table, p->ccpl.bits, 2);
-        }
-        return;
-    }
-
-    if(cplband[p->js_subband_start] > cplband[p->subbands-1]) return;
-
-    length = cplband[p->subbands-1] - cplband[p->js_subband_start] + 1;
-    for (i=0 ; i<length ; i++) {
-       decouple_tab[cplband[p->js_subband_start] + i] = get_bits(&q->gb, p->js_vlc_bits);
-    }
-    return;
-}
-
-/*
- * function decouples a pair of signals from a single signal via multiplication.
- *
- * @param q                 pointer to the COOKContext
- * @param subband           index of the current subband
- * @param f1                multiplier for channel 1 extraction
- * @param f2                multiplier for channel 2 extraction
- * @param decode_buffer     input buffer
- * @param mlt_buffer1       pointer to left channel mlt coefficients
- * @param mlt_buffer2       pointer to right channel mlt coefficients
- */
-static void decouple_float (COOKContext *q,
-                            COOKSubpacket *p,
-                            int subband,
-                            float f1, float f2,
-                            float *decode_buffer,
-                            float *mlt_buffer1, float *mlt_buffer2)
-{
-    int j, tmp_idx;
-    for (j=0 ; j<SUBBAND_SIZE ; j++) {
-        tmp_idx = ((p->js_subband_start + subband)*SUBBAND_SIZE)+j;
-        mlt_buffer1[SUBBAND_SIZE*subband + j] = f1 * decode_buffer[tmp_idx];
-        mlt_buffer2[SUBBAND_SIZE*subband + j] = f2 * decode_buffer[tmp_idx];
-    }
-}
-
-/**
- * function for decoding joint stereo data
- *
- * @param q                 pointer to the COOKContext
- * @param mlt_buffer1       pointer to left channel mlt coefficients
- * @param mlt_buffer2       pointer to right channel mlt coefficients
- */
-
-static void joint_decode(COOKContext *q, COOKSubpacket *p, float* mlt_buffer1,
-                         float* mlt_buffer2) {
-    int i,j;
-    int decouple_tab[SUBBAND_SIZE];
-    float *decode_buffer = q->decode_buffer_0;
-    int idx, cpl_tmp;
-    float f1,f2;
-    const float* cplscale;
-
-    memset(decouple_tab, 0, sizeof(decouple_tab));
-    memset(decode_buffer, 0, sizeof(decode_buffer));
-
-    /* Make sure the buffers are zeroed out. */
-    memset(mlt_buffer1,0, 1024*sizeof(float));
-    memset(mlt_buffer2,0, 1024*sizeof(float));
-    decouple_info(q, p, decouple_tab);
-    mono_decode(q, p, decode_buffer);
-
-    /* The two channels are stored interleaved in decode_buffer. */
-    for (i=0 ; i<p->js_subband_start ; i++) {
-        for (j=0 ; j<SUBBAND_SIZE ; j++) {
-            mlt_buffer1[i*20+j] = decode_buffer[i*40+j];
-            mlt_buffer2[i*20+j] = decode_buffer[i*40+20+j];
-        }
-    }
-
-    /* When we reach js_subband_start (the higher frequencies)
-       the coefficients are stored in a coupling scheme. */
-    idx = (1 << p->js_vlc_bits) - 1;
-    for (i=p->js_subband_start ; i<p->subbands ; i++) {
-        cpl_tmp = cplband[i];
-        idx -=decouple_tab[cpl_tmp];
-        cplscale = q->cplscales[p->js_vlc_bits-2];  //choose decoupler table
-        f1 = cplscale[decouple_tab[cpl_tmp]];
-        f2 = cplscale[idx-1];
-        q->decouple (q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2);
-        idx = (1 << p->js_vlc_bits) - 1;
-    }
-}
-
-/**
- * First part of subpacket decoding:
- *  decode raw stream bytes and read gain info.
- *
- * @param q                 pointer to the COOKContext
- * @param inbuffer          pointer to raw stream data
- * @param gain_ptr          array of current/prev gain pointers
- */
-
-static inline void
-decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p, const uint8_t *inbuffer,
-                      cook_gains *gains_ptr)
-{
-    int offset;
-
-    offset = decode_bytes(inbuffer, q->decoded_bytes_buffer,
-                          p->bits_per_subpacket/8);
-    init_get_bits(&q->gb, q->decoded_bytes_buffer + offset,
-                  p->bits_per_subpacket);
-    decode_gain_info(&q->gb, gains_ptr->now);
-
-    /* Swap current and previous gains */
-    FFSWAP(int *, gains_ptr->now, gains_ptr->previous);
-}
-
- /**
- * Saturate the output signal to signed 16bit integers.
- *
- * @param q                 pointer to the COOKContext
- * @param chan              channel to saturate
- * @param out               pointer to the output vector
- */
-static void
-saturate_output_float (COOKContext *q, int chan, int16_t *out)
-{
-    int j;
-    float *output = q->mono_mdct_output + q->samples_per_channel;
-    /* Clip and convert floats to 16 bits.
-     */
-    for (j = 0; j < q->samples_per_channel; j++) {
-        out[chan + q->nb_channels * j] =
-          av_clip_int16(lrintf(output[j]));
-    }
-}
-
-/**
- * Final part of subpacket decoding:
- *  Apply modulated lapped transform, gain compensation,
- *  clip and convert to integer.
- *
- * @param q                 pointer to the COOKContext
- * @param decode_buffer     pointer to the mlt coefficients
- * @param gain_ptr          array of current/prev gain pointers
- * @param previous_buffer   pointer to the previous buffer to be used for overlapping
- * @param out               pointer to the output buffer
- * @param chan              0: left or single channel, 1: right channel
- */
-
-static inline void
-mlt_compensate_output(COOKContext *q, float *decode_buffer,
-                      cook_gains *gains, float *previous_buffer,
-                      int16_t *out, int chan)
-{
-    imlt_gain(q, decode_buffer, gains, previous_buffer);
-    q->saturate_output (q, chan, out);
-}
-
-
-/**
- * Cook subpacket decoding. This function returns one decoded subpacket,
- * usually 1024 samples per channel.
- *
- * @param q                 pointer to the COOKContext
- * @param inbuffer          pointer to the inbuffer
- * @param sub_packet_size   subpacket size
- * @param outbuffer         pointer to the outbuffer
- */
-
-
-static void decode_subpacket(COOKContext *q, COOKSubpacket* p, const uint8_t *inbuffer, int16_t *outbuffer) {
-    int sub_packet_size = p->size;
-    /* packet dump */
-//    for (i=0 ; i<sub_packet_size ; i++) {
-//        av_log(q->avctx, AV_LOG_ERROR, "%02x", inbuffer[i]);
-//    }
-//    av_log(q->avctx, AV_LOG_ERROR, "\n");
-    memset(q->decode_buffer_1,0,sizeof(q->decode_buffer_1));
-    decode_bytes_and_gain(q, p, inbuffer, &p->gains1);
-
-    if (p->joint_stereo) {
-        joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2);
-    } else {
-        mono_decode(q, p, q->decode_buffer_1);
-
-        if (p->num_channels == 2) {
-            decode_bytes_and_gain(q, p, inbuffer + sub_packet_size/2, &p->gains2);
-            mono_decode(q, p, q->decode_buffer_2);
-        }
-    }
-
-    mlt_compensate_output(q, q->decode_buffer_1, &p->gains1,
-                          p->mono_previous_buffer1, outbuffer, p->ch_idx);
-
-    if (p->num_channels == 2) {
-        if (p->joint_stereo) {
-            mlt_compensate_output(q, q->decode_buffer_2, &p->gains1,
-                                  p->mono_previous_buffer2, outbuffer, p->ch_idx + 1);
-         } else {
-            mlt_compensate_output(q, q->decode_buffer_2, &p->gains2,
-                                  p->mono_previous_buffer2, outbuffer, p->ch_idx + 1);
-         }
-     }
-
-}
-
-
-/**
- * Cook frame decoding
- *
- * @param avctx     pointer to the AVCodecContext
- */
-
-static int cook_decode_frame(AVCodecContext *avctx,
-            void *data, int *data_size,
-            AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    COOKContext *q = avctx->priv_data;
-    int i;
-    int offset = 0;
-    int chidx = 0;
-
-    if (buf_size < avctx->block_align)
-        return buf_size;
-
-    /* estimate subpacket sizes */
-    q->subpacket[0].size = avctx->block_align;
-
-    for(i=1;i<q->num_subpackets;i++){
-        q->subpacket[i].size = 2 * buf[avctx->block_align - q->num_subpackets + i];
-        q->subpacket[0].size -= q->subpacket[i].size + 1;
-        if (q->subpacket[0].size < 0) {
-            av_log(avctx,AV_LOG_DEBUG,"frame subpacket size total > avctx->block_align!\n");
-            return -1;
-        }
-    }
-
-    /* decode supbackets */
-    *data_size = 0;
-    for(i=0;i<q->num_subpackets;i++){
-        q->subpacket[i].bits_per_subpacket = (q->subpacket[i].size*8)>>q->subpacket[i].bits_per_subpdiv;
-        q->subpacket[i].ch_idx = chidx;
-        av_log(avctx,AV_LOG_DEBUG,"subpacket[%i] size %i js %i %i block_align %i\n",i,q->subpacket[i].size,q->subpacket[i].joint_stereo,offset,avctx->block_align);
-        decode_subpacket(q, &q->subpacket[i], buf + offset, (int16_t*)data);
-        offset += q->subpacket[i].size;
-        chidx += q->subpacket[i].num_channels;
-        av_log(avctx,AV_LOG_DEBUG,"subpacket[%i] %i %i\n",i,q->subpacket[i].size * 8,get_bits_count(&q->gb));
-    }
-    *data_size = sizeof(int16_t) * q->nb_channels * q->samples_per_channel;
-
-    /* Discard the first two frames: no valid audio. */
-    if (avctx->frame_number < 2) *data_size = 0;
-
-    return avctx->block_align;
-}
-
-#ifdef COOKDEBUG
-static void dump_cook_context(COOKContext *q)
-{
-    //int i=0;
-#define PRINT(a,b) av_log(q->avctx,AV_LOG_ERROR," %s = %d\n", a, b);
-    av_log(q->avctx,AV_LOG_ERROR,"COOKextradata\n");
-    av_log(q->avctx,AV_LOG_ERROR,"cookversion=%x\n",q->subpacket[0].cookversion);
-    if (q->subpacket[0].cookversion > STEREO) {
-        PRINT("js_subband_start",q->subpacket[0].js_subband_start);
-        PRINT("js_vlc_bits",q->subpacket[0].js_vlc_bits);
-    }
-    av_log(q->avctx,AV_LOG_ERROR,"COOKContext\n");
-    PRINT("nb_channels",q->nb_channels);
-    PRINT("bit_rate",q->bit_rate);
-    PRINT("sample_rate",q->sample_rate);
-    PRINT("samples_per_channel",q->subpacket[0].samples_per_channel);
-    PRINT("samples_per_frame",q->subpacket[0].samples_per_frame);
-    PRINT("subbands",q->subpacket[0].subbands);
-    PRINT("random_state",q->random_state);
-    PRINT("js_subband_start",q->subpacket[0].js_subband_start);
-    PRINT("log2_numvector_size",q->subpacket[0].log2_numvector_size);
-    PRINT("numvector_size",q->subpacket[0].numvector_size);
-    PRINT("total_subbands",q->subpacket[0].total_subbands);
-}
-#endif
-
-static av_cold int cook_count_channels(unsigned int mask){
-    int i;
-    int channels = 0;
-    for(i = 0;i<32;i++){
-        if(mask & (1<<i))
-            ++channels;
-    }
-    return channels;
-}
-
-/**
- * Cook initialization
- *
- * @param avctx     pointer to the AVCodecContext
- */
-
-static av_cold int cook_decode_init(AVCodecContext *avctx)
-{
-    COOKContext *q = avctx->priv_data;
-    const uint8_t *edata_ptr = avctx->extradata;
-    const uint8_t *edata_ptr_end = edata_ptr + avctx->extradata_size;
-    int extradata_size = avctx->extradata_size;
-    int s = 0;
-    unsigned int channel_mask = 0;
-    q->avctx = avctx;
-
-    /* Take care of the codec specific extradata. */
-    if (extradata_size <= 0) {
-        av_log(avctx,AV_LOG_ERROR,"Necessary extradata missing!\n");
-        return -1;
-    }
-    av_log(avctx,AV_LOG_DEBUG,"codecdata_length=%d\n",avctx->extradata_size);
-
-    /* Take data from the AVCodecContext (RM container). */
-    q->sample_rate = avctx->sample_rate;
-    q->nb_channels = avctx->channels;
-    q->bit_rate = avctx->bit_rate;
-
-    /* Initialize RNG. */
-    av_lfg_init(&q->random_state, 0);
-
-    while(edata_ptr < edata_ptr_end){
-        /* 8 for mono, 16 for stereo, ? for multichannel
-           Swap to right endianness so we don't need to care later on. */
-        if (extradata_size >= 8){
-            q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr);
-            q->subpacket[s].samples_per_frame =  bytestream_get_be16(&edata_ptr);
-            q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr);
-            extradata_size -= 8;
-        }
-        if (avctx->extradata_size >= 8){
-            bytestream_get_be32(&edata_ptr);    //Unknown unused
-            q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr);
-            q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr);
-            extradata_size -= 8;
-        }
-
-        /* Initialize extradata related variables. */
-        q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame / q->nb_channels;
-        q->subpacket[s].bits_per_subpacket = avctx->block_align * 8;
-
-        /* Initialize default data states. */
-        q->subpacket[s].log2_numvector_size = 5;
-        q->subpacket[s].total_subbands = q->subpacket[s].subbands;
-        q->subpacket[s].num_channels = 1;
-
-        /* Initialize version-dependent variables */
-
-        av_log(avctx,AV_LOG_DEBUG,"subpacket[%i].cookversion=%x\n",s,q->subpacket[s].cookversion);
-        q->subpacket[s].joint_stereo = 0;
-        switch (q->subpacket[s].cookversion) {
-            case MONO:
-                if (q->nb_channels != 1) {
-                    av_log(avctx,AV_LOG_ERROR,"Container channels != 1, report sample!\n");
-                    return -1;
-                }
-                av_log(avctx,AV_LOG_DEBUG,"MONO\n");
-                break;
-            case STEREO:
-                if (q->nb_channels != 1) {
-                    q->subpacket[s].bits_per_subpdiv = 1;
-                    q->subpacket[s].num_channels = 2;
-                }
-                av_log(avctx,AV_LOG_DEBUG,"STEREO\n");
-                break;
-            case JOINT_STEREO:
-                if (q->nb_channels != 2) {
-                    av_log(avctx,AV_LOG_ERROR,"Container channels != 2, report sample!\n");
-                    return -1;
-                }
-                av_log(avctx,AV_LOG_DEBUG,"JOINT_STEREO\n");
-                if (avctx->extradata_size >= 16){
-                    q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start;
-                    q->subpacket[s].joint_stereo = 1;
-                    q->subpacket[s].num_channels = 2;
-                }
-                if (q->subpacket[s].samples_per_channel > 256) {
-                    q->subpacket[s].log2_numvector_size  = 6;
-                }
-                if (q->subpacket[s].samples_per_channel > 512) {
-                    q->subpacket[s].log2_numvector_size  = 7;
-                }
-                break;
-            case MC_COOK:
-                av_log(avctx,AV_LOG_DEBUG,"MULTI_CHANNEL\n");
-                if(extradata_size >= 4)
-                    channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr);
-
-                if(cook_count_channels(q->subpacket[s].channel_mask) > 1){
-                    q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start;
-                    q->subpacket[s].joint_stereo = 1;
-                    q->subpacket[s].num_channels = 2;
-                    q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame >> 1;
-
-                    if (q->subpacket[s].samples_per_channel > 256) {
-                        q->subpacket[s].log2_numvector_size  = 6;
-                    }
-                    if (q->subpacket[s].samples_per_channel > 512) {
-                        q->subpacket[s].log2_numvector_size  = 7;
-                    }
-                }else
-                    q->subpacket[s].samples_per_channel = q->subpacket[s].samples_per_frame;
-
-                break;
-            default:
-                av_log(avctx,AV_LOG_ERROR,"Unknown Cook version, report sample!\n");
-                return -1;
-                break;
-        }
-
-        if(s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) {
-            av_log(avctx,AV_LOG_ERROR,"different number of samples per channel!\n");
-            return -1;
-        } else
-            q->samples_per_channel = q->subpacket[0].samples_per_channel;
-
-
-        /* Initialize variable relations */
-        q->subpacket[s].numvector_size = (1 << q->subpacket[s].log2_numvector_size);
-
-        /* Try to catch some obviously faulty streams, othervise it might be exploitable */
-        if (q->subpacket[s].total_subbands > 53) {
-            av_log(avctx,AV_LOG_ERROR,"total_subbands > 53, report sample!\n");
-            return -1;
-        }
-
-        if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 0)) {
-            av_log(avctx,AV_LOG_ERROR,"js_vlc_bits = %d, only >= 0 and <= 6 allowed!\n",q->subpacket[s].js_vlc_bits);
-            return -1;
-        }
-
-        if (q->subpacket[s].subbands > 50) {
-            av_log(avctx,AV_LOG_ERROR,"subbands > 50, report sample!\n");
-            return -1;
-        }
-        q->subpacket[s].gains1.now      = q->subpacket[s].gain_1;
-        q->subpacket[s].gains1.previous = q->subpacket[s].gain_2;
-        q->subpacket[s].gains2.now      = q->subpacket[s].gain_3;
-        q->subpacket[s].gains2.previous = q->subpacket[s].gain_4;
-
-        q->num_subpackets++;
-        s++;
-        if (s > MAX_SUBPACKETS) {
-            av_log(avctx,AV_LOG_ERROR,"Too many subpackets > 5, report file!\n");
-            return -1;
-        }
-    }
-    /* Generate tables */
-    init_pow2table();
-    init_gain_table(q);
-    init_cplscales_table(q);
-
-    if (init_cook_vlc_tables(q) != 0)
-        return -1;
-
-
-    if(avctx->block_align >= UINT_MAX/2)
-        return -1;
-
-    /* Pad the databuffer with:
-       DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(),
-       FF_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */
-        q->decoded_bytes_buffer =
-          av_mallocz(avctx->block_align
-                     + DECODE_BYTES_PAD1(avctx->block_align)
-                     + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (q->decoded_bytes_buffer == NULL)
-        return -1;
-
-    /* Initialize transform. */
-    if ( init_cook_mlt(q) != 0 )
-        return -1;
-
-    /* Initialize COOK signal arithmetic handling */
-    if (1) {
-        q->scalar_dequant  = scalar_dequant_float;
-        q->decouple        = decouple_float;
-        q->imlt_window     = imlt_window_float;
-        q->interpolate     = interpolate_float;
-        q->saturate_output = saturate_output_float;
-    }
-
-    /* Try to catch some obviously faulty streams, othervise it might be exploitable */
-    if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) {
-    } else {
-        av_log(avctx,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel);
-        return -1;
-    }
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    if (channel_mask)
-        avctx->channel_layout = channel_mask;
-    else
-        avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
-
-#ifdef COOKDEBUG
-    dump_cook_context(q);
-#endif
-    return 0;
-}
-
-
-AVCodec cook_decoder =
-{
-    .name = "cook",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_COOK,
-    .priv_data_size = sizeof(COOKContext),
-    .init = cook_decode_init,
-    .close = cook_decode_close,
-    .decode = cook_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("COOK"),
-};
diff --git a/libavcodec/cookdata.h b/libavcodec/cookdata.h
deleted file mode 100644
index 15e8e95..0000000
--- a/libavcodec/cookdata.h
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * COOK compatible decoder data
- * Copyright (c) 2003 Sascha Sommer
- * Copyright (c) 2005 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Cook AKA RealAudio G2 compatible decoderdata
- */
-
-#ifndef AVCODEC_COOKDATA_H
-#define AVCODEC_COOKDATA_H
-
-#include <stdint.h>
-
-/* various data tables */
-
-static const int expbits_tab[8] = {
-    52,47,43,37,29,22,16,0,
-};
-
-static const float dither_tab[8] = {
-  0.0, 0.0, 0.0, 0.0, 0.0, 0.176777, 0.25, 0.707107,
-};
-
-static const float quant_centroid_tab[7][14] = {
-  { 0.000, 0.392, 0.761, 1.120, 1.477, 1.832, 2.183, 2.541, 2.893, 3.245, 3.598, 3.942, 4.288, 4.724 },
-  { 0.000, 0.544, 1.060, 1.563, 2.068, 2.571, 3.072, 3.562, 4.070, 4.620, 0.000, 0.000, 0.000, 0.000 },
-  { 0.000, 0.746, 1.464, 2.180, 2.882, 3.584, 4.316, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
-  { 0.000, 1.006, 2.000, 2.993, 3.985, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
-  { 0.000, 1.321, 2.703, 3.983, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
-  { 0.000, 1.657, 3.491, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 },
-  { 0.000, 1.964, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000 }
-};
-
-static const int invradix_tab[7] = {
-    74899, 104858, 149797, 209716, 262144, 349526, 524288,
-};
-
-static const int kmax_tab[7] = {
-    13, 9, 6, 4, 3, 2, 1,
-};
-
-static const int vd_tab[7] = {
-    2, 2, 2, 4, 4, 5, 5,
-};
-
-static const int vpr_tab[7] = {
-    10, 10, 10, 5, 5, 4, 4,
-};
-
-
-
-/* VLC data */
-
-static const int vhsize_tab[7] = {
-    191, 97, 48, 607, 246, 230, 32,
-};
-
-static const int vhvlcsize_tab[7] = {
-    8, 7, 7, 10, 9, 9, 6,
-};
-
-static const uint8_t envelope_quant_index_huffbits[13][24] = {
-    {  4,  6,  5,  5,  4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 5, 7,  8,  9, 11, 11, 12, 12, 12, 12 },
-    { 10,  8,  6,  5,  5, 4, 3, 3, 3, 3, 3, 3, 4, 5, 7, 9, 11, 12, 13, 15, 15, 15, 16, 16 },
-    { 12, 10,  8,  6,  5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 4,  5,  5,  7,  9, 11, 13, 14, 14 },
-    { 13, 10,  9,  9,  7, 7, 5, 5, 4, 3, 3, 3, 3, 3, 4, 4,  4,  5,  7,  9, 11, 13, 13, 13 },
-    { 12, 13, 10,  8,  6, 6, 5, 5, 4, 4, 3, 3, 3, 3, 3, 4,  5,  5,  6,  7,  9, 11, 14, 14 },
-    { 12, 11,  9,  8,  8, 7, 5, 4, 4, 3, 3, 3, 3, 3, 4, 4,  5,  5,  7,  8, 10, 13, 14, 14 },
-    { 15, 16, 15, 12, 10, 8, 6, 5, 4, 3, 3, 3, 2, 3, 4, 5,  5,  7,  9, 11, 13, 16, 16, 16 },
-    { 14, 14, 11, 10,  9, 7, 7, 5, 5, 4, 3, 3, 2, 3, 3, 4,  5,  7,  9,  9, 12, 14, 15, 15 },
-    {  9,  9,  9,  8,  7, 6, 5, 4, 3, 3, 3, 3, 3, 3, 4, 5,  6,  7,  8, 10, 11, 12, 13, 13 },
-    { 14, 12, 10,  8,  6, 6, 5, 4, 3, 3, 3, 3, 3, 3, 4, 5,  6,  8,  8,  9, 11, 14, 14, 14 },
-    { 13, 10,  9,  8,  6, 6, 5, 4, 4, 4, 3, 3, 2, 3, 4, 5,  6,  8,  9,  9, 11, 12, 14, 14 },
-    { 16, 13, 12, 11,  9, 6, 5, 5, 4, 4, 4, 3, 2, 3, 3, 4,  5,  7,  8, 10, 14, 16, 16, 16 },
-    { 13, 14, 14, 14, 10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4,  5,  5,  7,  9, 11, 14, 14, 14 },
-};
-
-static const uint16_t envelope_quant_index_huffcodes[13][24] = {
-    {0x0006, 0x003e, 0x001c, 0x001d, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x0000, 0x0001,
-     0x0002, 0x000d, 0x001e, 0x007e, 0x00fe, 0x01fe, 0x07fc, 0x07fd, 0x0ffc, 0x0ffd, 0x0ffe, 0x0fff},
-    {0x03fe, 0x00fe, 0x003e, 0x001c, 0x001d, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005,
-     0x000d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x0ffe, 0x1ffe, 0x7ffc, 0x7ffd, 0x7ffe, 0xfffe, 0xffff},
-    {0x0ffe, 0x03fe, 0x00fe, 0x003e, 0x001c, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x0000,
-     0x0001, 0x0002, 0x000c, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffe, 0x3ffe, 0x3fff},
-    {0x1ffc, 0x03fe, 0x01fc, 0x01fd, 0x007c, 0x007d, 0x001c, 0x001d, 0x000a, 0x0000, 0x0001, 0x0002,
-     0x0003, 0x0004, 0x000b, 0x000c, 0x000d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffd, 0x1ffe, 0x1fff},
-    {0x0ffe, 0x1ffe, 0x03fe, 0x00fe, 0x003c, 0x003d, 0x001a, 0x001b, 0x000a, 0x000b, 0x0000, 0x0001,
-     0x0002, 0x0003, 0x0004, 0x000c, 0x001c, 0x001d, 0x003e, 0x007e, 0x01fe, 0x07fe, 0x3ffe, 0x3fff},
-    {0x0ffe, 0x07fe, 0x01fe, 0x00fc, 0x00fd, 0x007c, 0x001c, 0x000a, 0x000b, 0x0000, 0x0001, 0x0002,
-     0x0003, 0x0004, 0x000c, 0x000d, 0x001d, 0x001e, 0x007d, 0x00fe, 0x03fe, 0x1ffe, 0x3ffe, 0x3fff},
-    {0x7ffc, 0xfffc, 0x7ffd, 0x0ffe, 0x03fe, 0x00fe, 0x003e, 0x001c, 0x000c, 0x0002, 0x0003, 0x0004,
-     0x0000, 0x0005, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x1ffe, 0xfffd, 0xfffe, 0xffff},
-    {0x3ffc, 0x3ffd, 0x07fe, 0x03fe, 0x01fc, 0x007c, 0x007d, 0x001c, 0x001d, 0x000c, 0x0002, 0x0003,
-     0x0000, 0x0004, 0x0005, 0x000d, 0x001e, 0x007e, 0x01fd, 0x01fe, 0x0ffe, 0x3ffe, 0x7ffe, 0x7fff},
-    {0x01fc, 0x01fd, 0x01fe, 0x00fc, 0x007c, 0x003c, 0x001c, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003,
-     0x0004, 0x0005, 0x000d, 0x001d, 0x003d, 0x007d, 0x00fd, 0x03fe, 0x07fe, 0x0ffe, 0x1ffe, 0x1fff},
-    {0x3ffc, 0x0ffe, 0x03fe, 0x00fc, 0x003c, 0x003d, 0x001c, 0x000c, 0x0000, 0x0001, 0x0002, 0x0003,
-     0x0004, 0x0005, 0x000d, 0x001d, 0x003e, 0x00fd, 0x00fe, 0x01fe, 0x07fe, 0x3ffd, 0x3ffe, 0x3fff},
-    {0x1ffe, 0x03fe, 0x01fc, 0x00fc, 0x003c, 0x003d, 0x001c, 0x000a, 0x000b, 0x000c, 0x0002, 0x0003,
-     0x0000, 0x0004, 0x000d, 0x001d, 0x003e, 0x00fd, 0x01fd, 0x01fe, 0x07fe, 0x0ffe, 0x3ffe, 0x3fff},
-    {0xfffc, 0x1ffe, 0x0ffe, 0x07fe, 0x01fe, 0x003e, 0x001c, 0x001d, 0x000a, 0x000b, 0x000c, 0x0002,
-     0x0000, 0x0003, 0x0004, 0x000d, 0x001e, 0x007e, 0x00fe, 0x03fe, 0x3ffe, 0xfffd, 0xfffe, 0xffff},
-    {0x1ffc, 0x3ffa, 0x3ffb, 0x3ffc, 0x03fe, 0x00fe, 0x007c, 0x007d, 0x001c, 0x000c, 0x0002, 0x0003,
-     0x0000, 0x0004, 0x0005, 0x000d, 0x001d, 0x001e, 0x007e, 0x01fe, 0x07fe, 0x3ffd, 0x3ffe, 0x3fff},
-};
-
-
-static const uint8_t cvh_huffbits0[191] = {
-    1, 4, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10,
-    11, 11, 4, 5, 6, 7, 7, 8, 8, 9, 9, 9,
-    9, 10, 11, 11, 5, 6, 7, 8, 8, 9, 9, 9,
-    9, 10, 10, 10, 11, 12, 6, 7, 8, 9, 9, 9,
-    9, 10, 10, 10, 10, 11, 12, 13, 7, 7, 8, 9,
-    9, 9, 10, 10, 10, 10, 11, 11, 12, 13, 8, 8,
-    9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 13, 14,
-    8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13,
-    13, 15, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12,
-    12, 13, 14, 15, 9, 9, 9, 10, 10, 10, 11, 11,
-    12, 13, 12, 14, 15, 16, 9, 9, 10, 10, 10, 10,
-    11, 12, 12, 14, 14, 16, 16, 0, 9, 9, 10, 10,
-    11, 11, 12, 13, 13, 14, 14, 15, 0, 0, 10, 10,
-    10, 11, 11, 12, 12, 13, 15, 15, 16, 0, 0, 0,
-    11, 11, 11, 12, 13, 13, 13, 15, 16, 16, 0, 0,
-    0, 0, 11, 11, 12, 13, 13, 14, 15, 16, 16,
-};
-
-static const uint16_t cvh_huffcodes0[191] = {
-    0x0000,0x0008,0x002c,0x002d,0x0062,0x0063,0x00d4,0x00d5,0x00d6,0x01c6,0x01c7,0x03ca,
-    0x07d6,0x07d7,0x0009,0x0014,0x002e,0x0064,0x0065,0x00d7,0x00d8,0x01c8,0x01c9,0x01ca,
-    0x01cb,0x03cb,0x07d8,0x07d9,0x0015,0x002f,0x0066,0x00d9,0x00da,0x01cc,0x01cd,0x01ce,
-    0x01cf,0x03cc,0x03cd,0x03ce,0x07da,0x0fe4,0x0030,0x0067,0x00db,0x01d0,0x01d1,0x01d2,
-    0x01d3,0x03cf,0x03d0,0x03d1,0x03d2,0x07db,0x0fe5,0x1fea,0x0068,0x0069,0x00dc,0x01d4,
-    0x01d5,0x01d6,0x03d3,0x03d4,0x03d5,0x03d6,0x07dc,0x07dd,0x0fe6,0x1feb,0x00dd,0x00de,
-    0x01d7,0x01d8,0x01d9,0x03d7,0x03d8,0x03d9,0x03da,0x07de,0x07df,0x0fe7,0x1fec,0x3ff2,
-    0x00df,0x00e0,0x01da,0x01db,0x03db,0x03dc,0x07e0,0x07e1,0x07e2,0x0fe8,0x0fe9,0x1fed,
-    0x1fee,0x7ff4,0x00e1,0x00e2,0x01dc,0x01dd,0x03dd,0x03de,0x07e3,0x07e4,0x07e5,0x0fea,
-    0x0feb,0x1fef,0x3ff3,0x7ff5,0x01de,0x01df,0x01e0,0x03df,0x03e0,0x03e1,0x07e6,0x07e7,
-    0x0fec,0x1ff0,0x0fed,0x3ff4,0x7ff6,0xfff8,0x01e1,0x01e2,0x03e2,0x03e3,0x03e4,0x03e5,
-    0x07e8,0x0fee,0x0fef,0x3ff5,0x3ff6,0xfff9,0xfffa,0xfffa,0x01e3,0x01e4,0x03e6,0x03e7,
-    0x07e9,0x07ea,0x0ff0,0x1ff1,0x1ff2,0x3ff7,0x3ff8,0x7ff7,0x7ff7,0xfffa,0x03e8,0x03e9,
-    0x03ea,0x07eb,0x07ec,0x0ff1,0x0ff2,0x1ff3,0x7ff8,0x7ff9,0xfffb,0x3ff8,0x7ff7,0x7ff7,
-    0x07ed,0x07ee,0x07ef,0x0ff3,0x1ff4,0x1ff5,0x1ff6,0x7ffa,0xfffc,0xfffd,0xfffb,0xfffb,
-    0x3ff8,0x7ff7,0x07f0,0x07f1,0x0ff4,0x1ff7,0x1ff8,0x3ff9,0x7ffb,0xfffe,0xffff,
-};
-
-
-static const uint8_t cvh_huffbits1[97] = {
-    1, 4, 5, 6, 7, 8, 8, 9, 10, 10, 4, 5,
-    6, 7, 7, 8, 8, 9, 9, 11, 5, 5, 6, 7,
-    8, 8, 9, 9, 10, 11, 6, 6, 7, 8, 8, 9,
-    9, 10, 11, 12, 7, 7, 8, 8, 9, 9, 10, 11,
-    11, 13, 8, 8, 8, 9, 9, 10, 10, 11, 12, 14,
-    8, 8, 8, 9, 10, 11, 11, 12, 13, 15, 9, 9,
-    9, 10, 11, 12, 12, 14, 14, 0, 9, 9, 9, 10,
-    11, 12, 14, 16, 0, 0, 10, 10, 11, 12, 13, 14,
-    16,
-};
-
-
-static const uint16_t cvh_huffcodes1[97] = {
-    0x0000,0x0008,0x0014,0x0030,0x006a,0x00e2,0x00e3,0x01e4,0x03ec,0x03ed,0x0009,0x0015,
-    0x0031,0x006b,0x006c,0x00e4,0x00e5,0x01e5,0x01e6,0x07f0,0x0016,0x0017,0x0032,0x006d,
-    0x00e6,0x00e7,0x01e7,0x01e8,0x03ee,0x07f1,0x0033,0x0034,0x006e,0x00e8,0x00e9,0x01e9,
-    0x01ea,0x03ef,0x07f2,0x0ff6,0x006f,0x0070,0x00ea,0x00eb,0x01eb,0x01ec,0x03f0,0x07f3,
-    0x07f4,0x1ffa,0x00ec,0x00ed,0x00ee,0x01ed,0x01ee,0x03f1,0x03f2,0x07f5,0x0ff7,0x3ffa,
-    0x00ef,0x00f0,0x00f1,0x01ef,0x03f3,0x07f6,0x07f7,0x0ff8,0x1ffb,0x7ffe,0x01f0,0x01f1,
-    0x01f2,0x03f4,0x07f8,0x0ff9,0x0ffa,0x3ffb,0x3ffc,0x0000,0x01f3,0x01f4,0x01f5,0x03f5,
-    0x07f9,0x0ffb,0x3ffd,0xfffe,0x0000,0x0000,0x03f6,0x03f7,0x07fa,0x0ffc,0x1ffc,0x3ffe,
-    0xffff,
-};
-
-static const uint8_t cvh_huffbits2[48] = {
-    1, 4, 5, 7, 8, 9, 10, 3, 4, 5, 7, 8,
-    9, 10, 5, 5, 6, 7, 8, 10, 10, 7, 6, 7,
-    8, 9, 10, 12, 8, 8, 8, 9, 10, 12, 14, 8,
-    9, 9, 10, 11, 15, 16, 9, 10, 11, 12, 13, 16,
-};
-
-static const uint16_t cvh_huffcodes2[48] = {
-    0x0000,0x000a,0x0018,0x0074,0x00f2,0x01f4,0x03f6,0x0004,0x000b,0x0019,0x0075,0x00f3,
-    0x01f5,0x03f7,0x001a,0x001b,0x0038,0x0076,0x00f4,0x03f8,0x03f9,0x0077,0x0039,0x0078,
-    0x00f5,0x01f6,0x03fa,0x0ffc,0x00f6,0x00f7,0x00f8,0x01f7,0x03fb,0x0ffd,0x3ffe,0x00f9,
-    0x01f8,0x01f9,0x03fc,0x07fc,0x7ffe,0xfffe,0x01fa,0x03fd,0x07fd,0x0ffe,0x1ffe,0xffff,
-};
-
-static const uint8_t cvh_huffbits3[607] = {
-    2, 4, 6, 8, 10, 5, 5, 6, 8, 10, 7, 8,
-    8, 10, 12, 9, 9, 10, 12, 15, 10, 11, 13, 16,
-    16, 5, 6, 8, 10, 11, 5, 6, 8, 10, 12, 7,
-    7, 8, 10, 13, 9, 9, 10, 12, 15, 12, 11, 13,
-    16, 16, 7, 9, 10, 12, 15, 7, 8, 10, 12, 13,
-    9, 9, 11, 13, 16, 11, 11, 12, 14, 16, 12, 12,
-    14, 16, 0, 9, 11, 12, 16, 16, 9, 10, 13, 15,
-    16, 10, 11, 12, 16, 16, 13, 13, 16, 16, 16, 16,
-    16, 15, 16, 0, 11, 13, 16, 16, 15, 11, 13, 15,
-    16, 16, 13, 13, 16, 16, 0, 14, 16, 16, 16, 0,
-    16, 16, 0, 0, 0, 4, 6, 8, 10, 13, 6, 6,
-    8, 10, 13, 9, 8, 10, 12, 16, 10, 10, 11, 15,
-    16, 13, 12, 14, 16, 16, 5, 6, 8, 11, 13, 6,
-    6, 8, 10, 13, 8, 8, 9, 11, 14, 10, 10, 12,
-    12, 16, 13, 12, 13, 15, 16, 7, 8, 9, 12, 16,
-    7, 8, 10, 12, 14, 9, 9, 10, 13, 16, 11, 10,
-    12, 15, 16, 13, 13, 16, 16, 0, 9, 11, 13, 16,
-    16, 9, 10, 12, 15, 16, 10, 11, 13, 16, 16, 13,
-    12, 16, 16, 16, 16, 16, 16, 16, 0, 11, 13, 16,
-    16, 16, 11, 13, 16, 16, 16, 12, 13, 15, 16, 0,
-    16, 16, 16, 16, 0, 16, 16, 0, 0, 0, 6, 8,
-    11, 13, 16, 8, 8, 10, 12, 16, 11, 10, 11, 13,
-    16, 12, 13, 13, 15, 16, 16, 16, 14, 16, 0, 6,
-    8, 10, 13, 16, 8, 8, 10, 12, 16, 10, 10, 11,
-    13, 16, 13, 12, 13, 16, 16, 14, 14, 14, 16, 0,
-    8, 9, 11, 13, 16, 8, 9, 11, 16, 14, 10, 10,
-    12, 15, 16, 12, 12, 13, 16, 16, 15, 16, 16, 16,
-    0, 10, 12, 15, 16, 16, 10, 12, 12, 14, 16, 12,
-    12, 13, 16, 16, 14, 15, 16, 16, 0, 16, 16, 16,
-    0, 0, 12, 15, 15, 16, 0, 13, 13, 16, 16, 0,
-    14, 16, 16, 16, 0, 16, 16, 16, 0, 0, 0, 0,
-    0, 0, 0, 8, 10, 13, 15, 16, 10, 11, 13, 16,
-    16, 13, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 0, 8, 10, 11, 15, 16, 9, 10, 12,
-    16, 16, 12, 12, 15, 16, 16, 16, 14, 16, 16, 16,
-    16, 16, 16, 16, 0, 9, 11, 14, 16, 16, 10, 11,
-    13, 16, 16, 14, 13, 14, 16, 16, 16, 15, 15, 16,
-    0, 16, 16, 16, 0, 0, 11, 13, 16, 16, 16, 11,
-    13, 15, 16, 16, 13, 16, 16, 16, 0, 16, 16, 16,
-    16, 0, 16, 16, 0, 0, 0, 15, 16, 16, 16, 0,
-    14, 16, 16, 16, 0, 16, 16, 16, 0, 0, 16, 16,
-    0, 0, 0, 0, 0, 0, 0, 0, 9, 13, 16, 16,
-    16, 11, 13, 16, 16, 16, 14, 15, 16, 16, 0, 15,
-    16, 16, 16, 0, 16, 16, 0, 0, 0, 9, 13, 15,
-    15, 16, 12, 13, 14, 16, 16, 16, 15, 16, 16, 0,
-    16, 16, 16, 16, 0, 16, 16, 0, 0, 0, 11, 13,
-    15, 16, 0, 12, 14, 16, 16, 0, 16, 16, 16, 16,
-    0, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 16,
-    16, 16, 16, 0, 16, 16, 16, 16, 0, 16, 16, 16,
-    0, 0, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0,
-    16, 16, 0, 0, 0, 16, 16,
-};
-
-
-static const uint16_t cvh_huffcodes3[607] = {
-    0x0000,0x0004,0x0022,0x00c6,0x03b0,0x000c,0x000d,0x0023,0x00c7,0x03b1,0x005c,0x00c8,
-    0x00c9,0x03b2,0x0fa4,0x01c2,0x01c3,0x03b3,0x0fa5,0x7f72,0x03b4,0x07b2,0x1f9a,0xff24,
-    0xff25,0x000e,0x0024,0x00ca,0x03b5,0x07b3,0x000f,0x0025,0x00cb,0x03b6,0x0fa6,0x005d,
-    0x005e,0x00cc,0x03b7,0x1f9b,0x01c4,0x01c5,0x03b8,0x0fa7,0x7f73,0x0fa8,0x07b4,0x1f9c,
-    0xff26,0xff27,0x005f,0x01c6,0x03b9,0x0fa9,0x7f74,0x0060,0x00cd,0x03ba,0x0faa,0x1f9d,
-    0x01c7,0x01c8,0x07b5,0x1f9e,0xff28,0x07b6,0x07b7,0x0fab,0x3fa2,0xff29,0x0fac,0x0fad,
-    0x3fa3,0xff2a,0x3fa2,0x01c9,0x07b8,0x0fae,0xff2b,0xff2c,0x01ca,0x03bb,0x1f9f,0x7f75,
-    0xff2d,0x03bc,0x07b9,0x0faf,0xff2e,0xff2f,0x1fa0,0x1fa1,0xff30,0xff31,0xff32,0xff33,
-    0xff34,0x7f76,0xff35,0xff31,0x07ba,0x1fa2,0xff36,0xff37,0x7f77,0x07bb,0x1fa3,0x7f78,
-    0xff38,0xff39,0x1fa4,0x1fa5,0xff3a,0xff3b,0xff2e,0x3fa4,0xff3c,0xff3d,0xff3e,0xff31,
-    0xff3f,0xff40,0xff30,0xff31,0xff31,0x0005,0x0026,0x00ce,0x03bd,0x1fa6,0x0027,0x0028,
-    0x00cf,0x03be,0x1fa7,0x01cb,0x00d0,0x03bf,0x0fb0,0xff41,0x03c0,0x03c1,0x07bc,0x7f79,
-    0xff42,0x1fa8,0x0fb1,0x3fa5,0xff43,0xff44,0x0010,0x0029,0x00d1,0x07bd,0x1fa9,0x002a,
-    0x002b,0x00d2,0x03c2,0x1faa,0x00d3,0x00d4,0x01cc,0x07be,0x3fa6,0x03c3,0x03c4,0x0fb2,
-    0x0fb3,0xff45,0x1fab,0x0fb4,0x1fac,0x7f7a,0xff46,0x0061,0x00d5,0x01cd,0x0fb5,0xff47,
-    0x0062,0x00d6,0x03c5,0x0fb6,0x3fa7,0x01ce,0x01cf,0x03c6,0x1fad,0xff48,0x07bf,0x03c7,
-    0x0fb7,0x7f7b,0xff49,0x1fae,0x1faf,0xff4a,0xff4b,0x7f7b,0x01d0,0x07c0,0x1fb0,0xff4c,
-    0xff4d,0x01d1,0x03c8,0x0fb8,0x7f7c,0xff4e,0x03c9,0x07c1,0x1fb1,0xff4f,0xff50,0x1fb2,
-    0x0fb9,0xff51,0xff52,0xff53,0xff54,0xff55,0xff56,0xff57,0xff52,0x07c2,0x1fb3,0xff58,
-    0xff59,0xff5a,0x07c3,0x1fb4,0xff5b,0xff5c,0xff5d,0x0fba,0x1fb5,0x7f7d,0xff5e,0xff4f,
-    0xff5f,0xff60,0xff61,0xff62,0xff52,0xff63,0xff64,0xff51,0xff52,0xff52,0x002c,0x00d7,
-    0x07c4,0x1fb6,0xff65,0x00d8,0x00d9,0x03ca,0x0fbb,0xff66,0x07c5,0x03cb,0x07c6,0x1fb7,
-    0xff67,0x0fbc,0x1fb8,0x1fb9,0x7f7e,0xff68,0xff69,0xff6a,0x3fa8,0xff6b,0x7f7e,0x002d,
-    0x00da,0x03cc,0x1fba,0xff6c,0x00db,0x00dc,0x03cd,0x0fbd,0xff6d,0x03ce,0x03cf,0x07c7,
-    0x1fbb,0xff6e,0x1fbc,0x0fbe,0x1fbd,0xff6f,0xff70,0x3fa9,0x3faa,0x3fab,0xff71,0xff6f,
-    0x00dd,0x01d2,0x07c8,0x1fbe,0xff72,0x00de,0x01d3,0x07c9,0xff73,0x3fac,0x03d0,0x03d1,
-    0x0fbf,0x7f7f,0xff74,0x0fc0,0x0fc1,0x1fbf,0xff75,0xff76,0x7f80,0xff77,0xff78,0xff79,
-    0xff75,0x03d2,0x0fc2,0x7f81,0xff7a,0xff7b,0x03d3,0x0fc3,0x0fc4,0x3fad,0xff7c,0x0fc5,
-    0x0fc6,0x1fc0,0xff7d,0xff7e,0x3fae,0x7f82,0xff7f,0xff80,0xff80,0xff81,0xff82,0xff83,
-    0xff80,0xff80,0x0fc7,0x7f83,0x7f84,0xff84,0xff7a,0x1fc1,0x1fc2,0xff85,0xff86,0x3fad,
-    0x3faf,0xff87,0xff88,0xff89,0xff7d,0xff8a,0xff8b,0xff8c,0xff80,0xff80,0x3fae,0x7f82,
-    0xff7f,0xff80,0xff80,0x00df,0x03d4,0x1fc3,0x7f85,0xff8d,0x03d5,0x07ca,0x1fc4,0xff8e,
-    0xff8f,0x1fc5,0x1fc6,0x3fb0,0xff90,0xff91,0xff92,0xff93,0xff94,0xff95,0xff96,0xff97,
-    0xff98,0xff99,0xff9a,0xff95,0x00e0,0x03d6,0x07cb,0x7f86,0xff9b,0x01d4,0x03d7,0x0fc8,
-    0xff9c,0xff9d,0x0fc9,0x0fca,0x7f87,0xff9e,0xff9f,0xffa0,0x3fb1,0xffa1,0xffa2,0xffa3,
-    0xffa4,0xffa5,0xffa6,0xffa7,0xffa2,0x01d5,0x07cc,0x3fb2,0xffa8,0xffa9,0x03d8,0x07cd,
-    0x1fc7,0xffaa,0xffab,0x3fb3,0x1fc8,0x3fb4,0xffac,0xffad,0xffae,0x7f88,0x7f89,0xffaf,
-    0xffaf,0xffb0,0xffb1,0xffb2,0xffaf,0xffaf,0x07ce,0x1fc9,0xffb3,0xffb4,0xffb5,0x07cf,
-    0x1fca,0x7f8a,0xffb6,0xffb7,0x1fcb,0xffb8,0xffb9,0xffba,0xffba,0xffbb,0xffbc,0xffbd,
-    0xffbe,0xffbe,0xffbf,0xffc0,0xffbd,0xffbe,0xffbe,0x7f8b,0xffc1,0xffc2,0xffc3,0xffb4,
-    0x3fb5,0xffc4,0xffc5,0xffc6,0xffb6,0xffc7,0xffc8,0xffc9,0xffba,0xffba,0xffca,0xffcb,
-    0xffbd,0xffbe,0xffbe,0xffbb,0xffbc,0xffbd,0xffbe,0xffbe,0x01d6,0x1fcc,0xffcc,0xffcd,
-    0xffce,0x07d0,0x1fcd,0xffcf,0xffd0,0xffd1,0x3fb6,0x7f8c,0xffd2,0xffd3,0xff90,0x7f8d,
-    0xffd4,0xffd5,0xffd6,0xff95,0xffd7,0xffd8,0xff94,0xff95,0xff95,0x01d7,0x1fce,0x7f8e,
-    0x7f8f,0xffd9,0x0fcb,0x1fcf,0x3fb7,0xffda,0xffdb,0xffdc,0x7f90,0xffdd,0xffde,0xff9e,
-    0xffdf,0xffe0,0xffe1,0xffe2,0xffa2,0xffe3,0xffe4,0xffa1,0xffa2,0xffa2,0x07d1,0x1fd0,
-    0x7f91,0xffe5,0xffa8,0x0fcc,0x3fb8,0xffe6,0xffe7,0xffaa,0xffe8,0xffe9,0xffea,0xffeb,
-    0xffac,0xffec,0xffed,0xffee,0xffaf,0xffaf,0xffae,0x7f88,0x7f89,0xffaf,0xffaf,0xffef,
-    0xfff0,0xfff1,0xfff2,0xffb4,0xfff3,0xfff4,0xfff5,0xfff6,0xffb6,0xfff7,0xfff8,0xfff9,
-    0xffba,0xffba,0xfffa,0xfffb,0xffbd,0xffbe,0xffbe,0xffbb,0xffbc,0xffbd,0xffbe,0xffbe,
-    0xfffc,0xfffd,0xffb3,0xffb4,0xffb4,0xfffe,0xffff,
-};
-
-static const uint8_t cvh_huffbits4[246] = {
-    2, 4, 7, 10, 4, 5, 7, 10, 7, 8, 10, 14,
-    11, 11, 15, 15, 4, 5, 9, 12, 5, 5, 8, 12,
-    8, 7, 10, 15, 11, 11, 15, 15, 7, 9, 12, 15,
-    8, 8, 12, 15, 10, 10, 13, 15, 14, 14, 15, 0,
-    11, 13, 15, 15, 11, 13, 15, 15, 14, 15, 15, 0,
-    15, 15, 0, 0, 4, 5, 9, 13, 5, 6, 9, 13,
-    9, 9, 11, 15, 14, 13, 15, 15, 4, 6, 9, 12,
-    5, 6, 9, 13, 9, 8, 11, 15, 13, 12, 15, 15,
-    7, 9, 12, 15, 7, 8, 11, 15, 10, 10, 14, 15,
-    14, 15, 15, 0, 10, 12, 15, 15, 11, 13, 15, 15,
-    15, 15, 15, 0, 15, 15, 0, 0, 6, 9, 13, 14,
-    8, 9, 12, 15, 12, 12, 15, 15, 15, 15, 15, 0,
-    7, 9, 13, 15, 8, 9, 12, 15, 11, 12, 15, 15,
-    15, 15, 15, 0, 9, 11, 15, 15, 9, 11, 15, 15,
-    14, 14, 15, 0, 15, 15, 0, 0, 14, 15, 15, 0,
-    14, 15, 15, 0, 15, 15, 0, 0, 0, 0, 0, 0,
-    9, 12, 15, 15, 12, 13, 15, 15, 15, 15, 15, 0,
-    15, 15, 0, 0, 10, 12, 15, 15, 12, 14, 15, 15,
-    15, 15, 15, 0, 15, 15, 0, 0, 14, 15, 15, 0,
-    15, 15, 15, 0, 15, 15, 0, 0, 0, 0, 0, 0,
-    15, 15, 0, 0, 15, 15,
-};
-
-
-static const uint16_t cvh_huffcodes4[246] = {
-    0x0000,0x0004,0x006c,0x03e6,0x0005,0x0012,0x006d,0x03e7,0x006e,0x00e8,0x03e8,0x3fc4,
-    0x07e0,0x07e1,0x7fa4,0x7fa5,0x0006,0x0013,0x01e2,0x0fda,0x0014,0x0015,0x00e9,0x0fdb,
-    0x00ea,0x006f,0x03e9,0x7fa6,0x07e2,0x07e3,0x7fa7,0x7fa8,0x0070,0x01e3,0x0fdc,0x7fa9,
-    0x00eb,0x00ec,0x0fdd,0x7faa,0x03ea,0x03eb,0x1fd6,0x7fab,0x3fc5,0x3fc6,0x7fac,0x1fd6,
-    0x07e4,0x1fd7,0x7fad,0x7fae,0x07e5,0x1fd8,0x7faf,0x7fb0,0x3fc7,0x7fb1,0x7fb2,0x1fd6,
-    0x7fb3,0x7fb4,0x1fd6,0x1fd6,0x0007,0x0016,0x01e4,0x1fd9,0x0017,0x0032,0x01e5,0x1fda,
-    0x01e6,0x01e7,0x07e6,0x7fb5,0x3fc8,0x1fdb,0x7fb6,0x7fb7,0x0008,0x0033,0x01e8,0x0fde,
-    0x0018,0x0034,0x01e9,0x1fdc,0x01ea,0x00ed,0x07e7,0x7fb8,0x1fdd,0x0fdf,0x7fb9,0x7fba,
-    0x0071,0x01eb,0x0fe0,0x7fbb,0x0072,0x00ee,0x07e8,0x7fbc,0x03ec,0x03ed,0x3fc9,0x7fbd,
-    0x3fca,0x7fbe,0x7fbf,0x3fc9,0x03ee,0x0fe1,0x7fc0,0x7fc1,0x07e9,0x1fde,0x7fc2,0x7fc3,
-    0x7fc4,0x7fc5,0x7fc6,0x3fc9,0x7fc7,0x7fc8,0x3fc9,0x3fc9,0x0035,0x01ec,0x1fdf,0x3fcb,
-    0x00ef,0x01ed,0x0fe2,0x7fc9,0x0fe3,0x0fe4,0x7fca,0x7fcb,0x7fcc,0x7fcd,0x7fce,0x7fca,
-    0x0073,0x01ee,0x1fe0,0x7fcf,0x00f0,0x01ef,0x0fe5,0x7fd0,0x07ea,0x0fe6,0x7fd1,0x7fd2,
-    0x7fd3,0x7fd4,0x7fd5,0x7fd1,0x01f0,0x07eb,0x7fd6,0x7fd7,0x01f1,0x07ec,0x7fd8,0x7fd9,
-    0x3fcc,0x3fcd,0x7fda,0x7fda,0x7fdb,0x7fdc,0x7fda,0x7fda,0x3fce,0x7fdd,0x7fde,0x7fd6,
-    0x3fcf,0x7fdf,0x7fe0,0x7fd8,0x7fe1,0x7fe2,0x7fda,0x7fda,0x3fcc,0x3fcd,0x7fda,0x7fda,
-    0x01f2,0x0fe7,0x7fe3,0x7fe4,0x0fe8,0x1fe1,0x7fe5,0x7fe6,0x7fe7,0x7fe8,0x7fe9,0x7fca,
-    0x7fea,0x7feb,0x7fca,0x7fca,0x03ef,0x0fe9,0x7fec,0x7fed,0x0fea,0x3fd0,0x7fee,0x7fef,
-    0x7ff0,0x7ff1,0x7ff2,0x7fd1,0x7ff3,0x7ff4,0x7fd1,0x7fd1,0x3fd1,0x7ff5,0x7ff6,0x7fd6,
-    0x7ff7,0x7ff8,0x7ff9,0x7fd8,0x7ffa,0x7ffb,0x7fda,0x7fda,0x3fcc,0x3fcd,0x7fda,0x7fda,
-    0x7ffc,0x7ffd,0x7fd6,0x7fd6,0x7ffe,0x7fff,
-};
-
-
-static const uint8_t cvh_huffbits5[230] = {
-    2, 4, 8, 4, 5, 9, 9, 10, 14, 4, 6, 11,
-    5, 6, 12, 10, 11, 15, 9, 11, 15, 10, 13, 15,
-    14, 15, 0, 4, 6, 12, 6, 7, 12, 12, 12, 15,
-    5, 7, 13, 6, 7, 13, 12, 13, 15, 10, 12, 15,
-    11, 13, 15, 15, 15, 0, 8, 13, 15, 11, 12, 15,
-    15, 15, 0, 10, 13, 15, 12, 15, 15, 15, 15, 0,
-    15, 15, 0, 15, 15, 0, 0, 0, 0, 4, 5, 11,
-    5, 7, 12, 11, 12, 15, 6, 7, 13, 7, 8, 14,
-    12, 14, 15, 11, 13, 15, 12, 13, 15, 15, 15, 0,
-    5, 6, 13, 7, 8, 15, 12, 14, 15, 6, 8, 14,
-    7, 8, 15, 14, 15, 15, 12, 12, 15, 12, 13, 15,
-    15, 15, 0, 9, 13, 15, 12, 13, 15, 15, 15, 0,
-    11, 13, 15, 13, 13, 15, 15, 15, 0, 14, 15, 0,
-    15, 15, 0, 0, 0, 0, 8, 10, 15, 11, 12, 15,
-    15, 15, 0, 10, 12, 15, 12, 13, 15, 15, 15, 0,
-    14, 15, 0, 15, 15, 0, 0, 0, 0, 8, 12, 15,
-    12, 13, 15, 15, 15, 0, 11, 13, 15, 13, 15, 15,
-    15, 15, 0, 15, 15, 0, 15, 15, 0, 0, 0, 0,
-    14, 15, 0, 15, 15, 0, 0, 0, 0, 15, 15, 0,
-    15, 15,
-};
-
-
-
-static const uint16_t cvh_huffcodes5[230] = {
-    0x0000,0x0004,0x00f0,0x0005,0x0012,0x01f0,0x01f1,0x03e8,0x3fce,0x0006,0x0030,0x07de,
-    0x0013,0x0031,0x0fd2,0x03e9,0x07df,0x7fb0,0x01f2,0x07e0,0x7fb1,0x03ea,0x1fd2,0x7fb2,
-    0x3fcf,0x7fb3,0x0031,0x0007,0x0032,0x0fd3,0x0033,0x0070,0x0fd4,0x0fd5,0x0fd6,0x7fb4,
-    0x0014,0x0071,0x1fd3,0x0034,0x0072,0x1fd4,0x0fd7,0x1fd5,0x7fb5,0x03eb,0x0fd8,0x7fb6,
-    0x07e1,0x1fd6,0x7fb7,0x7fb8,0x7fb9,0x0072,0x00f1,0x1fd7,0x7fba,0x07e2,0x0fd9,0x7fbb,
-    0x7fbc,0x7fbd,0x0070,0x03ec,0x1fd8,0x7fbe,0x0fda,0x7fbf,0x7fc0,0x7fc1,0x7fc2,0x0072,
-    0x7fc3,0x7fc4,0x0071,0x7fc5,0x7fc6,0x0072,0x0034,0x0072,0x0072,0x0008,0x0015,0x07e3,
-    0x0016,0x0073,0x0fdb,0x07e4,0x0fdc,0x7fc7,0x0035,0x0074,0x1fd9,0x0075,0x00f2,0x3fd0,
-    0x0fdd,0x3fd1,0x7fc8,0x07e5,0x1fda,0x7fc9,0x0fde,0x1fdb,0x7fca,0x7fcb,0x7fcc,0x00f2,
-    0x0017,0x0036,0x1fdc,0x0076,0x00f3,0x7fcd,0x0fdf,0x3fd2,0x7fce,0x0037,0x00f4,0x3fd3,
-    0x0077,0x00f5,0x7fcf,0x3fd4,0x7fd0,0x7fd1,0x0fe0,0x0fe1,0x7fd2,0x0fe2,0x1fdd,0x7fd3,
-    0x7fd4,0x7fd5,0x00f5,0x01f3,0x1fde,0x7fd6,0x0fe3,0x1fdf,0x7fd7,0x7fd8,0x7fd9,0x00f3,
-    0x07e6,0x1fe0,0x7fda,0x1fe1,0x1fe2,0x7fdb,0x7fdc,0x7fdd,0x00f5,0x3fd5,0x7fde,0x00f4,
-    0x7fdf,0x7fe0,0x00f5,0x0077,0x00f5,0x00f5,0x00f6,0x03ed,0x7fe1,0x07e7,0x0fe4,0x7fe2,
-    0x7fe3,0x7fe4,0x0073,0x03ee,0x0fe5,0x7fe5,0x0fe6,0x1fe3,0x7fe6,0x7fe7,0x7fe8,0x00f2,
-    0x3fd6,0x7fe9,0x0074,0x7fea,0x7feb,0x00f2,0x0075,0x00f2,0x00f2,0x00f7,0x0fe7,0x7fec,
-    0x0fe8,0x1fe4,0x7fed,0x7fee,0x7fef,0x00f3,0x07e8,0x1fe5,0x7ff0,0x1fe6,0x7ff1,0x7ff2,
-    0x7ff3,0x7ff4,0x00f5,0x7ff5,0x7ff6,0x00f4,0x7ff7,0x7ff8,0x00f5,0x0077,0x00f5,0x00f5,
-    0x3fd7,0x7ff9,0x0036,0x7ffa,0x7ffb,0x00f3,0x0076,0x00f3,0x00f3,0x7ffc,0x7ffd,0x0000,
-    0x7ffe,0x7fff,
-};
-
-
-static const uint8_t cvh_huffbits6[32] = {
-     1,  4,  4,  6,  4,  6,  6,  8,  4,  6,  6,  8,
-     6,  9,  8, 10,  4,  6,  7,  8,  6,  9,  8, 11,
-     6,  9,  8, 10,  8, 10,  9,  11,
-};
-
-static const uint16_t cvh_huffcodes6[32] = {
-    0x0000,0x0008,0x0009,0x0034,0x000a,0x0035,0x0036,0x00f6,0x000b,0x0037,0x0038,0x00f7,
-    0x0039,0x01fa,0x00f8,0x03fc,0x000c,0x003a,0x007a,0x00f9,0x003b,0x01fb,0x00fa,0x07fe,
-    0x003c,0x01fc,0x00fb,0x03fd,0x00fc,0x03fe,0x01fd,0x07ff,
-};
-
-static const uint16_t* const cvh_huffcodes[7] = {
-    cvh_huffcodes0, cvh_huffcodes1, cvh_huffcodes2, cvh_huffcodes3,
-    cvh_huffcodes4, cvh_huffcodes5, cvh_huffcodes6,
-};
-
-static const uint8_t* const cvh_huffbits[7] = {
-    cvh_huffbits0, cvh_huffbits1, cvh_huffbits2, cvh_huffbits3,
-    cvh_huffbits4, cvh_huffbits5, cvh_huffbits6,
-};
-
-
-static const uint16_t ccpl_huffcodes2[3] = {
-    0x02,0x00,0x03,
-};
-
-static const uint16_t ccpl_huffcodes3[7] = {
-    0x3e,0x1e,0x02,0x00,0x06,0x0e,0x3f,
-};
-
-static const uint16_t ccpl_huffcodes4[15] = {
-    0xfc,0xfd,0x7c,0x3c,0x1c,0x0c,0x04,0x00,0x05,0x0d,0x1d,0x3d,
-    0x7d,0xfe,0xff,
-};
-
-static const uint16_t ccpl_huffcodes5[31] = {
-    0x03f8,0x03f9,0x03fa,0x03fb,0x01f8,0x01f9,0x00f8,0x00f9,0x0078,0x0079,0x0038,0x0039,
-    0x0018,0x0019,0x0004,0x0000,0x0005,0x001a,0x001b,0x003a,0x003b,0x007a,0x007b,0x00fa,
-    0x00fb,0x01fa,0x01fb,0x03fc,0x03fd,0x03fe,0x03ff,
-};
-
-static const uint16_t ccpl_huffcodes6[63] = {
-    0x0004,0x0005,0x0005,0x0006,0x0006,0x0007,0x0007,0x0007,0x0007,0x0008,0x0008,0x0008,
-    0x0008,0x0009,0x0009,0x0009,0x0009,0x000a,0x000a,0x000a,0x000a,0x000a,0x000b,0x000b,
-    0x000b,0x000b,0x000c,0x000d,0x000e,0x000e,0x0010,0x0000,0x000a,0x0018,0x0019,0x0036,
-    0x0037,0x0074,0x0075,0x0076,0x0077,0x00f4,0x00f5,0x00f6,0x00f7,0x01f5,0x01f6,0x01f7,
-    0x01f8,0x03f6,0x03f7,0x03f8,0x03f9,0x03fa,0x07fa,0x07fb,0x07fc,0x07fd,0x0ffd,0x1ffd,
-    0x3ffd,0x3ffe,0xffff,
-};
-
-static const uint8_t ccpl_huffbits2[3] = {
-    2,1,2,
-};
-
-static const uint8_t ccpl_huffbits3[7] = {
-    6,5,2,1,3,4,6,
-};
-
-static const uint8_t ccpl_huffbits4[15] = {
-    8,8,7,6,5,4,3,1,3,4,5,6,7,8,8,
-};
-
-static const uint8_t ccpl_huffbits5[31] = {
-    10,10,10,10,9,9,8,8,7,7,6,6,
-    5,5,3,1,3,5,5,6,6,7,7,8,
-    8,9,9,10,10,10,10,
-};
-
-static const uint8_t ccpl_huffbits6[63] = {
-    16,15,14,13,12,11,11,11,11,10,10,10,
-    10,9,9,9,9,9,8,8,8,8,7,7,
-    7,7,6,6,5,5,3,1,4,5,5,6,
-    6,7,7,7,7,8,8,8,8,9,9,9,
-    9,10,10,10,10,10,11,11,11,11,12,13,
-    14,14,16,
-};
-
-static const uint16_t* const ccpl_huffcodes[5] = {
-    ccpl_huffcodes2,ccpl_huffcodes3,
-    ccpl_huffcodes4,ccpl_huffcodes5,ccpl_huffcodes6
-};
-
-static const uint8_t* const ccpl_huffbits[5] = {
-    ccpl_huffbits2,ccpl_huffbits3,
-    ccpl_huffbits4,ccpl_huffbits5,ccpl_huffbits6
-};
-
-
-//Coupling tables
-
-static const int cplband[51] = {
-    0,1,2,3,4,5,6,7,8,9,
-    10,11,11,12,12,13,13,14,14,14,
-    15,15,15,15,16,16,16,16,16,17,
-    17,17,17,17,17,18,18,18,18,18,
-    18,18,19,19,19,19,19,19,19,19,
-    19,
-};
-
-static const float cplscale2[3] = {
-0.953020632266998,0.70710676908493,0.302905440330505,
-};
-
-static const float cplscale3[7] = {
-0.981279790401459,0.936997592449188,0.875934481620789,0.70710676908493,
-0.482430040836334,0.349335819482803,0.192587479948997,
-};
-
-static const float cplscale4[15] = {
-0.991486728191376,0.973249018192291,0.953020632266998,0.930133521556854,
-0.903453230857849,0.870746195316315,0.826180458068848,0.70710676908493,
-0.563405573368073,0.491732746362686,0.428686618804932,0.367221474647522,
-0.302905440330505,0.229752898216248,0.130207896232605,
-};
-
-static const float cplscale5[31] = {
-0.995926380157471,0.987517595291138,0.978726446628571,0.969505727291107,
-0.95979779958725,0.949531257152557,0.938616216182709,0.926936149597168,
-0.914336204528809,0.900602877140045,0.885426938533783,0.868331849575043,
-0.84851086139679,0.824381768703461,0.791833400726318,0.70710676908493,
-0.610737144947052,0.566034197807312,0.529177963733673,0.495983630418777,
-0.464778542518616,0.434642940759659,0.404955863952637,0.375219136476517,
-0.344963222742081,0.313672333955765,0.280692428350449,0.245068684220314,
-0.205169528722763,0.157508864998817,0.0901700109243393,
-};
-
-static const float cplscale6[63] = {
-0.998005926609039,0.993956744670868,0.989822506904602,0.985598564147949,
-0.981279790401459,0.976860702037811,0.972335040569305,0.967696130275726,
-0.962936460971832,0.958047747612000,0.953020632266998,0.947844684123993,
-0.942508161067963,0.936997592449188,0.931297719478607,0.925390899181366,
-0.919256627559662,0.912870943546295,0.906205296516418,0.899225592613220,
-0.891890347003937,0.884148240089417,0.875934481620789,0.867165684700012,
-0.857730865478516,0.847477376461029,0.836184680461884,0.823513329029083,
-0.808890223503113,0.791194140911102,0.767520070075989,0.707106769084930,
-0.641024887561798,0.611565053462982,0.587959706783295,0.567296981811523,
-0.548448026180267,0.530831515789032,0.514098942279816,0.498019754886627,
-0.482430040836334,0.467206478118896,0.452251672744751,0.437485188245773,
-0.422837972640991,0.408248275518417,0.393658757209778,0.379014074802399,
-0.364258885383606,0.349335819482803,0.334183186292648,0.318732559680939,
-0.302905440330505,0.286608695983887,0.269728302955627,0.252119421958923,
-0.233590632677078,0.213876649737358,0.192587479948997,0.169101938605309,
-0.142307326197624,0.109772264957428,0.0631198287010193,
-};
-
-static const float* const cplscales[5] = {
-    cplscale2, cplscale3, cplscale4, cplscale5, cplscale6,
-};
-
-#endif /* AVCODEC_COOKDATA_H */
diff --git a/libavcodec/costablegen.c b/libavcodec/costablegen.c
deleted file mode 100644
index bfcd635..0000000
--- a/libavcodec/costablegen.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Generate a header file for hardcoded ff_cos_* tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#define BITS 16
-#define FLOATFMT "%.18e"
-
-int main(int argc, char *argv[])
-{
-    int i, j;
-    int do_sin = argc == 2 && !strcmp(argv[1], "sin");
-    double (*func)(double) = do_sin ? sin : cos;
-
-    printf("/* This file was generated by libavcodec/costablegen */\n");
-    printf("#include \"libavcodec/fft.h\"\n");
-    for (i = 4; i <= BITS; i++) {
-        int m = 1 << i;
-        double freq = 2*M_PI/m;
-        printf("%s(%i) = {\n   ", do_sin ? "SINTABLE" : "COSTABLE", m);
-        for (j = 0; j < m/2 - 1; j++) {
-            int idx = j > m/4 ? m/2 - j : j;
-            if (do_sin && j >= m/4)
-                idx = m/4 - j;
-            printf(" "FLOATFMT",", func(idx*freq));
-            if ((j & 3) == 3)
-                printf("\n   ");
-        }
-        printf(" "FLOATFMT"\n};\n", func(do_sin ? -(m/4 - 1)*freq : freq));
-    }
-    return 0;
-}
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
deleted file mode 100644
index e4f4b8f..0000000
--- a/libavcodec/cscd.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * CamStudio decoder
- * Copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-
-#if CONFIG_ZLIB
-#include <zlib.h>
-#endif
-#include "libavutil/lzo.h"
-
-typedef struct {
-    AVFrame pic;
-    int linelen, height, bpp;
-    unsigned int decomp_size;
-    unsigned char* decomp_buf;
-} CamStudioContext;
-
-static void copy_frame_default(AVFrame *f, const uint8_t *src,
-                               int linelen, int height) {
-    int i;
-    uint8_t *dst = f->data[0];
-    dst += (height - 1) * f->linesize[0];
-    for (i = height; i; i--) {
-        memcpy(dst, src, linelen);
-        src += linelen;
-        dst -= f->linesize[0];
-    }
-}
-
-static void add_frame_default(AVFrame *f, const uint8_t *src,
-                              int linelen, int height) {
-    int i, j;
-    uint8_t *dst = f->data[0];
-    dst += (height - 1) * f->linesize[0];
-    for (i = height; i; i--) {
-        for (j = linelen; j; j--)
-            *dst++ += *src++;
-        dst -= f->linesize[0] + linelen;
-    }
-}
-
-#if !HAVE_BIGENDIAN
-#define copy_frame_16 copy_frame_default
-#define copy_frame_32 copy_frame_default
-#define add_frame_16 add_frame_default
-#define add_frame_32 add_frame_default
-#else
-static void copy_frame_16(AVFrame *f, const uint8_t *src,
-                          int linelen, int height) {
-    int i, j;
-    uint8_t *dst = f->data[0];
-    dst += (height - 1) * f->linesize[0];
-    for (i = height; i; i--) {
-        for (j = linelen / 2; j; j--) {
-          dst[0] = src[1];
-          dst[1] = src[0];
-          src += 2;
-          dst += 2;
-        }
-        dst -= f->linesize[0] + linelen;
-    }
-}
-
-static void copy_frame_32(AVFrame *f, const uint8_t *src,
-                          int linelen, int height) {
-    int i, j;
-    uint8_t *dst = f->data[0];
-    dst += (height - 1) * f->linesize[0];
-    for (i = height; i; i--) {
-        for (j = linelen / 4; j; j--) {
-          dst[0] = src[3];
-          dst[1] = src[2];
-          dst[2] = src[1];
-          dst[3] = src[0];
-          src += 4;
-          dst += 4;
-        }
-        dst -= f->linesize[0] + linelen;
-    }
-}
-
-static void add_frame_16(AVFrame *f, const uint8_t *src,
-                         int linelen, int height) {
-    int i, j;
-    uint8_t *dst = f->data[0];
-    dst += (height - 1) * f->linesize[0];
-    for (i = height; i; i--) {
-        for (j = linelen / 2; j; j--) {
-          dst[0] += src[1];
-          dst[1] += src[0];
-          src += 2;
-          dst += 2;
-        }
-        dst -= f->linesize[0] + linelen;
-    }
-}
-
-static void add_frame_32(AVFrame *f, const uint8_t *src,
-                         int linelen, int height) {
-    int i, j;
-    uint8_t *dst = f->data[0];
-    dst += (height - 1) * f->linesize[0];
-    for (i = height; i; i--) {
-        for (j = linelen / 4; j; j--) {
-          dst[0] += src[3];
-          dst[1] += src[2];
-          dst[2] += src[1];
-          dst[3] += src[0];
-          src += 4;
-          dst += 4;
-        }
-        dst -= f->linesize[0] + linelen;
-    }
-}
-#endif
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CamStudioContext *c = avctx->priv_data;
-    AVFrame *picture = data;
-
-    if (buf_size < 2) {
-        av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
-        return -1;
-    }
-
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    c->pic.reference = 1;
-    c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
-                          FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->get_buffer(avctx, &c->pic) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    // decompress data
-    switch ((buf[0] >> 1) & 7) {
-        case 0: { // lzo compression
-            int outlen = c->decomp_size, inlen = buf_size - 2;
-            if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen))
-                av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
-            break;
-        }
-        case 1: { // zlib compression
-#if CONFIG_ZLIB
-            unsigned long dlen = c->decomp_size;
-            if (uncompress(c->decomp_buf, &dlen, &buf[2], buf_size - 2) != Z_OK)
-                av_log(avctx, AV_LOG_ERROR, "error during zlib decompression\n");
-            break;
-#else
-            av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
-            return -1;
-#endif
-        }
-        default:
-            av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
-            return -1;
-    }
-
-    // flip upside down, add difference frame
-    if (buf[0] & 1) { // keyframe
-        c->pic.pict_type = FF_I_TYPE;
-        c->pic.key_frame = 1;
-        switch (c->bpp) {
-          case 16:
-              copy_frame_16(&c->pic, c->decomp_buf, c->linelen, c->height);
-              break;
-          case 32:
-              copy_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height);
-              break;
-          default:
-              copy_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height);
-        }
-    } else {
-        c->pic.pict_type = FF_P_TYPE;
-        c->pic.key_frame = 0;
-        switch (c->bpp) {
-          case 16:
-              add_frame_16(&c->pic, c->decomp_buf, c->linelen, c->height);
-              break;
-          case 32:
-              add_frame_32(&c->pic, c->decomp_buf, c->linelen, c->height);
-              break;
-          default:
-              add_frame_default(&c->pic, c->decomp_buf, c->linelen, c->height);
-        }
-    }
-
-    *picture = c->pic;
-    *data_size = sizeof(AVFrame);
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx) {
-    CamStudioContext *c = avctx->priv_data;
-    switch (avctx->bits_per_coded_sample) {
-        case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
-        case 24: avctx->pix_fmt = PIX_FMT_BGR24; break;
-        case 32: avctx->pix_fmt = PIX_FMT_RGB32; break;
-        default:
-            av_log(avctx, AV_LOG_ERROR,
-                   "CamStudio codec error: invalid depth %i bpp\n",
-                   avctx->bits_per_coded_sample);
-             return 1;
-    }
-    c->bpp = avctx->bits_per_coded_sample;
-    c->pic.data[0] = NULL;
-    c->linelen = avctx->width * avctx->bits_per_coded_sample / 8;
-    c->height = avctx->height;
-    c->decomp_size = c->height * c->linelen;
-    c->decomp_buf = av_malloc(c->decomp_size + AV_LZO_OUTPUT_PADDING);
-    if (!c->decomp_buf) {
-        av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-        return 1;
-    }
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx) {
-    CamStudioContext *c = avctx->priv_data;
-    av_freep(&c->decomp_buf);
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    return 0;
-}
-
-AVCodec cscd_decoder = {
-    "camstudio",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CSCD,
-    sizeof(CamStudioContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("CamStudio"),
-};
-
diff --git a/libavcodec/cyuv.c b/libavcodec/cyuv.c
deleted file mode 100644
index db7e690..0000000
--- a/libavcodec/cyuv.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Creative YUV (CYUV) Video Decoder
- *   by Mike Melanson (melanson at pcisys.net)
- * based on "Creative YUV (CYUV) stream format for AVI":
- *   http://www.csse.monash.edu.au/~timf/videocodec/cyuv.txt
- *
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Creative YUV (CYUV) Video Decoder.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-
-typedef struct CyuvDecodeContext {
-    AVCodecContext *avctx;
-    int width, height;
-    AVFrame frame;
-} CyuvDecodeContext;
-
-static av_cold int cyuv_decode_init(AVCodecContext *avctx)
-{
-    CyuvDecodeContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->width = avctx->width;
-    /* width needs to be divisible by 4 for this codec to work */
-    if (s->width & 0x3)
-        return -1;
-    s->height = avctx->height;
-    avctx->pix_fmt = PIX_FMT_YUV411P;
-
-    return 0;
-}
-
-static int cyuv_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CyuvDecodeContext *s=avctx->priv_data;
-
-    unsigned char *y_plane;
-    unsigned char *u_plane;
-    unsigned char *v_plane;
-    int y_ptr;
-    int u_ptr;
-    int v_ptr;
-
-    /* prediction error tables (make it clear that they are signed values) */
-    const signed char *y_table = (const signed char*)buf +  0;
-    const signed char *u_table = (const signed char*)buf + 16;
-    const signed char *v_table = (const signed char*)buf + 32;
-
-    unsigned char y_pred, u_pred, v_pred;
-    int stream_ptr;
-    unsigned char cur_byte;
-    int pixel_groups;
-
-    if (avctx->codec_id == CODEC_ID_AURA) {
-        y_table = u_table;
-        u_table = v_table;
-    }
-    /* sanity check the buffer size: A buffer has 3x16-bytes tables
-     * followed by (height) lines each with 3 bytes to represent groups
-     * of 4 pixels. Thus, the total size of the buffer ought to be:
-     *    (3 * 16) + height * (width * 3 / 4) */
-    if (buf_size != 48 + s->height * (s->width * 3 / 4)) {
-        av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n",
-               buf_size, 48 + s->height * (s->width * 3 / 4));
-        return -1;
-    }
-
-    /* pixel data starts 48 bytes in, after 3x16-byte tables */
-    stream_ptr = 48;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
-    s->frame.reference = 0;
-    if (avctx->get_buffer(avctx, &s->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    y_plane = s->frame.data[0];
-    u_plane = s->frame.data[1];
-    v_plane = s->frame.data[2];
-
-    /* iterate through each line in the height */
-    for (y_ptr = 0, u_ptr = 0, v_ptr = 0;
-         y_ptr < (s->height * s->frame.linesize[0]);
-         y_ptr += s->frame.linesize[0] - s->width,
-         u_ptr += s->frame.linesize[1] - s->width / 4,
-         v_ptr += s->frame.linesize[2] - s->width / 4) {
-
-        /* reset predictors */
-        cur_byte = buf[stream_ptr++];
-        u_plane[u_ptr++] = u_pred = cur_byte & 0xF0;
-        y_plane[y_ptr++] = y_pred = (cur_byte & 0x0F) << 4;
-
-        cur_byte = buf[stream_ptr++];
-        v_plane[v_ptr++] = v_pred = cur_byte & 0xF0;
-        y_pred += y_table[cur_byte & 0x0F];
-        y_plane[y_ptr++] = y_pred;
-
-        cur_byte = buf[stream_ptr++];
-        y_pred += y_table[cur_byte & 0x0F];
-        y_plane[y_ptr++] = y_pred;
-        y_pred += y_table[(cur_byte & 0xF0) >> 4];
-        y_plane[y_ptr++] = y_pred;
-
-        /* iterate through the remaining pixel groups (4 pixels/group) */
-        pixel_groups = s->width / 4 - 1;
-        while (pixel_groups--) {
-
-            cur_byte = buf[stream_ptr++];
-            u_pred += u_table[(cur_byte & 0xF0) >> 4];
-            u_plane[u_ptr++] = u_pred;
-            y_pred += y_table[cur_byte & 0x0F];
-            y_plane[y_ptr++] = y_pred;
-
-            cur_byte = buf[stream_ptr++];
-            v_pred += v_table[(cur_byte & 0xF0) >> 4];
-            v_plane[v_ptr++] = v_pred;
-            y_pred += y_table[cur_byte & 0x0F];
-            y_plane[y_ptr++] = y_pred;
-
-            cur_byte = buf[stream_ptr++];
-            y_pred += y_table[cur_byte & 0x0F];
-            y_plane[y_ptr++] = y_pred;
-            y_pred += y_table[(cur_byte & 0xF0) >> 4];
-            y_plane[y_ptr++] = y_pred;
-
-        }
-    }
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data= s->frame;
-
-    return buf_size;
-}
-
-static av_cold int cyuv_decode_end(AVCodecContext *avctx)
-{
-    CyuvDecodeContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-#if CONFIG_AURA_DECODER
-AVCodec aura_decoder = {
-    "aura",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_AURA,
-    sizeof(CyuvDecodeContext),
-    cyuv_decode_init,
-    NULL,
-    cyuv_decode_end,
-    cyuv_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Auravision AURA"),
-};
-#endif
-
-#if CONFIG_CYUV_DECODER
-AVCodec cyuv_decoder = {
-    "cyuv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CYUV,
-    sizeof(CyuvDecodeContext),
-    cyuv_decode_init,
-    NULL,
-    cyuv_decode_end,
-    cyuv_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Creative YUV (CYUV)"),
-};
-#endif
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
deleted file mode 100644
index 10bc956..0000000
--- a/libavcodec/dca.c
+++ /dev/null
@@ -1,1333 +0,0 @@
-/*
- * DCA compatible decoder
- * Copyright (C) 2004 Gildas Bazin
- * Copyright (C) 2004 Benjamin Zores
- * Copyright (C) 2006 Benjamin Larsson
- * Copyright (C) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include "libavutil/intmath.h"
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "fft.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "dcadata.h"
-#include "dcahuff.h"
-#include "dca.h"
-#include "synth_filter.h"
-#include "dcadsp.h"
-
-//#define TRACE
-
-#define DCA_PRIM_CHANNELS_MAX (5)
-#define DCA_SUBBANDS (32)
-#define DCA_ABITS_MAX (32)      /* Should be 28 */
-#define DCA_SUBSUBFAMES_MAX (4)
-#define DCA_LFE_MAX (3)
-
-enum DCAMode {
-    DCA_MONO = 0,
-    DCA_CHANNEL,
-    DCA_STEREO,
-    DCA_STEREO_SUMDIFF,
-    DCA_STEREO_TOTAL,
-    DCA_3F,
-    DCA_2F1R,
-    DCA_3F1R,
-    DCA_2F2R,
-    DCA_3F2R,
-    DCA_4F2R
-};
-
-/* Tables for mapping dts channel configurations to libavcodec multichannel api.
- * Some compromises have been made for special configurations. Most configurations
- * are never used so complete accuracy is not needed.
- *
- * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead.
- * S  -> side, when both rear and back are configured move one of them to the side channel
- * OV -> center back
- * All 2 channel configurations -> CH_LAYOUT_STEREO
- */
-
-static const int64_t dca_core_channel_layout[] = {
-    CH_FRONT_CENTER,                                               ///< 1, A
-    CH_LAYOUT_STEREO,                                              ///< 2, A + B (dual mono)
-    CH_LAYOUT_STEREO,                                              ///< 2, L + R (stereo)
-    CH_LAYOUT_STEREO,                                              ///< 2, (L+R) + (L-R) (sum-difference)
-    CH_LAYOUT_STEREO,                                              ///< 2, LT +RT (left and right total)
-    CH_LAYOUT_STEREO|CH_FRONT_CENTER,                              ///< 3, C+L+R
-    CH_LAYOUT_STEREO|CH_BACK_CENTER,                               ///< 3, L+R+S
-    CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_BACK_CENTER,               ///< 4, C + L + R+ S
-    CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT,                   ///< 4, L + R +SL+ SR
-    CH_LAYOUT_STEREO|CH_FRONT_CENTER|CH_SIDE_LEFT|CH_SIDE_RIGHT,   ///< 5, C + L + R+ SL+SR
-    CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER,                 ///< 6, CL + CR + L + R + SL + SR
-    CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT|CH_FRONT_CENTER|CH_BACK_CENTER,                                   ///< 6, C + L + R+ LR + RR + OV
-    CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_FRONT_LEFT_OF_CENTER|CH_BACK_CENTER|CH_BACK_LEFT|CH_BACK_RIGHT,   ///< 6, CF+ CR+LF+ RF+LR + RR
-    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR
-    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT|CH_BACK_LEFT|CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2+ SR1 + SR2
-    CH_FRONT_LEFT_OF_CENTER|CH_FRONT_CENTER|CH_FRONT_RIGHT_OF_CENTER|CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_BACK_CENTER|CH_SIDE_RIGHT, ///< 8, CL + C+ CR + L + R + SL + S+ SR
-};
-
-static const int8_t dca_lfe_index[] = {
-    1,2,2,2,2,3,2,3,2,3,2,3,1,3,2,3
-};
-
-static const int8_t dca_channel_reorder_lfe[][8] = {
-    { 0, -1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 2,  0,  1, -1, -1, -1, -1, -1},
-    { 0,  1,  3, -1, -1, -1, -1, -1},
-    { 2,  0,  1,  4, -1, -1, -1, -1},
-    { 0,  1,  3,  4, -1, -1, -1, -1},
-    { 2,  0,  1,  4,  5, -1, -1, -1},
-    { 3,  4,  0,  1,  5,  6, -1, -1},
-    { 2,  0,  1,  4,  5,  6, -1, -1},
-    { 0,  6,  4,  5,  2,  3, -1, -1},
-    { 4,  2,  5,  0,  1,  6,  7, -1},
-    { 5,  6,  0,  1,  7,  3,  8,  4},
-    { 4,  2,  5,  0,  1,  6,  8,  7},
-};
-
-static const int8_t dca_channel_reorder_nolfe[][8] = {
-    { 0, -1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 0,  1, -1, -1, -1, -1, -1, -1},
-    { 2,  0,  1, -1, -1, -1, -1, -1},
-    { 0,  1,  2, -1, -1, -1, -1, -1},
-    { 2,  0,  1,  3, -1, -1, -1, -1},
-    { 0,  1,  2,  3, -1, -1, -1, -1},
-    { 2,  0,  1,  3,  4, -1, -1, -1},
-    { 2,  3,  0,  1,  4,  5, -1, -1},
-    { 2,  0,  1,  3,  4,  5, -1, -1},
-    { 0,  5,  3,  4,  1,  2, -1, -1},
-    { 3,  2,  4,  0,  1,  5,  6, -1},
-    { 4,  5,  0,  1,  6,  2,  7,  3},
-    { 3,  2,  4,  0,  1,  5,  7,  6},
-};
-
-
-#define DCA_DOLBY 101           /* FIXME */
-
-#define DCA_CHANNEL_BITS 6
-#define DCA_CHANNEL_MASK 0x3F
-
-#define DCA_LFE 0x80
-
-#define HEADER_SIZE 14
-
-#define DCA_MAX_FRAME_SIZE 16384
-
-/** Bit allocation */
-typedef struct {
-    int offset;                 ///< code values offset
-    int maxbits[8];             ///< max bits in VLC
-    int wrap;                   ///< wrap for get_vlc2()
-    VLC vlc[8];                 ///< actual codes
-} BitAlloc;
-
-static BitAlloc dca_bitalloc_index;    ///< indexes for samples VLC select
-static BitAlloc dca_tmode;             ///< transition mode VLCs
-static BitAlloc dca_scalefactor;       ///< scalefactor VLCs
-static BitAlloc dca_smpl_bitalloc[11]; ///< samples VLCs
-
-static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, int idx)
-{
-    return get_vlc2(gb, ba->vlc[idx].table, ba->vlc[idx].bits, ba->wrap) + ba->offset;
-}
-
-typedef struct {
-    AVCodecContext *avctx;
-    /* Frame header */
-    int frame_type;             ///< type of the current frame
-    int samples_deficit;        ///< deficit sample count
-    int crc_present;            ///< crc is present in the bitstream
-    int sample_blocks;          ///< number of PCM sample blocks
-    int frame_size;             ///< primary frame byte size
-    int amode;                  ///< audio channels arrangement
-    int sample_rate;            ///< audio sampling rate
-    int bit_rate;               ///< transmission bit rate
-    int bit_rate_index;         ///< transmission bit rate index
-
-    int downmix;                ///< embedded downmix enabled
-    int dynrange;               ///< embedded dynamic range flag
-    int timestamp;              ///< embedded time stamp flag
-    int aux_data;               ///< auxiliary data flag
-    int hdcd;                   ///< source material is mastered in HDCD
-    int ext_descr;              ///< extension audio descriptor flag
-    int ext_coding;             ///< extended coding flag
-    int aspf;                   ///< audio sync word insertion flag
-    int lfe;                    ///< low frequency effects flag
-    int predictor_history;      ///< predictor history flag
-    int header_crc;             ///< header crc check bytes
-    int multirate_inter;        ///< multirate interpolator switch
-    int version;                ///< encoder software revision
-    int copy_history;           ///< copy history
-    int source_pcm_res;         ///< source pcm resolution
-    int front_sum;              ///< front sum/difference flag
-    int surround_sum;           ///< surround sum/difference flag
-    int dialog_norm;            ///< dialog normalisation parameter
-
-    /* Primary audio coding header */
-    int subframes;              ///< number of subframes
-    int total_channels;         ///< number of channels including extensions
-    int prim_channels;          ///< number of primary audio channels
-    int subband_activity[DCA_PRIM_CHANNELS_MAX];    ///< subband activity count
-    int vq_start_subband[DCA_PRIM_CHANNELS_MAX];    ///< high frequency vq start subband
-    int joint_intensity[DCA_PRIM_CHANNELS_MAX];     ///< joint intensity coding index
-    int transient_huffman[DCA_PRIM_CHANNELS_MAX];   ///< transient mode code book
-    int scalefactor_huffman[DCA_PRIM_CHANNELS_MAX]; ///< scale factor code book
-    int bitalloc_huffman[DCA_PRIM_CHANNELS_MAX];    ///< bit allocation quantizer select
-    int quant_index_huffman[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< quantization index codebook select
-    float scalefactor_adj[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX];   ///< scale factor adjustment
-
-    /* Primary audio coding side information */
-    int subsubframes;           ///< number of subsubframes
-    int partial_samples;        ///< partial subsubframe samples count
-    int prediction_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS];    ///< prediction mode (ADPCM used or not)
-    int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS];      ///< prediction VQ coefs
-    int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS];           ///< bit allocation index
-    int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS];    ///< transition mode (transients)
-    int scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2];    ///< scale factors (2 if transient)
-    int joint_huff[DCA_PRIM_CHANNELS_MAX];                       ///< joint subband scale factors codebook
-    int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< joint subband scale factors
-    int downmix_coef[DCA_PRIM_CHANNELS_MAX][2];                  ///< stereo downmix coefficients
-    int dynrange_coef;                                           ///< dynamic range coefficient
-
-    int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS];       ///< VQ encoded high frequency subbands
-
-    float lfe_data[2 * DCA_SUBSUBFAMES_MAX * DCA_LFE_MAX *
-                   2 /*history */ ];    ///< Low frequency effect data
-    int lfe_scale_factor;
-
-    /* Subband samples history (for ADPCM) */
-    float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4];
-    DECLARE_ALIGNED(16, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512];
-    DECLARE_ALIGNED(16, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32];
-    int hist_index[DCA_PRIM_CHANNELS_MAX];
-    DECLARE_ALIGNED(16, float, raXin)[32];
-
-    int output;                 ///< type of output
-    float add_bias;             ///< output bias
-    float scale_bias;           ///< output scale
-
-    DECLARE_ALIGNED(16, float, samples)[1536];  /* 6 * 256 = 1536, might only need 5 */
-    const float *samples_chanptr[6];
-
-    uint8_t dca_buffer[DCA_MAX_FRAME_SIZE];
-    int dca_buffer_size;        ///< how much data is in the dca_buffer
-
-    const int8_t* channel_order_tab;                             ///< channel reordering table, lfe and non lfe
-    GetBitContext gb;
-    /* Current position in DCA frame */
-    int current_subframe;
-    int current_subsubframe;
-
-    int debug_flag;             ///< used for suppressing repeated error messages output
-    DSPContext dsp;
-    FFTContext imdct;
-    SynthFilterContext synth;
-    DCADSPContext dcadsp;
-} DCAContext;
-
-static const uint16_t dca_vlc_offs[] = {
-        0,   512,   640,   768,  1282,  1794,  2436,  3080,  3770,  4454,  5364,
-     5372,  5380,  5388,  5392,  5396,  5412,  5420,  5428,  5460,  5492,  5508,
-     5572,  5604,  5668,  5796,  5860,  5892,  6412,  6668,  6796,  7308,  7564,
-     7820,  8076,  8620,  9132,  9388,  9910, 10166, 10680, 11196, 11726, 12240,
-    12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264,
-    18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622,
-};
-
-static av_cold void dca_init_vlcs(void)
-{
-    static int vlcs_initialized = 0;
-    int i, j, c = 14;
-    static VLC_TYPE dca_table[23622][2];
-
-    if (vlcs_initialized)
-        return;
-
-    dca_bitalloc_index.offset = 1;
-    dca_bitalloc_index.wrap = 2;
-    for (i = 0; i < 5; i++) {
-        dca_bitalloc_index.vlc[i].table = &dca_table[dca_vlc_offs[i]];
-        dca_bitalloc_index.vlc[i].table_allocated = dca_vlc_offs[i + 1] - dca_vlc_offs[i];
-        init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12,
-                 bitalloc_12_bits[i], 1, 1,
-                 bitalloc_12_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
-    }
-    dca_scalefactor.offset = -64;
-    dca_scalefactor.wrap = 2;
-    for (i = 0; i < 5; i++) {
-        dca_scalefactor.vlc[i].table = &dca_table[dca_vlc_offs[i + 5]];
-        dca_scalefactor.vlc[i].table_allocated = dca_vlc_offs[i + 6] - dca_vlc_offs[i + 5];
-        init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129,
-                 scales_bits[i], 1, 1,
-                 scales_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
-    }
-    dca_tmode.offset = 0;
-    dca_tmode.wrap = 1;
-    for (i = 0; i < 4; i++) {
-        dca_tmode.vlc[i].table = &dca_table[dca_vlc_offs[i + 10]];
-        dca_tmode.vlc[i].table_allocated = dca_vlc_offs[i + 11] - dca_vlc_offs[i + 10];
-        init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4,
-                 tmode_bits[i], 1, 1,
-                 tmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
-    }
-
-    for(i = 0; i < 10; i++)
-        for(j = 0; j < 7; j++){
-            if(!bitalloc_codes[i][j]) break;
-            dca_smpl_bitalloc[i+1].offset = bitalloc_offsets[i];
-            dca_smpl_bitalloc[i+1].wrap = 1 + (j > 4);
-            dca_smpl_bitalloc[i+1].vlc[j].table = &dca_table[dca_vlc_offs[c]];
-            dca_smpl_bitalloc[i+1].vlc[j].table_allocated = dca_vlc_offs[c + 1] - dca_vlc_offs[c];
-            init_vlc(&dca_smpl_bitalloc[i+1].vlc[j], bitalloc_maxbits[i][j],
-                     bitalloc_sizes[i],
-                     bitalloc_bits[i][j], 1, 1,
-                     bitalloc_codes[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC);
-            c++;
-        }
-    vlcs_initialized = 1;
-}
-
-static inline void get_array(GetBitContext *gb, int *dst, int len, int bits)
-{
-    while(len--)
-        *dst++ = get_bits(gb, bits);
-}
-
-static int dca_parse_frame_header(DCAContext * s)
-{
-    int i, j;
-    static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 };
-    static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 };
-    static const int thr[11] = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 };
-
-    init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
-
-    /* Sync code */
-    get_bits(&s->gb, 32);
-
-    /* Frame header */
-    s->frame_type        = get_bits(&s->gb, 1);
-    s->samples_deficit   = get_bits(&s->gb, 5) + 1;
-    s->crc_present       = get_bits(&s->gb, 1);
-    s->sample_blocks     = get_bits(&s->gb, 7) + 1;
-    s->frame_size        = get_bits(&s->gb, 14) + 1;
-    if (s->frame_size < 95)
-        return -1;
-    s->amode             = get_bits(&s->gb, 6);
-    s->sample_rate       = dca_sample_rates[get_bits(&s->gb, 4)];
-    if (!s->sample_rate)
-        return -1;
-    s->bit_rate_index    = get_bits(&s->gb, 5);
-    s->bit_rate          = dca_bit_rates[s->bit_rate_index];
-    if (!s->bit_rate)
-        return -1;
-
-    s->downmix           = get_bits(&s->gb, 1);
-    s->dynrange          = get_bits(&s->gb, 1);
-    s->timestamp         = get_bits(&s->gb, 1);
-    s->aux_data          = get_bits(&s->gb, 1);
-    s->hdcd              = get_bits(&s->gb, 1);
-    s->ext_descr         = get_bits(&s->gb, 3);
-    s->ext_coding        = get_bits(&s->gb, 1);
-    s->aspf              = get_bits(&s->gb, 1);
-    s->lfe               = get_bits(&s->gb, 2);
-    s->predictor_history = get_bits(&s->gb, 1);
-
-    /* TODO: check CRC */
-    if (s->crc_present)
-        s->header_crc    = get_bits(&s->gb, 16);
-
-    s->multirate_inter   = get_bits(&s->gb, 1);
-    s->version           = get_bits(&s->gb, 4);
-    s->copy_history      = get_bits(&s->gb, 2);
-    s->source_pcm_res    = get_bits(&s->gb, 3);
-    s->front_sum         = get_bits(&s->gb, 1);
-    s->surround_sum      = get_bits(&s->gb, 1);
-    s->dialog_norm       = get_bits(&s->gb, 4);
-
-    /* FIXME: channels mixing levels */
-    s->output = s->amode;
-    if(s->lfe) s->output |= DCA_LFE;
-
-#ifdef TRACE
-    av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type);
-    av_log(s->avctx, AV_LOG_DEBUG, "samples deficit: %i\n", s->samples_deficit);
-    av_log(s->avctx, AV_LOG_DEBUG, "crc present: %i\n", s->crc_present);
-    av_log(s->avctx, AV_LOG_DEBUG, "sample blocks: %i (%i samples)\n",
-           s->sample_blocks, s->sample_blocks * 32);
-    av_log(s->avctx, AV_LOG_DEBUG, "frame size: %i bytes\n", s->frame_size);
-    av_log(s->avctx, AV_LOG_DEBUG, "amode: %i (%i channels)\n",
-           s->amode, dca_channels[s->amode]);
-    av_log(s->avctx, AV_LOG_DEBUG, "sample rate: %i Hz\n",
-           s->sample_rate);
-    av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n",
-           s->bit_rate);
-    av_log(s->avctx, AV_LOG_DEBUG, "downmix: %i\n", s->downmix);
-    av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange);
-    av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp);
-    av_log(s->avctx, AV_LOG_DEBUG, "aux_data: %i\n", s->aux_data);
-    av_log(s->avctx, AV_LOG_DEBUG, "hdcd: %i\n", s->hdcd);
-    av_log(s->avctx, AV_LOG_DEBUG, "ext descr: %i\n", s->ext_descr);
-    av_log(s->avctx, AV_LOG_DEBUG, "ext coding: %i\n", s->ext_coding);
-    av_log(s->avctx, AV_LOG_DEBUG, "aspf: %i\n", s->aspf);
-    av_log(s->avctx, AV_LOG_DEBUG, "lfe: %i\n", s->lfe);
-    av_log(s->avctx, AV_LOG_DEBUG, "predictor history: %i\n",
-           s->predictor_history);
-    av_log(s->avctx, AV_LOG_DEBUG, "header crc: %i\n", s->header_crc);
-    av_log(s->avctx, AV_LOG_DEBUG, "multirate inter: %i\n",
-           s->multirate_inter);
-    av_log(s->avctx, AV_LOG_DEBUG, "version number: %i\n", s->version);
-    av_log(s->avctx, AV_LOG_DEBUG, "copy history: %i\n", s->copy_history);
-    av_log(s->avctx, AV_LOG_DEBUG,
-           "source pcm resolution: %i (%i bits/sample)\n",
-           s->source_pcm_res, dca_bits_per_sample[s->source_pcm_res]);
-    av_log(s->avctx, AV_LOG_DEBUG, "front sum: %i\n", s->front_sum);
-    av_log(s->avctx, AV_LOG_DEBUG, "surround sum: %i\n", s->surround_sum);
-    av_log(s->avctx, AV_LOG_DEBUG, "dialog norm: %i\n", s->dialog_norm);
-    av_log(s->avctx, AV_LOG_DEBUG, "\n");
-#endif
-
-    /* Primary audio coding header */
-    s->subframes         = get_bits(&s->gb, 4) + 1;
-    s->total_channels    = get_bits(&s->gb, 3) + 1;
-    s->prim_channels     = s->total_channels;
-    if (s->prim_channels > DCA_PRIM_CHANNELS_MAX)
-        s->prim_channels = DCA_PRIM_CHANNELS_MAX;   /* We only support DTS core */
-
-
-    for (i = 0; i < s->prim_channels; i++) {
-        s->subband_activity[i] = get_bits(&s->gb, 5) + 2;
-        if (s->subband_activity[i] > DCA_SUBBANDS)
-            s->subband_activity[i] = DCA_SUBBANDS;
-    }
-    for (i = 0; i < s->prim_channels; i++) {
-        s->vq_start_subband[i] = get_bits(&s->gb, 5) + 1;
-        if (s->vq_start_subband[i] > DCA_SUBBANDS)
-            s->vq_start_subband[i] = DCA_SUBBANDS;
-    }
-    get_array(&s->gb, s->joint_intensity,     s->prim_channels, 3);
-    get_array(&s->gb, s->transient_huffman,   s->prim_channels, 2);
-    get_array(&s->gb, s->scalefactor_huffman, s->prim_channels, 3);
-    get_array(&s->gb, s->bitalloc_huffman,    s->prim_channels, 3);
-
-    /* Get codebooks quantization indexes */
-    memset(s->quant_index_huffman, 0, sizeof(s->quant_index_huffman));
-    for (j = 1; j < 11; j++)
-        for (i = 0; i < s->prim_channels; i++)
-            s->quant_index_huffman[i][j] = get_bits(&s->gb, bitlen[j]);
-
-    /* Get scale factor adjustment */
-    for (j = 0; j < 11; j++)
-        for (i = 0; i < s->prim_channels; i++)
-            s->scalefactor_adj[i][j] = 1;
-
-    for (j = 1; j < 11; j++)
-        for (i = 0; i < s->prim_channels; i++)
-            if (s->quant_index_huffman[i][j] < thr[j])
-                s->scalefactor_adj[i][j] = adj_table[get_bits(&s->gb, 2)];
-
-    if (s->crc_present) {
-        /* Audio header CRC check */
-        get_bits(&s->gb, 16);
-    }
-
-    s->current_subframe = 0;
-    s->current_subsubframe = 0;
-
-#ifdef TRACE
-    av_log(s->avctx, AV_LOG_DEBUG, "subframes: %i\n", s->subframes);
-    av_log(s->avctx, AV_LOG_DEBUG, "prim channels: %i\n", s->prim_channels);
-    for(i = 0; i < s->prim_channels; i++){
-        av_log(s->avctx, AV_LOG_DEBUG, "subband activity: %i\n", s->subband_activity[i]);
-        av_log(s->avctx, AV_LOG_DEBUG, "vq start subband: %i\n", s->vq_start_subband[i]);
-        av_log(s->avctx, AV_LOG_DEBUG, "joint intensity: %i\n", s->joint_intensity[i]);
-        av_log(s->avctx, AV_LOG_DEBUG, "transient mode codebook: %i\n", s->transient_huffman[i]);
-        av_log(s->avctx, AV_LOG_DEBUG, "scale factor codebook: %i\n", s->scalefactor_huffman[i]);
-        av_log(s->avctx, AV_LOG_DEBUG, "bit allocation quantizer: %i\n", s->bitalloc_huffman[i]);
-        av_log(s->avctx, AV_LOG_DEBUG, "quant index huff:");
-        for (j = 0; j < 11; j++)
-            av_log(s->avctx, AV_LOG_DEBUG, " %i",
-                   s->quant_index_huffman[i][j]);
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-        av_log(s->avctx, AV_LOG_DEBUG, "scalefac adj:");
-        for (j = 0; j < 11; j++)
-            av_log(s->avctx, AV_LOG_DEBUG, " %1.3f", s->scalefactor_adj[i][j]);
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-    }
-#endif
-
-    return 0;
-}
-
-
-static inline int get_scale(GetBitContext *gb, int level, int value)
-{
-   if (level < 5) {
-       /* huffman encoded */
-       value += get_bitalloc(gb, &dca_scalefactor, level);
-   } else if(level < 8)
-       value = get_bits(gb, level + 1);
-   return value;
-}
-
-static int dca_subframe_header(DCAContext * s)
-{
-    /* Primary audio coding side information */
-    int j, k;
-
-    s->subsubframes = get_bits(&s->gb, 2) + 1;
-    s->partial_samples = get_bits(&s->gb, 3);
-    for (j = 0; j < s->prim_channels; j++) {
-        for (k = 0; k < s->subband_activity[j]; k++)
-            s->prediction_mode[j][k] = get_bits(&s->gb, 1);
-    }
-
-    /* Get prediction codebook */
-    for (j = 0; j < s->prim_channels; j++) {
-        for (k = 0; k < s->subband_activity[j]; k++) {
-            if (s->prediction_mode[j][k] > 0) {
-                /* (Prediction coefficient VQ address) */
-                s->prediction_vq[j][k] = get_bits(&s->gb, 12);
-            }
-        }
-    }
-
-    /* Bit allocation index */
-    for (j = 0; j < s->prim_channels; j++) {
-        for (k = 0; k < s->vq_start_subband[j]; k++) {
-            if (s->bitalloc_huffman[j] == 6)
-                s->bitalloc[j][k] = get_bits(&s->gb, 5);
-            else if (s->bitalloc_huffman[j] == 5)
-                s->bitalloc[j][k] = get_bits(&s->gb, 4);
-            else if (s->bitalloc_huffman[j] == 7) {
-                av_log(s->avctx, AV_LOG_ERROR,
-                       "Invalid bit allocation index\n");
-                return -1;
-            } else {
-                s->bitalloc[j][k] =
-                    get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]);
-            }
-
-            if (s->bitalloc[j][k] > 26) {
-//                 av_log(s->avctx,AV_LOG_DEBUG,"bitalloc index [%i][%i] too big (%i)\n",
-//                          j, k, s->bitalloc[j][k]);
-                return -1;
-            }
-        }
-    }
-
-    /* Transition mode */
-    for (j = 0; j < s->prim_channels; j++) {
-        for (k = 0; k < s->subband_activity[j]; k++) {
-            s->transition_mode[j][k] = 0;
-            if (s->subsubframes > 1 &&
-                k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) {
-                s->transition_mode[j][k] =
-                    get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]);
-            }
-        }
-    }
-
-    for (j = 0; j < s->prim_channels; j++) {
-        const uint32_t *scale_table;
-        int scale_sum;
-
-        memset(s->scale_factor[j], 0, s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2);
-
-        if (s->scalefactor_huffman[j] == 6)
-            scale_table = scale_factor_quant7;
-        else
-            scale_table = scale_factor_quant6;
-
-        /* When huffman coded, only the difference is encoded */
-        scale_sum = 0;
-
-        for (k = 0; k < s->subband_activity[j]; k++) {
-            if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) {
-                scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum);
-                s->scale_factor[j][k][0] = scale_table[scale_sum];
-            }
-
-            if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) {
-                /* Get second scale factor */
-                scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum);
-                s->scale_factor[j][k][1] = scale_table[scale_sum];
-            }
-        }
-    }
-
-    /* Joint subband scale factor codebook select */
-    for (j = 0; j < s->prim_channels; j++) {
-        /* Transmitted only if joint subband coding enabled */
-        if (s->joint_intensity[j] > 0)
-            s->joint_huff[j] = get_bits(&s->gb, 3);
-    }
-
-    /* Scale factors for joint subband coding */
-    for (j = 0; j < s->prim_channels; j++) {
-        int source_channel;
-
-        /* Transmitted only if joint subband coding enabled */
-        if (s->joint_intensity[j] > 0) {
-            int scale = 0;
-            source_channel = s->joint_intensity[j] - 1;
-
-            /* When huffman coded, only the difference is encoded
-             * (is this valid as well for joint scales ???) */
-
-            for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) {
-                scale = get_scale(&s->gb, s->joint_huff[j], 0);
-                scale += 64;    /* bias */
-                s->joint_scale_factor[j][k] = scale;    /*joint_scale_table[scale]; */
-            }
-
-            if (!(s->debug_flag & 0x02)) {
-                av_log(s->avctx, AV_LOG_DEBUG,
-                       "Joint stereo coding not supported\n");
-                s->debug_flag |= 0x02;
-            }
-        }
-    }
-
-    /* Stereo downmix coefficients */
-    if (s->prim_channels > 2) {
-        if(s->downmix) {
-            for (j = 0; j < s->prim_channels; j++) {
-                s->downmix_coef[j][0] = get_bits(&s->gb, 7);
-                s->downmix_coef[j][1] = get_bits(&s->gb, 7);
-            }
-        } else {
-            int am = s->amode & DCA_CHANNEL_MASK;
-            for (j = 0; j < s->prim_channels; j++) {
-                s->downmix_coef[j][0] = dca_default_coeffs[am][j][0];
-                s->downmix_coef[j][1] = dca_default_coeffs[am][j][1];
-            }
-        }
-    }
-
-    /* Dynamic range coefficient */
-    if (s->dynrange)
-        s->dynrange_coef = get_bits(&s->gb, 8);
-
-    /* Side information CRC check word */
-    if (s->crc_present) {
-        get_bits(&s->gb, 16);
-    }
-
-    /*
-     * Primary audio data arrays
-     */
-
-    /* VQ encoded high frequency subbands */
-    for (j = 0; j < s->prim_channels; j++)
-        for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
-            /* 1 vector -> 32 samples */
-            s->high_freq_vq[j][k] = get_bits(&s->gb, 10);
-
-    /* Low frequency effect data */
-    if (s->lfe) {
-        /* LFE samples */
-        int lfe_samples = 2 * s->lfe * s->subsubframes;
-        float lfe_scale;
-
-        for (j = lfe_samples; j < lfe_samples * 2; j++) {
-            /* Signed 8 bits int */
-            s->lfe_data[j] = get_sbits(&s->gb, 8);
-        }
-
-        /* Scale factor index */
-        s->lfe_scale_factor = scale_factor_quant7[get_bits(&s->gb, 8)];
-
-        /* Quantization step size * scale factor */
-        lfe_scale = 0.035 * s->lfe_scale_factor;
-
-        for (j = lfe_samples; j < lfe_samples * 2; j++)
-            s->lfe_data[j] *= lfe_scale;
-    }
-
-#ifdef TRACE
-    av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n", s->subsubframes);
-    av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n",
-           s->partial_samples);
-    for (j = 0; j < s->prim_channels; j++) {
-        av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:");
-        for (k = 0; k < s->subband_activity[j]; k++)
-            av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]);
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-    }
-    for (j = 0; j < s->prim_channels; j++) {
-        for (k = 0; k < s->subband_activity[j]; k++)
-                av_log(s->avctx, AV_LOG_DEBUG,
-                       "prediction coefs: %f, %f, %f, %f\n",
-                       (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192,
-                       (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192,
-                       (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192,
-                       (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192);
-    }
-    for (j = 0; j < s->prim_channels; j++) {
-        av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: ");
-        for (k = 0; k < s->vq_start_subband[j]; k++)
-            av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]);
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-    }
-    for (j = 0; j < s->prim_channels; j++) {
-        av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:");
-        for (k = 0; k < s->subband_activity[j]; k++)
-            av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]);
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-    }
-    for (j = 0; j < s->prim_channels; j++) {
-        av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:");
-        for (k = 0; k < s->subband_activity[j]; k++) {
-            if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0)
-                av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]);
-            if (k < s->vq_start_subband[j] && s->transition_mode[j][k])
-                av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]);
-        }
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-    }
-    for (j = 0; j < s->prim_channels; j++) {
-        if (s->joint_intensity[j] > 0) {
-            int source_channel = s->joint_intensity[j] - 1;
-            av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n");
-            for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++)
-                av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]);
-            av_log(s->avctx, AV_LOG_DEBUG, "\n");
-        }
-    }
-    if (s->prim_channels > 2 && s->downmix) {
-        av_log(s->avctx, AV_LOG_DEBUG, "Downmix coeffs:\n");
-        for (j = 0; j < s->prim_channels; j++) {
-            av_log(s->avctx, AV_LOG_DEBUG, "Channel 0,%d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][0]]);
-            av_log(s->avctx, AV_LOG_DEBUG, "Channel 1,%d = %f\n", j, dca_downmix_coeffs[s->downmix_coef[j][1]]);
-        }
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-    }
-    for (j = 0; j < s->prim_channels; j++)
-        for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++)
-            av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]);
-    if(s->lfe){
-        int lfe_samples = 2 * s->lfe * s->subsubframes;
-        av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n");
-        for (j = lfe_samples; j < lfe_samples * 2; j++)
-            av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]);
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-    }
-#endif
-
-    return 0;
-}
-
-static void qmf_32_subbands(DCAContext * s, int chans,
-                            float samples_in[32][8], float *samples_out,
-                            float scale, float bias)
-{
-    const float *prCoeff;
-    int i;
-
-    int sb_act = s->subband_activity[chans];
-    int subindex;
-
-    scale *= sqrt(1/8.0);
-
-    /* Select filter */
-    if (!s->multirate_inter)    /* Non-perfect reconstruction */
-        prCoeff = fir_32bands_nonperfect;
-    else                        /* Perfect reconstruction */
-        prCoeff = fir_32bands_perfect;
-
-    /* Reconstructed channel sample index */
-    for (subindex = 0; subindex < 8; subindex++) {
-        /* Load in one sample from each subband and clear inactive subbands */
-        for (i = 0; i < sb_act; i++){
-            uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30;
-            AV_WN32A(&s->raXin[i], v);
-        }
-        for (; i < 32; i++)
-            s->raXin[i] = 0.0;
-
-        s->synth.synth_filter_float(&s->imdct,
-                              s->subband_fir_hist[chans], &s->hist_index[chans],
-                              s->subband_fir_noidea[chans], prCoeff,
-                              samples_out, s->raXin, scale, bias);
-        samples_out+= 32;
-
-    }
-}
-
-static void lfe_interpolation_fir(DCAContext *s, int decimation_select,
-                                  int num_deci_sample, float *samples_in,
-                                  float *samples_out, float scale,
-                                  float bias)
-{
-    /* samples_in: An array holding decimated samples.
-     *   Samples in current subframe starts from samples_in[0],
-     *   while samples_in[-1], samples_in[-2], ..., stores samples
-     *   from last subframe as history.
-     *
-     * samples_out: An array holding interpolated samples
-     */
-
-    int decifactor;
-    const float *prCoeff;
-    int deciindex;
-
-    /* Select decimation filter */
-    if (decimation_select == 1) {
-        decifactor = 64;
-        prCoeff = lfe_fir_128;
-    } else {
-        decifactor = 32;
-        prCoeff = lfe_fir_64;
-    }
-    /* Interpolation */
-    for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
-        s->dcadsp.lfe_fir(samples_out, samples_in, prCoeff, decifactor,
-                          scale, bias);
-        samples_in++;
-        samples_out += 2 * decifactor;
-    }
-}
-
-/* downmixing routines */
-#define MIX_REAR1(samples, si1, rs, coef) \
-     samples[i]     += samples[si1] * coef[rs][0]; \
-     samples[i+256] += samples[si1] * coef[rs][1];
-
-#define MIX_REAR2(samples, si1, si2, rs, coef) \
-     samples[i]     += samples[si1] * coef[rs][0] + samples[si2] * coef[rs+1][0]; \
-     samples[i+256] += samples[si1] * coef[rs][1] + samples[si2] * coef[rs+1][1];
-
-#define MIX_FRONT3(samples, coef) \
-    t = samples[i]; \
-    samples[i]     = t * coef[0][0] + samples[i+256] * coef[1][0] + samples[i+512] * coef[2][0]; \
-    samples[i+256] = t * coef[0][1] + samples[i+256] * coef[1][1] + samples[i+512] * coef[2][1];
-
-#define DOWNMIX_TO_STEREO(op1, op2) \
-    for(i = 0; i < 256; i++){ \
-        op1 \
-        op2 \
-    }
-
-static void dca_downmix(float *samples, int srcfmt,
-                        int downmix_coef[DCA_PRIM_CHANNELS_MAX][2])
-{
-    int i;
-    float t;
-    float coef[DCA_PRIM_CHANNELS_MAX][2];
-
-    for(i=0; i<DCA_PRIM_CHANNELS_MAX; i++) {
-        coef[i][0] = dca_downmix_coeffs[downmix_coef[i][0]];
-        coef[i][1] = dca_downmix_coeffs[downmix_coef[i][1]];
-    }
-
-    switch (srcfmt) {
-    case DCA_MONO:
-    case DCA_CHANNEL:
-    case DCA_STEREO_TOTAL:
-    case DCA_STEREO_SUMDIFF:
-    case DCA_4F2R:
-        av_log(NULL, 0, "Not implemented!\n");
-        break;
-    case DCA_STEREO:
-        break;
-    case DCA_3F:
-        DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef),);
-        break;
-    case DCA_2F1R:
-        DOWNMIX_TO_STEREO(MIX_REAR1(samples, i + 512, 2, coef),);
-        break;
-    case DCA_3F1R:
-        DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef),
-                          MIX_REAR1(samples, i + 768, 3, coef));
-        break;
-    case DCA_2F2R:
-        DOWNMIX_TO_STEREO(MIX_REAR2(samples, i + 512, i + 768, 2, coef),);
-        break;
-    case DCA_3F2R:
-        DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef),
-                          MIX_REAR2(samples, i + 768, i + 1024, 3, coef));
-        break;
-    }
-}
-
-
-/* Very compact version of the block code decoder that does not use table
- * look-up but is slightly slower */
-static int decode_blockcode(int code, int levels, int *values)
-{
-    int i;
-    int offset = (levels - 1) >> 1;
-
-    for (i = 0; i < 4; i++) {
-        int div = FASTDIV(code, levels);
-        values[i] = code - offset - div*levels;
-        code = div;
-    }
-
-    if (code == 0)
-        return 0;
-    else {
-        av_log(NULL, AV_LOG_ERROR, "ERROR: block code look-up failed\n");
-        return -1;
-    }
-}
-
-static const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 };
-static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
-
-static int dca_subsubframe(DCAContext * s)
-{
-    int k, l;
-    int subsubframe = s->current_subsubframe;
-
-    const float *quant_step_table;
-
-    /* FIXME */
-    LOCAL_ALIGNED_16(float, subband_samples, [DCA_PRIM_CHANNELS_MAX], [DCA_SUBBANDS][8]);
-    LOCAL_ALIGNED_16(int, block, [8]);
-
-    /*
-     * Audio data
-     */
-
-    /* Select quantization step size table */
-    if (s->bit_rate_index == 0x1f)
-        quant_step_table = lossless_quant_d;
-    else
-        quant_step_table = lossy_quant_d;
-
-    for (k = 0; k < s->prim_channels; k++) {
-        for (l = 0; l < s->vq_start_subband[k]; l++) {
-            int m;
-
-            /* Select the mid-tread linear quantizer */
-            int abits = s->bitalloc[k][l];
-
-            float quant_step_size = quant_step_table[abits];
-
-            /*
-             * Determine quantization index code book and its type
-             */
-
-            /* Select quantization index code book */
-            int sel = s->quant_index_huffman[k][abits];
-
-            /*
-             * Extract bits from the bit stream
-             */
-            if(!abits){
-                memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0]));
-            } else {
-                /* Deal with transients */
-                int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l];
-                float rscale = quant_step_size * s->scale_factor[k][l][sfi] * s->scalefactor_adj[k][sel];
-
-                if(abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){
-                    if(abits <= 7){
-                        /* Block code */
-                        int block_code1, block_code2, size, levels;
-
-                        size = abits_sizes[abits-1];
-                        levels = abits_levels[abits-1];
-
-                        block_code1 = get_bits(&s->gb, size);
-                        /* FIXME Should test return value */
-                        decode_blockcode(block_code1, levels, block);
-                        block_code2 = get_bits(&s->gb, size);
-                        decode_blockcode(block_code2, levels, &block[4]);
-                    }else{
-                        /* no coding */
-                        for (m = 0; m < 8; m++)
-                            block[m] = get_sbits(&s->gb, abits - 3);
-                    }
-                }else{
-                    /* Huffman coded */
-                    for (m = 0; m < 8; m++)
-                        block[m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel);
-                }
-
-                s->dsp.int32_to_float_fmul_scalar(subband_samples[k][l],
-                                                  block, rscale, 8);
-            }
-
-            /*
-             * Inverse ADPCM if in prediction mode
-             */
-            if (s->prediction_mode[k][l]) {
-                int n;
-                for (m = 0; m < 8; m++) {
-                    for (n = 1; n <= 4; n++)
-                        if (m >= n)
-                            subband_samples[k][l][m] +=
-                                (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
-                                 subband_samples[k][l][m - n] / 8192);
-                        else if (s->predictor_history)
-                            subband_samples[k][l][m] +=
-                                (adpcm_vb[s->prediction_vq[k][l]][n - 1] *
-                                 s->subband_samples_hist[k][l][m - n +
-                                                               4] / 8192);
-                }
-            }
-        }
-
-        /*
-         * Decode VQ encoded high frequencies
-         */
-        for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) {
-            /* 1 vector -> 32 samples but we only need the 8 samples
-             * for this subsubframe. */
-            int m;
-
-            if (!s->debug_flag & 0x01) {
-                av_log(s->avctx, AV_LOG_DEBUG, "Stream with high frequencies VQ coding\n");
-                s->debug_flag |= 0x01;
-            }
-
-            for (m = 0; m < 8; m++) {
-                subband_samples[k][l][m] =
-                    high_freq_vq[s->high_freq_vq[k][l]][subsubframe * 8 +
-                                                        m]
-                    * (float) s->scale_factor[k][l][0] / 16.0;
-            }
-        }
-    }
-
-    /* Check for DSYNC after subsubframe */
-    if (s->aspf || subsubframe == s->subsubframes - 1) {
-        if (0xFFFF == get_bits(&s->gb, 16)) {   /* 0xFFFF */
-#ifdef TRACE
-            av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n");
-#endif
-        } else {
-            av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n");
-        }
-    }
-
-    /* Backup predictor history for adpcm */
-    for (k = 0; k < s->prim_channels; k++)
-        for (l = 0; l < s->vq_start_subband[k]; l++)
-            memcpy(s->subband_samples_hist[k][l], &subband_samples[k][l][4],
-                        4 * sizeof(subband_samples[0][0][0]));
-
-    /* 32 subbands QMF */
-    for (k = 0; k < s->prim_channels; k++) {
-/*        static float pcm_to_double[8] =
-            {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/
-         qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * s->channel_order_tab[k]],
-                            M_SQRT1_2*s->scale_bias /*pcm_to_double[s->source_pcm_res] */ ,
-                            s->add_bias );
-    }
-
-    /* Down mixing */
-
-    if (s->prim_channels > dca_channels[s->output & DCA_CHANNEL_MASK]) {
-        dca_downmix(s->samples, s->amode, s->downmix_coef);
-    }
-
-    /* Generate LFE samples for this subsubframe FIXME!!! */
-    if (s->output & DCA_LFE) {
-        int lfe_samples = 2 * s->lfe * s->subsubframes;
-
-        lfe_interpolation_fir(s, s->lfe, 2 * s->lfe,
-                              s->lfe_data + lfe_samples +
-                              2 * s->lfe * subsubframe,
-                              &s->samples[256 * dca_lfe_index[s->amode]],
-                              (1.0/256.0)*s->scale_bias,  s->add_bias);
-        /* Outputs 20bits pcm samples */
-    }
-
-    return 0;
-}
-
-
-static int dca_subframe_footer(DCAContext * s)
-{
-    int aux_data_count = 0, i;
-    int lfe_samples;
-
-    /*
-     * Unpack optional information
-     */
-
-    if (s->timestamp)
-        get_bits(&s->gb, 32);
-
-    if (s->aux_data)
-        aux_data_count = get_bits(&s->gb, 6);
-
-    for (i = 0; i < aux_data_count; i++)
-        get_bits(&s->gb, 8);
-
-    if (s->crc_present && (s->downmix || s->dynrange))
-        get_bits(&s->gb, 16);
-
-    lfe_samples = 2 * s->lfe * s->subsubframes;
-    for (i = 0; i < lfe_samples; i++) {
-        s->lfe_data[i] = s->lfe_data[i + lfe_samples];
-    }
-
-    return 0;
-}
-
-/**
- * Decode a dca frame block
- *
- * @param s     pointer to the DCAContext
- */
-
-static int dca_decode_block(DCAContext * s)
-{
-
-    /* Sanity check */
-    if (s->current_subframe >= s->subframes) {
-        av_log(s->avctx, AV_LOG_DEBUG, "check failed: %i>%i",
-               s->current_subframe, s->subframes);
-        return -1;
-    }
-
-    if (!s->current_subsubframe) {
-#ifdef TRACE
-        av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_header\n");
-#endif
-        /* Read subframe header */
-        if (dca_subframe_header(s))
-            return -1;
-    }
-
-    /* Read subsubframe */
-#ifdef TRACE
-    av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n");
-#endif
-    if (dca_subsubframe(s))
-        return -1;
-
-    /* Update state */
-    s->current_subsubframe++;
-    if (s->current_subsubframe >= s->subsubframes) {
-        s->current_subsubframe = 0;
-        s->current_subframe++;
-    }
-    if (s->current_subframe >= s->subframes) {
-#ifdef TRACE
-        av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_footer\n");
-#endif
-        /* Read subframe footer */
-        if (dca_subframe_footer(s))
-            return -1;
-    }
-
-    return 0;
-}
-
-/**
- * Convert bitstream to one representation based on sync marker
- */
-static int dca_convert_bitstream(const uint8_t * src, int src_size, uint8_t * dst,
-                          int max_size)
-{
-    uint32_t mrk;
-    int i, tmp;
-    const uint16_t *ssrc = (const uint16_t *) src;
-    uint16_t *sdst = (uint16_t *) dst;
-    PutBitContext pb;
-
-    if((unsigned)src_size > (unsigned)max_size) {
-//        av_log(NULL, AV_LOG_ERROR, "Input frame size larger then DCA_MAX_FRAME_SIZE!\n");
-//        return -1;
-        src_size = max_size;
-    }
-
-    mrk = AV_RB32(src);
-    switch (mrk) {
-    case DCA_MARKER_RAW_BE:
-        memcpy(dst, src, src_size);
-        return src_size;
-    case DCA_MARKER_RAW_LE:
-        for (i = 0; i < (src_size + 1) >> 1; i++)
-            *sdst++ = bswap_16(*ssrc++);
-        return src_size;
-    case DCA_MARKER_14B_BE:
-    case DCA_MARKER_14B_LE:
-        init_put_bits(&pb, dst, max_size);
-        for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) {
-            tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF;
-            put_bits(&pb, 14, tmp);
-        }
-        flush_put_bits(&pb);
-        return (put_bits_count(&pb) + 7) >> 3;
-    default:
-        return -1;
-    }
-}
-
-/**
- * Main frame decoding function
- * FIXME add arguments
- */
-static int dca_decode_frame(AVCodecContext * avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-
-    int i;
-    int16_t *samples = data;
-    DCAContext *s = avctx->priv_data;
-    int channels;
-
-
-    s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE);
-    if (s->dca_buffer_size == -1) {
-        av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
-        return -1;
-    }
-
-    init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
-    if (dca_parse_frame_header(s) < 0) {
-        //seems like the frame is corrupt, try with the next one
-        *data_size=0;
-        return buf_size;
-    }
-    //set AVCodec values with parsed data
-    avctx->sample_rate = s->sample_rate;
-    avctx->bit_rate = s->bit_rate;
-
-    channels = s->prim_channels + !!s->lfe;
-
-    if (s->amode<16) {
-        avctx->channel_layout = dca_core_channel_layout[s->amode];
-
-        if (s->lfe) {
-            avctx->channel_layout |= CH_LOW_FREQUENCY;
-            s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
-        } else
-            s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
-
-        if (s->prim_channels > 0 &&
-            s->channel_order_tab[s->prim_channels - 1] < 0)
-            return -1;
-
-        if(avctx->request_channels == 2 && s->prim_channels > 2) {
-            channels = 2;
-            s->output = DCA_STEREO;
-            avctx->channel_layout = CH_LAYOUT_STEREO;
-        }
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode);
-        return -1;
-    }
-
-
-    /* There is nothing that prevents a dts frame to change channel configuration
-       but FFmpeg doesn't support that so only set the channels if it is previously
-       unset. Ideally during the first probe for channels the crc should be checked
-       and only set avctx->channels when the crc is ok. Right now the decoder could
-       set the channels based on a broken first frame.*/
-    if (!avctx->channels)
-        avctx->channels = channels;
-
-    if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
-        return -1;
-    *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels;
-    for (i = 0; i < (s->sample_blocks / 8); i++) {
-        dca_decode_block(s);
-        s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
-        samples += 256 * channels;
-    }
-
-    return buf_size;
-}
-
-
-
-/**
- * DCA initialization
- *
- * @param avctx     pointer to the AVCodecContext
- */
-
-static av_cold int dca_decode_init(AVCodecContext * avctx)
-{
-    DCAContext *s = avctx->priv_data;
-    int i;
-
-    s->avctx = avctx;
-    dca_init_vlcs();
-
-    dsputil_init(&s->dsp, avctx);
-    ff_mdct_init(&s->imdct, 6, 1, 1.0);
-    ff_synth_filter_init(&s->synth);
-    ff_dcadsp_init(&s->dcadsp);
-
-    for(i = 0; i < 6; i++)
-        s->samples_chanptr[i] = s->samples + i * 256;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        s->add_bias = 385.0f;
-        s->scale_bias = 1.0 / 32768.0;
-    } else {
-        s->add_bias = 0.0f;
-        s->scale_bias = 1.0;
-
-        /* allow downmixing to stereo */
-        if (avctx->channels > 0 && avctx->request_channels < avctx->channels &&
-                avctx->request_channels == 2) {
-            avctx->channels = avctx->request_channels;
-        }
-    }
-
-
-    return 0;
-}
-
-static av_cold int dca_decode_end(AVCodecContext * avctx)
-{
-    DCAContext *s = avctx->priv_data;
-    ff_mdct_end(&s->imdct);
-    return 0;
-}
-
-AVCodec dca_decoder = {
-    .name = "dca",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_DTS,
-    .priv_data_size = sizeof(DCAContext),
-    .init = dca_decode_init,
-    .decode = dca_decode_frame,
-    .close = dca_decode_end,
-    .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
-};
diff --git a/libavcodec/dca.h b/libavcodec/dca.h
deleted file mode 100644
index 02c0a51..0000000
--- a/libavcodec/dca.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * DCA compatible decoder
- * Copyright (C) 2004 Gildas Bazin
- * Copyright (C) 2004 Benjamin Zores
- * Copyright (C) 2006 Benjamin Larsson
- * Copyright (C) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DCA_H
-#define AVCODEC_DCA_H
-
-/** DCA syncwords, also used for bitstream type detection */
-#define DCA_MARKER_RAW_BE 0x7FFE8001
-#define DCA_MARKER_RAW_LE 0xFE7F0180
-#define DCA_MARKER_14B_BE 0x1FFFE800
-#define DCA_MARKER_14B_LE 0xFF1F00E8
-
-/** DCA-HD specific block starts with this marker. */
-#define DCA_HD_MARKER     0x64582025
-
-#endif /* AVCODEC_DCA_H */
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
deleted file mode 100644
index 01c5597..0000000
--- a/libavcodec/dca_parser.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * DCA parser
- * Copyright (C) 2004 Gildas Bazin
- * Copyright (C) 2004 Benjamin Zores
- * Copyright (C) 2006 Benjamin Larsson
- * Copyright (C) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-#include "dca.h"
-
-typedef struct DCAParseContext {
-    ParseContext pc;
-    uint32_t lastmarker;
-    int size;
-    int framesize;
-    int hd_pos;
-} DCAParseContext;
-
-#define IS_MARKER(state, i, buf, buf_size) \
- ((state == DCA_MARKER_14B_LE && (i < buf_size-2) && (buf[i+1] & 0xF0) == 0xF0 && buf[i+2] == 0x07) \
- || (state == DCA_MARKER_14B_BE && (i < buf_size-2) && buf[i+1] == 0x07 && (buf[i+2] & 0xF0) == 0xF0) \
- || state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE)
-
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf,
-                              int buf_size)
-{
-    int start_found, i;
-    uint32_t state;
-    ParseContext *pc = &pc1->pc;
-
-    start_found = pc->frame_start_found;
-    state = pc->state;
-
-    i = 0;
-    if (!start_found) {
-        for (i = 0; i < buf_size; i++) {
-            state = (state << 8) | buf[i];
-            if (IS_MARKER(state, i, buf, buf_size)) {
-                if (pc1->lastmarker && state == pc1->lastmarker) {
-                    start_found = 1;
-                    break;
-                } else if (!pc1->lastmarker) {
-                    start_found = 1;
-                    pc1->lastmarker = state;
-                    break;
-                }
-            }
-        }
-    }
-    if (start_found) {
-        for (; i < buf_size; i++) {
-            pc1->size++;
-            state = (state << 8) | buf[i];
-            if (state == DCA_HD_MARKER && !pc1->hd_pos)
-                pc1->hd_pos = pc1->size;
-            if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) {
-                if(pc1->framesize > pc1->size)
-                    continue;
-                if(!pc1->framesize){
-                    pc1->framesize = pc1->hd_pos ? pc1->hd_pos : pc1->size;
-                }
-                pc->frame_start_found = 0;
-                pc->state = -1;
-                pc1->size = 0;
-                return i - 3;
-            }
-        }
-    }
-    pc->frame_start_found = start_found;
-    pc->state = state;
-    return END_NOT_FOUND;
-}
-
-static av_cold int dca_parse_init(AVCodecParserContext * s)
-{
-    DCAParseContext *pc1 = s->priv_data;
-
-    pc1->lastmarker = 0;
-    return 0;
-}
-
-static int dca_parse(AVCodecParserContext * s,
-                     AVCodecContext * avctx,
-                     const uint8_t ** poutbuf, int *poutbuf_size,
-                     const uint8_t * buf, int buf_size)
-{
-    DCAParseContext *pc1 = s->priv_data;
-    ParseContext *pc = &pc1->pc;
-    int next;
-
-    if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
-        next = buf_size;
-    } else {
-        next = dca_find_frame_end(pc1, buf, buf_size);
-
-        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-    }
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-AVCodecParser dca_parser = {
-    {CODEC_ID_DTS},
-    sizeof(DCAParseContext),
-    dca_parse_init,
-    dca_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/dcadata.h b/libavcodec/dcadata.h
deleted file mode 100644
index fbd22ab..0000000
--- a/libavcodec/dcadata.h
+++ /dev/null
@@ -1,7636 +0,0 @@
-/*
- * DCA compatible decoder data
- * Copyright (C) 2004 Gildas Bazin
- * Copyright (c) 2006 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DCADATA_H
-#define AVCODEC_DCADATA_H
-
-#include <stdint.h>
-#include "libavutil/mem.h"
-
-/* Generic tables */
-
-static const uint32_t dca_sample_rates[16] =
-{
-    0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
-    12000, 24000, 48000, 96000, 192000
-};
-
-static const uint32_t dca_bit_rates[32] =
-{
-    32000, 56000, 64000, 96000, 112000, 128000,
-    192000, 224000, 256000, 320000, 384000,
-    448000, 512000, 576000, 640000, 768000,
-    896000, 1024000, 1152000, 1280000, 1344000,
-    1408000, 1411200, 1472000, 1536000, 1920000,
-    2048000, 3072000, 3840000, 1/*open*/, 2/*variable*/, 3/*lossless*/
-};
-
-static const uint8_t dca_channels[16] =
-{
-    1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8
-};
-
-static const uint8_t dca_bits_per_sample[7] =
-{
-    16, 16, 20, 20, 0, 24, 24
-};
-
-
-/* Adpcm data */
-
-/* 16bits signed fractional Q13 binary codes */
-static const int16_t adpcm_vb[4096][4] =
-{
-  { 9928, -2618, -1093, -1263 },
-  { 11077, -2876, -1747, -308 },
-  { 10503, -1082, -1426, -1167 },
-  { 9337, -2403, -1495, 274 },
-  { 10698, -2529, -532, -1122 },
-  { 10368, -3974, -1264, -750 },
-  { 10070, -3667, 346, 863 },
-  { 10278, -3093, 311, -576 },
-  { 9894, -1330, -1428, -860 },
-  { 10544, -1923, -1058, -971 },
-  { 10996, -1632, -841, -1404 },
-  { 11832, -3465, 1658, -1990 },
-  { 10852, -688, -2658, -499 },
-  { 10546, -1749, -147, -1733 },
-  { 10801, -1004, -708, -1453 },
-  { 10588, -441, -2113, -952 },
-  { 10141, -3331, -582, -1432 },
-  { 9608, -2590, 383, 258 },
-  { 11422, -3265, 229, -1544 },
-  { 10460, -1338, -713, -1568 },
-  { 10306, -1721, -1660, -603 },
-  { 9580, -1812, -1235, -1061 },
-  { 11471, -2285, -1617, -607 },
-  { 10081, -2225, -1408, -868 },
-  { 10715, -2624, -1367, -704 },
-  { 10616, -1871, -2770, -35 },
-  { 9352, -2340, -1024, -1566 },
-  { 11065, -1458, -1926, -735 },
-  { 11334, -2056, -1041, -1144 },
-  { 9825, -2048, -794, -1536 },
-  { 11850, -2695, -1123, -867 },
-  { 10654, -2226, -1891, -373 },
-  { 10024, -1557, -808, -1069 },
-  { 11142, -1266, -3238, 128 },
-  { 11729, -3282, -514, -1011 },
-  { 11402, -2094, -2335, -189 },
-  { 10195, -3658, 181, -1875 },
-  { 11431, -2626, -404, -1377 },
-  { 11001, -3868, -619, -1077 },
-  { 10894, -2559, 274, -1758 },
-  { 9633, -1482, -2253, -773 },
-  { 11245, -3321, 830, -1972 },
-  { 9768, -2701, -199, -1859 },
-  { 10500, -2042, 525, -2043 },
-  { 11669, -4069, 293, -1468 },
-  { 9192, -1991, -583, -61 },
-  { 10057, -3220, -2015, -473 },
-  { 9497, -2315, -2490, -467 },
-  { 10455, -3069, -1194, -1007 },
-  { 9994, -1936, -60, -1225 },
-  { 9295, -2156, -1761, -1134 },
-  { 10085, -3748, -1026, 197 },
-  { 9334, -2360, 804, -351 },
-  { 11561, -2553, 1352, -2313 },
-  { 12837, -3998, 1195, -1958 },
-  { 10114, -1100, -2414, -394 },
-  { 9341, -2530, 315, 755 },
-  { 10131, -3164, 1411, -674 },
-  { 9535, -905, -1551, 579 },
-  { 11717, -1519, -3051, 91 },
-  { 9824, -2911, -2775, 192 },
-  { 9662, -2934, -561, 1450 },
-  { 11085, -3392, -1298, -659 },
-  { 8955, -2102, -1899, 703 },
-  { 8607, -1742, -4348, 814 },
-  { 7640, -2063, -3617, 52 },
-  { 7074, -826, -4325, 4375 },
-  { 7714, 584, -4238, 1927 },
-  { 6355, -952, -4912, 3127 },
-  { 7069, -660, -6413, 4087 },
-  { 8313, -132, -2964, -876 },
-  { 6952, -1422, -3962, -24 },
-  { 9299, -734, -3088, -263 },
-  { 9484, -574, -4513, 466 },
-  { 7246, -91, -3735, -704 },
-  { 8325, -1417, -3090, -530 },
-  { 6469, -1226, -4757, 829 },
-  { 6652, -368, -5682, 1393 },
-  { 7971, -1278, -2284, 1205 },
-  { 7229, -699, -3556, 1840 },
-  { 7994, 1284, -2729, 732 },
-  { 9005, -698, -4522, 2189 },
-  { 6963, 197, -2727, 380 },
-  { 8527, 135, -3991, -213 },
-  { 8840, 934, -3014, -567 },
-  { 10125, 418, -3284, -371 },
-  { 6367, 361, -2318, 2554 },
-  { 7892, 172, -5247, 4673 },
-  { 6674, 387, -5424, 4398 },
-  { 6240, 684, -4047, 1219 },
-  { 11170, -794, -5081, 1195 },
-  { 11765, -648, -6265, 2052 },
-  { 10845, -775, -3837, 366 },
-  { 12496, -689, -8260, 3562 },
-  { 7893, -1166, -4972, 988 },
-  { 8592, 1052, -5986, 3087 },
-  { 7277, 1874, -5685, 3579 },
-  { 6900, 2016, -4809, 3491 },
-  { 8530, -2405, -3250, 1986 },
-  { 9426, 494, -7067, 5038 },
-  { 10285, 564, -8210, 5370 },
-  { 8749, -2207, -3980, 2852 },
-  { 9653, -2686, -4300, 1400 },
-  { 9770, -2286, -5663, 4233 },
-  { 8490, -4, -7048, 4496 },
-  { 7697, -1209, -5328, 3183 },
-  { 6451, 801, -4324, -554 },
-  { 7387, 1806, -5265, 545 },
-  { 7450, -2302, -4445, 1418 },
-  { 8817, -1370, -5827, 2168 },
-  { 10324, -2406, -5629, 2579 },
-  { 8863, -2578, -3537, 467 },
-  { 6901, -1624, -3169, 3392 },
-  { 7846, 156, -6948, 3381 },
-  { 7928, -1115, -5972, 4816 },
-  { 6089, -599, -4368, -320 },
-  { 7833, 1246, -3960, -621 },
-  { 8931, 2521, -6768, 2052 },
-  { 8900, 1944, -4126, 40 },
-  { 7661, -34, -2855, 2480 },
-  { 5873, 474, -3262, 3712 },
-  { 7535, -234, -4699, 216 },
-  { 5856, 143, -5142, 73 },
-  { 8944, -106, -5874, 3663 },
-  { 7134, 426, -5879, 2895 },
-  { 10199, 1011, -4762, 369 },
-  { 8454, 264, -5971, 1291 },
-  { 7822, -2449, -4333, 4540 },
-  { 6200, -2758, -2632, 1497 },
-  { 6070, -4315, -2699, 414 },
-  { 7047, -3739, -3210, 1060 },
-  { 5675, -3801, -2717, -407 },
-  { 4789, -4063, -2628, -744 },
-  { 4023, -3366, -3133, -726 },
-  { 4296, -2407, -3381, -513 },
-  { 4388, -2931, -2820, 1512 },
-  { 4559, -4233, -1941, 1976 },
-  { 6702, -3208, -1755, 1680 },
-  { 4416, -3521, -1052, 2984 },
-  { 7154, -4266, -1203, 3732 },
-  { 3625, -4242, -3244, 1395 },
-  { 6518, -2856, -1304, 2887 },
-  { 6170, -1949, -3014, 3973 },
-  { 5189, -2451, -4020, 3477 },
-  { 6218, -2988, -1921, 3844 },
-  { 4827, -3688, -1928, 3343 },
-  { 6668, -3991, -2805, 3095 },
-  { 5297, -3115, -3684, 2390 },
-  { 5354, -4614, -2662, 1504 },
-  { 4196, -3091, -4147, 1135 },
-  { 3540, -2893, -4007, 100 },
-  { 5569, -1602, -4007, 1909 },
-  { 4341, -2091, -4272, 252 },
-  { 5559, -2878, -3832, 498 },
-  { 4548, -4479, -2898, -27 },
-  { 5176, -2494, -4635, 1476 },
-  { 3294, -3485, -3738, 716 },
-  { 4920, -1229, -4195, -365 },
-  { 3257, -3518, -3349, 2862 },
-  { 5286, -1948, -3485, -778 },
-  { 6502, -3051, -152, 2854 },
-  { 5864, -4192, -1076, 3451 },
-  { 4656, -3122, -3448, 179 },
-  { 5907, -754, -1596, 3116 },
-  { 7229, -3680, -1590, 2892 },
-  { 5107, -3888, -3364, 806 },
-  { 6764, -2635, -3450, 134 },
-  { 5258, -2827, -2844, -1052 },
-  { 5798, -1725, -4305, 205 },
-  { 5404, -1213, -3362, 449 },
-  { 6224, -2738, -3046, -581 },
-  { 4223, -2438, -2725, 3745 },
-  { 4751, -3411, -2123, 116 },
-  { 3868, -3000, -3954, 2297 },
-  { 6819, -2899, -4277, 2825 },
-  { 4207, -4754, -2808, 865 },
-  { 4804, -1494, -1997, 4688 },
-  { 5282, -2213, -548, 3559 },
-  { 5580, -1912, -566, 4370 },
-  { 6168, -2857, -672, 4053 },
-  { 6583, -4515, -2850, 1670 },
-  { 6511, -3093, -3988, 1421 },
-  { 4646, -1790, -1443, 3650 },
-  { 5915, -924, -2020, 896 },
-  { 7814, -4181, -3152, 2007 },
-  { 6190, -2238, -4817, 2279 },
-  { 4737, -4034, -3288, 1835 },
-  { 8161, -3633, -3423, 3137 },
-  { 7415, -2351, -2088, 4290 },
-  { 4106, -2517, -62, 2905 },
-  { 4909, -3145, -614, 4112 },
-  { 4938, -3281, -397, 1100 },
-  { -173, 919, 1589, -5363 },
-  { -13, 796, -295, -6655 },
-  { -1860, -829, 1141, -4555 },
-  { 2298, -838, -664, -5005 },
-  { -884, -1097, 2074, -4613 },
-  { -101, 281, 2846, -4535 },
-  { 1166, 453, 2429, -5910 },
-  { 879, -664, 2370, -5452 },
-  { 1415, -370, -1699, -4727 },
-  { -1413, 1277, -669, -6649 },
-  { 2133, 304, -968, -4624 },
-  { 380, 586, -2087, -4892 },
-  { 1336, 275, -82, -5789 },
-  { -2459, 1057, -34, -5416 },
-  { 2278, -1758, 866, -5653 },
-  { 1945, -2295, -149, -5302 },
-  { 1287, -3525, 996, -5255 },
-  { 2297, 803, 1177, -6067 },
-  { 187, -180, -619, -6202 },
-  { -793, -2537, 1554, -5057 },
-  { -2703, -204, -629, -5853 },
-  { -1007, -146, 313, -5582 },
-  { 830, 357, 869, -6363 },
-  { -228, -575, -3177, -4433 },
-  { -1001, -1553, -142, -5708 },
-  { -1644, 1683, 1721, -4533 },
-  { 893, 1924, -15, -5791 },
-  { 2195, 2061, -262, -5471 },
-  { 3031, 270, 311, -5096 },
-  { 1912, 1638, -1523, -4677 },
-  { -3142, -55, 253, -4914 },
-  { 356, -1680, 343, -6123 },
-  { -2241, -1734, -976, -5939 },
-  { -2196, -2893, 547, -4938 },
-  { -1245, 126, -1916, -5419 },
-  { -249, -3755, -1422, -5594 },
-  { 575, -2683, -1926, -4566 },
-  { -762, 1885, 192, -5880 },
-  { -811, -2562, -1068, -6013 },
-  { -2264, -3086, -976, -4775 },
-  { 70, -1215, 2880, -4410 },
-  { 714, -3760, 2916, -4691 },
-  { -244, -3404, 1740, -4493 },
-  { 684, -5137, -328, -5608 },
-  { -529, -3825, -1786, -4535 },
-  { -713, -4743, -1118, -5546 },
-  { 2718, -3788, 1798, -5708 },
-  { -1639, -3679, -1564, -6095 },
-  { 1693, -2642, -1389, -4539 },
-  { 505, -1573, -1651, -4878 },
-  { -835, -2256, -1941, -5352 },
-  { 1464, -411, 1993, -6441 },
-  { 493, -3184, -145, -6148 },
-  { -1413, 499, -1617, -6479 },
-  { -294, 1722, -1419, -5725 },
-  { -2937, -1528, -175, -4624 },
-  { -594, -5911, -56, -6146 },
-  { -300, -4275, 1156, -5947 },
-  { 552, -2643, 2669, -3959 },
-  { 905, -4158, 1789, -5809 },
-  { 1336, -2009, 2108, -5903 },
-  { 1555, -3600, 1110, -6759 },
-  { -1294, -3464, 77, -6084 },
-  { -1139, -4006, -1270, -4181 },
-  { -5094, -3296, 1092, -2847 },
-  { -5503, -2883, 1984, -2067 },
-  { -4671, -4218, -1417, -4132 },
-  { -3763, -3818, 1262, -3082 },
-  { -5132, -3430, 2928, -728 },
-  { -5957, -2877, 1251, -2446 },
-  { -4425, -2319, -212, -4276 },
-  { -6201, -1993, 1774, -2182 },
-  { -5500, -3836, 2201, -1396 },
-  { -6934, -2334, 2366, -1293 },
-  { -6124, -4140, 1337, -1977 },
-  { -6553, -4186, 1756, -1325 },
-  { -5126, -1258, 744, -3656 },
-  { -5167, -1390, 1581, -2895 },
-  { -4525, -3398, 2429, -1865 },
-  { -4076, -3183, 2027, -2510 },
-  { -6191, -3274, 1838, -1814 },
-  { -4454, -2753, 2723, -1185 },
-  { -6655, -4797, 251, -2595 },
-  { -6332, -2232, 1832, 217 },
-  { -5869, -1698, 134, 340 },
-  { -6614, -1045, 2126, -1932 },
-  { -4859, -2107, 2010, -2435 },
-  { -6274, -1622, 2808, -1374 },
-  { -3119, -3209, 521, -3988 },
-  { -5676, -2082, -420, -2711 },
-  { -7073, -3623, 696, -2343 },
-  { -5986, -4224, 572, -2454 },
-  { -4340, -4521, 882, -2771 },
-  { -6178, -1933, 535, -1444 },
-  { -4923, -4163, 1744, -2066 },
-  { -6410, -1519, 1058, -2683 },
-  { -5077, -1185, 856, -2216 },
-  { -7091, -2444, 687, -2597 },
-  { -5284, -2165, 3239, -993 },
-  { -4763, -1497, 197, -3179 },
-  { -4128, -4958, -396, -3578 },
-  { -5054, -3878, -647, -2672 },
-  { -7005, -3348, 1679, -1579 },
-  { -5767, -1017, 2582, -1915 },
-  { -7069, -2787, 1331, -2070 },
-  { -5532, -2296, 706, -2950 },
-  { -5059, -3543, -821, -3637 },
-  { -6639, -1835, 1016, -696 },
-  { -5611, -5220, -694, -3371 },
-  { -5994, -2803, 2933, -729 },
-  { -5948, -619, 1596, -2676 },
-  { -5486, -4419, 153, -3265 },
-  { -4329, -3440, 1646, -1439 },
-  { -4083, -3978, 177, -3569 },
-  { -4289, -2599, 1224, -3075 },
-  { -5707, -3253, 1912, -759 },
-  { -6606, -3437, 2562, -571 },
-  { -5254, -2444, 769, -352 },
-  { -6545, -3154, 582, -1103 },
-  { -5328, -2241, 2566, -1775 },
-  { -7216, -1936, 1538, -1983 },
-  { -3730, -2451, 426, -3869 },
-  { -5110, -1385, 2031, -1169 },
-  { -6470, -2715, 269, -3123 },
-  { -5806, -2480, -97, -3832 },
-  { -3683, -4916, -490, -4330 },
-  { -6341, -2083, -669, -115 },
-  { -4913, -4079, -837, -4673 },
-  { -3274, -2497, 2334, -2652 },
-  { -1286, -1731, 2550, -3756 },
-  { -3375, -877, 926, -3977 },
-  { -2525, -2079, 2879, -2625 },
-  { -5308, -504, 3111, -1607 },
-  { -4904, 460, 4093, -1232 },
-  { -1993, 1616, 4656, -1913 },
-  { -3481, -1176, 3119, -2236 },
-  { -4132, -1502, 2339, -2545 },
-  { -2542, 1151, 3569, -2550 },
-  { -4381, 430, 3147, -2082 },
-  { -3888, 867, 3899, -1657 },
-  { -2861, 1290, 4202, -1979 },
-  { -3893, -253, 2363, -2764 },
-  { -1705, 688, 3827, -2923 },
-  { -2223, 2312, 3700, -3148 },
-  { -1986, -720, 5021, -795 },
-  { -3177, 242, 1952, -3352 },
-  { -1854, 1509, 2528, -3815 },
-  { -3173, 97, 5019, -706 },
-  { -2689, -145, 1375, -3915 },
-  { -4838, -385, 2488, -2427 },
-  { -4557, -355, 1603, -3060 },
-  { -3522, 1832, 3292, -2674 },
-  { -3769, 780, 2378, -2704 },
-  { -4323, -1932, 3414, -1169 },
-  { -2740, 1158, 2729, -3273 },
-  { -3647, 210, 1464, -2892 },
-  { -2342, -2097, 1513, -3727 },
-  { -4422, -1242, 3130, -1833 },
-  { -1308, -1039, 4290, -1875 },
-  { -1754, -2535, 3298, -2314 },
-  { -4102, -186, 4037, -1094 },
-  { -1008, 1570, 3290, 171 },
-  { -3322, -2621, 2791, -1536 },
-  { -2539, -2597, 3442, -1672 },
-  { -3411, -2015, 3670, -1174 },
-  { -2097, 730, 5581, -1399 },
-  { -1510, -74, 4820, -2004 },
-  { -4086, -868, 4425, -771 },
-  { -956, -986, 3640, -2925 },
-  { -2087, -1250, 3464, -2458 },
-  { -3308, -2411, 1334, -3667 },
-  { -2264, -389, 4004, -1854 },
-  { -680, 239, 4058, -3388 },
-  { -1357, 30, 2993, -3658 },
-  { -3601, -552, 1177, -1136 },
-  { -2641, 442, 4374, -1625 },
-  { -2525, 770, 1640, -3895 },
-  { -3172, -891, 3893, -1608 },
-  { -2996, 13, 3277, -2414 },
-  { -899, 1055, 4470, -2501 },
-  { -422, -584, 3475, -3787 },
-  { -1978, -593, 2566, -3415 },
-  { -3150, -1280, 2362, -3047 },
-  { -3592, 224, 1026, -3932 },
-  { -4840, -1189, 3633, -879 },
-  { -3952, -2255, 2916, -1826 },
-  { -1695, 28, 1810, -349 },
-  { -745, -2484, 3308, -3293 },
-  { -1016, 1563, 5365, -1823 },
-  { -2172, -1787, 4266, -1287 },
-  { -1241, -1951, 3982, -2413 },
-  { -2009, -2639, 2330, -3480 },
-  { 5105, -1618, -2588, -2015 },
-  { 6497, -1523, -3218, -910 },
-  { 6526, -2305, -2029, -1790 },
-  { 5289, -99, -3436, -400 },
-  { 5781, -1623, -1577, -2617 },
-  { 5259, -670, -3125, -1700 },
-  { 6343, -1256, -331, -3222 },
-  { 7967, -678, -2195, -1462 },
-  { 6119, -695, -2988, -1538 },
-  { 6108, 494, -3359, -1548 },
-  { 5067, 969, -2328, -2707 },
-  { 7595, -435, -1497, -2056 },
-  { 6929, -719, -2420, -1665 },
-  { 5190, 584, -2982, -2103 },
-  { 6106, -444, -1411, -2739 },
-  { 5584, 289, -1804, -2803 },
-  { 5276, 227, -1180, -3361 },
-  { 7544, -1525, -1834, -1725 },
-  { 5986, -1470, -2606, -1701 },
-  { 5096, -765, -1712, -3006 },
-  { 5423, -149, -3933, -1157 },
-  { 7651, 26, -2445, -1507 },
-  { 4745, -464, -1735, -2362 },
-  { 5352, -1011, -1094, -1999 },
-  { 6300, -672, -542, -1950 },
-  { 6675, -1020, -1318, -1059 },
-  { 7218, -2036, -603, -2462 },
-  { 7755, -1514, -2430, -1229 },
-  { 5041, 449, -1056, -2405 },
-  { 6710, -2277, -1344, -2284 },
-  { 6824, -1347, -2254, 251 },
-  { 6068, -1857, -983, -1316 },
-  { 5603, -2177, -2730, -1477 },
-  { 5838, -1059, -3604, -970 },
-  { 5076, -789, -335, -2413 },
-  { 6191, -1634, -2000, -2129 },
-  { 5092, -1292, -2543, -1034 },
-  { 5305, 435, -1710, -1850 },
-  { 6140, 561, -2176, -2380 },
-  { 6752, 348, -2496, -1890 },
-  { 6405, 273, -1098, -2778 },
-  { 6942, -1340, -496, -1381 },
-  { 5238, -687, -2454, -2349 },
-  { 6959, -882, -1833, -2061 },
-  { 6292, -253, -2125, -2199 },
-  { 5838, -574, -759, -3215 },
-  { 6954, -1484, -640, -2771 },
-  { 7498, -1706, -1210, -2154 },
-  { 6772, -1003, -1235, -2532 },
-  { 6014, 228, -2154, -1108 },
-  { 6943, -2178, -2644, -1122 },
-  { 7262, -763, -3056, -1090 },
-  { 6273, -1478, -1072, 177 },
-  { 4734, 425, -2912, 357 },
-  { 7129, 168, -1537, -2327 },
-  { 7204, -434, -746, -2660 },
-  { 6879, 57, -3087, -1310 },
-  { 4623, -610, -718, -3459 },
-  { 6565, -543, -1998, -339 },
-  { 4752, -277, -2066, -1405 },
-  { 7435, -1416, -1904, -505 },
-  { 4076, 150, -1222, -3556 },
-  { 7082, -28, -1456, -1174 },
-  { 5941, -446, -1326, -1158 },
-  { 3870, -1648, -2474, -2589 },
-  { 858, 37, -3387, -3721 },
-  { 3557, -1503, -1664, -3383 },
-  { 3336, -1972, -3079, -2216 },
-  { 3186, 60, -4185, -863 },
-  { 3456, -773, -3066, -2457 },
-  { 4131, -913, -2060, -2601 },
-  { 4431, -691, -4114, -972 },
-  { 3461, -334, -3680, -1751 },
-  { 2006, -459, -2214, -3827 },
-  { 1322, 32, -2816, -3203 },
-  { 4425, -1897, -2791, -1946 },
-  { 4504, 23, -3421, -1909 },
-  { 3090, -885, -2366, -3264 },
-  { 3209, -2363, -3730, -834 },
-  { 3312, -1471, -3641, -1579 },
-  { 4184, -1669, -3323, -1248 },
-  { 2190, -931, -3302, -2944 },
-  { 2947, -229, -4791, -1195 },
-  { 2020, -1626, -2700, -3125 },
-  { 2214, -326, -4352, -1683 },
-  { 3286, -2619, -2412, -2458 },
-  { 1000, -2571, -4129, -2158 },
-  { 2496, -2627, -3611, -1433 },
-  { 2043, -2191, -2167, -3827 },
-  { 2571, -2544, -1915, -3222 },
-  { 2022, -1501, -3856, -2165 },
-  { 2685, -1180, -1461, -4038 },
-  { 1610, -2313, -4391, -1173 },
-  { 2340, -2490, -4215, -516 },
-  { 1742, -2615, -3632, -2146 },
-  { 523, -1293, -4246, -2442 },
-  { 3725, -2723, -3014, -1576 },
-  { 3554, -1381, -4200, -824 },
-  { 1291, -1594, -4777, -1430 },
-  { 1452, 515, -2960, -3830 },
-  { 4264, -894, -3305, -1826 },
-  { 2606, -1452, -4522, -966 },
-  { 1196, -830, -4807, -1816 },
-  { 1054, -775, -2616, -4071 },
-  { 4206, 415, -4344, -1132 },
-  { 3044, 491, -4126, -1934 },
-  { 988, -901, -3353, -3443 },
-  { 1729, -3063, -2267, -3370 },
-  { 3915, 912, -2989, -2387 },
-  { 3781, 300, -2457, -3050 },
-  { 2712, 924, -1350, -1206 },
-  { 4230, 405, -2343, 665 },
-  { 1878, -873, -225, -29 },
-  { 3510, 56, -1334, -3420 },
-  { 2850, 1447, -2651, -3150 },
-  { 1510, -706, -4125, -2483 },
-  { 3115, 793, -1692, -3894 },
-  { 2667, 213, -2973, -2786 },
-  { 1184, -2384, -3051, -3173 },
-  { 2139, 796, -2079, -3697 },
-  { 1464, -1483, -3726, -2754 },
-  { 2407, -1148, -3915, -1569 },
-  { 2612, -1779, -3217, -2271 },
-  { 2406, -2870, -2937, -2496 },
-  { 2140, 126, -3646, -2758 },
-  { 2952, -1036, 268, -1423 },
-  { 93, -1931, -3841, -3535 },
-  { 389, -2953, -3383, -3343 },
-  { 8652, -5511, -1662, 565 },
-  { 7427, -2791, -2535, -842 },
-  { 8541, -4253, -1407, -988 },
-  { 8018, -3203, -2998, 105 },
-  { 7231, -3926, -958, 1308 },
-  { 7331, -3690, -363, 2586 },
-  { 6803, -3646, -2226, -903 },
-  { 8163, -2811, -477, -2235 },
-  { 9356, -3818, -1685, -684 },
-  { 8466, -2854, -302, -698 },
-  { 8458, -3224, 517, 279 },
-  { 8074, -2619, -1326, 2596 },
-  { 8779, -2761, -2527, -441 },
-  { 6533, -2887, -899, -696 },
-  { 7394, -2305, -1642, -120 },
-  { 8281, -3780, -22, 1305 },
-  { 9158, -4413, -779, 901 },
-  { 9031, -5240, -1109, 1678 },
-  { 8717, -3650, 410, -1075 },
-  { 7317, -3197, -818, -2264 },
-  { 7934, -2385, -1214, -1886 },
-  { 8256, -4441, -291, -587 },
-  { 7358, -3395, 1090, -270 },
-  { 9446, -4910, -1343, -473 },
-  { 8187, -4726, -808, 1166 },
-  { 7504, -3845, -47, 267 },
-  { 8029, -2146, -1283, -383 },
-  { 7461, -2705, -853, 783 },
-  { 9367, -3636, -645, -354 },
-  { 8955, -3473, -308, -1947 },
-  { 8676, -2683, -2099, 1485 },
-  { 7481, -3003, -871, -444 },
-  { 8015, -2839, -1673, 1175 },
-  { 6947, -4643, -1527, -1047 },
-  { 7622, -2575, -137, -960 },
-  { 9388, -4279, -707, -1322 },
-  { 8382, -5259, -1283, -565 },
-  { 6856, -4138, -1030, 630 },
-  { 8659, -2571, -1124, -1666 },
-  { 8763, -3807, -537, 2543 },
-  { 8049, -3578, -2186, -604 },
-  { 8272, -2351, -1985, -1214 },
-  { 6855, -3796, -1527, -1631 },
-  { 7178, -2896, -1600, -1756 },
-  { 7040, -2888, -89, -1586 },
-  { 6261, -3403, -264, 998 },
-  { 7756, -4699, -1543, -834 },
-  { 7682, -4622, -758, -1721 },
-  { 8839, -4232, -2932, 1959 },
-  { 9363, -4679, -1956, 39 },
-  { 7883, -3616, -1414, -1432 },
-  { 8828, -3188, -1356, -1312 },
-  { 7746, -3987, -121, -2424 },
-  { 9262, -3256, -693, 818 },
-  { 7670, -3420, -148, 3504 },
-  { 7344, -3183, 608, 1595 },
-  { 8976, -4139, -1848, 1304 },
-  { 6708, -4131, 33, -852 },
-  { 7840, -4429, -2275, 79 },
-  { 8980, -3858, -2838, 453 },
-  { 7815, -4604, -2563, 944 },
-  { 8372, -4422, -1783, 3071 },
-  { 8623, -5128, -1754, 2888 },
-  { 7462, -3281, 889, 920 },
-  { 8416, -59, -1320, -1825 },
-  { 7928, -1488, -414, -2499 },
-  { 8110, -977, -1047, -2042 },
-  { 8278, -687, -1597, -1550 },
-  { 7988, -174, -977, -2106 },
-  { 8609, -1547, -1628, -1527 },
-  { 9000, -1798, -946, -1761 },
-  { 8954, -872, -1404, -1594 },
-  { 8939, 466, -748, -1212 },
-  { 9549, -329, -177, -1360 },
-  { 9411, -18, -1126, -1568 },
-  { 8859, -782, -488, -1338 },
-  { 8955, -218, -43, -1209 },
-  { 9131, -69, -453, -1001 },
-  { 9069, -1519, -1091, -1199 },
-  { 9247, -1309, -566, -1146 },
-  { 8528, -1617, -287, -1313 },
-  { 7763, -745, -149, -2040 },
-  { 8294, -343, 257, -2633 },
-  { 10149, -893, -552, -1649 },
-  { 9398, -915, 218, -2042 },
-  { 9703, -1194, -675, -1592 },
-  { 9586, -700, -427, -1710 },
-  { 8930, 497, -1445, -1218 },
-  { 9285, -1323, -163, -1552 },
-  { 8431, -1289, -985, -1404 },
-  { 8965, -655, 653, -1483 },
-  { 9542, -1001, -951, -1128 },
-  { 9205, -647, -37, -882 },
-  { 8603, -56, 514, -1793 },
-  { 9300, -12, -1324, -567 },
-  { 8773, 238, -184, -1456 },
-  { 9941, -1306, -69, -1792 },
-  { 9360, 279, -376, -1919 },
-  { 9180, -285, 95, -2170 },
-  { 9922, -501, -970, -1570 },
-  { 8341, -1493, -856, -2092 },
-  { 8780, -981, -850, -1014 },
-  { 9721, -548, -1504, -1094 },
-  { 9973, -1493, 482, -2105 },
-  { 8707, -333, -1027, -1087 },
-  { 9098, -469, -315, -1723 },
-  { 8879, -1050, -661, -2020 },
-  { 8857, 602, -866, -1918 },
-  { 8945, -1025, -2154, -1071 },
-  { 8484, -1930, -468, -2179 },
-  { 9177, -1903, -224, -2112 },
-  { 8652, -137, -2097, -1214 },
-  { 9063, -973, -1405, -772 },
-  { 9328, -456, 662, -2469 },
-  { 10101, -697, 127, -2113 },
-  { 9685, 811, -2359, -1024 },
-  { 8586, -94, -460, -1982 },
-  { 7924, -141, -509, -2513 },
-  { 7773, -669, -107, -2835 },
-  { 8636, -1064, -46, -2409 },
-  { 9748, 596, -1815, -1349 },
-  { 8924, 304, 547, -2614 },
-  { 9442, 746, -1153, -1679 },
-  { 9454, -278, -529, -1976 },
-  { 8488, 561, -32, -2160 },
-  { 10083, -63, -1544, -1364 },
-  { 9390, -1278, 568, -1131 },
-  { 9740, -49, -2253, -910 },
-  { 3636, -2391, -1115, -3614 },
-  { 6014, -3204, -1902, -1808 },
-  { 5787, -3497, -1116, -2590 },
-  { 4365, -3046, -1632, -2668 },
-  { 4733, -2192, -2029, -2468 },
-  { 5412, -2753, -1633, -2464 },
-  { 4455, -3375, -767, -3399 },
-  { 4456, -1644, -983, -2841 },
-  { 4039, -2523, 38, -3967 },
-  { 3406, -2662, 72, -4757 },
-  { 4279, -2005, 1055, -4399 },
-  { 4321, -1377, -860, -3786 },
-  { 3743, -5739, -651, -3047 },
-  { 3528, -5510, 361, -4060 },
-  { 6496, -4886, -136, -2689 },
-  { 4513, -5254, 551, -4010 },
-  { 6557, -3413, -92, -3063 },
-  { 4186, -2059, 187, 47 },
-  { 6210, -4117, -1256, -1985 },
-  { 6038, -4343, 351, -2124 },
-  { 4305, -4780, -2077, -1897 },
-  { 4480, -3815, -2228, -1533 },
-  { 5582, -3689, 1221, -3429 },
-  { 5532, -4874, 1195, -2765 },
-  { 6518, -2853, -905, -2568 },
-  { 5467, -2192, 470, -4115 },
-  { 4139, -1577, 240, -3493 },
-  { 5281, -1926, -729, -3340 },
-  { 5214, -2870, 1359, -4289 },
-  { 3046, -3510, -1536, -3214 },
-  { 5433, -2881, -1230, -1184 },
-  { 4861, -3932, -1071, -2791 },
-  { 5693, -4234, -1906, -1502 },
-  { 4004, -3935, -1804, -2383 },
-  { 3728, -3792, 681, -4773 },
-  { 3621, -3030, -1951, -2598 },
-  { 5133, -3903, 44, -3700 },
-  { 3561, -3451, 1183, -5301 },
-  { 5026, -2762, -2341, -1780 },
-  { 5841, -2492, -467, -3210 },
-  { 5591, -1791, 497, -2472 },
-  { 5054, -3898, -1822, -2097 },
-  { 5813, -2792, 83, -1469 },
-  { 4432, -4497, 1670, -5193 },
-  { 5338, -4653, -1109, -2200 },
-  { 3239, -4401, -648, -3655 },
-  { 2147, -3598, -1200, -4242 },
-  { 4417, -2271, -1552, -3210 },
-  { 6494, -4360, 852, -3565 },
-  { 2393, -6358, -856, -4524 },
-  { 4959, -4196, -847, -1403 },
-  { 4924, -5438, -226, -3026 },
-  { 4254, -5303, -1306, -2424 },
-  { 4121, -3126, -2334, -1981 },
-  { 3437, -4443, -1464, -2953 },
-  { 3203, -3459, -529, -4339 },
-  { 5896, -5945, 543, -3246 },
-  { 1987, -4733, -220, -4863 },
-  { 4358, -4431, -514, -3081 },
-  { 4583, -2416, -492, -2287 },
-  { 2943, -5035, 419, -4927 },
-  { 5358, -5129, 987, -4309 },
-  { 4460, -3392, 1752, -5634 },
-  { 3415, -4633, 1507, -5945 },
-  { 811, -4692, -445, 2333 },
-  { 1009, -5613, -1857, 1360 },
-  { 1338, -2712, -2720, 3036 },
-  { 1002, -3754, -2582, 2344 },
-  { 750, -4608, -2334, 714 },
-  { 2043, -3207, -2822, 2173 },
-  { -140, -4654, -2953, 357 },
-  { -54, -4026, -2376, 2695 },
-  { 1858, -5022, -717, 2287 },
-  { 2064, -3894, -722, 3255 },
-  { 2727, -4558, -332, 2603 },
-  { 1810, -5378, 283, 1826 },
-  { 3935, -4326, 762, 3383 },
-  { -767, -4697, -2510, 1922 },
-  { 2146, -4312, -3090, 1641 },
-  { 54, -5881, -2114, 921 },
-  { 1992, -5766, -640, 1574 },
-  { 1200, -5371, -1114, 1828 },
-  { 2973, -5337, 34, 2266 },
-  { 1531, -5018, -2817, 1192 },
-  { 3078, -4570, 117, 1990 },
-  { 924, -4286, -1388, 2713 },
-  { 142, -5058, -2848, 1487 },
-  { -106, -6180, -881, 842 },
-  { 673, -5433, -229, 1596 },
-  { 783, -5710, -2784, 562 },
-  { 1935, -5729, -2009, 856 },
-  { -410, -3375, -3326, 2734 },
-  { 234, -3000, -2628, 3260 },
-  { 733, -3405, -3806, 1589 },
-  { 771, -4285, -3544, 1314 },
-  { 1192, -3563, -3960, 2178 },
-  { 206, -5555, -1250, 1546 },
-  { -130, -3815, -1210, 3041 },
-  { 646, -3940, -393, 2992 },
-  { -184, -4931, -1767, 1925 },
-  { 2746, -5120, -2275, 1464 },
-  { 2440, -3731, -3352, 2729 },
-  { -490, -4942, -3779, 997 },
-  { 68, -2636, -4167, 3778 },
-  { 48, -3986, -4118, 2106 },
-  { -978, -5486, -1336, 1390 },
-  { 1126, -5297, -855, 640 },
-  { -472, -3975, -3622, 1557 },
-  { 2456, -5344, -1523, 1648 },
-  { -774, -5652, -2417, 1147 },
-  { 995, -6122, -812, 1132 },
-  { 3282, -4571, -1763, 2175 },
-  { 3655, -3862, -676, 3568 },
-  { 3038, -3647, -1672, 3381 },
-  { 2595, -2964, -2772, 3263 },
-  { 4176, -3353, -1148, 4354 },
-  { 1603, -3442, -1500, 3444 },
-  { 828, -6226, -1783, 678 },
-  { 1421, -3333, -3080, 3403 },
-  { 1121, -4727, -1924, 1984 },
-  { -186, -5083, -682, 1796 },
-  { 819, -2778, -3488, 530 },
-  { 421, -2873, -3832, 2596 },
-  { 2164, -4263, -1605, 2282 },
-  { 585, -4437, -682, -491 },
-  { -644, -4452, -1157, 2325 },
-  { 1991, -4299, 210, 2834 },
-  { 2135, -3632, -2113, 665 },
-  { -7482, -2724, -2662, -1380 },
-  { -6983, -2166, -3756, -3509 },
-  { -7085, -1439, -2397, -3112 },
-  { -7760, -3049, -3319, -2822 },
-  { -8413, -2760, -4406, -3298 },
-  { -5995, -3943, -1260, -3750 },
-  { -7879, -1554, -3464, -2606 },
-  { -6314, -2034, -3878, -1681 },
-  { -8849, -2084, -1399, -1231 },
-  { -7153, -2602, -1384, -817 },
-  { -8041, -2571, -407, -2785 },
-  { -7246, -2233, -1578, 260 },
-  { -7336, -3883, -4061, -1342 },
-  { -7619, -3908, -2342, 382 },
-  { -8684, -3724, -1662, -727 },
-  { -7850, -2922, -1770, -3449 },
-  { -6766, -2034, -1293, -1988 },
-  { -6895, -2116, -968, -3744 },
-  { -7136, -5147, -2618, -2809 },
-  { -8224, -3724, -2519, -1589 },
-  { -6711, -2750, -3021, -219 },
-  { -8059, -1638, -1102, -3175 },
-  { -8710, -4839, -3963, -3143 },
-  { -9363, -4965, -3257, -1002 },
-  { -6099, -1751, -3157, -395 },
-  { -6453, -3216, -4597, -483 },
-  { -7879, -5477, -839, -2638 },
-  { -7202, -4038, -526, -2856 },
-  { -8022, -1228, -1910, -1646 },
-  { -9117, -1393, -1582, -2535 },
-  { -9095, -2693, -636, -2605 },
-  { -9076, -2580, -3481, -2519 },
-  { -8327, -4859, -2422, 83 },
-  { -8368, -2129, -2324, -2173 },
-  { -8554, -4563, -3842, -2007 },
-  { -10462, -4261, -1934, -2084 },
-  { -9717, -3187, -2294, -1896 },
-  { -9625, -3889, -3020, -3224 },
-  { -9857, -4955, -4239, -2184 },
-  { -9752, -2351, -2277, -3129 },
-  { -7219, -1302, -2639, -1603 },
-  { -7477, -4360, -3718, -559 },
-  { -5680, -2033, -2326, -3078 },
-  { -10190, -5548, -4643, -3601 },
-  { -9431, -4121, -879, -2479 },
-  { -8365, -5450, -2020, -1439 },
-  { -6289, -5178, -1605, -3845 },
-  { -8319, -3866, -687, -2792 },
-  { -8131, -1031, -3608, -3947 },
-  { -10510, -2560, -1199, -2082 },
-  { -11015, -3640, -2748, -3041 },
-  { -8762, -5022, -5231, -1162 },
-  { -10153, -2715, -4648, -4859 },
-  { -7930, -5205, -1900, -3600 },
-  { -9561, -3548, -4812, -3722 },
-  { -7663, -4709, -1180, -1475 },
-  { -9073, -5707, -1815, -2980 },
-  { -8602, -2363, -2675, -3770 },
-  { -9967, -5614, -3575, -3838 },
-  { -8324, -1005, -2131, -3254 },
-  { -10331, -5737, -2550, -2940 },
-  { -8234, -3354, -3361, -4479 },
-  { -8140, -1951, -4526, -4545 },
-  { -6679, -2662, -2284, -4182 },
-  { -1122, -1514, -6427, -212 },
-  { 54, -1660, -5424, -1404 },
-  { 254, -2778, -5222, 846 },
-  { -267, -1661, -6577, 814 },
-  { -305, -2021, -5759, 1484 },
-  { -1791, -2446, -6867, -86 },
-  { -2929, -3158, -6603, -1799 },
-  { -1391, -3189, -5557, -1053 },
-  { -1602, -884, -6767, -1213 },
-  { -361, -318, -6219, -44 },
-  { -4078, -2635, -5523, -433 },
-  { -956, 478, -4382, 1470 },
-  { -3300, -2462, -6021, -2721 },
-  { 708, -2434, -5085, -540 },
-  { -2435, -3607, -5647, -2110 },
-  { -491, -1134, -4681, -2886 },
-  { 87, -3435, -4641, -1194 },
-  { -586, -2927, -4784, 366 },
-  { -1394, -2326, -6021, 350 },
-  { 97, -2519, -4678, -2120 },
-  { -1547, -1907, -5069, -2993 },
-  { 268, -3724, -4719, 127 },
-  { -827, -1190, -5912, 1144 },
-  { -3959, -2322, -6898, -1974 },
-  { -2728, -2228, -6426, -562 },
-  { -456, -666, -5785, -1609 },
-  { 531, -1096, -5731, -656 },
-  { -3569, -688, -3915, 110 },
-  { -4752, -1725, -4393, -377 },
-  { -3210, -3315, -6960, -840 },
-  { -688, -3416, -4971, 1221 },
-  { -1833, 77, -6491, -2434 },
-  { -239, -255, -6850, -886 },
-  { -2112, -1490, -6291, -2689 },
-  { -1544, -4579, -5198, -1261 },
-  { -2771, -4014, -5520, 683 },
-  { -1635, -2829, -5512, 1214 },
-  { -958, -2582, -4823, 2360 },
-  { -2077, -4566, -4642, 365 },
-  { -3112, -4214, -5960, -823 },
-  { -2467, -2510, -4858, 1467 },
-  { -1561, -3399, -5822, 211 },
-  { -775, -1081, -4424, 2636 },
-  { -1263, 25, -6378, -1392 },
-  { -3476, -366, -5417, -1393 },
-  { -3176, -1476, -4149, 1466 },
-  { -2479, 518, -4448, -257 },
-  { -2992, 158, -4660, -1279 },
-  { -1320, -3872, -4479, 1147 },
-  { -1475, -312, -5318, 539 },
-  { -3527, -1679, -5860, -1681 },
-  { -3397, -3438, -5593, 1866 },
-  { -4089, -2439, -4763, 1275 },
-  { -748, -4513, -4687, -48 },
-  { -2166, -4531, -4691, -2856 },
-  { -2385, -853, -6035, -627 },
-  { -1194, -4091, -4472, -1963 },
-  { -682, -3234, -4084, -3033 },
-  { -3255, -5015, -5328, -12 },
-  { -2313, -3436, -4601, -155 },
-  { -2792, -1038, -6947, -2019 },
-  { -1244, -1526, -5771, -1882 },
-  { -4679, -3731, -5506, 283 },
-  { -3062, -66, -3558, -758 },
-  { -4895, -1187, 4751, 3728 },
-  { -7600, -2752, 3320, 4613 },
-  { -5703, -2975, 3944, 2659 },
-  { -4972, -1257, -246, 2952 },
-  { -4221, -2487, 1702, 4295 },
-  { -2900, -1529, 2458, 4935 },
-  { -5061, 407, 2416, 4050 },
-  { -6931, -3478, 2761, 2213 },
-  { -6037, -3921, 3192, 1866 },
-  { -6113, -811, 2407, 3782 },
-  { -5878, -1716, 1207, 3478 },
-  { -5953, -2853, 2207, 2712 },
-  { -6807, -3223, 2749, 3595 },
-  { -3272, -3157, 1389, 3788 },
-  { -5368, -1904, 1980, 5077 },
-  { -7235, -1398, 3075, 4548 },
-  { -4765, -3487, 2755, 2796 },
-  { -7658, -4435, 2694, 2582 },
-  { -6997, -4282, 456, 3832 },
-  { -5563, -3115, -63, 3713 },
-  { -4244, -4220, 1450, 2767 },
-  { -3801, -2194, 190, 4303 },
-  { -5458, -4119, 1958, 2274 },
-  { -7300, -3469, 3514, 3193 },
-  { -4594, -2067, 775, 4752 },
-  { -3389, -1654, 1464, 5412 },
-  { -4845, -3483, 964, 3437 },
-  { -6007, -2818, 1666, 4659 },
-  { -8709, -5007, 1757, 3287 },
-  { -5833, -4389, 1025, 3171 },
-  { -5788, -1780, 3944, 3661 },
-  { -4430, -920, 1938, 4753 },
-  { -7066, -1857, 4591, 4538 },
-  { -3549, -513, 1427, 5317 },
-  { -7517, -1220, 2883, 3049 },
-  { -7605, -2687, 1874, 2735 },
-  { -8718, -4035, 2676, 3730 },
-  { -7990, -3907, 1185, 2607 },
-  { -6058, -1744, 3349, 5157 },
-  { -5954, 565, 3161, 3250 },
-  { -6478, -612, 1930, 2271 },
-  { -6535, -1445, -2, 1618 },
-  { -8963, -4151, 1192, 4044 },
-  { -7227, -3570, 1600, 4234 },
-  { -4674, 79, 595, 3015 },
-  { -3974, 430, 2727, 5137 },
-  { -5299, 9, 3714, 4779 },
-  { -6779, -2699, -8, 2436 },
-  { -7016, -1145, 1293, 2310 },
-  { -6955, -3312, 1534, 1801 },
-  { -4025, 740, 1850, 4054 },
-  { -9589, -3460, 4154, 5270 },
-  { -4404, -1181, 4298, 5173 },
-  { -7356, -4583, -18, 2644 },
-  { -6516, -1235, 4439, 6234 },
-  { -3453, -301, 4344, 4464 },
-  { -4643, 1530, 3315, 4340 },
-  { -4575, -2557, 3754, 3682 },
-  { -3643, -3501, 2051, 2997 },
-  { -5412, -2475, 2301, 1579 },
-  { -5846, 259, 1360, 2348 },
-  { -5258, -1358, 1050, 838 },
-  { -5542, -219, 6377, 5750 },
-  { -5713, -2952, 922, 899 },
-  { -2049, -1135, 5206, 1033 },
-  { -1693, -1886, 4835, -106 },
-  { -2344, -3504, 4232, -13 },
-  { -2475, -2334, 5043, 1126 },
-  { -787, -2549, 3880, 2138 },
-  { -3159, -2341, 4830, 2887 },
-  { -1780, -1009, 6240, 2061 },
-  { -4327, -3363, 2818, 886 },
-  { -3376, -2743, 4104, 207 },
-  { -3250, -4640, 2718, 1498 },
-  { -382, -1075, 4382, 3460 },
-  { -2416, -4168, 3530, 816 },
-  { -1756, -2708, 4861, 622 },
-  { -1879, -2097, 5156, 2889 },
-  { -2496, -2418, 3722, 2671 },
-  { -2717, -3252, 3341, 1944 },
-  { -4063, -4091, 3306, 267 },
-  { -3549, -3808, 3747, 842 },
-  { -2635, 546, 5794, 1894 },
-  { -1857, -1121, 4383, 3964 },
-  { -2226, -2166, 3489, 3678 },
-  { -3492, -660, 5323, 1063 },
-  { -3033, -3130, 4382, 1828 },
-  { -2703, -625, 6369, 2851 },
-  { -1656, -2842, 4584, -528 },
-  { -4781, -2622, 4390, 2097 },
-  { -413, -2045, 5081, 3035 },
-  { -3810, -2662, 4532, 1095 },
-  { -3144, -1858, 5215, 1880 },
-  { -3562, -1795, 4928, 670 },
-  { -4800, -1509, 5189, 1859 },
-  { -1085, -3832, 4169, 900 },
-  { -1969, -3270, 2857, 2878 },
-  { -4267, -4140, 3176, 1805 },
-  { -5145, -3727, 3524, 1168 },
-  { -1346, -1876, 5501, 1748 },
-  { -4998, -2945, 3699, 338 },
-  { -3458, -3096, 3406, -635 },
-  { -1751, -3209, 3508, 395 },
-  { -2507, 170, 5987, 705 },
-  { -3756, -1072, 5647, 3536 },
-  { -2870, -1439, 5026, 3212 },
-  { -3913, -3225, 3669, 2144 },
-  { -3739, 226, 5747, 764 },
-  { -2052, -820, 5266, 3093 },
-  { -3214, -3820, 2409, 2391 },
-  { -4398, -2588, 3501, -218 },
-  { -4484, -1763, 4180, -198 },
-  { -3368, -1525, 4362, -134 },
-  { -2407, 224, 4905, 3533 },
-  { -1369, -2937, 4728, 1788 },
-  { -4848, -1707, 4159, 851 },
-  { -3454, -1749, 4281, 3230 },
-  { -1990, -3853, 3487, 1735 },
-  { -3117, 92, 6155, 4075 },
-  { -2676, -2472, 4078, -589 },
-  { -1547, -2012, 2626, 1835 },
-  { -4275, -588, 4824, 725 },
-  { -601, -2249, 3736, 3548 },
-  { -4060, -61, 5333, 3097 },
-  { -4303, 7, 6551, 3054 },
-  { -5003, -1029, 5786, 3319 },
-  { -2810, -728, 5392, 199 },
-  { -1232, -200, 5228, 3121 },
-  { 2621, 165, -6255, 298 },
-  { 3669, 537, -6844, 1564 },
-  { 1598, -1190, -6235, 2523 },
-  { 2164, -32, -6894, 1383 },
-  { 853, -1597, -6069, 1449 },
-  { 1377, -1661, -5266, 108 },
-  { 2660, 48, -5172, -517 },
-  { 1903, -391, -5677, 1010 },
-  { 3792, 206, -5274, -11 },
-  { 1239, 2776, -2929, 2721 },
-  { 4071, 149, -7259, 3125 },
-  { 1436, -480, -6156, -196 },
-  { 1373, -1960, -5005, 3122 },
-  { 3413, -1271, -5176, 3283 },
-  { 3060, -68, -6495, 2238 },
-  { 2700, -2075, -4681, 91 },
-  { 2928, -1728, -5168, 1858 },
-  { 4424, 828, -4471, 88 },
-  { 2672, -2604, -4038, 2753 },
-  { 5223, -123, -6749, 2295 },
-  { 4237, -420, -5538, 1353 },
-  { 4744, -1281, -4097, 4708 },
-  { 1103, -2764, -4751, 2024 },
-  { 3747, -1913, -3911, 3960 },
-  { 2470, -1416, -5542, 615 },
-  { 4847, -1354, -5334, 1733 },
-  { 5336, 88, -7593, 4007 },
-  { 2388, -2880, -4807, 1037 },
-  { 4495, 1391, -5685, -139 },
-  { 5253, 1637, -6450, 1533 },
-  { 1199, 795, -5515, 1261 },
-  { 1397, -1259, -4252, 3838 },
-  { 746, 70, -6640, 604 },
-  { 1584, 166, -4972, 3072 },
-  { 380, -999, -5397, 2267 },
-  { 2974, 1707, -3242, 5360 },
-  { 5202, -403, -5453, 2832 },
-  { 3718, -1731, -4760, 714 },
-  { 4150, -975, -4792, 61 },
-  { 2925, -818, -4841, 15 },
-  { 5301, 577, -4006, 3259 },
-  { 5265, 1986, -5679, 3028 },
-  { 3752, 1928, -4509, 3729 },
-  { 3278, 1925, -6370, 1247 },
-  { 5107, 1721, -4853, 3127 },
-  { 3279, 2982, -2515, 4005 },
-  { 4622, 668, -6204, 759 },
-  { 6034, 317, -5763, 4818 },
-  { -558, 57, -3785, 2817 },
-  { 4476, 1616, -3965, 4536 },
-  { 5953, 2056, -8215, 2715 },
-  { 4387, 2613, -7463, 868 },
-  { 5834, 1088, -4736, 4924 },
-  { 6473, -856, -6991, 4172 },
-  { 4959, -293, -5162, 76 },
-  { 2731, -843, -6119, 3847 },
-  { 3245, 1202, -6833, 616 },
-  { 2553, 1383, -3829, 3859 },
-  { 4332, 2099, -3480, 3622 },
-  { 2110, 2683, -2728, 3990 },
-  { 876, 1167, -3290, 3466 },
-  { 3991, 1709, -2410, 4077 },
-  { 5105, 939, -2584, 3256 },
-  { 4719, 688, -1566, 3040 },
-  { -3632, 4335, 1266, -3303 },
-  { -4956, 3207, 1312, -2806 },
-  { -4669, 2627, 2663, -2435 },
-  { -4282, 3708, 2303, -3038 },
-  { -4536, 2297, -175, -3350 },
-  { -5234, 2503, -139, -880 },
-  { -3978, 1512, 1092, -3619 },
-  { -4519, 4649, 1363, -2455 },
-  { -5118, 3132, 1961, -1577 },
-  { -5196, 3379, -182, -1378 },
-  { -6420, 4486, 2397, -1993 },
-  { -5030, 5046, 1292, -1118 },
-  { -4559, 2573, -927, -1406 },
-  { -3501, 3730, 691, -4930 },
-  { -4364, 2758, 1007, -3909 },
-  { -4026, 2839, -1559, -2340 },
-  { -5037, 4053, 836, -1571 },
-  { -4727, 5136, 1110, -3588 },
-  { -5245, 2799, -999, -2164 },
-  { -4954, 1501, 422, -3963 },
-  { -5994, 2726, 1462, -2833 },
-  { -5621, 5159, 2038, -2512 },
-  { -4991, 2291, 1917, -3151 },
-  { -5469, 4382, -148, -2978 },
-  { -5858, 1983, 807, -2720 },
-  { -4709, 3556, 952, -467 },
-  { -2489, 2362, 1714, -4230 },
-  { -4717, 5004, -1180, -3672 },
-  { -5914, 3653, 1359, -1317 },
-  { -5506, 2995, 780, -1059 },
-  { -5287, 3945, 2480, -2293 },
-  { -3849, 4358, 322, -1770 },
-  { -3911, 3570, 252, -3185 },
-  { -3660, 5128, 158, -3719 },
-  { -4599, 3277, -503, -2727 },
-  { -3673, 3760, -1252, -3339 },
-  { -5161, 2337, 388, -1943 },
-  { -3529, 2216, 2156, -3080 },
-  { -4309, 4331, 1808, -1460 },
-  { -4782, 3820, 480, -2504 },
-  { -4166, 3544, -378, -1567 },
-  { -5572, 2466, -418, -2909 },
-  { -6096, 2930, 119, -1878 },
-  { -5963, 3554, 1011, -2233 },
-  { -6433, 4335, 935, -2930 },
-  { -5004, 3314, -1352, -3430 },
-  { -6042, 3463, -1008, -3940 },
-  { -4671, 2214, -640, -5040 },
-  { -2795, 3759, 1412, -3803 },
-  { -3647, 4436, 729, -515 },
-  { -3594, 1033, 56, -4148 },
-  { -2908, 3027, 2889, -3485 },
-  { -3338, 2234, 313, -4285 },
-  { -3825, 4497, -561, -2634 },
-  { -6167, 3012, -48, -3149 },
-  { -4828, 3515, -969, -4475 },
-  { -5789, 2757, -539, -4173 },
-  { -2452, 3067, 564, -4249 },
-  { -4921, 1358, 1331, -2889 },
-  { -3127, 4239, -1045, -1523 },
-  { -4780, 2326, -1118, -3446 },
-  { -3908, 5546, 152, -2622 },
-  { -6972, 2976, 337, -2809 },
-  { -4839, 4613, -35, -4077 },
-  { -1408, 4822, -1149, -4997 },
-  { -981, 4979, -912, -6304 },
-  { -2098, 5689, -888, -2878 },
-  { -3343, 4814, -657, -4434 },
-  { -2461, 3601, -967, -4869 },
-  { -2652, 3944, 87, -5520 },
-  { -1104, 6076, 174, -6407 },
-  { 355, 5370, -1721, -5869 },
-  { 1242, 4497, -1107, -5091 },
-  { -89, 4002, -1491, -5182 },
-  { 1059, 5693, -1591, -4905 },
-  { 1323, 4682, -2078, -4768 },
-  { 818, 3996, -549, -5468 },
-  { -287, 4529, 929, -5543 },
-  { -919, 5519, -2791, -2844 },
-  { -1407, 5679, -3289, -3974 },
-  { -189, 6530, -3547, -4002 },
-  { -900, 7039, -3371, -4855 },
-  { -2983, 7211, -363, -4835 },
-  { -814, 6503, -104, -5106 },
-  { -2386, 6896, 809, -4919 },
-  { 845, 4492, 352, -6621 },
-  { -1998, 7237, -1646, -4231 },
-  { -3380, 6251, 471, -4577 },
-  { -1908, 7059, 84, -5726 },
-  { -340, 6346, -803, -6265 },
-  { -2279, 5834, -47, -4633 },
-  { -1532, 5286, -1748, -1901 },
-  { -2757, 6188, -453, -3415 },
-  { -1255, 6405, -2043, -6357 },
-  { 918, 5581, -121, -5667 },
-  { 1840, 5336, -821, -5034 },
-  { -2475, 4992, -1825, -3104 },
-  { -2413, 5606, -1789, -4298 },
-  { 132, 5128, -2389, -4442 },
-  { 223, 6400, -2653, -4742 },
-  { -673, 5012, 680, -4582 },
-  { -1657, 6624, -349, -3596 },
-  { -755, 6289, -1860, -3978 },
-  { -572, 6894, -1946, -5207 },
-  { -1141, 4756, -2665, -5586 },
-  { -1073, 4269, -431, -4030 },
-  { 186, 5761, 916, -5868 },
-  { -1907, 4836, 1017, -5106 },
-  { -963, 3363, -1248, -6348 },
-  { -3262, 4774, -1818, -5858 },
-  { 847, 3812, -2538, -4302 },
-  { -1223, 5903, 1360, -5479 },
-  { -1094, 6923, -1244, -2381 },
-  { 267, 6276, -709, -2846 },
-  { -157, 5840, 1124, -4266 },
-  { 889, 3206, -910, -5305 },
-  { -1736, 3344, 582, -4838 },
-  { -2357, 5676, -2695, -6277 },
-  { -1916, 6901, -986, -5397 },
-  { -3062, 6028, -695, -5687 },
-  { 1836, 3566, -1357, -5226 },
-  { -2176, 4938, 646, -3872 },
-  { -2199, 3055, -208, -6124 },
-  { -236, 3032, -821, -5325 },
-  { -3989, 7277, -565, -3899 },
-  { -595, 4362, 74, -5975 },
-  { 684, 5874, -841, -4424 },
-  { -2731, 6305, -2389, -5465 },
-  { -5775, 1325, -56, -2528 },
-  { -7029, -534, -1890, -3278 },
-  { -5798, -15, -2734, -2210 },
-  { -5504, -1198, -353, -3659 },
-  { -5079, 960, -894, -4336 },
-  { -6073, -36, -133, -3014 },
-  { -5782, -259, -1025, -3986 },
-  { -6843, 1262, -807, -1639 },
-  { -5263, -918, -3290, -579 },
-  { -4840, 461, -2158, -533 },
-  { -6014, -50, -620, 504 },
-  { -5843, 241, -1359, -282 },
-  { -5898, 577, 769, -3271 },
-  { -6833, -946, -466, -3347 },
-  { -6026, 1459, -512, -729 },
-  { -7361, 747, -388, -1110 },
-  { -6391, 2142, -1160, -2513 },
-  { -6995, 304, 498, -2673 },
-  { -6757, 679, -386, -433 },
-  { -5222, 1688, -1093, -1032 },
-  { -5019, 575, 184, -3627 },
-  { -4237, 628, -3507, -1243 },
-  { -7479, -456, -1722, -1486 },
-  { -6464, 713, -1273, -1153 },
-  { -6255, 1682, -606, -3607 },
-  { -7033, 1497, -71, -1955 },
-  { -6694, 1556, -1721, -3214 },
-  { -6114, -356, 813, -2575 },
-  { -5308, 632, -1851, -1636 },
-  { -5742, -911, -1733, 383 },
-  { -6083, -387, -2313, -879 },
-  { -6535, -530, -1505, -2083 },
-  { -4896, 1223, -2750, -1816 },
-  { -6392, -463, -3247, -2093 },
-  { -5373, 1264, -2706, -3042 },
-  { -3894, -1390, -1020, -891 },
-  { -6179, 1168, -1966, -1922 },
-  { -5162, 1668, -1617, -1916 },
-  { -6453, 920, -1169, -2432 },
-  { -6130, 2005, -536, -1519 },
-  { -6552, -98, -518, -1938 },
-  { -7528, 355, -1101, -1772 },
-  { -5745, 610, -247, -1360 },
-  { -7003, 177, -2064, -1958 },
-  { -6956, -570, -2220, -4225 },
-  { -7830, 791, -1394, -2774 },
-  { -7634, 480, -3171, -4224 },
-  { -7913, 1154, -350, -2381 },
-  { -5063, 1704, -1804, -2977 },
-  { -4887, -524, -2703, 188 },
-  { -5551, 406, -1620, -3063 },
-  { -7109, 1342, 381, -3021 },
-  { -6846, 631, -458, -3398 },
-  { -4606, -605, 11, -3930 },
-  { -8134, -225, -1738, -2648 },
-  { -7043, 402, -2734, -3059 },
-  { -7417, 1825, -2545, -4389 },
-  { -6971, -236, -1031, -665 },
-  { -5752, 2111, -1632, -3808 },
-  { -7660, -78, -624, -3135 },
-  { -6358, 619, -1951, -3911 },
-  { -8134, 408, -1935, -3695 },
-  { -6335, 1911, -2368, -4505 },
-  { -7116, 2163, -344, -2753 },
-  { 2357, 4488, 2220, -5682 },
-  { 1385, 3206, 2300, -5305 },
-  { 1419, 2557, 5203, -3516 },
-  { 262, 4315, 3920, -1847 },
-  { 3316, 3187, 1612, -5609 },
-  { 1729, 2350, 1673, -6068 },
-  { 1603, 6126, 1467, -2839 },
-  { -1339, 3316, 3691, -3530 },
-  { -563, 4618, 3180, -4548 },
-  { 463, 4624, 3111, -5614 },
-  { 1246, 5455, 3356, -5720 },
-  { 480, 2149, 5422, -2893 },
-  { 1768, 4827, 913, -5579 },
-  { -149, 5381, 4366, -3297 },
-  { 985, 3672, 2644, -92 },
-  { -258, 2911, 5817, -2213 },
-  { 3428, 3289, 3351, -3541 },
-  { -666, 3295, 4727, -2869 },
-  { 35, 6641, 4160, -4052 },
-  { 623, 6787, 3156, -4560 },
-  { 2654, 4360, 4676, -4632 },
-  { 1386, 5246, 4834, -4497 },
-  { 3488, 4574, 3856, -5946 },
-  { 383, 4481, 4168, -4110 },
-  { 1753, 3652, 4288, -3326 },
-  { 1344, 4905, 2508, -4660 },
-  { 1580, 4106, 3104, -2224 },
-  { 2027, 5038, 1683, -1554 },
-  { 446, 3699, 5872, -3013 },
-  { 4637, 4087, 3578, -5018 },
-  { 2629, 3560, 5331, -4900 },
-  { 1527, 6674, 2523, -4131 },
-  { -1437, 2804, 2528, -4464 },
-  { -229, 3355, 2016, -5537 },
-  { 3666, 3418, 4374, -4581 },
-  { 1192, 3799, 923, -6596 },
-  { 2040, 2956, 448, -5322 },
-  { 2468, 5768, 4029, -5869 },
-  { 3438, 6516, 3529, -6667 },
-  { 2737, 5495, 680, -5535 },
-  { 3896, 5727, 1801, -4958 },
-  { 4988, 4957, 3592, -6518 },
-  { -542, 4416, 5794, -2787 },
-  { 4136, 4354, 2064, -4696 },
-  { 3067, 5936, 1207, -3396 },
-  { 2789, 4966, 2405, -3854 },
-  { 1731, 3270, 3251, -1063 },
-  { 1767, 5537, 2084, -2349 },
-  { 465, 3116, 4532, -837 },
-  { 1499, 2627, 4610, -2212 },
-  { 122, 3095, 3642, -3552 },
-  { 2542, 2866, 2705, -6402 },
-  { 3134, 4323, 698, -4785 },
-  { 731, 1859, 3112, -5242 },
-  { 2553, 2980, 3241, -4846 },
-  { 1329, 5310, 1607, -6624 },
-  { 2468, 1858, 3476, -1034 },
-  { -172, 4996, 2000, -5562 },
-  { 2621, 4220, 1574, -3386 },
-  { -333, 1832, 3362, -4117 },
-  { 2169, 6762, 3065, -6225 },
-  { 2844, 5528, 3223, -4765 },
-  { 526, 5175, 1644, -4267 },
-  { 2922, 4426, 2414, -2610 },
-  { 452, 1399, -4516, -2636 },
-  { 2872, 1720, -4667, -1435 },
-  { 1279, 702, -5424, -1984 },
-  { 2187, 870, -5021, -1341 },
-  { 583, -144, -4628, -2464 },
-  { 3, 2237, -5284, -2827 },
-  { -19, 1005, -5460, -1819 },
-  { 2897, 2084, -5885, -515 },
-  { -400, 3370, -5527, -2947 },
-  { 1505, 2593, -5518, -1802 },
-  { 1341, 4534, -5094, -1899 },
-  { 3241, 3670, -5493, -1252 },
-  { -1287, 921, -5994, -1675 },
-  { 627, 408, -6652, -364 },
-  { -260, 1127, -4849, -3247 },
-  { 371, 3400, -5976, -2285 },
-  { 1533, 1566, -6373, -610 },
-  { 2462, 4274, -6184, -1254 },
-  { 1782, 3363, -6222, -1381 },
-  { 572, 4650, -5673, -2754 },
-  { 2674, 3414, -4460, -2154 },
-  { 3614, 3820, -6883, -398 },
-  { 1136, -1, -5511, -1112 },
-  { -1773, 1137, -5647, -2377 },
-  { -753, 2104, -6085, -2565 },
-  { -204, 3025, -4731, -1418 },
-  { -1486, 1438, -4380, -216 },
-  { 302, 858, -5786, -264 },
-  { 3486, 1495, -5234, -783 },
-  { 888, 2327, -3423, -3720 },
-  { -259, 772, -6596, -1311 },
-  { -1197, 2073, -5174, -1826 },
-  { 1500, 3470, -4462, -2645 },
-  { 3072, 1960, -3277, -2264 },
-  { 1841, 952, -4324, -2340 },
-  { 1994, 2200, -3940, -2923 },
-  { -1782, 1699, -4667, -1075 },
-  { -1464, 2906, -3468, -375 },
-  { 366, 2380, -3747, 1467 },
-  { -545, 1645, -4619, 376 },
-  { 1724, 2350, -2374, -3512 },
-  { 3184, 2628, -2996, -3275 },
-  { 734, 2010, -6239, -1479 },
-  { 524, 3756, -4496, -3263 },
-  { 1492, 3570, -3494, -3600 },
-  { -932, 618, -5389, -2894 },
-  { -133, 2161, -4083, -3267 },
-  { 786, 774, -3279, -3731 },
-  { 1078, 803, -3843, -3007 },
-  { -332, 3405, -3347, 40 },
-  { -17, 6, -4005, -3690 },
-  { -189, 4372, -4488, -2561 },
-  { -450, 3846, -3790, -1370 },
-  { 362, 2212, -5272, -15 },
-  { -1529, 791, -6802, -2296 },
-  { 2145, 4241, -4474, 376 },
-  { 1813, 2426, -2932, -2726 },
-  { -542, 4557, -3140, -1080 },
-  { 1192, 3784, -4371, -20 },
-  { 2784, 5188, -6399, -1394 },
-  { 431, 4561, -3673, -1398 },
-  { 1382, 3096, -4083, 1253 },
-  { 1209, 4224, -2930, 1500 },
-  { 2798, 2684, -6676, -606 },
-  { -2396, 1510, -5381, -2713 },
-  { -2625, 2542, -4032, -2880 },
-  { -1231, 3967, -4098, -2886 },
-  { -1393, 2374, -3862, -4525 },
-  { -2495, 1665, -1637, -5445 },
-  { -3854, 1759, -1750, -4944 },
-  { -2373, 1668, -2856, -6251 },
-  { -2668, 1981, -886, -4557 },
-  { -2927, 4427, -3451, -6172 },
-  { -1925, 2596, -4696, -2527 },
-  { -3202, 2847, -3928, -5896 },
-  { -3332, 1665, -5025, -3412 },
-  { -3212, 3115, -4155, -4062 },
-  { -1013, 3205, -5133, -3751 },
-  { -2022, 4595, -3947, -5611 },
-  { -3556, 1755, -3715, -2300 },
-  { -1784, 4114, -2723, -1773 },
-  { -3586, 4081, -2733, -4942 },
-  { -1608, 3685, -4154, -4573 },
-  { -3368, 4042, -4452, -6227 },
-  { -1407, 3881, -5729, -3719 },
-  { -2751, 3281, -5077, -4999 },
-  { -3791, 2410, -4906, -5288 },
-  { -730, 2303, -4217, -3755 },
-  { -1812, 2311, -5492, -3709 },
-  { -610, 4336, -3915, -3783 },
-  { -2841, 4337, -4278, -4430 },
-  { -1662, 4666, -4661, -3964 },
-  { -589, 5209, -4923, -3682 },
-  { -4155, 2234, -4076, -4218 },
-  { -3951, 2770, -2665, -2805 },
-  { -2302, 3228, -3717, -1908 },
-  { -3129, 4373, -2264, -2851 },
-  { -447, 1363, -3578, -4323 },
-  { -2648, 4237, -3159, -3071 },
-  { -4072, 3241, -3541, -4605 },
-  { -4507, 3458, -2339, -3838 },
-  { -1646, 997, -4926, -3970 },
-  { -3025, 1614, -3940, -1242 },
-  { -1337, 1756, -3163, -5529 },
-  { -3203, 1865, -3282, -4354 },
-  { -1646, 2118, -2203, -6018 },
-  { 174, 1871, -2707, -4639 },
-  { -2607, 1485, -4778, -4750 },
-  { -2199, 3991, -3134, -4879 },
-  { -2962, 3323, -2816, -2419 },
-  { -5286, 2495, -4548, -5395 },
-  { -2810, 3710, -2274, -4211 },
-  { -330, 3006, -2993, -4678 },
-  { -1187, 2411, -2743, -5196 },
-  { -664, 4033, -3101, -5641 },
-  { -1458, 3602, -2816, -5371 },
-  { -4116, 4923, -3321, -5630 },
-  { -4165, 2528, -2592, -4798 },
-  { -2759, 3080, -2333, -5719 },
-  { -5157, 3011, -5526, -6348 },
-  { -3095, 2126, -5881, -4234 },
-  { -4377, 3849, -3600, -6099 },
-  { -1994, 4947, -5235, -4753 },
-  { -1067, 600, -3258, -5133 },
-  { -4992, 3302, -2208, -5051 },
-  { -3377, 2981, -1655, -4815 },
-  { -3325, 2446, -1787, -6116 },
-  { -2341, 2737, -3240, -6347 },
-  { -2258, -3732, 3710, -1235 },
-  { -1558, -3849, 2694, -3012 },
-  { -599, -4837, 3050, -2951 },
-  { -2246, -5433, 2798, -1910 },
-  { -2255, -4989, 3260, 270 },
-  { -3026, -5353, 2693, -1036 },
-  { -1151, -6097, 1097, -3782 },
-  { -3391, -6012, 2130, -1303 },
-  { -2850, -4422, 3375, -480 },
-  { -1138, -3779, 1491, -4162 },
-  { -551, -3892, 3787, -2082 },
-  { -3221, -3676, 3144, -1202 },
-  { -3023, -5196, 2650, 605 },
-  { -1756, -5729, 2646, 321 },
-  { -2693, -4409, 494, -4797 },
-  { -1913, -4573, 3372, -1730 },
-  { -1277, -3604, 4061, -993 },
-  { -420, -4993, 1351, -4796 },
-  { -3052, -5333, 1435, -1242 },
-  { -602, -5034, 3869, -1141 },
-  { -2436, -4680, 1665, -3019 },
-  { -2657, -3658, 1459, -3391 },
-  { -1220, -6246, 2749, -525 },
-  { -3838, -4844, 2265, -1735 },
-  { -1247, -5679, 3356, -1417 },
-  { -917, -5448, 3342, 105 },
-  { -1756, -6839, 2276, -2350 },
-  { -412, -5206, 1764, -3539 },
-  { -1439, -6915, 1442, -3750 },
-  { -1381, -4439, 3863, -282 },
-  { -3482, -4953, 2726, -336 },
-  { -1376, -5931, 1714, -1987 },
-  { -1716, -4405, 2608, 105 },
-  { -1590, -5191, 2652, -2704 },
-  { -2149, -6442, 2453, -1263 },
-  { -3426, -3832, 2334, -1829 },
-  { -2747, -5948, 2362, -173 },
-  { -2435, -3267, 2966, -1710 },
-  { -3979, -4282, 2705, -775 },
-  { -356, -4238, 2544, -4343 },
-  { -1363, -6471, 2817, -1836 },
-  { -2878, -5117, 218, -3149 },
-  { -3539, -5196, 1710, -2356 },
-  { -2888, -4537, 2746, -1701 },
-  { -1870, -4439, 1496, -4121 },
-  { -1486, -3388, 3349, -2145 },
-  { -3333, -4138, 1467, -2876 },
-  { -345, -5340, 1012, -1190 },
-  { -1672, -4992, 2289, -1029 },
-  { -2146, -5528, 3038, -635 },
-  { -316, -3656, 3426, -3152 },
-  { -2695, -5812, 2336, -2050 },
-  { -2067, -6052, 737, -3258 },
-  { -2664, -4205, -350, -1266 },
-  { -617, -5406, 80, -4853 },
-  { -2418, -3825, 1853, -1326 },
-  { -1961, -4339, 583, -4315 },
-  { -1495, -5141, -133, -5205 },
-  { -3208, -6440, 1691, -2069 },
-  { -2632, -3633, 2325, -2761 },
-  { -2624, -5670, 1252, -3676 },
-  { -3687, -5608, 687, -2833 },
-  { -3320, -5707, 16, -3877 },
-  { -2738, -6112, 84, -5135 },
-  { 2277, -5661, 3076, 843 },
-  { 1555, -5769, 2821, -5236 },
-  { 536, -6381, 603, -4910 },
-  { 734, -4609, 3314, -4092 },
-  { 1836, -4547, 3267, -4322 },
-  { -13, -5976, 3752, -1607 },
-  { 1423, -6318, 2336, 398 },
-  { 365, -7779, 1498, -534 },
-  { 2104, -8366, 2946, -1345 },
-  { 143, -5545, 1898, -3756 },
-  { 655, -6852, 1430, 148 },
-  { 4, -6653, 2397, -59 },
-  { 2346, -5996, 4562, -934 },
-  { 1229, -7104, 2963, -598 },
-  { -528, -7048, 2887, -1790 },
-  { 1451, -6857, 3900, -1637 },
-  { 554, -6018, 3336, 9 },
-  { 3278, -5758, 4034, 129 },
-  { 3541, -7145, 4905, -1575 },
-  { 2339, -6907, 3464, -301 },
-  { 2775, -7301, 1667, -3894 },
-  { 539, -7887, 991, -4156 },
-  { 2115, -7421, 3131, -3075 },
-  { 2803, -8546, 2564, -5836 },
-  { 2869, -5833, 1620, -4561 },
-  { 2591, -7281, 3215, -4719 },
-  { -1228, -8477, 706, -4782 },
-  { 1967, -5243, 4813, -1940 },
-  { 701, -7010, 2273, -3893 },
-  { 915, -8470, 1918, -5620 },
-  { -94, -6715, 156, -3873 },
-  { 1074, -5607, 4389, -1017 },
-  { 2739, -6551, 1227, -3521 },
-  { 725, -7835, 2701, -1291 },
-  { -493, -7475, 2263, -1075 },
-  { -412, -6508, 2984, -744 },
-  { 665, -5451, 3725, -2692 },
-  { 1499, -8129, 3564, -2072 },
-  { 2870, -6333, 4487, -2108 },
-  { 706, -5007, 3911, -152 },
-  { -482, -8660, 1483, -2900 },
-  { 2481, -6596, 2518, -1715 },
-  { 1403, -6414, 1398, -5387 },
-  { 652, -6267, 583, -5942 },
-  { 694, -7540, 646, -6272 },
-  { 2275, -7614, 256, -5015 },
-  { 1416, -9727, 1900, -3153 },
-  { 2760, -6433, 3875, -3771 },
-  { 2325, -11196, 2182, -5155 },
-  { 1223, -11061, 1377, -5097 },
-  { 108, -10603, 307, -4952 },
-  { -118, -8268, 1650, -1572 },
-  { 1839, -7943, 1755, -612 },
-  { 2501, -9056, 981, -2969 },
-  { 2902, -8476, 1491, -5780 },
-  { 1995, -11175, 1585, -3643 },
-  { 696, -8212, 828, -2474 },
-  { 1526, -8649, 1380, -1210 },
-  { 461, -7253, 3222, -2229 },
-  { 2966, -8641, 4121, -3271 },
-  { 833, -6039, 2361, -1086 },
-  { 3565, -7312, 1980, -5427 },
-  { 2850, -8671, 3760, -1846 },
-  { 2643, -7281, 2163, -173 },
-  { 3463, -3706, -3132, -923 },
-  { 1315, -3825, -3443, 2 },
-  { 2594, -4083, -3815, 670 },
-  { 1826, -4291, -2741, -155 },
-  { 868, -3749, -4175, -298 },
-  { 2008, -4237, -3897, -517 },
-  { 1242, -3493, -4335, -1335 },
-  { -88, -4142, -3390, -1529 },
-  { 2176, -3488, -3822, -975 },
-  { 1706, -5188, -3415, -637 },
-  { 2717, -6159, -2333, -882 },
-  { 1276, -3978, -4361, 537 },
-  { 2471, -5556, -2866, -208 },
-  { 799, -4673, -4086, 56 },
-  { 1901, -4786, -3533, 270 },
-  { 3036, -3902, -3606, -333 },
-  { 2249, -3317, -4319, -144 },
-  { 2594, -4207, -2105, -2930 },
-  { 4008, -4774, -2626, -902 },
-  { 1038, -3659, -3496, -2454 },
-  { 2725, -3597, -3298, -1535 },
-  { 1662, -5803, -2813, 175 },
-  { 705, -3757, -3441, -1484 },
-  { 1860, -5987, -2821, -886 },
-  { 3786, -4918, -2199, -1929 },
-  { 3683, -4235, -2547, -1287 },
-  { 2531, -4896, -2956, -1593 },
-  { 1005, -5585, -3324, -180 },
-  { 1625, -5229, -1756, -3642 },
-  { 1494, -5041, -2989, -2685 },
-  { 2718, -4655, -3224, -867 },
-  { 2374, -6640, -1745, -2975 },
-  { 2133, -6436, -2477, -1499 },
-  { 1833, -4418, -3523, -1512 },
-  { 1128, -4910, -2658, -1106 },
-  { 689, -4777, -2831, -2085 },
-  { 3593, -5280, -2627, -315 },
-  { 3264, -3771, -2673, -1861 },
-  { 3202, -5602, -2409, 402 },
-  { 552, -4618, -2221, -3002 },
-  { 3095, -5356, -2666, -1083 },
-  { 3401, -4609, -3146, 45 },
-  { 3051, -4662, -2192, -2232 },
-  { 2798, -5552, -2462, -1941 },
-  { 2354, -5815, -2223, -2619 },
-  { 192, -3708, -2807, -2658 },
-  { 1886, -4226, -1862, -3529 },
-  { 2526, -3976, -2819, -2332 },
-  { 1577, -3870, -2711, -2806 },
-  { 1288, -5588, -3382, -1403 },
-  { 2711, -5399, -1564, -3253 },
-  { 1459, -5492, -2222, -322 },
-  { 2823, -5091, -2886, 776 },
-  { 3559, -5821, -2109, -1360 },
-  { 1587, -6331, -2760, -1909 },
-  { 2139, -5213, -2874, -2120 },
-  { 1318, -4337, -3695, -2098 },
-  { 821, -4471, -1849, -565 },
-  { 3329, -4782, -1725, -89 },
-  { 582, -4914, -4105, -1119 },
-  { 417, -4144, -4072, -2529 },
-  { -199, -3803, -2765, -4042 },
-  { 2731, -4283, -2143, 1 },
-  { 2911, -6187, -1951, -2116 },
-  { 1573, -6094, -493, -2838 },
-  { 2081, -6927, -864, -3211 },
-  { 1058, -7826, 79, -364 },
-  { 3147, -5570, -684, -978 },
-  { 3572, -5856, 1060, 1824 },
-  { 1143, -6702, -1478, 338 },
-  { 2341, -7220, -88, 260 },
-  { 3639, -6861, 668, 815 },
-  { 2227, -6268, -1706, 446 },
-  { 3390, -6082, -353, 1302 },
-  { 1123, -7556, -1237, -430 },
-  { 1729, -7742, 729, -218 },
-  { 1457, -6774, 587, 579 },
-  { 505, -6919, -569, 371 },
-  { 1106, -7245, 78, 158 },
-  { 2755, -6745, -1122, 338 },
-  { 3069, -6040, -1415, 986 },
-  { 2174, -7064, -1430, -283 },
-  { 1390, -8626, -446, -3031 },
-  { 3534, -6890, -431, 547 },
-  { 2267, -9618, 475, -2994 },
-  { 3672, -7673, 75, -115 },
-  { 2131, -7560, -1206, -750 },
-  { 2972, -7477, -685, -262 },
-  { 1604, -6637, -672, 699 },
-  { 1666, -7577, -577, -240 },
-  { 1591, -6554, -2158, -94 },
-  { 2348, -6286, -353, 1123 },
-  { 2017, -8810, -412, -1805 },
-  { 2892, -6713, -1765, -554 },
-  { 2500, -6828, -1995, -1197 },
-  { 3877, -6639, -224, -1655 },
-  { 2392, -7872, -91, -333 },
-  { 3562, -7370, -532, -2836 },
-  { 2552, -7614, 164, -1805 },
-  { 990, -6104, 218, 438 },
-  { 910, -7861, 312, -1195 },
-  { 1472, -6327, 372, -640 },
-  { 1576, -7143, -1983, -843 },
-  { 422, -7625, -457, -278 },
-  { 1797, -8532, 405, -1011 },
-  { 1088, -7396, -238, -2277 },
-  { 3209, -6753, -1431, -2072 },
-  { 2617, -6839, 100, -2573 },
-  { 2575, -8573, -387, -3188 },
-  { 3618, -6971, -1190, -321 },
-  { 2205, -7361, -1695, -2008 },
-  { 2985, -6297, 1464, 1179 },
-  { 2804, -7310, 1053, 338 },
-  { 1362, -6074, -1163, -840 },
-  { 3336, -6325, -1794, 21 },
-  { 2836, -8109, 818, -329 },
-  { 2791, -5879, 560, 1546 },
-  { 2392, -6064, 135, 100 },
-  { 1838, -6194, 596, 1085 },
-  { 1926, -7515, -414, -4901 },
-  { 3225, -7298, -1202, -1189 },
-  { 3960, -7558, -659, -719 },
-  { 3442, -6647, -1692, -1095 },
-  { 3381, -6441, 262, -886 },
-  { 1431, -8150, -1186, -1406 },
-  { 340, -8498, -150, -899 },
-  { 3004, -8149, -260, -953 },
-  { 2749, -6611, 563, 873 },
-  { -6647, -1325, -4517, -4691 },
-  { -6005, -1657, -4089, -3797 },
-  { -3157, 588, -5213, -3068 },
-  { -3311, -1425, -6329, -3726 },
-  { -5866, -819, -3857, -2744 },
-  { -5001, -1799, -1075, -4621 },
-  { -5330, -2650, -2672, -4664 },
-  { -4930, -539, -2363, -4010 },
-  { -2984, 10, -3863, -5749 },
-  { -1055, -2106, -3713, -4267 },
-  { -5476, -502, -4279, -6504 },
-  { -5231, -1543, -5018, -6425 },
-  { -5134, -363, -3165, -5109 },
-  { -3953, -771, -4107, -6393 },
-  { -2159, -563, -3652, -5342 },
-  { -3888, -2321, -919, -5057 },
-  { -1236, -597, -4235, -4193 },
-  { -4053, 675, -3083, -6174 },
-  { -2793, -1089, -5396, -3460 },
-  { -3000, -44, -2209, -6575 },
-  { -3336, -1531, -4313, -5160 },
-  { -2127, 128, -4851, -3692 },
-  { -3321, 136, -2067, -5660 },
-  { -5215, 1404, -4374, -4356 },
-  { -2747, 400, -6340, -3691 },
-  { -3926, -599, -5361, -5006 },
-  { -2875, -2592, -5143, -4092 },
-  { -4991, -1958, -5322, -4891 },
-  { -4965, -1318, -6652, -5333 },
-  { -4920, -1691, -3388, -5561 },
-  { -3644, -3354, -2688, -5982 },
-  { -5076, -919, -4563, -2984 },
-  { -6114, 250, -3884, -3915 },
-  { -4014, 744, -3973, -1924 },
-  { -5543, -1041, -5557, -3847 },
-  { -4711, -1352, -5649, -2603 },
-  { -3362, 775, -5305, -4879 },
-  { -5001, 107, -3554, -2888 },
-  { -6258, -1651, -6356, -6566 },
-  { -4529, 407, -5003, -3865 },
-  { -5154, 550, -5278, -5465 },
-  { -4195, -467, -1894, -3129 },
-  { -5022, 1127, -3349, -3314 },
-  { -6075, 1250, -4313, -5641 },
-  { -2677, -2283, -2312, -5903 },
-  { -4113, 193, -1195, -4833 },
-  { -3940, -1048, -1389, -5079 },
-  { -3703, 917, -4043, -4451 },
-  { -3366, -4231, -1534, -5488 },
-  { -3326, -3583, -2091, -4903 },
-  { -5144, 1254, -2532, -4949 },
-  { -5982, -870, -2545, -4555 },
-  { -3925, -157, -5367, -2281 },
-  { -6419, -746, -5668, -4371 },
-  { -5787, 518, -7096, -5805 },
-  { -4258, 954, -6453, -4321 },
-  { -4771, -695, -4158, -1639 },
-  { -7078, -760, -5195, -5877 },
-  { -7348, 83, -4101, -4586 },
-  { -2430, 184, -2874, -1679 },
-  { -2284, -3943, -2924, -5034 },
-  { -1804, -1785, -3002, -4710 },
-  { -4399, -2772, -1815, -4637 },
-  { -6340, -2626, -2824, -5191 },
-  { -4998, -5168, -3480, 1905 },
-  { -3958, -5492, -1599, 1579 },
-  { -2471, -3755, -276, 3182 },
-  { -3033, -5779, -1063, 1554 },
-  { -2936, -4829, -1290, 2386 },
-  { -1835, -5073, -3051, 1299 },
-  { -1724, -3771, -3935, 2324 },
-  { -5070, -2550, -3692, 768 },
-  { -4326, -5333, -297, 1878 },
-  { -3472, -5619, -3094, 992 },
-  { -3027, -4384, -3038, 2265 },
-  { -3201, -5332, 67, 2200 },
-  { -1681, -4373, -1947, 2461 },
-  { -3221, -3329, -4238, 2564 },
-  { -1262, -2968, -2915, 3227 },
-  { -3419, -1878, -3373, 2110 },
-  { -2244, -5583, -2012, 1288 },
-  { -1971, -5266, -990, 1812 },
-  { -2975, -2778, -452, 4063 },
-  { -2198, -1165, -3298, 2965 },
-  { -4782, -4894, -4767, 664 },
-  { -6002, -3950, -2806, 2025 },
-  { -3142, -3162, -2859, 3295 },
-  { -3262, -3340, -4123, 1596 },
-  { -4014, -3918, -1955, 3361 },
-  { -1700, -3463, -1346, 3449 },
-  { -4245, -4445, -4743, 1644 },
-  { -4180, -3969, -401, 3281 },
-  { -2782, -5240, -4117, 1156 },
-  { -5744, -4040, -1439, 3470 },
-  { -5063, -4663, -323, 3172 },
-  { -4531, -3319, -844, 3988 },
-  { -6226, -5125, -2064, 2976 },
-  { -3115, -3267, -1531, 3898 },
-  { -4628, -4421, -2864, 2808 },
-  { -4559, -2989, -3442, 2024 },
-  { -1775, -4487, -656, 2477 },
-  { -2664, -1865, -1884, 4081 },
-  { -1828, -2575, -3894, 3378 },
-  { -6441, -3677, -2025, 1677 },
-  { -4141, -2156, -1191, 3474 },
-  { -4802, -1623, -1727, 2160 },
-  { -5474, -2745, -1475, 2498 },
-  { -3664, -1056, -1975, 2491 },
-  { -4672, -3062, -2235, 2933 },
-  { -4205, -5960, -2849, 1517 },
-  { -4995, -5708, -1739, 1805 },
-  { -4892, -6080, -4793, 872 },
-  { -4270, -4172, -4263, 2185 },
-  { -4687, -1470, -2905, 1023 },
-  { -6446, -5017, -3919, 1000 },
-  { -6046, -5538, -3943, 2006 },
-  { -6028, -3750, -3953, 771 },
-  { -5959, -4582, -5024, 824 },
-  { -5818, -2576, -2249, 1326 },
-  { -5659, -5345, -1119, 2500 },
-  { -3346, -4155, 606, 2749 },
-  { -5680, -4827, -2501, 1838 },
-  { -6193, -2543, -1295, 840 },
-  { -6871, -4925, -3512, 1801 },
-  { -5605, -1788, -1895, 779 },
-  { -3922, -5712, -4644, 510 },
-  { -4745, -3869, -4533, 99 },
-  { -2984, -4907, -399, 1497 },
-  { 1847, -478, 3061, -5812 },
-  { 4450, -1116, 3609, -6570 },
-  { 3139, 99, 3007, -5532 },
-  { 2590, -3782, 3138, -4770 },
-  { 1881, 1204, 5778, -3404 },
-  { 3631, 2060, 5566, -5038 },
-  { 3461, 1961, 5167, -3800 },
-  { 2947, 273, 4536, -4389 },
-  { 4453, -1730, 5788, -4370 },
-  { 4032, 1805, 2666, -4534 },
-  { 3487, -944, 2313, -6028 },
-  { 1313, 34, 4210, -4067 },
-  { 5632, -1502, 5825, -5855 },
-  { 7736, -547, 4879, -5476 },
-  { 4906, -1512, 4760, -5760 },
-  { 3843, 447, 1091, -4958 },
-  { 2982, -1135, 5442, -4386 },
-  { 3579, 271, 3031, -6770 },
-  { 3932, -211, 4688, -5507 },
-  { 4411, 1720, 2387, -5584 },
-  { 5379, -479, 4575, -6280 },
-  { 3613, -362, 2012, -4885 },
-  { 3744, -2013, 4493, -5073 },
-  { 5693, 109, 4379, -3362 },
-  { 5475, -621, 5317, -3985 },
-  { 6411, -673, 5708, -4752 },
-  { 4933, -796, 7262, -4290 },
-  { 2804, 444, 6276, -3655 },
-  { 4120, -517, 6078, -4531 },
-  { 5119, 841, 3486, -3910 },
-  { 4738, 1539, 3525, -2970 },
-  { 5086, 370, 5895, -5640 },
-  { 4235, 2716, 4589, -5044 },
-  { 3691, 682, 6199, -4700 },
-  { 6111, -570, 6271, -6528 },
-  { 2611, 1277, 3756, -4802 },
-  { 4395, 970, 3807, -5879 },
-  { 5225, 2299, 3242, -4333 },
-  { 5144, 1778, 4946, -5545 },
-  { 2989, -3016, 3247, -5495 },
-  { 2983, 920, 2071, -6059 },
-  { 5270, -903, 4434, -2350 },
-  { 6415, -585, 3970, -3554 },
-  { 3866, -197, 5216, -2884 },
-  { 3767, -1298, 6702, -3315 },
-  { 6299, 2620, 5284, -6824 },
-  { 6654, 646, 3653, -4927 },
-  { 4770, 3047, 5160, -6287 },
-  { 5364, 434, 2919, -5207 },
-  { 2998, 1344, 4801, -2456 },
-  { 3896, 1013, 3773, -1864 },
-  { 2115, 655, 2999, -6344 },
-  { 5170, -981, 2849, -4464 },
-  { 2735, -2159, 2717, -5776 },
-  { 2430, -1952, 4392, -4559 },
-  { 6143, -1180, 3659, -4746 },
-  { 4978, -1483, 1726, -4875 },
-  { 3486, -2383, 3306, -4301 },
-  { 1434, -1372, 4171, -4770 },
-  { 3354, -2627, 1525, -5093 },
-  { 6790, 2386, 3995, -5909 },
-  { 1475, -2674, 3451, -4204 },
-  { 1999, -3494, 3693, -5556 },
-  { 4764, -2848, 2856, -5589 },
-  { -3677, 5131, 2827, -2934 },
-  { -2844, 7078, 2852, -3580 },
-  { -3902, 6434, 4118, -1911 },
-  { -1769, 7530, 3492, -3541 },
-  { -1937, 5679, -447, -1127 },
-  { -2456, 4680, 4196, -2407 },
-  { -2778, 8241, 1698, -4288 },
-  { -2876, 6104, 5182, -2387 },
-  { -2802, 7341, 4463, -2938 },
-  { -1025, 6267, 4752, -3201 },
-  { -2349, 5413, 2041, -3794 },
-  { -2252, 8225, 2856, -4269 },
-  { -1465, 4967, 4976, -2500 },
-  { -636, 7565, 3517, -4233 },
-  { -1905, 5618, 3904, -2942 },
-  { -302, 6816, 3343, -3316 },
-  { -2210, 4156, 2817, -3511 },
-  { -717, 6568, 1863, -2951 },
-  { -3873, 5682, 2164, -575 },
-  { -2878, 5835, 440, -2597 },
-  { -3228, 7701, 2610, -2514 },
-  { -3608, 8888, 3377, -2468 },
-  { -2582, 9717, 2519, -3126 },
-  { -5238, 6202, 2866, -2831 },
-  { -3428, 7370, 3056, -335 },
-  { -1681, 8836, 1210, -2010 },
-  { -3276, 6724, 1156, -3930 },
-  { -894, 8149, 827, -1258 },
-  { -2965, 8631, 2549, -1320 },
-  { -3961, 6902, 3581, 55 },
-  { -1894, 7745, 1750, -841 },
-  { -821, 6844, 850, -676 },
-  { -608, 6948, -4, -1376 },
-  { 615, 6524, 1089, -1147 },
-  { -2972, 5668, 1091, -489 },
-  { -157, 4649, 2904, -413 },
-  { 673, 5121, 1498, -66 },
-  { -390, 5902, 1611, -245 },
-  { -2349, 5478, 4772, -1320 },
-  { 88, 6798, 1972, -1859 },
-  { -1213, 5120, 2991, 200 },
-  { -2347, 6040, 2839, 376 },
-  { -578, 5976, 3364, -1796 },
-  { -1391, 5872, 3002, -965 },
-  { -564, 4496, 3946, -1186 },
-  { -2299, 6386, 3135, -2176 },
-  { -2131, 5641, 2011, 1223 },
-  { -772, 5807, 1124, 895 },
-  { -2837, 6758, 2297, -740 },
-  { -3091, 6298, 1415, -2126 },
-  { -4197, 6036, 1843, -3022 },
-  { -41, 6459, 92, 344 },
-  { -2241, 6860, 2095, -4396 },
-  { -1931, 7088, 2117, -2135 },
-  { -2375, 4422, 1688, -3169 },
-  { -1742, 6674, 1538, -119 },
-  { -4818, 7749, 4192, -1577 },
-  { -2004, 5672, 193, -430 },
-  { -3825, 6042, 2128, -1898 },
-  { -1108, 8033, 2119, -3013 },
-  { -2370, 5453, 1721, 266 },
-  { -1570, 7134, 614, -2638 },
-  { -1519, 8752, 3503, -4330 },
-  { -2050, 3845, 2907, -1126 },
-  { 5085, 4412, -335, -1923 },
-  { 3618, 1423, -613, -4012 },
-  { 4481, 3729, 589, -4631 },
-  { 4270, 3216, -1763, -3168 },
-  { 4241, 1796, -1701, -2796 },
-  { 4787, 2338, -487, -3639 },
-  { 2915, 3429, -621, -4753 },
-  { 5175, 1660, -1265, -3223 },
-  { 4280, 4057, -684, -4079 },
-  { 4980, 4419, -1455, -2719 },
-  { 5436, 2464, 387, -4197 },
-  { 4507, 4018, 1121, -3314 },
-  { 6020, 2401, -413, -3201 },
-  { 4200, 3789, -333, -2813 },
-  { 5229, 2493, -1194, -1878 },
-  { 5851, 2695, -492, -2292 },
-  { 5743, 3288, -697, -1221 },
-  { 5692, 2612, 979, -2227 },
-  { 5085, 2067, 1046, -1214 },
-  { 3163, 2240, -2098, -3435 },
-  { 5228, 1898, 145, -2397 },
-  { 5860, 3976, -418, -2872 },
-  { 6008, 3399, 1027, -3506 },
-  { 4126, 2035, 1865, -893 },
-  { 5375, 3596, 511, -2362 },
-  { 1937, 1493, -852, -122 },
-  { 3473, 4849, 547, -2603 },
-  { 4631, 2977, 1141, -1768 },
-  { 6149, 3050, -71, -1886 },
-  { 4069, 4353, -289, -1429 },
-  { 2884, 1225, -1388, 365 },
-  { 5485, 2518, -235, -571 },
-  { 1216, 4375, 1443, 398 },
-  { 4988, 3106, 107, -1435 },
-  { 4511, 2801, 307, -444 },
-  { 3235, 4386, 327, -676 },
-  { 2055, 3708, 1657, -305 },
-  { 5839, 2374, 290, -1385 },
-  { 5110, 3305, 1936, -4206 },
-  { 6416, 2920, 338, -2736 },
-  { 3350, 2824, -1269, -3881 },
-  { 4840, 1815, 464, 186 },
-  { 2399, 3332, 238, 1238 },
-  { 3516, 1363, 1582, 688 },
-  { 3582, 1874, 154, -4770 },
-  { 3261, 2878, 886, 283 },
-  { 3877, 2658, -327, 884 },
-  { 4151, 3436, 2173, -2923 },
-  { 3592, 3674, 1281, -1295 },
-  { 4561, 3730, -1114, -1747 },
-  { 4595, 3625, -558, -575 },
-  { 2577, 2348, 2267, 120 },
-  { 5242, 3299, 32, -3412 },
-  { 4264, 3637, 709, -2320 },
-  { 6556, 3570, -838, -2472 },
-  { 5745, 4014, -940, -1973 },
-  { 5629, 4475, 477, -3328 },
-  { 5269, 3199, 1682, -3085 },
-  { 4432, 2416, 1145, -3299 },
-  { 4465, 2505, 2162, -2186 },
-  { 4643, 4941, -88, -2885 },
-  { 4568, 5231, 552, -3915 },
-  { 5667, 3075, -1406, -2963 },
-  { 5418, 5259, -771, -2818 },
-  { -256, -7875, 511, -471 },
-  { -1813, -7971, -424, -396 },
-  { -306, -7006, 862, 282 },
-  { -2306, -6422, -1440, 508 },
-  { -245, -6787, 375, -100 },
-  { -1309, -6065, -20, 779 },
-  { -1656, -6047, -641, 1307 },
-  { -1496, -6522, 964, 726 },
-  { -2291, -6588, -202, 795 },
-  { -762, -7522, 1454, -558 },
-  { -2270, -7004, -834, -580 },
-  { -1139, -7078, 259, 362 },
-  { -2535, -7568, -1040, 49 },
-  { -3786, -7280, 934, -476 },
-  { -3336, -6368, 606, 1056 },
-  { -3602, -6924, 52, 714 },
-  { -2278, -6550, 1674, 204 },
-  { -2855, -5765, 930, 1530 },
-  { -2889, -7325, -215, 305 },
-  { -2749, -6080, -237, 1452 },
-  { -985, -6667, 1577, 400 },
-  { -2036, -6083, 380, 1267 },
-  { -2077, -7460, 380, -30 },
-  { -1775, -7175, 1540, -386 },
-  { -3065, -6927, 989, 168 },
-  { -2836, -7602, 117, -3392 },
-  { -1058, -6396, 593, -3078 },
-  { -844, -6062, 999, -236 },
-  { -3261, -6951, 1491, -720 },
-  { -2186, -8484, 75, -1287 },
-  { -2882, -7756, 456, -510 },
-  { -1800, -6879, 960, -1183 },
-  { -2554, -7241, 1614, -1474 },
-  { -2608, -5305, 392, 851 },
-  { -2973, -6562, -859, 858 },
-  { -2640, -5989, 1031, -416 },
-  { -977, -8366, 705, -1434 },
-  { -1213, -7409, -77, -1390 },
-  { -1335, -6657, 2125, -123 },
-  { -2544, -6862, 1852, -737 },
-  { -3235, -6422, 1752, -103 },
-  { -1300, -7557, 939, -348 },
-  { -3476, -7579, 202, -109 },
-  { -2482, -6572, 753, 619 },
-  { -2554, -8136, -648, -429 },
-  { -1012, -7870, -3, -421 },
-  { -3604, -6247, 32, -3102 },
-  { -1486, -7271, 2013, -1021 },
-  { -578, -6799, -523, 405 },
-  { -2841, -5948, 1644, 911 },
-  { -2411, -7473, 1084, -484 },
-  { -2238, -6033, 294, -1059 },
-  { -3459, -6470, -201, -790 },
-  { -2027, -6009, 1833, 805 },
-  { -1433, -8047, 1531, -1754 },
-  { -3258, -7884, 763, -1422 },
-  { -1544, -6928, -729, 478 },
-  { -2314, -8415, 74, -3757 },
-  { -3201, -5684, 95, -2214 },
-  { -2423, -8694, 725, -3631 },
-  { -3545, -7071, 1162, -1798 },
-  { -294, -9662, 403, -2274 },
-  { -2290, -5460, 1196, 402 },
-  { -1603, -6713, 903, -2363 },
-  { 4121, 2491, -3142, -2482 },
-  { 4500, 3305, -3671, -1567 },
-  { 5973, 3172, -1348, -534 },
-  { 4830, 3379, -1549, 643 },
-  { 5214, 3938, -2641, -2302 },
-  { 4639, 4826, -5532, -847 },
-  { 5639, 2731, -2170, -963 },
-  { 6084, 3487, -3525, -1346 },
-  { 5971, 3154, -2190, -2316 },
-  { 5618, 4865, -6927, 116 },
-  { 5345, 3568, -7391, 709 },
-  { 5429, 5078, -3811, -1524 },
-  { 6960, 2037, -3515, -1096 },
-  { 7092, 2531, -4557, -588 },
-  { 6061, 4247, -5651, -478 },
-  { 4595, 3684, -4907, -827 },
-  { 7497, 3213, -3048, -424 },
-  { 5996, 2137, -3098, -1745 },
-  { 6198, 5199, -2223, -2274 },
-  { 6888, 2851, -2768, -1675 },
-  { 6114, 4210, -2316, -954 },
-  { 7127, 4242, -3041, -1408 },
-  { 6126, 3668, -1517, -1427 },
-  { 6245, 6129, -4225, -1186 },
-  { 6816, 3213, -2101, -964 },
-  { 5345, 5276, -2643, -847 },
-  { 6592, 4665, -4338, 484 },
-  { 6746, 3751, -3443, 124 },
-  { 5453, 1980, -2738, 2606 },
-  { 4662, 2179, -4226, -1059 },
-  { 5571, 3208, -3554, 174 },
-  { 5256, 4447, -1815, -1481 },
-  { 5400, 2570, -1210, 235 },
-  { 7056, 2549, -2674, 318 },
-  { 4574, 4340, -2892, -130 },
-  { 6203, 4587, -3273, -305 },
-  { 5103, 1925, -2715, -2137 },
-  { 3905, 4296, -1700, 247 },
-  { 4421, 4605, -3299, 811 },
-  { 5671, 1273, -3870, -924 },
-  { 5486, 1805, -4901, 133 },
-  { 6437, 2578, -1828, -106 },
-  { 5530, 5253, -5058, 1223 },
-  { 4816, 2025, -1215, 1443 },
-  { 3457, 3525, -2456, 3217 },
-  { 3316, 2595, -1108, 2459 },
-  { 3068, 3810, -2207, 1926 },
-  { 6351, 5436, -6470, 600 },
-  { 6324, 4240, -5365, 2416 },
-  { 4851, 4774, -4075, 1878 },
-  { 4900, 3679, -5198, 1078 },
-  { 8347, 3633, -4565, -171 },
-  { 5244, 5718, -3853, 173 },
-  { 3960, 3492, -2939, 2105 },
-  { 6070, 3473, -2351, 161 },
-  { 8228, 3034, -3360, -901 },
-  { 7006, 3985, -1940, -1926 },
-  { 7123, 4681, -4301, -878 },
-  { 5122, 4097, -1851, -449 },
-  { 6200, 2060, -2251, 1049 },
-  { 7106, 3844, -7209, 2625 },
-  { 7108, 3370, -6734, 533 },
-  { 6859, 2849, -3992, 1360 },
-  { 5458, 2278, -3253, 1131 },
-  { -1072, -2109, 4783, -1073 },
-  { -319, -2604, 4257, -2418 },
-  { 2466, 1300, 3476, -314 },
-  { 2847, -1502, 5296, -141 },
-  { 1667, -1273, 5559, -2725 },
-  { 2877, -3402, 6434, 204 },
-  { 53, -2637, 5275, -1181 },
-  { 1091, -2215, 5803, -1549 },
-  { 2397, -922, 4327, 1182 },
-  { 219, -3747, 4647, -1564 },
-  { -29, -2705, 4812, 1277 },
-  { 1499, -2608, 5648, 1407 },
-  { 2139, -2399, 4202, 2791 },
-  { -426, -2064, 5528, 151 },
-  { 2560, -2803, 6179, -2806 },
-  { 4537, -2479, 3797, 1095 },
-  { 888, -3357, 5341, -415 },
-  { 4460, -1814, 5388, -1227 },
-  { 3920, -3268, 6364, -703 },
-  { 3343, -4698, 4410, 784 },
-  { 309, -1897, 6306, 1223 },
-  { 958, -3318, 4254, -3167 },
-  { -99, 1596, 6018, -1983 },
-  { -429, -853, 6407, 878 },
-  { 1170, -1322, 6290, -417 },
-  { 2288, -505, 6303, -1999 },
-  { 3312, -1674, 6749, -2494 },
-  { -415, -3401, 4721, -371 },
-  { -189, -1210, 4844, -2002 },
-  { 888, -4142, 4377, 130 },
-  { 2469, -4381, 5398, -2492 },
-  { 2879, -2912, 5094, -2598 },
-  { -717, -617, 5650, -685 },
-  { 1470, -3863, 5352, -1684 },
-  { 3935, -96, 3823, -730 },
-  { 3769, -430, 3168, 694 },
-  { 2556, 385, 3539, 512 },
-  { 77, -1415, 5111, 2655 },
-  { 2724, -2158, 6715, -822 },
-  { 1832, 1001, 5385, -1900 },
-  { 900, 2198, 4464, -559 },
-  { 441, 69, 5921, -1743 },
-  { -1161, 738, 6732, -308 },
-  { 257, 2035, 4091, 736 },
-  { 1607, 1288, 4355, -23 },
-  { -13, 1316, 4180, 1672 },
-  { 1511, 1336, 3057, 1435 },
-  { 2189, -3813, 4530, 939 },
-  { 3632, -706, 2646, 1375 },
-  { 4266, -3761, 4241, 1077 },
-  { 3101, -427, 5273, -1202 },
-  { 2293, 276, 4810, -313 },
-  { 3430, -1851, 3101, 2045 },
-  { 3453, -2979, 5142, 942 },
-  { 1683, -3281, 4802, 2002 },
-  { 3954, -4715, 5611, 578 },
-  { 1272, -155, 5085, 454 },
-  { 128, -194, 5095, 1409 },
-  { 820, 880, 5797, -2658 },
-  { -1095, 656, 5774, 1095 },
-  { 813, -1669, 4320, -3251 },
-  { -119, 518, 6372, -651 },
-  { 2922, -4299, 6115, -877 },
-  { 4205, -4273, 4004, 2642 },
-  { -1211, -3892, 224, 3127 },
-  { -34, -4371, 1321, 2318 },
-  { 77, -6326, 1201, 828 },
-  { 3995, -3775, 1958, 3233 },
-  { 178, -3301, 1985, 3318 },
-  { 2330, -3801, 1033, 3195 },
-  { 1413, -5536, 826, 1709 },
-  { 2468, -3499, 3653, 3631 },
-  { 741, -4617, 1723, 2008 },
-  { 1246, -3043, 2978, 3949 },
-  { -343, -4308, 2258, 2189 },
-  { -682, -4640, 454, 2272 },
-  { 1236, -4829, 2491, 1642 },
-  { -512, -3766, 1182, 3052 },
-  { 119, -3939, 3712, 971 },
-  { -1145, -4624, 1360, 2281 },
-  { 101, -4746, 2866, 1255 },
-  { -1500, -5455, 539, 1637 },
-  { -969, -5909, 1414, 1128 },
-  { -1261, -4939, -231, 2022 },
-  { -226, -5345, 1207, 705 },
-  { 2712, -5109, 3205, 1866 },
-  { -476, -5913, 273, 1208 },
-  { -2039, -4464, 624, 2545 },
-  { -2351, -3930, 2019, 2673 },
-  { -2675, -4849, 1522, 1990 },
-  { -1524, -3461, 1446, 3204 },
-  { 477, -5314, 1710, 1577 },
-  { 656, -3729, 2346, 2511 },
-  { 550, -5917, 1975, 1040 },
-  { 1728, -4704, 3067, 1058 },
-  { -9, -5247, 506, 1760 },
-  { -574, -5135, 1675, 1672 },
-  { 2129, -3781, 3444, 2313 },
-  { 1144, -4439, 2214, 2529 },
-  { 1292, -4160, 3185, 1833 },
-  { 2445, -3262, 2534, 3227 },
-  { 2266, -4401, 2023, 2400 },
-  { -587, -3602, 3408, 2067 },
-  { -885, -4951, 3228, 1174 },
-  { -728, -2711, 2807, 3552 },
-  { 1019, -3043, 3195, 2954 },
-  { 1888, -4615, 1140, 2454 },
-  { 660, -5616, 754, 800 },
-  { -1975, -5371, 1649, 1585 },
-  { -1544, -5436, 2422, 1081 },
-  { -422, -5882, 2390, 750 },
-  { 1336, -5557, 2441, 1230 },
-  { 136, -4001, 267, 2854 },
-  { -522, -3289, 2226, 2728 },
-  { -971, -4580, 2471, 708 },
-  { 704, -5306, 3300, 1001 },
-  { 325, -3464, 3555, 2398 },
-  { 794, -3686, 848, 3169 },
-  { 660, -3017, 4584, 3242 },
-  { -1486, -3978, 2170, 1644 },
-  { -1615, -4650, 2688, 1844 },
-  { 750, -4578, 538, 2239 },
-  { 1668, -5849, 1455, 1031 },
-  { 3486, -4681, 2030, 2183 },
-  { 2642, -5429, 1696, 1761 },
-  { 4491, -4502, 3538, 2767 },
-  { 3545, -4528, 3514, 2982 },
-  { 3269, -3676, 2758, 3966 },
-  { 5572, 1146, 209, -3379 },
-  { 7459, 1053, 593, -1896 },
-  { 4480, 200, -310, -4259 },
-  { 5577, -939, 242, -3992 },
-  { 8142, 442, 1257, -3083 },
-  { 5442, 1261, 1424, -3236 },
-  { 6260, -183, 3125, -2532 },
-  { 7179, 889, 1618, -2548 },
-  { 6416, 932, 2379, -2487 },
-  { 7094, 2560, 961, -3392 },
-  { 7322, 463, 2732, -3735 },
-  { 6632, 1577, 1912, -3272 },
-  { 6312, 1349, 3028, -3460 },
-  { 6105, 386, 1213, -977 },
-  { 5478, 1158, 1114, -486 },
-  { 6493, 410, 1686, -2180 },
-  { 6378, 1881, 1333, -2240 },
-  { 5711, 812, 1958, -1300 },
-  { 6844, 877, 730, -1189 },
-  { 6824, -245, 2249, -2000 },
-  { 7515, 1521, 1251, -3058 },
-  { 6697, 1051, 1300, -1749 },
-  { 6476, 1425, 811, -2773 },
-  { 7350, 465, -76, -2849 },
-  { 6975, 2095, 567, -2492 },
-  { 4691, 1736, 2660, -2289 },
-  { 7837, 1456, 340, -2767 },
-  { 7930, 507, 838, -2074 },
-  { 6106, 1502, 766, -1110 },
-  { 4891, -659, 835, -3954 },
-  { 7250, 141, 1369, -1523 },
-  { 7651, 67, 1651, -2298 },
-  { 7364, -305, 601, -3132 },
-  { 7179, 193, 2491, -2871 },
-  { 6504, -272, 2167, -1322 },
-  { 4456, 983, 2300, -421 },
-  { 4817, 457, 1695, 371 },
-  { 6914, 555, 850, -3159 },
-  { 5904, 1030, 202, -1959 },
-  { 6258, 880, 2233, -4503 },
-  { 6029, 10, 2130, -3600 },
-  { 6449, 985, 1129, -3963 },
-  { 6616, -18, -111, -3285 },
-  { 4496, 775, 817, -4276 },
-  { 6134, 2338, 1470, -2973 },
-  { 6911, 152, 430, -1946 },
-  { 4053, 991, 3218, -1193 },
-  { 5435, 1285, 3124, -2412 },
-  { 5507, 1836, 1935, -1988 },
-  { 5240, 689, 2189, -2670 },
-  { 6638, 1719, 606, -1799 },
-  { 5556, -180, 129, -2595 },
-  { 5644, 1918, 1281, -4316 },
-  { 6410, 1088, -282, -3117 },
-  { 6503, 1841, 312, -3514 },
-  { 6947, 20, 1358, -3886 },
-  { 5464, 2109, 2398, -3194 },
-  { 5616, -407, 2140, -498 },
-  { 6121, 2707, 2379, -4096 },
-  { 7303, 1846, 2266, -4095 },
-  { 5444, 470, 2718, -1553 },
-  { 5817, -645, 3285, -1349 },
-  { 5625, 1427, 1103, -1991 },
-  { 6041, -806, 1196, -2943 },
-  { 3050, -5722, 4070, -5460 },
-  { 3420, -4386, 4078, -5155 },
-  { 6020, -3982, 7268, -2689 },
-  { 7502, -4317, 7894, -3973 },
-  { 4156, -3558, 5247, -4316 },
-  { 4725, -4401, 7290, -1540 },
-  { 6688, -5122, 8216, -3210 },
-  { 9176, -6576, 9276, -4963 },
-  { 8706, -5708, 7987, -4621 },
-  { 7060, -3535, 6532, -3308 },
-  { 5600, -2719, 5363, -1568 },
-  { 4661, -2803, 6263, -4716 },
-  { 3673, -3636, 6147, -3433 },
-  { 5305, -2585, 6073, -2638 },
-  { 7614, -1962, 6079, -5266 },
-  { 6760, -3366, 7382, -4322 },
-  { 6385, -3883, 4797, -1353 },
-  { 8182, -5120, 4298, -4641 },
-  { 9130, -6198, 4975, -3063 },
-  { 7421, -5436, 5576, -3713 },
-  { 3483, -4898, 5443, -2745 },
-  { 4907, -5643, 6390, -4105 },
-  { 8119, -7008, 7992, -6764 },
-  { 6528, -6122, 6967, -5590 },
-  { 5890, -4190, 6624, -5688 },
-  { 6815, -7934, 7275, -5456 },
-  { 5434, -4306, 5169, -5378 },
-  { 4364, -6436, 5376, -2604 },
-  { 8152, -3404, 5913, -5048 },
-  { 7983, -4863, 4262, -2461 },
-  { 8023, -6188, 6238, -5062 },
-  { 6753, -3692, 3935, -3723 },
-  { 6826, -4760, 3284, -4051 },
-  { 7224, -7423, 4492, -3875 },
-  { 6904, -2590, 6587, -6248 },
-  { 6106, -1944, 7345, -5506 },
-  { 4956, -2990, 7808, -3146 },
-  { 6908, -6885, 5949, -1288 },
-  { 7162, -6058, 3419, -3401 },
-  { 7015, -7080, 6907, -3018 },
-  { 6971, -6832, 5646, -3273 },
-  { 8014, -5546, 5471, -1544 },
-  { 6792, -2220, 5105, -2879 },
-  { 8494, -3974, 4408, -3999 },
-  { 9591, -4866, 6027, -4558 },
-  { 5264, -5161, 6101, -738 },
-  { 5803, -6141, 5197, -5231 },
-  { 4657, -6822, 3232, -5189 },
-  { 4791, -5135, 3809, -4665 },
-  { 6108, -5103, 2379, -3873 },
-  { 4680, -3909, 3234, -5093 },
-  { 5802, -3853, 3795, -4984 },
-  { 4360, -7483, 4802, -3877 },
-  { 5429, -7517, 5911, -3717 },
-  { 6866, -2280, 4880, -4634 },
-  { 10131, -4628, 4414, -4092 },
-  { 10811, -5189, 7746, -5337 },
-  { 5663, -8941, 5287, -5680 },
-  { 8023, -5991, 7403, -2796 },
-  { 9669, -6919, 6525, -4932 },
-  { 7275, -3796, 4962, -2547 },
-  { 8848, -4806, 5677, -3080 },
-  { 8128, -4308, 7749, -6569 },
-  { 4032, -5196, 2282, -6239 },
-  { 6593, 700, -229, 304 },
-  { 8260, 539, -66, -1259 },
-  { 6605, 176, -814, -109 },
-  { 8057, 0, -1, -136 },
-  { 7382, -38, -484, -1129 },
-  { 8373, -929, 682, -454 },
-  { 7674, 690, -1278, 546 },
-  { 7326, -517, 406, -1283 },
-  { 7612, -1715, -1167, 1175 },
-  { 8590, 441, -782, -710 },
-  { 8572, -1202, -291, 260 },
-  { 7308, -147, -1785, 414 },
-  { 6787, -353, -672, 934 },
-  { 5177, -133, 179, 82 },
-  { 4161, -34, 447, 1497 },
-  { 5997, -902, 1533, -121 },
-  { 5727, -871, -1370, 945 },
-  { 8386, -252, 293, -823 },
-  { 6573, -1354, 682, 616 },
-  { 7650, -2096, 725, 457 },
-  { 8122, 78, 636, -1400 },
-  { 8421, 428, -1620, 131 },
-  { 7341, -1292, -717, 186 },
-  { 7998, -49, -720, 266 },
-  { 5987, -351, 669, 844 },
-  { 7314, -1620, 250, -603 },
-  { 7219, -1562, -572, 1994 },
-  { 8682, -358, -290, -388 },
-  { 5810, 155, -178, 1199 },
-  { 7246, -12, 1042, -786 },
-  { 7357, -923, 1468, -475 },
-  { 7801, 621, -212, -724 },
-  { 5346, -514, 1210, 1356 },
-  { 8459, 36, -127, -779 },
-  { 6878, -2429, 854, 1750 },
-  { 7280, -1401, -1353, 2845 },
-  { 7579, -2148, -1463, 2087 },
-  { 6637, 946, -872, 750 },
-  { 4807, -1100, 1289, 2602 },
-  { 4495, 219, 1551, 1128 },
-  { 7639, 506, 446, -1107 },
-  { 6359, 188, 1009, -115 },
-  { 6641, -1820, 1655, 723 },
-  { 5394, -2382, 1604, 2542 },
-  { 6021, -2644, 2396, 1407 },
-  { 4698, 882, 245, 1525 },
-  { 8103, 573, -798, -349 },
-  { 8045, -519, 997, -1092 },
-  { 7571, -122, 227, -338 },
-  { 5347, -1200, 630, 1718 },
-  { 7070, 790, 218, -544 },
-  { 7440, 728, -527, -20 },
-  { 6402, -355, 197, -736 },
-  { 4031, 771, 866, 1895 },
-  { 6009, 896, 445, -31 },
-  { 5160, 1098, -856, 1784 },
-  { 7980, -886, -1293, 1396 },
-  { 6318, -1361, 2423, 252 },
-  { 7547, -699, 133, 506 },
-  { 8562, -2344, 940, 264 },
-  { 5890, 1187, -1425, 2194 },
-  { 6558, -645, -1311, 2621 },
-  { 4634, -1671, 2075, 1623 },
-  { 5614, 105, -816, 2376 },
-  { 6646, 1558, -1365, 630 },
-  { 6998, 1150, -2117, -990 },
-  { 6555, 2311, -1093, -1783 },
-  { 6682, 1430, -2391, -1940 },
-  { 7861, 1555, -2977, -1188 },
-  { 6745, 1723, -459, -2085 },
-  { 7504, 1229, -1666, -2060 },
-  { 7937, 671, -2128, -1529 },
-  { 7139, 991, -735, -2632 },
-  { 6867, 1592, -1303, -2324 },
-  { 6401, 2230, -1732, -2508 },
-  { 7201, 2184, -2169, -1988 },
-  { 6636, 2190, -995, -2840 },
-  { 7620, 2306, -2089, -651 },
-  { 7584, 1875, -1438, -631 },
-  { 9214, 1561, -2464, -1139 },
-  { 6154, 1318, -1237, -2917 },
-  { 7917, 2847, -1797, -1599 },
-  { 8309, 2029, -2555, -465 },
-  { 8204, 1282, -584, -2405 },
-  { 8440, 1035, -1147, -1137 },
-  { 7107, 1858, -60, -1568 },
-  { 6781, 2912, -873, -1463 },
-  { 7603, 1316, -319, -1249 },
-  { 7833, 1335, -78, -1849 },
-  { 7930, 1141, -1016, -695 },
-  { 7883, 1610, -1017, -1314 },
-  { 8069, 1409, -1811, -196 },
-  { 8319, 1031, -582, -1590 },
-  { 5948, 1537, -2153, -2373 },
-  { 8684, 1171, -1871, -850 },
-  { 8357, 2484, -2411, -1292 },
-  { 6516, 2092, -193, -1167 },
-  { 6112, 1697, 22, -525 },
-  { 7161, 703, -602, -1879 },
-  { 6047, 2351, -807, -219 },
-  { 8072, 1854, -1817, -1553 },
-  { 6956, 1304, 76, -1011 },
-  { 6607, 1481, -544, -162 },
-  { 6958, 2541, -265, -1938 },
-  { 6416, 2514, -777, -850 },
-  { 7272, 2110, -899, -1171 },
-  { 7741, 2153, -283, -2614 },
-  { 6482, 2041, -1758, -1221 },
-  { 6762, 940, -1862, -2281 },
-  { 5610, 1194, -1691, -1561 },
-  { 7833, 2164, -823, -1952 },
-  { 5460, 1438, -848, 1189 },
-  { 6011, 1377, -771, -1557 },
-  { 7679, 544, -1134, -2214 },
-  { 7209, 1292, -2714, -1564 },
-  { 5567, 1200, -404, -169 },
-  { 5853, 1461, -1465, -518 },
-  { 6782, 689, -844, -860 },
-  { 7330, 1337, -1152, -71 },
-  { 7189, 1506, -653, -685 },
-  { 6860, 2116, -1403, -240 },
-  { 8804, 1516, -1391, -1760 },
-  { 7210, 2689, -1498, -989 },
-  { 7030, 3022, -1441, -2083 },
-  { 5649, 1836, -407, 525 },
-  { 7451, 3099, -717, -2464 },
-  { 7384, 1656, -2007, 398 },
-  { 6504, 707, -1919, -134 },
-  { -1851, 3639, -2279, -695 },
-  { -4037, 1644, -77, 1329 },
-  { -4025, 1960, -1565, -567 },
-  { -3430, 2495, -795, 368 },
-  { -4771, 2480, 993, 756 },
-  { -3431, 2058, -2539, -971 },
-  { -3802, 3418, 380, 217 },
-  { -3074, 3350, -1652, -1056 },
-  { -3705, 326, -1650, 1535 },
-  { -3122, 1281, -1192, 1607 },
-  { -4601, 1367, -968, 53 },
-  { -3808, 958, 44, 2560 },
-  { -2079, 2530, -1485, 1166 },
-  { -3707, 343, -2889, 180 },
-  { -5249, 1431, -31, 688 },
-  { -4990, 125, -704, 1270 },
-  { -2771, 1334, -2446, 746 },
-  { -2292, 994, -1527, 2630 },
-  { -1261, 3070, -2519, 268 },
-  { -2544, 3890, -1057, -552 },
-  { -4421, 255, -1980, 530 },
-  { -2951, 454, -13, 3643 },
-  { -2262, 1815, -370, 2880 },
-  { -2383, 3657, -649, 576 },
-  { -3541, -161, -1389, 2550 },
-  { -4241, 1575, 1325, 2561 },
-  { -2767, 4037, 1221, 1578 },
-  { -3748, 2697, 1148, 1801 },
-  { -4686, 2385, -220, 0 },
-  { -1531, 1645, -2751, 1327 },
-  { -45, 4032, -799, 2298 },
-  { -2915, 2280, 709, 2495 },
-  { -1199, 3278, -406, 2346 },
-  { -2471, 116, -2706, 2060 },
-  { -2440, 2173, -2894, -344 },
-  { -3375, 2287, 1781, 3226 },
-  { -2153, 3568, 1827, 2918 },
-  { -862, 2267, -1626, 2527 },
-  { -2698, 1135, 301, 4239 },
-  { -2364, 2123, 1010, 3710 },
-  { -2447, 3281, -81, 1408 },
-  { -2660, 4735, 472, 258 },
-  { -1053, 3097, 2682, 2398 },
-  { -3366, -1037, -1152, -868 },
-  { -643, 4242, 2212, 1259 },
-  { 971, 3991, 934, 643 },
-  { -1617, 2002, 2139, 2195 },
-  { -4897, 972, 784, 1719 },
-  { -1275, 2992, 1039, 3821 },
-  { -392, 4973, -209, 1821 },
-  { -1028, 4718, -1479, -137 },
-  { 50, 3914, 553, 2210 },
-  { 678, 4364, 359, 1303 },
-  { -582, 4911, 514, 1671 },
-  { 1276, 3914, -1252, 2934 },
-  { -1496, 3984, 857, 2330 },
-  { 772, 4744, -655, 2332 },
-  { -799, 5283, -439, 624 },
-  { 1341, 2937, 650, 2027 },
-  { -1739, 4892, 1275, 1702 },
-  { -892, 2596, -151, 3951 },
-  { -3532, 1090, 1292, 32 },
-  { 321, 3146, 2647, 1475 },
-  { 264, 4199, -1591, 1317 },
-  { -452, -2357, 2266, 4192 },
-  { 3022, -1033, -2389, 5678 },
-  { -1162, -1342, 3543, 4990 },
-  { -474, -1477, -1223, 5016 },
-  { -699, -2857, 900, 3835 },
-  { -461, -2255, -117, 4626 },
-  { 1204, -2062, -1211, 4403 },
-  { 2192, -3035, -337, 3966 },
-  { 108, -831, 279, 5643 },
-  { 1457, -620, -2908, 5276 },
-  { -2527, -78, 1085, 5460 },
-  { -1978, -1918, -949, 4733 },
-  { 32, 367, -1904, 5166 },
-  { 1890, -1665, 440, 4752 },
-  { -518, -348, 2816, 4891 },
-  { 3695, -2490, -1374, 4603 },
-  { 246, -1965, 3549, 3969 },
-  { 1100, -3111, 656, 3737 },
-  { -1379, 870, -414, 4575 },
-  { 628, -357, -1227, 6179 },
-  { -1129, -1318, -2457, 4576 },
-  { -425, -98, -73, 6336 },
-  { 367, -887, 2990, 4207 },
-  { 2091, -1251, 2444, 3557 },
-  { -1759, -1610, 2046, 5273 },
-  { 3210, 1414, -20, 2616 },
-  { 3303, -2636, 1005, 4237 },
-  { -327, -3107, -640, 3687 },
-  { -197, 764, 572, 5486 },
-  { 646, -767, 1388, 5464 },
-  { 104, 2742, -228, 3907 },
-  { -236, 1829, -579, 4585 },
-  { -2150, -474, -1525, 4006 },
-  { -23, -2632, -2400, 3892 },
-  { -12, -1739, -2910, 4867 },
-  { -2310, -368, -102, 4583 },
-  { -1991, -2061, 533, 4531 },
-  { 3884, -1446, -153, 4393 },
-  { 1568, 14, -289, 5268 },
-  { -1376, -253, -2797, 3417 },
-  { 3193, -2577, 2475, 3566 },
-  { 3418, 617, 1350, 1857 },
-  { 3792, -24, -272, 3370 },
-  { 153, 1159, 2906, 2877 },
-  { 511, 2162, 1548, 2741 },
-  { 262, 819, -2791, 3734 },
-  { 4232, -2015, 1486, 3477 },
-  { 2943, -1110, -1014, 5480 },
-  { 2842, 369, 703, 3476 },
-  { 3011, 1634, -933, 3553 },
-  { 4412, -1548, -942, 5021 },
-  { -1405, 593, 2372, 5267 },
-  { 2093, 2129, 896, 2365 },
-  { 4845, -1980, 0, 3823 },
-  { -2140, 81, 3278, 5637 },
-  { 1484, 2665, -324, 3653 },
-  { 10, 192, 1620, 5291 },
-  { 2152, 738, -2269, 5000 },
-  { 2102, 2748, -1652, 4707 },
-  { 2855, -2131, -387, 5188 },
-  { 1173, 676, 1338, 3277 },
-  { 2340, -2329, -2064, 4095 },
-  { 861, -2024, 1296, 5055 },
-  { 2189, 3225, -695, 2626 },
-  { 6196, -7079, 1943, -822 },
-  { 4547, -4813, 3261, 1856 },
-  { 4243, -6904, 3443, 448 },
-  { 4581, -7503, 946, 506 },
-  { 6626, -7754, 3427, 470 },
-  { 3407, -9088, 3269, -1496 },
-  { 4079, -6464, 2304, 777 },
-  { 5621, -9336, 2684, -768 },
-  { 5351, -6464, 5238, -214 },
-  { 5961, -8007, 1724, -3091 },
-  { 4213, -8067, 603, -246 },
-  { 7208, -7403, 3168, -1738 },
-  { 6098, -7700, 329, -1379 },
-  { 6525, -6735, 4248, -1072 },
-  { 6073, -6241, 2167, -2378 },
-  { 4609, -9218, 3051, -1033 },
-  { 6813, -7283, 1581, -1897 },
-  { 6126, -6275, 2789, 681 },
-  { 4423, -6538, 1621, -1692 },
-  { 6272, -8298, 3167, -1855 },
-  { 6172, -8558, 4498, -1169 },
-  { 4844, -8588, 1647, -366 },
-  { 6209, -8807, 1581, -369 },
-  { 5389, -8059, 550, -192 },
-  { 6654, -9775, 2504, -1063 },
-  { 7103, -7998, 806, 530 },
-  { 5662, -6736, 1565, -3620 },
-  { 4165, -9564, 4191, -2131 },
-  { 4526, -7181, 576, -2875 },
-  { 4633, -8623, 2807, -4742 },
-  { 3709, -7794, 1815, 34 },
-  { 3634, -8622, 2313, -826 },
-  { 6991, -8447, 2063, -3198 },
-  { 7757, -9486, 2255, -558 },
-  { 4149, -7778, 4728, -1696 },
-  { 5767, -7427, 1113, 707 },
-  { 4592, -6261, 2329, 1864 },
-  { 3159, -10498, 1677, -4273 },
-  { 3534, -9010, 2437, -3565 },
-  { 4479, -10821, 2715, -4942 },
-  { 3207, -9805, 3054, -3886 },
-  { 4627, -8189, 3018, -2354 },
-  { 5527, -10566, 3244, -2749 },
-  { 4346, -10127, 3335, -3084 },
-  { 6132, -10085, 3316, -1308 },
-  { 5629, -9704, 2178, -3058 },
-  { 3603, -8538, 1246, -624 },
-  { 3737, -8488, 395, -3167 },
-  { 5465, -11414, 2810, -4640 },
-  { 5306, -7745, 2721, -3988 },
-  { 7000, -9111, 1695, -1409 },
-  { 6663, -7741, 2466, -4079 },
-  { 4083, -7175, 1836, -4831 },
-  { 3613, -9926, 1342, -3455 },
-  { 6588, -8033, 457, -258 },
-  { 4720, -8102, 17, -1209 },
-  { 7414, -8709, 1294, -344 },
-  { 5437, -10030, 4043, -1704 },
-  { 4862, -9281, 1558, -1431 },
-  { 6800, -6403, 5113, 862 },
-  { 4623, -8242, 2667, -228 },
-  { 5919, -5083, 3348, 2135 },
-  { 5985, -8889, 2733, -5105 },
-  { 5029, -5767, 4407, 719 },
-  { 354, -6158, -838, -3001 },
-  { 351, -5943, -2104, -1534 },
-  { -633, -7190, -25, -4798 },
-  { -1595, -7235, -3812, -1400 },
-  { 103, -6197, -2933, -78 },
-  { -1722, -5020, -3441, -4333 },
-  { -1963, -5644, -4365, -270 },
-  { -846, -5743, -3477, 196 },
-  { -191, -5348, -4054, -469 },
-  { -2515, -7754, -3495, -818 },
-  { -2090, -6710, -2701, 117 },
-  { -546, -7036, -1398, 163 },
-  { -278, -7091, -2662, -536 },
-  { -622, -7962, -2731, -1464 },
-  { -1555, -8118, -3612, -2057 },
-  { -1094, -6280, -2314, 505 },
-  { -2556, -8538, -4024, -2247 },
-  { 109, -7134, -3107, -1823 },
-  { -900, -6954, -3340, -717 },
-  { -605, -7113, -3656, -2154 },
-  { 837, -6263, -3211, -2177 },
-  { -417, -5810, -3871, -1469 },
-  { -1318, -5649, -4207, -3198 },
-  { 413, -6765, -2082, -33 },
-  { -3101, -6450, -4362, -766 },
-  { 755, -6489, -2967, -846 },
-  { 1117, -7106, -2452, -1352 },
-  { -1202, -8387, -3072, -2897 },
-  { -365, -4894, -3561, -2937 },
-  { -2372, -8776, -265, -4441 },
-  { -1224, -8678, -896, -5074 },
-  { -755, -10096, -600, -6623 },
-  { 300, -8206, -225, -4568 },
-  { -1176, -6824, -2633, -3527 },
-  { -2006, -5443, -1526, -5849 },
-  { -1115, -5540, -2363, -4785 },
-  { 1059, -6812, -2543, -2654 },
-  { -1976, -6861, -3062, -5508 },
-  { -379, -5328, -2321, -3624 },
-  { -2108, -5860, -4518, -1915 },
-  { -379, -7885, -1329, -594 },
-  { 774, -5389, -581, -5213 },
-  { -2601, -5083, -1849, -4921 },
-  { -176, -5580, 74, -5075 },
-  { -204, -6780, -190, -6232 },
-  { 418, -7594, -1987, -820 },
-  { -1873, -8529, -2926, -1609 },
-  { 1340, -6362, -919, -4975 },
-  { 577, -7990, -2044, -1873 },
-  { -2572, -7413, -1745, -2224 },
-  { -2037, -7030, -1461, -7138 },
-  { -2559, -8756, -2039, -5836 },
-  { -2079, -6764, -1209, -5669 },
-  { -1613, -7801, -2006, -685 },
-  { -1865, -6583, -722, -3529 },
-  { -589, -6358, -1377, -1003 },
-  { -540, -7514, -1331, -3542 },
-  { 419, -6192, -1677, -4927 },
-  { -2786, -8763, -2966, -5065 },
-  { -2172, -8411, -1726, -4675 },
-  { -3382, -9833, -3497, -5722 },
-  { -2433, -10169, -2077, -5775 },
-  { -424, -9451, -1096, -3658 },
-  { -537, -8522, -910, -1897 },
-  { -5550, 2807, 1683, -693 },
-  { -6395, 635, 3573, -1246 },
-  { -7544, 2280, 2140, 44 },
-  { -8751, 1136, 2951, -794 },
-  { -5605, 2709, 2052, 916 },
-  { -7650, 654, 869, 135 },
-  { -6939, 967, 1409, 870 },
-  { -7834, 2123, 3310, 974 },
-  { -6935, 2818, 1274, -1678 },
-  { -5605, 2233, 1013, 471 },
-  { -7095, 1849, 1648, 198 },
-  { -6636, 1634, 712, -37 },
-  { -7279, 978, 296, -315 },
-  { -7664, 3504, 3292, -216 },
-  { -7836, 1209, 1221, -257 },
-  { -7913, 2201, 1765, -1529 },
-  { -7077, 3783, 2632, -1407 },
-  { -5565, 1645, 1410, -622 },
-  { -6494, 2879, 1181, -759 },
-  { -7073, 3137, 3010, 550 },
-  { -7249, 1839, 847, -805 },
-  { -6630, 2197, 282, -1096 },
-  { -8836, 1573, 1988, -1090 },
-  { -7809, 1274, 836, -1198 },
-  { -7895, 2970, 3511, -1097 },
-  { -6960, 1664, 1356, -2442 },
-  { -6582, 2866, 2273, 307 },
-  { -7221, 821, 2851, -1435 },
-  { -6015, 1703, 2001, -2367 },
-  { -8082, 1034, 2103, 239 },
-  { -5952, 1912, 301, -465 },
-  { -6099, 841, 379, 567 },
-  { -6343, 50, 494, 658 },
-  { -6586, 983, 591, -893 },
-  { -5500, 869, 2187, -2479 },
-  { -6482, 60, 1545, -979 },
-  { -6705, 515, 1974, -53 },
-  { -6460, 1755, 1325, -1275 },
-  { -6093, 2617, 2465, -623 },
-  { -7330, 2161, 594, -2115 },
-  { -7324, 762, 1593, -2004 },
-  { -6385, 679, 1510, -2514 },
-  { -6159, 241, 2976, -1631 },
-  { -8583, 3030, 4045, -162 },
-  { -6299, 66, 2209, -2103 },
-  { -5428, 1279, 3267, -1846 },
-  { -6438, 1335, 2728, -1631 },
-  { -8012, 1070, 2428, -1151 },
-  { -6201, 2781, 2349, -1918 },
-  { -5918, 1139, 3121, -148 },
-  { -6314, 2481, 3137, -1808 },
-  { -7180, 1722, 2435, -1602 },
-  { -6750, 1829, 3763, -1145 },
-  { -6713, 1777, 2221, 1212 },
-  { -7479, 1835, 3627, -479 },
-  { -7299, 10, 2406, -1593 },
-  { -8249, 3129, 996, -2870 },
-  { -8374, 1534, 1333, -1882 },
-  { -7507, 3353, 1598, -2299 },
-  { -7379, 2701, 2326, -1167 },
-  { -8440, 2276, 2796, -542 },
-  { -10348, 1527, 2649, -1165 },
-  { -8184, 3614, 2574, -1738 },
-  { -5539, 1574, 1733, 1138 },
-  { 9404, -7652, 67, 79 },
-  { 8654, -3972, 1358, -60 },
-  { 8617, -4794, 117, 2318 },
-  { 7886, -4505, 1784, 1200 },
-  { 8636, -6125, 3879, -1003 },
-  { 9654, -6836, 1816, 205 },
-  { 9374, -6553, 913, 1875 },
-  { 8020, -6150, 1134, 2390 },
-  { 7786, -4970, 2078, -1857 },
-  { 8691, -6119, 711, 708 },
-  { 9039, -5568, 2944, -1902 },
-  { 9955, -5048, 1433, -601 },
-  { 8089, -6927, 3093, -2846 },
-  { 8487, -7024, 2415, 19 },
-  { 9388, -5287, 3577, -2655 },
-  { 8591, -7371, 2300, -996 },
-  { 9104, -4763, 1453, -2558 },
-  { 7615, -5457, 596, 164 },
-  { 9860, -7047, 3433, -614 },
-  { 8756, -4404, 2235, -964 },
-  { 9462, -4660, 299, -1822 },
-  { 10119, -5550, 2689, -1273 },
-  { 10915, -7471, 2705, -1007 },
-  { 11433, -7090, 1410, -1198 },
-  { 9882, -7431, 2965, -1895 },
-  { 7628, -5219, 769, -2661 },
-  { 8169, -5318, 2262, 70 },
-  { 8846, -6320, 1939, -754 },
-  { 7147, -5593, 1248, -971 },
-  { 10652, -5485, 935, 137 },
-  { 7778, -6533, 2564, -1932 },
-  { 8878, -5173, 1214, -361 },
-  { 9828, -4943, 282, 510 },
-  { 10042, -6134, 3895, -1914 },
-  { 7965, -6630, 3566, -433 },
-  { 8573, -4502, 3574, -1209 },
-  { 8398, -4801, 1031, -1347 },
-  { 10136, -7772, 2612, 1547 },
-  { 9890, -7280, 1768, -1083 },
-  { 8407, -6585, -706, -58 },
-  { 7976, -7582, 229, -131 },
-  { 10481, -8866, 1166, -147 },
-  { 10914, -4342, 3189, -2412 },
-  { 10440, -5198, -104, -1109 },
-  { 11227, -6530, 2381, -2449 },
-  { 8487, -8064, 1086, 230 },
-  { 9975, -6123, -857, -134 },
-  { 8339, -6498, 1232, -2337 },
-  { 11042, -4506, 1119, -2098 },
-  { 12563, -5592, 1837, -2062 },
-  { 11801, -5590, 632, -1296 },
-  { 10152, -5617, 1511, -1917 },
-  { 7800, -6473, 51, -1337 },
-  { 7941, -5560, 2438, -3270 },
-  { 6554, -3834, 2100, 1476 },
-  { 9065, -5520, -226, -1120 },
-  { 10794, -7120, -243, 122 },
-  { 10429, -6968, 272, -806 },
-  { 8942, -8914, 1442, -392 },
-  { 9969, -5051, 2033, -2953 },
-  { 7275, -4152, 3058, -64 },
-  { 11127, -5488, 4589, -3227 },
-  { 9626, -6666, 2739, -2958 },
-  { 6943, -5362, 4470, 1008 },
-  { -7456, -967, 2936, -1002 },
-  { -8622, -333, 6962, 2606 },
-  { -7486, -3392, 3668, 1287 },
-  { -8053, -827, 5148, 1097 },
-  { -6610, 454, 4952, 96 },
-  { -7701, -1982, 3161, -468 },
-  { -7307, -1132, 4071, -36 },
-  { -8125, -271, 5199, 3862 },
-  { -9182, -1950, 2813, 1878 },
-  { -9855, -952, 4794, 3010 },
-  { -7241, 1431, 4202, 2468 },
-  { -9646, 157, 4766, 1046 },
-  { -9371, 1230, 6009, 2958 },
-  { -11514, -64, 8630, 5248 },
-  { -6766, 565, 2766, 2140 },
-  { -8426, -9, 2852, 1271 },
-  { -11291, -1113, 5087, 2937 },
-  { -8297, 2092, 4495, 1264 },
-  { -9983, 735, 3809, -51 },
-  { -9048, -1000, 3191, -308 },
-  { -7331, -1987, 2655, 1391 },
-  { -7144, -21, 4333, 2161 },
-  { -6032, -1540, 3543, 896 },
-  { -7987, -1036, 1985, 1529 },
-  { -9264, 2004, 5194, 290 },
-  { -11308, -840, 5754, 1654 },
-  { -9130, -2398, 4292, 2973 },
-  { -6248, 838, 3563, 1223 },
-  { -6819, -2760, 3511, 119 },
-  { -7213, -2006, 4364, 762 },
-  { -5431, -1047, 4533, 166 },
-  { -7098, -641, 2021, 639 },
-  { -8628, -2249, 3588, 399 },
-  { -6352, -1498, 3560, -648 },
-  { -7033, -2190, 4870, 2562 },
-  { -7405, -46, 3772, -581 },
-  { -6104, 796, 5143, 1965 },
-  { -5787, 943, 5784, 3030 },
-  { -8367, 1465, 7192, 4097 },
-  { -8259, 789, 5694, 1963 },
-  { -10614, -1899, 5748, 2645 },
-  { -8258, -805, 3698, 2275 },
-  { -6877, -972, 6431, 3160 },
-  { -6483, 363, 7018, 3129 },
-  { -6283, -1358, 5191, 1524 },
-  { -8853, -3157, 4119, 1741 },
-  { -6086, -267, 3883, -835 },
-  { -7254, 1032, 6613, 4017 },
-  { -11470, -3350, 4649, 3426 },
-  { -6743, 481, 6148, 1239 },
-  { -5394, -166, 5309, 3165 },
-  { -7958, 1068, 4268, -240 },
-  { -10520, 2256, 7916, 2828 },
-  { -5132, -4, 5739, 1176 },
-  { -8643, 120, 3255, -629 },
-  { -9631, 1974, 8870, 4362 },
-  { -10663, -1221, 3733, 589 },
-  { -8224, -1843, 5806, 2655 },
-  { -8282, 1255, 8647, 3478 },
-  { -12311, -1505, 9043, 6256 },
-  { -11312, -856, 7136, 4681 },
-  { -11944, -722, 7941, 3309 },
-  { -7868, -463, 6846, 4196 },
-  { -8679, -241, 7410, 5347 },
-  { 6759, -4680, -508, 1220 },
-  { 5176, -6111, 944, 121 },
-  { 6843, -5667, -1368, -533 },
-  { 5616, -5884, -1471, -695 },
-  { 6030, -5089, -1808, -940 },
-  { 7444, -5463, -52, 1881 },
-  { 4207, -6079, -506, 1571 },
-  { 6785, -4410, -649, 3084 },
-  { 4838, -5214, 2026, 2998 },
-  { 4201, -5790, 645, 1811 },
-  { 6930, -5129, -1940, 1698 },
-  { 6332, -4627, 692, 3027 },
-  { 6285, -4314, -106, 3644 },
-  { 6255, -5450, -1975, 742 },
-  { 4199, -4676, -459, 1796 },
-  { 5592, -5500, 1345, 1300 },
-  { 4358, -5556, -2236, 114 },
-  { 4620, -5875, -1563, 888 },
-  { 4892, -7550, -327, -419 },
-  { 4734, -7085, 7, 613 },
-  { 3883, -5562, -1969, 1080 },
-  { 5610, -4990, -204, 834 },
-  { 4117, -6482, -1271, 341 },
-  { 6585, -5107, 892, 1169 },
-  { 6632, -3683, 302, 3002 },
-  { 6326, -5351, -983, -1250 },
-  { 4382, -7192, -730, -158 },
-  { 5227, -6540, -451, 1123 },
-  { 5468, -6472, -870, -1471 },
-  { 5191, -6402, -1365, -127 },
-  { 7407, -6317, -973, -336 },
-  { 4611, -6530, -820, -1980 },
-  { 4963, -5159, -2050, -966 },
-  { 4414, -5691, -211, -998 },
-  { 5954, -5873, 750, -1749 },
-  { 4394, -4796, -1268, 254 },
-  { 7161, -6214, -1010, 689 },
-  { 4965, -3598, 2372, 1711 },
-  { 6248, -6180, 981, 864 },
-  { 6473, -5336, 525, -600 },
-  { 4591, -6864, -1131, -900 },
-  { 6314, -6440, -1021, -375 },
-  { 5838, -6209, -1199, 944 },
-  { 5308, -5283, -2100, 1267 },
-  { 4342, -5860, -1637, -1356 },
-  { 5680, -4388, -1227, -104 },
-  { 4900, -4098, 1449, 4046 },
-  { 4677, -4284, -106, 3190 },
-  { 7574, -6173, -848, 1859 },
-  { 6493, -7207, -131, 726 },
-  { 5513, -5261, -2117, 4 },
-  { 6191, -7352, -193, -505 },
-  { 5885, -4333, 324, -134 },
-  { 6162, -6081, -312, -2044 },
-  { 4216, -6200, -1810, -572 },
-  { 5652, -7035, -696, -197 },
-  { 7131, -7189, -366, -60 },
-  { 5032, -4803, -1514, 2832 },
-  { 7386, -4610, -606, 3489 },
-  { 4211, -5031, 1221, 3047 },
-  { 4050, -4653, 1584, 1469 },
-  { 6852, -5302, -1861, 206 },
-  { 7736, -4816, -1794, 3359 },
-  { 6290, -3439, 1522, 2454 },
-  { 1768, 5990, -5560, -2594 },
-  { 3903, 5326, -1530, -1501 },
-  { 2472, 3738, -2117, -4240 },
-  { 3260, 5448, -904, -4733 },
-  { 1435, 7297, -3676, -4102 },
-  { 4096, 5951, -656, -3312 },
-  { 2178, 6009, -3146, -3724 },
-  { 3787, 5493, -5473, -1633 },
-  { 2998, 7286, -3334, -3571 },
-  { 2894, 6576, -4708, -2804 },
-  { 830, 6163, -4286, -3348 },
-  { 4755, 5569, -1730, -2739 },
-  { 4604, 6065, -3562, -2605 },
-  { 2749, 5141, -3986, -2775 },
-  { 3942, 4875, -2143, -3340 },
-  { 2819, 8517, -2004, -2724 },
-  { 2146, 6298, -689, -3093 },
-  { 5196, 6504, -3393, -1475 },
-  { 1851, 8386, -1748, -1420 },
-  { 3474, 8572, -3534, -2688 },
-  { 4503, 7560, -3561, -2245 },
-  { 4433, 6219, -2393, -1575 },
-  { 3506, 7248, -2275, -1977 },
-  { 3490, 7409, -3147, -604 },
-  { 4214, 6447, -3520, 516 },
-  { 619, 7034, -829, -1705 },
-  { 1732, 7395, -356, -2208 },
-  { 1226, 5204, -3294, -3732 },
-  { 2027, 5619, -1813, -4146 },
-  { 3078, 5877, 47, -2651 },
-  { 1654, 5458, 424, -682 },
-  { 3163, 5464, -2026, -270 },
-  { 2884, 5375, -685, -530 },
-  { 2950, 7286, -35, -2967 },
-  { 1986, 5066, -597, 482 },
-  { 3459, 4308, -3845, -2333 },
-  { 3155, 7037, -1346, -4345 },
-  { 2193, 6696, -717, -1319 },
-  { 3677, 5089, -3892, -487 },
-  { 2186, 5136, -4186, -1492 },
-  { 773, 5796, -917, 817 },
-  { 2489, 6546, -3570, -2117 },
-  { 1223, 6469, -1362, -33 },
-  { 271, 6061, -1466, -1725 },
-  { 2540, 5171, -1847, 1032 },
-  { 2548, 5251, -2697, 1677 },
-  { 771, 7600, -768, -632 },
-  { 4710, 6647, -4736, -1275 },
-  { 1369, 5917, -2971, -1056 },
-  { 163, 5239, -3499, -2275 },
-  { 2104, 4285, -3211, -3286 },
-  { 1107, 7411, -1972, -1671 },
-  { 2196, 7262, -2310, -1926 },
-  { -244, 6439, -1745, -839 },
-  { 3293, 3832, -2890, -3000 },
-  { 419, 6443, -379, -407 },
-  { 3077, 4930, -1156, -2869 },
-  { 2131, 5874, -2330, 224 },
-  { 690, 6538, -2212, -2841 },
-  { 1602, 4421, -2515, 1542 },
-  { 3318, 9373, -3032, -3477 },
-  { 5646, 7462, -5153, -1463 },
-  { 4139, 7137, -1539, -3321 },
-  { 3481, 9077, -1645, -3653 },
-  { -7747, 375, -106, -543 },
-  { -8587, -1379, -586, -461 },
-  { -10146, -892, 2094, 694 },
-  { -8103, 382, 504, -325 },
-  { -8548, -92, 94, -656 },
-  { -7460, 38, 152, 388 },
-  { -8266, -271, -459, -883 },
-  { -7935, -664, -1026, -802 },
-  { -8341, -109, 853, 161 },
-  { -8802, -1355, 1099, 630 },
-  { -8957, -6, 1108, -669 },
-  { -7260, -1520, -43, -407 },
-  { -7555, -174, 668, -2562 },
-  { -9014, -126, 227, -1191 },
-  { -8184, 769, 290, -1375 },
-  { -9476, 55, 962, -1528 },
-  { -8679, 541, 755, -1030 },
-  { -9842, -1626, 838, -1588 },
-  { -8513, -702, 788, -1998 },
-  { -10101, -1558, -366, -1841 },
-  { -8135, 78, 1479, -1813 },
-  { -9128, -454, 313, -1786 },
-  { -7554, -1084, 831, -2442 },
-  { -7576, -701, 2068, -1665 },
-  { -7791, -1481, 1587, -1808 },
-  { -6701, -596, -97, 802 },
-  { -7418, -15, 684, -963 },
-  { -7127, -477, -139, -426 },
-  { -8097, -110, -36, -264 },
-  { -7620, -1922, -590, -101 },
-  { -7647, -1201, 279, 660 },
-  { -7856, -1974, 758, -2271 },
-  { -8496, -167, 2232, -1143 },
-  { -8506, -1359, 624, -740 },
-  { -7274, -1052, 1062, -139 },
-  { -7800, -217, 91, -1794 },
-  { -7030, -1694, -955, 615 },
-  { -9020, -1864, 101, -2182 },
-  { -9400, -740, 598, -667 },
-  { -8448, -1184, 2024, -1272 },
-  { -8812, -570, -897, -2384 },
-  { -10559, -1286, 538, -1536 },
-  { -8728, -888, -1089, -1397 },
-  { -7080, -1185, 636, -1252 },
-  { -9880, 233, 2344, -782 },
-  { -7952, -1326, -378, -1947 },
-  { -7207, -378, 1408, -2237 },
-  { -8467, -1545, 902, -1987 },
-  { -9163, -1474, 924, -1739 },
-  { -8159, -992, -77, -2744 },
-  { -8343, 148, -423, -1573 },
-  { -9105, -649, -254, -1214 },
-  { -8939, 456, 281, -1905 },
-  { -8837, 179, -394, -2634 },
-  { -9145, 757, 1547, -1319 },
-  { -9775, -723, 441, -1680 },
-  { -8910, -686, 1529, -1525 },
-  { -9492, -1134, 2064, -938 },
-  { -6111, -943, 677, -31 },
-  { -7411, -613, -814, 46 },
-  { -9479, -922, -430, -2061 },
-  { -11298, -1268, 1318, -1117 },
-  { -8190, 832, 671, -2214 },
-  { -10453, -550, 1672, -886 },
-  { 1044, 9353, -1651, -5423 },
-  { 1034, 8149, -455, -6166 },
-  { 761, 8293, -3214, -4838 },
-  { 938, 8077, 164, -5130 },
-  { 1295, 8673, 2582, -5490 },
-  { -314, 7973, -2395, -5231 },
-  { -507, 9012, -2497, -5775 },
-  { 2396, 8314, -1022, -4673 },
-  { -1516, 8501, 1950, -4969 },
-  { -308, 7401, 1549, -4866 },
-  { -112, 8340, 3003, -4920 },
-  { -50, 9315, 1371, -5666 },
-  { -659, 9449, 2496, -5547 },
-  { 2573, 9148, -2270, -4783 },
-  { 830, 7104, -438, -3907 },
-  { 522, 10672, -677, -6483 },
-  { -1190, 10108, -510, -6518 },
-  { -427, 8271, -579, -6315 },
-  { 1602, 8113, -1927, -4418 },
-  { -2266, 8180, 448, -5190 },
-  { -1633, 8816, -226, -5771 },
-  { 759, 9481, -105, -5813 },
-  { 2254, 6679, -466, -5662 },
-  { -88, 6946, 895, -5958 },
-  { -1705, 10009, 1394, -5574 },
-  { 748, 7943, 540, -6692 },
-  { 1411, 7009, 232, -6145 },
-  { 697, 7290, -1221, -5342 },
-  { -1764, 10580, 1944, -3981 },
-  { -1334, 9124, 1195, -3903 },
-  { -905, 10067, 635, -5039 },
-  { 664, 10680, 49, -4625 },
-  { 1374, 9536, -777, -3591 },
-  { 252, 9698, -597, -2931 },
-  { 824, 9164, -1014, -2144 },
-  { 2438, 10569, -2289, -4424 },
-  { 2101, 7102, 507, -3614 },
-  { 294, 8051, -432, -1518 },
-  { -665, 10337, 547, -2852 },
-  { 1168, 11989, -492, -5427 },
-  { 1344, 6416, 302, -5061 },
-  { -1727, 12264, 1507, -4543 },
-  { 674, 10889, -902, -3605 },
-  { -582, 9504, 300, -3618 },
-  { 641, 7654, 689, -2109 },
-  { 2065, 9243, 508, -4367 },
-  { 1055, 8373, 688, -3144 },
-  { -641, 8185, 986, -3307 },
-  { 1120, 7426, 1785, -3757 },
-  { 1660, 8070, -593, -3104 },
-  { 2002, 9467, -1722, -3475 },
-  { 2361, 8368, 100, -3709 },
-  { -772, 7845, -613, -4988 },
-  { 1485, 7430, 1896, -6127 },
-  { -432, 7823, -947, -2882 },
-  { 313, 11122, -760, -4871 },
-  { 412, 8412, -283, -4231 },
-  { 1585, 10402, -1884, -3267 },
-  { 321, 6952, 773, -3016 },
-  { -105, 9014, 121, -2249 },
-  { 1585, 10313, -977, -4812 },
-  { 1619, 11869, 1306, -6876 },
-  { -1168, 8886, -81, -2500 },
-  { -395, 10886, 733, -6490 },
-  { -4949, 4274, 3992, -1054 },
-  { -4241, 5299, 4262, -1584 },
-  { -2710, 3862, 4552, -1673 },
-  { -4608, 2472, 3672, -1715 },
-  { -2843, 2816, 4003, -2326 },
-  { -5229, 2964, 5636, 90 },
-  { -4924, 3442, 5015, -1096 },
-  { -1281, 3313, 5537, -2066 },
-  { -3808, 1939, 4351, -919 },
-  { -1915, 2585, 4939, -1614 },
-  { -3470, 1843, 5562, -682 },
-  { -3800, 870, 5827, 144 },
-  { -4985, 1452, 4728, -709 },
-  { -3745, 2750, 7220, 259 },
-  { -1875, 1900, 6514, -826 },
-  { -4329, 1574, 7192, 1304 },
-  { -5408, 1444, 6208, 631 },
-  { -3327, 5312, 5707, -1541 },
-  { -6966, 3334, 4034, 1028 },
-  { -7484, 4245, 4218, -212 },
-  { -6567, 5839, 4539, -512 },
-  { -5715, 5935, 3747, -1186 },
-  { -6410, 4881, 3356, -1610 },
-  { -5146, 2590, 2850, 2172 },
-  { -5196, 4095, 2569, -373 },
-  { -5043, 6025, 4318, 692 },
-  { -5525, 4884, 3513, 370 },
-  { -6804, 7533, 5812, -488 },
-  { -5657, 2480, 4061, 1234 },
-  { -3155, 1472, 6071, 1188 },
-  { -3427, 5217, 3442, 858 },
-  { -4698, 3013, 5517, 2586 },
-  { -4449, 2226, 5418, 3580 },
-  { -6395, 3547, 5487, 2028 },
-  { -3500, 5019, 4787, 1 },
-  { -4038, 2578, 3073, 3151 },
-  { -2750, 1955, 4469, 3856 },
-  { -5696, 1659, 6118, 2469 },
-  { -4350, 1241, 6840, 3126 },
-  { -5565, 5058, 5196, 1314 },
-  { -1642, 4190, 3948, 607 },
-  { -1233, 4108, 4850, -640 },
-  { -997, 3428, 3239, 1378 },
-  { -6488, 2741, 6926, 2792 },
-  { -4188, 3763, 4235, 2018 },
-  { -3210, 3224, 5646, 1427 },
-  { -5526, 6909, 5070, -627 },
-  { -2815, 3994, 3425, 1903 },
-  { -2163, 2734, 5423, 145 },
-  { -4149, 4247, 2355, 734 },
-  { -410, 2521, 4138, -16 },
-  { -2411, 2385, 4927, 2105 },
-  { -6077, 3591, 3114, 594 },
-  { -4186, 4834, 5926, -1004 },
-  { -7315, 3369, 5966, 448 },
-  { -7042, 5721, 5771, 238 },
-  { -4466, 3907, 3535, -1751 },
-  { -2116, 3970, 6163, -1392 },
-  { -7239, 2143, 8407, 3630 },
-  { -5431, 4486, 6486, -42 },
-  { -1874, 1617, 6333, 519 },
-  { -6478, 2629, 4634, -505 },
-  { -7784, 2342, 7216, 1365 },
-  { -1154, 1432, 4831, 1544 },
-  { -4964, -5801, 1797, 506 },
-  { -4436, -6905, 1059, -1237 },
-  { -5400, -6886, 884, -290 },
-  { -6259, -7103, 523, -227 },
-  { -4819, -6450, 1412, -450 },
-  { -4056, -6213, 1725, -943 },
-  { -5642, -6091, 1357, 605 },
-  { -4196, -5678, 2187, -173 },
-  { -4726, -5126, 2470, 321 },
-  { -6642, -5091, 1507, -1005 },
-  { -5304, -5250, 1944, 1579 },
-  { -7179, -5520, 1468, -425 },
-  { -6033, -4895, 1876, -955 },
-  { -6595, -5143, 2207, 1291 },
-  { -4224, -4943, 1846, 1792 },
-  { -7128, -6950, 539, 724 },
-  { -4369, -4901, 2590, 1103 },
-  { -7413, -5696, 1712, 1440 },
-  { -5885, -6821, 418, 871 },
-  { -6828, -5599, 710, -1563 },
-  { -6123, -5817, 1358, 1631 },
-  { -5291, -5622, 578, 2138 },
-  { -7171, -6004, 347, 2208 },
-  { -6083, -5251, 2132, 425 },
-  { -4329, -5721, 407, -2993 },
-  { -5326, -5056, 1119, -1837 },
-  { -5485, -5856, 185, -2389 },
-  { -6529, -5178, 403, -697 },
-  { -6719, -4412, 2726, 871 },
-  { -5126, -5629, 1835, -771 },
-  { -5622, -4361, 2973, 858 },
-  { -5282, -5895, 45, -335 },
-  { -4357, -5656, 1696, -1558 },
-  { -7139, -6659, 627, -409 },
-  { -4415, -6328, 35, 1306 },
-  { -7639, -6110, 1134, 197 },
-  { -3626, -5592, 2019, 901 },
-  { -3547, -5064, 1176, 1738 },
-  { -5075, -3899, 2087, 266 },
-  { -4086, -6311, 1479, 360 },
-  { -6210, -5220, -199, -1477 },
-  { -3910, -5063, 1356, -15 },
-  { -7616, -4977, 461, 2401 },
-  { -6118, -6131, 1258, -563 },
-  { -6127, -4968, 1286, -27 },
-  { -4121, -5852, 1113, 1476 },
-  { -5157, -4881, 1162, -662 },
-  { -4637, -5031, 1179, 709 },
-  { -5509, -5452, -397, 1224 },
-  { -4597, -6861, 646, 467 },
-  { -6247, -4043, 468, 278 },
-  { -5336, -6465, 874, -1472 },
-  { -6998, -6346, 78, -1798 },
-  { -4915, -4530, 2756, -203 },
-  { -6048, -4373, 1468, 1052 },
-  { -4273, -7100, 942, -323 },
-  { -6552, -4287, 2351, 69 },
-  { -6954, -4613, 722, 1521 },
-  { -4201, -5361, 763, -1562 },
-  { -6881, -5596, -748, 669 },
-  { -6695, -3547, -34, 1299 },
-  { -3981, -5728, 84, 111 },
-  { -4663, -4809, 2173, -1031 },
-  { -6599, -6077, 1303, 256 },
-  { -7596, -4265, -5791, -4140 },
-  { -6610, -2758, -5288, -3936 },
-  { -5880, -3865, -6563, -3088 },
-  { -7228, -5510, -7677, -3912 },
-  { -8854, -6553, -8318, -5361 },
-  { -9362, -5249, -6413, -4319 },
-  { -4418, -3110, -6368, -4358 },
-  { -5544, -4203, -6863, -5013 },
-  { -3056, -4316, -5567, -3181 },
-  { -3078, -5999, -5051, -2657 },
-  { -5884, -6292, -5756, -4013 },
-  { -4825, -4549, -5535, -4053 },
-  { -4443, -6126, -5316, -1368 },
-  { -3972, -6341, -6098, -2686 },
-  { -5751, -2781, -5398, -6230 },
-  { -4466, -6135, -5570, -3679 },
-  { -4291, -5992, -3564, -5189 },
-  { -7189, -4429, -7279, -6082 },
-  { -5076, -4433, -2748, -5366 },
-  { -6225, -2825, -6833, -5663 },
-  { -2989, -4792, -3960, -4492 },
-  { -7836, -7773, -7722, -5741 },
-  { -6559, -5703, -5844, -5589 },
-  { -7612, -5438, -4136, -3774 },
-  { -4218, -4176, -6591, -2333 },
-  { -4837, -5063, -6581, 322 },
-  { -6590, -5990, -2980, -3847 },
-  { -5558, -2971, -5489, -1932 },
-  { -7001, -5323, -4975, -1697 },
-  { -4694, -2688, -6904, -3044 },
-  { -8511, -5379, -5767, -2549 },
-  { -7548, -5412, -6522, -2572 },
-  { -6597, -4973, -6423, -1274 },
-  { -6415, -4022, -5168, -1072 },
-  { -5528, -5530, -7218, -2345 },
-  { -4845, -4805, -5943, -1227 },
-  { -6049, -7150, -6744, -2161 },
-  { -9061, -7299, -8542, -4375 },
-  { -5010, -5546, -5416, -82 },
-  { -4135, -4205, -5109, -3373 },
-  { -3311, -5869, -4007, -5061 },
-  { -5993, -6472, -3962, -4718 },
-  { -2966, -5832, -2821, -6305 },
-  { -4851, -5152, -2067, -3930 },
-  { -3620, -4441, -3362, -5836 },
-  { -4469, -5221, -4534, -5592 },
-  { -4022, -6335, -4321, -6107 },
-  { -4899, -4503, -3084, -3725 },
-  { -4490, -8276, -4620, -6236 },
-  { -6591, -4342, -7365, -4063 },
-  { -6498, -5057, -5553, 485 },
-  { -6060, -2714, -7093, -4144 },
-  { -6199, -7774, -7094, -4057 },
-  { -7536, -6424, -6415, -4265 },
-  { -7439, -2454, -6348, -4827 },
-  { -5333, -7565, -4417, -4639 },
-  { -4353, -7103, -4197, -2689 },
-  { -5229, -6549, -5129, -6804 },
-  { -6129, -7701, -5236, -4836 },
-  { -6797, -3983, -3884, -4406 },
-  { -6624, -4467, -4745, -5052 },
-  { -3324, -7596, -2720, -6553 },
-  { -5473, -6284, -1704, -4511 },
-  { -4131, -7263, -3180, -5196 },
-  { -7116, -5565, -3469, 685 },
-  { -6002, -6021, -3858, 576 },
-  { -3144, -8203, -1291, -434 },
-  { -6096, -7027, -4004, 1353 },
-  { -3943, -7709, -2344, -36 },
-  { -4510, -6767, -2642, 631 },
-  { -3657, -11541, -2570, -3984 },
-  { -5959, -8854, -1333, -867 },
-  { -6699, -8866, -1606, -344 },
-  { -3836, -7961, -2334, -2028 },
-  { -3430, -8045, -3037, -672 },
-  { -3868, -9184, -3635, -1819 },
-  { -4258, -9060, -2621, -1008 },
-  { -3595, -8693, -2022, -752 },
-  { -4573, -8048, -3166, -2622 },
-  { -4852, -7903, -1405, 256 },
-  { -4591, -7057, -1560, 965 },
-  { -6963, -7655, -980, 808 },
-  { -5179, -6641, -3356, 1196 },
-  { -7102, -6941, -2798, 2123 },
-  { -6867, -5834, -3320, -770 },
-  { -5977, -7369, -2500, -778 },
-  { -6160, -6400, -934, -2543 },
-  { -6741, -7608, -355, -1289 },
-  { -6856, -6466, -1433, -1643 },
-  { -4786, -6292, -4970, 376 },
-  { -5407, -8866, -2255, -400 },
-  { -3814, -6506, -1387, -3620 },
-  { -4998, -6137, -1200, -4092 },
-  { -5123, -9557, -2849, -1306 },
-  { -4259, -6444, -4395, -338 },
-  { -5221, -6810, -883, 1225 },
-  { -6137, -6215, -2165, 554 },
-  { -3895, -6557, -3176, -1829 },
-  { -3886, -8188, -87, -954 },
-  { -7243, -6707, -2216, -316 },
-  { -5592, -7606, 85, -432 },
-  { -3957, -7945, -504, -144 },
-  { -4617, -7624, 218, -312 },
-  { -4797, -8737, -844, -1051 },
-  { -4478, -8516, -1401, -454 },
-  { -4557, -7058, -302, -2332 },
-  { -6623, -7736, -271, -50 },
-  { -3157, -7532, -1111, -2207 },
-  { -3590, -7300, -1271, 517 },
-  { -4442, -7306, -507, 590 },
-  { -6458, -7524, -2807, 666 },
-  { -4991, -8466, -3363, -785 },
-  { -7474, -7541, -1056, -1839 },
-  { -7501, -8316, -938, -180 },
-  { -5329, -7739, -579, -2341 },
-  { -4549, -7063, -176, -3539 },
-  { -5191, -8612, -1504, -4250 },
-  { -3083, -7058, -2251, 32 },
-  { -4003, -7043, -1093, -791 },
-  { -5523, -8093, -678, -114 },
-  { -3022, -10265, -2070, -3109 },
-  { -3905, -6274, -182, -3652 },
-  { -3269, -9217, -551, -2650 },
-  { -3138, -9314, -1726, -1704 },
-  { -4420, -10339, -1744, -3459 },
-  { -4163, -8609, -2298, -4113 },
-  { -5566, -6505, -1241, -463 },
-  { -3130, -9746, -2352, -4884 },
-  { -7825, -3439, 1451, -1468 },
-  { -8451, -3318, 2360, -435 },
-  { -8462, -4130, 1438, -1024 },
-  { -9425, -4564, 1328, -689 },
-  { -11014, -3202, 2278, 2080 },
-  { -8269, -2761, -146, -440 },
-  { -7497, -2618, -166, 413 },
-  { -8250, -3060, 522, -2133 },
-  { -8365, -5366, 1347, -451 },
-  { -8589, -3979, 2943, 714 },
-  { -8111, -2572, 1272, -1748 },
-  { -7830, -5193, 605, -1484 },
-  { -8119, -4736, 2141, 256 },
-  { -7724, -4769, 1463, -812 },
-  { -7363, -3911, 2540, 4 },
-  { -7974, -3397, 2363, 1366 },
-  { -7359, -4204, 1752, -958 },
-  { -7622, -3505, 660, 916 },
-  { -9934, -3665, 3165, 828 },
-  { -8721, -4162, 62, 1718 },
-  { -9433, -4768, 2722, 1234 },
-  { -7960, -4496, 138, 1528 },
-  { -8198, -3454, -443, 631 },
-  { -7756, -2246, 655, 1137 },
-  { -8841, -3145, 1113, 829 },
-  { -7817, -3298, 1251, 230 },
-  { -9413, -2733, 323, -1862 },
-  { -9408, -4168, 1270, 1549 },
-  { -9037, -3892, -942, 283 },
-  { -8255, -3849, 1301, 1762 },
-  { -9057, -3987, -41, -682 },
-  { -9441, -4187, 2019, -111 },
-  { -9740, -3178, 1602, -871 },
-  { -8344, -2474, 1461, 1506 },
-  { -9752, -2925, 1996, 1243 },
-  { -9199, -3796, 180, 537 },
-  { -9060, -2405, 1140, -1562 },
-  { -9348, -2376, 309, -162 },
-  { -10786, -3182, -5, -1500 },
-  { -8142, -4540, -434, -826 },
-  { -7528, -2341, 1104, -73 },
-  { -9360, -2658, 3062, 56 },
-  { -8267, -2335, 2000, -1193 },
-  { -12169, -3154, 1287, -640 },
-  { -11398, -2120, 946, -1163 },
-  { -8940, -4559, 328, -1696 },
-  { -11025, -4213, 2813, 840 },
-  { -9224, -3581, 2224, 2039 },
-  { -8943, -3337, 1248, -1298 },
-  { -7900, -4042, 485, -2080 },
-  { -9221, -1947, 2191, -880 },
-  { -10762, -1800, 2516, -324 },
-  { -10095, -2238, 981, -1335 },
-  { -11908, -2808, 3255, 645 },
-  { -10640, -4105, 1283, -595 },
-  { -7663, -2863, 2467, -797 },
-  { -10712, -3854, 3710, 1538 },
-  { -10823, -2893, 1408, -801 },
-  { -9874, -3832, 256, -1638 },
-  { -10394, -3391, 2315, -94 },
-  { -11525, -4079, 4153, 2122 },
-  { -9546, -2088, 1541, 481 },
-  { -8731, -2433, 1042, 2160 },
-  { -7852, -3977, -1370, 1677 },
-  { 7072, -3420, 1398, -1741 },
-  { 6180, -1976, 1280, -3557 },
-  { 7692, -1793, 2844, -1700 },
-  { 8363, -1773, 3104, -2679 },
-  { 9213, -3266, 3756, -3542 },
-  { 9650, -2644, 1426, -1318 },
-  { 7712, -2796, 3686, -1975 },
-  { 7316, -3517, 2821, -622 },
-  { 7434, -2594, 2305, -2264 },
-  { 7237, -1797, 255, -3114 },
-  { 8663, -1983, 1338, -3056 },
-  { 6616, -952, 4059, -2652 },
-  { 8823, -1327, 1362, -1356 },
-  { 9938, -1722, 1287, -2362 },
-  { 7207, -1057, 1913, -1315 },
-  { 7508, -1585, 870, -1982 },
-  { 8217, -3680, 1417, -3170 },
-  { 8329, -2541, 1684, -585 },
-  { 8062, -2335, 252, -2800 },
-  { 8204, -4108, 3097, -2569 },
-  { 7701, -3367, 576, -3008 },
-  { 7350, -786, 2414, -2129 },
-  { 6948, -2568, 1607, -225 },
-  { 7684, -2387, 1308, -3449 },
-  { 8306, -3458, 2394, -1454 },
-  { 8438, -2781, 1043, -1362 },
-  { 9175, -2076, 2144, -1987 },
-  { 8347, -2709, 3489, -4301 },
-  { 5696, -2377, 2870, 851 },
-  { 8825, -1243, 2219, -2603 },
-  { 8801, -1614, 584, -2513 },
-  { 8413, -384, 1421, -2244 },
-  { 9228, -3050, 3279, -2164 },
-  { 6342, -2698, 3547, -107 },
-  { 10053, -2476, 2837, -3168 },
-  { 7439, -604, 3177, -3991 },
-  { 7749, -1064, 4329, -4855 },
-  { 8655, -2177, 2252, -3519 },
-  { 8490, -228, 1958, -3233 },
-  { 10513, -2968, 1911, -2340 },
-  { 8146, -862, 1884, -1723 },
-  { 7788, -666, 3004, -2891 },
-  { 7785, -1620, 4133, -3417 },
-  { 10262, -3731, 3455, -2971 },
-  { 8570, -905, 4519, -4649 },
-  { 9129, -2562, 463, -2465 },
-  { 9451, -3587, 1904, -3056 },
-  { 6549, -2236, 3010, -4523 },
-  { 7175, -2684, 2967, -3458 },
-  { 9872, -3278, 1054, -2472 },
-  { 9153, -931, 1217, -2565 },
-  { 8789, -3469, 753, -2568 },
-  { 6683, -3791, 1797, -3968 },
-  { 6801, -1977, 2311, -452 },
-  { 6336, -1572, 2612, -3264 },
-  { 7996, -1008, 730, -2964 },
-  { 7521, -1059, 1573, -3694 },
-  { 8148, -3973, 2600, -3572 },
-  { 7765, -1532, 2528, -3856 },
-  { 7404, -3918, 4472, -143 },
-  { 8894, -1398, 3299, -3685 },
-  { 5768, -2041, 1487, -637 },
-  { 5131, -2865, 2463, -811 },
-  { 6439, -1568, 3500, -1550 },
-  { -8878, -6798, -5319, -1452 },
-  { -6332, -9713, -3112, -990 },
-  { -8444, -6316, -3694, -687 },
-  { -6123, -10840, -3637, -4358 },
-  { -4784, -9580, -4577, -2581 },
-  { -6108, -10515, -4859, -2524 },
-  { -7605, -7518, -2327, -2797 },
-  { -9662, -8775, -2467, -2010 },
-  { -6494, -7523, -4715, -118 },
-  { -8290, -8982, -1672, -317 },
-  { -8798, -11051, -3888, -1426 },
-  { -6273, -6623, -6791, -142 },
-  { -8313, -7668, -2141, -1275 },
-  { -6453, -8412, -3589, -4102 },
-  { -6747, -7750, -5690, -2498 },
-  { -7814, -6693, -3174, -2446 },
-  { -10383, -10130, -3931, -2364 },
-  { -10606, -8467, -5539, -2772 },
-  { -9475, -6671, -3305, -2271 },
-  { -8982, -9457, -5635, -4005 },
-  { -10111, -7965, -6515, -4180 },
-  { -7301, -6479, -5364, 720 },
-  { -9543, -8999, -7921, -912 },
-  { -9534, -8562, -3469, -384 },
-  { -7601, -10344, -3205, -1127 },
-  { -8088, -8620, -4954, -2888 },
-  { -8202, -8406, -7038, -3775 },
-  { -7312, -8324, -3334, -1775 },
-  { -8566, -9262, -8071, -4174 },
-  { -7068, -11300, -5573, -2907 },
-  { -8295, -8952, -4366, -1544 },
-  { -11104, -10210, -2285, -384 },
-  { -5213, -7520, -5008, -1339 },
-  { -5889, -7940, -5987, -1385 },
-  { -10816, -8201, -4153, -1485 },
-  { -10277, -8919, -6315, -1652 },
-  { -5888, -10320, -3821, -1733 },
-  { -10497, -7181, -6083, -3032 },
-  { -7721, -9724, -6591, -5336 },
-  { -5688, -7894, -3486, -2552 },
-  { -10014, -10500, -3247, -820 },
-  { -6301, -8765, -4506, -2923 },
-  { -8261, -7847, -6213, -1552 },
-  { -10212, -7481, -8113, -3954 },
-  { -6938, -10874, -6074, -4703 },
-  { -7183, -10968, -4446, -1773 },
-  { -7120, -9193, -1966, -2509 },
-  { -6234, -9263, -2313, -4284 },
-  { -8503, -9857, -2429, -608 },
-  { -9372, -7844, -8391, -2120 },
-  { -7951, -7157, -6535, -11 },
-  { -7256, -9473, -2172, -660 },
-  { -10063, -9612, -2515, -15 },
-  { -6684, -9134, -6109, -4206 },
-  { -8204, -11932, -5220, -2306 },
-  { -9710, -6706, -4115, -3275 },
-  { -6855, -7078, -2409, -4447 },
-  { -7344, -7673, -4479, -4116 },
-  { -8851, -6842, -4927, -2948 },
-  { -8927, -10452, -5633, -2194 },
-  { -8627, -9002, -7176, -1575 },
-  { -8209, -9722, -7021, -3324 },
-  { -3770, -10249, -3623, -4816 },
-  { -8183, -7465, -4090, 646 },
-  { -8163, -7149, 200, 498 },
-  { -8289, -6266, 686, -206 },
-  { -10030, -6241, -1032, -1864 },
-  { -8793, -8327, -773, -169 },
-  { -9149, -6215, 969, -15 },
-  { -8303, -5859, -7, 2006 },
-  { -9682, -7283, 255, 1322 },
-  { -9293, -7227, 71, -231 },
-  { -8525, -6215, 287, -837 },
-  { -10477, -5379, 1159, 1449 },
-  { -10726, -7856, -130, 102 },
-  { -8694, -7461, -1210, 690 },
-  { -9367, -5324, 1103, 3170 },
-  { -10686, -8055, -831, 1633 },
-  { -9201, -6873, -2704, 2258 },
-  { -8421, -5358, -1405, 226 },
-  { -9066, -5830, -307, -1571 },
-  { -11150, -7381, -2746, -900 },
-  { -9978, -5925, -2006, -437 },
-  { -9464, -4741, -273, 1061 },
-  { -10543, -6684, -1113, 1660 },
-  { -10073, -5576, 1083, -269 },
-  { -8826, -5763, 1600, 1486 },
-  { -10445, -9071, -1253, -64 },
-  { -12085, -5799, 2, 769 },
-  { -12939, -6663, 1650, 1437 },
-  { -10932, -6434, -1252, -649 },
-  { -11650, -7826, -2053, 710 },
-  { -12122, -6733, -1889, -731 },
-  { -9093, -6095, -2463, -842 },
-  { -10977, -4364, 469, 420 },
-  { -11488, -6908, -521, 893 },
-  { -9669, -5478, -842, 337 },
-  { -10606, -5203, -632, -1361 },
-  { -10198, -6284, 1662, 1277 },
-  { -10135, -5292, 2435, 3493 },
-  { -11027, -6561, 655, 56 },
-  { -10977, -5030, 1127, -358 },
-  { -12766, -3986, 1348, -335 },
-  { -14244, -7731, 264, 317 },
-  { -15124, -10309, -508, 1447 },
-  { -12821, -8638, -608, 137 },
-  { -13076, -8693, -2852, -431 },
-  { -11156, -5546, -2252, -1600 },
-  { -8692, -7366, -819, -1223 },
-  { -12507, -9816, -1714, -121 },
-  { -10712, -6666, 544, 3349 },
-  { -12462, -5890, -2491, -2318 },
-  { -12468, -7226, 437, 232 },
-  { -11300, -5226, 2068, 687 },
-  { -11994, -8320, -626, 2728 },
-  { -12222, -5476, 1142, 18 },
-  { -10277, -8122, -2418, 2003 },
-  { -13418, -6115, -3563, -2802 },
-  { -14759, -9834, -1243, 21 },
-  { -13699, -5665, 1525, 507 },
-  { -16269, -9476, -701, 163 },
-  { -12677, -5437, -247, -1019 },
-  { -11827, -4295, -181, -1243 },
-  { -12847, -4496, 2984, 1123 },
-  { -13860, -7915, -1166, -547 },
-  { -12276, -8145, -2290, -1527 },
-  { -11417, -4830, 2983, 1854 },
-  { -11793, -6002, 1163, 1940 },
-  { 11443, -4920, -3235, 3151 },
-  { 11300, -6616, -1506, 1175 },
-  { 9198, -4628, -2060, 2390 },
-  { 10532, -4027, -643, 912 },
-  { 9902, -3573, -1606, 1327 },
-  { 9653, -3536, -2240, 1869 },
-  { 9948, -5171, -423, 2662 },
-  { 12316, -4004, -1989, 281 },
-  { 12125, -4800, -1265, -163 },
-  { 10650, -2617, -2337, 1462 },
-  { 9909, -4968, -2376, 916 },
-  { 12944, -4647, -1958, 460 },
-  { 12988, -5283, -1141, 41 },
-  { 12321, -2915, -3621, 1025 },
-  { 11449, -2894, -2728, 351 },
-  { 12087, -3041, -2002, -32 },
-  { 11558, -4031, -1343, -399 },
-  { 12983, -3740, -3516, 1245 },
-  { 12099, -2515, -2752, 225 },
-  { 12515, -3465, -2701, 550 },
-  { 14683, -5022, -5272, 2996 },
-  { 12260, -3383, -1215, -528 },
-  { 13810, -5422, -2443, 1166 },
-  { 13421, -5378, -1886, 721 },
-  { 12961, -4259, -2594, 796 },
-  { 12266, -2104, -4768, 1591 },
-  { 13523, -4710, -3045, 1342 },
-  { 12437, -2099, -5610, 2117 },
-  { 11850, -2183, -3497, 661 },
-  { 12275, -3936, -597, -697 },
-  { 12459, -5253, -517, -544 },
-  { 12835, -4094, -1322, -168 },
-  { 14360, -5677, -3305, 1859 },
-  { 13905, -4552, -4309, 2117 },
-  { 11559, -3412, -1847, -81 },
-  { 13379, -3167, -5764, 2746 },
-  { 11910, -1634, -4342, 1052 },
-  { 12662, -4742, 71, -974 },
-  { 13057, -3254, -4424, 1705 },
-  { 15046, -5706, -4851, 3019 },
-  { 14162, -4142, -5514, 2843 },
-  { 12764, -1845, -6684, 2888 },
-  { 13714, -2374, -7838, 3857 },
-  { 13295, -1663, -8293, 4073 },
-  { 10032, -4152, -3403, 1421 },
-  { 10942, -5386, -2222, 950 },
-  { 10532, -6385, -1750, 1925 },
-  { 10273, -5972, -1534, 643 },
-  { 10605, -4782, -1695, 27 },
-  { 10988, -5153, -1123, -341 },
-  { 11629, -5884, -1060, 48 },
-  { 10441, -4045, -2431, 311 },
-  { 10788, -3595, -4171, 1807 },
-  { 12110, -5686, -2127, 976 },
-  { 11746, -4773, -2639, 891 },
-  { 11541, -5299, -3031, 1732 },
-  { 11416, -2559, -5359, 2198 },
-  { 11583, -5376, -704, 677 },
-  { 10416, -3214, -3516, 872 },
-  { 9651, -5435, -1618, 3255 },
-  { 9973, -5133, -996, 3923 },
-  { 11707, -4643, -430, -796 },
-  { 10994, -2709, -3587, 2302 },
-  { 10716, -5118, -645, 270 },
-  { 14100, -10314, 1095, 1531 },
-  { 12944, -8049, 1105, -741 },
-  { 13276, -7035, -511, 274 },
-  { 14008, -7254, -283, 139 },
-  { 11594, -6536, -91, 1671 },
-  { 11732, -8645, 746, 15 },
-  { 14613, -7085, -1578, 1183 },
-  { 13083, -6224, -750, -4 },
-  { 13988, -6256, -1592, 820 },
-  { 14678, -8683, 441, 126 },
-  { 15571, -8872, -521, 1139 },
-  { 15642, -9533, 341, 697 },
-  { 15960, -9586, -168, 1121 },
-  { 15464, -10239, 1433, -1 },
-  { 14934, -7887, -1046, 1080 },
-  { 15252, -7630, -1899, 1628 },
-  { 15485, -8384, -1234, 1484 },
-  { 15962, -8638, -1815, 1931 },
-  { 16501, -10664, 398, 1167 },
-  { 16146, -10145, 411, 918 },
-  { 14573, -7475, -697, 601 },
-  { 14302, -7996, 28, 257 },
-  { 14769, -6792, -2286, 1574 },
-  { 14144, -6137, -2169, 1257 },
-  { 14770, -6271, -3111, 1933 },
-  { 14110, -8312, 1083, -531 },
-  { 15235, -6991, -2993, 2174 },
-  { 13222, -5805, 547, -891 },
-  { 14796, -8762, 1254, -246 },
-  { 16040, -9181, -1005, 1551 },
-  { 16487, -10086, -373, 1420 },
-  { 15077, -9479, 966, 51 },
-  { 13026, -6468, 932, -1080 },
-  { 12703, -6152, -33, -573 },
-  { 15641, -6810, -4128, 2874 },
-  { 13282, -7673, 1583, -1283 },
-  { 12373, -7150, 1512, -917 },
-  { 12992, -7751, -678, 783 },
-  { 10907, -6858, -313, 2597 },
-  { 13026, -8963, 125, 2152 },
-  { 12770, -9946, 1957, -505 },
-  { 12482, -6849, -1268, 833 },
-  { 13790, -6181, -138, -279 },
-  { 12709, -8382, 2044, 227 },
-  { 12244, -6630, 203, -457 },
-  { 14209, -6816, -1032, 632 },
-  { 15134, -8267, -288, 640 },
-  { 13619, -6157, -1090, 356 },
-  { 14044, -7413, 725, -484 },
-  { 12958, -7753, 2585, -1980 },
-  { 13188, -8396, 2306, -1558 },
-  { 14379, -9980, 2132, -688 },
-  { 14275, -9857, 1162, 179 },
-  { 13690, -8648, 1621, -889 },
-  { 11770, -6829, -746, 278 },
-  { 12732, -8202, 286, 90 },
-  { 13630, -10146, 1867, -207 },
-  { 12072, -8740, 1299, -645 },
-  { 12852, -9492, 1226, 62 },
-  { 11792, -7382, -54, -116 },
-  { 13779, -9014, 487, 351 },
-  { 11951, -7729, 121, 834 },
-  { 11970, -9781, 2276, -4 },
-  { 12680, -7984, 2787, -787 },
-  { 13300, -14488, 6408, -1927 },
-  { 13635, -15355, 9153, -3073 },
-  { 12804, -13566, 5517, -1625 },
-  { 16624, -10854, 1690, 28 },
-  { 20387, -18532, 6162, -261 },
-  { 16515, -12642, 3392, -519 },
-  { 15800, -11095, 2151, -202 },
-  { 16824, -11790, 1651, 599 },
-  { 17604, -13213, 2563, 538 },
-  { 17892, -14177, 3562, 147 },
-  { 16987, -11399, 869, 1052 },
-  { 17003, -12456, 2442, 265 },
-  { 21657, -21806, 9198, -1250 },
-  { 16825, -13341, 3980, -686 },
-  { 17525, -12714, 1887, 805 },
-  { 16419, -11034, 1216, 617 },
-  { 20931, -19939, 7469, -684 },
-  { 18452, -15390, 4573, -191 },
-  { 14778, -10077, 2841, -1209 },
-  { 17402, -13319, 3042, 160 },
-  { 19365, -17922, 7087, -1061 },
-  { 16298, -11941, 2810, -351 },
-  { 19087, -16176, 4775, -84 },
-  { 17666, -12289, 938, 1224 },
-  { 18581, -15894, 5132, -430 },
-  { 19823, -16717, 4142, 545 },
-  { 19960, -19423, 8400, -1492 },
-  { 18973, -16817, 5906, -594 },
-  { 19079, -15431, 3528, 503 },
-  { 16667, -12485, 4467, -1302 },
-  { 19791, -17797, 6196, -529 },
-  { 20005, -17606, 5354, -20 },
-  { 20123, -18599, 6886, -728 },
-  { 19068, -14805, 2394, 1105 },
-  { 14443, -13723, 5631, -2029 },
-  { 14730, -14231, 5631, -1450 },
-  { 16089, -15959, 7271, -2029 },
-  { 13473, -11200, 3236, -924 },
-  { 14413, -10902, 2347, -267 },
-  { 17666, -18662, 11381, -3496 },
-  { 14749, -11042, 3305, -275 },
-  { 15304, -10486, 1869, -240 },
-  { 14809, -12126, 3369, -616 },
-  { 16896, -16561, 7307, -1845 },
-  { 15782, -14336, 5380, -1264 },
-  { 16395, -15520, 6415, -1588 },
-  { 13681, -11114, 2584, -320 },
-  { 14244, -12326, 4480, -1632 },
-  { 15247, -13119, 4265, -898 },
-  { 13987, -12091, 3469, -597 },
-  { 13941, -12770, 4240, -839 },
-  { 13771, -13627, 5252, -1384 },
-  { 15010, -16074, 7592, -2249 },
-  { 15852, -17226, 8619, -2655 },
-  { 18921, -16916, 6875, -1501 },
-  { 14909, -11678, 2768, -295 },
-  { 18988, -18353, 8424, -2070 },
-  { 15457, -15080, 6218, -1513 },
-  { 14916, -15512, 6949, -1883 },
-  { 18108, -14702, 4681, -701 },
-  { 17600, -15733, 5616, -775 },
-  { 14070, -13683, 6472, -2626 },
-  { 13832, -11914, 5201, -2232 },
-  { 18846, -19009, 9192, -1961 },
-  { -11981, -10994, -6324, -2264 },
-  { -10976, -9047, -6546, -3828 },
-  { -11288, -10532, -7014, -4191 },
-  { -10139, -10189, -7799, -2688 },
-  { -10555, -9988, -9181, -2040 },
-  { -11596, -11339, -10022, -2707 },
-  { -13400, -13395, -11306, -4206 },
-  { -9774, -12281, -7466, -4133 },
-  { -10842, -13125, -8777, -4956 },
-  { -11964, -15082, -9779, -5095 },
-  { -9382, -10188, -9053, -4927 },
-  { -11562, -11296, -3651, -985 },
-  { -9287, -10083, -7918, -4069 },
-  { -12821, -16556, -11410, -6195 },
-  { -12628, -8959, -4521, -1113 },
-  { -13845, -11581, -3649, -681 },
-  { -12685, -10269, -5483, -1275 },
-  { -14988, -12874, -5107, -1189 },
-  { -13761, -11367, -6202, -1804 },
-  { -13225, -11249, -7820, -3354 },
-  { -14809, -11992, -3202, -312 },
-  { -15620, -15519, -10210, -3433 },
-  { -12954, -10200, -3139, -611 },
-  { -11536, -9981, -5284, -923 },
-  { -13034, -12417, -4612, -1098 },
-  { -16911, -15505, -6123, -1352 },
-  { -17396, -17685, -8330, -2171 },
-  { -14120, -10764, -2265, -99 },
-  { -12598, -7367, -5406, -3530 },
-  { -14143, -12793, -10909, -5226 },
-  { -14692, -16871, -11626, -5554 },
-  { -12581, -11197, -9194, -3837 },
-  { -16752, -16726, -9746, -2808 },
-  { -10600, -10358, -6560, -1227 },
-  { -14573, -13312, -8957, -3393 },
-  { -10172, -8463, -8579, -3387 },
-  { -11418, -12421, -5522, -1842 },
-  { -11855, -14204, -6669, -2625 },
-  { -13308, -8191, -3941, -2194 },
-  { -10007, -12266, -5022, -1811 },
-  { -13532, -15771, -9497, -3175 },
-  { -11760, -11148, -10339, -5529 },
-  { -12149, -12763, -11198, -3697 },
-  { -12029, -12119, -8555, -1792 },
-  { -16995, -19957, -11447, -3471 },
-  { -13144, -14504, -9988, -3191 },
-  { -9938, -11064, -6139, -3162 },
-  { -8873, -11550, -8294, -6550 },
-  { -9303, -13010, -6150, -2711 },
-  { -15463, -10469, -1766, -170 },
-  { -15985, -11693, -3007, -650 },
-  { -17142, -10671, -1434, 47 },
-  { -16063, -13858, -4817, -1058 },
-  { -19446, -19599, -9594, -2464 },
-  { -20076, -18744, -8313, -1889 },
-  { -15047, -16085, -7590, -2250 },
-  { -13481, -16195, -8552, -2998 },
-  { -13829, -14869, -6704, -1932 },
-  { -16357, -18484, -9802, -2959 },
-  { -10551, -8393, -9303, -5070 },
-  { -11345, -9156, -5641, -3107 },
-  { -13217, -13449, -9270, -4541 },
-  { -11988, -13732, -9995, -6374 },
-  { -11007, -9519, -5168, -4107 },
-  { 9930, -7858, 8061, -4375 },
-  { 8274, -7867, 5992, -2096 },
-  { 9692, -9675, 7621, -3670 },
-  { 9589, -8110, 6509, -3010 },
-  { 12617, -11976, 10122, -5360 },
-  { 11867, -8895, 7948, -5323 },
-  { 10388, -10482, 9234, -4324 },
-  { 8188, -8220, 7810, -2737 },
-  { 10407, -8787, 4806, -1930 },
-  { 10348, -8845, 9233, -6614 },
-  { 9422, -7091, 4820, -2878 },
-  { 9758, -9796, 5584, -2256 },
-  { 10188, -7994, 5347, -3343 },
-  { 11133, -7455, 4015, -2306 },
-  { 10676, -10744, 6093, -2629 },
-  { 11522, -12184, 7848, -3375 },
-  { 8805, -9883, 5317, -3071 },
-  { 9498, -9654, 6555, -3592 },
-  { 10488, -8008, 4066, -1252 },
-  { 11261, -8930, 6068, -2738 },
-  { 12180, -10397, 5027, -1531 },
-  { 9138, -8531, 3601, -1959 },
-  { 8107, -8380, 4970, -2061 },
-  { 9737, -13248, 6438, -2617 },
-  { 11178, -10423, 2622, -522 },
-  { 9572, -12372, 5199, -2019 },
-  { 12057, -12144, 4147, -1099 },
-  { 9047, -9925, 2516, -665 },
-  { 10790, -8030, 5882, -4386 },
-  { 7199, -8426, 6337, -2841 },
-  { 7778, -8285, 3529, -3442 },
-  { 7559, -10569, 3484, -1332 },
-  { 9404, -8115, 7484, -5541 },
-  { 7792, -11976, 5546, -2573 },
-  { 9313, -10264, 7661, -5195 },
-  { 6701, -10725, 4370, -1784 },
-  { 4918, -11361, 4507, -4527 },
-  { 5147, -12305, 3978, -5556 },
-  { 6525, -9899, 4481, -3129 },
-  { 7538, -12855, 6060, -4826 },
-  { 8659, -12111, 7159, -4430 },
-  { 8440, -11304, 4547, -1747 },
-  { 9216, -10918, 3507, -1195 },
-  { 6165, -9254, 4771, -4677 },
-  { 9163, -11019, 5637, -4935 },
-  { 13441, -11509, 6676, -2434 },
-  { 7912, -9398, 6663, -4048 },
-  { 11723, -13745, 8131, -4148 },
-  { 6065, -10257, 5005, -6327 },
-  { 11618, -12417, 5336, -1894 },
-  { 8891, -13924, 8407, -6131 },
-  { 9622, -12563, 7908, -5109 },
-  { 11479, -10315, 8349, -3991 },
-  { 11676, -14103, 6611, -2330 },
-  { 11951, -8953, 3829, -1550 },
-  { 10486, -8044, 10493, -5920 },
-  { 11801, -10769, 9763, -5305 },
-  { 6109, -8676, 5827, -1346 },
-  { 7030, -9611, 5624, -5761 },
-  { 12808, -12886, 8683, -4148 },
-  { 13213, -10464, 6381, -3189 },
-  { 11796, -13681, 10703, -6075 },
-  { 9639, -7949, 9625, -3944 },
-  { 8538, -6997, 5309, 453 }
-};
-
-/* quantization tables */
-
-static const uint32_t scale_factor_quant6[64] = {
-        1,       2,       2,       3,       3,       4,       6,       7,
-       10,      12,      16,      20,      26,      34,      44,      56,
-       72,      93,     120,     155,     200,     257,     331,     427,
-      550,     708,     912,    1175,    1514,    1950,    2512,    3236,
-     4169,    5370,    6918,    8913,   11482,   14791,   19055,   24547,
-    31623,   40738,   52481,   67608,   87096,  112202,  144544,  186209,
-   239883,  309030,  398107,  512861,  660693,  851138, 1096478, 1412538,
-  1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638,       0
-};
-
-static const uint32_t scale_factor_quant7[128] = {
-        1,       1,       2,       2,       2,       2,       3,       3,
-        3,       4,       4,       5,       6,       7,       7,       8,
-       10,      11,      12,      14,      16,      18,      20,      23,
-       26,      30,      34,      38,      44,      50,      56,      64,
-       72,      82,      93,     106,     120,     136,     155,     176,
-      200,     226,     257,     292,     331,     376,     427,     484,
-      550,     624,     708,     804,     912,    1035,    1175,    1334,
-     1514,    1718,    1950,    2213,    2512,    2851,    3236,    3673,
-     4169,    4732,    5370,    6095,    6918,    7852,    8913,   10116,
-    11482,   13032,   14791,   16788,   19055,   21627,   24547,   27861,
-    31623,   35892,   40738,   46238,   52481,   59566,   67608,   76736,
-    87096,   98855,  112202,  127350,  144544,  164059,  186209,  211349,
-   239883,  272270,  309030,  350752,  398107,  451856,  512861,  582103,
-   660693,  749894,  851138,  966051, 1096478, 1244515, 1412538, 1603245,
-  1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704,
-  5011872, 5688529, 6456542, 7328245, 8317638,       0,       0,       0
-};
-
-/* 20bits unsigned fractional binary codes */
-static const uint32_t lossy_quant[32] = {
-        0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063,
-   796918,  461373,  251658,  146801,   79692,   46137,   27263,   16777,
-    10486,    5872,    3355,    1887,    1258,     713,     336,     168,
-       84,      42,      21,       0,       0,       0,       0,       0
-};
-
-static const float lossy_quant_d[32] = {
-          0,     1.6,      1.0,     0.8,    0.59,    0.50,    0.42,    0.34,
-       0.19,    0.11,     0.06,   0.035,   0.019,   0.011,  0.0065,  0.0040,
-     0.0025,  0.0014,   0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004,
-    0.00002, 0.00001, 0.000005,       0,       0,       0,       0,       0
-};
-
-/* 20bits unsigned fractional binary codes */
-static const uint32_t lossless_quant[32] = {
-        0, 4194304, 2097152, 1384120, 1048576,  696254,  524288,  348127,
-   262144,  131072,   65431,   33026,   16450,    8208,    4100,    2049,
-     1024,     512,     256,     128,      64,      32,      16,       8,
-        4,       2,       1,       0,       0,       0,       0,       0
-};
-
-static const float lossless_quant_d[32] = {
-    0,             1.0,      0.5,     0.33,     0.25,    0.166,    0.125,
-    0.083,      0.0625,  0.03125,   0.0156, 7.874E-3, 3.922E-3, 1.957E-3,
-    9.775E-4, 4.885E-4, 2.442E-4, 1.221E-4, 6.104E-5, 3.052E-5, 1.526E-5,
-    7.629E-6, 3.815E-6, 1.907E-6, 9.537E-7, 4.768E-7, 2.384E-7,        0,
-           0,        0,        0,        0
-};
-
-
-/* Vector quantization tables */
-
-static const int8_t high_freq_vq[1024][32] =
-{
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22,
-    2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9 },
-  { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9,
-    -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15 },
-  { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0,
-    8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4 },
-  { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6,
-    -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14 },
-  { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1,
-    3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8 },
-  { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14,
-    -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2 },
-  { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3,
-    -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20 },
-  { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1,
-    -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2 },
-  { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24,
-    18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4 },
-  { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15,
-    -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5 },
-  { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13,
-    -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14 },
-  { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4,
-    -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 },
-  { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27,
-    18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 },
-  { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7,
-    -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3 },
-  { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2,
-    -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2 },
-  { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6,
-    -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4 },
-  { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15,
-    -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 },
-  { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11,
-    29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 },
-  { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1,
-    -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3 },
-  { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10,
-    -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 },
-  { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4,
-    24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 },
-  { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0,
-    0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1 },
-  { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3,
-    -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 },
-  { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0,
-    -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6 },
-  { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3,
-    13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0 },
-  { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3,
-    -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0 },
-  { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1,
-    0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7 },
-  { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5,
-    1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4 },
-  { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2,
-    45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1 },
-  { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4,
-    34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 },
-  { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38,
-    15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1 },
-  { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1,
-    2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 },
-  { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6,
-    -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19 },
-  { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10,
-    2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 },
-  { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10,
-    -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14 },
-  { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0,
-    8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9 },
-  { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0,
-    8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10 },
-  { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8,
-    -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 },
-  { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4,
-    -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8 },
-  { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2,
-    -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15 },
-  { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1,
-    0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23 },
-  { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1,
-    0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16 },
-  { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10,
-    -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 },
-  { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7,
-    -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 },
-  { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10,
-    -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4 },
-  { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6,
-    -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1 },
-  { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9,
-    -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7 },
-  { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3,
-    -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 },
-  { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1,
-    -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2 },
-  { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2,
-    -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1 },
-  { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1,
-    -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4 },
-  { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21,
-    4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 },
-  { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4,
-    0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18 },
-  { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1,
-    8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 },
-  { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2,
-    5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0 },
-  { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1,
-    3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10 },
-  { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7,
-    -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 },
-  { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6,
-    -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1 },
-  { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5,
-    -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21 },
-  { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0,
-    -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10 },
-  { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6,
-    13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16 },
-  { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5,
-    -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3 },
-  { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1,
-    -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5 },
-  { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7,
-    -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 },
-  { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5,
-    -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1 },
-  { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8,
-    -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 },
-  { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3,
-    4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 },
-  { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9,
-    -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 },
-  { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10,
-    -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2 },
-  { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5,
-    -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 },
-  { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2,
-    -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 },
-  { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2,
-    3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 },
-  { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5,
-    3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 },
-  { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22,
-    2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11 },
-  { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2,
-    6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 },
-  { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4,
-    1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18 },
-  { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15,
-    -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 },
-  { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4,
-    6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 },
-  { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1,
-    2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5 },
-  { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7,
-    11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 },
-  { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8,
-    -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 },
-  { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10,
-    -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5 },
-  { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4,
-    0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 },
-  { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3,
-    6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 },
-  { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8,
-    0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 },
-  { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14,
-    13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 },
-  { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4,
-    -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 },
-  { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2,
-    -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 },
-  { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1,
-    7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 },
-  { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1,
-    6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1 },
-  { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5,
-    -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17 },
-  { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4,
-    -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 },
-  { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4,
-    2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 },
-  { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5,
-    -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 },
-  { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5,
-    -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 },
-  { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1,
-    -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19 },
-  { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22,
-    8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11 },
-  { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3,
-    -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16 },
-  { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2,
-    16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2 },
-  { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4,
-    12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5 },
-  { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1,
-    1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9 },
-  { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3,
-    7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13 },
-  { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1,
-    0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7 },
-  { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4,
-    3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3 },
-  { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1,
-    11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2 },
-  { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11,
-    3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2 },
-  { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2,
-    0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27 },
-  { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5,
-    3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4 },
-  { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8,
-    -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10 },
-  { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2,
-    1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8 },
-  { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2,
-    -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8 },
-  { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6,
-    -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12 },
-  { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7,
-    18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9 },
-  { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5,
-    -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1 },
-  { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7,
-    6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6 },
-  { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0,
-    -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1 },
-  { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3,
-    -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11 },
-  { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4,
-    -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2 },
-  { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2,
-    4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1 },
-  { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3,
-    -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8 },
-  { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8,
-    7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6 },
-  { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6,
-    3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4 },
-  { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3,
-    9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12 },
-  { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1,
-    0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7 },
-  { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2,
-    4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5 },
-  { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1,
-    8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18 },
-  { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4,
-    1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12 },
-  { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5,
-    8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10 },
-  { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11,
-    2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9 },
-  { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9,
-    22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8 },
-  { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18,
-    -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1 },
-  { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6,
-    -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6 },
-  { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17,
-    37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3 },
-  { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6,
-    2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3 },
-  { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9,
-    -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5 },
-  { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7,
-    -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1,
-    -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4,
-    -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1,
-    15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 },
-  { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33,
-    10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2 },
-  { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1,
-    11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
-    2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0 },
-  { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10,
-    -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3 },
-  { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1,
-    -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 },
-  { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18,
-    -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4 },
-  { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5,
-    2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 },
-  { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5,
-    8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28 },
-  { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18,
-    4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5 },
-  { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0,
-    -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1 },
-  { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9,
-    -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8 },
-  { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9,
-    -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9 },
-  { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9,
-    0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8 },
-  { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12,
-    12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5 },
-  { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3,
-    27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12 },
-  { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28,
-    2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8 },
-  { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27,
-    14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
-    5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1,
-    4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1,
-    6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6 },
-  { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1,
-    10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 },
-  { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0,
-    11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3 },
-  { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3,
-    -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6 },
-  { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14,
-    4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 },
-  { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9,
-    -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1 },
-  { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17,
-    16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 },
-  { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10,
-    -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 },
-  { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7,
-    6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4 },
-  { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3,
-    0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 },
-  { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3,
-    -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10 },
-  { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11,
-    -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3 },
-  { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7,
-    4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2 },
-  { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1,
-    -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5 },
-  { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4,
-    -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 },
-  { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4,
-    -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0 },
-  { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4,
-    -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 },
-  { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15,
-    -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3 },
-  { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4,
-    0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 },
-  { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7,
-    -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1 },
-  { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3,
-    6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 },
-  { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6,
-    -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2 },
-  { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4,
-    -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1 },
-  { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7,
-    -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 },
-  { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3,
-    6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 },
-  { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15,
-    -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0 },
-  { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7,
-    7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1 },
-  { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1,
-    -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4 },
-  { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13,
-    -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 },
-  { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10,
-    -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7 },
-  { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15,
-    4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7 },
-  { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15,
-    -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 },
-  { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7,
-    -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 },
-  { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9,
-    -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5 },
-  { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4,
-    10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4 },
-  { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19,
-    0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3 },
-  { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12,
-    -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2 },
-  { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3,
-    6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0 },
-  { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9,
-    1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9 },
-  { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1,
-    3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 },
-  { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7,
-    5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1 },
-  { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7,
-    1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1 },
-  { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5,
-    4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3 },
-  { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11,
-    16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1 },
-  { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4,
-    -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 },
-  { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0,
-    4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 },
-  { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5,
-    7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16 },
-  { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7,
-    9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4 },
-  { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8,
-    1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2 },
-  { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0,
-    2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10 },
-  { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4,
-    13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8 },
-  { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21,
-    2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8 },
-  { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1,
-    27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3 },
-  { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4,
-    5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10 },
-  { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0,
-    1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2 },
-  { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8,
-    2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3 },
-  { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8,
-    -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14 },
-  { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2,
-    2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7 },
-  { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2,
-    -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 },
-  { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6,
-    -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 },
-  { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11,
-    5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3 },
-  { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4,
-    0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 },
-  { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3,
-    3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2 },
-  { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2,
-    -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 },
-  { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6,
-    1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 },
-  { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5,
-    -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 },
-  { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3,
-    -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0 },
-  { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0,
-    3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 },
-  { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10,
-    -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 },
-  { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6,
-    11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 },
-  { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18,
-    1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7 },
-  { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2,
-    4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9 },
-  { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9,
-    2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 },
-  { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11,
-    9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4 },
-  { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8,
-    3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 },
-  { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1,
-    -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 },
-  { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4,
-    6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 },
-  { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4,
-    -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 },
-  { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0,
-    -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 },
-  { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2,
-    -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10 },
-  { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2,
-    -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7 },
-  { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6,
-    10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10 },
-  { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2,
-    2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1 },
-  { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9,
-    -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 },
-  { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12,
-    15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 },
-  { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17,
-    11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3 },
-  { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5,
-    12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1 },
-  { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4,
-    -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4 },
-  { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4,
-    -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 },
-  { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16,
-    13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 },
-  { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4,
-    -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 },
-  { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6,
-    3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 },
-  { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6,
-    -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 },
-  { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14,
-    2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 },
-  { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7,
-    5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 },
-  { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4,
-    -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3 },
-  { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10,
-    12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 },
-  { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3,
-    14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1 },
-  { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18,
-    11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 },
-  { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2,
-    4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 },
-  { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7,
-    7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 },
-  { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11,
-    9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4 },
-  { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11,
-    -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2 },
-  { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4,
-    13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1 },
-  { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18,
-    16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12 },
-  { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20,
-    14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 },
-  { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10,
-    16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4 },
-  { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17,
-    7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12 },
-  { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9,
-    2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4 },
-  { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3,
-    6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 },
-  { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25,
-    3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0 },
-  { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0,
-    11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4 },
-  { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10,
-    3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11 },
-  { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21,
-    8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 },
-  { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10,
-    -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 },
-  { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13,
-    5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4 },
-  { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7,
-    -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 },
-  { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4,
-    1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 },
-  { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18,
-    -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4 },
-  { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4,
-    -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 },
-  { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11,
-    4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6 },
-  { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10,
-    1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 },
-  { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21,
-    7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 },
-  { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17,
-    16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13 },
-  { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16,
-    23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 },
-  { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26,
-    5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 },
-  { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4,
-    32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7 },
-  { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51,
-    4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 },
-  { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8,
-    11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4 },
-  { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6,
-    -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9 },
-  { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9,
-    -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 },
-  { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25,
-    7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5 },
-  { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15,
-    5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6 },
-  { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8,
-    -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1 },
-  { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15,
-    -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7 },
-  { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18,
-    0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 },
-  { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4,
-    -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16 },
-  { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7,
-    6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 },
-  { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7,
-    0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 },
-  { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3,
-    -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18 },
-  { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1,
-    4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 },
-  { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7,
-    -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11 },
-  { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19,
-    -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5 },
-  { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1,
-    15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 },
-  { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4,
-    -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4 },
-  { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3,
-    -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7 },
-  { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1,
-    4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2 },
-  { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4,
-    8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5 },
-  { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4,
-    3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 },
-  { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1,
-    -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7 },
-  { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10,
-    -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 },
-  { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7,
-    -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 },
-  { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10,
-    -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18 },
-  { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4,
-    4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 },
-  { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3,
-    -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 },
-  { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8,
-    0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 },
-  { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5,
-    32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 },
-  { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6,
-    -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7 },
-  { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10,
-    -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 },
-  { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5,
-    -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 },
-  { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12,
-    -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3 },
-  { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2,
-    11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5 },
-  { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1,
-    1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1 },
-  { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2,
-    -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8 },
-  { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3,
-    -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1,
-    0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 },
-  { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18,
-    15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0,
-    -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1 },
-  { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1,
-    -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 },
-  { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4,
-    -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0 },
-  { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0,
-    3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2 },
-  { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3,
-    56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 },
-  { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8,
-    2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9 },
-  { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16,
-    -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5 },
-  { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25,
-    -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4 },
-  { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1,
-    -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2 },
-  { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11,
-    10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28 },
-  { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0,
-    -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3 },
-  { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1,
-    1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2 },
-  { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2,
-    -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2 },
-  { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11,
-    -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12 },
-  { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7,
-    -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
-    3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
-    13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
-    -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
-    3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
-    13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
-  { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13,
-    -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7 },
-  { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8,
-    -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17 },
-  { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7,
-    36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11 },
-  { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11,
-    8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6 },
-  { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8,
-    30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2 },
-  { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5,
-    -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5 },
-  { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15,
-    24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 },
-  { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0,
-    24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1 },
-  { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4,
-    10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 },
-  { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1,
-    -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 },
-  { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1,
-    10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 },
-  { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19,
-    3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17 },
-  { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2,
-    8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5 },
-  { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
-    -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
-  { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
-    -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
-  { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
-    -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
-  { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
-    7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
-  { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
-    0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
-  { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
-    -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
-    11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
-  { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
-    -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
-  { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
-    -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
-  { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
-    -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
-  { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
-    7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
-  { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
-    0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
-  { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
-    -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-    -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
-    11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
-  { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4,
-    3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 },
-  { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7,
-    0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2 },
-  { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4,
-    3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 },
-  { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17,
-    -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 },
-  { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8,
-    -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7 },
-  { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4,
-    4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 },
-  { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1,
-    12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4 },
-  { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1,
-    0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 },
-  { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2,
-    8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0 },
-  { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0,
-    -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5 },
-  { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5,
-    3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 },
-  { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17,
-    9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 },
-  { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6,
-    -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2 },
-  { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16,
-    3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1 },
-  { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15,
-    6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 },
-  { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4,
-    2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1 },
-  { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9,
-    24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 },
-  { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19,
-    2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9 },
-  { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14,
-    7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10 },
-  { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9,
-    8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 },
-  { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5,
-    10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2 },
-  { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4,
-    8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 },
-  { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8,
-    7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 },
-  { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9,
-    4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 },
-  { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12,
-    7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1 },
-  { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4,
-    -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3 },
-  { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0,
-    6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 },
-  { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12,
-    7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 },
-  { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2,
-    16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14 },
-  { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11,
-    -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11 },
-  { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8,
-    -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13 },
-  { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2,
-    -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 },
-  { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5,
-    -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 },
-  { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5,
-    -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 },
-  { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4,
-    -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10 },
-  { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2,
-    -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3 },
-  { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3,
-    1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10 },
-  { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12,
-    -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3 },
-  { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9,
-    -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 },
-  { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30,
-    2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1 },
-  { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16,
-    0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10 },
-  { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5,
-    -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5 },
-  { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3,
-    4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6 },
-  { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13,
-    8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6 },
-  { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1,
-    -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1 },
-  { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1,
-    -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 },
-  { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3,
-    -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4 },
-  { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1,
-    -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 },
-  { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11,
-    -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5 },
-  { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6,
-    -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4 },
-  { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4,
-    5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6 },
-  { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6,
-    -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4 },
-  { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7,
-    6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1 },
-  { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3,
-    -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 },
-  { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15,
-    -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 },
-  { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4,
-    7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2 },
-  { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9,
-    -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 },
-  { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14,
-    -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2 },
-  { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1,
-    -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 },
-  { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4,
-    -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1 },
-  { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9,
-    0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6 },
-  { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4,
-    2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8 },
-  { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16,
-    0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6 },
-  { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13,
-    13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3 },
-  { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4,
-    -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 },
-  { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17,
-    3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 },
-  { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5,
-    -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 },
-  { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7,
-    -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3 },
-  { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7,
-    -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 },
-  { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1,
-    -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 },
-  { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4,
-    -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7 },
-  { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7,
-    16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6 },
-  { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1,
-    10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12 },
-  { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6,
-    7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11 },
-  { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4,
-    -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 },
-  { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0,
-    -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 },
-  { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6,
-    3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 },
-  { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1,
-    2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7 },
-  { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2,
-    0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12 },
-  { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15,
-    18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 },
-  { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2,
-    -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6 },
-  { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11,
-    11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7 },
-  { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8,
-    7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 },
-  { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3,
-    -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16 },
-  { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12,
-    -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13 },
-  { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0,
-    5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 },
-  { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14,
-    9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6 },
-  { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2,
-    17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7 },
-  { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6,
-    -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6 },
-  { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6,
-    -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 },
-  { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2,
-    3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 },
-  { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16,
-    -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1 },
-  { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19,
-    6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4 },
-  { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11,
-    -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 },
-  { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13,
-    9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5 },
-  { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2,
-    -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6 },
-  { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11,
-    5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3 },
-  { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7,
-    21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 },
-  { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8,
-    23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,
-    35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0,
-    41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0 },
-  { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7,
-    10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7 },
-  { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7,
-    23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5,
-    -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 },
-  { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40,
-    10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1 },
-  { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0,
-    4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 },
-  { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
-    1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
-  { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
-    -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
-  { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
-    -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
-  { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
-    10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
-  { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
-    -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
-    6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
-  { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
-    22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
-  { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
-    -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
-  { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
-    37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
-    1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
-  { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
-    -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
-  { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
-    -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
-  { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
-    10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
-  { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
-    -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
-    6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
-  { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
-    22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
-  { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
-    -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
-  { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
-    37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
-    -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
-  { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5,
-    0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 },
-  { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7,
-    -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11 },
-  { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5,
-    9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 },
-  { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12,
-    -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 },
-  { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2,
-    -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 },
-  { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1,
-    -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15 },
-  { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7,
-    -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5 },
-  { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9,
-    8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 },
-  { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4,
-    -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 },
-  { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12,
-    -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0 },
-  { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17,
-    -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4 },
-  { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2,
-    0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11 },
-  { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7,
-    11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 },
-  { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5,
-    -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12 },
-  { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9,
-    9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 },
-  { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2,
-    0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 },
-  { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5,
-    5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 },
-  { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14,
-    -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7 },
-  { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7,
-    -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 },
-  { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0,
-    -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2 },
-  { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8,
-    4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 },
-  { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1,
-    1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 },
-  { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1,
-    7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 },
-  { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1,
-    8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16 },
-  { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8,
-    -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 },
-  { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16,
-    0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 },
-  { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8,
-    -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 },
-  { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4,
-    10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1 },
-  { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6,
-    8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6 },
-  { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1,
-    2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 },
-  { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3,
-    3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7 },
-  { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4,
-    0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 },
-  { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2,
-    -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 },
-  { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6,
-    -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4 },
-  { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2,
-    13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1 },
-  { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2,
-    8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4 },
-  { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3,
-    14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2 },
-  { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4,
-    7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 },
-  { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4,
-    -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 },
-  { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4,
-    -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 },
-  { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3,
-    3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 },
-  { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7,
-    -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1 },
-  { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0,
-    -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11 },
-  { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12,
-    -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5 },
-  { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2,
-    0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5 },
-  { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13,
-    -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10 },
-  { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3,
-    17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2 },
-  { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0,
-    -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13 },
-  { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5,
-    5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 },
-  { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10,
-    1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2 },
-  { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21,
-    3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 },
-  { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5,
-    12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0 },
-  { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5,
-    -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6 },
-  { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3,
-    -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4 },
-  { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2,
-    -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13 },
-  { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10,
-    -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 },
-  { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4,
-    1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 },
-  { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13,
-    8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5 },
-  { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19,
-    3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4 },
-  { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2,
-    -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 },
-  { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8,
-    7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 },
-  { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7,
-    -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 },
-  { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6,
-    -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 },
-  { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11,
-    -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 },
-  { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8,
-    -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 },
-  { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6,
-    7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 },
-  { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1,
-    0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 },
-  { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1,
-    1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 },
-  { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7,
-    5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 },
-  { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1,
-    2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 },
-  { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3,
-    -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 },
-  { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12,
-    -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 },
-  { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14,
-    -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10 },
-  { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2,
-    4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3 },
-  { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11,
-    3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 },
-  { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12,
-    -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7 },
-  { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2,
-    9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 },
-  { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4,
-    0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 },
-  { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2,
-    -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 },
-  { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5,
-    -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5 },
-  { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9,
-    9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 },
-  { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5,
-    -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0 },
-  { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1,
-    4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7 },
-  { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2,
-    1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11 },
-  { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0,
-    5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9 },
-  { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8,
-    -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 },
-  { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4,
-    6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9 },
-  { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4,
-    -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7 },
-  { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11,
-    0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12 },
-  { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8,
-    -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 },
-  { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6,
-    -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7 },
-  { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8,
-    3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12 },
-  { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6,
-    -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2 },
-  { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2,
-    9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6 },
-  { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3,
-    1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8 },
-  { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1,
-    -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 },
-  { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2,
-    -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 },
-  { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7,
-    6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16 },
-  { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5,
-    -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 },
-  { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10,
-    -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3 },
-  { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3,
-    1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8 },
-  { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5,
-    2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4 },
-  { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14,
-    0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 },
-  { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3,
-    1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 },
-  { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2,
-    6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6 },
-  { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11,
-    0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5 },
-  { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25,
-    0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 },
-  { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16,
-    12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 },
-  { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0,
-    0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0 },
-  { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14,
-    -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12 },
-  { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2,
-    0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 },
-  { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5,
-    3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 },
-  { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12,
-    1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 },
-  { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0,
-    0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 },
-  { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0,
-    6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6 },
-  { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4,
-    5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1 },
-  { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13,
-    16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14 },
-  { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7,
-    26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16 },
-  { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17,
-    7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 },
-  { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1,
-    9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3 },
-  { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7,
-    10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3 },
-  { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0,
-    7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10 },
-  { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1,
-    1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3 },
-  { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9,
-    -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 },
-  { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9,
-    -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 },
-  { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8,
-    9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17 },
-  { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3,
-    1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 },
-  { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7,
-    12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 },
-  { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5,
-    -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 },
-  { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20,
-    7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4 },
-  { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2,
-    -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 },
-  { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7,
-    -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 },
-  { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7,
-    4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4 },
-  { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7,
-    -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3 },
-  { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2,
-    -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5 },
-  { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2,
-    3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 },
-  { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2,
-    6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 },
-  { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6,
-    -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 },
-  { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5,
-    7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 },
-  { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1,
-    9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 },
-  { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10,
-    -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4 },
-  { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4,
-    -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3 },
-  { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6,
-    11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1 },
-  { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7,
-    -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1 },
-  { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13,
-    -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8 },
-  { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5,
-    -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 },
-  { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6,
-    22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8 },
-  { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4,
-    -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 },
-  { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4,
-    6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4 },
-  { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7,
-    -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11 },
-  { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15,
-    -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6 },
-  { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1,
-    -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1 },
-  { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7,
-    -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6 },
-  { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3,
-    -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 },
-  { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1,
-    -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4 },
-  { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1,
-    3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 },
-  { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7,
-    1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 },
-  { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3,
-    -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 },
-  { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1,
-    -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7 },
-  { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5,
-    5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3 },
-  { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26,
-    -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4 },
-  { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3,
-    -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 },
-  { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5,
-    7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 },
-  { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18,
-    3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 },
-  { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2,
-    5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 },
-  { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2,
-    4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 },
-  { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3,
-    -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10 },
-  { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5,
-    -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 },
-  { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2,
-    -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1 },
-  { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3,
-    -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 },
-  { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12,
-    9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3 },
-  { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4,
-    4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 },
-  { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6,
-    -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 },
-  { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9,
-    8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8 },
-  { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7,
-    4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5 },
-  { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4,
-    -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1 },
-  { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3,
-    -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 },
-  { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2,
-    1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10 },
-  { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2,
-    -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1 },
-  { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10,
-    -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 },
-  { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8,
-    -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15 },
-  { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8,
-    8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 },
-  { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3,
-    -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 },
-  { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5,
-    5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 },
-  { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15,
-    2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7 },
-  { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9,
-    1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 },
-  { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7,
-    -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 },
-  { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4,
-    4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5 },
-  { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1,
-    2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2 },
-  { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9,
-    9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2 },
-  { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6,
-    5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3 },
-  { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15,
-    -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 },
-  { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0,
-    1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5 },
-  { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4,
-    -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 },
-  { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3,
-    -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7 },
-  { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18,
-    8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 },
-  { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9,
-    14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9 },
-  { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2,
-    3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 },
-  { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6,
-    -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 },
-  { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7,
-    8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 },
-  { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7,
-    18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 },
-  { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5,
-    -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 },
-  { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10,
-    1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 },
-  { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0,
-    5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28 },
-  { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3,
-    1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1 },
-  { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19,
-    1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10 },
-  { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2,
-    22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16 },
-  { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6,
-    10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 },
-  { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2,
-    -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 },
-  { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1,
-    10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 },
-  { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4,
-    8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11 },
-  { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6,
-    16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 },
-  { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1,
-    11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 },
-  { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3,
-    29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 },
-  { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5,
-    16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1 },
-  { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10,
-    0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 },
-  { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2,
-    5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 },
-  { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8,
-    2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 },
-  { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4,
-    6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3 },
-  { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8,
-    -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 },
-  { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1,
-    0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15 },
-  { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2,
-    -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3 },
-  { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4,
-    4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5 },
-  { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0,
-    8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6 },
-  { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10,
-    6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4 },
-  { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6,
-    -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 },
-  { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4,
-    -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 },
-  { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3,
-    8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 },
-  { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1,
-    -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 },
-  { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10,
-    3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 },
-  { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5,
-    8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 },
-  { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3,
-    -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 },
-  { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8,
-    -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 },
-  { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17,
-    -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 },
-  { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5,
-    0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 },
-  { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10,
-    -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6 },
-  { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18,
-    7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 },
-  { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6,
-    -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4 },
-  { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10,
-    -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 },
-  { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2,
-    -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5 },
-  { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6,
-    -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8 },
-  { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1,
-    6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1 },
-  { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1,
-    12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 },
-  { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10,
-    10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 },
-  { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0,
-    2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 },
-  { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2,
-    0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11 },
-  { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12,
-    9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 },
-  { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6,
-    -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 },
-  { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5,
-    -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 },
-  { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22,
-    6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 },
-  { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7,
-    5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 },
-  { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7,
-    -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5 },
-  { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3,
-    -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2 },
-  { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6,
-    -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14 },
-  { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11,
-    -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 },
-  { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1,
-    -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 },
-  { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0,
-    -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50 },
-  { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9,
-    -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26 },
-  { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1,
-    -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27 },
-  { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5,
-    0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26 },
-  { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11,
-    9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29 },
-  { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1,
-    2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27 },
-  { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6,
-    -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29 },
-  { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4,
-    3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31 },
-  { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27,
-    -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21 },
-  { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1,
-    -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17 },
-  { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2,
-    -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36 },
-  { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1,
-    -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28 },
-  { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2,
-    16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20 },
-  { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4,
-    3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32 },
-  { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9,
-    -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24 },
-  { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8,
-    0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33 },
-  { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13,
-    -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30 },
-  { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5,
-    -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40 },
-  { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5,
-    9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24 },
-  { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2,
-    11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29 },
-  { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2,
-    3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35 },
-  { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18,
-    9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26 },
-  { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4,
-    1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38 },
-  { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1,
-    -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28 },
-  { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18,
-    -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30 },
-  { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3,
-    -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26 },
-  { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5,
-    0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25 },
-  { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8,
-    20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23 },
-  { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6,
-    8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43 },
-  { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10,
-    -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30 },
-  { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9,
-    0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28 },
-  { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1,
-    -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70 },
-  { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15,
-    -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1 },
-  { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10,
-    8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13 },
-  { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0,
-    9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15 },
-  { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1,
-    -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9 },
-  { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5,
-    2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6 },
-  { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4,
-    -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3 },
-  { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7,
-    -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14 },
-  { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1,
-    -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2 },
-  { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1,
-    -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0 },
-  { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6,
-    5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3 },
-  { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5,
-    -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6 },
-  { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1,
-    -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5 },
-  { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2,
-    1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12 },
-  { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1,
-    -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2 },
-  { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3,
-    8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1 },
-  { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1,
-    0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2 },
-  { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2,
-    -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4 },
-  { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2,
-    9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1 },
-  { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0,
-    -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5 },
-  { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12,
-    -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5 },
-  { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2,
-    0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4 },
-  { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2,
-    9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6 },
-  { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6,
-    -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4 },
-  { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6,
-    2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4 },
-  { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1,
-    -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6 },
-  { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11,
-    -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4 },
-  { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11,
-    3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1 },
-  { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7,
-    4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11 },
-  { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4,
-    -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4 },
-  { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4,
-    -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5 },
-  { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31,
-    2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2 },
-  { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13,
-    -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4 },
-  { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9,
-    -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 },
-  { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15,
-    -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11 },
-  { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21,
-    -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15 },
-  { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8,
-    -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12 },
-  { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17,
-    3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 },
-  { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15,
-    -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12 },
-  { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3,
-    -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7 },
-  { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4,
-    8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7 },
-  { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16,
-    -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12 },
-  { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2,
-    -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5 },
-  { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10,
-    -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15 },
-  { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18,
-    -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10 },
-  { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1,
-    2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1 },
-  { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1,
-    -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5 },
-  { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20,
-    5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 },
-  { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5,
-    -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 },
-  { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16,
-    -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3 },
-  { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3,
-    -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 },
-  { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7,
-    3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7 },
-  { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0,
-    -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12 },
-  { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1,
-    -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9 },
-  { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25,
-    14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 },
-  { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12,
-    -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2 },
-  { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3,
-    -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3 },
-  { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21,
-    7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 },
-  { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23,
-    -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 },
-  { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5,
-    5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7 },
-  { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13,
-    -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 },
-  { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15,
-    -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 },
-  { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45,
-    -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3 },
-  { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6,
-    5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 },
-  { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17,
-    -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6 },
-  { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5,
-    -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1 },
-  { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1,
-    -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4 },
-  { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4,
-    -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3 },
-  { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6,
-    -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7 },
-  { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5,
-    -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1 },
-  { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0,
-    -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 },
-  { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5,
-    -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 },
-  { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5,
-    -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2 },
-  { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11,
-    -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 },
-  { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13,
-    -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1 },
-  { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0,
-    -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8 },
-  { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6,
-    -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10 },
-  { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3,
-    1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 },
-  { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6,
-    -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2 },
-  { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4,
-    -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7 },
-  { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6,
-    -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9 },
-  { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27,
-    -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5 },
-  { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7,
-    -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 },
-  { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0,
-    -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1 },
-  { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2,
-    -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4 },
-  { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26,
-    -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 },
-  { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3,
-    -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7 },
-  { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20,
-    -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10 },
-  { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7,
-    -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0 },
-  { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14,
-    -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13 },
-  { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8,
-    -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 },
-  { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13,
-    -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13 },
-  { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17,
-    -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1 },
-  { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9,
-    -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 },
-  { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8,
-    -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4 },
-  { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7,
-    -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2 },
-  { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4,
-    -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2 },
-  { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19,
-    -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3 },
-  { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8,
-    -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 },
-  { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1,
-    -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 },
-  { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9,
-    -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1 },
-  { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2,
-    -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1 },
-  { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6,
-    -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11 },
-  { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9,
-    7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2 },
-  { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4,
-    -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5 },
-  { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0,
-    11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2 },
-  { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12,
-    -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3 },
-  { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1,
-    3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15 },
-  { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21,
-    -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6 },
-  { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9,
-    -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 },
-  { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9,
-    -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11 },
-  { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6,
-    -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10 },
-  { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1,
-    18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6 },
-  { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7,
-    6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7 },
-  { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10,
-    16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1 },
-  { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17,
-    -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 },
-  { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5,
-    -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3 },
-  { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15,
-    6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 },
-  { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2,
-    -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1 },
-  { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28,
-    2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 },
-  { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5,
-    -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7 },
-  { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0,
-    -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3 },
-  { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3,
-    1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2 },
-  { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8,
-    -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 },
-  { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4,
-    -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 },
-  { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2,
-    14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3 },
-  { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28,
-    -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 },
-  { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3,
-    -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3 },
-  { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28,
-    0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 },
-  { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6,
-    -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34 },
-  { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1,
-    0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26 },
-  { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3,
-    7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24 },
-  { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8,
-    25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 },
-  { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14,
-    2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30 },
-  { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14,
-    7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 },
-  { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1,
-    6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55 },
-  { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5,
-    0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31 },
-  { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1,
-    5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31 },
-  { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2,
-    -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 },
-  { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3,
-    5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24 },
-  { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13,
-    8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25 },
-  { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4,
-    4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24 },
-  { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1,
-    1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 },
-  { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0,
-    1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41 },
-  { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3,
-    -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27 },
-  { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12,
-    -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28 },
-  { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9,
-    22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23 },
-  { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1,
-    13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23 },
-  { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6,
-    15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29 },
-  { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7,
-    -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37 },
-  { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5,
-    -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33 },
-  { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4,
-    3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40 },
-  { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9,
-    18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 },
-  { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4,
-    1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28 },
-  { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2,
-    2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32 },
-  { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1,
-    2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30 },
-  { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3,
-    2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 },
-  { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3,
-    4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32 },
-  { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2,
-    -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21 },
-  { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2,
-    0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29 },
-  { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2,
-    -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19 },
-  { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1,
-    2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13 },
-  { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6,
-    -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19 },
-  { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12,
-    17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9 },
-  { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0,
-    1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27 },
-  { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2,
-    -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15 },
-  { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7,
-    -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5 },
-  { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6,
-    -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8 },
-  { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11,
-    2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16 },
-  { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0,
-    6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1 },
-  { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4,
-    12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16 },
-  { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2,
-    2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21 },
-  { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3,
-    -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2 },
-  { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13,
-    17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11 },
-  { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6,
-    7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3 },
-  { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10,
-    10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14 },
-  { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1,
-    8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14 },
-  { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5,
-    1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11 },
-  { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1,
-    -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2 },
-  { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4,
-    -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4 },
-  { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10,
-    -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12 },
-  { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9,
-    2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15 },
-  { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1,
-    -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8 },
-  { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4,
-    -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2 },
-  { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6,
-    20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3 },
-  { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7,
-    10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2 },
-  { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9,
-    -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2 },
-  { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5,
-    -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12 },
-  { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9,
-    5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9 },
-  { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2,
-    -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6 },
-  { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4,
-    8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12 },
-  { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3,
-    2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4 },
-  { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15,
-    -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2 },
-  { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4,
-    1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16 },
-  { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7,
-    1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17 },
-  { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7,
-    0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26 },
-  { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2,
-    -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12 },
-  { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0,
-    3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11 },
-  { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4,
-    -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17 },
-  { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2,
-    -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11 },
-  { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7,
-    4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7 },
-  { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2,
-    6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23 },
-  { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2,
-    -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9 },
-  { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11,
-    -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6 },
-  { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4,
-    4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14 },
-  { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4,
-    -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22 },
-  { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6,
-    -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11 },
-  { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7,
-    -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12 },
-  { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6,
-    -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17 },
-  { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11,
-    7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12 },
-  { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3,
-    -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5 },
-  { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3,
-    7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6 },
-  { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6,
-    9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5 },
-  { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10,
-    -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11 },
-  { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7,
-    8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13 },
-  { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14,
-    6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13 },
-  { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11,
-    1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9 },
-  { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6,
-    9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7 },
-  { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10,
-    15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16 },
-  { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4,
-    0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16 },
-  { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0,
-    0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10 },
-  { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2,
-    1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46 },
-  { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10,
-    13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1 },
-  { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2,
-    7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 },
-  { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5,
-    4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5 }
-};
-
-
-/* FIR filter coefficients, they can be cut on half and maybe use float instead of double*/
-
-DECLARE_ALIGNED(16, static const float, fir_32bands_perfect)[] =
-{
-+1.135985195E-010,
-+7.018770981E-011,
--1.608403011E-008,
--5.083275667E-008,
--1.543309907E-007,
--3.961981463E-007,
--7.342250683E-007,
--3.970030775E-007,
--4.741137047E-007,
--6.022448247E-007,
--6.628192182E-007,
--6.982898526E-007,
--7.020648809E-007,
--6.767839409E-007,
--6.262345096E-007,
--5.564140224E-007,
-+7.003467317E-007,
-+8.419976893E-007,
-+9.742954035E-007,
-+1.085227950E-006,
-+1.162929266E-006,
-+1.194632091E-006,
-+1.179182050E-006,
-+1.033426656E-006,
-+9.451737242E-007,
-+1.975324267E-006,
-+1.190443072E-006,
-+5.234479659E-007,
-+2.014677420E-007,
-+7.834767501E-008,
--6.702406963E-010,
--1.613285505E-009,
--2.682709610E-009,
--3.399493131E-009,
-+1.314406006E-008,
-+7.506701927E-009,
-+2.788728892E-008,
-+1.444918922E-007,
-+3.132386439E-007,
-+1.399798180E-006,
-+2.032118118E-006,
-+2.715013807E-006,
-+3.453840463E-006,
-+4.195037945E-006,
-+4.896494374E-006,
-+5.516381407E-006,
-+6.015239251E-006,
-+6.361419310E-006,
-+8.006985809E-006,
-+8.087732567E-006,
-+7.941360309E-006,
-+7.568834008E-006,
-+6.986399967E-006,
-+6.225028756E-006,
-+5.315936960E-006,
-+4.429412002E-006,
-+3.332600045E-006,
-+8.427224429E-007,
-+4.341498823E-007,
-+9.458596395E-008,
-+2.975164826E-008,
-+6.402664354E-008,
--3.246264413E-008,
--3.809887872E-008,
-+8.434094667E-008,
-+6.437721822E-008,
-+1.189317118E-006,
-+2.497214155E-006,
-+3.617151151E-006,
-+3.157242645E-006,
-+2.319611212E-006,
-+7.869333785E-006,
-+9.826449968E-006,
-+1.177108606E-005,
-+1.379448349E-005,
-+1.571428584E-005,
-+1.743183020E-005,
-+1.884208177E-005,
-+1.987093310E-005,
-+2.042970118E-005,
--3.144468428E-005,
--3.334947178E-005,
--3.460439257E-005,
--3.515914432E-005,
--3.495384954E-005,
--3.397853652E-005,
--3.225446198E-005,
--2.978993689E-005,
--2.677291741E-005,
--1.806914770E-005,
--1.776598037E-005,
--1.661818715E-005,
--1.207003334E-005,
--6.993315310E-006,
--5.633860383E-007,
--9.984935332E-007,
--1.470520488E-006,
--1.853591357E-006,
-+7.198007665E-007,
-+3.086857760E-006,
-+6.084746474E-006,
-+9.561075785E-006,
-+1.309637537E-005,
-+2.263354872E-005,
-+2.847247197E-005,
-+3.415624451E-005,
-+3.946387005E-005,
-+4.425736552E-005,
-+4.839275425E-005,
-+5.176846025E-005,
-+5.429694284E-005,
-+5.595519906E-005,
-+4.916387297E-006,
-+9.299508747E-006,
-+1.356193479E-005,
-+1.751866148E-005,
-+2.093936746E-005,
-+2.362549276E-005,
-+2.537086584E-005,
-+2.618136386E-005,
-+2.554462844E-005,
-+3.018750249E-005,
-+2.570833203E-005,
-+1.985177369E-005,
-+1.191342653E-005,
-+2.525620175E-006,
--1.521241393E-005,
--1.617751332E-005,
-+1.992636317E-005,
-+1.774702469E-005,
-+4.624524081E-005,
-+5.610509834E-005,
-+6.568001118E-005,
-+7.513730816E-005,
-+8.413690375E-005,
-+8.757545584E-005,
-+9.517164290E-005,
-+1.020687996E-004,
-+1.084438481E-004,
-+1.140582463E-004,
-+1.187910311E-004,
-+1.224978914E-004,
-+1.250260248E-004,
-+1.262027217E-004,
-+1.226499153E-004,
-+1.213575742E-004,
-+1.180980107E-004,
-+1.126275165E-004,
-+1.047207043E-004,
-+9.417100227E-005,
-+8.078388782E-005,
-+6.447290798E-005,
-+4.491530854E-005,
-+2.470704203E-005,
--1.714242217E-006,
--3.193307566E-005,
--6.541742187E-005,
--1.024175072E-004,
--1.312203676E-004,
--1.774113771E-004,
--2.233728592E-004,
--2.682086197E-004,
--3.347633174E-004,
--3.906481725E-004,
--4.490280990E-004,
--5.099929986E-004,
--5.729619297E-004,
--6.358824321E-004,
--7.021900383E-004,
--7.698345580E-004,
--8.385353722E-004,
--9.078957955E-004,
--9.775133803E-004,
--1.046945457E-003,
--1.115717343E-003,
--1.183370827E-003,
--1.252829796E-003,
--1.316190348E-003,
--1.376571832E-003,
--1.433344092E-003,
--1.485876855E-003,
--1.533520175E-003,
--1.575609902E-003,
--1.611457788E-003,
--1.640390139E-003,
--1.661288203E-003,
--1.674512983E-003,
--1.678415807E-003,
--1.672798418E-003,
--1.656501088E-003,
--1.633993932E-003,
--1.593449386E-003,
-+1.542080659E-003,
-+1.479332102E-003,
-+1.395521569E-003,
-+1.303116791E-003,
-+1.196175464E-003,
-+1.073757303E-003,
-+9.358961834E-004,
-+7.817269652E-004,
-+6.114174030E-004,
-+4.244441516E-004,
-+2.206075296E-004,
--2.719412748E-007,
--2.382978710E-004,
--4.935106263E-004,
--7.658848190E-004,
--1.055365428E-003,
--1.361547387E-003,
--1.684492454E-003,
--2.023874084E-003,
--2.379294252E-003,
--2.750317100E-003,
--3.136433195E-003,
--3.537061159E-003,
--3.951539751E-003,
--4.379155114E-003,
--4.819062538E-003,
--5.270531867E-003,
--5.732392892E-003,
--6.203945260E-003,
--6.683901884E-003,
--7.170005701E-003,
--7.664063945E-003,
--8.162760176E-003,
--8.665001951E-003,
--9.170533158E-003,
--9.676489048E-003,
--1.018219907E-002,
--1.068630442E-002,
--1.118756086E-002,
--1.168460958E-002,
--1.217562053E-002,
--1.265939046E-002,
--1.313448418E-002,
--1.359948888E-002,
--1.405300573E-002,
--1.449365262E-002,
--1.492007636E-002,
--1.533095632E-002,
--1.572482102E-002,
--1.610082202E-002,
--1.645756140E-002,
--1.679391414E-002,
--1.710879989E-002,
--1.740120351E-002,
--1.767017506E-002,
--1.791484281E-002,
--1.813439466E-002,
--1.832821220E-002,
--1.849545911E-002,
--1.863567345E-002,
--1.874836907E-002,
--1.883326657E-002,
--1.889026538E-002,
--1.891860925E-002,
-+1.891860925E-002,
-+1.889026538E-002,
-+1.883326657E-002,
-+1.874836907E-002,
-+1.863567345E-002,
-+1.849545911E-002,
-+1.832821220E-002,
-+1.813439466E-002,
-+1.791484281E-002,
-+1.767017506E-002,
-+1.740120351E-002,
-+1.710879989E-002,
-+1.679391414E-002,
-+1.645756140E-002,
-+1.610082202E-002,
-+1.572482102E-002,
-+1.533095632E-002,
-+1.492007636E-002,
-+1.449365262E-002,
-+1.405300573E-002,
-+1.359948888E-002,
-+1.313448418E-002,
-+1.265939046E-002,
-+1.217562053E-002,
-+1.168460958E-002,
-+1.118756086E-002,
-+1.068630442E-002,
-+1.018219907E-002,
-+9.676489048E-003,
-+9.170533158E-003,
-+8.665001951E-003,
-+8.162760176E-003,
-+7.664063945E-003,
-+7.170005701E-003,
-+6.683901884E-003,
-+6.203945260E-003,
-+5.732392892E-003,
-+5.270531867E-003,
-+4.819062538E-003,
-+4.379155114E-003,
-+3.951539751E-003,
-+3.537061159E-003,
-+3.136433195E-003,
-+2.750317100E-003,
-+2.379294252E-003,
-+2.023874084E-003,
-+1.684492454E-003,
-+1.361547387E-003,
-+1.055365428E-003,
-+7.658848190E-004,
-+4.935106263E-004,
-+2.382978710E-004,
-+2.719412748E-007,
--2.206075296E-004,
--4.244441516E-004,
--6.114174030E-004,
--7.817269652E-004,
--9.358961834E-004,
--1.073757303E-003,
--1.196175464E-003,
--1.303116791E-003,
--1.395521569E-003,
--1.479332102E-003,
--1.542080659E-003,
-+1.593449386E-003,
-+1.633993932E-003,
-+1.656501088E-003,
-+1.672798418E-003,
-+1.678415807E-003,
-+1.674512983E-003,
-+1.661288203E-003,
-+1.640390139E-003,
-+1.611457788E-003,
-+1.575609902E-003,
-+1.533520175E-003,
-+1.485876855E-003,
-+1.433344092E-003,
-+1.376571832E-003,
-+1.316190348E-003,
-+1.252829796E-003,
-+1.183370827E-003,
-+1.115717343E-003,
-+1.046945457E-003,
-+9.775133803E-004,
-+9.078957955E-004,
-+8.385353722E-004,
-+7.698345580E-004,
-+7.021900383E-004,
-+6.358824321E-004,
-+5.729619297E-004,
-+5.099929986E-004,
-+4.490280990E-004,
-+3.906481725E-004,
-+3.347633174E-004,
-+2.682086197E-004,
-+2.233728592E-004,
-+1.774113771E-004,
-+1.312203676E-004,
-+1.024175072E-004,
-+6.541742187E-005,
-+3.193307566E-005,
-+1.714242217E-006,
--2.470704203E-005,
--4.491530854E-005,
--6.447290798E-005,
--8.078388782E-005,
--9.417100227E-005,
--1.047207043E-004,
--1.126275165E-004,
--1.180980107E-004,
--1.213575742E-004,
--1.226499153E-004,
--1.262027217E-004,
--1.250260248E-004,
--1.224978914E-004,
--1.187910311E-004,
--1.140582463E-004,
--1.084438481E-004,
--1.020687996E-004,
--9.517164290E-005,
--8.757545584E-005,
--8.413690375E-005,
--7.513730816E-005,
--6.568001118E-005,
--5.610509834E-005,
--4.624524081E-005,
--1.774702469E-005,
--1.992636317E-005,
-+1.617751332E-005,
-+1.521241393E-005,
--2.525620175E-006,
--1.191342653E-005,
--1.985177369E-005,
--2.570833203E-005,
--3.018750249E-005,
--2.554462844E-005,
--2.618136386E-005,
--2.537086584E-005,
--2.362549276E-005,
--2.093936746E-005,
--1.751866148E-005,
--1.356193479E-005,
--9.299508747E-006,
--4.916387297E-006,
--5.595519906E-005,
--5.429694284E-005,
--5.176846025E-005,
--4.839275425E-005,
--4.425736552E-005,
--3.946387005E-005,
--3.415624451E-005,
--2.847247197E-005,
--2.263354872E-005,
--1.309637537E-005,
--9.561075785E-006,
--6.084746474E-006,
--3.086857760E-006,
--7.198007665E-007,
-+1.853591357E-006,
-+1.470520488E-006,
-+9.984935332E-007,
-+5.633860383E-007,
-+6.993315310E-006,
-+1.207003334E-005,
-+1.661818715E-005,
-+1.776598037E-005,
-+1.806914770E-005,
-+2.677291741E-005,
-+2.978993689E-005,
-+3.225446198E-005,
-+3.397853652E-005,
-+3.495384954E-005,
-+3.515914432E-005,
-+3.460439257E-005,
-+3.334947178E-005,
-+3.144468428E-005,
--2.042970118E-005,
--1.987093310E-005,
--1.884208177E-005,
--1.743183020E-005,
--1.571428584E-005,
--1.379448349E-005,
--1.177108606E-005,
--9.826449968E-006,
--7.869333785E-006,
--2.319611212E-006,
--3.157242645E-006,
--3.617151151E-006,
--2.497214155E-006,
--1.189317118E-006,
--6.437721822E-008,
--8.434094667E-008,
-+3.809887872E-008,
-+3.246264413E-008,
--6.402664354E-008,
--2.975164826E-008,
--9.458596395E-008,
--4.341498823E-007,
--8.427224429E-007,
--3.332600045E-006,
--4.429412002E-006,
--5.315936960E-006,
--6.225028756E-006,
--6.986399967E-006,
--7.568834008E-006,
--7.941360309E-006,
--8.087732567E-006,
--8.006985809E-006,
--6.361419310E-006,
--6.015239251E-006,
--5.516381407E-006,
--4.896494374E-006,
--4.195037945E-006,
--3.453840463E-006,
--2.715013807E-006,
--2.032118118E-006,
--1.399798180E-006,
--3.132386439E-007,
--1.444918922E-007,
--2.788728892E-008,
--7.506701927E-009,
--1.314406006E-008,
-+3.399493131E-009,
-+2.682709610E-009,
-+1.613285505E-009,
-+6.702406963E-010,
--7.834767501E-008,
--2.014677420E-007,
--5.234479659E-007,
--1.190443072E-006,
--1.975324267E-006,
--9.451737242E-007,
--1.033426656E-006,
--1.179182050E-006,
--1.194632091E-006,
--1.162929266E-006,
--1.085227950E-006,
--9.742954035E-007,
--8.419976893E-007,
--7.003467317E-007,
-+5.564140224E-007,
-+6.262345096E-007,
-+6.767839409E-007,
-+7.020648809E-007,
-+6.982898526E-007,
-+6.628192182E-007,
-+6.022448247E-007,
-+4.741137047E-007,
-+3.970030775E-007,
-+7.342250683E-007,
-+3.961981463E-007,
-+1.543309907E-007,
-+5.083275667E-008,
-+1.608403011E-008,
--7.018770981E-011,
--1.135985195E-010
-};
-
-DECLARE_ALIGNED(16, static const float, fir_32bands_nonperfect)[] =
-{
--1.390191784E-007,
--1.693738625E-007,
--2.030677564E-007,
--2.404238444E-007,
--2.818143514E-007,
--3.276689142E-007,
--3.784752209E-007,
--4.347855338E-007,
--4.972276315E-007,
--5.665120852E-007,
--6.434325428E-007,
--7.288739425E-007,
--8.238164355E-007,
--9.293416952E-007,
--1.046637067E-006,
--1.176999604E-006,
--1.321840614E-006,
--1.482681114E-006,
--1.661159786E-006,
--1.859034001E-006,
--2.078171747E-006,
--2.320550948E-006,
--2.588257530E-006,
--2.883470643E-006,
--3.208459020E-006,
--3.565570978E-006,
--3.957220997E-006,
--4.385879038E-006,
--4.854050530E-006,
--5.364252502E-006,
--5.918994248E-006,
--6.520755960E-006,
--7.171964626E-006,
--7.874960829E-006,
--8.631964192E-006,
--9.445050637E-006,
--1.031611009E-005,
--1.124680875E-005,
--1.223855270E-005,
--1.329243969E-005,
--1.440921824E-005,
--1.558924305E-005,
--1.683242772E-005,
--1.813820381E-005,
--1.950545993E-005,
--2.093250441E-005,
--2.241701623E-005,
--2.395598858E-005,
--2.554569073E-005,
--2.718161704E-005,
--2.885844333E-005,
--3.056998685E-005,
--3.230916263E-005,
--3.406793985E-005,
--3.583733633E-005,
--3.760734762E-005,
--3.936696885E-005,
--4.110412556E-005,
--4.280570283E-005,
--4.445751256E-005,
--4.604430433E-005,
--4.754976908E-005,
--4.895655002E-005,
--5.024627535E-005,
-+5.139957648E-005,
-+5.239612074E-005,
-+5.321469871E-005,
-+5.383323878E-005,
-+5.422891263E-005,
-+5.437819709E-005,
-+5.425697600E-005,
-+5.384063843E-005,
-+5.310418419E-005,
-+5.202236207E-005,
-+5.056979353E-005,
-+4.872112549E-005,
-+4.645117951E-005,
-+4.373511547E-005,
-+4.054862075E-005,
-+3.686808850E-005,
-+3.267079956E-005,
-+2.793515523E-005,
-+2.264085742E-005,
-+1.676913780E-005,
-+1.030297699E-005,
-+3.227306706E-006,
--4.470633485E-006,
--1.280130618E-005,
--2.177240640E-005,
--3.138873581E-005,
--4.165195787E-005,
--5.256036457E-005,
--6.410864444E-005,
--7.628766616E-005,
--8.908427117E-005,
--1.024810626E-004,
--1.164562127E-004,
--1.309833024E-004,
--1.460311323E-004,
--1.615635992E-004,
--1.775395358E-004,
--1.939126523E-004,
--2.106313768E-004,
--2.276388550E-004,
--2.448728774E-004,
--2.622658503E-004,
--2.797449124E-004,
--2.972317743E-004,
--3.146430245E-004,
--3.318900708E-004,
--3.488793736E-004,
--3.655125911E-004,
--3.816867538E-004,
--3.972945851E-004,
--4.122247046E-004,
--4.263620067E-004,
--4.395879805E-004,
--4.517810594E-004,
--4.628172028E-004,
--4.725702747E-004,
--4.809123348E-004,
--4.877146275E-004,
--4.928477574E-004,
--4.961824161E-004,
--4.975944757E-004,
--4.969481961E-004,
--4.941228544E-004,
--4.889960401E-004,
-+4.814492422E-004,
-+4.713678791E-004,
-+4.586426076E-004,
-+4.431701091E-004,
-+4.248536134E-004,
-+4.036037717E-004,
-+3.793396754E-004,
-+3.519894381E-004,
-+3.214911267E-004,
-+2.877934603E-004,
-+2.508567995E-004,
-+2.106537577E-004,
-+1.671699720E-004,
-+1.204049113E-004,
-+7.037253090E-005,
-+1.710198012E-005,
--3.936182839E-005,
--9.895755647E-005,
--1.616069785E-004,
--2.272142592E-004,
--2.956659591E-004,
--3.668301215E-004,
--4.405563814E-004,
--5.166754709E-004,
--5.949990009E-004,
--6.753197522E-004,
--7.574109477E-004,
--8.410271257E-004,
--9.259034996E-004,
--1.011756598E-003,
--1.098284614E-003,
--1.185167348E-003,
--1.272067428E-003,
--1.358630019E-003,
--1.444484224E-003,
--1.529243193E-003,
--1.612505526E-003,
--1.693855622E-003,
--1.772865304E-003,
--1.849094522E-003,
--1.922092517E-003,
--1.991399564E-003,
--2.056547208E-003,
--2.117061289E-003,
--2.172462177E-003,
--2.222266514E-003,
--2.265989315E-003,
--2.303145360E-003,
--2.333251061E-003,
--2.355825622E-003,
--2.370394068E-003,
--2.376487479E-003,
--2.373647178E-003,
--2.361423569E-003,
--2.339380793E-003,
--2.307097195E-003,
--2.264167881E-003,
--2.210205887E-003,
--2.144844970E-003,
--2.067740774E-003,
--1.978572691E-003,
--1.877046190E-003,
--1.762894331E-003,
--1.635878929E-003,
-+1.495792647E-003,
-+1.342460280E-003,
-+1.175740734E-003,
-+9.955273708E-004,
-+8.017504588E-004,
-+5.943773431E-004,
-+3.734139318E-004,
-+1.389056415E-004,
--1.090620208E-004,
--3.703625989E-004,
--6.448282511E-004,
--9.322494152E-004,
--1.232374110E-003,
--1.544908970E-003,
--1.869517611E-003,
--2.205822384E-003,
--2.553403843E-003,
--2.911801683E-003,
--3.280514618E-003,
--3.659002949E-003,
--4.046686925E-003,
--4.442950245E-003,
--4.847140983E-003,
--5.258570891E-003,
--5.676518660E-003,
--6.100233644E-003,
--6.528933067E-003,
--6.961807609E-003,
--7.398022339E-003,
--7.836719044E-003,
--8.277016692E-003,
--8.718019351E-003,
--9.158811532E-003,
--9.598465636E-003,
--1.003604382E-002,
--1.047059800E-002,
--1.090117730E-002,
--1.132682897E-002,
--1.174659748E-002,
--1.215953380E-002,
--1.256469358E-002,
--1.296114177E-002,
--1.334795821E-002,
--1.372423489E-002,
--1.408908330E-002,
--1.444163360E-002,
--1.478104480E-002,
--1.510649733E-002,
--1.541720331E-002,
--1.571240649E-002,
--1.599138230E-002,
--1.625344716E-002,
--1.649795473E-002,
--1.672429405E-002,
--1.693190821E-002,
--1.712027565E-002,
--1.728892699E-002,
--1.743743755E-002,
--1.756543480E-002,
--1.767260395E-002,
--1.775865816E-002,
--1.782339066E-002,
--1.786663756E-002,
--1.788828894E-002,
-+1.788828894E-002,
-+1.786663756E-002,
-+1.782339066E-002,
-+1.775865816E-002,
-+1.767260395E-002,
-+1.756543480E-002,
-+1.743743755E-002,
-+1.728892699E-002,
-+1.712027565E-002,
-+1.693190821E-002,
-+1.672429405E-002,
-+1.649795473E-002,
-+1.625344716E-002,
-+1.599138230E-002,
-+1.571240649E-002,
-+1.541720331E-002,
-+1.510649733E-002,
-+1.478104480E-002,
-+1.444163360E-002,
-+1.408908330E-002,
-+1.372423489E-002,
-+1.334795821E-002,
-+1.296114177E-002,
-+1.256469358E-002,
-+1.215953380E-002,
-+1.174659748E-002,
-+1.132682897E-002,
-+1.090117730E-002,
-+1.047059800E-002,
-+1.003604382E-002,
-+9.598465636E-003,
-+9.158811532E-003,
-+8.718019351E-003,
-+8.277016692E-003,
-+7.836719044E-003,
-+7.398022339E-003,
-+6.961807609E-003,
-+6.528933067E-003,
-+6.100233644E-003,
-+5.676518660E-003,
-+5.258570891E-003,
-+4.847140983E-003,
-+4.442950245E-003,
-+4.046686925E-003,
-+3.659002949E-003,
-+3.280514618E-003,
-+2.911801683E-003,
-+2.553403843E-003,
-+2.205822384E-003,
-+1.869517611E-003,
-+1.544908970E-003,
-+1.232374110E-003,
-+9.322494152E-004,
-+6.448282511E-004,
-+3.703625989E-004,
-+1.090620208E-004,
--1.389056415E-004,
--3.734139318E-004,
--5.943773431E-004,
--8.017504588E-004,
--9.955273708E-004,
--1.175740734E-003,
--1.342460280E-003,
--1.495792647E-003,
-+1.635878929E-003,
-+1.762894331E-003,
-+1.877046190E-003,
-+1.978572691E-003,
-+2.067740774E-003,
-+2.144844970E-003,
-+2.210205887E-003,
-+2.264167881E-003,
-+2.307097195E-003,
-+2.339380793E-003,
-+2.361423569E-003,
-+2.373647178E-003,
-+2.376487479E-003,
-+2.370394068E-003,
-+2.355825622E-003,
-+2.333251061E-003,
-+2.303145360E-003,
-+2.265989315E-003,
-+2.222266514E-003,
-+2.172462177E-003,
-+2.117061289E-003,
-+2.056547208E-003,
-+1.991399564E-003,
-+1.922092517E-003,
-+1.849094522E-003,
-+1.772865304E-003,
-+1.693855622E-003,
-+1.612505526E-003,
-+1.529243193E-003,
-+1.444484224E-003,
-+1.358630019E-003,
-+1.272067428E-003,
-+1.185167348E-003,
-+1.098284614E-003,
-+1.011756598E-003,
-+9.259034996E-004,
-+8.410271257E-004,
-+7.574109477E-004,
-+6.753197522E-004,
-+5.949990009E-004,
-+5.166754709E-004,
-+4.405563814E-004,
-+3.668301215E-004,
-+2.956659591E-004,
-+2.272142592E-004,
-+1.616069785E-004,
-+9.895755647E-005,
-+3.936182839E-005,
--1.710198012E-005,
--7.037253090E-005,
--1.204049113E-004,
--1.671699720E-004,
--2.106537577E-004,
--2.508567995E-004,
--2.877934603E-004,
--3.214911267E-004,
--3.519894381E-004,
--3.793396754E-004,
--4.036037717E-004,
--4.248536134E-004,
--4.431701091E-004,
--4.586426076E-004,
--4.713678791E-004,
--4.814492422E-004,
-+4.889960401E-004,
-+4.941228544E-004,
-+4.969481961E-004,
-+4.975944757E-004,
-+4.961824161E-004,
-+4.928477574E-004,
-+4.877146275E-004,
-+4.809123348E-004,
-+4.725702747E-004,
-+4.628172028E-004,
-+4.517810594E-004,
-+4.395879805E-004,
-+4.263620067E-004,
-+4.122247046E-004,
-+3.972945851E-004,
-+3.816867538E-004,
-+3.655125911E-004,
-+3.488793736E-004,
-+3.318900708E-004,
-+3.146430245E-004,
-+2.972317743E-004,
-+2.797449124E-004,
-+2.622658503E-004,
-+2.448728774E-004,
-+2.276388550E-004,
-+2.106313768E-004,
-+1.939126523E-004,
-+1.775395358E-004,
-+1.615635992E-004,
-+1.460311323E-004,
-+1.309833024E-004,
-+1.164562127E-004,
-+1.024810626E-004,
-+8.908427117E-005,
-+7.628766616E-005,
-+6.410864444E-005,
-+5.256036457E-005,
-+4.165195787E-005,
-+3.138873581E-005,
-+2.177240640E-005,
-+1.280130618E-005,
-+4.470633485E-006,
--3.227306706E-006,
--1.030297699E-005,
--1.676913780E-005,
--2.264085742E-005,
--2.793515523E-005,
--3.267079956E-005,
--3.686808850E-005,
--4.054862075E-005,
--4.373511547E-005,
--4.645117951E-005,
--4.872112549E-005,
--5.056979353E-005,
--5.202236207E-005,
--5.310418419E-005,
--5.384063843E-005,
--5.425697600E-005,
--5.437819709E-005,
--5.422891263E-005,
--5.383323878E-005,
--5.321469871E-005,
--5.239612074E-005,
--5.139957648E-005,
-+5.024627535E-005,
-+4.895655002E-005,
-+4.754976908E-005,
-+4.604430433E-005,
-+4.445751256E-005,
-+4.280570283E-005,
-+4.110412556E-005,
-+3.936696885E-005,
-+3.760734762E-005,
-+3.583733633E-005,
-+3.406793985E-005,
-+3.230916263E-005,
-+3.056998685E-005,
-+2.885844333E-005,
-+2.718161704E-005,
-+2.554569073E-005,
-+2.395598858E-005,
-+2.241701623E-005,
-+2.093250441E-005,
-+1.950545993E-005,
-+1.813820381E-005,
-+1.683242772E-005,
-+1.558924305E-005,
-+1.440921824E-005,
-+1.329243969E-005,
-+1.223855270E-005,
-+1.124680875E-005,
-+1.031611009E-005,
-+9.445050637E-006,
-+8.631964192E-006,
-+7.874960829E-006,
-+7.171964626E-006,
-+6.520755960E-006,
-+5.918994248E-006,
-+5.364252502E-006,
-+4.854050530E-006,
-+4.385879038E-006,
-+3.957220997E-006,
-+3.565570978E-006,
-+3.208459020E-006,
-+2.883470643E-006,
-+2.588257530E-006,
-+2.320550948E-006,
-+2.078171747E-006,
-+1.859034001E-006,
-+1.661159786E-006,
-+1.482681114E-006,
-+1.321840614E-006,
-+1.176999604E-006,
-+1.046637067E-006,
-+9.293416952E-007,
-+8.238164355E-007,
-+7.288739425E-007,
-+6.434325428E-007,
-+5.665120852E-007,
-+4.972276315E-007,
-+4.347855338E-007,
-+3.784752209E-007,
-+3.276689142E-007,
-+2.818143514E-007,
-+2.404238444E-007,
-+2.030677564E-007,
-+1.693738625E-007,
-+1.390191784E-007
-};
-
-DECLARE_ALIGNED(16, static const float, lfe_fir_64)[] =
-{
-    2.658434386830777e-4, 9.029330685734748e-3,
-    7.939263433218002e-2, 2.425158768892288e-1,
-    3.430179357528686e-1, 2.398228943347931e-1,
-    7.746443897485733e-2, 8.622321300208569e-3,
-    8.179365249816328e-5, 9.450953453779220e-3,
-    8.134882897138596e-2, 2.451938837766648e-1,
-    3.429597318172455e-1, 2.371159791946411e-1,
-    7.556436210870743e-2, 8.229630999267101e-3,
-    9.439323912374676e-5, 9.887560270726680e-3,
-    8.333285897970200e-2, 2.478559017181396e-1,
-    3.428434133529663e-1, 2.343961596488952e-1,
-    7.369252294301987e-2, 7.850865833461285e-3,
-    1.082170274457894e-4, 1.033949479460716e-2,
-    8.534456789493561e-2, 2.505008876323700e-1,
-    3.426689505577088e-1, 2.316644787788391e-1,
-    7.184901088476181e-2, 7.485736627131701e-3,
-    1.233371440321207e-4, 1.080708485096693e-2,
-    8.738376945257187e-2, 2.531278133392334e-1,
-    3.424364924430847e-1, 2.289219647645950e-1,
-    7.003392279148102e-2, 7.133882027119398e-3,
-    1.397485757479444e-4, 1.129068247973919e-2,
-    8.945026248693466e-2, 2.557355761528015e-1,
-    3.421461284160614e-1, 2.261696159839630e-1,
-    6.824731826782227e-2, 6.794991903007030e-3,
-    1.575958012836054e-4, 1.179065089672804e-2,
-    9.154383838176728e-2, 2.583232223987580e-1,
-    3.417979776859284e-1, 2.234084606170654e-1,
-    6.648923456668854e-2, 6.468691397458315e-3,
-    1.769922382663936e-4, 1.230732165277004e-2,
-    9.366425126791000e-2, 2.608896791934967e-1,
-    3.413922190666198e-1, 2.206395119428635e-1,
-    6.475970894098282e-2, 6.154712289571762e-3,
-    1.981738605536520e-4, 1.284105982631445e-2,
-    9.581124037504196e-2, 2.634339034557342e-1,
-    3.409290313720703e-1, 2.178637981414795e-1,
-    6.305878609418869e-2, 5.852684378623962e-3,
-    2.211847313446924e-4, 1.339218579232693e-2,
-    9.798453748226166e-2, 2.659549415111542e-1,
-    3.404086530208588e-1, 2.150822728872299e-1,
-    6.138643622398376e-2, 5.562345497310162e-3,
-    2.460231189616024e-4, 1.396108977496624e-2,
-    1.001838669180870e-1, 2.684516608715058e-1,
-    3.398312926292420e-1, 2.122959494590759e-1,
-    5.974265560507774e-2, 5.283284001052380e-3,
-    2.726115926634520e-4, 1.454808749258518e-2,
-    1.024089083075523e-1, 2.709231376647949e-1,
-    3.391972482204438e-1, 2.095058411359787e-1,
-    5.812742188572884e-2, 5.015311297029257e-3,
-    3.013863170053810e-4, 1.515355054289102e-2,
-    1.046593263745308e-1, 2.733682692050934e-1,
-    3.385068178176880e-1, 2.067128717899322e-1,
-    5.654069408774376e-2, 4.758012015372515e-3,
-    3.328395541757345e-4, 1.577781140804291e-2,
-    1.069347932934761e-1, 2.757860720157624e-1,
-    3.377602994441986e-1, 2.039180546998978e-1,
-    5.498242005705833e-2, 4.511159844696522e-3,
-    3.658991190604866e-4, 1.642123050987720e-2,
-    1.092349365353584e-1, 2.781755328178406e-1,
-    3.369580209255218e-1, 2.011223286390304e-1,
-    5.345252528786659e-2, 4.274417180567980e-3,
-    4.018281470052898e-4, 1.708412915468216e-2,
-    1.115593686699867e-1, 2.805356979370117e-1,
-    3.361004292964936e-1, 1.983266174793244e-1,
-    5.195093154907227e-2, 4.047499038279056e-3,
-    4.401875485200435e-4, 1.776690222322941e-2,
-    1.139076948165894e-1, 2.828655838966370e-1,
-    3.351879119873047e-1, 1.955319195985794e-1,
-    5.047753453254700e-2, 3.830091329291463e-3,
-    4.812776169274002e-4, 1.846982724964619e-2,
-    1.162794977426529e-1, 2.851640880107880e-1,
-    3.342207968235016e-1, 1.927391141653061e-1,
-    4.903224110603333e-2, 3.621967276558280e-3,
-    5.252459668554366e-4, 1.919330470263958e-2,
-    1.186743453145027e-1, 2.874303460121155e-1,
-    3.331996202468872e-1, 1.899491697549820e-1,
-    4.761491715908051e-2, 3.422776935622096e-3,
-    5.721592460758984e-4, 1.993762329220772e-2,
-    1.210917681455612e-1, 2.896633744239807e-1,
-    3.321248590946198e-1, 1.871629506349564e-1,
-    4.622544348239899e-2, 3.232272574678064e-3,
-    6.222130032256246e-4, 2.070316113531590e-2,
-    1.235313042998314e-1, 2.918621897697448e-1,
-    3.309969604015350e-1, 1.843813359737396e-1,
-    4.486365616321564e-2, 3.050152910873294e-3,
-    6.755515350960195e-4, 2.149021252989769e-2,
-    1.259924471378326e-1, 2.940258979797364e-1,
-    3.298164308071136e-1, 1.816052496433258e-1,
-    4.352942481637001e-2, 2.876190468668938e-3,
-    7.324148900806904e-4, 2.229913882911205e-2,
-    1.284746825695038e-1, 2.961534857749939e-1,
-    3.285838961601258e-1, 1.788355410099030e-1,
-    4.222255200147629e-2, 2.710093278437853e-3,
-    7.928516715764999e-4, 2.313023805618286e-2,
-    1.309774816036224e-1, 2.982441186904907e-1,
-    3.272998929023742e-1, 1.760730892419815e-1,
-    4.094288870692253e-2, 2.551567042246461e-3,
-    8.570110658183694e-4, 2.398385666310787e-2,
-    1.335003077983856e-1, 3.002967536449432e-1,
-    3.259649574756622e-1, 1.733186990022659e-1,
-    3.969023004174232e-2, 2.400433411821723e-3,
-    9.251192095689476e-4, 2.486028522253036e-2,
-    1.360425949096680e-1, 3.023106753826142e-1,
-    3.245797157287598e-1, 1.705732345581055e-1,
-    3.846437484025955e-2, 2.256359672173858e-3,
-    9.974770946428180e-4, 2.575986087322235e-2,
-    1.386037617921829e-1, 3.042849004268646e-1,
-    3.231448531150818e-1, 1.678375005722046e-1,
-    3.726511076092720e-2, 2.119151875376701e-3,
-    1.073930296115577e-3, 2.668286114931106e-2,
-    1.411831974983215e-1, 3.062185347080230e-1,
-    3.216609656810760e-1, 1.651122719049454e-1,
-    3.609224036335945e-2, 1.988604199141264e-3,
-    1.155023579485714e-3, 2.762960828840732e-2,
-    1.437802612781525e-1, 3.081108033657074e-1,
-    3.201287388801574e-1, 1.623983532190323e-1,
-    3.494550660252571e-2, 1.864377525635064e-3,
-    1.240676851011813e-3, 2.860039286315441e-2,
-    1.463943719863892e-1, 3.099608123302460e-1,
-    3.185488879680634e-1, 1.596965193748474e-1,
-    3.382468968629837e-2, 1.746327499859035e-3,
-    1.331258914433420e-3, 2.959549613296986e-2,
-    1.490248143672943e-1, 3.117676973342896e-1,
-    3.169221282005310e-1, 1.570075154304504e-1,
-    3.272953629493714e-2, 1.634211512282491e-3,
-    1.426893868483603e-3, 3.061520494520664e-2,
-    1.516709625720978e-1, 3.135308027267456e-1,
-    3.152491748332978e-1, 1.543320864439010e-1,
-    3.165979683399200e-2, 1.527829794213176e-3,
-};
-
-DECLARE_ALIGNED(16, static const float, lfe_fir_128)[] =
-{
-    0.00053168571, 0.15878495574, 0.68603444099, 0.15492856503,
-    0.00016358691, 0.16269733012, 0.68591803312, 0.15112841129,
-    0.00018878609, 0.16666537523, 0.68568539619, 0.14738474786,
-    0.00021643363, 0.17068879306, 0.68533653021, 0.14369773865,
-    0.00024667382, 0.17476719618, 0.68487155437, 0.14006754756,
-    0.00027949660, 0.17890018225, 0.68429082632, 0.13649433851,
-    0.00031519096, 0.18308731914, 0.68359452486, 0.13297818601,
-    0.00035398375, 0.18732811511, 0.68278300762, 0.12951917946,
-    0.00039634691, 0.19162209332, 0.68185669184, 0.12611730397,
-    0.00044236859, 0.19596865773, 0.68081587553, 0.12277261168,
-    0.00049204525, 0.20036731660, 0.67966115475, 0.11948505789,
-    0.00054522208, 0.20481738448, 0.67839306593, 0.11625462025,
-    0.00060277141, 0.20931822062, 0.67701220512, 0.11308115721,
-    0.00066567765, 0.21386915445, 0.67551922798, 0.10996460915,
-    0.00073179678, 0.21846942604, 0.67391467094, 0.10690483451,
-    0.00080365466, 0.22311829031, 0.67219948769, 0.10390164703,
-    0.00088037323, 0.22781492770, 0.67037439346, 0.10095486045,
-    0.00096255314, 0.23255851865, 0.66844022274, 0.09806428105,
-    0.00105048984, 0.23734821379, 0.66639786959, 0.09522963315,
-    0.00114431616, 0.24218304455, 0.66424828768, 0.09245070815,
-    0.00124442333, 0.24706205726, 0.66199249029, 0.08972713351,
-    0.00135110028, 0.25198432803, 0.65963155031, 0.08705867827,
-    0.00146482687, 0.25694879889, 0.65716648102, 0.08444493264,
-    0.00158570008, 0.26195442677, 0.65459835529, 0.08188561350,
-    0.00171401864, 0.26700007915, 0.65192854404, 0.07938029617,
-    0.00185023469, 0.27208462358, 0.64915806055, 0.07692859322,
-    0.00199495023, 0.27720692754, 0.64628833532, 0.07453006506,
-    0.00214785640, 0.28236576915, 0.64332056046, 0.07218432426,
-    0.00231004250, 0.28755992651, 0.64025616646, 0.06989086419,
-    0.00248134881, 0.29278811812, 0.63709646463, 0.06764923781,
-    0.00266251224, 0.29804900289, 0.63384294510, 0.06545893103,
-    0.00285378192, 0.30334126949, 0.63049703836, 0.06331945211,
-    0.00305565330, 0.30866351724, 0.62706029415, 0.06123027951,
-    0.00326841651, 0.31401440501, 0.62353414297, 0.05919086933,
-    0.00349264755, 0.31939238310, 0.61992025375, 0.05720067024,
-    0.00372874714, 0.32479602098, 0.61622029543, 0.05525910854,
-    0.00397720048, 0.33022382855, 0.61243581772, 0.05336561054,
-    0.00423829490, 0.33567428589, 0.60856848955, 0.05151961371,
-    0.00451271003, 0.34114575386, 0.60462015867, 0.04972046614,
-    0.00480085658, 0.34663668275, 0.60059231520, 0.04796761274,
-    0.00510312291, 0.35214546323, 0.59648692608, 0.04626038298,
-    0.00542017492, 0.35767036676, 0.59230577946, 0.04459818453,
-    0.00575236930, 0.36320972443, 0.58805054426, 0.04298033938,
-    0.00610029325, 0.36876192689, 0.58372318745, 0.04140623659,
-    0.00646453211, 0.37432509661, 0.57932555676, 0.03987516090,
-    0.00684553990, 0.37989753485, 0.57485944033, 0.03838652745,
-    0.00724391919, 0.38547745347, 0.57032698393, 0.03693958372,
-    0.00766016589, 0.39106300473, 0.56572991610, 0.03553372994,
-    0.00809498038, 0.39665243030, 0.56107026339, 0.03416819125,
-    0.00854881573, 0.40224379301, 0.55634999275, 0.03284239396,
-    0.00902230106, 0.40783521533, 0.55157101154, 0.03155555204,
-    0.00951600447, 0.41342487931, 0.54673534632, 0.03030703776,
-    0.01003060210, 0.41901078820, 0.54184508324, 0.02909611352,
-    0.01056654565, 0.42459106445, 0.53690224886, 0.02792212367,
-    0.01112466771, 0.43016362190, 0.53190881014, 0.02678431384,
-    0.01170534454, 0.43572667241, 0.52686679363, 0.02568206564,
-    0.01230939943, 0.44127810001, 0.52177828550, 0.02461459488,
-    0.01293735672, 0.44681602716, 0.51664537191, 0.02358125709,
-    0.01358995494, 0.45233830810, 0.51147013903, 0.02258131653,
-    0.01426773332, 0.45784294605, 0.50625455379, 0.02161412500,
-    0.01497144438, 0.46332800388, 0.50100076199, 0.02067894675,
-    0.01570170000, 0.46879136562, 0.49571081996, 0.01977507770,
-    0.01645922661, 0.47423094511, 0.49038675427, 0.01890186779,
-    0.01724460535, 0.47964480519, 0.48503074050, 0.01805862412,
-};
-
-/* 10^-(dB/20), with dB being a list of dB values ranging from 0 to -72 */
-/* do a 20*log10(dca_downmix_coeffs) to reconvert the values */
-
-static const float dca_downmix_coeffs[65] = {
-  1.000000000000000, 0.988553094656939, 0.971627951577106, 0.944060876285923, 0.917275935389780, 0.891250938133746,
-  0.865964323360065, 0.841395141645195, 0.817523037943650, 0.794328234724281, 0.771791515585012, 0.749894209332456,
-  0.728618174513228, 0.707945784384138, 0.687859912308808, 0.668343917568615, 0.649381631576211, 0.630957344480193,
-  0.613055792149821, 0.595662143529010, 0.578761988349121, 0.562341325190349, 0.546386549881854, 0.530884444230988,
-  0.515822165072306, 0.501187233627272, 0.446683592150963, 0.398107170553497, 0.354813389233575, 0.316227766016838,
-  0.281838293126445, 0.251188643150958, 0.223872113856834, 0.199526231496888, 0.177827941003892, 0.158489319246111,
-  0.141253754462275, 0.125892541179417, 0.112201845430196, 0.100000000000000, 0.089125093813374, 0.079432823472428,
-  0.070794578438414, 0.063095734448019, 0.053088444423099, 0.044668359215096, 0.037583740428844, 0.031622776601684,
-  0.026607250597988, 0.022387211385683, 0.018836490894898, 0.015848931924611, 0.013335214321633, 0.011220184543020,
-  0.009440608762859, 0.007943282347243, 0.005623413251903, 0.003981071705535, 0.002818382931264, 0.001995262314969,
-  0.001412537544623, 0.001000000000000, 0.000501187233627, 0.000251188643151, 0.000000000000000,
-};
-
-static const uint8_t dca_default_coeffs[16][5][2] = {
-    { { 13, 13 },                                                 },
-    { {  0, 64 }, { 64,  0 },                                     },
-    { {  0, 64 }, { 64,  0 },                                     },
-    { {  0, 64 }, { 64,  0 },                                     },
-    { {  0, 64 }, { 64,  0 },                                     },
-    { {  6,  6 }, {  0, 25 }, { 25,  0 },                         },
-    { {  0, 25 }, { 25,  0 }, { 13, 13 },                         },
-    { {  6,  6 }, {  0, 25 }, { 25,  0 }, { 13, 13 },             },
-    { {  0, 25 }, { 25,  0 }, {  0, 13 }, { 13,  0 },             },
-    { {  6,  6 }, {  0, 25 }, { 25,  0 }, {  0, 13 }, { 13,  0 }, },
-};
-
-/* downmix coeffs
-
- TABLE 9
-______________________________________
-Down-mix coefficients for 8-channel source
-audio (5 + 3 format)
- lt
- cen- rt lt ctr rt
-lt ter ctr center
- rt srd srd srd
-______________________________________
-1 0.71 0.74 1.0 0.71 0.71 0.58 0.58 0.58
-2 left 1.0 0.89 0.71 0.46 0.71 0.50
-  rt 0.45 0.71 0.89 1.0 0.50 0.71
-3 lt 1.0 0.89 0.71 0.45
- rt 0.45 0.71 0.89 1.0
- srd 0.71 0.71 0.71
-4 lt 1.0 0.89 0.71 0.45
- rt 0.45 0.71 0.89 1.0
- lt srd 1.0 0.71
- rt srd 0.71 0.71
-4 lt 1.0 0.5
- ctr 0.87 1.0 0.87
- rt 0.5 1.0
- srd 0.71 0.71 0.71
-5 lt 1.0 0.5
- ctr 0.87 1.0 0.87
- rt 0.5 1.0
- lt srd 1.0 0.71
- rt srd 0.71 1.0
-6 lt 1.0 0.5
- lt ctr 0.87 0.71
- rt ctr 0.71 0.87
- rt 0.5 1.0
- lt srd 1.0 0.71
- rt srd 0.71 1.0
-6 lt 1.0 0.5
- ctr 0.86 1.0 0.86
- rt 0.5 1.0
- lt srd 1.0
- ctr srd 1.0
- rt srd 1.0
-7 lt 1.0
- lt ctr 1.0
- ctr 1.0
- rt ctr 1.0
- rt 1.0
- lt srd 1.0 0.71
- rt srd 0.71 1.0
-7 lt 1.0 0.5
- lt ctr 0.87 0.71
- rt ctr 0.71 0.87
- rt 0.5 1.0
- lt srd 1.0
- ctr srd 1.0
- rt srd 1.0
-8 lt 1.0 0.5
- lt ctr 0.87 0.71
- rt ctr 0.71 0.87
- rt 0.5 1.0
- lt 1 srd 0.87 0.35
- lt 2 srd 0.5 0.61
- rt 2 srd 0.61 0.50
- rt 2 srd 0.35 0.87
-
- Generation of Lt Rt
-
-In the case when the playback system has analog or digital surround multi-channel capability, a down matrix from 5, 4, or 3 channel to Lt Rt may be desirable. In the case when the number of decoded audio channels exceeds 5, 4 or 3 respectively a first stage down mix to 5, 4 or 3 chs should be used as described above.
-
-The down matrixing equations for 5-channel source audio to a two-channel Lt Rt playback system are given by:
-
-Left left+0.7*center-0.7*(lt surround+rt surround)
-
-Right=right+0.7*center+0.7*(lt surround+rt surround)
-
-Embedded mixing to 2-channel
-
-One concern arising from the proliferation of multi-channel audio systems is that most home systems presently have only two channel playback capability. To accommodate this a fixed 2-channel down matrix processes is commonly used following the multi-channel decoding stage. However, for music only applications the image quality etc. of the down matrixed signal may not match that of an equivalent stereo recording found on CD.
-
-The concept of embedded mixing is to allow the producer to dynamically specify the matrixing coefficients within the audio frame itself. In this way the stereo down mix at the decoder may be better matched to a 2-channel playback environment.
-
-CHS*2, 7-bit down mix indexes (MCOEFFS) are transmitted along with the multi-channel audio once in every frame. The indexes are converted to attenuation factors using a 7 bit LUT. The 2-ch down mix equations are as follows,
-
-Left Ch=sum (MCOEFF[n]*Ch[n]) for n=1, CHS
-
-Right Ch sum (MCOEFF[n+CHS]*Ch[n]) for n=1, CHS
-
-where Ch(n) represents the subband samples in the (n)th audio channel.
-
-
-*/
-
-#endif /* AVCODEC_DCADATA_H */
diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c
deleted file mode 100644
index af48e3c..0000000
--- a/libavcodec/dcadsp.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2004 Gildas Bazin
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "dcadsp.h"
-
-static void dca_lfe_fir_c(float *out, const float *in, const float *coefs,
-                          int decifactor, float scale, float bias)
-{
-    float *out2 = out + decifactor;
-    const float *cf0 = coefs;
-    const float *cf1 = coefs + 256;
-    int j, k;
-
-    /* One decimated sample generates 2*decifactor interpolated ones */
-    for (k = 0; k < decifactor; k++) {
-        float v0 = 0.0;
-        float v1 = 0.0;
-        for (j = 0; j < 256 / decifactor; j++) {
-            float s = in[-j];
-            v0 += s * *cf0++;
-            v1 += s * *--cf1;
-        }
-        *out++  = (v0 * scale) + bias;
-        *out2++ = (v1 * scale) + bias;
-    }
-}
-
-void ff_dcadsp_init(DCADSPContext *s)
-{
-    s->lfe_fir = dca_lfe_fir_c;
-    if (ARCH_ARM) ff_dcadsp_init_arm(s);
-}
diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h
deleted file mode 100644
index 20020ae..0000000
--- a/libavcodec/dcadsp.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DCADSP_H
-#define AVCODEC_DCADSP_H
-
-typedef struct DCADSPContext {
-    void (*lfe_fir)(float *out, const float *in, const float *coefs,
-                    int decifactor, float scale, float bias);
-} DCADSPContext;
-
-void ff_dcadsp_init(DCADSPContext *s);
-void ff_dcadsp_init_arm(DCADSPContext *s);
-
-#endif /* AVCODEC_DCADSP_H */
diff --git a/libavcodec/dcahuff.h b/libavcodec/dcahuff.h
deleted file mode 100644
index cbc8429..0000000
--- a/libavcodec/dcahuff.h
+++ /dev/null
@@ -1,1076 +0,0 @@
-/*
- * DCA compatible decoder - huffman tables
- * Copyright (C) 2004 Gildas Bazin
- * Copyright (C) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DCAHUFF_H
-#define AVCODEC_DCAHUFF_H
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#define TMODE_COUNT 4
-static const uint8_t tmode_vlc_bits[TMODE_COUNT] = { 3, 3, 3, 2 };
-static const uint16_t tmode_codes[TMODE_COUNT][4] = {
-  { 0x0000, 0x0002, 0x0006, 0x0007 },
-  { 0x0002, 0x0006, 0x0007, 0x0000 },
-  { 0x0006, 0x0007, 0x0000, 0x0002 },
-  { 0x0000, 0x0001, 0x0002, 0x0003 }
-};
-static const uint8_t tmode_bits[TMODE_COUNT][4] = {
-  {  1,  2,  3,  3 },
-  {  2,  3,  3,  1 },
-  {  3,  3,  1,  2 },
-  {  2,  2,  2,  2 }
-};
-
-
-#define BITALLOC_12_COUNT 5
-#define BITALLOC_12_VLC_BITS 9
-static const uint8_t bitalloc_12_vlc_bits[BITALLOC_12_COUNT] = {
-  9, 7, 7, 9, 9
-};
-static const uint16_t bitalloc_12_codes[BITALLOC_12_COUNT][12] = {
-  {
-    0x0000, 0x0002, 0x0006, 0x000E, 0x001E, 0x003E, 0x00FF, 0x00FE,
-    0x01FB, 0x01FA, 0x01F9, 0x01F8,
-  },
-  {
-    0x0001, 0x0000, 0x0002, 0x000F, 0x000C, 0x001D, 0x0039, 0x0038,
-    0x0037, 0x0036, 0x0035, 0x0034,
-  },
-  {
-    0x0000, 0x0007, 0x0005, 0x0004, 0x0002, 0x000D, 0x000C, 0x0006,
-    0x000F, 0x001D, 0x0039, 0x0038,
-  },
-  {
-    0x0003, 0x0002, 0x0000, 0x0002, 0x0006, 0x000E, 0x001E, 0x003E,
-    0x007E, 0x00FE, 0x01FF, 0x01FE,
-  },
-  {
-    0x0001, 0x0000, 0x0002, 0x0006, 0x000E, 0x003F, 0x003D, 0x007C,
-    0x0079, 0x0078, 0x00FB, 0x00FA,
-  }
-};
-static const uint8_t bitalloc_12_bits[BITALLOC_12_COUNT][12] = {
-  { 1,  2,  3,  4,  5,  6,  8,  8,  9,  9,  9,  9 },
-  { 1,  2,  3,  5,  5,  6,  7,  7,  7,  7,  7,  7 },
-  { 2,  3,  3,  3,  3,  4,  4,  4,  5,  6,  7,  7 },
-  { 2,  2,  2,  3,  4,  5,  6,  7,  8,  9, 10, 10 },
-  { 1,  2,  3,  4,  5,  7,  7,  8,  8,  8,  9,  9 }
-};
-
-
-#define SCALES_COUNT 5
-#define SCALES_VLC_BITS 9
-static const uint16_t scales_codes[SCALES_COUNT][129] = {
-  {
-    0x3AB0, 0x3AB2, 0x3AB4, 0x3AB6, 0x3AB8, 0x3ABA, 0x3ABC, 0x3ABE,
-    0x3AC0, 0x3AC2, 0x3AC4, 0x3AC6, 0x3AC8, 0x3ACA, 0x3ACC, 0x3ACE,
-    0x3AD0, 0x3AD2, 0x3AD4, 0x3AD6, 0x3AD8, 0x3ADA, 0x3ADC, 0x3ADE,
-    0x3AE0, 0x3AE2, 0x3AE4, 0x3AE6, 0x3AE8, 0x3AEA, 0x3AEC, 0x3AEE,
-    0x3AF0, 0x3AF2, 0x3AF4, 0x3AF6, 0x3AF8, 0x3AFA, 0x3AFC, 0x3AFE,
-    0x0540, 0x0542, 0x0544, 0x0546, 0x0548, 0x054A, 0x054C, 0x054E,
-    0x0558, 0x055E, 0x02AD, 0x0154, 0x0754, 0x03A8, 0x0056, 0x0028,
-    0x00E8, 0x004A, 0x000B, 0x003B, 0x0013, 0x0003, 0x000F, 0x0005,
-    0x0001, 0x0006, 0x0000, 0x0008, 0x001C, 0x0004, 0x0024, 0x004B,
-    0x00E9, 0x0029, 0x0057, 0x03A9, 0x0755, 0x0155, 0x02AE, 0x055F,
-    0x0559, 0x054F, 0x054D, 0x054B, 0x0549, 0x0547, 0x0545, 0x0543,
-    0x0541, 0x3AFF, 0x3AFD, 0x3AFB, 0x3AF9, 0x3AF7, 0x3AF5, 0x3AF3,
-    0x3AF1, 0x3AEF, 0x3AED, 0x3AEB, 0x3AE9, 0x3AE7, 0x3AE5, 0x3AE3,
-    0x3AE1, 0x3ADF, 0x3ADD, 0x3ADB, 0x3AD9, 0x3AD7, 0x3AD5, 0x3AD3,
-    0x3AD1, 0x3ACF, 0x3ACD, 0x3ACB, 0x3AC9, 0x3AC7, 0x3AC5, 0x3AC3,
-    0x3AC1, 0x3ABF, 0x3ABD, 0x3ABB, 0x3AB9, 0x3AB7, 0x3AB5, 0x3AB3,
-    0x3AB1,
-  },
-  {
-    0x0F60, 0x0F62, 0x0F64, 0x0F66, 0x0F68, 0x0F6A, 0x0F6C, 0x0F6E,
-    0x0F70, 0x0F72, 0x0F74, 0x0F76, 0x0F78, 0x0F7A, 0x0F7C, 0x0F7E,
-    0x0F80, 0x0F82, 0x0F84, 0x0F86, 0x0F88, 0x0F8A, 0x0F8C, 0x0F8E,
-    0x0F90, 0x0F92, 0x0F94, 0x0F96, 0x0F98, 0x0F9A, 0x0F9C, 0x0F9E,
-    0x0FA0, 0x0FA2, 0x0FA4, 0x0FA6, 0x0FA8, 0x0FAA, 0x0FAC, 0x0FAE,
-    0x0FB0, 0x0FB2, 0x0FB4, 0x0FB6, 0x0FB8, 0x0FBA, 0x0FBC, 0x0FBE,
-    0x07A0, 0x07A2, 0x03D2, 0x01EA, 0x00FC, 0x007F, 0x001C, 0x000C,
-    0x0004, 0x0034, 0x0010, 0x001B, 0x0009, 0x000B, 0x000E, 0x0001,
-    0x0003, 0x0002, 0x000F, 0x000C, 0x000A, 0x0000, 0x0011, 0x0035,
-    0x0005, 0x000D, 0x001D, 0x003C, 0x00FD, 0x01EB, 0x03D3, 0x07A3,
-    0x07A1, 0x0FBF, 0x0FBD, 0x0FBB, 0x0FB9, 0x0FB7, 0x0FB5, 0x0FB3,
-    0x0FB1, 0x0FAF, 0x0FAD, 0x0FAB, 0x0FA9, 0x0FA7, 0x0FA5, 0x0FA3,
-    0x0FA1, 0x0F9F, 0x0F9D, 0x0F9B, 0x0F99, 0x0F97, 0x0F95, 0x0F93,
-    0x0F91, 0x0F8F, 0x0F8D, 0x0F8B, 0x0F89, 0x0F87, 0x0F85, 0x0F83,
-    0x0F81, 0x0F7F, 0x0F7D, 0x0F7B, 0x0F79, 0x0F77, 0x0F75, 0x0F73,
-    0x0F71, 0x0F6F, 0x0F6D, 0x0F6B, 0x0F69, 0x0F67, 0x0F65, 0x0F63,
-    0x0F61,
-  },
-  {
-    0x51D0, 0x51D2, 0x51D4, 0x51D6, 0x51D8, 0x51DA, 0x51DC, 0x51DE,
-    0x51E0, 0x51E2, 0x51E4, 0x51E6, 0x51E8, 0x51EA, 0x51EC, 0x51EE,
-    0x51F0, 0x51F2, 0x51F4, 0x51F6, 0x51F8, 0x51FA, 0x51FC, 0x51FE,
-    0x70C0, 0x70C2, 0x70C4, 0x70C6, 0x70C8, 0x70CA, 0x70CC, 0x70CE,
-    0x70EC, 0x10EA, 0x3868, 0x3877, 0x0876, 0x1C35, 0x0434, 0x0A34,
-    0x0E1B, 0x021B, 0x051B, 0x070F, 0x010F, 0x0380, 0x0080, 0x0140,
-    0x01C1, 0x0041, 0x00A1, 0x00E2, 0x0022, 0x0052, 0x0072, 0x0012,
-    0x002A, 0x003A, 0x000A, 0x0016, 0x001E, 0x0006, 0x000C, 0x0000,
-    0x0004, 0x0001, 0x000D, 0x0007, 0x001F, 0x0017, 0x000B, 0x003B,
-    0x002B, 0x0013, 0x0073, 0x0053, 0x0023, 0x00E3, 0x00A2, 0x0042,
-    0x01C2, 0x0141, 0x0081, 0x0381, 0x028C, 0x010C, 0x051C, 0x021C,
-    0x0E1C, 0x0A35, 0x0435, 0x1C3A, 0x0877, 0x0874, 0x3869, 0x10EB,
-    0x70ED, 0x70CF, 0x70CD, 0x70CB, 0x70C9, 0x70C7, 0x70C5, 0x70C3,
-    0x70C1, 0x51FF, 0x51FD, 0x51FB, 0x51F9, 0x51F7, 0x51F5, 0x51F3,
-    0x51F1, 0x51EF, 0x51ED, 0x51EB, 0x51E9, 0x51E7, 0x51E5, 0x51E3,
-    0x51E1, 0x51DF, 0x51DD, 0x51DB, 0x51D9, 0x51D7, 0x51D5, 0x51D3,
-    0x51D1,
-  },
-  {
-    0x6F64, 0x6F66, 0x6F68, 0x6F6A, 0x6F6C, 0x6F6E, 0x6F70, 0x6F72,
-    0x6F74, 0x6F76, 0x6F78, 0x6F7A, 0x6F7C, 0x6F7E, 0x6F80, 0x6F82,
-    0x6F84, 0x6F86, 0x6F88, 0x6F8A, 0x6F8C, 0x6F8E, 0x6F90, 0x6F92,
-    0x6F94, 0x6F96, 0x6F98, 0x6F9A, 0x6F9C, 0x6F9E, 0x6FA0, 0x6FA2,
-    0x6FA4, 0x6FA6, 0x6FA8, 0x6FAA, 0x6FAC, 0x6FAE, 0x6FB0, 0x6FB2,
-    0x6FB4, 0x6FB6, 0x17B4, 0x37DC, 0x0BDB, 0x1BEF, 0x05EE, 0x0DF8,
-    0x02F8, 0x06FD, 0x017D, 0x037F, 0x00BF, 0x0040, 0x00C0, 0x0021,
-    0x0061, 0x0011, 0x0031, 0x0009, 0x0019, 0x0006, 0x000E, 0x0004,
-    0x0000, 0x0005, 0x000F, 0x0007, 0x001A, 0x000A, 0x0036, 0x0016,
-    0x006E, 0x002E, 0x00C1, 0x0041, 0x01BC, 0x00BC, 0x037A, 0x017A,
-    0x02F9, 0x0DF9, 0x05EF, 0x05EC, 0x1BD8, 0x37DD, 0x17B5, 0x6FB7,
-    0x6FB5, 0x6FB3, 0x6FB1, 0x6FAF, 0x6FAD, 0x6FAB, 0x6FA9, 0x6FA7,
-    0x6FA5, 0x6FA3, 0x6FA1, 0x6F9F, 0x6F9D, 0x6F9B, 0x6F99, 0x6F97,
-    0x6F95, 0x6F93, 0x6F91, 0x6F8F, 0x6F8D, 0x6F8B, 0x6F89, 0x6F87,
-    0x6F85, 0x6F83, 0x6F81, 0x6F7F, 0x6F7D, 0x6F7B, 0x6F79, 0x6F77,
-    0x6F75, 0x6F73, 0x6F71, 0x6F6F, 0x6F6D, 0x6F6B, 0x6F69, 0x6F67,
-    0x6F65,
-  },
-  {
-    0xDF54, 0xDF56, 0xDFC8, 0xDFCA, 0xDFCC, 0xDFCE, 0xDFD0, 0xDFD2,
-    0xDFD4, 0xDFD6, 0xDFD8, 0xDFDA, 0xDFDC, 0xDFDE, 0xDFE0, 0xDFE2,
-    0x0FE8, 0x2FEA, 0x6FA8, 0x6FF6, 0x07F5, 0x07F7, 0x37D2, 0x37F9,
-    0x03F8, 0x0BF8, 0x0BFB, 0x1BEB, 0x01FA, 0x05FA, 0x09FA, 0x0DFA,
-    0x0DFF, 0x00FF, 0x02FF, 0x06FB, 0x007C, 0x017C, 0x027C, 0x027F,
-    0x003C, 0x00BC, 0x013C, 0x01BC, 0x001C, 0x005C, 0x009C, 0x00DC,
-    0x000C, 0x002C, 0x004C, 0x006C, 0x0004, 0x0014, 0x0024, 0x0034,
-    0x0000, 0x0008, 0x0010, 0x0018, 0x001E, 0x0002, 0x0006, 0x000A,
-    0x000E, 0x000B, 0x0007, 0x0003, 0x001F, 0x0019, 0x0011, 0x0009,
-    0x0001, 0x0035, 0x0025, 0x0015, 0x0005, 0x006D, 0x004D, 0x002D,
-    0x000D, 0x00DD, 0x009D, 0x005D, 0x001D, 0x01BD, 0x013D, 0x00BD,
-    0x003D, 0x037C, 0x027D, 0x017D, 0x007D, 0x06FC, 0x04FC, 0x02FC,
-    0x00FC, 0x0DFB, 0x09FB, 0x05FB, 0x01FB, 0x1BF8, 0x1BE8, 0x0BF9,
-    0x03F9, 0x37FA, 0x37D3, 0x17F4, 0x07F6, 0x6FF7, 0x6FA9, 0x2FEB,
-    0x0FE9, 0xDFE3, 0xDFE1, 0xDFDF, 0xDFDD, 0xDFDB, 0xDFD9, 0xDFD7,
-    0xDFD5, 0xDFD3, 0xDFD1, 0xDFCF, 0xDFCD, 0xDFCB, 0xDFC9, 0xDF57,
-    0xDF55,
-  }
-};
-
-static const uint8_t scales_bits[SCALES_COUNT][129] = {
-  {
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    13, 13, 13, 13, 13, 13, 13, 13,
-    13, 13, 12, 11, 11, 10,  9,  8,
-     8,  7,  6,  6,  5,  4,  4,  3,
-     2,  3,  3,  4,  5,  5,  6,  7,
-     8,  8,  9, 10, 11, 11, 12, 13,
-    13, 13, 13, 13, 13, 13, 13, 13,
-    13, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 14, 14, 14,
-    14,
-  },
-  {
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    14, 14, 13, 12, 11, 10,  8,  7,
-     6,  6,  5,  5,  4,  4,  4,  3,
-     3,  3,  4,  4,  4,  4,  5,  6,
-     6,  7,  8,  9, 11, 12, 13, 14,
-    14, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15,
-  },
-  {
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 14, 14, 14, 13, 13, 12, 12,
-    12, 11, 11, 11, 10, 10,  9,  9,
-     9,  8,  8,  8,  7,  7,  7,  6,
-     6,  6,  5,  5,  5,  4,  4,  3,
-     3,  3,  4,  4,  5,  5,  5,  6,
-     6,  6,  7,  7,  7,  8,  8,  8,
-     9,  9,  9, 10, 10, 10, 11, 11,
-    12, 12, 12, 13, 13, 13, 14, 14,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15,
-  },
-  {
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 14, 14, 13, 13, 12, 12,
-    11, 11, 10, 10,  9,  8,  8,  7,
-     7,  6,  6,  5,  5,  4,  4,  3,
-     2,  3,  4,  4,  5,  5,  6,  6,
-     7,  7,  8,  8,  9,  9, 10, 10,
-    11, 12, 12, 12, 13, 14, 14, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15, 15,
-    15,
-  },
-  {
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    15, 15, 15, 15, 14, 14, 14, 14,
-    13, 13, 13, 13, 12, 12, 12, 12,
-    12, 11, 11, 11, 10, 10, 10, 10,
-     9,  9,  9,  9,  8,  8,  8,  8,
-     7,  7,  7,  7,  6,  6,  6,  6,
-     5,  5,  5,  5,  5,  4,  4,  4,
-     4,  4,  4,  4,  5,  5,  5,  5,
-     5,  6,  6,  6,  6,  7,  7,  7,
-     7,  8,  8,  8,  8,  9,  9,  9,
-     9, 10, 10, 10, 10, 11, 11, 11,
-    11, 12, 12, 12, 12, 13, 13, 13,
-    13, 14, 14, 14, 14, 15, 15, 15,
-    15, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16,
-  }
-};
-
-static const uint16_t bitalloc_3_codes[3] =
-{
-    0x0003, 0x0000, 0x0002,
-};
-static const uint8_t bitalloc_3_bits[3] =
-{
-     2,  1,  2,
-};
-
-static const uint16_t bitalloc_5_codes_a[5] =
-{
-    0x000F, 0x0006, 0x0000, 0x0002, 0x000E,
-};
-static const uint16_t bitalloc_5_codes_b[5] =
-{
-    0x0007, 0x0001, 0x0002, 0x0000, 0x0006,
-};
-static const uint16_t bitalloc_5_codes_c[5] =
-{
-    0x0007, 0x0005, 0x0000, 0x0004, 0x0006,
-};
-static const uint8_t bitalloc_5_bits_a[5] =
-{
-     4,  3,  1,  2,  4,
-};
-static const uint8_t bitalloc_5_bits_b[5] =
-{
-     3,  2,  2,  2,  3,
-};
-static const uint8_t bitalloc_5_bits_c[5] =
-{
-     3,  3,  1,  3,  3,
-};
-
-static const uint16_t bitalloc_7_codes_a[7] =
-{
-    0x001E, 0x000E, 0x0005, 0x0000, 0x0006, 0x0004, 0x001F,
-};
-static const uint16_t bitalloc_7_codes_b[7] =
-{
-    0x0014, 0x000B, 0x0000, 0x0003, 0x0001, 0x0004, 0x0015,
-};
-static const uint16_t bitalloc_7_codes_c[7] =
-{
-    0x0000, 0x0002, 0x0001, 0x0003, 0x0002, 0x0003, 0x0001,
-};
-static const uint8_t bitalloc_7_bits_a[7] =
-{
-     5,  4,  3,  1,  3,  3,  5,
-};
-static const uint8_t bitalloc_7_bits_b[7] =
-{
-     5,  4,  2,  2,  2,  3,  5,
-};
-static const uint8_t bitalloc_7_bits_c[7] =
-{
-     4,  4,  2,  2,  2,  4,  4,
-};
-
-static const uint16_t bitalloc_9_codes_a[9] =
-{
-    0x0030, 0x0019, 0x0009, 0x0005, 0x0000, 0x0007, 0x000D, 0x0008,
-    0x0031,
-};
-static const uint16_t bitalloc_9_codes_b[9] =
-{
-    0x0018, 0x001A, 0x0002, 0x0007, 0x0002, 0x0000, 0x0003, 0x001B,
-    0x0019,
-};
-static const uint16_t bitalloc_9_codes_c[9] =
-{
-    0x001C, 0x000F, 0x0002, 0x0007, 0x0002, 0x0000, 0x0006, 0x0006,
-    0x001D,
-};
-static const uint8_t bitalloc_9_bits_a[9] =
-{
-     6,  5,  4,  3,  1,  3,  4,  4,  6,
-};
-static const uint8_t bitalloc_9_bits_b[9] =
-{
-     5,  5,  3,  3,  2,  2,  3,  5,  5,
-};
-static const uint8_t bitalloc_9_bits_c[9] =
-{
-     6,  5,  3,  3,  2,  2,  3,  4,  6,
-};
-
-static const uint16_t bitalloc_13_codes_a[13] =
-{
-    0x0070, 0x002E, 0x0039, 0x001D, 0x000C, 0x000F, 0x0000, 0x0004,
-    0x000D, 0x000A, 0x0016, 0x002F, 0x0071,
-};
-static const uint16_t bitalloc_13_codes_b[13] =
-{
-    0x0038, 0x0010, 0x001D, 0x0007, 0x000F, 0x0005, 0x0000, 0x0006,
-    0x0002, 0x0009, 0x0006, 0x0011, 0x0039,
-};
-static const uint16_t bitalloc_13_codes_c[13] =
-{
-    0x0004, 0x001A, 0x0003, 0x000E, 0x0000, 0x0003, 0x0005, 0x0004,
-    0x0002, 0x000F, 0x000C, 0x001B, 0x0005,
-};
-static const uint8_t bitalloc_13_bits_a[13] =
-{
-     7,  6,  6,  5,  4,  4,  1,  3,  4,  4,  5,  6,  7,
-};
-static const uint8_t bitalloc_13_bits_b[13] =
-{
-     6,  5,  5,  4,  4,  3,  2,  3,  3,  4,  4,  5,  6,
-};
-static const uint8_t bitalloc_13_bits_c[13] =
-{
-     5,  5,  4,  4,  3,  3,  3,  3,  3,  4,  4,  5,  5,
-};
-
-static const uint16_t bitalloc_17_codes_a[17] =
-{
-    0x0154, 0x00AB, 0x002B, 0x000B, 0x0003, 0x000A, 0x0001, 0x0006,
-    0x0001, 0x0007, 0x0004, 0x000B, 0x0000, 0x0004, 0x0014, 0x0054,
-    0x0155,
-};
-static const uint16_t bitalloc_17_codes_b[17] =
-{
-    0x007C, 0x003F, 0x0019, 0x000D, 0x001C, 0x0008, 0x000F, 0x0005,
-    0x0000, 0x0006, 0x0002, 0x0009, 0x001D, 0x000E, 0x001E, 0x0018,
-    0x007D,
-};
-static const uint16_t bitalloc_17_codes_c[17] =
-{
-    0x002C, 0x0017, 0x0005, 0x001C, 0x0003, 0x000A, 0x000F, 0x0003,
-    0x0006, 0x0004, 0x0000, 0x000B, 0x0004, 0x001D, 0x000A, 0x0004,
-    0x002D,
-};
-static const uint16_t bitalloc_17_codes_d[17] =
-{
-    0x0100, 0x0102, 0x0082, 0x0042, 0x0022, 0x0012, 0x000A, 0x0006,
-    0x0000, 0x0007, 0x000B, 0x0013, 0x0023, 0x0043, 0x0083, 0x0103,
-    0x0101,
-};
-static const uint16_t bitalloc_17_codes_e[17] =
-{
-    0x00E8, 0x00F6, 0x0075, 0x0034, 0x003B, 0x001B, 0x001F, 0x0004,
-    0x0000, 0x0005, 0x000C, 0x001C, 0x003C, 0x0035, 0x007A, 0x00F7,
-    0x00E9,
-};
-static const uint16_t bitalloc_17_codes_f[17] =
-{
-    0x0004, 0x0003, 0x001E, 0x0001, 0x0001, 0x000E, 0x0001, 0x0004,
-    0x0006, 0x0005, 0x0002, 0x000F, 0x0006, 0x000E, 0x001F, 0x0000,
-    0x0005,
-};
-static const uint16_t bitalloc_17_codes_g[17] =
-{
-    0x0060, 0x007E, 0x0031, 0x0019, 0x000D, 0x0004, 0x0000, 0x0006,
-    0x0002, 0x0007, 0x0001, 0x0005, 0x000E, 0x001E, 0x003E, 0x007F,
-    0x0061,
-};
-static const uint8_t bitalloc_17_bits_a[17] =
-{
-    12, 11,  9,  7,  5,  4,  3,  3,  2,  3,  3,  4,  4,  6,  8, 10,
-    12,
-};
-static const uint8_t bitalloc_17_bits_b[17] =
-{
-     8,  7,  6,  5,  5,  4,  4,  3,  2,  3,  3,  4,  5,  5,  6,  6,
-     8,
-};
-static const uint8_t bitalloc_17_bits_c[17] =
-{
-     7,  6,  5,  5,  4,  4,  4,  3,  3,  3,  3,  4,  4,  5,  5,  5,
-     7,
-};
-static const uint8_t bitalloc_17_bits_d[17] =
-{
-     9,  9,  8,  7,  6,  5,  4,  3,  1,  3,  4,  5,  6,  7,  8,  9,
-     9,
-};
-static const uint8_t bitalloc_17_bits_e[17] =
-{
-     8,  8,  7,  6,  6,  5,  5,  3,  1,  3,  4,  5,  6,  6,  7,  8,
-     8,
-};
-static const uint8_t bitalloc_17_bits_f[17] =
-{
-     8,  7,  6,  5,  4,  4,  3,  3,  3,  3,  3,  4,  4,  5,  6,  6,
-     8,
-};
-static const uint8_t bitalloc_17_bits_g[17] =
-{
-     8,  8,  7,  6,  5,  4,  3,  3,  2,  3,  3,  4,  5,  6,  7,  8,
-     8,
-};
-
-static const uint16_t bitalloc_25_codes_a[25] =
-{
-    0x2854, 0x142B, 0x050B, 0x0143, 0x00A2, 0x0052, 0x002E, 0x0015,
-    0x0004, 0x000E, 0x0000, 0x0003, 0x0006, 0x0004, 0x0001, 0x000F,
-    0x0005, 0x0016, 0x002F, 0x0053, 0x00A3, 0x00A0, 0x0284, 0x0A14,
-    0x2855,
-};
-static const uint16_t bitalloc_25_codes_b[25] =
-{
-    0x001C, 0x000F, 0x0005, 0x0000, 0x0030, 0x0036, 0x000E, 0x0019,
-    0x0001, 0x0008, 0x000E, 0x0001, 0x0005, 0x0002, 0x000F, 0x0009,
-    0x0006, 0x001A, 0x000F, 0x0037, 0x0031, 0x0001, 0x0006, 0x0004,
-    0x001D,
-};
-static const uint16_t bitalloc_25_codes_c[25] =
-{
-    0x004C, 0x0027, 0x006D, 0x0028, 0x0037, 0x000E, 0x0015, 0x0000,
-    0x0005, 0x0008, 0x000B, 0x000E, 0x0001, 0x000F, 0x000C, 0x0009,
-    0x0006, 0x0001, 0x001A, 0x000F, 0x0008, 0x0029, 0x0012, 0x006C,
-    0x004D,
-};
-static const uint16_t bitalloc_25_codes_d[25] =
-{
-    0x0780, 0x0782, 0x03C2, 0x01E2, 0x00FE, 0x0079, 0x003D, 0x001C,
-    0x000C, 0x0004, 0x0000, 0x0006, 0x0002, 0x0007, 0x0001, 0x0005,
-    0x000D, 0x001D, 0x003E, 0x007E, 0x00FF, 0x01E3, 0x03C3, 0x0783,
-    0x0781,
-};
-static const uint16_t bitalloc_25_codes_e[25] =
-{
-    0x003C, 0x0092, 0x0018, 0x001F, 0x004E, 0x000D, 0x0025, 0x0004,
-    0x0010, 0x0000, 0x000A, 0x0002, 0x0003, 0x0003, 0x000B, 0x0001,
-    0x0011, 0x0005, 0x0026, 0x000E, 0x004F, 0x0048, 0x0019, 0x0093,
-    0x003D,
-};
-static const uint16_t bitalloc_25_codes_f[25] =
-{
-    0x0324, 0x0193, 0x00CE, 0x0065, 0x0024, 0x000C, 0x0013, 0x0004,
-    0x0007, 0x000A, 0x000D, 0x000F, 0x0001, 0x0000, 0x000E, 0x000B,
-    0x0008, 0x0005, 0x0018, 0x000D, 0x0025, 0x0066, 0x00CF, 0x00C8,
-    0x0325,
-};
-static const uint16_t bitalloc_25_codes_g[25] =
-{
-    0x03A8, 0x03AE, 0x01D5, 0x0094, 0x0014, 0x004B, 0x000B, 0x003B,
-    0x0013, 0x0003, 0x000F, 0x0005, 0x0001, 0x0006, 0x0000, 0x0008,
-    0x001C, 0x0004, 0x0024, 0x0074, 0x0015, 0x0095, 0x01D6, 0x03AF,
-    0x03A9,
-};
-static const uint8_t bitalloc_25_bits_a[25] =
-{
-    14, 13, 11,  9,  8,  7,  6,  5,  4,  4,  3,  3,  3,  3,  3,  4,
-     4,  5,  6,  7,  8,  8, 10, 12, 14,
-};
-static const uint8_t bitalloc_25_bits_b[25] =
-{
-     9,  8,  7,  6,  6,  6,  5,  5,  4,  4,  4,  3,  3,  3,  4,  4,
-     4,  5,  5,  6,  6,  6,  7,  7,  9,
-};
-static const uint8_t bitalloc_25_bits_c[25] =
-{
-     8,  7,  7,  6,  6,  5,  5,  4,  4,  4,  4,  4,  3,  4,  4,  4,
-     4,  4,  5,  5,  5,  6,  6,  7,  8,
-};
-static const uint8_t bitalloc_25_bits_d[25] =
-{
-    12, 12, 11, 10,  9,  8,  7,  6,  5,  4,  3,  3,  2,  3,  3,  4,
-     5,  6,  7,  8,  9, 10, 11, 12, 12,
-};
-static const uint8_t bitalloc_25_bits_e[25] =
-{
-     8,  8,  7,  7,  7,  6,  6,  5,  5,  4,  4,  3,  2,  3,  4,  4,
-     5,  5,  6,  6,  7,  7,  7,  8,  8,
-};
-static const uint8_t bitalloc_25_bits_f[25] =
-{
-    10,  9,  8,  7,  6,  5,  5,  4,  4,  4,  4,  4,  3,  3,  4,  4,
-     4,  4,  5,  5,  6,  7,  8,  8, 10,
-};
-static const uint8_t bitalloc_25_bits_g[25] =
-{
-    10, 10,  9,  8,  7,  7,  6,  6,  5,  4,  4,  3,  2,  3,  3,  4,
-     5,  5,  6,  7,  7,  8,  9, 10, 10,
-};
-
-static const uint16_t bitalloc_33_codes_a[33] =
-{
-    0x1580, 0x1582, 0x0AC2, 0x0562, 0x02B2, 0x015E, 0x00AD, 0x0054,
-    0x001C, 0x003C, 0x000F, 0x001F, 0x0008, 0x000B, 0x000D, 0x0000,
-    0x0002, 0x0001, 0x000E, 0x000C, 0x0009, 0x0006, 0x0014, 0x003D,
-    0x001D, 0x0055, 0x00AE, 0x015F, 0x02B3, 0x0563, 0x0AC3, 0x1583,
-    0x1581,
-};
-static const uint16_t bitalloc_33_codes_b[33] =
-{
-    0x030C, 0x0187, 0x006D, 0x0028, 0x0037, 0x0066, 0x0015, 0x0031,
-    0x0000, 0x000B, 0x0012, 0x001A, 0x0001, 0x0007, 0x000A, 0x000E,
-    0x0001, 0x000F, 0x000B, 0x0008, 0x0004, 0x001B, 0x0013, 0x000C,
-    0x0001, 0x0032, 0x001A, 0x0067, 0x0060, 0x0029, 0x00C2, 0x006C,
-    0x030D,
-};
-static const uint16_t bitalloc_33_codes_c[33] =
-{
-    0x00CC, 0x0067, 0x0005, 0x0070, 0x0003, 0x001A, 0x0039, 0x003F,
-    0x000A, 0x0012, 0x0018, 0x001D, 0x0001, 0x0003, 0x0007, 0x000A,
-    0x000D, 0x000B, 0x0008, 0x0004, 0x0002, 0x001E, 0x0019, 0x0013,
-    0x000B, 0x0000, 0x003E, 0x001B, 0x0018, 0x0071, 0x0032, 0x0004,
-    0x00CD,
-};
-static const uint16_t bitalloc_33_codes_d[33] =
-{
-    0x3AF8, 0x3AFA, 0x1D7E, 0x0EBC, 0x075C, 0x03AC, 0x01D4, 0x0094,
-    0x0014, 0x004B, 0x000B, 0x003B, 0x0013, 0x0003, 0x000F, 0x0005,
-    0x0001, 0x0006, 0x0000, 0x0008, 0x001C, 0x0004, 0x0024, 0x0074,
-    0x0015, 0x0095, 0x01D5, 0x03AD, 0x075D, 0x0EBD, 0x1D7F, 0x3AFB,
-    0x3AF9,
-};
-static const uint16_t bitalloc_33_codes_e[33] =
-{
-    0x01C8, 0x01E6, 0x0064, 0x00E2, 0x00E5, 0x0030, 0x0033, 0x0073,
-    0x007A, 0x001A, 0x003A, 0x0002, 0x001A, 0x001F, 0x0007, 0x0001,
-    0x0002, 0x0002, 0x000C, 0x0000, 0x001B, 0x0003, 0x003B, 0x001B,
-    0x007B, 0x0078, 0x0070, 0x0031, 0x00F2, 0x00E3, 0x0065, 0x01E7,
-    0x01C9,
-};
-static const uint16_t bitalloc_33_codes_f[33] =
-{
-    0x0724, 0x0393, 0x01CE, 0x00E5, 0x002C, 0x0008, 0x0017, 0x003E,
-    0x0005, 0x0014, 0x001D, 0x0000, 0x0003, 0x0006, 0x0008, 0x000B,
-    0x000D, 0x000C, 0x0009, 0x0007, 0x0004, 0x0001, 0x001E, 0x0015,
-    0x000A, 0x003F, 0x0038, 0x0009, 0x002D, 0x00E6, 0x01CF, 0x01C8,
-    0x0725,
-};
-static const uint16_t bitalloc_33_codes_g[33] =
-{
-    0x0284, 0x0042, 0x0140, 0x0143, 0x003E, 0x00BE, 0x0011, 0x0051,
-    0x0009, 0x0029, 0x0005, 0x0015, 0x0000, 0x0008, 0x000E, 0x0002,
-    0x0006, 0x0003, 0x000F, 0x0009, 0x0001, 0x0016, 0x0006, 0x002E,
-    0x000E, 0x005E, 0x001E, 0x00BF, 0x003F, 0x0020, 0x0141, 0x0043,
-    0x0285,
-};
-static const uint8_t bitalloc_33_bits_a[33] =
-{
-    13, 13, 12, 11, 10,  9,  8,  7,  6,  6,  5,  5,  4,  4,  4,  3,
-     3,  3,  4,  4,  4,  4,  5,  6,  6,  7,  8,  9, 10, 11, 12, 13,
-    13,
-};
-static const uint8_t bitalloc_33_bits_b[33] =
-{
-    10,  9,  8,  7,  7,  7,  6,  6,  5,  5,  5,  5,  4,  4,  4,  4,
-     3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  7,  7,  7,  8,  8,
-    10,
-};
-static const uint8_t bitalloc_33_bits_c[33] =
-{
-     9,  8,  7,  7,  6,  6,  6,  6,  5,  5,  5,  5,  4,  4,  4,  4,
-     4,  4,  4,  4,  4,  5,  5,  5,  5,  5,  6,  6,  6,  7,  7,  7,
-     9,
-};
-static const uint8_t bitalloc_33_bits_d[33] =
-{
-    14, 14, 13, 12, 11, 10,  9,  8,  7,  7,  6,  6,  5,  4,  4,  3,
-     2,  3,  3,  4,  5,  5,  6,  7,  7,  8,  9, 10, 11, 12, 13, 14,
-    14,
-};
-static const uint8_t bitalloc_33_bits_e[33] =
-{
-     9,  9,  8,  8,  8,  7,  7,  7,  7,  6,  6,  5,  5,  5,  4,  3,
-     2,  3,  4,  4,  5,  5,  6,  6,  7,  7,  7,  7,  8,  8,  8,  9,
-     9,
-};
-static const uint8_t bitalloc_33_bits_f[33] =
-{
-    11, 10,  9,  8,  7,  6,  6,  6,  5,  5,  5,  4,  4,  4,  4,  4,
-     4,  4,  4,  4,  4,  4,  5,  5,  5,  6,  6,  6,  7,  8,  9,  9,
-    11,
-};
-static const uint8_t bitalloc_33_bits_g[33] =
-{
-    10,  9,  9,  9,  8,  8,  7,  7,  6,  6,  5,  5,  4,  4,  4,  3,
-     3,  3,  4,  4,  4,  5,  5,  6,  6,  7,  7,  8,  8,  8,  9,  9,
-    10,
-};
-
-static const uint16_t bitalloc_65_codes_a[65] =
-{
-    0x9E5C, 0x9E5E, 0x4F2C, 0x2794, 0x13C4, 0x1E44, 0x09E3, 0x0F23,
-    0x04F3, 0x0792, 0x027E, 0x03CE, 0x013D, 0x01E5, 0x009C, 0x00CC,
-    0x0040, 0x0058, 0x0067, 0x001E, 0x0021, 0x002D, 0x003D, 0x0007,
-    0x0011, 0x0014, 0x0017, 0x001A, 0x001C, 0x001F, 0x0001, 0x0004,
-    0x0006, 0x0005, 0x0002, 0x0000, 0x001D, 0x001B, 0x0018, 0x0015,
-    0x0012, 0x000E, 0x0006, 0x0032, 0x0026, 0x001F, 0x0078, 0x0059,
-    0x0041, 0x00CD, 0x009D, 0x01E6, 0x013E, 0x03CF, 0x027F, 0x0793,
-    0x0790, 0x04F0, 0x09E4, 0x1E45, 0x13C5, 0x2795, 0x4F2D, 0x9E5F,
-    0x9E5D,
-};
-static const uint16_t bitalloc_65_codes_b[65] =
-{
-    0x0A8C, 0x0547, 0x01B5, 0x0008, 0x00DB, 0x0152, 0x0005, 0x000B,
-    0x008E, 0x00AE, 0x00E4, 0x0003, 0x0037, 0x0039, 0x0055, 0x006C,
-    0x0073, 0x0003, 0x0015, 0x001D, 0x0028, 0x0030, 0x0037, 0x003E,
-    0x0006, 0x000B, 0x000F, 0x0012, 0x0016, 0x0019, 0x001D, 0x0001,
-    0x0004, 0x0002, 0x001E, 0x001A, 0x0017, 0x0013, 0x0010, 0x000C,
-    0x0007, 0x003F, 0x0038, 0x0031, 0x0029, 0x0022, 0x001A, 0x0014,
-    0x0000, 0x006D, 0x0056, 0x0046, 0x0038, 0x0004, 0x00E5, 0x00AF,
-    0x008F, 0x006C, 0x000A, 0x0153, 0x0150, 0x0009, 0x02A2, 0x01B4,
-    0x0A8D,
-};
-static const uint16_t bitalloc_65_codes_c[65] =
-{
-    0x045C, 0x022F, 0x03F5, 0x01BC, 0x01FB, 0x0059, 0x00D0, 0x00DF,
-    0x000A, 0x002D, 0x002F, 0x0052, 0x0069, 0x0078, 0x007F, 0x000A,
-    0x0010, 0x001C, 0x0023, 0x002A, 0x0035, 0x003A, 0x003D, 0x0000,
-    0x0003, 0x0006, 0x0009, 0x000C, 0x000F, 0x0012, 0x0016, 0x0018,
-    0x001C, 0x0019, 0x0017, 0x0013, 0x0010, 0x000D, 0x000A, 0x0007,
-    0x0004, 0x0001, 0x003E, 0x003B, 0x0036, 0x002B, 0x0028, 0x001D,
-    0x0011, 0x000B, 0x0004, 0x0079, 0x006E, 0x0053, 0x0044, 0x002E,
-    0x000B, 0x00FC, 0x00D1, 0x008A, 0x0058, 0x01BD, 0x0116, 0x03F4,
-    0x045D,
-};
-static const uint16_t bitalloc_65_codes_d[65] =
-{
-    0x70B0, 0x70B2, 0x70B4, 0x2852, 0x385B, 0x142E, 0x1C2E, 0x0A15,
-    0x0E14, 0x0214, 0x0704, 0x0104, 0x010B, 0x0383, 0x0083, 0x0143,
-    0x01C3, 0x0043, 0x00A2, 0x00E2, 0x0022, 0x0052, 0x0072, 0x0012,
-    0x002A, 0x003A, 0x000A, 0x0016, 0x001E, 0x0006, 0x000C, 0x0000,
-    0x0004, 0x0001, 0x000D, 0x0007, 0x001F, 0x0017, 0x000B, 0x003B,
-    0x002B, 0x0013, 0x0073, 0x0053, 0x0023, 0x00E3, 0x00A3, 0x00A0,
-    0x0040, 0x01C0, 0x0084, 0x0384, 0x0284, 0x0105, 0x0705, 0x0215,
-    0x0E15, 0x0A16, 0x1C2F, 0x142F, 0x1428, 0x2853, 0x70B5, 0x70B3,
-    0x70B1,
-};
-static const uint16_t bitalloc_65_codes_e[65] =
-{
-    0x032C, 0x0332, 0x0378, 0x037E, 0x008C, 0x014A, 0x0188, 0x0197,
-    0x019E, 0x01BD, 0x0044, 0x0047, 0x00AA, 0x00C5, 0x00CD, 0x00DC,
-    0x001C, 0x002C, 0x0053, 0x0063, 0x0068, 0x0008, 0x000F, 0x0017,
-    0x002B, 0x0035, 0x0005, 0x0009, 0x0016, 0x001C, 0x0006, 0x000F,
-    0x0004, 0x0000, 0x0007, 0x001D, 0x0017, 0x000A, 0x0006, 0x0036,
-    0x0030, 0x0028, 0x0010, 0x0009, 0x0069, 0x0064, 0x0054, 0x002D,
-    0x001D, 0x00DD, 0x00CE, 0x00CA, 0x00AB, 0x00A4, 0x0045, 0x01BE,
-    0x019F, 0x0198, 0x0189, 0x014B, 0x008D, 0x037F, 0x0379, 0x0333,
-    0x032D,
-};
-static const uint16_t bitalloc_65_codes_f[65] =
-{
-    0x0FE0, 0x0FE2, 0x0FE8, 0x0FEA, 0x0FEC, 0x0FEE, 0x0FF0, 0x0FF2,
-    0x0FF4, 0x2FF2, 0x07F2, 0x07FB, 0x03F6, 0x0BFA, 0x0BFD, 0x01FF,
-    0x05FF, 0x02FC, 0x007C, 0x017C, 0x003C, 0x00BC, 0x001C, 0x005C,
-    0x000C, 0x002C, 0x0004, 0x0014, 0x0000, 0x0008, 0x000E, 0x0002,
-    0x0006, 0x0003, 0x000F, 0x0009, 0x0001, 0x0015, 0x0005, 0x002D,
-    0x000D, 0x005D, 0x001D, 0x00BD, 0x003D, 0x017D, 0x007D, 0x02FD,
-    0x00FC, 0x05FC, 0x01FA, 0x0BFB, 0x03F7, 0x17F8, 0x07F3, 0x2FF3,
-    0x0FF5, 0x0FF3, 0x0FF1, 0x0FEF, 0x0FED, 0x0FEB, 0x0FE9, 0x0FE3,
-    0x0FE1,
-};
-static const uint16_t bitalloc_65_codes_g[65] =
-{
-    0x010C, 0x038A, 0x0608, 0x0786, 0x0084, 0x0087, 0x0302, 0x0305,
-    0x0040, 0x00E0, 0x00E3, 0x0183, 0x001E, 0x005E, 0x009E, 0x00DE,
-    0x00F1, 0x0011, 0x0039, 0x0061, 0x0079, 0x0009, 0x001D, 0x0031,
-    0x003D, 0x0005, 0x000F, 0x0019, 0x001F, 0x0003, 0x0006, 0x000A,
-    0x000E, 0x000B, 0x0008, 0x0004, 0x0000, 0x001A, 0x0012, 0x000A,
-    0x0002, 0x0036, 0x0026, 0x0016, 0x0006, 0x006E, 0x004E, 0x002E,
-    0x000E, 0x00DF, 0x009F, 0x005F, 0x001F, 0x01E0, 0x0180, 0x00E1,
-    0x0041, 0x03C2, 0x0303, 0x01C4, 0x0085, 0x0787, 0x0609, 0x038B,
-    0x010D,
-};
-static const uint8_t bitalloc_65_bits_a[65] =
-{
-    16, 16, 15, 14, 13, 13, 12, 12, 11, 11, 10, 10,  9,  9,  8,  8,
-     7,  7,  7,  6,  6,  6,  6,  5,  5,  5,  5,  5,  5,  5,  4,  4,
-     4,  4,  4,  4,  5,  5,  5,  5,  5,  5,  5,  6,  6,  6,  7,  7,
-     7,  8,  8,  9,  9, 10, 10, 11, 11, 11, 12, 13, 13, 14, 15, 16,
-    16,
-};
-static const uint8_t bitalloc_65_bits_b[65] =
-{
-    12, 11, 10,  9,  9,  9,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,
-     7,  6,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  5,  5,  4,
-     4,  4,  5,  5,  5,  5,  5,  5,  5,  6,  6,  6,  6,  6,  6,  6,
-     6,  7,  7,  7,  7,  7,  8,  8,  8,  8,  8,  9,  9,  9, 10, 10,
-    12,
-};
-static const uint8_t bitalloc_65_bits_c[65] =
-{
-    11, 10, 10,  9,  9,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,  6,
-     6,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  5,  5,  5,  5,
-     5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  6,  6,  6,  6,  6,  6,
-     6,  6,  6,  7,  7,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9, 10,
-    11,
-};
-static const uint8_t bitalloc_65_bits_d[65] =
-{
-    15, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 10,  9,  9,
-     9,  8,  8,  8,  7,  7,  7,  6,  6,  6,  5,  5,  5,  4,  4,  3,
-     3,  3,  4,  4,  5,  5,  5,  6,  6,  6,  7,  7,  7,  8,  8,  8,
-     8,  9,  9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 15, 15,
-    15,
-};
-static const uint8_t bitalloc_65_bits_e[65] =
-{
-    10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,
-     7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  5,  5,  5,  5,  4,  4,
-     3,  3,  4,  5,  5,  5,  5,  6,  6,  6,  6,  6,  7,  7,  7,  7,
-     7,  8,  8,  8,  8,  8,  8,  9,  9,  9,  9,  9,  9, 10, 10, 10,
-    10,
-};
-static const uint8_t bitalloc_65_bits_f[65] =
-{
-    14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 12, 12, 12, 11,
-    11, 10,  9,  9,  8,  8,  7,  7,  6,  6,  5,  5,  4,  4,  4,  3,
-     3,  3,  4,  4,  4,  5,  5,  6,  6,  7,  7,  8,  8,  9,  9, 10,
-    10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-    14,
-};
-static const uint8_t bitalloc_65_bits_g[65] =
-{
-    11, 11, 11, 11, 10, 10, 10, 10,  9,  9,  9,  9,  8,  8,  8,  8,
-     8,  7,  7,  7,  7,  6,  6,  6,  6,  5,  5,  5,  5,  4,  4,  4,
-     4,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,  6,  7,  7,  7,
-     7,  8,  8,  8,  8,  9,  9,  9,  9, 10, 10, 10, 10, 11, 11, 11,
-    11,
-};
-
-static const uint16_t bitalloc_129_codes_a[129] =
-{
-    0x0660, 0x0666, 0x06EC, 0x0722, 0x0760, 0x076E, 0x004C, 0x004E,
-    0x00F4, 0x010A, 0x0148, 0x0156, 0x01D4, 0x01F2, 0x0331, 0x0370,
-    0x0377, 0x0396, 0x03B1, 0x0024, 0x0064, 0x007B, 0x008A, 0x00A5,
-    0x00D4, 0x00EB, 0x00FA, 0x019A, 0x01B9, 0x01C9, 0x01D9, 0x0010,
-    0x0030, 0x0033, 0x0043, 0x0053, 0x006B, 0x007A, 0x00CA, 0x00D2,
-    0x00DE, 0x00E6, 0x00F6, 0x000E, 0x001F, 0x0023, 0x002B, 0x003B,
-    0x003F, 0x0067, 0x0070, 0x0077, 0x0005, 0x000D, 0x0012, 0x001B,
-    0x002C, 0x0035, 0x003A, 0x0004, 0x000B, 0x0017, 0x001F, 0x0009,
-    0x0008, 0x000A, 0x0000, 0x0018, 0x000C, 0x0005, 0x003C, 0x0036,
-    0x002D, 0x001C, 0x0013, 0x000E, 0x0006, 0x007A, 0x0071, 0x0068,
-    0x0064, 0x003C, 0x0034, 0x0028, 0x0020, 0x000F, 0x00F7, 0x00E7,
-    0x00DF, 0x00D3, 0x00CB, 0x007B, 0x0074, 0x0054, 0x0044, 0x003C,
-    0x0031, 0x0011, 0x01DA, 0x01CA, 0x01BA, 0x019B, 0x00FB, 0x00F8,
-    0x00D5, 0x00AA, 0x008B, 0x0084, 0x0065, 0x0025, 0x03B6, 0x0397,
-    0x0390, 0x0371, 0x0332, 0x01F3, 0x01D5, 0x0157, 0x0149, 0x010B,
-    0x00F5, 0x004F, 0x004D, 0x076F, 0x0761, 0x0723, 0x06ED, 0x0667,
-    0x0661,
-};
-static const uint16_t bitalloc_129_codes_b[129] =
-{
-    0x29DC, 0x14EF, 0x0455, 0x0E9C, 0x022B, 0x0489, 0x0740, 0x074F,
-    0x0172, 0x0245, 0x0247, 0x030A, 0x03A1, 0x001C, 0x008B, 0x00D6,
-    0x010C, 0x0148, 0x014F, 0x0186, 0x01D1, 0x0008, 0x000F, 0x0046,
-    0x005D, 0x0078, 0x0087, 0x0096, 0x00A5, 0x00BC, 0x00D8, 0x00DE,
-    0x00F6, 0x0005, 0x0014, 0x0024, 0x002F, 0x003A, 0x003D, 0x0049,
-    0x0050, 0x0058, 0x005F, 0x0066, 0x006D, 0x0075, 0x007C, 0x0004,
-    0x000B, 0x0013, 0x0018, 0x001B, 0x001F, 0x0022, 0x0026, 0x002A,
-    0x002D, 0x0031, 0x0034, 0x0038, 0x003B, 0x003F, 0x0003, 0x0006,
-    0x000A, 0x0007, 0x0004, 0x0000, 0x003C, 0x0039, 0x0035, 0x0032,
-    0x002E, 0x002B, 0x0027, 0x0023, 0x0020, 0x001C, 0x0019, 0x0016,
-    0x0010, 0x0005, 0x007D, 0x007A, 0x006E, 0x0067, 0x0060, 0x0059,
-    0x0051, 0x004A, 0x0042, 0x003B, 0x0034, 0x0025, 0x0015, 0x0006,
-    0x00F7, 0x00DF, 0x00D9, 0x00BD, 0x00A6, 0x0097, 0x0090, 0x0079,
-    0x006A, 0x0047, 0x0044, 0x0009, 0x01D2, 0x0187, 0x0184, 0x0149,
-    0x010D, 0x00D7, 0x00B8, 0x001D, 0x03A6, 0x030B, 0x029C, 0x0246,
-    0x0173, 0x0114, 0x0741, 0x053A, 0x0488, 0x0E9D, 0x0A76, 0x0454,
-    0x29DD,
-};
-static const uint16_t bitalloc_129_codes_c[129] =
-{
-    0x0E5C, 0x072F, 0x001D, 0x0724, 0x000F, 0x010D, 0x0324, 0x0393,
-    0x03E9, 0x0080, 0x0087, 0x00FA, 0x0164, 0x0193, 0x01DE, 0x01F5,
-    0x0010, 0x002A, 0x0041, 0x0064, 0x0073, 0x008E, 0x00A4, 0x00B3,
-    0x00D6, 0x00E5, 0x00F4, 0x00FB, 0x0002, 0x0009, 0x0013, 0x001E,
-    0x0026, 0x002C, 0x0033, 0x003F, 0x0041, 0x004C, 0x0053, 0x005E,
-    0x0065, 0x0070, 0x0073, 0x0078, 0x007B, 0x007E, 0x0002, 0x0005,
-    0x0007, 0x000B, 0x000D, 0x0011, 0x0014, 0x0017, 0x001A, 0x001D,
-    0x0021, 0x0024, 0x0027, 0x002A, 0x002D, 0x0030, 0x0033, 0x0036,
-    0x003A, 0x0037, 0x0034, 0x0031, 0x002E, 0x002B, 0x0028, 0x0025,
-    0x0022, 0x001E, 0x001B, 0x0018, 0x0015, 0x0012, 0x000E, 0x000C,
-    0x0008, 0x0006, 0x0003, 0x007F, 0x007C, 0x0079, 0x0076, 0x0071,
-    0x006A, 0x005F, 0x0058, 0x004D, 0x0046, 0x0040, 0x0038, 0x002D,
-    0x0027, 0x001F, 0x0014, 0x0012, 0x0003, 0x0000, 0x00F5, 0x00EE,
-    0x00D7, 0x00C8, 0x00A5, 0x008F, 0x007C, 0x0065, 0x0042, 0x002B,
-    0x0011, 0x0002, 0x01DF, 0x01C8, 0x0165, 0x00FB, 0x00E4, 0x0081,
-    0x0006, 0x03E8, 0x0325, 0x01CA, 0x010C, 0x0725, 0x0396, 0x001C,
-    0x0E5D,
-};
-static const uint16_t bitalloc_129_codes_d[129] =
-{
-    0xA598, 0xA59A, 0xA59C, 0xA59E, 0xC598, 0xE586, 0x3ACC, 0x52CA,
-    0x62CD, 0x0D48, 0x1D67, 0x2978, 0x3167, 0x3966, 0x06A5, 0x0EBC,
-    0x14BD, 0x1CB1, 0x0350, 0x0353, 0x075F, 0x0A5F, 0x0C5E, 0x0E5E,
-    0x01AE, 0x03AD, 0x052D, 0x062D, 0x072D, 0x00D5, 0x01D4, 0x0294,
-    0x0314, 0x0394, 0x0014, 0x0094, 0x0114, 0x0174, 0x01B4, 0x01F4,
-    0x000B, 0x004B, 0x008B, 0x00BB, 0x00DB, 0x00FB, 0x001B, 0x003B,
-    0x0053, 0x0063, 0x0073, 0x0003, 0x0013, 0x0023, 0x002F, 0x0037,
-    0x003F, 0x0007, 0x000F, 0x0015, 0x0019, 0x001D, 0x0001, 0x0005,
-    0x0009, 0x0006, 0x0002, 0x001E, 0x001A, 0x0016, 0x0010, 0x0008,
-    0x0000, 0x0038, 0x0030, 0x0028, 0x001C, 0x000C, 0x007C, 0x006C,
-    0x005C, 0x0044, 0x0024, 0x0004, 0x00E4, 0x00C4, 0x00A4, 0x0074,
-    0x0034, 0x01F5, 0x01B5, 0x0175, 0x0115, 0x0095, 0x0015, 0x0395,
-    0x0315, 0x0295, 0x01D5, 0x00D6, 0x072E, 0x062E, 0x052E, 0x03AE,
-    0x01AF, 0x0E5F, 0x0C5F, 0x0C58, 0x0A58, 0x0758, 0x0351, 0x1CB2,
-    0x18B2, 0x0EBD, 0x0EB2, 0x3967, 0x3960, 0x2979, 0x2964, 0x0D49,
-    0x72C2, 0x52CB, 0x3ACD, 0xE587, 0xC599, 0xA59F, 0xA59D, 0xA59B,
-    0xA599,
-};
-static const uint16_t bitalloc_129_codes_e[129] =
-{
-    0xA13C, 0xC720, 0xA13F, 0xA13E, 0xA13D, 0xE722, 0x5090, 0x6393,
-    0x7392, 0x2849, 0x31CE, 0x39CE, 0x1425, 0x18E5, 0x1CE5, 0x0844,
-    0x0A1C, 0x0C7C, 0x036C, 0x0423, 0x050F, 0x063F, 0x01B7, 0x0216,
-    0x0285, 0x031D, 0x039D, 0x0109, 0x0140, 0x0180, 0x01C8, 0x01CF,
-    0x007A, 0x008A, 0x00A2, 0x00C1, 0x00E5, 0x0014, 0x0037, 0x0043,
-    0x004E, 0x0056, 0x0061, 0x006C, 0x007C, 0x000B, 0x001C, 0x001F,
-    0x0023, 0x0025, 0x0029, 0x002C, 0x002E, 0x0032, 0x0034, 0x0037,
-    0x003A, 0x003C, 0x003F, 0x0001, 0x0003, 0x0006, 0x0008, 0x000A,
-    0x000C, 0x000B, 0x0009, 0x0007, 0x0004, 0x0002, 0x0000, 0x003D,
-    0x003B, 0x0038, 0x0035, 0x0033, 0x002F, 0x002D, 0x002A, 0x0026,
-    0x0024, 0x0020, 0x001D, 0x001A, 0x007D, 0x006D, 0x0062, 0x0057,
-    0x004F, 0x0044, 0x003C, 0x0015, 0x00E6, 0x00C6, 0x00A3, 0x008B,
-    0x007B, 0x006C, 0x01C9, 0x0181, 0x0141, 0x010A, 0x00DA, 0x031E,
-    0x0286, 0x0217, 0x0210, 0x0738, 0x0638, 0x0508, 0x036D, 0x0C7D,
-    0x0A1D, 0x0845, 0x1CE6, 0x18E6, 0x1426, 0x39CF, 0x31CF, 0x284E,
-    0x7393, 0x7390, 0x5091, 0xE723, 0xC724, 0xC725, 0xC722, 0xC723,
-    0xC721,
-};
-static const uint16_t bitalloc_129_codes_f[129] =
-{
-    0x762C, 0x3B17, 0x1555, 0x0608, 0x0AAB, 0x0FF2, 0x0305, 0x0307,
-    0x0763, 0x0046, 0x010C, 0x01BC, 0x02AB, 0x03B6, 0x03FD, 0x0080,
-    0x0087, 0x00DF, 0x0156, 0x01D9, 0x01F8, 0x01FF, 0x002A, 0x0041,
-    0x0061, 0x0094, 0x00D4, 0x00EA, 0x00F2, 0x00FD, 0x0009, 0x000B,
-    0x001A, 0x0026, 0x0031, 0x0040, 0x004B, 0x006B, 0x0073, 0x0077,
-    0x007A, 0x007C, 0x0000, 0x0002, 0x0006, 0x0008, 0x000B, 0x000E,
-    0x0011, 0x0014, 0x0016, 0x0019, 0x001C, 0x001E, 0x0021, 0x0023,
-    0x0026, 0x0028, 0x002B, 0x002D, 0x002F, 0x0031, 0x0033, 0x0036,
-    0x0038, 0x0037, 0x0034, 0x0032, 0x0030, 0x002E, 0x002C, 0x0029,
-    0x0027, 0x0024, 0x0022, 0x001F, 0x001D, 0x001A, 0x0017, 0x0015,
-    0x0012, 0x000F, 0x000C, 0x0009, 0x0007, 0x0003, 0x0001, 0x007D,
-    0x007B, 0x0078, 0x0074, 0x0072, 0x0054, 0x0041, 0x0036, 0x0027,
-    0x001B, 0x0014, 0x000A, 0x00FE, 0x00F3, 0x00EB, 0x00D5, 0x0095,
-    0x006E, 0x0042, 0x002B, 0x0010, 0x01F9, 0x01DA, 0x0157, 0x0154,
-    0x00C0, 0x0081, 0x0022, 0x03B7, 0x03B0, 0x01BD, 0x010D, 0x0047,
-    0x07F8, 0x0554, 0x0306, 0x0FF3, 0x0EC4, 0x0609, 0x1D8A, 0x1554,
-    0x762D,
-};
-static const uint16_t bitalloc_129_codes_g[129] =
-{
-    0x1E20, 0x1E5E, 0x031C, 0x051A, 0x0718, 0x0916, 0x0B14, 0x0D12,
-    0x0F11, 0x0090, 0x018F, 0x028E, 0x038D, 0x048C, 0x058B, 0x068A,
-    0x0789, 0x0049, 0x00C8, 0x0148, 0x01C7, 0x0247, 0x02C6, 0x0346,
-    0x03C5, 0x0025, 0x0065, 0x00A5, 0x00E4, 0x0124, 0x0164, 0x01A4,
-    0x01E3, 0x0013, 0x0033, 0x0053, 0x0073, 0x0093, 0x00B3, 0x00D3,
-    0x00F3, 0x000A, 0x001A, 0x002A, 0x003A, 0x004A, 0x005A, 0x006A,
-    0x007A, 0x0006, 0x000E, 0x0016, 0x001E, 0x0026, 0x002E, 0x0036,
-    0x003E, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C,
-    0x0000, 0x001D, 0x0019, 0x0015, 0x0011, 0x000D, 0x0009, 0x0005,
-    0x003F, 0x0037, 0x002F, 0x0027, 0x001F, 0x0017, 0x000F, 0x0007,
-    0x007B, 0x006B, 0x005B, 0x004B, 0x003B, 0x002B, 0x001B, 0x000B,
-    0x0008, 0x00F0, 0x00D0, 0x00B0, 0x0090, 0x0070, 0x0050, 0x0030,
-    0x01E4, 0x01A5, 0x0165, 0x0125, 0x00E5, 0x00E2, 0x00A2, 0x0062,
-    0x03CA, 0x0347, 0x02C7, 0x02C4, 0x0244, 0x0149, 0x00C9, 0x00C6,
-    0x0796, 0x068B, 0x0688, 0x048D, 0x048A, 0x028F, 0x028C, 0x0091,
-    0x0F2E, 0x0D13, 0x0B15, 0x0917, 0x0719, 0x051B, 0x031D, 0x1E5F,
-    0x1E21,
-};
-static const uint8_t bitalloc_129_bits_a[129] =
-{
-    11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-    10, 10, 10,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  8,
-     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,
-     7,  7,  7,  7,  6,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  4,
-     4,  4,  4,  5,  5,  5,  6,  6,  6,  6,  6,  6,  6,  7,  7,  7,
-     7,  7,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
-     8,  8,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10,
-    10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
-    11,
-};
-static const uint8_t bitalloc_129_bits_b[129] =
-{
-    14, 13, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10,  9,  9,  9,
-     9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
-     8,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  6,
-     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  5,  5,
-     5,  5,  5,  5,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
-     6,  6,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  9,  9,  9,  9,
-     9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12,
-    14,
-};
-static const uint8_t bitalloc_129_bits_c[129] =
-{
-    13, 12, 11, 11, 10, 10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  9,
-     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,
-     7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  6,  6,
-     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
-     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
-     6,  6,  6,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-     7,  7,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
-     8,  8,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 11, 11, 11,
-    13,
-};
-static const uint8_t bitalloc_129_bits_d[129] =
-{
-    16, 16, 16, 16, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13,
-    13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 10, 10, 10,
-    10, 10,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  7,  7,
-     7,  7,  7,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  4,  4,
-     4,  4,  4,  5,  5,  5,  5,  5,  5,  6,  6,  6,  6,  6,  7,  7,
-     7,  7,  7,  7,  8,  8,  8,  8,  8,  9,  9,  9,  9,  9,  9, 10,
-    10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13,
-    13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16,
-    16,
-};
-static const uint8_t bitalloc_129_bits_e[129] =
-{
-    16, 16, 16, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12,
-    12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10,  9,  9,  9,  9,  9,
-     8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,  7,  6,  6,  6,
-     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,
-     5,  5,  5,  5,  5,  5,  5,  6,  6,  6,  6,  6,  6,  6,  6,  6,
-     6,  6,  6,  6,  7,  7,  7,  7,  7,  7,  7,  7,  8,  8,  8,  8,
-     8,  8,  9,  9,  9,  9,  9, 10, 10, 10, 10, 11, 11, 11, 11, 12,
-    12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16,
-    16,
-};
-static const uint8_t bitalloc_129_bits_f[129] =
-{
-    15, 14, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 10, 10, 10,  9,
-     9,  9,  9,  9,  9,  9,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,
-     7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  6,  6,  6,  6,  6,  6,
-     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
-     6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
-     6,  6,  6,  6,  6,  6,  6,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-     7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8,  8,  9,  9,  9,  9,
-     9,  9,  9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13,
-    15,
-};
-static const uint8_t bitalloc_129_bits_g[129] =
-{
-    13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11,
-    11, 10, 10, 10, 10, 10, 10, 10, 10,  9,  9,  9,  9,  9,  9,  9,
-     9,  8,  8,  8,  8,  8,  8,  8,  8,  7,  7,  7,  7,  7,  7,  7,
-     7,  6,  6,  6,  6,  6,  6,  6,  6,  5,  5,  5,  5,  5,  5,  5,
-     4,  5,  5,  5,  5,  5,  5,  5,  6,  6,  6,  6,  6,  6,  6,  6,
-     7,  7,  7,  7,  7,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,
-     9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 10, 10, 10, 10,
-    11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13,
-    13,
-};
-
-static const uint8_t bitalloc_sizes[10] = { 3, 5, 7, 9, 13, 17, 25, 33, 65, 129 };
-
-static const int8_t bitalloc_offsets[10] =
-    { -1, -2, -3, -4, -6, -8, -12, -16, -32, -64 };
-
-static const uint8_t bitalloc_maxbits[10][7] = {
-    { 2 },
-    { 4, 3, 3 },
-    { 5, 5, 4 },
-    { 6, 5, 6 },
-    { 7, 6, 5 },
-    { 9, 8, 7, 9, 8, 8, 8 },
-    { 9, 9, 8, 9, 8, 9, 9 },
-    { 9, 9, 9, 9, 9, 9, 9 },
-    { 9, 9, 9, 9, 9, 9, 9 },
-    { 9, 9, 9, 9, 9, 9, 9 }
-};
-
-static const uint16_t* const bitalloc_codes[10][8] = {
-  { bitalloc_3_codes, NULL },
-  { bitalloc_5_codes_a,  bitalloc_5_codes_b,  bitalloc_5_codes_c,  NULL },
-  { bitalloc_7_codes_a,  bitalloc_7_codes_b,  bitalloc_7_codes_c,  NULL },
-  { bitalloc_9_codes_a,  bitalloc_9_codes_b,  bitalloc_9_codes_c,  NULL },
-  { bitalloc_13_codes_a, bitalloc_13_codes_b, bitalloc_13_codes_c, NULL },
-  { bitalloc_17_codes_a, bitalloc_17_codes_b, bitalloc_17_codes_c, bitalloc_17_codes_d,
-    bitalloc_17_codes_e, bitalloc_17_codes_f, bitalloc_17_codes_g, NULL },
-  { bitalloc_25_codes_a, bitalloc_25_codes_b, bitalloc_25_codes_c, bitalloc_25_codes_d,
-    bitalloc_25_codes_e, bitalloc_25_codes_f, bitalloc_25_codes_g, NULL },
-  { bitalloc_33_codes_a, bitalloc_33_codes_b, bitalloc_33_codes_c, bitalloc_33_codes_d,
-    bitalloc_33_codes_e, bitalloc_33_codes_f, bitalloc_33_codes_g, NULL },
-  { bitalloc_65_codes_a, bitalloc_65_codes_b, bitalloc_65_codes_c, bitalloc_65_codes_d,
-    bitalloc_65_codes_e, bitalloc_65_codes_f, bitalloc_65_codes_g, NULL },
-  { bitalloc_129_codes_a, bitalloc_129_codes_b, bitalloc_129_codes_c, bitalloc_129_codes_d,
-    bitalloc_129_codes_e, bitalloc_129_codes_f, bitalloc_129_codes_g, NULL }
-};
-
-static const uint8_t* const bitalloc_bits[10][8] = {
-  { bitalloc_3_bits, NULL },
-  { bitalloc_5_bits_a,  bitalloc_5_bits_b,  bitalloc_5_bits_c,  NULL },
-  { bitalloc_7_bits_a,  bitalloc_7_bits_b,  bitalloc_7_bits_c,  NULL },
-  { bitalloc_9_bits_a,  bitalloc_9_bits_b,  bitalloc_9_bits_c,  NULL },
-  { bitalloc_13_bits_a, bitalloc_13_bits_b, bitalloc_13_bits_c, NULL },
-  { bitalloc_17_bits_a, bitalloc_17_bits_b, bitalloc_17_bits_c, bitalloc_17_bits_d,
-    bitalloc_17_bits_e, bitalloc_17_bits_f, bitalloc_17_bits_g, NULL },
-  { bitalloc_25_bits_a, bitalloc_25_bits_b, bitalloc_25_bits_c, bitalloc_25_bits_d,
-    bitalloc_25_bits_e, bitalloc_25_bits_f, bitalloc_25_bits_g, NULL },
-  { bitalloc_33_bits_a, bitalloc_33_bits_b, bitalloc_33_bits_c, bitalloc_33_bits_d,
-    bitalloc_33_bits_e, bitalloc_33_bits_f, bitalloc_33_bits_g, NULL },
-  { bitalloc_65_bits_a, bitalloc_65_bits_b, bitalloc_65_bits_c, bitalloc_65_bits_d,
-    bitalloc_65_bits_e, bitalloc_65_bits_f, bitalloc_65_bits_g, NULL },
-  { bitalloc_129_bits_a, bitalloc_129_bits_b, bitalloc_129_bits_c, bitalloc_129_bits_d,
-    bitalloc_129_bits_e, bitalloc_129_bits_f, bitalloc_129_bits_g, NULL }
-};
-
-#endif /* AVCODEC_DCAHUFF_H */
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
deleted file mode 100644
index 4f0a0c6..0000000
--- a/libavcodec/dct-test.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * (c) 2001 Fabrice Bellard
- *     2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DCT test (c) 2001 Fabrice Bellard
- * Started from sample code by Juan J. Sierralta P.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <math.h>
-
-#include "libavutil/common.h"
-#include "libavutil/lfg.h"
-
-#include "simple_idct.h"
-#include "aandcttab.h"
-#include "faandct.h"
-#include "faanidct.h"
-#include "x86/idct_xvid.h"
-#include "dctref.h"
-
-#undef printf
-
-void ff_mmx_idct(DCTELEM *data);
-void ff_mmxext_idct(DCTELEM *data);
-
-void odivx_idct_c(short *block);
-
-// BFIN
-void ff_bfin_idct(DCTELEM *block);
-void ff_bfin_fdct(DCTELEM *block);
-
-// ALTIVEC
-void fdct_altivec(DCTELEM *block);
-//void idct_altivec(DCTELEM *block);?? no routine
-
-// ARM
-void ff_j_rev_dct_arm(DCTELEM *data);
-void ff_simple_idct_arm(DCTELEM *data);
-void ff_simple_idct_armv5te(DCTELEM *data);
-void ff_simple_idct_armv6(DCTELEM *data);
-void ff_simple_idct_neon(DCTELEM *data);
-
-void ff_simple_idct_axp(DCTELEM *data);
-
-struct algo {
-  const char *name;
-  enum { FDCT, IDCT } is_idct;
-  void (* func) (DCTELEM *block);
-  void (* ref)  (DCTELEM *block);
-  enum formattag { NO_PERM,MMX_PERM, MMX_SIMPLE_PERM, SCALE_PERM, SSE2_PERM, PARTTRANS_PERM } format;
-  int  mm_support;
-};
-
-#ifndef FAAN_POSTSCALE
-#define FAAN_SCALE SCALE_PERM
-#else
-#define FAAN_SCALE NO_PERM
-#endif
-
-static int cpu_flags;
-
-struct algo algos[] = {
-  {"REF-DBL",         0, ff_ref_fdct,        ff_ref_fdct, NO_PERM},
-  {"FAAN",            0, ff_faandct,         ff_ref_fdct, FAAN_SCALE},
-  {"FAANI",           1, ff_faanidct,        ff_ref_idct, NO_PERM},
-  {"IJG-AAN-INT",     0, fdct_ifast,         ff_ref_fdct, SCALE_PERM},
-  {"IJG-LLM-INT",     0, ff_jpeg_fdct_islow, ff_ref_fdct, NO_PERM},
-  {"REF-DBL",         1, ff_ref_idct,        ff_ref_idct, NO_PERM},
-  {"INT",             1, j_rev_dct,          ff_ref_idct, MMX_PERM},
-  {"SIMPLE-C",        1, ff_simple_idct,     ff_ref_idct, NO_PERM},
-
-#if HAVE_MMX
-  {"MMX",             0, ff_fdct_mmx,        ff_ref_fdct, NO_PERM, FF_MM_MMX},
-#if HAVE_MMX2
-  {"MMX2",            0, ff_fdct_mmx2,       ff_ref_fdct, NO_PERM, FF_MM_MMX2},
-  {"SSE2",            0, ff_fdct_sse2,       ff_ref_fdct, NO_PERM, FF_MM_SSE2},
-#endif
-
-#if CONFIG_GPL
-  {"LIBMPEG2-MMX",    1, ff_mmx_idct,        ff_ref_idct, MMX_PERM, FF_MM_MMX},
-  {"LIBMPEG2-MMX2",   1, ff_mmxext_idct,     ff_ref_idct, MMX_PERM, FF_MM_MMX2},
-#endif
-  {"SIMPLE-MMX",      1, ff_simple_idct_mmx, ff_ref_idct, MMX_SIMPLE_PERM, FF_MM_MMX},
-  {"XVID-MMX",        1, ff_idct_xvid_mmx,   ff_ref_idct, NO_PERM, FF_MM_MMX},
-  {"XVID-MMX2",       1, ff_idct_xvid_mmx2,  ff_ref_idct, NO_PERM, FF_MM_MMX2},
-  {"XVID-SSE2",       1, ff_idct_xvid_sse2,  ff_ref_idct, SSE2_PERM, FF_MM_SSE2},
-#endif
-
-#if HAVE_ALTIVEC
-  {"altivecfdct",     0, fdct_altivec,       ff_ref_fdct, NO_PERM, FF_MM_ALTIVEC},
-#endif
-
-#if ARCH_BFIN
-  {"BFINfdct",        0, ff_bfin_fdct,       ff_ref_fdct, NO_PERM},
-  {"BFINidct",        1, ff_bfin_idct,       ff_ref_idct, NO_PERM},
-#endif
-
-#if ARCH_ARM
-  {"SIMPLE-ARM",      1, ff_simple_idct_arm, ff_ref_idct, NO_PERM },
-  {"INT-ARM",         1, ff_j_rev_dct_arm,   ff_ref_idct, MMX_PERM },
-#if HAVE_ARMV5TE
-  {"SIMPLE-ARMV5TE",  1, ff_simple_idct_armv5te, ff_ref_idct, NO_PERM },
-#endif
-#if HAVE_ARMV6
-  {"SIMPLE-ARMV6",    1, ff_simple_idct_armv6, ff_ref_idct, MMX_PERM },
-#endif
-#if HAVE_NEON
-  {"SIMPLE-NEON",     1, ff_simple_idct_neon, ff_ref_idct, PARTTRANS_PERM },
-#endif
-#endif /* ARCH_ARM */
-
-#if ARCH_ALPHA
-  {"SIMPLE-ALPHA",    1, ff_simple_idct_axp,  ff_ref_idct, NO_PERM },
-#endif
-
-  { 0 }
-};
-
-#define AANSCALE_BITS 12
-
-uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
-
-static int64_t gettime(void)
-{
-    struct timeval tv;
-    gettimeofday(&tv,NULL);
-    return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-#define NB_ITS 20000
-#define NB_ITS_SPEED 50000
-
-static short idct_mmx_perm[64];
-
-static short idct_simple_mmx_perm[64]={
-        0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
-        0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
-        0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D,
-        0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F,
-        0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F,
-        0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
-        0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
-        0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
-};
-
-static const uint8_t idct_sse2_row_perm[8] = {0, 4, 1, 5, 2, 6, 3, 7};
-
-static void idct_mmx_init(void)
-{
-    int i;
-
-    /* the mmx/mmxext idct uses a reordered input, so we patch scan tables */
-    for (i = 0; i < 64; i++) {
-        idct_mmx_perm[i] = (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
-//        idct_simple_mmx_perm[i] = simple_block_permute_op(i);
-    }
-}
-
-DECLARE_ALIGNED(16, static DCTELEM, block)[64];
-DECLARE_ALIGNED(8, static DCTELEM, block1)[64];
-DECLARE_ALIGNED(8, static DCTELEM, block_org)[64];
-
-static inline void mmx_emms(void)
-{
-#if HAVE_MMX
-    if (cpu_flags & FF_MM_MMX)
-        __asm__ volatile ("emms\n\t");
-#endif
-}
-
-static void dct_error(const char *name, int is_idct,
-               void (*fdct_func)(DCTELEM *block),
-               void (*fdct_ref)(DCTELEM *block), int form, int test)
-{
-    int it, i, scale;
-    int err_inf, v;
-    int64_t err2, ti, ti1, it1;
-    int64_t sysErr[64], sysErrMax=0;
-    int maxout=0;
-    int blockSumErrMax=0, blockSumErr;
-    AVLFG prng;
-
-    av_lfg_init(&prng, 1);
-
-    err_inf = 0;
-    err2 = 0;
-    for(i=0; i<64; i++) sysErr[i]=0;
-    for(it=0;it<NB_ITS;it++) {
-        for(i=0;i<64;i++)
-            block1[i] = 0;
-        switch(test){
-        case 0:
-            for(i=0;i<64;i++)
-                block1[i] = (av_lfg_get(&prng) % 512) -256;
-            if (is_idct){
-                ff_ref_fdct(block1);
-
-                for(i=0;i<64;i++)
-                    block1[i]>>=3;
-            }
-        break;
-        case 1:{
-            int num = av_lfg_get(&prng) % 10 + 1;
-            for(i=0;i<num;i++)
-                block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % 512 -256;
-        }break;
-        case 2:
-            block1[0] = av_lfg_get(&prng) % 4096 - 2048;
-            block1[63]= (block1[0]&1)^1;
-        break;
-        }
-
-#if 0 // simulate mismatch control
-{ int sum=0;
-        for(i=0;i<64;i++)
-           sum+=block1[i];
-
-        if((sum&1)==0) block1[63]^=1;
-}
-#endif
-
-        for(i=0; i<64; i++)
-            block_org[i]= block1[i];
-
-        if (form == MMX_PERM) {
-            for(i=0;i<64;i++)
-                block[idct_mmx_perm[i]] = block1[i];
-            } else if (form == MMX_SIMPLE_PERM) {
-            for(i=0;i<64;i++)
-                block[idct_simple_mmx_perm[i]] = block1[i];
-
-        } else if (form == SSE2_PERM) {
-            for(i=0; i<64; i++)
-                block[(i&0x38) | idct_sse2_row_perm[i&7]] = block1[i];
-        } else if (form == PARTTRANS_PERM) {
-            for(i=0; i<64; i++)
-                block[(i&0x24) | ((i&3)<<3) | ((i>>3)&3)] = block1[i];
-        } else {
-            for(i=0; i<64; i++)
-                block[i]= block1[i];
-        }
-#if 0 // simulate mismatch control for tested IDCT but not the ref
-{ int sum=0;
-        for(i=0;i<64;i++)
-           sum+=block[i];
-
-        if((sum&1)==0) block[63]^=1;
-}
-#endif
-
-        fdct_func(block);
-        mmx_emms();
-
-        if (form == SCALE_PERM) {
-            for(i=0; i<64; i++) {
-                scale = 8*(1 << (AANSCALE_BITS + 11)) / ff_aanscales[i];
-                block[i] = (block[i] * scale /*+ (1<<(AANSCALE_BITS-1))*/) >> AANSCALE_BITS;
-            }
-        }
-
-        fdct_ref(block1);
-
-        blockSumErr=0;
-        for(i=0;i<64;i++) {
-            v = abs(block[i] - block1[i]);
-            if (v > err_inf)
-                err_inf = v;
-            err2 += v * v;
-            sysErr[i] += block[i] - block1[i];
-            blockSumErr += v;
-            if( abs(block[i])>maxout) maxout=abs(block[i]);
-        }
-        if(blockSumErrMax < blockSumErr) blockSumErrMax= blockSumErr;
-#if 0 // print different matrix pairs
-        if(blockSumErr){
-            printf("\n");
-            for(i=0; i<64; i++){
-                if((i&7)==0) printf("\n");
-                printf("%4d ", block_org[i]);
-            }
-            for(i=0; i<64; i++){
-                if((i&7)==0) printf("\n");
-                printf("%4d ", block[i] - block1[i]);
-            }
-        }
-#endif
-    }
-    for(i=0; i<64; i++) sysErrMax= FFMAX(sysErrMax, FFABS(sysErr[i]));
-
-#if 1 // dump systematic errors
-    for(i=0; i<64; i++){
-        if(i%8==0) printf("\n");
-        printf("%7d ", (int)sysErr[i]);
-    }
-    printf("\n");
-#endif
-
-    printf("%s %s: err_inf=%d err2=%0.8f syserr=%0.8f maxout=%d blockSumErr=%d\n",
-           is_idct ? "IDCT" : "DCT",
-           name, err_inf, (double)err2 / NB_ITS / 64.0, (double)sysErrMax / NB_ITS, maxout, blockSumErrMax);
-#if 1 //Speed test
-    /* speed test */
-    for(i=0;i<64;i++)
-        block1[i] = 0;
-    switch(test){
-    case 0:
-        for(i=0;i<64;i++)
-            block1[i] = av_lfg_get(&prng) % 512 -256;
-        if (is_idct){
-            ff_ref_fdct(block1);
-
-            for(i=0;i<64;i++)
-                block1[i]>>=3;
-        }
-    break;
-    case 1:{
-    case 2:
-        block1[0] = av_lfg_get(&prng) % 512 -256;
-        block1[1] = av_lfg_get(&prng) % 512 -256;
-        block1[2] = av_lfg_get(&prng) % 512 -256;
-        block1[3] = av_lfg_get(&prng) % 512 -256;
-    }break;
-    }
-
-    if (form == MMX_PERM) {
-        for(i=0;i<64;i++)
-            block[idct_mmx_perm[i]] = block1[i];
-    } else if(form == MMX_SIMPLE_PERM) {
-        for(i=0;i<64;i++)
-            block[idct_simple_mmx_perm[i]] = block1[i];
-    } else {
-        for(i=0; i<64; i++)
-            block[i]= block1[i];
-    }
-
-    ti = gettime();
-    it1 = 0;
-    do {
-        for(it=0;it<NB_ITS_SPEED;it++) {
-            for(i=0; i<64; i++)
-                block[i]= block1[i];
-//            memcpy(block, block1, sizeof(DCTELEM) * 64);
-// do not memcpy especially not fastmemcpy because it does movntq !!!
-            fdct_func(block);
-        }
-        it1 += NB_ITS_SPEED;
-        ti1 = gettime() - ti;
-    } while (ti1 < 1000000);
-    mmx_emms();
-
-    printf("%s %s: %0.1f kdct/s\n",
-           is_idct ? "IDCT" : "DCT",
-           name, (double)it1 * 1000.0 / (double)ti1);
-#endif
-}
-
-DECLARE_ALIGNED(8, static uint8_t, img_dest)[64];
-DECLARE_ALIGNED(8, static uint8_t, img_dest1)[64];
-
-static void idct248_ref(uint8_t *dest, int linesize, int16_t *block)
-{
-    static int init;
-    static double c8[8][8];
-    static double c4[4][4];
-    double block1[64], block2[64], block3[64];
-    double s, sum, v;
-    int i, j, k;
-
-    if (!init) {
-        init = 1;
-
-        for(i=0;i<8;i++) {
-            sum = 0;
-            for(j=0;j<8;j++) {
-                s = (i==0) ? sqrt(1.0/8.0) : sqrt(1.0/4.0);
-                c8[i][j] = s * cos(M_PI * i * (j + 0.5) / 8.0);
-                sum += c8[i][j] * c8[i][j];
-            }
-        }
-
-        for(i=0;i<4;i++) {
-            sum = 0;
-            for(j=0;j<4;j++) {
-                s = (i==0) ? sqrt(1.0/4.0) : sqrt(1.0/2.0);
-                c4[i][j] = s * cos(M_PI * i * (j + 0.5) / 4.0);
-                sum += c4[i][j] * c4[i][j];
-            }
-        }
-    }
-
-    /* butterfly */
-    s = 0.5 * sqrt(2.0);
-    for(i=0;i<4;i++) {
-        for(j=0;j<8;j++) {
-            block1[8*(2*i)+j] = (block[8*(2*i)+j] + block[8*(2*i+1)+j]) * s;
-            block1[8*(2*i+1)+j] = (block[8*(2*i)+j] - block[8*(2*i+1)+j]) * s;
-        }
-    }
-
-    /* idct8 on lines */
-    for(i=0;i<8;i++) {
-        for(j=0;j<8;j++) {
-            sum = 0;
-            for(k=0;k<8;k++)
-                sum += c8[k][j] * block1[8*i+k];
-            block2[8*i+j] = sum;
-        }
-    }
-
-    /* idct4 */
-    for(i=0;i<8;i++) {
-        for(j=0;j<4;j++) {
-            /* top */
-            sum = 0;
-            for(k=0;k<4;k++)
-                sum += c4[k][j] * block2[8*(2*k)+i];
-            block3[8*(2*j)+i] = sum;
-
-            /* bottom */
-            sum = 0;
-            for(k=0;k<4;k++)
-                sum += c4[k][j] * block2[8*(2*k+1)+i];
-            block3[8*(2*j+1)+i] = sum;
-        }
-    }
-
-    /* clamp and store the result */
-    for(i=0;i<8;i++) {
-        for(j=0;j<8;j++) {
-            v = block3[8*i+j];
-            if (v < 0)
-                v = 0;
-            else if (v > 255)
-                v = 255;
-            dest[i * linesize + j] = (int)rint(v);
-        }
-    }
-}
-
-static void idct248_error(const char *name,
-                    void (*idct248_put)(uint8_t *dest, int line_size, int16_t *block))
-{
-    int it, i, it1, ti, ti1, err_max, v;
-
-    AVLFG prng;
-
-    av_lfg_init(&prng, 1);
-
-    /* just one test to see if code is correct (precision is less
-       important here) */
-    err_max = 0;
-    for(it=0;it<NB_ITS;it++) {
-
-        /* XXX: use forward transform to generate values */
-        for(i=0;i<64;i++)
-            block1[i] = av_lfg_get(&prng) % 256 - 128;
-        block1[0] += 1024;
-
-        for(i=0; i<64; i++)
-            block[i]= block1[i];
-        idct248_ref(img_dest1, 8, block);
-
-        for(i=0; i<64; i++)
-            block[i]= block1[i];
-        idct248_put(img_dest, 8, block);
-
-        for(i=0;i<64;i++) {
-            v = abs((int)img_dest[i] - (int)img_dest1[i]);
-            if (v == 255)
-                printf("%d %d\n", img_dest[i], img_dest1[i]);
-            if (v > err_max)
-                err_max = v;
-        }
-#if 0
-        printf("ref=\n");
-        for(i=0;i<8;i++) {
-            int j;
-            for(j=0;j<8;j++) {
-                printf(" %3d", img_dest1[i*8+j]);
-            }
-            printf("\n");
-        }
-
-        printf("out=\n");
-        for(i=0;i<8;i++) {
-            int j;
-            for(j=0;j<8;j++) {
-                printf(" %3d", img_dest[i*8+j]);
-            }
-            printf("\n");
-        }
-#endif
-    }
-    printf("%s %s: err_inf=%d\n",
-           1 ? "IDCT248" : "DCT248",
-           name, err_max);
-
-    ti = gettime();
-    it1 = 0;
-    do {
-        for(it=0;it<NB_ITS_SPEED;it++) {
-            for(i=0; i<64; i++)
-                block[i]= block1[i];
-//            memcpy(block, block1, sizeof(DCTELEM) * 64);
-// do not memcpy especially not fastmemcpy because it does movntq !!!
-            idct248_put(img_dest, 8, block);
-        }
-        it1 += NB_ITS_SPEED;
-        ti1 = gettime() - ti;
-    } while (ti1 < 1000000);
-    mmx_emms();
-
-    printf("%s %s: %0.1f kdct/s\n",
-           1 ? "IDCT248" : "DCT248",
-           name, (double)it1 * 1000.0 / (double)ti1);
-}
-
-static void help(void)
-{
-    printf("dct-test [-i] [<test-number>]\n"
-           "test-number 0 -> test with random matrixes\n"
-           "            1 -> test with random sparse matrixes\n"
-           "            2 -> do 3. test from mpeg4 std\n"
-           "-i          test IDCT implementations\n"
-           "-4          test IDCT248 implementations\n");
-}
-
-int main(int argc, char **argv)
-{
-    int test_idct = 0, test_248_dct = 0;
-    int c,i;
-    int test=1;
-    cpu_flags = mm_support();
-
-    ff_ref_dct_init();
-    idct_mmx_init();
-
-    for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i;
-    for(i=0;i<MAX_NEG_CROP;i++) {
-        cropTbl[i] = 0;
-        cropTbl[i + MAX_NEG_CROP + 256] = 255;
-    }
-
-    for(;;) {
-        c = getopt(argc, argv, "ih4");
-        if (c == -1)
-            break;
-        switch(c) {
-        case 'i':
-            test_idct = 1;
-            break;
-        case '4':
-            test_248_dct = 1;
-            break;
-        default :
-        case 'h':
-            help();
-            return 0;
-        }
-    }
-
-    if(optind <argc) test= atoi(argv[optind]);
-
-    printf("ffmpeg DCT/IDCT test\n");
-
-    if (test_248_dct) {
-        idct248_error("SIMPLE-C", ff_simple_idct248_put);
-    } else {
-      for (i=0;algos[i].name;i++)
-        if (algos[i].is_idct == test_idct && !(~cpu_flags & algos[i].mm_support)) {
-          dct_error (algos[i].name, algos[i].is_idct, algos[i].func, algos[i].ref, algos[i].format, test);
-        }
-    }
-    return 0;
-}
diff --git a/libavcodec/dct.c b/libavcodec/dct.c
deleted file mode 100644
index 0840fec..0000000
--- a/libavcodec/dct.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * (I)DCT Transforms
- * Copyright (c) 2009 Peter Ross <pross at xvid.org>
- * Copyright (c) 2010 Alex Converse <alex.converse at gmail.com>
- * Copyright (c) 2010 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * @file
- * (Inverse) Discrete Cosine Transforms. These are also known as the
- * type II and type III DCTs respectively.
- */
-
-#include <math.h>
-#include "libavutil/mathematics.h"
-#include "fft.h"
-
-/* sin((M_PI * x / (2*n)) */
-#define SIN(s,n,x) (s->costab[(n) - (x)])
-
-/* cos((M_PI * x / (2*n)) */
-#define COS(s,n,x) (s->costab[x])
-
-static void ff_dst_calc_I_c(DCTContext *ctx, FFTSample *data)
-{
-    int n = 1 << ctx->nbits;
-    int i;
-
-    data[0] = 0;
-    for(i = 1; i < n/2; i++) {
-        float tmp1 = data[i    ];
-        float tmp2 = data[n - i];
-        float s = SIN(ctx, n, 2*i);
-
-        s *= tmp1 + tmp2;
-        tmp1 = (tmp1 - tmp2) * 0.5f;
-        data[i    ] = s + tmp1;
-        data[n - i] = s - tmp1;
-    }
-
-    data[n/2] *= 2;
-    ff_rdft_calc(&ctx->rdft, data);
-
-    data[0] *= 0.5f;
-
-    for(i = 1; i < n-2; i += 2) {
-        data[i + 1] += data[i - 1];
-        data[i    ] = -data[i + 2];
-    }
-
-    data[n-1] = 0;
-}
-
-static void ff_dct_calc_I_c(DCTContext *ctx, FFTSample *data)
-{
-    int n = 1 << ctx->nbits;
-    int i;
-    float next = -0.5f * (data[0] - data[n]);
-
-    for(i = 0; i < n/2; i++) {
-        float tmp1 = data[i    ];
-        float tmp2 = data[n - i];
-        float s = SIN(ctx, n, 2*i);
-        float c = COS(ctx, n, 2*i);
-
-        c *= tmp1 - tmp2;
-        s *= tmp1 - tmp2;
-
-        next += c;
-
-        tmp1 = (tmp1 + tmp2) * 0.5f;
-        data[i    ] = tmp1 - s;
-        data[n - i] = tmp1 + s;
-    }
-
-    ff_rdft_calc(&ctx->rdft, data);
-    data[n] = data[1];
-    data[1] = next;
-
-    for(i = 3; i <= n; i += 2)
-        data[i] = data[i - 2] - data[i];
-}
-
-static void ff_dct_calc_III_c(DCTContext *ctx, FFTSample *data)
-{
-    int n = 1 << ctx->nbits;
-    int i;
-
-    float next = data[n - 1];
-    float inv_n = 1.0f / n;
-
-    for (i = n - 2; i >= 2; i -= 2) {
-        float val1 = data[i    ];
-        float val2 = data[i - 1] - data[i + 1];
-        float c = COS(ctx, n, i);
-        float s = SIN(ctx, n, i);
-
-        data[i    ] = c * val1 + s * val2;
-        data[i + 1] = s * val1 - c * val2;
-    }
-
-    data[1] = 2 * next;
-
-    ff_rdft_calc(&ctx->rdft, data);
-
-    for (i = 0; i < n / 2; i++) {
-        float tmp1 = data[i        ] * inv_n;
-        float tmp2 = data[n - i - 1] * inv_n;
-        float csc = ctx->csc2[i] * (tmp1 - tmp2);
-
-        tmp1 += tmp2;
-        data[i        ] = tmp1 + csc;
-        data[n - i - 1] = tmp1 - csc;
-    }
-}
-
-static void ff_dct_calc_II_c(DCTContext *ctx, FFTSample *data)
-{
-    int n = 1 << ctx->nbits;
-    int i;
-    float next;
-
-    for (i=0; i < n/2; i++) {
-        float tmp1 = data[i        ];
-        float tmp2 = data[n - i - 1];
-        float s = SIN(ctx, n, 2*i + 1);
-
-        s *= tmp1 - tmp2;
-        tmp1 = (tmp1 + tmp2) * 0.5f;
-
-        data[i    ] = tmp1 + s;
-        data[n-i-1] = tmp1 - s;
-    }
-
-    ff_rdft_calc(&ctx->rdft, data);
-
-    next = data[1] * 0.5;
-    data[1] *= -1;
-
-    for (i = n - 2; i >= 0; i -= 2) {
-        float inr = data[i    ];
-        float ini = data[i + 1];
-        float c = COS(ctx, n, i);
-        float s = SIN(ctx, n, i);
-
-        data[i  ] = c * inr + s * ini;
-
-        data[i+1] = next;
-
-        next +=     s * inr - c * ini;
-    }
-}
-
-void ff_dct_calc(DCTContext *s, FFTSample *data)
-{
-    s->dct_calc(s, data);
-}
-
-av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
-{
-    int n = 1 << nbits;
-    int i;
-
-    s->nbits    = nbits;
-    s->inverse  = inverse;
-
-    ff_init_ff_cos_tabs(nbits+2);
-
-    s->costab = ff_cos_tabs[nbits+2];
-
-    s->csc2 = av_malloc(n/2 * sizeof(FFTSample));
-
-    if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) {
-        av_free(s->csc2);
-        return -1;
-    }
-
-    for (i = 0; i < n/2; i++)
-        s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));
-
-    switch(inverse) {
-    case DCT_I  : s->dct_calc = ff_dct_calc_I_c; break;
-    case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break;
-    case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;
-    case DST_I  : s->dct_calc = ff_dst_calc_I_c; break;
-    }
-    return 0;
-}
-
-av_cold void ff_dct_end(DCTContext *s)
-{
-    ff_rdft_end(&s->rdft);
-    av_free(s->csc2);
-}
diff --git a/libavcodec/dctref.c b/libavcodec/dctref.c
deleted file mode 100644
index 851014b..0000000
--- a/libavcodec/dctref.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * reference discrete cosine transform (double precision)
- * Copyright (C) 2009 Dylan Yudaken
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * reference discrete cosine transform (double precision)
- *
- * @author Dylan Yudaken (dyudaken at gmail)
- *
- * @note This file could be optimized a lot, but is for
- * reference and so readability is better.
- */
-
-#include "libavutil/mathematics.h"
-#include "dctref.h"
-
-static double coefficients[8 * 8];
-
-/**
- * Initialize the double precision discrete cosine transform
- * functions fdct & idct.
- */
-av_cold void ff_ref_dct_init(void)
-{
-    unsigned int i, j;
-
-    for (j = 0; j < 8; ++j) {
-        coefficients[j] = sqrt(0.125);
-        for (i = 8; i < 64; i += 8) {
-            coefficients[i + j] = 0.5 * cos(i * (j + 0.5) * M_PI / 64.0);
-        }
-    }
-}
-
-/**
- * Transform 8x8 block of data with a double precision forward DCT <br>
- * This is a reference implementation.
- *
- * @param block pointer to 8x8 block of data to transform
- */
-void ff_ref_fdct(short *block)
-{
-    /* implement the equation: block = coefficients * block * coefficients' */
-
-    unsigned int i, j, k;
-    double out[8 * 8];
-
-    /* out = coefficients * block */
-    for (i = 0; i < 64; i += 8) {
-        for (j = 0; j < 8; ++j) {
-            double tmp = 0;
-            for (k = 0; k < 8; ++k) {
-                tmp += coefficients[i + k] * block[k * 8 + j];
-            }
-            out[i + j] = tmp * 8;
-        }
-    }
-
-    /* block = out * (coefficients') */
-    for (j = 0; j < 8; ++j) {
-        for (i = 0; i < 64; i += 8) {
-            double tmp = 0;
-            for (k = 0; k < 8; ++k) {
-                tmp += out[i + k] * coefficients[j * 8 + k];
-            }
-            block[i + j] = floor(tmp + 0.499999999999);
-        }
-    }
-}
-
-/**
- * Transform 8x8 block of data with a double precision inverse DCT <br>
- * This is a reference implementation.
- *
- * @param block pointer to 8x8 block of data to transform
- */
-void ff_ref_idct(short *block)
-{
-    /* implement the equation: block = (coefficients') * block * coefficients */
-
-    unsigned int i, j, k;
-    double out[8 * 8];
-
-    /* out = block * coefficients */
-    for (i = 0; i < 64; i += 8) {
-        for (j = 0; j < 8; ++j) {
-            double tmp = 0;
-            for (k = 0; k < 8; ++k) {
-                tmp += block[i + k] * coefficients[k * 8 + j];
-            }
-            out[i + j] = tmp;
-        }
-    }
-
-    /* block = (coefficients') * out */
-    for (i = 0; i < 8; ++i) {
-        for (j = 0; j < 8; ++j) {
-            double tmp = 0;
-            for (k = 0; k < 64; k += 8) {
-                tmp += coefficients[k + i] * out[k + j];
-            }
-            block[i * 8 + j] = floor(tmp + 0.5);
-        }
-    }
-}
diff --git a/libavcodec/dctref.h b/libavcodec/dctref.h
deleted file mode 100644
index adbaf68..0000000
--- a/libavcodec/dctref.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * reference discrete cosine transform (double precision)
- * Copyright (C) 2009 Dylan Yudaken
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DCTREF_H
-#define AVCODEC_DCTREF_H
-
-#include "dsputil.h"
-
-void ff_ref_fdct(DCTELEM *block);
-void ff_ref_idct(DCTELEM *block);
-void ff_ref_dct_init(void);
-
-#endif
diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
deleted file mode 100644
index c65a51f..0000000
--- a/libavcodec/dirac.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (C) 2007 Marco Gerards <marco at gnu.org>
- * Copyright (C) 2009 David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Dirac Decoder
- * @author Marco Gerards <marco at gnu.org>
- */
-
-#include "dirac.h"
-#include "avcodec.h"
-#include "golomb.h"
-#include "mpeg12data.h"
-
-// defaults for source parameters
-static const dirac_source_params dirac_source_parameters_defaults[] = {
-    { 640,  480,  2, 0, 0, 1,  1, 640,  480,  0, 0, 1, 0 },
-    { 176,  120,  2, 0, 0, 9,  2, 176,  120,  0, 0, 1, 1 },
-    { 176,  144,  2, 0, 1, 10, 3, 176,  144,  0, 0, 1, 2 },
-    { 352,  240,  2, 0, 0, 9,  2, 352,  240,  0, 0, 1, 1 },
-    { 352,  288,  2, 0, 1, 10, 3, 352,  288,  0, 0, 1, 2 },
-    { 704,  480,  2, 0, 0, 9,  2, 704,  480,  0, 0, 1, 1 },
-    { 704,  576,  2, 0, 1, 10, 3, 704,  576,  0, 0, 1, 2 },
-    { 720,  480,  1, 1, 0, 4,  2, 704,  480,  8, 0, 3, 1 },
-    { 720,  576,  1, 1, 1, 3,  3, 704,  576,  8, 0, 3, 2 },
-
-    { 1280, 720,  1, 0, 1, 7,  1, 1280, 720,  0, 0, 3, 3 },
-    { 1280, 720,  1, 0, 1, 6,  1, 1280, 720,  0, 0, 3, 3 },
-    { 1920, 1080, 1, 1, 1, 4,  1, 1920, 1080, 0, 0, 3, 3 },
-    { 1920, 1080, 1, 1, 1, 3,  1, 1920, 1080, 0, 0, 3, 3 },
-    { 1920, 1080, 1, 0, 1, 7,  1, 1920, 1080, 0, 0, 3, 3 },
-    { 1920, 1080, 1, 0, 1, 6,  1, 1920, 1080, 0, 0, 3, 3 },
-    { 2048, 1080, 0, 0, 1, 2,  1, 2048, 1080, 0, 0, 4, 4 },
-    { 4096, 2160, 0, 0, 1, 2,  1, 4096, 2160, 0, 0, 4, 4 },
-
-    { 3840, 2160, 1, 0, 1, 7,  1, 3840, 2160, 0, 0, 3, 3 },
-    { 3840, 2160, 1, 0, 1, 6,  1, 3840, 2160, 0, 0, 3, 3 },
-    { 7680, 4320, 1, 0, 1, 7,  1, 3840, 2160, 0, 0, 3, 3 },
-    { 7680, 4320, 1, 0, 1, 6,  1, 3840, 2160, 0, 0, 3, 3 },
-};
-
-static const AVRational dirac_preset_aspect_ratios[] = {
-    {1, 1},
-    {10, 11},
-    {12, 11},
-    {40, 33},
-    {16, 11},
-    {4, 3},
-};
-
-static const AVRational dirac_frame_rate[] = {
-    {15000, 1001},
-    {25, 2},
-};
-
-static const struct {
-    uint8_t             bitdepth;
-    enum AVColorRange   color_range;
-} pixel_range_presets[] = {
-    {8,  AVCOL_RANGE_JPEG},
-    {8,  AVCOL_RANGE_MPEG},
-    {10, AVCOL_RANGE_MPEG},
-    {12, AVCOL_RANGE_MPEG},
-};
-
-static const enum AVColorPrimaries dirac_primaries[] = {
-    AVCOL_PRI_BT709,
-    AVCOL_PRI_SMPTE170M,
-    AVCOL_PRI_BT470BG,
-};
-
-static const struct {
-    enum AVColorPrimaries color_primaries;
-    enum AVColorSpace colorspace;
-    enum AVColorTransferCharacteristic color_trc;
-} dirac_color_presets[] = {
-    { AVCOL_PRI_BT709,     AVCOL_SPC_BT709,   AVCOL_TRC_BT709 },
-    { AVCOL_PRI_SMPTE170M, AVCOL_SPC_BT470BG, AVCOL_TRC_BT709 },
-    { AVCOL_PRI_BT470BG,   AVCOL_SPC_BT470BG, AVCOL_TRC_BT709 },
-    { AVCOL_PRI_BT709,     AVCOL_SPC_BT709,   AVCOL_TRC_BT709 },
-    { AVCOL_PRI_BT709,     AVCOL_SPC_BT709,   AVCOL_TRC_UNSPECIFIED /* DCinema */ },
-};
-
-static const enum PixelFormat dirac_pix_fmt[2][3] = {
-    { PIX_FMT_YUV444P,  PIX_FMT_YUV422P,  PIX_FMT_YUV420P  },
-    { PIX_FMT_YUVJ444P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ420P },
-};
-
-static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
-                                   dirac_source_params *source)
-{
-    AVRational frame_rate = (AVRational){0,0};
-    unsigned luma_depth = 8, luma_offset = 16;
-    int idx;
-
-    if (get_bits1(gb)) {
-        source->width  = svq3_get_ue_golomb(gb);
-        source->height = svq3_get_ue_golomb(gb);
-    }
-
-    // chroma subsampling
-    if (get_bits1(gb))
-        source->chroma_format = svq3_get_ue_golomb(gb);
-    if (source->chroma_format > 2) {
-        av_log(avctx, AV_LOG_ERROR, "Unknown chroma format %d\n",
-               source->chroma_format);
-        return -1;
-    }
-
-    if (get_bits1(gb))
-        source->interlaced = svq3_get_ue_golomb(gb);
-    if (source->interlaced > 1)
-        return -1;
-
-    // frame rate
-    if (get_bits1(gb)) {
-        source->frame_rate_index = svq3_get_ue_golomb(gb);
-
-        if (source->frame_rate_index > 10)
-            return -1;
-
-        if (!source->frame_rate_index) {
-            frame_rate.num = svq3_get_ue_golomb(gb);
-            frame_rate.den = svq3_get_ue_golomb(gb);
-        }
-    }
-    if (source->frame_rate_index > 0) {
-        if (source->frame_rate_index <= 8)
-            frame_rate = ff_frame_rate_tab[source->frame_rate_index];
-        else
-            frame_rate = dirac_frame_rate[source->frame_rate_index-9];
-    }
-    av_reduce(&avctx->time_base.num, &avctx->time_base.den,
-              frame_rate.den, frame_rate.num, 1<<30);
-
-    // aspect ratio
-    if (get_bits1(gb)) {
-        source->aspect_ratio_index = svq3_get_ue_golomb(gb);
-
-        if (source->aspect_ratio_index > 6)
-            return -1;
-
-        if (!source->aspect_ratio_index) {
-            avctx->sample_aspect_ratio.num = svq3_get_ue_golomb(gb);
-            avctx->sample_aspect_ratio.den = svq3_get_ue_golomb(gb);
-        }
-    }
-    if (source->aspect_ratio_index > 0)
-        avctx->sample_aspect_ratio =
-                dirac_preset_aspect_ratios[source->aspect_ratio_index-1];
-
-    if (get_bits1(gb)) {
-        source->clean_width        = svq3_get_ue_golomb(gb);
-        source->clean_height       = svq3_get_ue_golomb(gb);
-        source->clean_left_offset  = svq3_get_ue_golomb(gb);
-        source->clean_right_offset = svq3_get_ue_golomb(gb);
-    }
-
-    // Override signal range.
-    if (get_bits1(gb)) {
-        source->pixel_range_index = svq3_get_ue_golomb(gb);
-
-        if (source->pixel_range_index > 4)
-            return -1;
-
-        // This assumes either fullrange or MPEG levels only
-        if (!source->pixel_range_index) {
-            luma_offset = svq3_get_ue_golomb(gb);
-            luma_depth  = av_log2(svq3_get_ue_golomb(gb))+1;
-            svq3_get_ue_golomb(gb); // chroma offset
-            svq3_get_ue_golomb(gb); // chroma excursion
-
-            avctx->color_range = luma_offset ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
-        }
-    }
-    if (source->pixel_range_index > 0) {
-        idx                = source->pixel_range_index-1;
-        luma_depth         = pixel_range_presets[idx].bitdepth;
-        avctx->color_range = pixel_range_presets[idx].color_range;
-    }
-
-    if (luma_depth > 8)
-        av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8");
-
-    avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format];
-
-    // color spec
-    if (get_bits1(gb)) {
-        idx = source->color_spec_index = svq3_get_ue_golomb(gb);
-
-        if (source->color_spec_index > 4)
-            return -1;
-
-        avctx->color_primaries = dirac_color_presets[idx].color_primaries;
-        avctx->colorspace      = dirac_color_presets[idx].colorspace;
-        avctx->color_trc       = dirac_color_presets[idx].color_trc;
-
-        if (!source->color_spec_index) {
-            if (get_bits1(gb)) {
-                idx = svq3_get_ue_golomb(gb);
-                if (idx < 3)
-                    avctx->color_primaries = dirac_primaries[idx];
-            }
-
-            if (get_bits1(gb)) {
-                idx = svq3_get_ue_golomb(gb);
-                if (!idx)
-                    avctx->colorspace = AVCOL_SPC_BT709;
-                else if (idx == 1)
-                    avctx->colorspace = AVCOL_SPC_BT470BG;
-            }
-
-            if (get_bits1(gb) && !svq3_get_ue_golomb(gb))
-                avctx->color_trc = AVCOL_TRC_BT709;
-        }
-    } else {
-        idx = source->color_spec_index;
-        avctx->color_primaries = dirac_color_presets[idx].color_primaries;
-        avctx->colorspace      = dirac_color_presets[idx].colorspace;
-        avctx->color_trc       = dirac_color_presets[idx].color_trc;
-    }
-
-    return 0;
-}
-
-int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
-                                   dirac_source_params *source)
-{
-    unsigned version_major, version_minor;
-    unsigned video_format, picture_coding_mode;
-
-    version_major  = svq3_get_ue_golomb(gb);
-    version_minor  = svq3_get_ue_golomb(gb);
-    avctx->profile = svq3_get_ue_golomb(gb);
-    avctx->level   = svq3_get_ue_golomb(gb);
-    video_format   = svq3_get_ue_golomb(gb);
-
-    if (version_major < 2)
-        av_log(avctx, AV_LOG_WARNING, "Stream is old and may not work\n");
-    else if (version_major > 2)
-        av_log(avctx, AV_LOG_WARNING, "Stream may have unhandled features\n");
-
-    if (video_format > 20)
-        return -1;
-
-    // Fill in defaults for the source parameters.
-    *source = dirac_source_parameters_defaults[video_format];
-
-    // Override the defaults.
-    if (parse_source_parameters(avctx, gb, source))
-        return -1;
-
-    if (avcodec_check_dimensions(avctx, source->width, source->height))
-        return -1;
-
-    avcodec_set_dimensions(avctx, source->width, source->height);
-
-    // currently only used to signal field coding
-    picture_coding_mode = svq3_get_ue_golomb(gb);
-    if (picture_coding_mode != 0) {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported picture coding mode %d",
-               picture_coding_mode);
-        return -1;
-    }
-    return 0;
-}
diff --git a/libavcodec/dirac.h b/libavcodec/dirac.h
deleted file mode 100644
index 09c5581..0000000
--- a/libavcodec/dirac.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2007 Marco Gerards <marco at gnu.org>
- * Copyright (C) 2009 David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DIRAC_H
-#define AVCODEC_DIRAC_H
-
-/**
- * @file
- * Interfaces to Dirac Decoder/Encoder
- * @author Marco Gerards <marco at gnu.org>
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-
-typedef struct {
-    unsigned width;
-    unsigned height;
-    uint8_t chroma_format;          ///< 0: 444  1: 422  2: 420
-
-    uint8_t interlaced;
-    uint8_t top_field_first;
-
-    uint8_t frame_rate_index;       ///< index into dirac_frame_rate[]
-    uint8_t aspect_ratio_index;     ///< index into dirac_aspect_ratio[]
-
-    uint16_t clean_width;
-    uint16_t clean_height;
-    uint16_t clean_left_offset;
-    uint16_t clean_right_offset;
-
-    uint8_t pixel_range_index;      ///< index into dirac_pixel_range_presets[]
-    uint8_t color_spec_index;       ///< index into dirac_color_spec_presets[]
-} dirac_source_params;
-
-int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb,
-                                   dirac_source_params *source);
-
-#endif /* AVCODEC_DIRAC_H */
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
deleted file mode 100644
index c82f0e6..0000000
--- a/libavcodec/dirac_parser.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Dirac parser
- *
- * Copyright (c) 2007-2008 Marco Gerards <marco at gnu.org>
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Dirac Parser
- * @author Marco Gerards <marco at gnu.org>
- */
-
-#include "libavutil/intreadwrite.h"
-#include "parser.h"
-
-#define DIRAC_PARSE_INFO_PREFIX 0x42424344
-
-/**
- * Finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame or -1
- */
-typedef struct DiracParseContext {
-    int state;
-    int is_synced;
-    int sync_offset;
-    int header_bytes_needed;
-    int overread_index;
-    int buffer_size;
-    int index;
-    uint8_t *buffer;
-    int dirac_unit_size;
-    uint8_t *dirac_unit;
-} DiracParseContext;
-
-static int find_frame_end(DiracParseContext *pc,
-                          const uint8_t *buf, int buf_size)
-{
-    uint32_t state = pc->state;
-    int i = 0;
-
-    if (!pc->is_synced) {
-        for (i = 0; i < buf_size; i++) {
-            state = (state << 8) | buf[i];
-            if (state == DIRAC_PARSE_INFO_PREFIX) {
-                state                   = -1;
-                pc->is_synced           = 1;
-                pc->header_bytes_needed = 9;
-                pc->sync_offset         = i;
-                break;
-            }
-        }
-    }
-
-    if (pc->is_synced) {
-        pc->sync_offset = 0;
-        for (; i < buf_size; i++) {
-            if (state == DIRAC_PARSE_INFO_PREFIX) {
-                if ((buf_size-i) >= pc->header_bytes_needed) {
-                    pc->state = -1;
-                    return i + pc->header_bytes_needed;
-                } else {
-                    pc->header_bytes_needed = 9-(buf_size-i);
-                    break;
-                }
-            } else
-              state = (state << 8) | buf[i];
-        }
-    }
-    pc->state = state;
-    return -1;
-}
-
-typedef struct DiracParseUnit
-{
-    int next_pu_offset;
-    int prev_pu_offset;
-    uint8_t pu_type;
-} DiracParseUnit;
-
-static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc,
-                             int offset)
-{
-    uint8_t *start = pc->buffer + offset;
-    uint8_t *end   = pc->buffer + pc->index;
-    if (start < pc->buffer || (start+13 > end))
-        return 0;
-    pu->pu_type = start[4];
-
-    pu->next_pu_offset = AV_RB32(start+5);
-    pu->prev_pu_offset = AV_RB32(start+9);
-
-    if (pu->pu_type == 0x10 && pu->next_pu_offset == 0)
-        pu->next_pu_offset = 13;
-
-    return 1;
-}
-
-static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
-                               int next, const uint8_t **buf, int *buf_size)
-{
-    int parse_timing_info = (s->pts == AV_NOPTS_VALUE &&
-                             s->dts == AV_NOPTS_VALUE);
-    DiracParseContext *pc = s->priv_data;
-
-    if (pc->overread_index) {
-        memcpy(pc->buffer, pc->buffer + pc->overread_index,
-               pc->index - pc->overread_index);
-        pc->index -= pc->overread_index;
-        pc->overread_index = 0;
-        if (*buf_size == 0 && pc->buffer[4] == 0x10) {
-            *buf      = pc->buffer;
-            *buf_size = pc->index;
-            return 0;
-        }
-    }
-
-    if ( next == -1) {
-        /* Found a possible frame start but not a frame end */
-        void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
-                                           pc->index + (*buf_size -
-                                                        pc->sync_offset));
-        pc->buffer = new_buffer;
-        memcpy(pc->buffer+pc->index, (*buf + pc->sync_offset),
-               *buf_size - pc->sync_offset);
-        pc->index += *buf_size - pc->sync_offset;
-        return -1;
-    } else {
-        /* Found a possible frame start and a  possible frame end */
-        DiracParseUnit pu1, pu;
-        void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
-                                           pc->index + next);
-        pc->buffer = new_buffer;
-        memcpy(pc->buffer + pc->index, *buf, next);
-        pc->index += next;
-
-        /* Need to check if we have a valid Parse Unit. We can't go by the
-         * sync pattern 'BBCD' alone because arithmetic coding of the residual
-         * and motion data can cause the pattern triggering a false start of
-         * frame. So check if the previous parse offset of the next parse unit
-         * is equal to the next parse offset of the current parse unit then
-         * we can be pretty sure that we have a valid parse unit */
-        if (!unpack_parse_unit(&pu1, pc, pc->index - 13)                     ||
-            !unpack_parse_unit(&pu, pc, pc->index - 13 - pu1.prev_pu_offset) ||
-            pu.next_pu_offset != pu1.prev_pu_offset) {
-            pc->index -= 9;
-            *buf_size = next-9;
-            pc->header_bytes_needed = 9;
-            return -1;
-        }
-
-        /* All non-frame data must be accompanied by frame data. This is to
-         * ensure that pts is set correctly. So if the current parse unit is
-         * not frame data, wait for frame data to come along */
-
-        pc->dirac_unit = pc->buffer + pc->index - 13 -
-                         pu1.prev_pu_offset - pc->dirac_unit_size;
-
-        pc->dirac_unit_size += pu.next_pu_offset;
-
-        if ((pu.pu_type&0x08) != 0x08) {
-            pc->header_bytes_needed = 9;
-            *buf_size = next;
-            return -1;
-        }
-
-        /* Get the picture number to set the pts and dts*/
-        if (parse_timing_info) {
-            uint8_t *cur_pu = pc->buffer +
-                              pc->index - 13 - pu1.prev_pu_offset;
-            int pts =  AV_RB32(cur_pu + 13);
-            if (s->last_pts == 0 && s->last_dts == 0)
-                s->dts = pts - 1;
-            else
-                s->dts = s->last_dts+1;
-            s->pts = pts;
-            if (!avctx->has_b_frames && (cur_pu[4] & 0x03))
-                avctx->has_b_frames = 1;
-        }
-        if (avctx->has_b_frames && s->pts == s->dts)
-             s->pict_type = FF_B_TYPE;
-
-        /* Finally have a complete Dirac data unit */
-        *buf      = pc->dirac_unit;
-        *buf_size = pc->dirac_unit_size;
-
-        pc->dirac_unit_size     = 0;
-        pc->overread_index      = pc->index-13;
-        pc->header_bytes_needed = 9;
-    }
-    return next;
-}
-
-static int dirac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
-                       const uint8_t **poutbuf, int *poutbuf_size,
-                       const uint8_t *buf, int buf_size)
-{
-    DiracParseContext *pc = s->priv_data;
-    int next;
-
-    *poutbuf = NULL;
-    *poutbuf_size = 0;
-
-    if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
-        next = buf_size;
-        *poutbuf = buf;
-        *poutbuf_size = buf_size;
-        /* Assume that data has been packetized into an encapsulation unit. */
-    } else {
-        next = find_frame_end(pc, buf, buf_size);
-        if (!pc->is_synced && next == -1) {
-            /* No frame start found yet. So throw away the entire buffer. */
-            return buf_size;
-        }
-
-        if (dirac_combine_frame(s, avctx, next, &buf, &buf_size) < 0) {
-            return buf_size;
-        }
-    }
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-static void dirac_parse_close(AVCodecParserContext *s)
-{
-    DiracParseContext *pc = s->priv_data;
-
-    if (pc->buffer_size > 0)
-        av_free(pc->buffer);
-}
-
-AVCodecParser dirac_parser = {
-    { CODEC_ID_DIRAC },
-    sizeof(DiracParseContext),
-    NULL,
-    dirac_parse,
-    dirac_parse_close,
-};
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
deleted file mode 100644
index 6149a2d..0000000
--- a/libavcodec/dnxhd_parser.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * DNxHD/VC-3 parser
- * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier at free.fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DNxHD/VC-3 parser
- */
-
-#include "parser.h"
-
-#define DNXHD_HEADER_PREFIX 0x0000028001
-
-static int dnxhd_find_frame_end(ParseContext *pc,
-                                const uint8_t *buf, int buf_size)
-{
-    uint64_t state = pc->state64;
-    int pic_found = pc->frame_start_found;
-    int i = 0;
-
-    if (!pic_found) {
-        for (i = 0; i < buf_size; i++) {
-            state = (state<<8) | buf[i];
-            if ((state & 0xffffffffffLL) == DNXHD_HEADER_PREFIX) {
-                i++;
-                pic_found = 1;
-                break;
-            }
-        }
-    }
-
-    if (pic_found) {
-        if (!buf_size) /* EOF considered as end of frame */
-            return 0;
-        for (; i < buf_size; i++) {
-            state = (state<<8) | buf[i];
-            if ((state & 0xffffffffffLL) == DNXHD_HEADER_PREFIX) {
-                pc->frame_start_found = 0;
-                pc->state64 = -1;
-                return i-4;
-            }
-        }
-    }
-    pc->frame_start_found = pic_found;
-    pc->state64 = state;
-    return END_NOT_FOUND;
-}
-
-static int dnxhd_parse(AVCodecParserContext *s,
-                       AVCodecContext *avctx,
-                       const uint8_t **poutbuf, int *poutbuf_size,
-                       const uint8_t *buf, int buf_size)
-{
-    ParseContext *pc = s->priv_data;
-    int next;
-
-    if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
-        next = buf_size;
-    } else {
-        next = dnxhd_find_frame_end(pc, buf, buf_size);
-        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-    }
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-AVCodecParser dnxhd_parser = {
-    { CODEC_ID_DNXHD },
-    sizeof(ParseContext),
-    NULL,
-    dnxhd_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
deleted file mode 100644
index 2625a9b..0000000
--- a/libavcodec/dnxhddata.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * VC3/DNxHD data.
- * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "dnxhddata.h"
-
-static const uint8_t dnxhd_1237_luma_weight[] = {
-     0,  32,  33,  34, 34, 36, 37, 36,
-    36,  37,  38,  38, 38, 39, 41, 44,
-    43,  41,  40,  41, 46, 49, 47, 46,
-    47,  49,  51,  54, 60, 62, 59, 55,
-    54,  56,  58,  61, 65, 66, 64, 63,
-    66,  73,  78,  79, 80, 79, 78, 78,
-    82,  87,  89,  90, 93, 95, 96, 97,
-    97, 100, 104, 102, 98, 98, 99, 99,
-};
-
-static const uint8_t dnxhd_1237_chroma_weight[] = {
-     0,  32,  36,  39, 39, 38, 39,  41,
-    45,  51,  57,  58, 53, 48, 47,  51,
-    55,  58,  66,  75, 81, 83, 82,  78,
-    73,  72,  74,  77, 83, 85, 83,  82,
-    89,  99,  96,  90, 94, 97, 99, 105,
-   109, 105,  95,  89, 92, 95, 94,  93,
-    92,  88,  89,  90, 93, 95, 96,  97,
-    97, 100, 104, 102, 98, 98, 99,  99,
-};
-
-static const uint8_t dnxhd_1238_luma_weight[] = {
-     0, 32, 32, 33, 34, 33, 33, 33,
-    33, 33, 33, 33, 33, 35, 37, 37,
-    36, 36, 35, 36, 38, 38, 36, 35,
-    36, 37, 38, 41, 42, 41, 39, 38,
-    38, 38, 39, 41, 42, 41, 39, 39,
-    40, 41, 43, 44, 44, 44, 44, 44,
-    45, 47, 47, 47, 49, 50, 51, 51,
-    51, 53, 55, 57, 58, 59, 57, 57,
-};
-
-static const uint8_t dnxhd_1238_chroma_weight[] = {
-     0, 32, 35, 35, 35, 34, 34, 35,
-    39, 43, 45, 45, 41, 39, 40, 41,
-    42, 44, 48, 55, 59, 63, 65, 59,
-    53, 52, 52, 55, 61, 62, 58, 58,
-    63, 66, 66, 65, 70, 74, 70, 66,
-    65, 68, 75, 77, 74, 74, 77, 76,
-    73, 73, 73, 73, 76, 80, 89, 90,
-    82, 77, 80, 86, 84, 82, 82, 82,
-};
-
-static const uint8_t dnxhd_1241_luma_weight[] = {
-     0, 32, 33, 34, 34, 35, 36, 37,
-    36, 37, 38, 38, 38, 39, 39, 40,
-    40, 38, 38, 39, 38, 37, 39, 41,
-    41, 42, 43, 45, 45, 46, 47, 46,
-    45, 43, 39, 37, 37, 40, 44, 45,
-    45, 46, 46, 46, 47, 47, 46, 44,
-    42, 43, 45, 47, 48, 49, 50, 49,
-    48, 46, 47, 48, 48, 49, 49, 49,
-};
-
-static const uint8_t dnxhd_1241_chroma_weight[] = {
-     0, 32, 36, 38, 37, 37, 40, 41,
-    40, 40, 42, 42, 41, 41, 41, 41,
-    42, 43, 44, 44, 45, 46, 46, 45,
-    44, 45, 45, 45, 45, 46, 47, 46,
-    45, 44, 42, 41, 43, 45, 45, 47,
-    48, 48, 48, 46, 47, 47, 46, 47,
-    46, 45, 45, 47, 48, 49, 50, 49,
-    48, 46, 48, 49, 48, 49, 49, 49,
-};
-
-static const uint8_t dnxhd_1242_luma_weight[] = {
-     0, 32, 33, 33, 34, 35, 36, 35,
-    33, 33, 35, 36, 37, 37, 38, 37,
-    37, 37, 36, 37, 37, 37, 38, 39,
-    37, 36, 37, 40, 42, 45, 46, 44,
-    41, 42, 44, 45, 47, 49, 50, 48,
-    46, 48, 49, 50, 52, 52, 50, 49,
-    47, 48, 50, 50, 51, 51, 50, 49,
-    49, 51, 52, 51, 49, 47, 47, 47,
-};
-
-static const uint8_t dnxhd_1242_chroma_weight[] = {
-     0, 32, 37, 42, 45, 45, 45, 44,
-    38, 37, 40, 42, 44, 49, 51, 47,
-    41, 40, 43, 44, 46, 48, 51, 54,
-    51, 47, 47, 45, 47, 50, 51, 49,
-    46, 47, 49, 47, 50, 55, 55, 51,
-    48, 49, 51, 51, 52, 52, 54, 54,
-    49, 49, 52, 53, 54, 54, 53, 53,
-    55, 59, 63, 62, 60, 60, 60, 60,
- };
-
-static const uint8_t dnxhd_1243_luma_weight[] = {
-     0, 32, 32, 33, 33, 35, 35, 35,
-    35, 35, 35, 35, 34, 35, 38, 40,
-    39, 37, 37, 37, 36, 35, 36, 38,
-    40, 41, 42, 44, 45, 44, 42, 41,
-    40, 38, 36, 36, 37, 38, 40, 43,
-    44, 45, 45, 45, 45, 45, 45, 41,
-    39, 41, 45, 47, 47, 48, 48, 48,
-    46, 44, 45, 47, 47, 48, 47, 47,
-};
-
-static const uint8_t dnxhd_1243_chroma_weight[] = {
-     0, 32, 36, 37, 36, 37, 39, 39,
-    41, 43, 43, 42, 41, 41, 41, 42,
-    43, 43, 43, 44, 44, 44, 46, 47,
-    46, 45, 45, 45, 45, 46, 44, 44,
-    45, 44, 42, 41, 43, 46, 45, 44,
-    45, 45, 45, 46, 46, 46, 45, 44,
-    45, 44, 45, 47, 47, 48, 49, 48,
-    46, 45, 46, 47, 47, 48, 47, 47,
-};
-
-static const uint8_t dnxhd_1251_luma_weight[] = {
-     0, 32, 32, 34, 34, 34, 34, 35,
-    35, 35, 36, 37, 36, 36, 35, 36,
-    38, 38, 38, 38, 38, 38, 38, 38,
-    38, 38, 39, 41, 44, 43, 41, 40,
-    40, 40, 40, 39, 40, 41, 40, 39,
-    40, 43, 46, 46, 44, 44, 44, 42,
-    41, 43, 46, 48, 50, 55, 58, 53,
-    48, 50, 55, 58, 61, 62, 62, 62,
-};
-
-static const uint8_t dnxhd_1251_chroma_weight[] = {
-     0, 32, 35, 36, 36, 35, 36, 39,
-    41, 43, 45, 44, 41, 39, 40, 42,
-    43, 43, 45, 48, 48, 48, 50, 50,
-    50, 51, 51, 51, 51, 52, 53, 54,
-    51, 49, 51, 52, 52, 56, 57, 55,
-    54, 54, 55, 56, 55, 58, 58, 58,
-    60, 61, 62, 62, 59, 57, 58, 58,
-    61, 59, 59, 59, 61, 62, 62, 62,
-};
-
-static const uint8_t dnxhd_1252_luma_weight[] = {
-      0,  32,  34, 35, 36, 36, 36, 37,
-     36,  37,  39, 40, 41, 40, 40, 40,
-     41,  41,  42, 41, 41, 43, 44, 44,
-     45,  46,  48, 55, 60, 57, 52, 50,
-     49,  49,  52, 52, 53, 55, 58, 62,
-     65,  73,  82, 82, 80, 78, 73, 68,
-     71,  82,  90, 90, 88, 87, 90, 95,
-    100, 107, 103, 97, 95, 93, 99, 99,
-};
-static const uint8_t dnxhd_1252_chroma_weight[] = {
-      0,  32,  35,  36,  37,  37,  38,  40,
-     42,  46,  49,  50,  50,  49,  49,  53,
-     56,  56,  57,  58,  60,  62,  64,  65,
-     63,  64,  64,  65,  66,  65,  67,  71,
-     72,  74,  74,  74,  74,  77,  81,  78,
-     72,  73,  82,  85,  89,  88,  84,  80,
-     90, 100,  90,  90,  88,  87,  90,  95,
-    114, 128, 125, 129, 134, 125, 116, 116,
-};
-
-static const uint8_t dnxhd_1237_dc_codes[12] = {
-    0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
-};
-
-static const uint8_t dnxhd_1237_dc_bits[12] = {
-    3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
-};
-
-static const uint16_t dnxhd_1237_ac_codes[257] = {
-    0, 1, 4, 5, 12, 26, 27, 56, 57, 58, 59, 120, 121, 244, 245, 246, 247, 248, 498, 499, 500, 501, 502, 1006, 1007, 1008, 1009, 1010, 1011, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 32668, 32669, 32670, 32671, 32672, 32673, 32674, 32675, 32676, 32677, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 65370, 65371, 65372, 65373, 65374, 65375, 65376, 65377, 65378, 65379, 65380, 65381, 65382, 65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390, 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398, 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406, 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414, 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
-};
-
-static const uint8_t dnxhd_1237_ac_bits[257] = {
-    2, 2, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-};
-
-static const uint8_t dnxhd_1237_ac_level[257] = {
-    1, 1, 2, 0, 3, 4, 2, 5, 6, 7, 3, 8, 9, 10, 11, 12, 4, 5, 13, 14, 15, 16, 6, 17, 18, 19, 20, 21, 7, 22, 23, 24, 25, 26, 27, 8, 9, 28, 29, 30, 31, 32, 33, 34, 10, 11, 12, 35, 36, 37, 38, 39, 40, 41, 13, 14, 15, 16, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 17, 18, 19, 20, 21, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 1, 22, 23, 24, 25, 26, 27, 62, 63, 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, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64,
-};
-
-static const uint8_t dnxhd_1237_ac_run_flag[257] = {
-    0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-static const uint8_t dnxhd_1237_ac_index_flag[257] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-static const uint16_t dnxhd_1237_run_codes[62] = {
-    0, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 58, 118, 119, 240, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023,
-};
-
-static const uint8_t dnxhd_1237_run_bits[62] = {
-    1, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-};
-
-static const uint8_t dnxhd_1237_run[62] = {
-    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 53, 57, 58, 59, 60, 61, 62, 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, 54, 55, 56,
-};
-
-static const uint8_t dnxhd_1238_dc_codes[12] = {
-    0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
-};
-
-static const uint8_t dnxhd_1238_dc_bits[12] = {
-    3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
-};
-
-static const uint16_t dnxhd_1238_ac_codes[257] = {
-    0, 1, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 116, 117, 118, 119, 240, 241, 242, 243, 244, 245, 492, 493, 494, 495, 496, 497, 498, 499, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 16314, 16315, 16316, 16317, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337, 16338, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705, 65412, 65413, 65414, 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
-};
-
-static const uint8_t dnxhd_1238_ac_bits[257] = {
-    2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-};
-
-static const uint8_t dnxhd_1238_ac_level[257] = {
-    1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 22, 6, 7, 23, 24, 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 10, 11, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 12, 13, 14, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 15, 16, 17, 18, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 40, 25, 26, 27, 28, 29, 30, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64,
-}; /* 0 is EOB */
-
-static const uint8_t dnxhd_1238_ac_run_flag[257] = {
-    0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-static const uint8_t dnxhd_1238_ac_index_flag[257] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-static const uint16_t dnxhd_1238_run_codes[62] = {
-    0, 4, 10, 11, 24, 25, 26, 27, 56, 57, 58, 59, 120, 242, 486, 487, 488, 489, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023,
-};
-
-static const uint8_t dnxhd_1238_run_bits[62] = {
-    1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-};
-
-static const uint8_t dnxhd_1238_run[62] = {
-    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 21, 17, 18, 19, 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, 57, 58, 59, 60, 61, 62,
-};
-
-static const uint8_t dnxhd_1241_dc_codes[14] = {
-    10, 62, 11, 12, 13, 0, 1, 2, 3, 4, 14, 30, 126, 127,
-};
-
-static const uint8_t dnxhd_1241_dc_bits[14] = {
-    4, 6, 4, 4, 4, 3, 3, 3, 3, 3, 4, 5, 7, 7,
-};
-static const uint16_t dnxhd_1241_ac_codes[257] = {
-    0, 1, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 116, 117, 118, 119, 240, 241, 242, 243, 244, 245, 492, 493, 494, 495, 496, 497, 498, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 16316, 16317, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337, 32676, 32677, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705, 32706, 32707, 32708, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
-};
-
-static const uint8_t dnxhd_1241_ac_bits[257] = {
-    2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-};
-
-static const uint8_t dnxhd_1241_ac_level[257] = {
-    1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 7, 22, 23, 24, 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 38, 10, 11, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 12, 13, 14, 15, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 1, 16, 17, 18, 19, 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 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, 25, 26, 27, 28, 29, 30, 31, 32, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64,
-};
-
-static const uint8_t dnxhd_1241_ac_run_flag[257] = {
-    0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-static const uint8_t dnxhd_1241_ac_index_flag[257] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-static const uint8_t dnxhd_1241_run[62] = {
-    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 17, 19, 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, 57, 58, 59, 60, 61, 62,
-};
-
-static const uint8_t dnxhd_1251_dc_codes[12] = {
-    0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
-};
-static const uint8_t dnxhd_1251_dc_bits[12] = {
-    3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
-};
-static const uint16_t dnxhd_1251_ac_codes[257] = {
-    0, 1, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 116, 117, 118, 119, 240, 241, 242, 243, 244, 245, 492, 493, 494, 495, 496, 497, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 16314, 16315, 16316, 16317, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337, 16338, 16339, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705, 32706, 32707, 32708, 32709, 32710, 32711, 32712, 32713, 32714, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
-};
-static const uint8_t dnxhd_1251_ac_bits[257] = {
-    2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-};
-static const uint8_t dnxhd_1251_ac_level[257] = {
-    1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 22, 23, 24, 25, 26, 27, 28, 29, 7, 8, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 9, 10, 11, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 12, 13, 14, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 15, 16, 17, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 19, 20, 21, 22, 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, 57, 58, 23, 24, 25, 26, 27, 28, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64,
-};
-static const uint8_t dnxhd_1251_ac_run_flag[257] = {
-    0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-static const uint8_t dnxhd_1251_ac_index_flag[257] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-static const uint16_t dnxhd_1251_run_codes[62] = {
-    0, 4, 5, 12, 26, 27, 28, 58, 118, 119, 120, 242, 486, 487, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023,
-};
-static const uint8_t dnxhd_1251_run_bits[62] = {
-    1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-};
-static const uint8_t dnxhd_1251_run[62] = {
-    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, 57, 58, 59, 60, 61, 62,
-};
-
-static const uint8_t dnxhd_1252_dc_codes[12] = {
-    0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
-};
-static const uint8_t dnxhd_1252_dc_bits[12] = {
-    3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
-};
-static const uint16_t dnxhd_1252_ac_codes[257] = {
-    0, 1, 4, 10, 11, 12, 26, 27, 56, 57, 58, 118, 119, 120, 242, 243, 244, 245, 246, 247, 496, 497, 498, 499, 500, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 32672, 32673, 32674, 32675, 32676, 32677, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 65390, 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398, 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406, 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414, 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
-};
-static const uint8_t dnxhd_1252_ac_bits[257] = {
-    2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-};
-static const uint8_t dnxhd_1252_ac_level[257] = {
-    1, 1, 2, 3, 2, 0, 4, 5, 6, 7, 3, 8, 9, 10, 11, 12, 13, 14, 4, 5, 15, 16, 17, 18, 6, 19, 20, 21, 22, 23, 24, 7, 8, 25, 26, 27, 28, 29, 30, 31, 32, 9, 10, 33, 34, 35, 36, 37, 38, 39, 40, 41, 11, 12, 13, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 14, 15, 16, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 17, 18, 19, 20, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 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, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64, 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, 57, 58, 59, 60, 61, 62, 63, 64,
-};
-static const uint8_t dnxhd_1252_ac_run_flag[257] = {
-    0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-static const uint8_t dnxhd_1252_ac_index_flag[257] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-const CIDEntry ff_dnxhd_cid_table[] = {
-    { 1237, 1920, 1080, 0, 606208, 606208, 4, 8,
-      dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
-      dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
-      dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
-      dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
-      dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
-      { 115, 120, 145, 240, 290 } },
-    { 1238, 1920, 1080, 0, 917504, 917504, 4, 8,
-      dnxhd_1238_luma_weight, dnxhd_1238_chroma_weight,
-      dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
-      dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
-      dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
-      dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run,
-      { 175, 185, 220, 365, 440 } },
-    { 1241, 1920, 1080, 1, 917504, 458752, 6, 10,
-      dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight,
-      dnxhd_1241_dc_codes, dnxhd_1241_dc_bits,
-      dnxhd_1241_ac_codes, dnxhd_1241_ac_bits, dnxhd_1241_ac_level,
-      dnxhd_1241_ac_run_flag, dnxhd_1241_ac_index_flag,
-      dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1241_run,
-      { 185, 220 } },
-    { 1242, 1920, 1080, 1, 606208, 303104, 4, 8,
-      dnxhd_1242_luma_weight, dnxhd_1242_chroma_weight,
-      dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
-      dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
-      dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
-      dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
-      { 120, 145 } },
-    { 1243, 1920, 1080, 1, 917504, 458752, 4, 8,
-      dnxhd_1243_luma_weight, dnxhd_1243_chroma_weight,
-      dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
-      dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
-      dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
-      dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run,
-      { 185, 220 } },
-    { 1251, 1280,  720, 0, 458752, 458752, 4, 8,
-      dnxhd_1251_luma_weight, dnxhd_1251_chroma_weight,
-      dnxhd_1251_dc_codes, dnxhd_1251_dc_bits,
-      dnxhd_1251_ac_codes, dnxhd_1251_ac_bits, dnxhd_1251_ac_level,
-      dnxhd_1251_ac_run_flag, dnxhd_1251_ac_index_flag,
-      dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
-      { 90, 110, 175, 220 } },
-    { 1252, 1280,  720, 0, 303104, 303104, 4, 8,
-      dnxhd_1252_luma_weight, dnxhd_1252_chroma_weight,
-      dnxhd_1252_dc_codes, dnxhd_1252_dc_bits,
-      dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level,
-      dnxhd_1252_ac_run_flag, dnxhd_1252_ac_index_flag,
-      dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
-      { 60, 75, 115, 145 } },
-    { 1253, 1920, 1080, 0, 188416, 188416, 4, 8,
-      dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
-      dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
-      dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
-      dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
-      dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
-      { 36, 45, 75, 90 } },
-};
-
-int ff_dnxhd_get_cid_table(int cid)
-{
-    int i;
-    for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++)
-        if (ff_dnxhd_cid_table[i].cid == cid)
-            return i;
-    return -1;
-}
-
-int ff_dnxhd_find_cid(AVCodecContext *avctx)
-{
-    int i, j;
-    int mbs = avctx->bit_rate/1000000;
-    if (!mbs)
-        return 0;
-    for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
-        const CIDEntry *cid = &ff_dnxhd_cid_table[i];
-        if (cid->width == avctx->width && cid->height == avctx->height &&
-            cid->interlaced == !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT) &&
-            cid->bit_depth == 8) { // until 10 bit is supported
-            for (j = 0; j < sizeof(cid->bit_rates); j++) {
-                if (cid->bit_rates[j] == mbs)
-                    return cid->cid;
-            }
-        }
-    }
-    return 0;
-}
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
deleted file mode 100644
index 32c77db..0000000
--- a/libavcodec/dnxhddata.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * VC3/DNxHD decoder.
- * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DNXHDDATA_H
-#define AVCODEC_DNXHDDATA_H
-
-#include <stdint.h>
-#include "avcodec.h"
-
-typedef struct {
-    int cid;
-    unsigned int width, height;
-    int interlaced;
-    unsigned int frame_size;
-    unsigned int coding_unit_size;
-    int index_bits;
-    int bit_depth;
-    const uint8_t *luma_weight, *chroma_weight;
-    const uint8_t *dc_codes, *dc_bits;
-    const uint16_t *ac_codes;
-    const uint8_t *ac_bits, *ac_level;
-    const uint8_t *ac_run_flag, *ac_index_flag;
-    const uint16_t *run_codes;
-    const uint8_t *run_bits, *run;
-    int bit_rates[5]; ///< Helpher to choose variants, rounded to nearest 5Mb/s
-} CIDEntry;
-
-extern const CIDEntry ff_dnxhd_cid_table[];
-
-int ff_dnxhd_get_cid_table(int cid);
-int ff_dnxhd_find_cid(AVCodecContext *avctx);
-
-#endif /* AVCODEC_DNXHDDATA_H */
diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
deleted file mode 100644
index 8b7c343..0000000
--- a/libavcodec/dnxhddec.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * VC3/DNxHD decoder.
- * Copyright (c) 2007 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define TRACE
-//#define DEBUG
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dnxhddata.h"
-#include "dsputil.h"
-
-typedef struct {
-    AVCodecContext *avctx;
-    AVFrame picture;
-    GetBitContext gb;
-    int cid;                            ///< compression id
-    unsigned int width, height;
-    unsigned int mb_width, mb_height;
-    uint32_t mb_scan_index[68];         /* max for 1080p */
-    int cur_field;                      ///< current interlaced field
-    VLC ac_vlc, dc_vlc, run_vlc;
-    int last_dc[3];
-    DSPContext dsp;
-    DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64];
-    ScanTable scantable;
-    const CIDEntry *cid_table;
-} DNXHDContext;
-
-#define DNXHD_VLC_BITS 9
-#define DNXHD_DC_VLC_BITS 7
-
-static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
-{
-    DNXHDContext *ctx = avctx->priv_data;
-
-    ctx->avctx = avctx;
-    dsputil_init(&ctx->dsp, avctx);
-    avctx->coded_frame = &ctx->picture;
-    ctx->picture.type = FF_I_TYPE;
-    return 0;
-}
-
-static int dnxhd_init_vlc(DNXHDContext *ctx, int cid)
-{
-    if (!ctx->cid_table) {
-        int index;
-
-        if ((index = ff_dnxhd_get_cid_table(cid)) < 0) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %d\n", cid);
-            return -1;
-        }
-        ctx->cid_table = &ff_dnxhd_cid_table[index];
-        init_vlc(&ctx->ac_vlc, DNXHD_VLC_BITS, 257,
-                 ctx->cid_table->ac_bits, 1, 1,
-                 ctx->cid_table->ac_codes, 2, 2, 0);
-        init_vlc(&ctx->dc_vlc, DNXHD_DC_VLC_BITS, ctx->cid_table->bit_depth+4,
-                 ctx->cid_table->dc_bits, 1, 1,
-                 ctx->cid_table->dc_codes, 1, 1, 0);
-        init_vlc(&ctx->run_vlc, DNXHD_VLC_BITS, 62,
-                 ctx->cid_table->run_bits, 1, 1,
-                 ctx->cid_table->run_codes, 2, 2, 0);
-
-        ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, ff_zigzag_direct);
-    }
-    return 0;
-}
-
-static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_size, int first_field)
-{
-    static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
-    int i;
-
-    if (buf_size < 0x280)
-        return -1;
-
-    if (memcmp(buf, header_prefix, 5)) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "error in header\n");
-        return -1;
-    }
-    if (buf[5] & 2) { /* interlaced */
-        ctx->cur_field = buf[5] & 1;
-        ctx->picture.interlaced_frame = 1;
-        ctx->picture.top_field_first = first_field ^ ctx->cur_field;
-        av_log(ctx->avctx, AV_LOG_DEBUG, "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field);
-    }
-
-    ctx->height = AV_RB16(buf + 0x18);
-    ctx->width  = AV_RB16(buf + 0x1a);
-
-    dprintf(ctx->avctx, "width %d, heigth %d\n", ctx->width, ctx->height);
-
-    if (buf[0x21] & 0x40) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "10 bit per component\n");
-        return -1;
-    }
-
-    ctx->cid = AV_RB32(buf + 0x28);
-    dprintf(ctx->avctx, "compression id %d\n", ctx->cid);
-
-    if (dnxhd_init_vlc(ctx, ctx->cid) < 0)
-        return -1;
-
-    if (buf_size < ctx->cid_table->coding_unit_size) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size\n");
-        return -1;
-    }
-
-    ctx->mb_width = ctx->width>>4;
-    ctx->mb_height = buf[0x16d];
-
-    dprintf(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
-
-    if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame)
-        ctx->height <<= 1;
-
-    if (ctx->mb_height > 68 ||
-        (ctx->mb_height<<ctx->picture.interlaced_frame) > (ctx->height+15)>>4) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height);
-        return -1;
-    }
-
-    for (i = 0; i < ctx->mb_height; i++) {
-        ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2));
-        dprintf(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
-        if (buf_size < ctx->mb_scan_index[i] + 0x280) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n");
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-static int dnxhd_decode_dc(DNXHDContext *ctx)
-{
-    int len;
-
-    len = get_vlc2(&ctx->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1);
-    return len ? get_xbits(&ctx->gb, len) : 0;
-}
-
-static void dnxhd_decode_dct_block(DNXHDContext *ctx, DCTELEM *block, int n, int qscale)
-{
-    int i, j, index, index2;
-    int level, component, sign;
-    const uint8_t *weigth_matrix;
-
-    if (n&2) {
-        component = 1 + (n&1);
-        weigth_matrix = ctx->cid_table->chroma_weight;
-    } else {
-        component = 0;
-        weigth_matrix = ctx->cid_table->luma_weight;
-    }
-
-    ctx->last_dc[component] += dnxhd_decode_dc(ctx);
-    block[0] = ctx->last_dc[component];
-    //av_log(ctx->avctx, AV_LOG_DEBUG, "dc %d\n", block[0]);
-    for (i = 1; ; i++) {
-        index = get_vlc2(&ctx->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2);
-        //av_log(ctx->avctx, AV_LOG_DEBUG, "index %d\n", index);
-        level = ctx->cid_table->ac_level[index];
-        if (!level) { /* EOB */
-            //av_log(ctx->avctx, AV_LOG_DEBUG, "EOB\n");
-            return;
-        }
-        sign = get_sbits(&ctx->gb, 1);
-
-        if (ctx->cid_table->ac_index_flag[index]) {
-            level += get_bits(&ctx->gb, ctx->cid_table->index_bits)<<6;
-        }
-
-        if (ctx->cid_table->ac_run_flag[index]) {
-            index2 = get_vlc2(&ctx->gb, ctx->run_vlc.table, DNXHD_VLC_BITS, 2);
-            i += ctx->cid_table->run[index2];
-        }
-
-        if (i > 63) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
-            return;
-        }
-
-        j = ctx->scantable.permutated[i];
-        //av_log(ctx->avctx, AV_LOG_DEBUG, "j %d\n", j);
-        //av_log(ctx->avctx, AV_LOG_DEBUG, "level %d, weigth %d\n", level, weigth_matrix[i]);
-        level = (2*level+1) * qscale * weigth_matrix[i];
-        if (ctx->cid_table->bit_depth == 10) {
-            if (weigth_matrix[i] != 8)
-                level += 8;
-            level >>= 4;
-        } else {
-            if (weigth_matrix[i] != 32)
-                level += 32;
-            level >>= 6;
-        }
-        //av_log(NULL, AV_LOG_DEBUG, "i %d, j %d, end level %d\n", i, j, level);
-        block[j] = (level^sign) - sign;
-    }
-}
-
-static int dnxhd_decode_macroblock(DNXHDContext *ctx, int x, int y)
-{
-    int dct_linesize_luma   = ctx->picture.linesize[0];
-    int dct_linesize_chroma = ctx->picture.linesize[1];
-    uint8_t *dest_y, *dest_u, *dest_v;
-    int dct_offset;
-    int qscale, i;
-
-    qscale = get_bits(&ctx->gb, 11);
-    skip_bits1(&ctx->gb);
-    //av_log(ctx->avctx, AV_LOG_DEBUG, "qscale %d\n", qscale);
-
-    for (i = 0; i < 8; i++) {
-        ctx->dsp.clear_block(ctx->blocks[i]);
-        dnxhd_decode_dct_block(ctx, ctx->blocks[i], i, qscale);
-    }
-
-    if (ctx->picture.interlaced_frame) {
-        dct_linesize_luma   <<= 1;
-        dct_linesize_chroma <<= 1;
-    }
-
-    dest_y = ctx->picture.data[0] + ((y * dct_linesize_luma)   << 4) + (x << 4);
-    dest_u = ctx->picture.data[1] + ((y * dct_linesize_chroma) << 4) + (x << 3);
-    dest_v = ctx->picture.data[2] + ((y * dct_linesize_chroma) << 4) + (x << 3);
-
-    if (ctx->cur_field) {
-        dest_y += ctx->picture.linesize[0];
-        dest_u += ctx->picture.linesize[1];
-        dest_v += ctx->picture.linesize[2];
-    }
-
-    dct_offset = dct_linesize_luma << 3;
-    ctx->dsp.idct_put(dest_y,                  dct_linesize_luma, ctx->blocks[0]);
-    ctx->dsp.idct_put(dest_y + 8,              dct_linesize_luma, ctx->blocks[1]);
-    ctx->dsp.idct_put(dest_y + dct_offset,     dct_linesize_luma, ctx->blocks[4]);
-    ctx->dsp.idct_put(dest_y + dct_offset + 8, dct_linesize_luma, ctx->blocks[5]);
-
-    if (!(ctx->avctx->flags & CODEC_FLAG_GRAY)) {
-        dct_offset = dct_linesize_chroma << 3;
-        ctx->dsp.idct_put(dest_u,              dct_linesize_chroma, ctx->blocks[2]);
-        ctx->dsp.idct_put(dest_v,              dct_linesize_chroma, ctx->blocks[3]);
-        ctx->dsp.idct_put(dest_u + dct_offset, dct_linesize_chroma, ctx->blocks[6]);
-        ctx->dsp.idct_put(dest_v + dct_offset, dct_linesize_chroma, ctx->blocks[7]);
-    }
-
-    return 0;
-}
-
-static int dnxhd_decode_macroblocks(DNXHDContext *ctx, const uint8_t *buf, int buf_size)
-{
-    int x, y;
-    for (y = 0; y < ctx->mb_height; y++) {
-        ctx->last_dc[0] =
-        ctx->last_dc[1] =
-        ctx->last_dc[2] = 1<<(ctx->cid_table->bit_depth+2); // for levels +2^(bitdepth-1)
-        init_get_bits(&ctx->gb, buf + ctx->mb_scan_index[y], (buf_size - ctx->mb_scan_index[y]) << 3);
-        for (x = 0; x < ctx->mb_width; x++) {
-            //START_TIMER;
-            dnxhd_decode_macroblock(ctx, x, y);
-            //STOP_TIMER("decode macroblock");
-        }
-    }
-    return 0;
-}
-
-static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    DNXHDContext *ctx = avctx->priv_data;
-    AVFrame *picture = data;
-    int first_field = 1;
-
-    dprintf(avctx, "frame size %d\n", buf_size);
-
- decode_coding_unit:
-    if (dnxhd_decode_header(ctx, buf, buf_size, first_field) < 0)
-        return -1;
-
-    if ((avctx->width || avctx->height) &&
-        (ctx->width != avctx->width || ctx->height != avctx->height)) {
-        av_log(avctx, AV_LOG_WARNING, "frame size changed: %dx%d -> %dx%d\n",
-               avctx->width, avctx->height, ctx->width, ctx->height);
-        first_field = 1;
-    }
-
-    avctx->pix_fmt = PIX_FMT_YUV422P;
-    if (avcodec_check_dimensions(avctx, ctx->width, ctx->height))
-        return -1;
-    avcodec_set_dimensions(avctx, ctx->width, ctx->height);
-
-    if (first_field) {
-        if (ctx->picture.data[0])
-            avctx->release_buffer(avctx, &ctx->picture);
-        if (avctx->get_buffer(avctx, &ctx->picture) < 0) {
-            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-            return -1;
-        }
-    }
-
-    dnxhd_decode_macroblocks(ctx, buf + 0x280, buf_size - 0x280);
-
-    if (first_field && ctx->picture.interlaced_frame) {
-        buf      += ctx->cid_table->coding_unit_size;
-        buf_size -= ctx->cid_table->coding_unit_size;
-        first_field = 0;
-        goto decode_coding_unit;
-    }
-
-    *picture = ctx->picture;
-    *data_size = sizeof(AVPicture);
-    return buf_size;
-}
-
-static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
-{
-    DNXHDContext *ctx = avctx->priv_data;
-
-    if (ctx->picture.data[0])
-        avctx->release_buffer(avctx, &ctx->picture);
-    free_vlc(&ctx->ac_vlc);
-    free_vlc(&ctx->dc_vlc);
-    free_vlc(&ctx->run_vlc);
-    return 0;
-}
-
-AVCodec dnxhd_decoder = {
-    "dnxhd",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DNXHD,
-    sizeof(DNXHDContext),
-    dnxhd_decode_init,
-    NULL,
-    dnxhd_decode_close,
-    dnxhd_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
-};
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
deleted file mode 100644
index 6b08929..0000000
--- a/libavcodec/dnxhdenc.c
+++ /dev/null
@@ -1,861 +0,0 @@
-/*
- * VC3/DNxHD encoder
- * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * VC-3 encoder funded by the British Broadcasting Corporation
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define DEBUG
-#define RC_VARIANCE 1 // use variance or ssd for fast rc
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "dnxhdenc.h"
-
-int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-
-#define LAMBDA_FRAC_BITS 10
-
-static av_always_inline void dnxhd_get_pixels_8x4(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
-{
-    int i;
-    for (i = 0; i < 4; i++) {
-        block[0] = pixels[0]; block[1] = pixels[1];
-        block[2] = pixels[2]; block[3] = pixels[3];
-        block[4] = pixels[4]; block[5] = pixels[5];
-        block[6] = pixels[6]; block[7] = pixels[7];
-        pixels += line_size;
-        block += 8;
-    }
-    memcpy(block   , block- 8, sizeof(*block)*8);
-    memcpy(block+ 8, block-16, sizeof(*block)*8);
-    memcpy(block+16, block-24, sizeof(*block)*8);
-    memcpy(block+24, block-32, sizeof(*block)*8);
-}
-
-static int dnxhd_init_vlc(DNXHDEncContext *ctx)
-{
-    int i, j, level, run;
-    int max_level = 1<<(ctx->cid_table->bit_depth+2);
-
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_codes, max_level*4*sizeof(*ctx->vlc_codes), fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->vlc_bits , max_level*4*sizeof(*ctx->vlc_bits ), fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_codes, 63*2                               , fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->run_bits , 63                                 , fail);
-
-    ctx->vlc_codes += max_level*2;
-    ctx->vlc_bits  += max_level*2;
-    for (level = -max_level; level < max_level; level++) {
-        for (run = 0; run < 2; run++) {
-            int index = (level<<1)|run;
-            int sign, offset = 0, alevel = level;
-
-            MASK_ABS(sign, alevel);
-            if (alevel > 64) {
-                offset = (alevel-1)>>6;
-                alevel -= offset<<6;
-            }
-            for (j = 0; j < 257; j++) {
-                if (ctx->cid_table->ac_level[j] == alevel &&
-                    (!offset || (ctx->cid_table->ac_index_flag[j] && offset)) &&
-                    (!run    || (ctx->cid_table->ac_run_flag  [j] && run))) {
-                    assert(!ctx->vlc_codes[index]);
-                    if (alevel) {
-                        ctx->vlc_codes[index] = (ctx->cid_table->ac_codes[j]<<1)|(sign&1);
-                        ctx->vlc_bits [index] = ctx->cid_table->ac_bits[j]+1;
-                    } else {
-                        ctx->vlc_codes[index] = ctx->cid_table->ac_codes[j];
-                        ctx->vlc_bits [index] = ctx->cid_table->ac_bits [j];
-                    }
-                    break;
-                }
-            }
-            assert(!alevel || j < 257);
-            if (offset) {
-                ctx->vlc_codes[index] = (ctx->vlc_codes[index]<<ctx->cid_table->index_bits)|offset;
-                ctx->vlc_bits [index]+= ctx->cid_table->index_bits;
-            }
-        }
-    }
-    for (i = 0; i < 62; i++) {
-        int run = ctx->cid_table->run[i];
-        assert(run < 63);
-        ctx->run_codes[run] = ctx->cid_table->run_codes[i];
-        ctx->run_bits [run] = ctx->cid_table->run_bits[i];
-    }
-    return 0;
- fail:
-    return -1;
-}
-
-static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias)
-{
-    // init first elem to 1 to avoid div by 0 in convert_matrix
-    uint16_t weight_matrix[64] = {1,}; // convert_matrix needs uint16_t*
-    int qscale, i;
-
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l,   (ctx->m.avctx->qmax+1) * 64 *     sizeof(int)     , fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c,   (ctx->m.avctx->qmax+1) * 64 *     sizeof(int)     , fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_l16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->qmatrix_c16, (ctx->m.avctx->qmax+1) * 64 * 2 * sizeof(uint16_t), fail);
-
-    for (i = 1; i < 64; i++) {
-        int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]];
-        weight_matrix[j] = ctx->cid_table->luma_weight[i];
-    }
-    ff_convert_matrix(&ctx->m.dsp, ctx->qmatrix_l, ctx->qmatrix_l16, weight_matrix,
-                      ctx->m.intra_quant_bias, 1, ctx->m.avctx->qmax, 1);
-    for (i = 1; i < 64; i++) {
-        int j = ctx->m.dsp.idct_permutation[ff_zigzag_direct[i]];
-        weight_matrix[j] = ctx->cid_table->chroma_weight[i];
-    }
-    ff_convert_matrix(&ctx->m.dsp, ctx->qmatrix_c, ctx->qmatrix_c16, weight_matrix,
-                      ctx->m.intra_quant_bias, 1, ctx->m.avctx->qmax, 1);
-    for (qscale = 1; qscale <= ctx->m.avctx->qmax; qscale++) {
-        for (i = 0; i < 64; i++) {
-            ctx->qmatrix_l  [qscale]   [i] <<= 2; ctx->qmatrix_c  [qscale]   [i] <<= 2;
-            ctx->qmatrix_l16[qscale][0][i] <<= 2; ctx->qmatrix_l16[qscale][1][i] <<= 2;
-            ctx->qmatrix_c16[qscale][0][i] <<= 2; ctx->qmatrix_c16[qscale][1][i] <<= 2;
-        }
-    }
-    return 0;
- fail:
-    return -1;
-}
-
-static int dnxhd_init_rc(DNXHDEncContext *ctx)
-{
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);
-    if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
-        FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);
-
-    ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8;
-    ctx->qscale = 1;
-    ctx->lambda = 2<<LAMBDA_FRAC_BITS; // qscale 2
-    return 0;
- fail:
-    return -1;
-}
-
-static int dnxhd_encode_init(AVCodecContext *avctx)
-{
-    DNXHDEncContext *ctx = avctx->priv_data;
-    int i, index;
-
-    ctx->cid = ff_dnxhd_find_cid(avctx);
-    if (!ctx->cid || avctx->pix_fmt != PIX_FMT_YUV422P) {
-        av_log(avctx, AV_LOG_ERROR, "video parameters incompatible with DNxHD\n");
-        return -1;
-    }
-    av_log(avctx, AV_LOG_DEBUG, "cid %d\n", ctx->cid);
-
-    index = ff_dnxhd_get_cid_table(ctx->cid);
-    ctx->cid_table = &ff_dnxhd_cid_table[index];
-
-    ctx->m.avctx = avctx;
-    ctx->m.mb_intra = 1;
-    ctx->m.h263_aic = 1;
-
-    ctx->get_pixels_8x4_sym = dnxhd_get_pixels_8x4;
-
-    dsputil_init(&ctx->m.dsp, avctx);
-    ff_dct_common_init(&ctx->m);
-#if HAVE_MMX
-    ff_dnxhd_init_mmx(ctx);
-#endif
-    if (!ctx->m.dct_quantize)
-        ctx->m.dct_quantize = dct_quantize_c;
-
-    ctx->m.mb_height = (avctx->height + 15) / 16;
-    ctx->m.mb_width  = (avctx->width  + 15) / 16;
-
-    if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
-        ctx->interlaced = 1;
-        ctx->m.mb_height /= 2;
-    }
-
-    ctx->m.mb_num = ctx->m.mb_height * ctx->m.mb_width;
-
-    if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
-        ctx->m.intra_quant_bias = avctx->intra_quant_bias;
-    if (dnxhd_init_qmat(ctx, ctx->m.intra_quant_bias, 0) < 0) // XXX tune lbias/cbias
-        return -1;
-
-    if (dnxhd_init_vlc(ctx) < 0)
-        return -1;
-    if (dnxhd_init_rc(ctx) < 0)
-        return -1;
-
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->slice_size, ctx->m.mb_height*sizeof(uint32_t), fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->slice_offs, ctx->m.mb_height*sizeof(uint32_t), fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_bits,    ctx->m.mb_num   *sizeof(uint16_t), fail);
-    FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_qscale,  ctx->m.mb_num   *sizeof(uint8_t) , fail);
-
-    ctx->frame.key_frame = 1;
-    ctx->frame.pict_type = FF_I_TYPE;
-    ctx->m.avctx->coded_frame = &ctx->frame;
-
-    if (avctx->thread_count > MAX_THREADS) {
-        av_log(avctx, AV_LOG_ERROR, "too many threads\n");
-        return -1;
-    }
-
-    ctx->thread[0] = ctx;
-    for (i = 1; i < avctx->thread_count; i++) {
-        ctx->thread[i] =  av_malloc(sizeof(DNXHDEncContext));
-        memcpy(ctx->thread[i], ctx, sizeof(DNXHDEncContext));
-    }
-
-    return 0;
- fail: //for FF_ALLOCZ_OR_GOTO
-    return -1;
-}
-
-static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf)
-{
-    DNXHDEncContext *ctx = avctx->priv_data;
-    const uint8_t header_prefix[5] = { 0x00,0x00,0x02,0x80,0x01 };
-
-    memset(buf, 0, 640);
-
-    memcpy(buf, header_prefix, 5);
-    buf[5] = ctx->interlaced ? ctx->cur_field+2 : 0x01;
-    buf[6] = 0x80; // crc flag off
-    buf[7] = 0xa0; // reserved
-    AV_WB16(buf + 0x18, avctx->height); // ALPF
-    AV_WB16(buf + 0x1a, avctx->width);  // SPL
-    AV_WB16(buf + 0x1d, avctx->height); // NAL
-
-    buf[0x21] = 0x38; // FIXME 8 bit per comp
-    buf[0x22] = 0x88 + (ctx->frame.interlaced_frame<<2);
-    AV_WB32(buf + 0x28, ctx->cid); // CID
-    buf[0x2c] = ctx->interlaced ? 0 : 0x80;
-
-    buf[0x5f] = 0x01; // UDL
-
-    buf[0x167] = 0x02; // reserved
-    AV_WB16(buf + 0x16a, ctx->m.mb_height * 4 + 4); // MSIPS
-    buf[0x16d] = ctx->m.mb_height; // Ns
-    buf[0x16f] = 0x10; // reserved
-
-    ctx->msip = buf + 0x170;
-    return 0;
-}
-
-static av_always_inline void dnxhd_encode_dc(DNXHDEncContext *ctx, int diff)
-{
-    int nbits;
-    if (diff < 0) {
-        nbits = av_log2_16bit(-2*diff);
-        diff--;
-    } else {
-        nbits = av_log2_16bit(2*diff);
-    }
-    put_bits(&ctx->m.pb, ctx->cid_table->dc_bits[nbits] + nbits,
-             (ctx->cid_table->dc_codes[nbits]<<nbits) + (diff & ((1 << nbits) - 1)));
-}
-
-static av_always_inline void dnxhd_encode_block(DNXHDEncContext *ctx, DCTELEM *block, int last_index, int n)
-{
-    int last_non_zero = 0;
-    int slevel, i, j;
-
-    dnxhd_encode_dc(ctx, block[0] - ctx->m.last_dc[n]);
-    ctx->m.last_dc[n] = block[0];
-
-    for (i = 1; i <= last_index; i++) {
-        j = ctx->m.intra_scantable.permutated[i];
-        slevel = block[j];
-        if (slevel) {
-            int run_level = i - last_non_zero - 1;
-            int rlevel = (slevel<<1)|!!run_level;
-            put_bits(&ctx->m.pb, ctx->vlc_bits[rlevel], ctx->vlc_codes[rlevel]);
-            if (run_level)
-                put_bits(&ctx->m.pb, ctx->run_bits[run_level], ctx->run_codes[run_level]);
-            last_non_zero = i;
-        }
-    }
-    put_bits(&ctx->m.pb, ctx->vlc_bits[0], ctx->vlc_codes[0]); // EOB
-}
-
-static av_always_inline void dnxhd_unquantize_c(DNXHDEncContext *ctx, DCTELEM *block, int n, int qscale, int last_index)
-{
-    const uint8_t *weight_matrix;
-    int level;
-    int i;
-
-    weight_matrix = (n&2) ? ctx->cid_table->chroma_weight : ctx->cid_table->luma_weight;
-
-    for (i = 1; i <= last_index; i++) {
-        int j = ctx->m.intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = (1-2*level) * qscale * weight_matrix[i];
-                if (weight_matrix[i] != 32)
-                    level += 32;
-                level >>= 6;
-                level = -level;
-            } else {
-                level = (2*level+1) * qscale * weight_matrix[i];
-                if (weight_matrix[i] != 32)
-                    level += 32;
-                level >>= 6;
-            }
-            block[j] = level;
-        }
-    }
-}
-
-static av_always_inline int dnxhd_ssd_block(DCTELEM *qblock, DCTELEM *block)
-{
-    int score = 0;
-    int i;
-    for (i = 0; i < 64; i++)
-        score += (block[i]-qblock[i])*(block[i]-qblock[i]);
-    return score;
-}
-
-static av_always_inline int dnxhd_calc_ac_bits(DNXHDEncContext *ctx, DCTELEM *block, int last_index)
-{
-    int last_non_zero = 0;
-    int bits = 0;
-    int i, j, level;
-    for (i = 1; i <= last_index; i++) {
-        j = ctx->m.intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            int run_level = i - last_non_zero - 1;
-            bits += ctx->vlc_bits[(level<<1)|!!run_level]+ctx->run_bits[run_level];
-            last_non_zero = i;
-        }
-    }
-    return bits;
-}
-
-static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y)
-{
-    const uint8_t *ptr_y = ctx->thread[0]->src[0] + ((mb_y << 4) * ctx->m.linesize)   + (mb_x << 4);
-    const uint8_t *ptr_u = ctx->thread[0]->src[1] + ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << 3);
-    const uint8_t *ptr_v = ctx->thread[0]->src[2] + ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << 3);
-    DSPContext *dsp = &ctx->m.dsp;
-
-    dsp->get_pixels(ctx->blocks[0], ptr_y    , ctx->m.linesize);
-    dsp->get_pixels(ctx->blocks[1], ptr_y + 8, ctx->m.linesize);
-    dsp->get_pixels(ctx->blocks[2], ptr_u    , ctx->m.uvlinesize);
-    dsp->get_pixels(ctx->blocks[3], ptr_v    , ctx->m.uvlinesize);
-
-    if (mb_y+1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) {
-        if (ctx->interlaced) {
-            ctx->get_pixels_8x4_sym(ctx->blocks[4], ptr_y + ctx->dct_y_offset    , ctx->m.linesize);
-            ctx->get_pixels_8x4_sym(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize);
-            ctx->get_pixels_8x4_sym(ctx->blocks[6], ptr_u + ctx->dct_uv_offset   , ctx->m.uvlinesize);
-            ctx->get_pixels_8x4_sym(ctx->blocks[7], ptr_v + ctx->dct_uv_offset   , ctx->m.uvlinesize);
-        } else {
-            dsp->clear_block(ctx->blocks[4]); dsp->clear_block(ctx->blocks[5]);
-            dsp->clear_block(ctx->blocks[6]); dsp->clear_block(ctx->blocks[7]);
-        }
-    } else {
-        dsp->get_pixels(ctx->blocks[4], ptr_y + ctx->dct_y_offset    , ctx->m.linesize);
-        dsp->get_pixels(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize);
-        dsp->get_pixels(ctx->blocks[6], ptr_u + ctx->dct_uv_offset   , ctx->m.uvlinesize);
-        dsp->get_pixels(ctx->blocks[7], ptr_v + ctx->dct_uv_offset   , ctx->m.uvlinesize);
-    }
-}
-
-static av_always_inline int dnxhd_switch_matrix(DNXHDEncContext *ctx, int i)
-{
-    if (i&2) {
-        ctx->m.q_intra_matrix16 = ctx->qmatrix_c16;
-        ctx->m.q_intra_matrix   = ctx->qmatrix_c;
-        return 1 + (i&1);
-    } else {
-        ctx->m.q_intra_matrix16 = ctx->qmatrix_l16;
-        ctx->m.q_intra_matrix   = ctx->qmatrix_l;
-        return 0;
-    }
-}
-
-static int dnxhd_calc_bits_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
-{
-    DNXHDEncContext *ctx = avctx->priv_data;
-    int mb_y = jobnr, mb_x;
-    int qscale = ctx->qscale;
-    LOCAL_ALIGNED_16(DCTELEM, block, [64]);
-    ctx = ctx->thread[threadnr];
-
-    ctx->m.last_dc[0] =
-    ctx->m.last_dc[1] =
-    ctx->m.last_dc[2] = 1024;
-
-    for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) {
-        unsigned mb = mb_y * ctx->m.mb_width + mb_x;
-        int ssd     = 0;
-        int ac_bits = 0;
-        int dc_bits = 0;
-        int i;
-
-        dnxhd_get_blocks(ctx, mb_x, mb_y);
-
-        for (i = 0; i < 8; i++) {
-            DCTELEM *src_block = ctx->blocks[i];
-            int overflow, nbits, diff, last_index;
-            int n = dnxhd_switch_matrix(ctx, i);
-
-            memcpy(block, src_block, 64*sizeof(*block));
-            last_index = ctx->m.dct_quantize((MpegEncContext*)ctx, block, i, qscale, &overflow);
-            ac_bits += dnxhd_calc_ac_bits(ctx, block, last_index);
-
-            diff = block[0] - ctx->m.last_dc[n];
-            if (diff < 0) nbits = av_log2_16bit(-2*diff);
-            else          nbits = av_log2_16bit( 2*diff);
-            dc_bits += ctx->cid_table->dc_bits[nbits] + nbits;
-
-            ctx->m.last_dc[n] = block[0];
-
-            if (avctx->mb_decision == FF_MB_DECISION_RD || !RC_VARIANCE) {
-                dnxhd_unquantize_c(ctx, block, i, qscale, last_index);
-                ctx->m.dsp.idct(block);
-                ssd += dnxhd_ssd_block(block, src_block);
-            }
-        }
-        ctx->mb_rc[qscale][mb].ssd = ssd;
-        ctx->mb_rc[qscale][mb].bits = ac_bits+dc_bits+12+8*ctx->vlc_bits[0];
-    }
-    return 0;
-}
-
-static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
-{
-    DNXHDEncContext *ctx = avctx->priv_data;
-    int mb_y = jobnr, mb_x;
-    ctx = ctx->thread[threadnr];
-    init_put_bits(&ctx->m.pb, (uint8_t *)arg + 640 + ctx->slice_offs[jobnr], ctx->slice_size[jobnr]);
-
-    ctx->m.last_dc[0] =
-    ctx->m.last_dc[1] =
-    ctx->m.last_dc[2] = 1024;
-    for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) {
-        unsigned mb = mb_y * ctx->m.mb_width + mb_x;
-        int qscale = ctx->mb_qscale[mb];
-        int i;
-
-        put_bits(&ctx->m.pb, 12, qscale<<1);
-
-        dnxhd_get_blocks(ctx, mb_x, mb_y);
-
-        for (i = 0; i < 8; i++) {
-            DCTELEM *block = ctx->blocks[i];
-            int last_index, overflow;
-            int n = dnxhd_switch_matrix(ctx, i);
-            last_index = ctx->m.dct_quantize((MpegEncContext*)ctx, block, i, qscale, &overflow);
-            //START_TIMER;
-            dnxhd_encode_block(ctx, block, last_index, n);
-            //STOP_TIMER("encode_block");
-        }
-    }
-    if (put_bits_count(&ctx->m.pb)&31)
-        put_bits(&ctx->m.pb, 32-(put_bits_count(&ctx->m.pb)&31), 0);
-    flush_put_bits(&ctx->m.pb);
-    return 0;
-}
-
-static void dnxhd_setup_threads_slices(DNXHDEncContext *ctx)
-{
-    int mb_y, mb_x;
-    int offset = 0;
-    for (mb_y = 0; mb_y < ctx->m.mb_height; mb_y++) {
-        int thread_size;
-        ctx->slice_offs[mb_y] = offset;
-            ctx->slice_size[mb_y] = 0;
-            for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) {
-                unsigned mb = mb_y * ctx->m.mb_width + mb_x;
-                ctx->slice_size[mb_y] += ctx->mb_bits[mb];
-            }
-            ctx->slice_size[mb_y] = (ctx->slice_size[mb_y]+31)&~31;
-            ctx->slice_size[mb_y] >>= 3;
-            thread_size = ctx->slice_size[mb_y];
-        offset += thread_size;
-    }
-}
-
-static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr)
-{
-    DNXHDEncContext *ctx = avctx->priv_data;
-    int mb_y = jobnr, mb_x;
-    ctx = ctx->thread[threadnr];
-    for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) {
-        unsigned mb  = mb_y * ctx->m.mb_width + mb_x;
-        uint8_t *pix = ctx->thread[0]->src[0] + ((mb_y<<4) * ctx->m.linesize) + (mb_x<<4);
-        int sum      = ctx->m.dsp.pix_sum(pix, ctx->m.linesize);
-        int varc     = (ctx->m.dsp.pix_norm1(pix, ctx->m.linesize) - (((unsigned)(sum*sum))>>8)+128)>>8;
-        ctx->mb_cmp[mb].value = varc;
-        ctx->mb_cmp[mb].mb = mb;
-    }
-    return 0;
-}
-
-static int dnxhd_encode_rdo(AVCodecContext *avctx, DNXHDEncContext *ctx)
-{
-    int lambda, up_step, down_step;
-    int last_lower = INT_MAX, last_higher = 0;
-    int x, y, q;
-
-    for (q = 1; q < avctx->qmax; q++) {
-        ctx->qscale = q;
-        avctx->execute2(avctx, dnxhd_calc_bits_thread, NULL, NULL, ctx->m.mb_height);
-    }
-    up_step = down_step = 2<<LAMBDA_FRAC_BITS;
-    lambda = ctx->lambda;
-
-    for (;;) {
-        int bits = 0;
-        int end = 0;
-        if (lambda == last_higher) {
-            lambda++;
-            end = 1; // need to set final qscales/bits
-        }
-        for (y = 0; y < ctx->m.mb_height; y++) {
-            for (x = 0; x < ctx->m.mb_width; x++) {
-                unsigned min = UINT_MAX;
-                int qscale = 1;
-                int mb = y*ctx->m.mb_width+x;
-                for (q = 1; q < avctx->qmax; q++) {
-                    unsigned score = ctx->mb_rc[q][mb].bits*lambda+(ctx->mb_rc[q][mb].ssd<<LAMBDA_FRAC_BITS);
-                    if (score < min) {
-                        min = score;
-                        qscale = q;
-                    }
-                }
-                bits += ctx->mb_rc[qscale][mb].bits;
-                ctx->mb_qscale[mb] = qscale;
-                ctx->mb_bits[mb] = ctx->mb_rc[qscale][mb].bits;
-            }
-            bits = (bits+31)&~31; // padding
-            if (bits > ctx->frame_bits)
-                break;
-        }
-        //dprintf(ctx->m.avctx, "lambda %d, up %u, down %u, bits %d, frame %d\n",
-        //        lambda, last_higher, last_lower, bits, ctx->frame_bits);
-        if (end) {
-            if (bits > ctx->frame_bits)
-                return -1;
-            break;
-        }
-        if (bits < ctx->frame_bits) {
-            last_lower = FFMIN(lambda, last_lower);
-            if (last_higher != 0)
-                lambda = (lambda+last_higher)>>1;
-            else
-                lambda -= down_step;
-            down_step *= 5; // XXX tune ?
-            up_step = 1<<LAMBDA_FRAC_BITS;
-            lambda = FFMAX(1, lambda);
-            if (lambda == last_lower)
-                break;
-        } else {
-            last_higher = FFMAX(lambda, last_higher);
-            if (last_lower != INT_MAX)
-                lambda = (lambda+last_lower)>>1;
-            else if ((int64_t)lambda + up_step > INT_MAX)
-                return -1;
-            else
-                lambda += up_step;
-            up_step = FFMIN((int64_t)up_step*5, INT_MAX);
-            down_step = 1<<LAMBDA_FRAC_BITS;
-        }
-    }
-    //dprintf(ctx->m.avctx, "out lambda %d\n", lambda);
-    ctx->lambda = lambda;
-    return 0;
-}
-
-static int dnxhd_find_qscale(DNXHDEncContext *ctx)
-{
-    int bits = 0;
-    int up_step = 1;
-    int down_step = 1;
-    int last_higher = 0;
-    int last_lower = INT_MAX;
-    int qscale;
-    int x, y;
-
-    qscale = ctx->qscale;
-    for (;;) {
-        bits = 0;
-        ctx->qscale = qscale;
-        // XXX avoid recalculating bits
-        ctx->m.avctx->execute2(ctx->m.avctx, dnxhd_calc_bits_thread, NULL, NULL, ctx->m.mb_height);
-        for (y = 0; y < ctx->m.mb_height; y++) {
-            for (x = 0; x < ctx->m.mb_width; x++)
-                bits += ctx->mb_rc[qscale][y*ctx->m.mb_width+x].bits;
-            bits = (bits+31)&~31; // padding
-            if (bits > ctx->frame_bits)
-                break;
-        }
-        //dprintf(ctx->m.avctx, "%d, qscale %d, bits %d, frame %d, higher %d, lower %d\n",
-        //        ctx->m.avctx->frame_number, qscale, bits, ctx->frame_bits, last_higher, last_lower);
-        if (bits < ctx->frame_bits) {
-            if (qscale == 1)
-                return 1;
-            if (last_higher == qscale - 1) {
-                qscale = last_higher;
-                break;
-            }
-            last_lower = FFMIN(qscale, last_lower);
-            if (last_higher != 0)
-                qscale = (qscale+last_higher)>>1;
-            else
-                qscale -= down_step++;
-            if (qscale < 1)
-                qscale = 1;
-            up_step = 1;
-        } else {
-            if (last_lower == qscale + 1)
-                break;
-            last_higher = FFMAX(qscale, last_higher);
-            if (last_lower != INT_MAX)
-                qscale = (qscale+last_lower)>>1;
-            else
-                qscale += up_step++;
-            down_step = 1;
-            if (qscale >= ctx->m.avctx->qmax)
-                return -1;
-        }
-    }
-    //dprintf(ctx->m.avctx, "out qscale %d\n", qscale);
-    ctx->qscale = qscale;
-    return 0;
-}
-
-#define BUCKET_BITS 8
-#define RADIX_PASSES 4
-#define NBUCKETS (1 << BUCKET_BITS)
-
-static inline int get_bucket(int value, int shift)
-{
-    value >>= shift;
-    value &= NBUCKETS - 1;
-    return NBUCKETS - 1 - value;
-}
-
-static void radix_count(const RCCMPEntry *data, int size, int buckets[RADIX_PASSES][NBUCKETS])
-{
-    int i, j;
-    memset(buckets, 0, sizeof(buckets[0][0]) * RADIX_PASSES * NBUCKETS);
-    for (i = 0; i < size; i++) {
-        int v = data[i].value;
-        for (j = 0; j < RADIX_PASSES; j++) {
-            buckets[j][get_bucket(v, 0)]++;
-            v >>= BUCKET_BITS;
-        }
-        assert(!v);
-    }
-    for (j = 0; j < RADIX_PASSES; j++) {
-        int offset = size;
-        for (i = NBUCKETS - 1; i >= 0; i--)
-            buckets[j][i] = offset -= buckets[j][i];
-        assert(!buckets[j][0]);
-    }
-}
-
-static void radix_sort_pass(RCCMPEntry *dst, const RCCMPEntry *data, int size, int buckets[NBUCKETS], int pass)
-{
-    int shift = pass * BUCKET_BITS;
-    int i;
-    for (i = 0; i < size; i++) {
-        int v = get_bucket(data[i].value, shift);
-        int pos = buckets[v]++;
-        dst[pos] = data[i];
-    }
-}
-
-static void radix_sort(RCCMPEntry *data, int size)
-{
-    int buckets[RADIX_PASSES][NBUCKETS];
-    RCCMPEntry *tmp = av_malloc(sizeof(*tmp) * size);
-    radix_count(data, size, buckets);
-    radix_sort_pass(tmp, data, size, buckets[0], 0);
-    radix_sort_pass(data, tmp, size, buckets[1], 1);
-    if (buckets[2][NBUCKETS - 1] || buckets[3][NBUCKETS - 1]) {
-        radix_sort_pass(tmp, data, size, buckets[2], 2);
-        radix_sort_pass(data, tmp, size, buckets[3], 3);
-    }
-    av_free(tmp);
-}
-
-static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
-{
-    int max_bits = 0;
-    int ret, x, y;
-    if ((ret = dnxhd_find_qscale(ctx)) < 0)
-        return -1;
-    for (y = 0; y < ctx->m.mb_height; y++) {
-        for (x = 0; x < ctx->m.mb_width; x++) {
-            int mb = y*ctx->m.mb_width+x;
-            int delta_bits;
-            ctx->mb_qscale[mb] = ctx->qscale;
-            ctx->mb_bits[mb] = ctx->mb_rc[ctx->qscale][mb].bits;
-            max_bits += ctx->mb_rc[ctx->qscale][mb].bits;
-            if (!RC_VARIANCE) {
-                delta_bits = ctx->mb_rc[ctx->qscale][mb].bits-ctx->mb_rc[ctx->qscale+1][mb].bits;
-                ctx->mb_cmp[mb].mb = mb;
-                ctx->mb_cmp[mb].value = delta_bits ?
-                    ((ctx->mb_rc[ctx->qscale][mb].ssd-ctx->mb_rc[ctx->qscale+1][mb].ssd)*100)/delta_bits
-                    : INT_MIN; //avoid increasing qscale
-            }
-        }
-        max_bits += 31; //worst padding
-    }
-    if (!ret) {
-        if (RC_VARIANCE)
-            avctx->execute2(avctx, dnxhd_mb_var_thread, NULL, NULL, ctx->m.mb_height);
-        radix_sort(ctx->mb_cmp, ctx->m.mb_num);
-        for (x = 0; x < ctx->m.mb_num && max_bits > ctx->frame_bits; x++) {
-            int mb = ctx->mb_cmp[x].mb;
-            max_bits -= ctx->mb_rc[ctx->qscale][mb].bits - ctx->mb_rc[ctx->qscale+1][mb].bits;
-            ctx->mb_qscale[mb] = ctx->qscale+1;
-            ctx->mb_bits[mb] = ctx->mb_rc[ctx->qscale+1][mb].bits;
-        }
-    }
-    return 0;
-}
-
-static void dnxhd_load_picture(DNXHDEncContext *ctx, const AVFrame *frame)
-{
-    int i;
-
-    for (i = 0; i < 3; i++) {
-        ctx->frame.data[i]     = frame->data[i];
-        ctx->frame.linesize[i] = frame->linesize[i];
-    }
-
-    for (i = 0; i < ctx->m.avctx->thread_count; i++) {
-        ctx->thread[i]->m.linesize    = ctx->frame.linesize[0]<<ctx->interlaced;
-        ctx->thread[i]->m.uvlinesize  = ctx->frame.linesize[1]<<ctx->interlaced;
-        ctx->thread[i]->dct_y_offset  = ctx->m.linesize  *8;
-        ctx->thread[i]->dct_uv_offset = ctx->m.uvlinesize*8;
-    }
-
-    ctx->frame.interlaced_frame = frame->interlaced_frame;
-    ctx->cur_field = frame->interlaced_frame && !frame->top_field_first;
-}
-
-static int dnxhd_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
-{
-    DNXHDEncContext *ctx = avctx->priv_data;
-    int first_field = 1;
-    int offset, i, ret;
-
-    if (buf_size < ctx->cid_table->frame_size) {
-        av_log(avctx, AV_LOG_ERROR, "output buffer is too small to compress picture\n");
-        return -1;
-    }
-
-    dnxhd_load_picture(ctx, data);
-
- encode_coding_unit:
-    for (i = 0; i < 3; i++) {
-        ctx->src[i] = ctx->frame.data[i];
-        if (ctx->interlaced && ctx->cur_field)
-            ctx->src[i] += ctx->frame.linesize[i];
-    }
-
-    dnxhd_write_header(avctx, buf);
-
-    if (avctx->mb_decision == FF_MB_DECISION_RD)
-        ret = dnxhd_encode_rdo(avctx, ctx);
-    else
-        ret = dnxhd_encode_fast(avctx, ctx);
-    if (ret < 0) {
-        av_log(avctx, AV_LOG_ERROR,
-               "picture could not fit ratecontrol constraints, increase qmax\n");
-        return -1;
-    }
-
-    dnxhd_setup_threads_slices(ctx);
-
-    offset = 0;
-    for (i = 0; i < ctx->m.mb_height; i++) {
-        AV_WB32(ctx->msip + i * 4, offset);
-        offset += ctx->slice_size[i];
-        assert(!(ctx->slice_size[i] & 3));
-    }
-
-    avctx->execute2(avctx, dnxhd_encode_thread, buf, NULL, ctx->m.mb_height);
-
-    assert(640 + offset + 4 <= ctx->cid_table->coding_unit_size);
-    memset(buf + 640 + offset, 0, ctx->cid_table->coding_unit_size - 4 - offset - 640);
-
-    AV_WB32(buf + ctx->cid_table->coding_unit_size - 4, 0x600DC0DE); // EOF
-
-    if (ctx->interlaced && first_field) {
-        first_field     = 0;
-        ctx->cur_field ^= 1;
-        buf      += ctx->cid_table->coding_unit_size;
-        buf_size -= ctx->cid_table->coding_unit_size;
-        goto encode_coding_unit;
-    }
-
-    ctx->frame.quality = ctx->qscale*FF_QP2LAMBDA;
-
-    return ctx->cid_table->frame_size;
-}
-
-static int dnxhd_encode_end(AVCodecContext *avctx)
-{
-    DNXHDEncContext *ctx = avctx->priv_data;
-    int max_level = 1<<(ctx->cid_table->bit_depth+2);
-    int i;
-
-    av_free(ctx->vlc_codes-max_level*2);
-    av_free(ctx->vlc_bits -max_level*2);
-    av_freep(&ctx->run_codes);
-    av_freep(&ctx->run_bits);
-
-    av_freep(&ctx->mb_bits);
-    av_freep(&ctx->mb_qscale);
-    av_freep(&ctx->mb_rc);
-    av_freep(&ctx->mb_cmp);
-    av_freep(&ctx->slice_size);
-    av_freep(&ctx->slice_offs);
-
-    av_freep(&ctx->qmatrix_c);
-    av_freep(&ctx->qmatrix_l);
-    av_freep(&ctx->qmatrix_c16);
-    av_freep(&ctx->qmatrix_l16);
-
-    for (i = 1; i < avctx->thread_count; i++)
-        av_freep(&ctx->thread[i]);
-
-    return 0;
-}
-
-AVCodec dnxhd_encoder = {
-    "dnxhd",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DNXHD,
-    sizeof(DNXHDEncContext),
-    dnxhd_encode_init,
-    dnxhd_encode_picture,
-    dnxhd_encode_end,
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
-};
diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h
deleted file mode 100644
index eaf33d5..0000000
--- a/libavcodec/dnxhdenc.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * VC3/DNxHD encoder structure definitions and prototypes
- * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * VC-3 encoder funded by the British Broadcasting Corporation
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DNXHDENC_H
-#define AVCODEC_DNXHDENC_H
-
-#include <stdint.h>
-#include "libavcodec/mpegvideo.h"
-#include "libavcodec/dnxhddata.h"
-
-typedef struct {
-    uint16_t mb;
-    int value;
-} RCCMPEntry;
-
-typedef struct {
-    int ssd;
-    int bits;
-} RCEntry;
-
-typedef struct DNXHDEncContext {
-    MpegEncContext m; ///< Used for quantization dsp functions
-
-    AVFrame frame;
-    int cid;
-    const CIDEntry *cid_table;
-    uint8_t *msip; ///< Macroblock Scan Indexes Payload
-    uint32_t *slice_size;
-    uint32_t *slice_offs;
-
-    struct DNXHDEncContext *thread[MAX_THREADS];
-
-    unsigned dct_y_offset;
-    unsigned dct_uv_offset;
-    int interlaced;
-    int cur_field;
-
-    DECLARE_ALIGNED(16, DCTELEM, blocks)[8][64];
-
-    int      (*qmatrix_c)     [64];
-    int      (*qmatrix_l)     [64];
-    uint16_t (*qmatrix_l16)[2][64];
-    uint16_t (*qmatrix_c16)[2][64];
-
-    unsigned frame_bits;
-    uint8_t *src[3];
-
-    uint32_t *vlc_codes;
-    uint8_t  *vlc_bits;
-    uint16_t *run_codes;
-    uint8_t  *run_bits;
-
-    /** Rate control */
-    unsigned slice_bits;
-    unsigned qscale;
-    unsigned lambda;
-
-    unsigned thread_size;
-
-    uint16_t *mb_bits;
-    uint8_t  *mb_qscale;
-
-    RCCMPEntry *mb_cmp;
-    RCEntry   (*mb_rc)[8160];
-
-    void (*get_pixels_8x4_sym)(DCTELEM */*align 16*/, const uint8_t *, int);
-} DNXHDEncContext;
-
-void ff_dnxhd_init_mmx(DNXHDEncContext *ctx);
-
-#endif /* AVCODEC_DNXHDENC_H */
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
deleted file mode 100644
index 7c53516..0000000
--- a/libavcodec/dpcm.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Assorted DPCM codecs
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file: dpcm.c
- * Assorted DPCM (differential pulse code modulation) audio codecs
- * by Mike Melanson (melanson at pcisys.net)
- * Xan DPCM decoder by Mario Brito (mbrito at student.dei.uc.pt)
- * for more information on the specific data formats, visit:
- *   http://www.pcisys.net/~melanson/codecs/simpleaudio.html
- * SOL DPCMs implemented by Konstantin Shishkov
- *
- * Note about using the Xan DPCM decoder: Xan DPCM is used in AVI files
- * found in the Wing Commander IV computer game. These AVI files contain
- * WAVEFORMAT headers which report the audio format as 0x01: raw PCM.
- * Clearly incorrect. To detect Xan DPCM, you will probably have to
- * special-case your AVI demuxer to use Xan DPCM if the file uses 'Xxan'
- * (Xan video) for its video codec. Alternately, such AVI files also contain
- * the fourcc 'Axan' in the 'auds' chunk of the AVI header.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct DPCMContext {
-    int channels;
-    short roq_square_array[256];
-    long sample[2];//for SOL_DPCM
-    const int *sol_table;//for SOL_DPCM
-} DPCMContext;
-
-#define SE_16BIT(x)  if (x & 0x8000) x -= 0x10000;
-
-static const int interplay_delta_table[] = {
-         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,     47,     51,     56,     61,
-        66,     72,     79,     86,     94,    102,    112,    122,
-       133,    145,    158,    173,    189,    206,    225,    245,
-       267,    292,    318,    348,    379,    414,    452,    493,
-       538,    587,    640,    699,    763,    832,    908,    991,
-      1081,   1180,   1288,   1405,   1534,   1673,   1826,   1993,
-      2175,   2373,   2590,   2826,   3084,   3365,   3672,   4008,
-      4373,   4772,   5208,   5683,   6202,   6767,   7385,   8059,
-      8794,   9597,  10472,  11428,  12471,  13609,  14851,  16206,
-     17685,  19298,  21060,  22981,  25078,  27367,  29864,  32589,
-    -29973, -26728, -23186, -19322, -15105, -10503,  -5481,     -1,
-         1,      1,   5481,  10503,  15105,  19322,  23186,  26728,
-     29973, -32589, -29864, -27367, -25078, -22981, -21060, -19298,
-    -17685, -16206, -14851, -13609, -12471, -11428, -10472,  -9597,
-     -8794,  -8059,  -7385,  -6767,  -6202,  -5683,  -5208,  -4772,
-     -4373,  -4008,  -3672,  -3365,  -3084,  -2826,  -2590,  -2373,
-     -2175,  -1993,  -1826,  -1673,  -1534,  -1405,  -1288,  -1180,
-     -1081,   -991,   -908,   -832,   -763,   -699,   -640,   -587,
-      -538,   -493,   -452,   -414,   -379,   -348,   -318,   -292,
-      -267,   -245,   -225,   -206,   -189,   -173,   -158,   -145,
-      -133,   -122,   -112,   -102,    -94,    -86,    -79,    -72,
-       -66,    -61,    -56,    -51,    -47,    -43,    -42,    -41,
-       -40,    -39,    -38,    -37,    -36,    -35,    -34,    -33,
-       -32,    -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
-
-};
-
-static const int sol_table_old[16] =
-    { 0x0,  0x1,  0x2 , 0x3,  0x6,  0xA,  0xF, 0x15,
-    -0x15, -0xF, -0xA, -0x6, -0x3, -0x2, -0x1, 0x0};
-
-static const int sol_table_new[16] =
-    { 0x0,  0x1,  0x2,  0x3,  0x6,  0xA,  0xF,  0x15,
-      0x0, -0x1, -0x2, -0x3, -0x6, -0xA, -0xF, -0x15};
-
-static const int sol_table_16[128] = {
-    0x000, 0x008, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x080,
-    0x090, 0x0A0, 0x0B0, 0x0C0, 0x0D0, 0x0E0, 0x0F0, 0x100, 0x110, 0x120,
-    0x130, 0x140, 0x150, 0x160, 0x170, 0x180, 0x190, 0x1A0, 0x1B0, 0x1C0,
-    0x1D0, 0x1E0, 0x1F0, 0x200, 0x208, 0x210, 0x218, 0x220, 0x228, 0x230,
-    0x238, 0x240, 0x248, 0x250, 0x258, 0x260, 0x268, 0x270, 0x278, 0x280,
-    0x288, 0x290, 0x298, 0x2A0, 0x2A8, 0x2B0, 0x2B8, 0x2C0, 0x2C8, 0x2D0,
-    0x2D8, 0x2E0, 0x2E8, 0x2F0, 0x2F8, 0x300, 0x308, 0x310, 0x318, 0x320,
-    0x328, 0x330, 0x338, 0x340, 0x348, 0x350, 0x358, 0x360, 0x368, 0x370,
-    0x378, 0x380, 0x388, 0x390, 0x398, 0x3A0, 0x3A8, 0x3B0, 0x3B8, 0x3C0,
-    0x3C8, 0x3D0, 0x3D8, 0x3E0, 0x3E8, 0x3F0, 0x3F8, 0x400, 0x440, 0x480,
-    0x4C0, 0x500, 0x540, 0x580, 0x5C0, 0x600, 0x640, 0x680, 0x6C0, 0x700,
-    0x740, 0x780, 0x7C0, 0x800, 0x900, 0xA00, 0xB00, 0xC00, 0xD00, 0xE00,
-    0xF00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x3000, 0x4000
-};
-
-
-
-static av_cold int dpcm_decode_init(AVCodecContext *avctx)
-{
-    DPCMContext *s = avctx->priv_data;
-    int i;
-    short square;
-
-    s->channels = avctx->channels;
-    s->sample[0] = s->sample[1] = 0;
-
-    switch(avctx->codec->id) {
-
-    case CODEC_ID_ROQ_DPCM:
-        /* initialize square table */
-        for (i = 0; i < 128; i++) {
-            square = i * i;
-            s->roq_square_array[i] = square;
-            s->roq_square_array[i + 128] = -square;
-        }
-        break;
-
-
-    case CODEC_ID_SOL_DPCM:
-        switch(avctx->codec_tag){
-        case 1:
-            s->sol_table=sol_table_old;
-            s->sample[0] = s->sample[1] = 0x80;
-            break;
-        case 2:
-            s->sol_table=sol_table_new;
-            s->sample[0] = s->sample[1] = 0x80;
-            break;
-        case 3:
-            s->sol_table=sol_table_16;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unknown SOL subcodec\n");
-            return -1;
-        }
-        break;
-
-    default:
-        break;
-    }
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-static int dpcm_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    DPCMContext *s = avctx->priv_data;
-    int in, out = 0;
-    int predictor[2];
-    int channel_number = 0;
-    short *output_samples = data;
-    int shift[2];
-    unsigned char byte;
-    short diff;
-
-    if (!buf_size)
-        return 0;
-
-    // almost every DPCM variant expands one byte of data into two
-    if(*data_size/2 < buf_size)
-        return -1;
-
-    switch(avctx->codec->id) {
-
-    case CODEC_ID_ROQ_DPCM:
-        if (s->channels == 1)
-            predictor[0] = AV_RL16(&buf[6]);
-        else {
-            predictor[0] = buf[7] << 8;
-            predictor[1] = buf[6] << 8;
-        }
-        SE_16BIT(predictor[0]);
-        SE_16BIT(predictor[1]);
-
-        /* decode the samples */
-        for (in = 8, out = 0; in < buf_size; in++, out++) {
-            predictor[channel_number] += s->roq_square_array[buf[in]];
-            predictor[channel_number] = av_clip_int16(predictor[channel_number]);
-            output_samples[out] = predictor[channel_number];
-
-            /* toggle channel */
-            channel_number ^= s->channels - 1;
-        }
-        break;
-
-    case CODEC_ID_INTERPLAY_DPCM:
-        in = 6;  /* skip over the stream mask and stream length */
-        predictor[0] = AV_RL16(&buf[in]);
-        in += 2;
-        SE_16BIT(predictor[0])
-        output_samples[out++] = predictor[0];
-        if (s->channels == 2) {
-            predictor[1] = AV_RL16(&buf[in]);
-            in += 2;
-            SE_16BIT(predictor[1])
-            output_samples[out++] = predictor[1];
-        }
-
-        while (in < buf_size) {
-            predictor[channel_number] += interplay_delta_table[buf[in++]];
-            predictor[channel_number] = av_clip_int16(predictor[channel_number]);
-            output_samples[out++] = predictor[channel_number];
-
-            /* toggle channel */
-            channel_number ^= s->channels - 1;
-        }
-
-        break;
-
-    case CODEC_ID_XAN_DPCM:
-        in = 0;
-        shift[0] = shift[1] = 4;
-        predictor[0] = AV_RL16(&buf[in]);
-        in += 2;
-        SE_16BIT(predictor[0]);
-        if (s->channels == 2) {
-            predictor[1] = AV_RL16(&buf[in]);
-            in += 2;
-            SE_16BIT(predictor[1]);
-        }
-
-        while (in < buf_size) {
-            byte = buf[in++];
-            diff = (byte & 0xFC) << 8;
-            if ((byte & 0x03) == 3)
-                shift[channel_number]++;
-            else
-                shift[channel_number] -= (2 * (byte & 3));
-            /* saturate the shifter to a lower limit of 0 */
-            if (shift[channel_number] < 0)
-                shift[channel_number] = 0;
-
-            diff >>= shift[channel_number];
-            predictor[channel_number] += diff;
-
-            predictor[channel_number] = av_clip_int16(predictor[channel_number]);
-            output_samples[out++] = predictor[channel_number];
-
-            /* toggle channel */
-            channel_number ^= s->channels - 1;
-        }
-        break;
-    case CODEC_ID_SOL_DPCM:
-        in = 0;
-        if (avctx->codec_tag != 3) {
-            if(*data_size/4 < buf_size)
-                return -1;
-            while (in < buf_size) {
-                int n1, n2;
-                n1 = (buf[in] >> 4) & 0xF;
-                n2 = buf[in++] & 0xF;
-                s->sample[0] += s->sol_table[n1];
-                if (s->sample[0] < 0) s->sample[0] = 0;
-                if (s->sample[0] > 255) s->sample[0] = 255;
-                output_samples[out++] = (s->sample[0] - 128) << 8;
-                s->sample[s->channels - 1] += s->sol_table[n2];
-                if (s->sample[s->channels - 1] < 0) s->sample[s->channels - 1] = 0;
-                if (s->sample[s->channels - 1] > 255) s->sample[s->channels - 1] = 255;
-                output_samples[out++] = (s->sample[s->channels - 1] - 128) << 8;
-            }
-        } else {
-            while (in < buf_size) {
-                int n;
-                n = buf[in++];
-                if (n & 0x80) s->sample[channel_number] -= s->sol_table[n & 0x7F];
-                else s->sample[channel_number] += s->sol_table[n & 0x7F];
-                s->sample[channel_number] = av_clip_int16(s->sample[channel_number]);
-                output_samples[out++] = s->sample[channel_number];
-                /* toggle channel */
-                channel_number ^= s->channels - 1;
-            }
-        }
-        break;
-    }
-
-    *data_size = out * sizeof(short);
-    return buf_size;
-}
-
-#define DPCM_DECODER(id, name, long_name_)      \
-AVCodec name ## _decoder = {                    \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    sizeof(DPCMContext),                        \
-    dpcm_decode_init,                           \
-    NULL,                                       \
-    NULL,                                       \
-    dpcm_decode_frame,                          \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
-
-DPCM_DECODER(CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay");
-DPCM_DECODER(CODEC_ID_ROQ_DPCM, roq_dpcm, "DPCM id RoQ");
-DPCM_DECODER(CODEC_ID_SOL_DPCM, sol_dpcm, "DPCM Sol");
-DPCM_DECODER(CODEC_ID_XAN_DPCM, xan_dpcm, "DPCM Xan");
diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
deleted file mode 100644
index 94a9181..0000000
--- a/libavcodec/dpx.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * DPX (.dpx) image decoder
- * Copyright (c) 2009 Jimmy Christensen
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "bytestream.h"
-#include "avcodec.h"
-
-typedef struct DPXContext {
-    AVFrame picture;
-} DPXContext;
-
-
-static unsigned int read32(const uint8_t **ptr, int is_big)
-{
-    unsigned int temp;
-    if (is_big) {
-        temp = AV_RB32(*ptr);
-    } else {
-        temp = AV_RL32(*ptr);
-    }
-    *ptr += 4;
-    return temp;
-}
-
-static inline unsigned make_16bit(unsigned value)
-{
-    // mask away invalid bits
-    value &= 0xFFC0;
-    // correctly expand to 16 bits
-    return value + (value >> 10);
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data,
-                        int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    DPXContext *const s = avctx->priv_data;
-    AVFrame *picture  = data;
-    AVFrame *const p = &s->picture;
-    uint8_t *ptr;
-
-    int magic_num, offset, endian;
-    int x, y;
-    int w, h, stride, bits_per_color, descriptor, elements, target_packet_size, source_packet_size;
-
-    unsigned int rgbBuffer;
-
-    magic_num = AV_RB32(buf);
-    buf += 4;
-
-    /* Check if the files "magic number" is "SDPX" which means it uses
-     * big-endian or XPDS which is for little-endian files */
-    if (magic_num == AV_RL32("SDPX")) {
-        endian = 0;
-    } else if (magic_num == AV_RB32("SDPX")) {
-        endian = 1;
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "DPX marker not found\n");
-        return -1;
-    }
-
-    offset = read32(&buf, endian);
-    // Need to end in 0x304 offset from start of file
-    buf = avpkt->data + 0x304;
-    w = read32(&buf, endian);
-    h = read32(&buf, endian);
-
-    // Need to end in 0x320 to read the descriptor
-    buf += 20;
-    descriptor = buf[0];
-
-    // Need to end in 0x323 to read the bits per color
-    buf += 3;
-    avctx->bits_per_raw_sample =
-    bits_per_color = buf[0];
-
-    switch (descriptor) {
-        case 51: // RGBA
-            elements = 4;
-            break;
-        case 50: // RGB
-            elements = 3;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unsupported descriptor %d\n", descriptor);
-            return -1;
-    }
-
-    switch (bits_per_color) {
-        case 8:
-            if (elements == 4) {
-                avctx->pix_fmt = PIX_FMT_RGBA;
-            } else {
-                avctx->pix_fmt = PIX_FMT_RGB24;
-            }
-            source_packet_size = elements;
-            target_packet_size = elements;
-            break;
-        case 10:
-            avctx->pix_fmt = PIX_FMT_RGB48;
-            target_packet_size = 6;
-            source_packet_size = elements * 2;
-            break;
-        case 12:
-        case 16:
-            if (endian) {
-                avctx->pix_fmt = PIX_FMT_RGB48BE;
-            } else {
-                avctx->pix_fmt = PIX_FMT_RGB48LE;
-            }
-            target_packet_size = 6;
-            source_packet_size = elements * 2;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unsupported color depth : %d\n", bits_per_color);
-            return -1;
-    }
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-    if (avcodec_check_dimensions(avctx, w, h))
-        return -1;
-    if (w != avctx->width || h != avctx->height)
-        avcodec_set_dimensions(avctx, w, h);
-    if (avctx->get_buffer(avctx, p) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    // Move pointer to offset from start of file
-    buf =  avpkt->data + offset;
-
-    ptr    = p->data[0];
-    stride = p->linesize[0];
-
-    switch (bits_per_color) {
-        case 10:
-            for (x = 0; x < avctx->height; x++) {
-               uint16_t *dst = (uint16_t*)ptr;
-               for (y = 0; y < avctx->width; y++) {
-                   rgbBuffer = read32(&buf, endian);
-                   // Read out the 10-bit colors and convert to 16-bit
-                   *dst++ = make_16bit(rgbBuffer >> 16);
-                   *dst++ = make_16bit(rgbBuffer >>  6);
-                   *dst++ = make_16bit(rgbBuffer <<  4);
-               }
-               ptr += stride;
-            }
-            break;
-        case 8:
-        case 12: // Treat 12-bit as 16-bit
-        case 16:
-            if (source_packet_size == target_packet_size) {
-                for (x = 0; x < avctx->height; x++) {
-                    memcpy(ptr, buf, target_packet_size*avctx->width);
-                    ptr += stride;
-                    buf += source_packet_size*avctx->width;
-                }
-            } else {
-                for (x = 0; x < avctx->height; x++) {
-                    uint8_t *dst = ptr;
-                    for (y = 0; y < avctx->width; y++) {
-                        memcpy(dst, buf, target_packet_size);
-                        dst += target_packet_size;
-                        buf += source_packet_size;
-                    }
-                    ptr += stride;
-                }
-            }
-            break;
-    }
-
-    *picture   = s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    DPXContext *s = avctx->priv_data;
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame = &s->picture;
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    DPXContext *s = avctx->priv_data;
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-AVCodec dpx_decoder = {
-    "dpx",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DPX,
-    sizeof(DPXContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    0,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("DPX image"),
-};
diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c
deleted file mode 100644
index 895b623..0000000
--- a/libavcodec/dsicinav.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Delphine Software International CIN Audio/Video Decoders
- * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Delphine Software International CIN audio/video decoders
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-
-typedef enum CinVideoBitmapIndex {
-    CIN_CUR_BMP = 0, /* current */
-    CIN_PRE_BMP = 1, /* previous */
-    CIN_INT_BMP = 2  /* intermediate */
-} CinVideoBitmapIndex;
-
-typedef struct CinVideoContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    unsigned int bitmap_size;
-    uint32_t palette[256];
-    uint8_t *bitmap_table[3];
-} CinVideoContext;
-
-typedef struct CinAudioContext {
-    AVCodecContext *avctx;
-    int initial_decode_frame;
-    int delta;
-} CinAudioContext;
-
-
-/* table defining a geometric sequence with multiplier = 32767 ^ (1 / 128) */
-static const int16_t cinaudio_delta16_table[256] = {
-         0,      0,      0,      0,      0,      0,      0,      0,
-         0,      0,      0,      0,      0,      0,      0,      0,
-         0,      0,      0, -30210, -27853, -25680, -23677, -21829,
-    -20126, -18556, -17108, -15774, -14543, -13408, -12362, -11398,
-    -10508,  -9689,  -8933,  -8236,  -7593,  -7001,  -6455,  -5951,
-     -5487,  -5059,  -4664,  -4300,  -3964,  -3655,  -3370,  -3107,
-     -2865,  -2641,  -2435,  -2245,  -2070,  -1908,  -1759,  -1622,
-     -1495,  -1379,  -1271,  -1172,  -1080,   -996,   -918,   -847,
-      -781,   -720,   -663,   -612,   -564,   -520,   -479,   -442,
-      -407,   -376,   -346,   -319,   -294,   -271,   -250,   -230,
-      -212,   -196,   -181,   -166,   -153,   -141,   -130,   -120,
-      -111,   -102,    -94,    -87,    -80,    -74,    -68,    -62,
-       -58,    -53,    -49,    -45,    -41,    -38,    -35,    -32,
-       -30,    -27,    -25,    -23,    -21,    -20,    -18,    -17,
-       -15,    -14,    -13,    -12,    -11,    -10,     -9,     -8,
-        -7,     -6,     -5,     -4,     -3,     -2,     -1,      0,
-         0,      1,      2,      3,      4,      5,      6,      7,
-         8,      9,     10,     11,     12,     13,     14,     15,
-        17,     18,     20,     21,     23,     25,     27,     30,
-        32,     35,     38,     41,     45,     49,     53,     58,
-        62,     68,     74,     80,     87,     94,    102,    111,
-       120,    130,    141,    153,    166,    181,    196,    212,
-       230,    250,    271,    294,    319,    346,    376,    407,
-       442,    479,    520,    564,    612,    663,    720,    781,
-       847,    918,    996,   1080,   1172,   1271,   1379,   1495,
-      1622,   1759,   1908,   2070,   2245,   2435,   2641,   2865,
-      3107,   3370,   3655,   3964,   4300,   4664,   5059,   5487,
-      5951,   6455,   7001,   7593,   8236,   8933,   9689,  10508,
-     11398,  12362,  13408,  14543,  15774,  17108,  18556,  20126,
-     21829,  23677,  25680,  27853,  30210,      0,      0,      0,
-         0,      0,      0,      0,      0,      0,      0,      0,
-         0,      0,      0,      0,      0,      0,      0,      0
-};
-
-
-static av_cold int cinvideo_decode_init(AVCodecContext *avctx)
-{
-    CinVideoContext *cin = avctx->priv_data;
-    unsigned int i;
-
-    cin->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    cin->frame.data[0] = NULL;
-
-    cin->bitmap_size = avctx->width * avctx->height;
-    for (i = 0; i < 3; ++i) {
-        cin->bitmap_table[i] = av_mallocz(cin->bitmap_size);
-        if (!cin->bitmap_table[i])
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate bitmap buffers.\n");
-    }
-
-    return 0;
-}
-
-static void cin_apply_delta_data(const unsigned char *src, unsigned char *dst, int size)
-{
-    while (size--)
-        *dst++ += *src++;
-}
-
-static int cin_decode_huffman(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
-{
-    int b, huff_code = 0;
-    unsigned char huff_code_table[15];
-    unsigned char *dst_cur = dst;
-    unsigned char *dst_end = dst + dst_size;
-    const unsigned char *src_end = src + src_size;
-
-    memcpy(huff_code_table, src, 15); src += 15; src_size -= 15;
-
-    while (src < src_end) {
-        huff_code = *src++;
-        if ((huff_code >> 4) == 15) {
-            b = huff_code << 4;
-            huff_code = *src++;
-            *dst_cur++ = b | (huff_code >> 4);
-        } else
-            *dst_cur++ = huff_code_table[huff_code >> 4];
-        if (dst_cur >= dst_end)
-            break;
-
-        huff_code &= 15;
-        if (huff_code == 15) {
-            *dst_cur++ = *src++;
-        } else
-            *dst_cur++ = huff_code_table[huff_code];
-        if (dst_cur >= dst_end)
-            break;
-    }
-
-    return dst_cur - dst;
-}
-
-static void cin_decode_lzss(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
-{
-    uint16_t cmd;
-    int i, sz, offset, code;
-    unsigned char *dst_end = dst + dst_size;
-    const unsigned char *src_end = src + src_size;
-
-    while (src < src_end && dst < dst_end) {
-        code = *src++;
-        for (i = 0; i < 8 && src < src_end && dst < dst_end; ++i) {
-            if (code & (1 << i)) {
-                *dst++ = *src++;
-            } else {
-                cmd = AV_RL16(src); src += 2;
-                offset = cmd >> 4;
-                sz = (cmd & 0xF) + 2;
-                /* don't use memcpy/memmove here as the decoding routine (ab)uses */
-                /* buffer overlappings to repeat bytes in the destination */
-                sz = FFMIN(sz, dst_end - dst);
-                while (sz--) {
-                    *dst = *(dst - offset - 1);
-                    ++dst;
-                }
-            }
-        }
-    }
-}
-
-static void cin_decode_rle(const unsigned char *src, int src_size, unsigned char *dst, int dst_size)
-{
-    int len, code;
-    unsigned char *dst_end = dst + dst_size;
-    const unsigned char *src_end = src + src_size;
-
-    while (src < src_end && dst < dst_end) {
-        code = *src++;
-        if (code & 0x80) {
-            len = code - 0x7F;
-            memset(dst, *src++, FFMIN(len, dst_end - dst));
-        } else {
-            len = code + 1;
-            memcpy(dst, src, FFMIN(len, dst_end - dst));
-            src += len;
-        }
-        dst += len;
-    }
-}
-
-static int cinvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CinVideoContext *cin = avctx->priv_data;
-    int i, y, palette_type, palette_colors_count, bitmap_frame_type, bitmap_frame_size;
-
-    cin->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &cin->frame)) {
-        av_log(cin->avctx, AV_LOG_ERROR, "delphinecinvideo: reget_buffer() failed to allocate a frame\n");
-        return -1;
-    }
-
-    palette_type = buf[0];
-    palette_colors_count = AV_RL16(buf+1);
-    bitmap_frame_type = buf[3];
-    buf += 4;
-
-    bitmap_frame_size = buf_size - 4;
-
-    /* handle palette */
-    if (palette_type == 0) {
-        for (i = 0; i < palette_colors_count; ++i) {
-            cin->palette[i] = bytestream_get_le24(&buf);
-            bitmap_frame_size -= 3;
-        }
-    } else {
-        for (i = 0; i < palette_colors_count; ++i) {
-            cin->palette[buf[0]] = AV_RL24(buf+1);
-            buf += 4;
-            bitmap_frame_size -= 4;
-        }
-    }
-    memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette));
-    cin->frame.palette_has_changed = 1;
-
-    /* note: the decoding routines below assumes that surface.width = surface.pitch */
-    switch (bitmap_frame_type) {
-    case 9:
-        cin_decode_rle(buf, bitmap_frame_size,
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        break;
-    case 34:
-        cin_decode_rle(buf, bitmap_frame_size,
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        break;
-    case 35:
-        cin_decode_huffman(buf, bitmap_frame_size,
-          cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
-        cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        break;
-    case 36:
-        bitmap_frame_size = cin_decode_huffman(buf, bitmap_frame_size,
-          cin->bitmap_table[CIN_INT_BMP], cin->bitmap_size);
-        cin_decode_rle(cin->bitmap_table[CIN_INT_BMP], bitmap_frame_size,
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        break;
-    case 37:
-        cin_decode_huffman(buf, bitmap_frame_size,
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        break;
-    case 38:
-        cin_decode_lzss(buf, bitmap_frame_size,
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        break;
-    case 39:
-        cin_decode_lzss(buf, bitmap_frame_size,
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        cin_apply_delta_data(cin->bitmap_table[CIN_PRE_BMP],
-          cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_size);
-        break;
-    }
-
-    for (y = 0; y < cin->avctx->height; ++y)
-        memcpy(cin->frame.data[0] + (cin->avctx->height - 1 - y) * cin->frame.linesize[0],
-          cin->bitmap_table[CIN_CUR_BMP] + y * cin->avctx->width,
-          cin->avctx->width);
-
-    FFSWAP(uint8_t *, cin->bitmap_table[CIN_CUR_BMP], cin->bitmap_table[CIN_PRE_BMP]);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame *)data = cin->frame;
-
-    return buf_size;
-}
-
-static av_cold int cinvideo_decode_end(AVCodecContext *avctx)
-{
-    CinVideoContext *cin = avctx->priv_data;
-    int i;
-
-    if (cin->frame.data[0])
-        avctx->release_buffer(avctx, &cin->frame);
-
-    for (i = 0; i < 3; ++i)
-        av_free(cin->bitmap_table[i]);
-
-    return 0;
-}
-
-static av_cold int cinaudio_decode_init(AVCodecContext *avctx)
-{
-    CinAudioContext *cin = avctx->priv_data;
-
-    cin->avctx = avctx;
-    cin->initial_decode_frame = 1;
-    cin->delta = 0;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    return 0;
-}
-
-static int cinaudio_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CinAudioContext *cin = avctx->priv_data;
-    const uint8_t *src = buf;
-    int16_t *samples = (int16_t *)data;
-
-    buf_size = FFMIN(buf_size, *data_size/2);
-
-    if (cin->initial_decode_frame) {
-        cin->initial_decode_frame = 0;
-        cin->delta = (int16_t)AV_RL16(src); src += 2;
-        *samples++ = cin->delta;
-        buf_size -= 2;
-    }
-    while (buf_size > 0) {
-        cin->delta += cinaudio_delta16_table[*src++];
-        cin->delta = av_clip_int16(cin->delta);
-        *samples++ = cin->delta;
-        --buf_size;
-    }
-
-    *data_size = (uint8_t *)samples - (uint8_t *)data;
-
-    return src - buf;
-}
-
-
-AVCodec dsicinvideo_decoder = {
-    "dsicinvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DSICINVIDEO,
-    sizeof(CinVideoContext),
-    cinvideo_decode_init,
-    NULL,
-    cinvideo_decode_end,
-    cinvideo_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"),
-};
-
-AVCodec dsicinaudio_decoder = {
-    "dsicinaudio",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_DSICINAUDIO,
-    sizeof(CinAudioContext),
-    cinaudio_decode_init,
-    NULL,
-    NULL,
-    cinaudio_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"),
-};
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
deleted file mode 100644
index 0701324..0000000
--- a/libavcodec/dsputil.c
+++ /dev/null
@@ -1,4566 +0,0 @@
-/*
- * DSP utils
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DSP utils
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "simple_idct.h"
-#include "faandct.h"
-#include "faanidct.h"
-#include "mathops.h"
-#include "mpegvideo.h"
-#include "config.h"
-#include "lpc.h"
-#include "ac3dec.h"
-#include "vorbis.h"
-#include "png.h"
-
-uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
-uint32_t ff_squareTbl[512] = {0, };
-
-// 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size
-#define pb_7f (~0UL/255 * 0x7f)
-#define pb_80 (~0UL/255 * 0x80)
-
-const uint8_t ff_zigzag_direct[64] = {
-    0,   1,  8, 16,  9,  2,  3, 10,
-    17, 24, 32, 25, 18, 11,  4,  5,
-    12, 19, 26, 33, 40, 48, 41, 34,
-    27, 20, 13,  6,  7, 14, 21, 28,
-    35, 42, 49, 56, 57, 50, 43, 36,
-    29, 22, 15, 23, 30, 37, 44, 51,
-    58, 59, 52, 45, 38, 31, 39, 46,
-    53, 60, 61, 54, 47, 55, 62, 63
-};
-
-/* Specific zigzag scan for 248 idct. NOTE that unlike the
-   specification, we interleave the fields */
-const uint8_t ff_zigzag248_direct[64] = {
-     0,  8,  1,  9, 16, 24,  2, 10,
-    17, 25, 32, 40, 48, 56, 33, 41,
-    18, 26,  3, 11,  4, 12, 19, 27,
-    34, 42, 49, 57, 50, 58, 35, 43,
-    20, 28,  5, 13,  6, 14, 21, 29,
-    36, 44, 51, 59, 52, 60, 37, 45,
-    22, 30,  7, 15, 23, 31, 38, 46,
-    53, 61, 54, 62, 39, 47, 55, 63,
-};
-
-/* not permutated inverse zigzag_direct + 1 for MMX quantizer */
-DECLARE_ALIGNED(16, uint16_t, inv_zigzag_direct16)[64];
-
-const uint8_t ff_alternate_horizontal_scan[64] = {
-    0,  1,   2,  3,  8,  9, 16, 17,
-    10, 11,  4,  5,  6,  7, 15, 14,
-    13, 12, 19, 18, 24, 25, 32, 33,
-    26, 27, 20, 21, 22, 23, 28, 29,
-    30, 31, 34, 35, 40, 41, 48, 49,
-    42, 43, 36, 37, 38, 39, 44, 45,
-    46, 47, 50, 51, 56, 57, 58, 59,
-    52, 53, 54, 55, 60, 61, 62, 63,
-};
-
-const uint8_t ff_alternate_vertical_scan[64] = {
-    0,  8,  16, 24,  1,  9,  2, 10,
-    17, 25, 32, 40, 48, 56, 57, 49,
-    41, 33, 26, 18,  3, 11,  4, 12,
-    19, 27, 34, 42, 50, 58, 35, 43,
-    51, 59, 20, 28,  5, 13,  6, 14,
-    21, 29, 36, 44, 52, 60, 37, 45,
-    53, 61, 22, 30,  7, 15, 23, 31,
-    38, 46, 54, 62, 39, 47, 55, 63,
-};
-
-/* a*inverse[b]>>32 == a/b for all 0<=a<=16909558 && 2<=b<=256
- * for a>16909558, is an overestimate by less than 1 part in 1<<24 */
-const uint32_t ff_inverse[257]={
-         0, 4294967295U,2147483648U,1431655766, 1073741824,  858993460,  715827883,  613566757,
- 536870912,  477218589,  429496730,  390451573,  357913942,  330382100,  306783379,  286331154,
- 268435456,  252645136,  238609295,  226050911,  214748365,  204522253,  195225787,  186737709,
- 178956971,  171798692,  165191050,  159072863,  153391690,  148102321,  143165577,  138547333,
- 134217728,  130150525,  126322568,  122713352,  119304648,  116080198,  113025456,  110127367,
- 107374183,  104755300,  102261127,   99882961,   97612894,   95443718,   93368855,   91382283,
-  89478486,   87652394,   85899346,   84215046,   82595525,   81037119,   79536432,   78090315,
-  76695845,   75350304,   74051161,   72796056,   71582789,   70409300,   69273667,   68174085,
-  67108864,   66076420,   65075263,   64103990,   63161284,   62245903,   61356676,   60492498,
-  59652324,   58835169,   58040099,   57266231,   56512728,   55778797,   55063684,   54366675,
-  53687092,   53024288,   52377650,   51746594,   51130564,   50529028,   49941481,   49367441,
-  48806447,   48258060,   47721859,   47197443,   46684428,   46182445,   45691142,   45210183,
-  44739243,   44278014,   43826197,   43383509,   42949673,   42524429,   42107523,   41698712,
-  41297763,   40904451,   40518560,   40139882,   39768216,   39403370,   39045158,   38693400,
-  38347923,   38008561,   37675152,   37347542,   37025581,   36709123,   36398028,   36092163,
-  35791395,   35495598,   35204650,   34918434,   34636834,   34359739,   34087043,   33818641,
-  33554432,   33294321,   33038210,   32786010,   32537632,   32292988,   32051995,   31814573,
-  31580642,   31350127,   31122952,   30899046,   30678338,   30460761,   30246249,   30034737,
-  29826162,   29620465,   29417585,   29217465,   29020050,   28825284,   28633116,   28443493,
-  28256364,   28071682,   27889399,   27709467,   27531842,   27356480,   27183338,   27012373,
-  26843546,   26676816,   26512144,   26349493,   26188825,   26030105,   25873297,   25718368,
-  25565282,   25414008,   25264514,   25116768,   24970741,   24826401,   24683721,   24542671,
-  24403224,   24265352,   24129030,   23994231,   23860930,   23729102,   23598722,   23469767,
-  23342214,   23216040,   23091223,   22967740,   22845571,   22724695,   22605092,   22486740,
-  22369622,   22253717,   22139007,   22025474,   21913099,   21801865,   21691755,   21582751,
-  21474837,   21367997,   21262215,   21157475,   21053762,   20951060,   20849356,   20748635,
-  20648882,   20550083,   20452226,   20355296,   20259280,   20164166,   20069941,   19976593,
-  19884108,   19792477,   19701685,   19611723,   19522579,   19434242,   19346700,   19259944,
-  19173962,   19088744,   19004281,   18920561,   18837576,   18755316,   18673771,   18592933,
-  18512791,   18433337,   18354562,   18276457,   18199014,   18122225,   18046082,   17970575,
-  17895698,   17821442,   17747799,   17674763,   17602325,   17530479,   17459217,   17388532,
-  17318417,   17248865,   17179870,   17111424,   17043522,   16976156,   16909321,   16843010,
-  16777216
-};
-
-/* Input permutation for the simple_idct_mmx */
-static const uint8_t simple_mmx_permutation[64]={
-        0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
-        0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
-        0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D,
-        0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F,
-        0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F,
-        0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
-        0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
-        0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
-};
-
-static const uint8_t idct_sse2_row_perm[8] = {0, 4, 1, 5, 2, 6, 3, 7};
-
-void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable){
-    int i;
-    int end;
-
-    st->scantable= src_scantable;
-
-    for(i=0; i<64; i++){
-        int j;
-        j = src_scantable[i];
-        st->permutated[i] = permutation[j];
-#if ARCH_PPC
-        st->inverse[j] = i;
-#endif
-    }
-
-    end=-1;
-    for(i=0; i<64; i++){
-        int j;
-        j = st->permutated[i];
-        if(j>end) end=j;
-        st->raster_end[i]= end;
-    }
-}
-
-static int pix_sum_c(uint8_t * pix, int line_size)
-{
-    int s, i, j;
-
-    s = 0;
-    for (i = 0; i < 16; i++) {
-        for (j = 0; j < 16; j += 8) {
-            s += pix[0];
-            s += pix[1];
-            s += pix[2];
-            s += pix[3];
-            s += pix[4];
-            s += pix[5];
-            s += pix[6];
-            s += pix[7];
-            pix += 8;
-        }
-        pix += line_size - 16;
-    }
-    return s;
-}
-
-static int pix_norm1_c(uint8_t * pix, int line_size)
-{
-    int s, i, j;
-    uint32_t *sq = ff_squareTbl + 256;
-
-    s = 0;
-    for (i = 0; i < 16; i++) {
-        for (j = 0; j < 16; j += 8) {
-#if 0
-            s += sq[pix[0]];
-            s += sq[pix[1]];
-            s += sq[pix[2]];
-            s += sq[pix[3]];
-            s += sq[pix[4]];
-            s += sq[pix[5]];
-            s += sq[pix[6]];
-            s += sq[pix[7]];
-#else
-#if LONG_MAX > 2147483647
-            register uint64_t x=*(uint64_t*)pix;
-            s += sq[x&0xff];
-            s += sq[(x>>8)&0xff];
-            s += sq[(x>>16)&0xff];
-            s += sq[(x>>24)&0xff];
-            s += sq[(x>>32)&0xff];
-            s += sq[(x>>40)&0xff];
-            s += sq[(x>>48)&0xff];
-            s += sq[(x>>56)&0xff];
-#else
-            register uint32_t x=*(uint32_t*)pix;
-            s += sq[x&0xff];
-            s += sq[(x>>8)&0xff];
-            s += sq[(x>>16)&0xff];
-            s += sq[(x>>24)&0xff];
-            x=*(uint32_t*)(pix+4);
-            s += sq[x&0xff];
-            s += sq[(x>>8)&0xff];
-            s += sq[(x>>16)&0xff];
-            s += sq[(x>>24)&0xff];
-#endif
-#endif
-            pix += 8;
-        }
-        pix += line_size - 16;
-    }
-    return s;
-}
-
-static void bswap_buf(uint32_t *dst, const uint32_t *src, int w){
-    int i;
-
-    for(i=0; i+8<=w; i+=8){
-        dst[i+0]= bswap_32(src[i+0]);
-        dst[i+1]= bswap_32(src[i+1]);
-        dst[i+2]= bswap_32(src[i+2]);
-        dst[i+3]= bswap_32(src[i+3]);
-        dst[i+4]= bswap_32(src[i+4]);
-        dst[i+5]= bswap_32(src[i+5]);
-        dst[i+6]= bswap_32(src[i+6]);
-        dst[i+7]= bswap_32(src[i+7]);
-    }
-    for(;i<w; i++){
-        dst[i+0]= bswap_32(src[i+0]);
-    }
-}
-
-static int sse4_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
-{
-    int s, i;
-    uint32_t *sq = ff_squareTbl + 256;
-
-    s = 0;
-    for (i = 0; i < h; i++) {
-        s += sq[pix1[0] - pix2[0]];
-        s += sq[pix1[1] - pix2[1]];
-        s += sq[pix1[2] - pix2[2]];
-        s += sq[pix1[3] - pix2[3]];
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    return s;
-}
-
-static int sse8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h)
-{
-    int s, i;
-    uint32_t *sq = ff_squareTbl + 256;
-
-    s = 0;
-    for (i = 0; i < h; i++) {
-        s += sq[pix1[0] - pix2[0]];
-        s += sq[pix1[1] - pix2[1]];
-        s += sq[pix1[2] - pix2[2]];
-        s += sq[pix1[3] - pix2[3]];
-        s += sq[pix1[4] - pix2[4]];
-        s += sq[pix1[5] - pix2[5]];
-        s += sq[pix1[6] - pix2[6]];
-        s += sq[pix1[7] - pix2[7]];
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    return s;
-}
-
-static int sse16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-    uint32_t *sq = ff_squareTbl + 256;
-
-    s = 0;
-    for (i = 0; i < h; i++) {
-        s += sq[pix1[ 0] - pix2[ 0]];
-        s += sq[pix1[ 1] - pix2[ 1]];
-        s += sq[pix1[ 2] - pix2[ 2]];
-        s += sq[pix1[ 3] - pix2[ 3]];
-        s += sq[pix1[ 4] - pix2[ 4]];
-        s += sq[pix1[ 5] - pix2[ 5]];
-        s += sq[pix1[ 6] - pix2[ 6]];
-        s += sq[pix1[ 7] - pix2[ 7]];
-        s += sq[pix1[ 8] - pix2[ 8]];
-        s += sq[pix1[ 9] - pix2[ 9]];
-        s += sq[pix1[10] - pix2[10]];
-        s += sq[pix1[11] - pix2[11]];
-        s += sq[pix1[12] - pix2[12]];
-        s += sq[pix1[13] - pix2[13]];
-        s += sq[pix1[14] - pix2[14]];
-        s += sq[pix1[15] - pix2[15]];
-
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    return s;
-}
-
-/* draw the edges of width 'w' of an image of size width, height */
-//FIXME check that this is ok for mpeg4 interlaced
-static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
-{
-    uint8_t *ptr, *last_line;
-    int i;
-
-    last_line = buf + (height - 1) * wrap;
-    for(i=0;i<w;i++) {
-        /* top and bottom */
-        memcpy(buf - (i + 1) * wrap, buf, width);
-        memcpy(last_line + (i + 1) * wrap, last_line, width);
-    }
-    /* left and right */
-    ptr = buf;
-    for(i=0;i<height;i++) {
-        memset(ptr - w, ptr[0], w);
-        memset(ptr + width, ptr[width-1], w);
-        ptr += wrap;
-    }
-    /* corners */
-    for(i=0;i<w;i++) {
-        memset(buf - (i + 1) * wrap - w, buf[0], w); /* top left */
-        memset(buf - (i + 1) * wrap + width, buf[width-1], w); /* top right */
-        memset(last_line + (i + 1) * wrap - w, last_line[0], w); /* top left */
-        memset(last_line + (i + 1) * wrap + width, last_line[width-1], w); /* top right */
-    }
-}
-
-/**
- * Copies a rectangular area of samples to a temporary buffer and replicates the boarder samples.
- * @param buf destination buffer
- * @param src source buffer
- * @param linesize number of bytes between 2 vertically adjacent samples in both the source and destination buffers
- * @param block_w width of block
- * @param block_h height of block
- * @param src_x x coordinate of the top left sample of the block in the source buffer
- * @param src_y y coordinate of the top left sample of the block in the source buffer
- * @param w width of the source buffer
- * @param h height of the source buffer
- */
-void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h,
-                                    int src_x, int src_y, int w, int h){
-    int x, y;
-    int start_y, start_x, end_y, end_x;
-
-    if(src_y>= h){
-        src+= (h-1-src_y)*linesize;
-        src_y=h-1;
-    }else if(src_y<=-block_h){
-        src+= (1-block_h-src_y)*linesize;
-        src_y=1-block_h;
-    }
-    if(src_x>= w){
-        src+= (w-1-src_x);
-        src_x=w-1;
-    }else if(src_x<=-block_w){
-        src+= (1-block_w-src_x);
-        src_x=1-block_w;
-    }
-
-    start_y= FFMAX(0, -src_y);
-    start_x= FFMAX(0, -src_x);
-    end_y= FFMIN(block_h, h-src_y);
-    end_x= FFMIN(block_w, w-src_x);
-
-    // copy existing part
-    for(y=start_y; y<end_y; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= src[x + y*linesize];
-        }
-    }
-
-    //top
-    for(y=0; y<start_y; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= buf[x + start_y*linesize];
-        }
-    }
-
-    //bottom
-    for(y=end_y; y<block_h; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= buf[x + (end_y-1)*linesize];
-        }
-    }
-
-    for(y=0; y<block_h; y++){
-       //left
-        for(x=0; x<start_x; x++){
-            buf[x + y*linesize]= buf[start_x + y*linesize];
-        }
-
-       //right
-        for(x=end_x; x<block_w; x++){
-            buf[x + y*linesize]= buf[end_x - 1 + y*linesize];
-        }
-    }
-}
-
-static void get_pixels_c(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
-{
-    int i;
-
-    /* read the pixels */
-    for(i=0;i<8;i++) {
-        block[0] = pixels[0];
-        block[1] = pixels[1];
-        block[2] = pixels[2];
-        block[3] = pixels[3];
-        block[4] = pixels[4];
-        block[5] = pixels[5];
-        block[6] = pixels[6];
-        block[7] = pixels[7];
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void diff_pixels_c(DCTELEM *restrict block, const uint8_t *s1,
-                          const uint8_t *s2, int stride){
-    int i;
-
-    /* read the pixels */
-    for(i=0;i<8;i++) {
-        block[0] = s1[0] - s2[0];
-        block[1] = s1[1] - s2[1];
-        block[2] = s1[2] - s2[2];
-        block[3] = s1[3] - s2[3];
-        block[4] = s1[4] - s2[4];
-        block[5] = s1[5] - s2[5];
-        block[6] = s1[6] - s2[6];
-        block[7] = s1[7] - s2[7];
-        s1 += stride;
-        s2 += stride;
-        block += 8;
-    }
-}
-
-
-static void put_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
-                                 int line_size)
-{
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    /* read the pixels */
-    for(i=0;i<8;i++) {
-        pixels[0] = cm[block[0]];
-        pixels[1] = cm[block[1]];
-        pixels[2] = cm[block[2]];
-        pixels[3] = cm[block[3]];
-        pixels[4] = cm[block[4]];
-        pixels[5] = cm[block[5]];
-        pixels[6] = cm[block[6]];
-        pixels[7] = cm[block[7]];
-
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void put_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels,
-                                 int line_size)
-{
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    /* read the pixels */
-    for(i=0;i<4;i++) {
-        pixels[0] = cm[block[0]];
-        pixels[1] = cm[block[1]];
-        pixels[2] = cm[block[2]];
-        pixels[3] = cm[block[3]];
-
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void put_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
-                                 int line_size)
-{
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    /* read the pixels */
-    for(i=0;i<2;i++) {
-        pixels[0] = cm[block[0]];
-        pixels[1] = cm[block[1]];
-
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void put_signed_pixels_clamped_c(const DCTELEM *block,
-                                        uint8_t *restrict pixels,
-                                        int line_size)
-{
-    int i, j;
-
-    for (i = 0; i < 8; i++) {
-        for (j = 0; j < 8; j++) {
-            if (*block < -128)
-                *pixels = 0;
-            else if (*block > 127)
-                *pixels = 255;
-            else
-                *pixels = (uint8_t)(*block + 128);
-            block++;
-            pixels++;
-        }
-        pixels += (line_size - 8);
-    }
-}
-
-static void put_pixels_nonclamped_c(const DCTELEM *block, uint8_t *restrict pixels,
-                                    int line_size)
-{
-    int i;
-
-    /* read the pixels */
-    for(i=0;i<8;i++) {
-        pixels[0] = block[0];
-        pixels[1] = block[1];
-        pixels[2] = block[2];
-        pixels[3] = block[3];
-        pixels[4] = block[4];
-        pixels[5] = block[5];
-        pixels[6] = block[6];
-        pixels[7] = block[7];
-
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void add_pixels_clamped_c(const DCTELEM *block, uint8_t *restrict pixels,
-                          int line_size)
-{
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    /* read the pixels */
-    for(i=0;i<8;i++) {
-        pixels[0] = cm[pixels[0] + block[0]];
-        pixels[1] = cm[pixels[1] + block[1]];
-        pixels[2] = cm[pixels[2] + block[2]];
-        pixels[3] = cm[pixels[3] + block[3]];
-        pixels[4] = cm[pixels[4] + block[4]];
-        pixels[5] = cm[pixels[5] + block[5]];
-        pixels[6] = cm[pixels[6] + block[6]];
-        pixels[7] = cm[pixels[7] + block[7]];
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void add_pixels_clamped4_c(const DCTELEM *block, uint8_t *restrict pixels,
-                          int line_size)
-{
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    /* read the pixels */
-    for(i=0;i<4;i++) {
-        pixels[0] = cm[pixels[0] + block[0]];
-        pixels[1] = cm[pixels[1] + block[1]];
-        pixels[2] = cm[pixels[2] + block[2]];
-        pixels[3] = cm[pixels[3] + block[3]];
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void add_pixels_clamped2_c(const DCTELEM *block, uint8_t *restrict pixels,
-                          int line_size)
-{
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    /* read the pixels */
-    for(i=0;i<2;i++) {
-        pixels[0] = cm[pixels[0] + block[0]];
-        pixels[1] = cm[pixels[1] + block[1]];
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void add_pixels8_c(uint8_t *restrict pixels, DCTELEM *block, int line_size)
-{
-    int i;
-    for(i=0;i<8;i++) {
-        pixels[0] += block[0];
-        pixels[1] += block[1];
-        pixels[2] += block[2];
-        pixels[3] += block[3];
-        pixels[4] += block[4];
-        pixels[5] += block[5];
-        pixels[6] += block[6];
-        pixels[7] += block[7];
-        pixels += line_size;
-        block += 8;
-    }
-}
-
-static void add_pixels4_c(uint8_t *restrict pixels, DCTELEM *block, int line_size)
-{
-    int i;
-    for(i=0;i<4;i++) {
-        pixels[0] += block[0];
-        pixels[1] += block[1];
-        pixels[2] += block[2];
-        pixels[3] += block[3];
-        pixels += line_size;
-        block += 4;
-    }
-}
-
-static int sum_abs_dctelem_c(DCTELEM *block)
-{
-    int sum=0, i;
-    for(i=0; i<64; i++)
-        sum+= FFABS(block[i]);
-    return sum;
-}
-
-static void fill_block16_c(uint8_t *block, uint8_t value, int line_size, int h)
-{
-    int i;
-
-    for (i = 0; i < h; i++) {
-        memset(block, value, 16);
-        block += line_size;
-    }
-}
-
-static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h)
-{
-    int i;
-
-    for (i = 0; i < h; i++) {
-        memset(block, value, 8);
-        block += line_size;
-    }
-}
-
-static void scale_block_c(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*/, int linesize)
-{
-    int i, j;
-    uint16_t *dst1 = (uint16_t *) dst;
-    uint16_t *dst2 = (uint16_t *)(dst + linesize);
-
-    for (j = 0; j < 8; j++) {
-        for (i = 0; i < 8; i++) {
-            dst1[i] = dst2[i] = src[i] * 0x0101;
-        }
-        src  += 8;
-        dst1 += linesize;
-        dst2 += linesize;
-    }
-}
-
-#if 0
-
-#define PIXOP2(OPNAME, OP) \
-static void OPNAME ## _pixels(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-    int i;\
-    for(i=0; i<h; i++){\
-        OP(*((uint64_t*)block), AV_RN64(pixels));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-\
-static void OPNAME ## _no_rnd_pixels_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-    int i;\
-    for(i=0; i<h; i++){\
-        const uint64_t a= AV_RN64(pixels  );\
-        const uint64_t b= AV_RN64(pixels+1);\
-        OP(*((uint64_t*)block), (a&b) + (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-\
-static void OPNAME ## _pixels_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-    int i;\
-    for(i=0; i<h; i++){\
-        const uint64_t a= AV_RN64(pixels  );\
-        const uint64_t b= AV_RN64(pixels+1);\
-        OP(*((uint64_t*)block), (a|b) - (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-\
-static void OPNAME ## _no_rnd_pixels_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-    int i;\
-    for(i=0; i<h; i++){\
-        const uint64_t a= AV_RN64(pixels          );\
-        const uint64_t b= AV_RN64(pixels+line_size);\
-        OP(*((uint64_t*)block), (a&b) + (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-\
-static void OPNAME ## _pixels_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-    int i;\
-    for(i=0; i<h; i++){\
-        const uint64_t a= AV_RN64(pixels          );\
-        const uint64_t b= AV_RN64(pixels+line_size);\
-        OP(*((uint64_t*)block), (a|b) - (((a^b)&0xFEFEFEFEFEFEFEFEULL)>>1));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-\
-static void OPNAME ## _pixels_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-        int i;\
-        const uint64_t a= AV_RN64(pixels  );\
-        const uint64_t b= AV_RN64(pixels+1);\
-        uint64_t l0=  (a&0x0303030303030303ULL)\
-                    + (b&0x0303030303030303ULL)\
-                    + 0x0202020202020202ULL;\
-        uint64_t h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
-                   + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\
-        uint64_t l1,h1;\
-\
-        pixels+=line_size;\
-        for(i=0; i<h; i+=2){\
-            uint64_t a= AV_RN64(pixels  );\
-            uint64_t b= AV_RN64(pixels+1);\
-            l1=  (a&0x0303030303030303ULL)\
-               + (b&0x0303030303030303ULL);\
-            h1= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
-              + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\
-            OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\
-            pixels+=line_size;\
-            block +=line_size;\
-            a= AV_RN64(pixels  );\
-            b= AV_RN64(pixels+1);\
-            l0=  (a&0x0303030303030303ULL)\
-               + (b&0x0303030303030303ULL)\
-               + 0x0202020202020202ULL;\
-            h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
-              + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\
-            OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\
-            pixels+=line_size;\
-            block +=line_size;\
-        }\
-}\
-\
-static void OPNAME ## _no_rnd_pixels_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-        int i;\
-        const uint64_t a= AV_RN64(pixels  );\
-        const uint64_t b= AV_RN64(pixels+1);\
-        uint64_t l0=  (a&0x0303030303030303ULL)\
-                    + (b&0x0303030303030303ULL)\
-                    + 0x0101010101010101ULL;\
-        uint64_t h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
-                   + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\
-        uint64_t l1,h1;\
-\
-        pixels+=line_size;\
-        for(i=0; i<h; i+=2){\
-            uint64_t a= AV_RN64(pixels  );\
-            uint64_t b= AV_RN64(pixels+1);\
-            l1=  (a&0x0303030303030303ULL)\
-               + (b&0x0303030303030303ULL);\
-            h1= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
-              + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\
-            OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\
-            pixels+=line_size;\
-            block +=line_size;\
-            a= AV_RN64(pixels  );\
-            b= AV_RN64(pixels+1);\
-            l0=  (a&0x0303030303030303ULL)\
-               + (b&0x0303030303030303ULL)\
-               + 0x0101010101010101ULL;\
-            h0= ((a&0xFCFCFCFCFCFCFCFCULL)>>2)\
-              + ((b&0xFCFCFCFCFCFCFCFCULL)>>2);\
-            OP(*((uint64_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0F0F0F0F0FULL));\
-            pixels+=line_size;\
-            block +=line_size;\
-        }\
-}\
-\
-CALL_2X_PIXELS(OPNAME ## _pixels16_c    , OPNAME ## _pixels_c    , 8)\
-CALL_2X_PIXELS(OPNAME ## _pixels16_x2_c , OPNAME ## _pixels_x2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _pixels16_y2_c , OPNAME ## _pixels_y2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _pixels16_xy2_c, OPNAME ## _pixels_xy2_c, 8)\
-CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_x2_c , OPNAME ## _no_rnd_pixels_x2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_y2_c , OPNAME ## _no_rnd_pixels_y2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_xy2_c, OPNAME ## _no_rnd_pixels_xy2_c, 8)
-
-#define op_avg(a, b) a = ( ((a)|(b)) - ((((a)^(b))&0xFEFEFEFEFEFEFEFEULL)>>1) )
-#else // 64 bit variant
-
-#define PIXOP2(OPNAME, OP) \
-static void OPNAME ## _pixels2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        OP(*((uint16_t*)(block  )), AV_RN16(pixels  ));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-static void OPNAME ## _pixels4_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        OP(*((uint32_t*)(block  )), AV_RN32(pixels  ));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-static void OPNAME ## _pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        OP(*((uint32_t*)(block  )), AV_RN32(pixels  ));\
-        OP(*((uint32_t*)(block+4)), AV_RN32(pixels+4));\
-        pixels+=line_size;\
-        block +=line_size;\
-    }\
-}\
-static inline void OPNAME ## _no_rnd_pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _pixels8_c(block, pixels, line_size, h);\
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
-                                                int src_stride1, int src_stride2, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        uint32_t a,b;\
-        a= AV_RN32(&src1[i*src_stride1  ]);\
-        b= AV_RN32(&src2[i*src_stride2  ]);\
-        OP(*((uint32_t*)&dst[i*dst_stride  ]), no_rnd_avg32(a, b));\
-        a= AV_RN32(&src1[i*src_stride1+4]);\
-        b= AV_RN32(&src2[i*src_stride2+4]);\
-        OP(*((uint32_t*)&dst[i*dst_stride+4]), no_rnd_avg32(a, b));\
-    }\
-}\
-\
-static inline void OPNAME ## _pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
-                                                int src_stride1, int src_stride2, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        uint32_t a,b;\
-        a= AV_RN32(&src1[i*src_stride1  ]);\
-        b= AV_RN32(&src2[i*src_stride2  ]);\
-        OP(*((uint32_t*)&dst[i*dst_stride  ]), rnd_avg32(a, b));\
-        a= AV_RN32(&src1[i*src_stride1+4]);\
-        b= AV_RN32(&src2[i*src_stride2+4]);\
-        OP(*((uint32_t*)&dst[i*dst_stride+4]), rnd_avg32(a, b));\
-    }\
-}\
-\
-static inline void OPNAME ## _pixels4_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
-                                                int src_stride1, int src_stride2, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        uint32_t a,b;\
-        a= AV_RN32(&src1[i*src_stride1  ]);\
-        b= AV_RN32(&src2[i*src_stride2  ]);\
-        OP(*((uint32_t*)&dst[i*dst_stride  ]), rnd_avg32(a, b));\
-    }\
-}\
-\
-static inline void OPNAME ## _pixels2_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
-                                                int src_stride1, int src_stride2, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        uint32_t a,b;\
-        a= AV_RN16(&src1[i*src_stride1  ]);\
-        b= AV_RN16(&src2[i*src_stride2  ]);\
-        OP(*((uint16_t*)&dst[i*dst_stride  ]), rnd_avg32(a, b));\
-    }\
-}\
-\
-static inline void OPNAME ## _pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
-                                                int src_stride1, int src_stride2, int h){\
-    OPNAME ## _pixels8_l2(dst  , src1  , src2  , dst_stride, src_stride1, src_stride2, h);\
-    OPNAME ## _pixels8_l2(dst+8, src1+8, src2+8, dst_stride, src_stride1, src_stride2, h);\
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
-                                                int src_stride1, int src_stride2, int h){\
-    OPNAME ## _no_rnd_pixels8_l2(dst  , src1  , src2  , dst_stride, src_stride1, src_stride2, h);\
-    OPNAME ## _no_rnd_pixels8_l2(dst+8, src1+8, src2+8, dst_stride, src_stride1, src_stride2, h);\
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels8_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _no_rnd_pixels8_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _pixels8_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _pixels8_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels8_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _no_rnd_pixels8_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _pixels8_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _pixels8_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _pixels8_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\
-                 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        uint32_t a, b, c, d, l0, l1, h0, h1;\
-        a= AV_RN32(&src1[i*src_stride1]);\
-        b= AV_RN32(&src2[i*src_stride2]);\
-        c= AV_RN32(&src3[i*src_stride3]);\
-        d= AV_RN32(&src4[i*src_stride4]);\
-        l0=  (a&0x03030303UL)\
-           + (b&0x03030303UL)\
-           + 0x02020202UL;\
-        h0= ((a&0xFCFCFCFCUL)>>2)\
-          + ((b&0xFCFCFCFCUL)>>2);\
-        l1=  (c&0x03030303UL)\
-           + (d&0x03030303UL);\
-        h1= ((c&0xFCFCFCFCUL)>>2)\
-          + ((d&0xFCFCFCFCUL)>>2);\
-        OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-        a= AV_RN32(&src1[i*src_stride1+4]);\
-        b= AV_RN32(&src2[i*src_stride2+4]);\
-        c= AV_RN32(&src3[i*src_stride3+4]);\
-        d= AV_RN32(&src4[i*src_stride4+4]);\
-        l0=  (a&0x03030303UL)\
-           + (b&0x03030303UL)\
-           + 0x02020202UL;\
-        h0= ((a&0xFCFCFCFCUL)>>2)\
-          + ((b&0xFCFCFCFCUL)>>2);\
-        l1=  (c&0x03030303UL)\
-           + (d&0x03030303UL);\
-        h1= ((c&0xFCFCFCFCUL)>>2)\
-          + ((d&0xFCFCFCFCUL)>>2);\
-        OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-    }\
-}\
-\
-static inline void OPNAME ## _pixels4_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _pixels4_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _pixels4_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _pixels4_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _pixels2_x2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _pixels2_l2(block, pixels, pixels+1, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _pixels2_y2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    OPNAME ## _pixels2_l2(block, pixels, pixels+line_size, line_size, line_size, line_size, h);\
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels8_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\
-                 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-    int i;\
-    for(i=0; i<h; i++){\
-        uint32_t a, b, c, d, l0, l1, h0, h1;\
-        a= AV_RN32(&src1[i*src_stride1]);\
-        b= AV_RN32(&src2[i*src_stride2]);\
-        c= AV_RN32(&src3[i*src_stride3]);\
-        d= AV_RN32(&src4[i*src_stride4]);\
-        l0=  (a&0x03030303UL)\
-           + (b&0x03030303UL)\
-           + 0x01010101UL;\
-        h0= ((a&0xFCFCFCFCUL)>>2)\
-          + ((b&0xFCFCFCFCUL)>>2);\
-        l1=  (c&0x03030303UL)\
-           + (d&0x03030303UL);\
-        h1= ((c&0xFCFCFCFCUL)>>2)\
-          + ((d&0xFCFCFCFCUL)>>2);\
-        OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-        a= AV_RN32(&src1[i*src_stride1+4]);\
-        b= AV_RN32(&src2[i*src_stride2+4]);\
-        c= AV_RN32(&src3[i*src_stride3+4]);\
-        d= AV_RN32(&src4[i*src_stride4+4]);\
-        l0=  (a&0x03030303UL)\
-           + (b&0x03030303UL)\
-           + 0x01010101UL;\
-        h0= ((a&0xFCFCFCFCUL)>>2)\
-          + ((b&0xFCFCFCFCUL)>>2);\
-        l1=  (c&0x03030303UL)\
-           + (d&0x03030303UL);\
-        h1= ((c&0xFCFCFCFCUL)>>2)\
-          + ((d&0xFCFCFCFCUL)>>2);\
-        OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-    }\
-}\
-static inline void OPNAME ## _pixels16_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\
-                 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-    OPNAME ## _pixels8_l4(dst  , src1  , src2  , src3  , src4  , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
-    OPNAME ## _pixels8_l4(dst+8, src1+8, src2+8, src3+8, src4+8, dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
-}\
-static inline void OPNAME ## _no_rnd_pixels16_l4(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,\
-                 int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-    OPNAME ## _no_rnd_pixels8_l4(dst  , src1  , src2  , src3  , src4  , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
-    OPNAME ## _no_rnd_pixels8_l4(dst+8, src1+8, src2+8, src3+8, src4+8, dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\
-}\
-\
-static inline void OPNAME ## _pixels2_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-        int i, a0, b0, a1, b1;\
-        a0= pixels[0];\
-        b0= pixels[1] + 2;\
-        a0 += b0;\
-        b0 += pixels[2];\
-\
-        pixels+=line_size;\
-        for(i=0; i<h; i+=2){\
-            a1= pixels[0];\
-            b1= pixels[1];\
-            a1 += b1;\
-            b1 += pixels[2];\
-\
-            block[0]= (a1+a0)>>2; /* FIXME non put */\
-            block[1]= (b1+b0)>>2;\
-\
-            pixels+=line_size;\
-            block +=line_size;\
-\
-            a0= pixels[0];\
-            b0= pixels[1] + 2;\
-            a0 += b0;\
-            b0 += pixels[2];\
-\
-            block[0]= (a1+a0)>>2;\
-            block[1]= (b1+b0)>>2;\
-            pixels+=line_size;\
-            block +=line_size;\
-        }\
-}\
-\
-static inline void OPNAME ## _pixels4_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-        int i;\
-        const uint32_t a= AV_RN32(pixels  );\
-        const uint32_t b= AV_RN32(pixels+1);\
-        uint32_t l0=  (a&0x03030303UL)\
-                    + (b&0x03030303UL)\
-                    + 0x02020202UL;\
-        uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\
-                   + ((b&0xFCFCFCFCUL)>>2);\
-        uint32_t l1,h1;\
-\
-        pixels+=line_size;\
-        for(i=0; i<h; i+=2){\
-            uint32_t a= AV_RN32(pixels  );\
-            uint32_t b= AV_RN32(pixels+1);\
-            l1=  (a&0x03030303UL)\
-               + (b&0x03030303UL);\
-            h1= ((a&0xFCFCFCFCUL)>>2)\
-              + ((b&0xFCFCFCFCUL)>>2);\
-            OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-            pixels+=line_size;\
-            block +=line_size;\
-            a= AV_RN32(pixels  );\
-            b= AV_RN32(pixels+1);\
-            l0=  (a&0x03030303UL)\
-               + (b&0x03030303UL)\
-               + 0x02020202UL;\
-            h0= ((a&0xFCFCFCFCUL)>>2)\
-              + ((b&0xFCFCFCFCUL)>>2);\
-            OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-            pixels+=line_size;\
-            block +=line_size;\
-        }\
-}\
-\
-static inline void OPNAME ## _pixels8_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-    int j;\
-    for(j=0; j<2; j++){\
-        int i;\
-        const uint32_t a= AV_RN32(pixels  );\
-        const uint32_t b= AV_RN32(pixels+1);\
-        uint32_t l0=  (a&0x03030303UL)\
-                    + (b&0x03030303UL)\
-                    + 0x02020202UL;\
-        uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\
-                   + ((b&0xFCFCFCFCUL)>>2);\
-        uint32_t l1,h1;\
-\
-        pixels+=line_size;\
-        for(i=0; i<h; i+=2){\
-            uint32_t a= AV_RN32(pixels  );\
-            uint32_t b= AV_RN32(pixels+1);\
-            l1=  (a&0x03030303UL)\
-               + (b&0x03030303UL);\
-            h1= ((a&0xFCFCFCFCUL)>>2)\
-              + ((b&0xFCFCFCFCUL)>>2);\
-            OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-            pixels+=line_size;\
-            block +=line_size;\
-            a= AV_RN32(pixels  );\
-            b= AV_RN32(pixels+1);\
-            l0=  (a&0x03030303UL)\
-               + (b&0x03030303UL)\
-               + 0x02020202UL;\
-            h0= ((a&0xFCFCFCFCUL)>>2)\
-              + ((b&0xFCFCFCFCUL)>>2);\
-            OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-            pixels+=line_size;\
-            block +=line_size;\
-        }\
-        pixels+=4-line_size*(h+1);\
-        block +=4-line_size*h;\
-    }\
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels8_xy2_c(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
-    int j;\
-    for(j=0; j<2; j++){\
-        int i;\
-        const uint32_t a= AV_RN32(pixels  );\
-        const uint32_t b= AV_RN32(pixels+1);\
-        uint32_t l0=  (a&0x03030303UL)\
-                    + (b&0x03030303UL)\
-                    + 0x01010101UL;\
-        uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\
-                   + ((b&0xFCFCFCFCUL)>>2);\
-        uint32_t l1,h1;\
-\
-        pixels+=line_size;\
-        for(i=0; i<h; i+=2){\
-            uint32_t a= AV_RN32(pixels  );\
-            uint32_t b= AV_RN32(pixels+1);\
-            l1=  (a&0x03030303UL)\
-               + (b&0x03030303UL);\
-            h1= ((a&0xFCFCFCFCUL)>>2)\
-              + ((b&0xFCFCFCFCUL)>>2);\
-            OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-            pixels+=line_size;\
-            block +=line_size;\
-            a= AV_RN32(pixels  );\
-            b= AV_RN32(pixels+1);\
-            l0=  (a&0x03030303UL)\
-               + (b&0x03030303UL)\
-               + 0x01010101UL;\
-            h0= ((a&0xFCFCFCFCUL)>>2)\
-              + ((b&0xFCFCFCFCUL)>>2);\
-            OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\
-            pixels+=line_size;\
-            block +=line_size;\
-        }\
-        pixels+=4-line_size*(h+1);\
-        block +=4-line_size*h;\
-    }\
-}\
-\
-CALL_2X_PIXELS(OPNAME ## _pixels16_c  , OPNAME ## _pixels8_c  , 8)\
-CALL_2X_PIXELS(OPNAME ## _pixels16_x2_c , OPNAME ## _pixels8_x2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _pixels16_y2_c , OPNAME ## _pixels8_y2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _pixels16_xy2_c, OPNAME ## _pixels8_xy2_c, 8)\
-CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_c  , OPNAME ## _pixels8_c         , 8)\
-CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_x2_c , OPNAME ## _no_rnd_pixels8_x2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_y2_c , OPNAME ## _no_rnd_pixels8_y2_c , 8)\
-CALL_2X_PIXELS(OPNAME ## _no_rnd_pixels16_xy2_c, OPNAME ## _no_rnd_pixels8_xy2_c, 8)\
-
-#define op_avg(a, b) a = rnd_avg32(a, b)
-#endif
-#define op_put(a, b) a = b
-
-PIXOP2(avg, op_avg)
-PIXOP2(put, op_put)
-#undef op_avg
-#undef op_put
-
-#define avg2(a,b) ((a+b+1)>>1)
-#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
-
-static void put_no_rnd_pixels16_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
-    put_no_rnd_pixels16_l2(dst, a, b, stride, stride, stride, h);
-}
-
-static void put_no_rnd_pixels8_l2_c(uint8_t *dst, const uint8_t *a, const uint8_t *b, int stride, int h){
-    put_no_rnd_pixels8_l2(dst, a, b, stride, stride, stride, h);
-}
-
-static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder)
-{
-    const int A=(16-x16)*(16-y16);
-    const int B=(   x16)*(16-y16);
-    const int C=(16-x16)*(   y16);
-    const int D=(   x16)*(   y16);
-    int i;
-
-    for(i=0; i<h; i++)
-    {
-        dst[0]= (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + rounder)>>8;
-        dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8;
-        dst[2]= (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + rounder)>>8;
-        dst[3]= (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + rounder)>>8;
-        dst[4]= (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + rounder)>>8;
-        dst[5]= (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + rounder)>>8;
-        dst[6]= (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + rounder)>>8;
-        dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8;
-        dst+= stride;
-        src+= stride;
-    }
-}
-
-void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
-                  int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
-{
-    int y, vx, vy;
-    const int s= 1<<shift;
-
-    width--;
-    height--;
-
-    for(y=0; y<h; y++){
-        int x;
-
-        vx= ox;
-        vy= oy;
-        for(x=0; x<8; x++){ //XXX FIXME optimize
-            int src_x, src_y, frac_x, frac_y, index;
-
-            src_x= vx>>16;
-            src_y= vy>>16;
-            frac_x= src_x&(s-1);
-            frac_y= src_y&(s-1);
-            src_x>>=shift;
-            src_y>>=shift;
-
-            if((unsigned)src_x < width){
-                if((unsigned)src_y < height){
-                    index= src_x + src_y*stride;
-                    dst[y*stride + x]= (  (  src[index         ]*(s-frac_x)
-                                           + src[index       +1]*   frac_x )*(s-frac_y)
-                                        + (  src[index+stride  ]*(s-frac_x)
-                                           + src[index+stride+1]*   frac_x )*   frac_y
-                                        + r)>>(shift*2);
-                }else{
-                    index= src_x + av_clip(src_y, 0, height)*stride;
-                    dst[y*stride + x]= ( (  src[index         ]*(s-frac_x)
-                                          + src[index       +1]*   frac_x )*s
-                                        + r)>>(shift*2);
-                }
-            }else{
-                if((unsigned)src_y < height){
-                    index= av_clip(src_x, 0, width) + src_y*stride;
-                    dst[y*stride + x]= (  (  src[index         ]*(s-frac_y)
-                                           + src[index+stride  ]*   frac_y )*s
-                                        + r)>>(shift*2);
-                }else{
-                    index= av_clip(src_x, 0, width) + av_clip(src_y, 0, height)*stride;
-                    dst[y*stride + x]=    src[index         ];
-                }
-            }
-
-            vx+= dxx;
-            vy+= dyx;
-        }
-        ox += dxy;
-        oy += dyy;
-    }
-}
-
-static inline void put_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    switch(width){
-    case 2: put_pixels2_c (dst, src, stride, height); break;
-    case 4: put_pixels4_c (dst, src, stride, height); break;
-    case 8: put_pixels8_c (dst, src, stride, height); break;
-    case 16:put_pixels16_c(dst, src, stride, height); break;
-    }
-}
-
-static inline void put_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (683*(2*src[j] + src[j+1] + 1)) >> 11;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void put_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (683*(src[j] + 2*src[j+1] + 1)) >> 11;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (683*(2*src[j] + src[j+stride] + 1)) >> 11;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void put_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void put_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void put_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (683*(src[j] + 2*src[j+stride] + 1)) >> 11;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void put_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    switch(width){
-    case 2: avg_pixels2_c (dst, src, stride, height); break;
-    case 4: avg_pixels4_c (dst, src, stride, height); break;
-    case 8: avg_pixels8_c (dst, src, stride, height); break;
-    case 16:avg_pixels16_c(dst, src, stride, height); break;
-    }
-}
-
-static inline void avg_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((683*(2*src[j] + src[j+1] + 1)) >> 11) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+1] + 1)) >> 11) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((683*(2*src[j] + src[j+stride] + 1)) >> 11) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+stride] + 1)) >> 11) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-
-static inline void avg_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){
-    int i,j;
-    for (i=0; i < height; i++) {
-      for (j=0; j < width; j++) {
-        dst[j] = (dst[j] + ((2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15) + 1) >> 1;
-      }
-      src += stride;
-      dst += stride;
-    }
-}
-#if 0
-#define TPEL_WIDTH(width)\
-static void put_tpel_pixels ## width ## _mc00_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc00_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc10_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc10_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc20_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc20_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc01_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc01_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc11_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc11_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc21_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc21_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc02_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc02_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc12_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc12_c(dst, src, stride, width, height);}\
-static void put_tpel_pixels ## width ## _mc22_c(uint8_t *dst, const uint8_t *src, int stride, int height){\
-    void put_tpel_pixels_mc22_c(dst, src, stride, width, height);}
-#endif
-
-#define H264_CHROMA_MC(OPNAME, OP)\
-static void OPNAME ## h264_chroma_mc2_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    int i;\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    if(D){\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
-            OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }else{\
-        const int E= B+C;\
-        const int step= C ? stride : 1;\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + E*src[step+0]));\
-            OP(dst[1], (A*src[1] + E*src[step+1]));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }\
-}\
-\
-static void OPNAME ## h264_chroma_mc4_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    int i;\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    if(D){\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
-            OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
-            OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\
-            OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }else{\
-        const int E= B+C;\
-        const int step= C ? stride : 1;\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + E*src[step+0]));\
-            OP(dst[1], (A*src[1] + E*src[step+1]));\
-            OP(dst[2], (A*src[2] + E*src[step+2]));\
-            OP(dst[3], (A*src[3] + E*src[step+3]));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }\
-}\
-\
-static void OPNAME ## h264_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    int i;\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    if(D){\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));\
-            OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));\
-            OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));\
-            OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));\
-            OP(dst[4], (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5]));\
-            OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));\
-            OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));\
-            OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }else{\
-        const int E= B+C;\
-        const int step= C ? stride : 1;\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + E*src[step+0]));\
-            OP(dst[1], (A*src[1] + E*src[step+1]));\
-            OP(dst[2], (A*src[2] + E*src[step+2]));\
-            OP(dst[3], (A*src[3] + E*src[step+3]));\
-            OP(dst[4], (A*src[4] + E*src[step+4]));\
-            OP(dst[5], (A*src[5] + E*src[step+5]));\
-            OP(dst[6], (A*src[6] + E*src[step+6]));\
-            OP(dst[7], (A*src[7] + E*src[step+7]));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }\
-}
-
-#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
-#define op_put(a, b) a = (((b) + 32)>>6)
-
-H264_CHROMA_MC(put_       , op_put)
-H264_CHROMA_MC(avg_       , op_avg)
-#undef op_avg
-#undef op_put
-
-static void put_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
-    const int A=(8-x)*(8-y);
-    const int B=(  x)*(8-y);
-    const int C=(8-x)*(  y);
-    const int D=(  x)*(  y);
-    int i;
-
-    assert(x<8 && y<8 && x>=0 && y>=0);
-
-    for(i=0; i<h; i++)
-    {
-        dst[0] = (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6;
-        dst[1] = (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6;
-        dst[2] = (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6;
-        dst[3] = (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6;
-        dst[4] = (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6;
-        dst[5] = (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6;
-        dst[6] = (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6;
-        dst[7] = (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6;
-        dst+= stride;
-        src+= stride;
-    }
-}
-
-static void avg_no_rnd_vc1_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
-    const int A=(8-x)*(8-y);
-    const int B=(  x)*(8-y);
-    const int C=(8-x)*(  y);
-    const int D=(  x)*(  y);
-    int i;
-
-    assert(x<8 && y<8 && x>=0 && y>=0);
-
-    for(i=0; i<h; i++)
-    {
-        dst[0] = avg2(dst[0], ((A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + 32 - 4) >> 6));
-        dst[1] = avg2(dst[1], ((A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + 32 - 4) >> 6));
-        dst[2] = avg2(dst[2], ((A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + 32 - 4) >> 6));
-        dst[3] = avg2(dst[3], ((A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + 32 - 4) >> 6));
-        dst[4] = avg2(dst[4], ((A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + 32 - 4) >> 6));
-        dst[5] = avg2(dst[5], ((A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + 32 - 4) >> 6));
-        dst[6] = avg2(dst[6], ((A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + 32 - 4) >> 6));
-        dst[7] = avg2(dst[7], ((A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + 32 - 4) >> 6));
-        dst+= stride;
-        src+= stride;
-    }
-}
-
-#define QPEL_MC(r, OPNAME, RND, OP) \
-static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[0], (src[0]+src[1])*20 - (src[0]+src[2])*6 + (src[1]+src[3])*3 - (src[2]+src[4]));\
-        OP(dst[1], (src[1]+src[2])*20 - (src[0]+src[3])*6 + (src[0]+src[4])*3 - (src[1]+src[5]));\
-        OP(dst[2], (src[2]+src[3])*20 - (src[1]+src[4])*6 + (src[0]+src[5])*3 - (src[0]+src[6]));\
-        OP(dst[3], (src[3]+src[4])*20 - (src[2]+src[5])*6 + (src[1]+src[6])*3 - (src[0]+src[7]));\
-        OP(dst[4], (src[4]+src[5])*20 - (src[3]+src[6])*6 + (src[2]+src[7])*3 - (src[1]+src[8]));\
-        OP(dst[5], (src[5]+src[6])*20 - (src[4]+src[7])*6 + (src[3]+src[8])*3 - (src[2]+src[8]));\
-        OP(dst[6], (src[6]+src[7])*20 - (src[5]+src[8])*6 + (src[4]+src[8])*3 - (src[3]+src[7]));\
-        OP(dst[7], (src[7]+src[8])*20 - (src[6]+src[8])*6 + (src[5]+src[7])*3 - (src[4]+src[6]));\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<w; i++)\
-    {\
-        const int src0= src[0*srcStride];\
-        const int src1= src[1*srcStride];\
-        const int src2= src[2*srcStride];\
-        const int src3= src[3*srcStride];\
-        const int src4= src[4*srcStride];\
-        const int src5= src[5*srcStride];\
-        const int src6= src[6*srcStride];\
-        const int src7= src[7*srcStride];\
-        const int src8= src[8*srcStride];\
-        OP(dst[0*dstStride], (src0+src1)*20 - (src0+src2)*6 + (src1+src3)*3 - (src2+src4));\
-        OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*6 + (src0+src4)*3 - (src1+src5));\
-        OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*6 + (src0+src5)*3 - (src0+src6));\
-        OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*6 + (src1+src6)*3 - (src0+src7));\
-        OP(dst[4*dstStride], (src4+src5)*20 - (src3+src6)*6 + (src2+src7)*3 - (src1+src8));\
-        OP(dst[5*dstStride], (src5+src6)*20 - (src4+src7)*6 + (src3+src8)*3 - (src2+src8));\
-        OP(dst[6*dstStride], (src6+src7)*20 - (src5+src8)*6 + (src4+src8)*3 - (src3+src7));\
-        OP(dst[7*dstStride], (src7+src8)*20 - (src6+src8)*6 + (src5+src7)*3 - (src4+src6));\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static void OPNAME ## mpeg4_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    \
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[ 0], (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]));\
-        OP(dst[ 1], (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]));\
-        OP(dst[ 2], (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]));\
-        OP(dst[ 3], (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]));\
-        OP(dst[ 4], (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]));\
-        OP(dst[ 5], (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]));\
-        OP(dst[ 6], (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]));\
-        OP(dst[ 7], (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]));\
-        OP(dst[ 8], (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]));\
-        OP(dst[ 9], (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]));\
-        OP(dst[10], (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]));\
-        OP(dst[11], (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]));\
-        OP(dst[12], (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]));\
-        OP(dst[13], (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]));\
-        OP(dst[14], (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]));\
-        OP(dst[15], (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]));\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## mpeg4_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    const int w=16;\
-    for(i=0; i<w; i++)\
-    {\
-        const int src0= src[0*srcStride];\
-        const int src1= src[1*srcStride];\
-        const int src2= src[2*srcStride];\
-        const int src3= src[3*srcStride];\
-        const int src4= src[4*srcStride];\
-        const int src5= src[5*srcStride];\
-        const int src6= src[6*srcStride];\
-        const int src7= src[7*srcStride];\
-        const int src8= src[8*srcStride];\
-        const int src9= src[9*srcStride];\
-        const int src10= src[10*srcStride];\
-        const int src11= src[11*srcStride];\
-        const int src12= src[12*srcStride];\
-        const int src13= src[13*srcStride];\
-        const int src14= src[14*srcStride];\
-        const int src15= src[15*srcStride];\
-        const int src16= src[16*srcStride];\
-        OP(dst[ 0*dstStride], (src0 +src1 )*20 - (src0 +src2 )*6 + (src1 +src3 )*3 - (src2 +src4 ));\
-        OP(dst[ 1*dstStride], (src1 +src2 )*20 - (src0 +src3 )*6 + (src0 +src4 )*3 - (src1 +src5 ));\
-        OP(dst[ 2*dstStride], (src2 +src3 )*20 - (src1 +src4 )*6 + (src0 +src5 )*3 - (src0 +src6 ));\
-        OP(dst[ 3*dstStride], (src3 +src4 )*20 - (src2 +src5 )*6 + (src1 +src6 )*3 - (src0 +src7 ));\
-        OP(dst[ 4*dstStride], (src4 +src5 )*20 - (src3 +src6 )*6 + (src2 +src7 )*3 - (src1 +src8 ));\
-        OP(dst[ 5*dstStride], (src5 +src6 )*20 - (src4 +src7 )*6 + (src3 +src8 )*3 - (src2 +src9 ));\
-        OP(dst[ 6*dstStride], (src6 +src7 )*20 - (src5 +src8 )*6 + (src4 +src9 )*3 - (src3 +src10));\
-        OP(dst[ 7*dstStride], (src7 +src8 )*20 - (src6 +src9 )*6 + (src5 +src10)*3 - (src4 +src11));\
-        OP(dst[ 8*dstStride], (src8 +src9 )*20 - (src7 +src10)*6 + (src6 +src11)*3 - (src5 +src12));\
-        OP(dst[ 9*dstStride], (src9 +src10)*20 - (src8 +src11)*6 + (src7 +src12)*3 - (src6 +src13));\
-        OP(dst[10*dstStride], (src10+src11)*20 - (src9 +src12)*6 + (src8 +src13)*3 - (src7 +src14));\
-        OP(dst[11*dstStride], (src11+src12)*20 - (src10+src13)*6 + (src9 +src14)*3 - (src8 +src15));\
-        OP(dst[12*dstStride], (src12+src13)*20 - (src11+src14)*6 + (src10+src15)*3 - (src9 +src16));\
-        OP(dst[13*dstStride], (src13+src14)*20 - (src12+src15)*6 + (src11+src16)*3 - (src10+src16));\
-        OP(dst[14*dstStride], (src14+src15)*20 - (src13+src16)*6 + (src12+src16)*3 - (src11+src15));\
-        OP(dst[15*dstStride], (src15+src16)*20 - (src14+src16)*6 + (src13+src15)*3 - (src12+src14));\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static void OPNAME ## qpel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels8_c(dst, src, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
-    OPNAME ## pixels8_l2(dst, src, half, stride, stride, 8, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel8_h_lowpass(dst, src, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
-    OPNAME ## pixels8_l2(dst, src+1, half, stride, stride, 8, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc01_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t half[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
-    OPNAME ## pixels8_l2(dst, full, half, stride, 16, 8, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    copy_block9(full, src, 16, stride, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);\
-}\
-\
-static void OPNAME ## qpel8_mc03_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t half[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
-    OPNAME ## pixels8_l2(dst, full+16, half, stride, 16, 8, 8);\
-}\
-void ff_ ## OPNAME ## qpel8_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfV[64];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l4(dst, full, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc11_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
-}\
-void ff_ ## OPNAME ## qpel8_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfV[64];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l4(dst, full+1, halfH, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc31_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
-}\
-void ff_ ## OPNAME ## qpel8_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfV[64];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l4(dst, full+16, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc13_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
-}\
-void ff_ ## OPNAME ## qpel8_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfV[64];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full  , 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l4(dst, full+17, halfH+8, halfV, halfHV, stride, 16, 8, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc21_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfH, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc23_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfH+8, halfHV, stride, 8, 8, 8);\
-}\
-void ff_ ## OPNAME ## qpel8_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfV[64];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full, 8, 16);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc12_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2(halfH, halfH, full, 8, 8, 16, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
-}\
-void ff_ ## OPNAME ## qpel8_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfV[64];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfV, full+1, 8, 16);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2(halfH, halfH, full+1, 8, 8, 16, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[72];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel16_mc00_c (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels16_c(dst, src, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc10_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
-    OPNAME ## pixels16_l2(dst, src, half, stride, stride, 16, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc20_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel16_h_lowpass(dst, src, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc30_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
-    OPNAME ## pixels16_l2(dst, src+1, half, stride, stride, 16, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc01_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t half[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
-    OPNAME ## pixels16_l2(dst, full, half, stride, 24, 16, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc02_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    copy_block17(full, src, 24, stride, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);\
-}\
-\
-static void OPNAME ## qpel16_mc03_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t half[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
-    OPNAME ## pixels16_l2(dst, full+24, half, stride, 24, 16, 16);\
-}\
-void ff_ ## OPNAME ## qpel16_mc11_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfV[256];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l4(dst, full, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc11_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
-}\
-void ff_ ## OPNAME ## qpel16_mc31_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfV[256];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l4(dst, full+1, halfH, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc31_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
-}\
-void ff_ ## OPNAME ## qpel16_mc13_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfV[256];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l4(dst, full+24, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc13_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
-}\
-void ff_ ## OPNAME ## qpel16_mc33_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfV[256];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full  , 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l4(dst, full+25, halfH+16, halfV, halfHV, stride, 24, 16, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc21_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfH, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc23_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfH+16, halfHV, stride, 16, 16, 16);\
-}\
-void ff_ ## OPNAME ## qpel16_mc12_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfV[256];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full, 16, 24);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc12_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2(halfH, halfH, full, 16, 16, 24, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
-}\
-void ff_ ## OPNAME ## qpel16_mc32_old_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfV[256];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfV, full+1, 16, 24);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2(dst, halfV, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc32_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2(halfH, halfH, full+1, 16, 16, 24, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc22_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[272];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
-}
-
-#define op_avg(a, b) a = (((a)+cm[((b) + 16)>>5]+1)>>1)
-#define op_avg_no_rnd(a, b) a = (((a)+cm[((b) + 15)>>5])>>1)
-#define op_put(a, b) a = cm[((b) + 16)>>5]
-#define op_put_no_rnd(a, b) a = cm[((b) + 15)>>5]
-
-QPEL_MC(0, put_       , _       , op_put)
-QPEL_MC(1, put_no_rnd_, _no_rnd_, op_put_no_rnd)
-QPEL_MC(0, avg_       , _       , op_avg)
-//QPEL_MC(1, avg_no_rnd , _       , op_avg)
-#undef op_avg
-#undef op_avg_no_rnd
-#undef op_put
-#undef op_put_no_rnd
-
-#if 1
-#define H264_LOWPASS(OPNAME, OP, OP2) \
-static av_unused void OPNAME ## h264_qpel2_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int h=2;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
-        OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static av_unused void OPNAME ## h264_qpel2_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w=2;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<w; i++)\
-    {\
-        const int srcB= src[-2*srcStride];\
-        const int srcA= src[-1*srcStride];\
-        const int src0= src[0 *srcStride];\
-        const int src1= src[1 *srcStride];\
-        const int src2= src[2 *srcStride];\
-        const int src3= src[3 *srcStride];\
-        const int src4= src[4 *srcStride];\
-        OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
-        OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static av_unused void OPNAME ## h264_qpel2_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    const int h=2;\
-    const int w=2;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    src -= 2*srcStride;\
-    for(i=0; i<h+5; i++)\
-    {\
-        tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]);\
-        tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]);\
-        tmp+=tmpStride;\
-        src+=srcStride;\
-    }\
-    tmp -= tmpStride*(h+5-2);\
-    for(i=0; i<w; i++)\
-    {\
-        const int tmpB= tmp[-2*tmpStride];\
-        const int tmpA= tmp[-1*tmpStride];\
-        const int tmp0= tmp[0 *tmpStride];\
-        const int tmp1= tmp[1 *tmpStride];\
-        const int tmp2= tmp[2 *tmpStride];\
-        const int tmp3= tmp[3 *tmpStride];\
-        const int tmp4= tmp[4 *tmpStride];\
-        OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
-        OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
-        dst++;\
-        tmp++;\
-    }\
-}\
-static void OPNAME ## h264_qpel4_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int h=4;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
-        OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
-        OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]));\
-        OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]));\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## h264_qpel4_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w=4;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<w; i++)\
-    {\
-        const int srcB= src[-2*srcStride];\
-        const int srcA= src[-1*srcStride];\
-        const int src0= src[0 *srcStride];\
-        const int src1= src[1 *srcStride];\
-        const int src2= src[2 *srcStride];\
-        const int src3= src[3 *srcStride];\
-        const int src4= src[4 *srcStride];\
-        const int src5= src[5 *srcStride];\
-        const int src6= src[6 *srcStride];\
-        OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
-        OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
-        OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
-        OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static void OPNAME ## h264_qpel4_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    const int h=4;\
-    const int w=4;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    src -= 2*srcStride;\
-    for(i=0; i<h+5; i++)\
-    {\
-        tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]);\
-        tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]);\
-        tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]);\
-        tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]);\
-        tmp+=tmpStride;\
-        src+=srcStride;\
-    }\
-    tmp -= tmpStride*(h+5-2);\
-    for(i=0; i<w; i++)\
-    {\
-        const int tmpB= tmp[-2*tmpStride];\
-        const int tmpA= tmp[-1*tmpStride];\
-        const int tmp0= tmp[0 *tmpStride];\
-        const int tmp1= tmp[1 *tmpStride];\
-        const int tmp2= tmp[2 *tmpStride];\
-        const int tmp3= tmp[3 *tmpStride];\
-        const int tmp4= tmp[4 *tmpStride];\
-        const int tmp5= tmp[5 *tmpStride];\
-        const int tmp6= tmp[6 *tmpStride];\
-        OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
-        OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
-        OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
-        OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
-        dst++;\
-        tmp++;\
-    }\
-}\
-\
-static void OPNAME ## h264_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int h=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]));\
-        OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]));\
-        OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]));\
-        OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]));\
-        OP(dst[4], (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]));\
-        OP(dst[5], (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]));\
-        OP(dst[6], (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]));\
-        OP(dst[7], (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]));\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## h264_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<w; i++)\
-    {\
-        const int srcB= src[-2*srcStride];\
-        const int srcA= src[-1*srcStride];\
-        const int src0= src[0 *srcStride];\
-        const int src1= src[1 *srcStride];\
-        const int src2= src[2 *srcStride];\
-        const int src3= src[3 *srcStride];\
-        const int src4= src[4 *srcStride];\
-        const int src5= src[5 *srcStride];\
-        const int src6= src[6 *srcStride];\
-        const int src7= src[7 *srcStride];\
-        const int src8= src[8 *srcStride];\
-        const int src9= src[9 *srcStride];\
-        const int src10=src[10*srcStride];\
-        OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
-        OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
-        OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
-        OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
-        OP(dst[4*dstStride], (src4+src5)*20 - (src3+src6)*5 + (src2+src7));\
-        OP(dst[5*dstStride], (src5+src6)*20 - (src4+src7)*5 + (src3+src8));\
-        OP(dst[6*dstStride], (src6+src7)*20 - (src5+src8)*5 + (src4+src9));\
-        OP(dst[7*dstStride], (src7+src8)*20 - (src6+src9)*5 + (src5+src10));\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static void OPNAME ## h264_qpel8_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    const int h=8;\
-    const int w=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    src -= 2*srcStride;\
-    for(i=0; i<h+5; i++)\
-    {\
-        tmp[0]= (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3 ]);\
-        tmp[1]= (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4 ]);\
-        tmp[2]= (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5 ]);\
-        tmp[3]= (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6 ]);\
-        tmp[4]= (src[4]+src[5])*20 - (src[3 ]+src[6])*5 + (src[2 ]+src[7 ]);\
-        tmp[5]= (src[5]+src[6])*20 - (src[4 ]+src[7])*5 + (src[3 ]+src[8 ]);\
-        tmp[6]= (src[6]+src[7])*20 - (src[5 ]+src[8])*5 + (src[4 ]+src[9 ]);\
-        tmp[7]= (src[7]+src[8])*20 - (src[6 ]+src[9])*5 + (src[5 ]+src[10]);\
-        tmp+=tmpStride;\
-        src+=srcStride;\
-    }\
-    tmp -= tmpStride*(h+5-2);\
-    for(i=0; i<w; i++)\
-    {\
-        const int tmpB= tmp[-2*tmpStride];\
-        const int tmpA= tmp[-1*tmpStride];\
-        const int tmp0= tmp[0 *tmpStride];\
-        const int tmp1= tmp[1 *tmpStride];\
-        const int tmp2= tmp[2 *tmpStride];\
-        const int tmp3= tmp[3 *tmpStride];\
-        const int tmp4= tmp[4 *tmpStride];\
-        const int tmp5= tmp[5 *tmpStride];\
-        const int tmp6= tmp[6 *tmpStride];\
-        const int tmp7= tmp[7 *tmpStride];\
-        const int tmp8= tmp[8 *tmpStride];\
-        const int tmp9= tmp[9 *tmpStride];\
-        const int tmp10=tmp[10*tmpStride];\
-        OP2(dst[0*dstStride], (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));\
-        OP2(dst[1*dstStride], (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));\
-        OP2(dst[2*dstStride], (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));\
-        OP2(dst[3*dstStride], (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));\
-        OP2(dst[4*dstStride], (tmp4+tmp5)*20 - (tmp3+tmp6)*5 + (tmp2+tmp7));\
-        OP2(dst[5*dstStride], (tmp5+tmp6)*20 - (tmp4+tmp7)*5 + (tmp3+tmp8));\
-        OP2(dst[6*dstStride], (tmp6+tmp7)*20 - (tmp5+tmp8)*5 + (tmp4+tmp9));\
-        OP2(dst[7*dstStride], (tmp7+tmp8)*20 - (tmp6+tmp9)*5 + (tmp5+tmp10));\
-        dst++;\
-        tmp++;\
-    }\
-}\
-\
-static void OPNAME ## h264_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8_v_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## h264_qpel8_v_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static void OPNAME ## h264_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8_h_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## h264_qpel8_h_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static void OPNAME ## h264_qpel16_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    OPNAME ## h264_qpel8_hv_lowpass(dst  , tmp  , src  , dstStride, tmpStride, srcStride);\
-    OPNAME ## h264_qpel8_hv_lowpass(dst+8, tmp+8, src+8, dstStride, tmpStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## h264_qpel8_hv_lowpass(dst  , tmp  , src  , dstStride, tmpStride, srcStride);\
-    OPNAME ## h264_qpel8_hv_lowpass(dst+8, tmp+8, src+8, dstStride, tmpStride, srcStride);\
-}\
-
-#define H264_MC(OPNAME, SIZE) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc00_c (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, src, half, stride, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, src+1, half, stride, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t half[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, full_mid, half, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    OPNAME ## h264_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t half[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, full_mid+SIZE, half, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2 + 1, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc33_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2 + 1, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    OPNAME ## h264_qpel ## SIZE ## _hv_lowpass(dst, tmp, src, stride, SIZE, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfV[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfV[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2 + 1, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-
-#define op_avg(a, b)  a = (((a)+cm[((b) + 16)>>5]+1)>>1)
-//#define op_avg2(a, b) a = (((a)*w1+cm[((b) + 16)>>5]*w2 + o + 64)>>7)
-#define op_put(a, b)  a = cm[((b) + 16)>>5]
-#define op2_avg(a, b)  a = (((a)+cm[((b) + 512)>>10]+1)>>1)
-#define op2_put(a, b)  a = cm[((b) + 512)>>10]
-
-H264_LOWPASS(put_       , op_put, op2_put)
-H264_LOWPASS(avg_       , op_avg, op2_avg)
-H264_MC(put_, 2)
-H264_MC(put_, 4)
-H264_MC(put_, 8)
-H264_MC(put_, 16)
-H264_MC(avg_, 4)
-H264_MC(avg_, 8)
-H264_MC(avg_, 16)
-
-#undef op_avg
-#undef op_put
-#undef op2_avg
-#undef op2_put
-#endif
-
-static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int i;
-
-    for(i=0; i<h; i++){
-        dst[0]= cm[(9*(src[0] + src[1]) - (src[-1] + src[2]) + 8)>>4];
-        dst[1]= cm[(9*(src[1] + src[2]) - (src[ 0] + src[3]) + 8)>>4];
-        dst[2]= cm[(9*(src[2] + src[3]) - (src[ 1] + src[4]) + 8)>>4];
-        dst[3]= cm[(9*(src[3] + src[4]) - (src[ 2] + src[5]) + 8)>>4];
-        dst[4]= cm[(9*(src[4] + src[5]) - (src[ 3] + src[6]) + 8)>>4];
-        dst[5]= cm[(9*(src[5] + src[6]) - (src[ 4] + src[7]) + 8)>>4];
-        dst[6]= cm[(9*(src[6] + src[7]) - (src[ 5] + src[8]) + 8)>>4];
-        dst[7]= cm[(9*(src[7] + src[8]) - (src[ 6] + src[9]) + 8)>>4];
-        dst+=dstStride;
-        src+=srcStride;
-    }
-}
-
-#if CONFIG_CAVS_DECODER
-/* AVS specific */
-void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
-    put_pixels8_c(dst, src, stride, 8);
-}
-void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
-    avg_pixels8_c(dst, src, stride, 8);
-}
-void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
-    put_pixels16_c(dst, src, stride, 16);
-}
-void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride) {
-    avg_pixels16_c(dst, src, stride, 16);
-}
-#endif /* CONFIG_CAVS_DECODER */
-
-#if CONFIG_VC1_DECODER
-/* VC-1 specific */
-void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    put_pixels8_c(dst, src, stride, 8);
-}
-void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    avg_pixels8_c(dst, src, stride, 8);
-}
-#endif /* CONFIG_VC1_DECODER */
-
-#if CONFIG_RV40_DECODER
-static void put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
-    put_pixels16_xy2_c(dst, src, stride, 16);
-}
-static void avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride){
-    avg_pixels16_xy2_c(dst, src, stride, 16);
-}
-static void put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
-    put_pixels8_xy2_c(dst, src, stride, 8);
-}
-static void avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
-    avg_pixels8_xy2_c(dst, src, stride, 8);
-}
-#endif /* CONFIG_RV40_DECODER */
-
-static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int i;
-
-    for(i=0; i<w; i++){
-        const int src_1= src[ -srcStride];
-        const int src0 = src[0          ];
-        const int src1 = src[  srcStride];
-        const int src2 = src[2*srcStride];
-        const int src3 = src[3*srcStride];
-        const int src4 = src[4*srcStride];
-        const int src5 = src[5*srcStride];
-        const int src6 = src[6*srcStride];
-        const int src7 = src[7*srcStride];
-        const int src8 = src[8*srcStride];
-        const int src9 = src[9*srcStride];
-        dst[0*dstStride]= cm[(9*(src0 + src1) - (src_1 + src2) + 8)>>4];
-        dst[1*dstStride]= cm[(9*(src1 + src2) - (src0  + src3) + 8)>>4];
-        dst[2*dstStride]= cm[(9*(src2 + src3) - (src1  + src4) + 8)>>4];
-        dst[3*dstStride]= cm[(9*(src3 + src4) - (src2  + src5) + 8)>>4];
-        dst[4*dstStride]= cm[(9*(src4 + src5) - (src3  + src6) + 8)>>4];
-        dst[5*dstStride]= cm[(9*(src5 + src6) - (src4  + src7) + 8)>>4];
-        dst[6*dstStride]= cm[(9*(src6 + src7) - (src5  + src8) + 8)>>4];
-        dst[7*dstStride]= cm[(9*(src7 + src8) - (src6  + src9) + 8)>>4];
-        src++;
-        dst++;
-    }
-}
-
-static void put_mspel8_mc00_c (uint8_t *dst, uint8_t *src, int stride){
-    put_pixels8_c(dst, src, stride, 8);
-}
-
-static void put_mspel8_mc10_c(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t half[64];
-    wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
-    put_pixels8_l2(dst, src, half, stride, stride, 8, 8);
-}
-
-static void put_mspel8_mc20_c(uint8_t *dst, uint8_t *src, int stride){
-    wmv2_mspel8_h_lowpass(dst, src, stride, stride, 8);
-}
-
-static void put_mspel8_mc30_c(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t half[64];
-    wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
-    put_pixels8_l2(dst, src+1, half, stride, stride, 8, 8);
-}
-
-static void put_mspel8_mc02_c(uint8_t *dst, uint8_t *src, int stride){
-    wmv2_mspel8_v_lowpass(dst, src, stride, stride, 8);
-}
-
-static void put_mspel8_mc12_c(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t halfH[88];
-    uint8_t halfV[64];
-    uint8_t halfHV[64];
-    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
-    wmv2_mspel8_v_lowpass(halfV, src, 8, stride, 8);
-    wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
-    put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);
-}
-static void put_mspel8_mc32_c(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t halfH[88];
-    uint8_t halfV[64];
-    uint8_t halfHV[64];
-    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
-    wmv2_mspel8_v_lowpass(halfV, src+1, 8, stride, 8);
-    wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
-    put_pixels8_l2(dst, halfV, halfHV, stride, 8, 8, 8);
-}
-static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t halfH[88];
-    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
-    wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8);
-}
-
-static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){
-    if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
-    int x;
-    const int strength= ff_h263_loop_filter_strength[qscale];
-
-    for(x=0; x<8; x++){
-        int d1, d2, ad1;
-        int p0= src[x-2*stride];
-        int p1= src[x-1*stride];
-        int p2= src[x+0*stride];
-        int p3= src[x+1*stride];
-        int d = (p0 - p3 + 4*(p2 - p1)) / 8;
-
-        if     (d<-2*strength) d1= 0;
-        else if(d<-  strength) d1=-2*strength - d;
-        else if(d<   strength) d1= d;
-        else if(d< 2*strength) d1= 2*strength - d;
-        else                   d1= 0;
-
-        p1 += d1;
-        p2 -= d1;
-        if(p1&256) p1= ~(p1>>31);
-        if(p2&256) p2= ~(p2>>31);
-
-        src[x-1*stride] = p1;
-        src[x+0*stride] = p2;
-
-        ad1= FFABS(d1)>>1;
-
-        d2= av_clip((p0-p3)/4, -ad1, ad1);
-
-        src[x-2*stride] = p0 - d2;
-        src[x+  stride] = p3 + d2;
-    }
-    }
-}
-
-static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){
-    if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
-    int y;
-    const int strength= ff_h263_loop_filter_strength[qscale];
-
-    for(y=0; y<8; y++){
-        int d1, d2, ad1;
-        int p0= src[y*stride-2];
-        int p1= src[y*stride-1];
-        int p2= src[y*stride+0];
-        int p3= src[y*stride+1];
-        int d = (p0 - p3 + 4*(p2 - p1)) / 8;
-
-        if     (d<-2*strength) d1= 0;
-        else if(d<-  strength) d1=-2*strength - d;
-        else if(d<   strength) d1= d;
-        else if(d< 2*strength) d1= 2*strength - d;
-        else                   d1= 0;
-
-        p1 += d1;
-        p2 -= d1;
-        if(p1&256) p1= ~(p1>>31);
-        if(p2&256) p2= ~(p2>>31);
-
-        src[y*stride-1] = p1;
-        src[y*stride+0] = p2;
-
-        ad1= FFABS(d1)>>1;
-
-        d2= av_clip((p0-p3)/4, -ad1, ad1);
-
-        src[y*stride-2] = p0 - d2;
-        src[y*stride+1] = p3 + d2;
-    }
-    }
-}
-
-static void h261_loop_filter_c(uint8_t *src, int stride){
-    int x,y,xy,yz;
-    int temp[64];
-
-    for(x=0; x<8; x++){
-        temp[x      ] = 4*src[x           ];
-        temp[x + 7*8] = 4*src[x + 7*stride];
-    }
-    for(y=1; y<7; y++){
-        for(x=0; x<8; x++){
-            xy = y * stride + x;
-            yz = y * 8 + x;
-            temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride];
-        }
-    }
-
-    for(y=0; y<8; y++){
-        src[  y*stride] = (temp[  y*8] + 2)>>2;
-        src[7+y*stride] = (temp[7+y*8] + 2)>>2;
-        for(x=1; x<7; x++){
-            xy = y * stride + x;
-            yz = y * 8 + x;
-            src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4;
-        }
-    }
-}
-
-static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - pix2[0]);
-        s += abs(pix1[1] - pix2[1]);
-        s += abs(pix1[2] - pix2[2]);
-        s += abs(pix1[3] - pix2[3]);
-        s += abs(pix1[4] - pix2[4]);
-        s += abs(pix1[5] - pix2[5]);
-        s += abs(pix1[6] - pix2[6]);
-        s += abs(pix1[7] - pix2[7]);
-        s += abs(pix1[8] - pix2[8]);
-        s += abs(pix1[9] - pix2[9]);
-        s += abs(pix1[10] - pix2[10]);
-        s += abs(pix1[11] - pix2[11]);
-        s += abs(pix1[12] - pix2[12]);
-        s += abs(pix1[13] - pix2[13]);
-        s += abs(pix1[14] - pix2[14]);
-        s += abs(pix1[15] - pix2[15]);
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    return s;
-}
-
-static int pix_abs16_x2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - avg2(pix2[0], pix2[1]));
-        s += abs(pix1[1] - avg2(pix2[1], pix2[2]));
-        s += abs(pix1[2] - avg2(pix2[2], pix2[3]));
-        s += abs(pix1[3] - avg2(pix2[3], pix2[4]));
-        s += abs(pix1[4] - avg2(pix2[4], pix2[5]));
-        s += abs(pix1[5] - avg2(pix2[5], pix2[6]));
-        s += abs(pix1[6] - avg2(pix2[6], pix2[7]));
-        s += abs(pix1[7] - avg2(pix2[7], pix2[8]));
-        s += abs(pix1[8] - avg2(pix2[8], pix2[9]));
-        s += abs(pix1[9] - avg2(pix2[9], pix2[10]));
-        s += abs(pix1[10] - avg2(pix2[10], pix2[11]));
-        s += abs(pix1[11] - avg2(pix2[11], pix2[12]));
-        s += abs(pix1[12] - avg2(pix2[12], pix2[13]));
-        s += abs(pix1[13] - avg2(pix2[13], pix2[14]));
-        s += abs(pix1[14] - avg2(pix2[14], pix2[15]));
-        s += abs(pix1[15] - avg2(pix2[15], pix2[16]));
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    return s;
-}
-
-static int pix_abs16_y2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-    uint8_t *pix3 = pix2 + line_size;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - avg2(pix2[0], pix3[0]));
-        s += abs(pix1[1] - avg2(pix2[1], pix3[1]));
-        s += abs(pix1[2] - avg2(pix2[2], pix3[2]));
-        s += abs(pix1[3] - avg2(pix2[3], pix3[3]));
-        s += abs(pix1[4] - avg2(pix2[4], pix3[4]));
-        s += abs(pix1[5] - avg2(pix2[5], pix3[5]));
-        s += abs(pix1[6] - avg2(pix2[6], pix3[6]));
-        s += abs(pix1[7] - avg2(pix2[7], pix3[7]));
-        s += abs(pix1[8] - avg2(pix2[8], pix3[8]));
-        s += abs(pix1[9] - avg2(pix2[9], pix3[9]));
-        s += abs(pix1[10] - avg2(pix2[10], pix3[10]));
-        s += abs(pix1[11] - avg2(pix2[11], pix3[11]));
-        s += abs(pix1[12] - avg2(pix2[12], pix3[12]));
-        s += abs(pix1[13] - avg2(pix2[13], pix3[13]));
-        s += abs(pix1[14] - avg2(pix2[14], pix3[14]));
-        s += abs(pix1[15] - avg2(pix2[15], pix3[15]));
-        pix1 += line_size;
-        pix2 += line_size;
-        pix3 += line_size;
-    }
-    return s;
-}
-
-static int pix_abs16_xy2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-    uint8_t *pix3 = pix2 + line_size;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1]));
-        s += abs(pix1[1] - avg4(pix2[1], pix2[2], pix3[1], pix3[2]));
-        s += abs(pix1[2] - avg4(pix2[2], pix2[3], pix3[2], pix3[3]));
-        s += abs(pix1[3] - avg4(pix2[3], pix2[4], pix3[3], pix3[4]));
-        s += abs(pix1[4] - avg4(pix2[4], pix2[5], pix3[4], pix3[5]));
-        s += abs(pix1[5] - avg4(pix2[5], pix2[6], pix3[5], pix3[6]));
-        s += abs(pix1[6] - avg4(pix2[6], pix2[7], pix3[6], pix3[7]));
-        s += abs(pix1[7] - avg4(pix2[7], pix2[8], pix3[7], pix3[8]));
-        s += abs(pix1[8] - avg4(pix2[8], pix2[9], pix3[8], pix3[9]));
-        s += abs(pix1[9] - avg4(pix2[9], pix2[10], pix3[9], pix3[10]));
-        s += abs(pix1[10] - avg4(pix2[10], pix2[11], pix3[10], pix3[11]));
-        s += abs(pix1[11] - avg4(pix2[11], pix2[12], pix3[11], pix3[12]));
-        s += abs(pix1[12] - avg4(pix2[12], pix2[13], pix3[12], pix3[13]));
-        s += abs(pix1[13] - avg4(pix2[13], pix2[14], pix3[13], pix3[14]));
-        s += abs(pix1[14] - avg4(pix2[14], pix2[15], pix3[14], pix3[15]));
-        s += abs(pix1[15] - avg4(pix2[15], pix2[16], pix3[15], pix3[16]));
-        pix1 += line_size;
-        pix2 += line_size;
-        pix3 += line_size;
-    }
-    return s;
-}
-
-static inline int pix_abs8_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - pix2[0]);
-        s += abs(pix1[1] - pix2[1]);
-        s += abs(pix1[2] - pix2[2]);
-        s += abs(pix1[3] - pix2[3]);
-        s += abs(pix1[4] - pix2[4]);
-        s += abs(pix1[5] - pix2[5]);
-        s += abs(pix1[6] - pix2[6]);
-        s += abs(pix1[7] - pix2[7]);
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    return s;
-}
-
-static int pix_abs8_x2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - avg2(pix2[0], pix2[1]));
-        s += abs(pix1[1] - avg2(pix2[1], pix2[2]));
-        s += abs(pix1[2] - avg2(pix2[2], pix2[3]));
-        s += abs(pix1[3] - avg2(pix2[3], pix2[4]));
-        s += abs(pix1[4] - avg2(pix2[4], pix2[5]));
-        s += abs(pix1[5] - avg2(pix2[5], pix2[6]));
-        s += abs(pix1[6] - avg2(pix2[6], pix2[7]));
-        s += abs(pix1[7] - avg2(pix2[7], pix2[8]));
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    return s;
-}
-
-static int pix_abs8_y2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-    uint8_t *pix3 = pix2 + line_size;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - avg2(pix2[0], pix3[0]));
-        s += abs(pix1[1] - avg2(pix2[1], pix3[1]));
-        s += abs(pix1[2] - avg2(pix2[2], pix3[2]));
-        s += abs(pix1[3] - avg2(pix2[3], pix3[3]));
-        s += abs(pix1[4] - avg2(pix2[4], pix3[4]));
-        s += abs(pix1[5] - avg2(pix2[5], pix3[5]));
-        s += abs(pix1[6] - avg2(pix2[6], pix3[6]));
-        s += abs(pix1[7] - avg2(pix2[7], pix3[7]));
-        pix1 += line_size;
-        pix2 += line_size;
-        pix3 += line_size;
-    }
-    return s;
-}
-
-static int pix_abs8_xy2_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int s, i;
-    uint8_t *pix3 = pix2 + line_size;
-
-    s = 0;
-    for(i=0;i<h;i++) {
-        s += abs(pix1[0] - avg4(pix2[0], pix2[1], pix3[0], pix3[1]));
-        s += abs(pix1[1] - avg4(pix2[1], pix2[2], pix3[1], pix3[2]));
-        s += abs(pix1[2] - avg4(pix2[2], pix2[3], pix3[2], pix3[3]));
-        s += abs(pix1[3] - avg4(pix2[3], pix2[4], pix3[3], pix3[4]));
-        s += abs(pix1[4] - avg4(pix2[4], pix2[5], pix3[4], pix3[5]));
-        s += abs(pix1[5] - avg4(pix2[5], pix2[6], pix3[5], pix3[6]));
-        s += abs(pix1[6] - avg4(pix2[6], pix2[7], pix3[6], pix3[7]));
-        s += abs(pix1[7] - avg4(pix2[7], pix2[8], pix3[7], pix3[8]));
-        pix1 += line_size;
-        pix2 += line_size;
-        pix3 += line_size;
-    }
-    return s;
-}
-
-static int nsse16_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){
-    MpegEncContext *c = v;
-    int score1=0;
-    int score2=0;
-    int x,y;
-
-    for(y=0; y<h; y++){
-        for(x=0; x<16; x++){
-            score1+= (s1[x  ] - s2[x ])*(s1[x  ] - s2[x ]);
-        }
-        if(y+1<h){
-            for(x=0; x<15; x++){
-                score2+= FFABS(  s1[x  ] - s1[x  +stride]
-                             - s1[x+1] + s1[x+1+stride])
-                        -FFABS(  s2[x  ] - s2[x  +stride]
-                             - s2[x+1] + s2[x+1+stride]);
-            }
-        }
-        s1+= stride;
-        s2+= stride;
-    }
-
-    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + FFABS(score2)*8;
-}
-
-static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){
-    MpegEncContext *c = v;
-    int score1=0;
-    int score2=0;
-    int x,y;
-
-    for(y=0; y<h; y++){
-        for(x=0; x<8; x++){
-            score1+= (s1[x  ] - s2[x ])*(s1[x  ] - s2[x ]);
-        }
-        if(y+1<h){
-            for(x=0; x<7; x++){
-                score2+= FFABS(  s1[x  ] - s1[x  +stride]
-                             - s1[x+1] + s1[x+1+stride])
-                        -FFABS(  s2[x  ] - s2[x  +stride]
-                             - s2[x+1] + s2[x+1+stride]);
-            }
-        }
-        s1+= stride;
-        s2+= stride;
-    }
-
-    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + FFABS(score2)*8;
-}
-
-static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){
-    int i;
-    unsigned int sum=0;
-
-    for(i=0; i<8*8; i++){
-        int b= rem[i] + ((basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT));
-        int w= weight[i];
-        b>>= RECON_SHIFT;
-        assert(-512<b && b<512);
-
-        sum += (w*b)*(w*b)>>4;
-    }
-    return sum>>2;
-}
-
-static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){
-    int i;
-
-    for(i=0; i<8*8; i++){
-        rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT);
-    }
-}
-
-/**
- * permutes an 8x8 block.
- * @param block the block which will be permuted according to the given permutation vector
- * @param permutation the permutation vector
- * @param last the last non zero coefficient in scantable order, used to speed the permutation up
- * @param scantable the used scantable, this is only used to speed the permutation up, the block is not
- *                  (inverse) permutated to scantable order!
- */
-void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last)
-{
-    int i;
-    DCTELEM temp[64];
-
-    if(last<=0) return;
-    //if(permutation[1]==1) return; //FIXME it is ok but not clean and might fail for some permutations
-
-    for(i=0; i<=last; i++){
-        const int j= scantable[i];
-        temp[j]= block[j];
-        block[j]=0;
-    }
-
-    for(i=0; i<=last; i++){
-        const int j= scantable[i];
-        const int perm_j= permutation[j];
-        block[perm_j]= temp[j];
-    }
-}
-
-static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){
-    return 0;
-}
-
-void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){
-    int i;
-
-    memset(cmp, 0, sizeof(void*)*6);
-
-    for(i=0; i<6; i++){
-        switch(type&0xFF){
-        case FF_CMP_SAD:
-            cmp[i]= c->sad[i];
-            break;
-        case FF_CMP_SATD:
-            cmp[i]= c->hadamard8_diff[i];
-            break;
-        case FF_CMP_SSE:
-            cmp[i]= c->sse[i];
-            break;
-        case FF_CMP_DCT:
-            cmp[i]= c->dct_sad[i];
-            break;
-        case FF_CMP_DCT264:
-            cmp[i]= c->dct264_sad[i];
-            break;
-        case FF_CMP_DCTMAX:
-            cmp[i]= c->dct_max[i];
-            break;
-        case FF_CMP_PSNR:
-            cmp[i]= c->quant_psnr[i];
-            break;
-        case FF_CMP_BIT:
-            cmp[i]= c->bit[i];
-            break;
-        case FF_CMP_RD:
-            cmp[i]= c->rd[i];
-            break;
-        case FF_CMP_VSAD:
-            cmp[i]= c->vsad[i];
-            break;
-        case FF_CMP_VSSE:
-            cmp[i]= c->vsse[i];
-            break;
-        case FF_CMP_ZERO:
-            cmp[i]= zero_cmp;
-            break;
-        case FF_CMP_NSSE:
-            cmp[i]= c->nsse[i];
-            break;
-#if CONFIG_DWT
-        case FF_CMP_W53:
-            cmp[i]= c->w53[i];
-            break;
-        case FF_CMP_W97:
-            cmp[i]= c->w97[i];
-            break;
-#endif
-        default:
-            av_log(NULL, AV_LOG_ERROR,"internal error in cmp function selection\n");
-        }
-    }
-}
-
-static void clear_block_c(DCTELEM *block)
-{
-    memset(block, 0, sizeof(DCTELEM)*64);
-}
-
-/**
- * memset(blocks, 0, sizeof(DCTELEM)*6*64)
- */
-static void clear_blocks_c(DCTELEM *blocks)
-{
-    memset(blocks, 0, sizeof(DCTELEM)*6*64);
-}
-
-static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
-    long i;
-    for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
-        long a = *(long*)(src+i);
-        long b = *(long*)(dst+i);
-        *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
-    }
-    for(; i<w; i++)
-        dst[i+0] += src[i+0];
-}
-
-static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
-    long i;
-    for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
-        long a = *(long*)(src1+i);
-        long b = *(long*)(src2+i);
-        *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
-    }
-    for(; i<w; i++)
-        dst[i] = src1[i]+src2[i];
-}
-
-static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
-    long i;
-#if !HAVE_FAST_UNALIGNED
-    if((long)src2 & (sizeof(long)-1)){
-        for(i=0; i+7<w; i+=8){
-            dst[i+0] = src1[i+0]-src2[i+0];
-            dst[i+1] = src1[i+1]-src2[i+1];
-            dst[i+2] = src1[i+2]-src2[i+2];
-            dst[i+3] = src1[i+3]-src2[i+3];
-            dst[i+4] = src1[i+4]-src2[i+4];
-            dst[i+5] = src1[i+5]-src2[i+5];
-            dst[i+6] = src1[i+6]-src2[i+6];
-            dst[i+7] = src1[i+7]-src2[i+7];
-        }
-    }else
-#endif
-    for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
-        long a = *(long*)(src1+i);
-        long b = *(long*)(src2+i);
-        *(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
-    }
-    for(; i<w; i++)
-        dst[i+0] = src1[i+0]-src2[i+0];
-}
-
-static void add_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *diff, int w, int *left, int *left_top){
-    int i;
-    uint8_t l, lt;
-
-    l= *left;
-    lt= *left_top;
-
-    for(i=0; i<w; i++){
-        l= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF) + diff[i];
-        lt= src1[i];
-        dst[i]= l;
-    }
-
-    *left= l;
-    *left_top= lt;
-}
-
-static void sub_hfyu_median_prediction_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top){
-    int i;
-    uint8_t l, lt;
-
-    l= *left;
-    lt= *left_top;
-
-    for(i=0; i<w; i++){
-        const int pred= mid_pred(l, src1[i], (l + src1[i] - lt)&0xFF);
-        lt= src1[i];
-        l= src2[i];
-        dst[i]= l - pred;
-    }
-
-    *left= l;
-    *left_top= lt;
-}
-
-static int add_hfyu_left_prediction_c(uint8_t *dst, const uint8_t *src, int w, int acc){
-    int i;
-
-    for(i=0; i<w-1; i++){
-        acc+= src[i];
-        dst[i]= acc;
-        i++;
-        acc+= src[i];
-        dst[i]= acc;
-    }
-
-    for(; i<w; i++){
-        acc+= src[i];
-        dst[i]= acc;
-    }
-
-    return acc;
-}
-
-#if HAVE_BIGENDIAN
-#define B 3
-#define G 2
-#define R 1
-#define A 0
-#else
-#define B 0
-#define G 1
-#define R 2
-#define A 3
-#endif
-static void add_hfyu_left_prediction_bgr32_c(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha){
-    int i;
-    int r,g,b,a;
-    r= *red;
-    g= *green;
-    b= *blue;
-    a= *alpha;
-
-    for(i=0; i<w; i++){
-        b+= src[4*i+B];
-        g+= src[4*i+G];
-        r+= src[4*i+R];
-        a+= src[4*i+A];
-
-        dst[4*i+B]= b;
-        dst[4*i+G]= g;
-        dst[4*i+R]= r;
-        dst[4*i+A]= a;
-    }
-
-    *red= r;
-    *green= g;
-    *blue= b;
-    *alpha= a;
-}
-#undef B
-#undef G
-#undef R
-#undef A
-
-#define BUTTERFLY2(o1,o2,i1,i2) \
-o1= (i1)+(i2);\
-o2= (i1)-(i2);
-
-#define BUTTERFLY1(x,y) \
-{\
-    int a,b;\
-    a= x;\
-    b= y;\
-    x= a+b;\
-    y= a-b;\
-}
-
-#define BUTTERFLYA(x,y) (FFABS((x)+(y)) + FFABS((x)-(y)))
-
-static int hadamard8_diff8x8_c(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){
-    int i;
-    int temp[64];
-    int sum=0;
-
-    assert(h==8);
-
-    for(i=0; i<8; i++){
-        //FIXME try pointer walks
-        BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0]-dst[stride*i+0],src[stride*i+1]-dst[stride*i+1]);
-        BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2]-dst[stride*i+2],src[stride*i+3]-dst[stride*i+3]);
-        BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4]-dst[stride*i+4],src[stride*i+5]-dst[stride*i+5]);
-        BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6]-dst[stride*i+6],src[stride*i+7]-dst[stride*i+7]);
-
-        BUTTERFLY1(temp[8*i+0], temp[8*i+2]);
-        BUTTERFLY1(temp[8*i+1], temp[8*i+3]);
-        BUTTERFLY1(temp[8*i+4], temp[8*i+6]);
-        BUTTERFLY1(temp[8*i+5], temp[8*i+7]);
-
-        BUTTERFLY1(temp[8*i+0], temp[8*i+4]);
-        BUTTERFLY1(temp[8*i+1], temp[8*i+5]);
-        BUTTERFLY1(temp[8*i+2], temp[8*i+6]);
-        BUTTERFLY1(temp[8*i+3], temp[8*i+7]);
-    }
-
-    for(i=0; i<8; i++){
-        BUTTERFLY1(temp[8*0+i], temp[8*1+i]);
-        BUTTERFLY1(temp[8*2+i], temp[8*3+i]);
-        BUTTERFLY1(temp[8*4+i], temp[8*5+i]);
-        BUTTERFLY1(temp[8*6+i], temp[8*7+i]);
-
-        BUTTERFLY1(temp[8*0+i], temp[8*2+i]);
-        BUTTERFLY1(temp[8*1+i], temp[8*3+i]);
-        BUTTERFLY1(temp[8*4+i], temp[8*6+i]);
-        BUTTERFLY1(temp[8*5+i], temp[8*7+i]);
-
-        sum +=
-             BUTTERFLYA(temp[8*0+i], temp[8*4+i])
-            +BUTTERFLYA(temp[8*1+i], temp[8*5+i])
-            +BUTTERFLYA(temp[8*2+i], temp[8*6+i])
-            +BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
-    }
-#if 0
-static int maxi=0;
-if(sum>maxi){
-    maxi=sum;
-    printf("MAX:%d\n", maxi);
-}
-#endif
-    return sum;
-}
-
-static int hadamard8_intra8x8_c(/*MpegEncContext*/ void *s, uint8_t *src, uint8_t *dummy, int stride, int h){
-    int i;
-    int temp[64];
-    int sum=0;
-
-    assert(h==8);
-
-    for(i=0; i<8; i++){
-        //FIXME try pointer walks
-        BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0],src[stride*i+1]);
-        BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2],src[stride*i+3]);
-        BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4],src[stride*i+5]);
-        BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6],src[stride*i+7]);
-
-        BUTTERFLY1(temp[8*i+0], temp[8*i+2]);
-        BUTTERFLY1(temp[8*i+1], temp[8*i+3]);
-        BUTTERFLY1(temp[8*i+4], temp[8*i+6]);
-        BUTTERFLY1(temp[8*i+5], temp[8*i+7]);
-
-        BUTTERFLY1(temp[8*i+0], temp[8*i+4]);
-        BUTTERFLY1(temp[8*i+1], temp[8*i+5]);
-        BUTTERFLY1(temp[8*i+2], temp[8*i+6]);
-        BUTTERFLY1(temp[8*i+3], temp[8*i+7]);
-    }
-
-    for(i=0; i<8; i++){
-        BUTTERFLY1(temp[8*0+i], temp[8*1+i]);
-        BUTTERFLY1(temp[8*2+i], temp[8*3+i]);
-        BUTTERFLY1(temp[8*4+i], temp[8*5+i]);
-        BUTTERFLY1(temp[8*6+i], temp[8*7+i]);
-
-        BUTTERFLY1(temp[8*0+i], temp[8*2+i]);
-        BUTTERFLY1(temp[8*1+i], temp[8*3+i]);
-        BUTTERFLY1(temp[8*4+i], temp[8*6+i]);
-        BUTTERFLY1(temp[8*5+i], temp[8*7+i]);
-
-        sum +=
-             BUTTERFLYA(temp[8*0+i], temp[8*4+i])
-            +BUTTERFLYA(temp[8*1+i], temp[8*5+i])
-            +BUTTERFLYA(temp[8*2+i], temp[8*6+i])
-            +BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
-    }
-
-    sum -= FFABS(temp[8*0] + temp[8*4]); // -mean
-
-    return sum;
-}
-
-static int dct_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
-    MpegEncContext * const s= (MpegEncContext *)c;
-    LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
-
-    assert(h==8);
-
-    s->dsp.diff_pixels(temp, src1, src2, stride);
-    s->dsp.fdct(temp);
-    return s->dsp.sum_abs_dctelem(temp);
-}
-
-#if CONFIG_GPL
-#define DCT8_1D {\
-    const int s07 = SRC(0) + SRC(7);\
-    const int s16 = SRC(1) + SRC(6);\
-    const int s25 = SRC(2) + SRC(5);\
-    const int s34 = SRC(3) + SRC(4);\
-    const int a0 = s07 + s34;\
-    const int a1 = s16 + s25;\
-    const int a2 = s07 - s34;\
-    const int a3 = s16 - s25;\
-    const int d07 = SRC(0) - SRC(7);\
-    const int d16 = SRC(1) - SRC(6);\
-    const int d25 = SRC(2) - SRC(5);\
-    const int d34 = SRC(3) - SRC(4);\
-    const int a4 = d16 + d25 + (d07 + (d07>>1));\
-    const int a5 = d07 - d34 - (d25 + (d25>>1));\
-    const int a6 = d07 + d34 - (d16 + (d16>>1));\
-    const int a7 = d16 - d25 + (d34 + (d34>>1));\
-    DST(0,  a0 + a1     ) ;\
-    DST(1,  a4 + (a7>>2)) ;\
-    DST(2,  a2 + (a3>>1)) ;\
-    DST(3,  a5 + (a6>>2)) ;\
-    DST(4,  a0 - a1     ) ;\
-    DST(5,  a6 - (a5>>2)) ;\
-    DST(6, (a2>>1) - a3 ) ;\
-    DST(7, (a4>>2) - a7 ) ;\
-}
-
-static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
-    MpegEncContext * const s= (MpegEncContext *)c;
-    DCTELEM dct[8][8];
-    int i;
-    int sum=0;
-
-    s->dsp.diff_pixels(dct[0], src1, src2, stride);
-
-#define SRC(x) dct[i][x]
-#define DST(x,v) dct[i][x]= v
-    for( i = 0; i < 8; i++ )
-        DCT8_1D
-#undef SRC
-#undef DST
-
-#define SRC(x) dct[x][i]
-#define DST(x,v) sum += FFABS(v)
-    for( i = 0; i < 8; i++ )
-        DCT8_1D
-#undef SRC
-#undef DST
-    return sum;
-}
-#endif
-
-static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
-    MpegEncContext * const s= (MpegEncContext *)c;
-    LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
-    int sum=0, i;
-
-    assert(h==8);
-
-    s->dsp.diff_pixels(temp, src1, src2, stride);
-    s->dsp.fdct(temp);
-
-    for(i=0; i<64; i++)
-        sum= FFMAX(sum, FFABS(temp[i]));
-
-    return sum;
-}
-
-static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
-    MpegEncContext * const s= (MpegEncContext *)c;
-    LOCAL_ALIGNED_16(DCTELEM, temp, [64*2]);
-    DCTELEM * const bak = temp+64;
-    int sum=0, i;
-
-    assert(h==8);
-    s->mb_intra=0;
-
-    s->dsp.diff_pixels(temp, src1, src2, stride);
-
-    memcpy(bak, temp, 64*sizeof(DCTELEM));
-
-    s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
-    s->dct_unquantize_inter(s, temp, 0, s->qscale);
-    ff_simple_idct(temp); //FIXME
-
-    for(i=0; i<64; i++)
-        sum+= (temp[i]-bak[i])*(temp[i]-bak[i]);
-
-    return sum;
-}
-
-static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
-    MpegEncContext * const s= (MpegEncContext *)c;
-    const uint8_t *scantable= s->intra_scantable.permutated;
-    LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
-    LOCAL_ALIGNED_16(uint8_t, lsrc1, [64]);
-    LOCAL_ALIGNED_16(uint8_t, lsrc2, [64]);
-    int i, last, run, bits, level, distortion, start_i;
-    const int esc_length= s->ac_esc_length;
-    uint8_t * length;
-    uint8_t * last_length;
-
-    assert(h==8);
-
-    copy_block8(lsrc1, src1, 8, stride, 8);
-    copy_block8(lsrc2, src2, 8, stride, 8);
-
-    s->dsp.diff_pixels(temp, lsrc1, lsrc2, 8);
-
-    s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
-
-    bits=0;
-
-    if (s->mb_intra) {
-        start_i = 1;
-        length     = s->intra_ac_vlc_length;
-        last_length= s->intra_ac_vlc_last_length;
-        bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma
-    } else {
-        start_i = 0;
-        length     = s->inter_ac_vlc_length;
-        last_length= s->inter_ac_vlc_last_length;
-    }
-
-    if(last>=start_i){
-        run=0;
-        for(i=start_i; i<last; i++){
-            int j= scantable[i];
-            level= temp[j];
-
-            if(level){
-                level+=64;
-                if((level&(~127)) == 0){
-                    bits+= length[UNI_AC_ENC_INDEX(run, level)];
-                }else
-                    bits+= esc_length;
-                run=0;
-            }else
-                run++;
-        }
-        i= scantable[last];
-
-        level= temp[i] + 64;
-
-        assert(level - 64);
-
-        if((level&(~127)) == 0){
-            bits+= last_length[UNI_AC_ENC_INDEX(run, level)];
-        }else
-            bits+= esc_length;
-
-    }
-
-    if(last>=0){
-        if(s->mb_intra)
-            s->dct_unquantize_intra(s, temp, 0, s->qscale);
-        else
-            s->dct_unquantize_inter(s, temp, 0, s->qscale);
-    }
-
-    s->dsp.idct_add(lsrc2, 8, temp);
-
-    distortion= s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8);
-
-    return distortion + ((bits*s->qscale*s->qscale*109 + 64)>>7);
-}
-
-static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){
-    MpegEncContext * const s= (MpegEncContext *)c;
-    const uint8_t *scantable= s->intra_scantable.permutated;
-    LOCAL_ALIGNED_16(DCTELEM, temp, [64]);
-    int i, last, run, bits, level, start_i;
-    const int esc_length= s->ac_esc_length;
-    uint8_t * length;
-    uint8_t * last_length;
-
-    assert(h==8);
-
-    s->dsp.diff_pixels(temp, src1, src2, stride);
-
-    s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
-
-    bits=0;
-
-    if (s->mb_intra) {
-        start_i = 1;
-        length     = s->intra_ac_vlc_length;
-        last_length= s->intra_ac_vlc_last_length;
-        bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma
-    } else {
-        start_i = 0;
-        length     = s->inter_ac_vlc_length;
-        last_length= s->inter_ac_vlc_last_length;
-    }
-
-    if(last>=start_i){
-        run=0;
-        for(i=start_i; i<last; i++){
-            int j= scantable[i];
-            level= temp[j];
-
-            if(level){
-                level+=64;
-                if((level&(~127)) == 0){
-                    bits+= length[UNI_AC_ENC_INDEX(run, level)];
-                }else
-                    bits+= esc_length;
-                run=0;
-            }else
-                run++;
-        }
-        i= scantable[last];
-
-        level= temp[i] + 64;
-
-        assert(level - 64);
-
-        if((level&(~127)) == 0){
-            bits+= last_length[UNI_AC_ENC_INDEX(run, level)];
-        }else
-            bits+= esc_length;
-    }
-
-    return bits;
-}
-
-#define VSAD_INTRA(size) \
-static int vsad_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ \
-    int score=0;                                                                                            \
-    int x,y;                                                                                                \
-                                                                                                            \
-    for(y=1; y<h; y++){                                                                                     \
-        for(x=0; x<size; x+=4){                                                                             \
-            score+= FFABS(s[x  ] - s[x  +stride]) + FFABS(s[x+1] - s[x+1+stride])                           \
-                   +FFABS(s[x+2] - s[x+2+stride]) + FFABS(s[x+3] - s[x+3+stride]);                          \
-        }                                                                                                   \
-        s+= stride;                                                                                         \
-    }                                                                                                       \
-                                                                                                            \
-    return score;                                                                                           \
-}
-VSAD_INTRA(8)
-VSAD_INTRA(16)
-
-static int vsad16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){
-    int score=0;
-    int x,y;
-
-    for(y=1; y<h; y++){
-        for(x=0; x<16; x++){
-            score+= FFABS(s1[x  ] - s2[x ] - s1[x  +stride] + s2[x +stride]);
-        }
-        s1+= stride;
-        s2+= stride;
-    }
-
-    return score;
-}
-
-#define SQ(a) ((a)*(a))
-#define VSSE_INTRA(size) \
-static int vsse_intra##size##_c(/*MpegEncContext*/ void *c, uint8_t *s, uint8_t *dummy, int stride, int h){ \
-    int score=0;                                                                                            \
-    int x,y;                                                                                                \
-                                                                                                            \
-    for(y=1; y<h; y++){                                                                                     \
-        for(x=0; x<size; x+=4){                                                                               \
-            score+= SQ(s[x  ] - s[x  +stride]) + SQ(s[x+1] - s[x+1+stride])                                 \
-                   +SQ(s[x+2] - s[x+2+stride]) + SQ(s[x+3] - s[x+3+stride]);                                \
-        }                                                                                                   \
-        s+= stride;                                                                                         \
-    }                                                                                                       \
-                                                                                                            \
-    return score;                                                                                           \
-}
-VSSE_INTRA(8)
-VSSE_INTRA(16)
-
-static int vsse16_c(/*MpegEncContext*/ void *c, uint8_t *s1, uint8_t *s2, int stride, int h){
-    int score=0;
-    int x,y;
-
-    for(y=1; y<h; y++){
-        for(x=0; x<16; x++){
-            score+= SQ(s1[x  ] - s2[x ] - s1[x  +stride] + s2[x +stride]);
-        }
-        s1+= stride;
-        s2+= stride;
-    }
-
-    return score;
-}
-
-static int ssd_int8_vs_int16_c(const int8_t *pix1, const int16_t *pix2,
-                               int size){
-    int score=0;
-    int i;
-    for(i=0; i<size; i++)
-        score += (pix1[i]-pix2[i])*(pix1[i]-pix2[i]);
-    return score;
-}
-
-WRAPPER8_16_SQ(hadamard8_diff8x8_c, hadamard8_diff16_c)
-WRAPPER8_16_SQ(hadamard8_intra8x8_c, hadamard8_intra16_c)
-WRAPPER8_16_SQ(dct_sad8x8_c, dct_sad16_c)
-#if CONFIG_GPL
-WRAPPER8_16_SQ(dct264_sad8x8_c, dct264_sad16_c)
-#endif
-WRAPPER8_16_SQ(dct_max8x8_c, dct_max16_c)
-WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c)
-WRAPPER8_16_SQ(rd8x8_c, rd16_c)
-WRAPPER8_16_SQ(bit8x8_c, bit16_c)
-
-static void vector_fmul_c(float *dst, const float *src, int len){
-    int i;
-    for(i=0; i<len; i++)
-        dst[i] *= src[i];
-}
-
-static void vector_fmul_reverse_c(float *dst, const float *src0, const float *src1, int len){
-    int i;
-    src1 += len-1;
-    for(i=0; i<len; i++)
-        dst[i] = src0[i] * src1[-i];
-}
-
-static void vector_fmul_add_c(float *dst, const float *src0, const float *src1, const float *src2, int len){
-    int i;
-    for(i=0; i<len; i++)
-        dst[i] = src0[i] * src1[i] + src2[i];
-}
-
-void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len){
-    int i,j;
-    dst += len;
-    win += len;
-    src0+= len;
-    for(i=-len, j=len-1; i<0; i++, j--) {
-        float s0 = src0[i];
-        float s1 = src1[j];
-        float wi = win[i];
-        float wj = win[j];
-        dst[i] = s0*wj - s1*wi + add_bias;
-        dst[j] = s0*wi + s1*wj + add_bias;
-    }
-}
-
-static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
-                                 int len)
-{
-    int i;
-    for (i = 0; i < len; i++)
-        dst[i] = src[i] * mul;
-}
-
-static void vector_fmul_sv_scalar_2_c(float *dst, const float *src,
-                                      const float **sv, float mul, int len)
-{
-    int i;
-    for (i = 0; i < len; i += 2, sv++) {
-        dst[i  ] = src[i  ] * sv[0][0] * mul;
-        dst[i+1] = src[i+1] * sv[0][1] * mul;
-    }
-}
-
-static void vector_fmul_sv_scalar_4_c(float *dst, const float *src,
-                                      const float **sv, float mul, int len)
-{
-    int i;
-    for (i = 0; i < len; i += 4, sv++) {
-        dst[i  ] = src[i  ] * sv[0][0] * mul;
-        dst[i+1] = src[i+1] * sv[0][1] * mul;
-        dst[i+2] = src[i+2] * sv[0][2] * mul;
-        dst[i+3] = src[i+3] * sv[0][3] * mul;
-    }
-}
-
-static void sv_fmul_scalar_2_c(float *dst, const float **sv, float mul,
-                               int len)
-{
-    int i;
-    for (i = 0; i < len; i += 2, sv++) {
-        dst[i  ] = sv[0][0] * mul;
-        dst[i+1] = sv[0][1] * mul;
-    }
-}
-
-static void sv_fmul_scalar_4_c(float *dst, const float **sv, float mul,
-                               int len)
-{
-    int i;
-    for (i = 0; i < len; i += 4, sv++) {
-        dst[i  ] = sv[0][0] * mul;
-        dst[i+1] = sv[0][1] * mul;
-        dst[i+2] = sv[0][2] * mul;
-        dst[i+3] = sv[0][3] * mul;
-    }
-}
-
-static void butterflies_float_c(float *restrict v1, float *restrict v2,
-                                int len)
-{
-    int i;
-    for (i = 0; i < len; i++) {
-        float t = v1[i] - v2[i];
-        v1[i] += v2[i];
-        v2[i] = t;
-    }
-}
-
-static float scalarproduct_float_c(const float *v1, const float *v2, int len)
-{
-    float p = 0.0;
-    int i;
-
-    for (i = 0; i < len; i++)
-        p += v1[i] * v2[i];
-
-    return p;
-}
-
-static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul, int len){
-    int i;
-    for(i=0; i<len; i++)
-        dst[i] = src[i] * mul;
-}
-
-static inline uint32_t clipf_c_one(uint32_t a, uint32_t mini,
-                   uint32_t maxi, uint32_t maxisign)
-{
-
-    if(a > mini) return mini;
-    else if((a^(1<<31)) > maxisign) return maxi;
-    else return a;
-}
-
-static void vector_clipf_c_opposite_sign(float *dst, const float *src, float *min, float *max, int len){
-    int i;
-    uint32_t mini = *(uint32_t*)min;
-    uint32_t maxi = *(uint32_t*)max;
-    uint32_t maxisign = maxi ^ (1<<31);
-    uint32_t *dsti = (uint32_t*)dst;
-    const uint32_t *srci = (const uint32_t*)src;
-    for(i=0; i<len; i+=8) {
-        dsti[i + 0] = clipf_c_one(srci[i + 0], mini, maxi, maxisign);
-        dsti[i + 1] = clipf_c_one(srci[i + 1], mini, maxi, maxisign);
-        dsti[i + 2] = clipf_c_one(srci[i + 2], mini, maxi, maxisign);
-        dsti[i + 3] = clipf_c_one(srci[i + 3], mini, maxi, maxisign);
-        dsti[i + 4] = clipf_c_one(srci[i + 4], mini, maxi, maxisign);
-        dsti[i + 5] = clipf_c_one(srci[i + 5], mini, maxi, maxisign);
-        dsti[i + 6] = clipf_c_one(srci[i + 6], mini, maxi, maxisign);
-        dsti[i + 7] = clipf_c_one(srci[i + 7], mini, maxi, maxisign);
-    }
-}
-static void vector_clipf_c(float *dst, const float *src, float min, float max, int len){
-    int i;
-    if(min < 0 && max > 0) {
-        vector_clipf_c_opposite_sign(dst, src, &min, &max, len);
-    } else {
-        for(i=0; i < len; i+=8) {
-            dst[i    ] = av_clipf(src[i    ], min, max);
-            dst[i + 1] = av_clipf(src[i + 1], min, max);
-            dst[i + 2] = av_clipf(src[i + 2], min, max);
-            dst[i + 3] = av_clipf(src[i + 3], min, max);
-            dst[i + 4] = av_clipf(src[i + 4], min, max);
-            dst[i + 5] = av_clipf(src[i + 5], min, max);
-            dst[i + 6] = av_clipf(src[i + 6], min, max);
-            dst[i + 7] = av_clipf(src[i + 7], min, max);
-        }
-    }
-}
-
-static av_always_inline int float_to_int16_one(const float *src){
-    int_fast32_t tmp = *(const int32_t*)src;
-    if(tmp & 0xf0000){
-        tmp = (0x43c0ffff - tmp)>>31;
-        // is this faster on some gcc/cpu combinations?
-//      if(tmp > 0x43c0ffff) tmp = 0xFFFF;
-//      else                 tmp = 0;
-    }
-    return tmp - 0x8000;
-}
-
-void ff_float_to_int16_c(int16_t *dst, const float *src, long len){
-    int i;
-    for(i=0; i<len; i++)
-        dst[i] = float_to_int16_one(src+i);
-}
-
-void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels){
-    int i,j,c;
-    if(channels==2){
-        for(i=0; i<len; i++){
-            dst[2*i]   = float_to_int16_one(src[0]+i);
-            dst[2*i+1] = float_to_int16_one(src[1]+i);
-        }
-    }else{
-        for(c=0; c<channels; c++)
-            for(i=0, j=c; i<len; i++, j+=channels)
-                dst[j] = float_to_int16_one(src[c]+i);
-    }
-}
-
-static int32_t scalarproduct_int16_c(int16_t * v1, int16_t * v2, int order, int shift)
-{
-    int res = 0;
-
-    while (order--)
-        res += (*v1++ * *v2++) >> shift;
-
-    return res;
-}
-
-static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
-{
-    int res = 0;
-    while (order--) {
-        res   += *v1 * *v2++;
-        *v1++ += mul * *v3++;
-    }
-    return res;
-}
-
-#define W0 2048
-#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
-#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
-#define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */
-#define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */
-#define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */
-#define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */
-#define W7 565  /* 2048*sqrt (2)*cos (7*pi/16) */
-
-static void wmv2_idct_row(short * b)
-{
-    int s1,s2;
-    int a0,a1,a2,a3,a4,a5,a6,a7;
-    /*step 1*/
-    a1 = W1*b[1]+W7*b[7];
-    a7 = W7*b[1]-W1*b[7];
-    a5 = W5*b[5]+W3*b[3];
-    a3 = W3*b[5]-W5*b[3];
-    a2 = W2*b[2]+W6*b[6];
-    a6 = W6*b[2]-W2*b[6];
-    a0 = W0*b[0]+W0*b[4];
-    a4 = W0*b[0]-W0*b[4];
-    /*step 2*/
-    s1 = (181*(a1-a5+a7-a3)+128)>>8;//1,3,5,7,
-    s2 = (181*(a1-a5-a7+a3)+128)>>8;
-    /*step 3*/
-    b[0] = (a0+a2+a1+a5 + (1<<7))>>8;
-    b[1] = (a4+a6 +s1   + (1<<7))>>8;
-    b[2] = (a4-a6 +s2   + (1<<7))>>8;
-    b[3] = (a0-a2+a7+a3 + (1<<7))>>8;
-    b[4] = (a0-a2-a7-a3 + (1<<7))>>8;
-    b[5] = (a4-a6 -s2   + (1<<7))>>8;
-    b[6] = (a4+a6 -s1   + (1<<7))>>8;
-    b[7] = (a0+a2-a1-a5 + (1<<7))>>8;
-}
-static void wmv2_idct_col(short * b)
-{
-    int s1,s2;
-    int a0,a1,a2,a3,a4,a5,a6,a7;
-    /*step 1, with extended precision*/
-    a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3;
-    a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3;
-    a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3;
-    a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3;
-    a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3;
-    a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3;
-    a0 = (W0*b[8*0]+W0*b[8*4]    )>>3;
-    a4 = (W0*b[8*0]-W0*b[8*4]    )>>3;
-    /*step 2*/
-    s1 = (181*(a1-a5+a7-a3)+128)>>8;
-    s2 = (181*(a1-a5-a7+a3)+128)>>8;
-    /*step 3*/
-    b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14;
-    b[8*1] = (a4+a6 +s1   + (1<<13))>>14;
-    b[8*2] = (a4-a6 +s2   + (1<<13))>>14;
-    b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14;
-
-    b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14;
-    b[8*5] = (a4-a6 -s2   + (1<<13))>>14;
-    b[8*6] = (a4+a6 -s1   + (1<<13))>>14;
-    b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14;
-}
-void ff_wmv2_idct_c(short * block){
-    int i;
-
-    for(i=0;i<64;i+=8){
-        wmv2_idct_row(block+i);
-    }
-    for(i=0;i<8;i++){
-        wmv2_idct_col(block+i);
-    }
-}
-/* XXX: those functions should be suppressed ASAP when all IDCTs are
- converted */
-static void ff_wmv2_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_wmv2_idct_c(block);
-    put_pixels_clamped_c(block, dest, line_size);
-}
-static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_wmv2_idct_c(block);
-    add_pixels_clamped_c(block, dest, line_size);
-}
-static void ff_jref_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    j_rev_dct (block);
-    put_pixels_clamped_c(block, dest, line_size);
-}
-static void ff_jref_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    j_rev_dct (block);
-    add_pixels_clamped_c(block, dest, line_size);
-}
-
-static void ff_jref_idct4_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    j_rev_dct4 (block);
-    put_pixels_clamped4_c(block, dest, line_size);
-}
-static void ff_jref_idct4_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    j_rev_dct4 (block);
-    add_pixels_clamped4_c(block, dest, line_size);
-}
-
-static void ff_jref_idct2_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    j_rev_dct2 (block);
-    put_pixels_clamped2_c(block, dest, line_size);
-}
-static void ff_jref_idct2_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    j_rev_dct2 (block);
-    add_pixels_clamped2_c(block, dest, line_size);
-}
-
-static void ff_jref_idct1_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    dest[0] = cm[(block[0] + 4)>>3];
-}
-static void ff_jref_idct1_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    dest[0] = cm[dest[0] + ((block[0] + 4)>>3)];
-}
-
-static void just_return(void *mem av_unused, int stride av_unused, int h av_unused) { return; }
-
-/* init static data */
-av_cold void dsputil_static_init(void)
-{
-    int i;
-
-    for(i=0;i<256;i++) ff_cropTbl[i + MAX_NEG_CROP] = i;
-    for(i=0;i<MAX_NEG_CROP;i++) {
-        ff_cropTbl[i] = 0;
-        ff_cropTbl[i + MAX_NEG_CROP + 256] = 255;
-    }
-
-    for(i=0;i<512;i++) {
-        ff_squareTbl[i] = (i - 256) * (i - 256);
-    }
-
-    for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
-}
-
-int ff_check_alignment(void){
-    static int did_fail=0;
-    DECLARE_ALIGNED(16, int, aligned);
-
-    if((intptr_t)&aligned & 15){
-        if(!did_fail){
-#if HAVE_MMX || HAVE_ALTIVEC
-            av_log(NULL, AV_LOG_ERROR,
-                "Compiler did not align stack variables. Libavcodec has been miscompiled\n"
-                "and may be very slow or crash. This is not a bug in libavcodec,\n"
-                "but in the compiler. You may try recompiling using gcc >= 4.2.\n"
-                "Do not report crashes to FFmpeg developers.\n");
-#endif
-            did_fail=1;
-        }
-        return -1;
-    }
-    return 0;
-}
-
-av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
-{
-    int i;
-
-    ff_check_alignment();
-
-#if CONFIG_ENCODERS
-    if(avctx->dct_algo==FF_DCT_FASTINT) {
-        c->fdct = fdct_ifast;
-        c->fdct248 = fdct_ifast248;
-    }
-    else if(avctx->dct_algo==FF_DCT_FAAN) {
-        c->fdct = ff_faandct;
-        c->fdct248 = ff_faandct248;
-    }
-    else {
-        c->fdct = ff_jpeg_fdct_islow; //slow/accurate/default
-        c->fdct248 = ff_fdct248_islow;
-    }
-#endif //CONFIG_ENCODERS
-
-    if(avctx->lowres==1){
-        if(avctx->idct_algo==FF_IDCT_INT || avctx->idct_algo==FF_IDCT_AUTO || !CONFIG_H264_DECODER){
-            c->idct_put= ff_jref_idct4_put;
-            c->idct_add= ff_jref_idct4_add;
-        }else{
-            c->idct_put= ff_h264_lowres_idct_put_c;
-            c->idct_add= ff_h264_lowres_idct_add_c;
-        }
-        c->idct    = j_rev_dct4;
-        c->idct_permutation_type= FF_NO_IDCT_PERM;
-    }else if(avctx->lowres==2){
-        c->idct_put= ff_jref_idct2_put;
-        c->idct_add= ff_jref_idct2_add;
-        c->idct    = j_rev_dct2;
-        c->idct_permutation_type= FF_NO_IDCT_PERM;
-    }else if(avctx->lowres==3){
-        c->idct_put= ff_jref_idct1_put;
-        c->idct_add= ff_jref_idct1_add;
-        c->idct    = j_rev_dct1;
-        c->idct_permutation_type= FF_NO_IDCT_PERM;
-    }else{
-        if(avctx->idct_algo==FF_IDCT_INT){
-            c->idct_put= ff_jref_idct_put;
-            c->idct_add= ff_jref_idct_add;
-            c->idct    = j_rev_dct;
-            c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
-        }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&
-                avctx->idct_algo==FF_IDCT_VP3){
-            c->idct_put= ff_vp3_idct_put_c;
-            c->idct_add= ff_vp3_idct_add_c;
-            c->idct    = ff_vp3_idct_c;
-            c->idct_permutation_type= FF_NO_IDCT_PERM;
-        }else if(avctx->idct_algo==FF_IDCT_WMV2){
-            c->idct_put= ff_wmv2_idct_put_c;
-            c->idct_add= ff_wmv2_idct_add_c;
-            c->idct    = ff_wmv2_idct_c;
-            c->idct_permutation_type= FF_NO_IDCT_PERM;
-        }else if(avctx->idct_algo==FF_IDCT_FAAN){
-            c->idct_put= ff_faanidct_put;
-            c->idct_add= ff_faanidct_add;
-            c->idct    = ff_faanidct;
-            c->idct_permutation_type= FF_NO_IDCT_PERM;
-        }else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) {
-            c->idct_put= ff_ea_idct_put_c;
-            c->idct_permutation_type= FF_NO_IDCT_PERM;
-        }else if(CONFIG_BINK_DECODER && avctx->idct_algo==FF_IDCT_BINK) {
-            c->idct     = ff_bink_idct_c;
-            c->idct_add = ff_bink_idct_add_c;
-            c->idct_put = ff_bink_idct_put_c;
-            c->idct_permutation_type = FF_NO_IDCT_PERM;
-        }else{ //accurate/default
-            c->idct_put= ff_simple_idct_put;
-            c->idct_add= ff_simple_idct_add;
-            c->idct    = ff_simple_idct;
-            c->idct_permutation_type= FF_NO_IDCT_PERM;
-        }
-    }
-
-    c->get_pixels = get_pixels_c;
-    c->diff_pixels = diff_pixels_c;
-    c->put_pixels_clamped = put_pixels_clamped_c;
-    c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
-    c->put_pixels_nonclamped = put_pixels_nonclamped_c;
-    c->add_pixels_clamped = add_pixels_clamped_c;
-    c->add_pixels8 = add_pixels8_c;
-    c->add_pixels4 = add_pixels4_c;
-    c->sum_abs_dctelem = sum_abs_dctelem_c;
-    c->gmc1 = gmc1_c;
-    c->gmc = ff_gmc_c;
-    c->clear_block = clear_block_c;
-    c->clear_blocks = clear_blocks_c;
-    c->pix_sum = pix_sum_c;
-    c->pix_norm1 = pix_norm1_c;
-
-    c->fill_block_tab[0] = fill_block16_c;
-    c->fill_block_tab[1] = fill_block8_c;
-    c->scale_block = scale_block_c;
-
-    /* TODO [0] 16  [1] 8 */
-    c->pix_abs[0][0] = pix_abs16_c;
-    c->pix_abs[0][1] = pix_abs16_x2_c;
-    c->pix_abs[0][2] = pix_abs16_y2_c;
-    c->pix_abs[0][3] = pix_abs16_xy2_c;
-    c->pix_abs[1][0] = pix_abs8_c;
-    c->pix_abs[1][1] = pix_abs8_x2_c;
-    c->pix_abs[1][2] = pix_abs8_y2_c;
-    c->pix_abs[1][3] = pix_abs8_xy2_c;
-
-#define dspfunc(PFX, IDX, NUM) \
-    c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c;     \
-    c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c;  \
-    c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c;  \
-    c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c
-
-    dspfunc(put, 0, 16);
-    dspfunc(put_no_rnd, 0, 16);
-    dspfunc(put, 1, 8);
-    dspfunc(put_no_rnd, 1, 8);
-    dspfunc(put, 2, 4);
-    dspfunc(put, 3, 2);
-
-    dspfunc(avg, 0, 16);
-    dspfunc(avg_no_rnd, 0, 16);
-    dspfunc(avg, 1, 8);
-    dspfunc(avg_no_rnd, 1, 8);
-    dspfunc(avg, 2, 4);
-    dspfunc(avg, 3, 2);
-#undef dspfunc
-
-    c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
-    c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
-
-    c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
-    c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
-    c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
-    c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;
-    c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;
-    c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;
-    c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;
-    c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;
-    c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;
-
-    c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;
-    c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;
-    c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;
-    c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;
-    c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;
-    c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;
-    c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;
-    c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;
-    c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;
-
-#define dspfunc(PFX, IDX, NUM) \
-    c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \
-    c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \
-    c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \
-    c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \
-    c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \
-    c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \
-    c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \
-    c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \
-    c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \
-    c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \
-    c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \
-    c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \
-    c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \
-    c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \
-    c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \
-    c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c
-
-    dspfunc(put_qpel, 0, 16);
-    dspfunc(put_no_rnd_qpel, 0, 16);
-
-    dspfunc(avg_qpel, 0, 16);
-    /* dspfunc(avg_no_rnd_qpel, 0, 16); */
-
-    dspfunc(put_qpel, 1, 8);
-    dspfunc(put_no_rnd_qpel, 1, 8);
-
-    dspfunc(avg_qpel, 1, 8);
-    /* dspfunc(avg_no_rnd_qpel, 1, 8); */
-
-    dspfunc(put_h264_qpel, 0, 16);
-    dspfunc(put_h264_qpel, 1, 8);
-    dspfunc(put_h264_qpel, 2, 4);
-    dspfunc(put_h264_qpel, 3, 2);
-    dspfunc(avg_h264_qpel, 0, 16);
-    dspfunc(avg_h264_qpel, 1, 8);
-    dspfunc(avg_h264_qpel, 2, 4);
-
-#undef dspfunc
-    c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
-    c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
-    c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
-    c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
-    c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
-    c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
-    c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_no_rnd_vc1_chroma_mc8_c;
-    c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_no_rnd_vc1_chroma_mc8_c;
-
-    c->draw_edges = draw_edges_c;
-
-#if CONFIG_CAVS_DECODER
-    ff_cavsdsp_init(c,avctx);
-#endif
-
-#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
-    ff_mlp_init(c, avctx);
-#endif
-#if CONFIG_VC1_DECODER
-    ff_vc1dsp_init(c,avctx);
-#endif
-#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER
-    ff_intrax8dsp_init(c,avctx);
-#endif
-#if CONFIG_RV30_DECODER
-    ff_rv30dsp_init(c,avctx);
-#endif
-#if CONFIG_RV40_DECODER
-    ff_rv40dsp_init(c,avctx);
-    c->put_rv40_qpel_pixels_tab[0][15] = put_rv40_qpel16_mc33_c;
-    c->avg_rv40_qpel_pixels_tab[0][15] = avg_rv40_qpel16_mc33_c;
-    c->put_rv40_qpel_pixels_tab[1][15] = put_rv40_qpel8_mc33_c;
-    c->avg_rv40_qpel_pixels_tab[1][15] = avg_rv40_qpel8_mc33_c;
-#endif
-
-    c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
-    c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
-    c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
-    c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;
-    c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;
-    c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;
-    c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;
-    c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;
-
-#define SET_CMP_FUNC(name) \
-    c->name[0]= name ## 16_c;\
-    c->name[1]= name ## 8x8_c;
-
-    SET_CMP_FUNC(hadamard8_diff)
-    c->hadamard8_diff[4]= hadamard8_intra16_c;
-    c->hadamard8_diff[5]= hadamard8_intra8x8_c;
-    SET_CMP_FUNC(dct_sad)
-    SET_CMP_FUNC(dct_max)
-#if CONFIG_GPL
-    SET_CMP_FUNC(dct264_sad)
-#endif
-    c->sad[0]= pix_abs16_c;
-    c->sad[1]= pix_abs8_c;
-    c->sse[0]= sse16_c;
-    c->sse[1]= sse8_c;
-    c->sse[2]= sse4_c;
-    SET_CMP_FUNC(quant_psnr)
-    SET_CMP_FUNC(rd)
-    SET_CMP_FUNC(bit)
-    c->vsad[0]= vsad16_c;
-    c->vsad[4]= vsad_intra16_c;
-    c->vsad[5]= vsad_intra8_c;
-    c->vsse[0]= vsse16_c;
-    c->vsse[4]= vsse_intra16_c;
-    c->vsse[5]= vsse_intra8_c;
-    c->nsse[0]= nsse16_c;
-    c->nsse[1]= nsse8_c;
-#if CONFIG_DWT
-    ff_dsputil_init_dwt(c);
-#endif
-
-    c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
-
-    c->add_bytes= add_bytes_c;
-    c->add_bytes_l2= add_bytes_l2_c;
-    c->diff_bytes= diff_bytes_c;
-    c->add_hfyu_median_prediction= add_hfyu_median_prediction_c;
-    c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
-    c->add_hfyu_left_prediction  = add_hfyu_left_prediction_c;
-    c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c;
-    c->bswap_buf= bswap_buf;
-#if CONFIG_PNG_DECODER
-    c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
-#endif
-
-    if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
-        c->h263_h_loop_filter= h263_h_loop_filter_c;
-        c->h263_v_loop_filter= h263_v_loop_filter_c;
-    }
-
-    if (CONFIG_VP3_DECODER) {
-        c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;
-        c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;
-        c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c;
-    }
-    if (CONFIG_VP6_DECODER) {
-        c->vp6_filter_diag4= ff_vp6_filter_diag4_c;
-    }
-
-    c->h261_loop_filter= h261_loop_filter_c;
-
-    c->try_8x8basis= try_8x8basis_c;
-    c->add_8x8basis= add_8x8basis_c;
-
-#if CONFIG_VORBIS_DECODER
-    c->vorbis_inverse_coupling = vorbis_inverse_coupling;
-#endif
-#if CONFIG_AC3_DECODER
-    c->ac3_downmix = ff_ac3_downmix_c;
-#endif
-#if CONFIG_LPC
-    c->lpc_compute_autocorr = ff_lpc_compute_autocorr;
-#endif
-    c->vector_fmul = vector_fmul_c;
-    c->vector_fmul_reverse = vector_fmul_reverse_c;
-    c->vector_fmul_add = vector_fmul_add_c;
-    c->vector_fmul_window = ff_vector_fmul_window_c;
-    c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
-    c->vector_clipf = vector_clipf_c;
-    c->float_to_int16 = ff_float_to_int16_c;
-    c->float_to_int16_interleave = ff_float_to_int16_interleave_c;
-    c->scalarproduct_int16 = scalarproduct_int16_c;
-    c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
-    c->scalarproduct_float = scalarproduct_float_c;
-    c->butterflies_float = butterflies_float_c;
-    c->vector_fmul_scalar = vector_fmul_scalar_c;
-
-    c->vector_fmul_sv_scalar[0] = vector_fmul_sv_scalar_2_c;
-    c->vector_fmul_sv_scalar[1] = vector_fmul_sv_scalar_4_c;
-
-    c->sv_fmul_scalar[0] = sv_fmul_scalar_2_c;
-    c->sv_fmul_scalar[1] = sv_fmul_scalar_4_c;
-
-    c->shrink[0]= ff_img_copy_plane;
-    c->shrink[1]= ff_shrink22;
-    c->shrink[2]= ff_shrink44;
-    c->shrink[3]= ff_shrink88;
-
-    c->prefetch= just_return;
-
-    memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
-    memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));
-
-    if (HAVE_MMX)        dsputil_init_mmx   (c, avctx);
-    if (ARCH_ARM)        dsputil_init_arm   (c, avctx);
-    if (CONFIG_MLIB)     dsputil_init_mlib  (c, avctx);
-    if (HAVE_VIS)        dsputil_init_vis   (c, avctx);
-    if (ARCH_ALPHA)      dsputil_init_alpha (c, avctx);
-    if (ARCH_PPC)        dsputil_init_ppc   (c, avctx);
-    if (HAVE_MMI)        dsputil_init_mmi   (c, avctx);
-    if (ARCH_SH4)        dsputil_init_sh4   (c, avctx);
-    if (ARCH_BFIN)       dsputil_init_bfin  (c, avctx);
-
-    for(i=0; i<64; i++){
-        if(!c->put_2tap_qpel_pixels_tab[0][i])
-            c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
-        if(!c->avg_2tap_qpel_pixels_tab[0][i])
-            c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
-    }
-
-    switch(c->idct_permutation_type){
-    case FF_NO_IDCT_PERM:
-        for(i=0; i<64; i++)
-            c->idct_permutation[i]= i;
-        break;
-    case FF_LIBMPEG2_IDCT_PERM:
-        for(i=0; i<64; i++)
-            c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
-        break;
-    case FF_SIMPLE_IDCT_PERM:
-        for(i=0; i<64; i++)
-            c->idct_permutation[i]= simple_mmx_permutation[i];
-        break;
-    case FF_TRANSPOSE_IDCT_PERM:
-        for(i=0; i<64; i++)
-            c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
-        break;
-    case FF_PARTTRANS_IDCT_PERM:
-        for(i=0; i<64; i++)
-            c->idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3);
-        break;
-    case FF_SSE2_IDCT_PERM:
-        for(i=0; i<64; i++)
-            c->idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7];
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
-    }
-}
-
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
deleted file mode 100644
index fd2d07f..0000000
--- a/libavcodec/dsputil.h
+++ /dev/null
@@ -1,810 +0,0 @@
-/*
- * DSP utils
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DSP utils.
- * note, many functions in here may use MMX which trashes the FPU state, it is
- * absolutely necessary to call emms_c() between dsp & float/double code
- */
-
-#ifndef AVCODEC_DSPUTIL_H
-#define AVCODEC_DSPUTIL_H
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-
-//#define DEBUG
-/* dct code */
-typedef short DCTELEM;
-
-void fdct_ifast (DCTELEM *data);
-void fdct_ifast248 (DCTELEM *data);
-void ff_jpeg_fdct_islow (DCTELEM *data);
-void ff_fdct248_islow (DCTELEM *data);
-
-void j_rev_dct (DCTELEM *data);
-void j_rev_dct4 (DCTELEM *data);
-void j_rev_dct2 (DCTELEM *data);
-void j_rev_dct1 (DCTELEM *data);
-void ff_wmv2_idct_c(DCTELEM *data);
-
-void ff_fdct_mmx(DCTELEM *block);
-void ff_fdct_mmx2(DCTELEM *block);
-void ff_fdct_sse2(DCTELEM *block);
-
-void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride);
-void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride);
-void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
-void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride);
-void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block);
-void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block);
-void ff_h264_idct_add16_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
-void ff_h264_idct_add16intra_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
-void ff_h264_idct8_add4_c(uint8_t *dst, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
-void ff_h264_idct_add8_c(uint8_t **dest, const int *blockoffset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]);
-
-void ff_vector_fmul_window_c(float *dst, const float *src0, const float *src1,
-                             const float *win, float add_bias, int len);
-void ff_float_to_int16_c(int16_t *dst, const float *src, long len);
-void ff_float_to_int16_interleave_c(int16_t *dst, const float **src, long len, int channels);
-
-/* encoding scans */
-extern const uint8_t ff_alternate_horizontal_scan[64];
-extern const uint8_t ff_alternate_vertical_scan[64];
-extern const uint8_t ff_zigzag_direct[64];
-extern const uint8_t ff_zigzag248_direct[64];
-
-/* pixel operations */
-#define MAX_NEG_CROP 1024
-
-/* temporary */
-extern uint32_t ff_squareTbl[512];
-extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
-
-/* VP3 DSP functions */
-void ff_vp3_idct_c(DCTELEM *block/* align 16*/);
-void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
-void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
-void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/);
-
-void ff_vp3_v_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
-void ff_vp3_h_loop_filter_c(uint8_t *src, int stride, int *bounding_values);
-
-/* VP6 DSP functions */
-void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
-                           const int16_t *h_weights, const int16_t *v_weights);
-
-/* Bink functions */
-void ff_bink_idct_c    (DCTELEM *block);
-void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block);
-void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
-
-/* CAVS functions */
-void ff_put_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
-void ff_avg_cavs_qpel8_mc00_c(uint8_t *dst, uint8_t *src, int stride);
-void ff_put_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
-void ff_avg_cavs_qpel16_mc00_c(uint8_t *dst, uint8_t *src, int stride);
-
-/* VC1 functions */
-void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd);
-void ff_avg_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd);
-
-/* EA functions */
-void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
-
-/* 1/2^n downscaling functions from imgconvert.c */
-void ff_img_copy_plane(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
-void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
-void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
-void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
-
-void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
-              int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
-
-/* minimum alignment rules ;)
-If you notice errors in the align stuff, need more alignment for some ASM code
-for some CPU or need to use a function with less aligned data then send a mail
-to the ffmpeg-devel mailing list, ...
-
-!warning These alignments might not match reality, (missing attribute((align))
-stuff somewhere possible).
-I (Michael) did not check them, these are just the alignments which I think
-could be reached easily ...
-
-!future video codecs might need functions with less strict alignment
-*/
-
-/*
-void get_pixels_c(DCTELEM *block, const uint8_t *pixels, int line_size);
-void diff_pixels_c(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride);
-void put_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
-void add_pixels_clamped_c(const DCTELEM *block, uint8_t *pixels, int line_size);
-void clear_blocks_c(DCTELEM *blocks);
-*/
-
-/* add and put pixel (decoding) */
-// blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
-//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller then 4
-typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h);
-typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int w, int h);
-typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
-typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
-
-typedef void (*op_fill_func)(uint8_t *block/*align width (8 or 16)*/, uint8_t value, int line_size, int h);
-
-#define DEF_OLD_QPEL(name)\
-void ff_put_        ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
-void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);\
-void ff_avg_        ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
-
-DEF_OLD_QPEL(qpel16_mc11_old_c)
-DEF_OLD_QPEL(qpel16_mc31_old_c)
-DEF_OLD_QPEL(qpel16_mc12_old_c)
-DEF_OLD_QPEL(qpel16_mc32_old_c)
-DEF_OLD_QPEL(qpel16_mc13_old_c)
-DEF_OLD_QPEL(qpel16_mc33_old_c)
-DEF_OLD_QPEL(qpel8_mc11_old_c)
-DEF_OLD_QPEL(qpel8_mc31_old_c)
-DEF_OLD_QPEL(qpel8_mc12_old_c)
-DEF_OLD_QPEL(qpel8_mc32_old_c)
-DEF_OLD_QPEL(qpel8_mc13_old_c)
-DEF_OLD_QPEL(qpel8_mc33_old_c)
-
-#define CALL_2X_PIXELS(a, b, n)\
-static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
-    b(block  , pixels  , line_size, h);\
-    b(block+n, pixels+n, line_size, h);\
-}
-
-/* motion estimation */
-// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller then 2
-// although currently h<4 is not used as functions with width <8 are neither used nor implemented
-typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size, int h)/* __attribute__ ((const))*/;
-
-/**
- * Scantable.
- */
-typedef struct ScanTable{
-    const uint8_t *scantable;
-    uint8_t permutated[64];
-    uint8_t raster_end[64];
-#if ARCH_PPC
-                /** Used by dct_quantize_altivec to find last-non-zero */
-    DECLARE_ALIGNED(16, uint8_t, inverse)[64];
-#endif
-} ScanTable;
-
-void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable);
-
-void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize,
-                         int block_w, int block_h,
-                         int src_x, int src_y, int w, int h);
-
-/**
- * DSPContext.
- */
-typedef struct DSPContext {
-    /* pixel ops : interface with DCT */
-    void (*get_pixels)(DCTELEM *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size);
-    void (*diff_pixels)(DCTELEM *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride);
-    void (*put_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
-    void (*put_signed_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
-    void (*put_pixels_nonclamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
-    void (*add_pixels_clamped)(const DCTELEM *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size);
-    void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size);
-    void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size);
-    int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/);
-    /**
-     * translational global motion compensation.
-     */
-    void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder);
-    /**
-     * global motion compensation.
-     */
-    void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy,
-                    int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
-    void (*clear_block)(DCTELEM *block/*align 16*/);
-    void (*clear_blocks)(DCTELEM *blocks/*align 16*/);
-    int (*pix_sum)(uint8_t * pix, int line_size);
-    int (*pix_norm1)(uint8_t * pix, int line_size);
-// 16x16 8x8 4x4 2x2 16x8 8x4 4x2 8x16 4x8 2x4
-
-    me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */
-    me_cmp_func sse[6];
-    me_cmp_func hadamard8_diff[6];
-    me_cmp_func dct_sad[6];
-    me_cmp_func quant_psnr[6];
-    me_cmp_func bit[6];
-    me_cmp_func rd[6];
-    me_cmp_func vsad[6];
-    me_cmp_func vsse[6];
-    me_cmp_func nsse[6];
-    me_cmp_func w53[6];
-    me_cmp_func w97[6];
-    me_cmp_func dct_max[6];
-    me_cmp_func dct264_sad[6];
-
-    me_cmp_func me_pre_cmp[6];
-    me_cmp_func me_cmp[6];
-    me_cmp_func me_sub_cmp[6];
-    me_cmp_func mb_cmp[6];
-    me_cmp_func ildct_cmp[6]; //only width 16 used
-    me_cmp_func frame_skip_cmp[6]; //only width 8 used
-
-    int (*ssd_int8_vs_int16)(const int8_t *pix1, const int16_t *pix2,
-                             int size);
-
-    /**
-     * Halfpel motion compensation with rounding (a+b+1)>>1.
-     * this is an array[4][4] of motion compensation functions for 4
-     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
-     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
-     * @param block destination where the result is stored
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-     */
-    op_pixels_func put_pixels_tab[4][4];
-
-    /**
-     * Halfpel motion compensation with rounding (a+b+1)>>1.
-     * This is an array[4][4] of motion compensation functions for 4
-     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
-     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
-     * @param block destination into which the result is averaged (a+b+1)>>1
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-     */
-    op_pixels_func avg_pixels_tab[4][4];
-
-    /**
-     * Halfpel motion compensation with no rounding (a+b)>>1.
-     * this is an array[2][4] of motion compensation functions for 2
-     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
-     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
-     * @param block destination where the result is stored
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-     */
-    op_pixels_func put_no_rnd_pixels_tab[4][4];
-
-    /**
-     * Halfpel motion compensation with no rounding (a+b)>>1.
-     * this is an array[2][4] of motion compensation functions for 2
-     * horizontal blocksizes (8,16) and the 4 halfpel positions<br>
-     * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
-     * @param block destination into which the result is averaged (a+b)>>1
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-     */
-    op_pixels_func avg_no_rnd_pixels_tab[4][4];
-
-    void (*put_no_rnd_pixels_l2[2])(uint8_t *block/*align width (8 or 16)*/, const uint8_t *a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h);
-
-    /**
-     * Thirdpel motion compensation with rounding (a+b+1)>>1.
-     * this is an array[12] of motion compensation functions for the 9 thirdpe
-     * positions<br>
-     * *pixels_tab[ xthirdpel + 4*ythirdpel ]
-     * @param block destination where the result is stored
-     * @param pixels source
-     * @param line_size number of bytes in a horizontal line of block
-     * @param h height
-     */
-    tpel_mc_func put_tpel_pixels_tab[11]; //FIXME individual func ptr per width?
-    tpel_mc_func avg_tpel_pixels_tab[11]; //FIXME individual func ptr per width?
-
-    qpel_mc_func put_qpel_pixels_tab[2][16];
-    qpel_mc_func avg_qpel_pixels_tab[2][16];
-    qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
-    qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
-    qpel_mc_func put_mspel_pixels_tab[8];
-
-    /**
-     * h264 Chroma MC
-     */
-    h264_chroma_mc_func put_h264_chroma_pixels_tab[3];
-    h264_chroma_mc_func avg_h264_chroma_pixels_tab[3];
-    /* This is really one func used in VC-1 decoding */
-    h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3];
-    h264_chroma_mc_func avg_no_rnd_vc1_chroma_pixels_tab[3];
-
-    qpel_mc_func put_h264_qpel_pixels_tab[4][16];
-    qpel_mc_func avg_h264_qpel_pixels_tab[4][16];
-
-    qpel_mc_func put_2tap_qpel_pixels_tab[4][16];
-    qpel_mc_func avg_2tap_qpel_pixels_tab[4][16];
-
-    /* AVS specific */
-    qpel_mc_func put_cavs_qpel_pixels_tab[2][16];
-    qpel_mc_func avg_cavs_qpel_pixels_tab[2][16];
-    void (*cavs_filter_lv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
-    void (*cavs_filter_lh)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
-    void (*cavs_filter_cv)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
-    void (*cavs_filter_ch)(uint8_t *pix, int stride, int alpha, int beta, int tc, int bs1, int bs2);
-    void (*cavs_idct8_add)(uint8_t *dst, DCTELEM *block, int stride);
-
-    me_cmp_func pix_abs[2][4];
-
-    /* huffyuv specific */
-    void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w);
-    void (*add_bytes_l2)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 16*/, int w);
-    void (*diff_bytes)(uint8_t *dst/*align 16*/, uint8_t *src1/*align 16*/, uint8_t *src2/*align 1*/,int w);
-    /**
-     * subtract huffyuv's variant of median prediction
-     * note, this might read from src1[-1], src2[-1]
-     */
-    void (*sub_hfyu_median_prediction)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top);
-    void (*add_hfyu_median_prediction)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
-    int  (*add_hfyu_left_prediction)(uint8_t *dst, const uint8_t *src, int w, int left);
-    void (*add_hfyu_left_prediction_bgr32)(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha);
-    /* this might write to dst[w] */
-    void (*add_png_paeth_prediction)(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp);
-    void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
-
-    void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
-    void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
-
-    void (*h261_loop_filter)(uint8_t *src, int stride);
-
-    void (*x8_v_loop_filter)(uint8_t *src, int stride, int qscale);
-    void (*x8_h_loop_filter)(uint8_t *src, int stride, int qscale);
-
-    void (*vp3_idct_dc_add)(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/);
-    void (*vp3_v_loop_filter)(uint8_t *src, int stride, int *bounding_values);
-    void (*vp3_h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
-
-    void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride,
-                             const int16_t *h_weights,const int16_t *v_weights);
-
-    /* assume len is a multiple of 4, and arrays are 16-byte aligned */
-    void (*vorbis_inverse_coupling)(float *mag, float *ang, int blocksize);
-    void (*ac3_downmix)(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len);
-    /* no alignment needed */
-    void (*lpc_compute_autocorr)(const int32_t *data, int len, int lag, double *autoc);
-    /* assume len is a multiple of 8, and arrays are 16-byte aligned */
-    void (*vector_fmul)(float *dst, const float *src, int len);
-    void (*vector_fmul_reverse)(float *dst, const float *src0, const float *src1, int len);
-    /* assume len is a multiple of 8, and src arrays are 16-byte aligned */
-    void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, const float *src2, int len);
-    /* assume len is a multiple of 4, and arrays are 16-byte aligned */
-    void (*vector_fmul_window)(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len);
-    /* assume len is a multiple of 8, and arrays are 16-byte aligned */
-    void (*int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len);
-    void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
-    /**
-     * Multiply a vector of floats by a scalar float.  Source and
-     * destination vectors must overlap exactly or not at all.
-     * @param dst result vector, 16-byte aligned
-     * @param src input vector, 16-byte aligned
-     * @param mul scalar value
-     * @param len length of vector, multiple of 4
-     */
-    void (*vector_fmul_scalar)(float *dst, const float *src, float mul,
-                               int len);
-    /**
-     * Multiply a vector of floats by concatenated short vectors of
-     * floats and by a scalar float.  Source and destination vectors
-     * must overlap exactly or not at all.
-     * [0]: short vectors of length 2, 8-byte aligned
-     * [1]: short vectors of length 4, 16-byte aligned
-     * @param dst output vector, 16-byte aligned
-     * @param src input vector, 16-byte aligned
-     * @param sv  array of pointers to short vectors
-     * @param mul scalar value
-     * @param len number of elements in src and dst, multiple of 4
-     */
-    void (*vector_fmul_sv_scalar[2])(float *dst, const float *src,
-                                     const float **sv, float mul, int len);
-    /**
-     * Multiply short vectors of floats by a scalar float, store
-     * concatenated result.
-     * [0]: short vectors of length 2, 8-byte aligned
-     * [1]: short vectors of length 4, 16-byte aligned
-     * @param dst output vector, 16-byte aligned
-     * @param sv  array of pointers to short vectors
-     * @param mul scalar value
-     * @param len number of output elements, multiple of 4
-     */
-    void (*sv_fmul_scalar[2])(float *dst, const float **sv,
-                              float mul, int len);
-    /**
-     * Calculate the scalar product of two vectors of floats.
-     * @param v1  first vector, 16-byte aligned
-     * @param v2  second vector, 16-byte aligned
-     * @param len length of vectors, multiple of 4
-     */
-    float (*scalarproduct_float)(const float *v1, const float *v2, int len);
-    /**
-     * Calculate the sum and difference of two vectors of floats.
-     * @param v1  first input vector, sum output, 16-byte aligned
-     * @param v2  second input vector, difference output, 16-byte aligned
-     * @param len length of vectors, multiple of 4
-     */
-    void (*butterflies_float)(float *restrict v1, float *restrict v2, int len);
-
-    /* C version: convert floats from the range [384.0,386.0] to ints in [-32768,32767]
-     * simd versions: convert floats from [-32768.0,32767.0] without rescaling and arrays are 16byte aligned */
-    void (*float_to_int16)(int16_t *dst, const float *src, long len);
-    void (*float_to_int16_interleave)(int16_t *dst, const float **src, long len, int channels);
-
-    /* (I)DCT */
-    void (*fdct)(DCTELEM *block/* align 16*/);
-    void (*fdct248)(DCTELEM *block/* align 16*/);
-
-    /* IDCT really*/
-    void (*idct)(DCTELEM *block/* align 16*/);
-
-    /**
-     * block -> idct -> clip to unsigned 8 bit -> dest.
-     * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...)
-     * @param line_size size in bytes of a horizontal line of dest
-     */
-    void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
-
-    /**
-     * block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
-     * @param line_size size in bytes of a horizontal line of dest
-     */
-    void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
-
-    /**
-     * idct input permutation.
-     * several optimized IDCTs need a permutated input (relative to the normal order of the reference
-     * IDCT)
-     * this permutation must be performed before the idct_put/add, note, normally this can be merged
-     * with the zigzag/alternate scan<br>
-     * an example to avoid confusion:
-     * - (->decode coeffs -> zigzag reorder -> dequant -> reference idct ->...)
-     * - (x -> referece dct -> reference idct -> x)
-     * - (x -> referece dct -> simple_mmx_perm = idct_permutation -> simple_idct_mmx -> x)
-     * - (->decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant -> simple_idct_mmx ->...)
-     */
-    uint8_t idct_permutation[64];
-    int idct_permutation_type;
-#define FF_NO_IDCT_PERM 1
-#define FF_LIBMPEG2_IDCT_PERM 2
-#define FF_SIMPLE_IDCT_PERM 3
-#define FF_TRANSPOSE_IDCT_PERM 4
-#define FF_PARTTRANS_IDCT_PERM 5
-#define FF_SSE2_IDCT_PERM 6
-
-    int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale);
-    void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale);
-#define BASIS_SHIFT 16
-#define RECON_SHIFT 6
-
-    void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w);
-#define EDGE_WIDTH 16
-
-    void (*prefetch)(void *mem, int stride, int h);
-
-    void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height);
-
-    /* mlp/truehd functions */
-    void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff,
-                               int firorder, int iirorder,
-                               unsigned int filter_shift, int32_t mask, int blocksize,
-                               int32_t *sample_buffer);
-
-    /* vc1 functions */
-    void (*vc1_inv_trans_8x8)(DCTELEM *b);
-    void (*vc1_inv_trans_8x4)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x8)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x4)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_8x8_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_8x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x8_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_inv_trans_4x4_dc)(uint8_t *dest, int line_size, DCTELEM *block);
-    void (*vc1_v_overlap)(uint8_t* src, int stride);
-    void (*vc1_h_overlap)(uint8_t* src, int stride);
-    void (*vc1_v_loop_filter4)(uint8_t *src, int stride, int pq);
-    void (*vc1_h_loop_filter4)(uint8_t *src, int stride, int pq);
-    void (*vc1_v_loop_filter8)(uint8_t *src, int stride, int pq);
-    void (*vc1_h_loop_filter8)(uint8_t *src, int stride, int pq);
-    void (*vc1_v_loop_filter16)(uint8_t *src, int stride, int pq);
-    void (*vc1_h_loop_filter16)(uint8_t *src, int stride, int pq);
-    /* put 8x8 block with bicubic interpolation and quarterpel precision
-     * last argument is actually round value instead of height
-     */
-    op_pixels_func put_vc1_mspel_pixels_tab[16];
-    op_pixels_func avg_vc1_mspel_pixels_tab[16];
-
-    /* intrax8 functions */
-    void (*x8_spatial_compensation[12])(uint8_t *src , uint8_t *dst, int linesize);
-    void (*x8_setup_spatial_compensation)(uint8_t *src, uint8_t *dst, int linesize,
-           int * range, int * sum,  int edges);
-
-    /**
-     * Calculate scalar product of two vectors.
-     * @param len length of vectors, should be multiple of 16
-     * @param shift number of bits to discard from product
-     */
-    int32_t (*scalarproduct_int16)(int16_t *v1, int16_t *v2/*align 16*/, int len, int shift);
-    /* ape functions */
-    /**
-     * Calculate scalar product of v1 and v2,
-     * and v1[i] += v3[i] * mul
-     * @param len length of vectors, should be multiple of 16
-     */
-    int32_t (*scalarproduct_and_madd_int16)(int16_t *v1/*align 16*/, int16_t *v2, int16_t *v3, int len, int mul);
-
-    /* rv30 functions */
-    qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
-    qpel_mc_func avg_rv30_tpel_pixels_tab[4][16];
-
-    /* rv40 functions */
-    qpel_mc_func put_rv40_qpel_pixels_tab[4][16];
-    qpel_mc_func avg_rv40_qpel_pixels_tab[4][16];
-    h264_chroma_mc_func put_rv40_chroma_pixels_tab[3];
-    h264_chroma_mc_func avg_rv40_chroma_pixels_tab[3];
-
-    /* bink functions */
-    op_fill_func fill_block_tab[2];
-    void (*scale_block)(const uint8_t src[64]/*align 8*/, uint8_t *dst/*align 8*/, int linesize);
-} DSPContext;
-
-void dsputil_static_init(void);
-void dsputil_init(DSPContext* p, AVCodecContext *avctx);
-
-int ff_check_alignment(void);
-
-/**
- * permute block according to permuatation.
- * @param last last non zero element in scantable order
- */
-void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last);
-
-void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
-
-#define         BYTE_VEC32(c)   ((c)*0x01010101UL)
-
-static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
-{
-    return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
-}
-
-static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
-{
-    return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
-}
-
-static inline int get_penalty_factor(int lambda, int lambda2, int type){
-    switch(type&0xFF){
-    default:
-    case FF_CMP_SAD:
-        return lambda>>FF_LAMBDA_SHIFT;
-    case FF_CMP_DCT:
-        return (3*lambda)>>(FF_LAMBDA_SHIFT+1);
-    case FF_CMP_W53:
-        return (4*lambda)>>(FF_LAMBDA_SHIFT);
-    case FF_CMP_W97:
-        return (2*lambda)>>(FF_LAMBDA_SHIFT);
-    case FF_CMP_SATD:
-    case FF_CMP_DCT264:
-        return (2*lambda)>>FF_LAMBDA_SHIFT;
-    case FF_CMP_RD:
-    case FF_CMP_PSNR:
-    case FF_CMP_SSE:
-    case FF_CMP_NSSE:
-        return lambda2>>FF_LAMBDA_SHIFT;
-    case FF_CMP_BIT:
-        return 1;
-    }
-}
-
-/**
- * Empty mmx state.
- * this must be called between any dsp function and float/double code.
- * for example sin(); dsp->idct_put(); emms_c(); cos()
- */
-#define emms_c()
-
-/* should be defined by architectures supporting
-   one or more MultiMedia extension */
-int mm_support(void);
-extern int mm_flags;
-
-void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
-
-void ff_dsputil_init_dwt(DSPContext *c);
-void ff_cavsdsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_vc1dsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_intrax8dsp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
-void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
-
-#if HAVE_MMX
-
-#undef emms_c
-
-static inline void emms(void)
-{
-    __asm__ volatile ("emms;":::"memory");
-}
-
-
-#define emms_c() \
-{\
-    if (mm_flags & FF_MM_MMX)\
-        emms();\
-}
-
-#elif ARCH_ARM
-
-#if HAVE_NEON
-#   define STRIDE_ALIGN 16
-#endif
-
-#elif ARCH_PPC
-
-#define STRIDE_ALIGN 16
-
-#elif HAVE_MMI
-
-#define STRIDE_ALIGN 16
-
-#else
-
-#define mm_flags 0
-#define mm_support() 0
-
-#endif
-
-#ifndef STRIDE_ALIGN
-#   define STRIDE_ALIGN 8
-#endif
-
-#define LOCAL_ALIGNED(a, t, v, s, ...)                          \
-    uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)];              \
-    t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a)
-
-#if HAVE_LOCAL_ALIGNED_8
-#   define LOCAL_ALIGNED_8(t, v, s, ...) DECLARE_ALIGNED(8, t, v) s __VA_ARGS__
-#else
-#   define LOCAL_ALIGNED_8(t, v, s, ...) LOCAL_ALIGNED(8, t, v, s, __VA_ARGS__)
-#endif
-
-#if HAVE_LOCAL_ALIGNED_16
-#   define LOCAL_ALIGNED_16(t, v, s, ...) DECLARE_ALIGNED(16, t, v) s __VA_ARGS__
-#else
-#   define LOCAL_ALIGNED_16(t, v, s, ...) LOCAL_ALIGNED(16, t, v, s, __VA_ARGS__)
-#endif
-
-/* PSNR */
-void get_psnr(uint8_t *orig_image[3], uint8_t *coded_image[3],
-              int orig_linesize[3], int coded_linesize,
-              AVCodecContext *avctx);
-
-#define WRAPPER8_16(name8, name16)\
-static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
-    return name8(s, dst           , src           , stride, h)\
-          +name8(s, dst+8         , src+8         , stride, h);\
-}
-
-#define WRAPPER8_16_SQ(name8, name16)\
-static int name16(void /*MpegEncContext*/ *s, uint8_t *dst, uint8_t *src, int stride, int h){\
-    int score=0;\
-    score +=name8(s, dst           , src           , stride, 8);\
-    score +=name8(s, dst+8         , src+8         , stride, 8);\
-    if(h==16){\
-        dst += 8*stride;\
-        src += 8*stride;\
-        score +=name8(s, dst           , src           , stride, 8);\
-        score +=name8(s, dst+8         , src+8         , stride, 8);\
-    }\
-    return score;\
-}
-
-
-static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
-{
-    int i;
-    for(i=0; i<h; i++)
-    {
-        AV_WN16(dst   , AV_RN16(src   ));
-        dst+=dstStride;
-        src+=srcStride;
-    }
-}
-
-static inline void copy_block4(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
-{
-    int i;
-    for(i=0; i<h; i++)
-    {
-        AV_WN32(dst   , AV_RN32(src   ));
-        dst+=dstStride;
-        src+=srcStride;
-    }
-}
-
-static inline void copy_block8(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
-{
-    int i;
-    for(i=0; i<h; i++)
-    {
-        AV_WN32(dst   , AV_RN32(src   ));
-        AV_WN32(dst+4 , AV_RN32(src+4 ));
-        dst+=dstStride;
-        src+=srcStride;
-    }
-}
-
-static inline void copy_block9(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
-{
-    int i;
-    for(i=0; i<h; i++)
-    {
-        AV_WN32(dst   , AV_RN32(src   ));
-        AV_WN32(dst+4 , AV_RN32(src+4 ));
-        dst[8]= src[8];
-        dst+=dstStride;
-        src+=srcStride;
-    }
-}
-
-static inline void copy_block16(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
-{
-    int i;
-    for(i=0; i<h; i++)
-    {
-        AV_WN32(dst   , AV_RN32(src   ));
-        AV_WN32(dst+4 , AV_RN32(src+4 ));
-        AV_WN32(dst+8 , AV_RN32(src+8 ));
-        AV_WN32(dst+12, AV_RN32(src+12));
-        dst+=dstStride;
-        src+=srcStride;
-    }
-}
-
-static inline void copy_block17(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
-{
-    int i;
-    for(i=0; i<h; i++)
-    {
-        AV_WN32(dst   , AV_RN32(src   ));
-        AV_WN32(dst+4 , AV_RN32(src+4 ));
-        AV_WN32(dst+8 , AV_RN32(src+8 ));
-        AV_WN32(dst+12, AV_RN32(src+12));
-        dst[16]= src[16];
-        dst+=dstStride;
-        src+=srcStride;
-    }
-}
-
-#endif /* AVCODEC_DSPUTIL_H */
diff --git a/libavcodec/dump_extradata_bsf.c b/libavcodec/dump_extradata_bsf.c
deleted file mode 100644
index db26349..0000000
--- a/libavcodec/dump_extradata_bsf.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-
-
-static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    int cmd= args ? *args : 0;
-    /* cast to avoid warning about discarding qualifiers */
-    if(avctx->extradata){
-        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
-           ||(keyframe && (cmd=='k' || !cmd))
-           ||(cmd=='e')
-            /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
-            int size= buf_size + avctx->extradata_size;
-            *poutbuf_size= size;
-            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
-            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-            return 1;
-        }
-    }
-    return 0;
-}
-
-AVBitStreamFilter dump_extradata_bsf={
-    "dump_extra",
-    0,
-    dump_extradata,
-};
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
deleted file mode 100644
index ea1f661..0000000
--- a/libavcodec/dv.c
+++ /dev/null
@@ -1,1309 +0,0 @@
-/*
- * DV decoder
- * Copyright (c) 2002 Fabrice Bellard
- * Copyright (c) 2004 Roman Shaposhnik
- *
- * DV encoder
- * Copyright (c) 2003 Roman Shaposhnik
- *
- * 50 Mbps (DVCPRO50) support
- * Copyright (c) 2006 Daniel Maas <dmaas at maasdigital.com>
- *
- * 100 Mbps (DVCPRO HD) support
- * Initial code by Daniel Maas <dmaas at maasdigital.com> (funded by BBC R&D)
- * Final code by Roman Shaposhnik
- *
- * Many thanks to Dan Dennedy <dan at dennedy.org> for providing wealth
- * of DV technical info.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DV codec.
- */
-#define ALT_BITSTREAM_READER
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "simple_idct.h"
-#include "dvdata.h"
-#include "dv_tablegen.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-typedef struct DVVideoContext {
-    const DVprofile *sys;
-    AVFrame          picture;
-    AVCodecContext  *avctx;
-    uint8_t         *buf;
-
-    uint8_t  dv_zigzag[2][64];
-
-    void (*get_pixels)(DCTELEM *block, const uint8_t *pixels, int line_size);
-    void (*fdct[2])(DCTELEM *block);
-    void (*idct_put[2])(uint8_t *dest, int line_size, DCTELEM *block);
-    me_cmp_func ildct_cmp;
-} DVVideoContext;
-
-#define TEX_VLC_BITS 9
-
-/* XXX: also include quantization */
-static RL_VLC_ELEM dv_rl_vlc[1184];
-
-static inline int dv_work_pool_size(const DVprofile *d)
-{
-    int size = d->n_difchan*d->difseg_size*27;
-    if (DV_PROFILE_IS_1080i50(d))
-        size -= 3*27;
-    if (DV_PROFILE_IS_720p50(d))
-        size -= 4*27;
-    return size;
-}
-
-static inline void dv_calc_mb_coordinates(const DVprofile *d, int chan, int seq, int slot,
-                                          uint16_t *tbl)
-{
-    static const uint8_t off[] = { 2, 6, 8, 0, 4 };
-    static const uint8_t shuf1[] = { 36, 18, 54, 0, 72 };
-    static const uint8_t shuf2[] = { 24, 12, 36, 0, 48 };
-    static const uint8_t shuf3[] = { 18, 9, 27, 0, 36 };
-
-    static const uint8_t l_start[] = {0, 4, 9, 13, 18, 22, 27, 31, 36, 40};
-    static const uint8_t l_start_shuffled[] = { 9, 4, 13, 0, 18 };
-
-    static const uint8_t serpent1[] = {0, 1, 2, 2, 1, 0,
-                                       0, 1, 2, 2, 1, 0,
-                                       0, 1, 2, 2, 1, 0,
-                                       0, 1, 2, 2, 1, 0,
-                                       0, 1, 2};
-    static const uint8_t serpent2[] = {0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0,
-                                       0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0,
-                                       0, 1, 2, 3, 4, 5};
-
-    static const uint8_t remap[][2] = {{ 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, /* dummy */
-                                       { 0, 0}, { 0, 1}, { 0, 2}, { 0, 3}, {10, 0},
-                                       {10, 1}, {10, 2}, {10, 3}, {20, 0}, {20, 1},
-                                       {20, 2}, {20, 3}, {30, 0}, {30, 1}, {30, 2},
-                                       {30, 3}, {40, 0}, {40, 1}, {40, 2}, {40, 3},
-                                       {50, 0}, {50, 1}, {50, 2}, {50, 3}, {60, 0},
-                                       {60, 1}, {60, 2}, {60, 3}, {70, 0}, {70, 1},
-                                       {70, 2}, {70, 3}, { 0,64}, { 0,65}, { 0,66},
-                                       {10,64}, {10,65}, {10,66}, {20,64}, {20,65},
-                                       {20,66}, {30,64}, {30,65}, {30,66}, {40,64},
-                                       {40,65}, {40,66}, {50,64}, {50,65}, {50,66},
-                                       {60,64}, {60,65}, {60,66}, {70,64}, {70,65},
-                                       {70,66}, { 0,67}, {20,67}, {40,67}, {60,67}};
-
-    int i, k, m;
-    int x, y, blk;
-
-    for (m=0; m<5; m++) {
-         switch (d->width) {
-         case 1440:
-              blk = (chan*11+seq)*27+slot;
-
-              if (chan == 0 && seq == 11) {
-                  x = m*27+slot;
-                  if (x<90) {
-                      y = 0;
-                  } else {
-                      x = (x - 90)*2;
-                      y = 67;
-                  }
-              } else {
-                  i = (4*chan + blk + off[m])%11;
-                  k = (blk/11)%27;
-
-                  x = shuf1[m] + (chan&1)*9 + k%9;
-                  y = (i*3+k/9)*2 + (chan>>1) + 1;
-              }
-              tbl[m] = (x<<1)|(y<<9);
-              break;
-         case 1280:
-              blk = (chan*10+seq)*27+slot;
-
-              i = (4*chan + (seq/5) + 2*blk + off[m])%10;
-              k = (blk/5)%27;
-
-              x = shuf1[m]+(chan&1)*9 + k%9;
-              y = (i*3+k/9)*2 + (chan>>1) + 4;
-
-              if (x >= 80) {
-                  x = remap[y][0]+((x-80)<<(y>59));
-                  y = remap[y][1];
-              }
-              tbl[m] = (x<<1)|(y<<9);
-              break;
-       case 960:
-              blk = (chan*10+seq)*27+slot;
-
-              i = (4*chan + (seq/5) + 2*blk + off[m])%10;
-              k = (blk/5)%27 + (i&1)*3;
-
-              x = shuf2[m] + k%6 + 6*(chan&1);
-              y = l_start[i] + k/6 + 45*(chan>>1);
-              tbl[m] = (x<<1)|(y<<9);
-              break;
-        case 720:
-              switch (d->pix_fmt) {
-              case PIX_FMT_YUV422P:
-                   x = shuf3[m] + slot/3;
-                   y = serpent1[slot] +
-                       ((((seq + off[m]) % d->difseg_size)<<1) + chan)*3;
-                   tbl[m] = (x<<1)|(y<<8);
-                   break;
-              case PIX_FMT_YUV420P:
-                   x = shuf3[m] + slot/3;
-                   y = serpent1[slot] +
-                       ((seq + off[m]) % d->difseg_size)*3;
-                   tbl[m] = (x<<1)|(y<<9);
-                   break;
-              case PIX_FMT_YUV411P:
-                   i = (seq + off[m]) % d->difseg_size;
-                   k = slot + ((m==1||m==2)?3:0);
-
-                   x = l_start_shuffled[m] + k/6;
-                   y = serpent2[k] + i*6;
-                   if (x>21)
-                       y = y*2 - i*6;
-                   tbl[m] = (x<<2)|(y<<8);
-                   break;
-              }
-        default:
-              break;
-        }
-    }
-}
-
-static int dv_init_dynamic_tables(const DVprofile *d)
-{
-    int j,i,c,s,p;
-    uint32_t *factor1, *factor2;
-    const int *iweight1, *iweight2;
-
-    if (!d->work_chunks[dv_work_pool_size(d)-1].buf_offset) {
-        p = i = 0;
-        for (c=0; c<d->n_difchan; c++) {
-            for (s=0; s<d->difseg_size; s++) {
-                p += 6;
-                for (j=0; j<27; j++) {
-                    p += !(j%3);
-                    if (!(DV_PROFILE_IS_1080i50(d) && c != 0 && s == 11) &&
-                        !(DV_PROFILE_IS_720p50(d) && s > 9)) {
-                          dv_calc_mb_coordinates(d, c, s, j, &d->work_chunks[i].mb_coordinates[0]);
-                          d->work_chunks[i++].buf_offset = p;
-                    }
-                    p += 5;
-                }
-            }
-        }
-    }
-
-    if (!d->idct_factor[DV_PROFILE_IS_HD(d)?8191:5631]) {
-        factor1 = &d->idct_factor[0];
-        factor2 = &d->idct_factor[DV_PROFILE_IS_HD(d)?4096:2816];
-        if (d->height == 720) {
-            iweight1 = &dv_iweight_720_y[0];
-            iweight2 = &dv_iweight_720_c[0];
-        } else {
-            iweight1 = &dv_iweight_1080_y[0];
-            iweight2 = &dv_iweight_1080_c[0];
-        }
-        if (DV_PROFILE_IS_HD(d)) {
-            for (c = 0; c < 4; c++) {
-                for (s = 0; s < 16; s++) {
-                    for (i = 0; i < 64; i++) {
-                        *factor1++ = (dv100_qstep[s] << (c + 9)) * iweight1[i];
-                        *factor2++ = (dv100_qstep[s] << (c + 9)) * iweight2[i];
-                    }
-                }
-            }
-        } else {
-            iweight1 = &dv_iweight_88[0];
-            for (j = 0; j < 2; j++, iweight1 = &dv_iweight_248[0]) {
-                for (s = 0; s < 22; s++) {
-                    for (i = c = 0; c < 4; c++) {
-                        for (; i < dv_quant_areas[c]; i++) {
-                            *factor1   = iweight1[i] << (dv_quant_shifts[s][c] + 1);
-                            *factor2++ = (*factor1++) << 1;
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    return 0;
-}
-
-static av_cold int dvvideo_init(AVCodecContext *avctx)
-{
-    DVVideoContext *s = avctx->priv_data;
-    DSPContext dsp;
-    static int done = 0;
-    int i, j;
-
-    if (!done) {
-        VLC dv_vlc;
-        uint16_t new_dv_vlc_bits[NB_DV_VLC*2];
-        uint8_t  new_dv_vlc_len[NB_DV_VLC*2];
-        uint8_t  new_dv_vlc_run[NB_DV_VLC*2];
-        int16_t  new_dv_vlc_level[NB_DV_VLC*2];
-
-        done = 1;
-
-        /* it's faster to include sign bit in a generic VLC parsing scheme */
-        for (i = 0, j = 0; i < NB_DV_VLC; i++, j++) {
-            new_dv_vlc_bits[j]  = dv_vlc_bits[i];
-            new_dv_vlc_len[j]   = dv_vlc_len[i];
-            new_dv_vlc_run[j]   = dv_vlc_run[i];
-            new_dv_vlc_level[j] = dv_vlc_level[i];
-
-            if (dv_vlc_level[i]) {
-                new_dv_vlc_bits[j] <<= 1;
-                new_dv_vlc_len[j]++;
-
-                j++;
-                new_dv_vlc_bits[j]  = (dv_vlc_bits[i] << 1) | 1;
-                new_dv_vlc_len[j]   =  dv_vlc_len[i] + 1;
-                new_dv_vlc_run[j]   =  dv_vlc_run[i];
-                new_dv_vlc_level[j] = -dv_vlc_level[i];
-            }
-        }
-
-        /* NOTE: as a trick, we use the fact the no codes are unused
-           to accelerate the parsing of partial codes */
-        init_vlc(&dv_vlc, TEX_VLC_BITS, j,
-                 new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0);
-        assert(dv_vlc.table_size == 1184);
-
-        for (i = 0; i < dv_vlc.table_size; i++){
-            int code = dv_vlc.table[i][0];
-            int len  = dv_vlc.table[i][1];
-            int level, run;
-
-            if (len < 0){ //more bits needed
-                run   = 0;
-                level = code;
-            } else {
-                run   = new_dv_vlc_run  [code] + 1;
-                level = new_dv_vlc_level[code];
-            }
-            dv_rl_vlc[i].len   = len;
-            dv_rl_vlc[i].level = level;
-            dv_rl_vlc[i].run   = run;
-        }
-        free_vlc(&dv_vlc);
-
-        dv_vlc_map_tableinit();
-    }
-
-    /* Generic DSP setup */
-    dsputil_init(&dsp, avctx);
-    ff_set_cmp(&dsp, dsp.ildct_cmp, avctx->ildct_cmp);
-    s->get_pixels = dsp.get_pixels;
-    s->ildct_cmp = dsp.ildct_cmp[5];
-
-    /* 88DCT setup */
-    s->fdct[0]     = dsp.fdct;
-    s->idct_put[0] = dsp.idct_put;
-    for (i = 0; i < 64; i++)
-       s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]];
-
-    /* 248DCT setup */
-    s->fdct[1]     = dsp.fdct248;
-    s->idct_put[1] = ff_simple_idct248_put;  // FIXME: need to add it to DSP
-    if (avctx->lowres){
-        for (i = 0; i < 64; i++){
-            int j = ff_zigzag248_direct[i];
-            s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2];
-        }
-    }else
-        memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64);
-
-    avctx->coded_frame = &s->picture;
-    s->avctx = avctx;
-    avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
-
-    return 0;
-}
-
-static av_cold int dvvideo_init_encoder(AVCodecContext *avctx)
-{
-    if (!ff_dv_codec_profile(avctx)) {
-        av_log(avctx, AV_LOG_ERROR, "Found no DV profile for %ix%i %s video\n",
-               avctx->width, avctx->height, avcodec_get_pix_fmt_name(avctx->pix_fmt));
-        return -1;
-    }
-
-    return dvvideo_init(avctx);
-}
-
-// #define VLC_DEBUG
-// #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__)
-
-typedef struct BlockInfo {
-    const uint32_t *factor_table;
-    const uint8_t *scan_table;
-    uint8_t pos; /* position in block */
-    void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
-    uint8_t partial_bit_count;
-    uint16_t partial_bit_buffer;
-    int shift_offset;
-} BlockInfo;
-
-/* bit budget for AC only in 5 MBs */
-static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5;
-/* see dv_88_areas and dv_248_areas for details */
-static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
-
-static inline int put_bits_left(PutBitContext* s)
-{
-    return (s->buf_end - s->buf) * 8 - put_bits_count(s);
-}
-
-/* decode ac coefficients */
-static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
-{
-    int last_index = gb->size_in_bits;
-    const uint8_t  *scan_table   = mb->scan_table;
-    const uint32_t *factor_table = mb->factor_table;
-    int pos               = mb->pos;
-    int partial_bit_count = mb->partial_bit_count;
-    int level, run, vlc_len, index;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-
-    /* if we must parse a partial vlc, we do it here */
-    if (partial_bit_count > 0) {
-        re_cache = ((unsigned)re_cache >> partial_bit_count) |
-                   (mb->partial_bit_buffer << (sizeof(re_cache) * 8 - partial_bit_count));
-        re_index -= partial_bit_count;
-        mb->partial_bit_count = 0;
-    }
-
-    /* get the AC coefficients until last_index is reached */
-    for (;;) {
-#ifdef VLC_DEBUG
-        printf("%2d: bits=%04x index=%d\n", pos, SHOW_UBITS(re, gb, 16), re_index);
-#endif
-        /* our own optimized GET_RL_VLC */
-        index   = NEG_USR32(re_cache, TEX_VLC_BITS);
-        vlc_len = dv_rl_vlc[index].len;
-        if (vlc_len < 0) {
-            index = NEG_USR32((unsigned)re_cache << TEX_VLC_BITS, -vlc_len) + dv_rl_vlc[index].level;
-            vlc_len = TEX_VLC_BITS - vlc_len;
-        }
-        level = dv_rl_vlc[index].level;
-        run   = dv_rl_vlc[index].run;
-
-        /* gotta check if we're still within gb boundaries */
-        if (re_index + vlc_len > last_index) {
-            /* should be < 16 bits otherwise a codeword could have been parsed */
-            mb->partial_bit_count = last_index - re_index;
-            mb->partial_bit_buffer = NEG_USR32(re_cache, mb->partial_bit_count);
-            re_index = last_index;
-            break;
-        }
-        re_index += vlc_len;
-
-#ifdef VLC_DEBUG
-        printf("run=%d level=%d\n", run, level);
-#endif
-        pos += run;
-        if (pos >= 64)
-            break;
-
-        level = (level * factor_table[pos] + (1 << (dv_iweight_bits - 1))) >> dv_iweight_bits;
-        block[scan_table[pos]] = level;
-
-        UPDATE_CACHE(re, gb);
-    }
-    CLOSE_READER(re, gb);
-    mb->pos = pos;
-}
-
-static inline void bit_copy(PutBitContext *pb, GetBitContext *gb)
-{
-    int bits_left = get_bits_left(gb);
-    while (bits_left >= MIN_CACHE_BITS) {
-        put_bits(pb, MIN_CACHE_BITS, get_bits(gb, MIN_CACHE_BITS));
-        bits_left -= MIN_CACHE_BITS;
-    }
-    if (bits_left > 0) {
-        put_bits(pb, bits_left, get_bits(gb, bits_left));
-    }
-}
-
-static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y)
-{
-     *mb_x = work_chunk->mb_coordinates[m] & 0xff;
-     *mb_y = work_chunk->mb_coordinates[m] >> 8;
-
-     /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */
-     if (s->sys->height == 720 && !(s->buf[1]&0x0C)) {
-         *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */
-     }
-}
-
-/* mb_x and mb_y are in units of 8 pixels */
-static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
-{
-    DVVideoContext *s = avctx->priv_data;
-    DVwork_chunk *work_chunk = arg;
-    int quant, dc, dct_mode, class1, j;
-    int mb_index, mb_x, mb_y, last_index;
-    int y_stride, linesize;
-    DCTELEM *block, *block1;
-    int c_offset;
-    uint8_t *y_ptr;
-    const uint8_t *buf_ptr;
-    PutBitContext pb, vs_pb;
-    GetBitContext gb;
-    BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
-    LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
-    LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + 4]); /* allow some slack */
-    LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5 * 80 + 4]); /* allow some slack */
-    const int log2_blocksize = 3-s->avctx->lowres;
-    int is_field_mode[5];
-
-    assert((((int)mb_bit_buffer) & 7) == 0);
-    assert((((int)vs_bit_buffer) & 7) == 0);
-
-    memset(sblock, 0, 5*DV_MAX_BPM*sizeof(*sblock));
-
-    /* pass 1 : read DC and AC coefficients in blocks */
-    buf_ptr = &s->buf[work_chunk->buf_offset*80];
-    block1  = &sblock[0][0];
-    mb1     = mb_data;
-    init_put_bits(&vs_pb, vs_bit_buffer, 5 * 80);
-    for (mb_index = 0; mb_index < 5; mb_index++, mb1 += s->sys->bpm, block1 += s->sys->bpm * 64) {
-        /* skip header */
-        quant = buf_ptr[3] & 0x0f;
-        buf_ptr += 4;
-        init_put_bits(&pb, mb_bit_buffer, 80);
-        mb    = mb1;
-        block = block1;
-        is_field_mode[mb_index] = 0;
-        for (j = 0; j < s->sys->bpm; j++) {
-            last_index = s->sys->block_sizes[j];
-            init_get_bits(&gb, buf_ptr, last_index);
-
-            /* get the dc */
-            dc       = get_sbits(&gb, 9);
-            dct_mode = get_bits1(&gb);
-            class1   = get_bits(&gb, 2);
-            if (DV_PROFILE_IS_HD(s->sys)) {
-                mb->idct_put     = s->idct_put[0];
-                mb->scan_table   = s->dv_zigzag[0];
-                mb->factor_table = &s->sys->idct_factor[(j >= 4)*4*16*64 + class1*16*64 + quant*64];
-                is_field_mode[mb_index] |= !j && dct_mode;
-            } else {
-                mb->idct_put     = s->idct_put[dct_mode && log2_blocksize == 3];
-                mb->scan_table   = s->dv_zigzag[dct_mode];
-                mb->factor_table = &s->sys->idct_factor[(class1 == 3)*2*22*64 + dct_mode*22*64 +
-                                                        (quant + dv_quant_offset[class1])*64];
-            }
-            dc = dc << 2;
-            /* convert to unsigned because 128 is not added in the
-               standard IDCT */
-            dc += 1024;
-            block[0] = dc;
-            buf_ptr += last_index >> 3;
-            mb->pos               = 0;
-            mb->partial_bit_count = 0;
-
-#ifdef VLC_DEBUG
-            printf("MB block: %d, %d ", mb_index, j);
-#endif
-            dv_decode_ac(&gb, mb, block);
-
-            /* write the remaining bits  in a new buffer only if the
-               block is finished */
-            if (mb->pos >= 64)
-                bit_copy(&pb, &gb);
-
-            block += 64;
-            mb++;
-        }
-
-        /* pass 2 : we can do it just after */
-#ifdef VLC_DEBUG
-        printf("***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
-#endif
-        block = block1;
-        mb    = mb1;
-        init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb));
-        flush_put_bits(&pb);
-        for (j = 0; j < s->sys->bpm; j++, block += 64, mb++) {
-            if (mb->pos < 64 && get_bits_left(&gb) > 0) {
-                dv_decode_ac(&gb, mb, block);
-                /* if still not finished, no need to parse other blocks */
-                if (mb->pos < 64)
-                    break;
-            }
-        }
-        /* all blocks are finished, so the extra bytes can be used at
-           the video segment level */
-        if (j >= s->sys->bpm)
-            bit_copy(&vs_pb, &gb);
-    }
-
-    /* we need a pass other the whole video segment */
-#ifdef VLC_DEBUG
-    printf("***pass 3 size=%d\n", put_bits_count(&vs_pb));
-#endif
-    block = &sblock[0][0];
-    mb    = mb_data;
-    init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb));
-    flush_put_bits(&vs_pb);
-    for (mb_index = 0; mb_index < 5; mb_index++) {
-        for (j = 0; j < s->sys->bpm; j++) {
-            if (mb->pos < 64) {
-#ifdef VLC_DEBUG
-                printf("start %d:%d\n", mb_index, j);
-#endif
-                dv_decode_ac(&gb, mb, block);
-            }
-            if (mb->pos >= 64 && mb->pos < 127)
-                av_log(avctx, AV_LOG_ERROR, "AC EOB marker is absent pos=%d\n", mb->pos);
-            block += 64;
-            mb++;
-        }
-    }
-
-    /* compute idct and place blocks */
-    block = &sblock[0][0];
-    mb    = mb_data;
-    for (mb_index = 0; mb_index < 5; mb_index++) {
-        dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
-
-        /* idct_put'ting luminance */
-        if ((s->sys->pix_fmt == PIX_FMT_YUV420P) ||
-            (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) ||
-            (s->sys->height >= 720 && mb_y != 134)) {
-            y_stride = (s->picture.linesize[0] << ((!is_field_mode[mb_index]) * log2_blocksize));
-        } else {
-            y_stride = (2 << log2_blocksize);
-        }
-        y_ptr = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x) << log2_blocksize);
-        linesize = s->picture.linesize[0] << is_field_mode[mb_index];
-        mb[0]    .idct_put(y_ptr                                   , linesize, block + 0*64);
-        if (s->sys->video_stype == 4) { /* SD 422 */
-            mb[2].idct_put(y_ptr + (1 << log2_blocksize)           , linesize, block + 2*64);
-        } else {
-            mb[1].idct_put(y_ptr + (1 << log2_blocksize)           , linesize, block + 1*64);
-            mb[2].idct_put(y_ptr                         + y_stride, linesize, block + 2*64);
-            mb[3].idct_put(y_ptr + (1 << log2_blocksize) + y_stride, linesize, block + 3*64);
-        }
-        mb += 4;
-        block += 4*64;
-
-        /* idct_put'ting chrominance */
-        c_offset = (((mb_y >>  (s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
-                     (mb_x >> ((s->sys->pix_fmt == PIX_FMT_YUV411P) ? 2 : 1))) << log2_blocksize);
-        for (j = 2; j; j--) {
-            uint8_t *c_ptr = s->picture.data[j] + c_offset;
-            if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) {
-                  uint64_t aligned_pixels[64/8];
-                  uint8_t *pixels = (uint8_t*)aligned_pixels;
-                  uint8_t *c_ptr1, *ptr1;
-                  int x, y;
-                  mb->idct_put(pixels, 8, block);
-                  for (y = 0; y < (1 << log2_blocksize); y++, c_ptr += s->picture.linesize[j], pixels += 8) {
-                      ptr1   = pixels + (1 << (log2_blocksize - 1));
-                      c_ptr1 = c_ptr + (s->picture.linesize[j] << log2_blocksize);
-                      for (x = 0; x < (1 << (log2_blocksize - 1)); x++) {
-                          c_ptr[x]  = pixels[x];
-                          c_ptr1[x] = ptr1[x];
-                      }
-                  }
-                  block += 64; mb++;
-            } else {
-                  y_stride = (mb_y == 134) ? (1 << log2_blocksize) :
-                                             s->picture.linesize[j] << ((!is_field_mode[mb_index]) * log2_blocksize);
-                  linesize = s->picture.linesize[j] << is_field_mode[mb_index];
-                  (mb++)->    idct_put(c_ptr           , linesize, block); block += 64;
-                  if (s->sys->bpm == 8) {
-                      (mb++)->idct_put(c_ptr + y_stride, linesize, block); block += 64;
-                  }
-            }
-        }
-    }
-    return 0;
-}
-
-#if CONFIG_SMALL
-/* Converts run and level (where level != 0) pair into vlc, returning bit size */
-static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc)
-{
-    int size;
-    if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) {
-        *vlc = dv_vlc_map[run][level].vlc | sign;
-        size = dv_vlc_map[run][level].size;
-    }
-    else {
-        if (level < DV_VLC_MAP_LEV_SIZE) {
-            *vlc = dv_vlc_map[0][level].vlc | sign;
-            size = dv_vlc_map[0][level].size;
-        } else {
-            *vlc = 0xfe00 | (level << 1) | sign;
-            size = 16;
-        }
-        if (run) {
-            *vlc |= ((run < 16) ? dv_vlc_map[run-1][0].vlc :
-                                  (0x1f80 | (run - 1))) << size;
-            size +=  (run < 16) ? dv_vlc_map[run-1][0].size : 13;
-        }
-    }
-
-    return size;
-}
-
-static av_always_inline int dv_rl2vlc_size(int run, int level)
-{
-    int size;
-
-    if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) {
-        size = dv_vlc_map[run][level].size;
-    }
-    else {
-        size = (level < DV_VLC_MAP_LEV_SIZE) ? dv_vlc_map[0][level].size : 16;
-        if (run) {
-            size += (run < 16) ? dv_vlc_map[run-1][0].size : 13;
-        }
-    }
-    return size;
-}
-#else
-static av_always_inline int dv_rl2vlc(int run, int l, int sign, uint32_t* vlc)
-{
-    *vlc = dv_vlc_map[run][l].vlc | sign;
-    return dv_vlc_map[run][l].size;
-}
-
-static av_always_inline int dv_rl2vlc_size(int run, int l)
-{
-    return dv_vlc_map[run][l].size;
-}
-#endif
-
-typedef struct EncBlockInfo {
-    int      area_q[4];
-    int      bit_size[4];
-    int      prev[5];
-    int      cur_ac;
-    int      cno;
-    int      dct_mode;
-    DCTELEM  mb[64];
-    uint8_t  next[64];
-    uint8_t  sign[64];
-    uint8_t  partial_bit_count;
-    uint32_t partial_bit_buffer; /* we can't use uint16_t here */
-} EncBlockInfo;
-
-static av_always_inline PutBitContext* dv_encode_ac(EncBlockInfo* bi,
-                                                    PutBitContext* pb_pool,
-                                                    PutBitContext* pb_end)
-{
-    int prev, bits_left;
-    PutBitContext* pb = pb_pool;
-    int size = bi->partial_bit_count;
-    uint32_t vlc = bi->partial_bit_buffer;
-
-    bi->partial_bit_count = bi->partial_bit_buffer = 0;
-    for (;;){
-       /* Find suitable storage space */
-       for (; size > (bits_left = put_bits_left(pb)); pb++) {
-          if (bits_left) {
-              size -= bits_left;
-              put_bits(pb, bits_left, vlc >> size);
-              vlc = vlc & ((1 << size) - 1);
-          }
-          if (pb + 1 >= pb_end) {
-              bi->partial_bit_count  = size;
-              bi->partial_bit_buffer = vlc;
-              return pb;
-          }
-       }
-
-       /* Store VLC */
-       put_bits(pb, size, vlc);
-
-       if (bi->cur_ac >= 64)
-           break;
-
-       /* Construct the next VLC */
-       prev       = bi->cur_ac;
-       bi->cur_ac = bi->next[prev];
-       if (bi->cur_ac < 64){
-           size = dv_rl2vlc(bi->cur_ac - prev - 1, bi->mb[bi->cur_ac], bi->sign[bi->cur_ac], &vlc);
-       } else {
-           size = 4; vlc = 6; /* End Of Block stamp */
-       }
-    }
-    return pb;
-}
-
-static av_always_inline int dv_guess_dct_mode(DVVideoContext *s, uint8_t *data, int linesize) {
-    if (s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) {
-        int ps = s->ildct_cmp(NULL, data, NULL, linesize, 8) - 400;
-        if (ps > 0) {
-            int is = s->ildct_cmp(NULL, data           , NULL, linesize<<1, 4) +
-                     s->ildct_cmp(NULL, data + linesize, NULL, linesize<<1, 4);
-            return (ps > is);
-        }
-    }
-
-    return 0;
-}
-
-static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, int linesize, DVVideoContext *s, int bias)
-{
-    const int *weight;
-    const uint8_t* zigzag_scan;
-    LOCAL_ALIGNED_16(DCTELEM, blk, [64]);
-    int i, area;
-    /* We offer two different methods for class number assignment: the
-       method suggested in SMPTE 314M Table 22, and an improved
-       method. The SMPTE method is very conservative; it assigns class
-       3 (i.e. severe quantization) to any block where the largest AC
-       component is greater than 36. FFmpeg's DV encoder tracks AC bit
-       consumption precisely, so there is no need to bias most blocks
-       towards strongly lossy compression. Instead, we assign class 2
-       to most blocks, and use class 3 only when strictly necessary
-       (for blocks whose largest AC component exceeds 255). */
-
-#if 0 /* SMPTE spec method */
-    static const int classes[] = {12, 24, 36, 0xffff};
-#else /* improved FFmpeg method */
-    static const int classes[] = {-1, -1, 255, 0xffff};
-#endif
-    int max  = classes[0];
-    int prev = 0;
-
-    assert((((int)blk) & 15) == 0);
-
-    bi->area_q[0] = bi->area_q[1] = bi->area_q[2] = bi->area_q[3] = 0;
-    bi->partial_bit_count = 0;
-    bi->partial_bit_buffer = 0;
-    bi->cur_ac = 0;
-    if (data) {
-        bi->dct_mode = dv_guess_dct_mode(s, data, linesize);
-        s->get_pixels(blk, data, linesize);
-        s->fdct[bi->dct_mode](blk);
-    } else {
-        /* We rely on the fact that encoding all zeros leads to an immediate EOB,
-           which is precisely what the spec calls for in the "dummy" blocks. */
-        memset(blk, 0, 64*sizeof(*blk));
-        bi->dct_mode = 0;
-    }
-    bi->mb[0] = blk[0];
-
-    zigzag_scan = bi->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct;
-    weight = bi->dct_mode ? dv_weight_248 : dv_weight_88;
-
-    for (area = 0; area < 4; area++) {
-       bi->prev[area]     = prev;
-       bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :)
-       for (i = mb_area_start[area]; i < mb_area_start[area+1]; i++) {
-          int level = blk[zigzag_scan[i]];
-
-          if (level + 15 > 30U) {
-              bi->sign[i] = (level >> 31) & 1;
-              /* weigh it and and shift down into range, adding for rounding */
-              /* the extra division by a factor of 2^4 reverses the 8x expansion of the DCT
-                 AND the 2x doubling of the weights */
-              level = (FFABS(level) * weight[i] + (1 << (dv_weight_bits+3))) >> (dv_weight_bits+4);
-              bi->mb[i] = level;
-              if (level > max)
-                  max = level;
-              bi->bit_size[area] += dv_rl2vlc_size(i - prev  - 1, level);
-              bi->next[prev]= i;
-              prev = i;
-          }
-       }
-    }
-    bi->next[prev]= i;
-    for (bi->cno = 0; max > classes[bi->cno]; bi->cno++);
-
-    bi->cno += bias;
-
-    if (bi->cno >= 3) {
-        bi->cno = 3;
-        prev    = 0;
-        i       = bi->next[prev];
-        for (area = 0; area < 4; area++) {
-            bi->prev[area]     = prev;
-            bi->bit_size[area] = 1; // 4 areas 4 bits for EOB :)
-            for (; i < mb_area_start[area+1]; i = bi->next[i]) {
-                bi->mb[i] >>= 1;
-
-                if (bi->mb[i]) {
-                    bi->bit_size[area] += dv_rl2vlc_size(i - prev - 1, bi->mb[i]);
-                    bi->next[prev]= i;
-                    prev = i;
-                }
-            }
-        }
-        bi->next[prev]= i;
-    }
-
-    return bi->bit_size[0] + bi->bit_size[1] + bi->bit_size[2] + bi->bit_size[3];
-}
-
-static inline void dv_guess_qnos(EncBlockInfo* blks, int* qnos)
-{
-    int size[5];
-    int i, j, k, a, prev, a2;
-    EncBlockInfo* b;
-
-    size[0] = size[1] = size[2] = size[3] = size[4] = 1 << 24;
-    do {
-       b = blks;
-       for (i = 0; i < 5; i++) {
-          if (!qnos[i])
-              continue;
-
-          qnos[i]--;
-          size[i] = 0;
-          for (j = 0; j < 6; j++, b++) {
-             for (a = 0; a < 4; a++) {
-                if (b->area_q[a] != dv_quant_shifts[qnos[i] + dv_quant_offset[b->cno]][a]) {
-                    b->bit_size[a] = 1; // 4 areas 4 bits for EOB :)
-                    b->area_q[a]++;
-                    prev = b->prev[a];
-                    assert(b->next[prev] >= mb_area_start[a+1] || b->mb[prev]);
-                    for (k = b->next[prev] ; k < mb_area_start[a+1]; k = b->next[k]) {
-                       b->mb[k] >>= 1;
-                       if (b->mb[k]) {
-                           b->bit_size[a] += dv_rl2vlc_size(k - prev - 1, b->mb[k]);
-                           prev = k;
-                       } else {
-                           if (b->next[k] >= mb_area_start[a+1] && b->next[k]<64){
-                                for (a2 = a + 1; b->next[k] >= mb_area_start[a2+1]; a2++)
-                                    b->prev[a2] = prev;
-                                assert(a2 < 4);
-                                assert(b->mb[b->next[k]]);
-                                b->bit_size[a2] += dv_rl2vlc_size(b->next[k] - prev - 1, b->mb[b->next[k]])
-                                                  -dv_rl2vlc_size(b->next[k] -    k - 1, b->mb[b->next[k]]);
-                                assert(b->prev[a2] == k && (a2 + 1 >= 4 || b->prev[a2+1] != k));
-                                b->prev[a2] = prev;
-                           }
-                           b->next[prev] = b->next[k];
-                       }
-                    }
-                    b->prev[a+1]= prev;
-                }
-                size[i] += b->bit_size[a];
-             }
-          }
-          if (vs_total_ac_bits >= size[0] + size[1] + size[2] + size[3] + size[4])
-                return;
-       }
-    } while (qnos[0]|qnos[1]|qnos[2]|qnos[3]|qnos[4]);
-
-
-    for (a = 2; a == 2 || vs_total_ac_bits < size[0]; a += a){
-        b = blks;
-        size[0] = 5 * 6 * 4; //EOB
-        for (j = 0; j < 6 *5; j++, b++) {
-            prev = b->prev[0];
-            for (k = b->next[prev]; k < 64; k = b->next[k]) {
-                if (b->mb[k] < a && b->mb[k] > -a){
-                    b->next[prev] = b->next[k];
-                }else{
-                    size[0] += dv_rl2vlc_size(k - prev - 1, b->mb[k]);
-                    prev = k;
-                }
-            }
-        }
-    }
-}
-
-static int dv_encode_video_segment(AVCodecContext *avctx, void *arg)
-{
-    DVVideoContext *s = avctx->priv_data;
-    DVwork_chunk *work_chunk = arg;
-    int mb_index, i, j;
-    int mb_x, mb_y, c_offset, linesize, y_stride;
-    uint8_t*  y_ptr;
-    uint8_t*  dif;
-    uint8_t   scratch[64];
-    EncBlockInfo  enc_blks[5*DV_MAX_BPM];
-    PutBitContext pbs[5*DV_MAX_BPM];
-    PutBitContext* pb;
-    EncBlockInfo* enc_blk;
-    int       vs_bit_size = 0;
-    int       qnos[5] = {15, 15, 15, 15, 15}; /* No quantization */
-    int*      qnosp = &qnos[0];
-
-    dif = &s->buf[work_chunk->buf_offset*80];
-    enc_blk = &enc_blks[0];
-    for (mb_index = 0; mb_index < 5; mb_index++) {
-        dv_calculate_mb_xy(s, work_chunk, mb_index, &mb_x, &mb_y);
-
-        /* initializing luminance blocks */
-        if ((s->sys->pix_fmt == PIX_FMT_YUV420P) ||
-            (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) ||
-            (s->sys->height >= 720 && mb_y != 134)) {
-            y_stride = s->picture.linesize[0] << 3;
-        } else {
-            y_stride = 16;
-        }
-        y_ptr    = s->picture.data[0] + ((mb_y * s->picture.linesize[0] + mb_x) << 3);
-        linesize = s->picture.linesize[0];
-
-        if (s->sys->video_stype == 4) { /* SD 422 */
-            vs_bit_size +=
-            dv_init_enc_block(enc_blk+0, y_ptr               , linesize, s, 0) +
-            dv_init_enc_block(enc_blk+1, NULL                , linesize, s, 0) +
-            dv_init_enc_block(enc_blk+2, y_ptr + 8           , linesize, s, 0) +
-            dv_init_enc_block(enc_blk+3, NULL                , linesize, s, 0);
-        } else {
-            vs_bit_size +=
-            dv_init_enc_block(enc_blk+0, y_ptr               , linesize, s, 0) +
-            dv_init_enc_block(enc_blk+1, y_ptr + 8           , linesize, s, 0) +
-            dv_init_enc_block(enc_blk+2, y_ptr     + y_stride, linesize, s, 0) +
-            dv_init_enc_block(enc_blk+3, y_ptr + 8 + y_stride, linesize, s, 0);
-        }
-        enc_blk += 4;
-
-        /* initializing chrominance blocks */
-        c_offset = (((mb_y >>  (s->sys->pix_fmt == PIX_FMT_YUV420P)) * s->picture.linesize[1] +
-                     (mb_x >> ((s->sys->pix_fmt == PIX_FMT_YUV411P) ? 2 : 1))) << 3);
-        for (j = 2; j; j--) {
-            uint8_t *c_ptr = s->picture.data[j] + c_offset;
-            linesize = s->picture.linesize[j];
-            y_stride = (mb_y == 134) ? 8 : (s->picture.linesize[j] << 3);
-            if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) {
-                uint8_t* d;
-                uint8_t* b = scratch;
-                for (i = 0; i < 8; i++) {
-                    d = c_ptr + (linesize << 3);
-                    b[0] = c_ptr[0]; b[1] = c_ptr[1]; b[2] = c_ptr[2]; b[3] = c_ptr[3];
-                    b[4] =     d[0]; b[5] =     d[1]; b[6] =     d[2]; b[7] =     d[3];
-                    c_ptr += linesize;
-                    b += 8;
-                }
-                c_ptr = scratch;
-                linesize = 8;
-            }
-
-            vs_bit_size += dv_init_enc_block(    enc_blk++, c_ptr           , linesize, s, 1);
-            if (s->sys->bpm == 8) {
-                vs_bit_size += dv_init_enc_block(enc_blk++, c_ptr + y_stride, linesize, s, 1);
-            }
-        }
-    }
-
-    if (vs_total_ac_bits < vs_bit_size)
-        dv_guess_qnos(&enc_blks[0], qnosp);
-
-    /* DIF encoding process */
-    for (j=0; j<5*s->sys->bpm;) {
-        int start_mb = j;
-
-        dif[3] = *qnosp++;
-        dif += 4;
-
-        /* First pass over individual cells only */
-        for (i=0; i<s->sys->bpm; i++, j++) {
-            int sz = s->sys->block_sizes[i]>>3;
-
-            init_put_bits(&pbs[j], dif, sz);
-            put_sbits(&pbs[j], 9, ((enc_blks[j].mb[0] >> 3) - 1024 + 2) >> 2);
-            put_bits(&pbs[j], 1, enc_blks[j].dct_mode);
-            put_bits(&pbs[j], 2, enc_blks[j].cno);
-
-            dv_encode_ac(&enc_blks[j], &pbs[j], &pbs[j+1]);
-            dif += sz;
-        }
-
-        /* Second pass over each MB space */
-        pb = &pbs[start_mb];
-        for (i=0; i<s->sys->bpm; i++) {
-            if (enc_blks[start_mb+i].partial_bit_count)
-                pb = dv_encode_ac(&enc_blks[start_mb+i], pb, &pbs[start_mb+s->sys->bpm]);
-        }
-    }
-
-    /* Third and final pass over the whole video segment space */
-    pb = &pbs[0];
-    for (j=0; j<5*s->sys->bpm; j++) {
-       if (enc_blks[j].partial_bit_count)
-           pb = dv_encode_ac(&enc_blks[j], pb, &pbs[s->sys->bpm*5]);
-       if (enc_blks[j].partial_bit_count)
-            av_log(avctx, AV_LOG_ERROR, "ac bitstream overflow\n");
-    }
-
-    for (j=0; j<5*s->sys->bpm; j++) {
-       int pos;
-       int size = pbs[j].size_in_bits >> 3;
-       flush_put_bits(&pbs[j]);
-       pos = put_bits_count(&pbs[j]) >> 3;
-       if (pos > size) {
-           av_log(avctx, AV_LOG_ERROR, "bitstream written beyond buffer size\n");
-           return -1;
-       }
-       memset(pbs[j].buf + pos, 0xff, size - pos);
-    }
-
-    return 0;
-}
-
-#if CONFIG_DVVIDEO_DECODER
-/* NOTE: exactly one frame must be given (120000 bytes for NTSC,
-   144000 bytes for PAL - or twice those for 50Mbps) */
-static int dvvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    DVVideoContext *s = avctx->priv_data;
-
-    s->sys = ff_dv_frame_profile(s->sys, buf, buf_size);
-    if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {
-        av_log(avctx, AV_LOG_ERROR, "could not find dv frame profile\n");
-        return -1; /* NOTE: we only accept several full frames */
-    }
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    s->picture.reference = 0;
-    s->picture.key_frame = 1;
-    s->picture.pict_type = FF_I_TYPE;
-    avctx->pix_fmt   = s->sys->pix_fmt;
-    avctx->time_base = s->sys->time_base;
-    avcodec_set_dimensions(avctx, s->sys->width, s->sys->height);
-    if (avctx->get_buffer(avctx, &s->picture) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    s->picture.interlaced_frame = 1;
-    s->picture.top_field_first  = 0;
-
-    s->buf = buf;
-    avctx->execute(avctx, dv_decode_video_segment, s->sys->work_chunks, NULL,
-                   dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
-
-    emms_c();
-
-    /* return image */
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->picture;
-
-    return s->sys->frame_size;
-}
-#endif /* CONFIG_DVVIDEO_DECODER */
-
-
-static inline int dv_write_pack(enum dv_pack_type pack_id, DVVideoContext *c,
-                                uint8_t* buf)
-{
-    /*
-     * Here's what SMPTE314M says about these two:
-     *    (page 6) APTn, AP1n, AP2n, AP3n: These data shall be identical
-     *             as track application IDs (APTn = 001, AP1n =
-     *             001, AP2n = 001, AP3n = 001), if the source signal
-     *             comes from a digital VCR. If the signal source is
-     *             unknown, all bits for these data shall be set to 1.
-     *    (page 12) STYPE: STYPE defines a signal type of video signal
-     *                     00000b = 4:1:1 compression
-     *                     00100b = 4:2:2 compression
-     *                     XXXXXX = Reserved
-     * Now, I've got two problems with these statements:
-     *   1. it looks like APT == 111b should be a safe bet, but it isn't.
-     *      It seems that for PAL as defined in IEC 61834 we have to set
-     *      APT to 000 and for SMPTE314M to 001.
-     *   2. It is not at all clear what STYPE is used for 4:2:0 PAL
-     *      compression scheme (if any).
-     */
-    int apt   = (c->sys->pix_fmt == PIX_FMT_YUV420P ? 0 : 1);
-
-    uint8_t aspect = 0;
-    if ((int)(av_q2d(c->avctx->sample_aspect_ratio) * c->avctx->width / c->avctx->height * 10) >= 17) /* 16:9 */
-        aspect = 0x02;
-
-    buf[0] = (uint8_t)pack_id;
-    switch (pack_id) {
-    case dv_header525: /* I can't imagine why these two weren't defined as real */
-    case dv_header625: /* packs in SMPTE314M -- they definitely look like ones */
-          buf[1] = 0xf8 |        /* reserved -- always 1 */
-                   (apt & 0x07); /* APT: Track application ID */
-          buf[2] = (0    << 7) | /* TF1: audio data is 0 - valid; 1 - invalid */
-                   (0x0f << 3) | /* reserved -- always 1 */
-                   (apt & 0x07); /* AP1: Audio application ID */
-          buf[3] = (0    << 7) | /* TF2: video data is 0 - valid; 1 - invalid */
-                   (0x0f << 3) | /* reserved -- always 1 */
-                   (apt & 0x07); /* AP2: Video application ID */
-          buf[4] = (0    << 7) | /* TF3: subcode(SSYB) is 0 - valid; 1 - invalid */
-                   (0x0f << 3) | /* reserved -- always 1 */
-                   (apt & 0x07); /* AP3: Subcode application ID */
-          break;
-    case dv_video_source:
-          buf[1] = 0xff;      /* reserved -- always 1 */
-          buf[2] = (1 << 7) | /* B/W: 0 - b/w, 1 - color */
-                   (1 << 6) | /* following CLF is valid - 0, invalid - 1 */
-                   (3 << 4) | /* CLF: color frames ID (see ITU-R BT.470-4) */
-                   0xf;       /* reserved -- always 1 */
-          buf[3] = (3 << 6) | /* reserved -- always 1 */
-                   (c->sys->dsf << 5) | /*  system: 60fields/50fields */
-                   c->sys->video_stype; /* signal type video compression */
-          buf[4] = 0xff;      /* VISC: 0xff -- no information */
-          break;
-    case dv_video_control:
-          buf[1] = (0 << 6) | /* Copy generation management (CGMS) 0 -- free */
-                   0x3f;      /* reserved -- always 1 */
-          buf[2] = 0xc8 |     /* reserved -- always b11001xxx */
-                   aspect;
-          buf[3] = (1 << 7) | /* frame/field flag 1 -- frame, 0 -- field */
-                   (1 << 6) | /* first/second field flag 0 -- field 2, 1 -- field 1 */
-                   (1 << 5) | /* frame change flag 0 -- same picture as before, 1 -- different */
-                   (1 << 4) | /* 1 - interlaced, 0 - noninterlaced */
-                   0xc;       /* reserved -- always b1100 */
-          buf[4] = 0xff;      /* reserved -- always 1 */
-          break;
-    default:
-          buf[1] = buf[2] = buf[3] = buf[4] = 0xff;
-    }
-    return 5;
-}
-
-#if CONFIG_DVVIDEO_ENCODER
-static void dv_format_frame(DVVideoContext* c, uint8_t* buf)
-{
-    int chan, i, j, k;
-
-    for (chan = 0; chan < c->sys->n_difchan; chan++) {
-        for (i = 0; i < c->sys->difseg_size; i++) {
-            memset(buf, 0xff, 80 * 6); /* first 6 DIF blocks are for control data */
-
-            /* DV header: 1DIF */
-            buf += dv_write_dif_id(dv_sect_header, chan, i, 0, buf);
-            buf += dv_write_pack((c->sys->dsf ? dv_header625 : dv_header525), c, buf);
-            buf += 72; /* unused bytes */
-
-            /* DV subcode: 2DIFs */
-            for (j = 0; j < 2; j++) {
-                buf += dv_write_dif_id(dv_sect_subcode, chan, i, j, buf);
-                for (k = 0; k < 6; k++)
-                     buf += dv_write_ssyb_id(k, (i < c->sys->difseg_size/2), buf) + 5;
-                buf += 29; /* unused bytes */
-            }
-
-            /* DV VAUX: 3DIFS */
-            for (j = 0; j < 3; j++) {
-                buf += dv_write_dif_id(dv_sect_vaux, chan, i, j, buf);
-                buf += dv_write_pack(dv_video_source,  c, buf);
-                buf += dv_write_pack(dv_video_control, c, buf);
-                buf += 7*5;
-                buf += dv_write_pack(dv_video_source,  c, buf);
-                buf += dv_write_pack(dv_video_control, c, buf);
-                buf += 4*5 + 2; /* unused bytes */
-            }
-
-            /* DV Audio/Video: 135 Video DIFs + 9 Audio DIFs */
-            for (j = 0; j < 135; j++) {
-                if (j%15 == 0) {
-                    memset(buf, 0xff, 80);
-                    buf += dv_write_dif_id(dv_sect_audio, chan, i, j/15, buf);
-                    buf += 77; /* audio control & shuffled PCM audio */
-                }
-                buf += dv_write_dif_id(dv_sect_video, chan, i, j, buf);
-                buf += 77; /* 1 video macroblock: 1 bytes control
-                              4 * 14 bytes Y 8x8 data
-                              10 bytes Cr 8x8 data
-                              10 bytes Cb 8x8 data */
-            }
-        }
-    }
-}
-
-
-static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
-                                void *data)
-{
-    DVVideoContext *s = c->priv_data;
-
-    s->sys = ff_dv_codec_profile(c);
-    if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys))
-        return -1;
-
-    c->pix_fmt           = s->sys->pix_fmt;
-    s->picture           = *((AVFrame *)data);
-    s->picture.key_frame = 1;
-    s->picture.pict_type = FF_I_TYPE;
-
-    s->buf = buf;
-    c->execute(c, dv_encode_video_segment, s->sys->work_chunks, NULL,
-               dv_work_pool_size(s->sys), sizeof(DVwork_chunk));
-
-    emms_c();
-
-    dv_format_frame(s, buf);
-
-    return s->sys->frame_size;
-}
-#endif
-
-static int dvvideo_close(AVCodecContext *c)
-{
-    DVVideoContext *s = c->priv_data;
-
-    if (s->picture.data[0])
-        c->release_buffer(c, &s->picture);
-
-    return 0;
-}
-
-
-#if CONFIG_DVVIDEO_ENCODER
-AVCodec dvvideo_encoder = {
-    "dvvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DVVIDEO,
-    sizeof(DVVideoContext),
-    dvvideo_init_encoder,
-    dvvideo_encode_frame,
-    .pix_fmts  = (const enum PixelFormat[]) {PIX_FMT_YUV411P, PIX_FMT_YUV422P, PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
-};
-#endif // CONFIG_DVVIDEO_ENCODER
-
-#if CONFIG_DVVIDEO_DECODER
-AVCodec dvvideo_decoder = {
-    "dvvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DVVIDEO,
-    sizeof(DVVideoContext),
-    dvvideo_init,
-    NULL,
-    dvvideo_close,
-    dvvideo_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
-};
-#endif
diff --git a/libavcodec/dv_tablegen.c b/libavcodec/dv_tablegen.c
deleted file mode 100644
index 0e2b39d..0000000
--- a/libavcodec/dv_tablegen.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Generate a header file for hardcoded DV tables
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#ifndef CONFIG_SMALL
-#error CONFIG_SMALL must be defined to generate tables
-#endif
-#include "dv_tablegen.h"
-#include "tableprint.h"
-#include <inttypes.h>
-
-WRITE_1D_FUNC_ARGV(vlc_pair, struct dv_vlc_pair, 7,
-                   "{0x%"PRIx32", %"PRId8"}", data[i].vlc, data[i].size)
-WRITE_2D_FUNC(vlc_pair, struct dv_vlc_pair)
-
-int main(void)
-{
-    dv_vlc_map_tableinit();
-
-    write_fileheader();
-
-    printf("static const struct dv_vlc_pair dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE] = {\n");
-    write_vlc_pair_2d_array(dv_vlc_map, DV_VLC_MAP_RUN_SIZE, DV_VLC_MAP_LEV_SIZE);
-    printf("};\n");
-
-    return 0;
-}
diff --git a/libavcodec/dv_tablegen.h b/libavcodec/dv_tablegen.h
deleted file mode 100644
index ee6e822..0000000
--- a/libavcodec/dv_tablegen.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Header file for hardcoded DV tables
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef DV_TABLEGEN_H
-#define DV_TABLEGEN_H
-
-#include <stdint.h>
-#include "dv_vlc_data.h"
-
-#if CONFIG_SMALL
-#define DV_VLC_MAP_RUN_SIZE 15
-#define DV_VLC_MAP_LEV_SIZE 23
-#else
-#define DV_VLC_MAP_RUN_SIZE  64
-#define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check
-#endif
-
-/* VLC encoding lookup table */
-struct dv_vlc_pair {
-   uint32_t vlc;
-   uint32_t size;
-};
-
-#if CONFIG_HARDCODED_TABLES
-#define dv_vlc_map_tableinit()
-#include "libavcodec/dv_tables.h"
-#else
-static struct dv_vlc_pair dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE];
-
-static void dv_vlc_map_tableinit(void)
-{
-    int i, j;
-    for (i = 0; i < NB_DV_VLC - 1; i++) {
-       if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE)
-           continue;
-#if CONFIG_SMALL
-       if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE)
-           continue;
-#endif
-
-       if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0)
-           continue;
-
-       dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc  =
-           dv_vlc_bits[i] << (!!dv_vlc_level[i]);
-       dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size =
-           dv_vlc_len[i] + (!!dv_vlc_level[i]);
-    }
-    for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) {
-#if CONFIG_SMALL
-       for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) {
-          if (dv_vlc_map[i][j].size == 0) {
-              dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
-                        (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
-              dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
-                                      dv_vlc_map[0][j].size;
-          }
-       }
-#else
-       for (j = 1; j < DV_VLC_MAP_LEV_SIZE/2; j++) {
-          if (dv_vlc_map[i][j].size == 0) {
-              dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
-                        (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
-              dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
-                                      dv_vlc_map[0][j].size;
-          }
-          dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc =
-                                        dv_vlc_map[i][j].vlc | 1;
-          dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size =
-                                        dv_vlc_map[i][j].size;
-       }
-#endif
-    }
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* DV_TABLEGEN_H */
diff --git a/libavcodec/dv_vlc_data.h b/libavcodec/dv_vlc_data.h
deleted file mode 100644
index c23c564..0000000
--- a/libavcodec/dv_vlc_data.h
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * VLC constants for DV codec
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VLC constants for DV codec.
- */
-
-#ifndef AVCODEC_DV_VLC_DATA_H
-#define AVCODEC_DV_VLC_DATA_H
-
-#include <stdint.h>
-
-#define NB_DV_VLC 409
-
-/*
- * There's a catch about the following three tables: the mapping they establish
- * between (run, level) and vlc is not 1-1. So you have to watch out for that
- * when building misc. tables. E.g. (1, 0) can be either 0x7cf or 0x1f82.
- */
-static const uint16_t dv_vlc_bits[409] = {
- 0x0000, 0x0002, 0x0007, 0x0008, 0x0009, 0x0014, 0x0015, 0x0016,
- 0x0017, 0x0030, 0x0031, 0x0032, 0x0033, 0x0068, 0x0069, 0x006a,
- 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x00e0, 0x00e1, 0x00e2,
- 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x00e8, 0x00e9, 0x00ea,
- 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x01e0, 0x01e1, 0x01e2,
- 0x01e3, 0x01e4, 0x01e5, 0x01e6, 0x01e7, 0x01e8, 0x01e9, 0x01ea,
- 0x01eb, 0x01ec, 0x01ed, 0x01ee, 0x01ef, 0x03e0, 0x03e1, 0x03e2,
- 0x03e3, 0x03e4, 0x03e5, 0x03e6, 0x07ce, 0x07cf, 0x07d0, 0x07d1,
- 0x07d2, 0x07d3, 0x07d4, 0x07d5, 0x0fac, 0x0fad, 0x0fae, 0x0faf,
- 0x0fb0, 0x0fb1, 0x0fb2, 0x0fb3, 0x0fb4, 0x0fb5, 0x0fb6, 0x0fb7,
- 0x0fb8, 0x0fb9, 0x0fba, 0x0fbb, 0x0fbc, 0x0fbd, 0x0fbe, 0x0fbf,
- 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87,
- 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f,
- 0x1f90, 0x1f91, 0x1f92, 0x1f93, 0x1f94, 0x1f95, 0x1f96, 0x1f97,
- 0x1f98, 0x1f99, 0x1f9a, 0x1f9b, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f,
- 0x1fa0, 0x1fa1, 0x1fa2, 0x1fa3, 0x1fa4, 0x1fa5, 0x1fa6, 0x1fa7,
- 0x1fa8, 0x1fa9, 0x1faa, 0x1fab, 0x1fac, 0x1fad, 0x1fae, 0x1faf,
- 0x1fb0, 0x1fb1, 0x1fb2, 0x1fb3, 0x1fb4, 0x1fb5, 0x1fb6, 0x1fb7,
- 0x1fb8, 0x1fb9, 0x1fba, 0x1fbb, 0x1fbc, 0x1fbd, 0x1fbe, 0x1fbf,
- 0x7f00, 0x7f01, 0x7f02, 0x7f03, 0x7f04, 0x7f05, 0x7f06, 0x7f07,
- 0x7f08, 0x7f09, 0x7f0a, 0x7f0b, 0x7f0c, 0x7f0d, 0x7f0e, 0x7f0f,
- 0x7f10, 0x7f11, 0x7f12, 0x7f13, 0x7f14, 0x7f15, 0x7f16, 0x7f17,
- 0x7f18, 0x7f19, 0x7f1a, 0x7f1b, 0x7f1c, 0x7f1d, 0x7f1e, 0x7f1f,
- 0x7f20, 0x7f21, 0x7f22, 0x7f23, 0x7f24, 0x7f25, 0x7f26, 0x7f27,
- 0x7f28, 0x7f29, 0x7f2a, 0x7f2b, 0x7f2c, 0x7f2d, 0x7f2e, 0x7f2f,
- 0x7f30, 0x7f31, 0x7f32, 0x7f33, 0x7f34, 0x7f35, 0x7f36, 0x7f37,
- 0x7f38, 0x7f39, 0x7f3a, 0x7f3b, 0x7f3c, 0x7f3d, 0x7f3e, 0x7f3f,
- 0x7f40, 0x7f41, 0x7f42, 0x7f43, 0x7f44, 0x7f45, 0x7f46, 0x7f47,
- 0x7f48, 0x7f49, 0x7f4a, 0x7f4b, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f4f,
- 0x7f50, 0x7f51, 0x7f52, 0x7f53, 0x7f54, 0x7f55, 0x7f56, 0x7f57,
- 0x7f58, 0x7f59, 0x7f5a, 0x7f5b, 0x7f5c, 0x7f5d, 0x7f5e, 0x7f5f,
- 0x7f60, 0x7f61, 0x7f62, 0x7f63, 0x7f64, 0x7f65, 0x7f66, 0x7f67,
- 0x7f68, 0x7f69, 0x7f6a, 0x7f6b, 0x7f6c, 0x7f6d, 0x7f6e, 0x7f6f,
- 0x7f70, 0x7f71, 0x7f72, 0x7f73, 0x7f74, 0x7f75, 0x7f76, 0x7f77,
- 0x7f78, 0x7f79, 0x7f7a, 0x7f7b, 0x7f7c, 0x7f7d, 0x7f7e, 0x7f7f,
- 0x7f80, 0x7f81, 0x7f82, 0x7f83, 0x7f84, 0x7f85, 0x7f86, 0x7f87,
- 0x7f88, 0x7f89, 0x7f8a, 0x7f8b, 0x7f8c, 0x7f8d, 0x7f8e, 0x7f8f,
- 0x7f90, 0x7f91, 0x7f92, 0x7f93, 0x7f94, 0x7f95, 0x7f96, 0x7f97,
- 0x7f98, 0x7f99, 0x7f9a, 0x7f9b, 0x7f9c, 0x7f9d, 0x7f9e, 0x7f9f,
- 0x7fa0, 0x7fa1, 0x7fa2, 0x7fa3, 0x7fa4, 0x7fa5, 0x7fa6, 0x7fa7,
- 0x7fa8, 0x7fa9, 0x7faa, 0x7fab, 0x7fac, 0x7fad, 0x7fae, 0x7faf,
- 0x7fb0, 0x7fb1, 0x7fb2, 0x7fb3, 0x7fb4, 0x7fb5, 0x7fb6, 0x7fb7,
- 0x7fb8, 0x7fb9, 0x7fba, 0x7fbb, 0x7fbc, 0x7fbd, 0x7fbe, 0x7fbf,
- 0x7fc0, 0x7fc1, 0x7fc2, 0x7fc3, 0x7fc4, 0x7fc5, 0x7fc6, 0x7fc7,
- 0x7fc8, 0x7fc9, 0x7fca, 0x7fcb, 0x7fcc, 0x7fcd, 0x7fce, 0x7fcf,
- 0x7fd0, 0x7fd1, 0x7fd2, 0x7fd3, 0x7fd4, 0x7fd5, 0x7fd6, 0x7fd7,
- 0x7fd8, 0x7fd9, 0x7fda, 0x7fdb, 0x7fdc, 0x7fdd, 0x7fde, 0x7fdf,
- 0x7fe0, 0x7fe1, 0x7fe2, 0x7fe3, 0x7fe4, 0x7fe5, 0x7fe6, 0x7fe7,
- 0x7fe8, 0x7fe9, 0x7fea, 0x7feb, 0x7fec, 0x7fed, 0x7fee, 0x7fef,
- 0x7ff0, 0x7ff1, 0x7ff2, 0x7ff3, 0x7ff4, 0x7ff5, 0x7ff6, 0x7ff7,
- 0x7ff8, 0x7ff9, 0x7ffa, 0x7ffb, 0x7ffc, 0x7ffd, 0x7ffe, 0x7fff,
- 0x0006,
-};
-
-static const uint8_t dv_vlc_len[409] = {
-  2,  3,  4,  4,  4,  5,  5,  5,
-  5,  6,  6,  6,  6,  7,  7,  7,
-  7,  7,  7,  7,  7,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9, 10, 10, 10,
- 10, 10, 10, 10, 11, 11, 11, 11,
- 11, 11, 11, 11, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
-  4,
-};
-
-static const uint8_t dv_vlc_run[409] = {
-  0,  0,  1,  0,  0,  2,  1,  0,
-  0,  3,  4,  0,  0,  5,  6,  2,
-  1,  1,  0,  0,  0,  7,  8,  9,
- 10,  3,  4,  2,  1,  1,  1,  0,
-  0,  0,  0,  0,  0, 11, 12, 13,
- 14,  5,  6,  3,  4,  2,  2,  1,
-  0,  0,  0,  0,  0,  5,  3,  3,
-  2,  1,  1,  1,  0,  1,  6,  4,
-  3,  1,  1,  1,  2,  3,  4,  5,
-  7,  8,  9, 10,  7,  8,  4,  3,
-  2,  2,  2,  2,  2,  1,  1,  1,
-  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, 57, 58, 59, 60, 61, 62, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-127,
-};
-
-static const uint8_t dv_vlc_level[409] = {
-   1,   2,   1,   3,   4,   1,   2,   5,
-   6,   1,   1,   7,   8,   1,   1,   2,
-   3,   4,   9,  10,  11,   1,   1,   1,
-   1,   2,   2,   3,   5,   6,   7,  12,
-  13,  14,  15,  16,  17,   1,   1,   1,
-   1,   2,   2,   3,   3,   4,   5,   8,
-  18,  19,  20,  21,  22,   3,   4,   5,
-   6,   9,  10,  11,   0,   0,   3,   4,
-   6,  12,  13,  14,   0,   0,   0,   0,
-   2,   2,   2,   2,   3,   3,   5,   7,
-   7,   8,   9,  10,  11,  15,  16,  17,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   0,   0,   0,   0,   0,   0,   0,   0,
-   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,  57,  58,  59,  60,  61,  62,  63,
-  64,  65,  66,  67,  68,  69,  70,  71,
-  72,  73,  74,  75,  76,  77,  78,  79,
-  80,  81,  82,  83,  84,  85,  86,  87,
-  88,  89,  90,  91,  92,  93,  94,  95,
-  96,  97,  98,  99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135,
- 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159,
- 160, 161, 162, 163, 164, 165, 166, 167,
- 168, 169, 170, 171, 172, 173, 174, 175,
- 176, 177, 178, 179, 180, 181, 182, 183,
- 184, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 204, 205, 206, 207,
- 208, 209, 210, 211, 212, 213, 214, 215,
- 216, 217, 218, 219, 220, 221, 222, 223,
- 224, 225, 226, 227, 228, 229, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247,
- 248, 249, 250, 251, 252, 253, 254, 255,
-   0,
-};
-
-#endif /* AVCODEC_DV_VLC_DATA_H */
diff --git a/libavcodec/dvbsub.c b/libavcodec/dvbsub.c
deleted file mode 100644
index 0f09826..0000000
--- a/libavcodec/dvbsub.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * DVB subtitle encoding for ffmpeg
- * Copyright (c) 2005 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "bytestream.h"
-#include "colorspace.h"
-
-typedef struct DVBSubtitleContext {
-    int hide_state;
-    int object_version;
-} DVBSubtitleContext;
-
-#define PUTBITS2(val)\
-{\
-    bitbuf |= (val) << bitcnt;\
-    bitcnt -= 2;\
-    if (bitcnt < 0) {\
-        bitcnt = 6;\
-        *q++ = bitbuf;\
-        bitbuf = 0;\
-    }\
-}
-
-static void dvb_encode_rle2(uint8_t **pq,
-                            const uint8_t *bitmap, int linesize,
-                            int w, int h)
-{
-    uint8_t *q;
-    unsigned int bitbuf;
-    int bitcnt;
-    int x, y, len, x1, v, color;
-
-    q = *pq;
-
-    for(y = 0; y < h; y++) {
-        *q++ = 0x10;
-        bitbuf = 0;
-        bitcnt = 6;
-
-        x = 0;
-        while (x < w) {
-            x1 = x;
-            color = bitmap[x1++];
-            while (x1 < w && bitmap[x1] == color)
-                x1++;
-            len = x1 - x;
-            if (color == 0 && len == 2) {
-                PUTBITS2(0);
-                PUTBITS2(0);
-                PUTBITS2(1);
-            } else if (len >= 3 && len <= 10) {
-                v = len - 3;
-                PUTBITS2(0);
-                PUTBITS2((v >> 2) | 2);
-                PUTBITS2(v & 3);
-                PUTBITS2(color);
-            } else if (len >= 12 && len <= 27) {
-                v = len - 12;
-                PUTBITS2(0);
-                PUTBITS2(0);
-                PUTBITS2(2);
-                PUTBITS2(v >> 2);
-                PUTBITS2(v & 3);
-                PUTBITS2(color);
-            } else if (len >= 29) {
-                /* length = 29 ... 284 */
-                if (len > 284)
-                    len = 284;
-                v = len - 29;
-                PUTBITS2(0);
-                PUTBITS2(0);
-                PUTBITS2(3);
-                PUTBITS2((v >> 6));
-                PUTBITS2((v >> 4) & 3);
-                PUTBITS2((v >> 2) & 3);
-                PUTBITS2(v & 3);
-                PUTBITS2(color);
-            } else {
-                PUTBITS2(color);
-                if (color == 0) {
-                    PUTBITS2(1);
-                }
-                len = 1;
-            }
-            x += len;
-        }
-        /* end of line */
-        PUTBITS2(0);
-        PUTBITS2(0);
-        PUTBITS2(0);
-        if (bitcnt != 6) {
-            *q++ = bitbuf;
-        }
-        *q++ = 0xf0;
-        bitmap += linesize;
-    }
-    *pq = q;
-}
-
-#define PUTBITS4(val)\
-{\
-    bitbuf |= (val) << bitcnt;\
-    bitcnt -= 4;\
-    if (bitcnt < 0) {\
-        bitcnt = 4;\
-        *q++ = bitbuf;\
-        bitbuf = 0;\
-    }\
-}
-
-/* some DVB decoders only implement 4 bits/pixel */
-static void dvb_encode_rle4(uint8_t **pq,
-                            const uint8_t *bitmap, int linesize,
-                            int w, int h)
-{
-    uint8_t *q;
-    unsigned int bitbuf;
-    int bitcnt;
-    int x, y, len, x1, v, color;
-
-    q = *pq;
-
-    for(y = 0; y < h; y++) {
-        *q++ = 0x11;
-        bitbuf = 0;
-        bitcnt = 4;
-
-        x = 0;
-        while (x < w) {
-            x1 = x;
-            color = bitmap[x1++];
-            while (x1 < w && bitmap[x1] == color)
-                x1++;
-            len = x1 - x;
-            if (color == 0 && len == 2) {
-                PUTBITS4(0);
-                PUTBITS4(0xd);
-            } else if (color == 0 && (len >= 3 && len <= 9)) {
-                PUTBITS4(0);
-                PUTBITS4(len - 2);
-            } else if (len >= 4 && len <= 7) {
-                PUTBITS4(0);
-                PUTBITS4(8 + len - 4);
-                PUTBITS4(color);
-            } else if (len >= 9 && len <= 24) {
-                PUTBITS4(0);
-                PUTBITS4(0xe);
-                PUTBITS4(len - 9);
-                PUTBITS4(color);
-            } else if (len >= 25) {
-                if (len > 280)
-                    len = 280;
-                v = len - 25;
-                PUTBITS4(0);
-                PUTBITS4(0xf);
-                PUTBITS4(v >> 4);
-                PUTBITS4(v & 0xf);
-                PUTBITS4(color);
-            } else {
-                PUTBITS4(color);
-                if (color == 0) {
-                    PUTBITS4(0xc);
-                }
-                len = 1;
-            }
-            x += len;
-        }
-        /* end of line */
-        PUTBITS4(0);
-        PUTBITS4(0);
-        if (bitcnt != 4) {
-            *q++ = bitbuf;
-        }
-        *q++ = 0xf0;
-        bitmap += linesize;
-    }
-    *pq = q;
-}
-
-static int encode_dvb_subtitles(DVBSubtitleContext *s,
-                                uint8_t *outbuf, AVSubtitle *h)
-{
-    uint8_t *q, *pseg_len;
-    int page_id, region_id, clut_id, object_id, i, bpp_index, page_state;
-
-
-    q = outbuf;
-
-    page_id = 1;
-
-    if (h->num_rects == 0 || h->rects == NULL)
-        return -1;
-
-    *q++ = 0x00; /* subtitle_stream_id */
-
-    /* page composition segment */
-
-    *q++ = 0x0f; /* sync_byte */
-    *q++ = 0x10; /* segment_type */
-    bytestream_put_be16(&q, page_id);
-    pseg_len = q;
-    q += 2; /* segment length */
-    *q++ = 30; /* page_timeout (seconds) */
-    if (s->hide_state)
-        page_state = 0; /* normal case */
-    else
-        page_state = 2; /* mode change */
-    /* page_version = 0 + page_state */
-    *q++ = s->object_version | (page_state << 2) | 3;
-
-    for (region_id = 0; region_id < h->num_rects; region_id++) {
-        *q++ = region_id;
-        *q++ = 0xff; /* reserved */
-        bytestream_put_be16(&q, h->rects[region_id]->x); /* left pos */
-        bytestream_put_be16(&q, h->rects[region_id]->y); /* top pos */
-    }
-
-    bytestream_put_be16(&pseg_len, q - pseg_len - 2);
-
-    if (!s->hide_state) {
-        for (clut_id = 0; clut_id < h->num_rects; clut_id++) {
-
-            /* CLUT segment */
-
-            if (h->rects[clut_id]->nb_colors <= 4) {
-                /* 2 bpp, some decoders do not support it correctly */
-                bpp_index = 0;
-            } else if (h->rects[clut_id]->nb_colors <= 16) {
-                /* 4 bpp, standard encoding */
-                bpp_index = 1;
-            } else {
-                return -1;
-            }
-
-            *q++ = 0x0f; /* sync byte */
-            *q++ = 0x12; /* CLUT definition segment */
-            bytestream_put_be16(&q, page_id);
-            pseg_len = q;
-            q += 2; /* segment length */
-            *q++ = clut_id;
-            *q++ = (0 << 4) | 0xf; /* version = 0 */
-
-            for(i = 0; i < h->rects[clut_id]->nb_colors; i++) {
-                *q++ = i; /* clut_entry_id */
-                *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1; /* 2 bits/pixel full range */
-                {
-                    int a, r, g, b;
-                    uint32_t x= ((uint32_t*)h->rects[clut_id]->pict.data[1])[i];
-                    a = (x >> 24) & 0xff;
-                    r = (x >> 16) & 0xff;
-                    g = (x >>  8) & 0xff;
-                    b = (x >>  0) & 0xff;
-
-                    *q++ = RGB_TO_Y_CCIR(r, g, b);
-                    *q++ = RGB_TO_V_CCIR(r, g, b, 0);
-                    *q++ = RGB_TO_U_CCIR(r, g, b, 0);
-                    *q++ = 255 - a;
-                }
-            }
-
-            bytestream_put_be16(&pseg_len, q - pseg_len - 2);
-        }
-    }
-
-    for (region_id = 0; region_id < h->num_rects; region_id++) {
-
-        /* region composition segment */
-
-        if (h->rects[region_id]->nb_colors <= 4) {
-            /* 2 bpp, some decoders do not support it correctly */
-            bpp_index = 0;
-        } else if (h->rects[region_id]->nb_colors <= 16) {
-            /* 4 bpp, standard encoding */
-            bpp_index = 1;
-        } else {
-            return -1;
-        }
-
-        *q++ = 0x0f; /* sync_byte */
-        *q++ = 0x11; /* segment_type */
-        bytestream_put_be16(&q, page_id);
-        pseg_len = q;
-        q += 2; /* segment length */
-        *q++ = region_id;
-        *q++ = (s->object_version << 4) | (0 << 3) | 0x07; /* version , no fill */
-        bytestream_put_be16(&q, h->rects[region_id]->w); /* region width */
-        bytestream_put_be16(&q, h->rects[region_id]->h); /* region height */
-        *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
-        *q++ = region_id; /* clut_id == region_id */
-        *q++ = 0; /* 8 bit fill colors */
-        *q++ = 0x03; /* 4 bit and 2 bit fill colors */
-
-        if (!s->hide_state) {
-            bytestream_put_be16(&q, region_id); /* object_id == region_id */
-            *q++ = (0 << 6) | (0 << 4);
-            *q++ = 0;
-            *q++ = 0xf0;
-            *q++ = 0;
-        }
-
-        bytestream_put_be16(&pseg_len, q - pseg_len - 2);
-    }
-
-    if (!s->hide_state) {
-
-        for (object_id = 0; object_id < h->num_rects; object_id++) {
-            /* Object Data segment */
-
-            if (h->rects[object_id]->nb_colors <= 4) {
-                /* 2 bpp, some decoders do not support it correctly */
-                bpp_index = 0;
-            } else if (h->rects[object_id]->nb_colors <= 16) {
-                /* 4 bpp, standard encoding */
-                bpp_index = 1;
-            } else {
-                return -1;
-            }
-
-            *q++ = 0x0f; /* sync byte */
-            *q++ = 0x13;
-            bytestream_put_be16(&q, page_id);
-            pseg_len = q;
-            q += 2; /* segment length */
-
-            bytestream_put_be16(&q, object_id);
-            *q++ = (s->object_version << 4) | (0 << 2) | (0 << 1) | 1; /* version = 0,
-                                                                       onject_coding_method,
-                                                                       non_modifying_color_flag */
-            {
-                uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr;
-                void (*dvb_encode_rle)(uint8_t **pq,
-                                        const uint8_t *bitmap, int linesize,
-                                        int w, int h);
-                ptop_field_len = q;
-                q += 2;
-                pbottom_field_len = q;
-                q += 2;
-
-                if (bpp_index == 0)
-                    dvb_encode_rle = dvb_encode_rle2;
-                else
-                    dvb_encode_rle = dvb_encode_rle4;
-
-                top_ptr = q;
-                dvb_encode_rle(&q, h->rects[object_id]->pict.data[0], h->rects[object_id]->w * 2,
-                                    h->rects[object_id]->w, h->rects[object_id]->h >> 1);
-                bottom_ptr = q;
-                dvb_encode_rle(&q, h->rects[object_id]->pict.data[0] + h->rects[object_id]->w,
-                                    h->rects[object_id]->w * 2, h->rects[object_id]->w,
-                                    h->rects[object_id]->h >> 1);
-
-                bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr);
-                bytestream_put_be16(&pbottom_field_len, q - bottom_ptr);
-            }
-
-            bytestream_put_be16(&pseg_len, q - pseg_len - 2);
-        }
-    }
-
-    /* end of display set segment */
-
-    *q++ = 0x0f; /* sync_byte */
-    *q++ = 0x80; /* segment_type */
-    bytestream_put_be16(&q, page_id);
-    pseg_len = q;
-    q += 2; /* segment length */
-
-    bytestream_put_be16(&pseg_len, q - pseg_len - 2);
-
-    *q++ = 0xff; /* end of PES data */
-
-    s->object_version = (s->object_version + 1) & 0xf;
-    s->hide_state = !s->hide_state;
-    return q - outbuf;
-}
-
-static int dvbsub_encode(AVCodecContext *avctx,
-                       unsigned char *buf, int buf_size, void *data)
-{
-    DVBSubtitleContext *s = avctx->priv_data;
-    AVSubtitle *sub = data;
-    int ret;
-
-    ret = encode_dvb_subtitles(s, buf, sub);
-    return ret;
-}
-
-AVCodec dvbsub_encoder = {
-    "dvbsub",
-    AVMEDIA_TYPE_SUBTITLE,
-    CODEC_ID_DVB_SUBTITLE,
-    sizeof(DVBSubtitleContext),
-    NULL,
-    dvbsub_encode,
-    .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
-};
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
deleted file mode 100644
index c9ccfd0..0000000
--- a/libavcodec/dvbsub_parser.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * DVB subtitle parser for FFmpeg
- * Copyright (c) 2005 Ian Caulfield
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-
-//#define DEBUG
-//#define DEBUG_PACKET_CONTENTS
-
-/* Parser (mostly) copied from dvdsub.c */
-
-#define PARSE_BUF_SIZE  (65536)
-
-
-/* parser definition */
-typedef struct DVBSubParseContext {
-    uint8_t *packet_buf;
-    int packet_start;
-    int packet_index;
-    int in_packet;
-} DVBSubParseContext;
-
-static av_cold int dvbsub_parse_init(AVCodecParserContext *s)
-{
-    DVBSubParseContext *pc = s->priv_data;
-    pc->packet_buf = av_malloc(PARSE_BUF_SIZE);
-
-    return 0;
-}
-
-static int dvbsub_parse(AVCodecParserContext *s,
-                        AVCodecContext *avctx,
-                        const uint8_t **poutbuf, int *poutbuf_size,
-                        const uint8_t *buf, int buf_size)
-{
-    DVBSubParseContext *pc = s->priv_data;
-    uint8_t *p, *p_end;
-    int len, buf_pos = 0;
-
-    dprintf(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n",
-            s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]);
-
-#ifdef DEBUG_PACKET_CONTENTS
-    int i;
-
-    for (i=0; i < buf_size; i++)
-    {
-        av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
-        if (i % 16 == 15)
-            av_log(avctx, AV_LOG_INFO, "\n");
-    }
-
-    if (i % 16 != 0)
-        av_log(avctx, AV_LOG_INFO, "\n");
-
-#endif
-
-    *poutbuf = NULL;
-    *poutbuf_size = 0;
-
-    s->fetch_timestamp = 1;
-
-    if (s->last_pts != s->pts && s->pts != AV_NOPTS_VALUE) /* Start of a new packet */
-    {
-        if (pc->packet_index != pc->packet_start)
-        {
-            dprintf(avctx, "Discarding %d bytes\n",
-                    pc->packet_index - pc->packet_start);
-        }
-
-        pc->packet_start = 0;
-        pc->packet_index = 0;
-
-        if (buf_size < 2 || buf[0] != 0x20 || buf[1] != 0x00) {
-            dprintf(avctx, "Bad packet header\n");
-            return -1;
-        }
-
-        buf_pos = 2;
-
-        pc->in_packet = 1;
-    } else {
-        if (pc->packet_start != 0)
-        {
-            if (pc->packet_index != pc->packet_start)
-            {
-                memmove(pc->packet_buf, pc->packet_buf + pc->packet_start,
-                            pc->packet_index - pc->packet_start);
-
-                pc->packet_index -= pc->packet_start;
-                pc->packet_start = 0;
-            } else {
-                pc->packet_start = 0;
-                pc->packet_index = 0;
-            }
-        }
-    }
-
-    if (buf_size - buf_pos + pc->packet_index > PARSE_BUF_SIZE)
-        return -1;
-
-/* if not currently in a packet, discard data */
-    if (pc->in_packet == 0)
-        return buf_size;
-
-    memcpy(pc->packet_buf + pc->packet_index, buf + buf_pos, buf_size - buf_pos);
-    pc->packet_index += buf_size - buf_pos;
-
-    p = pc->packet_buf;
-    p_end = pc->packet_buf + pc->packet_index;
-
-    while (p < p_end)
-    {
-        if (*p == 0x0f)
-        {
-            if (p + 6 <= p_end)
-            {
-                len = AV_RB16(p + 4);
-
-                if (p + len + 6 <= p_end)
-                {
-                    *poutbuf_size += len + 6;
-
-                    p += len + 6;
-                } else
-                    break;
-            } else
-                break;
-        } else if (*p == 0xff) {
-            if (p + 1 < p_end)
-            {
-                dprintf(avctx, "Junk at end of packet\n");
-            }
-            pc->packet_index = p - pc->packet_buf;
-            pc->in_packet = 0;
-            break;
-        } else {
-            av_log(avctx, AV_LOG_ERROR, "Junk in packet\n");
-
-            pc->packet_index = p - pc->packet_buf;
-            pc->in_packet = 0;
-            break;
-        }
-    }
-
-    if (*poutbuf_size > 0)
-    {
-        *poutbuf = pc->packet_buf;
-        pc->packet_start = *poutbuf_size;
-    }
-
-    if (s->pts == AV_NOPTS_VALUE)
-        s->pts = s->last_pts;
-
-    return buf_size;
-}
-
-static av_cold void dvbsub_parse_close(AVCodecParserContext *s)
-{
-    DVBSubParseContext *pc = s->priv_data;
-    av_freep(&pc->packet_buf);
-}
-
-AVCodecParser dvbsub_parser = {
-    { CODEC_ID_DVB_SUBTITLE },
-    sizeof(DVBSubParseContext),
-    dvbsub_parse_init,
-    dvbsub_parse,
-    dvbsub_parse_close,
-};
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
deleted file mode 100644
index 54c74b5..0000000
--- a/libavcodec/dvbsubdec.c
+++ /dev/null
@@ -1,1424 +0,0 @@
-/*
- * DVB subtitle decoding for ffmpeg
- * Copyright (c) 2005 Ian Caulfield
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-#include "colorspace.h"
-
-//#define DEBUG
-//#define DEBUG_PACKET_CONTENTS
-//#define DEBUG_SAVE_IMAGES
-
-#define DVBSUB_PAGE_SEGMENT     0x10
-#define DVBSUB_REGION_SEGMENT   0x11
-#define DVBSUB_CLUT_SEGMENT     0x12
-#define DVBSUB_OBJECT_SEGMENT   0x13
-#define DVBSUB_DISPLAY_SEGMENT  0x80
-
-#define cm (ff_cropTbl + MAX_NEG_CROP)
-
-#ifdef DEBUG_SAVE_IMAGES
-#undef fprintf
-#if 0
-static void png_save(const char *filename, uint8_t *bitmap, int w, int h,
-                     uint32_t *rgba_palette)
-{
-    int x, y, v;
-    FILE *f;
-    char fname[40], fname2[40];
-    char command[1024];
-
-    snprintf(fname, 40, "%s.ppm", filename);
-
-    f = fopen(fname, "w");
-    if (!f) {
-        perror(fname);
-        exit(1);
-    }
-    fprintf(f, "P6\n"
-            "%d %d\n"
-            "%d\n",
-            w, h, 255);
-    for(y = 0; y < h; y++) {
-        for(x = 0; x < w; x++) {
-            v = rgba_palette[bitmap[y * w + x]];
-            putc((v >> 16) & 0xff, f);
-            putc((v >> 8) & 0xff, f);
-            putc((v >> 0) & 0xff, f);
-        }
-    }
-    fclose(f);
-
-
-    snprintf(fname2, 40, "%s-a.pgm", filename);
-
-    f = fopen(fname2, "w");
-    if (!f) {
-        perror(fname2);
-        exit(1);
-    }
-    fprintf(f, "P5\n"
-            "%d %d\n"
-            "%d\n",
-            w, h, 255);
-    for(y = 0; y < h; y++) {
-        for(x = 0; x < w; x++) {
-            v = rgba_palette[bitmap[y * w + x]];
-            putc((v >> 24) & 0xff, f);
-        }
-    }
-    fclose(f);
-
-    snprintf(command, 1024, "pnmtopng -alpha %s %s > %s.png 2> /dev/null", fname2, fname, filename);
-    system(command);
-
-    snprintf(command, 1024, "rm %s %s", fname, fname2);
-    system(command);
-}
-#endif
-
-static void png_save2(const char *filename, uint32_t *bitmap, int w, int h)
-{
-    int x, y, v;
-    FILE *f;
-    char fname[40], fname2[40];
-    char command[1024];
-
-    snprintf(fname, sizeof(fname), "%s.ppm", filename);
-
-    f = fopen(fname, "w");
-    if (!f) {
-        perror(fname);
-        exit(1);
-    }
-    fprintf(f, "P6\n"
-            "%d %d\n"
-            "%d\n",
-            w, h, 255);
-    for(y = 0; y < h; y++) {
-        for(x = 0; x < w; x++) {
-            v = bitmap[y * w + x];
-            putc((v >> 16) & 0xff, f);
-            putc((v >> 8) & 0xff, f);
-            putc((v >> 0) & 0xff, f);
-        }
-    }
-    fclose(f);
-
-
-    snprintf(fname2, sizeof(fname2), "%s-a.pgm", filename);
-
-    f = fopen(fname2, "w");
-    if (!f) {
-        perror(fname2);
-        exit(1);
-    }
-    fprintf(f, "P5\n"
-            "%d %d\n"
-            "%d\n",
-            w, h, 255);
-    for(y = 0; y < h; y++) {
-        for(x = 0; x < w; x++) {
-            v = bitmap[y * w + x];
-            putc((v >> 24) & 0xff, f);
-        }
-    }
-    fclose(f);
-
-    snprintf(command, sizeof(command), "pnmtopng -alpha %s %s > %s.png 2> /dev/null", fname2, fname, filename);
-    system(command);
-
-    snprintf(command, sizeof(command), "rm %s %s", fname, fname2);
-    system(command);
-}
-#endif
-
-#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-typedef struct DVBSubCLUT {
-    int id;
-
-    uint32_t clut4[4];
-    uint32_t clut16[16];
-    uint32_t clut256[256];
-
-    struct DVBSubCLUT *next;
-} DVBSubCLUT;
-
-static DVBSubCLUT default_clut;
-
-typedef struct DVBSubObjectDisplay {
-    int object_id;
-    int region_id;
-
-    int x_pos;
-    int y_pos;
-
-    int fgcolor;
-    int bgcolor;
-
-    struct DVBSubObjectDisplay *region_list_next;
-    struct DVBSubObjectDisplay *object_list_next;
-} DVBSubObjectDisplay;
-
-typedef struct DVBSubObject {
-    int id;
-
-    int type;
-
-    DVBSubObjectDisplay *display_list;
-
-    struct DVBSubObject *next;
-} DVBSubObject;
-
-typedef struct DVBSubRegionDisplay {
-    int region_id;
-
-    int x_pos;
-    int y_pos;
-
-    struct DVBSubRegionDisplay *next;
-} DVBSubRegionDisplay;
-
-typedef struct DVBSubRegion {
-    int id;
-
-    int width;
-    int height;
-    int depth;
-
-    int clut;
-    int bgcolor;
-
-    uint8_t *pbuf;
-    int buf_size;
-
-    DVBSubObjectDisplay *display_list;
-
-    struct DVBSubRegion *next;
-} DVBSubRegion;
-
-typedef struct DVBSubContext {
-    int composition_id;
-    int ancillary_id;
-
-    int time_out;
-    DVBSubRegion *region_list;
-    DVBSubCLUT   *clut_list;
-    DVBSubObject *object_list;
-
-    int display_list_size;
-    DVBSubRegionDisplay *display_list;
-} DVBSubContext;
-
-
-static DVBSubObject* get_object(DVBSubContext *ctx, int object_id)
-{
-    DVBSubObject *ptr = ctx->object_list;
-
-    while (ptr && ptr->id != object_id) {
-        ptr = ptr->next;
-    }
-
-    return ptr;
-}
-
-static DVBSubCLUT* get_clut(DVBSubContext *ctx, int clut_id)
-{
-    DVBSubCLUT *ptr = ctx->clut_list;
-
-    while (ptr && ptr->id != clut_id) {
-        ptr = ptr->next;
-    }
-
-    return ptr;
-}
-
-static DVBSubRegion* get_region(DVBSubContext *ctx, int region_id)
-{
-    DVBSubRegion *ptr = ctx->region_list;
-
-    while (ptr && ptr->id != region_id) {
-        ptr = ptr->next;
-    }
-
-    return ptr;
-}
-
-static void delete_region_display_list(DVBSubContext *ctx, DVBSubRegion *region)
-{
-    DVBSubObject *object, *obj2, **obj2_ptr;
-    DVBSubObjectDisplay *display, *obj_disp, **obj_disp_ptr;
-
-    while (region->display_list) {
-        display = region->display_list;
-
-        object = get_object(ctx, display->object_id);
-
-        if (object) {
-            obj_disp_ptr = &object->display_list;
-            obj_disp = *obj_disp_ptr;
-
-            while (obj_disp && obj_disp != display) {
-                obj_disp_ptr = &obj_disp->object_list_next;
-                obj_disp = *obj_disp_ptr;
-            }
-
-            if (obj_disp) {
-                *obj_disp_ptr = obj_disp->object_list_next;
-
-                if (!object->display_list) {
-                    obj2_ptr = &ctx->object_list;
-                    obj2 = *obj2_ptr;
-
-                    while (obj2 != object) {
-                        assert(obj2);
-                        obj2_ptr = &obj2->next;
-                        obj2 = *obj2_ptr;
-                    }
-
-                    *obj2_ptr = obj2->next;
-
-                    av_free(obj2);
-                }
-            }
-        }
-
-        region->display_list = display->region_list_next;
-
-        av_free(display);
-    }
-
-}
-
-static void delete_state(DVBSubContext *ctx)
-{
-    DVBSubRegion *region;
-    DVBSubCLUT *clut;
-
-    while (ctx->region_list) {
-        region = ctx->region_list;
-
-        ctx->region_list = region->next;
-
-        delete_region_display_list(ctx, region);
-        if (region->pbuf)
-            av_free(region->pbuf);
-
-        av_free(region);
-    }
-
-    while (ctx->clut_list) {
-        clut = ctx->clut_list;
-
-        ctx->clut_list = clut->next;
-
-        av_free(clut);
-    }
-
-    /* Should already be null */
-    if (ctx->object_list)
-        av_log(0, AV_LOG_ERROR, "Memory deallocation error!\n");
-}
-
-static av_cold int dvbsub_init_decoder(AVCodecContext *avctx)
-{
-    int i, r, g, b, a = 0;
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-
-    memset(avctx->priv_data, 0, sizeof(DVBSubContext));
-
-    ctx->composition_id = avctx->sub_id & 0xffff;
-    ctx->ancillary_id = avctx->sub_id >> 16;
-
-    default_clut.id = -1;
-    default_clut.next = NULL;
-
-    default_clut.clut4[0] = RGBA(  0,   0,   0,   0);
-    default_clut.clut4[1] = RGBA(255, 255, 255, 255);
-    default_clut.clut4[2] = RGBA(  0,   0,   0, 255);
-    default_clut.clut4[3] = RGBA(127, 127, 127, 255);
-
-    default_clut.clut16[0] = RGBA(  0,   0,   0,   0);
-    for (i = 1; i < 16; i++) {
-        if (i < 8) {
-            r = (i & 1) ? 255 : 0;
-            g = (i & 2) ? 255 : 0;
-            b = (i & 4) ? 255 : 0;
-        } else {
-            r = (i & 1) ? 127 : 0;
-            g = (i & 2) ? 127 : 0;
-            b = (i & 4) ? 127 : 0;
-        }
-        default_clut.clut16[i] = RGBA(r, g, b, 255);
-    }
-
-    default_clut.clut256[0] = RGBA(  0,   0,   0,   0);
-    for (i = 1; i < 256; i++) {
-        if (i < 8) {
-            r = (i & 1) ? 255 : 0;
-            g = (i & 2) ? 255 : 0;
-            b = (i & 4) ? 255 : 0;
-            a = 63;
-        } else {
-            switch (i & 0x88) {
-            case 0x00:
-                r = ((i & 1) ? 85 : 0) + ((i & 0x10) ? 170 : 0);
-                g = ((i & 2) ? 85 : 0) + ((i & 0x20) ? 170 : 0);
-                b = ((i & 4) ? 85 : 0) + ((i & 0x40) ? 170 : 0);
-                a = 255;
-                break;
-            case 0x08:
-                r = ((i & 1) ? 85 : 0) + ((i & 0x10) ? 170 : 0);
-                g = ((i & 2) ? 85 : 0) + ((i & 0x20) ? 170 : 0);
-                b = ((i & 4) ? 85 : 0) + ((i & 0x40) ? 170 : 0);
-                a = 127;
-                break;
-            case 0x80:
-                r = 127 + ((i & 1) ? 43 : 0) + ((i & 0x10) ? 85 : 0);
-                g = 127 + ((i & 2) ? 43 : 0) + ((i & 0x20) ? 85 : 0);
-                b = 127 + ((i & 4) ? 43 : 0) + ((i & 0x40) ? 85 : 0);
-                a = 255;
-                break;
-            case 0x88:
-                r = ((i & 1) ? 43 : 0) + ((i & 0x10) ? 85 : 0);
-                g = ((i & 2) ? 43 : 0) + ((i & 0x20) ? 85 : 0);
-                b = ((i & 4) ? 43 : 0) + ((i & 0x40) ? 85 : 0);
-                a = 255;
-                break;
-            }
-        }
-        default_clut.clut256[i] = RGBA(r, g, b, a);
-    }
-
-    return 0;
-}
-
-static av_cold int dvbsub_close_decoder(AVCodecContext *avctx)
-{
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-    DVBSubRegionDisplay *display;
-
-    delete_state(ctx);
-
-    while (ctx->display_list) {
-        display = ctx->display_list;
-        ctx->display_list = display->next;
-
-        av_free(display);
-    }
-
-    return 0;
-}
-
-static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
-                                   const uint8_t **srcbuf, int buf_size,
-                                   int non_mod, uint8_t *map_table)
-{
-    GetBitContext gb;
-
-    int bits;
-    int run_length;
-    int pixels_read = 0;
-
-    init_get_bits(&gb, *srcbuf, buf_size << 3);
-
-    while (get_bits_count(&gb) < buf_size << 3 && pixels_read < dbuf_len) {
-        bits = get_bits(&gb, 2);
-
-        if (bits) {
-            if (non_mod != 1 || bits != 1) {
-                if (map_table)
-                    *destbuf++ = map_table[bits];
-                else
-                    *destbuf++ = bits;
-            }
-            pixels_read++;
-        } else {
-            bits = get_bits1(&gb);
-            if (bits == 1) {
-                run_length = get_bits(&gb, 3) + 3;
-                bits = get_bits(&gb, 2);
-
-                if (non_mod == 1 && bits == 1)
-                    pixels_read += run_length;
-                else {
-                    if (map_table)
-                        bits = map_table[bits];
-                    while (run_length-- > 0 && pixels_read < dbuf_len) {
-                        *destbuf++ = bits;
-                        pixels_read++;
-                    }
-                }
-            } else {
-                bits = get_bits1(&gb);
-                if (bits == 0) {
-                    bits = get_bits(&gb, 2);
-                    if (bits == 2) {
-                        run_length = get_bits(&gb, 4) + 12;
-                        bits = get_bits(&gb, 2);
-
-                        if (non_mod == 1 && bits == 1)
-                            pixels_read += run_length;
-                        else {
-                            if (map_table)
-                                bits = map_table[bits];
-                            while (run_length-- > 0 && pixels_read < dbuf_len) {
-                                *destbuf++ = bits;
-                                pixels_read++;
-                            }
-                        }
-                    } else if (bits == 3) {
-                        run_length = get_bits(&gb, 8) + 29;
-                        bits = get_bits(&gb, 2);
-
-                        if (non_mod == 1 && bits == 1)
-                            pixels_read += run_length;
-                        else {
-                            if (map_table)
-                                bits = map_table[bits];
-                            while (run_length-- > 0 && pixels_read < dbuf_len) {
-                                *destbuf++ = bits;
-                                pixels_read++;
-                            }
-                        }
-                    } else if (bits == 1) {
-                        pixels_read += 2;
-                        if (map_table)
-                            bits = map_table[0];
-                        else
-                            bits = 0;
-                        if (pixels_read <= dbuf_len) {
-                            *destbuf++ = bits;
-                            *destbuf++ = bits;
-                        }
-                    } else {
-                        (*srcbuf) += (get_bits_count(&gb) + 7) >> 3;
-                        return pixels_read;
-                    }
-                } else {
-                    if (map_table)
-                        bits = map_table[0];
-                    else
-                        bits = 0;
-                    *destbuf++ = bits;
-                    pixels_read++;
-                }
-            }
-        }
-    }
-
-    if (get_bits(&gb, 6))
-        av_log(0, AV_LOG_ERROR, "DVBSub error: line overflow\n");
-
-    (*srcbuf) += (get_bits_count(&gb) + 7) >> 3;
-
-    return pixels_read;
-}
-
-static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
-                                   const uint8_t **srcbuf, int buf_size,
-                                   int non_mod, uint8_t *map_table)
-{
-    GetBitContext gb;
-
-    int bits;
-    int run_length;
-    int pixels_read = 0;
-
-    init_get_bits(&gb, *srcbuf, buf_size << 3);
-
-    while (get_bits_count(&gb) < buf_size << 3 && pixels_read < dbuf_len) {
-        bits = get_bits(&gb, 4);
-
-        if (bits) {
-            if (non_mod != 1 || bits != 1) {
-                if (map_table)
-                    *destbuf++ = map_table[bits];
-                else
-                    *destbuf++ = bits;
-            }
-            pixels_read++;
-        } else {
-            bits = get_bits1(&gb);
-            if (bits == 0) {
-                run_length = get_bits(&gb, 3);
-
-                if (run_length == 0) {
-                    (*srcbuf) += (get_bits_count(&gb) + 7) >> 3;
-                    return pixels_read;
-                }
-
-                run_length += 2;
-
-                if (map_table)
-                    bits = map_table[0];
-                else
-                    bits = 0;
-
-                while (run_length-- > 0 && pixels_read < dbuf_len) {
-                    *destbuf++ = bits;
-                    pixels_read++;
-                }
-            } else {
-                bits = get_bits1(&gb);
-                if (bits == 0) {
-                    run_length = get_bits(&gb, 2) + 4;
-                    bits = get_bits(&gb, 4);
-
-                    if (non_mod == 1 && bits == 1)
-                        pixels_read += run_length;
-                    else {
-                        if (map_table)
-                            bits = map_table[bits];
-                        while (run_length-- > 0 && pixels_read < dbuf_len) {
-                            *destbuf++ = bits;
-                            pixels_read++;
-                        }
-                    }
-                } else {
-                    bits = get_bits(&gb, 2);
-                    if (bits == 2) {
-                        run_length = get_bits(&gb, 4) + 9;
-                        bits = get_bits(&gb, 4);
-
-                        if (non_mod == 1 && bits == 1)
-                            pixels_read += run_length;
-                        else {
-                            if (map_table)
-                                bits = map_table[bits];
-                            while (run_length-- > 0 && pixels_read < dbuf_len) {
-                                *destbuf++ = bits;
-                                pixels_read++;
-                            }
-                        }
-                    } else if (bits == 3) {
-                        run_length = get_bits(&gb, 8) + 25;
-                        bits = get_bits(&gb, 4);
-
-                        if (non_mod == 1 && bits == 1)
-                            pixels_read += run_length;
-                        else {
-                            if (map_table)
-                                bits = map_table[bits];
-                            while (run_length-- > 0 && pixels_read < dbuf_len) {
-                                *destbuf++ = bits;
-                                pixels_read++;
-                            }
-                        }
-                    } else if (bits == 1) {
-                        pixels_read += 2;
-                        if (map_table)
-                            bits = map_table[0];
-                        else
-                            bits = 0;
-                        if (pixels_read <= dbuf_len) {
-                            *destbuf++ = bits;
-                            *destbuf++ = bits;
-                        }
-                    } else {
-                        if (map_table)
-                            bits = map_table[0];
-                        else
-                            bits = 0;
-                        *destbuf++ = bits;
-                        pixels_read ++;
-                    }
-                }
-            }
-        }
-    }
-
-    if (get_bits(&gb, 8))
-        av_log(0, AV_LOG_ERROR, "DVBSub error: line overflow\n");
-
-    (*srcbuf) += (get_bits_count(&gb) + 7) >> 3;
-
-    return pixels_read;
-}
-
-static int dvbsub_read_8bit_string(uint8_t *destbuf, int dbuf_len,
-                                    const uint8_t **srcbuf, int buf_size,
-                                    int non_mod, uint8_t *map_table)
-{
-    const uint8_t *sbuf_end = (*srcbuf) + buf_size;
-    int bits;
-    int run_length;
-    int pixels_read = 0;
-
-    while (*srcbuf < sbuf_end && pixels_read < dbuf_len) {
-        bits = *(*srcbuf)++;
-
-        if (bits) {
-            if (non_mod != 1 || bits != 1) {
-                if (map_table)
-                    *destbuf++ = map_table[bits];
-                else
-                    *destbuf++ = bits;
-            }
-            pixels_read++;
-        } else {
-            bits = *(*srcbuf)++;
-            run_length = bits & 0x7f;
-            if ((bits & 0x80) == 0) {
-                if (run_length == 0) {
-                    return pixels_read;
-                }
-
-                if (map_table)
-                    bits = map_table[0];
-                else
-                    bits = 0;
-                while (run_length-- > 0 && pixels_read < dbuf_len) {
-                    *destbuf++ = bits;
-                    pixels_read++;
-                }
-            } else {
-                bits = *(*srcbuf)++;
-
-                if (non_mod == 1 && bits == 1)
-                    pixels_read += run_length;
-                if (map_table)
-                    bits = map_table[bits];
-                else while (run_length-- > 0 && pixels_read < dbuf_len) {
-                    *destbuf++ = bits;
-                    pixels_read++;
-                }
-            }
-        }
-    }
-
-    if (*(*srcbuf)++)
-        av_log(0, AV_LOG_ERROR, "DVBSub error: line overflow\n");
-
-    return pixels_read;
-}
-
-
-
-static void dvbsub_parse_pixel_data_block(AVCodecContext *avctx, DVBSubObjectDisplay *display,
-                                          const uint8_t *buf, int buf_size, int top_bottom, int non_mod)
-{
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-
-    DVBSubRegion *region = get_region(ctx, display->region_id);
-    const uint8_t *buf_end = buf + buf_size;
-    uint8_t *pbuf;
-    int x_pos, y_pos;
-    int i;
-
-    uint8_t map2to4[] = { 0x0,  0x7,  0x8,  0xf};
-    uint8_t map2to8[] = {0x00, 0x77, 0x88, 0xff};
-    uint8_t map4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
-                         0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
-    uint8_t *map_table;
-
-    dprintf(avctx, "DVB pixel block size %d, %s field:\n", buf_size,
-            top_bottom ? "bottom" : "top");
-
-#ifdef DEBUG_PACKET_CONTENTS
-    for (i = 0; i < buf_size; i++) {
-        if (i % 16 == 0)
-            av_log(avctx, AV_LOG_INFO, "0x%08p: ", buf+i);
-
-        av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
-        if (i % 16 == 15)
-            av_log(avctx, AV_LOG_INFO, "\n");
-    }
-
-    if (i % 16)
-        av_log(avctx, AV_LOG_INFO, "\n");
-
-#endif
-
-    if (region == 0)
-        return;
-
-    pbuf = region->pbuf;
-
-    x_pos = display->x_pos;
-    y_pos = display->y_pos;
-
-    if ((y_pos & 1) != top_bottom)
-        y_pos++;
-
-    while (buf < buf_end) {
-        if (x_pos > region->width || y_pos > region->height) {
-            av_log(avctx, AV_LOG_ERROR, "Invalid object location!\n");
-            return;
-        }
-
-        switch (*buf++) {
-        case 0x10:
-            if (region->depth == 8)
-                map_table = map2to8;
-            else if (region->depth == 4)
-                map_table = map2to4;
-            else
-                map_table = NULL;
-
-            x_pos += dvbsub_read_2bit_string(pbuf + (y_pos * region->width) + x_pos,
-                                                region->width - x_pos, &buf, buf_size,
-                                                non_mod, map_table);
-            break;
-        case 0x11:
-            if (region->depth < 4) {
-                av_log(avctx, AV_LOG_ERROR, "4-bit pixel string in %d-bit region!\n", region->depth);
-                return;
-            }
-
-            if (region->depth == 8)
-                map_table = map4to8;
-            else
-                map_table = NULL;
-
-            x_pos += dvbsub_read_4bit_string(pbuf + (y_pos * region->width) + x_pos,
-                                                region->width - x_pos, &buf, buf_size,
-                                                non_mod, map_table);
-            break;
-        case 0x12:
-            if (region->depth < 8) {
-                av_log(avctx, AV_LOG_ERROR, "8-bit pixel string in %d-bit region!\n", region->depth);
-                return;
-            }
-
-            x_pos += dvbsub_read_8bit_string(pbuf + (y_pos * region->width) + x_pos,
-                                                region->width - x_pos, &buf, buf_size,
-                                                non_mod, NULL);
-            break;
-
-        case 0x20:
-            map2to4[0] = (*buf) >> 4;
-            map2to4[1] = (*buf++) & 0xf;
-            map2to4[2] = (*buf) >> 4;
-            map2to4[3] = (*buf++) & 0xf;
-            break;
-        case 0x21:
-            for (i = 0; i < 4; i++)
-                map2to8[i] = *buf++;
-            break;
-        case 0x22:
-            for (i = 0; i < 16; i++)
-                map4to8[i] = *buf++;
-            break;
-
-        case 0xf0:
-            x_pos = display->x_pos;
-            y_pos += 2;
-            break;
-        default:
-            av_log(avctx, AV_LOG_INFO, "Unknown/unsupported pixel block 0x%x\n", *(buf-1));
-        }
-    }
-
-}
-
-static void dvbsub_parse_object_segment(AVCodecContext *avctx,
-                                        const uint8_t *buf, int buf_size)
-{
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-
-    const uint8_t *buf_end = buf + buf_size;
-    const uint8_t *block;
-    int object_id;
-    DVBSubObject *object;
-    DVBSubObjectDisplay *display;
-    int top_field_len, bottom_field_len;
-
-    int coding_method, non_modifying_color;
-
-    object_id = AV_RB16(buf);
-    buf += 2;
-
-    object = get_object(ctx, object_id);
-
-    if (!object)
-        return;
-
-    coding_method = ((*buf) >> 2) & 3;
-    non_modifying_color = ((*buf++) >> 1) & 1;
-
-    if (coding_method == 0) {
-        top_field_len = AV_RB16(buf);
-        buf += 2;
-        bottom_field_len = AV_RB16(buf);
-        buf += 2;
-
-        if (buf + top_field_len + bottom_field_len > buf_end) {
-            av_log(avctx, AV_LOG_ERROR, "Field data size too large\n");
-            return;
-        }
-
-        for (display = object->display_list; display; display = display->object_list_next) {
-            block = buf;
-
-            dvbsub_parse_pixel_data_block(avctx, display, block, top_field_len, 0,
-                                            non_modifying_color);
-
-            if (bottom_field_len > 0)
-                block = buf + top_field_len;
-            else
-                bottom_field_len = top_field_len;
-
-            dvbsub_parse_pixel_data_block(avctx, display, block, bottom_field_len, 1,
-                                            non_modifying_color);
-        }
-
-/*  } else if (coding_method == 1) {*/
-
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "Unknown object coding %d\n", coding_method);
-    }
-
-}
-
-static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
-                                        const uint8_t *buf, int buf_size)
-{
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-
-    const uint8_t *buf_end = buf + buf_size;
-    int clut_id;
-    DVBSubCLUT *clut;
-    int entry_id, depth , full_range;
-    int y, cr, cb, alpha;
-    int r, g, b, r_add, g_add, b_add;
-
-#ifdef DEBUG_PACKET_CONTENTS
-    int i;
-
-    av_log(avctx, AV_LOG_INFO, "DVB clut packet:\n");
-
-    for (i=0; i < buf_size; i++) {
-        av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
-        if (i % 16 == 15)
-            av_log(avctx, AV_LOG_INFO, "\n");
-    }
-
-    if (i % 16)
-        av_log(avctx, AV_LOG_INFO, "\n");
-
-#endif
-
-    clut_id = *buf++;
-    buf += 1;
-
-    clut = get_clut(ctx, clut_id);
-
-    if (!clut) {
-        clut = av_malloc(sizeof(DVBSubCLUT));
-
-        memcpy(clut, &default_clut, sizeof(DVBSubCLUT));
-
-        clut->id = clut_id;
-
-        clut->next = ctx->clut_list;
-        ctx->clut_list = clut;
-    }
-
-    while (buf + 4 < buf_end) {
-        entry_id = *buf++;
-
-        depth = (*buf) & 0xe0;
-
-        if (depth == 0) {
-            av_log(avctx, AV_LOG_ERROR, "Invalid clut depth 0x%x!\n", *buf);
-            return;
-        }
-
-        full_range = (*buf++) & 1;
-
-        if (full_range) {
-            y = *buf++;
-            cr = *buf++;
-            cb = *buf++;
-            alpha = *buf++;
-        } else {
-            y = buf[0] & 0xfc;
-            cr = (((buf[0] & 3) << 2) | ((buf[1] >> 6) & 3)) << 4;
-            cb = (buf[1] << 2) & 0xf0;
-            alpha = (buf[1] << 6) & 0xc0;
-
-            buf += 2;
-        }
-
-        if (y == 0)
-            alpha = 0xff;
-
-        YUV_TO_RGB1_CCIR(cb, cr);
-        YUV_TO_RGB2_CCIR(r, g, b, y);
-
-        dprintf(avctx, "clut %d := (%d,%d,%d,%d)\n", entry_id, r, g, b, alpha);
-
-        if (depth & 0x80)
-            clut->clut4[entry_id] = RGBA(r,g,b,255 - alpha);
-        if (depth & 0x40)
-            clut->clut16[entry_id] = RGBA(r,g,b,255 - alpha);
-        if (depth & 0x20)
-            clut->clut256[entry_id] = RGBA(r,g,b,255 - alpha);
-    }
-}
-
-
-static void dvbsub_parse_region_segment(AVCodecContext *avctx,
-                                        const uint8_t *buf, int buf_size)
-{
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-
-    const uint8_t *buf_end = buf + buf_size;
-    int region_id, object_id;
-    DVBSubRegion *region;
-    DVBSubObject *object;
-    DVBSubObjectDisplay *display;
-    int fill;
-
-    if (buf_size < 10)
-        return;
-
-    region_id = *buf++;
-
-    region = get_region(ctx, region_id);
-
-    if (!region) {
-        region = av_mallocz(sizeof(DVBSubRegion));
-
-        region->id = region_id;
-
-        region->next = ctx->region_list;
-        ctx->region_list = region;
-    }
-
-    fill = ((*buf++) >> 3) & 1;
-
-    region->width = AV_RB16(buf);
-    buf += 2;
-    region->height = AV_RB16(buf);
-    buf += 2;
-
-    if (region->width * region->height != region->buf_size) {
-        if (region->pbuf)
-            av_free(region->pbuf);
-
-        region->buf_size = region->width * region->height;
-
-        region->pbuf = av_malloc(region->buf_size);
-
-        fill = 1;
-    }
-
-    region->depth = 1 << (((*buf++) >> 2) & 7);
-    if(region->depth<2 || region->depth>8){
-        av_log(avctx, AV_LOG_ERROR, "region depth %d is invalid\n", region->depth);
-        region->depth= 4;
-    }
-    region->clut = *buf++;
-
-    if (region->depth == 8)
-        region->bgcolor = *buf++;
-    else {
-        buf += 1;
-
-        if (region->depth == 4)
-            region->bgcolor = (((*buf++) >> 4) & 15);
-        else
-            region->bgcolor = (((*buf++) >> 2) & 3);
-    }
-
-    dprintf(avctx, "Region %d, (%dx%d)\n", region_id, region->width, region->height);
-
-    if (fill) {
-        memset(region->pbuf, region->bgcolor, region->buf_size);
-        dprintf(avctx, "Fill region (%d)\n", region->bgcolor);
-    }
-
-    delete_region_display_list(ctx, region);
-
-    while (buf + 5 < buf_end) {
-        object_id = AV_RB16(buf);
-        buf += 2;
-
-        object = get_object(ctx, object_id);
-
-        if (!object) {
-            object = av_mallocz(sizeof(DVBSubObject));
-
-            object->id = object_id;
-            object->next = ctx->object_list;
-            ctx->object_list = object;
-        }
-
-        object->type = (*buf) >> 6;
-
-        display = av_mallocz(sizeof(DVBSubObjectDisplay));
-
-        display->object_id = object_id;
-        display->region_id = region_id;
-
-        display->x_pos = AV_RB16(buf) & 0xfff;
-        buf += 2;
-        display->y_pos = AV_RB16(buf) & 0xfff;
-        buf += 2;
-
-        if ((object->type == 1 || object->type == 2) && buf+1 < buf_end) {
-            display->fgcolor = *buf++;
-            display->bgcolor = *buf++;
-        }
-
-        display->region_list_next = region->display_list;
-        region->display_list = display;
-
-        display->object_list_next = object->display_list;
-        object->display_list = display;
-    }
-}
-
-static void dvbsub_parse_page_segment(AVCodecContext *avctx,
-                                        const uint8_t *buf, int buf_size)
-{
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-    DVBSubRegionDisplay *display;
-    DVBSubRegionDisplay *tmp_display_list, **tmp_ptr;
-
-    const uint8_t *buf_end = buf + buf_size;
-    int region_id;
-    int page_state;
-
-    if (buf_size < 1)
-        return;
-
-    ctx->time_out = *buf++;
-    page_state = ((*buf++) >> 2) & 3;
-
-    dprintf(avctx, "Page time out %ds, state %d\n", ctx->time_out, page_state);
-
-    if (page_state == 2) {
-        delete_state(ctx);
-    }
-
-    tmp_display_list = ctx->display_list;
-    ctx->display_list = NULL;
-    ctx->display_list_size = 0;
-
-    while (buf + 5 < buf_end) {
-        region_id = *buf++;
-        buf += 1;
-
-        display = tmp_display_list;
-        tmp_ptr = &tmp_display_list;
-
-        while (display && display->region_id != region_id) {
-            tmp_ptr = &display->next;
-            display = display->next;
-        }
-
-        if (!display)
-            display = av_mallocz(sizeof(DVBSubRegionDisplay));
-
-        display->region_id = region_id;
-
-        display->x_pos = AV_RB16(buf);
-        buf += 2;
-        display->y_pos = AV_RB16(buf);
-        buf += 2;
-
-        *tmp_ptr = display->next;
-
-        display->next = ctx->display_list;
-        ctx->display_list = display;
-        ctx->display_list_size++;
-
-        dprintf(avctx, "Region %d, (%d,%d)\n", region_id, display->x_pos, display->y_pos);
-    }
-
-    while (tmp_display_list) {
-        display = tmp_display_list;
-
-        tmp_display_list = display->next;
-
-        av_free(display);
-    }
-
-}
-
-
-#ifdef DEBUG_SAVE_IMAGES
-static void save_display_set(DVBSubContext *ctx)
-{
-    DVBSubRegion *region;
-    DVBSubRegionDisplay *display;
-    DVBSubCLUT *clut;
-    uint32_t *clut_table;
-    int x_pos, y_pos, width, height;
-    int x, y, y_off, x_off;
-    uint32_t *pbuf;
-    char filename[32];
-    static int fileno_index = 0;
-
-    x_pos = -1;
-    y_pos = -1;
-    width = 0;
-    height = 0;
-
-    for (display = ctx->display_list; display; display = display->next) {
-        region = get_region(ctx, display->region_id);
-
-        if (x_pos == -1) {
-            x_pos = display->x_pos;
-            y_pos = display->y_pos;
-            width = region->width;
-            height = region->height;
-        } else {
-            if (display->x_pos < x_pos) {
-                width += (x_pos - display->x_pos);
-                x_pos = display->x_pos;
-            }
-
-            if (display->y_pos < y_pos) {
-                height += (y_pos - display->y_pos);
-                y_pos = display->y_pos;
-            }
-
-            if (display->x_pos + region->width > x_pos + width) {
-                width = display->x_pos + region->width - x_pos;
-            }
-
-            if (display->y_pos + region->height > y_pos + height) {
-                height = display->y_pos + region->height - y_pos;
-            }
-        }
-    }
-
-    if (x_pos >= 0) {
-
-        pbuf = av_malloc(width * height * 4);
-
-        for (display = ctx->display_list; display; display = display->next) {
-            region = get_region(ctx, display->region_id);
-
-            x_off = display->x_pos - x_pos;
-            y_off = display->y_pos - y_pos;
-
-            clut = get_clut(ctx, region->clut);
-
-            if (clut == 0)
-                clut = &default_clut;
-
-            switch (region->depth) {
-            case 2:
-                clut_table = clut->clut4;
-                break;
-            case 8:
-                clut_table = clut->clut256;
-                break;
-            case 4:
-            default:
-                clut_table = clut->clut16;
-                break;
-            }
-
-            for (y = 0; y < region->height; y++) {
-                for (x = 0; x < region->width; x++) {
-                    pbuf[((y + y_off) * width) + x_off + x] =
-                        clut_table[region->pbuf[y * region->width + x]];
-                }
-            }
-
-        }
-
-        snprintf(filename, sizeof(filename), "dvbs.%d", fileno_index);
-
-        png_save2(filename, pbuf, width, height);
-
-        av_free(pbuf);
-    }
-
-    fileno_index++;
-}
-#endif
-
-static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
-                                        int buf_size, AVSubtitle *sub)
-{
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-
-    DVBSubRegion *region;
-    DVBSubRegionDisplay *display;
-    AVSubtitleRect *rect;
-    DVBSubCLUT *clut;
-    uint32_t *clut_table;
-    int i;
-
-    sub->rects = NULL;
-    sub->start_display_time = 0;
-    sub->end_display_time = ctx->time_out * 1000;
-    sub->format = 0;
-
-    sub->num_rects = ctx->display_list_size;
-
-    if (sub->num_rects > 0){
-        sub->rects = av_mallocz(sizeof(*sub->rects) * sub->num_rects);
-        for(i=0; i<sub->num_rects; i++)
-            sub->rects[i] = av_mallocz(sizeof(*sub->rects[i]));
-    }
-
-    i = 0;
-
-    for (display = ctx->display_list; display; display = display->next) {
-        region = get_region(ctx, display->region_id);
-        rect = sub->rects[i];
-
-        if (!region)
-            continue;
-
-        rect->x = display->x_pos;
-        rect->y = display->y_pos;
-        rect->w = region->width;
-        rect->h = region->height;
-        rect->nb_colors = 16;
-        rect->type      = SUBTITLE_BITMAP;
-        rect->pict.linesize[0] = region->width;
-
-        clut = get_clut(ctx, region->clut);
-
-        if (!clut)
-            clut = &default_clut;
-
-        switch (region->depth) {
-        case 2:
-            clut_table = clut->clut4;
-            break;
-        case 8:
-            clut_table = clut->clut256;
-            break;
-        case 4:
-        default:
-            clut_table = clut->clut16;
-            break;
-        }
-
-        rect->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
-        memcpy(rect->pict.data[1], clut_table, (1 << region->depth) * sizeof(uint32_t));
-
-        rect->pict.data[0] = av_malloc(region->buf_size);
-        memcpy(rect->pict.data[0], region->pbuf, region->buf_size);
-
-        i++;
-    }
-
-    sub->num_rects = i;
-
-#ifdef DEBUG_SAVE_IMAGES
-    save_display_set(ctx);
-#endif
-
-    return 1;
-}
-
-static int dvbsub_decode(AVCodecContext *avctx,
-                         void *data, int *data_size,
-                         AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    DVBSubContext *ctx = (DVBSubContext*) avctx->priv_data;
-    AVSubtitle *sub = (AVSubtitle*) data;
-    const uint8_t *p, *p_end;
-    int segment_type;
-    int page_id;
-    int segment_length;
-
-#ifdef DEBUG_PACKET_CONTENTS
-    int i;
-
-    av_log(avctx, AV_LOG_INFO, "DVB sub packet:\n");
-
-    for (i=0; i < buf_size; i++) {
-        av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
-        if (i % 16 == 15)
-            av_log(avctx, AV_LOG_INFO, "\n");
-    }
-
-    if (i % 16)
-        av_log(avctx, AV_LOG_INFO, "\n");
-
-#endif
-
-    if (buf_size <= 2)
-        return -1;
-
-    p = buf;
-    p_end = buf + buf_size;
-
-    while (p < p_end && *p == 0x0f) {
-        p += 1;
-        segment_type = *p++;
-        page_id = AV_RB16(p);
-        p += 2;
-        segment_length = AV_RB16(p);
-        p += 2;
-
-        if (page_id == ctx->composition_id || page_id == ctx->ancillary_id) {
-            switch (segment_type) {
-            case DVBSUB_PAGE_SEGMENT:
-                dvbsub_parse_page_segment(avctx, p, segment_length);
-                break;
-            case DVBSUB_REGION_SEGMENT:
-                dvbsub_parse_region_segment(avctx, p, segment_length);
-                break;
-            case DVBSUB_CLUT_SEGMENT:
-                dvbsub_parse_clut_segment(avctx, p, segment_length);
-                break;
-            case DVBSUB_OBJECT_SEGMENT:
-                dvbsub_parse_object_segment(avctx, p, segment_length);
-                break;
-            case DVBSUB_DISPLAY_SEGMENT:
-                *data_size = dvbsub_display_end_segment(avctx, p, segment_length, sub);
-                break;
-            default:
-                dprintf(avctx, "Subtitling segment type 0x%x, page id %d, length %d\n",
-                        segment_type, page_id, segment_length);
-                break;
-            }
-        }
-
-        p += segment_length;
-    }
-
-    if (p != p_end) {
-        dprintf(avctx, "Junk at end of packet\n");
-        return -1;
-    }
-
-    return buf_size;
-}
-
-
-AVCodec dvbsub_decoder = {
-    "dvbsub",
-    AVMEDIA_TYPE_SUBTITLE,
-    CODEC_ID_DVB_SUBTITLE,
-    sizeof(DVBSubContext),
-    dvbsub_init_decoder,
-    NULL,
-    dvbsub_close_decoder,
-    dvbsub_decode,
-    .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
-};
diff --git a/libavcodec/dvdata.c b/libavcodec/dvdata.c
deleted file mode 100644
index 7232baf..0000000
--- a/libavcodec/dvdata.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Constants for DV codec
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Constants for DV codec.
- */
-
-#include "libavutil/rational.h"
-#include "avcodec.h"
-#include "dvdata.h"
-
-static DVwork_chunk work_chunks_dv25pal   [1*12*27];
-static DVwork_chunk work_chunks_dv25pal411[1*12*27];
-static DVwork_chunk work_chunks_dv25ntsc  [1*10*27];
-static DVwork_chunk work_chunks_dv50pal   [2*12*27];
-static DVwork_chunk work_chunks_dv50ntsc  [2*10*27];
-static DVwork_chunk work_chunks_dv100palp [2*12*27];
-static DVwork_chunk work_chunks_dv100ntscp[2*10*27];
-static DVwork_chunk work_chunks_dv100pali [4*12*27];
-static DVwork_chunk work_chunks_dv100ntsci[4*10*27];
-
-static uint32_t dv_idct_factor_sd    [2*2*22*64];
-static uint32_t dv_idct_factor_hd1080[2*4*16*64];
-static uint32_t dv_idct_factor_hd720 [2*4*16*64];
-
-static const DVprofile dv_profiles[] = {
-    { .dsf = 0,
-      .video_stype = 0x0,
-      .frame_size = 120000,        /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */
-      .difseg_size = 10,
-      .n_difchan = 1,
-      .time_base = { 1001, 30000 },
-      .ltc_divisor = 30,
-      .height = 480,
-      .width = 720,
-      .sar = {{10, 11}, {40, 33}},
-      .work_chunks = &work_chunks_dv25ntsc[0],
-      .idct_factor = &dv_idct_factor_sd[0],
-      .pix_fmt = PIX_FMT_YUV411P,
-      .bpm = 6,
-      .block_sizes = block_sizes_dv2550,
-      .audio_stride = 90,
-      .audio_min_samples  = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
-      .audio_shuffle = dv_audio_shuffle525,
-    },
-    { .dsf = 1,
-      .video_stype = 0x0,
-      .frame_size = 144000,        /* IEC 61834 - 625/50 (PAL) */
-      .difseg_size = 12,
-      .n_difchan = 1,
-      .time_base = { 1, 25 },
-      .ltc_divisor = 25,
-      .height = 576,
-      .width = 720,
-      .sar = {{59, 54}, {118, 81}},
-      .work_chunks = &work_chunks_dv25pal[0],
-      .idct_factor = &dv_idct_factor_sd[0],
-      .pix_fmt = PIX_FMT_YUV420P,
-      .bpm = 6,
-      .block_sizes = block_sizes_dv2550,
-      .audio_stride = 108,
-      .audio_min_samples  = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
-      .audio_shuffle = dv_audio_shuffle625,
-    },
-    { .dsf = 1,
-      .video_stype = 0x0,
-      .frame_size = 144000,        /* SMPTE-314M - 625/50 (PAL) */
-      .difseg_size = 12,
-      .n_difchan = 1,
-      .time_base = { 1, 25 },
-      .ltc_divisor = 25,
-      .height = 576,
-      .width = 720,
-      .sar = {{59, 54}, {118, 81}},
-      .work_chunks = &work_chunks_dv25pal411[0],
-      .idct_factor = &dv_idct_factor_sd[0],
-      .pix_fmt = PIX_FMT_YUV411P,
-      .bpm = 6,
-      .block_sizes = block_sizes_dv2550,
-      .audio_stride = 108,
-      .audio_min_samples  = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
-      .audio_shuffle = dv_audio_shuffle625,
-    },
-    { .dsf = 0,
-      .video_stype = 0x4,
-      .frame_size = 240000,        /* SMPTE-314M - 525/60 (NTSC) 50 Mbps */
-      .difseg_size = 10,           /* also known as "DVCPRO50" */
-      .n_difchan = 2,
-      .time_base = { 1001, 30000 },
-      .ltc_divisor = 30,
-      .height = 480,
-      .width = 720,
-      .sar = {{10, 11}, {40, 33}},
-      .work_chunks = &work_chunks_dv50ntsc[0],
-      .idct_factor = &dv_idct_factor_sd[0],
-      .pix_fmt = PIX_FMT_YUV422P,
-      .bpm = 6,
-      .block_sizes = block_sizes_dv2550,
-      .audio_stride = 90,
-      .audio_min_samples  = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
-      .audio_shuffle = dv_audio_shuffle525,
-    },
-    { .dsf = 1,
-      .video_stype = 0x4,
-      .frame_size = 288000,        /* SMPTE-314M - 625/50 (PAL) 50 Mbps */
-      .difseg_size = 12,           /* also known as "DVCPRO50" */
-      .n_difchan = 2,
-      .time_base = { 1, 25 },
-      .ltc_divisor = 25,
-      .height = 576,
-      .width = 720,
-      .sar = {{59, 54}, {118, 81}},
-      .work_chunks = &work_chunks_dv50pal[0],
-      .idct_factor = &dv_idct_factor_sd[0],
-      .pix_fmt = PIX_FMT_YUV422P,
-      .bpm = 6,
-      .block_sizes = block_sizes_dv2550,
-      .audio_stride = 108,
-      .audio_min_samples  = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
-      .audio_shuffle = dv_audio_shuffle625,
-    },
-    { .dsf = 0,
-      .video_stype = 0x14,
-      .frame_size = 480000,        /* SMPTE-370M - 1080i60 100 Mbps */
-      .difseg_size = 10,           /* also known as "DVCPRO HD" */
-      .n_difchan = 4,
-      .time_base = { 1001, 30000 },
-      .ltc_divisor = 30,
-      .height = 1080,
-      .width = 1280,
-      .sar = {{1, 1}, {3, 2}},
-      .work_chunks = &work_chunks_dv100ntsci[0],
-      .idct_factor = &dv_idct_factor_hd1080[0],
-      .pix_fmt = PIX_FMT_YUV422P,
-      .bpm = 8,
-      .block_sizes = block_sizes_dv100,
-      .audio_stride = 90,
-      .audio_min_samples  = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
-      .audio_shuffle = dv_audio_shuffle525,
-    },
-    { .dsf = 1,
-      .video_stype = 0x14,
-      .frame_size = 576000,        /* SMPTE-370M - 1080i50 100 Mbps */
-      .difseg_size = 12,           /* also known as "DVCPRO HD" */
-      .n_difchan = 4,
-      .time_base = { 1, 25 },
-      .ltc_divisor = 25,
-      .height = 1080,
-      .width = 1440,
-      .sar = {{1, 1}, {4, 3}},
-      .work_chunks = &work_chunks_dv100pali[0],
-      .idct_factor = &dv_idct_factor_hd1080[0],
-      .pix_fmt = PIX_FMT_YUV422P,
-      .bpm = 8,
-      .block_sizes = block_sizes_dv100,
-      .audio_stride = 108,
-      .audio_min_samples  = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
-      .audio_shuffle = dv_audio_shuffle625,
-    },
-    { .dsf = 0,
-      .video_stype = 0x18,
-      .frame_size = 240000,        /* SMPTE-370M - 720p60 100 Mbps */
-      .difseg_size = 10,           /* also known as "DVCPRO HD" */
-      .n_difchan = 2,
-      .time_base = { 1001, 60000 },
-      .ltc_divisor = 60,
-      .height = 720,
-      .width = 960,
-      .sar = {{1, 1}, {4, 3}},
-      .work_chunks = &work_chunks_dv100ntscp[0],
-      .idct_factor = &dv_idct_factor_hd720[0],
-      .pix_fmt = PIX_FMT_YUV422P,
-      .bpm = 8,
-      .block_sizes = block_sizes_dv100,
-      .audio_stride = 90,
-      .audio_min_samples  = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */
-      .audio_shuffle = dv_audio_shuffle525,
-    },
-    { .dsf = 1,
-      .video_stype = 0x18,
-      .frame_size = 288000,        /* SMPTE-370M - 720p50 100 Mbps */
-      .difseg_size = 12,           /* also known as "DVCPRO HD" */
-      .n_difchan = 2,
-      .time_base = { 1, 50 },
-      .ltc_divisor = 50,
-      .height = 720,
-      .width = 960,
-      .sar = {{1, 1}, {4, 3}},
-      .work_chunks = &work_chunks_dv100palp[0],
-      .idct_factor = &dv_idct_factor_hd720[0],
-      .pix_fmt = PIX_FMT_YUV422P,
-      .bpm = 8,
-      .block_sizes = block_sizes_dv100,
-      .audio_stride = 90,
-      .audio_min_samples  = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
-      .audio_shuffle = dv_audio_shuffle625,
-    },
-    { .dsf = 1,
-      .video_stype = 0x1,
-      .frame_size = 144000,        /* IEC 61883-5 - 625/50 (PAL) */
-      .difseg_size = 12,
-      .n_difchan = 1,
-      .time_base = { 1, 25 },
-      .ltc_divisor = 25,
-      .height = 576,
-      .width = 720,
-      .sar = {{59, 54}, {118, 81}},
-      .work_chunks = &work_chunks_dv25pal[0],
-      .idct_factor = &dv_idct_factor_sd[0],
-      .pix_fmt = PIX_FMT_YUV420P,
-      .bpm = 6,
-      .block_sizes = block_sizes_dv2550,
-      .audio_stride = 108,
-      .audio_min_samples  = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */
-      .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 },
-      .audio_shuffle = dv_audio_shuffle625,
-    }
-};
-
-const DVprofile* ff_dv_frame_profile(const DVprofile *sys,
-                                  const uint8_t* frame, unsigned buf_size)
-{
-   int i;
-
-   int dsf = (frame[3] & 0x80) >> 7;
-
-   int stype = frame[80*5 + 48 + 3] & 0x1f;
-
-   /* 576i50 25Mbps 4:1:1 is a special case */
-   if (dsf == 1 && stype == 0 && frame[5] & 0x07) {
-       return &dv_profiles[2];
-   }
-
-   for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
-       if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype)
-           return &dv_profiles[i];
-
-   /* check if old sys matches and assumes corrupted input */
-   if (sys && buf_size == sys->frame_size)
-       return sys;
-
-   return NULL;
-}
-
-const DVprofile* ff_dv_codec_profile(AVCodecContext* codec)
-{
-    int i;
-
-    for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
-       if (codec->height  == dv_profiles[i].height  &&
-           codec->pix_fmt == dv_profiles[i].pix_fmt &&
-           codec->width   == dv_profiles[i].width)
-               return &dv_profiles[i];
-
-    return NULL;
-}
-
diff --git a/libavcodec/dvdata.h b/libavcodec/dvdata.h
deleted file mode 100644
index 90f4059..0000000
--- a/libavcodec/dvdata.h
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Constants for DV codec
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Constants for DV codec.
- */
-
-#ifndef AVCODEC_DVDATA_H
-#define AVCODEC_DVDATA_H
-
-#include "libavutil/rational.h"
-#include "avcodec.h"
-
-typedef struct DVwork_chunk {
-    uint16_t  buf_offset;
-    uint16_t  mb_coordinates[5];
-} DVwork_chunk;
-
-/*
- * DVprofile is used to express the differences between various
- * DV flavors. For now it's primarily used for differentiating
- * 525/60 and 625/50, but the plans are to use it for various
- * DV specs as well (e.g. SMPTE314M vs. IEC 61834).
- */
-typedef struct DVprofile {
-    int              dsf;                   /* value of the dsf in the DV header */
-    int              video_stype;           /* stype for VAUX source pack */
-    int              frame_size;            /* total size of one frame in bytes */
-    int              difseg_size;           /* number of DIF segments per DIF channel */
-    int              n_difchan;             /* number of DIF channels per frame */
-    AVRational       time_base;             /* 1/framerate */
-    int              ltc_divisor;           /* FPS from the LTS standpoint */
-    int              height;                /* picture height in pixels */
-    int              width;                 /* picture width in pixels */
-    AVRational       sar[2];                /* sample aspect ratios for 4:3 and 16:9 */
-    DVwork_chunk    *work_chunks;           /* each thread gets its own chunk of frame to work on */
-    uint32_t        *idct_factor;           /* set of iDCT factor tables */
-    enum PixelFormat pix_fmt;               /* picture pixel format */
-    int              bpm;                   /* blocks per macroblock */
-    const uint8_t   *block_sizes;           /* AC block sizes, in bits */
-    int              audio_stride;          /* size of audio_shuffle table */
-    int              audio_min_samples[3];  /* min amount of audio samples */
-                                            /* for 48kHz, 44.1kHz and 32kHz */
-    int              audio_samples_dist[5]; /* how many samples are supposed to be */
-                                            /* in each frame in a 5 frames window */
-    const uint8_t  (*audio_shuffle)[9];     /* PCM shuffling table */
-} DVprofile;
-
-/* unquant tables (not used directly) */
-static const uint8_t dv_quant_shifts[22][4] = {
-  { 3,3,4,4 },
-  { 3,3,4,4 },
-  { 2,3,3,4 },
-  { 2,3,3,4 },
-  { 2,2,3,3 },
-  { 2,2,3,3 },
-  { 1,2,2,3 },
-  { 1,2,2,3 },
-  { 1,1,2,2 },
-  { 1,1,2,2 },
-  { 0,1,1,2 },
-  { 0,1,1,2 },
-  { 0,0,1,1 },
-  { 0,0,1,1 },
-  { 0,0,0,1 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-  { 0,0,0,0 },
-};
-
-static const uint8_t dv_quant_offset[4] = { 6,  3,  0,  1 };
-static const uint8_t dv_quant_areas[4]  = { 6, 21, 43, 64 };
-
-/* quantization quanta by QNO for DV100 */
-static const uint8_t dv100_qstep[16] = {
-    1, /* QNO = 0 and 1 both have no quantization */
-    1,
-    2, 3, 4, 5, 6, 7, 8, 16, 18, 20, 22, 24, 28, 52
-};
-
-/* DV25/50 DCT coefficient weights and inverse weights */
-/* created by dvtables.py */
-static const int dv_weight_bits = 18;
-static const int dv_weight_88[64] = {
- 131072, 257107, 257107, 242189, 252167, 242189, 235923, 237536,
- 237536, 235923, 229376, 231390, 223754, 231390, 229376, 222935,
- 224969, 217965, 217965, 224969, 222935, 200636, 218652, 211916,
- 212325, 211916, 218652, 200636, 188995, 196781, 205965, 206433,
- 206433, 205965, 196781, 188995, 185364, 185364, 200636, 200704,
- 200636, 185364, 185364, 174609, 180568, 195068, 195068, 180568,
- 174609, 170091, 175557, 189591, 175557, 170091, 165371, 170627,
- 170627, 165371, 160727, 153560, 160727, 144651, 144651, 136258,
-};
-static const int dv_weight_248[64] = {
- 131072, 242189, 257107, 237536, 229376, 200636, 242189, 223754,
- 224969, 196781, 262144, 242189, 229376, 200636, 257107, 237536,
- 211916, 185364, 235923, 217965, 229376, 211916, 206433, 180568,
- 242189, 223754, 224969, 196781, 211916, 185364, 235923, 217965,
- 200704, 175557, 222935, 205965, 200636, 185364, 195068, 170627,
- 229376, 211916, 206433, 180568, 200704, 175557, 222935, 205965,
- 175557, 153560, 188995, 174609, 165371, 144651, 200636, 185364,
- 195068, 170627, 175557, 153560, 188995, 174609, 165371, 144651,
-};
-static const int dv_iweight_bits = 14;
-static const int dv_iweight_88[64] = {
- 32768, 16710, 16710, 17735, 17015, 17735, 18197, 18079,
- 18079, 18197, 18725, 18559, 19196, 18559, 18725, 19284,
- 19108, 19692, 19692, 19108, 19284, 21400, 19645, 20262,
- 20214, 20262, 19645, 21400, 22733, 21845, 20867, 20815,
- 20815, 20867, 21845, 22733, 23173, 23173, 21400, 21400,
- 21400, 23173, 23173, 24600, 23764, 22017, 22017, 23764,
- 24600, 25267, 24457, 22672, 24457, 25267, 25971, 25191,
- 25191, 25971, 26715, 27962, 26715, 29642, 29642, 31536,
-};
-static const int dv_iweight_248[64] = {
- 32768, 17735, 16710, 18079, 18725, 21400, 17735, 19196,
- 19108, 21845, 16384, 17735, 18725, 21400, 16710, 18079,
- 20262, 23173, 18197, 19692, 18725, 20262, 20815, 23764,
- 17735, 19196, 19108, 21845, 20262, 23173, 18197, 19692,
- 21400, 24457, 19284, 20867, 21400, 23173, 22017, 25191,
- 18725, 20262, 20815, 23764, 21400, 24457, 19284, 20867,
- 24457, 27962, 22733, 24600, 25971, 29642, 21400, 23173,
- 22017, 25191, 24457, 27962, 22733, 24600, 25971, 29642,
-};
-
-/**
- * The "inverse" DV100 weights are actually just the spec weights (zig-zagged).
- */
-static const int dv_iweight_1080_y[64] = {
-    128,  16,  16,  17,  17,  17,  18,  18,
-     18,  18,  18,  18,  19,  18,  18,  19,
-     19,  19,  19,  19,  19,  42,  38,  40,
-     40,  40,  38,  42,  44,  43,  41,  41,
-     41,  41,  43,  44,  45,  45,  42,  42,
-     42,  45,  45,  48,  46,  43,  43,  46,
-     48,  49,  48,  44,  48,  49, 101,  98,
-     98, 101, 104, 109, 104, 116, 116, 123,
-};
-static const int dv_iweight_1080_c[64] = {
-    128,  16,  16,  17,  17,  17,  25,  25,
-     25,  25,  26,  25,  26,  25,  26,  26,
-     26,  27,  27,  26,  26,  42,  38,  40,
-     40,  40,  38,  42,  44,  43,  41,  41,
-     41,  41,  43,  44,  91,  91,  84,  84,
-     84,  91,  91,  96,  93,  86,  86,  93,
-     96, 197, 191, 177, 191, 197, 203, 197,
-    197, 203, 209, 219, 209, 232, 232, 246,
-};
-static const int dv_iweight_720_y[64] = {
-    128,  16,  16,  17,  17,  17,  18,  18,
-     18,  18,  18,  18,  19,  18,  18,  19,
-     19,  19,  19,  19,  19,  42,  38,  40,
-     40,  40,  38,  42,  44,  43,  41,  41,
-     41,  41,  43,  44,  68,  68,  63,  63,
-     63,  68,  68,  96,  92,  86,  86,  92,
-     96,  98,  96,  88,  96,  98, 202, 196,
-    196, 202, 208, 218, 208, 232, 232, 246,
-};
-static const int dv_iweight_720_c[64] = {
-    128,  24,  24,  26,  26,  26,  36,  36,
-     36,  36,  36,  36,  38,  36,  36,  38,
-     38,  38,  38,  38,  38,  84,  76,  80,
-     80,  80,  76,  84,  88,  86,  82,  82,
-     82,  82,  86,  88, 182, 182, 168, 168,
-    168, 182, 182, 192, 186, 192, 172, 186,
-    192, 394, 382, 354, 382, 394, 406, 394,
-    394, 406, 418, 438, 418, 464, 464, 492,
-};
-
-static const uint8_t dv_audio_shuffle525[10][9] = {
-  {  0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */
-  {  6, 36, 66, 26, 56, 86, 16, 46, 76 },
-  { 12, 42, 72,  2, 32, 62, 22, 52, 82 },
-  { 18, 48, 78,  8, 38, 68, 28, 58, 88 },
-  { 24, 54, 84, 14, 44, 74,  4, 34, 64 },
-
-  {  1, 31, 61, 21, 51, 81, 11, 41, 71 }, /* 2nd channel */
-  {  7, 37, 67, 27, 57, 87, 17, 47, 77 },
-  { 13, 43, 73,  3, 33, 63, 23, 53, 83 },
-  { 19, 49, 79,  9, 39, 69, 29, 59, 89 },
-  { 25, 55, 85, 15, 45, 75,  5, 35, 65 },
-};
-
-static const uint8_t dv_audio_shuffle625[12][9] = {
-  {   0,  36,  72,  26,  62,  98,  16,  52,  88}, /* 1st channel */
-  {   6,  42,  78,  32,  68, 104,  22,  58,  94},
-  {  12,  48,  84,   2,  38,  74,  28,  64, 100},
-  {  18,  54,  90,   8,  44,  80,  34,  70, 106},
-  {  24,  60,  96,  14,  50,  86,   4,  40,  76},
-  {  30,  66, 102,  20,  56,  92,  10,  46,  82},
-
-  {   1,  37,  73,  27,  63,  99,  17,  53,  89}, /* 2nd channel */
-  {   7,  43,  79,  33,  69, 105,  23,  59,  95},
-  {  13,  49,  85,   3,  39,  75,  29,  65, 101},
-  {  19,  55,  91,   9,  45,  81,  35,  71, 107},
-  {  25,  61,  97,  15,  51,  87,   5,  41,  77},
-  {  31,  67, 103,  21,  57,  93,  11,  47,  83},
-};
-
-static const av_unused int dv_audio_frequency[3] = {
-    48000, 44100, 32000,
-};
-
-/* macroblock bit budgets */
-static const uint8_t block_sizes_dv2550[8] = {
-    112, 112, 112, 112, 80, 80, 0, 0,
-};
-
-static const uint8_t block_sizes_dv100[8] = {
-    80, 80, 80, 80, 80, 80, 64, 64,
-};
-
-enum dv_section_type {
-     dv_sect_header  = 0x1f,
-     dv_sect_subcode = 0x3f,
-     dv_sect_vaux    = 0x56,
-     dv_sect_audio   = 0x76,
-     dv_sect_video   = 0x96,
-};
-
-enum dv_pack_type {
-     dv_header525     = 0x3f, /* see dv_write_pack for important details on */
-     dv_header625     = 0xbf, /* these two packs */
-     dv_timecode      = 0x13,
-     dv_audio_source  = 0x50,
-     dv_audio_control = 0x51,
-     dv_audio_recdate = 0x52,
-     dv_audio_rectime = 0x53,
-     dv_video_source  = 0x60,
-     dv_video_control = 0x61,
-     dv_video_recdate = 0x62,
-     dv_video_rectime = 0x63,
-     dv_unknown_pack  = 0xff,
-};
-
-#define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10)
-#define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1))
-#define DV_PROFILE_IS_720p50(p)  (((p)->video_stype == 0x18) && ((p)->dsf == 1))
-
-/* minimum number of bytes to read from a DV stream in order to
-   determine the profile */
-#define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */
-
-/**
- * largest possible DV frame, in bytes (1080i50)
- */
-#define DV_MAX_FRAME_SIZE 576000
-
-/**
- * maximum number of blocks per macroblock in any DV format
- */
-#define DV_MAX_BPM 8
-
-const DVprofile* ff_dv_frame_profile(const DVprofile *sys,
-                                  const uint8_t* frame, unsigned buf_size);
-const DVprofile* ff_dv_codec_profile(AVCodecContext* codec);
-
-static inline int dv_write_dif_id(enum dv_section_type t, uint8_t chan_num,
-                                  uint8_t seq_num, uint8_t dif_num,
-                                  uint8_t* buf)
-{
-    buf[0] = (uint8_t)t;       /* Section type */
-    buf[1] = (seq_num  << 4) | /* DIF seq number 0-9 for 525/60; 0-11 for 625/50 */
-             (chan_num << 3) | /* FSC: for 50Mb/s 0 - first channel; 1 - second */
-             7;                /* reserved -- always 1 */
-    buf[2] = dif_num;          /* DIF block number Video: 0-134, Audio: 0-8 */
-    return 3;
-}
-
-
-static inline int dv_write_ssyb_id(uint8_t syb_num, uint8_t fr, uint8_t* buf)
-{
-    if (syb_num == 0 || syb_num == 6) {
-        buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
-                 (0  << 4) | /* AP3 (Subcode application ID) */
-                 0x0f;       /* reserved -- always 1 */
-    }
-    else if (syb_num == 11) {
-        buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
-                 0x7f;       /* reserved -- always 1 */
-    }
-    else {
-        buf[0] = (fr << 7) | /* FR ID 1 - first half of each channel; 0 - second */
-                 (0  << 4) | /* APT (Track application ID) */
-                 0x0f;       /* reserved -- always 1 */
-    }
-    buf[1] = 0xf0 |            /* reserved -- always 1 */
-             (syb_num & 0x0f); /* SSYB number 0 - 11   */
-    buf[2] = 0xff;             /* reserved -- always 1 */
-    return 3;
-}
-
-#endif /* AVCODEC_DVDATA_H */
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
deleted file mode 100644
index 8f1b8d0..0000000
--- a/libavcodec/dvdsub_parser.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * DVD subtitle decoding for ffmpeg
- * Copyright (c) 2005 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-/* parser definition */
-typedef struct DVDSubParseContext {
-    uint8_t *packet;
-    int packet_len;
-    int packet_index;
-} DVDSubParseContext;
-
-static av_cold int dvdsub_parse_init(AVCodecParserContext *s)
-{
-    return 0;
-}
-
-static int dvdsub_parse(AVCodecParserContext *s,
-                        AVCodecContext *avctx,
-                        const uint8_t **poutbuf, int *poutbuf_size,
-                        const uint8_t *buf, int buf_size)
-{
-    DVDSubParseContext *pc = s->priv_data;
-
-    if (pc->packet_index == 0) {
-        if (buf_size < 2)
-            return 0;
-        pc->packet_len = AV_RB16(buf);
-        if (pc->packet_len == 0) /* HD-DVD subpicture packet */
-            pc->packet_len = AV_RB32(buf+2);
-        av_freep(&pc->packet);
-        pc->packet = av_malloc(pc->packet_len);
-    }
-    if (pc->packet) {
-        if (pc->packet_index + buf_size <= pc->packet_len) {
-            memcpy(pc->packet + pc->packet_index, buf, buf_size);
-            pc->packet_index += buf_size;
-            if (pc->packet_index >= pc->packet_len) {
-                *poutbuf = pc->packet;
-                *poutbuf_size = pc->packet_len;
-                pc->packet_index = 0;
-                return buf_size;
-            }
-        } else {
-            /* erroneous size */
-            pc->packet_index = 0;
-        }
-    }
-    *poutbuf = NULL;
-    *poutbuf_size = 0;
-    return buf_size;
-}
-
-static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
-{
-    DVDSubParseContext *pc = s->priv_data;
-    av_freep(&pc->packet);
-}
-
-AVCodecParser dvdsub_parser = {
-    { CODEC_ID_DVD_SUBTITLE },
-    sizeof(DVDSubParseContext),
-    dvdsub_parse_init,
-    dvdsub_parse,
-    dvdsub_parse_close,
-};
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
deleted file mode 100644
index 75b5256..0000000
--- a/libavcodec/dvdsubdec.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * DVD subtitle decoding for ffmpeg
- * Copyright (c) 2005 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "get_bits.h"
-#include "colorspace.h"
-#include "dsputil.h"
-
-//#define DEBUG
-
-static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *rgba, int num_values)
-{
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    uint8_t r, g, b;
-    int i, y, cb, cr;
-    int r_add, g_add, b_add;
-
-    for (i = num_values; i > 0; i--) {
-        y = *ycbcr++;
-        cb = *ycbcr++;
-        cr = *ycbcr++;
-        YUV_TO_RGB1_CCIR(cb, cr);
-        YUV_TO_RGB2_CCIR(r, g, b, y);
-        *rgba++ = (*alpha++ << 24) | (r << 16) | (g << 8) | b;
-    }
-}
-
-static int decode_run_2bit(GetBitContext *gb, int *color)
-{
-    unsigned int v, t;
-
-    v = 0;
-    for (t = 1; v < t && t <= 0x40; t <<= 2)
-        v = (v << 4) | get_bits(gb, 4);
-    *color = v & 3;
-    if (v < 4) { /* Code for fill rest of line */
-        return INT_MAX;
-    }
-    return v >> 2;
-}
-
-static int decode_run_8bit(GetBitContext *gb, int *color)
-{
-    int len;
-    int has_run = get_bits1(gb);
-    if (get_bits1(gb))
-        *color = get_bits(gb, 8);
-    else
-        *color = get_bits(gb, 2);
-    if (has_run) {
-        if (get_bits1(gb)) {
-            len = get_bits(gb, 7);
-            if (len == 0)
-                len = INT_MAX;
-            else
-                len += 9;
-        } else
-            len = get_bits(gb, 3) + 2;
-    } else
-        len = 1;
-    return len;
-}
-
-static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
-                      const uint8_t *buf, int start, int buf_size, int is_8bit)
-{
-    GetBitContext gb;
-    int bit_len;
-    int x, y, len, color;
-    uint8_t *d;
-
-    bit_len = (buf_size - start) * 8;
-    init_get_bits(&gb, buf + start, bit_len);
-
-    x = 0;
-    y = 0;
-    d = bitmap;
-    for(;;) {
-        if (get_bits_count(&gb) > bit_len)
-            return -1;
-        if (is_8bit)
-            len = decode_run_8bit(&gb, &color);
-        else
-            len = decode_run_2bit(&gb, &color);
-        len = FFMIN(len, w - x);
-        memset(d + x, color, len);
-        x += len;
-        if (x >= w) {
-            y++;
-            if (y >= h)
-                break;
-            d += linesize;
-            x = 0;
-            /* byte align */
-            align_get_bits(&gb);
-        }
-    }
-    return 0;
-}
-
-static void guess_palette(uint32_t *rgba_palette,
-                          uint8_t *colormap,
-                          uint8_t *alpha,
-                          uint32_t subtitle_color)
-{
-    uint8_t color_used[16];
-    int nb_opaque_colors, i, level, j, r, g, b;
-
-    for(i = 0; i < 4; i++)
-        rgba_palette[i] = 0;
-
-    memset(color_used, 0, 16);
-    nb_opaque_colors = 0;
-    for(i = 0; i < 4; i++) {
-        if (alpha[i] != 0 && !color_used[colormap[i]]) {
-            color_used[colormap[i]] = 1;
-            nb_opaque_colors++;
-        }
-    }
-
-    if (nb_opaque_colors == 0)
-        return;
-
-    j = nb_opaque_colors;
-    memset(color_used, 0, 16);
-    for(i = 0; i < 4; i++) {
-        if (alpha[i] != 0) {
-            if (!color_used[colormap[i]])  {
-                level = (0xff * j) / nb_opaque_colors;
-                r = (((subtitle_color >> 16) & 0xff) * level) >> 8;
-                g = (((subtitle_color >> 8) & 0xff) * level) >> 8;
-                b = (((subtitle_color >> 0) & 0xff) * level) >> 8;
-                rgba_palette[i] = b | (g << 8) | (r << 16) | ((alpha[i] * 17) << 24);
-                color_used[colormap[i]] = (i + 1);
-                j--;
-            } else {
-                rgba_palette[i] = (rgba_palette[color_used[colormap[i]] - 1] & 0x00ffffff) |
-                                    ((alpha[i] * 17) << 24);
-            }
-        }
-    }
-}
-
-#define READ_OFFSET(a) (big_offsets ? AV_RB32(a) : AV_RB16(a))
-
-static int decode_dvd_subtitles(AVSubtitle *sub_header,
-                                const uint8_t *buf, int buf_size)
-{
-    int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
-    int big_offsets, offset_size, is_8bit = 0;
-    const uint8_t *yuv_palette = 0;
-    uint8_t colormap[4], alpha[256];
-    int date;
-    int i;
-    int is_menu = 0;
-
-    if (buf_size < 10)
-        return -1;
-    memset(sub_header, 0, sizeof(*sub_header));
-
-    if (AV_RB16(buf) == 0) {   /* HD subpicture with 4-byte offsets */
-        big_offsets = 1;
-        offset_size = 4;
-        cmd_pos = 6;
-    } else {
-        big_offsets = 0;
-        offset_size = 2;
-        cmd_pos = 2;
-    }
-
-    cmd_pos = READ_OFFSET(buf + cmd_pos);
-
-    while (cmd_pos > 0 && cmd_pos < buf_size - 2 - offset_size) {
-        date = AV_RB16(buf + cmd_pos);
-        next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2);
-        dprintf(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n",
-                cmd_pos, next_cmd_pos, date);
-        pos = cmd_pos + 2 + offset_size;
-        offset1 = -1;
-        offset2 = -1;
-        x1 = y1 = x2 = y2 = 0;
-        while (pos < buf_size) {
-            cmd = buf[pos++];
-            dprintf(NULL, "cmd=%02x\n", cmd);
-            switch(cmd) {
-            case 0x00:
-                /* menu subpicture */
-                is_menu = 1;
-                break;
-            case 0x01:
-                /* set start date */
-                sub_header->start_display_time = (date << 10) / 90;
-                break;
-            case 0x02:
-                /* set end date */
-                sub_header->end_display_time = (date << 10) / 90;
-                break;
-            case 0x03:
-                /* set colormap */
-                if ((buf_size - pos) < 2)
-                    goto fail;
-                colormap[3] = buf[pos] >> 4;
-                colormap[2] = buf[pos] & 0x0f;
-                colormap[1] = buf[pos + 1] >> 4;
-                colormap[0] = buf[pos + 1] & 0x0f;
-                pos += 2;
-                break;
-            case 0x04:
-                /* set alpha */
-                if ((buf_size - pos) < 2)
-                    goto fail;
-                alpha[3] = buf[pos] >> 4;
-                alpha[2] = buf[pos] & 0x0f;
-                alpha[1] = buf[pos + 1] >> 4;
-                alpha[0] = buf[pos + 1] & 0x0f;
-                pos += 2;
-            dprintf(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
-                break;
-            case 0x05:
-            case 0x85:
-                if ((buf_size - pos) < 6)
-                    goto fail;
-                x1 = (buf[pos] << 4) | (buf[pos + 1] >> 4);
-                x2 = ((buf[pos + 1] & 0x0f) << 8) | buf[pos + 2];
-                y1 = (buf[pos + 3] << 4) | (buf[pos + 4] >> 4);
-                y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5];
-                if (cmd & 0x80)
-                    is_8bit = 1;
-                dprintf(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2);
-                pos += 6;
-                break;
-            case 0x06:
-                if ((buf_size - pos) < 4)
-                    goto fail;
-                offset1 = AV_RB16(buf + pos);
-                offset2 = AV_RB16(buf + pos + 2);
-                dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
-                pos += 4;
-                break;
-            case 0x86:
-                if ((buf_size - pos) < 8)
-                    goto fail;
-                offset1 = AV_RB32(buf + pos);
-                offset2 = AV_RB32(buf + pos + 4);
-                dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
-                pos += 8;
-                break;
-
-            case 0x83:
-                /* HD set palette */
-                if ((buf_size - pos) < 768)
-                    goto fail;
-                yuv_palette = buf + pos;
-                pos += 768;
-                break;
-            case 0x84:
-                /* HD set contrast (alpha) */
-                if ((buf_size - pos) < 256)
-                    goto fail;
-                for (i = 0; i < 256; i++)
-                    alpha[i] = 0xFF - buf[pos+i];
-                pos += 256;
-                break;
-
-            case 0xff:
-                goto the_end;
-            default:
-                dprintf(NULL, "unrecognised subpicture command 0x%x\n", cmd);
-                goto the_end;
-            }
-        }
-    the_end:
-        if (offset1 >= 0) {
-            int w, h;
-            uint8_t *bitmap;
-
-            /* decode the bitmap */
-            w = x2 - x1 + 1;
-            if (w < 0)
-                w = 0;
-            h = y2 - y1;
-            if (h < 0)
-                h = 0;
-            if (w > 0 && h > 0) {
-                if (sub_header->rects != NULL) {
-                    for (i = 0; i < sub_header->num_rects; i++) {
-                        av_freep(&sub_header->rects[i]->pict.data[0]);
-                        av_freep(&sub_header->rects[i]->pict.data[1]);
-                        av_freep(&sub_header->rects[i]);
-                    }
-                    av_freep(&sub_header->rects);
-                    sub_header->num_rects = 0;
-                }
-
-                bitmap = av_malloc(w * h);
-                sub_header->rects = av_mallocz(sizeof(*sub_header->rects));
-                sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect));
-                sub_header->num_rects = 1;
-                sub_header->rects[0]->pict.data[0] = bitmap;
-                decode_rle(bitmap, w * 2, w, (h + 1) / 2,
-                           buf, offset1, buf_size, is_8bit);
-                decode_rle(bitmap + w, w * 2, w, h / 2,
-                           buf, offset2, buf_size, is_8bit);
-                sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
-                if (is_8bit) {
-                    if (yuv_palette == 0)
-                        goto fail;
-                    sub_header->rects[0]->nb_colors = 256;
-                    yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256);
-                } else {
-                    sub_header->rects[0]->nb_colors = 4;
-                    guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1],
-                                  colormap, alpha, 0xffff00);
-                }
-                sub_header->rects[0]->x = x1;
-                sub_header->rects[0]->y = y1;
-                sub_header->rects[0]->w = w;
-                sub_header->rects[0]->h = h;
-                sub_header->rects[0]->type = SUBTITLE_BITMAP;
-                sub_header->rects[0]->pict.linesize[0] = w;
-            }
-        }
-        if (next_cmd_pos == cmd_pos)
-            break;
-        cmd_pos = next_cmd_pos;
-    }
-    if (sub_header->num_rects > 0)
-        return is_menu;
- fail:
-    if (sub_header->rects != NULL) {
-        for (i = 0; i < sub_header->num_rects; i++) {
-            av_freep(&sub_header->rects[i]->pict.data[0]);
-            av_freep(&sub_header->rects[i]->pict.data[1]);
-            av_freep(&sub_header->rects[i]);
-        }
-        av_freep(&sub_header->rects);
-        sub_header->num_rects = 0;
-    }
-    return -1;
-}
-
-static int is_transp(const uint8_t *buf, int pitch, int n,
-                     const uint8_t *transp_color)
-{
-    int i;
-    for(i = 0; i < n; i++) {
-        if (!transp_color[*buf])
-            return 0;
-        buf += pitch;
-    }
-    return 1;
-}
-
-/* return 0 if empty rectangle, 1 if non empty */
-static int find_smallest_bounding_rectangle(AVSubtitle *s)
-{
-    uint8_t transp_color[256];
-    int y1, y2, x1, x2, y, w, h, i;
-    uint8_t *bitmap;
-
-    if (s->num_rects == 0 || s->rects == NULL || s->rects[0]->w <= 0 || s->rects[0]->h <= 0)
-        return 0;
-
-    memset(transp_color, 0, 256);
-    for(i = 0; i < s->rects[0]->nb_colors; i++) {
-        if ((((uint32_t*)s->rects[0]->pict.data[1])[i] >> 24) == 0)
-            transp_color[i] = 1;
-    }
-    y1 = 0;
-    while (y1 < s->rects[0]->h && is_transp(s->rects[0]->pict.data[0] + y1 * s->rects[0]->pict.linesize[0],
-                                  1, s->rects[0]->w, transp_color))
-        y1++;
-    if (y1 == s->rects[0]->h) {
-        av_freep(&s->rects[0]->pict.data[0]);
-        s->rects[0]->w = s->rects[0]->h = 0;
-        return 0;
-    }
-
-    y2 = s->rects[0]->h - 1;
-    while (y2 > 0 && is_transp(s->rects[0]->pict.data[0] + y2 * s->rects[0]->pict.linesize[0], 1,
-                               s->rects[0]->w, transp_color))
-        y2--;
-    x1 = 0;
-    while (x1 < (s->rects[0]->w - 1) && is_transp(s->rects[0]->pict.data[0] + x1, s->rects[0]->pict.linesize[0],
-                                        s->rects[0]->h, transp_color))
-        x1++;
-    x2 = s->rects[0]->w - 1;
-    while (x2 > 0 && is_transp(s->rects[0]->pict.data[0] + x2, s->rects[0]->pict.linesize[0], s->rects[0]->h,
-                                  transp_color))
-        x2--;
-    w = x2 - x1 + 1;
-    h = y2 - y1 + 1;
-    bitmap = av_malloc(w * h);
-    if (!bitmap)
-        return 1;
-    for(y = 0; y < h; y++) {
-        memcpy(bitmap + w * y, s->rects[0]->pict.data[0] + x1 + (y1 + y) * s->rects[0]->pict.linesize[0], w);
-    }
-    av_freep(&s->rects[0]->pict.data[0]);
-    s->rects[0]->pict.data[0] = bitmap;
-    s->rects[0]->pict.linesize[0] = w;
-    s->rects[0]->w = w;
-    s->rects[0]->h = h;
-    s->rects[0]->x += x1;
-    s->rects[0]->y += y1;
-    return 1;
-}
-
-#ifdef DEBUG
-#undef fprintf
-#undef perror
-#undef exit
-static void ppm_save(const char *filename, uint8_t *bitmap, int w, int h,
-                     uint32_t *rgba_palette)
-{
-    int x, y, v;
-    FILE *f;
-
-    f = fopen(filename, "w");
-    if (!f) {
-        perror(filename);
-        exit(1);
-    }
-    fprintf(f, "P6\n"
-            "%d %d\n"
-            "%d\n",
-            w, h, 255);
-    for(y = 0; y < h; y++) {
-        for(x = 0; x < w; x++) {
-            v = rgba_palette[bitmap[y * w + x]];
-            putc((v >> 16) & 0xff, f);
-            putc((v >> 8) & 0xff, f);
-            putc((v >> 0) & 0xff, f);
-        }
-    }
-    fclose(f);
-}
-#endif
-
-static int dvdsub_decode(AVCodecContext *avctx,
-                         void *data, int *data_size,
-                         AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AVSubtitle *sub = (void *)data;
-    int is_menu;
-
-    is_menu = decode_dvd_subtitles(sub, buf, buf_size);
-
-    if (is_menu < 0) {
-    no_subtitle:
-        *data_size = 0;
-
-        return buf_size;
-    }
-    if (!is_menu && find_smallest_bounding_rectangle(sub) == 0)
-        goto no_subtitle;
-
-#if defined(DEBUG)
-    dprintf(NULL, "start=%d ms end =%d ms\n",
-            sub->start_display_time,
-            sub->end_display_time);
-    ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0],
-             sub->rects[0]->w, sub->rects[0]->h, sub->rects[0]->pict.data[1]);
-#endif
-
-    *data_size = 1;
-    return buf_size;
-}
-
-AVCodec dvdsub_decoder = {
-    "dvdsub",
-    AVMEDIA_TYPE_SUBTITLE,
-    CODEC_ID_DVD_SUBTITLE,
-    0,
-    NULL,
-    NULL,
-    NULL,
-    dvdsub_decode,
-    .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
-};
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
deleted file mode 100644
index 4ee0f37..0000000
--- a/libavcodec/dvdsubenc.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * DVD subtitle encoding for ffmpeg
- * Copyright (c) 2005 Wolfram Gloger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "bytestream.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-// ncnt is the nibble counter
-#define PUTNIBBLE(val)\
-do {\
-    if (ncnt++ & 1)\
-        *q++ = bitbuf | ((val) & 0x0f);\
-    else\
-        bitbuf = (val) << 4;\
-} while(0)
-
-static void dvd_encode_rle(uint8_t **pq,
-                           const uint8_t *bitmap, int linesize,
-                           int w, int h,
-                           const int cmap[256])
-{
-    uint8_t *q;
-    unsigned int bitbuf = 0;
-    int ncnt;
-    int x, y, len, color;
-
-    q = *pq;
-
-    for (y = 0; y < h; ++y) {
-        ncnt = 0;
-        for(x = 0; x < w; x += len) {
-            color = bitmap[x];
-            for (len=1; x+len < w; ++len)
-                if (bitmap[x+len] != color)
-                    break;
-            color = cmap[color];
-            assert(color < 4);
-            if (len < 0x04) {
-                PUTNIBBLE((len << 2)|color);
-            } else if (len < 0x10) {
-                PUTNIBBLE(len >> 2);
-                PUTNIBBLE((len << 2)|color);
-            } else if (len < 0x40) {
-                PUTNIBBLE(0);
-                PUTNIBBLE(len >> 2);
-                PUTNIBBLE((len << 2)|color);
-            } else if (x+len == w) {
-                PUTNIBBLE(0);
-                PUTNIBBLE(0);
-                PUTNIBBLE(0);
-                PUTNIBBLE(color);
-            } else {
-                if (len > 0xff)
-                    len = 0xff;
-                PUTNIBBLE(0);
-                PUTNIBBLE(len >> 6);
-                PUTNIBBLE(len >> 2);
-                PUTNIBBLE((len << 2)|color);
-            }
-        }
-        /* end of line */
-        if (ncnt & 1)
-            PUTNIBBLE(0);
-        bitmap += linesize;
-    }
-
-    *pq = q;
-}
-
-static int encode_dvd_subtitles(uint8_t *outbuf, int outbuf_size,
-                                const AVSubtitle *h)
-{
-    uint8_t *q, *qq;
-    int object_id;
-    int offset1[20], offset2[20];
-    int i, imax, color, alpha, rects = h->num_rects;
-    unsigned long hmax;
-    unsigned long hist[256];
-    int           cmap[256];
-
-    if (rects == 0 || h->rects == NULL)
-        return -1;
-    if (rects > 20)
-        rects = 20;
-
-    // analyze bitmaps, compress to 4 colors
-    for (i=0; i<256; ++i) {
-        hist[i] = 0;
-        cmap[i] = 0;
-    }
-    for (object_id = 0; object_id < rects; object_id++)
-        for (i=0; i<h->rects[object_id]->w*h->rects[object_id]->h; ++i) {
-            color = h->rects[object_id]->pict.data[0][i];
-            // only count non-transparent pixels
-            alpha = ((uint32_t*)h->rects[object_id]->pict.data[1])[color] >> 24;
-            hist[color] += alpha;
-        }
-    for (color=3;; --color) {
-        hmax = 0;
-        imax = 0;
-        for (i=0; i<256; ++i)
-            if (hist[i] > hmax) {
-                imax = i;
-                hmax = hist[i];
-            }
-        if (hmax == 0)
-            break;
-        if (color == 0)
-            color = 3;
-        av_log(NULL, AV_LOG_DEBUG, "dvd_subtitle hist[%d]=%ld -> col %d\n",
-               imax, hist[imax], color);
-        cmap[imax] = color;
-        hist[imax] = 0;
-    }
-
-
-    // encode data block
-    q = outbuf + 4;
-    for (object_id = 0; object_id < rects; object_id++) {
-        offset1[object_id] = q - outbuf;
-        // worst case memory requirement: 1 nibble per pixel..
-        if ((q - outbuf) + h->rects[object_id]->w*h->rects[object_id]->h/2
-            + 17*rects + 21 > outbuf_size) {
-            av_log(NULL, AV_LOG_ERROR, "dvd_subtitle too big\n");
-            return -1;
-        }
-        dvd_encode_rle(&q, h->rects[object_id]->pict.data[0],
-                       h->rects[object_id]->w*2,
-                       h->rects[object_id]->w, h->rects[object_id]->h >> 1,
-                       cmap);
-        offset2[object_id] = q - outbuf;
-        dvd_encode_rle(&q, h->rects[object_id]->pict.data[0] + h->rects[object_id]->w,
-                       h->rects[object_id]->w*2,
-                       h->rects[object_id]->w, h->rects[object_id]->h >> 1,
-                       cmap);
-    }
-
-    // set data packet size
-    qq = outbuf + 2;
-    bytestream_put_be16(&qq, q - outbuf);
-
-    // send start display command
-    bytestream_put_be16(&q, (h->start_display_time*90) >> 10);
-    bytestream_put_be16(&q, (q - outbuf) /*- 2 */ + 8 + 12*rects + 2);
-    *q++ = 0x03; // palette - 4 nibbles
-    *q++ = 0x03; *q++ = 0x7f;
-    *q++ = 0x04; // alpha - 4 nibbles
-    *q++ = 0xf0; *q++ = 0x00;
-    //*q++ = 0x0f; *q++ = 0xff;
-
-    // XXX not sure if more than one rect can really be encoded..
-    // 12 bytes per rect
-    for (object_id = 0; object_id < rects; object_id++) {
-        int x2 = h->rects[object_id]->x + h->rects[object_id]->w - 1;
-        int y2 = h->rects[object_id]->y + h->rects[object_id]->h - 1;
-
-        *q++ = 0x05;
-        // x1 x2 -> 6 nibbles
-        *q++ = h->rects[object_id]->x >> 4;
-        *q++ = (h->rects[object_id]->x << 4) | ((x2 >> 8) & 0xf);
-        *q++ = x2;
-        // y1 y2 -> 6 nibbles
-        *q++ = h->rects[object_id]->y >> 4;
-        *q++ = (h->rects[object_id]->y << 4) | ((y2 >> 8) & 0xf);
-        *q++ = y2;
-
-        *q++ = 0x06;
-        // offset1, offset2
-        bytestream_put_be16(&q, offset1[object_id]);
-        bytestream_put_be16(&q, offset2[object_id]);
-    }
-    *q++ = 0x01; // start command
-    *q++ = 0xff; // terminating command
-
-    // send stop display command last
-    bytestream_put_be16(&q, (h->end_display_time*90) >> 10);
-    bytestream_put_be16(&q, (q - outbuf) - 2 /*+ 4*/);
-    *q++ = 0x02; // set end
-    *q++ = 0xff; // terminating command
-
-    qq = outbuf;
-    bytestream_put_be16(&qq, q - outbuf);
-
-    av_log(NULL, AV_LOG_DEBUG, "subtitle_packet size=%td\n", q - outbuf);
-    return q - outbuf;
-}
-
-static int dvdsub_encode(AVCodecContext *avctx,
-                         unsigned char *buf, int buf_size, void *data)
-{
-    //DVDSubtitleContext *s = avctx->priv_data;
-    AVSubtitle *sub = data;
-    int ret;
-
-    ret = encode_dvd_subtitles(buf, buf_size, sub);
-    return ret;
-}
-
-AVCodec dvdsub_encoder = {
-    "dvdsub",
-    AVMEDIA_TYPE_SUBTITLE,
-    CODEC_ID_DVD_SUBTITLE,
-    0,
-    NULL,
-    dvdsub_encode,
-    .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
-};
diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c
deleted file mode 100644
index 2ecb04a..0000000
--- a/libavcodec/dwt.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/*
- * Copyright (C) 2004-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/attributes.h"
-#include "dsputil.h"
-#include "dwt.h"
-
-void ff_slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer)
-{
-    int i;
-
-    buf->base_buffer = base_buffer;
-    buf->line_count = line_count;
-    buf->line_width = line_width;
-    buf->data_count = max_allocated_lines;
-    buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count);
-    buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines);
-
-    for(i = 0; i < max_allocated_lines; i++){
-        buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width);
-    }
-
-    buf->data_stack_top = max_allocated_lines - 1;
-}
-
-IDWTELEM * ff_slice_buffer_load_line(slice_buffer * buf, int line)
-{
-    IDWTELEM * buffer;
-
-    assert(buf->data_stack_top >= 0);
-//  assert(!buf->line[line]);
-    if (buf->line[line])
-        return buf->line[line];
-
-    buffer = buf->data_stack[buf->data_stack_top];
-    buf->data_stack_top--;
-    buf->line[line] = buffer;
-
-    return buffer;
-}
-
-void ff_slice_buffer_release(slice_buffer * buf, int line)
-{
-    IDWTELEM * buffer;
-
-    assert(line >= 0 && line < buf->line_count);
-    assert(buf->line[line]);
-
-    buffer = buf->line[line];
-    buf->data_stack_top++;
-    buf->data_stack[buf->data_stack_top] = buffer;
-    buf->line[line] = NULL;
-}
-
-void ff_slice_buffer_flush(slice_buffer * buf)
-{
-    int i;
-    for(i = 0; i < buf->line_count; i++){
-        if (buf->line[i])
-            ff_slice_buffer_release(buf, i);
-    }
-}
-
-void ff_slice_buffer_destroy(slice_buffer * buf)
-{
-    int i;
-    ff_slice_buffer_flush(buf);
-
-    for(i = buf->data_count - 1; i >= 0; i--){
-        av_freep(&buf->data_stack[i]);
-    }
-    av_freep(&buf->data_stack);
-    av_freep(&buf->line);
-}
-
-static inline int mirror(int v, int m){
-    while((unsigned)v > (unsigned)m){
-        v=-v;
-        if(v<0) v+= 2*m;
-    }
-    return v;
-}
-
-static av_always_inline void
-lift(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
-     int dst_step, int src_step, int ref_step,
-     int width, int mul, int add, int shift,
-     int highpass, int inverse){
-    const int mirror_left= !highpass;
-    const int mirror_right= (width&1) ^ highpass;
-    const int w= (width>>1) - 1 + (highpass & width);
-    int i;
-
-#define LIFT(src, ref, inv) ((src) + ((inv) ? - (ref) : + (ref)))
-    if(mirror_left){
-        dst[0] = LIFT(src[0], ((mul*2*ref[0]+add)>>shift), inverse);
-        dst += dst_step;
-        src += src_step;
-    }
-
-    for(i=0; i<w; i++){
-        dst[i*dst_step] =
-            LIFT(src[i*src_step],
-                 ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift),
-                 inverse);
-    }
-
-    if(mirror_right){
-        dst[w*dst_step] =
-            LIFT(src[w*src_step],
-                 ((mul*2*ref[w*ref_step]+add)>>shift),
-                 inverse);
-    }
-}
-
-static av_always_inline void
-inv_lift(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref,
-         int dst_step, int src_step, int ref_step,
-         int width, int mul, int add, int shift,
-         int highpass, int inverse){
-    const int mirror_left= !highpass;
-    const int mirror_right= (width&1) ^ highpass;
-    const int w= (width>>1) - 1 + (highpass & width);
-    int i;
-
-#define LIFT(src, ref, inv) ((src) + ((inv) ? - (ref) : + (ref)))
-    if(mirror_left){
-        dst[0] = LIFT(src[0], ((mul*2*ref[0]+add)>>shift), inverse);
-        dst += dst_step;
-        src += src_step;
-    }
-
-    for(i=0; i<w; i++){
-        dst[i*dst_step] =
-            LIFT(src[i*src_step],
-                 ((mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add)>>shift),
-                 inverse);
-    }
-
-    if(mirror_right){
-        dst[w*dst_step] =
-            LIFT(src[w*src_step],
-                 ((mul*2*ref[w*ref_step]+add)>>shift),
-                 inverse);
-    }
-}
-
-#ifndef liftS
-static av_always_inline void
-liftS(DWTELEM *dst, DWTELEM *src, DWTELEM *ref,
-      int dst_step, int src_step, int ref_step,
-      int width, int mul, int add, int shift,
-      int highpass, int inverse){
-    const int mirror_left= !highpass;
-    const int mirror_right= (width&1) ^ highpass;
-    const int w= (width>>1) - 1 + (highpass & width);
-    int i;
-
-    assert(shift == 4);
-#define LIFTS(src, ref, inv) \
-        ((inv) ? \
-            (src) + (((ref) + 4*(src))>>shift): \
-            -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23)))
-    if(mirror_left){
-        dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse);
-        dst += dst_step;
-        src += src_step;
-    }
-
-    for(i=0; i<w; i++){
-        dst[i*dst_step] =
-            LIFTS(src[i*src_step],
-                  mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add,
-                  inverse);
-    }
-
-    if(mirror_right){
-        dst[w*dst_step] =
-            LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse);
-    }
-}
-static av_always_inline void
-inv_liftS(IDWTELEM *dst, IDWTELEM *src, IDWTELEM *ref,
-          int dst_step, int src_step, int ref_step,
-          int width, int mul, int add, int shift,
-          int highpass, int inverse){
-    const int mirror_left= !highpass;
-    const int mirror_right= (width&1) ^ highpass;
-    const int w= (width>>1) - 1 + (highpass & width);
-    int i;
-
-    assert(shift == 4);
-#define LIFTS(src, ref, inv) \
-    ((inv) ? \
-        (src) + (((ref) + 4*(src))>>shift): \
-        -((-16*(src) + (ref) + add/4 + 1 + (5<<25))/(5*4) - (1<<23)))
-    if(mirror_left){
-        dst[0] = LIFTS(src[0], mul*2*ref[0]+add, inverse);
-        dst += dst_step;
-        src += src_step;
-    }
-
-    for(i=0; i<w; i++){
-        dst[i*dst_step] =
-            LIFTS(src[i*src_step],
-                  mul*(ref[i*ref_step] + ref[(i+1)*ref_step])+add,
-                  inverse);
-    }
-
-    if(mirror_right){
-        dst[w*dst_step] =
-            LIFTS(src[w*src_step], mul*2*ref[w*ref_step]+add, inverse);
-    }
-}
-#endif /* ! liftS */
-
-static void horizontal_decompose53i(DWTELEM *b, int width){
-    DWTELEM temp[width];
-    const int width2= width>>1;
-    int x;
-    const int w2= (width+1)>>1;
-
-    for(x=0; x<width2; x++){
-        temp[x   ]= b[2*x    ];
-        temp[x+w2]= b[2*x + 1];
-    }
-    if(width&1)
-        temp[x   ]= b[2*x    ];
-#if 0
-    {
-    int A1,A2,A3,A4;
-    A2= temp[1       ];
-    A4= temp[0       ];
-    A1= temp[0+width2];
-    A1 -= (A2 + A4)>>1;
-    A4 += (A1 + 1)>>1;
-    b[0+width2] = A1;
-    b[0       ] = A4;
-    for(x=1; x+1<width2; x+=2){
-        A3= temp[x+width2];
-        A4= temp[x+1     ];
-        A3 -= (A2 + A4)>>1;
-        A2 += (A1 + A3 + 2)>>2;
-        b[x+width2] = A3;
-        b[x       ] = A2;
-
-        A1= temp[x+1+width2];
-        A2= temp[x+2       ];
-        A1 -= (A2 + A4)>>1;
-        A4 += (A1 + A3 + 2)>>2;
-        b[x+1+width2] = A1;
-        b[x+1       ] = A4;
-    }
-    A3= temp[width-1];
-    A3 -= A2;
-    A2 += (A1 + A3 + 2)>>2;
-    b[width -1] = A3;
-    b[width2-1] = A2;
-    }
-#else
-    lift(b+w2, temp+w2, temp, 1, 1, 1, width, -1, 0, 1, 1, 0);
-    lift(b   , temp   , b+w2, 1, 1, 1, width,  1, 2, 2, 0, 0);
-#endif /* 0 */
-}
-
-static void vertical_decompose53iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] -= (b0[i] + b2[i])>>1;
-    }
-}
-
-static void vertical_decompose53iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] += (b0[i] + b2[i] + 2)>>2;
-    }
-}
-
-static void spatial_decompose53i(DWTELEM *buffer, int width, int height, int stride){
-    int y;
-    DWTELEM *b0= buffer + mirror(-2-1, height-1)*stride;
-    DWTELEM *b1= buffer + mirror(-2  , height-1)*stride;
-
-    for(y=-2; y<height; y+=2){
-        DWTELEM *b2= buffer + mirror(y+1, height-1)*stride;
-        DWTELEM *b3= buffer + mirror(y+2, height-1)*stride;
-
-        if(y+1<(unsigned)height) horizontal_decompose53i(b2, width);
-        if(y+2<(unsigned)height) horizontal_decompose53i(b3, width);
-
-        if(y+1<(unsigned)height) vertical_decompose53iH0(b1, b2, b3, width);
-        if(y+0<(unsigned)height) vertical_decompose53iL0(b0, b1, b2, width);
-
-        b0=b2;
-        b1=b3;
-    }
-}
-
-static void horizontal_decompose97i(DWTELEM *b, int width){
-    DWTELEM temp[width];
-    const int w2= (width+1)>>1;
-
-    lift (temp+w2, b    +1, b      , 1, 2, 2, width,  W_AM, W_AO, W_AS, 1, 1);
-    liftS(temp   , b      , temp+w2, 1, 2, 1, width,  W_BM, W_BO, W_BS, 0, 0);
-    lift (b   +w2, temp+w2, temp   , 1, 1, 1, width,  W_CM, W_CO, W_CS, 1, 0);
-    lift (b      , temp   , b   +w2, 1, 1, 1, width,  W_DM, W_DO, W_DS, 0, 0);
-}
-
-
-static void vertical_decompose97iH0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] -= (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
-    }
-}
-
-static void vertical_decompose97iH1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] += (W_CM*(b0[i] + b2[i])+W_CO)>>W_CS;
-    }
-}
-
-static void vertical_decompose97iL0(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-#ifdef liftS
-        b1[i] -= (W_BM*(b0[i] + b2[i])+W_BO)>>W_BS;
-#else
-        b1[i] = (16*4*b1[i] - 4*(b0[i] + b2[i]) + W_BO*5 + (5<<27)) / (5*16) - (1<<23);
-#endif
-    }
-}
-
-static void vertical_decompose97iL1(DWTELEM *b0, DWTELEM *b1, DWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] += (W_DM*(b0[i] + b2[i])+W_DO)>>W_DS;
-    }
-}
-
-static void spatial_decompose97i(DWTELEM *buffer, int width, int height, int stride){
-    int y;
-    DWTELEM *b0= buffer + mirror(-4-1, height-1)*stride;
-    DWTELEM *b1= buffer + mirror(-4  , height-1)*stride;
-    DWTELEM *b2= buffer + mirror(-4+1, height-1)*stride;
-    DWTELEM *b3= buffer + mirror(-4+2, height-1)*stride;
-
-    for(y=-4; y<height; y+=2){
-        DWTELEM *b4= buffer + mirror(y+3, height-1)*stride;
-        DWTELEM *b5= buffer + mirror(y+4, height-1)*stride;
-
-        if(y+3<(unsigned)height) horizontal_decompose97i(b4, width);
-        if(y+4<(unsigned)height) horizontal_decompose97i(b5, width);
-
-        if(y+3<(unsigned)height) vertical_decompose97iH0(b3, b4, b5, width);
-        if(y+2<(unsigned)height) vertical_decompose97iL0(b2, b3, b4, width);
-        if(y+1<(unsigned)height) vertical_decompose97iH1(b1, b2, b3, width);
-        if(y+0<(unsigned)height) vertical_decompose97iL1(b0, b1, b2, width);
-
-        b0=b2;
-        b1=b3;
-        b2=b4;
-        b3=b5;
-    }
-}
-
-void ff_spatial_dwt(DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
-    int level;
-
-    for(level=0; level<decomposition_count; level++){
-        switch(type){
-        case DWT_97: spatial_decompose97i(buffer, width>>level, height>>level, stride<<level); break;
-        case DWT_53: spatial_decompose53i(buffer, width>>level, height>>level, stride<<level); break;
-        }
-    }
-}
-
-static void horizontal_compose53i(IDWTELEM *b, int width){
-    IDWTELEM temp[width];
-    const int width2= width>>1;
-    const int w2= (width+1)>>1;
-    int x;
-
-    for(x=0; x<width2; x++){
-        temp[2*x    ]= b[x   ];
-        temp[2*x + 1]= b[x+w2];
-    }
-    if(width&1)
-        temp[2*x    ]= b[x   ];
-
-    b[0] = temp[0] - ((temp[1]+1)>>1);
-    for(x=2; x<width-1; x+=2){
-        b[x  ] = temp[x  ] - ((temp[x-1] + temp[x+1]+2)>>2);
-        b[x-1] = temp[x-1] + ((b   [x-2] + b   [x  ]+1)>>1);
-    }
-    if(width&1){
-        b[x  ] = temp[x  ] - ((temp[x-1]+1)>>1);
-        b[x-1] = temp[x-1] + ((b   [x-2] + b  [x  ]+1)>>1);
-    }else
-        b[x-1] = temp[x-1] + b[x-2];
-}
-
-static void vertical_compose53iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] += (b0[i] + b2[i])>>1;
-    }
-}
-
-static void vertical_compose53iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] -= (b0[i] + b2[i] + 2)>>2;
-    }
-}
-
-static void spatial_compose53i_buffered_init(DWTCompose *cs, slice_buffer * sb, int height, int stride_line){
-    cs->b0 = slice_buffer_get_line(sb, mirror(-1-1, height-1) * stride_line);
-    cs->b1 = slice_buffer_get_line(sb, mirror(-1  , height-1) * stride_line);
-    cs->y = -1;
-}
-
-static void spatial_compose53i_init(DWTCompose *cs, IDWTELEM *buffer, int height, int stride){
-    cs->b0 = buffer + mirror(-1-1, height-1)*stride;
-    cs->b1 = buffer + mirror(-1  , height-1)*stride;
-    cs->y = -1;
-}
-
-static void spatial_compose53i_dy_buffered(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line){
-    int y= cs->y;
-
-    IDWTELEM *b0= cs->b0;
-    IDWTELEM *b1= cs->b1;
-    IDWTELEM *b2= slice_buffer_get_line(sb, mirror(y+1, height-1) * stride_line);
-    IDWTELEM *b3= slice_buffer_get_line(sb, mirror(y+2, height-1) * stride_line);
-
-    if(y+1<(unsigned)height && y<(unsigned)height){
-        int x;
-
-        for(x=0; x<width; x++){
-            b2[x] -= (b1[x] + b3[x] + 2)>>2;
-            b1[x] += (b0[x] + b2[x])>>1;
-        }
-    }else{
-        if(y+1<(unsigned)height) vertical_compose53iL0(b1, b2, b3, width);
-        if(y+0<(unsigned)height) vertical_compose53iH0(b0, b1, b2, width);
-    }
-
-        if(y-1<(unsigned)height) horizontal_compose53i(b0, width);
-        if(y+0<(unsigned)height) horizontal_compose53i(b1, width);
-
-    cs->b0 = b2;
-    cs->b1 = b3;
-    cs->y += 2;
-}
-
-static void spatial_compose53i_dy(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride){
-    int y= cs->y;
-    IDWTELEM *b0= cs->b0;
-    IDWTELEM *b1= cs->b1;
-    IDWTELEM *b2= buffer + mirror(y+1, height-1)*stride;
-    IDWTELEM *b3= buffer + mirror(y+2, height-1)*stride;
-
-        if(y+1<(unsigned)height) vertical_compose53iL0(b1, b2, b3, width);
-        if(y+0<(unsigned)height) vertical_compose53iH0(b0, b1, b2, width);
-
-        if(y-1<(unsigned)height) horizontal_compose53i(b0, width);
-        if(y+0<(unsigned)height) horizontal_compose53i(b1, width);
-
-    cs->b0 = b2;
-    cs->b1 = b3;
-    cs->y += 2;
-}
-
-static void av_unused spatial_compose53i(IDWTELEM *buffer, int width, int height, int stride){
-    DWTCompose cs;
-    spatial_compose53i_init(&cs, buffer, height, stride);
-    while(cs.y <= height)
-        spatial_compose53i_dy(&cs, buffer, width, height, stride);
-}
-
-
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width){
-    IDWTELEM temp[width];
-    const int w2= (width+1)>>1;
-
-#if 0 //maybe more understadable but slower
-    inv_lift (temp   , b      , b   +w2, 2, 1, 1, width,  W_DM, W_DO, W_DS, 0, 1);
-    inv_lift (temp+1 , b   +w2, temp   , 2, 1, 2, width,  W_CM, W_CO, W_CS, 1, 1);
-
-    inv_liftS(b      , temp   , temp+1 , 2, 2, 2, width,  W_BM, W_BO, W_BS, 0, 1);
-    inv_lift (b+1    , temp+1 , b      , 2, 2, 2, width,  W_AM, W_AO, W_AS, 1, 0);
-#else
-    int x;
-    temp[0] = b[0] - ((3*b[w2]+2)>>2);
-    for(x=1; x<(width>>1); x++){
-        temp[2*x  ] = b[x     ] - ((3*(b   [x+w2-1] + b[x+w2])+4)>>3);
-        temp[2*x-1] = b[x+w2-1] - temp[2*x-2] - temp[2*x];
-    }
-    if(width&1){
-        temp[2*x  ] = b[x     ] - ((3*b   [x+w2-1]+2)>>2);
-        temp[2*x-1] = b[x+w2-1] - temp[2*x-2] - temp[2*x];
-    }else
-        temp[2*x-1] = b[x+w2-1] - 2*temp[2*x-2];
-
-    b[0] = temp[0] + ((2*temp[0] + temp[1]+4)>>3);
-    for(x=2; x<width-1; x+=2){
-        b[x  ] = temp[x  ] + ((4*temp[x  ] + temp[x-1] + temp[x+1]+8)>>4);
-        b[x-1] = temp[x-1] + ((3*(b  [x-2] + b   [x  ] ))>>1);
-    }
-    if(width&1){
-        b[x  ] = temp[x  ] + ((2*temp[x  ] + temp[x-1]+4)>>3);
-        b[x-1] = temp[x-1] + ((3*(b  [x-2] + b   [x  ] ))>>1);
-    }else
-        b[x-1] = temp[x-1] + 3*b [x-2];
-#endif
-}
-
-static void vertical_compose97iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
-    }
-}
-
-static void vertical_compose97iH1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] -= (W_CM*(b0[i] + b2[i])+W_CO)>>W_CS;
-    }
-}
-
-static void vertical_compose97iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-#ifdef liftS
-        b1[i] += (W_BM*(b0[i] + b2[i])+W_BO)>>W_BS;
-#else
-        b1[i] += (W_BM*(b0[i] + b2[i])+4*b1[i]+W_BO)>>W_BS;
-#endif
-    }
-}
-
-static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b1[i] -= (W_DM*(b0[i] + b2[i])+W_DO)>>W_DS;
-    }
-}
-
-void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
-    int i;
-
-    for(i=0; i<width; i++){
-        b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
-        b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
-#ifdef liftS
-        b2[i] += (W_BM*(b1[i] + b3[i])+W_BO)>>W_BS;
-#else
-        b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
-#endif
-        b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
-    }
-}
-
-static void spatial_compose97i_buffered_init(DWTCompose *cs, slice_buffer * sb, int height, int stride_line){
-    cs->b0 = slice_buffer_get_line(sb, mirror(-3-1, height-1) * stride_line);
-    cs->b1 = slice_buffer_get_line(sb, mirror(-3  , height-1) * stride_line);
-    cs->b2 = slice_buffer_get_line(sb, mirror(-3+1, height-1) * stride_line);
-    cs->b3 = slice_buffer_get_line(sb, mirror(-3+2, height-1) * stride_line);
-    cs->y = -3;
-}
-
-static void spatial_compose97i_init(DWTCompose *cs, IDWTELEM *buffer, int height, int stride){
-    cs->b0 = buffer + mirror(-3-1, height-1)*stride;
-    cs->b1 = buffer + mirror(-3  , height-1)*stride;
-    cs->b2 = buffer + mirror(-3+1, height-1)*stride;
-    cs->b3 = buffer + mirror(-3+2, height-1)*stride;
-    cs->y = -3;
-}
-
-static void spatial_compose97i_dy_buffered(DWTContext *dsp, DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line){
-    int y = cs->y;
-
-    IDWTELEM *b0= cs->b0;
-    IDWTELEM *b1= cs->b1;
-    IDWTELEM *b2= cs->b2;
-    IDWTELEM *b3= cs->b3;
-    IDWTELEM *b4= slice_buffer_get_line(sb, mirror(y + 3, height - 1) * stride_line);
-    IDWTELEM *b5= slice_buffer_get_line(sb, mirror(y + 4, height - 1) * stride_line);
-
-    if(y>0 && y+4<height){
-        dsp->vertical_compose97i(b0, b1, b2, b3, b4, b5, width);
-    }else{
-        if(y+3<(unsigned)height) vertical_compose97iL1(b3, b4, b5, width);
-        if(y+2<(unsigned)height) vertical_compose97iH1(b2, b3, b4, width);
-        if(y+1<(unsigned)height) vertical_compose97iL0(b1, b2, b3, width);
-        if(y+0<(unsigned)height) vertical_compose97iH0(b0, b1, b2, width);
-    }
-
-    if(y-1<(unsigned)height) dsp->horizontal_compose97i(b0, width);
-    if(y+0<(unsigned)height) dsp->horizontal_compose97i(b1, width);
-
-    cs->b0=b2;
-    cs->b1=b3;
-    cs->b2=b4;
-    cs->b3=b5;
-    cs->y += 2;
-}
-
-static void spatial_compose97i_dy(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride){
-    int y = cs->y;
-    IDWTELEM *b0= cs->b0;
-    IDWTELEM *b1= cs->b1;
-    IDWTELEM *b2= cs->b2;
-    IDWTELEM *b3= cs->b3;
-    IDWTELEM *b4= buffer + mirror(y+3, height-1)*stride;
-    IDWTELEM *b5= buffer + mirror(y+4, height-1)*stride;
-
-    if(y+3<(unsigned)height) vertical_compose97iL1(b3, b4, b5, width);
-    if(y+2<(unsigned)height) vertical_compose97iH1(b2, b3, b4, width);
-    if(y+1<(unsigned)height) vertical_compose97iL0(b1, b2, b3, width);
-    if(y+0<(unsigned)height) vertical_compose97iH0(b0, b1, b2, width);
-
-    if(y-1<(unsigned)height) ff_snow_horizontal_compose97i(b0, width);
-    if(y+0<(unsigned)height) ff_snow_horizontal_compose97i(b1, width);
-
-    cs->b0=b2;
-    cs->b1=b3;
-    cs->b2=b4;
-    cs->b3=b5;
-    cs->y += 2;
-}
-
-static void av_unused spatial_compose97i(IDWTELEM *buffer, int width, int height, int stride){
-    DWTCompose cs;
-    spatial_compose97i_init(&cs, buffer, height, stride);
-    while(cs.y <= height)
-        spatial_compose97i_dy(&cs, buffer, width, height, stride);
-}
-
-void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count){
-    int level;
-    for(level=decomposition_count-1; level>=0; level--){
-        switch(type){
-        case DWT_97: spatial_compose97i_buffered_init(cs+level, sb, height>>level, stride_line<<level); break;
-        case DWT_53: spatial_compose53i_buffered_init(cs+level, sb, height>>level, stride_line<<level); break;
-        }
-    }
-}
-
-void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y){
-    const int support = type==1 ? 3 : 5;
-    int level;
-    if(type==2) return;
-
-    for(level=decomposition_count-1; level>=0; level--){
-        while(cs[level].y <= FFMIN((y>>level)+support, height>>level)){
-            switch(type){
-            case DWT_97: spatial_compose97i_dy_buffered(dsp, cs+level, slice_buf, width>>level, height>>level, stride_line<<level);
-                break;
-            case DWT_53: spatial_compose53i_dy_buffered(cs+level, slice_buf, width>>level, height>>level, stride_line<<level);
-                break;
-            }
-        }
-    }
-}
-
-void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
-    int level;
-    for(level=decomposition_count-1; level>=0; level--){
-        switch(type){
-        case DWT_97: spatial_compose97i_init(cs+level, buffer, height>>level, stride<<level); break;
-        case DWT_53: spatial_compose53i_init(cs+level, buffer, height>>level, stride<<level); break;
-        }
-    }
-}
-
-void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){
-    const int support = type==1 ? 3 : 5;
-    int level;
-    if(type==2) return;
-
-    for(level=decomposition_count-1; level>=0; level--){
-        while(cs[level].y <= FFMIN((y>>level)+support, height>>level)){
-            switch(type){
-            case DWT_97: spatial_compose97i_dy(cs+level, buffer, width>>level, height>>level, stride<<level);
-                break;
-            case DWT_53: spatial_compose53i_dy(cs+level, buffer, width>>level, height>>level, stride<<level);
-                break;
-            }
-        }
-    }
-}
-
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
-        DWTCompose cs[MAX_DECOMPOSITIONS];
-        int y;
-        ff_spatial_idwt_init(cs, buffer, width, height, stride, type, decomposition_count);
-        for(y=0; y<height; y+=4)
-            ff_spatial_idwt_slice(cs, buffer, width, height, stride, type, decomposition_count, y);
-}
-
-static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
-    int s, i, j;
-    const int dec_count= w==8 ? 3 : 4;
-    int tmp[32*32];
-    int level, ori;
-    static const int scale[2][2][4][4]={
-      {
-        {
-            // 9/7 8x8 dec=3
-            {268, 239, 239, 213},
-            {  0, 224, 224, 152},
-            {  0, 135, 135, 110},
-        },{
-            // 9/7 16x16 or 32x32 dec=4
-            {344, 310, 310, 280},
-            {  0, 320, 320, 228},
-            {  0, 175, 175, 136},
-            {  0, 129, 129, 102},
-        }
-      },{
-        {
-            // 5/3 8x8 dec=3
-            {275, 245, 245, 218},
-            {  0, 230, 230, 156},
-            {  0, 138, 138, 113},
-        },{
-            // 5/3 16x16 or 32x32 dec=4
-            {352, 317, 317, 286},
-            {  0, 328, 328, 233},
-            {  0, 180, 180, 140},
-            {  0, 132, 132, 105},
-        }
-      }
-    };
-
-    for (i = 0; i < h; i++) {
-        for (j = 0; j < w; j+=4) {
-            tmp[32*i+j+0] = (pix1[j+0] - pix2[j+0])<<4;
-            tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4;
-            tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4;
-            tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4;
-        }
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-
-    ff_spatial_dwt(tmp, w, h, 32, type, dec_count);
-
-    s=0;
-    assert(w==h);
-    for(level=0; level<dec_count; level++){
-        for(ori= level ? 1 : 0; ori<4; ori++){
-            int size= w>>(dec_count-level);
-            int sx= (ori&1) ? size : 0;
-            int stride= 32<<(dec_count-level);
-            int sy= (ori&2) ? stride>>1 : 0;
-
-            for(i=0; i<size; i++){
-                for(j=0; j<size; j++){
-                    int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori];
-                    s += FFABS(v);
-                }
-            }
-        }
-    }
-    assert(s>=0);
-    return s>>9;
-}
-
-static int w53_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
-    return w_c(v, pix1, pix2, line_size,  8, h, 1);
-}
-
-static int w97_8_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
-    return w_c(v, pix1, pix2, line_size,  8, h, 0);
-}
-
-static int w53_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
-    return w_c(v, pix1, pix2, line_size, 16, h, 1);
-}
-
-static int w97_16_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
-    return w_c(v, pix1, pix2, line_size, 16, h, 0);
-}
-
-int ff_w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
-    return w_c(v, pix1, pix2, line_size, 32, h, 1);
-}
-
-int ff_w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
-    return w_c(v, pix1, pix2, line_size, 32, h, 0);
-}
-
-void ff_dsputil_init_dwt(DSPContext *c)
-{
-    c->w53[0]= w53_16_c;
-    c->w53[1]= w53_8_c;
-    c->w97[0]= w97_16_c;
-    c->w97[1]= w97_8_c;
-}
-
-void ff_dwt_init(DWTContext *c)
-{
-    c->vertical_compose97i = ff_snow_vertical_compose97i;
-    c->horizontal_compose97i = ff_snow_horizontal_compose97i;
-    c->inner_add_yblock = ff_snow_inner_add_yblock;
-
-    if (HAVE_MMX) ff_dwt_init_x86(c);
-}
diff --git a/libavcodec/dwt.h b/libavcodec/dwt.h
deleted file mode 100644
index 8c3aa20..0000000
--- a/libavcodec/dwt.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2004-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DWT_H
-#define AVCODEC_DWT_H
-
-#include <stdint.h>
-
-typedef int DWTELEM;
-typedef short IDWTELEM;
-
-typedef struct {
-    IDWTELEM *b0;
-    IDWTELEM *b1;
-    IDWTELEM *b2;
-    IDWTELEM *b3;
-    int y;
-} DWTCompose;
-
-/** Used to minimize the amount of memory used in order to optimize cache performance. **/
-typedef struct slice_buffer_s {
-    IDWTELEM * * line; ///< For use by idwt and predict_slices.
-    IDWTELEM * * data_stack; ///< Used for internal purposes.
-    int data_stack_top;
-    int line_count;
-    int line_width;
-    int data_count;
-    IDWTELEM * base_buffer; ///< Buffer that this structure is caching.
-} slice_buffer;
-
-typedef struct DWTContext {
-    void (*vertical_compose97i)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width);
-    void (*horizontal_compose97i)(IDWTELEM *b, int width);
-    void (*inner_add_yblock)(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
-} DWTContext;
-
-#define MAX_DECOMPOSITIONS 8
-
-#define DWT_97 0
-#define DWT_53 1
-
-#define liftS lift
-#if 1
-#define W_AM 3
-#define W_AO 0
-#define W_AS 1
-
-#undef liftS
-#define W_BM 1
-#define W_BO 8
-#define W_BS 4
-
-#define W_CM 1
-#define W_CO 0
-#define W_CS 0
-
-#define W_DM 3
-#define W_DO 4
-#define W_DS 3
-#elif 0
-#define W_AM 55
-#define W_AO 16
-#define W_AS 5
-
-#define W_BM 3
-#define W_BO 32
-#define W_BS 6
-
-#define W_CM 127
-#define W_CO 64
-#define W_CS 7
-
-#define W_DM 7
-#define W_DO 8
-#define W_DS 4
-#elif 0
-#define W_AM 97
-#define W_AO 32
-#define W_AS 6
-
-#define W_BM 63
-#define W_BO 512
-#define W_BS 10
-
-#define W_CM 13
-#define W_CO 8
-#define W_CS 4
-
-#define W_DM 15
-#define W_DO 16
-#define W_DS 5
-
-#else
-
-#define W_AM 203
-#define W_AO 64
-#define W_AS 7
-
-#define W_BM 217
-#define W_BO 2048
-#define W_BS 12
-
-#define W_CM 113
-#define W_CO 64
-#define W_CS 7
-
-#define W_DM 227
-#define W_DO 128
-#define W_DS 9
-#endif
-
-#define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : ff_slice_buffer_load_line((slice_buf), (line_num)))
-//#define slice_buffer_get_line(slice_buf, line_num) (ff_slice_buffer_load_line((slice_buf), (line_num)))
-
-void ff_slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, IDWTELEM * base_buffer);
-void ff_slice_buffer_release(slice_buffer * buf, int line);
-void ff_slice_buffer_flush(slice_buffer * buf);
-void ff_slice_buffer_destroy(slice_buffer * buf);
-IDWTELEM * ff_slice_buffer_load_line(slice_buffer * buf, int line);
-
-void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width);
-void ff_snow_horizontal_compose97i(IDWTELEM *b, int width);
-void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h, int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8);
-
-int ff_w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
-int ff_w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h);
-
-void ff_spatial_dwt(int *buffer, int width, int height, int stride, int type, int decomposition_count);
-
-void ff_spatial_idwt_buffered_init(DWTCompose *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count);
-void ff_spatial_idwt_buffered_slice(DWTContext *dsp, DWTCompose *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y);
-void ff_spatial_idwt_init(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count);
-void ff_spatial_idwt_slice(DWTCompose *cs, IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y);
-void ff_spatial_idwt(IDWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count);
-
-void ff_dwt_init(DWTContext *c);
-void ff_dwt_init_x86(DWTContext *c);
-
-#endif /* AVCODEC_DWT_H */
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c
deleted file mode 100644
index 62e4e0a..0000000
--- a/libavcodec/dxa.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Feeble Files/ScummVM DXA decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DXA Video decoder
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#include <zlib.h>
-
-/*
- * Decoder context
- */
-typedef struct DxaDecContext {
-    AVCodecContext *avctx;
-    AVFrame pic, prev;
-
-    int dsize;
-    uint8_t *decomp_buf;
-    uint32_t pal[256];
-} DxaDecContext;
-
-static const int shift1[6] = { 0, 8, 8, 8, 4, 4 };
-static const int shift2[6] = { 0, 0, 8, 4, 0, 4 };
-
-static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint8_t *src, uint8_t *ref)
-{
-    uint8_t *code, *data, *mv, *msk, *tmp, *tmp2;
-    int i, j, k;
-    int type, x, y, d, d2;
-    int stride = c->pic.linesize[0];
-    uint32_t mask;
-
-    code = src  + 12;
-    data = code + ((avctx->width * avctx->height) >> 4);
-    mv   = data + AV_RB32(src + 0);
-    msk  = mv   + AV_RB32(src + 4);
-
-    for(j = 0; j < avctx->height; j += 4){
-        for(i = 0; i < avctx->width; i += 4){
-            tmp  = dst + i;
-            tmp2 = ref + i;
-            type = *code++;
-            switch(type){
-            case 4: // motion compensation
-                x = (*mv) >> 4;    if(x & 8) x = 8 - x;
-                y = (*mv++) & 0xF; if(y & 8) y = 8 - y;
-                tmp2 += x + y*stride;
-            case 0: // skip
-            case 5: // skip in method 12
-                for(y = 0; y < 4; y++){
-                    memcpy(tmp, tmp2, 4);
-                    tmp  += stride;
-                    tmp2 += stride;
-                }
-                break;
-            case 1:  // masked change
-            case 10: // masked change with only half of pixels changed
-            case 11: // cases 10-15 are for method 12 only
-            case 12:
-            case 13:
-            case 14:
-            case 15:
-                if(type == 1){
-                    mask = AV_RB16(msk);
-                    msk += 2;
-                }else{
-                    type -= 10;
-                    mask = ((msk[0] & 0xF0) << shift1[type]) | ((msk[0] & 0xF) << shift2[type]);
-                    msk++;
-                }
-                for(y = 0; y < 4; y++){
-                    for(x = 0; x < 4; x++){
-                        tmp[x] = (mask & 0x8000) ? *data++ : tmp2[x];
-                        mask <<= 1;
-                    }
-                    tmp  += stride;
-                    tmp2 += stride;
-                }
-                break;
-            case 2: // fill block
-                for(y = 0; y < 4; y++){
-                    memset(tmp, data[0], 4);
-                    tmp += stride;
-                }
-                data++;
-                break;
-            case 3: // raw block
-                for(y = 0; y < 4; y++){
-                    memcpy(tmp, data, 4);
-                    data += 4;
-                    tmp  += stride;
-                }
-                break;
-            case 8: // subblocks - method 13 only
-                mask = *msk++;
-                for(k = 0; k < 4; k++){
-                    d  = ((k & 1) << 1) + ((k & 2) * stride);
-                    d2 = ((k & 1) << 1) + ((k & 2) * stride);
-                    tmp2 = ref + i + d2;
-                    switch(mask & 0xC0){
-                    case 0x80: // motion compensation
-                        x = (*mv) >> 4;    if(x & 8) x = 8 - x;
-                        y = (*mv++) & 0xF; if(y & 8) y = 8 - y;
-                        tmp2 += x + y*stride;
-                    case 0x00: // skip
-                        tmp[d + 0         ] = tmp2[0];
-                        tmp[d + 1         ] = tmp2[1];
-                        tmp[d + 0 + stride] = tmp2[0 + stride];
-                        tmp[d + 1 + stride] = tmp2[1 + stride];
-                        break;
-                    case 0x40: // fill
-                        tmp[d + 0         ] = data[0];
-                        tmp[d + 1         ] = data[0];
-                        tmp[d + 0 + stride] = data[0];
-                        tmp[d + 1 + stride] = data[0];
-                        data++;
-                        break;
-                    case 0xC0: // raw
-                        tmp[d + 0         ] = *data++;
-                        tmp[d + 1         ] = *data++;
-                        tmp[d + 0 + stride] = *data++;
-                        tmp[d + 1 + stride] = *data++;
-                        break;
-                    }
-                    mask <<= 2;
-                }
-                break;
-            case 32: // vector quantization - 2 colors
-                mask = AV_RB16(msk);
-                msk += 2;
-                for(y = 0; y < 4; y++){
-                    for(x = 0; x < 4; x++){
-                        tmp[x] = data[mask & 1];
-                        mask >>= 1;
-                    }
-                    tmp  += stride;
-                    tmp2 += stride;
-                }
-                data += 2;
-                break;
-            case 33: // vector quantization - 3 or 4 colors
-            case 34:
-                mask = AV_RB32(msk);
-                msk += 4;
-                for(y = 0; y < 4; y++){
-                    for(x = 0; x < 4; x++){
-                        tmp[x] = data[mask & 3];
-                        mask >>= 2;
-                    }
-                    tmp  += stride;
-                    tmp2 += stride;
-                }
-                data += type - 30;
-                break;
-            default:
-                av_log(avctx, AV_LOG_ERROR, "Unknown opcode %d\n", type);
-                return -1;
-            }
-        }
-        dst += stride * 4;
-        ref += stride * 4;
-    }
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    DxaDecContext * const c = avctx->priv_data;
-    uint8_t *outptr, *srcptr, *tmpptr;
-    unsigned long dsize;
-    int i, j, compr;
-    int stride;
-    int orig_buf_size = buf_size;
-    int pc = 0;
-
-    /* make the palette available on the way out */
-    if(buf[0]=='C' && buf[1]=='M' && buf[2]=='A' && buf[3]=='P'){
-        int r, g, b;
-
-        buf += 4;
-        for(i = 0; i < 256; i++){
-            r = *buf++;
-            g = *buf++;
-            b = *buf++;
-            c->pal[i] = (r << 16) | (g << 8) | b;
-        }
-        pc = 1;
-        buf_size -= 768+4;
-    }
-
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE);
-    c->pic.palette_has_changed = pc;
-
-    outptr = c->pic.data[0];
-    srcptr = c->decomp_buf;
-    tmpptr = c->prev.data[0];
-    stride = c->pic.linesize[0];
-
-    if(buf[0]=='N' && buf[1]=='U' && buf[2]=='L' && buf[3]=='L')
-        compr = -1;
-    else
-        compr = buf[4];
-
-    dsize = c->dsize;
-    if((compr != 4 && compr != -1) && uncompress(c->decomp_buf, &dsize, buf + 9, buf_size - 9) != Z_OK){
-        av_log(avctx, AV_LOG_ERROR, "Uncompress failed!\n");
-        return -1;
-    }
-    switch(compr){
-    case -1:
-        c->pic.key_frame = 0;
-        c->pic.pict_type = FF_P_TYPE;
-        if(c->prev.data[0])
-            memcpy(c->pic.data[0], c->prev.data[0], c->pic.linesize[0] * avctx->height);
-        else{ // Should happen only when first frame is 'NULL'
-            memset(c->pic.data[0], 0, c->pic.linesize[0] * avctx->height);
-            c->pic.key_frame = 1;
-            c->pic.pict_type = FF_I_TYPE;
-        }
-        break;
-    case 2:
-    case 3:
-    case 4:
-    case 5:
-        c->pic.key_frame = !(compr & 1);
-        c->pic.pict_type = (compr & 1) ? FF_P_TYPE : FF_I_TYPE;
-        for(j = 0; j < avctx->height; j++){
-            if(compr & 1){
-                for(i = 0; i < avctx->width; i++)
-                    outptr[i] = srcptr[i] ^ tmpptr[i];
-                tmpptr += stride;
-            }else
-                memcpy(outptr, srcptr, avctx->width);
-            outptr += stride;
-            srcptr += avctx->width;
-        }
-        break;
-    case 12: // ScummVM coding
-    case 13:
-        c->pic.key_frame = 0;
-        c->pic.pict_type = FF_P_TYPE;
-        decode_13(avctx, c, c->pic.data[0], srcptr, c->prev.data[0]);
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Unknown/unsupported compression type %d\n", buf[4]);
-        return -1;
-    }
-
-    FFSWAP(AVFrame, c->pic, c->prev);
-    if(c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->prev;
-
-    /* always report that the buffer was completely consumed */
-    return orig_buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    DxaDecContext * const c = avctx->priv_data;
-
-    c->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    c->dsize = avctx->width * avctx->height * 2;
-    if((c->decomp_buf = av_malloc(c->dsize)) == NULL) {
-        av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    DxaDecContext * const c = avctx->priv_data;
-
-    av_freep(&c->decomp_buf);
-    if(c->prev.data[0])
-        avctx->release_buffer(avctx, &c->prev);
-    if(c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-
-    return 0;
-}
-
-AVCodec dxa_decoder = {
-    "dxa",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DXA,
-    sizeof(DxaDecContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Feeble Files/ScummVM DXA"),
-};
-
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
deleted file mode 100644
index 3f14311..0000000
--- a/libavcodec/dxva2.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * DXVA2 HW acceleration.
- *
- * copyright (c) 2010 Laurent Aimar
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "dxva2_internal.h"
-
-void *ff_dxva2_get_surface(const Picture *picture)
-{
-    return picture->data[3];
-}
-
-unsigned ff_dxva2_get_surface_index(const struct dxva_context *ctx,
-                                    const Picture *picture)
-{
-    void *surface = ff_dxva2_get_surface(picture);
-    unsigned i;
-
-    for (i = 0; i < ctx->surface_count; i++)
-        if (ctx->surface[i] == surface)
-            return i;
-
-    assert(0);
-    return 0;
-}
-
-int ff_dxva2_commit_buffer(AVCodecContext *avctx,
-                           struct dxva_context *ctx,
-                           DXVA2_DecodeBufferDesc *dsc,
-                           unsigned type, const void *data, unsigned size,
-                           unsigned mb_count)
-{
-    void     *dxva_data;
-    unsigned dxva_size;
-    int      result;
-
-    if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->decoder, type,
-                                              &dxva_data, &dxva_size))) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to get a buffer for %d\n", type);
-        return -1;
-    }
-    if (size <= dxva_size) {
-        memcpy(dxva_data, data, size);
-
-        memset(dsc, 0, sizeof(*dsc));
-        dsc->CompressedBufferType = type;
-        dsc->DataSize             = size;
-        dsc->NumMBsInBuffer       = mb_count;
-
-        result = 0;
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "Buffer for type %d was too small\n", type);
-        result = -1;
-    }
-    if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->decoder, type))) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to release buffer type %d\n", type);
-        result = -1;
-    }
-    return result;
-}
-
-int ff_dxva2_common_end_frame(AVCodecContext *avctx, MpegEncContext *s,
-                              const void *pp, unsigned pp_size,
-                              const void *qm, unsigned qm_size,
-                              int (*commit_bs_si)(AVCodecContext *,
-                                                  DXVA2_DecodeBufferDesc *bs,
-                                                  DXVA2_DecodeBufferDesc *slice))
-{
-    struct dxva_context *ctx = avctx->hwaccel_context;
-    unsigned               buffer_count = 0;
-    DXVA2_DecodeBufferDesc buffer[4];
-    DXVA2_DecodeExecuteParams exec;
-    int      result;
-
-    if (FAILED(IDirectXVideoDecoder_BeginFrame(ctx->decoder,
-                                               ff_dxva2_get_surface(s->current_picture_ptr),
-                                               NULL))) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to begin frame\n");
-        return -1;
-    }
-
-    result = ff_dxva2_commit_buffer(avctx, ctx, &buffer[buffer_count],
-                                    DXVA2_PictureParametersBufferType,
-                                    pp, pp_size, 0);
-    if (result) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Failed to add picture parameter buffer\n");
-        goto end;
-    }
-    buffer_count++;
-
-    if (qm_size > 0) {
-        result = ff_dxva2_commit_buffer(avctx, ctx, &buffer[buffer_count],
-                                        DXVA2_InverseQuantizationMatrixBufferType,
-                                        qm, qm_size, 0);
-        if (result) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Failed to add inverse quantization matrix buffer\n");
-            goto end;
-        }
-        buffer_count++;
-    }
-
-    result = commit_bs_si(avctx,
-                          &buffer[buffer_count + 0],
-                          &buffer[buffer_count + 1]);
-    if (result) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Failed to add bitstream or slice control buffer\n");
-        goto end;
-    }
-    buffer_count += 2;
-
-    /* TODO Film Grain when possible */
-
-    assert(buffer_count == 1 + (qm_size > 0) + 2);
-
-    memset(&exec, 0, sizeof(exec));
-    exec.NumCompBuffers      = buffer_count;
-    exec.pCompressedBuffers  = buffer;
-    exec.pExtensionData      = NULL;
-    if (FAILED(IDirectXVideoDecoder_Execute(ctx->decoder, &exec))) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to execute\n");
-        result = -1;
-    }
-
-end:
-    if (FAILED(IDirectXVideoDecoder_EndFrame(ctx->decoder, NULL))) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to end frame\n");
-        result = -1;
-    }
-
-    if (!result)
-        ff_draw_horiz_band(s, 0, s->avctx->height);
-    return result;
-}
-
diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
deleted file mode 100644
index 5c5fe21..0000000
--- a/libavcodec/dxva2.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * DXVA2 HW acceleration
- *
- * copyright (c) 2009 Laurent Aimar
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DXVA_H
-#define AVCODEC_DXVA_H
-
-#include <stdint.h>
-
-#include <dxva2api.h>
-
-/**
- * This structure is used to provides the necessary configurations and data
- * to the DXVA2 FFmpeg HWAccel implementation.
- *
- * The application must make it available as AVCodecContext.hwaccel_context.
- */
-struct dxva_context {
-    /**
-     * DXVA2 decoder object
-     */
-    IDirectXVideoDecoder *decoder;
-
-    /**
-     * DXVA2 configuration used to create the decoder
-     */
-    const DXVA2_ConfigPictureDecode *cfg;
-
-    /**
-     * The number of surface in the surface array
-     */
-    unsigned surface_count;
-
-    /**
-     * The array of Direct3D surfaces used to create the decoder
-     */
-    LPDIRECT3DSURFACE9 *surface;
-
-    /**
-     * A bit field configuring the workarounds needed for using the decoder
-     */
-    uint64_t workaround;
-
-    /**
-     * Private to the FFmpeg AVHWAccel implementation
-     */
-    unsigned report_id;
-};
-
-#endif /* AVCODEC_DXVA_H */
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
deleted file mode 100644
index 22c76df..0000000
--- a/libavcodec/dxva2_h264.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * DXVA2 H264 HW acceleration.
- *
- * copyright (c) 2009 Laurent Aimar
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "dxva2_internal.h"
-#include "h264.h"
-#include "h264data.h"
-
-struct dxva2_picture_context {
-    DXVA_PicParams_H264   pp;
-    DXVA_Qmatrix_H264     qm;
-    unsigned              slice_count;
-    DXVA_Slice_H264_Short slice_short[MAX_SLICES];
-    DXVA_Slice_H264_Long  slice_long[MAX_SLICES];
-    const uint8_t         *bitstream;
-    unsigned              bitstream_size;
-};
-
-static void fill_picture_entry(DXVA_PicEntry_H264 *pic,
-                               unsigned index, unsigned flag)
-{
-    assert((index&0x7f) == index && (flag&0x01) == flag);
-    pic->bPicEntry = index | (flag << 7);
-}
-
-static void fill_picture_parameters(struct dxva_context *ctx, const H264Context *h,
-                                    DXVA_PicParams_H264 *pp)
-{
-    const MpegEncContext *s = &h->s;
-    const Picture *current_picture = s->current_picture_ptr;
-    int i;
-
-    memset(pp, 0, sizeof(*pp));
-    /* Configure current picture */
-    fill_picture_entry(&pp->CurrPic,
-                       ff_dxva2_get_surface_index(ctx, current_picture),
-                       s->picture_structure == PICT_BOTTOM_FIELD);
-    /* Configure the set of references */
-    pp->UsedForReferenceFlags  = 0;
-    pp->NonExistingFrameFlags  = 0;
-    for (i = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) {
-        if (i < h->short_ref_count + h->long_ref_count) {
-            const Picture *r;
-            if (i < h->short_ref_count) {
-                r = h->short_ref[i];
-                assert(!r->long_ref);
-            } else {
-                r = h->long_ref[i - h->short_ref_count];
-                assert(r->long_ref);
-            }
-            fill_picture_entry(&pp->RefFrameList[i],
-                               ff_dxva2_get_surface_index(ctx, r),
-                               r->long_ref != 0);
-
-            if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX)
-                pp->FieldOrderCntList[i][0] = r->field_poc[0];
-            if ((r->reference & PICT_BOTTOM_FIELD) && r->field_poc[1] != INT_MAX)
-                pp->FieldOrderCntList[i][1] = r->field_poc[1];
-
-            pp->FrameNumList[i] = r->long_ref ? r->pic_id : r->frame_num;
-            if (r->reference & PICT_TOP_FIELD)
-                pp->UsedForReferenceFlags |= 1 << (2*i + 0);
-            if (r->reference & PICT_BOTTOM_FIELD)
-                pp->UsedForReferenceFlags |= 1 << (2*i + 1);
-        } else {
-            pp->RefFrameList[i].bPicEntry = 0xff;
-            pp->FieldOrderCntList[i][0]   = 0;
-            pp->FieldOrderCntList[i][1]   = 0;
-            pp->FrameNumList[i]           = 0;
-        }
-    }
-
-    pp->wFrameWidthInMbsMinus1        = s->mb_width  - 1;
-    pp->wFrameHeightInMbsMinus1       = s->mb_height - 1;
-    pp->num_ref_frames                = h->sps.ref_frame_count;
-
-    pp->wBitFields                    = ((s->picture_structure != PICT_FRAME) <<  0) |
-                                        (h->sps.mb_aff                        <<  1) |
-                                        (h->sps.residual_color_transform_flag <<  2) |
-                                        /* sp_for_switch_flag (not implemented by FFmpeg) */
-                                        (0                                    <<  3) |
-                                        (h->sps.chroma_format_idc             <<  4) |
-                                        ((h->nal_ref_idc != 0)                <<  6) |
-                                        (h->pps.constrained_intra_pred        <<  7) |
-                                        (h->pps.weighted_pred                 <<  8) |
-                                        (h->pps.weighted_bipred_idc           <<  9) |
-                                        /* MbsConsecutiveFlag */
-                                        (1                                    << 11) |
-                                        (h->sps.frame_mbs_only_flag           << 12) |
-                                        (h->pps.transform_8x8_mode            << 13) |
-                                        ((h->sps.level_idc >= 31)             << 14) |
-                                        /* IntraPicFlag (Modified if we detect a non
-                                         * intra slice in decode_slice) */
-                                        (1                                    << 15);
-
-    pp->bit_depth_luma_minus8         = h->sps.bit_depth_luma - 8;
-    pp->bit_depth_chroma_minus8       = h->sps.bit_depth_chroma - 8;
-    pp->Reserved16Bits                = 3; /* FIXME is there a way to detect the right mode ? */
-    pp->StatusReportFeedbackNumber    = 1 + ctx->report_id++;
-    pp->CurrFieldOrderCnt[0] = 0;
-    if ((s->picture_structure & PICT_TOP_FIELD) &&
-        current_picture->field_poc[0] != INT_MAX)
-        pp->CurrFieldOrderCnt[0] = current_picture->field_poc[0];
-    pp->CurrFieldOrderCnt[1] = 0;
-    if ((s->picture_structure & PICT_BOTTOM_FIELD) &&
-        current_picture->field_poc[1] != INT_MAX)
-        pp->CurrFieldOrderCnt[1] = current_picture->field_poc[1];
-    pp->pic_init_qs_minus26           = h->pps.init_qs - 26;
-    pp->chroma_qp_index_offset        = h->pps.chroma_qp_index_offset[0];
-    pp->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1];
-    pp->ContinuationFlag              = 1;
-    pp->pic_init_qp_minus26           = h->pps.init_qp - 26;
-    pp->num_ref_idx_l0_active_minus1  = h->pps.ref_count[0] - 1;
-    pp->num_ref_idx_l1_active_minus1  = h->pps.ref_count[1] - 1;
-    pp->Reserved8BitsA                = 0;
-    pp->frame_num                     = h->frame_num;
-    pp->log2_max_frame_num_minus4     = h->sps.log2_max_frame_num - 4;
-    pp->pic_order_cnt_type            = h->sps.poc_type;
-    if (h->sps.poc_type == 0)
-        pp->log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;
-    else if (h->sps.poc_type == 1)
-        pp->delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;
-    pp->direct_8x8_inference_flag     = h->sps.direct_8x8_inference_flag;
-    pp->entropy_coding_mode_flag      = h->pps.cabac;
-    pp->pic_order_present_flag        = h->pps.pic_order_present;
-    pp->num_slice_groups_minus1       = h->pps.slice_group_count - 1;
-    pp->slice_group_map_type          = h->pps.mb_slice_group_map_type;
-    pp->deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
-    pp->redundant_pic_cnt_present_flag= h->pps.redundant_pic_cnt_present;
-    pp->Reserved8BitsB                = 0;
-    pp->slice_group_change_rate_minus1= 0;  /* XXX not implemented by FFmpeg */
-    //pp->SliceGroupMap[810];               /* XXX not implemented by FFmpeg */
-}
-
-static void fill_scaling_lists(const H264Context *h, DXVA_Qmatrix_H264 *qm)
-{
-    unsigned i, j;
-    memset(qm, 0, sizeof(*qm));
-    for (i = 0; i < 6; i++)
-        for (j = 0; j < 16; j++)
-            qm->bScalingLists4x4[i][j] = h->pps.scaling_matrix4[i][zigzag_scan[j]];
-
-    for (i = 0; i < 2; i++)
-        for (j = 0; j < 64; j++)
-            qm->bScalingLists8x8[i][j] = h->pps.scaling_matrix8[i][ff_zigzag_direct[j]];
-}
-
-static int is_slice_short(struct dxva_context *ctx)
-{
-    assert(ctx->cfg->ConfigBitstreamRaw == 1 ||
-           ctx->cfg->ConfigBitstreamRaw == 2);
-    return ctx->cfg->ConfigBitstreamRaw == 2;
-}
-
-static void fill_slice_short(DXVA_Slice_H264_Short *slice,
-                             unsigned position, unsigned size)
-{
-    memset(slice, 0, sizeof(*slice));
-    slice->BSNALunitDataLocation = position;
-    slice->SliceBytesInBuffer    = size;
-    slice->wBadSliceChopping     = 0;
-}
-
-static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
-                            unsigned position, unsigned size)
-{
-    const H264Context *h = avctx->priv_data;
-    struct dxva_context *ctx = avctx->hwaccel_context;
-    const MpegEncContext *s = &h->s;
-    unsigned list;
-
-    memset(slice, 0, sizeof(*slice));
-    slice->BSNALunitDataLocation = position;
-    slice->SliceBytesInBuffer    = size;
-    slice->wBadSliceChopping     = 0;
-
-    slice->first_mb_in_slice     = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x;
-    slice->NumMbsForSlice        = 0; /* XXX it is set once we have all slices */
-    slice->BitOffsetToSliceData  = get_bits_count(&s->gb) + 8;
-    slice->slice_type            = ff_h264_get_slice_type(h);
-    if (h->slice_type_fixed)
-        slice->slice_type += 5;
-    slice->luma_log2_weight_denom       = h->luma_log2_weight_denom;
-    slice->chroma_log2_weight_denom     = h->chroma_log2_weight_denom;
-    if (h->list_count > 0)
-        slice->num_ref_idx_l0_active_minus1 = h->ref_count[0] - 1;
-    if (h->list_count > 1)
-        slice->num_ref_idx_l1_active_minus1 = h->ref_count[1] - 1;
-    slice->slice_alpha_c0_offset_div2   = h->slice_alpha_c0_offset / 2 - 26;
-    slice->slice_beta_offset_div2       = h->slice_beta_offset     / 2 - 26;
-    slice->Reserved8Bits                = 0;
-
-    for (list = 0; list < 2; list++) {
-        unsigned i;
-        for (i = 0; i < FF_ARRAY_ELEMS(slice->RefPicList[list]); i++) {
-            if (list < h->list_count && i < h->ref_count[list]) {
-                const Picture *r = &h->ref_list[list][i];
-                unsigned plane;
-                fill_picture_entry(&slice->RefPicList[list][i],
-                                   ff_dxva2_get_surface_index(ctx, r),
-                                   r->reference == PICT_BOTTOM_FIELD);
-                for (plane = 0; plane < 3; plane++) {
-                    int w, o;
-                    if (plane == 0 && h->luma_weight_flag[list]) {
-                        w = h->luma_weight[i][list][0];
-                        o = h->luma_weight[i][list][1];
-                    } else if (plane >= 1 && h->chroma_weight_flag[list]) {
-                        w = h->chroma_weight[i][list][plane-1][0];
-                        o = h->chroma_weight[i][list][plane-1][1];
-                    } else {
-                        w = 1 << (plane == 0 ? h->luma_log2_weight_denom :
-                                               h->chroma_log2_weight_denom);
-                        o = 0;
-                    }
-                    slice->Weights[list][i][plane][0] = w;
-                    slice->Weights[list][i][plane][1] = o;
-                }
-            } else {
-                unsigned plane;
-                slice->RefPicList[list][i].bPicEntry = 0xff;
-                for (plane = 0; plane < 3; plane++) {
-                    slice->Weights[list][i][plane][0] = 0;
-                    slice->Weights[list][i][plane][1] = 0;
-                }
-            }
-        }
-    }
-    slice->slice_qs_delta    = 0; /* XXX not implemented by FFmpeg */
-    slice->slice_qp_delta    = s->qscale - h->pps.init_qp;
-    slice->redundant_pic_cnt = h->redundant_pic_count;
-    if (h->slice_type == FF_B_TYPE)
-        slice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred;
-    slice->cabac_init_idc = h->pps.cabac ? h->cabac_init_idc : 0;
-    if (h->deblocking_filter < 2)
-        slice->disable_deblocking_filter_idc = 1 - h->deblocking_filter;
-    else
-        slice->disable_deblocking_filter_idc = h->deblocking_filter;
-    slice->slice_id = h->current_slice - 1;
-}
-
-static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
-                                             DXVA2_DecodeBufferDesc *bs,
-                                             DXVA2_DecodeBufferDesc *sc)
-{
-    const H264Context *h = avctx->priv_data;
-    const MpegEncContext *s = &h->s;
-    const unsigned mb_count = s->mb_width * s->mb_height;
-    struct dxva_context *ctx = avctx->hwaccel_context;
-    const Picture *current_picture = h->s.current_picture_ptr;
-    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
-    DXVA_Slice_H264_Short *slice = NULL;
-    uint8_t  *dxva_data, *current, *end;
-    unsigned dxva_size;
-    void     *slice_data;
-    unsigned slice_size;
-    unsigned padding;
-    unsigned i;
-
-    /* Create an annex B bitstream buffer with only slice NAL and finalize slice */
-    if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->decoder,
-                                               DXVA2_BitStreamDateBufferType,
-                                               &dxva_data, &dxva_size)))
-        return -1;
-    current = dxva_data;
-    end = dxva_data + dxva_size;
-
-    for (i = 0; i < ctx_pic->slice_count; i++) {
-        static const uint8_t start_code[] = { 0, 0, 1 };
-        static const unsigned start_code_size = sizeof(start_code);
-        unsigned position, size;
-
-        assert(offsetof(DXVA_Slice_H264_Short, BSNALunitDataLocation) ==
-               offsetof(DXVA_Slice_H264_Long,  BSNALunitDataLocation));
-        assert(offsetof(DXVA_Slice_H264_Short, SliceBytesInBuffer) ==
-               offsetof(DXVA_Slice_H264_Long,  SliceBytesInBuffer));
-
-        if (is_slice_short(ctx))
-            slice = &ctx_pic->slice_short[i];
-        else
-            slice = (DXVA_Slice_H264_Short*)&ctx_pic->slice_long[i];
-
-        position = slice->BSNALunitDataLocation;
-        size     = slice->SliceBytesInBuffer;
-        if (start_code_size + size > end - current) {
-            av_log(avctx, AV_LOG_ERROR, "Failed to build bitstream");
-            break;
-        }
-
-        slice->BSNALunitDataLocation = current - dxva_data;
-        slice->SliceBytesInBuffer    = start_code_size + size;
-
-        if (!is_slice_short(ctx)) {
-            DXVA_Slice_H264_Long *slice_long = (DXVA_Slice_H264_Long*)slice;
-            if (i < ctx_pic->slice_count - 1)
-                slice_long->NumMbsForSlice =
-                    slice_long[1].first_mb_in_slice - slice_long[0].first_mb_in_slice;
-            else
-                slice_long->NumMbsForSlice = mb_count - slice_long->first_mb_in_slice;
-        }
-
-        memcpy(current, start_code, start_code_size);
-        current += start_code_size;
-
-        memcpy(current, &ctx_pic->bitstream[position], size);
-        current += size;
-    }
-    padding = FFMIN(128 - ((current - dxva_data) & 127), end - current);
-    if (slice && padding > 0) {
-        memset(current, 0, padding);
-        current += padding;
-
-        slice->SliceBytesInBuffer += padding;
-    }
-    if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->decoder,
-                                                  DXVA2_BitStreamDateBufferType)))
-        return -1;
-    if (i < ctx_pic->slice_count)
-        return -1;
-
-    memset(bs, 0, sizeof(*bs));
-    bs->CompressedBufferType = DXVA2_BitStreamDateBufferType;
-    bs->DataSize             = current - dxva_data;
-    bs->NumMBsInBuffer       = mb_count;
-
-    if (is_slice_short(ctx)) {
-        slice_data = ctx_pic->slice_short;
-        slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_short);
-    } else {
-        slice_data = ctx_pic->slice_long;
-        slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_long);
-    }
-    assert((bs->DataSize & 127) == 0);
-    return ff_dxva2_commit_buffer(avctx, ctx, sc,
-                                  DXVA2_SliceControlBufferType,
-                                  slice_data, slice_size, mb_count);
-}
-
-
-static int start_frame(AVCodecContext *avctx,
-                       av_unused const uint8_t *buffer,
-                       av_unused uint32_t size)
-{
-    const H264Context *h = avctx->priv_data;
-    struct dxva_context *ctx = avctx->hwaccel_context;
-    struct dxva2_picture_context *ctx_pic = h->s.current_picture_ptr->hwaccel_picture_private;
-
-    if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0)
-        return -1;
-    assert(ctx_pic);
-
-    /* Fill up DXVA_PicParams_H264 */
-    fill_picture_parameters(ctx, h, &ctx_pic->pp);
-
-    /* Fill up DXVA_Qmatrix_H264 */
-    fill_scaling_lists(h, &ctx_pic->qm);
-
-    ctx_pic->slice_count    = 0;
-    ctx_pic->bitstream_size = 0;
-    ctx_pic->bitstream      = NULL;
-    return 0;
-}
-
-static int decode_slice(AVCodecContext *avctx,
-                        const uint8_t *buffer, uint32_t size)
-{
-    const H264Context *h = avctx->priv_data;
-    struct dxva_context *ctx = avctx->hwaccel_context;
-    const Picture *current_picture = h->s.current_picture_ptr;
-    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
-    unsigned position;
-
-    if (ctx_pic->slice_count >= MAX_SLICES)
-        return -1;
-
-    if (!ctx_pic->bitstream)
-        ctx_pic->bitstream = buffer;
-    ctx_pic->bitstream_size += size;
-
-    position = buffer - ctx_pic->bitstream;
-    if (is_slice_short(ctx))
-        fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count],
-                         position, size);
-    else
-        fill_slice_long(avctx, &ctx_pic->slice_long[ctx_pic->slice_count],
-                        position, size);
-    ctx_pic->slice_count++;
-
-    if (h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE)
-        ctx_pic->pp.wBitFields &= ~(1 << 15); /* Set IntraPicFlag to 0 */
-    return 0;
-}
-
-static int end_frame(AVCodecContext *avctx)
-{
-    H264Context *h = avctx->priv_data;
-    MpegEncContext *s = &h->s;
-    struct dxva2_picture_context *ctx_pic =
-        h->s.current_picture_ptr->hwaccel_picture_private;
-
-    if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0)
-        return -1;
-    return ff_dxva2_common_end_frame(avctx, s,
-                                     &ctx_pic->pp, sizeof(ctx_pic->pp),
-                                     &ctx_pic->qm, sizeof(ctx_pic->qm),
-                                     commit_bitstream_and_slice_buffer);
-}
-
-AVHWAccel h264_dxva2_hwaccel = {
-    .name           = "h264_dxva2",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_H264,
-    .pix_fmt        = PIX_FMT_DXVA2_VLD,
-    .capabilities   = 0,
-    .start_frame    = start_frame,
-    .decode_slice   = decode_slice,
-    .end_frame      = end_frame,
-    .priv_data_size = sizeof(struct dxva2_picture_context),
-};
-
diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h
deleted file mode 100644
index a9be7a0..0000000
--- a/libavcodec/dxva2_internal.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * DXVA2 HW acceleration
- *
- * copyright (c) 2010 Laurent Aimar
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_DXVA_INTERNAL_H
-#define AVCODEC_DXVA_INTERNAL_H
-
-#include "dxva2.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-
-void *ff_dxva2_get_surface(const Picture *picture);
-
-unsigned ff_dxva2_get_surface_index(const struct dxva_context *,
-                                    const Picture *picture);
-
-int ff_dxva2_commit_buffer(AVCodecContext *, struct dxva_context *,
-                           DXVA2_DecodeBufferDesc *,
-                           unsigned type, const void *data, unsigned size,
-                           unsigned mb_count);
-
-
-int ff_dxva2_common_end_frame(AVCodecContext *, MpegEncContext *,
-                              const void *pp, unsigned pp_size,
-                              const void *qm, unsigned qm_size,
-                              int (*commit_bs_si)(AVCodecContext *,
-                                                  DXVA2_DecodeBufferDesc *bs,
-                                                  DXVA2_DecodeBufferDesc *slice));
-
-#endif /* AVCODEC_DXVA_INTERNAL_H */
diff --git a/libavcodec/dxva2_vc1.c b/libavcodec/dxva2_vc1.c
deleted file mode 100644
index a111213..0000000
--- a/libavcodec/dxva2_vc1.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * DXVA2 WMV3/VC-1 HW acceleration.
- *
- * copyright (c) 2010 Laurent Aimar
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "dxva2_internal.h"
-#include "vc1.h"
-#include "vc1data.h"
-
-struct dxva2_picture_context {
-    DXVA_PictureParameters pp;
-    DXVA_SliceInfo         si;
-
-    const uint8_t          *bitstream;
-    unsigned               bitstream_size;
-};
-
-static void fill_picture_parameters(AVCodecContext *avctx,
-                                    struct dxva_context *ctx, const VC1Context *v,
-                                    DXVA_PictureParameters *pp)
-{
-    const MpegEncContext *s = &v->s;
-    const Picture *current_picture = s->current_picture_ptr;
-
-    memset(pp, 0, sizeof(*pp));
-    pp->wDecodedPictureIndex    =
-    pp->wDeblockedPictureIndex  = ff_dxva2_get_surface_index(ctx, current_picture);
-    if (s->pict_type != FF_I_TYPE)
-        pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture);
-    else
-        pp->wForwardRefPictureIndex = 0xffff;
-    if (s->pict_type == FF_B_TYPE)
-        pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture);
-    else
-        pp->wBackwardRefPictureIndex = 0xffff;
-    if (v->profile == PROFILE_ADVANCED) {
-        /* It is the cropped width/height -1 of the frame */
-        pp->wPicWidthInMBminus1 = avctx->width  - 1;
-        pp->wPicHeightInMBminus1= avctx->height - 1;
-    } else {
-        /* It is the coded width/height in macroblock -1 of the frame */
-        pp->wPicWidthInMBminus1 = s->mb_width  - 1;
-        pp->wPicHeightInMBminus1= s->mb_height - 1;
-    }
-    pp->bMacroblockWidthMinus1  = 15;
-    pp->bMacroblockHeightMinus1 = 15;
-    pp->bBlockWidthMinus1       = 7;
-    pp->bBlockHeightMinus1      = 7;
-    pp->bBPPminus1              = 7;
-    if (s->picture_structure & PICT_TOP_FIELD)
-        pp->bPicStructure      |= 0x01;
-    if (s->picture_structure & PICT_BOTTOM_FIELD)
-        pp->bPicStructure      |= 0x02;
-    pp->bSecondField            = v->interlace && v->fcm != 0x03 && !s->first_field;
-    pp->bPicIntra               = s->pict_type == FF_I_TYPE;
-    pp->bPicBackwardPrediction  = s->pict_type == FF_B_TYPE;
-    pp->bBidirectionalAveragingMode = (1                                           << 7) |
-                                      ((ctx->cfg->ConfigIntraResidUnsigned != 0)   << 6) |
-                                      ((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) |
-                                      ((v->lumscale != 32 || v->lumshift != 0)     << 4) |
-                                      ((v->profile == PROFILE_ADVANCED)            << 3);
-    pp->bMVprecisionAndChromaRelation = ((v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) << 3) |
-                                        (1                                       << 2) |
-                                        (0                                       << 1) |
-                                        (!s->quarter_sample                          );
-    pp->bChromaFormat           = v->chromaformat;
-    ctx->report_id++;
-    if (ctx->report_id >= (1 << 16))
-        ctx->report_id = 1;
-    pp->bPicScanFixed           = ctx->report_id >> 8;
-    pp->bPicScanMethod          = ctx->report_id & 0xff;
-    pp->bPicReadbackRequests    = 0;
-    pp->bRcontrol               = v->rnd;
-    pp->bPicSpatialResid8       = (v->panscanflag  << 7) |
-                                  (v->refdist_flag << 6) |
-                                  (s->loop_filter  << 5) |
-                                  (v->fastuvmc     << 4) |
-                                  (v->extended_mv  << 3) |
-                                  (v->dquant       << 1) |
-                                  (v->vstransform      );
-    pp->bPicOverflowBlocks      = (v->quantizer_mode << 6) |
-                                  (v->multires       << 5) |
-                                  (s->resync_marker  << 4) |
-                                  (v->rangered       << 3) |
-                                  (s->max_b_frames       );
-    pp->bPicExtrapolation       = (!v->interlace || v->fcm == 0x00) ? 1 : 2;
-    pp->bPicDeblocked           = ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) |
-                                  (s->loop_filter                                     << 1);
-    pp->bPicDeblockConfined     = (v->postprocflag             << 7) |
-                                  (v->broadcast                << 6) |
-                                  (v->interlace                << 5) |
-                                  (v->tfcntrflag               << 4) |
-                                  (v->finterpflag              << 3) |
-                                  ((s->pict_type != FF_B_TYPE) << 2) |
-                                  (v->psf                      << 1) |
-                                  (v->extended_dmv                 );
-    if (s->pict_type != FF_I_TYPE)
-        pp->bPic4MVallowed      = v->mv_mode == MV_PMODE_MIXED_MV ||
-                                  (v->mv_mode == MV_PMODE_INTENSITY_COMP &&
-                                   v->mv_mode2 == MV_PMODE_MIXED_MV);
-    if (v->profile == PROFILE_ADVANCED)
-        pp->bPicOBMC            = (v->range_mapy_flag  << 7) |
-                                  (v->range_mapy       << 4) |
-                                  (v->range_mapuv_flag << 3) |
-                                  (v->range_mapuv          );
-    pp->bPicBinPB               = 0;
-    pp->bMV_RPS                 = 0;
-    pp->bReservedBits           = 0;
-    if (s->picture_structure == PICT_FRAME) {
-        pp->wBitstreamFcodes        = v->lumscale;
-        pp->wBitstreamPCEelements   = v->lumshift;
-    } else {
-        /* Syntax: (top_field_param << 8) | bottom_field_param */
-        pp->wBitstreamFcodes        = (v->lumscale << 8) | v->lumscale;
-        pp->wBitstreamPCEelements   = (v->lumshift << 8) | v->lumshift;
-    }
-    pp->bBitstreamConcealmentNeed   = 0;
-    pp->bBitstreamConcealmentMethod = 0;
-}
-
-static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice,
-                       unsigned position, unsigned size)
-{
-    const VC1Context *v = avctx->priv_data;
-    const MpegEncContext *s = &v->s;
-
-    memset(slice, 0, sizeof(*slice));
-    slice->wHorizontalPosition = 0;
-    slice->wVerticalPosition   = s->mb_y;
-    slice->dwSliceBitsInBuffer = 8 * size;
-    slice->dwSliceDataLocation = position;
-    slice->bStartCodeBitOffset = 0;
-    slice->bReservedBits       = 0;
-    slice->wMBbitOffset        = get_bits_count(&s->gb);
-    slice->wNumberMBsInSlice   = s->mb_width * s->mb_height; /* XXX We assume 1 slice */
-    slice->wQuantizerScaleCode = v->pq;
-    slice->wBadSliceChopping   = 0;
-}
-
-static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
-                                             DXVA2_DecodeBufferDesc *bs,
-                                             DXVA2_DecodeBufferDesc *sc)
-{
-    const VC1Context *v = avctx->priv_data;
-    struct dxva_context *ctx = avctx->hwaccel_context;
-    const MpegEncContext *s = &v->s;
-    struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->hwaccel_picture_private;
-
-    DXVA_SliceInfo *slice = &ctx_pic->si;
-
-    static const uint8_t start_code[] = { 0, 0, 1, 0x0d };
-    const unsigned start_code_size = avctx->codec_id == CODEC_ID_VC1 ? sizeof(start_code) : 0;
-    const unsigned slice_size = slice->dwSliceBitsInBuffer / 8;
-    const unsigned padding = 128 - ((start_code_size + slice_size) & 127);
-    const unsigned data_size = start_code_size + slice_size + padding;
-
-    uint8_t  *dxva_data;
-    unsigned dxva_size;
-    int result;
-
-    if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->decoder,
-                                              DXVA2_BitStreamDateBufferType,
-                                              &dxva_data, &dxva_size)))
-        return -1;
-
-    result = data_size <= dxva_size ? 0 : -1;
-    if (!result) {
-        if (start_code_size > 0)
-            memcpy(dxva_data, start_code, start_code_size);
-        memcpy(dxva_data + start_code_size,
-               ctx_pic->bitstream + slice->dwSliceDataLocation, slice_size);
-        if (padding > 0)
-            memset(dxva_data + start_code_size + slice_size, 0, padding);
-        slice->dwSliceBitsInBuffer = 8 * data_size;
-    }
-    if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->decoder,
-                                                  DXVA2_BitStreamDateBufferType)))
-        return -1;
-    if (result)
-        return result;
-
-    memset(bs, 0, sizeof(*bs));
-    bs->CompressedBufferType = DXVA2_BitStreamDateBufferType;
-    bs->DataSize             = data_size;
-    bs->NumMBsInBuffer       = s->mb_width * s->mb_height;
-    assert((bs->DataSize & 127) == 0);
-
-    return ff_dxva2_commit_buffer(avctx, ctx, sc,
-                                  DXVA2_SliceControlBufferType,
-                                  slice, sizeof(*slice), bs->NumMBsInBuffer);
-}
-
-static int start_frame(AVCodecContext *avctx,
-                       av_unused const uint8_t *buffer,
-                       av_unused uint32_t size)
-{
-    const VC1Context *v = avctx->priv_data;
-    struct dxva_context *ctx = avctx->hwaccel_context;
-    struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private;
-
-    if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0)
-        return -1;
-    assert(ctx_pic);
-
-    fill_picture_parameters(avctx, ctx, v, &ctx_pic->pp);
-
-    ctx_pic->bitstream_size = 0;
-    ctx_pic->bitstream      = NULL;
-    return 0;
-}
-
-static int decode_slice(AVCodecContext *avctx,
-                        const uint8_t *buffer, uint32_t size)
-{
-    const VC1Context *v = avctx->priv_data;
-    const Picture *current_picture = v->s.current_picture_ptr;
-    struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
-
-    if (ctx_pic->bitstream_size > 0)
-        return -1;
-
-    if (avctx->codec_id == CODEC_ID_VC1 &&
-        size >= 4 && IS_MARKER(AV_RB32(buffer))) {
-        buffer += 4;
-        size   -= 4;
-    }
-
-    ctx_pic->bitstream_size = size;
-    ctx_pic->bitstream      = buffer;
-
-    fill_slice(avctx, &ctx_pic->si, 0, size);
-    return 0;
-}
-
-static int end_frame(AVCodecContext *avctx)
-{
-    VC1Context *v = avctx->priv_data;
-    struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private;
-
-    if (ctx_pic->bitstream_size <= 0)
-        return -1;
-
-    return ff_dxva2_common_end_frame(avctx, &v->s,
-                                     &ctx_pic->pp, sizeof(ctx_pic->pp),
-                                     NULL, 0,
-                                     commit_bitstream_and_slice_buffer);
-}
-
-#if CONFIG_WMV3_DXVA2_HWACCEL
-AVHWAccel wmv3_dxva2_hwaccel = {
-    .name           = "wmv3_dxva2",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_WMV3,
-    .pix_fmt        = PIX_FMT_DXVA2_VLD,
-    .capabilities   = 0,
-    .start_frame    = start_frame,
-    .decode_slice   = decode_slice,
-    .end_frame      = end_frame,
-    .priv_data_size = sizeof(struct dxva2_picture_context),
-};
-#endif
-
-AVHWAccel vc1_dxva2_hwaccel = {
-    .name           = "vc1_dxva2",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_VC1,
-    .pix_fmt        = PIX_FMT_DXVA2_VLD,
-    .capabilities   = 0,
-    .start_frame    = start_frame,
-    .decode_slice   = decode_slice,
-    .end_frame      = end_frame,
-    .priv_data_size = sizeof(struct dxva2_picture_context),
-};
-
diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c
deleted file mode 100644
index 52d15c8..0000000
--- a/libavcodec/eac3dec.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
- * E-AC-3 decoder
- * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
- * Copyright (c) 2008 Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * There are several features of E-AC-3 that this decoder does not yet support.
- *
- * Enhanced Coupling
- *     No known samples exist.  If any ever surface, this feature should not be
- *     too difficult to implement.
- *
- * Reduced Sample Rates
- *     No known samples exist.  The spec also does not give clear information
- *     on how this is to be implemented.
- *
- * Dependent Streams
- *     Only the independent stream is currently decoded. Any dependent
- *     streams are skipped.  We have only come across two examples of this, and
- *     they are both just test streams, one for HD-DVD and the other for
- *     Blu-ray.
- *
- * Transient Pre-noise Processing
- *     This is side information which a decoder should use to reduce artifacts
- *     caused by transients.  There are samples which are known to have this
- *     information, but this decoder currently ignores it.
- */
-
-
-#include "avcodec.h"
-#include "internal.h"
-#include "aac_ac3_parser.h"
-#include "ac3.h"
-#include "ac3_parser.h"
-#include "ac3dec.h"
-#include "ac3dec_data.h"
-#include "eac3dec_data.h"
-
-/** gain adaptive quantization mode */
-typedef enum {
-    EAC3_GAQ_NO =0,
-    EAC3_GAQ_12,
-    EAC3_GAQ_14,
-    EAC3_GAQ_124
-} EAC3GaqMode;
-
-#define EAC3_SR_CODE_REDUCED  3
-
-void ff_eac3_apply_spectral_extension(AC3DecodeContext *s)
-{
-    int bin, bnd, ch, i;
-    uint8_t wrapflag[SPX_MAX_BANDS]={1,0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS];
-    float rms_energy[SPX_MAX_BANDS];
-
-    /* Set copy index mapping table. Set wrap flags to apply a notch filter at
-       wrap points later on. */
-    bin = s->spx_dst_start_freq;
-    num_copy_sections = 0;
-    for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
-        int copysize;
-        int bandsize = s->spx_band_sizes[bnd];
-        if (bin + bandsize > s->spx_src_start_freq) {
-            copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq;
-            bin = s->spx_dst_start_freq;
-            wrapflag[bnd] = 1;
-        }
-        for (i = 0; i < bandsize; i += copysize) {
-            if (bin == s->spx_src_start_freq) {
-                copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq;
-                bin = s->spx_dst_start_freq;
-            }
-            copysize = FFMIN(bandsize - i, s->spx_src_start_freq - bin);
-            bin += copysize;
-        }
-    }
-    copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq;
-
-    for (ch = 1; ch <= s->fbw_channels; ch++) {
-        if (!s->channel_uses_spx[ch])
-            continue;
-
-        /* Copy coeffs from normal bands to extension bands */
-        bin = s->spx_src_start_freq;
-        for (i = 0; i < num_copy_sections; i++) {
-            memcpy(&s->transform_coeffs[ch][bin],
-                   &s->transform_coeffs[ch][s->spx_dst_start_freq],
-                   copy_sizes[i]*sizeof(float));
-            bin += copy_sizes[i];
-        }
-
-        /* Calculate RMS energy for each SPX band. */
-        bin = s->spx_src_start_freq;
-        for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
-            int bandsize = s->spx_band_sizes[bnd];
-            float accum = 0.0f;
-            for (i = 0; i < bandsize; i++) {
-                float coeff = s->transform_coeffs[ch][bin++];
-                accum += coeff * coeff;
-            }
-            rms_energy[bnd] = sqrtf(accum / bandsize);
-        }
-
-        /* Apply a notch filter at transitions between normal and extension
-           bands and at all wrap points. */
-        if (s->spx_atten_code[ch] >= 0) {
-            const float *atten_tab = ff_eac3_spx_atten_tab[s->spx_atten_code[ch]];
-            bin = s->spx_src_start_freq - 2;
-            for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
-                if (wrapflag[bnd]) {
-                    float *coeffs = &s->transform_coeffs[ch][bin];
-                    coeffs[0] *= atten_tab[0];
-                    coeffs[1] *= atten_tab[1];
-                    coeffs[2] *= atten_tab[2];
-                    coeffs[3] *= atten_tab[1];
-                    coeffs[4] *= atten_tab[0];
-                }
-                bin += s->spx_band_sizes[bnd];
-            }
-        }
-
-        /* Apply noise-blended coefficient scaling based on previously
-           calculated RMS energy, blending factors, and SPX coordinates for
-           each band. */
-        bin = s->spx_src_start_freq;
-        for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
-            float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f/(1<<31));
-            float sscale = s->spx_signal_blend[ch][bnd];
-            for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
-                float noise  = nscale * (int32_t)av_lfg_get(&s->dith_state);
-                s->transform_coeffs[ch][bin]   *= sscale;
-                s->transform_coeffs[ch][bin++] += noise;
-            }
-        }
-    }
-}
-
-
-/** lrint(M_SQRT2*cos(2*M_PI/12)*(1<<23)) */
-#define COEFF_0 10273905LL
-
-/** lrint(M_SQRT2*cos(0*M_PI/12)*(1<<23)) = lrint(M_SQRT2*(1<<23)) */
-#define COEFF_1 11863283LL
-
-/** lrint(M_SQRT2*cos(5*M_PI/12)*(1<<23)) */
-#define COEFF_2  3070444LL
-
-/**
- * Calculate 6-point IDCT of the pre-mantissas.
- * All calculations are 24-bit fixed-point.
- */
-static void idct6(int pre_mant[6])
-{
-    int tmp;
-    int even0, even1, even2, odd0, odd1, odd2;
-
-    odd1 = pre_mant[1] - pre_mant[3] - pre_mant[5];
-
-    even2 = ( pre_mant[2]                * COEFF_0) >> 23;
-    tmp   = ( pre_mant[4]                * COEFF_1) >> 23;
-    odd0  = ((pre_mant[1] + pre_mant[5]) * COEFF_2) >> 23;
-
-    even0 = pre_mant[0] + (tmp >> 1);
-    even1 = pre_mant[0] - tmp;
-
-    tmp = even0;
-    even0 = tmp + even2;
-    even2 = tmp - even2;
-
-    tmp = odd0;
-    odd0 = tmp + pre_mant[1] + pre_mant[3];
-    odd2 = tmp + pre_mant[5] - pre_mant[3];
-
-    pre_mant[0] = even0 + odd0;
-    pre_mant[1] = even1 + odd1;
-    pre_mant[2] = even2 + odd2;
-    pre_mant[3] = even2 - odd2;
-    pre_mant[4] = even1 - odd1;
-    pre_mant[5] = even0 - odd0;
-}
-
-void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch)
-{
-    int bin, blk, gs;
-    int end_bap, gaq_mode;
-    GetBitContext *gbc = &s->gbc;
-    int gaq_gain[AC3_MAX_COEFS];
-
-    gaq_mode = get_bits(gbc, 2);
-    end_bap = (gaq_mode < 2) ? 12 : 17;
-
-    /* if GAQ gain is used, decode gain codes for bins with hebap between
-       8 and end_bap */
-    gs = 0;
-    if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) {
-        /* read 1-bit GAQ gain codes */
-        for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
-            if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap)
-                gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1);
-        }
-    } else if (gaq_mode == EAC3_GAQ_124) {
-        /* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */
-        int gc = 2;
-        for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
-            if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) {
-                if (gc++ == 2) {
-                    int group_code = get_bits(gbc, 5);
-                    if (group_code > 26) {
-                        av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n");
-                        group_code = 26;
-                    }
-                    gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0];
-                    gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1];
-                    gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2];
-                    gc = 0;
-                }
-            }
-        }
-    }
-
-    gs=0;
-    for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) {
-        int hebap = s->bap[ch][bin];
-        int bits = ff_eac3_bits_vs_hebap[hebap];
-        if (!hebap) {
-            /* zero-mantissa dithering */
-            for (blk = 0; blk < 6; blk++) {
-                s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
-            }
-        } else if (hebap < 8) {
-            /* Vector Quantization */
-            int v = get_bits(gbc, bits);
-            for (blk = 0; blk < 6; blk++) {
-                s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8;
-            }
-        } else {
-            /* Gain Adaptive Quantization */
-            int gbits, log_gain;
-            if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) {
-                log_gain = gaq_gain[gs++];
-            } else {
-                log_gain = 0;
-            }
-            gbits = bits - log_gain;
-
-            for (blk = 0; blk < 6; blk++) {
-                int mant = get_sbits(gbc, gbits);
-                if (log_gain && mant == -(1 << (gbits-1))) {
-                    /* large mantissa */
-                    int b;
-                    int mbits = bits - (2 - log_gain);
-                    mant = get_sbits(gbc, mbits);
-                    mant <<= (23 - (mbits - 1));
-                    /* remap mantissa value to correct for asymmetric quantization */
-                    if (mant >= 0)
-                        b = 1 << (23 - log_gain);
-                    else
-                        b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8;
-                    mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b;
-                } else {
-                    /* small mantissa, no GAQ, or Gk=1 */
-                    mant <<= 24 - bits;
-                    if (!log_gain) {
-                        /* remap mantissa value for no GAQ or Gk=1 */
-                        mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15;
-                    }
-                }
-                s->pre_mantissa[ch][bin][blk] = mant;
-            }
-        }
-        idct6(s->pre_mantissa[ch][bin]);
-    }
-}
-
-int ff_eac3_parse_header(AC3DecodeContext *s)
-{
-    int i, blk, ch;
-    int ac3_exponent_strategy, parse_aht_info, parse_spx_atten_data;
-    int parse_transient_proc_info;
-    int num_cpl_blocks;
-    GetBitContext *gbc = &s->gbc;
-
-    /* An E-AC-3 stream can have multiple independent streams which the
-       application can select from. each independent stream can also contain
-       dependent streams which are used to add or replace channels. */
-    if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
-        av_log_missing_feature(s->avctx, "Dependent substream decoding", 1);
-        return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
-    } else if (s->frame_type == EAC3_FRAME_TYPE_RESERVED) {
-        av_log(s->avctx, AV_LOG_ERROR, "Reserved frame type\n");
-        return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
-    }
-
-    /* The substream id indicates which substream this frame belongs to. each
-       independent stream has its own substream id, and the dependent streams
-       associated to an independent stream have matching substream id's. */
-    if (s->substreamid) {
-        /* only decode substream with id=0. skip any additional substreams. */
-        av_log_missing_feature(s->avctx, "Additional substreams", 1);
-        return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
-    }
-
-    if (s->bit_alloc_params.sr_code == EAC3_SR_CODE_REDUCED) {
-        /* The E-AC-3 specification does not tell how to handle reduced sample
-           rates in bit allocation.  The best assumption would be that it is
-           handled like AC-3 DolbyNet, but we cannot be sure until we have a
-           sample which utilizes this feature. */
-        av_log_missing_feature(s->avctx, "Reduced sampling rates", 1);
-        return -1;
-    }
-    skip_bits(gbc, 5); // skip bitstream id
-
-    /* volume control params */
-    for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
-        skip_bits(gbc, 5); // skip dialog normalization
-        if (get_bits1(gbc)) {
-            skip_bits(gbc, 8); // skip compression gain word
-        }
-    }
-
-    /* dependent stream channel map */
-    if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
-        if (get_bits1(gbc)) {
-            skip_bits(gbc, 16); // skip custom channel map
-        }
-    }
-
-    /* mixing metadata */
-    if (get_bits1(gbc)) {
-        /* center and surround mix levels */
-        if (s->channel_mode > AC3_CHMODE_STEREO) {
-            skip_bits(gbc, 2);  // skip preferred stereo downmix mode
-            if (s->channel_mode & 1) {
-                /* if three front channels exist */
-                skip_bits(gbc, 3); //skip Lt/Rt center mix level
-                s->center_mix_level = get_bits(gbc, 3);
-            }
-            if (s->channel_mode & 4) {
-                /* if a surround channel exists */
-                skip_bits(gbc, 3); //skip Lt/Rt surround mix level
-                s->surround_mix_level = get_bits(gbc, 3);
-            }
-        }
-
-        /* lfe mix level */
-        if (s->lfe_on && get_bits1(gbc)) {
-            // TODO: use LFE mix level
-            skip_bits(gbc, 5); // skip LFE mix level code
-        }
-
-        /* info for mixing with other streams and substreams */
-        if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {
-            for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
-                // TODO: apply program scale factor
-                if (get_bits1(gbc)) {
-                    skip_bits(gbc, 6);  // skip program scale factor
-                }
-            }
-            if (get_bits1(gbc)) {
-                skip_bits(gbc, 6);  // skip external program scale factor
-            }
-            /* skip mixing parameter data */
-            switch(get_bits(gbc, 2)) {
-                case 1: skip_bits(gbc, 5);  break;
-                case 2: skip_bits(gbc, 12); break;
-                case 3: {
-                    int mix_data_size = (get_bits(gbc, 5) + 2) << 3;
-                    skip_bits_long(gbc, mix_data_size);
-                    break;
-                }
-            }
-            /* skip pan information for mono or dual mono source */
-            if (s->channel_mode < AC3_CHMODE_STEREO) {
-                for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
-                    if (get_bits1(gbc)) {
-                        /* note: this is not in the ATSC A/52B specification
-                           reference: ETSI TS 102 366 V1.1.1
-                                      section: E.1.3.1.25 */
-                        skip_bits(gbc, 8);  // skip pan mean direction index
-                        skip_bits(gbc, 6);  // skip reserved paninfo bits
-                    }
-                }
-            }
-            /* skip mixing configuration information */
-            if (get_bits1(gbc)) {
-                for (blk = 0; blk < s->num_blocks; blk++) {
-                    if (s->num_blocks == 1 || get_bits1(gbc)) {
-                        skip_bits(gbc, 5);
-                    }
-                }
-            }
-        }
-    }
-
-    /* informational metadata */
-    if (get_bits1(gbc)) {
-        skip_bits(gbc, 3); // skip bit stream mode
-        skip_bits(gbc, 2); // skip copyright bit and original bitstream bit
-        if (s->channel_mode == AC3_CHMODE_STEREO) {
-            skip_bits(gbc, 4); // skip Dolby surround and headphone mode
-        }
-        if (s->channel_mode >= AC3_CHMODE_2F2R) {
-            skip_bits(gbc, 2); // skip Dolby surround EX mode
-        }
-        for (i = 0; i < (s->channel_mode ? 1 : 2); i++) {
-            if (get_bits1(gbc)) {
-                skip_bits(gbc, 8); // skip mix level, room type, and A/D converter type
-            }
-        }
-        if (s->bit_alloc_params.sr_code != EAC3_SR_CODE_REDUCED) {
-            skip_bits1(gbc); // skip source sample rate code
-        }
-    }
-
-    /* converter synchronization flag
-       If frames are less than six blocks, this bit should be turned on
-       once every 6 blocks to indicate the start of a frame set.
-       reference: RFC 4598, Section 2.1.3  Frame Sets */
-    if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && s->num_blocks != 6) {
-        skip_bits1(gbc); // skip converter synchronization flag
-    }
-
-    /* original frame size code if this stream was converted from AC-3 */
-    if (s->frame_type == EAC3_FRAME_TYPE_AC3_CONVERT &&
-            (s->num_blocks == 6 || get_bits1(gbc))) {
-        skip_bits(gbc, 6); // skip frame size code
-    }
-
-    /* additional bitstream info */
-    if (get_bits1(gbc)) {
-        int addbsil = get_bits(gbc, 6);
-        for (i = 0; i < addbsil + 1; i++) {
-            skip_bits(gbc, 8); // skip additional bit stream info
-        }
-    }
-
-    /* audio frame syntax flags, strategy data, and per-frame data */
-
-    if (s->num_blocks == 6) {
-        ac3_exponent_strategy = get_bits1(gbc);
-        parse_aht_info        = get_bits1(gbc);
-    } else {
-        /* less than 6 blocks, so use AC-3-style exponent strategy syntax, and
-           do not use AHT */
-        ac3_exponent_strategy = 1;
-        parse_aht_info = 0;
-    }
-
-    s->snr_offset_strategy    = get_bits(gbc, 2);
-    parse_transient_proc_info = get_bits1(gbc);
-
-    s->block_switch_syntax = get_bits1(gbc);
-    if (!s->block_switch_syntax)
-        memset(s->block_switch, 0, sizeof(s->block_switch));
-
-    s->dither_flag_syntax = get_bits1(gbc);
-    if (!s->dither_flag_syntax) {
-        for (ch = 1; ch <= s->fbw_channels; ch++)
-            s->dither_flag[ch] = 1;
-    }
-    s->dither_flag[CPL_CH] = s->dither_flag[s->lfe_ch] = 0;
-
-    s->bit_allocation_syntax = get_bits1(gbc);
-    if (!s->bit_allocation_syntax) {
-        /* set default bit allocation parameters */
-        s->bit_alloc_params.slow_decay = ff_ac3_slow_decay_tab[2];
-        s->bit_alloc_params.fast_decay = ff_ac3_fast_decay_tab[1];
-        s->bit_alloc_params.slow_gain  = ff_ac3_slow_gain_tab [1];
-        s->bit_alloc_params.db_per_bit = ff_ac3_db_per_bit_tab[2];
-        s->bit_alloc_params.floor      = ff_ac3_floor_tab     [7];
-    }
-
-    s->fast_gain_syntax  = get_bits1(gbc);
-    s->dba_syntax        = get_bits1(gbc);
-    s->skip_syntax       = get_bits1(gbc);
-    parse_spx_atten_data = get_bits1(gbc);
-
-    /* coupling strategy occurance and coupling use per block */
-    num_cpl_blocks = 0;
-    if (s->channel_mode > 1) {
-        for (blk = 0; blk < s->num_blocks; blk++) {
-            s->cpl_strategy_exists[blk] = (!blk || get_bits1(gbc));
-            if (s->cpl_strategy_exists[blk]) {
-                s->cpl_in_use[blk] = get_bits1(gbc);
-            } else {
-                s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
-            }
-            num_cpl_blocks += s->cpl_in_use[blk];
-        }
-    } else {
-        memset(s->cpl_in_use, 0, sizeof(s->cpl_in_use));
-    }
-
-    /* exponent strategy data */
-    if (ac3_exponent_strategy) {
-        /* AC-3-style exponent strategy syntax */
-        for (blk = 0; blk < s->num_blocks; blk++) {
-            for (ch = !s->cpl_in_use[blk]; ch <= s->fbw_channels; ch++) {
-                s->exp_strategy[blk][ch] = get_bits(gbc, 2);
-            }
-        }
-    } else {
-        /* LUT-based exponent strategy syntax */
-        for (ch = !((s->channel_mode > 1) && num_cpl_blocks); ch <= s->fbw_channels; ch++) {
-            int frmchexpstr = get_bits(gbc, 5);
-            for (blk = 0; blk < 6; blk++) {
-                s->exp_strategy[blk][ch] = ff_eac3_frm_expstr[frmchexpstr][blk];
-            }
-        }
-    }
-    /* LFE exponent strategy */
-    if (s->lfe_on) {
-        for (blk = 0; blk < s->num_blocks; blk++) {
-            s->exp_strategy[blk][s->lfe_ch] = get_bits1(gbc);
-        }
-    }
-    /* original exponent strategies if this stream was converted from AC-3 */
-    if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT &&
-            (s->num_blocks == 6 || get_bits1(gbc))) {
-        skip_bits(gbc, 5 * s->fbw_channels); // skip converter channel exponent strategy
-    }
-
-    /* determine which channels use AHT */
-    if (parse_aht_info) {
-        /* For AHT to be used, all non-zero blocks must reuse exponents from
-           the first block.  Furthermore, for AHT to be used in the coupling
-           channel, all blocks must use coupling and use the same coupling
-           strategy. */
-        s->channel_uses_aht[CPL_CH]=0;
-        for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) {
-            int use_aht = 1;
-            for (blk = 1; blk < 6; blk++) {
-                if ((s->exp_strategy[blk][ch] != EXP_REUSE) ||
-                        (!ch && s->cpl_strategy_exists[blk])) {
-                    use_aht = 0;
-                    break;
-                }
-            }
-            s->channel_uses_aht[ch] = use_aht && get_bits1(gbc);
-        }
-    } else {
-        memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));
-    }
-
-    /* per-frame SNR offset */
-    if (!s->snr_offset_strategy) {
-        int csnroffst = (get_bits(gbc, 6) - 15) << 4;
-        int snroffst = (csnroffst + get_bits(gbc, 4)) << 2;
-        for (ch = 0; ch <= s->channels; ch++)
-            s->snr_offset[ch] = snroffst;
-    }
-
-    /* transient pre-noise processing data */
-    if (parse_transient_proc_info) {
-        for (ch = 1; ch <= s->fbw_channels; ch++) {
-            if (get_bits1(gbc)) { // channel in transient processing
-                skip_bits(gbc, 10); // skip transient processing location
-                skip_bits(gbc, 8);  // skip transient processing length
-            }
-        }
-    }
-
-    /* spectral extension attenuation data */
-    for (ch = 1; ch <= s->fbw_channels; ch++) {
-        if (parse_spx_atten_data && get_bits1(gbc)) {
-            s->spx_atten_code[ch] = get_bits(gbc, 5);
-        } else {
-            s->spx_atten_code[ch] = -1;
-        }
-    }
-
-    /* block start information */
-    if (s->num_blocks > 1 && get_bits1(gbc)) {
-        /* reference: Section E2.3.2.27
-           nblkstrtbits = (numblks - 1) * (4 + ceiling(log2(words_per_frame)))
-           The spec does not say what this data is or what it's used for.
-           It is likely the offset of each block within the frame. */
-        int block_start_bits = (s->num_blocks-1) * (4 + av_log2(s->frame_size-2));
-        skip_bits_long(gbc, block_start_bits);
-        av_log_missing_feature(s->avctx, "Block start info", 1);
-    }
-
-    /* syntax state initialization */
-    for (ch = 1; ch <= s->fbw_channels; ch++) {
-        s->first_spx_coords[ch] = 1;
-        s->first_cpl_coords[ch] = 1;
-    }
-    s->first_cpl_leak = 1;
-
-    return 0;
-}
diff --git a/libavcodec/eac3dec_data.c b/libavcodec/eac3dec_data.c
deleted file mode 100644
index 031702e..0000000
--- a/libavcodec/eac3dec_data.c
+++ /dev/null
@@ -1,1134 +0,0 @@
-/*
- * E-AC-3 decoder tables
- * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Tables taken directly from the E-AC-3 spec.
- */
-
-#include "eac3dec_data.h"
-#include "ac3.h"
-
-const uint8_t ff_eac3_bits_vs_hebap[20] = {
-    0,  2,  3,  4,  5,  7,  8,  9,  3,  4,
-    5,  6,  7,  8,  9, 10, 11, 12, 14, 16,
-};
-
-/**
- * Table E3.6, Gk=1
- * No gain (Gk=1) inverse quantization, remapping scale factors
- * ff_eac3_gaq_remap[hebap+8]
- */
-const int16_t ff_eac3_gaq_remap_1[12] = {
-    4681, 2185, 1057, 520, 258, 129, 64, 32, 16, 8, 2, 0
-};
-
-/**
- * Table E3.6, Gk=2 & Gk=4, A
- * Large mantissa inverse quantization, remapping scale factors
- * ff_eac3_gaq_remap_2_4_a[hebap-8][Gk=2,4]
- */
-const int16_t ff_eac3_gaq_remap_2_4_a[9][2] = {
-    { -10923, -4681 },
-    { -14043, -6554 },
-    { -15292, -7399 },
-    { -15855, -7802 },
-    { -16124, -7998 },
-    { -16255, -8096 },
-    { -16320, -8144 },
-    { -16352, -8168 },
-    { -16368, -8180 }
-};
-
-/**
- * Table E3.6, Gk=2 & Gk=4, B
- * Large mantissa inverse quantization, negative mantissa remapping offsets
- * ff_eac3_gaq_remap_3_4_b[hebap-8][Gk=2,4]
- */
-const int16_t ff_eac3_gaq_remap_2_4_b[9][2] = {
-    {  -5461, -1170 },
-    { -11703, -4915 },
-    { -14199, -6606 },
-    { -15327, -7412 },
-    { -15864, -7805 },
-    { -16126, -7999 },
-    { -16255, -8096 },
-    { -16320, -8144 },
-    { -16352, -8168 }
-};
-
-static const int16_t vq_hebap1[4][6] = {
-{   7167,    4739,    1106,    4269,   10412,    4820},
-{  -5702,   -3187,  -14483,   -1392,   -2027,     849},
-{    633,    6199,    7009,  -12779,   -2306,   -2636},
-{  -1468,   -7031,    7592,   10617,   -5946,   -3062},
-};
-static const int16_t vq_hebap2[8][6] = {
-{ -12073,     608,   -7019,     590,    4000,     869},
-{   6692,   15689,   -6178,   -9239,     -74,     133},
-{   1855,    -989,   20596,   -2920,   -4475,     225},
-{  -1194,   -3901,    -821,   -6566,    -875,  -20298},
-{  -2762,   -3181,   -4094,   -5623,  -16945,    9765},
-{   1547,    6839,    1980,   20233,   -1071,   -4986},
-{   6221,  -17915,   -5516,    6266,     358,    1162},
-{   3753,   -1066,    4283,   -3227,   15928,   10186},
-};
-static const int16_t vq_hebap3[16][6] = {
-{ -10028,   20779,   10982,   -4560,     798,     -68},
-{  11050,   20490,   -6617,   -5342,   -1797,   -1631},
-{   3977,    -542,    7118,   -1166,   18844,   14678},
-{  -4320,     -96,   -7295,    -492,  -22050,   -4277},
-{   2692,    5856,    5530,   21862,   -7212,   -5325},
-{   -135,  -23391,     962,    8115,    -644,     382},
-{  -1563,    3400,   -3299,    4693,   -6892,   22398},
-{   3535,    3030,    7296,    6214,   20476,  -12099},
-{     57,   -6823,    1848,  -22349,   -5919,    6823},
-{   -821,   -3655,    -387,   -6253,   -1735,  -22373},
-{  -6046,    1586,  -18890,  -14392,    9214,     705},
-{  -5716,     264,  -17964,   14618,    7921,    -337},
-{   -110,     108,       8,      74,     -89,     -50},
-{   6612,   -1517,   21687,   -1658,   -7949,    -246},
-{  21667,   -6335,   -8290,    -101,   -1349,     -22},
-{ -22003,   -6476,    7974,     648,    2054,    -331},
-};
-static const int16_t vq_hebap4[32][6] = {
-{   6636,   -4593,   14173,  -17297,  -16523,     864},
-{   3658,   22540,     104,   -1763,     -84,       6},
-{  21580,  -17815,   -7282,   -1575,   -2078,    -320},
-{  -2233,   10017,   -2728,   14938,  -13640,  -17659},
-{  -1564,  -17738,  -19161,   13735,    2757,    2951},
-{   4520,    5510,    7393,   10799,   19231,  -13770},
-{    399,    2976,   -1099,    5013,   -1159,   22095},
-{   3624,   -2359,    4680,   -2238,   22702,    3765},
-{  -4201,   -8285,   -6810,  -12390,  -18414,   15382},
-{  -5198,   -6869,  -10047,   -8364,  -16022,  -20562},
-{   -142,  -22671,    -368,    4391,    -464,     -13},
-{    814,   -1118,   -1089,  -22019,      74,    1553},
-{  -1618,   19222,  -17642,  -13490,     842,   -2309},
-{   4689,   16490,   20813,  -15387,   -4164,   -3968},
-{  -3308,   11214,  -13542,   13599,  -19473,   13770},
-{   1817,     854,   21225,    -966,   -1643,    -268},
-{  -2587,    -107,  -20154,     376,    1174,    -304},
-{  -2919,     453,   -5390,     750,  -22034,    -978},
-{ -19012,   16839,   10000,   -3580,    2211,    1459},
-{   1363,   -2658,     -33,   -4067,    1165,  -21985},
-{  -8592,   -2760,  -17520,  -15985,   14897,    1323},
-{    652,   -9331,    3253,  -14622,   12181,   19692},
-{  -6361,    5773,  -15395,   17291,   16590,   -2922},
-{   -661,    -601,    1609,   22610,     992,   -1045},
-{   4961,    9107,   11225,    7829,   16320,   18627},
-{ -21872,   -1433,     138,    1470,   -1891,    -196},
-{ -19499,  -18203,   11056,    -516,    2543,   -2249},
-{  -1196,  -17574,   20150,   11462,    -401,    2619},
-{   4638,   -8154,   11891,  -15759,   17615,  -14955},
-{    -83,     278,     323,      55,    -154,     232},
-{   7788,    1462,   18395,   15296,  -15763,   -1131},
-};
-static const int16_t vq_hebap5[128][6] = {
-{  -3394,  -19730,    2963,    9590,    4660,   19673},
-{ -15665,   -6405,   17671,    3860,   -8232,  -19429},
-{   4467,     412,  -17873,   -8037,     691,  -17307},
-{   3580,    2363,    6886,    3763,    6379,  -20522},
-{ -17230,  -14133,   -1396,  -23939,    8373,  -12537},
-{  -8073,  -21469,  -15638,    3214,    8105,   -5965},
-{   4343,    5169,    2683,  -16822,   -5146,  -16558},
-{   6348,  -10668,   12995,  -25500,  -22090,    4091},
-{  -2880,   -8366,   -5968,  -17158,   -2638,   23132},
-{  -5095,  -14281,  -22371,   21741,    3689,    2961},
-{  -2443,  -17739,   25155,    2707,    1594,       7},
-{ -18379,    9010,    4270,     731,    -426,    -640},
-{ -23695,   24732,    5642,     612,    -308,    -964},
-{   -767,    1268,     225,    1635,     173,     916},
-{   5455,    6493,    4902,   10560,   23041,  -17140},
-{  17219,  -21054,  -18716,    4936,   -3420,    3357},
-{  -1390,   15488,  -21946,  -14611,    1339,     542},
-{  -6866,   -2254,  -12070,   -3075,  -19981,  -20622},
-{  -1803,   11775,    1343,    8917,     693,   24497},
-{ -21610,    9462,    4681,    9254,   -7815,   15904},
-{  -5559,   -3018,   -9169,   -1347,  -22547,   12868},
-{   -366,    5076,   -1727,   20427,    -283,   -2923},
-{  -1886,   -6313,    -939,   -2081,   -1399,    3513},
-{  -3161,    -537,   -5075,   11268,   19396,     989},
-{   2345,    4153,    5769,   -4273,     233,    -399},
-{ -21894,   -1138,  -16474,    5902,    5488,   -3211},
-{  10007,  -12530,   18829,   20932,   -1158,    1790},
-{  -1165,    5014,   -1199,    6415,   -8418,  -21038},
-{   1892,   -3534,    3815,   -5846,   16427,   20288},
-{  -2664,  -11627,   -4147,  -18311,  -22710,   14848},
-{  17256,   10419,    7764,   12040,   18956,    2525},
-{ -21419,  -18685,  -10897,    4368,   -7051,    4539},
-{  -1574,    2050,    5760,   24756,   15983,   17678},
-{   -538,  -22867,   11067,   10301,     385,     528},
-{  -8465,   -3025,  -16357,  -23237,   16491,    3654},
-{   5840,     575,   11890,    1947,   25157,    6653},
-{   6625,   -3516,   -1964,    3850,    -390,    -116},
-{  18005,   20900,   14323,   -7621,  -10922,   11802},
-{  -4857,   -2932,  -13334,   -7815,   21622,    2267},
-{   -579,   -9431,    -748,  -21321,   12367,    8265},
-{  -8317,    1375,  -17847,    2921,    9062,   22046},
-{  18398,    8635,   -1503,   -2418,  -18295,  -14734},
-{  -2987,   15129,   -3331,   22300,   13878,  -13639},
-{   5874,  -19026,   15587,   11350,  -20738,    1971},
-{   1581,   -6955,  -21440,    2455,      65,     414},
-{    515,   -4468,    -665,   -4672,     125,  -19222},
-{  21495,  -20301,   -1872,   -1926,    -211,   -1022},
-{   5189,  -12250,   -1775,  -23550,   -4546,    5813},
-{    321,   -6331,   14646,    6975,   -1773,     867},
-{ -13814,    3180,    7927,     444,   19552,    3146},
-{  -6660,   12252,   -1972,   17408,  -24280,  -12956},
-{   -745,   14356,   -1107,   23742,   -9631,  -18344},
-{  18284,   -7909,   -7531,   19118,    7721,  -12659},
-{   1926,   15101,  -12848,    2153,   21631,    1864},
-{  -2130,   23416,   17056,  -15597,   -1544,      87},
-{   8314,  -11824,   14581,  -20591,    7891,   -2099},
-{  19600,   22814,  -17304,   -2040,     285,   -3863},
-{  -8214,  -18322,   10724,  -13744,  -13469,   -1666},
-{  14351,    4880,  -20034,     964,   -4221,    -180},
-{ -24598,  -16635,   19724,    5925,    4777,    4414},
-{  -2495,   23493,  -16141,    2918,   -1038,   -2010},
-{  18974,   -2540,   13343,    1405,   -6194,   -1136},
-{   2489,   13670,   22638,   -7311,    -129,   -2792},
-{ -13962,   16775,   23012,     728,    3397,     162},
-{   3038,     993,    8774,  -21969,   -6609,     910},
-{ -12444,  -22386,   -2626,   -5295,   19520,    9872},
-{  -1911,  -18274,  -18506,  -14962,    4760,    7119},
-{   8298,   -2978,   25886,    7660,   -7897,    1020},
-{   6132,   15127,   18757,  -24370,   -6529,   -6627},
-{   7924,   12125,   -9459,  -23962,    5502,     937},
-{ -17056,   -5373,    2522,     327,    1129,    -390},
-{  15774,   19955,  -10380,   11172,   -3107,   14853},
-{ -11904,   -8091,  -17928,  -22287,  -17237,   -6803},
-{ -12862,   -2172,   -6509,    5927,   12458,  -22355},
-{   -497,     322,    1038,   -6643,   -5404,   20311},
-{   1083,  -22984,   -8494,   12130,    -762,    2623},
-{   5067,   19712,   -1901,     -30,    -325,      85},
-{    987,   -5830,    4212,   -9030,    9121,  -25038},
-{  -7868,    7284,  -12292,   12914,  -21592,   20941},
-{  -1630,   -7694,   -2187,   -8525,   -5604,  -25196},
-{  -6668,     388,  -22535,    1526,    9082,     193},
-{  -7867,  -22308,    5163,     362,     944,    -259},
-{   3824,  -11850,    7591,  -23176,   25342,   23771},
-{ -10504,    4123,  -21111,   21173,   22439,    -838},
-{  -4723,   21795,    6184,    -122,    1642,    -717},
-{  24504,   19887,   -2043,     986,       7,     -55},
-{ -27313,    -135,    2437,     259,      89,     307},
-{  24446,   -3873,   -5391,    -820,   -2387,     361},
-{   5529,    5784,   18682,     242,  -21896,   -4003},
-{  22304,    4483,     722,  -12242,    7570,   15448},
-{   8673,    3009,   20437,   21108,  -21100,   -3080},
-{  -1132,    2705,   -1825,    5420,    -785,   18532},
-{  16932,  -13517,  -16509,  -14858,  -20327,  -14221},
-{   2219,    1380,   21474,   -1128,     327,      83},
-{  -2177,   21517,   -3856,  -14180,    -204,   -2191},
-{    953,   -9426,   15874,  -10710,   -3231,   21030},
-{   -421,   -1377,     640,   -8239,  -20976,    2174},
-{   4309,   18514,   -9100,  -18319,  -15518,    3704},
-{  -5943,     449,   -8387,    1075,  -22210,   -4992},
-{   2953,   12788,   18285,    1430,   14937,   21731},
-{  -2913,     401,   -4739,  -20105,    1699,   -1147},
-{   3449,    5241,    8853,   22134,   -7547,    1451},
-{  -2154,    8584,   18120,  -15614,   19319,   -5991},
-{   3501,    2841,    5897,    6397,    8630,   23018},
-{   2467,    2956,     379,    5703,  -22047,   -2189},
-{ -16963,    -594,   18822,   -5295,    1640,     774},
-{   2896,   -1424,    3586,   -2292,   19910,   -1822},
-{ -18575,   21219,  -14001,  -12573,   16466,     635},
-{  -1998,  -19314,  -16527,   12208,  -16576,   -7854},
-{  -9674,    1012,  -21645,    2883,  -12712,    2321},
-{  -1005,     471,   -3629,    8045,  -11087,   25533},
-{   4141,  -21472,   -2673,     756,    -663,    -523},
-{   6490,    8531,   19289,   18949,    6092,   -9347},
-{  16965,   24599,   14024,   10072,    -536,  -10438},
-{  -8147,    2145,  -23028,  -17073,    5451,   -4401},
-{ -14873,   20520,  -18303,   -9717,  -11885,  -17831},
-{  -2290,  -14120,    2070,   22467,    1671,     725},
-{  -8538,   14629,    3521,  -20577,    6673,    8200},
-{  20248,    4410,   -1366,    -585,    1229,   -2449},
-{   7467,   -7148,   13667,   -8246,   22392,  -17320},
-{  -1932,    3875,   -9064,   -3812,     958,     265},
-{  -4399,    2959,  -15911,   19598,    4954,   -1105},
-{  18009,   -9923,  -18137,   -3862,   11178,    5821},
-{ -14596,   -1227,    9660,   21619,   11228,  -11721},
-{   -721,   -1700,     109,   -2142,      61,   -6772},
-{ -24619,  -22520,    5608,   -1957,   -1761,   -1012},
-{ -23728,   -4451,   -2688,  -14679,   -4266,    9919},
-{   8495,    -894,   20438,  -13820,  -17267,     139},
-};
-static const int16_t vq_hebap6[256][6] = {
-{  10154,    7365,   16861,   18681,  -22893,   -3636},
-{  -2619,   -3788,   -5529,   -5192,   -9009,  -20298},
-{  -5583,  -22800,   21297,    7012,     745,     720},
-{    428,   -1459,     109,   -3082,     361,   -8403},
-{   8161,   22401,     241,    1755,    -874,   -2824},
-{   1140,   12643,    2306,   22263,  -25146,  -17557},
-{  -2609,    3379,   10337,  -19730,  -15468,  -23944},
-{  -4040,  -12796,  -25772,   13096,    3905,    1315},
-{   4624,  -23799,   13608,   25317,   -1175,    2173},
-{    -97,   13747,   -5122,   23255,    4214,  -22145},
-{   6878,    -322,   18264,    -854,  -11916,    -733},
-{  17280,  -12669,   -9693,   23563,  -16240,   -1309},
-{   5802,   -4968,   19526,  -21194,  -24622,    -183},
-{   5851,  -16137,   15229,   -9496,   -1538,     377},
-{  14096,   25057,   13419,    8290,   23320,   16818},
-{  -7261,     118,  -15867,   19097,    9781,    -277},
-{  -4288,   21589,  -13288,  -16259,   16633,   -4862},
-{   4909,  -19217,   23411,   14705,    -722,     125},
-{  19462,   -4732,   -1928,  -11527,   20770,    5425},
-{ -27562,   -2881,   -4331,     384,   -2103,    1367},
-{   -266,   -9175,    5441,   26333,   -1924,    4221},
-{  -2970,  -20170,  -21816,    5450,   -7426,    5344},
-{   -221,   -6696,     603,   -9140,    1308,  -27506},
-{   9621,   -8380,   -1967,    9403,   -1651,   22817},
-{   7566,   -5250,   -4165,    1385,    -990,     560},
-{  -1262,   24738,  -19057,   10741,    7585,   -7098},
-{    451,   20130,   -9949,   -6015,   -2188,   -1458},
-{  22249,    9380,    9096,   10959,   -2365,   -3724},
-{  18668,    -650,   -1234,   11092,    7678,    5969},
-{  19207,   -1485,   -1076,    -731,    -684,      43},
-{  -4973,   13430,   20139,      60,     476,    -935},
-{ -20029,    8710,    2499,    1016,   -1158,     335},
-{ -26413,   18598,   -2201,    -669,    3409,     793},
-{  -4726,    8875,  -24607,   -9646,    3643,    -283},
-{  13303,  -21404,   -3691,   -1184,   -1970,    1612},
-{    173,      60,     919,    1229,    6942,    -665},
-{  16377,   16991,    5341,  -14015,   -2304,  -20390},
-{  25334,  -10609,   11947,   -7653,   -6363,   14058},
-{  23929,  -13259,   -7226,    -937,     234,    -187},
-{   6311,   -1877,   12506,   -1879,   18751,  -23341},
-{    621,    6445,    3354,  -24274,    8406,    5315},
-{  -3297,   -5034,   -4704,   -5080,  -25730,    5347},
-{  -1275,  -13295,    -965,  -23318,    1214,   26259},
-{  -6252,   10035,  -20105,   15301,  -16073,    5136},
-{   9562,   -3911,  -19510,    4745,   22270,   -4171},
-{   7978,  -19600,   14024,   -5745,  -20855,    8939},
-{      7,   -4039,     991,   -6065,      52,  -19423},
-{   3485,    2969,    7732,    7786,   25312,    6206},
-{   -959,  -12812,   -1840,  -22743,    7324,   10830},
-{  -4686,    1678,  -10172,   -5205,    4294,   -1271},
-{   3889,    1302,    7450,     638,   20374,   -3133},
-{ -12496,   -9123,   18463,  -12343,   -7238,   18552},
-{  -6185,    8649,   -6903,    -895,   17109,   16604},
-{  -9896,   28579,    2845,    1640,    2925,    -298},
-{  14968,  -25988,   14878,  -24012,    1815,   -6474},
-{  26107,    5166,   21225,   15873,   21617,   14825},
-{ -21684,   16438,   20504,  -14346,   -7114,   -4162},
-{  28647,      90,   -1572,     789,    -902,     -75},
-{  -1479,    2471,   -4061,    3612,   -2240,   10914},
-{   8616,   17491,   17255,  -17456,   17022,  -16357},
-{ -20722,  -18597,   25274,   17720,   -3573,    1695},
-{   -997,    6129,   -6303,   11250,  -11359,  -19739},
-{    -74,   -4001,   -1584,   13384,     162,    -144},
-{   -529,   21068,    7923,  -11396,     422,     -26},
-{   7102,  -13531,  -20055,    2629,    -178,    -429},
-{   9201,    1368,  -22238,    2623,  -20499,   24889},
-{   -432,    6675,    -266,    8723,      80,   28024},
-{  19493,   -3108,   -9261,    1910,  -21777,    5345},
-{  14079,  -11489,   12604,    6079,   19877,    1315},
-{  10947,    9837,  -18612,   15742,    4792,     605},
-{  -1777,    3758,   -4087,   21696,    6024,    -576},
-{   3567,   -3578,   16379,    2680,   -1752,     716},
-{  -5049,   -1399,   -4550,    -652,  -17721,   -3366},
-{  -3635,   -4372,   -6522,  -22152,    7382,    1458},
-{  12242,   19190,    5646,   -7815,  -20289,   21344},
-{  -7508,   19952,   23542,   -9753,    5669,   -1990},
-{  -2275,   15438,   10907,  -17879,    6497,   13582},
-{ -15894,  -15646,   -4716,    6019,   24250,   -6179},
-{  -2049,   -6856,   -1208,     918,   17735,     -69},
-{  -3721,    9099,  -16065,  -23621,    5981,   -2344},
-{   7862,   -8918,   24033,   25508,  -11033,    -741},
-{ -12588,   19468,   14649,   15451,  -21226,    1171},
-{   2102,    1147,    2789,    4096,    2179,    8750},
-{ -18214,  -17758,  -10366,   -5203,   -1066,   -3541},
-{  -2819,  -19958,  -11921,    6032,    8315,   10374},
-{  -9078,   -2100,   19431,     -17,     732,    -689},
-{ -14512,  -19224,   -7095,   18727,    1870,   22906},
-{   3912,     659,   25597,   -4006,    9619,     877},
-{   2616,   22695,   -5770,   17920,    3812,   20220},
-{   2561,   26847,   -5245,  -10908,    2256,    -517},
-{  -4974,     198,  -21983,   -3608,   22174,  -18924},
-{  21308,   -1211,   19144,   16691,   -1588,   11390},
-{  -1790,    3959,   -3488,    7003,   -7107,   20877},
-{  -6108,  -17955,  -18722,   24763,   16508,    3211},
-{  20462,  -24987,  -20361,    4484,   -5111,    -478},
-{  -6378,   -1998,  -10229,    -561,  -22039,  -22339},
-{   3047,  -18850,    7586,   14743,  -19862,    6351},
-{  -5047,    1405,   -9672,    1055,  -21881,   11170},
-{   3481,   -9699,    6526,  -16655,   22813,   21907},
-{ -18570,   17501,   14664,    1291,    5026,   19676},
-{  16134,  -19810,  -16956,  -17939,  -16933,    5800},
-{  -8224,    4908,    8935,    2272,   -1140,  -23217},
-{   1572,    2753,   -1598,    2143,   -3346,  -21926},
-{  -9832,   -1060,  -27818,    1214,    7289,     150},
-{     98,    1538,     535,   17429,  -23198,    -901},
-{  21340,  -20146,    3297,   -1744,   -8207,  -21462},
-{  -4166,   -4633,  -17902,    5478,    1285,     136},
-{  18713,   21003,   24818,   11421,    1282,   -4618},
-{  -3535,    7636,    -265,    2141,    -829,   -2035},
-{  -3184,   19713,    2775,      -2,    1090,     104},
-{  -6771,  -20185,    2938,   -2125,     -36,    1268},
-{   9560,    9430,    9586,   22100,   13827,    6296},
-{   -535,  -20018,    4276,   -1868,    -448,  -17183},
-{ -24352,   14244,  -13647,  -21040,    2271,   11555},
-{  -2646,   15437,   -4589,   18638,   -4299,    -622},
-{ -20064,    4169,   18115,   -1404,   13722,   -1825},
-{ -16359,    9080,     744,   22021,     125,   10794},
-{   9644,  -14607,  -18479,  -14714,   11174,  -20754},
-{   -326,  -23762,    6144,    7909,     602,    1540},
-{  -6650,    6634,  -12683,   21396,   20785,   -6839},
-{   4252,  -21043,    5628,   18687,   23860,    8328},
-{  17986,    5704,   -5245,  -18093,    -555,    3219},
-{   6091,   14232,   -5117,  -17456,  -19452,  -11649},
-{ -21586,   11302,   15434,   25590,    6777,  -26683},
-{  21355,   -8244,    5877,   -3540,    6079,   -2567},
-{   2603,   -2455,    5421,  -12286,  -19100,    5574},
-{  -1721,  -26393,  -23664,   22904,    -349,    3787},
-{   2189,   -1203,    5340,    3249,  -22617,     104},
-{  -1664,  -11020,   -2857,  -20723,  -24049,   19900},
-{  22873,   -7345,  -18481,  -14616,   -8400,  -12965},
-{   3777,    3958,    8239,   20494,   -6991,   -1201},
-{   -160,   -1613,    -793,   -8681,     573,     776},
-{   4297,   -3786,   20373,    6082,   -5321,  -18400},
-{  18745,    2463,   12546,   -7749,   -7734,   -2183},
-{  11074,   -4720,   22119,    1825,  -24351,    4080},
-{   1503,  -19178,   -1569,      13,    -313,     375},
-{    318,    -575,    2544,     178,     102,      40},
-{ -15996,  -26897,    5008,    3320,     686,    1159},
-{  25755,   26886,     574,   -5930,   -3916,    1407},
-{  -9148,   -7665,   -2875,   -8384,  -18663,   26400},
-{  -7445,  -18040,  -18396,    8802,   -2252,  -21886},
-{   7851,   11773,   27485,  -12847,   -1410,   19590},
-{   2240,    5947,   11247,   15980,   -6499,   24280},
-{  21673,  -18515,    9771,    6550,   -2730,     334},
-{  -4149,    1576,  -11010,      89,  -24429,   -5710},
-{   7720,    1478,   21412,  -25025,   -8385,       9},
-{  -2448,   10218,  -12756,  -16079,    1161,  -21284},
-{  -8757,  -14429,  -22918,  -14812,    2629,   13844},
-{  -7252,    2843,   -9639,    2882,  -14625,   24497},
-{   -674,   -6530,     414,  -23333,  -21343,     454},
-{   2104,   -6312,   10887,   18087,   -1199,     175},
-{   -493,    -562,   -2739,     118,   -1074,      93},
-{ -10011,   -4075,  -28071,   22180,   15077,    -636},
-{  -4637,  -16408,   -9003,  -20418,  -11608,  -20932},
-{   4815,   15892,   24238,  -13634,   -3074,   -1059},
-{  -6724,    4610,  -18772,  -15283,  -16685,   23988},
-{  15349,    -674,   -3682,   21679,    4475,  -12088},
-{   4756,    2593,    5354,    6001,   15063,   26490},
-{ -23815,  -17251,    6944,     378,     694,     670},
-{  23392,   -8839,  -14713,    7544,    -876,   11088},
-{   3640,    3336,   22593,   -3495,   -2328,    -113},
-{    284,    6914,    3097,   10171,    6638,  -18621},
-{   2472,    5976,   11054,  -11936,    -603,    -663},
-{  16175,   16441,   13164,   -4043,    4667,    7431},
-{  19338,   15534,   -6533,    1681,   -4857,   17048},
-{  17027,     532,  -19064,   -1441,   -5130,    1085},
-{ -12617,  -17609,    2062,  -25332,   19009,  -16121},
-{  10056,  -21000,  -13634,   -2949,   15367,   19934},
-{   -648,   -1605,   10046,   -1592,   13296,   19808},
-{  -1054,   10744,     538,   24938,    9630,   -9052},
-{ -10099,    3042,  -25076,  -24052,   13971,     100},
-{   6547,    6907,    7031,   10348,   23775,  -17886},
-{ -22793,   -1984,   -1393,   -3330,    9267,   14317},
-{ -14346,   -3967,    3042,   16254,  -17303,    9646},
-{ -21393,   23628,   16773,     716,    2663,     114},
-{ -19016,   -3038,    1574,    -245,    1463,    -793},
-{  22410,   23441,  -14637,    -530,   17310,   13617},
-{ -11582,    7935,  -13954,   23465,  -24628,   26550},
-{  -1045,    3679,   -2218,   10572,   20999,   -3702},
-{ -15513,     197,   16718,  -24603,    4945,       5},
-{  10781,    4335,   26790,   -9059,  -16152,   -2840},
-{  16075,  -24100,   -3933,   -6833,   12645,   -7029},
-{   2096,  -25572,   -8370,    6814,      11,    1178},
-{ -11848,    -583,   -8889,  -20543,  -10471,    -380},
-{  -2487,   24777,  -21639,  -19341,    1660,    -732},
-{   2313,   13679,    4085,   24549,   24691,  -21179},
-{  -2366,    -504,   -4130,  -10570,   23668,    1961},
-{  20379,   17809,   -9506,    3733,  -18954,   -6292},
-{  -3856,   16802,    -929,  -20310,  -17739,    6797},
-{  12431,    6078,  -11272,  -14450,    6913,   23476},
-{   7636,   -1655,   23017,   10719,   -8292,     838},
-{  -8559,   -1235,  -18096,    3897,   16093,    1490},
-{  -3586,    8276,   15165,   -3791,  -21149,    1741},
-{  -4497,   21739,    2366,    -278,   -4792,   15549},
-{ -23122,  -13708,    7668,   16232,   24120,   15025},
-{ -20043,   12821,  -20160,   16691,  -11655,  -16081},
-{ -12601,   20239,    3496,   -2549,   -6745,  -11850},
-{   4441,    7812,   20783,   17080,   11523,   -9643},
-{  24766,    8494,  -23298,   -3262,   11101,   -7120},
-{ -10107,   -7623,  -22152,  -18303,   26645,    9550},
-{ -25549,     477,    7874,   -1538,    1123,    -168},
-{    470,    9834,    -347,   23945,  -10381,   -9467},
-{  -4096,   -9702,   -6856,  -21544,   20845,    7174},
-{   5370,    9748,  -23765,   -1190,     512,   -1538},
-{  -1006,  -10046,  -12649,   19234,   -1790,    -890},
-{  15108,   23620,  -15646,   -2522,   -1203,   -1325},
-{  -7406,   -2605,    1095,    -247,    -473,     177},
-{   8089,       4,   12424,  -22284,   10405,   -7728},
-{  22196,   10775,   -5043,     690,     534,    -212},
-{  -3153,   -1418,  -16835,   18426,   15821,   22956},
-{   5681,   -2229,    3196,   -3414,  -21817,  -14807},
-{     19,     787,    1032,     170,   -8295,    -645},
-{   -882,   -2319,  -27105,     432,   -4392,    1499},
-{  -1354,  -11819,     -76,  -20380,  -10293,   11328},
-{    211,   -4753,   -4675,   -6933,  -13538,   14479},
-{   6043,    5260,    -459,    -462,     143,     -65},
-{  -2572,    7256,   -3317,    9212,  -23184,   -9990},
-{ -24882,   -9532,   18874,    6101,    2429,  -14482},
-{   8314,    2277,   14192,    3512,   25881,   22000},
-{    208,   20218,    -281,  -24778,     -63,   -1183},
-{   1095,   -6034,    2706,  -21935,   -2655,     563},
-{     23,   -5930,     243,   -8989,    5345,   20558},
-{ -15466,   12699,    4160,   11087,   20621,  -10416},
-{  20995,     -85,   -8468,     194,    1003,   -9515},
-{ -19637,   -3335,  -14081,    3574,  -23381,    -667},
-{  -2076,    3489,   -3192,  -19367,     539,   -1530},
-{   7352,  -15213,   22596,   19369,    1043,   16627},
-{  -1872,    -413,    1235,   -5276,   -3550,   21903},
-{   7931,   -2008,   16968,   -6799,   29393,   -2475},
-{ -13589,    8389,  -23636,  -22091,  -14178,  -14297},
-{ -11575,  -20090,   16056,   -1848,   15721,    4500},
-{   3849,  -16581,   20161,  -21155,    7778,   11864},
-{  -6547,   -1273,  -18837,  -11218,   11636,    1044},
-{   2528,   -6691,  -17917,  -11362,   -4894,   -1008},
-{   1241,    4260,    2319,    6111,    3485,   20209},
-{   3014,   -3048,    5316,   -4539,   20831,    8702},
-{  -1790,  -14683,     278,   13956,  -10065,  -10547},
-{ -22732,   -7957,   -1154,   13821,   -1484,   -1247},
-{  -7317,    -615,   13094,   18927,    9897,    1452},
-{   2552,   -2338,    3424,   -4630,   11124,  -19584},
-{ -11125,  -20553,  -10855,  -10783,  -20767,    6833},
-{    984,  -15095,    5775,   25125,    5377,  -19799},
-{    517,   13272,   -7458,   -1711,   20612,   -6013},
-{ -21417,   13251,  -20795,   13449,   17281,   13104},
-{ -15811,  -16248,   23093,   -4037,   -8195,     871},
-{    582,   12571,  -21129,  -14766,   -9187,    5685},
-{   4318,   -1776,   11425,  -17763,   -9921,     577},
-{   6013,   16830,   17655,  -25766,   -4400,   -3550},
-{ -13744,  -16541,    3636,   -3330,  -21091,  -15886},
-{   6565,  -11147,    8649,  -13114,   23345,  -13565},
-{  -2542,   -9046,   -7558,   29240,    3701,    -383},
-{ -10612,   24995,    1893,   -8210,   20920,  -16210},
-{   5276,   16726,   10659,   19940,   -4799,  -19324},
-{   -532,   -9300,   27856,    4965,    -241,     536},
-{   -765,  -20706,   -3412,   18870,    2765,    1420},
-{  -3059,    2708,  -19022,    -331,    3537,     116},
-};
-static const int16_t vq_hebap7[512][6] = {
-{ -21173,   21893,   10390,   13646,   10718,   -9177},
-{ -22519,   -8193,   18328,   -6629,   25518,  -10848},
-{   6800,  -13758,  -13278,   22418,   14667,  -20938},
-{   2347,   10516,    1125,   -3455,    5569,   27136},
-{  -6617,   11851,  -24524,   22937,   20362,   -6019},
-{ -21768,   10681,  -19615,  -15021,   -8478,   -2081},
-{  -2745,    8684,   -4895,   27739,    7554,  -11961},
-{  -1020,    2460,    -954,    4754,    -627,  -16368},
-{ -19702,   23097,      75,  -13684,   -2644,    2108},
-{   4049,   -2872,    5851,   -4459,   22150,   12560},
-{ -21304,  -17129,    -730,    7419,  -11658,  -10523},
-{  11332,    1792,   26666,   23518,  -19561,    -491},
-{ -17827,  -16777,  -13606,  -14389,  -22029,   -2464},
-{   1091,   -5967,   -7975,  -16977,  -20432,  -21931},
-{  18388,   -1103,    1933,   13342,  -17463,   18114},
-{  22646,   17345,   -9966,   17919,   18274,     698},
-{   1484,   20297,   -5754,  -26515,    4941,  -22263},
-{  -2603,    4587,   -5842,   18464,    8767,   -2568},
-{  -2797,   -1602,   21713,    3099,  -25683,    3224},
-{ -19027,    4693,   -5007,    6060,    1972,  -15095},
-{  -2189,    9516,    -530,   20669,   -4662,   -8301},
-{ -22325,   -8887,    2529,  -11352,    5476,     998},
-{  22100,   -5052,    1651,   -2657,    4615,    2319},
-{  20855,   -3078,   -3330,    4105,   13470,    3069},
-{     85,   17289,   10264,  -14752,     214,      90},
-{ -26365,  -18849,  -19352,   19244,  -10218,    9909},
-{  -9739,   20497,   -6579,   -6983,    2891,    -738},
-{  20575,  -15860,  -22913,    6870,      76,     327},
-{   8744,  -12877,  -22945,   -2372,  -19424,   -9771},
-{ -12886,   16183,   21084,    3821,     749,  -13792},
-{ -15995,   18399,    2391,  -17661,   19484,   -6018},
-{   1423,   11734,    4051,   19290,    6857,  -19681},
-{  -5200,    9766,   18246,    2463,   18764,   -4852},
-{   -597,   19498,    1323,   -9096,    -308,   -1104},
-{  -3099,  -25731,  -15665,   25332,    4634,    2635},
-{  19623,   -2384,   -7913,   11796,   -9333,  -14084},
-{   2642,   26453,  -21091,  -10354,   -1693,   -1711},
-{  22031,   21625,   11580,  -22915,   -4141,     129},
-{  -6122,    3542,     915,    -261,     -17,    -383},
-{   1696,    6704,   -1425,   20838,     857,   -4416},
-{   1423,  -15280,   -8550,   -9667,    5210,    5687},
-{  -4520,    -613,  -11683,    5618,    4230,     619},
-{    937,   -4963,  -14102,  -17104,   -6906,   -5952},
-{ -15068,    -481,   -7237,  -14894,   18876,   21673},
-{ -25658,    2910,    1143,    -327,    -458,    -995},
-{  -9656,    -819,  -24900,    2804,   20225,    1083},
-{  -1111,   -3682,   -1788,  -19492,     966,     821},
-{   7293,  -21759,   10790,   -7059,  -23293,   -1723},
-{   -282,  -11093,     170,  -20950,  -28926,   12615},
-{  17938,    3713,   -1563,     885,       5,     564},
-{   6116,   22696,    2242,   -6951,    9975,   -6132},
-{   4338,   26808,   -3705,    1976,   -1079,   -2570},
-{   -661,   -7901,   -2668,  -15194,   17722,    4375},
-{  -4174,  -11053,     717,  -22506,    1562,   12252},
-{  -6405,   18334,    6103,    6983,    5956,   18195},
-{   9851,    5370,   23604,   -6861,   -6569,     -62},
-{  21964,   13359,    -683,    3785,    2168,     209},
-{  -3569,   -1127,  -19724,   -1544,    1308,    -803},
-{  -3083,   16049,  -13791,   -3077,    4294,   23713},
-{  -9999,    9943,  -15872,   12934,  -23631,   21699},
-{   9722,   22837,   12192,   15091,    5533,    4837},
-{   2243,    2099,    1243,    4089,    4748,   12956},
-{   4007,   -2468,    3353,   -3092,    8843,   17024},
-{   4330,    6127,    5549,    9249,   11226,   28592},
-{  -9586,   -8825,     236,    1009,     455,    -964},
-{   6829,   19290,   -1018,     200,    1821,     578},
-{   5196,     957,   10372,    3330,  -12800,    -127},
-{  -3022,   -8193,  -14557,   22061,    5920,    1053},
-{  10982,   25942,  -24546,  -23278,  -11905,   -6789},
-{  22667,  -11010,    5736,    2567,   23705,  -10253},
-{  -3343,   -4233,   -5458,   20667,  -10843,   -3605},
-{  -4131,   -3612,    4575,    -829,    -350,    -847},
-{  -3303,    3451,   -7398,  -11604,    3023,     455},
-{   3200,   -9547,    3202,  -22893,   11184,  -26466},
-{ -14093,   -4117,   15382,   14295,  -10915,  -20377},
-{   3807,  -11016,   22052,   14370,  -15328,   -7733},
-{  -6291,  -17719,   -1560,   12048,  -19805,    -443},
-{  -6147,   -4234,    -160,    8363,   22638,   11911},
-{  19197,    1175,    7422,   -9875,   -4136,    4704},
-{    -72,   -7652,    -112,  -11955,   -3230,   27175},
-{   3274,    5963,    7501,  -17019,     866,  -25452},
-{    737,    1861,    1833,    2022,    2384,    4755},
-{  -5217,    7512,    3323,    2715,    3065,   -1606},
-{   4247,     565,    5629,    2497,   18019,   -4920},
-{  -2833,  -17920,   -8062,   15738,   -1018,    2136},
-{   3050,  -19483,   16930,   29835,  -10222,   15153},
-{ -11346,     118,  -25796,  -13761,   15320,    -468},
-{  -4824,    4960,   -4263,    1575,  -10593,   19561},
-{  -8203,   -1409,    -763,   -1139,    -607,    1408},
-{  -2203,  -11415,    2021,   -6388,   -2600,     711},
-{   -413,   -2511,    -216,   -3519,  -28267,    1719},
-{ -14446,   17050,   13917,   13499,  -25762,  -16121},
-{  19228,    7341,  -12301,     682,   -3791,    -199},
-{  -4193,   20746,  -15651,   11349,    5860,    -824},
-{ -21490,   -3546,      -3,   -1705,   -3959,    9213},
-{  15445,   -1876,    2012,  -19627,   16228,   -4845},
-{  -2867,   -3733,   -7354,    -175,  -20119,   11174},
-{  -3571,  -24587,   19700,    6654,     979,    -654},
-{  21820,   -7430,   -6639,  -10767,   -8362,   15543},
-{  14827,   17977,   -7204,   -3409,    1906,  -17288},
-{   3525,   -3947,   -1415,   -2798,   17648,    2082},
-{  -6580,  -15255,  -17913,    1337,   15338,   21158},
-{   6210,    9698,   15155,  -24666,  -22507,   -3999},
-{  -1740,    -593,    1095,   -7779,   25058,    5601},
-{  21415,    -432,   -1658,   -6898,   -1438,  -14454},
-{  -6943,     700,  -12139,    -745,  -24187,   22466},
-{   6287,    3283,   11006,    3844,   19184,   14781},
-{ -22502,   15274,    5443,   -2808,    -970,   -3343},
-{   3257,   -3708,    4744,   -8301,   22814,  -10208},
-{  24346,  -20970,   19846,     987,  -11958,   -6277},
-{   3906,  -19701,   13060,   -1609,   18641,    7466},
-{ -26409,  -22549,   16305,    2014,   10975,   18032},
-{  -7039,    4655,  -14818,   18739,   15789,    1296},
-{   9310,   -1681,   14667,   -3326,   26535,  -11853},
-{   5728,    5917,   13400,   10020,   -2236,  -24704},
-{   1741,   -6727,   12695,  -22009,    4080,    5450},
-{  -2621,    9393,   21143,  -25938,   -3162,   -2529},
-{  20672,   18894,  -13939,    6990,   -8260,   15811},
-{ -23818,   11183,  -13639,   11868,   16045,    2630},
-{  18361,  -10220,     829,     856,   -1010,     157},
-{  14400,   -4678,    5153,  -13290,  -27434,  -11028},
-{  21613,   11256,   17453,    7604,   13130,    -484},
-{      7,    1236,     573,    4214,    5576,   -3081},
-{    916,   -9092,    1285,   -8958,    1185,  -28699},
-{  21587,   23695,   19116,   -2885,  -14282,   -8438},
-{  23414,   -6161,   12978,    3061,   -9351,    2236},
-{  -3070,   -7344,  -20140,    5788,     582,    -551},
-{  -3993,     315,   -7773,    8224,  -28082,  -12465},
-{  13766,  -15357,   19205,  -20624,   13043,  -19247},
-{   3777,    -177,    8029,   -1001,   17812,    5162},
-{  -7308,   -4327,  -18096,    -620,   -1350,   14932},
-{  14756,   -1221,  -12819,  -14922,    -547,   27125},
-{   2234,    1708,    2764,    5416,    7986,  -25163},
-{   2873,    3636,    3992,    5344,   10142,   21259},
-{   1158,    5379,     508,  -10514,     290,   -1615},
-{   1114,   24789,   16575,  -25168,    -298,   -2832},
-{  -1107,   -6144,   -1918,   -7791,   -2971,  -23276},
-{   4016,   10793,   17317,   -4342,  -20982,   -3383},
-{  -4494,    -207,   -9951,   -3575,    7947,    1154},
-{  -7576,    8117,  -14047,   16982,  -26457,  -27540},
-{ -15164,   16096,  -16844,   -8886,  -23720,   15906},
-{  24922,    5680,   -1874,     420,     132,     117},
-{   -506,  -19310,    -198,     412,    -311,     752},
-{  -1906,    3981,   -7688,   16566,  -19291,  -14722},
-{   -399,    -729,   -3807,   -4196,  -12395,    7639},
-{   3368,    2330,    9092,   23686,  -10290,   -1705},
-{  -3148,    2596,   -7986,   14602,   -4807,   16627},
-{   8057,    1481,      49,   17205,   24869,    7474},
-{ -19304,    -513,   11905,    2346,    5588,    3365},
-{  -5063,  -21812,   11370,   10896,    4881,     261},
-{   4794,   20577,    5109,   -6025,   -8049,   -1521},
-{   8125,  -14756,   20639,  -14918,   23941,   -3650},
-{  12451,    1381,    3613,    8687,  -24002,    4848},
-{   6726,   10643,   10086,   25217,  -25159,   -1065},
-{   6561,   13977,    2911,   21737,   16465,  -26050},
-{  -1776,    2575,  -19606,  -16800,    3032,    6679},
-{  15012,  -17910,   -8438,  -21554,  -27111,   11808},
-{   3448,    -924,  -15913,   -1135,    5126,  -20613},
-{   7720,    2226,   17463,    5434,   28942,   17552},
-{   1246,   15614,  -11743,   24618,  -17539,    3272},
-{   3215,   17950,    2783,    -722,  -22672,    5979},
-{  -5678,   -3184,  -26087,   26034,    6583,    3302},
-{  20310,   -3555,   -2715,    -444,   -1487,    1526},
-{ -20640,  -21970,  -12207,  -25793,    8863,   -1036},
-{  17888,     570,  -16102,    8329,   -2553,   15275},
-{  -2677,    9950,   -1879,   16477,  -12762,  -29007},
-{   -120,   -2221,     219,      97,     365,      35},
-{   1270,    -718,    1480,   -2689,    1930,   -7527},
-{   1896,    8750,    1906,   18235,  -12692,   -6174},
-{  -3733,   13713,   -9882,  -15960,   -1376,   -7146},
-{ -10600,    8496,   15967,   -8792,    7532,   20439},
-{   3041,  -13457,    1032,  -26952,    5787,   24984},
-{  -4590,   -8220,   -9322,   -6112,  -17243,   25745},
-{ -17808,    6970,    3752,     626,    -114,    2178},
-{   4449,   -4862,    7054,   -5404,    4738,   -2827},
-{   4922,    -651,   18939,   -9866,     848,    1886},
-{   -336,   -5410,    7234,   20444,   -9583,    -600},
-{    781,  -19474,  -12648,    6634,    1414,     450},
-{  -3399,  -16770,   11107,   13200,   -5498,   21663},
-{  -3265,    4859,   -5961,    7530,  -10837,   28086},
-{  10350,  -12901,   25699,   25640,    -639,     351},
-{   1163,   18763,   -5466,  -15087,    -145,   -1377},
-{ -14477,   27229,  -31383,  -32653,   21439,   -2894},
-{  15420,   18823,   22128,   19398,   22583,   13587},
-{ -10674,   10710,    5089,   -4756,     909,  -20760},
-{ -12948,  -20660,    7410,    2722,    3427,   11585},
-{  -1105,   18374,   19731,   -9650,   22442,   19634},
-{   -296,   -6798,  -14677,   21603,   19796,   21399},
-{ -19350,   -7501,   25446,   13144,    8588,  -25298},
-{   3092,  -10618,   20896,    9249,   -3326,    1796},
-{   -811,    1449,    3106,    4748,   12073,  -14262},
-{ -20720,   14275,   -4332,  -25838,   -5781,  -21149},
-{  -5132,   10554,  -14020,  -22150,    2840,    -554},
-{  25533,   17648,   14886,  -21074,    2459,   25142},
-{  -9370,   -1788,  -12862,   -5870,  -25811,  -11023},
-{   6698,     819,   10313,     166,   27581,     523},
-{    101,  -19388,    3413,    9638,      64,     806},
-{  -2742,  -17931,   -2576,   22818,    8553,    1126},
-{   2972,   15203,    1792,   25434,   -5728,  -17265},
-{  -1419,    1604,    4398,   11452,    1731,   23787},
-{  -5136,    4625,  -10653,   27981,    9897,   -2510},
-{ -10528,  -28033,    2999,   -1530,    -832,    -830},
-{ -11133,  -12511,   22206,   -7243,  -23578,  -21698},
-{  16935,  -21892,    1861,   -9606,    9432,   19026},
-{  10277,    9516,   26815,    2010,   -4943,   -9080},
-{   5547,   -2210,   14270,  -15300,  -19316,    1822},
-{  -4850,    -783,   -8959,   -3076,  -20056,   -3197},
-{   8232,   -2794,  -17752,   13308,    3229,    -991},
-{ -12237,   -6581,   10315,   -9552,    2260,  -20648},
-{  -7000,    5529,   -7553,   -7490,  -10342,  -10266},
-{   3641,   19479,   -5972,  -19097,  -18570,   12805},
-{   1283,   -4164,    4198,  -28473,   -2498,    1866},
-{  16047,   26826,  -13053,   -6316,     985,   -1597},
-{   -403,   13680,    6457,   25070,   27124,  -20710},
-{ -18070,   -1790,  -24986,    5953,    -954,   26600},
-{ -24224,  -15383,   24788,    1953,   -1136,     187},
-{  -2289,   12505,  -20738,    -904,   18324,   21258},
-{   2658,   -6140,   16179,   22276,    -556,    2154},
-{  -6087,   13950,  -25682,  -27713,    4049,   -4795},
-{ -21452,   26473,   19435,   -9124,     895,     303},
-{ -22200,  -26177,   -6026,   24729,  -22926,   -9030},
-{ -14276,  -15982,   23732,  -22851,    9268,   -3841},
-{  29482,   21923,   -6213,    1679,   -2059,   -1120},
-{   -435,    9802,   -3891,   12359,   -4288,  -18971},
-{  19768,     -86,    2467,    1990,   -1021,   -5354},
-{  20986,   -8783,   -5329,  -23562,   -4730,    2673},
-{  -5095,    5605,   -4629,   19150,   26037,  -12259},
-{    972,    6858,    4551,   27949,   -4025,   -2272},
-{   6075,   -3260,   -4989,    -373,   -1571,   -3730},
-{  -7256,  -12992,   -8820,   -5109,   23054,    5054},
-{    920,    2615,    7912,   -7353,   -4905,   20186},
-{   -250,    5454,    3140,    6928,  -18723,   -2051},
-{ -10299,   -4372,   19608,    4879,    -661,   -1885},
-{  14816,   -8603,  -19815,    6135,  -21210,   14108},
-{ -11945,   -2223,    5018,   11892,   22741,     406},
-{ -13184,   -2613,  -13256,  -22433,  -12482,   -8380},
-{  17066,   25267,   -2273,    5056,    -342,     145},
-{   8401,  -17683,   19112,   10615,  -19453,   17083},
-{  20821,   -5700,   12298,  -25598,   10391,    7692},
-{   4550,   15779,   17338,  -19379,   -4768,    1206},
-{  -7723,   10836,  -27164,  -11439,    6835,   -1776},
-{   2542,    3199,    4442,   17513,   -3711,    -914},
-{  20960,  -16774,   -5814,   11087,     -70,   22961},
-{   3305,    2919,    6256,   -4800,  -20966,   -3230},
-{   5924,  -16547,    2183,    2733,    3446,  -23306},
-{  -6061,    -194,  -13852,  -10971,   19488,    1029},
-{   4467,   -5964,  -19004,    1519,    -359,     855},
-{  -1581,   -7607,   22070,  -11580,  -10032,   17102},
-{ -12412,    2553,    4324,   22500,    5751,   12170},
-{ -25127,   17996,   -6384,    1180,    1182,    9622},
-{  23462,   -8471,   -4392,   -2669,    7638,  -16835},
-{  -5511,   -2887,  -10757,  -20883,    7246,    1053},
-{   2703,  -20602,   -7554,    7516,   -7740,    5868},
-{  20670,   21901,     457,   14969,  -17657,  -11921},
-{   3603,   -1595,   -2177,    -157,     -43,     605},
-{   2513,    8954,   10527,   22559,  -16100,  -16041},
-{   6002,    4951,    6795,   -4862,  -22400,   18849},
-{   7590,   -1693,  -24688,   -3404,   14169,    1214},
-{  -4398,   -6663,   -6870,  -10083,  -24596,    9253},
-{  10468,   17751,   -7748,     147,   -6314,    4419},
-{  16187,  -16557,   -4119,    4302,    7625,    5409},
-{   3303,    2735,    7458,  -19902,   -2254,   -3702},
-{  -2077,   21609,   14870,   12545,   -6081,   -1764},
-{   4678,   11740,    2859,    6953,    1919,   -3871},
-{   3522,  -21853,   -2469,  -10453,   18893,  -10742},
-{   3759,  -10191,   -4866,   -2659,  -17831,   -1242},
-{  14991,    9351,   11870,   -1573,   -4848,   22549},
-{   9509,  -27152,   10734,   20851,  -26185,  -17878},
-{  -7170,   -1392,  -19495,   12746,    8198,   -1988},
-{   1883,   28158,    -846,   -7235,     249,     233},
-{  -7200,     669,    -371,   -2948,   23234,   -5635},
-{   3141,     288,    3223,   -1258,     -98,  -27607},
-{  17373,  -23235,    5110,  -11199,   -2574,  -11487},
-{  -4928,    1518,   -5456,     670,  -18278,    1951},
-{  10334,  -19865,   -4649,     361,    -160,    -923},
-{  18732,   14264,   -3155,   -7485,   -3328,    5959},
-{  -3614,   21077,    7276,    3536,    8121,   -1528},
-{  -8422,     500,  -19182,   18929,   26392,   -1039},
-{  15639,   25668,    8375,    1903,    1945,  -11979},
-{  -2716,    3389,   26850,   -4587,    1803,      22},
-{   1177,    -655,    1233,   -2128,    7844,    1767},
-{   -761,    8209,  -19290,   -4593,    1923,    -343},
-{   -689,   -3530,   -3267,   -3804,   -2753,   18566},
-{  -2110,    1962,   -1353,   16643,    2765,  -23102},
-{   -433,    4905,     302,   13016,   15933,   -5905},
-{   3203,    4126,   11181,   -5496,   -2529,   -1160},
-{  -1091,   -6469,   -1415,    5682,    -268,     583},
-{  -9405,  -19572,    6216,    1658,     993,     -75},
-{  -1695,   -4504,   -2289,   -4088,   -6556,  -16577},
-{   4760,    -892,  -10902,    6516,   24199,   -6011},
-{   -253,    1000,      63,     -81,    -115,    -382},
-{  -1333,   24224,    -698,   -4667,   -2801,  -19144},
-{   -876,  -28866,  -21873,   12677,   -6344,    3235},
-{  16847,   21145,  -26172,   -3183,    -396,     230},
-{  18296,   -7790,  -12857,    -679,   -1473,       5},
-{ -10488,   11429,   25805,   -1122,    1401,    -438},
-{   3782,   -7429,   26720,   17567,   19257,   12542},
-{   6332,    -746,   12789,    9316,  -22542,   -5354},
-{   3418,  -22728,   26978,   18303,    1076,     956},
-{ -27315,   -2988,     920,     235,    2233,      81},
-{   6199,    5296,   16093,   14768,   -8429,   -1112},
-{  -6432,   19244,    9921,   -3253,    1278,    -954},
-{  24213,    2049,  -22931,    2585,   -2410,   -4216},
-{   9286,   14282,  -19735,   -3985,   -2344,    1028},
-{ -20128,   17993,   -9458,   23012,  -16983,    8625},
-{  -6896,  -20730,    3762,   17415,   22341,   19024},
-{    842,   24181,   25062,   -5839,     -78,     937},
-{   -621,   19722,  -24204,   -1962,  -14854,     -56},
-{  22766,   -5119,   17365,   23868,  -19480,   -6558},
-{  -2158,   17490,  -21435,    3340,  -12819,  -20295},
-{  -9621,   17325,     715,    2265,   -4123,    -492},
-{   9156,   12947,   27303,  -21175,   -6072,   -9457},
-{ -13164,  -23269,  -14006,   -4184,    6978,       2},
-{    938,  -13381,    3520,  -24297,   22902,   19589},
-{  -4911,  -19774,   19764,   -9310,  -12650,    3819},
-{  -5462,   -4249,   -6987,   -6260,  -13943,  -25150},
-{   9341,   10369,  -13862,   -6704,   22556,    -519},
-{   6651,   18768,   -4855,   12570,   14730,  -10209},
-{   -823,   18119,     398,   -1582,    -116,    -363},
-{  -6935,  -12694,  -28392,    8552,    6961,    -239},
-{  -2602,   -4704,   -1021,    2015,    5129,   23670},
-{ -12559,   -8190,  -25028,   18544,   14179,    1663},
-{   3813,   21036,   -9620,   -5051,   -1800,   -1087},
-{ -22057,   16675,   14960,    9459,    2786,   16991},
-{ -26040,  -19318,   -6414,    1104,    5798,  -18039},
-{  -1737,   24825,   10417,  -11087,     896,   -5273},
-{  -1855,   11661,   -2803,   24809,  -21435,  -19792},
-{ -23473,  -16729,   -5782,    5643,    2636,    4940},
-{  -1724,    4388,  -26673,  -13695,   10570,  -25895},
-{  15358,  -19496,   26242,  -18493,    1736,    8054},
-{   5684,   20890,    4091,  -19100,  -14588,  -10468},
-{  17260,  -16291,   14859,  -17711,  -19174,   12435},
-{ -27185,  -12573,    6743,    -562,     976,    -257},
-{  12395,   -8618,  -22248,  -19843,   11013,    7762},
-{   3799,   11853,  -27622,   -8473,    1089,   -1495},
-{   4141,   -2182,  -26720,    -735,    -774,    1469},
-{   3125,   13762,    4606,   29257,   18771,   -9958},
-{ -17465,   -9445,  -17562,   -2530,   -6435,   -3726},
-{  -1742,    4351,   -6841,  -19773,    9627,  -10654},
-{   7251,    3525,   10835,    5601,   25198,  -23348},
-{ -10300,  -17830,     631,   11640,    2044,  -20878},
-{   -873,   -8502,   -1063,  -15674,  -10693,   14934},
-{ -15957,   28137,    5268,     477,   -1053,    1158},
-{  -1495,   -8814,   -5764,  -24965,   25988,    7907},
-{  -1038,    -114,   -2308,   -1319,   -6480,    1472},
-{   4895,  -17897,  -25850,    5301,    -188,    1581},
-{   3200,   17225,    4346,   22101,  -18543,   22028},
-{ -10250,     545,  -10932,    2276,  -28070,    8118},
-{  15343,    2329,    9316,   20537,   14908,   21021},
-{   6329,    6130,  -24508,     837,   -8637,   -5844},
-{   7386,    -501,   10503,   20131,   11435,   -4755},
-{  -2745,   24174,   -9274,   15273,   -8389,   -5835},
-{   2992,   -2864,    6048,   -7473,   11687,  -19996},
-{   -883,  -11954,   -9976,  -21829,   -4436,  -27178},
-{   3458,   19626,    1280,    2597,   19849,    5255},
-{  -5315,   19133,  -14518,   -8946,   13749,   -1352},
-{  18642,   17655,   11001,    6817,  -18418,    6336},
-{  -1697,    2244,   -4640,    3948,  -12890,   -5273},
-{  20428,   10542,    4170,   -1012,   19439,   21691},
-{  -2943,  -19735,   -4208,    1320,     909,   -8897},
-{   9351,   -8066,   -2618,  -12933,   26582,    3507},
-{   9705,  -22628,    8311,    8167,  -13293,    5608},
-{   3222,    3749,   -1508,     165,     -52,    -196},
-{    102,  -22744,   -8832,     903,  -11421,  -14662},
-{   -120,    5998,   19765,   13401,    3628,    5197},
-{   8528,    5827,   -1066,     774,     -39,    -166},
-{   9411,   -9476,    9581,  -13004,   24456,   24900},
-{  17878,    2235,  -21639,   20478,    4716,   -7190},
-{  -2482,    9511,    1611,  -21943,   14230,   -1289},
-{   9288,   -2291,   23215,   -3452,  -10842,      11},
-{   9496,    3041,    5130,   -3890,  -21219,  -22589},
-{  14262,   -9838,   20195,   14019,      91,  -17200},
-{ -18591,     980,      17,     821,     120,    -574},
-{  12285,  -19269,   13742,   16373,    -161,    6025},
-{  -3364,    1530,   -4005,    2454,  -10872,  -23839},
-{    105,    5085,    -260,    5790,    -588,   19170},
-{   4121,    4169,   13439,   14644,   20899,    7434},
-{   -175,   13101,   -3704,   23233,    3907,   10106},
-{  -6101,   23467,    5204,   -1341,    1599,   13174},
-{  -3217,   -3494,   15117,   -8387,  -11762,   -4750},
-{   1146,    4675,  -19378,   14917,   -5091,     249},
-{ -21506,   10136,  -16473,  -13305,   18382,   -8601},
-{    628,    2447,    3344,    3130,   -5115,     119},
-{  17900,  -22422,  -17633,   21967,  -16293,   -7676},
-{  16863,   24214,    5612,   -3858,    -809,    3822},
-{  -2291,   10091,   -2360,  -25109,   -1226,     312},
-{   2957,   11256,   26745,  -13266,   -3455,   -1128},
-{ -19762,   -2708,    4604,    6355,    1638,   25501},
-{ -19593,   -7753,    3159,     -85,    -489,   -1855},
-{    814,   12510,   19077,   -4681,   -2610,   -1474},
-{ -23408,  -19027,    8137,   19878,    7912,    -282},
-{    839,  -19652,   11927,   27278,   -3211,    2266},
-{   4020,   -1110,    8226,   -1274,   20922,   25060},
-{  26576,     325,   -8693,    -232,   -2218,    -699},
-{ -11293,   -4200,    1805,   -6673,  -22940,   -1339},
-{  -2005,  -15886,   -1047,  -27687,  -13235,   14370},
-{ -22073,    1949,   13175,  -15656,   -1846,    8055},
-{   3039,   12025,    7132,  -24632,     413,   -2347},
-{ -24048,    -206,   12459,   -6654,    -417,  -10091},
-{  18179,  -23688,  -20515,  -16396,    7230,     763},
-{   5659,   -5085,   13878,  -23729,  -11077,  -19587},
-{  11340,     501,   25040,    7616,  -19658,    1605},
-{ -26650,    8878,   10544,     417,    1299,     261},
-{  14460,   11369,   -3263,    9990,    8194,   18111},
-{   1355,  -20838,   -9196,  -16060,   -8559,    -730},
-{  -1918,  -20937,  -18293,   -2461,   -2651,    4316},
-{  -2810,   24521,  -10996,  -25721,     308,   -1234},
-{  -9075,  -17280,   -1833,  -29342,  -24213,  -16631},
-{  -2843,   10165,   -5339,   -2888,   21858,  -21340},
-{ -15832,   14849,  -23780,    5184,   10113,  -20639},
-{ -19535,  -11361,    8413,    1486,  -23658,   -5759},
-{  -7512,    1027,  -20794,   13732,   19892,  -21934},
-{ -12132,   -7022,  -19175,   -8840,   22125,  -16490},
-{   1937,    5210,   -6318,  -23788,   13141,   11082},
-{   -205,    6036,    -380,    8658,    -233,   28020},
-{  -5523,    7477,    7635,   23595,    9763,   -2590},
-{  21658,  -28313,   -3086,    -300,   -1032,    1744},
-{ -22352,   16646,     208,    6665,  -17400,   -3028},
-{  18482,    9336,   -2737,  -19372,     407,   -4389},
-{  -4913,  -17370,   18819,  -17654,   13416,   15232},
-{   7749,    6368,   23135,  -18174,    7584,   -4248},
-{  -1489,   -6523,     586,  -10157,   14964,   25568},
-{   3844,   -6156,    4897,  -13045,  -22526,    5647},
-{  -8491,   -2105,  -24774,     905,   -9326,    1456},
-{  -3040,   -1476,    1166,   -4428,   11236,    9204},
-{   3397,   -1451,   13598,  -15841,   24540,    5819},
-{   8483,   -2993,   21547,  -16916,    7741,   24018},
-{ -14932,  -23758,   -5332,   -6664,   -4497,   13267},
-{  19379,   12916,   -2142,    -737,   21100,  -22101},
-{   3393,   -4629,    5735,  -18913,   -6969,    2687},
-{   1148,  -16147,  -21433,  -28095,    -630,  -14449},
-{   7300,     672,   18530,  -17452,  -10149,     351},
-{  11356,  -10974,   17212,    4624,     145,   17791},
-{   -711,   -3479,   -2238,   15887,    2027,       0},
-{ -28048,    1794,    -593,   -2758,  -21852,   11535},
-{ -19683,    4937,   22004,   21523,   -3148,    1790},
-{    813,    8231,    2633,   11981,   -3043,   22201},
-{   8952,  -24760,    -690,   14873,   -2366,   -5372},
-{   8406,   -5439,    -274,    -642,    -145,     778},
-{  -6605,    7258,   20780,  -23507,  -18625,   22782},
-{ -22896,  -25488,   10020,   -1614,    1508,   -1393},
-{   7607,     407,  -24678,  -16385,   -1804,   -4699},
-{ -10592,  -19139,   10462,   -3747,    8721,   -6919},
-{  13010,    5292,   -6230,   -4884,  -20904,   -1797},
-{  16891,  -13770,    -465,   19343,  -10741,  -12959},
-{  25193,  -14799,   -5681,    -521,    -321,   -1211},
-{   6917,   -3093,   20183,  -26903,  -12026,    1295},
-{    305,    1992,   19457,    -985,      25,    -521},
-{   6707,   -3698,    8365,   -8687,   21921,  -27166},
-{   4668,    5997,    7117,   11696,   24401,  -10794},
-{    744,   -9416,   19893,    1963,    7922,   -9824},
-{   3430,   21282,   -1736,   10844,    8821,   27015},
-{  -8813,    1521,  -24038,    1651,    7838,   -1208},
-{   3911,  -11221,    3273,  -12541,    7168,   18402},
-{  21642,    9117,  -11536,   -5256,    7077,    2382},
-{    100,    3817,   -6713,    1244,    1518,    -321},
-{   7946,  -18670,   10667,   -4866,     727,     776},
-{ -15883,   -8150,   -2087,   22739,    1567,   -3482},
-{   4380,   -2735,    8469,   -7025,  -11424,    1317},
-{  26970,    4393,    7665,   17561,    -714,     650},
-{ -16191,    -835,    8365,    1795,  -14314,   16297},
-{   4504,  -10048,    7662,  -26690,  -17428,    2580},
-{     48,   -3984,     564,   -5871,    2658,  -18658},
-{  12579,  -26016,  -15642,    2672,   -1347,    -887},
-{  -4950,    4208,   -6811,    2569,  -20621,   -8658},
-{  -1836,  -14818,   -5571,  -23322,  -14800,   25867},
-{   5434,  -28139,   -2357,   -2883,    -570,    2431},
-{  13096,   -2771,   24994,  -12496,  -24723,   -1025},
-{  -5676,   -4339,    1908,   18628,  -21323,   17366},
-{  27660,  -27897,  -15409,    1436,   -7112,   -2241},
-{   8019,    3847,   24568,    -469,    9674,   10683},
-{   -903,  -10149,    1801,  -21260,    4795,   -8751},
-{   1122,   -9582,    2625,   22791,     956,     882},
-{   7876,   19075,   -9900,  -24266,    7496,    9277},
-{    980,  -26764,   -5386,    5396,    1086,    1648},
-{  28838,   -1270,    -447,       5,    -429,     -20},
-{ -15283,    6132,   22812,    1252,   -9963,     511},
-{    851,    7925,    -457,  -12210,    4261,    7579},
-{  -4530,    8452,   -1246,   14501,  -24951,   -5760},
-{ -17814,  -10727,    9887,  -23929,  -13432,    1878},
-{ -15049,   10165,   16491,  -14603,  -11712,  -21156},
-{  -3317,     840,   -5683,   22413,    1994,     586},
-{  23158,   -5788,  -15043,  -10372,   -9271,  -13523},
-{   -773,   -9509,   -3993,  -24264,    8463,    5804},
-{  -8545,    -703,  -12440,   -3985,  -25122,  -28147},
-{ -16659,   16001,    2746,    1611,    5097,   -1043},
-{     41,   -7181,   19903,   31555,  -32237,   13927},
-{  -5658,     845,  -12774,    5705,   16695,     -86},
-{   5282,   14875,   27026,   21124,   15776,  -10477},
-{  14712,   19648,  -11487,  -13361,  -20196,  -15229},
-{   8597,   -9138,    -626,   10891,   -6015,    6346},
-{  -1488,   -1272,   -1479,   -1303,   -3704,   -5485},
-{  -3370,   17871,   -6604,   24930,   25886,   -3127},
-{   8416,   27783,   -1385,    5350,   -4260,   19993},
-{   5688,     362,   17246,    3809,   -3246,    1088},
-{   -105,  -29607,    2747,   15223,    -167,    3722},
-{   3502,   -3195,    8602,    7772,   -1566,    -915},
-{   -491,    3257,   -2423,    5522,   20606,    -100},
-{ -13948,  -11368,  -15375,  -21866,   -8520,   12221},
-{   -616,    2424,   -2023,    4398,   -3805,    8108},
-{  -7204,   21043,   21211,   -9395,  -19391,     896},
-{  -5737,  -15160,  -21298,   17066,   -1006,    -366},
-{   6261,    3240,  -11937,  -16213,  -15820,    6581},
-{  -3155,   24796,    2733,   -1257,    -875,   -1597},
-{ -20469,   11094,   24071,   -8987,   14136,    2220},
-{ -14106,   11959,  -22495,    4135,   -1055,   -5420},
-{    801,   -2655,      60,   -5324,    -790,    5937},
-{  -7372,   -1764,  -22433,  -26060,   21707,    4178},
-{  -5715,   -6648,  -14908,    1325,  -24044,    1493},
-{  -6024,  -12488,   23930,    2950,    1601,    1173},
-{  19067,   17630,   17929,  -10654,   10928,   -4958},
-{   3231,   -3284,   27336,    4174,   -1683,     497},
-};
-
-const int16_t (* const ff_eac3_mantissa_vq[8])[6] = {
-    NULL,
-    vq_hebap1,
-    vq_hebap2,
-    vq_hebap3,
-    vq_hebap4,
-    vq_hebap5,
-    vq_hebap6,
-    vq_hebap7,
-};
-
-/**
- * Table E2.14 Frame Exponent Strategy Combinations
- */
-const uint8_t ff_eac3_frm_expstr[32][6] = {
-{    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,    EXP_D45},
-{    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,    EXP_D25,  EXP_REUSE},
-{    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,    EXP_D45,    EXP_D45},
-{    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D25,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D25,  EXP_REUSE,    EXP_D45},
-{    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D45,    EXP_D25,  EXP_REUSE},
-{    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D45,    EXP_D45,    EXP_D45},
-{    EXP_D25,  EXP_REUSE,    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D25,  EXP_REUSE,    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D45},
-{    EXP_D25,  EXP_REUSE,    EXP_D25,  EXP_REUSE,    EXP_D25,  EXP_REUSE},
-{    EXP_D25,  EXP_REUSE,    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D45},
-{    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D25,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D45},
-{    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D45,    EXP_D25,  EXP_REUSE},
-{    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D45},
-{    EXP_D45,    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D45,    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE,    EXP_D45},
-{    EXP_D45,    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D25,  EXP_REUSE},
-{    EXP_D45,    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D45,    EXP_D45},
-{    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D25,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D25,  EXP_REUSE,    EXP_D45},
-{    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D25,  EXP_REUSE},
-{    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D45,    EXP_D45},
-{    EXP_D45,    EXP_D45,    EXP_D15,  EXP_REUSE,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D45,    EXP_D45,    EXP_D25,  EXP_REUSE,  EXP_REUSE,    EXP_D45},
-{    EXP_D45,    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D25,  EXP_REUSE},
-{    EXP_D45,    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D45,    EXP_D45},
-{    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D25,  EXP_REUSE,  EXP_REUSE},
-{    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D25,  EXP_REUSE,    EXP_D45},
-{    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D25,  EXP_REUSE},
-{    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D45,    EXP_D45},
-};
-
-/**
- * Table E.25: Spectral Extension Attenuation Table
- * ff_eac3_spx_atten_tab[code][bin]=pow(2.0,(bin+1)*(code+1)/-15.0);
- */
-const float ff_eac3_spx_atten_tab[32][3] = {
-    { 0.954841603910416503f, 0.911722488558216804f, 0.870550563296124125f },
-    { 0.911722488558216804f, 0.831237896142787758f, 0.757858283255198995f },
-    { 0.870550563296124125f, 0.757858283255198995f, 0.659753955386447100f },
-    { 0.831237896142787758f, 0.690956439983888004f, 0.574349177498517438f },
-    { 0.793700525984099792f, 0.629960524947436595f, 0.500000000000000000f },
-    { 0.757858283255198995f, 0.574349177498517438f, 0.435275281648062062f },
-    { 0.723634618720189082f, 0.523647061410313364f, 0.378929141627599553f },
-    { 0.690956439983888004f, 0.477420801955208307f, 0.329876977693223550f },
-    { 0.659753955386447100f, 0.435275281648062062f, 0.287174588749258719f },
-    { 0.629960524947436595f, 0.396850262992049896f, 0.250000000000000000f },
-    { 0.601512518041058319f, 0.361817309360094541f, 0.217637640824031003f },
-    { 0.574349177498517438f, 0.329876977693223550f, 0.189464570813799776f },
-    { 0.548412489847312945f, 0.300756259020529160f, 0.164938488846611775f },
-    { 0.523647061410313364f, 0.274206244923656473f, 0.143587294374629387f },
-    { 0.500000000000000000f, 0.250000000000000000f, 0.125000000000000000f },
-    { 0.477420801955208307f, 0.227930622139554201f, 0.108818820412015502f },
-    { 0.455861244279108402f, 0.207809474035696939f, 0.094732285406899888f },
-    { 0.435275281648062062f, 0.189464570813799776f, 0.082469244423305887f },
-    { 0.415618948071393879f, 0.172739109995972029f, 0.071793647187314694f },
-    { 0.396850262992049896f, 0.157490131236859149f, 0.062500000000000000f },
-    { 0.378929141627599553f, 0.143587294374629387f, 0.054409410206007751f },
-    { 0.361817309360094541f, 0.130911765352578369f, 0.047366142703449930f },
-    { 0.345478219991944002f, 0.119355200488802049f, 0.041234622211652958f },
-    { 0.329876977693223550f, 0.108818820412015502f, 0.035896823593657347f },
-    { 0.314980262473718298f, 0.099212565748012460f, 0.031250000000000000f },
-    { 0.300756259020529160f, 0.090454327340023621f, 0.027204705103003875f },
-    { 0.287174588749258719f, 0.082469244423305887f, 0.023683071351724965f },
-    { 0.274206244923656473f, 0.075189064755132290f, 0.020617311105826479f },
-    { 0.261823530705156682f, 0.068551561230914118f, 0.017948411796828673f },
-    { 0.250000000000000000f, 0.062500000000000000f, 0.015625000000000000f },
-    { 0.238710400977604098f, 0.056982655534888536f, 0.013602352551501938f },
-    { 0.227930622139554201f, 0.051952368508924235f, 0.011841535675862483f }
-};
diff --git a/libavcodec/eac3dec_data.h b/libavcodec/eac3dec_data.h
deleted file mode 100644
index 1331833..0000000
--- a/libavcodec/eac3dec_data.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * E-AC-3 decoder tables
- * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_EAC3DEC_DATA_H
-#define AVCODEC_EAC3DEC_DATA_H
-
-#include <stdint.h>
-
-extern const uint8_t ff_eac3_bits_vs_hebap[20];
-extern const int16_t ff_eac3_gaq_remap_1[12];
-extern const int16_t ff_eac3_gaq_remap_2_4_a[9][2];
-extern const int16_t ff_eac3_gaq_remap_2_4_b[9][2];
-
-extern const int16_t (* const ff_eac3_mantissa_vq[8])[6];
-extern const uint8_t ff_eac3_frm_expstr[32][6];
-extern const float   ff_eac3_spx_atten_tab[32][3];
-
-#endif /* AVCODEC_EAC3DEC_DATA_H */
diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
deleted file mode 100644
index 517b307..0000000
--- a/libavcodec/eacmv.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Electronic Arts CMV Video Decoder
- * Copyright (c) 2007-2008 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * @file
- * Electronic Arts CMV Video Decoder
- * by Peter Ross (pross at xvid.org)
- *
- * Technical details here:
- * http://wiki.multimedia.cx/index.php?title=Electronic_Arts_CMV
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct CmvContext {
-    AVCodecContext *avctx;
-    AVFrame frame;        ///< current
-    AVFrame last_frame;   ///< last
-    AVFrame last2_frame;  ///< second-last
-    int width, height;
-    unsigned int palette[AVPALETTE_COUNT];
-} CmvContext;
-
-static av_cold int cmv_decode_init(AVCodecContext *avctx){
-    CmvContext *s = avctx->priv_data;
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    return 0;
-}
-
-static void cmv_decode_intra(CmvContext * s, const uint8_t *buf, const uint8_t *buf_end){
-    unsigned char *dst = s->frame.data[0];
-    int i;
-
-    for (i=0; i < s->avctx->height && buf+s->avctx->width<=buf_end; i++) {
-        memcpy(dst, buf, s->avctx->width);
-        dst += s->frame.linesize[0];
-        buf += s->avctx->width;
-    }
-}
-
-static void cmv_motcomp(unsigned char *dst, int dst_stride,
-                        const unsigned char *src, int src_stride,
-                        int x, int y,
-                        int xoffset, int yoffset,
-                        int width, int height){
-    int i,j;
-
-    for(j=y;j<y+4;j++)
-    for(i=x;i<x+4;i++)
-    {
-        if (i+xoffset>=0 && i+xoffset<width &&
-            j+yoffset>=0 && j+yoffset<height) {
-            dst[j*dst_stride + i] = src[(j+yoffset)*src_stride + i+xoffset];
-        }else{
-            dst[j*dst_stride + i] = 0;
-        }
-    }
-}
-
-static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *buf_end){
-    const uint8_t *raw = buf + (s->avctx->width*s->avctx->height/16);
-    int x,y,i;
-
-    i = 0;
-    for(y=0; y<s->avctx->height/4; y++)
-    for(x=0; x<s->avctx->width/4 && buf+i<buf_end; x++) {
-        if (buf[i]==0xFF) {
-            unsigned char *dst = s->frame.data[0] + (y*4)*s->frame.linesize[0] + x*4;
-            if (raw+16<buf_end && *raw==0xFF) { /* intra */
-                raw++;
-                memcpy(dst, raw, 4);
-                memcpy(dst+s->frame.linesize[0], raw+4, 4);
-                memcpy(dst+2*s->frame.linesize[0], raw+8, 4);
-                memcpy(dst+3*s->frame.linesize[0], raw+12, 4);
-                raw+=16;
-            }else if(raw<buf_end) {  /* inter using second-last frame as reference */
-                int xoffset = (*raw & 0xF) - 7;
-                int yoffset = ((*raw >> 4)) - 7;
-                cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
-                            s->last2_frame.data[0], s->last2_frame.linesize[0],
-                            x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
-                raw++;
-            }
-        }else{  /* inter using last frame as reference */
-            int xoffset = (buf[i] & 0xF) - 7;
-            int yoffset = ((buf[i] >> 4)) - 7;
-            cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
-                      s->last_frame.data[0], s->last_frame.linesize[0],
-                      x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
-        }
-        i++;
-    }
-}
-
-static void cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t *buf_end)
-{
-    int pal_start, pal_count, i;
-
-    if(buf+16>=buf_end) {
-        av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
-        return;
-    }
-
-    s->width  = AV_RL16(&buf[4]);
-    s->height = AV_RL16(&buf[6]);
-    if (s->avctx->width!=s->width || s->avctx->height!=s->height)
-        avcodec_set_dimensions(s->avctx, s->width, s->height);
-
-    s->avctx->time_base.num = 1;
-    s->avctx->time_base.den = AV_RL16(&buf[10]);
-
-    pal_start = AV_RL16(&buf[12]);
-    pal_count = AV_RL16(&buf[14]);
-
-    buf += 16;
-    for (i=pal_start; i<pal_start+pal_count && i<AVPALETTE_COUNT && buf+2<buf_end; i++) {
-        s->palette[i] = AV_RB24(buf);
-        buf += 3;
-    }
-}
-
-#define EA_PREAMBLE_SIZE 8
-#define MVIh_TAG MKTAG('M', 'V', 'I', 'h')
-
-static int cmv_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CmvContext *s = avctx->priv_data;
-    const uint8_t *buf_end = buf + buf_size;
-
-    if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) {
-        cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
-        return buf_size;
-    }
-
-    if (avcodec_check_dimensions(s->avctx, s->width, s->height))
-        return -1;
-
-    /* shuffle */
-    if (s->last2_frame.data[0])
-        avctx->release_buffer(avctx, &s->last2_frame);
-    FFSWAP(AVFrame, s->last_frame, s->last2_frame);
-    FFSWAP(AVFrame, s->frame, s->last_frame);
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if (avctx->get_buffer(avctx, &s->frame)<0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
-
-    buf += EA_PREAMBLE_SIZE;
-    if ((buf[0]&1)) {  // subtype
-        cmv_decode_inter(s, buf+2, buf_end);
-        s->frame.key_frame = 0;
-        s->frame.pict_type = FF_P_TYPE;
-    }else{
-        s->frame.key_frame = 1;
-        s->frame.pict_type = FF_I_TYPE;
-        cmv_decode_intra(s, buf+2, buf_end);
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    return buf_size;
-}
-
-static av_cold int cmv_decode_end(AVCodecContext *avctx){
-    CmvContext *s = avctx->priv_data;
-    if (s->frame.data[0])
-        s->avctx->release_buffer(avctx, &s->frame);
-    if (s->last_frame.data[0])
-        s->avctx->release_buffer(avctx, &s->last_frame);
-    if (s->last2_frame.data[0])
-        s->avctx->release_buffer(avctx, &s->last2_frame);
-
-    return 0;
-}
-
-AVCodec eacmv_decoder = {
-    "eacmv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_CMV,
-    sizeof(CmvContext),
-    cmv_decode_init,
-    NULL,
-    cmv_decode_end,
-    cmv_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"),
-};
diff --git a/libavcodec/eaidct.c b/libavcodec/eaidct.c
deleted file mode 100644
index 9972e42..0000000
--- a/libavcodec/eaidct.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Electronic Arts TGQ/TQI/MAD IDCT algorithm
- * Copyright (c) 2007-2008 Peter Ross <pross at xvid.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Electronic Arts TGQ/TQI/MAD IDCT algorithm
- * @author Peter Ross <pross at xvid.org>
- */
-
-#include "dsputil.h"
-
-#define ASQRT 181 /* (1/sqrt(2))<<8 */
-#define A4    669 /* cos(pi/8)*sqrt(2)<<9 */
-#define A2    277 /* sin(pi/8)*sqrt(2)<<9 */
-#define A5    196 /* sin(pi/8)<<9 */
-
-#define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\
-    const int a1 = (src)[s1] + (src)[s7]; \
-    const int a7 = (src)[s1] - (src)[s7]; \
-    const int a5 = (src)[s5] + (src)[s3]; \
-    const int a3 = (src)[s5] - (src)[s3]; \
-    const int a2 = (src)[s2] + (src)[s6]; \
-    const int a6 = (ASQRT*((src)[s2] - (src)[s6]))>>8; \
-    const int a0 = (src)[s0] + (src)[s4]; \
-    const int a4 = (src)[s0] - (src)[s4]; \
-    const int b0 = (((A4-A5)*a7 - A5*a3)>>9) + a1+a5; \
-    const int b1 = (((A4-A5)*a7 - A5*a3)>>9) + ((ASQRT*(a1-a5))>>8); \
-    const int b2 = (((A2+A5)*a3 + A5*a7)>>9) + ((ASQRT*(a1-a5))>>8); \
-    const int b3 =  ((A2+A5)*a3 + A5*a7)>>9; \
-    (dest)[d0] = munge(a0+a2+a6+b0); \
-    (dest)[d1] = munge(a4+a6   +b1); \
-    (dest)[d2] = munge(a4-a6   +b2); \
-    (dest)[d3] = munge(a0-a2-a6+b3); \
-    (dest)[d4] = munge(a0-a2-a6-b3); \
-    (dest)[d5] = munge(a4-a6   -b2); \
-    (dest)[d6] = munge(a4+a6   -b1); \
-    (dest)[d7] = munge(a0+a2+a6-b0); \
-}
-/* end IDCT_TRANSFORM macro */
-
-#define MUNGE_NONE(x) (x)
-#define IDCT_COL(dest,src) IDCT_TRANSFORM(dest,0,8,16,24,32,40,48,56,0,8,16,24,32,40,48,56,MUNGE_NONE,src)
-
-#define MUNGE_8BIT(x) av_clip_uint8((x)>>4)
-#define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_8BIT,src)
-
-static inline void ea_idct_col(DCTELEM *dest, const DCTELEM *src) {
-    if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) {
-        dest[0]  =
-        dest[8]  =
-        dest[16] =
-        dest[24] =
-        dest[32] =
-        dest[40] =
-        dest[48] =
-        dest[56] = src[0];
-    }else
-        IDCT_COL(dest, src);
-}
-
-void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block) {
-    int i;
-    DCTELEM temp[64];
-    block[0] += 4;
-    for (i=0; i<8; i++)
-        ea_idct_col(&temp[i], &block[i]);
-    for (i=0; i<8; i++)
-        IDCT_ROW( (&dest[i*linesize]), (&temp[8*i]) );
-}
diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c
deleted file mode 100644
index 8fc5ef1..0000000
--- a/libavcodec/eamad.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Electronic Arts Madcow Video Decoder
- * Copyright (c) 2007-2009 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * @file
- * Electronic Arts Madcow Video Decoder
- * by Peter Ross <pross at xvid.org>
- *
- * Technical details here:
- * http://wiki.multimedia.cx/index.php?title=Electronic_Arts_MAD
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "aandcttab.h"
-#include "mpeg12.h"
-#include "mpeg12data.h"
-
-#define EA_PREAMBLE_SIZE    8
-#define MADk_TAG MKTAG('M', 'A', 'D', 'k')    /* MAD i-frame */
-#define MADm_TAG MKTAG('M', 'A', 'D', 'm')    /* MAD p-frame */
-#define MADe_TAG MKTAG('M', 'A', 'D', 'e')    /* MAD lqp-frame */
-
-typedef struct MadContext {
-    MpegEncContext s;
-    AVFrame frame;
-    AVFrame last_frame;
-    void *bitstream_buf;
-    unsigned int bitstream_buf_size;
-    DECLARE_ALIGNED(16, DCTELEM, block)[64];
-} MadContext;
-
-static void bswap16_buf(uint16_t *dst, const uint16_t *src, int count)
-{
-    int i;
-    for (i=0; i<count; i++)
-        dst[i] = bswap_16(src[i]);
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    MadContext *t = avctx->priv_data;
-    MpegEncContext *s = &t->s;
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-    if (avctx->idct_algo == FF_IDCT_AUTO)
-        avctx->idct_algo = FF_IDCT_EA;
-    dsputil_init(&s->dsp, avctx);
-    ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
-    ff_mpeg12_init_vlcs();
-    return 0;
-}
-
-static inline void comp(unsigned char *dst, int dst_stride,
-                        unsigned char *src, int src_stride, int add)
-{
-    int j, i;
-    for (j=0; j<8; j++)
-        for (i=0; i<8; i++)
-            dst[j*dst_stride + i] = av_clip_uint8(src[j*src_stride + i] + add);
-}
-
-static inline void comp_block(MadContext *t, int mb_x, int mb_y,
-                              int j, int mv_x, int mv_y, int add)
-{
-    MpegEncContext *s = &t->s;
-    if (j < 4) {
-        comp(t->frame.data[0] + (mb_y*16 + ((j&2)<<2))*t->frame.linesize[0] + mb_x*16 + ((j&1)<<3),
-             t->frame.linesize[0],
-             t->last_frame.data[0] + (mb_y*16 + ((j&2)<<2) + mv_y)*t->last_frame.linesize[0] + mb_x*16 + ((j&1)<<3) + mv_x,
-             t->last_frame.linesize[0], add);
-    } else if (!(s->avctx->flags & CODEC_FLAG_GRAY)) {
-        int index = j - 3;
-        comp(t->frame.data[index] + (mb_y*8)*t->frame.linesize[index] + mb_x * 8,
-             t->frame.linesize[index],
-             t->last_frame.data[index] + (mb_y * 8 + (mv_y/2))*t->last_frame.linesize[index] + mb_x * 8 + (mv_x/2),
-             t->last_frame.linesize[index], add);
-    }
-}
-
-static inline void idct_put(MadContext *t, DCTELEM *block, int mb_x, int mb_y, int j)
-{
-    MpegEncContext *s = &t->s;
-    if (j < 4) {
-        s->dsp.idct_put(
-            t->frame.data[0] + (mb_y*16 + ((j&2)<<2))*t->frame.linesize[0] + mb_x*16 + ((j&1)<<3),
-            t->frame.linesize[0], block);
-    } else if (!(s->avctx->flags & CODEC_FLAG_GRAY)) {
-        int index = j - 3;
-        s->dsp.idct_put(
-            t->frame.data[index] + (mb_y*8)*t->frame.linesize[index] + mb_x*8,
-            t->frame.linesize[index], block);
-    }
-}
-
-static inline void decode_block_intra(MadContext * t, DCTELEM * block)
-{
-    MpegEncContext *s = &t->s;
-    int level, i, j, run;
-    RLTable *rl = &ff_rl_mpeg1;
-    const uint8_t *scantable = s->intra_scantable.permutated;
-    int16_t *quant_matrix = s->intra_matrix;
-
-    block[0] = (128 + get_sbits(&s->gb, 8)) * quant_matrix[0];
-
-    /* The RL decoder is derived from mpeg1_decode_block_intra;
-       Escaped level and run values a decoded differently */
-    i = 0;
-    {
-        OPEN_READER(re, &s->gb);
-        /* now quantify & encode AC coefficients */
-        for (;;) {
-            UPDATE_CACHE(re, &s->gb);
-            GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if (level == 127) {
-                break;
-            } else if (level != 0) {
-                i += run;
-                j = scantable[i];
-                level = (level*quant_matrix[j]) >> 4;
-                level = (level-1)|1;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                LAST_SKIP_BITS(re, &s->gb, 1);
-            } else {
-                /* escape */
-                UPDATE_CACHE(re, &s->gb);
-                level = SHOW_SBITS(re, &s->gb, 10); SKIP_BITS(re, &s->gb, 10);
-
-                UPDATE_CACHE(re, &s->gb);
-                run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-
-                i += run;
-                j = scantable[i];
-                if (level < 0) {
-                    level = -level;
-                    level = (level*quant_matrix[j]) >> 4;
-                    level = (level-1)|1;
-                    level = -level;
-                } else {
-                    level = (level*quant_matrix[j]) >> 4;
-                    level = (level-1)|1;
-                }
-            }
-            if (i > 63) {
-                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                return;
-            }
-
-            block[j] = level;
-        }
-        CLOSE_READER(re, &s->gb);
-    }
-}
-
-static int decode_motion(GetBitContext *gb)
-{
-    int value = 0;
-    if (get_bits1(gb)) {
-        if (get_bits1(gb))
-            value = -17;
-        value += get_bits(gb, 4) + 1;
-    }
-    return value;
-}
-
-static void decode_mb(MadContext *t, int inter)
-{
-    MpegEncContext *s = &t->s;
-    int mv_map = 0;
-    int mv_x, mv_y;
-    int j;
-
-    if (inter) {
-        int v = decode210(&s->gb);
-        if (v < 2) {
-            mv_map = v ? get_bits(&s->gb, 6) : 63;
-            mv_x = decode_motion(&s->gb);
-            mv_y = decode_motion(&s->gb);
-        } else {
-            mv_map = 0;
-        }
-    }
-
-    for (j=0; j<6; j++) {
-        if (mv_map & (1<<j)) {  // mv_x and mv_y are guarded by mv_map
-            int add = 2*decode_motion(&s->gb);
-            comp_block(t, s->mb_x, s->mb_y, j, mv_x, mv_y, add);
-        } else {
-            s->dsp.clear_block(t->block);
-            decode_block_intra(t, t->block);
-            idct_put(t, t->block, s->mb_x, s->mb_y, j);
-        }
-    }
-}
-
-static void calc_intra_matrix(MadContext *t, int qscale)
-{
-    MpegEncContext *s = &t->s;
-    int i;
-
-    if (s->avctx->idct_algo == FF_IDCT_EA) {
-        s->intra_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0]) >> 11;
-        for (i=1; i<64; i++)
-            s->intra_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32) >> 10;
-    } else {
-        s->intra_matrix[0] = ff_mpeg1_default_intra_matrix[0];
-        for (i=1; i<64; i++)
-            s->intra_matrix[i] = (ff_mpeg1_default_intra_matrix[i]*qscale) << 1;
-    }
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    const uint8_t *buf_end = buf+buf_size;
-    MadContext *t     = avctx->priv_data;
-    MpegEncContext *s = &t->s;
-    int chunk_type;
-    int inter;
-
-    if (buf_size < 17) {
-        av_log(avctx, AV_LOG_ERROR, "Input buffer too small\n");
-        *data_size = 0;
-        return -1;
-    }
-
-    chunk_type = AV_RL32(&buf[0]);
-    inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG);
-    buf += 8;
-
-    av_reduce(&avctx->time_base.num, &avctx->time_base.den,
-              AV_RL16(&buf[6]), 1000, 1<<30);
-
-    s->width  = AV_RL16(&buf[8]);
-    s->height = AV_RL16(&buf[10]);
-    calc_intra_matrix(t, buf[13]);
-    buf += 16;
-
-    if (avctx->width != s->width || avctx->height != s->height) {
-        if (avcodec_check_dimensions(avctx, s->width, s->height) < 0)
-            return -1;
-        avcodec_set_dimensions(avctx, s->width, s->height);
-        if (t->frame.data[0])
-            avctx->release_buffer(avctx, &t->frame);
-    }
-
-    t->frame.reference = 1;
-    if (!t->frame.data[0]) {
-        if (avctx->get_buffer(avctx, &t->frame) < 0) {
-            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-            return -1;
-        }
-    }
-
-    av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!t->bitstream_buf)
-        return AVERROR(ENOMEM);
-    bswap16_buf(t->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
-    init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf));
-
-    for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)
-        for (s->mb_x=0; s->mb_x < (avctx->width +15)/16; s->mb_x++)
-            decode_mb(t, inter);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = t->frame;
-
-    if (chunk_type != MADe_TAG)
-        FFSWAP(AVFrame, t->frame, t->last_frame);
-
-    return buf_size;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    MadContext *t = avctx->priv_data;
-    if (t->frame.data[0])
-        avctx->release_buffer(avctx, &t->frame);
-    if (t->last_frame.data[0])
-        avctx->release_buffer(avctx, &t->last_frame);
-    av_free(t->bitstream_buf);
-    return 0;
-}
-
-AVCodec eamad_decoder = {
-    "eamad",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MAD,
-    sizeof(MadContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Madcow Video")
-};
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
deleted file mode 100644
index 7a98505..0000000
--- a/libavcodec/eatgq.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Electronic Arts TGQ Video Decoder
- * Copyright (c) 2007-2008 Peter Ross <pross at xvid.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * @file
- * Electronic Arts TGQ Video Decoder
- * @author Peter Ross <pross at xvid.org>
- *
- * Technical details here:
- * http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TGQ
- */
-
-#include "avcodec.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-#include "bytestream.h"
-#include "dsputil.h"
-#include "aandcttab.h"
-
-typedef struct TgqContext {
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame frame;
-    int width,height;
-    ScanTable scantable;
-    int qtable[64];
-    DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
-} TgqContext;
-
-static av_cold int tgq_decode_init(AVCodecContext *avctx){
-    TgqContext *s = avctx->priv_data;
-    s->avctx = avctx;
-    if(avctx->idct_algo==FF_IDCT_AUTO)
-        avctx->idct_algo=FF_IDCT_EA;
-    dsputil_init(&s->dsp, avctx);
-    ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
-    avctx->time_base = (AVRational){1, 15};
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-    return 0;
-}
-
-static void tgq_decode_block(TgqContext *s, DCTELEM block[64], GetBitContext *gb){
-    uint8_t *perm = s->scantable.permutated;
-    int i,j,value;
-    block[0] = get_sbits(gb,8) * s->qtable[0];
-    for(i=1; i<64; ) {
-        switch(show_bits(gb,3)) {
-        case 4:
-            block[perm[i++]] = 0;
-        case 0:
-            block[perm[i++]] = 0;
-            skip_bits(gb,3);
-            break;
-        case 5:
-        case 1:
-            skip_bits(gb,2);
-            value = get_bits(gb,6);
-            for(j=0; j<value; j++)
-                block[perm[i++]] = 0;
-            break;
-        case 6:
-            skip_bits(gb,3);
-            block[perm[i]] = -s->qtable[perm[i]];
-            i++;
-            break;
-        case 2:
-            skip_bits(gb,3);
-            block[perm[i]] = s->qtable[perm[i]];
-            i++;
-            break;
-        case 7: // 111b
-        case 3: // 011b
-            skip_bits(gb,2);
-            if (show_bits(gb,6)==0x3F) {
-                skip_bits(gb, 6);
-                block[perm[i]] = get_sbits(gb,8)*s->qtable[perm[i]];
-            }else{
-                block[perm[i]] = get_sbits(gb,6)*s->qtable[perm[i]];
-            }
-            i++;
-            break;
-        }
-    }
-    block[0] += 128<<4;
-}
-
-static void tgq_idct_put_mb(TgqContext *s, DCTELEM (*block)[64], int mb_x, int mb_y){
-    int linesize= s->frame.linesize[0];
-    uint8_t *dest_y  = s->frame.data[0] + (mb_y * 16* linesize            ) + mb_x * 16;
-    uint8_t *dest_cb = s->frame.data[1] + (mb_y * 8 * s->frame.linesize[1]) + mb_x * 8;
-    uint8_t *dest_cr = s->frame.data[2] + (mb_y * 8 * s->frame.linesize[2]) + mb_x * 8;
-
-    s->dsp.idct_put(dest_y                 , linesize, block[0]);
-    s->dsp.idct_put(dest_y              + 8, linesize, block[1]);
-    s->dsp.idct_put(dest_y + 8*linesize    , linesize, block[2]);
-    s->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
-    if(!(s->avctx->flags&CODEC_FLAG_GRAY)){
-         s->dsp.idct_put(dest_cb, s->frame.linesize[1], block[4]);
-         s->dsp.idct_put(dest_cr, s->frame.linesize[2], block[5]);
-    }
-}
-
-static inline void tgq_dconly(TgqContext *s, unsigned char *dst, int dst_stride, int dc){
-    int level = av_clip_uint8((dc*s->qtable[0] + 2056)>>4);
-    int j;
-    for(j=0;j<8;j++)
-        memset(dst+j*dst_stride, level, 8);
-}
-
-static void tgq_idct_put_mb_dconly(TgqContext *s, int mb_x, int mb_y, const int8_t *dc)
-{
-    int linesize= s->frame.linesize[0];
-    uint8_t *dest_y  = s->frame.data[0] + (mb_y * 16* linesize            ) + mb_x * 16;
-    uint8_t *dest_cb = s->frame.data[1] + (mb_y * 8 * s->frame.linesize[1]) + mb_x * 8;
-    uint8_t *dest_cr = s->frame.data[2] + (mb_y * 8 * s->frame.linesize[2]) + mb_x * 8;
-    tgq_dconly(s,dest_y                 , linesize, dc[0]);
-    tgq_dconly(s,dest_y              + 8, linesize, dc[1]);
-    tgq_dconly(s,dest_y + 8*linesize    , linesize, dc[2]);
-    tgq_dconly(s,dest_y + 8*linesize + 8, linesize, dc[3]);
-    if(!(s->avctx->flags&CODEC_FLAG_GRAY)) {
-        tgq_dconly(s,dest_cb, s->frame.linesize[1], dc[4]);
-        tgq_dconly(s,dest_cr, s->frame.linesize[2], dc[5]);
-    }
-}
-
-static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){
-    int mode;
-    int i;
-    int8_t dc[6];
-
-    mode = bytestream_get_byte(bs);
-    if (mode>buf_end-*bs) {
-        av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n");
-        return;
-    }
-
-    if (mode>12) {
-        GetBitContext gb;
-        init_get_bits(&gb, *bs, mode*8);
-        for(i=0; i<6; i++)
-            tgq_decode_block(s, s->block[i], &gb);
-        tgq_idct_put_mb(s, s->block, mb_x, mb_y);
-    }else{
-        if (mode==3) {
-            memset(dc, (*bs)[0], 4);
-            dc[4] = (*bs)[1];
-            dc[5] = (*bs)[2];
-        }else if (mode==6) {
-            memcpy(dc, *bs, 6);
-        }else if (mode==12) {
-            for(i=0; i<6; i++)
-                dc[i] = (*bs)[i*2];
-        }else{
-            av_log(s->avctx, AV_LOG_ERROR, "unsupported mb mode %i\n", mode);
-        }
-        tgq_idct_put_mb_dconly(s, mb_x, mb_y, dc);
-    }
-    *bs += mode;
-}
-
-static void tgq_calculate_qtable(TgqContext *s, int quant){
-    int i,j;
-    const int a = (14*(100-quant))/100 + 1;
-    const int b = (11*(100-quant))/100 + 4;
-    for(j=0;j<8;j++)
-    for(i=0;i<8;i++)
-        if (s->avctx->idct_algo==FF_IDCT_EA)
-            s->qtable[j*8+i] = ((a*(j+i)/(7+7) + b)*ff_inv_aanscales[j*8+i])>>(14-4);
-        else
-            s->qtable[j*8+i] = (a*(j+i)/(7+7) + b)<<3;
-}
-
-static int tgq_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt){
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    const uint8_t *buf_start = buf;
-    const uint8_t *buf_end = buf + buf_size;
-    TgqContext *s = avctx->priv_data;
-    int x,y;
-
-    int big_endian = AV_RL32(&buf[4]) > 0x000FFFFF;
-    buf += 8;
-
-    if(8>buf_end-buf) {
-        av_log(avctx, AV_LOG_WARNING, "truncated header\n");
-        return -1;
-    }
-    s->width  = big_endian ? AV_RB16(&buf[0]) : AV_RL16(&buf[0]);
-    s->height = big_endian ? AV_RB16(&buf[2]) : AV_RL16(&buf[2]);
-
-    if (s->avctx->width!=s->width || s->avctx->height!=s->height) {
-        avcodec_set_dimensions(s->avctx, s->width, s->height);
-        if (s->frame.data[0])
-            avctx->release_buffer(avctx, &s->frame);
-    }
-    tgq_calculate_qtable(s, buf[4]);
-    buf += 8;
-
-    if (!s->frame.data[0]) {
-        s->frame.key_frame = 1;
-        s->frame.pict_type = FF_I_TYPE;
-        s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
-        if (avctx->get_buffer(avctx, &s->frame)) {
-            av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-            return -1;
-        }
-    }
-
-    for (y=0; y<(avctx->height+15)/16; y++)
-    for (x=0; x<(avctx->width+15)/16; x++)
-        tgq_decode_mb(s, y, x, &buf, buf_end);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    return buf-buf_start;
-}
-
-static av_cold int tgq_decode_end(AVCodecContext *avctx){
-    TgqContext *s = avctx->priv_data;
-    if (s->frame.data[0])
-        s->avctx->release_buffer(avctx, &s->frame);
-    return 0;
-}
-
-AVCodec eatgq_decoder = {
-    "eatgq",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TGQ,
-    sizeof(TgqContext),
-    tgq_decode_init,
-    NULL,
-    tgq_decode_end,
-    tgq_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),
-};
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
deleted file mode 100644
index 8c6a654..0000000
--- a/libavcodec/eatgv.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Electronic Arts TGV Video Decoder
- * Copyright (c) 2007-2008 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * @file
- * Electronic Arts TGV Video Decoder
- * by Peter Ross (pross at xvid.org)
- *
- * Technical details here:
- * http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TGV
- */
-
-#include "avcodec.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-#include "libavutil/lzo.h"
-
-#define EA_PREAMBLE_SIZE    8
-#define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
-
-typedef struct TgvContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    AVFrame last_frame;
-    int width,height;
-    unsigned int palette[AVPALETTE_COUNT];
-
-    int (*mv_codebook)[2];
-    unsigned char (*block_codebook)[16];
-    int num_mvs;           ///< current length of mv_codebook
-    int num_blocks_packed; ///< current length of block_codebook
-} TgvContext;
-
-static av_cold int tgv_decode_init(AVCodecContext *avctx){
-    TgvContext *s = avctx->priv_data;
-    s->avctx = avctx;
-    avctx->time_base = (AVRational){1, 15};
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    return 0;
-}
-
-/**
- * Unpack buffer
- * @return 0 on success, -1 on critical buffer underflow
- */
-static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst, int width, int height) {
-    unsigned char *dst_end = dst + width*height;
-    int size, size1, size2, av_uninit(offset), run;
-    unsigned char *dst_start = dst;
-
-    if (src[0] & 0x01)
-        src += 5;
-    else
-        src += 2;
-
-    if (src+3>src_end)
-        return -1;
-    size = AV_RB24(src);
-    src += 3;
-
-    while(size>0 && src<src_end) {
-
-        /* determine size1 and size2 */
-        size1 = (src[0] & 3);
-        if ( src[0] & 0x80 ) {  // 1
-            if (src[0] & 0x40 ) {  // 11
-                if ( src[0] & 0x20 ) {  // 111
-                    if ( src[0] < 0xFC )  // !(111111)
-                        size1 = (((src[0] & 31) + 1) << 2);
-                    src++;
-                    size2 = 0;
-                } else {  // 110
-                    offset = ((src[0] & 0x10) << 12) + AV_RB16(&src[1]) + 1;
-                    size2 = ((src[0] & 0xC) << 6) + src[3] + 5;
-                    src += 4;
-                }
-            } else {  // 10
-                size1 = ( ( src[1] & 0xC0) >> 6 );
-                offset = (AV_RB16(&src[1]) & 0x3FFF) + 1;
-                size2 = (src[0] & 0x3F) + 4;
-                src += 3;
-            }
-        } else {  // 0
-            offset = ((src[0] & 0x60) << 3) + src[1] + 1;
-            size2 = ((src[0] & 0x1C) >> 2) + 3;
-            src += 2;
-        }
-
-
-        /* fetch strip from src */
-        if (size1>src_end-src)
-            break;
-
-        if (size1>0) {
-            size -= size1;
-            run = FFMIN(size1, dst_end-dst);
-            memcpy(dst, src, run);
-            dst += run;
-            src += run;
-        }
-
-        if (size2>0) {
-            if (dst-dst_start<offset)
-                return 0;
-            size -= size2;
-            run = FFMIN(size2, dst_end-dst);
-            av_memcpy_backptr(dst, offset, run);
-            dst += run;
-        }
-    }
-
-    return 0;
-}
-
-/**
- * Decode inter-frame
- * @return 0 on success, -1 on critical buffer underflow
- */
-static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *buf_end){
-    unsigned char *frame0_end = s->last_frame.data[0] + s->avctx->width*s->last_frame.linesize[0];
-    int num_mvs;
-    int num_blocks_raw;
-    int num_blocks_packed;
-    int vector_bits;
-    int i,j,x,y;
-    GetBitContext gb;
-    int mvbits;
-    const unsigned char *blocks_raw;
-
-    if(buf+12>buf_end)
-        return -1;
-
-    num_mvs           = AV_RL16(&buf[0]);
-    num_blocks_raw    = AV_RL16(&buf[2]);
-    num_blocks_packed = AV_RL16(&buf[4]);
-    vector_bits       = AV_RL16(&buf[6]);
-    buf += 12;
-
-    /* allocate codebook buffers as neccessary */
-    if (num_mvs > s->num_mvs) {
-        s->mv_codebook = av_realloc(s->mv_codebook, num_mvs*2*sizeof(int));
-        s->num_mvs = num_mvs;
-    }
-
-    if (num_blocks_packed > s->num_blocks_packed) {
-        s->block_codebook = av_realloc(s->block_codebook, num_blocks_packed*16*sizeof(unsigned char));
-        s->num_blocks_packed = num_blocks_packed;
-    }
-
-    /* read motion vectors */
-    mvbits = (num_mvs*2*10+31) & ~31;
-
-    if (buf+(mvbits>>3)+16*num_blocks_raw+8*num_blocks_packed>buf_end)
-        return -1;
-
-    init_get_bits(&gb, buf, mvbits);
-    for (i=0; i<num_mvs; i++) {
-        s->mv_codebook[i][0] = get_sbits(&gb, 10);
-        s->mv_codebook[i][1] = get_sbits(&gb, 10);
-    }
-    buf += mvbits>>3;
-
-    /* note ptr to uncompressed blocks */
-    blocks_raw = buf;
-    buf += num_blocks_raw*16;
-
-    /* read compressed blocks */
-    init_get_bits(&gb, buf, (buf_end-buf)<<3);
-    for (i=0; i<num_blocks_packed; i++) {
-        int tmp[4];
-        for(j=0; j<4; j++)
-            tmp[j] = get_bits(&gb, 8);
-        for(j=0; j<16; j++)
-            s->block_codebook[i][15-j] = tmp[get_bits(&gb, 2)];
-    }
-
-    if (get_bits_left(&gb) < vector_bits *
-        (s->avctx->height/4) * (s->avctx->width/4))
-        return -1;
-
-    /* read vectors and build frame */
-    for(y=0; y<s->avctx->height/4; y++)
-    for(x=0; x<s->avctx->width/4; x++) {
-        unsigned int vector = get_bits(&gb, vector_bits);
-        const unsigned char *src;
-        int src_stride;
-
-        if (vector < num_mvs) {
-            src = s->last_frame.data[0] +
-                  (y*4 + s->mv_codebook[vector][1])*s->last_frame.linesize[0] +
-                   x*4 + s->mv_codebook[vector][0];
-            src_stride = s->last_frame.linesize[0];
-            if (src+3*src_stride+3>=frame0_end)
-                continue;
-        }else{
-            int offset = vector - num_mvs;
-            if (offset<num_blocks_raw)
-                src = blocks_raw + 16*offset;
-            else if (offset-num_blocks_raw<num_blocks_packed)
-                src = s->block_codebook[offset-num_blocks_raw];
-            else
-                continue;
-            src_stride = 4;
-        }
-
-        for(j=0; j<4; j++)
-        for(i=0; i<4; i++)
-            s->frame.data[0][ (y*4+j)*s->frame.linesize[0] + (x*4+i)  ] =
-               src[j*src_stride + i];
-    }
-
-    return 0;
-}
-
-/** release AVFrame buffers if allocated */
-static void cond_release_buffer(AVFrame *pic)
-{
-    if (pic->data[0]) {
-        av_freep(&pic->data[0]);
-        av_free(pic->data[1]);
-    }
-}
-
-static int tgv_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TgvContext *s = avctx->priv_data;
-    const uint8_t *buf_end = buf + buf_size;
-    int chunk_type;
-
-    chunk_type = AV_RL32(&buf[0]);
-    buf += EA_PREAMBLE_SIZE;
-
-    if (chunk_type==kVGT_TAG) {
-        int pal_count, i;
-        if(buf+12>buf_end) {
-            av_log(avctx, AV_LOG_WARNING, "truncated header\n");
-            return -1;
-        }
-
-        s->width  = AV_RL16(&buf[0]);
-        s->height = AV_RL16(&buf[2]);
-        if (s->avctx->width!=s->width || s->avctx->height!=s->height) {
-            avcodec_set_dimensions(s->avctx, s->width, s->height);
-            cond_release_buffer(&s->frame);
-            cond_release_buffer(&s->last_frame);
-        }
-
-        pal_count = AV_RL16(&buf[6]);
-        buf += 12;
-        for(i=0; i<pal_count && i<AVPALETTE_COUNT && buf+2<buf_end; i++) {
-            s->palette[i] = AV_RB24(buf);
-            buf += 3;
-        }
-    }
-
-    if (avcodec_check_dimensions(avctx, s->width, s->height))
-        return -1;
-
-    /* shuffle */
-    FFSWAP(AVFrame, s->frame, s->last_frame);
-    if (!s->frame.data[0]) {
-        s->frame.reference = 1;
-        s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
-        s->frame.linesize[0] = s->width;
-
-        /* allocate additional 12 bytes to accomodate av_memcpy_backptr() OUTBUF_PADDED optimisation */
-        s->frame.data[0] = av_malloc(s->width*s->height + 12);
-        if (!s->frame.data[0])
-            return AVERROR(ENOMEM);
-        s->frame.data[1] = av_malloc(AVPALETTE_SIZE);
-        if (!s->frame.data[1]) {
-            av_freep(&s->frame.data[0]);
-            return AVERROR(ENOMEM);
-        }
-    }
-    memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
-
-    if(chunk_type==kVGT_TAG) {
-        s->frame.key_frame = 1;
-        s->frame.pict_type = FF_I_TYPE;
-        if (unpack(buf, buf_end, s->frame.data[0], s->avctx->width, s->avctx->height)<0) {
-            av_log(avctx, AV_LOG_WARNING, "truncated intra frame\n");
-            return -1;
-        }
-    }else{
-        if (!s->last_frame.data[0]) {
-            av_log(avctx, AV_LOG_WARNING, "inter frame without corresponding intra frame\n");
-            return buf_size;
-        }
-        s->frame.key_frame = 0;
-        s->frame.pict_type = FF_P_TYPE;
-        if (tgv_decode_inter(s, buf, buf_end)<0) {
-            av_log(avctx, AV_LOG_WARNING, "truncated inter frame\n");
-            return -1;
-        }
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    return buf_size;
-}
-
-static av_cold int tgv_decode_end(AVCodecContext *avctx)
-{
-    TgvContext *s = avctx->priv_data;
-    cond_release_buffer(&s->frame);
-    cond_release_buffer(&s->last_frame);
-    av_free(s->mv_codebook);
-    av_free(s->block_codebook);
-    return 0;
-}
-
-AVCodec eatgv_decoder = {
-    "eatgv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TGV,
-    sizeof(TgvContext),
-    tgv_decode_init,
-    NULL,
-    tgv_decode_end,
-    tgv_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"),
-};
diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
deleted file mode 100644
index 7f1901d..0000000
--- a/libavcodec/eatqi.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Electronic Arts TQI Video Decoder
- * Copyright (c) 2007-2009 Peter Ross <pross at xvid.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/**
- * @file
- * Electronic Arts TQI Video Decoder
- * by Peter Ross <pross at xvid.org>
- *
- * Technical details here:
- * http://wiki.multimedia.cx/index.php?title=Electronic_Arts_TQI
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "aandcttab.h"
-#include "mpeg12.h"
-#include "mpegvideo.h"
-
-typedef struct TqiContext {
-    MpegEncContext s;
-    AVFrame frame;
-    void *bitstream_buf;
-    unsigned int bitstream_buf_size;
-    DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
-} TqiContext;
-
-static av_cold int tqi_decode_init(AVCodecContext *avctx)
-{
-    TqiContext *t = avctx->priv_data;
-    MpegEncContext *s = &t->s;
-    s->avctx = avctx;
-    if(avctx->idct_algo==FF_IDCT_AUTO)
-        avctx->idct_algo=FF_IDCT_EA;
-    dsputil_init(&s->dsp, avctx);
-    ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
-    s->qscale = 1;
-    avctx->time_base = (AVRational){1, 15};
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-    ff_mpeg12_init_vlcs();
-    return 0;
-}
-
-static void tqi_decode_mb(MpegEncContext *s, DCTELEM (*block)[64])
-{
-    int n;
-    s->dsp.clear_blocks(block[0]);
-    for (n=0; n<6; n++)
-        ff_mpeg1_decode_block_intra(s, block[n], n);
-}
-
-static inline void tqi_idct_put(TqiContext *t, DCTELEM (*block)[64])
-{
-    MpegEncContext *s = &t->s;
-    int linesize= t->frame.linesize[0];
-    uint8_t *dest_y  = t->frame.data[0] + (s->mb_y * 16* linesize            ) + s->mb_x * 16;
-    uint8_t *dest_cb = t->frame.data[1] + (s->mb_y * 8 * t->frame.linesize[1]) + s->mb_x * 8;
-    uint8_t *dest_cr = t->frame.data[2] + (s->mb_y * 8 * t->frame.linesize[2]) + s->mb_x * 8;
-
-    s->dsp.idct_put(dest_y                 , linesize, block[0]);
-    s->dsp.idct_put(dest_y              + 8, linesize, block[1]);
-    s->dsp.idct_put(dest_y + 8*linesize    , linesize, block[2]);
-    s->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
-    if(!(s->avctx->flags&CODEC_FLAG_GRAY)) {
-        s->dsp.idct_put(dest_cb, t->frame.linesize[1], block[4]);
-        s->dsp.idct_put(dest_cr, t->frame.linesize[2], block[5]);
-    }
-}
-
-static void tqi_calculate_qtable(MpegEncContext *s, int quant)
-{
-    const int qscale = (215 - 2*quant)*5;
-    int i;
-    if (s->avctx->idct_algo==FF_IDCT_EA) {
-        s->intra_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0])>>11;
-        for(i=1; i<64; i++)
-            s->intra_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32)>>14;
-    }else{
-        s->intra_matrix[0] = ff_mpeg1_default_intra_matrix[0];
-        for(i=1; i<64; i++)
-            s->intra_matrix[i] = (ff_mpeg1_default_intra_matrix[i]*qscale + 32)>>3;
-    }
-}
-
-static int tqi_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    const uint8_t *buf_end = buf+buf_size;
-    TqiContext *t = avctx->priv_data;
-    MpegEncContext *s = &t->s;
-
-    s->width  = AV_RL16(&buf[0]);
-    s->height = AV_RL16(&buf[2]);
-    tqi_calculate_qtable(s, buf[4]);
-    buf += 8;
-
-    if (t->frame.data[0])
-        avctx->release_buffer(avctx, &t->frame);
-
-    if (s->avctx->width!=s->width || s->avctx->height!=s->height)
-        avcodec_set_dimensions(s->avctx, s->width, s->height);
-
-    if(avctx->get_buffer(avctx, &t->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!t->bitstream_buf)
-        return AVERROR(ENOMEM);
-    s->dsp.bswap_buf(t->bitstream_buf, (const uint32_t*)buf, (buf_end-buf)/4);
-    init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf));
-
-    s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 0;
-    for (s->mb_y=0; s->mb_y<(avctx->height+15)/16; s->mb_y++)
-    for (s->mb_x=0; s->mb_x<(avctx->width+15)/16; s->mb_x++)
-    {
-        tqi_decode_mb(s, t->block);
-        tqi_idct_put(t, t->block);
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = t->frame;
-    return buf_size;
-}
-
-static av_cold int tqi_decode_end(AVCodecContext *avctx)
-{
-    TqiContext *t = avctx->priv_data;
-    if(t->frame.data[0])
-        avctx->release_buffer(avctx, &t->frame);
-    av_free(t->bitstream_buf);
-    return 0;
-}
-
-AVCodec eatqi_decoder = {
-    "eatqi",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TQI,
-    sizeof(TqiContext),
-    tqi_decode_init,
-    NULL,
-    tqi_decode_end,
-    tqi_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TQI Video"),
-};
diff --git a/libavcodec/elbg.c b/libavcodec/elbg.c
deleted file mode 100644
index d6a4ce7..0000000
--- a/libavcodec/elbg.c
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (C) 2007 Vitor Sessak <vitor1001 at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Codebook Generator using the ELBG algorithm
- */
-
-#include <string.h>
-
-#include "libavutil/lfg.h"
-#include "elbg.h"
-#include "avcodec.h"
-
-#define DELTA_ERR_MAX 0.1  ///< Precision of the ELBG algorithm (as percentual error)
-
-/**
- * In the ELBG jargon, a cell is the set of points that are closest to a
- * codebook entry. Not to be confused with a RoQ Video cell. */
-typedef struct cell_s {
-    int index;
-    struct cell_s *next;
-} cell;
-
-/**
- * ELBG internal data
- */
-typedef struct{
-    int error;
-    int dim;
-    int numCB;
-    int *codebook;
-    cell **cells;
-    int *utility;
-    int *utility_inc;
-    int *nearest_cb;
-    int *points;
-    AVLFG *rand_state;
-} elbg_data;
-
-static inline int distance_limited(int *a, int *b, int dim, int limit)
-{
-    int i, dist=0;
-    for (i=0; i<dim; i++) {
-        dist += (a[i] - b[i])*(a[i] - b[i]);
-        if (dist > limit)
-            return INT_MAX;
-    }
-
-    return dist;
-}
-
-static inline void vect_division(int *res, int *vect, int div, int dim)
-{
-    int i;
-    if (div > 1)
-        for (i=0; i<dim; i++)
-            res[i] = ROUNDED_DIV(vect[i],div);
-    else if (res != vect)
-        memcpy(res, vect, dim*sizeof(int));
-
-}
-
-static int eval_error_cell(elbg_data *elbg, int *centroid, cell *cells)
-{
-    int error=0;
-    for (; cells; cells=cells->next)
-        error += distance_limited(centroid, elbg->points + cells->index*elbg->dim, elbg->dim, INT_MAX);
-
-    return error;
-}
-
-static int get_closest_codebook(elbg_data *elbg, int index)
-{
-    int i, pick=0, diff, diff_min = INT_MAX;
-    for (i=0; i<elbg->numCB; i++)
-        if (i != index) {
-            diff = distance_limited(elbg->codebook + i*elbg->dim, elbg->codebook + index*elbg->dim, elbg->dim, diff_min);
-            if (diff < diff_min) {
-                pick = i;
-                diff_min = diff;
-            }
-        }
-    return pick;
-}
-
-static int get_high_utility_cell(elbg_data *elbg)
-{
-    int i=0;
-    /* Using linear search, do binary if it ever turns to be speed critical */
-    int r = av_lfg_get(elbg->rand_state)%elbg->utility_inc[elbg->numCB-1] + 1;
-    while (elbg->utility_inc[i] < r)
-        i++;
-
-    assert(!elbg->cells[i]);
-
-    return i;
-}
-
-/**
- * Implementation of the simple LBG algorithm for just two codebooks
- */
-static int simple_lbg(int dim,
-                      int *centroid[3],
-                      int newutility[3],
-                      int *points,
-                      cell *cells)
-{
-    int i, idx;
-    int numpoints[2] = {0,0};
-    int newcentroid[2][dim];
-    cell *tempcell;
-
-    memset(newcentroid, 0, sizeof(newcentroid));
-
-    newutility[0] =
-    newutility[1] = 0;
-
-    for (tempcell = cells; tempcell; tempcell=tempcell->next) {
-        idx = distance_limited(centroid[0], points + tempcell->index*dim, dim, INT_MAX)>=
-              distance_limited(centroid[1], points + tempcell->index*dim, dim, INT_MAX);
-        numpoints[idx]++;
-        for (i=0; i<dim; i++)
-            newcentroid[idx][i] += points[tempcell->index*dim + i];
-    }
-
-    vect_division(centroid[0], newcentroid[0], numpoints[0], dim);
-    vect_division(centroid[1], newcentroid[1], numpoints[1], dim);
-
-    for (tempcell = cells; tempcell; tempcell=tempcell->next) {
-        int dist[2] = {distance_limited(centroid[0], points + tempcell->index*dim, dim, INT_MAX),
-                       distance_limited(centroid[1], points + tempcell->index*dim, dim, INT_MAX)};
-        int idx = dist[0] > dist[1];
-        newutility[idx] += dist[idx];
-    }
-
-    return newutility[0] + newutility[1];
-}
-
-static void get_new_centroids(elbg_data *elbg, int huc, int *newcentroid_i,
-                              int *newcentroid_p)
-{
-    cell *tempcell;
-    int min[elbg->dim];
-    int max[elbg->dim];
-    int i;
-
-    for (i=0; i< elbg->dim; i++) {
-        min[i]=INT_MAX;
-        max[i]=0;
-    }
-
-    for (tempcell = elbg->cells[huc]; tempcell; tempcell = tempcell->next)
-        for(i=0; i<elbg->dim; i++) {
-            min[i]=FFMIN(min[i], elbg->points[tempcell->index*elbg->dim + i]);
-            max[i]=FFMAX(max[i], elbg->points[tempcell->index*elbg->dim + i]);
-        }
-
-    for (i=0; i<elbg->dim; i++) {
-        newcentroid_i[i] = min[i] + (max[i] - min[i])/3;
-        newcentroid_p[i] = min[i] + (2*(max[i] - min[i]))/3;
-    }
-}
-
-/**
- * Add the points in the low utility cell to its closest cell. Split the high
- * utility cell, putting the separed points in the (now empty) low utility
- * cell.
- *
- * @param elbg         Internal elbg data
- * @param indexes      {luc, huc, cluc}
- * @param newcentroid  A vector with the position of the new centroids
- */
-static void shift_codebook(elbg_data *elbg, int *indexes,
-                           int *newcentroid[3])
-{
-    cell *tempdata;
-    cell **pp = &elbg->cells[indexes[2]];
-
-    while(*pp)
-        pp= &(*pp)->next;
-
-    *pp = elbg->cells[indexes[0]];
-
-    elbg->cells[indexes[0]] = NULL;
-    tempdata = elbg->cells[indexes[1]];
-    elbg->cells[indexes[1]] = NULL;
-
-    while(tempdata) {
-        cell *tempcell2 = tempdata->next;
-        int idx = distance_limited(elbg->points + tempdata->index*elbg->dim,
-                           newcentroid[0], elbg->dim, INT_MAX) >
-                  distance_limited(elbg->points + tempdata->index*elbg->dim,
-                           newcentroid[1], elbg->dim, INT_MAX);
-
-        tempdata->next = elbg->cells[indexes[idx]];
-        elbg->cells[indexes[idx]] = tempdata;
-        tempdata = tempcell2;
-    }
-}
-
-static void evaluate_utility_inc(elbg_data *elbg)
-{
-    int i, inc=0;
-
-    for (i=0; i < elbg->numCB; i++) {
-        if (elbg->numCB*elbg->utility[i] > elbg->error)
-            inc += elbg->utility[i];
-        elbg->utility_inc[i] = inc;
-    }
-}
-
-
-static void update_utility_and_n_cb(elbg_data *elbg, int idx, int newutility)
-{
-    cell *tempcell;
-
-    elbg->utility[idx] = newutility;
-    for (tempcell=elbg->cells[idx]; tempcell; tempcell=tempcell->next)
-        elbg->nearest_cb[tempcell->index] = idx;
-}
-
-/**
- * Evaluate if a shift lower the error. If it does, call shift_codebooks
- * and update elbg->error, elbg->utility and elbg->nearest_cb.
- *
- * @param elbg  Internal elbg data
- * @param indexes      {luc (low utility cell, huc (high utility cell), cluc (closest cell to low utility cell)}
- */
-static void try_shift_candidate(elbg_data *elbg, int idx[3])
-{
-    int j, k, olderror=0, newerror, cont=0;
-    int newutility[3];
-    int newcentroid[3][elbg->dim];
-    int *newcentroid_ptrs[3];
-    cell *tempcell;
-
-    newcentroid_ptrs[0] = newcentroid[0];
-    newcentroid_ptrs[1] = newcentroid[1];
-    newcentroid_ptrs[2] = newcentroid[2];
-
-    for (j=0; j<3; j++)
-        olderror += elbg->utility[idx[j]];
-
-    memset(newcentroid[2], 0, elbg->dim*sizeof(int));
-
-    for (k=0; k<2; k++)
-        for (tempcell=elbg->cells[idx[2*k]]; tempcell; tempcell=tempcell->next) {
-            cont++;
-            for (j=0; j<elbg->dim; j++)
-                newcentroid[2][j] += elbg->points[tempcell->index*elbg->dim + j];
-        }
-
-    vect_division(newcentroid[2], newcentroid[2], cont, elbg->dim);
-
-    get_new_centroids(elbg, idx[1], newcentroid[0], newcentroid[1]);
-
-    newutility[2]  = eval_error_cell(elbg, newcentroid[2], elbg->cells[idx[0]]);
-    newutility[2] += eval_error_cell(elbg, newcentroid[2], elbg->cells[idx[2]]);
-
-    newerror = newutility[2];
-
-    newerror += simple_lbg(elbg->dim, newcentroid_ptrs, newutility, elbg->points,
-                           elbg->cells[idx[1]]);
-
-    if (olderror > newerror) {
-        shift_codebook(elbg, idx, newcentroid_ptrs);
-
-        elbg->error += newerror - olderror;
-
-        for (j=0; j<3; j++)
-            update_utility_and_n_cb(elbg, idx[j], newutility[j]);
-
-        evaluate_utility_inc(elbg);
-    }
- }
-
-/**
- * Implementation of the ELBG block
- */
-static void do_shiftings(elbg_data *elbg)
-{
-    int idx[3];
-
-    evaluate_utility_inc(elbg);
-
-    for (idx[0]=0; idx[0] < elbg->numCB; idx[0]++)
-        if (elbg->numCB*elbg->utility[idx[0]] < elbg->error) {
-            if (elbg->utility_inc[elbg->numCB-1] == 0)
-                return;
-
-            idx[1] = get_high_utility_cell(elbg);
-            idx[2] = get_closest_codebook(elbg, idx[0]);
-
-            if (idx[1] != idx[0] && idx[1] != idx[2])
-                try_shift_candidate(elbg, idx);
-        }
-}
-
-#define BIG_PRIME 433494437LL
-
-void ff_init_elbg(int *points, int dim, int numpoints, int *codebook,
-                  int numCB, int max_steps, int *closest_cb,
-                  AVLFG *rand_state)
-{
-    int i, k;
-
-    if (numpoints > 24*numCB) {
-        /* ELBG is very costly for a big number of points. So if we have a lot
-           of them, get a good initial codebook to save on iterations       */
-        int *temp_points = av_malloc(dim*(numpoints/8)*sizeof(int));
-        for (i=0; i<numpoints/8; i++) {
-            k = (i*BIG_PRIME) % numpoints;
-            memcpy(temp_points + i*dim, points + k*dim, dim*sizeof(int));
-        }
-
-        ff_init_elbg(temp_points, dim, numpoints/8, codebook, numCB, 2*max_steps, closest_cb, rand_state);
-        ff_do_elbg(temp_points, dim, numpoints/8, codebook, numCB, 2*max_steps, closest_cb, rand_state);
-
-        av_free(temp_points);
-
-    } else  // If not, initialize the codebook with random positions
-        for (i=0; i < numCB; i++)
-            memcpy(codebook + i*dim, points + ((i*BIG_PRIME)%numpoints)*dim,
-                   dim*sizeof(int));
-
-}
-
-void ff_do_elbg(int *points, int dim, int numpoints, int *codebook,
-                int numCB, int max_steps, int *closest_cb,
-                AVLFG *rand_state)
-{
-    int dist;
-    elbg_data elbg_d;
-    elbg_data *elbg = &elbg_d;
-    int i, j, k, last_error, steps=0;
-    int *dist_cb = av_malloc(numpoints*sizeof(int));
-    int *size_part = av_malloc(numCB*sizeof(int));
-    cell *list_buffer = av_malloc(numpoints*sizeof(cell));
-    cell *free_cells;
-    int best_dist, best_idx = 0;
-
-    elbg->error = INT_MAX;
-    elbg->dim = dim;
-    elbg->numCB = numCB;
-    elbg->codebook = codebook;
-    elbg->cells = av_malloc(numCB*sizeof(cell *));
-    elbg->utility = av_malloc(numCB*sizeof(int));
-    elbg->nearest_cb = closest_cb;
-    elbg->points = points;
-    elbg->utility_inc = av_malloc(numCB*sizeof(int));
-
-    elbg->rand_state = rand_state;
-
-    do {
-        free_cells = list_buffer;
-        last_error = elbg->error;
-        steps++;
-        memset(elbg->utility, 0, numCB*sizeof(int));
-        memset(elbg->cells, 0, numCB*sizeof(cell *));
-
-        elbg->error = 0;
-
-        /* This loop evaluate the actual Voronoi partition. It is the most
-           costly part of the algorithm. */
-        for (i=0; i < numpoints; i++) {
-            best_dist = distance_limited(elbg->points + i*elbg->dim, elbg->codebook + best_idx*elbg->dim, dim, INT_MAX);
-            for (k=0; k < elbg->numCB; k++) {
-                dist = distance_limited(elbg->points + i*elbg->dim, elbg->codebook + k*elbg->dim, dim, best_dist);
-                if (dist < best_dist) {
-                    best_dist = dist;
-                    best_idx = k;
-                }
-            }
-            elbg->nearest_cb[i] = best_idx;
-            dist_cb[i] = best_dist;
-            elbg->error += dist_cb[i];
-            elbg->utility[elbg->nearest_cb[i]] += dist_cb[i];
-            free_cells->index = i;
-            free_cells->next = elbg->cells[elbg->nearest_cb[i]];
-            elbg->cells[elbg->nearest_cb[i]] = free_cells;
-            free_cells++;
-        }
-
-        do_shiftings(elbg);
-
-        memset(size_part, 0, numCB*sizeof(int));
-
-        memset(elbg->codebook, 0, elbg->numCB*dim*sizeof(int));
-
-        for (i=0; i < numpoints; i++) {
-            size_part[elbg->nearest_cb[i]]++;
-            for (j=0; j < elbg->dim; j++)
-                elbg->codebook[elbg->nearest_cb[i]*elbg->dim + j] +=
-                    elbg->points[i*elbg->dim + j];
-        }
-
-        for (i=0; i < elbg->numCB; i++)
-            vect_division(elbg->codebook + i*elbg->dim,
-                          elbg->codebook + i*elbg->dim, size_part[i], elbg->dim);
-
-    } while(((last_error - elbg->error) > DELTA_ERR_MAX*elbg->error) &&
-            (steps < max_steps));
-
-    av_free(dist_cb);
-    av_free(size_part);
-    av_free(elbg->utility);
-    av_free(list_buffer);
-    av_free(elbg->cells);
-    av_free(elbg->utility_inc);
-}
diff --git a/libavcodec/elbg.h b/libavcodec/elbg.h
deleted file mode 100644
index e6f577e..0000000
--- a/libavcodec/elbg.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2007 Vitor Sessak <vitor1001 at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ELBG_H
-#define AVCODEC_ELBG_H
-
-#include "libavutil/lfg.h"
-
-/**
- * Implementation of the Enhanced LBG Algorithm
- * Based on the paper "Neural Networks 14:1219-1237" that can be found in
- * http://citeseer.ist.psu.edu/patan01enhanced.html .
- *
- * @param points Input points.
- * @param dim Dimension of the points.
- * @param numpoints Num of points in **points.
- * @param codebook Pointer to the output codebook. Must be allocated.
- * @param numCB Number of points in the codebook.
- * @param num_steps The maximum number of steps. One step is already a good compromise between time and quality.
- * @param closest_cb Return the closest codebook to each point. Must be allocated.
- * @param rand_state A random number generator state. Should be already initialized by av_lfg_init().
- */
-void ff_do_elbg(int *points, int dim, int numpoints, int *codebook,
-                int numCB, int num_steps, int *closest_cb,
-                AVLFG *rand_state);
-
-/**
- * Initialize the **codebook vector for the elbg algorithm. If you have already
- * a codebook and you want to refine it, you shouldn't call this function.
- * If numpoints < 8*numCB this function fills **codebook with random numbers.
- * If not, it calls ff_do_elbg for a (smaller) random sample of the points in
- * **points. Get the same parameters as ff_do_elbg.
- */
-void ff_init_elbg(int *points, int dim, int numpoints, int *codebook,
-                  int numCB, int num_steps, int *closest_cb,
-                  AVLFG *rand_state);
-
-#endif /* AVCODEC_ELBG_H */
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
deleted file mode 100644
index dc015b9..0000000
--- a/libavcodec/error_resilience.c
+++ /dev/null
@@ -1,1122 +0,0 @@
-/*
- * Error resilience / concealment
- *
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Error resilience / concealment.
- */
-
-#include <limits.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "h264.h"
-#include "rectangle.h"
-
-/*
- * H264 redefines mb_intra so it is not mistakely used (its uninitialized in h264)
- * but error concealment must support both h264 and h263 thus we must undo this
- */
-#undef mb_intra
-
-static void decode_mb(MpegEncContext *s, int ref){
-    s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16* s->linesize  ) + s->mb_x * 16;
-    s->dest[1] = s->current_picture.data[1] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);
-    s->dest[2] = s->current_picture.data[2] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);
-
-    if(CONFIG_H264_DECODER && s->codec_id == CODEC_ID_H264){
-        H264Context *h= (void*)s;
-        h->mb_xy= s->mb_x + s->mb_y*s->mb_stride;
-        memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache));
-        assert(ref>=0);
-        if(ref >= h->ref_count[0]) //FIXME it is posible albeit uncommon that slice references differ between slices, we take the easy approuch and ignore it for now. If this turns out to have any relevance in practice then correct remapping should be added
-            ref=0;
-        fill_rectangle(&s->current_picture.ref_index[0][4*h->mb_xy], 2, 2, 2, ref, 1);
-        fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
-        fill_rectangle(h->mv_cache[0][ scan8[0] ], 4, 4, 8, pack16to32(s->mv[0][0][0],s->mv[0][0][1]), 4);
-        assert(!FRAME_MBAFF);
-        ff_h264_hl_decode_mb(h);
-    }else{
-        assert(ref==0);
-    MPV_decode_mb(s, s->block);
-    }
-}
-
-/**
- * @param stride the number of MVs to get to the next row
- * @param mv_step the number of MVs per row or column in a macroblock
- */
-static void set_mv_strides(MpegEncContext *s, int *mv_step, int *stride){
-    if(s->codec_id == CODEC_ID_H264){
-        H264Context *h= (void*)s;
-        assert(s->quarter_sample);
-        *mv_step= 4;
-        *stride= h->b_stride;
-    }else{
-        *mv_step= 2;
-        *stride= s->b8_stride;
-    }
-}
-
-/**
- * replaces the current MB with a flat dc only version.
- */
-static void put_dc(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int mb_x, int mb_y)
-{
-    int dc, dcu, dcv, y, i;
-    for(i=0; i<4; i++){
-        dc= s->dc_val[0][mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*s->b8_stride];
-        if(dc<0) dc=0;
-        else if(dc>2040) dc=2040;
-        for(y=0; y<8; y++){
-            int x;
-            for(x=0; x<8; x++){
-                dest_y[x + (i&1)*8 + (y + (i>>1)*8)*s->linesize]= dc/8;
-            }
-        }
-    }
-    dcu = s->dc_val[1][mb_x + mb_y*s->mb_stride];
-    dcv = s->dc_val[2][mb_x + mb_y*s->mb_stride];
-    if     (dcu<0   ) dcu=0;
-    else if(dcu>2040) dcu=2040;
-    if     (dcv<0   ) dcv=0;
-    else if(dcv>2040) dcv=2040;
-    for(y=0; y<8; y++){
-        int x;
-        for(x=0; x<8; x++){
-            dest_cb[x + y*(s->uvlinesize)]= dcu/8;
-            dest_cr[x + y*(s->uvlinesize)]= dcv/8;
-        }
-    }
-}
-
-static void filter181(int16_t *data, int width, int height, int stride){
-    int x,y;
-
-    /* horizontal filter */
-    for(y=1; y<height-1; y++){
-        int prev_dc= data[0 + y*stride];
-
-        for(x=1; x<width-1; x++){
-            int dc;
-
-            dc= - prev_dc
-                + data[x     + y*stride]*8
-                - data[x + 1 + y*stride];
-            dc= (dc*10923 + 32768)>>16;
-            prev_dc= data[x + y*stride];
-            data[x + y*stride]= dc;
-        }
-    }
-
-    /* vertical filter */
-    for(x=1; x<width-1; x++){
-        int prev_dc= data[x];
-
-        for(y=1; y<height-1; y++){
-            int dc;
-
-            dc= - prev_dc
-                + data[x +  y   *stride]*8
-                - data[x + (y+1)*stride];
-            dc= (dc*10923 + 32768)>>16;
-            prev_dc= data[x + y*stride];
-            data[x + y*stride]= dc;
-        }
-    }
-}
-
-/**
- * guess the dc of blocks which do not have an undamaged dc
- * @param w     width in 8 pixel blocks
- * @param h     height in 8 pixel blocks
- */
-static void guess_dc(MpegEncContext *s, int16_t *dc, int w, int h, int stride, int is_luma){
-    int b_x, b_y;
-
-    for(b_y=0; b_y<h; b_y++){
-        for(b_x=0; b_x<w; b_x++){
-            int color[4]={1024,1024,1024,1024};
-            int distance[4]={9999,9999,9999,9999};
-            int mb_index, error, j;
-            int64_t guess, weight_sum;
-
-            mb_index= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
-
-            error= s->error_status_table[mb_index];
-
-            if(IS_INTER(s->current_picture.mb_type[mb_index])) continue; //inter
-            if(!(error&DC_ERROR)) continue;           //dc-ok
-
-            /* right block */
-            for(j=b_x+1; j<w; j++){
-                int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride;
-                int error_j= s->error_status_table[mb_index_j];
-                int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
-                if(intra_j==0 || !(error_j&DC_ERROR)){
-                    color[0]= dc[j + b_y*stride];
-                    distance[0]= j-b_x;
-                    break;
-                }
-            }
-
-            /* left block */
-            for(j=b_x-1; j>=0; j--){
-                int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride;
-                int error_j= s->error_status_table[mb_index_j];
-                int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
-                if(intra_j==0 || !(error_j&DC_ERROR)){
-                    color[1]= dc[j + b_y*stride];
-                    distance[1]= b_x-j;
-                    break;
-                }
-            }
-
-            /* bottom block */
-            for(j=b_y+1; j<h; j++){
-                int mb_index_j= (b_x>>is_luma) + (j>>is_luma)*s->mb_stride;
-                int error_j= s->error_status_table[mb_index_j];
-                int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
-                if(intra_j==0 || !(error_j&DC_ERROR)){
-                    color[2]= dc[b_x + j*stride];
-                    distance[2]= j-b_y;
-                    break;
-                }
-            }
-
-            /* top block */
-            for(j=b_y-1; j>=0; j--){
-                int mb_index_j= (b_x>>is_luma) + (j>>is_luma)*s->mb_stride;
-                int error_j= s->error_status_table[mb_index_j];
-                int intra_j= IS_INTRA(s->current_picture.mb_type[mb_index_j]);
-                if(intra_j==0 || !(error_j&DC_ERROR)){
-                    color[3]= dc[b_x + j*stride];
-                    distance[3]= b_y-j;
-                    break;
-                }
-            }
-
-            weight_sum=0;
-            guess=0;
-            for(j=0; j<4; j++){
-                int64_t weight= 256*256*256*16/distance[j];
-                guess+= weight*(int64_t)color[j];
-                weight_sum+= weight;
-            }
-            guess= (guess + weight_sum/2) / weight_sum;
-
-            dc[b_x + b_y*stride]= guess;
-        }
-    }
-}
-
-/**
- * simple horizontal deblocking filter used for error resilience
- * @param w     width in 8 pixel blocks
- * @param h     height in 8 pixel blocks
- */
-static void h_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
-    int b_x, b_y, mvx_stride, mvy_stride;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    set_mv_strides(s, &mvx_stride, &mvy_stride);
-    mvx_stride >>= is_luma;
-    mvy_stride *= mvx_stride;
-
-    for(b_y=0; b_y<h; b_y++){
-        for(b_x=0; b_x<w-1; b_x++){
-            int y;
-            int left_status = s->error_status_table[( b_x   >>is_luma) + (b_y>>is_luma)*s->mb_stride];
-            int right_status= s->error_status_table[((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride];
-            int left_intra=   IS_INTRA(s->current_picture.mb_type      [( b_x   >>is_luma) + (b_y>>is_luma)*s->mb_stride]);
-            int right_intra=  IS_INTRA(s->current_picture.mb_type      [((b_x+1)>>is_luma) + (b_y>>is_luma)*s->mb_stride]);
-            int left_damage =  left_status&(DC_ERROR|AC_ERROR|MV_ERROR);
-            int right_damage= right_status&(DC_ERROR|AC_ERROR|MV_ERROR);
-            int offset= b_x*8 + b_y*stride*8;
-            int16_t *left_mv=  s->current_picture.motion_val[0][mvy_stride*b_y + mvx_stride* b_x   ];
-            int16_t *right_mv= s->current_picture.motion_val[0][mvy_stride*b_y + mvx_stride*(b_x+1)];
-
-            if(!(left_damage||right_damage)) continue; // both undamaged
-
-            if(   (!left_intra) && (!right_intra)
-               && FFABS(left_mv[0]-right_mv[0]) + FFABS(left_mv[1]+right_mv[1]) < 2) continue;
-
-            for(y=0; y<8; y++){
-                int a,b,c,d;
-
-                a= dst[offset + 7 + y*stride] - dst[offset + 6 + y*stride];
-                b= dst[offset + 8 + y*stride] - dst[offset + 7 + y*stride];
-                c= dst[offset + 9 + y*stride] - dst[offset + 8 + y*stride];
-
-                d= FFABS(b) - ((FFABS(a) + FFABS(c) + 1)>>1);
-                d= FFMAX(d, 0);
-                if(b<0) d= -d;
-
-                if(d==0) continue;
-
-                if(!(left_damage && right_damage))
-                    d= d*16/9;
-
-                if(left_damage){
-                    dst[offset + 7 + y*stride] = cm[dst[offset + 7 + y*stride] + ((d*7)>>4)];
-                    dst[offset + 6 + y*stride] = cm[dst[offset + 6 + y*stride] + ((d*5)>>4)];
-                    dst[offset + 5 + y*stride] = cm[dst[offset + 5 + y*stride] + ((d*3)>>4)];
-                    dst[offset + 4 + y*stride] = cm[dst[offset + 4 + y*stride] + ((d*1)>>4)];
-                }
-                if(right_damage){
-                    dst[offset + 8 + y*stride] = cm[dst[offset + 8 + y*stride] - ((d*7)>>4)];
-                    dst[offset + 9 + y*stride] = cm[dst[offset + 9 + y*stride] - ((d*5)>>4)];
-                    dst[offset + 10+ y*stride] = cm[dst[offset +10 + y*stride] - ((d*3)>>4)];
-                    dst[offset + 11+ y*stride] = cm[dst[offset +11 + y*stride] - ((d*1)>>4)];
-                }
-            }
-        }
-    }
-}
-
-/**
- * simple vertical deblocking filter used for error resilience
- * @param w     width in 8 pixel blocks
- * @param h     height in 8 pixel blocks
- */
-static void v_block_filter(MpegEncContext *s, uint8_t *dst, int w, int h, int stride, int is_luma){
-    int b_x, b_y, mvx_stride, mvy_stride;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    set_mv_strides(s, &mvx_stride, &mvy_stride);
-    mvx_stride >>= is_luma;
-    mvy_stride *= mvx_stride;
-
-    for(b_y=0; b_y<h-1; b_y++){
-        for(b_x=0; b_x<w; b_x++){
-            int x;
-            int top_status   = s->error_status_table[(b_x>>is_luma) + ( b_y   >>is_luma)*s->mb_stride];
-            int bottom_status= s->error_status_table[(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride];
-            int top_intra=     IS_INTRA(s->current_picture.mb_type      [(b_x>>is_luma) + ( b_y   >>is_luma)*s->mb_stride]);
-            int bottom_intra=  IS_INTRA(s->current_picture.mb_type      [(b_x>>is_luma) + ((b_y+1)>>is_luma)*s->mb_stride]);
-            int top_damage =      top_status&(DC_ERROR|AC_ERROR|MV_ERROR);
-            int bottom_damage= bottom_status&(DC_ERROR|AC_ERROR|MV_ERROR);
-            int offset= b_x*8 + b_y*stride*8;
-            int16_t *top_mv=    s->current_picture.motion_val[0][mvy_stride* b_y    + mvx_stride*b_x];
-            int16_t *bottom_mv= s->current_picture.motion_val[0][mvy_stride*(b_y+1) + mvx_stride*b_x];
-
-            if(!(top_damage||bottom_damage)) continue; // both undamaged
-
-            if(   (!top_intra) && (!bottom_intra)
-               && FFABS(top_mv[0]-bottom_mv[0]) + FFABS(top_mv[1]+bottom_mv[1]) < 2) continue;
-
-            for(x=0; x<8; x++){
-                int a,b,c,d;
-
-                a= dst[offset + x + 7*stride] - dst[offset + x + 6*stride];
-                b= dst[offset + x + 8*stride] - dst[offset + x + 7*stride];
-                c= dst[offset + x + 9*stride] - dst[offset + x + 8*stride];
-
-                d= FFABS(b) - ((FFABS(a) + FFABS(c)+1)>>1);
-                d= FFMAX(d, 0);
-                if(b<0) d= -d;
-
-                if(d==0) continue;
-
-                if(!(top_damage && bottom_damage))
-                    d= d*16/9;
-
-                if(top_damage){
-                    dst[offset + x +  7*stride] = cm[dst[offset + x +  7*stride] + ((d*7)>>4)];
-                    dst[offset + x +  6*stride] = cm[dst[offset + x +  6*stride] + ((d*5)>>4)];
-                    dst[offset + x +  5*stride] = cm[dst[offset + x +  5*stride] + ((d*3)>>4)];
-                    dst[offset + x +  4*stride] = cm[dst[offset + x +  4*stride] + ((d*1)>>4)];
-                }
-                if(bottom_damage){
-                    dst[offset + x +  8*stride] = cm[dst[offset + x +  8*stride] - ((d*7)>>4)];
-                    dst[offset + x +  9*stride] = cm[dst[offset + x +  9*stride] - ((d*5)>>4)];
-                    dst[offset + x + 10*stride] = cm[dst[offset + x + 10*stride] - ((d*3)>>4)];
-                    dst[offset + x + 11*stride] = cm[dst[offset + x + 11*stride] - ((d*1)>>4)];
-                }
-            }
-        }
-    }
-}
-
-static void guess_mv(MpegEncContext *s){
-    uint8_t fixed[s->mb_stride * s->mb_height];
-#define MV_FROZEN    3
-#define MV_CHANGED   2
-#define MV_UNCHANGED 1
-    const int mb_stride = s->mb_stride;
-    const int mb_width = s->mb_width;
-    const int mb_height= s->mb_height;
-    int i, depth, num_avail;
-    int mb_x, mb_y, mot_step, mot_stride;
-
-    set_mv_strides(s, &mot_step, &mot_stride);
-
-    num_avail=0;
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[ i ];
-        int f=0;
-        int error= s->error_status_table[mb_xy];
-
-        if(IS_INTRA(s->current_picture.mb_type[mb_xy])) f=MV_FROZEN; //intra //FIXME check
-        if(!(error&MV_ERROR)) f=MV_FROZEN;           //inter with undamaged MV
-
-        fixed[mb_xy]= f;
-        if(f==MV_FROZEN)
-            num_avail++;
-    }
-
-    if((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || num_avail <= mb_width/2){
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                const int mb_xy= mb_x + mb_y*s->mb_stride;
-
-                if(IS_INTRA(s->current_picture.mb_type[mb_xy]))  continue;
-                if(!(s->error_status_table[mb_xy]&MV_ERROR)) continue;
-
-                s->mv_dir = s->last_picture.data[0] ? MV_DIR_FORWARD : MV_DIR_BACKWARD;
-                s->mb_intra=0;
-                s->mv_type = MV_TYPE_16X16;
-                s->mb_skipped=0;
-
-                s->dsp.clear_blocks(s->block[0]);
-
-                s->mb_x= mb_x;
-                s->mb_y= mb_y;
-                s->mv[0][0][0]= 0;
-                s->mv[0][0][1]= 0;
-                decode_mb(s, 0);
-            }
-        }
-        return;
-    }
-
-    for(depth=0;; depth++){
-        int changed, pass, none_left;
-
-        none_left=1;
-        changed=1;
-        for(pass=0; (changed || pass<2) && pass<10; pass++){
-            int mb_x, mb_y;
-int score_sum=0;
-
-            changed=0;
-            for(mb_y=0; mb_y<s->mb_height; mb_y++){
-                for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                    const int mb_xy= mb_x + mb_y*s->mb_stride;
-                    int mv_predictor[8][2]={{0}};
-                    int ref[8]={0};
-                    int pred_count=0;
-                    int j;
-                    int best_score=256*256*256*64;
-                    int best_pred=0;
-                    const int mot_index= (mb_x + mb_y*mot_stride) * mot_step;
-                    int prev_x= s->current_picture.motion_val[0][mot_index][0];
-                    int prev_y= s->current_picture.motion_val[0][mot_index][1];
-
-                    if((mb_x^mb_y^pass)&1) continue;
-
-                    if(fixed[mb_xy]==MV_FROZEN) continue;
-                    assert(!IS_INTRA(s->current_picture.mb_type[mb_xy]));
-                    assert(s->last_picture_ptr && s->last_picture_ptr->data[0]);
-
-                    j=0;
-                    if(mb_x>0           && fixed[mb_xy-1        ]==MV_FROZEN) j=1;
-                    if(mb_x+1<mb_width  && fixed[mb_xy+1        ]==MV_FROZEN) j=1;
-                    if(mb_y>0           && fixed[mb_xy-mb_stride]==MV_FROZEN) j=1;
-                    if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_FROZEN) j=1;
-                    if(j==0) continue;
-
-                    j=0;
-                    if(mb_x>0           && fixed[mb_xy-1        ]==MV_CHANGED) j=1;
-                    if(mb_x+1<mb_width  && fixed[mb_xy+1        ]==MV_CHANGED) j=1;
-                    if(mb_y>0           && fixed[mb_xy-mb_stride]==MV_CHANGED) j=1;
-                    if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]==MV_CHANGED) j=1;
-                    if(j==0 && pass>1) continue;
-
-                    none_left=0;
-
-                    if(mb_x>0 && fixed[mb_xy-1]){
-                        mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_step][0];
-                        mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_step][1];
-                        ref         [pred_count]   = s->current_picture.ref_index[0][4*(mb_xy-1)];
-                        pred_count++;
-                    }
-                    if(mb_x+1<mb_width && fixed[mb_xy+1]){
-                        mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_step][0];
-                        mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_step][1];
-                        ref         [pred_count]   = s->current_picture.ref_index[0][4*(mb_xy+1)];
-                        pred_count++;
-                    }
-                    if(mb_y>0 && fixed[mb_xy-mb_stride]){
-                        mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index - mot_stride*mot_step][0];
-                        mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index - mot_stride*mot_step][1];
-                        ref         [pred_count]   = s->current_picture.ref_index[0][4*(mb_xy-s->mb_stride)];
-                        pred_count++;
-                    }
-                    if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){
-                        mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index + mot_stride*mot_step][0];
-                        mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index + mot_stride*mot_step][1];
-                        ref         [pred_count]   = s->current_picture.ref_index[0][4*(mb_xy+s->mb_stride)];
-                        pred_count++;
-                    }
-                    if(pred_count==0) continue;
-
-                    if(pred_count>1){
-                        int sum_x=0, sum_y=0, sum_r=0;
-                        int max_x, max_y, min_x, min_y, max_r, min_r;
-
-                        for(j=0; j<pred_count; j++){
-                            sum_x+= mv_predictor[j][0];
-                            sum_y+= mv_predictor[j][1];
-                            sum_r+= ref[j];
-                            if(j && ref[j] != ref[j-1])
-                                goto skip_mean_and_median;
-                        }
-
-                        /* mean */
-                        mv_predictor[pred_count][0] = sum_x/j;
-                        mv_predictor[pred_count][1] = sum_y/j;
-                        ref         [pred_count]    = sum_r/j;
-
-                        /* median */
-                        if(pred_count>=3){
-                            min_y= min_x= min_r= 99999;
-                            max_y= max_x= max_r=-99999;
-                        }else{
-                            min_x=min_y=max_x=max_y=min_r=max_r=0;
-                        }
-                        for(j=0; j<pred_count; j++){
-                            max_x= FFMAX(max_x, mv_predictor[j][0]);
-                            max_y= FFMAX(max_y, mv_predictor[j][1]);
-                            max_r= FFMAX(max_r, ref[j]);
-                            min_x= FFMIN(min_x, mv_predictor[j][0]);
-                            min_y= FFMIN(min_y, mv_predictor[j][1]);
-                            min_r= FFMIN(min_r, ref[j]);
-                        }
-                        mv_predictor[pred_count+1][0] = sum_x - max_x - min_x;
-                        mv_predictor[pred_count+1][1] = sum_y - max_y - min_y;
-                        ref         [pred_count+1]    = sum_r - max_r - min_r;
-
-                        if(pred_count==4){
-                            mv_predictor[pred_count+1][0] /= 2;
-                            mv_predictor[pred_count+1][1] /= 2;
-                            ref         [pred_count+1]    /= 2;
-                        }
-                        pred_count+=2;
-                    }
-skip_mean_and_median:
-
-                    /* zero MV */
-                    pred_count++;
-
-                    /* last MV */
-                    mv_predictor[pred_count][0]= s->current_picture.motion_val[0][mot_index][0];
-                    mv_predictor[pred_count][1]= s->current_picture.motion_val[0][mot_index][1];
-                    ref         [pred_count]   = s->current_picture.ref_index[0][4*mb_xy];
-                    pred_count++;
-
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mb_intra=0;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_skipped=0;
-
-                    s->dsp.clear_blocks(s->block[0]);
-
-                    s->mb_x= mb_x;
-                    s->mb_y= mb_y;
-
-                    for(j=0; j<pred_count; j++){
-                        int score=0;
-                        uint8_t *src= s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
-
-                        s->current_picture.motion_val[0][mot_index][0]= s->mv[0][0][0]= mv_predictor[j][0];
-                        s->current_picture.motion_val[0][mot_index][1]= s->mv[0][0][1]= mv_predictor[j][1];
-
-                        if(ref[j]<0) //predictor intra or otherwise not available
-                            continue;
-
-                        decode_mb(s, ref[j]);
-
-                        if(mb_x>0 && fixed[mb_xy-1]){
-                            int k;
-                            for(k=0; k<16; k++)
-                                score += FFABS(src[k*s->linesize-1 ]-src[k*s->linesize   ]);
-                        }
-                        if(mb_x+1<mb_width && fixed[mb_xy+1]){
-                            int k;
-                            for(k=0; k<16; k++)
-                                score += FFABS(src[k*s->linesize+15]-src[k*s->linesize+16]);
-                        }
-                        if(mb_y>0 && fixed[mb_xy-mb_stride]){
-                            int k;
-                            for(k=0; k<16; k++)
-                                score += FFABS(src[k-s->linesize   ]-src[k               ]);
-                        }
-                        if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){
-                            int k;
-                            for(k=0; k<16; k++)
-                                score += FFABS(src[k+s->linesize*15]-src[k+s->linesize*16]);
-                        }
-
-                        if(score <= best_score){ // <= will favor the last MV
-                            best_score= score;
-                            best_pred= j;
-                        }
-                    }
-score_sum+= best_score;
-                    s->mv[0][0][0]= mv_predictor[best_pred][0];
-                    s->mv[0][0][1]= mv_predictor[best_pred][1];
-
-                    for(i=0; i<mot_step; i++)
-                        for(j=0; j<mot_step; j++){
-                            s->current_picture.motion_val[0][mot_index+i+j*mot_stride][0]= s->mv[0][0][0];
-                            s->current_picture.motion_val[0][mot_index+i+j*mot_stride][1]= s->mv[0][0][1];
-                        }
-
-                    decode_mb(s, ref[best_pred]);
-
-
-                    if(s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y){
-                        fixed[mb_xy]=MV_CHANGED;
-                        changed++;
-                    }else
-                        fixed[mb_xy]=MV_UNCHANGED;
-                }
-            }
-
-//            printf(".%d/%d", changed, score_sum); fflush(stdout);
-        }
-
-        if(none_left)
-            return;
-
-        for(i=0; i<s->mb_num; i++){
-            int mb_xy= s->mb_index2xy[i];
-            if(fixed[mb_xy])
-                fixed[mb_xy]=MV_FROZEN;
-        }
-//        printf(":"); fflush(stdout);
-    }
-}
-
-static int is_intra_more_likely(MpegEncContext *s){
-    int is_intra_likely, i, j, undamaged_count, skip_amount, mb_x, mb_y;
-
-    if(!s->last_picture_ptr || !s->last_picture_ptr->data[0]) return 1; //no previous frame available -> use spatial prediction
-
-    undamaged_count=0;
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[i];
-        const int error= s->error_status_table[mb_xy];
-        if(!((error&DC_ERROR) && (error&MV_ERROR)))
-            undamaged_count++;
-    }
-
-    if(s->codec_id == CODEC_ID_H264){
-        H264Context *h= (void*)s;
-        if(h->ref_count[0] <= 0 || !h->ref_list[0][0].data[0])
-            return 1;
-    }
-
-    if(undamaged_count < 5) return 0; //almost all MBs damaged -> use temporal prediction
-
-    //prevent dsp.sad() check, that requires access to the image
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration && s->pict_type == FF_I_TYPE)
-        return 1;
-
-    skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs
-    is_intra_likely=0;
-
-    j=0;
-    for(mb_y= 0; mb_y<s->mb_height-1; mb_y++){
-        for(mb_x= 0; mb_x<s->mb_width; mb_x++){
-            int error;
-            const int mb_xy= mb_x + mb_y*s->mb_stride;
-
-            error= s->error_status_table[mb_xy];
-            if((error&DC_ERROR) && (error&MV_ERROR))
-                continue; //skip damaged
-
-            j++;
-            if((j%skip_amount) != 0) continue; //skip a few to speed things up
-
-            if(s->pict_type==FF_I_TYPE){
-                uint8_t *mb_ptr     = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
-                uint8_t *last_mb_ptr= s->last_picture.data   [0] + mb_x*16 + mb_y*16*s->linesize;
-
-                is_intra_likely += s->dsp.sad[0](NULL, last_mb_ptr, mb_ptr                    , s->linesize, 16);
-                is_intra_likely -= s->dsp.sad[0](NULL, last_mb_ptr, last_mb_ptr+s->linesize*16, s->linesize, 16);
-            }else{
-                if(IS_INTRA(s->current_picture.mb_type[mb_xy]))
-                   is_intra_likely++;
-                else
-                   is_intra_likely--;
-            }
-        }
-    }
-//printf("is_intra_likely: %d type:%d\n", is_intra_likely, s->pict_type);
-    return is_intra_likely > 0;
-}
-
-void ff_er_frame_start(MpegEncContext *s){
-    if(!s->error_recognition) return;
-
-    memset(s->error_status_table, MV_ERROR|AC_ERROR|DC_ERROR|VP_START|AC_END|DC_END|MV_END, s->mb_stride*s->mb_height*sizeof(uint8_t));
-    s->error_count= 3*s->mb_num;
-}
-
-/**
- * adds a slice.
- * @param endx x component of the last macroblock, can be -1 for the last of the previous line
- * @param status the status at the end (MV_END, AC_ERROR, ...), it is assumed that no earlier end or
- *               error of the same type occurred
- */
-void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status){
-    const int start_i= av_clip(startx + starty * s->mb_width    , 0, s->mb_num-1);
-    const int end_i  = av_clip(endx   + endy   * s->mb_width    , 0, s->mb_num);
-    const int start_xy= s->mb_index2xy[start_i];
-    const int end_xy  = s->mb_index2xy[end_i];
-    int mask= -1;
-
-    if(s->avctx->hwaccel)
-        return;
-
-    if(start_i > end_i || start_xy > end_xy){
-        av_log(s->avctx, AV_LOG_ERROR, "internal error, slice end before start\n");
-        return;
-    }
-
-    if(!s->error_recognition) return;
-
-    mask &= ~VP_START;
-    if(status & (AC_ERROR|AC_END)){
-        mask &= ~(AC_ERROR|AC_END);
-        s->error_count -= end_i - start_i + 1;
-    }
-    if(status & (DC_ERROR|DC_END)){
-        mask &= ~(DC_ERROR|DC_END);
-        s->error_count -= end_i - start_i + 1;
-    }
-    if(status & (MV_ERROR|MV_END)){
-        mask &= ~(MV_ERROR|MV_END);
-        s->error_count -= end_i - start_i + 1;
-    }
-
-    if(status & (AC_ERROR|DC_ERROR|MV_ERROR)) s->error_count= INT_MAX;
-
-    if(mask == ~0x7F){
-        memset(&s->error_status_table[start_xy], 0, (end_xy - start_xy) * sizeof(uint8_t));
-    }else{
-        int i;
-        for(i=start_xy; i<end_xy; i++){
-            s->error_status_table[ i ] &= mask;
-        }
-    }
-
-    if(end_i == s->mb_num)
-        s->error_count= INT_MAX;
-    else{
-        s->error_status_table[end_xy] &= mask;
-        s->error_status_table[end_xy] |= status;
-    }
-
-    s->error_status_table[start_xy] |= VP_START;
-
-    if(start_xy > 0 && s->avctx->thread_count <= 1 && s->avctx->skip_top*s->mb_width < start_i){
-        int prev_status= s->error_status_table[ s->mb_index2xy[start_i - 1] ];
-
-        prev_status &= ~ VP_START;
-        if(prev_status != (MV_END|DC_END|AC_END)) s->error_count= INT_MAX;
-    }
-}
-
-void ff_er_frame_end(MpegEncContext *s){
-    int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error;
-    int distance;
-    int threshold_part[4]= {100,100,100};
-    int threshold= 50;
-    int is_intra_likely;
-    int size = s->b8_stride * 2 * s->mb_height;
-    Picture *pic= s->current_picture_ptr;
-
-    if(!s->error_recognition || s->error_count==0 || s->avctx->lowres ||
-       s->avctx->hwaccel ||
-       s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU ||
-       s->picture_structure != PICT_FRAME || // we dont support ER of field pictures yet, though it should not crash if enabled
-       s->error_count==3*s->mb_width*(s->avctx->skip_top + s->avctx->skip_bottom)) return;
-
-    if(s->current_picture.motion_val[0] == NULL){
-        av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
-
-        for(i=0; i<2; i++){
-            pic->ref_index[i]= av_mallocz(s->mb_stride * s->mb_height * 4 * sizeof(uint8_t));
-            pic->motion_val_base[i]= av_mallocz((size+4) * 2 * sizeof(uint16_t));
-            pic->motion_val[i]= pic->motion_val_base[i]+4;
-        }
-        pic->motion_subsample_log2= 3;
-        s->current_picture= *s->current_picture_ptr;
-    }
-
-    if(s->avctx->debug&FF_DEBUG_ER){
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                int status= s->error_status_table[mb_x + mb_y*s->mb_stride];
-
-                av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status);
-            }
-            av_log(s->avctx, AV_LOG_DEBUG, "\n");
-        }
-    }
-
-#if 1
-    /* handle overlapping slices */
-    for(error_type=1; error_type<=3; error_type++){
-        int end_ok=0;
-
-        for(i=s->mb_num-1; i>=0; i--){
-            const int mb_xy= s->mb_index2xy[i];
-            int error= s->error_status_table[mb_xy];
-
-            if(error&(1<<error_type))
-                end_ok=1;
-            if(error&(8<<error_type))
-                end_ok=1;
-
-            if(!end_ok)
-                s->error_status_table[mb_xy]|= 1<<error_type;
-
-            if(error&VP_START)
-                end_ok=0;
-        }
-    }
-#endif
-#if 1
-    /* handle slices with partitions of different length */
-    if(s->partitioned_frame){
-        int end_ok=0;
-
-        for(i=s->mb_num-1; i>=0; i--){
-            const int mb_xy= s->mb_index2xy[i];
-            int error= s->error_status_table[mb_xy];
-
-            if(error&AC_END)
-                end_ok=0;
-            if((error&MV_END) || (error&DC_END) || (error&AC_ERROR))
-                end_ok=1;
-
-            if(!end_ok)
-                s->error_status_table[mb_xy]|= AC_ERROR;
-
-            if(error&VP_START)
-                end_ok=0;
-        }
-    }
-#endif
-    /* handle missing slices */
-    if(s->error_recognition>=4){
-        int end_ok=1;
-
-        for(i=s->mb_num-2; i>=s->mb_width+100; i--){ //FIXME +100 hack
-            const int mb_xy= s->mb_index2xy[i];
-            int error1= s->error_status_table[mb_xy  ];
-            int error2= s->error_status_table[s->mb_index2xy[i+1]];
-
-            if(error1&VP_START)
-                end_ok=1;
-
-            if(   error2==(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END)
-               && error1!=(VP_START|DC_ERROR|AC_ERROR|MV_ERROR|AC_END|DC_END|MV_END)
-               && ((error1&AC_END) || (error1&DC_END) || (error1&MV_END))){ //end & uninit
-                end_ok=0;
-            }
-
-            if(!end_ok)
-                s->error_status_table[mb_xy]|= DC_ERROR|AC_ERROR|MV_ERROR;
-        }
-    }
-
-#if 1
-    /* backward mark errors */
-    distance=9999999;
-    for(error_type=1; error_type<=3; error_type++){
-        for(i=s->mb_num-1; i>=0; i--){
-            const int mb_xy= s->mb_index2xy[i];
-            int error= s->error_status_table[mb_xy];
-
-            if(!s->mbskip_table[mb_xy]) //FIXME partition specific
-                distance++;
-            if(error&(1<<error_type))
-                distance= 0;
-
-            if(s->partitioned_frame){
-                if(distance < threshold_part[error_type-1])
-                    s->error_status_table[mb_xy]|= 1<<error_type;
-            }else{
-                if(distance < threshold)
-                    s->error_status_table[mb_xy]|= 1<<error_type;
-            }
-
-            if(error&VP_START)
-                distance= 9999999;
-        }
-    }
-#endif
-
-    /* forward mark errors */
-    error=0;
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[i];
-        int old_error= s->error_status_table[mb_xy];
-
-        if(old_error&VP_START)
-            error= old_error& (DC_ERROR|AC_ERROR|MV_ERROR);
-        else{
-            error|= old_error& (DC_ERROR|AC_ERROR|MV_ERROR);
-            s->error_status_table[mb_xy]|= error;
-        }
-    }
-#if 1
-    /* handle not partitioned case */
-    if(!s->partitioned_frame){
-        for(i=0; i<s->mb_num; i++){
-            const int mb_xy= s->mb_index2xy[i];
-            error= s->error_status_table[mb_xy];
-            if(error&(AC_ERROR|DC_ERROR|MV_ERROR))
-                error|= AC_ERROR|DC_ERROR|MV_ERROR;
-            s->error_status_table[mb_xy]= error;
-        }
-    }
-#endif
-
-    dc_error= ac_error= mv_error=0;
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[i];
-        error= s->error_status_table[mb_xy];
-        if(error&DC_ERROR) dc_error ++;
-        if(error&AC_ERROR) ac_error ++;
-        if(error&MV_ERROR) mv_error ++;
-    }
-    av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors\n", dc_error, ac_error, mv_error);
-
-    is_intra_likely= is_intra_more_likely(s);
-
-    /* set unknown mb-type to most likely */
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[i];
-        error= s->error_status_table[mb_xy];
-        if(!((error&DC_ERROR) && (error&MV_ERROR)))
-            continue;
-
-        if(is_intra_likely)
-            s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA4x4;
-        else
-            s->current_picture.mb_type[mb_xy]= MB_TYPE_16x16 | MB_TYPE_L0;
-    }
-
-    // change inter to intra blocks if no reference frames are available
-    if (!s->last_picture.data[0] && !s->next_picture.data[0])
-        for(i=0; i<s->mb_num; i++){
-            const int mb_xy= s->mb_index2xy[i];
-            if(!IS_INTRA(s->current_picture.mb_type[mb_xy]))
-                s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA4x4;
-        }
-
-    /* handle inter blocks with damaged AC */
-    for(mb_y=0; mb_y<s->mb_height; mb_y++){
-        for(mb_x=0; mb_x<s->mb_width; mb_x++){
-            const int mb_xy= mb_x + mb_y * s->mb_stride;
-            const int mb_type= s->current_picture.mb_type[mb_xy];
-            int dir = !s->last_picture.data[0];
-            error= s->error_status_table[mb_xy];
-
-            if(IS_INTRA(mb_type)) continue; //intra
-            if(error&MV_ERROR) continue;              //inter with damaged MV
-            if(!(error&AC_ERROR)) continue;           //undamaged inter
-
-            s->mv_dir = dir ? MV_DIR_BACKWARD : MV_DIR_FORWARD;
-            s->mb_intra=0;
-            s->mb_skipped=0;
-            if(IS_8X8(mb_type)){
-                int mb_index= mb_x*2 + mb_y*2*s->b8_stride;
-                int j;
-                s->mv_type = MV_TYPE_8X8;
-                for(j=0; j<4; j++){
-                    s->mv[0][j][0] = s->current_picture.motion_val[dir][ mb_index + (j&1) + (j>>1)*s->b8_stride ][0];
-                    s->mv[0][j][1] = s->current_picture.motion_val[dir][ mb_index + (j&1) + (j>>1)*s->b8_stride ][1];
-                }
-            }else{
-                s->mv_type = MV_TYPE_16X16;
-                s->mv[0][0][0] = s->current_picture.motion_val[dir][ mb_x*2 + mb_y*2*s->b8_stride ][0];
-                s->mv[0][0][1] = s->current_picture.motion_val[dir][ mb_x*2 + mb_y*2*s->b8_stride ][1];
-            }
-
-            s->dsp.clear_blocks(s->block[0]);
-
-            s->mb_x= mb_x;
-            s->mb_y= mb_y;
-            decode_mb(s, 0/*FIXME h264 partitioned slices need this set*/);
-        }
-    }
-
-    /* guess MVs */
-    if(s->pict_type==FF_B_TYPE){
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                int xy= mb_x*2 + mb_y*2*s->b8_stride;
-                const int mb_xy= mb_x + mb_y * s->mb_stride;
-                const int mb_type= s->current_picture.mb_type[mb_xy];
-                error= s->error_status_table[mb_xy];
-
-                if(IS_INTRA(mb_type)) continue;
-                if(!(error&MV_ERROR)) continue;           //inter with undamaged MV
-                if(!(error&AC_ERROR)) continue;           //undamaged inter
-
-                s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD;
-                if(!s->last_picture.data[0]) s->mv_dir &= ~MV_DIR_FORWARD;
-                if(!s->next_picture.data[0]) s->mv_dir &= ~MV_DIR_BACKWARD;
-                s->mb_intra=0;
-                s->mv_type = MV_TYPE_16X16;
-                s->mb_skipped=0;
-
-                if(s->pp_time){
-                    int time_pp= s->pp_time;
-                    int time_pb= s->pb_time;
-
-                    s->mv[0][0][0] = s->next_picture.motion_val[0][xy][0]*time_pb/time_pp;
-                    s->mv[0][0][1] = s->next_picture.motion_val[0][xy][1]*time_pb/time_pp;
-                    s->mv[1][0][0] = s->next_picture.motion_val[0][xy][0]*(time_pb - time_pp)/time_pp;
-                    s->mv[1][0][1] = s->next_picture.motion_val[0][xy][1]*(time_pb - time_pp)/time_pp;
-                }else{
-                    s->mv[0][0][0]= 0;
-                    s->mv[0][0][1]= 0;
-                    s->mv[1][0][0]= 0;
-                    s->mv[1][0][1]= 0;
-                }
-
-                s->dsp.clear_blocks(s->block[0]);
-                s->mb_x= mb_x;
-                s->mb_y= mb_y;
-                decode_mb(s, 0);
-            }
-        }
-    }else
-        guess_mv(s);
-
-    /* the filters below are not XvMC compatible, skip them */
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
-        goto ec_clean;
-    /* fill DC for inter blocks */
-    for(mb_y=0; mb_y<s->mb_height; mb_y++){
-        for(mb_x=0; mb_x<s->mb_width; mb_x++){
-            int dc, dcu, dcv, y, n;
-            int16_t *dc_ptr;
-            uint8_t *dest_y, *dest_cb, *dest_cr;
-            const int mb_xy= mb_x + mb_y * s->mb_stride;
-            const int mb_type= s->current_picture.mb_type[mb_xy];
-
-            error= s->error_status_table[mb_xy];
-
-            if(IS_INTRA(mb_type) && s->partitioned_frame) continue;
-//            if(error&MV_ERROR) continue; //inter data damaged FIXME is this good?
-
-            dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
-            dest_cb= s->current_picture.data[1] + mb_x*8  + mb_y*8 *s->uvlinesize;
-            dest_cr= s->current_picture.data[2] + mb_x*8  + mb_y*8 *s->uvlinesize;
-
-            dc_ptr= &s->dc_val[0][mb_x*2 + mb_y*2*s->b8_stride];
-            for(n=0; n<4; n++){
-                dc=0;
-                for(y=0; y<8; y++){
-                    int x;
-                    for(x=0; x<8; x++){
-                       dc+= dest_y[x + (n&1)*8 + (y + (n>>1)*8)*s->linesize];
-                    }
-                }
-                dc_ptr[(n&1) + (n>>1)*s->b8_stride]= (dc+4)>>3;
-            }
-
-            dcu=dcv=0;
-            for(y=0; y<8; y++){
-                int x;
-                for(x=0; x<8; x++){
-                    dcu+=dest_cb[x + y*(s->uvlinesize)];
-                    dcv+=dest_cr[x + y*(s->uvlinesize)];
-                }
-            }
-            s->dc_val[1][mb_x + mb_y*s->mb_stride]= (dcu+4)>>3;
-            s->dc_val[2][mb_x + mb_y*s->mb_stride]= (dcv+4)>>3;
-        }
-    }
-#if 1
-    /* guess DC for damaged blocks */
-    guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride, 1);
-    guess_dc(s, s->dc_val[1], s->mb_width  , s->mb_height  , s->mb_stride, 0);
-    guess_dc(s, s->dc_val[2], s->mb_width  , s->mb_height  , s->mb_stride, 0);
-#endif
-    /* filter luma DC */
-    filter181(s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride);
-
-#if 1
-    /* render DC only intra */
-    for(mb_y=0; mb_y<s->mb_height; mb_y++){
-        for(mb_x=0; mb_x<s->mb_width; mb_x++){
-            uint8_t *dest_y, *dest_cb, *dest_cr;
-            const int mb_xy= mb_x + mb_y * s->mb_stride;
-            const int mb_type= s->current_picture.mb_type[mb_xy];
-
-            error= s->error_status_table[mb_xy];
-
-            if(IS_INTER(mb_type)) continue;
-            if(!(error&AC_ERROR)) continue;              //undamaged
-
-            dest_y = s->current_picture.data[0] + mb_x*16 + mb_y*16*s->linesize;
-            dest_cb= s->current_picture.data[1] + mb_x*8  + mb_y*8 *s->uvlinesize;
-            dest_cr= s->current_picture.data[2] + mb_x*8  + mb_y*8 *s->uvlinesize;
-
-            put_dc(s, dest_y, dest_cb, dest_cr, mb_x, mb_y);
-        }
-    }
-#endif
-
-    if(s->avctx->error_concealment&FF_EC_DEBLOCK){
-        /* filter horizontal block boundaries */
-        h_block_filter(s, s->current_picture.data[0], s->mb_width*2, s->mb_height*2, s->linesize  , 1);
-        h_block_filter(s, s->current_picture.data[1], s->mb_width  , s->mb_height  , s->uvlinesize, 0);
-        h_block_filter(s, s->current_picture.data[2], s->mb_width  , s->mb_height  , s->uvlinesize, 0);
-
-        /* filter vertical block boundaries */
-        v_block_filter(s, s->current_picture.data[0], s->mb_width*2, s->mb_height*2, s->linesize  , 1);
-        v_block_filter(s, s->current_picture.data[1], s->mb_width  , s->mb_height  , s->uvlinesize, 0);
-        v_block_filter(s, s->current_picture.data[2], s->mb_width  , s->mb_height  , s->uvlinesize, 0);
-    }
-
-ec_clean:
-    /* clean a few tables */
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[i];
-        int error= s->error_status_table[mb_xy];
-
-        if(s->pict_type!=FF_B_TYPE && (error&(DC_ERROR|MV_ERROR|AC_ERROR))){
-            s->mbskip_table[mb_xy]=0;
-        }
-        s->mbintra_table[mb_xy]=1;
-    }
-}
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
deleted file mode 100644
index b51206a..0000000
--- a/libavcodec/escape124.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Escape 124 Video Decoder
- * Copyright (C) 2008 Eli Friedman (eli.friedman at gmail.com)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-
-typedef union MacroBlock {
-    uint16_t pixels[4];
-    uint32_t pixels32[2];
-} MacroBlock;
-
-typedef union SuperBlock {
-    uint16_t pixels[64];
-    uint32_t pixels32[32];
-} SuperBlock;
-
-typedef struct CodeBook {
-    unsigned depth;
-    unsigned size;
-    MacroBlock* blocks;
-} CodeBook;
-
-typedef struct Escape124Context {
-    AVFrame frame;
-
-    unsigned num_superblocks;
-
-    CodeBook codebooks[3];
-} Escape124Context;
-
-static int can_safely_read(GetBitContext* gb, int bits) {
-    return get_bits_count(gb) + bits <= gb->size_in_bits;
-}
-
-/**
- * Initialize the decoder
- * @param avctx decoder context
- * @return 0 success, negative on error
- */
-static av_cold int escape124_decode_init(AVCodecContext *avctx)
-{
-    Escape124Context *s = avctx->priv_data;
-
-    avctx->pix_fmt = PIX_FMT_RGB555;
-
-    s->num_superblocks = ((unsigned)avctx->width / 8) *
-                         ((unsigned)avctx->height / 8);
-
-    return 0;
-}
-
-static av_cold int escape124_decode_close(AVCodecContext *avctx)
-{
-    unsigned i;
-    Escape124Context *s = avctx->priv_data;
-
-    for (i = 0; i < 3; i++)
-        av_free(s->codebooks[i].blocks);
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth,
-                                 unsigned size)
-{
-    unsigned i, j;
-    CodeBook cb = { 0 };
-
-    if (!can_safely_read(gb, size * 34))
-        return cb;
-
-    if (size >= INT_MAX / sizeof(MacroBlock))
-        return cb;
-    cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1);
-    if (!cb.blocks)
-        return cb;
-
-    cb.depth = depth;
-    cb.size = size;
-    for (i = 0; i < size; i++) {
-        unsigned mask_bits = get_bits(gb, 4);
-        unsigned color0 = get_bits(gb, 15);
-        unsigned color1 = get_bits(gb, 15);
-
-        for (j = 0; j < 4; j++) {
-            if (mask_bits & (1 << j))
-                cb.blocks[i].pixels[j] = color1;
-            else
-                cb.blocks[i].pixels[j] = color0;
-        }
-    }
-    return cb;
-}
-
-static unsigned decode_skip_count(GetBitContext* gb)
-{
-    unsigned value;
-    // This function reads a maximum of 23 bits,
-    // which is within the padding space
-    if (!can_safely_read(gb, 1))
-        return -1;
-    value = get_bits1(gb);
-    if (!value)
-        return value;
-
-    value += get_bits(gb, 3);
-    if (value != (1 + ((1 << 3) - 1)))
-        return value;
-
-    value += get_bits(gb, 7);
-    if (value != (1 + ((1 << 3) - 1)) + ((1 << 7) - 1))
-        return value;
-
-    return value + get_bits(gb, 12);
-}
-
-static MacroBlock decode_macroblock(Escape124Context* s, GetBitContext* gb,
-                                    int* codebook_index, int superblock_index)
-{
-    // This function reads a maximum of 22 bits; the callers
-    // guard this function appropriately
-    unsigned block_index, depth;
-
-    if (get_bits1(gb)) {
-        static const char transitions[3][2] = { {2, 1}, {0, 2}, {1, 0} };
-        *codebook_index = transitions[*codebook_index][get_bits1(gb)];
-    }
-
-    depth = s->codebooks[*codebook_index].depth;
-
-    // depth = 0 means that this shouldn't read any bits;
-    // in theory, this is the same as get_bits(gb, 0), but
-    // that doesn't actually work.
-    block_index = depth ? get_bits(gb, depth) : 0;
-
-    if (*codebook_index == 1) {
-        block_index += superblock_index << s->codebooks[1].depth;
-    }
-
-    // This condition can occur with invalid bitstreams and
-    // *codebook_index == 2
-    if (block_index >= s->codebooks[*codebook_index].size)
-        return (MacroBlock) { { 0 } };
-
-    return s->codebooks[*codebook_index].blocks[block_index];
-}
-
-static void insert_mb_into_sb(SuperBlock* sb, MacroBlock mb, unsigned index) {
-   // Formula: ((index / 4) * 16 + (index % 4) * 2) / 2
-   uint32_t *dst = sb->pixels32 + index + (index & -4);
-
-   // This technically violates C99 aliasing rules, but it should be safe.
-   dst[0] = mb.pixels32[0];
-   dst[4] = mb.pixels32[1];
-}
-
-static void copy_superblock(uint16_t* dest, unsigned dest_stride,
-                            uint16_t* src, unsigned src_stride)
-{
-    unsigned y;
-    if (src)
-        for (y = 0; y < 8; y++)
-            memcpy(dest + y * dest_stride, src + y * src_stride,
-                   sizeof(uint16_t) * 8);
-    else
-        for (y = 0; y < 8; y++)
-            memset(dest + y * dest_stride, 0, sizeof(uint16_t) * 8);
-}
-
-static const uint16_t mask_matrix[] = {0x1,   0x2,   0x10,   0x20,
-                                       0x4,   0x8,   0x40,   0x80,
-                                       0x100, 0x200, 0x1000, 0x2000,
-                                       0x400, 0x800, 0x4000, 0x8000};
-
-/**
- * Decode a single frame
- * @param avctx decoder context
- * @param data decoded frame
- * @param data_size size of the decoded frame
- * @param buf input buffer
- * @param buf_size input buffer size
- * @return 0 success, -1 on error
- */
-static int escape124_decode_frame(AVCodecContext *avctx,
-                                  void *data, int *data_size,
-                                  AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    Escape124Context *s = avctx->priv_data;
-
-    GetBitContext gb;
-    unsigned frame_flags, frame_size;
-    unsigned i;
-
-    unsigned superblock_index, cb_index = 1,
-             superblock_col_index = 0,
-             superblocks_per_row = avctx->width / 8, skip = -1;
-
-    uint16_t* old_frame_data, *new_frame_data;
-    unsigned old_stride, new_stride;
-
-    AVFrame new_frame = { { 0 } };
-
-    init_get_bits(&gb, buf, buf_size * 8);
-
-    // This call also guards the potential depth reads for the
-    // codebook unpacking.
-    if (!can_safely_read(&gb, 64))
-        return -1;
-
-    frame_flags = get_bits_long(&gb, 32);
-    frame_size  = get_bits_long(&gb, 32);
-
-    // Leave last frame unchanged
-    // FIXME: Is this necessary?  I haven't seen it in any real samples
-    if (!(frame_flags & 0x114) || !(frame_flags & 0x7800000)) {
-        av_log(NULL, AV_LOG_DEBUG, "Skipping frame\n");
-
-        *data_size = sizeof(AVFrame);
-        *(AVFrame*)data = s->frame;
-
-        return frame_size;
-    }
-
-    for (i = 0; i < 3; i++) {
-        if (frame_flags & (1 << (17 + i))) {
-            unsigned cb_depth, cb_size;
-            if (i == 2) {
-                // This codebook can be cut off at places other than
-                // powers of 2, leaving some of the entries undefined.
-                cb_size = get_bits_long(&gb, 20);
-                cb_depth = av_log2(cb_size - 1) + 1;
-            } else {
-                cb_depth = get_bits(&gb, 4);
-                if (i == 0) {
-                    // This is the most basic codebook: pow(2,depth) entries
-                    // for a depth-length key
-                    cb_size = 1 << cb_depth;
-                } else {
-                    // This codebook varies per superblock
-                    // FIXME: I don't think this handles integer overflow
-                    // properly
-                    cb_size = s->num_superblocks << cb_depth;
-                }
-            }
-            av_free(s->codebooks[i].blocks);
-            s->codebooks[i] = unpack_codebook(&gb, cb_depth, cb_size);
-            if (!s->codebooks[i].blocks)
-                return -1;
-        }
-    }
-
-    new_frame.reference = 3;
-    if (avctx->get_buffer(avctx, &new_frame)) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    new_frame_data = (uint16_t*)new_frame.data[0];
-    new_stride = new_frame.linesize[0] / 2;
-    old_frame_data = (uint16_t*)s->frame.data[0];
-    old_stride = s->frame.linesize[0] / 2;
-
-    for (superblock_index = 0; superblock_index < s->num_superblocks;
-         superblock_index++) {
-        MacroBlock mb;
-        SuperBlock sb;
-        unsigned multi_mask = 0;
-
-        if (skip == -1) {
-            // Note that this call will make us skip the rest of the blocks
-            // if the frame prematurely ends
-            skip = decode_skip_count(&gb);
-        }
-
-        if (skip) {
-            copy_superblock(new_frame_data, new_stride,
-                            old_frame_data, old_stride);
-        } else {
-            copy_superblock(sb.pixels, 8,
-                            old_frame_data, old_stride);
-
-            while (can_safely_read(&gb, 1) && !get_bits1(&gb)) {
-                unsigned mask;
-                mb = decode_macroblock(s, &gb, &cb_index, superblock_index);
-                mask = get_bits(&gb, 16);
-                multi_mask |= mask;
-                for (i = 0; i < 16; i++) {
-                    if (mask & mask_matrix[i]) {
-                        insert_mb_into_sb(&sb, mb, i);
-                    }
-                }
-            }
-
-            if (can_safely_read(&gb, 1) && !get_bits1(&gb)) {
-                unsigned inv_mask = get_bits(&gb, 4);
-                for (i = 0; i < 4; i++) {
-                    if (inv_mask & (1 << i)) {
-                        multi_mask ^= 0xF << i*4;
-                    } else {
-                        multi_mask ^= get_bits(&gb, 4) << i*4;
-                    }
-                }
-
-                for (i = 0; i < 16; i++) {
-                    if (multi_mask & mask_matrix[i]) {
-                        if (!can_safely_read(&gb, 1))
-                            break;
-                        mb = decode_macroblock(s, &gb, &cb_index,
-                                               superblock_index);
-                        insert_mb_into_sb(&sb, mb, i);
-                    }
-                }
-            } else if (frame_flags & (1 << 16)) {
-                while (can_safely_read(&gb, 1) && !get_bits1(&gb)) {
-                    mb = decode_macroblock(s, &gb, &cb_index, superblock_index);
-                    insert_mb_into_sb(&sb, mb, get_bits(&gb, 4));
-                }
-            }
-
-            copy_superblock(new_frame_data, new_stride, sb.pixels, 8);
-        }
-
-        superblock_col_index++;
-        new_frame_data += 8;
-        if (old_frame_data)
-            old_frame_data += 8;
-        if (superblock_col_index == superblocks_per_row) {
-            new_frame_data += new_stride * 8 - superblocks_per_row * 8;
-            if (old_frame_data)
-                old_frame_data += old_stride * 8 - superblocks_per_row * 8;
-            superblock_col_index = 0;
-        }
-        skip--;
-    }
-
-    av_log(NULL, AV_LOG_DEBUG,
-           "Escape sizes: %i, %i, %i\n",
-           frame_size, buf_size, get_bits_count(&gb) / 8);
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    *(AVFrame*)data = s->frame = new_frame;
-    *data_size = sizeof(AVFrame);
-
-    return frame_size;
-}
-
-
-AVCodec escape124_decoder = {
-    "escape124",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ESCAPE124,
-    sizeof(Escape124Context),
-    escape124_decode_init,
-    NULL,
-    escape124_decode_close,
-    escape124_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Escape 124"),
-};
-
diff --git a/libavcodec/eval.c b/libavcodec/eval.c
deleted file mode 100644
index ce4d0f5..0000000
--- a/libavcodec/eval.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Copyright (c) 2002-2006 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * simple arithmetic expression evaluator.
- *
- * see http://joe.hotchkiss.com/programming/eval/eval.html
- */
-
-#include "libavutil/avutil.h"
-#include "eval.h"
-
-typedef struct Parser{
-    int stack_index;
-    char *s;
-    const double *const_value;
-    const char * const *const_name;          // NULL terminated
-    double (* const *func1)(void *, double a);           // NULL terminated
-    const char * const *func1_name;          // NULL terminated
-    double (* const *func2)(void *, double a, double b); // NULL terminated
-    const char * const *func2_name;          // NULL terminated
-    void *opaque;
-    const char **error;
-#define VARS 10
-    double var[VARS];
-} Parser;
-
-static const int8_t si_prefixes['z' - 'E' + 1]={
-    ['y'-'E']= -24,
-    ['z'-'E']= -21,
-    ['a'-'E']= -18,
-    ['f'-'E']= -15,
-    ['p'-'E']= -12,
-    ['n'-'E']= - 9,
-    ['u'-'E']= - 6,
-    ['m'-'E']= - 3,
-    ['c'-'E']= - 2,
-    ['d'-'E']= - 1,
-    ['h'-'E']=   2,
-    ['k'-'E']=   3,
-    ['K'-'E']=   3,
-    ['M'-'E']=   6,
-    ['G'-'E']=   9,
-    ['T'-'E']=  12,
-    ['P'-'E']=  15,
-    ['E'-'E']=  18,
-    ['Z'-'E']=  21,
-    ['Y'-'E']=  24,
-};
-
-double av_strtod(const char *numstr, char **tail) {
-    double d;
-    char *next;
-    d = strtod(numstr, &next);
-    /* if parsing succeeded, check for and interpret postfixes */
-    if (next!=numstr) {
-
-        if(*next >= 'E' && *next <= 'z'){
-            int e= si_prefixes[*next - 'E'];
-            if(e){
-                if(next[1] == 'i'){
-                    d*= pow( 2, e/0.3);
-                    next+=2;
-                }else{
-                    d*= pow(10, e);
-                    next++;
-                }
-            }
-        }
-
-        if(*next=='B') {
-            d*=8;
-            next++;
-        }
-    }
-    /* if requested, fill in tail with the position after the last parsed
-       character */
-    if (tail)
-        *tail = next;
-    return d;
-}
-
-static int strmatch(const char *s, const char *prefix){
-    int i;
-    for(i=0; prefix[i]; i++){
-        if(prefix[i] != s[i]) return 0;
-    }
-    return 1;
-}
-
-struct AVExpr {
-    enum {
-        e_value, e_const, e_func0, e_func1, e_func2,
-        e_squish, e_gauss, e_ld,
-        e_mod, e_max, e_min, e_eq, e_gt, e_gte,
-        e_pow, e_mul, e_div, e_add,
-        e_last, e_st, e_while,
-    } type;
-    double value; // is sign in other types
-    union {
-        int const_index;
-        double (*func0)(double);
-        double (*func1)(void *, double);
-        double (*func2)(void *, double, double);
-    } a;
-    struct AVExpr *param[2];
-};
-
-static double eval_expr(Parser * p, AVExpr * e) {
-    switch (e->type) {
-        case e_value:  return e->value;
-        case e_const:  return e->value * p->const_value[e->a.const_index];
-        case e_func0:  return e->value * e->a.func0(eval_expr(p, e->param[0]));
-        case e_func1:  return e->value * e->a.func1(p->opaque, eval_expr(p, e->param[0]));
-        case e_func2:  return e->value * e->a.func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1]));
-        case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0])));
-        case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); }
-        case e_ld:     return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)];
-        case e_while: {
-            double d = NAN;
-            while(eval_expr(p, e->param[0]))
-                d=eval_expr(p, e->param[1]);
-            return d;
-        }
-        default: {
-            double d = eval_expr(p, e->param[0]);
-            double d2 = eval_expr(p, e->param[1]);
-            switch (e->type) {
-                case e_mod: return e->value * (d - floor(d/d2)*d2);
-                case e_max: return e->value * (d >  d2 ?   d : d2);
-                case e_min: return e->value * (d <  d2 ?   d : d2);
-                case e_eq:  return e->value * (d == d2 ? 1.0 : 0.0);
-                case e_gt:  return e->value * (d >  d2 ? 1.0 : 0.0);
-                case e_gte: return e->value * (d >= d2 ? 1.0 : 0.0);
-                case e_pow: return e->value * pow(d, d2);
-                case e_mul: return e->value * (d * d2);
-                case e_div: return e->value * (d / d2);
-                case e_add: return e->value * (d + d2);
-                case e_last:return e->value * d2;
-                case e_st : return e->value * (p->var[av_clip(d, 0, VARS-1)]= d2);
-            }
-        }
-    }
-    return NAN;
-}
-
-static AVExpr * parse_expr(Parser *p);
-
-void ff_free_expr(AVExpr * e) {
-    if (!e) return;
-    ff_free_expr(e->param[0]);
-    ff_free_expr(e->param[1]);
-    av_freep(&e);
-}
-
-static AVExpr * parse_primary(Parser *p) {
-    AVExpr * d = av_mallocz(sizeof(AVExpr));
-    char *next= p->s;
-    int i;
-
-    if (!d)
-        return NULL;
-
-    /* number */
-    d->value = av_strtod(p->s, &next);
-    if(next != p->s){
-        d->type = e_value;
-        p->s= next;
-        return d;
-    }
-    d->value = 1;
-
-    /* named constants */
-    for(i=0; p->const_name && p->const_name[i]; i++){
-        if(strmatch(p->s, p->const_name[i])){
-            p->s+= strlen(p->const_name[i]);
-            d->type = e_const;
-            d->a.const_index = i;
-            return d;
-        }
-    }
-
-    p->s= strchr(p->s, '(');
-    if(p->s==NULL){
-        *p->error = "undefined constant or missing (";
-        p->s= next;
-        ff_free_expr(d);
-        return NULL;
-    }
-    p->s++; // "("
-    if (*next == '(') { // special case do-nothing
-        av_freep(&d);
-        d = parse_expr(p);
-        if(p->s[0] != ')'){
-            *p->error = "missing )";
-            ff_free_expr(d);
-            return NULL;
-        }
-        p->s++; // ")"
-        return d;
-    }
-    d->param[0] = parse_expr(p);
-    if(p->s[0]== ','){
-        p->s++; // ","
-        d->param[1] = parse_expr(p);
-    }
-    if(p->s[0] != ')'){
-        *p->error = "missing )";
-        ff_free_expr(d);
-        return NULL;
-    }
-    p->s++; // ")"
-
-    d->type = e_func0;
-         if( strmatch(next, "sinh"  ) ) d->a.func0 = sinh;
-    else if( strmatch(next, "cosh"  ) ) d->a.func0 = cosh;
-    else if( strmatch(next, "tanh"  ) ) d->a.func0 = tanh;
-    else if( strmatch(next, "sin"   ) ) d->a.func0 = sin;
-    else if( strmatch(next, "cos"   ) ) d->a.func0 = cos;
-    else if( strmatch(next, "tan"   ) ) d->a.func0 = tan;
-    else if( strmatch(next, "atan"  ) ) d->a.func0 = atan;
-    else if( strmatch(next, "asin"  ) ) d->a.func0 = asin;
-    else if( strmatch(next, "acos"  ) ) d->a.func0 = acos;
-    else if( strmatch(next, "exp"   ) ) d->a.func0 = exp;
-    else if( strmatch(next, "log"   ) ) d->a.func0 = log;
-    else if( strmatch(next, "abs"   ) ) d->a.func0 = fabs;
-    else if( strmatch(next, "squish") ) d->type = e_squish;
-    else if( strmatch(next, "gauss" ) ) d->type = e_gauss;
-    else if( strmatch(next, "mod"   ) ) d->type = e_mod;
-    else if( strmatch(next, "max"   ) ) d->type = e_max;
-    else if( strmatch(next, "min"   ) ) d->type = e_min;
-    else if( strmatch(next, "eq"    ) ) d->type = e_eq;
-    else if( strmatch(next, "gte"   ) ) d->type = e_gte;
-    else if( strmatch(next, "gt"    ) ) d->type = e_gt;
-    else if( strmatch(next, "lte"   ) ) { AVExpr * tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gt; }
-    else if( strmatch(next, "lt"    ) ) { AVExpr * tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gte; }
-    else if( strmatch(next, "ld"    ) ) d->type = e_ld;
-    else if( strmatch(next, "st"    ) ) d->type = e_st;
-    else if( strmatch(next, "while" ) ) d->type = e_while;
-    else {
-        for(i=0; p->func1_name && p->func1_name[i]; i++){
-            if(strmatch(next, p->func1_name[i])){
-                d->a.func1 = p->func1[i];
-                d->type = e_func1;
-                return d;
-            }
-        }
-
-        for(i=0; p->func2_name && p->func2_name[i]; i++){
-            if(strmatch(next, p->func2_name[i])){
-                d->a.func2 = p->func2[i];
-                d->type = e_func2;
-                return d;
-            }
-        }
-
-        *p->error = "unknown function";
-        ff_free_expr(d);
-        return NULL;
-    }
-
-    return d;
-}
-
-static AVExpr * new_eval_expr(int type, int value, AVExpr *p0, AVExpr *p1){
-    AVExpr * e = av_mallocz(sizeof(AVExpr));
-    if (!e)
-        return NULL;
-    e->type     =type   ;
-    e->value    =value  ;
-    e->param[0] =p0     ;
-    e->param[1] =p1     ;
-    return e;
-}
-
-static AVExpr * parse_pow(Parser *p, int *sign){
-    *sign= (*p->s == '+') - (*p->s == '-');
-    p->s += *sign&1;
-    return parse_primary(p);
-}
-
-static AVExpr * parse_factor(Parser *p){
-    int sign, sign2;
-    AVExpr * e = parse_pow(p, &sign);
-    while(p->s[0]=='^'){
-        p->s++;
-        e= new_eval_expr(e_pow, 1, e, parse_pow(p, &sign2));
-        if (!e)
-            return NULL;
-        if (e->param[1]) e->param[1]->value *= (sign2|1);
-    }
-    if (e) e->value *= (sign|1);
-    return e;
-}
-
-static AVExpr * parse_term(Parser *p){
-    AVExpr * e = parse_factor(p);
-    while(p->s[0]=='*' || p->s[0]=='/'){
-        int c= *p->s++;
-        e= new_eval_expr(c == '*' ? e_mul : e_div, 1, e, parse_factor(p));
-        if (!e)
-            return NULL;
-    }
-    return e;
-}
-
-static AVExpr * parse_subexpr(Parser *p) {
-    AVExpr * e = parse_term(p);
-    while(*p->s == '+' || *p->s == '-') {
-        e= new_eval_expr(e_add, 1, e, parse_term(p));
-        if (!e)
-            return NULL;
-    };
-
-    return e;
-}
-
-static AVExpr * parse_expr(Parser *p) {
-    AVExpr * e;
-
-    if(p->stack_index <= 0) //protect against stack overflows
-        return NULL;
-    p->stack_index--;
-
-    e = parse_subexpr(p);
-
-    while(*p->s == ';') {
-        p->s++;
-        e= new_eval_expr(e_last, 1, e, parse_subexpr(p));
-        if (!e)
-            return NULL;
-    };
-
-    p->stack_index++;
-
-    return e;
-}
-
-static int verify_expr(AVExpr * e) {
-    if (!e) return 0;
-    switch (e->type) {
-        case e_value:
-        case e_const: return 1;
-        case e_func0:
-        case e_func1:
-        case e_squish:
-        case e_ld:
-        case e_gauss: return verify_expr(e->param[0]);
-        default: return verify_expr(e->param[0]) && verify_expr(e->param[1]);
-    }
-}
-
-AVExpr *ff_parse_expr(const char *s, const char * const *const_name,
-               double (* const *func1)(void *, double), const char * const *func1_name,
-               double (* const *func2)(void *, double, double), const char * const *func2_name,
-               const char **error){
-    Parser p;
-    AVExpr *e = NULL;
-    char *w = av_malloc(strlen(s) + 1);
-    char *wp = w;
-
-    if (!w)
-        goto end;
-
-    while (*s)
-        if (!isspace(*s++)) *wp++ = s[-1];
-    *wp++ = 0;
-
-    p.stack_index=100;
-    p.s= w;
-    p.const_name = const_name;
-    p.func1      = func1;
-    p.func1_name = func1_name;
-    p.func2      = func2;
-    p.func2_name = func2_name;
-    p.error= error;
-
-    e = parse_expr(&p);
-    if (!verify_expr(e)) {
-        ff_free_expr(e);
-        e = NULL;
-    }
-end:
-    av_free(w);
-    return e;
-}
-
-double ff_eval_expr(AVExpr * e, const double *const_value, void *opaque) {
-    Parser p;
-
-    p.const_value= const_value;
-    p.opaque     = opaque;
-    return eval_expr(&p, e);
-}
-
-double ff_parse_and_eval_expr(const char *s, const double *const_value, const char * const *const_name,
-               double (* const *func1)(void *, double), const char * const *func1_name,
-               double (* const *func2)(void *, double, double), const char * const *func2_name,
-               void *opaque, const char **error){
-    AVExpr * e = ff_parse_expr(s, const_name, func1, func1_name, func2, func2_name, error);
-    double d;
-    if (!e) return NAN;
-    d = ff_eval_expr(e, const_value, opaque);
-    ff_free_expr(e);
-    return d;
-}
-
-#ifdef TEST
-#undef printf
-static double const_values[]={
-    M_PI,
-    M_E,
-    0
-};
-static const char *const_names[]={
-    "PI",
-    "E",
-    0
-};
-int main(void){
-    int i;
-    printf("%f == 12.7\n", ff_parse_and_eval_expr("1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL));
-    printf("%f == 0.931322575\n", ff_parse_and_eval_expr("80G/80Gi", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL));
-
-    for(i=0; i<1050; i++){
-        START_TIMER
-            ff_parse_and_eval_expr("1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL);
-        STOP_TIMER("ff_parse_and_eval_expr")
-    }
-    return 0;
-}
-#endif
diff --git a/libavcodec/eval.h b/libavcodec/eval.h
deleted file mode 100644
index 50c16af..0000000
--- a/libavcodec/eval.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2002 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * simple arithmetic expression evaluator
- */
-
-#ifndef AVCODEC_EVAL_H
-#define AVCODEC_EVAL_H
-
-typedef struct AVExpr AVExpr;
-
-/**
- * Parses and evaluates an expression.
- * Note, this is significantly slower than ff_eval_expr().
- *
- * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
- * @param func1 NULL terminated array of function pointers for functions which take 1 argument
- * @param func2 NULL terminated array of function pointers for functions which take 2 arguments
- * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
- * @param func1_name NULL terminated array of zero terminated strings of func1 identifers
- * @param func2_name NULL terminated array of zero terminated strings of func2 identifers
- * @param error pointer to a char* which is set to an error message if something goes wrong
- * @param const_value a zero terminated array of values for the identifers from const_name
- * @param opaque a pointer which will be passed to all functions from func1 and func2
- * @return the value of the expression
- */
-double ff_parse_and_eval_expr(const char *s, const double *const_value, const char * const *const_name,
-               double (* const *func1)(void *, double), const char * const *func1_name,
-               double (* const *func2)(void *, double, double), const char * const *func2_name,
-               void *opaque, const char **error);
-
-/**
- * Parses an expression.
- *
- * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
- * @param func1 NULL terminated array of function pointers for functions which take 1 argument
- * @param func2 NULL terminated array of function pointers for functions which take 2 arguments
- * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
- * @param func1_name NULL terminated array of zero terminated strings of func1 identifers
- * @param func2_name NULL terminated array of zero terminated strings of func2 identifers
- * @param error pointer to a char* which is set to an error message if something goes wrong
- * @return AVExpr which must be freed with ff_free_expr() by the user when it is not needed anymore
- *         NULL if anything went wrong
- */
-AVExpr *ff_parse_expr(const char *s, const char * const *const_name,
-               double (* const *func1)(void *, double), const char * const *func1_name,
-               double (* const *func2)(void *, double, double), const char * const *func2_name,
-               const char **error);
-
-/**
- * Evaluates a previously parsed expression.
- *
- * @param const_value a zero terminated array of values for the identifers from ff_parse const_name
- * @param opaque a pointer which will be passed to all functions from func1 and func2
- * @return the value of the expression
- */
-double ff_eval_expr(AVExpr * e, const double *const_value, void *opaque);
-
-/**
- * Frees a parsed expression previously created with ff_parse().
- */
-void ff_free_expr(AVExpr *e);
-
-/**
- * Parses the string in numstr and returns its value as a double. If
- * the string is empty, contains only whitespaces, or does not contain
- * an initial substring that has the expected syntax for a
- * floating-point number, no conversion is performed. In this case,
- * returns a value of zero and the value returned in tail is the value
- * of numstr.
- *
- * @param numstr a string representing a number, may contain one of
- * the International System number postfixes, for example 'K', 'M',
- * 'G'. If 'i' is appended after the postfix, powers of 2 are used
- * instead of powers of 10. The 'B' postfix multiplies the value for
- * 8, and can be appended after another postfix or used alone. This
- * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix.
- * @param tail if non-NULL puts here the pointer to the char next
- * after the last parsed character
- */
-double av_strtod(const char *numstr, char **tail);
-
-#endif /* AVCODEC_EVAL_H */
diff --git a/libavcodec/faandct.c b/libavcodec/faandct.c
deleted file mode 100644
index a986f65..0000000
--- a/libavcodec/faandct.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Floating point AAN DCT
- * this implementation is based upon the IJG integer AAN DCT (see jfdctfst.c)
- *
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2003 Roman Shaposhnik
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/**
- * @file
- * @brief
- *     Floating point AAN DCT
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "dsputil.h"
-#include "faandct.h"
-
-#define FLOAT float
-#ifdef FAAN_POSTSCALE
-#    define SCALE(x) postscale[x]
-#else
-#    define SCALE(x) 1
-#endif
-
-//numbers generated by simple c code (not as accurate as they could be)
-/*
-for(i=0; i<8; i++){
-    printf("#define B%d %1.20llf\n", i, (long double)1.0/(cosl(i*acosl(-1.0)/(long double)16.0)*sqrtl(2)));
-}
-*/
-#define B0 1.00000000000000000000
-#define B1 0.72095982200694791383 // (cos(pi*1/16)sqrt(2))^-1
-#define B2 0.76536686473017954350 // (cos(pi*2/16)sqrt(2))^-1
-#define B3 0.85043009476725644878 // (cos(pi*3/16)sqrt(2))^-1
-#define B4 1.00000000000000000000 // (cos(pi*4/16)sqrt(2))^-1
-#define B5 1.27275858057283393842 // (cos(pi*5/16)sqrt(2))^-1
-#define B6 1.84775906502257351242 // (cos(pi*6/16)sqrt(2))^-1
-#define B7 3.62450978541155137218 // (cos(pi*7/16)sqrt(2))^-1
-
-
-#define A1 0.70710678118654752438 // cos(pi*4/16)
-#define A2 0.54119610014619698435 // cos(pi*6/16)sqrt(2)
-#define A5 0.38268343236508977170 // cos(pi*6/16)
-#define A4 1.30656296487637652774 // cos(pi*2/16)sqrt(2)
-
-static const FLOAT postscale[64]={
-B0*B0, B0*B1, B0*B2, B0*B3, B0*B4, B0*B5, B0*B6, B0*B7,
-B1*B0, B1*B1, B1*B2, B1*B3, B1*B4, B1*B5, B1*B6, B1*B7,
-B2*B0, B2*B1, B2*B2, B2*B3, B2*B4, B2*B5, B2*B6, B2*B7,
-B3*B0, B3*B1, B3*B2, B3*B3, B3*B4, B3*B5, B3*B6, B3*B7,
-B4*B0, B4*B1, B4*B2, B4*B3, B4*B4, B4*B5, B4*B6, B4*B7,
-B5*B0, B5*B1, B5*B2, B5*B3, B5*B4, B5*B5, B5*B6, B5*B7,
-B6*B0, B6*B1, B6*B2, B6*B3, B6*B4, B6*B5, B6*B6, B6*B7,
-B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7,
-};
-
-static av_always_inline void row_fdct(FLOAT temp[64], DCTELEM * data)
-{
-    FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-    FLOAT tmp10, tmp11, tmp12, tmp13;
-    FLOAT z2, z4, z11, z13;
-    FLOAT av_unused z5;
-    int i;
-
-    for (i=0; i<8*8; i+=8) {
-        tmp0= data[0 + i] + data[7 + i];
-        tmp7= data[0 + i] - data[7 + i];
-        tmp1= data[1 + i] + data[6 + i];
-        tmp6= data[1 + i] - data[6 + i];
-        tmp2= data[2 + i] + data[5 + i];
-        tmp5= data[2 + i] - data[5 + i];
-        tmp3= data[3 + i] + data[4 + i];
-        tmp4= data[3 + i] - data[4 + i];
-
-        tmp10= tmp0 + tmp3;
-        tmp13= tmp0 - tmp3;
-        tmp11= tmp1 + tmp2;
-        tmp12= tmp1 - tmp2;
-
-        temp[0 + i]= tmp10 + tmp11;
-        temp[4 + i]= tmp10 - tmp11;
-
-        tmp12 += tmp13;
-        tmp12 *= A1;
-        temp[2 + i]= tmp13 + tmp12;
-        temp[6 + i]= tmp13 - tmp12;
-
-        tmp4 += tmp5;
-        tmp5 += tmp6;
-        tmp6 += tmp7;
-
-#if 0
-        z5= (tmp4 - tmp6) * A5;
-        z2= tmp4*A2 + z5;
-        z4= tmp6*A4 + z5;
-#else
-        z2= tmp4*(A2+A5) - tmp6*A5;
-        z4= tmp6*(A4-A5) + tmp4*A5;
-#endif
-        tmp5*=A1;
-
-        z11= tmp7 + tmp5;
-        z13= tmp7 - tmp5;
-
-        temp[5 + i]= z13 + z2;
-        temp[3 + i]= z13 - z2;
-        temp[1 + i]= z11 + z4;
-        temp[7 + i]= z11 - z4;
-    }
-}
-
-void ff_faandct(DCTELEM * data)
-{
-    FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-    FLOAT tmp10, tmp11, tmp12, tmp13;
-    FLOAT z2, z4, z11, z13;
-    FLOAT av_unused z5;
-    FLOAT temp[64];
-    int i;
-
-    emms_c();
-
-    row_fdct(temp, data);
-
-    for (i=0; i<8; i++) {
-        tmp0= temp[8*0 + i] + temp[8*7 + i];
-        tmp7= temp[8*0 + i] - temp[8*7 + i];
-        tmp1= temp[8*1 + i] + temp[8*6 + i];
-        tmp6= temp[8*1 + i] - temp[8*6 + i];
-        tmp2= temp[8*2 + i] + temp[8*5 + i];
-        tmp5= temp[8*2 + i] - temp[8*5 + i];
-        tmp3= temp[8*3 + i] + temp[8*4 + i];
-        tmp4= temp[8*3 + i] - temp[8*4 + i];
-
-        tmp10= tmp0 + tmp3;
-        tmp13= tmp0 - tmp3;
-        tmp11= tmp1 + tmp2;
-        tmp12= tmp1 - tmp2;
-
-        data[8*0 + i]= lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
-        data[8*4 + i]= lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
-
-        tmp12 += tmp13;
-        tmp12 *= A1;
-        data[8*2 + i]= lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
-        data[8*6 + i]= lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
-
-        tmp4 += tmp5;
-        tmp5 += tmp6;
-        tmp6 += tmp7;
-
-#if 0
-        z5= (tmp4 - tmp6) * A5;
-        z2= tmp4*A2 + z5;
-        z4= tmp6*A4 + z5;
-#else
-        z2= tmp4*(A2+A5) - tmp6*A5;
-        z4= tmp6*(A4-A5) + tmp4*A5;
-#endif
-        tmp5*=A1;
-
-        z11= tmp7 + tmp5;
-        z13= tmp7 - tmp5;
-
-        data[8*5 + i]= lrintf(SCALE(8*5 + i) * (z13 + z2));
-        data[8*3 + i]= lrintf(SCALE(8*3 + i) * (z13 - z2));
-        data[8*1 + i]= lrintf(SCALE(8*1 + i) * (z11 + z4));
-        data[8*7 + i]= lrintf(SCALE(8*7 + i) * (z11 - z4));
-    }
-}
-
-void ff_faandct248(DCTELEM * data)
-{
-    FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-    FLOAT tmp10, tmp11, tmp12, tmp13;
-    FLOAT temp[64];
-    int i;
-
-    emms_c();
-
-    row_fdct(temp, data);
-
-    for (i=0; i<8; i++) {
-        tmp0 = temp[8*0 + i] + temp[8*1 + i];
-        tmp1 = temp[8*2 + i] + temp[8*3 + i];
-        tmp2 = temp[8*4 + i] + temp[8*5 + i];
-        tmp3 = temp[8*6 + i] + temp[8*7 + i];
-        tmp4 = temp[8*0 + i] - temp[8*1 + i];
-        tmp5 = temp[8*2 + i] - temp[8*3 + i];
-        tmp6 = temp[8*4 + i] - temp[8*5 + i];
-        tmp7 = temp[8*6 + i] - temp[8*7 + i];
-
-        tmp10 = tmp0 + tmp3;
-        tmp11 = tmp1 + tmp2;
-        tmp12 = tmp1 - tmp2;
-        tmp13 = tmp0 - tmp3;
-
-        data[8*0 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
-        data[8*4 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
-
-        tmp12 += tmp13;
-        tmp12 *= A1;
-        data[8*2 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
-        data[8*6 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
-
-        tmp10 = tmp4 + tmp7;
-        tmp11 = tmp5 + tmp6;
-        tmp12 = tmp5 - tmp6;
-        tmp13 = tmp4 - tmp7;
-
-        data[8*1 + i] = lrintf(SCALE(8*0 + i) * (tmp10 + tmp11));
-        data[8*5 + i] = lrintf(SCALE(8*4 + i) * (tmp10 - tmp11));
-
-        tmp12 += tmp13;
-        tmp12 *= A1;
-        data[8*3 + i] = lrintf(SCALE(8*2 + i) * (tmp13 + tmp12));
-        data[8*7 + i] = lrintf(SCALE(8*6 + i) * (tmp13 - tmp12));
-    }
-}
diff --git a/libavcodec/faandct.h b/libavcodec/faandct.h
deleted file mode 100644
index f43b62f..0000000
--- a/libavcodec/faandct.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Floating point AAN DCT
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief
- *     Floating point AAN DCT
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_FAANDCT_H
-#define AVCODEC_FAANDCT_H
-
-#include "dsputil.h"
-
-#define FAAN_POSTSCALE
-
-void ff_faandct(DCTELEM * data);
-void ff_faandct248(DCTELEM * data);
-
-#endif /* AVCODEC_FAANDCT_H */
diff --git a/libavcodec/faanidct.c b/libavcodec/faanidct.c
deleted file mode 100644
index dc3d8fb..0000000
--- a/libavcodec/faanidct.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Floating point AAN IDCT
- * Copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "faanidct.h"
-
-/* To allow switching to double. */
-#define FLOAT float
-
-#define B0 1.0000000000000000000000
-#define B1 1.3870398453221474618216 // cos(pi*1/16)sqrt(2)
-#define B2 1.3065629648763765278566 // cos(pi*2/16)sqrt(2)
-#define B3 1.1758756024193587169745 // cos(pi*3/16)sqrt(2)
-#define B4 1.0000000000000000000000 // cos(pi*4/16)sqrt(2)
-#define B5 0.7856949583871021812779 // cos(pi*5/16)sqrt(2)
-#define B6 0.5411961001461969843997 // cos(pi*6/16)sqrt(2)
-#define B7 0.2758993792829430123360 // cos(pi*7/16)sqrt(2)
-
-#define A4 0.70710678118654752438 // cos(pi*4/16)
-#define A2 0.92387953251128675613 // cos(pi*2/16)
-
-static const FLOAT prescale[64]={
-B0*B0/8, B0*B1/8, B0*B2/8, B0*B3/8, B0*B4/8, B0*B5/8, B0*B6/8, B0*B7/8,
-B1*B0/8, B1*B1/8, B1*B2/8, B1*B3/8, B1*B4/8, B1*B5/8, B1*B6/8, B1*B7/8,
-B2*B0/8, B2*B1/8, B2*B2/8, B2*B3/8, B2*B4/8, B2*B5/8, B2*B6/8, B2*B7/8,
-B3*B0/8, B3*B1/8, B3*B2/8, B3*B3/8, B3*B4/8, B3*B5/8, B3*B6/8, B3*B7/8,
-B4*B0/8, B4*B1/8, B4*B2/8, B4*B3/8, B4*B4/8, B4*B5/8, B4*B6/8, B4*B7/8,
-B5*B0/8, B5*B1/8, B5*B2/8, B5*B3/8, B5*B4/8, B5*B5/8, B5*B6/8, B5*B7/8,
-B6*B0/8, B6*B1/8, B6*B2/8, B6*B3/8, B6*B4/8, B6*B5/8, B6*B6/8, B6*B7/8,
-B7*B0/8, B7*B1/8, B7*B2/8, B7*B3/8, B7*B4/8, B7*B5/8, B7*B6/8, B7*B7/8,
-};
-
-static inline void p8idct(DCTELEM data[64], FLOAT temp[64], uint8_t *dest, int stride, int x, int y, int type){
-    int i;
-    FLOAT av_unused tmp0;
-    FLOAT s04, d04, s17, d17, s26, d26, s53, d53;
-    FLOAT os07, os16, os25, os34;
-    FLOAT od07, od16, od25, od34;
-
-    for(i=0; i<y*8; i+=y){
-        s17= temp[1*x + i] + temp[7*x + i];
-        d17= temp[1*x + i] - temp[7*x + i];
-        s53= temp[5*x + i] + temp[3*x + i];
-        d53= temp[5*x + i] - temp[3*x + i];
-
-        od07=  s17 + s53;
-        od25= (s17 - s53)*(2*A4);
-
-#if 0 //these 2 are equivalent
-        tmp0= (d17 + d53)*(2*A2);
-        od34=  d17*( 2*B6) - tmp0;
-        od16=  d53*(-2*B2) + tmp0;
-#else
-        od34=  d17*(2*(B6-A2)) - d53*(2*A2);
-        od16=  d53*(2*(A2-B2)) + d17*(2*A2);
-#endif
-
-        od16 -= od07;
-        od25 -= od16;
-        od34 += od25;
-
-        s26 = temp[2*x + i] + temp[6*x + i];
-        d26 = temp[2*x + i] - temp[6*x + i];
-        d26*= 2*A4;
-        d26-= s26;
-
-        s04= temp[0*x + i] + temp[4*x + i];
-        d04= temp[0*x + i] - temp[4*x + i];
-
-        os07= s04 + s26;
-        os34= s04 - s26;
-        os16= d04 + d26;
-        os25= d04 - d26;
-
-        if(type==0){
-            temp[0*x + i]= os07 + od07;
-            temp[7*x + i]= os07 - od07;
-            temp[1*x + i]= os16 + od16;
-            temp[6*x + i]= os16 - od16;
-            temp[2*x + i]= os25 + od25;
-            temp[5*x + i]= os25 - od25;
-            temp[3*x + i]= os34 - od34;
-            temp[4*x + i]= os34 + od34;
-        }else if(type==1){
-            data[0*x + i]= lrintf(os07 + od07);
-            data[7*x + i]= lrintf(os07 - od07);
-            data[1*x + i]= lrintf(os16 + od16);
-            data[6*x + i]= lrintf(os16 - od16);
-            data[2*x + i]= lrintf(os25 + od25);
-            data[5*x + i]= lrintf(os25 - od25);
-            data[3*x + i]= lrintf(os34 - od34);
-            data[4*x + i]= lrintf(os34 + od34);
-        }else if(type==2){
-            dest[0*stride + i]= av_clip_uint8(((int)dest[0*stride + i]) + lrintf(os07 + od07));
-            dest[7*stride + i]= av_clip_uint8(((int)dest[7*stride + i]) + lrintf(os07 - od07));
-            dest[1*stride + i]= av_clip_uint8(((int)dest[1*stride + i]) + lrintf(os16 + od16));
-            dest[6*stride + i]= av_clip_uint8(((int)dest[6*stride + i]) + lrintf(os16 - od16));
-            dest[2*stride + i]= av_clip_uint8(((int)dest[2*stride + i]) + lrintf(os25 + od25));
-            dest[5*stride + i]= av_clip_uint8(((int)dest[5*stride + i]) + lrintf(os25 - od25));
-            dest[3*stride + i]= av_clip_uint8(((int)dest[3*stride + i]) + lrintf(os34 - od34));
-            dest[4*stride + i]= av_clip_uint8(((int)dest[4*stride + i]) + lrintf(os34 + od34));
-        }else{
-            dest[0*stride + i]= av_clip_uint8(lrintf(os07 + od07));
-            dest[7*stride + i]= av_clip_uint8(lrintf(os07 - od07));
-            dest[1*stride + i]= av_clip_uint8(lrintf(os16 + od16));
-            dest[6*stride + i]= av_clip_uint8(lrintf(os16 - od16));
-            dest[2*stride + i]= av_clip_uint8(lrintf(os25 + od25));
-            dest[5*stride + i]= av_clip_uint8(lrintf(os25 - od25));
-            dest[3*stride + i]= av_clip_uint8(lrintf(os34 - od34));
-            dest[4*stride + i]= av_clip_uint8(lrintf(os34 + od34));
-        }
-    }
-}
-
-void ff_faanidct(DCTELEM block[64]){
-    FLOAT temp[64];
-    int i;
-
-    emms_c();
-
-    for(i=0; i<64; i++)
-        temp[i] = block[i] * prescale[i];
-
-    p8idct(block, temp, NULL, 0, 1, 8, 0);
-    p8idct(block, temp, NULL, 0, 8, 1, 1);
-}
-
-void ff_faanidct_add(uint8_t *dest, int line_size, DCTELEM block[64]){
-    FLOAT temp[64];
-    int i;
-
-    emms_c();
-
-    for(i=0; i<64; i++)
-        temp[i] = block[i] * prescale[i];
-
-    p8idct(block, temp, NULL,         0, 1, 8, 0);
-    p8idct(NULL , temp, dest, line_size, 8, 1, 2);
-}
-
-void ff_faanidct_put(uint8_t *dest, int line_size, DCTELEM block[64]){
-    FLOAT temp[64];
-    int i;
-
-    emms_c();
-
-    for(i=0; i<64; i++)
-        temp[i] = block[i] * prescale[i];
-
-    p8idct(block, temp, NULL,         0, 1, 8, 0);
-    p8idct(NULL , temp, dest, line_size, 8, 1, 3);
-}
diff --git a/libavcodec/faanidct.h b/libavcodec/faanidct.h
deleted file mode 100644
index 4cf1189..0000000
--- a/libavcodec/faanidct.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Floating point AAN IDCT
- * Copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_FAANIDCT_H
-#define AVCODEC_FAANIDCT_H
-
-#include <stdint.h>
-#include "dsputil.h"
-
-void ff_faanidct(DCTELEM block[64]);
-void ff_faanidct_add(uint8_t *dest, int line_size, DCTELEM block[64]);
-void ff_faanidct_put(uint8_t *dest, int line_size, DCTELEM block[64]);
-
-#endif /* AVCODEC_FAANIDCT_H */
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
deleted file mode 100644
index 34aa576..0000000
--- a/libavcodec/faxcompr.c
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * CCITT Fax Group 3 and 4 decompression
- * Copyright (c) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * CCITT Fax Group 3 and 4 decompression
- * @file
- * @author Konstantin Shishkov
- */
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "faxcompr.h"
-
-#define CCITT_SYMS 104
-
-static const uint16_t ccitt_syms[CCITT_SYMS] = {
-    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,   57,   58,   59,   60,   61,   62,   63,   64,
-  128,  192,  256,  320,  384,  448,  512,  576,  640,  704,  768,  832,  896,
-  960, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472, 1536, 1600, 1664, 1728,
- 1792, 1856, 1920, 1984, 2048, 2112, 2176, 2240, 2304, 2368, 2432, 2496, 2560
-};
-
-static const uint8_t ccitt_codes_bits[2][CCITT_SYMS] =
-{
-  {
-    0x35, 0x07, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, 0x13, 0x14, 0x07, 0x08, 0x08,
-    0x03, 0x34, 0x35, 0x2A, 0x2B, 0x27, 0x0C, 0x08, 0x17, 0x03, 0x04, 0x28, 0x2B,
-    0x13, 0x24, 0x18, 0x02, 0x03, 0x1A, 0x1B, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-    0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x04, 0x05, 0x0A, 0x0B, 0x52, 0x53, 0x54,
-    0x55, 0x24, 0x25, 0x58, 0x59, 0x5A, 0x5B, 0x4A, 0x4B, 0x32, 0x33, 0x34, 0x1B,
-    0x12, 0x17, 0x37, 0x36, 0x37, 0x64, 0x65, 0x68, 0x67, 0xCC, 0xCD, 0xD2, 0xD3,
-    0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0x98, 0x99, 0x9A, 0x18, 0x9B,
-    0x08, 0x0C, 0x0D, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F
-  },
-  {
-    0x37, 0x02, 0x03, 0x02, 0x03, 0x03, 0x02, 0x03, 0x05, 0x04, 0x04, 0x05, 0x07,
-    0x04, 0x07, 0x18, 0x17, 0x18, 0x08, 0x67, 0x68, 0x6C, 0x37, 0x28, 0x17, 0x18,
-    0xCA, 0xCB, 0xCC, 0xCD, 0x68, 0x69, 0x6A, 0x6B, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
-    0xD7, 0x6C, 0x6D, 0xDA, 0xDB, 0x54, 0x55, 0x56, 0x57, 0x64, 0x65, 0x52, 0x53,
-    0x24, 0x37, 0x38, 0x27, 0x28, 0x58, 0x59, 0x2B, 0x2C, 0x5A, 0x66, 0x67, 0x0F,
-    0xC8, 0xC9, 0x5B, 0x33, 0x34, 0x35, 0x6C, 0x6D, 0x4A, 0x4B, 0x4C, 0x4D, 0x72,
-    0x73, 0x74, 0x75, 0x76, 0x77, 0x52, 0x53, 0x54, 0x55, 0x5A, 0x5B, 0x64, 0x65,
-    0x08, 0x0C, 0x0D, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F
-  }
-};
-
-static const uint8_t ccitt_codes_lens[2][CCITT_SYMS] =
-{
-  {
-     8,  6,  4,  4,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,  6,  6,  6,  7,  7,
-     7,  7,  7,  7,  7,  7,  7,  7,  7,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
-     8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
-     8,  8,  8,  8,  5,  5,  6,  7,  8,  8,  8,  8,  8,  8,  9,  9,  9,  9,  9,  9,
-     9,  9,  9,  9,  9,  9,  9,  9,  9,  6,  9, 11, 11, 11, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12
-  },
-  {
-    10,  3,  2,  2,  3,  4,  4,  5,  6,  6,  7,  7,  7,  8,  8,  9, 10, 10, 10, 11,
-    11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 10, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-    13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 11, 11, 11, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12
-  }
-};
-
-static const uint8_t ccitt_group3_2d_bits[11] = {
-    1, 1, 2, 2, 2, 1, 3, 3, 3, 1, 1
-};
-
-static const uint8_t ccitt_group3_2d_lens[11] = {
-    4, 3, 7, 6, 3, 1, 3, 6, 7, 7, 9
-};
-
-static VLC ccitt_vlc[2], ccitt_group3_2d_vlc;
-
-av_cold void ff_ccitt_unpack_init(void)
-{
-    static VLC_TYPE code_table1[528][2];
-    static VLC_TYPE code_table2[648][2];
-    int i;
-    static int initialized = 0;
-
-    if(initialized)
-        return;
-    ccitt_vlc[0].table = code_table1;
-    ccitt_vlc[0].table_allocated = 528;
-    ccitt_vlc[1].table = code_table2;
-    ccitt_vlc[1].table_allocated = 648;
-    for(i = 0; i < 2; i++){
-        init_vlc_sparse(&ccitt_vlc[i], 9, CCITT_SYMS,
-                        ccitt_codes_lens[i], 1, 1,
-                        ccitt_codes_bits[i], 1, 1,
-                        ccitt_syms, 2, 2,
-                        INIT_VLC_USE_NEW_STATIC);
-    }
-    INIT_VLC_STATIC(&ccitt_group3_2d_vlc, 9, 11,
-                    ccitt_group3_2d_lens, 1, 1,
-                    ccitt_group3_2d_bits, 1, 1, 512);
-    initialized = 1;
-}
-
-
-static int decode_group3_1d_line(AVCodecContext *avctx, GetBitContext *gb,
-                                 unsigned int pix_left, int *runs, const int *runend)
-{
-    int mode = 0;
-    unsigned int run=0;
-    unsigned int t;
-    for(;;){
-        t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2);
-        run += t;
-        if(t < 64){
-            *runs++ = run;
-            if(runs >= runend){
-                av_log(avctx, AV_LOG_ERROR, "Run overrun\n");
-                return -1;
-            }
-            if(pix_left <= run){
-                if(pix_left == run)
-                    break;
-                av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n");
-                return -1;
-            }
-            pix_left -= run;
-            run = 0;
-            mode = !mode;
-        }else if((int)t == -1){
-            av_log(avctx, AV_LOG_ERROR, "Incorrect code\n");
-            return -1;
-        }
-    }
-    *runs++ = 0;
-    return 0;
-}
-
-static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb,
-                                 unsigned int width, int *runs, const int *runend, const int *ref)
-{
-    int mode = 0, saved_run = 0, t;
-    int run_off = *ref++;
-    unsigned int offs=0, run= 0;
-
-    runend--; // for the last written 0
-
-    while(offs < width){
-        int cmode = get_vlc2(gb, ccitt_group3_2d_vlc.table, 9, 1);
-        if(cmode == -1){
-            av_log(avctx, AV_LOG_ERROR, "Incorrect mode VLC\n");
-            return -1;
-        }
-        if(!cmode){//pass mode
-            run_off += *ref++;
-            run = run_off - offs;
-            offs= run_off;
-            run_off += *ref++;
-            if(offs > width){
-                av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n");
-                return -1;
-            }
-            saved_run += run;
-        }else if(cmode == 1){//horizontal mode
-            int k;
-            for(k = 0; k < 2; k++){
-                run = 0;
-                for(;;){
-                    t = get_vlc2(gb, ccitt_vlc[mode].table, 9, 2);
-                    if(t == -1){
-                        av_log(avctx, AV_LOG_ERROR, "Incorrect code\n");
-                        return -1;
-                    }
-                    run += t;
-                    if(t < 64)
-                        break;
-                }
-                *runs++ = run + saved_run;
-                if(runs >= runend){
-                    av_log(avctx, AV_LOG_ERROR, "Run overrun\n");
-                    return -1;
-                }
-                saved_run = 0;
-                offs += run;
-                if(offs > width || run > width){
-                    av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n");
-                    return -1;
-                }
-                mode = !mode;
-            }
-        }else if(cmode == 9 || cmode == 10){
-            av_log(avctx, AV_LOG_ERROR, "Special modes are not supported (yet)\n");
-            return -1;
-        }else{//vertical mode
-            run = run_off - offs + (cmode - 5);
-            run_off -= *--ref;
-            offs += run;
-            if(offs > width || run > width){
-                av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n");
-                return -1;
-            }
-            *runs++ = run + saved_run;
-            if(runs >= runend){
-                av_log(avctx, AV_LOG_ERROR, "Run overrun\n");
-                return -1;
-            }
-            saved_run = 0;
-            mode = !mode;
-        }
-        //sync line pointers
-        while(run_off <= offs){
-            run_off += *ref++;
-            run_off += *ref++;
-        }
-    }
-    *runs++ = saved_run;
-    *runs++ = 0;
-    return 0;
-}
-
-static void put_line(uint8_t *dst, int size, int width, const int *runs)
-{
-    PutBitContext pb;
-    int run, mode = ~0, pix_left = width, run_idx = 0;
-
-    init_put_bits(&pb, dst, size*8);
-    while(pix_left > 0){
-        run = runs[run_idx++];
-        mode = ~mode;
-        pix_left -= run;
-        for(; run > 16; run -= 16)
-            put_sbits(&pb, 16, mode);
-        if(run)
-            put_sbits(&pb, run, mode);
-    }
-    flush_put_bits(&pb);
-}
-
-static int find_group3_syncmarker(GetBitContext *gb, int srcsize)
-{
-    unsigned int state = -1;
-    srcsize -= get_bits_count(gb);
-    while(srcsize-- > 0){
-        state+= state + get_bits1(gb);
-        if((state & 0xFFF) == 1)
-            return 0;
-    }
-    return -1;
-}
-
-int ff_ccitt_unpack(AVCodecContext *avctx,
-                    const uint8_t *src, int srcsize,
-                    uint8_t *dst, int height, int stride,
-                    enum TiffCompr compr, int opts)
-{
-    int j;
-    GetBitContext gb;
-    int *runs, *ref, *runend;
-    int ret;
-    int runsize= avctx->width + 2;
-
-    runs = av_malloc(runsize * sizeof(runs[0]));
-    ref  = av_malloc(runsize * sizeof(ref[0]));
-    ref[0] = avctx->width;
-    ref[1] = 0;
-    ref[2] = 0;
-    init_get_bits(&gb, src, srcsize*8);
-    for(j = 0; j < height; j++){
-        runend = runs + runsize;
-        if(compr == TIFF_G4){
-            ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref);
-            if(ret < 0){
-                av_free(runs);
-                av_free(ref);
-                return -1;
-            }
-        }else{
-            int g3d1 = (compr == TIFF_G3) && !(opts & 1);
-            if(compr!=TIFF_CCITT_RLE && find_group3_syncmarker(&gb, srcsize*8) < 0)
-                break;
-            if(compr==TIFF_CCITT_RLE || g3d1 || get_bits1(&gb))
-                ret = decode_group3_1d_line(avctx, &gb, avctx->width, runs, runend);
-            else
-                ret = decode_group3_2d_line(avctx, &gb, avctx->width, runs, runend, ref);
-            if(compr==TIFF_CCITT_RLE)
-                align_get_bits(&gb);
-        }
-        if(ret < 0){
-            put_line(dst, stride, avctx->width, ref);
-        }else{
-            put_line(dst, stride, avctx->width, runs);
-            FFSWAP(int*, runs, ref);
-        }
-        dst += stride;
-    }
-    av_free(runs);
-    av_free(ref);
-    return 0;
-}
diff --git a/libavcodec/faxcompr.h b/libavcodec/faxcompr.h
deleted file mode 100644
index 62f591c..0000000
--- a/libavcodec/faxcompr.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * CCITT Fax Group 3 and 4 decompression
- * Copyright (c) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * CCITT Fax Group 3 and 4 decompression
- * @file
- * @author Konstantin Shishkov
- */
-#ifndef AVCODEC_FAXCOMPR_H
-#define AVCODEC_FAXCOMPR_H
-
-#include "avcodec.h"
-#include "tiff.h"
-
-/**
- * initialize upacker code
- */
-void ff_ccitt_unpack_init(void);
-
-/**
- * unpack data compressed with CCITT Group 3 1/2-D or Group 4 method
- */
-int ff_ccitt_unpack(AVCodecContext *avctx,
-                    const uint8_t *src, int srcsize,
-                    uint8_t *dst, int height, int stride,
-                    enum TiffCompr compr, int opts);
-
-#endif /* AVCODEC_FAXCOMPR_H */
diff --git a/libavcodec/fft-test.c b/libavcodec/fft-test.c
deleted file mode 100644
index ae43602..0000000
--- a/libavcodec/fft-test.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * FFT and MDCT tests.
- */
-
-#include "libavutil/mathematics.h"
-#include "libavutil/lfg.h"
-#include "libavutil/log.h"
-#include "fft.h"
-#include <math.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <string.h>
-
-#undef exit
-
-/* reference fft */
-
-#define MUL16(a,b) ((a) * (b))
-
-#define CMAC(pre, pim, are, aim, bre, bim) \
-{\
-   pre += (MUL16(are, bre) - MUL16(aim, bim));\
-   pim += (MUL16(are, bim) + MUL16(bre, aim));\
-}
-
-FFTComplex *exptab;
-
-static void fft_ref_init(int nbits, int inverse)
-{
-    int n, i;
-    double c1, s1, alpha;
-
-    n = 1 << nbits;
-    exptab = av_malloc((n / 2) * sizeof(FFTComplex));
-
-    for (i = 0; i < (n/2); i++) {
-        alpha = 2 * M_PI * (float)i / (float)n;
-        c1 = cos(alpha);
-        s1 = sin(alpha);
-        if (!inverse)
-            s1 = -s1;
-        exptab[i].re = c1;
-        exptab[i].im = s1;
-    }
-}
-
-static void fft_ref(FFTComplex *tabr, FFTComplex *tab, int nbits)
-{
-    int n, i, j, k, n2;
-    double tmp_re, tmp_im, s, c;
-    FFTComplex *q;
-
-    n = 1 << nbits;
-    n2 = n >> 1;
-    for (i = 0; i < n; i++) {
-        tmp_re = 0;
-        tmp_im = 0;
-        q = tab;
-        for (j = 0; j < n; j++) {
-            k = (i * j) & (n - 1);
-            if (k >= n2) {
-                c = -exptab[k - n2].re;
-                s = -exptab[k - n2].im;
-            } else {
-                c = exptab[k].re;
-                s = exptab[k].im;
-            }
-            CMAC(tmp_re, tmp_im, c, s, q->re, q->im);
-            q++;
-        }
-        tabr[i].re = tmp_re;
-        tabr[i].im = tmp_im;
-    }
-}
-
-static void imdct_ref(float *out, float *in, int nbits)
-{
-    int n = 1<<nbits;
-    int k, i, a;
-    double sum, f;
-
-    for (i = 0; i < n; i++) {
-        sum = 0;
-        for (k = 0; k < n/2; k++) {
-            a = (2 * i + 1 + (n / 2)) * (2 * k + 1);
-            f = cos(M_PI * a / (double)(2 * n));
-            sum += f * in[k];
-        }
-        out[i] = -sum;
-    }
-}
-
-/* NOTE: no normalisation by 1 / N is done */
-static void mdct_ref(float *output, float *input, int nbits)
-{
-    int n = 1<<nbits;
-    int k, i;
-    double a, s;
-
-    /* do it by hand */
-    for (k = 0; k < n/2; k++) {
-        s = 0;
-        for (i = 0; i < n; i++) {
-            a = (2*M_PI*(2*i+1+n/2)*(2*k+1) / (4 * n));
-            s += input[i] * cos(a);
-        }
-        output[k] = s;
-    }
-}
-
-static void idct_ref(float *output, float *input, int nbits)
-{
-    int n = 1<<nbits;
-    int k, i;
-    double a, s;
-
-    /* do it by hand */
-    for (i = 0; i < n; i++) {
-        s = 0.5 * input[0];
-        for (k = 1; k < n; k++) {
-            a = M_PI*k*(i+0.5) / n;
-            s += input[k] * cos(a);
-        }
-        output[i] = 2 * s / n;
-    }
-}
-static void dct_ref(float *output, float *input, int nbits)
-{
-    int n = 1<<nbits;
-    int k, i;
-    double a, s;
-
-    /* do it by hand */
-    for (k = 0; k < n; k++) {
-        s = 0;
-        for (i = 0; i < n; i++) {
-            a = M_PI*k*(i+0.5) / n;
-            s += input[i] * cos(a);
-        }
-        output[k] = s;
-    }
-}
-
-
-static float frandom(AVLFG *prng)
-{
-    return (int16_t)av_lfg_get(prng) / 32768.0;
-}
-
-static int64_t gettime(void)
-{
-    struct timeval tv;
-    gettimeofday(&tv,NULL);
-    return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-static void check_diff(float *tab1, float *tab2, int n, double scale)
-{
-    int i;
-    double max= 0;
-    double error= 0;
-
-    for (i = 0; i < n; i++) {
-        double e= fabsf(tab1[i] - (tab2[i] / scale));
-        if (e >= 1e-3) {
-            av_log(NULL, AV_LOG_ERROR, "ERROR %d: %f %f\n",
-                   i, tab1[i], tab2[i]);
-        }
-        error+= e*e;
-        if(e>max) max= e;
-    }
-    av_log(NULL, AV_LOG_INFO, "max:%f e:%g\n", max, sqrt(error)/n);
-}
-
-
-static void help(void)
-{
-    av_log(NULL, AV_LOG_INFO,"usage: fft-test [-h] [-s] [-i] [-n b]\n"
-           "-h     print this help\n"
-           "-s     speed test\n"
-           "-m     (I)MDCT test\n"
-           "-d     (I)DCT test\n"
-           "-r     (I)RDFT test\n"
-           "-i     inverse transform test\n"
-           "-n b   set the transform size to 2^b\n"
-           "-f x   set scale factor for output data of (I)MDCT to x\n"
-           );
-    exit(1);
-}
-
-enum tf_transform {
-    TRANSFORM_FFT,
-    TRANSFORM_MDCT,
-    TRANSFORM_RDFT,
-    TRANSFORM_DCT,
-};
-
-int main(int argc, char **argv)
-{
-    FFTComplex *tab, *tab1, *tab_ref;
-    FFTSample *tab2;
-    int it, i, c;
-    int do_speed = 0;
-    enum tf_transform transform = TRANSFORM_FFT;
-    int do_inverse = 0;
-    FFTContext s1, *s = &s1;
-    FFTContext m1, *m = &m1;
-    RDFTContext r1, *r = &r1;
-    DCTContext d1, *d = &d1;
-    int fft_nbits, fft_size, fft_size_2;
-    double scale = 1.0;
-    AVLFG prng;
-    av_lfg_init(&prng, 1);
-
-    fft_nbits = 9;
-    for(;;) {
-        c = getopt(argc, argv, "hsimrdn:f:");
-        if (c == -1)
-            break;
-        switch(c) {
-        case 'h':
-            help();
-            break;
-        case 's':
-            do_speed = 1;
-            break;
-        case 'i':
-            do_inverse = 1;
-            break;
-        case 'm':
-            transform = TRANSFORM_MDCT;
-            break;
-        case 'r':
-            transform = TRANSFORM_RDFT;
-            break;
-        case 'd':
-            transform = TRANSFORM_DCT;
-            break;
-        case 'n':
-            fft_nbits = atoi(optarg);
-            break;
-        case 'f':
-            scale = atof(optarg);
-            break;
-        }
-    }
-
-    fft_size = 1 << fft_nbits;
-    fft_size_2 = fft_size >> 1;
-    tab = av_malloc(fft_size * sizeof(FFTComplex));
-    tab1 = av_malloc(fft_size * sizeof(FFTComplex));
-    tab_ref = av_malloc(fft_size * sizeof(FFTComplex));
-    tab2 = av_malloc(fft_size * sizeof(FFTSample));
-
-    switch (transform) {
-    case TRANSFORM_MDCT:
-        av_log(NULL, AV_LOG_INFO,"Scale factor is set to %f\n", scale);
-        if (do_inverse)
-            av_log(NULL, AV_LOG_INFO,"IMDCT");
-        else
-            av_log(NULL, AV_LOG_INFO,"MDCT");
-        ff_mdct_init(m, fft_nbits, do_inverse, scale);
-        break;
-    case TRANSFORM_FFT:
-        if (do_inverse)
-            av_log(NULL, AV_LOG_INFO,"IFFT");
-        else
-            av_log(NULL, AV_LOG_INFO,"FFT");
-        ff_fft_init(s, fft_nbits, do_inverse);
-        fft_ref_init(fft_nbits, do_inverse);
-        break;
-    case TRANSFORM_RDFT:
-        if (do_inverse)
-            av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
-        else
-            av_log(NULL, AV_LOG_INFO,"DFT_R2C");
-        ff_rdft_init(r, fft_nbits, do_inverse ? IDFT_C2R : DFT_R2C);
-        fft_ref_init(fft_nbits, do_inverse);
-        break;
-    case TRANSFORM_DCT:
-        if (do_inverse)
-            av_log(NULL, AV_LOG_INFO,"DCT_III");
-        else
-            av_log(NULL, AV_LOG_INFO,"DCT_II");
-        ff_dct_init(d, fft_nbits, do_inverse ? DCT_III : DCT_II);
-        break;
-    }
-    av_log(NULL, AV_LOG_INFO," %d test\n", fft_size);
-
-    /* generate random data */
-
-    for (i = 0; i < fft_size; i++) {
-        tab1[i].re = frandom(&prng);
-        tab1[i].im = frandom(&prng);
-    }
-
-    /* checking result */
-    av_log(NULL, AV_LOG_INFO,"Checking...\n");
-
-    switch (transform) {
-    case TRANSFORM_MDCT:
-        if (do_inverse) {
-            imdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
-            ff_imdct_calc(m, tab2, (float *)tab1);
-            check_diff((float *)tab_ref, tab2, fft_size, scale);
-        } else {
-            mdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
-
-            ff_mdct_calc(m, tab2, (float *)tab1);
-
-            check_diff((float *)tab_ref, tab2, fft_size / 2, scale);
-        }
-        break;
-    case TRANSFORM_FFT:
-        memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
-        ff_fft_permute(s, tab);
-        ff_fft_calc(s, tab);
-
-        fft_ref(tab_ref, tab1, fft_nbits);
-        check_diff((float *)tab_ref, (float *)tab, fft_size * 2, 1.0);
-        break;
-    case TRANSFORM_RDFT:
-        if (do_inverse) {
-            tab1[         0].im = 0;
-            tab1[fft_size_2].im = 0;
-            for (i = 1; i < fft_size_2; i++) {
-                tab1[fft_size_2+i].re =  tab1[fft_size_2-i].re;
-                tab1[fft_size_2+i].im = -tab1[fft_size_2-i].im;
-            }
-
-            memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
-            tab2[1] = tab1[fft_size_2].re;
-
-            ff_rdft_calc(r, tab2);
-            fft_ref(tab_ref, tab1, fft_nbits);
-            for (i = 0; i < fft_size; i++) {
-                tab[i].re = tab2[i];
-                tab[i].im = 0;
-            }
-            check_diff((float *)tab_ref, (float *)tab, fft_size * 2, 0.5);
-        } else {
-            for (i = 0; i < fft_size; i++) {
-                tab2[i]    = tab1[i].re;
-                tab1[i].im = 0;
-            }
-            ff_rdft_calc(r, tab2);
-            fft_ref(tab_ref, tab1, fft_nbits);
-            tab_ref[0].im = tab_ref[fft_size_2].re;
-            check_diff((float *)tab_ref, (float *)tab2, fft_size, 1.0);
-        }
-        break;
-    case TRANSFORM_DCT:
-        memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
-        ff_dct_calc(d, tab);
-        if (do_inverse) {
-            idct_ref(tab_ref, tab1, fft_nbits);
-        } else {
-            dct_ref(tab_ref, tab1, fft_nbits);
-        }
-        check_diff((float *)tab_ref, (float *)tab, fft_size, 1.0);
-        break;
-    }
-
-    /* do a speed test */
-
-    if (do_speed) {
-        int64_t time_start, duration;
-        int nb_its;
-
-        av_log(NULL, AV_LOG_INFO,"Speed test...\n");
-        /* we measure during about 1 seconds */
-        nb_its = 1;
-        for(;;) {
-            time_start = gettime();
-            for (it = 0; it < nb_its; it++) {
-                switch (transform) {
-                case TRANSFORM_MDCT:
-                    if (do_inverse) {
-                        ff_imdct_calc(m, (float *)tab, (float *)tab1);
-                    } else {
-                        ff_mdct_calc(m, (float *)tab, (float *)tab1);
-                    }
-                    break;
-                case TRANSFORM_FFT:
-                    memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
-                    ff_fft_calc(s, tab);
-                    break;
-                case TRANSFORM_RDFT:
-                    memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
-                    ff_rdft_calc(r, tab2);
-                    break;
-                case TRANSFORM_DCT:
-                    memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
-                    ff_dct_calc(d, tab2);
-                    break;
-                }
-            }
-            duration = gettime() - time_start;
-            if (duration >= 1000000)
-                break;
-            nb_its *= 2;
-        }
-        av_log(NULL, AV_LOG_INFO,"time: %0.1f us/transform [total time=%0.2f s its=%d]\n",
-               (double)duration / nb_its,
-               (double)duration / 1000000.0,
-               nb_its);
-    }
-
-    switch (transform) {
-    case TRANSFORM_MDCT:
-        ff_mdct_end(m);
-        break;
-    case TRANSFORM_FFT:
-        ff_fft_end(s);
-        break;
-    case TRANSFORM_RDFT:
-        ff_rdft_end(r);
-        break;
-    case TRANSFORM_DCT:
-        ff_dct_end(d);
-        break;
-    }
-    return 0;
-}
diff --git a/libavcodec/fft.c b/libavcodec/fft.c
deleted file mode 100644
index bf240bf..0000000
--- a/libavcodec/fft.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * FFT/IFFT transforms
- * Copyright (c) 2008 Loren Merritt
- * Copyright (c) 2002 Fabrice Bellard
- * Partly based on libdjbfft by D. J. Bernstein
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * FFT/IFFT transforms.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "libavutil/mathematics.h"
-#include "fft.h"
-
-/* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */
-#if !CONFIG_HARDCODED_TABLES
-COSTABLE(16);
-COSTABLE(32);
-COSTABLE(64);
-COSTABLE(128);
-COSTABLE(256);
-COSTABLE(512);
-COSTABLE(1024);
-COSTABLE(2048);
-COSTABLE(4096);
-COSTABLE(8192);
-COSTABLE(16384);
-COSTABLE(32768);
-COSTABLE(65536);
-#endif
-COSTABLE_CONST FFTSample * const ff_cos_tabs[] = {
-    NULL, NULL, NULL, NULL,
-    ff_cos_16, ff_cos_32, ff_cos_64, ff_cos_128, ff_cos_256, ff_cos_512, ff_cos_1024,
-    ff_cos_2048, ff_cos_4096, ff_cos_8192, ff_cos_16384, ff_cos_32768, ff_cos_65536,
-};
-
-static int split_radix_permutation(int i, int n, int inverse)
-{
-    int m;
-    if(n <= 2) return i&1;
-    m = n >> 1;
-    if(!(i&m))            return split_radix_permutation(i, m, inverse)*2;
-    m >>= 1;
-    if(inverse == !(i&m)) return split_radix_permutation(i, m, inverse)*4 + 1;
-    else                  return split_radix_permutation(i, m, inverse)*4 - 1;
-}
-
-av_cold void ff_init_ff_cos_tabs(int index)
-{
-#if !CONFIG_HARDCODED_TABLES
-    int i;
-    int m = 1<<index;
-    double freq = 2*M_PI/m;
-    FFTSample *tab = ff_cos_tabs[index];
-    for(i=0; i<=m/4; i++)
-        tab[i] = cos(i*freq);
-    for(i=1; i<m/4; i++)
-        tab[m/2-i] = tab[i];
-#endif
-}
-
-av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
-{
-    int i, j, m, n;
-    float alpha, c1, s1, s2;
-    int av_unused has_vectors;
-
-    if (nbits < 2 || nbits > 16)
-        goto fail;
-    s->nbits = nbits;
-    n = 1 << nbits;
-
-    s->tmp_buf = NULL;
-    s->exptab  = av_malloc((n / 2) * sizeof(FFTComplex));
-    if (!s->exptab)
-        goto fail;
-    s->revtab = av_malloc(n * sizeof(uint16_t));
-    if (!s->revtab)
-        goto fail;
-    s->inverse = inverse;
-
-    s2 = inverse ? 1.0 : -1.0;
-
-    s->fft_permute = ff_fft_permute_c;
-    s->fft_calc    = ff_fft_calc_c;
-#if CONFIG_MDCT
-    s->imdct_calc  = ff_imdct_calc_c;
-    s->imdct_half  = ff_imdct_half_c;
-    s->mdct_calc   = ff_mdct_calc_c;
-#endif
-    s->exptab1     = NULL;
-    s->split_radix = 1;
-
-    if (ARCH_ARM)     ff_fft_init_arm(s);
-    if (HAVE_ALTIVEC) ff_fft_init_altivec(s);
-    if (HAVE_MMX)     ff_fft_init_mmx(s);
-
-    if (s->split_radix) {
-        for(j=4; j<=nbits; j++) {
-            ff_init_ff_cos_tabs(j);
-        }
-        for(i=0; i<n; i++)
-            s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = i;
-        s->tmp_buf = av_malloc(n * sizeof(FFTComplex));
-    } else {
-        int np, nblocks, np2, l;
-        FFTComplex *q;
-
-        for(i=0; i<(n/2); i++) {
-            alpha = 2 * M_PI * (float)i / (float)n;
-            c1 = cos(alpha);
-            s1 = sin(alpha) * s2;
-            s->exptab[i].re = c1;
-            s->exptab[i].im = s1;
-        }
-
-        np = 1 << nbits;
-        nblocks = np >> 3;
-        np2 = np >> 1;
-        s->exptab1 = av_malloc(np * 2 * sizeof(FFTComplex));
-        if (!s->exptab1)
-            goto fail;
-        q = s->exptab1;
-        do {
-            for(l = 0; l < np2; l += 2 * nblocks) {
-                *q++ = s->exptab[l];
-                *q++ = s->exptab[l + nblocks];
-
-                q->re = -s->exptab[l].im;
-                q->im = s->exptab[l].re;
-                q++;
-                q->re = -s->exptab[l + nblocks].im;
-                q->im = s->exptab[l + nblocks].re;
-                q++;
-            }
-            nblocks = nblocks >> 1;
-        } while (nblocks != 0);
-        av_freep(&s->exptab);
-
-        /* compute bit reverse table */
-        for(i=0;i<n;i++) {
-            m=0;
-            for(j=0;j<nbits;j++) {
-                m |= ((i >> j) & 1) << (nbits-j-1);
-            }
-            s->revtab[i]=m;
-        }
-    }
-
-    return 0;
- fail:
-    av_freep(&s->revtab);
-    av_freep(&s->exptab);
-    av_freep(&s->exptab1);
-    av_freep(&s->tmp_buf);
-    return -1;
-}
-
-void ff_fft_permute_c(FFTContext *s, FFTComplex *z)
-{
-    int j, k, np;
-    FFTComplex tmp;
-    const uint16_t *revtab = s->revtab;
-    np = 1 << s->nbits;
-
-    if (s->tmp_buf) {
-        /* TODO: handle split-radix permute in a more optimal way, probably in-place */
-        for(j=0;j<np;j++) s->tmp_buf[revtab[j]] = z[j];
-        memcpy(z, s->tmp_buf, np * sizeof(FFTComplex));
-        return;
-    }
-
-    /* reverse */
-    for(j=0;j<np;j++) {
-        k = revtab[j];
-        if (k < j) {
-            tmp = z[k];
-            z[k] = z[j];
-            z[j] = tmp;
-        }
-    }
-}
-
-av_cold void ff_fft_end(FFTContext *s)
-{
-    av_freep(&s->revtab);
-    av_freep(&s->exptab);
-    av_freep(&s->exptab1);
-    av_freep(&s->tmp_buf);
-}
-
-#define sqrthalf (float)M_SQRT1_2
-
-#define BF(x,y,a,b) {\
-    x = a - b;\
-    y = a + b;\
-}
-
-#define BUTTERFLIES(a0,a1,a2,a3) {\
-    BF(t3, t5, t5, t1);\
-    BF(a2.re, a0.re, a0.re, t5);\
-    BF(a3.im, a1.im, a1.im, t3);\
-    BF(t4, t6, t2, t6);\
-    BF(a3.re, a1.re, a1.re, t4);\
-    BF(a2.im, a0.im, a0.im, t6);\
-}
-
-// force loading all the inputs before storing any.
-// this is slightly slower for small data, but avoids store->load aliasing
-// for addresses separated by large powers of 2.
-#define BUTTERFLIES_BIG(a0,a1,a2,a3) {\
-    FFTSample r0=a0.re, i0=a0.im, r1=a1.re, i1=a1.im;\
-    BF(t3, t5, t5, t1);\
-    BF(a2.re, a0.re, r0, t5);\
-    BF(a3.im, a1.im, i1, t3);\
-    BF(t4, t6, t2, t6);\
-    BF(a3.re, a1.re, r1, t4);\
-    BF(a2.im, a0.im, i0, t6);\
-}
-
-#define TRANSFORM(a0,a1,a2,a3,wre,wim) {\
-    t1 = a2.re * wre + a2.im * wim;\
-    t2 = a2.im * wre - a2.re * wim;\
-    t5 = a3.re * wre - a3.im * wim;\
-    t6 = a3.im * wre + a3.re * wim;\
-    BUTTERFLIES(a0,a1,a2,a3)\
-}
-
-#define TRANSFORM_ZERO(a0,a1,a2,a3) {\
-    t1 = a2.re;\
-    t2 = a2.im;\
-    t5 = a3.re;\
-    t6 = a3.im;\
-    BUTTERFLIES(a0,a1,a2,a3)\
-}
-
-/* z[0...8n-1], w[1...2n-1] */
-#define PASS(name)\
-static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\
-{\
-    FFTSample t1, t2, t3, t4, t5, t6;\
-    int o1 = 2*n;\
-    int o2 = 4*n;\
-    int o3 = 6*n;\
-    const FFTSample *wim = wre+o1;\
-    n--;\
-\
-    TRANSFORM_ZERO(z[0],z[o1],z[o2],z[o3]);\
-    TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\
-    do {\
-        z += 2;\
-        wre += 2;\
-        wim -= 2;\
-        TRANSFORM(z[0],z[o1],z[o2],z[o3],wre[0],wim[0]);\
-        TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\
-    } while(--n);\
-}
-
-PASS(pass)
-#undef BUTTERFLIES
-#define BUTTERFLIES BUTTERFLIES_BIG
-PASS(pass_big)
-
-#define DECL_FFT(n,n2,n4)\
-static void fft##n(FFTComplex *z)\
-{\
-    fft##n2(z);\
-    fft##n4(z+n4*2);\
-    fft##n4(z+n4*3);\
-    pass(z,ff_cos_##n,n4/2);\
-}
-
-static void fft4(FFTComplex *z)
-{
-    FFTSample t1, t2, t3, t4, t5, t6, t7, t8;
-
-    BF(t3, t1, z[0].re, z[1].re);
-    BF(t8, t6, z[3].re, z[2].re);
-    BF(z[2].re, z[0].re, t1, t6);
-    BF(t4, t2, z[0].im, z[1].im);
-    BF(t7, t5, z[2].im, z[3].im);
-    BF(z[3].im, z[1].im, t4, t8);
-    BF(z[3].re, z[1].re, t3, t7);
-    BF(z[2].im, z[0].im, t2, t5);
-}
-
-static void fft8(FFTComplex *z)
-{
-    FFTSample t1, t2, t3, t4, t5, t6, t7, t8;
-
-    fft4(z);
-
-    BF(t1, z[5].re, z[4].re, -z[5].re);
-    BF(t2, z[5].im, z[4].im, -z[5].im);
-    BF(t3, z[7].re, z[6].re, -z[7].re);
-    BF(t4, z[7].im, z[6].im, -z[7].im);
-    BF(t8, t1, t3, t1);
-    BF(t7, t2, t2, t4);
-    BF(z[4].re, z[0].re, z[0].re, t1);
-    BF(z[4].im, z[0].im, z[0].im, t2);
-    BF(z[6].re, z[2].re, z[2].re, t7);
-    BF(z[6].im, z[2].im, z[2].im, t8);
-
-    TRANSFORM(z[1],z[3],z[5],z[7],sqrthalf,sqrthalf);
-}
-
-#if !CONFIG_SMALL
-static void fft16(FFTComplex *z)
-{
-    FFTSample t1, t2, t3, t4, t5, t6;
-
-    fft8(z);
-    fft4(z+8);
-    fft4(z+12);
-
-    TRANSFORM_ZERO(z[0],z[4],z[8],z[12]);
-    TRANSFORM(z[2],z[6],z[10],z[14],sqrthalf,sqrthalf);
-    TRANSFORM(z[1],z[5],z[9],z[13],ff_cos_16[1],ff_cos_16[3]);
-    TRANSFORM(z[3],z[7],z[11],z[15],ff_cos_16[3],ff_cos_16[1]);
-}
-#else
-DECL_FFT(16,8,4)
-#endif
-DECL_FFT(32,16,8)
-DECL_FFT(64,32,16)
-DECL_FFT(128,64,32)
-DECL_FFT(256,128,64)
-DECL_FFT(512,256,128)
-#if !CONFIG_SMALL
-#define pass pass_big
-#endif
-DECL_FFT(1024,512,256)
-DECL_FFT(2048,1024,512)
-DECL_FFT(4096,2048,1024)
-DECL_FFT(8192,4096,2048)
-DECL_FFT(16384,8192,4096)
-DECL_FFT(32768,16384,8192)
-DECL_FFT(65536,32768,16384)
-
-static void (* const fft_dispatch[])(FFTComplex*) = {
-    fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024,
-    fft2048, fft4096, fft8192, fft16384, fft32768, fft65536,
-};
-
-void ff_fft_calc_c(FFTContext *s, FFTComplex *z)
-{
-    fft_dispatch[s->nbits-2](z);
-}
-
diff --git a/libavcodec/fft.h b/libavcodec/fft.h
deleted file mode 100644
index 1f5b2e8..0000000
--- a/libavcodec/fft.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_FFT_H
-#define AVCODEC_FFT_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/mem.h"
-#include "avfft.h"
-
-/* FFT computation */
-
-struct FFTContext {
-    int nbits;
-    int inverse;
-    uint16_t *revtab;
-    FFTComplex *exptab;
-    FFTComplex *exptab1; /* only used by SSE code */
-    FFTComplex *tmp_buf;
-    int mdct_size; /* size of MDCT (i.e. number of input data * 2) */
-    int mdct_bits; /* n = 2^nbits */
-    /* pre/post rotation tables */
-    FFTSample *tcos;
-    FFTSample *tsin;
-    void (*fft_permute)(struct FFTContext *s, FFTComplex *z);
-    void (*fft_calc)(struct FFTContext *s, FFTComplex *z);
-    void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
-    void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
-    void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
-    int split_radix;
-    int permutation;
-#define FF_MDCT_PERM_NONE       0
-#define FF_MDCT_PERM_INTERLEAVE 1
-};
-
-#if CONFIG_HARDCODED_TABLES
-#define COSTABLE_CONST const
-#define SINTABLE_CONST const
-#define SINETABLE_CONST const
-#else
-#define COSTABLE_CONST
-#define SINTABLE_CONST
-#define SINETABLE_CONST
-#endif
-
-#define COSTABLE(size) \
-    COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_cos_##size)[size/2]
-#define SINTABLE(size) \
-    SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2]
-#define SINETABLE(size) \
-    SINETABLE_CONST DECLARE_ALIGNED(16, float, ff_sine_##size)[size]
-extern COSTABLE(16);
-extern COSTABLE(32);
-extern COSTABLE(64);
-extern COSTABLE(128);
-extern COSTABLE(256);
-extern COSTABLE(512);
-extern COSTABLE(1024);
-extern COSTABLE(2048);
-extern COSTABLE(4096);
-extern COSTABLE(8192);
-extern COSTABLE(16384);
-extern COSTABLE(32768);
-extern COSTABLE(65536);
-extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17];
-
-/**
- * Initializes the cosine table in ff_cos_tabs[index]
- * \param index index in ff_cos_tabs array of the table to initialize
- */
-void ff_init_ff_cos_tabs(int index);
-
-extern SINTABLE(16);
-extern SINTABLE(32);
-extern SINTABLE(64);
-extern SINTABLE(128);
-extern SINTABLE(256);
-extern SINTABLE(512);
-extern SINTABLE(1024);
-extern SINTABLE(2048);
-extern SINTABLE(4096);
-extern SINTABLE(8192);
-extern SINTABLE(16384);
-extern SINTABLE(32768);
-extern SINTABLE(65536);
-
-/**
- * Sets up a complex FFT.
- * @param nbits           log2 of the length of the input array
- * @param inverse         if 0 perform the forward transform, if 1 perform the inverse
- */
-int ff_fft_init(FFTContext *s, int nbits, int inverse);
-void ff_fft_permute_c(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_c(FFTContext *s, FFTComplex *z);
-
-void ff_fft_init_altivec(FFTContext *s);
-void ff_fft_init_mmx(FFTContext *s);
-void ff_fft_init_arm(FFTContext *s);
-
-/**
- * Do the permutation needed BEFORE calling ff_fft_calc().
- */
-static inline void ff_fft_permute(FFTContext *s, FFTComplex *z)
-{
-    s->fft_permute(s, z);
-}
-/**
- * Do a complex FFT with the parameters defined in ff_fft_init(). The
- * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
- */
-static inline void ff_fft_calc(FFTContext *s, FFTComplex *z)
-{
-    s->fft_calc(s, z);
-}
-void ff_fft_end(FFTContext *s);
-
-/* MDCT computation */
-
-static inline void ff_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    s->imdct_calc(s, output, input);
-}
-static inline void ff_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    s->imdct_half(s, output, input);
-}
-
-static inline void ff_mdct_calc(FFTContext *s, FFTSample *output,
-                                const FFTSample *input)
-{
-    s->mdct_calc(s, output, input);
-}
-
-/**
- * Generate a Kaiser-Bessel Derived Window.
- * @param   window  pointer to half window
- * @param   alpha   determines window shape
- * @param   n       size of half window
- */
-void ff_kbd_window_init(float *window, float alpha, int n);
-
-/**
- * Generate a sine window.
- * @param   window  pointer to half window
- * @param   n       size of half window
- */
-void ff_sine_window_init(float *window, int n);
-
-/**
- * initialize the specified entry of ff_sine_windows
- */
-void ff_init_ff_sine_windows(int index);
-extern SINETABLE(  32);
-extern SINETABLE(  64);
-extern SINETABLE( 128);
-extern SINETABLE( 256);
-extern SINETABLE( 512);
-extern SINETABLE(1024);
-extern SINETABLE(2048);
-extern SINETABLE(4096);
-extern SINETABLE_CONST float * const ff_sine_windows[13];
-
-int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale);
-void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_mdct_end(FFTContext *s);
-
-/* Real Discrete Fourier Transform */
-
-struct RDFTContext {
-    int nbits;
-    int inverse;
-    int sign_convention;
-
-    /* pre/post rotation tables */
-    const FFTSample *tcos;
-    SINTABLE_CONST FFTSample *tsin;
-    FFTContext fft;
-    void (*rdft_calc)(struct RDFTContext *s, FFTSample *z);
-};
-
-/**
- * Sets up a real FFT.
- * @param nbits           log2 of the length of the input array
- * @param trans           the type of transform
- */
-int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans);
-void ff_rdft_end(RDFTContext *s);
-
-void ff_rdft_init_arm(RDFTContext *s);
-
-static av_always_inline void ff_rdft_calc(RDFTContext *s, FFTSample *data)
-{
-    s->rdft_calc(s, data);
-}
-
-/* Discrete Cosine Transform */
-
-struct DCTContext {
-    int nbits;
-    int inverse;
-    RDFTContext rdft;
-    const float *costab;
-    FFTSample *csc2;
-    void (*dct_calc)(struct DCTContext *s, FFTSample *data);
-};
-
-/**
- * Sets up DCT.
- * @param nbits           size of the input array:
- *                        (1 << nbits)     for DCT-II, DCT-III and DST-I
- *                        (1 << nbits) + 1 for DCT-I
- *
- * @note the first element of the input of DST-I is ignored
- */
-int  ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
-void ff_dct_calc(DCTContext *s, FFTSample *data);
-void ff_dct_end (DCTContext *s);
-
-#endif /* AVCODEC_FFT_H */
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
deleted file mode 100644
index 12056e1..0000000
--- a/libavcodec/ffv1.c
+++ /dev/null
@@ -1,1197 +0,0 @@
-/*
- * FFV1 codec for libavcodec
- *
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * FF Video Codec 1 (a lossless codec)
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "dsputil.h"
-#include "rangecoder.h"
-#include "golomb.h"
-#include "mathops.h"
-
-#define MAX_PLANES 4
-#define CONTEXT_SIZE 32
-
-extern const uint8_t ff_log2_run[32];
-
-static const int8_t quant3[256]={
- 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,
-};
-
-static const int8_t quant5_10bit[256]={
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,
-};
-
-static const int8_t quant5[256]={
- 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,-1,
-};
-static const int8_t quant7[256]={
- 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,
-};
-static const int8_t quant9[256]={
- 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-1,-1,
-};
-static const int8_t quant9_10bit[256]={
- 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-1,-1,-1,-1,-1,-1,-1,-1,-0,-0,-0,-0,
-};
-
-static const int8_t quant11[256]={
- 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-1,
-};
-static const int8_t quant13[256]={
- 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-2,-2,-1,
-};
-
-static const uint8_t ver2_state[256]= {
-   0,  10,  10,  10,  10,  16,  16,  16,  28,  16,  16,  29,  42,  49,  20,  49,
-  59,  25,  26,  26,  27,  31,  33,  33,  33,  34,  34,  37,  67,  38,  39,  39,
-  40,  40,  41,  79,  43,  44,  45,  45,  48,  48,  64,  50,  51,  52,  88,  52,
-  53,  74,  55,  57,  58,  58,  74,  60, 101,  61,  62,  84,  66,  66,  68,  69,
-  87,  82,  71,  97,  73,  73,  82,  75, 111,  77,  94,  78,  87,  81,  83,  97,
-  85,  83,  94,  86,  99,  89,  90,  99, 111,  92,  93, 134,  95,  98, 105,  98,
- 105, 110, 102, 108, 102, 118, 103, 106, 106, 113, 109, 112, 114, 112, 116, 125,
- 115, 116, 117, 117, 126, 119, 125, 121, 121, 123, 145, 124, 126, 131, 127, 129,
- 165, 130, 132, 138, 133, 135, 145, 136, 137, 139, 146, 141, 143, 142, 144, 148,
- 147, 155, 151, 149, 151, 150, 152, 157, 153, 154, 156, 168, 158, 162, 161, 160,
- 172, 163, 169, 164, 166, 184, 167, 170, 177, 174, 171, 173, 182, 176, 180, 178,
- 175, 189, 179, 181, 186, 183, 192, 185, 200, 187, 191, 188, 190, 197, 193, 196,
- 197, 194, 195, 196, 198, 202, 199, 201, 210, 203, 207, 204, 205, 206, 208, 214,
- 209, 211, 221, 212, 213, 215, 224, 216, 217, 218, 219, 220, 222, 228, 223, 225,
- 226, 224, 227, 229, 240, 230, 231, 232, 233, 234, 235, 236, 238, 239, 237, 242,
- 241, 243, 242, 244, 245, 246, 247, 248, 249, 250, 251, 252, 252, 253, 254, 255,
-};
-
-typedef struct VlcState{
-    int16_t drift;
-    uint16_t error_sum;
-    int8_t bias;
-    uint8_t count;
-} VlcState;
-
-typedef struct PlaneContext{
-    int context_count;
-    uint8_t (*state)[CONTEXT_SIZE];
-    VlcState *vlc_state;
-    uint8_t interlace_bit_state[2];
-} PlaneContext;
-
-typedef struct FFV1Context{
-    AVCodecContext *avctx;
-    RangeCoder c;
-    GetBitContext gb;
-    PutBitContext pb;
-    int version;
-    int width, height;
-    int chroma_h_shift, chroma_v_shift;
-    int flags;
-    int picture_number;
-    AVFrame picture;
-    int plane_count;
-    int ac;                              ///< 1=range coder <-> 0=golomb rice
-    PlaneContext plane[MAX_PLANES];
-    int16_t quant_table[5][256];
-    uint8_t state_transition[256];
-    int run_index;
-    int colorspace;
-
-    DSPContext dsp;
-}FFV1Context;
-
-static av_always_inline int fold(int diff, int bits){
-    if(bits==8)
-        diff= (int8_t)diff;
-    else{
-        diff+= 1<<(bits-1);
-        diff&=(1<<bits)-1;
-        diff-= 1<<(bits-1);
-    }
-
-    return diff;
-}
-
-static inline int predict(int_fast16_t *src, int_fast16_t *last){
-    const int LT= last[-1];
-    const int  T= last[ 0];
-    const int L =  src[-1];
-
-    return mid_pred(L, L + T - LT, T);
-}
-
-static inline int get_context(FFV1Context *f, int_fast16_t *src, int_fast16_t *last, int_fast16_t *last2){
-    const int LT= last[-1];
-    const int  T= last[ 0];
-    const int RT= last[ 1];
-    const int L =  src[-1];
-
-    if(f->quant_table[3][127]){
-        const int TT= last2[0];
-        const int LL=  src[-2];
-        return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF]
-              +f->quant_table[3][(LL-L) & 0xFF] + f->quant_table[4][(TT-T) & 0xFF];
-    }else
-        return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF];
-}
-
-static inline void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed){
-    int i;
-
-    if(v){
-        const int a= FFABS(v);
-        const int e= av_log2(a);
-        put_rac(c, state+0, 0);
-        if(e<=9){
-            for(i=0; i<e; i++){
-                put_rac(c, state+1+i, 1);  //1..10
-            }
-            put_rac(c, state+1+i, 0);
-
-            for(i=e-1; i>=0; i--){
-                put_rac(c, state+22+i, (a>>i)&1); //22..31
-            }
-
-            if(is_signed)
-                put_rac(c, state+11 + e, v < 0); //11..21
-        }else{
-            for(i=0; i<e; i++){
-                put_rac(c, state+1+FFMIN(i,9), 1);  //1..10
-            }
-            put_rac(c, state+1+9, 0);
-
-            for(i=e-1; i>=0; i--){
-                put_rac(c, state+22+FFMIN(i,9), (a>>i)&1); //22..31
-            }
-
-            if(is_signed)
-                put_rac(c, state+11 + 10, v < 0); //11..21
-        }
-    }else{
-        put_rac(c, state+0, 1);
-    }
-}
-
-static void av_noinline put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){
-    put_symbol_inline(c, state, v, is_signed);
-}
-
-static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state, int is_signed){
-    if(get_rac(c, state+0))
-        return 0;
-    else{
-        int i, e, a;
-        e= 0;
-        while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
-            e++;
-        }
-
-        a= 1;
-        for(i=e-1; i>=0; i--){
-            a += a + get_rac(c, state+22 + FFMIN(i,9)); //22..31
-        }
-
-        e= -(is_signed && get_rac(c, state+11 + FFMIN(e, 10))); //11..21
-        return (a^e)-e;
-    }
-}
-
-static int av_noinline get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
-    return get_symbol_inline(c, state, is_signed);
-}
-
-static inline void update_vlc_state(VlcState * const state, const int v){
-    int drift= state->drift;
-    int count= state->count;
-    state->error_sum += FFABS(v);
-    drift += v;
-
-    if(count == 128){ //FIXME variable
-        count >>= 1;
-        drift >>= 1;
-        state->error_sum >>= 1;
-    }
-    count++;
-
-    if(drift <= -count){
-        if(state->bias > -128) state->bias--;
-
-        drift += count;
-        if(drift <= -count)
-            drift= -count + 1;
-    }else if(drift > 0){
-        if(state->bias <  127) state->bias++;
-
-        drift -= count;
-        if(drift > 0)
-            drift= 0;
-    }
-
-    state->drift= drift;
-    state->count= count;
-}
-
-static inline void put_vlc_symbol(PutBitContext *pb, VlcState * const state, int v, int bits){
-    int i, k, code;
-//printf("final: %d ", v);
-    v = fold(v - state->bias, bits);
-
-    i= state->count;
-    k=0;
-    while(i < state->error_sum){ //FIXME optimize
-        k++;
-        i += i;
-    }
-
-    assert(k<=8);
-
-#if 0 // JPEG LS
-    if(k==0 && 2*state->drift <= - state->count) code= v ^ (-1);
-    else                                         code= v;
-#else
-     code= v ^ ((2*state->drift + state->count)>>31);
-#endif
-
-//printf("v:%d/%d bias:%d error:%d drift:%d count:%d k:%d\n", v, code, state->bias, state->error_sum, state->drift, state->count, k);
-    set_sr_golomb(pb, code, k, 12, bits);
-
-    update_vlc_state(state, v);
-}
-
-static inline int get_vlc_symbol(GetBitContext *gb, VlcState * const state, int bits){
-    int k, i, v, ret;
-
-    i= state->count;
-    k=0;
-    while(i < state->error_sum){ //FIXME optimize
-        k++;
-        i += i;
-    }
-
-    assert(k<=8);
-
-    v= get_sr_golomb(gb, k, 12, bits);
-//printf("v:%d bias:%d error:%d drift:%d count:%d k:%d", v, state->bias, state->error_sum, state->drift, state->count, k);
-
-#if 0 // JPEG LS
-    if(k==0 && 2*state->drift <= - state->count) v ^= (-1);
-#else
-     v ^= ((2*state->drift + state->count)>>31);
-#endif
-
-    ret= fold(v + state->bias, bits);
-
-    update_vlc_state(state, v);
-//printf("final: %d\n", ret);
-    return ret;
-}
-
-#if CONFIG_FFV1_ENCODER
-static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
-    PlaneContext * const p= &s->plane[plane_index];
-    RangeCoder * const c= &s->c;
-    int x;
-    int run_index= s->run_index;
-    int run_count=0;
-    int run_mode=0;
-
-    if(s->ac){
-        if(c->bytestream_end - c->bytestream < w*20){
-            av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-            return -1;
-        }
-    }else{
-        if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < w*4){
-            av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-            return -1;
-        }
-    }
-
-    for(x=0; x<w; x++){
-        int diff, context;
-
-        context= get_context(s, sample[0]+x, sample[1]+x, sample[2]+x);
-        diff= sample[0][x] - predict(sample[0]+x, sample[1]+x);
-
-        if(context < 0){
-            context = -context;
-            diff= -diff;
-        }
-
-        diff= fold(diff, bits);
-
-        if(s->ac){
-            put_symbol_inline(c, p->state[context], diff, 1);
-        }else{
-            if(context == 0) run_mode=1;
-
-            if(run_mode){
-
-                if(diff){
-                    while(run_count >= 1<<ff_log2_run[run_index]){
-                        run_count -= 1<<ff_log2_run[run_index];
-                        run_index++;
-                        put_bits(&s->pb, 1, 1);
-                    }
-
-                    put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count);
-                    if(run_index) run_index--;
-                    run_count=0;
-                    run_mode=0;
-                    if(diff>0) diff--;
-                }else{
-                    run_count++;
-                }
-            }
-
-//            printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, (int)put_bits_count(&s->pb));
-
-            if(run_mode == 0)
-                put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits);
-        }
-    }
-    if(run_mode){
-        while(run_count >= 1<<ff_log2_run[run_index]){
-            run_count -= 1<<ff_log2_run[run_index];
-            run_index++;
-            put_bits(&s->pb, 1, 1);
-        }
-
-        if(run_count)
-            put_bits(&s->pb, 1, 1);
-    }
-    s->run_index= run_index;
-
-    return 0;
-}
-
-static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
-    int x,y,i;
-    const int ring_size= s->avctx->context_model ? 3 : 2;
-    int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size];
-    s->run_index=0;
-
-    memset(sample_buffer, 0, sizeof(sample_buffer));
-
-    for(y=0; y<h; y++){
-        for(i=0; i<ring_size; i++)
-            sample[i]= sample_buffer[(h+i-y)%ring_size]+3;
-
-        sample[0][-1]= sample[1][0  ];
-        sample[1][ w]= sample[1][w-1];
-//{START_TIMER
-        if(s->avctx->bits_per_raw_sample<=8){
-            for(x=0; x<w; x++){
-                sample[0][x]= src[x + stride*y];
-            }
-            encode_line(s, w, sample, plane_index, 8);
-        }else{
-            for(x=0; x<w; x++){
-                sample[0][x]= ((uint16_t*)(src + stride*y))[x] >> (16 - s->avctx->bits_per_raw_sample);
-            }
-            encode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
-        }
-//STOP_TIMER("encode line")}
-    }
-}
-
-static void encode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
-    int x, y, p, i;
-    const int ring_size= s->avctx->context_model ? 3 : 2;
-    int_fast16_t sample_buffer[3][ring_size][w+6], *sample[3][ring_size];
-    s->run_index=0;
-
-    memset(sample_buffer, 0, sizeof(sample_buffer));
-
-    for(y=0; y<h; y++){
-        for(i=0; i<ring_size; i++)
-            for(p=0; p<3; p++)
-                sample[p][i]= sample_buffer[p][(h+i-y)%ring_size]+3;
-
-        for(x=0; x<w; x++){
-            int v= src[x + stride*y];
-            int b= v&0xFF;
-            int g= (v>>8)&0xFF;
-            int r= (v>>16)&0xFF;
-
-            b -= g;
-            r -= g;
-            g += (b + r)>>2;
-            b += 0x100;
-            r += 0x100;
-
-//            assert(g>=0 && b>=0 && r>=0);
-//            assert(g<256 && b<512 && r<512);
-            sample[0][0][x]= g;
-            sample[1][0][x]= b;
-            sample[2][0][x]= r;
-        }
-        for(p=0; p<3; p++){
-            sample[p][0][-1]= sample[p][1][0  ];
-            sample[p][1][ w]= sample[p][1][w-1];
-            encode_line(s, w, sample[p], FFMIN(p, 1), 9);
-        }
-    }
-}
-
-static void write_quant_table(RangeCoder *c, int16_t *quant_table){
-    int last=0;
-    int i;
-    uint8_t state[CONTEXT_SIZE];
-    memset(state, 128, sizeof(state));
-
-    for(i=1; i<128 ; i++){
-        if(quant_table[i] != quant_table[i-1]){
-            put_symbol(c, state, i-last-1, 0);
-            last= i;
-        }
-    }
-    put_symbol(c, state, i-last-1, 0);
-}
-
-static void write_header(FFV1Context *f){
-    uint8_t state[CONTEXT_SIZE];
-    int i;
-    RangeCoder * const c= &f->c;
-
-    memset(state, 128, sizeof(state));
-
-    put_symbol(c, state, f->version, 0);
-    put_symbol(c, state, f->ac, 0);
-    if(f->ac>1){
-        for(i=1; i<256; i++){
-            f->state_transition[i]=ver2_state[i];
-            put_symbol(c, state, ver2_state[i] - c->one_state[i], 1);
-        }
-    }
-    put_symbol(c, state, f->colorspace, 0); //YUV cs type
-    if(f->version>0)
-        put_symbol(c, state, f->avctx->bits_per_raw_sample, 0);
-    put_rac(c, state, 1); //chroma planes
-        put_symbol(c, state, f->chroma_h_shift, 0);
-        put_symbol(c, state, f->chroma_v_shift, 0);
-    put_rac(c, state, 0); //no transparency plane
-
-    for(i=0; i<5; i++)
-        write_quant_table(c, f->quant_table[i]);
-}
-#endif /* CONFIG_FFV1_ENCODER */
-
-static av_cold int common_init(AVCodecContext *avctx){
-    FFV1Context *s = avctx->priv_data;
-
-    s->avctx= avctx;
-    s->flags= avctx->flags;
-
-    dsputil_init(&s->dsp, avctx);
-
-    s->width = avctx->width;
-    s->height= avctx->height;
-
-    assert(s->width && s->height);
-
-    return 0;
-}
-
-#if CONFIG_FFV1_ENCODER
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    FFV1Context *s = avctx->priv_data;
-    int i;
-
-    common_init(avctx);
-
-    s->version=0;
-    s->ac= avctx->coder_type ? 2:0;
-
-    s->plane_count=2;
-    for(i=0; i<256; i++){
-        if(avctx->bits_per_raw_sample <=8){
-            s->quant_table[0][i]=           quant11[i];
-            s->quant_table[1][i]=        11*quant11[i];
-            if(avctx->context_model==0){
-                s->quant_table[2][i]=     11*11*quant11[i];
-                s->quant_table[3][i]=
-                s->quant_table[4][i]=0;
-            }else{
-                s->quant_table[2][i]=     11*11*quant5 [i];
-                s->quant_table[3][i]=   5*11*11*quant5 [i];
-                s->quant_table[4][i]= 5*5*11*11*quant5 [i];
-            }
-        }else{
-            s->quant_table[0][i]=           quant9_10bit[i];
-            s->quant_table[1][i]=        11*quant9_10bit[i];
-            if(avctx->context_model==0){
-                s->quant_table[2][i]=     11*11*quant9_10bit[i];
-                s->quant_table[3][i]=
-                s->quant_table[4][i]=0;
-            }else{
-                s->quant_table[2][i]=     11*11*quant5_10bit[i];
-                s->quant_table[3][i]=   5*11*11*quant5_10bit[i];
-                s->quant_table[4][i]= 5*5*11*11*quant5_10bit[i];
-            }
-        }
-    }
-
-    for(i=0; i<s->plane_count; i++){
-        PlaneContext * const p= &s->plane[i];
-
-        if(avctx->context_model==0){
-            p->context_count= (11*11*11+1)/2;
-        }else{
-            p->context_count= (11*11*5*5*5+1)/2;
-        }
-
-        if(s->ac){
-            if(!p->state) p->state= av_malloc(CONTEXT_SIZE*p->context_count*sizeof(uint8_t));
-        }else{
-            if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState));
-        }
-    }
-
-    avctx->coded_frame= &s->picture;
-    switch(avctx->pix_fmt){
-    case PIX_FMT_YUV444P16:
-    case PIX_FMT_YUV422P16:
-    case PIX_FMT_YUV420P16:
-        if(avctx->bits_per_raw_sample <=8){
-            av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample invalid\n");
-            return -1;
-        }
-        if(!s->ac){
-            av_log(avctx, AV_LOG_ERROR, "bits_per_raw_sample of more than 8 needs -coder 1 currently\n");
-            return -1;
-        }
-        s->version= 1;
-    case PIX_FMT_YUV444P:
-    case PIX_FMT_YUV422P:
-    case PIX_FMT_YUV420P:
-    case PIX_FMT_YUV411P:
-    case PIX_FMT_YUV410P:
-        s->colorspace= 0;
-        break;
-    case PIX_FMT_RGB32:
-        s->colorspace= 1;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "format not supported\n");
-        return -1;
-    }
-    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
-
-    s->picture_number=0;
-
-    return 0;
-}
-#endif /* CONFIG_FFV1_ENCODER */
-
-
-static void clear_state(FFV1Context *f){
-    int i, j;
-
-    for(i=0; i<f->plane_count; i++){
-        PlaneContext *p= &f->plane[i];
-
-        p->interlace_bit_state[0]= 128;
-        p->interlace_bit_state[1]= 128;
-
-        for(j=0; j<p->context_count; j++){
-            if(f->ac){
-                memset(p->state[j], 128, sizeof(uint8_t)*CONTEXT_SIZE);
-            }else{
-                p->vlc_state[j].drift= 0;
-                p->vlc_state[j].error_sum= 4; //FFMAX((RANGE + 32)/64, 2);
-                p->vlc_state[j].bias= 0;
-                p->vlc_state[j].count= 1;
-            }
-        }
-    }
-}
-
-#if CONFIG_FFV1_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    FFV1Context *f = avctx->priv_data;
-    RangeCoder * const c= &f->c;
-    AVFrame *pict = data;
-    const int width= f->width;
-    const int height= f->height;
-    AVFrame * const p= &f->picture;
-    int used_count= 0;
-    uint8_t keystate=128;
-
-    ff_init_range_encoder(c, buf, buf_size);
-    ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-
-    if(avctx->gop_size==0 || f->picture_number % avctx->gop_size == 0){
-        put_rac(c, &keystate, 1);
-        p->key_frame= 1;
-        write_header(f);
-        clear_state(f);
-    }else{
-        put_rac(c, &keystate, 0);
-        p->key_frame= 0;
-    }
-
-    if(!f->ac){
-        used_count += ff_rac_terminate(c);
-//printf("pos=%d\n", used_count);
-        init_put_bits(&f->pb, buf + used_count, buf_size - used_count);
-    }else if (f->ac>1){
-        int i;
-        for(i=1; i<256; i++){
-            c->one_state[i]= f->state_transition[i];
-            c->zero_state[256-i]= 256-c->one_state[i];
-        }
-    }
-
-    if(f->colorspace==0){
-        const int chroma_width = -((-width )>>f->chroma_h_shift);
-        const int chroma_height= -((-height)>>f->chroma_v_shift);
-
-        encode_plane(f, p->data[0], width, height, p->linesize[0], 0);
-
-        encode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1);
-        encode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1);
-    }else{
-        encode_rgb_frame(f, (uint32_t*)(p->data[0]), width, height, p->linesize[0]/4);
-    }
-    emms_c();
-
-    f->picture_number++;
-
-    if(f->ac){
-        return ff_rac_terminate(c);
-    }else{
-        flush_put_bits(&f->pb); //nicer padding FIXME
-        return used_count + (put_bits_count(&f->pb)+7)/8;
-    }
-}
-#endif /* CONFIG_FFV1_ENCODER */
-
-static av_cold int common_end(AVCodecContext *avctx){
-    FFV1Context *s = avctx->priv_data;
-    int i;
-
-    for(i=0; i<s->plane_count; i++){
-        PlaneContext *p= &s->plane[i];
-
-        av_freep(&p->state);
-        av_freep(&p->vlc_state);
-    }
-
-    return 0;
-}
-
-static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){
-    PlaneContext * const p= &s->plane[plane_index];
-    RangeCoder * const c= &s->c;
-    int x;
-    int run_count=0;
-    int run_mode=0;
-    int run_index= s->run_index;
-
-    for(x=0; x<w; x++){
-        int diff, context, sign;
-
-        context= get_context(s, sample[1] + x, sample[0] + x, sample[1] + x);
-        if(context < 0){
-            context= -context;
-            sign=1;
-        }else
-            sign=0;
-
-
-        if(s->ac){
-            diff= get_symbol_inline(c, p->state[context], 1);
-        }else{
-            if(context == 0 && run_mode==0) run_mode=1;
-
-            if(run_mode){
-                if(run_count==0 && run_mode==1){
-                    if(get_bits1(&s->gb)){
-                        run_count = 1<<ff_log2_run[run_index];
-                        if(x + run_count <= w) run_index++;
-                    }else{
-                        if(ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]);
-                        else run_count=0;
-                        if(run_index) run_index--;
-                        run_mode=2;
-                    }
-                }
-                run_count--;
-                if(run_count < 0){
-                    run_mode=0;
-                    run_count=0;
-                    diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
-                    if(diff>=0) diff++;
-                }else
-                    diff=0;
-            }else
-                diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits);
-
-//            printf("count:%d index:%d, mode:%d, x:%d y:%d pos:%d\n", run_count, run_index, run_mode, x, y, get_bits_count(&s->gb));
-        }
-
-        if(sign) diff= -diff;
-
-        sample[1][x]= (predict(sample[1] + x, sample[0] + x) + diff) & ((1<<bits)-1);
-    }
-    s->run_index= run_index;
-}
-
-static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){
-    int x, y;
-    int_fast16_t sample_buffer[2][w+6];
-    int_fast16_t *sample[2];
-    sample[0]=sample_buffer[0]+3;
-    sample[1]=sample_buffer[1]+3;
-
-    s->run_index=0;
-
-    memset(sample_buffer, 0, sizeof(sample_buffer));
-
-    for(y=0; y<h; y++){
-        int_fast16_t *temp= sample[0]; //FIXME try a normal buffer
-
-        sample[0]= sample[1];
-        sample[1]= temp;
-
-        sample[1][-1]= sample[0][0  ];
-        sample[0][ w]= sample[0][w-1];
-
-//{START_TIMER
-        if(s->avctx->bits_per_raw_sample <= 8){
-            decode_line(s, w, sample, plane_index, 8);
-            for(x=0; x<w; x++){
-                src[x + stride*y]= sample[1][x];
-            }
-        }else{
-            decode_line(s, w, sample, plane_index, s->avctx->bits_per_raw_sample);
-            for(x=0; x<w; x++){
-                ((uint16_t*)(src + stride*y))[x]= sample[1][x] << (16 - s->avctx->bits_per_raw_sample);
-            }
-        }
-//STOP_TIMER("decode-line")}
-    }
-}
-
-static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){
-    int x, y, p;
-    int_fast16_t sample_buffer[3][2][w+6];
-    int_fast16_t *sample[3][2];
-    for(x=0; x<3; x++){
-        sample[x][0] = sample_buffer[x][0]+3;
-        sample[x][1] = sample_buffer[x][1]+3;
-    }
-
-    s->run_index=0;
-
-    memset(sample_buffer, 0, sizeof(sample_buffer));
-
-    for(y=0; y<h; y++){
-        for(p=0; p<3; p++){
-            int_fast16_t *temp= sample[p][0]; //FIXME try a normal buffer
-
-            sample[p][0]= sample[p][1];
-            sample[p][1]= temp;
-
-            sample[p][1][-1]= sample[p][0][0  ];
-            sample[p][0][ w]= sample[p][0][w-1];
-            decode_line(s, w, sample[p], FFMIN(p, 1), 9);
-        }
-        for(x=0; x<w; x++){
-            int g= sample[0][1][x];
-            int b= sample[1][1][x];
-            int r= sample[2][1][x];
-
-//            assert(g>=0 && b>=0 && r>=0);
-//            assert(g<256 && b<512 && r<512);
-
-            b -= 0x100;
-            r -= 0x100;
-            g -= (b + r)>>2;
-            b += g;
-            r += g;
-
-            src[x + stride*y]= b + (g<<8) + (r<<16);
-        }
-    }
-}
-
-static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){
-    int v;
-    int i=0;
-    uint8_t state[CONTEXT_SIZE];
-
-    memset(state, 128, sizeof(state));
-
-    for(v=0; i<128 ; v++){
-        int len= get_symbol(c, state, 0) + 1;
-
-        if(len + i > 128) return -1;
-
-        while(len--){
-            quant_table[i] = scale*v;
-            i++;
-//printf("%2d ",v);
-//if(i%16==0) printf("\n");
-        }
-    }
-
-    for(i=1; i<128; i++){
-        quant_table[256-i]= -quant_table[i];
-    }
-    quant_table[128]= -quant_table[127];
-
-    return 2*v - 1;
-}
-
-static int read_header(FFV1Context *f){
-    uint8_t state[CONTEXT_SIZE];
-    int i, context_count;
-    RangeCoder * const c= &f->c;
-
-    memset(state, 128, sizeof(state));
-
-    f->version= get_symbol(c, state, 0);
-    f->ac= f->avctx->coder_type= get_symbol(c, state, 0);
-    if(f->ac>1){
-        for(i=1; i<256; i++){
-            f->state_transition[i]= get_symbol(c, state, 1) + c->one_state[i];
-        }
-    }
-    f->colorspace= get_symbol(c, state, 0); //YUV cs type
-    if(f->version>0)
-        f->avctx->bits_per_raw_sample= get_symbol(c, state, 0);
-    get_rac(c, state); //no chroma = false
-    f->chroma_h_shift= get_symbol(c, state, 0);
-    f->chroma_v_shift= get_symbol(c, state, 0);
-    get_rac(c, state); //transparency plane
-    f->plane_count= 2;
-
-    if(f->colorspace==0){
-        if(f->avctx->bits_per_raw_sample<=8){
-            switch(16*f->chroma_h_shift + f->chroma_v_shift){
-            case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P; break;
-            case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P; break;
-            case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P; break;
-            case 0x20: f->avctx->pix_fmt= PIX_FMT_YUV411P; break;
-            case 0x22: f->avctx->pix_fmt= PIX_FMT_YUV410P; break;
-            default:
-                av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
-                return -1;
-            }
-        }else{
-            switch(16*f->chroma_h_shift + f->chroma_v_shift){
-            case 0x00: f->avctx->pix_fmt= PIX_FMT_YUV444P16; break;
-            case 0x10: f->avctx->pix_fmt= PIX_FMT_YUV422P16; break;
-            case 0x11: f->avctx->pix_fmt= PIX_FMT_YUV420P16; break;
-            default:
-                av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
-                return -1;
-            }
-        }
-    }else if(f->colorspace==1){
-        if(f->chroma_h_shift || f->chroma_v_shift){
-            av_log(f->avctx, AV_LOG_ERROR, "chroma subsampling not supported in this colorspace\n");
-            return -1;
-        }
-        f->avctx->pix_fmt= PIX_FMT_RGB32;
-    }else{
-        av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
-        return -1;
-    }
-
-//printf("%d %d %d\n", f->chroma_h_shift, f->chroma_v_shift,f->avctx->pix_fmt);
-
-    context_count=1;
-    for(i=0; i<5; i++){
-        context_count*= read_quant_table(c, f->quant_table[i], context_count);
-        if(context_count < 0 || context_count > 32768){
-            av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n");
-            return -1;
-        }
-    }
-    context_count= (context_count+1)/2;
-
-    for(i=0; i<f->plane_count; i++){
-        PlaneContext * const p= &f->plane[i];
-
-        p->context_count= context_count;
-
-        if(f->ac){
-            if(!p->state) p->state= av_malloc(CONTEXT_SIZE*p->context_count*sizeof(uint8_t));
-        }else{
-            if(!p->vlc_state) p->vlc_state= av_malloc(p->context_count*sizeof(VlcState));
-        }
-    }
-
-    return 0;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-//    FFV1Context *s = avctx->priv_data;
-
-    common_init(avctx);
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt){
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    FFV1Context *f = avctx->priv_data;
-    RangeCoder * const c= &f->c;
-    const int width= f->width;
-    const int height= f->height;
-    AVFrame * const p= &f->picture;
-    int bytes_read;
-    uint8_t keystate= 128;
-
-    AVFrame *picture = data;
-
-    ff_init_range_decoder(c, buf, buf_size);
-    ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
-
-    p->pict_type= FF_I_TYPE; //FIXME I vs. P
-    if(get_rac(c, &keystate)){
-        p->key_frame= 1;
-        if(read_header(f) < 0)
-            return -1;
-        clear_state(f);
-    }else{
-        p->key_frame= 0;
-    }
-    if(f->ac>1){
-        int i;
-        for(i=1; i<256; i++){
-            c->one_state[i]= f->state_transition[i];
-            c->zero_state[256-i]= 256-c->one_state[i];
-        }
-    }
-
-    if(!f->plane[0].state && !f->plane[0].vlc_state)
-        return -1;
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if(avctx->debug&FF_DEBUG_PICT_INFO)
-        av_log(avctx, AV_LOG_ERROR, "keyframe:%d coder:%d\n", p->key_frame, f->ac);
-
-    if(!f->ac){
-        bytes_read = c->bytestream - c->bytestream_start - 1;
-        if(bytes_read ==0) av_log(avctx, AV_LOG_ERROR, "error at end of AC stream\n"); //FIXME
-//printf("pos=%d\n", bytes_read);
-        init_get_bits(&f->gb, buf + bytes_read, buf_size - bytes_read);
-    } else {
-        bytes_read = 0; /* avoid warning */
-    }
-
-    if(f->colorspace==0){
-        const int chroma_width = -((-width )>>f->chroma_h_shift);
-        const int chroma_height= -((-height)>>f->chroma_v_shift);
-        decode_plane(f, p->data[0], width, height, p->linesize[0], 0);
-
-        decode_plane(f, p->data[1], chroma_width, chroma_height, p->linesize[1], 1);
-        decode_plane(f, p->data[2], chroma_width, chroma_height, p->linesize[2], 1);
-    }else{
-        decode_rgb_frame(f, (uint32_t*)p->data[0], width, height, p->linesize[0]/4);
-    }
-
-    emms_c();
-
-    f->picture_number++;
-
-    *picture= *p;
-
-    avctx->release_buffer(avctx, p); //FIXME
-
-    *data_size = sizeof(AVFrame);
-
-    if(f->ac){
-        bytes_read= c->bytestream - c->bytestream_start - 1;
-        if(bytes_read ==0) av_log(f->avctx, AV_LOG_ERROR, "error at end of frame\n");
-    }else{
-        bytes_read+= (get_bits_count(&f->gb)+7)/8;
-    }
-
-    return bytes_read;
-}
-
-AVCodec ffv1_decoder = {
-    "ffv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FFV1,
-    sizeof(FFV1Context),
-    decode_init,
-    NULL,
-    common_end,
-    decode_frame,
-    CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
-    NULL,
-    .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
-};
-
-#if CONFIG_FFV1_ENCODER
-AVCodec ffv1_encoder = {
-    "ffv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FFV1,
-    sizeof(FFV1Context),
-    encode_init,
-    encode_frame,
-    common_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV444P, PIX_FMT_YUV422P, PIX_FMT_YUV411P, PIX_FMT_YUV410P, PIX_FMT_RGB32, PIX_FMT_YUV420P16, PIX_FMT_YUV422P16, PIX_FMT_YUV444P16, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"),
-};
-#endif
diff --git a/libavcodec/flac.c b/libavcodec/flac.c
deleted file mode 100644
index a649e08..0000000
--- a/libavcodec/flac.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * FLAC common code
- * Copyright (c) 2009 Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "flac.h"
-
-int ff_flac_get_max_frame_size(int blocksize, int ch, int bps)
-{
-    /* Technically, there is no limit to FLAC frame size, but an encoder
-       should not write a frame that is larger than if verbatim encoding mode
-       were to be used. */
-
-    int count;
-
-    count = 16;                  /* frame header */
-    count += ch * ((7+bps+7)/8); /* subframe headers */
-    if (ch == 2) {
-        /* for stereo, need to account for using decorrelation */
-        count += (( 2*bps+1) * blocksize + 7) / 8;
-    } else {
-        count += ( ch*bps    * blocksize + 7) / 8;
-    }
-    count += 2; /* frame footer */
-
-    return count;
-}
diff --git a/libavcodec/flac.h b/libavcodec/flac.h
deleted file mode 100644
index 1b11463..0000000
--- a/libavcodec/flac.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * FLAC (Free Lossless Audio Codec) decoder/demuxer common functions
- * Copyright (c) 2008 Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * FLAC (Free Lossless Audio Codec) decoder/demuxer common functions
- */
-
-#ifndef AVCODEC_FLAC_H
-#define AVCODEC_FLAC_H
-
-#include "avcodec.h"
-
-#define FLAC_STREAMINFO_SIZE   34
-#define FLAC_MAX_CHANNELS       8
-#define FLAC_MIN_BLOCKSIZE     16
-#define FLAC_MAX_BLOCKSIZE  65535
-
-enum {
-    FLAC_CHMODE_INDEPENDENT =  0,
-    FLAC_CHMODE_LEFT_SIDE   =  8,
-    FLAC_CHMODE_RIGHT_SIDE  =  9,
-    FLAC_CHMODE_MID_SIDE    = 10,
-};
-
-enum {
-    FLAC_METADATA_TYPE_STREAMINFO = 0,
-    FLAC_METADATA_TYPE_PADDING,
-    FLAC_METADATA_TYPE_APPLICATION,
-    FLAC_METADATA_TYPE_SEEKTABLE,
-    FLAC_METADATA_TYPE_VORBIS_COMMENT,
-    FLAC_METADATA_TYPE_CUESHEET,
-    FLAC_METADATA_TYPE_PICTURE,
-    FLAC_METADATA_TYPE_INVALID = 127
-};
-
-enum FLACExtradataFormat {
-    FLAC_EXTRADATA_FORMAT_STREAMINFO  = 0,
-    FLAC_EXTRADATA_FORMAT_FULL_HEADER = 1
-};
-
-#define FLACCOMMONINFO \
-    int samplerate;         /**< sample rate                             */\
-    int channels;           /**< number of channels                      */\
-    int bps;                /**< bits-per-sample                         */\
-
-/**
- * Data needed from the Streaminfo header for use by the raw FLAC demuxer
- * and/or the FLAC decoder.
- */
-#define FLACSTREAMINFO \
-    FLACCOMMONINFO \
-    int max_blocksize;      /**< maximum block size, in samples          */\
-    int max_framesize;      /**< maximum frame size, in bytes            */\
-    int64_t samples;        /**< total number of samples                 */\
-
-typedef struct FLACStreaminfo {
-    FLACSTREAMINFO
-} FLACStreaminfo;
-
-typedef struct FLACFrameInfo {
-    FLACCOMMONINFO
-    int blocksize;          /**< block size of the frame                 */
-    int ch_mode;            /**< channel decorrelation mode              */
-} FLACFrameInfo;
-
-/**
- * Parse the Streaminfo metadata block
- * @param[out] avctx   codec context to set basic stream parameters
- * @param[out] s       where parsed information is stored
- * @param[in]  buffer  pointer to start of 34-byte streaminfo data
- */
-void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
-                              const uint8_t *buffer);
-
-/**
- * Validate the FLAC extradata.
- * @param[in]  avctx codec context containing the extradata.
- * @param[out] format extradata format.
- * @param[out] streaminfo_start pointer to start of 34-byte STREAMINFO data.
- * @return 1 if valid, 0 if not valid.
- */
-int ff_flac_is_extradata_valid(AVCodecContext *avctx,
-                               enum FLACExtradataFormat *format,
-                               uint8_t **streaminfo_start);
-
-/**
- * Parse the metadata block parameters from the header.
- * @param[in]  block_header header data, at least 4 bytes
- * @param[out] last indicator for last metadata block
- * @param[out] type metadata block type
- * @param[out] size metadata block size
- */
-void ff_flac_parse_block_header(const uint8_t *block_header,
-                                int *last, int *type, int *size);
-
-/**
- * Calculate an estimate for the maximum frame size based on verbatim mode.
- * @param blocksize block size, in samples
- * @param ch number of channels
- * @param bps bits-per-sample
- */
-int ff_flac_get_max_frame_size(int blocksize, int ch, int bps);
-
-#endif /* AVCODEC_FLAC_H */
diff --git a/libavcodec/flacdata.c b/libavcodec/flacdata.c
deleted file mode 100644
index 6fcbe39..0000000
--- a/libavcodec/flacdata.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * FLAC data
- * Copyright (c) 2003 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "internal.h"
-
-const int ff_flac_sample_rate_table[16] =
-{ 0,
-  88200, 176400, 192000,
-  8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000,
-  0, 0, 0, 0 };
-
-const int16_t ff_flac_blocksize_table[16] = {
-     0,    192, 576<<0, 576<<1, 576<<2, 576<<3,      0,      0,
-256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7
-};
diff --git a/libavcodec/flacdata.h b/libavcodec/flacdata.h
deleted file mode 100644
index 96a50b9..0000000
--- a/libavcodec/flacdata.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * FLAC data header
- * Copyright (c) 2003 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_FLACDATA_H
-#define AVCODEC_FLACDATA_H
-
-#include "internal.h"
-
-extern const int ff_flac_sample_rate_table[16];
-
-extern const int16_t ff_flac_blocksize_table[16];
-
-#endif /* AVCODEC_FLACDATA_H */
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
deleted file mode 100644
index 07acf6e..0000000
--- a/libavcodec/flacdec.c
+++ /dev/null
@@ -1,814 +0,0 @@
-/*
- * FLAC (Free Lossless Audio Codec) decoder
- * Copyright (c) 2003 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * FLAC (Free Lossless Audio Codec) decoder
- * @author Alex Beregszaszi
- *
- * For more information on the FLAC format, visit:
- *  http://flac.sourceforge.net/
- *
- * This decoder can be used in 1 of 2 ways: Either raw FLAC data can be fed
- * through, starting from the initial 'fLaC' signature; or by passing the
- * 34-byte streaminfo structure through avctx->extradata[_size] followed
- * by data starting with the 0xFFF8 marker.
- */
-
-#include <limits.h>
-
-#include "libavutil/crc.h"
-#include "avcodec.h"
-#include "internal.h"
-#include "get_bits.h"
-#include "bytestream.h"
-#include "golomb.h"
-#include "flac.h"
-#include "flacdata.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-typedef struct FLACContext {
-    FLACSTREAMINFO
-
-    AVCodecContext *avctx;                  ///< parent AVCodecContext
-    GetBitContext gb;                       ///< GetBitContext initialized to start at the current frame
-
-    int blocksize;                          ///< number of samples in the current frame
-    int curr_bps;                           ///< bps for current subframe, adjusted for channel correlation and wasted bits
-    int sample_shift;                       ///< shift required to make output samples 16-bit or 32-bit
-    int is32;                               ///< flag to indicate if output should be 32-bit instead of 16-bit
-    int ch_mode;                            ///< channel decorrelation type in the current frame
-    int got_streaminfo;                     ///< indicates if the STREAMINFO has been read
-
-    int32_t *decoded[FLAC_MAX_CHANNELS];    ///< decoded samples
-    uint8_t *bitstream;
-    unsigned int bitstream_size;
-    unsigned int bitstream_index;
-    unsigned int allocated_bitstream_size;
-} FLACContext;
-
-static const int sample_size_table[] =
-{ 0, 8, 12, 0, 16, 20, 24, 0 };
-
-static int64_t get_utf8(GetBitContext *gb)
-{
-    int64_t val;
-    GET_UTF8(val, get_bits(gb, 8), return -1;)
-    return val;
-}
-
-static void allocate_buffers(FLACContext *s);
-
-int ff_flac_is_extradata_valid(AVCodecContext *avctx,
-                               enum FLACExtradataFormat *format,
-                               uint8_t **streaminfo_start)
-{
-    if (!avctx->extradata || avctx->extradata_size < FLAC_STREAMINFO_SIZE) {
-        av_log(avctx, AV_LOG_ERROR, "extradata NULL or too small.\n");
-        return 0;
-    }
-    if (AV_RL32(avctx->extradata) != MKTAG('f','L','a','C')) {
-        /* extradata contains STREAMINFO only */
-        if (avctx->extradata_size != FLAC_STREAMINFO_SIZE) {
-            av_log(avctx, AV_LOG_WARNING, "extradata contains %d bytes too many.\n",
-                   FLAC_STREAMINFO_SIZE-avctx->extradata_size);
-        }
-        *format = FLAC_EXTRADATA_FORMAT_STREAMINFO;
-        *streaminfo_start = avctx->extradata;
-    } else {
-        if (avctx->extradata_size < 8+FLAC_STREAMINFO_SIZE) {
-            av_log(avctx, AV_LOG_ERROR, "extradata too small.\n");
-            return 0;
-        }
-        *format = FLAC_EXTRADATA_FORMAT_FULL_HEADER;
-        *streaminfo_start = &avctx->extradata[8];
-    }
-    return 1;
-}
-
-static av_cold int flac_decode_init(AVCodecContext *avctx)
-{
-    enum FLACExtradataFormat format;
-    uint8_t *streaminfo;
-    FLACContext *s = avctx->priv_data;
-    s->avctx = avctx;
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    /* for now, the raw FLAC header is allowed to be passed to the decoder as
-       frame data instead of extradata. */
-    if (!avctx->extradata)
-        return 0;
-
-    if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))
-        return -1;
-
-    /* initialize based on the demuxer-supplied streamdata header */
-    ff_flac_parse_streaminfo(avctx, (FLACStreaminfo *)s, streaminfo);
-    if (s->bps > 16)
-        avctx->sample_fmt = SAMPLE_FMT_S32;
-    else
-        avctx->sample_fmt = SAMPLE_FMT_S16;
-    allocate_buffers(s);
-    s->got_streaminfo = 1;
-
-    return 0;
-}
-
-static void dump_headers(AVCodecContext *avctx, FLACStreaminfo *s)
-{
-    av_log(avctx, AV_LOG_DEBUG, "  Max Blocksize: %d\n", s->max_blocksize);
-    av_log(avctx, AV_LOG_DEBUG, "  Max Framesize: %d\n", s->max_framesize);
-    av_log(avctx, AV_LOG_DEBUG, "  Samplerate: %d\n", s->samplerate);
-    av_log(avctx, AV_LOG_DEBUG, "  Channels: %d\n", s->channels);
-    av_log(avctx, AV_LOG_DEBUG, "  Bits: %d\n", s->bps);
-}
-
-static void allocate_buffers(FLACContext *s)
-{
-    int i;
-
-    assert(s->max_blocksize);
-
-    if (s->max_framesize == 0 && s->max_blocksize) {
-        s->max_framesize = ff_flac_get_max_frame_size(s->max_blocksize,
-                                                      s->channels, s->bps);
-    }
-
-    for (i = 0; i < s->channels; i++) {
-        s->decoded[i] = av_realloc(s->decoded[i],
-                                   sizeof(int32_t)*s->max_blocksize);
-    }
-
-    if (s->allocated_bitstream_size < s->max_framesize)
-        s->bitstream= av_fast_realloc(s->bitstream,
-                                      &s->allocated_bitstream_size,
-                                      s->max_framesize);
-}
-
-void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
-                              const uint8_t *buffer)
-{
-    GetBitContext gb;
-    init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8);
-
-    skip_bits(&gb, 16); /* skip min blocksize */
-    s->max_blocksize = get_bits(&gb, 16);
-    if (s->max_blocksize < FLAC_MIN_BLOCKSIZE) {
-        av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n",
-               s->max_blocksize);
-        s->max_blocksize = 16;
-    }
-
-    skip_bits(&gb, 24); /* skip min frame size */
-    s->max_framesize = get_bits_long(&gb, 24);
-
-    s->samplerate = get_bits_long(&gb, 20);
-    s->channels = get_bits(&gb, 3) + 1;
-    s->bps = get_bits(&gb, 5) + 1;
-
-    avctx->channels = s->channels;
-    avctx->sample_rate = s->samplerate;
-    avctx->bits_per_raw_sample = s->bps;
-
-    s->samples  = get_bits_long(&gb, 32) << 4;
-    s->samples |= get_bits(&gb, 4);
-
-    skip_bits_long(&gb, 64); /* md5 sum */
-    skip_bits_long(&gb, 64); /* md5 sum */
-
-    dump_headers(avctx, s);
-}
-
-void ff_flac_parse_block_header(const uint8_t *block_header,
-                                int *last, int *type, int *size)
-{
-    int tmp = bytestream_get_byte(&block_header);
-    if (last)
-        *last = tmp & 0x80;
-    if (type)
-        *type = tmp & 0x7F;
-    if (size)
-        *size = bytestream_get_be24(&block_header);
-}
-
-/**
- * Parse the STREAMINFO from an inline header.
- * @param s the flac decoding context
- * @param buf input buffer, starting with the "fLaC" marker
- * @param buf_size buffer size
- * @return non-zero if metadata is invalid
- */
-static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
-{
-    int metadata_type, metadata_size;
-
-    if (buf_size < FLAC_STREAMINFO_SIZE+8) {
-        /* need more data */
-        return 0;
-    }
-    ff_flac_parse_block_header(&buf[4], NULL, &metadata_type, &metadata_size);
-    if (metadata_type != FLAC_METADATA_TYPE_STREAMINFO ||
-        metadata_size != FLAC_STREAMINFO_SIZE) {
-        return AVERROR_INVALIDDATA;
-    }
-    ff_flac_parse_streaminfo(s->avctx, (FLACStreaminfo *)s, &buf[8]);
-    allocate_buffers(s);
-    s->got_streaminfo = 1;
-
-    return 0;
-}
-
-/**
- * Determine the size of an inline header.
- * @param buf input buffer, starting with the "fLaC" marker
- * @param buf_size buffer size
- * @return number of bytes in the header, or 0 if more data is needed
- */
-static int get_metadata_size(const uint8_t *buf, int buf_size)
-{
-    int metadata_last, metadata_size;
-    const uint8_t *buf_end = buf + buf_size;
-
-    buf += 4;
-    do {
-        ff_flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);
-        buf += 4;
-        if (buf + metadata_size > buf_end) {
-            /* need more data in order to read the complete header */
-            return 0;
-        }
-        buf += metadata_size;
-    } while (!metadata_last);
-
-    return buf_size - (buf_end - buf);
-}
-
-static int decode_residuals(FLACContext *s, int channel, int pred_order)
-{
-    int i, tmp, partition, method_type, rice_order;
-    int sample = 0, samples;
-
-    method_type = get_bits(&s->gb, 2);
-    if (method_type > 1) {
-        av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",
-               method_type);
-        return -1;
-    }
-
-    rice_order = get_bits(&s->gb, 4);
-
-    samples= s->blocksize >> rice_order;
-    if (pred_order > samples) {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",
-               pred_order, samples);
-        return -1;
-    }
-
-    sample=
-    i= pred_order;
-    for (partition = 0; partition < (1 << rice_order); partition++) {
-        tmp = get_bits(&s->gb, method_type == 0 ? 4 : 5);
-        if (tmp == (method_type == 0 ? 15 : 31)) {
-            tmp = get_bits(&s->gb, 5);
-            for (; i < samples; i++, sample++)
-                s->decoded[channel][sample] = get_sbits_long(&s->gb, tmp);
-        } else {
-            for (; i < samples; i++, sample++) {
-                s->decoded[channel][sample] = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
-            }
-        }
-        i= 0;
-    }
-
-    return 0;
-}
-
-static int decode_subframe_fixed(FLACContext *s, int channel, int pred_order)
-{
-    const int blocksize = s->blocksize;
-    int32_t *decoded = s->decoded[channel];
-    int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i;
-
-    /* warm up samples */
-    for (i = 0; i < pred_order; i++) {
-        decoded[i] = get_sbits_long(&s->gb, s->curr_bps);
-    }
-
-    if (decode_residuals(s, channel, pred_order) < 0)
-        return -1;
-
-    if (pred_order > 0)
-        a = decoded[pred_order-1];
-    if (pred_order > 1)
-        b = a - decoded[pred_order-2];
-    if (pred_order > 2)
-        c = b - decoded[pred_order-2] + decoded[pred_order-3];
-    if (pred_order > 3)
-        d = c - decoded[pred_order-2] + 2*decoded[pred_order-3] - decoded[pred_order-4];
-
-    switch (pred_order) {
-    case 0:
-        break;
-    case 1:
-        for (i = pred_order; i < blocksize; i++)
-            decoded[i] = a += decoded[i];
-        break;
-    case 2:
-        for (i = pred_order; i < blocksize; i++)
-            decoded[i] = a += b += decoded[i];
-        break;
-    case 3:
-        for (i = pred_order; i < blocksize; i++)
-            decoded[i] = a += b += c += decoded[i];
-        break;
-    case 4:
-        for (i = pred_order; i < blocksize; i++)
-            decoded[i] = a += b += c += d += decoded[i];
-        break;
-    default:
-        av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order);
-        return -1;
-    }
-
-    return 0;
-}
-
-static int decode_subframe_lpc(FLACContext *s, int channel, int pred_order)
-{
-    int i, j;
-    int coeff_prec, qlevel;
-    int coeffs[32];
-    int32_t *decoded = s->decoded[channel];
-
-    /* warm up samples */
-    for (i = 0; i < pred_order; i++) {
-        decoded[i] = get_sbits_long(&s->gb, s->curr_bps);
-    }
-
-    coeff_prec = get_bits(&s->gb, 4) + 1;
-    if (coeff_prec == 16) {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid coeff precision\n");
-        return -1;
-    }
-    qlevel = get_sbits(&s->gb, 5);
-    if (qlevel < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "qlevel %d not supported, maybe buggy stream\n",
-               qlevel);
-        return -1;
-    }
-
-    for (i = 0; i < pred_order; i++) {
-        coeffs[i] = get_sbits(&s->gb, coeff_prec);
-    }
-
-    if (decode_residuals(s, channel, pred_order) < 0)
-        return -1;
-
-    if (s->bps > 16) {
-        int64_t sum;
-        for (i = pred_order; i < s->blocksize; i++) {
-            sum = 0;
-            for (j = 0; j < pred_order; j++)
-                sum += (int64_t)coeffs[j] * decoded[i-j-1];
-            decoded[i] += sum >> qlevel;
-        }
-    } else {
-        for (i = pred_order; i < s->blocksize-1; i += 2) {
-            int c;
-            int d = decoded[i-pred_order];
-            int s0 = 0, s1 = 0;
-            for (j = pred_order-1; j > 0; j--) {
-                c = coeffs[j];
-                s0 += c*d;
-                d = decoded[i-j];
-                s1 += c*d;
-            }
-            c = coeffs[0];
-            s0 += c*d;
-            d = decoded[i] += s0 >> qlevel;
-            s1 += c*d;
-            decoded[i+1] += s1 >> qlevel;
-        }
-        if (i < s->blocksize) {
-            int sum = 0;
-            for (j = 0; j < pred_order; j++)
-                sum += coeffs[j] * decoded[i-j-1];
-            decoded[i] += sum >> qlevel;
-        }
-    }
-
-    return 0;
-}
-
-static inline int decode_subframe(FLACContext *s, int channel)
-{
-    int type, wasted = 0;
-    int i, tmp;
-
-    s->curr_bps = s->bps;
-    if (channel == 0) {
-        if (s->ch_mode == FLAC_CHMODE_RIGHT_SIDE)
-            s->curr_bps++;
-    } else {
-        if (s->ch_mode == FLAC_CHMODE_LEFT_SIDE || s->ch_mode == FLAC_CHMODE_MID_SIDE)
-            s->curr_bps++;
-    }
-
-    if (get_bits1(&s->gb)) {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n");
-        return -1;
-    }
-    type = get_bits(&s->gb, 6);
-
-    if (get_bits1(&s->gb)) {
-        wasted = 1;
-        while (!get_bits1(&s->gb))
-            wasted++;
-        s->curr_bps -= wasted;
-    }
-    if (s->curr_bps > 32) {
-        av_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);
-        return -1;
-    }
-
-//FIXME use av_log2 for types
-    if (type == 0) {
-        tmp = get_sbits_long(&s->gb, s->curr_bps);
-        for (i = 0; i < s->blocksize; i++)
-            s->decoded[channel][i] = tmp;
-    } else if (type == 1) {
-        for (i = 0; i < s->blocksize; i++)
-            s->decoded[channel][i] = get_sbits_long(&s->gb, s->curr_bps);
-    } else if ((type >= 8) && (type <= 12)) {
-        if (decode_subframe_fixed(s, channel, type & ~0x8) < 0)
-            return -1;
-    } else if (type >= 32) {
-        if (decode_subframe_lpc(s, channel, (type & ~0x20)+1) < 0)
-            return -1;
-    } else {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\n");
-        return -1;
-    }
-
-    if (wasted) {
-        int i;
-        for (i = 0; i < s->blocksize; i++)
-            s->decoded[channel][i] <<= wasted;
-    }
-
-    return 0;
-}
-
-/**
- * Validate and decode a frame header.
- * @param      avctx AVCodecContext to use as av_log() context
- * @param      gb    GetBitContext from which to read frame header
- * @param[out] fi    frame information
- * @return non-zero on error, 0 if ok
- */
-static int decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
-                               FLACFrameInfo *fi)
-{
-    int bs_code, sr_code, bps_code;
-
-    /* frame sync code */
-    skip_bits(gb, 16);
-
-    /* block size and sample rate codes */
-    bs_code = get_bits(gb, 4);
-    sr_code = get_bits(gb, 4);
-
-    /* channels and decorrelation */
-    fi->ch_mode = get_bits(gb, 4);
-    if (fi->ch_mode < FLAC_MAX_CHANNELS) {
-        fi->channels = fi->ch_mode + 1;
-        fi->ch_mode = FLAC_CHMODE_INDEPENDENT;
-    } else if (fi->ch_mode <= FLAC_CHMODE_MID_SIDE) {
-        fi->channels = 2;
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "invalid channel mode: %d\n", fi->ch_mode);
-        return -1;
-    }
-
-    /* bits per sample */
-    bps_code = get_bits(gb, 3);
-    if (bps_code == 3 || bps_code == 7) {
-        av_log(avctx, AV_LOG_ERROR, "invalid sample size code (%d)\n",
-               bps_code);
-        return -1;
-    }
-    fi->bps = sample_size_table[bps_code];
-
-    /* reserved bit */
-    if (get_bits1(gb)) {
-        av_log(avctx, AV_LOG_ERROR, "broken stream, invalid padding\n");
-        return -1;
-    }
-
-    /* sample or frame count */
-    if (get_utf8(gb) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "utf8 fscked\n");
-        return -1;
-    }
-
-    /* blocksize */
-    if (bs_code == 0) {
-        av_log(avctx, AV_LOG_ERROR, "reserved blocksize code: 0\n");
-        return -1;
-    } else if (bs_code == 6) {
-        fi->blocksize = get_bits(gb, 8) + 1;
-    } else if (bs_code == 7) {
-        fi->blocksize = get_bits(gb, 16) + 1;
-    } else {
-        fi->blocksize = ff_flac_blocksize_table[bs_code];
-    }
-
-    /* sample rate */
-    if (sr_code < 12) {
-        fi->samplerate = ff_flac_sample_rate_table[sr_code];
-    } else if (sr_code == 12) {
-        fi->samplerate = get_bits(gb, 8) * 1000;
-    } else if (sr_code == 13) {
-        fi->samplerate = get_bits(gb, 16);
-    } else if (sr_code == 14) {
-        fi->samplerate = get_bits(gb, 16) * 10;
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "illegal sample rate code %d\n",
-               sr_code);
-        return -1;
-    }
-
-    /* header CRC-8 check */
-    skip_bits(gb, 8);
-    if (av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, gb->buffer,
-               get_bits_count(gb)/8)) {
-        av_log(avctx, AV_LOG_ERROR, "header crc mismatch\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static int decode_frame(FLACContext *s)
-{
-    int i;
-    GetBitContext *gb = &s->gb;
-    FLACFrameInfo fi;
-
-    if (decode_frame_header(s->avctx, gb, &fi)) {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid frame header\n");
-        return -1;
-    }
-
-    if (fi.channels != s->channels) {
-        av_log(s->avctx, AV_LOG_ERROR, "switching channel layout mid-stream "
-                                       "is not supported\n");
-        return -1;
-    }
-    s->ch_mode = fi.ch_mode;
-
-    if (fi.bps && fi.bps != s->bps) {
-        av_log(s->avctx, AV_LOG_ERROR, "switching bps mid-stream is not "
-                                       "supported\n");
-        return -1;
-    }
-    if (s->bps > 16) {
-        s->avctx->sample_fmt = SAMPLE_FMT_S32;
-        s->sample_shift = 32 - s->bps;
-        s->is32 = 1;
-    } else {
-        s->avctx->sample_fmt = SAMPLE_FMT_S16;
-        s->sample_shift = 16 - s->bps;
-        s->is32 = 0;
-    }
-
-    if (fi.blocksize > s->max_blocksize) {
-        av_log(s->avctx, AV_LOG_ERROR, "blocksize %d > %d\n", fi.blocksize,
-               s->max_blocksize);
-        return -1;
-    }
-    s->blocksize = fi.blocksize;
-
-    if (fi.samplerate == 0) {
-        fi.samplerate = s->samplerate;
-    } else if (fi.samplerate != s->samplerate) {
-        av_log(s->avctx, AV_LOG_WARNING, "sample rate changed from %d to %d\n",
-               s->samplerate, fi.samplerate);
-    }
-    s->samplerate = s->avctx->sample_rate = fi.samplerate;
-
-//    dump_headers(s->avctx, (FLACStreaminfo *)s);
-
-    /* subframes */
-    for (i = 0; i < s->channels; i++) {
-        if (decode_subframe(s, i) < 0)
-            return -1;
-    }
-
-    align_get_bits(gb);
-
-    /* frame footer */
-    skip_bits(gb, 16); /* data crc */
-
-    return 0;
-}
-
-static int flac_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    FLACContext *s = avctx->priv_data;
-    int i, j = 0, input_buf_size = 0, bytes_read = 0;
-    int16_t *samples_16 = data;
-    int32_t *samples_32 = data;
-    int alloc_data_size= *data_size;
-    int output_size;
-
-    *data_size=0;
-
-    if (s->max_framesize == 0) {
-        s->max_framesize= FFMAX(4, buf_size); // should hopefully be enough for the first header
-        s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
-    }
-
-    if (1 && s->max_framesize) { //FIXME truncated
-        if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C'))
-            buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize));
-        input_buf_size= buf_size;
-
-        if (s->bitstream_size + buf_size < buf_size || s->bitstream_index + s->bitstream_size + buf_size < s->bitstream_index)
-            return -1;
-
-        if (s->allocated_bitstream_size < s->bitstream_size + buf_size)
-            s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->bitstream_size + buf_size);
-
-        if (s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size) {
-            memmove(s->bitstream, &s->bitstream[s->bitstream_index],
-                    s->bitstream_size);
-            s->bitstream_index=0;
-        }
-        memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size],
-               buf, buf_size);
-        buf= &s->bitstream[s->bitstream_index];
-        buf_size += s->bitstream_size;
-        s->bitstream_size= buf_size;
-
-        if (buf_size < s->max_framesize && input_buf_size) {
-            return input_buf_size;
-        }
-    }
-
-    /* check that there is at least the smallest decodable amount of data.
-       this amount corresponds to the smallest valid FLAC frame possible.
-       FF F8 69 02 00 00 9A 00 00 34 46 */
-    if (buf_size < 11)
-        goto end;
-
-    /* check for inline header */
-    if (AV_RB32(buf) == MKBETAG('f','L','a','C')) {
-        if (!s->got_streaminfo && parse_streaminfo(s, buf, buf_size)) {
-            av_log(s->avctx, AV_LOG_ERROR, "invalid header\n");
-            return -1;
-        }
-        bytes_read = get_metadata_size(buf, buf_size);
-        goto end;
-    }
-
-    /* check for frame sync code and resync stream if necessary */
-    if ((AV_RB16(buf) & 0xFFFE) != 0xFFF8) {
-        const uint8_t *buf_end = buf + buf_size;
-        av_log(s->avctx, AV_LOG_ERROR, "FRAME HEADER not here\n");
-        while (buf+2 < buf_end && (AV_RB16(buf) & 0xFFFE) != 0xFFF8)
-            buf++;
-        bytes_read = buf_size - (buf_end - buf);
-        goto end; // we may not have enough bits left to decode a frame, so try next time
-    }
-
-    /* decode frame */
-    init_get_bits(&s->gb, buf, buf_size*8);
-    if (decode_frame(s) < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n");
-        s->bitstream_size=0;
-        s->bitstream_index=0;
-        return -1;
-    }
-    bytes_read = (get_bits_count(&s->gb)+7)/8;
-
-    /* check if allocated data size is large enough for output */
-    output_size = s->blocksize * s->channels * (s->is32 ? 4 : 2);
-    if (output_size > alloc_data_size) {
-        av_log(s->avctx, AV_LOG_ERROR, "output data size is larger than "
-                                       "allocated data size\n");
-        goto end;
-    }
-    *data_size = output_size;
-
-#define DECORRELATE(left, right)\
-            assert(s->channels == 2);\
-            for (i = 0; i < s->blocksize; i++) {\
-                int a= s->decoded[0][i];\
-                int b= s->decoded[1][i];\
-                if (s->is32) {\
-                    *samples_32++ = (left)  << s->sample_shift;\
-                    *samples_32++ = (right) << s->sample_shift;\
-                } else {\
-                    *samples_16++ = (left)  << s->sample_shift;\
-                    *samples_16++ = (right) << s->sample_shift;\
-                }\
-            }\
-            break;
-
-    switch (s->ch_mode) {
-    case FLAC_CHMODE_INDEPENDENT:
-        for (j = 0; j < s->blocksize; j++) {
-            for (i = 0; i < s->channels; i++) {
-                if (s->is32)
-                    *samples_32++ = s->decoded[i][j] << s->sample_shift;
-                else
-                    *samples_16++ = s->decoded[i][j] << s->sample_shift;
-            }
-        }
-        break;
-    case FLAC_CHMODE_LEFT_SIDE:
-        DECORRELATE(a,a-b)
-    case FLAC_CHMODE_RIGHT_SIDE:
-        DECORRELATE(a+b,b)
-    case FLAC_CHMODE_MID_SIDE:
-        DECORRELATE( (a-=b>>1) + b, a)
-    }
-
-end:
-    if (bytes_read > buf_size) {
-        av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", bytes_read - buf_size);
-        s->bitstream_size=0;
-        s->bitstream_index=0;
-        return -1;
-    }
-
-    if (s->bitstream_size) {
-        s->bitstream_index += bytes_read;
-        s->bitstream_size  -= bytes_read;
-        return input_buf_size;
-    } else
-        return bytes_read;
-}
-
-static av_cold int flac_decode_close(AVCodecContext *avctx)
-{
-    FLACContext *s = avctx->priv_data;
-    int i;
-
-    for (i = 0; i < s->channels; i++) {
-        av_freep(&s->decoded[i]);
-    }
-    av_freep(&s->bitstream);
-
-    return 0;
-}
-
-static void flac_flush(AVCodecContext *avctx)
-{
-    FLACContext *s = avctx->priv_data;
-
-    s->bitstream_size=
-    s->bitstream_index= 0;
-}
-
-AVCodec flac_decoder = {
-    "flac",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_FLAC,
-    sizeof(FLACContext),
-    flac_decode_init,
-    NULL,
-    flac_decode_close,
-    flac_decode_frame,
-    CODEC_CAP_DELAY | CODEC_CAP_SUBFRAMES, /* FIXME: add a FLAC parser so that
-                                              we will not need to use either
-                                              of these capabilities */
-    .flush= flac_flush,
-    .long_name= NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
-};
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
deleted file mode 100644
index 89d40d5..0000000
--- a/libavcodec/flacenc.c
+++ /dev/null
@@ -1,1266 +0,0 @@
-/**
- * FLAC audio encoder
- * Copyright (c) 2006  Justin Ruggles <justin.ruggles at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/crc.h"
-#include "libavutil/md5.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "golomb.h"
-#include "lpc.h"
-#include "flac.h"
-#include "flacdata.h"
-
-#define FLAC_SUBFRAME_CONSTANT  0
-#define FLAC_SUBFRAME_VERBATIM  1
-#define FLAC_SUBFRAME_FIXED     8
-#define FLAC_SUBFRAME_LPC      32
-
-#define MAX_FIXED_ORDER     4
-#define MAX_PARTITION_ORDER 8
-#define MAX_PARTITIONS     (1 << MAX_PARTITION_ORDER)
-#define MAX_LPC_PRECISION  15
-#define MAX_LPC_SHIFT      15
-#define MAX_RICE_PARAM     14
-
-typedef struct CompressionOptions {
-    int compression_level;
-    int block_time_ms;
-    int use_lpc;
-    int lpc_coeff_precision;
-    int min_prediction_order;
-    int max_prediction_order;
-    int prediction_order_method;
-    int min_partition_order;
-    int max_partition_order;
-} CompressionOptions;
-
-typedef struct RiceContext {
-    int porder;
-    int params[MAX_PARTITIONS];
-} RiceContext;
-
-typedef struct FlacSubframe {
-    int type;
-    int type_code;
-    int obits;
-    int order;
-    int32_t coefs[MAX_LPC_ORDER];
-    int shift;
-    RiceContext rc;
-    int32_t samples[FLAC_MAX_BLOCKSIZE];
-    int32_t residual[FLAC_MAX_BLOCKSIZE+1];
-} FlacSubframe;
-
-typedef struct FlacFrame {
-    FlacSubframe subframes[FLAC_MAX_CHANNELS];
-    int blocksize;
-    int bs_code[2];
-    uint8_t crc8;
-    int ch_mode;
-} FlacFrame;
-
-typedef struct FlacEncodeContext {
-    PutBitContext pb;
-    int channels;
-    int samplerate;
-    int sr_code[2];
-    int max_blocksize;
-    int min_framesize;
-    int max_framesize;
-    int max_encoded_framesize;
-    uint32_t frame_count;
-    uint64_t sample_count;
-    uint8_t md5sum[16];
-    FlacFrame frame;
-    CompressionOptions options;
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    struct AVMD5 *md5ctx;
-} FlacEncodeContext;
-
-/**
- * Writes streaminfo metadata block to byte array
- */
-static void write_streaminfo(FlacEncodeContext *s, uint8_t *header)
-{
-    PutBitContext pb;
-
-    memset(header, 0, FLAC_STREAMINFO_SIZE);
-    init_put_bits(&pb, header, FLAC_STREAMINFO_SIZE);
-
-    /* streaminfo metadata block */
-    put_bits(&pb, 16, s->max_blocksize);
-    put_bits(&pb, 16, s->max_blocksize);
-    put_bits(&pb, 24, s->min_framesize);
-    put_bits(&pb, 24, s->max_framesize);
-    put_bits(&pb, 20, s->samplerate);
-    put_bits(&pb, 3, s->channels-1);
-    put_bits(&pb, 5, 15);       /* bits per sample - 1 */
-    /* write 36-bit sample count in 2 put_bits() calls */
-    put_bits(&pb, 24, (s->sample_count & 0xFFFFFF000LL) >> 12);
-    put_bits(&pb, 12,  s->sample_count & 0x000000FFFLL);
-    flush_put_bits(&pb);
-    memcpy(&header[18], s->md5sum, 16);
-}
-
-/**
- * Sets blocksize based on samplerate
- * Chooses the closest predefined blocksize >= BLOCK_TIME_MS milliseconds
- */
-static int select_blocksize(int samplerate, int block_time_ms)
-{
-    int i;
-    int target;
-    int blocksize;
-
-    assert(samplerate > 0);
-    blocksize = ff_flac_blocksize_table[1];
-    target = (samplerate * block_time_ms) / 1000;
-    for(i=0; i<16; i++) {
-        if(target >= ff_flac_blocksize_table[i] && ff_flac_blocksize_table[i] > blocksize) {
-            blocksize = ff_flac_blocksize_table[i];
-        }
-    }
-    return blocksize;
-}
-
-static av_cold int flac_encode_init(AVCodecContext *avctx)
-{
-    int freq = avctx->sample_rate;
-    int channels = avctx->channels;
-    FlacEncodeContext *s = avctx->priv_data;
-    int i, level;
-    uint8_t *streaminfo;
-
-    s->avctx = avctx;
-
-    dsputil_init(&s->dsp, avctx);
-
-    if(avctx->sample_fmt != SAMPLE_FMT_S16) {
-        return -1;
-    }
-
-    if(channels < 1 || channels > FLAC_MAX_CHANNELS) {
-        return -1;
-    }
-    s->channels = channels;
-
-    /* find samplerate in table */
-    if(freq < 1)
-        return -1;
-    for(i=4; i<12; i++) {
-        if(freq == ff_flac_sample_rate_table[i]) {
-            s->samplerate = ff_flac_sample_rate_table[i];
-            s->sr_code[0] = i;
-            s->sr_code[1] = 0;
-            break;
-        }
-    }
-    /* if not in table, samplerate is non-standard */
-    if(i == 12) {
-        if(freq % 1000 == 0 && freq < 255000) {
-            s->sr_code[0] = 12;
-            s->sr_code[1] = freq / 1000;
-        } else if(freq % 10 == 0 && freq < 655350) {
-            s->sr_code[0] = 14;
-            s->sr_code[1] = freq / 10;
-        } else if(freq < 65535) {
-            s->sr_code[0] = 13;
-            s->sr_code[1] = freq;
-        } else {
-            return -1;
-        }
-        s->samplerate = freq;
-    }
-
-    /* set compression option defaults based on avctx->compression_level */
-    if(avctx->compression_level < 0) {
-        s->options.compression_level = 5;
-    } else {
-        s->options.compression_level = avctx->compression_level;
-    }
-    av_log(avctx, AV_LOG_DEBUG, " compression: %d\n", s->options.compression_level);
-
-    level= s->options.compression_level;
-    if(level > 12) {
-        av_log(avctx, AV_LOG_ERROR, "invalid compression level: %d\n",
-               s->options.compression_level);
-        return -1;
-    }
-
-    s->options.block_time_ms       = ((int[]){ 27, 27, 27,105,105,105,105,105,105,105,105,105,105})[level];
-    s->options.use_lpc             = ((int[]){  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1})[level];
-    s->options.min_prediction_order= ((int[]){  2,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1})[level];
-    s->options.max_prediction_order= ((int[]){  3,  4,  4,  6,  8,  8,  8,  8, 12, 12, 12, 32, 32})[level];
-    s->options.prediction_order_method = ((int[]){ ORDER_METHOD_EST,    ORDER_METHOD_EST,    ORDER_METHOD_EST,
-                                                   ORDER_METHOD_EST,    ORDER_METHOD_EST,    ORDER_METHOD_EST,
-                                                   ORDER_METHOD_4LEVEL, ORDER_METHOD_LOG,    ORDER_METHOD_4LEVEL,
-                                                   ORDER_METHOD_LOG,    ORDER_METHOD_SEARCH, ORDER_METHOD_LOG,
-                                                   ORDER_METHOD_SEARCH})[level];
-    s->options.min_partition_order = ((int[]){  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0})[level];
-    s->options.max_partition_order = ((int[]){  2,  2,  3,  3,  3,  8,  8,  8,  8,  8,  8,  8,  8})[level];
-
-    /* set compression option overrides from AVCodecContext */
-    if(avctx->use_lpc >= 0) {
-        s->options.use_lpc = av_clip(avctx->use_lpc, 0, 11);
-    }
-    if(s->options.use_lpc == 1)
-        av_log(avctx, AV_LOG_DEBUG, " use lpc: Levinson-Durbin recursion with Welch window\n");
-    else if(s->options.use_lpc > 1)
-        av_log(avctx, AV_LOG_DEBUG, " use lpc: Cholesky factorization\n");
-
-    if(avctx->min_prediction_order >= 0) {
-        if(s->options.use_lpc) {
-            if(avctx->min_prediction_order < MIN_LPC_ORDER ||
-                    avctx->min_prediction_order > MAX_LPC_ORDER) {
-                av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
-                       avctx->min_prediction_order);
-                return -1;
-            }
-        } else {
-            if(avctx->min_prediction_order > MAX_FIXED_ORDER) {
-                av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n",
-                       avctx->min_prediction_order);
-                return -1;
-            }
-        }
-        s->options.min_prediction_order = avctx->min_prediction_order;
-    }
-    if(avctx->max_prediction_order >= 0) {
-        if(s->options.use_lpc) {
-            if(avctx->max_prediction_order < MIN_LPC_ORDER ||
-                    avctx->max_prediction_order > MAX_LPC_ORDER) {
-                av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
-                       avctx->max_prediction_order);
-                return -1;
-            }
-        } else {
-            if(avctx->max_prediction_order > MAX_FIXED_ORDER) {
-                av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n",
-                       avctx->max_prediction_order);
-                return -1;
-            }
-        }
-        s->options.max_prediction_order = avctx->max_prediction_order;
-    }
-    if(s->options.max_prediction_order < s->options.min_prediction_order) {
-        av_log(avctx, AV_LOG_ERROR, "invalid prediction orders: min=%d max=%d\n",
-               s->options.min_prediction_order, s->options.max_prediction_order);
-        return -1;
-    }
-    av_log(avctx, AV_LOG_DEBUG, " prediction order: %d, %d\n",
-           s->options.min_prediction_order, s->options.max_prediction_order);
-
-    if(avctx->prediction_order_method >= 0) {
-        if(avctx->prediction_order_method > ORDER_METHOD_LOG) {
-            av_log(avctx, AV_LOG_ERROR, "invalid prediction order method: %d\n",
-                   avctx->prediction_order_method);
-            return -1;
-        }
-        s->options.prediction_order_method = avctx->prediction_order_method;
-    }
-    switch(s->options.prediction_order_method) {
-        case ORDER_METHOD_EST:    av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
-                                         "estimate"); break;
-        case ORDER_METHOD_2LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
-                                         "2-level"); break;
-        case ORDER_METHOD_4LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
-                                         "4-level"); break;
-        case ORDER_METHOD_8LEVEL: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
-                                         "8-level"); break;
-        case ORDER_METHOD_SEARCH: av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
-                                         "full search"); break;
-        case ORDER_METHOD_LOG:    av_log(avctx, AV_LOG_DEBUG, " order method: %s\n",
-                                         "log search"); break;
-    }
-
-    if(avctx->min_partition_order >= 0) {
-        if(avctx->min_partition_order > MAX_PARTITION_ORDER) {
-            av_log(avctx, AV_LOG_ERROR, "invalid min partition order: %d\n",
-                   avctx->min_partition_order);
-            return -1;
-        }
-        s->options.min_partition_order = avctx->min_partition_order;
-    }
-    if(avctx->max_partition_order >= 0) {
-        if(avctx->max_partition_order > MAX_PARTITION_ORDER) {
-            av_log(avctx, AV_LOG_ERROR, "invalid max partition order: %d\n",
-                   avctx->max_partition_order);
-            return -1;
-        }
-        s->options.max_partition_order = avctx->max_partition_order;
-    }
-    if(s->options.max_partition_order < s->options.min_partition_order) {
-        av_log(avctx, AV_LOG_ERROR, "invalid partition orders: min=%d max=%d\n",
-               s->options.min_partition_order, s->options.max_partition_order);
-        return -1;
-    }
-    av_log(avctx, AV_LOG_DEBUG, " partition order: %d, %d\n",
-           s->options.min_partition_order, s->options.max_partition_order);
-
-    if(avctx->frame_size > 0) {
-        if(avctx->frame_size < FLAC_MIN_BLOCKSIZE ||
-                avctx->frame_size > FLAC_MAX_BLOCKSIZE) {
-            av_log(avctx, AV_LOG_ERROR, "invalid block size: %d\n",
-                   avctx->frame_size);
-            return -1;
-        }
-    } else {
-        s->avctx->frame_size = select_blocksize(s->samplerate, s->options.block_time_ms);
-    }
-    s->max_blocksize = s->avctx->frame_size;
-    av_log(avctx, AV_LOG_DEBUG, " block size: %d\n", s->avctx->frame_size);
-
-    /* set LPC precision */
-    if(avctx->lpc_coeff_precision > 0) {
-        if(avctx->lpc_coeff_precision > MAX_LPC_PRECISION) {
-            av_log(avctx, AV_LOG_ERROR, "invalid lpc coeff precision: %d\n",
-                   avctx->lpc_coeff_precision);
-            return -1;
-        }
-        s->options.lpc_coeff_precision = avctx->lpc_coeff_precision;
-    } else {
-        /* default LPC precision */
-        s->options.lpc_coeff_precision = 15;
-    }
-    av_log(avctx, AV_LOG_DEBUG, " lpc precision: %d\n",
-           s->options.lpc_coeff_precision);
-
-    /* set maximum encoded frame size in verbatim mode */
-    s->max_framesize = ff_flac_get_max_frame_size(s->avctx->frame_size,
-                                                  s->channels, 16);
-
-    /* initialize MD5 context */
-    s->md5ctx = av_malloc(av_md5_size);
-    if(!s->md5ctx)
-        return AVERROR(ENOMEM);
-    av_md5_init(s->md5ctx);
-
-    streaminfo = av_malloc(FLAC_STREAMINFO_SIZE);
-    write_streaminfo(s, streaminfo);
-    avctx->extradata = streaminfo;
-    avctx->extradata_size = FLAC_STREAMINFO_SIZE;
-
-    s->frame_count = 0;
-    s->min_framesize = s->max_framesize;
-
-    avctx->coded_frame = avcodec_alloc_frame();
-    avctx->coded_frame->key_frame = 1;
-
-    return 0;
-}
-
-static void init_frame(FlacEncodeContext *s)
-{
-    int i, ch;
-    FlacFrame *frame;
-
-    frame = &s->frame;
-
-    for(i=0; i<16; i++) {
-        if(s->avctx->frame_size == ff_flac_blocksize_table[i]) {
-            frame->blocksize = ff_flac_blocksize_table[i];
-            frame->bs_code[0] = i;
-            frame->bs_code[1] = 0;
-            break;
-        }
-    }
-    if(i == 16) {
-        frame->blocksize = s->avctx->frame_size;
-        if(frame->blocksize <= 256) {
-            frame->bs_code[0] = 6;
-            frame->bs_code[1] = frame->blocksize-1;
-        } else {
-            frame->bs_code[0] = 7;
-            frame->bs_code[1] = frame->blocksize-1;
-        }
-    }
-
-    for(ch=0; ch<s->channels; ch++) {
-        frame->subframes[ch].obits = 16;
-    }
-}
-
-/**
- * Copy channel-interleaved input samples into separate subframes
- */
-static void copy_samples(FlacEncodeContext *s, int16_t *samples)
-{
-    int i, j, ch;
-    FlacFrame *frame;
-
-    frame = &s->frame;
-    for(i=0,j=0; i<frame->blocksize; i++) {
-        for(ch=0; ch<s->channels; ch++,j++) {
-            frame->subframes[ch].samples[i] = samples[j];
-        }
-    }
-}
-
-
-#define rice_encode_count(sum, n, k) (((n)*((k)+1))+((sum-(n>>1))>>(k)))
-
-/**
- * Solve for d/dk(rice_encode_count) = n-((sum-(n>>1))>>(k+1)) = 0
- */
-static int find_optimal_param(uint32_t sum, int n)
-{
-    int k;
-    uint32_t sum2;
-
-    if(sum <= n>>1)
-        return 0;
-    sum2 = sum-(n>>1);
-    k = av_log2(n<256 ? FASTDIV(sum2,n) : sum2/n);
-    return FFMIN(k, MAX_RICE_PARAM);
-}
-
-static uint32_t calc_optimal_rice_params(RiceContext *rc, int porder,
-                                         uint32_t *sums, int n, int pred_order)
-{
-    int i;
-    int k, cnt, part;
-    uint32_t all_bits;
-
-    part = (1 << porder);
-    all_bits = 4 * part;
-
-    cnt = (n >> porder) - pred_order;
-    for(i=0; i<part; i++) {
-        k = find_optimal_param(sums[i], cnt);
-        rc->params[i] = k;
-        all_bits += rice_encode_count(sums[i], cnt, k);
-        cnt = n >> porder;
-    }
-
-    rc->porder = porder;
-
-    return all_bits;
-}
-
-static void calc_sums(int pmin, int pmax, uint32_t *data, int n, int pred_order,
-                      uint32_t sums[][MAX_PARTITIONS])
-{
-    int i, j;
-    int parts;
-    uint32_t *res, *res_end;
-
-    /* sums for highest level */
-    parts = (1 << pmax);
-    res = &data[pred_order];
-    res_end = &data[n >> pmax];
-    for(i=0; i<parts; i++) {
-        uint32_t sum = 0;
-        while(res < res_end){
-            sum += *(res++);
-        }
-        sums[pmax][i] = sum;
-        res_end+= n >> pmax;
-    }
-    /* sums for lower levels */
-    for(i=pmax-1; i>=pmin; i--) {
-        parts = (1 << i);
-        for(j=0; j<parts; j++) {
-            sums[i][j] = sums[i+1][2*j] + sums[i+1][2*j+1];
-        }
-    }
-}
-
-static uint32_t calc_rice_params(RiceContext *rc, int pmin, int pmax,
-                                 int32_t *data, int n, int pred_order)
-{
-    int i;
-    uint32_t bits[MAX_PARTITION_ORDER+1];
-    int opt_porder;
-    RiceContext tmp_rc;
-    uint32_t *udata;
-    uint32_t sums[MAX_PARTITION_ORDER+1][MAX_PARTITIONS];
-
-    assert(pmin >= 0 && pmin <= MAX_PARTITION_ORDER);
-    assert(pmax >= 0 && pmax <= MAX_PARTITION_ORDER);
-    assert(pmin <= pmax);
-
-    udata = av_malloc(n * sizeof(uint32_t));
-    for(i=0; i<n; i++) {
-        udata[i] = (2*data[i]) ^ (data[i]>>31);
-    }
-
-    calc_sums(pmin, pmax, udata, n, pred_order, sums);
-
-    opt_porder = pmin;
-    bits[pmin] = UINT32_MAX;
-    for(i=pmin; i<=pmax; i++) {
-        bits[i] = calc_optimal_rice_params(&tmp_rc, i, sums[i], n, pred_order);
-        if(bits[i] <= bits[opt_porder]) {
-            opt_porder = i;
-            *rc= tmp_rc;
-        }
-    }
-
-    av_freep(&udata);
-    return bits[opt_porder];
-}
-
-static int get_max_p_order(int max_porder, int n, int order)
-{
-    int porder = FFMIN(max_porder, av_log2(n^(n-1)));
-    if(order > 0)
-        porder = FFMIN(porder, av_log2(n/order));
-    return porder;
-}
-
-static uint32_t calc_rice_params_fixed(RiceContext *rc, int pmin, int pmax,
-                                       int32_t *data, int n, int pred_order,
-                                       int bps)
-{
-    uint32_t bits;
-    pmin = get_max_p_order(pmin, n, pred_order);
-    pmax = get_max_p_order(pmax, n, pred_order);
-    bits = pred_order*bps + 6;
-    bits += calc_rice_params(rc, pmin, pmax, data, n, pred_order);
-    return bits;
-}
-
-static uint32_t calc_rice_params_lpc(RiceContext *rc, int pmin, int pmax,
-                                     int32_t *data, int n, int pred_order,
-                                     int bps, int precision)
-{
-    uint32_t bits;
-    pmin = get_max_p_order(pmin, n, pred_order);
-    pmax = get_max_p_order(pmax, n, pred_order);
-    bits = pred_order*bps + 4 + 5 + pred_order*precision + 6;
-    bits += calc_rice_params(rc, pmin, pmax, data, n, pred_order);
-    return bits;
-}
-
-static void encode_residual_verbatim(int32_t *res, int32_t *smp, int n)
-{
-    assert(n > 0);
-    memcpy(res, smp, n * sizeof(int32_t));
-}
-
-static void encode_residual_fixed(int32_t *res, const int32_t *smp, int n,
-                                  int order)
-{
-    int i;
-
-    for(i=0; i<order; i++) {
-        res[i] = smp[i];
-    }
-
-    if(order==0){
-        for(i=order; i<n; i++)
-            res[i]= smp[i];
-    }else if(order==1){
-        for(i=order; i<n; i++)
-            res[i]= smp[i] - smp[i-1];
-    }else if(order==2){
-        int a = smp[order-1] - smp[order-2];
-        for(i=order; i<n; i+=2) {
-            int b = smp[i] - smp[i-1];
-            res[i]= b - a;
-            a = smp[i+1] - smp[i];
-            res[i+1]= a - b;
-        }
-    }else if(order==3){
-        int a = smp[order-1] - smp[order-2];
-        int c = smp[order-1] - 2*smp[order-2] + smp[order-3];
-        for(i=order; i<n; i+=2) {
-            int b = smp[i] - smp[i-1];
-            int d = b - a;
-            res[i]= d - c;
-            a = smp[i+1] - smp[i];
-            c = a - b;
-            res[i+1]= c - d;
-        }
-    }else{
-        int a = smp[order-1] - smp[order-2];
-        int c = smp[order-1] - 2*smp[order-2] + smp[order-3];
-        int e = smp[order-1] - 3*smp[order-2] + 3*smp[order-3] - smp[order-4];
-        for(i=order; i<n; i+=2) {
-            int b = smp[i] - smp[i-1];
-            int d = b - a;
-            int f = d - c;
-            res[i]= f - e;
-            a = smp[i+1] - smp[i];
-            c = a - b;
-            e = c - d;
-            res[i+1]= e - f;
-        }
-    }
-}
-
-#define LPC1(x) {\
-    int c = coefs[(x)-1];\
-    p0 += c*s;\
-    s = smp[i-(x)+1];\
-    p1 += c*s;\
-}
-
-static av_always_inline void encode_residual_lpc_unrolled(
-    int32_t *res, const int32_t *smp, int n,
-    int order, const int32_t *coefs, int shift, int big)
-{
-    int i;
-    for(i=order; i<n; i+=2) {
-        int s = smp[i-order];
-        int p0 = 0, p1 = 0;
-        if(big) {
-            switch(order) {
-                case 32: LPC1(32)
-                case 31: LPC1(31)
-                case 30: LPC1(30)
-                case 29: LPC1(29)
-                case 28: LPC1(28)
-                case 27: LPC1(27)
-                case 26: LPC1(26)
-                case 25: LPC1(25)
-                case 24: LPC1(24)
-                case 23: LPC1(23)
-                case 22: LPC1(22)
-                case 21: LPC1(21)
-                case 20: LPC1(20)
-                case 19: LPC1(19)
-                case 18: LPC1(18)
-                case 17: LPC1(17)
-                case 16: LPC1(16)
-                case 15: LPC1(15)
-                case 14: LPC1(14)
-                case 13: LPC1(13)
-                case 12: LPC1(12)
-                case 11: LPC1(11)
-                case 10: LPC1(10)
-                case  9: LPC1( 9)
-                         LPC1( 8)
-                         LPC1( 7)
-                         LPC1( 6)
-                         LPC1( 5)
-                         LPC1( 4)
-                         LPC1( 3)
-                         LPC1( 2)
-                         LPC1( 1)
-            }
-        } else {
-            switch(order) {
-                case  8: LPC1( 8)
-                case  7: LPC1( 7)
-                case  6: LPC1( 6)
-                case  5: LPC1( 5)
-                case  4: LPC1( 4)
-                case  3: LPC1( 3)
-                case  2: LPC1( 2)
-                case  1: LPC1( 1)
-            }
-        }
-        res[i  ] = smp[i  ] - (p0 >> shift);
-        res[i+1] = smp[i+1] - (p1 >> shift);
-    }
-}
-
-static void encode_residual_lpc(int32_t *res, const int32_t *smp, int n,
-                                int order, const int32_t *coefs, int shift)
-{
-    int i;
-    for(i=0; i<order; i++) {
-        res[i] = smp[i];
-    }
-#if CONFIG_SMALL
-    for(i=order; i<n; i+=2) {
-        int j;
-        int s = smp[i];
-        int p0 = 0, p1 = 0;
-        for(j=0; j<order; j++) {
-            int c = coefs[j];
-            p1 += c*s;
-            s = smp[i-j-1];
-            p0 += c*s;
-        }
-        res[i  ] = smp[i  ] - (p0 >> shift);
-        res[i+1] = smp[i+1] - (p1 >> shift);
-    }
-#else
-    switch(order) {
-        case  1: encode_residual_lpc_unrolled(res, smp, n, 1, coefs, shift, 0); break;
-        case  2: encode_residual_lpc_unrolled(res, smp, n, 2, coefs, shift, 0); break;
-        case  3: encode_residual_lpc_unrolled(res, smp, n, 3, coefs, shift, 0); break;
-        case  4: encode_residual_lpc_unrolled(res, smp, n, 4, coefs, shift, 0); break;
-        case  5: encode_residual_lpc_unrolled(res, smp, n, 5, coefs, shift, 0); break;
-        case  6: encode_residual_lpc_unrolled(res, smp, n, 6, coefs, shift, 0); break;
-        case  7: encode_residual_lpc_unrolled(res, smp, n, 7, coefs, shift, 0); break;
-        case  8: encode_residual_lpc_unrolled(res, smp, n, 8, coefs, shift, 0); break;
-        default: encode_residual_lpc_unrolled(res, smp, n, order, coefs, shift, 1); break;
-    }
-#endif
-}
-
-static int encode_residual(FlacEncodeContext *ctx, int ch)
-{
-    int i, n;
-    int min_order, max_order, opt_order, precision, omethod;
-    int min_porder, max_porder;
-    FlacFrame *frame;
-    FlacSubframe *sub;
-    int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER];
-    int shift[MAX_LPC_ORDER];
-    int32_t *res, *smp;
-
-    frame = &ctx->frame;
-    sub = &frame->subframes[ch];
-    res = sub->residual;
-    smp = sub->samples;
-    n = frame->blocksize;
-
-    /* CONSTANT */
-    for(i=1; i<n; i++) {
-        if(smp[i] != smp[0]) break;
-    }
-    if(i == n) {
-        sub->type = sub->type_code = FLAC_SUBFRAME_CONSTANT;
-        res[0] = smp[0];
-        return sub->obits;
-    }
-
-    /* VERBATIM */
-    if(n < 5) {
-        sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM;
-        encode_residual_verbatim(res, smp, n);
-        return sub->obits * n;
-    }
-
-    min_order = ctx->options.min_prediction_order;
-    max_order = ctx->options.max_prediction_order;
-    min_porder = ctx->options.min_partition_order;
-    max_porder = ctx->options.max_partition_order;
-    precision = ctx->options.lpc_coeff_precision;
-    omethod = ctx->options.prediction_order_method;
-
-    /* FIXED */
-    if(!ctx->options.use_lpc || max_order == 0 || (n <= max_order)) {
-        uint32_t bits[MAX_FIXED_ORDER+1];
-        if(max_order > MAX_FIXED_ORDER) max_order = MAX_FIXED_ORDER;
-        opt_order = 0;
-        bits[0] = UINT32_MAX;
-        for(i=min_order; i<=max_order; i++) {
-            encode_residual_fixed(res, smp, n, i);
-            bits[i] = calc_rice_params_fixed(&sub->rc, min_porder, max_porder, res,
-                                             n, i, sub->obits);
-            if(bits[i] < bits[opt_order]) {
-                opt_order = i;
-            }
-        }
-        sub->order = opt_order;
-        sub->type = FLAC_SUBFRAME_FIXED;
-        sub->type_code = sub->type | sub->order;
-        if(sub->order != max_order) {
-            encode_residual_fixed(res, smp, n, sub->order);
-            return calc_rice_params_fixed(&sub->rc, min_porder, max_porder, res, n,
-                                          sub->order, sub->obits);
-        }
-        return bits[sub->order];
-    }
-
-    /* LPC */
-    opt_order = ff_lpc_calc_coefs(&ctx->dsp, smp, n, min_order, max_order,
-                                  precision, coefs, shift, ctx->options.use_lpc,
-                                  omethod, MAX_LPC_SHIFT, 0);
-
-    if(omethod == ORDER_METHOD_2LEVEL ||
-       omethod == ORDER_METHOD_4LEVEL ||
-       omethod == ORDER_METHOD_8LEVEL) {
-        int levels = 1 << omethod;
-        uint32_t bits[levels];
-        int order;
-        int opt_index = levels-1;
-        opt_order = max_order-1;
-        bits[opt_index] = UINT32_MAX;
-        for(i=levels-1; i>=0; i--) {
-            order = min_order + (((max_order-min_order+1) * (i+1)) / levels)-1;
-            if(order < 0) order = 0;
-            encode_residual_lpc(res, smp, n, order+1, coefs[order], shift[order]);
-            bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
-                                           res, n, order+1, sub->obits, precision);
-            if(bits[i] < bits[opt_index]) {
-                opt_index = i;
-                opt_order = order;
-            }
-        }
-        opt_order++;
-    } else if(omethod == ORDER_METHOD_SEARCH) {
-        // brute-force optimal order search
-        uint32_t bits[MAX_LPC_ORDER];
-        opt_order = 0;
-        bits[0] = UINT32_MAX;
-        for(i=min_order-1; i<max_order; i++) {
-            encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
-            bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
-                                           res, n, i+1, sub->obits, precision);
-            if(bits[i] < bits[opt_order]) {
-                opt_order = i;
-            }
-        }
-        opt_order++;
-    } else if(omethod == ORDER_METHOD_LOG) {
-        uint32_t bits[MAX_LPC_ORDER];
-        int step;
-
-        opt_order= min_order - 1 + (max_order-min_order)/3;
-        memset(bits, -1, sizeof(bits));
-
-        for(step=16 ;step; step>>=1){
-            int last= opt_order;
-            for(i=last-step; i<=last+step; i+= step){
-                if(i<min_order-1 || i>=max_order || bits[i] < UINT32_MAX)
-                    continue;
-                encode_residual_lpc(res, smp, n, i+1, coefs[i], shift[i]);
-                bits[i] = calc_rice_params_lpc(&sub->rc, min_porder, max_porder,
-                                            res, n, i+1, sub->obits, precision);
-                if(bits[i] < bits[opt_order])
-                    opt_order= i;
-            }
-        }
-        opt_order++;
-    }
-
-    sub->order = opt_order;
-    sub->type = FLAC_SUBFRAME_LPC;
-    sub->type_code = sub->type | (sub->order-1);
-    sub->shift = shift[sub->order-1];
-    for(i=0; i<sub->order; i++) {
-        sub->coefs[i] = coefs[sub->order-1][i];
-    }
-    encode_residual_lpc(res, smp, n, sub->order, sub->coefs, sub->shift);
-    return calc_rice_params_lpc(&sub->rc, min_porder, max_porder, res, n, sub->order,
-                                sub->obits, precision);
-}
-
-static int encode_residual_v(FlacEncodeContext *ctx, int ch)
-{
-    int i, n;
-    FlacFrame *frame;
-    FlacSubframe *sub;
-    int32_t *res, *smp;
-
-    frame = &ctx->frame;
-    sub = &frame->subframes[ch];
-    res = sub->residual;
-    smp = sub->samples;
-    n = frame->blocksize;
-
-    /* CONSTANT */
-    for(i=1; i<n; i++) {
-        if(smp[i] != smp[0]) break;
-    }
-    if(i == n) {
-        sub->type = sub->type_code = FLAC_SUBFRAME_CONSTANT;
-        res[0] = smp[0];
-        return sub->obits;
-    }
-
-    /* VERBATIM */
-    sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM;
-    encode_residual_verbatim(res, smp, n);
-    return sub->obits * n;
-}
-
-static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n)
-{
-    int i, best;
-    int32_t lt, rt;
-    uint64_t sum[4];
-    uint64_t score[4];
-    int k;
-
-    /* calculate sum of 2nd order residual for each channel */
-    sum[0] = sum[1] = sum[2] = sum[3] = 0;
-    for(i=2; i<n; i++) {
-        lt = left_ch[i] - 2*left_ch[i-1] + left_ch[i-2];
-        rt = right_ch[i] - 2*right_ch[i-1] + right_ch[i-2];
-        sum[2] += FFABS((lt + rt) >> 1);
-        sum[3] += FFABS(lt - rt);
-        sum[0] += FFABS(lt);
-        sum[1] += FFABS(rt);
-    }
-    /* estimate bit counts */
-    for(i=0; i<4; i++) {
-        k = find_optimal_param(2*sum[i], n);
-        sum[i] = rice_encode_count(2*sum[i], n, k);
-    }
-
-    /* calculate score for each mode */
-    score[0] = sum[0] + sum[1];
-    score[1] = sum[0] + sum[3];
-    score[2] = sum[1] + sum[3];
-    score[3] = sum[2] + sum[3];
-
-    /* return mode with lowest score */
-    best = 0;
-    for(i=1; i<4; i++) {
-        if(score[i] < score[best]) {
-            best = i;
-        }
-    }
-    if(best == 0) {
-        return FLAC_CHMODE_INDEPENDENT;
-    } else if(best == 1) {
-        return FLAC_CHMODE_LEFT_SIDE;
-    } else if(best == 2) {
-        return FLAC_CHMODE_RIGHT_SIDE;
-    } else {
-        return FLAC_CHMODE_MID_SIDE;
-    }
-}
-
-/**
- * Perform stereo channel decorrelation
- */
-static void channel_decorrelation(FlacEncodeContext *ctx)
-{
-    FlacFrame *frame;
-    int32_t *left, *right;
-    int i, n;
-
-    frame = &ctx->frame;
-    n = frame->blocksize;
-    left  = frame->subframes[0].samples;
-    right = frame->subframes[1].samples;
-
-    if(ctx->channels != 2) {
-        frame->ch_mode = FLAC_CHMODE_INDEPENDENT;
-        return;
-    }
-
-    frame->ch_mode = estimate_stereo_mode(left, right, n);
-
-    /* perform decorrelation and adjust bits-per-sample */
-    if(frame->ch_mode == FLAC_CHMODE_INDEPENDENT) {
-        return;
-    }
-    if(frame->ch_mode == FLAC_CHMODE_MID_SIDE) {
-        int32_t tmp;
-        for(i=0; i<n; i++) {
-            tmp = left[i];
-            left[i] = (tmp + right[i]) >> 1;
-            right[i] = tmp - right[i];
-        }
-        frame->subframes[1].obits++;
-    } else if(frame->ch_mode == FLAC_CHMODE_LEFT_SIDE) {
-        for(i=0; i<n; i++) {
-            right[i] = left[i] - right[i];
-        }
-        frame->subframes[1].obits++;
-    } else {
-        for(i=0; i<n; i++) {
-            left[i] -= right[i];
-        }
-        frame->subframes[0].obits++;
-    }
-}
-
-static void write_utf8(PutBitContext *pb, uint32_t val)
-{
-    uint8_t tmp;
-    PUT_UTF8(val, tmp, put_bits(pb, 8, tmp);)
-}
-
-static void output_frame_header(FlacEncodeContext *s)
-{
-    FlacFrame *frame;
-    int crc;
-
-    frame = &s->frame;
-
-    put_bits(&s->pb, 16, 0xFFF8);
-    put_bits(&s->pb, 4, frame->bs_code[0]);
-    put_bits(&s->pb, 4, s->sr_code[0]);
-    if(frame->ch_mode == FLAC_CHMODE_INDEPENDENT) {
-        put_bits(&s->pb, 4, s->channels-1);
-    } else {
-        put_bits(&s->pb, 4, frame->ch_mode);
-    }
-    put_bits(&s->pb, 3, 4); /* bits-per-sample code */
-    put_bits(&s->pb, 1, 0);
-    write_utf8(&s->pb, s->frame_count);
-    if(frame->bs_code[0] == 6) {
-        put_bits(&s->pb, 8, frame->bs_code[1]);
-    } else if(frame->bs_code[0] == 7) {
-        put_bits(&s->pb, 16, frame->bs_code[1]);
-    }
-    if(s->sr_code[0] == 12) {
-        put_bits(&s->pb, 8, s->sr_code[1]);
-    } else if(s->sr_code[0] > 12) {
-        put_bits(&s->pb, 16, s->sr_code[1]);
-    }
-    flush_put_bits(&s->pb);
-    crc = av_crc(av_crc_get_table(AV_CRC_8_ATM), 0,
-                 s->pb.buf, put_bits_count(&s->pb)>>3);
-    put_bits(&s->pb, 8, crc);
-}
-
-static void output_subframe_constant(FlacEncodeContext *s, int ch)
-{
-    FlacSubframe *sub;
-    int32_t res;
-
-    sub = &s->frame.subframes[ch];
-    res = sub->residual[0];
-    put_sbits(&s->pb, sub->obits, res);
-}
-
-static void output_subframe_verbatim(FlacEncodeContext *s, int ch)
-{
-    int i;
-    FlacFrame *frame;
-    FlacSubframe *sub;
-    int32_t res;
-
-    frame = &s->frame;
-    sub = &frame->subframes[ch];
-
-    for(i=0; i<frame->blocksize; i++) {
-        res = sub->residual[i];
-        put_sbits(&s->pb, sub->obits, res);
-    }
-}
-
-static void output_residual(FlacEncodeContext *ctx, int ch)
-{
-    int i, j, p, n, parts;
-    int k, porder, psize, res_cnt;
-    FlacFrame *frame;
-    FlacSubframe *sub;
-    int32_t *res;
-
-    frame = &ctx->frame;
-    sub = &frame->subframes[ch];
-    res = sub->residual;
-    n = frame->blocksize;
-
-    /* rice-encoded block */
-    put_bits(&ctx->pb, 2, 0);
-
-    /* partition order */
-    porder = sub->rc.porder;
-    psize = n >> porder;
-    parts = (1 << porder);
-    put_bits(&ctx->pb, 4, porder);
-    res_cnt = psize - sub->order;
-
-    /* residual */
-    j = sub->order;
-    for(p=0; p<parts; p++) {
-        k = sub->rc.params[p];
-        put_bits(&ctx->pb, 4, k);
-        if(p == 1) res_cnt = psize;
-        for(i=0; i<res_cnt && j<n; i++, j++) {
-            set_sr_golomb_flac(&ctx->pb, res[j], k, INT32_MAX, 0);
-        }
-    }
-}
-
-static void output_subframe_fixed(FlacEncodeContext *ctx, int ch)
-{
-    int i;
-    FlacFrame *frame;
-    FlacSubframe *sub;
-
-    frame = &ctx->frame;
-    sub = &frame->subframes[ch];
-
-    /* warm-up samples */
-    for(i=0; i<sub->order; i++) {
-        put_sbits(&ctx->pb, sub->obits, sub->residual[i]);
-    }
-
-    /* residual */
-    output_residual(ctx, ch);
-}
-
-static void output_subframe_lpc(FlacEncodeContext *ctx, int ch)
-{
-    int i, cbits;
-    FlacFrame *frame;
-    FlacSubframe *sub;
-
-    frame = &ctx->frame;
-    sub = &frame->subframes[ch];
-
-    /* warm-up samples */
-    for(i=0; i<sub->order; i++) {
-        put_sbits(&ctx->pb, sub->obits, sub->residual[i]);
-    }
-
-    /* LPC coefficients */
-    cbits = ctx->options.lpc_coeff_precision;
-    put_bits(&ctx->pb, 4, cbits-1);
-    put_sbits(&ctx->pb, 5, sub->shift);
-    for(i=0; i<sub->order; i++) {
-        put_sbits(&ctx->pb, cbits, sub->coefs[i]);
-    }
-
-    /* residual */
-    output_residual(ctx, ch);
-}
-
-static void output_subframes(FlacEncodeContext *s)
-{
-    FlacFrame *frame;
-    FlacSubframe *sub;
-    int ch;
-
-    frame = &s->frame;
-
-    for(ch=0; ch<s->channels; ch++) {
-        sub = &frame->subframes[ch];
-
-        /* subframe header */
-        put_bits(&s->pb, 1, 0);
-        put_bits(&s->pb, 6, sub->type_code);
-        put_bits(&s->pb, 1, 0); /* no wasted bits */
-
-        /* subframe */
-        if(sub->type == FLAC_SUBFRAME_CONSTANT) {
-            output_subframe_constant(s, ch);
-        } else if(sub->type == FLAC_SUBFRAME_VERBATIM) {
-            output_subframe_verbatim(s, ch);
-        } else if(sub->type == FLAC_SUBFRAME_FIXED) {
-            output_subframe_fixed(s, ch);
-        } else if(sub->type == FLAC_SUBFRAME_LPC) {
-            output_subframe_lpc(s, ch);
-        }
-    }
-}
-
-static void output_frame_footer(FlacEncodeContext *s)
-{
-    int crc;
-    flush_put_bits(&s->pb);
-    crc = bswap_16(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0,
-                          s->pb.buf, put_bits_count(&s->pb)>>3));
-    put_bits(&s->pb, 16, crc);
-    flush_put_bits(&s->pb);
-}
-
-static void update_md5_sum(FlacEncodeContext *s, int16_t *samples)
-{
-#if HAVE_BIGENDIAN
-    int i;
-    for(i = 0; i < s->frame.blocksize*s->channels; i++) {
-        int16_t smp = le2me_16(samples[i]);
-        av_md5_update(s->md5ctx, (uint8_t *)&smp, 2);
-    }
-#else
-    av_md5_update(s->md5ctx, (uint8_t *)samples, s->frame.blocksize*s->channels*2);
-#endif
-}
-
-static int flac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
-                             int buf_size, void *data)
-{
-    int ch;
-    FlacEncodeContext *s;
-    int16_t *samples = data;
-    int out_bytes;
-    int reencoded=0;
-
-    s = avctx->priv_data;
-
-    if(buf_size < s->max_framesize*2) {
-        av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
-        return 0;
-    }
-
-    /* when the last block is reached, update the header in extradata */
-    if (!data) {
-        s->max_framesize = s->max_encoded_framesize;
-        av_md5_final(s->md5ctx, s->md5sum);
-        write_streaminfo(s, avctx->extradata);
-        return 0;
-    }
-
-    init_frame(s);
-
-    copy_samples(s, samples);
-
-    channel_decorrelation(s);
-
-    for(ch=0; ch<s->channels; ch++) {
-        encode_residual(s, ch);
-    }
-
-write_frame:
-    init_put_bits(&s->pb, frame, buf_size);
-    output_frame_header(s);
-    output_subframes(s);
-    output_frame_footer(s);
-    out_bytes = put_bits_count(&s->pb) >> 3;
-
-    if(out_bytes > s->max_framesize) {
-        if(reencoded) {
-            /* still too large. must be an error. */
-            av_log(avctx, AV_LOG_ERROR, "error encoding frame\n");
-            return -1;
-        }
-
-        /* frame too large. use verbatim mode */
-        for(ch=0; ch<s->channels; ch++) {
-            encode_residual_v(s, ch);
-        }
-        reencoded = 1;
-        goto write_frame;
-    }
-
-    s->frame_count++;
-    s->sample_count += avctx->frame_size;
-    update_md5_sum(s, samples);
-    if (out_bytes > s->max_encoded_framesize)
-        s->max_encoded_framesize = out_bytes;
-    if (out_bytes < s->min_framesize)
-        s->min_framesize = out_bytes;
-
-    return out_bytes;
-}
-
-static av_cold int flac_encode_close(AVCodecContext *avctx)
-{
-    if (avctx->priv_data) {
-        FlacEncodeContext *s = avctx->priv_data;
-        av_freep(&s->md5ctx);
-    }
-    av_freep(&avctx->extradata);
-    avctx->extradata_size = 0;
-    av_freep(&avctx->coded_frame);
-    return 0;
-}
-
-AVCodec flac_encoder = {
-    "flac",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_FLAC,
-    sizeof(FlacEncodeContext),
-    flac_encode_init,
-    flac_encode_frame,
-    flac_encode_close,
-    NULL,
-    .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
-};
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
deleted file mode 100644
index 394ac0f..0000000
--- a/libavcodec/flashsv.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Flash Screen Video decoder
- * Copyright (C) 2004 Alex Beregszaszi
- * Copyright (C) 2006 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Flash Screen Video decoder
- * @author Alex Beregszaszi
- * @author Benjamin Larsson
- */
-
-/* Bitstream description
- * The picture is divided into blocks that are zlib compressed.
- *
- * The decoder is fed complete frames, the frameheader contains:
- * 4bits of block width
- * 12bits of frame width
- * 4bits of block height
- * 12bits of frame height
- *
- * Directly after the header are the compressed blocks. The blocks
- * have their compressed size represented with 16bits in the beginnig.
- * If the size = 0 then the block is unchanged from the previous frame.
- * All blocks are decompressed until the buffer is consumed.
- *
- * Encoding ideas, a basic encoder would just use a fixed block size.
- * Block sizes can be multipels of 16, from 16 to 256. The blocks don't
- * have to be quadratic. A brute force search with a set of diffrent
- * block sizes should give a better result then to just use a fixed size.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-#include "get_bits.h"
-
-#include <zlib.h>
-
-typedef struct FlashSVContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    int image_width, image_height;
-    int block_width, block_height;
-    uint8_t* tmpblock;
-    int block_size;
-    z_stream zstream;
-} FlashSVContext;
-
-
-static void copy_region(uint8_t *sptr, uint8_t *dptr,
-        int dx, int dy, int h, int w, int stride)
-{
-    int i;
-
-    for (i = dx+h; i > dx; i--)
-    {
-        memcpy(dptr+(i*stride)+dy*3, sptr, w*3);
-        sptr += w*3;
-    }
-}
-
-
-static av_cold int flashsv_decode_init(AVCodecContext *avctx)
-{
-    FlashSVContext *s = avctx->priv_data;
-    int zret; // Zlib return code
-
-    s->avctx = avctx;
-    s->zstream.zalloc = Z_NULL;
-    s->zstream.zfree = Z_NULL;
-    s->zstream.opaque = Z_NULL;
-    zret = inflateInit(&(s->zstream));
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
-        return 1;
-    }
-    avctx->pix_fmt = PIX_FMT_BGR24;
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-
-static int flashsv_decode_frame(AVCodecContext *avctx,
-                                    void *data, int *data_size,
-                                    AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    FlashSVContext *s = avctx->priv_data;
-    int h_blocks, v_blocks, h_part, v_part, i, j;
-    GetBitContext gb;
-
-    /* no supplementary picture */
-    if (buf_size == 0)
-        return 0;
-    if (buf_size < 4)
-        return -1;
-
-    init_get_bits(&gb, buf, buf_size * 8);
-
-    /* start to parse the bitstream */
-    s->block_width = 16* (get_bits(&gb, 4)+1);
-    s->image_width =     get_bits(&gb,12);
-    s->block_height= 16* (get_bits(&gb, 4)+1);
-    s->image_height=     get_bits(&gb,12);
-
-    /* calculate amount of blocks and the size of the border blocks */
-    h_blocks = s->image_width / s->block_width;
-    h_part = s->image_width % s->block_width;
-    v_blocks = s->image_height / s->block_height;
-    v_part = s->image_height % s->block_height;
-
-    /* the block size could change between frames, make sure the buffer
-     * is large enough, if not, get a larger one */
-    if(s->block_size < s->block_width*s->block_height) {
-        if (s->tmpblock != NULL)
-            av_free(s->tmpblock);
-        if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) {
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-            return -1;
-        }
-    }
-    s->block_size = s->block_width*s->block_height;
-
-    /* init the image size once */
-    if((avctx->width==0) && (avctx->height==0)){
-        avctx->width = s->image_width;
-        avctx->height = s->image_height;
-    }
-
-    /* check for changes of image width and image height */
-    if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) {
-        av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n");
-        av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d  vs  ch = %d, cv = %d\n",avctx->height,
-        avctx->width,s->image_height,s->image_width);
-        return -1;
-    }
-
-    av_log(avctx, AV_LOG_DEBUG, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
-        s->image_width, s->image_height, s->block_width, s->block_height,
-        h_blocks, v_blocks, h_part, v_part);
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if(avctx->reget_buffer(avctx, &s->frame) < 0){
-      av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-      return -1;
-    }
-
-    /* loop over all block columns */
-    for (j = 0; j < v_blocks + (v_part?1:0); j++)
-    {
-
-        int hp = j*s->block_height; // horiz position in frame
-        int hs = (j<v_blocks)?s->block_height:v_part; // size of block
-
-
-        /* loop over all block rows */
-        for (i = 0; i < h_blocks + (h_part?1:0); i++)
-        {
-            int wp = i*s->block_width; // vert position in frame
-            int ws = (i<h_blocks)?s->block_width:h_part; // size of block
-
-            /* get the size of the compressed zlib chunk */
-            int size = get_bits(&gb, 16);
-            if (8 * size > get_bits_left(&gb)) {
-                avctx->release_buffer(avctx, &s->frame);
-                s->frame.data[0] = NULL;
-                return -1;
-            }
-
-            if (size == 0) {
-                /* no change, don't do anything */
-            } else {
-                /* decompress block */
-                int ret = inflateReset(&(s->zstream));
-                if (ret != Z_OK)
-                {
-                    av_log(avctx, AV_LOG_ERROR, "error in decompression (reset) of block %dx%d\n", i, j);
-                    /* return -1; */
-                }
-                s->zstream.next_in = buf+(get_bits_count(&gb)/8);
-                s->zstream.avail_in = size;
-                s->zstream.next_out = s->tmpblock;
-                s->zstream.avail_out = s->block_size*3;
-                ret = inflate(&(s->zstream), Z_FINISH);
-                if (ret == Z_DATA_ERROR)
-                {
-                    av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
-                    inflateSync(&(s->zstream));
-                    ret = inflate(&(s->zstream), Z_FINISH);
-                }
-
-                if ((ret != Z_OK) && (ret != Z_STREAM_END))
-                {
-                    av_log(avctx, AV_LOG_ERROR, "error in decompression of block %dx%d: %d\n", i, j, ret);
-                    /* return -1; */
-                }
-                copy_region(s->tmpblock, s->frame.data[0], s->image_height-(hp+hs+1), wp, hs, ws, s->frame.linesize[0]);
-                skip_bits_long(&gb, 8*size);   /* skip the consumed bits */
-            }
-        }
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    if ((get_bits_count(&gb)/8) != buf_size)
-        av_log(avctx, AV_LOG_ERROR, "buffer not fully consumed (%d != %d)\n",
-            buf_size, (get_bits_count(&gb)/8));
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-static av_cold int flashsv_decode_end(AVCodecContext *avctx)
-{
-    FlashSVContext *s = avctx->priv_data;
-    inflateEnd(&(s->zstream));
-    /* release the frame if needed */
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    /* free the tmpblock */
-    if (s->tmpblock != NULL)
-        av_free(s->tmpblock);
-
-    return 0;
-}
-
-
-AVCodec flashsv_decoder = {
-    "flashsv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FLASHSV,
-    sizeof(FlashSVContext),
-    flashsv_decode_init,
-    NULL,
-    flashsv_decode_end,
-    flashsv_decode_frame,
-    CODEC_CAP_DR1,
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"),
-};
diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c
deleted file mode 100644
index ff917e9..0000000
--- a/libavcodec/flashsvenc.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Flash Screen Video encoder
- * Copyright (C) 2004 Alex Beregszaszi
- * Copyright (C) 2006 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* Encoding development sponsored by http://fh-campuswien.ac.at */
-
-/**
- * @file
- * Flash Screen Video encoder
- * @author Alex Beregszaszi
- * @author Benjamin Larsson
- */
-
-/* Bitstream description
- * The picture is divided into blocks that are zlib-compressed.
- *
- * The decoder is fed complete frames, the frameheader contains:
- * 4bits of block width
- * 12bits of frame width
- * 4bits of block height
- * 12bits of frame height
- *
- * Directly after the header are the compressed blocks. The blocks
- * have their compressed size represented with 16bits in the beginig.
- * If the size = 0 then the block is unchanged from the previous frame.
- * All blocks are decompressed until the buffer is consumed.
- *
- * Encoding ideas, a basic encoder would just use a fixed block size.
- * Block sizes can be multipels of 16, from 16 to 256. The blocks don't
- * have to be quadratic. A brute force search with a set of different
- * block sizes should give a better result than to just use a fixed size.
- */
-
-/* TODO:
- * Don't reencode the frame in brute force mode if the frame is a dupe. Speed up.
- * Make the difference check faster.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <zlib.h>
-
-#include "avcodec.h"
-#include "put_bits.h"
-#include "bytestream.h"
-
-
-typedef struct FlashSVContext {
-    AVCodecContext *avctx;
-    uint8_t *previous_frame;
-    AVFrame frame;
-    int image_width, image_height;
-    int block_width, block_height;
-    uint8_t* tmpblock;
-    uint8_t* encbuffer;
-    int block_size;
-    z_stream zstream;
-    int last_key_frame;
-} FlashSVContext;
-
-static int copy_region_enc(uint8_t *sptr, uint8_t *dptr,
-        int dx, int dy, int h, int w, int stride, uint8_t *pfptr) {
-    int i,j;
-    uint8_t *nsptr;
-    uint8_t *npfptr;
-    int diff = 0;
-
-    for (i = dx+h; i > dx; i--) {
-        nsptr = sptr+(i*stride)+dy*3;
-        npfptr = pfptr+(i*stride)+dy*3;
-        for (j=0 ; j<w*3 ; j++) {
-            diff |=npfptr[j]^nsptr[j];
-            dptr[j] = nsptr[j];
-        }
-        dptr += w*3;
-    }
-    if (diff)
-        return 1;
-    return 0;
-}
-
-static av_cold int flashsv_encode_init(AVCodecContext *avctx)
-{
-    FlashSVContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    if ((avctx->width > 4095) || (avctx->height > 4095)) {
-        av_log(avctx, AV_LOG_ERROR, "Input dimensions too large, input must be max 4096x4096 !\n");
-        return -1;
-    }
-
-    // Needed if zlib unused or init aborted before deflateInit
-    memset(&(s->zstream), 0, sizeof(z_stream));
-
-    s->last_key_frame=0;
-
-    s->image_width = avctx->width;
-    s->image_height = avctx->height;
-
-    s->tmpblock = av_mallocz(3*256*256);
-    s->encbuffer = av_mallocz(s->image_width*s->image_height*3);
-
-    if (!s->tmpblock || !s->encbuffer) {
-        av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-
-static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, int buf_size,
-     int block_width, int block_height, uint8_t *previous_frame, int* I_frame) {
-
-    PutBitContext pb;
-    int h_blocks, v_blocks, h_part, v_part, i, j;
-    int buf_pos, res;
-    int pred_blocks = 0;
-
-    init_put_bits(&pb, buf, buf_size*8);
-
-    put_bits(&pb, 4, (block_width/16)-1);
-    put_bits(&pb, 12, s->image_width);
-    put_bits(&pb, 4, (block_height/16)-1);
-    put_bits(&pb, 12, s->image_height);
-    flush_put_bits(&pb);
-    buf_pos=4;
-
-    h_blocks = s->image_width / block_width;
-    h_part = s->image_width % block_width;
-    v_blocks = s->image_height / block_height;
-    v_part = s->image_height % block_height;
-
-    /* loop over all block columns */
-    for (j = 0; j < v_blocks + (v_part?1:0); j++)
-    {
-
-        int hp = j*block_height; // horiz position in frame
-        int hs = (j<v_blocks)?block_height:v_part; // size of block
-
-        /* loop over all block rows */
-        for (i = 0; i < h_blocks + (h_part?1:0); i++)
-        {
-            int wp = i*block_width; // vert position in frame
-            int ws = (i<h_blocks)?block_width:h_part; // size of block
-            int ret=Z_OK;
-            uint8_t *ptr;
-
-            ptr = buf+buf_pos;
-
-            //copy the block to the temp buffer before compression (if it differs from the previous frame's block)
-            res = copy_region_enc(p->data[0], s->tmpblock, s->image_height-(hp+hs+1), wp, hs, ws, p->linesize[0], previous_frame);
-
-            if (res || *I_frame) {
-                unsigned long zsize;
-                zsize = 3*block_width*block_height;
-                ret = compress2(ptr+2, &zsize, s->tmpblock, 3*ws*hs, 9);
-
-
-                //ret = deflateReset(&(s->zstream));
-                if (ret != Z_OK)
-                    av_log(s->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", i, j);
-
-                bytestream_put_be16(&ptr,(unsigned int)zsize);
-                buf_pos += zsize+2;
-                //av_log(avctx, AV_LOG_ERROR, "buf_pos = %d\n", buf_pos);
-            } else {
-                pred_blocks++;
-                bytestream_put_be16(&ptr,0);
-                buf_pos += 2;
-            }
-        }
-    }
-
-    if (pred_blocks)
-        *I_frame = 0;
-    else
-        *I_frame = 1;
-
-    return buf_pos;
-}
-
-
-static int flashsv_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
-{
-    FlashSVContext * const s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p = &s->frame;
-    uint8_t *pfptr;
-    int res;
-    int I_frame = 0;
-    int opt_w, opt_h;
-
-    *p = *pict;
-
-    /* First frame needs to be a keyframe */
-    if (avctx->frame_number == 0) {
-        s->previous_frame = av_mallocz(FFABS(p->linesize[0])*s->image_height);
-        if (!s->previous_frame) {
-            av_log(avctx, AV_LOG_ERROR, "Memory allocation failed.\n");
-            return -1;
-        }
-        I_frame = 1;
-    }
-
-    if (p->linesize[0] < 0)
-        pfptr = s->previous_frame - ((s->image_height-1) * p->linesize[0]);
-    else
-        pfptr = s->previous_frame;
-
-    /* Check the placement of keyframes */
-    if (avctx->gop_size > 0) {
-        if (avctx->frame_number >= s->last_key_frame + avctx->gop_size) {
-            I_frame = 1;
-        }
-    }
-
-    opt_w=4;
-    opt_h=4;
-
-    if (buf_size < s->image_width*s->image_height*3) {
-        //Conservative upper bound check for compressed data
-        av_log(avctx, AV_LOG_ERROR, "buf_size %d <  %d\n", buf_size, s->image_width*s->image_height*3);
-        return -1;
-    }
-
-    res = encode_bitstream(s, p, buf, buf_size, opt_w*16, opt_h*16, pfptr, &I_frame);
-
-    //save the current frame
-    if(p->linesize[0] > 0)
-        memcpy(s->previous_frame, p->data[0], s->image_height*p->linesize[0]);
-    else
-        memcpy(s->previous_frame, p->data[0] + p->linesize[0] * (s->image_height-1), s->image_height*FFABS(p->linesize[0]));
-
-    //mark the frame type so the muxer can mux it correctly
-    if (I_frame) {
-        p->pict_type = FF_I_TYPE;
-        p->key_frame = 1;
-        s->last_key_frame = avctx->frame_number;
-        av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n",avctx->frame_number);
-    } else {
-        p->pict_type = FF_P_TYPE;
-        p->key_frame = 0;
-    }
-
-    avctx->coded_frame = p;
-
-    return res;
-}
-
-static av_cold int flashsv_encode_end(AVCodecContext *avctx)
-{
-    FlashSVContext *s = avctx->priv_data;
-
-    deflateEnd(&(s->zstream));
-
-    av_free(s->encbuffer);
-    av_free(s->previous_frame);
-    av_free(s->tmpblock);
-
-    return 0;
-}
-
-AVCodec flashsv_encoder = {
-    "flashsv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FLASHSV,
-    sizeof(FlashSVContext),
-    flashsv_encode_init,
-    flashsv_encode_frame,
-    flashsv_encode_end,
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video"),
-};
-
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
deleted file mode 100644
index b63d7d4..0000000
--- a/libavcodec/flicvideo.c
+++ /dev/null
@@ -1,760 +0,0 @@
-/*
- * FLI/FLC Animation Video Decoder
- * Copyright (C) 2003, 2004 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Autodesk Animator FLI/FLC Video Decoder
- * by Mike Melanson (melanson at pcisys.net)
- * for more information on the .fli/.flc file format and all of its many
- * variations, visit:
- *   http://www.compuphase.com/flic.htm
- *
- * This decoder outputs PAL8/RGB555/RGB565 and maybe one day RGB24
- * colorspace data, depending on the FLC. To use this decoder, be
- * sure that your demuxer sends the FLI file header to the decoder via
- * the extradata chunk in AVCodecContext. The chunk should be 128 bytes
- * large. The only exception is for FLI files from the game "Magic Carpet",
- * in which the header is only 12 bytes.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#define FLI_256_COLOR 4
-#define FLI_DELTA     7
-#define FLI_COLOR     11
-#define FLI_LC        12
-#define FLI_BLACK     13
-#define FLI_BRUN      15
-#define FLI_COPY      16
-#define FLI_MINI      18
-#define FLI_DTA_BRUN  25
-#define FLI_DTA_COPY  26
-#define FLI_DTA_LC    27
-
-#define FLI_TYPE_CODE     (0xAF11)
-#define FLC_FLX_TYPE_CODE (0xAF12)
-#define FLC_DTA_TYPE_CODE (0xAF44) /* Marks an "Extended FLC" comes from Dave's Targa Animator (DTA) */
-#define FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE (0xAF13)
-
-#define CHECK_PIXEL_PTR(n) \
-    if (pixel_ptr + n > pixel_limit) { \
-        av_log (s->avctx, AV_LOG_INFO, "Problem: pixel_ptr >= pixel_limit (%d >= %d)\n", \
-        pixel_ptr + n, pixel_limit); \
-        return -1; \
-    } \
-
-typedef struct FlicDecodeContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    unsigned int palette[256];
-    int new_palette;
-    int fli_type;  /* either 0xAF11 or 0xAF12, affects palette resolution */
-} FlicDecodeContext;
-
-static av_cold int flic_decode_init(AVCodecContext *avctx)
-{
-    FlicDecodeContext *s = avctx->priv_data;
-    unsigned char *fli_header = (unsigned char *)avctx->extradata;
-    int depth;
-
-    s->avctx = avctx;
-
-    s->fli_type = AV_RL16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */
-
-    depth = 0;
-    if (s->avctx->extradata_size == 12) {
-        /* special case for magic carpet FLIs */
-        s->fli_type = FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE;
-        depth = 8;
-    } else if (s->avctx->extradata_size != 128) {
-        av_log(avctx, AV_LOG_ERROR, "Expected extradata of 12 or 128 bytes\n");
-        return -1;
-    } else {
-        depth = AV_RL16(&fli_header[12]);
-    }
-
-    if (depth == 0) {
-        depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */
-    }
-
-    if ((s->fli_type == FLC_FLX_TYPE_CODE) && (depth == 16)) {
-        depth = 15; /* Original Autodesk FLX's say the depth is 16Bpp when it is really 15Bpp */
-    }
-
-    switch (depth) {
-        case 8  : avctx->pix_fmt = PIX_FMT_PAL8; break;
-        case 15 : avctx->pix_fmt = PIX_FMT_RGB555; break;
-        case 16 : avctx->pix_fmt = PIX_FMT_RGB565; break;
-        case 24 : avctx->pix_fmt = PIX_FMT_BGR24; /* Supposedly BGR, but havent any files to test with */
-                  av_log(avctx, AV_LOG_ERROR, "24Bpp FLC/FLX is unsupported due to no test files.\n");
-                  return -1;
-                  break;
-        default :
-                  av_log(avctx, AV_LOG_ERROR, "Unknown FLC/FLX depth of %d Bpp is unsupported.\n",depth);
-                  return -1;
-    }
-
-    s->frame.data[0] = NULL;
-    s->new_palette = 0;
-
-    return 0;
-}
-
-static int flic_decode_frame_8BPP(AVCodecContext *avctx,
-                                  void *data, int *data_size,
-                                  const uint8_t *buf, int buf_size)
-{
-    FlicDecodeContext *s = avctx->priv_data;
-
-    int stream_ptr = 0;
-    int stream_ptr_after_color_chunk;
-    int pixel_ptr;
-    int palette_ptr;
-    unsigned char palette_idx1;
-    unsigned char palette_idx2;
-
-    unsigned int frame_size;
-    int num_chunks;
-
-    unsigned int chunk_size;
-    int chunk_type;
-
-    int i, j;
-
-    int color_packets;
-    int color_changes;
-    int color_shift;
-    unsigned char r, g, b;
-
-    int lines;
-    int compressed_lines;
-    int starting_line;
-    signed short line_packets;
-    int y_ptr;
-    int byte_run;
-    int pixel_skip;
-    int pixel_countdown;
-    unsigned char *pixels;
-    unsigned int pixel_limit;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    pixels = s->frame.data[0];
-    pixel_limit = s->avctx->height * s->frame.linesize[0];
-
-    frame_size = AV_RL32(&buf[stream_ptr]);
-    stream_ptr += 6;  /* skip the magic number */
-    num_chunks = AV_RL16(&buf[stream_ptr]);
-    stream_ptr += 10;  /* skip padding */
-
-    frame_size -= 16;
-
-    /* iterate through the chunks */
-    while ((frame_size > 0) && (num_chunks > 0)) {
-        chunk_size = AV_RL32(&buf[stream_ptr]);
-        stream_ptr += 4;
-        chunk_type = AV_RL16(&buf[stream_ptr]);
-        stream_ptr += 2;
-
-        switch (chunk_type) {
-        case FLI_256_COLOR:
-        case FLI_COLOR:
-            stream_ptr_after_color_chunk = stream_ptr + chunk_size - 6;
-
-            /* check special case: If this file is from the Magic Carpet
-             * game and uses 6-bit colors even though it reports 256-color
-             * chunks in a 0xAF12-type file (fli_type is set to 0xAF13 during
-             * initialization) */
-            if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE))
-                color_shift = 0;
-            else
-                color_shift = 2;
-            /* set up the palette */
-            color_packets = AV_RL16(&buf[stream_ptr]);
-            stream_ptr += 2;
-            palette_ptr = 0;
-            for (i = 0; i < color_packets; i++) {
-                /* first byte is how many colors to skip */
-                palette_ptr += buf[stream_ptr++];
-
-                /* next byte indicates how many entries to change */
-                color_changes = buf[stream_ptr++];
-
-                /* if there are 0 color changes, there are actually 256 */
-                if (color_changes == 0)
-                    color_changes = 256;
-
-                for (j = 0; j < color_changes; j++) {
-                    unsigned int entry;
-
-                    /* wrap around, for good measure */
-                    if ((unsigned)palette_ptr >= 256)
-                        palette_ptr = 0;
-
-                    r = buf[stream_ptr++] << color_shift;
-                    g = buf[stream_ptr++] << color_shift;
-                    b = buf[stream_ptr++] << color_shift;
-                    entry = (r << 16) | (g << 8) | b;
-                    if (s->palette[palette_ptr] != entry)
-                        s->new_palette = 1;
-                    s->palette[palette_ptr++] = entry;
-                }
-            }
-
-            /* color chunks sometimes have weird 16-bit alignment issues;
-             * therefore, take the hardline approach and set the stream_ptr
-             * to the value calculated w.r.t. the size specified by the color
-             * chunk header */
-            stream_ptr = stream_ptr_after_color_chunk;
-
-            break;
-
-        case FLI_DELTA:
-            y_ptr = 0;
-            compressed_lines = AV_RL16(&buf[stream_ptr]);
-            stream_ptr += 2;
-            while (compressed_lines > 0) {
-                line_packets = AV_RL16(&buf[stream_ptr]);
-                stream_ptr += 2;
-                if ((line_packets & 0xC000) == 0xC000) {
-                    // line skip opcode
-                    line_packets = -line_packets;
-                    y_ptr += line_packets * s->frame.linesize[0];
-                } else if ((line_packets & 0xC000) == 0x4000) {
-                    av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets);
-                } else if ((line_packets & 0xC000) == 0x8000) {
-                    // "last byte" opcode
-                    pixel_ptr= y_ptr + s->frame.linesize[0] - 1;
-                    CHECK_PIXEL_PTR(0);
-                    pixels[pixel_ptr] = line_packets & 0xff;
-                } else {
-                    compressed_lines--;
-                    pixel_ptr = y_ptr;
-                    CHECK_PIXEL_PTR(0);
-                    pixel_countdown = s->avctx->width;
-                    for (i = 0; i < line_packets; i++) {
-                        /* account for the skip bytes */
-                        pixel_skip = buf[stream_ptr++];
-                        pixel_ptr += pixel_skip;
-                        pixel_countdown -= pixel_skip;
-                        byte_run = (signed char)(buf[stream_ptr++]);
-                        if (byte_run < 0) {
-                            byte_run = -byte_run;
-                            palette_idx1 = buf[stream_ptr++];
-                            palette_idx2 = buf[stream_ptr++];
-                            CHECK_PIXEL_PTR(byte_run * 2);
-                            for (j = 0; j < byte_run; j++, pixel_countdown -= 2) {
-                                pixels[pixel_ptr++] = palette_idx1;
-                                pixels[pixel_ptr++] = palette_idx2;
-                            }
-                        } else {
-                            CHECK_PIXEL_PTR(byte_run * 2);
-                            for (j = 0; j < byte_run * 2; j++, pixel_countdown--) {
-                                palette_idx1 = buf[stream_ptr++];
-                                pixels[pixel_ptr++] = palette_idx1;
-                            }
-                        }
-                    }
-
-                    y_ptr += s->frame.linesize[0];
-                }
-            }
-            break;
-
-        case FLI_LC:
-            /* line compressed */
-            starting_line = AV_RL16(&buf[stream_ptr]);
-            stream_ptr += 2;
-            y_ptr = 0;
-            y_ptr += starting_line * s->frame.linesize[0];
-
-            compressed_lines = AV_RL16(&buf[stream_ptr]);
-            stream_ptr += 2;
-            while (compressed_lines > 0) {
-                pixel_ptr = y_ptr;
-                CHECK_PIXEL_PTR(0);
-                pixel_countdown = s->avctx->width;
-                line_packets = buf[stream_ptr++];
-                if (line_packets > 0) {
-                    for (i = 0; i < line_packets; i++) {
-                        /* account for the skip bytes */
-                        pixel_skip = buf[stream_ptr++];
-                        pixel_ptr += pixel_skip;
-                        pixel_countdown -= pixel_skip;
-                        byte_run = (signed char)(buf[stream_ptr++]);
-                        if (byte_run > 0) {
-                            CHECK_PIXEL_PTR(byte_run);
-                            for (j = 0; j < byte_run; j++, pixel_countdown--) {
-                                palette_idx1 = buf[stream_ptr++];
-                                pixels[pixel_ptr++] = palette_idx1;
-                            }
-                        } else if (byte_run < 0) {
-                            byte_run = -byte_run;
-                            palette_idx1 = buf[stream_ptr++];
-                            CHECK_PIXEL_PTR(byte_run);
-                            for (j = 0; j < byte_run; j++, pixel_countdown--) {
-                                pixels[pixel_ptr++] = palette_idx1;
-                            }
-                        }
-                    }
-                }
-
-                y_ptr += s->frame.linesize[0];
-                compressed_lines--;
-            }
-            break;
-
-        case FLI_BLACK:
-            /* set the whole frame to color 0 (which is usually black) */
-            memset(pixels, 0,
-                s->frame.linesize[0] * s->avctx->height);
-            break;
-
-        case FLI_BRUN:
-            /* Byte run compression: This chunk type only occurs in the first
-             * FLI frame and it will update the entire frame. */
-            y_ptr = 0;
-            for (lines = 0; lines < s->avctx->height; lines++) {
-                pixel_ptr = y_ptr;
-                /* disregard the line packets; instead, iterate through all
-                 * pixels on a row */
-                stream_ptr++;
-                pixel_countdown = s->avctx->width;
-                while (pixel_countdown > 0) {
-                    byte_run = (signed char)(buf[stream_ptr++]);
-                    if (byte_run > 0) {
-                        palette_idx1 = buf[stream_ptr++];
-                        CHECK_PIXEL_PTR(byte_run);
-                        for (j = 0; j < byte_run; j++) {
-                            pixels[pixel_ptr++] = palette_idx1;
-                            pixel_countdown--;
-                            if (pixel_countdown < 0)
-                                av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
-                                       pixel_countdown, lines);
-                        }
-                    } else {  /* copy bytes if byte_run < 0 */
-                        byte_run = -byte_run;
-                        CHECK_PIXEL_PTR(byte_run);
-                        for (j = 0; j < byte_run; j++) {
-                            palette_idx1 = buf[stream_ptr++];
-                            pixels[pixel_ptr++] = palette_idx1;
-                            pixel_countdown--;
-                            if (pixel_countdown < 0)
-                                av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
-                                       pixel_countdown, lines);
-                        }
-                    }
-                }
-
-                y_ptr += s->frame.linesize[0];
-            }
-            break;
-
-        case FLI_COPY:
-            /* copy the chunk (uncompressed frame) */
-            if (chunk_size - 6 > s->avctx->width * s->avctx->height) {
-                av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
-                       "bigger than image, skipping chunk\n", chunk_size - 6);
-                stream_ptr += chunk_size - 6;
-            } else {
-                for (y_ptr = 0; y_ptr < s->frame.linesize[0] * s->avctx->height;
-                     y_ptr += s->frame.linesize[0]) {
-                    memcpy(&pixels[y_ptr], &buf[stream_ptr],
-                        s->avctx->width);
-                    stream_ptr += s->avctx->width;
-                }
-            }
-            break;
-
-        case FLI_MINI:
-            /* some sort of a thumbnail? disregard this chunk... */
-            stream_ptr += chunk_size - 6;
-            break;
-
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
-            break;
-        }
-
-        frame_size -= chunk_size;
-        num_chunks--;
-    }
-
-    /* by the end of the chunk, the stream ptr should equal the frame
-     * size (minus 1, possibly); if it doesn't, issue a warning */
-    if ((stream_ptr != buf_size) && (stream_ptr != buf_size - 1))
-        av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
-               "and final chunk ptr = %d\n", buf_size, stream_ptr);
-
-    /* make the palette available on the way out */
-    memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
-    if (s->new_palette) {
-        s->frame.palette_has_changed = 1;
-        s->new_palette = 0;
-    }
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    return buf_size;
-}
-
-static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
-                                      void *data, int *data_size,
-                                      const uint8_t *buf, int buf_size)
-{
-    /* Note, the only difference between the 15Bpp and 16Bpp */
-    /* Format is the pixel format, the packets are processed the same. */
-    FlicDecodeContext *s = avctx->priv_data;
-
-    int stream_ptr = 0;
-    int pixel_ptr;
-    unsigned char palette_idx1;
-
-    unsigned int frame_size;
-    int num_chunks;
-
-    unsigned int chunk_size;
-    int chunk_type;
-
-    int i, j;
-
-    int lines;
-    int compressed_lines;
-    signed short line_packets;
-    int y_ptr;
-    int byte_run;
-    int pixel_skip;
-    int pixel_countdown;
-    unsigned char *pixels;
-    int pixel;
-    unsigned int pixel_limit;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    pixels = s->frame.data[0];
-    pixel_limit = s->avctx->height * s->frame.linesize[0];
-
-    frame_size = AV_RL32(&buf[stream_ptr]);
-    stream_ptr += 6;  /* skip the magic number */
-    num_chunks = AV_RL16(&buf[stream_ptr]);
-    stream_ptr += 10;  /* skip padding */
-
-    frame_size -= 16;
-
-    /* iterate through the chunks */
-    while ((frame_size > 0) && (num_chunks > 0)) {
-        chunk_size = AV_RL32(&buf[stream_ptr]);
-        stream_ptr += 4;
-        chunk_type = AV_RL16(&buf[stream_ptr]);
-        stream_ptr += 2;
-
-        switch (chunk_type) {
-        case FLI_256_COLOR:
-        case FLI_COLOR:
-            /* For some reason, it seems that non-palettized flics do
-             * include one of these chunks in their first frame.
-             * Why I do not know, it seems rather extraneous. */
-/*            av_log(avctx, AV_LOG_ERROR, "Unexpected Palette chunk %d in non-paletised FLC\n",chunk_type);*/
-            stream_ptr = stream_ptr + chunk_size - 6;
-            break;
-
-        case FLI_DELTA:
-        case FLI_DTA_LC:
-            y_ptr = 0;
-            compressed_lines = AV_RL16(&buf[stream_ptr]);
-            stream_ptr += 2;
-            while (compressed_lines > 0) {
-                line_packets = AV_RL16(&buf[stream_ptr]);
-                stream_ptr += 2;
-                if (line_packets < 0) {
-                    line_packets = -line_packets;
-                    y_ptr += line_packets * s->frame.linesize[0];
-                } else {
-                    compressed_lines--;
-                    pixel_ptr = y_ptr;
-                    CHECK_PIXEL_PTR(0);
-                    pixel_countdown = s->avctx->width;
-                    for (i = 0; i < line_packets; i++) {
-                        /* account for the skip bytes */
-                        pixel_skip = buf[stream_ptr++];
-                        pixel_ptr += (pixel_skip*2); /* Pixel is 2 bytes wide */
-                        pixel_countdown -= pixel_skip;
-                        byte_run = (signed char)(buf[stream_ptr++]);
-                        if (byte_run < 0) {
-                            byte_run = -byte_run;
-                            pixel    = AV_RL16(&buf[stream_ptr]);
-                            stream_ptr += 2;
-                            CHECK_PIXEL_PTR(2 * byte_run);
-                            for (j = 0; j < byte_run; j++, pixel_countdown -= 2) {
-                                *((signed short*)(&pixels[pixel_ptr])) = pixel;
-                                pixel_ptr += 2;
-                            }
-                        } else {
-                            CHECK_PIXEL_PTR(2 * byte_run);
-                            for (j = 0; j < byte_run; j++, pixel_countdown--) {
-                                *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]);
-                                stream_ptr += 2;
-                                pixel_ptr += 2;
-                            }
-                        }
-                    }
-
-                    y_ptr += s->frame.linesize[0];
-                }
-            }
-            break;
-
-        case FLI_LC:
-            av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-paletised FLC\n");
-            stream_ptr = stream_ptr + chunk_size - 6;
-            break;
-
-        case FLI_BLACK:
-            /* set the whole frame to 0x0000 which is black in both 15Bpp and 16Bpp modes. */
-            memset(pixels, 0x0000,
-                   s->frame.linesize[0] * s->avctx->height);
-            break;
-
-        case FLI_BRUN:
-            y_ptr = 0;
-            for (lines = 0; lines < s->avctx->height; lines++) {
-                pixel_ptr = y_ptr;
-                /* disregard the line packets; instead, iterate through all
-                 * pixels on a row */
-                stream_ptr++;
-                pixel_countdown = (s->avctx->width * 2);
-
-                while (pixel_countdown > 0) {
-                    byte_run = (signed char)(buf[stream_ptr++]);
-                    if (byte_run > 0) {
-                        palette_idx1 = buf[stream_ptr++];
-                        CHECK_PIXEL_PTR(byte_run);
-                        for (j = 0; j < byte_run; j++) {
-                            pixels[pixel_ptr++] = palette_idx1;
-                            pixel_countdown--;
-                            if (pixel_countdown < 0)
-                                av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n",
-                                       pixel_countdown, lines);
-                        }
-                    } else {  /* copy bytes if byte_run < 0 */
-                        byte_run = -byte_run;
-                        CHECK_PIXEL_PTR(byte_run);
-                        for (j = 0; j < byte_run; j++) {
-                            palette_idx1 = buf[stream_ptr++];
-                            pixels[pixel_ptr++] = palette_idx1;
-                            pixel_countdown--;
-                            if (pixel_countdown < 0)
-                                av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
-                                       pixel_countdown, lines);
-                        }
-                    }
-                }
-
-                /* Now FLX is strange, in that it is "byte" as opposed to "pixel" run length compressed.
-                 * This does not give us any good oportunity to perform word endian conversion
-                 * during decompression. So if it is required (i.e., this is not a LE target, we do
-                 * a second pass over the line here, swapping the bytes.
-                 */
-#if HAVE_BIGENDIAN
-                pixel_ptr = y_ptr;
-                pixel_countdown = s->avctx->width;
-                while (pixel_countdown > 0) {
-                    *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[pixel_ptr]);
-                    pixel_ptr += 2;
-                }
-#endif
-                y_ptr += s->frame.linesize[0];
-            }
-            break;
-
-        case FLI_DTA_BRUN:
-            y_ptr = 0;
-            for (lines = 0; lines < s->avctx->height; lines++) {
-                pixel_ptr = y_ptr;
-                /* disregard the line packets; instead, iterate through all
-                 * pixels on a row */
-                stream_ptr++;
-                pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */
-
-                while (pixel_countdown > 0) {
-                    byte_run = (signed char)(buf[stream_ptr++]);
-                    if (byte_run > 0) {
-                        pixel    = AV_RL16(&buf[stream_ptr]);
-                        stream_ptr += 2;
-                        CHECK_PIXEL_PTR(2 * byte_run);
-                        for (j = 0; j < byte_run; j++) {
-                            *((signed short*)(&pixels[pixel_ptr])) = pixel;
-                            pixel_ptr += 2;
-                            pixel_countdown--;
-                            if (pixel_countdown < 0)
-                                av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
-                                       pixel_countdown);
-                        }
-                    } else {  /* copy pixels if byte_run < 0 */
-                        byte_run = -byte_run;
-                        CHECK_PIXEL_PTR(2 * byte_run);
-                        for (j = 0; j < byte_run; j++) {
-                            *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[stream_ptr]);
-                            stream_ptr += 2;
-                            pixel_ptr  += 2;
-                            pixel_countdown--;
-                            if (pixel_countdown < 0)
-                                av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n",
-                                       pixel_countdown);
-                        }
-                    }
-                }
-
-                y_ptr += s->frame.linesize[0];
-            }
-            break;
-
-        case FLI_COPY:
-        case FLI_DTA_COPY:
-            /* copy the chunk (uncompressed frame) */
-            if (chunk_size - 6 > (unsigned int)(s->avctx->width * s->avctx->height)*2) {
-                av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
-                       "bigger than image, skipping chunk\n", chunk_size - 6);
-                stream_ptr += chunk_size - 6;
-            } else {
-
-                for (y_ptr = 0; y_ptr < s->frame.linesize[0] * s->avctx->height;
-                     y_ptr += s->frame.linesize[0]) {
-
-                    pixel_countdown = s->avctx->width;
-                    pixel_ptr = 0;
-                    while (pixel_countdown > 0) {
-                      *((signed short*)(&pixels[y_ptr + pixel_ptr])) = AV_RL16(&buf[stream_ptr+pixel_ptr]);
-                      pixel_ptr += 2;
-                      pixel_countdown--;
-                    }
-                    stream_ptr += s->avctx->width*2;
-                }
-            }
-            break;
-
-        case FLI_MINI:
-            /* some sort of a thumbnail? disregard this chunk... */
-            stream_ptr += chunk_size - 6;
-            break;
-
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
-            break;
-        }
-
-        frame_size -= chunk_size;
-        num_chunks--;
-    }
-
-    /* by the end of the chunk, the stream ptr should equal the frame
-     * size (minus 1, possibly); if it doesn't, issue a warning */
-    if ((stream_ptr != buf_size) && (stream_ptr != buf_size - 1))
-        av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
-               "and final chunk ptr = %d\n", buf_size, stream_ptr);
-
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    return buf_size;
-}
-
-static int flic_decode_frame_24BPP(AVCodecContext *avctx,
-                                   void *data, int *data_size,
-                                   const uint8_t *buf, int buf_size)
-{
-  av_log(avctx, AV_LOG_ERROR, "24Bpp FLC Unsupported due to lack of test files.\n");
-  return -1;
-}
-
-static int flic_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    if (avctx->pix_fmt == PIX_FMT_PAL8) {
-      return flic_decode_frame_8BPP(avctx, data, data_size,
-                                    buf, buf_size);
-    }
-    else if ((avctx->pix_fmt == PIX_FMT_RGB555) ||
-             (avctx->pix_fmt == PIX_FMT_RGB565)) {
-      return flic_decode_frame_15_16BPP(avctx, data, data_size,
-                                        buf, buf_size);
-    }
-    else if (avctx->pix_fmt == PIX_FMT_BGR24) {
-      return flic_decode_frame_24BPP(avctx, data, data_size,
-                                     buf, buf_size);
-    }
-
-    /* Should not get  here, ever as the pix_fmt is processed */
-    /* in flic_decode_init and the above if should deal with */
-    /* the finite set of possibilites allowable by here. */
-    /* But in case we do, just error out. */
-    av_log(avctx, AV_LOG_ERROR, "Unknown FLC format, my science cannot explain how this happened.\n");
-    return -1;
-}
-
-
-static av_cold int flic_decode_end(AVCodecContext *avctx)
-{
-    FlicDecodeContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec flic_decoder = {
-    "flic",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FLIC,
-    sizeof(FlicDecodeContext),
-    flic_decode_init,
-    NULL,
-    flic_decode_end,
-    flic_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Autodesk Animator Flic video"),
-};
diff --git a/libavcodec/flv.h b/libavcodec/flv.h
deleted file mode 100644
index eb10f22..0000000
--- a/libavcodec/flv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * FLV specific private header.
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_FLV_H
-#define AVCODEC_FLV_H
-
-#include "mpegvideo.h"
-#include "get_bits.h"
-#include "put_bits.h"
-
-void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number);
-void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run, int last);
-
-int ff_flv_decode_picture_header(MpegEncContext *s);
-void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last);
-
-#endif
-
diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
deleted file mode 100644
index cf9661c..0000000
--- a/libavcodec/flvdec.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * FLV decoding.
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mpegvideo.h"
-#include "h263.h"
-#include "flv.h"
-
-void ff_flv2_decode_ac_esc(GetBitContext *gb, int *level, int *run, int *last){
-    int is11 = get_bits1(gb);
-    *last = get_bits1(gb);
-    *run = get_bits(gb, 6);
-    if(is11){
-        *level = get_sbits(gb, 11);
-    } else {
-        *level = get_sbits(gb, 7);
-    }
-}
-
-int ff_flv_decode_picture_header(MpegEncContext *s)
-{
-    int format, width, height;
-
-    /* picture header */
-    if (get_bits_long(&s->gb, 17) != 1) {
-        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
-        return -1;
-    }
-    format = get_bits(&s->gb, 5);
-    if (format != 0 && format != 1) {
-        av_log(s->avctx, AV_LOG_ERROR, "Bad picture format\n");
-        return -1;
-    }
-    s->h263_flv = format+1;
-    s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
-    format = get_bits(&s->gb, 3);
-    switch (format) {
-    case 0:
-        width = get_bits(&s->gb, 8);
-        height = get_bits(&s->gb, 8);
-        break;
-    case 1:
-        width = get_bits(&s->gb, 16);
-        height = get_bits(&s->gb, 16);
-        break;
-    case 2:
-        width = 352;
-        height = 288;
-        break;
-    case 3:
-        width = 176;
-        height = 144;
-        break;
-    case 4:
-        width = 128;
-        height = 96;
-        break;
-    case 5:
-        width = 320;
-        height = 240;
-        break;
-    case 6:
-        width = 160;
-        height = 120;
-        break;
-    default:
-        width = height = 0;
-        break;
-    }
-    if(avcodec_check_dimensions(s->avctx, width, height))
-        return -1;
-    s->width = width;
-    s->height = height;
-
-    s->pict_type = FF_I_TYPE + get_bits(&s->gb, 2);
-    s->dropable= s->pict_type > FF_P_TYPE;
-    if (s->dropable)
-        s->pict_type = FF_P_TYPE;
-
-    skip_bits1(&s->gb); /* deblocking flag */
-    s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
-
-    s->h263_plus = 0;
-
-    s->unrestricted_mv = 1;
-    s->h263_long_vectors = 0;
-
-    /* PEI */
-    while (get_bits1(&s->gb) != 0) {
-        skip_bits(&s->gb, 8);
-    }
-    s->f_code = 1;
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO){
-        av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
-               s->dropable ? 'D' : av_get_pict_type_char(s->pict_type), s->h263_flv-1, s->qscale, s->picture_number);
-    }
-
-    s->y_dc_scale_table=
-    s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-
-    return 0;
-}
-
-AVCodec flv_decoder = {
-    "flv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FLV1,
-    sizeof(MpegEncContext),
-    ff_h263_decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c
deleted file mode 100644
index bf320f2..0000000
--- a/libavcodec/flvenc.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * FLV Encoding specific code.
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mpegvideo.h"
-#include "h263.h"
-#include "flv.h"
-
-void ff_flv_encode_picture_header(MpegEncContext * s, int picture_number)
-{
-      int format;
-
-      align_put_bits(&s->pb);
-
-      put_bits(&s->pb, 17, 1);
-      put_bits(&s->pb, 5, (s->h263_flv-1)); /* 0: h263 escape codes 1: 11-bit escape codes */
-      put_bits(&s->pb, 8, (((int64_t)s->picture_number * 30 * s->avctx->time_base.num) / //FIXME use timestamp
-                           s->avctx->time_base.den) & 0xff); /* TemporalReference */
-      if (s->width == 352 && s->height == 288)
-        format = 2;
-      else if (s->width == 176 && s->height == 144)
-        format = 3;
-      else if (s->width == 128 && s->height == 96)
-        format = 4;
-      else if (s->width == 320 && s->height == 240)
-        format = 5;
-      else if (s->width == 160 && s->height == 120)
-        format = 6;
-      else if (s->width <= 255 && s->height <= 255)
-        format = 0; /* use 1 byte width & height */
-      else
-        format = 1; /* use 2 bytes width & height */
-      put_bits(&s->pb, 3, format); /* PictureSize */
-      if (format == 0) {
-        put_bits(&s->pb, 8, s->width);
-        put_bits(&s->pb, 8, s->height);
-      } else if (format == 1) {
-        put_bits(&s->pb, 16, s->width);
-        put_bits(&s->pb, 16, s->height);
-      }
-      put_bits(&s->pb, 2, s->pict_type == FF_P_TYPE); /* PictureType */
-      put_bits(&s->pb, 1, 1); /* DeblockingFlag: on */
-      put_bits(&s->pb, 5, s->qscale); /* Quantizer */
-      put_bits(&s->pb, 1, 0); /* ExtraInformation */
-
-      if(s->h263_aic){
-        s->y_dc_scale_table=
-          s->c_dc_scale_table= ff_aic_dc_scale_table;
-      }else{
-        s->y_dc_scale_table=
-          s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-      }
-}
-
-void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, int run, int last){
-    if(level < 64) { // 7-bit level
-        put_bits(pb, 1, 0);
-        put_bits(pb, 1, last);
-        put_bits(pb, 6, run);
-
-        put_sbits(pb, 7, slevel);
-    } else {
-        /* 11-bit level */
-        put_bits(pb, 1, 1);
-        put_bits(pb, 1, last);
-        put_bits(pb, 6, run);
-
-        put_sbits(pb, 11, slevel);
-    }
-}
-
-AVCodec flv_encoder = {
-    "flv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FLV1,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("Flash Video (FLV) / Sorenson Spark / Sorenson H.263"),
-};
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
deleted file mode 100644
index 959ce92..0000000
--- a/libavcodec/fraps.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Fraps FPS1 decoder
- * Copyright (c) 2005 Roine Gustafsson
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Lossless Fraps 'FPS1' decoder
- * @author Roine Gustafsson <roine at users sf net>
- * @author Konstantin Shishkov
- *
- * Codec algorithm for version 0 is taken from Transcode <www.transcoding.org>
- *
- * Version 2 files support by Konstantin Shishkov
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "huffman.h"
-#include "bytestream.h"
-#include "dsputil.h"
-
-#define FPS_TAG MKTAG('F', 'P', 'S', 'x')
-
-/**
- * local variable storage
- */
-typedef struct FrapsContext{
-    AVCodecContext *avctx;
-    AVFrame frame;
-    uint8_t *tmpbuf;
-    DSPContext dsp;
-} FrapsContext;
-
-
-/**
- * initializes decoder
- * @param avctx codec context
- * @return 0 on success or negative if fails
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    FrapsContext * const s = avctx->priv_data;
-
-    avctx->coded_frame = (AVFrame*)&s->frame;
-    avctx->pix_fmt= PIX_FMT_NONE; /* set in decode_frame */
-
-    s->avctx = avctx;
-    s->tmpbuf = NULL;
-
-    dsputil_init(&s->dsp, avctx);
-
-    return 0;
-}
-
-/**
- * Comparator - our nodes should ascend by count
- * but with preserved symbol order
- */
-static int huff_cmp(const void *va, const void *vb){
-    const Node *a = va, *b = vb;
-    return (a->count - b->count)*256 + a->sym - b->sym;
-}
-
-/**
- * decode Fraps v2 packed plane
- */
-static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
-                               int h, const uint8_t *src, int size, int Uoff,
-                               const int step)
-{
-    int i, j;
-    GetBitContext gb;
-    VLC vlc;
-    Node nodes[512];
-
-    for(i = 0; i < 256; i++)
-        nodes[i].count = bytestream_get_le32(&src);
-    size -= 1024;
-    if (ff_huff_build_tree(s->avctx, &vlc, 256, nodes, huff_cmp,
-                           FF_HUFFMAN_FLAG_ZERO_COUNT) < 0)
-        return -1;
-    /* we have built Huffman table and are ready to decode plane */
-
-    /* convert bits so they may be used by standard bitreader */
-    s->dsp.bswap_buf((uint32_t *)s->tmpbuf, (const uint32_t *)src, size >> 2);
-
-    init_get_bits(&gb, s->tmpbuf, size * 8);
-    for(j = 0; j < h; j++){
-        for(i = 0; i < w*step; i += step){
-            dst[i] = get_vlc2(&gb, vlc.table, 9, 3);
-            /* lines are stored as deltas between previous lines
-             * and we need to add 0x80 to the first lines of chroma planes
-             */
-            if(j) dst[i] += dst[i - stride];
-            else if(Uoff) dst[i] += 0x80;
-        }
-        dst += stride;
-    }
-    free_vlc(&vlc);
-    return 0;
-}
-
-/**
- * decode a frame
- * @param avctx codec context
- * @param data output AVFrame
- * @param data_size size of output data or 0 if no picture is returned
- * @param buf input data frame
- * @param buf_size size of input data frame
- * @return number of consumed bytes on success or negative if decode fails
- */
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    FrapsContext * const s = avctx->priv_data;
-    AVFrame *frame = data;
-    AVFrame * const f = (AVFrame*)&s->frame;
-    uint32_t header;
-    unsigned int version,header_size;
-    unsigned int x, y;
-    const uint32_t *buf32;
-    uint32_t *luma1,*luma2,*cb,*cr;
-    uint32_t offs[4];
-    int i, j, is_chroma, planes;
-
-
-    header = AV_RL32(buf);
-    version = header & 0xff;
-    header_size = (header & (1<<30))? 8 : 4; /* bit 30 means pad to 8 bytes */
-
-    if (version > 5) {
-        av_log(avctx, AV_LOG_ERROR,
-               "This file is encoded with Fraps version %d. " \
-               "This codec can only decode versions <= 5.\n", version);
-        return -1;
-    }
-
-    buf+=4;
-    if (header_size == 8)
-        buf+=4;
-
-    switch(version) {
-    case 0:
-    default:
-        /* Fraps v0 is a reordered YUV420 */
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-
-        if ( (buf_size != avctx->width*avctx->height*3/2+header_size) &&
-             (buf_size != header_size) ) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Invalid frame length %d (should be %d)\n",
-                   buf_size, avctx->width*avctx->height*3/2+header_size);
-            return -1;
-        }
-
-        if (( (avctx->width % 8) != 0) || ( (avctx->height % 2) != 0 )) {
-            av_log(avctx, AV_LOG_ERROR, "Invalid frame size %dx%d\n",
-                   avctx->width, avctx->height);
-            return -1;
-        }
-
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if (avctx->reget_buffer(avctx, f)) {
-            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-            return -1;
-        }
-        /* bit 31 means same as previous pic */
-        f->pict_type = (header & (1<<31))? FF_P_TYPE : FF_I_TYPE;
-        f->key_frame = f->pict_type == FF_I_TYPE;
-
-        if (f->pict_type == FF_I_TYPE) {
-            buf32=(const uint32_t*)buf;
-            for(y=0; y<avctx->height/2; y++){
-                luma1=(uint32_t*)&f->data[0][ y*2*f->linesize[0] ];
-                luma2=(uint32_t*)&f->data[0][ (y*2+1)*f->linesize[0] ];
-                cr=(uint32_t*)&f->data[1][ y*f->linesize[1] ];
-                cb=(uint32_t*)&f->data[2][ y*f->linesize[2] ];
-                for(x=0; x<avctx->width; x+=8){
-                    *(luma1++) = *(buf32++);
-                    *(luma1++) = *(buf32++);
-                    *(luma2++) = *(buf32++);
-                    *(luma2++) = *(buf32++);
-                    *(cr++) = *(buf32++);
-                    *(cb++) = *(buf32++);
-                }
-            }
-        }
-        break;
-
-    case 1:
-        /* Fraps v1 is an upside-down BGR24 */
-        avctx->pix_fmt = PIX_FMT_BGR24;
-
-        if ( (buf_size != avctx->width*avctx->height*3+header_size) &&
-             (buf_size != header_size) ) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Invalid frame length %d (should be %d)\n",
-                   buf_size, avctx->width*avctx->height*3+header_size);
-            return -1;
-        }
-
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if (avctx->reget_buffer(avctx, f)) {
-            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-            return -1;
-        }
-        /* bit 31 means same as previous pic */
-        f->pict_type = (header & (1<<31))? FF_P_TYPE : FF_I_TYPE;
-        f->key_frame = f->pict_type == FF_I_TYPE;
-
-        if (f->pict_type == FF_I_TYPE) {
-            for(y=0; y<avctx->height; y++)
-                memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ],
-                       &buf[y*avctx->width*3],
-                       3*avctx->width);
-        }
-        break;
-
-    case 2:
-    case 4:
-        /**
-         * Fraps v2 is Huffman-coded YUV420 planes
-         * Fraps v4 is virtually the same
-         */
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-        planes = 3;
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if (avctx->reget_buffer(avctx, f)) {
-            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-            return -1;
-        }
-        /* skip frame */
-        if(buf_size == 8) {
-            f->pict_type = FF_P_TYPE;
-            f->key_frame = 0;
-            break;
-        }
-        f->pict_type = FF_I_TYPE;
-        f->key_frame = 1;
-        if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) {
-            av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
-            return -1;
-        }
-        for(i = 0; i < planes; i++) {
-            offs[i] = AV_RL32(buf + 4 + i * 4);
-            if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) {
-                av_log(avctx, AV_LOG_ERROR, "Fraps: plane %i offset is out of bounds\n", i);
-                return -1;
-            }
-        }
-        offs[planes] = buf_size;
-        for(i = 0; i < planes; i++){
-            is_chroma = !!i;
-            s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
-            if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma,
-                    avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) {
-                av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
-                return -1;
-            }
-        }
-        break;
-    case 3:
-    case 5:
-        /* Virtually the same as version 4, but is for RGB24 */
-        avctx->pix_fmt = PIX_FMT_BGR24;
-        planes = 3;
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if (avctx->reget_buffer(avctx, f)) {
-            av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-            return -1;
-        }
-        /* skip frame */
-        if(buf_size == 8) {
-            f->pict_type = FF_P_TYPE;
-            f->key_frame = 0;
-            break;
-        }
-        f->pict_type = FF_I_TYPE;
-        f->key_frame = 1;
-        if ((AV_RL32(buf) != FPS_TAG)||(buf_size < (planes*1024 + 24))) {
-            av_log(avctx, AV_LOG_ERROR, "Fraps: error in data stream\n");
-            return -1;
-        }
-        for(i = 0; i < planes; i++) {
-            offs[i] = AV_RL32(buf + 4 + i * 4);
-            if(offs[i] >= buf_size || (i && offs[i] <= offs[i - 1] + 1024)) {
-                av_log(avctx, AV_LOG_ERROR, "Fraps: plane %i offset is out of bounds\n", i);
-                return -1;
-            }
-        }
-        offs[planes] = buf_size;
-        for(i = 0; i < planes; i++){
-            s->tmpbuf = av_realloc(s->tmpbuf, offs[i + 1] - offs[i] - 1024 + FF_INPUT_BUFFER_PADDING_SIZE);
-            if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0],
-                    avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) {
-                av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
-                return -1;
-            }
-        }
-        // convert pseudo-YUV into real RGB
-        for(j = 0; j < avctx->height; j++){
-            for(i = 0; i < avctx->width; i++){
-                f->data[0][0 + i*3 + j*f->linesize[0]] += f->data[0][1 + i*3 + j*f->linesize[0]];
-                f->data[0][2 + i*3 + j*f->linesize[0]] += f->data[0][1 + i*3 + j*f->linesize[0]];
-            }
-        }
-        break;
-    }
-
-    *frame = *f;
-    *data_size = sizeof(AVFrame);
-
-    return buf_size;
-}
-
-
-/**
- * closes decoder
- * @param avctx codec context
- * @return 0 on success or negative if fails
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    FrapsContext *s = (FrapsContext*)avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    av_freep(&s->tmpbuf);
-    return 0;
-}
-
-
-AVCodec fraps_decoder = {
-    "fraps",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FRAPS,
-    sizeof(FrapsContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Fraps"),
-};
diff --git a/libavcodec/frwu.c b/libavcodec/frwu.c
deleted file mode 100644
index b685248..0000000
--- a/libavcodec/frwu.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Forward Uncompressed
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "libavutil/intreadwrite.h"
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    if (avctx->width & 1) {
-        av_log(avctx, AV_LOG_ERROR, "FRWU needs even width\n");
-        return -1;
-    }
-    avctx->pix_fmt = PIX_FMT_UYVY422;
-
-    avctx->coded_frame = avcodec_alloc_frame();
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    int field;
-    AVFrame *pic = avctx->coded_frame;
-    const uint8_t *buf = avpkt->data;
-    const uint8_t *buf_end = buf + avpkt->size;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) {
-        av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n");
-        return -1;
-    }
-    if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) {
-        av_log(avctx, AV_LOG_ERROR, "incorrect marker\n");
-        return -1;
-    }
-
-    pic->reference = 0;
-    if (avctx->get_buffer(avctx, pic) < 0)
-        return -1;
-
-    pic->pict_type = FF_I_TYPE;
-    pic->key_frame = 1;
-    pic->interlaced_frame = 1;
-    pic->top_field_first = 1;
-
-    for (field = 0; field < 2; field++) {
-        int i;
-        int field_h = (avctx->height + !field) >> 1;
-        int field_size, min_field_size = avctx->width * 2 * field_h;
-        uint8_t *dst = pic->data[0];
-        if (buf_end - buf < 8)
-            return -1;
-        buf += 4; // flags? 0x80 == bottom field maybe?
-        field_size = bytestream_get_le32(&buf);
-        if (field_size < min_field_size) {
-            av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size);
-            return -1;
-        }
-        if (buf_end - buf < field_size) {
-            av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf));
-            return -1;
-        }
-        if (field)
-            dst += pic->linesize[0];
-        for (i = 0; i < field_h; i++) {
-            memcpy(dst, buf, avctx->width * 2);
-            buf += avctx->width * 2;
-            dst += pic->linesize[0] << 1;
-        }
-        buf += field_size - min_field_size;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = *pic;
-
-    return avpkt->size;
-}
-
-static av_cold int decode_close(AVCodecContext *avctx)
-{
-    AVFrame *pic = avctx->coded_frame;
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-AVCodec frwu_decoder = {
-    "FRWU",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FRWU,
-    0,
-    decode_init,
-    NULL,
-    decode_close,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Forward Uncompressed"),
-};
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
deleted file mode 100644
index 5e00511..0000000
--- a/libavcodec/g726.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * G.726 ADPCM audio codec
- * Copyright (c) 2004 Roman Shaposhnik
- *
- * This is a very straightforward rendition of the G.726
- * Section 4 "Computational Details".
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <limits.h>
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-
-/**
- * G.726 11bit float.
- * G.726 Standard uses rather odd 11bit floating point arithmentic for
- * numerous occasions. It's a mistery to me why they did it this way
- * instead of simply using 32bit integer arithmetic.
- */
-typedef struct Float11 {
-    uint8_t sign;   /**< 1bit sign */
-    uint8_t exp;    /**< 4bit exponent */
-    uint8_t mant;   /**< 6bit mantissa */
-} Float11;
-
-static inline Float11* i2f(int i, Float11* f)
-{
-    f->sign = (i < 0);
-    if (f->sign)
-        i = -i;
-    f->exp = av_log2_16bit(i) + !!i;
-    f->mant = i? (i<<6) >> f->exp : 1<<5;
-    return f;
-}
-
-static inline int16_t mult(Float11* f1, Float11* f2)
-{
-        int res, exp;
-
-        exp = f1->exp + f2->exp;
-        res = (((f1->mant * f2->mant) + 0x30) >> 4);
-        res = exp > 19 ? res << (exp - 19) : res >> (19 - exp);
-        return (f1->sign ^ f2->sign) ? -res : res;
-}
-
-static inline int sgn(int value)
-{
-    return (value < 0) ? -1 : 1;
-}
-
-typedef struct G726Tables {
-    const int* quant;         /**< quantization table */
-    const int16_t* iquant;    /**< inverse quantization table */
-    const int16_t* W;         /**< special table #1 ;-) */
-    const uint8_t* F;         /**< special table #2 */
-} G726Tables;
-
-typedef struct G726Context {
-    G726Tables tbls;    /**< static tables needed for computation */
-
-    Float11 sr[2];      /**< prev. reconstructed samples */
-    Float11 dq[6];      /**< prev. difference */
-    int a[2];           /**< second order predictor coeffs */
-    int b[6];           /**< sixth order predictor coeffs */
-    int pk[2];          /**< signs of prev. 2 sez + dq */
-
-    int ap;             /**< scale factor control */
-    int yu;             /**< fast scale factor */
-    int yl;             /**< slow scale factor */
-    int dms;            /**< short average magnitude of F[i] */
-    int dml;            /**< long average magnitude of F[i] */
-    int td;             /**< tone detect */
-
-    int se;             /**< estimated signal for the next iteration */
-    int sez;            /**< estimated second order prediction */
-    int y;              /**< quantizer scaling factor for the next iteration */
-    int code_size;
-} G726Context;
-
-static const int quant_tbl16[] =                  /**< 16kbit/s 2bits per sample */
-           { 260, INT_MAX };
-static const int16_t iquant_tbl16[] =
-           { 116, 365, 365, 116 };
-static const int16_t W_tbl16[] =
-           { -22, 439, 439, -22 };
-static const uint8_t F_tbl16[] =
-           { 0, 7, 7, 0 };
-
-static const int quant_tbl24[] =                  /**< 24kbit/s 3bits per sample */
-           {  7, 217, 330, INT_MAX };
-static const int16_t iquant_tbl24[] =
-           { INT16_MIN, 135, 273, 373, 373, 273, 135, INT16_MIN };
-static const int16_t W_tbl24[] =
-           { -4,  30, 137, 582, 582, 137,  30, -4 };
-static const uint8_t F_tbl24[] =
-           { 0, 1, 2, 7, 7, 2, 1, 0 };
-
-static const int quant_tbl32[] =                  /**< 32kbit/s 4bits per sample */
-           { -125,  79, 177, 245, 299, 348, 399, INT_MAX };
-static const int16_t iquant_tbl32[] =
-         { INT16_MIN,   4, 135, 213, 273, 323, 373, 425,
-                 425, 373, 323, 273, 213, 135,   4, INT16_MIN };
-static const int16_t W_tbl32[] =
-           { -12,  18,  41,  64, 112, 198, 355, 1122,
-            1122, 355, 198, 112,  64,  41,  18, -12};
-static const uint8_t F_tbl32[] =
-           { 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 };
-
-static const int quant_tbl40[] =                  /**< 40kbit/s 5bits per sample */
-           { -122, -16,  67, 138, 197, 249, 297, 338,
-              377, 412, 444, 474, 501, 527, 552, INT_MAX };
-static const int16_t iquant_tbl40[] =
-         { INT16_MIN, -66,  28, 104, 169, 224, 274, 318,
-                 358, 395, 429, 459, 488, 514, 539, 566,
-                 566, 539, 514, 488, 459, 429, 395, 358,
-                 318, 274, 224, 169, 104,  28, -66, INT16_MIN };
-static const int16_t W_tbl40[] =
-           {   14,  14,  24,  39,  40,  41,   58,  100,
-              141, 179, 219, 280, 358, 440,  529,  696,
-              696, 529, 440, 358, 280, 219,  179,  141,
-              100,  58,  41,  40,  39,  24,   14,   14 };
-static const uint8_t F_tbl40[] =
-           { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6,
-             6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
-
-static const G726Tables G726Tables_pool[] =
-           {{ quant_tbl16, iquant_tbl16, W_tbl16, F_tbl16 },
-            { quant_tbl24, iquant_tbl24, W_tbl24, F_tbl24 },
-            { quant_tbl32, iquant_tbl32, W_tbl32, F_tbl32 },
-            { quant_tbl40, iquant_tbl40, W_tbl40, F_tbl40 }};
-
-
-/**
- * Para 4.2.2 page 18: Adaptive quantizer.
- */
-static inline uint8_t quant(G726Context* c, int d)
-{
-    int sign, exp, i, dln;
-
-    sign = i = 0;
-    if (d < 0) {
-        sign = 1;
-        d = -d;
-    }
-    exp = av_log2_16bit(d);
-    dln = ((exp<<7) + (((d<<7)>>exp)&0x7f)) - (c->y>>2);
-
-    while (c->tbls.quant[i] < INT_MAX && c->tbls.quant[i] < dln)
-        ++i;
-
-    if (sign)
-        i = ~i;
-    if (c->code_size != 2 && i == 0) /* I'm not sure this is a good idea */
-        i = 0xff;
-
-    return i;
-}
-
-/**
- * Para 4.2.3 page 22: Inverse adaptive quantizer.
- */
-static inline int16_t inverse_quant(G726Context* c, int i)
-{
-    int dql, dex, dqt;
-
-    dql = c->tbls.iquant[i] + (c->y >> 2);
-    dex = (dql>>7) & 0xf;        /* 4bit exponent */
-    dqt = (1<<7) + (dql & 0x7f); /* log2 -> linear */
-    return (dql < 0) ? 0 : ((dqt<<dex) >> 7);
-}
-
-static int16_t g726_decode(G726Context* c, int I)
-{
-    int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0;
-    Float11 f;
-    int I_sig= I >> (c->code_size - 1);
-
-    dq = inverse_quant(c, I);
-
-    /* Transition detect */
-    ylint = (c->yl >> 15);
-    ylfrac = (c->yl >> 10) & 0x1f;
-    thr2 = (ylint > 9) ? 0x1f << 10 : (0x20 + ylfrac) << ylint;
-    tr= (c->td == 1 && dq > ((3*thr2)>>2));
-
-    if (I_sig)  /* get the sign */
-        dq = -dq;
-    re_signal = c->se + dq;
-
-    /* Update second order predictor coefficient A2 and A1 */
-    pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;
-    dq0 = dq ? sgn(dq) : 0;
-    if (tr) {
-        c->a[0] = 0;
-        c->a[1] = 0;
-        for (i=0; i<6; i++)
-            c->b[i] = 0;
-    } else {
-        /* This is a bit crazy, but it really is +255 not +256 */
-        fa1 = av_clip((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255);
-
-        c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7);
-        c->a[1] = av_clip(c->a[1], -12288, 12288);
-        c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8);
-        c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]);
-
-        for (i=0; i<6; i++)
-            c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8);
-    }
-
-    /* Update Dq and Sr and Pk */
-    c->pk[1] = c->pk[0];
-    c->pk[0] = pk0 ? pk0 : 1;
-    c->sr[1] = c->sr[0];
-    i2f(re_signal, &c->sr[0]);
-    for (i=5; i>0; i--)
-        c->dq[i] = c->dq[i-1];
-    i2f(dq, &c->dq[0]);
-    c->dq[0].sign = I_sig; /* Isn't it crazy ?!?! */
-
-    c->td = c->a[1] < -11776;
-
-    /* Update Ap */
-    c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5);
-    c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7);
-    if (tr)
-        c->ap = 256;
-    else {
-        c->ap += (-c->ap) >> 4;
-        if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3))
-            c->ap += 0x20;
-    }
-
-    /* Update Yu and Yl */
-    c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120);
-    c->yl += c->yu + ((-c->yl)>>6);
-
-    /* Next iteration for Y */
-    al = (c->ap >= 256) ? 1<<6 : c->ap >> 2;
-    c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6;
-
-    /* Next iteration for SE and SEZ */
-    c->se = 0;
-    for (i=0; i<6; i++)
-        c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]);
-    c->sez = c->se >> 1;
-    for (i=0; i<2; i++)
-        c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]);
-    c->se >>= 1;
-
-    return av_clip(re_signal << 2, -0xffff, 0xffff);
-}
-
-static av_cold int g726_reset(G726Context* c, int index)
-{
-    int i;
-
-    c->tbls = G726Tables_pool[index];
-    for (i=0; i<2; i++) {
-        c->sr[i].mant = 1<<5;
-        c->pk[i] = 1;
-    }
-    for (i=0; i<6; i++) {
-        c->dq[i].mant = 1<<5;
-    }
-    c->yu = 544;
-    c->yl = 34816;
-
-    c->y = 544;
-
-    return 0;
-}
-
-#if CONFIG_ADPCM_G726_ENCODER
-static int16_t g726_encode(G726Context* c, int16_t sig)
-{
-    uint8_t i;
-
-    i = quant(c, sig/4 - c->se) & ((1<<c->code_size) - 1);
-    g726_decode(c, i);
-    return i;
-}
-#endif
-
-/* Interfacing to the libavcodec */
-
-static av_cold int g726_init(AVCodecContext * avctx)
-{
-    G726Context* c = avctx->priv_data;
-    unsigned int index;
-
-    if (avctx->sample_rate <= 0) {
-        av_log(avctx, AV_LOG_ERROR, "Samplerate is invalid\n");
-        return -1;
-    }
-
-    index = (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2;
-
-    if (avctx->bit_rate % avctx->sample_rate && avctx->codec->encode) {
-        av_log(avctx, AV_LOG_ERROR, "Bitrate - Samplerate combination is invalid\n");
-        return -1;
-    }
-    if(avctx->channels != 1){
-        av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n");
-        return -1;
-    }
-    if(index>3){
-        av_log(avctx, AV_LOG_ERROR, "Unsupported number of bits %d\n", index+2);
-        return -1;
-    }
-    g726_reset(c, index);
-    c->code_size = index+2;
-
-    avctx->coded_frame = avcodec_alloc_frame();
-    if (!avctx->coded_frame)
-        return AVERROR(ENOMEM);
-    avctx->coded_frame->key_frame = 1;
-
-    if (avctx->codec->decode)
-        avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    return 0;
-}
-
-static av_cold int g726_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-    return 0;
-}
-
-#if CONFIG_ADPCM_G726_ENCODER
-static int g726_encode_frame(AVCodecContext *avctx,
-                            uint8_t *dst, int buf_size, void *data)
-{
-    G726Context *c = avctx->priv_data;
-    short *samples = data;
-    PutBitContext pb;
-
-    init_put_bits(&pb, dst, 1024*1024);
-
-    for (; buf_size; buf_size--)
-        put_bits(&pb, c->code_size, g726_encode(c, *samples++));
-
-    flush_put_bits(&pb);
-
-    return put_bits_count(&pb)>>3;
-}
-#endif
-
-static int g726_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    G726Context *c = avctx->priv_data;
-    short *samples = data;
-    GetBitContext gb;
-
-    init_get_bits(&gb, buf, buf_size * 8);
-
-    while (get_bits_count(&gb) + c->code_size <= buf_size*8)
-        *samples++ = g726_decode(c, get_bits(&gb, c->code_size));
-
-    if(buf_size*8 != get_bits_count(&gb))
-        av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n");
-
-    *data_size = (uint8_t*)samples - (uint8_t*)data;
-    return buf_size;
-}
-
-#if CONFIG_ADPCM_G726_ENCODER
-AVCodec adpcm_g726_encoder = {
-    "g726",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_ADPCM_G726,
-    sizeof(G726Context),
-    g726_init,
-    g726_encode_frame,
-    g726_close,
-    NULL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
-};
-#endif
-
-AVCodec adpcm_g726_decoder = {
-    "g726",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_ADPCM_G726,
-    sizeof(G726Context),
-    g726_init,
-    NULL,
-    g726_close,
-    g726_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"),
-};
diff --git a/libavcodec/g729.h b/libavcodec/g729.h
deleted file mode 100644
index 462cf8f..0000000
--- a/libavcodec/g729.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * G.729 decoder
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVCODEC_G729_H
-#define AVCODEC_G729_H
-
-/**
- * subframe size
- */
-#define SUBFRAME_SIZE 40
-
-#endif // AVCODEC_G729_H
diff --git a/libavcodec/g729data.h b/libavcodec/g729data.h
deleted file mode 100644
index 1d64553..0000000
--- a/libavcodec/g729data.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * data for G.729 decoder
- * Copyright (c) 2007 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_G729DATA_H
-#define AVCODEC_G729DATA_H
-
-#include <stdint.h>
-
-#define MA_NP                4  ///< Moving Average (MA) prediction order
-
-#define VQ_1ST_BITS          7  ///< first stage vector of quantizer (size in bits)
-#define VQ_2ND_BITS          5  ///< second stage vector of quantizer (size in bits)
-
-#define GC_1ST_IDX_BITS_8K   3  ///< gain codebook (first stage) index, 8k mode (size in bits)
-#define GC_2ND_IDX_BITS_8K   4  ///< gain codebook (second stage) index, 8k mode (size in bits)
-
-#define GC_1ST_IDX_BITS_6K4  3  ///< gain codebook (first stage) index, 6.4k mode (size in bits)
-#define GC_2ND_IDX_BITS_6K4  3  ///< gain codebook (second stage) index, 6.4k mode (size in bits)
-
-/**
- * first stage LSP codebook
- * (10-dimensional, with 128 entries (3.24 of G.729)
- */
-static const int16_t cb_lsp_1st[1<<VQ_1ST_BITS][10] = { /* (2.13) */
-  { 1486,  2168,  3751,  9074, 12134, 13944, 17983, 19173, 21190, 21820},
-  { 1730,  2640,  3450,  4870,  6126,  7876, 15644, 17817, 20294, 21902},
-  { 1568,  2256,  3088,  4874, 11063, 13393, 18307, 19293, 21109, 21741},
-  { 1733,  2512,  3357,  4708,  6977, 10296, 17024, 17956, 19145, 20350},
-  { 1744,  2436,  3308,  8731, 10432, 12007, 15614, 16639, 21359, 21913},
-  { 1786,  2369,  3372,  4521,  6795, 12963, 17674, 18988, 20855, 21640},
-  { 1631,  2433,  3361,  6328, 10709, 12013, 13277, 13904, 19441, 21088},
-  { 1489,  2364,  3291,  6250,  9227, 10403, 13843, 15278, 17721, 21451},
-  { 1869,  2533,  3475,  4365,  9152, 14513, 15908, 17022, 20611, 21411},
-  { 2070,  3025,  4333,  5854,  7805,  9231, 10597, 16047, 20109, 21834},
-  { 1910,  2673,  3419,  4261, 11168, 15111, 16577, 17591, 19310, 20265},
-  { 1141,  1815,  2624,  4623,  6495,  9588, 13968, 16428, 19351, 21286},
-  { 2192,  3171,  4707,  5808, 10904, 12500, 14162, 15664, 21124, 21789},
-  { 1286,  1907,  2548,  3453,  9574, 11964, 15978, 17344, 19691, 22495},
-  { 1921,  2720,  4604,  6684, 11503, 12992, 14350, 15262, 16997, 20791},
-  { 2052,  2759,  3897,  5246,  6638, 10267, 15834, 16814, 18149, 21675},
-  { 1798,  2497,  5617, 11449, 13189, 14711, 17050, 18195, 20307, 21182},
-  { 1009,  1647,  2889,  5709,  9541, 12354, 15231, 18494, 20966, 22033},
-  { 3016,  3794,  5406,  7469, 12488, 13984, 15328, 16334, 19952, 20791},
-  { 2203,  3040,  3796,  5442, 11987, 13512, 14931, 16370, 17856, 18803},
-  { 2912,  4292,  7988,  9572, 11562, 13244, 14556, 16529, 20004, 21073},
-  { 2861,  3607,  5923,  7034,  9234, 12054, 13729, 18056, 20262, 20974},
-  { 3069,  4311,  5967,  7367, 11482, 12699, 14309, 16233, 18333, 19172},
-  { 2434,  3661,  4866,  5798, 10383, 11722, 13049, 15668, 18862, 19831},
-  { 2020,  2605,  3860,  9241, 13275, 14644, 16010, 17099, 19268, 20251},
-  { 1877,  2809,  3590,  4707, 11056, 12441, 15622, 17168, 18761, 19907},
-  { 2107,  2873,  3673,  5799, 13579, 14687, 15938, 17077, 18890, 19831},
-  { 1612,  2284,  2944,  3572,  8219, 13959, 15924, 17239, 18592, 20117},
-  { 2420,  3156,  6542, 10215, 12061, 13534, 15305, 16452, 18717, 19880},
-  { 1667,  2612,  3534,  5237, 10513, 11696, 12940, 16798, 18058, 19378},
-  { 2388,  3017,  4839,  9333, 11413, 12730, 15024, 16248, 17449, 18677},
-  { 1875,  2786,  4231,  6320,  8694, 10149, 11785, 17013, 18608, 19960},
-  {  679,  1411,  4654,  8006, 11446, 13249, 15763, 18127, 20361, 21567},
-  { 1838,  2596,  3578,  4608,  5650, 11274, 14355, 15886, 20579, 21754},
-  { 1303,  1955,  2395,  3322, 12023, 13764, 15883, 18077, 20180, 21232},
-  { 1438,  2102,  2663,  3462,  8328, 10362, 13763, 17248, 19732, 22344},
-  {  860,  1904,  6098,  7775,  9815, 12007, 14821, 16709, 19787, 21132},
-  { 1673,  2723,  3704,  6125,  7668,  9447, 13683, 14443, 20538, 21731},
-  { 1246,  1849,  2902,  4508,  7221, 12710, 14835, 16314, 19335, 22720},
-  { 1525,  2260,  3862,  5659,  7342, 11748, 13370, 14442, 18044, 21334},
-  { 1196,  1846,  3104,  7063, 10972, 12905, 14814, 17037, 19922, 22636},
-  { 2147,  3106,  4475,  6511,  8227,  9765, 10984, 12161, 18971, 21300},
-  { 1585,  2405,  2994,  4036, 11481, 13177, 14519, 15431, 19967, 21275},
-  { 1778,  2688,  3614,  4680,  9465, 11064, 12473, 16320, 19742, 20800},
-  { 1862,  2586,  3492,  6719, 11708, 13012, 14364, 16128, 19610, 20425},
-  { 1395,  2156,  2669,  3386, 10607, 12125, 13614, 16705, 18976, 21367},
-  { 1444,  2117,  3286,  6233,  9423, 12981, 14998, 15853, 17188, 21857},
-  { 2004,  2895,  3783,  4897,  6168,  7297, 12609, 16445, 19297, 21465},
-  { 1495,  2863,  6360,  8100, 11399, 14271, 15902, 17711, 20479, 22061},
-  { 2484,  3114,  5718,  7097,  8400, 12616, 14073, 14847, 20535, 21396},
-  { 2424,  3277,  5296,  6284, 11290, 12903, 16022, 17508, 19333, 20283},
-  { 2565,  3778,  5360,  6989,  8782, 10428, 14390, 15742, 17770, 21734},
-  { 2727,  3384,  6613,  9254, 10542, 12236, 14651, 15687, 20074, 21102},
-  { 1916,  2953,  6274,  8088,  9710, 10925, 12392, 16434, 20010, 21183},
-  { 3384,  4366,  5349,  7667, 11180, 12605, 13921, 15324, 19901, 20754},
-  { 3075,  4283,  5951,  7619,  9604, 11010, 12384, 14006, 20658, 21497},
-  { 1751,  2455,  5147,  9966, 11621, 13176, 14739, 16470, 20788, 21756},
-  { 1442,  2188,  3330,  6813,  8929, 12135, 14476, 15306, 19635, 20544},
-  { 2294,  2895,  4070,  8035, 12233, 13416, 14762, 17367, 18952, 19688},
-  { 1937,  2659,  4602,  6697,  9071, 12863, 14197, 15230, 16047, 18877},
-  { 2071,  2663,  4216,  9445, 10887, 12292, 13949, 14909, 19236, 20341},
-  { 1740,  2491,  3488,  8138,  9656, 11153, 13206, 14688, 20896, 21907},
-  { 2199,  2881,  4675,  8527, 10051, 11408, 14435, 15463, 17190, 20597},
-  { 1943,  2988,  4177,  6039,  7478,  8536, 14181, 15551, 17622, 21579},
-  { 1825,  3175,  7062,  9818, 12824, 15450, 18330, 19856, 21830, 22412},
-  { 2464,  3046,  4822,  5977,  7696, 15398, 16730, 17646, 20588, 21320},
-  { 2550,  3393,  5305,  6920, 10235, 14083, 18143, 19195, 20681, 21336},
-  { 3003,  3799,  5321,  6437,  7919, 11643, 15810, 16846, 18119, 18980},
-  { 3455,  4157,  6838,  8199,  9877, 12314, 15905, 16826, 19949, 20892},
-  { 3052,  3769,  4891,  5810,  6977, 10126, 14788, 15990, 19773, 20904},
-  { 3671,  4356,  5827,  6997,  8460, 12084, 14154, 14939, 19247, 20423},
-  { 2716,  3684,  5246,  6686,  8463, 10001, 12394, 14131, 16150, 19776},
-  { 1945,  2638,  4130,  7995, 14338, 15576, 17057, 18206, 20225, 20997},
-  { 2304,  2928,  4122,  4824,  5640, 13139, 15825, 16938, 20108, 21054},
-  { 1800,  2516,  3350,  5219, 13406, 15948, 17618, 18540, 20531, 21252},
-  { 1436,  2224,  2753,  4546,  9657, 11245, 15177, 16317, 17489, 19135},
-  { 2319,  2899,  4980,  6936,  8404, 13489, 15554, 16281, 20270, 20911},
-  { 2187,  2919,  4610,  5875,  7390, 12556, 14033, 16794, 20998, 21769},
-  { 2235,  2923,  5121,  6259,  8099, 13589, 15340, 16340, 17927, 20159},
-  { 1765,  2638,  3751,  5730,  7883, 10108, 13633, 15419, 16808, 18574},
-  { 3460,  5741,  9596, 11742, 14413, 16080, 18173, 19090, 20845, 21601},
-  { 3735,  4426,  6199,  7363,  9250, 14489, 16035, 17026, 19873, 20876},
-  { 3521,  4778,  6887,  8680, 12717, 14322, 15950, 18050, 20166, 21145},
-  { 2141,  2968,  6865,  8051, 10010, 13159, 14813, 15861, 17528, 18655},
-  { 4148,  6128,  9028, 10871, 12686, 14005, 15976, 17208, 19587, 20595},
-  { 4403,  5367,  6634,  8371, 10163, 11599, 14963, 16331, 17982, 18768},
-  { 4091,  5386,  6852,  8770, 11563, 13290, 15728, 16930, 19056, 20102},
-  { 2746,  3625,  5299,  7504, 10262, 11432, 13172, 15490, 16875, 17514},
-  { 2248,  3556,  8539, 10590, 12665, 14696, 16515, 17824, 20268, 21247},
-  { 1279,  1960,  3920,  7793, 10153, 14753, 16646, 18139, 20679, 21466},
-  { 2440,  3475,  6737,  8654, 12190, 14588, 17119, 17925, 19110, 19979},
-  { 1879,  2514,  4497,  7572, 10017, 14948, 16141, 16897, 18397, 19376},
-  { 2804,  3688,  7490, 10086, 11218, 12711, 16307, 17470, 20077, 21126},
-  { 2023,  2682,  3873,  8268, 10255, 11645, 15187, 17102, 18965, 19788},
-  { 2823,  3605,  5815,  8595, 10085, 11469, 16568, 17462, 18754, 19876},
-  { 2851,  3681,  5280,  7648,  9173, 10338, 14961, 16148, 17559, 18474},
-  { 1348,  2645,  5826,  8785, 10620, 12831, 16255, 18319, 21133, 22586},
-  { 2141,  3036,  4293,  6082,  7593, 10629, 17158, 18033, 21466, 22084},
-  { 1608,  2375,  3384,  6878,  9970, 11227, 16928, 17650, 20185, 21120},
-  { 2774,  3616,  5014,  6557,  7788,  8959, 17068, 18302, 19537, 20542},
-  { 1934,  4813,  6204,  7212,  8979, 11665, 15989, 17811, 20426, 21703},
-  { 2288,  3507,  5037,  6841,  8278,  9638, 15066, 16481, 21653, 22214},
-  { 2951,  3771,  4878,  7578,  9016, 10298, 14490, 15242, 20223, 20990},
-  { 3256,  4791,  6601,  7521,  8644,  9707, 13398, 16078, 19102, 20249},
-  { 1827,  2614,  3486,  6039, 12149, 13823, 16191, 17282, 21423, 22041},
-  { 1000,  1704,  3002,  6335,  8471, 10500, 14878, 16979, 20026, 22427},
-  { 1646,  2286,  3109,  7245, 11493, 12791, 16824, 17667, 18981, 20222},
-  { 1708,  2501,  3315,  6737,  8729,  9924, 16089, 17097, 18374, 19917},
-  { 2623,  3510,  4478,  5645,  9862, 11115, 15219, 18067, 19583, 20382},
-  { 2518,  3434,  4728,  6388,  8082,  9285, 13162, 18383, 19819, 20552},
-  { 1726,  2383,  4090,  6303,  7805, 12845, 14612, 17608, 19269, 20181},
-  { 2860,  3735,  4838,  6044,  7254,  8402, 14031, 16381, 18037, 19410},
-  { 4247,  5993,  7952,  9792, 12342, 14653, 17527, 18774, 20831, 21699},
-  { 3502,  4051,  5680,  6805,  8146, 11945, 16649, 17444, 20390, 21564},
-  { 3151,  4893,  5899,  7198, 11418, 13073, 15124, 17673, 20520, 21861},
-  { 3960,  4848,  5926,  7259,  8811, 10529, 15661, 16560, 18196, 20183},
-  { 4499,  6604,  8036,  9251, 10804, 12627, 15880, 17512, 20020, 21046},
-  { 4251,  5541,  6654,  8318,  9900, 11686, 15100, 17093, 20572, 21687},
-  { 3769,  5327,  7865,  9360, 10684, 11818, 13660, 15366, 18733, 19882},
-  { 3083,  3969,  6248,  8121,  9798, 10994, 12393, 13686, 17888, 19105},
-  { 2731,  4670,  7063,  9201, 11346, 13735, 16875, 18797, 20787, 22360},
-  { 1187,  2227,  4737,  7214,  9622, 12633, 15404, 17968, 20262, 23533},
-  { 1911,  2477,  3915, 10098, 11616, 12955, 16223, 17138, 19270, 20729},
-  { 1764,  2519,  3887,  6944,  9150, 12590, 16258, 16984, 17924, 18435},
-  { 1400,  3674,  7131,  8718, 10688, 12508, 15708, 17711, 19720, 21068},
-  { 2322,  3073,  4287,  8108,  9407, 10628, 15862, 16693, 19714, 21474},
-  { 2630,  3339,  4758,  8360, 10274, 11333, 12880, 17374, 19221, 19936},
-  { 1721,  2577,  5553,  7195,  8651, 10686, 15069, 16953, 18703, 19929}
-};
-
-/**
- * second stage LSP codebook, high and low parts
-   (both 5-dimensional, with 32 entries (3.2.4 of G.729)
- */
-static const int16_t cb_lsp_2nd[1<<VQ_2ND_BITS][10] = { /* (2.13) */
-  { -435,  -815,  -742,  1033,  -518,   582, -1201,   829,    86,   385},
-  { -833,  -891,   463,    -8, -1251,  1450,    72,  -231,   864,   661},
-  {-1021,   231,  -306,   321,  -220,  -163,  -526,  -754, -1633,   267},
-  {   57,  -198,  -339,   -33, -1468,   573,   796,  -169,  -631,   816},
-  {  171,  -350,   294,  1660,   453,   519,   291,   159,  -640, -1296},
-  { -701,  -842,   -58,   950,   892,  1549,   715,   527,  -714,  -193},
-  {  584,    31,  -289,   356,  -333,  -457,   612,  -283, -1381,  -741},
-  { -109,  -808,   231,    77,   -87,  -344,  1341,  1087,  -654,  -569},
-  { -859,  1236,   550,   854,   714,  -543, -1752,  -195,   -98,  -276},
-  { -877,  -954, -1248,  -299,   212,  -235,  -728,   949,  1517,   895},
-  {  -77,   344,  -620,   763,   413,   502,  -362,  -960,  -483,  1386},
-  { -314,  -307,  -256, -1260,  -429,   450,  -466,  -108,  1010,  2223},
-  {  711,   693,   521,   650,  1305,   -28,  -378,   744, -1005,   240},
-  { -112,  -271,  -500,   946,  1733,   271,   -15,   909,  -259,  1688},
-  {  575,   -10,  -468,  -199,  1101, -1011,   581,   -53,  -747,   878},
-  {  145,  -285, -1280,  -398,    36,  -498, -1377,    18,  -444,  1483},
-  {-1133,  -835,  1350,  1284,   -95,  1015,  -222,   443,   372,  -354},
-  {-1459, -1237,   416,  -213,   466,   669,   659,  1640,   932,   534},
-  {  -15,    66,   468,  1019,  -748,  1385,  -182,  -907,  -721,  -262},
-  { -338,   148,  1445,    75,  -760,   569,  1247,   337,   416,  -121},
-  {  389,   239,  1568,   981,   113,   369, -1003,  -507,  -587,  -904},
-  { -312,   -98,   949,    31,  1104,    72,  -141,  1465,    63,  -785},
-  { 1127,   584,   835,   277, -1159,   208,   301,  -882,   117,  -404},
-  {  539,  -114,   856,  -493,   223,  -912,   623,   -76,   276,  -440},
-  { 2197,  2337,  1268,   670,   304,  -267,  -525,   140,   882,  -139},
-  {-1596,   550,   801,  -456,   -56,  -697,   865,  1060,   413,   446},
-  { 1154,   593,   -77,  1237,   -31,   581, -1037,  -895,   669,   297},
-  {  397,   558,   203,  -797,  -919,     3,   692,  -292,  1050,   782},
-  {  334,  1475,   632,   -80,    48, -1061,  -484,   362,  -597,  -852},
-  { -545,  -330,  -429,  -680,  1133, -1182,  -744,  1340,   262,    63},
-  { 1320,   827,  -398,  -576,   341,  -774,  -483, -1247,   -70,    98},
-  { -163,   674,   -11,  -886,   531, -1125,  -265,  -242,   724,   934}
-};
-
-/**
- * gain codebook (first stage), 8k mode (3.9.2 of G.729)
- */
-static const int16_t cb_gain_1st_8k[1<<GC_1ST_IDX_BITS_8K][2] = { /*(0.14) (2.13) */
-  { 3242 ,  9949 },
-  { 1551 ,  2425 },
-  { 2678 , 27162 },
-  { 1921 ,  9291 },
-  { 1831 ,  5022 },
-  {    1 ,  1516 },
-  {  356 , 14756 },
-  {   57 ,  5404 },
-};
-
-/**
- * gain codebook (second stage), 8k mode (3.9.2 of G.729)
- */
-static const int16_t cb_gain_2nd_8k[1<<GC_2ND_IDX_BITS_8K][2] = { /*(1.14) (1.13) */
-  {  5142 ,   592 },
-  { 17299 ,  1861 },
-  {  6160 ,  2395 },
-  { 16112 ,  3392 },
-  {   826 ,  2005 },
-  { 18973 ,  5935 },
-  {  1994 ,     0 },
-  { 15434 ,   237 },
-  { 10573 ,  2966 },
-  { 15132 ,  4914 },
-  { 11569 ,  1196 },
-  { 14194 ,  1630 },
-  {  8091 ,  4861 },
-  { 15161 , 14276 },
-  {  9120 ,   525 },
-  { 13260 ,  3256 },
-};
-
-/**
- * 4th order Moving Average (MA) Predictor codebook (3.2.4 of G.729)
- */
-static const int16_t cb_ma_predictor[2][MA_NP][10] = { /* (0.15) */
-  {
-    { 8421,  9109,  9175,  8965,  9034,  9057,  8765,  8775,  9106,  8673},
-    { 7018,  7189,  7638,  7307,  7444,  7379,  7038,  6956,  6930,  6868},
-    { 5472,  4990,  5134,  5177,  5246,  5141,  5206,  5095,  4830,  5147},
-    { 4056,  3031,  2614,  3024,  2916,  2713,  3309,  3237,  2857,  3473}
-  },
-  {
-    { 7733,  7880,  8188,  8175,  8247,  8490,  8637,  8601,  8359,  7569},
-    { 4210,  3031,  2552,  3473,  3876,  3853,  4184,  4154,  3909,  3968},
-    { 3214,  1930,  1313,  2143,  2493,  2385,  2755,  2706,  2542,  2919},
-    { 3024,  1592,   940,  1631,  1723,  1579,  2034,  2084,  1913,  2601}
-  }
-};
-
-static const int16_t cb_ma_predictor_sum[2][10] = { /* (0.15) */
-  { 7798,  8447,  8205,  8293,  8126,  8477,  8447,  8703,  9043,  8604},
-  {14585, 18333, 19772, 17344, 16426, 16459, 15155, 15220, 16043, 15708}
-};
-
-/**
- * initial LSP coefficients belongs to virtual frame preceding  the
- * first frame of the stream
- */
-static const int16_t lsp_init[10]= { /* (0.15) */
-   30000, 26000, 21000, 15000, 8000, 0, -8000,-15000,-21000,-26000
-};
-#endif /* AVCODEC_G729DATA_H */
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
deleted file mode 100644
index 3a6fb0f..0000000
--- a/libavcodec/g729dec.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * G.729 decoder
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <stdlib.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-
-#include "avcodec.h"
-#include "libavutil/avutil.h"
-#include "get_bits.h"
-
-#include "g729.h"
-#include "lsp.h"
-#include "celp_math.h"
-#include "acelp_filters.h"
-#include "acelp_pitch_delay.h"
-#include "acelp_vectors.h"
-#include "g729data.h"
-
-/**
- * minimum quantized LSF value (3.2.4)
- * 0.005 in Q13
- */
-#define LSFQ_MIN                   40
-
-/**
- * maximum quantized LSF value (3.2.4)
- * 3.135 in Q13
- */
-#define LSFQ_MAX                   25681
-
-/**
- * minimum LSF distance (3.2.4)
- * 0.0391 in Q13
- */
-#define LSFQ_DIFF_MIN              321
-
-/**
- * minimum gain pitch value (3.8, Equation 47)
- * 0.2 in (1.14)
- */
-#define SHARP_MIN                  3277
-
-/**
- * maximum gain pitch value (3.8, Equation 47)
- * (EE) This does not comply with the specification.
- * Specification says about 0.8, which should be
- * 13107 in (1.14), but reference C code uses
- * 13017 (equals to 0.7945) instead of it.
- */
-#define SHARP_MAX                  13017
-
-typedef struct {
-    uint8_t ac_index_bits[2];   ///< adaptive codebook index for second subframe (size in bits)
-    uint8_t parity_bit;         ///< parity bit for pitch delay
-    uint8_t gc_1st_index_bits;  ///< gain codebook (first stage) index (size in bits)
-    uint8_t gc_2nd_index_bits;  ///< gain codebook (second stage) index (size in bits)
-    uint8_t fc_signs_bits;      ///< number of pulses in fixed-codebook vector
-    uint8_t fc_indexes_bits;    ///< size (in bits) of fixed-codebook index entry
-} G729FormatDescription;
-
-typedef struct {
-    int pitch_delay_int_prev;   ///< integer part of previous subframe's pitch delay (4.1.3)
-
-    /// (2.13) LSP quantizer outputs
-    int16_t  past_quantizer_output_buf[MA_NP + 1][10];
-    int16_t* past_quantizer_outputs[MA_NP + 1];
-
-    int16_t lsfq[10];           ///< (2.13) quantized LSF coefficients from previous frame
-    int16_t lsp_buf[2][10];     ///< (0.15) LSP coefficients (previous and current frames) (3.2.5)
-    int16_t *lsp[2];            ///< pointers to lsp_buf
-}  G729Context;
-
-static const G729FormatDescription format_g729_8k = {
-    .ac_index_bits     = {8,5},
-    .parity_bit        = 1,
-    .gc_1st_index_bits = GC_1ST_IDX_BITS_8K,
-    .gc_2nd_index_bits = GC_2ND_IDX_BITS_8K,
-    .fc_signs_bits     = 4,
-    .fc_indexes_bits   = 13,
-};
-
-static const G729FormatDescription format_g729d_6k4 = {
-    .ac_index_bits     = {8,4},
-    .parity_bit        = 0,
-    .gc_1st_index_bits = GC_1ST_IDX_BITS_6K4,
-    .gc_2nd_index_bits = GC_2ND_IDX_BITS_6K4,
-    .fc_signs_bits     = 2,
-    .fc_indexes_bits   = 9,
-};
-
-/**
- * \brief pseudo random number generator
- */
-static inline uint16_t g729_prng(uint16_t value)
-{
-    return 31821 * value + 13849;
-}
-
-/**
- * Get parity bit of bit 2..7
- */
-static inline int get_parity(uint8_t value)
-{
-   return (0x6996966996696996ULL >> (value >> 2)) & 1;
-}
-
-static void lsf_decode(int16_t* lsfq, int16_t* past_quantizer_outputs[MA_NP + 1],
-                       int16_t ma_predictor,
-                       int16_t vq_1st, int16_t vq_2nd_low, int16_t vq_2nd_high)
-{
-    int i,j;
-    static const uint8_t min_distance[2]={10, 5}; //(2.13)
-    int16_t* quantizer_output = past_quantizer_outputs[MA_NP];
-
-    for (i = 0; i < 5; i++) {
-        quantizer_output[i]     = cb_lsp_1st[vq_1st][i    ] + cb_lsp_2nd[vq_2nd_low ][i    ];
-        quantizer_output[i + 5] = cb_lsp_1st[vq_1st][i + 5] + cb_lsp_2nd[vq_2nd_high][i + 5];
-    }
-
-    for (j = 0; j < 2; j++) {
-        for (i = 1; i < 10; i++) {
-            int diff = (quantizer_output[i - 1] - quantizer_output[i] + min_distance[j]) >> 1;
-            if (diff > 0) {
-                quantizer_output[i - 1] -= diff;
-                quantizer_output[i    ] += diff;
-            }
-        }
-    }
-
-    for (i = 0; i < 10; i++) {
-        int sum = quantizer_output[i] * cb_ma_predictor_sum[ma_predictor][i];
-        for (j = 0; j < MA_NP; j++)
-            sum += past_quantizer_outputs[j][i] * cb_ma_predictor[ma_predictor][j][i];
-
-        lsfq[i] = sum >> 15;
-    }
-
-    /* Rotate past_quantizer_outputs. */
-    memmove(past_quantizer_outputs + 1, past_quantizer_outputs, MA_NP * sizeof(int16_t*));
-    past_quantizer_outputs[0] = quantizer_output;
-
-    ff_acelp_reorder_lsf(lsfq, LSFQ_DIFF_MIN, LSFQ_MIN, LSFQ_MAX, 10);
-}
-
-static av_cold int decoder_init(AVCodecContext * avctx)
-{
-    G729Context* ctx = avctx->priv_data;
-    int i,k;
-
-    if (avctx->channels != 1) {
-        av_log(avctx, AV_LOG_ERROR, "Only mono sound is supported (requested channels: %d).\n", avctx->channels);
-        return AVERROR(EINVAL);
-    }
-
-    /* Both 8kbit/s and 6.4kbit/s modes uses two subframes per frame. */
-    avctx->frame_size = SUBFRAME_SIZE << 1;
-
-    for (k = 0; k < MA_NP + 1; k++) {
-        ctx->past_quantizer_outputs[k] = ctx->past_quantizer_output_buf[k];
-        for (i = 1; i < 11; i++)
-            ctx->past_quantizer_outputs[k][i - 1] = (18717 * i) >> 3;
-    }
-
-    ctx->lsp[0] = ctx->lsp_buf[0];
-    ctx->lsp[1] = ctx->lsp_buf[1];
-    memcpy(ctx->lsp[0], lsp_init, 10 * sizeof(int16_t));
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    int16_t *out_frame = data;
-    GetBitContext gb;
-    G729FormatDescription format;
-    int frame_erasure = 0;    ///< frame erasure detected during decoding
-    int bad_pitch = 0;        ///< parity check failed
-    int i;
-    G729Context *ctx = avctx->priv_data;
-    int16_t lp[2][11];           // (3.12)
-    uint8_t ma_predictor;     ///< switched MA predictor of LSP quantizer
-    uint8_t quantizer_1st;    ///< first stage vector of quantizer
-    uint8_t quantizer_2nd_lo; ///< second stage lower vector of quantizer (size in bits)
-    uint8_t quantizer_2nd_hi; ///< second stage higher vector of quantizer (size in bits)
-
-    int pitch_delay_int;         // pitch delay, integer part
-    int pitch_delay_3x;          // pitch delay, multiplied by 3
-
-    if (*data_size < SUBFRAME_SIZE << 2) {
-        av_log(avctx, AV_LOG_ERROR, "Error processing packet: output buffer too small\n");
-        return AVERROR(EIO);
-    }
-
-    if (buf_size == 10) {
-        format = format_g729_8k;
-        av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729 @ 8kbit/s");
-    } else if (buf_size == 8) {
-        format = format_g729d_6k4;
-        av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729D @ 6.4kbit/s");
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "Packet size %d is unknown.\n", buf_size);
-        return AVERROR_INVALIDDATA;
-    }
-
-    for (i=0; i < buf_size; i++)
-        frame_erasure |= buf[i];
-    frame_erasure = !frame_erasure;
-
-    init_get_bits(&gb, buf, buf_size);
-
-    ma_predictor     = get_bits(&gb, 1);
-    quantizer_1st    = get_bits(&gb, VQ_1ST_BITS);
-    quantizer_2nd_lo = get_bits(&gb, VQ_2ND_BITS);
-    quantizer_2nd_hi = get_bits(&gb, VQ_2ND_BITS);
-
-    lsf_decode(ctx->lsfq, ctx->past_quantizer_outputs,
-               ma_predictor,
-               quantizer_1st, quantizer_2nd_lo, quantizer_2nd_hi);
-
-    ff_acelp_lsf2lsp(ctx->lsp[1], ctx->lsfq, 10);
-
-    ff_acelp_lp_decode(&lp[0][0], &lp[1][0], ctx->lsp[1], ctx->lsp[0], 10);
-
-    FFSWAP(int16_t*, ctx->lsp[1], ctx->lsp[0]);
-
-    for (i = 0; i < 2; i++) {
-        uint8_t ac_index;      ///< adaptive codebook index
-        uint8_t pulses_signs;  ///< fixed-codebook vector pulse signs
-        int fc_indexes;        ///< fixed-codebook indexes
-        uint8_t gc_1st_index;  ///< gain codebook (first stage) index
-        uint8_t gc_2nd_index;  ///< gain codebook (second stage) index
-
-        ac_index      = get_bits(&gb, format.ac_index_bits[i]);
-        if(!i && format.parity_bit)
-            bad_pitch = get_parity(ac_index) == get_bits1(&gb);
-        fc_indexes    = get_bits(&gb, format.fc_indexes_bits);
-        pulses_signs  = get_bits(&gb, format.fc_signs_bits);
-        gc_1st_index  = get_bits(&gb, format.gc_1st_index_bits);
-        gc_2nd_index  = get_bits(&gb, format.gc_2nd_index_bits);
-
-        if(!i) {
-            if (bad_pitch)
-                pitch_delay_3x   = 3 * ctx->pitch_delay_int_prev;
-            else
-                pitch_delay_3x = ff_acelp_decode_8bit_to_1st_delay3(ac_index);
-        } else {
-            int pitch_delay_min = av_clip(ctx->pitch_delay_int_prev - 5,
-                                          PITCH_DELAY_MIN, PITCH_DELAY_MAX - 9);
-
-            if(packet_type == FORMAT_G729D_6K4)
-                pitch_delay_3x = ff_acelp_decode_4bit_to_2nd_delay3(ac_index, pitch_delay_min);
-            else
-                pitch_delay_3x = ff_acelp_decode_5_6_bit_to_2nd_delay3(ac_index, pitch_delay_min);
-        }
-
-        /* Round pitch delay to nearest (used everywhere except ff_acelp_interpolate). */
-        pitch_delay_int  = (pitch_delay_3x + 1) / 3;
-
-        ff_acelp_weighted_vector_sum(fc + pitch_delay_int,
-                                     fc + pitch_delay_int,
-                                     fc, 1 << 14,
-                                     av_clip(ctx->gain_pitch, SHARP_MIN, SHARP_MAX),
-                                     0, 14,
-                                     SUBFRAME_SIZE - pitch_delay_int);
-
-        if (frame_erasure) {
-            ctx->gain_pitch = (29491 * ctx->gain_pitch) >> 15; // 0.90 (0.15)
-            ctx->gain_code  = ( 2007 * ctx->gain_code ) >> 11; // 0.98 (0.11)
-
-            gain_corr_factor = 0;
-        } else {
-            ctx->gain_pitch  = cb_gain_1st_8k[gc_1st_index][0] +
-                               cb_gain_2nd_8k[gc_2nd_index][0];
-            gain_corr_factor = cb_gain_1st_8k[gc_1st_index][1] +
-                               cb_gain_2nd_8k[gc_2nd_index][1];
-
-        ff_acelp_weighted_vector_sum(ctx->exc + i * SUBFRAME_SIZE,
-                                     ctx->exc + i * SUBFRAME_SIZE, fc,
-                                     (!voicing && frame_erasure) ? 0 : ctx->gain_pitch,
-                                     ( voicing && frame_erasure) ? 0 : ctx->gain_code,
-                                     1 << 13, 14, SUBFRAME_SIZE);
-
-            ctx->pitch_delay_int_prev = pitch_delay_int;
-    }
-
-    *data_size = SUBFRAME_SIZE << 2;
-    return buf_size;
-}
-
-AVCodec g729_decoder =
-{
-    "g729",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_G729,
-    sizeof(G729Context),
-    decoder_init,
-    NULL,
-    NULL,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("G.729"),
-};
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
deleted file mode 100644
index 556f542..0000000
--- a/libavcodec/get_bits.h
+++ /dev/null
@@ -1,691 +0,0 @@
-/*
- * copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * bitstream reader API header.
- */
-
-#ifndef AVCODEC_GET_BITS_H
-#define AVCODEC_GET_BITS_H
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "libavutil/bswap.h"
-#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/log.h"
-#include "mathops.h"
-
-#if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER)
-#   define ALT_BITSTREAM_READER
-#endif
-
-#if !defined(LIBMPEG2_BITSTREAM_READER) && !defined(A32_BITSTREAM_READER) && !defined(ALT_BITSTREAM_READER)
-#   if ARCH_ARM && !HAVE_FAST_UNALIGNED
-#       define A32_BITSTREAM_READER
-#   else
-#       define ALT_BITSTREAM_READER
-//#define LIBMPEG2_BITSTREAM_READER
-//#define A32_BITSTREAM_READER
-#   endif
-#endif
-
-/* bit input */
-/* buffer, buffer_end and size_in_bits must be present and used by every reader */
-typedef struct GetBitContext {
-    const uint8_t *buffer, *buffer_end;
-#ifdef ALT_BITSTREAM_READER
-    int index;
-#elif defined LIBMPEG2_BITSTREAM_READER
-    uint8_t *buffer_ptr;
-    uint32_t cache;
-    int bit_count;
-#elif defined A32_BITSTREAM_READER
-    uint32_t *buffer_ptr;
-    uint32_t cache0;
-    uint32_t cache1;
-    int bit_count;
-#endif
-    int size_in_bits;
-} GetBitContext;
-
-#define VLC_TYPE int16_t
-
-typedef struct VLC {
-    int bits;
-    VLC_TYPE (*table)[2]; ///< code, bits
-    int table_size, table_allocated;
-} VLC;
-
-typedef struct RL_VLC_ELEM {
-    int16_t level;
-    int8_t len;
-    uint8_t run;
-} RL_VLC_ELEM;
-
-/* Bitstream reader API docs:
-name
-    arbitrary name which is used as prefix for the internal variables
-
-gb
-    getbitcontext
-
-OPEN_READER(name, gb)
-    loads gb into local variables
-
-CLOSE_READER(name, gb)
-    stores local vars in gb
-
-UPDATE_CACHE(name, gb)
-    refills the internal cache from the bitstream
-    after this call at least MIN_CACHE_BITS will be available,
-
-GET_CACHE(name, gb)
-    will output the contents of the internal cache, next bit is MSB of 32 or 64 bit (FIXME 64bit)
-
-SHOW_UBITS(name, gb, num)
-    will return the next num bits
-
-SHOW_SBITS(name, gb, num)
-    will return the next num bits and do sign extension
-
-SKIP_BITS(name, gb, num)
-    will skip over the next num bits
-    note, this is equivalent to SKIP_CACHE; SKIP_COUNTER
-
-SKIP_CACHE(name, gb, num)
-    will remove the next num bits from the cache (note SKIP_COUNTER MUST be called before UPDATE_CACHE / CLOSE_READER)
-
-SKIP_COUNTER(name, gb, num)
-    will increment the internal bit counter (see SKIP_CACHE & SKIP_BITS)
-
-LAST_SKIP_CACHE(name, gb, num)
-    will remove the next num bits from the cache if it is needed for UPDATE_CACHE otherwise it will do nothing
-
-LAST_SKIP_BITS(name, gb, num)
-    is equivalent to LAST_SKIP_CACHE; SKIP_COUNTER
-
-for examples see get_bits, show_bits, skip_bits, get_vlc
-*/
-
-#ifdef ALT_BITSTREAM_READER
-#   define MIN_CACHE_BITS 25
-
-#   define OPEN_READER(name, gb)\
-        unsigned int name##_index= (gb)->index;\
-        int name##_cache= 0;\
-
-#   define CLOSE_READER(name, gb)\
-        (gb)->index= name##_index;\
-
-# ifdef ALT_BITSTREAM_READER_LE
-#   define UPDATE_CACHE(name, gb)\
-        name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\
-
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache >>= (num);
-# else
-#   define UPDATE_CACHE(name, gb)\
-        name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\
-
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache <<= (num);
-# endif
-
-// FIXME name?
-#   define SKIP_COUNTER(name, gb, num)\
-        name##_index += (num);\
-
-#   define SKIP_BITS(name, gb, num)\
-        {\
-            SKIP_CACHE(name, gb, num)\
-            SKIP_COUNTER(name, gb, num)\
-        }\
-
-#   define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
-#   define LAST_SKIP_CACHE(name, gb, num) ;
-
-# ifdef ALT_BITSTREAM_READER_LE
-#   define SHOW_UBITS(name, gb, num)\
-        zero_extend(name##_cache, num)
-
-#   define SHOW_SBITS(name, gb, num)\
-        sign_extend(name##_cache, num)
-# else
-#   define SHOW_UBITS(name, gb, num)\
-        NEG_USR32(name##_cache, num)
-
-#   define SHOW_SBITS(name, gb, num)\
-        NEG_SSR32(name##_cache, num)
-# endif
-
-#   define GET_CACHE(name, gb)\
-        ((uint32_t)name##_cache)
-
-static inline int get_bits_count(const GetBitContext *s){
-    return s->index;
-}
-
-static inline void skip_bits_long(GetBitContext *s, int n){
-    s->index += n;
-}
-
-#elif defined LIBMPEG2_BITSTREAM_READER
-//libmpeg2 like reader
-
-#   define MIN_CACHE_BITS 17
-
-#   define OPEN_READER(name, gb)\
-        int name##_bit_count=(gb)->bit_count;\
-        int name##_cache= (gb)->cache;\
-        uint8_t * name##_buffer_ptr=(gb)->buffer_ptr;\
-
-#   define CLOSE_READER(name, gb)\
-        (gb)->bit_count= name##_bit_count;\
-        (gb)->cache= name##_cache;\
-        (gb)->buffer_ptr= name##_buffer_ptr;\
-
-#   define UPDATE_CACHE(name, gb)\
-    if(name##_bit_count >= 0){\
-        name##_cache+= AV_RB16(name##_buffer_ptr) << name##_bit_count; \
-        name##_buffer_ptr+=2;\
-        name##_bit_count-= 16;\
-    }\
-
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache <<= (num);\
-
-#   define SKIP_COUNTER(name, gb, num)\
-        name##_bit_count += (num);\
-
-#   define SKIP_BITS(name, gb, num)\
-        {\
-            SKIP_CACHE(name, gb, num)\
-            SKIP_COUNTER(name, gb, num)\
-        }\
-
-#   define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
-#   define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
-
-#   define SHOW_UBITS(name, gb, num)\
-        NEG_USR32(name##_cache, num)
-
-#   define SHOW_SBITS(name, gb, num)\
-        NEG_SSR32(name##_cache, num)
-
-#   define GET_CACHE(name, gb)\
-        ((uint32_t)name##_cache)
-
-static inline int get_bits_count(const GetBitContext *s){
-    return (s->buffer_ptr - s->buffer)*8 - 16 + s->bit_count;
-}
-
-static inline void skip_bits_long(GetBitContext *s, int n){
-    OPEN_READER(re, s)
-    re_bit_count += n;
-    re_buffer_ptr += 2*(re_bit_count>>4);
-    re_bit_count &= 15;
-    re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count);
-    UPDATE_CACHE(re, s)
-    CLOSE_READER(re, s)
-}
-
-#elif defined A32_BITSTREAM_READER
-
-#   define MIN_CACHE_BITS 32
-
-#   define OPEN_READER(name, gb)\
-        int name##_bit_count=(gb)->bit_count;\
-        uint32_t name##_cache0= (gb)->cache0;\
-        uint32_t name##_cache1= (gb)->cache1;\
-        uint32_t * name##_buffer_ptr=(gb)->buffer_ptr;\
-
-#   define CLOSE_READER(name, gb)\
-        (gb)->bit_count= name##_bit_count;\
-        (gb)->cache0= name##_cache0;\
-        (gb)->cache1= name##_cache1;\
-        (gb)->buffer_ptr= name##_buffer_ptr;\
-
-#   define UPDATE_CACHE(name, gb)\
-    if(name##_bit_count > 0){\
-        const uint32_t next= be2me_32( *name##_buffer_ptr );\
-        name##_cache0 |= NEG_USR32(next,name##_bit_count);\
-        name##_cache1 |= next<<name##_bit_count;\
-        name##_buffer_ptr++;\
-        name##_bit_count-= 32;\
-    }\
-
-#if ARCH_X86
-#   define SKIP_CACHE(name, gb, num)\
-        __asm__(\
-            "shldl %2, %1, %0          \n\t"\
-            "shll %2, %1               \n\t"\
-            : "+r" (name##_cache0), "+r" (name##_cache1)\
-            : "Ic" ((uint8_t)(num))\
-           );
-#else
-#   define SKIP_CACHE(name, gb, num)\
-        name##_cache0 <<= (num);\
-        name##_cache0 |= NEG_USR32(name##_cache1,num);\
-        name##_cache1 <<= (num);
-#endif
-
-#   define SKIP_COUNTER(name, gb, num)\
-        name##_bit_count += (num);\
-
-#   define SKIP_BITS(name, gb, num)\
-        {\
-            SKIP_CACHE(name, gb, num)\
-            SKIP_COUNTER(name, gb, num)\
-        }\
-
-#   define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
-#   define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
-
-#   define SHOW_UBITS(name, gb, num)\
-        NEG_USR32(name##_cache0, num)
-
-#   define SHOW_SBITS(name, gb, num)\
-        NEG_SSR32(name##_cache0, num)
-
-#   define GET_CACHE(name, gb)\
-        (name##_cache0)
-
-static inline int get_bits_count(const GetBitContext *s){
-    return ((uint8_t*)s->buffer_ptr - s->buffer)*8 - 32 + s->bit_count;
-}
-
-static inline void skip_bits_long(GetBitContext *s, int n){
-    OPEN_READER(re, s)
-    re_bit_count += n;
-    re_buffer_ptr += re_bit_count>>5;
-    re_bit_count &= 31;
-    re_cache0 = be2me_32( re_buffer_ptr[-1] ) << re_bit_count;
-    re_cache1 = 0;
-    UPDATE_CACHE(re, s)
-    CLOSE_READER(re, s)
-}
-
-#endif
-
-/**
- * read mpeg1 dc style vlc (sign bit + mantisse with no MSB).
- * if MSB not set it is negative
- * @param n length in bits
- * @author BERO
- */
-static inline int get_xbits(GetBitContext *s, int n){
-    register int sign;
-    register int32_t cache;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    cache = GET_CACHE(re,s);
-    sign=(~cache)>>31;
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
-    return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
-}
-
-static inline int get_sbits(GetBitContext *s, int n){
-    register int tmp;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    tmp= SHOW_SBITS(re, s, n);
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
-    return tmp;
-}
-
-/**
- * reads 1-17 bits.
- * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
- */
-static inline unsigned int get_bits(GetBitContext *s, int n){
-    register int tmp;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    tmp= SHOW_UBITS(re, s, n);
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
-    return tmp;
-}
-
-/**
- * shows 1-17 bits.
- * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
- */
-static inline unsigned int show_bits(GetBitContext *s, int n){
-    register int tmp;
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    tmp= SHOW_UBITS(re, s, n);
-//    CLOSE_READER(re, s)
-    return tmp;
-}
-
-static inline void skip_bits(GetBitContext *s, int n){
- //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-    LAST_SKIP_BITS(re, s, n)
-    CLOSE_READER(re, s)
-}
-
-static inline unsigned int get_bits1(GetBitContext *s){
-#ifdef ALT_BITSTREAM_READER
-    unsigned int index= s->index;
-    uint8_t result= s->buffer[ index>>3 ];
-#ifdef ALT_BITSTREAM_READER_LE
-    result>>= (index&0x07);
-    result&= 1;
-#else
-    result<<= (index&0x07);
-    result>>= 8 - 1;
-#endif
-    index++;
-    s->index= index;
-
-    return result;
-#else
-    return get_bits(s, 1);
-#endif
-}
-
-static inline unsigned int show_bits1(GetBitContext *s){
-    return show_bits(s, 1);
-}
-
-static inline void skip_bits1(GetBitContext *s){
-    skip_bits(s, 1);
-}
-
-/**
- * reads 0-32 bits.
- */
-static inline unsigned int get_bits_long(GetBitContext *s, int n){
-    if(n<=MIN_CACHE_BITS) return get_bits(s, n);
-    else{
-#ifdef ALT_BITSTREAM_READER_LE
-        int ret= get_bits(s, 16);
-        return ret | (get_bits(s, n-16) << 16);
-#else
-        int ret= get_bits(s, 16) << (n-16);
-        return ret | get_bits(s, n-16);
-#endif
-    }
-}
-
-/**
- * reads 0-32 bits as a signed integer.
- */
-static inline int get_sbits_long(GetBitContext *s, int n) {
-    return sign_extend(get_bits_long(s, n), n);
-}
-
-/**
- * shows 0-32 bits.
- */
-static inline unsigned int show_bits_long(GetBitContext *s, int n){
-    if(n<=MIN_CACHE_BITS) return show_bits(s, n);
-    else{
-        GetBitContext gb= *s;
-        return get_bits_long(&gb, n);
-    }
-}
-
-static inline int check_marker(GetBitContext *s, const char *msg)
-{
-    int bit= get_bits1(s);
-    if(!bit)
-        av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
-
-    return bit;
-}
-
-/**
- * init GetBitContext.
- * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits
- * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end
- * @param bit_size the size of the buffer in bits
- *
- * While GetBitContext stores the buffer size, for performance reasons you are
- * responsible for checking for the buffer end yourself (take advantage of the padding)!
- */
-static inline void init_get_bits(GetBitContext *s,
-                   const uint8_t *buffer, int bit_size)
-{
-    int buffer_size= (bit_size+7)>>3;
-    if(buffer_size < 0 || bit_size < 0) {
-        buffer_size = bit_size = 0;
-        buffer = NULL;
-    }
-
-    s->buffer= buffer;
-    s->size_in_bits= bit_size;
-    s->buffer_end= buffer + buffer_size;
-#ifdef ALT_BITSTREAM_READER
-    s->index=0;
-#elif defined LIBMPEG2_BITSTREAM_READER
-    s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
-    s->bit_count = 16 + 8*((intptr_t)buffer&1);
-    skip_bits_long(s, 0);
-#elif defined A32_BITSTREAM_READER
-    s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));
-    s->bit_count = 32 + 8*((intptr_t)buffer&3);
-    skip_bits_long(s, 0);
-#endif
-}
-
-static inline void align_get_bits(GetBitContext *s)
-{
-    int n= (-get_bits_count(s)) & 7;
-    if(n) skip_bits(s, n);
-}
-
-#define init_vlc(vlc, nb_bits, nb_codes,\
-                 bits, bits_wrap, bits_size,\
-                 codes, codes_wrap, codes_size,\
-                 flags)\
-        init_vlc_sparse(vlc, nb_bits, nb_codes,\
-                 bits, bits_wrap, bits_size,\
-                 codes, codes_wrap, codes_size,\
-                 NULL, 0, 0, flags)
-
-int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
-             const void *bits, int bits_wrap, int bits_size,
-             const void *codes, int codes_wrap, int codes_size,
-             const void *symbols, int symbols_wrap, int symbols_size,
-             int flags);
-#define INIT_VLC_LE         2
-#define INIT_VLC_USE_NEW_STATIC 4
-void free_vlc(VLC *vlc);
-
-#define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size)\
-{\
-    static VLC_TYPE table[static_size][2];\
-    (vlc)->table= table;\
-    (vlc)->table_allocated= static_size;\
-    init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC);\
-}
-
-
-/**
- *
- * If the vlc code is invalid and max_depth=1, then no bits will be removed.
- * If the vlc code is invalid and max_depth>1, then the number of bits removed
- * is undefined.
- */
-#define GET_VLC(code, name, gb, table, bits, max_depth)\
-{\
-    int n, nb_bits;\
-    unsigned int index;\
-\
-    index= SHOW_UBITS(name, gb, bits);\
-    code = table[index][0];\
-    n    = table[index][1];\
-\
-    if(max_depth > 1 && n < 0){\
-        LAST_SKIP_BITS(name, gb, bits)\
-        UPDATE_CACHE(name, gb)\
-\
-        nb_bits = -n;\
-\
-        index= SHOW_UBITS(name, gb, nb_bits) + code;\
-        code = table[index][0];\
-        n    = table[index][1];\
-        if(max_depth > 2 && n < 0){\
-            LAST_SKIP_BITS(name, gb, nb_bits)\
-            UPDATE_CACHE(name, gb)\
-\
-            nb_bits = -n;\
-\
-            index= SHOW_UBITS(name, gb, nb_bits) + code;\
-            code = table[index][0];\
-            n    = table[index][1];\
-        }\
-    }\
-    SKIP_BITS(name, gb, n)\
-}
-
-#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\
-{\
-    int n, nb_bits;\
-    unsigned int index;\
-\
-    index= SHOW_UBITS(name, gb, bits);\
-    level = table[index].level;\
-    n     = table[index].len;\
-\
-    if(max_depth > 1 && n < 0){\
-        SKIP_BITS(name, gb, bits)\
-        if(need_update){\
-            UPDATE_CACHE(name, gb)\
-        }\
-\
-        nb_bits = -n;\
-\
-        index= SHOW_UBITS(name, gb, nb_bits) + level;\
-        level = table[index].level;\
-        n     = table[index].len;\
-    }\
-    run= table[index].run;\
-    SKIP_BITS(name, gb, n)\
-}
-
-
-/**
- * parses a vlc code, faster then get_vlc()
- * @param bits is the number of bits which will be read at once, must be
- *             identical to nb_bits in init_vlc()
- * @param max_depth is the number of times bits bits must be read to completely
- *                  read the longest vlc code
- *                  = (max_vlc_length + bits - 1) / bits
- */
-static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
-                                  int bits, int max_depth)
-{
-    int code;
-
-    OPEN_READER(re, s)
-    UPDATE_CACHE(re, s)
-
-    GET_VLC(code, re, s, table, bits, max_depth)
-
-    CLOSE_READER(re, s)
-    return code;
-}
-
-//#define TRACE
-
-#ifdef TRACE
-static inline void print_bin(int bits, int n){
-    int i;
-
-    for(i=n-1; i>=0; i--){
-        av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1);
-    }
-    for(i=n; i<24; i++)
-        av_log(NULL, AV_LOG_DEBUG, " ");
-}
-
-static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
-    int r= get_bits(s, n);
-
-    print_bin(r, n);
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line);
-    return r;
-}
-static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, const char *func, int line){
-    int show= show_bits(s, 24);
-    int pos= get_bits_count(s);
-    int r= get_vlc2(s, table, bits, max_depth);
-    int len= get_bits_count(s) - pos;
-    int bits2= show>>(24-len);
-
-    print_bin(bits2, len);
-
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line);
-    return r;
-}
-static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
-    int show= show_bits(s, n);
-    int r= get_xbits(s, n);
-
-    print_bin(show, n);
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line);
-    return r;
-}
-
-#define get_bits(s, n)  get_bits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_bits1(s)    get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_xbits(s, n) get_xbits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_vlc(s, vlc)            get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-
-#define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__)
-
-#else //TRACE
-#define tprintf(p, ...) {}
-#endif
-
-static inline int decode012(GetBitContext *gb){
-    int n;
-    n = get_bits1(gb);
-    if (n == 0)
-        return 0;
-    else
-        return get_bits1(gb) + 1;
-}
-
-static inline int decode210(GetBitContext *gb){
-    if (get_bits1(gb))
-        return 0;
-    else
-        return 2 - get_bits1(gb);
-}
-
-static inline int get_bits_left(GetBitContext *gb)
-{
-    return gb->size_in_bits - get_bits_count(gb);
-}
-
-#endif /* AVCODEC_GET_BITS_H */
diff --git a/libavcodec/gif.c b/libavcodec/gif.c
deleted file mode 100644
index 5114b89..0000000
--- a/libavcodec/gif.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * GIF encoder.
- * Copyright (c) 2000 Fabrice Bellard
- * Copyright (c) 2002 Francois Revol
- * Copyright (c) 2006 Baptiste Coudurier
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * First version by Francois Revol revol at free.fr
- *
- * Features and limitations:
- * - currently no compression is performed,
- *   in fact the size of the data is 9/8 the size of the image in 8bpp
- * - uses only a global standard palette
- * - tested with IE 5.0, Opera for BeOS, NetPositive (BeOS), and Mozilla (BeOS).
- *
- * Reference documents:
- * http://www.goice.co.jp/member/mo/formats/gif.html
- * http://astronomy.swin.edu.au/pbourke/dataformats/gif/
- * http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/GIF89a.txt
- *
- * this url claims to have an LZW algorithm not covered by Unisys patent:
- * http://www.msg.net/utility/whirlgif/gifencod.html
- * could help reduce the size of the files _a lot_...
- * some sites mentions an RLE type compression also.
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "lzw.h"
-
-/* The GIF format uses reversed order for bitstreams... */
-/* at least they don't use PDP_ENDIAN :) */
-#define BITSTREAM_WRITER_LE
-
-#include "put_bits.h"
-
-typedef struct {
-    AVFrame picture;
-    LZWState *lzw;
-    uint8_t *buf;
-} GIFContext;
-
-/* GIF header */
-static int gif_image_write_header(AVCodecContext *avctx,
-                                  uint8_t **bytestream, uint32_t *palette)
-{
-    int i;
-    unsigned int v;
-
-    bytestream_put_buffer(bytestream, "GIF", 3);
-    bytestream_put_buffer(bytestream, "89a", 3);
-    bytestream_put_le16(bytestream, avctx->width);
-    bytestream_put_le16(bytestream, avctx->height);
-
-    bytestream_put_byte(bytestream, 0xf7); /* flags: global clut, 256 entries */
-    bytestream_put_byte(bytestream, 0x1f); /* background color index */
-    bytestream_put_byte(bytestream, 0); /* aspect ratio */
-
-    /* the global palette */
-    for(i=0;i<256;i++) {
-        v = palette[i];
-        bytestream_put_be24(bytestream, v);
-    }
-
-    return 0;
-}
-
-static int gif_image_write_image(AVCodecContext *avctx,
-                                 uint8_t **bytestream, uint8_t *end,
-                                 const uint8_t *buf, int linesize)
-{
-    GIFContext *s = avctx->priv_data;
-    int len, height;
-    const uint8_t *ptr;
-    /* image block */
-
-    bytestream_put_byte(bytestream, 0x2c);
-    bytestream_put_le16(bytestream, 0);
-    bytestream_put_le16(bytestream, 0);
-    bytestream_put_le16(bytestream, avctx->width);
-    bytestream_put_le16(bytestream, avctx->height);
-    bytestream_put_byte(bytestream, 0x00); /* flags */
-    /* no local clut */
-
-    bytestream_put_byte(bytestream, 0x08);
-
-    ff_lzw_encode_init(s->lzw, s->buf, avctx->width*avctx->height,
-                       12, FF_LZW_GIF, put_bits);
-
-    ptr = buf;
-    for (height = avctx->height; height--;) {
-        len += ff_lzw_encode(s->lzw, ptr, avctx->width);
-        ptr += linesize;
-    }
-    len += ff_lzw_encode_flush(s->lzw, flush_put_bits);
-
-    ptr = s->buf;
-    while (len > 0) {
-        int size = FFMIN(255, len);
-        bytestream_put_byte(bytestream, size);
-        if (end - *bytestream < size)
-            return -1;
-        bytestream_put_buffer(bytestream, ptr, size);
-        ptr += size;
-        len -= size;
-    }
-    bytestream_put_byte(bytestream, 0x00); /* end of image block */
-    bytestream_put_byte(bytestream, 0x3b);
-    return 0;
-}
-
-static av_cold int gif_encode_init(AVCodecContext *avctx)
-{
-    GIFContext *s = avctx->priv_data;
-
-    avctx->coded_frame = &s->picture;
-    s->lzw = av_mallocz(ff_lzw_encode_state_size);
-    if (!s->lzw)
-        return AVERROR(ENOMEM);
-    s->buf = av_malloc(avctx->width*avctx->height*2);
-    if (!s->buf)
-         return AVERROR(ENOMEM);
-    return 0;
-}
-
-/* better than nothing gif encoder */
-static int gif_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int buf_size, void *data)
-{
-    GIFContext *s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame *const p = (AVFrame *)&s->picture;
-    uint8_t *outbuf_ptr = outbuf;
-    uint8_t *end = outbuf + buf_size;
-
-    *p = *pict;
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-    gif_image_write_header(avctx, &outbuf_ptr, (uint32_t *)pict->data[1]);
-    gif_image_write_image(avctx, &outbuf_ptr, end, pict->data[0], pict->linesize[0]);
-    return outbuf_ptr - outbuf;
-}
-
-static int gif_encode_close(AVCodecContext *avctx)
-{
-    GIFContext *s = avctx->priv_data;
-
-    av_freep(&s->lzw);
-    av_freep(&s->buf);
-    return 0;
-}
-
-AVCodec gif_encoder = {
-    "gif",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_GIF,
-    sizeof(GIFContext),
-    gif_encode_init,
-    gif_encode_frame,
-    gif_encode_close,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
-};
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
deleted file mode 100644
index 1daf1b7..0000000
--- a/libavcodec/gifdec.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * GIF decoder
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2006 Baptiste Coudurier
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define DEBUG
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "lzw.h"
-
-#define GCE_DISPOSAL_NONE       0
-#define GCE_DISPOSAL_INPLACE    1
-#define GCE_DISPOSAL_BACKGROUND 2
-#define GCE_DISPOSAL_RESTORE    3
-
-typedef struct GifState {
-    AVFrame picture;
-    int screen_width;
-    int screen_height;
-    int bits_per_pixel;
-    int background_color_index;
-    int transparent_color_index;
-    int color_resolution;
-    uint32_t *image_palette;
-
-    /* after the frame is displayed, the disposal method is used */
-    int gce_disposal;
-    /* delay during which the frame is shown */
-    int gce_delay;
-
-    /* LZW compatible decoder */
-    const uint8_t *bytestream;
-    const uint8_t *bytestream_end;
-    LZWState *lzw;
-
-    /* aux buffers */
-    uint8_t global_palette[256 * 3];
-    uint8_t local_palette[256 * 3];
-
-  AVCodecContext* avctx;
-} GifState;
-
-static const uint8_t gif87a_sig[6] = "GIF87a";
-static const uint8_t gif89a_sig[6] = "GIF89a";
-
-static int gif_read_image(GifState *s)
-{
-    int left, top, width, height, bits_per_pixel, code_size, flags;
-    int is_interleaved, has_local_palette, y, pass, y1, linesize, n, i;
-    uint8_t *ptr, *spal, *palette, *ptr1;
-
-    left = bytestream_get_le16(&s->bytestream);
-    top = bytestream_get_le16(&s->bytestream);
-    width = bytestream_get_le16(&s->bytestream);
-    height = bytestream_get_le16(&s->bytestream);
-    flags = bytestream_get_byte(&s->bytestream);
-    is_interleaved = flags & 0x40;
-    has_local_palette = flags & 0x80;
-    bits_per_pixel = (flags & 0x07) + 1;
-#ifdef DEBUG
-    dprintf(s->avctx, "gif: image x=%d y=%d w=%d h=%d\n", left, top, width, height);
-#endif
-
-    if (has_local_palette) {
-        bytestream_get_buffer(&s->bytestream, s->local_palette, 3 * (1 << bits_per_pixel));
-        palette = s->local_palette;
-    } else {
-        palette = s->global_palette;
-        bits_per_pixel = s->bits_per_pixel;
-    }
-
-    /* verify that all the image is inside the screen dimensions */
-    if (left + width > s->screen_width ||
-        top + height > s->screen_height)
-        return AVERROR(EINVAL);
-
-    /* build the palette */
-    n = (1 << bits_per_pixel);
-    spal = palette;
-    for(i = 0; i < n; i++) {
-        s->image_palette[i] = (0xff << 24) | AV_RB24(spal);
-        spal += 3;
-    }
-    for(; i < 256; i++)
-        s->image_palette[i] = (0xff << 24);
-    /* handle transparency */
-    if (s->transparent_color_index >= 0)
-        s->image_palette[s->transparent_color_index] = 0;
-
-    /* now get the image data */
-    code_size = bytestream_get_byte(&s->bytestream);
-    ff_lzw_decode_init(s->lzw, code_size, s->bytestream,
-                       s->bytestream_end - s->bytestream, FF_LZW_GIF);
-
-    /* read all the image */
-    linesize = s->picture.linesize[0];
-    ptr1 = s->picture.data[0] + top * linesize + left;
-    ptr = ptr1;
-    pass = 0;
-    y1 = 0;
-    for (y = 0; y < height; y++) {
-        ff_lzw_decode(s->lzw, ptr, width);
-        if (is_interleaved) {
-            switch(pass) {
-            default:
-            case 0:
-            case 1:
-                y1 += 8;
-                ptr += linesize * 8;
-                if (y1 >= height) {
-                    y1 = pass ? 2 : 4;
-                    ptr = ptr1 + linesize * y1;
-                    pass++;
-                }
-                break;
-            case 2:
-                y1 += 4;
-                ptr += linesize * 4;
-                if (y1 >= height) {
-                    y1 = 1;
-                    ptr = ptr1 + linesize;
-                    pass++;
-                }
-                break;
-            case 3:
-                y1 += 2;
-                ptr += linesize * 2;
-                break;
-            }
-        } else {
-            ptr += linesize;
-        }
-    }
-    /* read the garbage data until end marker is found */
-    ff_lzw_decode_tail(s->lzw);
-    s->bytestream = ff_lzw_cur_ptr(s->lzw);
-    return 0;
-}
-
-static int gif_read_extension(GifState *s)
-{
-    int ext_code, ext_len, i, gce_flags, gce_transparent_index;
-
-    /* extension */
-    ext_code = bytestream_get_byte(&s->bytestream);
-    ext_len = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
-    dprintf(s->avctx, "gif: ext_code=0x%x len=%d\n", ext_code, ext_len);
-#endif
-    switch(ext_code) {
-    case 0xf9:
-        if (ext_len != 4)
-            goto discard_ext;
-        s->transparent_color_index = -1;
-        gce_flags = bytestream_get_byte(&s->bytestream);
-        s->gce_delay = bytestream_get_le16(&s->bytestream);
-        gce_transparent_index = bytestream_get_byte(&s->bytestream);
-        if (gce_flags & 0x01)
-            s->transparent_color_index = gce_transparent_index;
-        else
-            s->transparent_color_index = -1;
-        s->gce_disposal = (gce_flags >> 2) & 0x7;
-#ifdef DEBUG
-        dprintf(s->avctx, "gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n",
-               gce_flags, s->gce_delay,
-               s->transparent_color_index, s->gce_disposal);
-#endif
-        ext_len = bytestream_get_byte(&s->bytestream);
-        break;
-    }
-
-    /* NOTE: many extension blocks can come after */
- discard_ext:
-    while (ext_len != 0) {
-        for (i = 0; i < ext_len; i++)
-            bytestream_get_byte(&s->bytestream);
-        ext_len = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
-        dprintf(s->avctx, "gif: ext_len1=%d\n", ext_len);
-#endif
-    }
-    return 0;
-}
-
-static int gif_read_header1(GifState *s)
-{
-    uint8_t sig[6];
-    int v, n;
-    int has_global_palette;
-
-    if (s->bytestream_end < s->bytestream + 13)
-        return -1;
-
-    /* read gif signature */
-    bytestream_get_buffer(&s->bytestream, sig, 6);
-    if (memcmp(sig, gif87a_sig, 6) != 0 &&
-        memcmp(sig, gif89a_sig, 6) != 0)
-        return -1;
-
-    /* read screen header */
-    s->transparent_color_index = -1;
-    s->screen_width = bytestream_get_le16(&s->bytestream);
-    s->screen_height = bytestream_get_le16(&s->bytestream);
-    if(   (unsigned)s->screen_width  > 32767
-       || (unsigned)s->screen_height > 32767){
-        av_log(NULL, AV_LOG_ERROR, "picture size too large\n");
-        return -1;
-    }
-
-    v = bytestream_get_byte(&s->bytestream);
-    s->color_resolution = ((v & 0x70) >> 4) + 1;
-    has_global_palette = (v & 0x80);
-    s->bits_per_pixel = (v & 0x07) + 1;
-    s->background_color_index = bytestream_get_byte(&s->bytestream);
-    bytestream_get_byte(&s->bytestream);                /* ignored */
-#ifdef DEBUG
-    dprintf(s->avctx, "gif: screen_w=%d screen_h=%d bpp=%d global_palette=%d\n",
-           s->screen_width, s->screen_height, s->bits_per_pixel,
-           has_global_palette);
-#endif
-    if (has_global_palette) {
-        n = 1 << s->bits_per_pixel;
-        if (s->bytestream_end < s->bytestream + n * 3)
-            return -1;
-        bytestream_get_buffer(&s->bytestream, s->global_palette, n * 3);
-    }
-    return 0;
-}
-
-static int gif_parse_next_image(GifState *s)
-{
-    while (s->bytestream < s->bytestream_end) {
-        int code = bytestream_get_byte(&s->bytestream);
-#ifdef DEBUG
-        dprintf(s->avctx, "gif: code=%02x '%c'\n", code, code);
-#endif
-        switch (code) {
-        case ',':
-            return gif_read_image(s);
-        case '!':
-            if (gif_read_extension(s) < 0)
-                return -1;
-            break;
-        case ';':
-            /* end of image */
-        default:
-            /* error or erroneous EOF */
-            return -1;
-        }
-    }
-    return -1;
-}
-
-static av_cold int gif_decode_init(AVCodecContext *avctx)
-{
-    GifState *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame= &s->picture;
-    s->picture.data[0] = NULL;
-    ff_lzw_decode_open(&s->lzw);
-    return 0;
-}
-
-static int gif_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    GifState *s = avctx->priv_data;
-    AVFrame *picture = data;
-    int ret;
-
-    s->bytestream = buf;
-    s->bytestream_end = buf + buf_size;
-    if (gif_read_header1(s) < 0)
-        return -1;
-
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    if (avcodec_check_dimensions(avctx, s->screen_width, s->screen_height))
-        return -1;
-    avcodec_set_dimensions(avctx, s->screen_width, s->screen_height);
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-    if (avctx->get_buffer(avctx, &s->picture) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    s->image_palette = (uint32_t *)s->picture.data[1];
-    ret = gif_parse_next_image(s);
-    if (ret < 0)
-        return ret;
-
-    *picture = s->picture;
-    *data_size = sizeof(AVPicture);
-    return s->bytestream - buf;
-}
-
-static av_cold int gif_decode_close(AVCodecContext *avctx)
-{
-    GifState *s = avctx->priv_data;
-
-    ff_lzw_decode_close(&s->lzw);
-    if(s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-    return 0;
-}
-
-AVCodec gif_decoder = {
-    "gif",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_GIF,
-    sizeof(GifState),
-    gif_decode_init,
-    NULL,
-    gif_decode_close,
-    gif_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
-};
diff --git a/libavcodec/golomb.c b/libavcodec/golomb.c
deleted file mode 100644
index 611598c..0000000
--- a/libavcodec/golomb.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * exp golomb vlc stuff
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief
- *     exp golomb vlc stuff
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "libavutil/common.h"
-
-const uint8_t ff_golomb_vlc_len[512]={
-14,13,12,12,11,11,11,11,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
-7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
-};
-
-const uint8_t ff_ue_golomb_vlc_code[512]={
-31,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
- 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-const int8_t ff_se_golomb_vlc_code[512]={
- 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,  8, -8,  9, -9, 10,-10, 11,-11, 12,-12, 13,-13, 14,-14, 15,-15,
-  4,  4,  4,  4, -4, -4, -4, -4,  5,  5,  5,  5, -5, -5, -5, -5,  6,  6,  6,  6, -6, -6, -6, -6,  7,  7,  7,  7, -7, -7, -7, -7,
-  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
-  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-};
-
-
-const uint8_t ff_ue_golomb_len[256]={
- 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,
-11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13,
-13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
-13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15,
-15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
-15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
-15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
-15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17,
-};
-
-const uint8_t ff_interleaved_golomb_vlc_len[256]={
-9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
-9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
-9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
-};
-
-const uint8_t ff_interleaved_ue_golomb_vlc_code[256]={
- 15,16,7, 7, 17,18,8, 8, 3, 3, 3, 3, 3, 3, 3, 3,
- 19,20,9, 9, 21,22,10,10,4, 4, 4, 4, 4, 4, 4, 4,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 23,24,11,11,25,26,12,12,5, 5, 5, 5, 5, 5, 5, 5,
- 27,28,13,13,29,30,14,14,6, 6, 6, 6, 6, 6, 6, 6,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-const int8_t ff_interleaved_se_golomb_vlc_code[256]={
-  8, -8,  4,  4,  9, -9, -4, -4,  2,  2,  2,  2,  2,  2,  2,  2,
- 10,-10,  5,  5, 11,-11, -5, -5, -2, -2, -2, -2, -2, -2, -2, -2,
-  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
- 12,-12,  6,  6, 13,-13, -6, -6,  3,  3,  3,  3,  3,  3,  3,  3,
- 14,-14,  7,  7, 15,-15, -7, -7, -3, -3, -3, -3, -3, -3, -3, -3,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-};
-
-const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]={
-0, 1, 0, 0, 2, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
-4, 5, 2, 2, 6, 7, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-8, 9, 4, 4, 10,11,5, 5, 2, 2, 2, 2, 2, 2, 2, 2,
-12,13,6, 6, 14,15,7, 7, 3, 3, 3, 3, 3, 3, 3, 3,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
deleted file mode 100644
index 90eeb30..0000000
--- a/libavcodec/golomb.h
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * exp golomb vlc stuff
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2004 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief
- *     exp golomb vlc stuff
- * @author Michael Niedermayer <michaelni at gmx.at> and Alex Beregszaszi
- */
-
-#ifndef AVCODEC_GOLOMB_H
-#define AVCODEC_GOLOMB_H
-
-#include <stdint.h>
-#include "get_bits.h"
-#include "put_bits.h"
-
-#define INVALID_VLC           0x80000000
-
-extern const uint8_t ff_golomb_vlc_len[512];
-extern const uint8_t ff_ue_golomb_vlc_code[512];
-extern const  int8_t ff_se_golomb_vlc_code[512];
-extern const uint8_t ff_ue_golomb_len[256];
-
-extern const uint8_t ff_interleaved_golomb_vlc_len[256];
-extern const uint8_t ff_interleaved_ue_golomb_vlc_code[256];
-extern const  int8_t ff_interleaved_se_golomb_vlc_code[256];
-extern const uint8_t ff_interleaved_dirac_golomb_vlc_code[256];
-
-
- /**
- * read unsigned exp golomb code.
- */
-static inline int get_ue_golomb(GetBitContext *gb){
-    unsigned int buf;
-    int log;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    if(buf >= (1<<27)){
-        buf >>= 32 - 9;
-        LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
-        CLOSE_READER(re, gb);
-
-        return ff_ue_golomb_vlc_code[buf];
-    }else{
-        log= 2*av_log2(buf) - 31;
-        buf>>= log;
-        buf--;
-        LAST_SKIP_BITS(re, gb, 32 - log);
-        CLOSE_READER(re, gb);
-
-        return buf;
-    }
-}
-
- /**
- * read unsigned exp golomb code, constraint to a max of 31.
- * the return value is undefined if the stored value exceeds 31.
- */
-static inline int get_ue_golomb_31(GetBitContext *gb){
-    unsigned int buf;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    buf >>= 32 - 9;
-    LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
-    CLOSE_READER(re, gb);
-
-    return ff_ue_golomb_vlc_code[buf];
-}
-
-static inline int svq3_get_ue_golomb(GetBitContext *gb){
-    uint32_t buf;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    if(buf&0xAA800000){
-        buf >>= 32 - 8;
-        LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
-        CLOSE_READER(re, gb);
-
-        return ff_interleaved_ue_golomb_vlc_code[buf];
-    }else{
-        int ret = 1;
-
-        while (1) {
-            buf >>= 32 - 8;
-            LAST_SKIP_BITS(re, gb, FFMIN(ff_interleaved_golomb_vlc_len[buf], 8));
-
-            if (ff_interleaved_golomb_vlc_len[buf] != 9){
-                ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1;
-                ret |= ff_interleaved_dirac_golomb_vlc_code[buf];
-                break;
-            }
-            ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf];
-            UPDATE_CACHE(re, gb);
-            buf = GET_CACHE(re, gb);
-        }
-
-        CLOSE_READER(re, gb);
-        return ret - 1;
-    }
-}
-
-/**
- * read unsigned truncated exp golomb code.
- */
-static inline int get_te0_golomb(GetBitContext *gb, int range){
-    assert(range >= 1);
-
-    if(range==1)      return 0;
-    else if(range==2) return get_bits1(gb)^1;
-    else              return get_ue_golomb(gb);
-}
-
-/**
- * read unsigned truncated exp golomb code.
- */
-static inline int get_te_golomb(GetBitContext *gb, int range){
-    assert(range >= 1);
-
-    if(range==2) return get_bits1(gb)^1;
-    else         return get_ue_golomb(gb);
-}
-
-
-/**
- * read signed exp golomb code.
- */
-static inline int get_se_golomb(GetBitContext *gb){
-    unsigned int buf;
-    int log;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    if(buf >= (1<<27)){
-        buf >>= 32 - 9;
-        LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]);
-        CLOSE_READER(re, gb);
-
-        return ff_se_golomb_vlc_code[buf];
-    }else{
-        log= 2*av_log2(buf) - 31;
-        buf>>= log;
-
-        LAST_SKIP_BITS(re, gb, 32 - log);
-        CLOSE_READER(re, gb);
-
-        if(buf&1) buf= -(buf>>1);
-        else      buf=  (buf>>1);
-
-        return buf;
-    }
-}
-
-static inline int svq3_get_se_golomb(GetBitContext *gb){
-    unsigned int buf;
-    int log;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    if(buf&0xAA800000){
-        buf >>= 32 - 8;
-        LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]);
-        CLOSE_READER(re, gb);
-
-        return ff_interleaved_se_golomb_vlc_code[buf];
-    }else{
-        LAST_SKIP_BITS(re, gb, 8);
-        UPDATE_CACHE(re, gb);
-        buf |= 1 | (GET_CACHE(re, gb) >> 8);
-
-        if((buf & 0xAAAAAAAA) == 0)
-            return INVALID_VLC;
-
-        for(log=31; (buf & 0x80000000) == 0; log--){
-            buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30);
-        }
-
-        LAST_SKIP_BITS(re, gb, 63 - 2*log - 8);
-        CLOSE_READER(re, gb);
-
-        return (signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1;
-    }
-}
-
-static inline int dirac_get_se_golomb(GetBitContext *gb){
-    uint32_t buf;
-    uint32_t ret;
-
-    ret = svq3_get_ue_golomb(gb);
-
-    if (ret) {
-        OPEN_READER(re, gb);
-        UPDATE_CACHE(re, gb);
-        buf = SHOW_SBITS(re, gb, 1);
-        LAST_SKIP_BITS(re, gb, 1);
-        ret = (ret ^ buf) - buf;
-        CLOSE_READER(re, gb);
-    }
-
-    return ret;
-}
-
-/**
- * read unsigned golomb rice code (ffv1).
- */
-static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len){
-    unsigned int buf;
-    int log;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    log= av_log2(buf);
-
-    if(log > 31-limit){
-        buf >>= log - k;
-        buf += (30-log)<<k;
-        LAST_SKIP_BITS(re, gb, 32 + k - log);
-        CLOSE_READER(re, gb);
-
-        return buf;
-    }else{
-        LAST_SKIP_BITS(re, gb, limit);
-        UPDATE_CACHE(re, gb);
-
-        buf = SHOW_UBITS(re, gb, esc_len);
-
-        LAST_SKIP_BITS(re, gb, esc_len);
-        CLOSE_READER(re, gb);
-
-        return buf + limit - 1;
-    }
-}
-
-/**
- * read unsigned golomb rice code (jpegls).
- */
-static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit, int esc_len){
-    unsigned int buf;
-    int log;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    log= av_log2(buf);
-
-    if(log - k >= 32-MIN_CACHE_BITS+(MIN_CACHE_BITS==32) && 32-log < limit){
-        buf >>= log - k;
-        buf += (30-log)<<k;
-        LAST_SKIP_BITS(re, gb, 32 + k - log);
-        CLOSE_READER(re, gb);
-
-        return buf;
-    }else{
-        int i;
-        for(i=0; SHOW_UBITS(re, gb, 1) == 0; i++){
-            LAST_SKIP_BITS(re, gb, 1);
-            UPDATE_CACHE(re, gb);
-        }
-        SKIP_BITS(re, gb, 1);
-
-        if(i < limit - 1){
-            if(k){
-                buf = SHOW_UBITS(re, gb, k);
-                LAST_SKIP_BITS(re, gb, k);
-            }else{
-                buf=0;
-            }
-
-            CLOSE_READER(re, gb);
-            return buf + (i<<k);
-        }else if(i == limit - 1){
-            buf = SHOW_UBITS(re, gb, esc_len);
-            LAST_SKIP_BITS(re, gb, esc_len);
-            CLOSE_READER(re, gb);
-
-            return buf + 1;
-        }else
-            return -1;
-    }
-}
-
-/**
- * read signed golomb rice code (ffv1).
- */
-static inline int get_sr_golomb(GetBitContext *gb, int k, int limit, int esc_len){
-    int v= get_ur_golomb(gb, k, limit, esc_len);
-
-    v++;
-    if (v&1) return v>>1;
-    else return -(v>>1);
-
-//    return (v>>1) ^ -(v&1);
-}
-
-/**
- * read signed golomb rice code (flac).
- */
-static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len){
-    int v= get_ur_golomb_jpegls(gb, k, limit, esc_len);
-    return (v>>1) ^ -(v&1);
-}
-
-/**
- * read unsigned golomb rice code (shorten).
- */
-static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k){
-        return get_ur_golomb_jpegls(gb, k, INT_MAX, 0);
-}
-
-/**
- * read signed golomb rice code (shorten).
- */
-static inline int get_sr_golomb_shorten(GetBitContext* gb, int k)
-{
-    int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0);
-    if (uvar & 1)
-        return ~(uvar >> 1);
-    else
-        return uvar >> 1;
-}
-
-
-
-#ifdef TRACE
-
-static inline int get_ue(GetBitContext *s, char *file, const char *func, int line){
-    int show= show_bits(s, 24);
-    int pos= get_bits_count(s);
-    int i= get_ue_golomb(s);
-    int len= get_bits_count(s) - pos;
-    int bits= show>>(24-len);
-
-    print_bin(bits, len);
-
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue  @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
-
-    return i;
-}
-
-static inline int get_se(GetBitContext *s, char *file, const char *func, int line){
-    int show= show_bits(s, 24);
-    int pos= get_bits_count(s);
-    int i= get_se_golomb(s);
-    int len= get_bits_count(s) - pos;
-    int bits= show>>(24-len);
-
-    print_bin(bits, len);
-
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se  @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
-
-    return i;
-}
-
-static inline int get_te(GetBitContext *s, int r, char *file, const char *func, int line){
-    int show= show_bits(s, 24);
-    int pos= get_bits_count(s);
-    int i= get_te0_golomb(s, r);
-    int len= get_bits_count(s) - pos;
-    int bits= show>>(24-len);
-
-    print_bin(bits, len);
-
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te  @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line);
-
-    return i;
-}
-
-#define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-
-#endif
-
-/**
- * write unsigned exp golomb code.
- */
-static inline void set_ue_golomb(PutBitContext *pb, int i){
-    int e;
-
-    assert(i>=0);
-
-#if 0
-    if(i=0){
-        put_bits(pb, 1, 1);
-        return;
-    }
-#endif
-    if(i<256)
-        put_bits(pb, ff_ue_golomb_len[i], i+1);
-    else{
-        e= av_log2(i+1);
-
-        put_bits(pb, 2*e+1, i+1);
-    }
-}
-
-/**
- * write truncated unsigned exp golomb code.
- */
-static inline void set_te_golomb(PutBitContext *pb, int i, int range){
-    assert(range >= 1);
-    assert(i<=range);
-
-    if(range==2) put_bits(pb, 1, i^1);
-    else         set_ue_golomb(pb, i);
-}
-
-/**
- * write signed exp golomb code. 16 bits at most.
- */
-static inline void set_se_golomb(PutBitContext *pb, int i){
-//    if (i>32767 || i<-32767)
-//        av_log(NULL,AV_LOG_ERROR,"value out of range %d\n", i);
-#if 0
-    if(i<=0) i= -2*i;
-    else     i=  2*i-1;
-#elif 1
-    i= 2*i-1;
-    if(i<0) i^= -1; //FIXME check if gcc does the right thing
-#else
-    i= 2*i-1;
-    i^= (i>>31);
-#endif
-    set_ue_golomb(pb, i);
-}
-
-/**
- * write unsigned golomb rice code (ffv1).
- */
-static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){
-    int e;
-
-    assert(i>=0);
-
-    e= i>>k;
-    if(e<limit){
-        put_bits(pb, e + k + 1, (1<<k) + (i&((1<<k)-1)));
-    }else{
-        put_bits(pb, limit + esc_len, i - limit + 1);
-    }
-}
-
-/**
- * write unsigned golomb rice code (jpegls).
- */
-static inline void set_ur_golomb_jpegls(PutBitContext *pb, int i, int k, int limit, int esc_len){
-    int e;
-
-    assert(i>=0);
-
-    e= (i>>k) + 1;
-    if(e<limit){
-        while(e > 31) {
-            put_bits(pb, 31, 0);
-            e -= 31;
-        }
-        put_bits(pb, e, 1);
-        if(k)
-            put_sbits(pb, k, i);
-    }else{
-        while(limit > 31) {
-            put_bits(pb, 31, 0);
-            limit -= 31;
-        }
-        put_bits(pb, limit  , 1);
-        put_bits(pb, esc_len, i - 1);
-    }
-}
-
-/**
- * write signed golomb rice code (ffv1).
- */
-static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){
-    int v;
-
-    v = -2*i-1;
-    v ^= (v>>31);
-
-    set_ur_golomb(pb, v, k, limit, esc_len);
-}
-
-/**
- * write signed golomb rice code (flac).
- */
-static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k, int limit, int esc_len){
-    int v;
-
-    v = -2*i-1;
-    v ^= (v>>31);
-
-    set_ur_golomb_jpegls(pb, v, k, limit, esc_len);
-}
-
-#endif /* AVCODEC_GOLOMB_H */
diff --git a/libavcodec/h261.c b/libavcodec/h261.c
deleted file mode 100644
index 562a151..0000000
--- a/libavcodec/h261.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * H261 common code
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2004 Maarten Daniels
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * h261codec.
- */
-
-#include "dsputil.h"
-#include "avcodec.h"
-#include "h261.h"
-
-#define IS_FIL(a)    ((a)&MB_TYPE_H261_FIL)
-
-uint8_t ff_h261_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3];
-
-void ff_h261_loop_filter(MpegEncContext *s){
-    H261Context * h= (H261Context*)s;
-    const int linesize  = s->linesize;
-    const int uvlinesize= s->uvlinesize;
-    uint8_t *dest_y = s->dest[0];
-    uint8_t *dest_cb= s->dest[1];
-    uint8_t *dest_cr= s->dest[2];
-
-    if(!(IS_FIL (h->mtype)))
-        return;
-
-    s->dsp.h261_loop_filter(dest_y                   , linesize);
-    s->dsp.h261_loop_filter(dest_y                + 8, linesize);
-    s->dsp.h261_loop_filter(dest_y + 8 * linesize    , linesize);
-    s->dsp.h261_loop_filter(dest_y + 8 * linesize + 8, linesize);
-    s->dsp.h261_loop_filter(dest_cb, uvlinesize);
-    s->dsp.h261_loop_filter(dest_cr, uvlinesize);
-}
-
diff --git a/libavcodec/h261.h b/libavcodec/h261.h
deleted file mode 100644
index 5b60dd6..0000000
--- a/libavcodec/h261.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * H261 decoder
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2004 Maarten Daniels
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * h261codec.
- */
-
-#ifndef AVCODEC_H261_H
-#define AVCODEC_H261_H
-
-#include "mpegvideo.h"
-
-/**
- * H261Context
- */
-typedef struct H261Context{
-    MpegEncContext s;
-
-    int current_mba;
-    int previous_mba;
-    int mba_diff;
-    int mtype;
-    int current_mv_x;
-    int current_mv_y;
-    int gob_number;
-    int gob_start_code_skipped; // 1 if gob start code is already read before gob header is read
-}H261Context;
-
-#define MB_TYPE_H261_FIL 0x800000
-
-#endif /* AVCODEC_H261_H */
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
deleted file mode 100644
index c32300d..0000000
--- a/libavcodec/h261_parser.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * H261 parser
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2004 Maarten Daniels
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * h261codec.
- */
-
-#include "parser.h"
-
-
-static int h261_find_frame_end(ParseContext *pc, AVCodecContext* avctx, const uint8_t *buf, int buf_size){
-    int vop_found, i, j;
-    uint32_t state;
-
-    vop_found= pc->frame_start_found;
-    state= pc->state;
-
-    for(i=0; i<buf_size && !vop_found; i++){
-        state= (state<<8) | buf[i];
-        for(j=0; j<8; j++){
-            if(((state>>j)&0xFFFFF0) == 0x000100){
-                vop_found=1;
-                break;
-            }
-        }
-    }
-    if(vop_found){
-        for(; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            for(j=0; j<8; j++){
-                if(((state>>j)&0xFFFFF0) == 0x000100){
-                    pc->frame_start_found=0;
-                    pc->state= (state>>(3*8))+0xFF00;
-                    return i-2;
-                }
-            }
-        }
-    }
-
-    pc->frame_start_found= vop_found;
-    pc->state= state;
-    return END_NOT_FOUND;
-}
-
-static int h261_parse(AVCodecParserContext *s,
-                      AVCodecContext *avctx,
-                      const uint8_t **poutbuf, int *poutbuf_size,
-                      const uint8_t *buf, int buf_size)
-{
-    ParseContext *pc = s->priv_data;
-    int next;
-
-    next= h261_find_frame_end(pc,avctx, buf, buf_size);
-    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-        *poutbuf = NULL;
-        *poutbuf_size = 0;
-        return buf_size;
-    }
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-AVCodecParser h261_parser = {
-    { CODEC_ID_H261 },
-    sizeof(ParseContext),
-    NULL,
-    h261_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/h261data.h b/libavcodec/h261data.h
deleted file mode 100644
index 82bae16..0000000
--- a/libavcodec/h261data.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * copyright (c) 2004 Maarten Daniels
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.261 tables.
- */
-
-#ifndef AVCODEC_H261DATA_H
-#define AVCODEC_H261DATA_H
-
-#include <stdint.h>
-#include "h261.h"
-
-// H.261 VLC table for macroblock addressing
-static const uint8_t h261_mba_code[35] = {
-     1,  3,  2,  3,
-     2,  3,  2,  7,
-     6, 11, 10,  9,
-     8,  7,  6, 23,
-    22, 21, 20, 19,
-    18, 35, 34, 33,
-    32, 31, 30, 29,
-    28, 27, 26, 25,
-    24,
-    15,           //(MBA stuffing)
-    1             //(start code)
-};
-
-static const uint8_t h261_mba_bits[35] = {
-     1,  3,  3,  4,
-     4,  5,  5,  7,
-     7,  8,  8,  8,
-     8,  8,  8, 10,
-    10, 10, 10, 10,
-    10, 11, 11, 11,
-    11, 11, 11, 11,
-    11, 11, 11, 11,
-    11,
-    11,           //(MBA stuffing)
-    16            //(start code)
-};
-
-//H.261 VLC table for macroblock type
-static const uint8_t h261_mtype_code[10] = {
-    1,  1,  1,  1,
-    1,  1,  1,  1,
-    1,  1
-};
-
-static const uint8_t h261_mtype_bits[10] = {
-    4,  7,  1,  5,
-    9,  8, 10,  3,
-    2,  6
-};
-
-static const int h261_mtype_map[10]= {
-        MB_TYPE_INTRA4x4,
-        MB_TYPE_INTRA4x4  |  MB_TYPE_QUANT,
-                                               MB_TYPE_CBP,
-                             MB_TYPE_QUANT  |  MB_TYPE_CBP,
-                                                               MB_TYPE_16x16,
-                                               MB_TYPE_CBP  |  MB_TYPE_16x16,
-                             MB_TYPE_QUANT  |  MB_TYPE_CBP  |  MB_TYPE_16x16,
-                                                               MB_TYPE_16x16  |  MB_TYPE_H261_FIL,
-                                               MB_TYPE_CBP  |  MB_TYPE_16x16  |  MB_TYPE_H261_FIL,
-                             MB_TYPE_QUANT  |  MB_TYPE_CBP  |  MB_TYPE_16x16  |  MB_TYPE_H261_FIL
-};
-
-//H.261 VLC table for motion vectors
-static const uint8_t h261_mv_tab[17][2] = {
-    {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
-    {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10}, {12,10}
-};
-
-static const int mvmap[17] =
-{
-    0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16
-};
-
-//H.261 VLC table for coded block pattern
-static const uint8_t h261_cbp_tab[63][2] =
-{
-    {11,5}, {9,5}, {13,6}, {13,4}, {23,7}, {19,7}, {31,8}, {12,4},
-    {22,7}, {18,7}, {30,8}, {19,5}, {27,8}, {23,8}, {19,8}, {11,4},
-    {21,7}, {17,7}, {29,8}, {17,5}, {25,8}, {21,8}, {17,8}, {15,6},
-    {15,8}, {13,8}, {3,9}, {15,5}, {11,8}, {7,8}, {7,9}, {10,4},
-    {20,7}, {16,7}, {28,8}, {14,6}, {14,8}, {12,8}, {2,9}, {16,5},
-    {24,8}, {20,8}, {16,8}, {14,5}, {10,8}, {6,8}, {6,9}, {18,5},
-    {26,8}, {22,8}, {18,8}, {13,5}, {9,8}, {5,8}, {5,9}, {12,5},
-    {8,8}, {4,8}, {4,9}, {7,3}, {10,5}, {8,5}, {12,6}
-};
-
-//H.261 VLC table for transform coefficients
-static const uint16_t h261_tcoeff_vlc[65][2] = {
-{ 0x2, 2 }, { 0x3, 2 },{ 0x4, 4 },{ 0x5, 5 },
-{ 0x6, 7 },{ 0x26, 8 },{ 0x21, 8 },{ 0xa, 10 },
-{ 0x1d, 12 },{ 0x18, 12 },{ 0x13, 12 },{ 0x10 , 12 },
-{ 0x1a, 13},{ 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 },
-{ 0x3, 3 }, { 0x6, 6 }, { 0x25 , 8 }, { 0xc, 10 },
-{ 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x5, 4},
-{ 0x4, 7}, { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 },
-{ 0x7, 5 }, { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 },
-{ 0x6, 5 }, { 0xf, 10 }, { 0x12, 12}, { 0x7, 6},
-{ 0x9 , 10 }, { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 },
-{ 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12},
-{ 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
-{ 0x23, 8 }, { 0x22, 8 }, { 0x20, 8 }, { 0xe , 10 },
-{ 0xd, 10 }, { 0x8, 10 },{ 0x1f, 12 }, { 0x1a, 12 },
-{ 0x19, 12 }, { 0x17, 12 }, { 0x16, 12}, { 0x1f, 13},
-{ 0x1e, 13 }, { 0x1d, 13 }, { 0x1c, 13}, { 0x1b, 13},
-{ 0x1, 6 }                                             //escape
-};
-
-static const int8_t h261_tcoeff_level[64] = {
-    0,  1,  2,  3,  4,  5,  6,  7,
-    8,  9, 10, 11, 12, 13, 14, 15,
-    1,  2,  3,  4,  5,  6,  7,  1,
-    2,  3,  4,  5,  1,  2,  3,  4,
-    1,  2,  3,  1,  2,  3,  1,  2,
-    1,  2,  1,  2,  1,  2,  1,  2,
-    1,  1,  1,  1,  1,  1,  1,  1,
-    1,  1,  1,  1,  1,  1,  1,  1
-};
-
-static const int8_t h261_tcoeff_run[64] = {
-    0,
-    0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  1,
-    1,  1,  1,  1,  1,  1,  2,  2,
-    2,  2,  2,  3,  3,  3,  3,  4,
-    4,  4,  5,  5,  5,  6,  6,  7,
-    7,  8,  8,  9,  9, 10, 10, 11,
-   12, 13, 14, 15, 16, 17, 18, 19,
-   20, 21, 22, 23, 24, 25, 26
-};
-
-static RLTable h261_rl_tcoeff = {
-    64,
-    64,
-    h261_tcoeff_vlc,
-    h261_tcoeff_run,
-    h261_tcoeff_level,
-};
-
-#endif /* AVCODEC_H261DATA_H */
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
deleted file mode 100644
index bb5f27d..0000000
--- a/libavcodec/h261dec.c
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * H261 decoder
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2004 Maarten Daniels
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.261 decoder.
- */
-
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "h261.h"
-#include "h261data.h"
-
-#define H261_MBA_VLC_BITS 9
-#define H261_MTYPE_VLC_BITS 6
-#define H261_MV_VLC_BITS 7
-#define H261_CBP_VLC_BITS 9
-#define TCOEFF_VLC_BITS 9
-#define MBA_STUFFING 33
-#define MBA_STARTCODE 34
-
-extern uint8_t ff_h261_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3];
-
-static VLC h261_mba_vlc;
-static VLC h261_mtype_vlc;
-static VLC h261_mv_vlc;
-static VLC h261_cbp_vlc;
-
-static int h261_decode_block(H261Context * h, DCTELEM * block, int n, int coded);
-
-static av_cold void h261_decode_init_vlc(H261Context *h){
-    static int done = 0;
-
-    if(!done){
-        done = 1;
-        INIT_VLC_STATIC(&h261_mba_vlc, H261_MBA_VLC_BITS, 35,
-                 h261_mba_bits, 1, 1,
-                 h261_mba_code, 1, 1, 662);
-        INIT_VLC_STATIC(&h261_mtype_vlc, H261_MTYPE_VLC_BITS, 10,
-                 h261_mtype_bits, 1, 1,
-                 h261_mtype_code, 1, 1, 80);
-        INIT_VLC_STATIC(&h261_mv_vlc, H261_MV_VLC_BITS, 17,
-                 &h261_mv_tab[0][1], 2, 1,
-                 &h261_mv_tab[0][0], 2, 1, 144);
-        INIT_VLC_STATIC(&h261_cbp_vlc, H261_CBP_VLC_BITS, 63,
-                 &h261_cbp_tab[0][1], 2, 1,
-                 &h261_cbp_tab[0][0], 2, 1, 512);
-        init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store);
-        INIT_VLC_RL(h261_rl_tcoeff, 552);
-    }
-}
-
-static av_cold int h261_decode_init(AVCodecContext *avctx){
-    H261Context *h= avctx->priv_data;
-    MpegEncContext * const s = &h->s;
-
-    // set defaults
-    MPV_decode_defaults(s);
-    s->avctx = avctx;
-
-    s->width  = s->avctx->coded_width;
-    s->height = s->avctx->coded_height;
-    s->codec_id = s->avctx->codec->id;
-
-    s->out_format = FMT_H261;
-    s->low_delay= 1;
-    avctx->pix_fmt= PIX_FMT_YUV420P;
-
-    s->codec_id= avctx->codec->id;
-
-    h261_decode_init_vlc(h);
-
-    h->gob_start_code_skipped = 0;
-
-    return 0;
-}
-
-/**
- * decodes the group of blocks header or slice header.
- * @return <0 if an error occurred
- */
-static int h261_decode_gob_header(H261Context *h){
-    unsigned int val;
-    MpegEncContext * const s = &h->s;
-
-    if ( !h->gob_start_code_skipped ){
-        /* Check for GOB Start Code */
-        val = show_bits(&s->gb, 15);
-        if(val)
-            return -1;
-
-        /* We have a GBSC */
-        skip_bits(&s->gb, 16);
-    }
-
-    h->gob_start_code_skipped = 0;
-
-    h->gob_number = get_bits(&s->gb, 4); /* GN */
-    s->qscale = get_bits(&s->gb, 5); /* GQUANT */
-
-    /* Check if gob_number is valid */
-    if (s->mb_height==18){ //cif
-        if ((h->gob_number<=0) || (h->gob_number>12))
-            return -1;
-    }
-    else{ //qcif
-        if ((h->gob_number!=1) && (h->gob_number!=3) && (h->gob_number!=5))
-            return -1;
-    }
-
-    /* GEI */
-    while (get_bits1(&s->gb) != 0) {
-        skip_bits(&s->gb, 8);
-    }
-
-    if(s->qscale==0) {
-        av_log(s->avctx, AV_LOG_ERROR, "qscale has forbidden 0 value\n");
-        if (s->avctx->error_recognition >= FF_ER_COMPLIANT)
-            return -1;
-    }
-
-    // For the first transmitted macroblock in a GOB, MBA is the absolute address. For
-    // subsequent macroblocks, MBA is the difference between the absolute addresses of
-    // the macroblock and the last transmitted macroblock.
-    h->current_mba = 0;
-    h->mba_diff = 0;
-
-    return 0;
-}
-
-/**
- * decodes the group of blocks / video packet header.
- * @return <0 if no resync found
- */
-static int ff_h261_resync(H261Context *h){
-    MpegEncContext * const s = &h->s;
-    int left, ret;
-
-    if ( h->gob_start_code_skipped ){
-        ret= h261_decode_gob_header(h);
-        if(ret>=0)
-            return 0;
-    }
-    else{
-        if(show_bits(&s->gb, 15)==0){
-            ret= h261_decode_gob_header(h);
-            if(ret>=0)
-                return 0;
-        }
-        //OK, it is not where it is supposed to be ...
-        s->gb= s->last_resync_gb;
-        align_get_bits(&s->gb);
-        left= get_bits_left(&s->gb);
-
-        for(;left>15+1+4+5; left-=8){
-            if(show_bits(&s->gb, 15)==0){
-                GetBitContext bak= s->gb;
-
-                ret= h261_decode_gob_header(h);
-                if(ret>=0)
-                    return 0;
-
-                s->gb= bak;
-            }
-            skip_bits(&s->gb, 8);
-        }
-    }
-
-    return -1;
-}
-
-/**
- * decodes skipped macroblocks
- * @return 0
- */
-static int h261_decode_mb_skipped(H261Context *h, int mba1, int mba2 )
-{
-    MpegEncContext * const s = &h->s;
-    int i;
-
-    s->mb_intra = 0;
-
-    for(i=mba1; i<mba2; i++){
-        int j, xy;
-
-        s->mb_x= ((h->gob_number-1) % 2) * 11 + i % 11;
-        s->mb_y= ((h->gob_number-1) / 2) * 3 + i / 11;
-        xy = s->mb_x + s->mb_y * s->mb_stride;
-        ff_init_block_index(s);
-        ff_update_block_index(s);
-
-        for(j=0;j<6;j++)
-            s->block_last_index[j] = -1;
-
-        s->mv_dir = MV_DIR_FORWARD;
-        s->mv_type = MV_TYPE_16X16;
-        s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-        s->mv[0][0][0] = 0;
-        s->mv[0][0][1] = 0;
-        s->mb_skipped = 1;
-        h->mtype &= ~MB_TYPE_H261_FIL;
-
-        MPV_decode_mb(s, s->block);
-    }
-
-    return 0;
-}
-
-static int decode_mv_component(GetBitContext *gb, int v){
-    int mv_diff = get_vlc2(gb, h261_mv_vlc.table, H261_MV_VLC_BITS, 2);
-
-    /* check if mv_diff is valid */
-    if ( mv_diff < 0 )
-        return v;
-
-    mv_diff = mvmap[mv_diff];
-
-    if(mv_diff && !get_bits1(gb))
-        mv_diff= -mv_diff;
-
-    v += mv_diff;
-    if     (v <=-16) v+= 32;
-    else if(v >= 16) v-= 32;
-
-    return v;
-}
-
-static int h261_decode_mb(H261Context *h){
-    MpegEncContext * const s = &h->s;
-    int i, cbp, xy;
-
-    cbp = 63;
-    // Read mba
-    do{
-        h->mba_diff = get_vlc2(&s->gb, h261_mba_vlc.table, H261_MBA_VLC_BITS, 2);
-
-        /* Check for slice end */
-        /* NOTE: GOB can be empty (no MB data) or exist only of MBA_stuffing */
-        if (h->mba_diff == MBA_STARTCODE){ // start code
-            h->gob_start_code_skipped = 1;
-            return SLICE_END;
-        }
-    }
-    while( h->mba_diff == MBA_STUFFING ); // stuffing
-
-    if ( h->mba_diff < 0 ){
-        if ( get_bits_count(&s->gb) + 7 >= s->gb.size_in_bits )
-            return SLICE_END;
-
-        av_log(s->avctx, AV_LOG_ERROR, "illegal mba at %d %d\n", s->mb_x, s->mb_y);
-        return SLICE_ERROR;
-    }
-
-    h->mba_diff += 1;
-    h->current_mba += h->mba_diff;
-
-    if ( h->current_mba > MBA_STUFFING )
-        return SLICE_ERROR;
-
-    s->mb_x= ((h->gob_number-1) % 2) * 11 + ((h->current_mba-1) % 11);
-    s->mb_y= ((h->gob_number-1) / 2) * 3 + ((h->current_mba-1) / 11);
-    xy = s->mb_x + s->mb_y * s->mb_stride;
-    ff_init_block_index(s);
-    ff_update_block_index(s);
-
-    // Read mtype
-    h->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2);
-    h->mtype = h261_mtype_map[h->mtype];
-
-    // Read mquant
-    if ( IS_QUANT ( h->mtype ) ){
-        ff_set_qscale(s, get_bits(&s->gb, 5));
-    }
-
-    s->mb_intra = IS_INTRA4x4(h->mtype);
-
-    // Read mv
-    if ( IS_16X16 ( h->mtype ) ){
-        // Motion vector data is included for all MC macroblocks. MVD is obtained from the macroblock vector by subtracting the
-        // vector of the preceding macroblock. For this calculation the vector of the preceding macroblock is regarded as zero in the
-        // following three situations:
-        // 1) evaluating MVD for macroblocks 1, 12 and 23;
-        // 2) evaluating MVD for macroblocks in which MBA does not represent a difference of 1;
-        // 3) MTYPE of the previous macroblock was not MC.
-        if ( ( h->current_mba == 1 ) || ( h->current_mba == 12 ) || ( h->current_mba == 23 ) ||
-             ( h->mba_diff != 1))
-        {
-            h->current_mv_x = 0;
-            h->current_mv_y = 0;
-        }
-
-        h->current_mv_x= decode_mv_component(&s->gb, h->current_mv_x);
-        h->current_mv_y= decode_mv_component(&s->gb, h->current_mv_y);
-    }else{
-        h->current_mv_x = 0;
-        h->current_mv_y = 0;
-    }
-
-    // Read cbp
-    if ( HAS_CBP( h->mtype ) ){
-        cbp = get_vlc2(&s->gb, h261_cbp_vlc.table, H261_CBP_VLC_BITS, 2) + 1;
-    }
-
-    if(s->mb_intra){
-        s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
-        goto intra;
-    }
-
-    //set motion vectors
-    s->mv_dir = MV_DIR_FORWARD;
-    s->mv_type = MV_TYPE_16X16;
-    s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
-    s->mv[0][0][0] = h->current_mv_x * 2;//gets divided by 2 in motion compensation
-    s->mv[0][0][1] = h->current_mv_y * 2;
-
-intra:
-    /* decode each block */
-    if(s->mb_intra || HAS_CBP(h->mtype)){
-        s->dsp.clear_blocks(s->block[0]);
-        for (i = 0; i < 6; i++) {
-            if (h261_decode_block(h, s->block[i], i, cbp&32) < 0){
-                return SLICE_ERROR;
-            }
-            cbp+=cbp;
-        }
-    }else{
-        for (i = 0; i < 6; i++)
-            s->block_last_index[i]= -1;
-    }
-
-    MPV_decode_mb(s, s->block);
-
-    return SLICE_OK;
-}
-
-/**
- * decodes a macroblock
- * @return <0 if an error occurred
- */
-static int h261_decode_block(H261Context * h, DCTELEM * block,
-                             int n, int coded)
-{
-    MpegEncContext * const s = &h->s;
-    int code, level, i, j, run;
-    RLTable *rl = &h261_rl_tcoeff;
-    const uint8_t *scan_table;
-
-    // For the variable length encoding there are two code tables, one being used for
-    // the first transmitted LEVEL in INTER, INTER+MC and INTER+MC+FIL blocks, the second
-    // for all other LEVELs except the first one in INTRA blocks which is fixed length
-    // coded with 8 bits.
-    // NOTE: the two code tables only differ in one VLC so we handle that manually.
-    scan_table = s->intra_scantable.permutated;
-    if (s->mb_intra){
-        /* DC coef */
-        level = get_bits(&s->gb, 8);
-        // 0 (00000000b) and -128 (10000000b) are FORBIDDEN
-        if((level&0x7F) == 0){
-            av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y);
-            return -1;
-        }
-        // The code 1000 0000 is not used, the reconstruction level of 1024 being coded as 1111 1111.
-        if (level == 255)
-            level = 128;
-        block[0] = level;
-        i = 1;
-    }else if(coded){
-        // Run  Level   Code
-        // EOB                  Not possible for first level when cbp is available (that's why the table is different)
-        // 0    1               1s
-        // *    *               0*
-        int check = show_bits(&s->gb, 2);
-        i = 0;
-        if ( check & 0x2 ){
-            skip_bits(&s->gb, 2);
-            block[0] = ( check & 0x1 ) ? -1 : 1;
-            i = 1;
-        }
-    }else{
-        i = 0;
-    }
-    if(!coded){
-        s->block_last_index[n] = i - 1;
-        return 0;
-    }
-    for(;;){
-        code = get_vlc2(&s->gb, rl->vlc.table, TCOEFF_VLC_BITS, 2);
-        if (code < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        if (code == rl->n) {
-            /* escape */
-            // The remaining combinations of (run, level) are encoded with a 20-bit word consisting of 6 bits escape, 6 bits run and 8 bits level.
-            run = get_bits(&s->gb, 6);
-            level = get_sbits(&s->gb, 8);
-        }else if(code == 0){
-            break;
-        }else{
-            run = rl->table_run[code];
-            level = rl->table_level[code];
-            if (get_bits1(&s->gb))
-                level = -level;
-        }
-        i += run;
-        if (i >= 64){
-            av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        j = scan_table[i];
-        block[j] = level;
-        i++;
-    }
-    s->block_last_index[n] = i-1;
-    return 0;
-}
-
-/**
- * decodes the H261 picture header.
- * @return <0 if no startcode found
- */
-static int h261_decode_picture_header(H261Context *h){
-    MpegEncContext * const s = &h->s;
-    int format, i;
-    uint32_t startcode= 0;
-
-    for(i= get_bits_left(&s->gb); i>24; i-=1){
-        startcode = ((startcode << 1) | get_bits(&s->gb, 1)) & 0x000FFFFF;
-
-        if(startcode == 0x10)
-            break;
-    }
-
-    if (startcode != 0x10){
-        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
-        return -1;
-    }
-
-    /* temporal reference */
-    i= get_bits(&s->gb, 5); /* picture timestamp */
-    if(i < (s->picture_number&31))
-        i += 32;
-    s->picture_number = (s->picture_number&~31) + i;
-
-    s->avctx->time_base= (AVRational){1001, 30000};
-    s->current_picture.pts= s->picture_number;
-
-
-    /* PTYPE starts here */
-    skip_bits1(&s->gb); /* split screen off */
-    skip_bits1(&s->gb); /* camera  off */
-    skip_bits1(&s->gb); /* freeze picture release off */
-
-    format = get_bits1(&s->gb);
-
-    //only 2 formats possible
-    if (format == 0){//QCIF
-        s->width = 176;
-        s->height = 144;
-        s->mb_width = 11;
-        s->mb_height = 9;
-    }else{//CIF
-        s->width = 352;
-        s->height = 288;
-        s->mb_width = 22;
-        s->mb_height = 18;
-    }
-
-    s->mb_num = s->mb_width * s->mb_height;
-
-    skip_bits1(&s->gb); /* still image mode off */
-    skip_bits1(&s->gb); /* Reserved */
-
-    /* PEI */
-    while (get_bits1(&s->gb) != 0){
-        skip_bits(&s->gb, 8);
-    }
-
-    // h261 has no I-FRAMES, but if we pass FF_I_TYPE for the first frame, the codec crashes if it does
-    // not contain all I-blocks (e.g. when a packet is lost)
-    s->pict_type = FF_P_TYPE;
-
-    h->gob_number = 0;
-    return 0;
-}
-
-static int h261_decode_gob(H261Context *h){
-    MpegEncContext * const s = &h->s;
-
-    ff_set_qscale(s, s->qscale);
-
-    /* decode mb's */
-    while(h->current_mba <= MBA_STUFFING)
-    {
-        int ret;
-        /* DCT & quantize */
-        ret= h261_decode_mb(h);
-        if(ret<0){
-            if(ret==SLICE_END){
-                h261_decode_mb_skipped(h, h->current_mba, 33);
-                return 0;
-            }
-            av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", s->mb_x + s->mb_y*s->mb_stride);
-            return -1;
-        }
-
-        h261_decode_mb_skipped(h, h->current_mba-h->mba_diff, h->current_mba-1);
-    }
-
-    return -1;
-}
-
-/**
- * returns the number of bytes consumed for building the current frame
- */
-static int get_consumed_bytes(MpegEncContext *s, int buf_size){
-    int pos= get_bits_count(&s->gb)>>3;
-    if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...)
-    if(pos+10>buf_size) pos=buf_size; // oops ;)
-
-    return pos;
-}
-
-static int h261_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    H261Context *h= avctx->priv_data;
-    MpegEncContext *s = &h->s;
-    int ret;
-    AVFrame *pict = data;
-
-    dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
-    dprintf(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
-    s->flags= avctx->flags;
-    s->flags2= avctx->flags2;
-
-    h->gob_start_code_skipped=0;
-
-retry:
-
-    init_get_bits(&s->gb, buf, buf_size*8);
-
-    if(!s->context_initialized){
-        if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
-            return -1;
-    }
-
-    //we need to set current_picture_ptr before reading the header, otherwise we cannot store anyting im there
-    if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
-        int i= ff_find_unused_picture(s, 0);
-        s->current_picture_ptr= &s->picture[i];
-    }
-
-    ret = h261_decode_picture_header(h);
-
-    /* skip if the header was thrashed */
-    if (ret < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
-        return -1;
-    }
-
-    if (s->width != avctx->coded_width || s->height != avctx->coded_height){
-        ParseContext pc= s->parse_context; //FIXME move this demuxing hack to libavformat
-        s->parse_context.buffer=0;
-        MPV_common_end(s);
-        s->parse_context= pc;
-    }
-    if (!s->context_initialized) {
-        avcodec_set_dimensions(avctx, s->width, s->height);
-
-        goto retry;
-    }
-
-    // for hurry_up==5
-    s->current_picture.pict_type= s->pict_type;
-    s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
-
-    /* skip everything if we are in a hurry>=5 */
-    if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
-    if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
-       ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
-       || avctx->skip_frame >= AVDISCARD_ALL)
-        return get_consumed_bytes(s, buf_size);
-
-    if(MPV_frame_start(s, avctx) < 0)
-        return -1;
-
-    ff_er_frame_start(s);
-
-    /* decode each macroblock */
-    s->mb_x=0;
-    s->mb_y=0;
-
-    while(h->gob_number < (s->mb_height==18 ? 12 : 5)){
-        if(ff_h261_resync(h)<0)
-            break;
-        h261_decode_gob(h);
-    }
-    MPV_frame_end(s);
-
-assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
-assert(s->current_picture.pict_type == s->pict_type);
-    *pict= *(AVFrame*)s->current_picture_ptr;
-    ff_print_debug_info(s, pict);
-
-    *data_size = sizeof(AVFrame);
-
-    return get_consumed_bytes(s, buf_size);
-}
-
-static av_cold int h261_decode_end(AVCodecContext *avctx)
-{
-    H261Context *h= avctx->priv_data;
-    MpegEncContext *s = &h->s;
-
-    MPV_common_end(s);
-    return 0;
-}
-
-AVCodec h261_decoder = {
-    "h261",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H261,
-    sizeof(H261Context),
-    h261_decode_init,
-    NULL,
-    h261_decode_end,
-    h261_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("H.261"),
-};
diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
deleted file mode 100644
index d3f2219..0000000
--- a/libavcodec/h261enc.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * H261 encoder
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2004 Maarten Daniels
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.261 encoder.
- */
-
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "h261.h"
-#include "h261data.h"
-
-extern uint8_t ff_h261_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3];
-
-static void h261_encode_block(H261Context * h, DCTELEM * block,
-                              int n);
-
-int ff_h261_get_picture_format(int width, int height){
-    // QCIF
-    if (width == 176 && height == 144)
-        return 0;
-    // CIF
-    else if (width == 352 && height == 288)
-        return 1;
-    // ERROR
-    else
-        return -1;
-}
-
-void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number){
-    H261Context * h = (H261Context *) s;
-    int format, temp_ref;
-
-    align_put_bits(&s->pb);
-
-    /* Update the pointer to last GOB */
-    s->ptr_lastgob = put_bits_ptr(&s->pb);
-
-    put_bits(&s->pb, 20, 0x10); /* PSC */
-
-    temp_ref= s->picture_number * (int64_t)30000 * s->avctx->time_base.num /
-                         (1001 * (int64_t)s->avctx->time_base.den); //FIXME maybe this should use a timestamp
-    put_sbits(&s->pb, 5, temp_ref); /* TemporalReference */
-
-    put_bits(&s->pb, 1, 0); /* split screen off */
-    put_bits(&s->pb, 1, 0); /* camera  off */
-    put_bits(&s->pb, 1, 0); /* freeze picture release off */
-
-    format = ff_h261_get_picture_format(s->width, s->height);
-
-    put_bits(&s->pb, 1, format); /* 0 == QCIF, 1 == CIF */
-
-    put_bits(&s->pb, 1, 0); /* still image mode */
-    put_bits(&s->pb, 1, 0); /* reserved */
-
-    put_bits(&s->pb, 1, 0); /* no PEI */
-    if(format == 0)
-        h->gob_number = -1;
-    else
-        h->gob_number = 0;
-    h->current_mba = 0;
-}
-
-/**
- * Encodes a group of blocks header.
- */
-static void h261_encode_gob_header(MpegEncContext * s, int mb_line){
-    H261Context * h = (H261Context *)s;
-    if(ff_h261_get_picture_format(s->width, s->height) == 0){
-        h->gob_number+=2; // QCIF
-    }
-    else{
-        h->gob_number++; // CIF
-    }
-    put_bits(&s->pb, 16, 1); /* GBSC */
-    put_bits(&s->pb, 4, h->gob_number); /* GN */
-    put_bits(&s->pb, 5, s->qscale); /* GQUANT */
-    put_bits(&s->pb, 1, 0); /* no GEI */
-    h->current_mba = 0;
-    h->previous_mba = 0;
-    h->current_mv_x=0;
-    h->current_mv_y=0;
-}
-
-void ff_h261_reorder_mb_index(MpegEncContext* s){
-    int index= s->mb_x + s->mb_y*s->mb_width;
-
-    if(index % 33 == 0)
-        h261_encode_gob_header(s,0);
-
-    /* for CIF the GOB's are fragmented in the middle of a scanline
-       that's why we need to adjust the x and y index of the macroblocks */
-    if(ff_h261_get_picture_format(s->width,s->height) == 1){ // CIF
-        s->mb_x =     index % 11 ; index /= 11;
-        s->mb_y =     index %  3 ; index /=  3;
-        s->mb_x+= 11*(index %  2); index /=  2;
-        s->mb_y+=  3*index;
-
-        ff_init_block_index(s);
-        ff_update_block_index(s);
-    }
-}
-
-static void h261_encode_motion(H261Context * h, int val){
-    MpegEncContext * const s = &h->s;
-    int sign, code;
-    if(val==0){
-        code = 0;
-        put_bits(&s->pb,h261_mv_tab[code][1],h261_mv_tab[code][0]);
-    }
-    else{
-        if(val > 15)
-            val -=32;
-        if(val < -16)
-            val+=32;
-        sign = val < 0;
-        code = sign ? -val : val;
-        put_bits(&s->pb,h261_mv_tab[code][1],h261_mv_tab[code][0]);
-        put_bits(&s->pb,1,sign);
-    }
-}
-
-static inline int get_cbp(MpegEncContext * s,
-                      DCTELEM block[6][64])
-{
-    int i, cbp;
-    cbp= 0;
-    for (i = 0; i < 6; i++) {
-        if (s->block_last_index[i] >= 0)
-            cbp |= 1 << (5 - i);
-    }
-    return cbp;
-}
-void ff_h261_encode_mb(MpegEncContext * s,
-         DCTELEM block[6][64],
-         int motion_x, int motion_y)
-{
-    H261Context * h = (H261Context *)s;
-    int mvd, mv_diff_x, mv_diff_y, i, cbp;
-    cbp = 63; // avoid warning
-    mvd = 0;
-
-    h->current_mba++;
-    h->mtype = 0;
-
-    if (!s->mb_intra){
-        /* compute cbp */
-        cbp= get_cbp(s, block);
-
-        /* mvd indicates if this block is motion compensated */
-        mvd = motion_x | motion_y;
-
-        if((cbp | mvd | s->dquant ) == 0) {
-            /* skip macroblock */
-            s->skip_count++;
-            h->current_mv_x=0;
-            h->current_mv_y=0;
-            return;
-        }
-    }
-
-    /* MB is not skipped, encode MBA */
-    put_bits(&s->pb, h261_mba_bits[(h->current_mba-h->previous_mba)-1], h261_mba_code[(h->current_mba-h->previous_mba)-1]);
-
-    /* calculate MTYPE */
-    if(!s->mb_intra){
-        h->mtype++;
-
-        if(mvd || s->loop_filter)
-            h->mtype+=3;
-        if(s->loop_filter)
-            h->mtype+=3;
-        if(cbp || s->dquant)
-            h->mtype++;
-        assert(h->mtype > 1);
-    }
-
-    if(s->dquant)
-        h->mtype++;
-
-    put_bits(&s->pb, h261_mtype_bits[h->mtype], h261_mtype_code[h->mtype]);
-
-    h->mtype = h261_mtype_map[h->mtype];
-
-    if(IS_QUANT(h->mtype)){
-        ff_set_qscale(s,s->qscale+s->dquant);
-        put_bits(&s->pb, 5, s->qscale);
-    }
-
-    if(IS_16X16(h->mtype)){
-        mv_diff_x = (motion_x >> 1) - h->current_mv_x;
-        mv_diff_y = (motion_y >> 1) - h->current_mv_y;
-        h->current_mv_x = (motion_x >> 1);
-        h->current_mv_y = (motion_y >> 1);
-        h261_encode_motion(h,mv_diff_x);
-        h261_encode_motion(h,mv_diff_y);
-    }
-
-    h->previous_mba = h->current_mba;
-
-    if(HAS_CBP(h->mtype)){
-        assert(cbp>0);
-        put_bits(&s->pb,h261_cbp_tab[cbp-1][1],h261_cbp_tab[cbp-1][0]);
-    }
-    for(i=0; i<6; i++) {
-        /* encode each block */
-        h261_encode_block(h, block[i], i);
-    }
-
-    if ( ( h->current_mba == 11 ) || ( h->current_mba == 22 ) || ( h->current_mba == 33 ) || ( !IS_16X16 ( h->mtype ) )){
-        h->current_mv_x=0;
-        h->current_mv_y=0;
-    }
-}
-
-void ff_h261_encode_init(MpegEncContext *s){
-    static int done = 0;
-
-    if (!done) {
-        done = 1;
-        init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store);
-    }
-
-    s->min_qcoeff= -127;
-    s->max_qcoeff=  127;
-    s->y_dc_scale_table=
-    s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-}
-
-
-/**
- * encodes a 8x8 block.
- * @param block the 8x8 block
- * @param n block index (0-3 are luma, 4-5 are chroma)
- */
-static void h261_encode_block(H261Context * h, DCTELEM * block, int n){
-    MpegEncContext * const s = &h->s;
-    int level, run, i, j, last_index, last_non_zero, sign, slevel, code;
-    RLTable *rl;
-
-    rl = &h261_rl_tcoeff;
-    if (s->mb_intra) {
-        /* DC coef */
-        level = block[0];
-        /* 255 cannot be represented, so we clamp */
-        if (level > 254) {
-            level = 254;
-            block[0] = 254;
-        }
-        /* 0 cannot be represented also */
-        else if (level < 1) {
-            level = 1;
-            block[0] = 1;
-        }
-        if (level == 128)
-            put_bits(&s->pb, 8, 0xff);
-        else
-            put_bits(&s->pb, 8, level);
-        i = 1;
-    } else if((block[0]==1 || block[0] == -1) && (s->block_last_index[n] > -1)){
-        //special case
-        put_bits(&s->pb,2,block[0]>0 ? 2 : 3 );
-        i = 1;
-    } else {
-        i = 0;
-    }
-
-    /* AC coefs */
-    last_index = s->block_last_index[n];
-    last_non_zero = i - 1;
-    for (; i <= last_index; i++) {
-        j = s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            run = i - last_non_zero - 1;
-            sign = 0;
-            slevel = level;
-            if (level < 0) {
-                sign = 1;
-                level = -level;
-            }
-            code = get_rl_index(rl, 0 /*no last in H.261, EOB is used*/, run, level);
-            if(run==0 && level < 16)
-            code+=1;
-            put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-            if (code == rl->n) {
-                put_bits(&s->pb, 6, run);
-                assert(slevel != 0);
-                assert(level <= 127);
-                put_sbits(&s->pb, 8, slevel);
-            } else {
-                put_bits(&s->pb, 1, sign);
-            }
-            last_non_zero = i;
-        }
-    }
-    if(last_index > -1){
-        put_bits(&s->pb, rl->table_vlc[0][1], rl->table_vlc[0][0]);// END OF BLOCK
-    }
-}
-
-AVCodec h261_encoder = {
-    "h261",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H261,
-    sizeof(H261Context),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("H.261"),
-};
-
diff --git a/libavcodec/h263.c b/libavcodec/h263.c
deleted file mode 100644
index 50ea6ce..0000000
--- a/libavcodec/h263.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * H263/MPEG4 backend for ffmpeg encoder and decoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * H263+ support.
- * Copyright (c) 2001 Juan J. Sierralta P
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * h263/mpeg4 codec.
- */
-
-//#define DEBUG
-#include <limits.h>
-
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "h263data.h"
-#include "mathops.h"
-#include "unary.h"
-#include "flv.h"
-#include "mpeg4video.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-uint8_t ff_h263_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-
-void ff_h263_update_motion_val(MpegEncContext * s){
-    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-               //FIXME a lot of that is only needed for !low_delay
-    const int wrap = s->b8_stride;
-    const int xy = s->block_index[0];
-
-    s->current_picture.mbskip_table[mb_xy]= s->mb_skipped;
-
-    if(s->mv_type != MV_TYPE_8X8){
-        int motion_x, motion_y;
-        if (s->mb_intra) {
-            motion_x = 0;
-            motion_y = 0;
-        } else if (s->mv_type == MV_TYPE_16X16) {
-            motion_x = s->mv[0][0][0];
-            motion_y = s->mv[0][0][1];
-        } else /*if (s->mv_type == MV_TYPE_FIELD)*/ {
-            int i;
-            motion_x = s->mv[0][0][0] + s->mv[0][1][0];
-            motion_y = s->mv[0][0][1] + s->mv[0][1][1];
-            motion_x = (motion_x>>1) | (motion_x&1);
-            for(i=0; i<2; i++){
-                s->p_field_mv_table[i][0][mb_xy][0]= s->mv[0][i][0];
-                s->p_field_mv_table[i][0][mb_xy][1]= s->mv[0][i][1];
-            }
-            s->current_picture.ref_index[0][4*mb_xy    ]=
-            s->current_picture.ref_index[0][4*mb_xy + 1]= s->field_select[0][0];
-            s->current_picture.ref_index[0][4*mb_xy + 2]=
-            s->current_picture.ref_index[0][4*mb_xy + 3]= s->field_select[0][1];
-        }
-
-        /* no update if 8X8 because it has been done during parsing */
-        s->current_picture.motion_val[0][xy][0] = motion_x;
-        s->current_picture.motion_val[0][xy][1] = motion_y;
-        s->current_picture.motion_val[0][xy + 1][0] = motion_x;
-        s->current_picture.motion_val[0][xy + 1][1] = motion_y;
-        s->current_picture.motion_val[0][xy + wrap][0] = motion_x;
-        s->current_picture.motion_val[0][xy + wrap][1] = motion_y;
-        s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x;
-        s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y;
-    }
-
-    if(s->encoding){ //FIXME encoding MUST be cleaned up
-        if (s->mv_type == MV_TYPE_8X8)
-            s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_8x8;
-        else if(s->mb_intra)
-            s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA;
-        else
-            s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_16x16;
-    }
-}
-
-int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr)
-{
-    int x, y, wrap, a, c, pred_dc;
-    int16_t *dc_val;
-
-    /* find prediction */
-    if (n < 4) {
-        x = 2 * s->mb_x + (n & 1);
-        y = 2 * s->mb_y + ((n & 2) >> 1);
-        wrap = s->b8_stride;
-        dc_val = s->dc_val[0];
-    } else {
-        x = s->mb_x;
-        y = s->mb_y;
-        wrap = s->mb_stride;
-        dc_val = s->dc_val[n - 4 + 1];
-    }
-    /* B C
-     * A X
-     */
-    a = dc_val[(x - 1) + (y) * wrap];
-    c = dc_val[(x) + (y - 1) * wrap];
-
-    /* No prediction outside GOB boundary */
-    if(s->first_slice_line && n!=3){
-        if(n!=2) c= 1024;
-        if(n!=1 && s->mb_x == s->resync_mb_x) a= 1024;
-    }
-    /* just DC prediction */
-    if (a != 1024 && c != 1024)
-        pred_dc = (a + c) >> 1;
-    else if (a != 1024)
-        pred_dc = a;
-    else
-        pred_dc = c;
-
-    /* we assume pred is positive */
-    *dc_val_ptr = &dc_val[x + y * wrap];
-    return pred_dc;
-}
-
-void ff_h263_loop_filter(MpegEncContext * s){
-    int qp_c;
-    const int linesize  = s->linesize;
-    const int uvlinesize= s->uvlinesize;
-    const int xy = s->mb_y * s->mb_stride + s->mb_x;
-    uint8_t *dest_y = s->dest[0];
-    uint8_t *dest_cb= s->dest[1];
-    uint8_t *dest_cr= s->dest[2];
-
-//    if(s->pict_type==FF_B_TYPE && !s->readable) return;
-
-    /*
-       Diag Top
-       Left Center
-    */
-    if(!IS_SKIP(s->current_picture.mb_type[xy])){
-        qp_c= s->qscale;
-        s->dsp.h263_v_loop_filter(dest_y+8*linesize  , linesize, qp_c);
-        s->dsp.h263_v_loop_filter(dest_y+8*linesize+8, linesize, qp_c);
-    }else
-        qp_c= 0;
-
-    if(s->mb_y){
-        int qp_dt, qp_tt, qp_tc;
-
-        if(IS_SKIP(s->current_picture.mb_type[xy-s->mb_stride]))
-            qp_tt=0;
-        else
-            qp_tt= s->current_picture.qscale_table[xy-s->mb_stride];
-
-        if(qp_c)
-            qp_tc= qp_c;
-        else
-            qp_tc= qp_tt;
-
-        if(qp_tc){
-            const int chroma_qp= s->chroma_qscale_table[qp_tc];
-            s->dsp.h263_v_loop_filter(dest_y  ,   linesize, qp_tc);
-            s->dsp.h263_v_loop_filter(dest_y+8,   linesize, qp_tc);
-
-            s->dsp.h263_v_loop_filter(dest_cb , uvlinesize, chroma_qp);
-            s->dsp.h263_v_loop_filter(dest_cr , uvlinesize, chroma_qp);
-        }
-
-        if(qp_tt)
-            s->dsp.h263_h_loop_filter(dest_y-8*linesize+8  ,   linesize, qp_tt);
-
-        if(s->mb_x){
-            if(qp_tt || IS_SKIP(s->current_picture.mb_type[xy-1-s->mb_stride]))
-                qp_dt= qp_tt;
-            else
-                qp_dt= s->current_picture.qscale_table[xy-1-s->mb_stride];
-
-            if(qp_dt){
-                const int chroma_qp= s->chroma_qscale_table[qp_dt];
-                s->dsp.h263_h_loop_filter(dest_y -8*linesize  ,   linesize, qp_dt);
-                s->dsp.h263_h_loop_filter(dest_cb-8*uvlinesize, uvlinesize, chroma_qp);
-                s->dsp.h263_h_loop_filter(dest_cr-8*uvlinesize, uvlinesize, chroma_qp);
-            }
-        }
-    }
-
-    if(qp_c){
-        s->dsp.h263_h_loop_filter(dest_y +8,   linesize, qp_c);
-        if(s->mb_y + 1 == s->mb_height)
-            s->dsp.h263_h_loop_filter(dest_y+8*linesize+8,   linesize, qp_c);
-    }
-
-    if(s->mb_x){
-        int qp_lc;
-        if(qp_c || IS_SKIP(s->current_picture.mb_type[xy-1]))
-            qp_lc= qp_c;
-        else
-            qp_lc= s->current_picture.qscale_table[xy-1];
-
-        if(qp_lc){
-            s->dsp.h263_h_loop_filter(dest_y,   linesize, qp_lc);
-            if(s->mb_y + 1 == s->mb_height){
-                const int chroma_qp= s->chroma_qscale_table[qp_lc];
-                s->dsp.h263_h_loop_filter(dest_y +8*  linesize,   linesize, qp_lc);
-                s->dsp.h263_h_loop_filter(dest_cb             , uvlinesize, chroma_qp);
-                s->dsp.h263_h_loop_filter(dest_cr             , uvlinesize, chroma_qp);
-            }
-        }
-    }
-}
-
-void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n)
-{
-    int x, y, wrap, a, c, pred_dc, scale, i;
-    int16_t *dc_val, *ac_val, *ac_val1;
-
-    /* find prediction */
-    if (n < 4) {
-        x = 2 * s->mb_x + (n & 1);
-        y = 2 * s->mb_y + (n>> 1);
-        wrap = s->b8_stride;
-        dc_val = s->dc_val[0];
-        ac_val = s->ac_val[0][0];
-        scale = s->y_dc_scale;
-    } else {
-        x = s->mb_x;
-        y = s->mb_y;
-        wrap = s->mb_stride;
-        dc_val = s->dc_val[n - 4 + 1];
-        ac_val = s->ac_val[n - 4 + 1][0];
-        scale = s->c_dc_scale;
-    }
-
-    ac_val += ((y) * wrap + (x)) * 16;
-    ac_val1 = ac_val;
-
-    /* B C
-     * A X
-     */
-    a = dc_val[(x - 1) + (y) * wrap];
-    c = dc_val[(x) + (y - 1) * wrap];
-
-    /* No prediction outside GOB boundary */
-    if(s->first_slice_line && n!=3){
-        if(n!=2) c= 1024;
-        if(n!=1 && s->mb_x == s->resync_mb_x) a= 1024;
-    }
-
-    if (s->ac_pred) {
-        pred_dc = 1024;
-        if (s->h263_aic_dir) {
-            /* left prediction */
-            if (a != 1024) {
-                ac_val -= 16;
-                for(i=1;i<8;i++) {
-                    block[s->dsp.idct_permutation[i<<3]] += ac_val[i];
-                }
-                pred_dc = a;
-            }
-        } else {
-            /* top prediction */
-            if (c != 1024) {
-                ac_val -= 16 * wrap;
-                for(i=1;i<8;i++) {
-                    block[s->dsp.idct_permutation[i   ]] += ac_val[i + 8];
-                }
-                pred_dc = c;
-            }
-        }
-    } else {
-        /* just DC prediction */
-        if (a != 1024 && c != 1024)
-            pred_dc = (a + c) >> 1;
-        else if (a != 1024)
-            pred_dc = a;
-        else
-            pred_dc = c;
-    }
-
-    /* we assume pred is positive */
-    block[0]=block[0]*scale + pred_dc;
-
-    if (block[0] < 0)
-        block[0] = 0;
-    else
-        block[0] |= 1;
-
-    /* Update AC/DC tables */
-    dc_val[(x) + (y) * wrap] = block[0];
-
-    /* left copy */
-    for(i=1;i<8;i++)
-        ac_val1[i    ] = block[s->dsp.idct_permutation[i<<3]];
-    /* top copy */
-    for(i=1;i<8;i++)
-        ac_val1[8 + i] = block[s->dsp.idct_permutation[i   ]];
-}
-
-int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir,
-                        int *px, int *py)
-{
-    int wrap;
-    int16_t *A, *B, *C, (*mot_val)[2];
-    static const int off[4]= {2, 1, 1, -1};
-
-    wrap = s->b8_stride;
-    mot_val = s->current_picture.motion_val[dir] + s->block_index[block];
-
-    A = mot_val[ - 1];
-    /* special case for first (slice) line */
-    if (s->first_slice_line && block<3) {
-        // we can't just change some MVs to simulate that as we need them for the B frames (and ME)
-        // and if we ever support non rectangular objects than we need to do a few ifs here anyway :(
-        if(block==0){ //most common case
-            if(s->mb_x  == s->resync_mb_x){ //rare
-                *px= *py = 0;
-            }else if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare
-                C = mot_val[off[block] - wrap];
-                if(s->mb_x==0){
-                    *px = C[0];
-                    *py = C[1];
-                }else{
-                    *px = mid_pred(A[0], 0, C[0]);
-                    *py = mid_pred(A[1], 0, C[1]);
-                }
-            }else{
-                *px = A[0];
-                *py = A[1];
-            }
-        }else if(block==1){
-            if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare
-                C = mot_val[off[block] - wrap];
-                *px = mid_pred(A[0], 0, C[0]);
-                *py = mid_pred(A[1], 0, C[1]);
-            }else{
-                *px = A[0];
-                *py = A[1];
-            }
-        }else{ /* block==2*/
-            B = mot_val[ - wrap];
-            C = mot_val[off[block] - wrap];
-            if(s->mb_x == s->resync_mb_x) //rare
-                A[0]=A[1]=0;
-
-            *px = mid_pred(A[0], B[0], C[0]);
-            *py = mid_pred(A[1], B[1], C[1]);
-        }
-    } else {
-        B = mot_val[ - wrap];
-        C = mot_val[off[block] - wrap];
-        *px = mid_pred(A[0], B[0], C[0]);
-        *py = mid_pred(A[1], B[1], C[1]);
-    }
-    return *mot_val;
-}
-
-
-/**
- * Get the GOB height based on picture height.
- */
-int ff_h263_get_gob_height(MpegEncContext *s){
-    if (s->height <= 400)
-        return 1;
-    else if (s->height <= 800)
-        return  2;
-    else
-        return 4;
-}
diff --git a/libavcodec/h263.h b/libavcodec/h263.h
deleted file mode 100644
index 678588a..0000000
--- a/libavcodec/h263.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * H263 internal header
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVCODEC_H263_H
-#define AVCODEC_H263_H
-
-#include <stdint.h>
-#include "libavutil/rational.h"
-#include "get_bits.h"
-#include "mpegvideo.h"
-#include "rl.h"
-
-// The defines below define the number of bits that are read at once for
-// reading vlc values. Changing these may improve speed and data cache needs
-// be aware though that decreasing them may need the number of stages that is
-// passed to get_vlc* to be increased.
-#define INTRA_MCBPC_VLC_BITS 6
-#define INTER_MCBPC_VLC_BITS 7
-#define CBPY_VLC_BITS 6
-#define TEX_VLC_BITS 9
-
-extern const AVRational ff_h263_pixel_aspect[16];
-extern const uint8_t ff_h263_cbpy_tab[16][2];
-
-extern const uint8_t cbpc_b_tab[4][2];
-
-extern const uint8_t mvtab[33][2];
-
-extern const uint8_t ff_h263_intra_MCBPC_code[9];
-extern const uint8_t ff_h263_intra_MCBPC_bits[9];
-
-extern const uint8_t ff_h263_inter_MCBPC_code[28];
-extern const uint8_t ff_h263_inter_MCBPC_bits[28];
-extern const uint8_t h263_mbtype_b_tab[15][2];
-
-extern VLC ff_h263_intra_MCBPC_vlc;
-extern VLC ff_h263_inter_MCBPC_vlc;
-extern VLC ff_h263_cbpy_vlc;
-
-extern RLTable ff_h263_rl_inter;
-
-extern RLTable rl_intra_aic;
-
-extern const uint16_t h263_format[8][2];
-extern const uint8_t modified_quant_tab[2][32];
-extern uint16_t ff_mba_max[6];
-extern uint8_t ff_mba_length[7];
-
-extern uint8_t ff_h263_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-
-int h263_decode_motion(MpegEncContext * s, int pred, int f_code);
-av_const int ff_h263_aspect_to_info(AVRational aspect);
-int ff_h263_decode_init(AVCodecContext *avctx);
-int ff_h263_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt);
-int ff_h263_decode_end(AVCodecContext *avctx);
-void h263_encode_mb(MpegEncContext *s,
-                    DCTELEM block[6][64],
-                    int motion_x, int motion_y);
-void h263_encode_picture_header(MpegEncContext *s, int picture_number);
-void h263_encode_gob_header(MpegEncContext * s, int mb_line);
-int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir,
-                        int *px, int *py);
-void h263_encode_init(MpegEncContext *s);
-void h263_decode_init_vlc(MpegEncContext *s);
-int h263_decode_picture_header(MpegEncContext *s);
-int ff_h263_decode_gob_header(MpegEncContext *s);
-void ff_h263_update_motion_val(MpegEncContext * s);
-void ff_h263_loop_filter(MpegEncContext * s);
-int ff_h263_decode_mba(MpegEncContext *s);
-void ff_h263_encode_mba(MpegEncContext *s);
-void ff_init_qscale_tab(MpegEncContext *s);
-int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr);
-void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n);
-
-
-/**
- * Prints picture info if FF_DEBUG_PICT_INFO is set.
- */
-void ff_h263_show_pict_info(MpegEncContext *s);
-
-int ff_intel_h263_decode_picture_header(MpegEncContext *s);
-int ff_h263_decode_mb(MpegEncContext *s,
-                      DCTELEM block[6][64]);
-
-/**
- * Returns the value of the 3bit "source format" syntax element.
- * that represents some standard picture dimensions or indicates that
- * width&height are explicitly stored later.
- */
-int av_const h263_get_picture_format(int width, int height);
-
-void ff_clean_h263_qscales(MpegEncContext *s);
-int ff_h263_resync(MpegEncContext *s);
-const uint8_t *ff_h263_find_resync_marker(const uint8_t *p, const uint8_t *end);
-int ff_h263_get_gob_height(MpegEncContext *s);
-void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code);
-
-
-static inline int h263_get_motion_length(MpegEncContext * s, int val, int f_code){
-    int l, bit_size, code;
-
-    if (val == 0) {
-        return mvtab[0][1];
-    } else {
-        bit_size = f_code - 1;
-        /* modulo encoding */
-        l= INT_BIT - 6 - bit_size;
-        val = (val<<l)>>l;
-        val--;
-        code = (val >> bit_size) + 1;
-
-        return mvtab[code][1] + 1 + bit_size;
-    }
-}
-
-static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int y, int f_code){
-    if(s->flags2 & CODEC_FLAG2_NO_OUTPUT){
-        skip_put_bits(&s->pb,
-            h263_get_motion_length(s, x, f_code)
-           +h263_get_motion_length(s, y, f_code));
-    }else{
-        ff_h263_encode_motion(s, x, f_code);
-        ff_h263_encode_motion(s, y, f_code);
-    }
-}
-
-static inline int get_p_cbp(MpegEncContext * s,
-                      DCTELEM block[6][64],
-                      int motion_x, int motion_y){
-    int cbp, i;
-
-    if(s->flags & CODEC_FLAG_CBP_RD){
-        int best_cbpy_score= INT_MAX;
-        int best_cbpc_score= INT_MAX;
-        int cbpc = (-1), cbpy= (-1);
-        const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0);
-        const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
-
-        for(i=0; i<4; i++){
-            int score= ff_h263_inter_MCBPC_bits[i + offset] * lambda;
-            if(i&1) score += s->coded_score[5];
-            if(i&2) score += s->coded_score[4];
-
-            if(score < best_cbpc_score){
-                best_cbpc_score= score;
-                cbpc= i;
-            }
-        }
-
-        for(i=0; i<16; i++){
-            int score= ff_h263_cbpy_tab[i ^ 0xF][1] * lambda;
-            if(i&1) score += s->coded_score[3];
-            if(i&2) score += s->coded_score[2];
-            if(i&4) score += s->coded_score[1];
-            if(i&8) score += s->coded_score[0];
-
-            if(score < best_cbpy_score){
-                best_cbpy_score= score;
-                cbpy= i;
-            }
-        }
-        cbp= cbpc + 4*cbpy;
-        if ((motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16){
-            if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0)
-                cbp= 0;
-        }
-
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){
-                s->block_last_index[i]= -1;
-                s->dsp.clear_block(s->block[i]);
-            }
-        }
-    }else{
-        cbp= 0;
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0)
-                cbp |= 1 << (5 - i);
-        }
-    }
-    return cbp;
-}
-
-static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
-                            int motion_x, int motion_y, int mb_type){
-    int cbp=0, i;
-
-    if(s->flags & CODEC_FLAG_CBP_RD){
-        int score=0;
-        const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
-
-        for(i=0; i<6; i++){
-            if(s->coded_score[i] < 0){
-                score += s->coded_score[i];
-                cbp |= 1 << (5 - i);
-            }
-        }
-
-        if(cbp){
-            int zero_score= -6;
-            if ((motion_x | motion_y | s->dquant | mb_type) == 0){
-                zero_score-= 4; //2*MV + mb_type + cbp bit
-            }
-
-            zero_score*= lambda;
-            if(zero_score <= score){
-                cbp=0;
-            }
-        }
-
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){
-                s->block_last_index[i]= -1;
-                s->dsp.clear_block(s->block[i]);
-            }
-        }
-    }else{
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0)
-                cbp |= 1 << (5 - i);
-        }
-    }
-    return cbp;
-}
-
-static inline void memsetw(short *tab, int val, int n)
-{
-    int i;
-    for(i=0;i<n;i++)
-        tab[i] = val;
-}
-#endif
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
deleted file mode 100644
index 16c5ea5..0000000
--- a/libavcodec/h263_parser.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * H.263 parser
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.263 parser
- */
-
-#include "parser.h"
-#include "h263_parser.h"
-
-int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
-    int vop_found, i;
-    uint32_t state;
-
-    vop_found= pc->frame_start_found;
-    state= pc->state;
-
-    i=0;
-    if(!vop_found){
-        for(i=0; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(state>>(32-22) == 0x20){
-                i++;
-                vop_found=1;
-                break;
-            }
-        }
-    }
-
-    if(vop_found){
-      for(; i<buf_size; i++){
-        state= (state<<8) | buf[i];
-        if(state>>(32-22) == 0x20){
-            pc->frame_start_found=0;
-            pc->state=-1;
-            return i-3;
-        }
-      }
-    }
-    pc->frame_start_found= vop_found;
-    pc->state= state;
-
-    return END_NOT_FOUND;
-}
-
-static int h263_parse(AVCodecParserContext *s,
-                           AVCodecContext *avctx,
-                           const uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size)
-{
-    ParseContext *pc = s->priv_data;
-    int next;
-
-    next= ff_h263_find_frame_end(pc, buf, buf_size);
-
-    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-        *poutbuf = NULL;
-        *poutbuf_size = 0;
-        return buf_size;
-    }
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-AVCodecParser h263_parser = {
-    { CODEC_ID_H263 },
-    sizeof(ParseContext),
-    NULL,
-    h263_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/h263_parser.h b/libavcodec/h263_parser.h
deleted file mode 100644
index 565a222..0000000
--- a/libavcodec/h263_parser.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * H.263 parser
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_H263_PARSER_H
-#define AVCODEC_H263_PARSER_H
-
-#include "parser.h"
-
-int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-
-#endif /* AVCODEC_H263_PARSER_H */
diff --git a/libavcodec/h263data.h b/libavcodec/h263data.h
deleted file mode 100644
index 81e3ddd..0000000
--- a/libavcodec/h263data.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * copyright (c) 2000,2001 Fabrice Bellard
- * H263+ support
- * copyright (c) 2001 Juan J. Sierralta P
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.263 tables.
- */
-
-#ifndef AVCODEC_H263DATA_H
-#define AVCODEC_H263DATA_H
-
-#include <stdint.h>
-#include "mpegvideo.h"
-
-/* intra MCBPC, mb_type = (intra), then (intraq) */
-const uint8_t ff_h263_intra_MCBPC_code[9] = { 1, 1, 2, 3, 1, 1, 2, 3, 1 };
-const uint8_t ff_h263_intra_MCBPC_bits[9] = { 1, 3, 3, 3, 4, 6, 6, 6, 9 };
-
-/* inter MCBPC, mb_type = (inter), (intra), (interq), (intraq), (inter4v) */
-/* Changed the tables for interq and inter4v+q, following the standard ** Juanjo ** */
-const uint8_t ff_h263_inter_MCBPC_code[28] = {
-    1, 3, 2, 5,
-    3, 4, 3, 3,
-    3, 7, 6, 5,
-    4, 4, 3, 2,
-    2, 5, 4, 5,
-    1, 0, 0, 0, /* Stuffing */
-    2, 12, 14, 15,
-};
-const uint8_t ff_h263_inter_MCBPC_bits[28] = {
-    1, 4, 4, 6, /* inter  */
-    5, 8, 8, 7, /* intra  */
-    3, 7, 7, 9, /* interQ */
-    6, 9, 9, 9, /* intraQ */
-    3, 7, 7, 8, /* inter4 */
-    9, 0, 0, 0, /* Stuffing */
-    11, 13, 13, 13,/* inter4Q*/
-};
-
-const uint8_t h263_mbtype_b_tab[15][2] = {
- {1, 1},
- {3, 3},
- {1, 5},
- {4, 4},
- {5, 4},
- {6, 6},
- {2, 4},
- {3, 4},
- {7, 6},
- {4, 6},
- {5, 6},
- {1, 6},
- {1,10},
- {1, 7},
- {1, 8},
-};
-
-const uint8_t cbpc_b_tab[4][2] = {
-{0, 1},
-{2, 2},
-{7, 3},
-{6, 3},
-};
-
-const uint8_t ff_h263_cbpy_tab[16][2] =
-{
-  {3,4}, {5,5}, {4,5}, {9,4}, {3,5}, {7,4}, {2,6}, {11,4},
-  {2,5}, {3,6}, {5,4}, {10,4}, {4,4}, {8,4}, {6,4}, {3,2}
-};
-
-const uint8_t mvtab[33][2] =
-{
-  {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
-  {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10},
-  {12,10}, {11,10}, {10,10}, {9,10}, {8,10}, {7,10}, {6,10}, {5,10},
-  {4,10}, {7,11}, {6,11}, {5,11}, {4,11}, {3,11}, {2,11}, {3,12},
-  {2,12}
-};
-
-/* third non intra table */
-const uint16_t inter_vlc[103][2] = {
-{ 0x2, 2 },{ 0xf, 4 },{ 0x15, 6 },{ 0x17, 7 },
-{ 0x1f, 8 },{ 0x25, 9 },{ 0x24, 9 },{ 0x21, 10 },
-{ 0x20, 10 },{ 0x7, 11 },{ 0x6, 11 },{ 0x20, 11 },
-{ 0x6, 3 },{ 0x14, 6 },{ 0x1e, 8 },{ 0xf, 10 },
-{ 0x21, 11 },{ 0x50, 12 },{ 0xe, 4 },{ 0x1d, 8 },
-{ 0xe, 10 },{ 0x51, 12 },{ 0xd, 5 },{ 0x23, 9 },
-{ 0xd, 10 },{ 0xc, 5 },{ 0x22, 9 },{ 0x52, 12 },
-{ 0xb, 5 },{ 0xc, 10 },{ 0x53, 12 },{ 0x13, 6 },
-{ 0xb, 10 },{ 0x54, 12 },{ 0x12, 6 },{ 0xa, 10 },
-{ 0x11, 6 },{ 0x9, 10 },{ 0x10, 6 },{ 0x8, 10 },
-{ 0x16, 7 },{ 0x55, 12 },{ 0x15, 7 },{ 0x14, 7 },
-{ 0x1c, 8 },{ 0x1b, 8 },{ 0x21, 9 },{ 0x20, 9 },
-{ 0x1f, 9 },{ 0x1e, 9 },{ 0x1d, 9 },{ 0x1c, 9 },
-{ 0x1b, 9 },{ 0x1a, 9 },{ 0x22, 11 },{ 0x23, 11 },
-{ 0x56, 12 },{ 0x57, 12 },{ 0x7, 4 },{ 0x19, 9 },
-{ 0x5, 11 },{ 0xf, 6 },{ 0x4, 11 },{ 0xe, 6 },
-{ 0xd, 6 },{ 0xc, 6 },{ 0x13, 7 },{ 0x12, 7 },
-{ 0x11, 7 },{ 0x10, 7 },{ 0x1a, 8 },{ 0x19, 8 },
-{ 0x18, 8 },{ 0x17, 8 },{ 0x16, 8 },{ 0x15, 8 },
-{ 0x14, 8 },{ 0x13, 8 },{ 0x18, 9 },{ 0x17, 9 },
-{ 0x16, 9 },{ 0x15, 9 },{ 0x14, 9 },{ 0x13, 9 },
-{ 0x12, 9 },{ 0x11, 9 },{ 0x7, 10 },{ 0x6, 10 },
-{ 0x5, 10 },{ 0x4, 10 },{ 0x24, 11 },{ 0x25, 11 },
-{ 0x26, 11 },{ 0x27, 11 },{ 0x58, 12 },{ 0x59, 12 },
-{ 0x5a, 12 },{ 0x5b, 12 },{ 0x5c, 12 },{ 0x5d, 12 },
-{ 0x5e, 12 },{ 0x5f, 12 },{ 0x3, 7 },
-};
-
-const int8_t inter_level[102] = {
-  1,  2,  3,  4,  5,  6,  7,  8,
-  9, 10, 11, 12,  1,  2,  3,  4,
-  5,  6,  1,  2,  3,  4,  1,  2,
-  3,  1,  2,  3,  1,  2,  3,  1,
-  2,  3,  1,  2,  1,  2,  1,  2,
-  1,  2,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  2,  3,  1,  2,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,
-};
-
-const int8_t inter_run[102] = {
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  1,  1,  1,
-  1,  1,  2,  2,  2,  2,  3,  3,
-  3,  4,  4,  4,  5,  5,  5,  6,
-  6,  6,  7,  7,  8,  8,  9,  9,
- 10, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26,  0,  0,  0,  1,  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,
-};
-
-RLTable ff_h263_rl_inter = {
-    102,
-    58,
-    inter_vlc,
-    inter_run,
-    inter_level,
-};
-
-static const uint16_t intra_vlc_aic[103][2] = {
-{  0x2,  2 }, {  0x6,  3 }, {  0xe,  4 }, {  0xc,  5 },
-{  0xd,  5 }, { 0x10,  6 }, { 0x11,  6 }, { 0x12,  6 },
-{ 0x16,  7 }, { 0x1b,  8 }, { 0x20,  9 }, { 0x21,  9 },
-{ 0x1a,  9 }, { 0x1b,  9 }, { 0x1c,  9 }, { 0x1d,  9 },
-{ 0x1e,  9 }, { 0x1f,  9 }, { 0x23, 11 }, { 0x22, 11 },
-{ 0x57, 12 }, { 0x56, 12 }, { 0x55, 12 }, { 0x54, 12 },
-{ 0x53, 12 }, {  0xf,  4 }, { 0x14,  6 }, { 0x14,  7 },
-{ 0x1e,  8 }, {  0xf, 10 }, { 0x21, 11 }, { 0x50, 12 },
-{  0xb,  5 }, { 0x15,  7 }, {  0xe, 10 }, {  0x9, 10 },
-{ 0x15,  6 }, { 0x1d,  8 }, {  0xd, 10 }, { 0x51, 12 },
-{ 0x13,  6 }, { 0x23,  9 }, {  0x7, 11 }, { 0x17,  7 },
-{ 0x22,  9 }, { 0x52, 12 }, { 0x1c,  8 }, {  0xc, 10 },
-{ 0x1f,  8 }, {  0xb, 10 }, { 0x25,  9 }, {  0xa, 10 },
-{ 0x24,  9 }, {  0x6, 11 }, { 0x21, 10 }, { 0x20, 10 },
-{  0x8, 10 }, { 0x20, 11 }, {  0x7,  4 }, {  0xc,  6 },
-{ 0x10,  7 }, { 0x13,  8 }, { 0x11,  9 }, { 0x12,  9 },
-{  0x4, 10 }, { 0x27, 11 }, { 0x26, 11 }, { 0x5f, 12 },
-{  0xf,  6 }, { 0x13,  9 }, {  0x5, 10 }, { 0x25, 11 },
-{  0xe,  6 }, { 0x14,  9 }, { 0x24, 11 }, {  0xd,  6 },
-{  0x6, 10 }, { 0x5e, 12 }, { 0x11,  7 }, {  0x7, 10 },
-{ 0x13,  7 }, { 0x5d, 12 }, { 0x12,  7 }, { 0x5c, 12 },
-{ 0x14,  8 }, { 0x5b, 12 }, { 0x15,  8 }, { 0x1a,  8 },
-{ 0x19,  8 }, { 0x18,  8 }, { 0x17,  8 }, { 0x16,  8 },
-{ 0x19,  9 }, { 0x15,  9 }, { 0x16,  9 }, { 0x18,  9 },
-{ 0x17,  9 }, {  0x4, 11 }, {  0x5, 11 }, { 0x58, 12 },
-{ 0x59, 12 }, { 0x5a, 12 }, {  0x3,  7 },
-};
-
-static const int8_t intra_run_aic[102] = {
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  1,  1,  1,  1,  1,  1,  1,
- 2,  2,  2,  2,  3,  3,  3,  3,
- 4,  4,  4,  5,  5,  5,  6,  6,
- 7,  7,  8,  8,  9,  9, 10, 11,
-12, 13,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  0,  1,  1,  1,  1,
- 2,  2,  2,  3,  3,  3,  4,  4,
- 5,  5,  6,  6,  7,  7,  8,  9,
-10, 11, 12, 13, 14, 15, 16, 17,
-18, 19, 20, 21, 22, 23,
-};
-
-static const int8_t intra_level_aic[102] = {
- 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,  1,  2,  3,  4,  5,  6,  7,
- 1,  2,  3,  4,  1,  2,  3,  4,
- 1,  2,  3,  1,  2,  3,  1,  2,
- 1,  2,  1,  2,  1,  2,  1,  1,
- 1,  1,  1,  2,  3,  4,  5,  6,
- 7,  8,  9, 10,  1,  2,  3,  4,
- 1,  2,  3,  1,  2,  3,  1,  2,
- 1,  2,  1,  2,  1,  2,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,
-};
-
-RLTable rl_intra_aic = {
-    102,
-    58,
-    intra_vlc_aic,
-    intra_run_aic,
-    intra_level_aic,
-};
-
-const uint16_t h263_format[8][2] = {
-    { 0, 0 },
-    { 128, 96 },
-    { 176, 144 },
-    { 352, 288 },
-    { 704, 576 },
-    { 1408, 1152 },
-};
-
-const uint8_t ff_aic_dc_scale_table[32]={
-//  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
-    0, 2, 4, 6, 8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
-};
-
-const uint8_t modified_quant_tab[2][32]={
-//  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
-{
-    0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28
-},{
-    0, 2, 3, 4, 5, 6, 7, 8, 9,10,11,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,31,31,26
-}
-};
-
-const uint8_t ff_h263_chroma_qscale_table[32]={
-//  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
-    0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9,10,10,11,11,12,12,12,13,13,13,14,14,14,14,14,15,15,15,15,15
-};
-
-uint16_t ff_mba_max[6]={
-     47,  98, 395,1583,6335,9215
-};
-
-uint8_t ff_mba_length[7]={
-      6,   7,   9,  11,  13,  14,  14
-};
-
-const uint8_t ff_h263_loop_filter_strength[32]={
-//  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
-    0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12
-};
-
-const AVRational ff_h263_pixel_aspect[16]={
- {0, 1},
- {1, 1},
- {12, 11},
- {10, 11},
- {16, 11},
- {40, 33},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
- {0, 1},
-};
-
-#endif /* AVCODEC_H263DATA_H */
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
deleted file mode 100644
index c80cfcf..0000000
--- a/libavcodec/h263dec.c
+++ /dev/null
@@ -1,743 +0,0 @@
-/*
- * H.263 decoder
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.263 decoder.
- */
-
-#include "internal.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "h263_parser.h"
-#include "mpeg4video_parser.h"
-#include "msmpeg4.h"
-#include "vdpau_internal.h"
-#include "flv.h"
-#include "mpeg4video.h"
-
-//#define DEBUG
-//#define PRINT_FRAME_TIME
-
-av_cold int ff_h263_decode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->out_format = FMT_H263;
-
-    s->width  = avctx->coded_width;
-    s->height = avctx->coded_height;
-    s->workaround_bugs= avctx->workaround_bugs;
-
-    // set defaults
-    MPV_decode_defaults(s);
-    s->quant_precision=5;
-    s->decode_mb= ff_h263_decode_mb;
-    s->low_delay= 1;
-    avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts);
-    s->unrestricted_mv= 1;
-
-    /* select sub codec */
-    switch(avctx->codec->id) {
-    case CODEC_ID_H263:
-        s->unrestricted_mv= 0;
-        avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
-        break;
-    case CODEC_ID_MPEG4:
-        break;
-    case CODEC_ID_MSMPEG4V1:
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->msmpeg4_version=1;
-        break;
-    case CODEC_ID_MSMPEG4V2:
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->msmpeg4_version=2;
-        break;
-    case CODEC_ID_MSMPEG4V3:
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->msmpeg4_version=3;
-        break;
-    case CODEC_ID_WMV1:
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->msmpeg4_version=4;
-        break;
-    case CODEC_ID_WMV2:
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->msmpeg4_version=5;
-        break;
-    case CODEC_ID_VC1:
-    case CODEC_ID_WMV3:
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->msmpeg4_version=6;
-        avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
-        break;
-    case CODEC_ID_H263I:
-        break;
-    case CODEC_ID_FLV1:
-        s->h263_flv = 1;
-        break;
-    default:
-        return -1;
-    }
-    s->codec_id= avctx->codec->id;
-    avctx->hwaccel= ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
-
-    /* for h263, we allocate the images after having read the header */
-    if (avctx->codec->id != CODEC_ID_H263 && avctx->codec->id != CODEC_ID_MPEG4)
-        if (MPV_common_init(s) < 0)
-            return -1;
-
-        h263_decode_init_vlc(s);
-
-    return 0;
-}
-
-av_cold int ff_h263_decode_end(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    MPV_common_end(s);
-    return 0;
-}
-
-/**
- * returns the number of bytes consumed for building the current frame
- */
-static int get_consumed_bytes(MpegEncContext *s, int buf_size){
-    int pos= (get_bits_count(&s->gb)+7)>>3;
-
-    if(s->divx_packed || s->avctx->hwaccel){
-        //we would have to scan through the whole buf to handle the weird reordering ...
-        return buf_size;
-    }else if(s->flags&CODEC_FLAG_TRUNCATED){
-        pos -= s->parse_context.last_index;
-        if(pos<0) pos=0; // padding is not really read so this might be -1
-        return pos;
-    }else{
-        if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...)
-        if(pos+10>buf_size) pos=buf_size; // oops ;)
-
-        return pos;
-    }
-}
-
-static int decode_slice(MpegEncContext *s){
-    const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
-    const int mb_size= 16>>s->avctx->lowres;
-    s->last_resync_gb= s->gb;
-    s->first_slice_line= 1;
-
-    s->resync_mb_x= s->mb_x;
-    s->resync_mb_y= s->mb_y;
-
-    ff_set_qscale(s, s->qscale);
-
-    if (s->avctx->hwaccel) {
-        const uint8_t *start= s->gb.buffer + get_bits_count(&s->gb)/8;
-        const uint8_t *end  = ff_h263_find_resync_marker(start + 1, s->gb.buffer_end);
-        skip_bits_long(&s->gb, 8*(end - start));
-        return s->avctx->hwaccel->decode_slice(s->avctx, start, end - start);
-    }
-
-    if(s->partitioned_frame){
-        const int qscale= s->qscale;
-
-        if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4){
-            if(ff_mpeg4_decode_partitions(s) < 0)
-                return -1;
-        }
-
-        /* restore variables which were modified */
-        s->first_slice_line=1;
-        s->mb_x= s->resync_mb_x;
-        s->mb_y= s->resync_mb_y;
-        ff_set_qscale(s, qscale);
-    }
-
-    for(; s->mb_y < s->mb_height; s->mb_y++) {
-        /* per-row end of slice checks */
-        if(s->msmpeg4_version){
-            if(s->resync_mb_y + s->slice_height == s->mb_y){
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
-
-                return 0;
-            }
-        }
-
-        if(s->msmpeg4_version==1){
-            s->last_dc[0]=
-            s->last_dc[1]=
-            s->last_dc[2]= 128;
-        }
-
-        ff_init_block_index(s);
-        for(; s->mb_x < s->mb_width; s->mb_x++) {
-            int ret;
-
-            ff_update_block_index(s);
-
-            if(s->resync_mb_x == s->mb_x && s->resync_mb_y+1 == s->mb_y){
-                s->first_slice_line=0;
-            }
-
-            /* DCT & quantize */
-
-            s->mv_dir = MV_DIR_FORWARD;
-            s->mv_type = MV_TYPE_16X16;
-//            s->mb_skipped = 0;
-//printf("%d %d %06X\n", ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
-            ret= s->decode_mb(s, s->block);
-
-            if (s->pict_type!=FF_B_TYPE)
-                ff_h263_update_motion_val(s);
-
-            if(ret<0){
-                const int xy= s->mb_x + s->mb_y*s->mb_stride;
-                if(ret==SLICE_END){
-                    MPV_decode_mb(s, s->block);
-                    if(s->loop_filter)
-                        ff_h263_loop_filter(s);
-
-//printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24));
-                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-                    s->padding_bug_score--;
-
-                    if(++s->mb_x >= s->mb_width){
-                        s->mb_x=0;
-                        ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
-                        s->mb_y++;
-                    }
-                    return 0;
-                }else if(ret==SLICE_NOEND){
-                    av_log(s->avctx, AV_LOG_ERROR, "Slice mismatch at MB: %d\n", xy);
-                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x+1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-                    return -1;
-                }
-                av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
-
-                return -1;
-            }
-
-            MPV_decode_mb(s, s->block);
-            if(s->loop_filter)
-                ff_h263_loop_filter(s);
-        }
-
-        ff_draw_horiz_band(s, s->mb_y*mb_size, mb_size);
-
-        s->mb_x= 0;
-    }
-
-    assert(s->mb_x==0 && s->mb_y==s->mb_height);
-
-    /* try to detect the padding bug */
-    if(      s->codec_id==CODEC_ID_MPEG4
-       &&   (s->workaround_bugs&FF_BUG_AUTODETECT)
-       &&    get_bits_left(&s->gb) >=0
-       &&    get_bits_left(&s->gb) < 48
-//       &&   !s->resync_marker
-       &&   !s->data_partitioning){
-
-        const int bits_count= get_bits_count(&s->gb);
-        const int bits_left = s->gb.size_in_bits - bits_count;
-
-        if(bits_left==0){
-            s->padding_bug_score+=16;
-        } else if(bits_left != 1){
-            int v= show_bits(&s->gb, 8);
-            v|= 0x7F >> (7-(bits_count&7));
-
-            if(v==0x7F && bits_left<=8)
-                s->padding_bug_score--;
-            else if(v==0x7F && ((get_bits_count(&s->gb)+8)&8) && bits_left<=16)
-                s->padding_bug_score+= 4;
-            else
-                s->padding_bug_score++;
-        }
-    }
-
-    if(s->workaround_bugs&FF_BUG_AUTODETECT){
-        if(s->padding_bug_score > -2 && !s->data_partitioning /*&& (s->divx_version>=0 || !s->resync_marker)*/)
-            s->workaround_bugs |=  FF_BUG_NO_PADDING;
-        else
-            s->workaround_bugs &= ~FF_BUG_NO_PADDING;
-    }
-
-    // handle formats which don't have unique end markers
-    if(s->msmpeg4_version || (s->workaround_bugs&FF_BUG_NO_PADDING)){ //FIXME perhaps solve this more cleanly
-        int left= get_bits_left(&s->gb);
-        int max_extra=7;
-
-        /* no markers in M$ crap */
-        if(s->msmpeg4_version && s->pict_type==FF_I_TYPE)
-            max_extra+= 17;
-
-        /* buggy padding but the frame should still end approximately at the bitstream end */
-        if((s->workaround_bugs&FF_BUG_NO_PADDING) && s->error_recognition>=3)
-            max_extra+= 48;
-        else if((s->workaround_bugs&FF_BUG_NO_PADDING))
-            max_extra+= 256*256*256*64;
-
-        if(left>max_extra){
-            av_log(s->avctx, AV_LOG_ERROR, "discarding %d junk bits at end, next would be %X\n", left, show_bits(&s->gb, 24));
-        }
-        else if(left<0){
-            av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
-        }else
-            ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
-
-        return 0;
-    }
-
-    av_log(s->avctx, AV_LOG_ERROR, "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
-            get_bits_left(&s->gb),
-            show_bits(&s->gb, 24), s->padding_bug_score);
-
-    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-    return -1;
-}
-
-int ff_h263_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MpegEncContext *s = avctx->priv_data;
-    int ret;
-    AVFrame *pict = data;
-
-#ifdef PRINT_FRAME_TIME
-uint64_t time= rdtsc();
-#endif
-    s->flags= avctx->flags;
-    s->flags2= avctx->flags2;
-
-    /* no supplementary picture */
-    if (buf_size == 0) {
-        /* special case for last picture */
-        if (s->low_delay==0 && s->next_picture_ptr) {
-            *pict= *(AVFrame*)s->next_picture_ptr;
-            s->next_picture_ptr= NULL;
-
-            *data_size = sizeof(AVFrame);
-        }
-
-        return 0;
-    }
-
-    if(s->flags&CODEC_FLAG_TRUNCATED){
-        int next;
-
-        if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4){
-            next= ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size);
-        }else if(CONFIG_H263_DECODER && s->codec_id==CODEC_ID_H263){
-            next= ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
-        }else{
-            av_log(s->avctx, AV_LOG_ERROR, "this codec does not support truncated bitstreams\n");
-            return -1;
-        }
-
-        if( ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
-            return buf_size;
-    }
-
-
-retry:
-
-    if(s->bitstream_buffer_size && (s->divx_packed || buf_size<20)){ //divx 5.01+/xvid frame reorder
-        init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size*8);
-    }else
-        init_get_bits(&s->gb, buf, buf_size*8);
-    s->bitstream_buffer_size=0;
-
-    if (!s->context_initialized) {
-        if (MPV_common_init(s) < 0) //we need the idct permutaton for reading a custom matrix
-            return -1;
-    }
-
-    /* We need to set current_picture_ptr before reading the header,
-     * otherwise we cannot store anyting in there */
-    if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
-        int i= ff_find_unused_picture(s, 0);
-        s->current_picture_ptr= &s->picture[i];
-    }
-
-    /* let's go :-) */
-    if (CONFIG_WMV2_DECODER && s->msmpeg4_version==5) {
-        ret= ff_wmv2_decode_picture_header(s);
-    } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) {
-        ret = msmpeg4_decode_picture_header(s);
-    } else if (CONFIG_MPEG4_DECODER && s->h263_pred) {
-        if(s->avctx->extradata_size && s->picture_number==0){
-            GetBitContext gb;
-
-            init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);
-            ret = ff_mpeg4_decode_picture_header(s, &gb);
-        }
-        ret = ff_mpeg4_decode_picture_header(s, &s->gb);
-    } else if (CONFIG_H263I_DECODER && s->codec_id == CODEC_ID_H263I) {
-        ret = ff_intel_h263_decode_picture_header(s);
-    } else if (CONFIG_FLV_DECODER && s->h263_flv) {
-        ret = ff_flv_decode_picture_header(s);
-    } else {
-        ret = h263_decode_picture_header(s);
-    }
-
-    if(ret==FRAME_SKIPPED) return get_consumed_bytes(s, buf_size);
-
-    /* skip if the header was thrashed */
-    if (ret < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
-        return -1;
-    }
-
-    avctx->has_b_frames= !s->low_delay;
-
-    if(s->xvid_build==-1 && s->divx_version==-1 && s->lavc_build==-1){
-        if(s->stream_codec_tag == AV_RL32("XVID") ||
-           s->codec_tag == AV_RL32("XVID") || s->codec_tag == AV_RL32("XVIX") ||
-           s->codec_tag == AV_RL32("RMP4") ||
-           s->codec_tag == AV_RL32("SIPP")
-           )
-            s->xvid_build= 0;
-#if 0
-        if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==1
-           && s->padding_bug_score > 0 && s->low_delay) // XVID with modified fourcc
-            s->xvid_build= 0;
-#endif
-    }
-
-    if(s->xvid_build==-1 && s->divx_version==-1 && s->lavc_build==-1){
-        if(s->codec_tag == AV_RL32("DIVX") && s->vo_type==0 && s->vol_control_parameters==0)
-            s->divx_version= 400; //divx 4
-    }
-
-    if(s->xvid_build>=0 && s->divx_version>=0){
-        s->divx_version=
-        s->divx_build= -1;
-    }
-
-    if(s->workaround_bugs&FF_BUG_AUTODETECT){
-        if(s->codec_tag == AV_RL32("XVIX"))
-            s->workaround_bugs|= FF_BUG_XVID_ILACE;
-
-        if(s->codec_tag == AV_RL32("UMP4")){
-            s->workaround_bugs|= FF_BUG_UMP4;
-        }
-
-        if(s->divx_version>=500 && s->divx_build<1814){
-            s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
-        }
-
-        if(s->divx_version>502 && s->divx_build<1814){
-            s->workaround_bugs|= FF_BUG_QPEL_CHROMA2;
-        }
-
-        if(s->xvid_build<=3U)
-            s->padding_bug_score= 256*256*256*64;
-
-        if(s->xvid_build<=1U)
-            s->workaround_bugs|= FF_BUG_QPEL_CHROMA;
-
-        if(s->xvid_build<=12U)
-            s->workaround_bugs|= FF_BUG_EDGE;
-
-        if(s->xvid_build<=32U)
-            s->workaround_bugs|= FF_BUG_DC_CLIP;
-
-#define SET_QPEL_FUNC(postfix1, postfix2) \
-    s->dsp.put_ ## postfix1 = ff_put_ ## postfix2;\
-    s->dsp.put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2;\
-    s->dsp.avg_ ## postfix1 = ff_avg_ ## postfix2;
-
-        if(s->lavc_build<4653U)
-            s->workaround_bugs|= FF_BUG_STD_QPEL;
-
-        if(s->lavc_build<4655U)
-            s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE;
-
-        if(s->lavc_build<4670U){
-            s->workaround_bugs|= FF_BUG_EDGE;
-        }
-
-        if(s->lavc_build<=4712U)
-            s->workaround_bugs|= FF_BUG_DC_CLIP;
-
-        if(s->divx_version>=0)
-            s->workaround_bugs|= FF_BUG_DIRECT_BLOCKSIZE;
-//printf("padding_bug_score: %d\n", s->padding_bug_score);
-        if(s->divx_version==501 && s->divx_build==20020416)
-            s->padding_bug_score= 256*256*256*64;
-
-        if(s->divx_version<500U){
-            s->workaround_bugs|= FF_BUG_EDGE;
-        }
-
-        if(s->divx_version>=0)
-            s->workaround_bugs|= FF_BUG_HPEL_CHROMA;
-#if 0
-        if(s->divx_version==500)
-            s->padding_bug_score= 256*256*256*64;
-
-        /* very ugly XVID padding bug detection FIXME/XXX solve this differently
-         * Let us hope this at least works.
-         */
-        if(   s->resync_marker==0 && s->data_partitioning==0 && s->divx_version==-1
-           && s->codec_id==CODEC_ID_MPEG4 && s->vo_type==0)
-            s->workaround_bugs|= FF_BUG_NO_PADDING;
-
-        if(s->lavc_build<4609U) //FIXME not sure about the version num but a 4609 file seems ok
-            s->workaround_bugs|= FF_BUG_NO_PADDING;
-#endif
-    }
-
-    if(s->workaround_bugs& FF_BUG_STD_QPEL){
-        SET_QPEL_FUNC(qpel_pixels_tab[0][ 5], qpel16_mc11_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[0][ 7], qpel16_mc31_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[0][ 9], qpel16_mc12_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[0][11], qpel16_mc32_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[0][13], qpel16_mc13_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[0][15], qpel16_mc33_old_c)
-
-        SET_QPEL_FUNC(qpel_pixels_tab[1][ 5], qpel8_mc11_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[1][ 7], qpel8_mc31_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[1][ 9], qpel8_mc12_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[1][11], qpel8_mc32_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[1][13], qpel8_mc13_old_c)
-        SET_QPEL_FUNC(qpel_pixels_tab[1][15], qpel8_mc33_old_c)
-    }
-
-    if(avctx->debug & FF_DEBUG_BUGS)
-        av_log(s->avctx, AV_LOG_DEBUG, "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n",
-               s->workaround_bugs, s->lavc_build, s->xvid_build, s->divx_version, s->divx_build,
-               s->divx_packed ? "p" : "");
-
-#if 0 // dump bits per frame / qp / complexity
-{
-    static FILE *f=NULL;
-    if(!f) f=fopen("rate_qp_cplx.txt", "w");
-    fprintf(f, "%d %d %f\n", buf_size, s->qscale, buf_size*(double)s->qscale);
-}
-#endif
-
-#if HAVE_MMX
-    if(s->codec_id == CODEC_ID_MPEG4 && s->xvid_build>=0 && avctx->idct_algo == FF_IDCT_AUTO && (mm_flags & FF_MM_MMX)){
-        avctx->idct_algo= FF_IDCT_XVIDMMX;
-        avctx->coded_width= 0; // force reinit
-//        dsputil_init(&s->dsp, avctx);
-        s->picture_number=0;
-    }
-#endif
-
-        /* After H263 & mpeg4 header decode we have the height, width,*/
-        /* and other parameters. So then we could init the picture   */
-        /* FIXME: By the way H263 decoder is evolving it should have */
-        /* an H263EncContext                                         */
-
-    if (   s->width  != avctx->coded_width
-        || s->height != avctx->coded_height) {
-        /* H.263 could change picture size any time */
-        ParseContext pc= s->parse_context; //FIXME move these demuxng hack to avformat
-        s->parse_context.buffer=0;
-        MPV_common_end(s);
-        s->parse_context= pc;
-    }
-    if (!s->context_initialized) {
-        avcodec_set_dimensions(avctx, s->width, s->height);
-
-        goto retry;
-    }
-
-    if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I))
-        s->gob_index = ff_h263_get_gob_height(s);
-
-    // for hurry_up==5
-    s->current_picture.pict_type= s->pict_type;
-    s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
-
-    /* skip B-frames if we don't have reference frames */
-    if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
-    /* skip b frames if we are in a hurry */
-    if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
-    if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
-       || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
-       ||  avctx->skip_frame >= AVDISCARD_ALL)
-        return get_consumed_bytes(s, buf_size);
-    /* skip everything if we are in a hurry>=5 */
-    if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
-
-    if(s->next_p_frame_damaged){
-        if(s->pict_type==FF_B_TYPE)
-            return get_consumed_bytes(s, buf_size);
-        else
-            s->next_p_frame_damaged=0;
-    }
-
-    if((s->avctx->flags2 & CODEC_FLAG2_FAST) && s->pict_type==FF_B_TYPE){
-        s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab;
-        s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab;
-    }else if((!s->no_rounding) || s->pict_type==FF_B_TYPE){
-        s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
-        s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
-    }else{
-        s->me.qpel_put= s->dsp.put_no_rnd_qpel_pixels_tab;
-        s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
-    }
-
-    if(MPV_frame_start(s, avctx) < 0)
-        return -1;
-
-    if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) {
-        ff_vdpau_mpeg4_decode_picture(s, s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
-        goto frame_end;
-    }
-
-    if (avctx->hwaccel) {
-        if (avctx->hwaccel->start_frame(avctx, s->gb.buffer, s->gb.buffer_end - s->gb.buffer) < 0)
-            return -1;
-    }
-
-    ff_er_frame_start(s);
-
-    //the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type
-    //which is not available before MPV_frame_start()
-    if (CONFIG_WMV2_DECODER && s->msmpeg4_version==5){
-        ret = ff_wmv2_decode_secondary_picture_header(s);
-        if(ret<0) return ret;
-        if(ret==1) goto intrax8_decoded;
-    }
-
-    /* decode each macroblock */
-    s->mb_x=0;
-    s->mb_y=0;
-
-    decode_slice(s);
-    while(s->mb_y<s->mb_height){
-        if(s->msmpeg4_version){
-            if(s->slice_height==0 || s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
-                break;
-        }else{
-            if(ff_h263_resync(s)<0)
-                break;
-        }
-
-        if(s->msmpeg4_version<4 && s->h263_pred)
-            ff_mpeg4_clean_buffers(s);
-
-        decode_slice(s);
-    }
-
-    if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==FF_I_TYPE)
-        if(!CONFIG_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){
-            s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR;
-        }
-
-    assert(s->bitstream_buffer_size==0);
-frame_end:
-    /* divx 5.01+ bistream reorder stuff */
-    if(s->codec_id==CODEC_ID_MPEG4 && s->divx_packed){
-        int current_pos= get_bits_count(&s->gb)>>3;
-        int startcode_found=0;
-
-        if(buf_size - current_pos > 5){
-            int i;
-            for(i=current_pos; i<buf_size-3; i++){
-                if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){
-                    startcode_found=1;
-                    break;
-                }
-            }
-        }
-        if(s->gb.buffer == s->bitstream_buffer && buf_size>7 && s->xvid_build>=0){ //xvid style
-            startcode_found=1;
-            current_pos=0;
-        }
-
-        if(startcode_found){
-            av_fast_malloc(
-                &s->bitstream_buffer,
-                &s->allocated_bitstream_buffer_size,
-                buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (!s->bitstream_buffer)
-                return AVERROR(ENOMEM);
-            memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);
-            s->bitstream_buffer_size= buf_size - current_pos;
-        }
-    }
-
-intrax8_decoded:
-    ff_er_frame_end(s);
-
-    if (avctx->hwaccel) {
-        if (avctx->hwaccel->end_frame(avctx) < 0)
-            return -1;
-    }
-
-    MPV_frame_end(s);
-
-assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
-assert(s->current_picture.pict_type == s->pict_type);
-    if (s->pict_type == FF_B_TYPE || s->low_delay) {
-        *pict= *(AVFrame*)s->current_picture_ptr;
-    } else if (s->last_picture_ptr != NULL) {
-        *pict= *(AVFrame*)s->last_picture_ptr;
-    }
-
-    if(s->last_picture_ptr || s->low_delay){
-        *data_size = sizeof(AVFrame);
-        ff_print_debug_info(s, pict);
-    }
-
-#ifdef PRINT_FRAME_TIME
-av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
-#endif
-
-    return get_consumed_bytes(s, buf_size);
-}
-
-AVCodec h263_decoder = {
-    "h263",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H263,
-    sizeof(MpegEncContext),
-    ff_h263_decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
-    .flush= ff_mpeg_flush,
-    .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
-    .pix_fmts= ff_hwaccel_pixfmt_list_420,
-};
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
deleted file mode 100644
index e4654f0..0000000
--- a/libavcodec/h264.c
+++ /dev/null
@@ -1,3392 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 codec.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h264.h"
-#include "h264data.h"
-#include "h264_mvpred.h"
-#include "h264_parser.h"
-#include "golomb.h"
-#include "mathops.h"
-#include "rectangle.h"
-#include "vdpau_internal.h"
-
-#include "cabac.h"
-
-//#undef NDEBUG
-#include <assert.h>
-
-static const uint8_t rem6[52]={
-0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
-};
-
-static const uint8_t div6[52]={
-0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
-};
-
-void ff_h264_write_back_intra_pred_mode(H264Context *h){
-    int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy];
-
-    AV_COPY32(mode, h->intra4x4_pred_mode_cache + 4 + 8*4);
-    mode[4]= h->intra4x4_pred_mode_cache[7+8*3];
-    mode[5]= h->intra4x4_pred_mode_cache[7+8*2];
-    mode[6]= h->intra4x4_pred_mode_cache[7+8*1];
-}
-
-/**
- * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
- */
-int ff_h264_check_intra4x4_pred_mode(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    static const int8_t top [12]= {-1, 0,LEFT_DC_PRED,-1,-1,-1,-1,-1, 0};
-    static const int8_t left[12]= { 0,-1, TOP_DC_PRED, 0,-1,-1,-1, 0,-1,DC_128_PRED};
-    int i;
-
-    if(!(h->top_samples_available&0x8000)){
-        for(i=0; i<4; i++){
-            int status= top[ h->intra4x4_pred_mode_cache[scan8[0] + i] ];
-            if(status<0){
-                av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
-                return -1;
-            } else if(status){
-                h->intra4x4_pred_mode_cache[scan8[0] + i]= status;
-            }
-        }
-    }
-
-    if((h->left_samples_available&0x8888)!=0x8888){
-        static const int mask[4]={0x8000,0x2000,0x80,0x20};
-        for(i=0; i<4; i++){
-            if(!(h->left_samples_available&mask[i])){
-                int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ];
-                if(status<0){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
-                    return -1;
-                } else if(status){
-                    h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status;
-                }
-            }
-        }
-    }
-
-    return 0;
-} //FIXME cleanup like ff_h264_check_intra_pred_mode
-
-/**
- * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
- */
-int ff_h264_check_intra_pred_mode(H264Context *h, int mode){
-    MpegEncContext * const s = &h->s;
-    static const int8_t top [7]= {LEFT_DC_PRED8x8, 1,-1,-1};
-    static const int8_t left[7]= { TOP_DC_PRED8x8,-1, 2,-1,DC_128_PRED8x8};
-
-    if(mode > 6U) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "out of range intra chroma pred mode at %d %d\n", s->mb_x, s->mb_y);
-        return -1;
-    }
-
-    if(!(h->top_samples_available&0x8000)){
-        mode= top[ mode ];
-        if(mode<0){
-            av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-    }
-
-    if((h->left_samples_available&0x8080) != 0x8080){
-        mode= left[ mode ];
-        if(h->left_samples_available&0x8080){ //mad cow disease mode, aka MBAFF + constrained_intra_pred
-            mode= ALZHEIMER_DC_L0T_PRED8x8 + (!(h->left_samples_available&0x8000)) + 2*(mode == DC_128_PRED8x8);
-        }
-        if(mode<0){
-            av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra mode at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-    }
-
-    return mode;
-}
-
-const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
-    int i, si, di;
-    uint8_t *dst;
-    int bufidx;
-
-//    src[0]&0x80;                //forbidden bit
-    h->nal_ref_idc= src[0]>>5;
-    h->nal_unit_type= src[0]&0x1F;
-
-    src++; length--;
-#if 0
-    for(i=0; i<length; i++)
-        printf("%2X ", src[i]);
-#endif
-
-#if HAVE_FAST_UNALIGNED
-# if HAVE_FAST_64BIT
-#   define RS 7
-    for(i=0; i+1<length; i+=9){
-        if(!((~AV_RN64A(src+i) & (AV_RN64A(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
-# else
-#   define RS 3
-    for(i=0; i+1<length; i+=5){
-        if(!((~AV_RN32A(src+i) & (AV_RN32A(src+i) - 0x01000101U)) & 0x80008080U))
-# endif
-            continue;
-        if(i>0 && !src[i]) i--;
-        while(src[i]) i++;
-#else
-#   define RS 0
-    for(i=0; i+1<length; i+=2){
-        if(src[i]) continue;
-        if(i>0 && src[i-1]==0) i--;
-#endif
-        if(i+2<length && src[i+1]==0 && src[i+2]<=3){
-            if(src[i+2]!=3){
-                /* startcode, so we must be past the end */
-                length=i;
-            }
-            break;
-        }
-        i-= RS;
-    }
-
-    if(i>=length-1){ //no escaped 0
-        *dst_length= length;
-        *consumed= length+1; //+1 for the header
-        return src;
-    }
-
-    bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; // use second escape buffer for inter data
-    av_fast_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE);
-    dst= h->rbsp_buffer[bufidx];
-
-    if (dst == NULL){
-        return NULL;
-    }
-
-//printf("decoding esc\n");
-    memcpy(dst, src, i);
-    si=di=i;
-    while(si+2<length){
-        //remove escapes (very rare 1:2^22)
-        if(src[si+2]>3){
-            dst[di++]= src[si++];
-            dst[di++]= src[si++];
-        }else if(src[si]==0 && src[si+1]==0){
-            if(src[si+2]==3){ //escape
-                dst[di++]= 0;
-                dst[di++]= 0;
-                si+=3;
-                continue;
-            }else //next start code
-                goto nsc;
-        }
-
-        dst[di++]= src[si++];
-    }
-    while(si<length)
-        dst[di++]= src[si++];
-nsc:
-
-    memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
-    *dst_length= di;
-    *consumed= si + 1;//+1 for the header
-//FIXME store exact number of bits in the getbitcontext (it is needed for decoding)
-    return dst;
-}
-
-int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){
-    int v= *src;
-    int r;
-
-    tprintf(h->s.avctx, "rbsp trailing %X\n", v);
-
-    for(r=1; r<9; r++){
-        if(v&1) return r;
-        v>>=1;
-    }
-    return 0;
-}
-
-/**
- * IDCT transforms the 16 dc values and dequantizes them.
- * @param qp quantization parameter
- */
-static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){
-#define stride 16
-    int i;
-    int temp[16]; //FIXME check if this is a good idea
-    static const int x_offset[4]={0, 1*stride, 4* stride,  5*stride};
-    static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride};
-
-//memset(block, 64, 2*256);
-//return;
-    for(i=0; i<4; i++){
-        const int offset= y_offset[i];
-        const int z0= block[offset+stride*0] + block[offset+stride*4];
-        const int z1= block[offset+stride*0] - block[offset+stride*4];
-        const int z2= block[offset+stride*1] - block[offset+stride*5];
-        const int z3= block[offset+stride*1] + block[offset+stride*5];
-
-        temp[4*i+0]= z0+z3;
-        temp[4*i+1]= z1+z2;
-        temp[4*i+2]= z1-z2;
-        temp[4*i+3]= z0-z3;
-    }
-
-    for(i=0; i<4; i++){
-        const int offset= x_offset[i];
-        const int z0= temp[4*0+i] + temp[4*2+i];
-        const int z1= temp[4*0+i] - temp[4*2+i];
-        const int z2= temp[4*1+i] - temp[4*3+i];
-        const int z3= temp[4*1+i] + temp[4*3+i];
-
-        block[stride*0 +offset]= ((((z0 + z3)*qmul + 128 ) >> 8)); //FIXME think about merging this into decode_residual
-        block[stride*2 +offset]= ((((z1 + z2)*qmul + 128 ) >> 8));
-        block[stride*8 +offset]= ((((z1 - z2)*qmul + 128 ) >> 8));
-        block[stride*10+offset]= ((((z0 - z3)*qmul + 128 ) >> 8));
-    }
-}
-
-#if 0
-/**
- * DCT transforms the 16 dc values.
- * @param qp quantization parameter ??? FIXME
- */
-static void h264_luma_dc_dct_c(DCTELEM *block/*, int qp*/){
-//    const int qmul= dequant_coeff[qp][0];
-    int i;
-    int temp[16]; //FIXME check if this is a good idea
-    static const int x_offset[4]={0, 1*stride, 4* stride,  5*stride};
-    static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride};
-
-    for(i=0; i<4; i++){
-        const int offset= y_offset[i];
-        const int z0= block[offset+stride*0] + block[offset+stride*4];
-        const int z1= block[offset+stride*0] - block[offset+stride*4];
-        const int z2= block[offset+stride*1] - block[offset+stride*5];
-        const int z3= block[offset+stride*1] + block[offset+stride*5];
-
-        temp[4*i+0]= z0+z3;
-        temp[4*i+1]= z1+z2;
-        temp[4*i+2]= z1-z2;
-        temp[4*i+3]= z0-z3;
-    }
-
-    for(i=0; i<4; i++){
-        const int offset= x_offset[i];
-        const int z0= temp[4*0+i] + temp[4*2+i];
-        const int z1= temp[4*0+i] - temp[4*2+i];
-        const int z2= temp[4*1+i] - temp[4*3+i];
-        const int z3= temp[4*1+i] + temp[4*3+i];
-
-        block[stride*0 +offset]= (z0 + z3)>>1;
-        block[stride*2 +offset]= (z1 + z2)>>1;
-        block[stride*8 +offset]= (z1 - z2)>>1;
-        block[stride*10+offset]= (z0 - z3)>>1;
-    }
-}
-#endif
-
-#undef xStride
-#undef stride
-
-static void chroma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){
-    const int stride= 16*2;
-    const int xStride= 16;
-    int a,b,c,d,e;
-
-    a= block[stride*0 + xStride*0];
-    b= block[stride*0 + xStride*1];
-    c= block[stride*1 + xStride*0];
-    d= block[stride*1 + xStride*1];
-
-    e= a-b;
-    a= a+b;
-    b= c-d;
-    c= c+d;
-
-    block[stride*0 + xStride*0]= ((a+c)*qmul) >> 7;
-    block[stride*0 + xStride*1]= ((e+b)*qmul) >> 7;
-    block[stride*1 + xStride*0]= ((a-c)*qmul) >> 7;
-    block[stride*1 + xStride*1]= ((e-b)*qmul) >> 7;
-}
-
-#if 0
-static void chroma_dc_dct_c(DCTELEM *block){
-    const int stride= 16*2;
-    const int xStride= 16;
-    int a,b,c,d,e;
-
-    a= block[stride*0 + xStride*0];
-    b= block[stride*0 + xStride*1];
-    c= block[stride*1 + xStride*0];
-    d= block[stride*1 + xStride*1];
-
-    e= a-b;
-    a= a+b;
-    b= c-d;
-    c= c+d;
-
-    block[stride*0 + xStride*0]= (a+c);
-    block[stride*0 + xStride*1]= (e+b);
-    block[stride*1 + xStride*0]= (a-c);
-    block[stride*1 + xStride*1]= (e-b);
-}
-#endif
-
-static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, int chroma_height, int delta, int list,
-                           uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                           int src_x_offset, int src_y_offset,
-                           qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op){
-    MpegEncContext * const s = &h->s;
-    const int mx= h->mv_cache[list][ scan8[n] ][0] + src_x_offset*8;
-    int my=       h->mv_cache[list][ scan8[n] ][1] + src_y_offset*8;
-    const int luma_xy= (mx&3) + ((my&3)<<2);
-    uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->mb_linesize;
-    uint8_t * src_cb, * src_cr;
-    int extra_width= h->emu_edge_width;
-    int extra_height= h->emu_edge_height;
-    int emu=0;
-    const int full_mx= mx>>2;
-    const int full_my= my>>2;
-    const int pic_width  = 16*s->mb_width;
-    const int pic_height = 16*s->mb_height >> MB_FIELD;
-
-    if(mx&7) extra_width -= 3;
-    if(my&7) extra_height -= 3;
-
-    if(   full_mx < 0-extra_width
-       || full_my < 0-extra_height
-       || full_mx + 16/*FIXME*/ > pic_width + extra_width
-       || full_my + 16/*FIXME*/ > pic_height + extra_height){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
-            src_y= s->edge_emu_buffer + 2 + 2*h->mb_linesize;
-        emu=1;
-    }
-
-    qpix_op[luma_xy](dest_y, src_y, h->mb_linesize); //FIXME try variable height perhaps?
-    if(!square){
-        qpix_op[luma_xy](dest_y + delta, src_y + delta, h->mb_linesize);
-    }
-
-    if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
-
-    if(MB_FIELD){
-        // chroma offset when predicting from a field of opposite parity
-        my += 2 * ((s->mb_y & 1) - (pic->reference - 1));
-        emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1);
-    }
-    src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->mb_uvlinesize;
-    src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize;
-
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
-            src_cb= s->edge_emu_buffer;
-    }
-    chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx&7, my&7);
-
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
-            src_cr= s->edge_emu_buffer;
-    }
-    chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx&7, my&7);
-}
-
-static inline void mc_part_std(H264Context *h, int n, int square, int chroma_height, int delta,
-                           uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                           int x_offset, int y_offset,
-                           qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
-                           qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg,
-                           int list0, int list1){
-    MpegEncContext * const s = &h->s;
-    qpel_mc_func *qpix_op=  qpix_put;
-    h264_chroma_mc_func chroma_op= chroma_put;
-
-    dest_y  += 2*x_offset + 2*y_offset*h->  mb_linesize;
-    dest_cb +=   x_offset +   y_offset*h->mb_uvlinesize;
-    dest_cr +=   x_offset +   y_offset*h->mb_uvlinesize;
-    x_offset += 8*s->mb_x;
-    y_offset += 8*(s->mb_y >> MB_FIELD);
-
-    if(list0){
-        Picture *ref= &h->ref_list[0][ h->ref_cache[0][ scan8[n] ] ];
-        mc_dir_part(h, ref, n, square, chroma_height, delta, 0,
-                           dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                           qpix_op, chroma_op);
-
-        qpix_op=  qpix_avg;
-        chroma_op= chroma_avg;
-    }
-
-    if(list1){
-        Picture *ref= &h->ref_list[1][ h->ref_cache[1][ scan8[n] ] ];
-        mc_dir_part(h, ref, n, square, chroma_height, delta, 1,
-                           dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                           qpix_op, chroma_op);
-    }
-}
-
-static inline void mc_part_weighted(H264Context *h, int n, int square, int chroma_height, int delta,
-                           uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                           int x_offset, int y_offset,
-                           qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
-                           h264_weight_func luma_weight_op, h264_weight_func chroma_weight_op,
-                           h264_biweight_func luma_weight_avg, h264_biweight_func chroma_weight_avg,
-                           int list0, int list1){
-    MpegEncContext * const s = &h->s;
-
-    dest_y  += 2*x_offset + 2*y_offset*h->  mb_linesize;
-    dest_cb +=   x_offset +   y_offset*h->mb_uvlinesize;
-    dest_cr +=   x_offset +   y_offset*h->mb_uvlinesize;
-    x_offset += 8*s->mb_x;
-    y_offset += 8*(s->mb_y >> MB_FIELD);
-
-    if(list0 && list1){
-        /* don't optimize for luma-only case, since B-frames usually
-         * use implicit weights => chroma too. */
-        uint8_t *tmp_cb = s->obmc_scratchpad;
-        uint8_t *tmp_cr = s->obmc_scratchpad + 8;
-        uint8_t *tmp_y  = s->obmc_scratchpad + 8*h->mb_uvlinesize;
-        int refn0 = h->ref_cache[0][ scan8[n] ];
-        int refn1 = h->ref_cache[1][ scan8[n] ];
-
-        mc_dir_part(h, &h->ref_list[0][refn0], n, square, chroma_height, delta, 0,
-                    dest_y, dest_cb, dest_cr,
-                    x_offset, y_offset, qpix_put, chroma_put);
-        mc_dir_part(h, &h->ref_list[1][refn1], n, square, chroma_height, delta, 1,
-                    tmp_y, tmp_cb, tmp_cr,
-                    x_offset, y_offset, qpix_put, chroma_put);
-
-        if(h->use_weight == 2){
-            int weight0 = h->implicit_weight[refn0][refn1][s->mb_y&1];
-            int weight1 = 64 - weight0;
-            luma_weight_avg(  dest_y,  tmp_y,  h->  mb_linesize, 5, weight0, weight1, 0);
-            chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, 5, weight0, weight1, 0);
-            chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, 5, weight0, weight1, 0);
-        }else{
-            luma_weight_avg(dest_y, tmp_y, h->mb_linesize, h->luma_log2_weight_denom,
-                            h->luma_weight[refn0][0][0] , h->luma_weight[refn1][1][0],
-                            h->luma_weight[refn0][0][1] + h->luma_weight[refn1][1][1]);
-            chroma_weight_avg(dest_cb, tmp_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom,
-                            h->chroma_weight[refn0][0][0][0] , h->chroma_weight[refn1][1][0][0],
-                            h->chroma_weight[refn0][0][0][1] + h->chroma_weight[refn1][1][0][1]);
-            chroma_weight_avg(dest_cr, tmp_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom,
-                            h->chroma_weight[refn0][0][1][0] , h->chroma_weight[refn1][1][1][0],
-                            h->chroma_weight[refn0][0][1][1] + h->chroma_weight[refn1][1][1][1]);
-        }
-    }else{
-        int list = list1 ? 1 : 0;
-        int refn = h->ref_cache[list][ scan8[n] ];
-        Picture *ref= &h->ref_list[list][refn];
-        mc_dir_part(h, ref, n, square, chroma_height, delta, list,
-                    dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                    qpix_put, chroma_put);
-
-        luma_weight_op(dest_y, h->mb_linesize, h->luma_log2_weight_denom,
-                       h->luma_weight[refn][list][0], h->luma_weight[refn][list][1]);
-        if(h->use_weight_chroma){
-            chroma_weight_op(dest_cb, h->mb_uvlinesize, h->chroma_log2_weight_denom,
-                             h->chroma_weight[refn][list][0][0], h->chroma_weight[refn][list][0][1]);
-            chroma_weight_op(dest_cr, h->mb_uvlinesize, h->chroma_log2_weight_denom,
-                             h->chroma_weight[refn][list][1][0], h->chroma_weight[refn][list][1][1]);
-        }
-    }
-}
-
-static inline void mc_part(H264Context *h, int n, int square, int chroma_height, int delta,
-                           uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                           int x_offset, int y_offset,
-                           qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
-                           qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg,
-                           h264_weight_func *weight_op, h264_biweight_func *weight_avg,
-                           int list0, int list1){
-    if((h->use_weight==2 && list0 && list1
-        && (h->implicit_weight[ h->ref_cache[0][scan8[n]] ][ h->ref_cache[1][scan8[n]] ][h->s.mb_y&1] != 32))
-       || h->use_weight==1)
-        mc_part_weighted(h, n, square, chroma_height, delta, dest_y, dest_cb, dest_cr,
-                         x_offset, y_offset, qpix_put, chroma_put,
-                         weight_op[0], weight_op[3], weight_avg[0], weight_avg[3], list0, list1);
-    else
-        mc_part_std(h, n, square, chroma_height, delta, dest_y, dest_cb, dest_cr,
-                    x_offset, y_offset, qpix_put, chroma_put, qpix_avg, chroma_avg, list0, list1);
-}
-
-static inline void prefetch_motion(H264Context *h, int list){
-    /* fetch pixels for estimated mv 4 macroblocks ahead
-     * optimized for 64byte cache lines */
-    MpegEncContext * const s = &h->s;
-    const int refn = h->ref_cache[list][scan8[0]];
-    if(refn >= 0){
-        const int mx= (h->mv_cache[list][scan8[0]][0]>>2) + 16*s->mb_x + 8;
-        const int my= (h->mv_cache[list][scan8[0]][1]>>2) + 16*s->mb_y;
-        uint8_t **src= h->ref_list[list][refn].data;
-        int off= mx + (my + (s->mb_x&3)*4)*h->mb_linesize + 64;
-        s->dsp.prefetch(src[0]+off, s->linesize, 4);
-        off= (mx>>1) + ((my>>1) + (s->mb_x&7))*s->uvlinesize + 64;
-        s->dsp.prefetch(src[1]+off, src[2]-src[1], 2);
-    }
-}
-
-static void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                      qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),
-                      qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg),
-                      h264_weight_func *weight_op, h264_biweight_func *weight_avg){
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= h->mb_xy;
-    const int mb_type= s->current_picture.mb_type[mb_xy];
-
-    assert(IS_INTER(mb_type));
-
-    prefetch_motion(h, 0);
-
-    if(IS_16X16(mb_type)){
-        mc_part(h, 0, 1, 8, 0, dest_y, dest_cb, dest_cr, 0, 0,
-                qpix_put[0], chroma_put[0], qpix_avg[0], chroma_avg[0],
-                weight_op, weight_avg,
-                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
-    }else if(IS_16X8(mb_type)){
-        mc_part(h, 0, 0, 4, 8, dest_y, dest_cb, dest_cr, 0, 0,
-                qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
-                &weight_op[1], &weight_avg[1],
-                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
-        mc_part(h, 8, 0, 4, 8, dest_y, dest_cb, dest_cr, 0, 4,
-                qpix_put[1], chroma_put[0], qpix_avg[1], chroma_avg[0],
-                &weight_op[1], &weight_avg[1],
-                IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
-    }else if(IS_8X16(mb_type)){
-        mc_part(h, 0, 0, 8, 8*h->mb_linesize, dest_y, dest_cb, dest_cr, 0, 0,
-                qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
-                &weight_op[2], &weight_avg[2],
-                IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1));
-        mc_part(h, 4, 0, 8, 8*h->mb_linesize, dest_y, dest_cb, dest_cr, 4, 0,
-                qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
-                &weight_op[2], &weight_avg[2],
-                IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1));
-    }else{
-        int i;
-
-        assert(IS_8X8(mb_type));
-
-        for(i=0; i<4; i++){
-            const int sub_mb_type= h->sub_mb_type[i];
-            const int n= 4*i;
-            int x_offset= (i&1)<<2;
-            int y_offset= (i&2)<<1;
-
-            if(IS_SUB_8X8(sub_mb_type)){
-                mc_part(h, n, 1, 4, 0, dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                    qpix_put[1], chroma_put[1], qpix_avg[1], chroma_avg[1],
-                    &weight_op[3], &weight_avg[3],
-                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
-            }else if(IS_SUB_8X4(sub_mb_type)){
-                mc_part(h, n  , 0, 2, 4, dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                    qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
-                    &weight_op[4], &weight_avg[4],
-                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
-                mc_part(h, n+2, 0, 2, 4, dest_y, dest_cb, dest_cr, x_offset, y_offset+2,
-                    qpix_put[2], chroma_put[1], qpix_avg[2], chroma_avg[1],
-                    &weight_op[4], &weight_avg[4],
-                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
-            }else if(IS_SUB_4X8(sub_mb_type)){
-                mc_part(h, n  , 0, 4, 4*h->mb_linesize, dest_y, dest_cb, dest_cr, x_offset, y_offset,
-                    qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
-                    &weight_op[5], &weight_avg[5],
-                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
-                mc_part(h, n+1, 0, 4, 4*h->mb_linesize, dest_y, dest_cb, dest_cr, x_offset+2, y_offset,
-                    qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
-                    &weight_op[5], &weight_avg[5],
-                    IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
-            }else{
-                int j;
-                assert(IS_SUB_4X4(sub_mb_type));
-                for(j=0; j<4; j++){
-                    int sub_x_offset= x_offset + 2*(j&1);
-                    int sub_y_offset= y_offset +   (j&2);
-                    mc_part(h, n+j, 1, 2, 0, dest_y, dest_cb, dest_cr, sub_x_offset, sub_y_offset,
-                        qpix_put[2], chroma_put[2], qpix_avg[2], chroma_avg[2],
-                        &weight_op[6], &weight_avg[6],
-                        IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1));
-                }
-            }
-        }
-    }
-
-    prefetch_motion(h, 1);
-}
-
-
-static void free_tables(H264Context *h){
-    int i;
-    H264Context *hx;
-    av_freep(&h->intra4x4_pred_mode);
-    av_freep(&h->chroma_pred_mode_table);
-    av_freep(&h->cbp_table);
-    av_freep(&h->mvd_table[0]);
-    av_freep(&h->mvd_table[1]);
-    av_freep(&h->direct_table);
-    av_freep(&h->non_zero_count);
-    av_freep(&h->slice_table_base);
-    h->slice_table= NULL;
-    av_freep(&h->list_counts);
-
-    av_freep(&h->mb2b_xy);
-    av_freep(&h->mb2br_xy);
-
-    for(i = 0; i < MAX_THREADS; i++) {
-        hx = h->thread_context[i];
-        if(!hx) continue;
-        av_freep(&hx->top_borders[1]);
-        av_freep(&hx->top_borders[0]);
-        av_freep(&hx->s.obmc_scratchpad);
-        av_freep(&hx->rbsp_buffer[1]);
-        av_freep(&hx->rbsp_buffer[0]);
-        hx->rbsp_buffer_size[0] = 0;
-        hx->rbsp_buffer_size[1] = 0;
-        if (i) av_freep(&h->thread_context[i]);
-    }
-}
-
-static void init_dequant8_coeff_table(H264Context *h){
-    int i,q,x;
-    const int transpose = (h->h264dsp.h264_idct8_add != ff_h264_idct8_add_c); //FIXME ugly
-    h->dequant8_coeff[0] = h->dequant8_buffer[0];
-    h->dequant8_coeff[1] = h->dequant8_buffer[1];
-
-    for(i=0; i<2; i++ ){
-        if(i && !memcmp(h->pps.scaling_matrix8[0], h->pps.scaling_matrix8[1], 64*sizeof(uint8_t))){
-            h->dequant8_coeff[1] = h->dequant8_buffer[0];
-            break;
-        }
-
-        for(q=0; q<52; q++){
-            int shift = div6[q];
-            int idx = rem6[q];
-            for(x=0; x<64; x++)
-                h->dequant8_coeff[i][q][transpose ? (x>>3)|((x&7)<<3) : x] =
-                    ((uint32_t)dequant8_coeff_init[idx][ dequant8_coeff_init_scan[((x>>1)&12) | (x&3)] ] *
-                    h->pps.scaling_matrix8[i][x]) << shift;
-        }
-    }
-}
-
-static void init_dequant4_coeff_table(H264Context *h){
-    int i,j,q,x;
-    const int transpose = (h->h264dsp.h264_idct_add != ff_h264_idct_add_c); //FIXME ugly
-    for(i=0; i<6; i++ ){
-        h->dequant4_coeff[i] = h->dequant4_buffer[i];
-        for(j=0; j<i; j++){
-            if(!memcmp(h->pps.scaling_matrix4[j], h->pps.scaling_matrix4[i], 16*sizeof(uint8_t))){
-                h->dequant4_coeff[i] = h->dequant4_buffer[j];
-                break;
-            }
-        }
-        if(j<i)
-            continue;
-
-        for(q=0; q<52; q++){
-            int shift = div6[q] + 2;
-            int idx = rem6[q];
-            for(x=0; x<16; x++)
-                h->dequant4_coeff[i][q][transpose ? (x>>2)|((x<<2)&0xF) : x] =
-                    ((uint32_t)dequant4_coeff_init[idx][(x&1) + ((x>>2)&1)] *
-                    h->pps.scaling_matrix4[i][x]) << shift;
-        }
-    }
-}
-
-static void init_dequant_tables(H264Context *h){
-    int i,x;
-    init_dequant4_coeff_table(h);
-    if(h->pps.transform_8x8_mode)
-        init_dequant8_coeff_table(h);
-    if(h->sps.transform_bypass){
-        for(i=0; i<6; i++)
-            for(x=0; x<16; x++)
-                h->dequant4_coeff[i][0][x] = 1<<6;
-        if(h->pps.transform_8x8_mode)
-            for(i=0; i<2; i++)
-                for(x=0; x<64; x++)
-                    h->dequant8_coeff[i][0][x] = 1<<6;
-    }
-}
-
-
-int ff_h264_alloc_tables(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    const int big_mb_num= s->mb_stride * (s->mb_height+1);
-    const int row_mb_num= 2*s->mb_stride*s->avctx->thread_count;
-    int x,y;
-
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->intra4x4_pred_mode, row_mb_num * 8  * sizeof(uint8_t), fail)
-
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->non_zero_count    , big_mb_num * 32 * sizeof(uint8_t), fail)
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->slice_table_base  , (big_mb_num+s->mb_stride) * sizeof(*h->slice_table_base), fail)
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->cbp_table, big_mb_num * sizeof(uint16_t), fail)
-
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->chroma_pred_mode_table, big_mb_num * sizeof(uint8_t), fail)
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[0], 16*row_mb_num * sizeof(uint8_t), fail);
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mvd_table[1], 16*row_mb_num * sizeof(uint8_t), fail);
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->direct_table, 4*big_mb_num * sizeof(uint8_t) , fail);
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->list_counts, big_mb_num * sizeof(uint8_t), fail)
-
-    memset(h->slice_table_base, -1, (big_mb_num+s->mb_stride)  * sizeof(*h->slice_table_base));
-    h->slice_table= h->slice_table_base + s->mb_stride*2 + 1;
-
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mb2b_xy  , big_mb_num * sizeof(uint32_t), fail);
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->mb2br_xy , big_mb_num * sizeof(uint32_t), fail);
-    for(y=0; y<s->mb_height; y++){
-        for(x=0; x<s->mb_width; x++){
-            const int mb_xy= x + y*s->mb_stride;
-            const int b_xy = 4*x + 4*y*h->b_stride;
-
-            h->mb2b_xy [mb_xy]= b_xy;
-            h->mb2br_xy[mb_xy]= 8*(FMO ? mb_xy : (mb_xy % (2*s->mb_stride)));
-        }
-    }
-
-    s->obmc_scratchpad = NULL;
-
-    if(!h->dequant4_coeff[0])
-        init_dequant_tables(h);
-
-    return 0;
-fail:
-    free_tables(h);
-    return -1;
-}
-
-/**
- * Mimic alloc_tables(), but for every context thread.
- */
-static void clone_tables(H264Context *dst, H264Context *src, int i){
-    MpegEncContext * const s = &src->s;
-    dst->intra4x4_pred_mode       = src->intra4x4_pred_mode + i*8*2*s->mb_stride;
-    dst->non_zero_count           = src->non_zero_count;
-    dst->slice_table              = src->slice_table;
-    dst->cbp_table                = src->cbp_table;
-    dst->mb2b_xy                  = src->mb2b_xy;
-    dst->mb2br_xy                 = src->mb2br_xy;
-    dst->chroma_pred_mode_table   = src->chroma_pred_mode_table;
-    dst->mvd_table[0]             = src->mvd_table[0] + i*8*2*s->mb_stride;
-    dst->mvd_table[1]             = src->mvd_table[1] + i*8*2*s->mb_stride;
-    dst->direct_table             = src->direct_table;
-    dst->list_counts              = src->list_counts;
-
-    dst->s.obmc_scratchpad = NULL;
-    ff_h264_pred_init(&dst->hpc, src->s.codec_id);
-}
-
-/**
- * Init context
- * Allocate buffers which are not shared amongst multiple threads.
- */
-static int context_init(H264Context *h){
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[0], h->s.mb_width * (16+8+8) * sizeof(uint8_t), fail)
-    FF_ALLOCZ_OR_GOTO(h->s.avctx, h->top_borders[1], h->s.mb_width * (16+8+8) * sizeof(uint8_t), fail)
-
-    h->ref_cache[0][scan8[5 ]+1] = h->ref_cache[0][scan8[7 ]+1] = h->ref_cache[0][scan8[13]+1] =
-    h->ref_cache[1][scan8[5 ]+1] = h->ref_cache[1][scan8[7 ]+1] = h->ref_cache[1][scan8[13]+1] = PART_NOT_AVAILABLE;
-
-    return 0;
-fail:
-    return -1; // free_tables will clean up for us
-}
-
-static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size);
-
-static av_cold void common_init(H264Context *h){
-    MpegEncContext * const s = &h->s;
-
-    s->width = s->avctx->width;
-    s->height = s->avctx->height;
-    s->codec_id= s->avctx->codec->id;
-
-    ff_h264dsp_init(&h->h264dsp);
-    ff_h264_pred_init(&h->hpc, s->codec_id);
-
-    h->dequant_coeff_pps= -1;
-    s->unrestricted_mv=1;
-    s->decode=1; //FIXME
-
-    dsputil_init(&s->dsp, s->avctx); // needed so that idct permutation is known early
-
-    memset(h->pps.scaling_matrix4, 16, 6*16*sizeof(uint8_t));
-    memset(h->pps.scaling_matrix8, 16, 2*64*sizeof(uint8_t));
-}
-
-av_cold int ff_h264_decode_init(AVCodecContext *avctx){
-    H264Context *h= avctx->priv_data;
-    MpegEncContext * const s = &h->s;
-
-    MPV_decode_defaults(s);
-
-    s->avctx = avctx;
-    common_init(h);
-
-    s->out_format = FMT_H264;
-    s->workaround_bugs= avctx->workaround_bugs;
-
-    // set defaults
-//    s->decode_mb= ff_h263_decode_mb;
-    s->quarter_sample = 1;
-    if(!avctx->has_b_frames)
-    s->low_delay= 1;
-
-    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
-
-    ff_h264_decode_init_vlc();
-
-    h->thread_context[0] = h;
-    h->outputed_poc = INT_MIN;
-    h->prev_poc_msb= 1<<16;
-    h->x264_build = -1;
-    ff_h264_reset_sei(h);
-    if(avctx->codec_id == CODEC_ID_H264){
-        if(avctx->ticks_per_frame == 1){
-            s->avctx->time_base.den *=2;
-        }
-        avctx->ticks_per_frame = 2;
-    }
-
-    if(avctx->extradata_size > 0 && avctx->extradata && *(char *)avctx->extradata == 1){
-        int i, cnt, nalsize;
-        unsigned char *p = avctx->extradata;
-
-        h->is_avc = 1;
-
-        if(avctx->extradata_size < 7) {
-            av_log(avctx, AV_LOG_ERROR, "avcC too short\n");
-            return -1;
-        }
-        /* sps and pps in the avcC always have length coded with 2 bytes,
-           so put a fake nal_length_size = 2 while parsing them */
-        h->nal_length_size = 2;
-        // Decode sps from avcC
-        cnt = *(p+5) & 0x1f; // Number of sps
-        p += 6;
-        for (i = 0; i < cnt; i++) {
-            nalsize = AV_RB16(p) + 2;
-            if(decode_nal_units(h, p, nalsize) < 0) {
-                av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i);
-                return -1;
-            }
-            p += nalsize;
-        }
-        // Decode pps from avcC
-        cnt = *(p++); // Number of pps
-        for (i = 0; i < cnt; i++) {
-            nalsize = AV_RB16(p) + 2;
-            if(decode_nal_units(h, p, nalsize)  != nalsize) {
-                av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i);
-                return -1;
-            }
-            p += nalsize;
-        }
-        // Now store right nal length size, that will be use to parse all other nals
-        h->nal_length_size = ((*(((char*)(avctx->extradata))+4))&0x03)+1;
-    } else {
-        h->is_avc = 0;
-        if(decode_nal_units(h, s->avctx->extradata, s->avctx->extradata_size) < 0)
-            return -1;
-    }
-    if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames < h->sps.num_reorder_frames){
-        s->avctx->has_b_frames = h->sps.num_reorder_frames;
-        s->low_delay = 0;
-    }
-
-    return 0;
-}
-
-int ff_h264_frame_start(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    int i;
-
-    if(MPV_frame_start(s, s->avctx) < 0)
-        return -1;
-    ff_er_frame_start(s);
-    /*
-     * MPV_frame_start uses pict_type to derive key_frame.
-     * This is incorrect for H.264; IDR markings must be used.
-     * Zero here; IDR markings per slice in frame or fields are ORed in later.
-     * See decode_nal_units().
-     */
-    s->current_picture_ptr->key_frame= 0;
-    s->current_picture_ptr->mmco_reset= 0;
-
-    assert(s->linesize && s->uvlinesize);
-
-    for(i=0; i<16; i++){
-        h->block_offset[i]= 4*((scan8[i] - scan8[0])&7) + 4*s->linesize*((scan8[i] - scan8[0])>>3);
-        h->block_offset[24+i]= 4*((scan8[i] - scan8[0])&7) + 8*s->linesize*((scan8[i] - scan8[0])>>3);
-    }
-    for(i=0; i<4; i++){
-        h->block_offset[16+i]=
-        h->block_offset[20+i]= 4*((scan8[i] - scan8[0])&7) + 4*s->uvlinesize*((scan8[i] - scan8[0])>>3);
-        h->block_offset[24+16+i]=
-        h->block_offset[24+20+i]= 4*((scan8[i] - scan8[0])&7) + 8*s->uvlinesize*((scan8[i] - scan8[0])>>3);
-    }
-
-    /* can't be in alloc_tables because linesize isn't known there.
-     * FIXME: redo bipred weight to not require extra buffer? */
-    for(i = 0; i < s->avctx->thread_count; i++)
-        if(!h->thread_context[i]->s.obmc_scratchpad)
-            h->thread_context[i]->s.obmc_scratchpad = av_malloc(16*2*s->linesize + 8*2*s->uvlinesize);
-
-    /* some macroblocks can be accessed before they're available in case of lost slices, mbaff or threading*/
-    memset(h->slice_table, -1, (s->mb_height*s->mb_stride-1) * sizeof(*h->slice_table));
-
-//    s->decode= (s->flags&CODEC_FLAG_PSNR) || !s->encoding || s->current_picture.reference /*|| h->contains_intra*/ || 1;
-
-    // We mark the current picture as non-reference after allocating it, so
-    // that if we break out due to an error it can be released automatically
-    // in the next MPV_frame_start().
-    // SVQ3 as well as most other codecs have only last/next/current and thus
-    // get released even with set reference, besides SVQ3 and others do not
-    // mark frames as reference later "naturally".
-    if(s->codec_id != CODEC_ID_SVQ3)
-        s->current_picture_ptr->reference= 0;
-
-    s->current_picture_ptr->field_poc[0]=
-    s->current_picture_ptr->field_poc[1]= INT_MAX;
-    assert(s->current_picture_ptr->long_ref==0);
-
-    return 0;
-}
-
-static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int simple){
-    MpegEncContext * const s = &h->s;
-    uint8_t *top_border;
-    int top_idx = 1;
-
-    src_y  -=   linesize;
-    src_cb -= uvlinesize;
-    src_cr -= uvlinesize;
-
-    if(!simple && FRAME_MBAFF){
-        if(s->mb_y&1){
-            if(!MB_MBAFF){
-                top_border = h->top_borders[0][s->mb_x];
-                AV_COPY128(top_border, src_y + 15*linesize);
-                if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                    AV_COPY64(top_border+16, src_cb+7*uvlinesize);
-                    AV_COPY64(top_border+24, src_cr+7*uvlinesize);
-                }
-            }
-        }else if(MB_MBAFF){
-            top_idx = 0;
-        }else
-            return;
-    }
-
-    top_border = h->top_borders[top_idx][s->mb_x];
-    // There are two lines saved, the line above the the top macroblock of a pair,
-    // and the line above the bottom macroblock
-    AV_COPY128(top_border, src_y + 16*linesize);
-
-    if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-        AV_COPY64(top_border+16, src_cb+8*uvlinesize);
-        AV_COPY64(top_border+24, src_cr+8*uvlinesize);
-    }
-}
-
-static inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg, int simple){
-    MpegEncContext * const s = &h->s;
-    int deblock_left;
-    int deblock_top;
-    int top_idx = 1;
-    uint8_t *top_border_m1;
-    uint8_t *top_border;
-
-    if(!simple && FRAME_MBAFF){
-        if(s->mb_y&1){
-            if(!MB_MBAFF)
-                return;
-        }else{
-            top_idx = MB_MBAFF ? 0 : 1;
-        }
-    }
-
-    if(h->deblocking_filter == 2) {
-        deblock_left = h->left_type[0];
-        deblock_top  = h->top_type;
-    } else {
-        deblock_left = (s->mb_x > 0);
-        deblock_top =  (s->mb_y > !!MB_FIELD);
-    }
-
-    src_y  -=   linesize + 1;
-    src_cb -= uvlinesize + 1;
-    src_cr -= uvlinesize + 1;
-
-    top_border_m1 = h->top_borders[top_idx][s->mb_x-1];
-    top_border    = h->top_borders[top_idx][s->mb_x];
-
-#define XCHG(a,b,xchg)\
-if (xchg) AV_SWAP64(b,a);\
-else      AV_COPY64(b,a);
-
-    if(deblock_top){
-        if(deblock_left){
-            XCHG(top_border_m1+8, src_y -7, 1);
-        }
-        XCHG(top_border+0, src_y +1, xchg);
-        XCHG(top_border+8, src_y +9, 1);
-        if(s->mb_x+1 < s->mb_width){
-            XCHG(h->top_borders[top_idx][s->mb_x+1], src_y +17, 1);
-        }
-    }
-
-    if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-        if(deblock_top){
-            if(deblock_left){
-                XCHG(top_border_m1+16, src_cb -7, 1);
-                XCHG(top_border_m1+24, src_cr -7, 1);
-            }
-            XCHG(top_border+16, src_cb+1, 1);
-            XCHG(top_border+24, src_cr+1, 1);
-        }
-    }
-}
-
-static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple){
-    MpegEncContext * const s = &h->s;
-    const int mb_x= s->mb_x;
-    const int mb_y= s->mb_y;
-    const int mb_xy= h->mb_xy;
-    const int mb_type= s->current_picture.mb_type[mb_xy];
-    uint8_t  *dest_y, *dest_cb, *dest_cr;
-    int linesize, uvlinesize /*dct_offset*/;
-    int i;
-    int *block_offset = &h->block_offset[0];
-    const int transform_bypass = !simple && (s->qscale == 0 && h->sps.transform_bypass);
-    /* is_h264 should always be true if SVQ3 is disabled. */
-    const int is_h264 = !CONFIG_SVQ3_DECODER || simple || s->codec_id == CODEC_ID_H264;
-    void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride);
-    void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride);
-
-    dest_y  = s->current_picture.data[0] + (mb_x + mb_y * s->linesize  ) * 16;
-    dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8;
-    dest_cr = s->current_picture.data[2] + (mb_x + mb_y * s->uvlinesize) * 8;
-
-    s->dsp.prefetch(dest_y + (s->mb_x&3)*4*s->linesize + 64, s->linesize, 4);
-    s->dsp.prefetch(dest_cb + (s->mb_x&7)*s->uvlinesize + 64, dest_cr - dest_cb, 2);
-
-    h->list_counts[mb_xy]= h->list_count;
-
-    if (!simple && MB_FIELD) {
-        linesize   = h->mb_linesize   = s->linesize * 2;
-        uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
-        block_offset = &h->block_offset[24];
-        if(mb_y&1){ //FIXME move out of this function?
-            dest_y -= s->linesize*15;
-            dest_cb-= s->uvlinesize*7;
-            dest_cr-= s->uvlinesize*7;
-        }
-        if(FRAME_MBAFF) {
-            int list;
-            for(list=0; list<h->list_count; list++){
-                if(!USES_LIST(mb_type, list))
-                    continue;
-                if(IS_16X16(mb_type)){
-                    int8_t *ref = &h->ref_cache[list][scan8[0]];
-                    fill_rectangle(ref, 4, 4, 8, (16+*ref)^(s->mb_y&1), 1);
-                }else{
-                    for(i=0; i<16; i+=4){
-                        int ref = h->ref_cache[list][scan8[i]];
-                        if(ref >= 0)
-                            fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, (16+ref)^(s->mb_y&1), 1);
-                    }
-                }
-            }
-        }
-    } else {
-        linesize   = h->mb_linesize   = s->linesize;
-        uvlinesize = h->mb_uvlinesize = s->uvlinesize;
-//        dct_offset = s->linesize * 16;
-    }
-
-    if (!simple && IS_INTRA_PCM(mb_type)) {
-        for (i=0; i<16; i++) {
-            memcpy(dest_y + i*  linesize, h->mb       + i*8, 16);
-        }
-        for (i=0; i<8; i++) {
-            memcpy(dest_cb+ i*uvlinesize, h->mb + 128 + i*4,  8);
-            memcpy(dest_cr+ i*uvlinesize, h->mb + 160 + i*4,  8);
-        }
-    } else {
-        if(IS_INTRA(mb_type)){
-            if(h->deblocking_filter)
-                xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 1, simple);
-
-            if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cb, uvlinesize);
-                h->hpc.pred8x8[ h->chroma_pred_mode ](dest_cr, uvlinesize);
-            }
-
-            if(IS_INTRA4x4(mb_type)){
-                if(simple || !s->encoding){
-                    if(IS_8x8DCT(mb_type)){
-                        if(transform_bypass){
-                            idct_dc_add =
-                            idct_add    = s->dsp.add_pixels8;
-                        }else{
-                            idct_dc_add = h->h264dsp.h264_idct8_dc_add;
-                            idct_add    = h->h264dsp.h264_idct8_add;
-                        }
-                        for(i=0; i<16; i+=4){
-                            uint8_t * const ptr= dest_y + block_offset[i];
-                            const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
-                            if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
-                                h->hpc.pred8x8l_add[dir](ptr, h->mb + i*16, linesize);
-                            }else{
-                                const int nnz = h->non_zero_count_cache[ scan8[i] ];
-                                h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000,
-                                                            (h->topright_samples_available<<i)&0x4000, linesize);
-                                if(nnz){
-                                    if(nnz == 1 && h->mb[i*16])
-                                        idct_dc_add(ptr, h->mb + i*16, linesize);
-                                    else
-                                        idct_add   (ptr, h->mb + i*16, linesize);
-                                }
-                            }
-                        }
-                    }else{
-                        if(transform_bypass){
-                            idct_dc_add =
-                            idct_add    = s->dsp.add_pixels4;
-                        }else{
-                            idct_dc_add = h->h264dsp.h264_idct_dc_add;
-                            idct_add    = h->h264dsp.h264_idct_add;
-                        }
-                        for(i=0; i<16; i++){
-                            uint8_t * const ptr= dest_y + block_offset[i];
-                            const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ];
-
-                            if(transform_bypass && h->sps.profile_idc==244 && dir<=1){
-                                h->hpc.pred4x4_add[dir](ptr, h->mb + i*16, linesize);
-                            }else{
-                                uint8_t *topright;
-                                int nnz, tr;
-                                if(dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED){
-                                    const int topright_avail= (h->topright_samples_available<<i)&0x8000;
-                                    assert(mb_y || linesize <= block_offset[i]);
-                                    if(!topright_avail){
-                                        tr= ptr[3 - linesize]*0x01010101;
-                                        topright= (uint8_t*) &tr;
-                                    }else
-                                        topright= ptr + 4 - linesize;
-                                }else
-                                    topright= NULL;
-
-                                h->hpc.pred4x4[ dir ](ptr, topright, linesize);
-                                nnz = h->non_zero_count_cache[ scan8[i] ];
-                                if(nnz){
-                                    if(is_h264){
-                                        if(nnz == 1 && h->mb[i*16])
-                                            idct_dc_add(ptr, h->mb + i*16, linesize);
-                                        else
-                                            idct_add   (ptr, h->mb + i*16, linesize);
-                                    }else
-                                        ff_svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, 0);
-                                }
-                            }
-                        }
-                    }
-                }
-            }else{
-                h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize);
-                if(is_h264){
-                    if(!transform_bypass)
-                        h264_luma_dc_dequant_idct_c(h->mb, s->qscale, h->dequant4_coeff[0][s->qscale][0]);
-                }else
-                    ff_svq3_luma_dc_dequant_idct_c(h->mb, s->qscale);
-            }
-            if(h->deblocking_filter)
-                xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, simple);
-        }else if(is_h264){
-            hl_motion(h, dest_y, dest_cb, dest_cr,
-                      s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
-                      s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
-                      h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab);
-        }
-
-
-        if(!IS_INTRA4x4(mb_type)){
-            if(is_h264){
-                if(IS_INTRA16x16(mb_type)){
-                    if(transform_bypass){
-                        if(h->sps.profile_idc==244 && (h->intra16x16_pred_mode==VERT_PRED8x8 || h->intra16x16_pred_mode==HOR_PRED8x8)){
-                            h->hpc.pred16x16_add[h->intra16x16_pred_mode](dest_y, block_offset, h->mb, linesize);
-                        }else{
-                            for(i=0; i<16; i++){
-                                if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16])
-                                    s->dsp.add_pixels4(dest_y + block_offset[i], h->mb + i*16, linesize);
-                            }
-                        }
-                    }else{
-                         h->h264dsp.h264_idct_add16intra(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
-                    }
-                }else if(h->cbp&15){
-                    if(transform_bypass){
-                        const int di = IS_8x8DCT(mb_type) ? 4 : 1;
-                        idct_add= IS_8x8DCT(mb_type) ? s->dsp.add_pixels8 : s->dsp.add_pixels4;
-                        for(i=0; i<16; i+=di){
-                            if(h->non_zero_count_cache[ scan8[i] ]){
-                                idct_add(dest_y + block_offset[i], h->mb + i*16, linesize);
-                            }
-                        }
-                    }else{
-                        if(IS_8x8DCT(mb_type)){
-                            h->h264dsp.h264_idct8_add4(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
-                        }else{
-                            h->h264dsp.h264_idct_add16(dest_y, block_offset, h->mb, linesize, h->non_zero_count_cache);
-                        }
-                    }
-                }
-            }else{
-                for(i=0; i<16; i++){
-                    if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){ //FIXME benchmark weird rule, & below
-                        uint8_t * const ptr= dest_y + block_offset[i];
-                        ff_svq3_add_idct_c(ptr, h->mb + i*16, linesize, s->qscale, IS_INTRA(mb_type) ? 1 : 0);
-                    }
-                }
-            }
-        }
-
-        if((simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) && (h->cbp&0x30)){
-            uint8_t *dest[2] = {dest_cb, dest_cr};
-            if(transform_bypass){
-                if(IS_INTRA(mb_type) && h->sps.profile_idc==244 && (h->chroma_pred_mode==VERT_PRED8x8 || h->chroma_pred_mode==HOR_PRED8x8)){
-                    h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0], block_offset + 16, h->mb + 16*16, uvlinesize);
-                    h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1], block_offset + 20, h->mb + 20*16, uvlinesize);
-                }else{
-                    idct_add = s->dsp.add_pixels4;
-                    for(i=16; i<16+8; i++){
-                        if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16])
-                            idct_add   (dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize);
-                    }
-                }
-            }else{
-                chroma_dc_dequant_idct_c(h->mb + 16*16, h->chroma_qp[0], h->dequant4_coeff[IS_INTRA(mb_type) ? 1:4][h->chroma_qp[0]][0]);
-                chroma_dc_dequant_idct_c(h->mb + 16*16+4*16, h->chroma_qp[1], h->dequant4_coeff[IS_INTRA(mb_type) ? 2:5][h->chroma_qp[1]][0]);
-                if(is_h264){
-                    idct_add = h->h264dsp.h264_idct_add;
-                    idct_dc_add = h->h264dsp.h264_idct_dc_add;
-                    for(i=16; i<16+8; i++){
-                        if(h->non_zero_count_cache[ scan8[i] ])
-                            idct_add   (dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize);
-                        else if(h->mb[i*16])
-                            idct_dc_add(dest[(i&4)>>2] + block_offset[i], h->mb + i*16, uvlinesize);
-                    }
-                }else{
-                    for(i=16; i<16+8; i++){
-                        if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
-                            uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];
-                            ff_svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, ff_h264_chroma_qp[s->qscale + 12] - 12, 2);
-                        }
-                    }
-                }
-            }
-        }
-    }
-    if(h->cbp || IS_INTRA(mb_type))
-        s->dsp.clear_blocks(h->mb);
-}
-
-/**
- * Process a macroblock; this case avoids checks for expensive uncommon cases.
- */
-static void hl_decode_mb_simple(H264Context *h){
-    hl_decode_mb_internal(h, 1);
-}
-
-/**
- * Process a macroblock; this handles edge cases, such as interlacing.
- */
-static void av_noinline hl_decode_mb_complex(H264Context *h){
-    hl_decode_mb_internal(h, 0);
-}
-
-void ff_h264_hl_decode_mb(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= h->mb_xy;
-    const int mb_type= s->current_picture.mb_type[mb_xy];
-    int is_complex = CONFIG_SMALL || h->is_complex || IS_INTRA_PCM(mb_type) || s->qscale == 0;
-
-    if (is_complex)
-        hl_decode_mb_complex(h);
-    else hl_decode_mb_simple(h);
-}
-
-static int pred_weight_table(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    int list, i;
-    int luma_def, chroma_def;
-
-    h->use_weight= 0;
-    h->use_weight_chroma= 0;
-    h->luma_log2_weight_denom= get_ue_golomb(&s->gb);
-    h->chroma_log2_weight_denom= get_ue_golomb(&s->gb);
-    luma_def = 1<<h->luma_log2_weight_denom;
-    chroma_def = 1<<h->chroma_log2_weight_denom;
-
-    for(list=0; list<2; list++){
-        h->luma_weight_flag[list]   = 0;
-        h->chroma_weight_flag[list] = 0;
-        for(i=0; i<h->ref_count[list]; i++){
-            int luma_weight_flag, chroma_weight_flag;
-
-            luma_weight_flag= get_bits1(&s->gb);
-            if(luma_weight_flag){
-                h->luma_weight[i][list][0]= get_se_golomb(&s->gb);
-                h->luma_weight[i][list][1]= get_se_golomb(&s->gb);
-                if(   h->luma_weight[i][list][0] != luma_def
-                   || h->luma_weight[i][list][1] != 0) {
-                    h->use_weight= 1;
-                    h->luma_weight_flag[list]= 1;
-                }
-            }else{
-                h->luma_weight[i][list][0]= luma_def;
-                h->luma_weight[i][list][1]= 0;
-            }
-
-            if(CHROMA){
-                chroma_weight_flag= get_bits1(&s->gb);
-                if(chroma_weight_flag){
-                    int j;
-                    for(j=0; j<2; j++){
-                        h->chroma_weight[i][list][j][0]= get_se_golomb(&s->gb);
-                        h->chroma_weight[i][list][j][1]= get_se_golomb(&s->gb);
-                        if(   h->chroma_weight[i][list][j][0] != chroma_def
-                           || h->chroma_weight[i][list][j][1] != 0) {
-                            h->use_weight_chroma= 1;
-                            h->chroma_weight_flag[list]= 1;
-                        }
-                    }
-                }else{
-                    int j;
-                    for(j=0; j<2; j++){
-                        h->chroma_weight[i][list][j][0]= chroma_def;
-                        h->chroma_weight[i][list][j][1]= 0;
-                    }
-                }
-            }
-        }
-        if(h->slice_type_nos != FF_B_TYPE) break;
-    }
-    h->use_weight= h->use_weight || h->use_weight_chroma;
-    return 0;
-}
-
-/**
- * Initialize implicit_weight table.
- * @param field, 0/1 initialize the weight for interlaced MBAFF
- *                -1 initializes the rest
- */
-static void implicit_weight_table(H264Context *h, int field){
-    MpegEncContext * const s = &h->s;
-    int ref0, ref1, i, cur_poc, ref_start, ref_count0, ref_count1;
-
-    for (i = 0; i < 2; i++) {
-        h->luma_weight_flag[i]   = 0;
-        h->chroma_weight_flag[i] = 0;
-    }
-
-    if(field < 0){
-        cur_poc = s->current_picture_ptr->poc;
-    if(   h->ref_count[0] == 1 && h->ref_count[1] == 1 && !FRAME_MBAFF
-       && h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2*cur_poc){
-        h->use_weight= 0;
-        h->use_weight_chroma= 0;
-        return;
-    }
-        ref_start= 0;
-        ref_count0= h->ref_count[0];
-        ref_count1= h->ref_count[1];
-    }else{
-        cur_poc = s->current_picture_ptr->field_poc[field];
-        ref_start= 16;
-        ref_count0= 16+2*h->ref_count[0];
-        ref_count1= 16+2*h->ref_count[1];
-    }
-
-    h->use_weight= 2;
-    h->use_weight_chroma= 2;
-    h->luma_log2_weight_denom= 5;
-    h->chroma_log2_weight_denom= 5;
-
-    for(ref0=ref_start; ref0 < ref_count0; ref0++){
-        int poc0 = h->ref_list[0][ref0].poc;
-        for(ref1=ref_start; ref1 < ref_count1; ref1++){
-            int poc1 = h->ref_list[1][ref1].poc;
-            int td = av_clip(poc1 - poc0, -128, 127);
-            int w= 32;
-            if(td){
-                int tb = av_clip(cur_poc - poc0, -128, 127);
-                int tx = (16384 + (FFABS(td) >> 1)) / td;
-                int dist_scale_factor = (tb*tx + 32) >> 8;
-                if(dist_scale_factor >= -64 && dist_scale_factor <= 128)
-                    w = 64 - dist_scale_factor;
-            }
-            if(field<0){
-                h->implicit_weight[ref0][ref1][0]=
-                h->implicit_weight[ref0][ref1][1]= w;
-            }else{
-                h->implicit_weight[ref0][ref1][field]=w;
-            }
-        }
-    }
-}
-
-/**
- * instantaneous decoder refresh.
- */
-static void idr(H264Context *h){
-    ff_h264_remove_all_refs(h);
-    h->prev_frame_num= 0;
-    h->prev_frame_num_offset= 0;
-    h->prev_poc_msb=
-    h->prev_poc_lsb= 0;
-}
-
-/* forget old pics after a seek */
-static void flush_dpb(AVCodecContext *avctx){
-    H264Context *h= avctx->priv_data;
-    int i;
-    for(i=0; i<MAX_DELAYED_PIC_COUNT; i++) {
-        if(h->delayed_pic[i])
-            h->delayed_pic[i]->reference= 0;
-        h->delayed_pic[i]= NULL;
-    }
-    h->outputed_poc= INT_MIN;
-    h->prev_interlaced_frame = 1;
-    idr(h);
-    if(h->s.current_picture_ptr)
-        h->s.current_picture_ptr->reference= 0;
-    h->s.first_field= 0;
-    ff_h264_reset_sei(h);
-    ff_mpeg_flush(avctx);
-}
-
-static int init_poc(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    const int max_frame_num= 1<<h->sps.log2_max_frame_num;
-    int field_poc[2];
-    Picture *cur = s->current_picture_ptr;
-
-    h->frame_num_offset= h->prev_frame_num_offset;
-    if(h->frame_num < h->prev_frame_num)
-        h->frame_num_offset += max_frame_num;
-
-    if(h->sps.poc_type==0){
-        const int max_poc_lsb= 1<<h->sps.log2_max_poc_lsb;
-
-        if     (h->poc_lsb < h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb >= max_poc_lsb/2)
-            h->poc_msb = h->prev_poc_msb + max_poc_lsb;
-        else if(h->poc_lsb > h->prev_poc_lsb && h->prev_poc_lsb - h->poc_lsb < -max_poc_lsb/2)
-            h->poc_msb = h->prev_poc_msb - max_poc_lsb;
-        else
-            h->poc_msb = h->prev_poc_msb;
-//printf("poc: %d %d\n", h->poc_msb, h->poc_lsb);
-        field_poc[0] =
-        field_poc[1] = h->poc_msb + h->poc_lsb;
-        if(s->picture_structure == PICT_FRAME)
-            field_poc[1] += h->delta_poc_bottom;
-    }else if(h->sps.poc_type==1){
-        int abs_frame_num, expected_delta_per_poc_cycle, expectedpoc;
-        int i;
-
-        if(h->sps.poc_cycle_length != 0)
-            abs_frame_num = h->frame_num_offset + h->frame_num;
-        else
-            abs_frame_num = 0;
-
-        if(h->nal_ref_idc==0 && abs_frame_num > 0)
-            abs_frame_num--;
-
-        expected_delta_per_poc_cycle = 0;
-        for(i=0; i < h->sps.poc_cycle_length; i++)
-            expected_delta_per_poc_cycle += h->sps.offset_for_ref_frame[ i ]; //FIXME integrate during sps parse
-
-        if(abs_frame_num > 0){
-            int poc_cycle_cnt          = (abs_frame_num - 1) / h->sps.poc_cycle_length;
-            int frame_num_in_poc_cycle = (abs_frame_num - 1) % h->sps.poc_cycle_length;
-
-            expectedpoc = poc_cycle_cnt * expected_delta_per_poc_cycle;
-            for(i = 0; i <= frame_num_in_poc_cycle; i++)
-                expectedpoc = expectedpoc + h->sps.offset_for_ref_frame[ i ];
-        } else
-            expectedpoc = 0;
-
-        if(h->nal_ref_idc == 0)
-            expectedpoc = expectedpoc + h->sps.offset_for_non_ref_pic;
-
-        field_poc[0] = expectedpoc + h->delta_poc[0];
-        field_poc[1] = field_poc[0] + h->sps.offset_for_top_to_bottom_field;
-
-        if(s->picture_structure == PICT_FRAME)
-            field_poc[1] += h->delta_poc[1];
-    }else{
-        int poc= 2*(h->frame_num_offset + h->frame_num);
-
-        if(!h->nal_ref_idc)
-            poc--;
-
-        field_poc[0]= poc;
-        field_poc[1]= poc;
-    }
-
-    if(s->picture_structure != PICT_BOTTOM_FIELD)
-        s->current_picture_ptr->field_poc[0]= field_poc[0];
-    if(s->picture_structure != PICT_TOP_FIELD)
-        s->current_picture_ptr->field_poc[1]= field_poc[1];
-    cur->poc= FFMIN(cur->field_poc[0], cur->field_poc[1]);
-
-    return 0;
-}
-
-
-/**
- * initialize scan tables
- */
-static void init_scan_tables(H264Context *h){
-    int i;
-    if(h->h264dsp.h264_idct_add == ff_h264_idct_add_c){ //FIXME little ugly
-        memcpy(h->zigzag_scan, zigzag_scan, 16*sizeof(uint8_t));
-        memcpy(h-> field_scan,  field_scan, 16*sizeof(uint8_t));
-    }else{
-        for(i=0; i<16; i++){
-#define T(x) (x>>2) | ((x<<2) & 0xF)
-            h->zigzag_scan[i] = T(zigzag_scan[i]);
-            h-> field_scan[i] = T( field_scan[i]);
-#undef T
-        }
-    }
-    if(h->h264dsp.h264_idct8_add == ff_h264_idct8_add_c){
-        memcpy(h->zigzag_scan8x8,       ff_zigzag_direct,     64*sizeof(uint8_t));
-        memcpy(h->zigzag_scan8x8_cavlc, zigzag_scan8x8_cavlc, 64*sizeof(uint8_t));
-        memcpy(h->field_scan8x8,        field_scan8x8,        64*sizeof(uint8_t));
-        memcpy(h->field_scan8x8_cavlc,  field_scan8x8_cavlc,  64*sizeof(uint8_t));
-    }else{
-        for(i=0; i<64; i++){
-#define T(x) (x>>3) | ((x&7)<<3)
-            h->zigzag_scan8x8[i]       = T(ff_zigzag_direct[i]);
-            h->zigzag_scan8x8_cavlc[i] = T(zigzag_scan8x8_cavlc[i]);
-            h->field_scan8x8[i]        = T(field_scan8x8[i]);
-            h->field_scan8x8_cavlc[i]  = T(field_scan8x8_cavlc[i]);
-#undef T
-        }
-    }
-    if(h->sps.transform_bypass){ //FIXME same ugly
-        h->zigzag_scan_q0          = zigzag_scan;
-        h->zigzag_scan8x8_q0       = ff_zigzag_direct;
-        h->zigzag_scan8x8_cavlc_q0 = zigzag_scan8x8_cavlc;
-        h->field_scan_q0           = field_scan;
-        h->field_scan8x8_q0        = field_scan8x8;
-        h->field_scan8x8_cavlc_q0  = field_scan8x8_cavlc;
-    }else{
-        h->zigzag_scan_q0          = h->zigzag_scan;
-        h->zigzag_scan8x8_q0       = h->zigzag_scan8x8;
-        h->zigzag_scan8x8_cavlc_q0 = h->zigzag_scan8x8_cavlc;
-        h->field_scan_q0           = h->field_scan;
-        h->field_scan8x8_q0        = h->field_scan8x8;
-        h->field_scan8x8_cavlc_q0  = h->field_scan8x8_cavlc;
-    }
-}
-
-static void field_end(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    AVCodecContext * const avctx= s->avctx;
-    s->mb_y= 0;
-
-    s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264;
-    s->current_picture_ptr->pict_type= s->pict_type;
-
-    if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-        ff_vdpau_h264_set_reference_frames(s);
-
-    if(!s->dropable) {
-        ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
-        h->prev_poc_msb= h->poc_msb;
-        h->prev_poc_lsb= h->poc_lsb;
-    }
-    h->prev_frame_num_offset= h->frame_num_offset;
-    h->prev_frame_num= h->frame_num;
-
-    if (avctx->hwaccel) {
-        if (avctx->hwaccel->end_frame(avctx) < 0)
-            av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
-    }
-
-    if (CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-        ff_vdpau_h264_picture_complete(s);
-
-    /*
-     * FIXME: Error handling code does not seem to support interlaced
-     * when slices span multiple rows
-     * The ff_er_add_slice calls don't work right for bottom
-     * fields; they cause massive erroneous error concealing
-     * Error marking covers both fields (top and bottom).
-     * This causes a mismatched s->error_count
-     * and a bad error table. Further, the error count goes to
-     * INT_MAX when called for bottom field, because mb_y is
-     * past end by one (callers fault) and resync_mb_y != 0
-     * causes problems for the first MB line, too.
-     */
-    if (!FIELD_PICTURE)
-        ff_er_frame_end(s);
-
-    MPV_frame_end(s);
-
-    h->current_slice=0;
-}
-
-/**
- * Replicates H264 "master" context to thread contexts.
- */
-static void clone_slice(H264Context *dst, H264Context *src)
-{
-    memcpy(dst->block_offset,     src->block_offset, sizeof(dst->block_offset));
-    dst->s.current_picture_ptr  = src->s.current_picture_ptr;
-    dst->s.current_picture      = src->s.current_picture;
-    dst->s.linesize             = src->s.linesize;
-    dst->s.uvlinesize           = src->s.uvlinesize;
-    dst->s.first_field          = src->s.first_field;
-
-    dst->prev_poc_msb           = src->prev_poc_msb;
-    dst->prev_poc_lsb           = src->prev_poc_lsb;
-    dst->prev_frame_num_offset  = src->prev_frame_num_offset;
-    dst->prev_frame_num         = src->prev_frame_num;
-    dst->short_ref_count        = src->short_ref_count;
-
-    memcpy(dst->short_ref,        src->short_ref,        sizeof(dst->short_ref));
-    memcpy(dst->long_ref,         src->long_ref,         sizeof(dst->long_ref));
-    memcpy(dst->default_ref_list, src->default_ref_list, sizeof(dst->default_ref_list));
-    memcpy(dst->ref_list,         src->ref_list,         sizeof(dst->ref_list));
-
-    memcpy(dst->dequant4_coeff,   src->dequant4_coeff,   sizeof(src->dequant4_coeff));
-    memcpy(dst->dequant8_coeff,   src->dequant8_coeff,   sizeof(src->dequant8_coeff));
-}
-
-/**
- * decodes a slice header.
- * This will also call MPV_common_init() and frame_start() as needed.
- *
- * @param h h264context
- * @param h0 h264 master context (differs from 'h' when doing sliced based parallel decoding)
- *
- * @return 0 if okay, <0 if an error occurred, 1 if decoding must not be multithreaded
- */
-static int decode_slice_header(H264Context *h, H264Context *h0){
-    MpegEncContext * const s = &h->s;
-    MpegEncContext * const s0 = &h0->s;
-    unsigned int first_mb_in_slice;
-    unsigned int pps_id;
-    int num_ref_idx_active_override_flag;
-    unsigned int slice_type, tmp, i, j;
-    int default_ref_list_done = 0;
-    int last_pic_structure;
-
-    s->dropable= h->nal_ref_idc == 0;
-
-    if((s->avctx->flags2 & CODEC_FLAG2_FAST) && !h->nal_ref_idc){
-        s->me.qpel_put= s->dsp.put_2tap_qpel_pixels_tab;
-        s->me.qpel_avg= s->dsp.avg_2tap_qpel_pixels_tab;
-    }else{
-        s->me.qpel_put= s->dsp.put_h264_qpel_pixels_tab;
-        s->me.qpel_avg= s->dsp.avg_h264_qpel_pixels_tab;
-    }
-
-    first_mb_in_slice= get_ue_golomb(&s->gb);
-
-    if(first_mb_in_slice == 0){ //FIXME better field boundary detection
-        if(h0->current_slice && FIELD_PICTURE){
-            field_end(h);
-        }
-
-        h0->current_slice = 0;
-        if (!s0->first_field)
-            s->current_picture_ptr= NULL;
-    }
-
-    slice_type= get_ue_golomb_31(&s->gb);
-    if(slice_type > 9){
-        av_log(h->s.avctx, AV_LOG_ERROR, "slice type too large (%d) at %d %d\n", h->slice_type, s->mb_x, s->mb_y);
-        return -1;
-    }
-    if(slice_type > 4){
-        slice_type -= 5;
-        h->slice_type_fixed=1;
-    }else
-        h->slice_type_fixed=0;
-
-    slice_type= golomb_to_pict_type[ slice_type ];
-    if (slice_type == FF_I_TYPE
-        || (h0->current_slice != 0 && slice_type == h0->last_slice_type) ) {
-        default_ref_list_done = 1;
-    }
-    h->slice_type= slice_type;
-    h->slice_type_nos= slice_type & 3;
-
-    s->pict_type= h->slice_type; // to make a few old functions happy, it's wrong though
-
-    pps_id= get_ue_golomb(&s->gb);
-    if(pps_id>=MAX_PPS_COUNT){
-        av_log(h->s.avctx, AV_LOG_ERROR, "pps_id out of range\n");
-        return -1;
-    }
-    if(!h0->pps_buffers[pps_id]) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id);
-        return -1;
-    }
-    h->pps= *h0->pps_buffers[pps_id];
-
-    if(!h0->sps_buffers[h->pps.sps_id]) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", h->pps.sps_id);
-        return -1;
-    }
-    h->sps = *h0->sps_buffers[h->pps.sps_id];
-
-    s->avctx->profile = h->sps.profile_idc;
-    s->avctx->level   = h->sps.level_idc;
-    s->avctx->refs    = h->sps.ref_frame_count;
-
-    if(h == h0 && h->dequant_coeff_pps != pps_id){
-        h->dequant_coeff_pps = pps_id;
-        init_dequant_tables(h);
-    }
-
-    s->mb_width= h->sps.mb_width;
-    s->mb_height= h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag);
-
-    h->b_stride=  s->mb_width*4;
-
-    s->width = 16*s->mb_width - 2*FFMIN(h->sps.crop_right, 7);
-    if(h->sps.frame_mbs_only_flag)
-        s->height= 16*s->mb_height - 2*FFMIN(h->sps.crop_bottom, 7);
-    else
-        s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3);
-
-    if (s->context_initialized
-        && (   s->width != s->avctx->width || s->height != s->avctx->height
-            || av_cmp_q(h->sps.sar, s->avctx->sample_aspect_ratio))) {
-        if(h != h0)
-            return -1;   // width / height changed during parallelized decoding
-        free_tables(h);
-        flush_dpb(s->avctx);
-        MPV_common_end(s);
-    }
-    if (!s->context_initialized) {
-        if(h != h0)
-            return -1;  // we cant (re-)initialize context during parallel decoding
-
-        avcodec_set_dimensions(s->avctx, s->width, s->height);
-        s->avctx->sample_aspect_ratio= h->sps.sar;
-        if(!s->avctx->sample_aspect_ratio.den)
-            s->avctx->sample_aspect_ratio.den = 1;
-
-        if(h->sps.video_signal_type_present_flag){
-            s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
-            if(h->sps.colour_description_present_flag){
-                s->avctx->color_primaries = h->sps.color_primaries;
-                s->avctx->color_trc       = h->sps.color_trc;
-                s->avctx->colorspace      = h->sps.colorspace;
-            }
-        }
-
-        if(h->sps.timing_info_present_flag){
-            int64_t den= h->sps.time_scale;
-            if(h->x264_build < 44U)
-                den *= 2;
-            av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
-                      h->sps.num_units_in_tick, den, 1<<30);
-        }
-        s->avctx->pix_fmt = s->avctx->get_format(s->avctx, s->avctx->codec->pix_fmts);
-        s->avctx->hwaccel = ff_find_hwaccel(s->avctx->codec->id, s->avctx->pix_fmt);
-
-        if (MPV_common_init(s) < 0)
-            return -1;
-        s->first_field = 0;
-        h->prev_interlaced_frame = 1;
-
-        init_scan_tables(h);
-        ff_h264_alloc_tables(h);
-
-        for(i = 1; i < s->avctx->thread_count; i++) {
-            H264Context *c;
-            c = h->thread_context[i] = av_malloc(sizeof(H264Context));
-            memcpy(c, h->s.thread_context[i], sizeof(MpegEncContext));
-            memset(&c->s + 1, 0, sizeof(H264Context) - sizeof(MpegEncContext));
-            c->h264dsp = h->h264dsp;
-            c->sps = h->sps;
-            c->pps = h->pps;
-            init_scan_tables(c);
-            clone_tables(c, h, i);
-        }
-
-        for(i = 0; i < s->avctx->thread_count; i++)
-            if(context_init(h->thread_context[i]) < 0)
-                return -1;
-    }
-
-    h->frame_num= get_bits(&s->gb, h->sps.log2_max_frame_num);
-
-    h->mb_mbaff = 0;
-    h->mb_aff_frame = 0;
-    last_pic_structure = s0->picture_structure;
-    if(h->sps.frame_mbs_only_flag){
-        s->picture_structure= PICT_FRAME;
-    }else{
-        if(get_bits1(&s->gb)) { //field_pic_flag
-            s->picture_structure= PICT_TOP_FIELD + get_bits1(&s->gb); //bottom_field_flag
-        } else {
-            s->picture_structure= PICT_FRAME;
-            h->mb_aff_frame = h->sps.mb_aff;
-        }
-    }
-    h->mb_field_decoding_flag= s->picture_structure != PICT_FRAME;
-
-    if(h0->current_slice == 0){
-        while(h->frame_num !=  h->prev_frame_num &&
-              h->frame_num != (h->prev_frame_num+1)%(1<<h->sps.log2_max_frame_num)){
-            av_log(NULL, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);
-            if (ff_h264_frame_start(h) < 0)
-                return -1;
-            h->prev_frame_num++;
-            h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
-            s->current_picture_ptr->frame_num= h->prev_frame_num;
-            ff_h264_execute_ref_pic_marking(h, NULL, 0);
-        }
-
-        /* See if we have a decoded first field looking for a pair... */
-        if (s0->first_field) {
-            assert(s0->current_picture_ptr);
-            assert(s0->current_picture_ptr->data[0]);
-            assert(s0->current_picture_ptr->reference != DELAYED_PIC_REF);
-
-            /* figure out if we have a complementary field pair */
-            if (!FIELD_PICTURE || s->picture_structure == last_pic_structure) {
-                /*
-                 * Previous field is unmatched. Don't display it, but let it
-                 * remain for reference if marked as such.
-                 */
-                s0->current_picture_ptr = NULL;
-                s0->first_field = FIELD_PICTURE;
-
-            } else {
-                if (h->nal_ref_idc &&
-                        s0->current_picture_ptr->reference &&
-                        s0->current_picture_ptr->frame_num != h->frame_num) {
-                    /*
-                     * This and previous field were reference, but had
-                     * different frame_nums. Consider this field first in
-                     * pair. Throw away previous field except for reference
-                     * purposes.
-                     */
-                    s0->first_field = 1;
-                    s0->current_picture_ptr = NULL;
-
-                } else {
-                    /* Second field in complementary pair */
-                    s0->first_field = 0;
-                }
-            }
-
-        } else {
-            /* Frame or first field in a potentially complementary pair */
-            assert(!s0->current_picture_ptr);
-            s0->first_field = FIELD_PICTURE;
-        }
-
-        if((!FIELD_PICTURE || s0->first_field) && ff_h264_frame_start(h) < 0) {
-            s0->first_field = 0;
-            return -1;
-        }
-    }
-    if(h != h0)
-        clone_slice(h, h0);
-
-    s->current_picture_ptr->frame_num= h->frame_num; //FIXME frame_num cleanup
-
-    assert(s->mb_num == s->mb_width * s->mb_height);
-    if(first_mb_in_slice << FIELD_OR_MBAFF_PICTURE >= s->mb_num ||
-       first_mb_in_slice                    >= s->mb_num){
-        av_log(h->s.avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n");
-        return -1;
-    }
-    s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width;
-    s->resync_mb_y = s->mb_y = (first_mb_in_slice / s->mb_width) << FIELD_OR_MBAFF_PICTURE;
-    if (s->picture_structure == PICT_BOTTOM_FIELD)
-        s->resync_mb_y = s->mb_y = s->mb_y + 1;
-    assert(s->mb_y < s->mb_height);
-
-    if(s->picture_structure==PICT_FRAME){
-        h->curr_pic_num=   h->frame_num;
-        h->max_pic_num= 1<< h->sps.log2_max_frame_num;
-    }else{
-        h->curr_pic_num= 2*h->frame_num + 1;
-        h->max_pic_num= 1<<(h->sps.log2_max_frame_num + 1);
-    }
-
-    if(h->nal_unit_type == NAL_IDR_SLICE){
-        get_ue_golomb(&s->gb); /* idr_pic_id */
-    }
-
-    if(h->sps.poc_type==0){
-        h->poc_lsb= get_bits(&s->gb, h->sps.log2_max_poc_lsb);
-
-        if(h->pps.pic_order_present==1 && s->picture_structure==PICT_FRAME){
-            h->delta_poc_bottom= get_se_golomb(&s->gb);
-        }
-    }
-
-    if(h->sps.poc_type==1 && !h->sps.delta_pic_order_always_zero_flag){
-        h->delta_poc[0]= get_se_golomb(&s->gb);
-
-        if(h->pps.pic_order_present==1 && s->picture_structure==PICT_FRAME)
-            h->delta_poc[1]= get_se_golomb(&s->gb);
-    }
-
-    init_poc(h);
-
-    if(h->pps.redundant_pic_cnt_present){
-        h->redundant_pic_count= get_ue_golomb(&s->gb);
-    }
-
-    //set defaults, might be overridden a few lines later
-    h->ref_count[0]= h->pps.ref_count[0];
-    h->ref_count[1]= h->pps.ref_count[1];
-
-    if(h->slice_type_nos != FF_I_TYPE){
-        if(h->slice_type_nos == FF_B_TYPE){
-            h->direct_spatial_mv_pred= get_bits1(&s->gb);
-        }
-        num_ref_idx_active_override_flag= get_bits1(&s->gb);
-
-        if(num_ref_idx_active_override_flag){
-            h->ref_count[0]= get_ue_golomb(&s->gb) + 1;
-            if(h->slice_type_nos==FF_B_TYPE)
-                h->ref_count[1]= get_ue_golomb(&s->gb) + 1;
-
-            if(h->ref_count[0]-1 > 32-1 || h->ref_count[1]-1 > 32-1){
-                av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow\n");
-                h->ref_count[0]= h->ref_count[1]= 1;
-                return -1;
-            }
-        }
-        if(h->slice_type_nos == FF_B_TYPE)
-            h->list_count= 2;
-        else
-            h->list_count= 1;
-    }else
-        h->list_count= 0;
-
-    if(!default_ref_list_done){
-        ff_h264_fill_default_ref_list(h);
-    }
-
-    if(h->slice_type_nos!=FF_I_TYPE && ff_h264_decode_ref_pic_list_reordering(h) < 0)
-        return -1;
-
-    if(h->slice_type_nos!=FF_I_TYPE){
-        s->last_picture_ptr= &h->ref_list[0][0];
-        ff_copy_picture(&s->last_picture, s->last_picture_ptr);
-    }
-    if(h->slice_type_nos==FF_B_TYPE){
-        s->next_picture_ptr= &h->ref_list[1][0];
-        ff_copy_picture(&s->next_picture, s->next_picture_ptr);
-    }
-
-    if(   (h->pps.weighted_pred          && h->slice_type_nos == FF_P_TYPE )
-       ||  (h->pps.weighted_bipred_idc==1 && h->slice_type_nos== FF_B_TYPE ) )
-        pred_weight_table(h);
-    else if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE){
-        implicit_weight_table(h, -1);
-    }else {
-        h->use_weight = 0;
-        for (i = 0; i < 2; i++) {
-            h->luma_weight_flag[i]   = 0;
-            h->chroma_weight_flag[i] = 0;
-        }
-    }
-
-    if(h->nal_ref_idc)
-        ff_h264_decode_ref_pic_marking(h0, &s->gb);
-
-    if(FRAME_MBAFF){
-        ff_h264_fill_mbaff_ref_list(h);
-
-        if(h->pps.weighted_bipred_idc==2 && h->slice_type_nos== FF_B_TYPE){
-            implicit_weight_table(h, 0);
-            implicit_weight_table(h, 1);
-        }
-    }
-
-    if(h->slice_type_nos==FF_B_TYPE && !h->direct_spatial_mv_pred)
-        ff_h264_direct_dist_scale_factor(h);
-    ff_h264_direct_ref_list_init(h);
-
-    if( h->slice_type_nos != FF_I_TYPE && h->pps.cabac ){
-        tmp = get_ue_golomb_31(&s->gb);
-        if(tmp > 2){
-            av_log(s->avctx, AV_LOG_ERROR, "cabac_init_idc overflow\n");
-            return -1;
-        }
-        h->cabac_init_idc= tmp;
-    }
-
-    h->last_qscale_diff = 0;
-    tmp = h->pps.init_qp + get_se_golomb(&s->gb);
-    if(tmp>51){
-        av_log(s->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp);
-        return -1;
-    }
-    s->qscale= tmp;
-    h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
-    h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
-    //FIXME qscale / qp ... stuff
-    if(h->slice_type == FF_SP_TYPE){
-        get_bits1(&s->gb); /* sp_for_switch_flag */
-    }
-    if(h->slice_type==FF_SP_TYPE || h->slice_type == FF_SI_TYPE){
-        get_se_golomb(&s->gb); /* slice_qs_delta */
-    }
-
-    h->deblocking_filter = 1;
-    h->slice_alpha_c0_offset = 52;
-    h->slice_beta_offset = 52;
-    if( h->pps.deblocking_filter_parameters_present ) {
-        tmp= get_ue_golomb_31(&s->gb);
-        if(tmp > 2){
-            av_log(s->avctx, AV_LOG_ERROR, "deblocking_filter_idc %u out of range\n", tmp);
-            return -1;
-        }
-        h->deblocking_filter= tmp;
-        if(h->deblocking_filter < 2)
-            h->deblocking_filter^= 1; // 1<->0
-
-        if( h->deblocking_filter ) {
-            h->slice_alpha_c0_offset += get_se_golomb(&s->gb) << 1;
-            h->slice_beta_offset     += get_se_golomb(&s->gb) << 1;
-            if(   h->slice_alpha_c0_offset > 104U
-               || h->slice_beta_offset     > 104U){
-                av_log(s->avctx, AV_LOG_ERROR, "deblocking filter parameters %d %d out of range\n", h->slice_alpha_c0_offset, h->slice_beta_offset);
-                return -1;
-            }
-        }
-    }
-
-    if(   s->avctx->skip_loop_filter >= AVDISCARD_ALL
-       ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE)
-       ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR  && h->slice_type_nos == FF_B_TYPE)
-       ||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
-        h->deblocking_filter= 0;
-
-    if(h->deblocking_filter == 1 && h0->max_contexts > 1) {
-        if(s->avctx->flags2 & CODEC_FLAG2_FAST) {
-            /* Cheat slightly for speed:
-               Do not bother to deblock across slices. */
-            h->deblocking_filter = 2;
-        } else {
-            h0->max_contexts = 1;
-            if(!h0->single_decode_warning) {
-                av_log(s->avctx, AV_LOG_INFO, "Cannot parallelize deblocking type 1, decoding such frames in sequential order\n");
-                h0->single_decode_warning = 1;
-            }
-            if(h != h0)
-                return 1; // deblocking switched inside frame
-        }
-    }
-    h->qp_thresh= 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]);
-
-#if 0 //FMO
-    if( h->pps.num_slice_groups > 1  && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5)
-        slice_group_change_cycle= get_bits(&s->gb, ?);
-#endif
-
-    h0->last_slice_type = slice_type;
-    h->slice_num = ++h0->current_slice;
-    if(h->slice_num >= MAX_SLICES){
-        av_log(s->avctx, AV_LOG_ERROR, "Too many slices, increase MAX_SLICES and recompile\n");
-    }
-
-    for(j=0; j<2; j++){
-        int id_list[16];
-        int *ref2frm= h->ref2frm[h->slice_num&(MAX_SLICES-1)][j];
-        for(i=0; i<16; i++){
-            id_list[i]= 60;
-            if(h->ref_list[j][i].data[0]){
-                int k;
-                uint8_t *base= h->ref_list[j][i].base[0];
-                for(k=0; k<h->short_ref_count; k++)
-                    if(h->short_ref[k]->base[0] == base){
-                        id_list[i]= k;
-                        break;
-                    }
-                for(k=0; k<h->long_ref_count; k++)
-                    if(h->long_ref[k] && h->long_ref[k]->base[0] == base){
-                        id_list[i]= h->short_ref_count + k;
-                        break;
-                    }
-            }
-        }
-
-        ref2frm[0]=
-        ref2frm[1]= -1;
-        for(i=0; i<16; i++)
-            ref2frm[i+2]= 4*id_list[i]
-                          +(h->ref_list[j][i].reference&3);
-        ref2frm[18+0]=
-        ref2frm[18+1]= -1;
-        for(i=16; i<48; i++)
-            ref2frm[i+4]= 4*id_list[(i-16)>>1]
-                          +(h->ref_list[j][i].reference&3);
-    }
-
-    h->emu_edge_width= (s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16;
-    h->emu_edge_height= (FRAME_MBAFF || FIELD_PICTURE) ? 0 : h->emu_edge_width;
-
-    if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-        av_log(h->s.avctx, AV_LOG_DEBUG, "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n",
-               h->slice_num,
-               (s->picture_structure==PICT_FRAME ? "F" : s->picture_structure==PICT_TOP_FIELD ? "T" : "B"),
-               first_mb_in_slice,
-               av_get_pict_type_char(h->slice_type), h->slice_type_fixed ? " fix" : "", h->nal_unit_type == NAL_IDR_SLICE ? " IDR" : "",
-               pps_id, h->frame_num,
-               s->current_picture_ptr->field_poc[0], s->current_picture_ptr->field_poc[1],
-               h->ref_count[0], h->ref_count[1],
-               s->qscale,
-               h->deblocking_filter, h->slice_alpha_c0_offset/2-26, h->slice_beta_offset/2-26,
-               h->use_weight,
-               h->use_weight==1 && h->use_weight_chroma ? "c" : "",
-               h->slice_type == FF_B_TYPE ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : ""
-               );
-    }
-
-    return 0;
-}
-
-int ff_h264_get_slice_type(const H264Context *h)
-{
-    switch (h->slice_type) {
-    case FF_P_TYPE:  return 0;
-    case FF_B_TYPE:  return 1;
-    case FF_I_TYPE:  return 2;
-    case FF_SP_TYPE: return 3;
-    case FF_SI_TYPE: return 4;
-    default:         return -1;
-    }
-}
-
-/**
- *
- * @return non zero if the loop filter can be skiped
- */
-static int fill_filter_caches(H264Context *h, int mb_type){
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= h->mb_xy;
-    int top_xy, left_xy[2];
-    int top_type, left_type[2];
-
-    top_xy     = mb_xy  - (s->mb_stride << MB_FIELD);
-
-    //FIXME deblocking could skip the intra and nnz parts.
-
-    /* Wow, what a mess, why didn't they simplify the interlacing & intra
-     * stuff, I can't imagine that these complex rules are worth it. */
-
-    left_xy[1] = left_xy[0] = mb_xy-1;
-    if(FRAME_MBAFF){
-        const int left_mb_field_flag     = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]);
-        const int curr_mb_field_flag     = IS_INTERLACED(mb_type);
-        if(s->mb_y&1){
-            if (left_mb_field_flag != curr_mb_field_flag) {
-                left_xy[0] -= s->mb_stride;
-            }
-        }else{
-            if(curr_mb_field_flag){
-                top_xy      += s->mb_stride & (((s->current_picture.mb_type[top_xy    ]>>7)&1)-1);
-            }
-            if (left_mb_field_flag != curr_mb_field_flag) {
-                left_xy[1] += s->mb_stride;
-            }
-        }
-    }
-
-    h->top_mb_xy = top_xy;
-    h->left_mb_xy[0] = left_xy[0];
-    h->left_mb_xy[1] = left_xy[1];
-    {
-        //for sufficiently low qp, filtering wouldn't do anything
-        //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
-        int qp_thresh = h->qp_thresh; //FIXME strictly we should store qp_thresh for each mb of a slice
-        int qp = s->current_picture.qscale_table[mb_xy];
-        if(qp <= qp_thresh
-           && (left_xy[0]<0 || ((qp + s->current_picture.qscale_table[left_xy[0]] + 1)>>1) <= qp_thresh)
-           && (top_xy   < 0 || ((qp + s->current_picture.qscale_table[top_xy    ] + 1)>>1) <= qp_thresh)){
-            if(!FRAME_MBAFF)
-                return 1;
-            if(   (left_xy[0]< 0            || ((qp + s->current_picture.qscale_table[left_xy[1]             ] + 1)>>1) <= qp_thresh)
-               && (top_xy    < s->mb_stride || ((qp + s->current_picture.qscale_table[top_xy    -s->mb_stride] + 1)>>1) <= qp_thresh))
-                return 1;
-        }
-    }
-
-    top_type     = s->current_picture.mb_type[top_xy]    ;
-    left_type[0] = s->current_picture.mb_type[left_xy[0]];
-    left_type[1] = s->current_picture.mb_type[left_xy[1]];
-    if(h->deblocking_filter == 2){
-        if(h->slice_table[top_xy     ] != h->slice_num) top_type= 0;
-        if(h->slice_table[left_xy[0] ] != h->slice_num) left_type[0]= left_type[1]= 0;
-    }else{
-        if(h->slice_table[top_xy     ] == 0xFFFF) top_type= 0;
-        if(h->slice_table[left_xy[0] ] == 0xFFFF) left_type[0]= left_type[1] =0;
-    }
-    h->top_type    = top_type    ;
-    h->left_type[0]= left_type[0];
-    h->left_type[1]= left_type[1];
-
-    if(IS_INTRA(mb_type))
-        return 0;
-
-    AV_COPY64(&h->non_zero_count_cache[0+8*1], &h->non_zero_count[mb_xy][ 0]);
-    AV_COPY64(&h->non_zero_count_cache[0+8*2], &h->non_zero_count[mb_xy][ 8]);
-    AV_COPY32(&h->non_zero_count_cache[0+8*5], &h->non_zero_count[mb_xy][16]);
-    AV_COPY32(&h->non_zero_count_cache[4+8*3], &h->non_zero_count[mb_xy][20]);
-    AV_COPY64(&h->non_zero_count_cache[0+8*4], &h->non_zero_count[mb_xy][24]);
-
-    h->cbp= h->cbp_table[mb_xy];
-
-    {
-        int list;
-        for(list=0; list<h->list_count; list++){
-            int8_t *ref;
-            int y, b_stride;
-            int16_t (*mv_dst)[2];
-            int16_t (*mv_src)[2];
-
-            if(!USES_LIST(mb_type, list)){
-                fill_rectangle(  h->mv_cache[list][scan8[0]], 4, 4, 8, pack16to32(0,0), 4);
-                AV_WN32A(&h->ref_cache[list][scan8[ 0]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
-                AV_WN32A(&h->ref_cache[list][scan8[ 2]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
-                AV_WN32A(&h->ref_cache[list][scan8[ 8]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
-                AV_WN32A(&h->ref_cache[list][scan8[10]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
-                continue;
-            }
-
-            ref = &s->current_picture.ref_index[list][4*mb_xy];
-            {
-                int (*ref2frm)[64] = h->ref2frm[ h->slice_num&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
-                AV_WN32A(&h->ref_cache[list][scan8[ 0]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
-                AV_WN32A(&h->ref_cache[list][scan8[ 2]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
-                ref += 2;
-                AV_WN32A(&h->ref_cache[list][scan8[ 8]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
-                AV_WN32A(&h->ref_cache[list][scan8[10]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
-            }
-
-            b_stride = h->b_stride;
-            mv_dst   = &h->mv_cache[list][scan8[0]];
-            mv_src   = &s->current_picture.motion_val[list][4*s->mb_x + 4*s->mb_y*b_stride];
-            for(y=0; y<4; y++){
-                AV_COPY128(mv_dst + 8*y, mv_src + y*b_stride);
-            }
-
-        }
-    }
-
-
-/*
-0 . T T. T T T T
-1 L . .L . . . .
-2 L . .L . . . .
-3 . T TL . . . .
-4 L . .L . . . .
-5 L . .. . . . .
-*/
-//FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec)
-    if(top_type){
-        AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][4+3*8]);
-    }
-
-    if(left_type[0]){
-        h->non_zero_count_cache[3+8*1]= h->non_zero_count[left_xy[0]][7+0*8];
-        h->non_zero_count_cache[3+8*2]= h->non_zero_count[left_xy[0]][7+1*8];
-        h->non_zero_count_cache[3+8*3]= h->non_zero_count[left_xy[0]][7+2*8];
-        h->non_zero_count_cache[3+8*4]= h->non_zero_count[left_xy[0]][7+3*8];
-    }
-
-    // CAVLC 8x8dct requires NNZ values for residual decoding that differ from what the loop filter needs
-    if(!CABAC && h->pps.transform_8x8_mode){
-        if(IS_8x8DCT(top_type)){
-            h->non_zero_count_cache[4+8*0]=
-            h->non_zero_count_cache[5+8*0]= h->cbp_table[top_xy] & 4;
-            h->non_zero_count_cache[6+8*0]=
-            h->non_zero_count_cache[7+8*0]= h->cbp_table[top_xy] & 8;
-        }
-        if(IS_8x8DCT(left_type[0])){
-            h->non_zero_count_cache[3+8*1]=
-            h->non_zero_count_cache[3+8*2]= h->cbp_table[left_xy[0]]&2; //FIXME check MBAFF
-        }
-        if(IS_8x8DCT(left_type[1])){
-            h->non_zero_count_cache[3+8*3]=
-            h->non_zero_count_cache[3+8*4]= h->cbp_table[left_xy[1]]&8; //FIXME check MBAFF
-        }
-
-        if(IS_8x8DCT(mb_type)){
-            h->non_zero_count_cache[scan8[0   ]]= h->non_zero_count_cache[scan8[1   ]]=
-            h->non_zero_count_cache[scan8[2   ]]= h->non_zero_count_cache[scan8[3   ]]= h->cbp & 1;
-
-            h->non_zero_count_cache[scan8[0+ 4]]= h->non_zero_count_cache[scan8[1+ 4]]=
-            h->non_zero_count_cache[scan8[2+ 4]]= h->non_zero_count_cache[scan8[3+ 4]]= h->cbp & 2;
-
-            h->non_zero_count_cache[scan8[0+ 8]]= h->non_zero_count_cache[scan8[1+ 8]]=
-            h->non_zero_count_cache[scan8[2+ 8]]= h->non_zero_count_cache[scan8[3+ 8]]= h->cbp & 4;
-
-            h->non_zero_count_cache[scan8[0+12]]= h->non_zero_count_cache[scan8[1+12]]=
-            h->non_zero_count_cache[scan8[2+12]]= h->non_zero_count_cache[scan8[3+12]]= h->cbp & 8;
-        }
-    }
-
-    if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){
-        int list;
-        for(list=0; list<h->list_count; list++){
-            if(USES_LIST(top_type, list)){
-                const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
-                const int b8_xy= 4*top_xy + 2;
-                int (*ref2frm)[64] = h->ref2frm[ h->slice_table[top_xy]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
-                AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
-                h->ref_cache[list][scan8[0] + 0 - 1*8]=
-                h->ref_cache[list][scan8[0] + 1 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]];
-                h->ref_cache[list][scan8[0] + 2 - 1*8]=
-                h->ref_cache[list][scan8[0] + 3 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]];
-            }else{
-                AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
-                AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
-            }
-
-            if(!IS_INTERLACED(mb_type^left_type[0])){
-                if(USES_LIST(left_type[0], list)){
-                    const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
-                    const int b8_xy= 4*left_xy[0] + 1;
-                    int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[0]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
-                    AV_COPY32(h->mv_cache[list][scan8[0] - 1 + 0 ], s->current_picture.motion_val[list][b_xy + h->b_stride*0]);
-                    AV_COPY32(h->mv_cache[list][scan8[0] - 1 + 8 ], s->current_picture.motion_val[list][b_xy + h->b_stride*1]);
-                    AV_COPY32(h->mv_cache[list][scan8[0] - 1 +16 ], s->current_picture.motion_val[list][b_xy + h->b_stride*2]);
-                    AV_COPY32(h->mv_cache[list][scan8[0] - 1 +24 ], s->current_picture.motion_val[list][b_xy + h->b_stride*3]);
-                    h->ref_cache[list][scan8[0] - 1 + 0 ]=
-                    h->ref_cache[list][scan8[0] - 1 + 8 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*0]];
-                    h->ref_cache[list][scan8[0] - 1 +16 ]=
-                    h->ref_cache[list][scan8[0] - 1 +24 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*1]];
-                }else{
-                    AV_ZERO32(h->mv_cache [list][scan8[0] - 1 + 0 ]);
-                    AV_ZERO32(h->mv_cache [list][scan8[0] - 1 + 8 ]);
-                    AV_ZERO32(h->mv_cache [list][scan8[0] - 1 +16 ]);
-                    AV_ZERO32(h->mv_cache [list][scan8[0] - 1 +24 ]);
-                    h->ref_cache[list][scan8[0] - 1 + 0  ]=
-                    h->ref_cache[list][scan8[0] - 1 + 8  ]=
-                    h->ref_cache[list][scan8[0] - 1 + 16 ]=
-                    h->ref_cache[list][scan8[0] - 1 + 24 ]= LIST_NOT_USED;
-                }
-            }
-        }
-    }
-
-    return 0;
-}
-
-static void loop_filter(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    uint8_t  *dest_y, *dest_cb, *dest_cr;
-    int linesize, uvlinesize, mb_x, mb_y;
-    const int end_mb_y= s->mb_y + FRAME_MBAFF;
-    const int old_slice_type= h->slice_type;
-
-    if(h->deblocking_filter) {
-        for(mb_x= 0; mb_x<s->mb_width; mb_x++){
-            for(mb_y=end_mb_y - FRAME_MBAFF; mb_y<= end_mb_y; mb_y++){
-                int mb_xy, mb_type;
-                mb_xy = h->mb_xy = mb_x + mb_y*s->mb_stride;
-                h->slice_num= h->slice_table[mb_xy];
-                mb_type= s->current_picture.mb_type[mb_xy];
-                h->list_count= h->list_counts[mb_xy];
-
-                if(FRAME_MBAFF)
-                    h->mb_mbaff = h->mb_field_decoding_flag = !!IS_INTERLACED(mb_type);
-
-                s->mb_x= mb_x;
-                s->mb_y= mb_y;
-                dest_y  = s->current_picture.data[0] + (mb_x + mb_y * s->linesize  ) * 16;
-                dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8;
-                dest_cr = s->current_picture.data[2] + (mb_x + mb_y * s->uvlinesize) * 8;
-                    //FIXME simplify above
-
-                if (MB_FIELD) {
-                    linesize   = h->mb_linesize   = s->linesize * 2;
-                    uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
-                    if(mb_y&1){ //FIXME move out of this function?
-                        dest_y -= s->linesize*15;
-                        dest_cb-= s->uvlinesize*7;
-                        dest_cr-= s->uvlinesize*7;
-                    }
-                } else {
-                    linesize   = h->mb_linesize   = s->linesize;
-                    uvlinesize = h->mb_uvlinesize = s->uvlinesize;
-                }
-                backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0);
-                if(fill_filter_caches(h, mb_type))
-                    continue;
-                h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
-                h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
-
-                if (FRAME_MBAFF) {
-                    ff_h264_filter_mb     (h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
-                } else {
-                    ff_h264_filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
-                }
-            }
-        }
-    }
-    h->slice_type= old_slice_type;
-    s->mb_x= 0;
-    s->mb_y= end_mb_y - FRAME_MBAFF;
-    h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
-    h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
-}
-
-static void predict_field_decoding_flag(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
-    int mb_type = (h->slice_table[mb_xy-1] == h->slice_num)
-                ? s->current_picture.mb_type[mb_xy-1]
-                : (h->slice_table[mb_xy-s->mb_stride] == h->slice_num)
-                ? s->current_picture.mb_type[mb_xy-s->mb_stride]
-                : 0;
-    h->mb_mbaff = h->mb_field_decoding_flag = IS_INTERLACED(mb_type) ? 1 : 0;
-}
-
-static int decode_slice(struct AVCodecContext *avctx, void *arg){
-    H264Context *h = *(void**)arg;
-    MpegEncContext * const s = &h->s;
-    const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
-
-    s->mb_skip_run= -1;
-
-    h->is_complex = FRAME_MBAFF || s->picture_structure != PICT_FRAME || s->codec_id != CODEC_ID_H264 ||
-                    (CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));
-
-    if( h->pps.cabac ) {
-        /* realign */
-        align_get_bits( &s->gb );
-
-        /* init cabac */
-        ff_init_cabac_states( &h->cabac);
-        ff_init_cabac_decoder( &h->cabac,
-                               s->gb.buffer + get_bits_count(&s->gb)/8,
-                               (get_bits_left(&s->gb) + 7)/8);
-
-        ff_h264_init_cabac_states(h);
-
-        for(;;){
-//START_TIMER
-            int ret = ff_h264_decode_mb_cabac(h);
-            int eos;
-//STOP_TIMER("decode_mb_cabac")
-
-            if(ret>=0) ff_h264_hl_decode_mb(h);
-
-            if( ret >= 0 && FRAME_MBAFF ) { //FIXME optimal? or let mb_decode decode 16x32 ?
-                s->mb_y++;
-
-                ret = ff_h264_decode_mb_cabac(h);
-
-                if(ret>=0) ff_h264_hl_decode_mb(h);
-                s->mb_y--;
-            }
-            eos = get_cabac_terminate( &h->cabac );
-
-            if((s->workaround_bugs & FF_BUG_TRUNCATED) && h->cabac.bytestream > h->cabac.bytestream_end + 2){
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-                return 0;
-            }
-            if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) {
-                av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", s->mb_x, s->mb_y, h->cabac.bytestream_end - h->cabac.bytestream);
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
-                return -1;
-            }
-
-            if( ++s->mb_x >= s->mb_width ) {
-                s->mb_x = 0;
-                loop_filter(h);
-                ff_draw_horiz_band(s, 16*s->mb_y, 16);
-                ++s->mb_y;
-                if(FIELD_OR_MBAFF_PICTURE) {
-                    ++s->mb_y;
-                    if(FRAME_MBAFF && s->mb_y < s->mb_height)
-                        predict_field_decoding_flag(h);
-                }
-            }
-
-            if( eos || s->mb_y >= s->mb_height ) {
-                tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-                return 0;
-            }
-        }
-
-    } else {
-        for(;;){
-            int ret = ff_h264_decode_mb_cavlc(h);
-
-            if(ret>=0) ff_h264_hl_decode_mb(h);
-
-            if(ret>=0 && FRAME_MBAFF){ //FIXME optimal? or let mb_decode decode 16x32 ?
-                s->mb_y++;
-                ret = ff_h264_decode_mb_cavlc(h);
-
-                if(ret>=0) ff_h264_hl_decode_mb(h);
-                s->mb_y--;
-            }
-
-            if(ret<0){
-                av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
-
-                return -1;
-            }
-
-            if(++s->mb_x >= s->mb_width){
-                s->mb_x=0;
-                loop_filter(h);
-                ff_draw_horiz_band(s, 16*s->mb_y, 16);
-                ++s->mb_y;
-                if(FIELD_OR_MBAFF_PICTURE) {
-                    ++s->mb_y;
-                    if(FRAME_MBAFF && s->mb_y < s->mb_height)
-                        predict_field_decoding_flag(h);
-                }
-                if(s->mb_y >= s->mb_height){
-                    tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
-
-                    if(get_bits_count(&s->gb) == s->gb.size_in_bits ) {
-                        ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-                        return 0;
-                    }else{
-                        ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-                        return -1;
-                    }
-                }
-            }
-
-            if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->mb_skip_run<=0){
-                tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
-                if(get_bits_count(&s->gb) == s->gb.size_in_bits ){
-                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-                    return 0;
-                }else{
-                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
-
-                    return -1;
-                }
-            }
-        }
-    }
-
-#if 0
-    for(;s->mb_y < s->mb_height; s->mb_y++){
-        for(;s->mb_x < s->mb_width; s->mb_x++){
-            int ret= decode_mb(h);
-
-            ff_h264_hl_decode_mb(h);
-
-            if(ret<0){
-                av_log(s->avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
-
-                return -1;
-            }
-
-            if(++s->mb_x >= s->mb_width){
-                s->mb_x=0;
-                if(++s->mb_y >= s->mb_height){
-                    if(get_bits_count(s->gb) == s->gb.size_in_bits){
-                        ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-                        return 0;
-                    }else{
-                        ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-                        return -1;
-                    }
-                }
-            }
-
-            if(get_bits_count(s->?gb) >= s->gb?.size_in_bits){
-                if(get_bits_count(s->gb) == s->gb.size_in_bits){
-                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
-
-                    return 0;
-                }else{
-                    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
-
-                    return -1;
-                }
-            }
-        }
-        s->mb_x=0;
-        ff_draw_horiz_band(s, 16*s->mb_y, 16);
-    }
-#endif
-    return -1; //not reached
-}
-
-/**
- * Call decode_slice() for each context.
- *
- * @param h h264 master context
- * @param context_count number of contexts to execute
- */
-static void execute_decode_slices(H264Context *h, int context_count){
-    MpegEncContext * const s = &h->s;
-    AVCodecContext * const avctx= s->avctx;
-    H264Context *hx;
-    int i;
-
-    if (s->avctx->hwaccel)
-        return;
-    if(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-        return;
-    if(context_count == 1) {
-        decode_slice(avctx, &h);
-    } else {
-        for(i = 1; i < context_count; i++) {
-            hx = h->thread_context[i];
-            hx->s.error_recognition = avctx->error_recognition;
-            hx->s.error_count = 0;
-        }
-
-        avctx->execute(avctx, (void *)decode_slice,
-                       h->thread_context, NULL, context_count, sizeof(void*));
-
-        /* pull back stuff from slices to master context */
-        hx = h->thread_context[context_count - 1];
-        s->mb_x = hx->s.mb_x;
-        s->mb_y = hx->s.mb_y;
-        s->dropable = hx->s.dropable;
-        s->picture_structure = hx->s.picture_structure;
-        for(i = 1; i < context_count; i++)
-            h->s.error_count += h->thread_context[i]->s.error_count;
-    }
-}
-
-
-static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
-    MpegEncContext * const s = &h->s;
-    AVCodecContext * const avctx= s->avctx;
-    int buf_index=0;
-    H264Context *hx; ///< thread context
-    int context_count = 0;
-    int next_avc= h->is_avc ? 0 : buf_size;
-
-    h->max_contexts = avctx->thread_count;
-#if 0
-    int i;
-    for(i=0; i<50; i++){
-        av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]);
-    }
-#endif
-    if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){
-        h->current_slice = 0;
-        if (!s->first_field)
-            s->current_picture_ptr= NULL;
-        ff_h264_reset_sei(h);
-    }
-
-    for(;;){
-        int consumed;
-        int dst_length;
-        int bit_length;
-        const uint8_t *ptr;
-        int i, nalsize = 0;
-        int err;
-
-        if(buf_index >= next_avc) {
-            if(buf_index >= buf_size) break;
-            nalsize = 0;
-            for(i = 0; i < h->nal_length_size; i++)
-                nalsize = (nalsize << 8) | buf[buf_index++];
-            if(nalsize <= 1 || nalsize > buf_size - buf_index){
-                if(nalsize == 1){
-                    buf_index++;
-                    continue;
-                }else{
-                    av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize);
-                    break;
-                }
-            }
-            next_avc= buf_index + nalsize;
-        } else {
-            // start code prefix search
-            for(; buf_index + 3 < next_avc; buf_index++){
-                // This should always succeed in the first iteration.
-                if(buf[buf_index] == 0 && buf[buf_index+1] == 0 && buf[buf_index+2] == 1)
-                    break;
-            }
-
-            if(buf_index+3 >= buf_size) break;
-
-            buf_index+=3;
-            if(buf_index >= next_avc) continue;
-        }
-
-        hx = h->thread_context[context_count];
-
-        ptr= ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index);
-        if (ptr==NULL || dst_length < 0){
-            return -1;
-        }
-        i= buf_index + consumed;
-        if((s->workaround_bugs & FF_BUG_AUTODETECT) && i+3<next_avc &&
-           buf[i]==0x00 && buf[i+1]==0x00 && buf[i+2]==0x01 && buf[i+3]==0xE0)
-            s->workaround_bugs |= FF_BUG_TRUNCATED;
-
-        if(!(s->workaround_bugs & FF_BUG_TRUNCATED)){
-        while(ptr[dst_length - 1] == 0 && dst_length > 0)
-            dst_length--;
-        }
-        bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1));
-
-        if(s->avctx->debug&FF_DEBUG_STARTCODE){
-            av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d at %d/%d length %d\n", hx->nal_unit_type, buf_index, buf_size, dst_length);
-        }
-
-        if (h->is_avc && (nalsize != consumed) && nalsize){
-            av_log(h->s.avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize);
-        }
-
-        buf_index += consumed;
-
-        if(  (s->hurry_up == 1 && h->nal_ref_idc  == 0) //FIXME do not discard SEI id
-           ||(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc  == 0))
-            continue;
-
-      again:
-        err = 0;
-        switch(hx->nal_unit_type){
-        case NAL_IDR_SLICE:
-            if (h->nal_unit_type != NAL_IDR_SLICE) {
-                av_log(h->s.avctx, AV_LOG_ERROR, "Invalid mix of idr and non-idr slices");
-                return -1;
-            }
-            idr(h); //FIXME ensure we don't loose some frames if there is reordering
-        case NAL_SLICE:
-            init_get_bits(&hx->s.gb, ptr, bit_length);
-            hx->intra_gb_ptr=
-            hx->inter_gb_ptr= &hx->s.gb;
-            hx->s.data_partitioning = 0;
-
-            if((err = decode_slice_header(hx, h)))
-               break;
-
-            if (h->current_slice == 1) {
-                if (s->avctx->hwaccel && s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0)
-                    return -1;
-                if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-                    ff_vdpau_h264_picture_start(s);
-            }
-
-            s->current_picture_ptr->key_frame |=
-                    (hx->nal_unit_type == NAL_IDR_SLICE) ||
-                    (h->sei_recovery_frame_cnt >= 0);
-            if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5
-               && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
-               && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
-               && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
-               && avctx->skip_frame < AVDISCARD_ALL){
-                if(avctx->hwaccel) {
-                    if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0)
-                        return -1;
-                }else
-                if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){
-                    static const uint8_t start_code[] = {0x00, 0x00, 0x01};
-                    ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code));
-                    ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed );
-                }else
-                    context_count++;
-            }
-            break;
-        case NAL_DPA:
-            init_get_bits(&hx->s.gb, ptr, bit_length);
-            hx->intra_gb_ptr=
-            hx->inter_gb_ptr= NULL;
-
-            if ((err = decode_slice_header(hx, h)) < 0)
-                break;
-
-            hx->s.data_partitioning = 1;
-
-            break;
-        case NAL_DPB:
-            init_get_bits(&hx->intra_gb, ptr, bit_length);
-            hx->intra_gb_ptr= &hx->intra_gb;
-            break;
-        case NAL_DPC:
-            init_get_bits(&hx->inter_gb, ptr, bit_length);
-            hx->inter_gb_ptr= &hx->inter_gb;
-
-            if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
-               && s->context_initialized
-               && s->hurry_up < 5
-               && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
-               && (avctx->skip_frame < AVDISCARD_BIDIR  || hx->slice_type_nos!=FF_B_TYPE)
-               && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
-               && avctx->skip_frame < AVDISCARD_ALL)
-                context_count++;
-            break;
-        case NAL_SEI:
-            init_get_bits(&s->gb, ptr, bit_length);
-            ff_h264_decode_sei(h);
-            break;
-        case NAL_SPS:
-            init_get_bits(&s->gb, ptr, bit_length);
-            ff_h264_decode_seq_parameter_set(h);
-
-            if(s->flags& CODEC_FLAG_LOW_DELAY)
-                s->low_delay=1;
-
-            if(avctx->has_b_frames < 2)
-                avctx->has_b_frames= !s->low_delay;
-            break;
-        case NAL_PPS:
-            init_get_bits(&s->gb, ptr, bit_length);
-
-            ff_h264_decode_picture_parameter_set(h, bit_length);
-
-            break;
-        case NAL_AUD:
-        case NAL_END_SEQUENCE:
-        case NAL_END_STREAM:
-        case NAL_FILLER_DATA:
-        case NAL_SPS_EXT:
-        case NAL_AUXILIARY_SLICE:
-            break;
-        default:
-            av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", hx->nal_unit_type, bit_length);
-        }
-
-        if(context_count == h->max_contexts) {
-            execute_decode_slices(h, context_count);
-            context_count = 0;
-        }
-
-        if (err < 0)
-            av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n");
-        else if(err == 1) {
-            /* Slice could not be decoded in parallel mode, copy down
-             * NAL unit stuff to context 0 and restart. Note that
-             * rbsp_buffer is not transferred, but since we no longer
-             * run in parallel mode this should not be an issue. */
-            h->nal_unit_type = hx->nal_unit_type;
-            h->nal_ref_idc   = hx->nal_ref_idc;
-            hx = h;
-            goto again;
-        }
-    }
-    if(context_count)
-        execute_decode_slices(h, context_count);
-    return buf_index;
-}
-
-/**
- * returns the number of bytes consumed for building the current frame
- */
-static int get_consumed_bytes(MpegEncContext *s, int pos, int buf_size){
-        if(pos==0) pos=1; //avoid infinite loops (i doubt that is needed but ...)
-        if(pos+10>buf_size) pos=buf_size; // oops ;)
-
-        return pos;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    H264Context *h = avctx->priv_data;
-    MpegEncContext *s = &h->s;
-    AVFrame *pict = data;
-    int buf_index;
-
-    s->flags= avctx->flags;
-    s->flags2= avctx->flags2;
-
-   /* end of stream, output what is still in the buffers */
-    if (buf_size == 0) {
-        Picture *out;
-        int i, out_idx;
-
-//FIXME factorize this with the output code below
-        out = h->delayed_pic[0];
-        out_idx = 0;
-        for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && !h->delayed_pic[i]->mmco_reset; i++)
-            if(h->delayed_pic[i]->poc < out->poc){
-                out = h->delayed_pic[i];
-                out_idx = i;
-            }
-
-        for(i=out_idx; h->delayed_pic[i]; i++)
-            h->delayed_pic[i] = h->delayed_pic[i+1];
-
-        if(out){
-            *data_size = sizeof(AVFrame);
-            *pict= *(AVFrame*)out;
-        }
-
-        return 0;
-    }
-
-    buf_index=decode_nal_units(h, buf, buf_size);
-    if(buf_index < 0)
-        return -1;
-
-    if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
-        if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0;
-        av_log(avctx, AV_LOG_ERROR, "no frame!\n");
-        return -1;
-    }
-
-    if(!(s->flags2 & CODEC_FLAG2_CHUNKS) || (s->mb_y >= s->mb_height && s->mb_height)){
-        Picture *out = s->current_picture_ptr;
-        Picture *cur = s->current_picture_ptr;
-        int i, pics, out_of_order, out_idx;
-
-        field_end(h);
-
-        if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) {
-            /* Wait for second field. */
-            *data_size = 0;
-
-        } else {
-            cur->interlaced_frame = 0;
-            cur->repeat_pict = 0;
-
-            /* Signal interlacing information externally. */
-            /* Prioritize picture timing SEI information over used decoding process if it exists. */
-
-            if(h->sps.pic_struct_present_flag){
-                switch (h->sei_pic_struct)
-                {
-                case SEI_PIC_STRUCT_FRAME:
-                    break;
-                case SEI_PIC_STRUCT_TOP_FIELD:
-                case SEI_PIC_STRUCT_BOTTOM_FIELD:
-                    cur->interlaced_frame = 1;
-                    break;
-                case SEI_PIC_STRUCT_TOP_BOTTOM:
-                case SEI_PIC_STRUCT_BOTTOM_TOP:
-                    if (FIELD_OR_MBAFF_PICTURE)
-                        cur->interlaced_frame = 1;
-                    else
-                        // try to flag soft telecine progressive
-                        cur->interlaced_frame = h->prev_interlaced_frame;
-                    break;
-                case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
-                case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
-                    // Signal the possibility of telecined film externally (pic_struct 5,6)
-                    // From these hints, let the applications decide if they apply deinterlacing.
-                    cur->repeat_pict = 1;
-                    break;
-                case SEI_PIC_STRUCT_FRAME_DOUBLING:
-                    // Force progressive here, as doubling interlaced frame is a bad idea.
-                    cur->repeat_pict = 2;
-                    break;
-                case SEI_PIC_STRUCT_FRAME_TRIPLING:
-                    cur->repeat_pict = 4;
-                    break;
-                }
-
-                if ((h->sei_ct_type & 3) && h->sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP)
-                    cur->interlaced_frame = (h->sei_ct_type & (1<<1)) != 0;
-            }else{
-                /* Derive interlacing flag from used decoding process. */
-                cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE;
-            }
-            h->prev_interlaced_frame = cur->interlaced_frame;
-
-            if (cur->field_poc[0] != cur->field_poc[1]){
-                /* Derive top_field_first from field pocs. */
-                cur->top_field_first = cur->field_poc[0] < cur->field_poc[1];
-            }else{
-                if(cur->interlaced_frame || h->sps.pic_struct_present_flag){
-                    /* Use picture timing SEI information. Even if it is a information of a past frame, better than nothing. */
-                    if(h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM
-                      || h->sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
-                        cur->top_field_first = 1;
-                    else
-                        cur->top_field_first = 0;
-                }else{
-                    /* Most likely progressive */
-                    cur->top_field_first = 0;
-                }
-            }
-
-        //FIXME do something with unavailable reference frames
-
-            /* Sort B-frames into display order */
-
-            if(h->sps.bitstream_restriction_flag
-               && s->avctx->has_b_frames < h->sps.num_reorder_frames){
-                s->avctx->has_b_frames = h->sps.num_reorder_frames;
-                s->low_delay = 0;
-            }
-
-            if(   s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT
-               && !h->sps.bitstream_restriction_flag){
-                s->avctx->has_b_frames= MAX_DELAYED_PIC_COUNT;
-                s->low_delay= 0;
-            }
-
-            pics = 0;
-            while(h->delayed_pic[pics]) pics++;
-
-            assert(pics <= MAX_DELAYED_PIC_COUNT);
-
-            h->delayed_pic[pics++] = cur;
-            if(cur->reference == 0)
-                cur->reference = DELAYED_PIC_REF;
-
-            out = h->delayed_pic[0];
-            out_idx = 0;
-            for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && !h->delayed_pic[i]->mmco_reset; i++)
-                if(h->delayed_pic[i]->poc < out->poc){
-                    out = h->delayed_pic[i];
-                    out_idx = i;
-                }
-            if(s->avctx->has_b_frames == 0 && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset))
-                h->outputed_poc= INT_MIN;
-            out_of_order = out->poc < h->outputed_poc;
-
-            if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames)
-                { }
-            else if((out_of_order && pics-1 == s->avctx->has_b_frames && s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT)
-               || (s->low_delay &&
-                ((h->outputed_poc != INT_MIN && out->poc > h->outputed_poc + 2)
-                 || cur->pict_type == FF_B_TYPE)))
-            {
-                s->low_delay = 0;
-                s->avctx->has_b_frames++;
-            }
-
-            if(out_of_order || pics > s->avctx->has_b_frames){
-                out->reference &= ~DELAYED_PIC_REF;
-                for(i=out_idx; h->delayed_pic[i]; i++)
-                    h->delayed_pic[i] = h->delayed_pic[i+1];
-            }
-            if(!out_of_order && pics > s->avctx->has_b_frames){
-                *data_size = sizeof(AVFrame);
-
-                if(out_idx==0 && h->delayed_pic[0] && (h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reset)) {
-                    h->outputed_poc = INT_MIN;
-                } else
-                    h->outputed_poc = out->poc;
-                *pict= *(AVFrame*)out;
-            }else{
-                av_log(avctx, AV_LOG_DEBUG, "no picture\n");
-            }
-        }
-    }
-
-    assert(pict->data[0] || !*data_size);
-    ff_print_debug_info(s, pict);
-//printf("out %d\n", (int)pict->data[0]);
-
-    return get_consumed_bytes(s, buf_index, buf_size);
-}
-#if 0
-static inline void fill_mb_avail(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
-
-    if(s->mb_y){
-        h->mb_avail[0]= s->mb_x                 && h->slice_table[mb_xy - s->mb_stride - 1] == h->slice_num;
-        h->mb_avail[1]=                            h->slice_table[mb_xy - s->mb_stride    ] == h->slice_num;
-        h->mb_avail[2]= s->mb_x+1 < s->mb_width && h->slice_table[mb_xy - s->mb_stride + 1] == h->slice_num;
-    }else{
-        h->mb_avail[0]=
-        h->mb_avail[1]=
-        h->mb_avail[2]= 0;
-    }
-    h->mb_avail[3]= s->mb_x && h->slice_table[mb_xy - 1] == h->slice_num;
-    h->mb_avail[4]= 1; //FIXME move out
-    h->mb_avail[5]= 0; //FIXME move out
-}
-#endif
-
-#ifdef TEST
-#undef printf
-#undef random
-#define COUNT 8000
-#define SIZE (COUNT*40)
-int main(void){
-    int i;
-    uint8_t temp[SIZE];
-    PutBitContext pb;
-    GetBitContext gb;
-//    int int_temp[10000];
-    DSPContext dsp;
-    AVCodecContext avctx;
-
-    dsputil_init(&dsp, &avctx);
-
-    init_put_bits(&pb, temp, SIZE);
-    printf("testing unsigned exp golomb\n");
-    for(i=0; i<COUNT; i++){
-        START_TIMER
-        set_ue_golomb(&pb, i);
-        STOP_TIMER("set_ue_golomb");
-    }
-    flush_put_bits(&pb);
-
-    init_get_bits(&gb, temp, 8*SIZE);
-    for(i=0; i<COUNT; i++){
-        int j, s;
-
-        s= show_bits(&gb, 24);
-
-        START_TIMER
-        j= get_ue_golomb(&gb);
-        if(j != i){
-            printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
-//            return -1;
-        }
-        STOP_TIMER("get_ue_golomb");
-    }
-
-
-    init_put_bits(&pb, temp, SIZE);
-    printf("testing signed exp golomb\n");
-    for(i=0; i<COUNT; i++){
-        START_TIMER
-        set_se_golomb(&pb, i - COUNT/2);
-        STOP_TIMER("set_se_golomb");
-    }
-    flush_put_bits(&pb);
-
-    init_get_bits(&gb, temp, 8*SIZE);
-    for(i=0; i<COUNT; i++){
-        int j, s;
-
-        s= show_bits(&gb, 24);
-
-        START_TIMER
-        j= get_se_golomb(&gb);
-        if(j != i - COUNT/2){
-            printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
-//            return -1;
-        }
-        STOP_TIMER("get_se_golomb");
-    }
-
-#if 0
-    printf("testing 4x4 (I)DCT\n");
-
-    DCTELEM block[16];
-    uint8_t src[16], ref[16];
-    uint64_t error= 0, max_error=0;
-
-    for(i=0; i<COUNT; i++){
-        int j;
-//        printf("%d %d %d\n", r1, r2, (r2-r1)*16);
-        for(j=0; j<16; j++){
-            ref[j]= random()%255;
-            src[j]= random()%255;
-        }
-
-        h264_diff_dct_c(block, src, ref, 4);
-
-        //normalize
-        for(j=0; j<16; j++){
-//            printf("%d ", block[j]);
-            block[j]= block[j]*4;
-            if(j&1) block[j]= (block[j]*4 + 2)/5;
-            if(j&4) block[j]= (block[j]*4 + 2)/5;
-        }
-//        printf("\n");
-
-        h->h264dsp.h264_idct_add(ref, block, 4);
-/*        for(j=0; j<16; j++){
-            printf("%d ", ref[j]);
-        }
-        printf("\n");*/
-
-        for(j=0; j<16; j++){
-            int diff= FFABS(src[j] - ref[j]);
-
-            error+= diff*diff;
-            max_error= FFMAX(max_error, diff);
-        }
-    }
-    printf("error=%f max_error=%d\n", ((float)error)/COUNT/16, (int)max_error );
-    printf("testing quantizer\n");
-    for(qp=0; qp<52; qp++){
-        for(i=0; i<16; i++)
-            src1_block[i]= src2_block[i]= random()%255;
-
-    }
-    printf("Testing NAL layer\n");
-
-    uint8_t bitstream[COUNT];
-    uint8_t nal[COUNT*2];
-    H264Context h;
-    memset(&h, 0, sizeof(H264Context));
-
-    for(i=0; i<COUNT; i++){
-        int zeros= i;
-        int nal_length;
-        int consumed;
-        int out_length;
-        uint8_t *out;
-        int j;
-
-        for(j=0; j<COUNT; j++){
-            bitstream[j]= (random() % 255) + 1;
-        }
-
-        for(j=0; j<zeros; j++){
-            int pos= random() % COUNT;
-            while(bitstream[pos] == 0){
-                pos++;
-                pos %= COUNT;
-            }
-            bitstream[pos]=0;
-        }
-
-        START_TIMER
-
-        nal_length= encode_nal(&h, nal, bitstream, COUNT, COUNT*2);
-        if(nal_length<0){
-            printf("encoding failed\n");
-            return -1;
-        }
-
-        out= ff_h264_decode_nal(&h, nal, &out_length, &consumed, nal_length);
-
-        STOP_TIMER("NAL")
-
-        if(out_length != COUNT){
-            printf("incorrect length %d %d\n", out_length, COUNT);
-            return -1;
-        }
-
-        if(consumed != nal_length){
-            printf("incorrect consumed length %d %d\n", nal_length, consumed);
-            return -1;
-        }
-
-        if(memcmp(bitstream, out, COUNT)){
-            printf("mismatch\n");
-            return -1;
-        }
-    }
-#endif
-
-    printf("Testing RBSP\n");
-
-
-    return 0;
-}
-#endif /* TEST */
-
-
-av_cold void ff_h264_free_context(H264Context *h)
-{
-    int i;
-
-    free_tables(h); //FIXME cleanup init stuff perhaps
-
-    for(i = 0; i < MAX_SPS_COUNT; i++)
-        av_freep(h->sps_buffers + i);
-
-    for(i = 0; i < MAX_PPS_COUNT; i++)
-        av_freep(h->pps_buffers + i);
-}
-
-av_cold int ff_h264_decode_end(AVCodecContext *avctx)
-{
-    H264Context *h = avctx->priv_data;
-    MpegEncContext *s = &h->s;
-
-    ff_h264_free_context(h);
-
-    MPV_common_end(s);
-
-//    memset(h, 0, sizeof(H264Context));
-
-    return 0;
-}
-
-
-AVCodec h264_decoder = {
-    "h264",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H264,
-    sizeof(H264Context),
-    ff_h264_decode_init,
-    NULL,
-    ff_h264_decode_end,
-    decode_frame,
-    /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    .flush= flush_dpb,
-    .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
-    .pix_fmts= ff_hwaccel_pixfmt_list_420,
-};
-
-#if CONFIG_H264_VDPAU_DECODER
-AVCodec h264_vdpau_decoder = {
-    "h264_vdpau",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H264,
-    sizeof(H264Context),
-    ff_h264_decode_init,
-    NULL,
-    ff_h264_decode_end,
-    decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
-    .flush= flush_dpb,
-    .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_H264, PIX_FMT_NONE},
-};
-#endif
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
deleted file mode 100644
index c6563af..0000000
--- a/libavcodec/h264.h
+++ /dev/null
@@ -1,1299 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 codec.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_H264_H
-#define AVCODEC_H264_H
-
-#include "libavutil/intreadwrite.h"
-#include "dsputil.h"
-#include "cabac.h"
-#include "mpegvideo.h"
-#include "h264dsp.h"
-#include "h264pred.h"
-#include "rectangle.h"
-
-#define interlaced_dct interlaced_dct_is_a_bad_name
-#define mb_intra mb_intra_is_not_initialized_see_mb_type
-
-#define LUMA_DC_BLOCK_INDEX   25
-#define CHROMA_DC_BLOCK_INDEX 26
-
-#define CHROMA_DC_COEFF_TOKEN_VLC_BITS 8
-#define COEFF_TOKEN_VLC_BITS           8
-#define TOTAL_ZEROS_VLC_BITS           9
-#define CHROMA_DC_TOTAL_ZEROS_VLC_BITS 3
-#define RUN_VLC_BITS                   3
-#define RUN7_VLC_BITS                  6
-
-#define MAX_SPS_COUNT 32
-#define MAX_PPS_COUNT 256
-
-#define MAX_MMCO_COUNT 66
-
-#define MAX_DELAYED_PIC_COUNT 16
-
-/* Compiling in interlaced support reduces the speed
- * of progressive decoding by about 2%. */
-#define ALLOW_INTERLACE
-
-#define ALLOW_NOCHROMA
-
-#define FMO 0
-
-/**
- * The maximum number of slices supported by the decoder.
- * must be a power of 2
- */
-#define MAX_SLICES 16
-
-#ifdef ALLOW_INTERLACE
-#define MB_MBAFF h->mb_mbaff
-#define MB_FIELD h->mb_field_decoding_flag
-#define FRAME_MBAFF h->mb_aff_frame
-#define FIELD_PICTURE (s->picture_structure != PICT_FRAME)
-#else
-#define MB_MBAFF 0
-#define MB_FIELD 0
-#define FRAME_MBAFF 0
-#define FIELD_PICTURE 0
-#undef  IS_INTERLACED
-#define IS_INTERLACED(mb_type) 0
-#endif
-#define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF || FIELD_PICTURE)
-
-#ifdef ALLOW_NOCHROMA
-#define CHROMA h->sps.chroma_format_idc
-#else
-#define CHROMA 1
-#endif
-
-#ifndef CABAC
-#define CABAC h->pps.cabac
-#endif
-
-#define EXTENDED_SAR          255
-
-#define MB_TYPE_REF0       MB_TYPE_ACPRED //dirty but it fits in 16 bit
-#define MB_TYPE_8x8DCT     0x01000000
-#define IS_REF0(a)         ((a) & MB_TYPE_REF0)
-#define IS_8x8DCT(a)       ((a) & MB_TYPE_8x8DCT)
-
-/**
- * Value of Picture.reference when Picture is not a reference picture, but
- * is held for delayed output.
- */
-#define DELAYED_PIC_REF 4
-
-
-/* NAL unit types */
-enum {
-    NAL_SLICE=1,
-    NAL_DPA,
-    NAL_DPB,
-    NAL_DPC,
-    NAL_IDR_SLICE,
-    NAL_SEI,
-    NAL_SPS,
-    NAL_PPS,
-    NAL_AUD,
-    NAL_END_SEQUENCE,
-    NAL_END_STREAM,
-    NAL_FILLER_DATA,
-    NAL_SPS_EXT,
-    NAL_AUXILIARY_SLICE=19
-};
-
-/**
- * SEI message types
- */
-typedef enum {
-    SEI_BUFFERING_PERIOD             =  0, ///< buffering period (H.264, D.1.1)
-    SEI_TYPE_PIC_TIMING              =  1, ///< picture timing
-    SEI_TYPE_USER_DATA_UNREGISTERED  =  5, ///< unregistered user data
-    SEI_TYPE_RECOVERY_POINT          =  6  ///< recovery point (frame # to decoder sync)
-} SEI_Type;
-
-/**
- * pic_struct in picture timing SEI message
- */
-typedef enum {
-    SEI_PIC_STRUCT_FRAME             = 0, ///<  0: %frame
-    SEI_PIC_STRUCT_TOP_FIELD         = 1, ///<  1: top field
-    SEI_PIC_STRUCT_BOTTOM_FIELD      = 2, ///<  2: bottom field
-    SEI_PIC_STRUCT_TOP_BOTTOM        = 3, ///<  3: top field, bottom field, in that order
-    SEI_PIC_STRUCT_BOTTOM_TOP        = 4, ///<  4: bottom field, top field, in that order
-    SEI_PIC_STRUCT_TOP_BOTTOM_TOP    = 5, ///<  5: top field, bottom field, top field repeated, in that order
-    SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///<  6: bottom field, top field, bottom field repeated, in that order
-    SEI_PIC_STRUCT_FRAME_DOUBLING    = 7, ///<  7: %frame doubling
-    SEI_PIC_STRUCT_FRAME_TRIPLING    = 8  ///<  8: %frame tripling
-} SEI_PicStructType;
-
-/**
- * Sequence parameter set
- */
-typedef struct SPS{
-
-    int profile_idc;
-    int level_idc;
-    int chroma_format_idc;
-    int transform_bypass;              ///< qpprime_y_zero_transform_bypass_flag
-    int log2_max_frame_num;            ///< log2_max_frame_num_minus4 + 4
-    int poc_type;                      ///< pic_order_cnt_type
-    int log2_max_poc_lsb;              ///< log2_max_pic_order_cnt_lsb_minus4
-    int delta_pic_order_always_zero_flag;
-    int offset_for_non_ref_pic;
-    int offset_for_top_to_bottom_field;
-    int poc_cycle_length;              ///< num_ref_frames_in_pic_order_cnt_cycle
-    int ref_frame_count;               ///< num_ref_frames
-    int gaps_in_frame_num_allowed_flag;
-    int mb_width;                      ///< pic_width_in_mbs_minus1 + 1
-    int mb_height;                     ///< pic_height_in_map_units_minus1 + 1
-    int frame_mbs_only_flag;
-    int mb_aff;                        ///<mb_adaptive_frame_field_flag
-    int direct_8x8_inference_flag;
-    int crop;                   ///< frame_cropping_flag
-    unsigned int crop_left;            ///< frame_cropping_rect_left_offset
-    unsigned int crop_right;           ///< frame_cropping_rect_right_offset
-    unsigned int crop_top;             ///< frame_cropping_rect_top_offset
-    unsigned int crop_bottom;          ///< frame_cropping_rect_bottom_offset
-    int vui_parameters_present_flag;
-    AVRational sar;
-    int video_signal_type_present_flag;
-    int full_range;
-    int colour_description_present_flag;
-    enum AVColorPrimaries color_primaries;
-    enum AVColorTransferCharacteristic color_trc;
-    enum AVColorSpace colorspace;
-    int timing_info_present_flag;
-    uint32_t num_units_in_tick;
-    uint32_t time_scale;
-    int fixed_frame_rate_flag;
-    short offset_for_ref_frame[256]; //FIXME dyn aloc?
-    int bitstream_restriction_flag;
-    int num_reorder_frames;
-    int scaling_matrix_present;
-    uint8_t scaling_matrix4[6][16];
-    uint8_t scaling_matrix8[2][64];
-    int nal_hrd_parameters_present_flag;
-    int vcl_hrd_parameters_present_flag;
-    int pic_struct_present_flag;
-    int time_offset_length;
-    int cpb_cnt;                       ///< See H.264 E.1.2
-    int initial_cpb_removal_delay_length; ///< initial_cpb_removal_delay_length_minus1 +1
-    int cpb_removal_delay_length;      ///< cpb_removal_delay_length_minus1 + 1
-    int dpb_output_delay_length;       ///< dpb_output_delay_length_minus1 + 1
-    int bit_depth_luma;                ///< bit_depth_luma_minus8 + 8
-    int bit_depth_chroma;              ///< bit_depth_chroma_minus8 + 8
-    int residual_color_transform_flag; ///< residual_colour_transform_flag
-}SPS;
-
-/**
- * Picture parameter set
- */
-typedef struct PPS{
-    unsigned int sps_id;
-    int cabac;                  ///< entropy_coding_mode_flag
-    int pic_order_present;      ///< pic_order_present_flag
-    int slice_group_count;      ///< num_slice_groups_minus1 + 1
-    int mb_slice_group_map_type;
-    unsigned int ref_count[2];  ///< num_ref_idx_l0/1_active_minus1 + 1
-    int weighted_pred;          ///< weighted_pred_flag
-    int weighted_bipred_idc;
-    int init_qp;                ///< pic_init_qp_minus26 + 26
-    int init_qs;                ///< pic_init_qs_minus26 + 26
-    int chroma_qp_index_offset[2];
-    int deblocking_filter_parameters_present; ///< deblocking_filter_parameters_present_flag
-    int constrained_intra_pred; ///< constrained_intra_pred_flag
-    int redundant_pic_cnt_present; ///< redundant_pic_cnt_present_flag
-    int transform_8x8_mode;     ///< transform_8x8_mode_flag
-    uint8_t scaling_matrix4[6][16];
-    uint8_t scaling_matrix8[2][64];
-    uint8_t chroma_qp_table[2][64];  ///< pre-scaled (with chroma_qp_index_offset) version of qp_table
-    int chroma_qp_diff;
-}PPS;
-
-/**
- * Memory management control operation opcode.
- */
-typedef enum MMCOOpcode{
-    MMCO_END=0,
-    MMCO_SHORT2UNUSED,
-    MMCO_LONG2UNUSED,
-    MMCO_SHORT2LONG,
-    MMCO_SET_MAX_LONG,
-    MMCO_RESET,
-    MMCO_LONG,
-} MMCOOpcode;
-
-/**
- * Memory management control operation.
- */
-typedef struct MMCO{
-    MMCOOpcode opcode;
-    int short_pic_num;  ///< pic_num without wrapping (pic_num & max_pic_num)
-    int long_arg;       ///< index, pic_num, or num long refs depending on opcode
-} MMCO;
-
-/**
- * H264Context
- */
-typedef struct H264Context{
-    MpegEncContext s;
-    H264DSPContext h264dsp;
-    int chroma_qp[2]; //QPc
-
-    int qp_thresh;      ///< QP threshold to skip loopfilter
-
-    int prev_mb_skipped;
-    int next_mb_skipped;
-
-    //prediction stuff
-    int chroma_pred_mode;
-    int intra16x16_pred_mode;
-
-    int topleft_mb_xy;
-    int top_mb_xy;
-    int topright_mb_xy;
-    int left_mb_xy[2];
-
-    int topleft_type;
-    int top_type;
-    int topright_type;
-    int left_type[2];
-
-    const uint8_t * left_block;
-    int topleft_partition;
-
-    int8_t intra4x4_pred_mode_cache[5*8];
-    int8_t (*intra4x4_pred_mode);
-    H264PredContext hpc;
-    unsigned int topleft_samples_available;
-    unsigned int top_samples_available;
-    unsigned int topright_samples_available;
-    unsigned int left_samples_available;
-    uint8_t (*top_borders[2])[16+2*8];
-
-    /**
-     * non zero coeff count cache.
-     * is 64 if not available.
-     */
-    DECLARE_ALIGNED(8, uint8_t, non_zero_count_cache)[6*8];
-
-    /*
-    .UU.YYYY
-    .UU.YYYY
-    .vv.YYYY
-    .VV.YYYY
-    */
-    uint8_t (*non_zero_count)[32];
-
-    /**
-     * Motion vector cache.
-     */
-    DECLARE_ALIGNED(16, int16_t, mv_cache)[2][5*8][2];
-    DECLARE_ALIGNED(8, int8_t, ref_cache)[2][5*8];
-#define LIST_NOT_USED -1 //FIXME rename?
-#define PART_NOT_AVAILABLE -2
-
-    /**
-     * is 1 if the specific list MV&references are set to 0,0,-2.
-     */
-    int mv_cache_clean[2];
-
-    /**
-     * number of neighbors (top and/or left) that used 8x8 dct
-     */
-    int neighbor_transform_size;
-
-    /**
-     * block_offset[ 0..23] for frame macroblocks
-     * block_offset[24..47] for field macroblocks
-     */
-    int block_offset[2*(16+8)];
-
-    uint32_t *mb2b_xy; //FIXME are these 4 a good idea?
-    uint32_t *mb2br_xy;
-    int b_stride; //FIXME use s->b4_stride
-
-    int mb_linesize;   ///< may be equal to s->linesize or s->linesize*2, for mbaff
-    int mb_uvlinesize;
-
-    int emu_edge_width;
-    int emu_edge_height;
-
-    SPS sps; ///< current sps
-
-    /**
-     * current pps
-     */
-    PPS pps; //FIXME move to Picture perhaps? (->no) do we need that?
-
-    uint32_t dequant4_buffer[6][52][16]; //FIXME should these be moved down?
-    uint32_t dequant8_buffer[2][52][64];
-    uint32_t (*dequant4_coeff[6])[16];
-    uint32_t (*dequant8_coeff[2])[64];
-
-    int slice_num;
-    uint16_t *slice_table;     ///< slice_table_base + 2*mb_stride + 1
-    int slice_type;
-    int slice_type_nos;        ///< S free slice type (SI/SP are remapped to I/P)
-    int slice_type_fixed;
-
-    //interlacing specific flags
-    int mb_aff_frame;
-    int mb_field_decoding_flag;
-    int mb_mbaff;              ///< mb_aff_frame && mb_field_decoding_flag
-
-    DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4];
-
-    //Weighted pred stuff
-    int use_weight;
-    int use_weight_chroma;
-    int luma_log2_weight_denom;
-    int chroma_log2_weight_denom;
-    //The following 2 can be changed to int8_t but that causes 10cpu cycles speedloss
-    int luma_weight[48][2][2];
-    int chroma_weight[48][2][2][2];
-    int implicit_weight[48][48][2];
-
-    int direct_spatial_mv_pred;
-    int col_parity;
-    int col_fieldoff;
-    int dist_scale_factor[16];
-    int dist_scale_factor_field[2][32];
-    int map_col_to_list0[2][16+32];
-    int map_col_to_list0_field[2][2][16+32];
-
-    /**
-     * num_ref_idx_l0/1_active_minus1 + 1
-     */
-    unsigned int ref_count[2];   ///< counts frames or fields, depending on current mb mode
-    unsigned int list_count;
-    uint8_t *list_counts;            ///< Array of list_count per MB specifying the slice type
-    Picture ref_list[2][48];         /**< 0..15: frame refs, 16..47: mbaff field refs.
-                                          Reordered version of default_ref_list
-                                          according to picture reordering in slice header */
-    int ref2frm[MAX_SLICES][2][64];  ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
-
-    //data partitioning
-    GetBitContext intra_gb;
-    GetBitContext inter_gb;
-    GetBitContext *intra_gb_ptr;
-    GetBitContext *inter_gb_ptr;
-
-    DECLARE_ALIGNED(16, DCTELEM, mb)[16*24];
-    DCTELEM mb_padding[256];        ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb
-
-    /**
-     * Cabac
-     */
-    CABACContext cabac;
-    uint8_t      cabac_state[460];
-
-    /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0,1,2), 0x0? luma_cbp */
-    uint16_t     *cbp_table;
-    int cbp;
-    int top_cbp;
-    int left_cbp;
-    /* chroma_pred_mode for i4x4 or i16x16, else 0 */
-    uint8_t     *chroma_pred_mode_table;
-    int         last_qscale_diff;
-    uint8_t     (*mvd_table[2])[2];
-    DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5*8][2];
-    uint8_t     *direct_table;
-    uint8_t     direct_cache[5*8];
-
-    uint8_t zigzag_scan[16];
-    uint8_t zigzag_scan8x8[64];
-    uint8_t zigzag_scan8x8_cavlc[64];
-    uint8_t field_scan[16];
-    uint8_t field_scan8x8[64];
-    uint8_t field_scan8x8_cavlc[64];
-    const uint8_t *zigzag_scan_q0;
-    const uint8_t *zigzag_scan8x8_q0;
-    const uint8_t *zigzag_scan8x8_cavlc_q0;
-    const uint8_t *field_scan_q0;
-    const uint8_t *field_scan8x8_q0;
-    const uint8_t *field_scan8x8_cavlc_q0;
-
-    int x264_build;
-
-    int mb_xy;
-
-    int is_complex;
-
-    //deblock
-    int deblocking_filter;         ///< disable_deblocking_filter_idc with 1<->0
-    int slice_alpha_c0_offset;
-    int slice_beta_offset;
-
-//=============================================================
-    //Things below are not used in the MB or more inner code
-
-    int nal_ref_idc;
-    int nal_unit_type;
-    uint8_t *rbsp_buffer[2];
-    unsigned int rbsp_buffer_size[2];
-
-    /**
-     * Used to parse AVC variant of h264
-     */
-    int is_avc; ///< this flag is != 0 if codec is avc1
-    int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4)
-
-    SPS *sps_buffers[MAX_SPS_COUNT];
-    PPS *pps_buffers[MAX_PPS_COUNT];
-
-    int dequant_coeff_pps;     ///< reinit tables when pps changes
-
-    uint16_t *slice_table_base;
-
-
-    //POC stuff
-    int poc_lsb;
-    int poc_msb;
-    int delta_poc_bottom;
-    int delta_poc[2];
-    int frame_num;
-    int prev_poc_msb;             ///< poc_msb of the last reference pic for POC type 0
-    int prev_poc_lsb;             ///< poc_lsb of the last reference pic for POC type 0
-    int frame_num_offset;         ///< for POC type 2
-    int prev_frame_num_offset;    ///< for POC type 2
-    int prev_frame_num;           ///< frame_num of the last pic for POC type 1/2
-
-    /**
-     * frame_num for frames or 2*frame_num+1 for field pics.
-     */
-    int curr_pic_num;
-
-    /**
-     * max_frame_num or 2*max_frame_num for field pics.
-     */
-    int max_pic_num;
-
-    int redundant_pic_count;
-
-    Picture *short_ref[32];
-    Picture *long_ref[32];
-    Picture default_ref_list[2][32]; ///< base reference list for all slices of a coded picture
-    Picture *delayed_pic[MAX_DELAYED_PIC_COUNT+2]; //FIXME size?
-    int outputed_poc;
-
-    /**
-     * memory management control operations buffer.
-     */
-    MMCO mmco[MAX_MMCO_COUNT];
-    int mmco_index;
-
-    int long_ref_count;  ///< number of actual long term references
-    int short_ref_count; ///< number of actual short term references
-
-    int          cabac_init_idc;
-
-    /**
-     * @defgroup multithreading Members for slice based multithreading
-     * @{
-     */
-    struct H264Context *thread_context[MAX_THREADS];
-
-    /**
-     * current slice number, used to initalize slice_num of each thread/context
-     */
-    int current_slice;
-
-    /**
-     * Max number of threads / contexts.
-     * This is equal to AVCodecContext.thread_count unless
-     * multithreaded decoding is impossible, in which case it is
-     * reduced to 1.
-     */
-    int max_contexts;
-
-    /**
-     *  1 if the single thread fallback warning has already been
-     *  displayed, 0 otherwise.
-     */
-    int single_decode_warning;
-
-    int last_slice_type;
-    /** @} */
-
-    /**
-     * pic_struct in picture timing SEI message
-     */
-    SEI_PicStructType sei_pic_struct;
-
-    /**
-     * Complement sei_pic_struct
-     * SEI_PIC_STRUCT_TOP_BOTTOM and SEI_PIC_STRUCT_BOTTOM_TOP indicate interlaced frames.
-     * However, soft telecined frames may have these values.
-     * This is used in an attempt to flag soft telecine progressive.
-     */
-    int prev_interlaced_frame;
-
-    /**
-     * Bit set of clock types for fields/frames in picture timing SEI message.
-     * For each found ct_type, appropriate bit is set (e.g., bit 1 for
-     * interlaced).
-     */
-    int sei_ct_type;
-
-    /**
-     * dpb_output_delay in picture timing SEI message, see H.264 C.2.2
-     */
-    int sei_dpb_output_delay;
-
-    /**
-     * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2
-     */
-    int sei_cpb_removal_delay;
-
-    /**
-     * recovery_frame_cnt from SEI message
-     *
-     * Set to -1 if no recovery point SEI message found or to number of frames
-     * before playback synchronizes. Frames having recovery point are key
-     * frames.
-     */
-    int sei_recovery_frame_cnt;
-
-    int luma_weight_flag[2];   ///< 7.4.3.2 luma_weight_lX_flag
-    int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag
-
-    // Timestamp stuff
-    int sei_buffering_period_present;  ///< Buffering period SEI flag
-    int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs
-
-    //SVQ3 specific fields
-    int halfpel_flag;
-    int thirdpel_flag;
-    int unknown_svq3_flag;
-    int next_slice_index;
-    uint32_t svq3_watermark_key;
-}H264Context;
-
-
-extern const uint8_t ff_h264_chroma_qp[52];
-
-void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
-
-void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
-
-/**
- * Decode SEI
- */
-int ff_h264_decode_sei(H264Context *h);
-
-/**
- * Decode SPS
- */
-int ff_h264_decode_seq_parameter_set(H264Context *h);
-
-/**
- * Decode PPS
- */
-int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length);
-
-/**
- * Decodes a network abstraction layer unit.
- * @param consumed is the number of bytes used as input
- * @param length is the length of the array
- * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing?
- * @return decoded bytes, might be src+1 if no escapes
- */
-const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length);
-
-/**
- * identifies the exact end of the bitstream
- * @return the length of the trailing, or 0 if damaged
- */
-int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src);
-
-/**
- * frees any data that may have been allocated in the H264 context like SPS, PPS etc.
- */
-av_cold void ff_h264_free_context(H264Context *h);
-
-/**
- * reconstructs bitstream slice_type.
- */
-int ff_h264_get_slice_type(const H264Context *h);
-
-/**
- * allocates tables.
- * needs width/height
- */
-int ff_h264_alloc_tables(H264Context *h);
-
-/**
- * fills the default_ref_list.
- */
-int ff_h264_fill_default_ref_list(H264Context *h);
-
-int ff_h264_decode_ref_pic_list_reordering(H264Context *h);
-void ff_h264_fill_mbaff_ref_list(H264Context *h);
-void ff_h264_remove_all_refs(H264Context *h);
-
-/**
- * Executes the reference picture marking (memory management control operations).
- */
-int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count);
-
-int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb);
-
-
-/**
- * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
- */
-int ff_h264_check_intra4x4_pred_mode(H264Context *h);
-
-/**
- * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
- */
-int ff_h264_check_intra_pred_mode(H264Context *h, int mode);
-
-void ff_h264_write_back_intra_pred_mode(H264Context *h);
-void ff_h264_hl_decode_mb(H264Context *h);
-int ff_h264_frame_start(H264Context *h);
-av_cold int ff_h264_decode_init(AVCodecContext *avctx);
-av_cold int ff_h264_decode_end(AVCodecContext *avctx);
-av_cold void ff_h264_decode_init_vlc(void);
-
-/**
- * decodes a macroblock
- * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed
- */
-int ff_h264_decode_mb_cavlc(H264Context *h);
-
-/**
- * decodes a CABAC coded macroblock
- * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed
- */
-int ff_h264_decode_mb_cabac(H264Context *h);
-
-void ff_h264_init_cabac_states(H264Context *h);
-
-void ff_h264_direct_dist_scale_factor(H264Context * const h);
-void ff_h264_direct_ref_list_init(H264Context * const h);
-void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type);
-
-void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
-void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize);
-
-/**
- * Reset SEI values at the beginning of the frame.
- *
- * @param h H.264 context.
- */
-void ff_h264_reset_sei(H264Context *h);
-
-
-/*
-o-o o-o
- / / /
-o-o o-o
- ,---'
-o-o o-o
- / / /
-o-o o-o
-*/
-//This table must be here because scan8[constant] must be known at compiletime
-static const uint8_t scan8[16 + 2*4]={
- 4+1*8, 5+1*8, 4+2*8, 5+2*8,
- 6+1*8, 7+1*8, 6+2*8, 7+2*8,
- 4+3*8, 5+3*8, 4+4*8, 5+4*8,
- 6+3*8, 7+3*8, 6+4*8, 7+4*8,
- 1+1*8, 2+1*8,
- 1+2*8, 2+2*8,
- 1+4*8, 2+4*8,
- 1+5*8, 2+5*8,
-};
-
-static av_always_inline uint32_t pack16to32(int a, int b){
-#if HAVE_BIGENDIAN
-   return (b&0xFFFF) + (a<<16);
-#else
-   return (a&0xFFFF) + (b<<16);
-#endif
-}
-
-static av_always_inline uint16_t pack8to16(int a, int b){
-#if HAVE_BIGENDIAN
-   return (b&0xFF) + (a<<8);
-#else
-   return (a&0xFF) + (b<<8);
-#endif
-}
-
-/**
- * gets the chroma qp.
- */
-static inline int get_chroma_qp(H264Context *h, int t, int qscale){
-    return h->pps.chroma_qp_table[t][qscale];
-}
-
-static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my);
-
-static void fill_decode_neighbors(H264Context *h, int mb_type){
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= h->mb_xy;
-    int topleft_xy, top_xy, topright_xy, left_xy[2];
-    static const uint8_t left_block_options[4][16]={
-        {0,1,2,3,7,10,8,11,7+0*8, 7+1*8, 7+2*8, 7+3*8, 2+0*8, 2+3*8, 2+1*8, 2+2*8},
-        {2,2,3,3,8,11,8,11,7+2*8, 7+2*8, 7+3*8, 7+3*8, 2+1*8, 2+2*8, 2+1*8, 2+2*8},
-        {0,0,1,1,7,10,7,10,7+0*8, 7+0*8, 7+1*8, 7+1*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8},
-        {0,2,0,2,7,10,7,10,7+0*8, 7+2*8, 7+0*8, 7+2*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8}
-    };
-
-    h->topleft_partition= -1;
-
-    top_xy     = mb_xy  - (s->mb_stride << MB_FIELD);
-
-    /* Wow, what a mess, why didn't they simplify the interlacing & intra
-     * stuff, I can't imagine that these complex rules are worth it. */
-
-    topleft_xy = top_xy - 1;
-    topright_xy= top_xy + 1;
-    left_xy[1] = left_xy[0] = mb_xy-1;
-    h->left_block = left_block_options[0];
-    if(FRAME_MBAFF){
-        const int left_mb_field_flag     = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]);
-        const int curr_mb_field_flag     = IS_INTERLACED(mb_type);
-        if(s->mb_y&1){
-            if (left_mb_field_flag != curr_mb_field_flag) {
-                left_xy[1] = left_xy[0] = mb_xy - s->mb_stride - 1;
-                if (curr_mb_field_flag) {
-                    left_xy[1] += s->mb_stride;
-                    h->left_block = left_block_options[3];
-                } else {
-                    topleft_xy += s->mb_stride;
-                    // take top left mv from the middle of the mb, as opposed to all other modes which use the bottom right partition
-                    h->topleft_partition = 0;
-                    h->left_block = left_block_options[1];
-                }
-            }
-        }else{
-            if(curr_mb_field_flag){
-                topleft_xy  += s->mb_stride & (((s->current_picture.mb_type[top_xy - 1]>>7)&1)-1);
-                topright_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy + 1]>>7)&1)-1);
-                top_xy      += s->mb_stride & (((s->current_picture.mb_type[top_xy    ]>>7)&1)-1);
-            }
-            if (left_mb_field_flag != curr_mb_field_flag) {
-                if (curr_mb_field_flag) {
-                    left_xy[1] += s->mb_stride;
-                    h->left_block = left_block_options[3];
-                } else {
-                    h->left_block = left_block_options[2];
-                }
-            }
-        }
-    }
-
-    h->topleft_mb_xy = topleft_xy;
-    h->top_mb_xy     = top_xy;
-    h->topright_mb_xy= topright_xy;
-    h->left_mb_xy[0] = left_xy[0];
-    h->left_mb_xy[1] = left_xy[1];
-    //FIXME do we need all in the context?
-
-    h->topleft_type = s->current_picture.mb_type[topleft_xy] ;
-    h->top_type     = s->current_picture.mb_type[top_xy]     ;
-    h->topright_type= s->current_picture.mb_type[topright_xy];
-    h->left_type[0] = s->current_picture.mb_type[left_xy[0]] ;
-    h->left_type[1] = s->current_picture.mb_type[left_xy[1]] ;
-
-    if(FMO){
-    if(h->slice_table[topleft_xy ] != h->slice_num) h->topleft_type = 0;
-    if(h->slice_table[top_xy     ] != h->slice_num) h->top_type     = 0;
-    if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0;
-    }else{
-        if(h->slice_table[topleft_xy ] != h->slice_num){
-            h->topleft_type = 0;
-            if(h->slice_table[top_xy     ] != h->slice_num) h->top_type     = 0;
-            if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0;
-        }
-    }
-    if(h->slice_table[topright_xy] != h->slice_num) h->topright_type= 0;
-}
-
-static void fill_decode_caches(H264Context *h, int mb_type){
-    MpegEncContext * const s = &h->s;
-    int topleft_xy, top_xy, topright_xy, left_xy[2];
-    int topleft_type, top_type, topright_type, left_type[2];
-    const uint8_t * left_block= h->left_block;
-    int i;
-
-    topleft_xy   = h->topleft_mb_xy ;
-    top_xy       = h->top_mb_xy     ;
-    topright_xy  = h->topright_mb_xy;
-    left_xy[0]   = h->left_mb_xy[0] ;
-    left_xy[1]   = h->left_mb_xy[1] ;
-    topleft_type = h->topleft_type  ;
-    top_type     = h->top_type      ;
-    topright_type= h->topright_type ;
-    left_type[0] = h->left_type[0]  ;
-    left_type[1] = h->left_type[1]  ;
-
-    if(!IS_SKIP(mb_type)){
-        if(IS_INTRA(mb_type)){
-            int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1;
-            h->topleft_samples_available=
-            h->top_samples_available=
-            h->left_samples_available= 0xFFFF;
-            h->topright_samples_available= 0xEEEA;
-
-            if(!(top_type & type_mask)){
-                h->topleft_samples_available= 0xB3FF;
-                h->top_samples_available= 0x33FF;
-                h->topright_samples_available= 0x26EA;
-            }
-            if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){
-                if(IS_INTERLACED(mb_type)){
-                    if(!(left_type[0] & type_mask)){
-                        h->topleft_samples_available&= 0xDFFF;
-                        h->left_samples_available&= 0x5FFF;
-                    }
-                    if(!(left_type[1] & type_mask)){
-                        h->topleft_samples_available&= 0xFF5F;
-                        h->left_samples_available&= 0xFF5F;
-                    }
-                }else{
-                    int left_typei = s->current_picture.mb_type[left_xy[0] + s->mb_stride];
-
-                    assert(left_xy[0] == left_xy[1]);
-                    if(!((left_typei & type_mask) && (left_type[0] & type_mask))){
-                        h->topleft_samples_available&= 0xDF5F;
-                        h->left_samples_available&= 0x5F5F;
-                    }
-                }
-            }else{
-                if(!(left_type[0] & type_mask)){
-                    h->topleft_samples_available&= 0xDF5F;
-                    h->left_samples_available&= 0x5F5F;
-                }
-            }
-
-            if(!(topleft_type & type_mask))
-                h->topleft_samples_available&= 0x7FFF;
-
-            if(!(topright_type & type_mask))
-                h->topright_samples_available&= 0xFBFF;
-
-            if(IS_INTRA4x4(mb_type)){
-                if(IS_INTRA4x4(top_type)){
-                    AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]);
-                }else{
-                    h->intra4x4_pred_mode_cache[4+8*0]=
-                    h->intra4x4_pred_mode_cache[5+8*0]=
-                    h->intra4x4_pred_mode_cache[6+8*0]=
-                    h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask);
-                }
-                for(i=0; i<2; i++){
-                    if(IS_INTRA4x4(left_type[i])){
-                        int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
-                        h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]];
-                        h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]];
-                    }else{
-                        h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
-                        h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[i] & type_mask);
-                    }
-                }
-            }
-        }
-
-
-/*
-0 . T T. T T T T
-1 L . .L . . . .
-2 L . .L . . . .
-3 . T TL . . . .
-4 L . .L . . . .
-5 L . .. . . . .
-*/
-//FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec)
-    if(top_type){
-        AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][4+3*8]);
-            h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8];
-            h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8];
-
-            h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8];
-            h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8];
-    }else {
-            h->non_zero_count_cache[1+8*0]=
-            h->non_zero_count_cache[2+8*0]=
-
-            h->non_zero_count_cache[1+8*3]=
-            h->non_zero_count_cache[2+8*3]=
-            AV_WN32A(&h->non_zero_count_cache[4+8*0], CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040);
-    }
-
-    for (i=0; i<2; i++) {
-        if(left_type[i]){
-            h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]];
-            h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]];
-                h->non_zero_count_cache[0+8*1 +   8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]];
-                h->non_zero_count_cache[0+8*4 +   8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]];
-        }else{
-                h->non_zero_count_cache[3+8*1 + 2*8*i]=
-                h->non_zero_count_cache[3+8*2 + 2*8*i]=
-                h->non_zero_count_cache[0+8*1 +   8*i]=
-                h->non_zero_count_cache[0+8*4 +   8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
-        }
-    }
-
-    if( CABAC ) {
-        // top_cbp
-        if(top_type) {
-            h->top_cbp = h->cbp_table[top_xy];
-        } else {
-            h->top_cbp = IS_INTRA(mb_type) ? 0x1CF : 0x00F;
-        }
-        // left_cbp
-        if (left_type[0]) {
-            h->left_cbp = (h->cbp_table[left_xy[0]] & 0x1f0)
-                        |  ((h->cbp_table[left_xy[0]]>>(left_block[0]&(~1)))&2)
-                        | (((h->cbp_table[left_xy[1]]>>(left_block[2]&(~1)))&2) << 2);
-        } else {
-            h->left_cbp = IS_INTRA(mb_type) ? 0x1CF : 0x00F;
-        }
-    }
-    }
-
-#if 1
-    if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){
-        int list;
-        for(list=0; list<h->list_count; list++){
-            if(!USES_LIST(mb_type, list)){
-                /*if(!h->mv_cache_clean[list]){
-                    memset(h->mv_cache [list],  0, 8*5*2*sizeof(int16_t)); //FIXME clean only input? clean at all?
-                    memset(h->ref_cache[list], PART_NOT_AVAILABLE, 8*5*sizeof(int8_t));
-                    h->mv_cache_clean[list]= 1;
-                }*/
-                continue;
-            }
-            assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred));
-
-            h->mv_cache_clean[list]= 0;
-
-            if(USES_LIST(top_type, list)){
-                const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
-                AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
-                    h->ref_cache[list][scan8[0] + 0 - 1*8]=
-                    h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 2];
-                    h->ref_cache[list][scan8[0] + 2 - 1*8]=
-                    h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 3];
-            }else{
-                AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
-                AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101);
-            }
-
-            if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){
-            for(i=0; i<2; i++){
-                int cache_idx = scan8[0] - 1 + i*2*8;
-                if(USES_LIST(left_type[i], list)){
-                    const int b_xy= h->mb2b_xy[left_xy[i]] + 3;
-                    const int b8_xy= 4*left_xy[i] + 1;
-                    AV_COPY32(h->mv_cache[list][cache_idx  ], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]);
-                    AV_COPY32(h->mv_cache[list][cache_idx+8], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]);
-                        h->ref_cache[list][cache_idx  ]= s->current_picture.ref_index[list][b8_xy + (left_block[0+i*2]&~1)];
-                        h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + (left_block[1+i*2]&~1)];
-                }else{
-                    AV_ZERO32(h->mv_cache [list][cache_idx  ]);
-                    AV_ZERO32(h->mv_cache [list][cache_idx+8]);
-                    h->ref_cache[list][cache_idx  ]=
-                    h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
-                }
-            }
-            }else{
-                if(USES_LIST(left_type[0], list)){
-                    const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
-                    const int b8_xy= 4*left_xy[0] + 1;
-                    AV_COPY32(h->mv_cache[list][scan8[0] - 1], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0]]);
-                    h->ref_cache[list][scan8[0] - 1]= s->current_picture.ref_index[list][b8_xy + (left_block[0]&~1)];
-                }else{
-                    AV_ZERO32(h->mv_cache [list][scan8[0] - 1]);
-                    h->ref_cache[list][scan8[0] - 1]= left_type[0] ? LIST_NOT_USED : PART_NOT_AVAILABLE;
-                }
-            }
-
-            if(USES_LIST(topright_type, list)){
-                const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride;
-                AV_COPY32(h->mv_cache[list][scan8[0] + 4 - 1*8], s->current_picture.motion_val[list][b_xy]);
-                h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][4*topright_xy + 2];
-            }else{
-                AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]);
-                h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
-            }
-            if(h->ref_cache[list][scan8[0] + 4 - 1*8] < 0){
-                if(USES_LIST(topleft_type, list)){
-                    const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride);
-                    const int b8_xy= 4*topleft_xy + 1 + (h->topleft_partition & 2);
-                    AV_COPY32(h->mv_cache[list][scan8[0] - 1 - 1*8], s->current_picture.motion_val[list][b_xy]);
-                    h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy];
-                }else{
-                    AV_ZERO32(h->mv_cache[list][scan8[0] - 1 - 1*8]);
-                    h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
-                }
-            }
-
-            if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF)
-                continue;
-
-            if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))) {
-            h->ref_cache[list][scan8[4 ]] =
-            h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE;
-            AV_ZERO32(h->mv_cache [list][scan8[4 ]]);
-            AV_ZERO32(h->mv_cache [list][scan8[12]]);
-
-            if( CABAC ) {
-                /* XXX beurk, Load mvd */
-                if(USES_LIST(top_type, list)){
-                    const int b_xy= h->mb2br_xy[top_xy];
-                    AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]);
-                }else{
-                    AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]);
-                }
-                if(USES_LIST(left_type[0], list)){
-                    const int b_xy= h->mb2br_xy[left_xy[0]] + 6;
-                    AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy - left_block[0]]);
-                    AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy - left_block[1]]);
-                }else{
-                    AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]);
-                    AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]);
-                }
-                if(USES_LIST(left_type[1], list)){
-                    const int b_xy= h->mb2br_xy[left_xy[1]] + 6;
-                    AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy - left_block[2]]);
-                    AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy - left_block[3]]);
-                }else{
-                    AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]);
-                    AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]);
-                }
-                AV_ZERO16(h->mvd_cache [list][scan8[4 ]]);
-                AV_ZERO16(h->mvd_cache [list][scan8[12]]);
-                if(h->slice_type_nos == FF_B_TYPE){
-                    fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1);
-
-                    if(IS_DIRECT(top_type)){
-                        AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101u*(MB_TYPE_DIRECT2>>1));
-                    }else if(IS_8X8(top_type)){
-                        int b8_xy = 4*top_xy;
-                        h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy + 2];
-                        h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 3];
-                    }else{
-                        AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_16x16>>1));
-                    }
-
-                    if(IS_DIRECT(left_type[0]))
-                        h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_DIRECT2>>1;
-                    else if(IS_8X8(left_type[0]))
-                        h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[4*left_xy[0] + 1 + (left_block[0]&~1)];
-                    else
-                        h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_16x16>>1;
-
-                    if(IS_DIRECT(left_type[1]))
-                        h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_DIRECT2>>1;
-                    else if(IS_8X8(left_type[1]))
-                        h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[4*left_xy[1] + 1 + (left_block[2]&~1)];
-                    else
-                        h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_16x16>>1;
-                }
-            }
-            }
-            if(FRAME_MBAFF){
-#define MAP_MVS\
-                    MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\
-                    MAP_F2F(scan8[0] + 0 - 1*8, top_type)\
-                    MAP_F2F(scan8[0] + 1 - 1*8, top_type)\
-                    MAP_F2F(scan8[0] + 2 - 1*8, top_type)\
-                    MAP_F2F(scan8[0] + 3 - 1*8, top_type)\
-                    MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\
-                    MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\
-                    MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\
-                    MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\
-                    MAP_F2F(scan8[0] - 1 + 3*8, left_type[1])
-                if(MB_FIELD){
-#define MAP_F2F(idx, mb_type)\
-                    if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
-                        h->ref_cache[list][idx] <<= 1;\
-                        h->mv_cache[list][idx][1] /= 2;\
-                        h->mvd_cache[list][idx][1] >>=1;\
-                    }
-                    MAP_MVS
-#undef MAP_F2F
-                }else{
-#define MAP_F2F(idx, mb_type)\
-                    if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
-                        h->ref_cache[list][idx] >>= 1;\
-                        h->mv_cache[list][idx][1] <<= 1;\
-                        h->mvd_cache[list][idx][1] <<= 1;\
-                    }
-                    MAP_MVS
-#undef MAP_F2F
-                }
-            }
-        }
-    }
-#endif
-
-        h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
-}
-
-/**
- * gets the predicted intra4x4 prediction mode.
- */
-static inline int pred_intra_mode(H264Context *h, int n){
-    const int index8= scan8[n];
-    const int left= h->intra4x4_pred_mode_cache[index8 - 1];
-    const int top = h->intra4x4_pred_mode_cache[index8 - 8];
-    const int min= FFMIN(left, top);
-
-    tprintf(h->s.avctx, "mode:%d %d min:%d\n", left ,top, min);
-
-    if(min<0) return DC_PRED;
-    else      return min;
-}
-
-static inline void write_back_non_zero_count(H264Context *h){
-    const int mb_xy= h->mb_xy;
-
-    AV_COPY64(&h->non_zero_count[mb_xy][ 0], &h->non_zero_count_cache[0+8*1]);
-    AV_COPY64(&h->non_zero_count[mb_xy][ 8], &h->non_zero_count_cache[0+8*2]);
-    AV_COPY32(&h->non_zero_count[mb_xy][16], &h->non_zero_count_cache[0+8*5]);
-    AV_COPY32(&h->non_zero_count[mb_xy][20], &h->non_zero_count_cache[4+8*3]);
-    AV_COPY64(&h->non_zero_count[mb_xy][24], &h->non_zero_count_cache[0+8*4]);
-}
-
-static inline void write_back_motion(H264Context *h, int mb_type){
-    MpegEncContext * const s = &h->s;
-    const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; //try mb2b(8)_xy
-    const int b8_xy= 4*h->mb_xy;
-    int list;
-
-    if(!USES_LIST(mb_type, 0))
-        fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, 2, (uint8_t)LIST_NOT_USED, 1);
-
-    for(list=0; list<h->list_count; list++){
-        int y, b_stride;
-        int16_t (*mv_dst)[2];
-        int16_t (*mv_src)[2];
-
-        if(!USES_LIST(mb_type, list))
-            continue;
-
-        b_stride = h->b_stride;
-        mv_dst   = &s->current_picture.motion_val[list][b_xy];
-        mv_src   = &h->mv_cache[list][scan8[0]];
-        for(y=0; y<4; y++){
-            AV_COPY128(mv_dst + y*b_stride, mv_src + 8*y);
-        }
-        if( CABAC ) {
-            uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8*h->mb_xy : h->mb2br_xy[h->mb_xy]];
-            uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
-            if(IS_SKIP(mb_type))
-                AV_ZERO128(mvd_dst);
-            else{
-            AV_COPY64(mvd_dst, mvd_src + 8*3);
-                AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8*0);
-                AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8*1);
-                AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8*2);
-            }
-        }
-
-        {
-            int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
-            ref_index[0+0*2]= h->ref_cache[list][scan8[0]];
-            ref_index[1+0*2]= h->ref_cache[list][scan8[4]];
-            ref_index[0+1*2]= h->ref_cache[list][scan8[8]];
-            ref_index[1+1*2]= h->ref_cache[list][scan8[12]];
-        }
-    }
-
-    if(h->slice_type_nos == FF_B_TYPE && CABAC){
-        if(IS_8X8(mb_type)){
-            uint8_t *direct_table = &h->direct_table[4*h->mb_xy];
-            direct_table[1] = h->sub_mb_type[1]>>1;
-            direct_table[2] = h->sub_mb_type[2]>>1;
-            direct_table[3] = h->sub_mb_type[3]>>1;
-        }
-    }
-}
-
-static inline int get_dct8x8_allowed(H264Context *h){
-    if(h->sps.direct_8x8_inference_flag)
-        return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8                )*0x0001000100010001ULL));
-    else
-        return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL));
-}
-
-/**
- * decodes a P_SKIP or B_SKIP macroblock
- */
-static void decode_mb_skip(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= h->mb_xy;
-    int mb_type=0;
-
-    memset(h->non_zero_count[mb_xy], 0, 32);
-    memset(h->non_zero_count_cache + 8, 0, 8*5); //FIXME ugly, remove pfui
-
-    if(MB_FIELD)
-        mb_type|= MB_TYPE_INTERLACED;
-
-    if( h->slice_type_nos == FF_B_TYPE )
-    {
-        // just for fill_caches. pred_direct_motion will set the real mb_type
-        mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
-        if(h->direct_spatial_mv_pred){
-            fill_decode_neighbors(h, mb_type);
-        fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
-        }
-        ff_h264_pred_direct_motion(h, &mb_type);
-        mb_type|= MB_TYPE_SKIP;
-    }
-    else
-    {
-        int mx, my;
-        mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP;
-
-        fill_decode_neighbors(h, mb_type);
-        fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
-        pred_pskip_motion(h, &mx, &my);
-        fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1);
-        fill_rectangle(  h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4);
-    }
-
-    write_back_motion(h, mb_type);
-    s->current_picture.mb_type[mb_xy]= mb_type;
-    s->current_picture.qscale_table[mb_xy]= s->qscale;
-    h->slice_table[ mb_xy ]= h->slice_num;
-    h->prev_mb_skipped= 1;
-}
-
-#include "h264_mvpred.h" //For pred_pskip_motion()
-
-#endif /* AVCODEC_H264_H */
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
deleted file mode 100644
index 4858378..0000000
--- a/libavcodec/h264_cabac.c
+++ /dev/null
@@ -1,1720 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... cabac decoding
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 cabac decoding.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#define CABAC 1
-
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "h264.h"
-#include "h264data.h"
-#include "h264_mvpred.h"
-#include "golomb.h"
-
-#include "cabac.h"
-#if ARCH_X86
-#include "x86/h264_i386.h"
-#endif
-
-//#undef NDEBUG
-#include <assert.h>
-
-/* Cabac pre state table */
-
-static const int8_t cabac_context_init_I[460][2] =
-{
-    /* 0 - 10 */
-    { 20, -15 }, {  2, 54 },  {  3,  74 }, { 20, -15 },
-    {  2,  54 }, {  3, 74 },  { -28,127 }, { -23, 104 },
-    { -6,  53 }, { -1, 54 },  {  7,  51 },
-
-    /* 11 - 23 unsused for I */
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },
-
-    /* 24- 39 */
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-
-    /* 40 - 53 */
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },
-
-    /* 54 - 59 */
-    { 0, 0 },    { 0, 0 },    { 0, 0 },      { 0, 0 },
-    { 0, 0 },    { 0, 0 },
-
-    /* 60 - 69 */
-    { 0, 41 },   { 0, 63 },   { 0, 63 },     { 0, 63 },
-    { -9, 83 },  { 4, 86 },   { 0, 97 },     { -7, 72 },
-    { 13, 41 },  { 3, 62 },
-
-    /* 70 -> 87 */
-    { 0, 11 },   { 1, 55 },   { 0, 69 },     { -17, 127 },
-    { -13, 102 },{ 0, 82 },   { -7, 74 },    { -21, 107 },
-    { -27, 127 },{ -31, 127 },{ -24, 127 },  { -18, 95 },
-    { -27, 127 },{ -21, 114 },{ -30, 127 },  { -17, 123 },
-    { -12, 115 },{ -16, 122 },
-
-    /* 88 -> 104 */
-    { -11, 115 },{ -12, 63 }, { -2, 68 },    { -15, 84 },
-    { -13, 104 },{ -3, 70 },  { -8, 93 },    { -10, 90 },
-    { -30, 127 },{ -1, 74 },  { -6, 97 },    { -7, 91 },
-    { -20, 127 },{ -4, 56 },  { -5, 82 },    { -7, 76 },
-    { -22, 125 },
-
-    /* 105 -> 135 */
-    { -7, 93 },  { -11, 87 }, { -3, 77 },    { -5, 71 },
-    { -4, 63 },  { -4, 68 },  { -12, 84 },   { -7, 62 },
-    { -7, 65 },  { 8, 61 },   { 5, 56 },     { -2, 66 },
-    { 1, 64 },   { 0, 61 },   { -2, 78 },    { 1, 50 },
-    { 7, 52 },   { 10, 35 },  { 0, 44 },     { 11, 38 },
-    { 1, 45 },   { 0, 46 },   { 5, 44 },     { 31, 17 },
-    { 1, 51 },   { 7, 50 },   { 28, 19 },    { 16, 33 },
-    { 14, 62 },  { -13, 108 },{ -15, 100 },
-
-    /* 136 -> 165 */
-    { -13, 101 },{ -13, 91 }, { -12, 94 },   { -10, 88 },
-    { -16, 84 }, { -10, 86 }, { -7, 83 },    { -13, 87 },
-    { -19, 94 }, { 1, 70 },   { 0, 72 },     { -5, 74 },
-    { 18, 59 },  { -8, 102 }, { -15, 100 },  { 0, 95 },
-    { -4, 75 },  { 2, 72 },   { -11, 75 },   { -3, 71 },
-    { 15, 46 },  { -13, 69 }, { 0, 62 },     { 0, 65 },
-    { 21, 37 },  { -15, 72 }, { 9, 57 },     { 16, 54 },
-    { 0, 62 },   { 12, 72 },
-
-    /* 166 -> 196 */
-    { 24, 0 },   { 15, 9 },   { 8, 25 },     { 13, 18 },
-    { 15, 9 },   { 13, 19 },  { 10, 37 },    { 12, 18 },
-    { 6, 29 },   { 20, 33 },  { 15, 30 },    { 4, 45 },
-    { 1, 58 },   { 0, 62 },   { 7, 61 },     { 12, 38 },
-    { 11, 45 },  { 15, 39 },  { 11, 42 },    { 13, 44 },
-    { 16, 45 },  { 12, 41 },  { 10, 49 },    { 30, 34 },
-    { 18, 42 },  { 10, 55 },  { 17, 51 },    { 17, 46 },
-    { 0, 89 },   { 26, -19 }, { 22, -17 },
-
-    /* 197 -> 226 */
-    { 26, -17 }, { 30, -25 }, { 28, -20 },   { 33, -23 },
-    { 37, -27 }, { 33, -23 }, { 40, -28 },   { 38, -17 },
-    { 33, -11 }, { 40, -15 }, { 41, -6 },    { 38, 1 },
-    { 41, 17 },  { 30, -6 },  { 27, 3 },     { 26, 22 },
-    { 37, -16 }, { 35, -4 },  { 38, -8 },    { 38, -3 },
-    { 37, 3 },   { 38, 5 },   { 42, 0 },     { 35, 16 },
-    { 39, 22 },  { 14, 48 },  { 27, 37 },    { 21, 60 },
-    { 12, 68 },  { 2, 97 },
-
-    /* 227 -> 251 */
-    { -3, 71 },  { -6, 42 },  { -5, 50 },    { -3, 54 },
-    { -2, 62 },  { 0, 58 },   { 1, 63 },     { -2, 72 },
-    { -1, 74 },  { -9, 91 },  { -5, 67 },    { -5, 27 },
-    { -3, 39 },  { -2, 44 },  { 0, 46 },     { -16, 64 },
-    { -8, 68 },  { -10, 78 }, { -6, 77 },    { -10, 86 },
-    { -12, 92 }, { -15, 55 }, { -10, 60 },   { -6, 62 },
-    { -4, 65 },
-
-    /* 252 -> 275 */
-    { -12, 73 }, { -8, 76 },  { -7, 80 },    { -9, 88 },
-    { -17, 110 },{ -11, 97 }, { -20, 84 },   { -11, 79 },
-    { -6, 73 },  { -4, 74 },  { -13, 86 },   { -13, 96 },
-    { -11, 97 }, { -19, 117 },{ -8, 78 },    { -5, 33 },
-    { -4, 48 },  { -2, 53 },  { -3, 62 },    { -13, 71 },
-    { -10, 79 }, { -12, 86 }, { -13, 90 },   { -14, 97 },
-
-    /* 276 a bit special (not used, bypass is used instead) */
-    { 0, 0 },
-
-    /* 277 -> 307 */
-    { -6, 93 },  { -6, 84 },  { -8, 79 },    { 0, 66 },
-    { -1, 71 },  { 0, 62 },   { -2, 60 },    { -2, 59 },
-    { -5, 75 },  { -3, 62 },  { -4, 58 },    { -9, 66 },
-    { -1, 79 },  { 0, 71 },   { 3, 68 },     { 10, 44 },
-    { -7, 62 },  { 15, 36 },  { 14, 40 },    { 16, 27 },
-    { 12, 29 },  { 1, 44 },   { 20, 36 },    { 18, 32 },
-    { 5, 42 },   { 1, 48 },   { 10, 62 },    { 17, 46 },
-    { 9, 64 },   { -12, 104 },{ -11, 97 },
-
-    /* 308 -> 337 */
-    { -16, 96 }, { -7, 88 },  { -8, 85 },    { -7, 85 },
-    { -9, 85 },  { -13, 88 }, { 4, 66 },     { -3, 77 },
-    { -3, 76 },  { -6, 76 },  { 10, 58 },    { -1, 76 },
-    { -1, 83 },  { -7, 99 },  { -14, 95 },   { 2, 95 },
-    { 0, 76 },   { -5, 74 },  { 0, 70 },     { -11, 75 },
-    { 1, 68 },   { 0, 65 },   { -14, 73 },   { 3, 62 },
-    { 4, 62 },   { -1, 68 },  { -13, 75 },   { 11, 55 },
-    { 5, 64 },   { 12, 70 },
-
-    /* 338 -> 368 */
-    { 15, 6 },   { 6, 19 },   { 7, 16 },     { 12, 14 },
-    { 18, 13 },  { 13, 11 },  { 13, 15 },    { 15, 16 },
-    { 12, 23 },  { 13, 23 },  { 15, 20 },    { 14, 26 },
-    { 14, 44 },  { 17, 40 },  { 17, 47 },    { 24, 17 },
-    { 21, 21 },  { 25, 22 },  { 31, 27 },    { 22, 29 },
-    { 19, 35 },  { 14, 50 },  { 10, 57 },    { 7, 63 },
-    { -2, 77 },  { -4, 82 },  { -3, 94 },    { 9, 69 },
-    { -12, 109 },{ 36, -35 }, { 36, -34 },
-
-    /* 369 -> 398 */
-    { 32, -26 }, { 37, -30 }, { 44, -32 },   { 34, -18 },
-    { 34, -15 }, { 40, -15 }, { 33, -7 },    { 35, -5 },
-    { 33, 0 },   { 38, 2 },   { 33, 13 },    { 23, 35 },
-    { 13, 58 },  { 29, -3 },  { 26, 0 },     { 22, 30 },
-    { 31, -7 },  { 35, -15 }, { 34, -3 },    { 34, 3 },
-    { 36, -1 },  { 34, 5 },   { 32, 11 },    { 35, 5 },
-    { 34, 12 },  { 39, 11 },  { 30, 29 },    { 34, 26 },
-    { 29, 39 },  { 19, 66 },
-
-    /* 399 -> 435 */
-    {  31,  21 }, {  31,  31 }, {  25,  50 },
-    { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11,  85 },
-    { -15,  92 }, { -14,  89 }, { -26,  71 }, { -15,  81 },
-    { -14,  80 }, {   0,  68 }, { -14,  70 }, { -24,  56 },
-    { -23,  68 }, { -24,  50 }, { -11,  74 }, {  23, -13 },
-    {  26, -13 }, {  40, -15 }, {  49, -14 }, {  44,   3 },
-    {  45,   6 }, {  44,  34 }, {  33,  54 }, {  19,  82 },
-    {  -3,  75 }, {  -1,  23 }, {   1,  34 }, {   1,  43 },
-    {   0,  54 }, {  -2,  55 }, {   0,  61 }, {   1,  64 },
-    {   0,  68 }, {  -9,  92 },
-
-    /* 436 -> 459 */
-    { -14, 106 }, { -13,  97 }, { -15,  90 }, { -12,  90 },
-    { -18,  88 }, { -10,  73 }, {  -9,  79 }, { -14,  86 },
-    { -10,  73 }, { -10,  70 }, { -10,  69 }, {  -5,  66 },
-    {  -9,  64 }, {  -5,  58 }, {   2,  59 }, {  21, -10 },
-    {  24, -11 }, {  28,  -8 }, {  28,  -1 }, {  29,   3 },
-    {  29,   9 }, {  35,  20 }, {  29,  36 }, {  14,  67 }
-};
-
-static const int8_t cabac_context_init_PB[3][460][2] =
-{
-    /* i_cabac_init_idc == 0 */
-    {
-        /* 0 - 10 */
-        {  20, -15 }, {   2,  54 }, {   3,  74 }, {  20, -15 },
-        {   2,  54 }, {   3,  74 }, { -28, 127 }, { -23, 104 },
-        {  -6,  53 }, {  -1,  54 }, {   7,  51 },
-
-        /* 11 - 23 */
-        {  23,  33 }, {  23,   2 }, {  21,   0 }, {   1,   9 },
-        {   0,  49 }, { -37, 118 }, {   5,  57 }, { -13,  78 },
-        { -11,  65 }, {   1,  62 }, {  12,  49 }, {  -4,  73 },
-        {  17,  50 },
-
-        /* 24 - 39 */
-        {  18,  64 }, {   9,  43 }, {  29,   0 }, {  26,  67 },
-        {  16,  90 }, {   9, 104 }, { -46, 127 }, { -20, 104 },
-        {   1,  67 }, { -13,  78 }, { -11,  65 }, {   1,  62 },
-        {  -6,  86 }, { -17,  95 }, {  -6,  61 }, {   9,  45 },
-
-        /* 40 - 53 */
-        {  -3,  69 }, {  -6,  81 }, { -11,  96 }, {   6,  55 },
-        {   7,  67 }, {  -5,  86 }, {   2,  88 }, {   0,  58 },
-        {  -3,  76 }, { -10,  94 }, {   5,  54 }, {   4,  69 },
-        {  -3,  81 }, {   0,  88 },
-
-        /* 54 - 59 */
-        {  -7,  67 }, {  -5,  74 }, {  -4,  74 }, {  -5,  80 },
-        {  -7,  72 }, {   1,  58 },
-
-        /* 60 - 69 */
-        {   0,  41 }, {   0,  63 }, {   0,  63 }, { 0, 63 },
-        {  -9,  83 }, {   4,  86 }, {   0,  97 }, { -7, 72 },
-        {  13,  41 }, {   3,  62 },
-
-        /* 70 - 87 */
-        {   0,  45 }, {  -4,  78 }, {  -3,  96 }, { -27,  126 },
-        { -28,  98 }, { -25, 101 }, { -23,  67 }, { -28,  82 },
-        { -20,  94 }, { -16,  83 }, { -22, 110 }, { -21,  91 },
-        { -18, 102 }, { -13,  93 }, { -29, 127 }, {  -7,  92 },
-        {  -5,  89 }, {  -7,  96 }, { -13, 108 }, {  -3,  46 },
-        {  -1,  65 }, {  -1,  57 }, {  -9,  93 }, {  -3,  74 },
-        {  -9,  92 }, {  -8,  87 }, { -23, 126 }, {   5,  54 },
-        {   6,  60 }, {   6,  59 }, {   6,  69 }, {  -1,  48 },
-        {   0,  68 }, {  -4,  69 }, {  -8,  88 },
-
-        /* 105 -> 165 */
-        {  -2,  85 }, {  -6,  78 }, {  -1,  75 }, {  -7,  77 },
-        {   2,  54 }, {   5,  50 }, {  -3,  68 }, {   1,  50 },
-        {   6,  42 }, {  -4,  81 }, {   1,  63 }, {  -4,  70 },
-        {   0,  67 }, {   2,  57 }, {  -2,  76 }, {  11,  35 },
-        {   4,  64 }, {   1,  61 }, {  11,  35 }, {  18,  25 },
-        {  12,  24 }, {  13,  29 }, {  13,  36 }, { -10,  93 },
-        {  -7,  73 }, {  -2,  73 }, {  13,  46 }, {   9,  49 },
-        {  -7, 100 }, {   9,  53 }, {   2,  53 }, {   5,  53 },
-        {  -2,  61 }, {   0,  56 }, {   0,  56 }, { -13,  63 },
-        {  -5,  60 }, {  -1,  62 }, {   4,  57 }, {  -6,  69 },
-        {   4,  57 }, {  14,  39 }, {   4,  51 }, {  13,  68 },
-        {   3,  64 }, {   1,  61 }, {   9,  63 }, {   7,  50 },
-        {  16,  39 }, {   5,  44 }, {   4,  52 }, {  11,  48 },
-        {  -5,  60 }, {  -1,  59 }, {   0,  59 }, {  22,  33 },
-        {   5,  44 }, {  14,  43 }, {  -1,  78 }, {   0,  60 },
-        {   9,  69 },
-
-        /* 166 - 226 */
-        {  11,  28 }, {   2,  40 }, {   3,  44 }, {   0,  49 },
-        {   0,  46 }, {   2,  44 }, {   2,  51 }, {   0,  47 },
-        {   4,  39 }, {   2,  62 }, {   6,  46 }, {   0,  54 },
-        {   3,  54 }, {   2,  58 }, {   4,  63 }, {   6,  51 },
-        {   6,  57 }, {   7,  53 }, {   6,  52 }, {   6,  55 },
-        {  11,  45 }, {  14,  36 }, {   8,  53 }, {  -1,  82 },
-        {   7,  55 }, {  -3,  78 }, {  15,  46 }, {  22,  31 },
-        {  -1,  84 }, {  25,   7 }, {  30,  -7 }, {  28,   3 },
-        {  28,   4 }, {  32,   0 }, {  34,  -1 }, {  30,   6 },
-        {  30,   6 }, {  32,   9 }, {  31,  19 }, {  26,  27 },
-        {  26,  30 }, {  37,  20 }, {  28,  34 }, {  17,  70 },
-        {   1,  67 }, {   5,  59 }, {   9,  67 }, {  16,  30 },
-        {  18,  32 }, {  18,  35 }, {  22,  29 }, {  24,  31 },
-        {  23,  38 }, {  18,  43 }, {  20,  41 }, {  11,  63 },
-        {   9,  59 }, {   9,  64 }, {  -1,  94 }, {  -2,  89 },
-        {  -9, 108 },
-
-        /* 227 - 275 */
-        {  -6,  76 }, {  -2,  44 }, {   0,  45 }, {   0,  52 },
-        {  -3,  64 }, {  -2,  59 }, {  -4,  70 }, {  -4,  75 },
-        {  -8,  82 }, { -17, 102 }, {  -9,  77 }, {   3,  24 },
-        {   0,  42 }, {   0,  48 }, {   0,  55 }, {  -6,  59 },
-        {  -7,  71 }, { -12,  83 }, { -11,  87 }, { -30, 119 },
-        {   1,  58 }, {  -3,  29 }, {  -1,  36 }, {   1,  38 },
-        {   2,  43 }, {  -6,  55 }, {   0,  58 }, {   0,  64 },
-        {  -3,  74 }, { -10,  90 }, {   0,  70 }, {  -4,  29 },
-        {   5,  31 }, {   7,  42 }, {   1,  59 }, {  -2,  58 },
-        {  -3,  72 }, {  -3,  81 }, { -11,  97 }, {   0,  58 },
-        {   8,   5 }, {  10,  14 }, {  14,  18 }, {  13,  27 },
-        {   2,  40 }, {   0,  58 }, {  -3,  70 }, {  -6,  79 },
-        {  -8,  85 },
-
-        /* 276 a bit special (not used, bypass is used instead) */
-        { 0, 0 },
-
-        /* 277 - 337 */
-        { -13, 106 }, { -16, 106 }, { -10,  87 }, { -21, 114 },
-        { -18, 110 }, { -14,  98 }, { -22, 110 }, { -21, 106 },
-        { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 },
-        { -10,  96 }, { -12,  95 }, {  -5,  91 }, {  -9,  93 },
-        { -22,  94 }, {  -5,  86 }, {   9,  67 }, {  -4,  80 },
-        { -10,  85 }, {  -1,  70 }, {   7,  60 }, {   9,  58 },
-        {   5,  61 }, {  12,  50 }, {  15,  50 }, {  18,  49 },
-        {  17,  54 }, {  10,  41 }, {   7,  46 }, {  -1,  51 },
-        {   7,  49 }, {   8,  52 }, {   9,  41 }, {   6,  47 },
-        {   2,  55 }, {  13,  41 }, {  10,  44 }, {   6,  50 },
-        {   5,  53 }, {  13,  49 }, {   4,  63 }, {   6,  64 },
-        {  -2,  69 }, {  -2,  59 }, {   6,  70 }, {  10,  44 },
-        {   9,  31 }, {  12,  43 }, {   3,  53 }, {  14,  34 },
-        {  10,  38 }, {  -3,  52 }, {  13,  40 }, {  17,  32 },
-        {   7,  44 }, {   7,  38 }, {  13,  50 }, {  10,  57 },
-        {  26,  43 },
-
-        /* 338 - 398 */
-        {  14,  11 }, {  11,  14 }, {   9,  11 }, {  18,  11 },
-        {  21,   9 }, {  23,  -2 }, {  32, -15 }, {  32, -15 },
-        {  34, -21 }, {  39, -23 }, {  42, -33 }, {  41, -31 },
-        {  46, -28 }, {  38, -12 }, {  21,  29 }, {  45, -24 },
-        {  53, -45 }, {  48, -26 }, {  65, -43 }, {  43, -19 },
-        {  39, -10 }, {  30,   9 }, {  18,  26 }, {  20,  27 },
-        {   0,  57 }, { -14,  82 }, {  -5,  75 }, { -19,  97 },
-        { -35, 125 }, {  27,   0 }, {  28,   0 }, {  31,  -4 },
-        {  27,   6 }, {  34,   8 }, {  30,  10 }, {  24,  22 },
-        {  33,  19 }, {  22,  32 }, {  26,  31 }, {  21,  41 },
-        {  26,  44 }, {  23,  47 }, {  16,  65 }, {  14,  71 },
-        {   8,  60 }, {   6,  63 }, {  17,  65 }, {  21,  24 },
-        {  23,  20 }, {  26,  23 }, {  27,  32 }, {  28,  23 },
-        {  28,  24 }, {  23,  40 }, {  24,  32 }, {  28,  29 },
-        {  23,  42 }, {  19,  57 }, {  22,  53 }, {  22,  61 },
-        {  11,  86 },
-
-        /* 399 - 435 */
-        {  12,  40 }, {  11,  51 }, {  14,  59 },
-        {  -4,  79 }, {  -7,  71 }, {  -5,  69 }, {  -9,  70 },
-        {  -8,  66 }, { -10,  68 }, { -19,  73 }, { -12,  69 },
-        { -16,  70 }, { -15,  67 }, { -20,  62 }, { -19,  70 },
-        { -16,  66 }, { -22,  65 }, { -20,  63 }, {   9,  -2 },
-        {  26,  -9 }, {  33,  -9 }, {  39,  -7 }, {  41,  -2 },
-        {  45,   3 }, {  49,   9 }, {  45,  27 }, {  36,  59 },
-        {  -6,  66 }, {  -7,  35 }, {  -7,  42 }, {  -8,  45 },
-        {  -5,  48 }, { -12,  56 }, {  -6,  60 }, {  -5,  62 },
-        {  -8,  66 }, {  -8,  76 },
-
-        /* 436 - 459 */
-        {  -5,  85 }, {  -6,  81 }, { -10,  77 }, {  -7,  81 },
-        { -17,  80 }, { -18,  73 }, {  -4,  74 }, { -10,  83 },
-        {  -9,  71 }, {  -9,  67 }, {  -1,  61 }, {  -8,  66 },
-        { -14,  66 }, {   0,  59 }, {   2,  59 }, {  21, -13 },
-        {  33, -14 }, {  39,  -7 }, {  46,  -2 }, {  51,   2 },
-        {  60,   6 }, {  61,  17 }, {  55,  34 }, {  42,  62 },
-    },
-
-    /* i_cabac_init_idc == 1 */
-    {
-        /* 0 - 10 */
-        {  20, -15 }, {   2,  54 }, {   3,  74 }, {  20, -15 },
-        {   2,  54 }, {   3,  74 }, { -28, 127 }, { -23, 104 },
-        {  -6,  53 }, {  -1,  54 }, {   7,  51 },
-
-        /* 11 - 23 */
-        {  22,  25 }, {  34,   0 }, {  16,   0 }, {  -2,   9 },
-        {   4,  41 }, { -29, 118 }, {   2,  65 }, {  -6,  71 },
-        { -13,  79 }, {   5,  52 }, {   9,  50 }, {  -3,  70 },
-        {  10,  54 },
-
-        /* 24 - 39 */
-        {  26,  34 }, {  19,  22 }, {  40,   0 }, {  57,   2 },
-        {  41,  36 }, {  26,  69 }, { -45, 127 }, { -15, 101 },
-        {  -4,  76 }, {  -6,  71 }, { -13,  79 }, {   5,  52 },
-        {   6,  69 }, { -13,  90 }, {   0,  52 }, {   8,  43 },
-
-        /* 40 - 53 */
-        {  -2,  69 },{  -5,  82 },{ -10,  96 },{   2,  59 },
-        {   2,  75 },{  -3,  87 },{  -3,  100 },{   1,  56 },
-        {  -3,  74 },{  -6,  85 },{   0,  59 },{  -3,  81 },
-        {  -7,  86 },{  -5,  95 },
-
-        /* 54 - 59 */
-        {  -1,  66 },{  -1,  77 },{   1,  70 },{  -2,  86 },
-        {  -5,  72 },{   0,  61 },
-
-        /* 60 - 69 */
-        { 0, 41 },   { 0, 63 },   { 0, 63 },     { 0, 63 },
-        { -9, 83 },  { 4, 86 },   { 0, 97 },     { -7, 72 },
-        { 13, 41 },  { 3, 62 },
-
-        /* 70 - 104 */
-        {  13,  15 }, {   7,  51 }, {   2,  80 }, { -39, 127 },
-        { -18,  91 }, { -17,  96 }, { -26,  81 }, { -35,  98 },
-        { -24, 102 }, { -23,  97 }, { -27, 119 }, { -24,  99 },
-        { -21, 110 }, { -18, 102 }, { -36, 127 }, {   0,  80 },
-        {  -5,  89 }, {  -7,  94 }, {  -4,  92 }, {   0,  39 },
-        {   0,  65 }, { -15,  84 }, { -35, 127 }, {  -2,  73 },
-        { -12, 104 }, {  -9,  91 }, { -31, 127 }, {   3,  55 },
-        {   7,  56 }, {   7,  55 }, {   8,  61 }, {  -3,  53 },
-        {   0,  68 }, {  -7,  74 }, {  -9,  88 },
-
-        /* 105 -> 165 */
-        { -13, 103 }, { -13,  91 }, {  -9,  89 }, { -14,  92 },
-        {  -8,  76 }, { -12,  87 }, { -23, 110 }, { -24, 105 },
-        { -10,  78 }, { -20, 112 }, { -17,  99 }, { -78, 127 },
-        { -70, 127 }, { -50, 127 }, { -46, 127 }, {  -4,  66 },
-        {  -5,  78 }, {  -4,  71 }, {  -8,  72 }, {   2,  59 },
-        {  -1,  55 }, {  -7,  70 }, {  -6,  75 }, {  -8,  89 },
-        { -34, 119 }, {  -3,  75 }, {  32,  20 }, {  30,  22 },
-        { -44, 127 }, {   0,  54 }, {  -5,  61 }, {   0,  58 },
-        {  -1,  60 }, {  -3,  61 }, {  -8,  67 }, { -25,  84 },
-        { -14,  74 }, {  -5,  65 }, {   5,  52 }, {   2,  57 },
-        {   0,  61 }, {  -9,  69 }, { -11,  70 }, {  18,  55 },
-        {  -4,  71 }, {   0,  58 }, {   7,  61 }, {   9,  41 },
-        {  18,  25 }, {   9,  32 }, {   5,  43 }, {   9,  47 },
-        {   0,  44 }, {   0,  51 }, {   2,  46 }, {  19,  38 },
-        {  -4,  66 }, {  15,  38 }, {  12,  42 }, {   9,  34 },
-        {   0,  89 },
-
-        /* 166 - 226 */
-        {   4,  45 }, {  10,  28 }, {  10,  31 }, {  33, -11 },
-        {  52, -43 }, {  18,  15 }, {  28,   0 }, {  35, -22 },
-        {  38, -25 }, {  34,   0 }, {  39, -18 }, {  32, -12 },
-        { 102, -94 }, {   0,   0 }, {  56, -15 }, {  33,  -4 },
-        {  29,  10 }, {  37,  -5 }, {  51, -29 }, {  39,  -9 },
-        {  52, -34 }, {  69, -58 }, {  67, -63 }, {  44,  -5 },
-        {  32,   7 }, {  55, -29 }, {  32,   1 }, {   0,   0 },
-        {  27,  36 }, {  33, -25 }, {  34, -30 }, {  36, -28 },
-        {  38, -28 }, {  38, -27 }, {  34, -18 }, {  35, -16 },
-        {  34, -14 }, {  32,  -8 }, {  37,  -6 }, {  35,   0 },
-        {  30,  10 }, {  28,  18 }, {  26,  25 }, {  29,  41 },
-        {   0,  75 }, {   2,  72 }, {   8,  77 }, {  14,  35 },
-        {  18,  31 }, {  17,  35 }, {  21,  30 }, {  17,  45 },
-        {  20,  42 }, {  18,  45 }, {  27,  26 }, {  16,  54 },
-        {   7,  66 }, {  16,  56 }, {  11,  73 }, {  10,  67 },
-        { -10, 116 },
-
-        /* 227 - 275 */
-        { -23, 112 }, { -15,  71 }, {  -7,  61 }, {   0,  53 },
-        {  -5,  66 }, { -11,  77 }, {  -9,  80 }, {  -9,  84 },
-        { -10,  87 }, { -34, 127 }, { -21, 101 }, {  -3,  39 },
-        {  -5,  53 }, {  -7,  61 }, { -11,  75 }, { -15,  77 },
-        { -17,  91 }, { -25, 107 }, { -25, 111 }, { -28, 122 },
-        { -11,  76 }, { -10,  44 }, { -10,  52 }, { -10,  57 },
-        {  -9,  58 }, { -16,  72 }, {  -7,  69 }, {  -4,  69 },
-        {  -5,  74 }, {  -9,  86 }, {   2,  66 }, {  -9,  34 },
-        {   1,  32 }, {  11,  31 }, {   5,  52 }, {  -2,  55 },
-        {  -2,  67 }, {   0,  73 }, {  -8,  89 }, {   3,  52 },
-        {   7,   4 }, {  10,   8 }, {  17,   8 }, {  16,  19 },
-        {   3,  37 }, {  -1,  61 }, {  -5,  73 }, {  -1,  70 },
-        {  -4,  78 },
-
-        /* 276 a bit special (not used, bypass is used instead) */
-        { 0, 0 },
-
-        /* 277 - 337 */
-        { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 },
-        { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 },
-        { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 },
-        { -10,  95 }, { -14, 100 }, {  -8,  95 }, { -17, 111 },
-        { -28, 114 }, {  -6,  89 }, {  -2,  80 }, {  -4,  82 },
-        {  -9,  85 }, {  -8,  81 }, {  -1,  72 }, {   5,  64 },
-        {   1,  67 }, {   9,  56 }, {   0,  69 }, {   1,  69 },
-        {   7,  69 }, {  -7,  69 }, {  -6,  67 }, { -16,  77 },
-        {  -2,  64 }, {   2,  61 }, {  -6,  67 }, {  -3,  64 },
-        {   2,  57 }, {  -3,  65 }, {  -3,  66 }, {   0,  62 },
-        {   9,  51 }, {  -1,  66 }, {  -2,  71 }, {  -2,  75 },
-        {  -1,  70 }, {  -9,  72 }, {  14,  60 }, {  16,  37 },
-        {   0,  47 }, {  18,  35 }, {  11,  37 }, {  12,  41 },
-        {  10,  41 }, {   2,  48 }, {  12,  41 }, {  13,  41 },
-        {   0,  59 }, {   3,  50 }, {  19,  40 }, {   3,  66 },
-        {  18,  50 },
-
-        /* 338 - 398 */
-        {  19,  -6 }, {  18,  -6 }, {  14,   0 }, {  26, -12 },
-        {  31, -16 }, {  33, -25 }, {  33, -22 }, {  37, -28 },
-        {  39, -30 }, {  42, -30 }, {  47, -42 }, {  45, -36 },
-        {  49, -34 }, {  41, -17 }, {  32,   9 }, {  69, -71 },
-        {  63, -63 }, {  66, -64 }, {  77, -74 }, {  54, -39 },
-        {  52, -35 }, {  41, -10 }, {  36,   0 }, {  40,  -1 },
-        {  30,  14 }, {  28,  26 }, {  23,  37 }, {  12,  55 },
-        {  11,  65 }, {  37, -33 }, {  39, -36 }, {  40, -37 },
-        {  38, -30 }, {  46, -33 }, {  42, -30 }, {  40, -24 },
-        {  49, -29 }, {  38, -12 }, {  40, -10 }, {  38,  -3 },
-        {  46,  -5 }, {  31,  20 }, {  29,  30 }, {  25,  44 },
-        {  12,  48 }, {  11,  49 }, {  26,  45 }, {  22,  22 },
-        {  23,  22 }, {  27,  21 }, {  33,  20 }, {  26,  28 },
-        {  30,  24 }, {  27,  34 }, {  18,  42 }, {  25,  39 },
-        {  18,  50 }, {  12,  70 }, {  21,  54 }, {  14,  71 },
-        {  11,  83 },
-
-        /* 399 - 435 */
-        {  25,  32 }, {  21,  49 }, {  21,  54 },
-        {  -5,  85 }, {  -6,  81 }, { -10,  77 }, {  -7,  81 },
-        { -17,  80 }, { -18,  73 }, {  -4,  74 }, { -10,  83 },
-        {  -9,  71 }, {  -9,  67 }, {  -1,  61 }, {  -8,  66 },
-        { -14,  66 }, {   0,  59 }, {   2,  59 }, {  17, -10 },
-        {  32, -13 }, {  42,  -9 }, {  49,  -5 }, {  53,   0 },
-        {  64,   3 }, {  68,  10 }, {  66,  27 }, {  47,  57 },
-        {  -5,  71 }, {   0,  24 }, {  -1,  36 }, {  -2,  42 },
-        {  -2,  52 }, {  -9,  57 }, {  -6,  63 }, {  -4,  65 },
-        {  -4,  67 }, {  -7,  82 },
-
-        /* 436 - 459 */
-        {  -3,  81 }, {  -3,  76 }, {  -7,  72 }, {  -6,  78 },
-        { -12,  72 }, { -14,  68 }, {  -3,  70 }, {  -6,  76 },
-        {  -5,  66 }, {  -5,  62 }, {   0,  57 }, {  -4,  61 },
-        {  -9,  60 }, {   1,  54 }, {   2,  58 }, {  17, -10 },
-        {  32, -13 }, {  42,  -9 }, {  49,  -5 }, {  53,   0 },
-        {  64,   3 }, {  68,  10 }, {  66,  27 }, {  47,  57 },
-    },
-
-    /* i_cabac_init_idc == 2 */
-    {
-        /* 0 - 10 */
-        {  20, -15 }, {   2,  54 }, {   3,  74 }, {  20, -15 },
-        {   2,  54 }, {   3,  74 }, { -28, 127 }, { -23, 104 },
-        {  -6,  53 }, {  -1,  54 }, {   7,  51 },
-
-        /* 11 - 23 */
-        {  29,  16 }, {  25,   0 }, {  14,   0 }, { -10,  51 },
-        {  -3,  62 }, { -27,  99 }, {  26,  16 }, {  -4,  85 },
-        { -24, 102 }, {   5,  57 }, {   6,  57 }, { -17,  73 },
-        {  14,  57 },
-
-        /* 24 - 39 */
-        {  20,  40 }, {  20,  10 }, {  29,   0 }, {  54,   0 },
-        {  37,  42 }, {  12,  97 }, { -32, 127 }, { -22, 117 },
-        {  -2,  74 }, {  -4,  85 }, { -24, 102 }, {   5,  57 },
-        {  -6,  93 }, { -14,  88 }, {  -6,  44 }, {   4,  55 },
-
-        /* 40 - 53 */
-        { -11,  89 },{ -15,  103 },{ -21,  116 },{  19,  57 },
-        {  20,  58 },{   4,  84 },{   6,  96 },{   1,  63 },
-        {  -5,  85 },{ -13,  106 },{   5,  63 },{   6,  75 },
-        {  -3,  90 },{  -1,  101 },
-
-        /* 54 - 59 */
-        {   3,  55 },{  -4,  79 },{  -2,  75 },{ -12,  97 },
-        {  -7,  50 },{   1,  60 },
-
-        /* 60 - 69 */
-        { 0, 41 },   { 0, 63 },   { 0, 63 },     { 0, 63 },
-        { -9, 83 },  { 4, 86 },   { 0, 97 },     { -7, 72 },
-        { 13, 41 },  { 3, 62 },
-
-        /* 70 - 104 */
-        {   7,  34 }, {  -9,  88 }, { -20, 127 }, { -36, 127 },
-        { -17,  91 }, { -14,  95 }, { -25,  84 }, { -25,  86 },
-        { -12,  89 }, { -17,  91 }, { -31, 127 }, { -14,  76 },
-        { -18, 103 }, { -13,  90 }, { -37, 127 }, {  11,  80 },
-        {   5,  76 }, {   2,  84 }, {   5,  78 }, {  -6,  55 },
-        {   4,  61 }, { -14,  83 }, { -37, 127 }, {  -5,  79 },
-        { -11, 104 }, { -11,  91 }, { -30, 127 }, {   0,  65 },
-        {  -2,  79 }, {   0,  72 }, {  -4,  92 }, {  -6,  56 },
-        {   3,  68 }, {  -8,  71 }, { -13,  98 },
-
-        /* 105 -> 165 */
-        {  -4,  86 }, { -12,  88 }, {  -5,  82 }, {  -3,  72 },
-        {  -4,  67 }, {  -8,  72 }, { -16,  89 }, {  -9,  69 },
-        {  -1,  59 }, {   5,  66 }, {   4,  57 }, {  -4,  71 },
-        {  -2,  71 }, {   2,  58 }, {  -1,  74 }, {  -4,  44 },
-        {  -1,  69 }, {   0,  62 }, {  -7,  51 }, {  -4,  47 },
-        {  -6,  42 }, {  -3,  41 }, {  -6,  53 }, {   8,  76 },
-        {  -9,  78 }, { -11,  83 }, {   9,  52 }, {   0,  67 },
-        {  -5,  90 }, {   1,  67 }, { -15,  72 }, {  -5,  75 },
-        {  -8,  80 }, { -21,  83 }, { -21,  64 }, { -13,  31 },
-        { -25,  64 }, { -29,  94 }, {   9,  75 }, {  17,  63 },
-        {  -8,  74 }, {  -5,  35 }, {  -2,  27 }, {  13,  91 },
-        {   3,  65 }, {  -7,  69 }, {   8,  77 }, { -10,  66 },
-        {   3,  62 }, {  -3,  68 }, { -20,  81 }, {   0,  30 },
-        {   1,   7 }, {  -3,  23 }, { -21,  74 }, {  16,  66 },
-        { -23, 124 }, {  17,  37 }, {  44, -18 }, {  50, -34 },
-        { -22, 127 },
-
-        /* 166 - 226 */
-        {   4,  39 }, {   0,  42 }, {   7,  34 }, {  11,  29 },
-        {   8,  31 }, {   6,  37 }, {   7,  42 }, {   3,  40 },
-        {   8,  33 }, {  13,  43 }, {  13,  36 }, {   4,  47 },
-        {   3,  55 }, {   2,  58 }, {   6,  60 }, {   8,  44 },
-        {  11,  44 }, {  14,  42 }, {   7,  48 }, {   4,  56 },
-        {   4,  52 }, {  13,  37 }, {   9,  49 }, {  19,  58 },
-        {  10,  48 }, {  12,  45 }, {   0,  69 }, {  20,  33 },
-        {   8,  63 }, {  35, -18 }, {  33, -25 }, {  28,  -3 },
-        {  24,  10 }, {  27,   0 }, {  34, -14 }, {  52, -44 },
-        {  39, -24 }, {  19,  17 }, {  31,  25 }, {  36,  29 },
-        {  24,  33 }, {  34,  15 }, {  30,  20 }, {  22,  73 },
-        {  20,  34 }, {  19,  31 }, {  27,  44 }, {  19,  16 },
-        {  15,  36 }, {  15,  36 }, {  21,  28 }, {  25,  21 },
-        {  30,  20 }, {  31,  12 }, {  27,  16 }, {  24,  42 },
-        {   0,  93 }, {  14,  56 }, {  15,  57 }, {  26,  38 },
-        { -24, 127 },
-
-        /* 227 - 275 */
-        { -24, 115 }, { -22,  82 }, {  -9,  62 }, {   0,  53 },
-        {   0,  59 }, { -14,  85 }, { -13,  89 }, { -13,  94 },
-        { -11,  92 }, { -29, 127 }, { -21, 100 }, { -14,  57 },
-        { -12,  67 }, { -11,  71 }, { -10,  77 }, { -21,  85 },
-        { -16,  88 }, { -23, 104 }, { -15,  98 }, { -37, 127 },
-        { -10,  82 }, {  -8,  48 }, {  -8,  61 }, {  -8,  66 },
-        {  -7,  70 }, { -14,  75 }, { -10,  79 }, {  -9,  83 },
-        { -12,  92 }, { -18, 108 }, {  -4,  79 }, { -22,  69 },
-        { -16,  75 }, {  -2,  58 }, {   1,  58 }, { -13,  78 },
-        {  -9,  83 }, {  -4,  81 }, { -13,  99 }, { -13,  81 },
-        {  -6,  38 }, { -13,  62 }, {  -6,  58 }, {  -2,  59 },
-        { -16,  73 }, { -10,  76 }, { -13,  86 }, {  -9,  83 },
-        { -10,  87 },
-
-        /* 276 a bit special (not used, bypass is used instead) */
-        { 0, 0 },
-
-        /* 277 - 337 */
-        { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 },
-        { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 },
-        { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 },
-        { -10,  94 }, { -15, 102 }, { -10,  99 }, { -13, 106 },
-        { -50, 127 }, {  -5,  92 }, {  17,  57 }, {  -5,  86 },
-        { -13,  94 }, { -12,  91 }, {  -2,  77 }, {   0,  71 },
-        {  -1,  73 }, {   4,  64 }, {  -7,  81 }, {   5,  64 },
-        {  15,  57 }, {   1,  67 }, {   0,  68 }, { -10,  67 },
-        {   1,  68 }, {   0,  77 }, {   2,  64 }, {   0,  68 },
-        {  -5,  78 }, {   7,  55 }, {   5,  59 }, {   2,  65 },
-        {  14,  54 }, {  15,  44 }, {   5,  60 }, {   2,  70 },
-        {  -2,  76 }, { -18,  86 }, {  12,  70 }, {   5,  64 },
-        { -12,  70 }, {  11,  55 }, {   5,  56 }, {   0,  69 },
-        {   2,  65 }, {  -6,  74 }, {   5,  54 }, {   7,  54 },
-        {  -6,  76 }, { -11,  82 }, {  -2,  77 }, {  -2,  77 },
-        {  25,  42 },
-
-        /* 338 - 398 */
-        {  17, -13 }, {  16,  -9 }, {  17, -12 }, {  27, -21 },
-        {  37, -30 }, {  41, -40 }, {  42, -41 }, {  48, -47 },
-        {  39, -32 }, {  46, -40 }, {  52, -51 }, {  46, -41 },
-        {  52, -39 }, {  43, -19 }, {  32,  11 }, {  61, -55 },
-        {  56, -46 }, {  62, -50 }, {  81, -67 }, {  45, -20 },
-        {  35,  -2 }, {  28,  15 }, {  34,   1 }, {  39,   1 },
-        {  30,  17 }, {  20,  38 }, {  18,  45 }, {  15,  54 },
-        {   0,  79 }, {  36, -16 }, {  37, -14 }, {  37, -17 },
-        {  32,   1 }, {  34,  15 }, {  29,  15 }, {  24,  25 },
-        {  34,  22 }, {  31,  16 }, {  35,  18 }, {  31,  28 },
-        {  33,  41 }, {  36,  28 }, {  27,  47 }, {  21,  62 },
-        {  18,  31 }, {  19,  26 }, {  36,  24 }, {  24,  23 },
-        {  27,  16 }, {  24,  30 }, {  31,  29 }, {  22,  41 },
-        {  22,  42 }, {  16,  60 }, {  15,  52 }, {  14,  60 },
-        {   3,  78 }, { -16, 123 }, {  21,  53 }, {  22,  56 },
-        {  25,  61 },
-
-        /* 399 - 435 */
-        {  21,  33 }, {  19,  50 }, {  17,  61 },
-        {  -3,  78 }, {  -8,  74 }, {  -9,  72 }, { -10,  72 },
-        { -18,  75 }, { -12,  71 }, { -11,  63 }, {  -5,  70 },
-        { -17,  75 }, { -14,  72 }, { -16,  67 }, {  -8,  53 },
-        { -14,  59 }, {  -9,  52 }, { -11,  68 }, {   9,  -2 },
-        {  30, -10 }, {  31,  -4 }, {  33,  -1 }, {  33,   7 },
-        {  31,  12 }, {  37,  23 }, {  31,  38 }, {  20,  64 },
-        {  -9,  71 }, {  -7,  37 }, {  -8,  44 }, { -11,  49 },
-        { -10,  56 }, { -12,  59 }, {  -8,  63 }, {  -9,  67 },
-        {  -6,  68 }, { -10,  79 },
-
-        /* 436 - 459 */
-        {  -3,  78 }, {  -8,  74 }, {  -9,  72 }, { -10,  72 },
-        { -18,  75 }, { -12,  71 }, { -11,  63 }, {  -5,  70 },
-        { -17,  75 }, { -14,  72 }, { -16,  67 }, {  -8,  53 },
-        { -14,  59 }, {  -9,  52 }, { -11,  68 }, {   9,  -2 },
-        {  30, -10 }, {  31,  -4 }, {  33,  -1 }, {  33,   7 },
-        {  31,  12 }, {  37,  23 }, {  31,  38 }, {  20,  64 },
-    }
-};
-
-void ff_h264_init_cabac_states(H264Context *h) {
-    MpegEncContext * const s = &h->s;
-    int i;
-    const int8_t (*tab)[2];
-
-    if( h->slice_type_nos == FF_I_TYPE ) tab = cabac_context_init_I;
-    else                                 tab = cabac_context_init_PB[h->cabac_init_idc];
-
-    /* calculate pre-state */
-    for( i= 0; i < 460; i++ ) {
-        int pre = 2*(((tab[i][0] * s->qscale) >>4 ) + tab[i][1]) - 127;
-
-        pre^= pre>>31;
-        if(pre > 124)
-            pre= 124 + (pre&1);
-
-        h->cabac_state[i] =  pre;
-    }
-}
-
-static int decode_cabac_field_decoding_flag(H264Context *h) {
-    MpegEncContext * const s = &h->s;
-    const long mbb_xy = h->mb_xy - 2L*s->mb_stride;
-
-    unsigned long ctx = 0;
-
-    ctx += h->mb_field_decoding_flag & !!s->mb_x; //for FMO:(s->current_picture.mb_type[mba_xy]>>7)&(h->slice_table[mba_xy] == h->slice_num);
-    ctx += (s->current_picture.mb_type[mbb_xy]>>7)&(h->slice_table[mbb_xy] == h->slice_num);
-
-    return get_cabac_noinline( &h->cabac, &(h->cabac_state+70)[ctx] );
-}
-
-static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) {
-    uint8_t *state= &h->cabac_state[ctx_base];
-    int mb_type;
-
-    if(intra_slice){
-        int ctx=0;
-        if( h->left_type[0] & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
-            ctx++;
-        if( h->top_type     & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
-            ctx++;
-        if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 )
-            return 0;   /* I4x4 */
-        state += 2;
-    }else{
-        if( get_cabac_noinline( &h->cabac, state ) == 0 )
-            return 0;   /* I4x4 */
-    }
-
-    if( get_cabac_terminate( &h->cabac ) )
-        return 25;  /* PCM */
-
-    mb_type = 1; /* I16x16 */
-    mb_type += 12 * get_cabac_noinline( &h->cabac, &state[1] ); /* cbp_luma != 0 */
-    if( get_cabac_noinline( &h->cabac, &state[2] ) ) /* cbp_chroma */
-        mb_type += 4 + 4 * get_cabac_noinline( &h->cabac, &state[2+intra_slice] );
-    mb_type += 2 * get_cabac_noinline( &h->cabac, &state[3+intra_slice] );
-    mb_type += 1 * get_cabac_noinline( &h->cabac, &state[3+2*intra_slice] );
-    return mb_type;
-}
-
-static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) {
-    MpegEncContext * const s = &h->s;
-    int mba_xy, mbb_xy;
-    int ctx = 0;
-
-    if(FRAME_MBAFF){ //FIXME merge with the stuff in fill_caches?
-        int mb_xy = mb_x + (mb_y&~1)*s->mb_stride;
-        mba_xy = mb_xy - 1;
-        if( (mb_y&1)
-            && h->slice_table[mba_xy] == h->slice_num
-            && MB_FIELD == !!IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) )
-            mba_xy += s->mb_stride;
-        if( MB_FIELD ){
-            mbb_xy = mb_xy - s->mb_stride;
-            if( !(mb_y&1)
-                && h->slice_table[mbb_xy] == h->slice_num
-                && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) )
-                mbb_xy -= s->mb_stride;
-        }else
-            mbb_xy = mb_x + (mb_y-1)*s->mb_stride;
-    }else{
-        int mb_xy = h->mb_xy;
-        mba_xy = mb_xy - 1;
-        mbb_xy = mb_xy - (s->mb_stride << FIELD_PICTURE);
-    }
-
-    if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mba_xy] ))
-        ctx++;
-    if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] ))
-        ctx++;
-
-    if( h->slice_type_nos == FF_B_TYPE )
-        ctx += 13;
-    return get_cabac_noinline( &h->cabac, &h->cabac_state[11+ctx] );
-}
-
-static int decode_cabac_mb_intra4x4_pred_mode( H264Context *h, int pred_mode ) {
-    int mode = 0;
-
-    if( get_cabac( &h->cabac, &h->cabac_state[68] ) )
-        return pred_mode;
-
-    mode += 1 * get_cabac( &h->cabac, &h->cabac_state[69] );
-    mode += 2 * get_cabac( &h->cabac, &h->cabac_state[69] );
-    mode += 4 * get_cabac( &h->cabac, &h->cabac_state[69] );
-
-    return mode + ( mode >= pred_mode );
-}
-
-static int decode_cabac_mb_chroma_pre_mode( H264Context *h) {
-    const int mba_xy = h->left_mb_xy[0];
-    const int mbb_xy = h->top_mb_xy;
-
-    int ctx = 0;
-
-    /* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */
-    if( h->left_type[0] && h->chroma_pred_mode_table[mba_xy] != 0 )
-        ctx++;
-
-    if( h->top_type     && h->chroma_pred_mode_table[mbb_xy] != 0 )
-        ctx++;
-
-    if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+ctx] ) == 0 )
-        return 0;
-
-    if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 )
-        return 1;
-    if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+3] ) == 0 )
-        return 2;
-    else
-        return 3;
-}
-
-static int decode_cabac_mb_cbp_luma( H264Context *h) {
-    int cbp_b, cbp_a, ctx, cbp = 0;
-
-    cbp_a = h->left_cbp;
-    cbp_b = h->top_cbp;
-
-    ctx = !(cbp_a & 0x02) + 2 * !(cbp_b & 0x04);
-    cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]);
-    ctx = !(cbp   & 0x01) + 2 * !(cbp_b & 0x08);
-    cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 1;
-    ctx = !(cbp_a & 0x08) + 2 * !(cbp   & 0x01);
-    cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 2;
-    ctx = !(cbp   & 0x04) + 2 * !(cbp   & 0x02);
-    cbp += get_cabac_noinline(&h->cabac, &h->cabac_state[73 + ctx]) << 3;
-    return cbp;
-}
-static int decode_cabac_mb_cbp_chroma( H264Context *h) {
-    int ctx;
-    int cbp_a, cbp_b;
-
-    cbp_a = (h->left_cbp>>4)&0x03;
-    cbp_b = (h-> top_cbp>>4)&0x03;
-
-    ctx = 0;
-    if( cbp_a > 0 ) ctx++;
-    if( cbp_b > 0 ) ctx += 2;
-    if( get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] ) == 0 )
-        return 0;
-
-    ctx = 4;
-    if( cbp_a == 2 ) ctx++;
-    if( cbp_b == 2 ) ctx += 2;
-    return 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[77 + ctx] );
-}
-
-static int decode_cabac_p_mb_sub_type( H264Context *h ) {
-    if( get_cabac( &h->cabac, &h->cabac_state[21] ) )
-        return 0;   /* 8x8 */
-    if( !get_cabac( &h->cabac, &h->cabac_state[22] ) )
-        return 1;   /* 8x4 */
-    if( get_cabac( &h->cabac, &h->cabac_state[23] ) )
-        return 2;   /* 4x8 */
-    return 3;       /* 4x4 */
-}
-static int decode_cabac_b_mb_sub_type( H264Context *h ) {
-    int type;
-    if( !get_cabac( &h->cabac, &h->cabac_state[36] ) )
-        return 0;   /* B_Direct_8x8 */
-    if( !get_cabac( &h->cabac, &h->cabac_state[37] ) )
-        return 1 + get_cabac( &h->cabac, &h->cabac_state[39] ); /* B_L0_8x8, B_L1_8x8 */
-    type = 3;
-    if( get_cabac( &h->cabac, &h->cabac_state[38] ) ) {
-        if( get_cabac( &h->cabac, &h->cabac_state[39] ) )
-            return 11 + get_cabac( &h->cabac, &h->cabac_state[39] ); /* B_L1_4x4, B_Bi_4x4 */
-        type += 4;
-    }
-    type += 2*get_cabac( &h->cabac, &h->cabac_state[39] );
-    type +=   get_cabac( &h->cabac, &h->cabac_state[39] );
-    return type;
-}
-
-static int decode_cabac_mb_ref( H264Context *h, int list, int n ) {
-    int refa = h->ref_cache[list][scan8[n] - 1];
-    int refb = h->ref_cache[list][scan8[n] - 8];
-    int ref  = 0;
-    int ctx  = 0;
-
-    if( h->slice_type_nos == FF_B_TYPE) {
-        if( refa > 0 && !(h->direct_cache[scan8[n] - 1]&(MB_TYPE_DIRECT2>>1)) )
-            ctx++;
-        if( refb > 0 && !(h->direct_cache[scan8[n] - 8]&(MB_TYPE_DIRECT2>>1)) )
-            ctx += 2;
-    } else {
-        if( refa > 0 )
-            ctx++;
-        if( refb > 0 )
-            ctx += 2;
-    }
-
-    while( get_cabac( &h->cabac, &h->cabac_state[54+ctx] ) ) {
-        ref++;
-        ctx = (ctx>>2)+4;
-        if(ref >= 32 /*h->ref_list[list]*/){
-            return -1;
-        }
-    }
-    return ref;
-}
-
-static int decode_cabac_mb_mvd( H264Context *h, int ctxbase, int amvd, int *mvda) {
-    int mvd;
-
-    if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+((amvd-3)>>(INT_BIT-1))+((amvd-33)>>(INT_BIT-1))+2])){
-//    if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+(amvd>2)+(amvd>32)])){
-        *mvda= 0;
-        return 0;
-    }
-
-    mvd= 1;
-    ctxbase+= 3;
-    while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase] ) ) {
-        if( mvd < 4 )
-            ctxbase++;
-        mvd++;
-    }
-
-    if( mvd >= 9 ) {
-        int k = 3;
-        while( get_cabac_bypass( &h->cabac ) ) {
-            mvd += 1 << k;
-            k++;
-            if(k>24){
-                av_log(h->s.avctx, AV_LOG_ERROR, "overflow in decode_cabac_mb_mvd\n");
-                return INT_MIN;
-            }
-        }
-        while( k-- ) {
-            mvd += get_cabac_bypass( &h->cabac )<<k;
-        }
-        *mvda=mvd < 70 ? mvd : 70;
-    }else
-        *mvda=mvd;
-    return get_cabac_bypass_sign( &h->cabac, -mvd );
-}
-
-#define DECODE_CABAC_MB_MVD( h,  list,  n )\
-{\
-    int amvd0 = h->mvd_cache[list][scan8[n] - 1][0] +\
-                h->mvd_cache[list][scan8[n] - 8][0];\
-    int amvd1 = h->mvd_cache[list][scan8[n] - 1][1] +\
-                h->mvd_cache[list][scan8[n] - 8][1];\
-\
-    mx += decode_cabac_mb_mvd( h, 40, amvd0, &mpx );\
-    my += decode_cabac_mb_mvd( h, 47, amvd1, &mpy );\
-}
-
-static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx, int is_dc ) {
-    int nza, nzb;
-    int ctx = 0;
-
-    if( is_dc ) {
-        if( cat == 0 ) {
-            nza = h->left_cbp&0x100;
-            nzb = h-> top_cbp&0x100;
-        } else {
-            nza = (h->left_cbp>>(6+idx))&0x01;
-            nzb = (h-> top_cbp>>(6+idx))&0x01;
-        }
-    } else {
-        assert(cat == 1 || cat == 2 || cat == 4);
-        nza = h->non_zero_count_cache[scan8[idx] - 1];
-        nzb = h->non_zero_count_cache[scan8[idx] - 8];
-    }
-
-    if( nza > 0 )
-        ctx++;
-
-    if( nzb > 0 )
-        ctx += 2;
-
-    return ctx + 4 * cat;
-}
-
-DECLARE_ASM_CONST(1, uint8_t, last_coeff_flag_offset_8x8)[63] = {
-    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
-    5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8
-};
-
-static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff, int is_dc ) {
-    static const int significant_coeff_flag_offset[2][6] = {
-      { 105+0, 105+15, 105+29, 105+44, 105+47, 402 },
-      { 277+0, 277+15, 277+29, 277+44, 277+47, 436 }
-    };
-    static const int last_coeff_flag_offset[2][6] = {
-      { 166+0, 166+15, 166+29, 166+44, 166+47, 417 },
-      { 338+0, 338+15, 338+29, 338+44, 338+47, 451 }
-    };
-    static const int coeff_abs_level_m1_offset[6] = {
-        227+0, 227+10, 227+20, 227+30, 227+39, 426
-    };
-    static const uint8_t significant_coeff_flag_offset_8x8[2][63] = {
-      { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5,
-        4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7,
-        7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11,
-       12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 },
-      { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5,
-        6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11,
-        9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9,
-        9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 }
-    };
-    /* node ctx: 0..3: abslevel1 (with abslevelgt1 == 0).
-     * 4..7: abslevelgt1 + 3 (and abslevel1 doesn't matter).
-     * map node ctx => cabac ctx for level=1 */
-    static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 };
-    /* map node ctx => cabac ctx for level>1 */
-    static const uint8_t coeff_abs_levelgt1_ctx[8] = { 5, 5, 5, 5, 6, 7, 8, 9 };
-    static const uint8_t coeff_abs_level_transition[2][8] = {
-    /* update node ctx after decoding a level=1 */
-        { 1, 2, 3, 3, 4, 5, 6, 7 },
-    /* update node ctx after decoding a level>1 */
-        { 4, 4, 4, 4, 5, 6, 7, 7 }
-    };
-
-    int index[64];
-
-    int av_unused last;
-    int coeff_count = 0;
-    int node_ctx = 0;
-
-    uint8_t *significant_coeff_ctx_base;
-    uint8_t *last_coeff_ctx_base;
-    uint8_t *abs_level_m1_ctx_base;
-
-#if !ARCH_X86
-#define CABAC_ON_STACK
-#endif
-#ifdef CABAC_ON_STACK
-#define CC &cc
-    CABACContext cc;
-    cc.range     = h->cabac.range;
-    cc.low       = h->cabac.low;
-    cc.bytestream= h->cabac.bytestream;
-#else
-#define CC &h->cabac
-#endif
-
-
-    /* cat: 0-> DC 16x16  n = 0
-     *      1-> AC 16x16  n = luma4x4idx
-     *      2-> Luma4x4   n = luma4x4idx
-     *      3-> DC Chroma n = iCbCr
-     *      4-> AC Chroma n = 16 + 4 * iCbCr + chroma4x4idx
-     *      5-> Luma8x8   n = 4 * luma8x8idx
-     */
-
-    /* read coded block flag */
-    if( is_dc || cat != 5 ) {
-        if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n, is_dc ) ] ) == 0 ) {
-            if( !is_dc )
-                h->non_zero_count_cache[scan8[n]] = 0;
-
-#ifdef CABAC_ON_STACK
-            h->cabac.range     = cc.range     ;
-            h->cabac.low       = cc.low       ;
-            h->cabac.bytestream= cc.bytestream;
-#endif
-            return;
-        }
-    }
-
-    significant_coeff_ctx_base = h->cabac_state
-        + significant_coeff_flag_offset[MB_FIELD][cat];
-    last_coeff_ctx_base = h->cabac_state
-        + last_coeff_flag_offset[MB_FIELD][cat];
-    abs_level_m1_ctx_base = h->cabac_state
-        + coeff_abs_level_m1_offset[cat];
-
-    if( !is_dc && cat == 5 ) {
-#define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \
-        for(last= 0; last < coefs; last++) { \
-            uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \
-            if( get_cabac( CC, sig_ctx )) { \
-                uint8_t *last_ctx = last_coeff_ctx_base + last_off; \
-                index[coeff_count++] = last; \
-                if( get_cabac( CC, last_ctx ) ) { \
-                    last= max_coeff; \
-                    break; \
-                } \
-            } \
-        }\
-        if( last == max_coeff -1 ) {\
-            index[coeff_count++] = last;\
-        }
-        const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
-#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
-        coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off);
-    } else {
-        coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index);
-#else
-        DECODE_SIGNIFICANCE( 63, sig_off[last], last_coeff_flag_offset_8x8[last] );
-    } else {
-        DECODE_SIGNIFICANCE( max_coeff - 1, last, last );
-#endif
-    }
-    assert(coeff_count > 0);
-
-    if( is_dc ) {
-        if( cat == 0 )
-            h->cbp_table[h->mb_xy] |= 0x100;
-        else
-            h->cbp_table[h->mb_xy] |= 0x40 << n;
-    } else {
-        if( cat == 5 )
-            fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
-        else {
-            assert( cat == 1 || cat == 2 || cat == 4 );
-            h->non_zero_count_cache[scan8[n]] = coeff_count;
-        }
-    }
-
-    do {
-        uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base;
-
-        int j= scantable[index[--coeff_count]];
-
-        if( get_cabac( CC, ctx ) == 0 ) {
-            node_ctx = coeff_abs_level_transition[0][node_ctx];
-            if( is_dc ) {
-                block[j] = get_cabac_bypass_sign( CC, -1);
-            }else{
-                block[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6;
-            }
-        } else {
-            int coeff_abs = 2;
-            ctx = coeff_abs_levelgt1_ctx[node_ctx] + abs_level_m1_ctx_base;
-            node_ctx = coeff_abs_level_transition[1][node_ctx];
-
-            while( coeff_abs < 15 && get_cabac( CC, ctx ) ) {
-                coeff_abs++;
-            }
-
-            if( coeff_abs >= 15 ) {
-                int j = 0;
-                while( get_cabac_bypass( CC ) ) {
-                    j++;
-                }
-
-                coeff_abs=1;
-                while( j-- ) {
-                    coeff_abs += coeff_abs + get_cabac_bypass( CC );
-                }
-                coeff_abs+= 14;
-            }
-
-            if( is_dc ) {
-                block[j] = get_cabac_bypass_sign( CC, -coeff_abs );
-            }else{
-                block[j] = (get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32) >> 6;
-            }
-        }
-    } while( coeff_count );
-#ifdef CABAC_ON_STACK
-            h->cabac.range     = cc.range     ;
-            h->cabac.low       = cc.low       ;
-            h->cabac.bytestream= cc.bytestream;
-#endif
-
-}
-
-static void decode_cabac_residual_dc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, int max_coeff ) {
-    decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1);
-}
-
-static void decode_cabac_residual_nondc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
-    decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0);
-}
-
-/**
- * decodes a macroblock
- * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed
- */
-int ff_h264_decode_mb_cabac(H264Context *h) {
-    MpegEncContext * const s = &h->s;
-    int mb_xy;
-    int mb_type, partition_count, cbp = 0;
-    int dct8x8_allowed= h->pps.transform_8x8_mode;
-
-    mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
-
-    tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
-    if( h->slice_type_nos != FF_I_TYPE ) {
-        int skip;
-        /* a skipped mb needs the aff flag from the following mb */
-        if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped )
-            skip = h->next_mb_skipped;
-        else
-            skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y );
-        /* read skip flags */
-        if( skip ) {
-            if( FRAME_MBAFF && (s->mb_y&1)==0 ){
-                s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP;
-                h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 );
-                if(!h->next_mb_skipped)
-                    h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
-            }
-
-            decode_mb_skip(h);
-
-            h->cbp_table[mb_xy] = 0;
-            h->chroma_pred_mode_table[mb_xy] = 0;
-            h->last_qscale_diff = 0;
-
-            return 0;
-
-        }
-    }
-    if(FRAME_MBAFF){
-        if( (s->mb_y&1) == 0 )
-            h->mb_mbaff =
-            h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
-    }
-
-    h->prev_mb_skipped = 0;
-
-    fill_decode_neighbors(h, -(MB_FIELD));
-
-    if( h->slice_type_nos == FF_B_TYPE ) {
-        int ctx = 0;
-        assert(h->slice_type_nos == FF_B_TYPE);
-
-        if( !IS_DIRECT( h->left_type[0]-1 ) )
-            ctx++;
-        if( !IS_DIRECT( h->top_type-1 ) )
-            ctx++;
-
-        if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+ctx] ) ){
-            mb_type= 0; /* B_Direct_16x16 */
-        }else if( !get_cabac_noinline( &h->cabac, &h->cabac_state[27+3] ) ) {
-            mb_type= 1 + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ); /* B_L[01]_16x16 */
-        }else{
-            int bits;
-            bits = get_cabac_noinline( &h->cabac, &h->cabac_state[27+4] ) << 3;
-            bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 2;
-            bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] ) << 1;
-            bits+= get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
-            if( bits < 8 ){
-                mb_type= bits + 3; /* B_Bi_16x16 through B_L1_L0_16x8 */
-            }else if( bits == 13 ){
-                mb_type= decode_cabac_intra_mb_type(h, 32, 0);
-                goto decode_intra_mb;
-            }else if( bits == 14 ){
-                mb_type= 11; /* B_L1_L0_8x16 */
-            }else if( bits == 15 ){
-                mb_type= 22; /* B_8x8 */
-            }else{
-                bits= ( bits<<1 ) + get_cabac_noinline( &h->cabac, &h->cabac_state[27+5] );
-                mb_type= bits - 4; /* B_L0_Bi_* through B_Bi_Bi_* */
-            }
-        }
-            partition_count= b_mb_type_info[mb_type].partition_count;
-            mb_type=         b_mb_type_info[mb_type].type;
-    } else if( h->slice_type_nos == FF_P_TYPE ) {
-        if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) {
-            /* P-type */
-            if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) {
-                /* P_L0_D16x16, P_8x8 */
-                mb_type= 3 * get_cabac_noinline( &h->cabac, &h->cabac_state[16] );
-            } else {
-                /* P_L0_D8x16, P_L0_D16x8 */
-                mb_type= 2 - get_cabac_noinline( &h->cabac, &h->cabac_state[17] );
-            }
-            partition_count= p_mb_type_info[mb_type].partition_count;
-            mb_type=         p_mb_type_info[mb_type].type;
-        } else {
-            mb_type= decode_cabac_intra_mb_type(h, 17, 0);
-            goto decode_intra_mb;
-        }
-    } else {
-        mb_type= decode_cabac_intra_mb_type(h, 3, 1);
-        if(h->slice_type == FF_SI_TYPE && mb_type)
-            mb_type--;
-        assert(h->slice_type_nos == FF_I_TYPE);
-decode_intra_mb:
-        partition_count = 0;
-        cbp= i_mb_type_info[mb_type].cbp;
-        h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
-        mb_type= i_mb_type_info[mb_type].type;
-    }
-    if(MB_FIELD)
-        mb_type |= MB_TYPE_INTERLACED;
-
-    h->slice_table[ mb_xy ]= h->slice_num;
-
-    if(IS_INTRA_PCM(mb_type)) {
-        const uint8_t *ptr;
-
-        // We assume these blocks are very rare so we do not optimize it.
-        // FIXME The two following lines get the bitstream position in the cabac
-        // decode, I think it should be done by a function in cabac.h (or cabac.c).
-        ptr= h->cabac.bytestream;
-        if(h->cabac.low&0x1) ptr--;
-        if(CABAC_BITS==16){
-            if(h->cabac.low&0x1FF) ptr--;
-        }
-
-        // The pixels are stored in the same order as levels in h->mb array.
-        memcpy(h->mb, ptr, 256); ptr+=256;
-        if(CHROMA){
-            memcpy(h->mb+128, ptr, 128); ptr+=128;
-        }
-
-        ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
-
-        // All blocks are present
-        h->cbp_table[mb_xy] = 0x1ef;
-        h->chroma_pred_mode_table[mb_xy] = 0;
-        // In deblocking, the quantizer is 0
-        s->current_picture.qscale_table[mb_xy]= 0;
-        // All coeffs are present
-        memset(h->non_zero_count[mb_xy], 16, 32);
-        s->current_picture.mb_type[mb_xy]= mb_type;
-        h->last_qscale_diff = 0;
-        return 0;
-    }
-
-    if(MB_MBAFF){
-        h->ref_count[0] <<= 1;
-        h->ref_count[1] <<= 1;
-    }
-
-    fill_decode_caches(h, mb_type);
-
-    if( IS_INTRA( mb_type ) ) {
-        int i, pred_mode;
-        if( IS_INTRA4x4( mb_type ) ) {
-            if( dct8x8_allowed && get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] ) ) {
-                mb_type |= MB_TYPE_8x8DCT;
-                for( i = 0; i < 16; i+=4 ) {
-                    int pred = pred_intra_mode( h, i );
-                    int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred );
-                    fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
-                }
-            } else {
-                for( i = 0; i < 16; i++ ) {
-                    int pred = pred_intra_mode( h, i );
-                    h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred );
-
-                //av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] );
-                }
-            }
-            ff_h264_write_back_intra_pred_mode(h);
-            if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1;
-        } else {
-            h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode );
-            if( h->intra16x16_pred_mode < 0 ) return -1;
-        }
-        if(CHROMA){
-            h->chroma_pred_mode_table[mb_xy] =
-            pred_mode                        = decode_cabac_mb_chroma_pre_mode( h );
-
-            pred_mode= ff_h264_check_intra_pred_mode( h, pred_mode );
-            if( pred_mode < 0 ) return -1;
-            h->chroma_pred_mode= pred_mode;
-        }
-    } else if( partition_count == 4 ) {
-        int i, j, sub_partition_count[4], list, ref[2][4];
-
-        if( h->slice_type_nos == FF_B_TYPE ) {
-            for( i = 0; i < 4; i++ ) {
-                h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h );
-                sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
-                h->sub_mb_type[i]=      b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
-            }
-            if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] |
-                          h->sub_mb_type[2] | h->sub_mb_type[3]) ) {
-                ff_h264_pred_direct_motion(h, &mb_type);
-                h->ref_cache[0][scan8[4]] =
-                h->ref_cache[1][scan8[4]] =
-                h->ref_cache[0][scan8[12]] =
-                h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
-                    for( i = 0; i < 4; i++ )
-                        fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, (h->sub_mb_type[i]>>1)&0xFF, 1 );
-            }
-        } else {
-            for( i = 0; i < 4; i++ ) {
-                h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h );
-                sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
-                h->sub_mb_type[i]=      p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
-            }
-        }
-
-        for( list = 0; list < h->list_count; list++ ) {
-                for( i = 0; i < 4; i++ ) {
-                    if(IS_DIRECT(h->sub_mb_type[i])) continue;
-                    if(IS_DIR(h->sub_mb_type[i], 0, list)){
-                        if( h->ref_count[list] > 1 ){
-                            ref[list][i] = decode_cabac_mb_ref( h, list, 4*i );
-                            if(ref[list][i] >= (unsigned)h->ref_count[list]){
-                                av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref[list][i], h->ref_count[list]);
-                                return -1;
-                            }
-                        }else
-                            ref[list][i] = 0;
-                    } else {
-                        ref[list][i] = -1;
-                    }
-                                                       h->ref_cache[list][ scan8[4*i]+1 ]=
-                    h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
-                }
-        }
-
-        if(dct8x8_allowed)
-            dct8x8_allowed = get_dct8x8_allowed(h);
-
-        for(list=0; list<h->list_count; list++){
-            for(i=0; i<4; i++){
-                h->ref_cache[list][ scan8[4*i]   ]=h->ref_cache[list][ scan8[4*i]+1 ];
-                if(IS_DIRECT(h->sub_mb_type[i])){
-                    fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 2);
-                    continue;
-                }
-
-                if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){
-                    const int sub_mb_type= h->sub_mb_type[i];
-                    const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
-                    for(j=0; j<sub_partition_count[i]; j++){
-                        int mpx, mpy;
-                        int mx, my;
-                        const int index= 4*i + block_width*j;
-                        int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
-                        uint8_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ];
-                        pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
-                        DECODE_CABAC_MB_MVD( h, list, index)
-                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-
-                        if(IS_SUB_8X8(sub_mb_type)){
-                            mv_cache[ 1 ][0]=
-                            mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
-                            mv_cache[ 1 ][1]=
-                            mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
-
-                            mvd_cache[ 1 ][0]=
-                            mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mpx;
-                            mvd_cache[ 1 ][1]=
-                            mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= mpy;
-                        }else if(IS_SUB_8X4(sub_mb_type)){
-                            mv_cache[ 1 ][0]= mx;
-                            mv_cache[ 1 ][1]= my;
-
-                            mvd_cache[ 1 ][0]=  mpx;
-                            mvd_cache[ 1 ][1]= mpy;
-                        }else if(IS_SUB_4X8(sub_mb_type)){
-                            mv_cache[ 8 ][0]= mx;
-                            mv_cache[ 8 ][1]= my;
-
-                            mvd_cache[ 8 ][0]= mpx;
-                            mvd_cache[ 8 ][1]= mpy;
-                        }
-                        mv_cache[ 0 ][0]= mx;
-                        mv_cache[ 0 ][1]= my;
-
-                        mvd_cache[ 0 ][0]= mpx;
-                        mvd_cache[ 0 ][1]= mpy;
-                    }
-                }else{
-                    fill_rectangle(h->mv_cache [list][ scan8[4*i] ], 2, 2, 8, 0, 4);
-                    fill_rectangle(h->mvd_cache[list][ scan8[4*i] ], 2, 2, 8, 0, 2);
-                }
-            }
-        }
-    } else if( IS_DIRECT(mb_type) ) {
-        ff_h264_pred_direct_motion(h, &mb_type);
-        fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 2);
-        fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 2);
-        dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
-    } else {
-        int list, i;
-        if(IS_16X16(mb_type)){
-            for(list=0; list<h->list_count; list++){
-                if(IS_DIR(mb_type, 0, list)){
-                    int ref;
-                    if(h->ref_count[list] > 1){
-                        ref= decode_cabac_mb_ref(h, list, 0);
-                        if(ref >= (unsigned)h->ref_count[list]){
-                            av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
-                            return -1;
-                        }
-                    }else
-                        ref=0;
-                        fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1);
-                }
-            }
-            for(list=0; list<h->list_count; list++){
-                if(IS_DIR(mb_type, 0, list)){
-                    int mx,my,mpx,mpy;
-                    pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
-                    DECODE_CABAC_MB_MVD( h, list, 0)
-                    tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-
-                    fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack8to16(mpx,mpy), 2);
-                    fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
-                }
-            }
-        }
-        else if(IS_16X8(mb_type)){
-            for(list=0; list<h->list_count; list++){
-                    for(i=0; i<2; i++){
-                        if(IS_DIR(mb_type, i, list)){
-                            int ref;
-                            if(h->ref_count[list] > 1){
-                                ref= decode_cabac_mb_ref( h, list, 8*i );
-                                if(ref >= (unsigned)h->ref_count[list]){
-                                    av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
-                                    return -1;
-                                }
-                            }else
-                                ref=0;
-                            fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1);
-                        }else
-                            fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);
-                    }
-            }
-            for(list=0; list<h->list_count; list++){
-                for(i=0; i<2; i++){
-                    if(IS_DIR(mb_type, i, list)){
-                        int mx,my,mpx,mpy;
-                        pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
-                        DECODE_CABAC_MB_MVD( h, list, 8*i)
-                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-
-                        fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack8to16(mpx,mpy), 2);
-                        fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4);
-                    }else{
-                        fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 2);
-                        fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4);
-                    }
-                }
-            }
-        }else{
-            assert(IS_8X16(mb_type));
-            for(list=0; list<h->list_count; list++){
-                    for(i=0; i<2; i++){
-                        if(IS_DIR(mb_type, i, list)){ //FIXME optimize
-                            int ref;
-                            if(h->ref_count[list] > 1){
-                                ref= decode_cabac_mb_ref( h, list, 4*i );
-                                if(ref >= (unsigned)h->ref_count[list]){
-                                    av_log(s->avctx, AV_LOG_ERROR, "Reference %d >= %d\n", ref, h->ref_count[list]);
-                                    return -1;
-                                }
-                            }else
-                                ref=0;
-                            fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1);
-                        }else
-                            fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);
-                    }
-            }
-            for(list=0; list<h->list_count; list++){
-                for(i=0; i<2; i++){
-                    if(IS_DIR(mb_type, i, list)){
-                        int mx,my,mpx,mpy;
-                        pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
-                        DECODE_CABAC_MB_MVD( h, list, 4*i)
-
-                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-                        fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack8to16(mpx,mpy), 2);
-                        fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4);
-                    }else{
-                        fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 2);
-                        fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4);
-                    }
-                }
-            }
-        }
-    }
-
-   if( IS_INTER( mb_type ) ) {
-        h->chroma_pred_mode_table[mb_xy] = 0;
-        write_back_motion( h, mb_type );
-   }
-
-    if( !IS_INTRA16x16( mb_type ) ) {
-        cbp  = decode_cabac_mb_cbp_luma( h );
-        if(CHROMA)
-            cbp |= decode_cabac_mb_cbp_chroma( h ) << 4;
-    }
-
-    h->cbp_table[mb_xy] = h->cbp = cbp;
-
-    if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) {
-        mb_type |= MB_TYPE_8x8DCT * get_cabac_noinline( &h->cabac, &h->cabac_state[399 + h->neighbor_transform_size] );
-    }
-    s->current_picture.mb_type[mb_xy]= mb_type;
-
-    if( cbp || IS_INTRA16x16( mb_type ) ) {
-        const uint8_t *scan, *scan8x8, *dc_scan;
-        const uint32_t *qmul;
-
-        if(IS_INTERLACED(mb_type)){
-            scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
-            scan= s->qscale ? h->field_scan : h->field_scan_q0;
-            dc_scan= luma_dc_field_scan;
-        }else{
-            scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
-            scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
-            dc_scan= luma_dc_zigzag_scan;
-        }
-
-        // decode_cabac_mb_dqp
-        if(get_cabac_noinline( &h->cabac, &h->cabac_state[60 + (h->last_qscale_diff != 0)])){
-            int val = 1;
-            int ctx= 2;
-
-            while( get_cabac_noinline( &h->cabac, &h->cabac_state[60 + ctx] ) ) {
-                ctx= 3;
-                val++;
-                if(val > 102){ //prevent infinite loop
-                    av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
-                }
-            }
-
-            if( val&0x01 )
-                val=   (val + 1)>>1 ;
-            else
-                val= -((val + 1)>>1);
-            h->last_qscale_diff = val;
-            s->qscale += val;
-            if(((unsigned)s->qscale) > 51){
-                if(s->qscale<0) s->qscale+= 52;
-                else            s->qscale-= 52;
-            }
-            h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale);
-            h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale);
-        }else
-            h->last_qscale_diff=0;
-
-        if( IS_INTRA16x16( mb_type ) ) {
-            int i;
-            //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 DC\n" );
-            decode_cabac_residual_dc( h, h->mb, 0, 0, dc_scan, 16);
-
-            if( cbp&15 ) {
-                qmul = h->dequant4_coeff[0][s->qscale];
-                for( i = 0; i < 16; i++ ) {
-                    //av_log( s->avctx, AV_LOG_ERROR, "INTRA16x16 AC:%d\n", i );
-                    decode_cabac_residual_nondc(h, h->mb + 16*i, 1, i, scan + 1, qmul, 15);
-                }
-            } else {
-                fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);
-            }
-        } else {
-            int i8x8, i4x4;
-            for( i8x8 = 0; i8x8 < 4; i8x8++ ) {
-                if( cbp & (1<<i8x8) ) {
-                    if( IS_8x8DCT(mb_type) ) {
-                        decode_cabac_residual_nondc(h, h->mb + 64*i8x8, 5, 4*i8x8,
-                            scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64);
-                    } else {
-                        qmul = h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale];
-                        for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
-                            const int index = 4*i8x8 + i4x4;
-                            //av_log( s->avctx, AV_LOG_ERROR, "Luma4x4: %d\n", index );
-//START_TIMER
-                            decode_cabac_residual_nondc(h, h->mb + 16*index, 2, index, scan, qmul, 16);
-//STOP_TIMER("decode_residual")
-                        }
-                    }
-                } else {
-                    uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
-                    nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
-                }
-            }
-        }
-
-        if( cbp&0x30 ){
-            int c;
-            for( c = 0; c < 2; c++ ) {
-                //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-DC\n",c );
-                decode_cabac_residual_dc(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, 4);
-            }
-        }
-
-        if( cbp&0x20 ) {
-            int c, i;
-            for( c = 0; c < 2; c++ ) {
-                qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]];
-                for( i = 0; i < 4; i++ ) {
-                    const int index = 16 + 4 * c + i;
-                    //av_log( s->avctx, AV_LOG_ERROR, "INTRA C%d-AC %d\n",c, index - 16 );
-                    decode_cabac_residual_nondc(h, h->mb + 16*index, 4, index, scan + 1, qmul, 15);
-                }
-            }
-        } else {
-            uint8_t * const nnz= &h->non_zero_count_cache[0];
-            nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
-            nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
-        }
-    } else {
-        uint8_t * const nnz= &h->non_zero_count_cache[0];
-        fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1);
-        nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
-        nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
-        h->last_qscale_diff = 0;
-    }
-
-    s->current_picture.qscale_table[mb_xy]= s->qscale;
-    write_back_non_zero_count(h);
-
-    if(MB_MBAFF){
-        h->ref_count[0] >>= 1;
-        h->ref_count[1] >>= 1;
-    }
-
-    return 0;
-}
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
deleted file mode 100644
index 0475e94..0000000
--- a/libavcodec/h264_cavlc.c
+++ /dev/null
@@ -1,1030 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... cavlc bitstream decoding
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 cavlc bitstream decoding.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#define CABAC 0
-
-#include "internal.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h264.h"
-#include "h264data.h" // FIXME FIXME FIXME
-#include "h264_mvpred.h"
-#include "golomb.h"
-
-//#undef NDEBUG
-#include <assert.h>
-
-static const uint8_t golomb_to_inter_cbp_gray[16]={
- 0, 1, 2, 4, 8, 3, 5,10,12,15, 7,11,13,14, 6, 9,
-};
-
-static const uint8_t golomb_to_intra4x4_cbp_gray[16]={
-15, 0, 7,11,13,14, 3, 5,10,12, 1, 2, 4, 8, 6, 9,
-};
-
-static const uint8_t chroma_dc_coeff_token_len[4*5]={
- 2, 0, 0, 0,
- 6, 1, 0, 0,
- 6, 6, 3, 0,
- 6, 7, 7, 6,
- 6, 8, 8, 7,
-};
-
-static const uint8_t chroma_dc_coeff_token_bits[4*5]={
- 1, 0, 0, 0,
- 7, 1, 0, 0,
- 4, 6, 1, 0,
- 3, 3, 2, 5,
- 2, 3, 2, 0,
-};
-
-static const uint8_t coeff_token_len[4][4*17]={
-{
-     1, 0, 0, 0,
-     6, 2, 0, 0,     8, 6, 3, 0,     9, 8, 7, 5,    10, 9, 8, 6,
-    11,10, 9, 7,    13,11,10, 8,    13,13,11, 9,    13,13,13,10,
-    14,14,13,11,    14,14,14,13,    15,15,14,14,    15,15,15,14,
-    16,15,15,15,    16,16,16,15,    16,16,16,16,    16,16,16,16,
-},
-{
-     2, 0, 0, 0,
-     6, 2, 0, 0,     6, 5, 3, 0,     7, 6, 6, 4,     8, 6, 6, 4,
-     8, 7, 7, 5,     9, 8, 8, 6,    11, 9, 9, 6,    11,11,11, 7,
-    12,11,11, 9,    12,12,12,11,    12,12,12,11,    13,13,13,12,
-    13,13,13,13,    13,14,13,13,    14,14,14,13,    14,14,14,14,
-},
-{
-     4, 0, 0, 0,
-     6, 4, 0, 0,     6, 5, 4, 0,     6, 5, 5, 4,     7, 5, 5, 4,
-     7, 5, 5, 4,     7, 6, 6, 4,     7, 6, 6, 4,     8, 7, 7, 5,
-     8, 8, 7, 6,     9, 8, 8, 7,     9, 9, 8, 8,     9, 9, 9, 8,
-    10, 9, 9, 9,    10,10,10,10,    10,10,10,10,    10,10,10,10,
-},
-{
-     6, 0, 0, 0,
-     6, 6, 0, 0,     6, 6, 6, 0,     6, 6, 6, 6,     6, 6, 6, 6,
-     6, 6, 6, 6,     6, 6, 6, 6,     6, 6, 6, 6,     6, 6, 6, 6,
-     6, 6, 6, 6,     6, 6, 6, 6,     6, 6, 6, 6,     6, 6, 6, 6,
-     6, 6, 6, 6,     6, 6, 6, 6,     6, 6, 6, 6,     6, 6, 6, 6,
-}
-};
-
-static const uint8_t coeff_token_bits[4][4*17]={
-{
-     1, 0, 0, 0,
-     5, 1, 0, 0,     7, 4, 1, 0,     7, 6, 5, 3,     7, 6, 5, 3,
-     7, 6, 5, 4,    15, 6, 5, 4,    11,14, 5, 4,     8,10,13, 4,
-    15,14, 9, 4,    11,10,13,12,    15,14, 9,12,    11,10,13, 8,
-    15, 1, 9,12,    11,14,13, 8,     7,10, 9,12,     4, 6, 5, 8,
-},
-{
-     3, 0, 0, 0,
-    11, 2, 0, 0,     7, 7, 3, 0,     7,10, 9, 5,     7, 6, 5, 4,
-     4, 6, 5, 6,     7, 6, 5, 8,    15, 6, 5, 4,    11,14,13, 4,
-    15,10, 9, 4,    11,14,13,12,     8,10, 9, 8,    15,14,13,12,
-    11,10, 9,12,     7,11, 6, 8,     9, 8,10, 1,     7, 6, 5, 4,
-},
-{
-    15, 0, 0, 0,
-    15,14, 0, 0,    11,15,13, 0,     8,12,14,12,    15,10,11,11,
-    11, 8, 9,10,     9,14,13, 9,     8,10, 9, 8,    15,14,13,13,
-    11,14,10,12,    15,10,13,12,    11,14, 9,12,     8,10,13, 8,
-    13, 7, 9,12,     9,12,11,10,     5, 8, 7, 6,     1, 4, 3, 2,
-},
-{
-     3, 0, 0, 0,
-     0, 1, 0, 0,     4, 5, 6, 0,     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,57,58,59,    60,61,62,63,
-}
-};
-
-static const uint8_t total_zeros_len[16][16]= {
-    {1,3,3,4,4,5,5,6,6,7,7,8,8,9,9,9},
-    {3,3,3,3,3,4,4,4,4,5,5,6,6,6,6},
-    {4,3,3,3,4,4,3,3,4,5,5,6,5,6},
-    {5,3,4,4,3,3,3,4,3,4,5,5,5},
-    {4,4,4,3,3,3,3,3,4,5,4,5},
-    {6,5,3,3,3,3,3,3,4,3,6},
-    {6,5,3,3,3,2,3,4,3,6},
-    {6,4,5,3,2,2,3,3,6},
-    {6,6,4,2,2,3,2,5},
-    {5,5,3,2,2,2,4},
-    {4,4,3,3,1,3},
-    {4,4,2,1,3},
-    {3,3,1,2},
-    {2,2,1},
-    {1,1},
-};
-
-static const uint8_t total_zeros_bits[16][16]= {
-    {1,3,2,3,2,3,2,3,2,3,2,3,2,3,2,1},
-    {7,6,5,4,3,5,4,3,2,3,2,3,2,1,0},
-    {5,7,6,5,4,3,4,3,2,3,2,1,1,0},
-    {3,7,5,4,6,5,4,3,3,2,2,1,0},
-    {5,4,3,7,6,5,4,3,2,1,1,0},
-    {1,1,7,6,5,4,3,2,1,1,0},
-    {1,1,5,4,3,3,2,1,1,0},
-    {1,1,1,3,3,2,2,1,0},
-    {1,0,1,3,2,1,1,1},
-    {1,0,1,3,2,1,1},
-    {0,1,1,2,1,3},
-    {0,1,1,1,1},
-    {0,1,1,1},
-    {0,1,1},
-    {0,1},
-};
-
-static const uint8_t chroma_dc_total_zeros_len[3][4]= {
-    { 1, 2, 3, 3,},
-    { 1, 2, 2, 0,},
-    { 1, 1, 0, 0,},
-};
-
-static const uint8_t chroma_dc_total_zeros_bits[3][4]= {
-    { 1, 1, 1, 0,},
-    { 1, 1, 0, 0,},
-    { 1, 0, 0, 0,},
-};
-
-static const uint8_t run_len[7][16]={
-    {1,1},
-    {1,2,2},
-    {2,2,2,2},
-    {2,2,2,3,3},
-    {2,2,3,3,3,3},
-    {2,3,3,3,3,3,3},
-    {3,3,3,3,3,3,3,4,5,6,7,8,9,10,11},
-};
-
-static const uint8_t run_bits[7][16]={
-    {1,0},
-    {1,1,0},
-    {3,2,1,0},
-    {3,2,1,1,0},
-    {3,2,3,2,1,0},
-    {3,0,1,3,2,5,4},
-    {7,6,5,4,3,2,1,1,1,1,1,1,1,1,1},
-};
-
-static VLC coeff_token_vlc[4];
-static VLC_TYPE coeff_token_vlc_tables[520+332+280+256][2];
-static const int coeff_token_vlc_tables_size[4]={520,332,280,256};
-
-static VLC chroma_dc_coeff_token_vlc;
-static VLC_TYPE chroma_dc_coeff_token_vlc_table[256][2];
-static const int chroma_dc_coeff_token_vlc_table_size = 256;
-
-static VLC total_zeros_vlc[15];
-static VLC_TYPE total_zeros_vlc_tables[15][512][2];
-static const int total_zeros_vlc_tables_size = 512;
-
-static VLC chroma_dc_total_zeros_vlc[3];
-static VLC_TYPE chroma_dc_total_zeros_vlc_tables[3][8][2];
-static const int chroma_dc_total_zeros_vlc_tables_size = 8;
-
-static VLC run_vlc[6];
-static VLC_TYPE run_vlc_tables[6][8][2];
-static const int run_vlc_tables_size = 8;
-
-static VLC run7_vlc;
-static VLC_TYPE run7_vlc_table[96][2];
-static const int run7_vlc_table_size = 96;
-
-#define LEVEL_TAB_BITS 8
-static int8_t cavlc_level_tab[7][1<<LEVEL_TAB_BITS][2];
-
-
-/**
- * gets the predicted number of non-zero coefficients.
- * @param n block index
- */
-static inline int pred_non_zero_count(H264Context *h, int n){
-    const int index8= scan8[n];
-    const int left= h->non_zero_count_cache[index8 - 1];
-    const int top = h->non_zero_count_cache[index8 - 8];
-    int i= left + top;
-
-    if(i<64) i= (i+1)>>1;
-
-    tprintf(h->s.avctx, "pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31);
-
-    return i&31;
-}
-
-static av_cold void init_cavlc_level_tab(void){
-    int suffix_length, mask;
-    unsigned int i;
-
-    for(suffix_length=0; suffix_length<7; suffix_length++){
-        for(i=0; i<(1<<LEVEL_TAB_BITS); i++){
-            int prefix= LEVEL_TAB_BITS - av_log2(2*i);
-            int level_code= (prefix<<suffix_length) + (i>>(LEVEL_TAB_BITS-prefix-1-suffix_length)) - (1<<suffix_length);
-
-            mask= -(level_code&1);
-            level_code= (((2+level_code)>>1) ^ mask) - mask;
-            if(prefix + 1 + suffix_length <= LEVEL_TAB_BITS){
-                cavlc_level_tab[suffix_length][i][0]= level_code;
-                cavlc_level_tab[suffix_length][i][1]= prefix + 1 + suffix_length;
-            }else if(prefix + 1 <= LEVEL_TAB_BITS){
-                cavlc_level_tab[suffix_length][i][0]= prefix+100;
-                cavlc_level_tab[suffix_length][i][1]= prefix + 1;
-            }else{
-                cavlc_level_tab[suffix_length][i][0]= LEVEL_TAB_BITS+100;
-                cavlc_level_tab[suffix_length][i][1]= LEVEL_TAB_BITS;
-            }
-        }
-    }
-}
-
-av_cold void ff_h264_decode_init_vlc(void){
-    static int done = 0;
-
-    if (!done) {
-        int i;
-        int offset;
-        done = 1;
-
-        chroma_dc_coeff_token_vlc.table = chroma_dc_coeff_token_vlc_table;
-        chroma_dc_coeff_token_vlc.table_allocated = chroma_dc_coeff_token_vlc_table_size;
-        init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5,
-                 &chroma_dc_coeff_token_len [0], 1, 1,
-                 &chroma_dc_coeff_token_bits[0], 1, 1,
-                 INIT_VLC_USE_NEW_STATIC);
-
-        offset = 0;
-        for(i=0; i<4; i++){
-            coeff_token_vlc[i].table = coeff_token_vlc_tables+offset;
-            coeff_token_vlc[i].table_allocated = coeff_token_vlc_tables_size[i];
-            init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17,
-                     &coeff_token_len [i][0], 1, 1,
-                     &coeff_token_bits[i][0], 1, 1,
-                     INIT_VLC_USE_NEW_STATIC);
-            offset += coeff_token_vlc_tables_size[i];
-        }
-        /*
-         * This is a one time safety check to make sure that
-         * the packed static coeff_token_vlc table sizes
-         * were initialized correctly.
-         */
-        assert(offset == FF_ARRAY_ELEMS(coeff_token_vlc_tables));
-
-        for(i=0; i<3; i++){
-            chroma_dc_total_zeros_vlc[i].table = chroma_dc_total_zeros_vlc_tables[i];
-            chroma_dc_total_zeros_vlc[i].table_allocated = chroma_dc_total_zeros_vlc_tables_size;
-            init_vlc(&chroma_dc_total_zeros_vlc[i],
-                     CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 4,
-                     &chroma_dc_total_zeros_len [i][0], 1, 1,
-                     &chroma_dc_total_zeros_bits[i][0], 1, 1,
-                     INIT_VLC_USE_NEW_STATIC);
-        }
-        for(i=0; i<15; i++){
-            total_zeros_vlc[i].table = total_zeros_vlc_tables[i];
-            total_zeros_vlc[i].table_allocated = total_zeros_vlc_tables_size;
-            init_vlc(&total_zeros_vlc[i],
-                     TOTAL_ZEROS_VLC_BITS, 16,
-                     &total_zeros_len [i][0], 1, 1,
-                     &total_zeros_bits[i][0], 1, 1,
-                     INIT_VLC_USE_NEW_STATIC);
-        }
-
-        for(i=0; i<6; i++){
-            run_vlc[i].table = run_vlc_tables[i];
-            run_vlc[i].table_allocated = run_vlc_tables_size;
-            init_vlc(&run_vlc[i],
-                     RUN_VLC_BITS, 7,
-                     &run_len [i][0], 1, 1,
-                     &run_bits[i][0], 1, 1,
-                     INIT_VLC_USE_NEW_STATIC);
-        }
-        run7_vlc.table = run7_vlc_table,
-        run7_vlc.table_allocated = run7_vlc_table_size;
-        init_vlc(&run7_vlc, RUN7_VLC_BITS, 16,
-                 &run_len [6][0], 1, 1,
-                 &run_bits[6][0], 1, 1,
-                 INIT_VLC_USE_NEW_STATIC);
-
-        init_cavlc_level_tab();
-    }
-}
-
-/**
- *
- */
-static inline int get_level_prefix(GetBitContext *gb){
-    unsigned int buf;
-    int log;
-
-    OPEN_READER(re, gb);
-    UPDATE_CACHE(re, gb);
-    buf=GET_CACHE(re, gb);
-
-    log= 32 - av_log2(buf);
-#ifdef TRACE
-    print_bin(buf>>(32-log), log);
-    av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d lpr @%5d in %s get_level_prefix\n", buf>>(32-log), log, log-1, get_bits_count(gb), __FILE__);
-#endif
-
-    LAST_SKIP_BITS(re, gb, log);
-    CLOSE_READER(re, gb);
-
-    return log-1;
-}
-
-/**
- * decodes a residual block.
- * @param n block index
- * @param scantable scantable
- * @param max_coeff number of coefficients in the block
- * @return <0 if an error occurred
- */
-static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){
-    MpegEncContext * const s = &h->s;
-    static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3};
-    int level[16];
-    int zeros_left, coeff_num, coeff_token, total_coeff, i, j, trailing_ones, run_before;
-
-    //FIXME put trailing_onex into the context
-
-    if(n == CHROMA_DC_BLOCK_INDEX){
-        coeff_token= get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1);
-        total_coeff= coeff_token>>2;
-    }else{
-        if(n == LUMA_DC_BLOCK_INDEX){
-            total_coeff= pred_non_zero_count(h, 0);
-            coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
-            total_coeff= coeff_token>>2;
-        }else{
-            total_coeff= pred_non_zero_count(h, n);
-            coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2);
-            total_coeff= coeff_token>>2;
-            h->non_zero_count_cache[ scan8[n] ]= total_coeff;
-        }
-    }
-
-    //FIXME set last_non_zero?
-
-    if(total_coeff==0)
-        return 0;
-    if(total_coeff > (unsigned)max_coeff) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff);
-        return -1;
-    }
-
-    trailing_ones= coeff_token&3;
-    tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);
-    assert(total_coeff<=16);
-
-    i = show_bits(gb, 3);
-    skip_bits(gb, trailing_ones);
-    level[0] = 1-((i&4)>>1);
-    level[1] = 1-((i&2)   );
-    level[2] = 1-((i&1)<<1);
-
-    if(trailing_ones<total_coeff) {
-        int mask, prefix;
-        int suffix_length = total_coeff > 10 & trailing_ones < 3;
-        int bitsi= show_bits(gb, LEVEL_TAB_BITS);
-        int level_code= cavlc_level_tab[suffix_length][bitsi][0];
-
-        skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
-        if(level_code >= 100){
-            prefix= level_code - 100;
-            if(prefix == LEVEL_TAB_BITS)
-                prefix += get_level_prefix(gb);
-
-            //first coefficient has suffix_length equal to 0 or 1
-            if(prefix<14){ //FIXME try to build a large unified VLC table for all this
-                if(suffix_length)
-                    level_code= (prefix<<1) + get_bits1(gb); //part
-                else
-                    level_code= prefix; //part
-            }else if(prefix==14){
-                if(suffix_length)
-                    level_code= (prefix<<1) + get_bits1(gb); //part
-                else
-                    level_code= prefix + get_bits(gb, 4); //part
-            }else{
-                level_code= 30 + get_bits(gb, prefix-3); //part
-                if(prefix>=16){
-                    if(prefix > 25+3){
-                        av_log(h->s.avctx, AV_LOG_ERROR, "Invalid level prefix\n");
-                        return -1;
-                    }
-                    level_code += (1<<(prefix-3))-4096;
-                }
-            }
-
-            if(trailing_ones < 3) level_code += 2;
-
-            suffix_length = 2;
-            mask= -(level_code&1);
-            level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask;
-        }else{
-            level_code += ((level_code>>31)|1) & -(trailing_ones < 3);
-
-            suffix_length = 1 + (level_code + 3U > 6U);
-            level[trailing_ones]= level_code;
-        }
-
-        //remaining coefficients have suffix_length > 0
-        for(i=trailing_ones+1;i<total_coeff;i++) {
-            static const unsigned int suffix_limit[7] = {0,3,6,12,24,48,INT_MAX };
-            int bitsi= show_bits(gb, LEVEL_TAB_BITS);
-            level_code= cavlc_level_tab[suffix_length][bitsi][0];
-
-            skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
-            if(level_code >= 100){
-                prefix= level_code - 100;
-                if(prefix == LEVEL_TAB_BITS){
-                    prefix += get_level_prefix(gb);
-                }
-                if(prefix<15){
-                    level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length);
-                }else{
-                    level_code = (15<<suffix_length) + get_bits(gb, prefix-3);
-                    if(prefix>=16)
-                        level_code += (1<<(prefix-3))-4096;
-                }
-                mask= -(level_code&1);
-                level_code= (((2+level_code)>>1) ^ mask) - mask;
-            }
-            level[i]= level_code;
-            suffix_length+= suffix_limit[suffix_length] + level_code > 2U*suffix_limit[suffix_length];
-        }
-    }
-
-    if(total_coeff == max_coeff)
-        zeros_left=0;
-    else{
-        if(n == CHROMA_DC_BLOCK_INDEX)
-            zeros_left= get_vlc2(gb, (chroma_dc_total_zeros_vlc-1)[ total_coeff ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1);
-        else
-            zeros_left= get_vlc2(gb, (total_zeros_vlc-1)[ total_coeff ].table, TOTAL_ZEROS_VLC_BITS, 1);
-    }
-
-    coeff_num = zeros_left + total_coeff - 1;
-    j = scantable[coeff_num];
-    if(n > 24){
-        block[j] = level[0];
-        for(i=1;i<total_coeff;i++) {
-            if(zeros_left <= 0)
-                run_before = 0;
-            else if(zeros_left < 7){
-                run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);
-            }else{
-                run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
-            }
-            zeros_left -= run_before;
-            coeff_num -= 1 + run_before;
-            j= scantable[ coeff_num ];
-
-            block[j]= level[i];
-        }
-    }else{
-        block[j] = (level[0] * qmul[j] + 32)>>6;
-        for(i=1;i<total_coeff;i++) {
-            if(zeros_left <= 0)
-                run_before = 0;
-            else if(zeros_left < 7){
-                run_before= get_vlc2(gb, (run_vlc-1)[zeros_left].table, RUN_VLC_BITS, 1);
-            }else{
-                run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2);
-            }
-            zeros_left -= run_before;
-            coeff_num -= 1 + run_before;
-            j= scantable[ coeff_num ];
-
-            block[j]= (level[i] * qmul[j] + 32)>>6;
-        }
-    }
-
-    if(zeros_left<0){
-        av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y);
-        return -1;
-    }
-
-    return 0;
-}
-
-int ff_h264_decode_mb_cavlc(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    int mb_xy;
-    int partition_count;
-    unsigned int mb_type, cbp;
-    int dct8x8_allowed= h->pps.transform_8x8_mode;
-
-    mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
-
-    tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
-    cbp = 0; /* avoid warning. FIXME: find a solution without slowing
-                down the code */
-    if(h->slice_type_nos != FF_I_TYPE){
-        if(s->mb_skip_run==-1)
-            s->mb_skip_run= get_ue_golomb(&s->gb);
-
-        if (s->mb_skip_run--) {
-            if(FRAME_MBAFF && (s->mb_y&1) == 0){
-                if(s->mb_skip_run==0)
-                    h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
-            }
-            decode_mb_skip(h);
-            return 0;
-        }
-    }
-    if(FRAME_MBAFF){
-        if( (s->mb_y&1) == 0 )
-            h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
-    }
-
-    h->prev_mb_skipped= 0;
-
-    mb_type= get_ue_golomb(&s->gb);
-    if(h->slice_type_nos == FF_B_TYPE){
-        if(mb_type < 23){
-            partition_count= b_mb_type_info[mb_type].partition_count;
-            mb_type=         b_mb_type_info[mb_type].type;
-        }else{
-            mb_type -= 23;
-            goto decode_intra_mb;
-        }
-    }else if(h->slice_type_nos == FF_P_TYPE){
-        if(mb_type < 5){
-            partition_count= p_mb_type_info[mb_type].partition_count;
-            mb_type=         p_mb_type_info[mb_type].type;
-        }else{
-            mb_type -= 5;
-            goto decode_intra_mb;
-        }
-    }else{
-       assert(h->slice_type_nos == FF_I_TYPE);
-        if(h->slice_type == FF_SI_TYPE && mb_type)
-            mb_type--;
-decode_intra_mb:
-        if(mb_type > 25){
-            av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y);
-            return -1;
-        }
-        partition_count=0;
-        cbp= i_mb_type_info[mb_type].cbp;
-        h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
-        mb_type= i_mb_type_info[mb_type].type;
-    }
-
-    if(MB_FIELD)
-        mb_type |= MB_TYPE_INTERLACED;
-
-    h->slice_table[ mb_xy ]= h->slice_num;
-
-    if(IS_INTRA_PCM(mb_type)){
-        unsigned int x;
-
-        // We assume these blocks are very rare so we do not optimize it.
-        align_get_bits(&s->gb);
-
-        // The pixels are stored in the same order as levels in h->mb array.
-        for(x=0; x < (CHROMA ? 384 : 256); x++){
-            ((uint8_t*)h->mb)[x]= get_bits(&s->gb, 8);
-        }
-
-        // In deblocking, the quantizer is 0
-        s->current_picture.qscale_table[mb_xy]= 0;
-        // All coeffs are present
-        memset(h->non_zero_count[mb_xy], 16, 32);
-
-        s->current_picture.mb_type[mb_xy]= mb_type;
-        return 0;
-    }
-
-    if(MB_MBAFF){
-        h->ref_count[0] <<= 1;
-        h->ref_count[1] <<= 1;
-    }
-
-    fill_decode_neighbors(h, mb_type);
-    fill_decode_caches(h, mb_type);
-
-    //mb_pred
-    if(IS_INTRA(mb_type)){
-        int pred_mode;
-//            init_top_left_availability(h);
-        if(IS_INTRA4x4(mb_type)){
-            int i;
-            int di = 1;
-            if(dct8x8_allowed && get_bits1(&s->gb)){
-                mb_type |= MB_TYPE_8x8DCT;
-                di = 4;
-            }
-
-//                fill_intra4x4_pred_table(h);
-            for(i=0; i<16; i+=di){
-                int mode= pred_intra_mode(h, i);
-
-                if(!get_bits1(&s->gb)){
-                    const int rem_mode= get_bits(&s->gb, 3);
-                    mode = rem_mode + (rem_mode >= mode);
-                }
-
-                if(di==4)
-                    fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
-                else
-                    h->intra4x4_pred_mode_cache[ scan8[i] ] = mode;
-            }
-            ff_h264_write_back_intra_pred_mode(h);
-            if( ff_h264_check_intra4x4_pred_mode(h) < 0)
-                return -1;
-        }else{
-            h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode);
-            if(h->intra16x16_pred_mode < 0)
-                return -1;
-        }
-        if(CHROMA){
-            pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb));
-            if(pred_mode < 0)
-                return -1;
-            h->chroma_pred_mode= pred_mode;
-        }
-    }else if(partition_count==4){
-        int i, j, sub_partition_count[4], list, ref[2][4];
-
-        if(h->slice_type_nos == FF_B_TYPE){
-            for(i=0; i<4; i++){
-                h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
-                if(h->sub_mb_type[i] >=13){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
-                    return -1;
-                }
-                sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
-                h->sub_mb_type[i]=      b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
-            }
-            if( IS_DIRECT(h->sub_mb_type[0]|h->sub_mb_type[1]|h->sub_mb_type[2]|h->sub_mb_type[3])) {
-                ff_h264_pred_direct_motion(h, &mb_type);
-                h->ref_cache[0][scan8[4]] =
-                h->ref_cache[1][scan8[4]] =
-                h->ref_cache[0][scan8[12]] =
-                h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
-            }
-        }else{
-            assert(h->slice_type_nos == FF_P_TYPE); //FIXME SP correct ?
-            for(i=0; i<4; i++){
-                h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
-                if(h->sub_mb_type[i] >=4){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
-                    return -1;
-                }
-                sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
-                h->sub_mb_type[i]=      p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
-            }
-        }
-
-        for(list=0; list<h->list_count; list++){
-            int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list];
-            for(i=0; i<4; i++){
-                if(IS_DIRECT(h->sub_mb_type[i])) continue;
-                if(IS_DIR(h->sub_mb_type[i], 0, list)){
-                    unsigned int tmp;
-                    if(ref_count == 1){
-                        tmp= 0;
-                    }else if(ref_count == 2){
-                        tmp= get_bits1(&s->gb)^1;
-                    }else{
-                        tmp= get_ue_golomb_31(&s->gb);
-                        if(tmp>=ref_count){
-                            av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp);
-                            return -1;
-                        }
-                    }
-                    ref[list][i]= tmp;
-                }else{
-                 //FIXME
-                    ref[list][i] = -1;
-                }
-            }
-        }
-
-        if(dct8x8_allowed)
-            dct8x8_allowed = get_dct8x8_allowed(h);
-
-        for(list=0; list<h->list_count; list++){
-            for(i=0; i<4; i++){
-                if(IS_DIRECT(h->sub_mb_type[i])) {
-                    h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ];
-                    continue;
-                }
-                h->ref_cache[list][ scan8[4*i]   ]=h->ref_cache[list][ scan8[4*i]+1 ]=
-                h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
-
-                if(IS_DIR(h->sub_mb_type[i], 0, list)){
-                    const int sub_mb_type= h->sub_mb_type[i];
-                    const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
-                    for(j=0; j<sub_partition_count[i]; j++){
-                        int mx, my;
-                        const int index= 4*i + block_width*j;
-                        int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
-                        pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
-                        mx += get_se_golomb(&s->gb);
-                        my += get_se_golomb(&s->gb);
-                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-
-                        if(IS_SUB_8X8(sub_mb_type)){
-                            mv_cache[ 1 ][0]=
-                            mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
-                            mv_cache[ 1 ][1]=
-                            mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
-                        }else if(IS_SUB_8X4(sub_mb_type)){
-                            mv_cache[ 1 ][0]= mx;
-                            mv_cache[ 1 ][1]= my;
-                        }else if(IS_SUB_4X8(sub_mb_type)){
-                            mv_cache[ 8 ][0]= mx;
-                            mv_cache[ 8 ][1]= my;
-                        }
-                        mv_cache[ 0 ][0]= mx;
-                        mv_cache[ 0 ][1]= my;
-                    }
-                }else{
-                    uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
-                    p[0] = p[1]=
-                    p[8] = p[9]= 0;
-                }
-            }
-        }
-    }else if(IS_DIRECT(mb_type)){
-        ff_h264_pred_direct_motion(h, &mb_type);
-        dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
-    }else{
-        int list, mx, my, i;
-         //FIXME we should set ref_idx_l? to 0 if we use that later ...
-        if(IS_16X16(mb_type)){
-            for(list=0; list<h->list_count; list++){
-                    unsigned int val;
-                    if(IS_DIR(mb_type, 0, list)){
-                        if(h->ref_count[list]==1){
-                            val= 0;
-                        }else if(h->ref_count[list]==2){
-                            val= get_bits1(&s->gb)^1;
-                        }else{
-                            val= get_ue_golomb_31(&s->gb);
-                            if(val >= h->ref_count[list]){
-                                av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
-                                return -1;
-                            }
-                        }
-                    fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1);
-                    }
-            }
-            for(list=0; list<h->list_count; list++){
-                if(IS_DIR(mb_type, 0, list)){
-                    pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my);
-                    mx += get_se_golomb(&s->gb);
-                    my += get_se_golomb(&s->gb);
-                    tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-
-                    fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
-                }
-            }
-        }
-        else if(IS_16X8(mb_type)){
-            for(list=0; list<h->list_count; list++){
-                    for(i=0; i<2; i++){
-                        unsigned int val;
-                        if(IS_DIR(mb_type, i, list)){
-                            if(h->ref_count[list] == 1){
-                                val= 0;
-                            }else if(h->ref_count[list] == 2){
-                                val= get_bits1(&s->gb)^1;
-                            }else{
-                                val= get_ue_golomb_31(&s->gb);
-                                if(val >= h->ref_count[list]){
-                                    av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
-                                    return -1;
-                                }
-                            }
-                        }else
-                            val= LIST_NOT_USED&0xFF;
-                        fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1);
-                    }
-            }
-            for(list=0; list<h->list_count; list++){
-                for(i=0; i<2; i++){
-                    unsigned int val;
-                    if(IS_DIR(mb_type, i, list)){
-                        pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
-                        mx += get_se_golomb(&s->gb);
-                        my += get_se_golomb(&s->gb);
-                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-
-                        val= pack16to32(mx,my);
-                    }else
-                        val=0;
-                    fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4);
-                }
-            }
-        }else{
-            assert(IS_8X16(mb_type));
-            for(list=0; list<h->list_count; list++){
-                    for(i=0; i<2; i++){
-                        unsigned int val;
-                        if(IS_DIR(mb_type, i, list)){ //FIXME optimize
-                            if(h->ref_count[list]==1){
-                                val= 0;
-                            }else if(h->ref_count[list]==2){
-                                val= get_bits1(&s->gb)^1;
-                            }else{
-                                val= get_ue_golomb_31(&s->gb);
-                                if(val >= h->ref_count[list]){
-                                    av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
-                                    return -1;
-                                }
-                            }
-                        }else
-                            val= LIST_NOT_USED&0xFF;
-                        fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1);
-                    }
-            }
-            for(list=0; list<h->list_count; list++){
-                for(i=0; i<2; i++){
-                    unsigned int val;
-                    if(IS_DIR(mb_type, i, list)){
-                        pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
-                        mx += get_se_golomb(&s->gb);
-                        my += get_se_golomb(&s->gb);
-                        tprintf(s->avctx, "final mv:%d %d\n", mx, my);
-
-                        val= pack16to32(mx,my);
-                    }else
-                        val=0;
-                    fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4);
-                }
-            }
-        }
-    }
-
-    if(IS_INTER(mb_type))
-        write_back_motion(h, mb_type);
-
-    if(!IS_INTRA16x16(mb_type)){
-        cbp= get_ue_golomb(&s->gb);
-        if(cbp > 47){
-            av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y);
-            return -1;
-        }
-
-        if(CHROMA){
-            if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp];
-            else                     cbp= golomb_to_inter_cbp   [cbp];
-        }else{
-            if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp];
-            else                     cbp= golomb_to_inter_cbp_gray[cbp];
-        }
-    }
-
-    if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){
-        mb_type |= MB_TYPE_8x8DCT*get_bits1(&s->gb);
-    }
-    h->cbp=
-    h->cbp_table[mb_xy]= cbp;
-    s->current_picture.mb_type[mb_xy]= mb_type;
-
-    if(cbp || IS_INTRA16x16(mb_type)){
-        int i8x8, i4x4, chroma_idx;
-        int dquant;
-        GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
-        const uint8_t *scan, *scan8x8, *dc_scan;
-
-        if(IS_INTERLACED(mb_type)){
-            scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
-            scan= s->qscale ? h->field_scan : h->field_scan_q0;
-            dc_scan= luma_dc_field_scan;
-        }else{
-            scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0;
-            scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
-            dc_scan= luma_dc_zigzag_scan;
-        }
-
-        dquant= get_se_golomb(&s->gb);
-
-        s->qscale += dquant;
-
-        if(((unsigned)s->qscale) > 51){
-            if(s->qscale<0) s->qscale+= 52;
-            else            s->qscale-= 52;
-            if(((unsigned)s->qscale) > 51){
-                av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
-                return -1;
-            }
-        }
-
-        h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale);
-        h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale);
-        if(IS_INTRA16x16(mb_type)){
-            if( decode_residual(h, h->intra_gb_ptr, h->mb, LUMA_DC_BLOCK_INDEX, dc_scan, h->dequant4_coeff[0][s->qscale], 16) < 0){
-                return -1; //FIXME continue if partitioned and other return -1 too
-            }
-
-            assert((cbp&15) == 0 || (cbp&15) == 15);
-
-            if(cbp&15){
-                for(i8x8=0; i8x8<4; i8x8++){
-                    for(i4x4=0; i4x4<4; i4x4++){
-                        const int index= i4x4 + 4*i8x8;
-                        if( decode_residual(h, h->intra_gb_ptr, h->mb + 16*index, index, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 ){
-                            return -1;
-                        }
-                    }
-                }
-            }else{
-                fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);
-            }
-        }else{
-            for(i8x8=0; i8x8<4; i8x8++){
-                if(cbp & (1<<i8x8)){
-                    if(IS_8x8DCT(mb_type)){
-                        DCTELEM *buf = &h->mb[64*i8x8];
-                        uint8_t *nnz;
-                        for(i4x4=0; i4x4<4; i4x4++){
-                            if( decode_residual(h, gb, buf, i4x4+4*i8x8, scan8x8+16*i4x4,
-                                                h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 16) <0 )
-                                return -1;
-                        }
-                        nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
-                        nnz[0] += nnz[1] + nnz[8] + nnz[9];
-                    }else{
-                        for(i4x4=0; i4x4<4; i4x4++){
-                            const int index= i4x4 + 4*i8x8;
-
-                            if( decode_residual(h, gb, h->mb + 16*index, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) <0 ){
-                                return -1;
-                            }
-                        }
-                    }
-                }else{
-                    uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
-                    nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
-                }
-            }
-        }
-
-        if(cbp&0x30){
-            for(chroma_idx=0; chroma_idx<2; chroma_idx++)
-                if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){
-                    return -1;
-                }
-        }
-
-        if(cbp&0x20){
-            for(chroma_idx=0; chroma_idx<2; chroma_idx++){
-                const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]];
-                for(i4x4=0; i4x4<4; i4x4++){
-                    const int index= 16 + 4*chroma_idx + i4x4;
-                    if( decode_residual(h, gb, h->mb + 16*index, index, scan + 1, qmul, 15) < 0){
-                        return -1;
-                    }
-                }
-            }
-        }else{
-            uint8_t * const nnz= &h->non_zero_count_cache[0];
-            nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
-            nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
-        }
-    }else{
-        uint8_t * const nnz= &h->non_zero_count_cache[0];
-        fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1);
-        nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
-        nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
-    }
-    s->current_picture.qscale_table[mb_xy]= s->qscale;
-    write_back_non_zero_count(h);
-
-    if(MB_MBAFF){
-        h->ref_count[0] >>= 1;
-        h->ref_count[1] >>= 1;
-    }
-
-    return 0;
-}
-
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
deleted file mode 100644
index d22780d..0000000
--- a/libavcodec/h264_direct.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... direct mb/block decoding
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 direct mb/block decoding.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h264.h"
-#include "rectangle.h"
-
-//#undef NDEBUG
-#include <assert.h>
-
-
-static int get_scale_factor(H264Context * const h, int poc, int poc1, int i){
-    int poc0 = h->ref_list[0][i].poc;
-    int td = av_clip(poc1 - poc0, -128, 127);
-    if(td == 0 || h->ref_list[0][i].long_ref){
-        return 256;
-    }else{
-        int tb = av_clip(poc - poc0, -128, 127);
-        int tx = (16384 + (FFABS(td) >> 1)) / td;
-        return av_clip((tb*tx + 32) >> 6, -1024, 1023);
-    }
-}
-
-void ff_h264_direct_dist_scale_factor(H264Context * const h){
-    MpegEncContext * const s = &h->s;
-    const int poc = h->s.current_picture_ptr->field_poc[ s->picture_structure == PICT_BOTTOM_FIELD ];
-    const int poc1 = h->ref_list[1][0].poc;
-    int i, field;
-    for(field=0; field<2; field++){
-        const int poc  = h->s.current_picture_ptr->field_poc[field];
-        const int poc1 = h->ref_list[1][0].field_poc[field];
-        for(i=0; i < 2*h->ref_count[0]; i++)
-            h->dist_scale_factor_field[field][i^field] = get_scale_factor(h, poc, poc1, i+16);
-    }
-
-    for(i=0; i<h->ref_count[0]; i++){
-        h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);
-    }
-}
-
-static void fill_colmap(H264Context *h, int map[2][16+32], int list, int field, int colfield, int mbafi){
-    MpegEncContext * const s = &h->s;
-    Picture * const ref1 = &h->ref_list[1][0];
-    int j, old_ref, rfield;
-    int start= mbafi ? 16                      : 0;
-    int end  = mbafi ? 16+2*h->ref_count[0]    : h->ref_count[0];
-    int interl= mbafi || s->picture_structure != PICT_FRAME;
-
-    /* bogus; fills in for missing frames */
-    memset(map[list], 0, sizeof(map[list]));
-
-    for(rfield=0; rfield<2; rfield++){
-        for(old_ref=0; old_ref<ref1->ref_count[colfield][list]; old_ref++){
-            int poc = ref1->ref_poc[colfield][list][old_ref];
-
-            if     (!interl)
-                poc |= 3;
-            else if( interl && (poc&3) == 3) //FIXME store all MBAFF references so this isnt needed
-                poc= (poc&~3) + rfield + 1;
-
-            for(j=start; j<end; j++){
-                if(4*h->ref_list[0][j].frame_num + (h->ref_list[0][j].reference&3) == poc){
-                    int cur_ref= mbafi ? (j-16)^field : j;
-                    map[list][2*old_ref + (rfield^field) + 16] = cur_ref;
-                    if(rfield == field || !interl)
-                        map[list][old_ref] = cur_ref;
-                    break;
-                }
-            }
-        }
-    }
-}
-
-void ff_h264_direct_ref_list_init(H264Context * const h){
-    MpegEncContext * const s = &h->s;
-    Picture * const ref1 = &h->ref_list[1][0];
-    Picture * const cur = s->current_picture_ptr;
-    int list, j, field;
-    int sidx= (s->picture_structure&1)^1;
-    int ref1sidx= (ref1->reference&1)^1;
-
-    for(list=0; list<2; list++){
-        cur->ref_count[sidx][list] = h->ref_count[list];
-        for(j=0; j<h->ref_count[list]; j++)
-            cur->ref_poc[sidx][list][j] = 4*h->ref_list[list][j].frame_num + (h->ref_list[list][j].reference&3);
-    }
-
-    if(s->picture_structure == PICT_FRAME){
-        memcpy(cur->ref_count[1], cur->ref_count[0], sizeof(cur->ref_count[0]));
-        memcpy(cur->ref_poc  [1], cur->ref_poc  [0], sizeof(cur->ref_poc  [0]));
-    }
-
-    cur->mbaff= FRAME_MBAFF;
-
-    h->col_fieldoff= 0;
-    if(s->picture_structure == PICT_FRAME){
-        int cur_poc = s->current_picture_ptr->poc;
-        int *col_poc = h->ref_list[1]->field_poc;
-        h->col_parity= (FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc));
-        ref1sidx=sidx= h->col_parity;
-    }else if(!(s->picture_structure & h->ref_list[1][0].reference) && !h->ref_list[1][0].mbaff){ // FL -> FL & differ parity
-        h->col_fieldoff= s->mb_stride*(2*(h->ref_list[1][0].reference) - 3);
-    }
-
-    if(cur->pict_type != FF_B_TYPE || h->direct_spatial_mv_pred)
-        return;
-
-    for(list=0; list<2; list++){
-        fill_colmap(h, h->map_col_to_list0, list, sidx, ref1sidx, 0);
-        if(FRAME_MBAFF)
-        for(field=0; field<2; field++)
-            fill_colmap(h, h->map_col_to_list0_field[field], list, field, field, 1);
-    }
-}
-
-static void pred_spatial_direct_motion(H264Context * const h, int *mb_type){
-    MpegEncContext * const s = &h->s;
-    int b8_stride = 2;
-    int b4_stride = h->b_stride;
-    int mb_xy = h->mb_xy;
-    int mb_type_col[2];
-    const int16_t (*l1mv0)[2], (*l1mv1)[2];
-    const int8_t *l1ref0, *l1ref1;
-    const int is_b8x8 = IS_8X8(*mb_type);
-    unsigned int sub_mb_type= MB_TYPE_L0L1;
-    int i8, i4;
-    int ref[2];
-    int mv[2];
-    int list;
-
-    assert(h->ref_list[1][0].reference&3);
-
-#define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM)
-
-
-    /* ref = min(neighbors) */
-    for(list=0; list<2; list++){
-        int left_ref = h->ref_cache[list][scan8[0] - 1];
-        int top_ref  = h->ref_cache[list][scan8[0] - 8];
-        int refc = h->ref_cache[list][scan8[0] - 8 + 4];
-        const int16_t *C= h->mv_cache[list][ scan8[0] - 8 + 4];
-        if(refc == PART_NOT_AVAILABLE){
-            refc = h->ref_cache[list][scan8[0] - 8 - 1];
-            C    = h-> mv_cache[list][scan8[0] - 8 - 1];
-        }
-        ref[list] = FFMIN3((unsigned)left_ref, (unsigned)top_ref, (unsigned)refc);
-        if(ref[list] >= 0){
-            //this is just pred_motion() but with the cases removed that cannot happen for direct blocks
-            const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ];
-            const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ];
-
-            int match_count= (left_ref==ref[list]) + (top_ref==ref[list]) + (refc==ref[list]);
-            if(match_count > 1){ //most common
-                mv[list]= pack16to32(mid_pred(A[0], B[0], C[0]),
-                                     mid_pred(A[1], B[1], C[1]) );
-            }else {
-                assert(match_count==1);
-                if(left_ref==ref[list]){
-                    mv[list]= AV_RN32A(A);
-                }else if(top_ref==ref[list]){
-                    mv[list]= AV_RN32A(B);
-                }else{
-                    mv[list]= AV_RN32A(C);
-                }
-            }
-        }else{
-            int mask= ~(MB_TYPE_L0 << (2*list));
-            mv[list] = 0;
-            ref[list] = -1;
-            if(!is_b8x8)
-                *mb_type &= mask;
-            sub_mb_type &= mask;
-        }
-    }
-    if(ref[0] < 0 && ref[1] < 0){
-        ref[0] = ref[1] = 0;
-        if(!is_b8x8)
-            *mb_type |= MB_TYPE_L0L1;
-        sub_mb_type |= MB_TYPE_L0L1;
-    }
-
-    if(!(is_b8x8|mv[0]|mv[1])){
-        fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1);
-        fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1);
-        fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4);
-        fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, 0, 4);
-        *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;
-        return;
-    }
-
-    if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL
-        if(!IS_INTERLACED(*mb_type)){                    //     AFR/FR    -> AFL/FL
-            mb_xy= s->mb_x + ((s->mb_y&~1) + h->col_parity)*s->mb_stride;
-            b8_stride = 0;
-        }else{
-            mb_xy += h->col_fieldoff; // non zero for FL -> FL & differ parity
-        }
-        goto single_col;
-    }else{                                               // AFL/AFR/FR/FL -> AFR/FR
-        if(IS_INTERLACED(*mb_type)){                     // AFL       /FL -> AFR/FR
-            mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride;
-            mb_type_col[0] = h->ref_list[1][0].mb_type[mb_xy];
-            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy + s->mb_stride];
-            b8_stride = 2+4*s->mb_stride;
-            b4_stride *= 6;
-
-            sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
-            if(    (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)
-                && (mb_type_col[1] & MB_TYPE_16x16_OR_INTRA)
-                && !is_b8x8){
-                *mb_type   |= MB_TYPE_16x8 |MB_TYPE_DIRECT2; /* B_16x8 */
-            }else{
-                *mb_type   |= MB_TYPE_8x8;
-            }
-        }else{                                           //     AFR/FR    -> AFR/FR
-single_col:
-            mb_type_col[0] =
-            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
-
-            sub_mb_type |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
-            if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
-                *mb_type   |= MB_TYPE_16x16|MB_TYPE_DIRECT2; /* B_16x16 */
-            }else if(!is_b8x8 && (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){
-                *mb_type   |= MB_TYPE_DIRECT2 | (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16));
-            }else{
-                if(!h->sps.direct_8x8_inference_flag){
-                    /* FIXME save sub mb types from previous frames (or derive from MVs)
-                    * so we know exactly what block size to use */
-                    sub_mb_type += (MB_TYPE_8x8-MB_TYPE_16x16); /* B_SUB_4x4 */
-                }
-                *mb_type   |= MB_TYPE_8x8;
-            }
-        }
-    }
-
-    l1mv0  = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]];
-    l1mv1  = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]];
-    l1ref0 = &h->ref_list[1][0].ref_index [0][4*mb_xy];
-    l1ref1 = &h->ref_list[1][0].ref_index [1][4*mb_xy];
-    if(!b8_stride){
-        if(s->mb_y&1){
-            l1ref0 += 2;
-            l1ref1 += 2;
-            l1mv0  +=  2*b4_stride;
-            l1mv1  +=  2*b4_stride;
-        }
-    }
-
-
-        if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){
-            int n=0;
-            for(i8=0; i8<4; i8++){
-                int x8 = i8&1;
-                int y8 = i8>>1;
-                int xy8 = x8+y8*b8_stride;
-                int xy4 = 3*x8+y8*b4_stride;
-                int a,b;
-
-                if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
-                    continue;
-                h->sub_mb_type[i8] = sub_mb_type;
-
-                fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
-                fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
-                if(!IS_INTRA(mb_type_col[y8]) && !h->ref_list[1][0].long_ref
-                   && (   (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1)
-                       || (l1ref0[xy8]  < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){
-                    a=b=0;
-                    if(ref[0] > 0)
-                        a= mv[0];
-                    if(ref[1] > 0)
-                        b= mv[1];
-                    n++;
-                }else{
-                    a= mv[0];
-                    b= mv[1];
-                }
-                fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4);
-                fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4);
-            }
-            if(!is_b8x8 && !(n&3))
-                *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;
-        }else if(IS_16X16(*mb_type)){
-            int a,b;
-
-            fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1);
-            fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1);
-            if(!IS_INTRA(mb_type_col[0]) && !h->ref_list[1][0].long_ref
-               && (   (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1)
-                   || (l1ref0[0]  < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1
-                       && h->x264_build>33U))){
-                a=b=0;
-                if(ref[0] > 0)
-                    a= mv[0];
-                if(ref[1] > 0)
-                    b= mv[1];
-            }else{
-                a= mv[0];
-                b= mv[1];
-            }
-            fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4);
-            fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4);
-        }else{
-            int n=0;
-            for(i8=0; i8<4; i8++){
-                const int x8 = i8&1;
-                const int y8 = i8>>1;
-
-                if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
-                    continue;
-                h->sub_mb_type[i8] = sub_mb_type;
-
-                fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, mv[0], 4);
-                fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, mv[1], 4);
-                fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
-                fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
-
-                assert(b8_stride==2);
-                /* col_zero_flag */
-                if(!IS_INTRA(mb_type_col[0]) && !h->ref_list[1][0].long_ref && (   l1ref0[i8] == 0
-                                              || (l1ref0[i8] < 0 && l1ref1[i8] == 0
-                                                  && h->x264_build>33U))){
-                    const int16_t (*l1mv)[2]= l1ref0[i8] == 0 ? l1mv0 : l1mv1;
-                    if(IS_SUB_8X8(sub_mb_type)){
-                        const int16_t *mv_col = l1mv[x8*3 + y8*3*b4_stride];
-                        if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
-                            if(ref[0] == 0)
-                                fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
-                            if(ref[1] == 0)
-                                fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
-                            n+=4;
-                        }
-                    }else{
-                        int m=0;
-                    for(i4=0; i4<4; i4++){
-                        const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride];
-                        if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
-                            if(ref[0] == 0)
-                                AV_ZERO32(h->mv_cache[0][scan8[i8*4+i4]]);
-                            if(ref[1] == 0)
-                                AV_ZERO32(h->mv_cache[1][scan8[i8*4+i4]]);
-                            m++;
-                        }
-                    }
-                    if(!(m&3))
-                        h->sub_mb_type[i8]+= MB_TYPE_16x16 - MB_TYPE_8x8;
-                    n+=m;
-                    }
-                }
-            }
-            if(!is_b8x8 && !(n&15))
-                *mb_type= (*mb_type & ~(MB_TYPE_8x8|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_P1L0|MB_TYPE_P1L1))|MB_TYPE_16x16|MB_TYPE_DIRECT2;
-        }
-}
-
-static void pred_temp_direct_motion(H264Context * const h, int *mb_type){
-    MpegEncContext * const s = &h->s;
-    int b8_stride = 2;
-    int b4_stride = h->b_stride;
-    int mb_xy = h->mb_xy;
-    int mb_type_col[2];
-    const int16_t (*l1mv0)[2], (*l1mv1)[2];
-    const int8_t *l1ref0, *l1ref1;
-    const int is_b8x8 = IS_8X8(*mb_type);
-    unsigned int sub_mb_type;
-    int i8, i4;
-
-    assert(h->ref_list[1][0].reference&3);
-
-    if(IS_INTERLACED(h->ref_list[1][0].mb_type[mb_xy])){ // AFL/AFR/FR/FL -> AFL/FL
-        if(!IS_INTERLACED(*mb_type)){                    //     AFR/FR    -> AFL/FL
-            mb_xy= s->mb_x + ((s->mb_y&~1) + h->col_parity)*s->mb_stride;
-            b8_stride = 0;
-        }else{
-            mb_xy += h->col_fieldoff; // non zero for FL -> FL & differ parity
-        }
-        goto single_col;
-    }else{                                               // AFL/AFR/FR/FL -> AFR/FR
-        if(IS_INTERLACED(*mb_type)){                     // AFL       /FL -> AFR/FR
-            mb_xy= s->mb_x + (s->mb_y&~1)*s->mb_stride;
-            mb_type_col[0] = h->ref_list[1][0].mb_type[mb_xy];
-            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy + s->mb_stride];
-            b8_stride = 2+4*s->mb_stride;
-            b4_stride *= 6;
-
-            sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
-
-            if(    (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)
-                && (mb_type_col[1] & MB_TYPE_16x16_OR_INTRA)
-                && !is_b8x8){
-                *mb_type   |= MB_TYPE_16x8 |MB_TYPE_L0L1|MB_TYPE_DIRECT2; /* B_16x8 */
-            }else{
-                *mb_type   |= MB_TYPE_8x8|MB_TYPE_L0L1;
-            }
-        }else{                                           //     AFR/FR    -> AFR/FR
-single_col:
-            mb_type_col[0] =
-            mb_type_col[1] = h->ref_list[1][0].mb_type[mb_xy];
-
-            sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_8x8 */
-            if(!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)){
-                *mb_type   |= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_16x16 */
-            }else if(!is_b8x8 && (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16))){
-                *mb_type   |= MB_TYPE_L0L1|MB_TYPE_DIRECT2 | (mb_type_col[0] & (MB_TYPE_16x8|MB_TYPE_8x16));
-            }else{
-                if(!h->sps.direct_8x8_inference_flag){
-                    /* FIXME save sub mb types from previous frames (or derive from MVs)
-                    * so we know exactly what block size to use */
-                    sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; /* B_SUB_4x4 */
-                }
-                *mb_type   |= MB_TYPE_8x8|MB_TYPE_L0L1;
-            }
-        }
-    }
-
-    l1mv0  = &h->ref_list[1][0].motion_val[0][h->mb2b_xy [mb_xy]];
-    l1mv1  = &h->ref_list[1][0].motion_val[1][h->mb2b_xy [mb_xy]];
-    l1ref0 = &h->ref_list[1][0].ref_index [0][4*mb_xy];
-    l1ref1 = &h->ref_list[1][0].ref_index [1][4*mb_xy];
-    if(!b8_stride){
-        if(s->mb_y&1){
-            l1ref0 += 2;
-            l1ref1 += 2;
-            l1mv0  +=  2*b4_stride;
-            l1mv1  +=  2*b4_stride;
-        }
-    }
-
-    {
-        const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]};
-        const int *dist_scale_factor = h->dist_scale_factor;
-        int ref_offset;
-
-        if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){
-            map_col_to_list0[0] = h->map_col_to_list0_field[s->mb_y&1][0];
-            map_col_to_list0[1] = h->map_col_to_list0_field[s->mb_y&1][1];
-            dist_scale_factor   =h->dist_scale_factor_field[s->mb_y&1];
-        }
-        ref_offset = (h->ref_list[1][0].mbaff<<4) & (mb_type_col[0]>>3); //if(h->ref_list[1][0].mbaff && IS_INTERLACED(mb_type_col[0])) ref_offset=16 else 0
-
-        if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])){
-            int y_shift  = 2*!IS_INTERLACED(*mb_type);
-            assert(h->sps.direct_8x8_inference_flag);
-
-            for(i8=0; i8<4; i8++){
-                const int x8 = i8&1;
-                const int y8 = i8>>1;
-                int ref0, scale;
-                const int16_t (*l1mv)[2]= l1mv0;
-
-                if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
-                    continue;
-                h->sub_mb_type[i8] = sub_mb_type;
-
-                fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
-                if(IS_INTRA(mb_type_col[y8])){
-                    fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
-                    fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
-                    fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
-                    continue;
-                }
-
-                ref0 = l1ref0[x8 + y8*b8_stride];
-                if(ref0 >= 0)
-                    ref0 = map_col_to_list0[0][ref0 + ref_offset];
-                else{
-                    ref0 = map_col_to_list0[1][l1ref1[x8 + y8*b8_stride] + ref_offset];
-                    l1mv= l1mv1;
-                }
-                scale = dist_scale_factor[ref0];
-                fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
-
-                {
-                    const int16_t *mv_col = l1mv[x8*3 + y8*b4_stride];
-                    int my_col = (mv_col[1]<<y_shift)/2;
-                    int mx = (scale * mv_col[0] + 128) >> 8;
-                    int my = (scale * my_col + 128) >> 8;
-                    fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
-                    fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4);
-                }
-            }
-            return;
-        }
-
-        /* one-to-one mv scaling */
-
-        if(IS_16X16(*mb_type)){
-            int ref, mv0, mv1;
-
-            fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1);
-            if(IS_INTRA(mb_type_col[0])){
-                ref=mv0=mv1=0;
-            }else{
-                const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0] + ref_offset]
-                                                : map_col_to_list0[1][l1ref1[0] + ref_offset];
-                const int scale = dist_scale_factor[ref0];
-                const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0];
-                int mv_l0[2];
-                mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
-                mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
-                ref= ref0;
-                mv0= pack16to32(mv_l0[0],mv_l0[1]);
-                mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]);
-            }
-            fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
-            fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4);
-            fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4);
-        }else{
-            for(i8=0; i8<4; i8++){
-                const int x8 = i8&1;
-                const int y8 = i8>>1;
-                int ref0, scale;
-                const int16_t (*l1mv)[2]= l1mv0;
-
-                if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
-                    continue;
-                h->sub_mb_type[i8] = sub_mb_type;
-                fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
-                if(IS_INTRA(mb_type_col[0])){
-                    fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
-                    fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
-                    fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
-                    continue;
-                }
-
-                assert(b8_stride == 2);
-                ref0 = l1ref0[i8];
-                if(ref0 >= 0)
-                    ref0 = map_col_to_list0[0][ref0 + ref_offset];
-                else{
-                    ref0 = map_col_to_list0[1][l1ref1[i8] + ref_offset];
-                    l1mv= l1mv1;
-                }
-                scale = dist_scale_factor[ref0];
-
-                fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
-                if(IS_SUB_8X8(sub_mb_type)){
-                    const int16_t *mv_col = l1mv[x8*3 + y8*3*b4_stride];
-                    int mx = (scale * mv_col[0] + 128) >> 8;
-                    int my = (scale * mv_col[1] + 128) >> 8;
-                    fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
-                    fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4);
-                }else
-                for(i4=0; i4<4; i4++){
-                    const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*b4_stride];
-                    int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]];
-                    mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
-                    mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
-                    AV_WN32A(h->mv_cache[1][scan8[i8*4+i4]],
-                        pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]));
-                }
-            }
-        }
-    }
-}
-
-void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type){
-    if(h->direct_spatial_mv_pred){
-        pred_spatial_direct_motion(h, mb_type);
-    }else{
-        pred_temp_direct_motion(h, mb_type);
-    }
-}
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
deleted file mode 100644
index 710e037..0000000
--- a/libavcodec/h264_loopfilter.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... loop filter
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 loop filter.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "libavutil/intreadwrite.h"
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h264.h"
-#include "mathops.h"
-#include "rectangle.h"
-
-//#undef NDEBUG
-#include <assert.h>
-
-/* Deblocking filter (p153) */
-static const uint8_t alpha_table[52*3] = {
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  4,  4,  5,  6,
-     7,  8,  9, 10, 12, 13, 15, 17, 20, 22,
-    25, 28, 32, 36, 40, 45, 50, 56, 63, 71,
-    80, 90,101,113,127,144,162,182,203,226,
-   255,255,
-   255,255,255,255,255,255,255,255,255,255,255,255,255,
-   255,255,255,255,255,255,255,255,255,255,255,255,255,
-   255,255,255,255,255,255,255,255,255,255,255,255,255,
-   255,255,255,255,255,255,255,255,255,255,255,255,255,
-};
-static const uint8_t beta_table[52*3] = {
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  2,  2,  2,  3,
-     3,  3,  3,  4,  4,  4,  6,  6,  7,  7,
-     8,  8,  9,  9, 10, 10, 11, 11, 12, 12,
-    13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
-    18, 18,
-    18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
-    18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
-    18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
-    18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
-};
-static const uint8_t tc0_table[52*3][4] = {
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
-    {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 1 },
-    {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 1, 1 }, {-1, 0, 1, 1 }, {-1, 1, 1, 1 },
-    {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 },
-    {-1, 1, 1, 2 }, {-1, 1, 2, 3 }, {-1, 1, 2, 3 }, {-1, 2, 2, 3 }, {-1, 2, 2, 4 }, {-1, 2, 3, 4 },
-    {-1, 2, 3, 4 }, {-1, 3, 3, 5 }, {-1, 3, 4, 6 }, {-1, 3, 4, 6 }, {-1, 4, 5, 7 }, {-1, 4, 5, 8 },
-    {-1, 4, 6, 9 }, {-1, 5, 7,10 }, {-1, 6, 8,11 }, {-1, 6, 8,13 }, {-1, 7,10,14 }, {-1, 8,11,16 },
-    {-1, 9,12,18 }, {-1,10,13,20 }, {-1,11,15,23 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-    {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
-};
-
-static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) {
-    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
-    const int alpha = alpha_table[index_a];
-    const int beta  = beta_table[qp + h->slice_beta_offset];
-    if (alpha ==0 || beta == 0) return;
-
-    if( bS[0] < 4 ) {
-        int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]];
-        tc[1] = tc0_table[index_a][bS[1]];
-        tc[2] = tc0_table[index_a][bS[2]];
-        tc[3] = tc0_table[index_a][bS[3]];
-        h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc);
-    } else {
-        h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta);
-    }
-}
-static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
-    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
-    const int alpha = alpha_table[index_a];
-    const int beta  = beta_table[qp + h->slice_beta_offset];
-    if (alpha ==0 || beta == 0) return;
-
-    if( bS[0] < 4 ) {
-        int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]]+1;
-        tc[1] = tc0_table[index_a][bS[1]]+1;
-        tc[2] = tc0_table[index_a][bS[2]]+1;
-        tc[3] = tc0_table[index_a][bS[3]]+1;
-        h->h264dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc);
-    } else {
-        h->h264dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta);
-    }
-}
-
-static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
-    int i;
-    int index_a = qp + h->slice_alpha_c0_offset;
-    int alpha = alpha_table[index_a];
-    int beta  = beta_table[qp + h->slice_beta_offset];
-    for( i = 0; i < 8; i++, pix += stride) {
-        const int bS_index = (i >> 1) * bsi;
-
-        if( bS[bS_index] == 0 ) {
-            continue;
-        }
-
-        if( bS[bS_index] < 4 ) {
-            const int tc0 = tc0_table[index_a][bS[bS_index]];
-            const int p0 = pix[-1];
-            const int p1 = pix[-2];
-            const int p2 = pix[-3];
-            const int q0 = pix[0];
-            const int q1 = pix[1];
-            const int q2 = pix[2];
-
-            if( FFABS( p0 - q0 ) < alpha &&
-                FFABS( p1 - p0 ) < beta &&
-                FFABS( q1 - q0 ) < beta ) {
-                int tc = tc0;
-                int i_delta;
-
-                if( FFABS( p2 - p0 ) < beta ) {
-                    if(tc0)
-                    pix[-2] = p1 + av_clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 );
-                    tc++;
-                }
-                if( FFABS( q2 - q0 ) < beta ) {
-                    if(tc0)
-                    pix[1] = q1 + av_clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 );
-                    tc++;
-                }
-
-                i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
-                pix[-1] = av_clip_uint8( p0 + i_delta );    /* p0' */
-                pix[0]  = av_clip_uint8( q0 - i_delta );    /* q0' */
-                tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
-            }
-        }else{
-            const int p0 = pix[-1];
-            const int p1 = pix[-2];
-            const int p2 = pix[-3];
-
-            const int q0 = pix[0];
-            const int q1 = pix[1];
-            const int q2 = pix[2];
-
-            if( FFABS( p0 - q0 ) < alpha &&
-                FFABS( p1 - p0 ) < beta &&
-                FFABS( q1 - q0 ) < beta ) {
-
-                if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
-                    if( FFABS( p2 - p0 ) < beta)
-                    {
-                        const int p3 = pix[-4];
-                        /* p0', p1', p2' */
-                        pix[-1] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
-                        pix[-2] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
-                        pix[-3] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3;
-                    } else {
-                        /* p0' */
-                        pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
-                    }
-                    if( FFABS( q2 - q0 ) < beta)
-                    {
-                        const int q3 = pix[3];
-                        /* q0', q1', q2' */
-                        pix[0] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
-                        pix[1] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
-                        pix[2] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3;
-                    } else {
-                        /* q0' */
-                        pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
-                    }
-                }else{
-                    /* p0', q0' */
-                    pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
-                    pix[ 0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
-                }
-                tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, p2, p1, p0, q0, q1, q2, pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
-            }
-        }
-    }
-}
-static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
-    int i;
-    int index_a = qp + h->slice_alpha_c0_offset;
-    int alpha = alpha_table[index_a];
-    int beta  = beta_table[qp + h->slice_beta_offset];
-    for( i = 0; i < 4; i++, pix += stride) {
-        const int bS_index = i*bsi;
-
-        if( bS[bS_index] == 0 ) {
-            continue;
-        }
-
-        if( bS[bS_index] < 4 ) {
-            const int tc = tc0_table[index_a][bS[bS_index]] + 1;
-            const int p0 = pix[-1];
-            const int p1 = pix[-2];
-            const int q0 = pix[0];
-            const int q1 = pix[1];
-
-            if( FFABS( p0 - q0 ) < alpha &&
-                FFABS( p1 - p0 ) < beta &&
-                FFABS( q1 - q0 ) < beta ) {
-                const int i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
-
-                pix[-1] = av_clip_uint8( p0 + i_delta );    /* p0' */
-                pix[0]  = av_clip_uint8( q0 - i_delta );    /* q0' */
-                tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
-            }
-        }else{
-            const int p0 = pix[-1];
-            const int p1 = pix[-2];
-            const int q0 = pix[0];
-            const int q1 = pix[1];
-
-            if( FFABS( p0 - q0 ) < alpha &&
-                FFABS( p1 - p0 ) < beta &&
-                FFABS( q1 - q0 ) < beta ) {
-
-                pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   /* p0' */
-                pix[0]  = ( 2*q1 + q0 + p1 + 2 ) >> 2;   /* q0' */
-                tprintf(h->s.avctx, "filter_mb_mbaff_edgecv i:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, pix[-3], p1, p0, q0, q1, pix[2], pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
-            }
-        }
-    }
-}
-
-static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
-    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
-    const int alpha = alpha_table[index_a];
-    const int beta  = beta_table[qp + h->slice_beta_offset];
-    if (alpha ==0 || beta == 0) return;
-
-    if( bS[0] < 4 ) {
-        int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]];
-        tc[1] = tc0_table[index_a][bS[1]];
-        tc[2] = tc0_table[index_a][bS[2]];
-        tc[3] = tc0_table[index_a][bS[3]];
-        h->h264dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc);
-    } else {
-        h->h264dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta);
-    }
-}
-
-static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
-    const unsigned int index_a = qp + h->slice_alpha_c0_offset;
-    const int alpha = alpha_table[index_a];
-    const int beta  = beta_table[qp + h->slice_beta_offset];
-    if (alpha ==0 || beta == 0) return;
-
-    if( bS[0] < 4 ) {
-        int8_t tc[4];
-        tc[0] = tc0_table[index_a][bS[0]]+1;
-        tc[1] = tc0_table[index_a][bS[1]]+1;
-        tc[2] = tc0_table[index_a][bS[2]]+1;
-        tc[3] = tc0_table[index_a][bS[3]]+1;
-        h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc);
-    } else {
-        h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta);
-    }
-}
-
-void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) {
-    MpegEncContext * const s = &h->s;
-    int mb_xy;
-    int mb_type, left_type;
-    int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh;
-
-    mb_xy = h->mb_xy;
-
-    if(!h->top_type || !h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) {
-        ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize);
-        return;
-    }
-    assert(!FRAME_MBAFF);
-    left_type= h->left_type[0];
-
-    mb_type = s->current_picture.mb_type[mb_xy];
-    qp = s->current_picture.qscale_table[mb_xy];
-    qp0 = s->current_picture.qscale_table[mb_xy-1];
-    qp1 = s->current_picture.qscale_table[h->top_mb_xy];
-    qpc = get_chroma_qp( h, 0, qp );
-    qpc0 = get_chroma_qp( h, 0, qp0 );
-    qpc1 = get_chroma_qp( h, 0, qp1 );
-    qp0 = (qp + qp0 + 1) >> 1;
-    qp1 = (qp + qp1 + 1) >> 1;
-    qpc0 = (qpc + qpc0 + 1) >> 1;
-    qpc1 = (qpc + qpc1 + 1) >> 1;
-    qp_thresh = 15+52 - h->slice_alpha_c0_offset;
-    if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh &&
-       qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh)
-        return;
-
-    if( IS_INTRA(mb_type) ) {
-        int16_t bS4[4] = {4,4,4,4};
-        int16_t bS3[4] = {3,3,3,3};
-        int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;
-        if(left_type)
-            filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, h);
-        if( IS_8x8DCT(mb_type) ) {
-            filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h);
-            filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
-            filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h);
-        } else {
-            filter_mb_edgev( &img_y[4*1], linesize, bS3, qp, h);
-            filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h);
-            filter_mb_edgev( &img_y[4*3], linesize, bS3, qp, h);
-            filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
-            filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, h);
-            filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h);
-            filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h);
-        }
-        if(left_type){
-            filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h);
-            filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h);
-        }
-        filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h);
-        filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h);
-        filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
-        filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
-        filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
-        filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
-        return;
-    } else {
-        LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]);
-        int edges;
-        if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) {
-            edges = 4;
-            AV_WN64A(bS[0][0], 0x0002000200020002ULL);
-            AV_WN64A(bS[0][2], 0x0002000200020002ULL);
-            AV_WN64A(bS[1][0], 0x0002000200020002ULL);
-            AV_WN64A(bS[1][2], 0x0002000200020002ULL);
-        } else {
-            int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0;
-            int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[0] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0;
-            int step =  1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1;
-            edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
-            h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache,
-                                              h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE);
-        }
-        if( IS_INTRA(left_type) )
-            AV_WN64A(bS[0][0], 0x0004000400040004ULL);
-        if( IS_INTRA(h->top_type) )
-            AV_WN64A(bS[1][0], FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL);
-
-#define FILTER(hv,dir,edge)\
-        if(AV_RN64A(bS[dir][edge])) {                                   \
-            filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir, h );\
-            if(!(edge&1)) {\
-                filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
-                filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\
-            }\
-        }
-        if(left_type)
-            FILTER(v,0,0);
-        if( edges == 1 ) {
-            FILTER(h,1,0);
-        } else if( IS_8x8DCT(mb_type) ) {
-            FILTER(v,0,2);
-            FILTER(h,1,0);
-            FILTER(h,1,2);
-        } else {
-            FILTER(v,0,1);
-            FILTER(v,0,2);
-            FILTER(v,0,3);
-            FILTER(h,1,0);
-            FILTER(h,1,1);
-            FILTER(h,1,2);
-            FILTER(h,1,3);
-        }
-#undef FILTER
-    }
-}
-
-static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){
-    int v;
-
-    v= h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx];
-    if(!v && h->ref_cache[0][b_idx]!=-1)
-        v= h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U |
-           FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit;
-
-    if(h->list_count==2){
-        if(!v)
-            v = h->ref_cache[1][b_idx] != h->ref_cache[1][bn_idx] |
-                h->mv_cache[1][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U |
-                FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit;
-
-        if(v){
-            if(h->ref_cache[0][b_idx] != h->ref_cache[1][bn_idx] |
-               h->ref_cache[1][b_idx] != h->ref_cache[0][bn_idx])
-                return 1;
-            return
-                h->mv_cache[0][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U |
-                FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit |
-                h->mv_cache[1][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U |
-                FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit;
-        }
-    }
-
-    return v;
-}
-
-static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int dir) {
-    MpegEncContext * const s = &h->s;
-    int edge;
-    const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy;
-    const int mbm_type = dir == 0 ? h->left_type[0] : h->top_type;
-
-    // how often to recheck mv-based bS when iterating between edges
-    static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1},
-                                              {0,3,1,1,3,3,3,3}};
-    const int mask_edge = mask_edge_tab[dir][(mb_type>>3)&7];
-    const int edges = mask_edge== 3 && !(h->cbp&15) ? 1 : 4;
-
-    // how often to recheck mv-based bS when iterating along each edge
-    const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir));
-
-    if(mbm_type && !first_vertical_edge_done){
-
-        if (FRAME_MBAFF && (dir == 1) && ((mb_y&1) == 0)
-            && IS_INTERLACED(mbm_type&~mb_type)
-            ) {
-            // This is a special case in the norm where the filtering must
-            // be done twice (one each of the field) even if we are in a
-            // frame macroblock.
-            //
-            unsigned int tmp_linesize   = 2 *   linesize;
-            unsigned int tmp_uvlinesize = 2 * uvlinesize;
-            int mbn_xy = mb_xy - 2 * s->mb_stride;
-            int j;
-
-            for(j=0; j<2; j++, mbn_xy += s->mb_stride){
-                DECLARE_ALIGNED(8, int16_t, bS)[4];
-                int qp;
-                if( IS_INTRA(mb_type|s->current_picture.mb_type[mbn_xy]) ) {
-                    AV_WN64A(bS, 0x0003000300030003ULL);
-                } else {
-                    if(!CABAC && IS_8x8DCT(s->current_picture.mb_type[mbn_xy])){
-                        bS[0]= 1+((h->cbp_table[mbn_xy] & 4)||h->non_zero_count_cache[scan8[0]+0]);
-                        bS[1]= 1+((h->cbp_table[mbn_xy] & 4)||h->non_zero_count_cache[scan8[0]+1]);
-                        bS[2]= 1+((h->cbp_table[mbn_xy] & 8)||h->non_zero_count_cache[scan8[0]+2]);
-                        bS[3]= 1+((h->cbp_table[mbn_xy] & 8)||h->non_zero_count_cache[scan8[0]+3]);
-                    }else{
-                    const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 4+3*8;
-                    int i;
-                    for( i = 0; i < 4; i++ ) {
-                        bS[i] = 1 + !!(h->non_zero_count_cache[scan8[0]+i] | mbn_nnz[i]);
-                    }
-                    }
-                }
-                // Do not use s->qscale as luma quantizer because it has not the same
-                // value in IPCM macroblocks.
-                qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbn_xy] + 1 ) >> 1;
-                tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize);
-                { int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
-                filter_mb_edgeh( &img_y[j*linesize], tmp_linesize, bS, qp, h );
-                filter_mb_edgech( &img_cb[j*uvlinesize], tmp_uvlinesize, bS,
-                                ( h->chroma_qp[0] + get_chroma_qp( h, 0, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1, h);
-                filter_mb_edgech( &img_cr[j*uvlinesize], tmp_uvlinesize, bS,
-                                ( h->chroma_qp[1] + get_chroma_qp( h, 1, s->current_picture.qscale_table[mbn_xy] ) + 1 ) >> 1, h);
-            }
-        }else{
-            DECLARE_ALIGNED(8, int16_t, bS)[4];
-            int qp;
-
-            if( IS_INTRA(mb_type|mbm_type)) {
-                AV_WN64A(bS, 0x0003000300030003ULL);
-                if (   (!IS_INTERLACED(mb_type|mbm_type))
-                    || ((FRAME_MBAFF || (s->picture_structure != PICT_FRAME)) && (dir == 0))
-                )
-                    AV_WN64A(bS, 0x0004000400040004ULL);
-            } else {
-                int i;
-                int mv_done;
-
-                if( dir && FRAME_MBAFF && IS_INTERLACED(mb_type ^ mbm_type)) {
-                    AV_WN64A(bS, 0x0001000100010001ULL);
-                    mv_done = 1;
-                }
-                else if( mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) {
-                    int b_idx= 8 + 4;
-                    int bn_idx= b_idx - (dir ? 8:1);
-
-                    bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, 8 + 4, bn_idx, mvy_limit);
-                    mv_done = 1;
-                }
-                else
-                    mv_done = 0;
-
-                for( i = 0; i < 4; i++ ) {
-                    int x = dir == 0 ? 0 : i;
-                    int y = dir == 0 ? i    : 0;
-                    int b_idx= 8 + 4 + x + 8*y;
-                    int bn_idx= b_idx - (dir ? 8:1);
-
-                    if( h->non_zero_count_cache[b_idx] |
-                        h->non_zero_count_cache[bn_idx] ) {
-                        bS[i] = 2;
-                    }
-                    else if(!mv_done)
-                    {
-                        bS[i] = check_mv(h, b_idx, bn_idx, mvy_limit);
-                    }
-                }
-            }
-
-            /* Filter edge */
-            // Do not use s->qscale as luma quantizer because it has not the same
-            // value in IPCM macroblocks.
-            if(bS[0]+bS[1]+bS[2]+bS[3]){
-                qp = ( s->current_picture.qscale_table[mb_xy] + s->current_picture.qscale_table[mbm_xy] + 1 ) >> 1;
-                //tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp[0], s->current_picture.qscale_table[mbn_xy]);
-                tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);
-                //{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
-                if( dir == 0 ) {
-                    filter_mb_edgev( &img_y[0], linesize, bS, qp, h );
-                    {
-                        int qp= ( h->chroma_qp[0] + get_chroma_qp( h, 0, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
-                        filter_mb_edgecv( &img_cb[0], uvlinesize, bS, qp, h);
-                        if(h->pps.chroma_qp_diff)
-                            qp= ( h->chroma_qp[1] + get_chroma_qp( h, 1, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
-                        filter_mb_edgecv( &img_cr[0], uvlinesize, bS, qp, h);
-                    }
-                } else {
-                    filter_mb_edgeh( &img_y[0], linesize, bS, qp, h );
-                    {
-                        int qp= ( h->chroma_qp[0] + get_chroma_qp( h, 0, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
-                        filter_mb_edgech( &img_cb[0], uvlinesize, bS, qp, h);
-                        if(h->pps.chroma_qp_diff)
-                            qp= ( h->chroma_qp[1] + get_chroma_qp( h, 1, s->current_picture.qscale_table[mbm_xy] ) + 1 ) >> 1;
-                        filter_mb_edgech( &img_cr[0], uvlinesize, bS, qp, h);
-                    }
-                }
-            }
-        }
-    }
-
-    /* Calculate bS */
-    for( edge = 1; edge < edges; edge++ ) {
-        DECLARE_ALIGNED(8, int16_t, bS)[4];
-        int qp;
-
-        if( IS_8x8DCT(mb_type & (edge<<24)) ) // (edge&1) && IS_8x8DCT(mb_type)
-            continue;
-
-        if( IS_INTRA(mb_type)) {
-            AV_WN64A(bS, 0x0003000300030003ULL);
-        } else {
-            int i;
-            int mv_done;
-
-            if( edge & mask_edge ) {
-                AV_ZERO64(bS);
-                mv_done = 1;
-            }
-            else if( mask_par0 ) {
-                int b_idx= 8 + 4 + edge * (dir ? 8:1);
-                int bn_idx= b_idx - (dir ? 8:1);
-
-                bS[0] = bS[1] = bS[2] = bS[3] = check_mv(h, b_idx, bn_idx, mvy_limit);
-                mv_done = 1;
-            }
-            else
-                mv_done = 0;
-
-            for( i = 0; i < 4; i++ ) {
-                int x = dir == 0 ? edge : i;
-                int y = dir == 0 ? i    : edge;
-                int b_idx= 8 + 4 + x + 8*y;
-                int bn_idx= b_idx - (dir ? 8:1);
-
-                if( h->non_zero_count_cache[b_idx] |
-                    h->non_zero_count_cache[bn_idx] ) {
-                    bS[i] = 2;
-                }
-                else if(!mv_done)
-                {
-                    bS[i] = check_mv(h, b_idx, bn_idx, mvy_limit);
-                }
-            }
-
-            if(bS[0]+bS[1]+bS[2]+bS[3] == 0)
-                continue;
-        }
-
-        /* Filter edge */
-        // Do not use s->qscale as luma quantizer because it has not the same
-        // value in IPCM macroblocks.
-        qp = s->current_picture.qscale_table[mb_xy];
-        //tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d, QPc:%d, QPcn:%d\n", mb_x, mb_y, dir, edge, qp, h->chroma_qp[0], s->current_picture.qscale_table[mbn_xy]);
-        tprintf(s->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize);
-        //{ int i; for (i = 0; i < 4; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
-        if( dir == 0 ) {
-            filter_mb_edgev( &img_y[4*edge], linesize, bS, qp, h );
-            if( (edge&1) == 0 ) {
-                filter_mb_edgecv( &img_cb[2*edge], uvlinesize, bS, h->chroma_qp[0], h);
-                filter_mb_edgecv( &img_cr[2*edge], uvlinesize, bS, h->chroma_qp[1], h);
-            }
-        } else {
-            filter_mb_edgeh( &img_y[4*edge*linesize], linesize, bS, qp, h );
-            if( (edge&1) == 0 ) {
-                filter_mb_edgech( &img_cb[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[0], h);
-                filter_mb_edgech( &img_cr[2*edge*uvlinesize], uvlinesize, bS, h->chroma_qp[1], h);
-            }
-        }
-    }
-}
-
-void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) {
-    MpegEncContext * const s = &h->s;
-    const int mb_xy= mb_x + mb_y*s->mb_stride;
-    const int mb_type = s->current_picture.mb_type[mb_xy];
-    const int mvy_limit = IS_INTERLACED(mb_type) ? 2 : 4;
-    int first_vertical_edge_done = 0;
-    av_unused int dir;
-
-    if (FRAME_MBAFF
-            // and current and left pair do not have the same interlaced type
-            && IS_INTERLACED(mb_type^h->left_type[0])
-            // and left mb is in available to us
-            && h->left_type[0]) {
-        /* First vertical edge is different in MBAFF frames
-         * There are 8 different bS to compute and 2 different Qp
-         */
-        DECLARE_ALIGNED(8, int16_t, bS)[8];
-        int qp[2];
-        int bqp[2];
-        int rqp[2];
-        int mb_qp, mbn0_qp, mbn1_qp;
-        int i;
-        first_vertical_edge_done = 1;
-
-        if( IS_INTRA(mb_type) ) {
-            AV_WN64A(&bS[0], 0x0004000400040004ULL);
-            AV_WN64A(&bS[4], 0x0004000400040004ULL);
-        } else {
-            static const uint8_t offset[2][2][8]={
-                {
-                    {7+8*0, 7+8*0, 7+8*0, 7+8*0, 7+8*1, 7+8*1, 7+8*1, 7+8*1},
-                    {7+8*2, 7+8*2, 7+8*2, 7+8*2, 7+8*3, 7+8*3, 7+8*3, 7+8*3},
-                },{
-                    {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3},
-                    {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3},
-                }
-            };
-            const uint8_t *off= offset[MB_FIELD][mb_y&1];
-            for( i = 0; i < 8; i++ ) {
-                int j= MB_FIELD ? i>>2 : i&1;
-                int mbn_xy = h->left_mb_xy[j];
-                int mbn_type= h->left_type[j];
-
-                if( IS_INTRA( mbn_type ) )
-                    bS[i] = 4;
-                else{
-                    bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] |
-                         ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ?
-                            (h->cbp_table[mbn_xy] & ((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2))
-                                                                       :
-                            h->non_zero_count[mbn_xy][ off[i] ]));
-                }
-            }
-        }
-
-        mb_qp = s->current_picture.qscale_table[mb_xy];
-        mbn0_qp = s->current_picture.qscale_table[h->left_mb_xy[0]];
-        mbn1_qp = s->current_picture.qscale_table[h->left_mb_xy[1]];
-        qp[0] = ( mb_qp + mbn0_qp + 1 ) >> 1;
-        bqp[0] = ( get_chroma_qp( h, 0, mb_qp ) +
-                   get_chroma_qp( h, 0, mbn0_qp ) + 1 ) >> 1;
-        rqp[0] = ( get_chroma_qp( h, 1, mb_qp ) +
-                   get_chroma_qp( h, 1, mbn0_qp ) + 1 ) >> 1;
-        qp[1] = ( mb_qp + mbn1_qp + 1 ) >> 1;
-        bqp[1] = ( get_chroma_qp( h, 0, mb_qp ) +
-                   get_chroma_qp( h, 0, mbn1_qp ) + 1 ) >> 1;
-        rqp[1] = ( get_chroma_qp( h, 1, mb_qp ) +
-                   get_chroma_qp( h, 1, mbn1_qp ) + 1 ) >> 1;
-
-        /* Filter edge */
-        tprintf(s->avctx, "filter mb:%d/%d MBAFF, QPy:%d/%d, QPb:%d/%d QPr:%d/%d ls:%d uvls:%d", mb_x, mb_y, qp[0], qp[1], bqp[0], bqp[1], rqp[0], rqp[1], linesize, uvlinesize);
-        { int i; for (i = 0; i < 8; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
-        if(MB_FIELD){
-            filter_mb_mbaff_edgev ( h, img_y                ,   linesize, bS  , 1, qp [0] );
-            filter_mb_mbaff_edgev ( h, img_y  + 8*  linesize,   linesize, bS+4, 1, qp [1] );
-            filter_mb_mbaff_edgecv( h, img_cb,                uvlinesize, bS  , 1, bqp[0] );
-            filter_mb_mbaff_edgecv( h, img_cb + 4*uvlinesize, uvlinesize, bS+4, 1, bqp[1] );
-            filter_mb_mbaff_edgecv( h, img_cr,                uvlinesize, bS  , 1, rqp[0] );
-            filter_mb_mbaff_edgecv( h, img_cr + 4*uvlinesize, uvlinesize, bS+4, 1, rqp[1] );
-        }else{
-            filter_mb_mbaff_edgev ( h, img_y              , 2*  linesize, bS  , 2, qp [0] );
-            filter_mb_mbaff_edgev ( h, img_y  +   linesize, 2*  linesize, bS+1, 2, qp [1] );
-            filter_mb_mbaff_edgecv( h, img_cb,              2*uvlinesize, bS  , 2, bqp[0] );
-            filter_mb_mbaff_edgecv( h, img_cb + uvlinesize, 2*uvlinesize, bS+1, 2, bqp[1] );
-            filter_mb_mbaff_edgecv( h, img_cr,              2*uvlinesize, bS  , 2, rqp[0] );
-            filter_mb_mbaff_edgecv( h, img_cr + uvlinesize, 2*uvlinesize, bS+1, 2, rqp[1] );
-        }
-    }
-
-#if CONFIG_SMALL
-    for( dir = 0; dir < 2; dir++ )
-        filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, dir);
-#else
-    filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, 0);
-    filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, 1);
-#endif
-}
diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c
deleted file mode 100644
index 0c92b36..0000000
--- a/libavcodec/h264_mp4toannexb_bsf.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * H.264 MP4 to Annex B byte stream format filter
- * Copyright (c) 2007 Benoit Fouet <benoit.fouet at free.fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct H264BSFContext {
-    uint8_t  length_size;
-    uint8_t  first_idr;
-    uint8_t *sps_pps_data;
-    uint32_t size;
-} H264BSFContext;
-
-static void alloc_and_copy(uint8_t **poutbuf,          int *poutbuf_size,
-                           const uint8_t *sps_pps, uint32_t sps_pps_size,
-                           const uint8_t *in,      uint32_t in_size) {
-    uint32_t offset = *poutbuf_size;
-    uint8_t nal_header_size = offset ? 3 : 4;
-
-    *poutbuf_size += sps_pps_size+in_size+nal_header_size;
-    *poutbuf = av_realloc(*poutbuf, *poutbuf_size);
-    if (sps_pps)
-        memcpy(*poutbuf+offset, sps_pps, sps_pps_size);
-    memcpy(*poutbuf+sps_pps_size+nal_header_size+offset, in, in_size);
-    if (!offset)
-        AV_WB32(*poutbuf+sps_pps_size, 1);
-    else {
-        (*poutbuf+offset+sps_pps_size)[0] = (*poutbuf+offset+sps_pps_size)[1] = 0;
-        (*poutbuf+offset+sps_pps_size)[2] = 1;
-    }
-}
-
-static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
-                                   AVCodecContext *avctx, const char *args,
-                                   uint8_t  **poutbuf, int *poutbuf_size,
-                                   const uint8_t *buf, int      buf_size,
-                                   int keyframe) {
-    H264BSFContext *ctx = bsfc->priv_data;
-    uint8_t unit_type;
-    int32_t nal_size;
-    uint32_t cumul_size = 0;
-    const uint8_t *buf_end = buf + buf_size;
-
-    /* nothing to filter */
-    if (!avctx->extradata || avctx->extradata_size < 6) {
-        *poutbuf = (uint8_t*) buf;
-        *poutbuf_size = buf_size;
-        return 0;
-    }
-
-    /* retrieve sps and pps NAL units from extradata */
-    if (!ctx->sps_pps_data) {
-        uint16_t unit_size;
-        uint32_t total_size = 0;
-        uint8_t *out = NULL, unit_nb, sps_done = 0;
-        const uint8_t *extradata = avctx->extradata+4;
-        static const uint8_t nalu_header[4] = {0, 0, 0, 1};
-
-        /* retrieve length coded size */
-        ctx->length_size = (*extradata++ & 0x3) + 1;
-        if (ctx->length_size == 3)
-            return AVERROR(EINVAL);
-
-        /* retrieve sps and pps unit(s) */
-        unit_nb = *extradata++ & 0x1f; /* number of sps unit(s) */
-        if (!unit_nb) {
-            unit_nb = *extradata++; /* number of pps unit(s) */
-            sps_done++;
-        }
-        while (unit_nb--) {
-            unit_size = AV_RB16(extradata);
-            total_size += unit_size+4;
-            if (extradata+2+unit_size > avctx->extradata+avctx->extradata_size) {
-                av_free(out);
-                return AVERROR(EINVAL);
-            }
-            out = av_realloc(out, total_size);
-            if (!out)
-                return AVERROR(ENOMEM);
-            memcpy(out+total_size-unit_size-4, nalu_header, 4);
-            memcpy(out+total_size-unit_size,   extradata+2, unit_size);
-            extradata += 2+unit_size;
-
-            if (!unit_nb && !sps_done++)
-                unit_nb = *extradata++; /* number of pps unit(s) */
-        }
-
-        ctx->sps_pps_data = out;
-        ctx->size = total_size;
-        ctx->first_idr = 1;
-    }
-
-    *poutbuf_size = 0;
-    *poutbuf = NULL;
-    do {
-        if (buf + ctx->length_size > buf_end)
-            goto fail;
-
-        if (ctx->length_size == 1)
-            nal_size = buf[0];
-        else if (ctx->length_size == 2)
-            nal_size = AV_RB16(buf);
-        else
-            nal_size = AV_RB32(buf);
-
-        buf += ctx->length_size;
-        unit_type = *buf & 0x1f;
-
-        if (buf + nal_size > buf_end || nal_size < 0)
-            goto fail;
-
-        /* prepend only to the first type 5 NAL unit of an IDR picture */
-        if (ctx->first_idr && unit_type == 5) {
-            alloc_and_copy(poutbuf, poutbuf_size,
-                           ctx->sps_pps_data, ctx->size,
-                           buf, nal_size);
-            ctx->first_idr = 0;
-        }
-        else {
-            alloc_and_copy(poutbuf, poutbuf_size,
-                           NULL, 0,
-                           buf, nal_size);
-            if (!ctx->first_idr && unit_type == 1)
-                ctx->first_idr = 1;
-        }
-
-        buf += nal_size;
-        cumul_size += nal_size + ctx->length_size;
-    } while (cumul_size < buf_size);
-
-    return 1;
-
-fail:
-    av_freep(poutbuf);
-    *poutbuf_size = 0;
-    return AVERROR(EINVAL);
-}
-
-static void h264_mp4toannexb_close(AVBitStreamFilterContext *bsfc)
-{
-    H264BSFContext *ctx = bsfc->priv_data;
-    av_freep(&ctx->sps_pps_data);
-}
-
-AVBitStreamFilter h264_mp4toannexb_bsf = {
-    "h264_mp4toannexb",
-    sizeof(H264BSFContext),
-    h264_mp4toannexb_filter,
-    h264_mp4toannexb_close,
-};
-
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
deleted file mode 100644
index 661ef6c..0000000
--- a/libavcodec/h264_mvpred.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... motion vector predicion
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 motion vector predicion.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_H264_MVPRED_H
-#define AVCODEC_H264_MVPRED_H
-
-#include "internal.h"
-#include "avcodec.h"
-#include "h264.h"
-
-//#undef NDEBUG
-#include <assert.h>
-
-static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, int list, int part_width){
-    const int topright_ref= h->ref_cache[list][ i - 8 + part_width ];
-    MpegEncContext *s = &h->s;
-
-    /* there is no consistent mapping of mvs to neighboring locations that will
-     * make mbaff happy, so we can't move all this logic to fill_caches */
-    if(FRAME_MBAFF){
-
-#define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4)\
-                const int xy = XY, y4 = Y4;\
-                const int mb_type = mb_types[xy+(y4>>2)*s->mb_stride];\
-                if(!USES_LIST(mb_type,list))\
-                    return LIST_NOT_USED;\
-                mv = s->current_picture_ptr->motion_val[list][h->mb2b_xy[xy]+3 + y4*h->b_stride];\
-                h->mv_cache[list][scan8[0]-2][0] = mv[0];\
-                h->mv_cache[list][scan8[0]-2][1] = mv[1] MV_OP;\
-                return s->current_picture_ptr->ref_index[list][4*xy+1 + (y4&~1)] REF_OP;
-
-        if(topright_ref == PART_NOT_AVAILABLE
-           && i >= scan8[0]+8 && (i&7)==4
-           && h->ref_cache[list][scan8[0]-1] != PART_NOT_AVAILABLE){
-            const uint32_t *mb_types = s->current_picture_ptr->mb_type;
-            const int16_t *mv;
-            AV_ZERO32(h->mv_cache[list][scan8[0]-2]);
-            *C = h->mv_cache[list][scan8[0]-2];
-
-            if(!MB_FIELD
-               && IS_INTERLACED(h->left_type[0])){
-                SET_DIAG_MV(*2, >>1, h->left_mb_xy[0]+s->mb_stride, (s->mb_y&1)*2+(i>>5));
-                assert(h->left_mb_xy[0] == h->left_mb_xy[1]);
-            }
-            if(MB_FIELD
-               && !IS_INTERLACED(h->left_type[0])){
-                // left shift will turn LIST_NOT_USED into PART_NOT_AVAILABLE, but that's OK.
-                SET_DIAG_MV(/2, <<1, h->left_mb_xy[i>=36], ((i>>2))&3);
-            }
-        }
-#undef SET_DIAG_MV
-    }
-
-    if(topright_ref != PART_NOT_AVAILABLE){
-        *C= h->mv_cache[list][ i - 8 + part_width ];
-        return topright_ref;
-    }else{
-        tprintf(s->avctx, "topright MV not available\n");
-
-        *C= h->mv_cache[list][ i - 8 - 1 ];
-        return h->ref_cache[list][ i - 8 - 1 ];
-    }
-}
-
-/**
- * gets the predicted MV.
- * @param n the block index
- * @param part_width the width of the partition (4, 8,16) -> (1, 2, 4)
- * @param mx the x component of the predicted motion vector
- * @param my the y component of the predicted motion vector
- */
-static inline void pred_motion(H264Context * const h, int n, int part_width, int list, int ref, int * const mx, int * const my){
-    const int index8= scan8[n];
-    const int top_ref=      h->ref_cache[list][ index8 - 8 ];
-    const int left_ref=     h->ref_cache[list][ index8 - 1 ];
-    const int16_t * const A= h->mv_cache[list][ index8 - 1 ];
-    const int16_t * const B= h->mv_cache[list][ index8 - 8 ];
-    const int16_t * C;
-    int diagonal_ref, match_count;
-
-    assert(part_width==1 || part_width==2 || part_width==4);
-
-/* mv_cache
-  B . . A T T T T
-  U . . L . . , .
-  U . . L . . . .
-  U . . L . . , .
-  . . . L . . . .
-*/
-
-    diagonal_ref= fetch_diagonal_mv(h, &C, index8, list, part_width);
-    match_count= (diagonal_ref==ref) + (top_ref==ref) + (left_ref==ref);
-    tprintf(h->s.avctx, "pred_motion match_count=%d\n", match_count);
-    if(match_count > 1){ //most common
-        *mx= mid_pred(A[0], B[0], C[0]);
-        *my= mid_pred(A[1], B[1], C[1]);
-    }else if(match_count==1){
-        if(left_ref==ref){
-            *mx= A[0];
-            *my= A[1];
-        }else if(top_ref==ref){
-            *mx= B[0];
-            *my= B[1];
-        }else{
-            *mx= C[0];
-            *my= C[1];
-        }
-    }else{
-        if(top_ref == PART_NOT_AVAILABLE && diagonal_ref == PART_NOT_AVAILABLE && left_ref != PART_NOT_AVAILABLE){
-            *mx= A[0];
-            *my= A[1];
-        }else{
-            *mx= mid_pred(A[0], B[0], C[0]);
-            *my= mid_pred(A[1], B[1], C[1]);
-        }
-    }
-
-    tprintf(h->s.avctx, "pred_motion (%2d %2d %2d) (%2d %2d %2d) (%2d %2d %2d) -> (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1],                    diagonal_ref, C[0], C[1], left_ref, A[0], A[1], ref, *mx, *my, h->s.mb_x, h->s.mb_y, n, list);
-}
-
-/**
- * gets the directionally predicted 16x8 MV.
- * @param n the block index
- * @param mx the x component of the predicted motion vector
- * @param my the y component of the predicted motion vector
- */
-static inline void pred_16x8_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
-    if(n==0){
-        const int top_ref=      h->ref_cache[list][ scan8[0] - 8 ];
-        const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ];
-
-        tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", top_ref, B[0], B[1], h->s.mb_x, h->s.mb_y, n, list);
-
-        if(top_ref == ref){
-            *mx= B[0];
-            *my= B[1];
-            return;
-        }
-    }else{
-        const int left_ref=     h->ref_cache[list][ scan8[8] - 1 ];
-        const int16_t * const A= h->mv_cache[list][ scan8[8] - 1 ];
-
-        tprintf(h->s.avctx, "pred_16x8: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
-
-        if(left_ref == ref){
-            *mx= A[0];
-            *my= A[1];
-            return;
-        }
-    }
-
-    //RARE
-    pred_motion(h, n, 4, list, ref, mx, my);
-}
-
-/**
- * gets the directionally predicted 8x16 MV.
- * @param n the block index
- * @param mx the x component of the predicted motion vector
- * @param my the y component of the predicted motion vector
- */
-static inline void pred_8x16_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
-    if(n==0){
-        const int left_ref=      h->ref_cache[list][ scan8[0] - 1 ];
-        const int16_t * const A=  h->mv_cache[list][ scan8[0] - 1 ];
-
-        tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", left_ref, A[0], A[1], h->s.mb_x, h->s.mb_y, n, list);
-
-        if(left_ref == ref){
-            *mx= A[0];
-            *my= A[1];
-            return;
-        }
-    }else{
-        const int16_t * C;
-        int diagonal_ref;
-
-        diagonal_ref= fetch_diagonal_mv(h, &C, scan8[4], list, 2);
-
-        tprintf(h->s.avctx, "pred_8x16: (%2d %2d %2d) at %2d %2d %d list %d\n", diagonal_ref, C[0], C[1], h->s.mb_x, h->s.mb_y, n, list);
-
-        if(diagonal_ref == ref){
-            *mx= C[0];
-            *my= C[1];
-            return;
-        }
-    }
-
-    //RARE
-    pred_motion(h, n, 2, list, ref, mx, my);
-}
-
-static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my){
-    const int top_ref = h->ref_cache[0][ scan8[0] - 8 ];
-    const int left_ref= h->ref_cache[0][ scan8[0] - 1 ];
-
-    tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n", top_ref, left_ref, h->s.mb_x, h->s.mb_y);
-
-    if(top_ref == PART_NOT_AVAILABLE || left_ref == PART_NOT_AVAILABLE
-       || !( top_ref | AV_RN32A(h->mv_cache[0][ scan8[0] - 8 ]))
-       || !(left_ref | AV_RN32A(h->mv_cache[0][ scan8[0] - 1 ]))){
-
-        *mx = *my = 0;
-        return;
-    }
-
-    pred_motion(h, 0, 4, 0, 0, mx, my);
-
-    return;
-}
-
-#endif /* AVCODEC_H264_MVPRED_H */
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
deleted file mode 100644
index a3cbe3b..0000000
--- a/libavcodec/h264_parser.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... parser
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 parser.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "parser.h"
-#include "h264_parser.h"
-#include "h264data.h"
-#include "golomb.h"
-
-#include <assert.h>
-
-
-int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
-{
-    int i;
-    uint32_t state;
-    ParseContext *pc = &(h->s.parse_context);
-//printf("first %02X%02X%02X%02X\n", buf[0], buf[1],buf[2],buf[3]);
-//    mb_addr= pc->mb_addr - 1;
-    state= pc->state;
-    if(state>13)
-        state= 7;
-
-    for(i=0; i<buf_size; i++){
-        if(state==7){
-#if HAVE_FAST_UNALIGNED
-        /* we check i<buf_size instead of i+3/7 because its simpler
-         * and there should be FF_INPUT_BUFFER_PADDING_SIZE bytes at the end
-         */
-#    if HAVE_FAST_64BIT
-            while(i<buf_size && !((~*(const uint64_t*)(buf+i) & (*(const uint64_t*)(buf+i) - 0x0101010101010101ULL)) & 0x8080808080808080ULL))
-                i+=8;
-#    else
-            while(i<buf_size && !((~*(const uint32_t*)(buf+i) & (*(const uint32_t*)(buf+i) - 0x01010101U)) & 0x80808080U))
-                i+=4;
-#    endif
-#endif
-            for(; i<buf_size; i++){
-                if(!buf[i]){
-                    state=2;
-                    break;
-                }
-            }
-        }else if(state<=2){
-            if(buf[i]==1)   state^= 5; //2->7, 1->4, 0->5
-            else if(buf[i]) state = 7;
-            else            state>>=1; //2->1, 1->0, 0->0
-        }else if(state<=5){
-            int v= buf[i] & 0x1F;
-            if(v==6 || v==7 || v==8 || v==9){
-                if(pc->frame_start_found){
-                    i++;
-                    goto found;
-                }
-            }else if(v==1 || v==2 || v==5){
-                if(pc->frame_start_found){
-                    state+=8;
-                    continue;
-                }else
-                    pc->frame_start_found = 1;
-            }
-            state= 7;
-        }else{
-            if(buf[i] & 0x80)
-                goto found;
-            state= 7;
-        }
-    }
-    pc->state= state;
-    return END_NOT_FOUND;
-
-found:
-    pc->state=7;
-    pc->frame_start_found= 0;
-    return i-(state&5);
-}
-
-/*!
- * Parse NAL units of found picture and decode some basic information.
- *
- * @param s parser context.
- * @param avctx codec context.
- * @param buf buffer with field/frame data.
- * @param buf_size size of the buffer.
- */
-static inline int parse_nal_units(AVCodecParserContext *s,
-                                  AVCodecContext *avctx,
-                                  const uint8_t *buf, int buf_size)
-{
-    H264Context *h = s->priv_data;
-    const uint8_t *buf_end = buf + buf_size;
-    unsigned int pps_id;
-    unsigned int slice_type;
-    int state = -1;
-    const uint8_t *ptr;
-
-    /* set some sane default values */
-    s->pict_type = FF_I_TYPE;
-    s->key_frame = 0;
-
-    h->s.avctx= avctx;
-    h->sei_recovery_frame_cnt = -1;
-    h->sei_dpb_output_delay         =  0;
-    h->sei_cpb_removal_delay        = -1;
-    h->sei_buffering_period_present =  0;
-
-    for(;;) {
-        int src_length, dst_length, consumed;
-        buf = ff_find_start_code(buf, buf_end, &state);
-        if(buf >= buf_end)
-            break;
-        --buf;
-        src_length = buf_end - buf;
-        switch (state & 0x1f) {
-        case NAL_SLICE:
-        case NAL_IDR_SLICE:
-            // Do not walk the whole buffer just to decode slice header
-            if (src_length > 20)
-                src_length = 20;
-            break;
-        }
-        ptr= ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length);
-        if (ptr==NULL || dst_length < 0)
-            break;
-
-        init_get_bits(&h->s.gb, ptr, 8*dst_length);
-        switch(h->nal_unit_type) {
-        case NAL_SPS:
-            ff_h264_decode_seq_parameter_set(h);
-            break;
-        case NAL_PPS:
-            ff_h264_decode_picture_parameter_set(h, h->s.gb.size_in_bits);
-            break;
-        case NAL_SEI:
-            ff_h264_decode_sei(h);
-            break;
-        case NAL_IDR_SLICE:
-            s->key_frame = 1;
-            /* fall through */
-        case NAL_SLICE:
-            get_ue_golomb(&h->s.gb);  // skip first_mb_in_slice
-            slice_type = get_ue_golomb_31(&h->s.gb);
-            s->pict_type = golomb_to_pict_type[slice_type % 5];
-            if (h->sei_recovery_frame_cnt >= 0) {
-                /* key frame, since recovery_frame_cnt is set */
-                s->key_frame = 1;
-            }
-            pps_id= get_ue_golomb(&h->s.gb);
-            if(pps_id>=MAX_PPS_COUNT) {
-                av_log(h->s.avctx, AV_LOG_ERROR, "pps_id out of range\n");
-                return -1;
-            }
-            if(!h->pps_buffers[pps_id]) {
-                av_log(h->s.avctx, AV_LOG_ERROR, "non-existing PPS referenced\n");
-                return -1;
-            }
-            h->pps= *h->pps_buffers[pps_id];
-            if(!h->sps_buffers[h->pps.sps_id]) {
-                av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS referenced\n");
-                return -1;
-            }
-            h->sps = *h->sps_buffers[h->pps.sps_id];
-            h->frame_num = get_bits(&h->s.gb, h->sps.log2_max_frame_num);
-
-            avctx->profile = h->sps.profile_idc;
-            avctx->level   = h->sps.level_idc;
-
-            if(h->sps.frame_mbs_only_flag){
-                h->s.picture_structure= PICT_FRAME;
-            }else{
-                if(get_bits1(&h->s.gb)) { //field_pic_flag
-                    h->s.picture_structure= PICT_TOP_FIELD + get_bits1(&h->s.gb); //bottom_field_flag
-                } else {
-                    h->s.picture_structure= PICT_FRAME;
-                }
-            }
-
-            if(h->sps.pic_struct_present_flag) {
-                switch (h->sei_pic_struct) {
-                    case SEI_PIC_STRUCT_TOP_FIELD:
-                    case SEI_PIC_STRUCT_BOTTOM_FIELD:
-                        s->repeat_pict = 0;
-                        break;
-                    case SEI_PIC_STRUCT_FRAME:
-                    case SEI_PIC_STRUCT_TOP_BOTTOM:
-                    case SEI_PIC_STRUCT_BOTTOM_TOP:
-                        s->repeat_pict = 1;
-                        break;
-                    case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:
-                    case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:
-                        s->repeat_pict = 2;
-                        break;
-                    case SEI_PIC_STRUCT_FRAME_DOUBLING:
-                        s->repeat_pict = 3;
-                        break;
-                    case SEI_PIC_STRUCT_FRAME_TRIPLING:
-                        s->repeat_pict = 5;
-                        break;
-                    default:
-                        s->repeat_pict = h->s.picture_structure == PICT_FRAME ? 1 : 0;
-                        break;
-                }
-            } else {
-                s->repeat_pict = h->s.picture_structure == PICT_FRAME ? 1 : 0;
-            }
-
-            return 0; /* no need to evaluate the rest */
-        }
-        buf += consumed;
-    }
-    /* didn't find a picture! */
-    av_log(h->s.avctx, AV_LOG_ERROR, "missing picture in access unit\n");
-    return -1;
-}
-
-static int h264_parse(AVCodecParserContext *s,
-                      AVCodecContext *avctx,
-                      const uint8_t **poutbuf, int *poutbuf_size,
-                      const uint8_t *buf, int buf_size)
-{
-    H264Context *h = s->priv_data;
-    ParseContext *pc = &h->s.parse_context;
-    int next;
-
-    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
-        next= buf_size;
-    }else{
-        next= ff_h264_find_frame_end(h, buf, buf_size);
-
-        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-
-        if(next<0 && next != END_NOT_FOUND){
-            assert(pc->last_index + next >= 0 );
-            ff_h264_find_frame_end(h, &pc->buffer[pc->last_index + next], -next); //update state
-        }
-
-        parse_nal_units(s, avctx, buf, buf_size);
-
-        if (h->sei_cpb_removal_delay >= 0) {
-            s->dts_sync_point    = h->sei_buffering_period_present;
-            s->dts_ref_dts_delta = h->sei_cpb_removal_delay;
-            s->pts_dts_delta     = h->sei_dpb_output_delay;
-        } else {
-            s->dts_sync_point    = INT_MIN;
-            s->dts_ref_dts_delta = INT_MIN;
-            s->pts_dts_delta     = INT_MIN;
-        }
-    }
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-static int h264_split(AVCodecContext *avctx,
-                      const uint8_t *buf, int buf_size)
-{
-    int i;
-    uint32_t state = -1;
-    int has_sps= 0;
-
-    for(i=0; i<=buf_size; i++){
-        if((state&0xFFFFFF1F) == 0x107)
-            has_sps=1;
-/*        if((state&0xFFFFFF1F) == 0x101 || (state&0xFFFFFF1F) == 0x102 || (state&0xFFFFFF1F) == 0x105){
-        }*/
-        if((state&0xFFFFFF00) == 0x100 && (state&0xFFFFFF1F) != 0x107 && (state&0xFFFFFF1F) != 0x108 && (state&0xFFFFFF1F) != 0x109){
-            if(has_sps){
-                while(i>4 && buf[i-5]==0) i--;
-                return i-4;
-            }
-        }
-        if (i<buf_size)
-            state= (state<<8) | buf[i];
-    }
-    return 0;
-}
-
-static void close(AVCodecParserContext *s)
-{
-    H264Context *h = s->priv_data;
-    ParseContext *pc = &h->s.parse_context;
-
-    av_free(pc->buffer);
-    ff_h264_free_context(h);
-}
-
-static int init(AVCodecParserContext *s)
-{
-    H264Context *h = s->priv_data;
-    h->thread_context[0] = h;
-    return 0;
-}
-
-AVCodecParser h264_parser = {
-    { CODEC_ID_H264 },
-    sizeof(H264Context),
-    init,
-    h264_parse,
-    close,
-    h264_split,
-};
diff --git a/libavcodec/h264_parser.h b/libavcodec/h264_parser.h
deleted file mode 100644
index 149f49a..0000000
--- a/libavcodec/h264_parser.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... parser
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 parser.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_H264_PARSER_H
-#define AVCODEC_H264_PARSER_H
-
-#include "h264.h"
-
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size);
-
-#endif /* AVCODEC_H264_PARSER_H */
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
deleted file mode 100644
index 7648e2c..0000000
--- a/libavcodec/h264_ps.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... parameter set decoding
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 parameter set decoding.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "h264.h"
-#include "h264data.h" //FIXME FIXME FIXME (just for zigzag_scan)
-#include "golomb.h"
-
-
-//#undef NDEBUG
-#include <assert.h>
-
-static const AVRational pixel_aspect[17]={
- {0, 1},
- {1, 1},
- {12, 11},
- {10, 11},
- {16, 11},
- {40, 33},
- {24, 11},
- {20, 11},
- {32, 11},
- {80, 33},
- {18, 11},
- {15, 11},
- {64, 33},
- {160,99},
- {4, 3},
- {3, 2},
- {2, 1},
-};
-
-const uint8_t ff_h264_chroma_qp[52]={
-    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,29,30,31,32,32,33,34,34,35,35,36,36,37,37,
-   37,38,38,38,39,39,39,39
-};
-
-static const uint8_t default_scaling4[2][16]={
-{   6,13,20,28,
-   13,20,28,32,
-   20,28,32,37,
-   28,32,37,42
-},{
-   10,14,20,24,
-   14,20,24,27,
-   20,24,27,30,
-   24,27,30,34
-}};
-
-static const uint8_t default_scaling8[2][64]={
-{   6,10,13,16,18,23,25,27,
-   10,11,16,18,23,25,27,29,
-   13,16,18,23,25,27,29,31,
-   16,18,23,25,27,29,31,33,
-   18,23,25,27,29,31,33,36,
-   23,25,27,29,31,33,36,38,
-   25,27,29,31,33,36,38,40,
-   27,29,31,33,36,38,40,42
-},{
-    9,13,15,17,19,21,22,24,
-   13,13,17,19,21,22,24,25,
-   15,17,19,21,22,24,25,27,
-   17,19,21,22,24,25,27,28,
-   19,21,22,24,25,27,28,30,
-   21,22,24,25,27,28,30,32,
-   22,24,25,27,28,30,32,33,
-   24,25,27,28,30,32,33,35
-}};
-
-static inline int decode_hrd_parameters(H264Context *h, SPS *sps){
-    MpegEncContext * const s = &h->s;
-    int cpb_count, i;
-    cpb_count = get_ue_golomb_31(&s->gb) + 1;
-
-    if(cpb_count > 32U){
-        av_log(h->s.avctx, AV_LOG_ERROR, "cpb_count %d invalid\n", cpb_count);
-        return -1;
-    }
-
-    get_bits(&s->gb, 4); /* bit_rate_scale */
-    get_bits(&s->gb, 4); /* cpb_size_scale */
-    for(i=0; i<cpb_count; i++){
-        get_ue_golomb(&s->gb); /* bit_rate_value_minus1 */
-        get_ue_golomb(&s->gb); /* cpb_size_value_minus1 */
-        get_bits1(&s->gb);     /* cbr_flag */
-    }
-    sps->initial_cpb_removal_delay_length = get_bits(&s->gb, 5) + 1;
-    sps->cpb_removal_delay_length = get_bits(&s->gb, 5) + 1;
-    sps->dpb_output_delay_length = get_bits(&s->gb, 5) + 1;
-    sps->time_offset_length = get_bits(&s->gb, 5);
-    sps->cpb_cnt = cpb_count;
-    return 0;
-}
-
-static inline int decode_vui_parameters(H264Context *h, SPS *sps){
-    MpegEncContext * const s = &h->s;
-    int aspect_ratio_info_present_flag;
-    unsigned int aspect_ratio_idc;
-
-    aspect_ratio_info_present_flag= get_bits1(&s->gb);
-
-    if( aspect_ratio_info_present_flag ) {
-        aspect_ratio_idc= get_bits(&s->gb, 8);
-        if( aspect_ratio_idc == EXTENDED_SAR ) {
-            sps->sar.num= get_bits(&s->gb, 16);
-            sps->sar.den= get_bits(&s->gb, 16);
-        }else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){
-            sps->sar=  pixel_aspect[aspect_ratio_idc];
-        }else{
-            av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
-            return -1;
-        }
-    }else{
-        sps->sar.num=
-        sps->sar.den= 0;
-    }
-//            s->avctx->aspect_ratio= sar_width*s->width / (float)(s->height*sar_height);
-
-    if(get_bits1(&s->gb)){      /* overscan_info_present_flag */
-        get_bits1(&s->gb);      /* overscan_appropriate_flag */
-    }
-
-    sps->video_signal_type_present_flag = get_bits1(&s->gb);
-    if(sps->video_signal_type_present_flag){
-        get_bits(&s->gb, 3);    /* video_format */
-        sps->full_range = get_bits1(&s->gb); /* video_full_range_flag */
-
-        sps->colour_description_present_flag = get_bits1(&s->gb);
-        if(sps->colour_description_present_flag){
-            sps->color_primaries = get_bits(&s->gb, 8); /* colour_primaries */
-            sps->color_trc       = get_bits(&s->gb, 8); /* transfer_characteristics */
-            sps->colorspace      = get_bits(&s->gb, 8); /* matrix_coefficients */
-            if (sps->color_primaries >= AVCOL_PRI_NB)
-                sps->color_primaries  = AVCOL_PRI_UNSPECIFIED;
-            if (sps->color_trc >= AVCOL_TRC_NB)
-                sps->color_trc  = AVCOL_TRC_UNSPECIFIED;
-            if (sps->colorspace >= AVCOL_SPC_NB)
-                sps->colorspace  = AVCOL_SPC_UNSPECIFIED;
-        }
-    }
-
-    if(get_bits1(&s->gb)){      /* chroma_location_info_present_flag */
-        s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1;  /* chroma_sample_location_type_top_field */
-        get_ue_golomb(&s->gb);  /* chroma_sample_location_type_bottom_field */
-    }
-
-    sps->timing_info_present_flag = get_bits1(&s->gb);
-    if(sps->timing_info_present_flag){
-        sps->num_units_in_tick = get_bits_long(&s->gb, 32);
-        sps->time_scale = get_bits_long(&s->gb, 32);
-        if(!sps->num_units_in_tick || !sps->time_scale){
-            av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
-            return -1;
-        }
-        sps->fixed_frame_rate_flag = get_bits1(&s->gb);
-    }
-
-    sps->nal_hrd_parameters_present_flag = get_bits1(&s->gb);
-    if(sps->nal_hrd_parameters_present_flag)
-        if(decode_hrd_parameters(h, sps) < 0)
-            return -1;
-    sps->vcl_hrd_parameters_present_flag = get_bits1(&s->gb);
-    if(sps->vcl_hrd_parameters_present_flag)
-        if(decode_hrd_parameters(h, sps) < 0)
-            return -1;
-    if(sps->nal_hrd_parameters_present_flag || sps->vcl_hrd_parameters_present_flag)
-        get_bits1(&s->gb);     /* low_delay_hrd_flag */
-    sps->pic_struct_present_flag = get_bits1(&s->gb);
-
-    sps->bitstream_restriction_flag = get_bits1(&s->gb);
-    if(sps->bitstream_restriction_flag){
-        get_bits1(&s->gb);     /* motion_vectors_over_pic_boundaries_flag */
-        get_ue_golomb(&s->gb); /* max_bytes_per_pic_denom */
-        get_ue_golomb(&s->gb); /* max_bits_per_mb_denom */
-        get_ue_golomb(&s->gb); /* log2_max_mv_length_horizontal */
-        get_ue_golomb(&s->gb); /* log2_max_mv_length_vertical */
-        sps->num_reorder_frames= get_ue_golomb(&s->gb);
-        get_ue_golomb(&s->gb); /*max_dec_frame_buffering*/
-
-        if(s->gb.size_in_bits < get_bits_count(&s->gb)){
-            av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", get_bits_count(&s->gb) - s->gb.size_in_bits);
-            sps->num_reorder_frames=0;
-            sps->bitstream_restriction_flag= 0;
-        }
-
-        if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){
-            av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-static void decode_scaling_list(H264Context *h, uint8_t *factors, int size,
-                                const uint8_t *jvt_list, const uint8_t *fallback_list){
-    MpegEncContext * const s = &h->s;
-    int i, last = 8, next = 8;
-    const uint8_t *scan = size == 16 ? zigzag_scan : ff_zigzag_direct;
-    if(!get_bits1(&s->gb)) /* matrix not written, we use the predicted one */
-        memcpy(factors, fallback_list, size*sizeof(uint8_t));
-    else
-    for(i=0;i<size;i++){
-        if(next)
-            next = (last + get_se_golomb(&s->gb)) & 0xff;
-        if(!i && !next){ /* matrix not written, we use the preset one */
-            memcpy(factors, jvt_list, size*sizeof(uint8_t));
-            break;
-        }
-        last = factors[scan[i]] = next ? next : last;
-    }
-}
-
-static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_sps,
-                                   uint8_t (*scaling_matrix4)[16], uint8_t (*scaling_matrix8)[64]){
-    MpegEncContext * const s = &h->s;
-    int fallback_sps = !is_sps && sps->scaling_matrix_present;
-    const uint8_t *fallback[4] = {
-        fallback_sps ? sps->scaling_matrix4[0] : default_scaling4[0],
-        fallback_sps ? sps->scaling_matrix4[3] : default_scaling4[1],
-        fallback_sps ? sps->scaling_matrix8[0] : default_scaling8[0],
-        fallback_sps ? sps->scaling_matrix8[1] : default_scaling8[1]
-    };
-    if(get_bits1(&s->gb)){
-        sps->scaling_matrix_present |= is_sps;
-        decode_scaling_list(h,scaling_matrix4[0],16,default_scaling4[0],fallback[0]); // Intra, Y
-        decode_scaling_list(h,scaling_matrix4[1],16,default_scaling4[0],scaling_matrix4[0]); // Intra, Cr
-        decode_scaling_list(h,scaling_matrix4[2],16,default_scaling4[0],scaling_matrix4[1]); // Intra, Cb
-        decode_scaling_list(h,scaling_matrix4[3],16,default_scaling4[1],fallback[1]); // Inter, Y
-        decode_scaling_list(h,scaling_matrix4[4],16,default_scaling4[1],scaling_matrix4[3]); // Inter, Cr
-        decode_scaling_list(h,scaling_matrix4[5],16,default_scaling4[1],scaling_matrix4[4]); // Inter, Cb
-        if(is_sps || pps->transform_8x8_mode){
-            decode_scaling_list(h,scaling_matrix8[0],64,default_scaling8[0],fallback[2]);  // Intra, Y
-            decode_scaling_list(h,scaling_matrix8[1],64,default_scaling8[1],fallback[3]);  // Inter, Y
-        }
-    }
-}
-
-int ff_h264_decode_seq_parameter_set(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    int profile_idc, level_idc;
-    unsigned int sps_id;
-    int i;
-    SPS *sps;
-
-    profile_idc= get_bits(&s->gb, 8);
-    get_bits1(&s->gb);   //constraint_set0_flag
-    get_bits1(&s->gb);   //constraint_set1_flag
-    get_bits1(&s->gb);   //constraint_set2_flag
-    get_bits1(&s->gb);   //constraint_set3_flag
-    get_bits(&s->gb, 4); // reserved
-    level_idc= get_bits(&s->gb, 8);
-    sps_id= get_ue_golomb_31(&s->gb);
-
-    if(sps_id >= MAX_SPS_COUNT) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "sps_id (%d) out of range\n", sps_id);
-        return -1;
-    }
-    sps= av_mallocz(sizeof(SPS));
-    if(sps == NULL)
-        return -1;
-
-    sps->profile_idc= profile_idc;
-    sps->level_idc= level_idc;
-
-    memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
-    memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
-    sps->scaling_matrix_present = 0;
-
-    if(sps->profile_idc >= 100){ //high profile
-        sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
-        if(sps->chroma_format_idc == 3)
-            sps->residual_color_transform_flag = get_bits1(&s->gb);
-        sps->bit_depth_luma   = get_ue_golomb(&s->gb) + 8;
-        sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8;
-        sps->transform_bypass = get_bits1(&s->gb);
-        decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8);
-    }else{
-        sps->chroma_format_idc= 1;
-        sps->bit_depth_luma   = 8;
-        sps->bit_depth_chroma = 8;
-    }
-
-    sps->log2_max_frame_num= get_ue_golomb(&s->gb) + 4;
-    sps->poc_type= get_ue_golomb_31(&s->gb);
-
-    if(sps->poc_type == 0){ //FIXME #define
-        sps->log2_max_poc_lsb= get_ue_golomb(&s->gb) + 4;
-    } else if(sps->poc_type == 1){//FIXME #define
-        sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb);
-        sps->offset_for_non_ref_pic= get_se_golomb(&s->gb);
-        sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb);
-        sps->poc_cycle_length                = get_ue_golomb(&s->gb);
-
-        if((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){
-            av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", sps->poc_cycle_length);
-            goto fail;
-        }
-
-        for(i=0; i<sps->poc_cycle_length; i++)
-            sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb);
-    }else if(sps->poc_type != 2){
-        av_log(h->s.avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
-        goto fail;
-    }
-
-    sps->ref_frame_count= get_ue_golomb_31(&s->gb);
-    if(sps->ref_frame_count > MAX_PICTURE_COUNT-2 || sps->ref_frame_count >= 32U){
-        av_log(h->s.avctx, AV_LOG_ERROR, "too many reference frames\n");
-        goto fail;
-    }
-    sps->gaps_in_frame_num_allowed_flag= get_bits1(&s->gb);
-    sps->mb_width = get_ue_golomb(&s->gb) + 1;
-    sps->mb_height= get_ue_golomb(&s->gb) + 1;
-    if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 ||
-       avcodec_check_dimensions(NULL, 16*sps->mb_width, 16*sps->mb_height)){
-        av_log(h->s.avctx, AV_LOG_ERROR, "mb_width/height overflow\n");
-        goto fail;
-    }
-
-    sps->frame_mbs_only_flag= get_bits1(&s->gb);
-    if(!sps->frame_mbs_only_flag)
-        sps->mb_aff= get_bits1(&s->gb);
-    else
-        sps->mb_aff= 0;
-
-    sps->direct_8x8_inference_flag= get_bits1(&s->gb);
-    if(!sps->frame_mbs_only_flag && !sps->direct_8x8_inference_flag){
-        av_log(h->s.avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n");
-        goto fail;
-    }
-
-#ifndef ALLOW_INTERLACE
-    if(sps->mb_aff)
-        av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n");
-#endif
-    sps->crop= get_bits1(&s->gb);
-    if(sps->crop){
-        sps->crop_left  = get_ue_golomb(&s->gb);
-        sps->crop_right = get_ue_golomb(&s->gb);
-        sps->crop_top   = get_ue_golomb(&s->gb);
-        sps->crop_bottom= get_ue_golomb(&s->gb);
-        if(sps->crop_left || sps->crop_top){
-            av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
-        }
-        if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !sps->frame_mbs_only_flag)){
-            av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");
-        }
-    }else{
-        sps->crop_left  =
-        sps->crop_right =
-        sps->crop_top   =
-        sps->crop_bottom= 0;
-    }
-
-    sps->vui_parameters_present_flag= get_bits1(&s->gb);
-    if( sps->vui_parameters_present_flag )
-        if (decode_vui_parameters(h, sps) < 0)
-            goto fail;
-
-    if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-        av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d\n",
-               sps_id, sps->profile_idc, sps->level_idc,
-               sps->poc_type,
-               sps->ref_frame_count,
-               sps->mb_width, sps->mb_height,
-               sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"),
-               sps->direct_8x8_inference_flag ? "8B8" : "",
-               sps->crop_left, sps->crop_right,
-               sps->crop_top, sps->crop_bottom,
-               sps->vui_parameters_present_flag ? "VUI" : "",
-               ((const char*[]){"Gray","420","422","444"})[sps->chroma_format_idc],
-               sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
-               sps->timing_info_present_flag ? sps->time_scale : 0
-               );
-    }
-
-    av_free(h->sps_buffers[sps_id]);
-    h->sps_buffers[sps_id]= sps;
-    h->sps = *sps;
-    return 0;
-fail:
-    av_free(sps);
-    return -1;
-}
-
-static void
-build_qp_table(PPS *pps, int t, int index)
-{
-    int i;
-    for(i = 0; i < 52; i++)
-        pps->chroma_qp_table[t][i] = ff_h264_chroma_qp[av_clip(i + index, 0, 51)];
-}
-
-int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
-    MpegEncContext * const s = &h->s;
-    unsigned int pps_id= get_ue_golomb(&s->gb);
-    PPS *pps;
-
-    if(pps_id >= MAX_PPS_COUNT) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "pps_id (%d) out of range\n", pps_id);
-        return -1;
-    }
-
-    pps= av_mallocz(sizeof(PPS));
-    if(pps == NULL)
-        return -1;
-    pps->sps_id= get_ue_golomb_31(&s->gb);
-    if((unsigned)pps->sps_id>=MAX_SPS_COUNT || h->sps_buffers[pps->sps_id] == NULL){
-        av_log(h->s.avctx, AV_LOG_ERROR, "sps_id out of range\n");
-        goto fail;
-    }
-
-    pps->cabac= get_bits1(&s->gb);
-    pps->pic_order_present= get_bits1(&s->gb);
-    pps->slice_group_count= get_ue_golomb(&s->gb) + 1;
-    if(pps->slice_group_count > 1 ){
-        pps->mb_slice_group_map_type= get_ue_golomb(&s->gb);
-        av_log(h->s.avctx, AV_LOG_ERROR, "FMO not supported\n");
-        switch(pps->mb_slice_group_map_type){
-        case 0:
-#if 0
-|   for( i = 0; i <= num_slice_groups_minus1; i++ ) |   |        |
-|    run_length[ i ]                                |1  |ue(v)   |
-#endif
-            break;
-        case 2:
-#if 0
-|   for( i = 0; i < num_slice_groups_minus1; i++ )  |   |        |
-|{                                                  |   |        |
-|    top_left_mb[ i ]                               |1  |ue(v)   |
-|    bottom_right_mb[ i ]                           |1  |ue(v)   |
-|   }                                               |   |        |
-#endif
-            break;
-        case 3:
-        case 4:
-        case 5:
-#if 0
-|   slice_group_change_direction_flag               |1  |u(1)    |
-|   slice_group_change_rate_minus1                  |1  |ue(v)   |
-#endif
-            break;
-        case 6:
-#if 0
-|   slice_group_id_cnt_minus1                       |1  |ue(v)   |
-|   for( i = 0; i <= slice_group_id_cnt_minus1; i++ |   |        |
-|)                                                  |   |        |
-|    slice_group_id[ i ]                            |1  |u(v)    |
-#endif
-            break;
-        }
-    }
-    pps->ref_count[0]= get_ue_golomb(&s->gb) + 1;
-    pps->ref_count[1]= get_ue_golomb(&s->gb) + 1;
-    if(pps->ref_count[0]-1 > 32-1 || pps->ref_count[1]-1 > 32-1){
-        av_log(h->s.avctx, AV_LOG_ERROR, "reference overflow (pps)\n");
-        goto fail;
-    }
-
-    pps->weighted_pred= get_bits1(&s->gb);
-    pps->weighted_bipred_idc= get_bits(&s->gb, 2);
-    pps->init_qp= get_se_golomb(&s->gb) + 26;
-    pps->init_qs= get_se_golomb(&s->gb) + 26;
-    pps->chroma_qp_index_offset[0]= get_se_golomb(&s->gb);
-    pps->deblocking_filter_parameters_present= get_bits1(&s->gb);
-    pps->constrained_intra_pred= get_bits1(&s->gb);
-    pps->redundant_pic_cnt_present = get_bits1(&s->gb);
-
-    pps->transform_8x8_mode= 0;
-    h->dequant_coeff_pps= -1; //contents of sps/pps can change even if id doesn't, so reinit
-    memcpy(pps->scaling_matrix4, h->sps_buffers[pps->sps_id]->scaling_matrix4, sizeof(pps->scaling_matrix4));
-    memcpy(pps->scaling_matrix8, h->sps_buffers[pps->sps_id]->scaling_matrix8, sizeof(pps->scaling_matrix8));
-
-    if(get_bits_count(&s->gb) < bit_length){
-        pps->transform_8x8_mode= get_bits1(&s->gb);
-        decode_scaling_matrices(h, h->sps_buffers[pps->sps_id], pps, 0, pps->scaling_matrix4, pps->scaling_matrix8);
-        pps->chroma_qp_index_offset[1]= get_se_golomb(&s->gb); //second_chroma_qp_index_offset
-    } else {
-        pps->chroma_qp_index_offset[1]= pps->chroma_qp_index_offset[0];
-    }
-
-    build_qp_table(pps, 0, pps->chroma_qp_index_offset[0]);
-    build_qp_table(pps, 1, pps->chroma_qp_index_offset[1]);
-    if(pps->chroma_qp_index_offset[0] != pps->chroma_qp_index_offset[1])
-        pps->chroma_qp_diff= 1;
-
-    if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-        av_log(h->s.avctx, AV_LOG_DEBUG, "pps:%u sps:%u %s slice_groups:%d ref:%d/%d %s qp:%d/%d/%d/%d %s %s %s %s\n",
-               pps_id, pps->sps_id,
-               pps->cabac ? "CABAC" : "CAVLC",
-               pps->slice_group_count,
-               pps->ref_count[0], pps->ref_count[1],
-               pps->weighted_pred ? "weighted" : "",
-               pps->init_qp, pps->init_qs, pps->chroma_qp_index_offset[0], pps->chroma_qp_index_offset[1],
-               pps->deblocking_filter_parameters_present ? "LPAR" : "",
-               pps->constrained_intra_pred ? "CONSTR" : "",
-               pps->redundant_pic_cnt_present ? "REDU" : "",
-               pps->transform_8x8_mode ? "8x8DCT" : ""
-               );
-    }
-
-    av_free(h->pps_buffers[pps_id]);
-    h->pps_buffers[pps_id]= pps;
-    return 0;
-fail:
-    av_free(pps);
-    return -1;
-}
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
deleted file mode 100644
index ed715c6..0000000
--- a/libavcodec/h264_refs.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... reference picture handling
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10  reference picture handling.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "h264.h"
-#include "golomb.h"
-
-//#undef NDEBUG
-#include <assert.h>
-
-
-static void pic_as_field(Picture *pic, const int parity){
-    int i;
-    for (i = 0; i < 4; ++i) {
-        if (parity == PICT_BOTTOM_FIELD)
-            pic->data[i] += pic->linesize[i];
-        pic->reference = parity;
-        pic->linesize[i] *= 2;
-    }
-    pic->poc= pic->field_poc[parity == PICT_BOTTOM_FIELD];
-}
-
-static int split_field_copy(Picture *dest, Picture *src,
-                            int parity, int id_add){
-    int match = !!(src->reference & parity);
-
-    if (match) {
-        *dest = *src;
-        if(parity != PICT_FRAME){
-            pic_as_field(dest, parity);
-            dest->pic_id *= 2;
-            dest->pic_id += id_add;
-        }
-    }
-
-    return match;
-}
-
-static int build_def_list(Picture *def, Picture **in, int len, int is_long, int sel){
-    int i[2]={0};
-    int index=0;
-
-    while(i[0]<len || i[1]<len){
-        while(i[0]<len && !(in[ i[0] ] && (in[ i[0] ]->reference & sel)))
-            i[0]++;
-        while(i[1]<len && !(in[ i[1] ] && (in[ i[1] ]->reference & (sel^3))))
-            i[1]++;
-        if(i[0] < len){
-            in[ i[0] ]->pic_id= is_long ? i[0] : in[ i[0] ]->frame_num;
-            split_field_copy(&def[index++], in[ i[0]++ ], sel  , 1);
-        }
-        if(i[1] < len){
-            in[ i[1] ]->pic_id= is_long ? i[1] : in[ i[1] ]->frame_num;
-            split_field_copy(&def[index++], in[ i[1]++ ], sel^3, 0);
-        }
-    }
-
-    return index;
-}
-
-static int add_sorted(Picture **sorted, Picture **src, int len, int limit, int dir){
-    int i, best_poc;
-    int out_i= 0;
-
-    for(;;){
-        best_poc= dir ? INT_MIN : INT_MAX;
-
-        for(i=0; i<len; i++){
-            const int poc= src[i]->poc;
-            if(((poc > limit) ^ dir) && ((poc < best_poc) ^ dir)){
-                best_poc= poc;
-                sorted[out_i]= src[i];
-            }
-        }
-        if(best_poc == (dir ? INT_MIN : INT_MAX))
-            break;
-        limit= sorted[out_i++]->poc - dir;
-    }
-    return out_i;
-}
-
-int ff_h264_fill_default_ref_list(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    int i, len;
-
-    if(h->slice_type_nos==FF_B_TYPE){
-        Picture *sorted[32];
-        int cur_poc, list;
-        int lens[2];
-
-        if(FIELD_PICTURE)
-            cur_poc= s->current_picture_ptr->field_poc[ s->picture_structure == PICT_BOTTOM_FIELD ];
-        else
-            cur_poc= s->current_picture_ptr->poc;
-
-        for(list= 0; list<2; list++){
-            len= add_sorted(sorted    , h->short_ref, h->short_ref_count, cur_poc, 1^list);
-            len+=add_sorted(sorted+len, h->short_ref, h->short_ref_count, cur_poc, 0^list);
-            assert(len<=32);
-            len= build_def_list(h->default_ref_list[list]    , sorted     , len, 0, s->picture_structure);
-            len+=build_def_list(h->default_ref_list[list]+len, h->long_ref, 16 , 1, s->picture_structure);
-            assert(len<=32);
-
-            if(len < h->ref_count[list])
-                memset(&h->default_ref_list[list][len], 0, sizeof(Picture)*(h->ref_count[list] - len));
-            lens[list]= len;
-        }
-
-        if(lens[0] == lens[1] && lens[1] > 1){
-            for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0] && i<lens[0]; i++);
-            if(i == lens[0])
-                FFSWAP(Picture, h->default_ref_list[1][0], h->default_ref_list[1][1]);
-        }
-    }else{
-        len = build_def_list(h->default_ref_list[0]    , h->short_ref, h->short_ref_count, 0, s->picture_structure);
-        len+= build_def_list(h->default_ref_list[0]+len, h-> long_ref, 16                , 1, s->picture_structure);
-        assert(len <= 32);
-        if(len < h->ref_count[0])
-            memset(&h->default_ref_list[0][len], 0, sizeof(Picture)*(h->ref_count[0] - len));
-    }
-#ifdef TRACE
-    for (i=0; i<h->ref_count[0]; i++) {
-        tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]);
-    }
-    if(h->slice_type_nos==FF_B_TYPE){
-        for (i=0; i<h->ref_count[1]; i++) {
-            tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]);
-        }
-    }
-#endif
-    return 0;
-}
-
-static void print_short_term(H264Context *h);
-static void print_long_term(H264Context *h);
-
-/**
- * Extract structure information about the picture described by pic_num in
- * the current decoding context (frame or field). Note that pic_num is
- * picture number without wrapping (so, 0<=pic_num<max_pic_num).
- * @param pic_num picture number for which to extract structure information
- * @param structure one of PICT_XXX describing structure of picture
- *                      with pic_num
- * @return frame number (short term) or long term index of picture
- *         described by pic_num
- */
-static int pic_num_extract(H264Context *h, int pic_num, int *structure){
-    MpegEncContext * const s = &h->s;
-
-    *structure = s->picture_structure;
-    if(FIELD_PICTURE){
-        if (!(pic_num & 1))
-            /* opposite field */
-            *structure ^= PICT_FRAME;
-        pic_num >>= 1;
-    }
-
-    return pic_num;
-}
-
-int ff_h264_decode_ref_pic_list_reordering(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    int list, index, pic_structure;
-
-    print_short_term(h);
-    print_long_term(h);
-
-    for(list=0; list<h->list_count; list++){
-        memcpy(h->ref_list[list], h->default_ref_list[list], sizeof(Picture)*h->ref_count[list]);
-
-        if(get_bits1(&s->gb)){
-            int pred= h->curr_pic_num;
-
-            for(index=0; ; index++){
-                unsigned int reordering_of_pic_nums_idc= get_ue_golomb_31(&s->gb);
-                unsigned int pic_id;
-                int i;
-                Picture *ref = NULL;
-
-                if(reordering_of_pic_nums_idc==3)
-                    break;
-
-                if(index >= h->ref_count[list]){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "reference count overflow\n");
-                    return -1;
-                }
-
-                if(reordering_of_pic_nums_idc<3){
-                    if(reordering_of_pic_nums_idc<2){
-                        const unsigned int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1;
-                        int frame_num;
-
-                        if(abs_diff_pic_num > h->max_pic_num){
-                            av_log(h->s.avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n");
-                            return -1;
-                        }
-
-                        if(reordering_of_pic_nums_idc == 0) pred-= abs_diff_pic_num;
-                        else                                pred+= abs_diff_pic_num;
-                        pred &= h->max_pic_num - 1;
-
-                        frame_num = pic_num_extract(h, pred, &pic_structure);
-
-                        for(i= h->short_ref_count-1; i>=0; i--){
-                            ref = h->short_ref[i];
-                            assert(ref->reference);
-                            assert(!ref->long_ref);
-                            if(
-                                   ref->frame_num == frame_num &&
-                                   (ref->reference & pic_structure)
-                              )
-                                break;
-                        }
-                        if(i>=0)
-                            ref->pic_id= pred;
-                    }else{
-                        int long_idx;
-                        pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx
-
-                        long_idx= pic_num_extract(h, pic_id, &pic_structure);
-
-                        if(long_idx>31){
-                            av_log(h->s.avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n");
-                            return -1;
-                        }
-                        ref = h->long_ref[long_idx];
-                        assert(!(ref && !ref->reference));
-                        if(ref && (ref->reference & pic_structure)){
-                            ref->pic_id= pic_id;
-                            assert(ref->long_ref);
-                            i=0;
-                        }else{
-                            i=-1;
-                        }
-                    }
-
-                    if (i < 0) {
-                        av_log(h->s.avctx, AV_LOG_ERROR, "reference picture missing during reorder\n");
-                        memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME
-                    } else {
-                        for(i=index; i+1<h->ref_count[list]; i++){
-                            if(ref->long_ref == h->ref_list[list][i].long_ref && ref->pic_id == h->ref_list[list][i].pic_id)
-                                break;
-                        }
-                        for(; i > index; i--){
-                            h->ref_list[list][i]= h->ref_list[list][i-1];
-                        }
-                        h->ref_list[list][index]= *ref;
-                        if (FIELD_PICTURE){
-                            pic_as_field(&h->ref_list[list][index], pic_structure);
-                        }
-                    }
-                }else{
-                    av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n");
-                    return -1;
-                }
-            }
-        }
-    }
-    for(list=0; list<h->list_count; list++){
-        for(index= 0; index < h->ref_count[list]; index++){
-            if(!h->ref_list[list][index].data[0]){
-                av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture\n");
-                if(h->default_ref_list[list][0].data[0])
-                    h->ref_list[list][index]= h->default_ref_list[list][0];
-                else
-                    return -1;
-            }
-        }
-    }
-
-    return 0;
-}
-
-void ff_h264_fill_mbaff_ref_list(H264Context *h){
-    int list, i, j;
-    for(list=0; list<2; list++){ //FIXME try list_count
-        for(i=0; i<h->ref_count[list]; i++){
-            Picture *frame = &h->ref_list[list][i];
-            Picture *field = &h->ref_list[list][16+2*i];
-            field[0] = *frame;
-            for(j=0; j<3; j++)
-                field[0].linesize[j] <<= 1;
-            field[0].reference = PICT_TOP_FIELD;
-            field[0].poc= field[0].field_poc[0];
-            field[1] = field[0];
-            for(j=0; j<3; j++)
-                field[1].data[j] += frame->linesize[j];
-            field[1].reference = PICT_BOTTOM_FIELD;
-            field[1].poc= field[1].field_poc[1];
-
-            h->luma_weight[16+2*i][list][0] = h->luma_weight[16+2*i+1][list][0] = h->luma_weight[i][list][0];
-            h->luma_weight[16+2*i][list][1] = h->luma_weight[16+2*i+1][list][1] = h->luma_weight[i][list][1];
-            for(j=0; j<2; j++){
-                h->chroma_weight[16+2*i][list][j][0] = h->chroma_weight[16+2*i+1][list][j][0] = h->chroma_weight[i][list][j][0];
-                h->chroma_weight[16+2*i][list][j][1] = h->chroma_weight[16+2*i+1][list][j][1] = h->chroma_weight[i][list][j][1];
-            }
-        }
-    }
-}
-
-/**
- * Mark a picture as no longer needed for reference. The refmask
- * argument allows unreferencing of individual fields or the whole frame.
- * If the picture becomes entirely unreferenced, but is being held for
- * display purposes, it is marked as such.
- * @param refmask mask of fields to unreference; the mask is bitwise
- *                anded with the reference marking of pic
- * @return non-zero if pic becomes entirely unreferenced (except possibly
- *         for display purposes) zero if one of the fields remains in
- *         reference
- */
-static inline int unreference_pic(H264Context *h, Picture *pic, int refmask){
-    int i;
-    if (pic->reference &= refmask) {
-        return 0;
-    } else {
-        for(i = 0; h->delayed_pic[i]; i++)
-            if(pic == h->delayed_pic[i]){
-                pic->reference=DELAYED_PIC_REF;
-                break;
-            }
-        return 1;
-    }
-}
-
-/**
- * Find a Picture in the short term reference list by frame number.
- * @param frame_num frame number to search for
- * @param idx the index into h->short_ref where returned picture is found
- *            undefined if no picture found.
- * @return pointer to the found picture, or NULL if no pic with the provided
- *                 frame number is found
- */
-static Picture * find_short(H264Context *h, int frame_num, int *idx){
-    MpegEncContext * const s = &h->s;
-    int i;
-
-    for(i=0; i<h->short_ref_count; i++){
-        Picture *pic= h->short_ref[i];
-        if(s->avctx->debug&FF_DEBUG_MMCO)
-            av_log(h->s.avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic);
-        if(pic->frame_num == frame_num) {
-            *idx = i;
-            return pic;
-        }
-    }
-    return NULL;
-}
-
-/**
- * Remove a picture from the short term reference list by its index in
- * that list.  This does no checking on the provided index; it is assumed
- * to be valid. Other list entries are shifted down.
- * @param i index into h->short_ref of picture to remove.
- */
-static void remove_short_at_index(H264Context *h, int i){
-    assert(i >= 0 && i < h->short_ref_count);
-    h->short_ref[i]= NULL;
-    if (--h->short_ref_count)
-        memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i)*sizeof(Picture*));
-}
-
-/**
- *
- * @return the removed picture or NULL if an error occurs
- */
-static Picture * remove_short(H264Context *h, int frame_num, int ref_mask){
-    MpegEncContext * const s = &h->s;
-    Picture *pic;
-    int i;
-
-    if(s->avctx->debug&FF_DEBUG_MMCO)
-        av_log(h->s.avctx, AV_LOG_DEBUG, "remove short %d count %d\n", frame_num, h->short_ref_count);
-
-    pic = find_short(h, frame_num, &i);
-    if (pic){
-        if(unreference_pic(h, pic, ref_mask))
-        remove_short_at_index(h, i);
-    }
-
-    return pic;
-}
-
-/**
- * Remove a picture from the long term reference list by its index in
- * that list.
- * @return the removed picture or NULL if an error occurs
- */
-static Picture * remove_long(H264Context *h, int i, int ref_mask){
-    Picture *pic;
-
-    pic= h->long_ref[i];
-    if (pic){
-        if(unreference_pic(h, pic, ref_mask)){
-            assert(h->long_ref[i]->long_ref == 1);
-            h->long_ref[i]->long_ref= 0;
-            h->long_ref[i]= NULL;
-            h->long_ref_count--;
-        }
-    }
-
-    return pic;
-}
-
-void ff_h264_remove_all_refs(H264Context *h){
-    int i;
-
-    for(i=0; i<16; i++){
-        remove_long(h, i, 0);
-    }
-    assert(h->long_ref_count==0);
-
-    for(i=0; i<h->short_ref_count; i++){
-        unreference_pic(h, h->short_ref[i], 0);
-        h->short_ref[i]= NULL;
-    }
-    h->short_ref_count=0;
-}
-
-/**
- * print short term list
- */
-static void print_short_term(H264Context *h) {
-    uint32_t i;
-    if(h->s.avctx->debug&FF_DEBUG_MMCO) {
-        av_log(h->s.avctx, AV_LOG_DEBUG, "short term list:\n");
-        for(i=0; i<h->short_ref_count; i++){
-            Picture *pic= h->short_ref[i];
-            av_log(h->s.avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n", i, pic->frame_num, pic->poc, pic->data[0]);
-        }
-    }
-}
-
-/**
- * print long term list
- */
-static void print_long_term(H264Context *h) {
-    uint32_t i;
-    if(h->s.avctx->debug&FF_DEBUG_MMCO) {
-        av_log(h->s.avctx, AV_LOG_DEBUG, "long term list:\n");
-        for(i = 0; i < 16; i++){
-            Picture *pic= h->long_ref[i];
-            if (pic) {
-                av_log(h->s.avctx, AV_LOG_DEBUG, "%d fn:%d poc:%d %p\n", i, pic->frame_num, pic->poc, pic->data[0]);
-            }
-        }
-    }
-}
-
-int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
-    MpegEncContext * const s = &h->s;
-    int i, av_uninit(j);
-    int current_ref_assigned=0;
-    Picture *av_uninit(pic);
-
-    if((s->avctx->debug&FF_DEBUG_MMCO) && mmco_count==0)
-        av_log(h->s.avctx, AV_LOG_DEBUG, "no mmco here\n");
-
-    for(i=0; i<mmco_count; i++){
-        int av_uninit(structure), av_uninit(frame_num);
-        if(s->avctx->debug&FF_DEBUG_MMCO)
-            av_log(h->s.avctx, AV_LOG_DEBUG, "mmco:%d %d %d\n", h->mmco[i].opcode, h->mmco[i].short_pic_num, h->mmco[i].long_arg);
-
-        if(   mmco[i].opcode == MMCO_SHORT2UNUSED
-           || mmco[i].opcode == MMCO_SHORT2LONG){
-            frame_num = pic_num_extract(h, mmco[i].short_pic_num, &structure);
-            pic = find_short(h, frame_num, &j);
-            if(!pic){
-                if(mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg]
-                   || h->long_ref[mmco[i].long_arg]->frame_num != frame_num)
-                av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short failure\n");
-                continue;
-            }
-        }
-
-        switch(mmco[i].opcode){
-        case MMCO_SHORT2UNUSED:
-            if(s->avctx->debug&FF_DEBUG_MMCO)
-                av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref short %d count %d\n", h->mmco[i].short_pic_num, h->short_ref_count);
-            remove_short(h, frame_num, structure ^ PICT_FRAME);
-            break;
-        case MMCO_SHORT2LONG:
-                if (h->long_ref[mmco[i].long_arg] != pic)
-                    remove_long(h, mmco[i].long_arg, 0);
-
-                remove_short_at_index(h, j);
-                h->long_ref[ mmco[i].long_arg ]= pic;
-                if (h->long_ref[ mmco[i].long_arg ]){
-                    h->long_ref[ mmco[i].long_arg ]->long_ref=1;
-                    h->long_ref_count++;
-                }
-            break;
-        case MMCO_LONG2UNUSED:
-            j = pic_num_extract(h, mmco[i].long_arg, &structure);
-            pic = h->long_ref[j];
-            if (pic) {
-                remove_long(h, j, structure ^ PICT_FRAME);
-            } else if(s->avctx->debug&FF_DEBUG_MMCO)
-                av_log(h->s.avctx, AV_LOG_DEBUG, "mmco: unref long failure\n");
-            break;
-        case MMCO_LONG:
-                    // Comment below left from previous code as it is an interresting note.
-                    /* First field in pair is in short term list or
-                     * at a different long term index.
-                     * This is not allowed; see 7.4.3.3, notes 2 and 3.
-                     * Report the problem and keep the pair where it is,
-                     * and mark this field valid.
-                     */
-
-            if (h->long_ref[mmco[i].long_arg] != s->current_picture_ptr) {
-                remove_long(h, mmco[i].long_arg, 0);
-
-                h->long_ref[ mmco[i].long_arg ]= s->current_picture_ptr;
-                h->long_ref[ mmco[i].long_arg ]->long_ref=1;
-                h->long_ref_count++;
-            }
-
-            s->current_picture_ptr->reference |= s->picture_structure;
-            current_ref_assigned=1;
-            break;
-        case MMCO_SET_MAX_LONG:
-            assert(mmco[i].long_arg <= 16);
-            // just remove the long term which index is greater than new max
-            for(j = mmco[i].long_arg; j<16; j++){
-                remove_long(h, j, 0);
-            }
-            break;
-        case MMCO_RESET:
-            while(h->short_ref_count){
-                remove_short(h, h->short_ref[0]->frame_num, 0);
-            }
-            for(j = 0; j < 16; j++) {
-                remove_long(h, j, 0);
-            }
-            s->current_picture_ptr->poc=
-            s->current_picture_ptr->field_poc[0]=
-            s->current_picture_ptr->field_poc[1]=
-            h->poc_lsb=
-            h->poc_msb=
-            h->frame_num=
-            s->current_picture_ptr->frame_num= 0;
-            s->current_picture_ptr->mmco_reset=1;
-            break;
-        default: assert(0);
-        }
-    }
-
-    if (!current_ref_assigned) {
-        /* Second field of complementary field pair; the first field of
-         * which is already referenced. If short referenced, it
-         * should be first entry in short_ref. If not, it must exist
-         * in long_ref; trying to put it on the short list here is an
-         * error in the encoded bit stream (ref: 7.4.3.3, NOTE 2 and 3).
-         */
-        if (h->short_ref_count && h->short_ref[0] == s->current_picture_ptr) {
-            /* Just mark the second field valid */
-            s->current_picture_ptr->reference = PICT_FRAME;
-        } else if (s->current_picture_ptr->long_ref) {
-            av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term reference "
-                                             "assignment for second field "
-                                             "in complementary field pair "
-                                             "(first field is long term)\n");
-        } else {
-            pic= remove_short(h, s->current_picture_ptr->frame_num, 0);
-            if(pic){
-                av_log(h->s.avctx, AV_LOG_ERROR, "illegal short term buffer state detected\n");
-            }
-
-            if(h->short_ref_count)
-                memmove(&h->short_ref[1], &h->short_ref[0], h->short_ref_count*sizeof(Picture*));
-
-            h->short_ref[0]= s->current_picture_ptr;
-            h->short_ref_count++;
-            s->current_picture_ptr->reference |= s->picture_structure;
-        }
-    }
-
-    if (h->long_ref_count + h->short_ref_count > h->sps.ref_frame_count){
-
-        /* We have too many reference frames, probably due to corrupted
-         * stream. Need to discard one frame. Prevents overrun of the
-         * short_ref and long_ref buffers.
-         */
-        av_log(h->s.avctx, AV_LOG_ERROR,
-               "number of reference frames exceeds max (probably "
-               "corrupt input), discarding one\n");
-
-        if (h->long_ref_count && !h->short_ref_count) {
-            for (i = 0; i < 16; ++i)
-                if (h->long_ref[i])
-                    break;
-
-            assert(i < 16);
-            remove_long(h, i, 0);
-        } else {
-            pic = h->short_ref[h->short_ref_count - 1];
-            remove_short(h, pic->frame_num, 0);
-        }
-    }
-
-    print_short_term(h);
-    print_long_term(h);
-    return 0;
-}
-
-int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
-    MpegEncContext * const s = &h->s;
-    int i;
-
-    h->mmco_index= 0;
-    if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields
-        s->broken_link= get_bits1(gb) -1;
-        if(get_bits1(gb)){
-            h->mmco[0].opcode= MMCO_LONG;
-            h->mmco[0].long_arg= 0;
-            h->mmco_index= 1;
-        }
-    }else{
-        if(get_bits1(gb)){ // adaptive_ref_pic_marking_mode_flag
-            for(i= 0; i<MAX_MMCO_COUNT; i++) {
-                MMCOOpcode opcode= get_ue_golomb_31(gb);
-
-                h->mmco[i].opcode= opcode;
-                if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){
-                    h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1);
-/*                    if(h->mmco[i].short_pic_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_pic_num ] == NULL){
-                        av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco);
-                        return -1;
-                    }*/
-                }
-                if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
-                    unsigned int long_arg= get_ue_golomb_31(gb);
-                    if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
-                        av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode);
-                        return -1;
-                    }
-                    h->mmco[i].long_arg= long_arg;
-                }
-
-                if(opcode > (unsigned)MMCO_LONG){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode);
-                    return -1;
-                }
-                if(opcode == MMCO_END)
-                    break;
-            }
-            h->mmco_index= i;
-        }else{
-            assert(h->long_ref_count + h->short_ref_count <= h->sps.ref_frame_count);
-
-            if(h->short_ref_count && h->long_ref_count + h->short_ref_count == h->sps.ref_frame_count &&
-                    !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->reference)) {
-                h->mmco[0].opcode= MMCO_SHORT2UNUSED;
-                h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num;
-                h->mmco_index= 1;
-                if (FIELD_PICTURE) {
-                    h->mmco[0].short_pic_num *= 2;
-                    h->mmco[1].opcode= MMCO_SHORT2UNUSED;
-                    h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1;
-                    h->mmco_index= 2;
-                }
-            }
-        }
-    }
-
-    return 0;
-}
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
deleted file mode 100644
index 195ea28..0000000
--- a/libavcodec/h264_sei.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... sei decoding
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 sei decoding.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "internal.h"
-#include "avcodec.h"
-#include "h264.h"
-#include "golomb.h"
-
-//#undef NDEBUG
-#include <assert.h>
-
-static const uint8_t sei_num_clock_ts_table[9]={
-    1,  1,  1,  2,  2,  3,  3,  2,  3
-};
-
-void ff_h264_reset_sei(H264Context *h) {
-    h->sei_recovery_frame_cnt       = -1;
-    h->sei_dpb_output_delay         =  0;
-    h->sei_cpb_removal_delay        = -1;
-    h->sei_buffering_period_present =  0;
-}
-
-static int decode_picture_timing(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    if(h->sps.nal_hrd_parameters_present_flag || h->sps.vcl_hrd_parameters_present_flag){
-        h->sei_cpb_removal_delay = get_bits(&s->gb, h->sps.cpb_removal_delay_length);
-        h->sei_dpb_output_delay = get_bits(&s->gb, h->sps.dpb_output_delay_length);
-    }
-    if(h->sps.pic_struct_present_flag){
-        unsigned int i, num_clock_ts;
-        h->sei_pic_struct = get_bits(&s->gb, 4);
-        h->sei_ct_type    = 0;
-
-        if (h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING)
-            return -1;
-
-        num_clock_ts = sei_num_clock_ts_table[h->sei_pic_struct];
-
-        for (i = 0 ; i < num_clock_ts ; i++){
-            if(get_bits(&s->gb, 1)){                  /* clock_timestamp_flag */
-                unsigned int full_timestamp_flag;
-                h->sei_ct_type |= 1<<get_bits(&s->gb, 2);
-                skip_bits(&s->gb, 1);                 /* nuit_field_based_flag */
-                skip_bits(&s->gb, 5);                 /* counting_type */
-                full_timestamp_flag = get_bits(&s->gb, 1);
-                skip_bits(&s->gb, 1);                 /* discontinuity_flag */
-                skip_bits(&s->gb, 1);                 /* cnt_dropped_flag */
-                skip_bits(&s->gb, 8);                 /* n_frames */
-                if(full_timestamp_flag){
-                    skip_bits(&s->gb, 6);             /* seconds_value 0..59 */
-                    skip_bits(&s->gb, 6);             /* minutes_value 0..59 */
-                    skip_bits(&s->gb, 5);             /* hours_value 0..23 */
-                }else{
-                    if(get_bits(&s->gb, 1)){          /* seconds_flag */
-                        skip_bits(&s->gb, 6);         /* seconds_value range 0..59 */
-                        if(get_bits(&s->gb, 1)){      /* minutes_flag */
-                            skip_bits(&s->gb, 6);     /* minutes_value 0..59 */
-                            if(get_bits(&s->gb, 1))   /* hours_flag */
-                                skip_bits(&s->gb, 5); /* hours_value 0..23 */
-                        }
-                    }
-                }
-                if(h->sps.time_offset_length > 0)
-                    skip_bits(&s->gb, h->sps.time_offset_length); /* time_offset */
-            }
-        }
-
-        if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-            av_log(s->avctx, AV_LOG_DEBUG, "ct_type:%X pic_struct:%d\n", h->sei_ct_type, h->sei_pic_struct);
-    }
-    return 0;
-}
-
-static int decode_unregistered_user_data(H264Context *h, int size){
-    MpegEncContext * const s = &h->s;
-    uint8_t user_data[16+256];
-    int e, build, i;
-
-    if(size<16)
-        return -1;
-
-    for(i=0; i<sizeof(user_data)-1 && i<size; i++){
-        user_data[i]= get_bits(&s->gb, 8);
-    }
-
-    user_data[i]= 0;
-    e= sscanf(user_data+16, "x264 - core %d"/*%s - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html*/, &build);
-    if(e==1 && build>0)
-        h->x264_build= build;
-
-    if(s->avctx->debug & FF_DEBUG_BUGS)
-        av_log(s->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data+16);
-
-    for(; i<size; i++)
-        skip_bits(&s->gb, 8);
-
-    return 0;
-}
-
-static int decode_recovery_point(H264Context *h){
-    MpegEncContext * const s = &h->s;
-
-    h->sei_recovery_frame_cnt = get_ue_golomb(&s->gb);
-    skip_bits(&s->gb, 4);       /* 1b exact_match_flag, 1b broken_link_flag, 2b changing_slice_group_idc */
-
-    return 0;
-}
-
-static int decode_buffering_period(H264Context *h){
-    MpegEncContext * const s = &h->s;
-    unsigned int sps_id;
-    int sched_sel_idx;
-    SPS *sps;
-
-    sps_id = get_ue_golomb_31(&s->gb);
-    if(sps_id > 31 || !h->sps_buffers[sps_id]) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS %d referenced in buffering period\n", sps_id);
-        return -1;
-    }
-    sps = h->sps_buffers[sps_id];
-
-    // NOTE: This is really so duplicated in the standard... See H.264, D.1.1
-    if (sps->nal_hrd_parameters_present_flag) {
-        for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) {
-            h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length);
-            skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset
-        }
-    }
-    if (sps->vcl_hrd_parameters_present_flag) {
-        for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) {
-            h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length);
-            skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset
-        }
-    }
-
-    h->sei_buffering_period_present = 1;
-    return 0;
-}
-
-int ff_h264_decode_sei(H264Context *h){
-    MpegEncContext * const s = &h->s;
-
-    while(get_bits_count(&s->gb) + 16 < s->gb.size_in_bits){
-        int size, type;
-
-        type=0;
-        do{
-            type+= show_bits(&s->gb, 8);
-        }while(get_bits(&s->gb, 8) == 255);
-
-        size=0;
-        do{
-            size+= show_bits(&s->gb, 8);
-        }while(get_bits(&s->gb, 8) == 255);
-
-        switch(type){
-        case SEI_TYPE_PIC_TIMING: // Picture timing SEI
-            if(decode_picture_timing(h) < 0)
-                return -1;
-            break;
-        case SEI_TYPE_USER_DATA_UNREGISTERED:
-            if(decode_unregistered_user_data(h, size) < 0)
-                return -1;
-            break;
-        case SEI_TYPE_RECOVERY_POINT:
-            if(decode_recovery_point(h) < 0)
-                return -1;
-            break;
-        case SEI_BUFFERING_PERIOD:
-            if(decode_buffering_period(h) < 0)
-                return -1;
-            break;
-        default:
-            skip_bits(&s->gb, 8*size);
-        }
-
-        //FIXME check bits here
-        align_get_bits(&s->gb);
-    }
-
-    return 0;
-}
diff --git a/libavcodec/h264data.h b/libavcodec/h264data.h
deleted file mode 100644
index b3631da..0000000
--- a/libavcodec/h264data.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * H26L/H264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief
- *     H264 / AVC / MPEG4 part10 codec data table
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_H264DATA_H
-#define AVCODEC_H264DATA_H
-
-#include <stdint.h>
-#include "libavutil/rational.h"
-#include "mpegvideo.h"
-#include "h264.h"
-
-
-static const uint8_t golomb_to_pict_type[5]=
-{FF_P_TYPE, FF_B_TYPE, FF_I_TYPE, FF_SP_TYPE, FF_SI_TYPE};
-
-static const uint8_t golomb_to_intra4x4_cbp[48]={
- 47, 31, 15,  0, 23, 27, 29, 30,  7, 11, 13, 14, 39, 43, 45, 46,
- 16,  3,  5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44,  1,  2,  4,
-  8, 17, 18, 20, 24,  6,  9, 22, 25, 32, 33, 34, 36, 40, 38, 41
-};
-
-static const uint8_t golomb_to_inter_cbp[48]={
-  0, 16,  1,  2,  4,  8, 32,  3,  5, 10, 12, 15, 47,  7, 11, 13,
- 14,  6,  9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46,
- 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41
-};
-
-static const uint8_t zigzag_scan[16]={
- 0+0*4, 1+0*4, 0+1*4, 0+2*4,
- 1+1*4, 2+0*4, 3+0*4, 2+1*4,
- 1+2*4, 0+3*4, 1+3*4, 2+2*4,
- 3+1*4, 3+2*4, 2+3*4, 3+3*4,
-};
-
-static const uint8_t field_scan[16]={
- 0+0*4, 0+1*4, 1+0*4, 0+2*4,
- 0+3*4, 1+1*4, 1+2*4, 1+3*4,
- 2+0*4, 2+1*4, 2+2*4, 2+3*4,
- 3+0*4, 3+1*4, 3+2*4, 3+3*4,
-};
-
-static const uint8_t luma_dc_zigzag_scan[16]={
- 0*16 + 0*64, 1*16 + 0*64, 2*16 + 0*64, 0*16 + 2*64,
- 3*16 + 0*64, 0*16 + 1*64, 1*16 + 1*64, 2*16 + 1*64,
- 1*16 + 2*64, 2*16 + 2*64, 3*16 + 2*64, 0*16 + 3*64,
- 3*16 + 1*64, 1*16 + 3*64, 2*16 + 3*64, 3*16 + 3*64,
-};
-
-static const uint8_t luma_dc_field_scan[16]={
- 0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64,
- 2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64,
- 0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64,
- 1*16 + 1*64, 3*16 + 1*64, 1*16 + 3*64, 3*16 + 3*64,
-};
-
-static const uint8_t chroma_dc_scan[4]={
- (0+0*2)*16, (1+0*2)*16,
- (0+1*2)*16, (1+1*2)*16,  //FIXME
-};
-
-// zigzag_scan8x8_cavlc[i] = zigzag_scan8x8[(i/4) + 16*(i%4)]
-static const uint8_t zigzag_scan8x8_cavlc[64]={
- 0+0*8, 1+1*8, 1+2*8, 2+2*8,
- 4+1*8, 0+5*8, 3+3*8, 7+0*8,
- 3+4*8, 1+7*8, 5+3*8, 6+3*8,
- 2+7*8, 6+4*8, 5+6*8, 7+5*8,
- 1+0*8, 2+0*8, 0+3*8, 3+1*8,
- 3+2*8, 0+6*8, 4+2*8, 6+1*8,
- 2+5*8, 2+6*8, 6+2*8, 5+4*8,
- 3+7*8, 7+3*8, 4+7*8, 7+6*8,
- 0+1*8, 3+0*8, 0+4*8, 4+0*8,
- 2+3*8, 1+5*8, 5+1*8, 5+2*8,
- 1+6*8, 3+5*8, 7+1*8, 4+5*8,
- 4+6*8, 7+4*8, 5+7*8, 6+7*8,
- 0+2*8, 2+1*8, 1+3*8, 5+0*8,
- 1+4*8, 2+4*8, 6+0*8, 4+3*8,
- 0+7*8, 4+4*8, 7+2*8, 3+6*8,
- 5+5*8, 6+5*8, 6+6*8, 7+7*8,
-};
-
-static const uint8_t field_scan8x8[64]={
- 0+0*8, 0+1*8, 0+2*8, 1+0*8,
- 1+1*8, 0+3*8, 0+4*8, 1+2*8,
- 2+0*8, 1+3*8, 0+5*8, 0+6*8,
- 0+7*8, 1+4*8, 2+1*8, 3+0*8,
- 2+2*8, 1+5*8, 1+6*8, 1+7*8,
- 2+3*8, 3+1*8, 4+0*8, 3+2*8,
- 2+4*8, 2+5*8, 2+6*8, 2+7*8,
- 3+3*8, 4+1*8, 5+0*8, 4+2*8,
- 3+4*8, 3+5*8, 3+6*8, 3+7*8,
- 4+3*8, 5+1*8, 6+0*8, 5+2*8,
- 4+4*8, 4+5*8, 4+6*8, 4+7*8,
- 5+3*8, 6+1*8, 6+2*8, 5+4*8,
- 5+5*8, 5+6*8, 5+7*8, 6+3*8,
- 7+0*8, 7+1*8, 6+4*8, 6+5*8,
- 6+6*8, 6+7*8, 7+2*8, 7+3*8,
- 7+4*8, 7+5*8, 7+6*8, 7+7*8,
-};
-
-static const uint8_t field_scan8x8_cavlc[64]={
- 0+0*8, 1+1*8, 2+0*8, 0+7*8,
- 2+2*8, 2+3*8, 2+4*8, 3+3*8,
- 3+4*8, 4+3*8, 4+4*8, 5+3*8,
- 5+5*8, 7+0*8, 6+6*8, 7+4*8,
- 0+1*8, 0+3*8, 1+3*8, 1+4*8,
- 1+5*8, 3+1*8, 2+5*8, 4+1*8,
- 3+5*8, 5+1*8, 4+5*8, 6+1*8,
- 5+6*8, 7+1*8, 6+7*8, 7+5*8,
- 0+2*8, 0+4*8, 0+5*8, 2+1*8,
- 1+6*8, 4+0*8, 2+6*8, 5+0*8,
- 3+6*8, 6+0*8, 4+6*8, 6+2*8,
- 5+7*8, 6+4*8, 7+2*8, 7+6*8,
- 1+0*8, 1+2*8, 0+6*8, 3+0*8,
- 1+7*8, 3+2*8, 2+7*8, 4+2*8,
- 3+7*8, 5+2*8, 4+7*8, 5+4*8,
- 6+3*8, 6+5*8, 7+3*8, 7+7*8,
-};
-
-typedef struct IMbInfo{
-    uint16_t type;
-    uint8_t pred_mode;
-    uint8_t cbp;
-} IMbInfo;
-
-static const IMbInfo i_mb_type_info[26]={
-{MB_TYPE_INTRA4x4  , -1, -1},
-{MB_TYPE_INTRA16x16,  2,  0},
-{MB_TYPE_INTRA16x16,  1,  0},
-{MB_TYPE_INTRA16x16,  0,  0},
-{MB_TYPE_INTRA16x16,  3,  0},
-{MB_TYPE_INTRA16x16,  2,  16},
-{MB_TYPE_INTRA16x16,  1,  16},
-{MB_TYPE_INTRA16x16,  0,  16},
-{MB_TYPE_INTRA16x16,  3,  16},
-{MB_TYPE_INTRA16x16,  2,  32},
-{MB_TYPE_INTRA16x16,  1,  32},
-{MB_TYPE_INTRA16x16,  0,  32},
-{MB_TYPE_INTRA16x16,  3,  32},
-{MB_TYPE_INTRA16x16,  2,  15+0},
-{MB_TYPE_INTRA16x16,  1,  15+0},
-{MB_TYPE_INTRA16x16,  0,  15+0},
-{MB_TYPE_INTRA16x16,  3,  15+0},
-{MB_TYPE_INTRA16x16,  2,  15+16},
-{MB_TYPE_INTRA16x16,  1,  15+16},
-{MB_TYPE_INTRA16x16,  0,  15+16},
-{MB_TYPE_INTRA16x16,  3,  15+16},
-{MB_TYPE_INTRA16x16,  2,  15+32},
-{MB_TYPE_INTRA16x16,  1,  15+32},
-{MB_TYPE_INTRA16x16,  0,  15+32},
-{MB_TYPE_INTRA16x16,  3,  15+32},
-{MB_TYPE_INTRA_PCM , -1, -1},
-};
-
-typedef struct PMbInfo{
-    uint16_t type;
-    uint8_t partition_count;
-} PMbInfo;
-
-static const PMbInfo p_mb_type_info[5]={
-{MB_TYPE_16x16|MB_TYPE_P0L0             , 1},
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2},
-{MB_TYPE_8x8  |MB_TYPE_P0L0|MB_TYPE_P1L0, 4},
-{MB_TYPE_8x8  |MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_REF0, 4},
-};
-
-static const PMbInfo p_sub_mb_type_info[4]={
-{MB_TYPE_16x16|MB_TYPE_P0L0             , 1},
-{MB_TYPE_16x8 |MB_TYPE_P0L0             , 2},
-{MB_TYPE_8x16 |MB_TYPE_P0L0             , 2},
-{MB_TYPE_8x8  |MB_TYPE_P0L0             , 4},
-};
-
-static const PMbInfo b_mb_type_info[23]={
-{MB_TYPE_DIRECT2|MB_TYPE_L0L1                                      , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0                                       , 1, },
-{MB_TYPE_16x16             |MB_TYPE_P0L1                          , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1                          , 1, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0             |MB_TYPE_P1L0             , 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0             |MB_TYPE_P1L0             , 2, },
-{MB_TYPE_16x8              |MB_TYPE_P0L1             |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16              |MB_TYPE_P0L1             |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0                          |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0                          |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8              |MB_TYPE_P0L1|MB_TYPE_P1L0             , 2, },
-{MB_TYPE_8x16              |MB_TYPE_P0L1|MB_TYPE_P1L0             , 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0             |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0             |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8              |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16              |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0             , 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0             , 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1             |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1             |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x8  |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, },
-};
-
-static const PMbInfo b_sub_mb_type_info[13]={
-{MB_TYPE_DIRECT2                                                   , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0                                       , 1, },
-{MB_TYPE_16x16             |MB_TYPE_P0L1                          , 1, },
-{MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1                          , 1, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0             |MB_TYPE_P1L0             , 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0             |MB_TYPE_P1L0             , 2, },
-{MB_TYPE_16x8              |MB_TYPE_P0L1             |MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16              |MB_TYPE_P0L1             |MB_TYPE_P1L1, 2, },
-{MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, },
-{MB_TYPE_8x8  |MB_TYPE_P0L0             |MB_TYPE_P1L0             , 4, },
-{MB_TYPE_8x8               |MB_TYPE_P0L1             |MB_TYPE_P1L1, 4, },
-{MB_TYPE_8x8  |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, },
-};
-
-static const uint8_t dequant4_coeff_init[6][3]={
-  {10,13,16},
-  {11,14,18},
-  {13,16,20},
-  {14,18,23},
-  {16,20,25},
-  {18,23,29},
-};
-
-static const uint8_t dequant8_coeff_init_scan[16] = {
-  0,3,4,3, 3,1,5,1, 4,5,2,5, 3,1,5,1
-};
-static const uint8_t dequant8_coeff_init[6][6]={
-  {20,18,32,19,25,24},
-  {22,19,35,21,28,26},
-  {26,23,42,24,33,31},
-  {28,25,45,26,35,33},
-  {32,28,51,30,40,38},
-  {36,32,58,34,46,43},
-};
-
-#endif /* AVCODEC_H264DATA_H */
diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c
deleted file mode 100644
index c01fc77..0000000
--- a/libavcodec/h264dsp.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 DSP functions.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include <stdint.h>
-#include "avcodec.h"
-#include "h264dsp.h"
-
-#define op_scale1(x)  block[x] = av_clip_uint8( (block[x]*weight + offset) >> log2_denom )
-#define op_scale2(x)  dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1))
-#define H264_WEIGHT(W,H) \
-static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \
-    int y; \
-    offset <<= log2_denom; \
-    if(log2_denom) offset += 1<<(log2_denom-1); \
-    for(y=0; y<H; y++, block += stride){ \
-        op_scale1(0); \
-        op_scale1(1); \
-        if(W==2) continue; \
-        op_scale1(2); \
-        op_scale1(3); \
-        if(W==4) continue; \
-        op_scale1(4); \
-        op_scale1(5); \
-        op_scale1(6); \
-        op_scale1(7); \
-        if(W==8) continue; \
-        op_scale1(8); \
-        op_scale1(9); \
-        op_scale1(10); \
-        op_scale1(11); \
-        op_scale1(12); \
-        op_scale1(13); \
-        op_scale1(14); \
-        op_scale1(15); \
-    } \
-} \
-static void biweight_h264_pixels ## W ## x ## H ## _c(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset){ \
-    int y; \
-    offset = ((offset + 1) | 1) << log2_denom; \
-    for(y=0; y<H; y++, dst += stride, src += stride){ \
-        op_scale2(0); \
-        op_scale2(1); \
-        if(W==2) continue; \
-        op_scale2(2); \
-        op_scale2(3); \
-        if(W==4) continue; \
-        op_scale2(4); \
-        op_scale2(5); \
-        op_scale2(6); \
-        op_scale2(7); \
-        if(W==8) continue; \
-        op_scale2(8); \
-        op_scale2(9); \
-        op_scale2(10); \
-        op_scale2(11); \
-        op_scale2(12); \
-        op_scale2(13); \
-        op_scale2(14); \
-        op_scale2(15); \
-    } \
-}
-
-H264_WEIGHT(16,16)
-H264_WEIGHT(16,8)
-H264_WEIGHT(8,16)
-H264_WEIGHT(8,8)
-H264_WEIGHT(8,4)
-H264_WEIGHT(4,8)
-H264_WEIGHT(4,4)
-H264_WEIGHT(4,2)
-H264_WEIGHT(2,4)
-H264_WEIGHT(2,2)
-
-#undef op_scale1
-#undef op_scale2
-#undef H264_WEIGHT
-
-static av_always_inline av_flatten void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0)
-{
-    int i, d;
-    for( i = 0; i < 4; i++ ) {
-        if( tc0[i] < 0 ) {
-            pix += 4*ystride;
-            continue;
-        }
-        for( d = 0; d < 4; d++ ) {
-            const int p0 = pix[-1*xstride];
-            const int p1 = pix[-2*xstride];
-            const int p2 = pix[-3*xstride];
-            const int q0 = pix[0];
-            const int q1 = pix[1*xstride];
-            const int q2 = pix[2*xstride];
-
-            if( FFABS( p0 - q0 ) < alpha &&
-                FFABS( p1 - p0 ) < beta &&
-                FFABS( q1 - q0 ) < beta ) {
-
-                int tc = tc0[i];
-                int i_delta;
-
-                if( FFABS( p2 - p0 ) < beta ) {
-                    if(tc0[i])
-                    pix[-2*xstride] = p1 + av_clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] );
-                    tc++;
-                }
-                if( FFABS( q2 - q0 ) < beta ) {
-                    if(tc0[i])
-                    pix[   xstride] = q1 + av_clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] );
-                    tc++;
-                }
-
-                i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
-                pix[-xstride] = av_clip_uint8( p0 + i_delta );    /* p0' */
-                pix[0]        = av_clip_uint8( q0 - i_delta );    /* q0' */
-            }
-            pix += ystride;
-        }
-    }
-}
-static void h264_v_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    h264_loop_filter_luma_c(pix, stride, 1, alpha, beta, tc0);
-}
-static void h264_h_loop_filter_luma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    h264_loop_filter_luma_c(pix, 1, stride, alpha, beta, tc0);
-}
-
-static av_always_inline av_flatten void h264_loop_filter_luma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta)
-{
-    int d;
-    for( d = 0; d < 16; d++ ) {
-        const int p2 = pix[-3*xstride];
-        const int p1 = pix[-2*xstride];
-        const int p0 = pix[-1*xstride];
-
-        const int q0 = pix[ 0*xstride];
-        const int q1 = pix[ 1*xstride];
-        const int q2 = pix[ 2*xstride];
-
-        if( FFABS( p0 - q0 ) < alpha &&
-            FFABS( p1 - p0 ) < beta &&
-            FFABS( q1 - q0 ) < beta ) {
-
-            if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
-                if( FFABS( p2 - p0 ) < beta)
-                {
-                    const int p3 = pix[-4*xstride];
-                    /* p0', p1', p2' */
-                    pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
-                    pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
-                    pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3;
-                } else {
-                    /* p0' */
-                    pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
-                }
-                if( FFABS( q2 - q0 ) < beta)
-                {
-                    const int q3 = pix[3*xstride];
-                    /* q0', q1', q2' */
-                    pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
-                    pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
-                    pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3;
-                } else {
-                    /* q0' */
-                    pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
-                }
-            }else{
-                /* p0', q0' */
-                pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
-                pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
-            }
-        }
-        pix += ystride;
-    }
-}
-static void h264_v_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta)
-{
-    h264_loop_filter_luma_intra_c(pix, stride, 1, alpha, beta);
-}
-static void h264_h_loop_filter_luma_intra_c(uint8_t *pix, int stride, int alpha, int beta)
-{
-    h264_loop_filter_luma_intra_c(pix, 1, stride, alpha, beta);
-}
-
-static av_always_inline av_flatten void h264_loop_filter_chroma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0)
-{
-    int i, d;
-    for( i = 0; i < 4; i++ ) {
-        const int tc = tc0[i];
-        if( tc <= 0 ) {
-            pix += 2*ystride;
-            continue;
-        }
-        for( d = 0; d < 2; d++ ) {
-            const int p0 = pix[-1*xstride];
-            const int p1 = pix[-2*xstride];
-            const int q0 = pix[0];
-            const int q1 = pix[1*xstride];
-
-            if( FFABS( p0 - q0 ) < alpha &&
-                FFABS( p1 - p0 ) < beta &&
-                FFABS( q1 - q0 ) < beta ) {
-
-                int delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
-
-                pix[-xstride] = av_clip_uint8( p0 + delta );    /* p0' */
-                pix[0]        = av_clip_uint8( q0 - delta );    /* q0' */
-            }
-            pix += ystride;
-        }
-    }
-}
-static void h264_v_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    h264_loop_filter_chroma_c(pix, stride, 1, alpha, beta, tc0);
-}
-static void h264_h_loop_filter_chroma_c(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    h264_loop_filter_chroma_c(pix, 1, stride, alpha, beta, tc0);
-}
-
-static av_always_inline av_flatten void h264_loop_filter_chroma_intra_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta)
-{
-    int d;
-    for( d = 0; d < 8; d++ ) {
-        const int p0 = pix[-1*xstride];
-        const int p1 = pix[-2*xstride];
-        const int q0 = pix[0];
-        const int q1 = pix[1*xstride];
-
-        if( FFABS( p0 - q0 ) < alpha &&
-            FFABS( p1 - p0 ) < beta &&
-            FFABS( q1 - q0 ) < beta ) {
-
-            pix[-xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2;   /* p0' */
-            pix[0]        = ( 2*q1 + q0 + p1 + 2 ) >> 2;   /* q0' */
-        }
-        pix += ystride;
-    }
-}
-static void h264_v_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta)
-{
-    h264_loop_filter_chroma_intra_c(pix, stride, 1, alpha, beta);
-}
-static void h264_h_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta)
-{
-    h264_loop_filter_chroma_intra_c(pix, 1, stride, alpha, beta);
-}
-
-void ff_h264dsp_init(H264DSPContext *c)
-{
-    c->h264_idct_add= ff_h264_idct_add_c;
-    c->h264_idct8_add= ff_h264_idct8_add_c;
-    c->h264_idct_dc_add= ff_h264_idct_dc_add_c;
-    c->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;
-    c->h264_idct_add16     = ff_h264_idct_add16_c;
-    c->h264_idct8_add4     = ff_h264_idct8_add4_c;
-    c->h264_idct_add8      = ff_h264_idct_add8_c;
-    c->h264_idct_add16intra= ff_h264_idct_add16intra_c;
-
-    c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
-    c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
-    c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;
-    c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;
-    c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;
-    c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;
-    c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;
-    c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;
-    c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;
-    c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;
-    c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;
-    c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;
-    c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;
-    c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;
-    c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;
-    c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;
-    c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;
-    c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;
-    c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
-    c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
-
-    c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
-    c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
-    c->h264_v_loop_filter_luma_intra= h264_v_loop_filter_luma_intra_c;
-    c->h264_h_loop_filter_luma_intra= h264_h_loop_filter_luma_intra_c;
-    c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;
-    c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;
-    c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;
-    c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;
-    c->h264_loop_filter_strength= NULL;
-
-    if (ARCH_ARM) ff_h264dsp_init_arm(c);
-    if (HAVE_ALTIVEC) ff_h264dsp_init_ppc(c);
-    if (HAVE_MMX) ff_h264dsp_init_x86(c);
-}
diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
deleted file mode 100644
index 3d32a9c..0000000
--- a/libavcodec/h264dsp.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2003-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 DSP functions.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_H264DSP_H
-#define AVCODEC_H264DSP_H
-
-#include <stdint.h>
-#include "dsputil.h"
-
-//typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
-typedef void (*h264_weight_func)(uint8_t *block, int stride, int log2_denom, int weight, int offset);
-typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset);
-
-/**
- * Context for storing H.264 DSP functions
- */
-typedef struct H264DSPContext{
-    /* weighted MC */
-    h264_weight_func weight_h264_pixels_tab[10];
-    h264_biweight_func biweight_h264_pixels_tab[10];
-
-    /* loop filter */
-    void (*h264_v_loop_filter_luma)(uint8_t *pix/*align 16*/, int stride, int alpha, int beta, int8_t *tc0);
-    void (*h264_h_loop_filter_luma)(uint8_t *pix/*align 4 */, int stride, int alpha, int beta, int8_t *tc0);
-    /* v/h_loop_filter_luma_intra: align 16 */
-    void (*h264_v_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta);
-    void (*h264_h_loop_filter_luma_intra)(uint8_t *pix, int stride, int alpha, int beta);
-    void (*h264_v_loop_filter_chroma)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta, int8_t *tc0);
-    void (*h264_h_loop_filter_chroma)(uint8_t *pix/*align 4*/, int stride, int alpha, int beta, int8_t *tc0);
-    void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
-    void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix/*align 8*/, int stride, int alpha, int beta);
-    // h264_loop_filter_strength: simd only. the C version is inlined in h264.c
-    void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2],
-                                      int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field);
-
-    /* IDCT */
-    /* NOTE!!! if you implement any of h264_idct8_add, h264_idct8_add4 then you must implement all of them
-       NOTE!!! if you implement any of h264_idct_add, h264_idct_add16, h264_idct_add16intra, h264_idct_add8 then you must implement all of them
-        The reason for above, is that no 2 out of one list may use a different permutation.
-    */
-    void (*h264_idct_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride);
-    void (*h264_idct8_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride);
-    void (*h264_idct_dc_add)(uint8_t *dst/*align 4*/, DCTELEM *block/*align 16*/, int stride);
-    void (*h264_idct8_dc_add)(uint8_t *dst/*align 8*/, DCTELEM *block/*align 16*/, int stride);
-    void (*h264_dct)(DCTELEM block[4][4]);
-    void (*h264_idct_add16)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
-    void (*h264_idct8_add4)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
-    void (*h264_idct_add8)(uint8_t **dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
-    void (*h264_idct_add16intra)(uint8_t *dst/*align 16*/, const int *blockoffset, DCTELEM *block/*align 16*/, int stride, const uint8_t nnzc[6*8]);
-}H264DSPContext;
-
-void ff_h264dsp_init(H264DSPContext *c);
-void ff_h264dsp_init_arm(H264DSPContext *c);
-void ff_h264dsp_init_ppc(H264DSPContext *c);
-void ff_h264dsp_init_x86(H264DSPContext *c);
-
-#endif /* AVCODEC_H264DSP_H */
diff --git a/libavcodec/h264dspenc.c b/libavcodec/h264dspenc.c
deleted file mode 100644
index b65a2cc..0000000
--- a/libavcodec/h264dspenc.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * H.264/MPEG-4 Part 10 (Base profile) encoder.
- *
- * DSP functions
- *
- * Copyright (c) 2006 Expertisecentrum Digitale Media, UHasselt
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 encoder related DSP utils
- *
- */
-
-#include "dsputil.h"
-
-#define  H264_DCT_PART1(X) \
-         a = block[0][X]+block[3][X]; \
-         c = block[0][X]-block[3][X]; \
-         b = block[1][X]+block[2][X]; \
-         d = block[1][X]-block[2][X]; \
-         pieces[0][X] = a+b; \
-         pieces[2][X] = a-b; \
-         pieces[1][X] = (c<<1)+d; \
-         pieces[3][X] = c-(d<<1);
-
-#define  H264_DCT_PART2(X) \
-         a = pieces[X][0]+pieces[X][3]; \
-         c = pieces[X][0]-pieces[X][3]; \
-         b = pieces[X][1]+pieces[X][2]; \
-         d = pieces[X][1]-pieces[X][2]; \
-         block[0][X] = a+b; \
-         block[2][X] = a-b; \
-         block[1][X] = (c<<1)+d; \
-         block[3][X] = c-(d<<1);
-
-/**
- * Transform the provided matrix using the H.264 modified DCT.
- * @note
- * we'll always work with transposed input blocks, to avoid having to make a
- * distinction between C and mmx implementations.
- *
- * @param block transposed input block
- */
-static void h264_dct_c(DCTELEM block[4][4])
-{
-    DCTELEM pieces[4][4];
-    DCTELEM a, b, c, d;
-
-    H264_DCT_PART1(0);
-    H264_DCT_PART1(1);
-    H264_DCT_PART1(2);
-    H264_DCT_PART1(3);
-    H264_DCT_PART2(0);
-    H264_DCT_PART2(1);
-    H264_DCT_PART2(2);
-    H264_DCT_PART2(3);
-}
-
-av_cold void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx)
-{
-    c->h264_dct = h264_dct_c;
-}
-
diff --git a/libavcodec/h264enc.c b/libavcodec/h264enc.c
deleted file mode 100644
index ad874f3..0000000
--- a/libavcodec/h264enc.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * H.264 encoder
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "libavutil/common.h"
-#include "get_bits.h"
-#include "mpegvideo.h"
-#include "h264data.h"
-
-/**
- * Write out the provided data into a NAL unit.
- * @param nal_ref_idc NAL reference IDC
- * @param nal_unit_type NAL unit payload type
- * @param dest the target buffer, dst+1 == src is allowed as a special case
- * @param destsize the length of the dst array
- * @param b2 the data which should be escaped
- * @return pointer to current position in the output buffer or NULL if an error occurred
- */
-static uint8_t *h264_write_nal_unit(int nal_ref_idc, int nal_unit_type, uint8_t *dest, int *destsize,
-                          PutBitContext *b2)
-{
-    PutBitContext b;
-    int i, destpos, rbsplen, escape_count;
-    uint8_t *rbsp;
-
-    if (nal_unit_type != NAL_END_STREAM)
-        put_bits(b2,1,1); // rbsp_stop_bit
-
-    // Align b2 on a byte boundary
-    align_put_bits(b2);
-    rbsplen = put_bits_count(b2)/8;
-    flush_put_bits(b2);
-    rbsp = b2->buf;
-
-    init_put_bits(&b,dest,*destsize);
-
-    put_bits(&b,16,0);
-    put_bits(&b,16,0x01);
-
-    put_bits(&b,1,0); // forbidden zero bit
-    put_bits(&b,2,nal_ref_idc); // nal_ref_idc
-    put_bits(&b,5,nal_unit_type); // nal_unit_type
-
-    flush_put_bits(&b);
-
-    destpos = 5;
-    escape_count= 0;
-
-    for (i=0; i<rbsplen; i+=2)
-    {
-        if (rbsp[i]) continue;
-        if (i>0 && rbsp[i-1]==0)
-            i--;
-        if (i+2<rbsplen && rbsp[i+1]==0 && rbsp[i+2]<=3)
-        {
-            escape_count++;
-            i+=2;
-        }
-    }
-
-    if(escape_count==0)
-    {
-        if(dest+destpos != rbsp)
-        {
-            memcpy(dest+destpos, rbsp, rbsplen);
-            *destsize -= (rbsplen+destpos);
-        }
-        return dest+rbsplen+destpos;
-    }
-
-    if(rbsplen + escape_count + 1> *destsize)
-    {
-        av_log(NULL, AV_LOG_ERROR, "Destination buffer too small!\n");
-        return NULL;
-    }
-
-    // this should be damn rare (hopefully)
-    for (i = 0 ; i < rbsplen ; i++)
-    {
-        if (i + 2 < rbsplen && (rbsp[i] == 0 && rbsp[i+1] == 0 && rbsp[i+2] < 4))
-        {
-            dest[destpos++] = rbsp[i++];
-            dest[destpos++] = rbsp[i];
-            dest[destpos++] = 0x03; // emulation prevention byte
-        }
-        else
-            dest[destpos++] = rbsp[i];
-    }
-    *destsize -= destpos;
-    return dest+destpos;
-}
-
-static const uint8_t pict_type_to_golomb[7] = {-1, 2, 0, 1, -1, 4, 3};
-
-static const uint8_t intra4x4_cbp_to_golomb[48] = {
-    3, 29, 30, 17, 31, 18, 37,  8, 32, 38, 19,  9, 20, 10, 11,  2,
-   16, 33, 34, 21, 35, 22, 39,  4, 36, 40, 23,  5, 24,  6,  7,  1,
-   41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15,  0
-};
-
-static const uint8_t inter_cbp_to_golomb[48] = {
-    0,  2,  3,  7,  4,  8, 17, 13,  5, 18,  9, 14, 10, 15, 16, 11,
-    1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19,
-    6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12
-};
-
-#define QUANT_SHIFT 22
-
-static const int quant_coeff[52][16] = {
-    { 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772, 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772,},
-    { 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131, 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131,},
-    { 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218, 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218,},
-    { 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711, 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711,},
-    { 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374, 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374,},
-    { 233017, 145889, 233017, 145889, 145889,  92564, 145889,  92564, 233017, 145889, 233017, 145889, 145889,  92564, 145889,  92564,},
-    { 209715, 129056, 209715, 129056, 129056,  83886, 129056,  83886, 209715, 129056, 209715, 129056, 129056,  83886, 129056,  83886,},
-    { 190650, 119837, 190650, 119837, 119837,  74565, 119837,  74565, 190650, 119837, 190650, 119837, 119837,  74565, 119837,  74565,},
-    { 161319, 104858, 161319, 104858, 104858,  67109, 104858,  67109, 161319, 104858, 161319, 104858, 104858,  67109, 104858,  67109,},
-    { 149797,  93207, 149797,  93207,  93207,  58356,  93207,  58356, 149797,  93207, 149797,  93207,  93207,  58356,  93207,  58356,},
-    { 131072,  83886, 131072,  83886,  83886,  53687,  83886,  53687, 131072,  83886, 131072,  83886,  83886,  53687,  83886,  53687,},
-    { 116508,  72944, 116508,  72944,  72944,  46282,  72944,  46282, 116508,  72944, 116508,  72944,  72944,  46282,  72944,  46282,},
-    { 104858,  64528, 104858,  64528,  64528,  41943,  64528,  41943, 104858,  64528, 104858,  64528,  64528,  41943,  64528,  41943,},
-    {  95325,  59919,  95325,  59919,  59919,  37283,  59919,  37283,  95325,  59919,  95325,  59919,  59919,  37283,  59919,  37283,},
-    {  80660,  52429,  80660,  52429,  52429,  33554,  52429,  33554,  80660,  52429,  80660,  52429,  52429,  33554,  52429,  33554,},
-    {  74898,  46603,  74898,  46603,  46603,  29178,  46603,  29178,  74898,  46603,  74898,  46603,  46603,  29178,  46603,  29178,},
-    {  65536,  41943,  65536,  41943,  41943,  26844,  41943,  26844,  65536,  41943,  65536,  41943,  41943,  26844,  41943,  26844,},
-    {  58254,  36472,  58254,  36472,  36472,  23141,  36472,  23141,  58254,  36472,  58254,  36472,  36472,  23141,  36472,  23141,},
-    {  52429,  32264,  52429,  32264,  32264,  20972,  32264,  20972,  52429,  32264,  52429,  32264,  32264,  20972,  32264,  20972,},
-    {  47663,  29959,  47663,  29959,  29959,  18641,  29959,  18641,  47663,  29959,  47663,  29959,  29959,  18641,  29959,  18641,},
-    {  40330,  26214,  40330,  26214,  26214,  16777,  26214,  16777,  40330,  26214,  40330,  26214,  26214,  16777,  26214,  16777,},
-    {  37449,  23302,  37449,  23302,  23302,  14589,  23302,  14589,  37449,  23302,  37449,  23302,  23302,  14589,  23302,  14589,},
-    {  32768,  20972,  32768,  20972,  20972,  13422,  20972,  13422,  32768,  20972,  32768,  20972,  20972,  13422,  20972,  13422,},
-    {  29127,  18236,  29127,  18236,  18236,  11570,  18236,  11570,  29127,  18236,  29127,  18236,  18236,  11570,  18236,  11570,},
-    {  26214,  16132,  26214,  16132,  16132,  10486,  16132,  10486,  26214,  16132,  26214,  16132,  16132,  10486,  16132,  10486,},
-    {  23831,  14980,  23831,  14980,  14980,   9321,  14980,   9321,  23831,  14980,  23831,  14980,  14980,   9321,  14980,   9321,},
-    {  20165,  13107,  20165,  13107,  13107,   8389,  13107,   8389,  20165,  13107,  20165,  13107,  13107,   8389,  13107,   8389,},
-    {  18725,  11651,  18725,  11651,  11651,   7294,  11651,   7294,  18725,  11651,  18725,  11651,  11651,   7294,  11651,   7294,},
-    {  16384,  10486,  16384,  10486,  10486,   6711,  10486,   6711,  16384,  10486,  16384,  10486,  10486,   6711,  10486,   6711,},
-    {  14564,   9118,  14564,   9118,   9118,   5785,   9118,   5785,  14564,   9118,  14564,   9118,   9118,   5785,   9118,   5785,},
-    {  13107,   8066,  13107,   8066,   8066,   5243,   8066,   5243,  13107,   8066,  13107,   8066,   8066,   5243,   8066,   5243,},
-    {  11916,   7490,  11916,   7490,   7490,   4660,   7490,   4660,  11916,   7490,  11916,   7490,   7490,   4660,   7490,   4660,},
-    {  10082,   6554,  10082,   6554,   6554,   4194,   6554,   4194,  10082,   6554,  10082,   6554,   6554,   4194,   6554,   4194,},
-    {   9362,   5825,   9362,   5825,   5825,   3647,   5825,   3647,   9362,   5825,   9362,   5825,   5825,   3647,   5825,   3647,},
-    {   8192,   5243,   8192,   5243,   5243,   3355,   5243,   3355,   8192,   5243,   8192,   5243,   5243,   3355,   5243,   3355,},
-    {   7282,   4559,   7282,   4559,   4559,   2893,   4559,   2893,   7282,   4559,   7282,   4559,   4559,   2893,   4559,   2893,},
-    {   6554,   4033,   6554,   4033,   4033,   2621,   4033,   2621,   6554,   4033,   6554,   4033,   4033,   2621,   4033,   2621,},
-    {   5958,   3745,   5958,   3745,   3745,   2330,   3745,   2330,   5958,   3745,   5958,   3745,   3745,   2330,   3745,   2330,},
-    {   5041,   3277,   5041,   3277,   3277,   2097,   3277,   2097,   5041,   3277,   5041,   3277,   3277,   2097,   3277,   2097,},
-    {   4681,   2913,   4681,   2913,   2913,   1824,   2913,   1824,   4681,   2913,   4681,   2913,   2913,   1824,   2913,   1824,},
-    {   4096,   2621,   4096,   2621,   2621,   1678,   2621,   1678,   4096,   2621,   4096,   2621,   2621,   1678,   2621,   1678,},
-    {   3641,   2280,   3641,   2280,   2280,   1446,   2280,   1446,   3641,   2280,   3641,   2280,   2280,   1446,   2280,   1446,},
-    {   3277,   2016,   3277,   2016,   2016,   1311,   2016,   1311,   3277,   2016,   3277,   2016,   2016,   1311,   2016,   1311,},
-    {   2979,   1872,   2979,   1872,   1872,   1165,   1872,   1165,   2979,   1872,   2979,   1872,   1872,   1165,   1872,   1165,},
-    {   2521,   1638,   2521,   1638,   1638,   1049,   1638,   1049,   2521,   1638,   2521,   1638,   1638,   1049,   1638,   1049,},
-    {   2341,   1456,   2341,   1456,   1456,    912,   1456,    912,   2341,   1456,   2341,   1456,   1456,    912,   1456,    912,},
-    {   2048,   1311,   2048,   1311,   1311,    839,   1311,    839,   2048,   1311,   2048,   1311,   1311,    839,   1311,    839,},
-    {   1820,   1140,   1820,   1140,   1140,    723,   1140,    723,   1820,   1140,   1820,   1140,   1140,    723,   1140,    723,},
-    {   1638,   1008,   1638,   1008,   1008,    655,   1008,    655,   1638,   1008,   1638,   1008,   1008,    655,   1008,    655,},
-    {   1489,    936,   1489,    936,    936,    583,    936,    583,   1489,    936,   1489,    936,    936,    583,    936,    583,},
-    {   1260,    819,   1260,    819,    819,    524,    819,    524,   1260,    819,   1260,    819,    819,    524,    819,    524,},
-    {   1170,    728,   1170,    728,    728,    456,    728,    456,   1170,    728,   1170,    728,    728,    456,    728,    456,},
-};
-
-//FIXME need to check that this does not overflow signed 32 bit for low qp, I am not sure, it's very close
-//FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away)
-static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale,
-                             int intra, int separate_dc)
-{
-    int i;
-    const int * const quant_table = quant_coeff[qscale];
-    const int bias = intra ? (1 << QUANT_SHIFT) / 3 : (1 << QUANT_SHIFT) / 6;
-    const unsigned int threshold1 = (1 << QUANT_SHIFT) - bias - 1;
-    const unsigned int threshold2 = (threshold1 << 1);
-    int last_non_zero;
-
-    if (separate_dc) {
-        if (qscale <= 18) {
-            //avoid overflows
-            const int dc_bias = intra ? (1 << (QUANT_SHIFT - 2)) / 3 : (1 << (QUANT_SHIFT - 2)) / 6;
-            const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT - 2)) - dc_bias - 1;
-            const unsigned int dc_threshold2 = (dc_threshold1 << 1);
-
-            int level = block[0]*quant_coeff[qscale+18][0];
-            if (((unsigned)(level + dc_threshold1)) > dc_threshold2) {
-                if (level > 0) {
-                    level = (dc_bias + level) >> (QUANT_SHIFT - 2);
-                    block[0] = level;
-                } else {
-                    level = (dc_bias - level) >> (QUANT_SHIFT - 2);
-                    block[0] = -level;
-                }
-//                last_non_zero = i;
-            } else {
-                block[0] = 0;
-            }
-        } else {
-            const int dc_bias = intra ? (1 << (QUANT_SHIFT + 1)) / 3 : (1 << (QUANT_SHIFT + 1)) / 6;
-            const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT + 1)) - dc_bias - 1;
-            const unsigned int dc_threshold2 = (dc_threshold1 << 1);
-
-            int level = block[0]*quant_table[0];
-            if (((unsigned)(level + dc_threshold1)) > dc_threshold2) {
-                if (level > 0) {
-                    level = (dc_bias + level) >> (QUANT_SHIFT + 1);
-                    block[0] = level;
-                } else {
-                    level = (dc_bias - level) >> (QUANT_SHIFT + 1);
-                    block[0] = -level;
-                }
-//                last_non_zero = i;
-            } else {
-                block[0] = 0;
-            }
-        }
-        last_non_zero = 0;
-        i = 1;
-    } else {
-        last_non_zero = -1;
-        i = 0;
-    }
-
-    for (; i < 16; i++) {
-        const int j = scantable[i];
-        int level = block[j]*quant_table[j];
-
-//        if (   bias+level >= (1 << (QMAT_SHIFT - 3))
-//            || bias-level >= (1 << (QMAT_SHIFT - 3))) {
-        if (((unsigned)(level + threshold1)) > threshold2) {
-            if (level > 0) {
-                level = (bias + level) >> QUANT_SHIFT;
-                block[j] = level;
-            } else {
-                level = (bias - level) >> QUANT_SHIFT;
-                block[j] = -level;
-            }
-            last_non_zero = i;
-        } else {
-            block[j] = 0;
-        }
-    }
-
-    return last_non_zero;
-}
diff --git a/libavcodec/h264idct.c b/libavcodec/h264idct.c
deleted file mode 100644
index da5c6a5..0000000
--- a/libavcodec/h264idct.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * H.264 IDCT
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 IDCT.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "dsputil.h"
-
-static av_always_inline void idct_internal(uint8_t *dst, DCTELEM *block, int stride, int block_stride, int shift, int add){
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    block[0] += 1<<(shift-1);
-
-    for(i=0; i<4; i++){
-        const int z0=  block[0 + block_stride*i]     +  block[2 + block_stride*i];
-        const int z1=  block[0 + block_stride*i]     -  block[2 + block_stride*i];
-        const int z2= (block[1 + block_stride*i]>>1) -  block[3 + block_stride*i];
-        const int z3=  block[1 + block_stride*i]     + (block[3 + block_stride*i]>>1);
-
-        block[0 + block_stride*i]= z0 + z3;
-        block[1 + block_stride*i]= z1 + z2;
-        block[2 + block_stride*i]= z1 - z2;
-        block[3 + block_stride*i]= z0 - z3;
-    }
-
-    for(i=0; i<4; i++){
-        const int z0=  block[i + block_stride*0]     +  block[i + block_stride*2];
-        const int z1=  block[i + block_stride*0]     -  block[i + block_stride*2];
-        const int z2= (block[i + block_stride*1]>>1) -  block[i + block_stride*3];
-        const int z3=  block[i + block_stride*1]     + (block[i + block_stride*3]>>1);
-
-        dst[i + 0*stride]= cm[ add*dst[i + 0*stride] + ((z0 + z3) >> shift) ];
-        dst[i + 1*stride]= cm[ add*dst[i + 1*stride] + ((z1 + z2) >> shift) ];
-        dst[i + 2*stride]= cm[ add*dst[i + 2*stride] + ((z1 - z2) >> shift) ];
-        dst[i + 3*stride]= cm[ add*dst[i + 3*stride] + ((z0 - z3) >> shift) ];
-    }
-}
-
-void ff_h264_idct_add_c(uint8_t *dst, DCTELEM *block, int stride){
-    idct_internal(dst, block, stride, 4, 6, 1);
-}
-
-void ff_h264_lowres_idct_add_c(uint8_t *dst, int stride, DCTELEM *block){
-    idct_internal(dst, block, stride, 8, 3, 1);
-}
-
-void ff_h264_lowres_idct_put_c(uint8_t *dst, int stride, DCTELEM *block){
-    idct_internal(dst, block, stride, 8, 3, 0);
-}
-
-void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    block[0] += 32;
-
-    for( i = 0; i < 8; i++ )
-    {
-        const int a0 =  block[0+i*8] + block[4+i*8];
-        const int a2 =  block[0+i*8] - block[4+i*8];
-        const int a4 = (block[2+i*8]>>1) - block[6+i*8];
-        const int a6 = (block[6+i*8]>>1) + block[2+i*8];
-
-        const int b0 = a0 + a6;
-        const int b2 = a2 + a4;
-        const int b4 = a2 - a4;
-        const int b6 = a0 - a6;
-
-        const int a1 = -block[3+i*8] + block[5+i*8] - block[7+i*8] - (block[7+i*8]>>1);
-        const int a3 =  block[1+i*8] + block[7+i*8] - block[3+i*8] - (block[3+i*8]>>1);
-        const int a5 = -block[1+i*8] + block[7+i*8] + block[5+i*8] + (block[5+i*8]>>1);
-        const int a7 =  block[3+i*8] + block[5+i*8] + block[1+i*8] + (block[1+i*8]>>1);
-
-        const int b1 = (a7>>2) + a1;
-        const int b3 =  a3 + (a5>>2);
-        const int b5 = (a3>>2) - a5;
-        const int b7 =  a7 - (a1>>2);
-
-        block[0+i*8] = b0 + b7;
-        block[7+i*8] = b0 - b7;
-        block[1+i*8] = b2 + b5;
-        block[6+i*8] = b2 - b5;
-        block[2+i*8] = b4 + b3;
-        block[5+i*8] = b4 - b3;
-        block[3+i*8] = b6 + b1;
-        block[4+i*8] = b6 - b1;
-    }
-    for( i = 0; i < 8; i++ )
-    {
-        const int a0 =  block[i+0*8] + block[i+4*8];
-        const int a2 =  block[i+0*8] - block[i+4*8];
-        const int a4 = (block[i+2*8]>>1) - block[i+6*8];
-        const int a6 = (block[i+6*8]>>1) + block[i+2*8];
-
-        const int b0 = a0 + a6;
-        const int b2 = a2 + a4;
-        const int b4 = a2 - a4;
-        const int b6 = a0 - a6;
-
-        const int a1 = -block[i+3*8] + block[i+5*8] - block[i+7*8] - (block[i+7*8]>>1);
-        const int a3 =  block[i+1*8] + block[i+7*8] - block[i+3*8] - (block[i+3*8]>>1);
-        const int a5 = -block[i+1*8] + block[i+7*8] + block[i+5*8] + (block[i+5*8]>>1);
-        const int a7 =  block[i+3*8] + block[i+5*8] + block[i+1*8] + (block[i+1*8]>>1);
-
-        const int b1 = (a7>>2) + a1;
-        const int b3 =  a3 + (a5>>2);
-        const int b5 = (a3>>2) - a5;
-        const int b7 =  a7 - (a1>>2);
-
-        dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b7) >> 6) ];
-        dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b2 + b5) >> 6) ];
-        dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b4 + b3) >> 6) ];
-        dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b6 + b1) >> 6) ];
-        dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b6 - b1) >> 6) ];
-        dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b4 - b3) >> 6) ];
-        dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b2 - b5) >> 6) ];
-        dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b7) >> 6) ];
-    }
-}
-
-// assumes all AC coefs are 0
-void ff_h264_idct_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
-    int i, j;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int dc = (block[0] + 32) >> 6;
-    for( j = 0; j < 4; j++ )
-    {
-        for( i = 0; i < 4; i++ )
-            dst[i] = cm[ dst[i] + dc ];
-        dst += stride;
-    }
-}
-
-void ff_h264_idct8_dc_add_c(uint8_t *dst, DCTELEM *block, int stride){
-    int i, j;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int dc = (block[0] + 32) >> 6;
-    for( j = 0; j < 8; j++ )
-    {
-        for( i = 0; i < 8; i++ )
-            dst[i] = cm[ dst[i] + dc ];
-        dst += stride;
-    }
-}
-
-//FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split
-static const uint8_t scan8[16 + 2*4]={
- 4+1*8, 5+1*8, 4+2*8, 5+2*8,
- 6+1*8, 7+1*8, 6+2*8, 7+2*8,
- 4+3*8, 5+3*8, 4+4*8, 5+4*8,
- 6+3*8, 7+3*8, 6+4*8, 7+4*8,
- 1+1*8, 2+1*8,
- 1+2*8, 2+2*8,
- 1+4*8, 2+4*8,
- 1+5*8, 2+5*8,
-};
-
-void ff_h264_idct_add16_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        int nnz = nnzc[ scan8[i] ];
-        if(nnz){
-            if(nnz==1 && block[i*16]) ff_h264_idct_dc_add_c(dst + block_offset[i], block + i*16, stride);
-            else                      idct_internal        (dst + block_offset[i], block + i*16, stride, 4, 6, 1);
-        }
-    }
-}
-
-void ff_h264_idct_add16intra_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        if(nnzc[ scan8[i] ]) idct_internal        (dst + block_offset[i], block + i*16, stride, 4, 6, 1);
-        else if(block[i*16]) ff_h264_idct_dc_add_c(dst + block_offset[i], block + i*16, stride);
-    }
-}
-
-void ff_h264_idct8_add4_c(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i+=4){
-        int nnz = nnzc[ scan8[i] ];
-        if(nnz){
-            if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_c(dst + block_offset[i], block + i*16, stride);
-            else                      ff_h264_idct8_add_c   (dst + block_offset[i], block + i*16, stride);
-        }
-    }
-}
-
-void ff_h264_idct_add8_c(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=16; i<16+8; i++){
-        if(nnzc[ scan8[i] ])
-            ff_h264_idct_add_c   (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-        else if(block[i*16])
-            ff_h264_idct_dc_add_c(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-    }
-}
diff --git a/libavcodec/h264pred.c b/libavcodec/h264pred.c
deleted file mode 100644
index 9637b45..0000000
--- a/libavcodec/h264pred.c
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 prediction functions.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h264pred.h"
-
-static void pred4x4_vertical_c(uint8_t *src, uint8_t *topright, int stride){
-    const uint32_t a= ((uint32_t*)(src-stride))[0];
-    ((uint32_t*)(src+0*stride))[0]= a;
-    ((uint32_t*)(src+1*stride))[0]= a;
-    ((uint32_t*)(src+2*stride))[0]= a;
-    ((uint32_t*)(src+3*stride))[0]= a;
-}
-
-static void pred4x4_horizontal_c(uint8_t *src, uint8_t *topright, int stride){
-    ((uint32_t*)(src+0*stride))[0]= src[-1+0*stride]*0x01010101;
-    ((uint32_t*)(src+1*stride))[0]= src[-1+1*stride]*0x01010101;
-    ((uint32_t*)(src+2*stride))[0]= src[-1+2*stride]*0x01010101;
-    ((uint32_t*)(src+3*stride))[0]= src[-1+3*stride]*0x01010101;
-}
-
-static void pred4x4_dc_c(uint8_t *src, uint8_t *topright, int stride){
-    const int dc= (  src[-stride] + src[1-stride] + src[2-stride] + src[3-stride]
-                   + src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 4) >>3;
-
-    ((uint32_t*)(src+0*stride))[0]=
-    ((uint32_t*)(src+1*stride))[0]=
-    ((uint32_t*)(src+2*stride))[0]=
-    ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
-}
-
-static void pred4x4_left_dc_c(uint8_t *src, uint8_t *topright, int stride){
-    const int dc= (  src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >>2;
-
-    ((uint32_t*)(src+0*stride))[0]=
-    ((uint32_t*)(src+1*stride))[0]=
-    ((uint32_t*)(src+2*stride))[0]=
-    ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
-}
-
-static void pred4x4_top_dc_c(uint8_t *src, uint8_t *topright, int stride){
-    const int dc= (  src[-stride] + src[1-stride] + src[2-stride] + src[3-stride] + 2) >>2;
-
-    ((uint32_t*)(src+0*stride))[0]=
-    ((uint32_t*)(src+1*stride))[0]=
-    ((uint32_t*)(src+2*stride))[0]=
-    ((uint32_t*)(src+3*stride))[0]= dc* 0x01010101;
-}
-
-static void pred4x4_128_dc_c(uint8_t *src, uint8_t *topright, int stride){
-    ((uint32_t*)(src+0*stride))[0]=
-    ((uint32_t*)(src+1*stride))[0]=
-    ((uint32_t*)(src+2*stride))[0]=
-    ((uint32_t*)(src+3*stride))[0]= 128U*0x01010101U;
-}
-
-
-#define LOAD_TOP_RIGHT_EDGE\
-    const int av_unused t4= topright[0];\
-    const int av_unused t5= topright[1];\
-    const int av_unused t6= topright[2];\
-    const int av_unused t7= topright[3];\
-
-#define LOAD_DOWN_LEFT_EDGE\
-    const int av_unused l4= src[-1+4*stride];\
-    const int av_unused l5= src[-1+5*stride];\
-    const int av_unused l6= src[-1+6*stride];\
-    const int av_unused l7= src[-1+7*stride];\
-
-#define LOAD_LEFT_EDGE\
-    const int av_unused l0= src[-1+0*stride];\
-    const int av_unused l1= src[-1+1*stride];\
-    const int av_unused l2= src[-1+2*stride];\
-    const int av_unused l3= src[-1+3*stride];\
-
-#define LOAD_TOP_EDGE\
-    const int av_unused t0= src[ 0-1*stride];\
-    const int av_unused t1= src[ 1-1*stride];\
-    const int av_unused t2= src[ 2-1*stride];\
-    const int av_unused t3= src[ 3-1*stride];\
-
-static void pred4x4_down_right_c(uint8_t *src, uint8_t *topright, int stride){
-    const int lt= src[-1-1*stride];
-    LOAD_TOP_EDGE
-    LOAD_LEFT_EDGE
-
-    src[0+3*stride]=(l3 + 2*l2 + l1 + 2)>>2;
-    src[0+2*stride]=
-    src[1+3*stride]=(l2 + 2*l1 + l0 + 2)>>2;
-    src[0+1*stride]=
-    src[1+2*stride]=
-    src[2+3*stride]=(l1 + 2*l0 + lt + 2)>>2;
-    src[0+0*stride]=
-    src[1+1*stride]=
-    src[2+2*stride]=
-    src[3+3*stride]=(l0 + 2*lt + t0 + 2)>>2;
-    src[1+0*stride]=
-    src[2+1*stride]=
-    src[3+2*stride]=(lt + 2*t0 + t1 + 2)>>2;
-    src[2+0*stride]=
-    src[3+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
-    src[3+0*stride]=(t1 + 2*t2 + t3 + 2)>>2;
-}
-
-static void pred4x4_down_left_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_TOP_EDGE
-    LOAD_TOP_RIGHT_EDGE
-//    LOAD_LEFT_EDGE
-
-    src[0+0*stride]=(t0 + t2 + 2*t1 + 2)>>2;
-    src[1+0*stride]=
-    src[0+1*stride]=(t1 + t3 + 2*t2 + 2)>>2;
-    src[2+0*stride]=
-    src[1+1*stride]=
-    src[0+2*stride]=(t2 + t4 + 2*t3 + 2)>>2;
-    src[3+0*stride]=
-    src[2+1*stride]=
-    src[1+2*stride]=
-    src[0+3*stride]=(t3 + t5 + 2*t4 + 2)>>2;
-    src[3+1*stride]=
-    src[2+2*stride]=
-    src[1+3*stride]=(t4 + t6 + 2*t5 + 2)>>2;
-    src[3+2*stride]=
-    src[2+3*stride]=(t5 + t7 + 2*t6 + 2)>>2;
-    src[3+3*stride]=(t6 + 3*t7 + 2)>>2;
-}
-
-static void pred4x4_down_left_svq3_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_TOP_EDGE
-    LOAD_LEFT_EDGE
-    const av_unused int unu0= t0;
-    const av_unused int unu1= l0;
-
-    src[0+0*stride]=(l1 + t1)>>1;
-    src[1+0*stride]=
-    src[0+1*stride]=(l2 + t2)>>1;
-    src[2+0*stride]=
-    src[1+1*stride]=
-    src[0+2*stride]=
-    src[3+0*stride]=
-    src[2+1*stride]=
-    src[1+2*stride]=
-    src[0+3*stride]=
-    src[3+1*stride]=
-    src[2+2*stride]=
-    src[1+3*stride]=
-    src[3+2*stride]=
-    src[2+3*stride]=
-    src[3+3*stride]=(l3 + t3)>>1;
-}
-
-static void pred4x4_down_left_rv40_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_TOP_EDGE
-    LOAD_TOP_RIGHT_EDGE
-    LOAD_LEFT_EDGE
-    LOAD_DOWN_LEFT_EDGE
-
-    src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
-    src[1+0*stride]=
-    src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
-    src[2+0*stride]=
-    src[1+1*stride]=
-    src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + l4 + 2*l3 + 2)>>3;
-    src[3+0*stride]=
-    src[2+1*stride]=
-    src[1+2*stride]=
-    src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3 + l5 + 2*l4 + 2)>>3;
-    src[3+1*stride]=
-    src[2+2*stride]=
-    src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l4 + l6 + 2*l5 + 2)>>3;
-    src[3+2*stride]=
-    src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l5 + l7 + 2*l6 + 2)>>3;
-    src[3+3*stride]=(t6 + t7 + 1 + l6 + l7 + 1)>>2;
-}
-
-static void pred4x4_down_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_TOP_EDGE
-    LOAD_TOP_RIGHT_EDGE
-    LOAD_LEFT_EDGE
-
-    src[0+0*stride]=(t0 + t2 + 2*t1 + 2 + l0 + l2 + 2*l1 + 2)>>3;
-    src[1+0*stride]=
-    src[0+1*stride]=(t1 + t3 + 2*t2 + 2 + l1 + l3 + 2*l2 + 2)>>3;
-    src[2+0*stride]=
-    src[1+1*stride]=
-    src[0+2*stride]=(t2 + t4 + 2*t3 + 2 + l2 + 3*l3 + 2)>>3;
-    src[3+0*stride]=
-    src[2+1*stride]=
-    src[1+2*stride]=
-    src[0+3*stride]=(t3 + t5 + 2*t4 + 2 + l3*4 + 2)>>3;
-    src[3+1*stride]=
-    src[2+2*stride]=
-    src[1+3*stride]=(t4 + t6 + 2*t5 + 2 + l3*4 + 2)>>3;
-    src[3+2*stride]=
-    src[2+3*stride]=(t5 + t7 + 2*t6 + 2 + l3*4 + 2)>>3;
-    src[3+3*stride]=(t6 + t7 + 1 + 2*l3 + 1)>>2;
-}
-
-static void pred4x4_vertical_right_c(uint8_t *src, uint8_t *topright, int stride){
-    const int lt= src[-1-1*stride];
-    LOAD_TOP_EDGE
-    LOAD_LEFT_EDGE
-
-    src[0+0*stride]=
-    src[1+2*stride]=(lt + t0 + 1)>>1;
-    src[1+0*stride]=
-    src[2+2*stride]=(t0 + t1 + 1)>>1;
-    src[2+0*stride]=
-    src[3+2*stride]=(t1 + t2 + 1)>>1;
-    src[3+0*stride]=(t2 + t3 + 1)>>1;
-    src[0+1*stride]=
-    src[1+3*stride]=(l0 + 2*lt + t0 + 2)>>2;
-    src[1+1*stride]=
-    src[2+3*stride]=(lt + 2*t0 + t1 + 2)>>2;
-    src[2+1*stride]=
-    src[3+3*stride]=(t0 + 2*t1 + t2 + 2)>>2;
-    src[3+1*stride]=(t1 + 2*t2 + t3 + 2)>>2;
-    src[0+2*stride]=(lt + 2*l0 + l1 + 2)>>2;
-    src[0+3*stride]=(l0 + 2*l1 + l2 + 2)>>2;
-}
-
-static void pred4x4_vertical_left_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_TOP_EDGE
-    LOAD_TOP_RIGHT_EDGE
-
-    src[0+0*stride]=(t0 + t1 + 1)>>1;
-    src[1+0*stride]=
-    src[0+2*stride]=(t1 + t2 + 1)>>1;
-    src[2+0*stride]=
-    src[1+2*stride]=(t2 + t3 + 1)>>1;
-    src[3+0*stride]=
-    src[2+2*stride]=(t3 + t4+ 1)>>1;
-    src[3+2*stride]=(t4 + t5+ 1)>>1;
-    src[0+1*stride]=(t0 + 2*t1 + t2 + 2)>>2;
-    src[1+1*stride]=
-    src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
-    src[2+1*stride]=
-    src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
-    src[3+1*stride]=
-    src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
-    src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
-}
-
-static void pred4x4_vertical_left_rv40(uint8_t *src, uint8_t *topright, int stride,
-                                      const int l0, const int l1, const int l2, const int l3, const int l4){
-    LOAD_TOP_EDGE
-    LOAD_TOP_RIGHT_EDGE
-
-    src[0+0*stride]=(2*t0 + 2*t1 + l1 + 2*l2 + l3 + 4)>>3;
-    src[1+0*stride]=
-    src[0+2*stride]=(t1 + t2 + 1)>>1;
-    src[2+0*stride]=
-    src[1+2*stride]=(t2 + t3 + 1)>>1;
-    src[3+0*stride]=
-    src[2+2*stride]=(t3 + t4+ 1)>>1;
-    src[3+2*stride]=(t4 + t5+ 1)>>1;
-    src[0+1*stride]=(t0 + 2*t1 + t2 + l2 + 2*l3 + l4 + 4)>>3;
-    src[1+1*stride]=
-    src[0+3*stride]=(t1 + 2*t2 + t3 + 2)>>2;
-    src[2+1*stride]=
-    src[1+3*stride]=(t2 + 2*t3 + t4 + 2)>>2;
-    src[3+1*stride]=
-    src[2+3*stride]=(t3 + 2*t4 + t5 + 2)>>2;
-    src[3+3*stride]=(t4 + 2*t5 + t6 + 2)>>2;
-}
-
-static void pred4x4_vertical_left_rv40_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_LEFT_EDGE
-    LOAD_DOWN_LEFT_EDGE
-
-    pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l4);
-}
-
-static void pred4x4_vertical_left_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_LEFT_EDGE
-
-    pred4x4_vertical_left_rv40(src, topright, stride, l0, l1, l2, l3, l3);
-}
-
-static void pred4x4_horizontal_up_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_LEFT_EDGE
-
-    src[0+0*stride]=(l0 + l1 + 1)>>1;
-    src[1+0*stride]=(l0 + 2*l1 + l2 + 2)>>2;
-    src[2+0*stride]=
-    src[0+1*stride]=(l1 + l2 + 1)>>1;
-    src[3+0*stride]=
-    src[1+1*stride]=(l1 + 2*l2 + l3 + 2)>>2;
-    src[2+1*stride]=
-    src[0+2*stride]=(l2 + l3 + 1)>>1;
-    src[3+1*stride]=
-    src[1+2*stride]=(l2 + 2*l3 + l3 + 2)>>2;
-    src[3+2*stride]=
-    src[1+3*stride]=
-    src[0+3*stride]=
-    src[2+2*stride]=
-    src[2+3*stride]=
-    src[3+3*stride]=l3;
-}
-
-static void pred4x4_horizontal_up_rv40_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_LEFT_EDGE
-    LOAD_DOWN_LEFT_EDGE
-    LOAD_TOP_EDGE
-    LOAD_TOP_RIGHT_EDGE
-
-    src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
-    src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
-    src[2+0*stride]=
-    src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
-    src[3+0*stride]=
-    src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
-    src[2+1*stride]=
-    src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
-    src[3+1*stride]=
-    src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
-    src[3+2*stride]=
-    src[1+3*stride]=(l3 + 2*l4 + l5 + 2)>>2;
-    src[0+3*stride]=
-    src[2+2*stride]=(t6 + t7 + l3 + l4 + 2)>>2;
-    src[2+3*stride]=(l4 + l5 + 1)>>1;
-    src[3+3*stride]=(l4 + 2*l5 + l6 + 2)>>2;
-}
-
-static void pred4x4_horizontal_up_rv40_nodown_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_LEFT_EDGE
-    LOAD_TOP_EDGE
-    LOAD_TOP_RIGHT_EDGE
-
-    src[0+0*stride]=(t1 + 2*t2 + t3 + 2*l0 + 2*l1 + 4)>>3;
-    src[1+0*stride]=(t2 + 2*t3 + t4 + l0 + 2*l1 + l2 + 4)>>3;
-    src[2+0*stride]=
-    src[0+1*stride]=(t3 + 2*t4 + t5 + 2*l1 + 2*l2 + 4)>>3;
-    src[3+0*stride]=
-    src[1+1*stride]=(t4 + 2*t5 + t6 + l1 + 2*l2 + l3 + 4)>>3;
-    src[2+1*stride]=
-    src[0+2*stride]=(t5 + 2*t6 + t7 + 2*l2 + 2*l3 + 4)>>3;
-    src[3+1*stride]=
-    src[1+2*stride]=(t6 + 3*t7 + l2 + 3*l3 + 4)>>3;
-    src[3+2*stride]=
-    src[1+3*stride]=l3;
-    src[0+3*stride]=
-    src[2+2*stride]=(t6 + t7 + 2*l3 + 2)>>2;
-    src[2+3*stride]=
-    src[3+3*stride]=l3;
-}
-
-static void pred4x4_horizontal_down_c(uint8_t *src, uint8_t *topright, int stride){
-    const int lt= src[-1-1*stride];
-    LOAD_TOP_EDGE
-    LOAD_LEFT_EDGE
-
-    src[0+0*stride]=
-    src[2+1*stride]=(lt + l0 + 1)>>1;
-    src[1+0*stride]=
-    src[3+1*stride]=(l0 + 2*lt + t0 + 2)>>2;
-    src[2+0*stride]=(lt + 2*t0 + t1 + 2)>>2;
-    src[3+0*stride]=(t0 + 2*t1 + t2 + 2)>>2;
-    src[0+1*stride]=
-    src[2+2*stride]=(l0 + l1 + 1)>>1;
-    src[1+1*stride]=
-    src[3+2*stride]=(lt + 2*l0 + l1 + 2)>>2;
-    src[0+2*stride]=
-    src[2+3*stride]=(l1 + l2+ 1)>>1;
-    src[1+2*stride]=
-    src[3+3*stride]=(l0 + 2*l1 + l2 + 2)>>2;
-    src[0+3*stride]=(l2 + l3 + 1)>>1;
-    src[1+3*stride]=(l1 + 2*l2 + l3 + 2)>>2;
-}
-
-static void pred16x16_vertical_c(uint8_t *src, int stride){
-    int i;
-    const uint32_t a= ((uint32_t*)(src-stride))[0];
-    const uint32_t b= ((uint32_t*)(src-stride))[1];
-    const uint32_t c= ((uint32_t*)(src-stride))[2];
-    const uint32_t d= ((uint32_t*)(src-stride))[3];
-
-    for(i=0; i<16; i++){
-        ((uint32_t*)(src+i*stride))[0]= a;
-        ((uint32_t*)(src+i*stride))[1]= b;
-        ((uint32_t*)(src+i*stride))[2]= c;
-        ((uint32_t*)(src+i*stride))[3]= d;
-    }
-}
-
-static void pred16x16_horizontal_c(uint8_t *src, int stride){
-    int i;
-
-    for(i=0; i<16; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]=
-        ((uint32_t*)(src+i*stride))[2]=
-        ((uint32_t*)(src+i*stride))[3]= src[-1+i*stride]*0x01010101;
-    }
-}
-
-static void pred16x16_dc_c(uint8_t *src, int stride){
-    int i, dc=0;
-
-    for(i=0;i<16; i++){
-        dc+= src[-1+i*stride];
-    }
-
-    for(i=0;i<16; i++){
-        dc+= src[i-stride];
-    }
-
-    dc= 0x01010101*((dc + 16)>>5);
-
-    for(i=0; i<16; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]=
-        ((uint32_t*)(src+i*stride))[2]=
-        ((uint32_t*)(src+i*stride))[3]= dc;
-    }
-}
-
-static void pred16x16_left_dc_c(uint8_t *src, int stride){
-    int i, dc=0;
-
-    for(i=0;i<16; i++){
-        dc+= src[-1+i*stride];
-    }
-
-    dc= 0x01010101*((dc + 8)>>4);
-
-    for(i=0; i<16; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]=
-        ((uint32_t*)(src+i*stride))[2]=
-        ((uint32_t*)(src+i*stride))[3]= dc;
-    }
-}
-
-static void pred16x16_top_dc_c(uint8_t *src, int stride){
-    int i, dc=0;
-
-    for(i=0;i<16; i++){
-        dc+= src[i-stride];
-    }
-    dc= 0x01010101*((dc + 8)>>4);
-
-    for(i=0; i<16; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]=
-        ((uint32_t*)(src+i*stride))[2]=
-        ((uint32_t*)(src+i*stride))[3]= dc;
-    }
-}
-
-static void pred16x16_128_dc_c(uint8_t *src, int stride){
-    int i;
-
-    for(i=0; i<16; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]=
-        ((uint32_t*)(src+i*stride))[2]=
-        ((uint32_t*)(src+i*stride))[3]= 0x01010101U*128U;
-    }
-}
-
-static inline void pred16x16_plane_compat_c(uint8_t *src, int stride, const int svq3, const int rv40){
-  int i, j, k;
-  int a;
-  uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-  const uint8_t * const src0 = src+7-stride;
-  const uint8_t *src1 = src+8*stride-1;
-  const uint8_t *src2 = src1-2*stride;      // == src+6*stride-1;
-  int H = src0[1] - src0[-1];
-  int V = src1[0] - src2[ 0];
-  for(k=2; k<=8; ++k) {
-    src1 += stride; src2 -= stride;
-    H += k*(src0[k] - src0[-k]);
-    V += k*(src1[0] - src2[ 0]);
-  }
-  if(svq3){
-    H = ( 5*(H/4) ) / 16;
-    V = ( 5*(V/4) ) / 16;
-
-    /* required for 100% accuracy */
-    i = H; H = V; V = i;
-  }else if(rv40){
-    H = ( H + (H>>2) ) >> 4;
-    V = ( V + (V>>2) ) >> 4;
-  }else{
-    H = ( 5*H+32 ) >> 6;
-    V = ( 5*V+32 ) >> 6;
-  }
-
-  a = 16*(src1[0] + src2[16] + 1) - 7*(V+H);
-  for(j=16; j>0; --j) {
-    int b = a;
-    a += V;
-    for(i=-16; i<0; i+=4) {
-      src[16+i] = cm[ (b    ) >> 5 ];
-      src[17+i] = cm[ (b+  H) >> 5 ];
-      src[18+i] = cm[ (b+2*H) >> 5 ];
-      src[19+i] = cm[ (b+3*H) >> 5 ];
-      b += 4*H;
-    }
-    src += stride;
-  }
-}
-
-static void pred16x16_plane_c(uint8_t *src, int stride){
-    pred16x16_plane_compat_c(src, stride, 0, 0);
-}
-
-static void pred16x16_plane_svq3_c(uint8_t *src, int stride){
-    pred16x16_plane_compat_c(src, stride, 1, 0);
-}
-
-static void pred16x16_plane_rv40_c(uint8_t *src, int stride){
-    pred16x16_plane_compat_c(src, stride, 0, 1);
-}
-
-static void pred8x8_vertical_c(uint8_t *src, int stride){
-    int i;
-    const uint32_t a= ((uint32_t*)(src-stride))[0];
-    const uint32_t b= ((uint32_t*)(src-stride))[1];
-
-    for(i=0; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]= a;
-        ((uint32_t*)(src+i*stride))[1]= b;
-    }
-}
-
-static void pred8x8_horizontal_c(uint8_t *src, int stride){
-    int i;
-
-    for(i=0; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]= src[-1+i*stride]*0x01010101;
-    }
-}
-
-static void pred8x8_128_dc_c(uint8_t *src, int stride){
-    int i;
-
-    for(i=0; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]= 0x01010101U*128U;
-    }
-}
-
-static void pred8x8_left_dc_c(uint8_t *src, int stride){
-    int i;
-    int dc0, dc2;
-
-    dc0=dc2=0;
-    for(i=0;i<4; i++){
-        dc0+= src[-1+i*stride];
-        dc2+= src[-1+(i+4)*stride];
-    }
-    dc0= 0x01010101*((dc0 + 2)>>2);
-    dc2= 0x01010101*((dc2 + 2)>>2);
-
-    for(i=0; i<4; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]= dc0;
-    }
-    for(i=4; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]= dc2;
-    }
-}
-
-static void pred8x8_left_dc_rv40_c(uint8_t *src, int stride){
-    int i;
-    int dc0;
-
-    dc0=0;
-    for(i=0;i<8; i++)
-        dc0+= src[-1+i*stride];
-    dc0= 0x01010101*((dc0 + 4)>>3);
-
-    for(i=0; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]= dc0;
-    }
-}
-
-static void pred8x8_top_dc_c(uint8_t *src, int stride){
-    int i;
-    int dc0, dc1;
-
-    dc0=dc1=0;
-    for(i=0;i<4; i++){
-        dc0+= src[i-stride];
-        dc1+= src[4+i-stride];
-    }
-    dc0= 0x01010101*((dc0 + 2)>>2);
-    dc1= 0x01010101*((dc1 + 2)>>2);
-
-    for(i=0; i<4; i++){
-        ((uint32_t*)(src+i*stride))[0]= dc0;
-        ((uint32_t*)(src+i*stride))[1]= dc1;
-    }
-    for(i=4; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]= dc0;
-        ((uint32_t*)(src+i*stride))[1]= dc1;
-    }
-}
-
-static void pred8x8_top_dc_rv40_c(uint8_t *src, int stride){
-    int i;
-    int dc0;
-
-    dc0=0;
-    for(i=0;i<8; i++)
-        dc0+= src[i-stride];
-    dc0= 0x01010101*((dc0 + 4)>>3);
-
-    for(i=0; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]=
-        ((uint32_t*)(src+i*stride))[1]= dc0;
-    }
-}
-
-
-static void pred8x8_dc_c(uint8_t *src, int stride){
-    int i;
-    int dc0, dc1, dc2, dc3;
-
-    dc0=dc1=dc2=0;
-    for(i=0;i<4; i++){
-        dc0+= src[-1+i*stride] + src[i-stride];
-        dc1+= src[4+i-stride];
-        dc2+= src[-1+(i+4)*stride];
-    }
-    dc3= 0x01010101*((dc1 + dc2 + 4)>>3);
-    dc0= 0x01010101*((dc0 + 4)>>3);
-    dc1= 0x01010101*((dc1 + 2)>>2);
-    dc2= 0x01010101*((dc2 + 2)>>2);
-
-    for(i=0; i<4; i++){
-        ((uint32_t*)(src+i*stride))[0]= dc0;
-        ((uint32_t*)(src+i*stride))[1]= dc1;
-    }
-    for(i=4; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]= dc2;
-        ((uint32_t*)(src+i*stride))[1]= dc3;
-    }
-}
-
-//the following 4 function should not be optimized!
-static void pred8x8_mad_cow_dc_l0t(uint8_t *src, int stride){
-    pred8x8_top_dc_c(src, stride);
-    pred4x4_dc_c(src, NULL, stride);
-}
-
-static void pred8x8_mad_cow_dc_0lt(uint8_t *src, int stride){
-    pred8x8_dc_c(src, stride);
-    pred4x4_top_dc_c(src, NULL, stride);
-}
-
-static void pred8x8_mad_cow_dc_l00(uint8_t *src, int stride){
-    pred8x8_left_dc_c(src, stride);
-    pred4x4_128_dc_c(src + 4*stride    , NULL, stride);
-    pred4x4_128_dc_c(src + 4*stride + 4, NULL, stride);
-}
-
-static void pred8x8_mad_cow_dc_0l0(uint8_t *src, int stride){
-    pred8x8_left_dc_c(src, stride);
-    pred4x4_128_dc_c(src    , NULL, stride);
-    pred4x4_128_dc_c(src + 4, NULL, stride);
-}
-
-static void pred8x8_dc_rv40_c(uint8_t *src, int stride){
-    int i;
-    int dc0=0;
-
-    for(i=0;i<4; i++){
-        dc0+= src[-1+i*stride] + src[i-stride];
-        dc0+= src[4+i-stride];
-        dc0+= src[-1+(i+4)*stride];
-    }
-    dc0= 0x01010101*((dc0 + 8)>>4);
-
-    for(i=0; i<4; i++){
-        ((uint32_t*)(src+i*stride))[0]= dc0;
-        ((uint32_t*)(src+i*stride))[1]= dc0;
-    }
-    for(i=4; i<8; i++){
-        ((uint32_t*)(src+i*stride))[0]= dc0;
-        ((uint32_t*)(src+i*stride))[1]= dc0;
-    }
-}
-
-static void pred8x8_plane_c(uint8_t *src, int stride){
-  int j, k;
-  int a;
-  uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-  const uint8_t * const src0 = src+3-stride;
-  const uint8_t *src1 = src+4*stride-1;
-  const uint8_t *src2 = src1-2*stride;      // == src+2*stride-1;
-  int H = src0[1] - src0[-1];
-  int V = src1[0] - src2[ 0];
-  for(k=2; k<=4; ++k) {
-    src1 += stride; src2 -= stride;
-    H += k*(src0[k] - src0[-k]);
-    V += k*(src1[0] - src2[ 0]);
-  }
-  H = ( 17*H+16 ) >> 5;
-  V = ( 17*V+16 ) >> 5;
-
-  a = 16*(src1[0] + src2[8]+1) - 3*(V+H);
-  for(j=8; j>0; --j) {
-    int b = a;
-    a += V;
-    src[0] = cm[ (b    ) >> 5 ];
-    src[1] = cm[ (b+  H) >> 5 ];
-    src[2] = cm[ (b+2*H) >> 5 ];
-    src[3] = cm[ (b+3*H) >> 5 ];
-    src[4] = cm[ (b+4*H) >> 5 ];
-    src[5] = cm[ (b+5*H) >> 5 ];
-    src[6] = cm[ (b+6*H) >> 5 ];
-    src[7] = cm[ (b+7*H) >> 5 ];
-    src += stride;
-  }
-}
-
-#define SRC(x,y) src[(x)+(y)*stride]
-#define PL(y) \
-    const int l##y = (SRC(-1,y-1) + 2*SRC(-1,y) + SRC(-1,y+1) + 2) >> 2;
-#define PREDICT_8x8_LOAD_LEFT \
-    const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \
-                     + 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \
-    PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) \
-    const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2
-
-#define PT(x) \
-    const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2;
-#define PREDICT_8x8_LOAD_TOP \
-    const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \
-                     + 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \
-    PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) \
-    const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \
-                     + 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2
-
-#define PTR(x) \
-    t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2;
-#define PREDICT_8x8_LOAD_TOPRIGHT \
-    int t8, t9, t10, t11, t12, t13, t14, t15; \
-    if(has_topright) { \
-        PTR(8) PTR(9) PTR(10) PTR(11) PTR(12) PTR(13) PTR(14) \
-        t15 = (SRC(14,-1) + 3*SRC(15,-1) + 2) >> 2; \
-    } else t8=t9=t10=t11=t12=t13=t14=t15= SRC(7,-1);
-
-#define PREDICT_8x8_LOAD_TOPLEFT \
-    const int lt = (SRC(-1,0) + 2*SRC(-1,-1) + SRC(0,-1) + 2) >> 2
-
-#define PREDICT_8x8_DC(v) \
-    int y; \
-    for( y = 0; y < 8; y++ ) { \
-        ((uint32_t*)src)[0] = \
-        ((uint32_t*)src)[1] = v; \
-        src += stride; \
-    }
-
-static void pred8x8l_128_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_DC(0x80808080);
-}
-static void pred8x8l_left_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_LEFT;
-    const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3) * 0x01010101;
-    PREDICT_8x8_DC(dc);
-}
-static void pred8x8l_top_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_TOP;
-    const uint32_t dc = ((t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3) * 0x01010101;
-    PREDICT_8x8_DC(dc);
-}
-static void pred8x8l_dc_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_LEFT;
-    PREDICT_8x8_LOAD_TOP;
-    const uint32_t dc = ((l0+l1+l2+l3+l4+l5+l6+l7
-                         +t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4) * 0x01010101;
-    PREDICT_8x8_DC(dc);
-}
-static void pred8x8l_horizontal_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_LEFT;
-#define ROW(y) ((uint32_t*)(src+y*stride))[0] =\
-               ((uint32_t*)(src+y*stride))[1] = 0x01010101 * l##y
-    ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7);
-#undef ROW
-}
-static void pred8x8l_vertical_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    int y;
-    PREDICT_8x8_LOAD_TOP;
-    src[0] = t0;
-    src[1] = t1;
-    src[2] = t2;
-    src[3] = t3;
-    src[4] = t4;
-    src[5] = t5;
-    src[6] = t6;
-    src[7] = t7;
-    for( y = 1; y < 8; y++ )
-        *(uint64_t*)(src+y*stride) = *(uint64_t*)src;
-}
-static void pred8x8l_down_left_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_TOP;
-    PREDICT_8x8_LOAD_TOPRIGHT;
-    SRC(0,0)= (t0 + 2*t1 + t2 + 2) >> 2;
-    SRC(0,1)=SRC(1,0)= (t1 + 2*t2 + t3 + 2) >> 2;
-    SRC(0,2)=SRC(1,1)=SRC(2,0)= (t2 + 2*t3 + t4 + 2) >> 2;
-    SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2;
-    SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2;
-    SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2;
-    SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= (t6 + 2*t7 + t8 + 2) >> 2;
-    SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= (t7 + 2*t8 + t9 + 2) >> 2;
-    SRC(1,7)=SRC(2,6)=SRC(3,5)=SRC(4,4)=SRC(5,3)=SRC(6,2)=SRC(7,1)= (t8 + 2*t9 + t10 + 2) >> 2;
-    SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2;
-    SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= (t10 + 2*t11 + t12 + 2) >> 2;
-    SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= (t11 + 2*t12 + t13 + 2) >> 2;
-    SRC(5,7)=SRC(6,6)=SRC(7,5)= (t12 + 2*t13 + t14 + 2) >> 2;
-    SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2;
-    SRC(7,7)= (t14 + 3*t15 + 2) >> 2;
-}
-static void pred8x8l_down_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_TOP;
-    PREDICT_8x8_LOAD_LEFT;
-    PREDICT_8x8_LOAD_TOPLEFT;
-    SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2;
-    SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2;
-    SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2;
-    SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2;
-    SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2;
-    SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= (l2 + 2*l1 + l0 + 2) >> 2;
-    SRC(0,1)=SRC(1,2)=SRC(2,3)=SRC(3,4)=SRC(4,5)=SRC(5,6)=SRC(6,7)= (l1 + 2*l0 + lt + 2) >> 2;
-    SRC(0,0)=SRC(1,1)=SRC(2,2)=SRC(3,3)=SRC(4,4)=SRC(5,5)=SRC(6,6)=SRC(7,7)= (l0 + 2*lt + t0 + 2) >> 2;
-    SRC(1,0)=SRC(2,1)=SRC(3,2)=SRC(4,3)=SRC(5,4)=SRC(6,5)=SRC(7,6)= (lt + 2*t0 + t1 + 2) >> 2;
-    SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= (t0 + 2*t1 + t2 + 2) >> 2;
-    SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= (t1 + 2*t2 + t3 + 2) >> 2;
-    SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= (t2 + 2*t3 + t4 + 2) >> 2;
-    SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2;
-    SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2;
-    SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2;
-
-}
-static void pred8x8l_vertical_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_TOP;
-    PREDICT_8x8_LOAD_LEFT;
-    PREDICT_8x8_LOAD_TOPLEFT;
-    SRC(0,6)= (l5 + 2*l4 + l3 + 2) >> 2;
-    SRC(0,7)= (l6 + 2*l5 + l4 + 2) >> 2;
-    SRC(0,4)=SRC(1,6)= (l3 + 2*l2 + l1 + 2) >> 2;
-    SRC(0,5)=SRC(1,7)= (l4 + 2*l3 + l2 + 2) >> 2;
-    SRC(0,2)=SRC(1,4)=SRC(2,6)= (l1 + 2*l0 + lt + 2) >> 2;
-    SRC(0,3)=SRC(1,5)=SRC(2,7)= (l2 + 2*l1 + l0 + 2) >> 2;
-    SRC(0,1)=SRC(1,3)=SRC(2,5)=SRC(3,7)= (l0 + 2*lt + t0 + 2) >> 2;
-    SRC(0,0)=SRC(1,2)=SRC(2,4)=SRC(3,6)= (lt + t0 + 1) >> 1;
-    SRC(1,1)=SRC(2,3)=SRC(3,5)=SRC(4,7)= (lt + 2*t0 + t1 + 2) >> 2;
-    SRC(1,0)=SRC(2,2)=SRC(3,4)=SRC(4,6)= (t0 + t1 + 1) >> 1;
-    SRC(2,1)=SRC(3,3)=SRC(4,5)=SRC(5,7)= (t0 + 2*t1 + t2 + 2) >> 2;
-    SRC(2,0)=SRC(3,2)=SRC(4,4)=SRC(5,6)= (t1 + t2 + 1) >> 1;
-    SRC(3,1)=SRC(4,3)=SRC(5,5)=SRC(6,7)= (t1 + 2*t2 + t3 + 2) >> 2;
-    SRC(3,0)=SRC(4,2)=SRC(5,4)=SRC(6,6)= (t2 + t3 + 1) >> 1;
-    SRC(4,1)=SRC(5,3)=SRC(6,5)=SRC(7,7)= (t2 + 2*t3 + t4 + 2) >> 2;
-    SRC(4,0)=SRC(5,2)=SRC(6,4)=SRC(7,6)= (t3 + t4 + 1) >> 1;
-    SRC(5,1)=SRC(6,3)=SRC(7,5)= (t3 + 2*t4 + t5 + 2) >> 2;
-    SRC(5,0)=SRC(6,2)=SRC(7,4)= (t4 + t5 + 1) >> 1;
-    SRC(6,1)=SRC(7,3)= (t4 + 2*t5 + t6 + 2) >> 2;
-    SRC(6,0)=SRC(7,2)= (t5 + t6 + 1) >> 1;
-    SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2;
-    SRC(7,0)= (t6 + t7 + 1) >> 1;
-}
-static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_TOP;
-    PREDICT_8x8_LOAD_LEFT;
-    PREDICT_8x8_LOAD_TOPLEFT;
-    SRC(0,7)= (l6 + l7 + 1) >> 1;
-    SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2;
-    SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1;
-    SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2;
-    SRC(0,5)=SRC(2,6)=SRC(4,7)= (l4 + l5 + 1) >> 1;
-    SRC(1,5)=SRC(3,6)=SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2;
-    SRC(0,4)=SRC(2,5)=SRC(4,6)=SRC(6,7)= (l3 + l4 + 1) >> 1;
-    SRC(1,4)=SRC(3,5)=SRC(5,6)=SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2;
-    SRC(0,3)=SRC(2,4)=SRC(4,5)=SRC(6,6)= (l2 + l3 + 1) >> 1;
-    SRC(1,3)=SRC(3,4)=SRC(5,5)=SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2;
-    SRC(0,2)=SRC(2,3)=SRC(4,4)=SRC(6,5)= (l1 + l2 + 1) >> 1;
-    SRC(1,2)=SRC(3,3)=SRC(5,4)=SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2;
-    SRC(0,1)=SRC(2,2)=SRC(4,3)=SRC(6,4)= (l0 + l1 + 1) >> 1;
-    SRC(1,1)=SRC(3,2)=SRC(5,3)=SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2;
-    SRC(0,0)=SRC(2,1)=SRC(4,2)=SRC(6,3)= (lt + l0 + 1) >> 1;
-    SRC(1,0)=SRC(3,1)=SRC(5,2)=SRC(7,3)= (l0 + 2*lt + t0 + 2) >> 2;
-    SRC(2,0)=SRC(4,1)=SRC(6,2)= (t1 + 2*t0 + lt + 2) >> 2;
-    SRC(3,0)=SRC(5,1)=SRC(7,2)= (t2 + 2*t1 + t0 + 2) >> 2;
-    SRC(4,0)=SRC(6,1)= (t3 + 2*t2 + t1 + 2) >> 2;
-    SRC(5,0)=SRC(7,1)= (t4 + 2*t3 + t2 + 2) >> 2;
-    SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2;
-    SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2;
-}
-static void pred8x8l_vertical_left_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_TOP;
-    PREDICT_8x8_LOAD_TOPRIGHT;
-    SRC(0,0)= (t0 + t1 + 1) >> 1;
-    SRC(0,1)= (t0 + 2*t1 + t2 + 2) >> 2;
-    SRC(0,2)=SRC(1,0)= (t1 + t2 + 1) >> 1;
-    SRC(0,3)=SRC(1,1)= (t1 + 2*t2 + t3 + 2) >> 2;
-    SRC(0,4)=SRC(1,2)=SRC(2,0)= (t2 + t3 + 1) >> 1;
-    SRC(0,5)=SRC(1,3)=SRC(2,1)= (t2 + 2*t3 + t4 + 2) >> 2;
-    SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= (t3 + t4 + 1) >> 1;
-    SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= (t3 + 2*t4 + t5 + 2) >> 2;
-    SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= (t4 + t5 + 1) >> 1;
-    SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2;
-    SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1;
-    SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2;
-    SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1;
-    SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2;
-    SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1;
-    SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2;
-    SRC(5,6)=SRC(6,4)=SRC(7,2)= (t8 + t9 + 1) >> 1;
-    SRC(5,7)=SRC(6,5)=SRC(7,3)= (t8 + 2*t9 + t10 + 2) >> 2;
-    SRC(6,6)=SRC(7,4)= (t9 + t10 + 1) >> 1;
-    SRC(6,7)=SRC(7,5)= (t9 + 2*t10 + t11 + 2) >> 2;
-    SRC(7,6)= (t10 + t11 + 1) >> 1;
-    SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2;
-}
-static void pred8x8l_horizontal_up_c(uint8_t *src, int has_topleft, int has_topright, int stride)
-{
-    PREDICT_8x8_LOAD_LEFT;
-    SRC(0,0)= (l0 + l1 + 1) >> 1;
-    SRC(1,0)= (l0 + 2*l1 + l2 + 2) >> 2;
-    SRC(0,1)=SRC(2,0)= (l1 + l2 + 1) >> 1;
-    SRC(1,1)=SRC(3,0)= (l1 + 2*l2 + l3 + 2) >> 2;
-    SRC(0,2)=SRC(2,1)=SRC(4,0)= (l2 + l3 + 1) >> 1;
-    SRC(1,2)=SRC(3,1)=SRC(5,0)= (l2 + 2*l3 + l4 + 2) >> 2;
-    SRC(0,3)=SRC(2,2)=SRC(4,1)=SRC(6,0)= (l3 + l4 + 1) >> 1;
-    SRC(1,3)=SRC(3,2)=SRC(5,1)=SRC(7,0)= (l3 + 2*l4 + l5 + 2) >> 2;
-    SRC(0,4)=SRC(2,3)=SRC(4,2)=SRC(6,1)= (l4 + l5 + 1) >> 1;
-    SRC(1,4)=SRC(3,3)=SRC(5,2)=SRC(7,1)= (l4 + 2*l5 + l6 + 2) >> 2;
-    SRC(0,5)=SRC(2,4)=SRC(4,3)=SRC(6,2)= (l5 + l6 + 1) >> 1;
-    SRC(1,5)=SRC(3,4)=SRC(5,3)=SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2;
-    SRC(0,6)=SRC(2,5)=SRC(4,4)=SRC(6,3)= (l6 + l7 + 1) >> 1;
-    SRC(1,6)=SRC(3,5)=SRC(5,4)=SRC(7,3)= (l6 + 3*l7 + 2) >> 2;
-    SRC(0,7)=SRC(1,7)=SRC(2,6)=SRC(2,7)=SRC(3,6)=
-    SRC(3,7)=SRC(4,5)=SRC(4,6)=SRC(4,7)=SRC(5,5)=
-    SRC(5,6)=SRC(5,7)=SRC(6,4)=SRC(6,5)=SRC(6,6)=
-    SRC(6,7)=SRC(7,4)=SRC(7,5)=SRC(7,6)=SRC(7,7)= l7;
-}
-#undef PREDICT_8x8_LOAD_LEFT
-#undef PREDICT_8x8_LOAD_TOP
-#undef PREDICT_8x8_LOAD_TOPLEFT
-#undef PREDICT_8x8_LOAD_TOPRIGHT
-#undef PREDICT_8x8_DC
-#undef PTR
-#undef PT
-#undef PL
-#undef SRC
-
-static void pred4x4_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride){
-    int i;
-    pix -= stride;
-    for(i=0; i<4; i++){
-        uint8_t v = pix[0];
-        pix[1*stride]= v += block[0];
-        pix[2*stride]= v += block[4];
-        pix[3*stride]= v += block[8];
-        pix[4*stride]= v +  block[12];
-        pix++;
-        block++;
-    }
-}
-
-static void pred4x4_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride){
-    int i;
-    for(i=0; i<4; i++){
-        uint8_t v = pix[-1];
-        pix[0]= v += block[0];
-        pix[1]= v += block[1];
-        pix[2]= v += block[2];
-        pix[3]= v +  block[3];
-        pix+= stride;
-        block+= 4;
-    }
-}
-
-static void pred8x8l_vertical_add_c(uint8_t *pix, const DCTELEM *block, int stride){
-    int i;
-    pix -= stride;
-    for(i=0; i<8; i++){
-        uint8_t v = pix[0];
-        pix[1*stride]= v += block[0];
-        pix[2*stride]= v += block[8];
-        pix[3*stride]= v += block[16];
-        pix[4*stride]= v += block[24];
-        pix[5*stride]= v += block[32];
-        pix[6*stride]= v += block[40];
-        pix[7*stride]= v += block[48];
-        pix[8*stride]= v +  block[56];
-        pix++;
-        block++;
-    }
-}
-
-static void pred8x8l_horizontal_add_c(uint8_t *pix, const DCTELEM *block, int stride){
-    int i;
-    for(i=0; i<8; i++){
-        uint8_t v = pix[-1];
-        pix[0]= v += block[0];
-        pix[1]= v += block[1];
-        pix[2]= v += block[2];
-        pix[3]= v += block[3];
-        pix[4]= v += block[4];
-        pix[5]= v += block[5];
-        pix[6]= v += block[6];
-        pix[7]= v +  block[7];
-        pix+= stride;
-        block+= 8;
-    }
-}
-
-static void pred16x16_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
-    int i;
-    for(i=0; i<16; i++)
-        pred4x4_vertical_add_c(pix + block_offset[i], block + i*16, stride);
-}
-
-static void pred16x16_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
-    int i;
-    for(i=0; i<16; i++)
-        pred4x4_horizontal_add_c(pix + block_offset[i], block + i*16, stride);
-}
-
-static void pred8x8_vertical_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
-    int i;
-    for(i=0; i<4; i++)
-        pred4x4_vertical_add_c(pix + block_offset[i], block + i*16, stride);
-}
-
-static void pred8x8_horizontal_add_c(uint8_t *pix, const int *block_offset, const DCTELEM *block, int stride){
-    int i;
-    for(i=0; i<4; i++)
-        pred4x4_horizontal_add_c(pix + block_offset[i], block + i*16, stride);
-}
-
-
-/**
- * Sets the intra prediction function pointers.
- */
-void ff_h264_pred_init(H264PredContext *h, int codec_id){
-//    MpegEncContext * const s = &h->s;
-
-    if(codec_id != CODEC_ID_RV40){
-        h->pred4x4[VERT_PRED           ]= pred4x4_vertical_c;
-        h->pred4x4[HOR_PRED            ]= pred4x4_horizontal_c;
-        h->pred4x4[DC_PRED             ]= pred4x4_dc_c;
-        if(codec_id == CODEC_ID_SVQ3)
-            h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_svq3_c;
-        else
-            h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_c;
-        h->pred4x4[DIAG_DOWN_RIGHT_PRED]= pred4x4_down_right_c;
-        h->pred4x4[VERT_RIGHT_PRED     ]= pred4x4_vertical_right_c;
-        h->pred4x4[HOR_DOWN_PRED       ]= pred4x4_horizontal_down_c;
-        h->pred4x4[VERT_LEFT_PRED      ]= pred4x4_vertical_left_c;
-        h->pred4x4[HOR_UP_PRED         ]= pred4x4_horizontal_up_c;
-        h->pred4x4[LEFT_DC_PRED        ]= pred4x4_left_dc_c;
-        h->pred4x4[TOP_DC_PRED         ]= pred4x4_top_dc_c;
-        h->pred4x4[DC_128_PRED         ]= pred4x4_128_dc_c;
-    }else{
-        h->pred4x4[VERT_PRED           ]= pred4x4_vertical_c;
-        h->pred4x4[HOR_PRED            ]= pred4x4_horizontal_c;
-        h->pred4x4[DC_PRED             ]= pred4x4_dc_c;
-        h->pred4x4[DIAG_DOWN_LEFT_PRED ]= pred4x4_down_left_rv40_c;
-        h->pred4x4[DIAG_DOWN_RIGHT_PRED]= pred4x4_down_right_c;
-        h->pred4x4[VERT_RIGHT_PRED     ]= pred4x4_vertical_right_c;
-        h->pred4x4[HOR_DOWN_PRED       ]= pred4x4_horizontal_down_c;
-        h->pred4x4[VERT_LEFT_PRED      ]= pred4x4_vertical_left_rv40_c;
-        h->pred4x4[HOR_UP_PRED         ]= pred4x4_horizontal_up_rv40_c;
-        h->pred4x4[LEFT_DC_PRED        ]= pred4x4_left_dc_c;
-        h->pred4x4[TOP_DC_PRED         ]= pred4x4_top_dc_c;
-        h->pred4x4[DC_128_PRED         ]= pred4x4_128_dc_c;
-        h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= pred4x4_down_left_rv40_nodown_c;
-        h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= pred4x4_horizontal_up_rv40_nodown_c;
-        h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= pred4x4_vertical_left_rv40_nodown_c;
-    }
-
-    h->pred8x8l[VERT_PRED           ]= pred8x8l_vertical_c;
-    h->pred8x8l[HOR_PRED            ]= pred8x8l_horizontal_c;
-    h->pred8x8l[DC_PRED             ]= pred8x8l_dc_c;
-    h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= pred8x8l_down_left_c;
-    h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= pred8x8l_down_right_c;
-    h->pred8x8l[VERT_RIGHT_PRED     ]= pred8x8l_vertical_right_c;
-    h->pred8x8l[HOR_DOWN_PRED       ]= pred8x8l_horizontal_down_c;
-    h->pred8x8l[VERT_LEFT_PRED      ]= pred8x8l_vertical_left_c;
-    h->pred8x8l[HOR_UP_PRED         ]= pred8x8l_horizontal_up_c;
-    h->pred8x8l[LEFT_DC_PRED        ]= pred8x8l_left_dc_c;
-    h->pred8x8l[TOP_DC_PRED         ]= pred8x8l_top_dc_c;
-    h->pred8x8l[DC_128_PRED         ]= pred8x8l_128_dc_c;
-
-    h->pred8x8[VERT_PRED8x8   ]= pred8x8_vertical_c;
-    h->pred8x8[HOR_PRED8x8    ]= pred8x8_horizontal_c;
-    h->pred8x8[PLANE_PRED8x8  ]= pred8x8_plane_c;
-    if(codec_id != CODEC_ID_RV40){
-        h->pred8x8[DC_PRED8x8     ]= pred8x8_dc_c;
-        h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_c;
-        h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_c;
-        h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= pred8x8_mad_cow_dc_l0t;
-        h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= pred8x8_mad_cow_dc_0lt;
-        h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= pred8x8_mad_cow_dc_l00;
-        h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= pred8x8_mad_cow_dc_0l0;
-    }else{
-        h->pred8x8[DC_PRED8x8     ]= pred8x8_dc_rv40_c;
-        h->pred8x8[LEFT_DC_PRED8x8]= pred8x8_left_dc_rv40_c;
-        h->pred8x8[TOP_DC_PRED8x8 ]= pred8x8_top_dc_rv40_c;
-    }
-    h->pred8x8[DC_128_PRED8x8 ]= pred8x8_128_dc_c;
-
-    h->pred16x16[DC_PRED8x8     ]= pred16x16_dc_c;
-    h->pred16x16[VERT_PRED8x8   ]= pred16x16_vertical_c;
-    h->pred16x16[HOR_PRED8x8    ]= pred16x16_horizontal_c;
-    h->pred16x16[PLANE_PRED8x8  ]= pred16x16_plane_c;
-    switch(codec_id){
-    case CODEC_ID_SVQ3:
-       h->pred16x16[PLANE_PRED8x8  ]= pred16x16_plane_svq3_c;
-       break;
-    case CODEC_ID_RV40:
-       h->pred16x16[PLANE_PRED8x8  ]= pred16x16_plane_rv40_c;
-       break;
-    default:
-       h->pred16x16[PLANE_PRED8x8  ]= pred16x16_plane_c;
-    }
-    h->pred16x16[LEFT_DC_PRED8x8]= pred16x16_left_dc_c;
-    h->pred16x16[TOP_DC_PRED8x8 ]= pred16x16_top_dc_c;
-    h->pred16x16[DC_128_PRED8x8 ]= pred16x16_128_dc_c;
-
-    //special lossless h/v prediction for h264
-    h->pred4x4_add  [VERT_PRED   ]= pred4x4_vertical_add_c;
-    h->pred4x4_add  [ HOR_PRED   ]= pred4x4_horizontal_add_c;
-    h->pred8x8l_add [VERT_PRED   ]= pred8x8l_vertical_add_c;
-    h->pred8x8l_add [ HOR_PRED   ]= pred8x8l_horizontal_add_c;
-    h->pred8x8_add  [VERT_PRED8x8]= pred8x8_vertical_add_c;
-    h->pred8x8_add  [ HOR_PRED8x8]= pred8x8_horizontal_add_c;
-    h->pred16x16_add[VERT_PRED8x8]= pred16x16_vertical_add_c;
-    h->pred16x16_add[ HOR_PRED8x8]= pred16x16_horizontal_add_c;
-
-    if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id);
-}
diff --git a/libavcodec/h264pred.h b/libavcodec/h264pred.h
deleted file mode 100644
index c52aeaa..0000000
--- a/libavcodec/h264pred.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 prediction functions.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_H264PRED_H
-#define AVCODEC_H264PRED_H
-
-#include "libavutil/common.h"
-#include "dsputil.h"
-
-/**
- * Prediction types
- */
-//@{
-#define VERT_PRED             0
-#define HOR_PRED              1
-#define DC_PRED               2
-#define DIAG_DOWN_LEFT_PRED   3
-#define DIAG_DOWN_RIGHT_PRED  4
-#define VERT_RIGHT_PRED       5
-#define HOR_DOWN_PRED         6
-#define VERT_LEFT_PRED        7
-#define HOR_UP_PRED           8
-
-#define LEFT_DC_PRED          9
-#define TOP_DC_PRED           10
-#define DC_128_PRED           11
-
-#define DIAG_DOWN_LEFT_PRED_RV40_NODOWN   12
-#define HOR_UP_PRED_RV40_NODOWN           13
-#define VERT_LEFT_PRED_RV40_NODOWN        14
-
-#define DC_PRED8x8            0
-#define HOR_PRED8x8           1
-#define VERT_PRED8x8          2
-#define PLANE_PRED8x8         3
-
-#define LEFT_DC_PRED8x8       4
-#define TOP_DC_PRED8x8        5
-#define DC_128_PRED8x8        6
-
-#define ALZHEIMER_DC_L0T_PRED8x8 7
-#define ALZHEIMER_DC_0LT_PRED8x8 8
-#define ALZHEIMER_DC_L00_PRED8x8 9
-#define ALZHEIMER_DC_0L0_PRED8x8 10
-//@}
-
-/**
- * Context for storing H.264 prediction functions
- */
-typedef struct H264PredContext{
-    void (*pred4x4  [9+3+3])(uint8_t *src, uint8_t *topright, int stride);//FIXME move to dsp?
-    void (*pred8x8l [9+3])(uint8_t *src, int topleft, int topright, int stride);
-    void (*pred8x8  [4+3+4])(uint8_t *src, int stride);
-    void (*pred16x16[4+3])(uint8_t *src, int stride);
-
-    void (*pred4x4_add  [2])(uint8_t *pix/*align  4*/, const DCTELEM *block/*align 16*/, int stride);
-    void (*pred8x8l_add [2])(uint8_t *pix/*align  8*/, const DCTELEM *block/*align 16*/, int stride);
-    void (*pred8x8_add  [3])(uint8_t *pix/*align  8*/, const int *block_offset, const DCTELEM *block/*align 16*/, int stride);
-    void (*pred16x16_add[3])(uint8_t *pix/*align 16*/, const int *block_offset, const DCTELEM *block/*align 16*/, int stride);
-}H264PredContext;
-
-void ff_h264_pred_init(H264PredContext *h, int codec_id);
-void ff_h264_pred_init_arm(H264PredContext *h, int codec_id);
-
-#endif /* AVCODEC_H264PRED_H */
diff --git a/libavcodec/huffman.c b/libavcodec/huffman.c
deleted file mode 100644
index 853fa64..0000000
--- a/libavcodec/huffman.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * @file
- * huffman tree builder and VLC generator
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "huffman.h"
-
-/* symbol for Huffman tree node */
-#define HNODE -1
-
-
-static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat, Node *nodes, int node, uint32_t pfx, int pl, int *pos, int no_zero_count)
-{
-    int s;
-
-    s = nodes[node].sym;
-    if(s != HNODE || (no_zero_count && !nodes[node].count)){
-        bits[*pos] = pfx;
-        lens[*pos] = pl;
-        xlat[*pos] = s;
-        (*pos)++;
-    }else{
-        pfx <<= 1;
-        pl++;
-        get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0, pfx, pl, pos,
-                       no_zero_count);
-        pfx |= 1;
-        get_tree_codes(bits, lens, xlat, nodes, nodes[node].n0+1, pfx, pl, pos,
-                       no_zero_count);
-    }
-}
-
-static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
-{
-    int no_zero_count = !(flags & FF_HUFFMAN_FLAG_ZERO_COUNT);
-    uint32_t bits[256];
-    int16_t lens[256];
-    uint8_t xlat[256];
-    int pos = 0;
-
-    get_tree_codes(bits, lens, xlat, nodes, head, 0, 0, &pos, no_zero_count);
-    return init_vlc_sparse(vlc, 9, pos, lens, 2, 2, bits, 4, 4, xlat, 1, 1, 0);
-}
-
-
-/**
- * nodes size must be 2*nb_codes
- * first nb_codes nodes.count must be set
- */
-int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
-                       Node *nodes, HuffCmp cmp, int flags)
-{
-    int i, j;
-    int cur_node;
-    int64_t sum = 0;
-
-    for(i = 0; i < nb_codes; i++){
-        nodes[i].sym = i;
-        nodes[i].n0 = -2;
-        sum += nodes[i].count;
-    }
-
-    if(sum >> 31) {
-        av_log(avctx, AV_LOG_ERROR, "Too high symbol frequencies. Tree construction is not possible\n");
-        return -1;
-    }
-    qsort(nodes, nb_codes, sizeof(Node), cmp);
-    cur_node = nb_codes;
-    nodes[nb_codes*2-1].count = 0;
-    for(i = 0; i < nb_codes*2-1; i += 2){
-        nodes[cur_node].sym = HNODE;
-        nodes[cur_node].count = nodes[i].count + nodes[i+1].count;
-        nodes[cur_node].n0 = i;
-        for(j = cur_node; j > 0; j--){
-            if(nodes[j].count > nodes[j-1].count ||
-               (nodes[j].count == nodes[j-1].count &&
-                (!(flags & FF_HUFFMAN_FLAG_HNODE_FIRST) ||
-                 nodes[j].n0==j-1 || nodes[j].n0==j-2 ||
-                 (nodes[j].sym!=HNODE && nodes[j-1].sym!=HNODE))))
-                break;
-            FFSWAP(Node, nodes[j], nodes[j-1]);
-        }
-        cur_node++;
-    }
-    if(build_huff_tree(vlc, nodes, nb_codes*2-2, flags) < 0){
-        av_log(avctx, AV_LOG_ERROR, "Error building tree\n");
-        return -1;
-    }
-    return 0;
-}
diff --git a/libavcodec/huffman.h b/libavcodec/huffman.h
deleted file mode 100644
index 3c08e6f..0000000
--- a/libavcodec/huffman.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @file
- * huffman tree builder and VLC generator
- * Copyright (C) 2007  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_HUFFMAN_H
-#define AVCODEC_HUFFMAN_H
-
-#include "avcodec.h"
-#include "get_bits.h"
-
-typedef struct {
-    int16_t  sym;
-    int16_t  n0;
-    uint32_t count;
-} Node;
-
-#define FF_HUFFMAN_FLAG_HNODE_FIRST 0x01
-#define FF_HUFFMAN_FLAG_ZERO_COUNT  0x02
-
-typedef int (*HuffCmp)(const void *va, const void *vb);
-int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
-                       Node *nodes, HuffCmp cmp, int flags);
-
-#endif /* AVCODEC_HUFFMAN_H */
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
deleted file mode 100644
index 7764c35..0000000
--- a/libavcodec/huffyuv.c
+++ /dev/null
@@ -1,1475 +0,0 @@
-/*
- * huffyuv codec for libavcodec
- *
- * Copyright (c) 2002-2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * see http://www.pcisys.net/~melanson/codecs/huffyuv.txt for a description of
- * the algorithm used
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * huffyuv codec for libavcodec.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "dsputil.h"
-
-#define VLC_BITS 11
-
-#if HAVE_BIGENDIAN
-#define B 3
-#define G 2
-#define R 1
-#define A 0
-#else
-#define B 0
-#define G 1
-#define R 2
-#define A 3
-#endif
-
-typedef enum Predictor{
-    LEFT= 0,
-    PLANE,
-    MEDIAN,
-} Predictor;
-
-typedef struct HYuvContext{
-    AVCodecContext *avctx;
-    Predictor predictor;
-    GetBitContext gb;
-    PutBitContext pb;
-    int interlaced;
-    int decorrelate;
-    int bitstream_bpp;
-    int version;
-    int yuy2;                               //use yuy2 instead of 422P
-    int bgr32;                              //use bgr32 instead of bgr24
-    int width, height;
-    int flags;
-    int context;
-    int picture_number;
-    int last_slice_end;
-    uint8_t *temp[3];
-    uint64_t stats[3][256];
-    uint8_t len[3][256];
-    uint32_t bits[3][256];
-    uint32_t pix_bgr_map[1<<VLC_BITS];
-    VLC vlc[6];                             //Y,U,V,YY,YU,YV
-    AVFrame picture;
-    uint8_t *bitstream_buffer;
-    unsigned int bitstream_buffer_size;
-    DSPContext dsp;
-}HYuvContext;
-
-static const unsigned char classic_shift_luma[] = {
-  34,36,35,69,135,232,9,16,10,24,11,23,12,16,13,10,14,8,15,8,
-  16,8,17,20,16,10,207,206,205,236,11,8,10,21,9,23,8,8,199,70,
-  69,68, 0
-};
-
-static const unsigned char classic_shift_chroma[] = {
-  66,36,37,38,39,40,41,75,76,77,110,239,144,81,82,83,84,85,118,183,
-  56,57,88,89,56,89,154,57,58,57,26,141,57,56,58,57,58,57,184,119,
-  214,245,116,83,82,49,80,79,78,77,44,75,41,40,39,38,37,36,34, 0
-};
-
-static const unsigned char classic_add_luma[256] = {
-    3,  9,  5, 12, 10, 35, 32, 29, 27, 50, 48, 45, 44, 41, 39, 37,
-   73, 70, 68, 65, 64, 61, 58, 56, 53, 50, 49, 46, 44, 41, 38, 36,
-   68, 65, 63, 61, 58, 55, 53, 51, 48, 46, 45, 43, 41, 39, 38, 36,
-   35, 33, 32, 30, 29, 27, 26, 25, 48, 47, 46, 44, 43, 41, 40, 39,
-   37, 36, 35, 34, 32, 31, 30, 28, 27, 26, 24, 23, 22, 20, 19, 37,
-   35, 34, 33, 31, 30, 29, 27, 26, 24, 23, 21, 20, 18, 17, 15, 29,
-   27, 26, 24, 22, 21, 19, 17, 16, 14, 26, 25, 23, 21, 19, 18, 16,
-   15, 27, 25, 23, 21, 19, 17, 16, 14, 26, 25, 23, 21, 18, 17, 14,
-   12, 17, 19, 13,  4,  9,  2, 11,  1,  7,  8,  0, 16,  3, 14,  6,
-   12, 10,  5, 15, 18, 11, 10, 13, 15, 16, 19, 20, 22, 24, 27, 15,
-   18, 20, 22, 24, 26, 14, 17, 20, 22, 24, 27, 15, 18, 20, 23, 25,
-   28, 16, 19, 22, 25, 28, 32, 36, 21, 25, 29, 33, 38, 42, 45, 49,
-   28, 31, 34, 37, 40, 42, 44, 47, 49, 50, 52, 54, 56, 57, 59, 60,
-   62, 64, 66, 67, 69, 35, 37, 39, 40, 42, 43, 45, 47, 48, 51, 52,
-   54, 55, 57, 59, 60, 62, 63, 66, 67, 69, 71, 72, 38, 40, 42, 43,
-   46, 47, 49, 51, 26, 28, 30, 31, 33, 34, 18, 19, 11, 13,  7,  8,
-};
-
-static const unsigned char classic_add_chroma[256] = {
-    3,  1,  2,  2,  2,  2,  3,  3,  7,  5,  7,  5,  8,  6, 11,  9,
-    7, 13, 11, 10,  9,  8,  7,  5,  9,  7,  6,  4,  7,  5,  8,  7,
-   11,  8, 13, 11, 19, 15, 22, 23, 20, 33, 32, 28, 27, 29, 51, 77,
-   43, 45, 76, 81, 46, 82, 75, 55, 56,144, 58, 80, 60, 74,147, 63,
-  143, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
-   80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 27, 30, 21, 22,
-   17, 14,  5,  6,100, 54, 47, 50, 51, 53,106,107,108,109,110,111,
-  112,113,114,115,  4,117,118, 92, 94,121,122,  3,124,103,  2,  1,
-    0,129,130,131,120,119,126,125,136,137,138,139,140,141,142,134,
-  135,132,133,104, 64,101, 62, 57,102, 95, 93, 59, 61, 28, 97, 96,
-   52, 49, 48, 29, 32, 25, 24, 46, 23, 98, 45, 44, 43, 20, 42, 41,
-   19, 18, 99, 40, 15, 39, 38, 16, 13, 12, 11, 37, 10,  9,  8, 36,
-    7,128,127,105,123,116, 35, 34, 33,145, 31, 79, 42,146, 78, 26,
-   83, 48, 49, 50, 44, 47, 26, 31, 30, 18, 17, 19, 21, 24, 25, 13,
-   14, 16, 17, 18, 20, 21, 12, 14, 15,  9, 10,  6,  9,  6,  5,  8,
-    6, 12,  8, 10,  7,  9,  6,  4,  6,  2,  2,  3,  3,  3,  3,  2,
-};
-
-static inline int sub_left_prediction(HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int left){
-    int i;
-    if(w<32){
-        for(i=0; i<w; i++){
-            const int temp= src[i];
-            dst[i]= temp - left;
-            left= temp;
-        }
-        return left;
-    }else{
-        for(i=0; i<16; i++){
-            const int temp= src[i];
-            dst[i]= temp - left;
-            left= temp;
-        }
-        s->dsp.diff_bytes(dst+16, src+16, src+15, w-16);
-        return src[w-1];
-    }
-}
-
-static inline void sub_left_prediction_bgr32(HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue){
-    int i;
-    int r,g,b;
-    r= *red;
-    g= *green;
-    b= *blue;
-    for(i=0; i<FFMIN(w,4); i++){
-        const int rt= src[i*4+R];
-        const int gt= src[i*4+G];
-        const int bt= src[i*4+B];
-        dst[i*4+R]= rt - r;
-        dst[i*4+G]= gt - g;
-        dst[i*4+B]= bt - b;
-        r = rt;
-        g = gt;
-        b = bt;
-    }
-    s->dsp.diff_bytes(dst+16, src+16, src+12, w*4-16);
-    *red=   src[(w-1)*4+R];
-    *green= src[(w-1)*4+G];
-    *blue=  src[(w-1)*4+B];
-}
-
-static int read_len_table(uint8_t *dst, GetBitContext *gb){
-    int i, val, repeat;
-
-    for(i=0; i<256;){
-        repeat= get_bits(gb, 3);
-        val   = get_bits(gb, 5);
-        if(repeat==0)
-            repeat= get_bits(gb, 8);
-//printf("%d %d\n", val, repeat);
-        if(i+repeat > 256) {
-            av_log(NULL, AV_LOG_ERROR, "Error reading huffman table\n");
-            return -1;
-        }
-        while (repeat--)
-            dst[i++] = val;
-    }
-    return 0;
-}
-
-static int generate_bits_table(uint32_t *dst, const uint8_t *len_table){
-    int len, index;
-    uint32_t bits=0;
-
-    for(len=32; len>0; len--){
-        for(index=0; index<256; index++){
-            if(len_table[index]==len)
-                dst[index]= bits++;
-        }
-        if(bits & 1){
-            av_log(NULL, AV_LOG_ERROR, "Error generating huffman table\n");
-            return -1;
-        }
-        bits >>= 1;
-    }
-    return 0;
-}
-
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-typedef struct {
-    uint64_t val;
-    int name;
-} HeapElem;
-
-static void heap_sift(HeapElem *h, int root, int size)
-{
-    while(root*2+1 < size) {
-        int child = root*2+1;
-        if(child < size-1 && h[child].val > h[child+1].val)
-            child++;
-        if(h[root].val > h[child].val) {
-            FFSWAP(HeapElem, h[root], h[child]);
-            root = child;
-        } else
-            break;
-    }
-}
-
-static void generate_len_table(uint8_t *dst, const uint64_t *stats, int size){
-    HeapElem h[size];
-    int up[2*size];
-    int len[2*size];
-    int offset, i, next;
-
-    for(offset=1; ; offset<<=1){
-        for(i=0; i<size; i++){
-            h[i].name = i;
-            h[i].val = (stats[i] << 8) + offset;
-        }
-        for(i=size/2-1; i>=0; i--)
-            heap_sift(h, i, size);
-
-        for(next=size; next<size*2-1; next++){
-            // merge the two smallest entries, and put it back in the heap
-            uint64_t min1v = h[0].val;
-            up[h[0].name] = next;
-            h[0].val = INT64_MAX;
-            heap_sift(h, 0, size);
-            up[h[0].name] = next;
-            h[0].name = next;
-            h[0].val += min1v;
-            heap_sift(h, 0, size);
-        }
-
-        len[2*size-2] = 0;
-        for(i=2*size-3; i>=size; i--)
-            len[i] = len[up[i]] + 1;
-        for(i=0; i<size; i++) {
-            dst[i] = len[up[i]] + 1;
-            if(dst[i] >= 32) break;
-        }
-        if(i==size) break;
-    }
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-static void generate_joint_tables(HYuvContext *s){
-    uint16_t symbols[1<<VLC_BITS];
-    uint16_t bits[1<<VLC_BITS];
-    uint8_t len[1<<VLC_BITS];
-    if(s->bitstream_bpp < 24){
-        int p, i, y, u;
-        for(p=0; p<3; p++){
-            for(i=y=0; y<256; y++){
-                int len0 = s->len[0][y];
-                int limit = VLC_BITS - len0;
-                if(limit <= 0)
-                    continue;
-                for(u=0; u<256; u++){
-                    int len1 = s->len[p][u];
-                    if(len1 > limit)
-                        continue;
-                    len[i] = len0 + len1;
-                    bits[i] = (s->bits[0][y] << len1) + s->bits[p][u];
-                    symbols[i] = (y<<8) + u;
-                    if(symbols[i] != 0xffff) // reserved to mean "invalid"
-                        i++;
-                }
-            }
-            free_vlc(&s->vlc[3+p]);
-            init_vlc_sparse(&s->vlc[3+p], VLC_BITS, i, len, 1, 1, bits, 2, 2, symbols, 2, 2, 0);
-        }
-    }else{
-        uint8_t (*map)[4] = (uint8_t(*)[4])s->pix_bgr_map;
-        int i, b, g, r, code;
-        int p0 = s->decorrelate;
-        int p1 = !s->decorrelate;
-        // restrict the range to +/-16 becaues that's pretty much guaranteed to
-        // cover all the combinations that fit in 11 bits total, and it doesn't
-        // matter if we miss a few rare codes.
-        for(i=0, g=-16; g<16; g++){
-            int len0 = s->len[p0][g&255];
-            int limit0 = VLC_BITS - len0;
-            if(limit0 < 2)
-                continue;
-            for(b=-16; b<16; b++){
-                int len1 = s->len[p1][b&255];
-                int limit1 = limit0 - len1;
-                if(limit1 < 1)
-                    continue;
-                code = (s->bits[p0][g&255] << len1) + s->bits[p1][b&255];
-                for(r=-16; r<16; r++){
-                    int len2 = s->len[2][r&255];
-                    if(len2 > limit1)
-                        continue;
-                    len[i] = len0 + len1 + len2;
-                    bits[i] = (code << len2) + s->bits[2][r&255];
-                    if(s->decorrelate){
-                        map[i][G] = g;
-                        map[i][B] = g+b;
-                        map[i][R] = g+r;
-                    }else{
-                        map[i][B] = g;
-                        map[i][G] = b;
-                        map[i][R] = r;
-                    }
-                    i++;
-                }
-            }
-        }
-        free_vlc(&s->vlc[3]);
-        init_vlc(&s->vlc[3], VLC_BITS, i, len, 1, 1, bits, 2, 2, 0);
-    }
-}
-
-static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){
-    GetBitContext gb;
-    int i;
-
-    init_get_bits(&gb, src, length*8);
-
-    for(i=0; i<3; i++){
-        if(read_len_table(s->len[i], &gb)<0)
-            return -1;
-        if(generate_bits_table(s->bits[i], s->len[i])<0){
-            return -1;
-        }
-#if 0
-for(j=0; j<256; j++){
-printf("%6X, %2d,  %3d\n", s->bits[i][j], s->len[i][j], j);
-}
-#endif
-        free_vlc(&s->vlc[i]);
-        init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0);
-    }
-
-    generate_joint_tables(s);
-
-    return (get_bits_count(&gb)+7)/8;
-}
-
-static int read_old_huffman_tables(HYuvContext *s){
-#if 1
-    GetBitContext gb;
-    int i;
-
-    init_get_bits(&gb, classic_shift_luma, sizeof(classic_shift_luma)*8);
-    if(read_len_table(s->len[0], &gb)<0)
-        return -1;
-    init_get_bits(&gb, classic_shift_chroma, sizeof(classic_shift_chroma)*8);
-    if(read_len_table(s->len[1], &gb)<0)
-        return -1;
-
-    for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma  [i];
-    for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i];
-
-    if(s->bitstream_bpp >= 24){
-        memcpy(s->bits[1], s->bits[0], 256*sizeof(uint32_t));
-        memcpy(s->len[1] , s->len [0], 256*sizeof(uint8_t));
-    }
-    memcpy(s->bits[2], s->bits[1], 256*sizeof(uint32_t));
-    memcpy(s->len[2] , s->len [1], 256*sizeof(uint8_t));
-
-    for(i=0; i<3; i++){
-        free_vlc(&s->vlc[i]);
-        init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0);
-    }
-
-    generate_joint_tables(s);
-
-    return 0;
-#else
-    av_log(s->avctx, AV_LOG_DEBUG, "v1 huffyuv is not supported \n");
-    return -1;
-#endif
-}
-
-static av_cold void alloc_temp(HYuvContext *s){
-    int i;
-
-    if(s->bitstream_bpp<24){
-        for(i=0; i<3; i++){
-            s->temp[i]= av_malloc(s->width + 16);
-        }
-    }else{
-        s->temp[0]= av_mallocz(4*s->width + 16);
-    }
-}
-
-static av_cold int common_init(AVCodecContext *avctx){
-    HYuvContext *s = avctx->priv_data;
-
-    s->avctx= avctx;
-    s->flags= avctx->flags;
-
-    dsputil_init(&s->dsp, avctx);
-
-    s->width= avctx->width;
-    s->height= avctx->height;
-    assert(s->width>0 && s->height>0);
-
-    return 0;
-}
-
-#if CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    HYuvContext *s = avctx->priv_data;
-
-    common_init(avctx);
-    memset(s->vlc, 0, 3*sizeof(VLC));
-
-    avctx->coded_frame= &s->picture;
-    s->interlaced= s->height > 288;
-
-s->bgr32=1;
-//if(avctx->extradata)
-//  printf("extradata:%X, extradata_size:%d\n", *(uint32_t*)avctx->extradata, avctx->extradata_size);
-    if(avctx->extradata_size){
-        if((avctx->bits_per_coded_sample&7) && avctx->bits_per_coded_sample != 12)
-            s->version=1; // do such files exist at all?
-        else
-            s->version=2;
-    }else
-        s->version=0;
-
-    if(s->version==2){
-        int method, interlace;
-
-        if (avctx->extradata_size < 4)
-            return -1;
-
-        method= ((uint8_t*)avctx->extradata)[0];
-        s->decorrelate= method&64 ? 1 : 0;
-        s->predictor= method&63;
-        s->bitstream_bpp= ((uint8_t*)avctx->extradata)[1];
-        if(s->bitstream_bpp==0)
-            s->bitstream_bpp= avctx->bits_per_coded_sample&~7;
-        interlace= (((uint8_t*)avctx->extradata)[2] & 0x30) >> 4;
-        s->interlaced= (interlace==1) ? 1 : (interlace==2) ? 0 : s->interlaced;
-        s->context= ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;
-
-        if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size-4) < 0)
-            return -1;
-    }else{
-        switch(avctx->bits_per_coded_sample&7){
-        case 1:
-            s->predictor= LEFT;
-            s->decorrelate= 0;
-            break;
-        case 2:
-            s->predictor= LEFT;
-            s->decorrelate= 1;
-            break;
-        case 3:
-            s->predictor= PLANE;
-            s->decorrelate= avctx->bits_per_coded_sample >= 24;
-            break;
-        case 4:
-            s->predictor= MEDIAN;
-            s->decorrelate= 0;
-            break;
-        default:
-            s->predictor= LEFT; //OLD
-            s->decorrelate= 0;
-            break;
-        }
-        s->bitstream_bpp= avctx->bits_per_coded_sample & ~7;
-        s->context= 0;
-
-        if(read_old_huffman_tables(s) < 0)
-            return -1;
-    }
-
-    switch(s->bitstream_bpp){
-    case 12:
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-        break;
-    case 16:
-        if(s->yuy2){
-            avctx->pix_fmt = PIX_FMT_YUYV422;
-        }else{
-            avctx->pix_fmt = PIX_FMT_YUV422P;
-        }
-        break;
-    case 24:
-    case 32:
-        if(s->bgr32){
-            avctx->pix_fmt = PIX_FMT_RGB32;
-        }else{
-            avctx->pix_fmt = PIX_FMT_BGR24;
-        }
-        break;
-    default:
-        assert(0);
-    }
-
-    alloc_temp(s);
-
-//    av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);
-
-    return 0;
-}
-#endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */
-
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-static int store_table(HYuvContext *s, const uint8_t *len, uint8_t *buf){
-    int i;
-    int index= 0;
-
-    for(i=0; i<256;){
-        int val= len[i];
-        int repeat=0;
-
-        for(; i<256 && len[i]==val && repeat<255; i++)
-            repeat++;
-
-        assert(val < 32 && val >0 && repeat<256 && repeat>0);
-        if(repeat>7){
-            buf[index++]= val;
-            buf[index++]= repeat;
-        }else{
-            buf[index++]= val | (repeat<<5);
-        }
-    }
-
-    return index;
-}
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    HYuvContext *s = avctx->priv_data;
-    int i, j;
-
-    common_init(avctx);
-
-    avctx->extradata= av_mallocz(1024*30); // 256*3+4 == 772
-    avctx->stats_out= av_mallocz(1024*30); // 21*256*3(%llu ) + 3(\n) + 1(0) = 16132
-    s->version=2;
-
-    avctx->coded_frame= &s->picture;
-
-    switch(avctx->pix_fmt){
-    case PIX_FMT_YUV420P:
-        s->bitstream_bpp= 12;
-        break;
-    case PIX_FMT_YUV422P:
-        s->bitstream_bpp= 16;
-        break;
-    case PIX_FMT_RGB32:
-        s->bitstream_bpp= 24;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "format not supported\n");
-        return -1;
-    }
-    avctx->bits_per_coded_sample= s->bitstream_bpp;
-    s->decorrelate= s->bitstream_bpp >= 24;
-    s->predictor= avctx->prediction_method;
-    s->interlaced= avctx->flags&CODEC_FLAG_INTERLACED_ME ? 1 : 0;
-    if(avctx->context_model==1){
-        s->context= avctx->context_model;
-        if(s->flags & (CODEC_FLAG_PASS1|CODEC_FLAG_PASS2)){
-            av_log(avctx, AV_LOG_ERROR, "context=1 is not compatible with 2 pass huffyuv encoding\n");
-            return -1;
-        }
-    }else s->context= 0;
-
-    if(avctx->codec->id==CODEC_ID_HUFFYUV){
-        if(avctx->pix_fmt==PIX_FMT_YUV420P){
-            av_log(avctx, AV_LOG_ERROR, "Error: YV12 is not supported by huffyuv; use vcodec=ffvhuff or format=422p\n");
-            return -1;
-        }
-        if(avctx->context_model){
-            av_log(avctx, AV_LOG_ERROR, "Error: per-frame huffman tables are not supported by huffyuv; use vcodec=ffvhuff\n");
-            return -1;
-        }
-        if(s->interlaced != ( s->height > 288 ))
-            av_log(avctx, AV_LOG_INFO, "using huffyuv 2.2.0 or newer interlacing flag\n");
-    }
-
-    if(s->bitstream_bpp>=24 && s->predictor==MEDIAN){
-        av_log(avctx, AV_LOG_ERROR, "Error: RGB is incompatible with median predictor\n");
-        return -1;
-    }
-
-    ((uint8_t*)avctx->extradata)[0]= s->predictor | (s->decorrelate << 6);
-    ((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp;
-    ((uint8_t*)avctx->extradata)[2]= s->interlaced ? 0x10 : 0x20;
-    if(s->context)
-        ((uint8_t*)avctx->extradata)[2]|= 0x40;
-    ((uint8_t*)avctx->extradata)[3]= 0;
-    s->avctx->extradata_size= 4;
-
-    if(avctx->stats_in){
-        char *p= avctx->stats_in;
-
-        for(i=0; i<3; i++)
-            for(j=0; j<256; j++)
-                s->stats[i][j]= 1;
-
-        for(;;){
-            for(i=0; i<3; i++){
-                char *next;
-
-                for(j=0; j<256; j++){
-                    s->stats[i][j]+= strtol(p, &next, 0);
-                    if(next==p) return -1;
-                    p=next;
-                }
-            }
-            if(p[0]==0 || p[1]==0 || p[2]==0) break;
-        }
-    }else{
-        for(i=0; i<3; i++)
-            for(j=0; j<256; j++){
-                int d= FFMIN(j, 256-j);
-
-                s->stats[i][j]= 100000000/(d+1);
-            }
-    }
-
-    for(i=0; i<3; i++){
-        generate_len_table(s->len[i], s->stats[i], 256);
-
-        if(generate_bits_table(s->bits[i], s->len[i])<0){
-            return -1;
-        }
-
-        s->avctx->extradata_size+=
-        store_table(s, s->len[i], &((uint8_t*)s->avctx->extradata)[s->avctx->extradata_size]);
-    }
-
-    if(s->context){
-        for(i=0; i<3; i++){
-            int pels = s->width*s->height / (i?40:10);
-            for(j=0; j<256; j++){
-                int d= FFMIN(j, 256-j);
-                s->stats[i][j]= pels/(d+1);
-            }
-        }
-    }else{
-        for(i=0; i<3; i++)
-            for(j=0; j<256; j++)
-                s->stats[i][j]= 0;
-    }
-
-//    printf("pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);
-
-    alloc_temp(s);
-
-    s->picture_number=0;
-
-    return 0;
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-/* TODO instead of restarting the read when the code isn't in the first level
- * of the joint table, jump into the 2nd level of the individual table. */
-#define READ_2PIX(dst0, dst1, plane1){\
-    uint16_t code = get_vlc2(&s->gb, s->vlc[3+plane1].table, VLC_BITS, 1);\
-    if(code != 0xffff){\
-        dst0 = code>>8;\
-        dst1 = code;\
-    }else{\
-        dst0 = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3);\
-        dst1 = get_vlc2(&s->gb, s->vlc[plane1].table, VLC_BITS, 3);\
-    }\
-}
-
-static void decode_422_bitstream(HYuvContext *s, int count){
-    int i;
-
-    count/=2;
-
-    if(count >= (get_bits_left(&s->gb))/(31*4)){
-        for(i=0; i<count && get_bits_count(&s->gb) < s->gb.size_in_bits; i++){
-            READ_2PIX(s->temp[0][2*i  ], s->temp[1][i], 1);
-            READ_2PIX(s->temp[0][2*i+1], s->temp[2][i], 2);
-        }
-    }else{
-        for(i=0; i<count; i++){
-            READ_2PIX(s->temp[0][2*i  ], s->temp[1][i], 1);
-            READ_2PIX(s->temp[0][2*i+1], s->temp[2][i], 2);
-        }
-    }
-}
-
-static void decode_gray_bitstream(HYuvContext *s, int count){
-    int i;
-
-    count/=2;
-
-    if(count >= (get_bits_left(&s->gb))/(31*2)){
-        for(i=0; i<count && get_bits_count(&s->gb) < s->gb.size_in_bits; i++){
-            READ_2PIX(s->temp[0][2*i  ], s->temp[0][2*i+1], 0);
-        }
-    }else{
-        for(i=0; i<count; i++){
-            READ_2PIX(s->temp[0][2*i  ], s->temp[0][2*i+1], 0);
-        }
-    }
-}
-
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-static int encode_422_bitstream(HYuvContext *s, int offset, int count){
-    int i;
-    const uint8_t *y = s->temp[0] + offset;
-    const uint8_t *u = s->temp[1] + offset/2;
-    const uint8_t *v = s->temp[2] + offset/2;
-
-    if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 2*4*count){
-        av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-
-#define LOAD4\
-            int y0 = y[2*i];\
-            int y1 = y[2*i+1];\
-            int u0 = u[i];\
-            int v0 = v[i];
-
-    count/=2;
-    if(s->flags&CODEC_FLAG_PASS1){
-        for(i=0; i<count; i++){
-            LOAD4;
-            s->stats[0][y0]++;
-            s->stats[1][u0]++;
-            s->stats[0][y1]++;
-            s->stats[2][v0]++;
-        }
-    }
-    if(s->avctx->flags2&CODEC_FLAG2_NO_OUTPUT)
-        return 0;
-    if(s->context){
-        for(i=0; i<count; i++){
-            LOAD4;
-            s->stats[0][y0]++;
-            put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);
-            s->stats[1][u0]++;
-            put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]);
-            s->stats[0][y1]++;
-            put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
-            s->stats[2][v0]++;
-            put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]);
-        }
-    }else{
-        for(i=0; i<count; i++){
-            LOAD4;
-            put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);
-            put_bits(&s->pb, s->len[1][u0], s->bits[1][u0]);
-            put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
-            put_bits(&s->pb, s->len[2][v0], s->bits[2][v0]);
-        }
-    }
-    return 0;
-}
-
-static int encode_gray_bitstream(HYuvContext *s, int count){
-    int i;
-
-    if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 4*count){
-        av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-
-#define LOAD2\
-            int y0 = s->temp[0][2*i];\
-            int y1 = s->temp[0][2*i+1];
-#define STAT2\
-            s->stats[0][y0]++;\
-            s->stats[0][y1]++;
-#define WRITE2\
-            put_bits(&s->pb, s->len[0][y0], s->bits[0][y0]);\
-            put_bits(&s->pb, s->len[0][y1], s->bits[0][y1]);
-
-    count/=2;
-    if(s->flags&CODEC_FLAG_PASS1){
-        for(i=0; i<count; i++){
-            LOAD2;
-            STAT2;
-        }
-    }
-    if(s->avctx->flags2&CODEC_FLAG2_NO_OUTPUT)
-        return 0;
-
-    if(s->context){
-        for(i=0; i<count; i++){
-            LOAD2;
-            STAT2;
-            WRITE2;
-        }
-    }else{
-        for(i=0; i<count; i++){
-            LOAD2;
-            WRITE2;
-        }
-    }
-    return 0;
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha){
-    int i;
-    for(i=0; i<count; i++){
-        int code = get_vlc2(&s->gb, s->vlc[3].table, VLC_BITS, 1);
-        if(code != -1){
-            *(uint32_t*)&s->temp[0][4*i] = s->pix_bgr_map[code];
-        }else if(decorrelate){
-            s->temp[0][4*i+G] = get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3);
-            s->temp[0][4*i+B] = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3) + s->temp[0][4*i+G];
-            s->temp[0][4*i+R] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3) + s->temp[0][4*i+G];
-        }else{
-            s->temp[0][4*i+B] = get_vlc2(&s->gb, s->vlc[0].table, VLC_BITS, 3);
-            s->temp[0][4*i+G] = get_vlc2(&s->gb, s->vlc[1].table, VLC_BITS, 3);
-            s->temp[0][4*i+R] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3);
-        }
-        if(alpha)
-            s->temp[0][4*i+A] = get_vlc2(&s->gb, s->vlc[2].table, VLC_BITS, 3);
-    }
-}
-
-static void decode_bgr_bitstream(HYuvContext *s, int count){
-    if(s->decorrelate){
-        if(s->bitstream_bpp==24)
-            decode_bgr_1(s, count, 1, 0);
-        else
-            decode_bgr_1(s, count, 1, 1);
-    }else{
-        if(s->bitstream_bpp==24)
-            decode_bgr_1(s, count, 0, 0);
-        else
-            decode_bgr_1(s, count, 0, 1);
-    }
-}
-
-static int encode_bgr_bitstream(HYuvContext *s, int count){
-    int i;
-
-    if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 3*4*count){
-        av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-
-#define LOAD3\
-            int g= s->temp[0][4*i+G];\
-            int b= (s->temp[0][4*i+B] - g) & 0xff;\
-            int r= (s->temp[0][4*i+R] - g) & 0xff;
-#define STAT3\
-            s->stats[0][b]++;\
-            s->stats[1][g]++;\
-            s->stats[2][r]++;
-#define WRITE3\
-            put_bits(&s->pb, s->len[1][g], s->bits[1][g]);\
-            put_bits(&s->pb, s->len[0][b], s->bits[0][b]);\
-            put_bits(&s->pb, s->len[2][r], s->bits[2][r]);
-
-    if((s->flags&CODEC_FLAG_PASS1) && (s->avctx->flags2&CODEC_FLAG2_NO_OUTPUT)){
-        for(i=0; i<count; i++){
-            LOAD3;
-            STAT3;
-        }
-    }else if(s->context || (s->flags&CODEC_FLAG_PASS1)){
-        for(i=0; i<count; i++){
-            LOAD3;
-            STAT3;
-            WRITE3;
-        }
-    }else{
-        for(i=0; i<count; i++){
-            LOAD3;
-            WRITE3;
-        }
-    }
-    return 0;
-}
-
-#if CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER
-static void draw_slice(HYuvContext *s, int y){
-    int h, cy;
-    int offset[4];
-
-    if(s->avctx->draw_horiz_band==NULL)
-        return;
-
-    h= y - s->last_slice_end;
-    y -= h;
-
-    if(s->bitstream_bpp==12){
-        cy= y>>1;
-    }else{
-        cy= y;
-    }
-
-    offset[0] = s->picture.linesize[0]*y;
-    offset[1] = s->picture.linesize[1]*cy;
-    offset[2] = s->picture.linesize[2]*cy;
-    offset[3] = 0;
-    emms_c();
-
-    s->avctx->draw_horiz_band(s->avctx, &s->picture, offset, y, 3, h);
-
-    s->last_slice_end= y + h;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt){
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    HYuvContext *s = avctx->priv_data;
-    const int width= s->width;
-    const int width2= s->width>>1;
-    const int height= s->height;
-    int fake_ystride, fake_ustride, fake_vstride;
-    AVFrame * const p= &s->picture;
-    int table_size= 0;
-
-    AVFrame *picture = data;
-
-    av_fast_malloc(&s->bitstream_buffer, &s->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!s->bitstream_buffer)
-        return AVERROR(ENOMEM);
-
-    memset(s->bitstream_buffer + buf_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-    s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (const uint32_t*)buf, buf_size/4);
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if(s->context){
-        table_size = read_huffman_tables(s, s->bitstream_buffer, buf_size);
-        if(table_size < 0)
-            return -1;
-    }
-
-    if((unsigned)(buf_size-table_size) >= INT_MAX/8)
-        return -1;
-
-    init_get_bits(&s->gb, s->bitstream_buffer+table_size, (buf_size-table_size)*8);
-
-    fake_ystride= s->interlaced ? p->linesize[0]*2  : p->linesize[0];
-    fake_ustride= s->interlaced ? p->linesize[1]*2  : p->linesize[1];
-    fake_vstride= s->interlaced ? p->linesize[2]*2  : p->linesize[2];
-
-    s->last_slice_end= 0;
-
-    if(s->bitstream_bpp<24){
-        int y, cy;
-        int lefty, leftu, leftv;
-        int lefttopy, lefttopu, lefttopv;
-
-        if(s->yuy2){
-            p->data[0][3]= get_bits(&s->gb, 8);
-            p->data[0][2]= get_bits(&s->gb, 8);
-            p->data[0][1]= get_bits(&s->gb, 8);
-            p->data[0][0]= get_bits(&s->gb, 8);
-
-            av_log(avctx, AV_LOG_ERROR, "YUY2 output is not implemented yet\n");
-            return -1;
-        }else{
-
-            leftv= p->data[2][0]= get_bits(&s->gb, 8);
-            lefty= p->data[0][1]= get_bits(&s->gb, 8);
-            leftu= p->data[1][0]= get_bits(&s->gb, 8);
-                   p->data[0][0]= get_bits(&s->gb, 8);
-
-            switch(s->predictor){
-            case LEFT:
-            case PLANE:
-                decode_422_bitstream(s, width-2);
-                lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + 2, s->temp[0], width-2, lefty);
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + 1, s->temp[1], width2-1, leftu);
-                    leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + 1, s->temp[2], width2-1, leftv);
-                }
-
-                for(cy=y=1; y<s->height; y++,cy++){
-                    uint8_t *ydst, *udst, *vdst;
-
-                    if(s->bitstream_bpp==12){
-                        decode_gray_bitstream(s, width);
-
-                        ydst= p->data[0] + p->linesize[0]*y;
-
-                        lefty= s->dsp.add_hfyu_left_prediction(ydst, s->temp[0], width, lefty);
-                        if(s->predictor == PLANE){
-                            if(y>s->interlaced)
-                                s->dsp.add_bytes(ydst, ydst - fake_ystride, width);
-                        }
-                        y++;
-                        if(y>=s->height) break;
-                    }
-
-                    draw_slice(s, y);
-
-                    ydst= p->data[0] + p->linesize[0]*y;
-                    udst= p->data[1] + p->linesize[1]*cy;
-                    vdst= p->data[2] + p->linesize[2]*cy;
-
-                    decode_422_bitstream(s, width);
-                    lefty= s->dsp.add_hfyu_left_prediction(ydst, s->temp[0], width, lefty);
-                    if(!(s->flags&CODEC_FLAG_GRAY)){
-                        leftu= s->dsp.add_hfyu_left_prediction(udst, s->temp[1], width2, leftu);
-                        leftv= s->dsp.add_hfyu_left_prediction(vdst, s->temp[2], width2, leftv);
-                    }
-                    if(s->predictor == PLANE){
-                        if(cy>s->interlaced){
-                            s->dsp.add_bytes(ydst, ydst - fake_ystride, width);
-                            if(!(s->flags&CODEC_FLAG_GRAY)){
-                                s->dsp.add_bytes(udst, udst - fake_ustride, width2);
-                                s->dsp.add_bytes(vdst, vdst - fake_vstride, width2);
-                            }
-                        }
-                    }
-                }
-                draw_slice(s, height);
-
-                break;
-            case MEDIAN:
-                /* first line except first 2 pixels is left predicted */
-                decode_422_bitstream(s, width-2);
-                lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + 2, s->temp[0], width-2, lefty);
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + 1, s->temp[1], width2-1, leftu);
-                    leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + 1, s->temp[2], width2-1, leftv);
-                }
-
-                cy=y=1;
-
-                /* second line is left predicted for interlaced case */
-                if(s->interlaced){
-                    decode_422_bitstream(s, width);
-                    lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + p->linesize[0], s->temp[0], width, lefty);
-                    if(!(s->flags&CODEC_FLAG_GRAY)){
-                        leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + p->linesize[2], s->temp[1], width2, leftu);
-                        leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + p->linesize[1], s->temp[2], width2, leftv);
-                    }
-                    y++; cy++;
-                }
-
-                /* next 4 pixels are left predicted too */
-                decode_422_bitstream(s, 4);
-                lefty= s->dsp.add_hfyu_left_prediction(p->data[0] + fake_ystride, s->temp[0], 4, lefty);
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    leftu= s->dsp.add_hfyu_left_prediction(p->data[1] + fake_ustride, s->temp[1], 2, leftu);
-                    leftv= s->dsp.add_hfyu_left_prediction(p->data[2] + fake_vstride, s->temp[2], 2, leftv);
-                }
-
-                /* next line except the first 4 pixels is median predicted */
-                lefttopy= p->data[0][3];
-                decode_422_bitstream(s, width-4);
-                s->dsp.add_hfyu_median_prediction(p->data[0] + fake_ystride+4, p->data[0]+4, s->temp[0], width-4, &lefty, &lefttopy);
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    lefttopu= p->data[1][1];
-                    lefttopv= p->data[2][1];
-                    s->dsp.add_hfyu_median_prediction(p->data[1] + fake_ustride+2, p->data[1]+2, s->temp[1], width2-2, &leftu, &lefttopu);
-                    s->dsp.add_hfyu_median_prediction(p->data[2] + fake_vstride+2, p->data[2]+2, s->temp[2], width2-2, &leftv, &lefttopv);
-                }
-                y++; cy++;
-
-                for(; y<height; y++,cy++){
-                    uint8_t *ydst, *udst, *vdst;
-
-                    if(s->bitstream_bpp==12){
-                        while(2*cy > y){
-                            decode_gray_bitstream(s, width);
-                            ydst= p->data[0] + p->linesize[0]*y;
-                            s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy);
-                            y++;
-                        }
-                        if(y>=height) break;
-                    }
-                    draw_slice(s, y);
-
-                    decode_422_bitstream(s, width);
-
-                    ydst= p->data[0] + p->linesize[0]*y;
-                    udst= p->data[1] + p->linesize[1]*cy;
-                    vdst= p->data[2] + p->linesize[2]*cy;
-
-                    s->dsp.add_hfyu_median_prediction(ydst, ydst - fake_ystride, s->temp[0], width, &lefty, &lefttopy);
-                    if(!(s->flags&CODEC_FLAG_GRAY)){
-                        s->dsp.add_hfyu_median_prediction(udst, udst - fake_ustride, s->temp[1], width2, &leftu, &lefttopu);
-                        s->dsp.add_hfyu_median_prediction(vdst, vdst - fake_vstride, s->temp[2], width2, &leftv, &lefttopv);
-                    }
-                }
-
-                draw_slice(s, height);
-                break;
-            }
-        }
-    }else{
-        int y;
-        int leftr, leftg, leftb, lefta;
-        const int last_line= (height-1)*p->linesize[0];
-
-        if(s->bitstream_bpp==32){
-            lefta= p->data[0][last_line+A]= get_bits(&s->gb, 8);
-            leftr= p->data[0][last_line+R]= get_bits(&s->gb, 8);
-            leftg= p->data[0][last_line+G]= get_bits(&s->gb, 8);
-            leftb= p->data[0][last_line+B]= get_bits(&s->gb, 8);
-        }else{
-            leftr= p->data[0][last_line+R]= get_bits(&s->gb, 8);
-            leftg= p->data[0][last_line+G]= get_bits(&s->gb, 8);
-            leftb= p->data[0][last_line+B]= get_bits(&s->gb, 8);
-            lefta= p->data[0][last_line+A]= 255;
-            skip_bits(&s->gb, 8);
-        }
-
-        if(s->bgr32){
-            switch(s->predictor){
-            case LEFT:
-            case PLANE:
-                decode_bgr_bitstream(s, width-1);
-                s->dsp.add_hfyu_left_prediction_bgr32(p->data[0] + last_line+4, s->temp[0], width-1, &leftr, &leftg, &leftb, &lefta);
-
-                for(y=s->height-2; y>=0; y--){ //Yes it is stored upside down.
-                    decode_bgr_bitstream(s, width);
-
-                    s->dsp.add_hfyu_left_prediction_bgr32(p->data[0] + p->linesize[0]*y, s->temp[0], width, &leftr, &leftg, &leftb, &lefta);
-                    if(s->predictor == PLANE){
-                        if(s->bitstream_bpp!=32) lefta=0;
-                        if((y&s->interlaced)==0 && y<s->height-1-s->interlaced){
-                            s->dsp.add_bytes(p->data[0] + p->linesize[0]*y,
-                                             p->data[0] + p->linesize[0]*y + fake_ystride, fake_ystride);
-                        }
-                    }
-                }
-                draw_slice(s, height); // just 1 large slice as this is not possible in reverse order
-                break;
-            default:
-                av_log(avctx, AV_LOG_ERROR, "prediction type not supported!\n");
-            }
-        }else{
-
-            av_log(avctx, AV_LOG_ERROR, "BGR24 output is not implemented yet\n");
-            return -1;
-        }
-    }
-    emms_c();
-
-    *picture= *p;
-    *data_size = sizeof(AVFrame);
-
-    return (get_bits_count(&s->gb)+31)/32*4 + table_size;
-}
-#endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */
-
-static int common_end(HYuvContext *s){
-    int i;
-
-    for(i=0; i<3; i++){
-        av_freep(&s->temp[i]);
-    }
-    return 0;
-}
-
-#if CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    HYuvContext *s = avctx->priv_data;
-    int i;
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    common_end(s);
-    av_freep(&s->bitstream_buffer);
-
-    for(i=0; i<6; i++){
-        free_vlc(&s->vlc[i]);
-    }
-
-    return 0;
-}
-#endif /* CONFIG_HUFFYUV_DECODER || CONFIG_FFVHUFF_DECODER */
-
-#if CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    HYuvContext *s = avctx->priv_data;
-    AVFrame *pict = data;
-    const int width= s->width;
-    const int width2= s->width>>1;
-    const int height= s->height;
-    const int fake_ystride= s->interlaced ? pict->linesize[0]*2  : pict->linesize[0];
-    const int fake_ustride= s->interlaced ? pict->linesize[1]*2  : pict->linesize[1];
-    const int fake_vstride= s->interlaced ? pict->linesize[2]*2  : pict->linesize[2];
-    AVFrame * const p= &s->picture;
-    int i, j, size=0;
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    if(s->context){
-        for(i=0; i<3; i++){
-            generate_len_table(s->len[i], s->stats[i], 256);
-            if(generate_bits_table(s->bits[i], s->len[i])<0)
-                return -1;
-            size+= store_table(s, s->len[i], &buf[size]);
-        }
-
-        for(i=0; i<3; i++)
-            for(j=0; j<256; j++)
-                s->stats[i][j] >>= 1;
-    }
-
-    init_put_bits(&s->pb, buf+size, buf_size-size);
-
-    if(avctx->pix_fmt == PIX_FMT_YUV422P || avctx->pix_fmt == PIX_FMT_YUV420P){
-        int lefty, leftu, leftv, y, cy;
-
-        put_bits(&s->pb, 8, leftv= p->data[2][0]);
-        put_bits(&s->pb, 8, lefty= p->data[0][1]);
-        put_bits(&s->pb, 8, leftu= p->data[1][0]);
-        put_bits(&s->pb, 8,        p->data[0][0]);
-
-        lefty= sub_left_prediction(s, s->temp[0], p->data[0], width , 0);
-        leftu= sub_left_prediction(s, s->temp[1], p->data[1], width2, 0);
-        leftv= sub_left_prediction(s, s->temp[2], p->data[2], width2, 0);
-
-        encode_422_bitstream(s, 2, width-2);
-
-        if(s->predictor==MEDIAN){
-            int lefttopy, lefttopu, lefttopv;
-            cy=y=1;
-            if(s->interlaced){
-                lefty= sub_left_prediction(s, s->temp[0], p->data[0]+p->linesize[0], width , lefty);
-                leftu= sub_left_prediction(s, s->temp[1], p->data[1]+p->linesize[1], width2, leftu);
-                leftv= sub_left_prediction(s, s->temp[2], p->data[2]+p->linesize[2], width2, leftv);
-
-                encode_422_bitstream(s, 0, width);
-                y++; cy++;
-            }
-
-            lefty= sub_left_prediction(s, s->temp[0], p->data[0]+fake_ystride, 4, lefty);
-            leftu= sub_left_prediction(s, s->temp[1], p->data[1]+fake_ustride, 2, leftu);
-            leftv= sub_left_prediction(s, s->temp[2], p->data[2]+fake_vstride, 2, leftv);
-
-            encode_422_bitstream(s, 0, 4);
-
-            lefttopy= p->data[0][3];
-            lefttopu= p->data[1][1];
-            lefttopv= p->data[2][1];
-            s->dsp.sub_hfyu_median_prediction(s->temp[0], p->data[0]+4, p->data[0] + fake_ystride+4, width-4 , &lefty, &lefttopy);
-            s->dsp.sub_hfyu_median_prediction(s->temp[1], p->data[1]+2, p->data[1] + fake_ustride+2, width2-2, &leftu, &lefttopu);
-            s->dsp.sub_hfyu_median_prediction(s->temp[2], p->data[2]+2, p->data[2] + fake_vstride+2, width2-2, &leftv, &lefttopv);
-            encode_422_bitstream(s, 0, width-4);
-            y++; cy++;
-
-            for(; y<height; y++,cy++){
-                uint8_t *ydst, *udst, *vdst;
-
-                if(s->bitstream_bpp==12){
-                    while(2*cy > y){
-                        ydst= p->data[0] + p->linesize[0]*y;
-                        s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
-                        encode_gray_bitstream(s, width);
-                        y++;
-                    }
-                    if(y>=height) break;
-                }
-                ydst= p->data[0] + p->linesize[0]*y;
-                udst= p->data[1] + p->linesize[1]*cy;
-                vdst= p->data[2] + p->linesize[2]*cy;
-
-                s->dsp.sub_hfyu_median_prediction(s->temp[0], ydst - fake_ystride, ydst, width , &lefty, &lefttopy);
-                s->dsp.sub_hfyu_median_prediction(s->temp[1], udst - fake_ustride, udst, width2, &leftu, &lefttopu);
-                s->dsp.sub_hfyu_median_prediction(s->temp[2], vdst - fake_vstride, vdst, width2, &leftv, &lefttopv);
-
-                encode_422_bitstream(s, 0, width);
-            }
-        }else{
-            for(cy=y=1; y<height; y++,cy++){
-                uint8_t *ydst, *udst, *vdst;
-
-                /* encode a luma only line & y++ */
-                if(s->bitstream_bpp==12){
-                    ydst= p->data[0] + p->linesize[0]*y;
-
-                    if(s->predictor == PLANE && s->interlaced < y){
-                        s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width);
-
-                        lefty= sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty);
-                    }else{
-                        lefty= sub_left_prediction(s, s->temp[0], ydst, width , lefty);
-                    }
-                    encode_gray_bitstream(s, width);
-                    y++;
-                    if(y>=height) break;
-                }
-
-                ydst= p->data[0] + p->linesize[0]*y;
-                udst= p->data[1] + p->linesize[1]*cy;
-                vdst= p->data[2] + p->linesize[2]*cy;
-
-                if(s->predictor == PLANE && s->interlaced < cy){
-                    s->dsp.diff_bytes(s->temp[1], ydst, ydst - fake_ystride, width);
-                    s->dsp.diff_bytes(s->temp[2], udst, udst - fake_ustride, width2);
-                    s->dsp.diff_bytes(s->temp[2] + width2, vdst, vdst - fake_vstride, width2);
-
-                    lefty= sub_left_prediction(s, s->temp[0], s->temp[1], width , lefty);
-                    leftu= sub_left_prediction(s, s->temp[1], s->temp[2], width2, leftu);
-                    leftv= sub_left_prediction(s, s->temp[2], s->temp[2] + width2, width2, leftv);
-                }else{
-                    lefty= sub_left_prediction(s, s->temp[0], ydst, width , lefty);
-                    leftu= sub_left_prediction(s, s->temp[1], udst, width2, leftu);
-                    leftv= sub_left_prediction(s, s->temp[2], vdst, width2, leftv);
-                }
-
-                encode_422_bitstream(s, 0, width);
-            }
-        }
-    }else if(avctx->pix_fmt == PIX_FMT_RGB32){
-        uint8_t *data = p->data[0] + (height-1)*p->linesize[0];
-        const int stride = -p->linesize[0];
-        const int fake_stride = -fake_ystride;
-        int y;
-        int leftr, leftg, leftb;
-
-        put_bits(&s->pb, 8, leftr= data[R]);
-        put_bits(&s->pb, 8, leftg= data[G]);
-        put_bits(&s->pb, 8, leftb= data[B]);
-        put_bits(&s->pb, 8, 0);
-
-        sub_left_prediction_bgr32(s, s->temp[0], data+4, width-1, &leftr, &leftg, &leftb);
-        encode_bgr_bitstream(s, width-1);
-
-        for(y=1; y<s->height; y++){
-            uint8_t *dst = data + y*stride;
-            if(s->predictor == PLANE && s->interlaced < y){
-                s->dsp.diff_bytes(s->temp[1], dst, dst - fake_stride, width*4);
-                sub_left_prediction_bgr32(s, s->temp[0], s->temp[1], width, &leftr, &leftg, &leftb);
-            }else{
-                sub_left_prediction_bgr32(s, s->temp[0], dst, width, &leftr, &leftg, &leftb);
-            }
-            encode_bgr_bitstream(s, width);
-        }
-    }else{
-        av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
-    }
-    emms_c();
-
-    size+= (put_bits_count(&s->pb)+31)/8;
-    put_bits(&s->pb, 16, 0);
-    put_bits(&s->pb, 15, 0);
-    size/= 4;
-
-    if((s->flags&CODEC_FLAG_PASS1) && (s->picture_number&31)==0){
-        int j;
-        char *p= avctx->stats_out;
-        char *end= p + 1024*30;
-        for(i=0; i<3; i++){
-            for(j=0; j<256; j++){
-                snprintf(p, end-p, "%"PRIu64" ", s->stats[i][j]);
-                p+= strlen(p);
-                s->stats[i][j]= 0;
-            }
-            snprintf(p, end-p, "\n");
-            p++;
-        }
-    } else
-        avctx->stats_out[0] = '\0';
-    if(!(s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)){
-        flush_put_bits(&s->pb);
-        s->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size);
-    }
-
-    s->picture_number++;
-
-    return size*4;
-}
-
-static av_cold int encode_end(AVCodecContext *avctx)
-{
-    HYuvContext *s = avctx->priv_data;
-
-    common_end(s);
-
-    av_freep(&avctx->extradata);
-    av_freep(&avctx->stats_out);
-
-    return 0;
-}
-#endif /* CONFIG_HUFFYUV_ENCODER || CONFIG_FFVHUFF_ENCODER */
-
-#if CONFIG_HUFFYUV_DECODER
-AVCodec huffyuv_decoder = {
-    "huffyuv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_HUFFYUV,
-    sizeof(HYuvContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
-};
-#endif
-
-#if CONFIG_FFVHUFF_DECODER
-AVCodec ffvhuff_decoder = {
-    "ffvhuff",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FFVHUFF,
-    sizeof(HYuvContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
-};
-#endif
-
-#if CONFIG_HUFFYUV_ENCODER
-AVCodec huffyuv_encoder = {
-    "huffyuv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_HUFFYUV,
-    sizeof(HYuvContext),
-    encode_init,
-    encode_frame,
-    encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Huffyuv / HuffYUV"),
-};
-#endif
-
-#if CONFIG_FFVHUFF_ENCODER
-AVCodec ffvhuff_encoder = {
-    "ffvhuff",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_FFVHUFF,
-    sizeof(HYuvContext),
-    encode_init,
-    encode_frame,
-    encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_RGB32, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"),
-};
-#endif
diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c
deleted file mode 100644
index 203812b..0000000
--- a/libavcodec/idcinvideo.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * id Quake II CIN Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * id Quake II Cin Video Decoder by Dr. Tim Ferguson
- * For more information about the id CIN format, visit:
- *   http://www.csse.monash.edu.au/~timf/
- *
- * This video decoder outputs PAL8 colorspace data. Interacting with this
- * decoder is a little involved. During initialization, the demuxer must
- * transmit the 65536-byte Huffman table(s) to the decoder via extradata.
- * Then, whenever a palette change is encountered while demuxing the file,
- * the demuxer must use the same extradata space to transmit an
- * AVPaletteControl structure.
- *
- * id CIN video is purely Huffman-coded, intraframe-only codec. It achieves
- * a little more compression by exploiting the fact that adjacent pixels
- * tend to be similar.
- *
- * Note that this decoder could use ffmpeg's optimized VLC facilities
- * rather than naive, tree-based Huffman decoding. However, there are 256
- * Huffman tables. Plus, the VLC bit coding order is right -> left instead
- * or left -> right, so all of the bits would have to be reversed. Further,
- * the original Quake II implementation likely used a similar naive
- * decoding algorithm and it worked fine on much lower spec machines.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-
-#define HUFFMAN_TABLE_SIZE 64 * 1024
-#define HUF_TOKENS 256
-#define PALETTE_COUNT 256
-
-typedef struct
-{
-  int count;
-  unsigned char used;
-  int children[2];
-} hnode;
-
-typedef struct IdcinContext {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *buf;
-    int size;
-
-    hnode huff_nodes[256][HUF_TOKENS*2];
-    int num_huff_nodes[256];
-
-} IdcinContext;
-
-/*
- * Find the lowest probability node in a Huffman table, and mark it as
- * being assigned to a higher probability.
- * Returns the node index of the lowest unused node, or -1 if all nodes
- * are used.
- */
-static int huff_smallest_node(hnode *hnodes, int num_hnodes) {
-    int i;
-    int best, best_node;
-
-    best = 99999999;
-    best_node = -1;
-    for(i = 0; i < num_hnodes; i++) {
-        if(hnodes[i].used)
-            continue;
-        if(!hnodes[i].count)
-            continue;
-        if(hnodes[i].count < best) {
-            best = hnodes[i].count;
-            best_node = i;
-        }
-    }
-
-    if(best_node == -1)
-        return -1;
-    hnodes[best_node].used = 1;
-    return best_node;
-}
-
-/*
- * Build the Huffman tree using the generated/loaded probabilities histogram.
- *
- * On completion:
- *  huff_nodes[prev][i < HUF_TOKENS] - are the nodes at the base of the tree.
- *  huff_nodes[prev][i >= HUF_TOKENS] - are used to construct the tree.
- *  num_huff_nodes[prev] - contains the index to the root node of the tree.
- *    That is: huff_nodes[prev][num_huff_nodes[prev]] is the root node.
- */
-static av_cold void huff_build_tree(IdcinContext *s, int prev) {
-    hnode *node, *hnodes;
-     int num_hnodes, i;
-
-    num_hnodes = HUF_TOKENS;
-    hnodes = s->huff_nodes[prev];
-    for(i = 0; i < HUF_TOKENS * 2; i++)
-        hnodes[i].used = 0;
-
-    while (1) {
-        node = &hnodes[num_hnodes];             /* next free node */
-
-        /* pick two lowest counts */
-        node->children[0] = huff_smallest_node(hnodes, num_hnodes);
-        if(node->children[0] == -1)
-            break;      /* reached the root node */
-
-        node->children[1] = huff_smallest_node(hnodes, num_hnodes);
-        if(node->children[1] == -1)
-            break;      /* reached the root node */
-
-        /* combine nodes probability for new node */
-        node->count = hnodes[node->children[0]].count +
-        hnodes[node->children[1]].count;
-        num_hnodes++;
-    }
-
-    s->num_huff_nodes[prev] = num_hnodes - 1;
-}
-
-static av_cold int idcin_decode_init(AVCodecContext *avctx)
-{
-    IdcinContext *s = avctx->priv_data;
-    int i, j, histogram_index = 0;
-    unsigned char *histograms;
-
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    /* make sure the Huffman tables make it */
-    if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) {
-        av_log(s->avctx, AV_LOG_ERROR, "  id CIN video: expected extradata size of %d\n", HUFFMAN_TABLE_SIZE);
-        return -1;
-    }
-
-    /* build the 256 Huffman decode trees */
-    histograms = (unsigned char *)s->avctx->extradata;
-    for (i = 0; i < 256; i++) {
-        for(j = 0; j < HUF_TOKENS; j++)
-            s->huff_nodes[i][j].count = histograms[histogram_index++];
-        huff_build_tree(s, i);
-    }
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static void idcin_decode_vlcs(IdcinContext *s)
-{
-    hnode *hnodes;
-    long x, y;
-    int prev;
-    unsigned char v = 0;
-    int bit_pos, node_num, dat_pos;
-
-    prev = bit_pos = dat_pos = 0;
-    for (y = 0; y < (s->frame.linesize[0] * s->avctx->height);
-        y += s->frame.linesize[0]) {
-        for (x = y; x < y + s->avctx->width; x++) {
-            node_num = s->num_huff_nodes[prev];
-            hnodes = s->huff_nodes[prev];
-
-            while(node_num >= HUF_TOKENS) {
-                if(!bit_pos) {
-                    if(dat_pos >= s->size) {
-                        av_log(s->avctx, AV_LOG_ERROR, "Huffman decode error.\n");
-                        return;
-                    }
-                    bit_pos = 8;
-                    v = s->buf[dat_pos++];
-                }
-
-                node_num = hnodes[node_num].children[v & 0x01];
-                v = v >> 1;
-                bit_pos--;
-            }
-
-            s->frame.data[0][x] = node_num;
-            prev = node_num;
-        }
-    }
-}
-
-static int idcin_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    IdcinContext *s = avctx->priv_data;
-    AVPaletteControl *palette_control = avctx->palctrl;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    if (avctx->get_buffer(avctx, &s->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "  id CIN Video: get_buffer() failed\n");
-        return -1;
-    }
-
-    idcin_decode_vlcs(s);
-
-    /* make the palette available on the way out */
-    memcpy(s->frame.data[1], palette_control->palette, PALETTE_COUNT * 4);
-    /* If palette changed inform application*/
-    if (palette_control->palette_changed) {
-        palette_control->palette_changed = 0;
-        s->frame.palette_has_changed = 1;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int idcin_decode_end(AVCodecContext *avctx)
-{
-    IdcinContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec idcin_decoder = {
-    "idcinvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_IDCIN,
-    sizeof(IdcinContext),
-    idcin_decode_init,
-    NULL,
-    idcin_decode_end,
-    idcin_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"),
-};
-
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
deleted file mode 100644
index 2989bb0..0000000
--- a/libavcodec/iff.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * IFF PBM/ILBM bitmap decoder
- * Copyright (c) 2010 Peter Ross <pross at xvid.org>
- * Copyright (c) 2010 Sebastian Vater <cdgs.basty at googlemail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * IFF PBM/ILBM bitmap decoder
- */
-
-#include "bytestream.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "iff.h"
-
-typedef struct {
-    AVFrame frame;
-    int planesize;
-    uint8_t * planebuf;
-} IffContext;
-
-/**
- * Convert CMAP buffer (stored in extradata) to lavc palette format
- */
-int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal)
-{
-    int count, i;
-
-    if (avctx->bits_per_coded_sample > 8) {
-        av_log(avctx, AV_LOG_ERROR, "bit_per_coded_sample > 8 not supported\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    count = 1 << avctx->bits_per_coded_sample;
-    if (avctx->extradata_size < count * 3) {
-        av_log(avctx, AV_LOG_ERROR, "palette data underflow\n");
-        return AVERROR_INVALIDDATA;
-    }
-    for (i=0; i < count; i++) {
-        pal[i] = 0xFF000000 | AV_RB24( avctx->extradata + i*3 );
-    }
-    return 0;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    IffContext *s = avctx->priv_data;
-    int err;
-
-    if (avctx->bits_per_coded_sample <= 8) {
-        avctx->pix_fmt = PIX_FMT_PAL8;
-    } else if (avctx->bits_per_coded_sample <= 32) {
-        avctx->pix_fmt = PIX_FMT_BGR32;
-    } else {
-        return AVERROR_INVALIDDATA;
-    }
-
-    s->planesize = avctx->width >> 3;
-    s->planebuf = av_malloc(s->planesize + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!s->planebuf)
-        return AVERROR(ENOMEM);
-
-    s->frame.reference = 1;
-    if ((err = avctx->get_buffer(avctx, &s->frame) < 0)) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return err;
-    }
-
-    return avctx->bits_per_coded_sample <= 8 ?
-       ff_cmap_read_palette(avctx, (uint32_t*)s->frame.data[1]) : 0;
-}
-
-/**
- * Decode interleaved plane buffer up to 8bpp
- * @param dst Destination buffer
- * @param buf Source buffer
- * @param buf_size
- * @param bps bits_per_coded_sample (must be <= 8)
- * @param plane plane number to decode as
- */
-static void decodeplane8(uint8_t *dst, const uint8_t *const buf, int buf_size, int bps, int plane)
-{
-    GetBitContext gb;
-    int i;
-    const int b = (buf_size * 8) + bps - 1;
-    init_get_bits(&gb, buf, buf_size * 8);
-    for(i = 0; i < b; i++) {
-        dst[i] |= get_bits1(&gb) << plane;
-    }
-}
-
-/**
- * Decode interleaved plane buffer up to 24bpp
- * @param dst Destination buffer
- * @param buf Source buffer
- * @param buf_size
- * @param bps bits_per_coded_sample
- * @param plane plane number to decode as
- */
-static void decodeplane32(uint32_t *dst, const uint8_t *const buf, int buf_size, int bps, int plane)
-{
-    GetBitContext gb;
-    int i;
-    const int b = (buf_size * 8) + bps - 1;
-    init_get_bits(&gb, buf, buf_size * 8);
-    for(i = 0; i < b; i++) {
-        dst[i] |= get_bits1(&gb) << plane;
-    }
-}
-
-static int decode_frame_ilbm(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    IffContext *s = avctx->priv_data;
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    const uint8_t *buf_end = buf+buf_size;
-    int y, plane;
-
-    if (avctx->reget_buffer(avctx, &s->frame) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if (avctx->pix_fmt == PIX_FMT_PAL8) {
-        for(y = 0; y < avctx->height; y++ ) {
-            uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
-            memset(row, 0, avctx->width);
-            for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) {
-                decodeplane8(row, buf, FFMIN(s->planesize, buf_end - buf), avctx->bits_per_coded_sample, plane);
-                buf += s->planesize;
-            }
-        }
-    } else { // PIX_FMT_BGR32
-        for(y = 0; y < avctx->height; y++ ) {
-            uint8_t *row = &s->frame.data[0][y*s->frame.linesize[0]];
-            memset(row, 0, avctx->width << 2);
-            for (plane = 0; plane < avctx->bits_per_coded_sample && buf < buf_end; plane++) {
-                decodeplane32((uint32_t *) row, buf, FFMIN(s->planesize, buf_end - buf), avctx->bits_per_coded_sample, plane);
-                buf += s->planesize;
-            }
-        }
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-    return buf_size;
-}
-
-static int decode_frame_byterun1(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    IffContext *s = avctx->priv_data;
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    const uint8_t *buf_end = buf+buf_size;
-    int y, plane, x;
-
-    if (avctx->reget_buffer(avctx, &s->frame) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if (avctx->codec_tag == MKTAG('I','L','B','M')) { //interleaved
-        if (avctx->pix_fmt == PIX_FMT_PAL8) {
-            for(y = 0; y < avctx->height ; y++ ) {
-                uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ];
-                memset(row, 0, avctx->width);
-                for (plane = 0; plane < avctx->bits_per_coded_sample; plane++) {
-                    for(x = 0; x < s->planesize && buf < buf_end; ) {
-                        int8_t value = *buf++;
-                        unsigned length;
-                        if (value >= 0) {
-                            length = value + 1;
-                            memcpy(s->planebuf + x, buf, FFMIN3(length, s->planesize - x, buf_end - buf));
-                            buf += length;
-                        } else if (value > -128) {
-                            length = -value + 1;
-                            memset(s->planebuf + x, *buf++, FFMIN(length, s->planesize - x));
-                        } else { //noop
-                            continue;
-                        }
-                        x += length;
-                    }
-                    decodeplane8(row, s->planebuf, s->planesize, avctx->bits_per_coded_sample, plane);
-                }
-            }
-        } else { //PIX_FMT_BGR32
-            for(y = 0; y < avctx->height ; y++ ) {
-                uint8_t *row = &s->frame.data[0][y*s->frame.linesize[0]];
-                memset(row, 0, avctx->width << 2);
-                for (plane = 0; plane < avctx->bits_per_coded_sample; plane++) {
-                    for(x = 0; x < s->planesize && buf < buf_end; ) {
-                        int8_t value = *buf++;
-                        unsigned length;
-                        if (value >= 0) {
-                            length = value + 1;
-                            memcpy(s->planebuf + x, buf, FFMIN3(length, s->planesize - x, buf_end - buf));
-                            buf += length;
-                        } else if (value > -128) {
-                            length = -value + 1;
-                            memset(s->planebuf + x, *buf++, FFMIN(length, s->planesize - x));
-                        } else { // noop
-                            continue;
-                        }
-                        x += length;
-                    }
-                    decodeplane32((uint32_t *) row, s->planebuf, s->planesize, avctx->bits_per_coded_sample, plane);
-                }
-            }
-        }
-    } else {
-        for(y = 0; y < avctx->height ; y++ ) {
-            uint8_t *row = &s->frame.data[0][y*s->frame.linesize[0]];
-            for(x = 0; x < avctx->width && buf < buf_end; ) {
-                int8_t value = *buf++;
-                unsigned length;
-                if (value >= 0) {
-                    length = value + 1;
-                    memcpy(row + x, buf, FFMIN3(length, buf_end - buf, avctx->width - x));
-                    buf += length;
-                } else if (value > -128) {
-                    length = -value + 1;
-                    memset(row + x, *buf++, FFMIN(length, avctx->width - x));
-                } else { //noop
-                    continue;
-                }
-                x += length;
-            }
-        }
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-    return buf_size;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    IffContext *s = avctx->priv_data;
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-    av_freep(&s->planebuf);
-    return 0;
-}
-
-AVCodec iff_ilbm_decoder = {
-    "iff_ilbm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_IFF_ILBM,
-    sizeof(IffContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame_ilbm,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"),
-};
-
-AVCodec iff_byterun1_decoder = {
-    "iff_byterun1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_IFF_BYTERUN1,
-    sizeof(IffContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame_byterun1,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("IFF ByteRun1"),
-};
diff --git a/libavcodec/iff.h b/libavcodec/iff.h
deleted file mode 100644
index 76db10b..0000000
--- a/libavcodec/iff.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * IFF PBM/ILBM bitmap decoder
- * Copyright (c) 2010 Peter Ross <pross at xvid.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_IFF_H
-#define AVCODEC_IFF_H
-
-#include <stdint.h>
-#include "avcodec.h"
-
-int ff_cmap_read_palette(AVCodecContext *avctx, uint32_t *pal);
-
-#endif /* AVCODEC_IFF_H */
diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
deleted file mode 100644
index 90af431..0000000
--- a/libavcodec/iirfilter.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * IIR filter
- * Copyright (c) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * different IIR filters implementation
- */
-
-#include "iirfilter.h"
-#include <math.h>
-
-/**
- * IIR filter global parameters
- */
-typedef struct FFIIRFilterCoeffs{
-    int   order;
-    float gain;
-    int   *cx;
-    float *cy;
-}FFIIRFilterCoeffs;
-
-/**
- * IIR filter state
- */
-typedef struct FFIIRFilterState{
-    float x[1];
-}FFIIRFilterState;
-
-/// maximum supported filter order
-#define MAXORDER 30
-
-av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,
-                                                    enum IIRFilterMode filt_mode,
-                                                    int order, float cutoff_ratio,
-                                                    float stopband, float ripple)
-{
-    int i, j;
-    FFIIRFilterCoeffs *c;
-    double wa;
-    double p[MAXORDER + 1][2];
-
-    if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS)
-        return NULL;
-    if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0)
-        return NULL;
-
-    c = av_malloc(sizeof(FFIIRFilterCoeffs));
-    c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1));
-    c->cy = av_malloc(sizeof(c->cy[0]) * order);
-    c->order = order;
-
-    wa = 2 * tan(M_PI * 0.5 * cutoff_ratio);
-
-    c->cx[0] = 1;
-    for(i = 1; i < (order >> 1) + 1; i++)
-        c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i;
-
-    p[0][0] = 1.0;
-    p[0][1] = 0.0;
-    for(i = 1; i <= order; i++)
-        p[i][0] = p[i][1] = 0.0;
-    for(i = 0; i < order; i++){
-        double zp[2];
-        double th = (i + (order >> 1) + 0.5) * M_PI / order;
-        double a_re, a_im, c_re, c_im;
-        zp[0] = cos(th) * wa;
-        zp[1] = sin(th) * wa;
-        a_re = zp[0] + 2.0;
-        c_re = zp[0] - 2.0;
-        a_im =
-        c_im = zp[1];
-        zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im);
-        zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im);
-
-        for(j = order; j >= 1; j--)
-        {
-            a_re = p[j][0];
-            a_im = p[j][1];
-            p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0];
-            p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1];
-        }
-        a_re    = p[0][0]*zp[0] - p[0][1]*zp[1];
-        p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0];
-        p[0][0] = a_re;
-    }
-    c->gain = p[order][0];
-    for(i = 0; i < order; i++){
-        c->gain += p[i][0];
-        c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) /
-                   (p[order][0] * p[order][0] + p[order][1] * p[order][1]);
-    }
-    c->gain /= 1 << order;
-
-    return c;
-}
-
-av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order)
-{
-    FFIIRFilterState* s = av_mallocz(sizeof(FFIIRFilterState) + sizeof(s->x[0]) * (order - 1));
-    return s;
-}
-
-#define FILTER(i0, i1, i2, i3)                    \
-    in =   *src * c->gain                         \
-         + c->cy[0]*s->x[i0] + c->cy[1]*s->x[i1]  \
-         + c->cy[2]*s->x[i2] + c->cy[3]*s->x[i3]; \
-    res =  (s->x[i0] + in      )*1                \
-         + (s->x[i1] + s->x[i3])*4                \
-         +  s->x[i2]            *6;               \
-    *dst = av_clip_int16(lrintf(res));            \
-    s->x[i0] = in;                                \
-    src += sstep;                                 \
-    dst += dstep;                                 \
-
-void ff_iir_filter(const struct FFIIRFilterCoeffs *c, struct FFIIRFilterState *s, int size, const int16_t *src, int sstep, int16_t *dst, int dstep)
-{
-    int i;
-
-    if(c->order == 4){
-        for(i = 0; i < size; i += 4){
-            float in, res;
-
-            FILTER(0, 1, 2, 3);
-            FILTER(1, 2, 3, 0);
-            FILTER(2, 3, 0, 1);
-            FILTER(3, 0, 1, 2);
-        }
-    }else{
-        for(i = 0; i < size; i++){
-            int j;
-            float in, res;
-            in = *src * c->gain;
-            for(j = 0; j < c->order; j++)
-                in += c->cy[j] * s->x[j];
-            res = s->x[0] + in + s->x[c->order >> 1] * c->cx[c->order >> 1];
-            for(j = 1; j < c->order >> 1; j++)
-                res += (s->x[j] + s->x[c->order - j]) * c->cx[j];
-            for(j = 0; j < c->order - 1; j++)
-                s->x[j] = s->x[j + 1];
-            *dst = av_clip_int16(lrintf(res));
-            s->x[c->order - 1] = in;
-            src += sstep;
-            dst += sstep;
-        }
-    }
-}
-
-av_cold void ff_iir_filter_free_state(struct FFIIRFilterState *state)
-{
-    av_free(state);
-}
-
-av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs)
-{
-    if(coeffs){
-        av_free(coeffs->cx);
-        av_free(coeffs->cy);
-    }
-    av_free(coeffs);
-}
-
-#ifdef TEST
-#define FILT_ORDER 4
-#define SIZE 1024
-int main(void)
-{
-    struct FFIIRFilterCoeffs *fcoeffs = NULL;
-    struct FFIIRFilterState  *fstate  = NULL;
-    float cutoff_coeff = 0.4;
-    int16_t x[SIZE], y[SIZE];
-    int i;
-    FILE* fd;
-
-    fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH,
-                                        FF_FILTER_MODE_LOWPASS, FILT_ORDER,
-                                        cutoff_coeff, 0.0, 0.0);
-    fstate  = ff_iir_filter_init_state(FILT_ORDER);
-
-    for (i = 0; i < SIZE; i++) {
-        x[i] = lrint(0.75 * INT16_MAX * sin(0.5*M_PI*i*i/SIZE));
-    }
-
-    ff_iir_filter(fcoeffs, fstate, SIZE, x, 1, y, 1);
-
-    fd = fopen("in.bin", "w");
-    fwrite(x, sizeof(x[0]), SIZE, fd);
-    fclose(fd);
-
-    fd = fopen("out.bin", "w");
-    fwrite(y, sizeof(y[0]), SIZE, fd);
-    fclose(fd);
-
-    ff_iir_filter_free_coeffs(fcoeffs);
-    ff_iir_filter_free_state(fstate);
-    return 0;
-}
-#endif /* TEST */
diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h
deleted file mode 100644
index f660955..0000000
--- a/libavcodec/iirfilter.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * IIR filter
- * Copyright (c) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * IIR filter interface
- */
-
-#ifndef AVCODEC_IIRFILTER_H
-#define AVCODEC_IIRFILTER_H
-
-#include "avcodec.h"
-
-struct FFIIRFilterCoeffs;
-struct FFIIRFilterState;
-
-enum IIRFilterType{
-    FF_FILTER_TYPE_BESSEL,
-    FF_FILTER_TYPE_BUTTERWORTH,
-    FF_FILTER_TYPE_CHEBYSHEV,
-    FF_FILTER_TYPE_ELLIPTIC,
-};
-
-enum IIRFilterMode{
-    FF_FILTER_MODE_LOWPASS,
-    FF_FILTER_MODE_HIGHPASS,
-    FF_FILTER_MODE_BANDPASS,
-    FF_FILTER_MODE_BANDSTOP,
-};
-
-/**
- * Initialize filter coefficients.
- *
- * @param filt_type    filter type (e.g. Butterworth)
- * @param filt_mode    filter mode (e.g. lowpass)
- * @param order        filter order
- * @param cutoff_ratio cutoff to input frequency ratio
- * @param stopband     stopband to input frequency ratio (used by bandpass and bandstop filter modes)
- * @param ripple       ripple factor (used only in Chebyshev filters)
- *
- * @return pointer to filter coefficients structure or NULL if filter cannot be created
- */
-struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type,
-                                                    enum IIRFilterMode filt_mode,
-                                                    int order, float cutoff_ratio,
-                                                    float stopband, float ripple);
-
-/**
- * Create new filter state.
- *
- * @param order filter order
- *
- * @return pointer to new filter state or NULL if state creation fails
- */
-struct FFIIRFilterState* ff_iir_filter_init_state(int order);
-
-/**
- * Free filter coefficients.
- *
- * @param coeffs pointer allocated with ff_iir_filter_init_coeffs()
- */
-void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs);
-
-/**
- * Free filter state.
- *
- * @param state pointer allocated with ff_iir_filter_init_state()
- */
-void ff_iir_filter_free_state(struct FFIIRFilterState *state);
-
-/**
- * Perform lowpass filtering on input samples.
- *
- * @param coeffs pointer to filter coefficients
- * @param state  pointer to filter state
- * @param size   input length
- * @param src    source samples
- * @param sstep  source stride
- * @param dst    filtered samples (destination may be the same as input)
- * @param dstep  destination stride
- */
-void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state,
-                   int size, const int16_t *src, int sstep, int16_t *dst, int dstep);
-
-#endif /* AVCODEC_IIRFILTER_H */
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
deleted file mode 100644
index 2a420f5..0000000
--- a/libavcodec/imc.c
+++ /dev/null
@@ -1,834 +0,0 @@
-/*
- * IMC compatible decoder
- * Copyright (c) 2002-2004 Maxim Poliakovski
- * Copyright (c) 2006 Benjamin Larsson
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- *  @file
- *  IMC - Intel Music Coder
- *  A mdct based codec using a 256 points large transform
- *  divied into 32 bands with some mix of scale factors.
- *  Only mono is supported.
- *
- */
-
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#define ALT_BITSTREAM_READER
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-
-#include "imcdata.h"
-
-#define IMC_BLOCK_SIZE 64
-#define IMC_FRAME_ID 0x21
-#define BANDS 32
-#define COEFFS 256
-
-typedef struct {
-    float old_floor[BANDS];
-    float flcoeffs1[BANDS];
-    float flcoeffs2[BANDS];
-    float flcoeffs3[BANDS];
-    float flcoeffs4[BANDS];
-    float flcoeffs5[BANDS];
-    float flcoeffs6[BANDS];
-    float CWdecoded[COEFFS];
-
-    /** MDCT tables */
-    //@{
-    float mdct_sine_window[COEFFS];
-    float post_cos[COEFFS];
-    float post_sin[COEFFS];
-    float pre_coef1[COEFFS];
-    float pre_coef2[COEFFS];
-    float last_fft_im[COEFFS];
-    //@}
-
-    int bandWidthT[BANDS];     ///< codewords per band
-    int bitsBandT[BANDS];      ///< how many bits per codeword in band
-    int CWlengthT[COEFFS];     ///< how many bits in each codeword
-    int levlCoeffBuf[BANDS];
-    int bandFlagsBuf[BANDS];   ///< flags for each band
-    int sumLenArr[BANDS];      ///< bits for all coeffs in band
-    int skipFlagRaw[BANDS];    ///< skip flags are stored in raw form or not
-    int skipFlagBits[BANDS];   ///< bits used to code skip flags
-    int skipFlagCount[BANDS];  ///< skipped coeffients per band
-    int skipFlags[COEFFS];     ///< skip coefficient decoding or not
-    int codewords[COEFFS];     ///< raw codewords read from bitstream
-    float sqrt_tab[30];
-    GetBitContext gb;
-    int decoder_reset;
-    float one_div_log2;
-
-    DSPContext dsp;
-    FFTContext fft;
-    DECLARE_ALIGNED(16, FFTComplex, samples)[COEFFS/2];
-    DECLARE_ALIGNED(16, float, out_samples)[COEFFS];
-} IMCContext;
-
-static VLC huffman_vlc[4][4];
-
-#define VLC_TABLES_SIZE 9512
-
-static const int vlc_offsets[17] = {
-    0,     640, 1156, 1732, 2308, 2852, 3396, 3924,
-    4452, 5220, 5860, 6628, 7268, 7908, 8424, 8936, VLC_TABLES_SIZE};
-
-static VLC_TYPE vlc_tables[VLC_TABLES_SIZE][2];
-
-static av_cold int imc_decode_init(AVCodecContext * avctx)
-{
-    int i, j;
-    IMCContext *q = avctx->priv_data;
-    double r1, r2;
-
-    q->decoder_reset = 1;
-
-    for(i = 0; i < BANDS; i++)
-        q->old_floor[i] = 1.0;
-
-    /* Build mdct window, a simple sine window normalized with sqrt(2) */
-    ff_sine_window_init(q->mdct_sine_window, COEFFS);
-    for(i = 0; i < COEFFS; i++)
-        q->mdct_sine_window[i] *= sqrt(2.0);
-    for(i = 0; i < COEFFS/2; i++){
-        q->post_cos[i] = cos(i / 256.0 * M_PI);
-        q->post_sin[i] = sin(i / 256.0 * M_PI);
-
-        r1 = sin((i * 4.0 + 1.0) / 1024.0 * M_PI);
-        r2 = cos((i * 4.0 + 1.0) / 1024.0 * M_PI);
-
-        if (i & 0x1)
-        {
-            q->pre_coef1[i] =  (r1 + r2) * sqrt(2.0);
-            q->pre_coef2[i] = -(r1 - r2) * sqrt(2.0);
-        }
-        else
-        {
-            q->pre_coef1[i] = -(r1 + r2) * sqrt(2.0);
-            q->pre_coef2[i] =  (r1 - r2) * sqrt(2.0);
-        }
-
-        q->last_fft_im[i] = 0;
-    }
-
-    /* Generate a square root table */
-
-    for(i = 0; i < 30; i++) {
-        q->sqrt_tab[i] = sqrt(i);
-    }
-
-    /* initialize the VLC tables */
-    for(i = 0; i < 4 ; i++) {
-        for(j = 0; j < 4; j++) {
-            huffman_vlc[i][j].table = &vlc_tables[vlc_offsets[i * 4 + j]];
-            huffman_vlc[i][j].table_allocated = vlc_offsets[i * 4 + j + 1] - vlc_offsets[i * 4 + j];
-            init_vlc(&huffman_vlc[i][j], 9, imc_huffman_sizes[i],
-                     imc_huffman_lens[i][j], 1, 1,
-                     imc_huffman_bits[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC);
-        }
-    }
-    q->one_div_log2 = 1/log(2);
-
-    ff_fft_init(&q->fft, 7, 1);
-    dsputil_init(&q->dsp, avctx);
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
-    return 0;
-}
-
-static void imc_calculate_coeffs(IMCContext* q, float* flcoeffs1, float* flcoeffs2, int* bandWidthT,
-                                float* flcoeffs3, float* flcoeffs5)
-{
-    float   workT1[BANDS];
-    float   workT2[BANDS];
-    float   workT3[BANDS];
-    float   snr_limit = 1.e-30;
-    float   accum = 0.0;
-    int i, cnt2;
-
-    for(i = 0; i < BANDS; i++) {
-        flcoeffs5[i] = workT2[i] = 0.0;
-        if (bandWidthT[i]){
-            workT1[i] = flcoeffs1[i] * flcoeffs1[i];
-            flcoeffs3[i] = 2.0 * flcoeffs2[i];
-        } else {
-            workT1[i] = 0.0;
-            flcoeffs3[i] = -30000.0;
-        }
-        workT3[i] = bandWidthT[i] * workT1[i] * 0.01;
-        if (workT3[i] <= snr_limit)
-            workT3[i] = 0.0;
-    }
-
-    for(i = 0; i < BANDS; i++) {
-        for(cnt2 = i; cnt2 < cyclTab[i]; cnt2++)
-            flcoeffs5[cnt2] = flcoeffs5[cnt2] + workT3[i];
-        workT2[cnt2-1] = workT2[cnt2-1] + workT3[i];
-    }
-
-    for(i = 1; i < BANDS; i++) {
-        accum = (workT2[i-1] + accum) * imc_weights1[i-1];
-        flcoeffs5[i] += accum;
-    }
-
-    for(i = 0; i < BANDS; i++)
-        workT2[i] = 0.0;
-
-    for(i = 0; i < BANDS; i++) {
-        for(cnt2 = i-1; cnt2 > cyclTab2[i]; cnt2--)
-            flcoeffs5[cnt2] += workT3[i];
-        workT2[cnt2+1] += workT3[i];
-    }
-
-    accum = 0.0;
-
-    for(i = BANDS-2; i >= 0; i--) {
-        accum = (workT2[i+1] + accum) * imc_weights2[i];
-        flcoeffs5[i] += accum;
-        //there is missing code here, but it seems to never be triggered
-    }
-}
-
-
-static void imc_read_level_coeffs(IMCContext* q, int stream_format_code, int* levlCoeffs)
-{
-    int i;
-    VLC *hufftab[4];
-    int start = 0;
-    const uint8_t *cb_sel;
-    int s;
-
-    s = stream_format_code >> 1;
-    hufftab[0] = &huffman_vlc[s][0];
-    hufftab[1] = &huffman_vlc[s][1];
-    hufftab[2] = &huffman_vlc[s][2];
-    hufftab[3] = &huffman_vlc[s][3];
-    cb_sel = imc_cb_select[s];
-
-    if(stream_format_code & 4)
-        start = 1;
-    if(start)
-        levlCoeffs[0] = get_bits(&q->gb, 7);
-    for(i = start; i < BANDS; i++){
-        levlCoeffs[i] = get_vlc2(&q->gb, hufftab[cb_sel[i]]->table, hufftab[cb_sel[i]]->bits, 2);
-        if(levlCoeffs[i] == 17)
-            levlCoeffs[i] += get_bits(&q->gb, 4);
-    }
-}
-
-static void imc_decode_level_coefficients(IMCContext* q, int* levlCoeffBuf, float* flcoeffs1,
-                                         float* flcoeffs2)
-{
-    int i, level;
-    float tmp, tmp2;
-    //maybe some frequency division thingy
-
-    flcoeffs1[0] = 20000.0 / pow (2, levlCoeffBuf[0] * 0.18945); // 0.18945 = log2(10) * 0.05703125
-    flcoeffs2[0] = log(flcoeffs1[0])/log(2);
-    tmp = flcoeffs1[0];
-    tmp2 = flcoeffs2[0];
-
-    for(i = 1; i < BANDS; i++) {
-        level = levlCoeffBuf[i];
-        if (level == 16) {
-            flcoeffs1[i] = 1.0;
-            flcoeffs2[i] = 0.0;
-        } else {
-            if (level < 17)
-                level -=7;
-            else if (level <= 24)
-                level -=32;
-            else
-                level -=16;
-
-            tmp  *= imc_exp_tab[15 + level];
-            tmp2 += 0.83048 * level;  // 0.83048 = log2(10) * 0.25
-            flcoeffs1[i] = tmp;
-            flcoeffs2[i] = tmp2;
-        }
-    }
-}
-
-
-static void imc_decode_level_coefficients2(IMCContext* q, int* levlCoeffBuf, float* old_floor, float* flcoeffs1,
-                                          float* flcoeffs2) {
-    int i;
-        //FIXME maybe flag_buf = noise coding and flcoeffs1 = new scale factors
-        //      and flcoeffs2 old scale factors
-        //      might be incomplete due to a missing table that is in the binary code
-    for(i = 0; i < BANDS; i++) {
-        flcoeffs1[i] = 0;
-        if(levlCoeffBuf[i] < 16) {
-            flcoeffs1[i] = imc_exp_tab2[levlCoeffBuf[i]] * old_floor[i];
-            flcoeffs2[i] = (levlCoeffBuf[i]-7) * 0.83048 + flcoeffs2[i]; // 0.83048 = log2(10) * 0.25
-        } else {
-            flcoeffs1[i] = old_floor[i];
-        }
-    }
-}
-
-/**
- * Perform bit allocation depending on bits available
- */
-static int bit_allocation (IMCContext* q, int stream_format_code, int freebits, int flag) {
-    int i, j;
-    const float limit = -1.e20;
-    float highest = 0.0;
-    int indx;
-    int t1 = 0;
-    int t2 = 1;
-    float summa = 0.0;
-    int iacc = 0;
-    int summer = 0;
-    int rres, cwlen;
-    float lowest = 1.e10;
-    int low_indx = 0;
-    float workT[32];
-    int flg;
-    int found_indx = 0;
-
-    for(i = 0; i < BANDS; i++)
-        highest = FFMAX(highest, q->flcoeffs1[i]);
-
-    for(i = 0; i < BANDS-1; i++) {
-        q->flcoeffs4[i] = q->flcoeffs3[i] - log(q->flcoeffs5[i])/log(2);
-    }
-    q->flcoeffs4[BANDS - 1] = limit;
-
-    highest = highest * 0.25;
-
-    for(i = 0; i < BANDS; i++) {
-        indx = -1;
-        if ((band_tab[i+1] - band_tab[i]) == q->bandWidthT[i])
-            indx = 0;
-
-        if ((band_tab[i+1] - band_tab[i]) > q->bandWidthT[i])
-            indx = 1;
-
-        if (((band_tab[i+1] - band_tab[i])/2) >= q->bandWidthT[i])
-            indx = 2;
-
-        if (indx == -1)
-            return -1;
-
-        q->flcoeffs4[i] = q->flcoeffs4[i] + xTab[(indx*2 + (q->flcoeffs1[i] < highest)) * 2 + flag];
-    }
-
-    if (stream_format_code & 0x2) {
-        q->flcoeffs4[0] = limit;
-        q->flcoeffs4[1] = limit;
-        q->flcoeffs4[2] = limit;
-        q->flcoeffs4[3] = limit;
-    }
-
-    for(i = (stream_format_code & 0x2)?4:0; i < BANDS-1; i++) {
-        iacc += q->bandWidthT[i];
-        summa += q->bandWidthT[i] * q->flcoeffs4[i];
-    }
-    q->bandWidthT[BANDS-1] = 0;
-    summa = (summa * 0.5 - freebits) / iacc;
-
-
-    for(i = 0; i < BANDS/2; i++) {
-        rres = summer - freebits;
-        if((rres >= -8) && (rres <= 8)) break;
-
-        summer = 0;
-        iacc = 0;
-
-        for(j = (stream_format_code & 0x2)?4:0; j < BANDS; j++) {
-            cwlen = av_clip((int)((q->flcoeffs4[j] * 0.5) - summa + 0.5), 0, 6);
-
-            q->bitsBandT[j] = cwlen;
-            summer += q->bandWidthT[j] * cwlen;
-
-            if (cwlen > 0)
-                iacc += q->bandWidthT[j];
-        }
-
-        flg = t2;
-        t2 = 1;
-        if (freebits < summer)
-            t2 = -1;
-        if (i == 0)
-            flg = t2;
-        if(flg != t2)
-            t1++;
-
-        summa = (float)(summer - freebits) / ((t1 + 1) * iacc) + summa;
-    }
-
-    for(i = (stream_format_code & 0x2)?4:0; i < BANDS; i++) {
-        for(j = band_tab[i]; j < band_tab[i+1]; j++)
-            q->CWlengthT[j] = q->bitsBandT[i];
-    }
-
-    if (freebits > summer) {
-        for(i = 0; i < BANDS; i++) {
-            workT[i] = (q->bitsBandT[i] == 6) ? -1.e20 : (q->bitsBandT[i] * -2 + q->flcoeffs4[i] - 0.415);
-        }
-
-        highest = 0.0;
-
-        do{
-            if (highest <= -1.e20)
-                break;
-
-            found_indx = 0;
-            highest = -1.e20;
-
-            for(i = 0; i < BANDS; i++) {
-                if (workT[i] > highest) {
-                    highest = workT[i];
-                    found_indx = i;
-                }
-            }
-
-            if (highest > -1.e20) {
-                workT[found_indx] -= 2.0;
-                if (++(q->bitsBandT[found_indx]) == 6)
-                    workT[found_indx] = -1.e20;
-
-                for(j = band_tab[found_indx]; j < band_tab[found_indx+1] && (freebits > summer); j++){
-                    q->CWlengthT[j]++;
-                    summer++;
-                }
-            }
-        }while (freebits > summer);
-    }
-    if (freebits < summer) {
-        for(i = 0; i < BANDS; i++) {
-            workT[i] = q->bitsBandT[i] ? (q->bitsBandT[i] * -2 + q->flcoeffs4[i] + 1.585) : 1.e20;
-        }
-        if (stream_format_code & 0x2) {
-            workT[0] = 1.e20;
-            workT[1] = 1.e20;
-            workT[2] = 1.e20;
-            workT[3] = 1.e20;
-        }
-        while (freebits < summer){
-            lowest = 1.e10;
-            low_indx = 0;
-            for(i = 0; i < BANDS; i++) {
-                if (workT[i] < lowest) {
-                    lowest = workT[i];
-                    low_indx = i;
-                }
-            }
-            //if(lowest >= 1.e10) break;
-            workT[low_indx] = lowest + 2.0;
-
-            if (!(--q->bitsBandT[low_indx]))
-                workT[low_indx] = 1.e20;
-
-            for(j = band_tab[low_indx]; j < band_tab[low_indx+1] && (freebits < summer); j++){
-                if(q->CWlengthT[j] > 0){
-                    q->CWlengthT[j]--;
-                    summer--;
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-static void imc_get_skip_coeff(IMCContext* q) {
-    int i, j;
-
-    memset(q->skipFlagBits, 0, sizeof(q->skipFlagBits));
-    memset(q->skipFlagCount, 0, sizeof(q->skipFlagCount));
-    for(i = 0; i < BANDS; i++) {
-        if (!q->bandFlagsBuf[i] || !q->bandWidthT[i])
-            continue;
-
-        if (!q->skipFlagRaw[i]) {
-            q->skipFlagBits[i] = band_tab[i+1] - band_tab[i];
-
-            for(j = band_tab[i]; j < band_tab[i+1]; j++) {
-                if ((q->skipFlags[j] = get_bits1(&q->gb)))
-                    q->skipFlagCount[i]++;
-            }
-        } else {
-            for(j = band_tab[i]; j < (band_tab[i+1]-1); j += 2) {
-                if(!get_bits1(&q->gb)){//0
-                    q->skipFlagBits[i]++;
-                    q->skipFlags[j]=1;
-                    q->skipFlags[j+1]=1;
-                    q->skipFlagCount[i] += 2;
-                }else{
-                    if(get_bits1(&q->gb)){//11
-                        q->skipFlagBits[i] +=2;
-                        q->skipFlags[j]=0;
-                        q->skipFlags[j+1]=1;
-                        q->skipFlagCount[i]++;
-                    }else{
-                        q->skipFlagBits[i] +=3;
-                        q->skipFlags[j+1]=0;
-                        if(!get_bits1(&q->gb)){//100
-                            q->skipFlags[j]=1;
-                            q->skipFlagCount[i]++;
-                        }else{//101
-                            q->skipFlags[j]=0;
-                        }
-                    }
-                }
-            }
-
-            if (j < band_tab[i+1]) {
-                q->skipFlagBits[i]++;
-                if ((q->skipFlags[j] = get_bits1(&q->gb)))
-                    q->skipFlagCount[i]++;
-            }
-        }
-    }
-}
-
-/**
- * Increase highest' band coefficient sizes as some bits won't be used
- */
-static void imc_adjust_bit_allocation (IMCContext* q, int summer) {
-    float workT[32];
-    int corrected = 0;
-    int i, j;
-    float highest = 0;
-    int found_indx=0;
-
-    for(i = 0; i < BANDS; i++) {
-        workT[i] = (q->bitsBandT[i] == 6) ? -1.e20 : (q->bitsBandT[i] * -2 + q->flcoeffs4[i] - 0.415);
-    }
-
-    while (corrected < summer) {
-        if(highest <= -1.e20)
-            break;
-
-        highest = -1.e20;
-
-        for(i = 0; i < BANDS; i++) {
-            if (workT[i] > highest) {
-                highest = workT[i];
-                found_indx = i;
-            }
-        }
-
-        if (highest > -1.e20) {
-            workT[found_indx] -= 2.0;
-            if (++(q->bitsBandT[found_indx]) == 6)
-                workT[found_indx] = -1.e20;
-
-            for(j = band_tab[found_indx]; j < band_tab[found_indx+1] && (corrected < summer); j++) {
-                if (!q->skipFlags[j] && (q->CWlengthT[j] < 6)) {
-                    q->CWlengthT[j]++;
-                    corrected++;
-                }
-            }
-        }
-    }
-}
-
-static void imc_imdct256(IMCContext *q) {
-    int i;
-    float re, im;
-
-    /* prerotation */
-    for(i=0; i < COEFFS/2; i++){
-        q->samples[i].re = -(q->pre_coef1[i] * q->CWdecoded[COEFFS-1-i*2]) -
-                           (q->pre_coef2[i] * q->CWdecoded[i*2]);
-        q->samples[i].im = (q->pre_coef2[i] * q->CWdecoded[COEFFS-1-i*2]) -
-                           (q->pre_coef1[i] * q->CWdecoded[i*2]);
-    }
-
-    /* FFT */
-    ff_fft_permute(&q->fft, q->samples);
-    ff_fft_calc (&q->fft, q->samples);
-
-    /* postrotation, window and reorder */
-    for(i = 0; i < COEFFS/2; i++){
-        re = (q->samples[i].re * q->post_cos[i]) + (-q->samples[i].im * q->post_sin[i]);
-        im = (-q->samples[i].im * q->post_cos[i]) - (q->samples[i].re * q->post_sin[i]);
-        q->out_samples[i*2] = (q->mdct_sine_window[COEFFS-1-i*2] * q->last_fft_im[i]) + (q->mdct_sine_window[i*2] * re);
-        q->out_samples[COEFFS-1-i*2] = (q->mdct_sine_window[i*2] * q->last_fft_im[i]) - (q->mdct_sine_window[COEFFS-1-i*2] * re);
-        q->last_fft_im[i] = im;
-    }
-}
-
-static int inverse_quant_coeff (IMCContext* q, int stream_format_code) {
-    int i, j;
-    int middle_value, cw_len, max_size;
-    const float* quantizer;
-
-    for(i = 0; i < BANDS; i++) {
-        for(j = band_tab[i]; j < band_tab[i+1]; j++) {
-            q->CWdecoded[j] = 0;
-            cw_len = q->CWlengthT[j];
-
-            if (cw_len <= 0 || q->skipFlags[j])
-                continue;
-
-            max_size = 1 << cw_len;
-            middle_value = max_size >> 1;
-
-            if (q->codewords[j] >= max_size || q->codewords[j] < 0)
-                return -1;
-
-            if (cw_len >= 4){
-                quantizer = imc_quantizer2[(stream_format_code & 2) >> 1];
-                if (q->codewords[j] >= middle_value)
-                    q->CWdecoded[j] = quantizer[q->codewords[j] - 8] * q->flcoeffs6[i];
-                else
-                    q->CWdecoded[j] = -quantizer[max_size - q->codewords[j] - 8 - 1] * q->flcoeffs6[i];
-            }else{
-                quantizer = imc_quantizer1[((stream_format_code & 2) >> 1) | (q->bandFlagsBuf[i] << 1)];
-                if (q->codewords[j] >= middle_value)
-                    q->CWdecoded[j] = quantizer[q->codewords[j] - 1] * q->flcoeffs6[i];
-                else
-                    q->CWdecoded[j] = -quantizer[max_size - 2 - q->codewords[j]] * q->flcoeffs6[i];
-            }
-        }
-    }
-    return 0;
-}
-
-
-static int imc_get_coeffs (IMCContext* q) {
-    int i, j, cw_len, cw;
-
-    for(i = 0; i < BANDS; i++) {
-        if(!q->sumLenArr[i]) continue;
-        if (q->bandFlagsBuf[i] || q->bandWidthT[i]) {
-            for(j = band_tab[i]; j < band_tab[i+1]; j++) {
-                cw_len = q->CWlengthT[j];
-                cw = 0;
-
-                if (get_bits_count(&q->gb) + cw_len > 512){
-//av_log(NULL,0,"Band %i coeff %i cw_len %i\n",i,j,cw_len);
-                    return -1;
-                }
-
-                if(cw_len && (!q->bandFlagsBuf[i] || !q->skipFlags[j]))
-                    cw = get_bits(&q->gb, cw_len);
-
-                q->codewords[j] = cw;
-            }
-        }
-    }
-    return 0;
-}
-
-static int imc_decode_frame(AVCodecContext * avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-
-    IMCContext *q = avctx->priv_data;
-
-    int stream_format_code;
-    int imc_hdr, i, j;
-    int flag;
-    int bits, summer;
-    int counter, bitscount;
-    uint16_t buf16[IMC_BLOCK_SIZE / 2];
-
-    if (buf_size < IMC_BLOCK_SIZE) {
-        av_log(avctx, AV_LOG_ERROR, "imc frame too small!\n");
-        return -1;
-    }
-    for(i = 0; i < IMC_BLOCK_SIZE / 2; i++)
-        buf16[i] = bswap_16(((const uint16_t*)buf)[i]);
-
-    init_get_bits(&q->gb, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8);
-
-    /* Check the frame header */
-    imc_hdr = get_bits(&q->gb, 9);
-    if (imc_hdr != IMC_FRAME_ID) {
-        av_log(avctx, AV_LOG_ERROR, "imc frame header check failed!\n");
-        av_log(avctx, AV_LOG_ERROR, "got %x instead of 0x21.\n", imc_hdr);
-        return -1;
-    }
-    stream_format_code = get_bits(&q->gb, 3);
-
-    if(stream_format_code & 1){
-        av_log(avctx, AV_LOG_ERROR, "Stream code format %X is not supported\n", stream_format_code);
-        return -1;
-    }
-
-//    av_log(avctx, AV_LOG_DEBUG, "stream_format_code = %d\n", stream_format_code);
-
-    if (stream_format_code & 0x04)
-        q->decoder_reset = 1;
-
-    if(q->decoder_reset) {
-        memset(q->out_samples, 0, sizeof(q->out_samples));
-        for(i = 0; i < BANDS; i++)q->old_floor[i] = 1.0;
-        for(i = 0; i < COEFFS; i++)q->CWdecoded[i] = 0;
-        q->decoder_reset = 0;
-    }
-
-    flag = get_bits1(&q->gb);
-    imc_read_level_coeffs(q, stream_format_code, q->levlCoeffBuf);
-
-    if (stream_format_code & 0x4)
-        imc_decode_level_coefficients(q, q->levlCoeffBuf, q->flcoeffs1, q->flcoeffs2);
-    else
-        imc_decode_level_coefficients2(q, q->levlCoeffBuf, q->old_floor, q->flcoeffs1, q->flcoeffs2);
-
-    memcpy(q->old_floor, q->flcoeffs1, 32 * sizeof(float));
-
-    counter = 0;
-    for (i=0 ; i<BANDS ; i++) {
-        if (q->levlCoeffBuf[i] == 16) {
-            q->bandWidthT[i] = 0;
-            counter++;
-        } else
-            q->bandWidthT[i] = band_tab[i+1] - band_tab[i];
-    }
-    memset(q->bandFlagsBuf, 0, BANDS * sizeof(int));
-    for(i = 0; i < BANDS-1; i++) {
-        if (q->bandWidthT[i])
-            q->bandFlagsBuf[i] = get_bits1(&q->gb);
-    }
-
-    imc_calculate_coeffs(q, q->flcoeffs1, q->flcoeffs2, q->bandWidthT, q->flcoeffs3, q->flcoeffs5);
-
-    bitscount = 0;
-    /* first 4 bands will be assigned 5 bits per coefficient */
-    if (stream_format_code & 0x2) {
-        bitscount += 15;
-
-        q->bitsBandT[0] = 5;
-        q->CWlengthT[0] = 5;
-        q->CWlengthT[1] = 5;
-        q->CWlengthT[2] = 5;
-        for(i = 1; i < 4; i++){
-            bits = (q->levlCoeffBuf[i] == 16) ? 0 : 5;
-            q->bitsBandT[i] = bits;
-            for(j = band_tab[i]; j < band_tab[i+1]; j++) {
-                q->CWlengthT[j] = bits;
-                bitscount += bits;
-            }
-        }
-    }
-
-    if(bit_allocation (q, stream_format_code, 512 - bitscount - get_bits_count(&q->gb), flag) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Bit allocations failed\n");
-        q->decoder_reset = 1;
-        return -1;
-    }
-
-    for(i = 0; i < BANDS; i++) {
-        q->sumLenArr[i] = 0;
-        q->skipFlagRaw[i] = 0;
-        for(j = band_tab[i]; j < band_tab[i+1]; j++)
-            q->sumLenArr[i] += q->CWlengthT[j];
-        if (q->bandFlagsBuf[i])
-            if( (((band_tab[i+1] - band_tab[i]) * 1.5) > q->sumLenArr[i]) && (q->sumLenArr[i] > 0))
-                q->skipFlagRaw[i] = 1;
-    }
-
-    imc_get_skip_coeff(q);
-
-    for(i = 0; i < BANDS; i++) {
-        q->flcoeffs6[i] = q->flcoeffs1[i];
-        /* band has flag set and at least one coded coefficient */
-        if (q->bandFlagsBuf[i] && (band_tab[i+1] - band_tab[i]) != q->skipFlagCount[i]){
-                q->flcoeffs6[i] *= q->sqrt_tab[band_tab[i+1] - band_tab[i]] /
-                                   q->sqrt_tab[(band_tab[i+1] - band_tab[i] - q->skipFlagCount[i])];
-        }
-    }
-
-    /* calculate bits left, bits needed and adjust bit allocation */
-    bits = summer = 0;
-
-    for(i = 0; i < BANDS; i++) {
-        if (q->bandFlagsBuf[i]) {
-            for(j = band_tab[i]; j < band_tab[i+1]; j++) {
-                if(q->skipFlags[j]) {
-                    summer += q->CWlengthT[j];
-                    q->CWlengthT[j] = 0;
-                }
-            }
-            bits += q->skipFlagBits[i];
-            summer -= q->skipFlagBits[i];
-        }
-    }
-    imc_adjust_bit_allocation(q, summer);
-
-    for(i = 0; i < BANDS; i++) {
-        q->sumLenArr[i] = 0;
-
-        for(j = band_tab[i]; j < band_tab[i+1]; j++)
-            if (!q->skipFlags[j])
-                q->sumLenArr[i] += q->CWlengthT[j];
-    }
-
-    memset(q->codewords, 0, sizeof(q->codewords));
-
-    if(imc_get_coeffs(q) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Read coefficients failed\n");
-        q->decoder_reset = 1;
-        return 0;
-    }
-
-    if(inverse_quant_coeff(q, stream_format_code) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Inverse quantization of coefficients failed\n");
-        q->decoder_reset = 1;
-        return 0;
-    }
-
-    memset(q->skipFlags, 0, sizeof(q->skipFlags));
-
-    imc_imdct256(q);
-
-    q->dsp.float_to_int16(data, q->out_samples, COEFFS);
-
-    *data_size = COEFFS * sizeof(int16_t);
-
-    return IMC_BLOCK_SIZE;
-}
-
-
-static av_cold int imc_decode_close(AVCodecContext * avctx)
-{
-    IMCContext *q = avctx->priv_data;
-
-    ff_fft_end(&q->fft);
-    return 0;
-}
-
-
-AVCodec imc_decoder = {
-    .name = "imc",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_IMC,
-    .priv_data_size = sizeof(IMCContext),
-    .init = imc_decode_init,
-    .close = imc_decode_close,
-    .decode = imc_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"),
-};
diff --git a/libavcodec/imcdata.h b/libavcodec/imcdata.h
deleted file mode 100644
index 64e7c71..0000000
--- a/libavcodec/imcdata.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * IMC compatible decoder
- * Copyright (c) 2002-2004 Maxim Poliakovski
- * Copyright (c) 2006 Benjamin Larsson
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_IMCDATA_H
-#define AVCODEC_IMCDATA_H
-
-#include <stdint.h>
-
-static const uint16_t band_tab[33] = {
-      0,   3,   6,   9,  12,  16,  20,  24,  29,  34,  40,
-     46,  53,  60,  68,  76,  84,  93, 102, 111, 121, 131,
-    141, 151, 162, 173, 184, 195, 207, 219, 231, 243, 256,
-};
-
-
-static const int8_t cyclTab[32] = {
-    1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
-   12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23,
-   24, 25, 26, 27, 28, 29, 30, 31, 32, 32,
-};
-
-static const int8_t cyclTab2[32] = {
-   -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 17, 18, 19, 20, 21, 22,
-23, 24, 25, 26, 27, 28, 29};
-
-static const float imc_weights1[31] = {
-    0.119595, 0.123124, 0.129192, 9.97377e-2, 8.1923e-2, 9.61153e-2, 8.77885e-2, 8.61174e-2,
-    9.00882e-2, 9.91658e-2, 0.112991, 0.131126, 0.152886, 0.177292, 0.221782, 0.244917, 0.267386,
-    0.306816, 0.323046, 0.33729, 0.366773, 0.392557, 0.398076, 0.403302, 0.42451, 0.444777,
-    0.449188, 0.455445, 0.477853, 0.500669, 0.510395};
-
-static const float imc_weights2[31] = {
-    3.23466e-3, 3.49886e-3, 3.98413e-3, 1.98116e-3, 1.16465e-3, 1.79283e-3, 1.40372e-3, 1.33274e-3,
-    1.50523e-3, 1.95064e-3, 2.77472e-3, 4.14725e-3, 6.2776e-3, 9.36401e-3, 1.71397e-2, 2.24052e-2,
-    2.83971e-2, 4.11689e-2, 4.73165e-2, 5.31631e-2, 6.66614e-2, 8.00824e-2, 8.31588e-2, 8.61397e-2,
-    9.89229e-2, 0.112197, 0.115227, 0.119613, 0.136174, 0.15445, 0.162685};
-
-static const float imc_quantizer1[4][8] = {
-    { 8.4431201e-1, 4.7358301e-1, 1.448354, 2.7073899e-1, 7.4449003e-1, 1.241991,  1.845484,  0.0},
-    { 8.6876702e-1, 4.7659001e-1, 1.478224, 2.5672799e-1, 7.55777e-1,   1.3229851, 2.03438,   0.0},
-    { 7.5891501e-1, 6.2272799e-1, 1.271322, 3.47904e-1,   7.5317699e-1, 1.150767,  1.628476,  0.0},
-    { 7.65257e-1,   6.44647e-1,   1.263824, 3.4548101e-1, 7.6384902e-1, 1.214466,  1.7638789, 0.0},
-};
-
-static const float imc_quantizer2[2][56] = {
-    { 1.39236e-1, 3.50548e-1, 5.9547901e-1, 8.5772401e-1, 1.121545, 1.3882281, 1.695882, 2.1270809,
-      7.2221003e-2, 1.85177e-1, 2.9521701e-1, 4.12568e-1, 5.4068601e-1, 6.7679501e-1, 8.1196898e-1, 9.4765198e-1,
-      1.0779999, 1.203415, 1.337265, 1.481871, 1.639982, 1.814766, 2.0701399, 2.449862,
-      3.7533998e-2, 1.02722e-1, 1.6021401e-1, 2.16043e-1, 2.7231601e-1, 3.3025399e-1, 3.9022601e-1, 4.52849e-1,
-      5.1794899e-1, 5.8529502e-1, 6.53956e-1, 7.2312802e-1, 7.9150802e-1, 8.5891002e-1, 9.28141e-1, 9.9706203e-1,
-      1.062153, 1.12564, 1.189834, 1.256122, 1.324469, 1.3955311, 1.468906, 1.545084,
-      1.6264729, 1.711524, 1.802705, 1.91023, 2.0533991, 2.22333, 2.4830019, 3.253329 },
-    { 1.11654e-1, 3.54469e-1, 6.4232099e-1, 9.6128798e-1, 1.295053, 1.61777, 1.989839, 2.51107,
-      5.7721999e-2, 1.69879e-1, 2.97589e-1, 4.3858799e-1, 5.9039903e-1, 7.4934798e-1, 9.1628098e-1, 1.087297,
-      1.262751, 1.4288321, 1.6040879, 1.79067, 2.000668, 2.2394669, 2.649332, 5.2760072,
-      2.9722e-2, 8.7316997e-2, 1.4445201e-1, 2.04247e-1, 2.6879501e-1, 3.3716801e-1, 4.08811e-1, 4.8306999e-1,
-      5.6049401e-1, 6.3955498e-1, 7.2044599e-1, 8.0427998e-1, 8.8933599e-1, 9.7537601e-1, 1.062461, 1.1510431,
-      1.240236, 1.326715, 1.412513, 1.500502, 1.591749, 1.686413, 1.785239, 1.891233,
-      2.0051291, 2.127681, 2.2709141, 2.475826, 2.7219379, 3.101985, 4.686213, 6.2287788},
-};
-
-
-static const float xTab[14] = {7.6, 3.6, 4.4, 3.7, 6.1, 5.1, 2.3, 1.6, 6.2, 1.5, 1.8, 1.2, 0, 0}; //10014048
-
-/* precomputed table for 10^(i/4), i=-15..16 */
-static const float imc_exp_tab[32] = {
-    1.778280e-4, 3.162278e-4, 5.623413e-4, 1.000000e-3,
-    1.778280e-3, 3.162278e-3, 5.623413e-3, 1.000000e-2,
-    1.778280e-2, 3.162278e-2, 5.623413e-2, 1.000000e-1,
-    1.778280e-1, 3.162278e-1, 5.623413e-1, 1.000000e00,
-    1.778280e00, 3.162278e00, 5.623413e00, 1.000000e01,
-    1.778280e01, 3.162278e01, 5.623413e01, 1.000000e02,
-    1.778280e02, 3.162278e02, 5.623413e02, 1.000000e03,
-    1.778280e03, 3.162278e03, 5.623413e03, 1.000000e04
-};
-static const float * const imc_exp_tab2 = imc_exp_tab + 8;
-
-
-static const uint8_t imc_cb_select[4][32] = {
-    { 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0,
-      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2 },
-    { 0, 2, 0, 3, 2, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-      0, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
-    { 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-      3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2 },
-    { 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-      3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
-};
-
-static const uint8_t imc_huffman_sizes[4] = {
-    17,  17,  18,  18
-};
-
-static const uint8_t imc_huffman_lens[4][4][18] = {
-    {
-        { 16, 15, 13, 11,  8,  5,  3,  1,  2,  4,  6,  9, 10, 12, 14, 16,  7,  0 },
-        { 10,  8,  7,  6,  4,  4,  3,  2,  2,  3,  4,  6,  7,  9, 11, 11,  7,  0 },
-        { 15, 15, 14, 11,  8,  6,  4,  2,  1,  4,  5,  7,  9, 10, 12, 13,  4,  0 },
-        { 13, 11, 10,  8,  6,  4,  2,  2,  2,  3,  5,  7,  9, 12, 15, 15, 14,  0 },
-    },
-    {
-        { 14, 12, 10,  8,  7,  4,  2,  2,  2,  3,  5,  7,  9, 11, 13, 14,  7,  0 },
-        { 14, 13, 11,  8,  6,  4,  3,  2,  2,  3,  5,  7,  9, 10, 12, 14,  3,  0 },
-        { 13, 12, 10,  7,  5,  4,  3,  2,  2,  3,  4,  6,  8,  9, 11, 13,  4,  0 },
-        { 13, 12, 10,  7,  5,  4,  3,  2,  2,  3,  4,  6,  8,  9, 11, 13,  4,  0 },
-    },
-    {
-        { 16, 14, 12, 10,  8,  5,  3,  1,  2,  4,  7,  9, 11, 13, 15, 17,  6, 17 },
-        { 15, 13, 11,  8,  6,  4,  2,  2,  2,  3,  5,  7, 10, 12, 14, 16,  9, 16 },
-        { 14, 12, 11,  9,  8,  6,  3,  1,  2,  5,  7, 10, 13, 15, 16, 17,  4, 17 },
-        { 16, 14, 12,  9,  7,  5,  2,  2,  2,  3,  4,  6,  8, 11, 13, 15, 10, 16 },
-    },
-    {
-        { 13, 11, 10,  8,  7,  5,  2,  2,  2,  4,  6,  9, 12, 14, 15, 16,  3, 16 },
-        { 11, 11, 10,  9,  8,  7,  5,  4,  3,  3,  3,  3,  3,  3,  4,  5,  6,  5 },
-        {  9,  9,  7,  6,  5,  4,  3,  3,  2,  3,  4,  5,  4,  5,  5,  6,  8,  6 },
-        { 13, 12, 10,  8,  5,  3,  3,  2,  2,  3,  4,  7,  9, 11, 14, 15,  6, 15 },
-    }
-};
-
-static const uint16_t imc_huffman_bits[4][4][18] = {
-    {
-        { 0xCC32, 0x6618, 0x1987, 0x0660, 0x00CD, 0x0018, 0x0007, 0x0000, 0x0002, 0x000D, 0x0032, 0x0199, 0x0331, 0x0CC2, 0x330D, 0xCC33, 0x0067, 0x0000 },
-        { 0x02FE, 0x00BE, 0x005E, 0x002D, 0x000A, 0x0009, 0x0003, 0x0003, 0x0000, 0x0002, 0x0008, 0x002C, 0x005D, 0x017E, 0x05FE, 0x05FF, 0x005C, 0x0000 },
-        { 0x5169, 0x5168, 0x28B5, 0x0517, 0x00A3, 0x0029, 0x0008, 0x0003, 0x0000, 0x0009, 0x0015, 0x0050, 0x0144, 0x028A, 0x0A2C, 0x145B, 0x000B, 0x0000 },
-        { 0x1231, 0x048D, 0x0247, 0x0090, 0x0025, 0x0008, 0x0001, 0x0003, 0x0000, 0x0005, 0x0013, 0x0049, 0x0122, 0x0919, 0x48C3, 0x48C2, 0x2460, 0x0000 },
-    },
-    {
-        { 0x2D1D, 0x0B46, 0x02D0, 0x00B5, 0x0059, 0x000A, 0x0003, 0x0001, 0x0000, 0x0004, 0x0017, 0x005B, 0x0169, 0x05A2, 0x168F, 0x2D1C, 0x0058, 0x0000 },
-        { 0x1800, 0x0C01, 0x0301, 0x0061, 0x0019, 0x0007, 0x0004, 0x0003, 0x0000, 0x0005, 0x000D, 0x0031, 0x00C1, 0x0181, 0x0601, 0x1801, 0x0002, 0x0000 },
-        { 0x1556, 0x0AAA, 0x02AB, 0x0054, 0x0014, 0x000B, 0x0002, 0x0003, 0x0000, 0x0003, 0x0008, 0x002B, 0x00AB, 0x0154, 0x0554, 0x1557, 0x0009, 0x0000 },
-        { 0x1556, 0x0AAA, 0x02AB, 0x0054, 0x0014, 0x000B, 0x0002, 0x0003, 0x0000, 0x0003, 0x0008, 0x002B, 0x00AB, 0x0154, 0x0554, 0x1557, 0x0009, 0x0000 },
-    },
-    {
-        { 0x2993, 0x0A65, 0x0298, 0x00A7, 0x0028, 0x0004, 0x0000, 0x0001, 0x0001, 0x0003, 0x0015, 0x0052, 0x014D, 0x0533, 0x14C8, 0x5324, 0x000B, 0x5325 },
-        { 0x09B8, 0x026F, 0x009A, 0x0012, 0x0005, 0x0000, 0x0001, 0x0002, 0x0003, 0x0001, 0x0003, 0x0008, 0x004C, 0x0136, 0x04DD, 0x1373, 0x0027, 0x1372 },
-        { 0x0787, 0x01E0, 0x00F1, 0x003D, 0x001F, 0x0006, 0x0001, 0x0001, 0x0001, 0x0002, 0x000E, 0x0079, 0x03C2, 0x0F0D, 0x1E19, 0x3C30, 0x0000, 0x3C31 },
-        { 0x4B06, 0x12C0, 0x04B1, 0x0097, 0x0024, 0x0008, 0x0002, 0x0003, 0x0000, 0x0003, 0x0005, 0x0013, 0x004A, 0x0259, 0x0961, 0x2582, 0x012D, 0x4B07 },
-    },
-    {
-        { 0x0A5A, 0x0297, 0x014A, 0x0053, 0x0028, 0x000B, 0x0003, 0x0000, 0x0002, 0x0004, 0x0015, 0x00A4, 0x052C, 0x14B7, 0x296C, 0x52DB, 0x0003, 0x52DA },
-        { 0x0193, 0x0192, 0x00C8, 0x0065, 0x0033, 0x0018, 0x0007, 0x0004, 0x0000, 0x0004, 0x0005, 0x0007, 0x0006, 0x0003, 0x0005, 0x0005, 0x000D, 0x0004 },
-        { 0x0012, 0x0013, 0x0005, 0x0003, 0x0000, 0x0003, 0x0005, 0x0004, 0x0003, 0x0003, 0x0005, 0x0005, 0x0004, 0x0004, 0x0003, 0x0005, 0x0008, 0x0004 },
-        { 0x0D66, 0x06B2, 0x01AD, 0x006A, 0x000C, 0x0005, 0x0004, 0x0000, 0x0003, 0x0002, 0x0007, 0x0034, 0x00D7, 0x0358, 0x1ACF, 0x359C, 0x001B, 0x359D },
-    }
-};
-
-#endif /* AVCODEC_IMCDATA_H */
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
deleted file mode 100644
index 8f789c4..0000000
--- a/libavcodec/imgconvert.c
+++ /dev/null
@@ -1,1478 +0,0 @@
-/*
- * Misc image conversion routines
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * misc image conversion routines
- */
-
-/* TODO:
- * - write 'ffimg' program to test all the image related stuff
- * - move all api to slice based system
- * - integrate deinterlacing, postprocessing and scaling in the conversion process
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "colorspace.h"
-#include "internal.h"
-#include "imgconvert.h"
-#include "libavutil/pixdesc.h"
-
-#if HAVE_MMX
-#include "x86/mmx.h"
-#include "x86/dsputil_mmx.h"
-#endif
-
-#define xglue(x, y) x ## y
-#define glue(x, y) xglue(x, y)
-
-#define FF_COLOR_RGB      0 /**< RGB color space */
-#define FF_COLOR_GRAY     1 /**< gray color space */
-#define FF_COLOR_YUV      2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */
-#define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */
-
-#define FF_PIXEL_PLANAR   0 /**< each channel has one component in AVPicture */
-#define FF_PIXEL_PACKED   1 /**< only one components containing all the channels */
-#define FF_PIXEL_PALETTE  2  /**< one components containing indexes for a palette */
-
-typedef struct PixFmtInfo {
-    uint8_t nb_channels;     /**< number of channels (including alpha) */
-    uint8_t color_type;      /**< color type (see FF_COLOR_xxx constants) */
-    uint8_t pixel_type;      /**< pixel storage type (see FF_PIXEL_xxx constants) */
-    uint8_t is_alpha : 1;    /**< true if alpha can be specified */
-    uint8_t depth;           /**< bit depth of the color components */
-} PixFmtInfo;
-
-/* this table gives more information about formats */
-static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
-    /* YUV formats */
-    [PIX_FMT_YUV420P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUV422P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUV444P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUYV422] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_UYVY422] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_YUV410P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUV411P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUV440P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUV420P16LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-    [PIX_FMT_YUV422P16LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-    [PIX_FMT_YUV444P16LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-    [PIX_FMT_YUV420P16BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-    [PIX_FMT_YUV422P16BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-    [PIX_FMT_YUV444P16BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-
-
-    /* YUV formats with alpha plane */
-    [PIX_FMT_YUVA420P] = {
-        .nb_channels = 4,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-
-    /* JPEG YUV */
-    [PIX_FMT_YUVJ420P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV_JPEG,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUVJ422P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV_JPEG,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUVJ444P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV_JPEG,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_YUVJ440P] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_YUV_JPEG,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-
-    /* RGB formats */
-    [PIX_FMT_RGB24] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_BGR24] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_ARGB] = {
-        .nb_channels = 4, .is_alpha = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_RGB48BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 16,
-    },
-    [PIX_FMT_RGB48LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 16,
-    },
-    [PIX_FMT_RGB565BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_RGB565LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_RGB555BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_RGB555LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_RGB444BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 4,
-    },
-    [PIX_FMT_RGB444LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 4,
-    },
-
-    /* gray / mono formats */
-    [PIX_FMT_GRAY16BE] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_GRAY,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-    [PIX_FMT_GRAY16LE] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_GRAY,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 16,
-    },
-    [PIX_FMT_GRAY8] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_GRAY,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_MONOWHITE] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_GRAY,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 1,
-    },
-    [PIX_FMT_MONOBLACK] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_GRAY,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 1,
-    },
-
-    /* paletted formats */
-    [PIX_FMT_PAL8] = {
-        .nb_channels = 4, .is_alpha = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PALETTE,
-        .depth = 8,
-    },
-    [PIX_FMT_UYYVYY411] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_ABGR] = {
-        .nb_channels = 4, .is_alpha = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_BGR565BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_BGR565LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_BGR555BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_BGR555LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 5,
-    },
-    [PIX_FMT_BGR444BE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 4,
-    },
-    [PIX_FMT_BGR444LE] = {
-        .nb_channels = 3,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 4,
-    },
-    [PIX_FMT_RGB8] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_RGB4] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 4,
-    },
-    [PIX_FMT_RGB4_BYTE] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_BGR8] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_BGR4] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 4,
-    },
-    [PIX_FMT_BGR4_BYTE] = {
-        .nb_channels = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_NV12] = {
-        .nb_channels = 2,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-    [PIX_FMT_NV21] = {
-        .nb_channels = 2,
-        .color_type = FF_COLOR_YUV,
-        .pixel_type = FF_PIXEL_PLANAR,
-        .depth = 8,
-    },
-
-    [PIX_FMT_BGRA] = {
-        .nb_channels = 4, .is_alpha = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-    [PIX_FMT_RGBA] = {
-        .nb_channels = 4, .is_alpha = 1,
-        .color_type = FF_COLOR_RGB,
-        .pixel_type = FF_PIXEL_PACKED,
-        .depth = 8,
-    },
-};
-
-void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift)
-{
-    *h_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;
-    *v_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
-}
-
-const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt)
-{
-    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
-        return NULL;
-    else
-        return av_pix_fmt_descriptors[pix_fmt].name;
-}
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-enum PixelFormat avcodec_get_pix_fmt(const char *name)
-{
-    return av_get_pix_fmt(name);
-}
-#endif
-
-void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
-{
-    /* print header */
-    if (pix_fmt < 0)
-        snprintf (buf, buf_size,
-                  "name      " " nb_channels" " depth" " is_alpha"
-            );
-    else{
-        PixFmtInfo info= pix_fmt_info[pix_fmt];
-
-        char is_alpha_char= info.is_alpha ? 'y' : 'n';
-
-        snprintf (buf, buf_size,
-                  "%-11s %5d %9d %6c",
-                  av_pix_fmt_descriptors[pix_fmt].name,
-                  info.nb_channels,
-                  info.depth,
-                  is_alpha_char
-            );
-    }
-}
-
-int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
-{
-    return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
-}
-
-int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
-    int i;
-
-    for(i=0; i<256; i++){
-        int r,g,b;
-
-        switch(pix_fmt) {
-        case PIX_FMT_RGB8:
-            r= (i>>5    )*36;
-            g= ((i>>2)&7)*36;
-            b= (i&3     )*85;
-            break;
-        case PIX_FMT_BGR8:
-            b= (i>>6    )*85;
-            g= ((i>>3)&7)*36;
-            r= (i&7     )*36;
-            break;
-        case PIX_FMT_RGB4_BYTE:
-            r= (i>>3    )*255;
-            g= ((i>>1)&3)*85;
-            b= (i&1     )*255;
-            break;
-        case PIX_FMT_BGR4_BYTE:
-            b= (i>>3    )*255;
-            g= ((i>>1)&3)*85;
-            r= (i&1     )*255;
-            break;
-        case PIX_FMT_GRAY8:
-            r=b=g= i;
-            break;
-        default:
-            return -1;
-        }
-        pal[i] =  b + (g<<8) + (r<<16);
-    }
-
-    return 0;
-}
-
-int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
-{
-    int i;
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-    int max_plane_step     [4];
-    int max_plane_step_comp[4];
-
-    memset(picture->linesize, 0, sizeof(picture->linesize));
-
-    if (desc->flags & PIX_FMT_HWACCEL)
-        return -1;
-
-    if (desc->flags & PIX_FMT_BITSTREAM) {
-        picture->linesize[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3;
-        return 0;
-    }
-
-    memset(max_plane_step     , 0, sizeof(max_plane_step     ));
-    memset(max_plane_step_comp, 0, sizeof(max_plane_step_comp));
-    for (i = 0; i < 4; i++) {
-        const AVComponentDescriptor *comp = &(desc->comp[i]);
-        if ((comp->step_minus1+1) > max_plane_step[comp->plane]) {
-            max_plane_step     [comp->plane] = comp->step_minus1+1;
-            max_plane_step_comp[comp->plane] = i;
-        }
-    }
-
-    for (i = 0; i < 4; i++) {
-        int s = (max_plane_step_comp[i] == 1 || max_plane_step_comp[i] == 2) ? desc->log2_chroma_w : 0;
-        picture->linesize[i] = max_plane_step[i] * (((width + (1 << s) - 1)) >> s);
-    }
-
-    return 0;
-}
-
-int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
-                    int height)
-{
-    int size, h2, size2;
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-
-    size = picture->linesize[0] * height;
-    switch(pix_fmt) {
-    case PIX_FMT_YUV420P:
-    case PIX_FMT_YUV422P:
-    case PIX_FMT_YUV444P:
-    case PIX_FMT_YUV410P:
-    case PIX_FMT_YUV411P:
-    case PIX_FMT_YUV440P:
-    case PIX_FMT_YUVJ420P:
-    case PIX_FMT_YUVJ422P:
-    case PIX_FMT_YUVJ444P:
-    case PIX_FMT_YUVJ440P:
-    case PIX_FMT_YUV420P16LE:
-    case PIX_FMT_YUV422P16LE:
-    case PIX_FMT_YUV444P16LE:
-    case PIX_FMT_YUV420P16BE:
-    case PIX_FMT_YUV422P16BE:
-    case PIX_FMT_YUV444P16BE:
-        h2 = (height + (1 << desc->log2_chroma_h) - 1) >> desc->log2_chroma_h;
-        size2 = picture->linesize[1] * h2;
-        picture->data[0] = ptr;
-        picture->data[1] = picture->data[0] + size;
-        picture->data[2] = picture->data[1] + size2;
-        picture->data[3] = NULL;
-        return size + 2 * size2;
-    case PIX_FMT_YUVA420P:
-        h2 = (height + (1 << desc->log2_chroma_h) - 1) >> desc->log2_chroma_h;
-        size2 = picture->linesize[1] * h2;
-        picture->data[0] = ptr;
-        picture->data[1] = picture->data[0] + size;
-        picture->data[2] = picture->data[1] + size2;
-        picture->data[3] = picture->data[1] + size2 + size2;
-        return 2 * size + 2 * size2;
-    case PIX_FMT_NV12:
-    case PIX_FMT_NV21:
-        h2 = (height + (1 << desc->log2_chroma_h) - 1) >> desc->log2_chroma_h;
-        size2 = picture->linesize[1] * h2;
-        picture->data[0] = ptr;
-        picture->data[1] = picture->data[0] + size;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        return size + size2;
-    case PIX_FMT_RGB24:
-    case PIX_FMT_BGR24:
-    case PIX_FMT_ARGB:
-    case PIX_FMT_ABGR:
-    case PIX_FMT_RGBA:
-    case PIX_FMT_BGRA:
-    case PIX_FMT_RGB48BE:
-    case PIX_FMT_RGB48LE:
-    case PIX_FMT_GRAY16BE:
-    case PIX_FMT_GRAY16LE:
-    case PIX_FMT_BGR444BE:
-    case PIX_FMT_BGR444LE:
-    case PIX_FMT_BGR555BE:
-    case PIX_FMT_BGR555LE:
-    case PIX_FMT_BGR565BE:
-    case PIX_FMT_BGR565LE:
-    case PIX_FMT_RGB444BE:
-    case PIX_FMT_RGB444LE:
-    case PIX_FMT_RGB555BE:
-    case PIX_FMT_RGB555LE:
-    case PIX_FMT_RGB565BE:
-    case PIX_FMT_RGB565LE:
-    case PIX_FMT_YUYV422:
-    case PIX_FMT_UYVY422:
-    case PIX_FMT_UYYVYY411:
-    case PIX_FMT_RGB4:
-    case PIX_FMT_BGR4:
-    case PIX_FMT_MONOWHITE:
-    case PIX_FMT_MONOBLACK:
-    case PIX_FMT_Y400A:
-        picture->data[0] = ptr;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        return size;
-    case PIX_FMT_PAL8:
-    case PIX_FMT_RGB8:
-    case PIX_FMT_BGR8:
-    case PIX_FMT_RGB4_BYTE:
-    case PIX_FMT_BGR4_BYTE:
-    case PIX_FMT_GRAY8:
-        size2 = (size + 3) & ~3;
-        picture->data[0] = ptr;
-        picture->data[1] = ptr + size2; /* palette is stored here as 256 32 bit words */
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        return size2 + 256 * 4;
-    default:
-        picture->data[0] = NULL;
-        picture->data[1] = NULL;
-        picture->data[2] = NULL;
-        picture->data[3] = NULL;
-        return -1;
-    }
-}
-
-int avpicture_fill(AVPicture *picture, uint8_t *ptr,
-                   enum PixelFormat pix_fmt, int width, int height)
-{
-
-    if(avcodec_check_dimensions(NULL, width, height))
-        return -1;
-
-    if (ff_fill_linesize(picture, pix_fmt, width))
-        return -1;
-
-    return ff_fill_pointer(picture, ptr, pix_fmt, height);
-}
-
-int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
-                     unsigned char *dest, int dest_size)
-{
-    const PixFmtInfo* pf = &pix_fmt_info[pix_fmt];
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-    int i, j, w, ow, h, oh, data_planes;
-    const unsigned char* s;
-    int size = avpicture_get_size(pix_fmt, width, height);
-
-    if (size > dest_size || size < 0)
-        return -1;
-
-    if (pf->pixel_type == FF_PIXEL_PACKED || pf->pixel_type == FF_PIXEL_PALETTE) {
-        if (pix_fmt == PIX_FMT_YUYV422 ||
-            pix_fmt == PIX_FMT_UYVY422 ||
-            pix_fmt == PIX_FMT_BGR565BE ||
-            pix_fmt == PIX_FMT_BGR565LE ||
-            pix_fmt == PIX_FMT_BGR555BE ||
-            pix_fmt == PIX_FMT_BGR555LE ||
-            pix_fmt == PIX_FMT_BGR444BE ||
-            pix_fmt == PIX_FMT_BGR444LE ||
-            pix_fmt == PIX_FMT_RGB565BE ||
-            pix_fmt == PIX_FMT_RGB565LE ||
-            pix_fmt == PIX_FMT_RGB555BE ||
-            pix_fmt == PIX_FMT_RGB555LE ||
-            pix_fmt == PIX_FMT_RGB444BE ||
-            pix_fmt == PIX_FMT_RGB444LE)
-            w = width * 2;
-        else if (pix_fmt == PIX_FMT_UYYVYY411)
-            w = width + width/2;
-        else if (pix_fmt == PIX_FMT_PAL8)
-            w = width;
-        else
-            w = width * (pf->depth * pf->nb_channels / 8);
-
-        data_planes = 1;
-        h = height;
-    } else {
-        data_planes = pf->nb_channels;
-        w = (width*pf->depth + 7)/8;
-        h = height;
-    }
-
-    ow = w;
-    oh = h;
-
-    for (i=0; i<data_planes; i++) {
-        if (i == 1) {
-            w = (- ((-width) >> desc->log2_chroma_w) * pf->depth + 7) / 8;
-            h = -((-height) >> desc->log2_chroma_h);
-            if (pix_fmt == PIX_FMT_NV12 || pix_fmt == PIX_FMT_NV21)
-                w <<= 1;
-        } else if (i == 3) {
-            w = ow;
-            h = oh;
-        }
-        s = src->data[i];
-        for(j=0; j<h; j++) {
-            memcpy(dest, s, w);
-            dest += w;
-            s += src->linesize[i];
-        }
-    }
-
-    if (pf->pixel_type == FF_PIXEL_PALETTE)
-        memcpy((unsigned char *)(((size_t)dest + 3) & ~3), src->data[1], 256 * 4);
-
-    return size;
-}
-
-int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height)
-{
-    AVPicture dummy_pict;
-    if(avcodec_check_dimensions(NULL, width, height))
-        return -1;
-    switch (pix_fmt) {
-    case PIX_FMT_RGB8:
-    case PIX_FMT_BGR8:
-    case PIX_FMT_RGB4_BYTE:
-    case PIX_FMT_BGR4_BYTE:
-    case PIX_FMT_GRAY8:
-        // do not include palette for these pseudo-paletted formats
-        return width * height;
-    }
-    return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
-}
-
-int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
-                             int has_alpha)
-{
-    const PixFmtInfo *pf, *ps;
-    const AVPixFmtDescriptor *src_desc = &av_pix_fmt_descriptors[src_pix_fmt];
-    const AVPixFmtDescriptor *dst_desc = &av_pix_fmt_descriptors[dst_pix_fmt];
-    int loss;
-
-    ps = &pix_fmt_info[src_pix_fmt];
-
-    /* compute loss */
-    loss = 0;
-    pf = &pix_fmt_info[dst_pix_fmt];
-    if (pf->depth < ps->depth ||
-        ((dst_pix_fmt == PIX_FMT_RGB555BE || dst_pix_fmt == PIX_FMT_RGB555LE ||
-          dst_pix_fmt == PIX_FMT_BGR555BE || dst_pix_fmt == PIX_FMT_BGR555LE) &&
-         (src_pix_fmt == PIX_FMT_RGB565BE || src_pix_fmt == PIX_FMT_RGB565LE ||
-          src_pix_fmt == PIX_FMT_BGR565BE || src_pix_fmt == PIX_FMT_BGR565LE)))
-        loss |= FF_LOSS_DEPTH;
-    if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w ||
-        dst_desc->log2_chroma_h > src_desc->log2_chroma_h)
-        loss |= FF_LOSS_RESOLUTION;
-    switch(pf->color_type) {
-    case FF_COLOR_RGB:
-        if (ps->color_type != FF_COLOR_RGB &&
-            ps->color_type != FF_COLOR_GRAY)
-            loss |= FF_LOSS_COLORSPACE;
-        break;
-    case FF_COLOR_GRAY:
-        if (ps->color_type != FF_COLOR_GRAY)
-            loss |= FF_LOSS_COLORSPACE;
-        break;
-    case FF_COLOR_YUV:
-        if (ps->color_type != FF_COLOR_YUV)
-            loss |= FF_LOSS_COLORSPACE;
-        break;
-    case FF_COLOR_YUV_JPEG:
-        if (ps->color_type != FF_COLOR_YUV_JPEG &&
-            ps->color_type != FF_COLOR_YUV &&
-            ps->color_type != FF_COLOR_GRAY)
-            loss |= FF_LOSS_COLORSPACE;
-        break;
-    default:
-        /* fail safe test */
-        if (ps->color_type != pf->color_type)
-            loss |= FF_LOSS_COLORSPACE;
-        break;
-    }
-    if (pf->color_type == FF_COLOR_GRAY &&
-        ps->color_type != FF_COLOR_GRAY)
-        loss |= FF_LOSS_CHROMA;
-    if (!pf->is_alpha && (ps->is_alpha && has_alpha))
-        loss |= FF_LOSS_ALPHA;
-    if (pf->pixel_type == FF_PIXEL_PALETTE &&
-        (ps->pixel_type != FF_PIXEL_PALETTE && ps->color_type != FF_COLOR_GRAY))
-        loss |= FF_LOSS_COLORQUANT;
-    return loss;
-}
-
-static int avg_bits_per_pixel(enum PixelFormat pix_fmt)
-{
-    int bits;
-    const PixFmtInfo *pf;
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-
-    pf = &pix_fmt_info[pix_fmt];
-    switch(pf->pixel_type) {
-    case FF_PIXEL_PACKED:
-        switch(pix_fmt) {
-        case PIX_FMT_YUYV422:
-        case PIX_FMT_UYVY422:
-        case PIX_FMT_RGB565BE:
-        case PIX_FMT_RGB565LE:
-        case PIX_FMT_RGB555BE:
-        case PIX_FMT_RGB555LE:
-        case PIX_FMT_RGB444BE:
-        case PIX_FMT_RGB444LE:
-        case PIX_FMT_BGR565BE:
-        case PIX_FMT_BGR565LE:
-        case PIX_FMT_BGR555BE:
-        case PIX_FMT_BGR555LE:
-        case PIX_FMT_BGR444BE:
-        case PIX_FMT_BGR444LE:
-            bits = 16;
-            break;
-        case PIX_FMT_UYYVYY411:
-            bits = 12;
-            break;
-        default:
-            bits = pf->depth * pf->nb_channels;
-            break;
-        }
-        break;
-    case FF_PIXEL_PLANAR:
-        if (desc->log2_chroma_w == 0 && desc->log2_chroma_h == 0) {
-            bits = pf->depth * pf->nb_channels;
-        } else {
-            bits = pf->depth + ((2 * pf->depth) >>
-                                (desc->log2_chroma_w + desc->log2_chroma_h));
-        }
-        break;
-    case FF_PIXEL_PALETTE:
-        bits = 8;
-        break;
-    default:
-        bits = -1;
-        break;
-    }
-    return bits;
-}
-
-static enum PixelFormat avcodec_find_best_pix_fmt1(int64_t pix_fmt_mask,
-                                      enum PixelFormat src_pix_fmt,
-                                      int has_alpha,
-                                      int loss_mask)
-{
-    int dist, i, loss, min_dist;
-    enum PixelFormat dst_pix_fmt;
-
-    /* find exact color match with smallest size */
-    dst_pix_fmt = PIX_FMT_NONE;
-    min_dist = 0x7fffffff;
-    for(i = 0;i < PIX_FMT_NB; i++) {
-        if (pix_fmt_mask & (1ULL << i)) {
-            loss = avcodec_get_pix_fmt_loss(i, src_pix_fmt, has_alpha) & loss_mask;
-            if (loss == 0) {
-                dist = avg_bits_per_pixel(i);
-                if (dist < min_dist) {
-                    min_dist = dist;
-                    dst_pix_fmt = i;
-                }
-            }
-        }
-    }
-    return dst_pix_fmt;
-}
-
-enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
-                              int has_alpha, int *loss_ptr)
-{
-    enum PixelFormat dst_pix_fmt;
-    int loss_mask, i;
-    static const int loss_mask_order[] = {
-        ~0, /* no loss first */
-        ~FF_LOSS_ALPHA,
-        ~FF_LOSS_RESOLUTION,
-        ~(FF_LOSS_COLORSPACE | FF_LOSS_RESOLUTION),
-        ~FF_LOSS_COLORQUANT,
-        ~FF_LOSS_DEPTH,
-        0,
-    };
-
-    /* try with successive loss */
-    i = 0;
-    for(;;) {
-        loss_mask = loss_mask_order[i++];
-        dst_pix_fmt = avcodec_find_best_pix_fmt1(pix_fmt_mask, src_pix_fmt,
-                                                 has_alpha, loss_mask);
-        if (dst_pix_fmt >= 0)
-            goto found;
-        if (loss_mask == 0)
-            break;
-    }
-    return PIX_FMT_NONE;
- found:
-    if (loss_ptr)
-        *loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha);
-    return dst_pix_fmt;
-}
-
-void ff_img_copy_plane(uint8_t *dst, int dst_wrap,
-                           const uint8_t *src, int src_wrap,
-                           int width, int height)
-{
-    if((!dst) || (!src))
-        return;
-    for(;height > 0; height--) {
-        memcpy(dst, src, width);
-        dst += dst_wrap;
-        src += src_wrap;
-    }
-}
-
-int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane)
-{
-    int bits;
-    const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-
-    pf = &pix_fmt_info[pix_fmt];
-    switch(pf->pixel_type) {
-    case FF_PIXEL_PACKED:
-        switch(pix_fmt) {
-        case PIX_FMT_YUYV422:
-        case PIX_FMT_UYVY422:
-        case PIX_FMT_RGB565BE:
-        case PIX_FMT_RGB565LE:
-        case PIX_FMT_RGB555BE:
-        case PIX_FMT_RGB555LE:
-        case PIX_FMT_RGB444BE:
-        case PIX_FMT_RGB444LE:
-        case PIX_FMT_BGR565BE:
-        case PIX_FMT_BGR565LE:
-        case PIX_FMT_BGR555BE:
-        case PIX_FMT_BGR555LE:
-        case PIX_FMT_BGR444BE:
-        case PIX_FMT_BGR444LE:
-            bits = 16;
-            break;
-        case PIX_FMT_UYYVYY411:
-            bits = 12;
-            break;
-        default:
-            bits = pf->depth * pf->nb_channels;
-            break;
-        }
-        return (width * bits + 7) >> 3;
-        break;
-    case FF_PIXEL_PLANAR:
-            if (plane == 1 || plane == 2)
-                width= -((-width)>>desc->log2_chroma_w);
-
-            return (width * pf->depth + 7) >> 3;
-        break;
-    case FF_PIXEL_PALETTE:
-        if (plane == 0)
-            return width;
-        break;
-    }
-
-    return -1;
-}
-
-void av_picture_copy(AVPicture *dst, const AVPicture *src,
-                     enum PixelFormat pix_fmt, int width, int height)
-{
-    int i;
-    const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
-    const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt];
-
-    switch(pf->pixel_type) {
-    case FF_PIXEL_PACKED:
-    case FF_PIXEL_PLANAR:
-        for(i = 0; i < pf->nb_channels; i++) {
-            int h;
-            int bwidth = ff_get_plane_bytewidth(pix_fmt, width, i);
-            h = height;
-            if (i == 1 || i == 2) {
-                h= -((-height)>>desc->log2_chroma_h);
-            }
-            ff_img_copy_plane(dst->data[i], dst->linesize[i],
-                           src->data[i], src->linesize[i],
-                           bwidth, h);
-        }
-        break;
-    case FF_PIXEL_PALETTE:
-        ff_img_copy_plane(dst->data[0], dst->linesize[0],
-                       src->data[0], src->linesize[0],
-                       width, height);
-        /* copy the palette */
-        memcpy(dst->data[1], src->data[1], 4*256);
-        break;
-    }
-}
-
-/* 2x2 -> 1x1 */
-void ff_shrink22(uint8_t *dst, int dst_wrap,
-                     const uint8_t *src, int src_wrap,
-                     int width, int height)
-{
-    int w;
-    const uint8_t *s1, *s2;
-    uint8_t *d;
-
-    for(;height > 0; height--) {
-        s1 = src;
-        s2 = s1 + src_wrap;
-        d = dst;
-        for(w = width;w >= 4; w-=4) {
-            d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
-            d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2;
-            d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2;
-            d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2;
-            s1 += 8;
-            s2 += 8;
-            d += 4;
-        }
-        for(;w > 0; w--) {
-            d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2;
-            s1 += 2;
-            s2 += 2;
-            d++;
-        }
-        src += 2 * src_wrap;
-        dst += dst_wrap;
-    }
-}
-
-/* 4x4 -> 1x1 */
-void ff_shrink44(uint8_t *dst, int dst_wrap,
-                     const uint8_t *src, int src_wrap,
-                     int width, int height)
-{
-    int w;
-    const uint8_t *s1, *s2, *s3, *s4;
-    uint8_t *d;
-
-    for(;height > 0; height--) {
-        s1 = src;
-        s2 = s1 + src_wrap;
-        s3 = s2 + src_wrap;
-        s4 = s3 + src_wrap;
-        d = dst;
-        for(w = width;w > 0; w--) {
-            d[0] = (s1[0] + s1[1] + s1[2] + s1[3] +
-                    s2[0] + s2[1] + s2[2] + s2[3] +
-                    s3[0] + s3[1] + s3[2] + s3[3] +
-                    s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4;
-            s1 += 4;
-            s2 += 4;
-            s3 += 4;
-            s4 += 4;
-            d++;
-        }
-        src += 4 * src_wrap;
-        dst += dst_wrap;
-    }
-}
-
-/* 8x8 -> 1x1 */
-void ff_shrink88(uint8_t *dst, int dst_wrap,
-                     const uint8_t *src, int src_wrap,
-                     int width, int height)
-{
-    int w, i;
-
-    for(;height > 0; height--) {
-        for(w = width;w > 0; w--) {
-            int tmp=0;
-            for(i=0; i<8; i++){
-                tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7];
-                src += src_wrap;
-            }
-            *(dst++) = (tmp + 32)>>6;
-            src += 8 - 8*src_wrap;
-        }
-        src += 8*src_wrap - 8*width;
-        dst += dst_wrap - width;
-    }
-}
-
-
-int avpicture_alloc(AVPicture *picture,
-                    enum PixelFormat pix_fmt, int width, int height)
-{
-    int size;
-    void *ptr;
-
-    size = avpicture_fill(picture, NULL, pix_fmt, width, height);
-    if(size<0)
-        goto fail;
-    ptr = av_malloc(size);
-    if (!ptr)
-        goto fail;
-    avpicture_fill(picture, ptr, pix_fmt, width, height);
-    if(picture->data[1] && !picture->data[2])
-        ff_set_systematic_pal((uint32_t*)picture->data[1], pix_fmt);
-
-    return 0;
- fail:
-    memset(picture, 0, sizeof(AVPicture));
-    return -1;
-}
-
-void avpicture_free(AVPicture *picture)
-{
-    av_free(picture->data[0]);
-}
-
-/* return true if yuv planar */
-static inline int is_yuv_planar(const PixFmtInfo *ps)
-{
-    return (ps->color_type == FF_COLOR_YUV ||
-            ps->color_type == FF_COLOR_YUV_JPEG) &&
-        ps->pixel_type == FF_PIXEL_PLANAR;
-}
-
-int av_picture_crop(AVPicture *dst, const AVPicture *src,
-                    enum PixelFormat pix_fmt, int top_band, int left_band)
-{
-    int y_shift;
-    int x_shift;
-
-    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB || !is_yuv_planar(&pix_fmt_info[pix_fmt]))
-        return -1;
-
-    y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h;
-    x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w;
-
-    dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band;
-    dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift);
-    dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift);
-
-    dst->linesize[0] = src->linesize[0];
-    dst->linesize[1] = src->linesize[1];
-    dst->linesize[2] = src->linesize[2];
-    return 0;
-}
-
-int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
-                   enum PixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright,
-            int *color)
-{
-    uint8_t *optr;
-    int y_shift;
-    int x_shift;
-    int yheight;
-    int i, y;
-
-    if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB ||
-        !is_yuv_planar(&pix_fmt_info[pix_fmt])) return -1;
-
-    for (i = 0; i < 3; i++) {
-        x_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_w : 0;
-        y_shift = i ? av_pix_fmt_descriptors[pix_fmt].log2_chroma_h : 0;
-
-        if (padtop || padleft) {
-            memset(dst->data[i], color[i],
-                dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift));
-        }
-
-        if (padleft || padright) {
-            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
-                (dst->linesize[i] - (padright >> x_shift));
-            yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
-            for (y = 0; y < yheight; y++) {
-                memset(optr, color[i], (padleft + padright) >> x_shift);
-                optr += dst->linesize[i];
-            }
-        }
-
-        if (src) { /* first line */
-            uint8_t *iptr = src->data[i];
-            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
-                    (padleft >> x_shift);
-            memcpy(optr, iptr, (width - padleft - padright) >> x_shift);
-            iptr += src->linesize[i];
-            optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) +
-                (dst->linesize[i] - (padright >> x_shift));
-            yheight = (height - 1 - (padtop + padbottom)) >> y_shift;
-            for (y = 0; y < yheight; y++) {
-                memset(optr, color[i], (padleft + padright) >> x_shift);
-                memcpy(optr + ((padleft + padright) >> x_shift), iptr,
-                       (width - padleft - padright) >> x_shift);
-                iptr += src->linesize[i];
-                optr += dst->linesize[i];
-            }
-        }
-
-        if (padbottom || padright) {
-            optr = dst->data[i] + dst->linesize[i] *
-                ((height - padbottom) >> y_shift) - (padright >> x_shift);
-            memset(optr, color[i],dst->linesize[i] *
-                (padbottom >> y_shift) + (padright >> x_shift));
-        }
-    }
-    return 0;
-}
-
-/* NOTE: we scan all the pixels to have an exact information */
-static int get_alpha_info_pal8(const AVPicture *src, int width, int height)
-{
-    const unsigned char *p;
-    int src_wrap, ret, x, y;
-    unsigned int a;
-    uint32_t *palette = (uint32_t *)src->data[1];
-
-    p = src->data[0];
-    src_wrap = src->linesize[0] - width;
-    ret = 0;
-    for(y=0;y<height;y++) {
-        for(x=0;x<width;x++) {
-            a = palette[p[0]] >> 24;
-            if (a == 0x00) {
-                ret |= FF_ALPHA_TRANSP;
-            } else if (a != 0xff) {
-                ret |= FF_ALPHA_SEMI_TRANSP;
-            }
-            p++;
-        }
-        p += src_wrap;
-    }
-    return ret;
-}
-
-int img_get_alpha_info(const AVPicture *src,
-                       enum PixelFormat pix_fmt, int width, int height)
-{
-    const PixFmtInfo *pf = &pix_fmt_info[pix_fmt];
-    int ret;
-
-    /* no alpha can be represented in format */
-    if (!pf->is_alpha)
-        return 0;
-    switch(pix_fmt) {
-    case PIX_FMT_PAL8:
-        ret = get_alpha_info_pal8(src, width, height);
-        break;
-    default:
-        /* we do not know, so everything is indicated */
-        ret = FF_ALPHA_TRANSP | FF_ALPHA_SEMI_TRANSP;
-        break;
-    }
-    return ret;
-}
-
-#if HAVE_MMX
-#define DEINT_INPLACE_LINE_LUM \
-                    movd_m2r(lum_m4[0],mm0);\
-                    movd_m2r(lum_m3[0],mm1);\
-                    movd_m2r(lum_m2[0],mm2);\
-                    movd_m2r(lum_m1[0],mm3);\
-                    movd_m2r(lum[0],mm4);\
-                    punpcklbw_r2r(mm7,mm0);\
-                    movd_r2m(mm2,lum_m4[0]);\
-                    punpcklbw_r2r(mm7,mm1);\
-                    punpcklbw_r2r(mm7,mm2);\
-                    punpcklbw_r2r(mm7,mm3);\
-                    punpcklbw_r2r(mm7,mm4);\
-                    paddw_r2r(mm3,mm1);\
-                    psllw_i2r(1,mm2);\
-                    paddw_r2r(mm4,mm0);\
-                    psllw_i2r(2,mm1);\
-                    paddw_r2r(mm6,mm2);\
-                    paddw_r2r(mm2,mm1);\
-                    psubusw_r2r(mm0,mm1);\
-                    psrlw_i2r(3,mm1);\
-                    packuswb_r2r(mm7,mm1);\
-                    movd_r2m(mm1,lum_m2[0]);
-
-#define DEINT_LINE_LUM \
-                    movd_m2r(lum_m4[0],mm0);\
-                    movd_m2r(lum_m3[0],mm1);\
-                    movd_m2r(lum_m2[0],mm2);\
-                    movd_m2r(lum_m1[0],mm3);\
-                    movd_m2r(lum[0],mm4);\
-                    punpcklbw_r2r(mm7,mm0);\
-                    punpcklbw_r2r(mm7,mm1);\
-                    punpcklbw_r2r(mm7,mm2);\
-                    punpcklbw_r2r(mm7,mm3);\
-                    punpcklbw_r2r(mm7,mm4);\
-                    paddw_r2r(mm3,mm1);\
-                    psllw_i2r(1,mm2);\
-                    paddw_r2r(mm4,mm0);\
-                    psllw_i2r(2,mm1);\
-                    paddw_r2r(mm6,mm2);\
-                    paddw_r2r(mm2,mm1);\
-                    psubusw_r2r(mm0,mm1);\
-                    psrlw_i2r(3,mm1);\
-                    packuswb_r2r(mm7,mm1);\
-                    movd_r2m(mm1,dst[0]);
-#endif
-
-/* filter parameters: [-1 4 2 4 -1] // 8 */
-static void deinterlace_line(uint8_t *dst,
-                             const uint8_t *lum_m4, const uint8_t *lum_m3,
-                             const uint8_t *lum_m2, const uint8_t *lum_m1,
-                             const uint8_t *lum,
-                             int size)
-{
-#if !HAVE_MMX
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int sum;
-
-    for(;size > 0;size--) {
-        sum = -lum_m4[0];
-        sum += lum_m3[0] << 2;
-        sum += lum_m2[0] << 1;
-        sum += lum_m1[0] << 2;
-        sum += -lum[0];
-        dst[0] = cm[(sum + 4) >> 3];
-        lum_m4++;
-        lum_m3++;
-        lum_m2++;
-        lum_m1++;
-        lum++;
-        dst++;
-    }
-#else
-
-    {
-        pxor_r2r(mm7,mm7);
-        movq_m2r(ff_pw_4,mm6);
-    }
-    for (;size > 3; size-=4) {
-        DEINT_LINE_LUM
-        lum_m4+=4;
-        lum_m3+=4;
-        lum_m2+=4;
-        lum_m1+=4;
-        lum+=4;
-        dst+=4;
-    }
-#endif
-}
-static void deinterlace_line_inplace(uint8_t *lum_m4, uint8_t *lum_m3, uint8_t *lum_m2, uint8_t *lum_m1, uint8_t *lum,
-                             int size)
-{
-#if !HAVE_MMX
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int sum;
-
-    for(;size > 0;size--) {
-        sum = -lum_m4[0];
-        sum += lum_m3[0] << 2;
-        sum += lum_m2[0] << 1;
-        lum_m4[0]=lum_m2[0];
-        sum += lum_m1[0] << 2;
-        sum += -lum[0];
-        lum_m2[0] = cm[(sum + 4) >> 3];
-        lum_m4++;
-        lum_m3++;
-        lum_m2++;
-        lum_m1++;
-        lum++;
-    }
-#else
-
-    {
-        pxor_r2r(mm7,mm7);
-        movq_m2r(ff_pw_4,mm6);
-    }
-    for (;size > 3; size-=4) {
-        DEINT_INPLACE_LINE_LUM
-        lum_m4+=4;
-        lum_m3+=4;
-        lum_m2+=4;
-        lum_m1+=4;
-        lum+=4;
-    }
-#endif
-}
-
-/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The
-   top field is copied as is, but the bottom field is deinterlaced
-   against the top field. */
-static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap,
-                                    const uint8_t *src1, int src_wrap,
-                                    int width, int height)
-{
-    const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2;
-    int y;
-
-    src_m2 = src1;
-    src_m1 = src1;
-    src_0=&src_m1[src_wrap];
-    src_p1=&src_0[src_wrap];
-    src_p2=&src_p1[src_wrap];
-    for(y=0;y<(height-2);y+=2) {
-        memcpy(dst,src_m1,width);
-        dst += dst_wrap;
-        deinterlace_line(dst,src_m2,src_m1,src_0,src_p1,src_p2,width);
-        src_m2 = src_0;
-        src_m1 = src_p1;
-        src_0 = src_p2;
-        src_p1 += 2*src_wrap;
-        src_p2 += 2*src_wrap;
-        dst += dst_wrap;
-    }
-    memcpy(dst,src_m1,width);
-    dst += dst_wrap;
-    /* do last line */
-    deinterlace_line(dst,src_m2,src_m1,src_0,src_0,src_0,width);
-}
-
-static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap,
-                                             int width, int height)
-{
-    uint8_t *src_m1, *src_0, *src_p1, *src_p2;
-    int y;
-    uint8_t *buf;
-    buf = (uint8_t*)av_malloc(width);
-
-    src_m1 = src1;
-    memcpy(buf,src_m1,width);
-    src_0=&src_m1[src_wrap];
-    src_p1=&src_0[src_wrap];
-    src_p2=&src_p1[src_wrap];
-    for(y=0;y<(height-2);y+=2) {
-        deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width);
-        src_m1 = src_p1;
-        src_0 = src_p2;
-        src_p1 += 2*src_wrap;
-        src_p2 += 2*src_wrap;
-    }
-    /* do last line */
-    deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width);
-    av_free(buf);
-}
-
-int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
-                          enum PixelFormat pix_fmt, int width, int height)
-{
-    int i;
-
-    if (pix_fmt != PIX_FMT_YUV420P &&
-        pix_fmt != PIX_FMT_YUV422P &&
-        pix_fmt != PIX_FMT_YUV444P &&
-        pix_fmt != PIX_FMT_YUV411P &&
-        pix_fmt != PIX_FMT_GRAY8)
-        return -1;
-    if ((width & 3) != 0 || (height & 3) != 0)
-        return -1;
-
-    for(i=0;i<3;i++) {
-        if (i == 1) {
-            switch(pix_fmt) {
-            case PIX_FMT_YUV420P:
-                width >>= 1;
-                height >>= 1;
-                break;
-            case PIX_FMT_YUV422P:
-                width >>= 1;
-                break;
-            case PIX_FMT_YUV411P:
-                width >>= 2;
-                break;
-            default:
-                break;
-            }
-            if (pix_fmt == PIX_FMT_GRAY8) {
-                break;
-            }
-        }
-        if (src == dst) {
-            deinterlace_bottom_field_inplace(dst->data[i], dst->linesize[i],
-                                 width, height);
-        } else {
-            deinterlace_bottom_field(dst->data[i],dst->linesize[i],
-                                        src->data[i], src->linesize[i],
-                                        width, height);
-        }
-    }
-    emms_c();
-    return 0;
-}
-
diff --git a/libavcodec/imgconvert.h b/libavcodec/imgconvert.h
deleted file mode 100644
index 48e2f12..0000000
--- a/libavcodec/imgconvert.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Misc image conversion routines
- * most functionality is exported to the public API, see avcodec.h
- *
- * Copyright (c) 2008 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_IMGCONVERT_H
-#define AVCODEC_IMGCONVERT_H
-
-#include <stdint.h>
-#include "avcodec.h"
-
-int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width);
-
-int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt, int height);
-
-int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane);
-
-int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt);
-
-#endif /* AVCODEC_IMGCONVERT_H */
diff --git a/libavcodec/imx_dump_header_bsf.c b/libavcodec/imx_dump_header_bsf.c
deleted file mode 100644
index 2310185..0000000
--- a/libavcodec/imx_dump_header_bsf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * imx dump header bitstream filter
- * Copyright (c) 2007 Baptiste Coudurier
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * imx dump header bitstream filter
- * modifies bitstream to fit in mov and be decoded by final cut pro decoder
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-
-static int imx_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                           uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size, int keyframe)
-{
-    /* MXF essence element key */
-    static const uint8_t imx_header[16] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01,0x05,0x01,0x01,0x00 };
-    uint8_t *poutbufp;
-
-    if (avctx->codec_id != CODEC_ID_MPEG2VIDEO) {
-        av_log(avctx, AV_LOG_ERROR, "imx bitstream filter only applies to mpeg2video codec\n");
-        return 0;
-    }
-
-    *poutbuf = av_malloc(buf_size + 20 + FF_INPUT_BUFFER_PADDING_SIZE);
-    poutbufp = *poutbuf;
-    bytestream_put_buffer(&poutbufp, imx_header, 16);
-    bytestream_put_byte(&poutbufp, 0x83); /* KLV BER long form */
-    bytestream_put_be24(&poutbufp, buf_size);
-    bytestream_put_buffer(&poutbufp, buf, buf_size);
-    *poutbuf_size = poutbufp - *poutbuf;
-    return 1;
-}
-
-AVBitStreamFilter imx_dump_header_bsf = {
-    "imxdump",
-    0,
-    imx_dump_header,
-};
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
deleted file mode 100644
index a3d6c80..0000000
--- a/libavcodec/indeo2.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Intel Indeo 2 codec
- * Copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Intel Indeo 2 decoder.
- */
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "get_bits.h"
-#include "indeo2data.h"
-#include "libavutil/common.h"
-
-typedef struct Ir2Context{
-    AVCodecContext *avctx;
-    AVFrame picture;
-    GetBitContext gb;
-    int decode_delta;
-} Ir2Context;
-
-#define CODE_VLC_BITS 14
-static VLC ir2_vlc;
-
-/* Indeo 2 codes are in range 0x01..0x7F and 0x81..0x90 */
-static inline int ir2_get_code(GetBitContext *gb)
-{
-    return get_vlc2(gb, ir2_vlc.table, CODE_VLC_BITS, 1) + 1;
-}
-
-static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst, int stride,
-                             const uint8_t *table)
-{
-    int i;
-    int j;
-    int out = 0;
-    int c;
-    int t;
-
-    if(width&1)
-        return -1;
-
-    /* first line contain absolute values, other lines contain deltas */
-    while (out < width){
-        c = ir2_get_code(&ctx->gb);
-        if(c >= 0x80) { /* we have a run */
-            c -= 0x7F;
-            if(out + c*2 > width)
-                return -1;
-            for (i = 0; i < c * 2; i++)
-                dst[out++] = 0x80;
-        } else { /* copy two values from table */
-            dst[out++] = table[c * 2];
-            dst[out++] = table[(c * 2) + 1];
-        }
-    }
-    dst += stride;
-
-    for (j = 1; j < height; j++){
-        out = 0;
-        while (out < width){
-            c = ir2_get_code(&ctx->gb);
-            if(c >= 0x80) { /* we have a skip */
-                c -= 0x7F;
-                if(out + c*2 > width)
-                    return -1;
-                for (i = 0; i < c * 2; i++) {
-                    dst[out] = dst[out - stride];
-                    out++;
-                }
-            } else { /* add two deltas from table */
-                t = dst[out - stride] + (table[c * 2] - 128);
-                t= av_clip_uint8(t);
-                dst[out] = t;
-                out++;
-                t = dst[out - stride] + (table[(c * 2) + 1] - 128);
-                t= av_clip_uint8(t);
-                dst[out] = t;
-                out++;
-            }
-        }
-        dst += stride;
-    }
-    return 0;
-}
-
-static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_t *dst, int stride,
-                             const uint8_t *table)
-{
-    int j;
-    int out = 0;
-    int c;
-    int t;
-
-    if(width&1)
-        return -1;
-
-    for (j = 0; j < height; j++){
-        out = 0;
-        while (out < width){
-            c = ir2_get_code(&ctx->gb);
-            if(c >= 0x80) { /* we have a skip */
-                c -= 0x7F;
-                out += c * 2;
-            } else { /* add two deltas from table */
-                t = dst[out] + (((table[c * 2] - 128)*3) >> 2);
-                t= av_clip_uint8(t);
-                dst[out] = t;
-                out++;
-                t = dst[out] + (((table[(c * 2) + 1] - 128)*3) >> 2);
-                t= av_clip_uint8(t);
-                dst[out] = t;
-                out++;
-            }
-        }
-        dst += stride;
-    }
-    return 0;
-}
-
-static int ir2_decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    Ir2Context * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p= (AVFrame*)&s->picture;
-    int start;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 1;
-    p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, p)) {
-        av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    s->decode_delta = buf[18];
-
-    /* decide whether frame uses deltas or not */
-#ifndef ALT_BITSTREAM_READER_LE
-    for (i = 0; i < buf_size; i++)
-        buf[i] = av_reverse[buf[i]];
-#endif
-    start = 48; /* hardcoded for now */
-
-    init_get_bits(&s->gb, buf + start, buf_size - start);
-
-    if (s->decode_delta) { /* intraframe */
-        ir2_decode_plane(s, avctx->width, avctx->height,
-                         s->picture.data[0], s->picture.linesize[0], ir2_luma_table);
-        /* swapped U and V */
-        ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
-                         s->picture.data[2], s->picture.linesize[2], ir2_luma_table);
-        ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2,
-                         s->picture.data[1], s->picture.linesize[1], ir2_luma_table);
-    } else { /* interframe */
-        ir2_decode_plane_inter(s, avctx->width, avctx->height,
-                         s->picture.data[0], s->picture.linesize[0], ir2_luma_table);
-        /* swapped U and V */
-        ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
-                         s->picture.data[2], s->picture.linesize[2], ir2_luma_table);
-        ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2,
-                         s->picture.data[1], s->picture.linesize[1], ir2_luma_table);
-    }
-
-    *picture= *(AVFrame*)&s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return buf_size;
-}
-
-static av_cold int ir2_decode_init(AVCodecContext *avctx){
-    Ir2Context * const ic = avctx->priv_data;
-    static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2];
-
-    ic->avctx = avctx;
-
-    avctx->pix_fmt= PIX_FMT_YUV410P;
-
-    ir2_vlc.table = vlc_tables;
-    ir2_vlc.table_allocated = 1 << CODE_VLC_BITS;
-#ifdef ALT_BITSTREAM_READER_LE
-        init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
-                 &ir2_codes[0][1], 4, 2,
-                 &ir2_codes[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-#else
-        init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
-                 &ir2_codes[0][1], 4, 2,
-                 &ir2_codes[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
-#endif
-
-    return 0;
-}
-
-static av_cold int ir2_decode_end(AVCodecContext *avctx){
-    Ir2Context * const ic = avctx->priv_data;
-    AVFrame *pic = &ic->picture;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    return 0;
-}
-
-AVCodec indeo2_decoder = {
-    "indeo2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_INDEO2,
-    sizeof(Ir2Context),
-    ir2_decode_init,
-    NULL,
-    ir2_decode_end,
-    ir2_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"),
-};
diff --git a/libavcodec/indeo2data.h b/libavcodec/indeo2data.h
deleted file mode 100644
index b2e0b8a..0000000
--- a/libavcodec/indeo2data.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Intel Indeo 2 codec
- * copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_INDEO2DATA_H
-#define AVCODEC_INDEO2DATA_H
-
-#include <stdint.h>
-
-#define IR2_CODES 143
-static const uint16_t ir2_codes[IR2_CODES][2] = {
-#ifdef ALT_BITSTREAM_READER_LE
-{0x0000,  3}, {0x0004,  3}, {0x0006,  3}, {0x0001,  5},
-{0x0009,  5}, {0x0019,  5}, {0x000D,  5}, {0x001D,  5},
-{0x0023,  6}, {0x0013,  6}, {0x0033,  6}, {0x000B,  6},
-{0x002B,  6}, {0x001B,  6}, {0x0007,  8}, {0x0087,  8},
-{0x0027,  8}, {0x00A7,  8}, {0x0067,  8}, {0x00E7,  8},
-{0x0097,  8}, {0x0057,  8}, {0x0037,  8}, {0x00B7,  8},
-{0x00F7,  8}, {0x000F,  9}, {0x008F,  9}, {0x018F,  9},
-{0x014F,  9}, {0x00CF,  9}, {0x002F,  9}, {0x012F,  9},
-{0x01AF,  9}, {0x006F,  9}, {0x00EF,  9}, {0x01EF,  9},
-{0x001F, 10}, {0x021F, 10}, {0x011F, 10}, {0x031F, 10},
-{0x009F, 10}, {0x029F, 10}, {0x019F, 10}, {0x039F, 10},
-{0x005F, 10}, {0x025F, 10}, {0x015F, 10}, {0x035F, 10},
-{0x00DF, 10}, {0x02DF, 10}, {0x01DF, 10}, {0x03DF, 10},
-{0x003F, 13}, {0x103F, 13}, {0x083F, 13}, {0x183F, 13},
-{0x043F, 13}, {0x143F, 13}, {0x0C3F, 13}, {0x1C3F, 13},
-{0x023F, 13}, {0x123F, 13}, {0x0A3F, 13}, {0x1A3F, 13},
-{0x063F, 13}, {0x163F, 13}, {0x0E3F, 13}, {0x1E3F, 13},
-{0x013F, 13}, {0x113F, 13}, {0x093F, 13}, {0x193F, 13},
-{0x053F, 13}, {0x153F, 13}, {0x0D3F, 13}, {0x1D3F, 13},
-{0x033F, 13}, {0x133F, 13}, {0x0B3F, 13}, {0x1B3F, 13},
-{0x073F, 13}, {0x173F, 13}, {0x0F3F, 13}, {0x1F3F, 13},
-{0x00BF, 13}, {0x10BF, 13}, {0x08BF, 13}, {0x18BF, 13},
-{0x04BF, 13}, {0x14BF, 13}, {0x0CBF, 13}, {0x1CBF, 13},
-{0x02BF, 13}, {0x12BF, 13}, {0x0ABF, 13}, {0x1ABF, 13},
-{0x06BF, 13}, {0x16BF, 13}, {0x0EBF, 13}, {0x1EBF, 13},
-{0x01BF, 13}, {0x11BF, 13}, {0x09BF, 13}, {0x19BF, 13},
-{0x05BF, 13}, {0x15BF, 13}, {0x0DBF, 13}, {0x1DBF, 13},
-{0x03BF, 13}, {0x13BF, 13}, {0x0BBF, 13}, {0x1BBF, 13},
-{0x07BF, 13}, {0x17BF, 13}, {0x0FBF, 13}, {0x1FBF, 13},
-{0x007F, 14}, {0x207F, 14}, {0x107F, 14}, {0x307F, 14},
-{0x087F, 14}, {0x287F, 14}, {0x187F, 14}, {0x387F, 14},
-{0x047F, 14}, {0x247F, 14}, {0x147F, 14}, {0x0002,  3},
-{0x0011,  5}, {0x0005,  5}, {0x0015,  5}, {0x0003,  6},
-{0x003B,  6}, {0x0047,  8}, {0x00C7,  8}, {0x0017,  8},
-{0x00D7,  8}, {0x0077,  8}, {0x010F,  9}, {0x004F,  9},
-{0x01CF,  9}, {0x00AF,  9}, {0x016F,  9},
-#else
-    {0x0000,  3}, {0x0001,  3}, {0x0003,  3}, {0x0010,  5},
-    {0x0012,  5}, {0x0013,  5}, {0x0016,  5}, {0x0017,  5},
-    {0x0031,  6}, {0x0032,  6}, {0x0033,  6}, {0x0034,  6},
-    {0x0035,  6}, {0x0036,  6}, {0x00E0,  8}, {0x00E1,  8},
-    {0x00E4,  8}, {0x00E5,  8}, {0x00E6,  8}, {0x00E7,  8},
-    {0x00E9,  8}, {0x00EA,  8}, {0x00EC,  8}, {0x00ED,  8},
-    {0x00EF,  8}, {0x01E0,  9}, {0x01E2,  9}, {0x01E3,  9},
-    {0x01E5,  9}, {0x01E6,  9}, {0x01E8,  9}, {0x01E9,  9},
-    {0x01EB,  9}, {0x01EC,  9}, {0x01EE,  9}, {0x01EF,  9},
-    {0x03E0, 10}, {0x03E1, 10}, {0x03E2, 10}, {0x03E3, 10},
-    {0x03E4, 10}, {0x03E5, 10}, {0x03E6, 10}, {0x03E7, 10},
-    {0x03E8, 10}, {0x03E9, 10}, {0x03EA, 10}, {0x03EB, 10},
-    {0x03EC, 10}, {0x03ED, 10}, {0x03EE, 10}, {0x03EF, 10},
-    {0x1F80, 13}, {0x1F81, 13}, {0x1F82, 13}, {0x1F83, 13},
-    {0x1F84, 13}, {0x1F85, 13}, {0x1F86, 13}, {0x1F87, 13},
-    {0x1F88, 13}, {0x1F89, 13}, {0x1F8A, 13}, {0x1F8B, 13},
-    {0x1F8C, 13}, {0x1F8D, 13}, {0x1F8E, 13}, {0x1F8F, 13},
-    {0x1F90, 13}, {0x1F91, 13}, {0x1F92, 13}, {0x1F93, 13},
-    {0x1F94, 13}, {0x1F95, 13}, {0x1F96, 13}, {0x1F97, 13},
-    {0x1F98, 13}, {0x1F99, 13}, {0x1F9A, 13}, {0x1F9B, 13},
-    {0x1F9C, 13}, {0x1F9D, 13}, {0x1F9E, 13}, {0x1F9F, 13},
-    {0x1FA0, 13}, {0x1FA1, 13}, {0x1FA2, 13}, {0x1FA3, 13},
-    {0x1FA4, 13}, {0x1FA5, 13}, {0x1FA6, 13}, {0x1FA7, 13},
-    {0x1FA8, 13}, {0x1FA9, 13}, {0x1FAA, 13}, {0x1FAB, 13},
-    {0x1FAC, 13}, {0x1FAD, 13}, {0x1FAE, 13}, {0x1FAF, 13},
-    {0x1FB0, 13}, {0x1FB1, 13}, {0x1FB2, 13}, {0x1FB3, 13},
-    {0x1FB4, 13}, {0x1FB5, 13}, {0x1FB6, 13}, {0x1FB7, 13},
-    {0x1FB8, 13}, {0x1FB9, 13}, {0x1FBA, 13}, {0x1FBB, 13},
-    {0x1FBC, 13}, {0x1FBD, 13}, {0x1FBE, 13}, {0x1FBF, 13},
-    {0x3F80, 14}, {0x3F81, 14}, {0x3F82, 14}, {0x3F83, 14},
-    {0x3F84, 14}, {0x3F85, 14}, {0x3F86, 14}, {0x3F87, 14},
-    {0x3F88, 14}, {0x3F89, 14}, {0x3F8A, 14}, {0x0002,  3},
-    {0x0011,  5}, {0x0014,  5}, {0x0015,  5}, {0x0030,  6},
-    {0x0037,  6}, {0x00E2,  8}, {0x00E3,  8}, {0x00E8,  8},
-    {0x00EB,  8}, {0x00EE,  8}, {0x01E1,  9}, {0x01E4,  9},
-    {0x01E7,  9}, {0x01EA,  9}, {0x01ED,  9}
-#endif
-};
-
-static const uint8_t ir2_luma_table[256] = {
- 0x80, 0x80, 0x84, 0x84, 0x7C, 0x7C, 0x7F, 0x85,
- 0x81, 0x7B, 0x85, 0x7F, 0x7B, 0x81, 0x8C, 0x8C,
- 0x74, 0x74, 0x83, 0x8D, 0x7D, 0x73, 0x8D, 0x83,
- 0x73, 0x7D, 0x77, 0x89, 0x89, 0x77, 0x89, 0x77,
- 0x77, 0x89, 0x8C, 0x95, 0x74, 0x6B, 0x95, 0x8C,
- 0x6B, 0x74, 0x7C, 0x90, 0x84, 0x70, 0x90, 0x7C,
- 0x70, 0x84, 0x96, 0x96, 0x6A, 0x6A, 0x82, 0x98,
- 0x7E, 0x68, 0x98, 0x82, 0x68, 0x7E, 0x97, 0xA2,
- 0x69, 0x5E, 0xA2, 0x97, 0x5E, 0x69, 0xA2, 0xA2,
- 0x5E, 0x5E, 0x8B, 0xA3, 0x75, 0x5D, 0xA3, 0x8B,
- 0x5D, 0x75, 0x71, 0x95, 0x8F, 0x6B, 0x95, 0x71,
- 0x6B, 0x8F, 0x78, 0x9D, 0x88, 0x63, 0x9D, 0x78,
- 0x63, 0x88, 0x7F, 0xA7, 0x81, 0x59, 0xA7, 0x7F,
- 0x59, 0x81, 0xA4, 0xB1, 0x5C, 0x4F, 0xB1, 0xA4,
- 0x4F, 0x5C, 0x96, 0xB1, 0x6A, 0x4F, 0xB1, 0x96,
- 0x4F, 0x6A, 0xB2, 0xB2, 0x4E, 0x4E, 0x65, 0x9B,
- 0x9B, 0x65, 0x9B, 0x65, 0x65, 0x9B, 0x89, 0xB4,
- 0x77, 0x4C, 0xB4, 0x89, 0x4C, 0x77, 0x6A, 0xA3,
- 0x96, 0x5D, 0xA3, 0x6A, 0x5D, 0x96, 0x73, 0xAC,
- 0x8D, 0x54, 0xAC, 0x73, 0x54, 0x8D, 0xB4, 0xC3,
- 0x4C, 0x3D, 0xC3, 0xB4, 0x3D, 0x4C, 0xA4, 0xC3,
- 0x5C, 0x3D, 0xC3, 0xA4, 0x3D, 0x5C, 0xC4, 0xC4,
- 0x3C, 0x3C, 0x96, 0xC6, 0x6A, 0x3A, 0xC6, 0x96,
- 0x3A, 0x6A, 0x7C, 0xBA, 0x84, 0x46, 0xBA, 0x7C,
- 0x46, 0x84, 0x5B, 0xAB, 0xA5, 0x55, 0xAB, 0x5B,
- 0x55, 0xA5, 0x63, 0xB4, 0x9D, 0x4C, 0xB4, 0x63,
- 0x4C, 0x9D, 0x86, 0xCA, 0x7A, 0x36, 0xCA, 0x86,
- 0x36, 0x7A, 0xB6, 0xD7, 0x4A, 0x29, 0xD7, 0xB6,
- 0x29, 0x4A, 0xC8, 0xD7, 0x38, 0x29, 0xD7, 0xC8,
- 0x29, 0x38, 0xA4, 0xD8, 0x5C, 0x28, 0xD8, 0xA4,
- 0x28, 0x5C, 0x6C, 0xC1, 0x94, 0x3F, 0xC1, 0x6C,
- 0x3F, 0x94, 0xD9, 0xD9, 0x27, 0x27, 0x80, 0x80
-};
-
-#endif /* AVCODEC_INDEO2DATA_H */
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
deleted file mode 100644
index e5df32c..0000000
--- a/libavcodec/indeo3.c
+++ /dev/null
@@ -1,1151 +0,0 @@
-/*
- * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
- * written, produced, and directed by Alan Smithee
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "bytestream.h"
-
-#include "indeo3data.h"
-
-typedef struct
-{
-    uint8_t *Ybuf;
-    uint8_t *Ubuf;
-    uint8_t *Vbuf;
-    unsigned short y_w, y_h;
-    unsigned short uv_w, uv_h;
-} YUVBufs;
-
-typedef struct Indeo3DecodeContext {
-    AVCodecContext *avctx;
-    int width, height;
-    AVFrame frame;
-
-    uint8_t *buf;
-    YUVBufs iv_frame[2];
-    YUVBufs *cur_frame;
-    YUVBufs *ref_frame;
-
-    uint8_t *ModPred;
-    uint8_t *corrector_type;
-} Indeo3DecodeContext;
-
-static const uint8_t corrector_type_0[24] = {
-    195, 159, 133, 115, 101,  93,  87,  77,
-    195, 159, 133, 115, 101,  93,  87,  77,
-    128,  79,  79,  79,  79,  79,  79,  79
-};
-
-static const uint8_t corrector_type_2[8] = { 9, 7, 6, 8, 5, 4, 3, 2 };
-
-static av_cold int build_modpred(Indeo3DecodeContext *s)
-{
-    int i, j;
-
-    if (!(s->ModPred = av_malloc(8 * 128)))
-        return AVERROR(ENOMEM);
-
-    for (i=0; i < 128; ++i) {
-        s->ModPred[i+0*128] = i >  126 ? 254 : 2*(i + 1 - ((i + 1) % 2));
-        s->ModPred[i+1*128] = i ==   7 ?  20 :
-                              i == 119 ||
-                              i == 120 ? 236 : 2*(i + 2 - ((i + 1) % 3));
-        s->ModPred[i+2*128] = i >  125 ? 248 : 2*(i + 2 - ((i + 2) % 4));
-        s->ModPred[i+3*128] =                  2*(i + 1 - ((i - 3) % 5));
-        s->ModPred[i+4*128] = i ==   8 ?  20 : 2*(i + 1 - ((i - 3) % 6));
-        s->ModPred[i+5*128] =                  2*(i + 4 - ((i + 3) % 7));
-        s->ModPred[i+6*128] = i >  123 ? 240 : 2*(i + 4 - ((i + 4) % 8));
-        s->ModPred[i+7*128] =                  2*(i + 5 - ((i + 4) % 9));
-    }
-
-    if (!(s->corrector_type = av_malloc(24 * 256)))
-        return AVERROR(ENOMEM);
-
-    for (i=0; i < 24; ++i) {
-        for (j=0; j < 256; ++j) {
-            s->corrector_type[i*256+j] = j < corrector_type_0[i]          ? 1 :
-                                         j < 248 || (i == 16 && j == 248) ? 0 :
-                                         corrector_type_2[j - 248];
-        }
-    }
-
-  return 0;
-}
-
-static av_cold int iv_alloc_frames(Indeo3DecodeContext *s)
-{
-    int luma_width    = (s->width           + 3) & ~3,
-        luma_height   = (s->height          + 3) & ~3,
-        chroma_width  = ((luma_width  >> 2) + 3) & ~3,
-        chroma_height = ((luma_height >> 2) + 3) & ~3,
-        luma_pixels   = luma_width   * luma_height,
-        chroma_pixels = chroma_width * chroma_height,
-        i;
-    unsigned int bufsize = luma_pixels * 2 + luma_width * 3 +
-                          (chroma_pixels   + chroma_width) * 4;
-
-    av_freep(&s->buf);
-    if(!(s->buf = av_malloc(bufsize)))
-        return AVERROR(ENOMEM);
-    s->iv_frame[0].y_w = s->iv_frame[1].y_w = luma_width;
-    s->iv_frame[0].y_h = s->iv_frame[1].y_h = luma_height;
-    s->iv_frame[0].uv_w = s->iv_frame[1].uv_w = chroma_width;
-    s->iv_frame[0].uv_h = s->iv_frame[1].uv_h = chroma_height;
-
-    s->iv_frame[0].Ybuf = s->buf + luma_width;
-    i = luma_pixels + luma_width * 2;
-    s->iv_frame[1].Ybuf = s->buf + i;
-    i += (luma_pixels + luma_width);
-    s->iv_frame[0].Ubuf = s->buf + i;
-    i += (chroma_pixels + chroma_width);
-    s->iv_frame[1].Ubuf = s->buf + i;
-    i += (chroma_pixels + chroma_width);
-    s->iv_frame[0].Vbuf = s->buf + i;
-    i += (chroma_pixels + chroma_width);
-    s->iv_frame[1].Vbuf = s->buf + i;
-
-    for(i = 1; i <= luma_width; i++)
-        s->iv_frame[0].Ybuf[-i] = s->iv_frame[1].Ybuf[-i] =
-            s->iv_frame[0].Ubuf[-i] = 0x80;
-
-    for(i = 1; i <= chroma_width; i++) {
-        s->iv_frame[1].Ubuf[-i] = 0x80;
-        s->iv_frame[0].Vbuf[-i] = 0x80;
-        s->iv_frame[1].Vbuf[-i] = 0x80;
-        s->iv_frame[1].Vbuf[chroma_pixels+i-1] = 0x80;
-    }
-
-    return 0;
-}
-
-static av_cold void iv_free_func(Indeo3DecodeContext *s)
-{
-    av_freep(&s->buf);
-    av_freep(&s->ModPred);
-    av_freep(&s->corrector_type);
-}
-
-struct ustr {
-    long xpos;
-    long ypos;
-    long width;
-    long height;
-    long split_flag;
-    long split_direction;
-    long usl7;
-};
-
-
-#define LV1_CHECK(buf1,rle_v3,lv1,lp2)  \
-    if((lv1 & 0x80) != 0) {             \
-        if(rle_v3 != 0)                 \
-            rle_v3 = 0;                 \
-        else {                          \
-            rle_v3 = 1;                 \
-            buf1 -= 2;                  \
-        }                               \
-    }                                   \
-    lp2 = 4;
-
-
-#define RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)  \
-    if(rle_v3 == 0) {                            \
-        rle_v2 = *buf1;                          \
-        rle_v1 = 1;                              \
-        if(rle_v2 > 32) {                        \
-            rle_v2 -= 32;                        \
-            rle_v1 = 0;                          \
-        }                                        \
-        rle_v3 = 1;                              \
-    }                                            \
-    buf1--;
-
-
-#define LP2_CHECK(buf1,rle_v3,lp2)  \
-    if(lp2 == 0 && rle_v3 != 0)     \
-        rle_v3 = 0;                 \
-    else {                          \
-        buf1--;                     \
-        rle_v3 = 1;                 \
-    }
-
-
-#define RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2) \
-    rle_v2--;                                 \
-    if(rle_v2 == 0) {                         \
-        rle_v3 = 0;                           \
-        buf1 += 2;                            \
-    }                                         \
-    lp2 = 4;
-
-static void iv_Decode_Chunk(Indeo3DecodeContext *s,
-        uint8_t *cur, uint8_t *ref, int width, int height,
-        const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
-        const uint8_t *buf2, int min_width_160)
-{
-    uint8_t bit_buf;
-    unsigned long bit_pos, lv, lv1, lv2;
-    long *width_tbl, width_tbl_arr[10];
-    const signed char *ref_vectors;
-    uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
-    uint32_t *cur_lp, *ref_lp;
-    const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
-    uint8_t *correction_type_sp[2];
-    struct ustr strip_tbl[20], *strip;
-    int i, j, k, lp1, lp2, flag1, cmd, blks_width, blks_height, region_160_width,
-        rle_v1, rle_v2, rle_v3;
-    unsigned short res;
-
-    bit_buf = 0;
-    ref_vectors = NULL;
-
-    width_tbl = width_tbl_arr + 1;
-    i = (width < 0 ? width + 3 : width)/4;
-    for(j = -1; j < 8; j++)
-        width_tbl[j] = i * j;
-
-    strip = strip_tbl;
-
-    for(region_160_width = 0; region_160_width < (width - min_width_160); region_160_width += min_width_160);
-
-    strip->ypos = strip->xpos = 0;
-    for(strip->width = min_width_160; width > strip->width; strip->width *= 2);
-    strip->height = height;
-    strip->split_direction = 0;
-    strip->split_flag = 0;
-    strip->usl7 = 0;
-
-    bit_pos = 0;
-
-    rle_v1 = rle_v2 = rle_v3 = 0;
-
-    while(strip >= strip_tbl) {
-        if(bit_pos <= 0) {
-            bit_pos = 8;
-            bit_buf = *buf1++;
-        }
-
-        bit_pos -= 2;
-        cmd = (bit_buf >> bit_pos) & 0x03;
-
-        if(cmd == 0) {
-            strip++;
-            if(strip >= strip_tbl + FF_ARRAY_ELEMS(strip_tbl)) {
-                av_log(s->avctx, AV_LOG_WARNING, "out of range strip\n");
-                break;
-            }
-            memcpy(strip, strip-1, sizeof(*strip));
-            strip->split_flag = 1;
-            strip->split_direction = 0;
-            strip->height = (strip->height > 8 ? ((strip->height+8)>>4)<<3 : 4);
-            continue;
-        } else if(cmd == 1) {
-            strip++;
-            if(strip >= strip_tbl + FF_ARRAY_ELEMS(strip_tbl)) {
-                av_log(s->avctx, AV_LOG_WARNING, "out of range strip\n");
-                break;
-            }
-            memcpy(strip, strip-1, sizeof(*strip));
-            strip->split_flag = 1;
-            strip->split_direction = 1;
-            strip->width = (strip->width > 8 ? ((strip->width+8)>>4)<<3 : 4);
-            continue;
-        } else if(cmd == 2) {
-            if(strip->usl7 == 0) {
-                strip->usl7 = 1;
-                ref_vectors = NULL;
-                continue;
-            }
-        } else if(cmd == 3) {
-            if(strip->usl7 == 0) {
-                strip->usl7 = 1;
-                ref_vectors = (const signed char*)buf2 + (*buf1 * 2);
-                buf1++;
-                continue;
-            }
-        }
-
-        cur_frm_pos = cur + width * strip->ypos + strip->xpos;
-
-        if((blks_width = strip->width) < 0)
-            blks_width += 3;
-        blks_width >>= 2;
-        blks_height = strip->height;
-
-        if(ref_vectors != NULL) {
-            ref_frm_pos = ref + (ref_vectors[0] + strip->ypos) * width +
-                ref_vectors[1] + strip->xpos;
-        } else
-            ref_frm_pos = cur_frm_pos - width_tbl[4];
-
-        if(cmd == 2) {
-            if(bit_pos <= 0) {
-                bit_pos = 8;
-                bit_buf = *buf1++;
-            }
-
-            bit_pos -= 2;
-            cmd = (bit_buf >> bit_pos) & 0x03;
-
-            if(cmd == 0 || ref_vectors != NULL) {
-                for(lp1 = 0; lp1 < blks_width; lp1++) {
-                    for(i = 0, j = 0; i < blks_height; i++, j += width_tbl[1])
-                        ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
-                    cur_frm_pos += 4;
-                    ref_frm_pos += 4;
-                }
-            } else if(cmd != 1)
-                return;
-        } else {
-            k = *buf1 >> 4;
-            j = *buf1 & 0x0f;
-            buf1++;
-            lv = j + cb_offset;
-
-            if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
-                cp2 = s->ModPred + ((lv - 8) << 7);
-                cp = ref_frm_pos;
-                for(i = 0; i < blks_width << 2; i++) {
-                    int v = *cp >> 1;
-                    *(cp++) = cp2[v];
-                }
-            }
-
-            if(k == 1 || k == 4) {
-                lv = (hdr[j] & 0xf) + cb_offset;
-                correction_type_sp[0] = s->corrector_type + (lv << 8);
-                correction_lp[0] = correction + (lv << 8);
-                lv = (hdr[j] >> 4) + cb_offset;
-                correction_lp[1] = correction + (lv << 8);
-                correction_type_sp[1] = s->corrector_type + (lv << 8);
-            } else {
-                correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (lv << 8);
-                correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (lv << 8);
-                correction_type_sp[0] = correction_type_sp[1] = s->corrector_type + (lv << 8);
-                correction_lp[0] = correction_lp[1] = correction + (lv << 8);
-            }
-
-            switch(k) {
-            case 1:
-            case 0:                    /********** CASE 0 **********/
-                for( ; blks_height > 0; blks_height -= 4) {
-                    for(lp1 = 0; lp1 < blks_width; lp1++) {
-                        for(lp2 = 0; lp2 < 4; ) {
-                            k = *buf1++;
-                            cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
-                            ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
-
-                            switch(correction_type_sp[0][k]) {
-                            case 0:
-                                *cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
-                                lp2++;
-                                break;
-                            case 1:
-                                res = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
-                                ((unsigned short *)cur_lp)[0] = le2me_16(res);
-                                res = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
-                                ((unsigned short *)cur_lp)[1] = le2me_16(res);
-                                buf1++;
-                                lp2++;
-                                break;
-                            case 2:
-                                if(lp2 == 0) {
-                                    for(i = 0, j = 0; i < 2; i++, j += width_tbl[1])
-                                        cur_lp[j] = ref_lp[j];
-                                    lp2 += 2;
-                                }
-                                break;
-                            case 3:
-                                if(lp2 < 2) {
-                                    for(i = 0, j = 0; i < (3 - lp2); i++, j += width_tbl[1])
-                                        cur_lp[j] = ref_lp[j];
-                                    lp2 = 3;
-                                }
-                                break;
-                            case 8:
-                                if(lp2 == 0) {
-                                    RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
-
-                                    if(rle_v1 == 1 || ref_vectors != NULL) {
-                                        for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
-                                            cur_lp[j] = ref_lp[j];
-                                    }
-
-                                    RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
-                                    break;
-                                } else {
-                                    rle_v1 = 1;
-                                    rle_v2 = *buf1 - 1;
-                                }
-                            case 5:
-                                LP2_CHECK(buf1,rle_v3,lp2)
-                            case 4:
-                                for(i = 0, j = 0; i < (4 - lp2); i++, j += width_tbl[1])
-                                    cur_lp[j] = ref_lp[j];
-                                lp2 = 4;
-                                break;
-
-                            case 7:
-                                if(rle_v3 != 0)
-                                    rle_v3 = 0;
-                                else {
-                                    buf1--;
-                                    rle_v3 = 1;
-                                }
-                            case 6:
-                                if(ref_vectors != NULL) {
-                                    for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
-                                        cur_lp[j] = ref_lp[j];
-                                }
-                                lp2 = 4;
-                                break;
-
-                            case 9:
-                                lv1 = *buf1++;
-                                lv = (lv1 & 0x7F) << 1;
-                                lv += (lv << 8);
-                                lv += (lv << 16);
-                                for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
-                                    cur_lp[j] = lv;
-
-                                LV1_CHECK(buf1,rle_v3,lv1,lp2)
-                                break;
-                            default:
-                                return;
-                            }
-                        }
-
-                        cur_frm_pos += 4;
-                        ref_frm_pos += 4;
-                    }
-
-                    cur_frm_pos += ((width - blks_width) * 4);
-                    ref_frm_pos += ((width - blks_width) * 4);
-                }
-                break;
-
-            case 4:
-            case 3:                    /********** CASE 3 **********/
-                if(ref_vectors != NULL)
-                    return;
-                flag1 = 1;
-
-                for( ; blks_height > 0; blks_height -= 8) {
-                    for(lp1 = 0; lp1 < blks_width; lp1++) {
-                        for(lp2 = 0; lp2 < 4; ) {
-                            k = *buf1++;
-
-                            cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
-                            ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
-
-                            switch(correction_type_sp[lp2 & 0x01][k]) {
-                            case 0:
-                                cur_lp[width_tbl[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
-                                if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
-                                    cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                else
-                                    cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
-                                lp2++;
-                                break;
-
-                            case 1:
-                                res = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
-                                ((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
-                                res = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
-                                ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
-
-                                if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
-                                    cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                else
-                                    cur_lp[0] = cur_lp[width_tbl[1]];
-                                buf1++;
-                                lp2++;
-                                break;
-
-                            case 2:
-                                if(lp2 == 0) {
-                                    for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
-                                        cur_lp[j] = *ref_lp;
-                                    lp2 += 2;
-                                }
-                                break;
-
-                            case 3:
-                                if(lp2 < 2) {
-                                    for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
-                                        cur_lp[j] = *ref_lp;
-                                    lp2 = 3;
-                                }
-                                break;
-
-                            case 6:
-                                lp2 = 4;
-                                break;
-
-                            case 7:
-                                if(rle_v3 != 0)
-                                    rle_v3 = 0;
-                                else {
-                                    buf1--;
-                                    rle_v3 = 1;
-                                }
-                                lp2 = 4;
-                                break;
-
-                            case 8:
-                                if(lp2 == 0) {
-                                    RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
-
-                                    if(rle_v1 == 1) {
-                                        for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
-                                            cur_lp[j] = ref_lp[j];
-                                    }
-
-                                    RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
-                                    break;
-                                } else {
-                                    rle_v2 = (*buf1) - 1;
-                                    rle_v1 = 1;
-                                }
-                            case 5:
-                                LP2_CHECK(buf1,rle_v3,lp2)
-                            case 4:
-                                for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
-                                    cur_lp[j] = *ref_lp;
-                                lp2 = 4;
-                                break;
-
-                            case 9:
-                                av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
-                                lv1 = *buf1++;
-                                lv = (lv1 & 0x7F) << 1;
-                                lv += (lv << 8);
-                                lv += (lv << 16);
-
-                                for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
-                                    cur_lp[j] = lv;
-
-                                LV1_CHECK(buf1,rle_v3,lv1,lp2)
-                                break;
-
-                            default:
-                                return;
-                            }
-                        }
-
-                        cur_frm_pos += 4;
-                    }
-
-                    cur_frm_pos += (((width * 2) - blks_width) * 4);
-                    flag1 = 0;
-                }
-                break;
-
-            case 10:                    /********** CASE 10 **********/
-                if(ref_vectors == NULL) {
-                    flag1 = 1;
-
-                    for( ; blks_height > 0; blks_height -= 8) {
-                        for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
-                            for(lp2 = 0; lp2 < 4; ) {
-                                k = *buf1++;
-                                cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
-                                ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
-                                lv1 = ref_lp[0];
-                                lv2 = ref_lp[1];
-                                if(lp2 == 0 && flag1 != 0) {
-#if HAVE_BIGENDIAN
-                                    lv1 = lv1 & 0xFF00FF00;
-                                    lv1 = (lv1 >> 8) | lv1;
-                                    lv2 = lv2 & 0xFF00FF00;
-                                    lv2 = (lv2 >> 8) | lv2;
-#else
-                                    lv1 = lv1 & 0x00FF00FF;
-                                    lv1 = (lv1 << 8) | lv1;
-                                    lv2 = lv2 & 0x00FF00FF;
-                                    lv2 = (lv2 << 8) | lv2;
-#endif
-                                }
-
-                                switch(correction_type_sp[lp2 & 0x01][k]) {
-                                case 0:
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
-                                    if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
-                                        cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                        cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
-                                    } else {
-                                        cur_lp[0] = cur_lp[width_tbl[1]];
-                                        cur_lp[1] = cur_lp[width_tbl[1]+1];
-                                    }
-                                    lp2++;
-                                    break;
-
-                                case 1:
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
-                                    if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
-                                        cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                        cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
-                                    } else {
-                                        cur_lp[0] = cur_lp[width_tbl[1]];
-                                        cur_lp[1] = cur_lp[width_tbl[1]+1];
-                                    }
-                                    buf1++;
-                                    lp2++;
-                                    break;
-
-                                case 2:
-                                    if(lp2 == 0) {
-                                        if(flag1 != 0) {
-                                            for(i = 0, j = width_tbl[1]; i < 3; i++, j += width_tbl[1]) {
-                                                cur_lp[j] = lv1;
-                                                cur_lp[j+1] = lv2;
-                                            }
-                                            cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                            cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
-                                        } else {
-                                            for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
-                                                cur_lp[j] = lv1;
-                                                cur_lp[j+1] = lv2;
-                                            }
-                                        }
-                                        lp2 += 2;
-                                    }
-                                    break;
-
-                                case 3:
-                                    if(lp2 < 2) {
-                                        if(lp2 == 0 && flag1 != 0) {
-                                            for(i = 0, j = width_tbl[1]; i < 5; i++, j += width_tbl[1]) {
-                                                cur_lp[j] = lv1;
-                                                cur_lp[j+1] = lv2;
-                                            }
-                                            cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                            cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
-                                        } else {
-                                            for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
-                                                cur_lp[j] = lv1;
-                                                cur_lp[j+1] = lv2;
-                                            }
-                                        }
-                                        lp2 = 3;
-                                    }
-                                    break;
-
-                                case 8:
-                                    if(lp2 == 0) {
-                                        RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
-                                        if(rle_v1 == 1) {
-                                            if(flag1 != 0) {
-                                                for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
-                                                    cur_lp[j] = lv1;
-                                                    cur_lp[j+1] = lv2;
-                                                }
-                                                cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                                cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
-                                            } else {
-                                                for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
-                                                    cur_lp[j] = lv1;
-                                                    cur_lp[j+1] = lv2;
-                                                }
-                                            }
-                                        }
-                                        RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
-                                        break;
-                                    } else {
-                                        rle_v1 = 1;
-                                        rle_v2 = (*buf1) - 1;
-                                    }
-                                case 5:
-                                    LP2_CHECK(buf1,rle_v3,lp2)
-                                case 4:
-                                    if(lp2 == 0 && flag1 != 0) {
-                                        for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
-                                            cur_lp[j] = lv1;
-                                            cur_lp[j+1] = lv2;
-                                        }
-                                        cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
-                                        cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
-                                    } else {
-                                        for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
-                                            cur_lp[j] = lv1;
-                                            cur_lp[j+1] = lv2;
-                                        }
-                                    }
-                                    lp2 = 4;
-                                    break;
-
-                                case 6:
-                                    lp2 = 4;
-                                    break;
-
-                                case 7:
-                                    if(lp2 == 0) {
-                                        if(rle_v3 != 0)
-                                            rle_v3 = 0;
-                                        else {
-                                            buf1--;
-                                            rle_v3 = 1;
-                                        }
-                                        lp2 = 4;
-                                    }
-                                    break;
-
-                                case 9:
-                                    av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
-                                    lv1 = *buf1;
-                                    lv = (lv1 & 0x7F) << 1;
-                                    lv += (lv << 8);
-                                    lv += (lv << 16);
-                                    for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
-                                        cur_lp[j] = lv;
-                                    LV1_CHECK(buf1,rle_v3,lv1,lp2)
-                                    break;
-
-                                default:
-                                    return;
-                                }
-                            }
-
-                            cur_frm_pos += 8;
-                        }
-
-                        cur_frm_pos += (((width * 2) - blks_width) * 4);
-                        flag1 = 0;
-                    }
-                } else {
-                    for( ; blks_height > 0; blks_height -= 8) {
-                        for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
-                            for(lp2 = 0; lp2 < 4; ) {
-                                k = *buf1++;
-                                cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
-                                ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
-
-                                switch(correction_type_sp[lp2 & 0x01][k]) {
-                                case 0:
-                                    lv1 = correctionloworder_lp[lp2 & 0x01][k];
-                                    lv2 = correctionhighorder_lp[lp2 & 0x01][k];
-                                    cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
-                                    cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
-                                    lp2++;
-                                    break;
-
-                                case 1:
-                                    lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
-                                    lv2 = correctionloworder_lp[lp2 & 0x01][k];
-                                    cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
-                                    cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
-                                    cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
-                                    cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
-                                    lp2++;
-                                    break;
-
-                                case 2:
-                                    if(lp2 == 0) {
-                                        for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
-                                            cur_lp[j] = ref_lp[j];
-                                            cur_lp[j+1] = ref_lp[j+1];
-                                        }
-                                        lp2 += 2;
-                                    }
-                                    break;
-
-                                case 3:
-                                    if(lp2 < 2) {
-                                        for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
-                                            cur_lp[j] = ref_lp[j];
-                                            cur_lp[j+1] = ref_lp[j+1];
-                                        }
-                                        lp2 = 3;
-                                    }
-                                    break;
-
-                                case 8:
-                                    if(lp2 == 0) {
-                                        RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
-                                        for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
-                                            ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
-                                            ((uint32_t *)cur_frm_pos)[j+1] = ((uint32_t *)ref_frm_pos)[j+1];
-                                        }
-                                        RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
-                                        break;
-                                    } else {
-                                        rle_v1 = 1;
-                                        rle_v2 = (*buf1) - 1;
-                                    }
-                                case 5:
-                                case 7:
-                                    LP2_CHECK(buf1,rle_v3,lp2)
-                                case 6:
-                                case 4:
-                                    for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
-                                        cur_lp[j] = ref_lp[j];
-                                        cur_lp[j+1] = ref_lp[j+1];
-                                    }
-                                    lp2 = 4;
-                                    break;
-
-                                case 9:
-                                    av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
-                                    lv1 = *buf1;
-                                    lv = (lv1 & 0x7F) << 1;
-                                    lv += (lv << 8);
-                                    lv += (lv << 16);
-                                    for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
-                                        ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)cur_frm_pos)[j+1] = lv;
-                                    LV1_CHECK(buf1,rle_v3,lv1,lp2)
-                                    break;
-
-                                default:
-                                    return;
-                                }
-                            }
-
-                            cur_frm_pos += 8;
-                            ref_frm_pos += 8;
-                        }
-
-                        cur_frm_pos += (((width * 2) - blks_width) * 4);
-                        ref_frm_pos += (((width * 2) - blks_width) * 4);
-                    }
-                }
-                break;
-
-            case 11:                    /********** CASE 11 **********/
-                if(ref_vectors == NULL)
-                    return;
-
-                for( ; blks_height > 0; blks_height -= 8) {
-                    for(lp1 = 0; lp1 < blks_width; lp1++) {
-                        for(lp2 = 0; lp2 < 4; ) {
-                            k = *buf1++;
-                            cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
-                            ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
-
-                            switch(correction_type_sp[lp2 & 0x01][k]) {
-                            case 0:
-                                cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
-                                cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
-                                lp2++;
-                                break;
-
-                            case 1:
-                                lv1 = (unsigned short)(correction_lp[lp2 & 0x01][*buf1++]);
-                                lv2 = (unsigned short)(correction_lp[lp2 & 0x01][k]);
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
-                                ((unsigned short *)cur_lp)[0] = le2me_16(res);
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
-                                ((unsigned short *)cur_lp)[1] = le2me_16(res);
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
-                                ((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
-                                res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
-                                ((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
-                                lp2++;
-                                break;
-
-                            case 2:
-                                if(lp2 == 0) {
-                                    for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
-                                        cur_lp[j] = ref_lp[j];
-                                    lp2 += 2;
-                                }
-                                break;
-
-                            case 3:
-                                if(lp2 < 2) {
-                                    for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
-                                        cur_lp[j] = ref_lp[j];
-                                    lp2 = 3;
-                                }
-                                break;
-
-                            case 8:
-                                if(lp2 == 0) {
-                                    RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
-
-                                    for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
-                                        cur_lp[j] = ref_lp[j];
-
-                                    RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
-                                    break;
-                                } else {
-                                    rle_v1 = 1;
-                                    rle_v2 = (*buf1) - 1;
-                                }
-                            case 5:
-                            case 7:
-                                LP2_CHECK(buf1,rle_v3,lp2)
-                            case 4:
-                            case 6:
-                                for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
-                                    cur_lp[j] = ref_lp[j];
-                                lp2 = 4;
-                                break;
-
-                            case 9:
-                                av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
-                                lv1 = *buf1++;
-                                lv = (lv1 & 0x7F) << 1;
-                                lv += (lv << 8);
-                                lv += (lv << 16);
-                                for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
-                                    cur_lp[j] = lv;
-                                LV1_CHECK(buf1,rle_v3,lv1,lp2)
-                                break;
-
-                            default:
-                                return;
-                            }
-                        }
-
-                        cur_frm_pos += 4;
-                        ref_frm_pos += 4;
-                    }
-
-                    cur_frm_pos += (((width * 2) - blks_width) * 4);
-                    ref_frm_pos += (((width * 2) - blks_width) * 4);
-                }
-                break;
-
-            default:
-                return;
-            }
-        }
-
-        for( ; strip >= strip_tbl; strip--) {
-            if(strip->split_flag != 0) {
-                strip->split_flag = 0;
-                strip->usl7 = (strip-1)->usl7;
-
-                if(strip->split_direction) {
-                    strip->xpos += strip->width;
-                    strip->width = (strip-1)->width - strip->width;
-                    if(region_160_width <= strip->xpos && width < strip->width + strip->xpos)
-                        strip->width = width - strip->xpos;
-                } else {
-                    strip->ypos += strip->height;
-                    strip->height = (strip-1)->height - strip->height;
-                }
-                break;
-            }
-        }
-    }
-}
-
-static av_cold int indeo3_decode_init(AVCodecContext *avctx)
-{
-    Indeo3DecodeContext *s = avctx->priv_data;
-    int ret = 0;
-
-    s->avctx = avctx;
-    s->width = avctx->width;
-    s->height = avctx->height;
-    avctx->pix_fmt = PIX_FMT_YUV410P;
-
-    if (!(ret = build_modpred(s)))
-        ret = iv_alloc_frames(s);
-    if (ret)
-        iv_free_func(s);
-
-    return ret;
-}
-
-static int iv_decode_frame(AVCodecContext *avctx,
-                           const uint8_t *buf, int buf_size)
-{
-    Indeo3DecodeContext *s = avctx->priv_data;
-    unsigned int image_width, image_height,
-                 chroma_width, chroma_height;
-    unsigned long flags, cb_offset, data_size,
-                  y_offset, v_offset, u_offset, mc_vector_count;
-    const uint8_t *hdr_pos, *buf_pos;
-
-    buf_pos = buf;
-    buf_pos += 18; /* skip OS header (16 bytes) and version number */
-
-    flags = bytestream_get_le16(&buf_pos);
-    data_size = bytestream_get_le32(&buf_pos);
-    cb_offset = *buf_pos++;
-    buf_pos += 3; /* skip reserved byte and checksum */
-    image_height = bytestream_get_le16(&buf_pos);
-    image_width  = bytestream_get_le16(&buf_pos);
-
-    if(avcodec_check_dimensions(avctx, image_width, image_height))
-        return -1;
-    if (image_width != avctx->width || image_height != avctx->height) {
-        int ret;
-        avcodec_set_dimensions(avctx, image_width, image_height);
-        s->width  = avctx->width;
-        s->height = avctx->height;
-        ret = iv_alloc_frames(s);
-        if (ret < 0) {
-            s->width = s->height = 0;
-            return ret;
-        }
-    }
-
-    chroma_height = ((image_height >> 2) + 3) & 0x7ffc;
-    chroma_width = ((image_width >> 2) + 3) & 0x7ffc;
-    y_offset = bytestream_get_le32(&buf_pos);
-    v_offset = bytestream_get_le32(&buf_pos);
-    u_offset = bytestream_get_le32(&buf_pos);
-    buf_pos += 4; /* reserved */
-    hdr_pos = buf_pos;
-    if(data_size == 0x80) return 4;
-
-    if(FFMAX3(y_offset, v_offset, u_offset) >= buf_size-16) {
-        av_log(s->avctx, AV_LOG_ERROR, "y/u/v offset outside buffer\n");
-        return -1;
-    }
-
-    if(flags & 0x200) {
-        s->cur_frame = s->iv_frame + 1;
-        s->ref_frame = s->iv_frame;
-    } else {
-        s->cur_frame = s->iv_frame;
-        s->ref_frame = s->iv_frame + 1;
-    }
-
-    buf_pos = buf + 16 + y_offset;
-    mc_vector_count = bytestream_get_le32(&buf_pos);
-    if(2LL*mc_vector_count >= buf_size-16-y_offset) {
-        av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
-        return -1;
-    }
-
-    iv_Decode_Chunk(s, s->cur_frame->Ybuf, s->ref_frame->Ybuf, image_width,
-                    image_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
-                    FFMIN(image_width, 160));
-
-    if (!(s->avctx->flags & CODEC_FLAG_GRAY))
-    {
-
-        buf_pos = buf + 16 + v_offset;
-        mc_vector_count = bytestream_get_le32(&buf_pos);
-        if(2LL*mc_vector_count >= buf_size-16-v_offset) {
-            av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
-            return -1;
-        }
-
-        iv_Decode_Chunk(s, s->cur_frame->Vbuf, s->ref_frame->Vbuf, chroma_width,
-                chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
-                FFMIN(chroma_width, 40));
-
-        buf_pos = buf + 16 + u_offset;
-        mc_vector_count = bytestream_get_le32(&buf_pos);
-        if(2LL*mc_vector_count >= buf_size-16-u_offset) {
-            av_log(s->avctx, AV_LOG_ERROR, "mc_vector_count too large\n");
-            return -1;
-        }
-
-        iv_Decode_Chunk(s, s->cur_frame->Ubuf, s->ref_frame->Ubuf, chroma_width,
-                chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
-                FFMIN(chroma_width, 40));
-
-    }
-
-    return 8;
-}
-
-static int indeo3_decode_frame(AVCodecContext *avctx,
-                               void *data, int *data_size,
-                               AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    Indeo3DecodeContext *s=avctx->priv_data;
-    uint8_t *src, *dest;
-    int y;
-
-    if (iv_decode_frame(avctx, buf, buf_size) < 0)
-        return -1;
-
-    if(s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    s->frame.reference = 0;
-    if(avctx->get_buffer(avctx, &s->frame) < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    src = s->cur_frame->Ybuf;
-    dest = s->frame.data[0];
-    for (y = 0; y < s->height; y++) {
-        memcpy(dest, src, s->cur_frame->y_w);
-        src += s->cur_frame->y_w;
-        dest += s->frame.linesize[0];
-    }
-
-    if (!(s->avctx->flags & CODEC_FLAG_GRAY))
-    {
-        src = s->cur_frame->Ubuf;
-        dest = s->frame.data[1];
-        for (y = 0; y < s->height / 4; y++) {
-            memcpy(dest, src, s->cur_frame->uv_w);
-            src += s->cur_frame->uv_w;
-            dest += s->frame.linesize[1];
-        }
-
-        src = s->cur_frame->Vbuf;
-        dest = s->frame.data[2];
-        for (y = 0; y < s->height / 4; y++) {
-            memcpy(dest, src, s->cur_frame->uv_w);
-            src += s->cur_frame->uv_w;
-            dest += s->frame.linesize[2];
-        }
-    }
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data= s->frame;
-
-    return buf_size;
-}
-
-static av_cold int indeo3_decode_end(AVCodecContext *avctx)
-{
-    Indeo3DecodeContext *s = avctx->priv_data;
-
-    iv_free_func(s);
-
-    return 0;
-}
-
-AVCodec indeo3_decoder = {
-    "indeo3",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_INDEO3,
-    sizeof(Indeo3DecodeContext),
-    indeo3_decode_init,
-    NULL,
-    indeo3_decode_end,
-    indeo3_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"),
-};
diff --git a/libavcodec/indeo3data.h b/libavcodec/indeo3data.h
deleted file mode 100644
index bbc4c95..0000000
--- a/libavcodec/indeo3data.h
+++ /dev/null
@@ -1,2342 +0,0 @@
-/*
- * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg
- * written, produced, and directed by Alan Smithee
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_INDEO3DATA_H
-#define AVCODEC_INDEO3DATA_H
-
-#include <stdint.h>
-
-static const uint32_t correction[] = {
-        0x00000000, 0x00000202, 0xfffffdfe, 0x000002ff, 0xfffffd01, 0xffffff03, 0x000000fd, 0x00000404,
-        0xfffffbfc, 0x00000501, 0xfffffaff, 0x00000105, 0xfffffefb, 0x000003fc, 0xfffffc04, 0x000005fe,
-        0xfffffa02, 0xfffffe06, 0x000001fa, 0x00000904, 0xfffff6fc, 0x00000409, 0xfffffbf7, 0x00000909,
-        0xfffff6f7, 0x00000a01, 0xfffff5ff, 0x0000010a, 0xfffffef6, 0x000007fb, 0xfffff805, 0xfffffb08,
-        0x000004f8, 0x00000f09, 0xfffff0f7, 0x0000090f, 0xfffff6f1, 0x00000bfd, 0xfffff403, 0xfffffd0c,
-        0x000002f4, 0x00001004, 0xffffeffc, 0x00000410, 0xfffffbf0, 0x00001010, 0xffffeff0, 0x00001200,
-        0xffffee00, 0x00000012, 0xffffffee, 0x00000bf4, 0xfffff40c, 0x00000ff7, 0xfffff009, 0xfffff710,
-        0x000008f0, 0x00001b0b, 0xffffe4f5, 0x00000b1b, 0xfffff4e5, 0x00001c13, 0xffffe3ed, 0x0000131c,
-        0xffffece4, 0x000015fa, 0xffffea06, 0xfffffa16, 0x000005ea, 0x00001d04, 0xffffe2fc, 0x0000041d,
-        0xfffffbe3, 0x00001e1e, 0xffffe1e2, 0x000020fe, 0xffffdf02, 0xfffffe21, 0x000001df, 0x000016ee,
-        0xffffe912, 0xffffee17, 0x000011e9, 0x00001df1, 0xffffe20f, 0xfffff11e, 0x00000ee2, 0x00002e16,
-        0xffffd1ea, 0x0000162e, 0xffffe9d2, 0x00002f0d, 0xffffd0f3, 0x00000d2f, 0xfffff2d1, 0x00003123,
-        0xffffcedd, 0x00002331, 0xffffdccf, 0x000028f5, 0xffffd70b, 0xfffff529, 0x00000ad7, 0x00003304,
-        0xffffccfc, 0x00000433, 0xfffffbcd, 0x00003636, 0xffffc9ca, 0x000021de, 0xffffde22, 0x000029e3,
-        0xffffd61d, 0xffffe32a, 0x00001cd6, 0x00003bfa, 0xffffc406, 0xfffffa3c, 0x000005c4, 0x00004c1b,
-        0xffffb3e5, 0x00001b4c, 0xffffe4b4, 0x00004d2b, 0xffffb2d5, 0x00002b4d, 0xffffd4b3, 0x000036e8,
-        0xffffc918, 0xffffe837, 0x000017c9, 0x00004f0e, 0xffffb0f2, 0x00000e4f, 0xfffff1b1, 0x0000533f,
-        0xffffacc1, 0x00003f53, 0xffffc0ad, 0x000049ec, 0xffffb614, 0xffffec4a, 0x000013b6, 0x00005802,
-        0xffffa7fe, 0x00000258, 0xfffffda8, 0x00005d5d, 0xffffa2a3, 0x00003ccc, 0xffffc334, 0xffffcc3d,
-        0x000033c3, 0x00007834, 0xffff87cc, 0x00003478, 0xffffcb88, 0x00004ad3, 0xffffb52d, 0xffffd34b,
-        0x00002cb5, 0x00007d4b, 0xffff82b5, 0x00004b7d, 0xffffb483, 0x00007a21, 0xffff85df, 0x0000217a,
-        0xffffde86, 0x000066f3, 0xffff990d, 0xfffff367, 0x00000c99, 0x00005fd8, 0xffffa028, 0xffffd860,
-        0x000027a0, 0x00007ede, 0xffff8122, 0xffffde7f, 0x00002181, 0x000058a7, 0xffffa759, 0x000068b2,
-        0xffff974e, 0xffffb269, 0x00004d97, 0x00000c0c, 0xfffff3f4, 0x00001717, 0xffffe8e9, 0x00002a2a,
-        0xffffd5d6, 0x00004949, 0xffffb6b7, 0x00000000, 0x02020000, 0xfdfe0000, 0x02ff0000, 0xfd010000,
-        0xff030000, 0x00fd0000, 0x00000202, 0x02020202, 0xfdfe0202, 0x02ff0202, 0xfd010202, 0xff030202,
-        0x00fd0202, 0xfffffdfe, 0x0201fdfe, 0xfdfdfdfe, 0x02fefdfe, 0xfd00fdfe, 0xff02fdfe, 0x00fcfdfe,
-        0x000002ff, 0x020202ff, 0xfdfe02ff, 0x02ff02ff, 0xfd0102ff, 0xff0302ff, 0x00fd02ff, 0xfffffd01,
-        0x0201fd01, 0xfdfdfd01, 0x02fefd01, 0xfd00fd01, 0xff02fd01, 0x00fcfd01, 0xffffff03, 0x0201ff03,
-        0xfdfdff03, 0x02feff03, 0xfd00ff03, 0xff02ff03, 0x00fcff03, 0x000000fd, 0x020200fd, 0xfdfe00fd,
-        0x02ff00fd, 0xfd0100fd, 0xff0300fd, 0x00fd00fd, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000303, 0xfffffcfd, 0x000003ff, 0xfffffc01, 0xffffff04, 0x000000fc, 0x00000707,
-        0xfffff8f9, 0x00000802, 0xfffff7fe, 0x00000208, 0xfffffdf8, 0x000008fe, 0xfffff702, 0xfffffe09,
-        0x000001f7, 0x000005fa, 0xfffffa06, 0x00000d06, 0xfffff2fa, 0x0000060d, 0xfffff9f3, 0x00000d0d,
-        0xfffff2f3, 0x00000e01, 0xfffff1ff, 0x0000010e, 0xfffffef2, 0x00000bf8, 0xfffff408, 0xfffff80c,
-        0x000007f4, 0x0000170e, 0xffffe8f2, 0x00000e17, 0xfffff1e9, 0x000011fb, 0xffffee05, 0xfffffb12,
-        0x000004ee, 0x00001806, 0xffffe7fa, 0x00000618, 0xfffff9e8, 0x00001818, 0xffffe7e8, 0x00001aff,
-        0xffffe501, 0xffffff1b, 0x000000e5, 0x000010ef, 0xffffef11, 0x000016f3, 0xffffe90d, 0xfffff317,
-        0x00000ce9, 0x00002810, 0xffffd7f0, 0x00001028, 0xffffefd8, 0x0000291c, 0xffffd6e4, 0x00001c29,
-        0xffffe3d7, 0x000020f7, 0xffffdf09, 0xfffff721, 0x000008df, 0x00002b06, 0xffffd4fa, 0x0000062b,
-        0xfffff9d5, 0x00002e2e, 0xffffd1d2, 0x000031fc, 0xffffce04, 0xfffffc32, 0x000003ce, 0x000021e5,
-        0xffffde1b, 0xffffe522, 0x00001ade, 0x00002cea, 0xffffd316, 0xffffea2d, 0x000015d3, 0x00004522,
-        0xffffbade, 0x00002245, 0xffffddbb, 0x00004613, 0xffffb9ed, 0x00001346, 0xffffecba, 0x00004935,
-        0xffffb6cb, 0x00003549, 0xffffcab7, 0x00003def, 0xffffc211, 0xffffef3e, 0x000010c2, 0x00004d05,
-        0xffffb2fb, 0x0000054d, 0xfffffab3, 0x00005252, 0xffffadae, 0x000032cd, 0xffffcd33, 0x00003fd5,
-        0xffffc02b, 0xffffd540, 0x00002ac0, 0x000059f6, 0xffffa60a, 0xfffff65a, 0x000009a6, 0x00007229,
-        0xffff8dd7, 0x00002972, 0xffffd68e, 0x00007440, 0xffff8bc0, 0x00004074, 0xffffbf8c, 0x000051db,
-        0xffffae25, 0xffffdb52, 0x000024ae, 0x00007716, 0xffff88ea, 0x00001677, 0xffffe989, 0x00007c5f,
-        0xffff83a1, 0x00005f7c, 0xffffa084, 0x00006ee2, 0xffff911e, 0xffffe26f, 0x00001d91, 0x00005bb2,
-        0xffffa44e, 0xffffb25c, 0x00004da4, 0x000070bc, 0xffff8f44, 0xffffbc71, 0x0000438f, 0x00001212,
-        0xffffedee, 0x00002222, 0xffffddde, 0x00003f3f, 0xffffc0c1, 0x00006d6d, 0xffff9293, 0x00000000,
-        0x03030000, 0xfcfd0000, 0x03ff0000, 0xfc010000, 0xff040000, 0x00fc0000, 0x07070000, 0xf8f90000,
-        0x00000303, 0x03030303, 0xfcfd0303, 0x03ff0303, 0xfc010303, 0xff040303, 0x00fc0303, 0x07070303,
-        0xf8f90303, 0xfffffcfd, 0x0302fcfd, 0xfcfcfcfd, 0x03fefcfd, 0xfc00fcfd, 0xff03fcfd, 0x00fbfcfd,
-        0x0706fcfd, 0xf8f8fcfd, 0x000003ff, 0x030303ff, 0xfcfd03ff, 0x03ff03ff, 0xfc0103ff, 0xff0403ff,
-        0x00fc03ff, 0x070703ff, 0xf8f903ff, 0xfffffc01, 0x0302fc01, 0xfcfcfc01, 0x03fefc01, 0xfc00fc01,
-        0xff03fc01, 0x00fbfc01, 0x0706fc01, 0xf8f8fc01, 0xffffff04, 0x0302ff04, 0xfcfcff04, 0x03feff04,
-        0xfc00ff04, 0xff03ff04, 0x00fbff04, 0x0706ff04, 0xf8f8ff04, 0x000000fc, 0x030300fc, 0xfcfd00fc,
-        0x03ff00fc, 0xfc0100fc, 0xff0400fc, 0x00fc00fc, 0x070700fc, 0xf8f900fc, 0x00000707, 0x03030707,
-        0xfcfd0707, 0x03ff0707, 0xfc010707, 0xff040707, 0x00fc0707, 0x07070707, 0xf8f90707, 0xfffff8f9,
-        0x0302f8f9, 0xfcfcf8f9, 0x03fef8f9, 0xfc00f8f9, 0xff03f8f9, 0x00fbf8f9, 0x0706f8f9, 0xf8f8f8f9,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000404, 0xfffffbfc, 0x000004ff, 0xfffffb01, 0xffffff05, 0x000000fb, 0x00000a03,
-        0xfffff5fd, 0x0000030a, 0xfffffcf6, 0x00000909, 0xfffff6f7, 0x000006f9, 0xfffff907, 0x00000bfd,
-        0xfffff403, 0xfffffd0c, 0x000002f4, 0x00001108, 0xffffeef8, 0x00000811, 0xfffff7ef, 0x00001111,
-        0xffffeeef, 0x00001301, 0xffffecff, 0x00000113, 0xfffffeed, 0x00000ff5, 0xfffff00b, 0xfffff510,
-        0x00000af0, 0x000016fa, 0xffffe906, 0xfffffa17, 0x000005e9, 0x00001f12, 0xffffe0ee, 0x0000121f,
-        0xffffede1, 0x00002008, 0xffffdff8, 0x00000820, 0xfffff7e0, 0x00002121, 0xffffdedf, 0x000023ff,
-        0xffffdc01, 0xffffff24, 0x000000dc, 0x000016e9, 0xffffe917, 0x00001eef, 0xffffe111, 0xffffef1f,
-        0x000010e1, 0x00003615, 0xffffc9eb, 0x00001536, 0xffffeaca, 0x00003725, 0xffffc8db, 0x00002537,
-        0xffffdac9, 0x00002bf4, 0xffffd40c, 0xfffff42c, 0x00000bd4, 0x00003908, 0xffffc6f8, 0x00000839,
-        0xfffff7c7, 0x00003d3d, 0xffffc2c3, 0x000041fb, 0xffffbe05, 0xfffffb42, 0x000004be, 0x00002cdc,
-        0xffffd324, 0xffffdc2d, 0x000023d3, 0x00003be3, 0xffffc41d, 0xffffe33c, 0x00001cc4, 0x00005c2d,
-        0xffffa3d3, 0x00002d5c, 0xffffd2a4, 0x00005d19, 0xffffa2e7, 0x0000195d, 0xffffe6a3, 0x00006147,
-        0xffff9eb9, 0x00004761, 0xffffb89f, 0x000052ea, 0xffffad16, 0xffffea53, 0x000015ad, 0x00006607,
-        0xffff99f9, 0x00000766, 0xfffff89a, 0x00006d6d, 0xffff9293, 0x000043bc, 0xffffbc44, 0x000054c7,
-        0xffffab39, 0xffffc755, 0x000038ab, 0x000077f3, 0xffff880d, 0xfffff378, 0x00000c88, 0x00006dcf,
-        0xffff9231, 0xffffcf6e, 0x00003092, 0x00007a98, 0xffff8568, 0xffff987b, 0x00006785, 0x00001818,
-        0xffffe7e8, 0x00002e2e, 0xffffd1d2, 0x00005454, 0xffffabac, 0x00000000, 0x04040000, 0xfbfc0000,
-        0x04ff0000, 0xfb010000, 0xff050000, 0x00fb0000, 0x0a030000, 0xf5fd0000, 0x030a0000, 0x00000404,
-        0x04040404, 0xfbfc0404, 0x04ff0404, 0xfb010404, 0xff050404, 0x00fb0404, 0x0a030404, 0xf5fd0404,
-        0x030a0404, 0xfffffbfc, 0x0403fbfc, 0xfbfbfbfc, 0x04fefbfc, 0xfb00fbfc, 0xff04fbfc, 0x00fafbfc,
-        0x0a02fbfc, 0xf5fcfbfc, 0x0309fbfc, 0x000004ff, 0x040404ff, 0xfbfc04ff, 0x04ff04ff, 0xfb0104ff,
-        0xff0504ff, 0x00fb04ff, 0x0a0304ff, 0xf5fd04ff, 0x030a04ff, 0xfffffb01, 0x0403fb01, 0xfbfbfb01,
-        0x04fefb01, 0xfb00fb01, 0xff04fb01, 0x00fafb01, 0x0a02fb01, 0xf5fcfb01, 0x0309fb01, 0xffffff05,
-        0x0403ff05, 0xfbfbff05, 0x04feff05, 0xfb00ff05, 0xff04ff05, 0x00faff05, 0x0a02ff05, 0xf5fcff05,
-        0x0309ff05, 0x000000fb, 0x040400fb, 0xfbfc00fb, 0x04ff00fb, 0xfb0100fb, 0xff0500fb, 0x00fb00fb,
-        0x0a0300fb, 0xf5fd00fb, 0x030a00fb, 0x00000a03, 0x04040a03, 0xfbfc0a03, 0x04ff0a03, 0xfb010a03,
-        0xff050a03, 0x00fb0a03, 0x0a030a03, 0xf5fd0a03, 0x030a0a03, 0xfffff5fd, 0x0403f5fd, 0xfbfbf5fd,
-        0x04fef5fd, 0xfb00f5fd, 0xff04f5fd, 0x00faf5fd, 0x0a02f5fd, 0xf5fcf5fd, 0x0309f5fd, 0x0000030a,
-        0x0404030a, 0xfbfc030a, 0x04ff030a, 0xfb01030a, 0xff05030a, 0x00fb030a, 0x0a03030a, 0xf5fd030a,
-        0x030a030a, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000505, 0xfffffafb, 0x000006fe, 0xfffff902, 0xfffffe07, 0x000001f9, 0x00000b0b,
-        0xfffff4f5, 0x00000d03, 0xfffff2fd, 0x0000030d, 0xfffffcf3, 0x000008f7, 0xfffff709, 0x00000efc,
-        0xfffff104, 0xfffffc0f, 0x000003f1, 0x0000160b, 0xffffe9f5, 0x00000b16, 0xfffff4ea, 0x00001515,
-        0xffffeaeb, 0x00001802, 0xffffe7fe, 0x00000218, 0xfffffde8, 0x000013f2, 0xffffec0e, 0xfffff214,
-        0x00000dec, 0x00002617, 0xffffd9e9, 0x00001726, 0xffffe8da, 0x00001cf8, 0xffffe308, 0xfffff81d,
-        0x000007e3, 0x0000270b, 0xffffd8f5, 0x00000b27, 0xfffff4d9, 0x00002929, 0xffffd6d7, 0x00002cff,
-        0xffffd301, 0xffffff2d, 0x000000d3, 0x00001ce3, 0xffffe31d, 0x000026ea, 0xffffd916, 0xffffea27,
-        0x000015d9, 0x0000431b, 0xffffbce5, 0x00001b43, 0xffffe4bd, 0x0000452f, 0xffffbad1, 0x00002f45,
-        0xffffd0bb, 0x000037f1, 0xffffc80f, 0xfffff138, 0x00000ec8, 0x0000470b, 0xffffb8f5, 0x00000b47,
-        0xfffff4b9, 0x00004c4c, 0xffffb3b4, 0x000052fa, 0xffffad06, 0xfffffa53, 0x000005ad, 0x000038d3,
-        0xffffc72d, 0xffffd339, 0x00002cc7, 0x00004adc, 0xffffb524, 0xffffdc4b, 0x000023b5, 0x00007338,
-        0xffff8cc8, 0x00003873, 0xffffc78d, 0x0000751f, 0xffff8ae1, 0x00001f75, 0xffffe08b, 0x00007a58,
-        0xffff85a8, 0x0000587a, 0xffffa786, 0x000067e4, 0xffff981c, 0xffffe468, 0x00001b98, 0x000054ab,
-        0xffffab55, 0x000069b8, 0xffff9648, 0xffffb86a, 0x00004796, 0x00001e1e, 0xffffe1e2, 0x00003a3a,
-        0xffffc5c6, 0x00006969, 0xffff9697, 0x00000000, 0x05050000, 0xfafb0000, 0x06fe0000, 0xf9020000,
-        0xfe070000, 0x01f90000, 0x0b0b0000, 0xf4f50000, 0x0d030000, 0xf2fd0000, 0x00000505, 0x05050505,
-        0xfafb0505, 0x06fe0505, 0xf9020505, 0xfe070505, 0x01f90505, 0x0b0b0505, 0xf4f50505, 0x0d030505,
-        0xf2fd0505, 0xfffffafb, 0x0504fafb, 0xfafafafb, 0x06fdfafb, 0xf901fafb, 0xfe06fafb, 0x01f8fafb,
-        0x0b0afafb, 0xf4f4fafb, 0x0d02fafb, 0xf2fcfafb, 0x000006fe, 0x050506fe, 0xfafb06fe, 0x06fe06fe,
-        0xf90206fe, 0xfe0706fe, 0x01f906fe, 0x0b0b06fe, 0xf4f506fe, 0x0d0306fe, 0xf2fd06fe, 0xfffff902,
-        0x0504f902, 0xfafaf902, 0x06fdf902, 0xf901f902, 0xfe06f902, 0x01f8f902, 0x0b0af902, 0xf4f4f902,
-        0x0d02f902, 0xf2fcf902, 0xfffffe07, 0x0504fe07, 0xfafafe07, 0x06fdfe07, 0xf901fe07, 0xfe06fe07,
-        0x01f8fe07, 0x0b0afe07, 0xf4f4fe07, 0x0d02fe07, 0xf2fcfe07, 0x000001f9, 0x050501f9, 0xfafb01f9,
-        0x06fe01f9, 0xf90201f9, 0xfe0701f9, 0x01f901f9, 0x0b0b01f9, 0xf4f501f9, 0x0d0301f9, 0xf2fd01f9,
-        0x00000b0b, 0x05050b0b, 0xfafb0b0b, 0x06fe0b0b, 0xf9020b0b, 0xfe070b0b, 0x01f90b0b, 0x0b0b0b0b,
-        0xf4f50b0b, 0x0d030b0b, 0xf2fd0b0b, 0xfffff4f5, 0x0504f4f5, 0xfafaf4f5, 0x06fdf4f5, 0xf901f4f5,
-        0xfe06f4f5, 0x01f8f4f5, 0x0b0af4f5, 0xf4f4f4f5, 0x0d02f4f5, 0xf2fcf4f5, 0x00000d03, 0x05050d03,
-        0xfafb0d03, 0x06fe0d03, 0xf9020d03, 0xfe070d03, 0x01f90d03, 0x0b0b0d03, 0xf4f50d03, 0x0d030d03,
-        0xf2fd0d03, 0xfffff2fd, 0x0504f2fd, 0xfafaf2fd, 0x06fdf2fd, 0xf901f2fd, 0xfe06f2fd, 0x01f8f2fd,
-        0x0b0af2fd, 0xf4f4f2fd, 0x0d02f2fd, 0xf2fcf2fd, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000606, 0xfffff9fa, 0x000007fe, 0xfffff802, 0xfffffe08, 0x000001f8, 0x00000d0d,
-        0xfffff2f3, 0x00000f04, 0xfffff0fc, 0x0000040f, 0xfffffbf1, 0x00000af5, 0xfffff50b, 0x000011fb,
-        0xffffee05, 0xfffffb12, 0x000004ee, 0x00001a0d, 0xffffe5f3, 0x00000d1a, 0xfffff2e6, 0x00001a1a,
-        0xffffe5e6, 0x00001d02, 0xffffe2fe, 0x0000021d, 0xfffffde3, 0x000017f0, 0xffffe810, 0xfffff018,
-        0x00000fe8, 0x00002e1c, 0xffffd1e4, 0x00001c2e, 0xffffe3d2, 0x000022f7, 0xffffdd09, 0xfffff723,
-        0x000008dd, 0x00002f0d, 0xffffd0f3, 0x00000d2f, 0xfffff2d1, 0x00003131, 0xffffcecf, 0x000035ff,
-        0xffffca01, 0xffffff36, 0x000000ca, 0x000022dd, 0xffffdd23, 0x00002ee6, 0xffffd11a, 0xffffe62f,
-        0x000019d1, 0x00005120, 0xffffaee0, 0x00002051, 0xffffdfaf, 0x00005338, 0xffffacc8, 0x00003853,
-        0xffffc7ad, 0x000042ee, 0xffffbd12, 0xffffee43, 0x000011bd, 0x0000560d, 0xffffa9f3, 0x00000d56,
-        0xfffff2aa, 0x00005b5b, 0xffffa4a5, 0x000062f9, 0xffff9d07, 0xfffff963, 0x0000069d, 0x000043ca,
-        0xffffbc36, 0xffffca44, 0x000035bc, 0x000059d4, 0xffffa62c, 0xffffd45a, 0x00002ba6, 0x00007bdf,
-        0xffff8421, 0xffffdf7c, 0x00002084, 0x00006699, 0xffff9967, 0x00007eaa, 0xffff8156, 0xffffaa7f,
-        0x00005581, 0x00002525, 0xffffdadb, 0x00004545, 0xffffbabb, 0x00000000, 0x06060000, 0xf9fa0000,
-        0x07fe0000, 0xf8020000, 0xfe080000, 0x01f80000, 0x0d0d0000, 0xf2f30000, 0x0f040000, 0xf0fc0000,
-        0x040f0000, 0x00000606, 0x06060606, 0xf9fa0606, 0x07fe0606, 0xf8020606, 0xfe080606, 0x01f80606,
-        0x0d0d0606, 0xf2f30606, 0x0f040606, 0xf0fc0606, 0x040f0606, 0xfffff9fa, 0x0605f9fa, 0xf9f9f9fa,
-        0x07fdf9fa, 0xf801f9fa, 0xfe07f9fa, 0x01f7f9fa, 0x0d0cf9fa, 0xf2f2f9fa, 0x0f03f9fa, 0xf0fbf9fa,
-        0x040ef9fa, 0x000007fe, 0x060607fe, 0xf9fa07fe, 0x07fe07fe, 0xf80207fe, 0xfe0807fe, 0x01f807fe,
-        0x0d0d07fe, 0xf2f307fe, 0x0f0407fe, 0xf0fc07fe, 0x040f07fe, 0xfffff802, 0x0605f802, 0xf9f9f802,
-        0x07fdf802, 0xf801f802, 0xfe07f802, 0x01f7f802, 0x0d0cf802, 0xf2f2f802, 0x0f03f802, 0xf0fbf802,
-        0x040ef802, 0xfffffe08, 0x0605fe08, 0xf9f9fe08, 0x07fdfe08, 0xf801fe08, 0xfe07fe08, 0x01f7fe08,
-        0x0d0cfe08, 0xf2f2fe08, 0x0f03fe08, 0xf0fbfe08, 0x040efe08, 0x000001f8, 0x060601f8, 0xf9fa01f8,
-        0x07fe01f8, 0xf80201f8, 0xfe0801f8, 0x01f801f8, 0x0d0d01f8, 0xf2f301f8, 0x0f0401f8, 0xf0fc01f8,
-        0x040f01f8, 0x00000d0d, 0x06060d0d, 0xf9fa0d0d, 0x07fe0d0d, 0xf8020d0d, 0xfe080d0d, 0x01f80d0d,
-        0x0d0d0d0d, 0xf2f30d0d, 0x0f040d0d, 0xf0fc0d0d, 0x040f0d0d, 0xfffff2f3, 0x0605f2f3, 0xf9f9f2f3,
-        0x07fdf2f3, 0xf801f2f3, 0xfe07f2f3, 0x01f7f2f3, 0x0d0cf2f3, 0xf2f2f2f3, 0x0f03f2f3, 0xf0fbf2f3,
-        0x040ef2f3, 0x00000f04, 0x06060f04, 0xf9fa0f04, 0x07fe0f04, 0xf8020f04, 0xfe080f04, 0x01f80f04,
-        0x0d0d0f04, 0xf2f30f04, 0x0f040f04, 0xf0fc0f04, 0x040f0f04, 0xfffff0fc, 0x0605f0fc, 0xf9f9f0fc,
-        0x07fdf0fc, 0xf801f0fc, 0xfe07f0fc, 0x01f7f0fc, 0x0d0cf0fc, 0xf2f2f0fc, 0x0f03f0fc, 0xf0fbf0fc,
-        0x040ef0fc, 0x0000040f, 0x0606040f, 0xf9fa040f, 0x07fe040f, 0xf802040f, 0xfe08040f, 0x01f8040f,
-        0x0d0d040f, 0xf2f3040f, 0x0f04040f, 0xf0fc040f, 0x040f040f, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000707, 0xfffff8f9, 0x000009fd, 0xfffff603, 0xfffffd0a, 0x000002f6, 0x00001010,
-        0xffffeff0, 0x00001205, 0xffffedfb, 0x00000512, 0xfffffaee, 0x00000cf3, 0xfffff30d, 0x000014fa,
-        0xffffeb06, 0xfffffa15, 0x000005eb, 0x00001e0f, 0xffffe1f1, 0x00000f1e, 0xfffff0e2, 0x00001e1e,
-        0xffffe1e2, 0x00002202, 0xffffddfe, 0x00000222, 0xfffffdde, 0x00001bed, 0xffffe413, 0xffffed1c,
-        0x000012e4, 0x00003620, 0xffffc9e0, 0x00002036, 0xffffdfca, 0x000028f5, 0xffffd70b, 0xfffff529,
-        0x00000ad7, 0x0000370f, 0xffffc8f1, 0x00000f37, 0xfffff0c9, 0x00003939, 0xffffc6c7, 0x00003eff,
-        0xffffc101, 0xffffff3f, 0x000000c1, 0x000027d8, 0xffffd828, 0x000036e2, 0xffffc91e, 0xffffe237,
-        0x00001dc9, 0x00005e25, 0xffffa1db, 0x0000255e, 0xffffdaa2, 0x00006041, 0xffff9fbf, 0x00004160,
-        0xffffbea0, 0x00004deb, 0xffffb215, 0xffffeb4e, 0x000014b2, 0x0000640f, 0xffff9bf1, 0x00000f64,
-        0xfffff09c, 0x00006a6a, 0xffff9596, 0x000073f8, 0xffff8c08, 0xfffff874, 0x0000078c, 0x00004ec1,
-        0xffffb13f, 0xffffc14f, 0x00003eb1, 0x000068cd, 0xffff9733, 0xffffcd69, 0x00003297, 0x00007788,
-        0xffff8878, 0x00002b2b, 0xffffd4d5, 0x00005050, 0xffffafb0, 0x00000000, 0x07070000, 0xf8f90000,
-        0x09fd0000, 0xf6030000, 0xfd0a0000, 0x02f60000, 0x10100000, 0xeff00000, 0x12050000, 0xedfb0000,
-        0x05120000, 0x00000707, 0x07070707, 0xf8f90707, 0x09fd0707, 0xf6030707, 0xfd0a0707, 0x02f60707,
-        0x10100707, 0xeff00707, 0x12050707, 0xedfb0707, 0x05120707, 0xfffff8f9, 0x0706f8f9, 0xf8f8f8f9,
-        0x09fcf8f9, 0xf602f8f9, 0xfd09f8f9, 0x02f5f8f9, 0x100ff8f9, 0xefeff8f9, 0x1204f8f9, 0xedfaf8f9,
-        0x0511f8f9, 0x000009fd, 0x070709fd, 0xf8f909fd, 0x09fd09fd, 0xf60309fd, 0xfd0a09fd, 0x02f609fd,
-        0x101009fd, 0xeff009fd, 0x120509fd, 0xedfb09fd, 0x051209fd, 0xfffff603, 0x0706f603, 0xf8f8f603,
-        0x09fcf603, 0xf602f603, 0xfd09f603, 0x02f5f603, 0x100ff603, 0xefeff603, 0x1204f603, 0xedfaf603,
-        0x0511f603, 0xfffffd0a, 0x0706fd0a, 0xf8f8fd0a, 0x09fcfd0a, 0xf602fd0a, 0xfd09fd0a, 0x02f5fd0a,
-        0x100ffd0a, 0xefeffd0a, 0x1204fd0a, 0xedfafd0a, 0x0511fd0a, 0x000002f6, 0x070702f6, 0xf8f902f6,
-        0x09fd02f6, 0xf60302f6, 0xfd0a02f6, 0x02f602f6, 0x101002f6, 0xeff002f6, 0x120502f6, 0xedfb02f6,
-        0x051202f6, 0x00001010, 0x07071010, 0xf8f91010, 0x09fd1010, 0xf6031010, 0xfd0a1010, 0x02f61010,
-        0x10101010, 0xeff01010, 0x12051010, 0xedfb1010, 0x05121010, 0xffffeff0, 0x0706eff0, 0xf8f8eff0,
-        0x09fceff0, 0xf602eff0, 0xfd09eff0, 0x02f5eff0, 0x100feff0, 0xefefeff0, 0x1204eff0, 0xedfaeff0,
-        0x0511eff0, 0x00001205, 0x07071205, 0xf8f91205, 0x09fd1205, 0xf6031205, 0xfd0a1205, 0x02f61205,
-        0x10101205, 0xeff01205, 0x12051205, 0xedfb1205, 0x05121205, 0xffffedfb, 0x0706edfb, 0xf8f8edfb,
-        0x09fcedfb, 0xf602edfb, 0xfd09edfb, 0x02f5edfb, 0x100fedfb, 0xefefedfb, 0x1204edfb, 0xedfaedfb,
-        0x0511edfb, 0x00000512, 0x07070512, 0xf8f90512, 0x09fd0512, 0xf6030512, 0xfd0a0512, 0x02f60512,
-        0x10100512, 0xeff00512, 0x12050512, 0xedfb0512, 0x05120512, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000808, 0xfffff7f8, 0x00000afd, 0xfffff503, 0xfffffd0b, 0x000002f5, 0x00001212,
-        0xffffedee, 0x00001405, 0xffffebfb, 0x00000514, 0xfffffaec, 0x00000ef1, 0xfffff10f, 0x000017f9,
-        0xffffe807, 0xfffff918, 0x000006e8, 0x00002311, 0xffffdcef, 0x00001123, 0xffffeedd, 0x00002222,
-        0xffffddde, 0x00002603, 0xffffd9fd, 0x00000326, 0xfffffcda, 0x00001fea, 0xffffe016, 0xffffea20,
-        0x000015e0, 0x00003d25, 0xffffc2db, 0x0000253d, 0xffffdac3, 0x00002ef3, 0xffffd10d, 0xfffff32f,
-        0x00000cd1, 0x00003f11, 0xffffc0ef, 0x0000113f, 0xffffeec1, 0x00004141, 0xffffbebf, 0x000047ff,
-        0xffffb801, 0xffffff48, 0x000000b8, 0x00002dd2, 0xffffd22e, 0x00003edd, 0xffffc123, 0xffffdd3f,
-        0x000022c1, 0x00006b2b, 0xffff94d5, 0x00002b6b, 0xffffd495, 0x00006e4b, 0xffff91b5, 0x00004b6e,
-        0xffffb492, 0x000058e8, 0xffffa718, 0xffffe859, 0x000017a7, 0x00007211, 0xffff8def, 0x00001172,
-        0xffffee8e, 0x00007979, 0xffff8687, 0x00005ab8, 0xffffa548, 0xffffb85b, 0x000047a5, 0x000077c6,
-        0xffff883a, 0xffffc678, 0x00003988, 0x00003131, 0xffffcecf, 0x00005c5c, 0xffffa3a4, 0x00000000,
-        0x08080000, 0xf7f80000, 0x0afd0000, 0xf5030000, 0xfd0b0000, 0x02f50000, 0x12120000, 0xedee0000,
-        0x14050000, 0xebfb0000, 0x05140000, 0x00000808, 0x08080808, 0xf7f80808, 0x0afd0808, 0xf5030808,
-        0xfd0b0808, 0x02f50808, 0x12120808, 0xedee0808, 0x14050808, 0xebfb0808, 0x05140808, 0xfffff7f8,
-        0x0807f7f8, 0xf7f7f7f8, 0x0afcf7f8, 0xf502f7f8, 0xfd0af7f8, 0x02f4f7f8, 0x1211f7f8, 0xededf7f8,
-        0x1404f7f8, 0xebfaf7f8, 0x0513f7f8, 0x00000afd, 0x08080afd, 0xf7f80afd, 0x0afd0afd, 0xf5030afd,
-        0xfd0b0afd, 0x02f50afd, 0x12120afd, 0xedee0afd, 0x14050afd, 0xebfb0afd, 0x05140afd, 0xfffff503,
-        0x0807f503, 0xf7f7f503, 0x0afcf503, 0xf502f503, 0xfd0af503, 0x02f4f503, 0x1211f503, 0xededf503,
-        0x1404f503, 0xebfaf503, 0x0513f503, 0xfffffd0b, 0x0807fd0b, 0xf7f7fd0b, 0x0afcfd0b, 0xf502fd0b,
-        0xfd0afd0b, 0x02f4fd0b, 0x1211fd0b, 0xededfd0b, 0x1404fd0b, 0xebfafd0b, 0x0513fd0b, 0x000002f5,
-        0x080802f5, 0xf7f802f5, 0x0afd02f5, 0xf50302f5, 0xfd0b02f5, 0x02f502f5, 0x121202f5, 0xedee02f5,
-        0x140502f5, 0xebfb02f5, 0x051402f5, 0x00001212, 0x08081212, 0xf7f81212, 0x0afd1212, 0xf5031212,
-        0xfd0b1212, 0x02f51212, 0x12121212, 0xedee1212, 0x14051212, 0xebfb1212, 0x05141212, 0xffffedee,
-        0x0807edee, 0xf7f7edee, 0x0afcedee, 0xf502edee, 0xfd0aedee, 0x02f4edee, 0x1211edee, 0xedededee,
-        0x1404edee, 0xebfaedee, 0x0513edee, 0x00001405, 0x08081405, 0xf7f81405, 0x0afd1405, 0xf5031405,
-        0xfd0b1405, 0x02f51405, 0x12121405, 0xedee1405, 0x14051405, 0xebfb1405, 0x05141405, 0xffffebfb,
-        0x0807ebfb, 0xf7f7ebfb, 0x0afcebfb, 0xf502ebfb, 0xfd0aebfb, 0x02f4ebfb, 0x1211ebfb, 0xededebfb,
-        0x1404ebfb, 0xebfaebfb, 0x0513ebfb, 0x00000514, 0x08080514, 0xf7f80514, 0x0afd0514, 0xf5030514,
-        0xfd0b0514, 0x02f50514, 0x12120514, 0xedee0514, 0x14050514, 0xebfb0514, 0x05140514, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000909, 0xfffff6f7, 0x00000bfd, 0xfffff403, 0xfffffd0c, 0x000002f4, 0x00001414,
-        0xffffebec, 0x00001706, 0xffffe8fa, 0x00000617, 0xfffff9e9, 0x000010ef, 0xffffef11, 0x00001af9,
-        0xffffe507, 0xfffff91b, 0x000006e5, 0x00002713, 0xffffd8ed, 0x00001327, 0xffffecd9, 0x00002727,
-        0xffffd8d9, 0x00002b03, 0xffffd4fd, 0x0000032b, 0xfffffcd5, 0x000023e8, 0xffffdc18, 0xffffe824,
-        0x000017dc, 0x0000452a, 0xffffbad6, 0x00002a45, 0xffffd5bb, 0x000034f2, 0xffffcb0e, 0xfffff235,
-        0x00000dcb, 0x00004713, 0xffffb8ed, 0x00001347, 0xffffecb9, 0x00004949, 0xffffb6b7, 0x00004ffe,
-        0xffffb002, 0xfffffe50, 0x000001b0, 0x000033cc, 0xffffcc34, 0x000045d9, 0xffffba27, 0xffffd946,
-        0x000026ba, 0x00007930, 0xffff86d0, 0x00003079, 0xffffcf87, 0x00007c54, 0xffff83ac, 0x0000547c,
-        0xffffab84, 0x000063e5, 0xffff9c1b, 0xffffe564, 0x00001a9c, 0x000065af, 0xffff9a51, 0xffffaf66,
-        0x0000509a, 0x00003737, 0xffffc8c9, 0x00006868, 0xffff9798, 0x00000000, 0x09090000, 0xf6f70000,
-        0x0bfd0000, 0xf4030000, 0xfd0c0000, 0x02f40000, 0x14140000, 0xebec0000, 0x17060000, 0xe8fa0000,
-        0x06170000, 0xf9e90000, 0x00000909, 0x09090909, 0xf6f70909, 0x0bfd0909, 0xf4030909, 0xfd0c0909,
-        0x02f40909, 0x14140909, 0xebec0909, 0x17060909, 0xe8fa0909, 0x06170909, 0xf9e90909, 0xfffff6f7,
-        0x0908f6f7, 0xf6f6f6f7, 0x0bfcf6f7, 0xf402f6f7, 0xfd0bf6f7, 0x02f3f6f7, 0x1413f6f7, 0xebebf6f7,
-        0x1705f6f7, 0xe8f9f6f7, 0x0616f6f7, 0xf9e8f6f7, 0x00000bfd, 0x09090bfd, 0xf6f70bfd, 0x0bfd0bfd,
-        0xf4030bfd, 0xfd0c0bfd, 0x02f40bfd, 0x14140bfd, 0xebec0bfd, 0x17060bfd, 0xe8fa0bfd, 0x06170bfd,
-        0xf9e90bfd, 0xfffff403, 0x0908f403, 0xf6f6f403, 0x0bfcf403, 0xf402f403, 0xfd0bf403, 0x02f3f403,
-        0x1413f403, 0xebebf403, 0x1705f403, 0xe8f9f403, 0x0616f403, 0xf9e8f403, 0xfffffd0c, 0x0908fd0c,
-        0xf6f6fd0c, 0x0bfcfd0c, 0xf402fd0c, 0xfd0bfd0c, 0x02f3fd0c, 0x1413fd0c, 0xebebfd0c, 0x1705fd0c,
-        0xe8f9fd0c, 0x0616fd0c, 0xf9e8fd0c, 0x000002f4, 0x090902f4, 0xf6f702f4, 0x0bfd02f4, 0xf40302f4,
-        0xfd0c02f4, 0x02f402f4, 0x141402f4, 0xebec02f4, 0x170602f4, 0xe8fa02f4, 0x061702f4, 0xf9e902f4,
-        0x00001414, 0x09091414, 0xf6f71414, 0x0bfd1414, 0xf4031414, 0xfd0c1414, 0x02f41414, 0x14141414,
-        0xebec1414, 0x17061414, 0xe8fa1414, 0x06171414, 0xf9e91414, 0xffffebec, 0x0908ebec, 0xf6f6ebec,
-        0x0bfcebec, 0xf402ebec, 0xfd0bebec, 0x02f3ebec, 0x1413ebec, 0xebebebec, 0x1705ebec, 0xe8f9ebec,
-        0x0616ebec, 0xf9e8ebec, 0x00001706, 0x09091706, 0xf6f71706, 0x0bfd1706, 0xf4031706, 0xfd0c1706,
-        0x02f41706, 0x14141706, 0xebec1706, 0x17061706, 0xe8fa1706, 0x06171706, 0xf9e91706, 0xffffe8fa,
-        0x0908e8fa, 0xf6f6e8fa, 0x0bfce8fa, 0xf402e8fa, 0xfd0be8fa, 0x02f3e8fa, 0x1413e8fa, 0xebebe8fa,
-        0x1705e8fa, 0xe8f9e8fa, 0x0616e8fa, 0xf9e8e8fa, 0x00000617, 0x09090617, 0xf6f70617, 0x0bfd0617,
-        0xf4030617, 0xfd0c0617, 0x02f40617, 0x14140617, 0xebec0617, 0x17060617, 0xe8fa0617, 0x06170617,
-        0xf9e90617, 0xfffff9e9, 0x0908f9e9, 0xf6f6f9e9, 0x0bfcf9e9, 0xf402f9e9, 0xfd0bf9e9, 0x02f3f9e9,
-        0x1413f9e9, 0xebebf9e9, 0x1705f9e9, 0xe8f9f9e9, 0x0616f9e9, 0xf9e8f9e9, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000202, 0xfffffdfe, 0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe, 0x00000404,
-        0xfffffbfc, 0x00000400, 0xfffffc00, 0x00000004, 0xfffffffc, 0x000003fc, 0xfffffc04, 0x000005fe,
-        0xfffffa02, 0xfffffe06, 0x000001fa, 0x00000804, 0xfffff7fc, 0x00000408, 0xfffffbf8, 0x00000808,
-        0xfffff7f8, 0x00000a00, 0xfffff600, 0x0000000a, 0xfffffff6, 0x000007fc, 0xfffff804, 0xfffffc08,
-        0x000003f8, 0x00000e08, 0xfffff1f8, 0x0000080e, 0xfffff7f2, 0x00000bfe, 0xfffff402, 0xfffffe0c,
-        0x000001f4, 0x00001004, 0xffffeffc, 0x00000410, 0xfffffbf0, 0x00001010, 0xffffeff0, 0x00001200,
-        0xffffee00, 0x00000012, 0xffffffee, 0x00000bf4, 0xfffff40c, 0x00000ff8, 0xfffff008, 0xfffff810,
-        0x000007f0, 0x00001a0a, 0xffffe5f6, 0x00000a1a, 0xfffff5e6, 0x00001c12, 0xffffe3ee, 0x0000121c,
-        0xffffede4, 0x000015fa, 0xffffea06, 0xfffffa16, 0x000005ea, 0x00001c04, 0xffffe3fc, 0x0000041c,
-        0xfffffbe4, 0x00001e1e, 0xffffe1e2, 0x00001ffe, 0xffffe002, 0xfffffe20, 0x000001e0, 0x000015ee,
-        0xffffea12, 0xffffee16, 0x000011ea, 0x00001df2, 0xffffe20e, 0xfffff21e, 0x00000de2, 0x00002e16,
-        0xffffd1ea, 0x0000162e, 0xffffe9d2, 0x00002e0c, 0xffffd1f4, 0x00000c2e, 0xfffff3d2, 0x00003022,
-        0xffffcfde, 0x00002230, 0xffffddd0, 0x000027f6, 0xffffd80a, 0xfffff628, 0x000009d8, 0x00003204,
-        0xffffcdfc, 0x00000432, 0xfffffbce, 0x00003636, 0xffffc9ca, 0x000021de, 0xffffde22, 0x000029e4,
-        0xffffd61c, 0xffffe42a, 0x00001bd6, 0x00003bfa, 0xffffc406, 0xfffffa3c, 0x000005c4, 0x00004c1a,
-        0xffffb3e6, 0x00001a4c, 0xffffe5b4, 0x00004c2a, 0xffffb3d6, 0x00002a4c, 0xffffd5b4, 0x000035e8,
-        0xffffca18, 0xffffe836, 0x000017ca, 0x00004e0e, 0xffffb1f2, 0x00000e4e, 0xfffff1b2, 0x0000523e,
-        0xffffadc2, 0x00003e52, 0xffffc1ae, 0x000049ec, 0xffffb614, 0xffffec4a, 0x000013b6, 0x00005802,
-        0xffffa7fe, 0x00000258, 0xfffffda8, 0x00005c5c, 0xffffa3a4, 0x00003bcc, 0xffffc434, 0xffffcc3c,
-        0x000033c4, 0x00007634, 0xffff89cc, 0x00003476, 0xffffcb8a, 0x000049d4, 0xffffb62c, 0xffffd44a,
-        0x00002bb6, 0x0000764a, 0xffff89b6, 0x00004a76, 0xffffb58a, 0x00007620, 0xffff89e0, 0x00002076,
-        0xffffdf8a, 0x000065f4, 0xffff9a0c, 0xfffff466, 0x00000b9a, 0x00005fd8, 0xffffa028, 0xffffd860,
-        0x000027a0, 0x000075de, 0xffff8a22, 0xffffde76, 0x0000218a, 0x000057a8, 0xffffa858, 0x000067b2,
-        0xffff984e, 0xffffb268, 0x00004d98, 0x00000c0c, 0xfffff3f4, 0x00001616, 0xffffe9ea, 0x00002a2a,
-        0xffffd5d6, 0x00004848, 0xffffb7b8, 0x00000000, 0x02020000, 0xfdfe0000, 0x02000000, 0xfe000000,
-        0x00020000, 0xfffe0000, 0x00000202, 0x02020202, 0xfdfe0202, 0x02000202, 0xfe000202, 0x00020202,
-        0xfffe0202, 0xfffffdfe, 0x0201fdfe, 0xfdfdfdfe, 0x01fffdfe, 0xfdfffdfe, 0x0001fdfe, 0xfffdfdfe,
-        0x00000200, 0x02020200, 0xfdfe0200, 0x02000200, 0xfe000200, 0x00020200, 0xfffe0200, 0xfffffe00,
-        0x0201fe00, 0xfdfdfe00, 0x01fffe00, 0xfdfffe00, 0x0001fe00, 0xfffdfe00, 0x00000002, 0x02020002,
-        0xfdfe0002, 0x02000002, 0xfe000002, 0x00020002, 0xfffe0002, 0xfffffffe, 0x0201fffe, 0xfdfdfffe,
-        0x01fffffe, 0xfdfffffe, 0x0001fffe, 0xfffdfffe, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000303, 0xfffffcfd, 0x00000300, 0xfffffd00, 0x00000003, 0xfffffffd, 0x00000606,
-        0xfffff9fa, 0x00000903, 0xfffff6fd, 0x00000309, 0xfffffcf7, 0x000008fd, 0xfffff703, 0xfffffd09,
-        0x000002f7, 0x000005fa, 0xfffffa06, 0x00000c06, 0xfffff3fa, 0x0000060c, 0xfffff9f4, 0x00000c0c,
-        0xfffff3f4, 0x00000f00, 0xfffff100, 0x0000000f, 0xfffffff1, 0x00000bf7, 0xfffff409, 0xfffff70c,
-        0x000008f4, 0x0000180f, 0xffffe7f1, 0x00000f18, 0xfffff0e8, 0x000011fa, 0xffffee06, 0xfffffa12,
-        0x000005ee, 0x00001806, 0xffffe7fa, 0x00000618, 0xfffff9e8, 0x00001818, 0xffffe7e8, 0x00001b00,
-        0xffffe500, 0x0000001b, 0xffffffe5, 0x000011ee, 0xffffee12, 0x000017f4, 0xffffe80c, 0xfffff418,
-        0x00000be8, 0x0000270f, 0xffffd8f1, 0x00000f27, 0xfffff0d9, 0x00002a1b, 0xffffd5e5, 0x00001b2a,
-        0xffffe4d6, 0x000020f7, 0xffffdf09, 0xfffff721, 0x000008df, 0x00002a06, 0xffffd5fa, 0x0000062a,
-        0xfffff9d6, 0x00002d2d, 0xffffd2d3, 0x000032fd, 0xffffcd03, 0xfffffd33, 0x000002cd, 0x000020e5,
-        0xffffdf1b, 0xffffe521, 0x00001adf, 0x00002ceb, 0xffffd315, 0xffffeb2d, 0x000014d3, 0x00004521,
-        0xffffbadf, 0x00002145, 0xffffdebb, 0x00004512, 0xffffbaee, 0x00001245, 0xffffedbb, 0x00004836,
-        0xffffb7ca, 0x00003648, 0xffffc9b8, 0x00003eee, 0xffffc112, 0xffffee3f, 0x000011c1, 0x00004e06,
-        0xffffb1fa, 0x0000064e, 0xfffff9b2, 0x00005151, 0xffffaeaf, 0x000032cd, 0xffffcd33, 0x00003ed6,
-        0xffffc12a, 0xffffd63f, 0x000029c1, 0x000059f7, 0xffffa609, 0xfffff75a, 0x000008a6, 0x0000722a,
-        0xffff8dd6, 0x00002a72, 0xffffd58e, 0x0000753f, 0xffff8ac1, 0x00003f75, 0xffffc08b, 0x000050dc,
-        0xffffaf24, 0xffffdc51, 0x000023af, 0x00007815, 0xffff87eb, 0x00001578, 0xffffea88, 0x00007b60,
-        0xffff84a0, 0x0000607b, 0xffff9f85, 0x00006ee2, 0xffff911e, 0xffffe26f, 0x00001d91, 0x00005cb2,
-        0xffffa34e, 0xffffb25d, 0x00004da3, 0x000071bb, 0xffff8e45, 0xffffbb72, 0x0000448e, 0x00001212,
-        0xffffedee, 0x00002121, 0xffffdedf, 0x00003f3f, 0xffffc0c1, 0x00006c6c, 0xffff9394, 0x00000000,
-        0x03030000, 0xfcfd0000, 0x03000000, 0xfd000000, 0x00030000, 0xfffd0000, 0x06060000, 0xf9fa0000,
-        0x00000303, 0x03030303, 0xfcfd0303, 0x03000303, 0xfd000303, 0x00030303, 0xfffd0303, 0x06060303,
-        0xf9fa0303, 0xfffffcfd, 0x0302fcfd, 0xfcfcfcfd, 0x02fffcfd, 0xfcfffcfd, 0x0002fcfd, 0xfffcfcfd,
-        0x0605fcfd, 0xf9f9fcfd, 0x00000300, 0x03030300, 0xfcfd0300, 0x03000300, 0xfd000300, 0x00030300,
-        0xfffd0300, 0x06060300, 0xf9fa0300, 0xfffffd00, 0x0302fd00, 0xfcfcfd00, 0x02fffd00, 0xfcfffd00,
-        0x0002fd00, 0xfffcfd00, 0x0605fd00, 0xf9f9fd00, 0x00000003, 0x03030003, 0xfcfd0003, 0x03000003,
-        0xfd000003, 0x00030003, 0xfffd0003, 0x06060003, 0xf9fa0003, 0xfffffffd, 0x0302fffd, 0xfcfcfffd,
-        0x02fffffd, 0xfcfffffd, 0x0002fffd, 0xfffcfffd, 0x0605fffd, 0xf9f9fffd, 0x00000606, 0x03030606,
-        0xfcfd0606, 0x03000606, 0xfd000606, 0x00030606, 0xfffd0606, 0x06060606, 0xf9fa0606, 0xfffff9fa,
-        0x0302f9fa, 0xfcfcf9fa, 0x02fff9fa, 0xfcfff9fa, 0x0002f9fa, 0xfffcf9fa, 0x0605f9fa, 0xf9f9f9fa,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000404, 0xfffffbfc, 0x00000400, 0xfffffc00, 0x00000004, 0xfffffffc, 0x00000804,
-        0xfffff7fc, 0x00000408, 0xfffffbf8, 0x00000808, 0xfffff7f8, 0x000007f8, 0xfffff808, 0x00000bfc,
-        0xfffff404, 0xfffffc0c, 0x000003f4, 0x00001008, 0xffffeff8, 0x00000810, 0xfffff7f0, 0x00001010,
-        0xffffeff0, 0x00001400, 0xffffec00, 0x00000014, 0xffffffec, 0x00000ff4, 0xfffff00c, 0xfffff410,
-        0x00000bf0, 0x000017fc, 0xffffe804, 0xfffffc18, 0x000003e8, 0x00002010, 0xffffdff0, 0x00001020,
-        0xffffefe0, 0x00002008, 0xffffdff8, 0x00000820, 0xfffff7e0, 0x00002020, 0xffffdfe0, 0x00002400,
-        0xffffdc00, 0x00000024, 0xffffffdc, 0x000017e8, 0xffffe818, 0x00001ff0, 0xffffe010, 0xfffff020,
-        0x00000fe0, 0x00003414, 0xffffcbec, 0x00001434, 0xffffebcc, 0x00003824, 0xffffc7dc, 0x00002438,
-        0xffffdbc8, 0x00002bf4, 0xffffd40c, 0xfffff42c, 0x00000bd4, 0x00003808, 0xffffc7f8, 0x00000838,
-        0xfffff7c8, 0x00003c3c, 0xffffc3c4, 0x00003ffc, 0xffffc004, 0xfffffc40, 0x000003c0, 0x00002bdc,
-        0xffffd424, 0xffffdc2c, 0x000023d4, 0x00003be4, 0xffffc41c, 0xffffe43c, 0x00001bc4, 0x00005c2c,
-        0xffffa3d4, 0x00002c5c, 0xffffd3a4, 0x00005c18, 0xffffa3e8, 0x0000185c, 0xffffe7a4, 0x00006048,
-        0xffff9fb8, 0x00004860, 0xffffb7a0, 0x000053ec, 0xffffac14, 0xffffec54, 0x000013ac, 0x00006408,
-        0xffff9bf8, 0x00000864, 0xfffff79c, 0x00006c6c, 0xffff9394, 0x000043bc, 0xffffbc44, 0x000053c8,
-        0xffffac38, 0xffffc854, 0x000037ac, 0x000077f4, 0xffff880c, 0xfffff478, 0x00000b88, 0x00006bd0,
-        0xffff9430, 0xffffd06c, 0x00002f94, 0x00007b98, 0xffff8468, 0xffff987c, 0x00006784, 0x00001818,
-        0xffffe7e8, 0x00002c2c, 0xffffd3d4, 0x00005454, 0xffffabac, 0x00000000, 0x04040000, 0xfbfc0000,
-        0x04000000, 0xfc000000, 0x00040000, 0xfffc0000, 0x08040000, 0xf7fc0000, 0x04080000, 0x00000404,
-        0x04040404, 0xfbfc0404, 0x04000404, 0xfc000404, 0x00040404, 0xfffc0404, 0x08040404, 0xf7fc0404,
-        0x04080404, 0xfffffbfc, 0x0403fbfc, 0xfbfbfbfc, 0x03fffbfc, 0xfbfffbfc, 0x0003fbfc, 0xfffbfbfc,
-        0x0803fbfc, 0xf7fbfbfc, 0x0407fbfc, 0x00000400, 0x04040400, 0xfbfc0400, 0x04000400, 0xfc000400,
-        0x00040400, 0xfffc0400, 0x08040400, 0xf7fc0400, 0x04080400, 0xfffffc00, 0x0403fc00, 0xfbfbfc00,
-        0x03fffc00, 0xfbfffc00, 0x0003fc00, 0xfffbfc00, 0x0803fc00, 0xf7fbfc00, 0x0407fc00, 0x00000004,
-        0x04040004, 0xfbfc0004, 0x04000004, 0xfc000004, 0x00040004, 0xfffc0004, 0x08040004, 0xf7fc0004,
-        0x04080004, 0xfffffffc, 0x0403fffc, 0xfbfbfffc, 0x03fffffc, 0xfbfffffc, 0x0003fffc, 0xfffbfffc,
-        0x0803fffc, 0xf7fbfffc, 0x0407fffc, 0x00000804, 0x04040804, 0xfbfc0804, 0x04000804, 0xfc000804,
-        0x00040804, 0xfffc0804, 0x08040804, 0xf7fc0804, 0x04080804, 0xfffff7fc, 0x0403f7fc, 0xfbfbf7fc,
-        0x03fff7fc, 0xfbfff7fc, 0x0003f7fc, 0xfffbf7fc, 0x0803f7fc, 0xf7fbf7fc, 0x0407f7fc, 0x00000408,
-        0x04040408, 0xfbfc0408, 0x04000408, 0xfc000408, 0x00040408, 0xfffc0408, 0x08040408, 0xf7fc0408,
-        0x04080408, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000505, 0xfffffafb, 0x00000500, 0xfffffb00, 0x00000005, 0xfffffffb, 0x00000a0a,
-        0xfffff5f6, 0x00000f05, 0xfffff0fb, 0x0000050f, 0xfffffaf1, 0x000009f6, 0xfffff60a, 0x00000efb,
-        0xfffff105, 0xfffffb0f, 0x000004f1, 0x0000140a, 0xffffebf6, 0x00000a14, 0xfffff5ec, 0x00001414,
-        0xffffebec, 0x00001900, 0xffffe700, 0x00000019, 0xffffffe7, 0x000013f1, 0xffffec0f, 0xfffff114,
-        0x00000eec, 0x00002819, 0xffffd7e7, 0x00001928, 0xffffe6d8, 0x00001df6, 0xffffe20a, 0xfffff61e,
-        0x000009e2, 0x0000280a, 0xffffd7f6, 0x00000a28, 0xfffff5d8, 0x00002828, 0xffffd7d8, 0x00002d00,
-        0xffffd300, 0x0000002d, 0xffffffd3, 0x00001de2, 0xffffe21e, 0x000027ec, 0xffffd814, 0xffffec28,
-        0x000013d8, 0x00004119, 0xffffbee7, 0x00001941, 0xffffe6bf, 0x0000462d, 0xffffb9d3, 0x00002d46,
-        0xffffd2ba, 0x000036f1, 0xffffc90f, 0xfffff137, 0x00000ec9, 0x0000460a, 0xffffb9f6, 0x00000a46,
-        0xfffff5ba, 0x00004b4b, 0xffffb4b5, 0x000054fb, 0xffffab05, 0xfffffb55, 0x000004ab, 0x000036d3,
-        0xffffc92d, 0xffffd337, 0x00002cc9, 0x00004add, 0xffffb523, 0xffffdd4b, 0x000022b5, 0x00007337,
-        0xffff8cc9, 0x00003773, 0xffffc88d, 0x0000731e, 0xffff8ce2, 0x00001e73, 0xffffe18d, 0x0000785a,
-        0xffff87a6, 0x00005a78, 0xffffa588, 0x000068e2, 0xffff971e, 0xffffe269, 0x00001d97, 0x000054ab,
-        0xffffab55, 0x000068ba, 0xffff9746, 0xffffba69, 0x00004597, 0x00001e1e, 0xffffe1e2, 0x00003c3c,
-        0xffffc3c4, 0x00006969, 0xffff9697, 0x00000000, 0x05050000, 0xfafb0000, 0x05000000, 0xfb000000,
-        0x00050000, 0xfffb0000, 0x0a0a0000, 0xf5f60000, 0x0f050000, 0xf0fb0000, 0x00000505, 0x05050505,
-        0xfafb0505, 0x05000505, 0xfb000505, 0x00050505, 0xfffb0505, 0x0a0a0505, 0xf5f60505, 0x0f050505,
-        0xf0fb0505, 0xfffffafb, 0x0504fafb, 0xfafafafb, 0x04fffafb, 0xfafffafb, 0x0004fafb, 0xfffafafb,
-        0x0a09fafb, 0xf5f5fafb, 0x0f04fafb, 0xf0fafafb, 0x00000500, 0x05050500, 0xfafb0500, 0x05000500,
-        0xfb000500, 0x00050500, 0xfffb0500, 0x0a0a0500, 0xf5f60500, 0x0f050500, 0xf0fb0500, 0xfffffb00,
-        0x0504fb00, 0xfafafb00, 0x04fffb00, 0xfafffb00, 0x0004fb00, 0xfffafb00, 0x0a09fb00, 0xf5f5fb00,
-        0x0f04fb00, 0xf0fafb00, 0x00000005, 0x05050005, 0xfafb0005, 0x05000005, 0xfb000005, 0x00050005,
-        0xfffb0005, 0x0a0a0005, 0xf5f60005, 0x0f050005, 0xf0fb0005, 0xfffffffb, 0x0504fffb, 0xfafafffb,
-        0x04fffffb, 0xfafffffb, 0x0004fffb, 0xfffafffb, 0x0a09fffb, 0xf5f5fffb, 0x0f04fffb, 0xf0fafffb,
-        0x00000a0a, 0x05050a0a, 0xfafb0a0a, 0x05000a0a, 0xfb000a0a, 0x00050a0a, 0xfffb0a0a, 0x0a0a0a0a,
-        0xf5f60a0a, 0x0f050a0a, 0xf0fb0a0a, 0xfffff5f6, 0x0504f5f6, 0xfafaf5f6, 0x04fff5f6, 0xfafff5f6,
-        0x0004f5f6, 0xfffaf5f6, 0x0a09f5f6, 0xf5f5f5f6, 0x0f04f5f6, 0xf0faf5f6, 0x00000f05, 0x05050f05,
-        0xfafb0f05, 0x05000f05, 0xfb000f05, 0x00050f05, 0xfffb0f05, 0x0a0a0f05, 0xf5f60f05, 0x0f050f05,
-        0xf0fb0f05, 0xfffff0fb, 0x0504f0fb, 0xfafaf0fb, 0x04fff0fb, 0xfafff0fb, 0x0004f0fb, 0xfffaf0fb,
-        0x0a09f0fb, 0xf5f5f0fb, 0x0f04f0fb, 0xf0faf0fb, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000606, 0xfffff9fa, 0x00000600, 0xfffffa00, 0x00000006, 0xfffffffa, 0x00000c0c,
-        0xfffff3f4, 0x00000c06, 0xfffff3fa, 0x0000060c, 0xfffff9f4, 0x00000bf4, 0xfffff40c, 0x000011fa,
-        0xffffee06, 0xfffffa12, 0x000005ee, 0x0000180c, 0xffffe7f4, 0x00000c18, 0xfffff3e8, 0x00001818,
-        0xffffe7e8, 0x00001e00, 0xffffe200, 0x0000001e, 0xffffffe2, 0x000017ee, 0xffffe812, 0xffffee18,
-        0x000011e8, 0x0000301e, 0xffffcfe2, 0x00001e30, 0xffffe1d0, 0x000023fa, 0xffffdc06, 0xfffffa24,
-        0x000005dc, 0x0000300c, 0xffffcff4, 0x00000c30, 0xfffff3d0, 0x00003030, 0xffffcfd0, 0x00003600,
-        0xffffca00, 0x00000036, 0xffffffca, 0x000023dc, 0xffffdc24, 0x00002fe8, 0xffffd018, 0xffffe830,
-        0x000017d0, 0x00004e1e, 0xffffb1e2, 0x00001e4e, 0xffffe1b2, 0x00005436, 0xffffabca, 0x00003654,
-        0xffffc9ac, 0x000041ee, 0xffffbe12, 0xffffee42, 0x000011be, 0x0000540c, 0xffffabf4, 0x00000c54,
-        0xfffff3ac, 0x00005a5a, 0xffffa5a6, 0x00005ffa, 0xffffa006, 0xfffffa60, 0x000005a0, 0x000041ca,
-        0xffffbe36, 0xffffca42, 0x000035be, 0x000059d6, 0xffffa62a, 0xffffd65a, 0x000029a6, 0x00007de2,
-        0xffff821e, 0xffffe27e, 0x00001d82, 0x0000659a, 0xffff9a66, 0x00007dac, 0xffff8254, 0xffffac7e,
-        0x00005382, 0x00002424, 0xffffdbdc, 0x00004242, 0xffffbdbe, 0x00000000, 0x06060000, 0xf9fa0000,
-        0x06000000, 0xfa000000, 0x00060000, 0xfffa0000, 0x0c0c0000, 0xf3f40000, 0x0c060000, 0xf3fa0000,
-        0x060c0000, 0x00000606, 0x06060606, 0xf9fa0606, 0x06000606, 0xfa000606, 0x00060606, 0xfffa0606,
-        0x0c0c0606, 0xf3f40606, 0x0c060606, 0xf3fa0606, 0x060c0606, 0xfffff9fa, 0x0605f9fa, 0xf9f9f9fa,
-        0x05fff9fa, 0xf9fff9fa, 0x0005f9fa, 0xfff9f9fa, 0x0c0bf9fa, 0xf3f3f9fa, 0x0c05f9fa, 0xf3f9f9fa,
-        0x060bf9fa, 0x00000600, 0x06060600, 0xf9fa0600, 0x06000600, 0xfa000600, 0x00060600, 0xfffa0600,
-        0x0c0c0600, 0xf3f40600, 0x0c060600, 0xf3fa0600, 0x060c0600, 0xfffffa00, 0x0605fa00, 0xf9f9fa00,
-        0x05fffa00, 0xf9fffa00, 0x0005fa00, 0xfff9fa00, 0x0c0bfa00, 0xf3f3fa00, 0x0c05fa00, 0xf3f9fa00,
-        0x060bfa00, 0x00000006, 0x06060006, 0xf9fa0006, 0x06000006, 0xfa000006, 0x00060006, 0xfffa0006,
-        0x0c0c0006, 0xf3f40006, 0x0c060006, 0xf3fa0006, 0x060c0006, 0xfffffffa, 0x0605fffa, 0xf9f9fffa,
-        0x05fffffa, 0xf9fffffa, 0x0005fffa, 0xfff9fffa, 0x0c0bfffa, 0xf3f3fffa, 0x0c05fffa, 0xf3f9fffa,
-        0x060bfffa, 0x00000c0c, 0x06060c0c, 0xf9fa0c0c, 0x06000c0c, 0xfa000c0c, 0x00060c0c, 0xfffa0c0c,
-        0x0c0c0c0c, 0xf3f40c0c, 0x0c060c0c, 0xf3fa0c0c, 0x060c0c0c, 0xfffff3f4, 0x0605f3f4, 0xf9f9f3f4,
-        0x05fff3f4, 0xf9fff3f4, 0x0005f3f4, 0xfff9f3f4, 0x0c0bf3f4, 0xf3f3f3f4, 0x0c05f3f4, 0xf3f9f3f4,
-        0x060bf3f4, 0x00000c06, 0x06060c06, 0xf9fa0c06, 0x06000c06, 0xfa000c06, 0x00060c06, 0xfffa0c06,
-        0x0c0c0c06, 0xf3f40c06, 0x0c060c06, 0xf3fa0c06, 0x060c0c06, 0xfffff3fa, 0x0605f3fa, 0xf9f9f3fa,
-        0x05fff3fa, 0xf9fff3fa, 0x0005f3fa, 0xfff9f3fa, 0x0c0bf3fa, 0xf3f3f3fa, 0x0c05f3fa, 0xf3f9f3fa,
-        0x060bf3fa, 0x0000060c, 0x0606060c, 0xf9fa060c, 0x0600060c, 0xfa00060c, 0x0006060c, 0xfffa060c,
-        0x0c0c060c, 0xf3f4060c, 0x0c06060c, 0xf3fa060c, 0x060c060c, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000707, 0xfffff8f9, 0x00000700, 0xfffff900, 0x00000007, 0xfffffff9, 0x00000e0e,
-        0xfffff1f2, 0x00001507, 0xffffeaf9, 0x00000715, 0xfffff8eb, 0x00000df2, 0xfffff20e, 0x000014f9,
-        0xffffeb07, 0xfffff915, 0x000006eb, 0x00001c0e, 0xffffe3f2, 0x00000e1c, 0xfffff1e4, 0x00001c1c,
-        0xffffe3e4, 0x00002300, 0xffffdd00, 0x00000023, 0xffffffdd, 0x00001beb, 0xffffe415, 0xffffeb1c,
-        0x000014e4, 0x00003823, 0xffffc7dd, 0x00002338, 0xffffdcc8, 0x000029f2, 0xffffd60e, 0xfffff22a,
-        0x00000dd6, 0x0000380e, 0xffffc7f2, 0x00000e38, 0xfffff1c8, 0x00003838, 0xffffc7c8, 0x00003f00,
-        0xffffc100, 0x0000003f, 0xffffffc1, 0x000029d6, 0xffffd62a, 0x000037e4, 0xffffc81c, 0xffffe438,
-        0x00001bc8, 0x00005b23, 0xffffa4dd, 0x0000235b, 0xffffdca5, 0x0000623f, 0xffff9dc1, 0x00003f62,
-        0xffffc09e, 0x00004ceb, 0xffffb315, 0xffffeb4d, 0x000014b3, 0x0000620e, 0xffff9df2, 0x00000e62,
-        0xfffff19e, 0x00006969, 0xffff9697, 0x000076f9, 0xffff8907, 0xfffff977, 0x00000689, 0x00004cc1,
-        0xffffb33f, 0xffffc14d, 0x00003eb3, 0x000068cf, 0xffff9731, 0xffffcf69, 0x00003097, 0x00007689,
-        0xffff8977, 0x00002a2a, 0xffffd5d6, 0x00004d4d, 0xffffb2b3, 0x00000000, 0x07070000, 0xf8f90000,
-        0x07000000, 0xf9000000, 0x00070000, 0xfff90000, 0x0e0e0000, 0xf1f20000, 0x15070000, 0xeaf90000,
-        0x07150000, 0x00000707, 0x07070707, 0xf8f90707, 0x07000707, 0xf9000707, 0x00070707, 0xfff90707,
-        0x0e0e0707, 0xf1f20707, 0x15070707, 0xeaf90707, 0x07150707, 0xfffff8f9, 0x0706f8f9, 0xf8f8f8f9,
-        0x06fff8f9, 0xf8fff8f9, 0x0006f8f9, 0xfff8f8f9, 0x0e0df8f9, 0xf1f1f8f9, 0x1506f8f9, 0xeaf8f8f9,
-        0x0714f8f9, 0x00000700, 0x07070700, 0xf8f90700, 0x07000700, 0xf9000700, 0x00070700, 0xfff90700,
-        0x0e0e0700, 0xf1f20700, 0x15070700, 0xeaf90700, 0x07150700, 0xfffff900, 0x0706f900, 0xf8f8f900,
-        0x06fff900, 0xf8fff900, 0x0006f900, 0xfff8f900, 0x0e0df900, 0xf1f1f900, 0x1506f900, 0xeaf8f900,
-        0x0714f900, 0x00000007, 0x07070007, 0xf8f90007, 0x07000007, 0xf9000007, 0x00070007, 0xfff90007,
-        0x0e0e0007, 0xf1f20007, 0x15070007, 0xeaf90007, 0x07150007, 0xfffffff9, 0x0706fff9, 0xf8f8fff9,
-        0x06fffff9, 0xf8fffff9, 0x0006fff9, 0xfff8fff9, 0x0e0dfff9, 0xf1f1fff9, 0x1506fff9, 0xeaf8fff9,
-        0x0714fff9, 0x00000e0e, 0x07070e0e, 0xf8f90e0e, 0x07000e0e, 0xf9000e0e, 0x00070e0e, 0xfff90e0e,
-        0x0e0e0e0e, 0xf1f20e0e, 0x15070e0e, 0xeaf90e0e, 0x07150e0e, 0xfffff1f2, 0x0706f1f2, 0xf8f8f1f2,
-        0x06fff1f2, 0xf8fff1f2, 0x0006f1f2, 0xfff8f1f2, 0x0e0df1f2, 0xf1f1f1f2, 0x1506f1f2, 0xeaf8f1f2,
-        0x0714f1f2, 0x00001507, 0x07071507, 0xf8f91507, 0x07001507, 0xf9001507, 0x00071507, 0xfff91507,
-        0x0e0e1507, 0xf1f21507, 0x15071507, 0xeaf91507, 0x07151507, 0xffffeaf9, 0x0706eaf9, 0xf8f8eaf9,
-        0x06ffeaf9, 0xf8ffeaf9, 0x0006eaf9, 0xfff8eaf9, 0x0e0deaf9, 0xf1f1eaf9, 0x1506eaf9, 0xeaf8eaf9,
-        0x0714eaf9, 0x00000715, 0x07070715, 0xf8f90715, 0x07000715, 0xf9000715, 0x00070715, 0xfff90715,
-        0x0e0e0715, 0xf1f20715, 0x15070715, 0xeaf90715, 0x07150715, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000808, 0xfffff7f8, 0x00000800, 0xfffff800, 0x00000008, 0xfffffff8, 0x00001010,
-        0xffffeff0, 0x00001008, 0xffffeff8, 0x00000810, 0xfffff7f0, 0x00000ff0, 0xfffff010, 0x000017f8,
-        0xffffe808, 0xfffff818, 0x000007e8, 0x00002010, 0xffffdff0, 0x00001020, 0xffffefe0, 0x00002020,
-        0xffffdfe0, 0x00002800, 0xffffd800, 0x00000028, 0xffffffd8, 0x00001fe8, 0xffffe018, 0xffffe820,
-        0x000017e0, 0x00004028, 0xffffbfd8, 0x00002840, 0xffffd7c0, 0x00002ff0, 0xffffd010, 0xfffff030,
-        0x00000fd0, 0x00004010, 0xffffbff0, 0x00001040, 0xffffefc0, 0x00004040, 0xffffbfc0, 0x00004800,
-        0xffffb800, 0x00000048, 0xffffffb8, 0x00002fd0, 0xffffd030, 0x00003fe0, 0xffffc020, 0xffffe040,
-        0x00001fc0, 0x00006828, 0xffff97d8, 0x00002868, 0xffffd798, 0x00007048, 0xffff8fb8, 0x00004870,
-        0xffffb790, 0x000057e8, 0xffffa818, 0xffffe858, 0x000017a8, 0x00007010, 0xffff8ff0, 0x00001070,
-        0xffffef90, 0x00007878, 0xffff8788, 0x000057b8, 0xffffa848, 0xffffb858, 0x000047a8, 0x000077c8,
-        0xffff8838, 0xffffc878, 0x00003788, 0x00003030, 0xffffcfd0, 0x00005858, 0xffffa7a8, 0x00000000,
-        0x08080000, 0xf7f80000, 0x08000000, 0xf8000000, 0x00080000, 0xfff80000, 0x10100000, 0xeff00000,
-        0x10080000, 0xeff80000, 0x08100000, 0x00000808, 0x08080808, 0xf7f80808, 0x08000808, 0xf8000808,
-        0x00080808, 0xfff80808, 0x10100808, 0xeff00808, 0x10080808, 0xeff80808, 0x08100808, 0xfffff7f8,
-        0x0807f7f8, 0xf7f7f7f8, 0x07fff7f8, 0xf7fff7f8, 0x0007f7f8, 0xfff7f7f8, 0x100ff7f8, 0xefeff7f8,
-        0x1007f7f8, 0xeff7f7f8, 0x080ff7f8, 0x00000800, 0x08080800, 0xf7f80800, 0x08000800, 0xf8000800,
-        0x00080800, 0xfff80800, 0x10100800, 0xeff00800, 0x10080800, 0xeff80800, 0x08100800, 0xfffff800,
-        0x0807f800, 0xf7f7f800, 0x07fff800, 0xf7fff800, 0x0007f800, 0xfff7f800, 0x100ff800, 0xefeff800,
-        0x1007f800, 0xeff7f800, 0x080ff800, 0x00000008, 0x08080008, 0xf7f80008, 0x08000008, 0xf8000008,
-        0x00080008, 0xfff80008, 0x10100008, 0xeff00008, 0x10080008, 0xeff80008, 0x08100008, 0xfffffff8,
-        0x0807fff8, 0xf7f7fff8, 0x07fffff8, 0xf7fffff8, 0x0007fff8, 0xfff7fff8, 0x100ffff8, 0xefeffff8,
-        0x1007fff8, 0xeff7fff8, 0x080ffff8, 0x00001010, 0x08081010, 0xf7f81010, 0x08001010, 0xf8001010,
-        0x00081010, 0xfff81010, 0x10101010, 0xeff01010, 0x10081010, 0xeff81010, 0x08101010, 0xffffeff0,
-        0x0807eff0, 0xf7f7eff0, 0x07ffeff0, 0xf7ffeff0, 0x0007eff0, 0xfff7eff0, 0x100feff0, 0xefefeff0,
-        0x1007eff0, 0xeff7eff0, 0x080feff0, 0x00001008, 0x08081008, 0xf7f81008, 0x08001008, 0xf8001008,
-        0x00081008, 0xfff81008, 0x10101008, 0xeff01008, 0x10081008, 0xeff81008, 0x08101008, 0xffffeff8,
-        0x0807eff8, 0xf7f7eff8, 0x07ffeff8, 0xf7ffeff8, 0x0007eff8, 0xfff7eff8, 0x100feff8, 0xefefeff8,
-        0x1007eff8, 0xeff7eff8, 0x080feff8, 0x00000810, 0x08080810, 0xf7f80810, 0x08000810, 0xf8000810,
-        0x00080810, 0xfff80810, 0x10100810, 0xeff00810, 0x10080810, 0xeff80810, 0x08100810, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000909, 0xfffff6f7, 0x00000900, 0xfffff700, 0x00000009, 0xfffffff7, 0x00001212,
-        0xffffedee, 0x00001b09, 0xffffe4f7, 0x0000091b, 0xfffff6e5, 0x000011ee, 0xffffee12, 0x00001af7,
-        0xffffe509, 0xfffff71b, 0x000008e5, 0x00002412, 0xffffdbee, 0x00001224, 0xffffeddc, 0x00002424,
-        0xffffdbdc, 0x00002d00, 0xffffd300, 0x0000002d, 0xffffffd3, 0x000023e5, 0xffffdc1b, 0xffffe524,
-        0x00001adc, 0x0000482d, 0xffffb7d3, 0x00002d48, 0xffffd2b8, 0x000035ee, 0xffffca12, 0xffffee36,
-        0x000011ca, 0x00004812, 0xffffb7ee, 0x00001248, 0xffffedb8, 0x00004848, 0xffffb7b8, 0x00005100,
-        0xffffaf00, 0x00000051, 0xffffffaf, 0x000035ca, 0xffffca36, 0x000047dc, 0xffffb824, 0xffffdc48,
-        0x000023b8, 0x0000752d, 0xffff8ad3, 0x00002d75, 0xffffd28b, 0x00007e51, 0xffff81af, 0x0000517e,
-        0xffffae82, 0x000062e5, 0xffff9d1b, 0xffffe563, 0x00001a9d, 0x000062af, 0xffff9d51, 0xffffaf63,
-        0x0000509d, 0x00003636, 0xffffc9ca, 0x00006c6c, 0xffff9394, 0x00000000, 0x09090000, 0xf6f70000,
-        0x09000000, 0xf7000000, 0x00090000, 0xfff70000, 0x12120000, 0xedee0000, 0x1b090000, 0xe4f70000,
-        0x091b0000, 0xf6e50000, 0x00000909, 0x09090909, 0xf6f70909, 0x09000909, 0xf7000909, 0x00090909,
-        0xfff70909, 0x12120909, 0xedee0909, 0x1b090909, 0xe4f70909, 0x091b0909, 0xf6e50909, 0xfffff6f7,
-        0x0908f6f7, 0xf6f6f6f7, 0x08fff6f7, 0xf6fff6f7, 0x0008f6f7, 0xfff6f6f7, 0x1211f6f7, 0xededf6f7,
-        0x1b08f6f7, 0xe4f6f6f7, 0x091af6f7, 0xf6e4f6f7, 0x00000900, 0x09090900, 0xf6f70900, 0x09000900,
-        0xf7000900, 0x00090900, 0xfff70900, 0x12120900, 0xedee0900, 0x1b090900, 0xe4f70900, 0x091b0900,
-        0xf6e50900, 0xfffff700, 0x0908f700, 0xf6f6f700, 0x08fff700, 0xf6fff700, 0x0008f700, 0xfff6f700,
-        0x1211f700, 0xededf700, 0x1b08f700, 0xe4f6f700, 0x091af700, 0xf6e4f700, 0x00000009, 0x09090009,
-        0xf6f70009, 0x09000009, 0xf7000009, 0x00090009, 0xfff70009, 0x12120009, 0xedee0009, 0x1b090009,
-        0xe4f70009, 0x091b0009, 0xf6e50009, 0xfffffff7, 0x0908fff7, 0xf6f6fff7, 0x08fffff7, 0xf6fffff7,
-        0x0008fff7, 0xfff6fff7, 0x1211fff7, 0xededfff7, 0x1b08fff7, 0xe4f6fff7, 0x091afff7, 0xf6e4fff7,
-        0x00001212, 0x09091212, 0xf6f71212, 0x09001212, 0xf7001212, 0x00091212, 0xfff71212, 0x12121212,
-        0xedee1212, 0x1b091212, 0xe4f71212, 0x091b1212, 0xf6e51212, 0xffffedee, 0x0908edee, 0xf6f6edee,
-        0x08ffedee, 0xf6ffedee, 0x0008edee, 0xfff6edee, 0x1211edee, 0xedededee, 0x1b08edee, 0xe4f6edee,
-        0x091aedee, 0xf6e4edee, 0x00001b09, 0x09091b09, 0xf6f71b09, 0x09001b09, 0xf7001b09, 0x00091b09,
-        0xfff71b09, 0x12121b09, 0xedee1b09, 0x1b091b09, 0xe4f71b09, 0x091b1b09, 0xf6e51b09, 0xffffe4f7,
-        0x0908e4f7, 0xf6f6e4f7, 0x08ffe4f7, 0xf6ffe4f7, 0x0008e4f7, 0xfff6e4f7, 0x1211e4f7, 0xedede4f7,
-        0x1b08e4f7, 0xe4f6e4f7, 0x091ae4f7, 0xf6e4e4f7, 0x0000091b, 0x0909091b, 0xf6f7091b, 0x0900091b,
-        0xf700091b, 0x0009091b, 0xfff7091b, 0x1212091b, 0xedee091b, 0x1b09091b, 0xe4f7091b, 0x091b091b,
-        0xf6e5091b, 0xfffff6e5, 0x0908f6e5, 0xf6f6f6e5, 0x08fff6e5, 0xf6fff6e5, 0x0008f6e5, 0xfff6f6e5,
-        0x1211f6e5, 0xededf6e5, 0x1b08f6e5, 0xe4f6f6e5, 0x091af6e5, 0xf6e4f6e5, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000202, 0xfffffdfe, 0x00000300, 0xfffffd00, 0x00000003, 0xfffffffd, 0x00000606,
-        0xfffff9fa, 0x00000700, 0xfffff900, 0x00000007, 0xfffffff9, 0x000004fb, 0xfffffb05, 0xfffffb05,
-        0x000004fb, 0x00000b06, 0xfffff4fa, 0x0000060b, 0xfffff9f5, 0x00000800, 0xfffff800, 0x00000008,
-        0xfffffff8, 0x00000b0b, 0xfffff4f5, 0x00000c00, 0xfffff400, 0x0000000c, 0xfffffff4, 0x0000110c,
-        0xffffeef4, 0x00000c11, 0xfffff3ef, 0x00001111, 0xffffeeef, 0x00001206, 0xffffedfa, 0x00000612,
-        0xfffff9ee, 0x00000af8, 0xfffff508, 0xfffff80b, 0x000007f5, 0x00000f00, 0xfffff100, 0x0000000f,
-        0xfffffff1, 0x00001400, 0xffffec00, 0x00000014, 0xffffffec, 0x00001912, 0xffffe6ee, 0x00001219,
-        0xffffede7, 0x0000190b, 0xffffe6f5, 0x00000b19, 0xfffff4e7, 0x00001919, 0xffffe6e7, 0x00000df2,
-        0xfffff20e, 0xfffff20e, 0x00000df2, 0x00001a00, 0xffffe600, 0x0000001a, 0xffffffe6, 0x000011f5,
-        0xffffee0b, 0xfffff512, 0x00000aee, 0x000015f9, 0xffffea07, 0xfffff916, 0x000006ea, 0x0000221a,
-        0xffffdde6, 0x00001a22, 0xffffe5de, 0x00002212, 0xffffddee, 0x00001222, 0xffffedde, 0x00002222,
-        0xffffddde, 0x0000230b, 0xffffdcf5, 0x00000b23, 0xfffff4dd, 0x00001d00, 0xffffe300, 0x0000001d,
-        0xffffffe3, 0x000015ed, 0xffffea13, 0xffffed16, 0x000012ea, 0x000019f1, 0xffffe60f, 0xfffff11a,
-        0x00000ee6, 0x00002500, 0xffffdb00, 0x00000025, 0xffffffdb, 0x00002c1b, 0xffffd3e5, 0x00001b2c,
-        0xffffe4d4, 0x00002c24, 0xffffd3dc, 0x0000242c, 0xffffdbd4, 0x00002c12, 0xffffd3ee, 0x0000122c,
-        0xffffedd4, 0x000020f6, 0xffffdf0a, 0xfffff621, 0x000009df, 0x00002d2d, 0xffffd2d3, 0x00000000,
-        0x00000000, 0x00000202, 0xfffffdfe, 0x00000300, 0xfffffd00, 0x00000003, 0xfffffffd, 0x00000606,
-        0xfffff9fa, 0x00000700, 0xfffff900, 0x02020000, 0x02020202, 0x0201fdfe, 0x02020300, 0x0201fd00,
-        0x02020003, 0x0201fffd, 0x02020606, 0x0201f9fa, 0x02020700, 0x0201f900, 0xfdfe0000, 0xfdfe0202,
-        0xfdfdfdfe, 0xfdfe0300, 0xfdfdfd00, 0xfdfe0003, 0xfdfdfffd, 0xfdfe0606, 0xfdfdf9fa, 0xfdfe0700,
-        0xfdfdf900, 0x03000000, 0x03000202, 0x02fffdfe, 0x03000300, 0x02fffd00, 0x03000003, 0x02fffffd,
-        0x03000606, 0x02fff9fa, 0x03000700, 0x02fff900, 0xfd000000, 0xfd000202, 0xfcfffdfe, 0xfd000300,
-        0xfcfffd00, 0xfd000003, 0xfcfffffd, 0xfd000606, 0xfcfff9fa, 0xfd000700, 0xfcfff900, 0x00030000,
-        0x00030202, 0x0002fdfe, 0x00030300, 0x0002fd00, 0x00030003, 0x0002fffd, 0x00030606, 0x0002f9fa,
-        0x00030700, 0x0002f900, 0xfffd0000, 0xfffd0202, 0xfffcfdfe, 0xfffd0300, 0xfffcfd00, 0xfffd0003,
-        0xfffcfffd, 0xfffd0606, 0xfffcf9fa, 0xfffd0700, 0xfffcf900, 0x06060000, 0x06060202, 0x0605fdfe,
-        0x06060300, 0x0605fd00, 0x06060003, 0x0605fffd, 0x06060606, 0x0605f9fa, 0x06060700, 0x0605f900,
-        0xf9fa0000, 0xf9fa0202, 0xf9f9fdfe, 0xf9fa0300, 0xf9f9fd00, 0xf9fa0003, 0xf9f9fffd, 0xf9fa0606,
-        0xf9f9f9fa, 0xf9fa0700, 0xf9f9f900, 0x07000000, 0x07000202, 0x06fffdfe, 0x07000300, 0x06fffd00,
-        0x07000003, 0x06fffffd, 0x07000606, 0x06fff9fa, 0x07000700, 0x06fff900, 0xf9000000, 0xf9000202,
-        0xf8fffdfe, 0xf9000300, 0xf8fffd00, 0xf9000003, 0xf8fffffd, 0xf9000606, 0xf8fff9fa, 0xf9000700,
-        0xf8fff900, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe, 0x00000202, 0xfffffdfe, 0x00000606,
-        0xfffff9fa, 0x00000600, 0xfffffa00, 0x00000006, 0xfffffffa, 0x000003fc, 0xfffffc04, 0xfffffa0a,
-        0x000005f6, 0xfffff400, 0x00000c00, 0xfffff3fa, 0xfffff406, 0x00000bfa, 0x00000c06, 0xfffffff2,
-        0x0000000e, 0x00000c0c, 0xfffff3f4, 0xffffee00, 0x00001200, 0xfffff40e, 0x00000bf2, 0xfffff9ee,
-        0xfffffa12, 0x000005ee, 0x00000612, 0xffffedf6, 0xffffee0a, 0x000011f6, 0x0000120a, 0xffffffea,
-        0x00000016, 0xffffe800, 0x00001800, 0xfffff3ea, 0xfffff416, 0x00000bea, 0x00000c16, 0xffffe7f8,
-        0xffffe808, 0x000017f8, 0x00001808, 0xfffff9e6, 0xfffffa1a, 0x000005e6, 0x0000061a, 0xffffffe4,
-        0x0000001c, 0x00001414, 0xffffebec, 0xffffe5f2, 0x00001a0e, 0xfffff3e2, 0x00000c1e, 0xffffdff6,
-        0x0000200a, 0xffffdfee, 0x00002012, 0xffffe5e6, 0x00001a1a, 0xffffebde, 0x00001422, 0xfffff3da,
-        0x00000c26, 0xffffdfe0, 0x00002020, 0x00002020, 0xffffd7ea, 0xffffddde, 0x00002222, 0x00000000,
-        0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa,
-        0x00000600, 0xfffffa00, 0x00000006, 0xfffffffa, 0x02000000, 0x02000200, 0x01fffe00, 0x02000002,
-        0x01fffffe, 0x02000202, 0x01fffdfe, 0x02000606, 0x01fff9fa, 0x02000600, 0x01fffa00, 0x02000006,
-        0x01fffffa, 0xfe000000, 0xfe000200, 0xfdfffe00, 0xfe000002, 0xfdfffffe, 0xfe000202, 0xfdfffdfe,
-        0xfe000606, 0xfdfff9fa, 0xfe000600, 0xfdfffa00, 0xfe000006, 0xfdfffffa, 0x00020000, 0x00020200,
-        0x0001fe00, 0x00020002, 0x0001fffe, 0x00020202, 0x0001fdfe, 0x00020606, 0x0001f9fa, 0x00020600,
-        0x0001fa00, 0x00020006, 0x0001fffa, 0xfffe0000, 0xfffe0200, 0xfffdfe00, 0xfffe0002, 0xfffdfffe,
-        0xfffe0202, 0xfffdfdfe, 0xfffe0606, 0xfffdf9fa, 0xfffe0600, 0xfffdfa00, 0xfffe0006, 0xfffdfffa,
-        0x02020000, 0x02020200, 0x0201fe00, 0x02020002, 0x0201fffe, 0x02020202, 0x0201fdfe, 0x02020606,
-        0x0201f9fa, 0x02020600, 0x0201fa00, 0x02020006, 0x0201fffa, 0xfdfe0000, 0xfdfe0200, 0xfdfdfe00,
-        0xfdfe0002, 0xfdfdfffe, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606, 0xfdfdf9fa, 0xfdfe0600, 0xfdfdfa00,
-        0xfdfe0006, 0xfdfdfffa, 0x06060000, 0x06060200, 0x0605fe00, 0x06060002, 0x0605fffe, 0x06060202,
-        0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060600, 0x0605fa00, 0x06060006, 0x0605fffa, 0xf9fa0000,
-        0xf9fa0200, 0xf9f9fe00, 0xf9fa0002, 0xf9f9fffe, 0xf9fa0202, 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
-        0xf9fa0600, 0xf9f9fa00, 0xf9fa0006, 0xf9f9fffa, 0x06000000, 0x06000200, 0x05fffe00, 0x06000002,
-        0x05fffffe, 0x06000202, 0x05fffdfe, 0x06000606, 0x05fff9fa, 0x06000600, 0x05fffa00, 0x06000006,
-        0x05fffffa, 0xfa000000, 0xfa000200, 0xf9fffe00, 0xfa000002, 0xf9fffffe, 0xfa000202, 0xf9fffdfe,
-        0xfa000606, 0xf9fff9fa, 0xfa000600, 0xf9fffa00, 0xfa000006, 0xf9fffffa, 0x00060000, 0x00060200,
-        0x0005fe00, 0x00060002, 0x0005fffe, 0x00060202, 0x0005fdfe, 0x00060606, 0x0005f9fa, 0x00060600,
-        0x0005fa00, 0x00060006, 0x0005fffa, 0xfffa0000, 0xfffa0200, 0xfff9fe00, 0xfffa0002, 0xfff9fffe,
-        0xfffa0202, 0xfff9fdfe, 0xfffa0606, 0xfff9f9fa, 0xfffa0600, 0xfff9fa00, 0xfffa0006, 0xfff9fffa,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe, 0x00000404, 0xfffffbfc, 0x00000a0a,
-        0xfffff5f6, 0x00000a00, 0xfffff600, 0x0000000a, 0xfffffff6, 0x000005fa, 0xfffffa06, 0xfffff80e,
-        0x000007f2, 0xffffffee, 0x00000012, 0xfffff00a, 0x00000ff6, 0xffffe800, 0x00001800, 0xfffff7e8,
-        0xfffff818, 0x000007e8, 0x00000818, 0x00001212, 0xffffedee, 0xfffff014, 0x00000fec, 0xffffe5f2,
-        0xffffe60e, 0x000019f2, 0x00001a0e, 0xffffffe2, 0x0000001e, 0xffffde00, 0x00002200, 0xfffff7de,
-        0xfffff822, 0x000007de, 0x00000822, 0xffffede2, 0xffffee1e, 0x000011e2, 0x0000121e, 0xffffddf6,
-        0xffffde0a, 0x000021f6, 0x0000220a, 0xffffddec, 0x00002214, 0xffffffd8, 0x00000028, 0x00001e1e,
-        0xffffe1e2, 0xffffedd8, 0x00001228, 0xffffd400, 0x00002c00, 0xffffd3f0, 0x00002c10, 0xffffdbdc,
-        0xffffdbdc, 0x00002424, 0xffffd3e6, 0x00002c1a, 0xffffe5d2, 0x00001a2e, 0xffffedcc, 0x00001234,
-        0xffffc9ec, 0xffffd3d4, 0x00002c2c, 0xffffc9e0, 0xffffd1d2, 0xffffd1d2, 0x00002e2e, 0x00000000,
-        0x00000200, 0xfffffe00, 0x00000002, 0xfffffffe, 0x00000404, 0xfffffbfc, 0x00000a0a, 0xfffff5f6,
-        0x00000a00, 0xfffff600, 0x0000000a, 0xfffffff6, 0x02000000, 0x02000200, 0x01fffe00, 0x02000002,
-        0x01fffffe, 0x02000404, 0x01fffbfc, 0x02000a0a, 0x01fff5f6, 0x02000a00, 0x01fff600, 0x0200000a,
-        0x01fffff6, 0xfe000000, 0xfe000200, 0xfdfffe00, 0xfe000002, 0xfdfffffe, 0xfe000404, 0xfdfffbfc,
-        0xfe000a0a, 0xfdfff5f6, 0xfe000a00, 0xfdfff600, 0xfe00000a, 0xfdfffff6, 0x00020000, 0x00020200,
-        0x0001fe00, 0x00020002, 0x0001fffe, 0x00020404, 0x0001fbfc, 0x00020a0a, 0x0001f5f6, 0x00020a00,
-        0x0001f600, 0x0002000a, 0x0001fff6, 0xfffe0000, 0xfffe0200, 0xfffdfe00, 0xfffe0002, 0xfffdfffe,
-        0xfffe0404, 0xfffdfbfc, 0xfffe0a0a, 0xfffdf5f6, 0xfffe0a00, 0xfffdf600, 0xfffe000a, 0xfffdfff6,
-        0x04040000, 0x04040200, 0x0403fe00, 0x04040002, 0x0403fffe, 0x04040404, 0x0403fbfc, 0x04040a0a,
-        0x0403f5f6, 0x04040a00, 0x0403f600, 0x0404000a, 0x0403fff6, 0xfbfc0000, 0xfbfc0200, 0xfbfbfe00,
-        0xfbfc0002, 0xfbfbfffe, 0xfbfc0404, 0xfbfbfbfc, 0xfbfc0a0a, 0xfbfbf5f6, 0xfbfc0a00, 0xfbfbf600,
-        0xfbfc000a, 0xfbfbfff6, 0x0a0a0000, 0x0a0a0200, 0x0a09fe00, 0x0a0a0002, 0x0a09fffe, 0x0a0a0404,
-        0x0a09fbfc, 0x0a0a0a0a, 0x0a09f5f6, 0x0a0a0a00, 0x0a09f600, 0x0a0a000a, 0x0a09fff6, 0xf5f60000,
-        0xf5f60200, 0xf5f5fe00, 0xf5f60002, 0xf5f5fffe, 0xf5f60404, 0xf5f5fbfc, 0xf5f60a0a, 0xf5f5f5f6,
-        0xf5f60a00, 0xf5f5f600, 0xf5f6000a, 0xf5f5fff6, 0x0a000000, 0x0a000200, 0x09fffe00, 0x0a000002,
-        0x09fffffe, 0x0a000404, 0x09fffbfc, 0x0a000a0a, 0x09fff5f6, 0x0a000a00, 0x09fff600, 0x0a00000a,
-        0x09fffff6, 0xf6000000, 0xf6000200, 0xf5fffe00, 0xf6000002, 0xf5fffffe, 0xf6000404, 0xf5fffbfc,
-        0xf6000a0a, 0xf5fff5f6, 0xf6000a00, 0xf5fff600, 0xf600000a, 0xf5fffff6, 0x000a0000, 0x000a0200,
-        0x0009fe00, 0x000a0002, 0x0009fffe, 0x000a0404, 0x0009fbfc, 0x000a0a0a, 0x0009f5f6, 0x000a0a00,
-        0x0009f600, 0x000a000a, 0x0009fff6, 0xfff60000, 0xfff60200, 0xfff5fe00, 0xfff60002, 0xfff5fffe,
-        0xfff60404, 0xfff5fbfc, 0xfff60a0a, 0xfff5f5f6, 0xfff60a00, 0xfff5f600, 0xfff6000a, 0xfff5fff6,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000400, 0xfffffc00, 0x00000004, 0xfffffffc, 0x00000404, 0xfffffbfc, 0x00000c0c,
-        0xfffff3f4, 0x00000c00, 0xfffff400, 0x0000000c, 0xfffffff4, 0x000007f8, 0xfffff808, 0xfffff008,
-        0x00000ff8, 0xffffe800, 0x00001800, 0xfffff7e8, 0xfffff818, 0x000007e8, 0x00000818, 0xfffff014,
-        0x00000fec, 0xffffffe4, 0x0000001c, 0xffffe7f0, 0xffffe810, 0x000017f0, 0x00001810, 0xffffe000,
-        0x00002000, 0xffffefe4, 0xfffff01c, 0x00000fe4, 0x0000101c, 0xffffdff8, 0xffffe008, 0xfffff7e0,
-        0xfffff820, 0x000007e0, 0x00000820, 0x00001ff8, 0x00002008, 0x00001818, 0xffffe7e8, 0xffffe818,
-        0x000017e8, 0xffffdfec, 0x00002014, 0xffffffd8, 0x00000028, 0xffffefd8, 0x00001028, 0xffffd400,
-        0xffffd400, 0xffffffd4, 0x0000002c, 0x00002c00, 0x00002c00, 0xffffdfe0, 0x00002020, 0xffffd3f0,
-        0x00002c10, 0xffffd3e8, 0xffffe7d4, 0x0000182c, 0x00002c18, 0xffffefd0, 0x00001030, 0xffffdbdc,
-        0xffffdbdc, 0x00002424, 0x00002424, 0xffffcbec, 0x00002828, 0xffffd7d8, 0xffffcbe0, 0x00000000,
-        0x00000400, 0xfffffc00, 0x00000004, 0xfffffffc, 0x00000404, 0xfffffbfc, 0x00000c0c, 0xfffff3f4,
-        0x00000c00, 0xfffff400, 0x0000000c, 0xfffffff4, 0x04000000, 0x04000400, 0x03fffc00, 0x04000004,
-        0x03fffffc, 0x04000404, 0x03fffbfc, 0x04000c0c, 0x03fff3f4, 0x04000c00, 0x03fff400, 0x0400000c,
-        0x03fffff4, 0xfc000000, 0xfc000400, 0xfbfffc00, 0xfc000004, 0xfbfffffc, 0xfc000404, 0xfbfffbfc,
-        0xfc000c0c, 0xfbfff3f4, 0xfc000c00, 0xfbfff400, 0xfc00000c, 0xfbfffff4, 0x00040000, 0x00040400,
-        0x0003fc00, 0x00040004, 0x0003fffc, 0x00040404, 0x0003fbfc, 0x00040c0c, 0x0003f3f4, 0x00040c00,
-        0x0003f400, 0x0004000c, 0x0003fff4, 0xfffc0000, 0xfffc0400, 0xfffbfc00, 0xfffc0004, 0xfffbfffc,
-        0xfffc0404, 0xfffbfbfc, 0xfffc0c0c, 0xfffbf3f4, 0xfffc0c00, 0xfffbf400, 0xfffc000c, 0xfffbfff4,
-        0x04040000, 0x04040400, 0x0403fc00, 0x04040004, 0x0403fffc, 0x04040404, 0x0403fbfc, 0x04040c0c,
-        0x0403f3f4, 0x04040c00, 0x0403f400, 0x0404000c, 0x0403fff4, 0xfbfc0000, 0xfbfc0400, 0xfbfbfc00,
-        0xfbfc0004, 0xfbfbfffc, 0xfbfc0404, 0xfbfbfbfc, 0xfbfc0c0c, 0xfbfbf3f4, 0xfbfc0c00, 0xfbfbf400,
-        0xfbfc000c, 0xfbfbfff4, 0x0c0c0000, 0x0c0c0400, 0x0c0bfc00, 0x0c0c0004, 0x0c0bfffc, 0x0c0c0404,
-        0x0c0bfbfc, 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c0c00, 0x0c0bf400, 0x0c0c000c, 0x0c0bfff4, 0xf3f40000,
-        0xf3f40400, 0xf3f3fc00, 0xf3f40004, 0xf3f3fffc, 0xf3f40404, 0xf3f3fbfc, 0xf3f40c0c, 0xf3f3f3f4,
-        0xf3f40c00, 0xf3f3f400, 0xf3f4000c, 0xf3f3fff4, 0x0c000000, 0x0c000400, 0x0bfffc00, 0x0c000004,
-        0x0bfffffc, 0x0c000404, 0x0bfffbfc, 0x0c000c0c, 0x0bfff3f4, 0x0c000c00, 0x0bfff400, 0x0c00000c,
-        0x0bfffff4, 0xf4000000, 0xf4000400, 0xf3fffc00, 0xf4000004, 0xf3fffffc, 0xf4000404, 0xf3fffbfc,
-        0xf4000c0c, 0xf3fff3f4, 0xf4000c00, 0xf3fff400, 0xf400000c, 0xf3fffff4, 0x000c0000, 0x000c0400,
-        0x000bfc00, 0x000c0004, 0x000bfffc, 0x000c0404, 0x000bfbfc, 0x000c0c0c, 0x000bf3f4, 0x000c0c00,
-        0x000bf400, 0x000c000c, 0x000bfff4, 0xfff40000, 0xfff40400, 0xfff3fc00, 0xfff40004, 0xfff3fffc,
-        0xfff40404, 0xfff3fbfc, 0xfff40c0c, 0xfff3f3f4, 0xfff40c00, 0xfff3f400, 0xfff4000c, 0xfff3fff4,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414,
-        0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414, 0xffffebec,
-        0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000, 0x02020202, 0x0201fdfe, 0x02020606,
-        0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec, 0x02022020, 0x0201dfe0, 0x02022e2e,
-        0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606, 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
-        0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e, 0xfdfdd1d2, 0x06060000, 0x06060202,
-        0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4, 0x06061414, 0x0605ebec, 0x06062020,
-        0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202, 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
-        0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020, 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
-        0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa, 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
-        0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2, 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
-        0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414, 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
-        0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe, 0x14140606, 0x1413f9fa, 0x14140c0c,
-        0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0, 0x14142e2e, 0x1413d1d2, 0xebec0000,
-        0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c, 0xebebf3f4, 0xebec1414, 0xebebebec,
-        0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000, 0x20200202, 0x201ffdfe, 0x20200606,
-        0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec, 0x20202020, 0x201fdfe0, 0x20202e2e,
-        0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606, 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
-        0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e, 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
-        0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4, 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
-        0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202, 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
-        0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020, 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414,
-        0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414, 0xffffebec,
-        0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000, 0x02020202, 0x0201fdfe, 0x02020606,
-        0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec, 0x02022020, 0x0201dfe0, 0x02022e2e,
-        0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606, 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
-        0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e, 0xfdfdd1d2, 0x06060000, 0x06060202,
-        0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4, 0x06061414, 0x0605ebec, 0x06062020,
-        0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202, 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
-        0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020, 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
-        0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa, 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
-        0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2, 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
-        0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414, 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
-        0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe, 0x14140606, 0x1413f9fa, 0x14140c0c,
-        0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0, 0x14142e2e, 0x1413d1d2, 0xebec0000,
-        0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c, 0xebebf3f4, 0xebec1414, 0xebebebec,
-        0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000, 0x20200202, 0x201ffdfe, 0x20200606,
-        0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec, 0x20202020, 0x201fdfe0, 0x20202e2e,
-        0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606, 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
-        0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e, 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
-        0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4, 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
-        0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202, 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
-        0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020, 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414,
-        0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414, 0xffffebec,
-        0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000, 0x02020202, 0x0201fdfe, 0x02020606,
-        0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec, 0x02022020, 0x0201dfe0, 0x02022e2e,
-        0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606, 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
-        0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e, 0xfdfdd1d2, 0x06060000, 0x06060202,
-        0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4, 0x06061414, 0x0605ebec, 0x06062020,
-        0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202, 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
-        0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020, 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
-        0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa, 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
-        0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2, 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
-        0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414, 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
-        0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe, 0x14140606, 0x1413f9fa, 0x14140c0c,
-        0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0, 0x14142e2e, 0x1413d1d2, 0xebec0000,
-        0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c, 0xebebf3f4, 0xebec1414, 0xebebebec,
-        0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000, 0x20200202, 0x201ffdfe, 0x20200606,
-        0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec, 0x20202020, 0x201fdfe0, 0x20202e2e,
-        0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606, 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
-        0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e, 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
-        0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4, 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
-        0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202, 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
-        0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020, 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414,
-        0xffffebec, 0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000202, 0xfffffdfe, 0x00000606, 0xfffff9fa, 0x00000c0c, 0xfffff3f4, 0x00001414, 0xffffebec,
-        0x00002020, 0xffffdfe0, 0x00002e2e, 0xffffd1d2, 0x02020000, 0x02020202, 0x0201fdfe, 0x02020606,
-        0x0201f9fa, 0x02020c0c, 0x0201f3f4, 0x02021414, 0x0201ebec, 0x02022020, 0x0201dfe0, 0x02022e2e,
-        0x0201d1d2, 0xfdfe0000, 0xfdfe0202, 0xfdfdfdfe, 0xfdfe0606, 0xfdfdf9fa, 0xfdfe0c0c, 0xfdfdf3f4,
-        0xfdfe1414, 0xfdfdebec, 0xfdfe2020, 0xfdfddfe0, 0xfdfe2e2e, 0xfdfdd1d2, 0x06060000, 0x06060202,
-        0x0605fdfe, 0x06060606, 0x0605f9fa, 0x06060c0c, 0x0605f3f4, 0x06061414, 0x0605ebec, 0x06062020,
-        0x0605dfe0, 0x06062e2e, 0x0605d1d2, 0xf9fa0000, 0xf9fa0202, 0xf9f9fdfe, 0xf9fa0606, 0xf9f9f9fa,
-        0xf9fa0c0c, 0xf9f9f3f4, 0xf9fa1414, 0xf9f9ebec, 0xf9fa2020, 0xf9f9dfe0, 0xf9fa2e2e, 0xf9f9d1d2,
-        0x0c0c0000, 0x0c0c0202, 0x0c0bfdfe, 0x0c0c0606, 0x0c0bf9fa, 0x0c0c0c0c, 0x0c0bf3f4, 0x0c0c1414,
-        0x0c0bebec, 0x0c0c2020, 0x0c0bdfe0, 0x0c0c2e2e, 0x0c0bd1d2, 0xf3f40000, 0xf3f40202, 0xf3f3fdfe,
-        0xf3f40606, 0xf3f3f9fa, 0xf3f40c0c, 0xf3f3f3f4, 0xf3f41414, 0xf3f3ebec, 0xf3f42020, 0xf3f3dfe0,
-        0xf3f42e2e, 0xf3f3d1d2, 0x14140000, 0x14140202, 0x1413fdfe, 0x14140606, 0x1413f9fa, 0x14140c0c,
-        0x1413f3f4, 0x14141414, 0x1413ebec, 0x14142020, 0x1413dfe0, 0x14142e2e, 0x1413d1d2, 0xebec0000,
-        0xebec0202, 0xebebfdfe, 0xebec0606, 0xebebf9fa, 0xebec0c0c, 0xebebf3f4, 0xebec1414, 0xebebebec,
-        0xebec2020, 0xebebdfe0, 0xebec2e2e, 0xebebd1d2, 0x20200000, 0x20200202, 0x201ffdfe, 0x20200606,
-        0x201ff9fa, 0x20200c0c, 0x201ff3f4, 0x20201414, 0x201febec, 0x20202020, 0x201fdfe0, 0x20202e2e,
-        0x201fd1d2, 0xdfe00000, 0xdfe00202, 0xdfdffdfe, 0xdfe00606, 0xdfdff9fa, 0xdfe00c0c, 0xdfdff3f4,
-        0xdfe01414, 0xdfdfebec, 0xdfe02020, 0xdfdfdfe0, 0xdfe02e2e, 0xdfdfd1d2, 0x2e2e0000, 0x2e2e0202,
-        0x2e2dfdfe, 0x2e2e0606, 0x2e2df9fa, 0x2e2e0c0c, 0x2e2df3f4, 0x2e2e1414, 0x2e2debec, 0x2e2e2020,
-        0x2e2ddfe0, 0x2e2e2e2e, 0x2e2dd1d2, 0xd1d20000, 0xd1d20202, 0xd1d1fdfe, 0xd1d20606, 0xd1d1f9fa,
-        0xd1d20c0c, 0xd1d1f3f4, 0xd1d21414, 0xd1d1ebec, 0xd1d22020, 0xd1d1dfe0, 0xd1d22e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
-};
-
-
-static const uint32_t correctionloworder[] = {
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd, 0x04040404,
-        0xfbfbfbfc, 0x05050101, 0xfafafeff, 0x01010505, 0xfefefafb, 0x0403fbfc, 0xfbfc0404, 0x0605fdfe,
-        0xf9fa0202, 0xfdfe0606, 0x0201f9fa, 0x09090404, 0xf6f6fbfc, 0x04040909, 0xfbfbf6f7, 0x09090909,
-        0xf6f6f6f7, 0x0a0a0101, 0xf5f5feff, 0x01010a0a, 0xfefef5f6, 0x0807fafb, 0xf7f80505, 0xfafb0808,
-        0x0504f7f8, 0x0f0f0909, 0xf0f0f6f7, 0x09090f0f, 0xf6f6f0f1, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
-        0x0302f3f4, 0x10100404, 0xefeffbfc, 0x04041010, 0xfbfbeff0, 0x10101010, 0xefefeff0, 0x12120000,
-        0xedee0000, 0x00001212, 0xffffedee, 0x0c0bf3f4, 0xf3f40c0c, 0x100ff6f7, 0xeff00909, 0xf6f71010,
-        0x0908eff0, 0x1b1b0b0b, 0xe4e4f4f5, 0x0b0b1b1b, 0xf4f4e4e5, 0x1c1c1313, 0xe3e3eced, 0x13131c1c,
-        0xecece3e4, 0x1615f9fa, 0xe9ea0606, 0xf9fa1616, 0x0605e9ea, 0x1d1d0404, 0xe2e2fbfc, 0x04041d1d,
-        0xfbfbe2e3, 0x1e1e1e1e, 0xe1e1e1e2, 0x2120fdfe, 0xdedf0202, 0xfdfe2121, 0x0201dedf, 0x1716edee,
-        0xe8e91212, 0xedee1717, 0x1211e8e9, 0x1e1df0f1, 0xe1e20f0f, 0xf0f11e1e, 0x0f0ee1e2, 0x2e2e1616,
-        0xd1d1e9ea, 0x16162e2e, 0xe9e9d1d2, 0x2f2f0d0d, 0xd0d0f2f3, 0x0d0d2f2f, 0xf2f2d0d1, 0x31312323,
-        0xcecedcdd, 0x23233131, 0xdcdccecf, 0x2928f4f5, 0xd6d70b0b, 0xf4f52929, 0x0b0ad6d7, 0x33330404,
-        0xccccfbfc, 0x04043333, 0xfbfbcccd, 0x36363636, 0xc9c9c9ca, 0x2221ddde, 0xddde2222, 0x2a29e2e3,
-        0xd5d61d1d, 0xe2e32a2a, 0x1d1cd5d6, 0x3c3bf9fa, 0xc3c40606, 0xf9fa3c3c, 0x0605c3c4, 0x4c4c1b1b,
-        0xb3b3e4e5, 0x1b1b4c4c, 0xe4e4b3b4, 0x4d4d2b2b, 0xb2b2d4d5, 0x2b2b4d4d, 0xd4d4b2b3, 0x3736e7e8,
-        0xc8c91818, 0xe7e83737, 0x1817c8c9, 0x4f4f0e0e, 0xb0b0f1f2, 0x0e0e4f4f, 0xf1f1b0b1, 0x53533f3f,
-        0xacacc0c1, 0x3f3f5353, 0xc0c0acad, 0x4a49ebec, 0xb5b61414, 0xebec4a4a, 0x1413b5b6, 0x58580202,
-        0xa7a7fdfe, 0x02025858, 0xfdfda7a8, 0x5d5d5d5d, 0xa2a2a2a3, 0x3d3ccbcc, 0xc2c33434, 0xcbcc3d3d,
-        0x3433c2c3, 0x78783434, 0x8787cbcc, 0x34347878, 0xcbcb8788, 0x4b4ad2d3, 0xb4b52d2d, 0xd2d34b4b,
-        0x2d2cb4b5, 0x7d7d4b4b, 0x8282b4b5, 0x4b4b7d7d, 0xb4b48283, 0x7a7a2121, 0x8585dedf, 0x21217a7a,
-        0xdede8586, 0x6766f2f3, 0x98990d0d, 0xf2f36767, 0x0d0c9899, 0x605fd7d8, 0x9fa02828, 0xd7d86060,
-        0x28279fa0, 0x7f7eddde, 0x80812222, 0xddde7f7f, 0x22218081, 0x5958a6a7, 0xa6a75959, 0x6968b1b2,
-        0x96974e4e, 0xb1b26969, 0x4e4d9697, 0x0c0c0c0c, 0xf3f3f3f4, 0x17171717, 0xe8e8e8e9, 0x2a2a2a2a,
-        0xd5d5d5d6, 0x49494949, 0xb6b6b6b7, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0x0302feff, 0x0302feff, 0x0302feff, 0x0302feff, 0x0302feff, 0x0302feff, 0x0302feff, 0xfcfd0101,
-        0xfcfd0101, 0xfcfd0101, 0xfcfd0101, 0xfcfd0101, 0xfcfd0101, 0xfcfd0101, 0xfeff0303, 0xfeff0303,
-        0xfeff0303, 0xfeff0303, 0xfeff0303, 0xfeff0303, 0xfeff0303, 0x0100fcfd, 0x0100fcfd, 0x0100fcfd,
-        0x0100fcfd, 0x0100fcfd, 0x0100fcfd, 0x0100fcfd, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707,
-        0xf8f8f8f9, 0x08080202, 0xf7f7fdfe, 0x02020808, 0xfdfdf7f8, 0x0908fdfe, 0xf6f70202, 0xfdfe0909,
-        0x0201f6f7, 0x0605f9fa, 0xf9fa0606, 0x0d0d0606, 0xf2f2f9fa, 0x06060d0d, 0xf9f9f2f3, 0x0d0d0d0d,
-        0xf2f2f2f3, 0x0e0e0101, 0xf1f1feff, 0x01010e0e, 0xfefef1f2, 0x0c0bf7f8, 0xf3f40808, 0xf7f80c0c,
-        0x0807f3f4, 0x17170e0e, 0xe8e8f1f2, 0x0e0e1717, 0xf1f1e8e9, 0x1211fafb, 0xedee0505, 0xfafb1212,
-        0x0504edee, 0x18180606, 0xe7e7f9fa, 0x06061818, 0xf9f9e7e8, 0x18181818, 0xe7e7e7e8, 0x1b1afeff,
-        0xe4e50101, 0xfeff1b1b, 0x0100e4e5, 0x1110eeef, 0xeeef1111, 0x1716f2f3, 0xe8e90d0d, 0xf2f31717,
-        0x0d0ce8e9, 0x28281010, 0xd7d7eff0, 0x10102828, 0xefefd7d8, 0x29291c1c, 0xd6d6e3e4, 0x1c1c2929,
-        0xe3e3d6d7, 0x2120f6f7, 0xdedf0909, 0xf6f72121, 0x0908dedf, 0x2b2b0606, 0xd4d4f9fa, 0x06062b2b,
-        0xf9f9d4d5, 0x2e2e2e2e, 0xd1d1d1d2, 0x3231fbfc, 0xcdce0404, 0xfbfc3232, 0x0403cdce, 0x2221e4e5,
-        0xddde1b1b, 0xe4e52222, 0x1b1addde, 0x2d2ce9ea, 0xd2d31616, 0xe9ea2d2d, 0x1615d2d3, 0x45452222,
-        0xbabaddde, 0x22224545, 0xddddbabb, 0x46461313, 0xb9b9eced, 0x13134646, 0xececb9ba, 0x49493535,
-        0xb6b6cacb, 0x35354949, 0xcacab6b7, 0x3e3deeef, 0xc1c21111, 0xeeef3e3e, 0x1110c1c2, 0x4d4d0505,
-        0xb2b2fafb, 0x05054d4d, 0xfafab2b3, 0x52525252, 0xadadadae, 0x3332cccd, 0xcccd3333, 0x403fd4d5,
-        0xbfc02b2b, 0xd4d54040, 0x2b2abfc0, 0x5a59f5f6, 0xa5a60a0a, 0xf5f65a5a, 0x0a09a5a6, 0x72722929,
-        0x8d8dd6d7, 0x29297272, 0xd6d68d8e, 0x74744040, 0x8b8bbfc0, 0x40407474, 0xbfbf8b8c, 0x5251dadb,
-        0xadae2525, 0xdadb5252, 0x2524adae, 0x77771616, 0x8888e9ea, 0x16167777, 0xe9e98889, 0x7c7c5f5f,
-        0x8383a0a1, 0x5f5f7c7c, 0xa0a08384, 0x6f6ee1e2, 0x90911e1e, 0xe1e26f6f, 0x1e1d9091, 0x5c5bb1b2,
-        0xa3a44e4e, 0xb1b25c5c, 0x4e4da3a4, 0x7170bbbc, 0x8e8f4444, 0xbbbc7171, 0x44438e8f, 0x12121212,
-        0xedededee, 0x22222222, 0xddddddde, 0x3f3f3f3f, 0xc0c0c0c1, 0x6d6d6d6d, 0x92929293, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303,
-        0x03030303, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd,
-        0xfcfcfcfd, 0xfcfcfcfd, 0x0403feff, 0x0403feff, 0x0403feff, 0x0403feff, 0x0403feff, 0x0403feff,
-        0x0403feff, 0x0403feff, 0x0403feff, 0xfbfc0101, 0xfbfc0101, 0xfbfc0101, 0xfbfc0101, 0xfbfc0101,
-        0xfbfc0101, 0xfbfc0101, 0xfbfc0101, 0xfbfc0101, 0xfeff0404, 0xfeff0404, 0xfeff0404, 0xfeff0404,
-        0xfeff0404, 0xfeff0404, 0xfeff0404, 0xfeff0404, 0xfeff0404, 0x0100fbfc, 0x0100fbfc, 0x0100fbfc,
-        0x0100fbfc, 0x0100fbfc, 0x0100fbfc, 0x0100fbfc, 0x0100fbfc, 0x0100fbfc, 0x07070707, 0x07070707,
-        0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0xf8f8f8f9,
-        0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303,
-        0xf5f5fcfd, 0x03030a0a, 0xfcfcf5f6, 0x09090909, 0xf6f6f6f7, 0x0706f8f9, 0xf8f90707, 0x0c0bfcfd,
-        0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x11110808, 0xeeeef7f8, 0x08081111, 0xf7f7eeef, 0x11111111,
-        0xeeeeeeef, 0x13130101, 0xececfeff, 0x01011313, 0xfefeeced, 0x100ff4f5, 0xeff00b0b, 0xf4f51010,
-        0x0b0aeff0, 0x1716f9fa, 0xe8e90606, 0xf9fa1717, 0x0605e8e9, 0x1f1f1212, 0xe0e0edee, 0x12121f1f,
-        0xedede0e1, 0x20200808, 0xdfdff7f8, 0x08082020, 0xf7f7dfe0, 0x21212121, 0xdedededf, 0x2423feff,
-        0xdbdc0101, 0xfeff2424, 0x0100dbdc, 0x1716e8e9, 0xe8e91717, 0x1f1eeeef, 0xe0e11111, 0xeeef1f1f,
-        0x1110e0e1, 0x36361515, 0xc9c9eaeb, 0x15153636, 0xeaeac9ca, 0x37372525, 0xc8c8dadb, 0x25253737,
-        0xdadac8c9, 0x2c2bf3f4, 0xd3d40c0c, 0xf3f42c2c, 0x0c0bd3d4, 0x39390808, 0xc6c6f7f8, 0x08083939,
-        0xf7f7c6c7, 0x3d3d3d3d, 0xc2c2c2c3, 0x4241fafb, 0xbdbe0505, 0xfafb4242, 0x0504bdbe, 0x2d2cdbdc,
-        0xd2d32424, 0xdbdc2d2d, 0x2423d2d3, 0x3c3be2e3, 0xc3c41d1d, 0xe2e33c3c, 0x1d1cc3c4, 0x5c5c2d2d,
-        0xa3a3d2d3, 0x2d2d5c5c, 0xd2d2a3a4, 0x5d5d1919, 0xa2a2e6e7, 0x19195d5d, 0xe6e6a2a3, 0x61614747,
-        0x9e9eb8b9, 0x47476161, 0xb8b89e9f, 0x5352e9ea, 0xacad1616, 0xe9ea5353, 0x1615acad, 0x66660707,
-        0x9999f8f9, 0x07076666, 0xf8f8999a, 0x6d6d6d6d, 0x92929293, 0x4443bbbc, 0xbbbc4444, 0x5554c6c7,
-        0xaaab3939, 0xc6c75555, 0x3938aaab, 0x7877f2f3, 0x87880d0d, 0xf2f37878, 0x0d0c8788, 0x6e6dcecf,
-        0x91923131, 0xcecf6e6e, 0x31309192, 0x7b7a9798, 0x84856868, 0x97987b7b, 0x68678485, 0x18181818,
-        0xe7e7e7e8, 0x2e2e2e2e, 0xd1d1d1d2, 0x54545454, 0xabababac, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04040404,
-        0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
-        0x04040404, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
-        0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0x0504feff, 0x0504feff, 0x0504feff, 0x0504feff, 0x0504feff,
-        0x0504feff, 0x0504feff, 0x0504feff, 0x0504feff, 0x0504feff, 0xfafb0101, 0xfafb0101, 0xfafb0101,
-        0xfafb0101, 0xfafb0101, 0xfafb0101, 0xfafb0101, 0xfafb0101, 0xfafb0101, 0xfafb0101, 0xfeff0505,
-        0xfeff0505, 0xfeff0505, 0xfeff0505, 0xfeff0505, 0xfeff0505, 0xfeff0505, 0xfeff0505, 0xfeff0505,
-        0xfeff0505, 0x0100fafb, 0x0100fafb, 0x0100fafb, 0x0100fafb, 0x0100fafb, 0x0100fafb, 0x0100fafb,
-        0x0100fafb, 0x0100fafb, 0x0100fafb, 0x0a0a0303, 0x0a0a0303, 0x0a0a0303, 0x0a0a0303, 0x0a0a0303,
-        0x0a0a0303, 0x0a0a0303, 0x0a0a0303, 0x0a0a0303, 0x0a0a0303, 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd,
-        0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd, 0xf5f5fcfd, 0x03030a0a,
-        0x03030a0a, 0x03030a0a, 0x03030a0a, 0x03030a0a, 0x03030a0a, 0x03030a0a, 0x03030a0a, 0x03030a0a,
-        0x03030a0a, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b,
-        0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x03030d0d, 0xfcfcf2f3, 0x0908f6f7, 0xf6f70909, 0x0f0efbfc,
-        0xf0f10404, 0xfbfc0f0f, 0x0403f0f1, 0x16160b0b, 0xe9e9f4f5, 0x0b0b1616, 0xf4f4e9ea, 0x15151515,
-        0xeaeaeaeb, 0x18180202, 0xe7e7fdfe, 0x02021818, 0xfdfde7e8, 0x1413f1f2, 0xebec0e0e, 0xf1f21414,
-        0x0e0debec, 0x26261717, 0xd9d9e8e9, 0x17172626, 0xe8e8d9da, 0x1d1cf7f8, 0xe2e30808, 0xf7f81d1d,
-        0x0807e2e3, 0x27270b0b, 0xd8d8f4f5, 0x0b0b2727, 0xf4f4d8d9, 0x29292929, 0xd6d6d6d7, 0x2d2cfeff,
-        0xd2d30101, 0xfeff2d2d, 0x0100d2d3, 0x1d1ce2e3, 0xe2e31d1d, 0x2726e9ea, 0xd8d91616, 0xe9ea2727,
-        0x1615d8d9, 0x43431b1b, 0xbcbce4e5, 0x1b1b4343, 0xe4e4bcbd, 0x45452f2f, 0xbabad0d1, 0x2f2f4545,
-        0xd0d0babb, 0x3837f0f1, 0xc7c80f0f, 0xf0f13838, 0x0f0ec7c8, 0x47470b0b, 0xb8b8f4f5, 0x0b0b4747,
-        0xf4f4b8b9, 0x4c4c4c4c, 0xb3b3b3b4, 0x5352f9fa, 0xacad0606, 0xf9fa5353, 0x0605acad, 0x3938d2d3,
-        0xc6c72d2d, 0xd2d33939, 0x2d2cc6c7, 0x4b4adbdc, 0xb4b52424, 0xdbdc4b4b, 0x2423b4b5, 0x73733838,
-        0x8c8cc7c8, 0x38387373, 0xc7c78c8d, 0x75751f1f, 0x8a8ae0e1, 0x1f1f7575, 0xe0e08a8b, 0x7a7a5858,
-        0x8585a7a8, 0x58587a7a, 0xa7a78586, 0x6867e3e4, 0x97981c1c, 0xe3e46868, 0x1c1b9798, 0x5554aaab,
-        0xaaab5555, 0x6a69b7b8, 0x95964848, 0xb7b86a6a, 0x48479596, 0x1e1e1e1e, 0xe1e1e1e2, 0x3a3a3a3a,
-        0xc5c5c5c6, 0x69696969, 0x96969697, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x05050505, 0x05050505,
-        0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505,
-        0x05050505, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb,
-        0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe,
-        0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0x0706fdfe, 0xf8f90202,
-        0xf8f90202, 0xf8f90202, 0xf8f90202, 0xf8f90202, 0xf8f90202, 0xf8f90202, 0xf8f90202, 0xf8f90202,
-        0xf8f90202, 0xf8f90202, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707,
-        0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0xfdfe0707, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9,
-        0x0201f8f9, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9, 0x0201f8f9,
-        0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b,
-        0x0b0b0b0b, 0x0b0b0b0b, 0x0b0b0b0b, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5,
-        0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0xf4f4f4f5, 0x0d0d0303, 0x0d0d0303,
-        0x0d0d0303, 0x0d0d0303, 0x0d0d0303, 0x0d0d0303, 0x0d0d0303, 0x0d0d0303, 0x0d0d0303, 0x0d0d0303,
-        0x0d0d0303, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd,
-        0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0xf2f2fcfd, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d,
-        0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0xfbfbf0f1, 0x0b0af4f5, 0xf4f50b0b, 0x1211fafb,
-        0xedee0505, 0xfafb1212, 0x0504edee, 0x1a1a0d0d, 0xe5e5f2f3, 0x0d0d1a1a, 0xf2f2e5e6, 0x1a1a1a1a,
-        0xe5e5e5e6, 0x1d1d0202, 0xe2e2fdfe, 0x02021d1d, 0xfdfde2e3, 0x1817eff0, 0xe7e81010, 0xeff01818,
-        0x100fe7e8, 0x2e2e1c1c, 0xd1d1e3e4, 0x1c1c2e2e, 0xe3e3d1d2, 0x2322f6f7, 0xdcdd0909, 0xf6f72323,
-        0x0908dcdd, 0x2f2f0d0d, 0xd0d0f2f3, 0x0d0d2f2f, 0xf2f2d0d1, 0x31313131, 0xcecececf, 0x3635feff,
-        0xc9ca0101, 0xfeff3636, 0x0100c9ca, 0x2322dcdd, 0xdcdd2323, 0x2f2ee5e6, 0xd0d11a1a, 0xe5e62f2f,
-        0x1a19d0d1, 0x51512020, 0xaeaedfe0, 0x20205151, 0xdfdfaeaf, 0x53533838, 0xacacc7c8, 0x38385353,
-        0xc7c7acad, 0x4342edee, 0xbcbd1212, 0xedee4343, 0x1211bcbd, 0x56560d0d, 0xa9a9f2f3, 0x0d0d5656,
-        0xf2f2a9aa, 0x5b5b5b5b, 0xa4a4a4a5, 0x6362f8f9, 0x9c9d0707, 0xf8f96363, 0x07069c9d, 0x4443c9ca,
-        0xbbbc3636, 0xc9ca4444, 0x3635bbbc, 0x5a59d3d4, 0xa5a62c2c, 0xd3d45a5a, 0x2c2ba5a6, 0x7c7bdedf,
-        0x83842121, 0xdedf7c7c, 0x21208384, 0x67669899, 0x98996767, 0x7f7ea9aa, 0x80815656, 0xa9aa7f7f,
-        0x56558081, 0x25252525, 0xdadadadb, 0x45454545, 0xbabababb, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe,
-        0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0x0807fdfe, 0xf7f80202, 0xf7f80202, 0xf7f80202,
-        0xf7f80202, 0xf7f80202, 0xf7f80202, 0xf7f80202, 0xf7f80202, 0xf7f80202, 0xf7f80202, 0xf7f80202,
-        0xf7f80202, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808,
-        0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0xfdfe0808, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8,
-        0x0201f7f8, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8, 0x0201f7f8,
-        0x0201f7f8, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d,
-        0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0x0d0d0d0d, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3,
-        0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3, 0xf2f2f2f3,
-        0xf2f2f2f3, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404,
-        0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0x0f0f0404, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc,
-        0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc, 0xf0f0fbfc,
-        0xf0f0fbfc, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f,
-        0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x04040f0f, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010,
-        0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0xfafaedee, 0x0d0cf2f3, 0xf2f30d0d, 0x1514f9fa,
-        0xeaeb0606, 0xf9fa1515, 0x0605eaeb, 0x1e1e0f0f, 0xe1e1f0f1, 0x0f0f1e1e, 0xf0f0e1e2, 0x1e1e1e1e,
-        0xe1e1e1e2, 0x22220202, 0xddddfdfe, 0x02022222, 0xfdfdddde, 0x1c1beced, 0xe3e41313, 0xeced1c1c,
-        0x1312e3e4, 0x36362020, 0xc9c9dfe0, 0x20203636, 0xdfdfc9ca, 0x2928f4f5, 0xd6d70b0b, 0xf4f52929,
-        0x0b0ad6d7, 0x37370f0f, 0xc8c8f0f1, 0x0f0f3737, 0xf0f0c8c9, 0x39393939, 0xc6c6c6c7, 0x3f3efeff,
-        0xc0c10101, 0xfeff3f3f, 0x0100c0c1, 0x2827d7d8, 0xd7d82828, 0x3736e1e2, 0xc8c91e1e, 0xe1e23737,
-        0x1e1dc8c9, 0x5e5e2525, 0xa1a1dadb, 0x25255e5e, 0xdadaa1a2, 0x60604141, 0x9f9fbebf, 0x41416060,
-        0xbebe9fa0, 0x4e4deaeb, 0xb1b21515, 0xeaeb4e4e, 0x1514b1b2, 0x64640f0f, 0x9b9bf0f1, 0x0f0f6464,
-        0xf0f09b9c, 0x6a6a6a6a, 0x95959596, 0x7473f7f8, 0x8b8c0808, 0xf7f87474, 0x08078b8c, 0x4f4ec0c1,
-        0xb0b13f3f, 0xc0c14f4f, 0x3f3eb0b1, 0x6968cccd, 0x96973333, 0xcccd6969, 0x33329697, 0x78778788,
-        0x87887878, 0x2b2b2b2b, 0xd4d4d4d5, 0x50505050, 0xafafafb0, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707,
-        0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
-        0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
-        0xf8f8f8f9, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd,
-        0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0x0a09fcfd, 0xf5f60303, 0xf5f60303, 0xf5f60303,
-        0xf5f60303, 0xf5f60303, 0xf5f60303, 0xf5f60303, 0xf5f60303, 0xf5f60303, 0xf5f60303, 0xf5f60303,
-        0xf5f60303, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a,
-        0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0xfcfd0a0a, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6,
-        0x0302f5f6, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6, 0x0302f5f6,
-        0x0302f5f6, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010,
-        0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0xefefeff0, 0xefefeff0, 0xefefeff0,
-        0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0,
-        0xefefeff0, 0x12120505, 0x12120505, 0x12120505, 0x12120505, 0x12120505, 0x12120505, 0x12120505,
-        0x12120505, 0x12120505, 0x12120505, 0x12120505, 0x12120505, 0xededfafb, 0xededfafb, 0xededfafb,
-        0xededfafb, 0xededfafb, 0xededfafb, 0xededfafb, 0xededfafb, 0xededfafb, 0xededfafb, 0xededfafb,
-        0xededfafb, 0x05051212, 0x05051212, 0x05051212, 0x05051212, 0x05051212, 0x05051212, 0x05051212,
-        0x05051212, 0x05051212, 0x05051212, 0x05051212, 0x05051212, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b, 0x0302f4f5, 0x12121212,
-        0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0xfafaebec, 0x0f0ef0f1, 0xf0f10f0f, 0x1817f8f9,
-        0xe7e80707, 0xf8f91818, 0x0706e7e8, 0x23231111, 0xdcdceeef, 0x11112323, 0xeeeedcdd, 0x22222222,
-        0xddddddde, 0x26260303, 0xd9d9fcfd, 0x03032626, 0xfcfcd9da, 0x201fe9ea, 0xdfe01616, 0xe9ea2020,
-        0x1615dfe0, 0x3d3d2525, 0xc2c2dadb, 0x25253d3d, 0xdadac2c3, 0x2f2ef2f3, 0xd0d10d0d, 0xf2f32f2f,
-        0x0d0cd0d1, 0x3f3f1111, 0xc0c0eeef, 0x11113f3f, 0xeeeec0c1, 0x41414141, 0xbebebebf, 0x4847feff,
-        0xb7b80101, 0xfeff4848, 0x0100b7b8, 0x2e2dd1d2, 0xd1d22e2e, 0x3f3edcdd, 0xc0c12323, 0xdcdd3f3f,
-        0x2322c0c1, 0x6b6b2b2b, 0x9494d4d5, 0x2b2b6b6b, 0xd4d49495, 0x6e6e4b4b, 0x9191b4b5, 0x4b4b6e6e,
-        0xb4b49192, 0x5958e7e8, 0xa6a71818, 0xe7e85959, 0x1817a6a7, 0x72721111, 0x8d8deeef, 0x11117272,
-        0xeeee8d8e, 0x79797979, 0x86868687, 0x5b5ab7b8, 0xa4a54848, 0xb7b85b5b, 0x4847a4a5, 0x7877c5c6,
-        0x87883a3a, 0xc5c67878, 0x3a398788, 0x31313131, 0xcecececf, 0x5c5c5c5c, 0xa3a3a3a4, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808,
-        0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0xf7f7f7f8,
-        0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8,
-        0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd,
-        0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0x0b0afcfd, 0xf4f50303,
-        0xf4f50303, 0xf4f50303, 0xf4f50303, 0xf4f50303, 0xf4f50303, 0xf4f50303, 0xf4f50303, 0xf4f50303,
-        0xf4f50303, 0xf4f50303, 0xf4f50303, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b,
-        0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0xfcfd0b0b, 0x0302f4f5,
-        0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x0302f4f5,
-        0x0302f4f5, 0x0302f4f5, 0x0302f4f5, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
-        0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0xedededee,
-        0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee,
-        0xedededee, 0xedededee, 0xedededee, 0x14140505, 0x14140505, 0x14140505, 0x14140505, 0x14140505,
-        0x14140505, 0x14140505, 0x14140505, 0x14140505, 0x14140505, 0x14140505, 0x14140505, 0xebebfafb,
-        0xebebfafb, 0xebebfafb, 0xebebfafb, 0xebebfafb, 0xebebfafb, 0xebebfafb, 0xebebfafb, 0xebebfafb,
-        0xebebfafb, 0xebebfafb, 0xebebfafb, 0x05051414, 0x05051414, 0x05051414, 0x05051414, 0x05051414,
-        0x05051414, 0x05051414, 0x05051414, 0x05051414, 0x05051414, 0x05051414, 0x05051414, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414,
-        0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x1110eeef, 0xeeef1111, 0x1b1af8f9,
-        0xe4e50707, 0xf8f91b1b, 0x0706e4e5, 0x27271313, 0xd8d8eced, 0x13132727, 0xececd8d9, 0x27272727,
-        0xd8d8d8d9, 0x2b2b0303, 0xd4d4fcfd, 0x03032b2b, 0xfcfcd4d5, 0x2423e7e8, 0xdbdc1818, 0xe7e82424,
-        0x1817dbdc, 0x45452a2a, 0xbabad5d6, 0x2a2a4545, 0xd5d5babb, 0x3534f1f2, 0xcacb0e0e, 0xf1f23535,
-        0x0e0dcacb, 0x47471313, 0xb8b8eced, 0x13134747, 0xececb8b9, 0x49494949, 0xb6b6b6b7, 0x504ffdfe,
-        0xafb00202, 0xfdfe5050, 0x0201afb0, 0x3433cbcc, 0xcbcc3434, 0x4645d8d9, 0xb9ba2727, 0xd8d94646,
-        0x2726b9ba, 0x79793030, 0x8686cfd0, 0x30307979, 0xcfcf8687, 0x7c7c5454, 0x8383abac, 0x54547c7c,
-        0xabab8384, 0x6463e4e5, 0x9b9c1b1b, 0xe4e56464, 0x1b1a9b9c, 0x6665aeaf, 0x999a5151, 0xaeaf6666,
-        0x5150999a, 0x37373737, 0xc8c8c8c9, 0x68686868, 0x97979798, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909,
-        0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0xf6f6f6f7,
-        0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7,
-        0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd,
-        0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd, 0x0c0bfcfd,
-        0x0c0bfcfd, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303,
-        0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xf3f40303, 0xfcfd0c0c, 0xfcfd0c0c,
-        0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c,
-        0xfcfd0c0c, 0xfcfd0c0c, 0xfcfd0c0c, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4,
-        0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4, 0x0302f3f4,
-        0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
-        0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0xebebebec, 0xebebebec, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
-        0xebebebec, 0xebebebec, 0x17170606, 0x17170606, 0x17170606, 0x17170606, 0x17170606, 0x17170606,
-        0x17170606, 0x17170606, 0x17170606, 0x17170606, 0x17170606, 0x17170606, 0x17170606, 0xe8e8f9fa,
-        0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa,
-        0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0xe8e8f9fa, 0x06061717, 0x06061717, 0x06061717, 0x06061717,
-        0x06061717, 0x06061717, 0x06061717, 0x06061717, 0x06061717, 0x06061717, 0x06061717, 0x06061717,
-        0x06061717, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9,
-        0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0xf9f9e8e9, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404,
-        0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x0403fbfc, 0xfbfc0404, 0x0605fdfe,
-        0xf9fa0202, 0xfdfe0606, 0x0201f9fa, 0x08080404, 0xf7f7fbfc, 0x04040808, 0xfbfbf7f8, 0x08080808,
-        0xf7f7f7f8, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x0807fbfc, 0xf7f80404, 0xfbfc0808,
-        0x0403f7f8, 0x0e0e0808, 0xf1f1f7f8, 0x08080e0e, 0xf7f7f1f2, 0x0c0bfdfe, 0xf3f40202, 0xfdfe0c0c,
-        0x0201f3f4, 0x10100404, 0xefeffbfc, 0x04041010, 0xfbfbeff0, 0x10101010, 0xefefeff0, 0x12120000,
-        0xedee0000, 0x00001212, 0xffffedee, 0x0c0bf3f4, 0xf3f40c0c, 0x100ff7f8, 0xeff00808, 0xf7f81010,
-        0x0807eff0, 0x1a1a0a0a, 0xe5e5f5f6, 0x0a0a1a1a, 0xf5f5e5e6, 0x1c1c1212, 0xe3e3edee, 0x12121c1c,
-        0xedede3e4, 0x1615f9fa, 0xe9ea0606, 0xf9fa1616, 0x0605e9ea, 0x1c1c0404, 0xe3e3fbfc, 0x04041c1c,
-        0xfbfbe3e4, 0x1e1e1e1e, 0xe1e1e1e2, 0x201ffdfe, 0xdfe00202, 0xfdfe2020, 0x0201dfe0, 0x1615edee,
-        0xe9ea1212, 0xedee1616, 0x1211e9ea, 0x1e1df1f2, 0xe1e20e0e, 0xf1f21e1e, 0x0e0de1e2, 0x2e2e1616,
-        0xd1d1e9ea, 0x16162e2e, 0xe9e9d1d2, 0x2e2e0c0c, 0xd1d1f3f4, 0x0c0c2e2e, 0xf3f3d1d2, 0x30302222,
-        0xcfcfddde, 0x22223030, 0xddddcfd0, 0x2827f5f6, 0xd7d80a0a, 0xf5f62828, 0x0a09d7d8, 0x32320404,
-        0xcdcdfbfc, 0x04043232, 0xfbfbcdce, 0x36363636, 0xc9c9c9ca, 0x2221ddde, 0xddde2222, 0x2a29e3e4,
-        0xd5d61c1c, 0xe3e42a2a, 0x1c1bd5d6, 0x3c3bf9fa, 0xc3c40606, 0xf9fa3c3c, 0x0605c3c4, 0x4c4c1a1a,
-        0xb3b3e5e6, 0x1a1a4c4c, 0xe5e5b3b4, 0x4c4c2a2a, 0xb3b3d5d6, 0x2a2a4c4c, 0xd5d5b3b4, 0x3635e7e8,
-        0xc9ca1818, 0xe7e83636, 0x1817c9ca, 0x4e4e0e0e, 0xb1b1f1f2, 0x0e0e4e4e, 0xf1f1b1b2, 0x52523e3e,
-        0xadadc1c2, 0x3e3e5252, 0xc1c1adae, 0x4a49ebec, 0xb5b61414, 0xebec4a4a, 0x1413b5b6, 0x58580202,
-        0xa7a7fdfe, 0x02025858, 0xfdfda7a8, 0x5c5c5c5c, 0xa3a3a3a4, 0x3c3bcbcc, 0xc3c43434, 0xcbcc3c3c,
-        0x3433c3c4, 0x76763434, 0x8989cbcc, 0x34347676, 0xcbcb898a, 0x4a49d3d4, 0xb5b62c2c, 0xd3d44a4a,
-        0x2c2bb5b6, 0x76764a4a, 0x8989b5b6, 0x4a4a7676, 0xb5b5898a, 0x76762020, 0x8989dfe0, 0x20207676,
-        0xdfdf898a, 0x6665f3f4, 0x999a0c0c, 0xf3f46666, 0x0c0b999a, 0x605fd7d8, 0x9fa02828, 0xd7d86060,
-        0x28279fa0, 0x7675ddde, 0x898a2222, 0xddde7676, 0x2221898a, 0x5857a7a8, 0xa7a85858, 0x6867b1b2,
-        0x97984e4e, 0xb1b26868, 0x4e4d9798, 0x0c0c0c0c, 0xf3f3f3f4, 0x16161616, 0xe9e9e9ea, 0x2a2a2a2a,
-        0xd5d5d5d6, 0x48484848, 0xb7b7b7b8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0xfdfe0000,
-        0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0x00000202, 0x00000202,
-        0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
-        0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606,
-        0xf9f9f9fa, 0x09090303, 0xf6f6fcfd, 0x03030909, 0xfcfcf6f7, 0x0908fcfd, 0xf6f70303, 0xfcfd0909,
-        0x0302f6f7, 0x0605f9fa, 0xf9fa0606, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0xf9f9f3f4, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x0f0f0000, 0xf0f10000, 0x00000f0f, 0xfffff0f1, 0x0c0bf6f7, 0xf3f40909, 0xf6f70c0c,
-        0x0908f3f4, 0x18180f0f, 0xe7e7f0f1, 0x0f0f1818, 0xf0f0e7e8, 0x1211f9fa, 0xedee0606, 0xf9fa1212,
-        0x0605edee, 0x18180606, 0xe7e7f9fa, 0x06061818, 0xf9f9e7e8, 0x18181818, 0xe7e7e7e8, 0x1b1b0000,
-        0xe4e50000, 0x00001b1b, 0xffffe4e5, 0x1211edee, 0xedee1212, 0x1817f3f4, 0xe7e80c0c, 0xf3f41818,
-        0x0c0be7e8, 0x27270f0f, 0xd8d8f0f1, 0x0f0f2727, 0xf0f0d8d9, 0x2a2a1b1b, 0xd5d5e4e5, 0x1b1b2a2a,
-        0xe4e4d5d6, 0x2120f6f7, 0xdedf0909, 0xf6f72121, 0x0908dedf, 0x2a2a0606, 0xd5d5f9fa, 0x06062a2a,
-        0xf9f9d5d6, 0x2d2d2d2d, 0xd2d2d2d3, 0x3332fcfd, 0xcccd0303, 0xfcfd3333, 0x0302cccd, 0x2120e4e5,
-        0xdedf1b1b, 0xe4e52121, 0x1b1adedf, 0x2d2ceaeb, 0xd2d31515, 0xeaeb2d2d, 0x1514d2d3, 0x45452121,
-        0xbabadedf, 0x21214545, 0xdedebabb, 0x45451212, 0xbabaedee, 0x12124545, 0xededbabb, 0x48483636,
-        0xb7b7c9ca, 0x36364848, 0xc9c9b7b8, 0x3f3eedee, 0xc0c11212, 0xedee3f3f, 0x1211c0c1, 0x4e4e0606,
-        0xb1b1f9fa, 0x06064e4e, 0xf9f9b1b2, 0x51515151, 0xaeaeaeaf, 0x3332cccd, 0xcccd3333, 0x3f3ed5d6,
-        0xc0c12a2a, 0xd5d63f3f, 0x2a29c0c1, 0x5a59f6f7, 0xa5a60909, 0xf6f75a5a, 0x0908a5a6, 0x72722a2a,
-        0x8d8dd5d6, 0x2a2a7272, 0xd5d58d8e, 0x75753f3f, 0x8a8ac0c1, 0x3f3f7575, 0xc0c08a8b, 0x5150dbdc,
-        0xaeaf2424, 0xdbdc5151, 0x2423aeaf, 0x78781515, 0x8787eaeb, 0x15157878, 0xeaea8788, 0x7b7b6060,
-        0x84849fa0, 0x60607b7b, 0x9f9f8485, 0x6f6ee1e2, 0x90911e1e, 0xe1e26f6f, 0x1e1d9091, 0x5d5cb1b2,
-        0xa2a34e4e, 0xb1b25d5d, 0x4e4da2a3, 0x7271babb, 0x8d8e4545, 0xbabb7272, 0x45448d8e, 0x12121212,
-        0xedededee, 0x21212121, 0xdedededf, 0x3f3f3f3f, 0xc0c0c0c1, 0x6c6c6c6c, 0x93939394, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303, 0x03030303,
-        0x03030303, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd, 0xfcfcfcfd,
-        0xfcfcfcfd, 0xfcfcfcfd, 0x03030000, 0x03030000, 0x03030000, 0x03030000, 0x03030000, 0x03030000,
-        0x03030000, 0x03030000, 0x03030000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000,
-        0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0x00000303, 0x00000303, 0x00000303, 0x00000303,
-        0x00000303, 0x00000303, 0x00000303, 0x00000303, 0x00000303, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd,
-        0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404,
-        0xf7f7fbfc, 0x04040808, 0xfbfbf7f8, 0x08080808, 0xf7f7f7f8, 0x0807f7f8, 0xf7f80808, 0x0c0bfbfc,
-        0xf3f40404, 0xfbfc0c0c, 0x0403f3f4, 0x10100808, 0xefeff7f8, 0x08081010, 0xf7f7eff0, 0x10101010,
-        0xefefeff0, 0x14140000, 0xebec0000, 0x00001414, 0xffffebec, 0x100ff3f4, 0xeff00c0c, 0xf3f41010,
-        0x0c0beff0, 0x1817fbfc, 0xe7e80404, 0xfbfc1818, 0x0403e7e8, 0x20201010, 0xdfdfeff0, 0x10102020,
-        0xefefdfe0, 0x20200808, 0xdfdff7f8, 0x08082020, 0xf7f7dfe0, 0x20202020, 0xdfdfdfe0, 0x24240000,
-        0xdbdc0000, 0x00002424, 0xffffdbdc, 0x1817e7e8, 0xe7e81818, 0x201feff0, 0xdfe01010, 0xeff02020,
-        0x100fdfe0, 0x34341414, 0xcbcbebec, 0x14143434, 0xebebcbcc, 0x38382424, 0xc7c7dbdc, 0x24243838,
-        0xdbdbc7c8, 0x2c2bf3f4, 0xd3d40c0c, 0xf3f42c2c, 0x0c0bd3d4, 0x38380808, 0xc7c7f7f8, 0x08083838,
-        0xf7f7c7c8, 0x3c3c3c3c, 0xc3c3c3c4, 0x403ffbfc, 0xbfc00404, 0xfbfc4040, 0x0403bfc0, 0x2c2bdbdc,
-        0xd3d42424, 0xdbdc2c2c, 0x2423d3d4, 0x3c3be3e4, 0xc3c41c1c, 0xe3e43c3c, 0x1c1bc3c4, 0x5c5c2c2c,
-        0xa3a3d3d4, 0x2c2c5c5c, 0xd3d3a3a4, 0x5c5c1818, 0xa3a3e7e8, 0x18185c5c, 0xe7e7a3a4, 0x60604848,
-        0x9f9fb7b8, 0x48486060, 0xb7b79fa0, 0x5453ebec, 0xabac1414, 0xebec5454, 0x1413abac, 0x64640808,
-        0x9b9bf7f8, 0x08086464, 0xf7f79b9c, 0x6c6c6c6c, 0x93939394, 0x4443bbbc, 0xbbbc4444, 0x5453c7c8,
-        0xabac3838, 0xc7c85454, 0x3837abac, 0x7877f3f4, 0x87880c0c, 0xf3f47878, 0x0c0b8788, 0x6c6bcfd0,
-        0x93943030, 0xcfd06c6c, 0x302f9394, 0x7c7b9798, 0x83846868, 0x97987c7c, 0x68678384, 0x18181818,
-        0xe7e7e7e8, 0x2c2c2c2c, 0xd3d3d3d4, 0x54545454, 0xabababac, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04040404,
-        0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
-        0x04040404, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
-        0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000,
-        0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000,
-        0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0x00000404,
-        0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404,
-        0x00000404, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
-        0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0x08080404, 0x08080404, 0x08080404, 0x08080404, 0x08080404,
-        0x08080404, 0x08080404, 0x08080404, 0x08080404, 0x08080404, 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc,
-        0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc, 0xf7f7fbfc, 0x04040808,
-        0x04040808, 0x04040808, 0x04040808, 0x04040808, 0x04040808, 0x04040808, 0x04040808, 0x04040808,
-        0x04040808, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a,
-        0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x05050f0f, 0xfafaf0f1, 0x0a09f5f6, 0xf5f60a0a, 0x0f0efafb,
-        0xf0f10505, 0xfafb0f0f, 0x0504f0f1, 0x14140a0a, 0xebebf5f6, 0x0a0a1414, 0xf5f5ebec, 0x14141414,
-        0xebebebec, 0x19190000, 0xe6e70000, 0x00001919, 0xffffe6e7, 0x1413f0f1, 0xebec0f0f, 0xf0f11414,
-        0x0f0eebec, 0x28281919, 0xd7d7e6e7, 0x19192828, 0xe6e6d7d8, 0x1e1df5f6, 0xe1e20a0a, 0xf5f61e1e,
-        0x0a09e1e2, 0x28280a0a, 0xd7d7f5f6, 0x0a0a2828, 0xf5f5d7d8, 0x28282828, 0xd7d7d7d8, 0x2d2d0000,
-        0xd2d30000, 0x00002d2d, 0xffffd2d3, 0x1e1de1e2, 0xe1e21e1e, 0x2827ebec, 0xd7d81414, 0xebec2828,
-        0x1413d7d8, 0x41411919, 0xbebee6e7, 0x19194141, 0xe6e6bebf, 0x46462d2d, 0xb9b9d2d3, 0x2d2d4646,
-        0xd2d2b9ba, 0x3736f0f1, 0xc8c90f0f, 0xf0f13737, 0x0f0ec8c9, 0x46460a0a, 0xb9b9f5f6, 0x0a0a4646,
-        0xf5f5b9ba, 0x4b4b4b4b, 0xb4b4b4b5, 0x5554fafb, 0xaaab0505, 0xfafb5555, 0x0504aaab, 0x3736d2d3,
-        0xc8c92d2d, 0xd2d33737, 0x2d2cc8c9, 0x4b4adcdd, 0xb4b52323, 0xdcdd4b4b, 0x2322b4b5, 0x73733737,
-        0x8c8cc8c9, 0x37377373, 0xc8c88c8d, 0x73731e1e, 0x8c8ce1e2, 0x1e1e7373, 0xe1e18c8d, 0x78785a5a,
-        0x8787a5a6, 0x5a5a7878, 0xa5a58788, 0x6968e1e2, 0x96971e1e, 0xe1e26969, 0x1e1d9697, 0x5554aaab,
-        0xaaab5555, 0x6968b9ba, 0x96974646, 0xb9ba6969, 0x46459697, 0x1e1e1e1e, 0xe1e1e1e2, 0x3c3c3c3c,
-        0xc3c3c3c4, 0x69696969, 0x96969697, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x05050505, 0x05050505,
-        0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505, 0x05050505,
-        0x05050505, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb,
-        0xfafafafb, 0xfafafafb, 0xfafafafb, 0xfafafafb, 0x05050000, 0x05050000, 0x05050000, 0x05050000,
-        0x05050000, 0x05050000, 0x05050000, 0x05050000, 0x05050000, 0x05050000, 0x05050000, 0xfafb0000,
-        0xfafb0000, 0xfafb0000, 0xfafb0000, 0xfafb0000, 0xfafb0000, 0xfafb0000, 0xfafb0000, 0xfafb0000,
-        0xfafb0000, 0xfafb0000, 0x00000505, 0x00000505, 0x00000505, 0x00000505, 0x00000505, 0x00000505,
-        0x00000505, 0x00000505, 0x00000505, 0x00000505, 0x00000505, 0xfffffafb, 0xfffffafb, 0xfffffafb,
-        0xfffffafb, 0xfffffafb, 0xfffffafb, 0xfffffafb, 0xfffffafb, 0xfffffafb, 0xfffffafb, 0xfffffafb,
-        0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a,
-        0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6,
-        0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0x0f0f0505, 0x0f0f0505,
-        0x0f0f0505, 0x0f0f0505, 0x0f0f0505, 0x0f0f0505, 0x0f0f0505, 0x0f0f0505, 0x0f0f0505, 0x0f0f0505,
-        0x0f0f0505, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb,
-        0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0xf0f0fafb, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0xf9f9f3f4, 0x0c0bf3f4, 0xf3f40c0c, 0x1211f9fa,
-        0xedee0606, 0xf9fa1212, 0x0605edee, 0x18180c0c, 0xe7e7f3f4, 0x0c0c1818, 0xf3f3e7e8, 0x18181818,
-        0xe7e7e7e8, 0x1e1e0000, 0xe1e20000, 0x00001e1e, 0xffffe1e2, 0x1817edee, 0xe7e81212, 0xedee1818,
-        0x1211e7e8, 0x30301e1e, 0xcfcfe1e2, 0x1e1e3030, 0xe1e1cfd0, 0x2423f9fa, 0xdbdc0606, 0xf9fa2424,
-        0x0605dbdc, 0x30300c0c, 0xcfcff3f4, 0x0c0c3030, 0xf3f3cfd0, 0x30303030, 0xcfcfcfd0, 0x36360000,
-        0xc9ca0000, 0x00003636, 0xffffc9ca, 0x2423dbdc, 0xdbdc2424, 0x302fe7e8, 0xcfd01818, 0xe7e83030,
-        0x1817cfd0, 0x4e4e1e1e, 0xb1b1e1e2, 0x1e1e4e4e, 0xe1e1b1b2, 0x54543636, 0xababc9ca, 0x36365454,
-        0xc9c9abac, 0x4241edee, 0xbdbe1212, 0xedee4242, 0x1211bdbe, 0x54540c0c, 0xababf3f4, 0x0c0c5454,
-        0xf3f3abac, 0x5a5a5a5a, 0xa5a5a5a6, 0x605ff9fa, 0x9fa00606, 0xf9fa6060, 0x06059fa0, 0x4241c9ca,
-        0xbdbe3636, 0xc9ca4242, 0x3635bdbe, 0x5a59d5d6, 0xa5a62a2a, 0xd5d65a5a, 0x2a29a5a6, 0x7e7de1e2,
-        0x81821e1e, 0xe1e27e7e, 0x1e1d8182, 0x6665999a, 0x999a6666, 0x7e7dabac, 0x81825454, 0xabac7e7e,
-        0x54538182, 0x24242424, 0xdbdbdbdc, 0x42424242, 0xbdbdbdbe, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000,
-        0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
-        0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
-        0xf9fa0000, 0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606,
-        0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
-        0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
-        0xfffff9fa, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606,
-        0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0x0c0c0606, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa,
-        0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa, 0xf3f3f9fa,
-        0xf3f3f9fa, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c,
-        0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x06060c0c, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e,
-        0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0xf8f8eaeb, 0x0e0df1f2, 0xf1f20e0e, 0x1514f8f9,
-        0xeaeb0707, 0xf8f91515, 0x0706eaeb, 0x1c1c0e0e, 0xe3e3f1f2, 0x0e0e1c1c, 0xf1f1e3e4, 0x1c1c1c1c,
-        0xe3e3e3e4, 0x23230000, 0xdcdd0000, 0x00002323, 0xffffdcdd, 0x1c1beaeb, 0xe3e41515, 0xeaeb1c1c,
-        0x1514e3e4, 0x38382323, 0xc7c7dcdd, 0x23233838, 0xdcdcc7c8, 0x2a29f1f2, 0xd5d60e0e, 0xf1f22a2a,
-        0x0e0dd5d6, 0x38380e0e, 0xc7c7f1f2, 0x0e0e3838, 0xf1f1c7c8, 0x38383838, 0xc7c7c7c8, 0x3f3f0000,
-        0xc0c10000, 0x00003f3f, 0xffffc0c1, 0x2a29d5d6, 0xd5d62a2a, 0x3837e3e4, 0xc7c81c1c, 0xe3e43838,
-        0x1c1bc7c8, 0x5b5b2323, 0xa4a4dcdd, 0x23235b5b, 0xdcdca4a5, 0x62623f3f, 0x9d9dc0c1, 0x3f3f6262,
-        0xc0c09d9e, 0x4d4ceaeb, 0xb2b31515, 0xeaeb4d4d, 0x1514b2b3, 0x62620e0e, 0x9d9df1f2, 0x0e0e6262,
-        0xf1f19d9e, 0x69696969, 0x96969697, 0x7776f8f9, 0x88890707, 0xf8f97777, 0x07068889, 0x4d4cc0c1,
-        0xb2b33f3f, 0xc0c14d4d, 0x3f3eb2b3, 0x6968cecf, 0x96973131, 0xcecf6969, 0x31309697, 0x77768889,
-        0x88897777, 0x2a2a2a2a, 0xd5d5d5d6, 0x4d4d4d4d, 0xb2b2b2b3, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707,
-        0x07070707, 0x07070707, 0x07070707, 0x07070707, 0x07070707, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
-        0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9, 0xf8f8f8f9,
-        0xf8f8f8f9, 0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000,
-        0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000, 0xf8f90000, 0xf8f90000, 0xf8f90000,
-        0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000,
-        0xf8f90000, 0x00000707, 0x00000707, 0x00000707, 0x00000707, 0x00000707, 0x00000707, 0x00000707,
-        0x00000707, 0x00000707, 0x00000707, 0x00000707, 0x00000707, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9,
-        0xfffff8f9, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9, 0xfffff8f9,
-        0xfffff8f9, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e,
-        0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0x0e0e0e0e, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2,
-        0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2, 0xf1f1f1f2,
-        0xf1f1f1f2, 0x15150707, 0x15150707, 0x15150707, 0x15150707, 0x15150707, 0x15150707, 0x15150707,
-        0x15150707, 0x15150707, 0x15150707, 0x15150707, 0x15150707, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9,
-        0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9, 0xeaeaf8f9,
-        0xeaeaf8f9, 0x07071515, 0x07071515, 0x07071515, 0x07071515, 0x07071515, 0x07071515, 0x07071515,
-        0x07071515, 0x07071515, 0x07071515, 0x07071515, 0x07071515, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808, 0xfffff7f8, 0x10101010,
-        0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0xf7f7eff0, 0x100feff0, 0xeff01010, 0x1817f7f8,
-        0xe7e80808, 0xf7f81818, 0x0807e7e8, 0x20201010, 0xdfdfeff0, 0x10102020, 0xefefdfe0, 0x20202020,
-        0xdfdfdfe0, 0x28280000, 0xd7d80000, 0x00002828, 0xffffd7d8, 0x201fe7e8, 0xdfe01818, 0xe7e82020,
-        0x1817dfe0, 0x40402828, 0xbfbfd7d8, 0x28284040, 0xd7d7bfc0, 0x302feff0, 0xcfd01010, 0xeff03030,
-        0x100fcfd0, 0x40401010, 0xbfbfeff0, 0x10104040, 0xefefbfc0, 0x40404040, 0xbfbfbfc0, 0x48480000,
-        0xb7b80000, 0x00004848, 0xffffb7b8, 0x302fcfd0, 0xcfd03030, 0x403fdfe0, 0xbfc02020, 0xdfe04040,
-        0x201fbfc0, 0x68682828, 0x9797d7d8, 0x28286868, 0xd7d79798, 0x70704848, 0x8f8fb7b8, 0x48487070,
-        0xb7b78f90, 0x5857e7e8, 0xa7a81818, 0xe7e85858, 0x1817a7a8, 0x70701010, 0x8f8feff0, 0x10107070,
-        0xefef8f90, 0x78787878, 0x87878788, 0x5857b7b8, 0xa7a84848, 0xb7b85858, 0x4847a7a8, 0x7877c7c8,
-        0x87883838, 0xc7c87878, 0x38378788, 0x30303030, 0xcfcfcfd0, 0x58585858, 0xa7a7a7a8, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808,
-        0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0x08080808, 0xf7f7f7f8,
-        0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8,
-        0xf7f7f7f8, 0xf7f7f7f8, 0xf7f7f7f8, 0x08080000, 0x08080000, 0x08080000, 0x08080000, 0x08080000,
-        0x08080000, 0x08080000, 0x08080000, 0x08080000, 0x08080000, 0x08080000, 0x08080000, 0xf7f80000,
-        0xf7f80000, 0xf7f80000, 0xf7f80000, 0xf7f80000, 0xf7f80000, 0xf7f80000, 0xf7f80000, 0xf7f80000,
-        0xf7f80000, 0xf7f80000, 0xf7f80000, 0x00000808, 0x00000808, 0x00000808, 0x00000808, 0x00000808,
-        0x00000808, 0x00000808, 0x00000808, 0x00000808, 0x00000808, 0x00000808, 0x00000808, 0xfffff7f8,
-        0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0xfffff7f8,
-        0xfffff7f8, 0xfffff7f8, 0xfffff7f8, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010,
-        0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0x10101010, 0xefefeff0,
-        0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0, 0xefefeff0,
-        0xefefeff0, 0xefefeff0, 0xefefeff0, 0x10100808, 0x10100808, 0x10100808, 0x10100808, 0x10100808,
-        0x10100808, 0x10100808, 0x10100808, 0x10100808, 0x10100808, 0x10100808, 0x10100808, 0xefeff7f8,
-        0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0xefeff7f8,
-        0xefeff7f8, 0xefeff7f8, 0xefeff7f8, 0x08081010, 0x08081010, 0x08081010, 0x08081010, 0x08081010,
-        0x08081010, 0x08081010, 0x08081010, 0x08081010, 0x08081010, 0x08081010, 0x08081010, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212,
-        0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x1211edee, 0xedee1212, 0x1b1af6f7,
-        0xe4e50909, 0xf6f71b1b, 0x0908e4e5, 0x24241212, 0xdbdbedee, 0x12122424, 0xededdbdc, 0x24242424,
-        0xdbdbdbdc, 0x2d2d0000, 0xd2d30000, 0x00002d2d, 0xffffd2d3, 0x2423e4e5, 0xdbdc1b1b, 0xe4e52424,
-        0x1b1adbdc, 0x48482d2d, 0xb7b7d2d3, 0x2d2d4848, 0xd2d2b7b8, 0x3635edee, 0xc9ca1212, 0xedee3636,
-        0x1211c9ca, 0x48481212, 0xb7b7edee, 0x12124848, 0xededb7b8, 0x48484848, 0xb7b7b7b8, 0x51510000,
-        0xaeaf0000, 0x00005151, 0xffffaeaf, 0x3635c9ca, 0xc9ca3636, 0x4847dbdc, 0xb7b82424, 0xdbdc4848,
-        0x2423b7b8, 0x75752d2d, 0x8a8ad2d3, 0x2d2d7575, 0xd2d28a8b, 0x7e7e5151, 0x8181aeaf, 0x51517e7e,
-        0xaeae8182, 0x6362e4e5, 0x9c9d1b1b, 0xe4e56363, 0x1b1a9c9d, 0x6362aeaf, 0x9c9d5151, 0xaeaf6363,
-        0x51509c9d, 0x36363636, 0xc9c9c9ca, 0x6c6c6c6c, 0x93939394, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909,
-        0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0x09090909, 0xf6f6f6f7,
-        0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7,
-        0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0xf6f6f6f7, 0x09090000, 0x09090000, 0x09090000, 0x09090000,
-        0x09090000, 0x09090000, 0x09090000, 0x09090000, 0x09090000, 0x09090000, 0x09090000, 0x09090000,
-        0x09090000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000,
-        0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0xf6f70000, 0x00000909, 0x00000909,
-        0x00000909, 0x00000909, 0x00000909, 0x00000909, 0x00000909, 0x00000909, 0x00000909, 0x00000909,
-        0x00000909, 0x00000909, 0x00000909, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7,
-        0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7, 0xfffff6f7,
-        0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212,
-        0x12121212, 0x12121212, 0x12121212, 0x12121212, 0x12121212, 0xedededee, 0xedededee, 0xedededee,
-        0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee, 0xedededee,
-        0xedededee, 0xedededee, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909,
-        0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0x1b1b0909, 0xe4e4f6f7,
-        0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7,
-        0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0xe4e4f6f7, 0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b,
-        0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b, 0x09091b1b,
-        0x09091b1b, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5,
-        0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0xf6f6e4e5, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606,
-        0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0504fafb, 0xfafb0505, 0xfafb0505,
-        0x0504fafb, 0x0b0b0606, 0xf4f4f9fa, 0x06060b0b, 0xf9f9f4f5, 0x08080000, 0xf7f80000, 0x00000808,
-        0xfffff7f8, 0x0b0b0b0b, 0xf4f4f4f5, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x11110c0c,
-        0xeeeef3f4, 0x0c0c1111, 0xf3f3eeef, 0x11111111, 0xeeeeeeef, 0x12120606, 0xededf9fa, 0x06061212,
-        0xf9f9edee, 0x0b0af7f8, 0xf4f50808, 0xf7f80b0b, 0x0807f4f5, 0x0f0f0000, 0xf0f10000, 0x00000f0f,
-        0xfffff0f1, 0x14140000, 0xebec0000, 0x00001414, 0xffffebec, 0x19191212, 0xe6e6edee, 0x12121919,
-        0xedede6e7, 0x19190b0b, 0xe6e6f4f5, 0x0b0b1919, 0xf4f4e6e7, 0x19191919, 0xe6e6e6e7, 0x0e0df1f2,
-        0xf1f20e0e, 0xf1f20e0e, 0x0e0df1f2, 0x1a1a0000, 0xe5e60000, 0x00001a1a, 0xffffe5e6, 0x1211f4f5,
-        0xedee0b0b, 0xf4f51212, 0x0b0aedee, 0x1615f8f9, 0xe9ea0707, 0xf8f91616, 0x0706e9ea, 0x22221a1a,
-        0xdddde5e6, 0x1a1a2222, 0xe5e5ddde, 0x22221212, 0xddddedee, 0x12122222, 0xededddde, 0x22222222,
-        0xddddddde, 0x23230b0b, 0xdcdcf4f5, 0x0b0b2323, 0xf4f4dcdd, 0x1d1d0000, 0xe2e30000, 0x00001d1d,
-        0xffffe2e3, 0x1615eced, 0xe9ea1313, 0xeced1616, 0x1312e9ea, 0x1a19f0f1, 0xe5e60f0f, 0xf0f11a1a,
-        0x0f0ee5e6, 0x25250000, 0xdadb0000, 0x00002525, 0xffffdadb, 0x2c2c1b1b, 0xd3d3e4e5, 0x1b1b2c2c,
-        0xe4e4d3d4, 0x2c2c2424, 0xd3d3dbdc, 0x24242c2c, 0xdbdbd3d4, 0x2c2c1212, 0xd3d3edee, 0x12122c2c,
-        0xededd3d4, 0x2120f5f6, 0xdedf0a0a, 0xf5f62121, 0x0a09dedf, 0x2d2d2d2d, 0xd2d2d2d3, 0x00000000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606,
-        0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000,
-        0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000,
-        0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd,
-        0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000,
-        0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
-        0x07070000, 0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303,
-        0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe,
-        0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606,
-        0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x03030000, 0xfcfd0000,
-        0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000, 0xf8f90000, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x07070000,
-        0xf8f90000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0403fbfc, 0xfbfc0404, 0xf9fa0a0a,
-        0x0605f5f6, 0xf3f40000, 0x0c0c0000, 0xf3f3f9fa, 0xf3f40606, 0x0c0bf9fa, 0x0c0c0606, 0xfffff1f2,
-        0x00000e0e, 0x0c0c0c0c, 0xf3f3f3f4, 0xedee0000, 0x12120000, 0xf3f40e0e, 0x0c0bf1f2, 0xf9f9edee,
-        0xf9fa1212, 0x0605edee, 0x06061212, 0xededf5f6, 0xedee0a0a, 0x1211f5f6, 0x12120a0a, 0xffffe9ea,
-        0x00001616, 0xe7e80000, 0x18180000, 0xf3f3e9ea, 0xf3f41616, 0x0c0be9ea, 0x0c0c1616, 0xe7e7f7f8,
-        0xe7e80808, 0x1817f7f8, 0x18180808, 0xf9f9e5e6, 0xf9fa1a1a, 0x0605e5e6, 0x06061a1a, 0xffffe3e4,
-        0x00001c1c, 0x14141414, 0xebebebec, 0xe5e5f1f2, 0x1a1a0e0e, 0xf3f3e1e2, 0x0c0c1e1e, 0xdfdff5f6,
-        0x20200a0a, 0xdfdfedee, 0x20201212, 0xe5e5e5e6, 0x1a1a1a1a, 0xebebddde, 0x14142222, 0xf3f3d9da,
-        0x0c0c2626, 0xdfdfdfe0, 0x20202020, 0x20202020, 0xd7d7e9ea, 0xddddddde, 0x22222222, 0x00000000,
-        0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
-        0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606,
-        0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe,
-        0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000,
-        0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000,
-        0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000,
-        0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000,
-        0x00000606, 0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000,
-        0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
-        0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606,
-        0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe,
-        0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000,
-        0xfdfe0000, 0x00000202, 0xfffffdfe, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000,
-        0xf9fa0000, 0x00000606, 0xfffff9fa, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a,
-        0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x0605f9fa, 0xf9fa0606, 0xf7f80e0e,
-        0x0807f1f2, 0xffffedee, 0x00001212, 0xeff00a0a, 0x100ff5f6, 0xe7e80000, 0x18180000, 0xf7f7e7e8,
-        0xf7f81818, 0x0807e7e8, 0x08081818, 0x12121212, 0xedededee, 0xeff01414, 0x100febec, 0xe5e5f1f2,
-        0xe5e60e0e, 0x1a19f1f2, 0x1a1a0e0e, 0xffffe1e2, 0x00001e1e, 0xddde0000, 0x22220000, 0xf7f7ddde,
-        0xf7f82222, 0x0807ddde, 0x08082222, 0xedede1e2, 0xedee1e1e, 0x1211e1e2, 0x12121e1e, 0xddddf5f6,
-        0xddde0a0a, 0x2221f5f6, 0x22220a0a, 0xddddebec, 0x22221414, 0xffffd7d8, 0x00002828, 0x1e1e1e1e,
-        0xe1e1e1e2, 0xededd7d8, 0x12122828, 0xd3d40000, 0x2c2c0000, 0xd3d3eff0, 0x2c2c1010, 0xdbdbdbdc,
-        0xdbdbdbdc, 0x24242424, 0xd3d3e5e6, 0x2c2c1a1a, 0xe5e5d1d2, 0x1a1a2e2e, 0xededcbcc, 0x12123434,
-        0xc9c9ebec, 0xd3d3d3d4, 0x2c2c2c2c, 0xc9c9dfe0, 0xd1d1d1d2, 0xd1d1d1d2, 0x2e2e2e2e, 0x00000000,
-        0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6,
-        0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
-        0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a,
-        0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc,
-        0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000,
-        0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000,
-        0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
-        0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6,
-        0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a,
-        0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000,
-        0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000,
-        0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404,
-        0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000,
-        0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6,
-        0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202,
-        0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a,
-        0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc,
-        0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000,
-        0xfdfe0000, 0x00000202, 0xfffffdfe, 0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000,
-        0xf5f60000, 0x00000a0a, 0xfffff5f6, 0x00000000, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
-        0x04040404, 0xfbfbfbfc, 0x0a0a0a0a, 0xf5f5f5f6, 0x0a0a0000, 0xf5f60000, 0x00000a0a, 0xfffff5f6,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x0807f7f8, 0xf7f80808, 0xeff00808,
-        0x100ff7f8, 0xe7e80000, 0x18180000, 0xf7f7e7e8, 0xf7f81818, 0x0807e7e8, 0x08081818, 0xeff01414,
-        0x100febec, 0xffffe3e4, 0x00001c1c, 0xe7e7eff0, 0xe7e81010, 0x1817eff0, 0x18181010, 0xdfe00000,
-        0x20200000, 0xefefe3e4, 0xeff01c1c, 0x100fe3e4, 0x10101c1c, 0xdfdff7f8, 0xdfe00808, 0xf7f7dfe0,
-        0xf7f82020, 0x0807dfe0, 0x08082020, 0x201ff7f8, 0x20200808, 0x18181818, 0xe7e7e7e8, 0xe7e81818,
-        0x1817e7e8, 0xdfdfebec, 0x20201414, 0xffffd7d8, 0x00002828, 0xefefd7d8, 0x10102828, 0xd3d40000,
-        0xd3d40000, 0xffffd3d4, 0x00002c2c, 0x2c2c0000, 0x2c2c0000, 0xdfdfdfe0, 0x20202020, 0xd3d3eff0,
-        0x2c2c1010, 0xd3d3e7e8, 0xe7e7d3d4, 0x18182c2c, 0x2c2c1818, 0xefefcfd0, 0x10103030, 0xdbdbdbdc,
-        0xdbdbdbdc, 0x24242424, 0x24242424, 0xcbcbebec, 0x28282828, 0xd7d7d7d8, 0xcbcbdfe0, 0x00000000,
-        0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404,
-        0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c,
-        0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000,
-        0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000,
-        0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc,
-        0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4,
-        0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000,
-        0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000,
-        0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404,
-        0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000,
-        0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404,
-        0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c,
-        0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000,
-        0xfbfc0000, 0x00000404, 0xfffffbfc, 0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000,
-        0xf3f40000, 0x00000c0c, 0xfffff3f4, 0x00000000, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc,
-        0x04040404, 0xfbfbfbfc, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0000, 0xf3f40000, 0x00000c0c, 0xfffff3f4,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
-        0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
-        0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
-        0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
-        0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
-        0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
-        0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414,
-        0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe,
-        0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0,
-        0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c,
-        0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec,
-        0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606,
-        0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e,
-        0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4,
-        0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x06060606, 0xf9f9f9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020,
-        0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x06060606, 0xf9f9f9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x14141414, 0xebebebec, 0x20202020, 0xdfdfdfe0, 0x2e2e2e2e, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
-};
-
-
-static const uint32_t correctionhighorder[] = {
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101,
-        0xfeff0303, 0x0100fcfd, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303,
-        0x0100fcfd, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd, 0x00000000, 0x02020202, 0xfdfdfdfe,
-        0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9,
-        0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707,
-        0xf8f8f8f9, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc,
-        0x07070707, 0xf8f8f8f9, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404,
-        0x0100fbfc, 0x07070707, 0xf8f8f8f9, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101,
-        0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x0403feff,
-        0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9, 0x00000000, 0x03030303, 0xfcfcfcfd,
-        0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9, 0x00000000, 0x03030303,
-        0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9, 0x00000000,
-        0x03030303, 0xfcfcfcfd, 0x0403feff, 0xfbfc0101, 0xfeff0404, 0x0100fbfc, 0x07070707, 0xf8f8f8f9,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x04040404, 0xfbfbfbfc,
-        0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000,
-        0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd,
-        0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb,
-        0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101,
-        0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc,
-        0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000,
-        0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd,
-        0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb,
-        0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101,
-        0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000, 0x04040404, 0xfbfbfbfc,
-        0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd, 0x03030a0a, 0x00000000,
-        0x04040404, 0xfbfbfbfc, 0x0504feff, 0xfafb0101, 0xfeff0505, 0x0100fafb, 0x0a0a0303, 0xf5f5fcfd,
-        0x03030a0a, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202,
-        0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505,
-        0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303,
-        0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9,
-        0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe,
-        0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000,
-        0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5,
-        0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707,
-        0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb,
-        0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd,
-        0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b,
-        0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202,
-        0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x05050505,
-        0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9, 0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303,
-        0xf2f2fcfd, 0x00000000, 0x05050505, 0xfafafafb, 0x0706fdfe, 0xf8f90202, 0xfdfe0707, 0x0201f8f9,
-        0x0b0b0b0b, 0xf4f4f4f5, 0x0d0d0303, 0xf2f2fcfd, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
-        0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
-        0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
-        0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
-        0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
-        0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
-        0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
-        0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
-        0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
-        0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
-        0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8, 0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc,
-        0x04040f0f, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x0807fdfe, 0xf7f80202, 0xfdfe0808, 0x0201f7f8,
-        0x0d0d0d0d, 0xf2f2f2f3, 0x0f0f0404, 0xf0f0fbfc, 0x04040f0f, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010, 0xefefeff0, 0x12120505, 0xededfafb,
-        0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
-        0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010, 0xefefeff0, 0x12120505, 0xededfafb,
-        0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
-        0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010, 0xefefeff0, 0x12120505, 0xededfafb,
-        0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
-        0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010, 0xefefeff0, 0x12120505, 0xededfafb,
-        0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
-        0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010, 0xefefeff0, 0x12120505, 0xededfafb,
-        0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
-        0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6, 0x10101010, 0xefefeff0, 0x12120505, 0xededfafb,
-        0x05051212, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x0a09fcfd, 0xf5f60303, 0xfcfd0a0a, 0x0302f5f6,
-        0x10101010, 0xefefeff0, 0x12120505, 0xededfafb, 0x05051212, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee,
-        0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
-        0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee,
-        0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
-        0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee,
-        0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
-        0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee,
-        0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
-        0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee,
-        0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
-        0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303, 0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee,
-        0x14140505, 0xebebfafb, 0x05051414, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x0b0afcfd, 0xf4f50303,
-        0xfcfd0b0b, 0x0302f4f5, 0x12121212, 0xedededee, 0x14140505, 0xebebfafb, 0x05051414, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x09090909, 0xf6f6f6f7,
-        0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa,
-        0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
-        0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000,
-        0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec,
-        0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd,
-        0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717,
-        0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4,
-        0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909,
-        0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606,
-        0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303,
-        0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9,
-        0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414,
-        0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7,
-        0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa,
-        0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c,
-        0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000,
-        0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec,
-        0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd,
-        0xf3f40303, 0xfcfd0c0c, 0x0302f3f4, 0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717,
-        0xf9f9e8e9, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x0c0bfcfd, 0xf3f40303, 0xfcfd0c0c, 0x0302f3f4,
-        0x14141414, 0xebebebec, 0x17170606, 0xe8e8f9fa, 0x06061717, 0xf9f9e8e9, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000,
-        0x00000202, 0xfffffdfe, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202,
-        0xfffffdfe, 0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe,
-        0x00000000, 0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x00000000,
-        0x02020202, 0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x00000000, 0x02020202,
-        0xfdfdfdfe, 0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x00000000, 0x02020202, 0xfdfdfdfe,
-        0x02020000, 0xfdfe0000, 0x00000202, 0xfffffdfe, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
-        0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606,
-        0xf9f9f9fa, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd,
-        0x06060606, 0xf9f9f9fa, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303,
-        0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000,
-        0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x00000000, 0x03030303, 0xfcfcfcfd, 0x03030000,
-        0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x00000000, 0x03030303, 0xfcfcfcfd,
-        0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x00000000, 0x03030303,
-        0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa, 0x00000000,
-        0x03030303, 0xfcfcfcfd, 0x03030000, 0xfcfd0000, 0x00000303, 0xfffffcfd, 0x06060606, 0xf9f9f9fa,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x04040404, 0xfbfbfbfc,
-        0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000,
-        0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc,
-        0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc,
-        0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000,
-        0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc,
-        0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000,
-        0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc,
-        0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc,
-        0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000,
-        0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000, 0x04040404, 0xfbfbfbfc,
-        0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc, 0x04040808, 0x00000000,
-        0x04040404, 0xfbfbfbfc, 0x04040000, 0xfbfc0000, 0x00000404, 0xfffffbfc, 0x08080404, 0xf7f7fbfc,
-        0x04040808, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000,
-        0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505,
-        0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505,
-        0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb,
-        0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000,
-        0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000,
-        0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6,
-        0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505,
-        0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb,
-        0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb,
-        0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a,
-        0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000,
-        0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x05050505,
-        0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb, 0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505,
-        0xf0f0fafb, 0x00000000, 0x05050505, 0xfafafafb, 0x05050000, 0xfafb0000, 0x00000505, 0xfffffafb,
-        0x0a0a0a0a, 0xf5f5f5f6, 0x0f0f0505, 0xf0f0fafb, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
-        0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
-        0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
-        0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
-        0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
-        0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa,
-        0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa, 0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa,
-        0x06060c0c, 0x00000000, 0x06060606, 0xf9f9f9fa, 0x06060000, 0xf9fa0000, 0x00000606, 0xfffff9fa,
-        0x0c0c0c0c, 0xf3f3f3f4, 0x0c0c0606, 0xf3f3f9fa, 0x06060c0c, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
-        0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9,
-        0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
-        0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9,
-        0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
-        0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9,
-        0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
-        0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9,
-        0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
-        0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9,
-        0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9,
-        0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9, 0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9,
-        0x07071515, 0x00000000, 0x07070707, 0xf8f8f8f9, 0x07070000, 0xf8f90000, 0x00000707, 0xfffff8f9,
-        0x0e0e0e0e, 0xf1f1f1f2, 0x15150707, 0xeaeaf8f9, 0x07071515, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0,
-        0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000,
-        0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0,
-        0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000,
-        0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0,
-        0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000,
-        0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0,
-        0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000,
-        0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0,
-        0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000,
-        0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0x00000000,
-        0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000, 0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0,
-        0x10100808, 0xefeff7f8, 0x08081010, 0x00000000, 0x08080808, 0xf7f7f7f8, 0x08080000, 0xf7f80000,
-        0x00000808, 0xfffff7f8, 0x10101010, 0xefefeff0, 0x10100808, 0xefeff7f8, 0x08081010, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000, 0x09090909, 0xf6f6f6f7,
-        0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7,
-        0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909,
-        0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000,
-        0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee,
-        0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000,
-        0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b,
-        0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7,
-        0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909,
-        0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909,
-        0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000,
-        0x00000909, 0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5,
-        0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212,
-        0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7,
-        0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7,
-        0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909,
-        0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000,
-        0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee,
-        0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000,
-        0xf6f70000, 0x00000909, 0xfffff6f7, 0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b,
-        0xf6f6e4e5, 0x00000000, 0x09090909, 0xf6f6f6f7, 0x09090000, 0xf6f70000, 0x00000909, 0xfffff6f7,
-        0x12121212, 0xedededee, 0x1b1b0909, 0xe4e4f6f7, 0x09091b1b, 0xf6f6e4e5, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0x03030000, 0x03030000, 0x03030000, 0x03030000, 0x03030000, 0x03030000, 0x03030000,
-        0x03030000, 0x03030000, 0x03030000, 0x03030000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000,
-        0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0xfcfd0000, 0x00000303,
-        0x00000303, 0x00000303, 0x00000303, 0x00000303, 0x00000303, 0x00000303, 0x00000303, 0x00000303,
-        0x00000303, 0x00000303, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd,
-        0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0xfffffcfd, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000,
-        0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000, 0x07070000, 0xf8f90000, 0xf8f90000,
-        0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000, 0xf8f90000,
-        0xf8f90000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020000, 0x02020000, 0x02020000, 0x02020000,
-        0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000,
-        0x02020000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
-        0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0x00000202, 0x00000202,
-        0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202,
-        0x00000202, 0x00000202, 0x00000202, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
-        0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
-        0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0xfdfdfdfe, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0x06060000, 0x06060000, 0x06060000, 0x06060000,
-        0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000, 0x06060000,
-        0x06060000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000,
-        0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0xf9fa0000, 0x00000606, 0x00000606,
-        0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606, 0x00000606,
-        0x00000606, 0x00000606, 0x00000606, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
-        0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa, 0xfffff9fa,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020000, 0x02020000, 0x02020000, 0x02020000,
-        0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000, 0x02020000,
-        0x02020000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000,
-        0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0xfdfe0000, 0x00000202, 0x00000202,
-        0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202, 0x00000202,
-        0x00000202, 0x00000202, 0x00000202, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
-        0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe, 0xfffffdfe,
-        0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
-        0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
-        0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
-        0xfbfbfbfc, 0xfbfbfbfc, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a,
-        0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0x0a0a0a0a, 0xf5f5f5f6,
-        0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6,
-        0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0xf5f5f5f6, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000,
-        0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000, 0x0a0a0000,
-        0x0a0a0000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000,
-        0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0xf5f60000, 0x00000a0a, 0x00000a0a,
-        0x00000a0a, 0x00000a0a, 0x00000a0a, 0x00000a0a, 0x00000a0a, 0x00000a0a, 0x00000a0a, 0x00000a0a,
-        0x00000a0a, 0x00000a0a, 0x00000a0a, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6,
-        0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6, 0xfffff5f6,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04040000, 0x04040000, 0x04040000, 0x04040000,
-        0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000, 0x04040000,
-        0x04040000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000,
-        0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0xfbfc0000, 0x00000404, 0x00000404,
-        0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404, 0x00000404,
-        0x00000404, 0x00000404, 0x00000404, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
-        0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc, 0xfffffbfc,
-        0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404,
-        0x04040404, 0x04040404, 0x04040404, 0x04040404, 0x04040404, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
-        0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc, 0xfbfbfbfc,
-        0xfbfbfbfc, 0xfbfbfbfc, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000,
-        0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000, 0x0c0c0000,
-        0x0c0c0000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000,
-        0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0xf3f40000, 0x00000c0c, 0x00000c0c,
-        0x00000c0c, 0x00000c0c, 0x00000c0c, 0x00000c0c, 0x00000c0c, 0x00000c0c, 0x00000c0c, 0x00000c0c,
-        0x00000c0c, 0x00000c0c, 0x00000c0c, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4,
-        0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4, 0xfffff3f4,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
-        0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
-        0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
-        0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
-        0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
-        0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
-        0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,
-        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202, 0x02020202,
-        0x02020202, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe,
-        0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0xfdfdfdfe, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606, 0x06060606,
-        0x06060606, 0x06060606, 0x06060606, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa, 0xf9f9f9fa,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c,
-        0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0x0c0c0c0c, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4, 0xf3f3f3f4,
-        0xf3f3f3f4, 0xf3f3f3f4, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414,
-        0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0x14141414, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec,
-        0xebebebec, 0xebebebec, 0xebebebec, 0xebebebec, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020, 0x20202020,
-        0x20202020, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0,
-        0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0xdfdfdfe0, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e,
-        0x2e2e2e2e, 0x2e2e2e2e, 0x2e2e2e2e, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2, 0xd1d1d1d2,
-        0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
-};
-
-#endif /* AVCODEC_INDEO3DATA_H */
diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c
deleted file mode 100644
index 2593e55..0000000
--- a/libavcodec/indeo5.c
+++ /dev/null
@@ -1,827 +0,0 @@
-/*
- * Indeo Video Interactive v5 compatible decoder
- * Copyright (c) 2009 Maxim Poliakovski
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Indeo Video Interactive version 5 decoder
- *
- * Indeo5 data is usually transported within .avi or .mov files.
- * Known FOURCCs: 'IV50'
- */
-
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "ivi_dsp.h"
-#include "ivi_common.h"
-#include "indeo5data.h"
-
-/**
- *  Indeo5 frame types.
- */
-enum {
-    FRAMETYPE_INTRA       = 0,
-    FRAMETYPE_INTER       = 1,  ///< non-droppable P-frame
-    FRAMETYPE_INTER_SCAL  = 2,  ///< droppable P-frame used in the scalability mode
-    FRAMETYPE_INTER_NOREF = 3,  ///< droppable P-frame
-    FRAMETYPE_NULL        = 4   ///< empty frame with no data
-};
-
-#define IVI5_PIC_SIZE_ESC       15
-
-#define IVI5_IS_PROTECTED       0x20
-
-typedef struct {
-    GetBitContext   gb;
-    AVFrame         frame;
-    RVMapDesc       rvmap_tabs[9];   ///< local corrected copy of the static rvmap tables
-    IVIPlaneDesc    planes[3];       ///< color planes
-    const uint8_t   *frame_data;     ///< input frame data pointer
-    int             buf_switch;      ///< used to switch between three buffers
-    int             inter_scal;      ///< signals a sequence of scalable inter frames
-    int             dst_buf;         ///< buffer index for the currently decoded frame
-    int             ref_buf;         ///< inter frame reference buffer index
-    int             ref2_buf;        ///< temporal storage for switching buffers
-    uint32_t        frame_size;      ///< frame size in bytes
-    int             frame_type;
-    int             prev_frame_type; ///< frame type of the previous frame
-    int             frame_num;
-    uint32_t        pic_hdr_size;    ///< picture header size in bytes
-    uint8_t         frame_flags;
-    uint16_t        checksum;        ///< frame checksum
-
-    IVIHuffTab      mb_vlc;          ///< vlc table for decoding macroblock data
-
-    uint16_t        gop_hdr_size;
-    uint8_t         gop_flags;
-    int             is_scalable;
-    uint32_t        lock_word;
-    IVIPicConfig    pic_conf;
-} IVI5DecContext;
-
-
-/**
- *  Decodes Indeo5 GOP (Group of pictures) header.
- *  This header is present in key frames only.
- *  It defines parameters for all frames in a GOP.
- *
- *  @param ctx      [in,out] ptr to the decoder context
- *  @param avctx    [in] ptr to the AVCodecContext
- *  @return         result code: 0 = OK, -1 = error
- */
-static int decode_gop_header(IVI5DecContext *ctx, AVCodecContext *avctx)
-{
-    int             result, i, p, tile_size, pic_size_indx, mb_size, blk_size, blk_size_changed = 0;
-    IVIBandDesc     *band, *band1, *band2;
-    IVIPicConfig    pic_conf;
-
-    ctx->gop_flags = get_bits(&ctx->gb, 8);
-
-    ctx->gop_hdr_size = (ctx->gop_flags & 1) ? get_bits(&ctx->gb, 16) : 0;
-
-    if (ctx->gop_flags & IVI5_IS_PROTECTED)
-        ctx->lock_word = get_bits_long(&ctx->gb, 32);
-
-    tile_size = (ctx->gop_flags & 0x40) ? 64 << get_bits(&ctx->gb, 2) : 0;
-    if (tile_size > 256) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid tile size: %d\n", tile_size);
-        return -1;
-    }
-
-    /* decode number of wavelet bands */
-    /* num_levels * 3 + 1 */
-    pic_conf.luma_bands   = get_bits(&ctx->gb, 2) * 3 + 1;
-    pic_conf.chroma_bands = get_bits1(&ctx->gb)   * 3 + 1;
-    ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
-    if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
-        av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
-               pic_conf.luma_bands, pic_conf.chroma_bands);
-        return -1;
-    }
-
-    pic_size_indx = get_bits(&ctx->gb, 4);
-    if (pic_size_indx == IVI5_PIC_SIZE_ESC) {
-        pic_conf.pic_height = get_bits(&ctx->gb, 13);
-        pic_conf.pic_width  = get_bits(&ctx->gb, 13);
-    } else {
-        pic_conf.pic_height = ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2;
-        pic_conf.pic_width  = ivi5_common_pic_sizes[pic_size_indx * 2    ] << 2;
-    }
-
-    if (ctx->gop_flags & 2) {
-        av_log(avctx, AV_LOG_ERROR, "YV12 picture format not supported!\n");
-        return -1;
-    }
-
-    pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;
-    pic_conf.chroma_width  = (pic_conf.pic_width  + 3) >> 2;
-
-    if (!tile_size) {
-        pic_conf.tile_height = pic_conf.pic_height;
-        pic_conf.tile_width  = pic_conf.pic_width;
-    } else {
-        pic_conf.tile_height = pic_conf.tile_width = tile_size;
-    }
-
-    /* check if picture layout was changed and reallocate buffers */
-    if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) {
-        result = ff_ivi_init_planes(ctx->planes, &pic_conf);
-        if (result) {
-            av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n");
-            return -1;
-        }
-        ctx->pic_conf = pic_conf;
-        blk_size_changed = 1; /* force reallocation of the internal structures */
-    }
-
-    for (p = 0; p <= 1; p++) {
-        for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) {
-            band = &ctx->planes[p].bands[i];
-
-            band->is_halfpel = get_bits1(&ctx->gb);
-
-            mb_size  = get_bits1(&ctx->gb);
-            blk_size = 8 >> get_bits1(&ctx->gb);
-            mb_size  = blk_size << !mb_size;
-
-            blk_size_changed = mb_size != band->mb_size || blk_size != band->blk_size;
-            if (blk_size_changed) {
-                band->mb_size  = mb_size;
-                band->blk_size = blk_size;
-            }
-
-            if (get_bits1(&ctx->gb)) {
-                av_log(avctx, AV_LOG_ERROR, "Extended transform info encountered!\n");
-                return -1;
-            }
-
-            /* select transform function and scan pattern according to plane and band number */
-            switch ((p << 2) + i) {
-            case 0:
-                band->inv_transform = ff_ivi_inverse_slant_8x8;
-                band->dc_transform  = ff_ivi_dc_slant_2d;
-                band->scan          = ff_zigzag_direct;
-                break;
-
-            case 1:
-                band->inv_transform = ff_ivi_row_slant8;
-                band->dc_transform  = ff_ivi_dc_row_slant;
-                band->scan          = ivi5_scans8x8[0];
-                break;
-
-            case 2:
-                band->inv_transform = ff_ivi_col_slant8;
-                band->dc_transform  = ff_ivi_dc_col_slant;
-                band->scan          = ivi5_scans8x8[1];
-                break;
-
-            case 3:
-                band->inv_transform = ff_ivi_put_pixels_8x8;
-                band->dc_transform  = ff_ivi_put_dc_pixel_8x8;
-                band->scan          = ivi5_scans8x8[1];
-                break;
-
-            case 4:
-                band->inv_transform = ff_ivi_inverse_slant_4x4;
-                band->dc_transform  = ff_ivi_dc_slant_2d;
-                band->scan          = ivi5_scan4x4;
-                break;
-            }
-
-            band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 ||
-                                band->inv_transform == ff_ivi_inverse_slant_4x4;
-
-            /* select dequant matrix according to plane and band number */
-            if (!p) {
-                band->quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0;
-            } else {
-                band->quant_mat = 5;
-            }
-
-            if (get_bits(&ctx->gb, 2)) {
-                av_log(avctx, AV_LOG_ERROR, "End marker missing!\n");
-                return -1;
-            }
-        }
-    }
-
-    /* copy chroma parameters into the 2nd chroma plane */
-    for (i = 0; i < pic_conf.chroma_bands; i++) {
-        band1 = &ctx->planes[1].bands[i];
-        band2 = &ctx->planes[2].bands[i];
-
-        band2->width         = band1->width;
-        band2->height        = band1->height;
-        band2->mb_size       = band1->mb_size;
-        band2->blk_size      = band1->blk_size;
-        band2->is_halfpel    = band1->is_halfpel;
-        band2->quant_mat     = band1->quant_mat;
-        band2->scan          = band1->scan;
-        band2->inv_transform = band1->inv_transform;
-        band2->dc_transform  = band1->dc_transform;
-        band2->is_2d_trans   = band1->is_2d_trans;
-    }
-
-    /* reallocate internal structures if needed */
-    if (blk_size_changed) {
-        result = ff_ivi_init_tiles(ctx->planes, pic_conf.tile_width,
-                                   pic_conf.tile_height);
-        if (result) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Couldn't reallocate internal structures!\n");
-            return -1;
-        }
-    }
-
-    if (ctx->gop_flags & 8) {
-        if (get_bits(&ctx->gb, 3)) {
-            av_log(avctx, AV_LOG_ERROR, "Alignment bits are not zero!\n");
-            return -1;
-        }
-
-        if (get_bits1(&ctx->gb))
-            skip_bits_long(&ctx->gb, 24); /* skip transparency fill color */
-    }
-
-    align_get_bits(&ctx->gb);
-
-    skip_bits(&ctx->gb, 23); /* FIXME: unknown meaning */
-
-    /* skip GOP extension if any */
-    if (get_bits1(&ctx->gb)) {
-        do {
-            i = get_bits(&ctx->gb, 16);
-        } while (i & 0x8000);
-    }
-
-    align_get_bits(&ctx->gb);
-
-    return 0;
-}
-
-
-/**
- *  Skips a header extension.
- *
- *  @param gb   [in,out] the GetBit context
- */
-static inline void skip_hdr_extension(GetBitContext *gb)
-{
-    int i, len;
-
-    do {
-        len = get_bits(gb, 8);
-        for (i = 0; i < len; i++) skip_bits(gb, 8);
-    } while(len);
-}
-
-
-/**
- *  Decodes Indeo5 picture header.
- *
- *  @param ctx      [in,out] ptr to the decoder context
- *  @param avctx    [in] ptr to the AVCodecContext
- *  @return         result code: 0 = OK, -1 = error
- */
-static int decode_pic_hdr(IVI5DecContext *ctx, AVCodecContext *avctx)
-{
-    if (get_bits(&ctx->gb, 5) != 0x1F) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid picture start code!\n");
-        return -1;
-    }
-
-    ctx->prev_frame_type = ctx->frame_type;
-    ctx->frame_type      = get_bits(&ctx->gb, 3);
-    if (ctx->frame_type >= 5) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid frame type: %d \n", ctx->frame_type);
-        return -1;
-    }
-
-    ctx->frame_num = get_bits(&ctx->gb, 8);
-
-    if (ctx->frame_type == FRAMETYPE_INTRA) {
-        if (decode_gop_header(ctx, avctx))
-            return -1;
-    }
-
-    if (ctx->frame_type != FRAMETYPE_NULL) {
-        ctx->frame_flags = get_bits(&ctx->gb, 8);
-
-        ctx->pic_hdr_size = (ctx->frame_flags & 1) ? get_bits_long(&ctx->gb, 24) : 0;
-
-        ctx->checksum = (ctx->frame_flags & 0x10) ? get_bits(&ctx->gb, 16) : 0;
-
-        /* skip unknown extension if any */
-        if (ctx->frame_flags & 0x20)
-            skip_hdr_extension(&ctx->gb); /* XXX: untested */
-
-        /* decode macroblock huffman codebook */
-        if (ff_ivi_dec_huff_desc(&ctx->gb, ctx->frame_flags & 0x40, IVI_MB_HUFF, &ctx->mb_vlc, avctx))
-            return -1;
-
-        skip_bits(&ctx->gb, 3); /* FIXME: unknown meaning! */
-    }
-
-    align_get_bits(&ctx->gb);
-
-    return 0;
-}
-
-
-/**
- *  Decodes Indeo5 band header.
- *
- *  @param ctx      [in,out] ptr to the decoder context
- *  @param band     [in,out] ptr to the band descriptor
- *  @param avctx    [in] ptr to the AVCodecContext
- *  @return         result code: 0 = OK, -1 = error
- */
-static int decode_band_hdr(IVI5DecContext *ctx, IVIBandDesc *band,
-                           AVCodecContext *avctx)
-{
-    int         i;
-    uint8_t     band_flags;
-
-    band_flags = get_bits(&ctx->gb, 8);
-
-    if (band_flags & 1) {
-        band->is_empty = 1;
-        return 0;
-    }
-
-    band->data_size = (ctx->frame_flags & 0x80) ? get_bits_long(&ctx->gb, 24) : 0;
-
-    band->inherit_mv     = band_flags & 2;
-    band->inherit_qdelta = band_flags & 8;
-    band->qdelta_present = band_flags & 4;
-    if (!band->qdelta_present) band->inherit_qdelta = 1;
-
-    /* decode rvmap probability corrections if any */
-    band->num_corr = 0; /* there are no corrections */
-    if (band_flags & 0x10) {
-        band->num_corr = get_bits(&ctx->gb, 8); /* get number of correction pairs */
-        if (band->num_corr > 61) {
-            av_log(avctx, AV_LOG_ERROR, "Too many corrections: %d\n",
-                   band->num_corr);
-            return -1;
-        }
-
-        /* read correction pairs */
-        for (i = 0; i < band->num_corr * 2; i++)
-            band->corr[i] = get_bits(&ctx->gb, 8);
-    }
-
-    /* select appropriate rvmap table for this band */
-    band->rvmap_sel = (band_flags & 0x40) ? get_bits(&ctx->gb, 3) : 8;
-
-    /* decode block huffman codebook */
-    if (ff_ivi_dec_huff_desc(&ctx->gb, band_flags & 0x80, IVI_BLK_HUFF, &band->blk_vlc, avctx))
-        return -1;
-
-    band->checksum_present = get_bits1(&ctx->gb);
-    if (band->checksum_present)
-        band->checksum = get_bits(&ctx->gb, 16);
-
-    band->glob_quant = get_bits(&ctx->gb, 5);
-
-    /* skip unknown extension if any */
-    if (band_flags & 0x20) { /* XXX: untested */
-        align_get_bits(&ctx->gb);
-        skip_hdr_extension(&ctx->gb);
-    }
-
-    align_get_bits(&ctx->gb);
-
-    return 0;
-}
-
-
-/**
- *  Decodes info (block type, cbp, quant delta, motion vector)
- *  for all macroblocks in the current tile.
- *
- *  @param ctx      [in,out] ptr to the decoder context
- *  @param band     [in,out] ptr to the band descriptor
- *  @param tile     [in,out] ptr to the tile descriptor
- *  @param avctx    [in] ptr to the AVCodecContext
- *  @return         result code: 0 = OK, -1 = error
- */
-static int decode_mb_info(IVI5DecContext *ctx, IVIBandDesc *band,
-                          IVITile *tile, AVCodecContext *avctx)
-{
-    int         x, y, mv_x, mv_y, mv_delta, offs, mb_offset,
-                mv_scale, blks_per_mb;
-    IVIMbInfo   *mb, *ref_mb;
-    int         row_offset = band->mb_size * band->pitch;
-
-    mb     = tile->mbs;
-    ref_mb = tile->ref_mbs;
-    offs   = tile->ypos * band->pitch + tile->xpos;
-
-    /* scale factor for motion vectors */
-    mv_scale = (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3);
-    mv_x = mv_y = 0;
-
-    for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) {
-        mb_offset = offs;
-
-        for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) {
-            mb->xpos     = x;
-            mb->ypos     = y;
-            mb->buf_offs = mb_offset;
-
-            if (get_bits1(&ctx->gb)) {
-                if (ctx->frame_type == FRAMETYPE_INTRA) {
-                    av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n");
-                    return -1;
-                }
-                mb->type = 1; /* empty macroblocks are always INTER */
-                mb->cbp  = 0; /* all blocks are empty */
-
-                mb->q_delta = 0;
-                if (!band->plane && !band->band_num && (ctx->frame_flags & 8)) {
-                    mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table,
-                                           IVI_VLC_BITS, 1);
-                    mb->q_delta = IVI_TOSIGNED(mb->q_delta);
-                }
-
-                mb->mv_x = mb->mv_y = 0; /* no motion vector coded */
-                if (band->inherit_mv){
-                    /* motion vector inheritance */
-                    if (mv_scale) {
-                        mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
-                        mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
-                    } else {
-                        mb->mv_x = ref_mb->mv_x;
-                        mb->mv_y = ref_mb->mv_y;
-                    }
-                }
-            } else {
-                if (band->inherit_mv) {
-                    mb->type = ref_mb->type; /* copy mb_type from corresponding reference mb */
-                } else if (ctx->frame_type == FRAMETYPE_INTRA) {
-                    mb->type = 0; /* mb_type is always INTRA for intra-frames */
-                } else {
-                    mb->type = get_bits1(&ctx->gb);
-                }
-
-                blks_per_mb = band->mb_size != band->blk_size ? 4 : 1;
-                mb->cbp = get_bits(&ctx->gb, blks_per_mb);
-
-                mb->q_delta = 0;
-                if (band->qdelta_present) {
-                    if (band->inherit_qdelta) {
-                        if (ref_mb) mb->q_delta = ref_mb->q_delta;
-                    } else if (mb->cbp || (!band->plane && !band->band_num &&
-                                           (ctx->frame_flags & 8))) {
-                        mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table,
-                                               IVI_VLC_BITS, 1);
-                        mb->q_delta = IVI_TOSIGNED(mb->q_delta);
-                    }
-                }
-
-                if (!mb->type) {
-                    mb->mv_x = mb->mv_y = 0; /* there is no motion vector in intra-macroblocks */
-                } else {
-                    if (band->inherit_mv){
-                        /* motion vector inheritance */
-                        if (mv_scale) {
-                            mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
-                            mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
-                        } else {
-                            mb->mv_x = ref_mb->mv_x;
-                            mb->mv_y = ref_mb->mv_y;
-                        }
-                    } else {
-                        /* decode motion vector deltas */
-                        mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table,
-                                            IVI_VLC_BITS, 1);
-                        mv_y += IVI_TOSIGNED(mv_delta);
-                        mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table,
-                                            IVI_VLC_BITS, 1);
-                        mv_x += IVI_TOSIGNED(mv_delta);
-                        mb->mv_x = mv_x;
-                        mb->mv_y = mv_y;
-                    }
-                }
-            }
-
-            mb++;
-            if (ref_mb)
-                ref_mb++;
-            mb_offset += band->mb_size;
-        }
-
-        offs += row_offset;
-    }
-
-    align_get_bits(&ctx->gb);
-
-    return 0;
-}
-
-
-/**
- *  Decodes an Indeo5 band.
- *
- *  @param ctx      [in,out] ptr to the decoder context
- *  @param band     [in,out] ptr to the band descriptor
- *  @param avctx    [in] ptr to the AVCodecContext
- *  @return         result code: 0 = OK, -1 = error
- */
-static int decode_band(IVI5DecContext *ctx, int plane_num,
-                       IVIBandDesc *band, AVCodecContext *avctx)
-{
-    int         result, i, t, idx1, idx2, pos;
-    IVITile     *tile;
-
-    band->buf     = band->bufs[ctx->dst_buf];
-    band->ref_buf = band->bufs[ctx->ref_buf];
-    band->data_ptr = ctx->frame_data + (get_bits_count(&ctx->gb) >> 3);
-
-    result = decode_band_hdr(ctx, band, avctx);
-    if (result) {
-        av_log(avctx, AV_LOG_ERROR, "Error while decoding band header: %d\n",
-               result);
-        return -1;
-    }
-
-    if (band->is_empty) {
-        av_log(avctx, AV_LOG_ERROR, "Empty band encountered!\n");
-        return -1;
-    }
-
-    if (band->blk_size == 8) {
-        band->intra_base  = &ivi5_base_quant_8x8_intra[band->quant_mat][0];
-        band->inter_base  = &ivi5_base_quant_8x8_inter[band->quant_mat][0];
-        band->intra_scale = &ivi5_scale_quant_8x8_intra[band->quant_mat][0];
-        band->inter_scale = &ivi5_scale_quant_8x8_inter[band->quant_mat][0];
-    } else {
-        band->intra_base  = ivi5_base_quant_4x4_intra;
-        band->inter_base  = ivi5_base_quant_4x4_inter;
-        band->intra_scale = ivi5_scale_quant_4x4_intra;
-        band->inter_scale = ivi5_scale_quant_4x4_inter;
-    }
-
-    band->rv_map = &ctx->rvmap_tabs[band->rvmap_sel];
-
-    /* apply corrections to the selected rvmap table if present */
-    for (i = 0; i < band->num_corr; i++) {
-        idx1 = band->corr[i*2];
-        idx2 = band->corr[i*2+1];
-        FFSWAP(uint8_t, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
-        FFSWAP(int16_t, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
-    }
-
-    pos = get_bits_count(&ctx->gb);
-
-    for (t = 0; t < band->num_tiles; t++) {
-        tile = &band->tiles[t];
-
-        tile->is_empty = get_bits1(&ctx->gb);
-        if (tile->is_empty) {
-            ff_ivi_process_empty_tile(avctx, band, tile,
-                                      (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3));
-        } else {
-            tile->data_size = ff_ivi_dec_tile_data_size(&ctx->gb);
-
-            result = decode_mb_info(ctx, band, tile, avctx);
-            if (result < 0)
-                break;
-
-            result = ff_ivi_decode_blocks(&ctx->gb, band, tile);
-            if (result < 0 || (get_bits_count(&ctx->gb) - pos) >> 3 != tile->data_size) {
-                av_log(avctx, AV_LOG_ERROR, "Corrupted tile data encountered!\n");
-                break;
-            }
-            pos += tile->data_size << 3; // skip to next tile
-        }
-    }
-
-    /* restore the selected rvmap table by applying its corrections in reverse order */
-    for (i = band->num_corr-1; i >= 0; i--) {
-        idx1 = band->corr[i*2];
-        idx2 = band->corr[i*2+1];
-        FFSWAP(uint8_t, band->rv_map->runtab[idx1], band->rv_map->runtab[idx2]);
-        FFSWAP(int16_t, band->rv_map->valtab[idx1], band->rv_map->valtab[idx2]);
-    }
-
-#if IVI_DEBUG
-    if (band->checksum_present) {
-        uint16_t chksum = ivi_calc_band_checksum(band);
-        if (chksum != band->checksum) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Band checksum mismatch! Plane %d, band %d, received: %x, calculated: %x\n",
-                   band->plane, band->band_num, band->checksum, chksum);
-        }
-    }
-#endif
-
-    align_get_bits(&ctx->gb);
-
-    return result;
-}
-
-
-/**
- *  Switches buffers.
- *
- *  @param ctx      [in,out] ptr to the decoder context
- *  @param avctx    [in] ptr to the AVCodecContext
- */
-static void switch_buffers(IVI5DecContext *ctx, AVCodecContext *avctx)
-{
-    switch (ctx->prev_frame_type) {
-    case FRAMETYPE_INTRA:
-    case FRAMETYPE_INTER:
-        ctx->buf_switch ^= 1;
-        ctx->dst_buf = ctx->buf_switch;
-        ctx->ref_buf = ctx->buf_switch ^ 1;
-        break;
-    case FRAMETYPE_INTER_SCAL:
-        if (!ctx->inter_scal) {
-            ctx->ref2_buf   = 2;
-            ctx->inter_scal = 1;
-        }
-        FFSWAP(int, ctx->dst_buf, ctx->ref2_buf);
-        ctx->ref_buf = ctx->ref2_buf;
-        break;
-    case FRAMETYPE_INTER_NOREF:
-        break;
-    }
-
-    switch (ctx->frame_type) {
-    case FRAMETYPE_INTRA:
-        ctx->buf_switch = 0;
-        /* FALLTHROUGH */
-    case FRAMETYPE_INTER:
-        ctx->inter_scal = 0;
-        ctx->dst_buf = ctx->buf_switch;
-        ctx->ref_buf = ctx->buf_switch ^ 1;
-        break;
-    case FRAMETYPE_INTER_SCAL:
-    case FRAMETYPE_INTER_NOREF:
-    case FRAMETYPE_NULL:
-        break;
-    }
-}
-
-
-/**
- *  Initializes Indeo5 decoder.
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    IVI5DecContext  *ctx = avctx->priv_data;
-    int             result;
-
-    ff_ivi_init_static_vlc();
-
-    /* copy rvmap tables in our context so we can apply changes to them */
-    memcpy(ctx->rvmap_tabs, ff_ivi_rvmap_tabs, sizeof(ff_ivi_rvmap_tabs));
-
-    /* set the initial picture layout according to the basic profile:
-       there is only one band per plane (no scalability), only one tile (no local decoding)
-       and picture format = YVU9 */
-    ctx->pic_conf.pic_width     = avctx->width;
-    ctx->pic_conf.pic_height    = avctx->height;
-    ctx->pic_conf.chroma_width  = (avctx->width  + 3) >> 2;
-    ctx->pic_conf.chroma_height = (avctx->height + 3) >> 2;
-    ctx->pic_conf.tile_width    = avctx->width;
-    ctx->pic_conf.tile_height   = avctx->height;
-    ctx->pic_conf.luma_bands    = ctx->pic_conf.chroma_bands = 1;
-
-    result = ff_ivi_init_planes(ctx->planes, &ctx->pic_conf);
-    if (result) {
-        av_log(avctx, AV_LOG_ERROR, "Couldn't allocate color planes!\n");
-        return -1;
-    }
-
-    ctx->buf_switch = 0;
-    ctx->inter_scal = 0;
-
-    avctx->pix_fmt = PIX_FMT_YUV410P;
-
-    return 0;
-}
-
-
-/**
- *  main decoder function
- */
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    IVI5DecContext  *ctx = avctx->priv_data;
-    const uint8_t   *buf = avpkt->data;
-    int             buf_size = avpkt->size;
-    int             result, p, b;
-
-    init_get_bits(&ctx->gb, buf, buf_size * 8);
-    ctx->frame_data = buf;
-    ctx->frame_size = buf_size;
-
-    result = decode_pic_hdr(ctx, avctx);
-    if (result) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Error while decoding picture header: %d\n", result);
-        return -1;
-    }
-
-    if (ctx->gop_flags & IVI5_IS_PROTECTED) {
-        av_log(avctx, AV_LOG_ERROR, "Password-protected clip!\n");
-        return -1;
-    }
-
-    switch_buffers(ctx, avctx);
-
-    //START_TIMER;
-
-    if (ctx->frame_type != FRAMETYPE_NULL) {
-        for (p = 0; p < 3; p++) {
-            for (b = 0; b < ctx->planes[p].num_bands; b++) {
-                result = decode_band(ctx, p, &ctx->planes[p].bands[b], avctx);
-                if (result) {
-                    av_log(avctx, AV_LOG_ERROR,
-                           "Error while decoding band: %d, plane: %d\n", b, p);
-                    return -1;
-                }
-            }
-        }
-    }
-
-    //STOP_TIMER("decode_planes");
-
-    if (ctx->frame.data[0])
-        avctx->release_buffer(avctx, &ctx->frame);
-
-    ctx->frame.reference = 0;
-    if (avctx->get_buffer(avctx, &ctx->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if (ctx->is_scalable) {
-        ff_ivi_recompose53 (&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0], 4);
-    } else {
-        ff_ivi_output_plane(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]);
-    }
-
-    ff_ivi_output_plane(&ctx->planes[2], ctx->frame.data[1], ctx->frame.linesize[1]);
-    ff_ivi_output_plane(&ctx->planes[1], ctx->frame.data[2], ctx->frame.linesize[2]);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = ctx->frame;
-
-    return buf_size;
-}
-
-
-/**
- *  Closes Indeo5 decoder and cleans up its context.
- */
-static av_cold int decode_close(AVCodecContext *avctx)
-{
-    IVI5DecContext *ctx = avctx->priv_data;
-
-    ff_ivi_free_buffers(&ctx->planes[0]);
-
-    if (ctx->mb_vlc.cust_tab.table)
-        free_vlc(&ctx->mb_vlc.cust_tab);
-
-    if (ctx->frame.data[0])
-        avctx->release_buffer(avctx, &ctx->frame);
-
-    return 0;
-}
-
-
-AVCodec indeo5_decoder = {
-    .name           = "indeo5",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_INDEO5,
-    .priv_data_size = sizeof(IVI5DecContext),
-    .init           = decode_init,
-    .close          = decode_close,
-    .decode         = decode_frame,
-    .long_name      = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"),
-};
diff --git a/libavcodec/indeo5data.h b/libavcodec/indeo5data.h
deleted file mode 100644
index 972e598..0000000
--- a/libavcodec/indeo5data.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Indeo Video Interactive 5 compatible decoder
- * Copyright (c) 2009 Maxim Poliakovski
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * This file contains data needed for the Indeo5 decoder.
- */
-
-#ifndef AVCODEC_INDEO5DATA_H
-#define AVCODEC_INDEO5DATA_H
-
-#include <stdint.h>
-
-/**
- *  standard picture dimensions (width, height divided by 4)
- */
-static const uint8_t ivi5_common_pic_sizes[30] = {
-    160, 120, 80, 60, 40, 30, 176, 120, 88, 60, 88, 72, 44, 36, 60, 45, 160, 60,
-    176,  60, 20, 15, 22, 18,   0,   0,  0,  0,  0,  0
-};
-
-/**
- *  Indeo5 8x8 scan (zigzag) patterns
- */
-static const uint8_t ivi5_scans8x8[2][64] = {
-    {0,  8, 16, 24, 32, 40, 48, 56,  1,  9, 17, 25, 33, 41, 49, 57,
-     2, 10, 18, 26, 34, 42, 50, 58,  3, 11, 19, 27, 35, 43, 51, 59,
-     4, 12, 20, 28, 36, 44, 52, 60,  5, 13, 21, 29, 37, 45, 53, 61,
-     6, 14, 22, 30, 38, 46, 54, 62,  7, 15, 23, 31, 39, 47, 55, 63
-    },
-    {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, 57, 58, 59, 60, 61, 62, 63
-    }
-};
-
-/**
- *  Indeo5 4x4 scan (zigzag) pattern
- */
-static const uint8_t ivi5_scan4x4[16] = {
-    0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
-};
-
-
-/**
- *  Indeo5 dequantization matrixes consist of two tables: base table
- *  and scale table. The base table defines the dequantization matrix
- *  itself and the scale table tells how this matrix should be scaled
- *  for a particular quant level (0...24).
- *
- *  ivi5_base_quant_bbb_ttt  - base  tables for block size 'bbb' of type 'ttt'
- *  ivi5_scale_quant_bbb_ttt - scale tables for block size 'bbb' of type 'ttt'
- */
-static const uint8_t ivi5_base_quant_8x8_inter[5][64] = {
-    {0x13, 0x1d, 0x1f, 0x23, 0x25, 0x27, 0x29, 0x2d, 0x1d, 0x1f, 0x21, 0x23, 0x25, 0x27, 0x2b, 0x2f,
-     0x1f, 0x21, 0x23, 0x24, 0x26, 0x29, 0x2d, 0x31, 0x23, 0x23, 0x24, 0x25, 0x27, 0x2b, 0x2f, 0x33,
-     0x25, 0x25, 0x26, 0x27, 0x29, 0x2d, 0x31, 0x35, 0x27, 0x27, 0x29, 0x2b, 0x2d, 0x2f, 0x33, 0x37,
-     0x29, 0x2b, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x39, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x37, 0x39, 0x3b
-    },
-    {0x13, 0x1d, 0x1f, 0x23, 0x25, 0x27, 0x29, 0x2d, 0x1d, 0x1f, 0x21, 0x23, 0x25, 0x27, 0x2b, 0x2f,
-     0x1f, 0x21, 0x23, 0x24, 0x26, 0x29, 0x2d, 0x31, 0x23, 0x23, 0x24, 0x25, 0x27, 0x2b, 0x2f, 0x33,
-     0x25, 0x25, 0x26, 0x27, 0x29, 0x2d, 0x31, 0x35, 0x27, 0x27, 0x29, 0x2b, 0x2d, 0x2f, 0x33, 0x37,
-     0x29, 0x2b, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x39, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x37, 0x39, 0x3b
-    },
-    {0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61,
-     0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61,
-     0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61,
-     0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61
-    },
-    {0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
-     0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a,
-     0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
-     0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61
-    },
-    {0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
-     0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
-     0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
-     0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f
-    }
-};
-
-static const uint8_t ivi5_base_quant_8x8_intra[5][64] = {
-    {0x0d, 0x17, 0x1b, 0x21, 0x23, 0x25, 0x27, 0x2d, 0x17, 0x19, 0x1f, 0x21, 0x23, 0x27, 0x2b, 0x35,
-     0x1b, 0x1f, 0x1f, 0x22, 0x25, 0x2a, 0x33, 0x39, 0x21, 0x21, 0x22, 0x25, 0x29, 0x31, 0x36, 0x3d,
-     0x23, 0x23, 0x25, 0x29, 0x2f, 0x33, 0x39, 0x47, 0x25, 0x27, 0x2a, 0x31, 0x33, 0x37, 0x43, 0x53,
-     0x27, 0x2b, 0x33, 0x36, 0x39, 0x43, 0x4d, 0x65, 0x2d, 0x35, 0x39, 0x3d, 0x47, 0x53, 0x65, 0x7f
-    },
-    {0x13, 0x1d, 0x1f, 0x23, 0x25, 0x27, 0x29, 0x2d, 0x1d, 0x1f, 0x21, 0x23, 0x25, 0x27, 0x2b, 0x2f,
-     0x1f, 0x21, 0x23, 0x24, 0x26, 0x29, 0x2d, 0x31, 0x23, 0x23, 0x24, 0x25, 0x27, 0x2b, 0x2f, 0x33,
-     0x25, 0x25, 0x26, 0x27, 0x29, 0x2d, 0x31, 0x35, 0x27, 0x27, 0x29, 0x2b, 0x2d, 0x2f, 0x33, 0x37,
-     0x29, 0x2b, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x39, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x37, 0x39, 0x3b
-    },
-    {0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61,
-     0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61,
-     0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61,
-     0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61
-    },
-    {0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
-     0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a,
-     0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61,
-     0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61
-    },
-    {0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
-     0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
-     0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
-     0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f
-    }
-};
-
-static const uint8_t ivi5_base_quant_4x4_inter[16] = {
-    0x0f, 0x1f, 0x25, 0x29, 0x1f, 0x25, 0x29, 0x2b, 0x25, 0x29, 0x2b, 0x2f, 0x29, 0x2b, 0x2f, 0x33
-};
-
-static const uint8_t ivi5_base_quant_4x4_intra[16] = {
-    0x0f, 0x1f, 0x25, 0x29, 0x1f, 0x25, 0x29, 0x2f, 0x25, 0x29, 0x2f, 0x3d, 0x29, 0x2f, 0x3d, 0x49
-};
-
-
-static const uint8_t ivi5_scale_quant_8x8_inter[5][24] = {
-    {0x0b, 0x11, 0x13, 0x14, 0x15, 0x16, 0x18, 0x1a, 0x1b, 0x1d, 0x20, 0x22,
-     0x23, 0x25, 0x28, 0x2a, 0x2e, 0x32, 0x35, 0x39, 0x3d, 0x41, 0x44, 0x4a,
-    },
-    {0x07, 0x14, 0x16, 0x18, 0x1b, 0x1e, 0x22, 0x25, 0x29, 0x2d, 0x31, 0x35,
-     0x3a, 0x3f, 0x44, 0x4a, 0x50, 0x56, 0x5c, 0x63, 0x6a, 0x71, 0x78, 0x7e,
-    },
-    {0x15, 0x25, 0x28, 0x2d, 0x30, 0x34, 0x3a, 0x3d, 0x42, 0x48, 0x4c, 0x51,
-     0x56, 0x5b, 0x60, 0x65, 0x6b, 0x70, 0x76, 0x7c, 0x82, 0x88, 0x8f, 0x97,
-    },
-    {0x13, 0x1f, 0x20, 0x22, 0x25, 0x28, 0x2b, 0x2d, 0x30, 0x33, 0x36, 0x39,
-     0x3c, 0x3f, 0x42, 0x45, 0x48, 0x4b, 0x4e, 0x52, 0x56, 0x5a, 0x5e, 0x62,
-    },
-    {0x3c, 0x52, 0x58, 0x5d, 0x63, 0x68, 0x68, 0x6d, 0x73, 0x78, 0x7c, 0x80,
-     0x84, 0x89, 0x8e, 0x93, 0x98, 0x9d, 0xa3, 0xa9, 0xad, 0xb1, 0xb5, 0xba,
-    },
-};
-
-static const uint8_t ivi5_scale_quant_8x8_intra[5][24] = {
-    {0x0b, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x17, 0x18, 0x1a, 0x1c, 0x1e, 0x20,
-     0x22, 0x24, 0x27, 0x28, 0x2a, 0x2d, 0x2f, 0x31, 0x34, 0x37, 0x39, 0x3c,
-    },
-    {0x01, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1b, 0x1e, 0x22, 0x25, 0x28, 0x2c,
-     0x30, 0x34, 0x38, 0x3d, 0x42, 0x47, 0x4c, 0x52, 0x58, 0x5e, 0x65, 0x6c,
-    },
-    {0x13, 0x22, 0x27, 0x2a, 0x2d, 0x33, 0x36, 0x3c, 0x41, 0x45, 0x49, 0x4e,
-     0x53, 0x58, 0x5d, 0x63, 0x69, 0x6f, 0x75, 0x7c, 0x82, 0x88, 0x8e, 0x95,
-    },
-    {0x13, 0x1f, 0x21, 0x24, 0x27, 0x29, 0x2d, 0x2f, 0x34, 0x37, 0x3a, 0x3d,
-     0x40, 0x44, 0x48, 0x4c, 0x4f, 0x52, 0x56, 0x5a, 0x5e, 0x62, 0x66, 0x6b,
-    },
-    {0x31, 0x42, 0x47, 0x47, 0x4d, 0x52, 0x58, 0x58, 0x5d, 0x63, 0x67, 0x6b,
-     0x6f, 0x73, 0x78, 0x7c, 0x80, 0x84, 0x89, 0x8e, 0x93, 0x98, 0x9d, 0xa4,
-    }
-};
-
-static const uint8_t ivi5_scale_quant_4x4_inter[24] = {
-    0x0b, 0x0d, 0x0d, 0x0e, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-    0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
-};
-
-static const uint8_t ivi5_scale_quant_4x4_intra[24] = {
-    0x01, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x13, 0x14,
-    0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20
-};
-
-
-#endif /* AVCODEC_INDEO5DATA_H */
diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c
deleted file mode 100644
index 5e45129..0000000
--- a/libavcodec/intelh263dec.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * H.263i decoder
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mpegvideo.h"
-#include "h263.h"
-
-/* don't understand why they choose a different header ! */
-int ff_intel_h263_decode_picture_header(MpegEncContext *s)
-{
-    int format;
-
-    /* picture header */
-    if (get_bits_long(&s->gb, 22) != 0x20) {
-        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
-        return -1;
-    }
-    s->picture_number = get_bits(&s->gb, 8); /* picture timestamp */
-
-    if (get_bits1(&s->gb) != 1) {
-        av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
-        return -1;      /* marker */
-    }
-    if (get_bits1(&s->gb) != 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
-        return -1;      /* h263 id */
-    }
-    skip_bits1(&s->gb);         /* split screen off */
-    skip_bits1(&s->gb);         /* camera  off */
-    skip_bits1(&s->gb);         /* freeze picture release off */
-
-    format = get_bits(&s->gb, 3);
-    if (format != 7) {
-        av_log(s->avctx, AV_LOG_ERROR, "Intel H263 free format not supported\n");
-        return -1;
-    }
-    s->h263_plus = 0;
-
-    s->pict_type = FF_I_TYPE + get_bits1(&s->gb);
-
-    s->unrestricted_mv = get_bits1(&s->gb);
-    s->h263_long_vectors = s->unrestricted_mv;
-
-    if (get_bits1(&s->gb) != 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "SAC not supported\n");
-        return -1;      /* SAC: off */
-    }
-    s->obmc= get_bits1(&s->gb);
-    s->pb_frame = get_bits1(&s->gb);
-
-    if(format == 7){
-        format = get_bits(&s->gb, 3);
-        if(format == 0 || format == 7){
-            av_log(s->avctx, AV_LOG_ERROR, "Wrong Intel H263 format\n");
-            return -1;
-        }
-        if(get_bits(&s->gb, 2))
-            av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
-        s->loop_filter = get_bits1(&s->gb);
-        if(get_bits1(&s->gb))
-            av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
-        if(get_bits1(&s->gb))
-            s->pb_frame = 2;
-        if(get_bits(&s->gb, 5))
-            av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n");
-        if(get_bits(&s->gb, 5) != 1)
-            av_log(s->avctx, AV_LOG_ERROR, "Invalid marker\n");
-    }
-    if(format == 6){
-        int ar = get_bits(&s->gb, 4);
-        skip_bits(&s->gb, 9); // display width
-        skip_bits1(&s->gb);
-        skip_bits(&s->gb, 9); // display height
-        if(ar == 15){
-            skip_bits(&s->gb, 8); // aspect ratio - width
-            skip_bits(&s->gb, 8); // aspect ratio - height
-        }
-    }
-
-    s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
-    skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
-
-    if(s->pb_frame){
-        skip_bits(&s->gb, 3); //temporal reference for B-frame
-        skip_bits(&s->gb, 2); //dbquant
-    }
-
-    /* PEI */
-    while (get_bits1(&s->gb) != 0) {
-        skip_bits(&s->gb, 8);
-    }
-    s->f_code = 1;
-
-    s->y_dc_scale_table=
-    s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-
-    ff_h263_show_pict_info(s);
-
-    return 0;
-}
-
-AVCodec h263i_decoder = {
-    "h263i",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H263I,
-    sizeof(MpegEncContext),
-    ff_h263_decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
-
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
deleted file mode 100644
index 97c0dcb..0000000
--- a/libavcodec/internal.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * common internal api header.
- */
-
-#ifndef AVCODEC_INTERNAL_H
-#define AVCODEC_INTERNAL_H
-
-#include <stdint.h>
-#include "avcodec.h"
-
-/**
- * Determines whether pix_fmt is a hardware accelerated format.
- */
-int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt);
-
-/**
- * Returns the hardware accelerated codec for codec codec_id and
- * pixel format pix_fmt.
- *
- * @param codec_id the codec to match
- * @param pix_fmt the pixel format to match
- * @return the hardware accelerated codec, or NULL if none was found.
- */
-AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt);
-
-/**
- * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
- * If there is no such matching pair then size is returned.
- */
-int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);
-
-#endif /* AVCODEC_INTERNAL_H */
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
deleted file mode 100644
index b98386f..0000000
--- a/libavcodec/interplayvideo.c
+++ /dev/null
@@ -1,1107 +0,0 @@
-/*
- * Interplay MVE Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Interplay MVE Video Decoder by Mike Melanson (melanson at pcisys.net)
- * For more information about the Interplay MVE format, visit:
- *   http://www.pcisys.net/~melanson/codecs/interplay-mve.txt
- * This code is written in such a way that the identifiers match up
- * with the encoding descriptions in the document.
- *
- * This decoder presently only supports a PAL8 output colorspace.
- *
- * An Interplay video frame consists of 2 parts: The decoding map and
- * the video data. A demuxer must load these 2 parts together in a single
- * buffer before sending it through the stream to this decoder.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "dsputil.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-
-#define PALETTE_COUNT 256
-
-/* debugging support */
-#define DEBUG_INTERPLAY 0
-#if DEBUG_INTERPLAY
-#define debug_interplay(x,...) av_log(NULL, AV_LOG_DEBUG, x, __VA_ARGS__)
-#else
-static inline void debug_interplay(const char *format, ...) { }
-#endif
-
-typedef struct IpvideoContext {
-
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame second_last_frame;
-    AVFrame last_frame;
-    AVFrame current_frame;
-    const unsigned char *decoding_map;
-    int decoding_map_size;
-
-    const unsigned char *buf;
-    int size;
-
-    int is_16bpp;
-    const unsigned char *stream_ptr;
-    const unsigned char *stream_end;
-    const uint8_t *mv_ptr;
-    const uint8_t *mv_end;
-    unsigned char *pixel_ptr;
-    int line_inc;
-    int stride;
-    int upper_motion_limit_offset;
-
-} IpvideoContext;
-
-#define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \
-    if (stream_end - stream_ptr < n) { \
-        av_log(s->avctx, AV_LOG_ERROR, "Interplay video warning: stream_ptr out of bounds (%p >= %p)\n", \
-               stream_ptr + n, stream_end); \
-        return -1; \
-    }
-
-static int copy_from(IpvideoContext *s, AVFrame *src, int delta_x, int delta_y)
-{
-    int current_offset = s->pixel_ptr - s->current_frame.data[0];
-    int motion_offset = current_offset + delta_y * s->current_frame.linesize[0]
-                       + delta_x * (1 + s->is_16bpp);
-    if (motion_offset < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset < 0 (%d)\n", motion_offset);
-        return -1;
-    } else if (motion_offset > s->upper_motion_limit_offset) {
-        av_log(s->avctx, AV_LOG_ERROR, " Interplay video: motion offset above limit (%d >= %d)\n",
-            motion_offset, s->upper_motion_limit_offset);
-        return -1;
-    }
-    s->dsp.put_pixels_tab[!s->is_16bpp][0](s->pixel_ptr, src->data[0] + motion_offset,
-                                           s->current_frame.linesize[0], 8);
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0x0(IpvideoContext *s)
-{
-    return copy_from(s, &s->last_frame, 0, 0);
-}
-
-static int ipvideo_decode_block_opcode_0x1(IpvideoContext *s)
-{
-    return copy_from(s, &s->second_last_frame, 0, 0);
-}
-
-static int ipvideo_decode_block_opcode_0x2(IpvideoContext *s)
-{
-    unsigned char B;
-    int x, y;
-
-    /* copy block from 2 frames ago using a motion vector; need 1 more byte */
-    if (!s->is_16bpp) {
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
-        B = *s->stream_ptr++;
-    } else {
-        CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
-        B = *s->mv_ptr++;
-    }
-
-    if (B < 56) {
-        x = 8 + (B % 7);
-        y = B / 7;
-    } else {
-        x = -14 + ((B - 56) % 29);
-        y =   8 + ((B - 56) / 29);
-    }
-
-    debug_interplay ("    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
-    return copy_from(s, &s->second_last_frame, x, y);
-}
-
-static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s)
-{
-    unsigned char B;
-    int x, y;
-
-    /* copy 8x8 block from current frame from an up/left block */
-
-    /* need 1 more byte for motion */
-    if (!s->is_16bpp) {
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
-        B = *s->stream_ptr++;
-    } else {
-        CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
-        B = *s->mv_ptr++;
-    }
-
-    if (B < 56) {
-        x = -(8 + (B % 7));
-        y = -(B / 7);
-    } else {
-        x = -(-14 + ((B - 56) % 29));
-        y = -(  8 + ((B - 56) / 29));
-    }
-
-    debug_interplay ("    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
-    return copy_from(s, &s->current_frame, x, y);
-}
-
-static int ipvideo_decode_block_opcode_0x4(IpvideoContext *s)
-{
-    int x, y;
-    unsigned char B, BL, BH;
-
-    /* copy a block from the previous frame; need 1 more byte */
-    if (!s->is_16bpp) {
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
-        B = *s->stream_ptr++;
-    } else {
-        CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
-        B = *s->mv_ptr++;
-    }
-
-    BL = B & 0x0F;
-    BH = (B >> 4) & 0x0F;
-    x = -8 + BL;
-    y = -8 + BH;
-
-    debug_interplay ("    motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
-    return copy_from(s, &s->last_frame, x, y);
-}
-
-static int ipvideo_decode_block_opcode_0x5(IpvideoContext *s)
-{
-    signed char x, y;
-
-    /* copy a block from the previous frame using an expanded range;
-     * need 2 more bytes */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
-    x = *s->stream_ptr++;
-    y = *s->stream_ptr++;
-
-    debug_interplay ("    motion bytes = %d, %d\n", x, y);
-    return copy_from(s, &s->last_frame, x, y);
-}
-
-static int ipvideo_decode_block_opcode_0x6(IpvideoContext *s)
-{
-    /* mystery opcode? skip multiple blocks? */
-    av_log(s->avctx, AV_LOG_ERROR, "  Interplay video: Help! Mystery opcode 0x6 seen\n");
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0x7(IpvideoContext *s)
-{
-    int x, y;
-    unsigned char P[2];
-    unsigned int flags;
-
-    /* 2-color encoding */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
-    P[0] = *s->stream_ptr++;
-    P[1] = *s->stream_ptr++;
-
-    if (P[0] <= P[1]) {
-
-        /* need 8 more bytes from the stream */
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
-        for (y = 0; y < 8; y++) {
-            flags = *s->stream_ptr++ | 0x100;
-            for (; flags != 1; flags >>= 1)
-                *s->pixel_ptr++ = P[flags & 1];
-            s->pixel_ptr += s->line_inc;
-        }
-
-    } else {
-
-        /* need 2 more bytes from the stream */
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
-        flags = bytestream_get_le16(&s->stream_ptr);
-        for (y = 0; y < 8; y += 2) {
-            for (x = 0; x < 8; x += 2, flags >>= 1) {
-                s->pixel_ptr[x                ] =
-                s->pixel_ptr[x + 1            ] =
-                s->pixel_ptr[x +     s->stride] =
-                s->pixel_ptr[x + 1 + s->stride] = P[flags & 1];
-            }
-            s->pixel_ptr += s->stride * 2;
-        }
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0x8(IpvideoContext *s)
-{
-    int x, y;
-    unsigned char P[2];
-    unsigned int flags = 0;
-
-    /* 2-color encoding for each 4x4 quadrant, or 2-color encoding on
-     * either top and bottom or left and right halves */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
-    P[0] = *s->stream_ptr++;
-    P[1] = *s->stream_ptr++;
-
-    if (P[0] <= P[1]) {
-
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 14);
-        s->stream_ptr -= 2;
-
-        for (y = 0; y < 16; y++) {
-            // new values for each 4x4 block
-            if (!(y & 3)) {
-                P[0] = *s->stream_ptr++; P[1] = *s->stream_ptr++;
-                flags = bytestream_get_le16(&s->stream_ptr);
-            }
-
-            for (x = 0; x < 4; x++, flags >>= 1)
-                *s->pixel_ptr++ = P[flags & 1];
-            s->pixel_ptr += s->stride - 4;
-            // switch to right half
-            if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
-        }
-
-    } else {
-
-        /* need 10 more bytes */
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 10);
-
-        if (s->stream_ptr[4] <= s->stream_ptr[5]) {
-
-            flags = bytestream_get_le32(&s->stream_ptr);
-
-            /* vertical split; left & right halves are 2-color encoded */
-
-            for (y = 0; y < 16; y++) {
-                for (x = 0; x < 4; x++, flags >>= 1)
-                    *s->pixel_ptr++ = P[flags & 1];
-                s->pixel_ptr += s->stride - 4;
-                // switch to right half
-                if (y == 7) {
-                    s->pixel_ptr -= 8 * s->stride - 4;
-                    P[0] = *s->stream_ptr++; P[1] = *s->stream_ptr++;
-                    flags = bytestream_get_le32(&s->stream_ptr);
-                }
-            }
-
-        } else {
-
-            /* horizontal split; top & bottom halves are 2-color encoded */
-
-            for (y = 0; y < 8; y++) {
-                if (y == 4) {
-                    P[0] = *s->stream_ptr++;
-                    P[1] = *s->stream_ptr++;
-                }
-                flags = *s->stream_ptr++ | 0x100;
-
-                for (; flags != 1; flags >>= 1)
-                    *s->pixel_ptr++ = P[flags & 1];
-                s->pixel_ptr += s->line_inc;
-            }
-        }
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s)
-{
-    int x, y;
-    unsigned char P[4];
-
-    /* 4-color encoding */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
-    memcpy(P, s->stream_ptr, 4);
-    s->stream_ptr += 4;
-
-    if (P[0] <= P[1]) {
-        if (P[2] <= P[3]) {
-
-            /* 1 of 4 colors for each pixel, need 16 more bytes */
-            CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 16);
-
-            for (y = 0; y < 8; y++) {
-                /* get the next set of 8 2-bit flags */
-                int flags = bytestream_get_le16(&s->stream_ptr);
-                for (x = 0; x < 8; x++, flags >>= 2)
-                    *s->pixel_ptr++ = P[flags & 0x03];
-                s->pixel_ptr += s->line_inc;
-            }
-
-        } else {
-            uint32_t flags;
-
-            /* 1 of 4 colors for each 2x2 block, need 4 more bytes */
-            CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
-            flags = bytestream_get_le32(&s->stream_ptr);
-
-            for (y = 0; y < 8; y += 2) {
-                for (x = 0; x < 8; x += 2, flags >>= 2) {
-                    s->pixel_ptr[x                ] =
-                    s->pixel_ptr[x + 1            ] =
-                    s->pixel_ptr[x +     s->stride] =
-                    s->pixel_ptr[x + 1 + s->stride] = P[flags & 0x03];
-                }
-                s->pixel_ptr += s->stride * 2;
-            }
-
-        }
-    } else {
-        uint64_t flags;
-
-        /* 1 of 4 colors for each 2x1 or 1x2 block, need 8 more bytes */
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
-        flags = bytestream_get_le64(&s->stream_ptr);
-        if (P[2] <= P[3]) {
-            for (y = 0; y < 8; y++) {
-                for (x = 0; x < 8; x += 2, flags >>= 2) {
-                    s->pixel_ptr[x    ] =
-                    s->pixel_ptr[x + 1] = P[flags & 0x03];
-                }
-                s->pixel_ptr += s->stride;
-            }
-        } else {
-            for (y = 0; y < 8; y += 2) {
-                for (x = 0; x < 8; x++, flags >>= 2) {
-                    s->pixel_ptr[x            ] =
-                    s->pixel_ptr[x + s->stride] = P[flags & 0x03];
-                }
-                s->pixel_ptr += s->stride * 2;
-            }
-        }
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
-{
-    int x, y;
-    unsigned char P[4];
-    int flags = 0;
-
-    /* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
-     * either top and bottom or left and right halves */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 24);
-
-    if (s->stream_ptr[0] <= s->stream_ptr[1]) {
-
-        /* 4-color encoding for each quadrant; need 32 bytes */
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 32);
-
-        for (y = 0; y < 16; y++) {
-            // new values for each 4x4 block
-            if (!(y & 3)) {
-                memcpy(P, s->stream_ptr, 4);
-                s->stream_ptr += 4;
-                flags = bytestream_get_le32(&s->stream_ptr);
-            }
-
-            for (x = 0; x < 4; x++, flags >>= 2)
-                *s->pixel_ptr++ = P[flags & 0x03];
-
-            s->pixel_ptr += s->stride - 4;
-            // switch to right half
-            if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
-        }
-
-    } else {
-        // vertical split?
-        int vert = s->stream_ptr[12] <= s->stream_ptr[13];
-        uint64_t flags = 0;
-
-        /* 4-color encoding for either left and right or top and bottom
-         * halves */
-
-        for (y = 0; y < 16; y++) {
-            // load values for each half
-            if (!(y & 7)) {
-                memcpy(P, s->stream_ptr, 4);
-                s->stream_ptr += 4;
-                flags = bytestream_get_le64(&s->stream_ptr);
-            }
-
-            for (x = 0; x < 4; x++, flags >>= 2)
-                *s->pixel_ptr++ = P[flags & 0x03];
-
-            if (vert) {
-                s->pixel_ptr += s->stride - 4;
-                // switch to right half
-                if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
-            } else if (y & 1) s->pixel_ptr += s->line_inc;
-        }
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xB(IpvideoContext *s)
-{
-    int y;
-
-    /* 64-color encoding (each pixel in block is a different color) */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 64);
-
-    for (y = 0; y < 8; y++) {
-        memcpy(s->pixel_ptr, s->stream_ptr, 8);
-        s->stream_ptr += 8;
-        s->pixel_ptr  += s->stride;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xC(IpvideoContext *s)
-{
-    int x, y;
-
-    /* 16-color block encoding: each 2x2 block is a different color */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 16);
-
-    for (y = 0; y < 8; y += 2) {
-        for (x = 0; x < 8; x += 2) {
-            s->pixel_ptr[x                ] =
-            s->pixel_ptr[x + 1            ] =
-            s->pixel_ptr[x +     s->stride] =
-            s->pixel_ptr[x + 1 + s->stride] = *s->stream_ptr++;
-        }
-        s->pixel_ptr += s->stride * 2;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xD(IpvideoContext *s)
-{
-    int y;
-    unsigned char P[2];
-
-    /* 4-color block encoding: each 4x4 block is a different color */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
-    for (y = 0; y < 8; y++) {
-        if (!(y & 3)) {
-            P[0] = *s->stream_ptr++;
-            P[1] = *s->stream_ptr++;
-        }
-        memset(s->pixel_ptr,     P[0], 4);
-        memset(s->pixel_ptr + 4, P[1], 4);
-        s->pixel_ptr += s->stride;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xE(IpvideoContext *s)
-{
-    int y;
-    unsigned char pix;
-
-    /* 1-color encoding: the whole block is 1 solid color */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
-    pix = *s->stream_ptr++;
-
-    for (y = 0; y < 8; y++) {
-        memset(s->pixel_ptr, pix, 8);
-        s->pixel_ptr += s->stride;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xF(IpvideoContext *s)
-{
-    int x, y;
-    unsigned char sample[2];
-
-    /* dithered encoding */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-    sample[0] = *s->stream_ptr++;
-    sample[1] = *s->stream_ptr++;
-
-    for (y = 0; y < 8; y++) {
-        for (x = 0; x < 8; x += 2) {
-            *s->pixel_ptr++ = sample[  y & 1 ];
-            *s->pixel_ptr++ = sample[!(y & 1)];
-        }
-        s->pixel_ptr += s->line_inc;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0x6_16(IpvideoContext *s)
-{
-    signed char x, y;
-
-    /* copy a block from the second last frame using an expanded range */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
-    x = *s->stream_ptr++;
-    y = *s->stream_ptr++;
-
-    debug_interplay ("    motion bytes = %d, %d\n", x, y);
-    return copy_from(s, &s->second_last_frame, x, y);
-}
-
-static int ipvideo_decode_block_opcode_0x7_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t P[2];
-    unsigned int flags;
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 2-color encoding */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
-    P[0] = bytestream_get_le16(&s->stream_ptr);
-    P[1] = bytestream_get_le16(&s->stream_ptr);
-
-    if (!(P[0] & 0x8000)) {
-
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
-        for (y = 0; y < 8; y++) {
-            flags = *s->stream_ptr++ | 0x100;
-            for (; flags != 1; flags >>= 1)
-                *pixel_ptr++ = P[flags & 1];
-            pixel_ptr += s->line_inc;
-        }
-
-    } else {
-
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-
-        flags = bytestream_get_le16(&s->stream_ptr);
-        for (y = 0; y < 8; y += 2) {
-            for (x = 0; x < 8; x += 2, flags >>= 1) {
-                pixel_ptr[x                ] =
-                pixel_ptr[x + 1            ] =
-                pixel_ptr[x +     s->stride] =
-                pixel_ptr[x + 1 + s->stride] = P[flags & 1];
-            }
-            pixel_ptr += s->stride * 2;
-        }
-    }
-
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0x8_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t P[2];
-    unsigned int flags = 0;
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 2-color encoding for each 4x4 quadrant, or 2-color encoding on
-     * either top and bottom or left and right halves */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
-    P[0] = bytestream_get_le16(&s->stream_ptr);
-    P[1] = bytestream_get_le16(&s->stream_ptr);
-
-    if (!(P[0] & 0x8000)) {
-
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 24);
-        s->stream_ptr -= 4;
-
-        for (y = 0; y < 16; y++) {
-            // new values for each 4x4 block
-            if (!(y & 3)) {
-                P[0] = bytestream_get_le16(&s->stream_ptr);
-                P[1] = bytestream_get_le16(&s->stream_ptr);
-                flags = bytestream_get_le16(&s->stream_ptr);
-            }
-
-            for (x = 0; x < 4; x++, flags >>= 1)
-                *pixel_ptr++ = P[flags & 1];
-            pixel_ptr += s->stride - 4;
-            // switch to right half
-            if (y == 7) pixel_ptr -= 8 * s->stride - 4;
-        }
-
-    } else {
-
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 12);
-
-        if (!(AV_RL16(s->stream_ptr + 4) & 0x8000)) {
-
-            flags = bytestream_get_le32(&s->stream_ptr);
-
-            /* vertical split; left & right halves are 2-color encoded */
-
-            for (y = 0; y < 16; y++) {
-                for (x = 0; x < 4; x++, flags >>= 1)
-                    *pixel_ptr++ = P[flags & 1];
-                pixel_ptr += s->stride - 4;
-                // switch to right half
-                if (y == 7) {
-                    pixel_ptr -= 8 * s->stride - 4;
-                    P[0] = bytestream_get_le16(&s->stream_ptr);
-                    P[1] = bytestream_get_le16(&s->stream_ptr);
-                    flags = bytestream_get_le32(&s->stream_ptr);
-                }
-            }
-
-        } else {
-
-            /* horizontal split; top & bottom halves are 2-color encoded */
-
-            for (y = 0; y < 8; y++) {
-                if (y == 4) {
-                    P[0] = bytestream_get_le16(&s->stream_ptr);
-                    P[1] = bytestream_get_le16(&s->stream_ptr);
-                }
-                flags = *s->stream_ptr++ | 0x100;
-
-                for (; flags != 1; flags >>= 1)
-                    *pixel_ptr++ = P[flags & 1];
-                pixel_ptr += s->line_inc;
-            }
-        }
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0x9_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t P[4];
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 4-color encoding */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
-    for (x = 0; x < 4; x++)
-        P[x] = bytestream_get_le16(&s->stream_ptr);
-
-    if (!(P[0] & 0x8000)) {
-        if (!(P[2] & 0x8000)) {
-
-            /* 1 of 4 colors for each pixel */
-            CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 16);
-
-            for (y = 0; y < 8; y++) {
-                /* get the next set of 8 2-bit flags */
-                int flags = bytestream_get_le16(&s->stream_ptr);
-                for (x = 0; x < 8; x++, flags >>= 2)
-                    *pixel_ptr++ = P[flags & 0x03];
-                pixel_ptr += s->line_inc;
-            }
-
-        } else {
-            uint32_t flags;
-
-            /* 1 of 4 colors for each 2x2 block */
-            CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 4);
-
-            flags = bytestream_get_le32(&s->stream_ptr);
-
-            for (y = 0; y < 8; y += 2) {
-                for (x = 0; x < 8; x += 2, flags >>= 2) {
-                    pixel_ptr[x                ] =
-                    pixel_ptr[x + 1            ] =
-                    pixel_ptr[x +     s->stride] =
-                    pixel_ptr[x + 1 + s->stride] = P[flags & 0x03];
-                }
-                pixel_ptr += s->stride * 2;
-            }
-
-        }
-    } else {
-        uint64_t flags;
-
-        /* 1 of 4 colors for each 2x1 or 1x2 block */
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
-        flags = bytestream_get_le64(&s->stream_ptr);
-        if (!(P[2] & 0x8000)) {
-            for (y = 0; y < 8; y++) {
-                for (x = 0; x < 8; x += 2, flags >>= 2) {
-                    pixel_ptr[x    ] =
-                    pixel_ptr[x + 1] = P[flags & 0x03];
-                }
-                pixel_ptr += s->stride;
-            }
-        } else {
-            for (y = 0; y < 8; y += 2) {
-                for (x = 0; x < 8; x++, flags >>= 2) {
-                    pixel_ptr[x            ] =
-                    pixel_ptr[x + s->stride] = P[flags & 0x03];
-                }
-                pixel_ptr += s->stride * 2;
-            }
-        }
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xA_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t P[4];
-    int flags = 0;
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
-     * either top and bottom or left and right halves */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 24);
-
-    if (!(AV_RL16(s->stream_ptr) & 0x8000)) {
-
-        /* 4-color encoding for each quadrant */
-        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 48);
-
-        for (y = 0; y < 16; y++) {
-            // new values for each 4x4 block
-            if (!(y & 3)) {
-                for (x = 0; x < 4; x++)
-                    P[x] = bytestream_get_le16(&s->stream_ptr);
-                flags = bytestream_get_le32(&s->stream_ptr);
-            }
-
-            for (x = 0; x < 4; x++, flags >>= 2)
-                *pixel_ptr++ = P[flags & 0x03];
-
-            pixel_ptr += s->stride - 4;
-            // switch to right half
-            if (y == 7) pixel_ptr -= 8 * s->stride - 4;
-        }
-
-    } else {
-        // vertical split?
-        int vert = !(AV_RL16(s->stream_ptr + 16) & 0x8000);
-        uint64_t flags = 0;
-
-        /* 4-color encoding for either left and right or top and bottom
-         * halves */
-
-        for (y = 0; y < 16; y++) {
-            // load values for each half
-            if (!(y & 7)) {
-                for (x = 0; x < 4; x++)
-                    P[x] = bytestream_get_le16(&s->stream_ptr);
-                flags = bytestream_get_le64(&s->stream_ptr);
-            }
-
-            for (x = 0; x < 4; x++, flags >>= 2)
-                *pixel_ptr++ = P[flags & 0x03];
-
-            if (vert) {
-                pixel_ptr += s->stride - 4;
-                // switch to right half
-                if (y == 7) pixel_ptr -= 8 * s->stride - 4;
-            } else if (y & 1) pixel_ptr += s->line_inc;
-        }
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xB_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 64-color encoding (each pixel in block is a different color) */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 128);
-
-    for (y = 0; y < 8; y++) {
-        for (x = 0; x < 8; x++)
-            pixel_ptr[x] = bytestream_get_le16(&s->stream_ptr);
-        pixel_ptr  += s->stride;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xC_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 16-color block encoding: each 2x2 block is a different color */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 32);
-
-    for (y = 0; y < 8; y += 2) {
-        for (x = 0; x < 8; x += 2) {
-            pixel_ptr[x                ] =
-            pixel_ptr[x + 1            ] =
-            pixel_ptr[x +     s->stride] =
-            pixel_ptr[x + 1 + s->stride] = bytestream_get_le16(&s->stream_ptr);
-        }
-        pixel_ptr += s->stride * 2;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xD_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t P[2];
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 4-color block encoding: each 4x4 block is a different color */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 8);
-
-    for (y = 0; y < 8; y++) {
-        if (!(y & 3)) {
-            P[0] = bytestream_get_le16(&s->stream_ptr);
-            P[1] = bytestream_get_le16(&s->stream_ptr);
-        }
-        for (x = 0; x < 8; x++)
-            pixel_ptr[x] = P[x >> 2];
-        pixel_ptr += s->stride;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int ipvideo_decode_block_opcode_0xE_16(IpvideoContext *s)
-{
-    int x, y;
-    uint16_t pix;
-    uint16_t *pixel_ptr = (uint16_t*)s->pixel_ptr;
-
-    /* 1-color encoding: the whole block is 1 solid color */
-    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 2);
-    pix = bytestream_get_le16(&s->stream_ptr);
-
-    for (y = 0; y < 8; y++) {
-        for (x = 0; x < 8; x++)
-            pixel_ptr[x] = pix;
-        pixel_ptr += s->stride;
-    }
-
-    /* report success */
-    return 0;
-}
-
-static int (* const ipvideo_decode_block[])(IpvideoContext *s) = {
-    ipvideo_decode_block_opcode_0x0, ipvideo_decode_block_opcode_0x1,
-    ipvideo_decode_block_opcode_0x2, ipvideo_decode_block_opcode_0x3,
-    ipvideo_decode_block_opcode_0x4, ipvideo_decode_block_opcode_0x5,
-    ipvideo_decode_block_opcode_0x6, ipvideo_decode_block_opcode_0x7,
-    ipvideo_decode_block_opcode_0x8, ipvideo_decode_block_opcode_0x9,
-    ipvideo_decode_block_opcode_0xA, ipvideo_decode_block_opcode_0xB,
-    ipvideo_decode_block_opcode_0xC, ipvideo_decode_block_opcode_0xD,
-    ipvideo_decode_block_opcode_0xE, ipvideo_decode_block_opcode_0xF,
-};
-
-static int (* const ipvideo_decode_block16[])(IpvideoContext *s) = {
-    ipvideo_decode_block_opcode_0x0,    ipvideo_decode_block_opcode_0x1,
-    ipvideo_decode_block_opcode_0x2,    ipvideo_decode_block_opcode_0x3,
-    ipvideo_decode_block_opcode_0x4,    ipvideo_decode_block_opcode_0x5,
-    ipvideo_decode_block_opcode_0x6_16, ipvideo_decode_block_opcode_0x7_16,
-    ipvideo_decode_block_opcode_0x8_16, ipvideo_decode_block_opcode_0x9_16,
-    ipvideo_decode_block_opcode_0xA_16, ipvideo_decode_block_opcode_0xB_16,
-    ipvideo_decode_block_opcode_0xC_16, ipvideo_decode_block_opcode_0xD_16,
-    ipvideo_decode_block_opcode_0xE_16, ipvideo_decode_block_opcode_0x1,
-};
-
-static void ipvideo_decode_opcodes(IpvideoContext *s)
-{
-    int x, y;
-    unsigned char opcode;
-    int ret;
-    static int frame = 0;
-    GetBitContext gb;
-
-    debug_interplay("------------------ frame %d\n", frame);
-    frame++;
-
-    if (!s->is_16bpp) {
-        /* this is PAL8, so make the palette available */
-        memcpy(s->current_frame.data[1], s->avctx->palctrl->palette, PALETTE_COUNT * 4);
-
-        s->stride = s->current_frame.linesize[0];
-        s->stream_ptr = s->buf + 14;  /* data starts 14 bytes in */
-        s->stream_end = s->buf + s->size;
-    } else {
-        s->stride = s->current_frame.linesize[0] >> 1;
-        s->stream_ptr = s->buf + 16;
-        s->stream_end =
-        s->mv_ptr = s->buf + 14 + AV_RL16(s->buf+14);
-        s->mv_end = s->buf + s->size;
-    }
-    s->line_inc = s->stride - 8;
-    s->upper_motion_limit_offset = (s->avctx->height - 8) * s->current_frame.linesize[0]
-                                  + (s->avctx->width - 8) * (1 + s->is_16bpp);
-
-    init_get_bits(&gb, s->decoding_map, s->decoding_map_size * 8);
-    for (y = 0; y < s->avctx->height; y += 8) {
-        for (x = 0; x < s->avctx->width; x += 8) {
-            opcode = get_bits(&gb, 4);
-
-            debug_interplay("  block @ (%3d, %3d): encoding 0x%X, data ptr @ %p\n",
-                            x, y, opcode, s->stream_ptr);
-
-            if (!s->is_16bpp) {
-                s->pixel_ptr = s->current_frame.data[0] + x
-                              + y*s->current_frame.linesize[0];
-                ret = ipvideo_decode_block[opcode](s);
-            } else {
-                s->pixel_ptr = s->current_frame.data[0] + x*2
-                              + y*s->current_frame.linesize[0];
-                ret = ipvideo_decode_block16[opcode](s);
-            }
-            if (ret != 0) {
-                av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode problem on frame %d, @ block (%d, %d)\n",
-                       frame, x, y);
-                return;
-            }
-        }
-    }
-    if (s->stream_end - s->stream_ptr > 1) {
-        av_log(s->avctx, AV_LOG_ERROR, " Interplay video: decode finished with %td bytes left over\n",
-               s->stream_end - s->stream_ptr);
-    }
-}
-
-static av_cold int ipvideo_decode_init(AVCodecContext *avctx)
-{
-    IpvideoContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    s->is_16bpp = avctx->bits_per_coded_sample == 16;
-    avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8;
-    if (!s->is_16bpp && s->avctx->palctrl == NULL) {
-        av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n");
-        return -1;
-    }
-
-    dsputil_init(&s->dsp, avctx);
-
-    /* decoding map contains 4 bits of information per 8x8 block */
-    s->decoding_map_size = avctx->width * avctx->height / (8 * 8 * 2);
-
-    s->current_frame.data[0] = s->last_frame.data[0] =
-    s->second_last_frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int ipvideo_decode_frame(AVCodecContext *avctx,
-                                void *data, int *data_size,
-                                AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    IpvideoContext *s = avctx->priv_data;
-    AVPaletteControl *palette_control = avctx->palctrl;
-
-    /* compressed buffer needs to be large enough to at least hold an entire
-     * decoding map */
-    if (buf_size < s->decoding_map_size)
-        return buf_size;
-
-    s->decoding_map = buf;
-    s->buf = buf + s->decoding_map_size;
-    s->size = buf_size - s->decoding_map_size;
-
-    s->current_frame.reference = 3;
-    if (avctx->get_buffer(avctx, &s->current_frame)) {
-        av_log(avctx, AV_LOG_ERROR, "  Interplay Video: get_buffer() failed\n");
-        return -1;
-    }
-
-    ipvideo_decode_opcodes(s);
-
-    if (!s->is_16bpp && palette_control->palette_changed) {
-        palette_control->palette_changed = 0;
-        s->current_frame.palette_has_changed = 1;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->current_frame;
-
-    /* shuffle frames */
-    if (s->second_last_frame.data[0])
-        avctx->release_buffer(avctx, &s->second_last_frame);
-    s->second_last_frame = s->last_frame;
-    s->last_frame = s->current_frame;
-    s->current_frame.data[0] = NULL;  /* catch any access attempts */
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int ipvideo_decode_end(AVCodecContext *avctx)
-{
-    IpvideoContext *s = avctx->priv_data;
-
-    /* release the last frame */
-    if (s->last_frame.data[0])
-        avctx->release_buffer(avctx, &s->last_frame);
-    if (s->second_last_frame.data[0])
-        avctx->release_buffer(avctx, &s->second_last_frame);
-
-    return 0;
-}
-
-AVCodec interplay_video_decoder = {
-    "interplayvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_INTERPLAY_VIDEO,
-    sizeof(IpvideoContext),
-    ipvideo_decode_init,
-    NULL,
-    ipvideo_decode_end,
-    ipvideo_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE video"),
-};
diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
deleted file mode 100644
index 75166e8..0000000
--- a/libavcodec/intrax8.c
+++ /dev/null
@@ -1,789 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief IntraX8 (J-Frame) subdecoder, used by WMV2 and VC-1
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "mpegvideo.h"
-#include "msmpeg4data.h"
-#include "intrax8huf.h"
-#include "intrax8.h"
-
-#define MAX_TABLE_DEPTH(table_bits, max_bits) ((max_bits+table_bits-1)/table_bits)
-
-#define DC_VLC_BITS 9
-#define AC_VLC_BITS 9
-#define OR_VLC_BITS 7
-
-#define DC_VLC_MTD MAX_TABLE_DEPTH(DC_VLC_BITS, MAX_DC_VLC_BITS)
-#define AC_VLC_MTD MAX_TABLE_DEPTH(AC_VLC_BITS, MAX_AC_VLC_BITS)
-#define OR_VLC_MTD MAX_TABLE_DEPTH(OR_VLC_BITS, MAX_OR_VLC_BITS)
-
-static VLC j_ac_vlc[2][2][8];  //[quant<13],[intra/inter],[select]
-static VLC j_dc_vlc[2][8];     //[quant], [select]
-static VLC j_orient_vlc[2][4]; //[quant], [select]
-
-static av_cold void x8_vlc_init(void){
-    int i;
-    int offset = 0;
-    int sizeidx = 0;
-    static const uint16_t sizes[8*4 + 8*2 + 2 + 4] = {
-        576, 548, 582, 618, 546, 616, 560, 642,
-        584, 582, 704, 664, 512, 544, 656, 640,
-        512, 648, 582, 566, 532, 614, 596, 648,
-        586, 552, 584, 590, 544, 578, 584, 624,
-
-        528, 528, 526, 528, 536, 528, 526, 544,
-        544, 512, 512, 528, 528, 544, 512, 544,
-
-        128, 128, 128, 128, 128, 128};
-
-    static VLC_TYPE table[28150][2];
-
-#define  init_ac_vlc(dst,src) \
-    dst.table = &table[offset]; \
-    dst.table_allocated = sizes[sizeidx]; \
-    offset += sizes[sizeidx++]; \
-       init_vlc(&dst, \
-              AC_VLC_BITS,77, \
-              &src[1],4,2, \
-              &src[0],4,2, \
-              INIT_VLC_USE_NEW_STATIC)
-//set ac tables
-    for(i=0;i<8;i++){
-        init_ac_vlc( j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0] );
-        init_ac_vlc( j_ac_vlc[0][1][i], x8_ac1_highquant_table[i][0] );
-        init_ac_vlc( j_ac_vlc[1][0][i], x8_ac0_lowquant_table [i][0] );
-        init_ac_vlc( j_ac_vlc[1][1][i], x8_ac1_lowquant_table [i][0] );
-    }
-#undef init_ac_vlc
-
-//set dc tables
-#define init_dc_vlc(dst,src) \
-    dst.table = &table[offset]; \
-    dst.table_allocated = sizes[sizeidx]; \
-    offset += sizes[sizeidx++]; \
-        init_vlc(&dst, \
-        DC_VLC_BITS,34, \
-        &src[1],4,2, \
-        &src[0],4,2, \
-        INIT_VLC_USE_NEW_STATIC);
-    for(i=0;i<8;i++){
-        init_dc_vlc( j_dc_vlc[0][i], x8_dc_highquant_table[i][0]);
-        init_dc_vlc( j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]);
-    }
-#undef init_dc_vlc
-
-//set orient tables
-#define init_or_vlc(dst,src) \
-    dst.table = &table[offset]; \
-    dst.table_allocated = sizes[sizeidx]; \
-    offset += sizes[sizeidx++]; \
-    init_vlc(&dst, \
-    OR_VLC_BITS,12, \
-    &src[1],4,2, \
-    &src[0],4,2, \
-    INIT_VLC_USE_NEW_STATIC);
-    for(i=0;i<2;i++){
-        init_or_vlc( j_orient_vlc[0][i], x8_orient_highquant_table[i][0]);
-    }
-    for(i=0;i<4;i++){
-        init_or_vlc( j_orient_vlc[1][i], x8_orient_lowquant_table [i][0])
-    }
-    if (offset != sizeof(table)/sizeof(VLC_TYPE)/2)
-        av_log(NULL, AV_LOG_ERROR, "table size %i does not match needed %i\n", (int)(sizeof(table)/sizeof(VLC_TYPE)/2), offset);
-}
-#undef init_or_vlc
-
-static void x8_reset_vlc_tables(IntraX8Context * w){
-    memset(w->j_dc_vlc,0,sizeof(w->j_dc_vlc));
-    memset(w->j_ac_vlc,0,sizeof(w->j_ac_vlc));
-    w->j_orient_vlc=NULL;
-}
-
-static inline void x8_select_ac_table(IntraX8Context * const w , int mode){
-    MpegEncContext * const s= w->s;
-    int table_index;
-
-    assert(mode<4);
-
-    if( w->j_ac_vlc[mode] ) return;
-
-    table_index = get_bits(&s->gb, 3);
-    w->j_ac_vlc[mode] = &j_ac_vlc[w->quant<13][mode>>1][table_index];//2 modes use same tables
-    assert(w->j_ac_vlc[mode]);
-}
-
-static inline int x8_get_orient_vlc(IntraX8Context * w){
-    MpegEncContext * const s= w->s;
-    int table_index;
-
-    if(!w->j_orient_vlc ){
-        table_index = get_bits(&s->gb, 1+(w->quant<13) );
-        w->j_orient_vlc = &j_orient_vlc[w->quant<13][table_index];
-    }
-    assert(w->j_orient_vlc);
-    assert(w->j_orient_vlc->table);
-
-    return get_vlc2(&s->gb, w->j_orient_vlc->table, OR_VLC_BITS, OR_VLC_MTD);
-}
-
-#define extra_bits(eb) (eb)
-#define extra_run   (0xFF<<8)
-#define extra_level (0x00<<8)
-#define   run_offset(r)    ((r)<<16)
-#define level_offset(l)    ((l)<<24)
-static const uint32_t ac_decode_table[]={
-    /*46*/ extra_bits(3) |  extra_run  | run_offset(16) | level_offset( 0),
-    /*47*/ extra_bits(3) |  extra_run  | run_offset(24) | level_offset( 0),
-    /*48*/ extra_bits(2) |  extra_run  | run_offset( 4) | level_offset( 1),
-    /*49*/ extra_bits(3) |  extra_run  | run_offset( 8) | level_offset( 1),
-
-    /*50*/ extra_bits(5) |  extra_run  | run_offset(32) | level_offset( 0),
-    /*51*/ extra_bits(4) |  extra_run  | run_offset(16) | level_offset( 1),
-
-    /*52*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset( 4),
-    /*53*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset( 8),
-    /*54*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset(12),
-    /*55*/ extra_bits(3) | extra_level | run_offset( 0) | level_offset(16),
-    /*56*/ extra_bits(3) | extra_level | run_offset( 0) | level_offset(24),
-
-    /*57*/ extra_bits(2) | extra_level | run_offset( 1) | level_offset( 3),
-    /*58*/ extra_bits(3) | extra_level | run_offset( 1) | level_offset( 7),
-
-    /*59*/ extra_bits(2) |  extra_run  | run_offset(16) | level_offset( 0),
-    /*60*/ extra_bits(2) |  extra_run  | run_offset(20) | level_offset( 0),
-    /*61*/ extra_bits(2) |  extra_run  | run_offset(24) | level_offset( 0),
-    /*62*/ extra_bits(2) |  extra_run  | run_offset(28) | level_offset( 0),
-    /*63*/ extra_bits(4) |  extra_run  | run_offset(32) | level_offset( 0),
-    /*64*/ extra_bits(4) |  extra_run  | run_offset(48) | level_offset( 0),
-
-    /*65*/ extra_bits(2) |  extra_run  | run_offset( 4) | level_offset( 1),
-    /*66*/ extra_bits(3) |  extra_run  | run_offset( 8) | level_offset( 1),
-    /*67*/ extra_bits(4) |  extra_run  | run_offset(16) | level_offset( 1),
-
-    /*68*/ extra_bits(2) | extra_level | run_offset( 0) | level_offset( 4),
-    /*69*/ extra_bits(3) | extra_level | run_offset( 0) | level_offset( 8),
-    /*70*/ extra_bits(4) | extra_level | run_offset( 0) | level_offset(16),
-
-    /*71*/ extra_bits(2) | extra_level | run_offset( 1) | level_offset( 3),
-    /*72*/ extra_bits(3) | extra_level | run_offset( 1) | level_offset( 7),
-};
-//extra_bits = 3bits; extra_run/level = 1 bit; run_offset = 6bits; level_offset = 5 bits;
-#undef extra_bits
-#undef extra_run
-#undef extra_level
-#undef run_offset
-#undef level_offset
-
-static void x8_get_ac_rlf(IntraX8Context * const w, const int mode,
-                     int * const run, int * const level, int * const final){
-    MpegEncContext *  const s= w->s;
-    int i,e;
-
-//    x8_select_ac_table(w,mode);
-    i = get_vlc2(&s->gb, w->j_ac_vlc[mode]->table, AC_VLC_BITS, AC_VLC_MTD);
-
-    if(i<46){ //[0-45]
-        int t,l;
-        if(i<0){
-            (*level)=(*final)=//prevent 'may be used unilitialized'
-            (*run)=64;//this would cause error exit in the ac loop
-            return;
-        }
-
-        (*final) = t = (i>22);
-        i-=23*t;
-/*
-  i== 0-15 r=0-15 l=0 ;r=i& %01111
-  i==16-19 r=0-3  l=1 ;r=i& %00011
-  i==20-21 r=0-1  l=2 ;r=i& %00001
-  i==22    r=0    l=3 ;r=i& %00000
-l=lut_l[i/2]={0,0,0,0,0,0,0,0,1,1,2,3}[i>>1];// 11 10'01 01'00 00'00 00'00 00'00 00 => 0xE50000
-t=lut_mask[l]={0x0f,0x03,0x01,0x00}[l]; as i<256 the higher bits do not matter */
-        l=(0xE50000>>(i&(0x1E)))&3;/*0x1E or (~1) or ((i>>1)<<1)*/
-        t=(0x01030F>>(l<<3));
-
-        (*run)   = i&t;
-        (*level) = l;
-    }else if(i<73){//[46-72]
-        uint32_t sm;
-        uint32_t mask;
-
-        i-=46;
-        sm=ac_decode_table[i];
-
-        e=get_bits(&s->gb,sm&0xF);sm>>=8;//3bits
-        mask=sm&0xff;sm>>=8;             //1bit
-
-        (*run)  =(sm&0xff) + (e&( mask));//6bits
-        (*level)=(sm>>8)   + (e&(~mask));//5bits
-        (*final)=i>(58-46);
-    }else if(i<75){//[73-74]
-        static const uint8_t crazy_mix_runlevel[32]={
-        0x22,0x32,0x33,0x53,0x23,0x42,0x43,0x63,
-        0x24,0x52,0x34,0x73,0x25,0x62,0x44,0x83,
-        0x26,0x72,0x35,0x54,0x27,0x82,0x45,0x64,
-        0x28,0x92,0x36,0x74,0x29,0xa2,0x46,0x84};
-
-        (*final)=!(i&1);
-        e=get_bits(&s->gb,5);//get the extra bits
-        (*run)  =crazy_mix_runlevel[e]>>4;
-        (*level)=crazy_mix_runlevel[e]&0x0F;
-    }else{
-        (*level)=get_bits( &s->gb, 7-3*(i&1));
-        (*run)  =get_bits( &s->gb, 6);
-        (*final)=get_bits1(&s->gb);
-    }
-    return;
-}
-
-//static const uint8_t dc_extra_sbits[]   ={0, 1,1, 1,1, 2,2, 3,3,   4,4,   5,5,   6,6,    7,7    };
-static const uint8_t dc_index_offset[]  ={ 0, 1,2, 3,4, 5,7, 9,13, 17,25, 33,49, 65,97, 129,193};
-
-static int x8_get_dc_rlf(IntraX8Context * const w,int const mode, int * const level, int * const final){
-    MpegEncContext * const s= w->s;
-    int i,e,c;
-
-    assert(mode<3);
-    if( !w->j_dc_vlc[mode] ) {
-        int table_index;
-        table_index = get_bits(&s->gb, 3);
-        //4 modes, same table
-        w->j_dc_vlc[mode]= &j_dc_vlc[w->quant<13][table_index];
-    }
-    assert(w->j_dc_vlc);
-    assert(w->j_dc_vlc[mode]->table);
-
-    i=get_vlc2(&s->gb, w->j_dc_vlc[mode]->table, DC_VLC_BITS, DC_VLC_MTD);
-
-    /*(i>=17) {i-=17;final=1;}*/
-    c= i>16;
-    (*final)=c;
-    i-=17*c;
-
-    if(i<=0){
-        (*level)=0;
-        return -i;
-    }
-    c=(i+1)>>1;//hackish way to calculate dc_extra_sbits[]
-    c-=c>1;
-
-    e=get_bits(&s->gb,c);//get the extra bits
-    i=dc_index_offset[i]+(e>>1);
-
-    e= -(e & 1);//0,0xffffff
-    (*level)= (i ^ e) - e;// (i^0)-0 , (i^0xff)-(-1)
-    return 0;
-}
-//end of huffman
-
-static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma){
-    MpegEncContext * const s= w->s;
-    int range;
-    int sum;
-    int quant;
-
-    s->dsp.x8_setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
-                                          s->current_picture.linesize[chroma>0],
-                                          &range, &sum, w->edges);
-    if(chroma){
-        w->orient=w->chroma_orient;
-        quant=w->quant_dc_chroma;
-    }else{
-        quant=w->quant;
-    }
-
-    w->flat_dc=0;
-    if(range < quant || range < 3){
-        w->orient=0;
-        if(range < 3){//yep you read right, a +-1 idct error may break decoding!
-            w->flat_dc=1;
-            sum+=9;
-            w->predicted_dc = (sum*6899)>>17;//((1<<17)+9)/(8+8+1+2)=6899
-        }
-    }
-    if(chroma)
-        return 0;
-
-    assert(w->orient < 3);
-    if(range < 2*w->quant){
-        if( (w->edges&3) == 0){
-            if(w->orient==1) w->orient=11;
-            if(w->orient==2) w->orient=10;
-        }else{
-            w->orient=0;
-        }
-        w->raw_orient=0;
-    }else{
-        static const uint8_t prediction_table[3][12]={
-            {0,8,4, 10,11, 2,6,9,1,3,5,7},
-            {4,0,8, 11,10, 3,5,2,6,9,1,7},
-            {8,0,4, 10,11, 1,7,2,6,9,3,5}
-        };
-        w->raw_orient=x8_get_orient_vlc(w);
-        if(w->raw_orient<0) return -1;
-        assert(w->raw_orient < 12 );
-        assert(w->orient<3);
-        w->orient=prediction_table[w->orient][w->raw_orient];
-    }
-    return 0;
-}
-
-static void x8_update_predictions(IntraX8Context * const w, const int orient, const int est_run ){
-    MpegEncContext * const s= w->s;
-
-    w->prediction_table[s->mb_x*2+(s->mb_y&1)] = (est_run<<2) + 1*(orient==4) + 2*(orient==8);
-/*
-  y=2n+0 ->//0 2 4
-  y=2n+1 ->//1 3 5
-*/
-}
-static void x8_get_prediction_chroma(IntraX8Context * const w){
-    MpegEncContext * const s= w->s;
-
-    w->edges = 1*( !(s->mb_x>>1) );
-    w->edges|= 2*( !(s->mb_y>>1) );
-    w->edges|= 4*( s->mb_x >= (2*s->mb_width-1) );//mb_x for chroma would always be odd
-
-    w->raw_orient=0;
-    if(w->edges&3){//lut_co[8]={inv,4,8,8, inv,4,8,8}<- =>{1,1,0,0;1,1,0,0} => 0xCC
-        w->chroma_orient=4<<((0xCC>>w->edges)&1);
-        return;
-    }
-    w->chroma_orient = (w->prediction_table[2*s->mb_x-2] & 0x03)<<2;//block[x-1][y|1-1)]
-}
-
-static void x8_get_prediction(IntraX8Context * const w){
-    MpegEncContext * const s= w->s;
-    int a,b,c,i;
-
-    w->edges = 1*( !s->mb_x );
-    w->edges|= 2*( !s->mb_y );
-    w->edges|= 4*( s->mb_x >= (2*s->mb_width-1) );
-
-    switch(w->edges&3){
-        case 0:
-            break;
-        case 1:
-            //take the one from the above block[0][y-1]
-            w->est_run = w->prediction_table[!(s->mb_y&1)]>>2;
-            w->orient  = 1;
-            return;
-        case 2:
-            //take the one from the previous block[x-1][0]
-            w->est_run = w->prediction_table[2*s->mb_x-2]>>2;
-            w->orient  = 2;
-            return;
-        case 3:
-            w->est_run = 16;
-            w->orient  = 0;
-            return;
-    }
-    //no edge cases
-    b= w->prediction_table[2*s->mb_x   + !(s->mb_y&1) ];//block[x  ][y-1]
-    a= w->prediction_table[2*s->mb_x-2 +  (s->mb_y&1) ];//block[x-1][y  ]
-    c= w->prediction_table[2*s->mb_x-2 + !(s->mb_y&1) ];//block[x-1][y-1]
-
-    w->est_run = FFMIN(b,a);
-    /* This condition has nothing to do with w->edges, even if it looks
-       similar it would trigger if e.g. x=3;y=2;
-       I guess somebody wrote something wrong and it became standard. */
-    if( (s->mb_x & s->mb_y) != 0 ) w->est_run=FFMIN(c,w->est_run);
-    w->est_run>>=2;
-
-    a&=3;
-    b&=3;
-    c&=3;
-
-    i=( 0xFFEAF4C4>>(2*b+8*a) )&3;
-    if(i!=3) w->orient=i;
-    else     w->orient=( 0xFFEAD8>>(2*c+8*(w->quant>12)) )&3;
-/*
-lut1[b][a]={
-->{0, 1, 0, pad},
-  {0, 1, X, pad},
-  {2, 2, 2, pad}}
-   pad 2   2  2; pad X  1  0; pad 0  1  0 <-
--> 11 10 '10 10 '11 11'01 00 '11 00'01 00=>0xEAF4C4
-
-lut2[q>12][c]={
-  ->{0,2,1,pad},
-    {2,2,2,pad}}
-   pad 2  2  2; pad 1  2  0 <-
--> 11 10'10 10 '11 01'10 00=>0xEAD8
-*/
-}
-
-
-static void x8_ac_compensation(IntraX8Context * const w, int const direction, int const dc_level){
-    MpegEncContext * const s= w->s;
-    int t;
-#define B(x,y)  s->block[0][s->dsp.idct_permutation[(x)+(y)*8]]
-#define T(x)  ((x) * dc_level + 0x8000) >> 16;
-    switch(direction){
-    case 0:
-        t = T(3811);//h
-        B(1,0) -= t;
-        B(0,1) -= t;
-
-        t = T(487);//e
-        B(2,0) -= t;
-        B(0,2) -= t;
-
-        t = T(506);//f
-        B(3,0) -= t;
-        B(0,3) -= t;
-
-        t = T(135);//c
-        B(4,0) -= t;
-        B(0,4) -= t;
-        B(2,1) += t;
-        B(1,2) += t;
-        B(3,1) += t;
-        B(1,3) += t;
-
-        t = T(173);//d
-        B(5,0) -= t;
-        B(0,5) -= t;
-
-        t = T(61);//b
-        B(6,0) -= t;
-        B(0,6) -= t;
-        B(5,1) += t;
-        B(1,5) += t;
-
-        t = T(42); //a
-        B(7,0) -= t;
-        B(0,7) -= t;
-        B(4,1) += t;
-        B(1,4) += t;
-        B(4,4) += t;
-
-        t = T(1084);//g
-        B(1,1) += t;
-
-        s->block_last_index[0] = FFMAX(s->block_last_index[0], 7*8);
-        break;
-    case 1:
-        B(0,1) -= T(6269);
-        B(0,3) -= T( 708);
-        B(0,5) -= T( 172);
-        B(0,7) -= T(  73);
-
-        s->block_last_index[0] = FFMAX(s->block_last_index[0], 7*8);
-        break;
-    case 2:
-        B(1,0) -= T(6269);
-        B(3,0) -= T( 708);
-        B(5,0) -= T( 172);
-        B(7,0) -= T(  73);
-
-        s->block_last_index[0] = FFMAX(s->block_last_index[0], 7);
-        break;
-    }
-#undef B
-#undef T
-}
-
-static void dsp_x8_put_solidcolor(uint8_t const pix, uint8_t * dst, int const linesize){
-    int k;
-    for(k=0;k<8;k++){
-        memset(dst,pix,8);
-        dst+=linesize;
-    }
-}
-
-static const int16_t quant_table[64] = {
-    256, 256, 256, 256,  256, 256, 259, 262,
-    265, 269, 272, 275,  278, 282, 285, 288,
-    292, 295, 299, 303,  306, 310, 314, 317,
-    321, 325, 329, 333,  337, 341, 345, 349,
-    353, 358, 362, 366,  371, 375, 379, 384,
-    389, 393, 398, 403,  408, 413, 417, 422,
-    428, 433, 438, 443,  448, 454, 459, 465,
-    470, 476, 482, 488,  493, 499, 505, 511
-};
-
-static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
-    MpegEncContext * const s= w->s;
-
-    uint8_t * scantable;
-    int final,run,level;
-    int ac_mode,dc_mode,est_run,dc_level;
-    int pos,n;
-    int zeros_only;
-    int use_quant_matrix;
-    int sign;
-
-    assert(w->orient<12);
-    s->dsp.clear_block(s->block[0]);
-
-    if(chroma){
-        dc_mode=2;
-    }else{
-        dc_mode=!!w->est_run;//0,1
-    }
-
-    if(x8_get_dc_rlf(w, dc_mode, &dc_level, &final)) return -1;
-    n=0;
-    zeros_only=0;
-    if(!final){//decode ac
-        use_quant_matrix=w->use_quant_matrix;
-        if(chroma){
-            ac_mode = 1;
-            est_run = 64;//not used
-        }else{
-            if (w->raw_orient < 3){
-                use_quant_matrix = 0;
-            }
-            if(w->raw_orient > 4){
-                ac_mode = 0;
-                est_run = 64;
-            }else{
-                if(w->est_run > 1){
-                    ac_mode = 2;
-                    est_run=w->est_run;
-                }else{
-                    ac_mode = 3;
-                    est_run = 64;
-                }
-            }
-        }
-        x8_select_ac_table(w,ac_mode);
-        /*scantable_selector[12]={0,2,0,1,1,1,0,2,2,0,1,2};<-
-        -> 10'01' 00'10' 10'00' 01'01' 01'00' 10'00 =>0x928548 */
-        scantable = w->scantable[ (0x928548>>(2*w->orient))&3 ].permutated;
-        pos=0;
-        do {
-            n++;
-            if( n >= est_run ){
-                ac_mode=3;
-                x8_select_ac_table(w,3);
-            }
-
-            x8_get_ac_rlf(w,ac_mode,&run,&level,&final);
-
-            pos+=run+1;
-            if(pos>63){
-                //this also handles vlc error in x8_get_ac_rlf
-                return -1;
-            }
-            level= (level+1) * w->dquant;
-            level+= w->qsum;
-
-            sign = - get_bits1(&s->gb);
-            level = (level ^ sign) - sign;
-
-            if(use_quant_matrix){
-                level = (level*quant_table[pos])>>8;
-            }
-            s->block[0][ scantable[pos] ]=level;
-        }while(!final);
-
-        s->block_last_index[0]=pos;
-    }else{//DC only
-        s->block_last_index[0]=0;
-        if(w->flat_dc && ((unsigned)(dc_level+1)) < 3){//[-1;1]
-            int32_t divide_quant= !chroma ? w->divide_quant_dc_luma:
-                                            w->divide_quant_dc_chroma;
-            int32_t dc_quant    = !chroma ? w->quant:
-                                            w->quant_dc_chroma;
-
-            //original intent dc_level+=predicted_dc/quant; but it got lost somewhere in the rounding
-            dc_level+= (w->predicted_dc*divide_quant + (1<<12) )>>13;
-
-            dsp_x8_put_solidcolor( av_clip_uint8((dc_level*dc_quant+4)>>3),
-                                   s->dest[chroma], s->current_picture.linesize[!!chroma]);
-
-            goto block_placed;
-        }
-        zeros_only = (dc_level == 0);
-    }
-    if(!chroma){
-        s->block[0][0] = dc_level*w->quant;
-    }else{
-        s->block[0][0] = dc_level*w->quant_dc_chroma;
-    }
-
-    //there is !zero_only check in the original, but dc_level check is enough
-    if( (unsigned int)(dc_level+1) >= 3 && (w->edges&3) != 3 ){
-        int direction;
-        /*ac_comp_direction[orient] = { 0, 3, 3, 1, 1, 0, 0, 0, 2, 2, 2, 1 };<-
-        -> 01'10' 10'10' 00'00' 00'01' 01'11' 11'00 =>0x6A017C */
-        direction= (0x6A017C>>(w->orient*2))&3;
-        if (direction != 3){
-            x8_ac_compensation(w, direction, s->block[0][0]);//modify block_last[]
-        }
-    }
-
-    if(w->flat_dc){
-        dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma], s->current_picture.linesize[!!chroma]);
-    }else{
-        s->dsp.x8_spatial_compensation[w->orient]( s->edge_emu_buffer,
-                                            s->dest[chroma],
-                                            s->current_picture.linesize[!!chroma] );
-    }
-    if(!zeros_only)
-        s->dsp.idct_add ( s->dest[chroma],
-                          s->current_picture.linesize[!!chroma],
-                          s->block[0] );
-
-block_placed:
-
-    if(!chroma){
-        x8_update_predictions(w,w->orient,n);
-    }
-
-    if(s->loop_filter){
-        uint8_t* ptr = s->dest[chroma];
-        int linesize = s->current_picture.linesize[!!chroma];
-
-        if(!( (w->edges&2) || ( zeros_only && (w->orient|4)==4 ) )){
-            s->dsp.x8_h_loop_filter(ptr, linesize, w->quant);
-        }
-        if(!( (w->edges&1) || ( zeros_only && (w->orient|8)==8 ) )){
-            s->dsp.x8_v_loop_filter(ptr, linesize, w->quant);
-        }
-    }
-    return 0;
-}
-
-static void x8_init_block_index(MpegEncContext *s){ //FIXME maybe merge with ff_*
-//not s->linesize as this would be wrong for field pics
-//not that IntraX8 has interlacing support ;)
-    const int linesize  = s->current_picture.linesize[0];
-    const int uvlinesize= s->current_picture.linesize[1];
-
-    s->dest[0] = s->current_picture.data[0];
-    s->dest[1] = s->current_picture.data[1];
-    s->dest[2] = s->current_picture.data[2];
-
-    s->dest[0] +=   s->mb_y        *   linesize << 3;
-    s->dest[1] += ( s->mb_y&(~1) ) * uvlinesize << 2;//chroma blocks are on add rows
-    s->dest[2] += ( s->mb_y&(~1) ) * uvlinesize << 2;
-}
-
-/**
- * Initialize IntraX8 frame decoder.
- * Requires valid MpegEncContext with valid s->mb_width before calling.
- * @param w pointer to IntraX8Context
- * @param s pointer to MpegEncContext of the parent codec
- */
-av_cold void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s){
-
-    w->s=s;
-    x8_vlc_init();
-    assert(s->mb_width>0);
-    w->prediction_table=av_mallocz(s->mb_width*2*2);//two rows, 2 blocks per cannon mb
-
-    ff_init_scantable(s->dsp.idct_permutation, &w->scantable[0], wmv1_scantable[0]);
-    ff_init_scantable(s->dsp.idct_permutation, &w->scantable[1], wmv1_scantable[2]);
-    ff_init_scantable(s->dsp.idct_permutation, &w->scantable[2], wmv1_scantable[3]);
-}
-
-/**
- * Destroy IntraX8 frame structure.
- * @param w pointer to IntraX8Context
- */
-av_cold void ff_intrax8_common_end(IntraX8Context * w)
-{
-    av_freep(&w->prediction_table);
-}
-
-/**
- * Decode single IntraX8 frame.
- * The parent codec must fill s->loopfilter and s->gb (bitstream).
- * The parent codec must call MPV_frame_start(), ff_er_frame_start() before calling this function.
- * The parent codec must call ff_er_frame_end(), MPV_frame_end() after calling this function.
- * This function does not use MPV_decode_mb().
- * lowres decoding is theoretically impossible.
- * @param w pointer to IntraX8Context
- * @param dquant doubled quantizer, it would be odd in case of VC-1 halfpq==1.
- * @param quant_offset offset away from zero
- */
-//FIXME extern uint8_t wmv3_dc_scale_table[32];
-int ff_intrax8_decode_picture(IntraX8Context * const w, int dquant, int quant_offset){
-    MpegEncContext * const s= w->s;
-    int mb_xy;
-    assert(s);
-    w->use_quant_matrix = get_bits1(&s->gb);
-
-    w->dquant = dquant;
-    w->quant  = dquant >> 1;
-    w->qsum   = quant_offset;
-
-    w->divide_quant_dc_luma = ((1<<16) + (w->quant>>1)) / w->quant;
-    if(w->quant < 5){
-        w->quant_dc_chroma =  w->quant;
-        w->divide_quant_dc_chroma = w->divide_quant_dc_luma;
-    }else{
-        w->quant_dc_chroma =  w->quant+((w->quant+3)>>3);
-        w->divide_quant_dc_chroma = ((1<<16) + (w->quant_dc_chroma>>1)) / w->quant_dc_chroma;
-    }
-    x8_reset_vlc_tables(w);
-
-    s->resync_mb_x=0;
-    s->resync_mb_y=0;
-
-    for(s->mb_y=0; s->mb_y < s->mb_height*2; s->mb_y++){
-        x8_init_block_index(s);
-        mb_xy=(s->mb_y>>1)*s->mb_stride;
-
-        for(s->mb_x=0; s->mb_x < s->mb_width*2; s->mb_x++){
-            x8_get_prediction(w);
-            if(x8_setup_spatial_predictor(w,0)) goto error;
-            if(x8_decode_intra_mb(w,0)) goto error;
-
-            if( s->mb_x & s->mb_y & 1 ){
-                x8_get_prediction_chroma(w);
-
-                /*when setting up chroma, no vlc is read,
-                so no error condition can be reached*/
-                x8_setup_spatial_predictor(w,1);
-                if(x8_decode_intra_mb(w,1)) goto error;
-
-                x8_setup_spatial_predictor(w,2);
-                if(x8_decode_intra_mb(w,2)) goto error;
-
-                s->dest[1]+= 8;
-                s->dest[2]+= 8;
-
-                /*emulate MB info in the relevant tables*/
-                s->mbskip_table [mb_xy]=0;
-                s->mbintra_table[mb_xy]=1;
-                s->current_picture.qscale_table[mb_xy]=w->quant;
-                mb_xy++;
-            }
-            s->dest[0]+= 8;
-        }
-        if(s->mb_y&1){
-            ff_draw_horiz_band(s, (s->mb_y-1)*8, 16);
-        }
-    }
-
-error:
-    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y,
-                        (s->mb_x>>1)-1, (s->mb_y>>1)-1,
-                        (AC_END|DC_END|MV_END) );
-    return 0;
-}
diff --git a/libavcodec/intrax8.h b/libavcodec/intrax8.h
deleted file mode 100644
index 8ce4f8d..0000000
--- a/libavcodec/intrax8.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_INTRAX8_H
-#define AVCODEC_INTRAX8_H
-
-#include "get_bits.h"
-#include "mpegvideo.h"
-
-typedef struct{
-    VLC * j_ac_vlc[4];//they point to the static j_mb_vlc
-    VLC * j_orient_vlc;
-    VLC * j_dc_vlc[3];
-
-    int use_quant_matrix;
-//set by ff_intrax8_common_init
-    uint8_t * prediction_table;//2*(mb_w*2)
-    ScanTable scantable[3];
-//set by the caller codec
-    MpegEncContext * s;
-    int quant;
-    int dquant;
-    int qsum;
-//calculated per frame
-    int quant_dc_chroma;
-    int divide_quant_dc_luma;
-    int divide_quant_dc_chroma;
-//changed per block
-    int edges;
-    int flat_dc;
-    int predicted_dc;
-    int raw_orient;
-    int chroma_orient;
-    int orient;
-    int est_run;
-} IntraX8Context;
-
-void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s);
-void ff_intrax8_common_end(IntraX8Context * w);
-int  ff_intrax8_decode_picture(IntraX8Context * w, int quant, int halfpq);
-
-#endif /* AVCODEC_INTRAX8_H */
diff --git a/libavcodec/intrax8dsp.c b/libavcodec/intrax8dsp.c
deleted file mode 100644
index 692e1b1..0000000
--- a/libavcodec/intrax8dsp.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
- *@brief IntraX8 frame subdecoder image manipulation routines
- */
-
-#include "dsputil.h"
-
-/*
-area positions, #3 is 1 pixel only, other are 8 pixels
-   |66666666|
-  3|44444444|55555555|
-- -+--------+--------+
-1 2|XXXXXXXX|
-1 2|XXXXXXXX|
-1 2|XXXXXXXX|
-1 2|XXXXXXXX|
-1 2|XXXXXXXX|
-1 2|XXXXXXXX|
-1 2|XXXXXXXX|
-1 2|XXXXXXXX|
-^-start
-*/
-
-#define area1 (0)
-#define area2 (8)
-#define area3 (8+8)
-#define area4 (8+8+1)
-#define area5 (8+8+1+8)
-#define area6 (8+8+1+16)
-
-/**
- Collect statistics and prepare the edge pixels required by the other spatial compensation functions.
-
- * @param src pointer to the beginning of the processed block
- * @param dst pointer to emu_edge, edge pixels are stored the way other compensation routines do.
- * @param linesize byte offset between 2 vertical pixels in the source image
- * @param range pointer to the variable where the edge pixel range is to be stored (max-min values)
- * @param psum  pointer to the variable where the edge pixel sum is to be stored
- * @param edges Informs this routine that the block is on an image border, so it has to interpolate the missing edge pixels.
-                and some of the edge pixels should be interpolated, the flag has the following meaning:
-                1   - mb_x==0 - first block in the row, interpolate area #1,#2,#3;
-                2   - mb_y==0 - first row, interpolate area #3,#4,#5,#6;
-        note:   1|2 - mb_x==mb_y==0 - first block, use 0x80 value for all areas;
-                4   - mb_x>= (mb_width-1) last block in the row, interpolate area #5;
-*/
-static void x8_setup_spatial_compensation(uint8_t *src, uint8_t *dst, int linesize,
-           int * range, int * psum,  int edges){
-    uint8_t * ptr;
-    int sum;
-    int i;
-    int min_pix,max_pix;
-    uint8_t c;
-
-    if((edges&3)==3){
-        *psum=0x80*(8+1+8+2);
-        *range=0;
-        memset(dst,0x80,16+1+16+8);
-        //this triggers flat_dc for sure.
-        //flat_dc avoids all (other) prediction modes, but requires dc_level decoding.
-        return;
-    }
-
-    min_pix=256;
-    max_pix=-1;
-
-    sum=0;
-
-    if(!(edges&1)){//(mb_x!=0)//there is previous block on this row
-        ptr=src-1;//left column, area 2
-        for(i=7;i>=0;i--){
-            c=*(ptr-1);//area1, same mb as area2, no need to check
-            dst[area1+i]=c;
-            c=*(ptr);
-
-            sum+=c;
-            min_pix=FFMIN(min_pix,c);
-            max_pix=FFMAX(max_pix,c);
-            dst[area2+i]=c;
-
-            ptr+=linesize;
-        }
-    }
-
-    if(!(edges&2)){  //(mb_y!=0)//there is row above
-        ptr=src-linesize;//top line
-        for(i=0;i<8;i++){
-            c=*(ptr+i);
-            sum+=c;
-            min_pix=FFMIN(min_pix, c);
-            max_pix=FFMAX(max_pix, c);
-        }
-        if(edges&4){//last block on the row?
-            memset(dst+area5,c,8);//set with last pixel fr
-            memcpy(dst+area4, ptr, 8);
-        }else{
-            memcpy(dst+area4, ptr, 16);//both area4 and 5
-        }
-        memcpy(dst+area6, ptr-linesize, 8);//area6 always present in the above block
-    }
-    //now calculate the stuff we need
-    if(edges&3){//mb_x==0 || mb_y==0){
-        int avg=(sum+4)>>3;
-        if(edges&1){ //(mb_x==0) {//implies mb_y!=0
-            memset(dst+area1,avg,8+8+1);//areas 1,2 and 3 are averaged
-        }else{//implies y==0 x!=0
-            memset(dst+area3,avg, 1+16+8);//areas 3, 4,5,6
-        }
-        sum+=avg*9;
-    }else{
-        uint8_t c=*(src-1-linesize);//the edge pixel, in the top line and left column
-        dst[area3]=c;
-        sum+=c;
-        //edge pixel is not part of min/max
-    }
-    (*range) = max_pix - min_pix;
-    sum += *(dst+area5) + *(dst+area5+1);
-    *psum = sum;
-}
-
-
-static const uint16_t zero_prediction_weights[64*2] = {
-    640,  640,  669,  480,  708,  354,  748, 257,  792, 198,  760, 143,  808, 101,  772,  72,
-    480,  669,  537,  537,  598,  416,  661, 316,  719, 250,  707, 185,  768, 134,  745,  97,
-    354,  708,  416,  598,  488,  488,  564, 388,  634, 317,  642, 241,  716, 179,  706, 132,
-    257,  748,  316,  661,  388,  564,  469, 469,  543, 395,  571, 311,  655, 238,  660, 180,
-    198,  792,  250,  719,  317,  634,  395, 543,  469, 469,  507, 380,  597, 299,  616, 231,
-    161,  855,  206,  788,  266,  710,  340, 623,  411, 548,  455, 455,  548, 366,  576, 288,
-    122,  972,  159,  914,  211,  842,  276, 758,  341, 682,  389, 584,  483, 483,  520, 390,
-    110, 1172,  144, 1107,  193, 1028,  254, 932,  317, 846,  366, 731,  458, 611,  499, 499
-};
-
-static void spatial_compensation_0(uint8_t *src , uint8_t *dst, int linesize){
-    int i,j;
-    int x,y;
-    unsigned int p;//power divided by 2
-    int a;
-    uint16_t left_sum[2][8];
-    uint16_t  top_sum[2][8];
-    memset(left_sum,0,2*8*sizeof(uint16_t));
-    memset( top_sum,0,2*8*sizeof(uint16_t));
-
-    for(i=0;i<8;i++){
-        a=src[area2+7-i]<<4;
-        for(j=0;j<8;j++){
-            p=abs(i-j);
-            left_sum[p&1][j]+= a>>(p>>1);
-        }
-    }
-
-    for(i=0;i<8;i++){
-        a=src[area4+i]<<4;
-        for(j=0;j<8;j++){
-            p=abs(i-j);
-            top_sum[p&1][j]+=   a>>(p>>1);
-        }
-    }
-    for(;i<10;i++){
-        a=src[area4+i]<<4;
-        for(j=5;j<8;j++){
-            p=abs(i-j);
-            top_sum[p&1][j]+=   a>>(p>>1);
-        }
-    }
-    for(;i<12;i++){
-        a=src[area4+i]<<4;
-        for(j=7;j<8;j++){
-            p=abs(i-j);
-            top_sum[p&1][j]+=   a>>(p>>1);
-        }
-    }
-
-    for(i=0;i<8;i++){
-        top_sum [0][i]+=(top_sum [1][i]*181 + 128 )>>8;//181 is sqrt(2)/2
-        left_sum[0][i]+=(left_sum[1][i]*181 + 128 )>>8;
-    }
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x] = (
-                      (uint32_t)top_sum [0][x]*zero_prediction_weights[y*16+x*2+0] +
-                      (uint32_t)left_sum[0][y]*zero_prediction_weights[y*16+x*2+1] +
-                       0x8000
-                      )>>16;
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_1(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=src[area4 + FFMIN(2*y+x+2, 15) ];
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_2(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=src[area4 +1+y+x];
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_3(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=src[area4 +((y+1)>>1)+x];
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_4(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=( src[area4+x] + src[area6+x] + 1 )>>1;
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_5(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            if(2*x-y<0){
-                dst[x]=src[area2+9+2*x-y];
-            }else{
-                dst[x]=src[area4 +x-((y+1)>>1)];
-            }
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_6(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=src[area3+x-y];
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_7(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            if(x-2*y>0){
-                dst[x]=( src[area3-1+x-2*y] + src[area3+x-2*y] + 1)>>1;
-            }else{
-                dst[x]=src[area2+8-y +(x>>1)];
-            }
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_8(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=( src[area1+7-y] + src[area2+7-y] + 1 )>>1;
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_9(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=src[area2+6-FFMIN(x+y,6)];
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_10(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=(src[area2+7-y]*(8-x)+src[area4+x]*x+4)>>3;
-        }
-        dst+=linesize;
-    }
-}
-static void spatial_compensation_11(uint8_t *src , uint8_t *dst, int linesize){
-    int x,y;
-
-    for(y=0;y<8;y++){
-        for(x=0;x<8;x++){
-            dst[x]=(src[area2+7-y]*y+src[area4+x]*(8-y)+4)>>3;
-        }
-        dst+=linesize;
-    }
-}
-
-static void x8_loop_filter(uint8_t * ptr, const int a_stride, const int b_stride, int quant){
-    int i,t;
-    int p0,p1,p2,p3,p4,p5,p6,p7,p8,p9;
-    int ql=(quant+10)>>3;
-
-    for(i=0; i<8; i++,ptr+=b_stride){
-        p0=ptr[-5*a_stride];
-        p1=ptr[-4*a_stride];
-        p2=ptr[-3*a_stride];
-        p3=ptr[-2*a_stride];
-        p4=ptr[-1*a_stride];
-        p5=ptr[ 0         ];
-        p6=ptr[ 1*a_stride];
-        p7=ptr[ 2*a_stride];
-        p8=ptr[ 3*a_stride];
-        p9=ptr[ 4*a_stride];
-
-        t=
-            (FFABS(p1-p2) <= ql) +
-            (FFABS(p2-p3) <= ql) +
-            (FFABS(p3-p4) <= ql) +
-            (FFABS(p4-p5) <= ql);
-        if(t>0){//You need at least 1 to be able to reach a total score of 6.
-            t+=
-                (FFABS(p5-p6) <= ql) +
-                (FFABS(p6-p7) <= ql) +
-                (FFABS(p7-p8) <= ql) +
-                (FFABS(p8-p9) <= ql) +
-                (FFABS(p0-p1) <= ql);
-            if(t>=6){
-                int min,max;
-
-                min=max=p1;
-                min=FFMIN(min,p3); max=FFMAX(max,p3);
-                min=FFMIN(min,p5); max=FFMAX(max,p5);
-                min=FFMIN(min,p8); max=FFMAX(max,p8);
-                if(max-min<2*quant){//early stop
-                    min=FFMIN(min,p2); max=FFMAX(max,p2);
-                    min=FFMIN(min,p4); max=FFMAX(max,p4);
-                    min=FFMIN(min,p6); max=FFMAX(max,p6);
-                    min=FFMIN(min,p7); max=FFMAX(max,p7);
-                    if(max-min<2*quant){
-                        ptr[-2*a_stride]=(4*p2 + 3*p3 + 1*p7 + 4)>>3;
-                        ptr[-1*a_stride]=(3*p2 + 3*p4 + 2*p7 + 4)>>3;
-                        ptr[ 0         ]=(2*p2 + 3*p5 + 3*p7 + 4)>>3;
-                        ptr[ 1*a_stride]=(1*p2 + 3*p6 + 4*p7 + 4)>>3;
-                        continue;
-                    };
-                }
-            }
-        }
-        {
-            int x,x0,x1,x2;
-            int m;
-
-            x0 =   (2*p3 - 5*p4 + 5*p5 - 2*p6 + 4)>>3;
-            if(FFABS(x0) < quant){
-                x1=(2*p1 - 5*p2 + 5*p3 - 2*p4 + 4)>>3;
-                x2=(2*p5 - 5*p6 + 5*p7 - 2*p8 + 4)>>3;
-
-                x=FFABS(x0) - FFMIN( FFABS(x1), FFABS(x2) );
-                m=p4-p5;
-
-                if( x > 0 && (m^x0) <0){
-                    int32_t sign;
-
-                    sign=m>>31;
-                    m=(m^sign)-sign;//abs(m)
-                    m>>=1;
-
-                    x=(5*x)>>3;
-
-                    if(x>m) x=m;
-
-                    x=(x^sign)-sign;
-
-                    ptr[-1*a_stride] -= x;
-                    ptr[ 0]          += x;
-                }
-            }
-        }
-    }
-}
-
-static void x8_h_loop_filter(uint8_t *src, int stride, int qscale){
-    x8_loop_filter(src, stride, 1, qscale);
-}
-
-static void x8_v_loop_filter(uint8_t *src, int stride, int qscale){
-    x8_loop_filter(src, 1, stride, qscale);
-}
-
-av_cold void ff_intrax8dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
-    dsp->x8_h_loop_filter=x8_h_loop_filter;
-    dsp->x8_v_loop_filter=x8_v_loop_filter;
-    dsp->x8_setup_spatial_compensation=x8_setup_spatial_compensation;
-    dsp->x8_spatial_compensation[0]=spatial_compensation_0;
-    dsp->x8_spatial_compensation[1]=spatial_compensation_1;
-    dsp->x8_spatial_compensation[2]=spatial_compensation_2;
-    dsp->x8_spatial_compensation[3]=spatial_compensation_3;
-    dsp->x8_spatial_compensation[4]=spatial_compensation_4;
-    dsp->x8_spatial_compensation[5]=spatial_compensation_5;
-    dsp->x8_spatial_compensation[6]=spatial_compensation_6;
-    dsp->x8_spatial_compensation[7]=spatial_compensation_7;
-    dsp->x8_spatial_compensation[8]=spatial_compensation_8;
-    dsp->x8_spatial_compensation[9]=spatial_compensation_9;
-    dsp->x8_spatial_compensation[10]=spatial_compensation_10;
-    dsp->x8_spatial_compensation[11]=spatial_compensation_11;
-}
diff --git a/libavcodec/intrax8huf.h b/libavcodec/intrax8huf.h
deleted file mode 100644
index 375906b..0000000
--- a/libavcodec/intrax8huf.h
+++ /dev/null
@@ -1,918 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_INTRAX8HUF_H
-#define AVCODEC_INTRAX8HUF_H
-
-#include <inttypes.h>
-
-
-static const uint16_t x8_orient_lowquant_table[4][12][2]={
-    {//0
-        {0x0000,  1}, {0x0004,  3}, {0x0005,  3}, {0x000C,  4},
-        {0x000D,  4}, {0x0038,  6}, {0x001D,  5}, {0x0039,  6},
-        {0x003C,  6}, {0x003D,  6}, {0x003E,  6}, {0x003F,  6},
-    },{//1
-        {0x0000,  5}, {0x0001,  5}, {0x0002,  5}, {0x0001,  2},
-        {0x0002,  2}, {0x0002,  4}, {0x0003,  5}, {0x0006,  3},
-        {0x0003,  4}, {0x000E,  4}, {0x001E,  5}, {0x001F,  5},
-    },{//2
-        {0x0000,  2}, {0x0001,  2}, {0x0004,  3}, {0x0005,  3},
-        {0x0006,  3}, {0x0038,  6}, {0x0039,  6}, {0x001D,  5},
-        {0x003C,  6}, {0x003D,  6}, {0x003E,  6}, {0x003F,  6},
-    },{//3
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0001,  2},
-        {0x0002,  2}, {0x0018,  5}, {0x0019,  5}, {0x000D,  4},
-        {0x001C,  5}, {0x001D,  5}, {0x001E,  5}, {0x001F,  5},
-    }
-};
-
-static const uint16_t x8_orient_highquant_table[2][12][2]={
-    {//0
-        {0x0000,  2}, {0x0001,  2}, {0x0004,  3}, {0x0005,  3},
-        {0x0006,  3}, {0x0038,  6}, {0x001D,  5}, {0x0039,  6},
-        {0x003C,  6}, {0x003D,  6}, {0x003E,  6}, {0x003F,  6},
-    },{//1
-        {0x0000,  1}, {0x0002,  2}, {0x0006,  3}, {0x001C,  5},
-        {0x001D,  5}, {0x0078,  7}, {0x003D,  6}, {0x0079,  7},
-        {0x007C,  7}, {0x007D,  7}, {0x007E,  7}, {0x007F,  7},
-    }
-};
-#define MAX_OR_VLC_BITS 7
-
-
-static const uint16_t x8_dc_lowquant_table[8][34][2]={
-    {//0
-        {0x0000,  5}, {0x0001,  4}, {0x0001,  5}, {0x0004,  5},
-        {0x0005,  5}, {0x0006,  5}, {0x000E,  6}, {0x000F,  6},
-        {0x0040,  8}, {0x0041,  8}, {0x0840, 13}, {0x0841, 13},
-        {0x0842, 13}, {0x0843, 13}, {0x0844, 13}, {0x0845, 13},
-        {0x0846, 13}, {0x0002,  2}, {0x0003,  2}, {0x0003,  3},
-        {0x0005,  4}, {0x0009,  5}, {0x0011,  6}, {0x0043,  8},
-        {0x0085,  9}, {0x0847, 13}, {0x0848, 13}, {0x0849, 13},
-        {0x084A, 13}, {0x084B, 13}, {0x084C, 13}, {0x084D, 13},
-        {0x084E, 13}, {0x084F, 13},
-    },{//1
-        {0x0000,  4}, {0x0001,  3}, {0x0002,  3}, {0x0001,  4},
-        {0x0006,  4}, {0x0004,  3}, {0x0007,  4}, {0x0005,  3},
-        {0x000C,  4}, {0x000D,  4}, {0x001C,  5}, {0x003A,  6},
-        {0x01D8,  9}, {0x01D9,  9}, {0x1DA0, 13}, {0x1DA1, 13},
-        {0x1DA2, 13}, {0x003C,  6}, {0x003D,  6}, {0x003E,  6},
-        {0x0077,  7}, {0x01DB,  9}, {0x007E,  7}, {0x00FE,  8},
-        {0x01FE,  9}, {0x1DA3, 13}, {0x1DA4, 13}, {0x1DA5, 13},
-        {0x0ED3, 12}, {0x0ED4, 12}, {0x01FF,  9}, {0x0ED5, 12},
-        {0x0ED6, 12}, {0x0ED7, 12},
-    },{//2
-        {0x0000,  4}, {0x0001,  3}, {0x0002,  3}, {0x0001,  4},
-        {0x0006,  4}, {0x0007,  4}, {0x0008,  4}, {0x0009,  4},
-        {0x0028,  6}, {0x0029,  6}, {0x0054,  7}, {0x0055,  7},
-        {0x0AC0, 12}, {0x0AC1, 12}, {0x0AC2, 12}, {0x0AC3, 12},
-        {0x0AC4, 12}, {0x000B,  4}, {0x0006,  3}, {0x000E,  4},
-        {0x001E,  5}, {0x003E,  6}, {0x003F,  6}, {0x0057,  7},
-        {0x00AD,  8}, {0x0AC5, 12}, {0x0AC6, 12}, {0x0AC7, 12},
-        {0x0AC8, 12}, {0x0AC9, 12}, {0x0ACA, 12}, {0x0ACB, 12},
-        {0x0566, 11}, {0x0567, 11},
-    },{//3
-        {0x0000,  4}, {0x0001,  2}, {0x0001,  3}, {0x0004,  3},
-        {0x0005,  3}, {0x0006,  3}, {0x0001,  4}, {0x000E,  4},
-        {0x003C,  6}, {0x003D,  6}, {0x007C,  7}, {0x00FA,  8},
-        {0x3EC0, 14}, {0x3EC1, 14}, {0x3EC2, 14}, {0x3EC3, 14},
-        {0x1F62, 13}, {0x01F7,  9}, {0x007E,  7}, {0x00FE,  8},
-        {0x00FF,  8}, {0x1F63, 13}, {0x1F64, 13}, {0x1F65, 13},
-        {0x1F66, 13}, {0x1F67, 13}, {0x1F68, 13}, {0x1F69, 13},
-        {0x1F6A, 13}, {0x1F6B, 13}, {0x1F6C, 13}, {0x1F6D, 13},
-        {0x1F6E, 13}, {0x1F6F, 13},
-    },{//4
-        {0x0000,  7}, {0x0001,  7}, {0x0002,  7}, {0x0003,  7},
-        {0x0004,  7}, {0x0005,  7}, {0x0006,  7}, {0x0007,  7},
-        {0x0008,  7}, {0x0009,  7}, {0x000A,  7}, {0x000B,  7},
-        {0x000C,  7}, {0x000D,  7}, {0x000E,  7}, {0x000F,  7},
-        {0x0010,  7}, {0x0001,  1}, {0x0001,  2}, {0x0011,  7},
-        {0x0012,  7}, {0x0013,  7}, {0x0014,  7}, {0x0015,  7},
-        {0x0016,  7}, {0x0017,  7}, {0x0018,  7}, {0x0019,  7},
-        {0x001A,  7}, {0x001B,  7}, {0x001C,  7}, {0x001D,  7},
-        {0x001E,  7}, {0x001F,  7},
-    },{//5
-        {0x0000,  5}, {0x0001,  4}, {0x0001,  5}, {0x0008,  6},
-        {0x0009,  6}, {0x000A,  6}, {0x0016,  7}, {0x000C,  6},
-        {0x0017,  7}, {0x000D,  6}, {0x0038,  8}, {0x001D,  7},
-        {0x0039,  8}, {0x0780, 13}, {0x0781, 13}, {0x0782, 13},
-        {0x0783, 13}, {0x0002,  3}, {0x0001,  1}, {0x0003,  3},
-        {0x001F,  7}, {0x003D,  8}, {0x0079,  9}, {0x0784, 13},
-        {0x0785, 13}, {0x0786, 13}, {0x0787, 13}, {0x0788, 13},
-        {0x0789, 13}, {0x078A, 13}, {0x078B, 13}, {0x078C, 13},
-        {0x078D, 13}, {0x03C7, 12},
-    },{//6
-        {0x0000,  4}, {0x0001,  2}, {0x0001,  3}, {0x0004,  3},
-        {0x0001,  4}, {0x000A,  4}, {0x0016,  5}, {0x002E,  6},
-        {0x005E,  7}, {0x005F,  7}, {0x00C0,  8}, {0x3040, 14},
-        {0x3041, 14}, {0x0305, 10}, {0x0183,  9}, {0x3042, 14},
-        {0x3043, 14}, {0x000D,  4}, {0x0007,  3}, {0x0019,  5},
-        {0x0031,  6}, {0x00C2,  8}, {0x00C3,  8}, {0x3044, 14},
-        {0x3045, 14}, {0x3046, 14}, {0x3047, 14}, {0x3048, 14},
-        {0x3049, 14}, {0x304A, 14}, {0x304B, 14}, {0x304C, 14},
-        {0x304D, 14}, {0x1827, 13},
-    },{//7
-        {0x0000,  6}, {0x0001,  6}, {0x0002,  6}, {0x0006,  7},
-        {0x0007,  7}, {0x0004,  6}, {0x0005,  6}, {0x0006,  6},
-        {0x000E,  7}, {0x001E,  8}, {0x001F,  8}, {0x0040,  9},
-        {0x0082, 10}, {0x0830, 14}, {0x0831, 14}, {0x0832, 14},
-        {0x0833, 14}, {0x0001,  1}, {0x0001,  2}, {0x0003,  4},
-        {0x0005,  5}, {0x0009,  6}, {0x0011,  7}, {0x0021,  8},
-        {0x0834, 14}, {0x0835, 14}, {0x0836, 14}, {0x0837, 14},
-        {0x0838, 14}, {0x0839, 14}, {0x083A, 14}, {0x083B, 14},
-        {0x041E, 13}, {0x041F, 13},
-    }
-};
-
-static const uint16_t x8_dc_highquant_table[8][34][2]={
-    {//0
-        {0x0000,  5}, {0x0001,  4}, {0x0002,  4}, {0x0001,  5},
-        {0x0006,  5}, {0x0004,  4}, {0x0007,  5}, {0x000A,  5},
-        {0x002C,  7}, {0x002D,  7}, {0x05C0, 12}, {0x05C1, 12},
-        {0x05C2, 12}, {0x05C3, 12}, {0x05C4, 12}, {0x05C5, 12},
-        {0x05C6, 12}, {0x0003,  3}, {0x0002,  2}, {0x0006,  3},
-        {0x000E,  4}, {0x001E,  5}, {0x001F,  5}, {0x002F,  7},
-        {0x005D,  8}, {0x05C7, 12}, {0x05C8, 12}, {0x05C9, 12},
-        {0x05CA, 12}, {0x05CB, 12}, {0x05CC, 12}, {0x05CD, 12},
-        {0x05CE, 12}, {0x05CF, 12},
-    },{//1
-        {0x0000,  3}, {0x0001,  3}, {0x0002,  3}, {0x0006,  4},
-        {0x0007,  4}, {0x0004,  3}, {0x000A,  4}, {0x000B,  4},
-        {0x0030,  6}, {0x0062,  7}, {0x0063,  7}, {0x0640, 11},
-        {0x0641, 11}, {0x0642, 11}, {0x0643, 11}, {0x0644, 11},
-        {0x0645, 11}, {0x0033,  6}, {0x000D,  4}, {0x001C,  5},
-        {0x001D,  5}, {0x003C,  6}, {0x001F,  5}, {0x0065,  7},
-        {0x007A,  7}, {0x0646, 11}, {0x007B,  7}, {0x0647, 11},
-        {0x0648, 11}, {0x0649, 11}, {0x064A, 11}, {0x064B, 11},
-        {0x0326, 10}, {0x0327, 10},
-    },{//2
-        {0x0000,  7}, {0x0001,  7}, {0x0001,  6}, {0x0004,  7},
-        {0x0003,  6}, {0x0005,  7}, {0x0010,  8}, {0x0011,  8},
-        {0x0240, 13}, {0x0241, 13}, {0x0242, 13}, {0x0243, 13},
-        {0x0244, 13}, {0x0245, 13}, {0x0246, 13}, {0x0247, 13},
-        {0x0124, 12}, {0x0001,  1}, {0x0001,  2}, {0x0001,  3},
-        {0x0003,  5}, {0x0005,  6}, {0x0013,  8}, {0x0125, 12},
-        {0x0126, 12}, {0x0127, 12}, {0x0128, 12}, {0x0129, 12},
-        {0x012A, 12}, {0x012B, 12}, {0x012C, 12}, {0x012D, 12},
-        {0x012E, 12}, {0x012F, 12},
-    },{//3
-        {0x0000,  4}, {0x0001,  3}, {0x0002,  3}, {0x0001,  4},
-        {0x0006,  4}, {0x0004,  3}, {0x0005,  3}, {0x0006,  3},
-        {0x000E,  5}, {0x000F,  5}, {0x0070,  7}, {0x0710, 11},
-        {0x0711, 11}, {0x0712, 11}, {0x0713, 11}, {0x0714, 11},
-        {0x0715, 11}, {0x001D,  5}, {0x0072,  7}, {0x003C,  6},
-        {0x003D,  6}, {0x0073,  7}, {0x007C,  7}, {0x007D,  7},
-        {0x007E,  7}, {0x0716, 11}, {0x0717, 11}, {0x0718, 11},
-        {0x007F,  7}, {0x0719, 11}, {0x071A, 11}, {0x071B, 11},
-        {0x038E, 10}, {0x038F, 10},
-    },{//4
-        {0x0000,  8}, {0x0001,  7}, {0x0002,  7}, {0x0003,  7},
-        {0x0002,  9}, {0x0008,  8}, {0x0003,  9}, {0x0240, 14},
-        {0x0241, 14}, {0x0242, 14}, {0x0243, 14}, {0x0244, 14},
-        {0x0245, 14}, {0x0246, 14}, {0x0247, 14}, {0x0124, 13},
-        {0x0125, 13}, {0x0001,  2}, {0x0001,  1}, {0x0001,  3},
-        {0x0001,  4}, {0x0003,  6}, {0x0005,  7}, {0x0013,  9},
-        {0x0126, 13}, {0x0127, 13}, {0x0128, 13}, {0x0129, 13},
-        {0x012A, 13}, {0x012B, 13}, {0x012C, 13}, {0x012D, 13},
-        {0x012E, 13}, {0x012F, 13},
-    },{//5
-        {0x0000,  7}, {0x0001,  7}, {0x0001,  6}, {0x0002,  6},
-        {0x0003,  6}, {0x0004,  6}, {0x0005,  6}, {0x0006,  6},
-        {0x0007,  6}, {0x0008,  6}, {0x0009,  6}, {0x000A,  6},
-        {0x000B,  6}, {0x000C,  6}, {0x000D,  6}, {0x000E,  6},
-        {0x000F,  6}, {0x0010,  6}, {0x0011,  6}, {0x0012,  6},
-        {0x0013,  6}, {0x0014,  6}, {0x0015,  6}, {0x0016,  6},
-        {0x0017,  6}, {0x0018,  6}, {0x0019,  6}, {0x0001,  1},
-        {0x001A,  6}, {0x001B,  6}, {0x001C,  6}, {0x001D,  6},
-        {0x001E,  6}, {0x001F,  6},
-    },{//6
-        {0x0000,  5}, {0x0001,  4}, {0x0001,  5}, {0x0004,  5},
-        {0x000A,  6}, {0x0006,  5}, {0x000B,  6}, {0x000E,  6},
-        {0x003C,  8}, {0x003D,  8}, {0x07C0, 13}, {0x07C1, 13},
-        {0x07C2, 13}, {0x07C3, 13}, {0x07C4, 13}, {0x07C5, 13},
-        {0x07C6, 13}, {0x0001,  2}, {0x0002,  2}, {0x0006,  3},
-        {0x000E,  4}, {0x001E,  5}, {0x001F,  5}, {0x003F,  8},
-        {0x007D,  9}, {0x07C7, 13}, {0x07C8, 13}, {0x07C9, 13},
-        {0x07CA, 13}, {0x07CB, 13}, {0x07CC, 13}, {0x07CD, 13},
-        {0x07CE, 13}, {0x07CF, 13},
-    },{//7
-        {0x0000,  7}, {0x0001,  7}, {0x0002,  7}, {0x0003,  7},
-        {0x0004,  7}, {0x0005,  7}, {0x0006,  7}, {0x0007,  7},
-        {0x0008,  7}, {0x0009,  7}, {0x000A,  7}, {0x000B,  7},
-        {0x000C,  7}, {0x000D,  7}, {0x000E,  7}, {0x000F,  7},
-        {0x0010,  7}, {0x0001,  1}, {0x0001,  2}, {0x0011,  7},
-        {0x0012,  7}, {0x0013,  7}, {0x0014,  7}, {0x0015,  7},
-        {0x0016,  7}, {0x0017,  7}, {0x0018,  7}, {0x0019,  7},
-        {0x001A,  7}, {0x001B,  7}, {0x001C,  7}, {0x001D,  7},
-        {0x001E,  7}, {0x001F,  7},
-    }
-};
-#define MAX_DC_VLC_BITS 14
-
-
-static const uint16_t x8_ac0_lowquant_table[8][77][2]={
-    {//0
-        {0x0000,  2}, {0x0002,  3}, {0x0006,  4}, {0x000E,  5},
-        {0x001E,  6}, {0x003E,  7}, {0x003F,  7}, {0x0040,  7},
-        {0x0104,  9}, {0x0083,  8}, {0x0084,  8}, {0x0085,  8},
-        {0x020A, 10}, {0x020B, 10}, {0x0218, 10}, {0x0219, 10},
-        {0x0009,  4}, {0x0044,  7}, {0x010D,  9}, {0x021C, 10},
-        {0x0023,  6}, {0x0045,  7}, {0x0050,  7}, {0x000B,  4},
-        {0x000C,  4}, {0x0015,  5}, {0x001A,  5}, {0x001B,  5},
-        {0x0029,  6}, {0x0038,  6}, {0x0039,  6}, {0x003A,  6},
-        {0x0051,  7}, {0x0076,  7}, {0x0077,  7}, {0x0078,  7},
-        {0x0079,  7}, {0x007A,  7}, {0x007B,  7}, {0x00F8,  8},
-        {0x010F,  9}, {0x021D, 10}, {0x3E40, 14}, {0x3E41, 14},
-        {0x3E42, 14}, {0x3E43, 14}, {0x03E5, 10}, {0x3E44, 14},
-        {0x01F3,  9}, {0x3E45, 14}, {0x3E46, 14}, {0x3E47, 14},
-        {0x00FA,  8}, {0x3E48, 14}, {0x3E49, 14}, {0x3E4A, 14},
-        {0x3E4B, 14}, {0x03EC, 10}, {0x3E4C, 14}, {0x007E,  7},
-        {0x00FE,  8}, {0x00FF,  8}, {0x01F7,  9}, {0x3E4D, 14},
-        {0x3E4E, 14}, {0x3E4F, 14}, {0x3ED0, 14}, {0x3ED1, 14},
-        {0x3ED2, 14}, {0x3ED3, 14}, {0x3ED4, 14}, {0x3ED5, 14},
-        {0x1F6B, 13}, {0x1F6C, 13}, {0x1F6D, 13}, {0x1F6E, 13},
-        {0x1F6F, 13},
-    },{//1
-        {0x0000,  3}, {0x0004,  5}, {0x0014,  7}, {0x000B,  6},
-        {0x000C,  6}, {0x002A,  8}, {0x002B,  8}, {0x0034,  8},
-        {0x0D40, 14}, {0x0D41, 14}, {0x001B,  7}, {0x0D42, 14},
-        {0x0D43, 14}, {0x0D44, 14}, {0x0D45, 14}, {0x0D46, 14},
-        {0x000E,  6}, {0x003C,  8}, {0x0D47, 14}, {0x003D,  8},
-        {0x0D48, 14}, {0x0D49, 14}, {0x0D4A, 14}, {0x0001,  2},
-        {0x0004,  3}, {0x0014,  5}, {0x000B,  4}, {0x000C,  4},
-        {0x000D,  4}, {0x002A,  6}, {0x001F,  7}, {0x0056,  7},
-        {0x0057,  7}, {0x0070,  7}, {0x00E2,  8}, {0x0072,  7},
-        {0x003A,  6}, {0x003B,  6}, {0x003C,  6}, {0x003D,  6},
-        {0x00E3,  8}, {0x0D4B, 14}, {0x00E6,  8}, {0x00E7,  8},
-        {0x00F8,  8}, {0x0D4C, 14}, {0x0D4D, 14}, {0x0D4E, 14},
-        {0x00F9,  8}, {0x0D4F, 14}, {0x0D50, 14}, {0x0D51, 14},
-        {0x06A9, 13}, {0x06AA, 13}, {0x06AB, 13}, {0x06AC, 13},
-        {0x06AD, 13}, {0x06AE, 13}, {0x06AF, 13}, {0x003F,  6},
-        {0x06B0, 13}, {0x06B1, 13}, {0x06B2, 13}, {0x06B3, 13},
-        {0x06B4, 13}, {0x007D,  7}, {0x06B5, 13}, {0x06B6, 13},
-        {0x06B7, 13}, {0x06B8, 13}, {0x06B9, 13}, {0x06BA, 13},
-        {0x06BB, 13}, {0x06BC, 13}, {0x06BD, 13}, {0x06BE, 13},
-        {0x06BF, 13},
-    },{//2
-        {0x0000,  2}, {0x0002,  3}, {0x0003,  3}, {0x0008,  4},
-        {0x0012,  5}, {0x0013,  5}, {0x0028,  6}, {0x0029,  6},
-        {0x0054,  7}, {0x0055,  7}, {0x0056,  7}, {0x00AE,  8},
-        {0x00AF,  8}, {0x00B0,  8}, {0x0162,  9}, {0x02C6, 10},
-        {0x000C,  4}, {0x002D,  6}, {0x00B2,  8}, {0x0166,  9},
-        {0x002E,  6}, {0x0167,  9}, {0x00BC,  8}, {0x001A,  5},
-        {0x0036,  6}, {0x0037,  6}, {0x0038,  6}, {0x005F,  7},
-        {0x0072,  7}, {0x0073,  7}, {0x0074,  7}, {0x0075,  7},
-        {0x0076,  7}, {0x0077,  7}, {0x0078,  7}, {0x0079,  7},
-        {0x007A,  7}, {0x007B,  7}, {0x00BD,  8}, {0xB1C0, 16},
-        {0xB1C1, 16}, {0x58E1, 15}, {0x0B1D, 12}, {0x58E2, 15},
-        {0x58E3, 15}, {0x58E4, 15}, {0x00F8,  8}, {0x03E4, 10},
-        {0x01F3,  9}, {0x0B1E, 12}, {0x58E5, 15}, {0x58E6, 15},
-        {0x00FA,  8}, {0x58E7, 15}, {0x58F8, 15}, {0x58F9, 15},
-        {0x58FA, 15}, {0x01F6,  9}, {0x58FB, 15}, {0x007E,  7},
-        {0x00FE,  8}, {0x00FF,  8}, {0x07CA, 11}, {0x0F96, 12},
-        {0x58FC, 15}, {0x58FD, 15}, {0x58FE, 15}, {0x58FF, 15},
-        {0x7CB8, 15}, {0x7CB9, 15}, {0x7CBA, 15}, {0x7CBB, 15},
-        {0x7CBC, 15}, {0x01F7,  9}, {0x7CBD, 15}, {0x7CBE, 15},
-        {0x7CBF, 15},
-    },{//3
-        {0x0000,  2}, {0x0002,  3}, {0x0006,  4}, {0x000E,  5},
-        {0x000F,  5}, {0x0020,  6}, {0x0021,  6}, {0x0044,  7},
-        {0x0045,  7}, {0x008C,  8}, {0x008D,  8}, {0x011C,  9},
-        {0x011D,  9}, {0x011E,  9}, {0x023E, 10}, {0x023F, 10},
-        {0x0005,  3}, {0x0012,  5}, {0x004C,  7}, {0x004D,  7},
-        {0x000C,  4}, {0x004E,  7}, {0x001A,  5}, {0x0036,  6},
-        {0x004F,  7}, {0x006E,  7}, {0x006F,  7}, {0x00E0,  8},
-        {0x00E1,  8}, {0x00E2,  8}, {0x00E3,  8}, {0x00E4,  8},
-        {0x00E5,  8}, {0x01CC,  9}, {0x00E7,  8}, {0x00E8,  8},
-        {0x00E9,  8}, {0x01CD,  9}, {0x0750, 11}, {0x03A9, 10},
-        {0x0751, 11}, {0x7540, 15}, {0x03AB, 10}, {0x7541, 15},
-        {0x7542, 15}, {0x7543, 15}, {0x01D6,  9}, {0x0755, 11},
-        {0x0076,  7}, {0x0EA9, 12}, {0x7544, 15}, {0x7545, 15},
-        {0x001E,  5}, {0x0077,  7}, {0x00F8,  8}, {0x03AE, 10},
-        {0x075E, 11}, {0x007D,  7}, {0x03E4, 10}, {0x00FC,  8},
-        {0x00FD,  8}, {0x03E5, 10}, {0x03E6, 10}, {0x0EBE, 12},
-        {0x7546, 15}, {0x07CE, 11}, {0x7547, 15}, {0x75F8, 15},
-        {0x75F9, 15}, {0x75FA, 15}, {0x75FB, 15}, {0x75FC, 15},
-        {0x75FD, 15}, {0x007F,  7}, {0x3AFF, 14}, {0x0F9E, 12},
-        {0x0F9F, 12},
-    },{//4
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0008,  5},
-        {0x0012,  6}, {0x0013,  6}, {0x0014,  6}, {0x002A,  7},
-        {0x0016,  6}, {0x002B,  7}, {0x005C,  8}, {0x005D,  8},
-        {0x005E,  8}, {0x00BE,  9}, {0x00BF,  9}, {0x0060,  8},
-        {0x0007,  4}, {0x000D,  5}, {0x0019,  6}, {0x0020,  6},
-        {0x0009,  4}, {0x0021,  6}, {0x0011,  5}, {0x0014,  5},
-        {0x002A,  6}, {0x002B,  6}, {0x002C,  6}, {0x002D,  6},
-        {0x002E,  6}, {0x002F,  6}, {0x0030,  6}, {0x0031,  7},
-        {0x0062,  7}, {0x0063,  7}, {0x0064,  7}, {0x0065,  7},
-        {0x0066,  7}, {0x0061,  8}, {0x0670, 11}, {0x0068,  7},
-        {0x0069,  7}, {0x00CF,  8}, {0x019D,  9}, {0x01A8,  9},
-        {0x01A9,  9}, {0x0339, 10}, {0x01AA,  9}, {0x0356, 10},
-        {0x0036,  6}, {0x00D6,  8}, {0x6710, 15}, {0x6711, 15},
-        {0x000E,  4}, {0x006E,  7}, {0x01AE,  9}, {0x6712, 15},
-        {0x6713, 15}, {0x003C,  6}, {0x0357, 10}, {0x006F,  7},
-        {0x00F4,  8}, {0x00F5,  8}, {0x035E, 10}, {0x01EC,  9},
-        {0x6714, 15}, {0x01ED,  9}, {0x035F, 10}, {0x03DC, 10},
-        {0x03DD, 10}, {0x6715, 15}, {0x338B, 14}, {0x338C, 14},
-        {0x338D, 14}, {0x001F,  5}, {0x01EF,  9}, {0x338E, 14},
-        {0x338F, 14},
-    },{//5
-        {0x0000,  2}, {0x0004,  4}, {0x000A,  5}, {0x000B,  5},
-        {0x0018,  6}, {0x0019,  6}, {0x0034,  7}, {0x006A,  8},
-        {0x006B,  8}, {0x006C,  8}, {0x00DA,  9}, {0x036C, 11},
-        {0x006E,  8}, {0x01B7, 10}, {0x036D, 11}, {0x3780, 15},
-        {0x0004,  3}, {0x000E,  5}, {0x001E,  6}, {0x003E,  7},
-        {0x000A,  4}, {0x002C,  6}, {0x0017,  5}, {0x002D,  6},
-        {0x003F,  7}, {0x00C0,  8}, {0x0061,  7}, {0x00C1,  8},
-        {0x0062,  7}, {0x00C6,  8}, {0x0064,  7}, {0x00C7,  8},
-        {0x00CA,  8}, {0x00DF,  9}, {0x0196,  9}, {0x0197,  9},
-        {0x0198,  9}, {0x0199,  9}, {0x0379, 11}, {0x019A,  9},
-        {0x01BD, 10}, {0x066C, 11}, {0x3781, 15}, {0x0337, 10},
-        {0x066D, 11}, {0x0670, 11}, {0x0339, 10}, {0x0671, 11},
-        {0x0034,  6}, {0x00CF,  8}, {0x3782, 15}, {0x3783, 15},
-        {0x000E,  4}, {0x001B,  5}, {0x006A,  7}, {0x006B,  7},
-        {0x019D,  9}, {0x003C,  6}, {0x00F4,  8}, {0x00F5,  8},
-        {0x03D8, 10}, {0x07B2, 11}, {0x3784, 15}, {0x03DA, 10},
-        {0x3785, 15}, {0x03DB, 10}, {0x03DC, 10}, {0x3786, 15},
-        {0x3787, 15}, {0x1BC4, 14}, {0x1BC5, 14}, {0x1BC6, 14},
-        {0x1BC7, 14}, {0x001F,  5}, {0x03DD, 10}, {0x07B3, 11},
-        {0x01EF,  9},
-    },{//6
-        {0x0000,  2}, {0x0004,  4}, {0x000A,  5}, {0x0016,  6},
-        {0x0017,  6}, {0x0060,  8}, {0x00C2,  9}, {0x0186, 10},
-        {0x0187, 10}, {0x00C4,  9}, {0x3140, 15}, {0x3141, 15},
-        {0x018B, 10}, {0x3142, 15}, {0x018C, 10}, {0x3143, 15},
-        {0x0007,  4}, {0x000D,  5}, {0x0064,  8}, {0x0065,  8},
-        {0x0010,  5}, {0x00C7,  9}, {0x0066,  8}, {0x0005,  3},
-        {0x0006,  3}, {0x0009,  4}, {0x0011,  5}, {0x0038,  6},
-        {0x0039,  6}, {0x0074,  7}, {0x0075,  7}, {0x0076,  7},
-        {0x0067,  8}, {0x00EE,  8}, {0x01DE,  9}, {0x00F0,  8},
-        {0x018D, 10}, {0x3144, 15}, {0x01DF,  9}, {0x003D,  6},
-        {0x003E,  6}, {0x01E2,  9}, {0x03C6, 10}, {0x00F2,  8},
-        {0x00F3,  8}, {0x03C7, 10}, {0x3145, 15}, {0x3146, 15},
-        {0x01F8,  9}, {0x3147, 15}, {0x3148, 15}, {0x3149, 15},
-        {0x00FD,  8}, {0x314A, 15}, {0x314B, 15}, {0x314C, 15},
-        {0x314D, 15}, {0x01F9,  9}, {0x314E, 15}, {0x01FC,  9},
-        {0x314F, 15}, {0x3150, 15}, {0x3151, 15}, {0x3152, 15},
-        {0x3153, 15}, {0x03FA, 10}, {0x03FB, 10}, {0x3154, 15},
-        {0x3155, 15}, {0x3156, 15}, {0x3157, 15}, {0x3158, 15},
-        {0x3159, 15}, {0x00FF,  8}, {0x18AD, 14}, {0x18AE, 14},
-        {0x18AF, 14},
-    },{//7
-        {0x0000,  4}, {0x0080, 11}, {0x0081, 11}, {0x0082, 11},
-        {0x0083, 11}, {0x0084, 11}, {0x0085, 11}, {0x0086, 11},
-        {0x0087, 11}, {0x0088, 11}, {0x0089, 11}, {0x008A, 11},
-        {0x008B, 11}, {0x008C, 11}, {0x008D, 11}, {0x008E, 11},
-        {0x008F, 11}, {0x0048, 10}, {0x0049, 10}, {0x004A, 10},
-        {0x004B, 10}, {0x004C, 10}, {0x004D, 10}, {0x0001,  1},
-        {0x0001,  2}, {0x004E, 10}, {0x0002,  4}, {0x0003,  4},
-        {0x004F, 10}, {0x0050, 10}, {0x0051, 10}, {0x0052, 10},
-        {0x0053, 10}, {0x0054, 10}, {0x0055, 10}, {0x0056, 10},
-        {0x0057, 10}, {0x0058, 10}, {0x0059, 10}, {0x005A, 10},
-        {0x005B, 10}, {0x005C, 10}, {0x005D, 10}, {0x005E, 10},
-        {0x005F, 10}, {0x0060, 10}, {0x0061, 10}, {0x0062, 10},
-        {0x0063, 10}, {0x0064, 10}, {0x0065, 10}, {0x0066, 10},
-        {0x0067, 10}, {0x0068, 10}, {0x0069, 10}, {0x006A, 10},
-        {0x006B, 10}, {0x006C, 10}, {0x006D, 10}, {0x006E, 10},
-        {0x006F, 10}, {0x0070, 10}, {0x0071, 10}, {0x0072, 10},
-        {0x0073, 10}, {0x0074, 10}, {0x0075, 10}, {0x0076, 10},
-        {0x0077, 10}, {0x0078, 10}, {0x0079, 10}, {0x007A, 10},
-        {0x007B, 10}, {0x007C, 10}, {0x007D, 10}, {0x007E, 10},
-        {0x007F, 10},
-    }
-};
-
-static const uint16_t x8_ac0_highquant_table[8][77][2]={
-    {//0
-        {0x0000,  3}, {0x0002,  4}, {0x000C,  6}, {0x000D,  6},
-        {0x001C,  7}, {0x000F,  6}, {0x1D00, 15}, {0x003B,  8},
-        {0x1D01, 15}, {0x0075,  9}, {0x1D02, 15}, {0x0080,  9},
-        {0x1D03, 15}, {0x1D04, 15}, {0x1D05, 15}, {0x0E83, 14},
-        {0x0009,  5}, {0x0011,  6}, {0x0081,  9}, {0x0082,  9},
-        {0x0021,  7}, {0x0028,  7}, {0x0083,  9}, {0x0002,  2},
-        {0x0003,  3}, {0x000C,  4}, {0x000D,  4}, {0x000B,  5},
-        {0x0015,  6}, {0x0052,  8}, {0x0070,  7}, {0x0039,  6},
-        {0x0071,  7}, {0x0053,  8}, {0x0E84, 14}, {0x0074,  7},
-        {0x0075,  7}, {0x0076,  7}, {0x01DC,  9}, {0x001E,  5},
-        {0x003E,  6}, {0x01DD,  9}, {0x00EF,  8}, {0x01F8,  9},
-        {0x01F9,  9}, {0x0E85, 14}, {0x0E86, 14}, {0x0E87, 14},
-        {0x00FD,  8}, {0x0E88, 14}, {0x0E89, 14}, {0x0E8A, 14},
-        {0x0E8B, 14}, {0x0E8C, 14}, {0x0E8D, 14}, {0x0E8E, 14},
-        {0x0E8F, 14}, {0x0E90, 14}, {0x0E91, 14}, {0x01FC,  9},
-        {0x0E92, 14}, {0x0E93, 14}, {0x0E94, 14}, {0x0E95, 14},
-        {0x0E96, 14}, {0x0E97, 14}, {0x01FD,  9}, {0x0E98, 14},
-        {0x01FE,  9}, {0x0E99, 14}, {0x0E9A, 14}, {0x0E9B, 14},
-        {0x0E9C, 14}, {0x01FF,  9}, {0x0E9D, 14}, {0x0E9E, 14},
-        {0x0E9F, 14},
-    },{//1
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0008,  5},
-        {0x0012,  6}, {0x0013,  6}, {0x0014,  6}, {0x0015,  6},
-        {0x002C,  7}, {0x005A,  8}, {0x005B,  8}, {0x005C,  8},
-        {0x005D,  8}, {0x1780, 14}, {0x0179, 10}, {0x017A, 10},
-        {0x0006,  4}, {0x000E,  5}, {0x001E,  6}, {0x003E,  7},
-        {0x0010,  5}, {0x0022,  6}, {0x0012,  5}, {0x000A,  4},
-        {0x0013,  5}, {0x0016,  5}, {0x0023,  6}, {0x002E,  6},
-        {0x002F,  6}, {0x0030,  6}, {0x0031,  6}, {0x003F,  7},
-        {0x005F,  8}, {0x00C8,  8}, {0x0065,  7}, {0x0066,  7},
-        {0x0067,  7}, {0x0068,  7}, {0x00C9,  8}, {0x0069,  7},
-        {0x006A,  7}, {0x00D6,  8}, {0x00D7,  8}, {0x00D8,  8},
-        {0x1781, 14}, {0x017B, 10}, {0x01B2,  9}, {0x1782, 14},
-        {0x001C,  5}, {0x01B3,  9}, {0x1783, 14}, {0x1784, 14},
-        {0x001D,  5}, {0x00DA,  8}, {0x1785, 14}, {0x1786, 14},
-        {0x1787, 14}, {0x0037,  6}, {0x00DB,  8}, {0x0078,  7},
-        {0x00F2,  8}, {0x01E6,  9}, {0x00F4,  8}, {0x1788, 14},
-        {0x1789, 14}, {0x00F5,  8}, {0x01E7,  9}, {0x178A, 14},
-        {0x178B, 14}, {0x178C, 14}, {0x178D, 14}, {0x01EC,  9},
-        {0x178E, 14}, {0x001F,  5}, {0x00F7,  8}, {0x01ED,  9},
-        {0x178F, 14},
-    },{//2
-        {0x0000,  4}, {0x0002,  5}, {0x0180, 12}, {0x0181, 12},
-        {0x0182, 12}, {0x0183, 12}, {0x0184, 12}, {0x0185, 12},
-        {0x0186, 12}, {0x0187, 12}, {0x0188, 12}, {0x0189, 12},
-        {0x00C5, 11}, {0x00C6, 11}, {0x00C7, 11}, {0x00C8, 11},
-        {0x00C9, 11}, {0x00CA, 11}, {0x00CB, 11}, {0x00CC, 11},
-        {0x00CD, 11}, {0x00CE, 11}, {0x00CF, 11}, {0x0001,  1},
-        {0x0001,  2}, {0x0004,  5}, {0x0005,  5}, {0x0006,  5},
-        {0x00D0, 11}, {0x00D1, 11}, {0x00D2, 11}, {0x00D3, 11},
-        {0x00D4, 11}, {0x00D5, 11}, {0x00D6, 11}, {0x00D7, 11},
-        {0x00D8, 11}, {0x00D9, 11}, {0x00DA, 11}, {0x0007,  5},
-        {0x00DB, 11}, {0x00DC, 11}, {0x00DD, 11}, {0x00DE, 11},
-        {0x00DF, 11}, {0x00E0, 11}, {0x00E1, 11}, {0x00E2, 11},
-        {0x00E3, 11}, {0x00E4, 11}, {0x00E5, 11}, {0x00E6, 11},
-        {0x00E7, 11}, {0x00E8, 11}, {0x00E9, 11}, {0x00EA, 11},
-        {0x00EB, 11}, {0x00EC, 11}, {0x00ED, 11}, {0x00EE, 11},
-        {0x00EF, 11}, {0x00F0, 11}, {0x00F1, 11}, {0x00F2, 11},
-        {0x00F3, 11}, {0x00F4, 11}, {0x00F5, 11}, {0x00F6, 11},
-        {0x00F7, 11}, {0x00F8, 11}, {0x00F9, 11}, {0x00FA, 11},
-        {0x00FB, 11}, {0x00FC, 11}, {0x00FD, 11}, {0x00FE, 11},
-        {0x00FF, 11},
-    },{//3
-        {0x0000,  8}, {0x0001,  8}, {0x0002,  8}, {0x0003,  8},
-        {0x0004,  8}, {0x0005,  8}, {0x0006,  8}, {0x0007,  8},
-        {0x0008,  8}, {0x0009,  8}, {0x000A,  8}, {0x000B,  8},
-        {0x000C,  8}, {0x000D,  8}, {0x000E,  8}, {0x000F,  8},
-        {0x0010,  8}, {0x0011,  8}, {0x0012,  8}, {0x0013,  8},
-        {0x0014,  8}, {0x0015,  8}, {0x0016,  8}, {0x0001,  1},
-        {0x0017,  8}, {0x000C,  7}, {0x000D,  7}, {0x000E,  7},
-        {0x000F,  7}, {0x0010,  7}, {0x0011,  7}, {0x0012,  7},
-        {0x0013,  7}, {0x0014,  7}, {0x0015,  7}, {0x0016,  7},
-        {0x0017,  7}, {0x0018,  7}, {0x0019,  7}, {0x001A,  7},
-        {0x001B,  7}, {0x001C,  7}, {0x001D,  7}, {0x001E,  7},
-        {0x001F,  7}, {0x0020,  7}, {0x0021,  7}, {0x0022,  7},
-        {0x0023,  7}, {0x0024,  7}, {0x0025,  7}, {0x0026,  7},
-        {0x0027,  7}, {0x0028,  7}, {0x0029,  7}, {0x002A,  7},
-        {0x002B,  7}, {0x002C,  7}, {0x002D,  7}, {0x002E,  7},
-        {0x002F,  7}, {0x0030,  7}, {0x0031,  7}, {0x0032,  7},
-        {0x0033,  7}, {0x0034,  7}, {0x0035,  7}, {0x0036,  7},
-        {0x0037,  7}, {0x0038,  7}, {0x0039,  7}, {0x003A,  7},
-        {0x003B,  7}, {0x003C,  7}, {0x003D,  7}, {0x003E,  7},
-        {0x003F,  7},
-    },{//4
-        {0x0000,  9}, {0x0001,  9}, {0x0002,  9}, {0x0003,  9},
-        {0x0004,  9}, {0x0005,  9}, {0x0006,  9}, {0x0007,  9},
-        {0x0008,  9}, {0x0009,  9}, {0x000A,  9}, {0x000B,  9},
-        {0x000C,  9}, {0x000D,  9}, {0x000E,  9}, {0x000F,  9},
-        {0x0010,  9}, {0x0011,  9}, {0x0012,  9}, {0x0013,  9},
-        {0x0014,  9}, {0x0015,  9}, {0x000B,  8}, {0x0001,  2},
-        {0x0001,  1}, {0x000C,  8}, {0x000D,  8}, {0x000E,  8},
-        {0x000F,  8}, {0x0010,  8}, {0x0011,  8}, {0x0012,  8},
-        {0x0013,  8}, {0x0014,  8}, {0x0015,  8}, {0x0016,  8},
-        {0x0017,  8}, {0x0018,  8}, {0x0019,  8}, {0x001A,  8},
-        {0x001B,  8}, {0x001C,  8}, {0x001D,  8}, {0x001E,  8},
-        {0x001F,  8}, {0x0020,  8}, {0x0021,  8}, {0x0022,  8},
-        {0x0023,  8}, {0x0024,  8}, {0x0025,  8}, {0x0026,  8},
-        {0x0027,  8}, {0x0028,  8}, {0x0029,  8}, {0x002A,  8},
-        {0x002B,  8}, {0x002C,  8}, {0x002D,  8}, {0x002E,  8},
-        {0x002F,  8}, {0x0030,  8}, {0x0031,  8}, {0x0032,  8},
-        {0x0033,  8}, {0x0034,  8}, {0x0035,  8}, {0x0036,  8},
-        {0x0037,  8}, {0x0038,  8}, {0x0039,  8}, {0x003A,  8},
-        {0x003B,  8}, {0x003C,  8}, {0x003D,  8}, {0x003E,  8},
-        {0x003F,  8},
-    },{//5
-        {0x0000, 10}, {0x0001, 10}, {0x0002, 10}, {0x0003, 10},
-        {0x0004, 10}, {0x0005, 10}, {0x0006, 10}, {0x0007, 10},
-        {0x0008, 10}, {0x0009, 10}, {0x000A, 10}, {0x000B, 10},
-        {0x000C, 10}, {0x000D, 10}, {0x000E, 10}, {0x000F, 10},
-        {0x0010, 10}, {0x0011, 10}, {0x0012, 10}, {0x0013, 10},
-        {0x000A,  9}, {0x000B,  9}, {0x000C,  9}, {0x0001,  1},
-        {0x0001,  3}, {0x000D,  9}, {0x000E,  9}, {0x0001,  2},
-        {0x000F,  9}, {0x0010,  9}, {0x0011,  9}, {0x0012,  9},
-        {0x0013,  9}, {0x0014,  9}, {0x0015,  9}, {0x0016,  9},
-        {0x0017,  9}, {0x0018,  9}, {0x0019,  9}, {0x001A,  9},
-        {0x001B,  9}, {0x001C,  9}, {0x001D,  9}, {0x001E,  9},
-        {0x001F,  9}, {0x0020,  9}, {0x0021,  9}, {0x0022,  9},
-        {0x0023,  9}, {0x0024,  9}, {0x0025,  9}, {0x0026,  9},
-        {0x0027,  9}, {0x0028,  9}, {0x0029,  9}, {0x002A,  9},
-        {0x002B,  9}, {0x002C,  9}, {0x002D,  9}, {0x002E,  9},
-        {0x002F,  9}, {0x0030,  9}, {0x0031,  9}, {0x0032,  9},
-        {0x0033,  9}, {0x0034,  9}, {0x0035,  9}, {0x0036,  9},
-        {0x0037,  9}, {0x0038,  9}, {0x0039,  9}, {0x003A,  9},
-        {0x003B,  9}, {0x003C,  9}, {0x003D,  9}, {0x003E,  9},
-        {0x003F,  9},
-    },{//6
-        {0x0000,  2}, {0x0004,  4}, {0x000A,  5}, {0x000B,  5},
-        {0x0018,  6}, {0x0019,  6}, {0x0034,  7}, {0x006A,  8},
-        {0x006B,  8}, {0x006C,  8}, {0x00DA,  9}, {0x00DB,  9},
-        {0x01B8, 10}, {0x00DD,  9}, {0x01B9, 10}, {0x3780, 15},
-        {0x0004,  3}, {0x000E,  5}, {0x001E,  6}, {0x001F,  6},
-        {0x000A,  4}, {0x0058,  7}, {0x0017,  5}, {0x0018,  5},
-        {0x0059,  7}, {0x005A,  7}, {0x005B,  7}, {0x00C8,  8},
-        {0x0065,  7}, {0x0066,  7}, {0x00C9,  8}, {0x00CE,  8},
-        {0x00CF,  8}, {0x00D0,  8}, {0x00D1,  8}, {0x00D2,  8},
-        {0x00D3,  8}, {0x00DF,  9}, {0x00D4,  8}, {0x00D5,  8},
-        {0x00D6,  8}, {0x01AE,  9}, {0x3781, 15}, {0x01BD, 10},
-        {0x035E, 10}, {0x035F, 10}, {0x3782, 15}, {0x0360, 10},
-        {0x0037,  6}, {0x01B1,  9}, {0x3783, 15}, {0x3784, 15},
-        {0x000E,  4}, {0x003C,  6}, {0x0361, 10}, {0x3785, 15},
-        {0x1BC3, 14}, {0x003D,  6}, {0x00D9,  8}, {0x1BC4, 14},
-        {0x0368, 10}, {0x1BC5, 14}, {0x1BC6, 14}, {0x1BC7, 14},
-        {0x1BC8, 14}, {0x00DB,  8}, {0x0369, 10}, {0x036A, 10},
-        {0x1BC9, 14}, {0x1BCA, 14}, {0x1BCB, 14}, {0x1BCC, 14},
-        {0x1BCD, 14}, {0x001F,  5}, {0x036B, 10}, {0x1BCE, 14},
-        {0x1BCF, 14},
-    },{//7
-        {0x0000,  3}, {0x0002,  4}, {0x0006,  5}, {0x0007,  5},
-        {0x0010,  6}, {0x0044,  8}, {0x0023,  7}, {0x0012,  6},
-        {0x0026,  7}, {0x08A0, 13}, {0x004E,  8}, {0x004F,  8},
-        {0x08A1, 13}, {0x08A2, 13}, {0x08A3, 13}, {0x0050,  8},
-        {0x0006,  4}, {0x000B,  5}, {0x0029,  7}, {0x0015,  6},
-        {0x001C,  6}, {0x003A,  7}, {0x001E,  6}, {0x0004,  3},
-        {0x0014,  5}, {0x0015,  5}, {0x000B,  4}, {0x001F,  6},
-        {0x0030,  6}, {0x0031,  6}, {0x0019,  5}, {0x0051,  8},
-        {0x0034,  6}, {0x0035,  6}, {0x0036,  6}, {0x0037,  6},
-        {0x0076,  8}, {0x0077,  8}, {0x0070,  7}, {0x001D,  5},
-        {0x0071,  7}, {0x0072,  7}, {0x08A4, 13}, {0x0073,  7},
-        {0x00F0,  8}, {0x08A5, 13}, {0x08A6, 13}, {0x08A7, 13},
-        {0x0079,  7}, {0x007A,  7}, {0x08A8, 13}, {0x08A9, 13},
-        {0x00F1,  8}, {0x08AA, 13}, {0x08AB, 13}, {0x08AC, 13},
-        {0x08AD, 13}, {0x00F6,  8}, {0x08AE, 13}, {0x007C,  7},
-        {0x00F7,  8}, {0x08AF, 13}, {0x08B0, 13}, {0x08B1, 13},
-        {0x08B2, 13}, {0x00FA,  8}, {0x08B3, 13}, {0x08B4, 13},
-        {0x08B5, 13}, {0x08B6, 13}, {0x08B7, 13}, {0x00FB,  8},
-        {0x045C, 12}, {0x003F,  6}, {0x045D, 12}, {0x045E, 12},
-        {0x045F, 12},
-    }
-};
-
-static const uint16_t x8_ac1_lowquant_table[8][77][2]={
-    {//0
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0008,  5},
-        {0x0012,  6}, {0x0026,  7}, {0x0014,  6}, {0x004E,  8},
-        {0x004F,  8}, {0x00A8,  9}, {0x0152, 10}, {0x00AA,  9},
-        {0x00AB,  9}, {0x00AC,  9}, {0x2A60, 15}, {0x02A7, 11},
-        {0x0006,  4}, {0x000B,  5}, {0x001C,  6}, {0x003A,  7},
-        {0x000F,  5}, {0x003B,  7}, {0x0010,  5}, {0x0005,  3},
-        {0x0009,  4}, {0x0011,  5}, {0x0018,  5}, {0x0019,  5},
-        {0x001A,  5}, {0x0036,  6}, {0x0037,  6}, {0x0070,  7},
-        {0x0057,  8}, {0x00E2,  8}, {0x00E3,  8}, {0x00E4,  8},
-        {0x00E5,  8}, {0x00AD,  9}, {0x0398, 10}, {0x003A,  6},
-        {0x0076,  7}, {0x00E7,  8}, {0x00EE,  8}, {0x00EF,  8},
-        {0x0732, 11}, {0x039A, 10}, {0x0733, 11}, {0x2A61, 15},
-        {0x0078,  7}, {0x1531, 14}, {0x1532, 14}, {0x1533, 14},
-        {0x003D,  6}, {0x039B, 10}, {0x1534, 14}, {0x1535, 14},
-        {0x1536, 14}, {0x0079,  7}, {0x1537, 14}, {0x00F8,  8},
-        {0x01F2,  9}, {0x07CC, 11}, {0x03E7, 10}, {0x07CD, 11},
-        {0x3E80, 14}, {0x00FB,  8}, {0x03E9, 10}, {0x3E81, 14},
-        {0x3E82, 14}, {0x3E83, 14}, {0x3E84, 14}, {0x3E85, 14},
-        {0x3E86, 14}, {0x003F,  6}, {0x01F5,  9}, {0x07D1, 11},
-        {0x3E87, 14},
-    },{//1
-        {0x0000,  2}, {0x0002,  3}, {0x0006,  4}, {0x000E,  5},
-        {0x001E,  6}, {0x001F,  6}, {0x0040,  7}, {0x0082,  8},
-        {0x0083,  8}, {0x0084,  8}, {0x010A,  9}, {0x010B,  9},
-        {0x0430, 11}, {0x0431, 11}, {0x0432, 11}, {0x0433, 11},
-        {0x0005,  3}, {0x0011,  5}, {0x0024,  6}, {0x004A,  7},
-        {0x000C,  4}, {0x0026,  6}, {0x000D,  4}, {0x0087,  8},
-        {0x010D,  9}, {0x0258, 10}, {0x012D,  9}, {0x0259, 10},
-        {0x025C, 10}, {0x0974, 12}, {0x025E, 10}, {0x025F, 10},
-        {0x0270, 10}, {0x0271, 10}, {0x04BB, 11}, {0x0975, 12},
-        {0x0272, 10}, {0x09CC, 12}, {0x09CD, 12}, {0x4E70, 15},
-        {0x4E71, 15}, {0x4E72, 15}, {0x4E73, 15}, {0x273A, 14},
-        {0x273B, 14}, {0x273C, 14}, {0x04E8, 11}, {0x04E9, 11},
-        {0x009E,  8}, {0x0275, 10}, {0x09D8, 12}, {0x273D, 14},
-        {0x000E,  4}, {0x003C,  6}, {0x007A,  7}, {0x009F,  8},
-        {0x0277, 10}, {0x003E,  6}, {0x00F6,  8}, {0x04ED, 11},
-        {0x03DC, 10}, {0x273E, 14}, {0x07BA, 11}, {0x09D9, 12},
-        {0x273F, 14}, {0x3DD8, 14}, {0x3DD9, 14}, {0x3DDA, 14},
-        {0x3DDB, 14}, {0x3DDC, 14}, {0x3DDD, 14}, {0x3DDE, 14},
-        {0x3DDF, 14}, {0x003F,  6}, {0x07BC, 11}, {0x07BD, 11},
-        {0x03DF, 10},
-    },{//2
-        {0x0000,  3}, {0x0002,  4}, {0x0006,  5}, {0x000E,  6},
-        {0x001E,  7}, {0x003E,  8}, {0x003F,  8}, {0x0040,  8},
-        {0x0104, 10}, {0x0083,  9}, {0x0105, 10}, {0x0108, 10},
-        {0x4240, 16}, {0x010A, 10}, {0x010B, 10}, {0x4241, 16},
-        {0x0003,  3}, {0x0009,  5}, {0x0011,  6}, {0x0043,  8},
-        {0x0004,  3}, {0x000A,  5}, {0x000A,  4}, {0x002C,  7},
-        {0x00B4,  9}, {0x00B5,  9}, {0x00B6,  9}, {0x00B7,  9},
-        {0x00B8,  9}, {0x0172, 10}, {0x0173, 10}, {0x0174, 10},
-        {0x0175, 10}, {0x0176, 10}, {0x0177, 10}, {0x00BC,  9},
-        {0x017A, 10}, {0x0213, 11}, {0x4242, 16}, {0x017B, 10},
-        {0x02F8, 11}, {0x017D, 10}, {0x02F9, 11}, {0x017E, 10},
-        {0x4243, 16}, {0x02FE, 11}, {0x2122, 15}, {0x2123, 15},
-        {0x0058,  7}, {0x0164,  9}, {0x2124, 15}, {0x2125, 15},
-        {0x0006,  3}, {0x000E,  4}, {0x002D,  6}, {0x002E,  6},
-        {0x00B3,  8}, {0x001E,  5}, {0x005E,  7}, {0x2126, 15},
-        {0x2127, 15}, {0x2128, 15}, {0x2129, 15}, {0x02FF, 11},
-        {0x212A, 15}, {0x0594, 11}, {0x0595, 11}, {0x0596, 11},
-        {0x212B, 15}, {0x212C, 15}, {0x212D, 15}, {0x212E, 15},
-        {0x212F, 15}, {0x001F,  5}, {0x0597, 11}, {0x00BE,  8},
-        {0x00BF,  8},
-    },{//3
-        {0x0000,  2}, {0x0002,  3}, {0x0006,  4}, {0x0007,  4},
-        {0x0010,  5}, {0x0011,  5}, {0x0024,  6}, {0x0025,  6},
-        {0x0026,  6}, {0x0027,  6}, {0x0050,  7}, {0x0051,  7},
-        {0x00A4,  8}, {0x00A5,  8}, {0x00A6,  8}, {0x014E,  9},
-        {0x000B,  4}, {0x002A,  6}, {0x0056,  7}, {0x014F,  9},
-        {0x0030,  6}, {0x00AE,  8}, {0x0062,  7}, {0x0032,  6},
-        {0x0033,  6}, {0x0034,  6}, {0x0035,  6}, {0x0036,  6},
-        {0x0063,  7}, {0x006E,  7}, {0x006F,  7}, {0x0070,  7},
-        {0x0071,  7}, {0x0072,  7}, {0x0073,  7}, {0x0074,  7},
-        {0x00AF,  8}, {0x00EA,  8}, {0x01D6,  9}, {0x075C, 11},
-        {0x03AF, 10}, {0x75D0, 15}, {0x75D1, 15}, {0x75D2, 15},
-        {0x75D3, 15}, {0x75D4, 15}, {0x0076,  7}, {0x00EE,  8},
-        {0x00EF,  8}, {0x0EBB, 12}, {0x01E0,  9}, {0x75D5, 15},
-        {0x0079,  7}, {0x01E1,  9}, {0x75D6, 15}, {0x75D7, 15},
-        {0x7880, 15}, {0x00F4,  8}, {0x0789, 11}, {0x003E,  6},
-        {0x007B,  7}, {0x00F5,  8}, {0x00FC,  8}, {0x007F,  7},
-        {0x01E3,  9}, {0x078A, 11}, {0x078B, 11}, {0x7881, 15},
-        {0x7882, 15}, {0x7883, 15}, {0x3C42, 14}, {0x3C43, 14},
-        {0x3C44, 14}, {0x00FD,  8}, {0x3C45, 14}, {0x3C46, 14},
-        {0x3C47, 14},
-    },{//4
-        {0x0000,  2}, {0x0004,  4}, {0x000A,  5}, {0x0016,  6},
-        {0x0017,  6}, {0x0030,  7}, {0x0031,  7}, {0x0064,  8},
-        {0x0065,  8}, {0x0066,  8}, {0x00CE,  9}, {0x00CF,  9},
-        {0x01A0, 10}, {0x01A1, 10}, {0x1A20, 14}, {0x0689, 12},
-        {0x0004,  3}, {0x000E,  5}, {0x001B,  6}, {0x0035,  7},
-        {0x000A,  4}, {0x001E,  6}, {0x0016,  5}, {0x0017,  5},
-        {0x001F,  6}, {0x0030,  6}, {0x0031,  6}, {0x0064,  7},
-        {0x0065,  7}, {0x0069,  8}, {0x0066,  7}, {0x00CE,  8},
-        {0x00CF,  8}, {0x00D0,  8}, {0x00D1,  8}, {0x00D2,  8},
-        {0x01A6,  9}, {0x01A3, 10}, {0x034E, 10}, {0x006A,  7},
-        {0x00D6,  8}, {0x01AE,  9}, {0x01AF,  9}, {0x034F, 10},
-        {0x0345, 11}, {0x01B0,  9}, {0x01B1,  9}, {0x0364, 10},
-        {0x006D,  7}, {0x00DC,  8}, {0x0D94, 12}, {0x0D95, 12},
-        {0x000E,  4}, {0x003C,  6}, {0x00DD,  8}, {0x00DE,  8},
-        {0x01B3,  9}, {0x003D,  6}, {0x00DF,  8}, {0x01F0,  9},
-        {0x03E2, 10}, {0x03E3, 10}, {0x06CB, 11}, {0x03E4, 10},
-        {0x07CA, 11}, {0x01F3,  9}, {0x01F4,  9}, {0x07CB, 11},
-        {0x07D4, 11}, {0x1A21, 14}, {0x1A22, 14}, {0x07D5, 11},
-        {0x1A23, 14}, {0x003F,  6}, {0x01F6,  9}, {0x01F7,  9},
-        {0x03EB, 10},
-    },{//5
-        {0x0000,  2}, {0x0002,  3}, {0x0006,  4}, {0x000E,  5},
-        {0x000F,  5}, {0x0020,  6}, {0x0021,  6}, {0x0044,  7},
-        {0x0045,  7}, {0x0046,  7}, {0x008E,  8}, {0x008F,  8},
-        {0x0090,  8}, {0x0122,  9}, {0x0246, 10}, {0x0124,  9},
-        {0x0005,  3}, {0x0013,  5}, {0x004A,  7}, {0x0093,  8},
-        {0x0018,  5}, {0x004B,  7}, {0x0032,  6}, {0x001A,  5},
-        {0x0033,  6}, {0x006C,  7}, {0x006D,  7}, {0x006E,  7},
-        {0x00DE,  8}, {0x00DF,  8}, {0x0070,  7}, {0x00E2,  8},
-        {0x00E3,  8}, {0x00E4,  8}, {0x00E5,  8}, {0x00E6,  8},
-        {0x00E7,  8}, {0x0125,  9}, {0x01D0,  9}, {0x048E, 11},
-        {0x091E, 12}, {0x091F, 12}, {0x7440, 15}, {0x1D11, 13},
-        {0x7441, 15}, {0x7442, 15}, {0x00E9,  8}, {0x01D4,  9},
-        {0x00EB,  8}, {0x03A3, 10}, {0x01D5,  9}, {0x1D12, 13},
-        {0x001E,  5}, {0x0076,  7}, {0x01DC,  9}, {0x01DD,  9},
-        {0x7443, 15}, {0x007C,  7}, {0x0745, 11}, {0x00EF,  8},
-        {0x00FA,  8}, {0x00FB,  8}, {0x01F8,  9}, {0x00FD,  8},
-        {0x07E4, 11}, {0x0FCA, 12}, {0x1D13, 13}, {0x7E58, 15},
-        {0x7E59, 15}, {0x7E5A, 15}, {0x7E5B, 15}, {0x7E5C, 15},
-        {0x7E5D, 15}, {0x007F,  7}, {0x3F2F, 14}, {0x07E6, 11},
-        {0x07E7, 11},
-    },{//6
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0008,  5},
-        {0x0009,  5}, {0x0014,  6}, {0x0015,  6}, {0x002C,  7},
-        {0x005A,  8}, {0x005B,  8}, {0x005C,  8}, {0x00BA,  9},
-        {0x00BB,  9}, {0x00BC,  9}, {0x02F4, 11}, {0x05EA, 12},
-        {0x0003,  3}, {0x0010,  5}, {0x0022,  6}, {0x0046,  7},
-        {0x0009,  4}, {0x0028,  6}, {0x0015,  5}, {0x000B,  4},
-        {0x0018,  5}, {0x0029,  6}, {0x0032,  6}, {0x0047,  7},
-        {0x0066,  7}, {0x0067,  7}, {0x0068,  7}, {0x0069,  7},
-        {0x006A,  7}, {0x005F,  8}, {0x00D6,  8}, {0x00D7,  8},
-        {0x01B0,  9}, {0x00D9,  8}, {0x017B, 10}, {0x006D,  7},
-        {0x00DC,  8}, {0x01B1,  9}, {0x06E8, 11}, {0x01BB,  9},
-        {0x0375, 10}, {0x05EB, 12}, {0x01BC,  9}, {0x6E90, 15},
-        {0x0038,  6}, {0x0072,  7}, {0x6E91, 15}, {0x6E92, 15},
-        {0x001D,  5}, {0x0073,  7}, {0x01BD,  9}, {0x06F8, 11},
-        {0x6E93, 15}, {0x003C,  6}, {0x01BF,  9}, {0x00F4,  8},
-        {0x01EA,  9}, {0x037D, 10}, {0x03D6, 10}, {0x06F9, 11},
-        {0x6E94, 15}, {0x00F6,  8}, {0x01EE,  9}, {0x6E95, 15},
-        {0x6E96, 15}, {0x6E97, 15}, {0x374C, 14}, {0x374D, 14},
-        {0x374E, 14}, {0x001F,  5}, {0x03D7, 10}, {0x01EF,  9},
-        {0x374F, 14},
-    },{//7
-        {0x0000,  2}, {0x0004,  4}, {0x000A,  5}, {0x0016,  6},
-        {0x002E,  7}, {0x002F,  7}, {0x0060,  8}, {0x0061,  8},
-        {0x00C4,  9}, {0x00C5,  9}, {0x00C6,  9}, {0x018E, 10},
-        {0x31E0, 15}, {0x31E1, 15}, {0x31E2, 15}, {0x31E3, 15},
-        {0x0004,  3}, {0x000D,  5}, {0x0019,  6}, {0x0038,  7},
-        {0x000A,  4}, {0x001D,  6}, {0x000B,  4}, {0x0072,  8},
-        {0x0073,  8}, {0x00F0,  9}, {0x01E2, 10}, {0x00F2,  9},
-        {0x01E3, 10}, {0x00F3,  9}, {0x01E8, 10}, {0x01E9, 10},
-        {0x31E4, 15}, {0x01EA, 10}, {0x031F, 11}, {0x03D6, 11},
-        {0x31E5, 15}, {0x01EC, 10}, {0x31E6, 15}, {0x00F7,  9},
-        {0x03D7, 11}, {0x31E7, 15}, {0x31E8, 15}, {0x03DA, 11},
-        {0x03DB, 11}, {0x31E9, 15}, {0x03E0, 11}, {0x31EA, 15},
-        {0x003F,  7}, {0x01F1, 10}, {0x31EB, 15}, {0x31EC, 15},
-        {0x0006,  3}, {0x001C,  5}, {0x0074,  7}, {0x0075,  7},
-        {0x00F9,  9}, {0x001E,  5}, {0x0076,  7}, {0x00FA,  9},
-        {0x03E1, 11}, {0x31ED, 15}, {0x18F7, 14}, {0x1F60, 14},
-        {0x1F61, 14}, {0x01DC,  9}, {0x01DD,  9}, {0x1F62, 14},
-        {0x1F63, 14}, {0x1F64, 14}, {0x1F65, 14}, {0x1F66, 14},
-        {0x1F67, 14}, {0x001F,  5}, {0x03ED, 11}, {0x00EF,  8},
-        {0x01F7, 10},
-    }
-};
-
-static const uint16_t x8_ac1_highquant_table[8][77][2]={
-    {//0
-        {0x0000,  3}, {0x0002,  4}, {0x0006,  5}, {0x0007,  5},
-        {0x0008,  5}, {0x0009,  5}, {0x0014,  6}, {0x002A,  7},
-        {0x0016,  6}, {0x002B,  7}, {0x005C,  8}, {0x002F,  7},
-        {0x0030,  7}, {0x005D,  8}, {0x0062,  8}, {0x00C6,  9},
-        {0x0007,  4}, {0x0019,  6}, {0x001A,  6}, {0x0036,  7},
-        {0x0010,  5}, {0x006E,  8}, {0x0022,  6}, {0x0009,  4},
-        {0x000A,  4}, {0x0016,  5}, {0x0023,  6}, {0x002E,  6},
-        {0x002F,  6}, {0x0030,  6}, {0x0062,  7}, {0x0063,  7},
-        {0x0064,  7}, {0x0065,  7}, {0x0066,  7}, {0x0067,  7},
-        {0x0068,  7}, {0x0069,  7}, {0x006A,  7}, {0x006B,  7},
-        {0x006C,  7}, {0x00C7,  9}, {0x00DE,  9}, {0x00DF,  9},
-        {0x06D0, 11}, {0x01B5,  9}, {0x0037,  6}, {0x00DB,  8},
-        {0x001C,  5}, {0x0074,  7}, {0x01D4,  9}, {0x01D5,  9},
-        {0x0076,  7}, {0x0369, 10}, {0x3688, 14}, {0x3689, 14},
-        {0x368A, 14}, {0x0077,  7}, {0x03AC, 10}, {0x0078,  7},
-        {0x00F2,  8}, {0x01D7,  9}, {0x00F3,  8}, {0x007A,  7},
-        {0x368B, 14}, {0x007B,  7}, {0x007C,  7}, {0x03AD, 10},
-        {0x03E8, 10}, {0x368C, 14}, {0x368D, 14}, {0x03E9, 10},
-        {0x368E, 14}, {0x003F,  6}, {0x01F5,  9}, {0x00FB,  8},
-        {0x368F, 14},
-    },{//1
-        {0x0000,  2}, {0x0004,  4}, {0x000A,  5}, {0x000B,  5},
-        {0x0018,  6}, {0x0032,  7}, {0x0033,  7}, {0x0034,  7},
-        {0x006A,  8}, {0x00D6,  9}, {0x00D7,  9}, {0x00D8,  9},
-        {0x00D9,  9}, {0x3680, 15}, {0x01B5, 10}, {0x0369, 11},
-        {0x0004,  3}, {0x000E,  5}, {0x001E,  6}, {0x0037,  7},
-        {0x000A,  4}, {0x0016,  5}, {0x000C,  4}, {0x001F,  6},
-        {0x005C,  7}, {0x005D,  7}, {0x00BC,  8}, {0x00BD,  8},
-        {0x005F,  7}, {0x00D0,  8}, {0x00DB,  9}, {0x00D1,  8},
-        {0x01A4,  9}, {0x01A5,  9}, {0x01A6,  9}, {0x01A7,  9},
-        {0x0350, 10}, {0x06A2, 11}, {0x06A3, 11}, {0x01A9,  9},
-        {0x01AA,  9}, {0x06AC, 11}, {0x3681, 15}, {0x0357, 10},
-        {0x3682, 15}, {0x3683, 15}, {0x3684, 15}, {0x3685, 15},
-        {0x0036,  6}, {0x00D6,  8}, {0x3686, 15}, {0x3687, 15},
-        {0x000E,  4}, {0x006E,  7}, {0x00D7,  8}, {0x06AD, 11},
-        {0x3688, 15}, {0x001E,  5}, {0x00DE,  8}, {0x06F8, 11},
-        {0x037D, 10}, {0x3689, 15}, {0x368A, 15}, {0x368B, 15},
-        {0x368C, 15}, {0x01BF,  9}, {0x368D, 15}, {0x1B47, 14},
-        {0x37C8, 14}, {0x37C9, 14}, {0x37CA, 14}, {0x37CB, 14},
-        {0x37CC, 14}, {0x001F,  5}, {0x37CD, 14}, {0x37CE, 14},
-        {0x37CF, 14},
-    },{//2
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0008,  5},
-        {0x0012,  6}, {0x0026,  7}, {0x0014,  6}, {0x0027,  7},
-        {0x00A8,  9}, {0x00A9,  9}, {0x0055,  8}, {0x2B00, 15},
-        {0x00AD,  9}, {0x2B01, 15}, {0x2B02, 15}, {0x2B03, 15},
-        {0x0003,  3}, {0x000B,  5}, {0x0040,  7}, {0x0041,  7},
-        {0x0009,  4}, {0x0021,  6}, {0x0011,  5}, {0x000A,  4},
-        {0x000B,  4}, {0x0018,  5}, {0x0032,  6}, {0x0033,  6},
-        {0x0034,  6}, {0x0035,  6}, {0x006C,  7}, {0x0057,  8},
-        {0x006D,  7}, {0x00DC,  8}, {0x0159, 10}, {0x00DD,  8},
-        {0x01BC,  9}, {0x037A, 10}, {0x037B, 10}, {0x0038,  6},
-        {0x0072,  7}, {0x01BE,  9}, {0x01BF,  9}, {0x00E6,  8},
-        {0x039C, 10}, {0x01CF,  9}, {0x2B04, 15}, {0x2B05, 15},
-        {0x0074,  7}, {0x01D4,  9}, {0x2B06, 15}, {0x2B07, 15},
-        {0x001E,  5}, {0x00EB,  8}, {0x1584, 14}, {0x1585, 14},
-        {0x1586, 14}, {0x003B,  6}, {0x01D5,  9}, {0x01F0,  9},
-        {0x039D, 10}, {0x03E2, 10}, {0x1587, 14}, {0x1588, 14},
-        {0x1589, 14}, {0x00F9,  8}, {0x158A, 14}, {0x158B, 14},
-        {0x03E3, 10}, {0x158C, 14}, {0x158D, 14}, {0x01F4,  9},
-        {0x158E, 14}, {0x003F,  6}, {0x00FB,  8}, {0x01F5,  9},
-        {0x158F, 14},
-    },{//3
-        {0x0000,  3}, {0x0002,  4}, {0x0006,  5}, {0x0007,  5},
-        {0x0010,  6}, {0x0011,  6}, {0x0024,  7}, {0x0025,  7},
-        {0x0013,  6}, {0x0014,  6}, {0x002A,  7}, {0x002B,  7},
-        {0x00B0,  9}, {0x00B1,  9}, {0x002D,  7}, {0x0059,  8},
-        {0x000C,  5}, {0x0017,  6}, {0x00D0,  9}, {0x0035,  7},
-        {0x001B,  6}, {0x0038,  7}, {0x0039,  7}, {0x0004,  3},
-        {0x0005,  3}, {0x000F,  5}, {0x0018,  5}, {0x001D,  6},
-        {0x0032,  6}, {0x0033,  6}, {0x0068,  7}, {0x0069,  7},
-        {0x0069,  8}, {0x00D4,  8}, {0x00D5,  8}, {0x00D6,  8},
-        {0x006C,  7}, {0x0037,  6}, {0x006D,  7}, {0x0070,  7},
-        {0x0039,  6}, {0x00D7,  8}, {0x00D1,  9}, {0x3880, 14},
-        {0x3881, 14}, {0x3882, 14}, {0x0074,  7}, {0x01C5,  9},
-        {0x0075,  7}, {0x00E3,  8}, {0x3883, 14}, {0x3884, 14},
-        {0x00EC,  8}, {0x3885, 14}, {0x1C43, 13}, {0x1C44, 13},
-        {0x1C45, 13}, {0x00ED,  8}, {0x1C46, 13}, {0x003C,  6},
-        {0x0077,  7}, {0x01E8,  9}, {0x003E,  6}, {0x007B,  7},
-        {0x1C47, 13}, {0x007E,  7}, {0x007F,  7}, {0x1C48, 13},
-        {0x1C49, 13}, {0x1C4A, 13}, {0x1C4B, 13}, {0x1C4C, 13},
-        {0x1C4D, 13}, {0x00F5,  8}, {0x1C4E, 13}, {0x01E9,  9},
-        {0x1C4F, 13},
-    },{//4
-        {0x0000,  2}, {0x0004,  4}, {0x000A,  5}, {0x000B,  5},
-        {0x0018,  6}, {0x0019,  6}, {0x0034,  7}, {0x0035,  7},
-        {0x0036,  7}, {0x006E,  8}, {0x00DE,  9}, {0x00DF,  9},
-        {0x01C0, 10}, {0x01C1, 10}, {0x01C2, 10}, {0x3860, 15},
-        {0x0004,  3}, {0x000F,  5}, {0x001D,  6}, {0x0039,  7},
-        {0x000A,  4}, {0x002C,  6}, {0x002D,  6}, {0x000C,  4},
-        {0x0017,  5}, {0x0034,  6}, {0x0035,  6}, {0x0036,  6},
-        {0x006E,  7}, {0x006F,  7}, {0x0070,  7}, {0x0071,  7},
-        {0x0071,  8}, {0x00E4,  8}, {0x00E5,  8}, {0x00E6,  8},
-        {0x00E7,  8}, {0x00E8,  8}, {0x03A4, 10}, {0x0075,  7},
-        {0x00EC,  8}, {0x01D3,  9}, {0x01DA,  9}, {0x03A5, 10},
-        {0x03B6, 10}, {0x070D, 12}, {0x03B7, 10}, {0x070E, 12},
-        {0x003C,  6}, {0x00EE,  8}, {0x3861, 15}, {0x3862, 15},
-        {0x003D,  6}, {0x01DE,  9}, {0x3863, 15}, {0x3864, 15},
-        {0x3865, 15}, {0x007C,  7}, {0x070F, 12}, {0x03BE, 10},
-        {0x03BF, 10}, {0x3866, 15}, {0x0FA0, 12}, {0x07D1, 11},
-        {0x3867, 15}, {0x00FB,  8}, {0x01F5,  9}, {0x7D08, 15},
-        {0x0FA4, 12}, {0x7D09, 15}, {0x7D0A, 15}, {0x7D0B, 15},
-        {0x3E86, 14}, {0x003F,  6}, {0x0FA5, 12}, {0x07D3, 11},
-        {0x3E87, 14},
-    },{//5
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0008,  5},
-        {0x0009,  5}, {0x0014,  6}, {0x002A,  7}, {0x0056,  8},
-        {0x02B8, 11}, {0x00AF,  9}, {0x02B9, 11}, {0x015D, 10},
-        {0x02C0, 11}, {0x2C10, 15}, {0x2C11, 15}, {0x2C12, 15},
-        {0x0006,  4}, {0x000E,  5}, {0x0017,  6}, {0x002D,  7},
-        {0x000F,  5}, {0x0040,  7}, {0x0021,  6}, {0x0005,  3},
-        {0x0009,  4}, {0x0011,  5}, {0x0018,  5}, {0x0019,  5},
-        {0x001A,  5}, {0x0036,  6}, {0x0037,  6}, {0x0041,  7},
-        {0x0059,  8}, {0x00E0,  8}, {0x00E1,  8}, {0x0071,  7},
-        {0x00E4,  8}, {0x00B1,  9}, {0x02C2, 11}, {0x001D,  5},
-        {0x0073,  7}, {0x00E5,  8}, {0x00F0,  8}, {0x0079,  7},
-        {0x03C4, 10}, {0x01E3,  9}, {0x01E8,  9}, {0x2C13, 15},
-        {0x007B,  7}, {0x2C14, 15}, {0x2C15, 15}, {0x2C16, 15},
-        {0x007C,  7}, {0x02C3, 11}, {0x2C17, 15}, {0x160C, 14},
-        {0x160D, 14}, {0x007D,  7}, {0x160E, 14}, {0x01E9,  9},
-        {0x03C5, 10}, {0x03D4, 10}, {0x01EB,  9}, {0x160F, 14},
-        {0x3D50, 14}, {0x00FC,  8}, {0x07AB, 11}, {0x3D51, 14},
-        {0x3D52, 14}, {0x3D53, 14}, {0x3D54, 14}, {0x01FA,  9},
-        {0x3D55, 14}, {0x007F,  7}, {0x01FB,  9}, {0x3D56, 14},
-        {0x3D57, 14},
-    },{//6
-        {0x0000,  3}, {0x0002,  4}, {0x0003,  4}, {0x0008,  5},
-        {0x0009,  5}, {0x000A,  5}, {0x000B,  5}, {0x0018,  6},
-        {0x0032,  7}, {0x000D,  5}, {0x0033,  7}, {0x0E00, 13},
-        {0x0039,  7}, {0x0E01, 13}, {0x003A,  7}, {0x0E02, 13},
-        {0x0008,  4}, {0x001E,  6}, {0x003B,  7}, {0x003E,  7},
-        {0x0012,  5}, {0x003F,  7}, {0x0013,  5}, {0x0028,  6},
-        {0x0029,  6}, {0x0054,  7}, {0x002B,  6}, {0x0055,  7},
-        {0x0058,  7}, {0x0E03, 13}, {0x0059,  7}, {0x005A,  7},
-        {0x0E04, 13}, {0x0E05, 13}, {0x0703, 12}, {0x005B,  7},
-        {0x005C,  7}, {0x0704, 12}, {0x0705, 12}, {0x005D,  7},
-        {0x0706, 12}, {0x0707, 12}, {0x0708, 12}, {0x0709, 12},
-        {0x070A, 12}, {0x070B, 12}, {0x0018,  5}, {0x002F,  6},
-        {0x000D,  4}, {0x0019,  5}, {0x070C, 12}, {0x0070,  7},
-        {0x001D,  5}, {0x070D, 12}, {0x070E, 12}, {0x070F, 12},
-        {0x0710, 12}, {0x0039,  6}, {0x0711, 12}, {0x003C,  6},
-        {0x0712, 12}, {0x0713, 12}, {0x0714, 12}, {0x0715, 12},
-        {0x0716, 12}, {0x003D,  6}, {0x0717, 12}, {0x0718, 12},
-        {0x0719, 12}, {0x071A, 12}, {0x071B, 12}, {0x071C, 12},
-        {0x071D, 12}, {0x001F,  5}, {0x071E, 12}, {0x0071,  7},
-        {0x071F, 12},
-    },{//7
-        {0x0000,  3}, {0x0002,  4}, {0x0006,  5}, {0x000E,  6},
-        {0x000F,  6}, {0x0040,  8}, {0x0041,  8}, {0x0042,  8},
-        {0x0218, 11}, {0x2190, 15}, {0x2191, 15}, {0x2192, 15},
-        {0x2193, 15}, {0x2194, 15}, {0x2195, 15}, {0x2196, 15},
-        {0x0005,  4}, {0x0011,  6}, {0x0024,  7}, {0x0087,  9},
-        {0x000C,  5}, {0x004A,  8}, {0x004B,  8}, {0x0002,  2},
-        {0x0006,  3}, {0x000D,  5}, {0x000E,  5}, {0x000F,  5},
-        {0x0013,  6}, {0x0038,  6}, {0x00E4,  8}, {0x00E5,  8},
-        {0x01CC,  9}, {0x00E7,  8}, {0x0074,  7}, {0x00EA,  8},
-        {0x01CD,  9}, {0x021A, 11}, {0x2197, 15}, {0x001E,  5},
-        {0x0076,  7}, {0x00EB,  8}, {0x01DC,  9}, {0x00EF,  8},
-        {0x01DD,  9}, {0x01F0,  9}, {0x2198, 15}, {0x2199, 15},
-        {0x00F9,  8}, {0x03E2, 10}, {0x219A, 15}, {0x219B, 15},
-        {0x00FA,  8}, {0x219C, 15}, {0x219D, 15}, {0x219E, 15},
-        {0x219F, 15}, {0x01F6,  9}, {0x21B0, 15}, {0x00FC,  8},
-        {0x01F7,  9}, {0x21B1, 15}, {0x21B2, 15}, {0x21B3, 15},
-        {0x21B4, 15}, {0x01FA,  9}, {0x21B5, 15}, {0x21B6, 15},
-        {0x21B7, 15}, {0x21B8, 15}, {0x21B9, 15}, {0x03E3, 10},
-        {0x10DD, 14}, {0x007F,  7}, {0x01FB,  9}, {0x10DE, 14},
-        {0x10DF, 14},
-    }
-};
-#define MAX_AC_VLC_BITS 16
-
-#endif /* AVCODEC_INTRAX8HUF_H */
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
deleted file mode 100644
index 8b5d939..0000000
--- a/libavcodec/ituh263dec.c
+++ /dev/null
@@ -1,1131 +0,0 @@
-/*
- * ITU H263 bitstream decoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * H263+ support.
- * Copyright (c) 2001 Juan J. Sierralta P
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * h263 decoder.
- */
-
-//#define DEBUG
-#include <limits.h>
-
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "mathops.h"
-#include "unary.h"
-#include "flv.h"
-#include "mpeg4video.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-// The defines below define the number of bits that are read at once for
-// reading vlc values. Changing these may improve speed and data cache needs
-// be aware though that decreasing them may need the number of stages that is
-// passed to get_vlc* to be increased.
-#define MV_VLC_BITS 9
-#define H263_MBTYPE_B_VLC_BITS 6
-#define CBPC_B_VLC_BITS 3
-
-static const int h263_mb_type_b_map[15]= {
-    MB_TYPE_DIRECT2 | MB_TYPE_L0L1,
-    MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP,
-    MB_TYPE_DIRECT2 | MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT,
-                      MB_TYPE_L0                                 | MB_TYPE_16x16,
-                      MB_TYPE_L0   | MB_TYPE_CBP                 | MB_TYPE_16x16,
-                      MB_TYPE_L0   | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
-                      MB_TYPE_L1                                 | MB_TYPE_16x16,
-                      MB_TYPE_L1   | MB_TYPE_CBP                 | MB_TYPE_16x16,
-                      MB_TYPE_L1   | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
-                      MB_TYPE_L0L1                               | MB_TYPE_16x16,
-                      MB_TYPE_L0L1 | MB_TYPE_CBP                 | MB_TYPE_16x16,
-                      MB_TYPE_L0L1 | MB_TYPE_CBP | MB_TYPE_QUANT | MB_TYPE_16x16,
-    0, //stuffing
-    MB_TYPE_INTRA4x4                | MB_TYPE_CBP,
-    MB_TYPE_INTRA4x4                | MB_TYPE_CBP | MB_TYPE_QUANT,
-};
-
-void ff_h263_show_pict_info(MpegEncContext *s){
-    if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-    av_log(s->avctx, AV_LOG_DEBUG, "qp:%d %c size:%d rnd:%d%s%s%s%s%s%s%s%s%s %d/%d\n",
-         s->qscale, av_get_pict_type_char(s->pict_type),
-         s->gb.size_in_bits, 1-s->no_rounding,
-         s->obmc ? " AP" : "",
-         s->umvplus ? " UMV" : "",
-         s->h263_long_vectors ? " LONG" : "",
-         s->h263_plus ? " +" : "",
-         s->h263_aic ? " AIC" : "",
-         s->alt_inter_vlc ? " AIV" : "",
-         s->modified_quant ? " MQ" : "",
-         s->loop_filter ? " LOOP" : "",
-         s->h263_slice_structured ? " SS" : "",
-         s->avctx->time_base.den, s->avctx->time_base.num
-    );
-    }
-}
-
-/***********************************************/
-/* decoding */
-
-VLC ff_h263_intra_MCBPC_vlc;
-VLC ff_h263_inter_MCBPC_vlc;
-VLC ff_h263_cbpy_vlc;
-static VLC mv_vlc;
-static VLC h263_mbtype_b_vlc;
-static VLC cbpc_b_vlc;
-
-/* init vlcs */
-
-/* XXX: find a better solution to handle static init */
-void h263_decode_init_vlc(MpegEncContext *s)
-{
-    static int done = 0;
-
-    if (!done) {
-        done = 1;
-
-        INIT_VLC_STATIC(&ff_h263_intra_MCBPC_vlc, INTRA_MCBPC_VLC_BITS, 9,
-                 ff_h263_intra_MCBPC_bits, 1, 1,
-                 ff_h263_intra_MCBPC_code, 1, 1, 72);
-        INIT_VLC_STATIC(&ff_h263_inter_MCBPC_vlc, INTER_MCBPC_VLC_BITS, 28,
-                 ff_h263_inter_MCBPC_bits, 1, 1,
-                 ff_h263_inter_MCBPC_code, 1, 1, 198);
-        INIT_VLC_STATIC(&ff_h263_cbpy_vlc, CBPY_VLC_BITS, 16,
-                 &ff_h263_cbpy_tab[0][1], 2, 1,
-                 &ff_h263_cbpy_tab[0][0], 2, 1, 64);
-        INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 33,
-                 &mvtab[0][1], 2, 1,
-                 &mvtab[0][0], 2, 1, 538);
-        init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
-        init_rl(&rl_intra_aic, ff_h263_static_rl_table_store[1]);
-        INIT_VLC_RL(ff_h263_rl_inter, 554);
-        INIT_VLC_RL(rl_intra_aic, 554);
-        INIT_VLC_STATIC(&h263_mbtype_b_vlc, H263_MBTYPE_B_VLC_BITS, 15,
-                 &h263_mbtype_b_tab[0][1], 2, 1,
-                 &h263_mbtype_b_tab[0][0], 2, 1, 80);
-        INIT_VLC_STATIC(&cbpc_b_vlc, CBPC_B_VLC_BITS, 4,
-                 &cbpc_b_tab[0][1], 2, 1,
-                 &cbpc_b_tab[0][0], 2, 1, 8);
-    }
-}
-
-int ff_h263_decode_mba(MpegEncContext *s)
-{
-    int i, mb_pos;
-
-    for(i=0; i<6; i++){
-        if(s->mb_num-1 <= ff_mba_max[i]) break;
-    }
-    mb_pos= get_bits(&s->gb, ff_mba_length[i]);
-    s->mb_x= mb_pos % s->mb_width;
-    s->mb_y= mb_pos / s->mb_width;
-
-    return mb_pos;
-}
-
-/**
- * decodes the group of blocks header or slice header.
- * @return <0 if an error occurred
- */
-static int h263_decode_gob_header(MpegEncContext *s)
-{
-    unsigned int val, gfid, gob_number;
-    int left;
-
-    /* Check for GOB Start Code */
-    val = show_bits(&s->gb, 16);
-    if(val)
-        return -1;
-
-        /* We have a GBSC probably with GSTUFF */
-    skip_bits(&s->gb, 16); /* Drop the zeros */
-    left= get_bits_left(&s->gb);
-    //MN: we must check the bits left or we might end in a infinite loop (or segfault)
-    for(;left>13; left--){
-        if(get_bits1(&s->gb)) break; /* Seek the '1' bit */
-    }
-    if(left<=13)
-        return -1;
-
-    if(s->h263_slice_structured){
-        if(get_bits1(&s->gb)==0)
-            return -1;
-
-        ff_h263_decode_mba(s);
-
-        if(s->mb_num > 1583)
-            if(get_bits1(&s->gb)==0)
-                return -1;
-
-        s->qscale = get_bits(&s->gb, 5); /* SQUANT */
-        if(get_bits1(&s->gb)==0)
-            return -1;
-        gfid = get_bits(&s->gb, 2); /* GFID */
-    }else{
-        gob_number = get_bits(&s->gb, 5); /* GN */
-        s->mb_x= 0;
-        s->mb_y= s->gob_index* gob_number;
-        gfid = get_bits(&s->gb, 2); /* GFID */
-        s->qscale = get_bits(&s->gb, 5); /* GQUANT */
-    }
-
-    if(s->mb_y >= s->mb_height)
-        return -1;
-
-    if(s->qscale==0)
-        return -1;
-
-    return 0;
-}
-
-/**
- * finds the next resync_marker
- * @param p pointer to buffer to scan
- * @param end pointer to the end of the buffer
- * @return pointer to the next resync_marker, or end if none was found
- */
-const uint8_t *ff_h263_find_resync_marker(const uint8_t *restrict p, const uint8_t * restrict end)
-{
-    assert(p < end);
-
-    end-=2;
-    p++;
-    for(;p<end; p+=2){
-        if(!*p){
-            if     (!p[-1] && p[1]) return p - 1;
-            else if(!p[ 1] && p[2]) return p;
-        }
-    }
-    return end+2;
-}
-
-/**
- * decodes the group of blocks / video packet header.
- * @return bit position of the resync_marker, or <0 if none was found
- */
-int ff_h263_resync(MpegEncContext *s){
-    int left, pos, ret;
-
-    if(s->codec_id==CODEC_ID_MPEG4){
-        skip_bits1(&s->gb);
-        align_get_bits(&s->gb);
-    }
-
-    if(show_bits(&s->gb, 16)==0){
-        pos= get_bits_count(&s->gb);
-        if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4)
-            ret= mpeg4_decode_video_packet_header(s);
-        else
-            ret= h263_decode_gob_header(s);
-        if(ret>=0)
-            return pos;
-    }
-    //OK, it's not where it is supposed to be ...
-    s->gb= s->last_resync_gb;
-    align_get_bits(&s->gb);
-    left= get_bits_left(&s->gb);
-
-    for(;left>16+1+5+5; left-=8){
-        if(show_bits(&s->gb, 16)==0){
-            GetBitContext bak= s->gb;
-
-            pos= get_bits_count(&s->gb);
-            if(CONFIG_MPEG4_DECODER && s->codec_id==CODEC_ID_MPEG4)
-                ret= mpeg4_decode_video_packet_header(s);
-            else
-                ret= h263_decode_gob_header(s);
-            if(ret>=0)
-                return pos;
-
-            s->gb= bak;
-        }
-        skip_bits(&s->gb, 8);
-    }
-
-    return -1;
-}
-
-int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
-{
-    int code, val, sign, shift, l;
-    code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
-
-    if (code == 0)
-        return pred;
-    if (code < 0)
-        return 0xffff;
-
-    sign = get_bits1(&s->gb);
-    shift = f_code - 1;
-    val = code;
-    if (shift) {
-        val = (val - 1) << shift;
-        val |= get_bits(&s->gb, shift);
-        val++;
-    }
-    if (sign)
-        val = -val;
-    val += pred;
-
-    /* modulo decoding */
-    if (!s->h263_long_vectors) {
-        l = INT_BIT - 5 - f_code;
-        val = (val<<l)>>l;
-    } else {
-        /* horrible h263 long vector mode */
-        if (pred < -31 && val < -63)
-            val += 64;
-        if (pred > 32 && val > 63)
-            val -= 64;
-
-    }
-    return val;
-}
-
-
-/* Decodes RVLC of H.263+ UMV */
-static int h263p_decode_umotion(MpegEncContext * s, int pred)
-{
-   int code = 0, sign;
-
-   if (get_bits1(&s->gb)) /* Motion difference = 0 */
-      return pred;
-
-   code = 2 + get_bits1(&s->gb);
-
-   while (get_bits1(&s->gb))
-   {
-      code <<= 1;
-      code += get_bits1(&s->gb);
-   }
-   sign = code & 1;
-   code >>= 1;
-
-   code = (sign) ? (pred - code) : (pred + code);
-   dprintf(s->avctx,"H.263+ UMV Motion = %d\n", code);
-   return code;
-
-}
-
-/**
- * read the next MVs for OBMC. yes this is a ugly hack, feel free to send a patch :)
- */
-static void preview_obmc(MpegEncContext *s){
-    GetBitContext gb= s->gb;
-
-    int cbpc, i, pred_x, pred_y, mx, my;
-    int16_t *mot_val;
-    const int xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
-    const int stride= s->b8_stride*2;
-
-    for(i=0; i<4; i++)
-        s->block_index[i]+= 2;
-    for(i=4; i<6; i++)
-        s->block_index[i]+= 1;
-    s->mb_x++;
-
-    assert(s->pict_type == FF_P_TYPE);
-
-    do{
-        if (get_bits1(&s->gb)) {
-            /* skip mb */
-            mot_val = s->current_picture.motion_val[0][ s->block_index[0] ];
-            mot_val[0       ]= mot_val[2       ]=
-            mot_val[0+stride]= mot_val[2+stride]= 0;
-            mot_val[1       ]= mot_val[3       ]=
-            mot_val[1+stride]= mot_val[3+stride]= 0;
-
-            s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-            goto end;
-        }
-        cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
-    }while(cbpc == 20);
-
-    if(cbpc & 4){
-        s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
-    }else{
-        get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-        if (cbpc & 8) {
-            if(s->modified_quant){
-                if(get_bits1(&s->gb)) skip_bits(&s->gb, 1);
-                else                  skip_bits(&s->gb, 5);
-            }else
-                skip_bits(&s->gb, 2);
-        }
-
-        if ((cbpc & 16) == 0) {
-                s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
-                /* 16x16 motion prediction */
-                mot_val= h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-                if (s->umvplus)
-                   mx = h263p_decode_umotion(s, pred_x);
-                else
-                   mx = h263_decode_motion(s, pred_x, 1);
-
-                if (s->umvplus)
-                   my = h263p_decode_umotion(s, pred_y);
-                else
-                   my = h263_decode_motion(s, pred_y, 1);
-
-                mot_val[0       ]= mot_val[2       ]=
-                mot_val[0+stride]= mot_val[2+stride]= mx;
-                mot_val[1       ]= mot_val[3       ]=
-                mot_val[1+stride]= mot_val[3+stride]= my;
-        } else {
-            s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
-            for(i=0;i<4;i++) {
-                mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y);
-                if (s->umvplus)
-                  mx = h263p_decode_umotion(s, pred_x);
-                else
-                  mx = h263_decode_motion(s, pred_x, 1);
-
-                if (s->umvplus)
-                  my = h263p_decode_umotion(s, pred_y);
-                else
-                  my = h263_decode_motion(s, pred_y, 1);
-                if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
-                  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
-                mot_val[0] = mx;
-                mot_val[1] = my;
-            }
-        }
-    }
-end:
-
-    for(i=0; i<4; i++)
-        s->block_index[i]-= 2;
-    for(i=4; i<6; i++)
-        s->block_index[i]-= 1;
-    s->mb_x--;
-
-    s->gb= gb;
-}
-
-static void h263_decode_dquant(MpegEncContext *s){
-    static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
-
-    if(s->modified_quant){
-        if(get_bits1(&s->gb))
-            s->qscale= modified_quant_tab[get_bits1(&s->gb)][ s->qscale ];
-        else
-            s->qscale= get_bits(&s->gb, 5);
-    }else
-        s->qscale += quant_tab[get_bits(&s->gb, 2)];
-    ff_set_qscale(s, s->qscale);
-}
-
-static int h263_decode_block(MpegEncContext * s, DCTELEM * block,
-                             int n, int coded)
-{
-    int code, level, i, j, last, run;
-    RLTable *rl = &ff_h263_rl_inter;
-    const uint8_t *scan_table;
-    GetBitContext gb= s->gb;
-
-    scan_table = s->intra_scantable.permutated;
-    if (s->h263_aic && s->mb_intra) {
-        rl = &rl_intra_aic;
-        i = 0;
-        if (s->ac_pred) {
-            if (s->h263_aic_dir)
-                scan_table = s->intra_v_scantable.permutated; /* left */
-            else
-                scan_table = s->intra_h_scantable.permutated; /* top */
-        }
-    } else if (s->mb_intra) {
-        /* DC coef */
-        if(s->codec_id == CODEC_ID_RV10){
-#if CONFIG_RV10_DECODER
-          if (s->rv10_version == 3 && s->pict_type == FF_I_TYPE) {
-            int component, diff;
-            component = (n <= 3 ? 0 : n - 4 + 1);
-            level = s->last_dc[component];
-            if (s->rv10_first_dc_coded[component]) {
-                diff = rv_decode_dc(s, n);
-                if (diff == 0xffff)
-                    return -1;
-                level += diff;
-                level = level & 0xff; /* handle wrap round */
-                s->last_dc[component] = level;
-            } else {
-                s->rv10_first_dc_coded[component] = 1;
-            }
-          } else {
-                level = get_bits(&s->gb, 8);
-                if (level == 255)
-                    level = 128;
-          }
-#endif
-        }else{
-            level = get_bits(&s->gb, 8);
-            if((level&0x7F) == 0){
-                av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y);
-                if(s->error_recognition >= FF_ER_COMPLIANT)
-                    return -1;
-            }
-            if (level == 255)
-                level = 128;
-        }
-        block[0] = level;
-        i = 1;
-    } else {
-        i = 0;
-    }
-    if (!coded) {
-        if (s->mb_intra && s->h263_aic)
-            goto not_coded;
-        s->block_last_index[n] = i - 1;
-        return 0;
-    }
-retry:
-    for(;;) {
-        code = get_vlc2(&s->gb, rl->vlc.table, TEX_VLC_BITS, 2);
-        if (code < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        if (code == rl->n) {
-            /* escape */
-            if (CONFIG_FLV_DECODER && s->h263_flv > 1) {
-                ff_flv2_decode_ac_esc(&s->gb, &level, &run, &last);
-            } else {
-                last = get_bits1(&s->gb);
-                run = get_bits(&s->gb, 6);
-                level = (int8_t)get_bits(&s->gb, 8);
-                if(level == -128){
-                    if (s->codec_id == CODEC_ID_RV10) {
-                        /* XXX: should patch encoder too */
-                        level = get_sbits(&s->gb, 12);
-                    }else{
-                        level = get_bits(&s->gb, 5);
-                        level |= get_sbits(&s->gb, 6)<<5;
-                    }
-                }
-            }
-        } else {
-            run = rl->table_run[code];
-            level = rl->table_level[code];
-            last = code >= rl->last;
-            if (get_bits1(&s->gb))
-                level = -level;
-        }
-        i += run;
-        if (i >= 64){
-            if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){
-                //Looks like a hack but no, it's the way it is supposed to work ...
-                rl = &rl_intra_aic;
-                i = 0;
-                s->gb= gb;
-                s->dsp.clear_block(block);
-                goto retry;
-            }
-            av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d i:%d\n", s->mb_x, s->mb_y, s->mb_intra);
-            return -1;
-        }
-        j = scan_table[i];
-        block[j] = level;
-        if (last)
-            break;
-        i++;
-    }
-not_coded:
-    if (s->mb_intra && s->h263_aic) {
-        h263_pred_acdc(s, block, n);
-        i = 63;
-    }
-    s->block_last_index[n] = i;
-    return 0;
-}
-
-static int h263_skip_b_part(MpegEncContext *s, int cbp)
-{
-    LOCAL_ALIGNED_16(DCTELEM, dblock, [64]);
-    int i, mbi;
-
-    /* we have to set s->mb_intra to zero to decode B-part of PB-frame correctly
-     * but real value should be restored in order to be used later (in OBMC condition)
-     */
-    mbi = s->mb_intra;
-    s->mb_intra = 0;
-    for (i = 0; i < 6; i++) {
-        if (h263_decode_block(s, dblock, i, cbp&32) < 0)
-            return -1;
-        cbp+=cbp;
-    }
-    s->mb_intra = mbi;
-    return 0;
-}
-
-static int h263_get_modb(GetBitContext *gb, int pb_frame, int *cbpb)
-{
-    int c, mv = 1;
-
-    if (pb_frame < 3) { // h.263 Annex G and i263 PB-frame
-        c = get_bits1(gb);
-        if (pb_frame == 2 && c)
-            mv = !get_bits1(gb);
-    } else { // h.263 Annex M improved PB-frame
-        mv = get_unary(gb, 0, 4) + 1;
-        c = mv & 1;
-        mv = !!(mv & 2);
-    }
-    if(c)
-        *cbpb = get_bits(gb, 6);
-    return mv;
-}
-
-int ff_h263_decode_mb(MpegEncContext *s,
-                      DCTELEM block[6][64])
-{
-    int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
-    int16_t *mot_val;
-    const int xy= s->mb_x + s->mb_y * s->mb_stride;
-    int cbpb = 0, pb_mv_count = 0;
-
-    assert(!s->h263_pred);
-
-    if (s->pict_type == FF_P_TYPE) {
-        do{
-            if (get_bits1(&s->gb)) {
-                /* skip mb */
-                s->mb_intra = 0;
-                for(i=0;i<6;i++)
-                    s->block_last_index[i] = -1;
-                s->mv_dir = MV_DIR_FORWARD;
-                s->mv_type = MV_TYPE_16X16;
-                s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-                s->mv[0][0][0] = 0;
-                s->mv[0][0][1] = 0;
-                s->mb_skipped = !(s->obmc | s->loop_filter);
-                goto end;
-            }
-            cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
-            if (cbpc < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-        }while(cbpc == 20);
-
-        s->dsp.clear_blocks(s->block[0]);
-
-        dquant = cbpc & 8;
-        s->mb_intra = ((cbpc & 4) != 0);
-        if (s->mb_intra) goto intra;
-
-        if(s->pb_frame && get_bits1(&s->gb))
-            pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
-        cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-
-        if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
-            cbpy ^= 0xF;
-
-        cbp = (cbpc & 3) | (cbpy << 2);
-        if (dquant) {
-            h263_decode_dquant(s);
-        }
-
-        s->mv_dir = MV_DIR_FORWARD;
-        if ((cbpc & 16) == 0) {
-            s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
-            /* 16x16 motion prediction */
-            s->mv_type = MV_TYPE_16X16;
-            h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-            if (s->umvplus)
-               mx = h263p_decode_umotion(s, pred_x);
-            else
-               mx = h263_decode_motion(s, pred_x, 1);
-
-            if (mx >= 0xffff)
-                return -1;
-
-            if (s->umvplus)
-               my = h263p_decode_umotion(s, pred_y);
-            else
-               my = h263_decode_motion(s, pred_y, 1);
-
-            if (my >= 0xffff)
-                return -1;
-            s->mv[0][0][0] = mx;
-            s->mv[0][0][1] = my;
-
-            if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
-               skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
-        } else {
-            s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
-            s->mv_type = MV_TYPE_8X8;
-            for(i=0;i<4;i++) {
-                mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y);
-                if (s->umvplus)
-                  mx = h263p_decode_umotion(s, pred_x);
-                else
-                  mx = h263_decode_motion(s, pred_x, 1);
-                if (mx >= 0xffff)
-                    return -1;
-
-                if (s->umvplus)
-                  my = h263p_decode_umotion(s, pred_y);
-                else
-                  my = h263_decode_motion(s, pred_y, 1);
-                if (my >= 0xffff)
-                    return -1;
-                s->mv[0][i][0] = mx;
-                s->mv[0][i][1] = my;
-                if (s->umvplus && (mx - pred_x) == 1 && (my - pred_y) == 1)
-                  skip_bits1(&s->gb); /* Bit stuffing to prevent PSC */
-                mot_val[0] = mx;
-                mot_val[1] = my;
-            }
-        }
-    } else if(s->pict_type==FF_B_TYPE) {
-        int mb_type;
-        const int stride= s->b8_stride;
-        int16_t *mot_val0 = s->current_picture.motion_val[0][ 2*(s->mb_x + s->mb_y*stride) ];
-        int16_t *mot_val1 = s->current_picture.motion_val[1][ 2*(s->mb_x + s->mb_y*stride) ];
-//        const int mv_xy= s->mb_x + 1 + s->mb_y * s->mb_stride;
-
-        //FIXME ugly
-        mot_val0[0       ]= mot_val0[2       ]= mot_val0[0+2*stride]= mot_val0[2+2*stride]=
-        mot_val0[1       ]= mot_val0[3       ]= mot_val0[1+2*stride]= mot_val0[3+2*stride]=
-        mot_val1[0       ]= mot_val1[2       ]= mot_val1[0+2*stride]= mot_val1[2+2*stride]=
-        mot_val1[1       ]= mot_val1[3       ]= mot_val1[1+2*stride]= mot_val1[3+2*stride]= 0;
-
-        do{
-            mb_type= get_vlc2(&s->gb, h263_mbtype_b_vlc.table, H263_MBTYPE_B_VLC_BITS, 2);
-            if (mb_type < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "b mb_type damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            mb_type= h263_mb_type_b_map[ mb_type ];
-        }while(!mb_type);
-
-        s->mb_intra = IS_INTRA(mb_type);
-        if(HAS_CBP(mb_type)){
-            s->dsp.clear_blocks(s->block[0]);
-            cbpc = get_vlc2(&s->gb, cbpc_b_vlc.table, CBPC_B_VLC_BITS, 1);
-            if(s->mb_intra){
-                dquant = IS_QUANT(mb_type);
-                goto intra;
-            }
-
-            cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-
-            if (cbpy < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "b cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            if(s->alt_inter_vlc==0 || (cbpc & 3)!=3)
-                cbpy ^= 0xF;
-
-            cbp = (cbpc & 3) | (cbpy << 2);
-        }else
-            cbp=0;
-
-        assert(!s->mb_intra);
-
-        if(IS_QUANT(mb_type)){
-            h263_decode_dquant(s);
-        }
-
-        if(IS_DIRECT(mb_type)){
-            s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
-            mb_type |= ff_mpeg4_set_direct_mv(s, 0, 0);
-        }else{
-            s->mv_dir = 0;
-            s->mv_type= MV_TYPE_16X16;
-//FIXME UMV
-
-            if(USES_LIST(mb_type, 0)){
-                int16_t *mot_val= h263_pred_motion(s, 0, 0, &mx, &my);
-                s->mv_dir = MV_DIR_FORWARD;
-
-                mx = h263_decode_motion(s, mx, 1);
-                my = h263_decode_motion(s, my, 1);
-
-                s->mv[0][0][0] = mx;
-                s->mv[0][0][1] = my;
-                mot_val[0       ]= mot_val[2       ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
-                mot_val[1       ]= mot_val[3       ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
-            }
-
-            if(USES_LIST(mb_type, 1)){
-                int16_t *mot_val= h263_pred_motion(s, 0, 1, &mx, &my);
-                s->mv_dir |= MV_DIR_BACKWARD;
-
-                mx = h263_decode_motion(s, mx, 1);
-                my = h263_decode_motion(s, my, 1);
-
-                s->mv[1][0][0] = mx;
-                s->mv[1][0][1] = my;
-                mot_val[0       ]= mot_val[2       ]= mot_val[0+2*stride]= mot_val[2+2*stride]= mx;
-                mot_val[1       ]= mot_val[3       ]= mot_val[1+2*stride]= mot_val[3+2*stride]= my;
-            }
-        }
-
-        s->current_picture.mb_type[xy]= mb_type;
-    } else { /* I-Frame */
-        do{
-            cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
-            if (cbpc < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-        }while(cbpc == 8);
-
-        s->dsp.clear_blocks(s->block[0]);
-
-        dquant = cbpc & 4;
-        s->mb_intra = 1;
-intra:
-        s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
-        if (s->h263_aic) {
-            s->ac_pred = get_bits1(&s->gb);
-            if(s->ac_pred){
-                s->current_picture.mb_type[xy]= MB_TYPE_INTRA | MB_TYPE_ACPRED;
-
-                s->h263_aic_dir = get_bits1(&s->gb);
-            }
-        }else
-            s->ac_pred = 0;
-
-        if(s->pb_frame && get_bits1(&s->gb))
-            pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb);
-        cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-        if(cbpy<0){
-            av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        cbp = (cbpc & 3) | (cbpy << 2);
-        if (dquant) {
-            h263_decode_dquant(s);
-        }
-
-        pb_mv_count += !!s->pb_frame;
-    }
-
-    while(pb_mv_count--){
-        h263_decode_motion(s, 0, 1);
-        h263_decode_motion(s, 0, 1);
-    }
-
-    /* decode each block */
-    for (i = 0; i < 6; i++) {
-        if (h263_decode_block(s, block[i], i, cbp&32) < 0)
-            return -1;
-        cbp+=cbp;
-    }
-
-    if(s->pb_frame && h263_skip_b_part(s, cbpb) < 0)
-        return -1;
-    if(s->obmc && !s->mb_intra){
-        if(s->pict_type == FF_P_TYPE && s->mb_x+1<s->mb_width && s->mb_num_left != 1)
-            preview_obmc(s);
-    }
-end:
-
-        /* per-MB end of slice check */
-    {
-        int v= show_bits(&s->gb, 16);
-
-        if(get_bits_count(&s->gb) + 16 > s->gb.size_in_bits){
-            v>>= get_bits_count(&s->gb) + 16 - s->gb.size_in_bits;
-        }
-
-        if(v==0)
-            return SLICE_END;
-    }
-
-    return SLICE_OK;
-}
-
-/* most is hardcoded. should extend to handle all h263 streams */
-int h263_decode_picture_header(MpegEncContext *s)
-{
-    int format, width, height, i;
-    uint32_t startcode;
-
-    align_get_bits(&s->gb);
-
-    startcode= get_bits(&s->gb, 22-8);
-
-    for(i= get_bits_left(&s->gb); i>24; i-=8) {
-        startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;
-
-        if(startcode == 0x20)
-            break;
-    }
-
-    if (startcode != 0x20) {
-        av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
-        return -1;
-    }
-    /* temporal reference */
-    i = get_bits(&s->gb, 8); /* picture timestamp */
-    if( (s->picture_number&~0xFF)+i < s->picture_number)
-        i+= 256;
-    s->current_picture_ptr->pts=
-    s->picture_number= (s->picture_number&~0xFF) + i;
-
-    /* PTYPE starts here */
-    if (get_bits1(&s->gb) != 1) {
-        /* marker */
-        av_log(s->avctx, AV_LOG_ERROR, "Bad marker\n");
-        return -1;
-    }
-    if (get_bits1(&s->gb) != 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "Bad H263 id\n");
-        return -1;      /* h263 id */
-    }
-    skip_bits1(&s->gb);         /* split screen off */
-    skip_bits1(&s->gb);         /* camera  off */
-    skip_bits1(&s->gb);         /* freeze picture release off */
-
-    format = get_bits(&s->gb, 3);
-    /*
-        0    forbidden
-        1    sub-QCIF
-        10   QCIF
-        7       extended PTYPE (PLUSPTYPE)
-    */
-
-    if (format != 7 && format != 6) {
-        s->h263_plus = 0;
-        /* H.263v1 */
-        width = h263_format[format][0];
-        height = h263_format[format][1];
-        if (!width)
-            return -1;
-
-        s->pict_type = FF_I_TYPE + get_bits1(&s->gb);
-
-        s->h263_long_vectors = get_bits1(&s->gb);
-
-        if (get_bits1(&s->gb) != 0) {
-            av_log(s->avctx, AV_LOG_ERROR, "H263 SAC not supported\n");
-            return -1; /* SAC: off */
-        }
-        s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
-        s->unrestricted_mv = s->h263_long_vectors || s->obmc;
-
-        s->pb_frame = get_bits1(&s->gb);
-        s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
-        skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */
-
-        s->width = width;
-        s->height = height;
-        s->avctx->sample_aspect_ratio= (AVRational){12,11};
-        s->avctx->time_base= (AVRational){1001, 30000};
-    } else {
-        int ufep;
-
-        /* H.263v2 */
-        s->h263_plus = 1;
-        ufep = get_bits(&s->gb, 3); /* Update Full Extended PTYPE */
-
-        /* ufep other than 0 and 1 are reserved */
-        if (ufep == 1) {
-            /* OPPTYPE */
-            format = get_bits(&s->gb, 3);
-            dprintf(s->avctx, "ufep=1, format: %d\n", format);
-            s->custom_pcf= get_bits1(&s->gb);
-            s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */
-            if (get_bits1(&s->gb) != 0) {
-                av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n");
-            }
-            s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */
-            s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */
-            s->loop_filter= get_bits1(&s->gb);
-            s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter;
-
-            s->h263_slice_structured= get_bits1(&s->gb);
-            if (get_bits1(&s->gb) != 0) {
-                av_log(s->avctx, AV_LOG_ERROR, "Reference Picture Selection not supported\n");
-            }
-            if (get_bits1(&s->gb) != 0) {
-                av_log(s->avctx, AV_LOG_ERROR, "Independent Segment Decoding not supported\n");
-            }
-            s->alt_inter_vlc= get_bits1(&s->gb);
-            s->modified_quant= get_bits1(&s->gb);
-            if(s->modified_quant)
-                s->chroma_qscale_table= ff_h263_chroma_qscale_table;
-
-            skip_bits(&s->gb, 1); /* Prevent start code emulation */
-
-            skip_bits(&s->gb, 3); /* Reserved */
-        } else if (ufep != 0) {
-            av_log(s->avctx, AV_LOG_ERROR, "Bad UFEP type (%d)\n", ufep);
-            return -1;
-        }
-
-        /* MPPTYPE */
-        s->pict_type = get_bits(&s->gb, 3);
-        switch(s->pict_type){
-        case 0: s->pict_type= FF_I_TYPE;break;
-        case 1: s->pict_type= FF_P_TYPE;break;
-        case 2: s->pict_type= FF_P_TYPE;s->pb_frame = 3;break;
-        case 3: s->pict_type= FF_B_TYPE;break;
-        case 7: s->pict_type= FF_I_TYPE;break; //ZYGO
-        default:
-            return -1;
-        }
-        skip_bits(&s->gb, 2);
-        s->no_rounding = get_bits1(&s->gb);
-        skip_bits(&s->gb, 4);
-
-        /* Get the picture dimensions */
-        if (ufep) {
-            if (format == 6) {
-                /* Custom Picture Format (CPFMT) */
-                s->aspect_ratio_info = get_bits(&s->gb, 4);
-                dprintf(s->avctx, "aspect: %d\n", s->aspect_ratio_info);
-                /* aspect ratios:
-                0 - forbidden
-                1 - 1:1
-                2 - 12:11 (CIF 4:3)
-                3 - 10:11 (525-type 4:3)
-                4 - 16:11 (CIF 16:9)
-                5 - 40:33 (525-type 16:9)
-                6-14 - reserved
-                */
-                width = (get_bits(&s->gb, 9) + 1) * 4;
-                skip_bits1(&s->gb);
-                height = get_bits(&s->gb, 9) * 4;
-                dprintf(s->avctx, "\nH.263+ Custom picture: %dx%d\n",width,height);
-                if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
-                    /* aspected dimensions */
-                    s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 8);
-                    s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 8);
-                }else{
-                    s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info];
-                }
-            } else {
-                width = h263_format[format][0];
-                height = h263_format[format][1];
-                s->avctx->sample_aspect_ratio= (AVRational){12,11};
-            }
-            if ((width == 0) || (height == 0))
-                return -1;
-            s->width = width;
-            s->height = height;
-
-            if(s->custom_pcf){
-                int gcd;
-                s->avctx->time_base.den= 1800000;
-                s->avctx->time_base.num= 1000 + get_bits1(&s->gb);
-                s->avctx->time_base.num*= get_bits(&s->gb, 7);
-                if(s->avctx->time_base.num == 0){
-                    av_log(s, AV_LOG_ERROR, "zero framerate\n");
-                    return -1;
-                }
-                gcd= av_gcd(s->avctx->time_base.den, s->avctx->time_base.num);
-                s->avctx->time_base.den /= gcd;
-                s->avctx->time_base.num /= gcd;
-            }else{
-                s->avctx->time_base= (AVRational){1001, 30000};
-            }
-        }
-
-        if(s->custom_pcf){
-            skip_bits(&s->gb, 2); //extended Temporal reference
-        }
-
-        if (ufep) {
-            if (s->umvplus) {
-                if(get_bits1(&s->gb)==0) /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */
-                    skip_bits1(&s->gb);
-            }
-            if(s->h263_slice_structured){
-                if (get_bits1(&s->gb) != 0) {
-                    av_log(s->avctx, AV_LOG_ERROR, "rectangular slices not supported\n");
-                }
-                if (get_bits1(&s->gb) != 0) {
-                    av_log(s->avctx, AV_LOG_ERROR, "unordered slices not supported\n");
-                }
-            }
-        }
-
-        s->qscale = get_bits(&s->gb, 5);
-    }
-
-    s->mb_width = (s->width  + 15) / 16;
-    s->mb_height = (s->height  + 15) / 16;
-    s->mb_num = s->mb_width * s->mb_height;
-
-    if (s->pb_frame) {
-        skip_bits(&s->gb, 3); /* Temporal reference for B-pictures */
-        if (s->custom_pcf)
-            skip_bits(&s->gb, 2); //extended Temporal reference
-        skip_bits(&s->gb, 2); /* Quantization information for B-pictures */
-    }
-
-    /* PEI */
-    while (get_bits1(&s->gb) != 0) {
-        skip_bits(&s->gb, 8);
-    }
-
-    if(s->h263_slice_structured){
-        if (get_bits1(&s->gb) != 1) {
-            av_log(s->avctx, AV_LOG_ERROR, "SEPB1 marker missing\n");
-            return -1;
-        }
-
-        ff_h263_decode_mba(s);
-
-        if (get_bits1(&s->gb) != 1) {
-            av_log(s->avctx, AV_LOG_ERROR, "SEPB2 marker missing\n");
-            return -1;
-        }
-    }
-    s->f_code = 1;
-
-    if(s->h263_aic){
-         s->y_dc_scale_table=
-         s->c_dc_scale_table= ff_aic_dc_scale_table;
-    }else{
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-    }
-
-        ff_h263_show_pict_info(s);
-    if (s->pict_type == FF_I_TYPE && s->codec_tag == AV_RL32("ZYGO")){
-        int i,j;
-        for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
-        av_log(s->avctx, AV_LOG_DEBUG, "\n");
-        for(i=0; i<13; i++){
-            for(j=0; j<3; j++){
-                int v= get_bits(&s->gb, 8);
-                v |= get_sbits(&s->gb, 8)<<8;
-                av_log(s->avctx, AV_LOG_DEBUG, " %5d", v);
-            }
-            av_log(s->avctx, AV_LOG_DEBUG, "\n");
-        }
-        for(i=0; i<50; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
-    }
-
-    return 0;
-}
diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
deleted file mode 100644
index f736d7c..0000000
--- a/libavcodec/ituh263enc.c
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * ITU H263 bitstream encoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * H263+ support.
- * Copyright (c) 2001 Juan J. Sierralta P
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * h263 bitstream encoder.
- */
-
-//#define DEBUG
-#include <limits.h>
-
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "mathops.h"
-#include "unary.h"
-#include "flv.h"
-#include "mpeg4video.h"
-#include "internal.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-/**
- * Table of number of bits a motion vector component needs.
- */
-static uint8_t mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
-
-/**
- * Minimal fcode that a motion vector component would need.
- */
-static uint8_t fcode_tab[MAX_MV*2+1];
-
-/**
- * Minimal fcode that a motion vector component would need in umv.
- * All entries in this table are 1.
- */
-static uint8_t umv_fcode_tab[MAX_MV*2+1];
-
-//unified encoding tables for run length encoding of coefficients
-//unified in the sense that the specification specifies the encoding in several steps.
-static uint8_t  uni_h263_intra_aic_rl_len [64*64*2*2];
-static uint8_t  uni_h263_inter_rl_len [64*64*2*2];
-//#define UNI_MPEG4_ENC_INDEX(last,run,level) ((last)*128 + (run)*256 + (level))
-//#define UNI_MPEG4_ENC_INDEX(last,run,level) ((last)*128*64 + (run) + (level)*64)
-#define UNI_MPEG4_ENC_INDEX(last,run,level) ((last)*128*64 + (run)*128 + (level))
-
-static const uint8_t wrong_run[102] = {
- 1,  2,  3,  5,  4, 10,  9,  8,
-11, 15, 17, 16, 23, 22, 21, 20,
-19, 18, 25, 24, 27, 26, 11,  7,
- 6,  1,  2, 13,  2,  2,  2,  2,
- 6, 12,  3,  9,  1,  3,  4,  3,
- 7,  4,  1,  1,  5,  5, 14,  6,
- 1,  7,  1,  8,  1,  1,  1,  1,
-10,  1,  1,  5,  9, 17, 25, 24,
-29, 33, 32, 41,  2, 23, 28, 31,
- 3, 22, 30,  4, 27, 40,  8, 26,
- 6, 39,  7, 38, 16, 37, 15, 10,
-11, 12, 13, 14,  1, 21, 20, 18,
-19,  2,  1, 34, 35, 36
-};
-
-/**
- * Returns the 4 bit value that specifies the given aspect ratio.
- * This may be one of the standard aspect ratios or it specifies
- * that the aspect will be stored explicitly later.
- */
-av_const int ff_h263_aspect_to_info(AVRational aspect){
-    int i;
-
-    if(aspect.num==0) aspect= (AVRational){1,1};
-
-    for(i=1; i<6; i++){
-        if(av_cmp_q(ff_h263_pixel_aspect[i], aspect) == 0){
-            return i;
-        }
-    }
-
-    return FF_ASPECT_EXTENDED;
-}
-
-void h263_encode_picture_header(MpegEncContext * s, int picture_number)
-{
-    int format, coded_frame_rate, coded_frame_rate_base, i, temp_ref;
-    int best_clock_code=1;
-    int best_divisor=60;
-    int best_error= INT_MAX;
-
-    if(s->h263_plus){
-        for(i=0; i<2; i++){
-            int div, error;
-            div= (s->avctx->time_base.num*1800000LL + 500LL*s->avctx->time_base.den) / ((1000LL+i)*s->avctx->time_base.den);
-            div= av_clip(div, 1, 127);
-            error= FFABS(s->avctx->time_base.num*1800000LL - (1000LL+i)*s->avctx->time_base.den*div);
-            if(error < best_error){
-                best_error= error;
-                best_divisor= div;
-                best_clock_code= i;
-            }
-        }
-    }
-    s->custom_pcf= best_clock_code!=1 || best_divisor!=60;
-    coded_frame_rate= 1800000;
-    coded_frame_rate_base= (1000+best_clock_code)*best_divisor;
-
-    align_put_bits(&s->pb);
-
-    /* Update the pointer to last GOB */
-    s->ptr_lastgob = put_bits_ptr(&s->pb);
-    put_bits(&s->pb, 22, 0x20); /* PSC */
-    temp_ref= s->picture_number * (int64_t)coded_frame_rate * s->avctx->time_base.num / //FIXME use timestamp
-                         (coded_frame_rate_base * (int64_t)s->avctx->time_base.den);
-    put_sbits(&s->pb, 8, temp_ref); /* TemporalReference */
-
-    put_bits(&s->pb, 1, 1);     /* marker */
-    put_bits(&s->pb, 1, 0);     /* h263 id */
-    put_bits(&s->pb, 1, 0);     /* split screen off */
-    put_bits(&s->pb, 1, 0);     /* camera  off */
-    put_bits(&s->pb, 1, 0);     /* freeze picture release off */
-
-    format = ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height);
-    if (!s->h263_plus) {
-        /* H.263v1 */
-        put_bits(&s->pb, 3, format);
-        put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE));
-        /* By now UMV IS DISABLED ON H.263v1, since the restrictions
-        of H.263v1 UMV implies to check the predicted MV after
-        calculation of the current MB to see if we're on the limits */
-        put_bits(&s->pb, 1, 0);         /* Unrestricted Motion Vector: off */
-        put_bits(&s->pb, 1, 0);         /* SAC: off */
-        put_bits(&s->pb, 1, s->obmc);   /* Advanced Prediction */
-        put_bits(&s->pb, 1, 0);         /* only I/P frames, no PB frame */
-        put_bits(&s->pb, 5, s->qscale);
-        put_bits(&s->pb, 1, 0);         /* Continuous Presence Multipoint mode: off */
-    } else {
-        int ufep=1;
-        /* H.263v2 */
-        /* H.263 Plus PTYPE */
-
-        put_bits(&s->pb, 3, 7);
-        put_bits(&s->pb,3,ufep); /* Update Full Extended PTYPE */
-        if (format == 7)
-            put_bits(&s->pb,3,6); /* Custom Source Format */
-        else
-            put_bits(&s->pb, 3, format);
-
-        put_bits(&s->pb,1, s->custom_pcf);
-        put_bits(&s->pb,1, s->umvplus); /* Unrestricted Motion Vector */
-        put_bits(&s->pb,1,0); /* SAC: off */
-        put_bits(&s->pb,1,s->obmc); /* Advanced Prediction Mode */
-        put_bits(&s->pb,1,s->h263_aic); /* Advanced Intra Coding */
-        put_bits(&s->pb,1,s->loop_filter); /* Deblocking Filter */
-        put_bits(&s->pb,1,s->h263_slice_structured); /* Slice Structured */
-        put_bits(&s->pb,1,0); /* Reference Picture Selection: off */
-        put_bits(&s->pb,1,0); /* Independent Segment Decoding: off */
-        put_bits(&s->pb,1,s->alt_inter_vlc); /* Alternative Inter VLC */
-        put_bits(&s->pb,1,s->modified_quant); /* Modified Quantization: */
-        put_bits(&s->pb,1,1); /* "1" to prevent start code emulation */
-        put_bits(&s->pb,3,0); /* Reserved */
-
-        put_bits(&s->pb, 3, s->pict_type == FF_P_TYPE);
-
-        put_bits(&s->pb,1,0); /* Reference Picture Resampling: off */
-        put_bits(&s->pb,1,0); /* Reduced-Resolution Update: off */
-        put_bits(&s->pb,1,s->no_rounding); /* Rounding Type */
-        put_bits(&s->pb,2,0); /* Reserved */
-        put_bits(&s->pb,1,1); /* "1" to prevent start code emulation */
-
-        /* This should be here if PLUSPTYPE */
-        put_bits(&s->pb, 1, 0); /* Continuous Presence Multipoint mode: off */
-
-                if (format == 7) {
-            /* Custom Picture Format (CPFMT) */
-            s->aspect_ratio_info= ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
-
-            put_bits(&s->pb,4,s->aspect_ratio_info);
-            put_bits(&s->pb,9,(s->width >> 2) - 1);
-            put_bits(&s->pb,1,1); /* "1" to prevent start code emulation */
-            put_bits(&s->pb,9,(s->height >> 2));
-            if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){
-                put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num);
-                put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den);
-            }
-        }
-        if(s->custom_pcf){
-            if(ufep){
-                put_bits(&s->pb, 1, best_clock_code);
-                put_bits(&s->pb, 7, best_divisor);
-            }
-            put_sbits(&s->pb, 2, temp_ref>>8);
-        }
-
-        /* Unlimited Unrestricted Motion Vectors Indicator (UUI) */
-        if (s->umvplus)
-//            put_bits(&s->pb,1,1); /* Limited according tables of Annex D */
-//FIXME check actual requested range
-            put_bits(&s->pb,2,1); /* unlimited */
-        if(s->h263_slice_structured)
-            put_bits(&s->pb,2,0); /* no weird submodes */
-
-        put_bits(&s->pb, 5, s->qscale);
-    }
-
-    put_bits(&s->pb, 1, 0);     /* no PEI */
-
-    if(s->h263_slice_structured){
-        put_bits(&s->pb, 1, 1);
-
-        assert(s->mb_x == 0 && s->mb_y == 0);
-        ff_h263_encode_mba(s);
-
-        put_bits(&s->pb, 1, 1);
-    }
-
-    if(s->h263_aic){
-         s->y_dc_scale_table=
-         s->c_dc_scale_table= ff_aic_dc_scale_table;
-    }else{
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-    }
-}
-
-/**
- * Encodes a group of blocks header.
- */
-void h263_encode_gob_header(MpegEncContext * s, int mb_line)
-{
-    put_bits(&s->pb, 17, 1); /* GBSC */
-
-    if(s->h263_slice_structured){
-        put_bits(&s->pb, 1, 1);
-
-        ff_h263_encode_mba(s);
-
-        if(s->mb_num > 1583)
-            put_bits(&s->pb, 1, 1);
-        put_bits(&s->pb, 5, s->qscale); /* GQUANT */
-        put_bits(&s->pb, 1, 1);
-        put_bits(&s->pb, 2, s->pict_type == FF_I_TYPE); /* GFID */
-    }else{
-        int gob_number= mb_line / s->gob_index;
-
-        put_bits(&s->pb, 5, gob_number); /* GN */
-        put_bits(&s->pb, 2, s->pict_type == FF_I_TYPE); /* GFID */
-        put_bits(&s->pb, 5, s->qscale); /* GQUANT */
-    }
-}
-
-/**
- * modify qscale so that encoding is acually possible in h263 (limit difference to -2..2)
- */
-void ff_clean_h263_qscales(MpegEncContext *s){
-    int i;
-    int8_t * const qscale_table= s->current_picture.qscale_table;
-
-    ff_init_qscale_tab(s);
-
-    for(i=1; i<s->mb_num; i++){
-        if(qscale_table[ s->mb_index2xy[i] ] - qscale_table[ s->mb_index2xy[i-1] ] >2)
-            qscale_table[ s->mb_index2xy[i] ]= qscale_table[ s->mb_index2xy[i-1] ]+2;
-    }
-    for(i=s->mb_num-2; i>=0; i--){
-        if(qscale_table[ s->mb_index2xy[i] ] - qscale_table[ s->mb_index2xy[i+1] ] >2)
-            qscale_table[ s->mb_index2xy[i] ]= qscale_table[ s->mb_index2xy[i+1] ]+2;
-    }
-
-    if(s->codec_id != CODEC_ID_H263P){
-        for(i=1; i<s->mb_num; i++){
-            int mb_xy= s->mb_index2xy[i];
-
-            if(qscale_table[mb_xy] != qscale_table[s->mb_index2xy[i-1]] && (s->mb_type[mb_xy]&CANDIDATE_MB_TYPE_INTER4V)){
-                s->mb_type[mb_xy]|= CANDIDATE_MB_TYPE_INTER;
-            }
-        }
-    }
-}
-
-static const int dquant_code[5]= {1,0,9,2,3};
-
-/**
- * encodes a 8x8 block.
- * @param block the 8x8 block
- * @param n block index (0-3 are luma, 4-5 are chroma)
- */
-static void h263_encode_block(MpegEncContext * s, DCTELEM * block, int n)
-{
-    int level, run, last, i, j, last_index, last_non_zero, sign, slevel, code;
-    RLTable *rl;
-
-    rl = &ff_h263_rl_inter;
-    if (s->mb_intra && !s->h263_aic) {
-        /* DC coef */
-        level = block[0];
-        /* 255 cannot be represented, so we clamp */
-        if (level > 254) {
-            level = 254;
-            block[0] = 254;
-        }
-        /* 0 cannot be represented also */
-        else if (level < 1) {
-            level = 1;
-            block[0] = 1;
-        }
-        if (level == 128) //FIXME check rv10
-            put_bits(&s->pb, 8, 0xff);
-        else
-            put_bits(&s->pb, 8, level);
-        i = 1;
-    } else {
-        i = 0;
-        if (s->h263_aic && s->mb_intra)
-            rl = &rl_intra_aic;
-
-        if(s->alt_inter_vlc && !s->mb_intra){
-            int aic_vlc_bits=0;
-            int inter_vlc_bits=0;
-            int wrong_pos=-1;
-            int aic_code;
-
-            last_index = s->block_last_index[n];
-            last_non_zero = i - 1;
-            for (; i <= last_index; i++) {
-                j = s->intra_scantable.permutated[i];
-                level = block[j];
-                if (level) {
-                    run = i - last_non_zero - 1;
-                    last = (i == last_index);
-
-                    if(level<0) level= -level;
-
-                    code = get_rl_index(rl, last, run, level);
-                    aic_code = get_rl_index(&rl_intra_aic, last, run, level);
-                    inter_vlc_bits += rl->table_vlc[code][1]+1;
-                    aic_vlc_bits   += rl_intra_aic.table_vlc[aic_code][1]+1;
-
-                    if (code == rl->n) {
-                        inter_vlc_bits += 1+6+8-1;
-                    }
-                    if (aic_code == rl_intra_aic.n) {
-                        aic_vlc_bits += 1+6+8-1;
-                        wrong_pos += run + 1;
-                    }else
-                        wrong_pos += wrong_run[aic_code];
-                    last_non_zero = i;
-                }
-            }
-            i = 0;
-            if(aic_vlc_bits < inter_vlc_bits && wrong_pos > 63)
-                rl = &rl_intra_aic;
-        }
-    }
-
-    /* AC coefs */
-    last_index = s->block_last_index[n];
-    last_non_zero = i - 1;
-    for (; i <= last_index; i++) {
-        j = s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            run = i - last_non_zero - 1;
-            last = (i == last_index);
-            sign = 0;
-            slevel = level;
-            if (level < 0) {
-                sign = 1;
-                level = -level;
-            }
-            code = get_rl_index(rl, last, run, level);
-            put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-            if (code == rl->n) {
-              if(!CONFIG_FLV_ENCODER || s->h263_flv <= 1){
-                put_bits(&s->pb, 1, last);
-                put_bits(&s->pb, 6, run);
-
-                assert(slevel != 0);
-
-                if(level < 128)
-                    put_sbits(&s->pb, 8, slevel);
-                else{
-                    put_bits(&s->pb, 8, 128);
-                    put_sbits(&s->pb, 5, slevel);
-                    put_sbits(&s->pb, 6, slevel>>5);
-                }
-              }else{
-                    ff_flv2_encode_ac_esc(&s->pb, slevel, level, run, last);
-              }
-            } else {
-                put_bits(&s->pb, 1, sign);
-            }
-            last_non_zero = i;
-        }
-    }
-}
-
-/* Encode MV differences on H.263+ with Unrestricted MV mode */
-static void h263p_encode_umotion(MpegEncContext * s, int val)
-{
-    short sval = 0;
-    short i = 0;
-    short n_bits = 0;
-    short temp_val;
-    int code = 0;
-    int tcode;
-
-    if ( val == 0)
-        put_bits(&s->pb, 1, 1);
-    else if (val == 1)
-        put_bits(&s->pb, 3, 0);
-    else if (val == -1)
-        put_bits(&s->pb, 3, 2);
-    else {
-
-        sval = ((val < 0) ? (short)(-val):(short)val);
-        temp_val = sval;
-
-        while (temp_val != 0) {
-            temp_val = temp_val >> 1;
-            n_bits++;
-        }
-
-        i = n_bits - 1;
-        while (i > 0) {
-            tcode = (sval & (1 << (i-1))) >> (i-1);
-            tcode = (tcode << 1) | 1;
-            code = (code << 2) | tcode;
-            i--;
-        }
-        code = ((code << 1) | (val < 0)) << 1;
-        put_bits(&s->pb, (2*n_bits)+1, code);
-    }
-}
-
-void h263_encode_mb(MpegEncContext * s,
-                    DCTELEM block[6][64],
-                    int motion_x, int motion_y)
-{
-    int cbpc, cbpy, i, cbp, pred_x, pred_y;
-    int16_t pred_dc;
-    int16_t rec_intradc[6];
-    int16_t *dc_ptr[6];
-    const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1);
-
-    if (!s->mb_intra) {
-        /* compute cbp */
-        cbp= get_p_cbp(s, block, motion_x, motion_y);
-
-        if ((cbp | motion_x | motion_y | s->dquant | (s->mv_type - MV_TYPE_16X16)) == 0) {
-            /* skip macroblock */
-            put_bits(&s->pb, 1, 1);
-            if(interleaved_stats){
-                s->misc_bits++;
-                s->last_bits++;
-            }
-            s->skip_count++;
-
-            return;
-        }
-        put_bits(&s->pb, 1, 0);         /* mb coded */
-
-        cbpc = cbp & 3;
-        cbpy = cbp >> 2;
-        if(s->alt_inter_vlc==0 || cbpc!=3)
-            cbpy ^= 0xF;
-        if(s->dquant) cbpc+= 8;
-        if(s->mv_type==MV_TYPE_16X16){
-            put_bits(&s->pb,
-                    ff_h263_inter_MCBPC_bits[cbpc],
-                    ff_h263_inter_MCBPC_code[cbpc]);
-
-            put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
-            if(s->dquant)
-                put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
-
-            if(interleaved_stats){
-                s->misc_bits+= get_bits_diff(s);
-            }
-
-            /* motion vectors: 16x16 mode */
-            h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-
-            if (!s->umvplus) {
-                ff_h263_encode_motion_vector(s, motion_x - pred_x,
-                                                motion_y - pred_y, 1);
-            }
-            else {
-                h263p_encode_umotion(s, motion_x - pred_x);
-                h263p_encode_umotion(s, motion_y - pred_y);
-                if (((motion_x - pred_x) == 1) && ((motion_y - pred_y) == 1))
-                    /* To prevent Start Code emulation */
-                    put_bits(&s->pb,1,1);
-            }
-        }else{
-            put_bits(&s->pb,
-                    ff_h263_inter_MCBPC_bits[cbpc+16],
-                    ff_h263_inter_MCBPC_code[cbpc+16]);
-            put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
-            if(s->dquant)
-                put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
-
-            if(interleaved_stats){
-                s->misc_bits+= get_bits_diff(s);
-            }
-
-            for(i=0; i<4; i++){
-                /* motion vectors: 8x8 mode*/
-                h263_pred_motion(s, i, 0, &pred_x, &pred_y);
-
-                motion_x= s->current_picture.motion_val[0][ s->block_index[i] ][0];
-                motion_y= s->current_picture.motion_val[0][ s->block_index[i] ][1];
-                if (!s->umvplus) {
-                    ff_h263_encode_motion_vector(s, motion_x - pred_x,
-                                                    motion_y - pred_y, 1);
-                }
-                else {
-                    h263p_encode_umotion(s, motion_x - pred_x);
-                    h263p_encode_umotion(s, motion_y - pred_y);
-                    if (((motion_x - pred_x) == 1) && ((motion_y - pred_y) == 1))
-                        /* To prevent Start Code emulation */
-                        put_bits(&s->pb,1,1);
-                }
-            }
-        }
-
-        if(interleaved_stats){
-            s->mv_bits+= get_bits_diff(s);
-        }
-    } else {
-        assert(s->mb_intra);
-
-        cbp = 0;
-        if (s->h263_aic) {
-            /* Predict DC */
-            for(i=0; i<6; i++) {
-                int16_t level = block[i][0];
-                int scale;
-
-                if(i<4) scale= s->y_dc_scale;
-                else    scale= s->c_dc_scale;
-
-                pred_dc = h263_pred_dc(s, i, &dc_ptr[i]);
-                level -= pred_dc;
-                /* Quant */
-                if (level >= 0)
-                    level = (level + (scale>>1))/scale;
-                else
-                    level = (level - (scale>>1))/scale;
-
-                /* AIC can change CBP */
-                if (level == 0 && s->block_last_index[i] == 0)
-                    s->block_last_index[i] = -1;
-
-                if(!s->modified_quant){
-                    if (level < -127)
-                        level = -127;
-                    else if (level > 127)
-                        level = 127;
-                }
-
-                block[i][0] = level;
-                /* Reconstruction */
-                rec_intradc[i] = scale*level + pred_dc;
-                /* Oddify */
-                rec_intradc[i] |= 1;
-                //if ((rec_intradc[i] % 2) == 0)
-                //    rec_intradc[i]++;
-                /* Clipping */
-                if (rec_intradc[i] < 0)
-                    rec_intradc[i] = 0;
-                else if (rec_intradc[i] > 2047)
-                    rec_intradc[i] = 2047;
-
-                /* Update AC/DC tables */
-                *dc_ptr[i] = rec_intradc[i];
-                if (s->block_last_index[i] >= 0)
-                    cbp |= 1 << (5 - i);
-            }
-        }else{
-            for(i=0; i<6; i++) {
-                /* compute cbp */
-                if (s->block_last_index[i] >= 1)
-                    cbp |= 1 << (5 - i);
-            }
-        }
-
-        cbpc = cbp & 3;
-        if (s->pict_type == FF_I_TYPE) {
-            if(s->dquant) cbpc+=4;
-            put_bits(&s->pb,
-                ff_h263_intra_MCBPC_bits[cbpc],
-                ff_h263_intra_MCBPC_code[cbpc]);
-        } else {
-            if(s->dquant) cbpc+=8;
-            put_bits(&s->pb, 1, 0);     /* mb coded */
-            put_bits(&s->pb,
-                ff_h263_inter_MCBPC_bits[cbpc + 4],
-                ff_h263_inter_MCBPC_code[cbpc + 4]);
-        }
-        if (s->h263_aic) {
-            /* XXX: currently, we do not try to use ac prediction */
-            put_bits(&s->pb, 1, 0);     /* no AC prediction */
-        }
-        cbpy = cbp >> 2;
-        put_bits(&s->pb, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
-        if(s->dquant)
-            put_bits(&s->pb, 2, dquant_code[s->dquant+2]);
-
-        if(interleaved_stats){
-            s->misc_bits+= get_bits_diff(s);
-        }
-    }
-
-    for(i=0; i<6; i++) {
-        /* encode each block */
-        h263_encode_block(s, block[i], i);
-
-        /* Update INTRADC for decoding */
-        if (s->h263_aic && s->mb_intra) {
-            block[i][0] = rec_intradc[i];
-
-        }
-    }
-
-    if(interleaved_stats){
-        if (!s->mb_intra) {
-            s->p_tex_bits+= get_bits_diff(s);
-            s->f_count++;
-        }else{
-            s->i_tex_bits+= get_bits_diff(s);
-            s->i_count++;
-        }
-    }
-}
-
-void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
-{
-    int range, l, bit_size, sign, code, bits;
-
-    if (val == 0) {
-        /* zero vector */
-        code = 0;
-        put_bits(&s->pb, mvtab[code][1], mvtab[code][0]);
-    } else {
-        bit_size = f_code - 1;
-        range = 1 << bit_size;
-        /* modulo encoding */
-        l= INT_BIT - 6 - bit_size;
-        val = (val<<l)>>l;
-        sign = val>>31;
-        val= (val^sign)-sign;
-        sign&=1;
-
-        val--;
-        code = (val >> bit_size) + 1;
-        bits = val & (range - 1);
-
-        put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign);
-        if (bit_size > 0) {
-            put_bits(&s->pb, bit_size, bits);
-        }
-    }
-}
-
-static void init_mv_penalty_and_fcode(MpegEncContext *s)
-{
-    int f_code;
-    int mv;
-
-    for(f_code=1; f_code<=MAX_FCODE; f_code++){
-        for(mv=-MAX_MV; mv<=MAX_MV; mv++){
-            int len;
-
-            if(mv==0) len= mvtab[0][1];
-            else{
-                int val, bit_size, code;
-
-                bit_size = f_code - 1;
-
-                val=mv;
-                if (val < 0)
-                    val = -val;
-                val--;
-                code = (val >> bit_size) + 1;
-                if(code<33){
-                    len= mvtab[code][1] + 1 + bit_size;
-                }else{
-                    len= mvtab[32][1] + av_log2(code>>5) + 2 + bit_size;
-                }
-            }
-
-            mv_penalty[f_code][mv+MAX_MV]= len;
-        }
-    }
-
-    for(f_code=MAX_FCODE; f_code>0; f_code--){
-        for(mv=-(16<<f_code); mv<(16<<f_code); mv++){
-            fcode_tab[mv+MAX_MV]= f_code;
-        }
-    }
-
-    for(mv=0; mv<MAX_MV*2+1; mv++){
-        umv_fcode_tab[mv]= 1;
-    }
-}
-
-static void init_uni_h263_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab){
-    int slevel, run, last;
-
-    assert(MAX_LEVEL >= 64);
-    assert(MAX_RUN   >= 63);
-
-    for(slevel=-64; slevel<64; slevel++){
-        if(slevel==0) continue;
-        for(run=0; run<64; run++){
-            for(last=0; last<=1; last++){
-                const int index= UNI_MPEG4_ENC_INDEX(last, run, slevel+64);
-                int level= slevel < 0 ? -slevel : slevel;
-                int sign= slevel < 0 ? 1 : 0;
-                int bits, len, code;
-
-                len_tab[index]= 100;
-
-                /* ESC0 */
-                code= get_rl_index(rl, last, run, level);
-                bits= rl->table_vlc[code][0];
-                len=  rl->table_vlc[code][1];
-                bits=bits*2+sign; len++;
-
-                if(code!=rl->n && len < len_tab[index]){
-                    if(bits_tab) bits_tab[index]= bits;
-                    len_tab [index]= len;
-                }
-                /* ESC */
-                bits= rl->table_vlc[rl->n][0];
-                len = rl->table_vlc[rl->n][1];
-                bits=bits*2+last; len++;
-                bits=bits*64+run; len+=6;
-                bits=bits*256+(level&0xff); len+=8;
-
-                if(len < len_tab[index]){
-                    if(bits_tab) bits_tab[index]= bits;
-                    len_tab [index]= len;
-                }
-            }
-        }
-    }
-}
-
-void h263_encode_init(MpegEncContext *s)
-{
-    static int done = 0;
-
-    if (!done) {
-        done = 1;
-
-        init_rl(&ff_h263_rl_inter, ff_h263_static_rl_table_store[0]);
-        init_rl(&rl_intra_aic, ff_h263_static_rl_table_store[1]);
-
-        init_uni_h263_rl_tab(&rl_intra_aic, NULL, uni_h263_intra_aic_rl_len);
-        init_uni_h263_rl_tab(&ff_h263_rl_inter    , NULL, uni_h263_inter_rl_len);
-
-        init_mv_penalty_and_fcode(s);
-    }
-    s->me.mv_penalty= mv_penalty; //FIXME exact table for msmpeg4 & h263p
-
-    s->intra_ac_vlc_length     =s->inter_ac_vlc_length     = uni_h263_inter_rl_len;
-    s->intra_ac_vlc_last_length=s->inter_ac_vlc_last_length= uni_h263_inter_rl_len + 128*64;
-    if(s->h263_aic){
-        s->intra_ac_vlc_length     = uni_h263_intra_aic_rl_len;
-        s->intra_ac_vlc_last_length= uni_h263_intra_aic_rl_len + 128*64;
-    }
-    s->ac_esc_length= 7+1+6+8;
-
-    // use fcodes >1 only for mpeg4 & h263 & h263p FIXME
-    switch(s->codec_id){
-    case CODEC_ID_MPEG4:
-        s->fcode_tab= fcode_tab;
-        break;
-    case CODEC_ID_H263P:
-        if(s->umvplus)
-            s->fcode_tab= umv_fcode_tab;
-        if(s->modified_quant){
-            s->min_qcoeff= -2047;
-            s->max_qcoeff=  2047;
-        }else{
-            s->min_qcoeff= -127;
-            s->max_qcoeff=  127;
-        }
-        break;
-        //Note for mpeg4 & h263 the dc-scale table will be set per frame as needed later
-    case CODEC_ID_FLV1:
-        if (s->h263_flv > 1) {
-            s->min_qcoeff= -1023;
-            s->max_qcoeff=  1023;
-        } else {
-            s->min_qcoeff= -127;
-            s->max_qcoeff=  127;
-        }
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-        break;
-    default: //nothing needed - default table already set in mpegvideo.c
-        s->min_qcoeff= -127;
-        s->max_qcoeff=  127;
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-    }
-}
-
-void ff_h263_encode_mba(MpegEncContext *s)
-{
-    int i, mb_pos;
-
-    for(i=0; i<6; i++){
-        if(s->mb_num-1 <= ff_mba_max[i]) break;
-    }
-    mb_pos= s->mb_x + s->mb_width*s->mb_y;
-    put_bits(&s->pb, ff_mba_length[i], mb_pos);
-}
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
deleted file mode 100644
index a0596f6..0000000
--- a/libavcodec/ivi_common.c
+++ /dev/null
@@ -1,1000 +0,0 @@
-/*
- * common functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
- *
- * Copyright (c) 2009 Maxim Poliakovski
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * This file contains functions and data shared by both Indeo4 and
- * Indeo5 decoders.
- */
-
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "get_bits.h"
-#include "ivi_common.h"
-#include "libavutil/common.h"
-#include "ivi_dsp.h"
-
-extern const IVIHuffDesc ff_ivi_mb_huff_desc[8];  ///< static macroblock huffman tables
-extern const IVIHuffDesc ff_ivi_blk_huff_desc[8]; ///< static block huffman tables
-
-VLC ff_ivi_mb_vlc_tabs [8];
-VLC ff_ivi_blk_vlc_tabs[8];
-
-/**
- *  Reverses "nbits" bits of the value "val" and returns the result
- *  in the least significant bits.
- */
-static uint16_t inv_bits(uint16_t val, int nbits)
-{
-    uint16_t res;
-
-    if (nbits <= 8) {
-        res = av_reverse[val] >> (8-nbits);
-    } else
-        res = ((av_reverse[val & 0xFF] << 8) + (av_reverse[val >> 8])) >> (16-nbits);
-
-    return res;
-}
-
-int ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag)
-{
-    int         pos, i, j, codes_per_row, prefix, not_last_row;
-    uint16_t    codewords[256]; /* FIXME: move this temporal storage out? */
-    uint8_t     bits[256];
-
-    pos = 0; /* current position = 0 */
-
-    for (i = 0; i < cb->num_rows; i++) {
-        codes_per_row = 1 << cb->xbits[i];
-        not_last_row  = (i != cb->num_rows - 1);
-        prefix        = ((1 << i) - 1) << (cb->xbits[i] + not_last_row);
-
-        for (j = 0; j < codes_per_row; j++) {
-            if (pos >= 256) /* Some Indeo5 codebooks can have more than 256 */
-                break;      /* elements, but only 256 codes are allowed! */
-
-            bits[pos] = i + cb->xbits[i] + not_last_row;
-            if (bits[pos] > IVI_VLC_BITS)
-                return -1; /* invalid descriptor */
-
-            codewords[pos] = inv_bits((prefix | j), bits[pos]);
-            if (!bits[pos])
-                bits[pos] = 1;
-
-            pos++;
-        }//for j
-    }//for i
-
-    /* number of codewords = pos */
-    return init_vlc(vlc, IVI_VLC_BITS, pos, bits, 1, 1, codewords, 2, 2,
-                    (flag ? INIT_VLC_USE_NEW_STATIC : 0) | INIT_VLC_LE);
-}
-
-void ff_ivi_init_static_vlc(void)
-{
-    int i;
-    static VLC_TYPE table_data[8192 * 16][2];
-    static int initialized_vlcs = 0;
-
-    if (initialized_vlcs)
-        return;
-    for (i = 0; i < 8; i++) {
-        ff_ivi_mb_vlc_tabs[i].table = table_data + i * 2 * 8192;
-        ff_ivi_mb_vlc_tabs[i].table_allocated = 8192;
-        ff_ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i],  &ff_ivi_mb_vlc_tabs[i],  1);
-        ff_ivi_blk_vlc_tabs[i].table = table_data + (i * 2 + 1) * 8192;
-        ff_ivi_blk_vlc_tabs[i].table_allocated = 8192;
-        ff_ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i], &ff_ivi_blk_vlc_tabs[i], 1);
-    }
-    initialized_vlcs = 1;
-}
-
-int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
-                         IVIHuffTab *huff_tab, AVCodecContext *avctx)
-{
-    int         i, result;
-    IVIHuffDesc new_huff;
-
-    if (!desc_coded) {
-        /* select default table */
-        huff_tab->tab = (which_tab) ? &ff_ivi_blk_vlc_tabs[7]
-            : &ff_ivi_mb_vlc_tabs [7];
-    } else {
-        huff_tab->tab_sel = get_bits(gb, 3);
-        if (huff_tab->tab_sel == 7) {
-            /* custom huffman table (explicitly encoded) */
-            new_huff.num_rows = get_bits(gb, 4);
-
-            for (i = 0; i < new_huff.num_rows; i++)
-                new_huff.xbits[i] = get_bits(gb, 4);
-
-            /* Have we got the same custom table? Rebuild if not. */
-            if (ff_ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc)) {
-                ff_ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
-
-                if (huff_tab->cust_tab.table)
-                    free_vlc(&huff_tab->cust_tab);
-                result = ff_ivi_create_huff_from_desc(&huff_tab->cust_desc,
-                        &huff_tab->cust_tab, 0);
-                if (result) {
-                    av_log(avctx, AV_LOG_ERROR,
-                           "Error while initializing custom vlc table!\n");
-                    return -1;
-                }
-            }
-            huff_tab->tab = &huff_tab->cust_tab;
-        } else {
-            /* select one of predefined tables */
-            huff_tab->tab = (which_tab) ? &ff_ivi_blk_vlc_tabs[huff_tab->tab_sel]
-                : &ff_ivi_mb_vlc_tabs [huff_tab->tab_sel];
-        }
-    }
-
-    return 0;
-}
-
-int ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2)
-{
-    return    desc1->num_rows != desc2->num_rows
-           || memcmp(desc1->xbits, desc2->xbits, desc1->num_rows);
-}
-
-void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src)
-{
-    dst->num_rows = src->num_rows;
-    memcpy(dst->xbits, src->xbits, src->num_rows);
-}
-
-int av_cold ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg)
-{
-    int         p, b;
-    uint32_t    b_width, b_height, align_fac, width_aligned, height_aligned, buf_size;
-    IVIBandDesc *band;
-
-    ff_ivi_free_buffers(planes);
-
-    /* fill in the descriptor of the luminance plane */
-    planes[0].width     = cfg->pic_width;
-    planes[0].height    = cfg->pic_height;
-    planes[0].num_bands = cfg->luma_bands;
-
-    /* fill in the descriptors of the chrominance planes */
-    planes[1].width     = planes[2].width     = (cfg->pic_width  + 3) >> 2;
-    planes[1].height    = planes[2].height    = (cfg->pic_height + 3) >> 2;
-    planes[1].num_bands = planes[2].num_bands = cfg->chroma_bands;
-
-    for (p = 0; p < 3; p++) {
-        planes[p].bands = av_mallocz(planes[p].num_bands * sizeof(IVIBandDesc));
-        if (!planes[p].bands)
-            return AVERROR(ENOMEM);
-
-        /* select band dimensions: if there is only one band then it
-         *  has the full size, if there are several bands each of them
-         *  has only half size */
-        b_width  = planes[p].num_bands == 1 ? planes[p].width  : (planes[p].width  + 1) >> 1;
-        b_height = planes[p].num_bands == 1 ? planes[p].height : (planes[p].height + 1) >> 1;
-
-        /* luma   band buffers will be aligned on 16x16 (max macroblock size) */
-        /* chroma band buffers will be aligned on   8x8 (max macroblock size) */
-        align_fac       = p ? 8 : 16;
-        width_aligned   = FFALIGN(b_width , align_fac);
-        height_aligned  = FFALIGN(b_height, align_fac);
-        buf_size        = width_aligned * height_aligned * sizeof(int16_t);
-
-        for (b = 0; b < planes[p].num_bands; b++) {
-            band = &planes[p].bands[b]; /* select appropriate plane/band */
-            band->plane    = p;
-            band->band_num = b;
-            band->width    = b_width;
-            band->height   = b_height;
-            band->pitch    = width_aligned;
-            band->bufs[0]  = av_malloc(buf_size);
-            band->bufs[1]  = av_malloc(buf_size);
-            if (!band->bufs[0] || !band->bufs[1])
-                return AVERROR(ENOMEM);
-
-            /* allocate the 3rd band buffer for scalability mode */
-            if (cfg->luma_bands > 1) {
-                band->bufs[2] = av_malloc(buf_size);
-                if (!band->bufs[2])
-                    return AVERROR(ENOMEM);
-            }
-
-            planes[p].bands[0].blk_vlc.cust_desc.num_rows = 0; /* reset custom vlc */
-        }
-    }
-
-    return 0;
-}
-
-void av_cold ff_ivi_free_buffers(IVIPlaneDesc *planes)
-{
-    int p, b, t;
-
-    for (p = 0; p < 3; p++) {
-        for (b = 0; b < planes[p].num_bands; b++) {
-            av_freep(&planes[p].bands[b].bufs[0]);
-            av_freep(&planes[p].bands[b].bufs[1]);
-            av_freep(&planes[p].bands[b].bufs[2]);
-
-            if (planes[p].bands[b].blk_vlc.cust_tab.table)
-                free_vlc(&planes[p].bands[b].blk_vlc.cust_tab);
-            for (t = 0; t < planes[p].bands[b].num_tiles; t++)
-                av_freep(&planes[p].bands[b].tiles[t].mbs);
-            av_freep(&planes[p].bands[b].tiles);
-        }
-        av_freep(&planes[p].bands);
-    }
-}
-
-int av_cold ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height)
-{
-    int         p, b, x, y, x_tiles, y_tiles, t_width, t_height;
-    IVIBandDesc *band;
-    IVITile     *tile, *ref_tile;
-
-    for (p = 0; p < 3; p++) {
-        t_width  = !p ? tile_width  : (tile_width  + 3) >> 2;
-        t_height = !p ? tile_height : (tile_height + 3) >> 2;
-
-        if (!p && planes[0].num_bands == 4) {
-            t_width  >>= 1;
-            t_height >>= 1;
-        }
-
-        for (b = 0; b < planes[p].num_bands; b++) {
-            band = &planes[p].bands[b];
-            x_tiles = IVI_NUM_TILES(band->width, t_width);
-            y_tiles = IVI_NUM_TILES(band->height, t_height);
-            band->num_tiles = x_tiles * y_tiles;
-
-            av_freep(&band->tiles);
-            band->tiles = av_mallocz(band->num_tiles * sizeof(IVITile));
-            if (!band->tiles)
-                return AVERROR(ENOMEM);
-
-            tile = band->tiles;
-
-            /* use the first luma band as reference for motion vectors
-             * and quant */
-            ref_tile = planes[0].bands[0].tiles;
-
-            for (y = 0; y < band->height; y += t_height) {
-                for (x = 0; x < band->width; x += t_width) {
-                    tile->xpos     = x;
-                    tile->ypos     = y;
-                    tile->width    = FFMIN(band->width - x,  t_width);
-                    tile->height   = FFMIN(band->height - y, t_height);
-                    tile->is_empty = tile->data_size = 0;
-                    /* calculate number of macroblocks */
-                    tile->num_MBs  = IVI_MBs_PER_TILE(tile->width, tile->height,
-                                                      band->mb_size);
-
-                    av_freep(&tile->mbs);
-                    tile->mbs = av_malloc(tile->num_MBs * sizeof(IVIMbInfo));
-                    if (!tile->mbs)
-                        return AVERROR(ENOMEM);
-
-                    tile->ref_mbs = 0;
-                    if (p || b) {
-                        tile->ref_mbs = ref_tile->mbs;
-                        ref_tile++;
-                    }
-
-                    tile++;
-                }
-            }
-
-        }// for b
-    }// for p
-
-    return 0;
-}
-
-int ff_ivi_dec_tile_data_size(GetBitContext *gb)
-{
-    int    len;
-
-    len = 0;
-    if (get_bits1(gb)) {
-        len = get_bits(gb, 8);
-        if (len == 255)
-            len = get_bits_long(gb, 24);
-    }
-
-    /* align the bitstream reader on the byte boundary */
-    align_get_bits(gb);
-
-    return len;
-}
-
-int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
-{
-    int         mbn, blk, num_blocks, num_coeffs, blk_size, scan_pos, run, val,
-                pos, is_intra, mc_type, mv_x, mv_y, col_mask;
-    uint8_t     col_flags[8];
-    int32_t     prev_dc, trvec[64];
-    uint32_t    cbp, sym, lo, hi, quant, buf_offs, q;
-    IVIMbInfo   *mb;
-    RVMapDesc   *rvmap = band->rv_map;
-    void (*mc_with_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
-    void (*mc_no_delta_func)  (int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
-    const uint8_t   *base_tab, *scale_tab;
-
-    prev_dc = 0; /* init intra prediction for the DC coefficient */
-
-    blk_size   = band->blk_size;
-    col_mask   = blk_size - 1; /* column mask for tracking non-zero coeffs */
-    num_blocks = (band->mb_size != blk_size) ? 4 : 1; /* number of blocks per mb */
-    num_coeffs = blk_size * blk_size;
-    if (blk_size == 8) {
-        mc_with_delta_func = ff_ivi_mc_8x8_delta;
-        mc_no_delta_func   = ff_ivi_mc_8x8_no_delta;
-    } else {
-        mc_with_delta_func = ff_ivi_mc_4x4_delta;
-        mc_no_delta_func   = ff_ivi_mc_4x4_no_delta;
-    }
-
-    for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) {
-        is_intra = !mb->type;
-        cbp      = mb->cbp;
-        buf_offs = mb->buf_offs;
-
-        quant = av_clip(band->glob_quant + mb->q_delta, 0, 23);
-
-        base_tab  = is_intra ? band->intra_base  : band->inter_base;
-        scale_tab = is_intra ? band->intra_scale : band->inter_scale;
-
-        if (!is_intra) {
-            mv_x = mb->mv_x;
-            mv_y = mb->mv_y;
-            if (!band->is_halfpel) {
-                mc_type = 0; /* we have only fullpel vectors */
-            } else {
-                mc_type = ((mv_y & 1) << 1) | (mv_x & 1);
-                mv_x >>= 1;
-                mv_y >>= 1; /* convert halfpel vectors into fullpel ones */
-            }
-        }
-
-        for (blk = 0; blk < num_blocks; blk++) {
-            /* adjust block position in the buffer according to its number */
-            if (blk & 1) {
-                buf_offs += blk_size;
-            } else if (blk == 2) {
-                buf_offs -= blk_size;
-                buf_offs += blk_size * band->pitch;
-            }
-
-            if (cbp & 1) { /* block coded ? */
-                scan_pos = -1;
-                memset(trvec, 0, num_coeffs*sizeof(trvec[0])); /* zero transform vector */
-                memset(col_flags, 0, sizeof(col_flags));      /* zero column flags */
-
-                while (scan_pos <= num_coeffs) {
-                    sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
-                    if (sym == rvmap->eob_sym)
-                        break; /* End of block */
-
-                    if (sym == rvmap->esc_sym) { /* Escape - run/val explicitly coded using 3 vlc codes */
-                        run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;
-                        lo  = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
-                        hi  = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
-                        val = IVI_TOSIGNED((hi << 6) | lo); /* merge them and convert into signed val */
-                    } else {
-                        run = rvmap->runtab[sym];
-                        val = rvmap->valtab[sym];
-                    }
-
-                    /* de-zigzag and dequantize */
-                    scan_pos += run;
-                    if (scan_pos >= num_coeffs)
-                        break;
-                    pos = band->scan[scan_pos];
-
-                    if (IVI_DEBUG && !val)
-                        av_log(NULL, AV_LOG_ERROR, "Val = 0 encountered!\n");
-
-                    q = (base_tab[pos] * scale_tab[quant]) >> 8;
-                    if (q > 1)
-                        val = val * q + FFSIGN(val) * ((q >> 1) - (q & 1));
-                    trvec[pos] = val;
-                    col_flags[pos & col_mask] |= !!val; /* track columns containing non-zero coeffs */
-                }// while
-
-                if (scan_pos >= num_coeffs && sym != rvmap->eob_sym)
-                    return -1; /* corrupt block data */
-
-                /* undoing DC coeff prediction for intra-blocks */
-                if (is_intra && band->is_2d_trans) {
-                    prev_dc      += trvec[0];
-                    trvec[0]      = prev_dc;
-                    col_flags[0] |= !!prev_dc;
-                }
-
-                /* apply inverse transform */
-                band->inv_transform(trvec, band->buf + buf_offs,
-                                    band->pitch, col_flags);
-
-                /* apply motion compensation */
-                if (!is_intra)
-                    mc_with_delta_func(band->buf + buf_offs,
-                                       band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
-                                       band->pitch, mc_type);
-            } else {
-                /* block not coded */
-                /* for intra blocks apply the dc slant transform */
-                /* for inter - perform the motion compensation without delta */
-                if (is_intra && band->dc_transform) {
-                    band->dc_transform(&prev_dc, band->buf + buf_offs,
-                                       band->pitch, blk_size);
-                } else
-                    mc_no_delta_func(band->buf + buf_offs,
-                                     band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
-                                     band->pitch, mc_type);
-            }
-
-            cbp >>= 1;
-        }// for blk
-    }// for mbn
-
-    align_get_bits(gb);
-
-    return 0;
-}
-
-void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
-                               IVITile *tile, int32_t mv_scale)
-{
-    int             x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type;
-    int             offs, mb_offset, row_offset;
-    IVIMbInfo       *mb, *ref_mb;
-    const int16_t   *src;
-    int16_t         *dst;
-    void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch,
-                             int mc_type);
-
-    offs       = tile->ypos * band->pitch + tile->xpos;
-    mb         = tile->mbs;
-    ref_mb     = tile->ref_mbs;
-    row_offset = band->mb_size * band->pitch;
-    need_mc    = 0; /* reset the mc tracking flag */
-
-    for (y = tile->ypos; y < (tile->ypos + tile->height); y += band->mb_size) {
-        mb_offset = offs;
-
-        for (x = tile->xpos; x < (tile->xpos + tile->width); x += band->mb_size) {
-            mb->xpos     = x;
-            mb->ypos     = y;
-            mb->buf_offs = mb_offset;
-
-            mb->type = 1; /* set the macroblocks type = INTER */
-            mb->cbp  = 0; /* all blocks are empty */
-
-            if (!band->qdelta_present && !band->plane && !band->band_num) {
-                mb->q_delta = band->glob_quant;
-                mb->mv_x    = 0;
-                mb->mv_y    = 0;
-            }
-
-            if (band->inherit_qdelta && ref_mb)
-                mb->q_delta = ref_mb->q_delta;
-
-            if (band->inherit_mv) {
-                /* motion vector inheritance */
-                if (mv_scale) {
-                    mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale);
-                    mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale);
-                } else {
-                    mb->mv_x = ref_mb->mv_x;
-                    mb->mv_y = ref_mb->mv_y;
-                }
-                need_mc |= mb->mv_x || mb->mv_y; /* tracking non-zero motion vectors */
-            }
-
-            mb++;
-            if (ref_mb)
-                ref_mb++;
-            mb_offset += band->mb_size;
-        } // for x
-        offs += row_offset;
-    } // for y
-
-    if (band->inherit_mv && need_mc) { /* apply motion compensation if there is at least one non-zero motion vector */
-        num_blocks = (band->mb_size != band->blk_size) ? 4 : 1; /* number of blocks per mb */
-        mc_no_delta_func = (band->blk_size == 8) ? ff_ivi_mc_8x8_no_delta
-                                                 : ff_ivi_mc_4x4_no_delta;
-
-        for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) {
-            mv_x = mb->mv_x;
-            mv_y = mb->mv_y;
-            if (!band->is_halfpel) {
-                mc_type = 0; /* we have only fullpel vectors */
-            } else {
-                mc_type = ((mv_y & 1) << 1) | (mv_x & 1);
-                mv_x >>= 1;
-                mv_y >>= 1; /* convert halfpel vectors into fullpel ones */
-            }
-
-            for (blk = 0; blk < num_blocks; blk++) {
-                /* adjust block position in the buffer according with its number */
-                offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch);
-                mc_no_delta_func(band->buf + offs,
-                                 band->ref_buf + offs + mv_y * band->pitch + mv_x,
-                                 band->pitch, mc_type);
-            }
-        }
-    } else {
-        /* copy data from the reference tile into the current one */
-        src = band->ref_buf + tile->ypos * band->pitch + tile->xpos;
-        dst = band->buf     + tile->ypos * band->pitch + tile->xpos;
-        for (y = 0; y < tile->height; y++) {
-            memcpy(dst, src, tile->width*sizeof(band->buf[0]));
-            src += band->pitch;
-            dst += band->pitch;
-        }
-    }
-}
-
-
-#if IVI_DEBUG
-uint16_t ivi_calc_band_checksum (IVIBandDesc *band)
-{
-    int         x, y;
-    int16_t     *src, checksum;
-
-    src = band->buf;
-    checksum = 0;
-
-    for (y = 0; y < band->height; src += band->pitch, y++)
-        for (x = 0; x < band->width; x++)
-            checksum += src[x];
-
-    return checksum;
-}
-
-int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch)
-{
-    int         x, y, result;
-    uint8_t     t1, t2;
-    int16_t    *src;
-
-    src = band->buf;
-    result = 0;
-
-    for (y = 0; y < band->height; src += band->pitch, y++) {
-        for (x = 0; x < band->width; x++) {
-            t1 = av_clip(src[x] + 128, 0, 255);
-            t2 = ref[x];
-            if (t1 != t2) {
-                av_log(NULL, AV_LOG_ERROR, "Data mismatch: row %d, column %d\n",
-                       y / band->blk_size, x / band->blk_size);
-                result = -1;
-            }
-        }
-        ref += pitch;
-    }
-
-    return result;
-}
-#endif
-
-void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch)
-{
-    int             x, y;
-    const int16_t   *src  = plane->bands[0].buf;
-    uint32_t        pitch = plane->bands[0].pitch;
-
-    for (y = 0; y < plane->height; y++) {
-        for (x = 0; x < plane->width; x++)
-            dst[x] = av_clip_uint8(src[x] + 128);
-        src += pitch;
-        dst += dst_pitch;
-    }
-}
-
-
-/**
- * These are 2x8 predefined Huffman codebooks for coding macroblock/block
- * signals. They are specified using "huffman descriptors" in order to
- * avoid huge static tables. The decoding tables will be generated at
- * startup from these descriptors.
- */
-const IVIHuffDesc ff_ivi_mb_huff_desc[8] = {
-    {8,  {0, 4, 5, 4, 4, 4, 6, 6}},
-    {12, {0, 2, 2, 3, 3, 3, 3, 5, 3, 2, 2, 2}},
-    {12, {0, 2, 3, 4, 3, 3, 3, 3, 4, 3, 2, 2}},
-    {12, {0, 3, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2}},
-    {13, {0, 4, 4, 3, 3, 3, 3, 2, 3, 3, 2, 1, 1}},
-    {9,  {0, 4, 4, 4, 4, 3, 3, 3, 2}},
-    {10, {0, 4, 4, 4, 4, 3, 3, 2, 2, 2}},
-    {12, {0, 4, 4, 4, 3, 3, 2, 3, 2, 2, 2, 2}}
-};
-
-const IVIHuffDesc ff_ivi_blk_huff_desc[8] = {
-    {10, {1, 2, 3, 4, 4, 7, 5, 5, 4, 1}},
-    {11, {2, 3, 4, 4, 4, 7, 5, 4, 3, 3, 2}},
-    {12, {2, 4, 5, 5, 5, 5, 6, 4, 4, 3, 1, 1}},
-    {13, {3, 3, 4, 4, 5, 6, 6, 4, 4, 3, 2, 1, 1}},
-    {11, {3, 4, 4, 5, 5, 5, 6, 5, 4, 2, 2}},
-    {13, {3, 4, 5, 5, 5, 5, 6, 4, 3, 3, 2, 1, 1}},
-    {13, {3, 4, 5, 5, 5, 6, 5, 4, 3, 3, 2, 1, 1}},
-    {9,  {3, 4, 4, 5, 5, 5, 6, 5, 5}}
-};
-
-
-/**
- *  Run-value (RLE) tables.
- */
-const RVMapDesc ff_ivi_rvmap_tabs[9] = {
-{   /* MapTab0 */
-    5, /* eob_sym */
-    2, /* esc_sym */
-    /* run table */
-    {1,  1,  0,  1,  1,  0,  1,  1,  2,  2,  1,  1,  1,  1,  3,  3,
-     1,  1,  2,  2,  1,  1,  4,  4,  1,  1,  1,  1,  2,  2,  5,  5,
-     1,  1,  3,  3,  1,  1,  6,  6,  1,  2,  1,  2,  7,  7,  1,  1,
-     8,  8,  1,  1,  4,  2,  1,  4,  2,  1,  3,  3,  1,  1,  1,  9,
-     9,  1,  2,  1,  2,  1,  5,  5,  1,  1, 10, 10,  1,  1,  3,  3,
-     2,  2,  1,  1, 11, 11,  6,  4,  4,  1,  6,  1,  2,  1,  2, 12,
-     8,  1, 12,  7,  8,  7,  1, 16,  1, 16,  1,  3,  3, 13,  1, 13,
-     2,  2,  1, 15,  1,  5, 14, 15,  1,  5, 14,  1, 17,  8, 17,  8,
-     1,  4,  4,  2,  2,  1, 25, 25, 24, 24,  1,  3,  1,  3,  1,  8,
-     6,  7,  6,  1, 18,  8, 18,  1,  7, 23,  2,  2, 23,  1,  1, 21,
-    22,  9,  9, 22, 19,  1, 21,  5, 19,  5,  1, 33, 20, 33, 20,  8,
-     4,  4,  1, 32,  2,  2,  8,  3, 32, 26,  3,  1,  7,  7, 26,  6,
-     1,  6,  1,  1, 16,  1, 10,  1, 10,  2, 16, 29, 28,  2, 29, 28,
-     1, 27,  5,  8,  5, 27,  1,  8,  3,  7,  3, 31, 41, 31,  1, 41,
-     6,  1,  6,  7,  4,  4,  1,  1,  2,  1,  2, 11, 34, 30, 11,  1,
-    30, 15, 15, 34, 36, 40, 36, 40, 35, 35, 37, 37, 39, 39, 38, 38},
-
-    /* value table */
-    { 1,  -1,   0,   2,  -2,   0,   3,  -3,   1,  -1,   4,  -4,   5,  -5,   1,  -1,
-      6,  -6,   2,  -2,   7,  -7,   1,  -1,   8,  -8,   9,  -9,   3,  -3,   1,  -1,
-     10, -10,   2,  -2,  11, -11,   1,  -1,  12,   4, -12,  -4,   1,  -1,  13, -13,
-      1,  -1,  14, -14,   2,   5,  15,  -2,  -5, -15,  -3,   3,  16, -16,  17,   1,
-     -1, -17,   6,  18,  -6, -18,   2,  -2,  19, -19,   1,  -1,  20, -20,   4,  -4,
-      7,  -7,  21, -21,   1,  -1,   2,   3,  -3,  22,  -2, -22,   8,  23,  -8,   1,
-      2, -23,  -1,   2,  -2,  -2,  24,   1, -24,  -1,  25,   5,  -5,   1, -25,  -1,
-      9,  -9,  26,   1, -26,   3,   1,  -1,  27,  -3,  -1, -27,   1,   3,  -1,  -3,
-     28,  -4,   4,  10, -10, -28,   1,  -1,   1,  -1,  29,   6, -29,  -6,  30,  -4,
-      3,   3,  -3, -30,   1,   4,  -1,  31,  -3,   1,  11, -11,  -1, -31,  32,  -1,
-     -1,   2,  -2,   1,   1, -32,   1,   4,  -1,  -4,  33,  -1,   1,   1,  -1,   5,
-      5,  -5, -33,  -1, -12,  12,  -5,  -7,   1,   1,   7,  34,   4,  -4,  -1,   4,
-    -34,  -4,  35,  36,  -2, -35,  -2, -36,   2,  13,   2,  -1,   1, -13,   1,  -1,
-     37,   1,  -5,   6,   5,  -1,  38,  -6,  -8,   5,   8,  -1,   1,   1, -37,  -1,
-      5,  39,  -5,  -5,   6,  -6, -38, -39, -14,  40,  14,   2,   1,   1,  -2, -40,
-     -1,  -2,   2,  -1,  -1,  -1,   1,   1,   1,  -1,   1,  -1,   1,  -1,   1,  -1}
-},{
-    /* MapTab1 */
-    0,  /* eob_sym */
-    38, /* esc_sym */
-    /* run table */
-    {0,  1,  1,  2,  2,  3,  3,  4,  4,  5,  5,  6,  8,  6,  8,  7,
-     7,  9,  9, 10, 10, 11, 11,  1, 12,  1, 12, 13, 13, 16, 14, 16,
-    14, 15, 15, 17, 17, 18,  0, 18, 19, 20, 21, 19, 22, 21, 20, 22,
-    25, 24,  2, 25, 24, 23, 23,  2, 26, 28, 26, 28, 29, 27, 29, 27,
-    33, 33,  1, 32,  1,  3, 32, 30, 36,  3, 36, 30, 31, 31, 35, 34,
-    37, 41, 34, 35, 37,  4, 41,  4, 49,  8,  8, 49, 40, 38,  5, 38,
-    40, 39,  5, 39, 42, 43, 42,  7, 57,  6, 43, 44,  6, 50,  7, 44,
-    57, 48, 50, 48, 45, 45, 46, 47, 51, 46, 47, 58,  1, 51, 58,  1,
-    52, 59, 53,  9, 52, 55, 55, 59, 53, 56, 54, 56, 54,  9, 64, 64,
-    60, 63, 60, 63, 61, 62, 61, 62,  2, 10,  2, 10, 11,  1, 11, 13,
-    12,  1, 12, 13, 16, 16,  8,  8, 14,  3,  3, 15, 14, 15,  4,  4,
-     1, 17, 17,  5,  1,  7,  7,  5,  6,  1,  2,  2,  6, 22,  1, 25,
-    21, 22,  8, 24,  1, 21, 25, 24,  8, 18, 18, 23,  9, 20, 23, 33,
-    29, 33, 20,  1, 19,  1, 29, 36,  9, 36, 19, 41, 28, 57, 32,  3,
-    28,  3,  1, 27, 49, 49,  1, 32, 26, 26,  2,  4,  4,  7, 57, 41,
-     2,  7, 10,  5, 37, 16, 10, 27,  8,  8, 13, 16, 37, 13,  1,  5},
-
-    /* value table */
-    {0,   1,  -1,   1,  -1,   1,  -1,   1,  -1,   1,  -1,   1,   1,  -1,  -1,   1,
-    -1,   1,  -1,   1,  -1,   1,  -1,   2,   1,  -2,  -1,   1,  -1,   1,   1,  -1,
-    -1,   1,  -1,   1,  -1,   1,   0,  -1,   1,   1,   1,  -1,   1,  -1,  -1,  -1,
-     1,   1,   2,  -1,  -1,   1,  -1,  -2,   1,   1,  -1,  -1,   1,   1,  -1,  -1,
-     1,  -1,   3,   1,  -3,   2,  -1,   1,   1,  -2,  -1,  -1,  -1,   1,   1,   1,
-     1,   1,  -1,  -1,  -1,   2,  -1,  -2,   1,   2,  -2,  -1,   1,   1,   2,  -1,
-    -1,   1,  -2,  -1,   1,   1,  -1,   2,   1,   2,  -1,   1,  -2,  -1,  -2,  -1,
-    -1,   1,   1,  -1,   1,  -1,   1,   1,   1,  -1,  -1,   1,   4,  -1,  -1,  -4,
-     1,   1,   1,   2,  -1,  -1,   1,  -1,  -1,   1,  -1,  -1,   1,  -2,   1,  -1,
-     1,   1,  -1,  -1,   1,   1,  -1,  -1,   3,   2,  -3,  -2,   2,   5,  -2,   2,
-     2,  -5,  -2,  -2,  -2,   2,  -3,   3,   2,   3,  -3,   2,  -2,  -2,   3,  -3,
-     6,   2,  -2,   3,  -6,   3,  -3,  -3,   3,   7,  -4,   4,  -3,   2,  -7,   2,
-     2,  -2,  -4,   2,   8,  -2,  -2,  -2,   4,   2,  -2,   2,   3,   2,  -2,  -2,
-     2,   2,  -2,  -8,  -2,   9,  -2,   2,  -3,  -2,   2,  -2,   2,   2,   2,   4,
-    -2,  -4,  10,   2,   2,  -2,  -9,  -2,   2,  -2,   5,   4,  -4,   4,  -2,   2,
-    -5,  -4,  -3,   4,   2,  -3,   3,  -2,  -5,   5,   3,   3,  -2,  -3, -10,  -4}
-},{
-    /* MapTab2 */
-    2,  /* eob_sym */
-    11, /* esc_sym */
-    /* run table */
-    {1,  1,  0,  2,  2,  1,  1,  3,  3,  4,  4,  0,  1,  1,  5,  5,
-     2,  2,  6,  6,  7,  7,  1,  8,  1,  8,  3,  3,  9,  9,  1,  2,
-     2,  1,  4, 10,  4, 10, 11, 11,  1,  5, 12, 12,  1,  5, 13, 13,
-     3,  3,  6,  6,  2,  2, 14, 14, 16, 16, 15,  7, 15,  8,  8,  7,
-     1,  1, 17, 17,  4,  4,  1,  1, 18, 18,  2,  2,  5,  5, 25,  3,
-     9,  3, 25,  9, 19, 24, 19, 24,  1, 21, 20,  1, 21, 22, 20, 22,
-    23, 23,  8,  6, 33,  6,  8, 33,  7,  7, 26, 26,  1, 32,  1, 32,
-    28,  4, 28, 10, 29, 27, 27, 10, 41,  4, 29,  2,  2, 41, 36, 31,
-    49, 31, 34, 30, 34, 36, 30, 35,  1, 49, 11,  5, 35, 11,  1,  3,
-     3,  5, 37, 37,  8, 40,  8, 40, 12, 12, 42, 42,  1, 38, 16, 57,
-     1,  6, 16, 39, 38,  6,  7,  7, 13, 13, 39, 43,  2, 43, 57,  2,
-    50,  9, 44,  9, 50,  4, 15, 48, 44,  4,  1, 15, 48, 14, 14,  1,
-    45, 45,  8,  3,  5,  8, 51, 47,  3, 46, 46, 47,  5, 51,  1, 17,
-    17, 58,  1, 58,  2, 52, 52,  2, 53,  7, 59,  6,  6, 56, 53, 55,
-     7, 55,  1, 54, 59, 56, 54, 10,  1, 10,  4, 60,  1, 60,  8,  4,
-     8, 64, 64, 61,  1, 63,  3, 63, 62, 61,  5, 11,  5,  3, 11, 62},
-
-    /* value table */
-    { 1,  -1,   0,   1,  -1,   2,  -2,   1,  -1,   1,  -1,   0,   3,  -3,   1,  -1,
-      2,  -2,   1,  -1,   1,  -1,   4,   1,  -4,  -1,   2,  -2,   1,  -1,   5,   3,
-     -3,  -5,   2,   1,  -2,  -1,   1,  -1,   6,   2,   1,  -1,  -6,  -2,   1,  -1,
-      3,  -3,   2,  -2,   4,  -4,   1,  -1,   1,  -1,   1,   2,  -1,   2,  -2,  -2,
-      7,  -7,   1,  -1,   3,  -3,   8,  -8,   1,  -1,   5,  -5,   3,  -3,   1,   4,
-      2,  -4,  -1,  -2,   1,   1,  -1,  -1,   9,   1,   1,  -9,  -1,   1,  -1,  -1,
-      1,  -1,   3,  -3,   1,   3,  -3,  -1,   3,  -3,   1,  -1,  10,   1, -10,  -1,
-      1,   4,  -1,   2,   1,  -1,   1,  -2,   1,  -4,  -1,   6,  -6,  -1,   1,   1,
-      1,  -1,   1,   1,  -1,  -1,  -1,   1,  11,  -1,  -2,   4,  -1,   2, -11,   5,
-     -5,  -4,  -1,   1,   4,   1,  -4,  -1,  -2,   2,   1,  -1,  12,   1,  -2,   1,
-    -12,   4,   2,   1,  -1,  -4,   4,  -4,   2,  -2,  -1,   1,   7,  -1,  -1,  -7,
-     -1,  -3,   1,   3,   1,   5,   2,   1,  -1,  -5,  13,  -2,  -1,   2,  -2, -13,
-      1,  -1,   5,   6,   5,  -5,   1,   1,  -6,   1,  -1,  -1,  -5,  -1,  14,   2,
-     -2,   1, -14,  -1,   8,   1,  -1,  -8,   1,   5,   1,   5,  -5,   1,  -1,   1,
-     -5,  -1,  15,   1,  -1,  -1,  -1,   3, -15,  -3,   6,   1,  16,  -1,   6,  -6,
-     -6,   1,  -1,   1, -16,   1,   7,  -1,   1,  -1,  -6,  -3,   6,  -7,   3,  -1}
-},{
-    /* MapTab3 */
-    0,  /* eob_sym */
-    35, /* esc_sym */
-    /* run table */
-    {0,  1,  1,  2,  2,  3,  3,  4,  4,  1,  1,  5,  5,  6,  6,  7,
-     7,  8,  8,  9,  9,  2,  2, 10, 10,  1,  1, 11, 11, 12, 12,  3,
-     3, 13, 13,  0, 14, 14, 16, 15, 16, 15,  4,  4, 17,  1, 17,  1,
-     5,  5, 18, 18,  2,  2,  6,  6,  8, 19,  7,  8,  7, 19, 20, 20,
-    21, 21, 22, 24, 22, 24, 23, 23,  1,  1, 25, 25,  3,  3, 26, 26,
-     9,  9, 27, 27, 28, 28, 33, 29,  4, 33, 29,  1,  4,  1, 32, 32,
-     2,  2, 31, 10, 30, 10, 30, 31, 34, 34,  5,  5, 36, 36, 35, 41,
-    35, 11, 41, 11, 37,  1,  8,  8, 37,  6,  1,  6, 40,  7,  7, 40,
-    12, 38, 12, 39, 39, 38, 49, 13, 49, 13,  3, 42,  3, 42, 16, 16,
-    43, 43, 14, 14,  1,  1, 44, 15, 44, 15,  2,  2, 57, 48, 50, 48,
-    57, 50,  4, 45, 45,  4, 46, 47, 47, 46,  1, 51,  1, 17, 17, 51,
-     8,  9,  9,  5, 58,  8, 58,  5, 52, 52, 55, 56, 53, 56, 55, 59,
-    59, 53, 54,  1,  6, 54,  7,  7,  6,  1,  2,  3,  2,  3, 64, 60,
-    60, 10, 10, 64, 61, 62, 61, 63,  1, 63, 62,  1, 18, 24, 18,  4,
-    25,  4,  8, 21, 21,  1, 24, 22, 25, 22,  8, 11, 19, 11, 23,  1,
-    20, 23, 19, 20,  5, 12,  5,  1, 16,  2, 12, 13,  2, 13,  1, 16},
-
-    /* value table */
-    { 0,   1,  -1,   1,  -1,   1,  -1,   1,  -1,   2,  -2,   1,  -1,   1,  -1,   1,
-     -1,   1,  -1,   1,  -1,   2,  -2,   1,  -1,   3,  -3,   1,  -1,   1,  -1,   2,
-     -2,   1,  -1,   0,   1,  -1,   1,   1,  -1,  -1,   2,  -2,   1,   4,  -1,  -4,
-      2,  -2,   1,  -1,  -3,   3,   2,  -2,   2,   1,   2,  -2,  -2,  -1,   1,  -1,
-      1,  -1,   1,   1,  -1,  -1,   1,  -1,   5,  -5,   1,  -1,   3,  -3,   1,  -1,
-      2,  -2,   1,  -1,   1,  -1,   1,   1,   3,  -1,  -1,   6,  -3,  -6,  -1,   1,
-      4,  -4,   1,   2,   1,  -2,  -1,  -1,   1,  -1,   3,  -3,   1,  -1,   1,   1,
-     -1,   2,  -1,  -2,   1,   7,  -3,   3,  -1,   3,  -7,  -3,   1,  -3,   3,  -1,
-      2,   1,  -2,   1,  -1,  -1,   1,   2,  -1,  -2,  -4,  -1,   4,   1,   2,  -2,
-      1,  -1,  -2,   2,   8,  -8,  -1,   2,   1,  -2,  -5,   5,   1,  -1,  -1,   1,
-     -1,   1,   4,  -1,   1,  -4,  -1,  -1,   1,   1,   9,   1,  -9,   2,  -2,  -1,
-     -4,   3,  -3,  -4,  -1,   4,   1,   4,   1,  -1,   1,  -1,   1,   1,  -1,   1,
-     -1,  -1,  -1,  10,   4,   1,   4,  -4,  -4, -10,   6,   5,  -6,  -5,   1,  -1,
-      1,   3,  -3,  -1,   1,  -1,  -1,  -1,  11,   1,   1, -11,  -2,  -2,   2,   5,
-     -2,  -5,  -5,   2,  -2,  12,   2,  -2,   2,   2,   5,  -3,  -2,   3,  -2, -12,
-     -2,   2,   2,   2,  -5,   3,   5,  13,  -3,   7,  -3,  -3,  -7,   3, -13,   3}
-},{
-    /* MapTab4 */
-    0,  /* eob_sym */
-    34, /* esc_sym */
-    /* run table */
-    {0,  1,  1,  1,  2,  2,  1,  3,  3,  1,  1,  1,  4,  4,  1,  5,
-     2,  1,  5,  2,  1,  1,  6,  6,  1,  1,  1,  1,  1,  7,  3,  1,
-     2,  3,  0,  1,  2,  7,  1,  1,  1,  8,  1,  1,  8,  1,  1,  1,
-     9,  1,  9,  1,  2,  1,  1,  2,  1,  1, 10,  4,  1, 10,  1,  4,
-     1,  1,  1,  1,  1,  3,  1,  1,  1,  3,  2,  1,  5,  1,  1,  1,
-     2,  5,  1, 11,  1, 11,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-     2,  1,  6,  1,  6,  1,  1,  2,  1,  1,  1,  1,  1,  1,  1, 12,
-     3,  1, 12,  1,  1,  1,  2,  1,  1,  3,  1,  1,  1,  1,  1,  1,
-     4,  1,  1,  1,  2,  1,  1,  4,  1,  1,  1,  1,  1,  1,  2,  1,
-     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  3,  1,  2,  1,  1,  5,
-     1,  1,  1,  1,  1,  7,  1,  7,  1,  1,  2,  3,  1,  1,  1,  1,
-     5,  1,  1,  1,  1,  1,  1,  2, 13,  1,  1,  1,  1,  1,  1,  1,
-     1,  1,  1,  1,  1,  1,  1,  1, 13,  2,  1,  1,  4,  1,  1,  1,
-     3,  1,  6,  1,  1,  1, 14,  1,  1,  1,  1,  1, 14,  6,  1,  1,
-     1,  1, 15,  2,  4,  1,  2,  3, 15,  1,  1,  1,  8,  1,  1,  8,
-     1,  1,  1,  1,  1,  1,  1,  1,  2,  1,  1,  1,  1,  1,  1,  1},
-
-    /* value table */
-    { 0,   1,  -1,   2,   1,  -1,  -2,   1,  -1,   3,  -3,   4,   1,  -1,  -4,   1,
-      2,   5,  -1,  -2,  -5,   6,   1,  -1,  -6,   7,  -7,   8,  -8,   1,   2,   9,
-      3,  -2,   0,  -9,  -3,  -1,  10, -10,  11,   1, -11,  12,  -1, -12,  13, -13,
-      1,  14,  -1, -14,   4,  15, -15,  -4,  16, -16,   1,   2,  17,  -1, -17,  -2,
-     18, -18,  19, -19,  20,   3, -20,  21, -21,  -3,   5,  22,   2, -22, -23,  23,
-     -5,  -2,  24,   1, -24,  -1,  25, -25,  26, -26, -27,  27,  28,  29, -28, -29,
-      6,  30,   2, -31,  -2, -30,  31,  -6, -32,  32,  33, -33,  34, -35, -34,   1,
-      4, -36,  -1,  35,  37,  36,   7, -37,  38,  -4, -38,  39,  41,  40, -40, -39,
-      3,  42, -43, -41,  -7, -42,  43,  -3,  44, -44,  45, -45,  46,  47,   8, -47,
-    -48, -46,  50, -50,  48,  49,  51, -49,  52, -52,   5, -51,  -8, -53,  53,   3,
-    -56,  56,  55,  54, -54,   2,  60,  -2, -55,  58,   9,  -5,  59,  57, -57, -63,
-     -3, -58, -60, -61,  61, -59, -62,  -9,   1,  64,  62,  69, -64,  63,  65, -67,
-    -68,  66, -65,  68, -66, -69,  67, -70,  -1,  10,  71, -71,   4,  73,  72,  70,
-      6, -76,  -3,  74, -78, -74,   1,  78,  80, -72, -75,  76,  -1,   3, -73,  79,
-     75,  77,   1,  11,  -4, -79, -10,  -6,  -1, -77, -83, -80,   2,  81, -84,  -2,
-     83, -81,  82, -82,  84, -87, -86,  85, -11, -85,  86, -89,  87, -88,  88,  89}
-},{
-    /* MapTab5 */
-    2,  /* eob_sym */
-    33, /* esc_sym */
-    /* run table */
-    {1,  1,  0,  2,  1,  2,  1,  3,  3,  1,  1,  4,  4,  2,  2,  1,
-     1,  5,  5,  6,  1,  6,  1,  7,  7,  3,  3,  2,  8,  2,  8,  1,
-     1,  0,  9,  9,  1,  1, 10,  4, 10,  4, 11, 11,  2,  1,  2,  1,
-    12, 12,  3,  3,  1,  1, 13,  5,  5, 13, 14,  1,  1, 14,  2,  2,
-     6,  6, 15,  1,  1, 15, 16,  4,  7, 16,  4,  7,  1,  1,  3,  3,
-     8,  8,  2,  2,  1,  1, 17, 17,  1,  1, 18, 18,  5,  5,  2,  2,
-     1,  1,  9, 19,  9, 19, 20,  3,  3, 20,  1, 10, 21,  1, 10,  4,
-     4, 21, 22,  6,  6, 22,  1,  1, 23, 24,  2,  2, 23, 24, 11,  1,
-     1, 11,  7, 25,  7,  1,  1, 25,  8,  8,  3, 26,  3,  1, 12,  2,
-     2, 26,  1, 12,  5,  5, 27,  4,  1,  4,  1, 27, 28,  1, 28, 13,
-     1, 13,  2, 29,  2,  1, 32,  6,  1, 30, 14, 29, 14,  6,  3, 31,
-     3,  1, 30,  1, 32, 31, 33,  9, 33,  1,  1,  7,  9,  7,  2,  2,
-     1,  1,  4, 36, 34,  4,  5, 10, 10,  5, 34,  1,  1, 35,  8,  8,
-    36,  3, 35,  1, 15,  3,  2,  1, 16, 15, 16,  2, 37,  1, 37,  1,
-     1,  1,  6,  6, 38,  1, 38, 11,  1, 39, 39, 40, 11,  2, 41,  4,
-    40,  1,  2,  4,  1,  1,  1, 41,  3,  1,  3,  1,  5,  7,  5,  7},
-
-    /* value table */
-    { 1,  -1,   0,   1,   2,  -1,  -2,   1,  -1,   3,  -3,   1,  -1,   2,  -2,   4,
-     -4,   1,  -1,   1,   5,  -1,  -5,   1,  -1,   2,  -2,   3,   1,  -3,  -1,   6,
-     -6,   0,   1,  -1,   7,  -7,   1,   2,  -1,  -2,   1,  -1,   4,   8,  -4,  -8,
-      1,  -1,   3,  -3,   9,  -9,   1,   2,  -2,  -1,   1,  10, -10,  -1,   5,  -5,
-      2,  -2,   1,  11, -11,  -1,   1,   3,   2,  -1,  -3,  -2,  12, -12,   4,  -4,
-      2,  -2,  -6,   6,  13, -13,   1,  -1,  14, -14,   1,  -1,   3,  -3,   7,  -7,
-     15, -15,   2,   1,  -2,  -1,   1,   5,  -5,  -1, -16,   2,   1,  16,  -2,   4,
-     -4,  -1,   1,   3,  -3,  -1,  17, -17,   1,   1,  -8,   8,  -1,  -1,   2,  18,
-    -18,  -2,   3,   1,  -3,  19, -19,  -1,   3,  -3,   6,   1,  -6,  20,   2,   9,
-     -9,  -1, -20,  -2,   4,  -4,   1,  -5,  21,   5, -21,  -1,   1, -22,  -1,   2,
-     22,  -2,  10,   1, -10,  23,   1,   4, -23,   1,   2,  -1,  -2,  -4,  -7,   1,
-      7, -24,  -1,  24,  -1,  -1,   1,   3,  -1, -25,  25,   4,  -3,  -4,  11, -11,
-     26, -26,   6,   1,   1,  -6,  -5,  -3,   3,   5,  -1, -27,  27,   1,   4,  -4,
-     -1,  -8,  -1,  28,   2,   8, -12, -28,  -2,  -2,   2,  12,  -1,  29,   1, -29,
-     30, -30,   5,  -5,   1, -31,  -1,   3,  31,  -1,   1,   1,  -3, -13,   1,  -7,
-     -1, -32,  13,   7,  32,  33, -33,  -1,  -9, -34,   9,  34,  -6,   5,   6,  -5}
-},{
-    /* MapTab6 */
-    2,  /* eob_sym */
-    13, /* esc_sym */
-    /* run table */
-    {1,  1,  0,  1,  1,  2,  2,  1,  1,  3,  3,  1,  1,  0,  2,  2,
-     4,  1,  4,  1,  1,  1,  5,  5,  1,  1,  6,  6,  2,  2,  1,  1,
-     3,  3,  7,  7,  1,  1,  8,  8,  1,  1,  2,  2,  1,  9,  1,  9,
-     4,  4, 10,  1,  1, 10,  1,  1, 11, 11,  3,  3,  1,  2,  1,  2,
-     1,  1, 12, 12,  5,  5,  1,  1, 13,  1,  1, 13,  2,  2,  1,  1,
-     6,  6,  1,  1,  4, 14,  4, 14,  3,  1,  3,  1,  1,  1, 15,  7,
-    15,  2,  2,  7,  1,  1,  1,  8,  1,  8, 16, 16,  1,  1,  1,  1,
-     2,  1,  1,  2,  1,  1,  3,  5,  5,  3,  4,  1,  1,  4,  1,  1,
-    17, 17,  9,  1,  1,  9,  2,  2,  1,  1, 10, 10,  1,  6,  1,  1,
-     6, 18,  1,  1, 18,  1,  1,  1,  2,  2,  3,  1,  3,  1,  1,  1,
-     4,  1, 19,  1, 19,  7,  1,  1, 20,  1,  4, 20,  1,  7, 11,  2,
-     1, 11, 21,  2,  8,  5,  1,  8,  1,  5, 21,  1,  1,  1, 22,  1,
-     1, 22,  1,  1,  3,  3,  1, 23,  2, 12, 24,  1,  1,  2,  1,  1,
-    12, 23,  1,  1, 24,  1,  1,  1,  4,  1,  1,  1,  2,  1,  6,  6,
-     4,  2,  1,  1,  1,  1,  1,  1,  1, 14, 13,  3,  1, 25,  9, 25,
-    14,  1,  9,  3, 13,  1,  1,  1,  1,  1, 10,  1,  1,  2, 10,  2},
-
-    /* value table */
-    {-20,  -1,   0,   2,  -2,   1,  -1,   3,  -3,   1,  -1,   4,  -4,   0,   2,  -2,
-       1,   5,  -1,  -5,   6,  -6,   1,  -1,   7,  -7,   1,  -1,   3,  -3,   8,  -8,
-       2,  -2,   1,  -1,   9,  -9,   1,  -1,  10, -10,   4,  -4,  11,   1, -11,  -1,
-       2,  -2,   1,  12, -12,  -1,  13, -13,   1,  -1,   3,  -3,  14,   5, -14,  -5,
-     -15,  15,  -1,   1,   2,  -2,  16, -16,   1,  17, -17,  -1,   6,  -6,  18, -18,
-       2,  -2, -19,  19,  -3,   1,   3,  -1,   4,  20,  -4,   1, -21,  21,   1,   2,
-      -1,  -7,   7,  -2,  22, -22,  23,   2, -23,  -2,   1,  -1, -24,  24, -25,  25,
-      -8, -26,  26,   8, -27,  27,   5,   3,  -3,  -5,  -4,  28, -28,   4,  29, -29,
-       1,  -1,  -2, -30,  30,   2,   9,  -9, -31,  31,   2,  -2, -32,   3,  32, -33,
-      -3,   1,  33, -34,  -1,  34, -35,  35, -10,  10,  -6,  36,   6, -36,  37, -37,
-      -5,  38,   1, -38,  -1,   3,  39, -39,  -1,  40,   5,   1, -40,  -3,   2, -11,
-     -41,  -2,   1,  11,  -3,  -4,  41,   3,  42,   4,  -1, -43, -42,  43,   1, -44,
-      45,  -1,  44, -45,  -7,   7, -46,   1, -12,   2,   1, -47,  46,  12,  47,  48,
-      -2,  -1, -48,  49,  -1, -50, -49,  50,  -6, -51,  51,  52, -13,  53,  -4,   4,
-       6,  13, -53, -52, -54,  55,  54, -55, -56,  -2,   2,  -8,  56,   1,  -3,  -1,
-       2,  58,   3,   8,  -2,  57, -58, -60, -59, -57,  -3,  60,  59, -14,   3,  14}
-},{
-    /* MapTab7 */
-    2,  /* eob_sym */
-    38, /* esc_sym */
-    /* run table */
-    {1,  1,  0,  2,  2,  1,  1,  3,  3,  4,  4,  5,  5,  1,  1,  6,
-     6,  2,  2,  7,  7,  8,  8,  1,  1,  3,  3,  9,  9, 10, 10,  1,
-     1,  2,  2,  4,  4, 11,  0, 11, 12, 12, 13, 13,  1,  1,  5,  5,
-    14, 14, 15, 16, 15, 16,  3,  3,  1,  6,  1,  6,  2,  2,  7,  7,
-     8,  8, 17, 17,  1,  1,  4,  4, 18, 18,  2,  2,  1, 19,  1, 20,
-    19, 20, 21, 21,  3,  3, 22, 22,  5,  5, 24,  1,  1, 23,  9, 23,
-    24,  9,  2,  2, 10,  1,  1, 10,  6,  6, 25,  4,  4, 25,  7,  7,
-    26,  8,  1,  8,  3,  1, 26,  3, 11, 11, 27, 27,  2, 28,  1,  2,
-    28,  1, 12, 12,  5,  5, 29, 13, 13, 29, 32,  1,  1, 33, 31, 30,
-    32,  4, 30, 33,  4, 31,  3, 14,  1,  1,  3, 34, 34,  2,  2, 14,
-     6,  6, 35, 36, 35, 36,  1, 15,  1, 16, 16, 15,  7,  9,  7,  9,
-    37,  8,  8, 37,  1,  1, 39,  2, 38, 39,  2, 40,  5, 38, 40,  5,
-     3,  3,  4,  4, 10, 10,  1,  1,  1,  1, 41,  2, 41,  2,  6,  6,
-     1,  1, 11, 42, 11, 43,  3, 42,  3, 17,  4, 43,  1, 17,  7,  1,
-     8, 44,  4,  7, 44,  5,  8,  2,  5,  1,  2, 48, 45,  1, 12, 45,
-    12, 48, 13, 13,  1,  9,  9, 46,  1, 46, 47, 47, 49, 18, 18, 49},
-
-    /* value table */
-    { 1,  -1,   0,   1,  -1,   2,  -2,   1,  -1,   1,  -1,   1,  -1,   3,  -3,   1,
-     -1,  -2,   2,   1,  -1,   1,  -1,   4,  -4,  -2,   2,   1,  -1,   1,  -1,   5,
-     -5,  -3,   3,   2,  -2,   1,   0,  -1,   1,  -1,   1,  -1,   6,  -6,   2,  -2,
-      1,  -1,   1,   1,  -1,  -1,  -3,   3,   7,   2,  -7,  -2,  -4,   4,   2,  -2,
-      2,  -2,   1,  -1,   8,  -8,   3,  -3,   1,  -1,  -5,   5,   9,   1,  -9,   1,
-     -1,  -1,   1,  -1,  -4,   4,   1,  -1,   3,  -3,   1, -10,  10,   1,   2,  -1,
-     -1,  -2,   6,  -6,   2,  11, -11,  -2,   3,  -3,   1,  -4,   4,  -1,   3,  -3,
-      1,   3,  12,  -3,  -5, -12,  -1,   5,   2,  -2,   1,  -1,  -7,   1,  13,   7,
-     -1, -13,   2,  -2,   4,  -4,   1,   2,  -2,  -1,   1,  14, -14,   1,   1,   1,
-     -1,  -5,  -1,  -1,   5,  -1,  -6,   2, -15,  15,   6,   1,  -1,  -8,   8,  -2,
-     -4,   4,   1,   1,  -1,  -1,  16,   2, -16,  -2,   2,  -2,   4,   3,  -4,  -3,
-     -1,  -4,   4,   1, -17,  17,  -1,  -9,   1,   1,   9,   1,  -5,  -1,  -1,   5,
-     -7,   7,   6,  -6,   3,  -3,  18, -18,  19, -19,   1, -10,  -1,  10,  -5,   5,
-     20, -20,  -3,   1,   3,   1,   8,  -1,  -8,   2,   7,  -1, -21,  -2,   5,  21,
-      5,  -1,  -7,  -5,   1,  -6,  -5, -11,   6,  22,  11,   1,   1, -22,  -3,  -1,
-      3,  -1,   3,  -3, -23,   4,  -4,   1,  23,  -1,   1,  -1,   1,  -2,   2,  -1}
-},{
-    /* MapTab8 */
-    4,  /* eob_sym */
-    11, /* esc_sym */
-    /* run table */
-    {1,  1,  1,  1,  0,  2,  2,  1,  1,  3,  3,  0,  1,  1,  2,  2,
-     4,  4,  1,  1,  5,  5,  1,  1,  2,  2,  3,  3,  6,  6,  1,  1,
-     7,  7,  8,  1,  8,  2,  2,  1,  4,  4,  1,  3,  1,  3,  9,  9,
-     2,  2,  1,  5,  1,  5, 10, 10,  1,  1, 11, 11,  3,  6,  3,  4,
-     4,  6,  2,  2,  1, 12,  1, 12,  7, 13,  7, 13,  1,  1,  8,  8,
-     2,  2, 14, 14, 16, 15, 16,  5,  5,  1,  3, 15,  1,  3,  4,  4,
-     1,  1, 17, 17,  2,  2,  6,  6,  1, 18,  1, 18, 22, 21, 22, 21,
-    25, 24, 25, 19,  9, 20,  9, 23, 19, 24, 20,  3, 23,  7,  3,  1,
-     1,  7, 28, 26, 29,  5, 28, 26,  5,  8, 29,  4,  8, 27,  2,  2,
-     4, 27,  1,  1, 10, 36, 10, 33, 33, 36, 30,  1, 32, 32,  1, 30,
-     6, 31, 31, 35,  3,  6, 11, 11,  3,  2, 35,  2, 34,  1, 34,  1,
-    37, 37, 12,  7, 12,  5, 41,  5,  4,  7,  1,  8, 13,  4,  1, 41,
-    13, 38,  8, 38,  9,  1, 40, 40,  9,  1, 39,  2,  2, 49, 39, 42,
-     3,  3, 14, 16, 49, 14, 16, 42, 43, 43,  6,  6, 15,  1,  1, 15,
-    44, 44,  1,  1, 50, 48,  4,  5,  4,  7,  5,  2, 10, 10, 48,  7,
-    50, 45,  2,  1, 45,  8,  8,  1, 46, 46,  3, 47, 47,  3,  1,  1},
-
-    /* value table */
-    { 1,  -1,   2,  -2,   0,   1,  -1,   3,  -3,   1,  -1,   0,   4,  -4,   2,  -2,
-      1,  -1,   5,  -5,   1,  -1,   6,  -6,   3,  -3,   2,  -2,   1,  -1,   7,  -7,
-      1,  -1,   1,   8,  -1,   4,  -4,  -8,   2,  -2,   9,   3,  -9,  -3,   1,  -1,
-      5,  -5,  10,   2, -10,  -2,   1,  -1,  11, -11,   1,  -1,  -4,   2,   4,   3,
-     -3,  -2,   6,  -6,  12,   1, -12,  -1,   2,   1,  -2,  -1,  13, -13,   2,  -2,
-      7,  -7,   1,  -1,   1,   1,  -1,   3,  -3,  14,   5,  -1, -14,  -5,   4,  -4,
-     15, -15,   1,  -1,   8,  -8,  -3,   3,  16,   1, -16,  -1,   1,   1,  -1,  -1,
-      1,   1,  -1,   1,   2,   1,  -2,   1,  -1,  -1,  -1,   6,  -1,   3,  -6,  17,
-    -17,  -3,   1,   1,   1,   4,  -1,  -1,  -4,   3,  -1,   5,  -3,  -1,  -9,   9,
-     -5,   1,  18, -18,   2,   1,  -2,   1,  -1,  -1,   1,  19,  -1,   1, -19,  -1,
-      4,   1,  -1,   1,   7,  -4,  -2,   2,  -7,  10,  -1, -10,   1,  20,  -1, -20,
-      1,  -1,   2,   4,  -2,   5,   1,  -5,   6,  -4,  21,   4,   2,  -6, -21,  -1,
-     -2,   1,  -4,  -1,  -3,  22,  -1,   1,   3, -22,  -1,  11, -11,   1,   1,   1,
-      8,  -8,   2,   2,  -1,  -2,  -2,  -1,   1,  -1,  -5,   5,   2,  23, -23,  -2,
-      1,  -1,  24, -24,  -1,  -1,   7,   6,  -7,   5,  -6,  12,  -3,   3,   1,  -5,
-      1,   1, -12,  25,  -1,  -5,   5, -25,  -1,   1,   9,   1,  -1,  -9,  26, -26}
-}
-};
diff --git a/libavcodec/ivi_common.h b/libavcodec/ivi_common.h
deleted file mode 100644
index 64793e4..0000000
--- a/libavcodec/ivi_common.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * common functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
- *
- * Copyright (c) 2009 Maxim Poliakovski
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * This file contains structures and macros shared by both Indeo4 and
- * Indeo5 decoders.
- */
-
-#ifndef AVCODEC_IVI_COMMON_H
-#define AVCODEC_IVI_COMMON_H
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include <stdint.h>
-
-#define IVI_DEBUG 0
-
-#define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes
-
-/**
- *  huffman codebook descriptor
- */
-typedef struct {
-    int32_t     num_rows;
-    uint8_t     xbits[16];
-} IVIHuffDesc;
-
-/**
- *  macroblock/block huffman table descriptor
- */
-typedef struct {
-    int32_t     tab_sel;    /// index of one of the predefined tables
-                            /// or "7" for custom one
-    VLC         *tab;       /// pointer to the table associated with tab_sel
-
-    //! the following are used only when tab_sel == 7
-    IVIHuffDesc cust_desc;  /// custom Huffman codebook descriptor
-    VLC         cust_tab;   /// vlc table for custom codebook
-} IVIHuffTab;
-
-enum {
-    IVI_MB_HUFF   = 0,      /// Huffman table is used for coding macroblocks
-    IVI_BLK_HUFF  = 1       /// Huffman table is used for coding blocks
-};
-
-extern VLC ff_ivi_mb_vlc_tabs [8]; ///< static macroblock Huffman tables
-extern VLC ff_ivi_blk_vlc_tabs[8]; ///< static block Huffman tables
-
-
-/**
- *  run-value (RLE) table descriptor
- */
-typedef struct {
-    uint8_t     eob_sym; ///< end of block symbol
-    uint8_t     esc_sym; ///< escape symbol
-    uint8_t     runtab[256];
-    int8_t      valtab[256];
-} RVMapDesc;
-
-extern const RVMapDesc ff_ivi_rvmap_tabs[9];
-
-
-/**
- *  information for Indeo macroblock (16x16, 8x8 or 4x4)
- */
-typedef struct {
-    int16_t     xpos;
-    int16_t     ypos;
-    uint32_t    buf_offs; ///< address in the output buffer for this mb
-    uint8_t     type;     ///< macroblock type: 0 - INTRA, 1 - INTER
-    uint8_t     cbp;      ///< coded block pattern
-    int8_t      q_delta;  ///< quant delta
-    int8_t      mv_x;     ///< motion vector (x component)
-    int8_t      mv_y;     ///< motion vector (y component)
-} IVIMbInfo;
-
-
-/**
- *  information for Indeo tile
- */
-typedef struct {
-    int         xpos;
-    int         ypos;
-    int         width;
-    int         height;
-    int         is_empty;  ///< = 1 if this tile doesn't contain any data
-    int         data_size; ///< size of the data in bytes
-    int         num_MBs;   ///< number of macroblocks in this tile
-    IVIMbInfo   *mbs;      ///< array of macroblock descriptors
-    IVIMbInfo   *ref_mbs;  ///< ptr to the macroblock descriptors of the reference tile
-} IVITile;
-
-
-/**
- *  information for Indeo wavelet band
- */
-typedef struct {
-    int             plane;          ///< plane number this band belongs to
-    int             band_num;       ///< band number
-    int             width;
-    int             height;
-    const uint8_t   *data_ptr;      ///< ptr to the first byte of the band data
-    int             data_size;      ///< size of the band data
-    int16_t         *buf;           ///< pointer to the output buffer for this band
-    int16_t         *ref_buf;       ///< pointer to the reference frame buffer (for motion compensation)
-    int16_t         *bufs[3];       ///< array of pointers to the band buffers
-    int             pitch;          ///< pitch associated with the buffers above
-    int             is_empty;       ///< = 1 if this band doesn't contain any data
-    int             mb_size;        ///< macroblock size
-    int             blk_size;       ///< block size
-    int             is_halfpel;     ///< precision of the motion compensation: 0 - fullpel, 1 - halfpel
-    int             inherit_mv;     ///< tells if motion vector is inherited from reference macroblock
-    int             inherit_qdelta; ///< tells if quantiser delta is inherited from reference macroblock
-    int             qdelta_present; ///< tells if Qdelta signal is present in the bitstream (Indeo5 only)
-    int             quant_mat;      ///< dequant matrix index
-    int             glob_quant;     ///< quant base for this band
-    const uint8_t   *scan;          ///< ptr to the scan pattern
-
-    IVIHuffTab      blk_vlc;        ///< vlc table for decoding block data
-
-    uint16_t        *dequant_intra; ///< ptr to dequant tables for intra blocks
-    uint16_t        *dequant_inter; ///< ptr dequant tables for inter blocks
-    int             num_corr;       ///< number of correction entries
-    uint8_t         corr[61*2];     ///< rvmap correction pairs
-    int             rvmap_sel;      ///< rvmap table selector
-    RVMapDesc       *rv_map;        ///< ptr to the RLE table for this band
-    int             num_tiles;      ///< number of tiles in this band
-    IVITile         *tiles;         ///< array of tile descriptors
-    void (*inv_transform)(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); ///< inverse transform function pointer
-    void (*dc_transform) (const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);   ///< dc transform function pointer, it may be NULL
-    int             is_2d_trans;    ///< 1 indicates that the two-dimensional inverse transform is used
-    int32_t         checksum;       ///< for debug purposes
-    int             checksum_present;
-    int             bufsize;        ///< band buffer size in bytes
-    const uint8_t   *intra_base;    ///< quantization matrix for intra blocks
-    const uint8_t   *inter_base;    ///< quantization matrix for inter blocks
-    const uint8_t   *intra_scale;   ///< quantization coefficient for intra blocks
-    const uint8_t   *inter_scale;   ///< quantization coefficient for inter blocks
-} IVIBandDesc;
-
-
-/**
- *  color plane (luma or chroma) information
- */
-typedef struct {
-    uint16_t    width;
-    uint16_t    height;
-    uint8_t     num_bands;  ///< number of bands this plane subdivided into
-    IVIBandDesc *bands;     ///< array of band descriptors
-} IVIPlaneDesc;
-
-
-typedef struct {
-    uint16_t    pic_width;
-    uint16_t    pic_height;
-    uint16_t    chroma_width;
-    uint16_t    chroma_height;
-    uint16_t    tile_width;
-    uint16_t    tile_height;
-    uint8_t     luma_bands;
-    uint8_t     chroma_bands;
-} IVIPicConfig;
-
-/** compares some properties of two pictures */
-static inline int ivi_pic_config_cmp(IVIPicConfig *str1, IVIPicConfig *str2)
-{
-    return (str1->pic_width    != str2->pic_width    || str1->pic_height    != str2->pic_height    ||
-            str1->chroma_width != str2->chroma_width || str1->chroma_height != str2->chroma_height ||
-            str1->tile_width   != str2->tile_width   || str1->tile_height   != str2->tile_height   ||
-            str1->luma_bands   != str2->luma_bands   || str1->chroma_bands  != str2->chroma_bands);
-}
-
-/** calculate number of tiles in a stride */
-#define IVI_NUM_TILES(stride, tile_size) (((stride) + (tile_size) - 1) / (tile_size))
-
-/** calculate number of macroblocks in a tile */
-#define IVI_MBs_PER_TILE(tile_width, tile_height, mb_size) \
-    ((((tile_width) + (mb_size) - 1) / (mb_size)) * (((tile_height) + (mb_size) - 1) / (mb_size)))
-
-/** convert unsigned values into signed ones (the sign is in the LSB) */
-#define IVI_TOSIGNED(val) (-(((val) >> 1) ^ -((val) & 1)))
-
-/** scales motion vector */
-static inline int ivi_scale_mv(int mv, int mv_scale)
-{
-    return (mv + (mv > 0) + (mv_scale - 1)) >> mv_scale;
-}
-
-/**
- *  Generates a huffman codebook from the given descriptor
- *  and converts it into the FFmpeg VLC table.
- *
- *  @param cb   [in]  pointer to codebook descriptor
- *  @param vlc  [out] where to place the generated VLC table
- *  @param flag [in]  flag: 1 - for static or 0 for dynamic tables
- *  @return     result code: 0 - OK, -1 = error (invalid codebook descriptor)
- */
-int  ff_ivi_create_huff_from_desc(const IVIHuffDesc *cb, VLC *vlc, int flag);
-
-/**
- * Initializes static codes used for macroblock and block decoding.
- */
-void ff_ivi_init_static_vlc(void);
-
-/**
- *  Decodes a huffman codebook descriptor from the bitstream
- *  and selects specified huffman table.
- *
- *  @param gb           [in,out] the GetBit context
- *  @param desc_coded   [in] flag signalling if table descriptor was coded
- *  @param which_tab    [in] codebook purpose (IVI_MB_HUFF or IVI_BLK_HUFF)
- *  @param huff_tab     [out] pointer to the descriptor of the selected table
- *  @param avctx        [in] AVCodecContext pointer
- *  @return             zero on success, negative value otherwise
- */
-int  ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
-                          IVIHuffTab *huff_tab, AVCodecContext *avctx);
-
-/**
- *  Compares two huffman codebook descriptors.
- *
- *  @param desc1    [in] ptr to the 1st descriptor to compare
- *  @param desc2    [in] ptr to the 2nd descriptor to compare
- *  @return         comparison result: 0 - equal, 1 - not equal
- */
-int  ff_ivi_huff_desc_cmp(const IVIHuffDesc *desc1, const IVIHuffDesc *desc2);
-
-/**
- *  Copies huffman codebook descriptors.
- *
- *  @param dst  [out] ptr to the destination descriptor
- *  @param src  [in]  ptr to the source descriptor
- */
-void ff_ivi_huff_desc_copy(IVIHuffDesc *dst, const IVIHuffDesc *src);
-
-/**
- *  Initializes planes (prepares descriptors, allocates buffers etc).
- *
- *  @param planes       [in,out] pointer to the array of the plane descriptors
- *  @param cfg          [in] pointer to the ivi_pic_config structure describing picture layout
- *  @return             result code: 0 - OK
- */
-int  ff_ivi_init_planes(IVIPlaneDesc *planes, const IVIPicConfig *cfg);
-
-/**
- *  Frees planes, bands and macroblocks buffers.
- *
- *  @param planes       [in] pointer to the array of the plane descriptors
- */
-void ff_ivi_free_buffers(IVIPlaneDesc *planes);
-
-/**
- *  Initializes tile and macroblock descriptors.
- *
- *  @param planes       [in,out] pointer to the array of the plane descriptors
- *  @param tile_width   [in]     tile width
- *  @param tile_height  [in]     tile height
- *  @return             result code: 0 - OK
- */
-int  ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_height);
-
-/**
- *  Decodes size of the tile data.
- *  The size is stored as a variable-length field having the following format:
- *  if (tile_data_size < 255) than this field is only one byte long
- *  if (tile_data_size >= 255) than this field four is byte long: 0xFF X1 X2 X3
- *  where X1-X3 is size of the tile data
- *
- *  @param gb   [in,out] the GetBit context
- *  @return     size of the tile data in bytes
- */
-int  ff_ivi_dec_tile_data_size(GetBitContext *gb);
-
-/**
- *  Decodes block data:
- *  extracts huffman-coded transform coefficients from the bitstream,
- *  dequantizes them, applies inverse transform and motion compensation
- *  in order to reconstruct the picture.
- *
- *  @param gb   [in,out] the GetBit context
- *  @param band [in]     pointer to the band descriptor
- *  @param tile [in]     pointer to the tile descriptor
- *  @return     result code: 0 - OK, -1 = error (corrupted blocks data)
- */
-int  ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile);
-
-/**
- *  Handles empty tiles by performing data copying and motion
- *  compensation respectively.
- *
- *  @param avctx    [in] ptr to the AVCodecContext
- *  @param band     [in] pointer to the band descriptor
- *  @param tile     [in] pointer to the tile descriptor
- *  @param mv_scale [in] scaling factor for motion vectors
- */
-void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band,
-                               IVITile *tile, int32_t mv_scale);
-
-/**
- *  Converts and outputs the current plane.
- *  This conversion is done by adding back the bias value of 128
- *  (subtracted in the encoder) and clipping the result.
- *
- *  @param plane        [in]  pointer to the descriptor of the plane being processed
- *  @param dst          [out] pointer to the buffer receiving converted pixels
- *  @param dst_pitch    [in]  pitch for moving to the next y line
- */
-void ff_ivi_output_plane(IVIPlaneDesc *plane, uint8_t *dst, int dst_pitch);
-
-#if IVI_DEBUG
-/**
- *  Calculates band checksum from band data.
- */
-uint16_t ivi_calc_band_checksum (IVIBandDesc *band);
-
-/**
- *  Verifies that band data lies in range.
- */
-int ivi_check_band (IVIBandDesc *band, const uint8_t *ref, int pitch);
-#endif
-
-#endif /* AVCODEC_IVI_COMMON_H */
diff --git a/libavcodec/ivi_dsp.c b/libavcodec/ivi_dsp.c
deleted file mode 100644
index ccaffd4..0000000
--- a/libavcodec/ivi_dsp.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
- *
- * Copyright (c) 2009 Maxim Poliakovski
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DSP functions (inverse transforms, motion compensation, wavelet recompostions)
- * for Indeo Video Interactive codecs.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "dwt.h"
-#include "ivi_common.h"
-#include "ivi_dsp.h"
-
-void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
-                        const int dst_pitch, const int num_bands)
-{
-    int             x, y, indx;
-    int32_t         p0, p1, p2, p3, tmp0, tmp1, tmp2;
-    int32_t         b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6;
-    int32_t         b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
-    int32_t         pitch, back_pitch;
-    const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
-
-    /* all bands should have the same pitch */
-    pitch = plane->bands[0].pitch;
-
-    /* pixels at the position "y-1" will be set to pixels at the "y" for the 1st iteration */
-    back_pitch = 0;
-
-    /* get pointers to the wavelet bands */
-    b0_ptr = plane->bands[0].buf;
-    b1_ptr = plane->bands[1].buf;
-    b2_ptr = plane->bands[2].buf;
-    b3_ptr = plane->bands[3].buf;
-
-    for (y = 0; y < plane->height; y += 2) {
-        /* load storage variables with values */
-        if (num_bands > 0) {
-            b0_1 = b0_ptr[0];
-            b0_2 = b0_ptr[pitch];
-        }
-
-        if (num_bands > 1) {
-            b1_1 = b1_ptr[back_pitch];
-            b1_2 = b1_ptr[0];
-            b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch];
-        }
-
-        if (num_bands > 2) {
-            b2_2 = b2_ptr[0];     // b2[x,  y  ]
-            b2_3 = b2_2;          // b2[x+1,y  ] = b2[x,y]
-            b2_5 = b2_ptr[pitch]; // b2[x  ,y+1]
-            b2_6 = b2_5;          // b2[x+1,y+1] = b2[x,y+1]
-        }
-
-        if (num_bands > 3) {
-            b3_2 = b3_ptr[back_pitch]; // b3[x  ,y-1]
-            b3_3 = b3_2;               // b3[x+1,y-1] = b3[x  ,y-1]
-            b3_5 = b3_ptr[0];          // b3[x  ,y  ]
-            b3_6 = b3_5;               // b3[x+1,y  ] = b3[x  ,y  ]
-            b3_8 = b3_2 - b3_5*6 + b3_ptr[pitch];
-            b3_9 = b3_8;
-        }
-
-        for (x = 0, indx = 0; x < plane->width; x+=2, indx++) {
-            /* some values calculated in the previous iterations can */
-            /* be reused in the next ones, so do appropriate copying */
-            b2_1 = b2_2; // b2[x-1,y  ] = b2[x,  y  ]
-            b2_2 = b2_3; // b2[x  ,y  ] = b2[x+1,y  ]
-            b2_4 = b2_5; // b2[x-1,y+1] = b2[x  ,y+1]
-            b2_5 = b2_6; // b2[x  ,y+1] = b2[x+1,y+1]
-            b3_1 = b3_2; // b3[x-1,y-1] = b3[x  ,y-1]
-            b3_2 = b3_3; // b3[x  ,y-1] = b3[x+1,y-1]
-            b3_4 = b3_5; // b3[x-1,y  ] = b3[x  ,y  ]
-            b3_5 = b3_6; // b3[x  ,y  ] = b3[x+1,y  ]
-            b3_7 = b3_8; // vert_HPF(x-1)
-            b3_8 = b3_9; // vert_HPF(x  )
-
-            p0 = p1 = p2 = p3 = 0;
-
-            /* process the LL-band by applying LPF both vertically and horizontally */
-            if (num_bands > 0) {
-                tmp0 = b0_1;
-                tmp2 = b0_2;
-                b0_1 = b0_ptr[indx+1];
-                b0_2 = b0_ptr[pitch+indx+1];
-                tmp1 = tmp0 + b0_1;
-
-                p0 =  tmp0 << 4;
-                p1 =  tmp1 << 3;
-                p2 = (tmp0 + tmp2) << 3;
-                p3 = (tmp1 + tmp2 + b0_2) << 2;
-            }
-
-            /* process the HL-band by applying HPF vertically and LPF horizontally */
-            if (num_bands > 1) {
-                tmp0 = b1_2;
-                tmp1 = b1_1;
-                b1_2 = b1_ptr[indx+1];
-                b1_1 = b1_ptr[back_pitch+indx+1];
-
-                tmp2 = tmp1 - tmp0*6 + b1_3;
-                b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch+indx+1];
-
-                p0 += (tmp0 + tmp1) << 3;
-                p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
-                p2 +=  tmp2 << 2;
-                p3 += (tmp2 + b1_3) << 1;
-            }
-
-            /* process the LH-band by applying LPF vertically and HPF horizontally */
-            if (num_bands > 2) {
-                b2_3 = b2_ptr[indx+1];
-                b2_6 = b2_ptr[pitch+indx+1];
-
-                tmp0 = b2_1 + b2_2;
-                tmp1 = b2_1 - b2_2*6 + b2_3;
-
-                p0 += tmp0 << 3;
-                p1 += tmp1 << 2;
-                p2 += (tmp0 + b2_4 + b2_5) << 2;
-                p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) << 1;
-            }
-
-            /* process the HH-band by applying HPF both vertically and horizontally */
-            if (num_bands > 3) {
-                b3_6 = b3_ptr[indx+1];            // b3[x+1,y  ]
-                b3_3 = b3_ptr[back_pitch+indx+1]; // b3[x+1,y-1]
-
-                tmp0 = b3_1 + b3_4;
-                tmp1 = b3_2 + b3_5;
-                tmp2 = b3_3 + b3_6;
-
-                b3_9 = b3_3 - b3_6*6 + b3_ptr[pitch+indx+1];
-
-                p0 += (tmp0 + tmp1) << 2;
-                p1 += (tmp0 - tmp1*6 + tmp2) << 1;
-                p2 += (b3_7 + b3_8) << 1;
-                p3 +=  b3_7 - b3_8*6 + b3_9;
-            }
-
-            /* output four pixels */
-            dst[x]             = av_clip_uint8((p0 >> 6) + 128);
-            dst[x+1]           = av_clip_uint8((p1 >> 6) + 128);
-            dst[dst_pitch+x]   = av_clip_uint8((p2 >> 6) + 128);
-            dst[dst_pitch+x+1] = av_clip_uint8((p3 >> 6) + 128);
-        }// for x
-
-        dst += dst_pitch << 1;
-
-        back_pitch = -pitch;
-
-        b0_ptr += pitch;
-        b1_ptr += pitch;
-        b2_ptr += pitch;
-        b3_ptr += pitch;
-    }
-}
-
-/** butterfly operation for the inverse slant transform */
-#define IVI_SLANT_BFLY(s1, s2, o1, o2, t) \
-    t  = s1 - s2;\
-    o1 = s1 + s2;\
-    o2 = t;\
-
-/** This is a reflection a,b = 1/2, 5/4 for the inverse slant transform */
-#define IVI_IREFLECT(s1, s2, o1, o2, t) \
-    t  = ((s1 + s2*2 + 2) >> 2) + s1;\
-    o2 = ((s1*2 - s2 + 2) >> 2) - s2;\
-    o1 = t;\
-
-/** This is a reflection a,b = 1/2, 7/8 for the inverse slant transform */
-#define IVI_SLANT_PART4(s1, s2, o1, o2, t) \
-    t  = s2 + ((s1*4  - s2 + 4) >> 3);\
-    o2 = s1 + ((-s1 - s2*4 + 4) >> 3);\
-    o1 = t;\
-
-/** inverse slant8 transform */
-#define IVI_INV_SLANT8(s1, s4, s8, s5, s2, s6, s3, s7,\
-                       d1, d2, d3, d4, d5, d6, d7, d8,\
-                       t0, t1, t2, t3, t4, t5, t6, t7, t8) {\
-    IVI_SLANT_PART4(s4, s5, t4, t5, t0);\
-\
-    IVI_SLANT_BFLY(s1, t5, t1, t5, t0); IVI_SLANT_BFLY(s2, s6, t2, t6, t0);\
-    IVI_SLANT_BFLY(s7, s3, t7, t3, t0); IVI_SLANT_BFLY(t4, s8, t4, t8, t0);\
-\
-    IVI_SLANT_BFLY(t1, t2, t1, t2, t0); IVI_IREFLECT  (t4, t3, t4, t3, t0);\
-    IVI_SLANT_BFLY(t5, t6, t5, t6, t0); IVI_IREFLECT  (t8, t7, t8, t7, t0);\
-    IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\
-    IVI_SLANT_BFLY(t5, t8, t5, t8, t0); IVI_SLANT_BFLY(t6, t7, t6, t7, t0);\
-    d1 = COMPENSATE(t1);\
-    d2 = COMPENSATE(t2);\
-    d3 = COMPENSATE(t3);\
-    d4 = COMPENSATE(t4);\
-    d5 = COMPENSATE(t5);\
-    d6 = COMPENSATE(t6);\
-    d7 = COMPENSATE(t7);\
-    d8 = COMPENSATE(t8);}
-
-/** inverse slant4 transform */
-#define IVI_INV_SLANT4(s1, s4, s2, s3, d1, d2, d3, d4, t0, t1, t2, t3, t4) {\
-    IVI_SLANT_BFLY(s1, s2, t1, t2, t0); IVI_IREFLECT  (s4, s3, t4, t3, t0);\
-\
-    IVI_SLANT_BFLY(t1, t4, t1, t4, t0); IVI_SLANT_BFLY(t2, t3, t2, t3, t0);\
-    d1 = COMPENSATE(t1);\
-    d2 = COMPENSATE(t2);\
-    d3 = COMPENSATE(t3);\
-    d4 = COMPENSATE(t4);}
-
-void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
-{
-    int     i;
-    const int32_t *src;
-    int32_t *dst;
-    int     tmp[64];
-    int     t0, t1, t2, t3, t4, t5, t6, t7, t8;
-
-#define COMPENSATE(x) (x)
-    src = in;
-    dst = tmp;
-    for (i = 0; i < 8; i++) {
-        if (flags[i]) {
-            IVI_INV_SLANT8(src[0], src[8], src[16], src[24], src[32], src[40], src[48], src[56],
-                           dst[0], dst[8], dst[16], dst[24], dst[32], dst[40], dst[48], dst[56],
-                           t0, t1, t2, t3, t4, t5, t6, t7, t8);
-        } else
-            dst[0] = dst[8] = dst[16] = dst[24] = dst[32] = dst[40] = dst[48] = dst[56] = 0;
-
-            src++;
-            dst++;
-    }
-#undef COMPENSATE
-
-#define COMPENSATE(x) ((x + 1)>>1)
-    src = tmp;
-    for (i = 0; i < 8; i++) {
-        if (!src[0] && !src[1] && !src[2] && !src[3] && !src[4] && !src[5] && !src[6] && !src[7]) {
-            memset(out, 0, 8*sizeof(out[0]));
-        } else {
-            IVI_INV_SLANT8(src[0], src[1], src[2], src[3], src[4], src[5], src[6], src[7],
-                           out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
-                           t0, t1, t2, t3, t4, t5, t6, t7, t8);
-        }
-        src += 8;
-        out += pitch;
-    }
-#undef COMPENSATE
-}
-
-void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
-{
-    int     i;
-    const int32_t *src;
-    int32_t *dst;
-    int     tmp[16];
-    int     t0, t1, t2, t3, t4;
-
-#define COMPENSATE(x) (x)
-    src = in;
-    dst = tmp;
-    for (i = 0; i < 4; i++) {
-        if (flags[i]) {
-            IVI_INV_SLANT4(src[0], src[4], src[8], src[12],
-                           dst[0], dst[4], dst[8], dst[12],
-                           t0, t1, t2, t3, t4);
-        } else
-            dst[0] = dst[4] = dst[8] = dst[12] = 0;
-
-            src++;
-            dst++;
-    }
-#undef COMPENSATE
-
-#define COMPENSATE(x) ((x + 1)>>1)
-    src = tmp;
-    for (i = 0; i < 4; i++) {
-        if (!src[0] && !src[1] && !src[2] && !src[3]) {
-            out[0] = out[1] = out[2] = out[3] = 0;
-        } else {
-            IVI_INV_SLANT4(src[0], src[1], src[2], src[3],
-                           out[0], out[1], out[2], out[3],
-                           t0, t1, t2, t3, t4);
-        }
-        src += 4;
-        out += pitch;
-    }
-#undef COMPENSATE
-}
-
-void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
-{
-    int     x, y;
-    int16_t dc_coeff;
-
-    dc_coeff = (*in + 1) >> 1;
-
-    for (y = 0; y < blk_size; out += pitch, y++) {
-        for (x = 0; x < blk_size; x++)
-            out[x] = dc_coeff;
-    }
-}
-
-void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
-{
-    int     i;
-    int     t0, t1, t2, t3, t4, t5, t6, t7, t8;
-
-#define COMPENSATE(x) ((x + 1)>>1)
-    for (i = 0; i < 8; i++) {
-        if (!in[0] && !in[1] && !in[2] && !in[3] && !in[4] && !in[5] && !in[6] && !in[7]) {
-            memset(out, 0, 8*sizeof(out[0]));
-        } else {
-            IVI_INV_SLANT8( in[0],  in[1],  in[2],  in[3],  in[4],  in[5],  in[6],  in[7],
-                           out[0], out[1], out[2], out[3], out[4], out[5], out[6], out[7],
-                           t0, t1, t2, t3, t4, t5, t6, t7, t8);
-        }
-        in += 8;
-        out += pitch;
-    }
-#undef COMPENSATE
-}
-
-void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
-{
-    int     x, y;
-    int16_t dc_coeff;
-
-    dc_coeff = (*in + 1) >> 1;
-
-    for (x = 0; x < blk_size; x++)
-        out[x] = dc_coeff;
-
-    out += pitch;
-
-    for (y = 1; y < blk_size; out += pitch, y++) {
-        for (x = 0; x < blk_size; x++)
-            out[x] = 0;
-    }
-}
-
-void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags)
-{
-    int     i, row2, row4, row8;
-    int     t0, t1, t2, t3, t4, t5, t6, t7, t8;
-
-    row2 = pitch << 1;
-    row4 = pitch << 2;
-    row8 = pitch << 3;
-
-#define COMPENSATE(x) ((x + 1)>>1)
-    for (i = 0; i < 8; i++) {
-        if (flags[i]) {
-            IVI_INV_SLANT8(in[0], in[8], in[16], in[24], in[32], in[40], in[48], in[56],
-                           out[0], out[pitch], out[row2], out[row2 + pitch], out[row4],
-                           out[row4 + pitch],  out[row4 + row2], out[row8 - pitch],
-                           t0, t1, t2, t3, t4, t5, t6, t7, t8);
-        } else {
-            out[0] = out[pitch] = out[row2] = out[row2 + pitch] = out[row4] =
-            out[row4 + pitch] =  out[row4 + row2] = out[row8 - pitch] = 0;
-        }
-
-        in++;
-        out++;
-    }
-#undef COMPENSATE
-}
-
-void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size)
-{
-    int     x, y;
-    int16_t dc_coeff;
-
-    dc_coeff = (*in + 1) >> 1;
-
-    for (y = 0; y < blk_size; out += pitch, y++) {
-        out[0] = dc_coeff;
-        for (x = 1; x < blk_size; x++)
-            out[x] = 0;
-    }
-}
-
-void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
-                           const uint8_t *flags)
-{
-    int     x, y;
-
-    for (y = 0; y < 8; out += pitch, in += 8, y++)
-        for (x = 0; x < 8; x++)
-            out[x] = in[x];
-}
-
-void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
-                             int blk_size)
-{
-    int     y;
-
-    out[0] = in[0];
-    memset(out + 1, 0, 7*sizeof(out[0]));
-    out += pitch;
-
-    for (y = 1; y < 8; out += pitch, y++)
-        memset(out, 0, 8*sizeof(out[0]));
-}
-
-#define IVI_MC_TEMPLATE(size, suffix, OP) \
-void ff_ivi_mc_ ## size ##x## size ## suffix (int16_t *buf, const int16_t *ref_buf, \
-                                              uint32_t pitch, int mc_type) \
-{ \
-    int     i, j; \
-    const int16_t *wptr; \
-\
-    switch (mc_type) { \
-    case 0: /* fullpel (no interpolation) */ \
-        for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) { \
-            for (j = 0; j < size; j++) {\
-                OP(buf[j], ref_buf[j]); \
-            } \
-        } \
-        break; \
-    case 1: /* horizontal halfpel interpolation */ \
-        for (i = 0; i < size; i++, buf += pitch, ref_buf += pitch) \
-            for (j = 0; j < size; j++) \
-                OP(buf[j], (ref_buf[j] + ref_buf[j+1]) >> 1); \
-        break; \
-    case 2: /* vertical halfpel interpolation */ \
-        wptr = ref_buf + pitch; \
-        for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \
-            for (j = 0; j < size; j++) \
-                OP(buf[j], (ref_buf[j] + wptr[j]) >> 1); \
-        break; \
-    case 3: /* vertical and horizontal halfpel interpolation */ \
-        wptr = ref_buf + pitch; \
-        for (i = 0; i < size; i++, buf += pitch, wptr += pitch, ref_buf += pitch) \
-            for (j = 0; j < size; j++) \
-                OP(buf[j], (ref_buf[j] + ref_buf[j+1] + wptr[j] + wptr[j+1]) >> 2); \
-        break; \
-    } \
-} \
-
-#define OP_PUT(a, b)  (a) = (b)
-#define OP_ADD(a, b)  (a) += (b)
-
-IVI_MC_TEMPLATE(8, _no_delta, OP_PUT);
-IVI_MC_TEMPLATE(8, _delta,    OP_ADD);
-IVI_MC_TEMPLATE(4, _no_delta, OP_PUT);
-IVI_MC_TEMPLATE(4, _delta,    OP_ADD);
diff --git a/libavcodec/ivi_dsp.h b/libavcodec/ivi_dsp.h
deleted file mode 100644
index bdd9654..0000000
--- a/libavcodec/ivi_dsp.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * DSP functions for Indeo Video Interactive codecs (Indeo4 and Indeo5)
- *
- * Copyright (c) 2009 Maxim Poliakovski
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * DSP functions (inverse transforms, motion compensations, wavelet recompostion)
- * for Indeo Video Interactive codecs.
- */
-
-#ifndef AVCODEC_IVI_DSP_H
-#define AVCODEC_IVI_DSP_H
-
-#include "avcodec.h"
-#include "ivi_common.h"
-
-/**
- *  5/3 wavelet recomposition filter for Indeo5
- *
- *  @param plane        [in]  pointer to the descriptor of the plane being processed
- *  @param dst          [out] pointer to the destination buffer
- *  @param dst_pitch    [in]  pitch of the destination buffer
- *  @param num_bands    [in]  number of wavelet bands to be processed
- */
-void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
-                        const int dst_pitch, const int num_bands);
-
-/**
- *  two-dimensional inverse slant 8x8 transform
- *
- *  @param  in      [in]  pointer to the vector of transform coefficients
- *  @param  out     [out] pointer to the output buffer (frame)
- *  @param  pitch   [in]  pitch to move to the next y line
- *  @param  flags   [in]  pointer to the array of column flags:
- *                        != 0 - non_empty column, 0 - empty one
- *                        (this array must be filled by caller)
- */
-void ff_ivi_inverse_slant_8x8(const int32_t *in, int16_t *out, uint32_t pitch,
-                              const uint8_t *flags);
-
-/**
- *  two-dimensional inverse slant 4x4 transform
- *
- *  @param  in      [in]  pointer to the vector of transform coefficients
- *  @param  out     [out] pointer to the output buffer (frame)
- *  @param  pitch   [in]  pitch to move to the next y line
- *  @param  flags   [in]  pointer to the array of column flags:
- *                        != 0 - non_empty column, 0 - empty one
- *                        (this array must be filled by caller)
- */
-void ff_ivi_inverse_slant_4x4(const int32_t *in, int16_t *out, uint32_t pitch,
-                              const uint8_t *flags);
-
-/**
- *  DC-only two-dimensional inverse slant transform.
- *  Performing the inverse slant transform in this case is equivalent to
- *  spreading (DC_coeff + 1)/2 over the whole block.
- *  It works much faster than performing the slant transform on a vector of zeroes.
- *
- *  @param  in          [in]  pointer to the dc coefficient
- *  @param  out         [out] pointer to the output buffer (frame)
- *  @param  pitch       [in]  pitch to move to the next y line
- *  @param  blk_size    [in]  transform block size
- */
-void ff_ivi_dc_slant_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
-
-/**
- *  inverse 1D row slant transform
- *
- *  @param  in      [in]  pointer to the vector of transform coefficients
- *  @param  out     [out] pointer to the output buffer (frame)
- *  @param  pitch   [in]  pitch to move to the next y line
- *  @param  flags   [in]  pointer to the array of column flags (unused here)
- */
-void ff_ivi_row_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
-                       const uint8_t *flags);
-
-/**
- *  inverse 1D column slant transform
- *
- *  @param  in      [in]  pointer to the vector of transform coefficients
- *  @param  out     [out] pointer to the output buffer (frame)
- *  @param  pitch   [in]  pitch to move to the next y line
- *  @param  flags   [in]  pointer to the array of column flags:
- *                        != 0 - non_empty column, 0 - empty one
- *                        (this array must be filled by caller)
- */
-void ff_ivi_col_slant8(const int32_t *in, int16_t *out, uint32_t pitch,
-                       const uint8_t *flags);
-
-/**
- *  DC-only inverse row slant transform
- */
-void ff_ivi_dc_row_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
-
-/**
- *  DC-only inverse column slant transform
- */
-void ff_ivi_dc_col_slant(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
-
-/**
- *  Copies the pixels into the frame buffer.
- */
-void ff_ivi_put_pixels_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags);
-
-/**
- *  Copies the DC coefficient into the first pixel of the block and
- *  zeroes all others.
- */
-void ff_ivi_put_dc_pixel_8x8(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size);
-
-/**
- *  8x8 block motion compensation with adding delta
- *
- *  @param  buf     [in,out] pointer to the block in the current frame buffer containing delta
- *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
- *  @param  pitch   [in]     pitch for moving to the next y line
- *  @param  mc_type [in]     interpolation type
- */
-void ff_ivi_mc_8x8_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
-
-/**
- *  4x4 block motion compensation with adding delta
- *
- *  @param  buf     [in,out] pointer to the block in the current frame buffer containing delta
- *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
- *  @param  pitch   [in]     pitch for moving to the next y line
- *  @param  mc_type [in]     interpolation type
- */
-void ff_ivi_mc_4x4_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
-
-/**
- *  motion compensation without adding delta
- *
- *  @param  buf     [in,out] pointer to the block in the current frame receiving the result
- *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
- *  @param  pitch   [in]     pitch for moving to the next y line
- *  @param  mc_type [in]     interpolation type
- */
-void ff_ivi_mc_8x8_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
-
-/**
- *  4x4 block motion compensation without adding delta
- *
- *  @param  buf     [in,out] pointer to the block in the current frame receiving the result
- *  @param  ref_buf [in]     pointer to the corresponding block in the reference frame
- *  @param  pitch   [in]     pitch for moving to the next y line
- *  @param  mc_type [in]     interpolation type
- */
-void ff_ivi_mc_4x4_no_delta(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
-
-#endif /* AVCODEC_IVI_DSP_H */
diff --git a/libavcodec/jfdctfst.c b/libavcodec/jfdctfst.c
deleted file mode 100644
index b911909..0000000
--- a/libavcodec/jfdctfst.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * jfdctfst.c
- *
- * This file is part of the Independent JPEG Group's software.
- *
- * The authors make NO WARRANTY or representation, either express or implied,
- * with respect to this software, its quality, accuracy, merchantability, or
- * fitness for a particular purpose.  This software is provided "AS IS", and
- * you, its user, assume the entire risk as to its quality and accuracy.
- *
- * This software is copyright (C) 1994-1996, Thomas G. Lane.
- * All Rights Reserved except as specified below.
- *
- * Permission is hereby granted to use, copy, modify, and distribute this
- * software (or portions thereof) for any purpose, without fee, subject to
- * these conditions:
- * (1) If any part of the source code for this software is distributed, then
- * this README file must be included, with this copyright and no-warranty
- * notice unaltered; and any additions, deletions, or changes to the original
- * files must be clearly indicated in accompanying documentation.
- * (2) If only executable code is distributed, then the accompanying
- * documentation must state that "this software is based in part on the work
- * of the Independent JPEG Group".
- * (3) Permission for use of this software is granted only if the user accepts
- * full responsibility for any undesirable consequences; the authors accept
- * NO LIABILITY for damages of any kind.
- *
- * These conditions apply to any software derived from or based on the IJG
- * code, not just to the unmodified library.  If you use our work, you ought
- * to acknowledge us.
- *
- * Permission is NOT granted for the use of any IJG author's name or company
- * name in advertising or publicity relating to this software or products
- * derived from it.  This software may be referred to only as "the Independent
- * JPEG Group's software".
- *
- * We specifically permit and encourage the use of this software as the basis
- * of commercial products, provided that all warranty or liability claims are
- * assumed by the product vendor.
- *
- * This file contains a fast, not so accurate integer implementation of the
- * forward DCT (Discrete Cosine Transform).
- *
- * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
- * on each column.  Direct algorithms are also available, but they are
- * much more complex and seem not to be any faster when reduced to code.
- *
- * This implementation is based on Arai, Agui, and Nakajima's algorithm for
- * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in
- * Japanese, but the algorithm is described in the Pennebaker & Mitchell
- * JPEG textbook (see REFERENCES section in file README).  The following code
- * is based directly on figure 4-8 in P&M.
- * While an 8-point DCT cannot be done in less than 11 multiplies, it is
- * possible to arrange the computation so that many of the multiplies are
- * simple scalings of the final outputs.  These multiplies can then be
- * folded into the multiplications or divisions by the JPEG quantization
- * table entries.  The AA&N method leaves only 5 multiplies and 29 adds
- * to be done in the DCT itself.
- * The primary disadvantage of this method is that with fixed-point math,
- * accuracy is lost due to imprecise representation of the scaled
- * quantization values.  The smaller the quantization table entry, the less
- * precise the scaled value, so this implementation does worse with high-
- * quality-setting files than with low-quality ones.
- */
-
-/**
- * @file
- * Independent JPEG Group's fast AAN dct.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "libavutil/common.h"
-#include "dsputil.h"
-
-#define DCTSIZE 8
-#define GLOBAL(x) x
-#define RIGHT_SHIFT(x, n) ((x) >> (n))
-
-/*
- * This module is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
-  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/* Scaling decisions are generally the same as in the LL&M algorithm;
- * see jfdctint.c for more details.  However, we choose to descale
- * (right shift) multiplication products as soon as they are formed,
- * rather than carrying additional fractional bits into subsequent additions.
- * This compromises accuracy slightly, but it lets us save a few shifts.
- * More importantly, 16-bit arithmetic is then adequate (for 8-bit samples)
- * everywhere except in the multiplications proper; this saves a good deal
- * of work on 16-bit-int machines.
- *
- * Again to save a few shifts, the intermediate results between pass 1 and
- * pass 2 are not upscaled, but are represented only to integral precision.
- *
- * A final compromise is to represent the multiplicative constants to only
- * 8 fractional bits, rather than 13.  This saves some shifting work on some
- * machines, and may also reduce the cost of multiplication (since there
- * are fewer one-bits in the constants).
- */
-
-#define CONST_BITS  8
-
-
-/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
- * causing a lot of useless floating-point operations at run time.
- * To get around this we use the following pre-calculated constants.
- * If you change CONST_BITS you may want to add appropriate values.
- * (With a reasonable C compiler, you can just rely on the FIX() macro...)
- */
-
-#if CONST_BITS == 8
-#define FIX_0_382683433  ((int32_t)   98)       /* FIX(0.382683433) */
-#define FIX_0_541196100  ((int32_t)  139)       /* FIX(0.541196100) */
-#define FIX_0_707106781  ((int32_t)  181)       /* FIX(0.707106781) */
-#define FIX_1_306562965  ((int32_t)  334)       /* FIX(1.306562965) */
-#else
-#define FIX_0_382683433  FIX(0.382683433)
-#define FIX_0_541196100  FIX(0.541196100)
-#define FIX_0_707106781  FIX(0.707106781)
-#define FIX_1_306562965  FIX(1.306562965)
-#endif
-
-
-/* We can gain a little more speed, with a further compromise in accuracy,
- * by omitting the addition in a descaling shift.  This yields an incorrectly
- * rounded result half the time...
- */
-
-#ifndef USE_ACCURATE_ROUNDING
-#undef DESCALE
-#define DESCALE(x,n)  RIGHT_SHIFT(x, n)
-#endif
-
-
-/* Multiply a DCTELEM variable by an int32_t constant, and immediately
- * descale to yield a DCTELEM result.
- */
-
-#define MULTIPLY(var,const)  ((DCTELEM) DESCALE((var) * (const), CONST_BITS))
-
-static av_always_inline void row_fdct(DCTELEM * data){
-  int_fast16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-  int_fast16_t tmp10, tmp11, tmp12, tmp13;
-  int_fast16_t z1, z2, z3, z4, z5, z11, z13;
-  DCTELEM *dataptr;
-  int ctr;
-
-  /* Pass 1: process rows. */
-
-  dataptr = data;
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
-    tmp0 = dataptr[0] + dataptr[7];
-    tmp7 = dataptr[0] - dataptr[7];
-    tmp1 = dataptr[1] + dataptr[6];
-    tmp6 = dataptr[1] - dataptr[6];
-    tmp2 = dataptr[2] + dataptr[5];
-    tmp5 = dataptr[2] - dataptr[5];
-    tmp3 = dataptr[3] + dataptr[4];
-    tmp4 = dataptr[3] - dataptr[4];
-
-    /* Even part */
-
-    tmp10 = tmp0 + tmp3;        /* phase 2 */
-    tmp13 = tmp0 - tmp3;
-    tmp11 = tmp1 + tmp2;
-    tmp12 = tmp1 - tmp2;
-
-    dataptr[0] = tmp10 + tmp11; /* phase 3 */
-    dataptr[4] = tmp10 - tmp11;
-
-    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
-    dataptr[2] = tmp13 + z1;    /* phase 5 */
-    dataptr[6] = tmp13 - z1;
-
-    /* Odd part */
-
-    tmp10 = tmp4 + tmp5;        /* phase 2 */
-    tmp11 = tmp5 + tmp6;
-    tmp12 = tmp6 + tmp7;
-
-    /* The rotator is modified from fig 4-8 to avoid extra negations. */
-    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
-    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5;    /* c2-c6 */
-    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5;    /* c2+c6 */
-    z3 = MULTIPLY(tmp11, FIX_0_707106781);         /* c4 */
-
-    z11 = tmp7 + z3;            /* phase 5 */
-    z13 = tmp7 - z3;
-
-    dataptr[5] = z13 + z2;      /* phase 6 */
-    dataptr[3] = z13 - z2;
-    dataptr[1] = z11 + z4;
-    dataptr[7] = z11 - z4;
-
-    dataptr += DCTSIZE;         /* advance pointer to next row */
-  }
-}
-
-/*
- * Perform the forward DCT on one block of samples.
- */
-
-GLOBAL(void)
-fdct_ifast (DCTELEM * data)
-{
-  int_fast16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-  int_fast16_t tmp10, tmp11, tmp12, tmp13;
-  int_fast16_t z1, z2, z3, z4, z5, z11, z13;
-  DCTELEM *dataptr;
-  int ctr;
-
-  row_fdct(data);
-
-  /* Pass 2: process columns. */
-
-  dataptr = data;
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
-    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
-    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
-    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
-    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
-    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
-    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
-    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
-    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
-
-    /* Even part */
-
-    tmp10 = tmp0 + tmp3;        /* phase 2 */
-    tmp13 = tmp0 - tmp3;
-    tmp11 = tmp1 + tmp2;
-    tmp12 = tmp1 - tmp2;
-
-    dataptr[DCTSIZE*0] = tmp10 + tmp11; /* phase 3 */
-    dataptr[DCTSIZE*4] = tmp10 - tmp11;
-
-    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
-    dataptr[DCTSIZE*2] = tmp13 + z1; /* phase 5 */
-    dataptr[DCTSIZE*6] = tmp13 - z1;
-
-    /* Odd part */
-
-    tmp10 = tmp4 + tmp5;        /* phase 2 */
-    tmp11 = tmp5 + tmp6;
-    tmp12 = tmp6 + tmp7;
-
-    /* The rotator is modified from fig 4-8 to avoid extra negations. */
-    z5 = MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
-    z2 = MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
-    z4 = MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
-    z3 = MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
-
-    z11 = tmp7 + z3;            /* phase 5 */
-    z13 = tmp7 - z3;
-
-    dataptr[DCTSIZE*5] = z13 + z2; /* phase 6 */
-    dataptr[DCTSIZE*3] = z13 - z2;
-    dataptr[DCTSIZE*1] = z11 + z4;
-    dataptr[DCTSIZE*7] = z11 - z4;
-
-    dataptr++;                  /* advance pointer to next column */
-  }
-}
-
-/*
- * Perform the forward 2-4-8 DCT on one block of samples.
- */
-
-GLOBAL(void)
-fdct_ifast248 (DCTELEM * data)
-{
-  int_fast16_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-  int_fast16_t tmp10, tmp11, tmp12, tmp13;
-  int_fast16_t z1;
-  DCTELEM *dataptr;
-  int ctr;
-
-  row_fdct(data);
-
-  /* Pass 2: process columns. */
-
-  dataptr = data;
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
-    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*1];
-    tmp1 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*3];
-    tmp2 = dataptr[DCTSIZE*4] + dataptr[DCTSIZE*5];
-    tmp3 = dataptr[DCTSIZE*6] + dataptr[DCTSIZE*7];
-    tmp4 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*1];
-    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*3];
-    tmp6 = dataptr[DCTSIZE*4] - dataptr[DCTSIZE*5];
-    tmp7 = dataptr[DCTSIZE*6] - dataptr[DCTSIZE*7];
-
-    /* Even part */
-
-    tmp10 = tmp0 + tmp3;
-    tmp11 = tmp1 + tmp2;
-    tmp12 = tmp1 - tmp2;
-    tmp13 = tmp0 - tmp3;
-
-    dataptr[DCTSIZE*0] = tmp10 + tmp11;
-    dataptr[DCTSIZE*4] = tmp10 - tmp11;
-
-    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781);
-    dataptr[DCTSIZE*2] = tmp13 + z1;
-    dataptr[DCTSIZE*6] = tmp13 - z1;
-
-    tmp10 = tmp4 + tmp7;
-    tmp11 = tmp5 + tmp6;
-    tmp12 = tmp5 - tmp6;
-    tmp13 = tmp4 - tmp7;
-
-    dataptr[DCTSIZE*1] = tmp10 + tmp11;
-    dataptr[DCTSIZE*5] = tmp10 - tmp11;
-
-    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_707106781);
-    dataptr[DCTSIZE*3] = tmp13 + z1;
-    dataptr[DCTSIZE*7] = tmp13 - z1;
-
-    dataptr++;                        /* advance pointer to next column */
-  }
-}
-
-
-#undef GLOBAL
-#undef CONST_BITS
-#undef DESCALE
-#undef FIX_0_541196100
-#undef FIX_1_306562965
diff --git a/libavcodec/jfdctint.c b/libavcodec/jfdctint.c
deleted file mode 100644
index f6e8c4e..0000000
--- a/libavcodec/jfdctint.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * jfdctint.c
- *
- * This file is part of the Independent JPEG Group's software.
- *
- * The authors make NO WARRANTY or representation, either express or implied,
- * with respect to this software, its quality, accuracy, merchantability, or
- * fitness for a particular purpose.  This software is provided "AS IS", and
- * you, its user, assume the entire risk as to its quality and accuracy.
- *
- * This software is copyright (C) 1991-1996, Thomas G. Lane.
- * All Rights Reserved except as specified below.
- *
- * Permission is hereby granted to use, copy, modify, and distribute this
- * software (or portions thereof) for any purpose, without fee, subject to
- * these conditions:
- * (1) If any part of the source code for this software is distributed, then
- * this README file must be included, with this copyright and no-warranty
- * notice unaltered; and any additions, deletions, or changes to the original
- * files must be clearly indicated in accompanying documentation.
- * (2) If only executable code is distributed, then the accompanying
- * documentation must state that "this software is based in part on the work
- * of the Independent JPEG Group".
- * (3) Permission for use of this software is granted only if the user accepts
- * full responsibility for any undesirable consequences; the authors accept
- * NO LIABILITY for damages of any kind.
- *
- * These conditions apply to any software derived from or based on the IJG
- * code, not just to the unmodified library.  If you use our work, you ought
- * to acknowledge us.
- *
- * Permission is NOT granted for the use of any IJG author's name or company
- * name in advertising or publicity relating to this software or products
- * derived from it.  This software may be referred to only as "the Independent
- * JPEG Group's software".
- *
- * We specifically permit and encourage the use of this software as the basis
- * of commercial products, provided that all warranty or liability claims are
- * assumed by the product vendor.
- *
- * This file contains a slow-but-accurate integer implementation of the
- * forward DCT (Discrete Cosine Transform).
- *
- * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
- * on each column.  Direct algorithms are also available, but they are
- * much more complex and seem not to be any faster when reduced to code.
- *
- * This implementation is based on an algorithm described in
- *   C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
- *   Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
- *   Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
- * The primary algorithm described there uses 11 multiplies and 29 adds.
- * We use their alternate method with 12 multiplies and 32 adds.
- * The advantage of this method is that no data path contains more than one
- * multiplication; this allows a very simple and accurate implementation in
- * scaled fixed-point arithmetic, with a minimal number of shifts.
- */
-
-/**
- * @file
- * Independent JPEG Group's slow & accurate dct.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "libavutil/common.h"
-#include "dsputil.h"
-
-#define DCTSIZE 8
-#define BITS_IN_JSAMPLE 8
-#define GLOBAL(x) x
-#define RIGHT_SHIFT(x, n) ((x) >> (n))
-#define MULTIPLY16C16(var,const) ((var)*(const))
-
-#if 1 //def USE_ACCURATE_ROUNDING
-#define DESCALE(x,n)  RIGHT_SHIFT((x) + (1 << ((n) - 1)), n)
-#else
-#define DESCALE(x,n)  RIGHT_SHIFT(x, n)
-#endif
-
-
-/*
- * This module is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
-  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/*
- * The poop on this scaling stuff is as follows:
- *
- * Each 1-D DCT step produces outputs which are a factor of sqrt(N)
- * larger than the true DCT outputs.  The final outputs are therefore
- * a factor of N larger than desired; since N=8 this can be cured by
- * a simple right shift at the end of the algorithm.  The advantage of
- * this arrangement is that we save two multiplications per 1-D DCT,
- * because the y0 and y4 outputs need not be divided by sqrt(N).
- * In the IJG code, this factor of 8 is removed by the quantization step
- * (in jcdctmgr.c), NOT in this module.
- *
- * We have to do addition and subtraction of the integer inputs, which
- * is no problem, and multiplication by fractional constants, which is
- * a problem to do in integer arithmetic.  We multiply all the constants
- * by CONST_SCALE and convert them to integer constants (thus retaining
- * CONST_BITS bits of precision in the constants).  After doing a
- * multiplication we have to divide the product by CONST_SCALE, with proper
- * rounding, to produce the correct output.  This division can be done
- * cheaply as a right shift of CONST_BITS bits.  We postpone shifting
- * as long as possible so that partial sums can be added together with
- * full fractional precision.
- *
- * The outputs of the first pass are scaled up by PASS1_BITS bits so that
- * they are represented to better-than-integral precision.  These outputs
- * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
- * with the recommended scaling.  (For 12-bit sample data, the intermediate
- * array is int32_t anyway.)
- *
- * To avoid overflow of the 32-bit intermediate results in pass 2, we must
- * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26.  Error analysis
- * shows that the values given below are the most effective.
- */
-
-#if BITS_IN_JSAMPLE == 8
-#define CONST_BITS  13
-#define PASS1_BITS  4   /* set this to 2 if 16x16 multiplies are faster */
-#else
-#define CONST_BITS  13
-#define PASS1_BITS  1   /* lose a little precision to avoid overflow */
-#endif
-
-/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
- * causing a lot of useless floating-point operations at run time.
- * To get around this we use the following pre-calculated constants.
- * If you change CONST_BITS you may want to add appropriate values.
- * (With a reasonable C compiler, you can just rely on the FIX() macro...)
- */
-
-#if CONST_BITS == 13
-#define FIX_0_298631336  ((int32_t)  2446)      /* FIX(0.298631336) */
-#define FIX_0_390180644  ((int32_t)  3196)      /* FIX(0.390180644) */
-#define FIX_0_541196100  ((int32_t)  4433)      /* FIX(0.541196100) */
-#define FIX_0_765366865  ((int32_t)  6270)      /* FIX(0.765366865) */
-#define FIX_0_899976223  ((int32_t)  7373)      /* FIX(0.899976223) */
-#define FIX_1_175875602  ((int32_t)  9633)      /* FIX(1.175875602) */
-#define FIX_1_501321110  ((int32_t)  12299)     /* FIX(1.501321110) */
-#define FIX_1_847759065  ((int32_t)  15137)     /* FIX(1.847759065) */
-#define FIX_1_961570560  ((int32_t)  16069)     /* FIX(1.961570560) */
-#define FIX_2_053119869  ((int32_t)  16819)     /* FIX(2.053119869) */
-#define FIX_2_562915447  ((int32_t)  20995)     /* FIX(2.562915447) */
-#define FIX_3_072711026  ((int32_t)  25172)     /* FIX(3.072711026) */
-#else
-#define FIX_0_298631336  FIX(0.298631336)
-#define FIX_0_390180644  FIX(0.390180644)
-#define FIX_0_541196100  FIX(0.541196100)
-#define FIX_0_765366865  FIX(0.765366865)
-#define FIX_0_899976223  FIX(0.899976223)
-#define FIX_1_175875602  FIX(1.175875602)
-#define FIX_1_501321110  FIX(1.501321110)
-#define FIX_1_847759065  FIX(1.847759065)
-#define FIX_1_961570560  FIX(1.961570560)
-#define FIX_2_053119869  FIX(2.053119869)
-#define FIX_2_562915447  FIX(2.562915447)
-#define FIX_3_072711026  FIX(3.072711026)
-#endif
-
-
-/* Multiply an int32_t variable by an int32_t constant to yield an int32_t result.
- * For 8-bit samples with the recommended scaling, all the variable
- * and constant values involved are no more than 16 bits wide, so a
- * 16x16->32 bit multiply can be used instead of a full 32x32 multiply.
- * For 12-bit samples, a full 32-bit multiplication will be needed.
- */
-
-#if BITS_IN_JSAMPLE == 8 && CONST_BITS<=13 && PASS1_BITS<=2
-#define MULTIPLY(var,const)  MULTIPLY16C16(var,const)
-#else
-#define MULTIPLY(var,const)  ((var) * (const))
-#endif
-
-
-static av_always_inline void row_fdct(DCTELEM * data){
-  int_fast32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-  int_fast32_t tmp10, tmp11, tmp12, tmp13;
-  int_fast32_t z1, z2, z3, z4, z5;
-  DCTELEM *dataptr;
-  int ctr;
-
-  /* Pass 1: process rows. */
-  /* Note results are scaled up by sqrt(8) compared to a true DCT; */
-  /* furthermore, we scale the results by 2**PASS1_BITS. */
-
-  dataptr = data;
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
-    tmp0 = dataptr[0] + dataptr[7];
-    tmp7 = dataptr[0] - dataptr[7];
-    tmp1 = dataptr[1] + dataptr[6];
-    tmp6 = dataptr[1] - dataptr[6];
-    tmp2 = dataptr[2] + dataptr[5];
-    tmp5 = dataptr[2] - dataptr[5];
-    tmp3 = dataptr[3] + dataptr[4];
-    tmp4 = dataptr[3] - dataptr[4];
-
-    /* Even part per LL&M figure 1 --- note that published figure is faulty;
-     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
-     */
-
-    tmp10 = tmp0 + tmp3;
-    tmp13 = tmp0 - tmp3;
-    tmp11 = tmp1 + tmp2;
-    tmp12 = tmp1 - tmp2;
-
-    dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
-    dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
-
-    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
-    dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
-                                   CONST_BITS-PASS1_BITS);
-    dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
-                                   CONST_BITS-PASS1_BITS);
-
-    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
-     * cK represents cos(K*pi/16).
-     * i0..i3 in the paper are tmp4..tmp7 here.
-     */
-
-    z1 = tmp4 + tmp7;
-    z2 = tmp5 + tmp6;
-    z3 = tmp4 + tmp6;
-    z4 = tmp5 + tmp7;
-    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
-    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
-    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
-    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
-    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
-    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
-    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
-    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
-    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
-    z3 += z5;
-    z4 += z5;
-
-    dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
-    dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
-    dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
-    dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
-
-    dataptr += DCTSIZE;         /* advance pointer to next row */
-  }
-}
-
-/*
- * Perform the forward DCT on one block of samples.
- */
-
-GLOBAL(void)
-ff_jpeg_fdct_islow (DCTELEM * data)
-{
-  int_fast32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-  int_fast32_t tmp10, tmp11, tmp12, tmp13;
-  int_fast32_t z1, z2, z3, z4, z5;
-  DCTELEM *dataptr;
-  int ctr;
-
-  row_fdct(data);
-
-  /* Pass 2: process columns.
-   * We remove the PASS1_BITS scaling, but leave the results scaled up
-   * by an overall factor of 8.
-   */
-
-  dataptr = data;
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
-    tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*7];
-    tmp7 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*7];
-    tmp1 = dataptr[DCTSIZE*1] + dataptr[DCTSIZE*6];
-    tmp6 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*6];
-    tmp2 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*5];
-    tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*5];
-    tmp3 = dataptr[DCTSIZE*3] + dataptr[DCTSIZE*4];
-    tmp4 = dataptr[DCTSIZE*3] - dataptr[DCTSIZE*4];
-
-    /* Even part per LL&M figure 1 --- note that published figure is faulty;
-     * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
-     */
-
-    tmp10 = tmp0 + tmp3;
-    tmp13 = tmp0 - tmp3;
-    tmp11 = tmp1 + tmp2;
-    tmp12 = tmp1 - tmp2;
-
-    dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
-    dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
-
-    z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
-    dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
-                                           CONST_BITS+PASS1_BITS);
-    dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
-                                           CONST_BITS+PASS1_BITS);
-
-    /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
-     * cK represents cos(K*pi/16).
-     * i0..i3 in the paper are tmp4..tmp7 here.
-     */
-
-    z1 = tmp4 + tmp7;
-    z2 = tmp5 + tmp6;
-    z3 = tmp4 + tmp6;
-    z4 = tmp5 + tmp7;
-    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
-    tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
-    tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
-    tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
-    tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
-    z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
-    z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
-    z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
-    z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
-    z3 += z5;
-    z4 += z5;
-
-    dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp4 + z1 + z3,
-                                           CONST_BITS+PASS1_BITS);
-    dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp5 + z2 + z4,
-                                           CONST_BITS+PASS1_BITS);
-    dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp6 + z2 + z3,
-                                           CONST_BITS+PASS1_BITS);
-    dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp7 + z1 + z4,
-                                           CONST_BITS+PASS1_BITS);
-
-    dataptr++;                  /* advance pointer to next column */
-  }
-}
-
-/*
- * The secret of DCT2-4-8 is really simple -- you do the usual 1-DCT
- * on the rows and then, instead of doing even and odd, part on the colums
- * you do even part two times.
- */
-GLOBAL(void)
-ff_fdct248_islow (DCTELEM * data)
-{
-  int_fast32_t tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-  int_fast32_t tmp10, tmp11, tmp12, tmp13;
-  int_fast32_t z1;
-  DCTELEM *dataptr;
-  int ctr;
-
-  row_fdct(data);
-
-  /* Pass 2: process columns.
-   * We remove the PASS1_BITS scaling, but leave the results scaled up
-   * by an overall factor of 8.
-   */
-
-  dataptr = data;
-  for (ctr = DCTSIZE-1; ctr >= 0; ctr--) {
-     tmp0 = dataptr[DCTSIZE*0] + dataptr[DCTSIZE*1];
-     tmp1 = dataptr[DCTSIZE*2] + dataptr[DCTSIZE*3];
-     tmp2 = dataptr[DCTSIZE*4] + dataptr[DCTSIZE*5];
-     tmp3 = dataptr[DCTSIZE*6] + dataptr[DCTSIZE*7];
-     tmp4 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*1];
-     tmp5 = dataptr[DCTSIZE*2] - dataptr[DCTSIZE*3];
-     tmp6 = dataptr[DCTSIZE*4] - dataptr[DCTSIZE*5];
-     tmp7 = dataptr[DCTSIZE*6] - dataptr[DCTSIZE*7];
-
-     tmp10 = tmp0 + tmp3;
-     tmp11 = tmp1 + tmp2;
-     tmp12 = tmp1 - tmp2;
-     tmp13 = tmp0 - tmp3;
-
-     dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
-     dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
-
-     z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
-     dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
-                                            CONST_BITS+PASS1_BITS);
-     dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
-                                            CONST_BITS+PASS1_BITS);
-
-     tmp10 = tmp4 + tmp7;
-     tmp11 = tmp5 + tmp6;
-     tmp12 = tmp5 - tmp6;
-     tmp13 = tmp4 - tmp7;
-
-     dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp10 + tmp11, PASS1_BITS);
-     dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp10 - tmp11, PASS1_BITS);
-
-     z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
-     dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
-                                            CONST_BITS+PASS1_BITS);
-     dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
-                                            CONST_BITS+PASS1_BITS);
-
-     dataptr++;                 /* advance pointer to next column */
-  }
-}
diff --git a/libavcodec/jpegls.c b/libavcodec/jpegls.c
deleted file mode 100644
index c40b929..0000000
--- a/libavcodec/jpegls.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * JPEG-LS common code
- * Copyright (c) 2003 Michael Niedermayer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * JPEG-LS common code.
- */
-
-#include "jpegls.h"
-
-void ff_jpegls_init_state(JLSState *state){
-    int i;
-
-    state->twonear = state->near * 2 + 1;
-    state->range = ((state->maxval + state->twonear - 1) / state->twonear) + 1;
-
-    // QBPP = ceil(log2(RANGE))
-    for(state->qbpp = 0; (1 << state->qbpp) < state->range; state->qbpp++);
-
-    if(state->bpp < 8)
-        state->limit = 16 + 2 * state->bpp - state->qbpp;
-    else
-        state->limit = (4 * state->bpp) - state->qbpp;
-
-    for(i = 0; i < 367; i++) {
-        state->A[i] = FFMAX((state->range + 32) >> 6, 2);
-        state->N[i] = 1;
-    }
-
-}
-
-/**
- * Custom value clipping function used in T1, T2, T3 calculation
- */
-static inline int iso_clip(int v, int vmin, int vmax){
-    if(v > vmax || v < vmin) return vmin;
-    else                     return v;
-}
-
-void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all){
-    const int basic_t1= 3;
-    const int basic_t2= 7;
-    const int basic_t3= 21;
-    int factor;
-
-    if(s->maxval==0 || reset_all) s->maxval= (1 << s->bpp) - 1;
-
-    if(s->maxval >=128){
-        factor= (FFMIN(s->maxval, 4095) + 128)>>8;
-
-        if(s->T1==0     || reset_all)
-            s->T1= iso_clip(factor*(basic_t1-2) + 2 + 3*s->near, s->near+1, s->maxval);
-        if(s->T2==0     || reset_all)
-            s->T2= iso_clip(factor*(basic_t2-3) + 3 + 5*s->near, s->T1, s->maxval);
-        if(s->T3==0     || reset_all)
-            s->T3= iso_clip(factor*(basic_t3-4) + 4 + 7*s->near, s->T2, s->maxval);
-    }else{
-        factor= 256 / (s->maxval + 1);
-
-        if(s->T1==0     || reset_all)
-            s->T1= iso_clip(FFMAX(2, basic_t1/factor + 3*s->near), s->near+1, s->maxval);
-        if(s->T2==0     || reset_all)
-            s->T2= iso_clip(FFMAX(3, basic_t2/factor + 5*s->near), s->T1, s->maxval);
-        if(s->T3==0     || reset_all)
-            s->T3= iso_clip(FFMAX(4, basic_t3/factor + 7*s->near), s->T2, s->maxval);
-    }
-
-    if(s->reset==0  || reset_all) s->reset= 64;
-//    av_log(NULL, AV_LOG_DEBUG, "[JPEG-LS RESET] T=%i,%i,%i\n", s->T1, s->T2, s->T3);
-}
diff --git a/libavcodec/jpegls.h b/libavcodec/jpegls.h
deleted file mode 100644
index 28c7524..0000000
--- a/libavcodec/jpegls.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * JPEG-LS common code
- * Copyright (c) 2003 Michael Niedermayer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * JPEG-LS common code.
- */
-
-#ifndef AVCODEC_JPEGLS_H
-#define AVCODEC_JPEGLS_H
-
-#include "avcodec.h"
-
-typedef struct JpeglsContext{
-    AVCodecContext *avctx;
-    AVFrame picture;
-}JpeglsContext;
-
-typedef struct JLSState{
-    int T1, T2, T3;
-    int A[367], B[367], C[365], N[367];
-    int limit, reset, bpp, qbpp, maxval, range;
-    int near, twonear;
-    int run_index[3];
-}JLSState;
-
-extern const uint8_t ff_log2_run[32];
-
-/**
- * Calculate initial JPEG-LS parameters
- */
-void ff_jpegls_init_state(JLSState *state);
-
-/**
- * Calculate quantized gradient value, used for context determination
- */
-static inline int ff_jpegls_quantize(JLSState *s, int v){ //FIXME optimize
-    if(v==0) return 0;
-    if(v < 0){
-        if(v <= -s->T3) return -4;
-        if(v <= -s->T2) return -3;
-        if(v <= -s->T1) return -2;
-        if(v <  -s->near) return -1;
-        return 0;
-    }else{
-        if(v <= s->near) return 0;
-        if(v <  s->T1) return 1;
-        if(v <  s->T2) return 2;
-        if(v <  s->T3) return 3;
-        return 4;
-    }
-}
-
-/**
- * Calculate JPEG-LS codec values
- */
-void ff_jpegls_reset_coding_parameters(JLSState *s, int reset_all);
-
-
-static inline void ff_jpegls_downscale_state(JLSState *state, int Q){
-    if(state->N[Q] == state->reset){
-        state->A[Q] >>=1;
-        state->B[Q] >>=1;
-        state->N[Q] >>=1;
-    }
-    state->N[Q]++;
-}
-
-static inline int ff_jpegls_update_state_regular(JLSState *state, int Q, int err){
-    state->A[Q] += FFABS(err);
-    err *= state->twonear;
-    state->B[Q] += err;
-
-    ff_jpegls_downscale_state(state, Q);
-
-    if(state->B[Q] <= -state->N[Q]) {
-        state->B[Q]= FFMAX(state->B[Q] + state->N[Q], 1-state->N[Q]);
-        if(state->C[Q] > -128)
-            state->C[Q]--;
-    }else if(state->B[Q] > 0){
-        state->B[Q]= FFMIN(state->B[Q] - state->N[Q], 0);
-        if(state->C[Q] < 127)
-            state->C[Q]++;
-    }
-
-    return err;
-}
-
-#define R(a, i   ) (bits == 8 ?  ((uint8_t*)(a))[i]    :  ((uint16_t*)(a))[i]  )
-#define W(a, i, v) (bits == 8 ? (((uint8_t*)(a))[i]=v) : (((uint16_t*)(a))[i]=v))
-
-#endif /* AVCODEC_JPEGLS_H */
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
deleted file mode 100644
index 6b7dd94..0000000
--- a/libavcodec/jpeglsdec.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * JPEG-LS decoder
- * Copyright (c) 2003 Michael Niedermayer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * JPEG-LS decoder.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-#include "mathops.h"
-#include "mjpeg.h"
-#include "mjpegdec.h"
-#include "jpegls.h"
-#include "jpeglsdec.h"
-
-
-/*
-* Uncomment this to significantly speed up decoding of broken JPEG-LS
-* (or test broken JPEG-LS decoder) and slow down ordinary decoding a bit.
-*
-* There is no Golomb code with length >= 32 bits possible, so check and
-* avoid situation of 32 zeros, FFmpeg Golomb decoder is painfully slow
-* on this errors.
-*/
-//#define JLS_BROKEN
-
-
-/**
- * Decode LSE block with initialization parameters
- */
-int ff_jpegls_decode_lse(MJpegDecodeContext *s)
-{
-    int len, id;
-
-    /* XXX: verify len field validity */
-    len = get_bits(&s->gb, 16);
-    id = get_bits(&s->gb, 8);
-
-    switch(id){
-    case 1:
-        s->maxval= get_bits(&s->gb, 16);
-        s->t1= get_bits(&s->gb, 16);
-        s->t2= get_bits(&s->gb, 16);
-        s->t3= get_bits(&s->gb, 16);
-        s->reset= get_bits(&s->gb, 16);
-
-//        ff_jpegls_reset_coding_parameters(s, 0);
-        //FIXME quant table?
-        break;
-    case 2:
-    case 3:
-        av_log(s->avctx, AV_LOG_ERROR, "palette not supported\n");
-        return -1;
-    case 4:
-        av_log(s->avctx, AV_LOG_ERROR, "oversize image not supported\n");
-        return -1;
-    default:
-        av_log(s->avctx, AV_LOG_ERROR, "invalid id %d\n", id);
-        return -1;
-    }
-//    av_log(s->avctx, AV_LOG_DEBUG, "ID=%i, T=%i,%i,%i\n", id, s->t1, s->t2, s->t3);
-
-    return 0;
-}
-
-/**
- * Get context-dependent Golomb code, decode it and update context
- */
-static inline int ls_get_code_regular(GetBitContext *gb, JLSState *state, int Q){
-    int k, ret;
-
-    for(k = 0; (state->N[Q] << k) < state->A[Q]; k++);
-
-#ifdef JLS_BROKEN
-    if(!show_bits_long(gb, 32))return -1;
-#endif
-    ret = get_ur_golomb_jpegls(gb, k, state->limit, state->qbpp);
-
-    /* decode mapped error */
-    if(ret & 1)
-        ret = -((ret + 1) >> 1);
-    else
-        ret >>= 1;
-
-    /* for NEAR=0, k=0 and 2*B[Q] <= - N[Q] mapping is reversed */
-    if(!state->near && !k && (2 * state->B[Q] <= -state->N[Q]))
-        ret = -(ret + 1);
-
-    ret= ff_jpegls_update_state_regular(state, Q, ret);
-
-    return ret;
-}
-
-/**
- * Get Golomb code, decode it and update state for run termination
- */
-static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RItype, int limit_add){
-    int k, ret, temp, map;
-    int Q = 365 + RItype;
-
-    temp=  state->A[Q];
-    if(RItype)
-        temp += state->N[Q] >> 1;
-
-    for(k = 0; (state->N[Q] << k) < temp; k++);
-
-#ifdef JLS_BROKEN
-    if(!show_bits_long(gb, 32))return -1;
-#endif
-    ret = get_ur_golomb_jpegls(gb, k, state->limit - limit_add - 1, state->qbpp);
-
-    /* decode mapped error */
-    map = 0;
-    if(!k && (RItype || ret) && (2 * state->B[Q] < state->N[Q]))
-        map = 1;
-    ret += RItype + map;
-
-    if(ret & 1){
-        ret = map - ((ret + 1) >> 1);
-        state->B[Q]++;
-    } else {
-        ret = ret >> 1;
-    }
-
-    /* update state */
-    state->A[Q] += FFABS(ret) - RItype;
-    ret *= state->twonear;
-    ff_jpegls_downscale_state(state, Q);
-
-    return ret;
-}
-
-/**
- * Decode one line of image
- */
-static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *last, void *dst, int last2, int w, int stride, int comp, int bits){
-    int i, x = 0;
-    int Ra, Rb, Rc, Rd;
-    int D0, D1, D2;
-
-    while(x < w) {
-        int err, pred;
-
-        /* compute gradients */
-        Ra = x ? R(dst, x - stride) : R(last, x);
-        Rb = R(last, x);
-        Rc = x ? R(last, x - stride) : last2;
-        Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
-        D0 = Rd - Rb;
-        D1 = Rb - Rc;
-        D2 = Rc - Ra;
-        /* run mode */
-        if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) {
-            int r;
-            int RItype;
-
-            /* decode full runs while available */
-            while(get_bits1(&s->gb)) {
-                int r;
-                r = 1 << ff_log2_run[state->run_index[comp]];
-                if(x + r * stride > w) {
-                    r = (w - x) / stride;
-                }
-                for(i = 0; i < r; i++) {
-                    W(dst, x, Ra);
-                    x += stride;
-                }
-                /* if EOL reached, we stop decoding */
-                if(r != (1 << ff_log2_run[state->run_index[comp]]))
-                    return;
-                if(state->run_index[comp] < 31)
-                    state->run_index[comp]++;
-                if(x + stride > w)
-                    return;
-            }
-            /* decode aborted run */
-            r = ff_log2_run[state->run_index[comp]];
-            if(r)
-                r = get_bits_long(&s->gb, r);
-            for(i = 0; i < r; i++) {
-                W(dst, x, Ra);
-                x += stride;
-            }
-
-            /* decode run termination value */
-            Rb = R(last, x);
-            RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
-            err = ls_get_code_runterm(&s->gb, state, RItype, ff_log2_run[state->run_index[comp]]);
-            if(state->run_index[comp])
-                state->run_index[comp]--;
-
-            if(state->near && RItype){
-                pred = Ra + err;
-            } else {
-                if(Rb < Ra)
-                    pred = Rb - err;
-                else
-                    pred = Rb + err;
-            }
-        } else { /* regular mode */
-            int context, sign;
-
-            context = ff_jpegls_quantize(state, D0) * 81 + ff_jpegls_quantize(state, D1) * 9 + ff_jpegls_quantize(state, D2);
-            pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
-
-            if(context < 0){
-                context = -context;
-                sign = 1;
-            }else{
-                sign = 0;
-            }
-
-            if(sign){
-                pred = av_clip(pred - state->C[context], 0, state->maxval);
-                err = -ls_get_code_regular(&s->gb, state, context);
-            } else {
-                pred = av_clip(pred + state->C[context], 0, state->maxval);
-                err = ls_get_code_regular(&s->gb, state, context);
-            }
-
-            /* we have to do something more for near-lossless coding */
-            pred += err;
-        }
-        if(state->near){
-            if(pred < -state->near)
-                pred += state->range * state->twonear;
-            else if(pred > state->maxval + state->near)
-                pred -= state->range * state->twonear;
-            pred = av_clip(pred, 0, state->maxval);
-        }
-
-        pred &= state->maxval;
-        W(dst, x, pred);
-        x += stride;
-    }
-}
-
-int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv){
-    int i, t = 0;
-    uint8_t *zero, *last, *cur;
-    JLSState *state;
-    int off = 0, stride = 1, width, shift;
-
-    zero = av_mallocz(s->picture.linesize[0]);
-    last = zero;
-    cur = s->picture.data[0];
-
-    state = av_mallocz(sizeof(JLSState));
-    /* initialize JPEG-LS state from JPEG parameters */
-    state->near = near;
-    state->bpp = (s->bits < 2) ? 2 : s->bits;
-    state->maxval = s->maxval;
-    state->T1 = s->t1;
-    state->T2 = s->t2;
-    state->T3 = s->t3;
-    state->reset = s->reset;
-    ff_jpegls_reset_coding_parameters(state, 0);
-    ff_jpegls_init_state(state);
-
-    if(s->bits <= 8)
-        shift = point_transform + (8 - s->bits);
-    else
-        shift = point_transform + (16 - s->bits);
-
-//    av_log(s->avctx, AV_LOG_DEBUG, "JPEG-LS params: %ix%i NEAR=%i MV=%i T(%i,%i,%i) RESET=%i, LIMIT=%i, qbpp=%i, RANGE=%i\n",s->width,s->height,state->near,state->maxval,state->T1,state->T2,state->T3,state->reset,state->limit,state->qbpp, state->range);
-//    av_log(s->avctx, AV_LOG_DEBUG, "JPEG params: ILV=%i Pt=%i BPP=%i, scan = %i\n", ilv, point_transform, s->bits, s->cur_scan);
-    if(ilv == 0) { /* separate planes */
-        off = s->cur_scan - 1;
-        stride = (s->nb_components > 1) ? 3 : 1;
-        width = s->width * stride;
-        cur += off;
-        for(i = 0; i < s->height; i++) {
-            if(s->bits <= 8){
-                ls_decode_line(state, s, last, cur, t, width, stride, off,  8);
-                t = last[0];
-            }else{
-                ls_decode_line(state, s, last, cur, t, width, stride, off, 16);
-                t = *((uint16_t*)last);
-            }
-            last = cur;
-            cur += s->picture.linesize[0];
-
-            if (s->restart_interval && !--s->restart_count) {
-                align_get_bits(&s->gb);
-                skip_bits(&s->gb, 16); /* skip RSTn */
-            }
-        }
-    } else if(ilv == 1) { /* line interleaving */
-        int j;
-        int Rc[3] = {0, 0, 0};
-        memset(cur, 0, s->picture.linesize[0]);
-        width = s->width * 3;
-        for(i = 0; i < s->height; i++) {
-            for(j = 0; j < 3; j++) {
-                ls_decode_line(state, s, last + j, cur + j, Rc[j], width, 3, j, 8);
-                Rc[j] = last[j];
-
-                if (s->restart_interval && !--s->restart_count) {
-                    align_get_bits(&s->gb);
-                    skip_bits(&s->gb, 16); /* skip RSTn */
-                }
-            }
-            last = cur;
-            cur += s->picture.linesize[0];
-        }
-    } else if(ilv == 2) { /* sample interleaving */
-        av_log(s->avctx, AV_LOG_ERROR, "Sample interleaved images are not supported.\n");
-        av_free(state);
-        av_free(zero);
-        return -1;
-    }
-
-    if(shift){ /* we need to do point transform or normalize samples */
-        int x, w;
-
-        w = s->width * s->nb_components;
-
-        if(s->bits <= 8){
-            uint8_t *src = s->picture.data[0];
-
-            for(i = 0; i < s->height; i++){
-                for(x = off; x < w; x+= stride){
-                    src[x] <<= shift;
-                }
-                src += s->picture.linesize[0];
-            }
-        }else{
-            uint16_t *src = (uint16_t*) s->picture.data[0];
-
-            for(i = 0; i < s->height; i++){
-                for(x = 0; x < w; x++){
-                    src[x] <<= shift;
-                }
-                src += s->picture.linesize[0]/2;
-            }
-        }
-    }
-    av_free(state);
-    av_free(zero);
-
-    return 0;
-}
-
-
-AVCodec jpegls_decoder = {
-    "jpegls",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_JPEGLS,
-    sizeof(MJpegDecodeContext),
-    ff_mjpeg_decode_init,
-    NULL,
-    ff_mjpeg_decode_end,
-    ff_mjpeg_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
-};
diff --git a/libavcodec/jpeglsdec.h b/libavcodec/jpeglsdec.h
deleted file mode 100644
index 5204ecb..0000000
--- a/libavcodec/jpeglsdec.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * JPEG-LS decoder
- * Copyright (c) 2003 Michael Niedermayer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * JPEG-LS decoder.
- */
-
-#ifndef AVCODEC_JPEGLSDEC_H
-#define AVCODEC_JPEGLSDEC_H
-
-#include "mjpeg.h"
-#include "mjpegdec.h"
-
-/**
- * Decode LSE block with initialization parameters
- */
-int ff_jpegls_decode_lse(MJpegDecodeContext *s);
-
-int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transform, int ilv);
-
-#endif /* AVCODEC_JPEGLSDEC_H */
diff --git a/libavcodec/jpeglsenc.c b/libavcodec/jpeglsenc.c
deleted file mode 100644
index 08ef71f..0000000
--- a/libavcodec/jpeglsenc.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * JPEG-LS encoder
- * Copyright (c) 2003 Michael Niedermayer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * JPEG-LS encoder.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-#include "mathops.h"
-#include "dsputil.h"
-#include "mjpeg.h"
-#include "jpegls.h"
-
-
-/**
- * Encode error from regular symbol
- */
-static inline void ls_encode_regular(JLSState *state, PutBitContext *pb, int Q, int err){
-    int k;
-    int val;
-    int map;
-
-    for(k = 0; (state->N[Q] << k) < state->A[Q]; k++);
-
-    map = !state->near && !k && (2 * state->B[Q] <= -state->N[Q]);
-
-    if(err < 0)
-        err += state->range;
-    if(err >= ((state->range + 1) >> 1)) {
-        err -= state->range;
-        val = 2 * FFABS(err) - 1 - map;
-    } else
-        val = 2 * err + map;
-
-    set_ur_golomb_jpegls(pb, val, k, state->limit, state->qbpp);
-
-    ff_jpegls_update_state_regular(state, Q, err);
-}
-
-/**
- * Encode error from run termination
- */
-static inline void ls_encode_runterm(JLSState *state, PutBitContext *pb, int RItype, int err, int limit_add){
-    int k;
-    int val, map;
-    int Q = 365 + RItype;
-    int temp;
-
-    temp = state->A[Q];
-    if(RItype)
-        temp += state->N[Q] >> 1;
-    for(k = 0; (state->N[Q] << k) < temp; k++);
-    map = 0;
-    if(!k && err && (2 * state->B[Q] < state->N[Q]))
-        map = 1;
-
-    if(err < 0)
-        val = - (2 * err) - 1 - RItype + map;
-    else
-        val = 2 * err - RItype - map;
-    set_ur_golomb_jpegls(pb, val, k, state->limit - limit_add - 1, state->qbpp);
-
-    if(err < 0)
-        state->B[Q]++;
-    state->A[Q] += (val + 1 - RItype) >> 1;
-
-    ff_jpegls_downscale_state(state, Q);
-}
-
-/**
- * Encode run value as specified by JPEG-LS standard
- */
-static inline void ls_encode_run(JLSState *state, PutBitContext *pb, int run, int comp, int trail){
-    while(run >= (1 << ff_log2_run[state->run_index[comp]])){
-        put_bits(pb, 1, 1);
-        run -= 1 << ff_log2_run[state->run_index[comp]];
-        if(state->run_index[comp] < 31)
-            state->run_index[comp]++;
-    }
-    /* if hit EOL, encode another full run, else encode aborted run */
-    if(!trail && run) {
-        put_bits(pb, 1, 1);
-    }else if(trail){
-        put_bits(pb, 1, 0);
-        if(ff_log2_run[state->run_index[comp]])
-            put_bits(pb, ff_log2_run[state->run_index[comp]], run);
-    }
-}
-
-/**
- * Encode one line of image
- */
-static inline void ls_encode_line(JLSState *state, PutBitContext *pb, void *last, void *cur, int last2, int w, int stride, int comp, int bits){
-    int x = 0;
-    int Ra, Rb, Rc, Rd;
-    int D0, D1, D2;
-
-    while(x < w) {
-        int err, pred, sign;
-
-        /* compute gradients */
-        Ra = x ? R(cur, x - stride) : R(last, x);
-        Rb = R(last, x);
-        Rc = x ? R(last, x - stride) : last2;
-        Rd = (x >= w - stride) ? R(last, x) : R(last, x + stride);
-        D0 = Rd - Rb;
-        D1 = Rb - Rc;
-        D2 = Rc - Ra;
-
-        /* run mode */
-        if((FFABS(D0) <= state->near) && (FFABS(D1) <= state->near) && (FFABS(D2) <= state->near)) {
-            int RUNval, RItype, run;
-
-            run = 0;
-            RUNval = Ra;
-            while(x < w && (FFABS(R(cur, x) - RUNval) <= state->near)){
-                run++;
-                W(cur, x, Ra);
-                x += stride;
-            }
-            ls_encode_run(state, pb, run, comp, x < w);
-            if(x >= w)
-                return;
-            Rb = R(last, x);
-            RItype = (FFABS(Ra - Rb) <= state->near);
-            pred = RItype ? Ra : Rb;
-            err = R(cur, x) - pred;
-
-            if(!RItype && Ra > Rb)
-                err = -err;
-
-            if(state->near){
-                if(err > 0)
-                    err = (state->near + err) / state->twonear;
-                else
-                    err = -(state->near - err) / state->twonear;
-
-                if(RItype || (Rb >= Ra))
-                    Ra = av_clip(pred + err * state->twonear, 0, state->maxval);
-                else
-                    Ra = av_clip(pred - err * state->twonear, 0, state->maxval);
-                W(cur, x, Ra);
-            }
-            if(err < 0)
-                err += state->range;
-            if(err >= ((state->range + 1) >> 1))
-                err -= state->range;
-
-            ls_encode_runterm(state, pb, RItype, err, ff_log2_run[state->run_index[comp]]);
-
-            if(state->run_index[comp] > 0)
-                state->run_index[comp]--;
-        } else { /* regular mode */
-            int context;
-
-            context = ff_jpegls_quantize(state, D0) * 81 + ff_jpegls_quantize(state, D1) * 9 + ff_jpegls_quantize(state, D2);
-            pred = mid_pred(Ra, Ra + Rb - Rc, Rb);
-
-            if(context < 0){
-                context = -context;
-                sign = 1;
-                pred = av_clip(pred - state->C[context], 0, state->maxval);
-                err = pred - R(cur, x);
-            }else{
-                sign = 0;
-                pred = av_clip(pred + state->C[context], 0, state->maxval);
-                err = R(cur, x) - pred;
-            }
-
-            if(state->near){
-                if(err > 0)
-                    err = (state->near + err) / state->twonear;
-                else
-                    err = -(state->near - err) / state->twonear;
-                if(!sign)
-                    Ra = av_clip(pred + err * state->twonear, 0, state->maxval);
-                else
-                    Ra = av_clip(pred - err * state->twonear, 0, state->maxval);
-                W(cur, x, Ra);
-            }
-
-            ls_encode_regular(state, pb, context, err);
-        }
-        x += stride;
-    }
-}
-
-static void ls_store_lse(JLSState *state, PutBitContext *pb){
-    /* Test if we have default params and don't need to store LSE */
-    JLSState state2;
-    memset(&state2, 0, sizeof(JLSState));
-    state2.bpp = state->bpp;
-    state2.near = state->near;
-    ff_jpegls_reset_coding_parameters(&state2, 1);
-    if(state->T1 == state2.T1 && state->T2 == state2.T2 && state->T3 == state2.T3 && state->reset == state2.reset)
-        return;
-    /* store LSE type 1 */
-    put_marker(pb, LSE);
-    put_bits(pb, 16, 13);
-    put_bits(pb, 8,   1);
-    put_bits(pb, 16, state->maxval);
-    put_bits(pb, 16, state->T1);
-    put_bits(pb, 16, state->T2);
-    put_bits(pb, 16, state->T3);
-    put_bits(pb, 16, state->reset);
-}
-
-static int encode_picture_ls(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    JpeglsContext * const s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= (AVFrame*)&s->picture;
-    const int near = avctx->prediction_method;
-    PutBitContext pb, pb2;
-    GetBitContext gb;
-    uint8_t *buf2, *zero, *cur, *last;
-    JLSState *state;
-    int i, size;
-    int comps;
-
-    buf2 = av_malloc(buf_size);
-
-    init_put_bits(&pb, buf, buf_size);
-    init_put_bits(&pb2, buf2, buf_size);
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    if(avctx->pix_fmt == PIX_FMT_GRAY8 || avctx->pix_fmt == PIX_FMT_GRAY16)
-        comps = 1;
-    else
-        comps = 3;
-
-    /* write our own JPEG header, can't use mjpeg_picture_header */
-    put_marker(&pb, SOI);
-    put_marker(&pb, SOF48);
-    put_bits(&pb, 16, 8 + comps * 3); // header size depends on components
-    put_bits(&pb,  8, (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8); // bpp
-    put_bits(&pb, 16, avctx->height);
-    put_bits(&pb, 16, avctx->width);
-    put_bits(&pb,  8, comps);         // components
-    for(i = 1; i <= comps; i++) {
-        put_bits(&pb,  8, i);    // component ID
-        put_bits(&pb,  8, 0x11); // subsampling: none
-        put_bits(&pb,  8, 0);    // Tiq, used by JPEG-LS ext
-    }
-
-    put_marker(&pb, SOS);
-    put_bits(&pb, 16, 6 + comps * 2);
-    put_bits(&pb,  8, comps);
-    for(i = 1; i <= comps; i++) {
-        put_bits(&pb,  8, i);  // component ID
-        put_bits(&pb,  8, 0);  // mapping index: none
-    }
-    put_bits(&pb,  8, near);
-    put_bits(&pb,  8, (comps > 1) ? 1 : 0); // interleaving: 0 - plane, 1 - line
-    put_bits(&pb,  8, 0); // point transform: none
-
-    state = av_mallocz(sizeof(JLSState));
-    /* initialize JPEG-LS state from JPEG parameters */
-    state->near = near;
-    state->bpp = (avctx->pix_fmt == PIX_FMT_GRAY16) ? 16 : 8;
-    ff_jpegls_reset_coding_parameters(state, 0);
-    ff_jpegls_init_state(state);
-
-    ls_store_lse(state, &pb);
-
-    zero = av_mallocz(p->linesize[0]);
-    last = zero;
-    cur = p->data[0];
-    if(avctx->pix_fmt == PIX_FMT_GRAY8){
-        int t = 0;
-
-        for(i = 0; i < avctx->height; i++) {
-            ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0,  8);
-            t = last[0];
-            last = cur;
-            cur += p->linesize[0];
-        }
-    }else if(avctx->pix_fmt == PIX_FMT_GRAY16){
-        int t = 0;
-
-        for(i = 0; i < avctx->height; i++) {
-            ls_encode_line(state, &pb2, last, cur, t, avctx->width, 1, 0, 16);
-            t = *((uint16_t*)last);
-            last = cur;
-            cur += p->linesize[0];
-        }
-    }else if(avctx->pix_fmt == PIX_FMT_RGB24){
-        int j, width;
-        int Rc[3] = {0, 0, 0};
-
-        width = avctx->width * 3;
-        for(i = 0; i < avctx->height; i++) {
-            for(j = 0; j < 3; j++) {
-                ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8);
-                Rc[j] = last[j];
-            }
-            last = cur;
-            cur += s->picture.linesize[0];
-        }
-    }else if(avctx->pix_fmt == PIX_FMT_BGR24){
-        int j, width;
-        int Rc[3] = {0, 0, 0};
-
-        width = avctx->width * 3;
-        for(i = 0; i < avctx->height; i++) {
-            for(j = 2; j >= 0; j--) {
-                ls_encode_line(state, &pb2, last + j, cur + j, Rc[j], width, 3, j, 8);
-                Rc[j] = last[j];
-            }
-            last = cur;
-            cur += s->picture.linesize[0];
-        }
-    }
-
-    av_free(zero);
-    av_free(state);
-
-    // the specification says that after doing 0xff escaping unused bits in the
-    // last byte must be set to 0, so just append 7 "optional" zero-bits to
-    // avoid special-casing.
-    put_bits(&pb2, 7, 0);
-    size = put_bits_count(&pb2);
-    flush_put_bits(&pb2);
-    /* do escape coding */
-    init_get_bits(&gb, buf2, size);
-    size -= 7;
-    while(get_bits_count(&gb) < size){
-        int v;
-        v = get_bits(&gb, 8);
-        put_bits(&pb, 8, v);
-        if(v == 0xFF){
-            v = get_bits(&gb, 7);
-            put_bits(&pb, 8, v);
-        }
-    }
-    align_put_bits(&pb);
-    av_free(buf2);
-
-    /* End of image */
-    put_marker(&pb, EOI);
-    flush_put_bits(&pb);
-
-    emms_c();
-
-    return put_bits_count(&pb) >> 3;
-}
-
-static av_cold int encode_init_ls(AVCodecContext *ctx) {
-    JpeglsContext *c = (JpeglsContext*)ctx->priv_data;
-
-    c->avctx = ctx;
-    ctx->coded_frame = &c->picture;
-
-    if(ctx->pix_fmt != PIX_FMT_GRAY8 && ctx->pix_fmt != PIX_FMT_GRAY16 && ctx->pix_fmt != PIX_FMT_RGB24 && ctx->pix_fmt != PIX_FMT_BGR24){
-        av_log(ctx, AV_LOG_ERROR, "Only grayscale and RGB24/BGR24 images are supported\n");
-        return -1;
-    }
-    return 0;
-}
-
-AVCodec jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
-    "jpegls",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_JPEGLS,
-    sizeof(JpeglsContext),
-    encode_init_ls,
-    encode_picture_ls,
-    NULL,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("JPEG-LS"),
-};
diff --git a/libavcodec/jrevdct.c b/libavcodec/jrevdct.c
deleted file mode 100644
index 9e28dae..0000000
--- a/libavcodec/jrevdct.c
+++ /dev/null
@@ -1,1157 +0,0 @@
-/*
- * jrevdct.c
- *
- * This file is part of the Independent JPEG Group's software.
- *
- * The authors make NO WARRANTY or representation, either express or implied,
- * with respect to this software, its quality, accuracy, merchantability, or
- * fitness for a particular purpose.  This software is provided "AS IS", and
- * you, its user, assume the entire risk as to its quality and accuracy.
- *
- * This software is copyright (C) 1991, 1992, Thomas G. Lane.
- * All Rights Reserved except as specified below.
- *
- * Permission is hereby granted to use, copy, modify, and distribute this
- * software (or portions thereof) for any purpose, without fee, subject to
- * these conditions:
- * (1) If any part of the source code for this software is distributed, then
- * this README file must be included, with this copyright and no-warranty
- * notice unaltered; and any additions, deletions, or changes to the original
- * files must be clearly indicated in accompanying documentation.
- * (2) If only executable code is distributed, then the accompanying
- * documentation must state that "this software is based in part on the work
- * of the Independent JPEG Group".
- * (3) Permission for use of this software is granted only if the user accepts
- * full responsibility for any undesirable consequences; the authors accept
- * NO LIABILITY for damages of any kind.
- *
- * These conditions apply to any software derived from or based on the IJG
- * code, not just to the unmodified library.  If you use our work, you ought
- * to acknowledge us.
- *
- * Permission is NOT granted for the use of any IJG author's name or company
- * name in advertising or publicity relating to this software or products
- * derived from it.  This software may be referred to only as "the Independent
- * JPEG Group's software".
- *
- * We specifically permit and encourage the use of this software as the basis
- * of commercial products, provided that all warranty or liability claims are
- * assumed by the product vendor.
- *
- * This file contains the basic inverse-DCT transformation subroutine.
- *
- * This implementation is based on an algorithm described in
- *   C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
- *   Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
- *   Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
- * The primary algorithm described there uses 11 multiplies and 29 adds.
- * We use their alternate method with 12 multiplies and 32 adds.
- * The advantage of this method is that no data path contains more than one
- * multiplication; this allows a very simple and accurate implementation in
- * scaled fixed-point arithmetic, with a minimal number of shifts.
- *
- * I've made lots of modifications to attempt to take advantage of the
- * sparse nature of the DCT matrices we're getting.  Although the logic
- * is cumbersome, it's straightforward and the resulting code is much
- * faster.
- *
- * A better way to do this would be to pass in the DCT block as a sparse
- * matrix, perhaps with the difference cases encoded.
- */
-
-/**
- * @file
- * Independent JPEG Group's LLM idct.
- */
-
-#include "libavutil/common.h"
-#include "dsputil.h"
-
-#define EIGHT_BIT_SAMPLES
-
-#define DCTSIZE 8
-#define DCTSIZE2 64
-
-#define GLOBAL
-
-#define RIGHT_SHIFT(x, n) ((x) >> (n))
-
-typedef DCTELEM DCTBLOCK[DCTSIZE2];
-
-#define CONST_BITS 13
-
-/*
- * This routine is specialized to the case DCTSIZE = 8.
- */
-
-#if DCTSIZE != 8
-  Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
-#endif
-
-
-/*
- * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
- * on each column.  Direct algorithms are also available, but they are
- * much more complex and seem not to be any faster when reduced to code.
- *
- * The poop on this scaling stuff is as follows:
- *
- * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
- * larger than the true IDCT outputs.  The final outputs are therefore
- * a factor of N larger than desired; since N=8 this can be cured by
- * a simple right shift at the end of the algorithm.  The advantage of
- * this arrangement is that we save two multiplications per 1-D IDCT,
- * because the y0 and y4 inputs need not be divided by sqrt(N).
- *
- * We have to do addition and subtraction of the integer inputs, which
- * is no problem, and multiplication by fractional constants, which is
- * a problem to do in integer arithmetic.  We multiply all the constants
- * by CONST_SCALE and convert them to integer constants (thus retaining
- * CONST_BITS bits of precision in the constants).  After doing a
- * multiplication we have to divide the product by CONST_SCALE, with proper
- * rounding, to produce the correct output.  This division can be done
- * cheaply as a right shift of CONST_BITS bits.  We postpone shifting
- * as long as possible so that partial sums can be added together with
- * full fractional precision.
- *
- * The outputs of the first pass are scaled up by PASS1_BITS bits so that
- * they are represented to better-than-integral precision.  These outputs
- * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
- * with the recommended scaling.  (To scale up 12-bit sample data further, an
- * intermediate int32 array would be needed.)
- *
- * To avoid overflow of the 32-bit intermediate results in pass 2, we must
- * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26.  Error analysis
- * shows that the values given below are the most effective.
- */
-
-#ifdef EIGHT_BIT_SAMPLES
-#define PASS1_BITS  2
-#else
-#define PASS1_BITS  1   /* lose a little precision to avoid overflow */
-#endif
-
-#define ONE         ((int32_t) 1)
-
-#define CONST_SCALE (ONE << CONST_BITS)
-
-/* Convert a positive real constant to an integer scaled by CONST_SCALE.
- * IMPORTANT: if your compiler doesn't do this arithmetic at compile time,
- * you will pay a significant penalty in run time.  In that case, figure
- * the correct integer constant values and insert them by hand.
- */
-
-/* Actually FIX is no longer used, we precomputed them all */
-#define FIX(x)  ((int32_t) ((x) * CONST_SCALE + 0.5))
-
-/* Descale and correctly round an int32_t value that's scaled by N bits.
- * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
- * the fudge factor is correct for either sign of X.
- */
-
-#define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
-
-/* Multiply an int32_t variable by an int32_t constant to yield an int32_t result.
- * For 8-bit samples with the recommended scaling, all the variable
- * and constant values involved are no more than 16 bits wide, so a
- * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
- * this provides a useful speedup on many machines.
- * There is no way to specify a 16x16->32 multiply in portable C, but
- * some C compilers will do the right thing if you provide the correct
- * combination of casts.
- * NB: for 12-bit samples, a full 32-bit multiplication will be needed.
- */
-
-#ifdef EIGHT_BIT_SAMPLES
-#ifdef SHORTxSHORT_32           /* may work if 'int' is 32 bits */
-#define MULTIPLY(var,const)  (((int16_t) (var)) * ((int16_t) (const)))
-#endif
-#ifdef SHORTxLCONST_32          /* known to work with Microsoft C 6.0 */
-#define MULTIPLY(var,const)  (((int16_t) (var)) * ((int32_t) (const)))
-#endif
-#endif
-
-#ifndef MULTIPLY                /* default definition */
-#define MULTIPLY(var,const)  ((var) * (const))
-#endif
-
-
-/*
-  Unlike our decoder where we approximate the FIXes, we need to use exact
-ones here or successive P-frames will drift too much with Reference frame coding
-*/
-#define FIX_0_211164243 1730
-#define FIX_0_275899380 2260
-#define FIX_0_298631336 2446
-#define FIX_0_390180644 3196
-#define FIX_0_509795579 4176
-#define FIX_0_541196100 4433
-#define FIX_0_601344887 4926
-#define FIX_0_765366865 6270
-#define FIX_0_785694958 6436
-#define FIX_0_899976223 7373
-#define FIX_1_061594337 8697
-#define FIX_1_111140466 9102
-#define FIX_1_175875602 9633
-#define FIX_1_306562965 10703
-#define FIX_1_387039845 11363
-#define FIX_1_451774981 11893
-#define FIX_1_501321110 12299
-#define FIX_1_662939225 13623
-#define FIX_1_847759065 15137
-#define FIX_1_961570560 16069
-#define FIX_2_053119869 16819
-#define FIX_2_172734803 17799
-#define FIX_2_562915447 20995
-#define FIX_3_072711026 25172
-
-/*
- * Perform the inverse DCT on one block of coefficients.
- */
-
-void j_rev_dct(DCTBLOCK data)
-{
-  int32_t tmp0, tmp1, tmp2, tmp3;
-  int32_t tmp10, tmp11, tmp12, tmp13;
-  int32_t z1, z2, z3, z4, z5;
-  int32_t d0, d1, d2, d3, d4, d5, d6, d7;
-  register DCTELEM *dataptr;
-  int rowctr;
-
-  /* Pass 1: process rows. */
-  /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
-  /* furthermore, we scale the results by 2**PASS1_BITS. */
-
-  dataptr = data;
-
-  for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
-    /* Due to quantization, we will usually find that many of the input
-     * coefficients are zero, especially the AC terms.  We can exploit this
-     * by short-circuiting the IDCT calculation for any row in which all
-     * the AC terms are zero.  In that case each output is equal to the
-     * DC coefficient (with scale factor as needed).
-     * With typical images and quantization tables, half or more of the
-     * row DCT calculations can be simplified this way.
-     */
-
-    register int *idataptr = (int*)dataptr;
-
-    /* WARNING: we do the same permutation as MMX idct to simplify the
-       video core */
-    d0 = dataptr[0];
-    d2 = dataptr[1];
-    d4 = dataptr[2];
-    d6 = dataptr[3];
-    d1 = dataptr[4];
-    d3 = dataptr[5];
-    d5 = dataptr[6];
-    d7 = dataptr[7];
-
-    if ((d1 | d2 | d3 | d4 | d5 | d6 | d7) == 0) {
-      /* AC terms all zero */
-      if (d0) {
-          /* Compute a 32 bit value to assign. */
-          DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS);
-          register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
-
-          idataptr[0] = v;
-          idataptr[1] = v;
-          idataptr[2] = v;
-          idataptr[3] = v;
-      }
-
-      dataptr += DCTSIZE;       /* advance pointer to next row */
-      continue;
-    }
-
-    /* Even part: reverse the even part of the forward DCT. */
-    /* The rotator is sqrt(2)*c(-6). */
-{
-    if (d6) {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
-                    z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
-                    tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
-                    tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
-                    tmp2 = MULTIPLY(-d6, FIX_1_306562965);
-                    tmp3 = MULTIPLY(d6, FIX_0_541196100);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            }
-    } else {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
-                    tmp2 = MULTIPLY(d2, FIX_0_541196100);
-                    tmp3 = MULTIPLY(d2, FIX_1_306562965);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
-                    tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
-                    tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
-            }
-      }
-
-    /* Odd part per figure 8; the matrix is unitary and hence its
-     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
-     */
-
-    if (d7) {
-        if (d5) {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z2 = d5 + d3;
-                    z3 = d7 + d3;
-                    z4 = d5 + d1;
-                    z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-z1, FIX_0_899976223);
-                    z2 = MULTIPLY(-z2, FIX_2_562915447);
-                    z3 = MULTIPLY(-z3, FIX_1_961570560);
-                    z4 = MULTIPLY(-z4, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
-                    z2 = d5 + d3;
-                    z3 = d7 + d3;
-                    z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    z1 = MULTIPLY(-d7, FIX_0_899976223);
-                    z2 = MULTIPLY(-z2, FIX_2_562915447);
-                    z3 = MULTIPLY(-z3, FIX_1_961570560);
-                    z4 = MULTIPLY(-d5, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 = z1 + z4;
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z4 = d5 + d1;
-                    z5 = MULTIPLY(d7 + z4, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-z1, FIX_0_899976223);
-                    z2 = MULTIPLY(-d5, FIX_2_562915447);
-                    z3 = MULTIPLY(-d7, FIX_1_961570560);
-                    z4 = MULTIPLY(-z4, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 = z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
-                    tmp0 = MULTIPLY(-d7, FIX_0_601344887);
-                    z1 = MULTIPLY(-d7, FIX_0_899976223);
-                    z3 = MULTIPLY(-d7, FIX_1_961570560);
-                    tmp1 = MULTIPLY(-d5, FIX_0_509795579);
-                    z2 = MULTIPLY(-d5, FIX_2_562915447);
-                    z4 = MULTIPLY(-d5, FIX_0_390180644);
-                    z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z3;
-                    tmp1 += z4;
-                    tmp2 = z2 + z3;
-                    tmp3 = z1 + z4;
-                }
-            }
-        } else {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z3 = d7 + d3;
-                    z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-z1, FIX_0_899976223);
-                    z2 = MULTIPLY(-d3, FIX_2_562915447);
-                    z3 = MULTIPLY(-z3, FIX_1_961570560);
-                    z4 = MULTIPLY(-d1, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 = z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
-                    z3 = d7 + d3;
-
-                    tmp0 = MULTIPLY(-d7, FIX_0_601344887);
-                    z1 = MULTIPLY(-d7, FIX_0_899976223);
-                    tmp2 = MULTIPLY(d3, FIX_0_509795579);
-                    z2 = MULTIPLY(-d3, FIX_2_562915447);
-                    z5 = MULTIPLY(z3, FIX_1_175875602);
-                    z3 = MULTIPLY(-z3, FIX_0_785694958);
-
-                    tmp0 += z3;
-                    tmp1 = z2 + z5;
-                    tmp2 += z3;
-                    tmp3 = z1 + z5;
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z5 = MULTIPLY(z1, FIX_1_175875602);
-
-                    z1 = MULTIPLY(z1, FIX_0_275899380);
-                    z3 = MULTIPLY(-d7, FIX_1_961570560);
-                    tmp0 = MULTIPLY(-d7, FIX_1_662939225);
-                    z4 = MULTIPLY(-d1, FIX_0_390180644);
-                    tmp3 = MULTIPLY(d1, FIX_1_111140466);
-
-                    tmp0 += z1;
-                    tmp1 = z4 + z5;
-                    tmp2 = z3 + z5;
-                    tmp3 += z1;
-                } else {
-                    /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
-                    tmp0 = MULTIPLY(-d7, FIX_1_387039845);
-                    tmp1 = MULTIPLY(d7, FIX_1_175875602);
-                    tmp2 = MULTIPLY(-d7, FIX_0_785694958);
-                    tmp3 = MULTIPLY(d7, FIX_0_275899380);
-                }
-            }
-        }
-    } else {
-        if (d5) {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
-                    z2 = d5 + d3;
-                    z4 = d5 + d1;
-                    z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
-
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-d1, FIX_0_899976223);
-                    z2 = MULTIPLY(-z2, FIX_2_562915447);
-                    z3 = MULTIPLY(-d3, FIX_1_961570560);
-                    z4 = MULTIPLY(-z4, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 = z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
-                    z2 = d5 + d3;
-
-                    z5 = MULTIPLY(z2, FIX_1_175875602);
-                    tmp1 = MULTIPLY(d5, FIX_1_662939225);
-                    z4 = MULTIPLY(-d5, FIX_0_390180644);
-                    z2 = MULTIPLY(-z2, FIX_1_387039845);
-                    tmp2 = MULTIPLY(d3, FIX_1_111140466);
-                    z3 = MULTIPLY(-d3, FIX_1_961570560);
-
-                    tmp0 = z3 + z5;
-                    tmp1 += z2;
-                    tmp2 += z2;
-                    tmp3 = z4 + z5;
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
-                    z4 = d5 + d1;
-
-                    z5 = MULTIPLY(z4, FIX_1_175875602);
-                    z1 = MULTIPLY(-d1, FIX_0_899976223);
-                    tmp3 = MULTIPLY(d1, FIX_0_601344887);
-                    tmp1 = MULTIPLY(-d5, FIX_0_509795579);
-                    z2 = MULTIPLY(-d5, FIX_2_562915447);
-                    z4 = MULTIPLY(z4, FIX_0_785694958);
-
-                    tmp0 = z1 + z5;
-                    tmp1 += z4;
-                    tmp2 = z2 + z5;
-                    tmp3 += z4;
-                } else {
-                    /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
-                    tmp0 = MULTIPLY(d5, FIX_1_175875602);
-                    tmp1 = MULTIPLY(d5, FIX_0_275899380);
-                    tmp2 = MULTIPLY(-d5, FIX_1_387039845);
-                    tmp3 = MULTIPLY(d5, FIX_0_785694958);
-                }
-            }
-        } else {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
-                    z5 = d1 + d3;
-                    tmp3 = MULTIPLY(d1, FIX_0_211164243);
-                    tmp2 = MULTIPLY(-d3, FIX_1_451774981);
-                    z1 = MULTIPLY(d1, FIX_1_061594337);
-                    z2 = MULTIPLY(-d3, FIX_2_172734803);
-                    z4 = MULTIPLY(z5, FIX_0_785694958);
-                    z5 = MULTIPLY(z5, FIX_1_175875602);
-
-                    tmp0 = z1 - z4;
-                    tmp1 = z2 + z4;
-                    tmp2 += z5;
-                    tmp3 += z5;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
-                    tmp0 = MULTIPLY(-d3, FIX_0_785694958);
-                    tmp1 = MULTIPLY(-d3, FIX_1_387039845);
-                    tmp2 = MULTIPLY(-d3, FIX_0_275899380);
-                    tmp3 = MULTIPLY(d3, FIX_1_175875602);
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
-                    tmp0 = MULTIPLY(d1, FIX_0_275899380);
-                    tmp1 = MULTIPLY(d1, FIX_0_785694958);
-                    tmp2 = MULTIPLY(d1, FIX_1_175875602);
-                    tmp3 = MULTIPLY(d1, FIX_1_387039845);
-                } else {
-                    /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
-                    tmp0 = tmp1 = tmp2 = tmp3 = 0;
-                }
-            }
-        }
-    }
-}
-    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
-    dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
-    dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
-    dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
-    dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
-    dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
-    dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
-    dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
-    dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
-
-    dataptr += DCTSIZE;         /* advance pointer to next row */
-  }
-
-  /* Pass 2: process columns. */
-  /* Note that we must descale the results by a factor of 8 == 2**3, */
-  /* and also undo the PASS1_BITS scaling. */
-
-  dataptr = data;
-  for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
-    /* Columns of zeroes can be exploited in the same way as we did with rows.
-     * However, the row calculation has created many nonzero AC terms, so the
-     * simplification applies less often (typically 5% to 10% of the time).
-     * On machines with very fast multiplication, it's possible that the
-     * test takes more time than it's worth.  In that case this section
-     * may be commented out.
-     */
-
-    d0 = dataptr[DCTSIZE*0];
-    d1 = dataptr[DCTSIZE*1];
-    d2 = dataptr[DCTSIZE*2];
-    d3 = dataptr[DCTSIZE*3];
-    d4 = dataptr[DCTSIZE*4];
-    d5 = dataptr[DCTSIZE*5];
-    d6 = dataptr[DCTSIZE*6];
-    d7 = dataptr[DCTSIZE*7];
-
-    /* Even part: reverse the even part of the forward DCT. */
-    /* The rotator is sqrt(2)*c(-6). */
-    if (d6) {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
-                    z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
-                    tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
-                    tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
-                    tmp2 = MULTIPLY(-d6, FIX_1_306562965);
-                    tmp3 = MULTIPLY(d6, FIX_0_541196100);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            }
-    } else {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
-                    tmp2 = MULTIPLY(d2, FIX_0_541196100);
-                    tmp3 = MULTIPLY(d2, FIX_1_306562965);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
-                    tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
-                    tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
-            }
-    }
-
-    /* Odd part per figure 8; the matrix is unitary and hence its
-     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
-     */
-    if (d7) {
-        if (d5) {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z2 = d5 + d3;
-                    z3 = d7 + d3;
-                    z4 = d5 + d1;
-                    z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-z1, FIX_0_899976223);
-                    z2 = MULTIPLY(-z2, FIX_2_562915447);
-                    z3 = MULTIPLY(-z3, FIX_1_961570560);
-                    z4 = MULTIPLY(-z4, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
-                    z2 = d5 + d3;
-                    z3 = d7 + d3;
-                    z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    z1 = MULTIPLY(-d7, FIX_0_899976223);
-                    z2 = MULTIPLY(-z2, FIX_2_562915447);
-                    z3 = MULTIPLY(-z3, FIX_1_961570560);
-                    z4 = MULTIPLY(-d5, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 = z1 + z4;
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z3 = d7;
-                    z4 = d5 + d1;
-                    z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-z1, FIX_0_899976223);
-                    z2 = MULTIPLY(-d5, FIX_2_562915447);
-                    z3 = MULTIPLY(-d7, FIX_1_961570560);
-                    z4 = MULTIPLY(-z4, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 = z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
-                    tmp0 = MULTIPLY(-d7, FIX_0_601344887);
-                    z1 = MULTIPLY(-d7, FIX_0_899976223);
-                    z3 = MULTIPLY(-d7, FIX_1_961570560);
-                    tmp1 = MULTIPLY(-d5, FIX_0_509795579);
-                    z2 = MULTIPLY(-d5, FIX_2_562915447);
-                    z4 = MULTIPLY(-d5, FIX_0_390180644);
-                    z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z3;
-                    tmp1 += z4;
-                    tmp2 = z2 + z3;
-                    tmp3 = z1 + z4;
-                }
-            }
-        } else {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z3 = d7 + d3;
-                    z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
-
-                    tmp0 = MULTIPLY(d7, FIX_0_298631336);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-z1, FIX_0_899976223);
-                    z2 = MULTIPLY(-d3, FIX_2_562915447);
-                    z3 = MULTIPLY(-z3, FIX_1_961570560);
-                    z4 = MULTIPLY(-d1, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 += z1 + z3;
-                    tmp1 = z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
-                    z3 = d7 + d3;
-
-                    tmp0 = MULTIPLY(-d7, FIX_0_601344887);
-                    z1 = MULTIPLY(-d7, FIX_0_899976223);
-                    tmp2 = MULTIPLY(d3, FIX_0_509795579);
-                    z2 = MULTIPLY(-d3, FIX_2_562915447);
-                    z5 = MULTIPLY(z3, FIX_1_175875602);
-                    z3 = MULTIPLY(-z3, FIX_0_785694958);
-
-                    tmp0 += z3;
-                    tmp1 = z2 + z5;
-                    tmp2 += z3;
-                    tmp3 = z1 + z5;
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
-                    z1 = d7 + d1;
-                    z5 = MULTIPLY(z1, FIX_1_175875602);
-
-                    z1 = MULTIPLY(z1, FIX_0_275899380);
-                    z3 = MULTIPLY(-d7, FIX_1_961570560);
-                    tmp0 = MULTIPLY(-d7, FIX_1_662939225);
-                    z4 = MULTIPLY(-d1, FIX_0_390180644);
-                    tmp3 = MULTIPLY(d1, FIX_1_111140466);
-
-                    tmp0 += z1;
-                    tmp1 = z4 + z5;
-                    tmp2 = z3 + z5;
-                    tmp3 += z1;
-                } else {
-                    /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
-                    tmp0 = MULTIPLY(-d7, FIX_1_387039845);
-                    tmp1 = MULTIPLY(d7, FIX_1_175875602);
-                    tmp2 = MULTIPLY(-d7, FIX_0_785694958);
-                    tmp3 = MULTIPLY(d7, FIX_0_275899380);
-                }
-            }
-        }
-    } else {
-        if (d5) {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
-                    z2 = d5 + d3;
-                    z4 = d5 + d1;
-                    z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
-
-                    tmp1 = MULTIPLY(d5, FIX_2_053119869);
-                    tmp2 = MULTIPLY(d3, FIX_3_072711026);
-                    tmp3 = MULTIPLY(d1, FIX_1_501321110);
-                    z1 = MULTIPLY(-d1, FIX_0_899976223);
-                    z2 = MULTIPLY(-z2, FIX_2_562915447);
-                    z3 = MULTIPLY(-d3, FIX_1_961570560);
-                    z4 = MULTIPLY(-z4, FIX_0_390180644);
-
-                    z3 += z5;
-                    z4 += z5;
-
-                    tmp0 = z1 + z3;
-                    tmp1 += z2 + z4;
-                    tmp2 += z2 + z3;
-                    tmp3 += z1 + z4;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
-                    z2 = d5 + d3;
-
-                    z5 = MULTIPLY(z2, FIX_1_175875602);
-                    tmp1 = MULTIPLY(d5, FIX_1_662939225);
-                    z4 = MULTIPLY(-d5, FIX_0_390180644);
-                    z2 = MULTIPLY(-z2, FIX_1_387039845);
-                    tmp2 = MULTIPLY(d3, FIX_1_111140466);
-                    z3 = MULTIPLY(-d3, FIX_1_961570560);
-
-                    tmp0 = z3 + z5;
-                    tmp1 += z2;
-                    tmp2 += z2;
-                    tmp3 = z4 + z5;
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
-                    z4 = d5 + d1;
-
-                    z5 = MULTIPLY(z4, FIX_1_175875602);
-                    z1 = MULTIPLY(-d1, FIX_0_899976223);
-                    tmp3 = MULTIPLY(d1, FIX_0_601344887);
-                    tmp1 = MULTIPLY(-d5, FIX_0_509795579);
-                    z2 = MULTIPLY(-d5, FIX_2_562915447);
-                    z4 = MULTIPLY(z4, FIX_0_785694958);
-
-                    tmp0 = z1 + z5;
-                    tmp1 += z4;
-                    tmp2 = z2 + z5;
-                    tmp3 += z4;
-                } else {
-                    /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
-                    tmp0 = MULTIPLY(d5, FIX_1_175875602);
-                    tmp1 = MULTIPLY(d5, FIX_0_275899380);
-                    tmp2 = MULTIPLY(-d5, FIX_1_387039845);
-                    tmp3 = MULTIPLY(d5, FIX_0_785694958);
-                }
-            }
-        } else {
-            if (d3) {
-                if (d1) {
-                    /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
-                    z5 = d1 + d3;
-                    tmp3 = MULTIPLY(d1, FIX_0_211164243);
-                    tmp2 = MULTIPLY(-d3, FIX_1_451774981);
-                    z1 = MULTIPLY(d1, FIX_1_061594337);
-                    z2 = MULTIPLY(-d3, FIX_2_172734803);
-                    z4 = MULTIPLY(z5, FIX_0_785694958);
-                    z5 = MULTIPLY(z5, FIX_1_175875602);
-
-                    tmp0 = z1 - z4;
-                    tmp1 = z2 + z4;
-                    tmp2 += z5;
-                    tmp3 += z5;
-                } else {
-                    /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
-                    tmp0 = MULTIPLY(-d3, FIX_0_785694958);
-                    tmp1 = MULTIPLY(-d3, FIX_1_387039845);
-                    tmp2 = MULTIPLY(-d3, FIX_0_275899380);
-                    tmp3 = MULTIPLY(d3, FIX_1_175875602);
-                }
-            } else {
-                if (d1) {
-                    /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
-                    tmp0 = MULTIPLY(d1, FIX_0_275899380);
-                    tmp1 = MULTIPLY(d1, FIX_0_785694958);
-                    tmp2 = MULTIPLY(d1, FIX_1_175875602);
-                    tmp3 = MULTIPLY(d1, FIX_1_387039845);
-                } else {
-                    /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
-                    tmp0 = tmp1 = tmp2 = tmp3 = 0;
-                }
-            }
-        }
-    }
-
-    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
-    dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
-                                           CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
-                                           CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
-                                           CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
-                                           CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
-                                           CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
-                                           CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
-                                           CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
-                                           CONST_BITS+PASS1_BITS+3);
-
-    dataptr++;                  /* advance pointer to next column */
-  }
-}
-
-#undef DCTSIZE
-#define DCTSIZE 4
-#define DCTSTRIDE 8
-
-void j_rev_dct4(DCTBLOCK data)
-{
-  int32_t tmp0, tmp1, tmp2, tmp3;
-  int32_t tmp10, tmp11, tmp12, tmp13;
-  int32_t z1;
-  int32_t d0, d2, d4, d6;
-  register DCTELEM *dataptr;
-  int rowctr;
-
-  /* Pass 1: process rows. */
-  /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
-  /* furthermore, we scale the results by 2**PASS1_BITS. */
-
-  data[0] += 4;
-
-  dataptr = data;
-
-  for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
-    /* Due to quantization, we will usually find that many of the input
-     * coefficients are zero, especially the AC terms.  We can exploit this
-     * by short-circuiting the IDCT calculation for any row in which all
-     * the AC terms are zero.  In that case each output is equal to the
-     * DC coefficient (with scale factor as needed).
-     * With typical images and quantization tables, half or more of the
-     * row DCT calculations can be simplified this way.
-     */
-
-    register int *idataptr = (int*)dataptr;
-
-    d0 = dataptr[0];
-    d2 = dataptr[1];
-    d4 = dataptr[2];
-    d6 = dataptr[3];
-
-    if ((d2 | d4 | d6) == 0) {
-      /* AC terms all zero */
-      if (d0) {
-          /* Compute a 32 bit value to assign. */
-          DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS);
-          register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
-
-          idataptr[0] = v;
-          idataptr[1] = v;
-      }
-
-      dataptr += DCTSTRIDE;     /* advance pointer to next row */
-      continue;
-    }
-
-    /* Even part: reverse the even part of the forward DCT. */
-    /* The rotator is sqrt(2)*c(-6). */
-    if (d6) {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
-                    z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
-                    tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
-                    tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
-                    tmp2 = MULTIPLY(-d6, FIX_1_306562965);
-                    tmp3 = MULTIPLY(d6, FIX_0_541196100);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            }
-    } else {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
-                    tmp2 = MULTIPLY(d2, FIX_0_541196100);
-                    tmp3 = MULTIPLY(d2, FIX_1_306562965);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
-                    tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
-                    tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
-            }
-      }
-
-    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
-    dataptr[0] = (DCTELEM) DESCALE(tmp10, CONST_BITS-PASS1_BITS);
-    dataptr[1] = (DCTELEM) DESCALE(tmp11, CONST_BITS-PASS1_BITS);
-    dataptr[2] = (DCTELEM) DESCALE(tmp12, CONST_BITS-PASS1_BITS);
-    dataptr[3] = (DCTELEM) DESCALE(tmp13, CONST_BITS-PASS1_BITS);
-
-    dataptr += DCTSTRIDE;       /* advance pointer to next row */
-  }
-
-  /* Pass 2: process columns. */
-  /* Note that we must descale the results by a factor of 8 == 2**3, */
-  /* and also undo the PASS1_BITS scaling. */
-
-  dataptr = data;
-  for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
-    /* Columns of zeroes can be exploited in the same way as we did with rows.
-     * However, the row calculation has created many nonzero AC terms, so the
-     * simplification applies less often (typically 5% to 10% of the time).
-     * On machines with very fast multiplication, it's possible that the
-     * test takes more time than it's worth.  In that case this section
-     * may be commented out.
-     */
-
-    d0 = dataptr[DCTSTRIDE*0];
-    d2 = dataptr[DCTSTRIDE*1];
-    d4 = dataptr[DCTSTRIDE*2];
-    d6 = dataptr[DCTSTRIDE*3];
-
-    /* Even part: reverse the even part of the forward DCT. */
-    /* The rotator is sqrt(2)*c(-6). */
-    if (d6) {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
-                    z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
-                    tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
-                    tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
-                    tmp2 = MULTIPLY(-d6, FIX_1_306562965);
-                    tmp3 = MULTIPLY(d6, FIX_0_541196100);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            }
-    } else {
-            if (d2) {
-                    /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
-                    tmp2 = MULTIPLY(d2, FIX_0_541196100);
-                    tmp3 = MULTIPLY(d2, FIX_1_306562965);
-
-                    tmp0 = (d0 + d4) << CONST_BITS;
-                    tmp1 = (d0 - d4) << CONST_BITS;
-
-                    tmp10 = tmp0 + tmp3;
-                    tmp13 = tmp0 - tmp3;
-                    tmp11 = tmp1 + tmp2;
-                    tmp12 = tmp1 - tmp2;
-            } else {
-                    /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
-                    tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
-                    tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
-            }
-    }
-
-    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
-
-    dataptr[DCTSTRIDE*0] = tmp10 >> (CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSTRIDE*1] = tmp11 >> (CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSTRIDE*2] = tmp12 >> (CONST_BITS+PASS1_BITS+3);
-    dataptr[DCTSTRIDE*3] = tmp13 >> (CONST_BITS+PASS1_BITS+3);
-
-    dataptr++;                  /* advance pointer to next column */
-  }
-}
-
-void j_rev_dct2(DCTBLOCK data){
-  int d00, d01, d10, d11;
-
-  data[0] += 4;
-  d00 = data[0+0*DCTSTRIDE] + data[1+0*DCTSTRIDE];
-  d01 = data[0+0*DCTSTRIDE] - data[1+0*DCTSTRIDE];
-  d10 = data[0+1*DCTSTRIDE] + data[1+1*DCTSTRIDE];
-  d11 = data[0+1*DCTSTRIDE] - data[1+1*DCTSTRIDE];
-
-  data[0+0*DCTSTRIDE]= (d00 + d10)>>3;
-  data[1+0*DCTSTRIDE]= (d01 + d11)>>3;
-  data[0+1*DCTSTRIDE]= (d00 - d10)>>3;
-  data[1+1*DCTSTRIDE]= (d01 - d11)>>3;
-}
-
-void j_rev_dct1(DCTBLOCK data){
-  data[0] = (data[0] + 4)>>3;
-}
-
-#undef FIX
-#undef CONST_BITS
diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
deleted file mode 100644
index 5af6b3b..0000000
--- a/libavcodec/kgv1dec.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Kega Game Video (KGV1) decoder
- * Copyright (c) 2010 Daniel Verkamp
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Kega Game Video decoder
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct {
-    AVCodecContext *avctx;
-    AVFrame pic;
-    uint16_t *prev, *cur;
-} KgvContext;
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    const uint8_t *buf_end = buf + avpkt->size;
-    KgvContext * const c = avctx->priv_data;
-    int offsets[7];
-    uint16_t *out, *prev;
-    int outcnt = 0, maxcnt;
-    int w, h, i;
-
-    if (avpkt->size < 2)
-        return -1;
-
-    w = (buf[0] + 1) * 8;
-    h = (buf[1] + 1) * 8;
-    buf += 2;
-
-    if (avcodec_check_dimensions(avctx, w, h))
-        return -1;
-
-    if (w != avctx->width || h != avctx->height)
-        avcodec_set_dimensions(avctx, w, h);
-
-    maxcnt = w * h;
-
-    out = av_realloc(c->cur, w * h * 2);
-    if (!out)
-        return -1;
-    c->cur = out;
-
-    prev = av_realloc(c->prev, w * h * 2);
-    if (!prev)
-        return -1;
-    c->prev = prev;
-
-    for (i = 0; i < 7; i++)
-        offsets[i] = -1;
-
-    while (outcnt < maxcnt && buf_end - 2 > buf) {
-        int code = AV_RL16(buf);
-        buf += 2;
-
-        if (!(code & 0x8000)) {
-            out[outcnt++] = code; // rgb555 pixel coded directly
-        } else {
-            int count;
-            uint16_t *inp;
-
-            if ((code & 0x6000) == 0x6000) {
-                // copy from previous frame
-                int oidx = (code >> 10) & 7;
-                int start;
-
-                count = (code & 0x3FF) + 3;
-
-                if (offsets[oidx] < 0) {
-                    if (buf_end - 3 < buf)
-                        break;
-                    offsets[oidx] = AV_RL24(buf);
-                    buf += 3;
-                }
-
-                start = (outcnt + offsets[oidx]) % maxcnt;
-
-                if (maxcnt - start < count)
-                    break;
-
-                inp = prev + start;
-            } else {
-                // copy from earlier in this frame
-                int offset = (code & 0x1FFF) + 1;
-
-                if (!(code & 0x6000)) {
-                    count = 2;
-                } else if ((code & 0x6000) == 0x2000) {
-                    count = 3;
-                } else {
-                    if (buf_end - 1 < buf)
-                        break;
-                    count = 4 + *buf++;
-                }
-
-                if (outcnt < offset)
-                    break;
-
-                inp = out + outcnt - offset;
-            }
-
-            if (maxcnt - outcnt < count)
-                break;
-
-            for (i = 0; i < count; i++)
-                out[outcnt++] = inp[i];
-        }
-    }
-
-    if (outcnt - maxcnt)
-        av_log(avctx, AV_LOG_DEBUG, "frame finished with %d diff\n", outcnt - maxcnt);
-
-    c->pic.data[0]     = (uint8_t *)c->cur;
-    c->pic.linesize[0] = w * 2;
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    FFSWAP(uint16_t *, c->cur, c->prev);
-
-    return avpkt->size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    KgvContext * const c = avctx->priv_data;
-
-    c->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_RGB555;
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    KgvContext * const c = avctx->priv_data;
-
-    av_freep(&c->cur);
-    av_freep(&c->prev);
-
-    return 0;
-}
-
-AVCodec kgv1_decoder = {
-    "kgv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_KGV1,
-    sizeof(KgvContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"),
-};
diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c
deleted file mode 100644
index 3e8dccd..0000000
--- a/libavcodec/kmvc.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * KMVC decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Karl Morton's Video Codec decoder
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-#define KMVC_KEYFRAME 0x80
-#define KMVC_PALETTE  0x40
-#define KMVC_METHOD   0x0F
-
-/*
- * Decoder context
- */
-typedef struct KmvcContext {
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    int setpal;
-    int palsize;
-    uint32_t pal[256];
-    uint8_t *cur, *prev;
-    uint8_t *frm0, *frm1;
-} KmvcContext;
-
-typedef struct BitBuf {
-    int bits;
-    int bitbuf;
-} BitBuf;
-
-#define BLK(data, x, y)  data[(x) + (y) * 320]
-
-#define kmvc_init_getbits(bb, src)  bb.bits = 7; bb.bitbuf = *src++;
-
-#define kmvc_getbit(bb, src, res) {\
-    res = 0; \
-    if (bb.bitbuf & (1 << bb.bits)) res = 1; \
-    bb.bits--; \
-    if(bb.bits == -1) { \
-        bb.bitbuf = *src++; \
-        bb.bits = 7; \
-    } \
-}
-
-static void kmvc_decode_intra_8x8(KmvcContext * ctx, const uint8_t * src, int w, int h)
-{
-    BitBuf bb;
-    int res, val;
-    int i, j;
-    int bx, by;
-    int l0x, l1x, l0y, l1y;
-    int mx, my;
-
-    kmvc_init_getbits(bb, src);
-
-    for (by = 0; by < h; by += 8)
-        for (bx = 0; bx < w; bx += 8) {
-            kmvc_getbit(bb, src, res);
-            if (!res) {         // fill whole 8x8 block
-                val = *src++;
-                for (i = 0; i < 64; i++)
-                    BLK(ctx->cur, bx + (i & 0x7), by + (i >> 3)) = val;
-            } else {            // handle four 4x4 subblocks
-                for (i = 0; i < 4; i++) {
-                    l0x = bx + (i & 1) * 4;
-                    l0y = by + (i & 2) * 2;
-                    kmvc_getbit(bb, src, res);
-                    if (!res) {
-                        kmvc_getbit(bb, src, res);
-                        if (!res) {     // fill whole 4x4 block
-                            val = *src++;
-                            for (j = 0; j < 16; j++)
-                                BLK(ctx->cur, l0x + (j & 3), l0y + (j >> 2)) = val;
-                        } else {        // copy block from already decoded place
-                            val = *src++;
-                            mx = val & 0xF;
-                            my = val >> 4;
-                            for (j = 0; j < 16; j++)
-                                BLK(ctx->cur, l0x + (j & 3), l0y + (j >> 2)) =
-                                    BLK(ctx->cur, l0x + (j & 3) - mx, l0y + (j >> 2) - my);
-                        }
-                    } else {    // descend to 2x2 sub-sub-blocks
-                        for (j = 0; j < 4; j++) {
-                            l1x = l0x + (j & 1) * 2;
-                            l1y = l0y + (j & 2);
-                            kmvc_getbit(bb, src, res);
-                            if (!res) {
-                                kmvc_getbit(bb, src, res);
-                                if (!res) {     // fill whole 2x2 block
-                                    val = *src++;
-                                    BLK(ctx->cur, l1x, l1y) = val;
-                                    BLK(ctx->cur, l1x + 1, l1y) = val;
-                                    BLK(ctx->cur, l1x, l1y + 1) = val;
-                                    BLK(ctx->cur, l1x + 1, l1y + 1) = val;
-                                } else {        // copy block from already decoded place
-                                    val = *src++;
-                                    mx = val & 0xF;
-                                    my = val >> 4;
-                                    BLK(ctx->cur, l1x, l1y) = BLK(ctx->cur, l1x - mx, l1y - my);
-                                    BLK(ctx->cur, l1x + 1, l1y) =
-                                        BLK(ctx->cur, l1x + 1 - mx, l1y - my);
-                                    BLK(ctx->cur, l1x, l1y + 1) =
-                                        BLK(ctx->cur, l1x - mx, l1y + 1 - my);
-                                    BLK(ctx->cur, l1x + 1, l1y + 1) =
-                                        BLK(ctx->cur, l1x + 1 - mx, l1y + 1 - my);
-                                }
-                            } else {    // read values for block
-                                BLK(ctx->cur, l1x, l1y) = *src++;
-                                BLK(ctx->cur, l1x + 1, l1y) = *src++;
-                                BLK(ctx->cur, l1x, l1y + 1) = *src++;
-                                BLK(ctx->cur, l1x + 1, l1y + 1) = *src++;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-}
-
-static void kmvc_decode_inter_8x8(KmvcContext * ctx, const uint8_t * src, int w, int h)
-{
-    BitBuf bb;
-    int res, val;
-    int i, j;
-    int bx, by;
-    int l0x, l1x, l0y, l1y;
-    int mx, my;
-
-    kmvc_init_getbits(bb, src);
-
-    for (by = 0; by < h; by += 8)
-        for (bx = 0; bx < w; bx += 8) {
-            kmvc_getbit(bb, src, res);
-            if (!res) {
-                kmvc_getbit(bb, src, res);
-                if (!res) {     // fill whole 8x8 block
-                    val = *src++;
-                    for (i = 0; i < 64; i++)
-                        BLK(ctx->cur, bx + (i & 0x7), by + (i >> 3)) = val;
-                } else {        // copy block from previous frame
-                    for (i = 0; i < 64; i++)
-                        BLK(ctx->cur, bx + (i & 0x7), by + (i >> 3)) =
-                            BLK(ctx->prev, bx + (i & 0x7), by + (i >> 3));
-                }
-            } else {            // handle four 4x4 subblocks
-                for (i = 0; i < 4; i++) {
-                    l0x = bx + (i & 1) * 4;
-                    l0y = by + (i & 2) * 2;
-                    kmvc_getbit(bb, src, res);
-                    if (!res) {
-                        kmvc_getbit(bb, src, res);
-                        if (!res) {     // fill whole 4x4 block
-                            val = *src++;
-                            for (j = 0; j < 16; j++)
-                                BLK(ctx->cur, l0x + (j & 3), l0y + (j >> 2)) = val;
-                        } else {        // copy block
-                            val = *src++;
-                            mx = (val & 0xF) - 8;
-                            my = (val >> 4) - 8;
-                            for (j = 0; j < 16; j++)
-                                BLK(ctx->cur, l0x + (j & 3), l0y + (j >> 2)) =
-                                    BLK(ctx->prev, l0x + (j & 3) + mx, l0y + (j >> 2) + my);
-                        }
-                    } else {    // descend to 2x2 sub-sub-blocks
-                        for (j = 0; j < 4; j++) {
-                            l1x = l0x + (j & 1) * 2;
-                            l1y = l0y + (j & 2);
-                            kmvc_getbit(bb, src, res);
-                            if (!res) {
-                                kmvc_getbit(bb, src, res);
-                                if (!res) {     // fill whole 2x2 block
-                                    val = *src++;
-                                    BLK(ctx->cur, l1x, l1y) = val;
-                                    BLK(ctx->cur, l1x + 1, l1y) = val;
-                                    BLK(ctx->cur, l1x, l1y + 1) = val;
-                                    BLK(ctx->cur, l1x + 1, l1y + 1) = val;
-                                } else {        // copy block
-                                    val = *src++;
-                                    mx = (val & 0xF) - 8;
-                                    my = (val >> 4) - 8;
-                                    BLK(ctx->cur, l1x, l1y) = BLK(ctx->prev, l1x + mx, l1y + my);
-                                    BLK(ctx->cur, l1x + 1, l1y) =
-                                        BLK(ctx->prev, l1x + 1 + mx, l1y + my);
-                                    BLK(ctx->cur, l1x, l1y + 1) =
-                                        BLK(ctx->prev, l1x + mx, l1y + 1 + my);
-                                    BLK(ctx->cur, l1x + 1, l1y + 1) =
-                                        BLK(ctx->prev, l1x + 1 + mx, l1y + 1 + my);
-                                }
-                            } else {    // read values for block
-                                BLK(ctx->cur, l1x, l1y) = *src++;
-                                BLK(ctx->cur, l1x + 1, l1y) = *src++;
-                                BLK(ctx->cur, l1x, l1y + 1) = *src++;
-                                BLK(ctx->cur, l1x + 1, l1y + 1) = *src++;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-}
-
-static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    KmvcContext *const ctx = avctx->priv_data;
-    uint8_t *out, *src;
-    int i;
-    int header;
-    int blocksize;
-
-    if (ctx->pic.data[0])
-        avctx->release_buffer(avctx, &ctx->pic);
-
-    ctx->pic.reference = 1;
-    ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if (avctx->get_buffer(avctx, &ctx->pic) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    header = *buf++;
-
-    /* blocksize 127 is really palette change event */
-    if (buf[0] == 127) {
-        buf += 3;
-        for (i = 0; i < 127; i++) {
-            ctx->pal[i + (header & 0x81)] = AV_RB24(buf);
-            buf += 4;
-        }
-        buf -= 127 * 4 + 3;
-    }
-
-    if (header & KMVC_KEYFRAME) {
-        ctx->pic.key_frame = 1;
-        ctx->pic.pict_type = FF_I_TYPE;
-    } else {
-        ctx->pic.key_frame = 0;
-        ctx->pic.pict_type = FF_P_TYPE;
-    }
-
-    /* if palette has been changed, copy it from palctrl */
-    if (ctx->avctx->palctrl && ctx->avctx->palctrl->palette_changed) {
-        memcpy(ctx->pal, ctx->avctx->palctrl->palette, AVPALETTE_SIZE);
-        ctx->setpal = 1;
-        ctx->avctx->palctrl->palette_changed = 0;
-    }
-
-    if (header & KMVC_PALETTE) {
-        ctx->pic.palette_has_changed = 1;
-        // palette starts from index 1 and has 127 entries
-        for (i = 1; i <= ctx->palsize; i++) {
-            ctx->pal[i] = bytestream_get_be24(&buf);
-        }
-    }
-
-    if (ctx->setpal) {
-        ctx->setpal = 0;
-        ctx->pic.palette_has_changed = 1;
-    }
-
-    /* make the palette available on the way out */
-    memcpy(ctx->pic.data[1], ctx->pal, 1024);
-
-    blocksize = *buf++;
-
-    if (blocksize != 8 && blocksize != 127) {
-        av_log(avctx, AV_LOG_ERROR, "Block size = %i\n", blocksize);
-        return -1;
-    }
-    memset(ctx->cur, 0, 320 * 200);
-    switch (header & KMVC_METHOD) {
-    case 0:
-    case 1: // used in palette changed event
-        memcpy(ctx->cur, ctx->prev, 320 * 200);
-        break;
-    case 3:
-        kmvc_decode_intra_8x8(ctx, buf, avctx->width, avctx->height);
-        break;
-    case 4:
-        kmvc_decode_inter_8x8(ctx, buf, avctx->width, avctx->height);
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Unknown compression method %i\n", header & KMVC_METHOD);
-        return -1;
-    }
-
-    out = ctx->pic.data[0];
-    src = ctx->cur;
-    for (i = 0; i < avctx->height; i++) {
-        memcpy(out, src, avctx->width);
-        src += 320;
-        out += ctx->pic.linesize[0];
-    }
-
-    /* flip buffers */
-    if (ctx->cur == ctx->frm0) {
-        ctx->cur = ctx->frm1;
-        ctx->prev = ctx->frm0;
-    } else {
-        ctx->cur = ctx->frm0;
-        ctx->prev = ctx->frm1;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame *) data = ctx->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-
-/*
- * Init kmvc decoder
- */
-static av_cold int decode_init(AVCodecContext * avctx)
-{
-    KmvcContext *const c = avctx->priv_data;
-    int i;
-
-    c->avctx = avctx;
-
-    if (avctx->width > 320 || avctx->height > 200) {
-        av_log(avctx, AV_LOG_ERROR, "KMVC supports frames <= 320x200\n");
-        return -1;
-    }
-
-    c->frm0 = av_mallocz(320 * 200);
-    c->frm1 = av_mallocz(320 * 200);
-    c->cur = c->frm0;
-    c->prev = c->frm1;
-
-    for (i = 0; i < 256; i++) {
-        c->pal[i] = i * 0x10101;
-    }
-
-    if (avctx->extradata_size < 12) {
-        av_log(NULL, 0, "Extradata missing, decoding may not work properly...\n");
-        c->palsize = 127;
-    } else {
-        c->palsize = AV_RL16(avctx->extradata + 10);
-    }
-
-    if (avctx->extradata_size == 1036) {        // palette in extradata
-        uint8_t *src = avctx->extradata + 12;
-        for (i = 0; i < 256; i++) {
-            c->pal[i] = AV_RL32(src);
-            src += 4;
-        }
-        c->setpal = 1;
-        if (c->avctx->palctrl) {
-            c->avctx->palctrl->palette_changed = 0;
-        }
-    }
-
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    return 0;
-}
-
-
-
-/*
- * Uninit kmvc decoder
- */
-static av_cold int decode_end(AVCodecContext * avctx)
-{
-    KmvcContext *const c = avctx->priv_data;
-
-    av_freep(&c->frm0);
-    av_freep(&c->frm1);
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-
-    return 0;
-}
-
-AVCodec kmvc_decoder = {
-    "kmvc",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_KMVC,
-    sizeof(KmvcContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"),
-};
diff --git a/libavcodec/lcl.h b/libavcodec/lcl.h
deleted file mode 100644
index b60c0e9..0000000
--- a/libavcodec/lcl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * LCL (LossLess Codec Library) Codec
- * Copyright (c) 2002-2004 Roberto Togni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_LCL_H
-#define AVCODEC_LCL_H
-
-#define BMPTYPE_YUV 1
-#define BMPTYPE_RGB 2
-
-#define IMGTYPE_YUV111 0
-#define IMGTYPE_YUV422 1
-#define IMGTYPE_RGB24 2
-#define IMGTYPE_YUV411 3
-#define IMGTYPE_YUV211 4
-#define IMGTYPE_YUV420 5
-
-#define COMP_MSZH 0
-#define COMP_MSZH_NOCOMP 1
-#define COMP_ZLIB_HISPEED 1
-#define COMP_ZLIB_HICOMP 9
-#define COMP_ZLIB_NORMAL -1
-
-#define FLAG_MULTITHREAD 1
-#define FLAG_NULLFRAME 2
-#define FLAG_PNGFILTER 4
-#define FLAGMASK_UNUSED 0xf8
-
-#define CODEC_MSZH 1
-#define CODEC_ZLIB 3
-
-#endif /* AVCODEC_LCL_H */
diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
deleted file mode 100644
index 2bf448a..0000000
--- a/libavcodec/lcldec.c
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- * LCL (LossLess Codec Library) Codec
- * Copyright (c) 2002-2004 Roberto Togni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * LCL (LossLess Codec Library) Video Codec
- * Decoder for MSZH and ZLIB codecs
- * Experimental encoder for ZLIB RGB24
- *
- * Fourcc: MSZH, ZLIB
- *
- * Original Win32 dll:
- * Ver2.23 By Kenji Oshima 2000.09.20
- * avimszh.dll, avizlib.dll
- *
- * A description of the decoding algorithm can be found here:
- *   http://www.pcisys.net/~melanson/codecs
- *
- * Supports: BGR24 (RGB 24bpp)
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "lcl.h"
-#include "libavutil/lzo.h"
-
-#if CONFIG_ZLIB_DECODER
-#include <zlib.h>
-#endif
-
-/*
- * Decoder context
- */
-typedef struct LclDecContext {
-    AVFrame pic;
-
-    // Image type
-    int imgtype;
-    // Compression type
-    int compression;
-    // Flags
-    int flags;
-    // Decompressed data size
-    unsigned int decomp_size;
-    // Decompression buffer
-    unsigned char* decomp_buf;
-#if CONFIG_ZLIB_DECODER
-    z_stream zstream;
-#endif
-} LclDecContext;
-
-
-/**
- * \param srcptr compressed source buffer, must be padded with at least 5 extra bytes
- * \param destptr must be padded sufficiently for av_memcpy_backptr
- */
-static unsigned int mszh_decomp(const unsigned char * srcptr, int srclen, unsigned char * destptr, unsigned int destsize)
-{
-    unsigned char *destptr_bak = destptr;
-    unsigned char *destptr_end = destptr + destsize;
-    const unsigned char *srcptr_end = srcptr + srclen;
-    unsigned mask = *srcptr++;
-    unsigned maskbit = 0x80;
-
-    while (srcptr < srcptr_end && destptr < destptr_end) {
-        if (!(mask & maskbit)) {
-            memcpy(destptr, srcptr, 4);
-            destptr += 4;
-            srcptr += 4;
-        } else {
-            unsigned ofs = bytestream_get_le16(&srcptr);
-            unsigned cnt = (ofs >> 11) + 1;
-            ofs &= 0x7ff;
-            ofs = FFMIN(ofs, destptr - destptr_bak);
-            cnt *= 4;
-            cnt = FFMIN(cnt, destptr_end - destptr);
-            av_memcpy_backptr(destptr, ofs, cnt);
-            destptr += cnt;
-        }
-        maskbit >>= 1;
-        if (!maskbit) {
-            mask = *srcptr++;
-            while (!mask) {
-                if (destptr_end - destptr < 32 || srcptr_end - srcptr < 32) break;
-                memcpy(destptr, srcptr, 32);
-                destptr += 32;
-                srcptr += 32;
-                mask = *srcptr++;
-            }
-            maskbit = 0x80;
-        }
-    }
-
-    return destptr - destptr_bak;
-}
-
-
-/**
- * \brief decompress a zlib-compressed data block into decomp_buf
- * \param src compressed input buffer
- * \param src_len data length in input buffer
- * \param offset offset in decomp_buf
- * \param expected expected decompressed length
- */
-#if CONFIG_ZLIB_DECODER
-static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, int offset, int expected)
-{
-    LclDecContext *c = avctx->priv_data;
-    int zret = inflateReset(&c->zstream);
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
-        return -1;
-    }
-    c->zstream.next_in = src;
-    c->zstream.avail_in = src_len;
-    c->zstream.next_out = c->decomp_buf + offset;
-    c->zstream.avail_out = c->decomp_size - offset;
-    zret = inflate(&c->zstream, Z_FINISH);
-    if (zret != Z_OK && zret != Z_STREAM_END) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
-        return -1;
-    }
-    if (expected != (unsigned int)c->zstream.total_out) {
-        av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
-               expected, c->zstream.total_out);
-        return -1;
-    }
-    return c->zstream.total_out;
-}
-#endif
-
-
-/*
- *
- * Decode a frame
- *
- */
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    LclDecContext * const c = avctx->priv_data;
-    unsigned char *encoded = (unsigned char *)buf;
-    unsigned int pixel_ptr;
-    int row, col;
-    unsigned char *outptr;
-    uint8_t *y_out, *u_out, *v_out;
-    unsigned int width = avctx->width; // Real image width
-    unsigned int height = avctx->height; // Real image height
-    unsigned int mszh_dlen;
-    unsigned char yq, y1q, uq, vq;
-    int uqvq;
-    unsigned int mthread_inlen, mthread_outlen;
-    unsigned int len = buf_size;
-
-    if(c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-
-    c->pic.reference = 0;
-    c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    outptr = c->pic.data[0]; // Output image pointer
-
-    /* Decompress frame */
-    switch (avctx->codec_id) {
-    case CODEC_ID_MSZH:
-        switch (c->compression) {
-        case COMP_MSZH:
-            if (c->flags & FLAG_MULTITHREAD) {
-                mthread_inlen = AV_RL32(encoded);
-                mthread_inlen = FFMIN(mthread_inlen, len - 8);
-                mthread_outlen = AV_RL32(encoded+4);
-                mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
-                mszh_dlen = mszh_decomp(encoded + 8, mthread_inlen, c->decomp_buf, c->decomp_size);
-                if (mthread_outlen != mszh_dlen) {
-                    av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n",
-                           mthread_outlen, mszh_dlen);
-                    return -1;
-                }
-                mszh_dlen = mszh_decomp(encoded + 8 + mthread_inlen, len - 8 - mthread_inlen,
-                                        c->decomp_buf + mthread_outlen, c->decomp_size - mthread_outlen);
-                if (mthread_outlen != mszh_dlen) {
-                    av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n",
-                           mthread_outlen, mszh_dlen);
-                    return -1;
-                }
-                encoded = c->decomp_buf;
-                len = c->decomp_size;
-            } else {
-                mszh_dlen = mszh_decomp(encoded, len, c->decomp_buf, c->decomp_size);
-                if (c->decomp_size != mszh_dlen) {
-                    av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n",
-                           c->decomp_size, mszh_dlen);
-                    return -1;
-                }
-                encoded = c->decomp_buf;
-                len = mszh_dlen;
-            }
-            break;
-        case COMP_MSZH_NOCOMP:
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n");
-            return -1;
-        }
-        break;
-#if CONFIG_ZLIB_DECODER
-    case CODEC_ID_ZLIB:
-        /* Using the original dll with normal compression (-1) and RGB format
-         * gives a file with ZLIB fourcc, but frame is really uncompressed.
-         * To be sure that's true check also frame size */
-        if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 &&
-            len == width * height * 3)
-            break;
-        if (c->flags & FLAG_MULTITHREAD) {
-            int ret;
-            mthread_inlen = AV_RL32(encoded);
-            mthread_inlen = FFMIN(mthread_inlen, len - 8);
-            mthread_outlen = AV_RL32(encoded+4);
-            mthread_outlen = FFMIN(mthread_outlen, c->decomp_size);
-            ret = zlib_decomp(avctx, encoded + 8, mthread_inlen, 0, mthread_outlen);
-            if (ret < 0) return ret;
-            ret = zlib_decomp(avctx, encoded + 8 + mthread_inlen, len - 8 - mthread_inlen,
-                              mthread_outlen, mthread_outlen);
-            if (ret < 0) return ret;
-        } else {
-            int ret = zlib_decomp(avctx, encoded, len, 0, c->decomp_size);
-            if (ret < 0) return ret;
-        }
-        encoded = c->decomp_buf;
-        len = c->decomp_size;
-        break;
-#endif
-    default:
-        av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n");
-        return -1;
-    }
-
-
-    /* Apply PNG filter */
-    if (avctx->codec_id == CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER)) {
-        switch (c->imgtype) {
-        case IMGTYPE_YUV111:
-        case IMGTYPE_RGB24:
-            for (row = 0; row < height; row++) {
-                pixel_ptr = row * width * 3;
-                yq = encoded[pixel_ptr++];
-                uqvq = AV_RL16(encoded+pixel_ptr);
-                pixel_ptr += 2;
-                for (col = 1; col < width; col++) {
-                    encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
-                    uqvq -= AV_RL16(encoded+pixel_ptr+1);
-                    AV_WL16(encoded+pixel_ptr+1, uqvq);
-                    pixel_ptr += 3;
-                }
-            }
-            break;
-        case IMGTYPE_YUV422:
-            for (row = 0; row < height; row++) {
-                pixel_ptr = row * width * 2;
-                yq = uq = vq =0;
-                for (col = 0; col < width/4; col++) {
-                    encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
-                    encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1];
-                    encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2];
-                    encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3];
-                    encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4];
-                    encoded[pixel_ptr+5] = uq -= encoded[pixel_ptr+5];
-                    encoded[pixel_ptr+6] = vq -= encoded[pixel_ptr+6];
-                    encoded[pixel_ptr+7] = vq -= encoded[pixel_ptr+7];
-                    pixel_ptr += 8;
-                }
-            }
-            break;
-        case IMGTYPE_YUV411:
-            for (row = 0; row < height; row++) {
-                pixel_ptr = row * width / 2 * 3;
-                yq = uq = vq =0;
-                for (col = 0; col < width/4; col++) {
-                    encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
-                    encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1];
-                    encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2];
-                    encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3];
-                    encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4];
-                    encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5];
-                    pixel_ptr += 6;
-                }
-            }
-            break;
-        case IMGTYPE_YUV211:
-            for (row = 0; row < height; row++) {
-                pixel_ptr = row * width * 2;
-                yq = uq = vq =0;
-                for (col = 0; col < width/2; col++) {
-                    encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
-                    encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1];
-                    encoded[pixel_ptr+2] = uq -= encoded[pixel_ptr+2];
-                    encoded[pixel_ptr+3] = vq -= encoded[pixel_ptr+3];
-                    pixel_ptr += 4;
-                }
-            }
-            break;
-        case IMGTYPE_YUV420:
-            for (row = 0; row < height/2; row++) {
-                pixel_ptr = row * width * 3;
-                yq = y1q = uq = vq =0;
-                for (col = 0; col < width/2; col++) {
-                    encoded[pixel_ptr] = yq -= encoded[pixel_ptr];
-                    encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1];
-                    encoded[pixel_ptr+2] = y1q -= encoded[pixel_ptr+2];
-                    encoded[pixel_ptr+3] = y1q -= encoded[pixel_ptr+3];
-                    encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4];
-                    encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5];
-                    pixel_ptr += 6;
-                }
-            }
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n");
-            return -1;
-        }
-    }
-
-    /* Convert colorspace */
-    y_out = c->pic.data[0] + (height - 1) * c->pic.linesize[0];
-    u_out = c->pic.data[1] + (height - 1) * c->pic.linesize[1];
-    v_out = c->pic.data[2] + (height - 1) * c->pic.linesize[2];
-    switch (c->imgtype) {
-    case IMGTYPE_YUV111:
-        for (row = 0; row < height; row++) {
-            for (col = 0; col < width; col++) {
-                y_out[col] = *encoded++;
-                u_out[col] = *encoded++ + 128;
-                v_out[col] = *encoded++ + 128;
-            }
-            y_out -= c->pic.linesize[0];
-            u_out -= c->pic.linesize[1];
-            v_out -= c->pic.linesize[2];
-        }
-        break;
-    case IMGTYPE_YUV422:
-        for (row = 0; row < height; row++) {
-            for (col = 0; col < width - 3; col += 4) {
-                memcpy(y_out + col, encoded, 4);
-                encoded += 4;
-                u_out[ col >> 1     ] = *encoded++ + 128;
-                u_out[(col >> 1) + 1] = *encoded++ + 128;
-                v_out[ col >> 1     ] = *encoded++ + 128;
-                v_out[(col >> 1) + 1] = *encoded++ + 128;
-            }
-            y_out -= c->pic.linesize[0];
-            u_out -= c->pic.linesize[1];
-            v_out -= c->pic.linesize[2];
-        }
-        break;
-    case IMGTYPE_RGB24:
-        for (row = height - 1; row >= 0; row--) {
-            pixel_ptr = row * c->pic.linesize[0];
-            memcpy(outptr + pixel_ptr, encoded, 3 * width);
-            encoded += 3 * width;
-        }
-        break;
-    case IMGTYPE_YUV411:
-        for (row = 0; row < height; row++) {
-            for (col = 0; col < width - 3; col += 4) {
-                memcpy(y_out + col, encoded, 4);
-                encoded += 4;
-                u_out[col >> 2] = *encoded++ + 128;
-                v_out[col >> 2] = *encoded++ + 128;
-            }
-            y_out -= c->pic.linesize[0];
-            u_out -= c->pic.linesize[1];
-            v_out -= c->pic.linesize[2];
-        }
-        break;
-    case IMGTYPE_YUV211:
-        for (row = 0; row < height; row++) {
-            for (col = 0; col < width - 1; col += 2) {
-                memcpy(y_out + col, encoded, 2);
-                encoded += 2;
-                u_out[col >> 1] = *encoded++ + 128;
-                v_out[col >> 1] = *encoded++ + 128;
-            }
-            y_out -= c->pic.linesize[0];
-            u_out -= c->pic.linesize[1];
-            v_out -= c->pic.linesize[2];
-        }
-        break;
-    case IMGTYPE_YUV420:
-        u_out = c->pic.data[1] + ((height >> 1) - 1) * c->pic.linesize[1];
-        v_out = c->pic.data[2] + ((height >> 1) - 1) * c->pic.linesize[2];
-        for (row = 0; row < height - 1; row += 2) {
-            for (col = 0; col < width - 1; col += 2) {
-                memcpy(y_out + col, encoded, 2);
-                encoded += 2;
-                memcpy(y_out + col - c->pic.linesize[0], encoded, 2);
-                encoded += 2;
-                u_out[col >> 1] = *encoded++ + 128;
-                v_out[col >> 1] = *encoded++ + 128;
-            }
-            y_out -= c->pic.linesize[0] << 1;
-            u_out -= c->pic.linesize[1];
-            v_out -= c->pic.linesize[2];
-        }
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n");
-        return -1;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-/*
- *
- * Init lcl decoder
- *
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    LclDecContext * const c = avctx->priv_data;
-    unsigned int basesize = avctx->width * avctx->height;
-    unsigned int max_basesize = FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4) + AV_LZO_OUTPUT_PADDING;
-    unsigned int max_decomp_size;
-
-    if (avctx->extradata_size < 8) {
-        av_log(avctx, AV_LOG_ERROR, "Extradata size too small.\n");
-        return 1;
-    }
-
-    /* Check codec type */
-    if ((avctx->codec_id == CODEC_ID_MSZH  && avctx->extradata[7] != CODEC_MSZH) ||
-        (avctx->codec_id == CODEC_ID_ZLIB  && avctx->extradata[7] != CODEC_ZLIB)) {
-        av_log(avctx, AV_LOG_ERROR, "Codec id and codec type mismatch. This should not happen.\n");
-    }
-
-    /* Detect image type */
-    switch (c->imgtype = avctx->extradata[4]) {
-    case IMGTYPE_YUV111:
-        c->decomp_size = basesize * 3;
-        max_decomp_size = max_basesize * 3;
-        avctx->pix_fmt = PIX_FMT_YUV444P;
-        av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 1:1:1.\n");
-        break;
-    case IMGTYPE_YUV422:
-        c->decomp_size = basesize * 2;
-        max_decomp_size = max_basesize * 2;
-        avctx->pix_fmt = PIX_FMT_YUV422P;
-        av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n");
-        break;
-    case IMGTYPE_RGB24:
-        c->decomp_size = basesize * 3;
-        max_decomp_size = max_basesize * 3;
-        avctx->pix_fmt = PIX_FMT_BGR24;
-        av_log(avctx, AV_LOG_DEBUG, "Image type is RGB 24.\n");
-        break;
-    case IMGTYPE_YUV411:
-        c->decomp_size = basesize / 2 * 3;
-        max_decomp_size = max_basesize / 2 * 3;
-        avctx->pix_fmt = PIX_FMT_YUV411P;
-        av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:1:1.\n");
-        break;
-    case IMGTYPE_YUV211:
-        c->decomp_size = basesize * 2;
-        max_decomp_size = max_basesize * 2;
-        avctx->pix_fmt = PIX_FMT_YUV422P;
-        av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 2:1:1.\n");
-        break;
-    case IMGTYPE_YUV420:
-        c->decomp_size = basesize / 2 * 3;
-        max_decomp_size = max_basesize / 2 * 3;
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-        av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:0.\n");
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Unsupported image format %d.\n", c->imgtype);
-        return 1;
-    }
-
-    /* Detect compression method */
-    c->compression = (int8_t)avctx->extradata[5];
-    switch (avctx->codec_id) {
-    case CODEC_ID_MSZH:
-        switch (c->compression) {
-        case COMP_MSZH:
-            av_log(avctx, AV_LOG_DEBUG, "Compression enabled.\n");
-            break;
-        case COMP_MSZH_NOCOMP:
-            c->decomp_size = 0;
-            av_log(avctx, AV_LOG_DEBUG, "No compression.\n");
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unsupported compression format for MSZH (%d).\n", c->compression);
-            return 1;
-        }
-        break;
-#if CONFIG_ZLIB_DECODER
-    case CODEC_ID_ZLIB:
-        switch (c->compression) {
-        case COMP_ZLIB_HISPEED:
-            av_log(avctx, AV_LOG_DEBUG, "High speed compression.\n");
-            break;
-        case COMP_ZLIB_HICOMP:
-            av_log(avctx, AV_LOG_DEBUG, "High compression.\n");
-            break;
-        case COMP_ZLIB_NORMAL:
-            av_log(avctx, AV_LOG_DEBUG, "Normal compression.\n");
-            break;
-        default:
-            if (c->compression < Z_NO_COMPRESSION || c->compression > Z_BEST_COMPRESSION) {
-                av_log(avctx, AV_LOG_ERROR, "Unsupported compression level for ZLIB: (%d).\n", c->compression);
-                return 1;
-            }
-            av_log(avctx, AV_LOG_DEBUG, "Compression level for ZLIB: (%d).\n", c->compression);
-        }
-        break;
-#endif
-    default:
-        av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in compression switch.\n");
-        return 1;
-    }
-
-    /* Allocate decompression buffer */
-    if (c->decomp_size) {
-        if ((c->decomp_buf = av_malloc(max_decomp_size)) == NULL) {
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-            return 1;
-        }
-    }
-
-    /* Detect flags */
-    c->flags = avctx->extradata[6];
-    if (c->flags & FLAG_MULTITHREAD)
-        av_log(avctx, AV_LOG_DEBUG, "Multithread encoder flag set.\n");
-    if (c->flags & FLAG_NULLFRAME)
-        av_log(avctx, AV_LOG_DEBUG, "Nullframe insertion flag set.\n");
-    if (avctx->codec_id == CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER))
-        av_log(avctx, AV_LOG_DEBUG, "PNG filter flag set.\n");
-    if (c->flags & FLAGMASK_UNUSED)
-        av_log(avctx, AV_LOG_ERROR, "Unknown flag set (%d).\n", c->flags);
-
-    /* If needed init zlib */
-#if CONFIG_ZLIB_DECODER
-    if (avctx->codec_id == CODEC_ID_ZLIB) {
-        int zret;
-        c->zstream.zalloc = Z_NULL;
-        c->zstream.zfree = Z_NULL;
-        c->zstream.opaque = Z_NULL;
-        zret = inflateInit(&c->zstream);
-        if (zret != Z_OK) {
-            av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
-            av_freep(&c->decomp_buf);
-            return 1;
-        }
-    }
-#endif
-
-    return 0;
-}
-
-/*
- *
- * Uninit lcl decoder
- *
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    LclDecContext * const c = avctx->priv_data;
-
-    av_freep(&c->decomp_buf);
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-#if CONFIG_ZLIB_DECODER
-    if (avctx->codec_id == CODEC_ID_ZLIB)
-        inflateEnd(&c->zstream);
-#endif
-
-    return 0;
-}
-
-#if CONFIG_MSZH_DECODER
-AVCodec mszh_decoder = {
-    "mszh",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSZH,
-    sizeof(LclDecContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) MSZH"),
-};
-#endif
-
-#if CONFIG_ZLIB_DECODER
-AVCodec zlib_decoder = {
-    "zlib",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ZLIB,
-    sizeof(LclDecContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
-};
-#endif
diff --git a/libavcodec/lclenc.c b/libavcodec/lclenc.c
deleted file mode 100644
index 8d7c5bf..0000000
--- a/libavcodec/lclenc.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * LCL (LossLess Codec Library) Codec
- * Copyright (c) 2002-2004 Roberto Togni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * LCL (LossLess Codec Library) Video Codec
- * Decoder for MSZH and ZLIB codecs
- * Experimental encoder for ZLIB RGB24
- *
- * Fourcc: MSZH, ZLIB
- *
- * Original Win32 dll:
- * Ver2.23 By Kenji Oshima 2000.09.20
- * avimszh.dll, avizlib.dll
- *
- * A description of the decoding algorithm can be found here:
- *   http://www.pcisys.net/~melanson/codecs
- *
- * Supports: BGR24 (RGB 24bpp)
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-#include "lcl.h"
-
-#include <zlib.h>
-
-/*
- * Decoder context
- */
-typedef struct LclEncContext {
-
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    // Image type
-    int imgtype;
-    // Compression type
-    int compression;
-    // Flags
-    int flags;
-    z_stream zstream;
-} LclEncContext;
-
-/*
- *
- * Encode a frame
- *
- */
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    LclEncContext *c = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p = &c->pic;
-    int i;
-    int zret; // Zlib return code
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    if(avctx->pix_fmt != PIX_FMT_BGR24){
-        av_log(avctx, AV_LOG_ERROR, "Format not supported!\n");
-        return -1;
-    }
-
-    zret = deflateReset(&c->zstream);
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Deflate reset error: %d\n", zret);
-        return -1;
-    }
-    c->zstream.next_out = buf;
-    c->zstream.avail_out = buf_size;
-
-    for(i = avctx->height - 1; i >= 0; i--) {
-        c->zstream.next_in = p->data[0]+p->linesize[0]*i;
-        c->zstream.avail_in = avctx->width*3;
-        zret = deflate(&c->zstream, Z_NO_FLUSH);
-        if (zret != Z_OK) {
-            av_log(avctx, AV_LOG_ERROR, "Deflate error: %d\n", zret);
-            return -1;
-        }
-    }
-    zret = deflate(&c->zstream, Z_FINISH);
-    if (zret != Z_STREAM_END) {
-        av_log(avctx, AV_LOG_ERROR, "Deflate error: %d\n", zret);
-        return -1;
-    }
-
-    return c->zstream.total_out;
-}
-
-/*
- *
- * Init lcl encoder
- *
- */
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    LclEncContext *c = avctx->priv_data;
-    int zret; // Zlib return code
-
-    c->avctx= avctx;
-
-    assert(avctx->width && avctx->height);
-
-    avctx->extradata= av_mallocz(8);
-    avctx->coded_frame= &c->pic;
-
-    // Will be user settable someday
-    c->compression = 6;
-    c->flags = 0;
-
-    switch(avctx->pix_fmt){
-        case PIX_FMT_BGR24:
-            c->imgtype = IMGTYPE_RGB24;
-            avctx->bits_per_coded_sample= 24;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Input pixel format %s not supported\n", avcodec_get_pix_fmt_name(avctx->pix_fmt));
-            return -1;
-    }
-
-    avctx->extradata[0]= 4;
-    avctx->extradata[1]= 0;
-    avctx->extradata[2]= 0;
-    avctx->extradata[3]= 0;
-    avctx->extradata[4]= c->imgtype;
-    avctx->extradata[5]= c->compression;
-    avctx->extradata[6]= c->flags;
-    avctx->extradata[7]= CODEC_ZLIB;
-    c->avctx->extradata_size= 8;
-
-    c->zstream.zalloc = Z_NULL;
-    c->zstream.zfree = Z_NULL;
-    c->zstream.opaque = Z_NULL;
-    zret = deflateInit(&c->zstream, c->compression);
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Deflate init error: %d\n", zret);
-        return 1;
-    }
-
-    return 0;
-}
-
-/*
- *
- * Uninit lcl encoder
- *
- */
-static av_cold int encode_end(AVCodecContext *avctx)
-{
-    LclEncContext *c = avctx->priv_data;
-
-    av_freep(&avctx->extradata);
-    deflateEnd(&c->zstream);
-
-    return 0;
-}
-
-AVCodec zlib_encoder = {
-    "zlib",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ZLIB,
-    sizeof(LclEncContext),
-    encode_init,
-    encode_frame,
-    encode_end,
-    .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"),
-};
diff --git a/libavcodec/libavcodec.v b/libavcodec/libavcodec.v
deleted file mode 100644
index 561a42c..0000000
--- a/libavcodec/libavcodec.v
+++ /dev/null
@@ -1,3 +0,0 @@
-LIBAVCODEC_$MAJOR {
-        global: *;
-};
diff --git a/libavcodec/libdirac.h b/libavcodec/libdirac.h
deleted file mode 100644
index 0dc19ca..0000000
--- a/libavcodec/libdirac.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* data structures common to libdiracenc.c and libdiracdec.c
-*/
-
-#ifndef AVCODEC_LIBDIRAC_H
-#define AVCODEC_LIBDIRAC_H
-
-#include "avcodec.h"
-#include <libdirac_common/dirac_types.h>
-
-/**
-* Table providing a Dirac chroma format to FFmpeg pixel format mapping.
-*/
-static const struct {
-    enum PixelFormat ff_pix_fmt;
-    dirac_chroma_t dirac_pix_fmt;
-} ffmpeg_dirac_pixel_format_map[] = {
-    { PIX_FMT_YUV420P, format420 },
-    { PIX_FMT_YUV422P, format422 },
-    { PIX_FMT_YUV444P, format444 },
-};
-
-#endif /* AVCODEC_LIBDIRAC_H */
diff --git a/libavcodec/libdirac_libschro.c b/libavcodec/libdirac_libschro.c
deleted file mode 100644
index aee1858..0000000
--- a/libavcodec/libdirac_libschro.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* functions common to libdirac and libschroedinger
-*/
-
-#include "libdirac_libschro.h"
-
-static const FfmpegDiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = {
-    { 640,  480,  24000, 1001},
-    { 176,  120,  15000, 1001},
-    { 176,  144,  25,    2   },
-    { 352,  240,  15000, 1001},
-    { 352,  288,  25,    2   },
-    { 704,  480,  15000, 1001},
-    { 704,  576,  25,    2   },
-    { 720,  480,  30000, 1001},
-    { 720,  576,  25,    1   },
-    { 1280, 720,  60000, 1001},
-    { 1280, 720,  50,    1   },
-    { 1920, 1080, 30000, 1001},
-    { 1920, 1080, 25,    1   },
-    { 1920, 1080, 60000, 1001},
-    { 1920, 1080, 50,    1   },
-    { 2048, 1080, 24,    1   },
-    { 4096, 2160, 24,    1   },
-};
-
-unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext)
-{
-    unsigned int ret_idx = 0;
-    unsigned int idx;
-    unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) /
-                               sizeof(ff_dirac_schro_video_format_info[0]);
-
-    for (idx = 1; idx < num_formats; ++idx) {
-        const FfmpegDiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx];
-        if (avccontext->width  == vf->width &&
-            avccontext->height == vf->height) {
-            ret_idx = idx;
-            if (avccontext->time_base.den == vf->frame_rate_num &&
-                avccontext->time_base.num == vf->frame_rate_denom)
-                return idx;
-        }
-    }
-    return ret_idx;
-}
-
-void ff_dirac_schro_queue_init(FfmpegDiracSchroQueue *queue)
-{
-    queue->p_head = queue->p_tail = NULL;
-    queue->size = 0;
-}
-
-void ff_dirac_schro_queue_free(FfmpegDiracSchroQueue *queue,
-                               void (*free_func)(void *))
-{
-    while (queue->p_head)
-        free_func(ff_dirac_schro_queue_pop(queue));
-}
-
-int ff_dirac_schro_queue_push_back(FfmpegDiracSchroQueue *queue, void *p_data)
-{
-    FfmpegDiracSchroQueueElement *p_new = av_mallocz(sizeof(FfmpegDiracSchroQueueElement));
-
-    if (!p_new)
-        return -1;
-
-    p_new->data = p_data;
-
-    if (!queue->p_head)
-        queue->p_head = p_new;
-    else
-        queue->p_tail->next = p_new;
-    queue->p_tail = p_new;
-
-    ++queue->size;
-    return 0;
-}
-
-void *ff_dirac_schro_queue_pop(FfmpegDiracSchroQueue *queue)
-{
-    FfmpegDiracSchroQueueElement *top = queue->p_head;
-
-    if (top) {
-        void *data = top->data;
-        queue->p_head = queue->p_head->next;
-        --queue->size;
-        av_freep(&top);
-        return data;
-    }
-
-    return NULL;
-}
diff --git a/libavcodec/libdirac_libschro.h b/libavcodec/libdirac_libschro.h
deleted file mode 100644
index 3d63f97..0000000
--- a/libavcodec/libdirac_libschro.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* data structures common to libdirac and libschroedinger
-*/
-
-#ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H
-#define AVCODEC_LIBDIRAC_LIBSCHRO_H
-
-#include "avcodec.h"
-
-typedef struct {
-    uint16_t width;
-    uint16_t height;
-    uint16_t frame_rate_num;
-    uint16_t frame_rate_denom;
-} FfmpegDiracSchroVideoFormatInfo;
-
-/**
-* Returns the index into the Dirac Schro common video format info table
-*/
-unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext);
-
-/**
-* contains a single encoded frame returned from Dirac or Schroedinger
-*/
-typedef struct FfmpegDiracSchroEncodedFrame {
-    /** encoded frame data */
-    uint8_t *p_encbuf;
-
-    /** encoded frame size */
-    uint32_t size;
-
-    /** encoded frame number. Will be used as pts */
-    uint32_t frame_num;
-
-    /** key frame flag. 1 : is key frame , 0 : in not key frame */
-    uint16_t key_frame;
-} FfmpegDiracSchroEncodedFrame;
-
-/**
-* queue element
-*/
-typedef struct FfmpegDiracSchroQueueElement {
-    /** Data to be stored in queue*/
-    void *data;
-    /** Pointer to next element queue */
-    struct FfmpegDiracSchroQueueElement *next;
-} FfmpegDiracSchroQueueElement;
-
-
-/**
-* A simple queue implementation used in libdirac and libschroedinger
-*/
-typedef struct FfmpegDiracSchroQueue {
-    /** Pointer to head of queue */
-    FfmpegDiracSchroQueueElement *p_head;
-    /** Pointer to tail of queue */
-    FfmpegDiracSchroQueueElement *p_tail;
-    /** Queue size*/
-    int size;
-} FfmpegDiracSchroQueue;
-
-/**
-* Initialise the queue
-*/
-void ff_dirac_schro_queue_init(FfmpegDiracSchroQueue *queue);
-
-/**
-* Add an element to the end of the queue
-*/
-int ff_dirac_schro_queue_push_back(FfmpegDiracSchroQueue *queue, void *p_data);
-
-/**
-* Return the first element in the queue
-*/
-void *ff_dirac_schro_queue_pop(FfmpegDiracSchroQueue *queue);
-
-/**
-* Free the queue resources. free_func is a function supplied by the caller to
-* free any resources allocated by the caller. The data field of the queue
-* element is passed to it.
-*/
-void ff_dirac_schro_queue_free(FfmpegDiracSchroQueue *queue,
-                               void (*free_func)(void *));
-#endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */
diff --git a/libavcodec/libdiracdec.c b/libavcodec/libdiracdec.c
deleted file mode 100644
index d24d3ba..0000000
--- a/libavcodec/libdiracdec.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Dirac decoder support via libdirac library
- * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk>
- * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* Dirac decoder support via libdirac library; more details about the Dirac
-* project can be found at http://dirac.sourceforge.net/.
-* The libdirac_decoder library implements Dirac specification version 2.2
-* (http://dirac.sourceforge.net/specification.html).
-*/
-
-#include "libdirac.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#include <libdirac_decoder/dirac_parser.h>
-
-/** contains a single frame returned from Dirac */
-typedef struct FfmpegDiracDecoderParams {
-    /** decoder handle */
-    dirac_decoder_t* p_decoder;
-
-    /** buffer to hold decoded frame */
-    unsigned char* p_out_frame_buf;
-} FfmpegDiracDecoderParams;
-
-
-/**
-* returns FFmpeg chroma format
-*/
-static enum PixelFormat GetFfmpegChromaFormat(dirac_chroma_t dirac_pix_fmt)
-{
-    int num_formats = sizeof(ffmpeg_dirac_pixel_format_map) /
-                      sizeof(ffmpeg_dirac_pixel_format_map[0]);
-    int idx;
-
-    for (idx = 0; idx < num_formats; ++idx)
-        if (ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt == dirac_pix_fmt)
-            return ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt;
-    return PIX_FMT_NONE;
-}
-
-static av_cold int libdirac_decode_init(AVCodecContext *avccontext)
-{
-
-    FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data;
-    p_dirac_params->p_decoder =  dirac_decoder_init(avccontext->debug);
-
-    if (!p_dirac_params->p_decoder)
-        return -1;
-
-    return 0;
-}
-
-static int libdirac_decode_frame(AVCodecContext *avccontext,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-
-    FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data;
-    AVPicture *picture = data;
-    AVPicture pic;
-    int pict_size;
-    unsigned char *buffer[3];
-
-    *data_size = 0;
-
-    if (buf_size > 0) {
-        /* set data to decode into buffer */
-        dirac_buffer(p_dirac_params->p_decoder, buf, buf + buf_size);
-        if ((buf[4] & 0x08) == 0x08 && (buf[4] & 0x03))
-            avccontext->has_b_frames = 1;
-    }
-    while (1) {
-         /* parse data and process result */
-        DecoderState state = dirac_parse(p_dirac_params->p_decoder);
-        switch (state) {
-        case STATE_BUFFER:
-            return buf_size;
-
-        case STATE_SEQUENCE:
-        {
-            /* tell FFmpeg about sequence details */
-            dirac_sourceparams_t *src_params = &p_dirac_params->p_decoder->src_params;
-
-            if (avcodec_check_dimensions(avccontext, src_params->width,
-                                         src_params->height) < 0) {
-                av_log(avccontext, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n",
-                       src_params->width, src_params->height);
-                avccontext->height = avccontext->width = 0;
-                return -1;
-            }
-
-            avccontext->height = src_params->height;
-            avccontext->width  = src_params->width;
-
-            avccontext->pix_fmt = GetFfmpegChromaFormat(src_params->chroma);
-            if (avccontext->pix_fmt == PIX_FMT_NONE) {
-                av_log(avccontext, AV_LOG_ERROR,
-                       "Dirac chroma format %d not supported currently\n",
-                       src_params->chroma);
-                return -1;
-            }
-
-            avccontext->time_base.den = src_params->frame_rate.numerator;
-            avccontext->time_base.num = src_params->frame_rate.denominator;
-
-            /* calculate output dimensions */
-            avpicture_fill(&pic, NULL, avccontext->pix_fmt,
-                           avccontext->width, avccontext->height);
-
-            pict_size = avpicture_get_size(avccontext->pix_fmt,
-                                           avccontext->width,
-                                           avccontext->height);
-
-            /* allocate output buffer */
-            if (!p_dirac_params->p_out_frame_buf)
-                p_dirac_params->p_out_frame_buf = av_malloc(pict_size);
-            buffer[0] = p_dirac_params->p_out_frame_buf;
-            buffer[1] = p_dirac_params->p_out_frame_buf +
-                        pic.linesize[0] * avccontext->height;
-            buffer[2] = buffer[1] +
-                        pic.linesize[1] * src_params->chroma_height;
-
-            /* tell Dirac about output destination */
-            dirac_set_buf(p_dirac_params->p_decoder, buffer, NULL);
-            break;
-        }
-        case STATE_SEQUENCE_END:
-            break;
-
-        case STATE_PICTURE_AVAIL:
-            /* fill picture with current buffer data from Dirac */
-            avpicture_fill(picture, p_dirac_params->p_out_frame_buf,
-                           avccontext->pix_fmt,
-                           avccontext->width, avccontext->height);
-            *data_size = sizeof(AVPicture);
-            return buf_size;
-
-        case STATE_INVALID:
-            return -1;
-
-        default:
-            break;
-        }
-    }
-
-    return buf_size;
-}
-
-
-static av_cold int libdirac_decode_close(AVCodecContext *avccontext)
-{
-    FfmpegDiracDecoderParams *p_dirac_params = avccontext->priv_data;
-    dirac_decoder_close(p_dirac_params->p_decoder);
-
-    av_freep(&p_dirac_params->p_out_frame_buf);
-
-    return 0;
-}
-
-static void libdirac_flush(AVCodecContext *avccontext)
-{
-    /* Got a seek request. We will need free memory held in the private
-     * context and free the current Dirac decoder handle and then open
-     * a new decoder handle. */
-    libdirac_decode_close(avccontext);
-    libdirac_decode_init(avccontext);
-    return;
-}
-
-
-
-AVCodec libdirac_decoder = {
-    "libdirac",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DIRAC,
-    sizeof(FfmpegDiracDecoderParams),
-    libdirac_decode_init,
-    NULL,
-    libdirac_decode_close,
-    libdirac_decode_frame,
-    CODEC_CAP_DELAY,
-    .flush = libdirac_flush,
-    .long_name = NULL_IF_CONFIG_SMALL("libdirac Dirac 2.2"),
-};
diff --git a/libavcodec/libdiracenc.c b/libavcodec/libdiracenc.c
deleted file mode 100644
index d390aa8..0000000
--- a/libavcodec/libdiracenc.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Dirac encoding support via libdirac library
- * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk>
- * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* Dirac encoding support via libdirac library; more details about the
-* Dirac project can be found at http://dirac.sourceforge.net/.
-* The libdirac_encoder library implements Dirac specification version 2.2
-* (http://dirac.sourceforge.net/specification.html).
-*/
-
-#include "libdirac_libschro.h"
-#include "libdirac.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-#include <libdirac_encoder/dirac_encoder.h>
-
-/** Dirac encoder private data */
-typedef struct FfmpegDiracEncoderParams {
-    /** Dirac encoder context */
-    dirac_encoder_context_t enc_ctx;
-
-    /** frame being encoded */
-    AVFrame picture;
-
-    /** frame size */
-    int frame_size;
-
-    /** Dirac encoder handle */
-    dirac_encoder_t* p_encoder;
-
-    /** input frame buffer */
-    unsigned char *p_in_frame_buf;
-
-    /** buffer to store encoder output before writing it to the frame queue */
-    unsigned char *enc_buf;
-
-    /** size of encoder buffer */
-    int enc_buf_size;
-
-    /** queue storing encoded frames */
-    FfmpegDiracSchroQueue enc_frame_queue;
-
-    /** end of sequence signalled by user, 0 - false, 1 - true */
-    int eos_signalled;
-
-    /** end of sequence returned by encoder, 0 - false, 1 - true */
-    int eos_pulled;
-} FfmpegDiracEncoderParams;
-
-/**
-* Works out Dirac-compatible chroma format.
-*/
-static dirac_chroma_t GetDiracChromaFormat(enum PixelFormat ff_pix_fmt)
-{
-    int num_formats = sizeof(ffmpeg_dirac_pixel_format_map) /
-                      sizeof(ffmpeg_dirac_pixel_format_map[0]);
-    int idx;
-
-    for (idx = 0; idx < num_formats; ++idx)
-        if (ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt == ff_pix_fmt)
-            return ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt;
-    return formatNK;
-}
-
-/**
-* Dirac video preset table. Ensure that this tables matches up correctly
-* with the ff_dirac_schro_video_format_info table in libdirac_libschro.c.
-*/
-static const VideoFormat ff_dirac_video_formats[]={
-    VIDEO_FORMAT_CUSTOM           ,
-    VIDEO_FORMAT_QSIF525          ,
-    VIDEO_FORMAT_QCIF             ,
-    VIDEO_FORMAT_SIF525           ,
-    VIDEO_FORMAT_CIF              ,
-    VIDEO_FORMAT_4SIF525          ,
-    VIDEO_FORMAT_4CIF             ,
-    VIDEO_FORMAT_SD_480I60        ,
-    VIDEO_FORMAT_SD_576I50        ,
-    VIDEO_FORMAT_HD_720P60        ,
-    VIDEO_FORMAT_HD_720P50        ,
-    VIDEO_FORMAT_HD_1080I60       ,
-    VIDEO_FORMAT_HD_1080I50       ,
-    VIDEO_FORMAT_HD_1080P60       ,
-    VIDEO_FORMAT_HD_1080P50       ,
-    VIDEO_FORMAT_DIGI_CINEMA_2K24 ,
-    VIDEO_FORMAT_DIGI_CINEMA_4K24 ,
-};
-
-/**
-* Returns the video format preset matching the input video dimensions and
-* time base.
-*/
-static VideoFormat GetDiracVideoFormatPreset(AVCodecContext *avccontext)
-{
-    unsigned int num_formats = sizeof(ff_dirac_video_formats) /
-                               sizeof(ff_dirac_video_formats[0]);
-
-    unsigned int idx = ff_dirac_schro_get_video_format_idx(avccontext);
-
-    return (idx < num_formats) ?
-                 ff_dirac_video_formats[idx] : VIDEO_FORMAT_CUSTOM;
-}
-
-static av_cold int libdirac_encode_init(AVCodecContext *avccontext)
-{
-
-    FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data;
-    int no_local = 1;
-    int verbose  = avccontext->debug;
-    VideoFormat preset;
-
-    /* get Dirac preset */
-    preset = GetDiracVideoFormatPreset(avccontext);
-
-    /* initialize the encoder context */
-    dirac_encoder_context_init(&(p_dirac_params->enc_ctx), preset);
-
-    p_dirac_params->enc_ctx.src_params.chroma = GetDiracChromaFormat(avccontext->pix_fmt);
-
-    if (p_dirac_params->enc_ctx.src_params.chroma == formatNK) {
-        av_log(avccontext, AV_LOG_ERROR,
-               "Unsupported pixel format %d. This codec supports only "
-               "Planar YUV formats (yuv420p, yuv422p, yuv444p\n",
-               avccontext->pix_fmt);
-        return -1;
-    }
-
-    p_dirac_params->enc_ctx.src_params.frame_rate.numerator   = avccontext->time_base.den;
-    p_dirac_params->enc_ctx.src_params.frame_rate.denominator = avccontext->time_base.num;
-
-    p_dirac_params->enc_ctx.src_params.width  = avccontext->width;
-    p_dirac_params->enc_ctx.src_params.height = avccontext->height;
-
-    p_dirac_params->frame_size = avpicture_get_size(avccontext->pix_fmt,
-                                                    avccontext->width,
-                                                    avccontext->height);
-
-    avccontext->coded_frame = &p_dirac_params->picture;
-
-    if (no_local) {
-        p_dirac_params->enc_ctx.decode_flag = 0;
-        p_dirac_params->enc_ctx.instr_flag  = 0;
-    } else {
-        p_dirac_params->enc_ctx.decode_flag = 1;
-        p_dirac_params->enc_ctx.instr_flag  = 1;
-    }
-
-    /* Intra-only sequence */
-    if (!avccontext->gop_size) {
-        p_dirac_params->enc_ctx.enc_params.num_L1 = 0;
-        if (avccontext->coder_type == FF_CODER_TYPE_VLC)
-            p_dirac_params->enc_ctx.enc_params.using_ac = 0;
-    } else
-        avccontext->has_b_frames = 1;
-
-    if (avccontext->flags & CODEC_FLAG_QSCALE) {
-        if (avccontext->global_quality) {
-            p_dirac_params->enc_ctx.enc_params.qf = avccontext->global_quality
-                                                    / (FF_QP2LAMBDA * 10.0);
-            /* if it is not default bitrate then send target rate. */
-            if (avccontext->bit_rate >= 1000 &&
-                avccontext->bit_rate != 200000)
-                p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate
-                                                           / 1000;
-        } else
-            p_dirac_params->enc_ctx.enc_params.lossless = 1;
-    } else if (avccontext->bit_rate >= 1000)
-        p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate / 1000;
-
-    if ((preset > VIDEO_FORMAT_QCIF || preset < VIDEO_FORMAT_QSIF525) &&
-         avccontext->bit_rate == 200000)
-        p_dirac_params->enc_ctx.enc_params.trate = 0;
-
-    if (avccontext->flags & CODEC_FLAG_INTERLACED_ME)
-        /* all material can be coded as interlaced or progressive
-         * irrespective of the type of source material */
-        p_dirac_params->enc_ctx.enc_params.picture_coding_mode = 1;
-
-    p_dirac_params->p_encoder = dirac_encoder_init(&(p_dirac_params->enc_ctx),
-                                                   verbose);
-
-    if (!p_dirac_params->p_encoder) {
-        av_log(avccontext, AV_LOG_ERROR,
-               "Unrecoverable Error: dirac_encoder_init failed. ");
-        return EXIT_FAILURE;
-    }
-
-    /* allocate enough memory for the incoming data */
-    p_dirac_params->p_in_frame_buf = av_malloc(p_dirac_params->frame_size);
-
-    /* initialize the encoded frame queue */
-    ff_dirac_schro_queue_init(&p_dirac_params->enc_frame_queue);
-
-    return 0;
-}
-
-static void DiracFreeFrame(void *data)
-{
-    FfmpegDiracSchroEncodedFrame *enc_frame = data;
-
-    av_freep(&(enc_frame->p_encbuf));
-    av_free(enc_frame);
-}
-
-static int libdirac_encode_frame(AVCodecContext *avccontext,
-                                 unsigned char *frame,
-                                 int buf_size, void *data)
-{
-    int enc_size = 0;
-    dirac_encoder_state_t state;
-    FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data;
-    FfmpegDiracSchroEncodedFrame* p_frame_output      = NULL;
-    FfmpegDiracSchroEncodedFrame* p_next_output_frame = NULL;
-    int go = 1;
-    int last_frame_in_sequence = 0;
-
-    if (!data) {
-        /* push end of sequence if not already signalled */
-        if (!p_dirac_params->eos_signalled) {
-            dirac_encoder_end_sequence(p_dirac_params->p_encoder);
-            p_dirac_params->eos_signalled = 1;
-        }
-    } else {
-
-        /* Allocate frame data to Dirac input buffer.
-         * Input line size may differ from what the codec supports,
-         * especially when transcoding from one format to another.
-         * So use avpicture_layout to copy the frame. */
-        avpicture_layout((AVPicture *)data, avccontext->pix_fmt,
-                         avccontext->width, avccontext->height,
-                         p_dirac_params->p_in_frame_buf,
-                         p_dirac_params->frame_size);
-
-        /* load next frame */
-        if (dirac_encoder_load(p_dirac_params->p_encoder,
-                               p_dirac_params->p_in_frame_buf,
-                               p_dirac_params->frame_size) < 0) {
-            av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Encoder Error."
-                   " dirac_encoder_load failed...\n");
-            return -1;
-        }
-    }
-
-    if (p_dirac_params->eos_pulled)
-        go = 0;
-
-    while (go) {
-        p_dirac_params->p_encoder->enc_buf.buffer = frame;
-        p_dirac_params->p_encoder->enc_buf.size   = buf_size;
-        /* process frame */
-        state = dirac_encoder_output(p_dirac_params->p_encoder);
-
-        switch (state) {
-        case ENC_STATE_AVAIL:
-        case ENC_STATE_EOS:
-            assert(p_dirac_params->p_encoder->enc_buf.size > 0);
-
-            /* All non-frame data is prepended to actual frame data to
-             * be able to set the pts correctly. So we don't write data
-             * to the frame output queue until we actually have a frame
-             */
-
-            p_dirac_params->enc_buf = av_realloc(p_dirac_params->enc_buf,
-                                                 p_dirac_params->enc_buf_size +
-                                                 p_dirac_params->p_encoder->enc_buf.size);
-            memcpy(p_dirac_params->enc_buf + p_dirac_params->enc_buf_size,
-                   p_dirac_params->p_encoder->enc_buf.buffer,
-                   p_dirac_params->p_encoder->enc_buf.size);
-
-            p_dirac_params->enc_buf_size += p_dirac_params->p_encoder->enc_buf.size;
-
-            if (state == ENC_STATE_EOS) {
-                p_dirac_params->eos_pulled = 1;
-                go = 0;
-            }
-
-            /* If non-frame data, don't output it until it we get an
-             * encoded frame back from the encoder. */
-            if (p_dirac_params->p_encoder->enc_pparams.pnum == -1)
-                break;
-
-            /* create output frame */
-            p_frame_output = av_mallocz(sizeof(FfmpegDiracSchroEncodedFrame));
-            /* set output data */
-            p_frame_output->size      = p_dirac_params->enc_buf_size;
-            p_frame_output->p_encbuf  = p_dirac_params->enc_buf;
-            p_frame_output->frame_num = p_dirac_params->p_encoder->enc_pparams.pnum;
-
-            if (p_dirac_params->p_encoder->enc_pparams.ptype == INTRA_PICTURE &&
-                p_dirac_params->p_encoder->enc_pparams.rtype == REFERENCE_PICTURE)
-                p_frame_output->key_frame = 1;
-
-            ff_dirac_schro_queue_push_back(&p_dirac_params->enc_frame_queue,
-                                           p_frame_output);
-
-            p_dirac_params->enc_buf_size = 0;
-            p_dirac_params->enc_buf      = NULL;
-            break;
-
-        case ENC_STATE_BUFFER:
-            go = 0;
-            break;
-
-        case ENC_STATE_INVALID:
-            av_log(avccontext, AV_LOG_ERROR,
-                   "Unrecoverable Dirac Encoder Error. Quitting...\n");
-            return -1;
-
-        default:
-            av_log(avccontext, AV_LOG_ERROR, "Unknown Dirac Encoder state\n");
-            return -1;
-        }
-    }
-
-    /* copy 'next' frame in queue */
-
-    if (p_dirac_params->enc_frame_queue.size == 1 && p_dirac_params->eos_pulled)
-        last_frame_in_sequence = 1;
-
-    p_next_output_frame = ff_dirac_schro_queue_pop(&p_dirac_params->enc_frame_queue);
-
-    if (!p_next_output_frame)
-        return 0;
-
-    memcpy(frame, p_next_output_frame->p_encbuf, p_next_output_frame->size);
-    avccontext->coded_frame->key_frame = p_next_output_frame->key_frame;
-    /* Use the frame number of the encoded frame as the pts. It is OK to do
-     * so since Dirac is a constant framerate codec. It expects input to be
-     * of constant framerate. */
-    avccontext->coded_frame->pts = p_next_output_frame->frame_num;
-    enc_size = p_next_output_frame->size;
-
-    /* Append the end of sequence information to the last frame in the
-     * sequence. */
-    if (last_frame_in_sequence && p_dirac_params->enc_buf_size > 0) {
-        memcpy(frame + enc_size, p_dirac_params->enc_buf,
-               p_dirac_params->enc_buf_size);
-        enc_size += p_dirac_params->enc_buf_size;
-        av_freep(&p_dirac_params->enc_buf);
-        p_dirac_params->enc_buf_size = 0;
-    }
-
-    /* free frame */
-    DiracFreeFrame(p_next_output_frame);
-
-    return enc_size;
-}
-
-static av_cold int libdirac_encode_close(AVCodecContext *avccontext)
-{
-    FfmpegDiracEncoderParams* p_dirac_params  = avccontext->priv_data;
-
-    /* close the encoder */
-    dirac_encoder_close(p_dirac_params->p_encoder);
-
-    /* free data in the output frame queue */
-    ff_dirac_schro_queue_free(&p_dirac_params->enc_frame_queue,
-                              DiracFreeFrame);
-
-    /* free the encoder buffer */
-    if (p_dirac_params->enc_buf_size)
-        av_freep(&p_dirac_params->enc_buf);
-
-    /* free the input frame buffer */
-    av_freep(&p_dirac_params->p_in_frame_buf);
-
-    return 0;
-}
-
-
-AVCodec libdirac_encoder = {
-    "libdirac",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DIRAC,
-    sizeof(FfmpegDiracEncoderParams),
-    libdirac_encode_init,
-    libdirac_encode_frame,
-    libdirac_encode_close,
-   .capabilities = CODEC_CAP_DELAY,
-   .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
-   .long_name = NULL_IF_CONFIG_SMALL("libdirac Dirac 2.2"),
-};
diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c
deleted file mode 100644
index 82fd05b..0000000
--- a/libavcodec/libfaac.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Interface to libfaac for aac encoding
- * Copyright (c) 2002 Gildas Bazin <gbazin at netcourrier.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Interface to libfaac for aac encoding.
- */
-
-#include "avcodec.h"
-#include <faac.h>
-
-typedef struct FaacAudioContext {
-    faacEncHandle faac_handle;
-} FaacAudioContext;
-
-static av_cold int Faac_encode_init(AVCodecContext *avctx)
-{
-    FaacAudioContext *s = avctx->priv_data;
-    faacEncConfigurationPtr faac_cfg;
-    unsigned long samples_input, max_bytes_output;
-
-    /* number of channels */
-    if (avctx->channels < 1 || avctx->channels > 6) {
-        av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed\n", avctx->channels);
-        return -1;
-    }
-
-    s->faac_handle = faacEncOpen(avctx->sample_rate,
-                                 avctx->channels,
-                                 &samples_input, &max_bytes_output);
-
-    /* check faac version */
-    faac_cfg = faacEncGetCurrentConfiguration(s->faac_handle);
-    if (faac_cfg->version != FAAC_CFG_VERSION) {
-        av_log(avctx, AV_LOG_ERROR, "wrong libfaac version (compiled for: %d, using %d)\n", FAAC_CFG_VERSION, faac_cfg->version);
-        faacEncClose(s->faac_handle);
-        return -1;
-    }
-
-    /* put the options in the configuration struct */
-    switch(avctx->profile) {
-        case FF_PROFILE_AAC_MAIN:
-            faac_cfg->aacObjectType = MAIN;
-            break;
-        case FF_PROFILE_UNKNOWN:
-        case FF_PROFILE_AAC_LOW:
-            faac_cfg->aacObjectType = LOW;
-            break;
-        case FF_PROFILE_AAC_SSR:
-            faac_cfg->aacObjectType = SSR;
-            break;
-        case FF_PROFILE_AAC_LTP:
-            faac_cfg->aacObjectType = LTP;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "invalid AAC profile\n");
-            faacEncClose(s->faac_handle);
-            return -1;
-    }
-    faac_cfg->mpegVersion = MPEG4;
-    faac_cfg->useTns = 0;
-    faac_cfg->allowMidside = 1;
-    faac_cfg->bitRate = avctx->bit_rate / avctx->channels;
-    faac_cfg->bandWidth = avctx->cutoff;
-    if(avctx->flags & CODEC_FLAG_QSCALE) {
-        faac_cfg->bitRate = 0;
-        faac_cfg->quantqual = avctx->global_quality / FF_QP2LAMBDA;
-    }
-    faac_cfg->outputFormat = 1;
-    faac_cfg->inputFormat = FAAC_INPUT_16BIT;
-
-    avctx->frame_size = samples_input / avctx->channels;
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    /* Set decoder specific info */
-    avctx->extradata_size = 0;
-    if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
-
-        unsigned char *buffer = NULL;
-        unsigned long decoder_specific_info_size;
-
-        if (!faacEncGetDecoderSpecificInfo(s->faac_handle, &buffer,
-                                           &decoder_specific_info_size)) {
-            avctx->extradata = av_malloc(decoder_specific_info_size + FF_INPUT_BUFFER_PADDING_SIZE);
-            avctx->extradata_size = decoder_specific_info_size;
-            memcpy(avctx->extradata, buffer, avctx->extradata_size);
-            faac_cfg->outputFormat = 0;
-        }
-#undef free
-        free(buffer);
-#define free please_use_av_free
-    }
-
-    if (!faacEncSetConfiguration(s->faac_handle, faac_cfg)) {
-        av_log(avctx, AV_LOG_ERROR, "libfaac doesn't support this output format!\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static int Faac_encode_frame(AVCodecContext *avctx,
-                             unsigned char *frame, int buf_size, void *data)
-{
-    FaacAudioContext *s = avctx->priv_data;
-    int bytes_written;
-
-    bytes_written = faacEncEncode(s->faac_handle,
-                                  data,
-                                  avctx->frame_size * avctx->channels,
-                                  frame,
-                                  buf_size);
-
-    return bytes_written;
-}
-
-static av_cold int Faac_encode_close(AVCodecContext *avctx)
-{
-    FaacAudioContext *s = avctx->priv_data;
-
-    av_freep(&avctx->coded_frame);
-    av_freep(&avctx->extradata);
-
-    faacEncClose(s->faac_handle);
-    return 0;
-}
-
-AVCodec libfaac_encoder = {
-    "libfaac",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AAC,
-    sizeof(FaacAudioContext),
-    Faac_encode_init,
-    Faac_encode_frame,
-    Faac_encode_close,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("libfaac AAC (Advanced Audio Codec)"),
-};
diff --git a/libavcodec/libfaad.c b/libavcodec/libfaad.c
deleted file mode 100644
index 679729a..0000000
--- a/libavcodec/libfaad.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Faad decoder
- * Copyright (c) 2003 Zdenek Kabelac
- * Copyright (c) 2004 Thomas Raivio
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AAC decoder.
- *
- * still a bit unfinished - but it plays something
- */
-
-#include "avcodec.h"
-#include "faad.h"
-
-#ifndef FAADAPI
-#define FAADAPI
-#endif
-
-/*
- * when CONFIG_LIBFAADBIN is true libfaad will be opened at runtime
- */
-//#undef CONFIG_LIBFAADBIN
-//#define CONFIG_LIBFAADBIN 0
-//#define CONFIG_LIBFAADBIN 1
-
-#if CONFIG_LIBFAADBIN
-#include <dlfcn.h>
-static const char* const libfaadname = "libfaad.so";
-#else
-#define dlopen(a)
-#define dlclose(a)
-#endif
-
-typedef struct {
-    void* handle;               /* dlopen handle */
-    void* faac_handle;          /* FAAD library handle */
-    int sample_size;
-    int init;
-
-    /* faad calls */
-    faacDecHandle FAADAPI (*faacDecOpen)(void);
-    faacDecConfigurationPtr FAADAPI (*faacDecGetCurrentConfiguration)(faacDecHandle hDecoder);
-#ifndef FAAD2_VERSION
-    int FAADAPI (*faacDecSetConfiguration)(faacDecHandle hDecoder,
-                                           faacDecConfigurationPtr config);
-    int FAADAPI (*faacDecInit)(faacDecHandle hDecoder,
-                               unsigned char *buffer,
-                               unsigned long *samplerate,
-                               unsigned long *channels);
-    int FAADAPI (*faacDecInit2)(faacDecHandle hDecoder, unsigned char *pBuffer,
-                                unsigned long SizeOfDecoderSpecificInfo,
-                                unsigned long *samplerate, unsigned long *channels);
-    int FAADAPI (*faacDecDecode)(faacDecHandle hDecoder,
-                                 unsigned char *buffer,
-                                 unsigned long *bytesconsumed,
-                                 short *sample_buffer,
-                                 unsigned long *samples);
-#else
-    unsigned char FAADAPI (*faacDecSetConfiguration)(faacDecHandle hDecoder,
-                                                     faacDecConfigurationPtr config);
-    long FAADAPI (*faacDecInit)(faacDecHandle hDecoder,
-                                unsigned char *buffer,
-                                unsigned long buffer_size,
-                                unsigned long *samplerate,
-                                unsigned char *channels);
-    char FAADAPI (*faacDecInit2)(faacDecHandle hDecoder, unsigned char *pBuffer,
-                                 unsigned long SizeOfDecoderSpecificInfo,
-                                 unsigned long *samplerate, unsigned char *channels);
-    void *FAADAPI (*faacDecDecode)(faacDecHandle hDecoder,
-                                   faacDecFrameInfo *hInfo,
-                                   unsigned char *buffer,
-                                   unsigned long buffer_size);
-    char* FAADAPI (*faacDecGetErrorMessage)(unsigned char errcode);
-#endif
-
-    void FAADAPI (*faacDecClose)(faacDecHandle hDecoder);
-
-
-} FAACContext;
-
-static const unsigned long faac_srates[] =
-{
-    96000, 88200, 64000, 48000, 44100, 32000,
-    24000, 22050, 16000, 12000, 11025, 8000
-};
-
-static void channel_setup(AVCodecContext *avctx)
-{
-#ifdef FAAD2_VERSION
-    FAACContext *s = avctx->priv_data;
-    if (avctx->request_channels > 0 && avctx->request_channels == 2 &&
-        avctx->request_channels < avctx->channels) {
-        faacDecConfigurationPtr faac_cfg;
-        avctx->channels = 2;
-        faac_cfg = s->faacDecGetCurrentConfiguration(s->faac_handle);
-        faac_cfg->downMatrix = 1;
-        s->faacDecSetConfiguration(s->faac_handle, faac_cfg);
-    }
-#endif
-}
-
-static av_cold int faac_init_mp4(AVCodecContext *avctx)
-{
-    FAACContext *s = avctx->priv_data;
-    unsigned long samplerate;
-#ifndef FAAD2_VERSION
-    unsigned long channels;
-#else
-    unsigned char channels;
-#endif
-    int r = 0;
-
-    if (avctx->extradata){
-        r = s->faacDecInit2(s->faac_handle, (uint8_t*) avctx->extradata,
-                            avctx->extradata_size,
-                            &samplerate, &channels);
-        if (r < 0){
-            av_log(avctx, AV_LOG_ERROR,
-                   "faacDecInit2 failed r:%d   sr:%ld  ch:%ld  s:%d\n",
-                   r, samplerate, (long)channels, avctx->extradata_size);
-        } else {
-            avctx->sample_rate = samplerate;
-            avctx->channels = channels;
-            channel_setup(avctx);
-            s->init = 1;
-        }
-    }
-
-    return r;
-}
-
-static int faac_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    FAACContext *s = avctx->priv_data;
-#ifndef FAAD2_VERSION
-    unsigned long bytesconsumed;
-    short *sample_buffer = NULL;
-    unsigned long samples;
-    int out;
-#else
-    faacDecFrameInfo frame_info;
-    void *out;
-#endif
-    if(buf_size == 0)
-        return 0;
-#ifndef FAAD2_VERSION
-    out = s->faacDecDecode(s->faac_handle,
-                           (unsigned char*)buf,
-                           &bytesconsumed,
-                           data,
-                           &samples);
-    samples *= s->sample_size;
-    if (data_size)
-        *data_size = samples;
-    return (buf_size < (int)bytesconsumed)
-        ? buf_size : (int)bytesconsumed;
-#else
-
-    if(!s->init){
-        unsigned long srate;
-        unsigned char channels;
-        int r = s->faacDecInit(s->faac_handle, buf, buf_size, &srate, &channels);
-        if(r < 0){
-            av_log(avctx, AV_LOG_ERROR, "libfaad: codec init failed.\n");
-            return -1;
-        }
-        avctx->sample_rate = srate;
-        avctx->channels = channels;
-        channel_setup(avctx);
-        s->init = 1;
-    }
-
-    out = s->faacDecDecode(s->faac_handle, &frame_info, (unsigned char*)buf, (unsigned long)buf_size);
-
-    if (frame_info.error > 0) {
-        av_log(avctx, AV_LOG_ERROR, "libfaad: frame decoding failed: %s\n",
-               s->faacDecGetErrorMessage(frame_info.error));
-        return -1;
-    }
-    if (!avctx->frame_size)
-        avctx->frame_size = frame_info.samples/avctx->channels;
-    frame_info.samples *= s->sample_size;
-    memcpy(data, out, frame_info.samples); // CHECKME - can we cheat this one
-
-    if (data_size)
-        *data_size = frame_info.samples;
-
-    return (buf_size < (int)frame_info.bytesconsumed)
-        ? buf_size : (int)frame_info.bytesconsumed;
-#endif
-}
-
-static av_cold int faac_decode_end(AVCodecContext *avctx)
-{
-    FAACContext *s = avctx->priv_data;
-
-    s->faacDecClose(s->faac_handle);
-
-    dlclose(s->handle);
-    return 0;
-}
-
-static av_cold int faac_decode_init(AVCodecContext *avctx)
-{
-    FAACContext *s = avctx->priv_data;
-    faacDecConfigurationPtr faac_cfg;
-
-#if CONFIG_LIBFAADBIN
-    const char* err = 0;
-
-    s->handle = dlopen(libfaadname, RTLD_LAZY);
-    if (!s->handle)
-    {
-        av_log(avctx, AV_LOG_ERROR, "FAAD library: %s could not be opened! \n%s\n",
-               libfaadname, dlerror());
-        return -1;
-    }
-
-#define dfaac(a) do {                                                   \
-        const char* n = AV_STRINGIFY(faacDec ## a);                     \
-        if (!err && !(s->faacDec ## a = dlsym(s->handle, n))) {         \
-            err = n;                                                    \
-        }                                                               \
-    } while(0)
-#else  /* !CONFIG_LIBFAADBIN */
-#define dfaac(a)     s->faacDec ## a = faacDec ## a
-#endif /* CONFIG_LIBFAADBIN */
-
-    // resolve all needed function calls
-    dfaac(Open);
-    dfaac(Close);
-    dfaac(GetCurrentConfiguration);
-    dfaac(SetConfiguration);
-    dfaac(Init);
-    dfaac(Init2);
-    dfaac(Decode);
-#ifdef FAAD2_VERSION
-    dfaac(GetErrorMessage);
-#endif
-
-#undef dfaac
-
-#if CONFIG_LIBFAADBIN
-    if (err) {
-        dlclose(s->handle);
-        av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot resolve %s in %s!\n",
-               err, libfaadname);
-        return -1;
-    }
-#endif
-
-    s->faac_handle = s->faacDecOpen();
-    if (!s->faac_handle) {
-        av_log(avctx, AV_LOG_ERROR, "FAAD library: cannot create handler!\n");
-        faac_decode_end(avctx);
-        return -1;
-    }
-
-
-    faac_cfg = s->faacDecGetCurrentConfiguration(s->faac_handle);
-
-    if (faac_cfg) {
-        switch (avctx->bits_per_coded_sample) {
-        case 8: av_log(avctx, AV_LOG_ERROR, "FAADlib unsupported bps %d\n", avctx->bits_per_coded_sample); break;
-        default:
-        case 16:
-#ifdef FAAD2_VERSION
-            faac_cfg->outputFormat = FAAD_FMT_16BIT;
-#endif
-            s->sample_size = 2;
-            break;
-        case 24:
-#ifdef FAAD2_VERSION
-            faac_cfg->outputFormat = FAAD_FMT_24BIT;
-#endif
-            s->sample_size = 3;
-            break;
-        case 32:
-#ifdef FAAD2_VERSION
-            faac_cfg->outputFormat = FAAD_FMT_32BIT;
-#endif
-            s->sample_size = 4;
-            break;
-        }
-
-        faac_cfg->defSampleRate = (!avctx->sample_rate) ? 44100 : avctx->sample_rate;
-        faac_cfg->defObjectType = LC;
-    }
-
-    s->faacDecSetConfiguration(s->faac_handle, faac_cfg);
-
-    faac_init_mp4(avctx);
-
-    if(!s->init && avctx->channels > 0)
-        channel_setup(avctx);
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-AVCodec libfaad_decoder = {
-    "libfaad",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AAC,
-    sizeof(FAACContext),
-    faac_decode_init,
-    NULL,
-    faac_decode_end,
-    faac_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("libfaad AAC (Advanced Audio Codec)"),
-};
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c
deleted file mode 100644
index 1062099..0000000
--- a/libavcodec/libgsm.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Interface to libgsm for gsm encoding/decoding
- * Copyright (c) 2005 Alban Bedel <albeu at free.fr>
- * Copyright (c) 2006, 2007 Michel Bardiaux <mbardiaux at mediaxim.be>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Interface to libgsm for gsm encoding/decoding
- */
-
-// The idiosyncrasies of GSM-in-WAV are explained at http://kbs.cs.tu-berlin.de/~jutta/toast.html
-
-#include "avcodec.h"
-#include <gsm/gsm.h>
-
-// gsm.h misses some essential constants
-#define GSM_BLOCK_SIZE 33
-#define GSM_MS_BLOCK_SIZE 65
-#define GSM_FRAME_SIZE 160
-
-static av_cold int libgsm_init(AVCodecContext *avctx) {
-    if (avctx->channels > 1) {
-        av_log(avctx, AV_LOG_ERROR, "Mono required for GSM, got %d channels\n",
-               avctx->channels);
-        return -1;
-    }
-
-    if(avctx->codec->decode){
-        if(!avctx->channels)
-            avctx->channels= 1;
-
-        if(!avctx->sample_rate)
-            avctx->sample_rate= 8000;
-
-        avctx->sample_fmt = SAMPLE_FMT_S16;
-    }else{
-        if (avctx->sample_rate != 8000) {
-            av_log(avctx, AV_LOG_ERROR, "Sample rate 8000Hz required for GSM, got %dHz\n",
-                avctx->sample_rate);
-            if(avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL)
-                return -1;
-        }
-        if (avctx->bit_rate != 13000 /* Official */ &&
-            avctx->bit_rate != 13200 /* Very common */ &&
-            avctx->bit_rate != 0 /* Unknown; a.o. mov does not set bitrate when decoding */ ) {
-            av_log(avctx, AV_LOG_ERROR, "Bitrate 13000bps required for GSM, got %dbps\n",
-                avctx->bit_rate);
-            if(avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL)
-                return -1;
-        }
-    }
-
-    avctx->priv_data = gsm_create();
-
-    switch(avctx->codec_id) {
-    case CODEC_ID_GSM:
-        avctx->frame_size = GSM_FRAME_SIZE;
-        avctx->block_align = GSM_BLOCK_SIZE;
-        break;
-    case CODEC_ID_GSM_MS: {
-        int one = 1;
-        gsm_option(avctx->priv_data, GSM_OPT_WAV49, &one);
-        avctx->frame_size = 2*GSM_FRAME_SIZE;
-        avctx->block_align = GSM_MS_BLOCK_SIZE;
-        }
-    }
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    return 0;
-}
-
-static av_cold int libgsm_close(AVCodecContext *avctx) {
-    av_freep(&avctx->coded_frame);
-    gsm_destroy(avctx->priv_data);
-    avctx->priv_data = NULL;
-    return 0;
-}
-
-static int libgsm_encode_frame(AVCodecContext *avctx,
-                               unsigned char *frame, int buf_size, void *data) {
-    // we need a full block
-    if(buf_size < avctx->block_align) return 0;
-
-    switch(avctx->codec_id) {
-    case CODEC_ID_GSM:
-        gsm_encode(avctx->priv_data,data,frame);
-        break;
-    case CODEC_ID_GSM_MS:
-        gsm_encode(avctx->priv_data,data,frame);
-        gsm_encode(avctx->priv_data,((short*)data)+GSM_FRAME_SIZE,frame+32);
-    }
-    return avctx->block_align;
-}
-
-
-AVCodec libgsm_encoder = {
-    "libgsm",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_GSM,
-    0,
-    libgsm_init,
-    libgsm_encode_frame,
-    libgsm_close,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
-};
-
-AVCodec libgsm_ms_encoder = {
-    "libgsm_ms",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_GSM_MS,
-    0,
-    libgsm_init,
-    libgsm_encode_frame,
-    libgsm_close,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
-};
-
-static int libgsm_decode_frame(AVCodecContext *avctx,
-                               void *data, int *data_size,
-                               AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    *data_size = 0; /* In case of error */
-    if(buf_size < avctx->block_align) return -1;
-    switch(avctx->codec_id) {
-    case CODEC_ID_GSM:
-        if(gsm_decode(avctx->priv_data,buf,data)) return -1;
-        *data_size = GSM_FRAME_SIZE*sizeof(int16_t);
-        break;
-    case CODEC_ID_GSM_MS:
-        if(gsm_decode(avctx->priv_data,buf,data) ||
-           gsm_decode(avctx->priv_data,buf+33,((int16_t*)data)+GSM_FRAME_SIZE)) return -1;
-        *data_size = GSM_FRAME_SIZE*sizeof(int16_t)*2;
-    }
-    return avctx->block_align;
-}
-
-AVCodec libgsm_decoder = {
-    "libgsm",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_GSM,
-    0,
-    libgsm_init,
-    NULL,
-    libgsm_close,
-    libgsm_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM"),
-};
-
-AVCodec libgsm_ms_decoder = {
-    "libgsm_ms",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_GSM_MS,
-    0,
-    libgsm_init,
-    NULL,
-    libgsm_close,
-    libgsm_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("libgsm GSM Microsoft variant"),
-};
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
deleted file mode 100644
index 1d74d6d..0000000
--- a/libavcodec/libmp3lame.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Interface to libmp3lame for mp3 encoding
- * Copyright (c) 2002 Lennert Buytenhek <buytenh at gnu.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Interface to libmp3lame for mp3 encoding.
- */
-
-#include "avcodec.h"
-#include "mpegaudio.h"
-#include <lame/lame.h>
-
-#define BUFFER_SIZE (7200 + 2*MPA_FRAME_SIZE + MPA_FRAME_SIZE/4)
-typedef struct Mp3AudioContext {
-    lame_global_flags *gfp;
-    int stereo;
-    uint8_t buffer[BUFFER_SIZE];
-    int buffer_index;
-} Mp3AudioContext;
-
-static av_cold int MP3lame_encode_init(AVCodecContext *avctx)
-{
-    Mp3AudioContext *s = avctx->priv_data;
-
-    if (avctx->channels > 2)
-        return -1;
-
-    s->stereo = avctx->channels > 1 ? 1 : 0;
-
-    if ((s->gfp = lame_init()) == NULL)
-        goto err;
-    lame_set_in_samplerate(s->gfp, avctx->sample_rate);
-    lame_set_out_samplerate(s->gfp, avctx->sample_rate);
-    lame_set_num_channels(s->gfp, avctx->channels);
-    if(avctx->compression_level == FF_COMPRESSION_DEFAULT) {
-        lame_set_quality(s->gfp, 5);
-    } else {
-        lame_set_quality(s->gfp, avctx->compression_level);
-    }
-    /* lame 3.91 doesn't work in mono */
-    lame_set_mode(s->gfp, JOINT_STEREO);
-    lame_set_brate(s->gfp, avctx->bit_rate/1000);
-    if(avctx->flags & CODEC_FLAG_QSCALE) {
-        lame_set_brate(s->gfp, 0);
-        lame_set_VBR(s->gfp, vbr_default);
-        lame_set_VBR_q(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA);
-    }
-    lame_set_bWriteVbrTag(s->gfp,0);
-    lame_set_disable_reservoir(s->gfp, avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR ? 0 : 1);
-    if (lame_init_params(s->gfp) < 0)
-        goto err_close;
-
-    avctx->frame_size = lame_get_framesize(s->gfp);
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    return 0;
-
-err_close:
-    lame_close(s->gfp);
-err:
-    return -1;
-}
-
-static const int sSampleRates[] = {
-    44100, 48000,  32000, 22050, 24000, 16000, 11025, 12000, 8000, 0
-};
-
-static const int sBitRates[2][3][15] = {
-    {   {  0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448},
-        {  0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384},
-        {  0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320}
-    },
-    {   {  0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256},
-        {  0,  8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160},
-        {  0,  8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}
-    },
-};
-
-static const int sSamplesPerFrame[2][3] =
-{
-    {  384,     1152,    1152 },
-    {  384,     1152,     576 }
-};
-
-static const int sBitsPerSlot[3] = {
-    32,
-    8,
-    8
-};
-
-static int mp3len(void *data, int *samplesPerFrame, int *sampleRate)
-{
-    uint32_t header = AV_RB32(data);
-    int layerID = 3 - ((header >> 17) & 0x03);
-    int bitRateID = ((header >> 12) & 0x0f);
-    int sampleRateID = ((header >> 10) & 0x03);
-    int bitsPerSlot = sBitsPerSlot[layerID];
-    int isPadded = ((header >> 9) & 0x01);
-    static int const mode_tab[4]= {2,3,1,0};
-    int mode= mode_tab[(header >> 19) & 0x03];
-    int mpeg_id= mode>0;
-    int temp0, temp1, bitRate;
-
-    if ( (( header >> 21 ) & 0x7ff) != 0x7ff || mode == 3 || layerID==3 || sampleRateID==3) {
-        return -1;
-    }
-
-    if(!samplesPerFrame) samplesPerFrame= &temp0;
-    if(!sampleRate     ) sampleRate     = &temp1;
-
-//    *isMono = ((header >>  6) & 0x03) == 0x03;
-
-    *sampleRate = sSampleRates[sampleRateID]>>mode;
-    bitRate = sBitRates[mpeg_id][layerID][bitRateID] * 1000;
-    *samplesPerFrame = sSamplesPerFrame[mpeg_id][layerID];
-//av_log(NULL, AV_LOG_DEBUG, "sr:%d br:%d spf:%d l:%d m:%d\n", *sampleRate, bitRate, *samplesPerFrame, layerID, mode);
-
-    return *samplesPerFrame * bitRate / (bitsPerSlot * *sampleRate) + isPadded;
-}
-
-static int MP3lame_encode_frame(AVCodecContext *avctx,
-                                unsigned char *frame, int buf_size, void *data)
-{
-    Mp3AudioContext *s = avctx->priv_data;
-    int len;
-    int lame_result;
-
-    /* lame 3.91 dies on '1-channel interleaved' data */
-
-    if(data){
-        if (s->stereo) {
-            lame_result = lame_encode_buffer_interleaved(
-                s->gfp,
-                data,
-                avctx->frame_size,
-                s->buffer + s->buffer_index,
-                BUFFER_SIZE - s->buffer_index
-                );
-        } else {
-            lame_result = lame_encode_buffer(
-                s->gfp,
-                data,
-                data,
-                avctx->frame_size,
-                s->buffer + s->buffer_index,
-                BUFFER_SIZE - s->buffer_index
-                );
-        }
-    }else{
-        lame_result= lame_encode_flush(
-                s->gfp,
-                s->buffer + s->buffer_index,
-                BUFFER_SIZE - s->buffer_index
-                );
-    }
-
-    if(lame_result < 0){
-        if(lame_result==-1) {
-            /* output buffer too small */
-            av_log(avctx, AV_LOG_ERROR, "lame: output buffer too small (buffer index: %d, free bytes: %d)\n", s->buffer_index, BUFFER_SIZE - s->buffer_index);
-        }
-        return -1;
-    }
-
-    s->buffer_index += lame_result;
-
-    if(s->buffer_index<4)
-        return 0;
-
-    len= mp3len(s->buffer, NULL, NULL);
-//av_log(avctx, AV_LOG_DEBUG, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len, s->buffer_index);
-    if(len <= s->buffer_index){
-        memcpy(frame, s->buffer, len);
-        s->buffer_index -= len;
-
-        memmove(s->buffer, s->buffer+len, s->buffer_index);
-            //FIXME fix the audio codec API, so we do not need the memcpy()
-/*for(i=0; i<len; i++){
-    av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]);
-}*/
-        return len;
-    }else
-        return 0;
-}
-
-static av_cold int MP3lame_encode_close(AVCodecContext *avctx)
-{
-    Mp3AudioContext *s = avctx->priv_data;
-
-    av_freep(&avctx->coded_frame);
-
-    lame_close(s->gfp);
-    return 0;
-}
-
-
-AVCodec libmp3lame_encoder = {
-    "libmp3lame",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3,
-    sizeof(Mp3AudioContext),
-    MP3lame_encode_init,
-    MP3lame_encode_frame,
-    MP3lame_encode_close,
-    .capabilities= CODEC_CAP_DELAY,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .supported_samplerates= sSampleRates,
-    .long_name= NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
-};
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
deleted file mode 100644
index 2661645..0000000
--- a/libavcodec/libopencore-amr.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * AMR Audio decoder stub
- * Copyright (c) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-
-static void amr_decode_fix_avctx(AVCodecContext *avctx)
-{
-    const int is_amr_wb = 1 + (avctx->codec_id == CODEC_ID_AMR_WB);
-
-    if (!avctx->sample_rate)
-        avctx->sample_rate = 8000 * is_amr_wb;
-
-    if (!avctx->channels)
-        avctx->channels = 1;
-
-    avctx->frame_size = 160 * is_amr_wb;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-}
-
-#if CONFIG_LIBOPENCORE_AMRNB
-
-#include <opencore-amrnb/interf_dec.h>
-#include <opencore-amrnb/interf_enc.h>
-
-static const char nb_bitrate_unsupported[] =
-    "bitrate not supported: use one of 4.75k, 5.15k, 5.9k, 6.7k, 7.4k, 7.95k, 10.2k or 12.2k\n";
-
-/* Common code for fixed and float version*/
-typedef struct AMR_bitrates {
-    int       rate;
-    enum Mode mode;
-} AMR_bitrates;
-
-/* Match desired bitrate */
-static int getBitrateMode(int bitrate)
-{
-    /* make the correspondance between bitrate and mode */
-    AMR_bitrates rates[] = { { 4750, MR475},
-                             { 5150, MR515},
-                             { 5900, MR59},
-                             { 6700, MR67},
-                             { 7400, MR74},
-                             { 7950, MR795},
-                             {10200, MR102},
-                             {12200, MR122}, };
-    int i;
-
-    for (i = 0; i < 8; i++)
-        if (rates[i].rate == bitrate)
-            return rates[i].mode;
-    /* no bitrate matching, return an error */
-    return -1;
-}
-
-typedef struct AMRContext {
-    int   frameCount;
-    void *decState;
-    int  *enstate;
-    int   enc_bitrate;
-} AMRContext;
-
-static av_cold int amr_nb_decode_init(AVCodecContext *avctx)
-{
-    AMRContext *s = avctx->priv_data;
-
-    s->frameCount = 0;
-    s->decState   = Decoder_Interface_init();
-    if (!s->decState) {
-        av_log(avctx, AV_LOG_ERROR, "Decoder_Interface_init error\r\n");
-        return -1;
-    }
-
-    amr_decode_fix_avctx(avctx);
-
-    if (avctx->channels > 1) {
-        av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static av_cold int amr_nb_decode_close(AVCodecContext *avctx)
-{
-    AMRContext *s = avctx->priv_data;
-
-    Decoder_Interface_exit(s->decState);
-    return 0;
-}
-
-static int amr_nb_decode_frame(AVCodecContext *avctx, void *data,
-                               int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    AMRContext *s = avctx->priv_data;
-    const uint8_t *amrData = buf;
-    static const uint8_t block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
-    enum Mode dec_mode;
-    int packet_size;
-
-    /* av_log(NULL, AV_LOG_DEBUG, "amr_decode_frame buf=%p buf_size=%d frameCount=%d!!\n",
-              buf, buf_size, s->frameCount); */
-
-    dec_mode = (buf[0] >> 3) & 0x000F;
-    packet_size = block_size[dec_mode] + 1;
-
-    if (packet_size > buf_size) {
-        av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n",
-               buf_size, packet_size);
-        return -1;
-    }
-
-    s->frameCount++;
-    /* av_log(NULL, AV_LOG_DEBUG, "packet_size=%d amrData= 0x%X %X %X %X\n",
-              packet_size, amrData[0], amrData[1], amrData[2], amrData[3]); */
-    /* call decoder */
-    Decoder_Interface_Decode(s->decState, amrData, data, 0);
-    *data_size = 160 * 2;
-
-    return packet_size;
-}
-
-AVCodec libopencore_amrnb_decoder = {
-    "libopencore_amrnb",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AMR_NB,
-    sizeof(AMRContext),
-    amr_nb_decode_init,
-    NULL,
-    amr_nb_decode_close,
-    amr_nb_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
-};
-
-static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
-{
-    AMRContext *s = avctx->priv_data;
-
-    s->frameCount = 0;
-
-    if (avctx->sample_rate != 8000) {
-        av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n");
-        return -1;
-    }
-
-    if (avctx->channels != 1) {
-        av_log(avctx, AV_LOG_ERROR, "Only mono supported\n");
-        return -1;
-    }
-
-    avctx->frame_size  = 160;
-    avctx->coded_frame = avcodec_alloc_frame();
-
-    s->enstate=Encoder_Interface_init(0);
-    if (!s->enstate) {
-        av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
-        return -1;
-    }
-
-    if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) {
-        av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
-        return -1;
-    }
-
-    return 0;
-}
-
-static av_cold int amr_nb_encode_close(AVCodecContext *avctx)
-{
-    AMRContext *s = avctx->priv_data;
-
-    Encoder_Interface_exit(s->enstate);
-    av_freep(&avctx->coded_frame);
-    return 0;
-}
-
-static int amr_nb_encode_frame(AVCodecContext *avctx,
-                               unsigned char *frame/*out*/,
-                               int buf_size, void *data/*in*/)
-{
-    AMRContext *s = avctx->priv_data;
-    int written;
-
-    if ((s->enc_bitrate = getBitrateMode(avctx->bit_rate)) < 0) {
-        av_log(avctx, AV_LOG_ERROR, nb_bitrate_unsupported);
-        return -1;
-    }
-
-    written = Encoder_Interface_Encode(s->enstate, s->enc_bitrate, data,
-                                       frame, 0);
-    /* av_log(NULL, AV_LOG_DEBUG, "amr_nb_encode_frame encoded %u bytes, bitrate %u, first byte was %#02x\n",
-              written, s->enc_bitrate, frame[0] ); */
-
-    return written;
-}
-
-AVCodec libopencore_amrnb_encoder = {
-    "libopencore_amrnb",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AMR_NB,
-    sizeof(AMRContext),
-    amr_nb_encode_init,
-    amr_nb_encode_frame,
-    amr_nb_encode_close,
-    NULL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Narrow-Band"),
-};
-
-#endif
-
-/* -----------AMR wideband ------------*/
-#if CONFIG_LIBOPENCORE_AMRWB
-
-#ifdef _TYPEDEF_H
-//To avoid duplicate typedefs from typedef in amr-nb
-#define typedef_h
-#endif
-
-#include <opencore-amrwb/dec_if.h>
-#include <opencore-amrwb/if_rom.h>
-
-static const char wb_bitrate_unsupported[] =
-    "bitrate not supported: use one of 6.6k, 8.85k, 12.65k, 14.25k, 15.85k, 18.25k, 19.85k, 23.05k, or 23.85k\n";
-
-/* Common code for fixed and float version*/
-typedef struct AMRWB_bitrates {
-    int rate;
-    int mode;
-} AMRWB_bitrates;
-
-typedef struct AMRWBContext {
-    int    frameCount;
-    void  *state;
-    int    mode;
-    Word16 allow_dtx;
-} AMRWBContext;
-
-static av_cold int amr_wb_decode_init(AVCodecContext *avctx)
-{
-    AMRWBContext *s = avctx->priv_data;
-
-    s->frameCount = 0;
-    s->state      = D_IF_init();
-
-    amr_decode_fix_avctx(avctx);
-
-    if (avctx->channels > 1) {
-        av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static int amr_wb_decode_frame(AVCodecContext *avctx, void *data,
-                               int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    AMRWBContext *s = avctx->priv_data;
-    const uint8_t *amrData = buf;
-    int mode;
-    int packet_size;
-    static const uint8_t block_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
-
-    if (!buf_size)
-        /* nothing to do */
-        return 0;
-
-    mode = (amrData[0] >> 3) & 0x000F;
-    packet_size = block_size[mode];
-
-    if (packet_size > buf_size) {
-        av_log(avctx, AV_LOG_ERROR, "amr frame too short (%u, should be %u)\n",
-               buf_size, packet_size + 1);
-        return -1;
-    }
-
-    s->frameCount++;
-    D_IF_decode(s->state, amrData, data, _good_frame);
-    *data_size = 320 * 2;
-    return packet_size;
-}
-
-static int amr_wb_decode_close(AVCodecContext *avctx)
-{
-    AMRWBContext *s = avctx->priv_data;
-
-    D_IF_exit(s->state);
-    return 0;
-}
-
-AVCodec libopencore_amrwb_decoder = {
-    "libopencore_amrwb",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_AMR_WB,
-    sizeof(AMRWBContext),
-    amr_wb_decode_init,
-    NULL,
-    amr_wb_decode_close,
-    amr_wb_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("OpenCORE Adaptive Multi-Rate (AMR) Wide-Band"),
-};
-
-#endif /* CONFIG_LIBOPENCORE_AMRWB */
diff --git a/libavcodec/libopenjpeg.c b/libavcodec/libopenjpeg.c
deleted file mode 100644
index 0956da9..0000000
--- a/libavcodec/libopenjpeg.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * JPEG 2000 decoding support via OpenJPEG
- * Copyright (c) 2009 Jaikrishnan Menon <realityman at gmx.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* JPEG 2000 decoder using libopenjpeg
-*/
-
-#include "avcodec.h"
-#include "libavutil/intreadwrite.h"
-#define  OPJ_STATIC
-#include <openjpeg.h>
-
-#define JP2_SIG_TYPE    0x6A502020
-#define JP2_SIG_VALUE   0x0D0A870A
-
-typedef struct {
-    opj_dparameters_t dec_params;
-    AVFrame image;
-} LibOpenJPEGContext;
-
-static int check_image_attributes(opj_image_t *image)
-{
-    return image->comps[0].dx == image->comps[1].dx &&
-           image->comps[1].dx == image->comps[2].dx &&
-           image->comps[0].dy == image->comps[1].dy &&
-           image->comps[1].dy == image->comps[2].dy &&
-           image->comps[0].prec == image->comps[1].prec &&
-           image->comps[1].prec == image->comps[2].prec;
-}
-
-static av_cold int libopenjpeg_decode_init(AVCodecContext *avctx)
-{
-    LibOpenJPEGContext *ctx = avctx->priv_data;
-
-    opj_set_default_decoder_parameters(&ctx->dec_params);
-    avctx->coded_frame = &ctx->image;
-    return 0;
-}
-
-static int libopenjpeg_decode_frame(AVCodecContext *avctx,
-                                    void *data, int *data_size,
-                                    AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    LibOpenJPEGContext *ctx = avctx->priv_data;
-    AVFrame *picture = &ctx->image, *output = data;
-    opj_dinfo_t *dec;
-    opj_cio_t *stream;
-    opj_image_t *image;
-    int width, height, has_alpha = 0, ret = -1;
-    int x, y, index;
-    uint8_t *img_ptr;
-    int adjust[4];
-
-    *data_size = 0;
-
-    // Check if input is a raw jpeg2k codestream or in jp2 wrapping
-    if((AV_RB32(buf) == 12) &&
-       (AV_RB32(buf + 4) == JP2_SIG_TYPE) &&
-       (AV_RB32(buf + 8) == JP2_SIG_VALUE)) {
-        dec = opj_create_decompress(CODEC_JP2);
-    } else {
-        // If the AVPacket contains a jp2c box, then skip to
-        // the starting byte of the codestream.
-        if (AV_RB32(buf + 4) == AV_RB32("jp2c"))
-            buf += 8;
-        dec = opj_create_decompress(CODEC_J2K);
-    }
-
-    if(!dec) {
-        av_log(avctx, AV_LOG_ERROR, "Error initializing decoder.\n");
-        return -1;
-    }
-    opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL);
-
-    ctx->dec_params.cp_reduce = avctx->lowres;
-    // Tie decoder with decoding parameters
-    opj_setup_decoder(dec, &ctx->dec_params);
-    stream = opj_cio_open((opj_common_ptr)dec, buf, buf_size);
-    if(!stream) {
-        av_log(avctx, AV_LOG_ERROR, "Codestream could not be opened for reading.\n");
-        opj_destroy_decompress(dec);
-        return -1;
-    }
-
-    // Decode the codestream
-    image = opj_decode_with_info(dec, stream, NULL);
-    opj_cio_close(stream);
-    if(!image) {
-        av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
-        opj_destroy_decompress(dec);
-        return -1;
-    }
-    width  = image->comps[0].w << avctx->lowres;
-    height = image->comps[0].h << avctx->lowres;
-    if(avcodec_check_dimensions(avctx, width, height) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height);
-        goto done;
-    }
-    avcodec_set_dimensions(avctx, width, height);
-
-    switch(image->numcomps)
-    {
-        case 1:  avctx->pix_fmt = PIX_FMT_GRAY8;
-                 break;
-        case 3:  if(check_image_attributes(image)) {
-                     avctx->pix_fmt = PIX_FMT_RGB24;
-                 } else {
-                     avctx->pix_fmt = PIX_FMT_GRAY8;
-                     av_log(avctx, AV_LOG_ERROR, "Only first component will be used.\n");
-                 }
-                 break;
-        case 4:  has_alpha = 1;
-                 avctx->pix_fmt = PIX_FMT_RGBA;
-                 break;
-        default: av_log(avctx, AV_LOG_ERROR, "%d components unsupported.\n", image->numcomps);
-                 goto done;
-    }
-
-    if(picture->data[0])
-        avctx->release_buffer(avctx, picture);
-
-    if(avctx->get_buffer(avctx, picture) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Couldn't allocate image buffer.\n");
-        return -1;
-    }
-
-    for(x = 0; x < image->numcomps; x++) {
-        adjust[x] = FFMAX(image->comps[x].prec - 8, 0);
-    }
-
-    for(y = 0; y < avctx->height; y++) {
-        index = y*avctx->width;
-        img_ptr = picture->data[0] + y*picture->linesize[0];
-        for(x = 0; x < avctx->width; x++, index++) {
-            *img_ptr++ = image->comps[0].data[index] >> adjust[0];
-            if(image->numcomps > 2 && check_image_attributes(image)) {
-                *img_ptr++ = image->comps[1].data[index] >> adjust[1];
-                *img_ptr++ = image->comps[2].data[index] >> adjust[2];
-                if(has_alpha)
-                    *img_ptr++ = image->comps[3].data[index] >> adjust[3];
-            }
-        }
-    }
-
-    *output    = ctx->image;
-    *data_size = sizeof(AVPicture);
-    ret = buf_size;
-
-done:
-    opj_image_destroy(image);
-    opj_destroy_decompress(dec);
-    return ret;
-}
-
-static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
-{
-    LibOpenJPEGContext *ctx = avctx->priv_data;
-
-    if(ctx->image.data[0])
-        avctx->release_buffer(avctx, &ctx->image);
-    return 0 ;
-}
-
-
-AVCodec libopenjpeg_decoder = {
-    "libopenjpeg",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_JPEG2000,
-    sizeof(LibOpenJPEGContext),
-    libopenjpeg_decode_init,
-    NULL,
-    libopenjpeg_decode_close,
-    libopenjpeg_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
-} ;
diff --git a/libavcodec/libschroedinger.c b/libavcodec/libschroedinger.c
deleted file mode 100644
index 04c15a2..0000000
--- a/libavcodec/libschroedinger.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* function definitions common to libschroedingerdec.c and libschroedingerenc.c
-*/
-
-#include "libdirac_libschro.h"
-#include "libschroedinger.h"
-
-/**
-* Schroedinger video preset table. Ensure that this tables matches up correctly
-* with the ff_dirac_schro_video_format_info table in libdirac_libschro.c.
-*/
-static const SchroVideoFormatEnum ff_schro_video_formats[]={
-    SCHRO_VIDEO_FORMAT_CUSTOM     ,
-    SCHRO_VIDEO_FORMAT_QSIF       ,
-    SCHRO_VIDEO_FORMAT_QCIF       ,
-    SCHRO_VIDEO_FORMAT_SIF        ,
-    SCHRO_VIDEO_FORMAT_CIF        ,
-    SCHRO_VIDEO_FORMAT_4SIF       ,
-    SCHRO_VIDEO_FORMAT_4CIF       ,
-    SCHRO_VIDEO_FORMAT_SD480I_60  ,
-    SCHRO_VIDEO_FORMAT_SD576I_50  ,
-    SCHRO_VIDEO_FORMAT_HD720P_60  ,
-    SCHRO_VIDEO_FORMAT_HD720P_50  ,
-    SCHRO_VIDEO_FORMAT_HD1080I_60 ,
-    SCHRO_VIDEO_FORMAT_HD1080I_50 ,
-    SCHRO_VIDEO_FORMAT_HD1080P_60 ,
-    SCHRO_VIDEO_FORMAT_HD1080P_50 ,
-    SCHRO_VIDEO_FORMAT_DC2K_24    ,
-    SCHRO_VIDEO_FORMAT_DC4K_24    ,
-};
-
-SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext)
-{
-    unsigned int num_formats = sizeof(ff_schro_video_formats) /
-                               sizeof(ff_schro_video_formats[0]);
-
-    unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext);
-
-    return (idx < num_formats) ? ff_schro_video_formats[idx] :
-                                 SCHRO_VIDEO_FORMAT_CUSTOM;
-}
-
-int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
-                               SchroFrameFormat  *schro_frame_fmt)
-{
-    unsigned int num_formats = sizeof(ffmpeg_schro_pixel_format_map) /
-                               sizeof(ffmpeg_schro_pixel_format_map[0]);
-
-    int idx;
-
-    for (idx = 0; idx < num_formats; ++idx) {
-        if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) {
-            *schro_frame_fmt = ffmpeg_schro_pixel_format_map[idx].schro_frame_fmt;
-            return 0;
-        }
-    }
-    return -1;
-}
-
-static void FreeSchroFrame(SchroFrame *frame, void *priv)
-{
-    AVPicture *p_pic = priv;
-
-    if (!p_pic)
-        return;
-
-    avpicture_free(p_pic);
-    av_freep(&p_pic);
-}
-
-SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext,
-                                  SchroFrameFormat schro_frame_fmt)
-{
-    AVPicture *p_pic;
-    SchroFrame *p_frame;
-    int y_width, uv_width;
-    int y_height, uv_height;
-    int i;
-
-    y_width   = avccontext->width;
-    y_height  = avccontext->height;
-    uv_width  = y_width  >> (SCHRO_FRAME_FORMAT_H_SHIFT(schro_frame_fmt));
-    uv_height = y_height >> (SCHRO_FRAME_FORMAT_V_SHIFT(schro_frame_fmt));
-
-    p_pic = av_mallocz(sizeof(AVPicture));
-    avpicture_alloc(p_pic, avccontext->pix_fmt, y_width, y_height);
-
-    p_frame         = schro_frame_new();
-    p_frame->format = schro_frame_fmt;
-    p_frame->width  = y_width;
-    p_frame->height = y_height;
-    schro_frame_set_free_callback(p_frame, FreeSchroFrame, (void *)p_pic);
-
-    for (i = 0; i < 3; ++i) {
-        p_frame->components[i].width  = i ? uv_width : y_width;
-        p_frame->components[i].stride = p_pic->linesize[i];
-        p_frame->components[i].height = i ? uv_height : y_height;
-        p_frame->components[i].length =
-                 p_frame->components[i].stride * p_frame->components[i].height;
-        p_frame->components[i].data   = p_pic->data[i];
-
-        if (i) {
-            p_frame->components[i].v_shift =
-                SCHRO_FRAME_FORMAT_V_SHIFT(p_frame->format);
-            p_frame->components[i].h_shift =
-                SCHRO_FRAME_FORMAT_H_SHIFT(p_frame->format);
-        }
-    }
-
-    return p_frame;
-}
diff --git a/libavcodec/libschroedinger.h b/libavcodec/libschroedinger.h
deleted file mode 100644
index 65a41e6..0000000
--- a/libavcodec/libschroedinger.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* data structures common to libschroedingerdec.c and libschroedingerenc.c
-*/
-
-#ifndef AVCODEC_LIBSCHROEDINGER_H
-#define AVCODEC_LIBSCHROEDINGER_H
-
-#include <schroedinger/schrobitstream.h>
-#include <schroedinger/schroframe.h>
-#include "avcodec.h"
-
-static const struct {
-    enum PixelFormat  ff_pix_fmt;
-    SchroChromaFormat schro_pix_fmt;
-    SchroFrameFormat  schro_frame_fmt;
-} ffmpeg_schro_pixel_format_map[] = {
-    { PIX_FMT_YUV420P, SCHRO_CHROMA_420, SCHRO_FRAME_FORMAT_U8_420 },
-    { PIX_FMT_YUV422P, SCHRO_CHROMA_422, SCHRO_FRAME_FORMAT_U8_422 },
-    { PIX_FMT_YUV444P, SCHRO_CHROMA_444, SCHRO_FRAME_FORMAT_U8_444 },
-};
-
-/**
-* Returns the video format preset matching the input video dimensions and
-* time base.
-*/
-SchroVideoFormatEnum ff_get_schro_video_format_preset (AVCodecContext *avccontext);
-
-/**
-* Sets the Schroedinger frame format corresponding to the Schro chroma format
-* passed. Returns 0 on success, -1 on failure.
-*/
-int ff_get_schro_frame_format(SchroChromaFormat schro_chroma_fmt,
-                              SchroFrameFormat  *schro_frame_fmt);
-
-/**
-* Create a Schro frame based on the dimensions and frame format
-* passed. Returns a pointer to a frame on success, NULL on failure.
-*/
-SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext,
-                                  SchroFrameFormat schro_frame_fmt);
-
-#endif /* AVCODEC_LIBSCHROEDINGER_H */
diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
deleted file mode 100644
index ef20f20..0000000
--- a/libavcodec/libschroedingerdec.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Dirac decoder support via Schroedinger libraries
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* Dirac decoder support via libschroedinger-1.0 libraries. More details about
-* the Schroedinger project can be found at http://www.diracvideo.org/.
-* The library implements Dirac Specification Version 2.2.
-* (http://dirac.sourceforge.net/specification.html).
-*/
-
-#include "avcodec.h"
-#include "libdirac_libschro.h"
-#include "libschroedinger.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-#include <schroedinger/schro.h>
-#include <schroedinger/schrodebug.h>
-#include <schroedinger/schrovideoformat.h>
-
-/** libschroedinger decoder private data */
-typedef struct FfmpegSchroDecoderParams {
-    /** Schroedinger video format */
-    SchroVideoFormat *format;
-
-    /** Schroedinger frame format */
-    SchroFrameFormat frame_format;
-
-    /** decoder handle */
-    SchroDecoder* decoder;
-
-    /** queue storing decoded frames */
-    FfmpegDiracSchroQueue dec_frame_queue;
-
-    /** end of sequence signalled */
-    int eos_signalled;
-
-    /** end of sequence pulled */
-    int eos_pulled;
-
-    /** decoded picture */
-    AVPicture dec_pic;
-} FfmpegSchroDecoderParams;
-
-typedef struct FfmpegSchroParseUnitContext {
-    const uint8_t *buf;
-    int           buf_size;
-} FfmpegSchroParseUnitContext;
-
-
-static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
-                                               void *priv);
-
-static void FfmpegSchroParseContextInit(FfmpegSchroParseUnitContext *parse_ctx,
-                                        const uint8_t *buf, int buf_size)
-{
-    parse_ctx->buf           = buf;
-    parse_ctx->buf_size      = buf_size;
-}
-
-static SchroBuffer* FfmpegFindNextSchroParseUnit(FfmpegSchroParseUnitContext *parse_ctx)
-{
-    SchroBuffer *enc_buf = NULL;
-    int next_pu_offset = 0;
-    unsigned char *in_buf;
-
-    if (parse_ctx->buf_size < 13 ||
-        parse_ctx->buf[0] != 'B' ||
-        parse_ctx->buf[1] != 'B' ||
-        parse_ctx->buf[2] != 'C' ||
-        parse_ctx->buf[3] != 'D')
-        return NULL;
-
-    next_pu_offset = (parse_ctx->buf[5] << 24) +
-                     (parse_ctx->buf[6] << 16) +
-                     (parse_ctx->buf[7] <<  8) +
-                      parse_ctx->buf[8];
-
-    if (next_pu_offset == 0 &&
-        SCHRO_PARSE_CODE_IS_END_OF_SEQUENCE(parse_ctx->buf[4]))
-        next_pu_offset = 13;
-
-    if (next_pu_offset <= 0 || parse_ctx->buf_size < next_pu_offset)
-        return NULL;
-
-    in_buf = av_malloc(next_pu_offset);
-    memcpy(in_buf, parse_ctx->buf, next_pu_offset);
-    enc_buf       = schro_buffer_new_with_data(in_buf, next_pu_offset);
-    enc_buf->free = libschroedinger_decode_buffer_free;
-    enc_buf->priv = in_buf;
-
-    parse_ctx->buf      += next_pu_offset;
-    parse_ctx->buf_size -= next_pu_offset;
-
-    return enc_buf;
-}
-
-/**
-* Returns FFmpeg chroma format.
-*/
-static enum PixelFormat GetFfmpegChromaFormat(SchroChromaFormat schro_pix_fmt)
-{
-    int num_formats = sizeof(ffmpeg_schro_pixel_format_map) /
-                      sizeof(ffmpeg_schro_pixel_format_map[0]);
-    int idx;
-
-    for (idx = 0; idx < num_formats; ++idx)
-        if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt)
-            return ffmpeg_schro_pixel_format_map[idx].ff_pix_fmt;
-    return PIX_FMT_NONE;
-}
-
-static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext)
-{
-
-    FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data;
-    /* First of all, initialize our supporting libraries. */
-    schro_init();
-
-    schro_debug_set_level(avccontext->debug);
-    p_schro_params->decoder = schro_decoder_new();
-    schro_decoder_set_skip_ratio(p_schro_params->decoder, 1);
-
-    if (!p_schro_params->decoder)
-        return -1;
-
-    /* Initialize the decoded frame queue. */
-    ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue);
-    return 0;
-}
-
-static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
-                                               void *priv)
-{
-    av_freep(&priv);
-}
-
-static void libschroedinger_decode_frame_free(void *frame)
-{
-    schro_frame_unref(frame);
-}
-
-static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext)
-{
-    FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data;
-    SchroDecoder *decoder = p_schro_params->decoder;
-
-    p_schro_params->format = schro_decoder_get_video_format(decoder);
-
-    /* Tell FFmpeg about sequence details. */
-    if (avcodec_check_dimensions(avccontext, p_schro_params->format->width,
-                                 p_schro_params->format->height) < 0) {
-        av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n",
-               p_schro_params->format->width, p_schro_params->format->height);
-        avccontext->height = avccontext->width = 0;
-        return;
-    }
-    avccontext->height  = p_schro_params->format->height;
-    avccontext->width   = p_schro_params->format->width;
-    avccontext->pix_fmt = GetFfmpegChromaFormat(p_schro_params->format->chroma_format);
-
-    if (ff_get_schro_frame_format(p_schro_params->format->chroma_format,
-                                  &p_schro_params->frame_format) == -1) {
-        av_log(avccontext, AV_LOG_ERROR,
-               "This codec currently only supports planar YUV 4:2:0, 4:2:2 "
-               "and 4:4:4 formats.\n");
-        return;
-    }
-
-    avccontext->time_base.den = p_schro_params->format->frame_rate_numerator;
-    avccontext->time_base.num = p_schro_params->format->frame_rate_denominator;
-
-    if (!p_schro_params->dec_pic.data[0])
-        avpicture_alloc(&p_schro_params->dec_pic,
-                        avccontext->pix_fmt,
-                        avccontext->width,
-                        avccontext->height);
-}
-
-static int libschroedinger_decode_frame(AVCodecContext *avccontext,
-                                        void *data, int *data_size,
-                                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-
-    FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data;
-    SchroDecoder *decoder = p_schro_params->decoder;
-    SchroVideoFormat *format;
-    AVPicture *picture = data;
-    SchroBuffer *enc_buf;
-    SchroFrame* frame;
-    int state;
-    int go = 1;
-    int outer = 1;
-    FfmpegSchroParseUnitContext parse_ctx;
-
-    *data_size = 0;
-
-    FfmpegSchroParseContextInit(&parse_ctx, buf, buf_size);
-    if (!buf_size) {
-        if (!p_schro_params->eos_signalled) {
-            state = schro_decoder_push_end_of_stream(decoder);
-            p_schro_params->eos_signalled = 1;
-        }
-    }
-
-    /* Loop through all the individual parse units in the input buffer */
-    do {
-        if ((enc_buf = FfmpegFindNextSchroParseUnit(&parse_ctx))) {
-            /* Push buffer into decoder. */
-            if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) &&
-                SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0)
-                avccontext->has_b_frames = 1;
-            state = schro_decoder_push(decoder, enc_buf);
-            if (state == SCHRO_DECODER_FIRST_ACCESS_UNIT)
-                libschroedinger_handle_first_access_unit(avccontext);
-            go = 1;
-        } else
-            outer = 0;
-        format = p_schro_params->format;
-
-        while (go) {
-            /* Parse data and process result. */
-            state = schro_decoder_wait(decoder);
-            switch (state) {
-            case SCHRO_DECODER_FIRST_ACCESS_UNIT:
-                libschroedinger_handle_first_access_unit(avccontext);
-                break;
-
-            case SCHRO_DECODER_NEED_BITS:
-                /* Need more input data - stop iterating over what we have. */
-                go = 0;
-                break;
-
-            case SCHRO_DECODER_NEED_FRAME:
-                /* Decoder needs a frame - create one and push it in. */
-                frame = ff_create_schro_frame(avccontext,
-                                              p_schro_params->frame_format);
-                schro_decoder_add_output_picture(decoder, frame);
-                break;
-
-            case SCHRO_DECODER_OK:
-                /* Pull a frame out of the decoder. */
-                frame = schro_decoder_pull(decoder);
-
-                if (frame)
-                    ff_dirac_schro_queue_push_back(&p_schro_params->dec_frame_queue,
-                                                   frame);
-                break;
-            case SCHRO_DECODER_EOS:
-                go = 0;
-                p_schro_params->eos_pulled = 1;
-                schro_decoder_reset(decoder);
-                outer = 0;
-                break;
-
-            case SCHRO_DECODER_ERROR:
-                return -1;
-                break;
-            }
-        }
-    } while (outer);
-
-    /* Grab next frame to be returned from the top of the queue. */
-    frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue);
-
-    if (frame) {
-        memcpy(p_schro_params->dec_pic.data[0],
-               frame->components[0].data,
-               frame->components[0].length);
-
-        memcpy(p_schro_params->dec_pic.data[1],
-               frame->components[1].data,
-               frame->components[1].length);
-
-        memcpy(p_schro_params->dec_pic.data[2],
-               frame->components[2].data,
-               frame->components[2].length);
-
-        /* Fill picture with current buffer data from Schroedinger. */
-        avpicture_fill(picture, p_schro_params->dec_pic.data[0],
-                       avccontext->pix_fmt,
-                       avccontext->width, avccontext->height);
-
-        *data_size = sizeof(AVPicture);
-
-        /* Now free the frame resources. */
-        libschroedinger_decode_frame_free(frame);
-    }
-    return buf_size;
-}
-
-
-static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext)
-{
-    FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data;
-    /* Free the decoder. */
-    schro_decoder_free(p_schro_params->decoder);
-    av_freep(&p_schro_params->format);
-
-    avpicture_free(&p_schro_params->dec_pic);
-
-    /* Free data in the output frame queue. */
-    ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue,
-                              libschroedinger_decode_frame_free);
-
-    return 0;
-}
-
-static void libschroedinger_flush(AVCodecContext *avccontext)
-{
-    /* Got a seek request. Free the decoded frames queue and then reset
-     * the decoder */
-    FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data;
-
-    /* Free data in the output frame queue. */
-    ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue,
-                              libschroedinger_decode_frame_free);
-
-    ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue);
-    schro_decoder_reset(p_schro_params->decoder);
-    p_schro_params->eos_pulled = 0;
-    p_schro_params->eos_signalled = 0;
-}
-
-AVCodec libschroedinger_decoder = {
-    "libschroedinger",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DIRAC,
-    sizeof(FfmpegSchroDecoderParams),
-    libschroedinger_decode_init,
-    NULL,
-    libschroedinger_decode_close,
-    libschroedinger_decode_frame,
-    CODEC_CAP_DELAY,
-    .flush = libschroedinger_flush,
-    .long_name = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
-};
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c
deleted file mode 100644
index c375c73..0000000
--- a/libavcodec/libschroedingerenc.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Dirac encoder support via Schroedinger libraries
- * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com >
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
-* Dirac encoder support via libschroedinger-1.0 libraries. More details about
-* the Schroedinger project can be found at http://www.diracvideo.org/.
-* The library implements Dirac Specification Version 2.2
-* (http://dirac.sourceforge.net/specification.html).
-*/
-
-#undef NDEBUG
-#include <assert.h>
-
-#include <schroedinger/schro.h>
-#include <schroedinger/schrodebug.h>
-#include <schroedinger/schrovideoformat.h>
-
-#include "avcodec.h"
-#include "libdirac_libschro.h"
-#include "libschroedinger.h"
-
-
-/** libschroedinger encoder private data */
-typedef struct FfmpegSchroEncoderParams {
-    /** Schroedinger video format */
-    SchroVideoFormat *format;
-
-    /** Schroedinger frame format */
-    SchroFrameFormat frame_format;
-
-    /** frame being encoded */
-    AVFrame picture;
-
-    /** frame size */
-    int frame_size;
-
-    /** Schroedinger encoder handle*/
-    SchroEncoder* encoder;
-
-    /** buffer to store encoder output before writing it to the frame queue*/
-    unsigned char *enc_buf;
-
-    /** Size of encoder buffer*/
-    int enc_buf_size;
-
-    /** queue storing encoded frames */
-    FfmpegDiracSchroQueue enc_frame_queue;
-
-    /** end of sequence signalled */
-    int eos_signalled;
-
-    /** end of sequence pulled */
-    int eos_pulled;
-} FfmpegSchroEncoderParams;
-
-/**
-* Works out Schro-compatible chroma format.
-*/
-static int SetSchroChromaFormat(AVCodecContext *avccontext)
-{
-    int num_formats = sizeof(ffmpeg_schro_pixel_format_map) /
-                      sizeof(ffmpeg_schro_pixel_format_map[0]);
-    int idx;
-
-    FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data;
-
-    for (idx = 0; idx < num_formats; ++idx) {
-        if (ffmpeg_schro_pixel_format_map[idx].ff_pix_fmt ==
-            avccontext->pix_fmt) {
-            p_schro_params->format->chroma_format =
-                            ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt;
-            return 0;
-        }
-    }
-
-    av_log(avccontext, AV_LOG_ERROR,
-           "This codec currently only supports planar YUV 4:2:0, 4:2:2"
-           " and 4:4:4 formats.\n");
-
-    return -1;
-}
-
-static int libschroedinger_encode_init(AVCodecContext *avccontext)
-{
-    FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data;
-    SchroVideoFormatEnum preset;
-
-    /* Initialize the libraries that libschroedinger depends on. */
-    schro_init();
-
-    /* Create an encoder object. */
-    p_schro_params->encoder = schro_encoder_new();
-
-    if (!p_schro_params->encoder) {
-        av_log(avccontext, AV_LOG_ERROR,
-               "Unrecoverable Error: schro_encoder_new failed. ");
-        return -1;
-    }
-
-    /* Initialize the format. */
-    preset = ff_get_schro_video_format_preset(avccontext);
-    p_schro_params->format =
-                    schro_encoder_get_video_format(p_schro_params->encoder);
-    schro_video_format_set_std_video_format(p_schro_params->format, preset);
-    p_schro_params->format->width  = avccontext->width;
-    p_schro_params->format->height = avccontext->height;
-
-    if (SetSchroChromaFormat(avccontext) == -1)
-        return -1;
-
-    if (ff_get_schro_frame_format(p_schro_params->format->chroma_format,
-                                  &p_schro_params->frame_format) == -1) {
-        av_log(avccontext, AV_LOG_ERROR,
-               "This codec currently supports only planar YUV 4:2:0, 4:2:2"
-               " and 4:4:4 formats.\n");
-        return -1;
-    }
-
-    p_schro_params->format->frame_rate_numerator   = avccontext->time_base.den;
-    p_schro_params->format->frame_rate_denominator = avccontext->time_base.num;
-
-    p_schro_params->frame_size = avpicture_get_size(avccontext->pix_fmt,
-                                                    avccontext->width,
-                                                    avccontext->height);
-
-    avccontext->coded_frame = &p_schro_params->picture;
-
-    if (!avccontext->gop_size) {
-        schro_encoder_setting_set_double(p_schro_params->encoder,
-                                         "gop_structure",
-                                         SCHRO_ENCODER_GOP_INTRA_ONLY);
-
-        if (avccontext->coder_type == FF_CODER_TYPE_VLC)
-            schro_encoder_setting_set_double(p_schro_params->encoder,
-                                             "enable_noarith", 1);
-    } else {
-        schro_encoder_setting_set_double(p_schro_params->encoder,
-                                         "gop_structure",
-                                         SCHRO_ENCODER_GOP_BIREF);
-        avccontext->has_b_frames = 1;
-    }
-
-    /* FIXME - Need to handle SCHRO_ENCODER_RATE_CONTROL_LOW_DELAY. */
-    if (avccontext->flags & CODEC_FLAG_QSCALE) {
-        if (!avccontext->global_quality) {
-            /* lossless coding */
-            schro_encoder_setting_set_double(p_schro_params->encoder,
-                                             "rate_control",
-                                             SCHRO_ENCODER_RATE_CONTROL_LOSSLESS);
-        } else {
-            int noise_threshold;
-            schro_encoder_setting_set_double(p_schro_params->encoder,
-                                             "rate_control",
-                                             SCHRO_ENCODER_RATE_CONTROL_CONSTANT_NOISE_THRESHOLD);
-
-            noise_threshold = avccontext->global_quality / FF_QP2LAMBDA;
-            if (noise_threshold > 100)
-                noise_threshold = 100;
-            schro_encoder_setting_set_double(p_schro_params->encoder,
-                                             "noise_threshold",
-                                             noise_threshold);
-        }
-    } else {
-        schro_encoder_setting_set_double(p_schro_params->encoder,
-                                         "rate_control",
-                                         SCHRO_ENCODER_RATE_CONTROL_CONSTANT_BITRATE);
-
-        schro_encoder_setting_set_double(p_schro_params->encoder,
-                                         "bitrate",
-                                         avccontext->bit_rate);
-
-    }
-
-    if (avccontext->flags & CODEC_FLAG_INTERLACED_ME)
-        /* All material can be coded as interlaced or progressive
-           irrespective of the type of source material. */
-        schro_encoder_setting_set_double(p_schro_params->encoder,
-                                         "interlaced_coding", 1);
-
-    /* FIXME: Signal range hardcoded to 8-bit data until both libschroedinger
-     * and libdirac support other bit-depth data. */
-    schro_video_format_set_std_signal_range(p_schro_params->format,
-                                            SCHRO_SIGNAL_RANGE_8BIT_VIDEO);
-
-    /* Set the encoder format. */
-    schro_encoder_set_video_format(p_schro_params->encoder,
-                                   p_schro_params->format);
-
-    /* Set the debug level. */
-    schro_debug_set_level(avccontext->debug);
-
-    schro_encoder_start(p_schro_params->encoder);
-
-    /* Initialize the encoded frame queue. */
-    ff_dirac_schro_queue_init(&p_schro_params->enc_frame_queue);
-    return 0;
-}
-
-static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
-                                                   void *in_data)
-{
-    FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data;
-    SchroFrame *in_frame;
-    /* Input line size may differ from what the codec supports. Especially
-     * when transcoding from one format to another. So use avpicture_layout
-     * to copy the frame. */
-    in_frame = ff_create_schro_frame(avccontext, p_schro_params->frame_format);
-
-    if (in_frame)
-        avpicture_layout((AVPicture *)in_data, avccontext->pix_fmt,
-                          avccontext->width, avccontext->height,
-                          in_frame->components[0].data,
-                          p_schro_params->frame_size);
-
-    return in_frame;
-}
-
-static void SchroedingerFreeFrame(void *data)
-{
-    FfmpegDiracSchroEncodedFrame *enc_frame = data;
-
-    av_freep(&(enc_frame->p_encbuf));
-    av_free(enc_frame);
-}
-
-static int libschroedinger_encode_frame(AVCodecContext *avccontext,
-                                        unsigned char *frame,
-                                        int buf_size, void *data)
-{
-    int enc_size = 0;
-    FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data;
-    SchroEncoder *encoder = p_schro_params->encoder;
-    struct FfmpegDiracSchroEncodedFrame* p_frame_output = NULL;
-    int go = 1;
-    SchroBuffer *enc_buf;
-    int presentation_frame;
-    int parse_code;
-    int last_frame_in_sequence = 0;
-
-    if (!data) {
-        /* Push end of sequence if not already signalled. */
-        if (!p_schro_params->eos_signalled) {
-            schro_encoder_end_of_stream(encoder);
-            p_schro_params->eos_signalled = 1;
-        }
-    } else {
-        /* Allocate frame data to schro input buffer. */
-        SchroFrame *in_frame = libschroedinger_frame_from_data(avccontext,
-                                                               data);
-        /* Load next frame. */
-        schro_encoder_push_frame(encoder, in_frame);
-    }
-
-    if (p_schro_params->eos_pulled)
-        go = 0;
-
-    /* Now check to see if we have any output from the encoder. */
-    while (go) {
-        SchroStateEnum state;
-        state = schro_encoder_wait(encoder);
-        switch (state) {
-        case SCHRO_STATE_HAVE_BUFFER:
-        case SCHRO_STATE_END_OF_STREAM:
-            enc_buf = schro_encoder_pull(encoder, &presentation_frame);
-            assert(enc_buf->length > 0);
-            assert(enc_buf->length <= buf_size);
-            parse_code = enc_buf->data[4];
-
-            /* All non-frame data is prepended to actual frame data to
-             * be able to set the pts correctly. So we don't write data
-             * to the frame output queue until we actually have a frame
-             */
-            p_schro_params->enc_buf = av_realloc(p_schro_params->enc_buf,
-                                                 p_schro_params->enc_buf_size + enc_buf->length);
-
-            memcpy(p_schro_params->enc_buf + p_schro_params->enc_buf_size,
-                   enc_buf->data, enc_buf->length);
-            p_schro_params->enc_buf_size += enc_buf->length;
-
-
-            if (state == SCHRO_STATE_END_OF_STREAM) {
-                p_schro_params->eos_pulled = 1;
-                go = 0;
-            }
-
-            if (!SCHRO_PARSE_CODE_IS_PICTURE(parse_code)) {
-                schro_buffer_unref(enc_buf);
-                break;
-            }
-
-            /* Create output frame. */
-            p_frame_output = av_mallocz(sizeof(FfmpegDiracSchroEncodedFrame));
-            /* Set output data. */
-            p_frame_output->size     = p_schro_params->enc_buf_size;
-            p_frame_output->p_encbuf = p_schro_params->enc_buf;
-            if (SCHRO_PARSE_CODE_IS_INTRA(parse_code) &&
-                SCHRO_PARSE_CODE_IS_REFERENCE(parse_code))
-                p_frame_output->key_frame = 1;
-
-            /* Parse the coded frame number from the bitstream. Bytes 14
-             * through 17 represesent the frame number. */
-                p_frame_output->frame_num = (enc_buf->data[13] << 24) +
-                                            (enc_buf->data[14] << 16) +
-                                            (enc_buf->data[15] <<  8) +
-                                             enc_buf->data[16];
-
-            ff_dirac_schro_queue_push_back(&p_schro_params->enc_frame_queue,
-                                           p_frame_output);
-            p_schro_params->enc_buf_size = 0;
-            p_schro_params->enc_buf      = NULL;
-
-            schro_buffer_unref(enc_buf);
-
-            break;
-
-        case SCHRO_STATE_NEED_FRAME:
-            go = 0;
-            break;
-
-        case SCHRO_STATE_AGAIN:
-            break;
-
-        default:
-            av_log(avccontext, AV_LOG_ERROR, "Unknown Schro Encoder state\n");
-            return -1;
-        }
-    }
-
-    /* Copy 'next' frame in queue. */
-
-    if (p_schro_params->enc_frame_queue.size == 1 &&
-        p_schro_params->eos_pulled)
-        last_frame_in_sequence = 1;
-
-    p_frame_output = ff_dirac_schro_queue_pop(&p_schro_params->enc_frame_queue);
-
-    if (!p_frame_output)
-        return 0;
-
-    memcpy(frame, p_frame_output->p_encbuf, p_frame_output->size);
-    avccontext->coded_frame->key_frame = p_frame_output->key_frame;
-    /* Use the frame number of the encoded frame as the pts. It is OK to
-     * do so since Dirac is a constant frame rate codec. It expects input
-     * to be of constant frame rate. */
-    avccontext->coded_frame->pts = p_frame_output->frame_num;
-    enc_size = p_frame_output->size;
-
-    /* Append the end of sequence information to the last frame in the
-     * sequence. */
-    if (last_frame_in_sequence && p_schro_params->enc_buf_size > 0) {
-        memcpy(frame + enc_size, p_schro_params->enc_buf,
-               p_schro_params->enc_buf_size);
-        enc_size += p_schro_params->enc_buf_size;
-        av_freep(&p_schro_params->enc_buf);
-        p_schro_params->enc_buf_size = 0;
-    }
-
-    /* free frame */
-    SchroedingerFreeFrame(p_frame_output);
-
-    return enc_size;
-}
-
-
-static int libschroedinger_encode_close(AVCodecContext *avccontext)
-{
-
-    FfmpegSchroEncoderParams* p_schro_params = avccontext->priv_data;
-
-    /* Close the encoder. */
-    schro_encoder_free(p_schro_params->encoder);
-
-    /* Free data in the output frame queue. */
-    ff_dirac_schro_queue_free(&p_schro_params->enc_frame_queue,
-                              SchroedingerFreeFrame);
-
-
-    /* Free the encoder buffer. */
-    if (p_schro_params->enc_buf_size)
-        av_freep(&p_schro_params->enc_buf);
-
-    /* Free the video format structure. */
-    av_freep(&p_schro_params->format);
-
-    return 0;
-}
-
-
-AVCodec libschroedinger_encoder = {
-    "libschroedinger",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_DIRAC,
-    sizeof(FfmpegSchroEncoderParams),
-    libschroedinger_encode_init,
-    libschroedinger_encode_frame,
-    libschroedinger_encode_close,
-   .capabilities = CODEC_CAP_DELAY,
-   .pix_fmts     = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
-   .long_name    = NULL_IF_CONFIG_SMALL("libschroedinger Dirac 2.2"),
-};
diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c
deleted file mode 100644
index c5cfbd5..0000000
--- a/libavcodec/libspeexdec.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2008 David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include <speex/speex.h>
-#include <speex/speex_header.h>
-#include <speex/speex_stereo.h>
-#include <speex/speex_callbacks.h>
-
-typedef struct {
-    SpeexBits bits;
-    SpeexStereoState stereo;
-    void *dec_state;
-    SpeexHeader *header;
-    int frame_size;
-} LibSpeexContext;
-
-
-static av_cold int libspeex_decode_init(AVCodecContext *avctx)
-{
-    LibSpeexContext *s = avctx->priv_data;
-    const SpeexMode *mode;
-
-    // defaults in the case of a missing header
-    if (avctx->sample_rate <= 8000)
-        mode = &speex_nb_mode;
-    else if (avctx->sample_rate <= 16000)
-        mode = &speex_wb_mode;
-    else
-        mode = &speex_uwb_mode;
-
-    if (avctx->extradata_size >= 80)
-        s->header = speex_packet_to_header(avctx->extradata, avctx->extradata_size);
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    if (s->header) {
-        avctx->sample_rate = s->header->rate;
-        avctx->channels    = s->header->nb_channels;
-        avctx->frame_size  = s->frame_size = s->header->frame_size;
-        if (s->header->frames_per_packet)
-            avctx->frame_size *= s->header->frames_per_packet;
-
-        mode = speex_lib_get_mode(s->header->mode);
-        if (!mode) {
-            av_log(avctx, AV_LOG_ERROR, "Unknown Speex mode %d", s->header->mode);
-            return -1;
-        }
-    } else
-        av_log(avctx, AV_LOG_INFO, "Missing Speex header, assuming defaults.\n");
-
-    if (avctx->channels > 2) {
-        av_log(avctx, AV_LOG_ERROR, "Only stereo and mono are supported.\n");
-        return -1;
-    }
-
-    speex_bits_init(&s->bits);
-    s->dec_state = speex_decoder_init(mode);
-    if (!s->dec_state) {
-        av_log(avctx, AV_LOG_ERROR, "Error initializing libspeex decoder.\n");
-        return -1;
-    }
-
-    if (!s->header) {
-        speex_decoder_ctl(s->dec_state, SPEEX_GET_FRAME_SIZE, &s->frame_size);
-    }
-
-    if (avctx->channels == 2) {
-        SpeexCallback callback;
-        callback.callback_id = SPEEX_INBAND_STEREO;
-        callback.func = speex_std_stereo_request_handler;
-        callback.data = &s->stereo;
-        s->stereo = (SpeexStereoState)SPEEX_STEREO_STATE_INIT;
-        speex_decoder_ctl(s->dec_state, SPEEX_SET_HANDLER, &callback);
-    }
-    return 0;
-}
-
-static int libspeex_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    LibSpeexContext *s = avctx->priv_data;
-    int16_t *output = data, *end;
-    int i, num_samples;
-
-    num_samples = s->frame_size * avctx->channels;
-    end = output + *data_size / sizeof(*output);
-
-    speex_bits_read_from(&s->bits, buf, buf_size);
-
-    for (i = 0; speex_bits_remaining(&s->bits) && output + num_samples < end; i++) {
-        int ret = speex_decode_int(s->dec_state, &s->bits, output);
-        if (ret <= -2) {
-            av_log(avctx, AV_LOG_ERROR, "Error decoding Speex frame.\n");
-            return -1;
-        } else if (ret == -1)
-            // end of stream
-            break;
-
-        if (avctx->channels == 2)
-            speex_decode_stereo_int(output, s->frame_size, &s->stereo);
-
-        output += num_samples;
-    }
-
-    avctx->frame_size = s->frame_size * i;
-    *data_size = avctx->channels * avctx->frame_size * sizeof(*output);
-    return buf_size;
-}
-
-static av_cold int libspeex_decode_close(AVCodecContext *avctx)
-{
-    LibSpeexContext *s = avctx->priv_data;
-
-    speex_header_free(s->header);
-    speex_bits_destroy(&s->bits);
-    speex_decoder_destroy(s->dec_state);
-
-    return 0;
-}
-
-AVCodec libspeex_decoder = {
-    "libspeex",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SPEEX,
-    sizeof(LibSpeexContext),
-    libspeex_decode_init,
-    NULL,
-    libspeex_decode_close,
-    libspeex_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("libspeex Speex"),
-};
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c
deleted file mode 100644
index 2dc45a9..0000000
--- a/libavcodec/libtheoraenc.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright (c) 2006 Paul Richards <paul.richards at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Theora encoder using libtheora.
- * @author Paul Richards <paul.richards at gmail.com>
- *
- * A lot of this is copy / paste from other output codecs in
- * libavcodec or pure guesswork (or both).
- *
- * I have used t_ prefixes on variables which are libtheora types
- * and o_ prefixes on variables which are libogg types.
- */
-
-/* FFmpeg includes */
-#include "libavutil/intreadwrite.h"
-#include "libavutil/log.h"
-#include "libavutil/base64.h"
-#include "avcodec.h"
-
-/* libtheora includes */
-#include <theora/theoraenc.h>
-
-typedef struct TheoraContext {
-    th_enc_ctx *t_state;
-    uint8_t    *stats;
-    int         stats_size;
-    int         stats_offset;
-    int         uv_hshift;
-    int         uv_vshift;
-    int         keyframe_mask;
-} TheoraContext;
-
-/** Concatenates an ogg_packet into the extradata. */
-static int concatenate_packet(unsigned int* offset,
-                              AVCodecContext* avc_context,
-                              const ogg_packet* packet)
-{
-    const char* message = NULL;
-    uint8_t* newdata    = NULL;
-    int newsize = avc_context->extradata_size + 2 + packet->bytes;
-
-    if (packet->bytes < 0) {
-        message = "ogg_packet has negative size";
-    } else if (packet->bytes > 0xffff) {
-        message = "ogg_packet is larger than 65535 bytes";
-    } else if (newsize < avc_context->extradata_size) {
-        message = "extradata_size would overflow";
-    } else {
-        newdata = av_realloc(avc_context->extradata, newsize);
-        if (!newdata)
-            message = "av_realloc failed";
-    }
-    if (message) {
-        av_log(avc_context, AV_LOG_ERROR, "concatenate_packet failed: %s\n", message);
-        return -1;
-    }
-
-    avc_context->extradata      = newdata;
-    avc_context->extradata_size = newsize;
-    AV_WB16(avc_context->extradata + (*offset), packet->bytes);
-    *offset += 2;
-    memcpy(avc_context->extradata + (*offset), packet->packet, packet->bytes);
-    (*offset) += packet->bytes;
-    return 0;
-}
-
-static int get_stats(AVCodecContext *avctx, int eos)
-{
-#ifdef TH_ENCCTL_2PASS_OUT
-    TheoraContext *h = avctx->priv_data;
-    uint8_t *buf;
-    int bytes;
-
-    bytes = th_encode_ctl(h->t_state, TH_ENCCTL_2PASS_OUT, &buf, sizeof(buf));
-    if (bytes < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Error getting first pass stats\n");
-        return -1;
-    }
-    if (!eos) {
-        h->stats = av_fast_realloc(h->stats, &h->stats_size,
-                                   h->stats_offset + bytes);
-        memcpy(h->stats + h->stats_offset, buf, bytes);
-        h->stats_offset += bytes;
-    } else {
-        int b64_size = ((h->stats_offset + 2) / 3) * 4 + 1;
-        // libtheora generates a summary header at the end
-        memcpy(h->stats, buf, bytes);
-        avctx->stats_out = av_malloc(b64_size);
-        av_base64_encode(avctx->stats_out, b64_size, h->stats, h->stats_offset);
-    }
-    return 0;
-#else
-    av_log(avctx, AV_LOG_ERROR, "libtheora too old to support 2pass\n");
-    return -1;
-#endif
-}
-
-// libtheora won't read the entire buffer we give it at once, so we have to
-// repeatedly submit it...
-static int submit_stats(AVCodecContext *avctx)
-{
-#ifdef TH_ENCCTL_2PASS_IN
-    TheoraContext *h = avctx->priv_data;
-    int bytes;
-    if (!h->stats) {
-        if (!avctx->stats_in) {
-            av_log(avctx, AV_LOG_ERROR, "No statsfile for second pass\n");
-            return -1;
-        }
-        h->stats_size = strlen(avctx->stats_in) * 3/4;
-        h->stats      = av_malloc(h->stats_size);
-        h->stats_size = av_base64_decode(h->stats, avctx->stats_in, h->stats_size);
-    }
-    while (h->stats_size - h->stats_offset > 0) {
-        bytes = th_encode_ctl(h->t_state, TH_ENCCTL_2PASS_IN,
-                              h->stats + h->stats_offset,
-                              h->stats_size - h->stats_offset);
-        if (bytes < 0) {
-            av_log(avctx, AV_LOG_ERROR, "Error submitting stats\n");
-            return -1;
-        }
-        if (!bytes)
-            return 0;
-        h->stats_offset += bytes;
-    }
-    return 0;
-#else
-    av_log(avctx, AV_LOG_ERROR, "libtheora too old to support 2pass\n");
-    return -1;
-#endif
-}
-
-static av_cold int encode_init(AVCodecContext* avc_context)
-{
-    th_info t_info;
-    th_comment t_comment;
-    ogg_packet o_packet;
-    unsigned int offset;
-    TheoraContext *h = avc_context->priv_data;
-    uint32_t gop_size = avc_context->gop_size;
-
-    /* Set up the theora_info struct */
-    th_info_init(&t_info);
-    t_info.frame_width  = FFALIGN(avc_context->width,  16);
-    t_info.frame_height = FFALIGN(avc_context->height, 16);
-    t_info.pic_width    = avc_context->width;
-    t_info.pic_height   = avc_context->height;
-    t_info.pic_x        = 0;
-    t_info.pic_y        = 0;
-    /* Swap numerator and denominator as time_base in AVCodecContext gives the
-     * time period between frames, but theora_info needs the framerate.  */
-    t_info.fps_numerator   = avc_context->time_base.den;
-    t_info.fps_denominator = avc_context->time_base.num;
-    if (avc_context->sample_aspect_ratio.num) {
-        t_info.aspect_numerator   = avc_context->sample_aspect_ratio.num;
-        t_info.aspect_denominator = avc_context->sample_aspect_ratio.den;
-    } else {
-        t_info.aspect_numerator   = 1;
-        t_info.aspect_denominator = 1;
-    }
-
-    if (avc_context->color_primaries == AVCOL_PRI_BT470M)
-        t_info.colorspace = TH_CS_ITU_REC_470M;
-    else if (avc_context->color_primaries == AVCOL_PRI_BT470BG)
-        t_info.colorspace = TH_CS_ITU_REC_470BG;
-    else
-        t_info.colorspace = TH_CS_UNSPECIFIED;
-
-    if (avc_context->pix_fmt == PIX_FMT_YUV420P)
-        t_info.pixel_fmt = TH_PF_420;
-    else if (avc_context->pix_fmt == PIX_FMT_YUV422P)
-        t_info.pixel_fmt = TH_PF_422;
-    else if (avc_context->pix_fmt == PIX_FMT_YUV444P)
-        t_info.pixel_fmt = TH_PF_444;
-    else {
-        av_log(avc_context, AV_LOG_ERROR, "Unsupported pix_fmt\n");
-        return -1;
-    }
-    avcodec_get_chroma_sub_sample(avc_context->pix_fmt, &h->uv_hshift, &h->uv_vshift);
-
-    if (avc_context->flags & CODEC_FLAG_QSCALE) {
-        /* to be constant with the libvorbis implementation, clip global_quality to 0 - 10
-           Theora accepts a quality parameter p, which is:
-                * 0 <= p <=63
-                * an int value
-         */
-        t_info.quality        = av_clip(avc_context->global_quality / (float)FF_QP2LAMBDA, 0, 10) * 6.3;
-        t_info.target_bitrate = 0;
-    } else {
-        t_info.target_bitrate = avc_context->bit_rate;
-        t_info.quality        = 0;
-    }
-
-    /* Now initialise libtheora */
-    h->t_state = th_encode_alloc(&t_info);
-    if (!h->t_state) {
-        av_log(avc_context, AV_LOG_ERROR, "theora_encode_init failed\n");
-        return -1;
-    }
-
-    h->keyframe_mask = (1 << t_info.keyframe_granule_shift) - 1;
-    /* Clear up theora_info struct */
-    th_info_clear(&t_info);
-
-    if (th_encode_ctl(h->t_state, TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE,
-                      &gop_size, sizeof(gop_size))) {
-        av_log(avc_context, AV_LOG_ERROR, "Error setting GOP size\n");
-        return -1;
-    }
-
-    // need to enable 2 pass (via TH_ENCCTL_2PASS_) before encoding headers
-    if (avc_context->flags & CODEC_FLAG_PASS1) {
-        if (get_stats(avc_context, 0))
-            return -1;
-    } else if (avc_context->flags & CODEC_FLAG_PASS2) {
-        if (submit_stats(avc_context))
-            return -1;
-    }
-
-    /*
-        Output first header packet consisting of theora
-        header, comment, and tables.
-
-        Each one is prefixed with a 16bit size, then they
-        are concatenated together into ffmpeg's extradata.
-    */
-    offset = 0;
-
-    /* Headers */
-    th_comment_init(&t_comment);
-
-    while (th_encode_flushheader(h->t_state, &t_comment, &o_packet))
-        if (concatenate_packet(&offset, avc_context, &o_packet))
-            return -1;
-
-    th_comment_clear(&t_comment);
-
-    /* Set up the output AVFrame */
-    avc_context->coded_frame= avcodec_alloc_frame();
-
-    return 0;
-}
-
-static int encode_frame(AVCodecContext* avc_context, uint8_t *outbuf,
-                        int buf_size, void *data)
-{
-    th_ycbcr_buffer t_yuv_buffer;
-    TheoraContext *h = avc_context->priv_data;
-    AVFrame *frame = data;
-    ogg_packet o_packet;
-    int result, i;
-
-    // EOS, finish and get 1st pass stats if applicable
-    if (!frame) {
-        th_encode_packetout(h->t_state, 1, &o_packet);
-        if (avc_context->flags & CODEC_FLAG_PASS1)
-            if (get_stats(avc_context, 1))
-                return -1;
-        return 0;
-    }
-
-    /* Copy planes to the theora yuv_buffer */
-    for (i = 0; i < 3; i++) {
-        t_yuv_buffer[i].width  = FFALIGN(avc_context->width,  16) >> (i && h->uv_hshift);
-        t_yuv_buffer[i].height = FFALIGN(avc_context->height, 16) >> (i && h->uv_vshift);
-        t_yuv_buffer[i].stride = frame->linesize[i];
-        t_yuv_buffer[i].data   = frame->data[i];
-    }
-
-    if (avc_context->flags & CODEC_FLAG_PASS2)
-        if (submit_stats(avc_context))
-            return -1;
-
-    /* Now call into theora_encode_YUVin */
-    result = th_encode_ycbcr_in(h->t_state, t_yuv_buffer);
-    if (result) {
-        const char* message;
-        switch (result) {
-        case -1:
-            message = "differing frame sizes";
-            break;
-        case TH_EINVAL:
-            message = "encoder is not ready or is finished";
-            break;
-        default:
-            message = "unknown reason";
-            break;
-        }
-        av_log(avc_context, AV_LOG_ERROR, "theora_encode_YUVin failed (%s) [%d]\n", message, result);
-        return -1;
-    }
-
-    if (avc_context->flags & CODEC_FLAG_PASS1)
-        if (get_stats(avc_context, 0))
-            return -1;
-
-    /* Pick up returned ogg_packet */
-    result = th_encode_packetout(h->t_state, 0, &o_packet);
-    switch (result) {
-    case 0:
-        /* No packet is ready */
-        return 0;
-    case 1:
-        /* Success, we have a packet */
-        break;
-    default:
-        av_log(avc_context, AV_LOG_ERROR, "theora_encode_packetout failed [%d]\n", result);
-        return -1;
-    }
-
-    /* Copy ogg_packet content out to buffer */
-    if (buf_size < o_packet.bytes) {
-        av_log(avc_context, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-    memcpy(outbuf, o_packet.packet, o_packet.bytes);
-
-    // HACK: assumes no encoder delay, this is true until libtheora becomes
-    // multithreaded (which will be disabled unless explictly requested)
-    avc_context->coded_frame->pts = frame->pts;
-    avc_context->coded_frame->key_frame = !(o_packet.granulepos & h->keyframe_mask);
-
-    return o_packet.bytes;
-}
-
-static av_cold int encode_close(AVCodecContext* avc_context)
-{
-    TheoraContext *h = avc_context->priv_data;
-
-    th_encode_free(h->t_state);
-    av_freep(&h->stats);
-    av_freep(&avc_context->coded_frame);
-    av_freep(&avc_context->stats_out);
-    av_freep(&avc_context->extradata);
-    avc_context->extradata_size = 0;
-
-    return 0;
-}
-
-/** AVCodec struct exposed to libavcodec */
-AVCodec libtheora_encoder = {
-    .name = "libtheora",
-    .type = AVMEDIA_TYPE_VIDEO,
-    .id = CODEC_ID_THEORA,
-    .priv_data_size = sizeof(TheoraContext),
-    .init = encode_init,
-    .close = encode_close,
-    .encode = encode_frame,
-    .capabilities = CODEC_CAP_DELAY, // needed to get the statsfile summary
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("libtheora Theora"),
-};
diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
deleted file mode 100644
index 81d328a..0000000
--- a/libavcodec/libvorbis.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * copyright (c) 2002 Mark Hills <mark at pogo.org.uk>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Ogg Vorbis codec support via libvorbisenc.
- * @author Mark Hills <mark at pogo.org.uk>
- */
-
-#include <vorbis/vorbisenc.h>
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#define OGGVORBIS_FRAME_SIZE 64
-
-#define BUFFER_SIZE (1024*64)
-
-typedef struct OggVorbisContext {
-    vorbis_info vi ;
-    vorbis_dsp_state vd ;
-    vorbis_block vb ;
-    uint8_t buffer[BUFFER_SIZE];
-    int buffer_index;
-    int eof;
-
-    /* decoder */
-    vorbis_comment vc ;
-    ogg_packet op;
-} OggVorbisContext ;
-
-
-static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext) {
-    double cfreq;
-
-    if(avccontext->flags & CODEC_FLAG_QSCALE) {
-        /* variable bitrate */
-        if(vorbis_encode_setup_vbr(vi, avccontext->channels,
-                avccontext->sample_rate,
-                avccontext->global_quality / (float)FF_QP2LAMBDA / 10.0))
-            return -1;
-    } else {
-        /* constant bitrate */
-        if(vorbis_encode_setup_managed(vi, avccontext->channels,
-                avccontext->sample_rate, -1, avccontext->bit_rate, -1))
-            return -1;
-
-#ifdef OGGVORBIS_VBR_BY_ESTIMATE
-        /* variable bitrate by estimate */
-        if(vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_AVG, NULL))
-            return -1;
-#endif
-    }
-
-    /* cutoff frequency */
-    if(avccontext->cutoff > 0) {
-        cfreq = avccontext->cutoff / 1000.0;
-        if(vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &cfreq))
-            return -1;
-    }
-
-    return vorbis_encode_setup_init(vi);
-}
-
-static av_cold int oggvorbis_encode_init(AVCodecContext *avccontext) {
-    OggVorbisContext *context = avccontext->priv_data ;
-    ogg_packet header, header_comm, header_code;
-    uint8_t *p;
-    unsigned int offset, len;
-
-    vorbis_info_init(&context->vi) ;
-    if(oggvorbis_init_encoder(&context->vi, avccontext) < 0) {
-        av_log(avccontext, AV_LOG_ERROR, "oggvorbis_encode_init: init_encoder failed\n") ;
-        return -1 ;
-    }
-    vorbis_analysis_init(&context->vd, &context->vi) ;
-    vorbis_block_init(&context->vd, &context->vb) ;
-
-    vorbis_comment_init(&context->vc);
-    vorbis_comment_add_tag(&context->vc, "encoder", LIBAVCODEC_IDENT) ;
-
-    vorbis_analysis_headerout(&context->vd, &context->vc, &header,
-                                &header_comm, &header_code);
-
-    len = header.bytes + header_comm.bytes +  header_code.bytes;
-    avccontext->extradata_size= 64 + len + len/255;
-    p = avccontext->extradata= av_mallocz(avccontext->extradata_size);
-    p[0] = 2;
-    offset = 1;
-    offset += av_xiphlacing(&p[offset], header.bytes);
-    offset += av_xiphlacing(&p[offset], header_comm.bytes);
-    memcpy(&p[offset], header.packet, header.bytes);
-    offset += header.bytes;
-    memcpy(&p[offset], header_comm.packet, header_comm.bytes);
-    offset += header_comm.bytes;
-    memcpy(&p[offset], header_code.packet, header_code.bytes);
-    offset += header_code.bytes;
-    avccontext->extradata_size = offset;
-    avccontext->extradata= av_realloc(avccontext->extradata, avccontext->extradata_size);
-
-/*    vorbis_block_clear(&context->vb);
-    vorbis_dsp_clear(&context->vd);
-    vorbis_info_clear(&context->vi);*/
-    vorbis_comment_clear(&context->vc);
-
-    avccontext->frame_size = OGGVORBIS_FRAME_SIZE ;
-
-    avccontext->coded_frame= avcodec_alloc_frame();
-    avccontext->coded_frame->key_frame= 1;
-
-    return 0 ;
-}
-
-
-static int oggvorbis_encode_frame(AVCodecContext *avccontext,
-                                  unsigned char *packets,
-                           int buf_size, void *data)
-{
-    OggVorbisContext *context = avccontext->priv_data ;
-    ogg_packet op ;
-    signed short *audio = data ;
-    int l;
-
-    if(data) {
-        int samples = OGGVORBIS_FRAME_SIZE;
-        float **buffer ;
-
-        buffer = vorbis_analysis_buffer(&context->vd, samples) ;
-        if(context->vi.channels == 1) {
-            for(l = 0 ; l < samples ; l++)
-                buffer[0][l]=audio[l]/32768.f;
-        } else {
-            for(l = 0 ; l < samples ; l++){
-                buffer[0][l]=audio[l*2]/32768.f;
-                buffer[1][l]=audio[l*2+1]/32768.f;
-            }
-        }
-        vorbis_analysis_wrote(&context->vd, samples) ;
-    } else {
-        if(!context->eof)
-            vorbis_analysis_wrote(&context->vd, 0) ;
-        context->eof = 1;
-    }
-
-    while(vorbis_analysis_blockout(&context->vd, &context->vb) == 1) {
-        vorbis_analysis(&context->vb, NULL);
-        vorbis_bitrate_addblock(&context->vb) ;
-
-        while(vorbis_bitrate_flushpacket(&context->vd, &op)) {
-            /* i'd love to say the following line is a hack, but sadly it's
-             * not, apparently the end of stream decision is in libogg. */
-            if(op.bytes==1)
-                continue;
-            memcpy(context->buffer + context->buffer_index, &op, sizeof(ogg_packet));
-            context->buffer_index += sizeof(ogg_packet);
-            memcpy(context->buffer + context->buffer_index, op.packet, op.bytes);
-            context->buffer_index += op.bytes;
-//            av_log(avccontext, AV_LOG_DEBUG, "e%d / %d\n", context->buffer_index, op.bytes);
-        }
-    }
-
-    l=0;
-    if(context->buffer_index){
-        ogg_packet *op2= (ogg_packet*)context->buffer;
-        op2->packet = context->buffer + sizeof(ogg_packet);
-
-        l=  op2->bytes;
-        avccontext->coded_frame->pts= av_rescale_q(op2->granulepos, (AVRational){1, avccontext->sample_rate}, avccontext->time_base);
-        //FIXME we should reorder the user supplied pts and not assume that they are spaced by 1/sample_rate
-
-        memcpy(packets, op2->packet, l);
-        context->buffer_index -= l + sizeof(ogg_packet);
-        memcpy(context->buffer, context->buffer + l + sizeof(ogg_packet), context->buffer_index);
-//        av_log(avccontext, AV_LOG_DEBUG, "E%d\n", l);
-    }
-
-    return l;
-}
-
-
-static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) {
-    OggVorbisContext *context = avccontext->priv_data ;
-/*  ogg_packet op ; */
-
-    vorbis_analysis_wrote(&context->vd, 0) ; /* notify vorbisenc this is EOF */
-
-    vorbis_block_clear(&context->vb);
-    vorbis_dsp_clear(&context->vd);
-    vorbis_info_clear(&context->vi);
-
-    av_freep(&avccontext->coded_frame);
-    av_freep(&avccontext->extradata);
-
-    return 0 ;
-}
-
-
-AVCodec libvorbis_encoder = {
-    "libvorbis",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_VORBIS,
-    sizeof(OggVorbisContext),
-    oggvorbis_encode_init,
-    oggvorbis_encode_frame,
-    oggvorbis_encode_close,
-    .capabilities= CODEC_CAP_DELAY,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
-} ;
diff --git a/libavcodec/libvpxdec.c b/libavcodec/libvpxdec.c
deleted file mode 100644
index 0464d12..0000000
--- a/libavcodec/libvpxdec.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2010, Google, Inc.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VP8 decoder support via libvpx
- */
-
-#define VPX_CODEC_DISABLE_COMPAT 1
-#include <vpx/vpx_decoder.h>
-#include <vpx/vp8dx.h>
-
-#include "avcodec.h"
-
-typedef struct VP8DecoderContext {
-    struct vpx_codec_ctx decoder;
-} VP8Context;
-
-static av_cold int vp8_init(AVCodecContext *avctx)
-{
-    VP8Context *ctx = avctx->priv_data;
-    const struct vpx_codec_iface *iface = &vpx_codec_vp8_dx_algo;
-    struct vpx_codec_dec_cfg deccfg = {
-        /* token partitions+1 would be a decent choice */
-        .threads = FFMIN(avctx->thread_count, 16)
-    };
-
-    av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
-    av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
-
-    if (vpx_codec_dec_init(&ctx->decoder, iface, &deccfg, 0) != VPX_CODEC_OK) {
-        const char *error = vpx_codec_error(&ctx->decoder);
-        av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n",
-               error);
-        return AVERROR(EINVAL);
-    }
-
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-    return 0;
-}
-
-static int vp8_decode(AVCodecContext *avctx,
-                      void *data, int *data_size, AVPacket *avpkt)
-{
-    VP8Context *ctx = avctx->priv_data;
-    AVFrame *picture = data;
-    const void *iter = NULL;
-    struct vpx_image *img;
-
-    if (vpx_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL, 0) !=
-        VPX_CODEC_OK) {
-        const char *error  = vpx_codec_error(&ctx->decoder);
-        const char *detail = vpx_codec_error_detail(&ctx->decoder);
-
-        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
-        if (detail)
-            av_log(avctx, AV_LOG_ERROR, "  Additional information: %s\n",
-                   detail);
-        return AVERROR_INVALIDDATA;
-    }
-
-    if ((img = vpx_codec_get_frame(&ctx->decoder, &iter))) {
-        if (img->fmt != VPX_IMG_FMT_I420) {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d)\n",
-                   img->fmt);
-            return AVERROR_INVALIDDATA;
-        }
-
-        if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
-            av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
-                   avctx->width, avctx->height, img->d_w, img->d_h);
-            if (avcodec_check_dimensions(avctx, img->d_w, img->d_h))
-                return AVERROR_INVALIDDATA;
-            avcodec_set_dimensions(avctx, img->d_w, img->d_h);
-        }
-        picture->data[0]     = img->planes[0];
-        picture->data[1]     = img->planes[1];
-        picture->data[2]     = img->planes[2];
-        picture->data[3]     = NULL;
-        picture->linesize[0] = img->stride[0];
-        picture->linesize[1] = img->stride[1];
-        picture->linesize[2] = img->stride[2];
-        picture->linesize[3] = 0;
-        *data_size           = sizeof(AVPicture);
-    }
-    return avpkt->size;
-}
-
-static av_cold int vp8_free(AVCodecContext *avctx)
-{
-    VP8Context *ctx = avctx->priv_data;
-    vpx_codec_destroy(&ctx->decoder);
-    return 0;
-}
-
-AVCodec libvpx_decoder = {
-    "libvpx",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VP8,
-    sizeof(VP8Context),
-    vp8_init,
-    NULL, /* encode */
-    vp8_free,
-    vp8_decode,
-    0, /* capabilities */
-    .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
-};
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
deleted file mode 100644
index fa393b8..0000000
--- a/libavcodec/libvpxenc.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * Copyright (c) 2010, Google, Inc.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VP8 encoder support via libvpx
- */
-
-#define VPX_DISABLE_CTRL_TYPECHECKS 1
-#define VPX_CODEC_DISABLE_COMPAT    1
-#include <vpx/vpx_encoder.h>
-#include <vpx/vp8cx.h>
-
-#include "avcodec.h"
-#include "libavutil/base64.h"
-
-/**
- * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h.
- * One encoded frame returned from the library.
- */
-struct FrameListData {
-    void *buf;                       /**≤ compressed data buffer */
-    size_t sz;                       /**≤ length of compressed data */
-    int64_t pts;                     /**≤ time stamp to show frame
-                                          (in timebase units) */
-    unsigned long duration;          /**≤ duration to show frame
-                                          (in timebase units) */
-    uint32_t flags;                  /**≤ flags for this frame */
-    struct FrameListData *next;
-};
-
-typedef struct VP8EncoderContext {
-    struct vpx_codec_ctx encoder;
-    struct vpx_image rawimg;
-    struct vpx_fixed_buf twopass_stats;
-    unsigned long deadline; //i.e., RT/GOOD/BEST
-    struct FrameListData *coded_frame_list;
-} VP8Context;
-
-/** String mappings for enum vp8e_enc_control_id */
-static const char *ctlidstr[] = {
-    [VP8E_UPD_ENTROPY]           = "VP8E_UPD_ENTROPY",
-    [VP8E_UPD_REFERENCE]         = "VP8E_UPD_REFERENCE",
-    [VP8E_USE_REFERENCE]         = "VP8E_USE_REFERENCE",
-    [VP8E_SET_ROI_MAP]           = "VP8E_SET_ROI_MAP",
-    [VP8E_SET_ACTIVEMAP]         = "VP8E_SET_ACTIVEMAP",
-    [VP8E_SET_SCALEMODE]         = "VP8E_SET_SCALEMODE",
-    [VP8E_SET_CPUUSED]           = "VP8E_SET_CPUUSED",
-    [VP8E_SET_ENABLEAUTOALTREF]  = "VP8E_SET_ENABLEAUTOALTREF",
-    [VP8E_SET_NOISE_SENSITIVITY] = "VP8E_SET_NOISE_SENSITIVITY",
-    [VP8E_SET_SHARPNESS]         = "VP8E_SET_SHARPNESS",
-    [VP8E_SET_STATIC_THRESHOLD]  = "VP8E_SET_STATIC_THRESHOLD",
-    [VP8E_SET_TOKEN_PARTITIONS]  = "VP8E_SET_TOKEN_PARTITIONS",
-    [VP8E_GET_LAST_QUANTIZER]    = "VP8E_GET_LAST_QUANTIZER",
-    [VP8E_SET_ARNR_MAXFRAMES]    = "VP8E_SET_ARNR_MAXFRAMES",
-    [VP8E_SET_ARNR_STRENGTH]     = "VP8E_SET_ARNR_STRENGTH",
-    [VP8E_SET_ARNR_TYPE]         = "VP8E_SET_ARNR_TYPE",
-};
-
-static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc)
-{
-    VP8Context *ctx = avctx->priv_data;
-    const char *error  = vpx_codec_error(&ctx->encoder);
-    const char *detail = vpx_codec_error_detail(&ctx->encoder);
-
-    av_log(avctx, AV_LOG_ERROR, "%s: %s\n", desc, error);
-    if (detail)
-        av_log(avctx, AV_LOG_ERROR, "  Additional information: %s\n", detail);
-}
-
-static av_cold void dump_enc_cfg(AVCodecContext *avctx,
-                                 const struct vpx_codec_enc_cfg *cfg)
-{
-    int width = -30;
-    int level = AV_LOG_DEBUG;
-
-    av_log(avctx, level, "vpx_codec_enc_cfg\n");
-    av_log(avctx, level, "generic settings\n"
-           "  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n"
-           "  %*s{%u/%u}\n  %*s%u\n  %*s%d\n  %*s%u\n",
-           width, "g_usage:",           cfg->g_usage,
-           width, "g_threads:",         cfg->g_threads,
-           width, "g_profile:",         cfg->g_profile,
-           width, "g_w:",               cfg->g_w,
-           width, "g_h:",               cfg->g_h,
-           width, "g_timebase:",        cfg->g_timebase.num, cfg->g_timebase.den,
-           width, "g_error_resilient:", cfg->g_error_resilient,
-           width, "g_pass:",            cfg->g_pass,
-           width, "g_lag_in_frames:",   cfg->g_lag_in_frames);
-    av_log(avctx, level, "rate control settings\n"
-           "  %*s%u\n  %*s%u\n  %*s%u\n  %*s%u\n"
-           "  %*s%d\n  %*s%p(%zu)\n  %*s%u\n",
-           width, "rc_dropframe_thresh:",   cfg->rc_dropframe_thresh,
-           width, "rc_resize_allowed:",     cfg->rc_resize_allowed,
-           width, "rc_resize_up_thresh:",   cfg->rc_resize_up_thresh,
-           width, "rc_resize_down_thresh:", cfg->rc_resize_down_thresh,
-           width, "rc_end_usage:",          cfg->rc_end_usage,
-           width, "rc_twopass_stats_in:",   cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz,
-           width, "rc_target_bitrate:",     cfg->rc_target_bitrate);
-    av_log(avctx, level, "quantizer settings\n"
-           "  %*s%u\n  %*s%u\n",
-           width, "rc_min_quantizer:", cfg->rc_min_quantizer,
-           width, "rc_max_quantizer:", cfg->rc_max_quantizer);
-    av_log(avctx, level, "bitrate tolerance\n"
-           "  %*s%u\n  %*s%u\n",
-           width, "rc_undershoot_pct:", cfg->rc_undershoot_pct,
-           width, "rc_overshoot_pct:",  cfg->rc_overshoot_pct);
-    av_log(avctx, level, "decoder buffer model\n"
-            "  %*s%u\n  %*s%u\n  %*s%u\n",
-            width, "rc_buf_sz:",         cfg->rc_buf_sz,
-            width, "rc_buf_initial_sz:", cfg->rc_buf_initial_sz,
-            width, "rc_buf_optimal_sz:", cfg->rc_buf_optimal_sz);
-    av_log(avctx, level, "2 pass rate control settings\n"
-           "  %*s%u\n  %*s%u\n  %*s%u\n",
-           width, "rc_2pass_vbr_bias_pct:",       cfg->rc_2pass_vbr_bias_pct,
-           width, "rc_2pass_vbr_minsection_pct:", cfg->rc_2pass_vbr_minsection_pct,
-           width, "rc_2pass_vbr_maxsection_pct:", cfg->rc_2pass_vbr_maxsection_pct);
-    av_log(avctx, level, "keyframing settings\n"
-           "  %*s%d\n  %*s%u\n  %*s%u\n",
-           width, "kf_mode:",     cfg->kf_mode,
-           width, "kf_min_dist:", cfg->kf_min_dist,
-           width, "kf_max_dist:", cfg->kf_max_dist);
-    av_log(avctx, level, "\n");
-}
-
-static void coded_frame_add(void *list, struct FrameListData *cx_frame)
-{
-    struct FrameListData **p = list;
-
-    while (*p != NULL)
-        p = &(*p)->next;
-    *p = cx_frame;
-    cx_frame->next = NULL;
-}
-
-static av_cold void free_coded_frame(struct FrameListData *cx_frame)
-{
-    av_freep(&cx_frame->buf);
-    av_freep(&cx_frame);
-}
-
-static av_cold void free_frame_list(struct FrameListData *list)
-{
-    struct FrameListData *p = list;
-
-    while (p) {
-        list = list->next;
-        free_coded_frame(p);
-        p = list;
-    }
-}
-
-static av_cold int codecctl_int(AVCodecContext *avctx,
-                                enum vp8e_enc_control_id id, int val)
-{
-    VP8Context *ctx = avctx->priv_data;
-    char buf[80];
-    int width = -30;
-    int res;
-
-    snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
-    av_log(avctx, AV_LOG_DEBUG, "  %*s%d\n", width, buf, val);
-
-    res = vpx_codec_control(&ctx->encoder, id, val);
-    if (res != VPX_CODEC_OK) {
-        snprintf(buf, sizeof(buf), "Failed to set %s codec control",
-                 ctlidstr[id]);
-        log_encoder_error(avctx, buf);
-    }
-
-    return res == VPX_CODEC_OK ? 0 : AVERROR(EINVAL);
-}
-
-static av_cold int vp8_free(AVCodecContext *avctx)
-{
-    VP8Context *ctx = avctx->priv_data;
-
-    vpx_codec_destroy(&ctx->encoder);
-    av_freep(&ctx->twopass_stats.buf);
-    av_freep(&avctx->coded_frame);
-    av_freep(&avctx->stats_out);
-    free_frame_list(ctx->coded_frame_list);
-    return 0;
-}
-
-static av_cold int vp8_init(AVCodecContext *avctx)
-{
-    VP8Context *ctx = avctx->priv_data;
-    const struct vpx_codec_iface *iface = &vpx_codec_vp8_cx_algo;
-    int cpuused = 3;
-    struct vpx_codec_enc_cfg enccfg;
-    int res;
-
-    av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
-    av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
-
-    if ((res = vpx_codec_enc_config_default(iface, &enccfg, 0)) != VPX_CODEC_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n",
-               vpx_codec_err_to_string(res));
-        return AVERROR(EINVAL);
-    }
-    dump_enc_cfg(avctx, &enccfg);
-
-    enccfg.g_w            = avctx->width;
-    enccfg.g_h            = avctx->height;
-    enccfg.g_timebase.num = avctx->time_base.num;
-    enccfg.g_timebase.den = avctx->time_base.den;
-    enccfg.g_threads      = avctx->thread_count;
-
-    if (avctx->flags & CODEC_FLAG_PASS1)
-        enccfg.g_pass = VPX_RC_FIRST_PASS;
-    else if (avctx->flags & CODEC_FLAG_PASS2)
-        enccfg.g_pass = VPX_RC_LAST_PASS;
-    else
-        enccfg.g_pass = VPX_RC_ONE_PASS;
-
-    if (avctx->rc_min_rate == avctx->rc_max_rate &&
-        avctx->rc_min_rate == avctx->bit_rate)
-        enccfg.rc_end_usage = VPX_CBR;
-    enccfg.rc_target_bitrate = av_rescale_rnd(avctx->bit_rate, 1, 1000,
-                                              AV_ROUND_NEAR_INF);
-
-    //convert [1,51] -> [0,63]
-    enccfg.rc_min_quantizer = ((avctx->qmin * 5 + 1) >> 2) - 1;
-    enccfg.rc_max_quantizer = ((avctx->qmax * 5 + 1) >> 2) - 1;
-
-    if (avctx->keyint_min == avctx->gop_size)
-        enccfg.kf_mode = VPX_KF_FIXED;
-    //_enc_init() will balk if kf_min_dist is set in this case
-    if (enccfg.kf_mode != VPX_KF_AUTO)
-        enccfg.kf_min_dist = avctx->keyint_min;
-    enccfg.kf_max_dist     = avctx->gop_size;
-
-    if (enccfg.g_pass == VPX_RC_FIRST_PASS)
-        enccfg.g_lag_in_frames = 0;
-    else if (enccfg.g_pass == VPX_RC_LAST_PASS) {
-        int decode_size;
-
-        if (!avctx->stats_in) {
-            av_log(avctx, AV_LOG_ERROR, "No stats file for second pass\n");
-            return AVERROR_INVALIDDATA;
-        }
-
-        ctx->twopass_stats.sz  = strlen(avctx->stats_in) * 3 / 4;
-        ctx->twopass_stats.buf = av_malloc(ctx->twopass_stats.sz);
-        if (!ctx->twopass_stats.buf) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Stat buffer alloc (%zu bytes) failed\n",
-                   ctx->twopass_stats.sz);
-            return AVERROR(ENOMEM);
-        }
-        decode_size = av_base64_decode(ctx->twopass_stats.buf, avctx->stats_in,
-                                       ctx->twopass_stats.sz);
-        if (decode_size < 0) {
-            av_log(avctx, AV_LOG_ERROR, "Stat buffer decode failed\n");
-            return AVERROR_INVALIDDATA;
-        }
-
-        ctx->twopass_stats.sz      = decode_size;
-        enccfg.rc_twopass_stats_in = ctx->twopass_stats;
-    }
-
-    ctx->deadline = VPX_DL_GOOD_QUALITY;
-
-    dump_enc_cfg(avctx, &enccfg);
-    /* Construct Encoder Context */
-    res = vpx_codec_enc_init(&ctx->encoder, iface, &enccfg, 0);
-    if (res != VPX_CODEC_OK) {
-        log_encoder_error(avctx, "Failed to initialize encoder");
-        return AVERROR(EINVAL);
-    }
-
-    //codec control failures are currently treated only as warnings
-    av_log(avctx, AV_LOG_DEBUG, "vpx_codec_control\n");
-    codecctl_int(avctx, VP8E_SET_CPUUSED,           cpuused);
-    codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx->noise_reduction);
-
-    //provide dummy value to initialize wrapper, values will be updated each _encode()
-    vpx_img_wrap(&ctx->rawimg, VPX_IMG_FMT_I420, avctx->width, avctx->height, 1,
-                 (unsigned char*)1);
-
-    avctx->coded_frame = avcodec_alloc_frame();
-    if (!avctx->coded_frame) {
-        av_log(avctx, AV_LOG_ERROR, "Error allocating coded frame\n");
-        vp8_free(avctx);
-        return AVERROR(ENOMEM);
-    }
-    return 0;
-}
-
-static inline void cx_pktcpy(struct FrameListData *dst,
-                             const struct vpx_codec_cx_pkt *src)
-{
-    dst->pts      = src->data.frame.pts;
-    dst->duration = src->data.frame.duration;
-    dst->flags    = src->data.frame.flags;
-    dst->sz       = src->data.frame.sz;
-    dst->buf      = src->data.frame.buf;
-}
-
-/**
- * Store coded frame information in format suitable for return from encode().
- *
- * Write buffer information from @a cx_frame to @a buf & @a buf_size.
- * Timing/frame details to @a coded_frame.
- * @return Frame size written to @a buf on success
- * @return AVERROR(EINVAL) on error
- */
-static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
-                      uint8_t *buf, int buf_size, AVFrame *coded_frame)
-{
-    if ((int) cx_frame->sz <= buf_size) {
-        buf_size = cx_frame->sz;
-        memcpy(buf, cx_frame->buf, buf_size);
-        coded_frame->pts       = cx_frame->pts;
-        coded_frame->key_frame = !!(cx_frame->flags & VPX_FRAME_IS_KEY);
-
-        if (coded_frame->key_frame)
-            coded_frame->pict_type = FF_I_TYPE;
-        else
-            coded_frame->pict_type = FF_P_TYPE;
-    } else {
-        av_log(avctx, AV_LOG_ERROR,
-               "Compressed frame larger than storage provided! (%zu/%d)\n",
-               cx_frame->sz, buf_size);
-        return AVERROR(EINVAL);
-    }
-    return buf_size;
-}
-
-/**
- * Queue multiple output frames from the encoder, returning the front-most.
- * In cases where vpx_codec_get_cx_data() returns more than 1 frame append
- * the frame queue. Return the head frame if available.
- * @return Stored frame size
- * @return AVERROR(EINVAL) on output size error
- * @return AVERROR(ENOMEM) on coded frame queue data allocation error
- */
-static int queue_frames(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                        AVFrame *coded_frame)
-{
-    VP8Context *ctx = avctx->priv_data;
-    const struct vpx_codec_cx_pkt *pkt;
-    const void *iter = NULL;
-    int size = 0;
-
-    if (ctx->coded_frame_list) {
-        struct FrameListData *cx_frame = ctx->coded_frame_list;
-        /* return the leading frame if we've already begun queueing */
-        size = storeframe(avctx, cx_frame, buf, buf_size, coded_frame);
-        if (size < 0)
-            return AVERROR(EINVAL);
-        ctx->coded_frame_list = cx_frame->next;
-        free_coded_frame(cx_frame);
-    }
-
-    /* consume all available output from the encoder before returning. buffers
-       are only good through the next vpx_codec call */
-    while ((pkt = vpx_codec_get_cx_data(&ctx->encoder, &iter))) {
-        switch (pkt->kind) {
-        case VPX_CODEC_CX_FRAME_PKT:
-            if (!size) {
-                struct FrameListData cx_frame;
-
-                /* avoid storing the frame when the list is empty and we haven't yet
-                   provided a frame for output */
-                assert(!ctx->coded_frame_list);
-                cx_pktcpy(&cx_frame, pkt);
-                size = storeframe(avctx, &cx_frame, buf, buf_size, coded_frame);
-                if (size < 0)
-                    return AVERROR(EINVAL);
-            } else {
-                struct FrameListData *cx_frame =
-                    av_malloc(sizeof(struct FrameListData));
-
-                if (!cx_frame) {
-                    av_log(avctx, AV_LOG_ERROR,
-                           "Frame queue element alloc failed\n");
-                    return AVERROR(ENOMEM);
-                }
-                cx_pktcpy(cx_frame, pkt);
-                cx_frame->buf = av_malloc(cx_frame->sz);
-
-                if (!cx_frame->buf) {
-                    av_log(avctx, AV_LOG_ERROR,
-                           "Data buffer alloc (%zu bytes) failed\n",
-                           cx_frame->sz);
-                    return AVERROR(ENOMEM);
-                }
-                memcpy(cx_frame->buf, pkt->data.frame.buf, pkt->data.frame.sz);
-                coded_frame_add(&ctx->coded_frame_list, cx_frame);
-            }
-            break;
-        case VPX_CODEC_STATS_PKT: {
-            struct vpx_fixed_buf *stats = &ctx->twopass_stats;
-            stats->buf = av_realloc(stats->buf,
-                                    stats->sz + pkt->data.twopass_stats.sz);
-            if (!stats->buf) {
-                av_log(avctx, AV_LOG_ERROR, "Stat buffer realloc failed\n");
-                return AVERROR(ENOMEM);
-            }
-            memcpy((uint8_t*)stats->buf + stats->sz,
-                   pkt->data.twopass_stats.buf, pkt->data.twopass_stats.sz);
-            stats->sz += pkt->data.twopass_stats.sz;
-            break;
-        }
-        case VPX_CODEC_PSNR_PKT: //FIXME add support for CODEC_FLAG_PSNR
-        case VPX_CODEC_CUSTOM_PKT:
-            //ignore unsupported/unrecognized packet types
-            break;
-        }
-    }
-
-    return size;
-}
-
-static int vp8_encode(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                      void *data)
-{
-    VP8Context *ctx = avctx->priv_data;
-    AVFrame *frame = data;
-    struct vpx_image *rawimg = NULL;
-    int64_t timestamp = 0;
-    int res, coded_size;
-
-    if (frame) {
-        rawimg                      = &ctx->rawimg;
-        rawimg->planes[VPX_PLANE_Y] = frame->data[0];
-        rawimg->planes[VPX_PLANE_U] = frame->data[1];
-        rawimg->planes[VPX_PLANE_V] = frame->data[2];
-        rawimg->stride[VPX_PLANE_Y] = frame->linesize[0];
-        rawimg->stride[VPX_PLANE_U] = frame->linesize[1];
-        rawimg->stride[VPX_PLANE_V] = frame->linesize[2];
-        timestamp                   = frame->pts;
-    }
-
-    res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,
-                           avctx->ticks_per_frame, 0, ctx->deadline);
-    if (res != VPX_CODEC_OK) {
-        log_encoder_error(avctx, "Error encoding frame");
-        return AVERROR_INVALIDDATA;
-    }
-    coded_size = queue_frames(avctx, buf, buf_size, avctx->coded_frame);
-
-    if (!frame && avctx->flags & CODEC_FLAG_PASS1) {
-        unsigned int b64_size = ((ctx->twopass_stats.sz + 2) / 3) * 4 + 1;
-
-        avctx->stats_out = av_malloc(b64_size);
-        if (!avctx->stats_out) {
-            av_log(avctx, AV_LOG_ERROR, "Stat buffer alloc (%d bytes) failed\n",
-                   b64_size);
-            return AVERROR(ENOMEM);
-        }
-        av_base64_encode(avctx->stats_out, b64_size, ctx->twopass_stats.buf,
-                         ctx->twopass_stats.sz);
-    }
-    return coded_size;
-}
-
-AVCodec libvpx_encoder = {
-    "libvpx",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VP8,
-    sizeof(VP8Context),
-    vp8_init,
-    vp8_encode,
-    vp8_free,
-    NULL,
-    CODEC_CAP_DELAY,
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
-};
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
deleted file mode 100644
index df7b2e8..0000000
--- a/libavcodec/libx264.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * H.264 encoding using the x264 library
- * Copyright (C) 2005  Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include <x264.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-typedef struct X264Context {
-    x264_param_t    params;
-    x264_t         *enc;
-    x264_picture_t  pic;
-    uint8_t        *sei;
-    int             sei_size;
-    AVFrame         out_pic;
-} X264Context;
-
-static void X264_log(void *p, int level, const char *fmt, va_list args)
-{
-    static const int level_map[] = {
-        [X264_LOG_ERROR]   = AV_LOG_ERROR,
-        [X264_LOG_WARNING] = AV_LOG_WARNING,
-        [X264_LOG_INFO]    = AV_LOG_INFO,
-        [X264_LOG_DEBUG]   = AV_LOG_DEBUG
-    };
-
-    if (level < 0 || level > X264_LOG_DEBUG)
-        return;
-
-    av_vlog(p, level_map[level], fmt, args);
-}
-
-
-static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,
-                       x264_nal_t *nals, int nnal, int skip_sei)
-{
-    X264Context *x4 = ctx->priv_data;
-    uint8_t *p = buf;
-    int i;
-
-    /* Write the SEI as part of the first frame. */
-    if (x4->sei_size > 0 && nnal > 0) {
-        memcpy(p, x4->sei, x4->sei_size);
-        p += x4->sei_size;
-        x4->sei_size = 0;
-    }
-
-    for (i = 0; i < nnal; i++){
-        /* Don't put the SEI in extradata. */
-        if (skip_sei && nals[i].i_type == NAL_SEI) {
-            x4->sei_size = nals[i].i_payload;
-            x4->sei      = av_malloc(x4->sei_size);
-            memcpy(x4->sei, nals[i].p_payload, nals[i].i_payload);
-            continue;
-        }
-        memcpy(p, nals[i].p_payload, nals[i].i_payload);
-        p += nals[i].i_payload;
-    }
-
-    return p - buf;
-}
-
-static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
-                      int bufsize, void *data)
-{
-    X264Context *x4 = ctx->priv_data;
-    AVFrame *frame = data;
-    x264_nal_t *nal;
-    int nnal, i;
-    x264_picture_t pic_out;
-
-    x4->pic.img.i_csp   = X264_CSP_I420;
-    x4->pic.img.i_plane = 3;
-
-    if (frame) {
-        for (i = 0; i < 3; i++) {
-            x4->pic.img.plane[i]    = frame->data[i];
-            x4->pic.img.i_stride[i] = frame->linesize[i];
-        }
-
-        x4->pic.i_pts  = frame->pts;
-        x4->pic.i_type = X264_TYPE_AUTO;
-    }
-
-    if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
-        return -1;
-
-    bufsize = encode_nals(ctx, buf, bufsize, nal, nnal, 0);
-    if (bufsize < 0)
-        return -1;
-
-    /* FIXME: libx264 now provides DTS, but AVFrame doesn't have a field for it. */
-    x4->out_pic.pts = pic_out.i_pts;
-
-    switch (pic_out.i_type) {
-    case X264_TYPE_IDR:
-    case X264_TYPE_I:
-        x4->out_pic.pict_type = FF_I_TYPE;
-        break;
-    case X264_TYPE_P:
-        x4->out_pic.pict_type = FF_P_TYPE;
-        break;
-    case X264_TYPE_B:
-    case X264_TYPE_BREF:
-        x4->out_pic.pict_type = FF_B_TYPE;
-        break;
-    }
-
-    x4->out_pic.key_frame = pic_out.b_keyframe;
-    x4->out_pic.quality   = (pic_out.i_qpplus1 - 1) * FF_QP2LAMBDA;
-
-    return bufsize;
-}
-
-static av_cold int X264_close(AVCodecContext *avctx)
-{
-    X264Context *x4 = avctx->priv_data;
-
-    av_freep(&avctx->extradata);
-    av_free(x4->sei);
-
-    if (x4->enc)
-        x264_encoder_close(x4->enc);
-
-    return 0;
-}
-
-static av_cold int X264_init(AVCodecContext *avctx)
-{
-    X264Context *x4 = avctx->priv_data;
-
-    x4->sei_size = 0;
-    x264_param_default(&x4->params);
-
-    x4->params.pf_log               = X264_log;
-    x4->params.p_log_private        = avctx;
-
-    x4->params.i_keyint_max         = avctx->gop_size;
-    x4->params.rc.i_bitrate         = avctx->bit_rate       / 1000;
-    x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
-    x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate    / 1000;
-    x4->params.rc.b_stat_write      = avctx->flags & CODEC_FLAG_PASS1;
-    if (avctx->flags & CODEC_FLAG_PASS2) {
-        x4->params.rc.b_stat_read = 1;
-    } else {
-        if (avctx->crf) {
-            x4->params.rc.i_rc_method   = X264_RC_CRF;
-            x4->params.rc.f_rf_constant = avctx->crf;
-        } else if (avctx->cqp > -1) {
-            x4->params.rc.i_rc_method   = X264_RC_CQP;
-            x4->params.rc.i_qp_constant = avctx->cqp;
-        }
-    }
-
-    // if neither crf nor cqp modes are selected we have to enable the RC
-    // we do it this way because we cannot check if the bitrate has been set
-    if (!(avctx->crf || (avctx->cqp > -1)))
-        x4->params.rc.i_rc_method = X264_RC_ABR;
-
-    x4->params.i_bframe          = avctx->max_b_frames;
-    x4->params.b_cabac           = avctx->coder_type == FF_CODER_TYPE_AC;
-    x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
-    x4->params.i_bframe_bias     = avctx->bframebias;
-    x4->params.i_bframe_pyramid  = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
-    avctx->has_b_frames          = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? 2 : !!avctx->max_b_frames;
-
-    x4->params.i_keyint_min = avctx->keyint_min;
-    if (x4->params.i_keyint_min > x4->params.i_keyint_max)
-        x4->params.i_keyint_min = x4->params.i_keyint_max;
-
-    x4->params.i_scenecut_threshold        = avctx->scenechange_threshold;
-
-    x4->params.b_deblocking_filter         = avctx->flags & CODEC_FLAG_LOOP_FILTER;
-    x4->params.i_deblocking_filter_alphac0 = avctx->deblockalpha;
-    x4->params.i_deblocking_filter_beta    = avctx->deblockbeta;
-
-    x4->params.rc.i_qp_min                 = avctx->qmin;
-    x4->params.rc.i_qp_max                 = avctx->qmax;
-    x4->params.rc.i_qp_step                = avctx->max_qdiff;
-
-    x4->params.rc.f_qcompress       = avctx->qcompress; /* 0.0 => cbr, 1.0 => constant qp */
-    x4->params.rc.f_qblur           = avctx->qblur;     /* temporally blur quants */
-    x4->params.rc.f_complexity_blur = avctx->complexityblur;
-
-    x4->params.i_frame_reference    = avctx->refs;
-
-    x4->params.i_width              = avctx->width;
-    x4->params.i_height             = avctx->height;
-    x4->params.vui.i_sar_width      = avctx->sample_aspect_ratio.num;
-    x4->params.vui.i_sar_height     = avctx->sample_aspect_ratio.den;
-    x4->params.i_fps_num = x4->params.i_timebase_den = avctx->time_base.den;
-    x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num;
-
-    x4->params.analyse.inter    = 0;
-    if (avctx->partitions) {
-        if (avctx->partitions & X264_PART_I4X4)
-            x4->params.analyse.inter |= X264_ANALYSE_I4x4;
-        if (avctx->partitions & X264_PART_I8X8)
-            x4->params.analyse.inter |= X264_ANALYSE_I8x8;
-        if (avctx->partitions & X264_PART_P8X8)
-            x4->params.analyse.inter |= X264_ANALYSE_PSUB16x16;
-        if (avctx->partitions & X264_PART_P4X4)
-            x4->params.analyse.inter |= X264_ANALYSE_PSUB8x8;
-        if (avctx->partitions & X264_PART_B8X8)
-            x4->params.analyse.inter |= X264_ANALYSE_BSUB16x16;
-    }
-
-    x4->params.analyse.i_direct_mv_pred  = avctx->directpred;
-
-    x4->params.analyse.b_weighted_bipred = avctx->flags2 & CODEC_FLAG2_WPRED;
-    x4->params.analyse.i_weighted_pred = avctx->weighted_p_pred;
-
-    if (avctx->me_method == ME_EPZS)
-        x4->params.analyse.i_me_method = X264_ME_DIA;
-    else if (avctx->me_method == ME_HEX)
-        x4->params.analyse.i_me_method = X264_ME_HEX;
-    else if (avctx->me_method == ME_UMH)
-        x4->params.analyse.i_me_method = X264_ME_UMH;
-    else if (avctx->me_method == ME_FULL)
-        x4->params.analyse.i_me_method = X264_ME_ESA;
-    else if (avctx->me_method == ME_TESA)
-        x4->params.analyse.i_me_method = X264_ME_TESA;
-    else x4->params.analyse.i_me_method = X264_ME_HEX;
-
-    x4->params.rc.i_aq_mode               = avctx->aq_mode;
-    x4->params.rc.f_aq_strength           = avctx->aq_strength;
-    x4->params.rc.i_lookahead             = avctx->rc_lookahead;
-
-    x4->params.analyse.b_psy              = avctx->flags2 & CODEC_FLAG2_PSY;
-    x4->params.analyse.f_psy_rd           = avctx->psy_rd;
-    x4->params.analyse.f_psy_trellis      = avctx->psy_trellis;
-
-    x4->params.analyse.i_me_range         = avctx->me_range;
-    x4->params.analyse.i_subpel_refine    = avctx->me_subpel_quality;
-
-    x4->params.analyse.b_mixed_references = avctx->flags2 & CODEC_FLAG2_MIXED_REFS;
-    x4->params.analyse.b_chroma_me        = avctx->me_cmp & FF_CMP_CHROMA;
-    x4->params.analyse.b_transform_8x8    = avctx->flags2 & CODEC_FLAG2_8X8DCT;
-    x4->params.analyse.b_fast_pskip       = avctx->flags2 & CODEC_FLAG2_FASTPSKIP;
-
-    x4->params.analyse.i_trellis          = avctx->trellis;
-    x4->params.analyse.i_noise_reduction  = avctx->noise_reduction;
-
-    if (avctx->level > 0)
-        x4->params.i_level_idc = avctx->level;
-
-    x4->params.rc.f_rate_tolerance =
-        (float)avctx->bit_rate_tolerance/avctx->bit_rate;
-
-    if ((avctx->rc_buffer_size != 0) &&
-        (avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
-        x4->params.rc.f_vbv_buffer_init =
-            (float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
-    } else
-        x4->params.rc.f_vbv_buffer_init = 0.9;
-
-    x4->params.rc.b_mb_tree               = !!(avctx->flags2 & CODEC_FLAG2_MBTREE);
-    x4->params.rc.f_ip_factor             = 1 / fabs(avctx->i_quant_factor);
-    x4->params.rc.f_pb_factor             = avctx->b_quant_factor;
-    x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
-
-    x4->params.analyse.b_psnr = avctx->flags & CODEC_FLAG_PSNR;
-    x4->params.analyse.b_ssim = avctx->flags2 & CODEC_FLAG2_SSIM;
-    x4->params.i_log_level    = X264_LOG_DEBUG;
-
-    x4->params.b_aud          = avctx->flags2 & CODEC_FLAG2_AUD;
-
-    x4->params.i_threads      = avctx->thread_count;
-
-    x4->params.b_interlaced   = avctx->flags & CODEC_FLAG_INTERLACED_DCT;
-
-    if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
-        x4->params.b_repeat_headers = 0;
-
-    x4->enc = x264_encoder_open(&x4->params);
-    if (!x4->enc)
-        return -1;
-
-    avctx->coded_frame = &x4->out_pic;
-
-    if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
-        x264_nal_t *nal;
-        int nnal, s, i;
-
-        s = x264_encoder_headers(x4->enc, &nal, &nnal);
-
-        for (i = 0; i < nnal; i++)
-            if (nal[i].i_type == NAL_SEI)
-                av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25);
-
-        avctx->extradata      = av_malloc(s);
-        avctx->extradata_size = encode_nals(avctx, avctx->extradata, s, nal, nnal, 1);
-    }
-
-    return 0;
-}
-
-AVCodec libx264_encoder = {
-    .name           = "libx264",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_H264,
-    .priv_data_size = sizeof(X264Context),
-    .init           = X264_init,
-    .encode         = X264_frame,
-    .close          = X264_close,
-    .capabilities   = CODEC_CAP_DELAY,
-    .pix_fmts       = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_NONE },
-    .long_name      = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
-};
diff --git a/libavcodec/libxvid_internal.h b/libavcodec/libxvid_internal.h
deleted file mode 100644
index ffa5cf8..0000000
--- a/libavcodec/libxvid_internal.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * copyright (C) 2006 Corey Hickey
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_LIBXVID_INTERNAL_H
-#define AVCODEC_LIBXVID_INTERNAL_H
-
-/**
- * @file
- * common functions for use with the Xvid wrappers
- */
-
-
-int av_tempfile(char *prefix, char **filename);
-
-#endif /* AVCODEC_LIBXVID_INTERNAL_H */
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
deleted file mode 100644
index c161ba7..0000000
--- a/libavcodec/libxvid_rc.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Xvid rate control wrapper for lavc video encoders
- *
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <xvid.h>
-#include <unistd.h>
-#include "avcodec.h"
-#include "libxvid_internal.h"
-//#include "dsputil.h"
-#include "mpegvideo.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-extern unsigned int xvid_debug;
-
-int ff_xvid_rate_control_init(MpegEncContext *s){
-    char *tmp_name;
-    int fd, i;
-    xvid_plg_create_t xvid_plg_create;
-    xvid_plugin_2pass2_t xvid_2pass2;
-
-//xvid_debug=-1;
-
-    fd=av_tempfile("xvidrc.", &tmp_name);
-    if (fd == -1) {
-        av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n");
-        return -1;
-    }
-
-    for(i=0; i<s->rc_context.num_entries; i++){
-        static const char *frame_types = " ipbs";
-        char tmp[256];
-        RateControlEntry *rce;
-
-        rce= &s->rc_context.entry[i];
-
-        snprintf(tmp, sizeof(tmp), "%c %d %d %d %d %d %d\n",
-            frame_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, s->mb_num - rce->i_count - rce->skip_count,
-            rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8);
-
-//av_log(NULL, AV_LOG_ERROR, "%s\n", tmp);
-        write(fd, tmp, strlen(tmp));
-    }
-
-    close(fd);
-
-    memset(&xvid_2pass2, 0, sizeof(xvid_2pass2));
-    xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0);
-    xvid_2pass2.filename= tmp_name;
-    xvid_2pass2.bitrate= s->avctx->bit_rate;
-    xvid_2pass2.vbv_size= s->avctx->rc_buffer_size;
-    xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate;
-    xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy;
-
-    memset(&xvid_plg_create, 0, sizeof(xvid_plg_create));
-    xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0);
-    xvid_plg_create.fbase= s->avctx->time_base.den;
-    xvid_plg_create.fincr= s->avctx->time_base.num;
-    xvid_plg_create.param= &xvid_2pass2;
-
-    if(xvid_plugin_2pass2(NULL, XVID_PLG_CREATE, &xvid_plg_create, &s->rc_context.non_lavc_opaque)<0){
-        av_log(NULL, AV_LOG_ERROR, "xvid_plugin_2pass2 failed\n");
-        return -1;
-    }
-    return 0;
-}
-
-float ff_xvid_rate_estimate_qscale(MpegEncContext *s, int dry_run){
-    xvid_plg_data_t xvid_plg_data;
-
-    memset(&xvid_plg_data, 0, sizeof(xvid_plg_data));
-    xvid_plg_data.version= XVID_MAKE_VERSION(1,1,0);
-    xvid_plg_data.width = s->width;
-    xvid_plg_data.height= s->height;
-    xvid_plg_data.mb_width = s->mb_width;
-    xvid_plg_data.mb_height= s->mb_height;
-    xvid_plg_data.fbase= s->avctx->time_base.den;
-    xvid_plg_data.fincr= s->avctx->time_base.num;
-    xvid_plg_data.min_quant[0]= s->avctx->qmin;
-    xvid_plg_data.min_quant[1]= s->avctx->qmin;
-    xvid_plg_data.min_quant[2]= s->avctx->qmin; //FIXME i/b factor & offset
-    xvid_plg_data.max_quant[0]= s->avctx->qmax;
-    xvid_plg_data.max_quant[1]= s->avctx->qmax;
-    xvid_plg_data.max_quant[2]= s->avctx->qmax; //FIXME i/b factor & offset
-    xvid_plg_data.bquant_offset = 0; //  100 * s->avctx->b_quant_offset;
-    xvid_plg_data.bquant_ratio = 100; // * s->avctx->b_quant_factor;
-
-#if 0
-    xvid_plg_data.stats.hlength= X
-#endif
-
-    if(!s->rc_context.dry_run_qscale){
-        if(s->picture_number){
-            xvid_plg_data.length=
-            xvid_plg_data.stats.length= (s->frame_bits + 7)/8;
-            xvid_plg_data.frame_num= s->rc_context.last_picture_number;
-            xvid_plg_data.quant= s->qscale;
-
-            xvid_plg_data.type= s->last_pict_type;
-            if(xvid_plugin_2pass2(s->rc_context.non_lavc_opaque, XVID_PLG_AFTER, &xvid_plg_data, NULL)){
-                av_log(s->avctx, AV_LOG_ERROR, "xvid_plugin_2pass2(handle, XVID_PLG_AFTER, ...) FAILED\n");
-                return -1;
-            }
-        }
-        s->rc_context.last_picture_number=
-        xvid_plg_data.frame_num= s->picture_number;
-        xvid_plg_data.quant= 0;
-        if(xvid_plugin_2pass2(s->rc_context.non_lavc_opaque, XVID_PLG_BEFORE, &xvid_plg_data, NULL)){
-            av_log(s->avctx, AV_LOG_ERROR, "xvid_plugin_2pass2(handle, XVID_PLG_BEFORE, ...) FAILED\n");
-            return -1;
-        }
-        s->rc_context.dry_run_qscale= xvid_plg_data.quant;
-    }
-    xvid_plg_data.quant= s->rc_context.dry_run_qscale;
-    if(!dry_run)
-        s->rc_context.dry_run_qscale= 0;
-
-    if(s->pict_type == FF_B_TYPE) //FIXME this is not exactly identical to xvid
-        return xvid_plg_data.quant * FF_QP2LAMBDA * s->avctx->b_quant_factor + s->avctx->b_quant_offset;
-    else
-        return xvid_plg_data.quant * FF_QP2LAMBDA;
-}
-
-void ff_xvid_rate_control_uninit(MpegEncContext *s){
-    xvid_plg_destroy_t xvid_plg_destroy;
-
-    xvid_plugin_2pass2(s->rc_context.non_lavc_opaque, XVID_PLG_DESTROY, &xvid_plg_destroy, NULL);
-}
-
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
deleted file mode 100644
index 2a404cd..0000000
--- a/libavcodec/libxvidff.c
+++ /dev/null
@@ -1,780 +0,0 @@
-/*
- * Interface to xvidcore for mpeg4 encoding
- * Copyright (c) 2004 Adam Thayer <krevnik at comcast.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Interface to xvidcore for MPEG-4 compliant encoding.
- * @author Adam Thayer (krevnik at comcast.net)
- */
-
-#include <xvid.h>
-#include <unistd.h>
-#include "avcodec.h"
-#include "libavutil/intreadwrite.h"
-#include "libxvid_internal.h"
-
-/**
- * Buffer management macros.
- */
-#define BUFFER_SIZE                 1024
-#define BUFFER_REMAINING(x)         (BUFFER_SIZE - strlen(x))
-#define BUFFER_CAT(x)               (&((x)[strlen(x)]))
-
-/* For PPC Use */
-int has_altivec(void);
-
-/**
- * Structure for the private Xvid context.
- * This stores all the private context for the codec.
- */
-struct xvid_context {
-    void *encoder_handle;          /** Handle for Xvid encoder */
-    int xsize, ysize;              /** Frame size */
-    int vop_flags;                 /** VOP flags for Xvid encoder */
-    int vol_flags;                 /** VOL flags for Xvid encoder */
-    int me_flags;                  /** Motion Estimation flags */
-    int qscale;                    /** Do we use constant scale? */
-    int quicktime_format;          /** Are we in a QT-based format? */
-    AVFrame encoded_picture;       /** Encoded frame information */
-    char *twopassbuffer;           /** Character buffer for two-pass */
-    char *old_twopassbuffer;       /** Old character buffer (two-pass) */
-    char *twopassfile;             /** second pass temp file name */
-    unsigned char *intra_matrix;   /** P-Frame Quant Matrix */
-    unsigned char *inter_matrix;   /** I-Frame Quant Matrix */
-};
-
-/**
- * Structure for the private first-pass plugin.
- */
-struct xvid_ff_pass1 {
-    int     version;                /** Xvid version */
-    struct xvid_context *context;        /** Pointer to private context */
-};
-
-/* Prototypes - See function implementation for details */
-int xvid_strip_vol_header(AVCodecContext *avctx, unsigned char *frame, unsigned int header_len, unsigned int frame_len);
-int xvid_ff_2pass(void *ref, int opt, void *p1, void *p2);
-void xvid_correct_framerate(AVCodecContext *avctx);
-
-/**
- * Creates the private context for the encoder.
- * All buffers are allocated, settings are loaded from the user,
- * and the encoder context created.
- *
- * @param avctx AVCodecContext pointer to context
- * @return Returns 0 on success, -1 on failure
- */
-static av_cold int xvid_encode_init(AVCodecContext *avctx)  {
-    int xerr, i;
-    int xvid_flags = avctx->flags;
-    struct xvid_context *x = avctx->priv_data;
-    uint16_t *intra, *inter;
-    int fd;
-
-    xvid_plugin_single_t single;
-    struct xvid_ff_pass1 rc2pass1;
-    xvid_plugin_2pass2_t rc2pass2;
-    xvid_gbl_init_t xvid_gbl_init;
-    xvid_enc_create_t xvid_enc_create;
-    xvid_enc_plugin_t plugins[7];
-
-    /* Bring in VOP flags from ffmpeg command-line */
-    x->vop_flags = XVID_VOP_HALFPEL; /* Bare minimum quality */
-    if( xvid_flags & CODEC_FLAG_4MV )
-        x->vop_flags |= XVID_VOP_INTER4V; /* Level 3 */
-    if( avctx->trellis
-        )
-        x->vop_flags |= XVID_VOP_TRELLISQUANT; /* Level 5 */
-    if( xvid_flags & CODEC_FLAG_AC_PRED )
-        x->vop_flags |= XVID_VOP_HQACPRED; /* Level 6 */
-    if( xvid_flags & CODEC_FLAG_GRAY )
-        x->vop_flags |= XVID_VOP_GREYSCALE;
-
-    /* Decide which ME quality setting to use */
-    x->me_flags = 0;
-    switch( avctx->me_method ) {
-       case ME_FULL:   /* Quality 6 */
-           x->me_flags |=  XVID_ME_EXTSEARCH16
-                       |   XVID_ME_EXTSEARCH8;
-
-       case ME_EPZS:   /* Quality 4 */
-           x->me_flags |=  XVID_ME_ADVANCEDDIAMOND8
-                       |   XVID_ME_HALFPELREFINE8
-                       |   XVID_ME_CHROMA_PVOP
-                       |   XVID_ME_CHROMA_BVOP;
-
-       case ME_LOG:    /* Quality 2 */
-       case ME_PHODS:
-       case ME_X1:
-           x->me_flags |=  XVID_ME_ADVANCEDDIAMOND16
-                       |   XVID_ME_HALFPELREFINE16;
-
-       case ME_ZERO:   /* Quality 0 */
-       default:
-           break;
-    }
-
-    /* Decide how we should decide blocks */
-    switch( avctx->mb_decision ) {
-       case 2:
-           x->vop_flags |= XVID_VOP_MODEDECISION_RD;
-           x->me_flags |=  XVID_ME_HALFPELREFINE8_RD
-                       |   XVID_ME_QUARTERPELREFINE8_RD
-                       |   XVID_ME_EXTSEARCH_RD
-                       |   XVID_ME_CHECKPREDICTION_RD;
-       case 1:
-           if( !(x->vop_flags & XVID_VOP_MODEDECISION_RD) )
-               x->vop_flags |= XVID_VOP_FAST_MODEDECISION_RD;
-           x->me_flags |=  XVID_ME_HALFPELREFINE16_RD
-                       |   XVID_ME_QUARTERPELREFINE16_RD;
-
-       default:
-           break;
-    }
-
-    /* Bring in VOL flags from ffmpeg command-line */
-    x->vol_flags = 0;
-    if( xvid_flags & CODEC_FLAG_GMC ) {
-        x->vol_flags |= XVID_VOL_GMC;
-        x->me_flags |= XVID_ME_GME_REFINE;
-    }
-    if( xvid_flags & CODEC_FLAG_QPEL ) {
-        x->vol_flags |= XVID_VOL_QUARTERPEL;
-        x->me_flags |= XVID_ME_QUARTERPELREFINE16;
-        if( x->vop_flags & XVID_VOP_INTER4V )
-            x->me_flags |= XVID_ME_QUARTERPELREFINE8;
-    }
-
-    memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init));
-    xvid_gbl_init.version = XVID_VERSION;
-    xvid_gbl_init.debug = 0;
-
-#if ARCH_PPC
-    /* Xvid's PPC support is borked, use libavcodec to detect */
-#if HAVE_ALTIVEC
-    if( has_altivec() ) {
-        xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_ALTIVEC;
-    } else
-#endif
-        xvid_gbl_init.cpu_flags = XVID_CPU_FORCE;
-#else
-    /* Xvid can detect on x86 */
-    xvid_gbl_init.cpu_flags = 0;
-#endif
-
-    /* Initialize */
-    xvid_global(NULL, XVID_GBL_INIT, &xvid_gbl_init, NULL);
-
-    /* Create the encoder reference */
-    memset(&xvid_enc_create, 0, sizeof(xvid_enc_create));
-    xvid_enc_create.version = XVID_VERSION;
-
-    /* Store the desired frame size */
-    xvid_enc_create.width = x->xsize = avctx->width;
-    xvid_enc_create.height = x->ysize = avctx->height;
-
-    /* Xvid can determine the proper profile to use */
-    /* xvid_enc_create.profile = XVID_PROFILE_S_L3; */
-
-    /* We don't use zones */
-    xvid_enc_create.zones = NULL;
-    xvid_enc_create.num_zones = 0;
-
-    xvid_enc_create.num_threads = avctx->thread_count;
-
-    xvid_enc_create.plugins = plugins;
-    xvid_enc_create.num_plugins = 0;
-
-    /* Initialize Buffers */
-    x->twopassbuffer = NULL;
-    x->old_twopassbuffer = NULL;
-    x->twopassfile = NULL;
-
-    if( xvid_flags & CODEC_FLAG_PASS1 ) {
-        memset(&rc2pass1, 0, sizeof(struct xvid_ff_pass1));
-        rc2pass1.version = XVID_VERSION;
-        rc2pass1.context = x;
-        x->twopassbuffer = av_malloc(BUFFER_SIZE);
-        x->old_twopassbuffer = av_malloc(BUFFER_SIZE);
-        if( x->twopassbuffer == NULL || x->old_twopassbuffer == NULL ) {
-            av_log(avctx, AV_LOG_ERROR,
-                "Xvid: Cannot allocate 2-pass log buffers\n");
-            return -1;
-        }
-        x->twopassbuffer[0] = x->old_twopassbuffer[0] = 0;
-
-        plugins[xvid_enc_create.num_plugins].func = xvid_ff_2pass;
-        plugins[xvid_enc_create.num_plugins].param = &rc2pass1;
-        xvid_enc_create.num_plugins++;
-    } else if( xvid_flags & CODEC_FLAG_PASS2 ) {
-        memset(&rc2pass2, 0, sizeof(xvid_plugin_2pass2_t));
-        rc2pass2.version = XVID_VERSION;
-        rc2pass2.bitrate = avctx->bit_rate;
-
-        fd = av_tempfile("xvidff.", &(x->twopassfile));
-        if( fd == -1 ) {
-            av_log(avctx, AV_LOG_ERROR,
-                "Xvid: Cannot write 2-pass pipe\n");
-            return -1;
-        }
-
-        if( avctx->stats_in == NULL ) {
-            av_log(avctx, AV_LOG_ERROR,
-                "Xvid: No 2-pass information loaded for second pass\n");
-            return -1;
-        }
-
-        if( strlen(avctx->stats_in) >
-              write(fd, avctx->stats_in, strlen(avctx->stats_in)) ) {
-            close(fd);
-            av_log(avctx, AV_LOG_ERROR,
-                "Xvid: Cannot write to 2-pass pipe\n");
-            return -1;
-        }
-
-        close(fd);
-        rc2pass2.filename = x->twopassfile;
-        plugins[xvid_enc_create.num_plugins].func = xvid_plugin_2pass2;
-        plugins[xvid_enc_create.num_plugins].param = &rc2pass2;
-        xvid_enc_create.num_plugins++;
-    } else if( !(xvid_flags & CODEC_FLAG_QSCALE) ) {
-        /* Single Pass Bitrate Control! */
-        memset(&single, 0, sizeof(xvid_plugin_single_t));
-        single.version = XVID_VERSION;
-        single.bitrate = avctx->bit_rate;
-
-        plugins[xvid_enc_create.num_plugins].func = xvid_plugin_single;
-        plugins[xvid_enc_create.num_plugins].param = &single;
-        xvid_enc_create.num_plugins++;
-    }
-
-    /* Luminance Masking */
-    if( 0.0 != avctx->lumi_masking ) {
-        plugins[xvid_enc_create.num_plugins].func = xvid_plugin_lumimasking;
-        plugins[xvid_enc_create.num_plugins].param = NULL;
-        xvid_enc_create.num_plugins++;
-    }
-
-    /* Frame Rate and Key Frames */
-    xvid_correct_framerate(avctx);
-    xvid_enc_create.fincr = avctx->time_base.num;
-    xvid_enc_create.fbase = avctx->time_base.den;
-    if( avctx->gop_size > 0 )
-        xvid_enc_create.max_key_interval = avctx->gop_size;
-    else
-        xvid_enc_create.max_key_interval = 240; /* Xvid's best default */
-
-    /* Quants */
-    if( xvid_flags & CODEC_FLAG_QSCALE ) x->qscale = 1;
-    else x->qscale = 0;
-
-    xvid_enc_create.min_quant[0] = avctx->qmin;
-    xvid_enc_create.min_quant[1] = avctx->qmin;
-    xvid_enc_create.min_quant[2] = avctx->qmin;
-    xvid_enc_create.max_quant[0] = avctx->qmax;
-    xvid_enc_create.max_quant[1] = avctx->qmax;
-    xvid_enc_create.max_quant[2] = avctx->qmax;
-
-    /* Quant Matrices */
-    x->intra_matrix = x->inter_matrix = NULL;
-    if( avctx->mpeg_quant )
-       x->vol_flags |= XVID_VOL_MPEGQUANT;
-    if( (avctx->intra_matrix || avctx->inter_matrix) ) {
-       x->vol_flags |= XVID_VOL_MPEGQUANT;
-
-       if( avctx->intra_matrix ) {
-           intra = avctx->intra_matrix;
-           x->intra_matrix = av_malloc(sizeof(unsigned char) * 64);
-       } else
-           intra = NULL;
-       if( avctx->inter_matrix ) {
-           inter = avctx->inter_matrix;
-           x->inter_matrix = av_malloc(sizeof(unsigned char) * 64);
-       } else
-           inter = NULL;
-
-       for( i = 0; i < 64; i++ ) {
-           if( intra )
-               x->intra_matrix[i] = (unsigned char)intra[i];
-           if( inter )
-               x->inter_matrix[i] = (unsigned char)inter[i];
-       }
-    }
-
-    /* Misc Settings */
-    xvid_enc_create.frame_drop_ratio = 0;
-    xvid_enc_create.global = 0;
-    if( xvid_flags & CODEC_FLAG_CLOSED_GOP )
-        xvid_enc_create.global |= XVID_GLOBAL_CLOSED_GOP;
-
-    /* Determines which codec mode we are operating in */
-    avctx->extradata = NULL;
-    avctx->extradata_size = 0;
-    if( xvid_flags & CODEC_FLAG_GLOBAL_HEADER ) {
-        /* In this case, we are claiming to be MPEG4 */
-        x->quicktime_format = 1;
-        avctx->codec_id = CODEC_ID_MPEG4;
-    } else {
-        /* We are claiming to be Xvid */
-        x->quicktime_format = 0;
-        if(!avctx->codec_tag)
-            avctx->codec_tag = AV_RL32("xvid");
-    }
-
-    /* Bframes */
-    xvid_enc_create.max_bframes = avctx->max_b_frames;
-    xvid_enc_create.bquant_offset = 100 * avctx->b_quant_offset;
-    xvid_enc_create.bquant_ratio = 100 * avctx->b_quant_factor;
-    if( avctx->max_b_frames > 0  && !x->quicktime_format ) xvid_enc_create.global |= XVID_GLOBAL_PACKED;
-
-    /* Create encoder context */
-    xerr = xvid_encore(NULL, XVID_ENC_CREATE, &xvid_enc_create, NULL);
-    if( xerr ) {
-        av_log(avctx, AV_LOG_ERROR, "Xvid: Could not create encoder reference\n");
-        return -1;
-    }
-
-    x->encoder_handle = xvid_enc_create.handle;
-    avctx->coded_frame = &x->encoded_picture;
-
-    return 0;
-}
-
-/**
- * Encodes a single frame.
- *
- * @param avctx AVCodecContext pointer to context
- * @param frame Pointer to encoded frame buffer
- * @param buf_size Size of encoded frame buffer
- * @param data Pointer to AVFrame of unencoded frame
- * @return Returns 0 on success, -1 on failure
- */
-static int xvid_encode_frame(AVCodecContext *avctx,
-                         unsigned char *frame, int buf_size, void *data) {
-    int xerr, i;
-    char *tmp;
-    struct xvid_context *x = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame *p = &(x->encoded_picture);
-
-    xvid_enc_frame_t xvid_enc_frame;
-    xvid_enc_stats_t xvid_enc_stats;
-
-    /* Start setting up the frame */
-    memset(&xvid_enc_frame, 0, sizeof(xvid_enc_frame));
-    xvid_enc_frame.version = XVID_VERSION;
-    memset(&xvid_enc_stats, 0, sizeof(xvid_enc_stats));
-    xvid_enc_stats.version = XVID_VERSION;
-    *p = *picture;
-
-    /* Let Xvid know where to put the frame. */
-    xvid_enc_frame.bitstream = frame;
-    xvid_enc_frame.length = buf_size;
-
-    /* Initialize input image fields */
-    if( avctx->pix_fmt != PIX_FMT_YUV420P ) {
-        av_log(avctx, AV_LOG_ERROR, "Xvid: Color spaces other than 420p not supported\n");
-        return -1;
-    }
-
-    xvid_enc_frame.input.csp = XVID_CSP_PLANAR; /* YUV420P */
-
-    for( i = 0; i < 4; i++ ) {
-        xvid_enc_frame.input.plane[i] = picture->data[i];
-        xvid_enc_frame.input.stride[i] = picture->linesize[i];
-    }
-
-    /* Encoder Flags */
-    xvid_enc_frame.vop_flags = x->vop_flags;
-    xvid_enc_frame.vol_flags = x->vol_flags;
-    xvid_enc_frame.motion = x->me_flags;
-    xvid_enc_frame.type = XVID_TYPE_AUTO;
-
-    /* Pixel aspect ratio setting */
-    if (avctx->sample_aspect_ratio.num < 1 || avctx->sample_aspect_ratio.num > 255 ||
-        avctx->sample_aspect_ratio.den < 1 || avctx->sample_aspect_ratio.den > 255) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i\n",
-               avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
-        return -1;
-    }
-    xvid_enc_frame.par = XVID_PAR_EXT;
-    xvid_enc_frame.par_width  = avctx->sample_aspect_ratio.num;
-    xvid_enc_frame.par_height = avctx->sample_aspect_ratio.den;
-
-    /* Quant Setting */
-    if( x->qscale ) xvid_enc_frame.quant = picture->quality / FF_QP2LAMBDA;
-    else xvid_enc_frame.quant = 0;
-
-    /* Matrices */
-    xvid_enc_frame.quant_intra_matrix = x->intra_matrix;
-    xvid_enc_frame.quant_inter_matrix = x->inter_matrix;
-
-    /* Encode */
-    xerr = xvid_encore(x->encoder_handle, XVID_ENC_ENCODE,
-        &xvid_enc_frame, &xvid_enc_stats);
-
-    /* Two-pass log buffer swapping */
-    avctx->stats_out = NULL;
-    if( x->twopassbuffer ) {
-        tmp = x->old_twopassbuffer;
-        x->old_twopassbuffer = x->twopassbuffer;
-        x->twopassbuffer = tmp;
-        x->twopassbuffer[0] = 0;
-        if( x->old_twopassbuffer[0] != 0 ) {
-            avctx->stats_out = x->old_twopassbuffer;
-        }
-    }
-
-    if( 0 <= xerr ) {
-        p->quality = xvid_enc_stats.quant * FF_QP2LAMBDA;
-        if( xvid_enc_stats.type == XVID_TYPE_PVOP )
-            p->pict_type = FF_P_TYPE;
-        else if( xvid_enc_stats.type == XVID_TYPE_BVOP )
-            p->pict_type = FF_B_TYPE;
-        else if( xvid_enc_stats.type == XVID_TYPE_SVOP )
-            p->pict_type = FF_S_TYPE;
-        else
-            p->pict_type = FF_I_TYPE;
-        if( xvid_enc_frame.out_flags & XVID_KEYFRAME ) {
-            p->key_frame = 1;
-            if( x->quicktime_format )
-                return xvid_strip_vol_header(avctx, frame,
-                    xvid_enc_stats.hlength, xerr);
-         } else
-            p->key_frame = 0;
-
-        return xerr;
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "Xvid: Encoding Error Occurred: %i\n", xerr);
-        return -1;
-    }
-}
-
-/**
- * Destroys the private context for the encoder.
- * All buffers are freed, and the Xvid encoder context is destroyed.
- *
- * @param avctx AVCodecContext pointer to context
- * @return Returns 0, success guaranteed
- */
-static av_cold int xvid_encode_close(AVCodecContext *avctx) {
-    struct xvid_context *x = avctx->priv_data;
-
-    xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
-
-    if( avctx->extradata != NULL )
-        av_freep(&avctx->extradata);
-    if( x->twopassbuffer != NULL ) {
-        av_free(x->twopassbuffer);
-        av_free(x->old_twopassbuffer);
-    }
-    if( x->twopassfile != NULL )
-        av_free(x->twopassfile);
-    if( x->intra_matrix != NULL )
-        av_free(x->intra_matrix);
-    if( x->inter_matrix != NULL )
-        av_free(x->inter_matrix);
-
-    return 0;
-}
-
-/**
- * Routine to create a global VO/VOL header for MP4 container.
- * What we do here is extract the header from the Xvid bitstream
- * as it is encoded. We also strip the repeated headers from the
- * bitstream when a global header is requested for MPEG-4 ISO
- * compliance.
- *
- * @param avctx AVCodecContext pointer to context
- * @param frame Pointer to encoded frame data
- * @param header_len Length of header to search
- * @param frame_len Length of encoded frame data
- * @return Returns new length of frame data
- */
-int xvid_strip_vol_header(AVCodecContext *avctx,
-                  unsigned char *frame,
-                  unsigned int header_len,
-                  unsigned int frame_len) {
-    int vo_len = 0, i;
-
-    for( i = 0; i < header_len - 3; i++ ) {
-        if( frame[i] == 0x00 &&
-            frame[i+1] == 0x00 &&
-            frame[i+2] == 0x01 &&
-            frame[i+3] == 0xB6 ) {
-            vo_len = i;
-            break;
-        }
-    }
-
-    if( vo_len > 0 ) {
-        /* We need to store the header, so extract it */
-        if( avctx->extradata == NULL ) {
-            avctx->extradata = av_malloc(vo_len);
-            memcpy(avctx->extradata, frame, vo_len);
-            avctx->extradata_size = vo_len;
-        }
-        /* Less dangerous now, memmove properly copies the two
-           chunks of overlapping data */
-        memmove(frame, &(frame[vo_len]), frame_len - vo_len);
-        return frame_len - vo_len;
-    } else
-        return frame_len;
-}
-
-/**
- * Routine to correct a possibly erroneous framerate being fed to us.
- * Xvid currently chokes on framerates where the ticks per frame is
- * extremely large. This function works to correct problems in this area
- * by estimating a new framerate and taking the simpler fraction of
- * the two presented.
- *
- * @param avctx Context that contains the framerate to correct.
- */
-void xvid_correct_framerate(AVCodecContext *avctx) {
-    int frate, fbase;
-    int est_frate, est_fbase;
-    int gcd;
-    float est_fps, fps;
-
-    frate = avctx->time_base.den;
-    fbase = avctx->time_base.num;
-
-    gcd = av_gcd(frate, fbase);
-    if( gcd > 1 ) {
-        frate /= gcd;
-        fbase /= gcd;
-    }
-
-    if( frate <= 65000 && fbase <= 65000 ) {
-        avctx->time_base.den = frate;
-        avctx->time_base.num = fbase;
-        return;
-    }
-
-    fps = (float)frate / (float)fbase;
-    est_fps = roundf(fps * 1000.0) / 1000.0;
-
-    est_frate = (int)est_fps;
-    if( est_fps > (int)est_fps ) {
-        est_frate = (est_frate + 1) * 1000;
-        est_fbase = (int)roundf((float)est_frate / est_fps);
-    } else
-        est_fbase = 1;
-
-    gcd = av_gcd(est_frate, est_fbase);
-    if( gcd > 1 ) {
-        est_frate /= gcd;
-        est_fbase /= gcd;
-    }
-
-    if( fbase > est_fbase ) {
-        avctx->time_base.den = est_frate;
-        avctx->time_base.num = est_fbase;
-        av_log(avctx, AV_LOG_DEBUG,
-            "Xvid: framerate re-estimated: %.2f, %.3f%% correction\n",
-            est_fps, (((est_fps - fps)/fps) * 100.0));
-    } else {
-        avctx->time_base.den = frate;
-        avctx->time_base.num = fbase;
-    }
-}
-
-/*
- * Xvid 2-Pass Kludge Section
- *
- * Xvid's default 2-pass doesn't allow us to create data as we need to, so
- * this section spends time replacing the first pass plugin so we can write
- * statistic information as libavcodec requests in. We have another kludge
- * that allows us to pass data to the second pass in Xvid without a custom
- * rate-control plugin.
- */
-
-/**
- * Initializes the two-pass plugin and context.
- *
- * @param param Input construction parameter structure
- * @param handle Private context handle
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success.
- */
-static int xvid_ff_2pass_create(xvid_plg_create_t * param,
-                                void ** handle) {
-    struct xvid_ff_pass1 *x = (struct xvid_ff_pass1 *)param->param;
-    char *log = x->context->twopassbuffer;
-
-    /* Do a quick bounds check */
-    if( log == NULL )
-        return XVID_ERR_FAIL;
-
-    /* We use snprintf() */
-    /* This is because we can safely prevent a buffer overflow */
-    log[0] = 0;
-    snprintf(log, BUFFER_REMAINING(log),
-        "# ffmpeg 2-pass log file, using xvid codec\n");
-    snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
-        "# Do not modify. libxvidcore version: %d.%d.%d\n\n",
-        XVID_VERSION_MAJOR(XVID_VERSION),
-        XVID_VERSION_MINOR(XVID_VERSION),
-        XVID_VERSION_PATCH(XVID_VERSION));
-
-    *handle = x->context;
-    return 0;
-}
-
-/**
- * Destroys the two-pass plugin context.
- *
- * @param ref Context pointer for the plugin
- * @param param Destrooy context
- * @return Returns 0, success guaranteed
- */
-static int xvid_ff_2pass_destroy(struct xvid_context *ref,
-                                xvid_plg_destroy_t *param) {
-    /* Currently cannot think of anything to do on destruction */
-    /* Still, the framework should be here for reference/use */
-    if( ref->twopassbuffer != NULL )
-        ref->twopassbuffer[0] = 0;
-    return 0;
-}
-
-/**
- * Enables fast encode mode during the first pass.
- *
- * @param ref Context pointer for the plugin
- * @param param Frame data
- * @return Returns 0, success guaranteed
- */
-static int xvid_ff_2pass_before(struct xvid_context *ref,
-                                xvid_plg_data_t *param) {
-    int motion_remove;
-    int motion_replacements;
-    int vop_remove;
-
-    /* Nothing to do here, result is changed too much */
-    if( param->zone && param->zone->mode == XVID_ZONE_QUANT )
-        return 0;
-
-    /* We can implement a 'turbo' first pass mode here */
-    param->quant = 2;
-
-    /* Init values */
-    motion_remove = ~XVID_ME_CHROMA_PVOP &
-                    ~XVID_ME_CHROMA_BVOP &
-                    ~XVID_ME_EXTSEARCH16 &
-                    ~XVID_ME_ADVANCEDDIAMOND16;
-    motion_replacements = XVID_ME_FAST_MODEINTERPOLATE |
-                          XVID_ME_SKIP_DELTASEARCH |
-                          XVID_ME_FASTREFINE16 |
-                          XVID_ME_BFRAME_EARLYSTOP;
-    vop_remove = ~XVID_VOP_MODEDECISION_RD &
-                 ~XVID_VOP_FAST_MODEDECISION_RD &
-                 ~XVID_VOP_TRELLISQUANT &
-                 ~XVID_VOP_INTER4V &
-                 ~XVID_VOP_HQACPRED;
-
-    param->vol_flags &= ~XVID_VOL_GMC;
-    param->vop_flags &= vop_remove;
-    param->motion_flags &= motion_remove;
-    param->motion_flags |= motion_replacements;
-
-    return 0;
-}
-
-/**
- * Captures statistic data and writes it during first pass.
- *
- * @param ref Context pointer for the plugin
- * @param param Statistic data
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success
- */
-static int xvid_ff_2pass_after(struct xvid_context *ref,
-                                xvid_plg_data_t *param) {
-    char *log = ref->twopassbuffer;
-    char *frame_types = " ipbs";
-    char frame_type;
-
-    /* Quick bounds check */
-    if( log == NULL )
-        return XVID_ERR_FAIL;
-
-    /* Convert the type given to us into a character */
-    if( param->type < 5 && param->type > 0 ) {
-        frame_type = frame_types[param->type];
-    } else {
-        return XVID_ERR_FAIL;
-    }
-
-    snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
-        "%c %d %d %d %d %d %d\n",
-        frame_type, param->stats.quant, param->stats.kblks, param->stats.mblks,
-        param->stats.ublks, param->stats.length, param->stats.hlength);
-
-    return 0;
-}
-
-/**
- * Dispatch function for our custom plugin.
- * This handles the dispatch for the Xvid plugin. It passes data
- * on to other functions for actual processing.
- *
- * @param ref Context pointer for the plugin
- * @param cmd The task given for us to complete
- * @param p1 First parameter (varies)
- * @param p2 Second parameter (varies)
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success
- */
-int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2) {
-    switch( cmd ) {
-        case XVID_PLG_INFO:
-        case XVID_PLG_FRAME:
-            return 0;
-
-        case XVID_PLG_BEFORE:
-            return xvid_ff_2pass_before(ref, p1);
-
-        case XVID_PLG_CREATE:
-            return xvid_ff_2pass_create(p1, p2);
-
-        case XVID_PLG_AFTER:
-            return xvid_ff_2pass_after(ref, p1);
-
-        case XVID_PLG_DESTROY:
-            return xvid_ff_2pass_destroy(ref, p1);
-
-        default:
-            return XVID_ERR_FAIL;
-    }
-}
-
-/**
- * Xvid codec definition for libavcodec.
- */
-AVCodec libxvid_encoder = {
-    "libxvid",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG4,
-    sizeof(struct xvid_context),
-    xvid_encode_init,
-    xvid_encode_frame,
-    xvid_encode_close,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("libxvidcore MPEG-4 part 2"),
-};
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
deleted file mode 100644
index 2ef07c3..0000000
--- a/libavcodec/ljpegenc.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * lossless JPEG encoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * Support for external huffman table, various fixes (AVID workaround),
- * aspecting, new decode_frame mechanism and apple mjpeg-b support
- *                                  by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * lossless JPEG encoder.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mjpeg.h"
-#include "mjpegenc.h"
-
-
-static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    MpegEncContext * const s = avctx->priv_data;
-    MJpegContext * const m = s->mjpeg_ctx;
-    AVFrame *pict = data;
-    const int width= s->width;
-    const int height= s->height;
-    AVFrame * const p= (AVFrame*)&s->current_picture;
-    const int predictor= avctx->prediction_method+1;
-
-    init_put_bits(&s->pb, buf, buf_size);
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    ff_mjpeg_encode_picture_header(s);
-
-    s->header_bits= put_bits_count(&s->pb);
-
-    if(avctx->pix_fmt == PIX_FMT_BGRA){
-        int x, y, i;
-        const int linesize= p->linesize[0];
-        uint16_t (*buffer)[4]= (void *) s->rd_scratchpad;
-        int left[3], top[3], topleft[3];
-
-        for(i=0; i<3; i++){
-            buffer[0][i]= 1 << (9 - 1);
-        }
-
-        for(y = 0; y < height; y++) {
-            const int modified_predictor= y ? predictor : 1;
-            uint8_t *ptr = p->data[0] + (linesize * y);
-
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < width*3*4){
-                av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                return -1;
-            }
-
-            for(i=0; i<3; i++){
-                top[i]= left[i]= topleft[i]= buffer[0][i];
-            }
-            for(x = 0; x < width; x++) {
-                buffer[x][1] = ptr[4*x+0] - ptr[4*x+1] + 0x100;
-                buffer[x][2] = ptr[4*x+2] - ptr[4*x+1] + 0x100;
-                buffer[x][0] = (ptr[4*x+0] + 2*ptr[4*x+1] + ptr[4*x+2])>>2;
-
-                for(i=0;i<3;i++) {
-                    int pred, diff;
-
-                    PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
-
-                    topleft[i]= top[i];
-                    top[i]= buffer[x+1][i];
-
-                    left[i]= buffer[x][i];
-
-                    diff= ((left[i] - pred + 0x100)&0x1FF) - 0x100;
-
-                    if(i==0)
-                        ff_mjpeg_encode_dc(s, diff, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
-                    else
-                        ff_mjpeg_encode_dc(s, diff, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
-                }
-            }
-        }
-    }else{
-        int mb_x, mb_y, i;
-        const int mb_width  = (width  + s->mjpeg_hsample[0] - 1) / s->mjpeg_hsample[0];
-        const int mb_height = (height + s->mjpeg_vsample[0] - 1) / s->mjpeg_vsample[0];
-
-        for(mb_y = 0; mb_y < mb_height; mb_y++) {
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < mb_width * 4 * 3 * s->mjpeg_hsample[0] * s->mjpeg_vsample[0]){
-                av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                return -1;
-            }
-            for(mb_x = 0; mb_x < mb_width; mb_x++) {
-                if(mb_x==0 || mb_y==0){
-                    for(i=0;i<3;i++) {
-                        uint8_t *ptr;
-                        int x, y, h, v, linesize;
-                        h = s->mjpeg_hsample[i];
-                        v = s->mjpeg_vsample[i];
-                        linesize= p->linesize[i];
-
-                        for(y=0; y<v; y++){
-                            for(x=0; x<h; x++){
-                                int pred;
-
-                                ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
-                                if(y==0 && mb_y==0){
-                                    if(x==0 && mb_x==0){
-                                        pred= 128;
-                                    }else{
-                                        pred= ptr[-1];
-                                    }
-                                }else{
-                                    if(x==0 && mb_x==0){
-                                        pred= ptr[-linesize];
-                                    }else{
-                                        PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
-                                    }
-                                }
-
-                                if(i==0)
-                                    ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
-                                else
-                                    ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
-                            }
-                        }
-                    }
-                }else{
-                    for(i=0;i<3;i++) {
-                        uint8_t *ptr;
-                        int x, y, h, v, linesize;
-                        h = s->mjpeg_hsample[i];
-                        v = s->mjpeg_vsample[i];
-                        linesize= p->linesize[i];
-
-                        for(y=0; y<v; y++){
-                            for(x=0; x<h; x++){
-                                int pred;
-
-                                ptr = p->data[i] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
-//printf("%d %d %d %d %8X\n", mb_x, mb_y, x, y, ptr);
-                                PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
-
-                                if(i==0)
-                                    ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_luminance, m->huff_code_dc_luminance); //FIXME ugly
-                                else
-                                    ff_mjpeg_encode_dc(s, *ptr - pred, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    emms_c();
-
-    ff_mjpeg_encode_picture_trailer(s);
-    s->picture_number++;
-
-    flush_put_bits(&s->pb);
-    return put_bits_ptr(&s->pb) - s->pb.buf;
-//    return (put_bits_count(&f->pb)+7)/8;
-}
-
-
-AVCodec ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
-    "ljpeg",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_LJPEG,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    encode_picture_lossless,
-    MPV_encode_end,
-    .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
-};
diff --git a/libavcodec/loco.c b/libavcodec/loco.c
deleted file mode 100644
index d19a80c..0000000
--- a/libavcodec/loco.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * LOCO codec
- * Copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * LOCO codec.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-#include "mathops.h"
-
-enum LOCO_MODE {LOCO_UNKN=0, LOCO_CYUY2=-1, LOCO_CRGB=-2, LOCO_CRGBA=-3, LOCO_CYV12=-4,
- LOCO_YUY2=1, LOCO_UYVY=2, LOCO_RGB=3, LOCO_RGBA=4, LOCO_YV12=5};
-
-typedef struct LOCOContext{
-    AVCodecContext *avctx;
-    AVFrame pic;
-    int lossy;
-    int mode;
-} LOCOContext;
-
-typedef struct RICEContext{
-    GetBitContext gb;
-    int save, run, run2; /* internal rice decoder state */
-    int sum, count; /* sum and count for getting rice parameter */
-    int lossy;
-}RICEContext;
-
-static int loco_get_rice_param(RICEContext *r)
-{
-    int cnt = 0;
-    int val = r->count;
-
-    while(r->sum > val && cnt < 9) {
-        val <<= 1;
-        cnt++;
-    }
-
-    return cnt;
-}
-
-static inline void loco_update_rice_param(RICEContext *r, int val)
-{
-    r->sum += val;
-    r->count++;
-
-    if(r->count == 16) {
-        r->sum >>= 1;
-        r->count >>= 1;
-    }
-}
-
-static inline int loco_get_rice(RICEContext *r)
-{
-    int v;
-    if (r->run > 0) { /* we have zero run */
-        r->run--;
-        loco_update_rice_param(r, 0);
-        return 0;
-    }
-    v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0);
-    loco_update_rice_param(r, (v+1)>>1);
-    if (!v) {
-        if (r->save >= 0) {
-            r->run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
-            if(r->run > 1)
-                r->save += r->run + 1;
-            else
-                r->save -= 3;
-        }
-        else
-            r->run2++;
-    } else {
-        v = ((v>>1) + r->lossy) ^ -(v&1);
-        if (r->run2 > 0) {
-            if (r->run2 > 2)
-                r->save += r->run2;
-            else
-                r->save -= 3;
-            r->run2 = 0;
-        }
-    }
-
-    return v;
-}
-
-/* LOCO main predictor - LOCO-I/JPEG-LS predictor */
-static inline int loco_predict(uint8_t* data, int stride, int step)
-{
-    int a, b, c;
-
-    a = data[-stride];
-    b = data[-step];
-    c = data[-stride - step];
-
-    return mid_pred(a, a + b - c, b);
-}
-
-static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int height,
-                             int stride, const uint8_t *buf, int buf_size, int step)
-{
-    RICEContext rc;
-    int val;
-    int i, j;
-
-    init_get_bits(&rc.gb, buf, buf_size*8);
-    rc.save = 0;
-    rc.run = 0;
-    rc.run2 = 0;
-    rc.lossy = l->lossy;
-
-    rc.sum = 8;
-    rc.count = 1;
-
-    /* restore top left pixel */
-    val = loco_get_rice(&rc);
-    data[0] = 128 + val;
-    /* restore top line */
-    for (i = 1; i < width; i++) {
-        val = loco_get_rice(&rc);
-        data[i * step] = data[i * step - step] + val;
-    }
-    data += stride;
-    for (j = 1; j < height; j++) {
-        /* restore left column */
-        val = loco_get_rice(&rc);
-        data[0] = data[-stride] + val;
-        /* restore all other pixels */
-        for (i = 1; i < width; i++) {
-            val = loco_get_rice(&rc);
-            data[i * step] = loco_predict(&data[i * step], stride, step) + val;
-        }
-        data += stride;
-    }
-
-    return (get_bits_count(&rc.gb) + 7) >> 3;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    LOCOContext * const l = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&l->pic;
-    int decoded;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->key_frame = 1;
-
-    switch(l->mode) {
-    case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY:
-        decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 1);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[1], avctx->width / 2, avctx->height,
-                                    p->linesize[1], buf, buf_size, 1);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[2], avctx->width / 2, avctx->height,
-                                    p->linesize[2], buf, buf_size, 1);
-        break;
-    case LOCO_CYV12: case LOCO_YV12:
-        decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 1);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[2], avctx->width / 2, avctx->height / 2,
-                                    p->linesize[2], buf, buf_size, 1);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[1], avctx->width / 2, avctx->height / 2,
-                                    p->linesize[1], buf, buf_size, 1);
-        break;
-    case LOCO_CRGB: case LOCO_RGB:
-        decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1), avctx->width, avctx->height,
-                                    -p->linesize[0], buf, buf_size, 3);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 1, avctx->width, avctx->height,
-                                    -p->linesize[0], buf, buf_size, 3);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 2, avctx->width, avctx->height,
-                                    -p->linesize[0], buf, buf_size, 3);
-        break;
-    case LOCO_RGBA:
-        decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 4);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[0] + 1, avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 4);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[0] + 2, avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 4);
-        buf += decoded; buf_size -= decoded;
-        decoded = loco_decode_plane(l, p->data[0] + 3, avctx->width, avctx->height,
-                                    p->linesize[0], buf, buf_size, 4);
-        break;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = l->pic;
-
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-    LOCOContext * const l = avctx->priv_data;
-    int version;
-
-    l->avctx = avctx;
-    if (avctx->extradata_size < 12) {
-        av_log(avctx, AV_LOG_ERROR, "Extradata size must be >= 12 instead of %i\n",
-               avctx->extradata_size);
-        return -1;
-    }
-    version = AV_RL32(avctx->extradata);
-    switch(version) {
-    case 1:
-        l->lossy = 0;
-        break;
-    case 2:
-        l->lossy = AV_RL32(avctx->extradata + 8);
-        break;
-    default:
-        l->lossy = AV_RL32(avctx->extradata + 8);
-        av_log(avctx, AV_LOG_INFO, "This is LOCO codec version %i, please upload file for study\n", version);
-    }
-
-    l->mode = AV_RL32(avctx->extradata + 4);
-    switch(l->mode) {
-    case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY:
-        avctx->pix_fmt = PIX_FMT_YUV422P;
-        break;
-    case LOCO_CRGB: case LOCO_RGB:
-        avctx->pix_fmt = PIX_FMT_BGR24;
-        break;
-    case LOCO_CYV12: case LOCO_YV12:
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-        break;
-    case LOCO_CRGBA: case LOCO_RGBA:
-        avctx->pix_fmt = PIX_FMT_RGB32;
-        break;
-    default:
-        av_log(avctx, AV_LOG_INFO, "Unknown colorspace, index = %i\n", l->mode);
-        return -1;
-    }
-    if(avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(avctx, AV_LOG_INFO, "lossy:%i, version:%i, mode: %i\n", l->lossy, version, l->mode);
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    LOCOContext * const l = avctx->priv_data;
-    AVFrame *pic = &l->pic;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    return 0;
-}
-
-AVCodec loco_decoder = {
-    "loco",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_LOCO,
-    sizeof(LOCOContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("LOCO"),
-};
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
deleted file mode 100644
index 49e41d8..0000000
--- a/libavcodec/lpc.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/**
- * LPC utility code
- * Copyright (c) 2006  Justin Ruggles <justin.ruggles at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/lls.h"
-#include "dsputil.h"
-
-#define LPC_USE_DOUBLE
-#include "lpc.h"
-
-
-/**
- * Apply Welch window function to audio block
- */
-static void apply_welch_window(const int32_t *data, int len, double *w_data)
-{
-    int i, n2;
-    double w;
-    double c;
-
-    assert(!(len&1)); //the optimization in r11881 does not support odd len
-                      //if someone wants odd len extend the change in r11881
-
-    n2 = (len >> 1);
-    c = 2.0 / (len - 1.0);
-
-    w_data+=n2;
-      data+=n2;
-    for(i=0; i<n2; i++) {
-        w = c - n2 + i;
-        w = 1.0 - (w * w);
-        w_data[-i-1] = data[-i-1] * w;
-        w_data[+i  ] = data[+i  ] * w;
-    }
-}
-
-/**
- * Calculates autocorrelation data from audio samples
- * A Welch window function is applied before calculation.
- */
-void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag,
-                             double *autoc)
-{
-    int i, j;
-    double tmp[len + lag + 1];
-    double *data1= tmp + lag;
-
-    apply_welch_window(data, len, data1);
-
-    for(j=0; j<lag; j++)
-        data1[j-lag]= 0.0;
-    data1[len] = 0.0;
-
-    for(j=0; j<lag; j+=2){
-        double sum0 = 1.0, sum1 = 1.0;
-        for(i=j; i<len; i++){
-            sum0 += data1[i] * data1[i-j];
-            sum1 += data1[i] * data1[i-j-1];
-        }
-        autoc[j  ] = sum0;
-        autoc[j+1] = sum1;
-    }
-
-    if(j==lag){
-        double sum = 1.0;
-        for(i=j-1; i<len; i+=2){
-            sum += data1[i  ] * data1[i-j  ]
-                 + data1[i+1] * data1[i-j+1];
-        }
-        autoc[j] = sum;
-    }
-}
-
-/**
- * Quantize LPC coefficients
- */
-static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
-                               int32_t *lpc_out, int *shift, int max_shift, int zero_shift)
-{
-    int i;
-    double cmax, error;
-    int32_t qmax;
-    int sh;
-
-    /* define maximum levels */
-    qmax = (1 << (precision - 1)) - 1;
-
-    /* find maximum coefficient value */
-    cmax = 0.0;
-    for(i=0; i<order; i++) {
-        cmax= FFMAX(cmax, fabs(lpc_in[i]));
-    }
-
-    /* if maximum value quantizes to zero, return all zeros */
-    if(cmax * (1 << max_shift) < 1.0) {
-        *shift = zero_shift;
-        memset(lpc_out, 0, sizeof(int32_t) * order);
-        return;
-    }
-
-    /* calculate level shift which scales max coeff to available bits */
-    sh = max_shift;
-    while((cmax * (1 << sh) > qmax) && (sh > 0)) {
-        sh--;
-    }
-
-    /* since negative shift values are unsupported in decoder, scale down
-       coefficients instead */
-    if(sh == 0 && cmax > qmax) {
-        double scale = ((double)qmax) / cmax;
-        for(i=0; i<order; i++) {
-            lpc_in[i] *= scale;
-        }
-    }
-
-    /* output quantized coefficients and level shift */
-    error=0;
-    for(i=0; i<order; i++) {
-        error -= lpc_in[i] * (1 << sh);
-        lpc_out[i] = av_clip(lrintf(error), -qmax, qmax);
-        error -= lpc_out[i];
-    }
-    *shift = sh;
-}
-
-static int estimate_best_order(double *ref, int min_order, int max_order)
-{
-    int i, est;
-
-    est = min_order;
-    for(i=max_order-1; i>=min_order-1; i--) {
-        if(ref[i] > 0.10) {
-            est = i+1;
-            break;
-        }
-    }
-    return est;
-}
-
-/**
- * Calculate LPC coefficients for multiple orders
- *
- * @param use_lpc LPC method for determining coefficients
- * 0  = LPC with fixed pre-defined coeffs
- * 1  = LPC with coeffs determined by Levinson-Durbin recursion
- * 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes.
- */
-int ff_lpc_calc_coefs(DSPContext *s,
-                      const int32_t *samples, int blocksize, int min_order,
-                      int max_order, int precision,
-                      int32_t coefs[][MAX_LPC_ORDER], int *shift, int use_lpc,
-                      int omethod, int max_shift, int zero_shift)
-{
-    double autoc[MAX_LPC_ORDER+1];
-    double ref[MAX_LPC_ORDER];
-    double lpc[MAX_LPC_ORDER][MAX_LPC_ORDER];
-    int i, j, pass;
-    int opt_order;
-
-    assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && use_lpc > 0);
-
-    if(use_lpc == 1){
-        s->lpc_compute_autocorr(samples, blocksize, max_order, autoc);
-
-        compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1);
-
-        for(i=0; i<max_order; i++)
-            ref[i] = fabs(lpc[i][i]);
-    }else{
-        LLSModel m[2];
-        double var[MAX_LPC_ORDER+1], av_uninit(weight);
-
-        for(pass=0; pass<use_lpc-1; pass++){
-            av_init_lls(&m[pass&1], max_order);
-
-            weight=0;
-            for(i=max_order; i<blocksize; i++){
-                for(j=0; j<=max_order; j++)
-                    var[j]= samples[i-j];
-
-                if(pass){
-                    double eval, inv, rinv;
-                    eval= av_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1);
-                    eval= (512>>pass) + fabs(eval - var[0]);
-                    inv = 1/eval;
-                    rinv = sqrt(inv);
-                    for(j=0; j<=max_order; j++)
-                        var[j] *= rinv;
-                    weight += inv;
-                }else
-                    weight++;
-
-                av_update_lls(&m[pass&1], var, 1.0);
-            }
-            av_solve_lls(&m[pass&1], 0.001, 0);
-        }
-
-        for(i=0; i<max_order; i++){
-            for(j=0; j<max_order; j++)
-                lpc[i][j]=-m[(pass-1)&1].coeff[i][j];
-            ref[i]= sqrt(m[(pass-1)&1].variance[i] / weight) * (blocksize - max_order) / 4000;
-        }
-        for(i=max_order-1; i>0; i--)
-            ref[i] = ref[i-1] - ref[i];
-    }
-    opt_order = max_order;
-
-    if(omethod == ORDER_METHOD_EST) {
-        opt_order = estimate_best_order(ref, min_order, max_order);
-        i = opt_order-1;
-        quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift);
-    } else {
-        for(i=min_order-1; i<max_order; i++) {
-            quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift);
-        }
-    }
-
-    return opt_order;
-}
diff --git a/libavcodec/lpc.h b/libavcodec/lpc.h
deleted file mode 100644
index d3754f0..0000000
--- a/libavcodec/lpc.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * LPC utility code
- * Copyright (c) 2006  Justin Ruggles <justin.ruggles at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_LPC_H
-#define AVCODEC_LPC_H
-
-#include <stdint.h>
-#include "dsputil.h"
-
-#define ORDER_METHOD_EST     0
-#define ORDER_METHOD_2LEVEL  1
-#define ORDER_METHOD_4LEVEL  2
-#define ORDER_METHOD_8LEVEL  3
-#define ORDER_METHOD_SEARCH  4
-#define ORDER_METHOD_LOG     5
-
-#define MIN_LPC_ORDER        1
-#define MAX_LPC_ORDER       32
-
-
-/**
- * Calculate LPC coefficients for multiple orders
- */
-int ff_lpc_calc_coefs(DSPContext *s,
-                      const int32_t *samples, int blocksize, int min_order,
-                      int max_order, int precision,
-                      int32_t coefs[][MAX_LPC_ORDER], int *shift, int use_lpc,
-                      int omethod, int max_shift, int zero_shift);
-
-void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag,
-                             double *autoc);
-
-#ifdef LPC_USE_DOUBLE
-#define LPC_TYPE double
-#else
-#define LPC_TYPE float
-#endif
-
-/**
- * Levinson-Durbin recursion.
- * Produces LPC coefficients from autocorrelation data.
- */
-static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order,
-                                    LPC_TYPE *lpc, int lpc_stride, int fail,
-                                    int normalize)
-{
-    int i, j;
-    LPC_TYPE err;
-    LPC_TYPE *lpc_last = lpc;
-
-    if (normalize)
-        err = *autoc++;
-
-    if (fail && (autoc[max_order - 1] == 0 || err <= 0))
-        return -1;
-
-    for(i=0; i<max_order; i++) {
-        LPC_TYPE r = -autoc[i];
-
-        if (normalize) {
-            for(j=0; j<i; j++)
-                r -= lpc_last[j] * autoc[i-j-1];
-
-            r /= err;
-            err *= 1.0 - (r * r);
-        }
-
-        lpc[i] = r;
-
-        for(j=0; j < (i+1)>>1; j++) {
-            LPC_TYPE f = lpc_last[    j];
-            LPC_TYPE b = lpc_last[i-1-j];
-            lpc[    j] = f + r * b;
-            lpc[i-1-j] = b + r * f;
-        }
-
-        if (fail && err < 0)
-            return -1;
-
-        lpc_last = lpc;
-        lpc += lpc_stride;
-    }
-
-    return 0;
-}
-
-#endif /* AVCODEC_LPC_H */
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c
deleted file mode 100644
index 003ffbc..0000000
--- a/libavcodec/lsp.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * LSP routines for ACELP-based codecs
- *
- * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet (QCELP decoder)
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-
-#include "avcodec.h"
-#define FRAC_BITS 14
-#include "mathops.h"
-#include "lsp.h"
-#include "celp_math.h"
-
-void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max, int lp_order)
-{
-    int i, j;
-
-    /* sort lsfq in ascending order. float bubble agorithm,
-       O(n) if data already sorted, O(n^2) - otherwise */
-    for(i=0; i<lp_order-1; i++)
-        for(j=i; j>=0 && lsfq[j] > lsfq[j+1]; j--)
-            FFSWAP(int16_t, lsfq[j], lsfq[j+1]);
-
-    for(i=0; i<lp_order; i++)
-    {
-        lsfq[i] = FFMAX(lsfq[i], lsfq_min);
-        lsfq_min = lsfq[i] + lsfq_min_distance;
-    }
-    lsfq[lp_order-1] = FFMIN(lsfq[lp_order-1], lsfq_max);//Is warning required ?
-}
-
-void ff_set_min_dist_lsf(float *lsf, double min_spacing, int size)
-{
-    int i;
-    float prev = 0.0;
-    for (i = 0; i < size; i++)
-        prev = lsf[i] = FFMAX(lsf[i], prev + min_spacing);
-}
-
-void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order)
-{
-    int i;
-
-    /* Convert LSF to LSP, lsp=cos(lsf) */
-    for(i=0; i<lp_order; i++)
-        // 20861 = 2.0 / PI in (0.15)
-        lsp[i] = ff_cos(lsf[i] * 20861 >> 15); // divide by PI and (0,13) -> (0,14)
-}
-
-/**
- * \brief decodes polynomial coefficients from LSP
- * \param f [out] decoded polynomial coefficients (-0x20000000 <= (3.22) <= 0x1fffffff)
- * \param lsp LSP coefficients (-0x8000 <= (0.15) <= 0x7fff)
- */
-static void lsp2poly(int* f, const int16_t* lsp, int lp_half_order)
-{
-    int i, j;
-
-    f[0] = 0x400000;          // 1.0 in (3.22)
-    f[1] = -lsp[0] << 8;      // *2 and (0.15) -> (3.22)
-
-    for(i=2; i<=lp_half_order; i++)
-    {
-        f[i] = f[i-2];
-        for(j=i; j>1; j--)
-            f[j] -= MULL(f[j-1], lsp[2*i-2], FRAC_BITS) - f[j-2];
-
-        f[1] -= lsp[2*i-2] << 8;
-    }
-}
-
-void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order)
-{
-    int i;
-    int f1[lp_half_order+1]; // (3.22)
-    int f2[lp_half_order+1]; // (3.22)
-
-    lsp2poly(f1, lsp  , lp_half_order);
-    lsp2poly(f2, lsp+1, lp_half_order);
-
-    /* 3.2.6 of G.729, Equations 25 and  26*/
-    lp[0] = 4096;
-    for(i=1; i<lp_half_order+1; i++)
-    {
-        int ff1 = f1[i] + f1[i-1]; // (3.22)
-        int ff2 = f2[i] - f2[i-1]; // (3.22)
-
-        ff1 += 1 << 10; // for rounding
-        lp[i]    = (ff1 + ff2) >> 11; // divide by 2 and (3.22) -> (3.12)
-        lp[(lp_half_order << 1) + 1 - i] = (ff1 - ff2) >> 11; // divide by 2 and (3.22) -> (3.12)
-    }
-}
-
-void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd, const int16_t* lsp_prev, int lp_order)
-{
-    int16_t lsp_1st[lp_order]; // (0.15)
-    int i;
-
-    /* LSP values for first subframe (3.2.5 of G.729, Equation 24)*/
-    for(i=0; i<lp_order; i++)
-#ifdef G729_BITEXACT
-        lsp_1st[i] = (lsp_2nd[i] >> 1) + (lsp_prev[i] >> 1);
-#else
-        lsp_1st[i] = (lsp_2nd[i] + lsp_prev[i]) >> 1;
-#endif
-
-    ff_acelp_lsp2lpc(lp_1st, lsp_1st, lp_order >> 1);
-
-    /* LSP values for second subframe (3.2.5 of G.729)*/
-    ff_acelp_lsp2lpc(lp_2nd, lsp_2nd, lp_order >> 1);
-}
-
-void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order)
-{
-    int i, j;
-
-    f[0] = 1.0;
-    f[1] = -2 * lsp[0];
-    lsp -= 2;
-    for(i=2; i<=lp_half_order; i++)
-    {
-        double val = -2 * lsp[2*i];
-        f[i] = val * f[i-1] + 2*f[i-2];
-        for(j=i-1; j>1; j--)
-            f[j] += f[j-1] * val + f[j-2];
-        f[1] += val;
-    }
-}
-
-void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order)
-{
-    double pa[MAX_LP_HALF_ORDER+1], qa[MAX_LP_HALF_ORDER+1];
-    float *lpc2 = lpc + (lp_half_order << 1) - 1;
-
-    assert(lp_half_order <= MAX_LP_HALF_ORDER);
-
-    ff_lsp2polyf(lsp,     pa, lp_half_order);
-    ff_lsp2polyf(lsp + 1, qa, lp_half_order);
-
-    while (lp_half_order--) {
-        double paf = pa[lp_half_order+1] + pa[lp_half_order];
-        double qaf = qa[lp_half_order+1] - qa[lp_half_order];
-
-        lpc [ lp_half_order] = 0.5*(paf+qaf);
-        lpc2[-lp_half_order] = 0.5*(paf-qaf);
-    }
-}
-
-void ff_sort_nearly_sorted_floats(float *vals, int len)
-{
-    int i,j;
-
-    for (i = 0; i < len - 1; i++)
-        for (j = i; j >= 0 && vals[j] > vals[j+1]; j--)
-            FFSWAP(float, vals[j], vals[j+1]);
-}
diff --git a/libavcodec/lsp.h b/libavcodec/lsp.h
deleted file mode 100644
index c3aee7b..0000000
--- a/libavcodec/lsp.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * LSP computing for ACELP-based codecs
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_LSP_H
-#define AVCODEC_LSP_H
-
-#include <stdint.h>
-
-/**
-  (I.F) means fixed-point value with F fractional and I integer bits
-*/
-
-/**
- * \brief ensure a minimum distance between LSFs
- * \param lsfq [in/out] LSF to check and adjust
- * \param lsfq_min_distance minimum distance between LSFs
- * \param lsfq_min minimum allowed LSF value
- * \param lsfq_max maximum allowed LSF value
- * \param lp_order LP filter order
- */
-void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max, int lp_order);
-
-/**
- * Adjust the quantized LSFs so they are increasing and not too close.
- *
- * This step is not mentioned in the AMR spec but is in the reference C decoder.
- * Omitting this step creates audible distortion on the sinusoidal sweep
- * test vectors in 3GPP TS 26.074.
- *
- * @param[in,out] lsf    LSFs in Hertz
- * @param min_spacing    minimum distance between two consecutive lsf values
- * @param                size size of the lsf vector
- */
-void ff_set_min_dist_lsf(float *lsf, double min_spacing, int order);
-
-/**
- * \brief Convert LSF to LSP
- * \param lsp [out] LSP coefficients (-0x8000 <= (0.15) < 0x8000)
- * \param lsf normalized LSF coefficients (0 <= (2.13) < 0x2000 * PI)
- * \param lp_order LP filter order
- *
- * \remark It is safe to pass the same array into the lsf and lsp parameters.
- */
-void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order);
-
-/**
- * \brief LSP to LP conversion (3.2.6 of G.729)
- * \param lp [out] decoded LP coefficients (-0x8000 <= (3.12) < 0x8000)
- * \param lsp LSP coefficients (-0x8000 <= (0.15) < 0x8000)
- * \param lp_half_order LP filter order, divided by 2
- */
-void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order);
-
-/**
- * \brief Interpolate LSP for the first subframe and convert LSP -> LP for both subframes (3.2.5 and 3.2.6 of G.729)
- * \param lp_1st [out] decoded LP coefficients for first subframe (-0x8000 <= (3.12) < 0x8000)
- * \param lp_2nd [out] decoded LP coefficients for second subframe (-0x8000 <= (3.12) < 0x8000)
- * \param lsp_2nd LSP coefficients of the second subframe (-0x8000 <= (0.15) < 0x8000)
- * \param lsp_prev LSP coefficients from the second subframe of the previous frame (-0x8000 <= (0.15) < 0x8000)
- * \param lp_order LP filter order
- */
-void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd, const int16_t* lsp_prev, int lp_order);
-
-
-#define MAX_LP_HALF_ORDER 8
-
-/**
- * Reconstructs LPC coefficients from the line spectral pair frequencies.
- *
- * @param lsp line spectral pairs in cosine domain
- * @param lpc linear predictive coding coefficients
- * @param lp_half_order half the number of the amount of LPCs to be
- *        reconstructed, need to be smaller or equal to MAX_LP_HALF_ORDER
- *
- * @note buffers should have a minimux size of 2*lp_half_order elements.
- *
- * TIA/EIA/IS-733 2.4.3.3.5
- */
-void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order);
-
-/**
- * Sort values in ascending order.
- *
- * @note O(n) if data already sorted, O(n^2) - otherwise
- */
-void ff_sort_nearly_sorted_floats(float *vals, int len);
-
-/**
- * Computes the Pa / (1 + z(-1)) or Qa / (1 - z(-1)) coefficients
- * needed for LSP to LPC conversion.
- * We only need to calculate the 6 first elements of the polynomial.
- *
- * @param lsp line spectral pairs in cosine domain
- * @param f [out] polynomial input/output as a vector
- *
- * TIA/EIA/IS-733 2.4.3.3.5-1/2
- */
-void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order);
-
-#endif /* AVCODEC_LSP_H */
diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c
deleted file mode 100644
index 8043789..0000000
--- a/libavcodec/lzw.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * LZW decoder
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief LZW decoding routines
- * @author Fabrice Bellard
- * Modified for use in TIFF by Konstantin Shishkov
- */
-
-#include "avcodec.h"
-#include "lzw.h"
-
-#define LZW_MAXBITS                 12
-#define LZW_SIZTABLE                (1<<LZW_MAXBITS)
-
-static const uint16_t mask[17] =
-{
-    0x0000, 0x0001, 0x0003, 0x0007,
-    0x000F, 0x001F, 0x003F, 0x007F,
-    0x00FF, 0x01FF, 0x03FF, 0x07FF,
-    0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF
-};
-
-struct LZWState {
-    const uint8_t *pbuf, *ebuf;
-    int bbits;
-    unsigned int bbuf;
-
-    int mode;                   ///< Decoder mode
-    int cursize;                ///< The current code size
-    int curmask;
-    int codesize;
-    int clear_code;
-    int end_code;
-    int newcodes;               ///< First available code
-    int top_slot;               ///< Highest code for current size
-    int extra_slot;
-    int slot;                   ///< Last read code
-    int fc, oc;
-    uint8_t *sp;
-    uint8_t stack[LZW_SIZTABLE];
-    uint8_t suffix[LZW_SIZTABLE];
-    uint16_t prefix[LZW_SIZTABLE];
-    int bs;                     ///< current buffer size for GIF
-};
-
-/* get one code from stream */
-static int lzw_get_code(struct LZWState * s)
-{
-    int c;
-
-    if(s->mode == FF_LZW_GIF) {
-        while (s->bbits < s->cursize) {
-            if (!s->bs) {
-                s->bs = *s->pbuf++;
-            }
-            s->bbuf |= (*s->pbuf++) << s->bbits;
-            s->bbits += 8;
-            s->bs--;
-        }
-        c = s->bbuf;
-        s->bbuf >>= s->cursize;
-    } else { // TIFF
-        while (s->bbits < s->cursize) {
-            s->bbuf = (s->bbuf << 8) | (*s->pbuf++);
-            s->bbits += 8;
-        }
-        c = s->bbuf >> (s->bbits - s->cursize);
-    }
-    s->bbits -= s->cursize;
-    return c & s->curmask;
-}
-
-const uint8_t* ff_lzw_cur_ptr(LZWState *p)
-{
-    return ((struct LZWState*)p)->pbuf;
-}
-
-void ff_lzw_decode_tail(LZWState *p)
-{
-    struct LZWState *s = (struct LZWState *)p;
-
-    if(s->mode == FF_LZW_GIF) {
-        while(s->pbuf < s->ebuf && s->bs>0){
-            s->pbuf += s->bs;
-            s->bs = *s->pbuf++;
-        }
-    }else
-        s->pbuf= s->ebuf;
-}
-
-av_cold void ff_lzw_decode_open(LZWState **p)
-{
-    *p = av_mallocz(sizeof(struct LZWState));
-}
-
-av_cold void ff_lzw_decode_close(LZWState **p)
-{
-    av_freep(p);
-}
-
-/**
- * Initialize LZW decoder
- * @param s LZW context
- * @param csize initial code size in bits
- * @param buf input data
- * @param buf_size input data size
- * @param mode decoder working mode - either GIF or TIFF
- */
-int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode)
-{
-    struct LZWState *s = (struct LZWState *)p;
-
-    if(csize < 1 || csize >= LZW_MAXBITS)
-        return -1;
-    /* read buffer */
-    s->pbuf = buf;
-    s->ebuf = s->pbuf + buf_size;
-    s->bbuf = 0;
-    s->bbits = 0;
-    s->bs = 0;
-
-    /* decoder */
-    s->codesize = csize;
-    s->cursize = s->codesize + 1;
-    s->curmask = mask[s->cursize];
-    s->top_slot = 1 << s->cursize;
-    s->clear_code = 1 << s->codesize;
-    s->end_code = s->clear_code + 1;
-    s->slot = s->newcodes = s->clear_code + 2;
-    s->oc = s->fc = -1;
-    s->sp = s->stack;
-
-    s->mode = mode;
-    s->extra_slot = s->mode == FF_LZW_TIFF;
-    return 0;
-}
-
-/**
- * Decode given number of bytes
- * NOTE: the algorithm here is inspired from the LZW GIF decoder
- *  written by Steven A. Bennett in 1987.
- *
- * @param s LZW context
- * @param buf output buffer
- * @param len number of bytes to decode
- * @return number of bytes decoded
- */
-int ff_lzw_decode(LZWState *p, uint8_t *buf, int len){
-    int l, c, code, oc, fc;
-    uint8_t *sp;
-    struct LZWState *s = (struct LZWState *)p;
-
-    if (s->end_code < 0)
-        return 0;
-
-    l = len;
-    sp = s->sp;
-    oc = s->oc;
-    fc = s->fc;
-
-    for (;;) {
-        while (sp > s->stack) {
-            *buf++ = *(--sp);
-            if ((--l) == 0)
-                goto the_end;
-        }
-        c = lzw_get_code(s);
-        if (c == s->end_code) {
-            break;
-        } else if (c == s->clear_code) {
-            s->cursize = s->codesize + 1;
-            s->curmask = mask[s->cursize];
-            s->slot = s->newcodes;
-            s->top_slot = 1 << s->cursize;
-            fc= oc= -1;
-        } else {
-            code = c;
-            if (code == s->slot && fc>=0) {
-                *sp++ = fc;
-                code = oc;
-            }else if(code >= s->slot)
-                break;
-            while (code >= s->newcodes) {
-                *sp++ = s->suffix[code];
-                code = s->prefix[code];
-            }
-            *sp++ = code;
-            if (s->slot < s->top_slot && oc>=0) {
-                s->suffix[s->slot] = code;
-                s->prefix[s->slot++] = oc;
-            }
-            fc = code;
-            oc = c;
-            if (s->slot >= s->top_slot - s->extra_slot) {
-                if (s->cursize < LZW_MAXBITS) {
-                    s->top_slot <<= 1;
-                    s->curmask = mask[++s->cursize];
-                }
-            }
-        }
-    }
-    s->end_code = -1;
-  the_end:
-    s->sp = sp;
-    s->oc = oc;
-    s->fc = fc;
-    return len - l;
-}
diff --git a/libavcodec/lzw.h b/libavcodec/lzw.h
deleted file mode 100644
index 76a5b67..0000000
--- a/libavcodec/lzw.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * LZW decoder
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief LZW decoding routines
- * @author Fabrice Bellard
- * Modified for use in TIFF by Konstantin Shishkov
- */
-
-#ifndef AVCODEC_LZW_H
-#define AVCODEC_LZW_H
-
-#include <stdint.h>
-
-struct PutBitContext;
-
-enum FF_LZW_MODES{
-    FF_LZW_GIF,
-    FF_LZW_TIFF
-};
-
-/* clients should not know what LZWState is */
-typedef void LZWState;
-
-/* first two functions de/allocate memory for LZWState */
-void ff_lzw_decode_open(LZWState **p);
-void ff_lzw_decode_close(LZWState **p);
-int ff_lzw_decode_init(LZWState *s, int csize, const uint8_t *buf, int buf_size, int mode);
-int ff_lzw_decode(LZWState *s, uint8_t *buf, int len);
-const uint8_t* ff_lzw_cur_ptr(LZWState *lzw);
-void ff_lzw_decode_tail(LZWState *lzw);
-
-/** LZW encode state */
-struct LZWEncodeState;
-extern const int ff_lzw_encode_state_size;
-
-void ff_lzw_encode_init(struct LZWEncodeState *s, uint8_t *outbuf, int outsize,
-                        int maxbits, enum FF_LZW_MODES mode,
-                        void (*lzw_put_bits)(struct PutBitContext *, int, unsigned int));
-int ff_lzw_encode(struct LZWEncodeState * s, const uint8_t * inbuf, int insize);
-int ff_lzw_encode_flush(struct LZWEncodeState *s,
-                        void (*lzw_flush_put_bits)(struct PutBitContext *));
-
-#endif /* AVCODEC_LZW_H */
diff --git a/libavcodec/lzwenc.c b/libavcodec/lzwenc.c
deleted file mode 100644
index 23248a6..0000000
--- a/libavcodec/lzwenc.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * LZW encoder
- * Copyright (c) 2007 Bartlomiej Wolowiec
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * LZW encoder
- * @file
- * @author Bartlomiej Wolowiec
- */
-
-#include "avcodec.h"
-#include "put_bits.h"
-#include "lzw.h"
-
-#define LZW_MAXBITS 12
-#define LZW_SIZTABLE (1<<LZW_MAXBITS)
-#define LZW_HASH_SIZE 16411
-#define LZW_HASH_SHIFT 6
-
-#define LZW_PREFIX_EMPTY -1
-#define LZW_PREFIX_FREE -2
-
-/** One code in hash table */
-typedef struct Code{
-    /// Hash code of prefix, LZW_PREFIX_EMPTY if empty prefix, or LZW_PREFIX_FREE if no code
-    int hash_prefix;
-    int code;               ///< LZW code
-    uint8_t suffix;         ///< Last character in code block
-}Code;
-
-/** LZW encode state */
-typedef struct LZWEncodeState {
-    int clear_code;          ///< Value of clear code
-    int end_code;            ///< Value of end code
-    Code tab[LZW_HASH_SIZE]; ///< Hash table
-    int tabsize;             ///< Number of values in hash table
-    int bits;                ///< Actual bits code
-    int bufsize;             ///< Size of output buffer
-    PutBitContext pb;        ///< Put bit context for output
-    int maxbits;             ///< Max bits code
-    int maxcode;             ///< Max value of code
-    int output_bytes;        ///< Number of written bytes
-    int last_code;           ///< Value of last output code or LZW_PREFIX_EMPTY
-    enum FF_LZW_MODES mode;  ///< TIFF or GIF
-    void (*put_bits)(PutBitContext *, int, unsigned); ///< GIF is LE while TIFF is BE
-}LZWEncodeState;
-
-
-const int ff_lzw_encode_state_size = sizeof(LZWEncodeState);
-
-/**
- * Hash function adding character
- * @param head LZW code for prefix
- * @param add Character to add
- * @return New hash value
- */
-static inline int hash(int head, const int add)
-{
-    head ^= (add << LZW_HASH_SHIFT);
-    if (head >= LZW_HASH_SIZE)
-        head -= LZW_HASH_SIZE;
-    assert(head >= 0 && head < LZW_HASH_SIZE);
-    return head;
-}
-
-/**
- * Hash function calculates next hash value
- * @param head Actual hash code
- * @param offset Offset calculated by hashOffset
- * @return New hash value
- */
-static inline int hashNext(int head, const int offset)
-{
-    head -= offset;
-    if(head < 0)
-        head += LZW_HASH_SIZE;
-    return head;
-}
-
-/**
- * Hash function calculates hash offset
- * @param head Actual hash code
- * @return Hash offset
- */
-static inline int hashOffset(const int head)
-{
-    return head ? LZW_HASH_SIZE - head : 1;
-}
-
-/**
- * Write one code to stream
- * @param s LZW state
- * @param c code to write
- */
-static inline void writeCode(LZWEncodeState * s, int c)
-{
-    assert(0 <= c && c < 1 << s->bits);
-    s->put_bits(&s->pb, s->bits, c);
-}
-
-
-/**
- * Find LZW code for block
- * @param s LZW state
- * @param c Last character in block
- * @param hash_prefix LZW code for prefix
- * @return LZW code for block or -1 if not found in table
- */
-static inline int findCode(LZWEncodeState * s, uint8_t c, int hash_prefix)
-{
-    int h = hash(FFMAX(hash_prefix, 0), c);
-    int hash_offset = hashOffset(h);
-
-    while (s->tab[h].hash_prefix != LZW_PREFIX_FREE) {
-        if ((s->tab[h].suffix == c)
-            && (s->tab[h].hash_prefix == hash_prefix))
-            return h;
-        h = hashNext(h, hash_offset);
-    }
-
-    return h;
-}
-
-/**
- * Add block to LZW code table
- * @param s LZW state
- * @param c Last character in block
- * @param hash_prefix LZW code for prefix
- * @param hash_code LZW code for bytes block
- */
-static inline void addCode(LZWEncodeState * s, uint8_t c, int hash_prefix, int hash_code)
-{
-    s->tab[hash_code].code = s->tabsize;
-    s->tab[hash_code].suffix = c;
-    s->tab[hash_code].hash_prefix = hash_prefix;
-
-    s->tabsize++;
-
-    if (s->tabsize >= (1 << s->bits) + (s->mode == FF_LZW_GIF))
-        s->bits++;
-}
-
-/**
- * Clear LZW code table
- * @param s LZW state
- */
-static void clearTable(LZWEncodeState * s)
-{
-    int i, h;
-
-    writeCode(s, s->clear_code);
-    s->bits = 9;
-    for (i = 0; i < LZW_HASH_SIZE; i++) {
-        s->tab[i].hash_prefix = LZW_PREFIX_FREE;
-    }
-    for (i = 0; i < 256; i++) {
-        h = hash(0, i);
-        s->tab[h].code = i;
-        s->tab[h].suffix = i;
-        s->tab[h].hash_prefix = LZW_PREFIX_EMPTY;
-    }
-    s->tabsize = 258;
-}
-
-/**
- * Calculate number of bytes written
- * @param s LZW encode state
- * @return Number of bytes written
- */
-static int writtenBytes(LZWEncodeState *s){
-    int ret = put_bits_count(&s->pb) >> 3;
-    ret -= s->output_bytes;
-    s->output_bytes += ret;
-    return ret;
-}
-
-/**
- * Initialize LZW encoder. Please set s->clear_code, s->end_code and s->maxbits before run.
- * @param s LZW state
- * @param outbuf Output buffer
- * @param outsize Size of output buffer
- * @param maxbits Maximum length of code
- */
-void ff_lzw_encode_init(LZWEncodeState *s, uint8_t *outbuf, int outsize,
-                        int maxbits, enum FF_LZW_MODES mode,
-                        void (*lzw_put_bits)(PutBitContext *, int, unsigned))
-{
-    s->clear_code = 256;
-    s->end_code = 257;
-    s->maxbits = maxbits;
-    init_put_bits(&s->pb, outbuf, outsize);
-    s->bufsize = outsize;
-    assert(s->maxbits >= 9 && s->maxbits <= LZW_MAXBITS);
-    s->maxcode = 1 << s->maxbits;
-    s->output_bytes = 0;
-    s->last_code = LZW_PREFIX_EMPTY;
-    s->bits = 9;
-    s->mode = mode;
-    s->put_bits = lzw_put_bits;
-}
-
-/**
- * LZW main compress function
- * @param s LZW state
- * @param inbuf Input buffer
- * @param insize Size of input buffer
- * @return Number of bytes written or -1 on error
- */
-int ff_lzw_encode(LZWEncodeState * s, const uint8_t * inbuf, int insize)
-{
-    int i;
-
-    if(insize * 3 > (s->bufsize - s->output_bytes) * 2){
-        return -1;
-    }
-
-    if (s->last_code == LZW_PREFIX_EMPTY)
-        clearTable(s);
-
-    for (i = 0; i < insize; i++) {
-        uint8_t c = *inbuf++;
-        int code = findCode(s, c, s->last_code);
-        if (s->tab[code].hash_prefix == LZW_PREFIX_FREE) {
-            writeCode(s, s->last_code);
-            addCode(s, c, s->last_code, code);
-            code= hash(0, c);
-        }
-        s->last_code = s->tab[code].code;
-        if (s->tabsize >= s->maxcode - 1) {
-            clearTable(s);
-        }
-    }
-
-    return writtenBytes(s);
-}
-
-/**
- * Write end code and flush bitstream
- * @param s LZW state
- * @return Number of bytes written or -1 on error
- */
-int ff_lzw_encode_flush(LZWEncodeState *s,
-                        void (*lzw_flush_put_bits)(PutBitContext *))
-{
-    if (s->last_code != -1)
-        writeCode(s, s->last_code);
-    writeCode(s, s->end_code);
-    lzw_flush_put_bits(&s->pb);
-    s->last_code = -1;
-
-    return writtenBytes(s);
-}
diff --git a/libavcodec/mace.c b/libavcodec/mace.c
deleted file mode 100644
index 3c71320..0000000
--- a/libavcodec/mace.c
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * MACE decoder
- * Copyright (c) 2002 Laszlo Torok <torokl at alpha.dfmk.hu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MACE decoder.
- */
-
-#include "avcodec.h"
-
-/*
- * Adapted to ffmpeg by Francois Revol <revol at free.fr>
- * (removed 68k REG stuff, changed types, added some statics and consts,
- * libavcodec api, context stuff, interlaced stereo out).
- */
-
-static const int16_t MACEtab1[] = {-13, 8, 76, 222, 222, 76, 8, -13};
-
-static const int16_t MACEtab3[] = {-18, 140, 140, -18};
-
-static const int16_t MACEtab2[][4] = {
-    {    37,    116,    206,    330}, {    39,    121,    216,    346},
-    {    41,    127,    225,    361}, {    42,    132,    235,    377},
-    {    44,    137,    245,    392}, {    46,    144,    256,    410},
-    {    48,    150,    267,    428}, {    51,    157,    280,    449},
-    {    53,    165,    293,    470}, {    55,    172,    306,    490},
-    {    58,    179,    319,    511}, {    60,    187,    333,    534},
-    {    63,    195,    348,    557}, {    66,    205,    364,    583},
-    {    69,    214,    380,    609}, {    72,    223,    396,    635},
-    {    75,    233,    414,    663}, {    79,    244,    433,    694},
-    {    82,    254,    453,    725}, {    86,    265,    472,    756},
-    {    90,    278,    495,    792}, {    94,    290,    516,    826},
-    {    98,    303,    538,    862}, {   102,    316,    562,    901},
-    {   107,    331,    588,    942}, {   112,    345,    614,    983},
-    {   117,    361,    641,   1027}, {   122,    377,    670,   1074},
-    {   127,    394,    701,   1123}, {   133,    411,    732,   1172},
-    {   139,    430,    764,   1224}, {   145,    449,    799,   1280},
-    {   152,    469,    835,   1337}, {   159,    490,    872,   1397},
-    {   166,    512,    911,   1459}, {   173,    535,    951,   1523},
-    {   181,    558,    993,   1590}, {   189,    584,   1038,   1663},
-    {   197,    610,   1085,   1738}, {   206,    637,   1133,   1815},
-    {   215,    665,   1183,   1895}, {   225,    695,   1237,   1980},
-    {   235,    726,   1291,   2068}, {   246,    759,   1349,   2161},
-    {   257,    792,   1409,   2257}, {   268,    828,   1472,   2357},
-    {   280,    865,   1538,   2463}, {   293,    903,   1606,   2572},
-    {   306,    944,   1678,   2688}, {   319,    986,   1753,   2807},
-    {   334,   1030,   1832,   2933}, {   349,   1076,   1914,   3065},
-    {   364,   1124,   1999,   3202}, {   380,   1174,   2088,   3344},
-    {   398,   1227,   2182,   3494}, {   415,   1281,   2278,   3649},
-    {   434,   1339,   2380,   3811}, {   453,   1398,   2486,   3982},
-    {   473,   1461,   2598,   4160}, {   495,   1526,   2714,   4346},
-    {   517,   1594,   2835,   4540}, {   540,   1665,   2961,   4741},
-    {   564,   1740,   3093,   4953}, {   589,   1818,   3232,   5175},
-    {   615,   1898,   3375,   5405}, {   643,   1984,   3527,   5647},
-    {   671,   2072,   3683,   5898}, {   701,   2164,   3848,   6161},
-    {   733,   2261,   4020,   6438}, {   766,   2362,   4199,   6724},
-    {   800,   2467,   4386,   7024}, {   836,   2578,   4583,   7339},
-    {   873,   2692,   4786,   7664}, {   912,   2813,   5001,   8008},
-    {   952,   2938,   5223,   8364}, {   995,   3070,   5457,   8739},
-    {  1039,   3207,   5701,   9129}, {  1086,   3350,   5956,   9537},
-    {  1134,   3499,   6220,   9960}, {  1185,   3655,   6497,  10404},
-    {  1238,   3818,   6788,  10869}, {  1293,   3989,   7091,  11355},
-    {  1351,   4166,   7407,  11861}, {  1411,   4352,   7738,  12390},
-    {  1474,   4547,   8084,  12946}, {  1540,   4750,   8444,  13522},
-    {  1609,   4962,   8821,  14126}, {  1680,   5183,   9215,  14756},
-    {  1756,   5415,   9626,  15415}, {  1834,   5657,  10057,  16104},
-    {  1916,   5909,  10505,  16822}, {  2001,   6173,  10975,  17574},
-    {  2091,   6448,  11463,  18356}, {  2184,   6736,  11974,  19175},
-    {  2282,   7037,  12510,  20032}, {  2383,   7351,  13068,  20926},
-    {  2490,   7679,  13652,  21861}, {  2601,   8021,  14260,  22834},
-    {  2717,   8380,  14897,  23854}, {  2838,   8753,  15561,  24918},
-    {  2965,   9144,  16256,  26031}, {  3097,   9553,  16982,  27193},
-    {  3236,   9979,  17740,  28407}, {  3380,  10424,  18532,  29675},
-    {  3531,  10890,  19359,  31000}, {  3688,  11375,  20222,  32382},
-    {  3853,  11883,  21125,  32767}, {  4025,  12414,  22069,  32767},
-    {  4205,  12967,  23053,  32767}, {  4392,  13546,  24082,  32767},
-    {  4589,  14151,  25157,  32767}, {  4793,  14783,  26280,  32767},
-    {  5007,  15442,  27452,  32767}, {  5231,  16132,  28678,  32767},
-    {  5464,  16851,  29957,  32767}, {  5708,  17603,  31294,  32767},
-    {  5963,  18389,  32691,  32767}, {  6229,  19210,  32767,  32767},
-    {  6507,  20067,  32767,  32767}, {  6797,  20963,  32767,  32767},
-    {  7101,  21899,  32767,  32767}, {  7418,  22876,  32767,  32767},
-    {  7749,  23897,  32767,  32767}, {  8095,  24964,  32767,  32767},
-    {  8456,  26078,  32767,  32767}, {  8833,  27242,  32767,  32767},
-    {  9228,  28457,  32767,  32767}, {  9639,  29727,  32767,  32767}
-};
-
-static const int16_t MACEtab4[][2] = {
-    {    64,    216}, {    67,    226}, {    70,    236}, {    74,    246},
-    {    77,    257}, {    80,    268}, {    84,    280}, {    88,    294},
-    {    92,    307}, {    96,    321}, {   100,    334}, {   104,    350},
-    {   109,    365}, {   114,    382}, {   119,    399}, {   124,    416},
-    {   130,    434}, {   136,    454}, {   142,    475}, {   148,    495},
-    {   155,    519}, {   162,    541}, {   169,    564}, {   176,    590},
-    {   185,    617}, {   193,    644}, {   201,    673}, {   210,    703},
-    {   220,    735}, {   230,    767}, {   240,    801}, {   251,    838},
-    {   262,    876}, {   274,    914}, {   286,    955}, {   299,    997},
-    {   312,   1041}, {   326,   1089}, {   341,   1138}, {   356,   1188},
-    {   372,   1241}, {   388,   1297}, {   406,   1354}, {   424,   1415},
-    {   443,   1478}, {   462,   1544}, {   483,   1613}, {   505,   1684},
-    {   527,   1760}, {   551,   1838}, {   576,   1921}, {   601,   2007},
-    {   628,   2097}, {   656,   2190}, {   686,   2288}, {   716,   2389},
-    {   748,   2496}, {   781,   2607}, {   816,   2724}, {   853,   2846},
-    {   891,   2973}, {   930,   3104}, {   972,   3243}, {  1016,   3389},
-    {  1061,   3539}, {  1108,   3698}, {  1158,   3862}, {  1209,   4035},
-    {  1264,   4216}, {  1320,   4403}, {  1379,   4599}, {  1441,   4806},
-    {  1505,   5019}, {  1572,   5244}, {  1642,   5477}, {  1715,   5722},
-    {  1792,   5978}, {  1872,   6245}, {  1955,   6522}, {  2043,   6813},
-    {  2134,   7118}, {  2229,   7436}, {  2329,   7767}, {  2432,   8114},
-    {  2541,   8477}, {  2655,   8854}, {  2773,   9250}, {  2897,   9663},
-    {  3026,  10094}, {  3162,  10546}, {  3303,  11016}, {  3450,  11508},
-    {  3604,  12020}, {  3765,  12556}, {  3933,  13118}, {  4108,  13703},
-    {  4292,  14315}, {  4483,  14953}, {  4683,  15621}, {  4892,  16318},
-    {  5111,  17046}, {  5339,  17807}, {  5577,  18602}, {  5826,  19433},
-    {  6086,  20300}, {  6358,  21205}, {  6642,  22152}, {  6938,  23141},
-    {  7248,  24173}, {  7571,  25252}, {  7909,  26380}, {  8262,  27557},
-    {  8631,  28786}, {  9016,  30072}, {  9419,  31413}, {  9839,  32767},
-    { 10278,  32767}, { 10737,  32767}, { 11216,  32767}, { 11717,  32767},
-    { 12240,  32767}, { 12786,  32767}, { 13356,  32767}, { 13953,  32767},
-    { 14576,  32767}, { 15226,  32767}, { 15906,  32767}, { 16615,  32767}
-};
-
-static const struct {
-    const int16_t *tab1; const int16_t *tab2; int stride;
-} tabs[] = {
-    {MACEtab1, &MACEtab2[0][0], 4},
-    {MACEtab3, &MACEtab4[0][0], 2},
-    {MACEtab1, &MACEtab2[0][0], 4}
-};
-
-#define QT_8S_2_16S(x) (((x) & 0xFF00) | (((x) >> 8) & 0xFF))
-
-typedef struct ChannelData {
-    int16_t index, factor, prev2, previous, level;
-} ChannelData;
-
-typedef struct MACEContext {
-    ChannelData chd[2];
-} MACEContext;
-
-/**
- * MACE version of av_clip_int16(). We have to do this to keep binary
- * identical output to the binary decoder.
- */
-static inline int16_t mace_broken_clip_int16(int n)
-{
-    if (n > 32767)
-        return 32767;
-    else if (n < -32768)
-        return -32767;
-    else
-        return n;
-}
-
-static int16_t read_table(ChannelData *chd, uint8_t val, int tab_idx)
-{
-    int16_t current;
-
-    if (val < tabs[tab_idx].stride)
-        current = tabs[tab_idx].tab2[((chd->index & 0x7f0) >> 4) * tabs[tab_idx].stride + val];
-    else
-        current = - 1 - tabs[tab_idx].tab2[((chd->index & 0x7f0) >> 4)*tabs[tab_idx].stride + 2*tabs[tab_idx].stride-val-1];
-
-    if (( chd->index += tabs[tab_idx].tab1[val]-(chd->index >> 5) ) < 0)
-      chd->index = 0;
-
-    return current;
-}
-
-static void chomp3(ChannelData *chd, int16_t *output, uint8_t val,
-                   int tab_idx,
-                   uint32_t numChannels)
-{
-
-    int16_t current = read_table(chd, val, tab_idx);
-
-    current = mace_broken_clip_int16(current + chd->level);
-
-    chd->level = current - (current >> 3);
-    *output = QT_8S_2_16S(current);
-}
-
-static void chomp6(ChannelData *chd, int16_t *output, uint8_t val,
-                   int tab_idx,
-                   uint32_t numChannels)
-{
-    int16_t current = read_table(chd, val, tab_idx);
-
-    if ((chd->previous ^ current) >= 0) {
-        chd->factor = FFMIN(chd->factor + 506, 32767);
-    } else {
-        if (chd->factor - 314 < -32768)
-            chd->factor = -32767;
-        else
-            chd->factor -= 314;
-    }
-
-    current = mace_broken_clip_int16(current + chd->level);
-
-    chd->level = (current*chd->factor) >> 15;
-    current >>= 1;
-
-    output[0] = QT_8S_2_16S(chd->previous + chd->prev2 -
-                            ((chd->prev2-current) >> 2));
-    output[numChannels] = QT_8S_2_16S(chd->previous + current +
-                                      ((chd->prev2-current) >> 2));
-    chd->prev2 = chd->previous;
-    chd->previous = current;
-}
-
-static av_cold int mace_decode_init(AVCodecContext * avctx)
-{
-    if (avctx->channels > 2)
-        return -1;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-static int mace_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    int16_t *samples = data;
-    MACEContext *ctx = avctx->priv_data;
-    int i, j, k, l;
-    int is_mace3 = (avctx->codec_id == CODEC_ID_MACE3);
-
-    if (*data_size < (3 * buf_size << (2-is_mace3))) {
-        av_log(avctx, AV_LOG_ERROR, "Output buffer too small!\n");
-        return -1;
-    }
-
-    for(i = 0; i < avctx->channels; i++) {
-        int16_t *output = samples + i;
-
-        for (j=0; j < buf_size / (avctx->channels << is_mace3); j++)
-            for (k=0; k < (1 << is_mace3); k++) {
-                uint8_t pkt = buf[(i << is_mace3) +
-                                  (j*avctx->channels << is_mace3) + k];
-
-                uint8_t val[2][3] = {{pkt >> 5, (pkt >> 3) & 3, pkt & 7 },
-                                     {pkt & 7 , (pkt >> 3) & 3, pkt >> 5}};
-
-                for (l=0; l < 3; l++) {
-                    if (is_mace3)
-                        chomp3(&ctx->chd[i], output, val[1][l], l,
-                               avctx->channels);
-                    else
-                        chomp6(&ctx->chd[i], output, val[0][l], l,
-                               avctx->channels);
-
-                    output += avctx->channels << (1-is_mace3);
-                }
-            }
-    }
-
-    *data_size = 3 * buf_size << (2-is_mace3);
-
-    return buf_size;
-}
-
-AVCodec mace3_decoder = {
-    "mace3",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MACE3,
-    sizeof(MACEContext),
-    mace_decode_init,
-    NULL,
-    NULL,
-    mace_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"),
-};
-
-AVCodec mace6_decoder = {
-    "mace6",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MACE6,
-    sizeof(MACEContext),
-    mace_decode_init,
-    NULL,
-    NULL,
-    mace_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"),
-};
-
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
deleted file mode 100644
index 149910b..0000000
--- a/libavcodec/mathops.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * simple math operations
- * Copyright (c) 2001, 2002 Fabrice Bellard
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVCODEC_MATHOPS_H
-#define AVCODEC_MATHOPS_H
-
-#include "libavutil/common.h"
-
-#if   ARCH_ARM
-#   include "arm/mathops.h"
-#elif ARCH_AVR32
-#   include "avr32/mathops.h"
-#elif ARCH_BFIN
-#   include "bfin/mathops.h"
-#elif ARCH_MIPS
-#   include "mips/mathops.h"
-#elif ARCH_PPC
-#   include "ppc/mathops.h"
-#elif ARCH_X86
-#   include "x86/mathops.h"
-#endif
-
-/* generic implementation */
-
-#ifndef MULL
-#   define MULL(a,b,s) (((int64_t)(a) * (int64_t)(b)) >> (s))
-#endif
-
-#ifndef MULH
-//gcc 3.4 creates an incredibly bloated mess out of this
-//#    define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32)
-
-static av_always_inline int MULH(int a, int b){
-    return ((int64_t)(a) * (int64_t)(b))>>32;
-}
-#endif
-
-#ifndef UMULH
-static av_always_inline unsigned UMULH(unsigned a, unsigned b){
-    return ((uint64_t)(a) * (uint64_t)(b))>>32;
-}
-#endif
-
-#ifndef MUL64
-#   define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
-#endif
-
-#ifndef MAC64
-#   define MAC64(d, a, b) ((d) += MUL64(a, b))
-#endif
-
-#ifndef MLS64
-#   define MLS64(d, a, b) ((d) -= MUL64(a, b))
-#endif
-
-/* signed 16x16 -> 32 multiply add accumulate */
-#ifndef MAC16
-#   define MAC16(rt, ra, rb) rt += (ra) * (rb)
-#endif
-
-/* signed 16x16 -> 32 multiply */
-#ifndef MUL16
-#   define MUL16(ra, rb) ((ra) * (rb))
-#endif
-
-#ifndef MLS16
-#   define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb))
-#endif
-
-/* median of 3 */
-#ifndef mid_pred
-#define mid_pred mid_pred
-static inline av_const int mid_pred(int a, int b, int c)
-{
-#if 0
-    int t= (a-b)&((a-b)>>31);
-    a-=t;
-    b+=t;
-    b-= (b-c)&((b-c)>>31);
-    b+= (a-b)&((a-b)>>31);
-
-    return b;
-#else
-    if(a>b){
-        if(c>b){
-            if(c>a) b=a;
-            else    b=c;
-        }
-    }else{
-        if(b>c){
-            if(c>a) b=c;
-            else    b=a;
-        }
-    }
-    return b;
-#endif
-}
-#endif
-
-#ifndef sign_extend
-static inline av_const int sign_extend(int val, unsigned bits)
-{
-    return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
-}
-#endif
-
-#ifndef zero_extend
-static inline av_const unsigned zero_extend(unsigned val, unsigned bits)
-{
-    return (val << (INT_BIT - bits)) >> (INT_BIT - bits);
-}
-#endif
-
-#ifndef COPY3_IF_LT
-#define COPY3_IF_LT(x, y, a, b, c, d)\
-if ((y) < (x)) {\
-    (x) = (y);\
-    (a) = (b);\
-    (c) = (d);\
-}
-#endif
-
-#ifndef NEG_SSR32
-#   define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
-#endif
-
-#ifndef NEG_USR32
-#   define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
-#endif
-
-#endif /* AVCODEC_MATHOPS_H */
-
diff --git a/libavcodec/mdct.c b/libavcodec/mdct.c
deleted file mode 100644
index 69e1bbf..0000000
--- a/libavcodec/mdct.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * MDCT/IMDCT transforms
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "libavutil/common.h"
-#include "libavutil/mathematics.h"
-#include "fft.h"
-
-/**
- * @file
- * MDCT/IMDCT transforms.
- */
-
-// Generate a Kaiser-Bessel Derived Window.
-#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation
-av_cold void ff_kbd_window_init(float *window, float alpha, int n)
-{
-   int i, j;
-   double sum = 0.0, bessel, tmp;
-   double local_window[n];
-   double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n);
-
-   for (i = 0; i < n; i++) {
-       tmp = i * (n - i) * alpha2;
-       bessel = 1.0;
-       for (j = BESSEL_I0_ITER; j > 0; j--)
-           bessel = bessel * tmp / (j * j) + 1;
-       sum += bessel;
-       local_window[i] = sum;
-   }
-
-   sum++;
-   for (i = 0; i < n; i++)
-       window[i] = sqrt(local_window[i] / sum);
-}
-
-#include "mdct_tablegen.h"
-
-/**
- * init MDCT or IMDCT computation.
- */
-av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale)
-{
-    int n, n4, i;
-    double alpha, theta;
-    int tstep;
-
-    memset(s, 0, sizeof(*s));
-    n = 1 << nbits;
-    s->mdct_bits = nbits;
-    s->mdct_size = n;
-    n4 = n >> 2;
-    s->permutation = FF_MDCT_PERM_NONE;
-
-    if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0)
-        goto fail;
-
-    s->tcos = av_malloc(n/2 * sizeof(FFTSample));
-    if (!s->tcos)
-        goto fail;
-
-    switch (s->permutation) {
-    case FF_MDCT_PERM_NONE:
-        s->tsin = s->tcos + n4;
-        tstep = 1;
-        break;
-    case FF_MDCT_PERM_INTERLEAVE:
-        s->tsin = s->tcos + 1;
-        tstep = 2;
-        break;
-    default:
-        goto fail;
-    }
-
-    theta = 1.0 / 8.0 + (scale < 0 ? n4 : 0);
-    scale = sqrt(fabs(scale));
-    for(i=0;i<n4;i++) {
-        alpha = 2 * M_PI * (i + theta) / n;
-        s->tcos[i*tstep] = -cos(alpha) * scale;
-        s->tsin[i*tstep] = -sin(alpha) * scale;
-    }
-    return 0;
- fail:
-    ff_mdct_end(s);
-    return -1;
-}
-
-/* complex multiplication: p = a * b */
-#define CMUL(pre, pim, are, aim, bre, bim) \
-{\
-    FFTSample _are = (are);\
-    FFTSample _aim = (aim);\
-    FFTSample _bre = (bre);\
-    FFTSample _bim = (bim);\
-    (pre) = _are * _bre - _aim * _bim;\
-    (pim) = _are * _bim + _aim * _bre;\
-}
-
-/**
- * Compute the middle half of the inverse MDCT of size N = 2^nbits,
- * thus excluding the parts that can be derived by symmetry
- * @param output N/2 samples
- * @param input N/2 samples
- */
-void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    int k, n8, n4, n2, n, j;
-    const uint16_t *revtab = s->revtab;
-    const FFTSample *tcos = s->tcos;
-    const FFTSample *tsin = s->tsin;
-    const FFTSample *in1, *in2;
-    FFTComplex *z = (FFTComplex *)output;
-
-    n = 1 << s->mdct_bits;
-    n2 = n >> 1;
-    n4 = n >> 2;
-    n8 = n >> 3;
-
-    /* pre rotation */
-    in1 = input;
-    in2 = input + n2 - 1;
-    for(k = 0; k < n4; k++) {
-        j=revtab[k];
-        CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]);
-        in1 += 2;
-        in2 -= 2;
-    }
-    ff_fft_calc(s, z);
-
-    /* post rotation + reordering */
-    for(k = 0; k < n8; k++) {
-        FFTSample r0, i0, r1, i1;
-        CMUL(r0, i1, z[n8-k-1].im, z[n8-k-1].re, tsin[n8-k-1], tcos[n8-k-1]);
-        CMUL(r1, i0, z[n8+k  ].im, z[n8+k  ].re, tsin[n8+k  ], tcos[n8+k  ]);
-        z[n8-k-1].re = r0;
-        z[n8-k-1].im = i0;
-        z[n8+k  ].re = r1;
-        z[n8+k  ].im = i1;
-    }
-}
-
-/**
- * Compute inverse MDCT of size N = 2^nbits
- * @param output N samples
- * @param input N/2 samples
- */
-void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    int k;
-    int n = 1 << s->mdct_bits;
-    int n2 = n >> 1;
-    int n4 = n >> 2;
-
-    ff_imdct_half_c(s, output+n4, input);
-
-    for(k = 0; k < n4; k++) {
-        output[k] = -output[n2-k-1];
-        output[n-k-1] = output[n2+k];
-    }
-}
-
-/**
- * Compute MDCT of size N = 2^nbits
- * @param input N samples
- * @param out N/2 samples
- */
-void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input)
-{
-    int i, j, n, n8, n4, n2, n3;
-    FFTSample re, im;
-    const uint16_t *revtab = s->revtab;
-    const FFTSample *tcos = s->tcos;
-    const FFTSample *tsin = s->tsin;
-    FFTComplex *x = (FFTComplex *)out;
-
-    n = 1 << s->mdct_bits;
-    n2 = n >> 1;
-    n4 = n >> 2;
-    n8 = n >> 3;
-    n3 = 3 * n4;
-
-    /* pre rotation */
-    for(i=0;i<n8;i++) {
-        re = -input[2*i+3*n4] - input[n3-1-2*i];
-        im = -input[n4+2*i] + input[n4-1-2*i];
-        j = revtab[i];
-        CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
-
-        re = input[2*i] - input[n2-1-2*i];
-        im = -(input[n2+2*i] + input[n-1-2*i]);
-        j = revtab[n8 + i];
-        CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
-    }
-
-    ff_fft_calc(s, x);
-
-    /* post rotation */
-    for(i=0;i<n8;i++) {
-        FFTSample r0, i0, r1, i1;
-        CMUL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]);
-        CMUL(i0, r1, x[n8+i  ].re, x[n8+i  ].im, -tsin[n8+i  ], -tcos[n8+i  ]);
-        x[n8-i-1].re = r0;
-        x[n8-i-1].im = i0;
-        x[n8+i  ].re = r1;
-        x[n8+i  ].im = i1;
-    }
-}
-
-av_cold void ff_mdct_end(FFTContext *s)
-{
-    av_freep(&s->tcos);
-    ff_fft_end(s);
-}
diff --git a/libavcodec/mdct_tablegen.c b/libavcodec/mdct_tablegen.c
deleted file mode 100644
index 6205f06..0000000
--- a/libavcodec/mdct_tablegen.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Generate a header file for hardcoded MDCT tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#define SINETABLE_CONST
-#define SINETABLE(size) \
-    float ff_sine_##size[size]
-#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#include "mdct_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    int i;
-
-    write_fileheader();
-
-    for (i = 5; i <= 12; i++) {
-        ff_init_ff_sine_windows(i);
-        printf("SINETABLE(%4i) = {\n", 1 << i);
-        write_float_array(ff_sine_windows[i], 1 << i);
-        printf("};\n");
-    }
-
-    return 0;
-}
diff --git a/libavcodec/mdct_tablegen.h b/libavcodec/mdct_tablegen.h
deleted file mode 100644
index 1722c3b..0000000
--- a/libavcodec/mdct_tablegen.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Header file for hardcoded MDCT tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <assert.h>
-// do not use libavutil/mathematics.h since this is compiled both
-// for the host and the target and config.h is only valid for the target
-#include <math.h>
-#include "../libavutil/attributes.h"
-
-#if !CONFIG_HARDCODED_TABLES
-SINETABLE(  32);
-SINETABLE(  64);
-SINETABLE( 128);
-SINETABLE( 256);
-SINETABLE( 512);
-SINETABLE(1024);
-SINETABLE(2048);
-SINETABLE(4096);
-#else
-#include "libavcodec/mdct_tables.h"
-#endif
-
-SINETABLE_CONST float * const ff_sine_windows[] = {
-    NULL, NULL, NULL, NULL, NULL, // unused
-    ff_sine_32 , ff_sine_64 ,
-    ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096
-};
-
-// Generate a sine window.
-av_cold void ff_sine_window_init(float *window, int n) {
-    int i;
-    for(i = 0; i < n; i++)
-        window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n)));
-}
-
-av_cold void ff_init_ff_sine_windows(int index) {
-    assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows));
-#if !CONFIG_HARDCODED_TABLES
-    ff_sine_window_init(ff_sine_windows[index], 1 << index);
-#endif
-}
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
deleted file mode 100644
index 606a749..0000000
--- a/libavcodec/mdec.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Sony PlayStation MDEC (Motion DECoder)
- * Copyright (c) 2003 Michael Niedermayer
- *
- * based upon code from Sebastian Jedruszkiewicz <elf at frogger.rules.pl>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sony PlayStation MDEC (Motion DECoder)
- * This is very similar to intra-only MPEG-1.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mpeg12.h"
-
-typedef struct MDECContext{
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame picture;
-    GetBitContext gb;
-    ScanTable scantable;
-    int version;
-    int qscale;
-    int last_dc[3];
-    int mb_width;
-    int mb_height;
-    int mb_x, mb_y;
-    DECLARE_ALIGNED(16, DCTELEM, block)[6][64];
-    uint8_t *bitstream_buffer;
-    unsigned int bitstream_buffer_size;
-    int block_last_index[6];
-} MDECContext;
-
-//very similar to MPEG-1
-static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n)
-{
-    int level, diff, i, j, run;
-    int component;
-    RLTable *rl = &ff_rl_mpeg1;
-    uint8_t * const scantable= a->scantable.permutated;
-    const uint16_t *quant_matrix= ff_mpeg1_default_intra_matrix;
-    const int qscale= a->qscale;
-
-    /* DC coefficient */
-    if(a->version==2){
-        block[0]= 2*get_sbits(&a->gb, 10) + 1024;
-    }else{
-        component = (n <= 3 ? 0 : n - 4 + 1);
-        diff = decode_dc(&a->gb, component);
-        if (diff >= 0xffff)
-            return -1;
-        a->last_dc[component]+= diff;
-        block[0] = a->last_dc[component]<<3;
-    }
-
-    i = 0;
-    {
-        OPEN_READER(re, &a->gb);
-        /* now quantify & encode AC coefficients */
-        for(;;) {
-            UPDATE_CACHE(re, &a->gb);
-            GET_RL_VLC(level, run, re, &a->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if(level == 127){
-                break;
-            } else if(level != 0) {
-                i += run;
-                j = scantable[i];
-                level= (level*qscale*quant_matrix[j])>>3;
-                level = (level ^ SHOW_SBITS(re, &a->gb, 1)) - SHOW_SBITS(re, &a->gb, 1);
-                LAST_SKIP_BITS(re, &a->gb, 1);
-            } else {
-                /* escape */
-                run = SHOW_UBITS(re, &a->gb, 6)+1; LAST_SKIP_BITS(re, &a->gb, 6);
-                UPDATE_CACHE(re, &a->gb);
-                level = SHOW_SBITS(re, &a->gb, 10); SKIP_BITS(re, &a->gb, 10);
-                i += run;
-                j = scantable[i];
-                if(level<0){
-                    level= -level;
-                    level= (level*qscale*quant_matrix[j])>>3;
-                    level= (level-1)|1;
-                    level= -level;
-                }else{
-                    level= (level*qscale*quant_matrix[j])>>3;
-                    level= (level-1)|1;
-                }
-            }
-            if (i > 63){
-                av_log(a->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", a->mb_x, a->mb_y);
-                return -1;
-            }
-
-            block[j] = level;
-        }
-        CLOSE_READER(re, &a->gb);
-    }
-    a->block_last_index[n] = i;
-    return 0;
-}
-
-static inline int decode_mb(MDECContext *a, DCTELEM block[6][64]){
-    int i;
-    const int block_index[6]= {5,4,0,1,2,3};
-
-    a->dsp.clear_blocks(block[0]);
-
-    for(i=0; i<6; i++){
-        if( mdec_decode_block_intra(a, block[ block_index[i] ], block_index[i]) < 0)
-            return -1;
-    }
-    return 0;
-}
-
-static inline void idct_put(MDECContext *a, int mb_x, int mb_y){
-    DCTELEM (*block)[64]= a->block;
-    int linesize= a->picture.linesize[0];
-
-    uint8_t *dest_y  = a->picture.data[0] + (mb_y * 16* linesize              ) + mb_x * 16;
-    uint8_t *dest_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8;
-    uint8_t *dest_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8;
-
-    a->dsp.idct_put(dest_y                 , linesize, block[0]);
-    a->dsp.idct_put(dest_y              + 8, linesize, block[1]);
-    a->dsp.idct_put(dest_y + 8*linesize    , linesize, block[2]);
-    a->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
-
-    if(!(a->avctx->flags&CODEC_FLAG_GRAY)){
-        a->dsp.idct_put(dest_cb, a->picture.linesize[1], block[4]);
-        a->dsp.idct_put(dest_cr, a->picture.linesize[2], block[5]);
-    }
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MDECContext * const a = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p= &a->picture;
-    int i;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!a->bitstream_buffer)
-        return AVERROR(ENOMEM);
-    for(i=0; i<buf_size; i+=2){
-        a->bitstream_buffer[i]  = buf[i+1];
-        a->bitstream_buffer[i+1]= buf[i  ];
-    }
-    init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8);
-
-    /* skip over 4 preamble bytes in stream (typically 0xXX 0xXX 0x00 0x38) */
-    skip_bits(&a->gb, 32);
-
-    a->qscale=  get_bits(&a->gb, 16);
-    a->version= get_bits(&a->gb, 16);
-
-    a->last_dc[0]=
-    a->last_dc[1]=
-    a->last_dc[2]= 128;
-
-    for(a->mb_x=0; a->mb_x<a->mb_width; a->mb_x++){
-        for(a->mb_y=0; a->mb_y<a->mb_height; a->mb_y++){
-            if( decode_mb(a, a->block) <0)
-                return -1;
-
-            idct_put(a, a->mb_x, a->mb_y);
-        }
-    }
-
-    p->quality= a->qscale * FF_QP2LAMBDA;
-    memset(p->qscale_table, a->qscale, a->mb_width);
-
-    *picture   = a->picture;
-    *data_size = sizeof(AVPicture);
-
-    return (get_bits_count(&a->gb)+31)/32*4;
-}
-
-static av_cold void mdec_common_init(AVCodecContext *avctx){
-    MDECContext * const a = avctx->priv_data;
-
-    dsputil_init(&a->dsp, avctx);
-
-    a->mb_width   = (avctx->coded_width  + 15) / 16;
-    a->mb_height  = (avctx->coded_height + 15) / 16;
-
-    avctx->coded_frame= &a->picture;
-    a->avctx= avctx;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-    MDECContext * const a = avctx->priv_data;
-    AVFrame *p= &a->picture;
-
-    mdec_common_init(avctx);
-    ff_mpeg12_init_vlcs();
-    ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_zigzag_direct);
-
-    p->qstride= 0;
-    p->qscale_table= av_mallocz(a->mb_width);
-    avctx->pix_fmt= PIX_FMT_YUV420P;
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    MDECContext * const a = avctx->priv_data;
-
-    if(a->picture.data[0])
-        avctx->release_buffer(avctx, &a->picture);
-    av_freep(&a->bitstream_buffer);
-    av_freep(&a->picture.qscale_table);
-    a->bitstream_buffer_size=0;
-
-    return 0;
-}
-
-AVCodec mdec_decoder = {
-    "mdec",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MDEC,
-    sizeof(MDECContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"),
-};
-
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
deleted file mode 100644
index e5f7123..0000000
--- a/libavcodec/mimic.c
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Copyright (C) 2005  Ole André Vadla Ravnås <oleavr at gmail.com>
- * Copyright (C) 2008  Ramiro Polla <ramiro at lisha.ufsc.br>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "bytestream.h"
-#include "dsputil.h"
-
-#define MIMIC_HEADER_SIZE   20
-
-typedef struct {
-    AVCodecContext *avctx;
-
-    int             num_vblocks[3];
-    int             num_hblocks[3];
-
-    void           *swap_buf;
-    int             swap_buf_size;
-
-    int             cur_index;
-    int             prev_index;
-
-    AVFrame         buf_ptrs    [16];
-    AVPicture       flipped_ptrs[16];
-
-    DECLARE_ALIGNED(16, DCTELEM, dct_block)[64];
-
-    GetBitContext   gb;
-    ScanTable       scantable;
-    DSPContext      dsp;
-    VLC             vlc;
-} MimicContext;
-
-static const uint32_t huffcodes[] = {
-    0x0000000a, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
-    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000b,
-    0x0000001b, 0x00000038, 0x00000078, 0x00000079, 0x0000007a, 0x000000f9,
-    0x000000fa, 0x000003fb, 0x000007f8, 0x000007f9, 0x000007fa, 0x000007fb,
-    0x00000ff8, 0x00000ff9, 0x00000001, 0x00000039, 0x0000007b, 0x000000fb,
-    0x000001f8, 0x000001f9, 0x00000ffa, 0x00000ffb, 0x00001ff8, 0x00001ff9,
-    0x00001ffa, 0x00001ffb, 0x00003ff8, 0x00003ff9, 0x00003ffa, 0x00000000,
-    0x00000004, 0x0000003a, 0x000001fa, 0x00003ffb, 0x00007ff8, 0x00007ff9,
-    0x00007ffa, 0x00007ffb, 0x0000fff8, 0x0000fff9, 0x0000fffa, 0x0000fffb,
-    0x0001fff8, 0x0001fff9, 0x0001fffa, 0x00000000, 0x0000000c, 0x000000f8,
-    0x000001fb, 0x0001fffb, 0x0003fff8, 0x0003fff9, 0x0003fffa, 0x0003fffb,
-    0x0007fff8, 0x0007fff9, 0x0007fffa, 0x0007fffb, 0x000ffff8, 0x000ffff9,
-    0x000ffffa, 0x00000000, 0x0000001a, 0x000003f8, 0x000ffffb, 0x001ffff8,
-    0x001ffff9, 0x001ffffa, 0x001ffffb, 0x003ffff8, 0x003ffff9, 0x003ffffa,
-    0x003ffffb, 0x007ffff8, 0x007ffff9, 0x007ffffa, 0x007ffffb, 0x00000000,
-    0x0000003b, 0x000003f9, 0x00fffff8, 0x00fffff9, 0x00fffffa, 0x00fffffb,
-    0x01fffff8, 0x01fffff9, 0x01fffffa, 0x01fffffb, 0x03fffff8, 0x03fffff9,
-    0x03fffffa, 0x03fffffb, 0x07fffff8, 0x00000000, 0x000003fa, 0x07fffff9,
-    0x07fffffa, 0x07fffffb, 0x0ffffff8, 0x0ffffff9, 0x0ffffffa, 0x0ffffffb,
-    0x1ffffff8, 0x1ffffff9, 0x1ffffffa, 0x1ffffffb, 0x3ffffff8, 0x3ffffff9,
-    0x3ffffffa,
-};
-
-static const uint8_t huffbits[] = {
-     4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  2,  4,  5,  6,  7,  7,  7,  8,
-     8, 10, 11, 11, 11, 11, 12, 12,  2,  6,  7,  8,
-     9,  9, 12, 12, 13, 13, 13, 13, 14, 14, 14,  0,
-     3,  6,  9, 14, 15, 15, 15, 15, 16, 16, 16, 16,
-    17, 17, 17,  0,  4,  8,  9, 17, 18, 18, 18, 18,
-    19, 19, 19, 19, 20, 20, 20,  0,  5, 10, 20, 21,
-    21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23,  0,
-     6, 10, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26,
-    26, 26, 27,  0, 10, 27, 27, 27, 28, 28, 28, 28,
-    29, 29, 29, 29, 30, 30, 30,
-};
-
-static const uint8_t col_zag[64] = {
-     0,  8,  1,  2,  9, 16, 24, 17,
-    10,  3,  4, 11, 18, 25, 32, 40,
-    33, 26, 19, 12,  5,  6, 13, 20,
-    27, 34, 41, 48, 56, 49, 42, 35,
-    28, 21, 14,  7, 15, 22, 29, 36,
-    43, 50, 57, 58, 51, 44, 37, 30,
-    23, 31, 38, 45, 52, 59, 39, 46,
-    53, 60, 61, 54, 47, 55, 62, 63,
-};
-
-static av_cold int mimic_decode_init(AVCodecContext *avctx)
-{
-    MimicContext *ctx = avctx->priv_data;
-
-    ctx->prev_index = 0;
-    ctx->cur_index = 15;
-
-    if(init_vlc(&ctx->vlc, 11, FF_ARRAY_ELEMS(huffbits),
-                 huffbits, 1, 1, huffcodes, 4, 4, 0)) {
-        av_log(avctx, AV_LOG_ERROR, "error initializing vlc table\n");
-        return -1;
-    }
-    dsputil_init(&ctx->dsp, avctx);
-    ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, col_zag);
-
-    return 0;
-}
-
-static const int8_t vlcdec_lookup[9][64] = {
-    {    0, },
-    {   -1,   1, },
-    {   -3,   3,   -2,   2, },
-    {   -7,   7,   -6,   6,   -5,   5,   -4,   4, },
-    {  -15,  15,  -14,  14,  -13,  13,  -12,  12,
-       -11,  11,  -10,  10,   -9,   9,   -8,   8, },
-    {  -31,  31,  -30,  30,  -29,  29,  -28,  28,
-       -27,  27,  -26,  26,  -25,  25,  -24,  24,
-       -23,  23,  -22,  22,  -21,  21,  -20,  20,
-       -19,  19,  -18,  18,  -17,  17,  -16,  16, },
-    {  -63,  63,  -62,  62,  -61,  61,  -60,  60,
-       -59,  59,  -58,  58,  -57,  57,  -56,  56,
-       -55,  55,  -54,  54,  -53,  53,  -52,  52,
-       -51,  51,  -50,  50,  -49,  49,  -48,  48,
-       -47,  47,  -46,  46,  -45,  45,  -44,  44,
-       -43,  43,  -42,  42,  -41,  41,  -40,  40,
-       -39,  39,  -38,  38,  -37,  37,  -36,  36,
-       -35,  35,  -34,  34,  -33,  33,  -32,  32, },
-    { -127, 127, -126, 126, -125, 125, -124, 124,
-      -123, 123, -122, 122, -121, 121, -120, 120,
-      -119, 119, -118, 118, -117, 117, -116, 116,
-      -115, 115, -114, 114, -113, 113, -112, 112,
-      -111, 111, -110, 110, -109, 109, -108, 108,
-      -107, 107, -106, 106, -105, 105, -104, 104,
-      -103, 103, -102, 102, -101, 101, -100, 100,
-       -99,  99,  -98,  98,  -97,  97,  -96,  96, },
-    {  -95,  95,  -94,  94,  -93,  93,  -92,  92,
-       -91,  91,  -90,  90,  -89,  89,  -88,  88,
-       -87,  87,  -86,  86,  -85,  85,  -84,  84,
-       -83,  83,  -82,  82,  -81,  81,  -80,  80,
-       -79,  79,  -78,  78,  -77,  77,  -76,  76,
-       -75,  75,  -74,  74,  -73,  73,  -72,  72,
-       -71,  71,  -70,  70,  -69,  69,  -68,  68,
-       -67,  67,  -66,  66,  -65,  65,  -64,  64, },
-};
-
-static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale)
-{
-    DCTELEM *block = ctx->dct_block;
-    unsigned int pos;
-
-    ctx->dsp.clear_block(block);
-
-    block[0] = get_bits(&ctx->gb, 8) << 3;
-
-    for(pos = 1; pos < num_coeffs; pos++) {
-        uint32_t vlc, num_bits;
-        int value;
-        int coeff;
-
-        vlc = get_vlc2(&ctx->gb, ctx->vlc.table, ctx->vlc.bits, 3);
-        if(!vlc) /* end-of-block code */
-            return 1;
-        if(vlc == -1)
-            return 0;
-
-        /* pos_add and num_bits are coded in the vlc code */
-        pos +=     vlc&15; // pos_add
-        num_bits = vlc>>4; // num_bits
-
-        if(pos >= 64)
-            return 0;
-
-        value = get_bits(&ctx->gb, num_bits);
-
-        /* FFmpeg's IDCT behaves somewhat different from the original code, so
-         * a factor of 4 was added to the input */
-
-        coeff = vlcdec_lookup[num_bits][value];
-        if(pos<3)
-            coeff <<= 4;
-        else /* TODO Use >> 10 instead of / 1001 */
-            coeff = (coeff * qscale) / 1001;
-
-        block[ctx->scantable.permutated[pos]] = coeff;
-    }
-
-    return 1;
-}
-
-static int decode(MimicContext *ctx, int quality, int num_coeffs,
-                  int is_iframe)
-{
-    int y, x, plane;
-
-    for(plane = 0; plane < 3; plane++) {
-        const int is_chroma = !!plane;
-        const int qscale = av_clip(10000-quality,is_chroma?1000:2000,10000)<<2;
-        const int stride = ctx->flipped_ptrs[ctx->cur_index].linesize[plane];
-        const uint8_t *src = ctx->flipped_ptrs[ctx->prev_index].data[plane];
-        uint8_t       *dst = ctx->flipped_ptrs[ctx->cur_index ].data[plane];
-
-        for(y = 0; y < ctx->num_vblocks[plane]; y++) {
-            for(x = 0; x < ctx->num_hblocks[plane]; x++) {
-
-                /* Check for a change condition in the current block.
-                 * - iframes always change.
-                 * - Luma plane changes on get_bits1 == 0
-                 * - Chroma planes change on get_bits1 == 1 */
-                if(is_iframe || get_bits1(&ctx->gb) == is_chroma) {
-
-                    /* Luma planes may use a backreference from the 15 last
-                     * frames preceding the previous. (get_bits1 == 1)
-                     * Chroma planes don't use backreferences. */
-                    if(is_chroma || is_iframe || !get_bits1(&ctx->gb)) {
-
-                        if(!vlc_decode_block(ctx, num_coeffs, qscale))
-                            return 0;
-                        ctx->dsp.idct_put(dst, stride, ctx->dct_block);
-                    } else {
-                        unsigned int backref = get_bits(&ctx->gb, 4);
-                        int index = (ctx->cur_index+backref)&15;
-                        uint8_t *p = ctx->flipped_ptrs[index].data[0];
-
-                        if(p) {
-                            p += src -
-                                ctx->flipped_ptrs[ctx->prev_index].data[plane];
-                            ctx->dsp.put_pixels_tab[1][0](dst, p, stride, 8);
-                        } else {
-                            av_log(ctx->avctx, AV_LOG_ERROR,
-                                     "No such backreference! Buggy sample.\n");
-                        }
-                    }
-                } else {
-                    ctx->dsp.put_pixels_tab[1][0](dst, src, stride, 8);
-                }
-                src += 8;
-                dst += 8;
-            }
-            src += (stride - ctx->num_hblocks[plane])<<3;
-            dst += (stride - ctx->num_hblocks[plane])<<3;
-        }
-    }
-
-    return 1;
-}
-
-/**
- * Flip the buffer upside-down and put it in the YVU order to match the
- * way Mimic encodes frames.
- */
-static void prepare_avpic(MimicContext *ctx, AVPicture *dst, AVPicture *src)
-{
-    int i;
-    dst->data[0] = src->data[0]+( ctx->avctx->height    -1)*src->linesize[0];
-    dst->data[1] = src->data[2]+((ctx->avctx->height>>1)-1)*src->linesize[2];
-    dst->data[2] = src->data[1]+((ctx->avctx->height>>1)-1)*src->linesize[1];
-    for(i = 0; i < 3; i++)
-        dst->linesize[i] = -src->linesize[i];
-}
-
-static int mimic_decode_frame(AVCodecContext *avctx, void *data,
-                              int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MimicContext *ctx = avctx->priv_data;
-    int is_pframe;
-    int width, height;
-    int quality, num_coeffs;
-    int swap_buf_size = buf_size - MIMIC_HEADER_SIZE;
-
-    if(buf_size < MIMIC_HEADER_SIZE) {
-        av_log(avctx, AV_LOG_ERROR, "insufficient data\n");
-        return -1;
-    }
-
-    buf       += 2; /* some constant (always 256) */
-    quality    = bytestream_get_le16(&buf);
-    width      = bytestream_get_le16(&buf);
-    height     = bytestream_get_le16(&buf);
-    buf       += 4; /* some constant */
-    is_pframe  = bytestream_get_le32(&buf);
-    num_coeffs = bytestream_get_byte(&buf);
-    buf       += 3; /* some constant */
-
-    if(!ctx->avctx) {
-        int i;
-
-        if(!(width == 160 && height == 120) &&
-           !(width == 320 && height == 240)) {
-            av_log(avctx, AV_LOG_ERROR, "invalid width/height!\n");
-            return -1;
-        }
-
-        ctx->avctx     = avctx;
-        avctx->width   = width;
-        avctx->height  = height;
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-        for(i = 0; i < 3; i++) {
-            ctx->num_vblocks[i] = -((-height) >> (3 + !!i));
-            ctx->num_hblocks[i] =     width   >> (3 + !!i) ;
-        }
-    } else if(width != ctx->avctx->width || height != ctx->avctx->height) {
-        av_log(avctx, AV_LOG_ERROR, "resolution changing is not supported\n");
-        return -1;
-    }
-
-    if(is_pframe && !ctx->buf_ptrs[ctx->prev_index].data[0]) {
-        av_log(avctx, AV_LOG_ERROR, "decoding must start with keyframe\n");
-        return -1;
-    }
-
-    ctx->buf_ptrs[ctx->cur_index].reference = 1;
-    if(avctx->get_buffer(avctx, &ctx->buf_ptrs[ctx->cur_index])) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    prepare_avpic(ctx, &ctx->flipped_ptrs[ctx->cur_index],
-                  (AVPicture*) &ctx->buf_ptrs[ctx->cur_index]);
-
-    av_fast_malloc(&ctx->swap_buf, &ctx->swap_buf_size,
-                                 swap_buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if(!ctx->swap_buf)
-        return AVERROR(ENOMEM);
-
-    ctx->dsp.bswap_buf(ctx->swap_buf,
-                        (const uint32_t*) buf,
-                        swap_buf_size>>2);
-    init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3);
-
-    if(!decode(ctx, quality, num_coeffs, !is_pframe)) {
-        avctx->release_buffer(avctx, &ctx->buf_ptrs[ctx->cur_index]);
-        return -1;
-    }
-
-    ctx->buf_ptrs[ctx->cur_index].pict_type = is_pframe ? FF_P_TYPE:FF_I_TYPE;
-    *(AVFrame*)data = ctx->buf_ptrs[ctx->cur_index];
-    *data_size = sizeof(AVFrame);
-
-    ctx->prev_index = ctx->cur_index;
-    ctx->cur_index--;
-    ctx->cur_index &= 15;
-
-    /* Only release frames that aren't used for backreferences anymore */
-    if(ctx->buf_ptrs[ctx->cur_index].data[0])
-        avctx->release_buffer(avctx, &ctx->buf_ptrs[ctx->cur_index]);
-
-    return buf_size;
-}
-
-static av_cold int mimic_decode_end(AVCodecContext *avctx)
-{
-    MimicContext *ctx = avctx->priv_data;
-    int i;
-
-    av_free(ctx->swap_buf);
-    for(i = 0; i < 16; i++)
-        if(ctx->buf_ptrs[i].data[0])
-            avctx->release_buffer(avctx, &ctx->buf_ptrs[i]);
-    free_vlc(&ctx->vlc);
-
-    return 0;
-}
-
-AVCodec mimic_decoder = {
-    "mimic",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MIMIC,
-    sizeof(MimicContext),
-    mimic_decode_init,
-    NULL,
-    mimic_decode_end,
-    mimic_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Mimic"),
-};
diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
deleted file mode 100644
index 3f4da68..0000000
--- a/libavcodec/mips/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-OBJS-$(HAVE_MMI)                       += ps2/dsputil_mmi.o             \
-                                          ps2/idct_mmi.o                \
-                                          ps2/mpegvideo_mmi.o           \
diff --git a/libavcodec/mips/mathops.h b/libavcodec/mips/mathops.h
deleted file mode 100644
index a1b04ed..0000000
--- a/libavcodec/mips/mathops.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MIPS_MATHOPS_H
-#define AVCODEC_MIPS_MATHOPS_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/common.h"
-
-#if HAVE_LOONGSON
-
-static inline av_const int64_t MAC64(int64_t d, int a, int b)
-{
-    int64_t m;
-    __asm__ ("dmult.g %1, %2, %3 \n\t"
-             "daddu   %0, %0, %1 \n\t"
-             : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
-    return d;
-}
-#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
-
-static inline av_const int64_t MLS64(int64_t d, int a, int b)
-{
-    int64_t m;
-    __asm__ ("dmult.g %1, %2, %3 \n\t"
-             "dsubu   %0, %0, %1 \n\t"
-             : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
-    return d;
-}
-#define MLS64(d, a, b) ((d) = MLS64(d, a, b))
-
-#elif ARCH_MIPS64
-
-static inline av_const int64_t MAC64(int64_t d, int a, int b)
-{
-    int64_t m;
-    __asm__ ("dmult %2, %3     \n\t"
-             "mflo  %1         \n\t"
-             "daddu %0, %0, %1 \n\t"
-             : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
-    return d;
-}
-#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
-
-static inline av_const int64_t MLS64(int64_t d, int a, int b)
-{
-    int64_t m;
-    __asm__ ("dmult %2, %3     \n\t"
-             "mflo  %1         \n\t"
-             "dsubu %0, %0, %1 \n\t"
-             : "+r"(d), "=&r"(m) : "r"(a), "r"(b));
-    return d;
-}
-#define MLS64(d, a, b) ((d) = MLS64(d, a, b))
-
-#endif
-
-#endif /* AVCODEC_MIPS_MATHOPS_H */
diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c
deleted file mode 100644
index 6eba27d..0000000
--- a/libavcodec/mjpeg.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * MJPEG encoder and decoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * Support for external huffman table, various fixes (AVID workaround),
- * aspecting, new decode_frame mechanism and apple mjpeg-b support
- *                                  by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG encoder and decoder.
- */
-
-#include "mjpeg.h"
-
-
-#if 0
-/* These are the sample quantization tables given in JPEG spec section K.1.
- * The spec says that the values given produce "good" quality, and
- * when divided by 2, "very good" quality.
- */
-const unsigned char std_luminance_quant_tbl[64] = {
-    16,  11,  10,  16,  24,  40,  51,  61,
-    12,  12,  14,  19,  26,  58,  60,  55,
-    14,  13,  16,  24,  40,  57,  69,  56,
-    14,  17,  22,  29,  51,  87,  80,  62,
-    18,  22,  37,  56,  68, 109, 103,  77,
-    24,  35,  55,  64,  81, 104, 113,  92,
-    49,  64,  78,  87, 103, 121, 120, 101,
-    72,  92,  95,  98, 112, 100, 103,  99
-};
-const unsigned char std_chrominance_quant_tbl[64] = {
-    17,  18,  24,  47,  99,  99,  99,  99,
-    18,  21,  26,  66,  99,  99,  99,  99,
-    24,  26,  56,  99,  99,  99,  99,  99,
-    47,  66,  99,  99,  99,  99,  99,  99,
-    99,  99,  99,  99,  99,  99,  99,  99,
-    99,  99,  99,  99,  99,  99,  99,  99,
-    99,  99,  99,  99,  99,  99,  99,  99,
-    99,  99,  99,  99,  99,  99,  99,  99
-};
-#endif
-
-/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
-/* IMPORTANT: these are only valid for 8-bit data precision! */
-const uint8_t ff_mjpeg_bits_dc_luminance[17] =
-{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
-const uint8_t ff_mjpeg_val_dc[12] =
-{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-
-const uint8_t ff_mjpeg_bits_dc_chrominance[17] =
-{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
-
-const uint8_t ff_mjpeg_bits_ac_luminance[17] =
-{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
-const uint8_t ff_mjpeg_val_ac_luminance[] =
-{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
-  0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
-  0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
-  0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
-  0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
-  0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
-  0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
-  0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
-  0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
-  0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
-  0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
-  0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
-  0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
-  0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
-  0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
-  0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
-  0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
-  0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
-  0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
-  0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
-  0xf9, 0xfa
-};
-
-const uint8_t ff_mjpeg_bits_ac_chrominance[17] =
-{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
-
-const uint8_t ff_mjpeg_val_ac_chrominance[] =
-{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
-  0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
-  0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
-  0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
-  0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
-  0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
-  0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
-  0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
-  0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
-  0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
-  0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
-  0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-  0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
-  0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
-  0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
-  0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
-  0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
-  0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
-  0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
-  0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
-  0xf9, 0xfa
-};
-
-/* isn't this function nicer than the one in the libjpeg ? */
-void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
-                                  const uint8_t *bits_table,
-                                  const uint8_t *val_table)
-{
-    int i, j, k,nb, code, sym;
-
-    code = 0;
-    k = 0;
-    for(i=1;i<=16;i++) {
-        nb = bits_table[i];
-        for(j=0;j<nb;j++) {
-            sym = val_table[k++];
-            huff_size[sym] = i;
-            huff_code[sym] = code;
-            code++;
-        }
-        code <<= 1;
-    }
-}
diff --git a/libavcodec/mjpeg.h b/libavcodec/mjpeg.h
deleted file mode 100644
index 3c88471..0000000
--- a/libavcodec/mjpeg.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * MJPEG encoder and decoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * Support for external huffman table, various fixes (AVID workaround),
- * aspecting, new decode_frame mechanism and apple mjpeg-b support
- *                                  by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG encoder and decoder.
- */
-
-#ifndef AVCODEC_MJPEG_H
-#define AVCODEC_MJPEG_H
-
-#include "avcodec.h"
-#include "put_bits.h"
-
-
-/* JPEG marker codes */
-typedef enum {
-    /* start of frame */
-    SOF0  = 0xc0,       /* baseline */
-    SOF1  = 0xc1,       /* extended sequential, huffman */
-    SOF2  = 0xc2,       /* progressive, huffman */
-    SOF3  = 0xc3,       /* lossless, huffman */
-
-    SOF5  = 0xc5,       /* differential sequential, huffman */
-    SOF6  = 0xc6,       /* differential progressive, huffman */
-    SOF7  = 0xc7,       /* differential lossless, huffman */
-    JPG   = 0xc8,       /* reserved for JPEG extension */
-    SOF9  = 0xc9,       /* extended sequential, arithmetic */
-    SOF10 = 0xca,       /* progressive, arithmetic */
-    SOF11 = 0xcb,       /* lossless, arithmetic */
-
-    SOF13 = 0xcd,       /* differential sequential, arithmetic */
-    SOF14 = 0xce,       /* differential progressive, arithmetic */
-    SOF15 = 0xcf,       /* differential lossless, arithmetic */
-
-    DHT   = 0xc4,       /* define huffman tables */
-
-    DAC   = 0xcc,       /* define arithmetic-coding conditioning */
-
-    /* restart with modulo 8 count "m" */
-    RST0  = 0xd0,
-    RST1  = 0xd1,
-    RST2  = 0xd2,
-    RST3  = 0xd3,
-    RST4  = 0xd4,
-    RST5  = 0xd5,
-    RST6  = 0xd6,
-    RST7  = 0xd7,
-
-    SOI   = 0xd8,       /* start of image */
-    EOI   = 0xd9,       /* end of image */
-    SOS   = 0xda,       /* start of scan */
-    DQT   = 0xdb,       /* define quantization tables */
-    DNL   = 0xdc,       /* define number of lines */
-    DRI   = 0xdd,       /* define restart interval */
-    DHP   = 0xde,       /* define hierarchical progression */
-    EXP   = 0xdf,       /* expand reference components */
-
-    APP0  = 0xe0,
-    APP1  = 0xe1,
-    APP2  = 0xe2,
-    APP3  = 0xe3,
-    APP4  = 0xe4,
-    APP5  = 0xe5,
-    APP6  = 0xe6,
-    APP7  = 0xe7,
-    APP8  = 0xe8,
-    APP9  = 0xe9,
-    APP10 = 0xea,
-    APP11 = 0xeb,
-    APP12 = 0xec,
-    APP13 = 0xed,
-    APP14 = 0xee,
-    APP15 = 0xef,
-
-    JPG0  = 0xf0,
-    JPG1  = 0xf1,
-    JPG2  = 0xf2,
-    JPG3  = 0xf3,
-    JPG4  = 0xf4,
-    JPG5  = 0xf5,
-    JPG6  = 0xf6,
-    SOF48 = 0xf7,       ///< JPEG-LS
-    LSE   = 0xf8,       ///< JPEG-LS extension parameters
-    JPG9  = 0xf9,
-    JPG10 = 0xfa,
-    JPG11 = 0xfb,
-    JPG12 = 0xfc,
-    JPG13 = 0xfd,
-
-    COM   = 0xfe,       /* comment */
-
-    TEM   = 0x01,       /* temporary private use for arithmetic coding */
-
-    /* 0x02 -> 0xbf reserved */
-} JPEG_MARKER;
-
-static inline void put_marker(PutBitContext *p, int code)
-{
-    put_bits(p, 8, 0xff);
-    put_bits(p, 8, code);
-}
-
-#define PREDICT(ret, topleft, top, left, predictor)\
-    switch(predictor){\
-        case 1: ret= left; break;\
-        case 2: ret= top; break;\
-        case 3: ret= topleft; break;\
-        case 4: ret= left   +   top - topleft; break;\
-        case 5: ret= left   + ((top - topleft)>>1); break;\
-        case 6: ret= top + ((left   - topleft)>>1); break;\
-        default:\
-        case 7: ret= (left + top)>>1; break;\
-    }
-
-extern const uint8_t ff_mjpeg_bits_dc_luminance[];
-extern const uint8_t ff_mjpeg_val_dc[];
-
-extern const uint8_t ff_mjpeg_bits_dc_chrominance[];
-
-extern const uint8_t ff_mjpeg_bits_ac_luminance[];
-extern const uint8_t ff_mjpeg_val_ac_luminance[];
-
-extern const uint8_t ff_mjpeg_bits_ac_chrominance[];
-extern const uint8_t ff_mjpeg_val_ac_chrominance[];
-
-void ff_mjpeg_build_huffman_codes(uint8_t *huff_size, uint16_t *huff_code,
-                                  const uint8_t *bits_table,
-                                  const uint8_t *val_table);
-
-#endif /* AVCODEC_MJPEG_H */
diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c
deleted file mode 100644
index b1848fa..0000000
--- a/libavcodec/mjpeg_parser.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * MJPEG parser
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG parser.
- */
-
-#include "parser.h"
-
-
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-static int find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
-    int vop_found, i;
-    uint16_t state;
-
-    vop_found= pc->frame_start_found;
-    state= pc->state;
-
-    i=0;
-    if(!vop_found){
-        for(i=0; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(state == 0xFFD8){
-                i++;
-                vop_found=1;
-                break;
-            }
-        }
-    }
-
-    if(vop_found){
-        /* EOF considered as end of frame */
-        if (buf_size == 0)
-            return 0;
-        for(; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(state == 0xFFD8){
-                pc->frame_start_found=0;
-                pc->state=0;
-                return i-1;
-            }
-        }
-    }
-    pc->frame_start_found= vop_found;
-    pc->state= state;
-    return END_NOT_FOUND;
-}
-
-static int jpeg_parse(AVCodecParserContext *s,
-                      AVCodecContext *avctx,
-                      const uint8_t **poutbuf, int *poutbuf_size,
-                      const uint8_t *buf, int buf_size)
-{
-    ParseContext *pc = s->priv_data;
-    int next;
-
-    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
-        next= buf_size;
-    }else{
-        next= find_frame_end(pc, buf, buf_size);
-
-        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-    }
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-
-AVCodecParser mjpeg_parser = {
-    { CODEC_ID_MJPEG },
-    sizeof(ParseContext),
-    NULL,
-    jpeg_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/mjpega_dump_header_bsf.c b/libavcodec/mjpega_dump_header_bsf.c
deleted file mode 100644
index bb7858e..0000000
--- a/libavcodec/mjpega_dump_header_bsf.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * MJPEG A dump header bitstream filter
- * Copyright (c) 2006 Baptiste Coudurier
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG A dump header bitstream filter
- * modifies bitstream to be decoded by quicktime
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "mjpeg.h"
-
-
-static int mjpega_dump_header(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                              uint8_t **poutbuf, int *poutbuf_size,
-                              const uint8_t *buf, int buf_size, int keyframe)
-{
-    uint8_t *poutbufp;
-    unsigned dqt = 0, dht = 0, sof0 = 0;
-    int i;
-
-    if (avctx->codec_id != CODEC_ID_MJPEG) {
-        av_log(avctx, AV_LOG_ERROR, "mjpega bitstream filter only applies to mjpeg codec\n");
-        return 0;
-    }
-
-    *poutbuf_size = 0;
-    *poutbuf = av_malloc(buf_size + 44 + FF_INPUT_BUFFER_PADDING_SIZE);
-    poutbufp = *poutbuf;
-    bytestream_put_byte(&poutbufp, 0xff);
-    bytestream_put_byte(&poutbufp, SOI);
-    bytestream_put_byte(&poutbufp, 0xff);
-    bytestream_put_byte(&poutbufp, APP1);
-    bytestream_put_be16(&poutbufp, 42); /* size */
-    bytestream_put_be32(&poutbufp, 0);
-    bytestream_put_buffer(&poutbufp, "mjpg", 4);
-    bytestream_put_be32(&poutbufp, buf_size + 44); /* field size */
-    bytestream_put_be32(&poutbufp, buf_size + 44); /* pad field size */
-    bytestream_put_be32(&poutbufp, 0);             /* next ptr */
-
-    for (i = 0; i < buf_size - 1; i++) {
-        if (buf[i] == 0xff) {
-            switch (buf[i + 1]) {
-            case DQT:  dqt  = i + 46; break;
-            case DHT:  dht  = i + 46; break;
-            case SOF0: sof0 = i + 46; break;
-            case SOS:
-                bytestream_put_be32(&poutbufp, dqt); /* quant off */
-                bytestream_put_be32(&poutbufp, dht); /* huff off */
-                bytestream_put_be32(&poutbufp, sof0); /* image off */
-                bytestream_put_be32(&poutbufp, i + 46); /* scan off */
-                bytestream_put_be32(&poutbufp, i + 46 + AV_RB16(buf + i + 2)); /* data off */
-                bytestream_put_buffer(&poutbufp, buf + 2, buf_size - 2); /* skip already written SOI */
-                *poutbuf_size = poutbufp - *poutbuf;
-                return 1;
-            case APP1:
-                if (i + 8 < buf_size && AV_RL32(buf + i + 8) == AV_RL32("mjpg")) {
-                    av_log(avctx, AV_LOG_ERROR, "bitstream already formatted\n");
-                    memcpy(*poutbuf, buf, buf_size);
-                    *poutbuf_size = buf_size;
-                    return 1;
-                }
-            }
-        }
-    }
-    av_freep(poutbuf);
-    av_log(avctx, AV_LOG_ERROR, "could not find SOS marker in bitstream\n");
-    return 0;
-}
-
-AVBitStreamFilter mjpega_dump_header_bsf = {
-    "mjpegadump",
-    0,
-    mjpega_dump_header,
-};
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
deleted file mode 100644
index b418f57..0000000
--- a/libavcodec/mjpegbdec.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Apple MJPEG-B decoder
- * Copyright (c) 2002 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Apple MJPEG-B decoder.
- */
-
-#include "avcodec.h"
-#include "mjpeg.h"
-#include "mjpegdec.h"
-
-static uint32_t read_offs(AVCodecContext *avctx, GetBitContext *gb, uint32_t size, const char *err_msg){
-    uint32_t offs= get_bits_long(gb, 32);
-    if(offs >= size){
-        av_log(avctx, AV_LOG_WARNING, err_msg, offs, size);
-        return 0;
-    }
-    return offs;
-}
-
-static int mjpegb_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MJpegDecodeContext *s = avctx->priv_data;
-    const uint8_t *buf_end, *buf_ptr;
-    AVFrame *picture = data;
-    GetBitContext hgb; /* for the header */
-    uint32_t dqt_offs, dht_offs, sof_offs, sos_offs, second_field_offs;
-    uint32_t field_size, sod_offs;
-
-    buf_ptr = buf;
-    buf_end = buf + buf_size;
-
-read_header:
-    /* reset on every SOI */
-    s->restart_interval = 0;
-    s->restart_count = 0;
-    s->mjpb_skiptosod = 0;
-
-    init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8);
-
-    skip_bits(&hgb, 32); /* reserved zeros */
-
-    if (get_bits_long(&hgb, 32) != MKBETAG('m','j','p','g'))
-    {
-        av_log(avctx, AV_LOG_WARNING, "not mjpeg-b (bad fourcc)\n");
-        return 0;
-    }
-
-    field_size = get_bits_long(&hgb, 32); /* field size */
-    av_log(avctx, AV_LOG_DEBUG, "field size: 0x%x\n", field_size);
-    skip_bits(&hgb, 32); /* padded field size */
-    second_field_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "second_field_offs is %d and size is %d\n");
-    av_log(avctx, AV_LOG_DEBUG, "second field offs: 0x%x\n", second_field_offs);
-
-    dqt_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "dqt is %d and size is %d\n");
-    av_log(avctx, AV_LOG_DEBUG, "dqt offs: 0x%x\n", dqt_offs);
-    if (dqt_offs)
-    {
-        init_get_bits(&s->gb, buf_ptr+dqt_offs, (buf_end - (buf_ptr+dqt_offs))*8);
-        s->start_code = DQT;
-        ff_mjpeg_decode_dqt(s);
-    }
-
-    dht_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "dht is %d and size is %d\n");
-    av_log(avctx, AV_LOG_DEBUG, "dht offs: 0x%x\n", dht_offs);
-    if (dht_offs)
-    {
-        init_get_bits(&s->gb, buf_ptr+dht_offs, (buf_end - (buf_ptr+dht_offs))*8);
-        s->start_code = DHT;
-        ff_mjpeg_decode_dht(s);
-    }
-
-    sof_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "sof is %d and size is %d\n");
-    av_log(avctx, AV_LOG_DEBUG, "sof offs: 0x%x\n", sof_offs);
-    if (sof_offs)
-    {
-        init_get_bits(&s->gb, buf_ptr+sof_offs, (buf_end - (buf_ptr+sof_offs))*8);
-        s->start_code = SOF0;
-        if (ff_mjpeg_decode_sof(s) < 0)
-            return -1;
-    }
-
-    sos_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "sos is %d and size is %d\n");
-    av_log(avctx, AV_LOG_DEBUG, "sos offs: 0x%x\n", sos_offs);
-    sod_offs = read_offs(avctx, &hgb, buf_end - buf_ptr, "sof is %d and size is %d\n");
-    av_log(avctx, AV_LOG_DEBUG, "sod offs: 0x%x\n", sod_offs);
-    if (sos_offs)
-    {
-//        init_get_bits(&s->gb, buf+sos_offs, (buf_end - (buf+sos_offs))*8);
-        init_get_bits(&s->gb, buf_ptr+sos_offs, field_size*8);
-        s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16));
-        s->start_code = SOS;
-        ff_mjpeg_decode_sos(s);
-    }
-
-    if (s->interlaced) {
-        s->bottom_field ^= 1;
-        /* if not bottom field, do not output image yet */
-        if (s->bottom_field != s->interlace_polarity && second_field_offs)
-        {
-            buf_ptr = buf + second_field_offs;
-            second_field_offs = 0;
-            goto read_header;
-            }
-    }
-
-    //XXX FIXME factorize, this looks very similar to the EOI code
-
-    *picture= s->picture;
-    *data_size = sizeof(AVFrame);
-
-    if(!s->lossless){
-        picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
-        picture->qstride= 0;
-        picture->qscale_table= s->qscale_table;
-        memset(picture->qscale_table, picture->quality, (s->width+15)/16);
-        if(avctx->debug & FF_DEBUG_QP)
-            av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
-        picture->quality*= FF_QP2LAMBDA;
-    }
-
-    return buf_ptr - buf;
-}
-
-AVCodec mjpegb_decoder = {
-    "mjpegb",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MJPEGB,
-    sizeof(MJpegDecodeContext),
-    ff_mjpeg_decode_init,
-    NULL,
-    ff_mjpeg_decode_end,
-    mjpegb_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"),
-};
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
deleted file mode 100644
index 7f57af9..0000000
--- a/libavcodec/mjpegdec.c
+++ /dev/null
@@ -1,1560 +0,0 @@
-/*
- * MJPEG decoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * Support for external huffman table, various fixes (AVID workaround),
- * aspecting, new decode_frame mechanism and apple mjpeg-b support
- *                                  by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG decoder.
- */
-
-//#define DEBUG
-#include <assert.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mjpeg.h"
-#include "mjpegdec.h"
-#include "jpeglsdec.h"
-
-
-static int build_vlc(VLC *vlc, const uint8_t *bits_table, const uint8_t *val_table,
-                      int nb_codes, int use_static, int is_ac)
-{
-    uint8_t huff_size[256+16];
-    uint16_t huff_code[256+16];
-
-    assert(nb_codes <= 256);
-
-    memset(huff_size, 0, sizeof(huff_size));
-    ff_mjpeg_build_huffman_codes(huff_size, huff_code, bits_table, val_table);
-
-    if(is_ac){
-        memmove(huff_size+16, huff_size, sizeof(uint8_t)*nb_codes);
-        memmove(huff_code+16, huff_code, sizeof(uint16_t)*nb_codes);
-        memset(huff_size, 0, sizeof(uint8_t)*16);
-        memset(huff_code, 0, sizeof(uint16_t)*16);
-        nb_codes += 16;
-    }
-
-    return init_vlc(vlc, 9, nb_codes, huff_size, 1, 1, huff_code, 2, 2, use_static);
-}
-
-static void build_basic_mjpeg_vlc(MJpegDecodeContext * s) {
-    build_vlc(&s->vlcs[0][0], ff_mjpeg_bits_dc_luminance,
-              ff_mjpeg_val_dc, 12, 0, 0);
-    build_vlc(&s->vlcs[0][1], ff_mjpeg_bits_dc_chrominance,
-              ff_mjpeg_val_dc, 12, 0, 0);
-    build_vlc(&s->vlcs[1][0], ff_mjpeg_bits_ac_luminance,
-              ff_mjpeg_val_ac_luminance, 251, 0, 1);
-    build_vlc(&s->vlcs[1][1], ff_mjpeg_bits_ac_chrominance,
-              ff_mjpeg_val_ac_chrominance, 251, 0, 1);
-}
-
-av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
-{
-    MJpegDecodeContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    dsputil_init(&s->dsp, avctx);
-    ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
-    s->buffer_size = 0;
-    s->buffer = NULL;
-    s->start_code = -1;
-    s->first_picture = 1;
-    s->org_height = avctx->coded_height;
-    avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
-
-    build_basic_mjpeg_vlc(s);
-
-    if (avctx->flags & CODEC_FLAG_EXTERN_HUFF)
-    {
-        av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n");
-        init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8);
-        if (ff_mjpeg_decode_dht(s)) {
-            av_log(avctx, AV_LOG_ERROR, "mjpeg: error using external huffman table, switching back to internal\n");
-            build_basic_mjpeg_vlc(s);
-        }
-    }
-    if (avctx->extradata_size > 9 &&
-        AV_RL32(avctx->extradata + 4) == MKTAG('f','i','e','l')) {
-        if (avctx->extradata[9] == 6) { /* quicktime icefloe 019 */
-            s->interlace_polarity = 1; /* bottom field first */
-            av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n");
-        }
-    }
-    if (avctx->codec->id == CODEC_ID_AMV)
-        s->flipped = 1;
-
-    return 0;
-}
-
-
-/* quantize tables */
-int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
-{
-    int len, index, i, j;
-
-    len = get_bits(&s->gb, 16) - 2;
-
-    while (len >= 65) {
-        /* only 8 bit precision handled */
-        if (get_bits(&s->gb, 4) != 0)
-        {
-            av_log(s->avctx, AV_LOG_ERROR, "dqt: 16bit precision\n");
-            return -1;
-        }
-        index = get_bits(&s->gb, 4);
-        if (index >= 4)
-            return -1;
-        av_log(s->avctx, AV_LOG_DEBUG, "index=%d\n", index);
-        /* read quant table */
-        for(i=0;i<64;i++) {
-            j = s->scantable.permutated[i];
-            s->quant_matrixes[index][j] = get_bits(&s->gb, 8);
-        }
-
-        //XXX FIXME finetune, and perhaps add dc too
-        s->qscale[index]= FFMAX(
-            s->quant_matrixes[index][s->scantable.permutated[1]],
-            s->quant_matrixes[index][s->scantable.permutated[8]]) >> 1;
-        av_log(s->avctx, AV_LOG_DEBUG, "qscale[%d]: %d\n", index, s->qscale[index]);
-        len -= 65;
-    }
-
-    return 0;
-}
-
-/* decode huffman tables and build VLC decoders */
-int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
-{
-    int len, index, i, class, n, v, code_max;
-    uint8_t bits_table[17];
-    uint8_t val_table[256];
-
-    len = get_bits(&s->gb, 16) - 2;
-
-    while (len > 0) {
-        if (len < 17)
-            return -1;
-        class = get_bits(&s->gb, 4);
-        if (class >= 2)
-            return -1;
-        index = get_bits(&s->gb, 4);
-        if (index >= 4)
-            return -1;
-        n = 0;
-        for(i=1;i<=16;i++) {
-            bits_table[i] = get_bits(&s->gb, 8);
-            n += bits_table[i];
-        }
-        len -= 17;
-        if (len < n || n > 256)
-            return -1;
-
-        code_max = 0;
-        for(i=0;i<n;i++) {
-            v = get_bits(&s->gb, 8);
-            if (v > code_max)
-                code_max = v;
-            val_table[i] = v;
-        }
-        len -= n;
-
-        /* build VLC and flush previous vlc if present */
-        free_vlc(&s->vlcs[class][index]);
-        av_log(s->avctx, AV_LOG_DEBUG, "class=%d index=%d nb_codes=%d\n",
-               class, index, code_max + 1);
-        if(build_vlc(&s->vlcs[class][index], bits_table, val_table, code_max + 1, 0, class > 0) < 0){
-            return -1;
-        }
-    }
-    return 0;
-}
-
-int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
-{
-    int len, nb_components, i, width, height, pix_fmt_id;
-
-    /* XXX: verify len field validity */
-    len = get_bits(&s->gb, 16);
-    s->bits= get_bits(&s->gb, 8);
-
-    if(s->pegasus_rct) s->bits=9;
-    if(s->bits==9 && !s->pegasus_rct) s->rct=1;    //FIXME ugly
-
-    if (s->bits != 8 && !s->lossless){
-        av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n");
-        return -1;
-    }
-
-    height = get_bits(&s->gb, 16);
-    width = get_bits(&s->gb, 16);
-
-    //HACK for odd_height.mov
-    if(s->interlaced && s->width == width && s->height == height + 1)
-        height= s->height;
-
-    av_log(s->avctx, AV_LOG_DEBUG, "sof0: picture: %dx%d\n", width, height);
-    if(avcodec_check_dimensions(s->avctx, width, height))
-        return -1;
-
-    nb_components = get_bits(&s->gb, 8);
-    if (nb_components <= 0 ||
-        nb_components > MAX_COMPONENTS)
-        return -1;
-    if (s->ls && !(s->bits <= 8 || nb_components == 1)){
-        av_log(s->avctx, AV_LOG_ERROR, "only <= 8 bits/component or 16-bit gray accepted for JPEG-LS\n");
-        return -1;
-    }
-    s->nb_components = nb_components;
-    s->h_max = 1;
-    s->v_max = 1;
-    for(i=0;i<nb_components;i++) {
-        /* component id */
-        s->component_id[i] = get_bits(&s->gb, 8) - 1;
-        s->h_count[i] = get_bits(&s->gb, 4);
-        s->v_count[i] = get_bits(&s->gb, 4);
-        /* compute hmax and vmax (only used in interleaved case) */
-        if (s->h_count[i] > s->h_max)
-            s->h_max = s->h_count[i];
-        if (s->v_count[i] > s->v_max)
-            s->v_max = s->v_count[i];
-        s->quant_index[i] = get_bits(&s->gb, 8);
-        if (s->quant_index[i] >= 4)
-            return -1;
-        av_log(s->avctx, AV_LOG_DEBUG, "component %d %d:%d id: %d quant:%d\n", i, s->h_count[i],
-               s->v_count[i], s->component_id[i], s->quant_index[i]);
-    }
-
-    if(s->ls && (s->h_max > 1 || s->v_max > 1)) {
-        av_log(s->avctx, AV_LOG_ERROR, "Subsampling in JPEG-LS is not supported.\n");
-        return -1;
-    }
-
-    if(s->v_max==1 && s->h_max==1 && s->lossless==1) s->rgb=1;
-
-    /* if different size, realloc/alloc picture */
-    /* XXX: also check h_count and v_count */
-    if (width != s->width || height != s->height) {
-        av_freep(&s->qscale_table);
-
-        s->width = width;
-        s->height = height;
-        s->interlaced = 0;
-
-        /* test interlaced mode */
-        if (s->first_picture &&
-            s->org_height != 0 &&
-            s->height < ((s->org_height * 3) / 4)) {
-            s->interlaced = 1;
-            s->bottom_field = s->interlace_polarity;
-            s->picture.interlaced_frame = 1;
-            s->picture.top_field_first = !s->interlace_polarity;
-            height *= 2;
-        }
-
-        avcodec_set_dimensions(s->avctx, width, height);
-
-        s->qscale_table= av_mallocz((s->width+15)/16);
-
-        s->first_picture = 0;
-    }
-
-    if(s->interlaced && (s->bottom_field == !s->interlace_polarity))
-        return 0;
-
-    /* XXX: not complete test ! */
-    pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) |
-                 (s->h_count[1] << 20) | (s->v_count[1] << 16) |
-                 (s->h_count[2] << 12) | (s->v_count[2] <<  8) |
-                 (s->h_count[3] <<  4) |  s->v_count[3];
-    av_log(s->avctx, AV_LOG_DEBUG, "pix fmt id %x\n", pix_fmt_id);
-    //NOTE we do not allocate pictures large enough for the possible padding of h/v_count being 4
-    if(!(pix_fmt_id & 0xD0D0D0D0))
-        pix_fmt_id-= (pix_fmt_id & 0xF0F0F0F0)>>1;
-    if(!(pix_fmt_id & 0x0D0D0D0D))
-        pix_fmt_id-= (pix_fmt_id & 0x0F0F0F0F)>>1;
-
-    switch(pix_fmt_id){
-    case 0x11111100:
-        if(s->rgb){
-            s->avctx->pix_fmt = PIX_FMT_BGRA;
-        }else
-            s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV444P : PIX_FMT_YUVJ444P;
-        assert(s->nb_components==3);
-        break;
-    case 0x11000000:
-        s->avctx->pix_fmt = PIX_FMT_GRAY8;
-        break;
-    case 0x12111100:
-        s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV440P : PIX_FMT_YUVJ440P;
-        break;
-    case 0x21111100:
-        s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV422P : PIX_FMT_YUVJ422P;
-        break;
-    case 0x22111100:
-        s->avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420P;
-        break;
-    default:
-        av_log(s->avctx, AV_LOG_ERROR, "Unhandled pixel format 0x%x\n", pix_fmt_id);
-        return -1;
-    }
-    if(s->ls){
-        if(s->nb_components > 1)
-            s->avctx->pix_fmt = PIX_FMT_RGB24;
-        else if(s->bits <= 8)
-            s->avctx->pix_fmt = PIX_FMT_GRAY8;
-        else
-            s->avctx->pix_fmt = PIX_FMT_GRAY16;
-    }
-
-    if(s->picture.data[0])
-        s->avctx->release_buffer(s->avctx, &s->picture);
-
-    s->picture.reference= 0;
-    if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    s->picture.pict_type= FF_I_TYPE;
-    s->picture.key_frame= 1;
-    s->got_picture = 1;
-
-    for(i=0; i<3; i++){
-        s->linesize[i]= s->picture.linesize[i] << s->interlaced;
-    }
-
-//    printf("%d %d %d %d %d %d\n", s->width, s->height, s->linesize[0], s->linesize[1], s->interlaced, s->avctx->height);
-
-    if (len != (8+(3*nb_components)))
-    {
-        av_log(s->avctx, AV_LOG_DEBUG, "decode_sof0: error, len(%d) mismatch\n", len);
-    }
-
-    /* totally blank picture as progressive JPEG will only add details to it */
-    if(s->progressive){
-        int bw = (width  + s->h_max*8-1) / (s->h_max*8);
-        int bh = (height + s->v_max*8-1) / (s->v_max*8);
-        for(i=0; i<s->nb_components; i++) {
-            int size = bw * bh * s->h_count[i] * s->v_count[i];
-            av_freep(&s->blocks[i]);
-            av_freep(&s->last_nnz[i]);
-            s->blocks[i] = av_malloc(size * sizeof(**s->blocks));
-            s->last_nnz[i] = av_mallocz(size * sizeof(**s->last_nnz));
-            s->block_stride[i] = bw * s->h_count[i];
-        }
-        memset(s->coefs_finished, 0, sizeof(s->coefs_finished));
-    }
-    return 0;
-}
-
-static inline int mjpeg_decode_dc(MJpegDecodeContext *s, int dc_index)
-{
-    int code;
-    code = get_vlc2(&s->gb, s->vlcs[0][dc_index].table, 9, 2);
-    if (code < 0)
-    {
-        av_log(s->avctx, AV_LOG_WARNING, "mjpeg_decode_dc: bad vlc: %d:%d (%p)\n", 0, dc_index,
-               &s->vlcs[0][dc_index]);
-        return 0xffff;
-    }
-
-    if(code)
-        return get_xbits(&s->gb, code);
-    else
-        return 0;
-}
-
-/* decode block and dequantize */
-static int decode_block(MJpegDecodeContext *s, DCTELEM *block,
-                        int component, int dc_index, int ac_index, int16_t *quant_matrix)
-{
-    int code, i, j, level, val;
-
-    /* DC coef */
-    val = mjpeg_decode_dc(s, dc_index);
-    if (val == 0xffff) {
-        av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
-        return -1;
-    }
-    val = val * quant_matrix[0] + s->last_dc[component];
-    s->last_dc[component] = val;
-    block[0] = val;
-    /* AC coefs */
-    i = 0;
-    {OPEN_READER(re, &s->gb)
-    for(;;) {
-        UPDATE_CACHE(re, &s->gb);
-        GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
-
-        /* EOB */
-        if (code == 0x10)
-            break;
-        i += ((unsigned)code) >> 4;
-        if(code != 0x100){
-            code &= 0xf;
-            if(code > MIN_CACHE_BITS - 16){
-                UPDATE_CACHE(re, &s->gb)
-            }
-            {
-                int cache=GET_CACHE(re,&s->gb);
-                int sign=(~cache)>>31;
-                level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
-            }
-
-            LAST_SKIP_BITS(re, &s->gb, code)
-
-            if (i >= 63) {
-                if(i == 63){
-                    j = s->scantable.permutated[63];
-                    block[j] = level * quant_matrix[j];
-                    break;
-                }
-                av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
-                return -1;
-            }
-            j = s->scantable.permutated[i];
-            block[j] = level * quant_matrix[j];
-        }
-    }
-    CLOSE_READER(re, &s->gb)}
-
-    return 0;
-}
-
-static int decode_dc_progressive(MJpegDecodeContext *s, DCTELEM *block, int component,
-                                 int dc_index, int16_t *quant_matrix, int Al)
-{
-    int val;
-    s->dsp.clear_block(block);
-    val = mjpeg_decode_dc(s, dc_index);
-    if (val == 0xffff) {
-        av_log(s->avctx, AV_LOG_ERROR, "error dc\n");
-        return -1;
-    }
-    val = (val * quant_matrix[0] << Al) + s->last_dc[component];
-    s->last_dc[component] = val;
-    block[0] = val;
-    return 0;
-}
-
-/* decode block and dequantize - progressive JPEG version */
-static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, uint8_t *last_nnz,
-                                    int ac_index, int16_t *quant_matrix,
-                                    int ss, int se, int Al, int *EOBRUN)
-{
-    int code, i, j, level, val, run;
-
-    if(*EOBRUN){
-        (*EOBRUN)--;
-        return 0;
-    }
-    {OPEN_READER(re, &s->gb)
-    for(i=ss;;i++) {
-        UPDATE_CACHE(re, &s->gb);
-        GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
-        /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */
-        code -= 16;
-        if(code & 0xF) {
-            i += ((unsigned) code) >> 4;
-            code &= 0xf;
-            if(code > MIN_CACHE_BITS - 16){
-                UPDATE_CACHE(re, &s->gb)
-            }
-            {
-                int cache=GET_CACHE(re,&s->gb);
-                int sign=(~cache)>>31;
-                level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign;
-            }
-
-            LAST_SKIP_BITS(re, &s->gb, code)
-
-            if (i >= se) {
-                if(i == se){
-                    j = s->scantable.permutated[se];
-                    block[j] = level * quant_matrix[j] << Al;
-                    break;
-                }
-                av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);
-                return -1;
-            }
-            j = s->scantable.permutated[i];
-            block[j] = level * quant_matrix[j] << Al;
-        }else{
-            run = ((unsigned) code) >> 4;
-            if(run == 0xF){// ZRL - skip 15 coefficients
-                i += 15;
-            }else{
-                val = run;
-                run = (1 << run);
-                UPDATE_CACHE(re, &s->gb);
-                run += (GET_CACHE(re, &s->gb) >> (32 - val)) & (run - 1);
-                if(val)
-                    LAST_SKIP_BITS(re, &s->gb, val);
-                *EOBRUN = run - 1;
-                break;
-            }
-        }
-    }
-    CLOSE_READER(re, &s->gb)}
-    if(i > *last_nnz)
-        *last_nnz = i;
-    return 0;
-}
-
-#define REFINE_BIT(j) {\
-    UPDATE_CACHE(re, &s->gb);\
-    sign = block[j]>>15;\
-    block[j] += SHOW_UBITS(re, &s->gb, 1) * ((quant_matrix[j]^sign)-sign) << Al;\
-    LAST_SKIP_BITS(re, &s->gb, 1);\
-}
-
-#define ZERO_RUN \
-for(;;i++) {\
-    if(i > last) {\
-        i += run;\
-        if(i > se) {\
-            av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i);\
-            return -1;\
-        }\
-        break;\
-    }\
-    j = s->scantable.permutated[i];\
-    if(block[j])\
-        REFINE_BIT(j)\
-    else if(run-- == 0)\
-        break;\
-}
-
-/* decode block and dequantize - progressive JPEG refinement pass */
-static int decode_block_refinement(MJpegDecodeContext *s, DCTELEM *block, uint8_t *last_nnz,
-                        int ac_index, int16_t *quant_matrix,
-                        int ss, int se, int Al, int *EOBRUN)
-{
-    int code, i=ss, j, sign, val, run;
-    int last = FFMIN(se, *last_nnz);
-
-    OPEN_READER(re, &s->gb);
-    if(*EOBRUN)
-        (*EOBRUN)--;
-    else {
-        for(;;i++) {
-            UPDATE_CACHE(re, &s->gb);
-            GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2)
-            /* Progressive JPEG use AC coeffs from zero and this decoder sets offset 16 by default */
-            code -= 16;
-            if(code & 0xF) {
-                run = ((unsigned) code) >> 4;
-                UPDATE_CACHE(re, &s->gb);
-                val = SHOW_UBITS(re, &s->gb, 1);
-                LAST_SKIP_BITS(re, &s->gb, 1);
-                ZERO_RUN;
-                j = s->scantable.permutated[i];
-                val--;
-                block[j] = ((quant_matrix[j]^val)-val) << Al;
-                if(i == se) {
-                    if(i > *last_nnz)
-                        *last_nnz = i;
-                    CLOSE_READER(re, &s->gb)
-                    return 0;
-                }
-            }else{
-                run = ((unsigned) code) >> 4;
-                if(run == 0xF){
-                    ZERO_RUN;
-                }else{
-                    val = run;
-                    run = (1 << run);
-                    if(val) {
-                        UPDATE_CACHE(re, &s->gb);
-                        run += SHOW_UBITS(re, &s->gb, val);
-                        LAST_SKIP_BITS(re, &s->gb, val);
-                    }
-                    *EOBRUN = run - 1;
-                    break;
-                }
-            }
-        }
-
-        if(i > *last_nnz)
-            *last_nnz = i;
-    }
-
-    for(;i<=last;i++) {
-        j = s->scantable.permutated[i];
-        if(block[j])
-            REFINE_BIT(j)
-    }
-    CLOSE_READER(re, &s->gb);
-
-    return 0;
-}
-#undef REFINE_BIT
-#undef ZERO_RUN
-
-static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int predictor, int point_transform){
-    int i, mb_x, mb_y;
-    uint16_t (*buffer)[4];
-    int left[3], top[3], topleft[3];
-    const int linesize= s->linesize[0];
-    const int mask= (1<<s->bits)-1;
-
-    av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size, (unsigned)s->mb_width * 4 * sizeof(s->ljpeg_buffer[0][0]));
-    buffer= s->ljpeg_buffer;
-
-    for(i=0; i<3; i++){
-        buffer[0][i]= 1 << (s->bits + point_transform - 1);
-    }
-    for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
-        const int modified_predictor= mb_y ? predictor : 1;
-        uint8_t *ptr = s->picture.data[0] + (linesize * mb_y);
-
-        if (s->interlaced && s->bottom_field)
-            ptr += linesize >> 1;
-
-        for(i=0; i<3; i++){
-            top[i]= left[i]= topleft[i]= buffer[0][i];
-        }
-        for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
-            if (s->restart_interval && !s->restart_count)
-                s->restart_count = s->restart_interval;
-
-            for(i=0;i<3;i++) {
-                int pred;
-
-                topleft[i]= top[i];
-                top[i]= buffer[mb_x][i];
-
-                PREDICT(pred, topleft[i], top[i], left[i], modified_predictor);
-
-                left[i]=
-                buffer[mb_x][i]= mask & (pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform));
-            }
-
-            if (s->restart_interval && !--s->restart_count) {
-                align_get_bits(&s->gb);
-                skip_bits(&s->gb, 16); /* skip RSTn */
-            }
-        }
-
-        if(s->rct){
-            for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
-                ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2] - 0x200)>>2);
-                ptr[4*mb_x+0] = buffer[mb_x][1] + ptr[4*mb_x+1];
-                ptr[4*mb_x+2] = buffer[mb_x][2] + ptr[4*mb_x+1];
-            }
-        }else if(s->pegasus_rct){
-            for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
-                ptr[4*mb_x+1] = buffer[mb_x][0] - ((buffer[mb_x][1] + buffer[mb_x][2])>>2);
-                ptr[4*mb_x+0] = buffer[mb_x][1] + ptr[4*mb_x+1];
-                ptr[4*mb_x+2] = buffer[mb_x][2] + ptr[4*mb_x+1];
-            }
-        }else{
-            for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
-                ptr[4*mb_x+0] = buffer[mb_x][2];
-                ptr[4*mb_x+1] = buffer[mb_x][1];
-                ptr[4*mb_x+2] = buffer[mb_x][0];
-            }
-        }
-    }
-    return 0;
-}
-
-static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor, int point_transform){
-    int i, mb_x, mb_y;
-    const int nb_components=3;
-
-    for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
-        for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
-            if (s->restart_interval && !s->restart_count)
-                s->restart_count = s->restart_interval;
-
-            if(mb_x==0 || mb_y==0 || s->interlaced){
-                for(i=0;i<nb_components;i++) {
-                    uint8_t *ptr;
-                    int n, h, v, x, y, c, j, linesize;
-                    n = s->nb_blocks[i];
-                    c = s->comp_index[i];
-                    h = s->h_scount[i];
-                    v = s->v_scount[i];
-                    x = 0;
-                    y = 0;
-                    linesize= s->linesize[c];
-
-                    for(j=0; j<n; j++) {
-                        int pred;
-
-                        ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
-                        if(y==0 && mb_y==0){
-                            if(x==0 && mb_x==0){
-                                pred= 128 << point_transform;
-                            }else{
-                                pred= ptr[-1];
-                            }
-                        }else{
-                            if(x==0 && mb_x==0){
-                                pred= ptr[-linesize];
-                            }else{
-                                PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
-                            }
-                        }
-
-                        if (s->interlaced && s->bottom_field)
-                            ptr += linesize >> 1;
-                        *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
-
-                        if (++x == h) {
-                            x = 0;
-                            y++;
-                        }
-                    }
-                }
-            }else{
-                for(i=0;i<nb_components;i++) {
-                    uint8_t *ptr;
-                    int n, h, v, x, y, c, j, linesize;
-                    n = s->nb_blocks[i];
-                    c = s->comp_index[i];
-                    h = s->h_scount[i];
-                    v = s->v_scount[i];
-                    x = 0;
-                    y = 0;
-                    linesize= s->linesize[c];
-
-                    for(j=0; j<n; j++) {
-                        int pred;
-
-                        ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x); //FIXME optimize this crap
-                        PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
-                        *ptr= pred + (mjpeg_decode_dc(s, s->dc_index[i]) << point_transform);
-                        if (++x == h) {
-                            x = 0;
-                            y++;
-                        }
-                    }
-                }
-            }
-            if (s->restart_interval && !--s->restart_count) {
-                align_get_bits(&s->gb);
-                skip_bits(&s->gb, 16); /* skip RSTn */
-            }
-        }
-    }
-    return 0;
-}
-
-static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int Ah, int Al){
-    int i, mb_x, mb_y;
-    uint8_t* data[MAX_COMPONENTS];
-    int linesize[MAX_COMPONENTS];
-
-    if(s->flipped && s->avctx->flags & CODEC_FLAG_EMU_EDGE) {
-        av_log(s->avctx, AV_LOG_ERROR, "Can not flip image with CODEC_FLAG_EMU_EDGE set!\n");
-        s->flipped = 0;
-    }
-    for(i=0; i < nb_components; i++) {
-        int c = s->comp_index[i];
-        data[c] = s->picture.data[c];
-        linesize[c]=s->linesize[c];
-        s->coefs_finished[c] |= 1;
-        if(s->flipped) {
-            //picture should be flipped upside-down for this codec
-            data[c] += (linesize[c] * (s->v_scount[i] * (8 * s->mb_height -((s->height/s->v_max)&7)) - 1 ));
-            linesize[c] *= -1;
-        }
-    }
-
-    for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
-        for(mb_x = 0; mb_x < s->mb_width; mb_x++) {
-            if (s->restart_interval && !s->restart_count)
-                s->restart_count = s->restart_interval;
-
-            for(i=0;i<nb_components;i++) {
-                uint8_t *ptr;
-                int n, h, v, x, y, c, j;
-                n = s->nb_blocks[i];
-                c = s->comp_index[i];
-                h = s->h_scount[i];
-                v = s->v_scount[i];
-                x = 0;
-                y = 0;
-                for(j=0;j<n;j++) {
-                    ptr = data[c] +
-                        (((linesize[c] * (v * mb_y + y) * 8) +
-                        (h * mb_x + x) * 8) >> s->avctx->lowres);
-                    if(s->interlaced && s->bottom_field)
-                        ptr += linesize[c] >> 1;
-                    if(!s->progressive) {
-                        s->dsp.clear_block(s->block);
-                        if(decode_block(s, s->block, i,
-                                     s->dc_index[i], s->ac_index[i],
-                                     s->quant_matrixes[ s->quant_index[c] ]) < 0) {
-                            av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x);
-                            return -1;
-                        }
-                        s->dsp.idct_put(ptr, linesize[c], s->block);
-                    } else {
-                        int block_idx = s->block_stride[c] * (v * mb_y + y) + (h * mb_x + x);
-                        DCTELEM *block = s->blocks[c][block_idx];
-                        if(Ah)
-                            block[0] += get_bits1(&s->gb) * s->quant_matrixes[ s->quant_index[c] ][0] << Al;
-                        else if(decode_dc_progressive(s, block, i, s->dc_index[i], s->quant_matrixes[ s->quant_index[c] ], Al) < 0) {
-                            av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x);
-                            return -1;
-                        }
-                    }
-//                    av_log(s->avctx, AV_LOG_DEBUG, "mb: %d %d processed\n", mb_y, mb_x);
-//av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8);
-                    if (++x == h) {
-                        x = 0;
-                        y++;
-                    }
-                }
-            }
-
-            if (s->restart_interval && !--s->restart_count) {
-                align_get_bits(&s->gb);
-                skip_bits(&s->gb, 16); /* skip RSTn */
-                for (i=0; i<nb_components; i++) /* reset dc */
-                    s->last_dc[i] = 1024;
-            }
-        }
-    }
-    return 0;
-}
-
-static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int se, int Ah, int Al){
-    int mb_x, mb_y;
-    int EOBRUN = 0;
-    int c = s->comp_index[0];
-    uint8_t* data = s->picture.data[c];
-    int linesize = s->linesize[c];
-    int last_scan = 0;
-    int16_t *quant_matrix = s->quant_matrixes[ s->quant_index[c] ];
-
-    if(!Al) {
-        s->coefs_finished[c] |= (1LL<<(se+1))-(1LL<<ss);
-        last_scan = !~s->coefs_finished[c];
-    }
-
-    if(s->interlaced && s->bottom_field)
-        data += linesize >> 1;
-
-    for(mb_y = 0; mb_y < s->mb_height; mb_y++) {
-        uint8_t *ptr = data + (mb_y*linesize*8 >> s->avctx->lowres);
-        int block_idx = mb_y * s->block_stride[c];
-        DCTELEM (*block)[64] = &s->blocks[c][block_idx];
-        uint8_t *last_nnz = &s->last_nnz[c][block_idx];
-        for(mb_x = 0; mb_x < s->mb_width; mb_x++, block++, last_nnz++) {
-            int ret;
-            if(Ah)
-                ret = decode_block_refinement(s, *block, last_nnz, s->ac_index[0],
-                                              quant_matrix, ss, se, Al, &EOBRUN);
-            else
-                ret = decode_block_progressive(s, *block, last_nnz, s->ac_index[0],
-                                               quant_matrix, ss, se, Al, &EOBRUN);
-            if(ret < 0) {
-                av_log(s->avctx, AV_LOG_ERROR, "error y=%d x=%d\n", mb_y, mb_x);
-                return -1;
-            }
-            if(last_scan) {
-                s->dsp.idct_put(ptr, linesize, *block);
-                ptr += 8 >> s->avctx->lowres;
-            }
-        }
-    }
-    return 0;
-}
-
-int ff_mjpeg_decode_sos(MJpegDecodeContext *s)
-{
-    int len, nb_components, i, h, v, predictor, point_transform;
-    int index, id;
-    const int block_size= s->lossless ? 1 : 8;
-    int ilv, prev_shift;
-
-    /* XXX: verify len field validity */
-    len = get_bits(&s->gb, 16);
-    nb_components = get_bits(&s->gb, 8);
-    if (nb_components == 0 || nb_components > MAX_COMPONENTS){
-        av_log(s->avctx, AV_LOG_ERROR, "decode_sos: nb_components (%d) unsupported\n", nb_components);
-        return -1;
-    }
-    if (len != 6+2*nb_components)
-    {
-        av_log(s->avctx, AV_LOG_ERROR, "decode_sos: invalid len (%d)\n", len);
-        return -1;
-    }
-    for(i=0;i<nb_components;i++) {
-        id = get_bits(&s->gb, 8) - 1;
-        av_log(s->avctx, AV_LOG_DEBUG, "component: %d\n", id);
-        /* find component index */
-        for(index=0;index<s->nb_components;index++)
-            if (id == s->component_id[index])
-                break;
-        if (index == s->nb_components)
-        {
-            av_log(s->avctx, AV_LOG_ERROR, "decode_sos: index(%d) out of components\n", index);
-            return -1;
-        }
-        /* Metasoft MJPEG codec has Cb and Cr swapped */
-        if (s->avctx->codec_tag == MKTAG('M', 'T', 'S', 'J')
-            && nb_components == 3 && s->nb_components == 3 && i)
-            index = 3 - i;
-
-        s->comp_index[i] = index;
-
-        s->nb_blocks[i] = s->h_count[index] * s->v_count[index];
-        s->h_scount[i] = s->h_count[index];
-        s->v_scount[i] = s->v_count[index];
-
-        s->dc_index[i] = get_bits(&s->gb, 4);
-        s->ac_index[i] = get_bits(&s->gb, 4);
-
-        if (s->dc_index[i] <  0 || s->ac_index[i] < 0 ||
-            s->dc_index[i] >= 4 || s->ac_index[i] >= 4)
-            goto out_of_range;
-        if (!s->vlcs[0][s->dc_index[i]].table || !s->vlcs[1][s->ac_index[i]].table)
-            goto out_of_range;
-    }
-
-    predictor= get_bits(&s->gb, 8); /* JPEG Ss / lossless JPEG predictor /JPEG-LS NEAR */
-    ilv= get_bits(&s->gb, 8);    /* JPEG Se / JPEG-LS ILV */
-    prev_shift = get_bits(&s->gb, 4); /* Ah */
-    point_transform= get_bits(&s->gb, 4); /* Al */
-
-    for(i=0;i<nb_components;i++)
-        s->last_dc[i] = 1024;
-
-    if (nb_components > 1) {
-        /* interleaved stream */
-        s->mb_width  = (s->width  + s->h_max * block_size - 1) / (s->h_max * block_size);
-        s->mb_height = (s->height + s->v_max * block_size - 1) / (s->v_max * block_size);
-    } else if(!s->ls) { /* skip this for JPEG-LS */
-        h = s->h_max / s->h_scount[0];
-        v = s->v_max / s->v_scount[0];
-        s->mb_width  = (s->width  + h * block_size - 1) / (h * block_size);
-        s->mb_height = (s->height + v * block_size - 1) / (v * block_size);
-        s->nb_blocks[0] = 1;
-        s->h_scount[0] = 1;
-        s->v_scount[0] = 1;
-    }
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_DEBUG, "%s %s p:%d >>:%d ilv:%d bits:%d %s\n", s->lossless ? "lossless" : "sequential DCT", s->rgb ? "RGB" : "",
-               predictor, point_transform, ilv, s->bits,
-               s->pegasus_rct ? "PRCT" : (s->rct ? "RCT" : ""));
-
-
-    /* mjpeg-b can have padding bytes between sos and image data, skip them */
-    for (i = s->mjpb_skiptosod; i > 0; i--)
-        skip_bits(&s->gb, 8);
-
-    if(s->lossless){
-        if(CONFIG_JPEGLS_DECODER && s->ls){
-//            for(){
-//            reset_ls_coding_parameters(s, 0);
-
-            if(ff_jpegls_decode_picture(s, predictor, point_transform, ilv) < 0)
-                return -1;
-        }else{
-            if(s->rgb){
-                if(ljpeg_decode_rgb_scan(s, predictor, point_transform) < 0)
-                    return -1;
-            }else{
-                if(ljpeg_decode_yuv_scan(s, predictor, point_transform) < 0)
-                    return -1;
-            }
-        }
-    }else{
-        if(s->progressive && predictor) {
-            if(mjpeg_decode_scan_progressive_ac(s, predictor, ilv, prev_shift, point_transform) < 0)
-                return -1;
-        } else {
-            if(mjpeg_decode_scan(s, nb_components, prev_shift, point_transform) < 0)
-                return -1;
-        }
-    }
-    emms_c();
-    return 0;
- out_of_range:
-    av_log(s->avctx, AV_LOG_ERROR, "decode_sos: ac/dc index out of range\n");
-    return -1;
-}
-
-static int mjpeg_decode_dri(MJpegDecodeContext *s)
-{
-    if (get_bits(&s->gb, 16) != 4)
-        return -1;
-    s->restart_interval = get_bits(&s->gb, 16);
-    s->restart_count = 0;
-    av_log(s->avctx, AV_LOG_DEBUG, "restart interval: %d\n", s->restart_interval);
-
-    return 0;
-}
-
-static int mjpeg_decode_app(MJpegDecodeContext *s)
-{
-    int len, id, i;
-
-    len = get_bits(&s->gb, 16);
-    if (len < 5)
-        return -1;
-    if(8*len + get_bits_count(&s->gb) > s->gb.size_in_bits)
-        return -1;
-
-    id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
-    id = be2me_32(id);
-    len -= 6;
-
-    if(s->avctx->debug & FF_DEBUG_STARTCODE){
-        av_log(s->avctx, AV_LOG_DEBUG, "APPx %8X\n", id);
-    }
-
-    /* buggy AVID, it puts EOI only at every 10th frame */
-    /* also this fourcc is used by non-avid files too, it holds some
-       informations, but it's always present in AVID creates files */
-    if (id == AV_RL32("AVI1"))
-    {
-        /* structure:
-            4bytes      AVI1
-            1bytes      polarity
-            1bytes      always zero
-            4bytes      field_size
-            4bytes      field_size_less_padding
-        */
-            s->buggy_avid = 1;
-//        if (s->first_picture)
-//            printf("mjpeg: workarounding buggy AVID\n");
-        i = get_bits(&s->gb, 8);
-        if     (i==2) s->bottom_field= 1;
-        else if(i==1) s->bottom_field= 0;
-#if 0
-        skip_bits(&s->gb, 8);
-        skip_bits(&s->gb, 32);
-        skip_bits(&s->gb, 32);
-        len -= 10;
-#endif
-//        if (s->interlace_polarity)
-//            printf("mjpeg: interlace polarity: %d\n", s->interlace_polarity);
-        goto out;
-    }
-
-//    len -= 2;
-
-    if (id == AV_RL32("JFIF"))
-    {
-        int t_w, t_h, v1, v2;
-        skip_bits(&s->gb, 8); /* the trailing zero-byte */
-        v1= get_bits(&s->gb, 8);
-        v2= get_bits(&s->gb, 8);
-        skip_bits(&s->gb, 8);
-
-        s->avctx->sample_aspect_ratio.num= get_bits(&s->gb, 16);
-        s->avctx->sample_aspect_ratio.den= get_bits(&s->gb, 16);
-
-        if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-            av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n",
-                v1, v2,
-                s->avctx->sample_aspect_ratio.num,
-                s->avctx->sample_aspect_ratio.den
-            );
-
-        t_w = get_bits(&s->gb, 8);
-        t_h = get_bits(&s->gb, 8);
-        if (t_w && t_h)
-        {
-            /* skip thumbnail */
-            if (len-10-(t_w*t_h*3) > 0)
-                len -= t_w*t_h*3;
-        }
-        len -= 10;
-        goto out;
-    }
-
-    if (id == AV_RL32("Adob") && (get_bits(&s->gb, 8) == 'e'))
-    {
-        if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-            av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found\n");
-        skip_bits(&s->gb, 16); /* version */
-        skip_bits(&s->gb, 16); /* flags0 */
-        skip_bits(&s->gb, 16); /* flags1 */
-        skip_bits(&s->gb, 8);  /* transform */
-        len -= 7;
-        goto out;
-    }
-
-    if (id == AV_RL32("LJIF")){
-        if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-            av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n");
-        skip_bits(&s->gb, 16); /* version ? */
-        skip_bits(&s->gb, 16); /* unknwon always 0? */
-        skip_bits(&s->gb, 16); /* unknwon always 0? */
-        skip_bits(&s->gb, 16); /* unknwon always 0? */
-        switch( get_bits(&s->gb, 8)){
-        case 1:
-            s->rgb= 1;
-            s->pegasus_rct=0;
-            break;
-        case 2:
-            s->rgb= 1;
-            s->pegasus_rct=1;
-            break;
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace\n");
-        }
-        len -= 9;
-        goto out;
-    }
-
-    /* Apple MJPEG-A */
-    if ((s->start_code == APP1) && (len > (0x28 - 8)))
-    {
-        id = (get_bits(&s->gb, 16) << 16) | get_bits(&s->gb, 16);
-        id = be2me_32(id);
-        len -= 4;
-        if (id == AV_RL32("mjpg")) /* Apple MJPEG-A */
-        {
-#if 0
-            skip_bits(&s->gb, 32); /* field size */
-            skip_bits(&s->gb, 32); /* pad field size */
-            skip_bits(&s->gb, 32); /* next off */
-            skip_bits(&s->gb, 32); /* quant off */
-            skip_bits(&s->gb, 32); /* huff off */
-            skip_bits(&s->gb, 32); /* image off */
-            skip_bits(&s->gb, 32); /* scan off */
-            skip_bits(&s->gb, 32); /* data off */
-#endif
-            if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-                av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n");
-        }
-    }
-
-out:
-    /* slow but needed for extreme adobe jpegs */
-    if (len < 0)
-        av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n");
-    while(--len > 0)
-        skip_bits(&s->gb, 8);
-
-    return 0;
-}
-
-static int mjpeg_decode_com(MJpegDecodeContext *s)
-{
-    int len = get_bits(&s->gb, 16);
-    if (len >= 2 && 8*len - 16 + get_bits_count(&s->gb) <= s->gb.size_in_bits) {
-        char *cbuf = av_malloc(len - 1);
-        if (cbuf) {
-            int i;
-            for (i = 0; i < len - 2; i++)
-                cbuf[i] = get_bits(&s->gb, 8);
-            if (i > 0 && cbuf[i-1] == '\n')
-                cbuf[i-1] = 0;
-            else
-                cbuf[i] = 0;
-
-            if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-                av_log(s->avctx, AV_LOG_INFO, "mjpeg comment: '%s'\n", cbuf);
-
-            /* buggy avid, it puts EOI only at every 10th frame */
-            if (!strcmp(cbuf, "AVID"))
-            {
-                s->buggy_avid = 1;
-                //        if (s->first_picture)
-                //            printf("mjpeg: workarounding buggy AVID\n");
-            }
-            else if(!strcmp(cbuf, "CS=ITU601")){
-                s->cs_itu601= 1;
-            }
-            else if((len > 20 && !strncmp(cbuf, "Intel(R) JPEG Library", 21)) ||
-                    (len > 19 && !strncmp(cbuf, "Metasoft MJPEG Codec", 20))){
-                s->flipped = 1;
-            }
-
-            av_free(cbuf);
-        }
-    }
-
-    return 0;
-}
-
-#if 0
-static int valid_marker_list[] =
-{
-        /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f */
-/* 0 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 1 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 2 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 3 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 4 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 5 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 6 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 7 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 8 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* 9 */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* a */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* b */    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-/* c */    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-/* d */    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-/* e */    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-/* f */    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
-}
-#endif
-
-/* return the 8 bit start code value and update the search
-   state. Return -1 if no start code found */
-static int find_marker(const uint8_t **pbuf_ptr, const uint8_t *buf_end)
-{
-    const uint8_t *buf_ptr;
-    unsigned int v, v2;
-    int val;
-#ifdef DEBUG
-    int skipped=0;
-#endif
-
-    buf_ptr = *pbuf_ptr;
-    while (buf_ptr < buf_end) {
-        v = *buf_ptr++;
-        v2 = *buf_ptr;
-        if ((v == 0xff) && (v2 >= 0xc0) && (v2 <= 0xfe) && buf_ptr < buf_end) {
-            val = *buf_ptr++;
-            goto found;
-        }
-#ifdef DEBUG
-        skipped++;
-#endif
-    }
-    val = -1;
-found:
-    dprintf(NULL, "find_marker skipped %d bytes\n", skipped);
-    *pbuf_ptr = buf_ptr;
-    return val;
-}
-
-int ff_mjpeg_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MJpegDecodeContext *s = avctx->priv_data;
-    const uint8_t *buf_end, *buf_ptr;
-    int start_code;
-    AVFrame *picture = data;
-
-    s->got_picture = 0; // picture from previous image can not be reused
-    buf_ptr = buf;
-    buf_end = buf + buf_size;
-    while (buf_ptr < buf_end) {
-        /* find start next marker */
-        start_code = find_marker(&buf_ptr, buf_end);
-        {
-            /* EOF */
-            if (start_code < 0) {
-                goto the_end;
-            } else {
-                av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n", start_code, buf_end - buf_ptr);
-
-                if ((buf_end - buf_ptr) > s->buffer_size)
-                {
-                    av_free(s->buffer);
-                    s->buffer_size = buf_end-buf_ptr;
-                    s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                    av_log(avctx, AV_LOG_DEBUG, "buffer too small, expanding to %d bytes\n",
-                        s->buffer_size);
-                }
-
-                /* unescape buffer of SOS, use special treatment for JPEG-LS */
-                if (start_code == SOS && !s->ls)
-                {
-                    const uint8_t *src = buf_ptr;
-                    uint8_t *dst = s->buffer;
-
-                    while (src<buf_end)
-                    {
-                        uint8_t x = *(src++);
-
-                        *(dst++) = x;
-                        if (avctx->codec_id != CODEC_ID_THP)
-                        {
-                            if (x == 0xff) {
-                                while (src < buf_end && x == 0xff)
-                                    x = *(src++);
-
-                                if (x >= 0xd0 && x <= 0xd7)
-                                    *(dst++) = x;
-                                else if (x)
-                                    break;
-                            }
-                        }
-                    }
-                    init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8);
-
-                    av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n",
-                           (buf_end - buf_ptr) - (dst - s->buffer));
-                }
-                else if(start_code == SOS && s->ls){
-                    const uint8_t *src = buf_ptr;
-                    uint8_t *dst = s->buffer;
-                    int bit_count = 0;
-                    int t = 0, b = 0;
-                    PutBitContext pb;
-
-                    s->cur_scan++;
-
-                    /* find marker */
-                    while (src + t < buf_end){
-                        uint8_t x = src[t++];
-                        if (x == 0xff){
-                            while((src + t < buf_end) && x == 0xff)
-                                x = src[t++];
-                            if (x & 0x80) {
-                                t -= 2;
-                                break;
-                            }
-                        }
-                    }
-                    bit_count = t * 8;
-
-                    init_put_bits(&pb, dst, t);
-
-                    /* unescape bitstream */
-                    while(b < t){
-                        uint8_t x = src[b++];
-                        put_bits(&pb, 8, x);
-                        if(x == 0xFF){
-                            x = src[b++];
-                            put_bits(&pb, 7, x);
-                            bit_count--;
-                        }
-                    }
-                    flush_put_bits(&pb);
-
-                    init_get_bits(&s->gb, dst, bit_count);
-                }
-                else
-                    init_get_bits(&s->gb, buf_ptr, (buf_end - buf_ptr)*8);
-
-                s->start_code = start_code;
-                if(s->avctx->debug & FF_DEBUG_STARTCODE){
-                    av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code);
-                }
-
-                /* process markers */
-                if (start_code >= 0xd0 && start_code <= 0xd7) {
-                    av_log(avctx, AV_LOG_DEBUG, "restart marker: %d\n", start_code&0x0f);
-                    /* APP fields */
-                } else if (start_code >= APP0 && start_code <= APP15) {
-                    mjpeg_decode_app(s);
-                    /* Comment */
-                } else if (start_code == COM){
-                    mjpeg_decode_com(s);
-                }
-
-                switch(start_code) {
-                case SOI:
-                    s->restart_interval = 0;
-
-                    s->restart_count = 0;
-                    /* nothing to do on SOI */
-                    break;
-                case DQT:
-                    ff_mjpeg_decode_dqt(s);
-                    break;
-                case DHT:
-                    if(ff_mjpeg_decode_dht(s) < 0){
-                        av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
-                        return -1;
-                    }
-                    break;
-                case SOF0:
-                case SOF1:
-                    s->lossless=0;
-                    s->ls=0;
-                    s->progressive=0;
-                    if (ff_mjpeg_decode_sof(s) < 0)
-                        return -1;
-                    break;
-                case SOF2:
-                    s->lossless=0;
-                    s->ls=0;
-                    s->progressive=1;
-                    if (ff_mjpeg_decode_sof(s) < 0)
-                        return -1;
-                    break;
-                case SOF3:
-                    s->lossless=1;
-                    s->ls=0;
-                    s->progressive=0;
-                    if (ff_mjpeg_decode_sof(s) < 0)
-                        return -1;
-                    break;
-                case SOF48:
-                    s->lossless=1;
-                    s->ls=1;
-                    s->progressive=0;
-                    if (ff_mjpeg_decode_sof(s) < 0)
-                        return -1;
-                    break;
-                case LSE:
-                    if (!CONFIG_JPEGLS_DECODER || ff_jpegls_decode_lse(s) < 0)
-                        return -1;
-                    break;
-                case EOI:
-                    s->cur_scan = 0;
-                    if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
-                        break;
-eoi_parser:
-                    if (!s->got_picture) {
-                        av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n");
-                        break;
-                    }
-                    {
-                        if (s->interlaced) {
-                            s->bottom_field ^= 1;
-                            /* if not bottom field, do not output image yet */
-                            if (s->bottom_field == !s->interlace_polarity)
-                                goto not_the_end;
-                        }
-                        *picture = s->picture;
-                        *data_size = sizeof(AVFrame);
-
-                        if(!s->lossless){
-                            picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
-                            picture->qstride= 0;
-                            picture->qscale_table= s->qscale_table;
-                            memset(picture->qscale_table, picture->quality, (s->width+15)/16);
-                            if(avctx->debug & FF_DEBUG_QP)
-                                av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
-                            picture->quality*= FF_QP2LAMBDA;
-                        }
-
-                        goto the_end;
-                    }
-                    break;
-                case SOS:
-                    if (!s->got_picture) {
-                        av_log(avctx, AV_LOG_WARNING, "Can not process SOS before SOF, skipping\n");
-                        break;
-                    }
-                    ff_mjpeg_decode_sos(s);
-                    /* buggy avid puts EOI every 10-20th frame */
-                    /* if restart period is over process EOI */
-                    if ((s->buggy_avid && !s->interlaced) || s->restart_interval)
-                        goto eoi_parser;
-                    break;
-                case DRI:
-                    mjpeg_decode_dri(s);
-                    break;
-                case SOF5:
-                case SOF6:
-                case SOF7:
-                case SOF9:
-                case SOF10:
-                case SOF11:
-                case SOF13:
-                case SOF14:
-                case SOF15:
-                case JPG:
-                    av_log(avctx, AV_LOG_ERROR, "mjpeg: unsupported coding type (%x)\n", start_code);
-                    break;
-//                default:
-//                    printf("mjpeg: unsupported marker (%x)\n", start_code);
-//                    break;
-                }
-
-not_the_end:
-                /* eof process start code */
-                buf_ptr += (get_bits_count(&s->gb)+7)/8;
-                av_log(avctx, AV_LOG_DEBUG, "marker parser used %d bytes (%d bits)\n",
-                       (get_bits_count(&s->gb)+7)/8, get_bits_count(&s->gb));
-            }
-        }
-    }
-    if (s->got_picture) {
-        av_log(avctx, AV_LOG_WARNING, "EOI missing, emulating\n");
-        goto eoi_parser;
-    }
-    av_log(avctx, AV_LOG_FATAL, "No JPEG data found in image\n");
-    return -1;
-the_end:
-    av_log(avctx, AV_LOG_DEBUG, "mjpeg decode frame unused %td bytes\n", buf_end - buf_ptr);
-//    return buf_end - buf_ptr;
-    return buf_ptr - buf;
-}
-
-av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
-{
-    MJpegDecodeContext *s = avctx->priv_data;
-    int i, j;
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    av_free(s->buffer);
-    av_free(s->qscale_table);
-    av_freep(&s->ljpeg_buffer);
-    s->ljpeg_buffer_size=0;
-
-    for(i=0;i<2;i++) {
-        for(j=0;j<4;j++)
-            free_vlc(&s->vlcs[i][j]);
-    }
-    for(i=0; i<MAX_COMPONENTS; i++) {
-        av_freep(&s->blocks[i]);
-        av_freep(&s->last_nnz[i]);
-    }
-    return 0;
-}
-
-AVCodec mjpeg_decoder = {
-    "mjpeg",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MJPEG,
-    sizeof(MJpegDecodeContext),
-    ff_mjpeg_decode_init,
-    NULL,
-    ff_mjpeg_decode_end,
-    ff_mjpeg_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
-};
-
-AVCodec thp_decoder = {
-    "thp",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_THP,
-    sizeof(MJpegDecodeContext),
-    ff_mjpeg_decode_init,
-    NULL,
-    ff_mjpeg_decode_end,
-    ff_mjpeg_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
-};
diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h
deleted file mode 100644
index bbf734b..0000000
--- a/libavcodec/mjpegdec.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * MJPEG decoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG decoder.
- */
-
-#ifndef AVCODEC_MJPEGDEC_H
-#define AVCODEC_MJPEGDEC_H
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-
-#define MAX_COMPONENTS 4
-
-typedef struct MJpegDecodeContext {
-    AVCodecContext *avctx;
-    GetBitContext gb;
-
-    int start_code; /* current start code */
-    int buffer_size;
-    uint8_t *buffer;
-
-    int16_t quant_matrixes[4][64];
-    VLC vlcs[2][4];
-    int qscale[4];      ///< quantizer scale calculated from quant_matrixes
-
-    int org_height;  /* size given at codec init */
-    int first_picture;    /* true if decoding first picture */
-    int interlaced;     /* true if interlaced */
-    int bottom_field;   /* true if bottom field */
-    int lossless;
-    int ls;
-    int progressive;
-    int rgb;
-    int rct;            /* standard rct */
-    int pegasus_rct;    /* pegasus reversible colorspace transform */
-    int bits;           /* bits per component */
-
-    int maxval;
-    int near;         ///< near lossless bound (si 0 for lossless)
-    int t1,t2,t3;
-    int reset;        ///< context halfing intervall ?rename
-
-    int width, height;
-    int mb_width, mb_height;
-    int nb_components;
-    int block_stride[MAX_COMPONENTS];
-    int component_id[MAX_COMPONENTS];
-    int h_count[MAX_COMPONENTS]; /* horizontal and vertical count for each component */
-    int v_count[MAX_COMPONENTS];
-    int comp_index[MAX_COMPONENTS];
-    int dc_index[MAX_COMPONENTS];
-    int ac_index[MAX_COMPONENTS];
-    int nb_blocks[MAX_COMPONENTS];
-    int h_scount[MAX_COMPONENTS];
-    int v_scount[MAX_COMPONENTS];
-    int h_max, v_max; /* maximum h and v counts */
-    int quant_index[4];   /* quant table index for each component */
-    int last_dc[MAX_COMPONENTS]; /* last DEQUANTIZED dc (XXX: am I right to do that ?) */
-    AVFrame picture; /* picture structure */
-    int got_picture;                                ///< we found a SOF and picture is valid, too.
-    int linesize[MAX_COMPONENTS];                   ///< linesize << interlaced
-    int8_t *qscale_table;
-    DECLARE_ALIGNED(16, DCTELEM, block)[64];
-    DCTELEM (*blocks[MAX_COMPONENTS])[64]; ///< intermediate sums (progressive mode)
-    uint8_t *last_nnz[MAX_COMPONENTS];
-    uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode)
-    ScanTable scantable;
-    DSPContext dsp;
-
-    int restart_interval;
-    int restart_count;
-
-    int buggy_avid;
-    int cs_itu601;
-    int interlace_polarity;
-
-    int mjpb_skiptosod;
-
-    int cur_scan; /* current scan, used by JPEG-LS */
-    int flipped; /* true if picture is flipped */
-
-    uint16_t (*ljpeg_buffer)[4];
-    unsigned int ljpeg_buffer_size;
-} MJpegDecodeContext;
-
-int ff_mjpeg_decode_init(AVCodecContext *avctx);
-int ff_mjpeg_decode_end(AVCodecContext *avctx);
-int ff_mjpeg_decode_frame(AVCodecContext *avctx,
-                          void *data, int *data_size,
-                          AVPacket *avpkt);
-int ff_mjpeg_decode_dqt(MJpegDecodeContext *s);
-int ff_mjpeg_decode_dht(MJpegDecodeContext *s);
-int ff_mjpeg_decode_sof(MJpegDecodeContext *s);
-int ff_mjpeg_decode_sos(MJpegDecodeContext *s);
-
-#endif /* AVCODEC_MJPEGDEC_H */
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
deleted file mode 100644
index ec819c8..0000000
--- a/libavcodec/mjpegenc.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * MJPEG encoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * Support for external huffman table, various fixes (AVID workaround),
- * aspecting, new decode_frame mechanism and apple mjpeg-b support
- *                                  by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG encoder.
- */
-
-//#define DEBUG
-#include <assert.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mjpeg.h"
-#include "mjpegenc.h"
-
-/* use two quantizer tables (one for luminance and one for chrominance) */
-/* not yet working */
-#undef TWOMATRIXES
-
-
-av_cold int ff_mjpeg_encode_init(MpegEncContext *s)
-{
-    MJpegContext *m;
-
-    m = av_malloc(sizeof(MJpegContext));
-    if (!m)
-        return -1;
-
-    s->min_qcoeff=-1023;
-    s->max_qcoeff= 1023;
-
-    /* build all the huffman tables */
-    ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance,
-                                 m->huff_code_dc_luminance,
-                                 ff_mjpeg_bits_dc_luminance,
-                                 ff_mjpeg_val_dc);
-    ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance,
-                                 m->huff_code_dc_chrominance,
-                                 ff_mjpeg_bits_dc_chrominance,
-                                 ff_mjpeg_val_dc);
-    ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance,
-                                 m->huff_code_ac_luminance,
-                                 ff_mjpeg_bits_ac_luminance,
-                                 ff_mjpeg_val_ac_luminance);
-    ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance,
-                                 m->huff_code_ac_chrominance,
-                                 ff_mjpeg_bits_ac_chrominance,
-                                 ff_mjpeg_val_ac_chrominance);
-
-    s->mjpeg_ctx = m;
-    return 0;
-}
-
-void ff_mjpeg_encode_close(MpegEncContext *s)
-{
-    av_free(s->mjpeg_ctx);
-}
-
-/* table_class: 0 = DC coef, 1 = AC coefs */
-static int put_huffman_table(MpegEncContext *s, int table_class, int table_id,
-                             const uint8_t *bits_table, const uint8_t *value_table)
-{
-    PutBitContext *p = &s->pb;
-    int n, i;
-
-    put_bits(p, 4, table_class);
-    put_bits(p, 4, table_id);
-
-    n = 0;
-    for(i=1;i<=16;i++) {
-        n += bits_table[i];
-        put_bits(p, 8, bits_table[i]);
-    }
-
-    for(i=0;i<n;i++)
-        put_bits(p, 8, value_table[i]);
-
-    return n + 17;
-}
-
-static void jpeg_table_header(MpegEncContext *s)
-{
-    PutBitContext *p = &s->pb;
-    int i, j, size;
-    uint8_t *ptr;
-
-    /* quant matrixes */
-    put_marker(p, DQT);
-#ifdef TWOMATRIXES
-    put_bits(p, 16, 2 + 2 * (1 + 64));
-#else
-    put_bits(p, 16, 2 + 1 * (1 + 64));
-#endif
-    put_bits(p, 4, 0); /* 8 bit precision */
-    put_bits(p, 4, 0); /* table 0 */
-    for(i=0;i<64;i++) {
-        j = s->intra_scantable.permutated[i];
-        put_bits(p, 8, s->intra_matrix[j]);
-    }
-#ifdef TWOMATRIXES
-    put_bits(p, 4, 0); /* 8 bit precision */
-    put_bits(p, 4, 1); /* table 1 */
-    for(i=0;i<64;i++) {
-        j = s->intra_scantable.permutated[i];
-        put_bits(p, 8, s->chroma_intra_matrix[j]);
-    }
-#endif
-
-    /* huffman table */
-    put_marker(p, DHT);
-    flush_put_bits(p);
-    ptr = put_bits_ptr(p);
-    put_bits(p, 16, 0); /* patched later */
-    size = 2;
-    size += put_huffman_table(s, 0, 0, ff_mjpeg_bits_dc_luminance,
-                              ff_mjpeg_val_dc);
-    size += put_huffman_table(s, 0, 1, ff_mjpeg_bits_dc_chrominance,
-                              ff_mjpeg_val_dc);
-
-    size += put_huffman_table(s, 1, 0, ff_mjpeg_bits_ac_luminance,
-                              ff_mjpeg_val_ac_luminance);
-    size += put_huffman_table(s, 1, 1, ff_mjpeg_bits_ac_chrominance,
-                              ff_mjpeg_val_ac_chrominance);
-    AV_WB16(ptr, size);
-}
-
-static void jpeg_put_comments(MpegEncContext *s)
-{
-    PutBitContext *p = &s->pb;
-    int size;
-    uint8_t *ptr;
-
-    if (s->aspect_ratio_info /* && !lossless */)
-    {
-    /* JFIF header */
-    put_marker(p, APP0);
-    put_bits(p, 16, 16);
-    ff_put_string(p, "JFIF", 1); /* this puts the trailing zero-byte too */
-    put_bits(p, 16, 0x0201); /* v 1.02 */
-    put_bits(p, 8, 0); /* units type: 0 - aspect ratio */
-    put_bits(p, 16, s->avctx->sample_aspect_ratio.num);
-    put_bits(p, 16, s->avctx->sample_aspect_ratio.den);
-    put_bits(p, 8, 0); /* thumbnail width */
-    put_bits(p, 8, 0); /* thumbnail height */
-    }
-
-    /* comment */
-    if(!(s->flags & CODEC_FLAG_BITEXACT)){
-        put_marker(p, COM);
-        flush_put_bits(p);
-        ptr = put_bits_ptr(p);
-        put_bits(p, 16, 0); /* patched later */
-        ff_put_string(p, LIBAVCODEC_IDENT, 1);
-        size = strlen(LIBAVCODEC_IDENT)+3;
-        AV_WB16(ptr, size);
-    }
-
-    if(  s->avctx->pix_fmt == PIX_FMT_YUV420P
-       ||s->avctx->pix_fmt == PIX_FMT_YUV422P
-       ||s->avctx->pix_fmt == PIX_FMT_YUV444P){
-        put_marker(p, COM);
-        flush_put_bits(p);
-        ptr = put_bits_ptr(p);
-        put_bits(p, 16, 0); /* patched later */
-        ff_put_string(p, "CS=ITU601", 1);
-        size = strlen("CS=ITU601")+3;
-        AV_WB16(ptr, size);
-    }
-}
-
-void ff_mjpeg_encode_picture_header(MpegEncContext *s)
-{
-    const int lossless= s->avctx->codec_id != CODEC_ID_MJPEG;
-
-    put_marker(&s->pb, SOI);
-
-    jpeg_put_comments(s);
-
-    jpeg_table_header(s);
-
-    switch(s->avctx->codec_id){
-    case CODEC_ID_MJPEG:  put_marker(&s->pb, SOF0 ); break;
-    case CODEC_ID_LJPEG:  put_marker(&s->pb, SOF3 ); break;
-    default: assert(0);
-    }
-
-    put_bits(&s->pb, 16, 17);
-    if(lossless && s->avctx->pix_fmt == PIX_FMT_BGRA)
-        put_bits(&s->pb, 8, 9); /* 9 bits/component RCT */
-    else
-        put_bits(&s->pb, 8, 8); /* 8 bits/component */
-    put_bits(&s->pb, 16, s->height);
-    put_bits(&s->pb, 16, s->width);
-    put_bits(&s->pb, 8, 3); /* 3 components */
-
-    /* Y component */
-    put_bits(&s->pb, 8, 1); /* component number */
-    put_bits(&s->pb, 4, s->mjpeg_hsample[0]); /* H factor */
-    put_bits(&s->pb, 4, s->mjpeg_vsample[0]); /* V factor */
-    put_bits(&s->pb, 8, 0); /* select matrix */
-
-    /* Cb component */
-    put_bits(&s->pb, 8, 2); /* component number */
-    put_bits(&s->pb, 4, s->mjpeg_hsample[1]); /* H factor */
-    put_bits(&s->pb, 4, s->mjpeg_vsample[1]); /* V factor */
-#ifdef TWOMATRIXES
-    put_bits(&s->pb, 8, lossless ? 0 : 1); /* select matrix */
-#else
-    put_bits(&s->pb, 8, 0); /* select matrix */
-#endif
-
-    /* Cr component */
-    put_bits(&s->pb, 8, 3); /* component number */
-    put_bits(&s->pb, 4, s->mjpeg_hsample[2]); /* H factor */
-    put_bits(&s->pb, 4, s->mjpeg_vsample[2]); /* V factor */
-#ifdef TWOMATRIXES
-    put_bits(&s->pb, 8, lossless ? 0 : 1); /* select matrix */
-#else
-    put_bits(&s->pb, 8, 0); /* select matrix */
-#endif
-
-    /* scan header */
-    put_marker(&s->pb, SOS);
-    put_bits(&s->pb, 16, 12); /* length */
-    put_bits(&s->pb, 8, 3); /* 3 components */
-
-    /* Y component */
-    put_bits(&s->pb, 8, 1); /* index */
-    put_bits(&s->pb, 4, 0); /* DC huffman table index */
-    put_bits(&s->pb, 4, 0); /* AC huffman table index */
-
-    /* Cb component */
-    put_bits(&s->pb, 8, 2); /* index */
-    put_bits(&s->pb, 4, 1); /* DC huffman table index */
-    put_bits(&s->pb, 4, lossless ? 0 : 1); /* AC huffman table index */
-
-    /* Cr component */
-    put_bits(&s->pb, 8, 3); /* index */
-    put_bits(&s->pb, 4, 1); /* DC huffman table index */
-    put_bits(&s->pb, 4, lossless ? 0 : 1); /* AC huffman table index */
-
-    put_bits(&s->pb, 8, lossless ? s->avctx->prediction_method+1 : 0); /* Ss (not used) */
-
-    switch(s->avctx->codec_id){
-    case CODEC_ID_MJPEG:  put_bits(&s->pb, 8, 63); break; /* Se (not used) */
-    case CODEC_ID_LJPEG:  put_bits(&s->pb, 8,  0); break; /* not used */
-    default: assert(0);
-    }
-
-    put_bits(&s->pb, 8, 0); /* Ah/Al (not used) */
-}
-
-static void escape_FF(MpegEncContext *s, int start)
-{
-    int size= put_bits_count(&s->pb) - start*8;
-    int i, ff_count;
-    uint8_t *buf= s->pb.buf + start;
-    int align= (-(size_t)(buf))&3;
-
-    assert((size&7) == 0);
-    size >>= 3;
-
-    ff_count=0;
-    for(i=0; i<size && i<align; i++){
-        if(buf[i]==0xFF) ff_count++;
-    }
-    for(; i<size-15; i+=16){
-        int acc, v;
-
-        v= *(uint32_t*)(&buf[i]);
-        acc= (((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
-        v= *(uint32_t*)(&buf[i+4]);
-        acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
-        v= *(uint32_t*)(&buf[i+8]);
-        acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
-        v= *(uint32_t*)(&buf[i+12]);
-        acc+=(((v & (v>>4))&0x0F0F0F0F)+0x01010101)&0x10101010;
-
-        acc>>=4;
-        acc+= (acc>>16);
-        acc+= (acc>>8);
-        ff_count+= acc&0xFF;
-    }
-    for(; i<size; i++){
-        if(buf[i]==0xFF) ff_count++;
-    }
-
-    if(ff_count==0) return;
-
-    flush_put_bits(&s->pb);
-    skip_put_bytes(&s->pb, ff_count);
-
-    for(i=size-1; ff_count; i--){
-        int v= buf[i];
-
-        if(v==0xFF){
-//printf("%d %d\n", i, ff_count);
-            buf[i+ff_count]= 0;
-            ff_count--;
-        }
-
-        buf[i+ff_count]= v;
-    }
-}
-
-void ff_mjpeg_encode_stuffing(PutBitContext * pbc)
-{
-    int length;
-    length= (-put_bits_count(pbc))&7;
-    if(length) put_bits(pbc, length, (1<<length)-1);
-}
-
-void ff_mjpeg_encode_picture_trailer(MpegEncContext *s)
-{
-    ff_mjpeg_encode_stuffing(&s->pb);
-    flush_put_bits(&s->pb);
-
-    assert((s->header_bits&7)==0);
-
-    escape_FF(s, s->header_bits>>3);
-
-    put_marker(&s->pb, EOI);
-}
-
-void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
-                        uint8_t *huff_size, uint16_t *huff_code)
-{
-    int mant, nbits;
-
-    if (val == 0) {
-        put_bits(&s->pb, huff_size[0], huff_code[0]);
-    } else {
-        mant = val;
-        if (val < 0) {
-            val = -val;
-            mant--;
-        }
-
-        nbits= av_log2_16bit(val) + 1;
-
-        put_bits(&s->pb, huff_size[nbits], huff_code[nbits]);
-
-        put_sbits(&s->pb, nbits, mant);
-    }
-}
-
-static void encode_block(MpegEncContext *s, DCTELEM *block, int n)
-{
-    int mant, nbits, code, i, j;
-    int component, dc, run, last_index, val;
-    MJpegContext *m = s->mjpeg_ctx;
-    uint8_t *huff_size_ac;
-    uint16_t *huff_code_ac;
-
-    /* DC coef */
-    component = (n <= 3 ? 0 : (n&1) + 1);
-    dc = block[0]; /* overflow is impossible */
-    val = dc - s->last_dc[component];
-    if (n < 4) {
-        ff_mjpeg_encode_dc(s, val, m->huff_size_dc_luminance, m->huff_code_dc_luminance);
-        huff_size_ac = m->huff_size_ac_luminance;
-        huff_code_ac = m->huff_code_ac_luminance;
-    } else {
-        ff_mjpeg_encode_dc(s, val, m->huff_size_dc_chrominance, m->huff_code_dc_chrominance);
-        huff_size_ac = m->huff_size_ac_chrominance;
-        huff_code_ac = m->huff_code_ac_chrominance;
-    }
-    s->last_dc[component] = dc;
-
-    /* AC coefs */
-
-    run = 0;
-    last_index = s->block_last_index[n];
-    for(i=1;i<=last_index;i++) {
-        j = s->intra_scantable.permutated[i];
-        val = block[j];
-        if (val == 0) {
-            run++;
-        } else {
-            while (run >= 16) {
-                put_bits(&s->pb, huff_size_ac[0xf0], huff_code_ac[0xf0]);
-                run -= 16;
-            }
-            mant = val;
-            if (val < 0) {
-                val = -val;
-                mant--;
-            }
-
-            nbits= av_log2(val) + 1;
-            code = (run << 4) | nbits;
-
-            put_bits(&s->pb, huff_size_ac[code], huff_code_ac[code]);
-
-            put_sbits(&s->pb, nbits, mant);
-            run = 0;
-        }
-    }
-
-    /* output EOB only if not already 64 values */
-    if (last_index < 63 || run != 0)
-        put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]);
-}
-
-void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64])
-{
-    int i;
-    for(i=0;i<5;i++) {
-        encode_block(s, block[i], i);
-    }
-    if (s->chroma_format == CHROMA_420) {
-        encode_block(s, block[5], 5);
-    } else {
-        encode_block(s, block[6], 6);
-        encode_block(s, block[5], 5);
-        encode_block(s, block[7], 7);
-    }
-}
-
-AVCodec mjpeg_encoder = {
-    "mjpeg",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MJPEG,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
-};
diff --git a/libavcodec/mjpegenc.h b/libavcodec/mjpegenc.h
deleted file mode 100644
index 49627a3..0000000
--- a/libavcodec/mjpegenc.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * MJPEG encoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003 Alex Beregszaszi
- * Copyright (c) 2003-2004 Michael Niedermayer
- *
- * Support for external huffman table, various fixes (AVID workaround),
- * aspecting, new decode_frame mechanism and apple mjpeg-b support
- *                                  by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MJPEG encoder.
- */
-
-#ifndef AVCODEC_MJPEGENC_H
-#define AVCODEC_MJPEGENC_H
-
-#include "dsputil.h"
-#include "mpegvideo.h"
-
-typedef struct MJpegContext {
-    uint8_t huff_size_dc_luminance[12]; //FIXME use array [3] instead of lumi / chrom, for easier addressing
-    uint16_t huff_code_dc_luminance[12];
-    uint8_t huff_size_dc_chrominance[12];
-    uint16_t huff_code_dc_chrominance[12];
-
-    uint8_t huff_size_ac_luminance[256];
-    uint16_t huff_code_ac_luminance[256];
-    uint8_t huff_size_ac_chrominance[256];
-    uint16_t huff_code_ac_chrominance[256];
-} MJpegContext;
-
-int  ff_mjpeg_encode_init(MpegEncContext *s);
-void ff_mjpeg_encode_close(MpegEncContext *s);
-void ff_mjpeg_encode_picture_header(MpegEncContext *s);
-void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
-void ff_mjpeg_encode_stuffing(PutBitContext *pbc);
-void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
-                        uint8_t *huff_size, uint16_t *huff_code);
-void ff_mjpeg_encode_mb(MpegEncContext *s, DCTELEM block[6][64]);
-
-#endif /* AVCODEC_MJPEGENC_H */
diff --git a/libavcodec/mlib/dsputil_mlib.c b/libavcodec/mlib/dsputil_mlib.c
deleted file mode 100644
index 6be0ba4..0000000
--- a/libavcodec/mlib/dsputil_mlib.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Sun mediaLib optimized DSP utils
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-
-#include <mlib_types.h>
-#include <mlib_status.h>
-#include <mlib_sys.h>
-#include <mlib_algebra.h>
-#include <mlib_video.h>
-
-/* misc */
-
-static void get_pixels_mlib(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
-{
-  int i;
-
-  for (i=0;i<8;i++) {
-    mlib_VectorConvert_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)pixels, 8);
-
-    pixels += line_size;
-    block += 8;
-  }
-}
-
-static void diff_pixels_mlib(DCTELEM *restrict block, const uint8_t *s1, const uint8_t *s2, int line_size)
-{
-  int i;
-
-  for (i=0;i<8;i++) {
-    mlib_VectorSub_S16_U8_Mod((mlib_s16 *)block, (mlib_u8 *)s1, (mlib_u8 *)s2, 8);
-
-    s1 += line_size;
-    s2 += line_size;
-    block += 8;
-  }
-}
-
-static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size)
-{
-    mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
-}
-
-/* put block, width 16 pixel, height 8/16 */
-
-static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
-                               int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoCopyRef_U8_U8_16x8(dest, (uint8_t *)ref, stride);
-    break;
-
-    case 16:
-      mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoInterpX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoInterpY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoInterpXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-/* put block, width 8 pixel, height 4/8/16 */
-
-static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
-                               int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoCopyRef_U8_U8_8x4(dest, (uint8_t *)ref, stride);
-    break;
-
-    case 8:
-      mlib_VideoCopyRef_U8_U8_8x8(dest, (uint8_t *)ref, stride);
-    break;
-
-    case 16:
-      mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoInterpX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 8:
-      mlib_VideoInterpX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoInterpY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 8:
-      mlib_VideoInterpY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoInterpXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 8:
-      mlib_VideoInterpXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-/* average block, width 16 pixel, height 8/16 */
-
-static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
-                               int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoCopyRefAve_U8_U8_16x8(dest, (uint8_t *)ref, stride);
-    break;
-
-    case 16:
-      mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoInterpAveX_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoInterpAveY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void avg_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 8:
-      mlib_VideoInterpAveXY_U8_U8_16x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-/* average block, width 8 pixel, height 4/8/16 */
-
-static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
-                               int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoCopyRefAve_U8_U8_8x4(dest, (uint8_t *)ref, stride);
-    break;
-
-    case 8:
-      mlib_VideoCopyRefAve_U8_U8_8x8(dest, (uint8_t *)ref, stride);
-    break;
-
-    case 16:
-      mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoInterpAveX_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 8:
-      mlib_VideoInterpAveX_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoInterpAveY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 8:
-      mlib_VideoInterpAveY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-static void avg_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
-                                  int stride, int height)
-{
-  switch (height) {
-    case 4:
-      mlib_VideoInterpAveXY_U8_U8_8x4(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 8:
-      mlib_VideoInterpAveXY_U8_U8_8x8(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    case 16:
-      mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
-    break;
-
-    default:
-      assert(0);
-  }
-}
-
-/* swap byte order of a buffer */
-
-static void bswap_buf_mlib(uint32_t *dst, const uint32_t *src, int w)
-{
-  mlib_VectorReverseByteOrder_U32_U32(dst, src, w);
-}
-
-/* transformations */
-
-static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data)
-{
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    mlib_VideoIDCT8x8_S16_S16 (data, data);
-
-    for(i=0;i<8;i++) {
-        dest[0] = cm[data[0]];
-        dest[1] = cm[data[1]];
-        dest[2] = cm[data[2]];
-        dest[3] = cm[data[3]];
-        dest[4] = cm[data[4]];
-        dest[5] = cm[data[5]];
-        dest[6] = cm[data[6]];
-        dest[7] = cm[data[7]];
-
-        dest += line_size;
-        data += 8;
-    }
-}
-
-static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data)
-{
-    mlib_VideoIDCT8x8_S16_S16 (data, data);
-    mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size);
-}
-
-static void ff_idct_mlib(DCTELEM *data)
-{
-    mlib_VideoIDCT8x8_S16_S16 (data, data);
-}
-
-static void ff_fdct_mlib(DCTELEM *data)
-{
-    mlib_VideoDCT8x8_S16_S16 (data, data);
-}
-
-void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
-{
-    c->get_pixels  = get_pixels_mlib;
-    c->diff_pixels = diff_pixels_mlib;
-    c->add_pixels_clamped = add_pixels_clamped_mlib;
-
-    c->put_pixels_tab[0][0] = put_pixels16_mlib;
-    c->put_pixels_tab[0][1] = put_pixels16_x2_mlib;
-    c->put_pixels_tab[0][2] = put_pixels16_y2_mlib;
-    c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
-    c->put_pixels_tab[1][0] = put_pixels8_mlib;
-    c->put_pixels_tab[1][1] = put_pixels8_x2_mlib;
-    c->put_pixels_tab[1][2] = put_pixels8_y2_mlib;
-    c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
-
-    c->avg_pixels_tab[0][0] = avg_pixels16_mlib;
-    c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
-    c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
-    c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
-    c->avg_pixels_tab[1][0] = avg_pixels8_mlib;
-    c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
-    c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
-    c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
-
-    c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
-    c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
-
-    c->bswap_buf = bswap_buf_mlib;
-}
-
-void MPV_common_init_mlib(MpegEncContext *s)
-{
-    if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){
-        s->dsp.fdct = ff_fdct_mlib;
-    }
-
-    if(s->avctx->idct_algo==FF_IDCT_MLIB){
-        s->dsp.idct_put= ff_idct_put_mlib;
-        s->dsp.idct_add= ff_idct_add_mlib;
-        s->dsp.idct    = ff_idct_mlib;
-        s->dsp.idct_permutation_type= FF_NO_IDCT_PERM;
-    }
-}
diff --git a/libavcodec/mlp.c b/libavcodec/mlp.c
deleted file mode 100644
index 87f7c77..0000000
--- a/libavcodec/mlp.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * MLP codec common code
- * Copyright (c) 2007-2008 Ian Caulfield
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-
-#include "libavutil/crc.h"
-#include "libavutil/intreadwrite.h"
-#include "mlp.h"
-
-const uint8_t ff_mlp_huffman_tables[3][18][2] = {
-    {    /* Huffman table 0, -7 - +10 */
-        {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
-        {0x04, 3}, {0x05, 3}, {0x06, 3}, {0x07, 3},
-        {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
-    }, { /* Huffman table 1, -7 - +8 */
-        {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
-        {0x02, 2}, {0x03, 2},
-        {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
-    }, { /* Huffman table 2, -7 - +7 */
-        {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
-        {0x01, 1},
-        {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
-    }
-};
-
-static int crc_init = 0;
-#if CONFIG_SMALL
-#define CRC_TABLE_SIZE 257
-#else
-#define CRC_TABLE_SIZE 1024
-#endif
-static AVCRC crc_63[CRC_TABLE_SIZE];
-static AVCRC crc_1D[CRC_TABLE_SIZE];
-static AVCRC crc_2D[CRC_TABLE_SIZE];
-
-av_cold void ff_mlp_init_crc(void)
-{
-    if (!crc_init) {
-        av_crc_init(crc_63, 0,  8,   0x63, sizeof(crc_63));
-        av_crc_init(crc_1D, 0,  8,   0x1D, sizeof(crc_1D));
-        av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D));
-        crc_init = 1;
-    }
-}
-
-uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size)
-{
-    uint16_t crc;
-
-    crc = av_crc(crc_2D, 0, buf, buf_size - 2);
-    crc ^= AV_RL16(buf + buf_size - 2);
-    return crc;
-}
-
-uint8_t ff_mlp_checksum8(const uint8_t *buf, unsigned int buf_size)
-{
-    uint8_t checksum = av_crc(crc_63, 0x3c, buf, buf_size - 1); // crc_63[0xa2] == 0x3c
-    checksum ^= buf[buf_size-1];
-    return checksum;
-}
-
-uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size)
-{
-    int i;
-    int num_bytes = (bit_size + 2) / 8;
-
-    int crc = crc_1D[buf[0] & 0x3f];
-    crc = av_crc(crc_1D, crc, buf + 1, num_bytes - 2);
-    crc ^= buf[num_bytes - 1];
-
-    for (i = 0; i < ((bit_size + 2) & 7); i++) {
-        crc <<= 1;
-        if (crc & 0x100)
-            crc ^= 0x11D;
-        crc ^= (buf[num_bytes] >> (7 - i)) & 1;
-    }
-
-    return crc;
-}
-
-uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size)
-{
-    uint32_t scratch = 0;
-    const uint8_t *buf_end = buf + buf_size;
-
-    for (; ((intptr_t) buf & 3) && buf < buf_end; buf++)
-        scratch ^= *buf;
-    for (; buf < buf_end - 3; buf += 4)
-        scratch ^= *((const uint32_t*)buf);
-
-    scratch = xor_32_to_8(scratch);
-
-    for (; buf < buf_end; buf++)
-        scratch ^= *buf;
-
-    return scratch;
-}
diff --git a/libavcodec/mlp.h b/libavcodec/mlp.h
deleted file mode 100644
index 628b58d..0000000
--- a/libavcodec/mlp.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * MLP codec common header file
- * Copyright (c) 2007-2008 Ian Caulfield
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MLP_H
-#define AVCODEC_MLP_H
-
-#include <stdint.h>
-
-#include "avcodec.h"
-
-/** Last possible matrix channel for each codec */
-#define MAX_MATRIX_CHANNEL_MLP      5
-#define MAX_MATRIX_CHANNEL_TRUEHD   7
-/** Maximum number of channels in a valid stream.
- *  MLP   : 5.1 + 2 noise channels -> 8 channels
- *  TrueHD: 7.1                    -> 8 channels
- */
-#define MAX_CHANNELS                8
-
-/** Maximum number of matrices used in decoding; most streams have one matrix
- *  per output channel, but some rematrix a channel (usually 0) more than once.
- */
-#define MAX_MATRICES_MLP            6
-#define MAX_MATRICES_TRUEHD         8
-#define MAX_MATRICES                8
-
-/** Maximum number of substreams that can be decoded.
- *  MLP's limit is 2. TrueHD supports at least up to 3.
- */
-#define MAX_SUBSTREAMS      3
-
-/** which multiple of 48000 the maximum sample rate is */
-#define MAX_RATEFACTOR      4
-/** maximum sample frequency seen in files */
-#define MAX_SAMPLERATE      (MAX_RATEFACTOR * 48000)
-
-/** maximum number of audio samples within one access unit */
-#define MAX_BLOCKSIZE       (40 * MAX_RATEFACTOR)
-/** next power of two greater than MAX_BLOCKSIZE */
-#define MAX_BLOCKSIZE_POW2  (64 * MAX_RATEFACTOR)
-
-/** number of allowed filters */
-#define NUM_FILTERS         2
-
-/** The maximum number of taps in IIR and FIR filters. */
-#define MAX_FIR_ORDER       8
-#define MAX_IIR_ORDER       4
-
-/** Code that signals end of a stream. */
-#define END_OF_STREAM       0xd234d234
-
-#define FIR 0
-#define IIR 1
-
-/** filter data */
-typedef struct {
-    uint8_t     order; ///< number of taps in filter
-    uint8_t     shift; ///< Right shift to apply to output of filter.
-
-    int32_t     state[MAX_FIR_ORDER];
-} FilterParams;
-
-/** sample data coding information */
-typedef struct {
-    FilterParams filter_params[NUM_FILTERS];
-    int32_t     coeff[NUM_FILTERS][MAX_FIR_ORDER];
-
-    int16_t     huff_offset;      ///< Offset to apply to residual values.
-    int32_t     sign_huff_offset; ///< sign/rounding-corrected version of huff_offset
-    uint8_t     codebook;         ///< Which VLC codebook to use to read residuals.
-    uint8_t     huff_lsbs;        ///< Size of residual suffix not encoded using VLC.
-} ChannelParams;
-
-/** Tables defining the Huffman codes.
- *  There are three entropy coding methods used in MLP (four if you count
- *  "none" as a method). These use the same sequences for codes starting with
- *  00 or 01, but have different codes starting with 1.
- */
-extern const uint8_t ff_mlp_huffman_tables[3][18][2];
-
-/** MLP uses checksums that seem to be based on the standard CRC algorithm, but
- *  are not (in implementation terms, the table lookup and XOR are reversed).
- *  We can implement this behavior using a standard av_crc on all but the
- *  last element, then XOR that with the last element.
- */
-uint8_t  ff_mlp_checksum8 (const uint8_t *buf, unsigned int buf_size);
-uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size);
-
-/** Calculate an 8-bit checksum over a restart header -- a non-multiple-of-8
- *  number of bits, starting two bits into the first byte of buf.
- */
-uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size);
-
-/** XOR together all the bytes of a buffer.
- *  Does this belong in dspcontext?
- */
-uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size);
-
-void ff_mlp_init_crc(void);
-
-/** XOR four bytes into one. */
-static inline uint8_t xor_32_to_8(uint32_t value)
-{
-    value ^= value >> 16;
-    value ^= value >>  8;
-    return value;
-}
-
-#endif /* AVCODEC_MLP_H */
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
deleted file mode 100644
index 90bf939..0000000
--- a/libavcodec/mlp_parser.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * MLP parser
- * Copyright (c) 2007 Ian Caulfield
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MLP parser
- */
-
-#include <stdint.h>
-
-#include "libavutil/crc.h"
-#include "get_bits.h"
-#include "parser.h"
-#include "mlp_parser.h"
-#include "mlp.h"
-
-static const uint8_t mlp_quants[16] = {
-    16, 20, 24, 0, 0, 0, 0, 0,
-     0,  0,  0, 0, 0, 0, 0, 0,
-};
-
-static const uint8_t mlp_channels[32] = {
-    1, 2, 3, 4, 3, 4, 5, 3, 4, 5, 4, 5, 6, 4, 5, 4,
-    5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-static const uint8_t thd_chancount[13] = {
-//  LR    C   LFE  LRs LRvh  LRc LRrs  Cs   Ts  LRsd  LRw  Cvh  LFE2
-     2,   1,   1,   2,   2,   2,   2,   1,   1,   2,   2,   1,   1
-};
-
-static int mlp_samplerate(int in)
-{
-    if (in == 0xF)
-        return 0;
-
-    return (in & 8 ? 44100 : 48000) << (in & 7) ;
-}
-
-static int truehd_channels(int chanmap)
-{
-    int channels = 0, i;
-
-    for (i = 0; i < 13; i++)
-        channels += thd_chancount[i] * ((chanmap >> i) & 1);
-
-    return channels;
-}
-
-/** Read a major sync info header - contains high level information about
- *  the stream - sample rate, channel arrangement etc. Most of this
- *  information is not actually necessary for decoding, only for playback.
- *  gb must be a freshly initialized GetBitContext with no bits read.
- */
-
-int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
-{
-    int ratebits;
-    uint16_t checksum;
-
-    assert(get_bits_count(gb) == 0);
-
-    if (gb->size_in_bits < 28 << 3) {
-        av_log(log, AV_LOG_ERROR, "packet too short, unable to read major sync\n");
-        return -1;
-    }
-
-    checksum = ff_mlp_checksum16(gb->buffer, 26);
-    if (checksum != AV_RL16(gb->buffer+26)) {
-        av_log(log, AV_LOG_ERROR, "major sync info header checksum error\n");
-        return -1;
-    }
-
-    if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
-        return -1;
-
-    mh->stream_type = get_bits(gb, 8);
-
-    if (mh->stream_type == 0xbb) {
-        mh->group1_bits = mlp_quants[get_bits(gb, 4)];
-        mh->group2_bits = mlp_quants[get_bits(gb, 4)];
-
-        ratebits = get_bits(gb, 4);
-        mh->group1_samplerate = mlp_samplerate(ratebits);
-        mh->group2_samplerate = mlp_samplerate(get_bits(gb, 4));
-
-        skip_bits(gb, 11);
-
-        mh->channels_mlp = get_bits(gb, 5);
-    } else if (mh->stream_type == 0xba) {
-        mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere?
-        mh->group2_bits = 0;
-
-        ratebits = get_bits(gb, 4);
-        mh->group1_samplerate = mlp_samplerate(ratebits);
-        mh->group2_samplerate = 0;
-
-        skip_bits(gb, 8);
-
-        mh->channels_thd_stream1 = get_bits(gb, 5);
-
-        skip_bits(gb, 2);
-
-        mh->channels_thd_stream2 = get_bits(gb, 13);
-    } else
-        return -1;
-
-    mh->access_unit_size = 40 << (ratebits & 7);
-    mh->access_unit_size_pow2 = 64 << (ratebits & 7);
-
-    skip_bits_long(gb, 48);
-
-    mh->is_vbr = get_bits1(gb);
-
-    mh->peak_bitrate = (get_bits(gb, 15) * mh->group1_samplerate + 8) >> 4;
-
-    mh->num_substreams = get_bits(gb, 4);
-
-    skip_bits_long(gb, 4 + 11 * 8);
-
-    return 0;
-}
-
-typedef struct MLPParseContext
-{
-    ParseContext pc;
-
-    int bytes_left;
-
-    int in_sync;
-
-    int num_substreams;
-} MLPParseContext;
-
-static av_cold int mlp_init(AVCodecParserContext *s)
-{
-    ff_mlp_init_crc();
-    return 0;
-}
-
-static int mlp_parse(AVCodecParserContext *s,
-                     AVCodecContext *avctx,
-                     const uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size)
-{
-    MLPParseContext *mp = s->priv_data;
-    int sync_present;
-    uint8_t parity_bits;
-    int next;
-    int i, p = 0;
-
-    *poutbuf_size = 0;
-    if (buf_size == 0)
-        return 0;
-
-    if (!mp->in_sync) {
-        // Not in sync - find a major sync header
-
-        for (i = 0; i < buf_size; i++) {
-            mp->pc.state = (mp->pc.state << 8) | buf[i];
-            if ((mp->pc.state & 0xfffffffe) == 0xf8726fba &&
-                // ignore if we do not have the data for the start of header
-                mp->pc.index + i >= 7) {
-                mp->in_sync = 1;
-                mp->bytes_left = 0;
-                break;
-            }
-        }
-
-        if (!mp->in_sync) {
-            ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
-            return buf_size;
-        }
-
-        ff_combine_frame(&mp->pc, i - 7, &buf, &buf_size);
-
-        return i - 7;
-    }
-
-    if (mp->bytes_left == 0) {
-        // Find length of this packet
-
-        /* Copy overread bytes from last frame into buffer. */
-        for(; mp->pc.overread>0; mp->pc.overread--) {
-            mp->pc.buffer[mp->pc.index++]= mp->pc.buffer[mp->pc.overread_index++];
-        }
-
-        if (mp->pc.index + buf_size < 2) {
-            ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size);
-            return buf_size;
-        }
-
-        mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8)
-                       |  (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]);
-        mp->bytes_left = (mp->bytes_left & 0xfff) * 2;
-        mp->bytes_left -= mp->pc.index;
-    }
-
-    next = (mp->bytes_left > buf_size) ? END_NOT_FOUND : mp->bytes_left;
-
-    if (ff_combine_frame(&mp->pc, next, &buf, &buf_size) < 0) {
-        mp->bytes_left -= buf_size;
-        return buf_size;
-    }
-
-    mp->bytes_left = 0;
-
-    sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba;
-
-    if (!sync_present) {
-        /* The first nibble of a frame is a parity check of the 4-byte
-         * access unit header and all the 2- or 4-byte substream headers. */
-        // Only check when this isn't a sync frame - syncs have a checksum.
-
-        parity_bits = 0;
-        for (i = -1; i < mp->num_substreams; i++) {
-            parity_bits ^= buf[p++];
-            parity_bits ^= buf[p++];
-
-            if (i < 0 || buf[p-2] & 0x80) {
-                parity_bits ^= buf[p++];
-                parity_bits ^= buf[p++];
-            }
-        }
-
-        if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
-            av_log(avctx, AV_LOG_INFO, "mlpparse: Parity check failed.\n");
-            goto lost_sync;
-        }
-    } else {
-        GetBitContext gb;
-        MLPHeaderInfo mh;
-
-        init_get_bits(&gb, buf + 4, (buf_size - 4) << 3);
-        if (ff_mlp_read_major_sync(avctx, &mh, &gb) < 0)
-            goto lost_sync;
-
-        avctx->bits_per_raw_sample = mh.group1_bits;
-        if (avctx->bits_per_raw_sample > 16)
-            avctx->sample_fmt = SAMPLE_FMT_S32;
-        else
-            avctx->sample_fmt = SAMPLE_FMT_S16;
-        avctx->sample_rate = mh.group1_samplerate;
-        avctx->frame_size = mh.access_unit_size;
-
-        if (mh.stream_type == 0xbb) {
-            /* MLP stream */
-            avctx->channels = mlp_channels[mh.channels_mlp];
-        } else { /* mh.stream_type == 0xba */
-            /* TrueHD stream */
-            if (mh.channels_thd_stream2)
-                avctx->channels = truehd_channels(mh.channels_thd_stream2);
-            else
-                avctx->channels = truehd_channels(mh.channels_thd_stream1);
-        }
-
-        if (!mh.is_vbr) /* Stream is CBR */
-            avctx->bit_rate = mh.peak_bitrate;
-
-        mp->num_substreams = mh.num_substreams;
-    }
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-
-    return next;
-
-lost_sync:
-    mp->in_sync = 0;
-    return 1;
-}
-
-AVCodecParser mlp_parser = {
-    { CODEC_ID_MLP, CODEC_ID_TRUEHD },
-    sizeof(MLPParseContext),
-    mlp_init,
-    mlp_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/mlp_parser.h b/libavcodec/mlp_parser.h
deleted file mode 100644
index d7ce2b8..0000000
--- a/libavcodec/mlp_parser.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * MLP parser prototypes
- * Copyright (c) 2007 Ian Caulfield
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MLP parser prototypes
- */
-
-#ifndef AVCODEC_MLP_PARSER_H
-#define AVCODEC_MLP_PARSER_H
-
-#include "get_bits.h"
-
-typedef struct MLPHeaderInfo
-{
-    int stream_type;            ///< 0xBB for MLP, 0xBA for TrueHD
-
-    int group1_bits;            ///< The bit depth of the first substream
-    int group2_bits;            ///< Bit depth of the second substream (MLP only)
-
-    int group1_samplerate;      ///< Sample rate of first substream
-    int group2_samplerate;      ///< Sample rate of second substream (MLP only)
-
-    int channels_mlp;           ///< Channel arrangement for MLP streams
-    int channels_thd_stream1;   ///< Channel arrangement for substream 1 of TrueHD streams (5.1)
-    int channels_thd_stream2;   ///< Channel arrangement for substream 2 of TrueHD streams (7.1)
-
-    int access_unit_size;       ///< Number of samples per coded frame
-    int access_unit_size_pow2;  ///< Next power of two above number of samples per frame
-
-    int is_vbr;                 ///< Stream is VBR instead of CBR
-    int peak_bitrate;           ///< Peak bitrate for VBR, actual bitrate (==peak) for CBR
-
-    int num_substreams;         ///< Number of substreams within stream
-} MLPHeaderInfo;
-
-
-int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb);
-
-#endif /* AVCODEC_MLP_PARSER_H */
-
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
deleted file mode 100644
index 80fbbdb..0000000
--- a/libavcodec/mlpdec.c
+++ /dev/null
@@ -1,1164 +0,0 @@
-/*
- * MLP decoder
- * Copyright (c) 2007-2008 Ian Caulfield
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MLP decoder
- */
-
-#include <stdint.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "libavutil/intreadwrite.h"
-#include "get_bits.h"
-#include "libavutil/crc.h"
-#include "parser.h"
-#include "mlp_parser.h"
-#include "mlp.h"
-
-/** number of bits used for VLC lookup - longest Huffman code is 9 */
-#define VLC_BITS            9
-
-
-static const char* sample_message =
-    "Please file a bug report following the instructions at "
-    "http://ffmpeg.org/bugreports.html and include "
-    "a sample of this file.";
-
-typedef struct SubStream {
-    //! Set if a valid restart header has been read. Otherwise the substream cannot be decoded.
-    uint8_t     restart_seen;
-
-    //@{
-    /** restart header data */
-    //! The type of noise to be used in the rematrix stage.
-    uint16_t    noise_type;
-
-    //! The index of the first channel coded in this substream.
-    uint8_t     min_channel;
-    //! The index of the last channel coded in this substream.
-    uint8_t     max_channel;
-    //! The number of channels input into the rematrix stage.
-    uint8_t     max_matrix_channel;
-    //! For each channel output by the matrix, the output channel to map it to
-    uint8_t     ch_assign[MAX_CHANNELS];
-
-    //! Channel coding parameters for channels in the substream
-    ChannelParams channel_params[MAX_CHANNELS];
-
-    //! The left shift applied to random noise in 0x31ea substreams.
-    uint8_t     noise_shift;
-    //! The current seed value for the pseudorandom noise generator(s).
-    uint32_t    noisegen_seed;
-
-    //! Set if the substream contains extra info to check the size of VLC blocks.
-    uint8_t     data_check_present;
-
-    //! Bitmask of which parameter sets are conveyed in a decoding parameter block.
-    uint8_t     param_presence_flags;
-#define PARAM_BLOCKSIZE     (1 << 7)
-#define PARAM_MATRIX        (1 << 6)
-#define PARAM_OUTSHIFT      (1 << 5)
-#define PARAM_QUANTSTEP     (1 << 4)
-#define PARAM_FIR           (1 << 3)
-#define PARAM_IIR           (1 << 2)
-#define PARAM_HUFFOFFSET    (1 << 1)
-#define PARAM_PRESENCE      (1 << 0)
-    //@}
-
-    //@{
-    /** matrix data */
-
-    //! Number of matrices to be applied.
-    uint8_t     num_primitive_matrices;
-
-    //! matrix output channel
-    uint8_t     matrix_out_ch[MAX_MATRICES];
-
-    //! Whether the LSBs of the matrix output are encoded in the bitstream.
-    uint8_t     lsb_bypass[MAX_MATRICES];
-    //! Matrix coefficients, stored as 2.14 fixed point.
-    int32_t     matrix_coeff[MAX_MATRICES][MAX_CHANNELS];
-    //! Left shift to apply to noise values in 0x31eb substreams.
-    uint8_t     matrix_noise_shift[MAX_MATRICES];
-    //@}
-
-    //! Left shift to apply to Huffman-decoded residuals.
-    uint8_t     quant_step_size[MAX_CHANNELS];
-
-    //! number of PCM samples in current audio block
-    uint16_t    blocksize;
-    //! Number of PCM samples decoded so far in this frame.
-    uint16_t    blockpos;
-
-    //! Left shift to apply to decoded PCM values to get final 24-bit output.
-    int8_t      output_shift[MAX_CHANNELS];
-
-    //! Running XOR of all output samples.
-    int32_t     lossless_check_data;
-
-} SubStream;
-
-typedef struct MLPDecodeContext {
-    AVCodecContext *avctx;
-
-    //! Current access unit being read has a major sync.
-    int         is_major_sync_unit;
-
-    //! Set if a valid major sync block has been read. Otherwise no decoding is possible.
-    uint8_t     params_valid;
-
-    //! Number of substreams contained within this stream.
-    uint8_t     num_substreams;
-
-    //! Index of the last substream to decode - further substreams are skipped.
-    uint8_t     max_decoded_substream;
-
-    //! number of PCM samples contained in each frame
-    int         access_unit_size;
-    //! next power of two above the number of samples in each frame
-    int         access_unit_size_pow2;
-
-    SubStream   substream[MAX_SUBSTREAMS];
-
-    int         matrix_changed;
-    int         filter_changed[MAX_CHANNELS][NUM_FILTERS];
-
-    int8_t      noise_buffer[MAX_BLOCKSIZE_POW2];
-    int8_t      bypassed_lsbs[MAX_BLOCKSIZE][MAX_CHANNELS];
-    int32_t     sample_buffer[MAX_BLOCKSIZE][MAX_CHANNELS];
-
-    DSPContext  dsp;
-} MLPDecodeContext;
-
-static VLC huff_vlc[3];
-
-/** Initialize static data, constant between all invocations of the codec. */
-
-static av_cold void init_static(void)
-{
-    if (!huff_vlc[0].bits) {
-        INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18,
-                    &ff_mlp_huffman_tables[0][0][1], 2, 1,
-                    &ff_mlp_huffman_tables[0][0][0], 2, 1, 512);
-        INIT_VLC_STATIC(&huff_vlc[1], VLC_BITS, 16,
-                    &ff_mlp_huffman_tables[1][0][1], 2, 1,
-                    &ff_mlp_huffman_tables[1][0][0], 2, 1, 512);
-        INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15,
-                    &ff_mlp_huffman_tables[2][0][1], 2, 1,
-                    &ff_mlp_huffman_tables[2][0][0], 2, 1, 512);
-    }
-
-    ff_mlp_init_crc();
-}
-
-static inline int32_t calculate_sign_huff(MLPDecodeContext *m,
-                                          unsigned int substr, unsigned int ch)
-{
-    SubStream *s = &m->substream[substr];
-    ChannelParams *cp = &s->channel_params[ch];
-    int lsb_bits = cp->huff_lsbs - s->quant_step_size[ch];
-    int sign_shift = lsb_bits + (cp->codebook ? 2 - cp->codebook : -1);
-    int32_t sign_huff_offset = cp->huff_offset;
-
-    if (cp->codebook > 0)
-        sign_huff_offset -= 7 << lsb_bits;
-
-    if (sign_shift >= 0)
-        sign_huff_offset -= 1 << sign_shift;
-
-    return sign_huff_offset;
-}
-
-/** Read a sample, consisting of either, both or neither of entropy-coded MSBs
- *  and plain LSBs. */
-
-static inline int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp,
-                                     unsigned int substr, unsigned int pos)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int mat, channel;
-
-    for (mat = 0; mat < s->num_primitive_matrices; mat++)
-        if (s->lsb_bypass[mat])
-            m->bypassed_lsbs[pos + s->blockpos][mat] = get_bits1(gbp);
-
-    for (channel = s->min_channel; channel <= s->max_channel; channel++) {
-        ChannelParams *cp = &s->channel_params[channel];
-        int codebook = cp->codebook;
-        int quant_step_size = s->quant_step_size[channel];
-        int lsb_bits = cp->huff_lsbs - quant_step_size;
-        int result = 0;
-
-        if (codebook > 0)
-            result = get_vlc2(gbp, huff_vlc[codebook-1].table,
-                            VLC_BITS, (9 + VLC_BITS - 1) / VLC_BITS);
-
-        if (result < 0)
-            return -1;
-
-        if (lsb_bits > 0)
-            result = (result << lsb_bits) + get_bits(gbp, lsb_bits);
-
-        result  += cp->sign_huff_offset;
-        result <<= quant_step_size;
-
-        m->sample_buffer[pos + s->blockpos][channel] = result;
-    }
-
-    return 0;
-}
-
-static av_cold int mlp_decode_init(AVCodecContext *avctx)
-{
-    MLPDecodeContext *m = avctx->priv_data;
-    int substr;
-
-    init_static();
-    m->avctx = avctx;
-    for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
-        m->substream[substr].lossless_check_data = 0xffffffff;
-    dsputil_init(&m->dsp, avctx);
-
-    return 0;
-}
-
-/** Read a major sync info header - contains high level information about
- *  the stream - sample rate, channel arrangement etc. Most of this
- *  information is not actually necessary for decoding, only for playback.
- */
-
-static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
-{
-    MLPHeaderInfo mh;
-    int substr;
-
-    if (ff_mlp_read_major_sync(m->avctx, &mh, gb) != 0)
-        return -1;
-
-    if (mh.group1_bits == 0) {
-        av_log(m->avctx, AV_LOG_ERROR, "invalid/unknown bits per sample\n");
-        return -1;
-    }
-    if (mh.group2_bits > mh.group1_bits) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Channel group 2 cannot have more bits per sample than group 1.\n");
-        return -1;
-    }
-
-    if (mh.group2_samplerate && mh.group2_samplerate != mh.group1_samplerate) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Channel groups with differing sample rates are not currently supported.\n");
-        return -1;
-    }
-
-    if (mh.group1_samplerate == 0) {
-        av_log(m->avctx, AV_LOG_ERROR, "invalid/unknown sampling rate\n");
-        return -1;
-    }
-    if (mh.group1_samplerate > MAX_SAMPLERATE) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Sampling rate %d is greater than the supported maximum (%d).\n",
-               mh.group1_samplerate, MAX_SAMPLERATE);
-        return -1;
-    }
-    if (mh.access_unit_size > MAX_BLOCKSIZE) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Block size %d is greater than the supported maximum (%d).\n",
-               mh.access_unit_size, MAX_BLOCKSIZE);
-        return -1;
-    }
-    if (mh.access_unit_size_pow2 > MAX_BLOCKSIZE_POW2) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Block size pow2 %d is greater than the supported maximum (%d).\n",
-               mh.access_unit_size_pow2, MAX_BLOCKSIZE_POW2);
-        return -1;
-    }
-
-    if (mh.num_substreams == 0)
-        return -1;
-    if (m->avctx->codec_id == CODEC_ID_MLP && mh.num_substreams > 2) {
-        av_log(m->avctx, AV_LOG_ERROR, "MLP only supports up to 2 substreams.\n");
-        return -1;
-    }
-    if (mh.num_substreams > MAX_SUBSTREAMS) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Number of substreams %d is larger than the maximum supported "
-               "by the decoder. %s\n", mh.num_substreams, sample_message);
-        return -1;
-    }
-
-    m->access_unit_size      = mh.access_unit_size;
-    m->access_unit_size_pow2 = mh.access_unit_size_pow2;
-
-    m->num_substreams        = mh.num_substreams;
-    m->max_decoded_substream = m->num_substreams - 1;
-
-    m->avctx->sample_rate    = mh.group1_samplerate;
-    m->avctx->frame_size     = mh.access_unit_size;
-
-    m->avctx->bits_per_raw_sample = mh.group1_bits;
-    if (mh.group1_bits > 16)
-        m->avctx->sample_fmt = SAMPLE_FMT_S32;
-    else
-        m->avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    m->params_valid = 1;
-    for (substr = 0; substr < MAX_SUBSTREAMS; substr++)
-        m->substream[substr].restart_seen = 0;
-
-    return 0;
-}
-
-/** Read a restart header from a block in a substream. This contains parameters
- *  required to decode the audio that do not change very often. Generally
- *  (always) present only in blocks following a major sync. */
-
-static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp,
-                               const uint8_t *buf, unsigned int substr)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int ch;
-    int sync_word, tmp;
-    uint8_t checksum;
-    uint8_t lossless_check;
-    int start_count = get_bits_count(gbp);
-    const int max_matrix_channel = m->avctx->codec_id == CODEC_ID_MLP
-                                 ? MAX_MATRIX_CHANNEL_MLP
-                                 : MAX_MATRIX_CHANNEL_TRUEHD;
-
-    sync_word = get_bits(gbp, 13);
-
-    if (sync_word != 0x31ea >> 1) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "restart header sync incorrect (got 0x%04x)\n", sync_word);
-        return -1;
-    }
-
-    s->noise_type = get_bits1(gbp);
-
-    if (m->avctx->codec_id == CODEC_ID_MLP && s->noise_type) {
-        av_log(m->avctx, AV_LOG_ERROR, "MLP must have 0x31ea sync word.\n");
-        return -1;
-    }
-
-    skip_bits(gbp, 16); /* Output timestamp */
-
-    s->min_channel        = get_bits(gbp, 4);
-    s->max_channel        = get_bits(gbp, 4);
-    s->max_matrix_channel = get_bits(gbp, 4);
-
-    if (s->max_matrix_channel > max_matrix_channel) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Max matrix channel cannot be greater than %d.\n",
-               max_matrix_channel);
-        return -1;
-    }
-
-    if (s->max_channel != s->max_matrix_channel) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Max channel must be equal max matrix channel.\n");
-        return -1;
-    }
-
-    /* This should happen for TrueHD streams with >6 channels and MLP's noise
-     * type. It is not yet known if this is allowed. */
-    if (s->max_channel > MAX_MATRIX_CHANNEL_MLP && !s->noise_type) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Number of channels %d is larger than the maximum supported "
-               "by the decoder. %s\n", s->max_channel+2, sample_message);
-        return -1;
-    }
-
-    if (s->min_channel > s->max_channel) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Substream min channel cannot be greater than max channel.\n");
-        return -1;
-    }
-
-    if (m->avctx->request_channels > 0
-        && s->max_channel + 1 >= m->avctx->request_channels
-        && substr < m->max_decoded_substream) {
-        av_log(m->avctx, AV_LOG_DEBUG,
-               "Extracting %d channel downmix from substream %d. "
-               "Further substreams will be skipped.\n",
-               s->max_channel + 1, substr);
-        m->max_decoded_substream = substr;
-    }
-
-    s->noise_shift   = get_bits(gbp,  4);
-    s->noisegen_seed = get_bits(gbp, 23);
-
-    skip_bits(gbp, 19);
-
-    s->data_check_present = get_bits1(gbp);
-    lossless_check = get_bits(gbp, 8);
-    if (substr == m->max_decoded_substream
-        && s->lossless_check_data != 0xffffffff) {
-        tmp = xor_32_to_8(s->lossless_check_data);
-        if (tmp != lossless_check)
-            av_log(m->avctx, AV_LOG_WARNING,
-                   "Lossless check failed - expected %02x, calculated %02x.\n",
-                   lossless_check, tmp);
-    }
-
-    skip_bits(gbp, 16);
-
-    memset(s->ch_assign, 0, sizeof(s->ch_assign));
-
-    for (ch = 0; ch <= s->max_matrix_channel; ch++) {
-        int ch_assign = get_bits(gbp, 6);
-        if (ch_assign > s->max_matrix_channel) {
-            av_log(m->avctx, AV_LOG_ERROR,
-                   "Assignment of matrix channel %d to invalid output channel %d. %s\n",
-                   ch, ch_assign, sample_message);
-            return -1;
-        }
-        s->ch_assign[ch_assign] = ch;
-    }
-
-    checksum = ff_mlp_restart_checksum(buf, get_bits_count(gbp) - start_count);
-
-    if (checksum != get_bits(gbp, 8))
-        av_log(m->avctx, AV_LOG_ERROR, "restart header checksum error\n");
-
-    /* Set default decoding parameters. */
-    s->param_presence_flags   = 0xff;
-    s->num_primitive_matrices = 0;
-    s->blocksize              = 8;
-    s->lossless_check_data    = 0;
-
-    memset(s->output_shift   , 0, sizeof(s->output_shift   ));
-    memset(s->quant_step_size, 0, sizeof(s->quant_step_size));
-
-    for (ch = s->min_channel; ch <= s->max_channel; ch++) {
-        ChannelParams *cp = &s->channel_params[ch];
-        cp->filter_params[FIR].order = 0;
-        cp->filter_params[IIR].order = 0;
-        cp->filter_params[FIR].shift = 0;
-        cp->filter_params[IIR].shift = 0;
-
-        /* Default audio coding is 24-bit raw PCM. */
-        cp->huff_offset      = 0;
-        cp->sign_huff_offset = (-1) << 23;
-        cp->codebook         = 0;
-        cp->huff_lsbs        = 24;
-    }
-
-    if (substr == m->max_decoded_substream)
-        m->avctx->channels = s->max_matrix_channel + 1;
-
-    return 0;
-}
-
-/** Read parameters for one of the prediction filters. */
-
-static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp,
-                              unsigned int substr, unsigned int channel,
-                              unsigned int filter)
-{
-    SubStream *s = &m->substream[substr];
-    FilterParams *fp = &s->channel_params[channel].filter_params[filter];
-    const int max_order = filter ? MAX_IIR_ORDER : MAX_FIR_ORDER;
-    const char fchar = filter ? 'I' : 'F';
-    int i, order;
-
-    // Filter is 0 for FIR, 1 for IIR.
-    assert(filter < 2);
-
-    if (m->filter_changed[channel][filter]++ > 1) {
-        av_log(m->avctx, AV_LOG_ERROR, "Filters may change only once per access unit.\n");
-        return -1;
-    }
-
-    order = get_bits(gbp, 4);
-    if (order > max_order) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "%cIR filter order %d is greater than maximum %d.\n",
-               fchar, order, max_order);
-        return -1;
-    }
-    fp->order = order;
-
-    if (order > 0) {
-        int32_t *fcoeff = s->channel_params[channel].coeff[filter];
-        int coeff_bits, coeff_shift;
-
-        fp->shift = get_bits(gbp, 4);
-
-        coeff_bits  = get_bits(gbp, 5);
-        coeff_shift = get_bits(gbp, 3);
-        if (coeff_bits < 1 || coeff_bits > 16) {
-            av_log(m->avctx, AV_LOG_ERROR,
-                   "%cIR filter coeff_bits must be between 1 and 16.\n",
-                   fchar);
-            return -1;
-        }
-        if (coeff_bits + coeff_shift > 16) {
-            av_log(m->avctx, AV_LOG_ERROR,
-                   "Sum of coeff_bits and coeff_shift for %cIR filter must be 16 or less.\n",
-                   fchar);
-            return -1;
-        }
-
-        for (i = 0; i < order; i++)
-            fcoeff[i] = get_sbits(gbp, coeff_bits) << coeff_shift;
-
-        if (get_bits1(gbp)) {
-            int state_bits, state_shift;
-
-            if (filter == FIR) {
-                av_log(m->avctx, AV_LOG_ERROR,
-                       "FIR filter has state data specified.\n");
-                return -1;
-            }
-
-            state_bits  = get_bits(gbp, 4);
-            state_shift = get_bits(gbp, 4);
-
-            /* TODO: Check validity of state data. */
-
-            for (i = 0; i < order; i++)
-                fp->state[i] = get_sbits(gbp, state_bits) << state_shift;
-        }
-    }
-
-    return 0;
-}
-
-/** Read parameters for primitive matrices. */
-
-static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int mat, ch;
-    const int max_primitive_matrices = m->avctx->codec_id == CODEC_ID_MLP
-                                     ? MAX_MATRICES_MLP
-                                     : MAX_MATRICES_TRUEHD;
-
-    if (m->matrix_changed++ > 1) {
-        av_log(m->avctx, AV_LOG_ERROR, "Matrices may change only once per access unit.\n");
-        return -1;
-    }
-
-    s->num_primitive_matrices = get_bits(gbp, 4);
-
-    if (s->num_primitive_matrices > max_primitive_matrices) {
-        av_log(m->avctx, AV_LOG_ERROR,
-               "Number of primitive matrices cannot be greater than %d.\n",
-               max_primitive_matrices);
-        return -1;
-    }
-
-    for (mat = 0; mat < s->num_primitive_matrices; mat++) {
-        int frac_bits, max_chan;
-        s->matrix_out_ch[mat] = get_bits(gbp, 4);
-        frac_bits             = get_bits(gbp, 4);
-        s->lsb_bypass   [mat] = get_bits1(gbp);
-
-        if (s->matrix_out_ch[mat] > s->max_matrix_channel) {
-            av_log(m->avctx, AV_LOG_ERROR,
-                    "Invalid channel %d specified as output from matrix.\n",
-                    s->matrix_out_ch[mat]);
-            return -1;
-        }
-        if (frac_bits > 14) {
-            av_log(m->avctx, AV_LOG_ERROR,
-                    "Too many fractional bits specified.\n");
-            return -1;
-        }
-
-        max_chan = s->max_matrix_channel;
-        if (!s->noise_type)
-            max_chan+=2;
-
-        for (ch = 0; ch <= max_chan; ch++) {
-            int coeff_val = 0;
-            if (get_bits1(gbp))
-                coeff_val = get_sbits(gbp, frac_bits + 2);
-
-            s->matrix_coeff[mat][ch] = coeff_val << (14 - frac_bits);
-        }
-
-        if (s->noise_type)
-            s->matrix_noise_shift[mat] = get_bits(gbp, 4);
-        else
-            s->matrix_noise_shift[mat] = 0;
-    }
-
-    return 0;
-}
-
-/** Read channel parameters. */
-
-static int read_channel_params(MLPDecodeContext *m, unsigned int substr,
-                               GetBitContext *gbp, unsigned int ch)
-{
-    SubStream *s = &m->substream[substr];
-    ChannelParams *cp = &s->channel_params[ch];
-    FilterParams *fir = &cp->filter_params[FIR];
-    FilterParams *iir = &cp->filter_params[IIR];
-
-    if (s->param_presence_flags & PARAM_FIR)
-        if (get_bits1(gbp))
-            if (read_filter_params(m, gbp, substr, ch, FIR) < 0)
-                return -1;
-
-    if (s->param_presence_flags & PARAM_IIR)
-        if (get_bits1(gbp))
-            if (read_filter_params(m, gbp, substr, ch, IIR) < 0)
-                return -1;
-
-    if (fir->order + iir->order > 8) {
-        av_log(m->avctx, AV_LOG_ERROR, "Total filter orders too high.\n");
-        return -1;
-    }
-
-    if (fir->order && iir->order &&
-        fir->shift != iir->shift) {
-        av_log(m->avctx, AV_LOG_ERROR,
-                "FIR and IIR filters must use the same precision.\n");
-        return -1;
-    }
-    /* The FIR and IIR filters must have the same precision.
-     * To simplify the filtering code, only the precision of the
-     * FIR filter is considered. If only the IIR filter is employed,
-     * the FIR filter precision is set to that of the IIR filter, so
-     * that the filtering code can use it. */
-    if (!fir->order && iir->order)
-        fir->shift = iir->shift;
-
-    if (s->param_presence_flags & PARAM_HUFFOFFSET)
-        if (get_bits1(gbp))
-            cp->huff_offset = get_sbits(gbp, 15);
-
-    cp->codebook  = get_bits(gbp, 2);
-    cp->huff_lsbs = get_bits(gbp, 5);
-
-    if (cp->huff_lsbs > 24) {
-        av_log(m->avctx, AV_LOG_ERROR, "Invalid huff_lsbs.\n");
-        return -1;
-    }
-
-    cp->sign_huff_offset = calculate_sign_huff(m, substr, ch);
-
-    return 0;
-}
-
-/** Read decoding parameters that change more often than those in the restart
- *  header. */
-
-static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp,
-                                unsigned int substr)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int ch;
-
-    if (s->param_presence_flags & PARAM_PRESENCE)
-        if (get_bits1(gbp))
-            s->param_presence_flags = get_bits(gbp, 8);
-
-    if (s->param_presence_flags & PARAM_BLOCKSIZE)
-        if (get_bits1(gbp)) {
-            s->blocksize = get_bits(gbp, 9);
-            if (s->blocksize < 8 || s->blocksize > m->access_unit_size) {
-                av_log(m->avctx, AV_LOG_ERROR, "Invalid blocksize.");
-                s->blocksize = 0;
-                return -1;
-            }
-        }
-
-    if (s->param_presence_flags & PARAM_MATRIX)
-        if (get_bits1(gbp))
-            if (read_matrix_params(m, substr, gbp) < 0)
-                return -1;
-
-    if (s->param_presence_flags & PARAM_OUTSHIFT)
-        if (get_bits1(gbp))
-            for (ch = 0; ch <= s->max_matrix_channel; ch++)
-                s->output_shift[ch] = get_sbits(gbp, 4);
-
-    if (s->param_presence_flags & PARAM_QUANTSTEP)
-        if (get_bits1(gbp))
-            for (ch = 0; ch <= s->max_channel; ch++) {
-                ChannelParams *cp = &s->channel_params[ch];
-
-                s->quant_step_size[ch] = get_bits(gbp, 4);
-
-                cp->sign_huff_offset = calculate_sign_huff(m, substr, ch);
-            }
-
-    for (ch = s->min_channel; ch <= s->max_channel; ch++)
-        if (get_bits1(gbp))
-            if (read_channel_params(m, substr, gbp, ch) < 0)
-                return -1;
-
-    return 0;
-}
-
-#define MSB_MASK(bits)  (-1u << bits)
-
-/** Generate PCM samples using the prediction filters and residual values
- *  read from the data stream, and update the filter state. */
-
-static void filter_channel(MLPDecodeContext *m, unsigned int substr,
-                           unsigned int channel)
-{
-    SubStream *s = &m->substream[substr];
-    const int32_t *fircoeff = s->channel_params[channel].coeff[FIR];
-    int32_t state_buffer[NUM_FILTERS][MAX_BLOCKSIZE + MAX_FIR_ORDER];
-    int32_t *firbuf = state_buffer[FIR] + MAX_BLOCKSIZE;
-    int32_t *iirbuf = state_buffer[IIR] + MAX_BLOCKSIZE;
-    FilterParams *fir = &s->channel_params[channel].filter_params[FIR];
-    FilterParams *iir = &s->channel_params[channel].filter_params[IIR];
-    unsigned int filter_shift = fir->shift;
-    int32_t mask = MSB_MASK(s->quant_step_size[channel]);
-
-    memcpy(firbuf, fir->state, MAX_FIR_ORDER * sizeof(int32_t));
-    memcpy(iirbuf, iir->state, MAX_IIR_ORDER * sizeof(int32_t));
-
-    m->dsp.mlp_filter_channel(firbuf, fircoeff,
-                              fir->order, iir->order,
-                              filter_shift, mask, s->blocksize,
-                              &m->sample_buffer[s->blockpos][channel]);
-
-    memcpy(fir->state, firbuf - s->blocksize, MAX_FIR_ORDER * sizeof(int32_t));
-    memcpy(iir->state, iirbuf - s->blocksize, MAX_IIR_ORDER * sizeof(int32_t));
-}
-
-/** Read a block of PCM residual data (or actual if no filtering active). */
-
-static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp,
-                           unsigned int substr)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int i, ch, expected_stream_pos = 0;
-
-    if (s->data_check_present) {
-        expected_stream_pos  = get_bits_count(gbp);
-        expected_stream_pos += get_bits(gbp, 16);
-        av_log(m->avctx, AV_LOG_WARNING, "This file contains some features "
-               "we have not tested yet. %s\n", sample_message);
-    }
-
-    if (s->blockpos + s->blocksize > m->access_unit_size) {
-        av_log(m->avctx, AV_LOG_ERROR, "too many audio samples in frame\n");
-        return -1;
-    }
-
-    memset(&m->bypassed_lsbs[s->blockpos][0], 0,
-           s->blocksize * sizeof(m->bypassed_lsbs[0]));
-
-    for (i = 0; i < s->blocksize; i++)
-        if (read_huff_channels(m, gbp, substr, i) < 0)
-            return -1;
-
-    for (ch = s->min_channel; ch <= s->max_channel; ch++)
-        filter_channel(m, substr, ch);
-
-    s->blockpos += s->blocksize;
-
-    if (s->data_check_present) {
-        if (get_bits_count(gbp) != expected_stream_pos)
-            av_log(m->avctx, AV_LOG_ERROR, "block data length mismatch\n");
-        skip_bits(gbp, 8);
-    }
-
-    return 0;
-}
-
-/** Data table used for TrueHD noise generation function. */
-
-static const int8_t noise_table[256] = {
-     30,  51,  22,  54,   3,   7,  -4,  38,  14,  55,  46,  81,  22,  58,  -3,   2,
-     52,  31,  -7,  51,  15,  44,  74,  30,  85, -17,  10,  33,  18,  80,  28,  62,
-     10,  32,  23,  69,  72,  26,  35,  17,  73,  60,   8,  56,   2,   6,  -2,  -5,
-     51,   4,  11,  50,  66,  76,  21,  44,  33,  47,   1,  26,  64,  48,  57,  40,
-     38,  16, -10, -28,  92,  22, -18,  29, -10,   5, -13,  49,  19,  24,  70,  34,
-     61,  48,  30,  14,  -6,  25,  58,  33,  42,  60,  67,  17,  54,  17,  22,  30,
-     67,  44,  -9,  50, -11,  43,  40,  32,  59,  82,  13,  49, -14,  55,  60,  36,
-     48,  49,  31,  47,  15,  12,   4,  65,   1,  23,  29,  39,  45,  -2,  84,  69,
-      0,  72,  37,  57,  27,  41, -15, -16,  35,  31,  14,  61,  24,   0,  27,  24,
-     16,  41,  55,  34,  53,   9,  56,  12,  25,  29,  53,   5,  20, -20,  -8,  20,
-     13,  28,  -3,  78,  38,  16,  11,  62,  46,  29,  21,  24,  46,  65,  43, -23,
-     89,  18,  74,  21,  38, -12,  19,  12, -19,   8,  15,  33,   4,  57,   9,  -8,
-     36,  35,  26,  28,   7,  83,  63,  79,  75,  11,   3,  87,  37,  47,  34,  40,
-     39,  19,  20,  42,  27,  34,  39,  77,  13,  42,  59,  64,  45,  -1,  32,  37,
-     45,  -5,  53,  -6,   7,  36,  50,  23,   6,  32,   9, -21,  18,  71,  27,  52,
-    -25,  31,  35,  42,  -1,  68,  63,  52,  26,  43,  66,  37,  41,  25,  40,  70,
-};
-
-/** Noise generation functions.
- *  I'm not sure what these are for - they seem to be some kind of pseudorandom
- *  sequence generators, used to generate noise data which is used when the
- *  channels are rematrixed. I'm not sure if they provide a practical benefit
- *  to compression, or just obfuscate the decoder. Are they for some kind of
- *  dithering? */
-
-/** Generate two channels of noise, used in the matrix when
- *  restart sync word == 0x31ea. */
-
-static void generate_2_noise_channels(MLPDecodeContext *m, unsigned int substr)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int i;
-    uint32_t seed = s->noisegen_seed;
-    unsigned int maxchan = s->max_matrix_channel;
-
-    for (i = 0; i < s->blockpos; i++) {
-        uint16_t seed_shr7 = seed >> 7;
-        m->sample_buffer[i][maxchan+1] = ((int8_t)(seed >> 15)) << s->noise_shift;
-        m->sample_buffer[i][maxchan+2] = ((int8_t) seed_shr7)   << s->noise_shift;
-
-        seed = (seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);
-    }
-
-    s->noisegen_seed = seed;
-}
-
-/** Generate a block of noise, used when restart sync word == 0x31eb. */
-
-static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int i;
-    uint32_t seed = s->noisegen_seed;
-
-    for (i = 0; i < m->access_unit_size_pow2; i++) {
-        uint8_t seed_shr15 = seed >> 15;
-        m->noise_buffer[i] = noise_table[seed_shr15];
-        seed = (seed << 8) ^ seed_shr15 ^ (seed_shr15 << 5);
-    }
-
-    s->noisegen_seed = seed;
-}
-
-
-/** Apply the channel matrices in turn to reconstruct the original audio
- *  samples. */
-
-static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int mat, src_ch, i;
-    unsigned int maxchan;
-
-    maxchan = s->max_matrix_channel;
-    if (!s->noise_type) {
-        generate_2_noise_channels(m, substr);
-        maxchan += 2;
-    } else {
-        fill_noise_buffer(m, substr);
-    }
-
-    for (mat = 0; mat < s->num_primitive_matrices; mat++) {
-        int matrix_noise_shift = s->matrix_noise_shift[mat];
-        unsigned int dest_ch = s->matrix_out_ch[mat];
-        int32_t mask = MSB_MASK(s->quant_step_size[dest_ch]);
-        int32_t *coeffs = s->matrix_coeff[mat];
-        int index  = s->num_primitive_matrices - mat;
-        int index2 = 2 * index + 1;
-
-        /* TODO: DSPContext? */
-
-        for (i = 0; i < s->blockpos; i++) {
-            int32_t bypassed_lsb = m->bypassed_lsbs[i][mat];
-            int32_t *samples = m->sample_buffer[i];
-            int64_t accum = 0;
-
-            for (src_ch = 0; src_ch <= maxchan; src_ch++)
-                accum += (int64_t) samples[src_ch] * coeffs[src_ch];
-
-            if (matrix_noise_shift) {
-                index &= m->access_unit_size_pow2 - 1;
-                accum += m->noise_buffer[index] << (matrix_noise_shift + 7);
-                index += index2;
-            }
-
-            samples[dest_ch] = ((accum >> 14) & mask) + bypassed_lsb;
-        }
-    }
-}
-
-/** Write the audio data into the output buffer. */
-
-static int output_data_internal(MLPDecodeContext *m, unsigned int substr,
-                                uint8_t *data, unsigned int *data_size, int is32)
-{
-    SubStream *s = &m->substream[substr];
-    unsigned int i, out_ch = 0;
-    int32_t *data_32 = (int32_t*) data;
-    int16_t *data_16 = (int16_t*) data;
-
-    if (*data_size < (s->max_channel + 1) * s->blockpos * (is32 ? 4 : 2))
-        return -1;
-
-    for (i = 0; i < s->blockpos; i++) {
-        for (out_ch = 0; out_ch <= s->max_matrix_channel; out_ch++) {
-            int mat_ch = s->ch_assign[out_ch];
-            int32_t sample = m->sample_buffer[i][mat_ch]
-                          << s->output_shift[mat_ch];
-            s->lossless_check_data ^= (sample & 0xffffff) << mat_ch;
-            if (is32) *data_32++ = sample << 8;
-            else      *data_16++ = sample >> 8;
-        }
-    }
-
-    *data_size = i * out_ch * (is32 ? 4 : 2);
-
-    return 0;
-}
-
-static int output_data(MLPDecodeContext *m, unsigned int substr,
-                       uint8_t *data, unsigned int *data_size)
-{
-    if (m->avctx->sample_fmt == SAMPLE_FMT_S32)
-        return output_data_internal(m, substr, data, data_size, 1);
-    else
-        return output_data_internal(m, substr, data, data_size, 0);
-}
-
-
-/** Read an access unit from the stream.
- *  Returns < 0 on error, 0 if not enough data is present in the input stream
- *  otherwise returns the number of bytes consumed. */
-
-static int read_access_unit(AVCodecContext *avctx, void* data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MLPDecodeContext *m = avctx->priv_data;
-    GetBitContext gb;
-    unsigned int length, substr;
-    unsigned int substream_start;
-    unsigned int header_size = 4;
-    unsigned int substr_header_size = 0;
-    uint8_t substream_parity_present[MAX_SUBSTREAMS];
-    uint16_t substream_data_len[MAX_SUBSTREAMS];
-    uint8_t parity_bits;
-
-    if (buf_size < 4)
-        return 0;
-
-    length = (AV_RB16(buf) & 0xfff) * 2;
-
-    if (length < 4 || length > buf_size)
-        return -1;
-
-    init_get_bits(&gb, (buf + 4), (length - 4) * 8);
-
-    m->is_major_sync_unit = 0;
-    if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
-        if (read_major_sync(m, &gb) < 0)
-            goto error;
-        m->is_major_sync_unit = 1;
-        header_size += 28;
-    }
-
-    if (!m->params_valid) {
-        av_log(m->avctx, AV_LOG_WARNING,
-               "Stream parameters not seen; skipping frame.\n");
-        *data_size = 0;
-        return length;
-    }
-
-    substream_start = 0;
-
-    for (substr = 0; substr < m->num_substreams; substr++) {
-        int extraword_present, checkdata_present, end, nonrestart_substr;
-
-        extraword_present = get_bits1(&gb);
-        nonrestart_substr = get_bits1(&gb);
-        checkdata_present = get_bits1(&gb);
-        skip_bits1(&gb);
-
-        end = get_bits(&gb, 12) * 2;
-
-        substr_header_size += 2;
-
-        if (extraword_present) {
-            if (m->avctx->codec_id == CODEC_ID_MLP) {
-                av_log(m->avctx, AV_LOG_ERROR, "There must be no extraword for MLP.\n");
-                goto error;
-            }
-            skip_bits(&gb, 16);
-            substr_header_size += 2;
-        }
-
-        if (!(nonrestart_substr ^ m->is_major_sync_unit)) {
-            av_log(m->avctx, AV_LOG_ERROR, "Invalid nonrestart_substr.\n");
-            goto error;
-        }
-
-        if (end + header_size + substr_header_size > length) {
-            av_log(m->avctx, AV_LOG_ERROR,
-                   "Indicated length of substream %d data goes off end of "
-                   "packet.\n", substr);
-            end = length - header_size - substr_header_size;
-        }
-
-        if (end < substream_start) {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Indicated end offset of substream %d data "
-                   "is smaller than calculated start offset.\n",
-                   substr);
-            goto error;
-        }
-
-        if (substr > m->max_decoded_substream)
-            continue;
-
-        substream_parity_present[substr] = checkdata_present;
-        substream_data_len[substr] = end - substream_start;
-        substream_start = end;
-    }
-
-    parity_bits  = ff_mlp_calculate_parity(buf, 4);
-    parity_bits ^= ff_mlp_calculate_parity(buf + header_size, substr_header_size);
-
-    if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
-        av_log(avctx, AV_LOG_ERROR, "Parity check failed.\n");
-        goto error;
-    }
-
-    buf += header_size + substr_header_size;
-
-    for (substr = 0; substr <= m->max_decoded_substream; substr++) {
-        SubStream *s = &m->substream[substr];
-        init_get_bits(&gb, buf, substream_data_len[substr] * 8);
-
-        m->matrix_changed = 0;
-        memset(m->filter_changed, 0, sizeof(m->filter_changed));
-
-        s->blockpos = 0;
-        do {
-            if (get_bits1(&gb)) {
-                if (get_bits1(&gb)) {
-                    /* A restart header should be present. */
-                    if (read_restart_header(m, &gb, buf, substr) < 0)
-                        goto next_substr;
-                    s->restart_seen = 1;
-                }
-
-                if (!s->restart_seen)
-                    goto next_substr;
-                if (read_decoding_params(m, &gb, substr) < 0)
-                    goto next_substr;
-            }
-
-            if (!s->restart_seen)
-                goto next_substr;
-
-            if (read_block_data(m, &gb, substr) < 0)
-                return -1;
-
-            if (get_bits_count(&gb) >= substream_data_len[substr] * 8)
-                goto substream_length_mismatch;
-
-        } while (!get_bits1(&gb));
-
-        skip_bits(&gb, (-get_bits_count(&gb)) & 15);
-
-        if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) {
-            int shorten_by;
-
-            if (get_bits(&gb, 16) != 0xD234)
-                return -1;
-
-            shorten_by = get_bits(&gb, 16);
-            if      (m->avctx->codec_id == CODEC_ID_TRUEHD && shorten_by  & 0x2000)
-                s->blockpos -= FFMIN(shorten_by & 0x1FFF, s->blockpos);
-            else if (m->avctx->codec_id == CODEC_ID_MLP    && shorten_by != 0xD234)
-                return -1;
-
-            if (substr == m->max_decoded_substream)
-                av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n");
-        }
-
-        if (substream_parity_present[substr]) {
-            uint8_t parity, checksum;
-
-            if (substream_data_len[substr] * 8 - get_bits_count(&gb) != 16)
-                goto substream_length_mismatch;
-
-            parity   = ff_mlp_calculate_parity(buf, substream_data_len[substr] - 2);
-            checksum = ff_mlp_checksum8       (buf, substream_data_len[substr] - 2);
-
-            if ((get_bits(&gb, 8) ^ parity) != 0xa9    )
-                av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr);
-            if ( get_bits(&gb, 8)           != checksum)
-                av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n"    , substr);
-        }
-
-        if (substream_data_len[substr] * 8 != get_bits_count(&gb))
-            goto substream_length_mismatch;
-
-next_substr:
-        if (!s->restart_seen)
-            av_log(m->avctx, AV_LOG_ERROR,
-                   "No restart header present in substream %d.\n", substr);
-
-        buf += substream_data_len[substr];
-    }
-
-    rematrix_channels(m, m->max_decoded_substream);
-
-    if (output_data(m, m->max_decoded_substream, data, data_size) < 0)
-        return -1;
-
-    return length;
-
-substream_length_mismatch:
-    av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", substr);
-    return -1;
-
-error:
-    m->params_valid = 0;
-    return -1;
-}
-
-AVCodec mlp_decoder = {
-    "mlp",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MLP,
-    sizeof(MLPDecodeContext),
-    mlp_decode_init,
-    NULL,
-    NULL,
-    read_access_unit,
-    .long_name = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"),
-};
-
-#if CONFIG_TRUEHD_DECODER
-AVCodec truehd_decoder = {
-    "truehd",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_TRUEHD,
-    sizeof(MLPDecodeContext),
-    mlp_decode_init,
-    NULL,
-    NULL,
-    read_access_unit,
-    .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
-};
-#endif /* CONFIG_TRUEHD_DECODER */
diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c
deleted file mode 100644
index a0647ee..0000000
--- a/libavcodec/mlpdsp.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2007-2008 Ian Caulfield
- *               2009 Ramiro Polla
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/mlp.h"
-#include "dsputil.h"
-
-static void ff_mlp_filter_channel(int32_t *state, const int32_t *coeff,
-                                  int firorder, int iirorder,
-                                  unsigned int filter_shift, int32_t mask, int blocksize,
-                                  int32_t *sample_buffer)
-{
-    int32_t *firbuf = state;
-    int32_t *iirbuf = state + MAX_BLOCKSIZE + MAX_FIR_ORDER;
-    const int32_t *fircoeff = coeff;
-    const int32_t *iircoeff = coeff + MAX_FIR_ORDER;
-    int i;
-
-    for (i = 0; i < blocksize; i++) {
-        int32_t residual = *sample_buffer;
-        unsigned int order;
-        int64_t accum = 0;
-        int32_t result;
-
-        for (order = 0; order < firorder; order++)
-            accum += (int64_t) firbuf[order] * fircoeff[order];
-        for (order = 0; order < iirorder; order++)
-            accum += (int64_t) iirbuf[order] * iircoeff[order];
-
-        accum  = accum >> filter_shift;
-        result = (accum + residual) & mask;
-
-        *--firbuf = result;
-        *--iirbuf = result - accum;
-
-        *sample_buffer = result;
-        sample_buffer += MAX_CHANNELS;
-    }
-}
-
-void ff_mlp_init(DSPContext* c, AVCodecContext *avctx)
-{
-    c->mlp_filter_channel = ff_mlp_filter_channel;
-    if (ARCH_X86)
-        ff_mlp_init_x86(c, avctx);
-}
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
deleted file mode 100644
index 6dbc0c4..0000000
--- a/libavcodec/mmvideo.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * American Laser Games MM Video Decoder
- * Copyright (c) 2006,2008 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * American Laser Games MM Video Decoder
- * by Peter Ross (pross at xvid.org)
- *
- * The MM format was used by IBM-PC ports of ALG's "arcade shooter" games,
- * including Mad Dog McCree and Crime Patrol.
- *
- * Technical details here:
- *  http://wiki.multimedia.cx/index.php?title=American_Laser_Games_MM
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#define MM_PREAMBLE_SIZE    6
-
-#define MM_TYPE_INTER       0x5
-#define MM_TYPE_INTRA       0x8
-#define MM_TYPE_INTRA_HH    0xc
-#define MM_TYPE_INTER_HH    0xd
-#define MM_TYPE_INTRA_HHV   0xe
-#define MM_TYPE_INTER_HHV   0xf
-#define MM_TYPE_PALETTE     0x31
-
-typedef struct MmContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    int palette[AVPALETTE_COUNT];
-} MmContext;
-
-static av_cold int mm_decode_init(AVCodecContext *avctx)
-{
-    MmContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    s->frame.reference = 1;
-    if (avctx->get_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static void mm_decode_pal(MmContext *s, const uint8_t *buf, const uint8_t *buf_end)
-{
-    int i;
-    buf += 4;
-    for (i=0; i<128 && buf+2<buf_end; i++) {
-        s->palette[i] = AV_RB24(buf);
-        s->palette[i+128] = s->palette[i]<<2;
-        buf += 3;
-    }
-}
-
-static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size)
-{
-    int i, x, y;
-    i=0; x=0; y=0;
-
-    while(i<buf_size) {
-        int run_length, color;
-
-        if (buf[i] & 0x80) {
-            run_length = 1;
-            color = buf[i];
-            i++;
-        }else{
-            run_length = (buf[i] & 0x7f) + 2;
-            color = buf[i+1];
-            i+=2;
-        }
-
-        if (half_horiz)
-            run_length *=2;
-
-        if (color) {
-            memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length);
-            if (half_vert)
-                memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length);
-        }
-        x+= run_length;
-
-        if (x >= s->avctx->width) {
-            x=0;
-            y += half_vert ? 2 : 1;
-        }
-    }
-}
-
-static void mm_decode_inter(MmContext * s, int half_horiz, int half_vert, const uint8_t *buf, int buf_size)
-{
-    const int data_ptr = 2 + AV_RL16(&buf[0]);
-    int d, r, y;
-    d = data_ptr; r = 2; y = 0;
-
-    while(r < data_ptr) {
-        int i, j;
-        int length = buf[r] & 0x7f;
-        int x = buf[r+1] + ((buf[r] & 0x80) << 1);
-        r += 2;
-
-        if (length==0) {
-            y += x;
-            continue;
-        }
-
-        for(i=0; i<length; i++) {
-            for(j=0; j<8; j++) {
-                int replace = (buf[r+i] >> (7-j)) & 1;
-                if (replace) {
-                    int color = buf[d];
-                    s->frame.data[0][y*s->frame.linesize[0] + x] = color;
-                    if (half_horiz)
-                        s->frame.data[0][y*s->frame.linesize[0] + x + 1] = color;
-                    if (half_vert) {
-                        s->frame.data[0][(y+1)*s->frame.linesize[0] + x] = color;
-                        if (half_horiz)
-                            s->frame.data[0][(y+1)*s->frame.linesize[0] + x + 1] = color;
-                    }
-                    d++;
-                }
-                x += half_horiz ? 2 : 1;
-            }
-        }
-
-        r += length;
-        y += half_vert ? 2 : 1;
-    }
-}
-
-static int mm_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MmContext *s = avctx->priv_data;
-    const uint8_t *buf_end = buf+buf_size;
-    int type;
-
-    type = AV_RL16(&buf[0]);
-    buf += MM_PREAMBLE_SIZE;
-    buf_size -= MM_PREAMBLE_SIZE;
-
-    switch(type) {
-    case MM_TYPE_PALETTE   : mm_decode_pal(s, buf, buf_end); return buf_size;
-    case MM_TYPE_INTRA     : mm_decode_intra(s, 0, 0, buf, buf_size); break;
-    case MM_TYPE_INTRA_HH  : mm_decode_intra(s, 1, 0, buf, buf_size); break;
-    case MM_TYPE_INTRA_HHV : mm_decode_intra(s, 1, 1, buf, buf_size); break;
-    case MM_TYPE_INTER     : mm_decode_inter(s, 0, 0, buf, buf_size); break;
-    case MM_TYPE_INTER_HH  : mm_decode_inter(s, 1, 0, buf, buf_size); break;
-    case MM_TYPE_INTER_HHV : mm_decode_inter(s, 1, 1, buf, buf_size); break;
-    default :
-        return -1;
-    }
-
-    memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    return buf_size;
-}
-
-static av_cold int mm_decode_end(AVCodecContext *avctx)
-{
-    MmContext *s = avctx->priv_data;
-
-    if(s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec mmvideo_decoder = {
-    "mmvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MMVIDEO,
-    sizeof(MmContext),
-    mm_decode_init,
-    NULL,
-    mm_decode_end,
-    mm_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM Video"),
-};
diff --git a/libavcodec/motion-test.c b/libavcodec/motion-test.c
deleted file mode 100644
index 37f55a6..0000000
--- a/libavcodec/motion-test.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * motion test.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include "config.h"
-#include "dsputil.h"
-#include "libavutil/lfg.h"
-
-#undef exit
-#undef printf
-
-#define WIDTH 64
-#define HEIGHT 64
-
-uint8_t img1[WIDTH * HEIGHT];
-uint8_t img2[WIDTH * HEIGHT];
-
-static void fill_random(uint8_t *tab, int size)
-{
-    int i;
-    AVLFG prng;
-
-    av_lfg_init(&prng, 1);
-    for(i=0;i<size;i++) {
-#if 1
-        tab[i] = av_lfg_get(&prng) % 256;
-#else
-        tab[i] = i;
-#endif
-    }
-}
-
-static void help(void)
-{
-    printf("motion-test [-h]\n"
-           "test motion implementations\n");
-    exit(1);
-}
-
-static int64_t gettime(void)
-{
-    struct timeval tv;
-    gettimeofday(&tv,NULL);
-    return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-#define NB_ITS 500
-
-int dummy;
-
-static void test_motion(const char *name,
-                 me_cmp_func test_func, me_cmp_func ref_func)
-{
-    int x, y, d1, d2, it;
-    uint8_t *ptr;
-    int64_t ti;
-    printf("testing '%s'\n", name);
-
-    /* test correctness */
-    for(it=0;it<20;it++) {
-
-        fill_random(img1, WIDTH * HEIGHT);
-        fill_random(img2, WIDTH * HEIGHT);
-
-        for(y=0;y<HEIGHT-17;y++) {
-            for(x=0;x<WIDTH-17;x++) {
-                ptr = img2 + y * WIDTH + x;
-                d1 = test_func(NULL, img1, ptr, WIDTH, 1);
-                d2 = ref_func(NULL, img1, ptr, WIDTH, 1);
-                if (d1 != d2) {
-                    printf("error: mmx=%d c=%d\n", d1, d2);
-                }
-            }
-        }
-    }
-    emms_c();
-
-    /* speed test */
-    ti = gettime();
-    d1 = 0;
-    for(it=0;it<NB_ITS;it++) {
-        for(y=0;y<HEIGHT-17;y++) {
-            for(x=0;x<WIDTH-17;x++) {
-                ptr = img2 + y * WIDTH + x;
-                d1 += test_func(NULL, img1, ptr, WIDTH, 1);
-            }
-        }
-    }
-    emms_c();
-    dummy = d1; /* avoid optimization */
-    ti = gettime() - ti;
-
-    printf("  %0.0f kop/s\n",
-           (double)NB_ITS * (WIDTH - 16) * (HEIGHT - 16) /
-           (double)(ti / 1000.0));
-}
-
-
-int main(int argc, char **argv)
-{
-    AVCodecContext *ctx;
-    int c;
-    DSPContext cctx, mmxctx;
-    int flags[2] = { FF_MM_MMX, FF_MM_MMX2 };
-    int flags_size = HAVE_MMX2 ? 2 : 1;
-
-    for(;;) {
-        c = getopt(argc, argv, "h");
-        if (c == -1)
-            break;
-        switch(c) {
-        case 'h':
-            help();
-            break;
-        }
-    }
-
-    printf("ffmpeg motion test\n");
-
-    ctx = avcodec_alloc_context();
-    ctx->dsp_mask = FF_MM_FORCE;
-    dsputil_init(&cctx, ctx);
-    for (c = 0; c < flags_size; c++) {
-        int x;
-        ctx->dsp_mask = FF_MM_FORCE | flags[c];
-        dsputil_init(&mmxctx, ctx);
-
-        for (x = 0; x < 2; x++) {
-            printf("%s for %dx%d pixels\n", c ? "mmx2" : "mmx",
-                   x ? 8 : 16, x ? 8 : 16);
-            test_motion("mmx",     mmxctx.pix_abs[x][0], cctx.pix_abs[x][0]);
-            test_motion("mmx_x2",  mmxctx.pix_abs[x][1], cctx.pix_abs[x][1]);
-            test_motion("mmx_y2",  mmxctx.pix_abs[x][2], cctx.pix_abs[x][2]);
-            test_motion("mmx_xy2", mmxctx.pix_abs[x][3], cctx.pix_abs[x][3]);
-        }
-    }
-    av_free(ctx);
-
-    return 0;
-}
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
deleted file mode 100644
index 82a36d0..0000000
--- a/libavcodec/motion_est.c
+++ /dev/null
@@ -1,2016 +0,0 @@
-/*
- * Motion estimation
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * new motion estimation (X1/EPZS) by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Motion estimation.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-#include "libavutil/intmath.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mathops.h"
-#include "mpegvideo.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#define SQ(a) ((a)*(a))
-
-#define P_LEFT P[1]
-#define P_TOP P[2]
-#define P_TOPRIGHT P[3]
-#define P_MEDIAN P[4]
-#define P_MV1 P[9]
-
-static inline int sad_hpel_motion_search(MpegEncContext * s,
-                                  int *mx_ptr, int *my_ptr, int dmin,
-                                  int src_index, int ref_index,
-                                  int size, int h);
-
-static inline int update_map_generation(MotionEstContext *c)
-{
-    c->map_generation+= 1<<(ME_MAP_MV_BITS*2);
-    if(c->map_generation==0){
-        c->map_generation= 1<<(ME_MAP_MV_BITS*2);
-        memset(c->map, 0, sizeof(uint32_t)*ME_MAP_SIZE);
-    }
-    return c->map_generation;
-}
-
-/* shape adaptive search stuff */
-typedef struct Minima{
-    int height;
-    int x, y;
-    int checked;
-}Minima;
-
-static int minima_cmp(const void *a, const void *b){
-    const Minima *da = (const Minima *) a;
-    const Minima *db = (const Minima *) b;
-
-    return da->height - db->height;
-}
-
-#define FLAG_QPEL   1 //must be 1
-#define FLAG_CHROMA 2
-#define FLAG_DIRECT 4
-
-static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){
-    const int offset[3]= {
-          y*c->  stride + x,
-        ((y*c->uvstride + x)>>1),
-        ((y*c->uvstride + x)>>1),
-    };
-    int i;
-    for(i=0; i<3; i++){
-        c->src[0][i]= src [i] + offset[i];
-        c->ref[0][i]= ref [i] + offset[i];
-    }
-    if(ref_index){
-        for(i=0; i<3; i++){
-            c->ref[ref_index][i]= ref2[i] + offset[i];
-        }
-    }
-}
-
-static int get_flags(MotionEstContext *c, int direct, int chroma){
-    return   ((c->avctx->flags&CODEC_FLAG_QPEL) ? FLAG_QPEL : 0)
-           + (direct ? FLAG_DIRECT : 0)
-           + (chroma ? FLAG_CHROMA : 0);
-}
-
-static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
-                      const int size, const int h, int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel){
-    MotionEstContext * const c= &s->me;
-    const int stride= c->stride;
-    const int hx= subx + (x<<(1+qpel));
-    const int hy= suby + (y<<(1+qpel));
-    uint8_t * const * const ref= c->ref[ref_index];
-    uint8_t * const * const src= c->src[src_index];
-    int d;
-    //FIXME check chroma 4mv, (no crashes ...)
-        assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1));
-        if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){
-            const int time_pp= s->pp_time;
-            const int time_pb= s->pb_time;
-            const int mask= 2*qpel+1;
-            if(s->mv_type==MV_TYPE_8X8){
-                int i;
-                for(i=0; i<4; i++){
-                    int fx = c->direct_basis_mv[i][0] + hx;
-                    int fy = c->direct_basis_mv[i][1] + hy;
-                    int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4));
-                    int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4));
-                    int fxy= (fx&mask) + ((fy&mask)<<(qpel+1));
-                    int bxy= (bx&mask) + ((by&mask)<<(qpel+1));
-
-                    uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1);
-                    if(qpel){
-                        c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride);
-                        c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride);
-                    }else{
-                        c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8);
-                        c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8);
-                    }
-                }
-            }else{
-                int fx = c->direct_basis_mv[0][0] + hx;
-                int fy = c->direct_basis_mv[0][1] + hy;
-                int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp);
-                int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp);
-                int fxy= (fx&mask) + ((fy&mask)<<(qpel+1));
-                int bxy= (bx&mask) + ((by&mask)<<(qpel+1));
-
-                if(qpel){
-                    c->qpel_put[1][fxy](c->temp               , ref[0] + (fx>>2) + (fy>>2)*stride               , stride);
-                    c->qpel_put[1][fxy](c->temp + 8           , ref[0] + (fx>>2) + (fy>>2)*stride + 8           , stride);
-                    c->qpel_put[1][fxy](c->temp     + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride     + 8*stride, stride);
-                    c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride);
-                    c->qpel_avg[1][bxy](c->temp               , ref[8] + (bx>>2) + (by>>2)*stride               , stride);
-                    c->qpel_avg[1][bxy](c->temp + 8           , ref[8] + (bx>>2) + (by>>2)*stride + 8           , stride);
-                    c->qpel_avg[1][bxy](c->temp     + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride     + 8*stride, stride);
-                    c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride);
-                }else{
-                    assert((fx>>1) + 16*s->mb_x >= -16);
-                    assert((fy>>1) + 16*s->mb_y >= -16);
-                    assert((fx>>1) + 16*s->mb_x <= s->width);
-                    assert((fy>>1) + 16*s->mb_y <= s->height);
-                    assert((bx>>1) + 16*s->mb_x >= -16);
-                    assert((by>>1) + 16*s->mb_y >= -16);
-                    assert((bx>>1) + 16*s->mb_x <= s->width);
-                    assert((by>>1) + 16*s->mb_y <= s->height);
-
-                    c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16);
-                    c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16);
-                }
-            }
-            d = cmp_func(s, c->temp, src[0], stride, 16);
-        }else
-            d= 256*256*256*32;
-    return d;
-}
-
-static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
-                      const int size, const int h, int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel, int chroma){
-    MotionEstContext * const c= &s->me;
-    const int stride= c->stride;
-    const int uvstride= c->uvstride;
-    const int dxy= subx + (suby<<(1+qpel)); //FIXME log2_subpel?
-    const int hx= subx + (x<<(1+qpel));
-    const int hy= suby + (y<<(1+qpel));
-    uint8_t * const * const ref= c->ref[ref_index];
-    uint8_t * const * const src= c->src[src_index];
-    int d;
-    //FIXME check chroma 4mv, (no crashes ...)
-        int uvdxy;              /* no, it might not be used uninitialized */
-        if(dxy){
-            if(qpel){
-                c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h)
-                if(chroma){
-                    int cx= hx/2;
-                    int cy= hy/2;
-                    cx= (cx>>1)|(cx&1);
-                    cy= (cy>>1)|(cy&1);
-                    uvdxy= (cx&1) + 2*(cy&1);
-                    //FIXME x/y wrong, but mpeg4 qpel is sick anyway, we should drop as much of it as possible in favor for h264
-                }
-            }else{
-                c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h);
-                if(chroma)
-                    uvdxy= dxy | (x&1) | (2*(y&1));
-            }
-            d = cmp_func(s, c->temp, src[0], stride, h);
-        }else{
-            d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h);
-            if(chroma)
-                uvdxy= (x&1) + 2*(y&1);
-        }
-        if(chroma){
-            uint8_t * const uvtemp= c->temp + 16*stride;
-            c->hpel_put[size+1][uvdxy](uvtemp  , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
-            c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1);
-            d += chroma_cmp_func(s, uvtemp  , src[1], uvstride, h>>1);
-            d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1);
-        }
-    return d;
-}
-
-static int cmp_simple(MpegEncContext *s, const int x, const int y,
-                      int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func){
-    return cmp_inline(s,x,y,0,0,0,16,ref_index,src_index, cmp_func, chroma_cmp_func, 0, 0);
-}
-
-static int cmp_fpel_internal(MpegEncContext *s, const int x, const int y,
-                      const int size, const int h, int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
-    if(flags&FLAG_DIRECT){
-        return cmp_direct_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL);
-    }else{
-        return cmp_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0, flags&FLAG_CHROMA);
-    }
-}
-
-static int cmp_internal(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
-                      const int size, const int h, int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
-    if(flags&FLAG_DIRECT){
-        return cmp_direct_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL);
-    }else{
-        return cmp_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL, flags&FLAG_CHROMA);
-    }
-}
-
-/*! \brief compares a block (either a full macroblock or a partition thereof)
-    against a proposed motion-compensated prediction of that block
- */
-static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
-                      const int size, const int h, int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
-    if(av_builtin_constant_p(flags) && av_builtin_constant_p(h) && av_builtin_constant_p(size)
-       && av_builtin_constant_p(subx) && av_builtin_constant_p(suby)
-       && flags==0 && h==16 && size==0 && subx==0 && suby==0){
-        return cmp_simple(s,x,y,ref_index,src_index, cmp_func, chroma_cmp_func);
-    }else if(av_builtin_constant_p(subx) && av_builtin_constant_p(suby)
-       && subx==0 && suby==0){
-        return cmp_fpel_internal(s,x,y,size,h,ref_index,src_index, cmp_func, chroma_cmp_func,flags);
-    }else{
-        return cmp_internal(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags);
-    }
-}
-
-static int cmp_hpel(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
-                      const int size, const int h, int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
-    if(flags&FLAG_DIRECT){
-        return cmp_direct_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0);
-    }else{
-        return cmp_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0, flags&FLAG_CHROMA);
-    }
-}
-
-static int cmp_qpel(MpegEncContext *s, const int x, const int y, const int subx, const int suby,
-                      const int size, const int h, int ref_index, int src_index,
-                      me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){
-    if(flags&FLAG_DIRECT){
-        return cmp_direct_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 1);
-    }else{
-        return cmp_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 1, flags&FLAG_CHROMA);
-    }
-}
-
-#include "motion_est_template.c"
-
-static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){
-    return 0;
-}
-
-static void zero_hpel(uint8_t *a, const uint8_t *b, int stride, int h){
-}
-
-int ff_init_me(MpegEncContext *s){
-    MotionEstContext * const c= &s->me;
-    int cache_size= FFMIN(ME_MAP_SIZE>>ME_MAP_SHIFT, 1<<ME_MAP_SHIFT);
-    int dia_size= FFMAX(FFABS(s->avctx->dia_size)&255, FFABS(s->avctx->pre_dia_size)&255);
-
-    if(FFMIN(s->avctx->dia_size, s->avctx->pre_dia_size) < -ME_MAP_SIZE){
-        av_log(s->avctx, AV_LOG_ERROR, "ME_MAP size is too small for SAB diamond\n");
-        return -1;
-    }
-    //special case of snow is needed because snow uses its own iterative ME code
-    if(s->me_method!=ME_ZERO && s->me_method!=ME_EPZS && s->me_method!=ME_X1 && s->avctx->codec_id != CODEC_ID_SNOW){
-        av_log(s->avctx, AV_LOG_ERROR, "me_method is only allowed to be set to zero and epzs; for hex,umh,full and others see dia_size\n");
-        return -1;
-    }
-
-    c->avctx= s->avctx;
-
-    if(cache_size < 2*dia_size && !c->stride){
-        av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n");
-    }
-
-    ff_set_cmp(&s->dsp, s->dsp.me_pre_cmp, c->avctx->me_pre_cmp);
-    ff_set_cmp(&s->dsp, s->dsp.me_cmp, c->avctx->me_cmp);
-    ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, c->avctx->me_sub_cmp);
-    ff_set_cmp(&s->dsp, s->dsp.mb_cmp, c->avctx->mb_cmp);
-
-    c->flags    = get_flags(c, 0, c->avctx->me_cmp    &FF_CMP_CHROMA);
-    c->sub_flags= get_flags(c, 0, c->avctx->me_sub_cmp&FF_CMP_CHROMA);
-    c->mb_flags = get_flags(c, 0, c->avctx->mb_cmp    &FF_CMP_CHROMA);
-
-/*FIXME s->no_rounding b_type*/
-    if(s->flags&CODEC_FLAG_QPEL){
-        c->sub_motion_search= qpel_motion_search;
-        c->qpel_avg= s->dsp.avg_qpel_pixels_tab;
-        if(s->no_rounding) c->qpel_put= s->dsp.put_no_rnd_qpel_pixels_tab;
-        else               c->qpel_put= s->dsp.put_qpel_pixels_tab;
-    }else{
-        if(c->avctx->me_sub_cmp&FF_CMP_CHROMA)
-            c->sub_motion_search= hpel_motion_search;
-        else if(   c->avctx->me_sub_cmp == FF_CMP_SAD
-                && c->avctx->    me_cmp == FF_CMP_SAD
-                && c->avctx->    mb_cmp == FF_CMP_SAD)
-            c->sub_motion_search= sad_hpel_motion_search; // 2050 vs. 2450 cycles
-        else
-            c->sub_motion_search= hpel_motion_search;
-    }
-    c->hpel_avg= s->dsp.avg_pixels_tab;
-    if(s->no_rounding) c->hpel_put= s->dsp.put_no_rnd_pixels_tab;
-    else               c->hpel_put= s->dsp.put_pixels_tab;
-
-    if(s->linesize){
-        c->stride  = s->linesize;
-        c->uvstride= s->uvlinesize;
-    }else{
-        c->stride  = 16*s->mb_width + 32;
-        c->uvstride=  8*s->mb_width + 16;
-    }
-
-    /* 8x8 fullpel search would need a 4x4 chroma compare, which we do
-     * not have yet, and even if we had, the motion estimation code
-     * does not expect it. */
-    if(s->codec_id != CODEC_ID_SNOW){
-        if((c->avctx->me_cmp&FF_CMP_CHROMA)/* && !s->dsp.me_cmp[2]*/){
-            s->dsp.me_cmp[2]= zero_cmp;
-        }
-        if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){
-            s->dsp.me_sub_cmp[2]= zero_cmp;
-        }
-        c->hpel_put[2][0]= c->hpel_put[2][1]=
-        c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
-    }
-
-    if(s->codec_id == CODEC_ID_H261){
-        c->sub_motion_search= no_sub_motion_search;
-    }
-
-    return 0;
-}
-
-#if 0
-static int pix_dev(uint8_t * pix, int line_size, int mean)
-{
-    int s, i, j;
-
-    s = 0;
-    for (i = 0; i < 16; i++) {
-        for (j = 0; j < 16; j += 8) {
-            s += FFABS(pix[0]-mean);
-            s += FFABS(pix[1]-mean);
-            s += FFABS(pix[2]-mean);
-            s += FFABS(pix[3]-mean);
-            s += FFABS(pix[4]-mean);
-            s += FFABS(pix[5]-mean);
-            s += FFABS(pix[6]-mean);
-            s += FFABS(pix[7]-mean);
-            pix += 8;
-        }
-        pix += line_size - 16;
-    }
-    return s;
-}
-#endif
-
-static inline void no_motion_search(MpegEncContext * s,
-                                    int *mx_ptr, int *my_ptr)
-{
-    *mx_ptr = 16 * s->mb_x;
-    *my_ptr = 16 * s->mb_y;
-}
-
-#define Z_THRESHOLD 256
-
-#define CHECK_SAD_HALF_MV(suffix, x, y) \
-{\
-    d= s->dsp.pix_abs[size][(x?1:0)+(y?2:0)](NULL, pix, ptr+((x)>>1), stride, h);\
-    d += (mv_penalty[pen_x + x] + mv_penalty[pen_y + y])*penalty_factor;\
-    COPY3_IF_LT(dminh, d, dx, x, dy, y)\
-}
-
-static inline int sad_hpel_motion_search(MpegEncContext * s,
-                                  int *mx_ptr, int *my_ptr, int dmin,
-                                  int src_index, int ref_index,
-                                  int size, int h)
-{
-    MotionEstContext * const c= &s->me;
-    const int penalty_factor= c->sub_penalty_factor;
-    int mx, my, dminh;
-    uint8_t *pix, *ptr;
-    int stride= c->stride;
-    const int flags= c->sub_flags;
-    LOAD_COMMON
-
-    assert(flags == 0);
-
-    if(c->skip){
-//    printf("S");
-        *mx_ptr = 0;
-        *my_ptr = 0;
-        return dmin;
-    }
-//    printf("N");
-
-    pix = c->src[src_index][0];
-
-    mx = *mx_ptr;
-    my = *my_ptr;
-    ptr = c->ref[ref_index][0] + (my * stride) + mx;
-
-    dminh = dmin;
-
-    if (mx > xmin && mx < xmax &&
-        my > ymin && my < ymax) {
-        int dx=0, dy=0;
-        int d, pen_x, pen_y;
-        const int index= (my<<ME_MAP_SHIFT) + mx;
-        const int t= score_map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)];
-        const int l= score_map[(index- 1               )&(ME_MAP_SIZE-1)];
-        const int r= score_map[(index+ 1               )&(ME_MAP_SIZE-1)];
-        const int b= score_map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)];
-        mx<<=1;
-        my<<=1;
-
-
-        pen_x= pred_x + mx;
-        pen_y= pred_y + my;
-
-        ptr-= stride;
-        if(t<=b){
-            CHECK_SAD_HALF_MV(y2 , 0, -1)
-            if(l<=r){
-                CHECK_SAD_HALF_MV(xy2, -1, -1)
-                if(t+r<=b+l){
-                    CHECK_SAD_HALF_MV(xy2, +1, -1)
-                    ptr+= stride;
-                }else{
-                    ptr+= stride;
-                    CHECK_SAD_HALF_MV(xy2, -1, +1)
-                }
-                CHECK_SAD_HALF_MV(x2 , -1,  0)
-            }else{
-                CHECK_SAD_HALF_MV(xy2, +1, -1)
-                if(t+l<=b+r){
-                    CHECK_SAD_HALF_MV(xy2, -1, -1)
-                    ptr+= stride;
-                }else{
-                    ptr+= stride;
-                    CHECK_SAD_HALF_MV(xy2, +1, +1)
-                }
-                CHECK_SAD_HALF_MV(x2 , +1,  0)
-            }
-        }else{
-            if(l<=r){
-                if(t+l<=b+r){
-                    CHECK_SAD_HALF_MV(xy2, -1, -1)
-                    ptr+= stride;
-                }else{
-                    ptr+= stride;
-                    CHECK_SAD_HALF_MV(xy2, +1, +1)
-                }
-                CHECK_SAD_HALF_MV(x2 , -1,  0)
-                CHECK_SAD_HALF_MV(xy2, -1, +1)
-            }else{
-                if(t+r<=b+l){
-                    CHECK_SAD_HALF_MV(xy2, +1, -1)
-                    ptr+= stride;
-                }else{
-                    ptr+= stride;
-                    CHECK_SAD_HALF_MV(xy2, -1, +1)
-                }
-                CHECK_SAD_HALF_MV(x2 , +1,  0)
-                CHECK_SAD_HALF_MV(xy2, +1, +1)
-            }
-            CHECK_SAD_HALF_MV(y2 ,  0, +1)
-        }
-        mx+=dx;
-        my+=dy;
-
-    }else{
-        mx<<=1;
-        my<<=1;
-    }
-
-    *mx_ptr = mx;
-    *my_ptr = my;
-    return dminh;
-}
-
-static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4)
-{
-    const int xy= s->mb_x + s->mb_y*s->mb_stride;
-
-    s->p_mv_table[xy][0] = mx;
-    s->p_mv_table[xy][1] = my;
-
-    /* has already been set to the 4 MV if 4MV is done */
-    if(mv4){
-        int mot_xy= s->block_index[0];
-
-        s->current_picture.motion_val[0][mot_xy  ][0]= mx;
-        s->current_picture.motion_val[0][mot_xy  ][1]= my;
-        s->current_picture.motion_val[0][mot_xy+1][0]= mx;
-        s->current_picture.motion_val[0][mot_xy+1][1]= my;
-
-        mot_xy += s->b8_stride;
-        s->current_picture.motion_val[0][mot_xy  ][0]= mx;
-        s->current_picture.motion_val[0][mot_xy  ][1]= my;
-        s->current_picture.motion_val[0][mot_xy+1][0]= mx;
-        s->current_picture.motion_val[0][mot_xy+1][1]= my;
-    }
-}
-
-/**
- * get fullpel ME search limits.
- */
-static inline void get_limits(MpegEncContext *s, int x, int y)
-{
-    MotionEstContext * const c= &s->me;
-    int range= c->avctx->me_range >> (1 + !!(c->flags&FLAG_QPEL));
-/*
-    if(c->avctx->me_range) c->range= c->avctx->me_range >> 1;
-    else                   c->range= 16;
-*/
-    if (s->unrestricted_mv) {
-        c->xmin = - x - 16;
-        c->ymin = - y - 16;
-        c->xmax = - x + s->mb_width *16;
-        c->ymax = - y + s->mb_height*16;
-    } else if (s->out_format == FMT_H261){
-        // Search range of H261 is different from other codec standards
-        c->xmin = (x > 15) ? - 15 : 0;
-        c->ymin = (y > 15) ? - 15 : 0;
-        c->xmax = (x < s->mb_width * 16 - 16) ? 15 : 0;
-        c->ymax = (y < s->mb_height * 16 - 16) ? 15 : 0;
-    } else {
-        c->xmin = - x;
-        c->ymin = - y;
-        c->xmax = - x + s->mb_width *16 - 16;
-        c->ymax = - y + s->mb_height*16 - 16;
-    }
-    if(range){
-        c->xmin = FFMAX(c->xmin,-range);
-        c->xmax = FFMIN(c->xmax, range);
-        c->ymin = FFMAX(c->ymin,-range);
-        c->ymax = FFMIN(c->ymax, range);
-    }
-}
-
-static inline void init_mv4_ref(MotionEstContext *c){
-    const int stride= c->stride;
-
-    c->ref[1][0] = c->ref[0][0] + 8;
-    c->ref[2][0] = c->ref[0][0] + 8*stride;
-    c->ref[3][0] = c->ref[2][0] + 8;
-    c->src[1][0] = c->src[0][0] + 8;
-    c->src[2][0] = c->src[0][0] + 8*stride;
-    c->src[3][0] = c->src[2][0] + 8;
-}
-
-static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
-{
-    MotionEstContext * const c= &s->me;
-    const int size= 1;
-    const int h=8;
-    int block;
-    int P[10][2];
-    int dmin_sum=0, mx4_sum=0, my4_sum=0;
-    int same=1;
-    const int stride= c->stride;
-    uint8_t *mv_penalty= c->current_mv_penalty;
-
-    init_mv4_ref(c);
-
-    for(block=0; block<4; block++){
-        int mx4, my4;
-        int pred_x4, pred_y4;
-        int dmin4;
-        static const int off[4]= {2, 1, 1, -1};
-        const int mot_stride = s->b8_stride;
-        const int mot_xy = s->block_index[block];
-
-        P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0];
-        P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1];
-
-        if(P_LEFT[0]       > (c->xmax<<shift)) P_LEFT[0]       = (c->xmax<<shift);
-
-        /* special case for first line */
-        if (s->first_slice_line && block<2) {
-            c->pred_x= pred_x4= P_LEFT[0];
-            c->pred_y= pred_y4= P_LEFT[1];
-        } else {
-            P_TOP[0]      = s->current_picture.motion_val[0][mot_xy - mot_stride             ][0];
-            P_TOP[1]      = s->current_picture.motion_val[0][mot_xy - mot_stride             ][1];
-            P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][0];
-            P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][1];
-            if(P_TOP[1]      > (c->ymax<<shift)) P_TOP[1]     = (c->ymax<<shift);
-            if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
-            if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift);
-            if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
-
-            P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
-            P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
-
-            c->pred_x= pred_x4 = P_MEDIAN[0];
-            c->pred_y= pred_y4 = P_MEDIAN[1];
-        }
-        P_MV1[0]= mx;
-        P_MV1[1]= my;
-
-        dmin4 = epzs_motion_search4(s, &mx4, &my4, P, block, block, s->p_mv_table, (1<<16)>>shift);
-
-        dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h);
-
-        if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
-            int dxy;
-            const int offset= ((block&1) + (block>>1)*stride)*8;
-            uint8_t *dest_y = c->scratchpad + offset;
-            if(s->quarter_sample){
-                uint8_t *ref= c->ref[block][0] + (mx4>>2) + (my4>>2)*stride;
-                dxy = ((my4 & 3) << 2) | (mx4 & 3);
-
-                if(s->no_rounding)
-                    s->dsp.put_no_rnd_qpel_pixels_tab[1][dxy](dest_y   , ref    , stride);
-                else
-                    s->dsp.put_qpel_pixels_tab       [1][dxy](dest_y   , ref    , stride);
-            }else{
-                uint8_t *ref= c->ref[block][0] + (mx4>>1) + (my4>>1)*stride;
-                dxy = ((my4 & 1) << 1) | (mx4 & 1);
-
-                if(s->no_rounding)
-                    s->dsp.put_no_rnd_pixels_tab[1][dxy](dest_y    , ref    , stride, h);
-                else
-                    s->dsp.put_pixels_tab       [1][dxy](dest_y    , ref    , stride, h);
-            }
-            dmin_sum+= (mv_penalty[mx4-pred_x4] + mv_penalty[my4-pred_y4])*c->mb_penalty_factor;
-        }else
-            dmin_sum+= dmin4;
-
-        if(s->quarter_sample){
-            mx4_sum+= mx4/2;
-            my4_sum+= my4/2;
-        }else{
-            mx4_sum+= mx4;
-            my4_sum+= my4;
-        }
-
-        s->current_picture.motion_val[0][ s->block_index[block] ][0]= mx4;
-        s->current_picture.motion_val[0][ s->block_index[block] ][1]= my4;
-
-        if(mx4 != mx || my4 != my) same=0;
-    }
-
-    if(same)
-        return INT_MAX;
-
-    if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
-        dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16);
-    }
-
-    if(c->avctx->mb_cmp&FF_CMP_CHROMA){
-        int dxy;
-        int mx, my;
-        int offset;
-
-        mx= ff_h263_round_chroma(mx4_sum);
-        my= ff_h263_round_chroma(my4_sum);
-        dxy = ((my & 1) << 1) | (mx & 1);
-
-        offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize;
-
-        if(s->no_rounding){
-            s->dsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad    , s->last_picture.data[1] + offset, s->uvlinesize, 8);
-            s->dsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad+8  , s->last_picture.data[2] + offset, s->uvlinesize, 8);
-        }else{
-            s->dsp.put_pixels_tab       [1][dxy](c->scratchpad    , s->last_picture.data[1] + offset, s->uvlinesize, 8);
-            s->dsp.put_pixels_tab       [1][dxy](c->scratchpad+8  , s->last_picture.data[2] + offset, s->uvlinesize, 8);
-        }
-
-        dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad  , s->uvlinesize, 8);
-        dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8);
-    }
-
-    c->pred_x= mx;
-    c->pred_y= my;
-
-    switch(c->avctx->mb_cmp&0xFF){
-    /*case FF_CMP_SSE:
-        return dmin_sum+ 32*s->qscale*s->qscale;*/
-    case FF_CMP_RD:
-        return dmin_sum;
-    default:
-        return dmin_sum+ 11*c->mb_penalty_factor;
-    }
-}
-
-static inline void init_interlaced_ref(MpegEncContext *s, int ref_index){
-    MotionEstContext * const c= &s->me;
-
-    c->ref[1+ref_index][0] = c->ref[0+ref_index][0] + s->linesize;
-    c->src[1][0] = c->src[0][0] + s->linesize;
-    if(c->flags & FLAG_CHROMA){
-        c->ref[1+ref_index][1] = c->ref[0+ref_index][1] + s->uvlinesize;
-        c->ref[1+ref_index][2] = c->ref[0+ref_index][2] + s->uvlinesize;
-        c->src[1][1] = c->src[0][1] + s->uvlinesize;
-        c->src[1][2] = c->src[0][2] + s->uvlinesize;
-    }
-}
-
-static int interlaced_search(MpegEncContext *s, int ref_index,
-                             int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select)
-{
-    MotionEstContext * const c= &s->me;
-    const int size=0;
-    const int h=8;
-    int block;
-    int P[10][2];
-    uint8_t * const mv_penalty= c->current_mv_penalty;
-    int same=1;
-    const int stride= 2*s->linesize;
-    int dmin_sum= 0;
-    const int mot_stride= s->mb_stride;
-    const int xy= s->mb_x + s->mb_y*mot_stride;
-
-    c->ymin>>=1;
-    c->ymax>>=1;
-    c->stride<<=1;
-    c->uvstride<<=1;
-    init_interlaced_ref(s, ref_index);
-
-    for(block=0; block<2; block++){
-        int field_select;
-        int best_dmin= INT_MAX;
-        int best_field= -1;
-
-        for(field_select=0; field_select<2; field_select++){
-            int dmin, mx_i, my_i;
-            int16_t (*mv_table)[2]= mv_tables[block][field_select];
-
-            if(user_field_select){
-                assert(field_select==0 || field_select==1);
-                assert(field_select_tables[block][xy]==0 || field_select_tables[block][xy]==1);
-                if(field_select_tables[block][xy] != field_select)
-                    continue;
-            }
-
-            P_LEFT[0] = mv_table[xy - 1][0];
-            P_LEFT[1] = mv_table[xy - 1][1];
-            if(P_LEFT[0]       > (c->xmax<<1)) P_LEFT[0]       = (c->xmax<<1);
-
-            c->pred_x= P_LEFT[0];
-            c->pred_y= P_LEFT[1];
-
-            if(!s->first_slice_line){
-                P_TOP[0]      = mv_table[xy - mot_stride][0];
-                P_TOP[1]      = mv_table[xy - mot_stride][1];
-                P_TOPRIGHT[0] = mv_table[xy - mot_stride + 1][0];
-                P_TOPRIGHT[1] = mv_table[xy - mot_stride + 1][1];
-                if(P_TOP[1]      > (c->ymax<<1)) P_TOP[1]     = (c->ymax<<1);
-                if(P_TOPRIGHT[0] < (c->xmin<<1)) P_TOPRIGHT[0]= (c->xmin<<1);
-                if(P_TOPRIGHT[0] > (c->xmax<<1)) P_TOPRIGHT[0]= (c->xmax<<1);
-                if(P_TOPRIGHT[1] > (c->ymax<<1)) P_TOPRIGHT[1]= (c->ymax<<1);
-
-                P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
-                P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
-            }
-            P_MV1[0]= mx; //FIXME not correct if block != field_select
-            P_MV1[1]= my / 2;
-
-            dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1);
-
-            dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h);
-
-            mv_table[xy][0]= mx_i;
-            mv_table[xy][1]= my_i;
-
-            if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){
-                int dxy;
-
-                //FIXME chroma ME
-                uint8_t *ref= c->ref[field_select+ref_index][0] + (mx_i>>1) + (my_i>>1)*stride;
-                dxy = ((my_i & 1) << 1) | (mx_i & 1);
-
-                if(s->no_rounding){
-                    s->dsp.put_no_rnd_pixels_tab[size][dxy](c->scratchpad, ref    , stride, h);
-                }else{
-                    s->dsp.put_pixels_tab       [size][dxy](c->scratchpad, ref    , stride, h);
-                }
-                dmin= s->dsp.mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h);
-                dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor;
-            }else
-                dmin+= c->mb_penalty_factor; //field_select bits
-
-            dmin += field_select != block; //slightly prefer same field
-
-            if(dmin < best_dmin){
-                best_dmin= dmin;
-                best_field= field_select;
-            }
-        }
-        {
-            int16_t (*mv_table)[2]= mv_tables[block][best_field];
-
-            if(mv_table[xy][0] != mx) same=0; //FIXME check if these checks work and are any good at all
-            if(mv_table[xy][1]&1) same=0;
-            if(mv_table[xy][1]*2 != my) same=0;
-            if(best_field != block) same=0;
-        }
-
-        field_select_tables[block][xy]= best_field;
-        dmin_sum += best_dmin;
-    }
-
-    c->ymin<<=1;
-    c->ymax<<=1;
-    c->stride>>=1;
-    c->uvstride>>=1;
-
-    if(same)
-        return INT_MAX;
-
-    switch(c->avctx->mb_cmp&0xFF){
-    /*case FF_CMP_SSE:
-        return dmin_sum+ 32*s->qscale*s->qscale;*/
-    case FF_CMP_RD:
-        return dmin_sum;
-    default:
-        return dmin_sum+ 11*c->mb_penalty_factor;
-    }
-}
-
-static void clip_input_mv(MpegEncContext * s, int16_t *mv, int interlaced){
-    int ymax= s->me.ymax>>interlaced;
-    int ymin= s->me.ymin>>interlaced;
-
-    if(mv[0] < s->me.xmin) mv[0] = s->me.xmin;
-    if(mv[0] > s->me.xmax) mv[0] = s->me.xmax;
-    if(mv[1] <       ymin) mv[1] =       ymin;
-    if(mv[1] >       ymax) mv[1] =       ymax;
-}
-
-static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){
-    MotionEstContext * const c= &s->me;
-    Picture *p= s->current_picture_ptr;
-    int mb_xy= mb_x + mb_y*s->mb_stride;
-    int xy= 2*mb_x + 2*mb_y*s->b8_stride;
-    int mb_type= s->current_picture.mb_type[mb_xy];
-    int flags= c->flags;
-    int shift= (flags&FLAG_QPEL) + 1;
-    int mask= (1<<shift)-1;
-    int x, y, i;
-    int d=0;
-    me_cmp_func cmpf= s->dsp.sse[0];
-    me_cmp_func chroma_cmpf= s->dsp.sse[1];
-
-    if(p_type && USES_LIST(mb_type, 1)){
-        av_log(c->avctx, AV_LOG_ERROR, "backward motion vector in P frame\n");
-        return INT_MAX/2;
-    }
-    assert(IS_INTRA(mb_type) || USES_LIST(mb_type,0) || USES_LIST(mb_type,1));
-
-    for(i=0; i<4; i++){
-        int xy= s->block_index[i];
-        clip_input_mv(s, p->motion_val[0][xy], !!IS_INTERLACED(mb_type));
-        clip_input_mv(s, p->motion_val[1][xy], !!IS_INTERLACED(mb_type));
-    }
-
-    if(IS_INTERLACED(mb_type)){
-        int xy2= xy  + s->b8_stride;
-        s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA;
-        c->stride<<=1;
-        c->uvstride<<=1;
-
-        if(!(s->flags & CODEC_FLAG_INTERLACED_ME)){
-            av_log(c->avctx, AV_LOG_ERROR, "Interlaced macroblock selected but interlaced motion estimation disabled\n");
-            return INT_MAX/2;
-        }
-
-        if(USES_LIST(mb_type, 0)){
-            int field_select0= p->ref_index[0][4*mb_xy  ];
-            int field_select1= p->ref_index[0][4*mb_xy+2];
-            assert(field_select0==0 ||field_select0==1);
-            assert(field_select1==0 ||field_select1==1);
-            init_interlaced_ref(s, 0);
-
-            if(p_type){
-                s->p_field_select_table[0][mb_xy]= field_select0;
-                s->p_field_select_table[1][mb_xy]= field_select1;
-                *(uint32_t*)s->p_field_mv_table[0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ];
-                *(uint32_t*)s->p_field_mv_table[1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2];
-                s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER_I;
-            }else{
-                s->b_field_select_table[0][0][mb_xy]= field_select0;
-                s->b_field_select_table[0][1][mb_xy]= field_select1;
-                *(uint32_t*)s->b_field_mv_table[0][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ];
-                *(uint32_t*)s->b_field_mv_table[0][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2];
-                s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_FORWARD_I;
-            }
-
-            x= p->motion_val[0][xy ][0];
-            y= p->motion_val[0][xy ][1];
-            d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0, 0, cmpf, chroma_cmpf, flags);
-            x= p->motion_val[0][xy2][0];
-            y= p->motion_val[0][xy2][1];
-            d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1, 1, cmpf, chroma_cmpf, flags);
-        }
-        if(USES_LIST(mb_type, 1)){
-            int field_select0= p->ref_index[1][4*mb_xy  ];
-            int field_select1= p->ref_index[1][4*mb_xy+2];
-            assert(field_select0==0 ||field_select0==1);
-            assert(field_select1==0 ||field_select1==1);
-            init_interlaced_ref(s, 2);
-
-            s->b_field_select_table[1][0][mb_xy]= field_select0;
-            s->b_field_select_table[1][1][mb_xy]= field_select1;
-            *(uint32_t*)s->b_field_mv_table[1][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[1][xy ];
-            *(uint32_t*)s->b_field_mv_table[1][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[1][xy2];
-            if(USES_LIST(mb_type, 0)){
-                s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BIDIR_I;
-            }else{
-                s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BACKWARD_I;
-            }
-
-            x= p->motion_val[1][xy ][0];
-            y= p->motion_val[1][xy ][1];
-            d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags);
-            x= p->motion_val[1][xy2][0];
-            y= p->motion_val[1][xy2][1];
-            d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1+2, 1, cmpf, chroma_cmpf, flags);
-            //FIXME bidir scores
-        }
-        c->stride>>=1;
-        c->uvstride>>=1;
-    }else if(IS_8X8(mb_type)){
-        if(!(s->flags & CODEC_FLAG_4MV)){
-            av_log(c->avctx, AV_LOG_ERROR, "4MV macroblock selected but 4MV encoding disabled\n");
-            return INT_MAX/2;
-        }
-        cmpf= s->dsp.sse[1];
-        chroma_cmpf= s->dsp.sse[1];
-        init_mv4_ref(c);
-        for(i=0; i<4; i++){
-            xy= s->block_index[i];
-            x= p->motion_val[0][xy][0];
-            y= p->motion_val[0][xy][1];
-            d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 1, 8, i, i, cmpf, chroma_cmpf, flags);
-        }
-        s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER4V;
-    }else{
-        if(USES_LIST(mb_type, 0)){
-            if(p_type){
-                *(uint32_t*)s->p_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
-                s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER;
-            }else if(USES_LIST(mb_type, 1)){
-                *(uint32_t*)s->b_bidir_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
-                *(uint32_t*)s->b_bidir_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy];
-                s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BIDIR;
-            }else{
-                *(uint32_t*)s->b_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy];
-                s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_FORWARD;
-            }
-            x= p->motion_val[0][xy][0];
-            y= p->motion_val[0][xy][1];
-            d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 0, 0, cmpf, chroma_cmpf, flags);
-        }else if(USES_LIST(mb_type, 1)){
-            *(uint32_t*)s->b_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy];
-            s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BACKWARD;
-
-            x= p->motion_val[1][xy][0];
-            y= p->motion_val[1][xy][1];
-            d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 2, 0, cmpf, chroma_cmpf, flags);
-        }else
-            s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA;
-    }
-    return d;
-}
-
-void ff_estimate_p_frame_motion(MpegEncContext * s,
-                                int mb_x, int mb_y)
-{
-    MotionEstContext * const c= &s->me;
-    uint8_t *pix, *ppix;
-    int sum, mx, my, dmin;
-    int varc;            ///< the variance of the block (sum of squared (p[y][x]-average))
-    int vard;            ///< sum of squared differences with the estimated motion vector
-    int P[10][2];
-    const int shift= 1+s->quarter_sample;
-    int mb_type=0;
-    Picture * const pic= &s->current_picture;
-
-    init_ref(c, s->new_picture.data, s->last_picture.data, NULL, 16*mb_x, 16*mb_y, 0);
-
-    assert(s->quarter_sample==0 || s->quarter_sample==1);
-    assert(s->linesize == c->stride);
-    assert(s->uvlinesize == c->uvstride);
-
-    c->penalty_factor    = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
-    c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
-    c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
-    c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
-
-    get_limits(s, 16*mb_x, 16*mb_y);
-    c->skip=0;
-
-    /* intra / predictive decision */
-    pix = c->src[0][0];
-    sum = s->dsp.pix_sum(pix, s->linesize);
-    varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500;
-
-    pic->mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
-    pic->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8;
-    c->mb_var_sum_temp += (varc+128)>>8;
-
-    if(c->avctx->me_threshold){
-        vard= check_input_motion(s, mb_x, mb_y, 1);
-
-        if((vard+128)>>8 < c->avctx->me_threshold){
-            int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100);
-            int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20;
-            pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
-            c->mc_mb_var_sum_temp += (vard+128)>>8;
-            c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score);
-            return;
-        }
-        if((vard+128)>>8 < c->avctx->mb_threshold)
-            mb_type= s->mb_type[mb_x + mb_y*s->mb_stride];
-    }
-
-    switch(s->me_method) {
-    case ME_ZERO:
-    default:
-        no_motion_search(s, &mx, &my);
-        mx-= mb_x*16;
-        my-= mb_y*16;
-        dmin = 0;
-        break;
-    case ME_X1:
-    case ME_EPZS:
-       {
-            const int mot_stride = s->b8_stride;
-            const int mot_xy = s->block_index[0];
-
-            P_LEFT[0]       = s->current_picture.motion_val[0][mot_xy - 1][0];
-            P_LEFT[1]       = s->current_picture.motion_val[0][mot_xy - 1][1];
-
-            if(P_LEFT[0]       > (c->xmax<<shift)) P_LEFT[0]       = (c->xmax<<shift);
-
-            if(!s->first_slice_line) {
-                P_TOP[0]      = s->current_picture.motion_val[0][mot_xy - mot_stride    ][0];
-                P_TOP[1]      = s->current_picture.motion_val[0][mot_xy - mot_stride    ][1];
-                P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][0];
-                P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][1];
-                if(P_TOP[1]      > (c->ymax<<shift)) P_TOP[1]     = (c->ymax<<shift);
-                if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
-                if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
-
-                P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
-                P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
-
-                if(s->out_format == FMT_H263){
-                    c->pred_x = P_MEDIAN[0];
-                    c->pred_y = P_MEDIAN[1];
-                }else { /* mpeg1 at least */
-                    c->pred_x= P_LEFT[0];
-                    c->pred_y= P_LEFT[1];
-                }
-            }else{
-                c->pred_x= P_LEFT[0];
-                c->pred_y= P_LEFT[1];
-            }
-
-        }
-        dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, s->p_mv_table, (1<<16)>>shift, 0, 16);
-
-        break;
-    }
-
-    /* At this point (mx,my) are full-pell and the relative displacement */
-    ppix = c->ref[0][0] + (my * s->linesize) + mx;
-
-    vard = s->dsp.sse[0](NULL, pix, ppix, s->linesize, 16);
-
-    pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
-//    pic->mb_cmp_score[s->mb_stride * mb_y + mb_x] = dmin;
-    c->mc_mb_var_sum_temp += (vard+128)>>8;
-
-#if 0
-    printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n",
-           varc, s->avg_mb_var, sum, vard, mx - xx, my - yy);
-#endif
-    if(mb_type){
-        int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100);
-        int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20;
-        c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score);
-
-        if(mb_type == CANDIDATE_MB_TYPE_INTER){
-            c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
-            set_p_mv_tables(s, mx, my, 1);
-        }else{
-            mx <<=shift;
-            my <<=shift;
-        }
-        if(mb_type == CANDIDATE_MB_TYPE_INTER4V){
-            h263_mv4_search(s, mx, my, shift);
-
-            set_p_mv_tables(s, mx, my, 0);
-        }
-        if(mb_type == CANDIDATE_MB_TYPE_INTER_I){
-            interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 1);
-        }
-    }else if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){
-        int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100);
-        int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20;
-        c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score);
-
-        if (vard*2 + 200*256 > varc)
-            mb_type|= CANDIDATE_MB_TYPE_INTRA;
-        if (varc*2 + 200*256 > vard || s->qscale > 24){
-//        if (varc*2 + 200*256 + 50*(s->lambda2>>FF_LAMBDA_SHIFT) > vard){
-            mb_type|= CANDIDATE_MB_TYPE_INTER;
-            c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
-            if(s->flags&CODEC_FLAG_MV0)
-                if(mx || my)
-                    mb_type |= CANDIDATE_MB_TYPE_SKIPPED; //FIXME check difference
-        }else{
-            mx <<=shift;
-            my <<=shift;
-        }
-        if((s->flags&CODEC_FLAG_4MV)
-           && !c->skip && varc>50<<8 && vard>10<<8){
-            if(h263_mv4_search(s, mx, my, shift) < INT_MAX)
-                mb_type|=CANDIDATE_MB_TYPE_INTER4V;
-
-            set_p_mv_tables(s, mx, my, 0);
-        }else
-            set_p_mv_tables(s, mx, my, 1);
-        if((s->flags&CODEC_FLAG_INTERLACED_ME)
-           && !c->skip){ //FIXME varc/d checks
-            if(interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0) < INT_MAX)
-                mb_type |= CANDIDATE_MB_TYPE_INTER_I;
-        }
-    }else{
-        int intra_score, i;
-        mb_type= CANDIDATE_MB_TYPE_INTER;
-
-        dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
-        if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
-            dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
-
-        if((s->flags&CODEC_FLAG_4MV)
-           && !c->skip && varc>50<<8 && vard>10<<8){
-            int dmin4= h263_mv4_search(s, mx, my, shift);
-            if(dmin4 < dmin){
-                mb_type= CANDIDATE_MB_TYPE_INTER4V;
-                dmin=dmin4;
-            }
-        }
-        if((s->flags&CODEC_FLAG_INTERLACED_ME)
-           && !c->skip){ //FIXME varc/d checks
-            int dmin_i= interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0);
-            if(dmin_i < dmin){
-                mb_type = CANDIDATE_MB_TYPE_INTER_I;
-                dmin= dmin_i;
-            }
-        }
-
-//        pic->mb_cmp_score[s->mb_stride * mb_y + mb_x] = dmin;
-        set_p_mv_tables(s, mx, my, mb_type!=CANDIDATE_MB_TYPE_INTER4V);
-
-        /* get intra luma score */
-        if((c->avctx->mb_cmp&0xFF)==FF_CMP_SSE){
-            intra_score= varc - 500;
-        }else{
-            int mean= (sum+128)>>8;
-            mean*= 0x01010101;
-
-            for(i=0; i<16; i++){
-                *(uint32_t*)(&c->scratchpad[i*s->linesize+ 0]) = mean;
-                *(uint32_t*)(&c->scratchpad[i*s->linesize+ 4]) = mean;
-                *(uint32_t*)(&c->scratchpad[i*s->linesize+ 8]) = mean;
-                *(uint32_t*)(&c->scratchpad[i*s->linesize+12]) = mean;
-            }
-
-            intra_score= s->dsp.mb_cmp[0](s, c->scratchpad, pix, s->linesize, 16);
-        }
-#if 0 //FIXME
-        /* get chroma score */
-        if(c->avctx->mb_cmp&FF_CMP_CHROMA){
-            for(i=1; i<3; i++){
-                uint8_t *dest_c;
-                int mean;
-
-                if(s->out_format == FMT_H263){
-                    mean= (s->dc_val[i][mb_x + mb_y*s->b8_stride] + 4)>>3; //FIXME not exact but simple ;)
-                }else{
-                    mean= (s->last_dc[i] + 4)>>3;
-                }
-                dest_c = s->new_picture.data[i] + (mb_y * 8  * (s->uvlinesize)) + mb_x * 8;
-
-                mean*= 0x01010101;
-                for(i=0; i<8; i++){
-                    *(uint32_t*)(&c->scratchpad[i*s->uvlinesize+ 0]) = mean;
-                    *(uint32_t*)(&c->scratchpad[i*s->uvlinesize+ 4]) = mean;
-                }
-
-                intra_score+= s->dsp.mb_cmp[1](s, c->scratchpad, dest_c, s->uvlinesize);
-            }
-        }
-#endif
-        intra_score += c->mb_penalty_factor*16;
-
-        if(intra_score < dmin){
-            mb_type= CANDIDATE_MB_TYPE_INTRA;
-            s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_INTRA; //FIXME cleanup
-        }else
-            s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= 0;
-
-        {
-            int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100);
-            int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20;
-            c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score);
-        }
-    }
-
-    s->mb_type[mb_y*s->mb_stride + mb_x]= mb_type;
-}
-
-int ff_pre_estimate_p_frame_motion(MpegEncContext * s,
-                                    int mb_x, int mb_y)
-{
-    MotionEstContext * const c= &s->me;
-    int mx, my, dmin;
-    int P[10][2];
-    const int shift= 1+s->quarter_sample;
-    const int xy= mb_x + mb_y*s->mb_stride;
-    init_ref(c, s->new_picture.data, s->last_picture.data, NULL, 16*mb_x, 16*mb_y, 0);
-
-    assert(s->quarter_sample==0 || s->quarter_sample==1);
-
-    c->pre_penalty_factor    = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp);
-    c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
-
-    get_limits(s, 16*mb_x, 16*mb_y);
-    c->skip=0;
-
-    P_LEFT[0]       = s->p_mv_table[xy + 1][0];
-    P_LEFT[1]       = s->p_mv_table[xy + 1][1];
-
-    if(P_LEFT[0]       < (c->xmin<<shift)) P_LEFT[0]       = (c->xmin<<shift);
-
-    /* special case for first line */
-    if (s->first_slice_line) {
-        c->pred_x= P_LEFT[0];
-        c->pred_y= P_LEFT[1];
-        P_TOP[0]= P_TOPRIGHT[0]= P_MEDIAN[0]=
-        P_TOP[1]= P_TOPRIGHT[1]= P_MEDIAN[1]= 0; //FIXME
-    } else {
-        P_TOP[0]      = s->p_mv_table[xy + s->mb_stride    ][0];
-        P_TOP[1]      = s->p_mv_table[xy + s->mb_stride    ][1];
-        P_TOPRIGHT[0] = s->p_mv_table[xy + s->mb_stride - 1][0];
-        P_TOPRIGHT[1] = s->p_mv_table[xy + s->mb_stride - 1][1];
-        if(P_TOP[1]      < (c->ymin<<shift)) P_TOP[1]     = (c->ymin<<shift);
-        if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift);
-        if(P_TOPRIGHT[1] < (c->ymin<<shift)) P_TOPRIGHT[1]= (c->ymin<<shift);
-
-        P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
-        P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
-
-        c->pred_x = P_MEDIAN[0];
-        c->pred_y = P_MEDIAN[1];
-    }
-
-    dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, s->p_mv_table, (1<<16)>>shift, 0, 16);
-
-    s->p_mv_table[xy][0] = mx<<shift;
-    s->p_mv_table[xy][1] = my<<shift;
-
-    return dmin;
-}
-
-static int ff_estimate_motion_b(MpegEncContext * s,
-                       int mb_x, int mb_y, int16_t (*mv_table)[2], int ref_index, int f_code)
-{
-    MotionEstContext * const c= &s->me;
-    int mx, my, dmin;
-    int P[10][2];
-    const int shift= 1+s->quarter_sample;
-    const int mot_stride = s->mb_stride;
-    const int mot_xy = mb_y*mot_stride + mb_x;
-    uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV;
-    int mv_scale;
-
-    c->penalty_factor    = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
-    c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
-    c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
-    c->current_mv_penalty= mv_penalty;
-
-    get_limits(s, 16*mb_x, 16*mb_y);
-
-    switch(s->me_method) {
-    case ME_ZERO:
-    default:
-        no_motion_search(s, &mx, &my);
-        dmin = 0;
-        mx-= mb_x*16;
-        my-= mb_y*16;
-        break;
-    case ME_X1:
-    case ME_EPZS:
-       {
-            P_LEFT[0]        = mv_table[mot_xy - 1][0];
-            P_LEFT[1]        = mv_table[mot_xy - 1][1];
-
-            if(P_LEFT[0]       > (c->xmax<<shift)) P_LEFT[0]       = (c->xmax<<shift);
-
-            /* special case for first line */
-            if (!s->first_slice_line) {
-                P_TOP[0] = mv_table[mot_xy - mot_stride             ][0];
-                P_TOP[1] = mv_table[mot_xy - mot_stride             ][1];
-                P_TOPRIGHT[0] = mv_table[mot_xy - mot_stride + 1         ][0];
-                P_TOPRIGHT[1] = mv_table[mot_xy - mot_stride + 1         ][1];
-                if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1]= (c->ymax<<shift);
-                if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
-                if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
-
-                P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
-                P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
-            }
-            c->pred_x= P_LEFT[0];
-            c->pred_y= P_LEFT[1];
-        }
-
-        if(mv_table == s->b_forw_mv_table){
-            mv_scale= (s->pb_time<<16) / (s->pp_time<<shift);
-        }else{
-            mv_scale= ((s->pb_time - s->pp_time)<<16) / (s->pp_time<<shift);
-        }
-
-        dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16);
-
-        break;
-    }
-
-    dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16);
-
-    if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
-        dmin= ff_get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1);
-
-//printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my);
-//    s->mb_type[mb_y*s->mb_width + mb_x]= mb_type;
-    mv_table[mot_xy][0]= mx;
-    mv_table[mot_xy][1]= my;
-
-    return dmin;
-}
-
-static inline int check_bidir_mv(MpegEncContext * s,
-                   int motion_fx, int motion_fy,
-                   int motion_bx, int motion_by,
-                   int pred_fx, int pred_fy,
-                   int pred_bx, int pred_by,
-                   int size, int h)
-{
-    //FIXME optimize?
-    //FIXME better f_code prediction (max mv & distance)
-    //FIXME pointers
-    MotionEstContext * const c= &s->me;
-    uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame
-    uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_MV; // f_code of the prev frame
-    int stride= c->stride;
-    uint8_t *dest_y = c->scratchpad;
-    uint8_t *ptr;
-    int dxy;
-    int src_x, src_y;
-    int fbmin;
-    uint8_t **src_data= c->src[0];
-    uint8_t **ref_data= c->ref[0];
-    uint8_t **ref2_data= c->ref[2];
-
-    if(s->quarter_sample){
-        dxy = ((motion_fy & 3) << 2) | (motion_fx & 3);
-        src_x = motion_fx >> 2;
-        src_y = motion_fy >> 2;
-
-        ptr = ref_data[0] + (src_y * stride) + src_x;
-        s->dsp.put_qpel_pixels_tab[0][dxy](dest_y    , ptr    , stride);
-
-        dxy = ((motion_by & 3) << 2) | (motion_bx & 3);
-        src_x = motion_bx >> 2;
-        src_y = motion_by >> 2;
-
-        ptr = ref2_data[0] + (src_y * stride) + src_x;
-        s->dsp.avg_qpel_pixels_tab[size][dxy](dest_y    , ptr    , stride);
-    }else{
-        dxy = ((motion_fy & 1) << 1) | (motion_fx & 1);
-        src_x = motion_fx >> 1;
-        src_y = motion_fy >> 1;
-
-        ptr = ref_data[0] + (src_y * stride) + src_x;
-        s->dsp.put_pixels_tab[size][dxy](dest_y    , ptr    , stride, h);
-
-        dxy = ((motion_by & 1) << 1) | (motion_bx & 1);
-        src_x = motion_bx >> 1;
-        src_y = motion_by >> 1;
-
-        ptr = ref2_data[0] + (src_y * stride) + src_x;
-        s->dsp.avg_pixels_tab[size][dxy](dest_y    , ptr    , stride, h);
-    }
-
-    fbmin = (mv_penalty_f[motion_fx-pred_fx] + mv_penalty_f[motion_fy-pred_fy])*c->mb_penalty_factor
-           +(mv_penalty_b[motion_bx-pred_bx] + mv_penalty_b[motion_by-pred_by])*c->mb_penalty_factor
-           + s->dsp.mb_cmp[size](s, src_data[0], dest_y, stride, h); //FIXME new_pic
-
-    if(c->avctx->mb_cmp&FF_CMP_CHROMA){
-    }
-    //FIXME CHROMA !!!
-
-    return fbmin;
-}
-
-/* refine the bidir vectors in hq mode and return the score in both lq & hq mode*/
-static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y)
-{
-    MotionEstContext * const c= &s->me;
-    const int mot_stride = s->mb_stride;
-    const int xy = mb_y *mot_stride + mb_x;
-    int fbmin;
-    int pred_fx= s->b_bidir_forw_mv_table[xy-1][0];
-    int pred_fy= s->b_bidir_forw_mv_table[xy-1][1];
-    int pred_bx= s->b_bidir_back_mv_table[xy-1][0];
-    int pred_by= s->b_bidir_back_mv_table[xy-1][1];
-    int motion_fx= s->b_bidir_forw_mv_table[xy][0]= s->b_forw_mv_table[xy][0];
-    int motion_fy= s->b_bidir_forw_mv_table[xy][1]= s->b_forw_mv_table[xy][1];
-    int motion_bx= s->b_bidir_back_mv_table[xy][0]= s->b_back_mv_table[xy][0];
-    int motion_by= s->b_bidir_back_mv_table[xy][1]= s->b_back_mv_table[xy][1];
-    const int flags= c->sub_flags;
-    const int qpel= flags&FLAG_QPEL;
-    const int shift= 1+qpel;
-    const int xmin= c->xmin<<shift;
-    const int ymin= c->ymin<<shift;
-    const int xmax= c->xmax<<shift;
-    const int ymax= c->ymax<<shift;
-#define HASH(fx,fy,bx,by) ((fx)+17*(fy)+63*(bx)+117*(by))
-    int hashidx= HASH(motion_fx,motion_fy, motion_bx, motion_by);
-    uint8_t map[256];
-
-    memset(map,0,sizeof(map));
-    map[hashidx&255] = 1;
-
-    fbmin= check_bidir_mv(s, motion_fx, motion_fy,
-                          motion_bx, motion_by,
-                          pred_fx, pred_fy,
-                          pred_bx, pred_by,
-                          0, 16);
-
-    if(s->avctx->bidir_refine){
-        int end;
-        static const uint8_t limittab[5]={0,8,32,64,80};
-        const int limit= limittab[s->avctx->bidir_refine];
-        static const int8_t vect[][4]={
-{ 0, 0, 0, 1}, { 0, 0, 0,-1}, { 0, 0, 1, 0}, { 0, 0,-1, 0}, { 0, 1, 0, 0}, { 0,-1, 0, 0}, { 1, 0, 0, 0}, {-1, 0, 0, 0},
-
-{ 0, 0, 1, 1}, { 0, 0,-1,-1}, { 0, 1, 1, 0}, { 0,-1,-1, 0}, { 1, 1, 0, 0}, {-1,-1, 0, 0}, { 1, 0, 0, 1}, {-1, 0, 0,-1},
-{ 0, 1, 0, 1}, { 0,-1, 0,-1}, { 1, 0, 1, 0}, {-1, 0,-1, 0},
-{ 0, 0,-1, 1}, { 0, 0, 1,-1}, { 0,-1, 1, 0}, { 0, 1,-1, 0}, {-1, 1, 0, 0}, { 1,-1, 0, 0}, { 1, 0, 0,-1}, {-1, 0, 0, 1},
-{ 0,-1, 0, 1}, { 0, 1, 0,-1}, {-1, 0, 1, 0}, { 1, 0,-1, 0},
-
-{ 0, 1, 1, 1}, { 0,-1,-1,-1}, { 1, 1, 1, 0}, {-1,-1,-1, 0}, { 1, 1, 0, 1}, {-1,-1, 0,-1}, { 1, 0, 1, 1}, {-1, 0,-1,-1},
-{ 0,-1, 1, 1}, { 0, 1,-1,-1}, {-1, 1, 1, 0}, { 1,-1,-1, 0}, { 1, 1, 0,-1}, {-1,-1, 0, 1}, { 1, 0,-1, 1}, {-1, 0, 1,-1},
-{ 0, 1,-1, 1}, { 0,-1, 1,-1}, { 1,-1, 1, 0}, {-1, 1,-1, 0}, {-1, 1, 0, 1}, { 1,-1, 0,-1}, { 1, 0, 1,-1}, {-1, 0,-1, 1},
-{ 0, 1, 1,-1}, { 0,-1,-1, 1}, { 1, 1,-1, 0}, {-1,-1, 1, 0}, { 1,-1, 0, 1}, {-1, 1, 0,-1}, {-1, 0, 1, 1}, { 1, 0,-1,-1},
-
-{ 1, 1, 1, 1}, {-1,-1,-1,-1},
-{ 1, 1, 1,-1}, {-1,-1,-1, 1}, { 1, 1,-1, 1}, {-1,-1, 1,-1}, { 1,-1, 1, 1}, {-1, 1,-1,-1}, {-1, 1, 1, 1}, { 1,-1,-1,-1},
-{ 1, 1,-1,-1}, {-1,-1, 1, 1}, { 1,-1,-1, 1}, {-1, 1, 1,-1}, { 1,-1, 1,-1}, {-1, 1,-1, 1},
-        };
-        static const uint8_t hash[]={
-HASH( 0, 0, 0, 1), HASH( 0, 0, 0,-1), HASH( 0, 0, 1, 0), HASH( 0, 0,-1, 0), HASH( 0, 1, 0, 0), HASH( 0,-1, 0, 0), HASH( 1, 0, 0, 0), HASH(-1, 0, 0, 0),
-
-HASH( 0, 0, 1, 1), HASH( 0, 0,-1,-1), HASH( 0, 1, 1, 0), HASH( 0,-1,-1, 0), HASH( 1, 1, 0, 0), HASH(-1,-1, 0, 0), HASH( 1, 0, 0, 1), HASH(-1, 0, 0,-1),
-HASH( 0, 1, 0, 1), HASH( 0,-1, 0,-1), HASH( 1, 0, 1, 0), HASH(-1, 0,-1, 0),
-HASH( 0, 0,-1, 1), HASH( 0, 0, 1,-1), HASH( 0,-1, 1, 0), HASH( 0, 1,-1, 0), HASH(-1, 1, 0, 0), HASH( 1,-1, 0, 0), HASH( 1, 0, 0,-1), HASH(-1, 0, 0, 1),
-HASH( 0,-1, 0, 1), HASH( 0, 1, 0,-1), HASH(-1, 0, 1, 0), HASH( 1, 0,-1, 0),
-
-HASH( 0, 1, 1, 1), HASH( 0,-1,-1,-1), HASH( 1, 1, 1, 0), HASH(-1,-1,-1, 0), HASH( 1, 1, 0, 1), HASH(-1,-1, 0,-1), HASH( 1, 0, 1, 1), HASH(-1, 0,-1,-1),
-HASH( 0,-1, 1, 1), HASH( 0, 1,-1,-1), HASH(-1, 1, 1, 0), HASH( 1,-1,-1, 0), HASH( 1, 1, 0,-1), HASH(-1,-1, 0, 1), HASH( 1, 0,-1, 1), HASH(-1, 0, 1,-1),
-HASH( 0, 1,-1, 1), HASH( 0,-1, 1,-1), HASH( 1,-1, 1, 0), HASH(-1, 1,-1, 0), HASH(-1, 1, 0, 1), HASH( 1,-1, 0,-1), HASH( 1, 0, 1,-1), HASH(-1, 0,-1, 1),
-HASH( 0, 1, 1,-1), HASH( 0,-1,-1, 1), HASH( 1, 1,-1, 0), HASH(-1,-1, 1, 0), HASH( 1,-1, 0, 1), HASH(-1, 1, 0,-1), HASH(-1, 0, 1, 1), HASH( 1, 0,-1,-1),
-
-HASH( 1, 1, 1, 1), HASH(-1,-1,-1,-1),
-HASH( 1, 1, 1,-1), HASH(-1,-1,-1, 1), HASH( 1, 1,-1, 1), HASH(-1,-1, 1,-1), HASH( 1,-1, 1, 1), HASH(-1, 1,-1,-1), HASH(-1, 1, 1, 1), HASH( 1,-1,-1,-1),
-HASH( 1, 1,-1,-1), HASH(-1,-1, 1, 1), HASH( 1,-1,-1, 1), HASH(-1, 1, 1,-1), HASH( 1,-1, 1,-1), HASH(-1, 1,-1, 1),
-};
-
-#define CHECK_BIDIR(fx,fy,bx,by)\
-    if( !map[(hashidx+HASH(fx,fy,bx,by))&255]\
-       &&(fx<=0 || motion_fx+fx<=xmax) && (fy<=0 || motion_fy+fy<=ymax) && (bx<=0 || motion_bx+bx<=xmax) && (by<=0 || motion_by+by<=ymax)\
-       &&(fx>=0 || motion_fx+fx>=xmin) && (fy>=0 || motion_fy+fy>=ymin) && (bx>=0 || motion_bx+bx>=xmin) && (by>=0 || motion_by+by>=ymin)){\
-        int score;\
-        map[(hashidx+HASH(fx,fy,bx,by))&255] = 1;\
-        score= check_bidir_mv(s, motion_fx+fx, motion_fy+fy, motion_bx+bx, motion_by+by, pred_fx, pred_fy, pred_bx, pred_by, 0, 16);\
-        if(score < fbmin){\
-            hashidx += HASH(fx,fy,bx,by);\
-            fbmin= score;\
-            motion_fx+=fx;\
-            motion_fy+=fy;\
-            motion_bx+=bx;\
-            motion_by+=by;\
-            end=0;\
-        }\
-    }
-#define CHECK_BIDIR2(a,b,c,d)\
-CHECK_BIDIR(a,b,c,d)\
-CHECK_BIDIR(-(a),-(b),-(c),-(d))
-
-        do{
-            int i;
-            int borderdist=0;
-            end=1;
-
-            CHECK_BIDIR2(0,0,0,1)
-            CHECK_BIDIR2(0,0,1,0)
-            CHECK_BIDIR2(0,1,0,0)
-            CHECK_BIDIR2(1,0,0,0)
-
-            for(i=8; i<limit; i++){
-                int fx= motion_fx+vect[i][0];
-                int fy= motion_fy+vect[i][1];
-                int bx= motion_bx+vect[i][2];
-                int by= motion_by+vect[i][3];
-                if(borderdist<=0){
-                    int a= (xmax - FFMAX(fx,bx))|(FFMIN(fx,bx) - xmin);
-                    int b= (ymax - FFMAX(fy,by))|(FFMIN(fy,by) - ymin);
-                    if((a|b) < 0)
-                        map[(hashidx+hash[i])&255] = 1;
-                }
-                if(!map[(hashidx+hash[i])&255]){
-                    int score;
-                    map[(hashidx+hash[i])&255] = 1;
-                    score= check_bidir_mv(s, fx, fy, bx, by, pred_fx, pred_fy, pred_bx, pred_by, 0, 16);
-                    if(score < fbmin){
-                        hashidx += hash[i];
-                        fbmin= score;
-                        motion_fx=fx;
-                        motion_fy=fy;
-                        motion_bx=bx;
-                        motion_by=by;
-                        end=0;
-                        borderdist--;
-                        if(borderdist<=0){
-                            int a= FFMIN(xmax - FFMAX(fx,bx), FFMIN(fx,bx) - xmin);
-                            int b= FFMIN(ymax - FFMAX(fy,by), FFMIN(fy,by) - ymin);
-                            borderdist= FFMIN(a,b);
-                        }
-                    }
-                }
-            }
-        }while(!end);
-    }
-
-    s->b_bidir_forw_mv_table[xy][0]= motion_fx;
-    s->b_bidir_forw_mv_table[xy][1]= motion_fy;
-    s->b_bidir_back_mv_table[xy][0]= motion_bx;
-    s->b_bidir_back_mv_table[xy][1]= motion_by;
-
-    return fbmin;
-}
-
-static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
-{
-    MotionEstContext * const c= &s->me;
-    int P[10][2];
-    const int mot_stride = s->mb_stride;
-    const int mot_xy = mb_y*mot_stride + mb_x;
-    const int shift= 1+s->quarter_sample;
-    int dmin, i;
-    const int time_pp= s->pp_time;
-    const int time_pb= s->pb_time;
-    int mx, my, xmin, xmax, ymin, ymax;
-    int16_t (*mv_table)[2]= s->b_direct_mv_table;
-
-    c->current_mv_penalty= c->mv_penalty[1] + MAX_MV;
-    ymin= xmin=(-32)>>shift;
-    ymax= xmax=   31>>shift;
-
-    if(IS_8X8(s->next_picture.mb_type[mot_xy])){
-        s->mv_type= MV_TYPE_8X8;
-    }else{
-        s->mv_type= MV_TYPE_16X16;
-    }
-
-    for(i=0; i<4; i++){
-        int index= s->block_index[i];
-        int min, max;
-
-        c->co_located_mv[i][0]= s->next_picture.motion_val[0][index][0];
-        c->co_located_mv[i][1]= s->next_picture.motion_val[0][index][1];
-        c->direct_basis_mv[i][0]= c->co_located_mv[i][0]*time_pb/time_pp + ((i& 1)<<(shift+3));
-        c->direct_basis_mv[i][1]= c->co_located_mv[i][1]*time_pb/time_pp + ((i>>1)<<(shift+3));
-//        c->direct_basis_mv[1][i][0]= c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(shift+3);
-//        c->direct_basis_mv[1][i][1]= c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(shift+3);
-
-        max= FFMAX(c->direct_basis_mv[i][0], c->direct_basis_mv[i][0] - c->co_located_mv[i][0])>>shift;
-        min= FFMIN(c->direct_basis_mv[i][0], c->direct_basis_mv[i][0] - c->co_located_mv[i][0])>>shift;
-        max+= 16*mb_x + 1; // +-1 is for the simpler rounding
-        min+= 16*mb_x - 1;
-        xmax= FFMIN(xmax, s->width - max);
-        xmin= FFMAX(xmin, - 16     - min);
-
-        max= FFMAX(c->direct_basis_mv[i][1], c->direct_basis_mv[i][1] - c->co_located_mv[i][1])>>shift;
-        min= FFMIN(c->direct_basis_mv[i][1], c->direct_basis_mv[i][1] - c->co_located_mv[i][1])>>shift;
-        max+= 16*mb_y + 1; // +-1 is for the simpler rounding
-        min+= 16*mb_y - 1;
-        ymax= FFMIN(ymax, s->height - max);
-        ymin= FFMAX(ymin, - 16      - min);
-
-        if(s->mv_type == MV_TYPE_16X16) break;
-    }
-
-    assert(xmax <= 15 && ymax <= 15 && xmin >= -16 && ymin >= -16);
-
-    if(xmax < 0 || xmin >0 || ymax < 0 || ymin > 0){
-        s->b_direct_mv_table[mot_xy][0]= 0;
-        s->b_direct_mv_table[mot_xy][1]= 0;
-
-        return 256*256*256*64;
-    }
-
-    c->xmin= xmin;
-    c->ymin= ymin;
-    c->xmax= xmax;
-    c->ymax= ymax;
-    c->flags     |= FLAG_DIRECT;
-    c->sub_flags |= FLAG_DIRECT;
-    c->pred_x=0;
-    c->pred_y=0;
-
-    P_LEFT[0]        = av_clip(mv_table[mot_xy - 1][0], xmin<<shift, xmax<<shift);
-    P_LEFT[1]        = av_clip(mv_table[mot_xy - 1][1], ymin<<shift, ymax<<shift);
-
-    /* special case for first line */
-    if (!s->first_slice_line) { //FIXME maybe allow this over thread boundary as it is clipped
-        P_TOP[0]      = av_clip(mv_table[mot_xy - mot_stride             ][0], xmin<<shift, xmax<<shift);
-        P_TOP[1]      = av_clip(mv_table[mot_xy - mot_stride             ][1], ymin<<shift, ymax<<shift);
-        P_TOPRIGHT[0] = av_clip(mv_table[mot_xy - mot_stride + 1         ][0], xmin<<shift, xmax<<shift);
-        P_TOPRIGHT[1] = av_clip(mv_table[mot_xy - mot_stride + 1         ][1], ymin<<shift, ymax<<shift);
-
-        P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
-        P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
-    }
-
-    dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, mv_table, 1<<(16-shift), 0, 16);
-    if(c->sub_flags&FLAG_QPEL)
-        dmin = qpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
-    else
-        dmin = hpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
-
-    if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
-        dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
-
-    get_limits(s, 16*mb_x, 16*mb_y); //restore c->?min/max, maybe not needed
-
-    mv_table[mot_xy][0]= mx;
-    mv_table[mot_xy][1]= my;
-    c->flags     &= ~FLAG_DIRECT;
-    c->sub_flags &= ~FLAG_DIRECT;
-
-    return dmin;
-}
-
-void ff_estimate_b_frame_motion(MpegEncContext * s,
-                             int mb_x, int mb_y)
-{
-    MotionEstContext * const c= &s->me;
-    const int penalty_factor= c->mb_penalty_factor;
-    int fmin, bmin, dmin, fbmin, bimin, fimin;
-    int type=0;
-    const int xy = mb_y*s->mb_stride + mb_x;
-    init_ref(c, s->new_picture.data, s->last_picture.data, s->next_picture.data, 16*mb_x, 16*mb_y, 2);
-
-    get_limits(s, 16*mb_x, 16*mb_y);
-
-    c->skip=0;
-
-    if(s->codec_id == CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]){
-        int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0
-
-        score= ((unsigned)(score*score + 128*256))>>16;
-        c->mc_mb_var_sum_temp += score;
-        s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE
-        s->mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_DIRECT0;
-
-        return;
-    }
-
-    if(c->avctx->me_threshold){
-        int vard= check_input_motion(s, mb_x, mb_y, 0);
-
-        if((vard+128)>>8 < c->avctx->me_threshold){
-//            pix = c->src[0][0];
-//            sum = s->dsp.pix_sum(pix, s->linesize);
-//            varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500;
-
-//            pic->mb_var   [s->mb_stride * mb_y + mb_x] = (varc+128)>>8;
-             s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
-/*            pic->mb_mean  [s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
-            c->mb_var_sum_temp    += (varc+128)>>8;*/
-            c->mc_mb_var_sum_temp += (vard+128)>>8;
-/*            if (vard <= 64<<8 || vard < varc) {
-                c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
-            }else{
-                c->scene_change_score+= s->qscale * s->avctx->scenechange_factor;
-            }*/
-            return;
-        }
-        if((vard+128)>>8 < c->avctx->mb_threshold){
-            type= s->mb_type[mb_y*s->mb_stride + mb_x];
-            if(type == CANDIDATE_MB_TYPE_DIRECT){
-                direct_search(s, mb_x, mb_y);
-            }
-            if(type == CANDIDATE_MB_TYPE_FORWARD || type == CANDIDATE_MB_TYPE_BIDIR){
-                c->skip=0;
-                ff_estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, 0, s->f_code);
-            }
-            if(type == CANDIDATE_MB_TYPE_BACKWARD || type == CANDIDATE_MB_TYPE_BIDIR){
-                c->skip=0;
-                ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code);
-            }
-            if(type == CANDIDATE_MB_TYPE_FORWARD_I || type == CANDIDATE_MB_TYPE_BIDIR_I){
-                c->skip=0;
-                c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
-                interlaced_search(s, 0,
-                                        s->b_field_mv_table[0], s->b_field_select_table[0],
-                                        s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 1);
-            }
-            if(type == CANDIDATE_MB_TYPE_BACKWARD_I || type == CANDIDATE_MB_TYPE_BIDIR_I){
-                c->skip=0;
-                c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV;
-                interlaced_search(s, 2,
-                                        s->b_field_mv_table[1], s->b_field_select_table[1],
-                                        s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 1);
-            }
-            return;
-        }
-    }
-
-    if (s->codec_id == CODEC_ID_MPEG4)
-        dmin= direct_search(s, mb_x, mb_y);
-    else
-        dmin= INT_MAX;
-//FIXME penalty stuff for non mpeg4
-    c->skip=0;
-    fmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, 0, s->f_code) + 3*penalty_factor;
-
-    c->skip=0;
-    bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor;
-//printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]);
-
-    c->skip=0;
-    fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor;
-//printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin);
-
-    if(s->flags & CODEC_FLAG_INTERLACED_ME){
-//FIXME mb type penalty
-        c->skip=0;
-        c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV;
-        fimin= interlaced_search(s, 0,
-                                 s->b_field_mv_table[0], s->b_field_select_table[0],
-                                 s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0);
-        c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV;
-        bimin= interlaced_search(s, 2,
-                                 s->b_field_mv_table[1], s->b_field_select_table[1],
-                                 s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0);
-    }else
-        fimin= bimin= INT_MAX;
-
-    {
-        int score= fmin;
-        type = CANDIDATE_MB_TYPE_FORWARD;
-
-        if (dmin <= score){
-            score = dmin;
-            type = CANDIDATE_MB_TYPE_DIRECT;
-        }
-        if(bmin<score){
-            score=bmin;
-            type= CANDIDATE_MB_TYPE_BACKWARD;
-        }
-        if(fbmin<score){
-            score=fbmin;
-            type= CANDIDATE_MB_TYPE_BIDIR;
-        }
-        if(fimin<score){
-            score=fimin;
-            type= CANDIDATE_MB_TYPE_FORWARD_I;
-        }
-        if(bimin<score){
-            score=bimin;
-            type= CANDIDATE_MB_TYPE_BACKWARD_I;
-        }
-
-        score= ((unsigned)(score*score + 128*256))>>16;
-        c->mc_mb_var_sum_temp += score;
-        s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE
-    }
-
-    if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){
-        type= CANDIDATE_MB_TYPE_FORWARD | CANDIDATE_MB_TYPE_BACKWARD | CANDIDATE_MB_TYPE_BIDIR | CANDIDATE_MB_TYPE_DIRECT;
-        if(fimin < INT_MAX)
-            type |= CANDIDATE_MB_TYPE_FORWARD_I;
-        if(bimin < INT_MAX)
-            type |= CANDIDATE_MB_TYPE_BACKWARD_I;
-        if(fimin < INT_MAX && bimin < INT_MAX){
-            type |= CANDIDATE_MB_TYPE_BIDIR_I;
-        }
-         //FIXME something smarter
-        if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //do not try direct mode if it is invalid for this MB
-        if(s->codec_id == CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->flags&CODEC_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy])
-            type |= CANDIDATE_MB_TYPE_DIRECT0;
-#if 0
-        if(s->out_format == FMT_MPEG1)
-            type |= CANDIDATE_MB_TYPE_INTRA;
-#endif
-    }
-
-    s->mb_type[mb_y*s->mb_stride + mb_x]= type;
-}
-
-/* find best f_code for ME which do unlimited searches */
-int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
-{
-    if(s->me_method>=ME_EPZS){
-        int score[8];
-        int i, y, range= s->avctx->me_range ? s->avctx->me_range : (INT_MAX/2);
-        uint8_t * fcode_tab= s->fcode_tab;
-        int best_fcode=-1;
-        int best_score=-10000000;
-
-        if(s->msmpeg4_version)
-            range= FFMIN(range, 16);
-        else if(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)
-            range= FFMIN(range, 256);
-
-        for(i=0; i<8; i++) score[i]= s->mb_num*(8-i);
-
-        for(y=0; y<s->mb_height; y++){
-            int x;
-            int xy= y*s->mb_stride;
-            for(x=0; x<s->mb_width; x++){
-                if(s->mb_type[xy] & type){
-                    int mx= mv_table[xy][0];
-                    int my= mv_table[xy][1];
-                    int fcode= FFMAX(fcode_tab[mx + MAX_MV],
-                                     fcode_tab[my + MAX_MV]);
-                    int j;
-
-                        if(mx >= range || mx < -range ||
-                           my >= range || my < -range)
-                            continue;
-
-                    for(j=0; j<fcode && j<8; j++){
-                        if(s->pict_type==FF_B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy])
-                            score[j]-= 170;
-                    }
-                }
-                xy++;
-            }
-        }
-
-        for(i=1; i<8; i++){
-            if(score[i] > best_score){
-                best_score= score[i];
-                best_fcode= i;
-            }
-//            printf("%d %d\n", i, score[i]);
-        }
-
-//    printf("fcode: %d type: %d\n", i, s->pict_type);
-        return best_fcode;
-/*        for(i=0; i<=MAX_FCODE; i++){
-            printf("%d ", mv_num[i]);
-        }
-        printf("\n");*/
-    }else{
-        return 1;
-    }
-}
-
-void ff_fix_long_p_mvs(MpegEncContext * s)
-{
-    MotionEstContext * const c= &s->me;
-    const int f_code= s->f_code;
-    int y, range;
-    assert(s->pict_type==FF_P_TYPE);
-
-    range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code);
-
-    assert(range <= 16 || !s->msmpeg4_version);
-    assert(range <=256 || !(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL));
-
-    if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range;
-
-//printf("%d no:%d %d//\n", clip, noclip, f_code);
-    if(s->flags&CODEC_FLAG_4MV){
-        const int wrap= s->b8_stride;
-
-        /* clip / convert to intra 8x8 type MVs */
-        for(y=0; y<s->mb_height; y++){
-            int xy= y*2*wrap;
-            int i= y*s->mb_stride;
-            int x;
-
-            for(x=0; x<s->mb_width; x++){
-                if(s->mb_type[i]&CANDIDATE_MB_TYPE_INTER4V){
-                    int block;
-                    for(block=0; block<4; block++){
-                        int off= (block& 1) + (block>>1)*wrap;
-                        int mx= s->current_picture.motion_val[0][ xy + off ][0];
-                        int my= s->current_picture.motion_val[0][ xy + off ][1];
-
-                        if(   mx >=range || mx <-range
-                           || my >=range || my <-range){
-                            s->mb_type[i] &= ~CANDIDATE_MB_TYPE_INTER4V;
-                            s->mb_type[i] |= CANDIDATE_MB_TYPE_INTRA;
-                            s->current_picture.mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
-                        }
-                    }
-                }
-                xy+=2;
-                i++;
-            }
-        }
-    }
-}
-
-/**
- *
- * @param truncate 1 for truncation, 0 for using intra
- */
-void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select,
-                     int16_t (*mv_table)[2], int f_code, int type, int truncate)
-{
-    MotionEstContext * const c= &s->me;
-    int y, h_range, v_range;
-
-    // RAL: 8 in MPEG-1, 16 in MPEG-4
-    int range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code);
-
-    if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range;
-
-    h_range= range;
-    v_range= field_select_table ? range>>1 : range;
-
-    /* clip / convert to intra 16x16 type MVs */
-    for(y=0; y<s->mb_height; y++){
-        int x;
-        int xy= y*s->mb_stride;
-        for(x=0; x<s->mb_width; x++){
-            if (s->mb_type[xy] & type){    // RAL: "type" test added...
-                if(field_select_table==NULL || field_select_table[xy] == field_select){
-                    if(   mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range
-                       || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){
-
-                        if(truncate){
-                            if     (mv_table[xy][0] > h_range-1) mv_table[xy][0]=  h_range-1;
-                            else if(mv_table[xy][0] < -h_range ) mv_table[xy][0]= -h_range;
-                            if     (mv_table[xy][1] > v_range-1) mv_table[xy][1]=  v_range-1;
-                            else if(mv_table[xy][1] < -v_range ) mv_table[xy][1]= -v_range;
-                        }else{
-                            s->mb_type[xy] &= ~type;
-                            s->mb_type[xy] |= CANDIDATE_MB_TYPE_INTRA;
-                            mv_table[xy][0]=
-                            mv_table[xy][1]= 0;
-                        }
-                    }
-                }
-            }
-            xy++;
-        }
-    }
-}
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c
deleted file mode 100644
index 8f730ef..0000000
--- a/libavcodec/motion_est_template.c
+++ /dev/null
@@ -1,1285 +0,0 @@
-/*
- * Motion estimation
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Motion estimation template.
- */
-
-//Let us hope gcc will remove the unused vars ...(gcc 3.2.2 seems to do it ...)
-#define LOAD_COMMON\
-    uint32_t av_unused * const score_map= c->score_map;\
-    const int av_unused xmin= c->xmin;\
-    const int av_unused ymin= c->ymin;\
-    const int av_unused xmax= c->xmax;\
-    const int av_unused ymax= c->ymax;\
-    uint8_t *mv_penalty= c->current_mv_penalty;\
-    const int pred_x= c->pred_x;\
-    const int pred_y= c->pred_y;\
-
-#define CHECK_HALF_MV(dx, dy, x, y)\
-{\
-    const int hx= 2*(x)+(dx);\
-    const int hy= 2*(y)+(dy);\
-    d= cmp_hpel(s, x, y, dx, dy, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);\
-    d += (mv_penalty[hx - pred_x] + mv_penalty[hy - pred_y])*penalty_factor;\
-    COPY3_IF_LT(dmin, d, bx, hx, by, hy)\
-}
-
-#if 0
-static int hpel_motion_search)(MpegEncContext * s,
-                                  int *mx_ptr, int *my_ptr, int dmin,
-                                  uint8_t *ref_data[3],
-                                  int size)
-{
-    const int xx = 16 * s->mb_x + 8*(n&1);
-    const int yy = 16 * s->mb_y + 8*(n>>1);
-    const int mx = *mx_ptr;
-    const int my = *my_ptr;
-    const int penalty_factor= c->sub_penalty_factor;
-
-    LOAD_COMMON
-
- //   INIT;
- //FIXME factorize
-    me_cmp_func cmp, chroma_cmp, cmp_sub, chroma_cmp_sub;
-
-    if(s->no_rounding /*FIXME b_type*/){
-        hpel_put= &s->dsp.put_no_rnd_pixels_tab[size];
-        chroma_hpel_put= &s->dsp.put_no_rnd_pixels_tab[size+1];
-    }else{
-        hpel_put=& s->dsp.put_pixels_tab[size];
-        chroma_hpel_put= &s->dsp.put_pixels_tab[size+1];
-    }
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-    cmp_sub= s->dsp.me_sub_cmp[size];
-    chroma_cmp_sub= s->dsp.me_sub_cmp[size+1];
-
-    if(c->skip){ //FIXME somehow move up (benchmark)
-        *mx_ptr = 0;
-        *my_ptr = 0;
-        return dmin;
-    }
-
-    if(c->avctx->me_cmp != c->avctx->me_sub_cmp){
-        CMP_HPEL(dmin, 0, 0, mx, my, size);
-        if(mx || my)
-            dmin += (mv_penalty[2*mx - pred_x] + mv_penalty[2*my - pred_y])*penalty_factor;
-    }
-
-    if (mx > xmin && mx < xmax &&
-        my > ymin && my < ymax) {
-        int bx=2*mx, by=2*my;
-        int d= dmin;
-
-        CHECK_HALF_MV(1, 1, mx-1, my-1)
-        CHECK_HALF_MV(0, 1, mx  , my-1)
-        CHECK_HALF_MV(1, 1, mx  , my-1)
-        CHECK_HALF_MV(1, 0, mx-1, my  )
-        CHECK_HALF_MV(1, 0, mx  , my  )
-        CHECK_HALF_MV(1, 1, mx-1, my  )
-        CHECK_HALF_MV(0, 1, mx  , my  )
-        CHECK_HALF_MV(1, 1, mx  , my  )
-
-        assert(bx >= xmin*2 || bx <= xmax*2 || by >= ymin*2 || by <= ymax*2);
-
-        *mx_ptr = bx;
-        *my_ptr = by;
-    }else{
-        *mx_ptr =2*mx;
-        *my_ptr =2*my;
-    }
-
-    return dmin;
-}
-
-#else
-static int hpel_motion_search(MpegEncContext * s,
-                                  int *mx_ptr, int *my_ptr, int dmin,
-                                  int src_index, int ref_index,
-                                  int size, int h)
-{
-    MotionEstContext * const c= &s->me;
-    const int mx = *mx_ptr;
-    const int my = *my_ptr;
-    const int penalty_factor= c->sub_penalty_factor;
-    me_cmp_func cmp_sub, chroma_cmp_sub;
-    int bx=2*mx, by=2*my;
-
-    LOAD_COMMON
-    int flags= c->sub_flags;
-
- //FIXME factorize
-
-    cmp_sub= s->dsp.me_sub_cmp[size];
-    chroma_cmp_sub= s->dsp.me_sub_cmp[size+1];
-
-    if(c->skip){ //FIXME move out of hpel?
-        *mx_ptr = 0;
-        *my_ptr = 0;
-        return dmin;
-    }
-
-    if(c->avctx->me_cmp != c->avctx->me_sub_cmp){
-        dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);
-        if(mx || my || size>0)
-            dmin += (mv_penalty[2*mx - pred_x] + mv_penalty[2*my - pred_y])*penalty_factor;
-    }
-
-    if (mx > xmin && mx < xmax &&
-        my > ymin && my < ymax) {
-        int d= dmin;
-        const int index= (my<<ME_MAP_SHIFT) + mx;
-        const int t= score_map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)]
-                     + (mv_penalty[bx   - pred_x] + mv_penalty[by-2 - pred_y])*c->penalty_factor;
-        const int l= score_map[(index- 1               )&(ME_MAP_SIZE-1)]
-                     + (mv_penalty[bx-2 - pred_x] + mv_penalty[by   - pred_y])*c->penalty_factor;
-        const int r= score_map[(index+ 1               )&(ME_MAP_SIZE-1)]
-                     + (mv_penalty[bx+2 - pred_x] + mv_penalty[by   - pred_y])*c->penalty_factor;
-        const int b= score_map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)]
-                     + (mv_penalty[bx   - pred_x] + mv_penalty[by+2 - pred_y])*c->penalty_factor;
-
-#if 1
-        int key;
-        int map_generation= c->map_generation;
-#ifndef NDEBUG
-        uint32_t *map= c->map;
-#endif
-        key= ((my-1)<<ME_MAP_MV_BITS) + (mx) + map_generation;
-        assert(map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key);
-        key= ((my+1)<<ME_MAP_MV_BITS) + (mx) + map_generation;
-        assert(map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)] == key);
-        key= ((my)<<ME_MAP_MV_BITS) + (mx+1) + map_generation;
-        assert(map[(index+1)&(ME_MAP_SIZE-1)] == key);
-        key= ((my)<<ME_MAP_MV_BITS) + (mx-1) + map_generation;
-        assert(map[(index-1)&(ME_MAP_SIZE-1)] == key);
-#endif
-        if(t<=b){
-            CHECK_HALF_MV(0, 1, mx  ,my-1)
-            if(l<=r){
-                CHECK_HALF_MV(1, 1, mx-1, my-1)
-                if(t+r<=b+l){
-                    CHECK_HALF_MV(1, 1, mx  , my-1)
-                }else{
-                    CHECK_HALF_MV(1, 1, mx-1, my  )
-                }
-                CHECK_HALF_MV(1, 0, mx-1, my  )
-            }else{
-                CHECK_HALF_MV(1, 1, mx  , my-1)
-                if(t+l<=b+r){
-                    CHECK_HALF_MV(1, 1, mx-1, my-1)
-                }else{
-                    CHECK_HALF_MV(1, 1, mx  , my  )
-                }
-                CHECK_HALF_MV(1, 0, mx  , my  )
-            }
-        }else{
-            if(l<=r){
-                if(t+l<=b+r){
-                    CHECK_HALF_MV(1, 1, mx-1, my-1)
-                }else{
-                    CHECK_HALF_MV(1, 1, mx  , my  )
-                }
-                CHECK_HALF_MV(1, 0, mx-1, my)
-                CHECK_HALF_MV(1, 1, mx-1, my)
-            }else{
-                if(t+r<=b+l){
-                    CHECK_HALF_MV(1, 1, mx  , my-1)
-                }else{
-                    CHECK_HALF_MV(1, 1, mx-1, my)
-                }
-                CHECK_HALF_MV(1, 0, mx  , my)
-                CHECK_HALF_MV(1, 1, mx  , my)
-            }
-            CHECK_HALF_MV(0, 1, mx  , my)
-        }
-        assert(bx >= xmin*2 && bx <= xmax*2 && by >= ymin*2 && by <= ymax*2);
-    }
-
-    *mx_ptr = bx;
-    *my_ptr = by;
-
-    return dmin;
-}
-#endif
-
-static int no_sub_motion_search(MpegEncContext * s,
-          int *mx_ptr, int *my_ptr, int dmin,
-                                  int src_index, int ref_index,
-                                  int size, int h)
-{
-    (*mx_ptr)<<=1;
-    (*my_ptr)<<=1;
-    return dmin;
-}
-
-inline int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index,
-                               int ref_index, int size, int h, int add_rate)
-{
-//    const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp;
-    MotionEstContext * const c= &s->me;
-    const int penalty_factor= c->mb_penalty_factor;
-    const int flags= c->mb_flags;
-    const int qpel= flags & FLAG_QPEL;
-    const int mask= 1+2*qpel;
-    me_cmp_func cmp_sub, chroma_cmp_sub;
-    int d;
-
-    LOAD_COMMON
-
- //FIXME factorize
-
-    cmp_sub= s->dsp.mb_cmp[size];
-    chroma_cmp_sub= s->dsp.mb_cmp[size+1];
-
-//    assert(!c->skip);
-//    assert(c->avctx->me_sub_cmp != c->avctx->mb_cmp);
-
-    d= cmp(s, mx>>(qpel+1), my>>(qpel+1), mx&mask, my&mask, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);
-    //FIXME check cbp before adding penalty for (0,0) vector
-    if(add_rate && (mx || my || size>0))
-        d += (mv_penalty[mx - pred_x] + mv_penalty[my - pred_y])*penalty_factor;
-
-    return d;
-}
-
-#define CHECK_QUARTER_MV(dx, dy, x, y)\
-{\
-    const int hx= 4*(x)+(dx);\
-    const int hy= 4*(y)+(dy);\
-    d= cmp_qpel(s, x, y, dx, dy, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
-    d += (mv_penalty[hx - pred_x] + mv_penalty[hy - pred_y])*penalty_factor;\
-    COPY3_IF_LT(dmin, d, bx, hx, by, hy)\
-}
-
-static int qpel_motion_search(MpegEncContext * s,
-                                  int *mx_ptr, int *my_ptr, int dmin,
-                                  int src_index, int ref_index,
-                                  int size, int h)
-{
-    MotionEstContext * const c= &s->me;
-    const int mx = *mx_ptr;
-    const int my = *my_ptr;
-    const int penalty_factor= c->sub_penalty_factor;
-    const int map_generation= c->map_generation;
-    const int subpel_quality= c->avctx->me_subpel_quality;
-    uint32_t *map= c->map;
-    me_cmp_func cmpf, chroma_cmpf;
-    me_cmp_func cmp_sub, chroma_cmp_sub;
-
-    LOAD_COMMON
-    int flags= c->sub_flags;
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1]; //factorize FIXME
- //FIXME factorize
-
-    cmp_sub= s->dsp.me_sub_cmp[size];
-    chroma_cmp_sub= s->dsp.me_sub_cmp[size+1];
-
-    if(c->skip){ //FIXME somehow move up (benchmark)
-        *mx_ptr = 0;
-        *my_ptr = 0;
-        return dmin;
-    }
-
-    if(c->avctx->me_cmp != c->avctx->me_sub_cmp){
-        dmin= cmp(s, mx, my, 0, 0, size, h, ref_index, src_index, cmp_sub, chroma_cmp_sub, flags);
-        if(mx || my || size>0)
-            dmin += (mv_penalty[4*mx - pred_x] + mv_penalty[4*my - pred_y])*penalty_factor;
-    }
-
-    if (mx > xmin && mx < xmax &&
-        my > ymin && my < ymax) {
-        int bx=4*mx, by=4*my;
-        int d= dmin;
-        int i, nx, ny;
-        const int index= (my<<ME_MAP_SHIFT) + mx;
-        const int t= score_map[(index-(1<<ME_MAP_SHIFT)  )&(ME_MAP_SIZE-1)];
-        const int l= score_map[(index- 1                 )&(ME_MAP_SIZE-1)];
-        const int r= score_map[(index+ 1                 )&(ME_MAP_SIZE-1)];
-        const int b= score_map[(index+(1<<ME_MAP_SHIFT)  )&(ME_MAP_SIZE-1)];
-        const int c= score_map[(index                    )&(ME_MAP_SIZE-1)];
-        int best[8];
-        int best_pos[8][2];
-
-        memset(best, 64, sizeof(int)*8);
-#if 1
-        if(s->me.dia_size>=2){
-            const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
-            const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
-            const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
-            const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
-
-            for(ny= -3; ny <= 3; ny++){
-                for(nx= -3; nx <= 3; nx++){
-                    //FIXME this could overflow (unlikely though)
-                    const int64_t t2= nx*nx*(tr + tl - 2*t) + 4*nx*(tr-tl) + 32*t;
-                    const int64_t c2= nx*nx*( r +  l - 2*c) + 4*nx*( r- l) + 32*c;
-                    const int64_t b2= nx*nx*(br + bl - 2*b) + 4*nx*(br-bl) + 32*b;
-                    int score= (ny*ny*(b2 + t2 - 2*c2) + 4*ny*(b2 - t2) + 32*c2 + 512)>>10;
-                    int i;
-
-                    if((nx&3)==0 && (ny&3)==0) continue;
-
-                    score += (mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor;
-
-//                    if(nx&1) score-=1024*c->penalty_factor;
-//                    if(ny&1) score-=1024*c->penalty_factor;
-
-                    for(i=0; i<8; i++){
-                        if(score < best[i]){
-                            memmove(&best[i+1], &best[i], sizeof(int)*(7-i));
-                            memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i));
-                            best[i]= score;
-                            best_pos[i][0]= nx + 4*mx;
-                            best_pos[i][1]= ny + 4*my;
-                            break;
-                        }
-                    }
-                }
-            }
-        }else{
-            int tl;
-            //FIXME this could overflow (unlikely though)
-            const int cx = 4*(r - l);
-            const int cx2= r + l - 2*c;
-            const int cy = 4*(b - t);
-            const int cy2= b + t - 2*c;
-            int cxy;
-
-            if(map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)] == (my<<ME_MAP_MV_BITS) + mx + map_generation && 0){ //FIXME
-                tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
-            }else{
-                tl= cmp(s, mx-1, my-1, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);//FIXME wrong if chroma me is different
-            }
-
-            cxy= 2*tl + (cx + cy)/4 - (cx2 + cy2) - 2*c;
-
-            assert(16*cx2 + 4*cx + 32*c == 32*r);
-            assert(16*cx2 - 4*cx + 32*c == 32*l);
-            assert(16*cy2 + 4*cy + 32*c == 32*b);
-            assert(16*cy2 - 4*cy + 32*c == 32*t);
-            assert(16*cxy + 16*cy2 + 16*cx2 - 4*cy - 4*cx + 32*c == 32*tl);
-
-            for(ny= -3; ny <= 3; ny++){
-                for(nx= -3; nx <= 3; nx++){
-                    //FIXME this could overflow (unlikely though)
-                    int score= ny*nx*cxy + nx*nx*cx2 + ny*ny*cy2 + nx*cx + ny*cy + 32*c; //FIXME factor
-                    int i;
-
-                    if((nx&3)==0 && (ny&3)==0) continue;
-
-                    score += 32*(mv_penalty[4*mx + nx - pred_x] + mv_penalty[4*my + ny - pred_y])*penalty_factor;
-//                    if(nx&1) score-=32*c->penalty_factor;
-  //                  if(ny&1) score-=32*c->penalty_factor;
-
-                    for(i=0; i<8; i++){
-                        if(score < best[i]){
-                            memmove(&best[i+1], &best[i], sizeof(int)*(7-i));
-                            memmove(&best_pos[i+1][0], &best_pos[i][0], sizeof(int)*2*(7-i));
-                            best[i]= score;
-                            best_pos[i][0]= nx + 4*mx;
-                            best_pos[i][1]= ny + 4*my;
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-        for(i=0; i<subpel_quality; i++){
-            nx= best_pos[i][0];
-            ny= best_pos[i][1];
-            CHECK_QUARTER_MV(nx&3, ny&3, nx>>2, ny>>2)
-        }
-
-#if 0
-            const int tl= score_map[(index-(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
-            const int bl= score_map[(index+(1<<ME_MAP_SHIFT)-1)&(ME_MAP_SIZE-1)];
-            const int tr= score_map[(index-(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
-            const int br= score_map[(index+(1<<ME_MAP_SHIFT)+1)&(ME_MAP_SIZE-1)];
-//            if(l < r && l < t && l < b && l < tl && l < bl && l < tr && l < br && bl < tl){
-            if(tl<br){
-
-//            nx= FFMAX(4*mx - bx, bx - 4*mx);
-//            ny= FFMAX(4*my - by, by - 4*my);
-
-            static int stats[7][7], count;
-            count++;
-            stats[4*mx - bx + 3][4*my - by + 3]++;
-            if(256*256*256*64 % count ==0){
-                for(i=0; i<49; i++){
-                    if((i%7)==0) printf("\n");
-                    printf("%6d ", stats[0][i]);
-                }
-                printf("\n");
-            }
-            }
-#endif
-#else
-
-        CHECK_QUARTER_MV(2, 2, mx-1, my-1)
-        CHECK_QUARTER_MV(0, 2, mx  , my-1)
-        CHECK_QUARTER_MV(2, 2, mx  , my-1)
-        CHECK_QUARTER_MV(2, 0, mx  , my  )
-        CHECK_QUARTER_MV(2, 2, mx  , my  )
-        CHECK_QUARTER_MV(0, 2, mx  , my  )
-        CHECK_QUARTER_MV(2, 2, mx-1, my  )
-        CHECK_QUARTER_MV(2, 0, mx-1, my  )
-
-        nx= bx;
-        ny= by;
-
-        for(i=0; i<8; i++){
-            int ox[8]= {0, 1, 1, 1, 0,-1,-1,-1};
-            int oy[8]= {1, 1, 0,-1,-1,-1, 0, 1};
-            CHECK_QUARTER_MV((nx + ox[i])&3, (ny + oy[i])&3, (nx + ox[i])>>2, (ny + oy[i])>>2)
-        }
-#endif
-#if 0
-        //outer ring
-        CHECK_QUARTER_MV(1, 3, mx-1, my-1)
-        CHECK_QUARTER_MV(1, 2, mx-1, my-1)
-        CHECK_QUARTER_MV(1, 1, mx-1, my-1)
-        CHECK_QUARTER_MV(2, 1, mx-1, my-1)
-        CHECK_QUARTER_MV(3, 1, mx-1, my-1)
-        CHECK_QUARTER_MV(0, 1, mx  , my-1)
-        CHECK_QUARTER_MV(1, 1, mx  , my-1)
-        CHECK_QUARTER_MV(2, 1, mx  , my-1)
-        CHECK_QUARTER_MV(3, 1, mx  , my-1)
-        CHECK_QUARTER_MV(3, 2, mx  , my-1)
-        CHECK_QUARTER_MV(3, 3, mx  , my-1)
-        CHECK_QUARTER_MV(3, 0, mx  , my  )
-        CHECK_QUARTER_MV(3, 1, mx  , my  )
-        CHECK_QUARTER_MV(3, 2, mx  , my  )
-        CHECK_QUARTER_MV(3, 3, mx  , my  )
-        CHECK_QUARTER_MV(2, 3, mx  , my  )
-        CHECK_QUARTER_MV(1, 3, mx  , my  )
-        CHECK_QUARTER_MV(0, 3, mx  , my  )
-        CHECK_QUARTER_MV(3, 3, mx-1, my  )
-        CHECK_QUARTER_MV(2, 3, mx-1, my  )
-        CHECK_QUARTER_MV(1, 3, mx-1, my  )
-        CHECK_QUARTER_MV(1, 2, mx-1, my  )
-        CHECK_QUARTER_MV(1, 1, mx-1, my  )
-        CHECK_QUARTER_MV(1, 0, mx-1, my  )
-#endif
-        assert(bx >= xmin*4 && bx <= xmax*4 && by >= ymin*4 && by <= ymax*4);
-
-        *mx_ptr = bx;
-        *my_ptr = by;
-    }else{
-        *mx_ptr =4*mx;
-        *my_ptr =4*my;
-    }
-
-    return dmin;
-}
-
-
-#define CHECK_MV(x,y)\
-{\
-    const int key= ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\
-    const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\
-    assert((x) >= xmin);\
-    assert((x) <= xmax);\
-    assert((y) >= ymin);\
-    assert((y) <= ymax);\
-/*printf("check_mv %d %d\n", x, y);*/\
-    if(map[index]!=key){\
-        d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
-        map[index]= key;\
-        score_map[index]= d;\
-        d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
-/*printf("score:%d\n", d);*/\
-        COPY3_IF_LT(dmin, d, best[0], x, best[1], y)\
-    }\
-}
-
-#define CHECK_CLIPPED_MV(ax,ay)\
-{\
-    const int Lx= ax;\
-    const int Ly= ay;\
-    const int Lx2= FFMAX(xmin, FFMIN(Lx, xmax));\
-    const int Ly2= FFMAX(ymin, FFMIN(Ly, ymax));\
-    CHECK_MV(Lx2, Ly2)\
-}
-
-#define CHECK_MV_DIR(x,y,new_dir)\
-{\
-    const int key= ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\
-    const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\
-/*printf("check_mv_dir %d %d %d\n", x, y, new_dir);*/\
-    if(map[index]!=key){\
-        d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
-        map[index]= key;\
-        score_map[index]= d;\
-        d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\
-/*printf("score:%d\n", d);*/\
-        if(d<dmin){\
-            best[0]=x;\
-            best[1]=y;\
-            dmin=d;\
-            next_dir= new_dir;\
-        }\
-    }\
-}
-
-#define check(x,y,S,v)\
-if( (x)<(xmin<<(S)) ) printf("%d %d %d %d %d xmin" #v, xmin, (x), (y), s->mb_x, s->mb_y);\
-if( (x)>(xmax<<(S)) ) printf("%d %d %d %d %d xmax" #v, xmax, (x), (y), s->mb_x, s->mb_y);\
-if( (y)<(ymin<<(S)) ) printf("%d %d %d %d %d ymin" #v, ymin, (x), (y), s->mb_x, s->mb_y);\
-if( (y)>(ymax<<(S)) ) printf("%d %d %d %d %d ymax" #v, ymax, (x), (y), s->mb_x, s->mb_y);\
-
-#define LOAD_COMMON2\
-    uint32_t *map= c->map;\
-    const int qpel= flags&FLAG_QPEL;\
-    const int shift= 1+qpel;\
-
-static av_always_inline int small_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    int next_dir=-1;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    { /* ensure that the best point is in the MAP as h/qpel refinement needs it */
-        const int key= (best[1]<<ME_MAP_MV_BITS) + best[0] + map_generation;
-        const int index= ((best[1]<<ME_MAP_SHIFT) + best[0])&(ME_MAP_SIZE-1);
-        if(map[index]!=key){ //this will be executed only very rarey
-            score_map[index]= cmp(s, best[0], best[1], 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
-            map[index]= key;
-        }
-    }
-
-    for(;;){
-        int d;
-        const int dir= next_dir;
-        const int x= best[0];
-        const int y= best[1];
-        next_dir=-1;
-
-//printf("%d", dir);
-        if(dir!=2 && x>xmin) CHECK_MV_DIR(x-1, y  , 0)
-        if(dir!=3 && y>ymin) CHECK_MV_DIR(x  , y-1, 1)
-        if(dir!=0 && x<xmax) CHECK_MV_DIR(x+1, y  , 2)
-        if(dir!=1 && y<ymax) CHECK_MV_DIR(x  , y+1, 3)
-
-        if(next_dir==-1){
-            return dmin;
-        }
-    }
-}
-
-static int funny_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    int dia_size;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    for(dia_size=1; dia_size<=4; dia_size++){
-        int dir;
-        const int x= best[0];
-        const int y= best[1];
-
-        if(dia_size&(dia_size-1)) continue;
-
-        if(   x + dia_size > xmax
-           || x - dia_size < xmin
-           || y + dia_size > ymax
-           || y - dia_size < ymin)
-           continue;
-
-        for(dir= 0; dir<dia_size; dir+=2){
-            int d;
-
-            CHECK_MV(x + dir           , y + dia_size - dir);
-            CHECK_MV(x + dia_size - dir, y - dir           );
-            CHECK_MV(x - dir           , y - dia_size + dir);
-            CHECK_MV(x - dia_size + dir, y + dir           );
-        }
-
-        if(x!=best[0] || y!=best[1])
-            dia_size=0;
-#if 0
-{
-int dx, dy, i;
-static int stats[8*8];
-dx= FFABS(x-best[0]);
-dy= FFABS(y-best[1]);
-if(dy>dx){
-    dx^=dy; dy^=dx; dx^=dy;
-}
-stats[dy*8 + dx] ++;
-if(256*256*256*64 % (stats[0]+1)==0){
-    for(i=0; i<64; i++){
-        if((i&7)==0) printf("\n");
-        printf("%8d ", stats[i]);
-    }
-    printf("\n");
-}
-}
-#endif
-    }
-    return dmin;
-}
-
-static int hex_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags, int dia_size)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-    int x,y,d;
-    const int dec= dia_size & (dia_size-1);
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    for(;dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
-        do{
-            x= best[0];
-            y= best[1];
-
-            CHECK_CLIPPED_MV(x  -dia_size    , y);
-            CHECK_CLIPPED_MV(x+  dia_size    , y);
-            CHECK_CLIPPED_MV(x+( dia_size>>1), y+dia_size);
-            CHECK_CLIPPED_MV(x+( dia_size>>1), y-dia_size);
-            if(dia_size>1){
-                CHECK_CLIPPED_MV(x+(-dia_size>>1), y+dia_size);
-                CHECK_CLIPPED_MV(x+(-dia_size>>1), y-dia_size);
-            }
-        }while(best[0] != x || best[1] != y);
-    }
-
-    return dmin;
-}
-
-static int l2s_dia_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-    int x,y,i,d;
-    int dia_size= c->dia_size&0xFF;
-    const int dec= dia_size & (dia_size-1);
-    static const int hex[8][2]={{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1},
-                                { 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}};
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    for(; dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
-        do{
-            x= best[0];
-            y= best[1];
-            for(i=0; i<8; i++){
-                CHECK_CLIPPED_MV(x+hex[i][0]*dia_size, y+hex[i][1]*dia_size);
-            }
-        }while(best[0] != x || best[1] != y);
-    }
-
-    x= best[0];
-    y= best[1];
-    CHECK_CLIPPED_MV(x+1, y);
-    CHECK_CLIPPED_MV(x, y+1);
-    CHECK_CLIPPED_MV(x-1, y);
-    CHECK_CLIPPED_MV(x, y-1);
-
-    return dmin;
-}
-
-static int umh_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-    int x,y,x2,y2, i, j, d;
-    const int dia_size= c->dia_size&0xFE;
-    static const int hex[16][2]={{-4,-2}, {-4,-1}, {-4, 0}, {-4, 1}, {-4, 2},
-                                 { 4,-2}, { 4,-1}, { 4, 0}, { 4, 1}, { 4, 2},
-                                 {-2, 3}, { 0, 4}, { 2, 3},
-                                 {-2,-3}, { 0,-4}, { 2,-3},};
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    x= best[0];
-    y= best[1];
-    for(x2=FFMAX(x-dia_size+1, xmin); x2<=FFMIN(x+dia_size-1,xmax); x2+=2){
-        CHECK_MV(x2, y);
-    }
-    for(y2=FFMAX(y-dia_size/2+1, ymin); y2<=FFMIN(y+dia_size/2-1,ymax); y2+=2){
-        CHECK_MV(x, y2);
-    }
-
-    x= best[0];
-    y= best[1];
-    for(y2=FFMAX(y-2, ymin); y2<=FFMIN(y+2,ymax); y2++){
-        for(x2=FFMAX(x-2, xmin); x2<=FFMIN(x+2,xmax); x2++){
-            CHECK_MV(x2, y2);
-        }
-    }
-
-//FIXME prevent the CLIP stuff
-
-    for(j=1; j<=dia_size/4; j++){
-        for(i=0; i<16; i++){
-            CHECK_CLIPPED_MV(x+hex[i][0]*j, y+hex[i][1]*j);
-        }
-    }
-
-    return hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, 2);
-}
-
-static int full_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-    int x,y, d;
-    const int dia_size= c->dia_size&0xFF;
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    for(y=FFMAX(-dia_size, ymin); y<=FFMIN(dia_size,ymax); y++){
-        for(x=FFMAX(-dia_size, xmin); x<=FFMIN(dia_size,xmax); x++){
-            CHECK_MV(x, y);
-        }
-    }
-
-    x= best[0];
-    y= best[1];
-    d= dmin;
-    CHECK_CLIPPED_MV(x  , y);
-    CHECK_CLIPPED_MV(x+1, y);
-    CHECK_CLIPPED_MV(x, y+1);
-    CHECK_CLIPPED_MV(x-1, y);
-    CHECK_CLIPPED_MV(x, y-1);
-    best[0]= x;
-    best[1]= y;
-
-    return d;
-}
-
-#define SAB_CHECK_MV(ax,ay)\
-{\
-    const int key= ((ay)<<ME_MAP_MV_BITS) + (ax) + map_generation;\
-    const int index= (((ay)<<ME_MAP_SHIFT) + (ax))&(ME_MAP_SIZE-1);\
-/*printf("sab check %d %d\n", ax, ay);*/\
-    if(map[index]!=key){\
-        d= cmp(s, ax, ay, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
-        map[index]= key;\
-        score_map[index]= d;\
-        d += (mv_penalty[((ax)<<shift)-pred_x] + mv_penalty[((ay)<<shift)-pred_y])*penalty_factor;\
-/*printf("score: %d\n", d);*/\
-        if(d < minima[minima_count-1].height){\
-            int j=0;\
-            \
-            while(d >= minima[j].height) j++;\
-\
-            memmove(&minima [j+1], &minima [j], (minima_count - j - 1)*sizeof(Minima));\
-\
-            minima[j].checked= 0;\
-            minima[j].height= d;\
-            minima[j].x= ax;\
-            minima[j].y= ay;\
-            \
-            i=-1;\
-            continue;\
-        }\
-    }\
-}
-
-#define MAX_SAB_SIZE ME_MAP_SIZE
-static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    Minima minima[MAX_SAB_SIZE];
-    const int minima_count= FFABS(c->dia_size);
-    int i, j;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    /*Note j<MAX_SAB_SIZE is needed if MAX_SAB_SIZE < ME_MAP_SIZE as j can
-      become larger due to MVs overflowing their ME_MAP_MV_BITS bits space in map
-     */
-    for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){
-        uint32_t key= map[i];
-
-        key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1));
-
-        if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue;
-
-        minima[j].height= score_map[i];
-        minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS;
-        minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1);
-        minima[j].x-= (1<<(ME_MAP_MV_BITS-1));
-        minima[j].y-= (1<<(ME_MAP_MV_BITS-1));
-
-        // all entries in map should be in range except if the mv overflows their ME_MAP_MV_BITS bits space
-        if(   minima[j].x > xmax || minima[j].x < xmin
-           || minima[j].y > ymax || minima[j].y < ymin)
-            continue;
-
-        minima[j].checked=0;
-        if(minima[j].x || minima[j].y)
-            minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor;
-
-        j++;
-    }
-
-    qsort(minima, j, sizeof(Minima), minima_cmp);
-
-    for(; j<minima_count; j++){
-        minima[j].height=256*256*256*64;
-        minima[j].checked=0;
-        minima[j].x= minima[j].y=0;
-    }
-
-    for(i=0; i<minima_count; i++){
-        const int x= minima[i].x;
-        const int y= minima[i].y;
-        int d;
-
-        if(minima[i].checked) continue;
-
-        if(   x >= xmax || x <= xmin
-           || y >= ymax || y <= ymin)
-           continue;
-
-        SAB_CHECK_MV(x-1, y)
-        SAB_CHECK_MV(x+1, y)
-        SAB_CHECK_MV(x  , y-1)
-        SAB_CHECK_MV(x  , y+1)
-
-        minima[i].checked= 1;
-    }
-
-    best[0]= minima[0].x;
-    best[1]= minima[0].y;
-    dmin= minima[0].height;
-
-    if(   best[0] < xmax && best[0] > xmin
-       && best[1] < ymax && best[1] > ymin){
-        int d;
-        //ensure that the refernece samples for hpel refinement are in the map
-        CHECK_MV(best[0]-1, best[1])
-        CHECK_MV(best[0]+1, best[1])
-        CHECK_MV(best[0], best[1]-1)
-        CHECK_MV(best[0], best[1]+1)
-    }
-    return dmin;
-}
-
-static int var_diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags)
-{
-    MotionEstContext * const c= &s->me;
-    me_cmp_func cmpf, chroma_cmpf;
-    int dia_size;
-    LOAD_COMMON
-    LOAD_COMMON2
-    int map_generation= c->map_generation;
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    for(dia_size=1; dia_size<=c->dia_size; dia_size++){
-        int dir, start, end;
-        const int x= best[0];
-        const int y= best[1];
-
-        start= FFMAX(0, y + dia_size - ymax);
-        end  = FFMIN(dia_size, xmax - x + 1);
-        for(dir= start; dir<end; dir++){
-            int d;
-
-//check(x + dir,y + dia_size - dir,0, a0)
-            CHECK_MV(x + dir           , y + dia_size - dir);
-        }
-
-        start= FFMAX(0, x + dia_size - xmax);
-        end  = FFMIN(dia_size, y - ymin + 1);
-        for(dir= start; dir<end; dir++){
-            int d;
-
-//check(x + dia_size - dir, y - dir,0, a1)
-            CHECK_MV(x + dia_size - dir, y - dir           );
-        }
-
-        start= FFMAX(0, -y + dia_size + ymin );
-        end  = FFMIN(dia_size, x - xmin + 1);
-        for(dir= start; dir<end; dir++){
-            int d;
-
-//check(x - dir,y - dia_size + dir,0, a2)
-            CHECK_MV(x - dir           , y - dia_size + dir);
-        }
-
-        start= FFMAX(0, -x + dia_size + xmin );
-        end  = FFMIN(dia_size, ymax - y + 1);
-        for(dir= start; dir<end; dir++){
-            int d;
-
-//check(x - dia_size + dir, y + dir,0, a3)
-            CHECK_MV(x - dia_size + dir, y + dir           );
-        }
-
-        if(x!=best[0] || y!=best[1])
-            dia_size=0;
-#if 0
-{
-int dx, dy, i;
-static int stats[8*8];
-dx= FFABS(x-best[0]);
-dy= FFABS(y-best[1]);
-stats[dy*8 + dx] ++;
-if(256*256*256*64 % (stats[0]+1)==0){
-    for(i=0; i<64; i++){
-        if((i&7)==0) printf("\n");
-        printf("%6d ", stats[i]);
-    }
-    printf("\n");
-}
-}
-#endif
-    }
-    return dmin;
-}
-
-static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin,
-                                       int src_index, int ref_index, int const penalty_factor,
-                                       int size, int h, int flags){
-    MotionEstContext * const c= &s->me;
-    if(c->dia_size==-1)
-        return funny_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-    else if(c->dia_size<-1)
-        return   sab_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-    else if(c->dia_size<2)
-        return small_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-    else if(c->dia_size>1024)
-        return          full_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-    else if(c->dia_size>768)
-        return           umh_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-    else if(c->dia_size>512)
-        return           hex_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags, c->dia_size&0xFF);
-    else if(c->dia_size>256)
-        return       l2s_dia_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-    else
-        return   var_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-}
-
-/*!
-   \param P[10][2] a list of candidate mvs to check before starting the
-   iterative search. If one of the candidates is close to the optimal mv, then
-   it takes fewer iterations. And it increases the chance that we find the
-   optimal mv.
- */
-static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
-                             int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
-                             int ref_mv_scale, int flags, int size, int h)
-{
-    MotionEstContext * const c= &s->me;
-    int best[2]={0, 0};      /*!< x and y coordinates of the best motion vector.
-                               i.e. the difference between the position of the
-                               block currently being encoded and the position of
-                               the block chosen to predict it from. */
-    int d;                   ///< the score (cmp + penalty) of any given mv
-    int dmin;                /*!< the best value of d, i.e. the score
-                               corresponding to the mv stored in best[]. */
-    int map_generation;
-    int penalty_factor;
-    const int ref_mv_stride= s->mb_stride; //pass as arg  FIXME
-    const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; //add to last_mv beforepassing FIXME
-    me_cmp_func cmpf, chroma_cmpf;
-
-    LOAD_COMMON
-    LOAD_COMMON2
-
-    if(c->pre_pass){
-        penalty_factor= c->pre_penalty_factor;
-        cmpf= s->dsp.me_pre_cmp[size];
-        chroma_cmpf= s->dsp.me_pre_cmp[size+1];
-    }else{
-        penalty_factor= c->penalty_factor;
-        cmpf= s->dsp.me_cmp[size];
-        chroma_cmpf= s->dsp.me_cmp[size+1];
-    }
-
-    map_generation= update_map_generation(c);
-
-    assert(cmpf);
-    dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
-    map[0]= map_generation;
-    score_map[0]= dmin;
-
-    //FIXME precalc first term below?
-    if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
-        dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
-
-    /* first line */
-    if (s->first_slice_line) {
-        CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
-    }else{
-        if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
-                    && ( P_LEFT[0]    |P_LEFT[1]
-                        |P_TOP[0]     |P_TOP[1]
-                        |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
-            *mx_ptr= 0;
-            *my_ptr= 0;
-            c->skip=1;
-            return dmin;
-        }
-        CHECK_MV(    P_MEDIAN[0] >>shift ,    P_MEDIAN[1] >>shift)
-        CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)  , (P_MEDIAN[1]>>shift)-1)
-        CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)  , (P_MEDIAN[1]>>shift)+1)
-        CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift)  )
-        CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift)  )
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
-        CHECK_MV(P_LEFT[0]    >>shift, P_LEFT[1]    >>shift)
-        CHECK_MV(P_TOP[0]     >>shift, P_TOP[1]     >>shift)
-        CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
-    }
-    if(dmin>h*h*4){
-        if(c->pre_pass){
-            CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
-                            (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
-            if(!s->first_slice_line)
-                CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
-                                (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
-        }else{
-            CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
-                            (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
-            if(s->mb_y+1<s->end_mb_y)  //FIXME replace at least with last_slice_line
-                CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
-                                (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
-        }
-    }
-
-    if(c->avctx->last_predictor_count){
-        const int count= c->avctx->last_predictor_count;
-        const int xstart= FFMAX(0, s->mb_x - count);
-        const int ystart= FFMAX(0, s->mb_y - count);
-        const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
-        const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
-        int mb_y;
-
-        for(mb_y=ystart; mb_y<yend; mb_y++){
-            int mb_x;
-            for(mb_x=xstart; mb_x<xend; mb_x++){
-                const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
-                int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
-                int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
-
-                if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
-                CHECK_MV(mx,my)
-            }
-        }
-    }
-
-//check(best[0],best[1],0, b0)
-    dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-
-//check(best[0],best[1],0, b1)
-    *mx_ptr= best[0];
-    *my_ptr= best[1];
-
-//    printf("%d %d %d \n", best[0], best[1], dmin);
-    return dmin;
-}
-
-//this function is dedicated to the braindamaged gcc
-inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr,
-                             int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
-                             int ref_mv_scale, int size, int h)
-{
-    MotionEstContext * const c= &s->me;
-//FIXME convert other functions in the same way if faster
-    if(c->flags==0 && h==16 && size==0){
-        return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16);
-//    case FLAG_QPEL:
-//        return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, FLAG_QPEL);
-    }else{
-        return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, c->flags, size, h);
-    }
-}
-
-static int epzs_motion_search4(MpegEncContext * s,
-                             int *mx_ptr, int *my_ptr, int P[10][2],
-                             int src_index, int ref_index, int16_t (*last_mv)[2],
-                             int ref_mv_scale)
-{
-    MotionEstContext * const c= &s->me;
-    int best[2]={0, 0};
-    int d, dmin;
-    int map_generation;
-    const int penalty_factor= c->penalty_factor;
-    const int size=1;
-    const int h=8;
-    const int ref_mv_stride= s->mb_stride;
-    const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
-    me_cmp_func cmpf, chroma_cmpf;
-    LOAD_COMMON
-    int flags= c->flags;
-    LOAD_COMMON2
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    map_generation= update_map_generation(c);
-
-    dmin = 1000000;
-//printf("%d %d %d %d //",xmin, ymin, xmax, ymax);
-    /* first line */
-    if (s->first_slice_line) {
-        CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
-        CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
-    }else{
-        CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
-        //FIXME try some early stop
-        CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
-        CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
-        CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
-        CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
-    }
-    if(dmin>64*4){
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
-        if(s->mb_y+1<s->end_mb_y)  //FIXME replace at least with last_slice_line
-            CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
-                            (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
-    }
-
-    dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-
-    *mx_ptr= best[0];
-    *my_ptr= best[1];
-
-//    printf("%d %d %d \n", best[0], best[1], dmin);
-    return dmin;
-}
-
-//try to merge with above FIXME (needs PSNR test)
-static int epzs_motion_search2(MpegEncContext * s,
-                             int *mx_ptr, int *my_ptr, int P[10][2],
-                             int src_index, int ref_index, int16_t (*last_mv)[2],
-                             int ref_mv_scale)
-{
-    MotionEstContext * const c= &s->me;
-    int best[2]={0, 0};
-    int d, dmin;
-    int map_generation;
-    const int penalty_factor= c->penalty_factor;
-    const int size=0; //FIXME pass as arg
-    const int h=8;
-    const int ref_mv_stride= s->mb_stride;
-    const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
-    me_cmp_func cmpf, chroma_cmpf;
-    LOAD_COMMON
-    int flags= c->flags;
-    LOAD_COMMON2
-
-    cmpf= s->dsp.me_cmp[size];
-    chroma_cmpf= s->dsp.me_cmp[size+1];
-
-    map_generation= update_map_generation(c);
-
-    dmin = 1000000;
-//printf("%d %d %d %d //",xmin, ymin, xmax, ymax);
-    /* first line */
-    if (s->first_slice_line) {
-        CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
-        CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
-    }else{
-        CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
-        //FIXME try some early stop
-        CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
-        CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
-        CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
-        CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
-    }
-    if(dmin>64*4){
-        CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
-                        (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
-        if(s->mb_y+1<s->end_mb_y)  //FIXME replace at least with last_slice_line
-            CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
-                            (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
-    }
-
-    dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
-
-    *mx_ptr= best[0];
-    *my_ptr= best[1];
-
-//    printf("%d %d %d \n", best[0], best[1], dmin);
-    return dmin;
-}
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
deleted file mode 100644
index 9bc5e20..0000000
--- a/libavcodec/motionpixels.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Motion Pixels Video Decoder
- * Copyright (c) 2008 Gregory Montoir (cyx at users.sourceforge.net)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-
-#define MAX_HUFF_CODES 16
-
-#include "motionpixels_tablegen.h"
-
-typedef struct HuffCode {
-    int code;
-    uint8_t size;
-    uint8_t delta;
-} HuffCode;
-
-typedef struct MotionPixelsContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    DSPContext dsp;
-    uint8_t *changes_map;
-    int offset_bits_len;
-    int codes_count, current_codes_count;
-    int max_codes_bits;
-    HuffCode codes[MAX_HUFF_CODES];
-    VLC vlc;
-    YuvPixel *vpt, *hpt;
-    uint8_t gradient_scale[3];
-    uint8_t *bswapbuf;
-    int bswapbuf_size;
-} MotionPixelsContext;
-
-static av_cold int mp_decode_init(AVCodecContext *avctx)
-{
-    MotionPixelsContext *mp = avctx->priv_data;
-
-    motionpixels_tableinit();
-    mp->avctx = avctx;
-    dsputil_init(&mp->dsp, avctx);
-    mp->changes_map = av_mallocz(avctx->width * avctx->height);
-    mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
-    mp->vpt = av_mallocz(avctx->height * sizeof(YuvPixel));
-    mp->hpt = av_mallocz(avctx->height * avctx->width / 16 * sizeof(YuvPixel));
-    avctx->pix_fmt = PIX_FMT_RGB555;
-    return 0;
-}
-
-static void mp_read_changes_map(MotionPixelsContext *mp, GetBitContext *gb, int count, int bits_len, int read_color)
-{
-    uint16_t *pixels;
-    int offset, w, h, color = 0, x, y, i;
-
-    while (count--) {
-        offset = get_bits_long(gb, mp->offset_bits_len);
-        w      = get_bits(gb, bits_len) + 1;
-        h      = get_bits(gb, bits_len) + 1;
-        if (read_color)
-            color = get_bits(gb, 15);
-        x = offset % mp->avctx->width;
-        y = offset / mp->avctx->width;
-        if (y >= mp->avctx->height)
-            continue;
-        w = FFMIN(w, mp->avctx->width  - x);
-        h = FFMIN(h, mp->avctx->height - y);
-        pixels = (uint16_t *)&mp->frame.data[0][y * mp->frame.linesize[0] + x * 2];
-        while (h--) {
-            mp->changes_map[offset] = w;
-            if (read_color)
-                for (i = 0; i < w; ++i)
-                    pixels[i] = color;
-            offset += mp->avctx->width;
-            pixels += mp->frame.linesize[0] / 2;
-        }
-    }
-}
-
-static void mp_get_code(MotionPixelsContext *mp, GetBitContext *gb, int size, int code)
-{
-    while (get_bits1(gb)) {
-        ++size;
-        if (size > mp->max_codes_bits) {
-            av_log(mp->avctx, AV_LOG_ERROR, "invalid code size %d/%d\n", size, mp->max_codes_bits);
-            return;
-        }
-        code <<= 1;
-        mp_get_code(mp, gb, size, code + 1);
-    }
-    if (mp->current_codes_count >= MAX_HUFF_CODES) {
-        av_log(mp->avctx, AV_LOG_ERROR, "too many codes\n");
-        return;
-    }
-    mp->codes[mp->current_codes_count  ].code = code;
-    mp->codes[mp->current_codes_count++].size = size;
-}
-
-static void mp_read_codes_table(MotionPixelsContext *mp, GetBitContext *gb)
-{
-    if (mp->codes_count == 1) {
-        mp->codes[0].delta = get_bits(gb, 4);
-    } else {
-        int i;
-
-        mp->max_codes_bits = get_bits(gb, 4);
-        for (i = 0; i < mp->codes_count; ++i)
-            mp->codes[i].delta = get_bits(gb, 4);
-        mp->current_codes_count = 0;
-        mp_get_code(mp, gb, 0, 0);
-   }
-}
-
-static int mp_gradient(MotionPixelsContext *mp, int component, int v)
-{
-    int delta;
-
-    delta = (v - 7) * mp->gradient_scale[component];
-    mp->gradient_scale[component] = (v == 0 || v == 14) ? 2 : 1;
-    return delta;
-}
-
-static YuvPixel mp_get_yuv_from_rgb(MotionPixelsContext *mp, int x, int y)
-{
-    int color;
-
-    color = *(uint16_t *)&mp->frame.data[0][y * mp->frame.linesize[0] + x * 2];
-    return mp_rgb_yuv_table[color];
-}
-
-static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const YuvPixel *p)
-{
-    int color;
-
-    color = mp_yuv_to_rgb(p->y, p->v, p->u, 1);
-    *(uint16_t *)&mp->frame.data[0][y * mp->frame.linesize[0] + x * 2] = color;
-}
-
-static int mp_get_vlc(MotionPixelsContext *mp, GetBitContext *gb)
-{
-    int i;
-
-    i = (mp->codes_count == 1) ? 0 : get_vlc2(gb, mp->vlc.table, mp->max_codes_bits, 1);
-    return mp->codes[i].delta;
-}
-
-static void mp_decode_line(MotionPixelsContext *mp, GetBitContext *gb, int y)
-{
-    YuvPixel p;
-    const int y0 = y * mp->avctx->width;
-    int w, i, x = 0;
-
-    p = mp->vpt[y];
-    if (mp->changes_map[y0 + x] == 0) {
-        memset(mp->gradient_scale, 1, sizeof(mp->gradient_scale));
-        ++x;
-    }
-    while (x < mp->avctx->width) {
-        w = mp->changes_map[y0 + x];
-        if (w != 0) {
-            if ((y & 3) == 0) {
-                if (mp->changes_map[y0 + x + mp->avctx->width] < w ||
-                    mp->changes_map[y0 + x + mp->avctx->width * 2] < w ||
-                    mp->changes_map[y0 + x + mp->avctx->width * 3] < w) {
-                    for (i = (x + 3) & ~3; i < x + w; i += 4) {
-                        mp->hpt[((y / 4) * mp->avctx->width + i) / 4] = mp_get_yuv_from_rgb(mp, i, y);
-                    }
-                }
-            }
-            x += w;
-            memset(mp->gradient_scale, 1, sizeof(mp->gradient_scale));
-            p = mp_get_yuv_from_rgb(mp, x - 1, y);
-        } else {
-            p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
-            if ((x & 3) == 0) {
-                if ((y & 3) == 0) {
-                    p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
-                    p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
-                    mp->hpt[((y / 4) * mp->avctx->width + x) / 4] = p;
-                } else {
-                    p.v = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].v;
-                    p.u = mp->hpt[((y / 4) * mp->avctx->width + x) / 4].u;
-                }
-            }
-            mp_set_rgb_from_yuv(mp, x, y, &p);
-            ++x;
-        }
-    }
-}
-
-static void mp_decode_frame_helper(MotionPixelsContext *mp, GetBitContext *gb)
-{
-    YuvPixel p;
-    int y, y0;
-
-    for (y = 0; y < mp->avctx->height; ++y) {
-        if (mp->changes_map[y * mp->avctx->width] != 0) {
-            memset(mp->gradient_scale, 1, sizeof(mp->gradient_scale));
-            p = mp_get_yuv_from_rgb(mp, 0, y);
-        } else {
-            p.y += mp_gradient(mp, 0, mp_get_vlc(mp, gb));
-            if ((y & 3) == 0) {
-                p.v += mp_gradient(mp, 1, mp_get_vlc(mp, gb));
-                p.u += mp_gradient(mp, 2, mp_get_vlc(mp, gb));
-            }
-            mp->vpt[y] = p;
-            mp_set_rgb_from_yuv(mp, 0, y, &p);
-        }
-    }
-    for (y0 = 0; y0 < 2; ++y0)
-        for (y = y0; y < mp->avctx->height; y += 2)
-            mp_decode_line(mp, gb, y);
-}
-
-static int mp_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MotionPixelsContext *mp = avctx->priv_data;
-    GetBitContext gb;
-    int i, count1, count2, sz;
-
-    mp->frame.reference = 1;
-    mp->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &mp->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    /* le32 bitstream msb first */
-    av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!mp->bswapbuf)
-        return AVERROR(ENOMEM);
-    mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4);
-    if (buf_size & 3)
-        memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
-    init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
-
-    memset(mp->changes_map, 0, avctx->width * avctx->height);
-    for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
-        count1 = get_bits(&gb, 12);
-        count2 = get_bits(&gb, 12);
-        mp_read_changes_map(mp, &gb, count1, 8, i);
-        mp_read_changes_map(mp, &gb, count2, 4, i);
-    }
-
-    mp->codes_count = get_bits(&gb, 4);
-    if (mp->codes_count == 0)
-        goto end;
-
-    if (mp->changes_map[0] == 0) {
-        *(uint16_t *)mp->frame.data[0] = get_bits(&gb, 15);
-        mp->changes_map[0] = 1;
-    }
-    mp_read_codes_table(mp, &gb);
-
-    sz = get_bits(&gb, 18);
-    if (avctx->extradata[0] != 5)
-        sz += get_bits(&gb, 18);
-    if (sz == 0)
-        goto end;
-
-    init_vlc(&mp->vlc, mp->max_codes_bits, mp->codes_count, &mp->codes[0].size, sizeof(HuffCode), 1, &mp->codes[0].code, sizeof(HuffCode), 4, 0);
-    mp_decode_frame_helper(mp, &gb);
-    free_vlc(&mp->vlc);
-
-end:
-    *data_size = sizeof(AVFrame);
-    *(AVFrame *)data = mp->frame;
-    return buf_size;
-}
-
-static av_cold int mp_decode_end(AVCodecContext *avctx)
-{
-    MotionPixelsContext *mp = avctx->priv_data;
-
-    av_freep(&mp->changes_map);
-    av_freep(&mp->vpt);
-    av_freep(&mp->hpt);
-    av_freep(&mp->bswapbuf);
-    if (mp->frame.data[0])
-        avctx->release_buffer(avctx, &mp->frame);
-
-    return 0;
-}
-
-AVCodec motionpixels_decoder = {
-    "motionpixels",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MOTIONPIXELS,
-    sizeof(MotionPixelsContext),
-    mp_decode_init,
-    NULL,
-    mp_decode_end,
-    mp_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels video"),
-};
diff --git a/libavcodec/motionpixels_tablegen.c b/libavcodec/motionpixels_tablegen.c
deleted file mode 100644
index 5f1220a..0000000
--- a/libavcodec/motionpixels_tablegen.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Generate a header file for hardcoded motionpixels RGB to YUV table
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#define MAX_NEG_CROP 0
-#define ff_cropTbl ((uint8_t *)NULL)
-#include "motionpixels_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    motionpixels_tableinit();
-
-    write_fileheader();
-
-    printf("static const YuvPixel mp_rgb_yuv_table[1 << 15] = {\n");
-    write_int8_2d_array(mp_rgb_yuv_table, 1 << 15, 3);
-    printf("};\n");
-
-    return 0;
-}
diff --git a/libavcodec/motionpixels_tablegen.h b/libavcodec/motionpixels_tablegen.h
deleted file mode 100644
index 5d6df52..0000000
--- a/libavcodec/motionpixels_tablegen.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Header file for hardcoded motionpixels RGB to YUV table
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef MOTIONPIXELS_TABLEGEN_H
-#define MOTIONPIXELS_TABLEGEN_H
-
-#include <stdint.h>
-
-typedef struct YuvPixel {
-    int8_t y, v, u;
-} YuvPixel;
-
-static int mp_yuv_to_rgb(int y, int v, int u, int clip_rgb) {
-    static const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int r, g, b;
-
-    r = (1000 * y + 701 * v) / 1000;
-    g = (1000 * y - 357 * v - 172 * u) / 1000;
-    b = (1000 * y + 886 * u) / 1000;
-    if (clip_rgb)
-        return ((cm[r * 8] & 0xF8) << 7) | ((cm[g * 8] & 0xF8) << 2) | (cm[b * 8] >> 3);
-    if ((unsigned)r < 32 && (unsigned)g < 32 && (unsigned)b < 32)
-        return (r << 10) | (g << 5) | b;
-    return 1 << 15;
-}
-
-#if CONFIG_HARDCODED_TABLES
-#define motionpixels_tableinit()
-#include "libavcodec/motionpixels_tables.h"
-#else
-static YuvPixel mp_rgb_yuv_table[1 << 15];
-
-static void mp_set_zero_yuv(YuvPixel *p)
-{
-    int i, j;
-
-    for (i = 0; i < 31; ++i) {
-        for (j = 31; j > i; --j)
-            if (!(p[j].u | p[j].v | p[j].y))
-                p[j] = p[j - 1];
-        for (j = 0; j < 31 - i; ++j)
-            if (!(p[j].u | p[j].v | p[j].y))
-                p[j] = p[j + 1];
-    }
-}
-
-static void mp_build_rgb_yuv_table(YuvPixel *p)
-{
-    int y, v, u, i;
-
-    for (y = 0; y <= 31; ++y)
-        for (v = -31; v <= 31; ++v)
-            for (u = -31; u <= 31; ++u) {
-                i = mp_yuv_to_rgb(y, v, u, 0);
-                if (i < (1 << 15) && !(p[i].u | p[i].v | p[i].y)) {
-                    p[i].y = y;
-                    p[i].v = v;
-                    p[i].u = u;
-                }
-            }
-    for (i = 0; i < 1024; ++i)
-        mp_set_zero_yuv(p + i * 32);
-}
-
-static void motionpixels_tableinit(void)
-{
-    if (!mp_rgb_yuv_table[0].u)
-        mp_build_rgb_yuv_table(mp_rgb_yuv_table);
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* MOTIONPIXELS_TABLEGEN_H */
diff --git a/libavcodec/movsub_bsf.c b/libavcodec/movsub_bsf.c
deleted file mode 100644
index 2423f2d..0000000
--- a/libavcodec/movsub_bsf.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2008 Reimar Döffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-
-static int text2movsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    if (buf_size > 0xffff) return 0;
-    *poutbuf_size = buf_size + 2;
-    *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    AV_WB16(*poutbuf, buf_size);
-    memcpy(*poutbuf + 2, buf, buf_size);
-    return 1;
-}
-
-AVBitStreamFilter text2movsub_bsf={
-    "text2movsub",
-    0,
-    text2movsub,
-};
-
-static int mov2textsub(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    if (buf_size < 2) return 0;
-    *poutbuf_size = FFMIN(buf_size - 2, AV_RB16(buf));
-    *poutbuf = av_malloc(*poutbuf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    memcpy(*poutbuf, buf + 2, *poutbuf_size);
-    return 1;
-}
-
-AVBitStreamFilter mov2textsub_bsf={
-    "mov2textsub",
-    0,
-    mov2textsub,
-};
diff --git a/libavcodec/mp3_header_compress_bsf.c b/libavcodec/mp3_header_compress_bsf.c
deleted file mode 100644
index f5c5138..0000000
--- a/libavcodec/mp3_header_compress_bsf.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "mpegaudio.h"
-
-
-static int mp3_header_compress(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    uint32_t header, extraheader;
-    int mode_extension, header_size;
-
-    if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
-        av_log(avctx, AV_LOG_ERROR, "not standards compliant\n");
-        return -1;
-    }
-
-    header = AV_RB32(buf);
-    mode_extension= (header>>4)&3;
-
-    if(ff_mpa_check_header(header) < 0 || (header&0x60000) != 0x20000){
-output_unchanged:
-        *poutbuf= (uint8_t *) buf;
-        *poutbuf_size= buf_size;
-
-        av_log(avctx, AV_LOG_INFO, "cannot compress %08X\n", header);
-        return 0;
-    }
-
-    if(avctx->extradata_size == 0){
-        avctx->extradata_size=15;
-        avctx->extradata= av_malloc(avctx->extradata_size);
-        strcpy(avctx->extradata, "FFCMP3 0.0");
-        memcpy(avctx->extradata+11, buf, 4);
-    }
-    if(avctx->extradata_size != 15){
-        av_log(avctx, AV_LOG_ERROR, "Extradata invalid\n");
-        return -1;
-    }
-    extraheader = AV_RB32(avctx->extradata+11);
-    if((extraheader&MP3_MASK) != (header&MP3_MASK))
-        goto output_unchanged;
-
-    header_size= (header&0x10000) ? 4 : 6;
-
-    *poutbuf_size= buf_size - header_size;
-    *poutbuf= av_malloc(buf_size - header_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    memcpy(*poutbuf, buf + header_size, buf_size - header_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-    if(avctx->channels==2){
-        if((header & (3<<19)) != 3<<19){
-            (*poutbuf)[1] &= 0x3F;
-            (*poutbuf)[1] |= mode_extension<<6;
-            FFSWAP(int, (*poutbuf)[1], (*poutbuf)[2]);
-        }else{
-            (*poutbuf)[1] &= 0x8F;
-            (*poutbuf)[1] |= mode_extension<<4;
-        }
-    }
-
-    return 1;
-}
-
-AVBitStreamFilter mp3_header_compress_bsf={
-    "mp3comp",
-    0,
-    mp3_header_compress,
-};
diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c
deleted file mode 100644
index d897ed9..0000000
--- a/libavcodec/mp3_header_decompress_bsf.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "mpegaudio.h"
-#include "mpegaudiodata.h"
-
-
-static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    uint32_t header;
-    int sample_rate= avctx->sample_rate;
-    int sample_rate_index=0;
-    int lsf, mpeg25, bitrate_index, frame_size;
-
-    header = AV_RB32(buf);
-    if(ff_mpa_check_header(header) >= 0){
-        *poutbuf= (uint8_t *) buf;
-        *poutbuf_size= buf_size;
-
-        return 0;
-    }
-
-    if(avctx->extradata_size != 15 || strcmp(avctx->extradata, "FFCMP3 0.0")){
-        av_log(avctx, AV_LOG_ERROR, "Extradata invalid %d\n", avctx->extradata_size);
-        return -1;
-    }
-
-    header= AV_RB32(avctx->extradata+11) & MP3_MASK;
-
-    lsf     = sample_rate < (24000+32000)/2;
-    mpeg25  = sample_rate < (12000+16000)/2;
-    sample_rate_index= (header>>10)&3;
-    sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
-
-    for(bitrate_index=2; bitrate_index<30; bitrate_index++){
-        frame_size = ff_mpa_bitrate_tab[lsf][2][bitrate_index>>1];
-        frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
-        if(frame_size == buf_size + 4)
-            break;
-        if(frame_size == buf_size + 6)
-            break;
-    }
-    if(bitrate_index == 30){
-        av_log(avctx, AV_LOG_ERROR, "Could not find bitrate_index.\n");
-        return -1;
-    }
-
-    header |= (bitrate_index&1)<<9;
-    header |= (bitrate_index>>1)<<12;
-    header |= (frame_size == buf_size + 4)<<16; //FIXME actually set a correct crc instead of 0
-
-    *poutbuf_size= frame_size;
-    *poutbuf= av_malloc(frame_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    memcpy(*poutbuf + frame_size - buf_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-    if(avctx->channels==2){
-        uint8_t *p= *poutbuf + frame_size - buf_size;
-        if(lsf){
-            FFSWAP(int, p[1], p[2]);
-            header |= (p[1] & 0xC0)>>2;
-            p[1] &= 0x3F;
-        }else{
-            header |= p[1] & 0x30;
-            p[1] &= 0xCF;
-        }
-    }
-
-    AV_WB32(*poutbuf, header);
-
-    return 1;
-}
-
-AVBitStreamFilter mp3_header_decompress_bsf={
-    "mp3decomp",
-    0,
-    mp3_header_decompress,
-};
diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c
deleted file mode 100644
index 30ae591..0000000
--- a/libavcodec/mpc.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Musepack decoder core
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Musepack decoder core
- * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples
- * divided into 32 subbands.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "mpegaudio.h"
-
-#include "mpc.h"
-#include "mpcdata.h"
-
-void ff_mpc_init(void)
-{
-    ff_mpa_synth_init(ff_mpa_synth_window);
-}
-
-/**
- * Process decoded Musepack data and produce PCM
- */
-static void mpc_synth(MPCContext *c, int16_t *out)
-{
-    int dither_state = 0;
-    int i, ch;
-    OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE], *samples_ptr;
-
-    for(ch = 0;  ch < 2; ch++){
-        samples_ptr = samples + ch;
-        for(i = 0; i < SAMPLES_PER_BAND; i++) {
-            ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
-                                ff_mpa_synth_window, &dither_state,
-                                samples_ptr, 2,
-                                c->sb_samples[ch][i]);
-            samples_ptr += 64;
-        }
-    }
-    for(i = 0; i < MPC_FRAME_SIZE*2; i++)
-        *out++=samples[i];
-}
-
-void ff_mpc_dequantize_and_synth(MPCContext * c, int maxband, void *data)
-{
-    int i, j, ch;
-    Band *bands = c->bands;
-    int off;
-    float mul;
-
-    /* dequantize */
-    memset(c->sb_samples, 0, sizeof(c->sb_samples));
-    off = 0;
-    for(i = 0; i <= maxband; i++, off += SAMPLES_PER_BAND){
-        for(ch = 0; ch < 2; ch++){
-            if(bands[i].res[ch]){
-                j = 0;
-                mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][0]];
-                for(; j < 12; j++)
-                    c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off];
-                mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][1]];
-                for(; j < 24; j++)
-                    c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off];
-                mul = mpc_CC[bands[i].res[ch]] * mpc_SCF[bands[i].scf_idx[ch][2]];
-                for(; j < 36; j++)
-                    c->sb_samples[ch][j][i] = mul * c->Q[ch][j + off];
-            }
-        }
-        if(bands[i].msf){
-            int t1, t2;
-            for(j = 0; j < SAMPLES_PER_BAND; j++){
-                t1 = c->sb_samples[0][j][i];
-                t2 = c->sb_samples[1][j][i];
-                c->sb_samples[0][j][i] = t1 + t2;
-                c->sb_samples[1][j][i] = t1 - t2;
-            }
-        }
-    }
-
-    mpc_synth(c, data);
-}
diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h
deleted file mode 100644
index 25d1d2c..0000000
--- a/libavcodec/mpc.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Musepack decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Musepack decoder
- * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples
- * divided into 32 subbands.
- */
-
-#ifndef AVCODEC_MPC_H
-#define AVCODEC_MPC_H
-
-#include "libavutil/lfg.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "mpegaudio.h"
-
-#include "mpcdata.h"
-
-#define BANDS            32
-#define SAMPLES_PER_BAND 36
-#define MPC_FRAME_SIZE   (BANDS * SAMPLES_PER_BAND)
-
-/** Subband structure - hold all variables for each subband */
-typedef struct {
-    int msf; ///< mid-stereo flag
-    int res[2];
-    int scfi[2];
-    int scf_idx[2][3];
-    int Q[2];
-}Band;
-
-typedef struct {
-    DSPContext dsp;
-    GetBitContext gb;
-    int IS, MSS, gapless;
-    int lastframelen;
-    int maxbands, last_max_band;
-    int last_bits_used;
-    int oldDSCF[2][BANDS];
-    Band bands[BANDS];
-    int Q[2][MPC_FRAME_SIZE];
-    int cur_frame, frames;
-    uint8_t *bits;
-    int buf_size;
-    AVLFG rnd;
-    int frames_to_skip;
-    /* for synthesis */
-    DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512*2];
-    int synth_buf_offset[MPA_MAX_CHANNELS];
-    DECLARE_ALIGNED(16, int32_t, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT];
-} MPCContext;
-
-void ff_mpc_init(void);
-void ff_mpc_dequantize_and_synth(MPCContext *c, int maxband, void *dst);
-
-#endif /* AVCODEC_MPC_H */
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
deleted file mode 100644
index 42de27e..0000000
--- a/libavcodec/mpc7.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Musepack SV7 decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples
- * divided into 32 subbands.
- */
-
-#include "libavutil/lfg.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "mpegaudio.h"
-
-#include "mpc.h"
-#include "mpc7data.h"
-
-#define BANDS            32
-#define SAMPLES_PER_BAND 36
-#define MPC_FRAME_SIZE   (BANDS * SAMPLES_PER_BAND)
-
-static VLC scfi_vlc, dscf_vlc, hdr_vlc, quant_vlc[MPC7_QUANT_VLC_TABLES][2];
-
-static const uint16_t quant_offsets[MPC7_QUANT_VLC_TABLES*2 + 1] =
-{
-       0, 512, 1024, 1536, 2052, 2564, 3076, 3588, 4100, 4612, 5124,
-       5636, 6164, 6676, 7224
-};
-
-
-static av_cold int mpc7_decode_init(AVCodecContext * avctx)
-{
-    int i, j;
-    MPCContext *c = avctx->priv_data;
-    GetBitContext gb;
-    uint8_t buf[16];
-    static int vlc_initialized = 0;
-
-    static VLC_TYPE scfi_table[1 << MPC7_SCFI_BITS][2];
-    static VLC_TYPE dscf_table[1 << MPC7_DSCF_BITS][2];
-    static VLC_TYPE hdr_table[1 << MPC7_HDR_BITS][2];
-    static VLC_TYPE quant_tables[7224][2];
-
-    if(avctx->extradata_size < 16){
-        av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
-        return -1;
-    }
-    memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
-    av_lfg_init(&c->rnd, 0xDEADBEEF);
-    dsputil_init(&c->dsp, avctx);
-    c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
-    ff_mpc_init();
-    init_get_bits(&gb, buf, 128);
-
-    c->IS = get_bits1(&gb);
-    c->MSS = get_bits1(&gb);
-    c->maxbands = get_bits(&gb, 6);
-    if(c->maxbands >= BANDS){
-        av_log(avctx, AV_LOG_ERROR, "Too many bands: %i\n", c->maxbands);
-        return -1;
-    }
-    skip_bits_long(&gb, 88);
-    c->gapless = get_bits1(&gb);
-    c->lastframelen = get_bits(&gb, 11);
-    av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n",
-            c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
-    c->frames_to_skip = 0;
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
-
-    if(vlc_initialized) return 0;
-    av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
-    scfi_vlc.table = scfi_table;
-    scfi_vlc.table_allocated = 1 << MPC7_SCFI_BITS;
-    if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE,
-                &mpc7_scfi[1], 2, 1,
-                &mpc7_scfi[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
-        av_log(avctx, AV_LOG_ERROR, "Cannot init SCFI VLC\n");
-        return -1;
-    }
-    dscf_vlc.table = dscf_table;
-    dscf_vlc.table_allocated = 1 << MPC7_DSCF_BITS;
-    if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE,
-                &mpc7_dscf[1], 2, 1,
-                &mpc7_dscf[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
-        av_log(avctx, AV_LOG_ERROR, "Cannot init DSCF VLC\n");
-        return -1;
-    }
-    hdr_vlc.table = hdr_table;
-    hdr_vlc.table_allocated = 1 << MPC7_HDR_BITS;
-    if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE,
-                &mpc7_hdr[1], 2, 1,
-                &mpc7_hdr[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
-        av_log(avctx, AV_LOG_ERROR, "Cannot init HDR VLC\n");
-        return -1;
-    }
-    for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){
-        for(j = 0; j < 2; j++){
-            quant_vlc[i][j].table = &quant_tables[quant_offsets[i*2 + j]];
-            quant_vlc[i][j].table_allocated = quant_offsets[i*2 + j + 1] - quant_offsets[i*2 + j];
-            if(init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i],
-                        &mpc7_quant_vlc[i][j][1], 4, 2,
-                        &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_NEW_STATIC)){
-                av_log(avctx, AV_LOG_ERROR, "Cannot init QUANT VLC %i,%i\n",i,j);
-                return -1;
-            }
-        }
-    }
-    vlc_initialized = 1;
-    return 0;
-}
-
-/**
- * Fill samples for given subband
- */
-static inline void idx_to_quant(MPCContext *c, GetBitContext *gb, int idx, int *dst)
-{
-    int i, i1, t;
-    switch(idx){
-    case -1:
-        for(i = 0; i < SAMPLES_PER_BAND; i++){
-            *dst++ = (av_lfg_get(&c->rnd) & 0x3FC) - 510;
-        }
-        break;
-    case 1:
-        i1 = get_bits1(gb);
-        for(i = 0; i < SAMPLES_PER_BAND/3; i++){
-            t = get_vlc2(gb, quant_vlc[0][i1].table, 9, 2);
-            *dst++ = mpc7_idx30[t];
-            *dst++ = mpc7_idx31[t];
-            *dst++ = mpc7_idx32[t];
-        }
-        break;
-    case 2:
-        i1 = get_bits1(gb);
-        for(i = 0; i < SAMPLES_PER_BAND/2; i++){
-            t = get_vlc2(gb, quant_vlc[1][i1].table, 9, 2);
-            *dst++ = mpc7_idx50[t];
-            *dst++ = mpc7_idx51[t];
-        }
-        break;
-    case  3: case  4: case  5: case  6: case  7:
-        i1 = get_bits1(gb);
-        for(i = 0; i < SAMPLES_PER_BAND; i++)
-            *dst++ = get_vlc2(gb, quant_vlc[idx-1][i1].table, 9, 2) - mpc7_quant_vlc_off[idx-1];
-        break;
-    case  8: case  9: case 10: case 11: case 12:
-    case 13: case 14: case 15: case 16: case 17:
-        t = (1 << (idx - 2)) - 1;
-        for(i = 0; i < SAMPLES_PER_BAND; i++)
-            *dst++ = get_bits(gb, idx - 1) - t;
-        break;
-    default: // case 0 and -2..-17
-        return;
-    }
-}
-
-static int get_scale_idx(GetBitContext *gb, int ref)
-{
-    int t = get_vlc2(gb, dscf_vlc.table, MPC7_DSCF_BITS, 1) - 7;
-    if (t == 8)
-        return get_bits(gb, 6);
-    return ref + t;
-}
-
-static int mpc7_decode_frame(AVCodecContext * avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MPCContext *c = avctx->priv_data;
-    GetBitContext gb;
-    uint8_t *bits;
-    int i, ch;
-    int mb = -1;
-    Band *bands = c->bands;
-    int off;
-    int bits_used, bits_avail;
-
-    memset(bands, 0, sizeof(bands));
-    if(buf_size <= 4){
-        av_log(avctx, AV_LOG_ERROR, "Too small buffer passed (%i bytes)\n", buf_size);
-    }
-
-    bits = av_malloc(((buf_size - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE);
-    c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(buf + 4), (buf_size - 4) >> 2);
-    init_get_bits(&gb, bits, (buf_size - 4)* 8);
-    skip_bits(&gb, buf[0]);
-
-    /* read subband indexes */
-    for(i = 0; i <= c->maxbands; i++){
-        for(ch = 0; ch < 2; ch++){
-            int t = 4;
-            if(i) t = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5;
-            if(t == 4) bands[i].res[ch] = get_bits(&gb, 4);
-            else bands[i].res[ch] = bands[i-1].res[ch] + t;
-        }
-
-        if(bands[i].res[0] || bands[i].res[1]){
-            mb = i;
-            if(c->MSS) bands[i].msf = get_bits1(&gb);
-        }
-    }
-    /* get scale indexes coding method */
-    for(i = 0; i <= mb; i++)
-        for(ch = 0; ch < 2; ch++)
-            if(bands[i].res[ch]) bands[i].scfi[ch] = get_vlc2(&gb, scfi_vlc.table, MPC7_SCFI_BITS, 1);
-    /* get scale indexes */
-    for(i = 0; i <= mb; i++){
-        for(ch = 0; ch < 2; ch++){
-            if(bands[i].res[ch]){
-                bands[i].scf_idx[ch][2] = c->oldDSCF[ch][i];
-                bands[i].scf_idx[ch][0] = get_scale_idx(&gb, bands[i].scf_idx[ch][2]);
-                switch(bands[i].scfi[ch]){
-                case 0:
-                    bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]);
-                    bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]);
-                    break;
-                case 1:
-                    bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]);
-                    bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1];
-                    break;
-                case 2:
-                    bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0];
-                    bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]);
-                    break;
-                case 3:
-                    bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0];
-                    break;
-                }
-                c->oldDSCF[ch][i] = bands[i].scf_idx[ch][2];
-            }
-        }
-    }
-    /* get quantizers */
-    memset(c->Q, 0, sizeof(c->Q));
-    off = 0;
-    for(i = 0; i < BANDS; i++, off += SAMPLES_PER_BAND)
-        for(ch = 0; ch < 2; ch++)
-            idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off);
-
-    ff_mpc_dequantize_and_synth(c, mb, data);
-
-    av_free(bits);
-
-    bits_used = get_bits_count(&gb);
-    bits_avail = (buf_size - 4) * 8;
-    if(!buf[1] && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))){
-        av_log(NULL,0, "Error decoding frame: used %i of %i bits\n", bits_used, bits_avail);
-        return -1;
-    }
-    if(c->frames_to_skip){
-        c->frames_to_skip--;
-        *data_size = 0;
-        return buf_size;
-    }
-    *data_size = (buf[1] ? c->lastframelen : MPC_FRAME_SIZE) * 4;
-
-    return buf_size;
-}
-
-static void mpc7_decode_flush(AVCodecContext *avctx)
-{
-    MPCContext *c = avctx->priv_data;
-
-    memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
-    c->frames_to_skip = 32;
-}
-
-AVCodec mpc7_decoder = {
-    "mpc7",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MUSEPACK7,
-    sizeof(MPCContext),
-    mpc7_decode_init,
-    NULL,
-    NULL,
-    mpc7_decode_frame,
-    .flush = mpc7_decode_flush,
-    .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"),
-};
diff --git a/libavcodec/mpc7data.h b/libavcodec/mpc7data.h
deleted file mode 100644
index 5609e8f..0000000
--- a/libavcodec/mpc7data.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Musepack decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPC7DATA_H
-#define AVCODEC_MPC7DATA_H
-
-#include <stdint.h>
-
-static const int8_t mpc7_idx30[] = { -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 const int8_t mpc7_idx31[] = { -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 const int8_t mpc7_idx32[] = { -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 const int8_t mpc7_idx50[] = { -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 const int8_t mpc7_idx51[] = { -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};
-
-#define MPC7_SCFI_SIZE  4
-#define MPC7_SCFI_BITS  3
-static const uint8_t mpc7_scfi[MPC7_SCFI_SIZE * 2] = {
-    0x2, 3, 0x1, 1, 0x3, 3, 0x0, 2
-};
-
-#define MPC7_DSCF_SIZE 16
-#define MPC7_DSCF_BITS  6
-static const uint8_t mpc7_dscf[MPC7_DSCF_SIZE * 2] = {
-    0x20, 6, 0x04, 5, 0x11, 5, 0x1E, 5, 0x0D, 4, 0x00, 3, 0x03, 3, 0x09, 4,
-    0x05, 3, 0x02, 3, 0x0E, 4, 0x03, 4, 0x1F, 5, 0x05, 5, 0x21, 6, 0x0C, 4
-};
-
-#define MPC7_HDR_SIZE  10
-#define MPC7_HDR_BITS   9
-static const uint8_t mpc7_hdr[MPC7_HDR_SIZE * 2] = {
-    0x5C, 8, 0x2F, 7, 0x0A, 5, 0x04, 4, 0x00, 2,
-    0x01, 1, 0x03, 3, 0x16, 6, 0xBB, 9, 0xBA, 9
-};
-
-#define MPC7_QUANT_VLC_TABLES 7
-static const uint8_t mpc7_quant_vlc_sizes[MPC7_QUANT_VLC_TABLES * 2] = {
-    27, 25, 7, 9, 15, 31, 63
-};
-
-static const uint8_t mpc7_quant_vlc_off[MPC7_QUANT_VLC_TABLES] = {
-    0, 0, 3, 4, 7, 15, 31
-};
-
-static const uint16_t mpc7_quant_vlc[MPC7_QUANT_VLC_TABLES][2][64 * 2] = {
-{
-    {
-        0x0036,  6, 0x0009,  5, 0x0020,  6, 0x0005,  5, 0x000A,  4, 0x0007,  5,
-        0x0034,  6, 0x0000,  5, 0x0023,  6, 0x000A,  5, 0x0006,  4, 0x0004,  5,
-        0x000B,  4, 0x0007,  3, 0x000C,  4, 0x0003,  5, 0x0007,  4, 0x000B,  5,
-        0x0022,  6, 0x0001,  5, 0x0035,  6, 0x0006,  5, 0x0009,  4, 0x0002,  5,
-        0x0021,  6, 0x0008,  5, 0x0037,  6
-    },
-    {
-        0x0067,  8, 0x003E,  7, 0x00E1,  9, 0x0037,  7, 0x0003,  4, 0x0034,  7,
-        0x0065,  8, 0x003C,  7, 0x00E3,  9, 0x0018,  6, 0x0000,  4, 0x003D,  7,
-        0x0004,  4, 0x0001,  1, 0x0005,  4, 0x003F,  7, 0x0001,  4, 0x003B,  7,
-        0x00E2,  9, 0x0039,  7, 0x0064,  8, 0x0035,  7, 0x0002,  4, 0x0036,  7,
-        0x00E0,  9, 0x003A,  7, 0x0066,  8
-    }
-},
-{
-    {
-        0x0059,  7, 0x002F,  6, 0x000F,  5, 0x0000,  5, 0x005B,  7, 0x0004,  5,
-        0x0006,  4, 0x000D,  4, 0x0004,  4, 0x0005,  5, 0x0014,  5, 0x000C,  4,
-        0x0004,  3, 0x000F,  4, 0x000E,  5, 0x0003,  5, 0x0003,  4, 0x000E,  4,
-        0x0005,  4, 0x0001,  5, 0x005A,  7, 0x0002,  5, 0x0015,  5, 0x002E,  6,
-        0x0058,  7
-    },
-    {
-        0x0399, 10, 0x0071,  7, 0x0033,  6, 0x00E7,  8, 0x039A, 10, 0x0068,  7,
-        0x001E,  5, 0x0000,  3, 0x001D,  5, 0x0069,  7, 0x0032,  6, 0x0001,  3,
-        0x0002,  2, 0x0003,  3, 0x0031,  6, 0x006B,  7, 0x001B,  5, 0x0002,  3,
-        0x001F,  5, 0x0070,  7, 0x0398, 10, 0x006A,  7, 0x0030,  6, 0x0072,  7,
-        0x039B, 10
-    }
-},
-{
-    {
-        0x000C,  4, 0x0004,  3, 0x0000,  2, 0x0001,  2, 0x0007,  3, 0x0005,  3, 0x000D,  4
-    },
-    {
-        0x0004,  5, 0x0003,  4, 0x0002,  2, 0x0003,  2, 0x0001,  2, 0x0000,  3, 0x0005,  5
-    }
-},
-{
-    {
-        0x0005,  4, 0x0000,  3, 0x0004,  3, 0x0006,  3, 0x0007,  3, 0x0005,  3, 0x0003,  3, 0x0001,  3, 0x0004,  4
-    },
-    {
-        0x0009,  5, 0x000C,  4, 0x0003,  3, 0x0000,  2, 0x0002,  2, 0x0007,  3, 0x000D,  4, 0x0005,  4, 0x0008,  5
-    }
-},
-{
-    {
-        0x0039,  6, 0x0017,  5, 0x0008,  4, 0x000A,  4, 0x000D,  4, 0x0000,  3,
-        0x0002,  3, 0x0003,  3, 0x0001,  3, 0x000F,  4, 0x000C,  4, 0x0009,  4,
-        0x001D,  5, 0x0016,  5, 0x0038,  6,
-    },
-    {
-        0x00E5,  8, 0x0038,  6, 0x0007,  5, 0x0002,  4, 0x0000,  3, 0x0003,  3,
-        0x0005,  3, 0x0006,  3, 0x0004,  3, 0x0002,  3, 0x000F,  4, 0x001D,  5,
-        0x0006,  5, 0x0073,  7, 0x00E4,  8,
-    },
-},
-{
-    {
-        0x0041,  7, 0x0006,  6, 0x002C,  6, 0x002D,  6, 0x003B,  6, 0x000D,  5,
-        0x0011,  5, 0x0013,  5, 0x0017,  5, 0x0015,  5, 0x001A,  5, 0x001E,  5,
-        0x0000,  4, 0x0002,  4, 0x0005,  4, 0x0007,  4, 0x0003,  4, 0x0004,  4,
-        0x001F,  5, 0x001C,  5, 0x0019,  5, 0x001B,  5, 0x0018,  5, 0x0014,  5,
-        0x0012,  5, 0x000C,  5, 0x0002,  5, 0x003A,  6, 0x0021,  6, 0x0007,  6,
-        0x0040,  7
-    },
-    {
-        0x1948, 13, 0x194A, 13, 0x0328, 10, 0x0195,  9, 0x00CB,  8, 0x0066,  7,
-        0x0031,  6, 0x0009,  5, 0x000F,  5, 0x001F,  5, 0x0002,  4, 0x0006,  4,
-        0x0008,  4, 0x000B,  4, 0x000D,  4, 0x0000,  3, 0x000E,  4, 0x000A,  4,
-        0x0009,  4, 0x0005,  4, 0x0003,  4, 0x001E,  5, 0x000E,  5, 0x0008,  5,
-        0x0030,  6, 0x0067,  7, 0x00C9,  8, 0x00C8,  8, 0x0653, 11, 0x1949, 13,
-        0x194B, 13
-    }
-},
-{
-    {
-        0x0067,  8, 0x0099,  8, 0x00B5,  8, 0x00E9,  8, 0x0040,  7, 0x0041,  7,
-        0x004D,  7, 0x0051,  7, 0x005B,  7, 0x0071,  7, 0x0070,  7, 0x0018,  6,
-        0x001D,  6, 0x0023,  6, 0x0025,  6, 0x0029,  6, 0x002C,  6, 0x002E,  6,
-        0x0033,  6, 0x0031,  6, 0x0036,  6, 0x0037,  6, 0x0039,  6, 0x003C,  6,
-        0x0000,  5, 0x0002,  5, 0x000A,  5, 0x0005,  5, 0x0009,  5, 0x0006,  5,
-        0x000D,  5, 0x0007,  5, 0x000B,  5, 0x000F,  5, 0x0008,  5, 0x0004,  5,
-        0x0003,  5, 0x0001,  5, 0x003F,  6, 0x003E,  6, 0x003D,  6, 0x0035,  6,
-        0x003B,  6, 0x0034,  6, 0x0030,  6, 0x002F,  6, 0x002B,  6, 0x002A,  6,
-        0x0027,  6, 0x0024,  6, 0x0021,  6, 0x001C,  6, 0x0075,  7, 0x0065,  7,
-        0x0064,  7, 0x0050,  7, 0x0045,  7, 0x0044,  7, 0x0032,  7, 0x00E8,  8,
-        0x00B4,  8, 0x0098,  8, 0x0066,  8
-    },
-    {
-        0x37A4, 14, 0x37AD, 14, 0x37A6, 14, 0x37AE, 14, 0x0DEA, 12, 0x02F0, 10,
-        0x02F1, 10, 0x00A0,  9, 0x00A2,  9, 0x01BC,  9, 0x007A,  8, 0x00DF,  8,
-        0x003C,  7, 0x0049,  7, 0x006E,  7, 0x000E,  6, 0x0018,  6, 0x0019,  6,
-        0x0022,  6, 0x0025,  6, 0x0036,  6, 0x0003,  5, 0x0009,  5, 0x000B,  5,
-        0x0010,  5, 0x0013,  5, 0x0015,  5, 0x0018,  5, 0x001A,  5, 0x001D,  5,
-        0x001F,  5, 0x0002,  4, 0x0000,  4, 0x001E,  5, 0x001C,  5, 0x0019,  5,
-        0x0016,  5, 0x0014,  5, 0x000E,  5, 0x000D,  5, 0x0008,  5, 0x0006,  5,
-        0x0002,  5, 0x002E,  6, 0x0023,  6, 0x001F,  6, 0x0015,  6, 0x000F,  6,
-        0x005F,  7, 0x0048,  7, 0x0029,  7, 0x00BD,  8, 0x007B,  8, 0x0179,  9,
-        0x00A1,  9, 0x037B, 10, 0x0147, 10, 0x0146, 10, 0x0DE8, 12, 0x37AF, 14,
-        0x37A7, 14, 0x37AC, 14, 0x37A5, 14
-    }
-}
-};
-
-#endif /* AVCODEC_MPC7DATA_H */
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
deleted file mode 100644
index 3762746..0000000
--- a/libavcodec/mpc8.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/*
- * Musepack SV8 decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG Audio Layer 1/2 -like codec with frames of 1152 samples
- * divided into 32 subbands.
- */
-
-#include "libavutil/lfg.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "mpegaudio.h"
-
-#include "mpc.h"
-#include "mpcdata.h"
-#include "mpc8data.h"
-#include "mpc8huff.h"
-
-static VLC band_vlc, scfi_vlc[2], dscf_vlc[2], res_vlc[2];
-static VLC q1_vlc, q2_vlc[2], q3_vlc[2], quant_vlc[4][2], q9up_vlc;
-
-static const int q3_offsets[2] = { MPC8_Q3_OFFSET, MPC8_Q4_OFFSET };
-static const int quant_offsets[6] = { MPC8_Q5_OFFSET, MPC8_Q6_OFFSET, MPC8_Q7_OFFSET, MPC8_Q8_OFFSET };
-
-static inline int mpc8_dec_base(GetBitContext *gb, int k, int n)
-{
-    int len = mpc8_cnk_len[k-1][n-1] - 1;
-    int code = len ? get_bits_long(gb, len) : 0;
-
-    if (code >= mpc8_cnk_lost[k-1][n-1])
-        code = ((code << 1) | get_bits1(gb)) - mpc8_cnk_lost[k-1][n-1];
-
-    return code;
-}
-
-static inline int mpc8_dec_enum(GetBitContext *gb, int k, int n)
-{
-    int bits = 0;
-    const uint32_t * C = mpc8_cnk[k-1];
-    int code = mpc8_dec_base(gb, k, n);
-
-    do {
-        n--;
-        if (code >= C[n]) {
-            bits |= 1 << n;
-            code -= C[n];
-            C -= 32;
-            k--;
-        }
-    } while(k > 0);
-
-    return bits;
-}
-
-static inline int mpc8_get_mod_golomb(GetBitContext *gb, int m)
-{
-    if(mpc8_cnk_len[0][m] < 1) return 0;
-    return mpc8_dec_base(gb, 1, m+1);
-}
-
-static int mpc8_get_mask(GetBitContext *gb, int size, int t)
-{
-    int mask = 0;
-
-    if(t && t != size)
-         mask = mpc8_dec_enum(gb, FFMIN(t, size - t), size);
-    if((t << 1) > size) mask = ~mask;
-
-    return mask;
-}
-
-static const uint16_t vlc_offsets[13] = {
-    0, 640, 1184, 1748, 2298, 2426, 2554, 3066, 3578, 4106, 4618, 5196, 5708
-};
-
-static av_cold int mpc8_decode_init(AVCodecContext * avctx)
-{
-    int i;
-    MPCContext *c = avctx->priv_data;
-    GetBitContext gb;
-    static int vlc_initialized = 0;
-
-    static VLC_TYPE band_table[542][2];
-    static VLC_TYPE q1_table[520][2];
-    static VLC_TYPE q9up_table[524][2];
-    static VLC_TYPE scfi0_table[1 << MPC8_SCFI0_BITS][2];
-    static VLC_TYPE scfi1_table[1 << MPC8_SCFI1_BITS][2];
-    static VLC_TYPE dscf0_table[560][2];
-    static VLC_TYPE dscf1_table[598][2];
-    static VLC_TYPE q3_0_table[512][2];
-    static VLC_TYPE q3_1_table[516][2];
-    static VLC_TYPE codes_table[5708][2];
-
-    if(avctx->extradata_size < 2){
-        av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
-        return -1;
-    }
-    memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
-    av_lfg_init(&c->rnd, 0xDEADBEEF);
-    dsputil_init(&c->dsp, avctx);
-
-    ff_mpc_init();
-
-    init_get_bits(&gb, avctx->extradata, 16);
-
-    skip_bits(&gb, 3);//sample rate
-    c->maxbands = get_bits(&gb, 5) + 1;
-    skip_bits(&gb, 4);//channels
-    c->MSS = get_bits1(&gb);
-    c->frames = 1 << (get_bits(&gb, 3) * 2);
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
-
-    if(vlc_initialized) return 0;
-    av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
-
-    band_vlc.table = band_table;
-    band_vlc.table_allocated = 542;
-    init_vlc(&band_vlc, MPC8_BANDS_BITS, MPC8_BANDS_SIZE,
-             mpc8_bands_bits,  1, 1,
-             mpc8_bands_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    q1_vlc.table = q1_table;
-    q1_vlc.table_allocated = 520;
-    init_vlc(&q1_vlc, MPC8_Q1_BITS, MPC8_Q1_SIZE,
-             mpc8_q1_bits,  1, 1,
-             mpc8_q1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-    q9up_vlc.table = q9up_table;
-    q9up_vlc.table_allocated = 524;
-    init_vlc(&q9up_vlc, MPC8_Q9UP_BITS, MPC8_Q9UP_SIZE,
-             mpc8_q9up_bits,  1, 1,
-             mpc8_q9up_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    scfi_vlc[0].table = scfi0_table;
-    scfi_vlc[0].table_allocated = 1 << MPC8_SCFI0_BITS;
-    init_vlc(&scfi_vlc[0], MPC8_SCFI0_BITS, MPC8_SCFI0_SIZE,
-             mpc8_scfi0_bits,  1, 1,
-             mpc8_scfi0_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-    scfi_vlc[1].table = scfi1_table;
-    scfi_vlc[1].table_allocated = 1 << MPC8_SCFI1_BITS;
-    init_vlc(&scfi_vlc[1], MPC8_SCFI1_BITS, MPC8_SCFI1_SIZE,
-             mpc8_scfi1_bits,  1, 1,
-             mpc8_scfi1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    dscf_vlc[0].table = dscf0_table;
-    dscf_vlc[0].table_allocated = 560;
-    init_vlc(&dscf_vlc[0], MPC8_DSCF0_BITS, MPC8_DSCF0_SIZE,
-             mpc8_dscf0_bits,  1, 1,
-             mpc8_dscf0_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-    dscf_vlc[1].table = dscf1_table;
-    dscf_vlc[1].table_allocated = 598;
-    init_vlc(&dscf_vlc[1], MPC8_DSCF1_BITS, MPC8_DSCF1_SIZE,
-             mpc8_dscf1_bits,  1, 1,
-             mpc8_dscf1_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    q3_vlc[0].table = q3_0_table;
-    q3_vlc[0].table_allocated = 512;
-    init_vlc_sparse(&q3_vlc[0], MPC8_Q3_BITS, MPC8_Q3_SIZE,
-             mpc8_q3_bits,  1, 1,
-             mpc8_q3_codes, 1, 1,
-             mpc8_q3_syms,  1, 1, INIT_VLC_USE_NEW_STATIC);
-    q3_vlc[1].table = q3_1_table;
-    q3_vlc[1].table_allocated = 516;
-    init_vlc_sparse(&q3_vlc[1], MPC8_Q4_BITS, MPC8_Q4_SIZE,
-             mpc8_q4_bits,  1, 1,
-             mpc8_q4_codes, 1, 1,
-             mpc8_q4_syms,  1, 1, INIT_VLC_USE_NEW_STATIC);
-
-    for(i = 0; i < 2; i++){
-        res_vlc[i].table = &codes_table[vlc_offsets[0+i]];
-        res_vlc[i].table_allocated = vlc_offsets[1+i] - vlc_offsets[0+i];
-        init_vlc(&res_vlc[i], MPC8_RES_BITS, MPC8_RES_SIZE,
-                 &mpc8_res_bits[i],  1, 1,
-                 &mpc8_res_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-        q2_vlc[i].table = &codes_table[vlc_offsets[2+i]];
-        q2_vlc[i].table_allocated = vlc_offsets[3+i] - vlc_offsets[2+i];
-        init_vlc(&q2_vlc[i], MPC8_Q2_BITS, MPC8_Q2_SIZE,
-                 &mpc8_q2_bits[i],  1, 1,
-                 &mpc8_q2_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-
-        quant_vlc[0][i].table = &codes_table[vlc_offsets[4+i]];
-        quant_vlc[0][i].table_allocated = vlc_offsets[5+i] - vlc_offsets[4+i];
-        init_vlc(&quant_vlc[0][i], MPC8_Q5_BITS, MPC8_Q5_SIZE,
-                 &mpc8_q5_bits[i],  1, 1,
-                 &mpc8_q5_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-        quant_vlc[1][i].table = &codes_table[vlc_offsets[6+i]];
-        quant_vlc[1][i].table_allocated = vlc_offsets[7+i] - vlc_offsets[6+i];
-        init_vlc(&quant_vlc[1][i], MPC8_Q6_BITS, MPC8_Q6_SIZE,
-                 &mpc8_q6_bits[i],  1, 1,
-                 &mpc8_q6_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-        quant_vlc[2][i].table = &codes_table[vlc_offsets[8+i]];
-        quant_vlc[2][i].table_allocated = vlc_offsets[9+i] - vlc_offsets[8+i];
-        init_vlc(&quant_vlc[2][i], MPC8_Q7_BITS, MPC8_Q7_SIZE,
-                 &mpc8_q7_bits[i],  1, 1,
-                 &mpc8_q7_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-        quant_vlc[3][i].table = &codes_table[vlc_offsets[10+i]];
-        quant_vlc[3][i].table_allocated = vlc_offsets[11+i] - vlc_offsets[10+i];
-        init_vlc(&quant_vlc[3][i], MPC8_Q8_BITS, MPC8_Q8_SIZE,
-                 &mpc8_q8_bits[i],  1, 1,
-                 &mpc8_q8_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-    }
-    vlc_initialized = 1;
-    return 0;
-}
-
-static int mpc8_decode_frame(AVCodecContext * avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MPCContext *c = avctx->priv_data;
-    GetBitContext gb2, *gb = &gb2;
-    int i, j, k, ch, cnt, res, t;
-    Band *bands = c->bands;
-    int off;
-    int maxband, keyframe;
-    int last[2];
-
-    keyframe = c->cur_frame == 0;
-
-    if(keyframe){
-        memset(c->Q, 0, sizeof(c->Q));
-        c->last_bits_used = 0;
-    }
-    init_get_bits(gb, buf, buf_size * 8);
-    skip_bits(gb, c->last_bits_used & 7);
-
-    if(keyframe)
-        maxband = mpc8_get_mod_golomb(gb, c->maxbands + 1);
-    else{
-        maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2);
-        if(maxband > 32) maxband -= 33;
-    }
-    c->last_max_band = maxband;
-
-    /* read subband indexes */
-    if(maxband){
-        last[0] = last[1] = 0;
-        for(i = maxband - 1; i >= 0; i--){
-            for(ch = 0; ch < 2; ch++){
-                last[ch] = get_vlc2(gb, res_vlc[last[ch] > 2].table, MPC8_RES_BITS, 2) + last[ch];
-                if(last[ch] > 15) last[ch] -= 17;
-                bands[i].res[ch] = last[ch];
-            }
-        }
-        if(c->MSS){
-            int mask;
-
-            cnt = 0;
-            for(i = 0; i < maxband; i++)
-                if(bands[i].res[0] || bands[i].res[1])
-                    cnt++;
-            t = mpc8_get_mod_golomb(gb, cnt);
-            mask = mpc8_get_mask(gb, cnt, t);
-            for(i = maxband - 1; i >= 0; i--)
-                if(bands[i].res[0] || bands[i].res[1]){
-                    bands[i].msf = mask & 1;
-                    mask >>= 1;
-                }
-        }
-    }
-    for(i = maxband; i < c->maxbands; i++)
-        bands[i].res[0] = bands[i].res[1] = 0;
-
-    if(keyframe){
-        for(i = 0; i < 32; i++)
-            c->oldDSCF[0][i] = c->oldDSCF[1][i] = 1;
-    }
-
-    for(i = 0; i < maxband; i++){
-        if(bands[i].res[0] || bands[i].res[1]){
-            cnt = !!bands[i].res[0] + !!bands[i].res[1] - 1;
-            if(cnt >= 0){
-                t = get_vlc2(gb, scfi_vlc[cnt].table, scfi_vlc[cnt].bits, 1);
-                if(bands[i].res[0]) bands[i].scfi[0] = t >> (2 * cnt);
-                if(bands[i].res[1]) bands[i].scfi[1] = t & 3;
-            }
-        }
-    }
-
-    for(i = 0; i < maxband; i++){
-        for(ch = 0; ch < 2; ch++){
-            if(!bands[i].res[ch]) continue;
-
-            if(c->oldDSCF[ch][i]){
-                bands[i].scf_idx[ch][0] = get_bits(gb, 7) - 6;
-                c->oldDSCF[ch][i] = 0;
-            }else{
-                t = get_vlc2(gb, dscf_vlc[1].table, MPC8_DSCF1_BITS, 2);
-                if(t == 64)
-                    t += get_bits(gb, 6);
-                bands[i].scf_idx[ch][0] = ((bands[i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;
-            }
-            for(j = 0; j < 2; j++){
-                if((bands[i].scfi[ch] << j) & 2)
-                    bands[i].scf_idx[ch][j + 1] = bands[i].scf_idx[ch][j];
-                else{
-                    t = get_vlc2(gb, dscf_vlc[0].table, MPC8_DSCF0_BITS, 2);
-                    if(t == 31)
-                        t = 64 + get_bits(gb, 6);
-                    bands[i].scf_idx[ch][j + 1] = ((bands[i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;
-                }
-            }
-        }
-    }
-
-    for(i = 0, off = 0; i < maxband; i++, off += SAMPLES_PER_BAND){
-        for(ch = 0; ch < 2; ch++){
-            res = bands[i].res[ch];
-            switch(res){
-            case -1:
-                for(j = 0; j < SAMPLES_PER_BAND; j++)
-                    c->Q[ch][off + j] = (av_lfg_get(&c->rnd) & 0x3FC) - 510;
-                break;
-            case 0:
-                break;
-            case 1:
-                for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){
-                    cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);
-                    t = mpc8_get_mask(gb, 18, cnt);
-                    for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)
-                        c->Q[ch][off + j + k] = (t & 0x20000) ? (get_bits1(gb) << 1) - 1 : 0;
-                }
-                break;
-            case 2:
-                cnt = 6;//2*mpc8_thres[res]
-                for(j = 0; j < SAMPLES_PER_BAND; j += 3){
-                    t = get_vlc2(gb, q2_vlc[cnt > 3].table, MPC8_Q2_BITS, 2);
-                    c->Q[ch][off + j + 0] = mpc8_idx50[t];
-                    c->Q[ch][off + j + 1] = mpc8_idx51[t];
-                    c->Q[ch][off + j + 2] = mpc8_idx52[t];
-                    cnt = (cnt >> 1) + mpc8_huffq2[t];
-                }
-                break;
-            case 3:
-            case 4:
-                for(j = 0; j < SAMPLES_PER_BAND; j += 2){
-                    t = get_vlc2(gb, q3_vlc[res - 3].table, MPC8_Q3_BITS, 2) + q3_offsets[res - 3];
-                    c->Q[ch][off + j + 1] = t >> 4;
-                    c->Q[ch][off + j + 0] = (t & 8) ? (t & 0xF) - 16 : (t & 0xF);
-                }
-                break;
-            case 5:
-            case 6:
-            case 7:
-            case 8:
-                cnt = 2 * mpc8_thres[res];
-                for(j = 0; j < SAMPLES_PER_BAND; j++){
-                    t = get_vlc2(gb, quant_vlc[res - 5][cnt > mpc8_thres[res]].table, quant_vlc[res - 5][cnt > mpc8_thres[res]].bits, 2) + quant_offsets[res - 5];
-                    c->Q[ch][off + j] = t;
-                    cnt = (cnt >> 1) + FFABS(c->Q[ch][off + j]);
-                }
-                break;
-            default:
-                for(j = 0; j < SAMPLES_PER_BAND; j++){
-                    c->Q[ch][off + j] = get_vlc2(gb, q9up_vlc.table, MPC8_Q9UP_BITS, 2);
-                    if(res != 9){
-                        c->Q[ch][off + j] <<= res - 9;
-                        c->Q[ch][off + j] |= get_bits(gb, res - 9);
-                    }
-                    c->Q[ch][off + j] -= (1 << (res - 2)) - 1;
-                }
-            }
-        }
-    }
-
-    ff_mpc_dequantize_and_synth(c, maxband, data);
-
-    c->cur_frame++;
-
-    c->last_bits_used = get_bits_count(gb);
-    if(c->cur_frame >= c->frames)
-        c->cur_frame = 0;
-    *data_size =  MPC_FRAME_SIZE * 4;
-
-    return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
-}
-
-AVCodec mpc8_decoder = {
-    "mpc8",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MUSEPACK8,
-    sizeof(MPCContext),
-    mpc8_decode_init,
-    NULL,
-    NULL,
-    mpc8_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"),
-};
diff --git a/libavcodec/mpc8data.h b/libavcodec/mpc8data.h
deleted file mode 100644
index 22c2be4..0000000
--- a/libavcodec/mpc8data.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Musepack SV8 decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPC8DATA_H
-#define AVCODEC_MPC8DATA_H
-
-#include <stdint.h>
-
-static const int8_t mpc8_idx50[125] = {
-    -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,
-    -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,
-    -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,
-    -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,
-    -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 const int8_t mpc8_idx51[125] = {
-    -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,
-    -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,
-    -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,
-    -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,
-    -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
-};
-static const int8_t mpc8_idx52[125] = {
-    -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
-};
-
-static const unsigned int mpc8_thres[] = {0, 0, 3, 0, 0, 1, 3, 4, 8};
-static const int8_t mpc8_huffq2[5*5*5] = {
-    6, 5, 4, 5, 6, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5, 6, 5, 4, 5,
-    6, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3,
-    4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 4, 3,
-    2, 3, 4, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 3, 2, 1, 2, 3, 4, 3, 2, 3, 4, 5,
-    4, 3, 4, 5, 6, 5, 4, 5, 6, 5, 4, 3, 4, 5, 4, 3, 2, 3, 4, 5, 4, 3, 4, 5,
-    6, 5, 4, 5, 6
-};
-
-
-static const uint32_t mpc8_cnk[16][32] =
-{
-    {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},
-    {0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465},
-    {0, 0, 0, 1, 4, 10, 20, 35, 56, 84, 120, 165, 220, 286, 364, 455, 560, 680, 816, 969, 1140, 1330, 1540, 1771, 2024, 2300, 2600, 2925, 3276, 3654, 4060, 4495},
-    {0, 0, 0, 0, 1, 5, 15, 35, 70, 126, 210, 330, 495, 715, 1001, 1365, 1820, 2380, 3060, 3876, 4845, 5985, 7315, 8855, 10626, 12650, 14950, 17550, 20475, 23751, 27405, 31465},
-    {0, 0, 0, 0, 0, 1, 6, 21, 56, 126, 252, 462, 792, 1287, 2002, 3003, 4368, 6188, 8568, 11628, 15504, 20349, 26334, 33649, 42504, 53130, 65780, 80730, 98280, 118755, 142506, 169911},
-    {0, 0, 0, 0, 0, 0, 1, 7, 28, 84, 210, 462, 924, 1716, 3003, 5005, 8008, 12376, 18564, 27132, 38760, 54264, 74613, 100947, 134596, 177100, 230230, 296010, 376740, 475020, 593775, 736281},
-    {0, 0, 0, 0, 0, 0, 0, 1, 8, 36, 120, 330, 792, 1716, 3432, 6435, 11440, 19448, 31824, 50388, 77520, 116280, 170544, 245157, 346104, 480700, 657800, 888030, 1184040, 1560780, 2035800, 2629575},
-    {0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 45, 165, 495, 1287, 3003, 6435, 12870, 24310, 43758, 75582, 125970, 203490, 319770, 490314, 735471, 1081575, 1562275, 2220075, 3108105, 4292145, 5852925, 7888725},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10, 55, 220, 715, 2002, 5005, 11440, 24310, 48620, 92378, 167960, 293930, 497420, 817190, 1307504, 2042975, 3124550, 4686825, 6906900, 10015005, 14307150, 20160075},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 66, 286, 1001, 3003, 8008, 19448, 43758, 92378, 184756, 352716, 646646, 1144066, 1961256, 3268760, 5311735, 8436285, 13123110, 20030010, 30045015, 44352165},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 12, 78, 364, 1365, 4368, 12376, 31824, 75582, 167960, 352716, 705432, 1352078, 2496144, 4457400, 7726160, 13037895, 21474180, 34597290, 54627300, 84672315},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 13, 91, 455, 1820, 6188, 18564, 50388, 125970, 293930, 646646, 1352078, 2704156, 5200300, 9657700, 17383860, 30421755, 51895935, 86493225, 141120525},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 14, 105, 560, 2380, 8568, 27132, 77520, 203490, 497420, 1144066, 2496144, 5200300, 10400600, 20058300, 37442160, 67863915, 119759850, 206253075},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 15, 120, 680, 3060, 11628, 38760, 116280, 319770, 817190, 1961256, 4457400, 9657700, 20058300, 40116600, 77558760, 145422675, 265182525},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 16, 136, 816, 3876, 15504, 54264, 170544, 490314, 1307504, 3268760, 7726160, 17383860, 37442160, 77558760, 155117520, 300540195},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 17, 153, 969, 4845, 20349, 74613, 245157, 735471, 2042975, 5311735, 13037895, 30421755, 67863915, 145422675, 300540195}
-};
-
-static const uint8_t mpc8_cnk_len[16][33] =
-{
-    {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6},
-    {0, 0, 2, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0},
-    {0, 0, 0, 2, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 0},
-    {0, 0, 0, 0, 3, 4, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 0},
-    {0, 0, 0, 0, 0, 3, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 0},
-    {0, 0, 0, 0, 0, 0, 3, 5, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 0},
-    {0, 0, 0, 0, 0, 0, 0, 3, 6, 7, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 21, 22, 22, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 8, 9, 11, 12, 13, 14, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 22, 23, 23, 23, 24, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 25, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 9, 10, 12, 13, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 24, 25, 25, 26, 26, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 9, 11, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 23, 24, 25, 26, 26, 27, 27, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 9, 11, 13, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 28, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 10, 12, 14, 15, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 27, 28, 29, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 7, 10, 12, 14, 16, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 28, 29, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 10, 12, 14, 16, 18, 19, 21, 22, 23, 25, 26, 27, 28, 29, 30, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 10, 13, 15, 17, 18, 20, 21, 23, 24, 25, 27, 28, 29, 30, 0}
-
-};
-
-static const uint32_t mpc8_cnk_lost[16][33] =
-{
-    {0, 0, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31},
-    {0, 0, 1, 2, 6, 1, 11, 4, 28, 19, 9, 62, 50, 37, 23, 8, 120, 103, 85, 66, 46, 25, 3, 236, 212, 187, 161, 134, 106, 77, 47, 16, 0},
-    {0, 0, 0, 0, 6, 12, 29, 8, 44, 8, 91, 36, 226, 148, 57, 464, 344, 208, 55, 908, 718, 508, 277, 24, 1796, 1496, 1171, 820, 442, 36, 3697, 3232, 0},
-    {0, 0, 0, 0, 3, 1, 29, 58, 2, 46, 182, 17, 309, 23, 683, 228, 1716, 1036, 220, 3347, 2207, 877, 7529, 5758, 3734, 1434, 15218, 12293, 9017, 5363, 1303, 29576, 0},
-    {0, 0, 0, 0, 0, 2, 11, 8, 2, 4, 50, 232, 761, 46, 1093, 3824, 2004, 7816, 4756, 880, 12419, 6434, 31887, 23032, 12406, 65292, 50342, 32792, 12317, 119638, 92233, 60768, 0},
-    {0, 0, 0, 0, 0, 0, 1, 4, 44, 46, 50, 100, 332, 1093, 3187, 184, 4008, 14204, 5636, 26776, 11272, 56459, 30125, 127548, 85044, 31914, 228278, 147548, 49268, 454801, 312295, 142384, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 28, 8, 182, 232, 332, 664, 1757, 4944, 13320, 944, 15148, 53552, 14792, 91600, 16987, 178184, 43588, 390776, 160546, 913112, 536372, 61352, 1564729, 828448, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 7, 19, 91, 17, 761, 1093, 1757, 3514, 8458, 21778, 55490, 5102, 58654, 204518, 33974, 313105, 1015577, 534877, 1974229, 1086199, 4096463, 2535683, 499883, 6258916, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 9, 36, 309, 46, 3187, 4944, 8458, 16916, 38694, 94184, 230358, 26868, 231386, 789648, 54177, 1069754, 3701783, 1481708, 6762211, 2470066, 13394357, 5505632, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 62, 226, 23, 1093, 184, 13320, 21778, 38694, 77388, 171572, 401930, 953086, 135896, 925544, 3076873, 8340931, 3654106, 13524422, 3509417, 22756699, 2596624, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 50, 148, 683, 3824, 4008, 944, 55490, 94184, 171572, 343144, 745074, 1698160, 3931208, 662448, 3739321, 12080252, 32511574, 12481564, 49545413, 5193248, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 37, 57, 228, 2004, 14204, 15148, 5102, 230358, 401930, 745074, 1490148, 3188308, 7119516, 16170572, 3132677, 15212929, 47724503, 127314931, 42642616, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 23, 464, 1716, 7816, 5636, 53552, 58654, 26868, 953086, 1698160, 3188308, 6376616, 13496132, 29666704, 66353813, 14457878, 62182381, 189497312, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 344, 1036, 4756, 26776, 14792, 204518, 231386, 135896, 3931208, 7119516, 13496132, 26992264, 56658968, 123012781, 3252931, 65435312, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 208, 220, 880, 11272, 91600, 33974, 789648, 925544, 662448, 16170572, 29666704, 56658968, 113317936, 236330717, 508019104, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 103, 55, 3347, 12419, 56459, 16987, 313105, 54177, 3076873, 3739321, 3132677, 66353813, 123012781, 236330717, 0}
-};
-
-#endif /* AVCODEC_MPC8DATA_H */
diff --git a/libavcodec/mpc8huff.h b/libavcodec/mpc8huff.h
deleted file mode 100644
index 8491037..0000000
--- a/libavcodec/mpc8huff.h
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * Musepack SV8 decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPC8HUFF_H
-#define AVCODEC_MPC8HUFF_H
-
-#include <stdint.h>
-
-#define MPC8_BANDS_SIZE 33
-#define MPC8_BANDS_BITS 9
-
-static const uint8_t mpc8_bands_codes[MPC8_BANDS_SIZE] = {
- 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04,
- 0x05, 0x06, 0x01, 0x02, 0x03, 0x00, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x01, 0x09, 0x0A, 0x0B, 0x07,
- 0x08, 0x09, 0x06, 0x07, 0x05, 0x05, 0x03, 0x03,
- 0x01,
-};
-static const int8_t mpc8_bands_bits[MPC8_BANDS_SIZE] = {
-  1,  3,  5,  6,  7,  8,  8,  9,
- 10, 11, 12, 12, 12, 13, 12, 12,
- 12, 12, 12, 13, 12, 12, 12, 11,
- 11, 11, 10, 10,  9,  8,  6,  5,
-  2,
-};
-
-#define MPC8_SCFI0_SIZE 4
-#define MPC8_SCFI0_BITS 3
-
-static const uint8_t mpc8_scfi0_codes[MPC8_SCFI0_SIZE] = {
- 0x00, 0x01, 0x01, 0x01,
-};
-static const int8_t mpc8_scfi0_bits[MPC8_SCFI0_SIZE] = {
-  3,  3,  1,  2,
-};
-
-#define MPC8_SCFI1_SIZE 16
-#define MPC8_SCFI1_BITS 7
-
-static const uint8_t mpc8_scfi1_codes[MPC8_SCFI1_SIZE] = {
- 0x01, 0x00, 0x02, 0x03, 0x01, 0x03, 0x04, 0x05,
- 0x04, 0x06, 0x02, 0x02, 0x05, 0x07, 0x03, 0x03,
-
-};
-static const int8_t mpc8_scfi1_bits[MPC8_SCFI1_SIZE] = {
-  6,  7,  6,  6,  7,  5,  5,  5,
-  6,  5,  2,  3,  6,  5,  3,  2,
-
-};
-
-#define MPC8_DSCF0_SIZE 64
-#define MPC8_DSCF0_BITS 9
-
-static const uint8_t mpc8_dscf0_codes[MPC8_DSCF0_SIZE] = {
- 0x03, 0x04, 0x05, 0x04, 0x05, 0x06, 0x05, 0x06,
- 0x07, 0x08, 0x09, 0x07, 0x08, 0x09, 0x0A, 0x07,
- 0x08, 0x09, 0x0A, 0x07, 0x08, 0x09, 0x0A, 0x06,
- 0x07, 0x05, 0x04, 0x05, 0x06, 0x06, 0x07, 0x0A,
- 0x08, 0x05, 0x06, 0x07, 0x09, 0x07, 0x08, 0x09,
- 0x0B, 0x0B, 0x0C, 0x0D, 0x0B, 0x0C, 0x0D, 0x0B,
- 0x0C, 0x0D, 0x07, 0x08, 0x09, 0x06, 0x07, 0x03,
- 0x04, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
-};
-static const int8_t mpc8_dscf0_bits[MPC8_DSCF0_SIZE] = {
- 12, 12, 12, 11, 11, 11, 10, 10,
- 10, 10, 10,  9,  9,  9,  9,  8,
-  8,  8,  8,  7,  7,  7,  7,  6,
-  6,  5,  4,  4,  5,  4,  4, 10,
-  4,  3,  3,  3,  4,  5,  6,  6,
-  7,  8,  8,  8,  9,  9,  9, 10,
- 10, 10, 11, 11, 11, 12, 12, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
-
-};
-
-#define MPC8_DSCF1_SIZE 65
-#define MPC8_DSCF1_BITS 9
-
-static const uint8_t mpc8_dscf1_codes[MPC8_DSCF1_SIZE] = {
- 0x00, 0x03, 0x04, 0x04, 0x05, 0x06, 0x05, 0x06,
- 0x07, 0x08, 0x07, 0x08, 0x09, 0x0A, 0x07, 0x08,
- 0x09, 0x0A, 0x07, 0x08, 0x09, 0x06, 0x07, 0x05,
- 0x06, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x05, 0x04, 0x05, 0x05, 0x07, 0x08,
- 0x09, 0x0A, 0x0B, 0x0B, 0x0C, 0x0D, 0x0B, 0x0C,
- 0x0D, 0x09, 0x0A, 0x0B, 0x0C, 0x07, 0x08, 0x09,
- 0x05, 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05,
- 0x0D,
-};
-static const int8_t mpc8_dscf1_bits[MPC8_DSCF1_SIZE] = {
- 15, 14, 14, 13, 13, 13, 12, 12,
- 12, 12, 11, 11, 11, 11, 10, 10,
- 10, 10,  9,  9,  9,  8,  8,  7,
-  7,  6,  5,  4,  4,  3,  3,  3,
-  3,  3,  4,  5,  5,  6,  7,  8,
-  8,  9,  9, 10, 10, 10, 11, 11,
- 11, 12, 12, 12, 12, 13, 13, 13,
- 14, 14, 14, 15, 15, 15, 15, 15,
- 12,
-};
-
-#define MPC8_RES_SIZE 17
-#define MPC8_RES_BITS 9
-
-static const uint8_t mpc8_res_codes[2][MPC8_RES_SIZE] = {
-  {
-    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-    0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01,
-    0x01,
-  },
-  {
-    0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-    0x00, 0x01, 0x02, 0x03, 0x01, 0x01, 0x01, 0x01,
-    0x03,
-  }
-};
-static const int8_t mpc8_res_bits[2][MPC8_RES_SIZE] = {
-  {
-     1,  2,  4,  5,  6,  7,  9, 10,
-    11, 12, 13, 14, 15, 16, 16,  8,
-     3,
-  },
-  {
-     2,  2,  3,  5,  7,  8, 10, 12,
-    14, 14, 14, 14, 11,  9,  6,  4,
-     2,
-  }
-};
-
-#define MPC8_Q1_SIZE 19
-#define MPC8_Q1_BITS 9
-
-static const uint8_t mpc8_q1_codes[MPC8_Q1_SIZE] = {
- 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x03, 0x04, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x00, 0x01,
-};
-static const int8_t mpc8_q1_bits[MPC8_Q1_SIZE] = {
-  6,  4,  4,  3,  3,  3,  3,  3,
-  4,  4,  4,  5,  7,  8,  9, 10,
- 11, 12, 12,
-};
-
-#define MPC8_Q9UP_SIZE 256
-#define MPC8_Q9UP_BITS 9
-
-static const uint8_t mpc8_q9up_codes[MPC8_Q9UP_SIZE] = {
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x26, 0x27, 0x13, 0x14, 0x15,
- 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D,
- 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
- 0x28, 0x26, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,
- 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
- 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
- 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
- 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E,
- 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
- 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E,
- 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
- 0x67, 0x68, 0x69, 0x6A, 0x56, 0x57, 0x58, 0x59,
- 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61,
- 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x3E,
- 0x3F, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
- 0x78, 0x79, 0x7A, 0x6B, 0x7B, 0x6C, 0x6D, 0x6E,
- 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76,
- 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E,
- 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86,
- 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E,
- 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E,
- 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
- 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x27, 0x28, 0x29,
- 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31,
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41,
- 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4A, 0x4B, 0x06, 0x07, 0x08, 0x09, 0x00, 0x01,
-};
-static const int8_t mpc8_q9up_bits[MPC8_Q9UP_SIZE] = {
- 10, 10, 10, 10, 10,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  8,  9,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  6,
-  6,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  8,  7,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9, 10, 10, 10, 10, 11, 11,
-};
-
-#define MPC8_Q2_SIZE 125
-#define MPC8_Q2_BITS 9
-
-static const uint8_t mpc8_q2_codes[2][MPC8_Q2_SIZE] = {
-{
- 0x02, 0x03, 0x0F, 0x04, 0x00, 0x05, 0x0C, 0x12,
- 0x0D, 0x06, 0x07, 0x13, 0x15, 0x14, 0x08, 0x09,
- 0x0E, 0x15, 0x0F, 0x0A, 0x03, 0x0B, 0x10, 0x0C,
- 0x01, 0x0D, 0x10, 0x16, 0x11, 0x0E, 0x12, 0x0F,
- 0x10, 0x16, 0x13, 0x17, 0x11, 0x08, 0x12, 0x18,
- 0x14, 0x13, 0x14, 0x17, 0x15, 0x0F, 0x16, 0x19,
- 0x17, 0x10, 0x11, 0x1A, 0x18, 0x1B, 0x12, 0x1C,
- 0x15, 0x09, 0x16, 0x1D, 0x19, 0x0A, 0x07, 0x0B,
- 0x1A, 0x1E, 0x17, 0x0C, 0x18, 0x1F, 0x13, 0x20,
- 0x1B, 0x21, 0x14, 0x11, 0x18, 0x22, 0x19, 0x12,
- 0x1A, 0x19, 0x1A, 0x1B, 0x1B, 0x23, 0x1C, 0x0D,
- 0x1D, 0x24, 0x1C, 0x1C, 0x1E, 0x1F, 0x1D, 0x13,
- 0x1E, 0x25, 0x1F, 0x14, 0x02, 0x15, 0x15, 0x16,
- 0x04, 0x17, 0x20, 0x26, 0x21, 0x18, 0x16, 0x27,
- 0x1D, 0x28, 0x19, 0x1A, 0x22, 0x29, 0x23, 0x1B,
- 0x03, 0x1C, 0x17, 0x1D, 0x05,
-},
-{
- 0x02, 0x03, 0x0F, 0x04, 0x00, 0x05, 0x0C, 0x0D,
- 0x0E, 0x06, 0x07, 0x0F, 0x1E, 0x10, 0x10, 0x08,
- 0x11, 0x12, 0x13, 0x09, 0x03, 0x0A, 0x11, 0x0B,
- 0x01, 0x0C, 0x14, 0x15, 0x16, 0x0D, 0x17, 0x12,
- 0x0E, 0x13, 0x18, 0x19, 0x14, 0x0F, 0x10, 0x1A,
- 0x1B, 0x15, 0x11, 0x16, 0x1C, 0x0E, 0x1D, 0x1E,
- 0x1F, 0x0F, 0x12, 0x20, 0x1F, 0x21, 0x13, 0x22,
- 0x12, 0x13, 0x14, 0x23, 0x20, 0x15, 0x0F, 0x16,
- 0x21, 0x24, 0x17, 0x18, 0x19, 0x25, 0x14, 0x26,
- 0x22, 0x27, 0x15, 0x10, 0x28, 0x29, 0x2A, 0x11,
- 0x2B, 0x17, 0x1A, 0x18, 0x2C, 0x2D, 0x1B, 0x1C,
- 0x19, 0x2E, 0x2F, 0x1A, 0x1D, 0x1B, 0x30, 0x12,
- 0x31, 0x32, 0x33, 0x13, 0x02, 0x14, 0x15, 0x16,
- 0x04, 0x17, 0x34, 0x35, 0x36, 0x18, 0x16, 0x37,
- 0x23, 0x38, 0x19, 0x1A, 0x39, 0x3A, 0x3B, 0x1B,
- 0x03, 0x1C, 0x17, 0x1D, 0x05,
-}
-};
-static const int8_t mpc8_q2_bits[2][MPC8_Q2_SIZE] = {
-{
- 12, 11, 10, 11, 13, 11,  9,  8,
-  9, 11, 11,  8,  7,  8, 11, 11,
-  9,  8,  9, 11, 12, 11, 10, 11,
- 13, 11,  9,  8,  9, 11,  9,  6,
-  6,  7,  9,  8,  6,  4,  6,  8,
-  9,  6,  6,  7,  9, 11,  9,  8,
-  9, 11, 10,  8,  7,  8, 10,  8,
-  6,  4,  6,  8,  7,  4,  3,  4,
-  7,  8,  6,  4,  6,  8, 10,  8,
-  7,  8, 10, 11,  9,  8,  9, 11,
-  9,  6,  6,  6,  9,  8,  6,  4,
-  6,  8,  9,  7,  6,  6,  9, 11,
-  9,  8,  9, 11, 13, 11, 10, 11,
- 12, 11,  9,  8,  9, 11, 10,  8,
-  7,  8, 11, 11,  9,  8,  9, 11,
- 13, 11, 10, 11, 12,
-},
-{
- 11, 10,  9, 10, 12, 10,  8,  8,
-  8, 10, 10,  8,  7,  8,  9, 10,
-  8,  8,  8, 10, 11, 10,  9, 10,
- 12, 10,  8,  8,  8, 10,  8,  6,
-  5,  6,  8,  8,  6,  5,  5,  8,
-  8,  6,  5,  6,  8, 10,  8,  8,
-  8, 10,  9,  8,  7,  8,  9,  8,
-  5,  5,  5,  8,  7,  5,  4,  5,
-  7,  8,  5,  5,  5,  8,  9,  8,
-  7,  8,  9, 10,  8,  8,  8, 10,
-  8,  6,  5,  6,  8,  8,  5,  5,
-  6,  8,  8,  6,  5,  6,  8, 10,
-  8,  8,  8, 10, 12, 10, 10, 10,
- 11, 10,  8,  8,  8, 10,  9,  8,
-  7,  8, 10, 10,  8,  8,  8, 10,
- 12, 10,  9, 10, 11,
-}
-};
-
-#define MPC8_Q3_SIZE 49
-#define MPC8_Q3_BITS 9
-#define MPC8_Q3_OFFSET -48
-
-static const uint8_t mpc8_q3_codes[MPC8_Q3_SIZE] = {
- 0x07, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x0F,
- 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x13, 0x12, 0x11,
- 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09,
- 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x09, 0x08, 0x07,
- 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x01,
- 0x00,
-};
-static const int8_t mpc8_q3_bits[MPC8_Q3_SIZE] = {
-  3,  4,  4,  4,  4,  4,  4,  5,
-  5,  5,  5,  5,  5,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  8,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,
-};
-static const int8_t mpc8_q3_syms[MPC8_Q3_SIZE] = {
-   48,    65,    64,    49,    63,    32,    47,    80,
-   79,    50,    62,    33,    16,    82,    81,    95,
-   94,    66,    78,    34,    46,    17,    31,    30,
-   97,    96,   111,    67,    77,    51,    61,    35,
-   45,    18,     1,     0,    15,    98,   110,    83,
-   93,    19,    29,     2,    14,    99,   109,     3,
-   13,
-};
-
-#define MPC8_Q4_SIZE 81
-#define MPC8_Q4_BITS 9
-#define MPC8_Q4_OFFSET -64
-
-static const uint8_t mpc8_q4_codes[MPC8_Q4_SIZE] = {
- 0x0F, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x17,
- 0x16, 0x15, 0x14, 0x13, 0x12, 0x23, 0x22, 0x21,
- 0x20, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19,
- 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11,
- 0x10, 0x0F, 0x0E, 0x0D, 0x19, 0x18, 0x17, 0x16,
- 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0F, 0x0E,
- 0x0D, 0x0C, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12,
- 0x11, 0x10, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
- 0x09, 0x08, 0x07, 0x06, 0x05, 0x09, 0x08, 0x07,
- 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x02, 0x01,
- 0x00,
-};
-static const int8_t mpc8_q4_bits[MPC8_Q4_SIZE] = {
-  4,  5,  5,  5,  5,  5,  5,  5,
-  5,  5,  5,  5,  5,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9, 10, 10, 10,
- 10,
-};
-static const int8_t mpc8_q4_syms[MPC8_Q4_SIZE] = {
-   64,    96,    81,    80,    95,    66,    65,    79,
-   78,    49,    48,    63,    32,   113,   112,    98,
-   97,   111,   110,    83,    82,    94,    93,    67,
-   77,    51,    50,    62,    61,    34,    33,    47,
-   46,    17,    16,    31,   128,   114,   127,   126,
-   99,   109,    68,    76,    35,    45,    18,    30,
-    0,    15,   130,   129,   143,   142,   115,   125,
-  100,   108,    84,    92,    52,    60,    36,    44,
-   19,    29,     2,     1,    14,   131,   141,   116,
-  124,    20,    28,     3,    13,   132,   140,     4,
-   12,
-};
-
-#define MPC8_Q5_SIZE 15
-#define MPC8_Q5_BITS 7
-#define MPC8_Q5_OFFSET -7
-
-static const uint8_t mpc8_q5_codes[2][MPC8_Q5_SIZE] = {
-{
- 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03,
- 0x04, 0x05, 0x03, 0x03, 0x03, 0x02, 0x03,
-},
-{
- 0x00, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x04, 0x05, 0x03, 0x02, 0x03,
-}
-};
-static const int8_t mpc8_q5_bits[2][MPC8_Q5_SIZE] = {
-{
-  7,  7,  6,  5,  4,  3,  3,  2,
-  3,  3,  4,  5,  6,  7,  7,
-},
-{
-  6,  6,  5,  4,  4,  3,  3,  3,
-  3,  3,  4,  4,  5,  6,  6,
-}
-};
-
-#define MPC8_Q6_SIZE 31
-#define MPC8_Q6_BITS 9
-#define MPC8_Q6_OFFSET -15
-
-static const uint8_t mpc8_q6_codes[2][MPC8_Q6_SIZE] = {
-{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x04, 0x03,
- 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x04, 0x03,
- 0x05, 0x06, 0x07, 0x07, 0x06, 0x07, 0x08, 0x09,
- 0x05, 0x06, 0x07, 0x04, 0x05, 0x06, 0x07,
-},
-{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x04, 0x05, 0x04,
- 0x05, 0x06, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
- 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x07, 0x08, 0x09,
- 0x06, 0x07, 0x05, 0x06, 0x07, 0x02, 0x03,
-}
-};
-static const int8_t mpc8_q6_bits[2][MPC8_Q6_SIZE] = {
-{
-  9,  9,  9,  9,  8,  8,  7,  6,
-  6,  6,  5,  5,  4,  4,  3,  2,
-  3,  4,  4,  5,  6,  6,  6,  6,
-  7,  8,  8,  9,  9,  9,  9,
-},
-{
-  8,  8,  7,  7,  7,  6,  6,  5,
-  5,  5,  4,  4,  4,  4,  4,  4,
-  4,  4,  4,  4,  4,  5,  5,  5,
-  6,  6,  7,  7,  7,  8,  8,
-}
-};
-
-#define MPC8_Q7_SIZE 63
-#define MPC8_Q7_BITS 9
-#define MPC8_Q7_OFFSET -31
-
-static const uint8_t mpc8_q7_codes[2][MPC8_Q7_SIZE] = {
-{
- 0x00, 0x01, 0x02, 0x08, 0x09, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x0A, 0x0B, 0x0C, 0x0D, 0x0A, 0x0B,
- 0x0C, 0x0D, 0x0E, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
- 0x0A, 0x0B, 0x0C, 0x08, 0x09, 0x06, 0x04, 0x03,
- 0x05, 0x07, 0x0A, 0x0B, 0x0D, 0x0E, 0x0F, 0x0F,
- 0x10, 0x11, 0x12, 0x0F, 0x13, 0x10, 0x11, 0x12,
- 0x13, 0x0E, 0x0F, 0x10, 0x11, 0x08, 0x09, 0x0A,
- 0x0B, 0x0C, 0x12, 0x13, 0x0D, 0x0E, 0x0F,
-},
-{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x09, 0x0A,
- 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x0C, 0x0D,
- 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
- 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D,
- 0x1E, 0x1F, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
- 0x17, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x09, 0x0A,
- 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x02, 0x03,
-}
-};
-static const int8_t mpc8_q7_bits[2][MPC8_Q7_SIZE] = {
-{
- 10, 10, 10,  9,  9, 10, 10, 10,
- 10, 10,  9,  9,  9,  9,  8,  8,
-  8,  8,  8,  7,  7,  7,  7,  7,
-  6,  6,  6,  5,  5,  4,  3,  2,
-  3,  4,  5,  5,  6,  6,  6,  7,
-  7,  7,  7,  8,  7,  8,  8,  8,
-  8,  9,  9,  9,  9, 10, 10, 10,
- 10, 10,  9,  9, 10, 10, 10,
-},
-{
-  9,  9,  8,  8,  8,  8,  8,  8,
-  8,  7,  7,  7,  7,  7,  6,  6,
-  6,  6,  6,  6,  6,  6,  5,  5,
-  5,  5,  5,  5,  5,  5,  5,  5,
-  5,  5,  5,  5,  5,  5,  5,  5,
-  5,  5,  6,  6,  6,  6,  6,  6,
-  6,  7,  7,  7,  7,  7,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,
-}
-};
-
-#define MPC8_Q8_SIZE 127
-#define MPC8_Q8_BITS 9
-#define MPC8_Q8_OFFSET -63
-
-static const uint8_t mpc8_q8_codes[2][MPC8_Q8_SIZE] = {
-{
- 0x03, 0x04, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x1A,
- 0x0F, 0x1B, 0x10, 0x00, 0x01, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x11, 0x0C, 0x12, 0x13,
- 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1C, 0x1A,
- 0x1B, 0x1C, 0x1D, 0x1E, 0x1D, 0x1E, 0x1F, 0x20,
- 0x21, 0x22, 0x23, 0x24, 0x19, 0x25, 0x1A, 0x1B,
- 0x1C, 0x1D, 0x1E, 0x1F, 0x14, 0x15, 0x16, 0x17,
- 0x0E, 0x0F, 0x10, 0x11, 0x0B, 0x07, 0x04, 0x03,
- 0x05, 0x0C, 0x0D, 0x12, 0x13, 0x14, 0x15, 0x18,
- 0x19, 0x1A, 0x1B, 0x20, 0x21, 0x22, 0x23, 0x24,
- 0x25, 0x26, 0x27, 0x26, 0x27, 0x28, 0x29, 0x2A,
- 0x2B, 0x2C, 0x2D, 0x2E, 0x1F, 0x20, 0x2F, 0x21,
- 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29,
- 0x0D, 0x0E, 0x2A, 0x0F, 0x10, 0x11, 0x12, 0x02,
- 0x13, 0x03, 0x04, 0x05, 0x2B, 0x2C, 0x30, 0x31,
- 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
-},
-{
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
- 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x15, 0x16,
- 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
- 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
- 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E,
- 0x2F, 0x30, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
- 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B,
- 0x3C, 0x3D, 0x3E, 0x31, 0x3F, 0x32, 0x33, 0x34,
- 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C,
- 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44,
- 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x16,
- 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E,
- 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
- 0x27, 0x28, 0x29, 0x04, 0x05, 0x06, 0x07,
-}
-};
-static const int8_t mpc8_q8_bits[2][MPC8_Q8_SIZE] = {
-{
- 11, 11, 10, 10, 10, 10, 10,  9,
- 10,  9, 10, 12, 12, 11, 11, 11,
- 11, 11, 11, 11, 10, 11, 10, 10,
- 10, 10, 10, 10, 10, 10,  9, 10,
- 10, 10, 10, 10,  9,  9,  9,  9,
-  9,  9,  9,  9,  8,  9,  8,  8,
-  8,  8,  8,  8,  7,  7,  7,  7,
-  6,  6,  6,  6,  5,  4,  3,  2,
-  3,  5,  5,  6,  6,  6,  6,  7,
-  7,  7,  7,  8,  8,  8,  8,  8,
-  8,  8,  8,  9,  9,  9,  9,  9,
-  9,  9,  9,  9, 10, 10,  9, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 11, 11, 10, 11, 11, 11, 11, 12,
- 11, 12, 12, 12, 10, 10,  9,  9,
- 10, 10, 10, 10, 10, 10, 10,
-},
-{
-  9,  9,  9,  9,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  6,  6,  6,  6,  6,
-  6,  6,  6,  7,  6,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  9,  9,  9,  9,
-}
-};
-
-#endif /* AVCODEC_MPC8HUFF_H */
diff --git a/libavcodec/mpcdata.h b/libavcodec/mpcdata.h
deleted file mode 100644
index a2212ec..0000000
--- a/libavcodec/mpcdata.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Musepack decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPCDATA_H
-#define AVCODEC_MPCDATA_H
-
-#include <stdint.h>
-
-static const float mpc_CC[18] = {
-    65536.0000, 21845.3333, 13107.2000, 9362.2857, 7281.7778, 4369.0667, 2114.0645,
-    1040.2539, 516.0315, 257.0039, 128.2505, 64.0626, 32.0156, 16.0039, 8.0010,
-    4.0002, 2.0001, 1.0000
-};
-
-static const float mpc_SCF[128] = {
-    307.330047607421875000, 255.999984741210937500, 213.243041992187500000, 177.627334594726562500,
-    147.960128784179687500, 123.247924804687500000, 102.663139343261718750, 85.516410827636718750,
-    71.233520507812500000, 59.336143493652343750, 49.425861358642578125, 41.170787811279296875,
-    34.294471740722656250, 28.566631317138671875, 23.795452117919921875, 19.821151733398437500,
-    16.510635375976562500, 13.753040313720703125, 11.456016540527343750, 9.542640686035156250,
-    7.948835372924804688, 6.621226310729980469, 5.515353679656982422, 4.594182968139648438,
-    3.826865673065185547, 3.187705039978027344, 2.655296564102172852, 2.211810588836669922,
-    1.842395424842834473, 1.534679770469665527, 1.278358578681945801, 1.064847946166992188,
-    0.886997759342193604, 0.738851964473724365, 0.615449428558349609, 0.512657463550567627,
-    0.427033752202987671, 0.355710864067077637, 0.296300262212753296, 0.246812388300895691,
-    0.205589950084686279, 0.171252459287643433, 0.142649993300437927, 0.118824683129787445,
-    0.098978661000728607, 0.082447312772274017, 0.068677015602588654, 0.057206626981496811,
-    0.047652013599872589, 0.039693206548690796, 0.033063672482967377, 0.027541399002075195,
-    0.022941453382372856, 0.019109787419438362, 0.015918083488941193, 0.013259455561637878,
-    0.011044870130717754, 0.009200163185596466, 0.007663558237254620, 0.006383595988154411,
-    0.005317411851137877, 0.004429301247000694, 0.003689522389322519, 0.003073300700634718,
-    0.002560000168159604, 0.002132430672645569, 0.001776273478753865, 0.001479601487517357,
-    0.001232479466125369, 0.001026631565764546, 0.000855164253152907, 0.000712335284333676,
-    0.000593361502978951, 0.000494258652906865, 0.000411707907915115, 0.000342944724252447,
-    0.000285666319541633, 0.000237954518524930, 0.000198211506358348, 0.000165106350323185,
-    0.000137530398205854, 0.000114560163638089, 0.000095426403277088, 0.000079488345363643,
-    0.000066212254751008, 0.000055153526773211, 0.000045941822463647, 0.000038268648495432,
-    0.000031877043511486, 0.000026552961571724, 0.000022118103515822, 0.000018423952496960,
-    0.000015346795407822, 0.000012783583770215, 0.000010648477655195, 0.000008869976227288,
-    0.000007388518497464, 0.000006154492893984, 0.000005126573796588, 0.000004270336830814,
-    0.000003557107902452, 0.000002963002089018, 0.000002468123511790, 0.000002055899130937,
-    0.000001712524181130, 0.000001426499579793, 0.000001188246528727, 0.000000989786371974,
-    0.000000824472920158, 0.000000686770022185, 0.000000572066142013, 0.000000476520028769,
-    0.000000396931966407, 0.000000330636652279, 0.000000275413924555, 0.000000229414467867,
-    0.000000191097811353, 0.000000159180785886, 0.000000132594522029, 0.000000110448674207,
-    0.000000092001613439, 0.000000076635565449, 0.000000063835940978, 0.000000053174105119,
-    0.000000044293003043, 0.000000036895215771, 0.000000030733001921, 0.000000025599996789
-};
-
-#endif /* AVCODEC_MPCDATA_H */
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
deleted file mode 100644
index bc9ddcc..0000000
--- a/libavcodec/mpeg12.c
+++ /dev/null
@@ -1,2610 +0,0 @@
-/*
- * MPEG-1/2 decoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG-1/2 decoder
- */
-
-//#define DEBUG
-#include "internal.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-
-#include "mpeg12.h"
-#include "mpeg12data.h"
-#include "mpeg12decdata.h"
-#include "bytestream.h"
-#include "vdpau_internal.h"
-#include "xvmc_internal.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-
-#define MV_VLC_BITS 9
-#define MBINCR_VLC_BITS 9
-#define MB_PAT_VLC_BITS 9
-#define MB_PTYPE_VLC_BITS 6
-#define MB_BTYPE_VLC_BITS 6
-
-static inline int mpeg1_decode_block_intra(MpegEncContext *s,
-                              DCTELEM *block,
-                              int n);
-static inline int mpeg1_decode_block_inter(MpegEncContext *s,
-                              DCTELEM *block,
-                              int n);
-static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n);
-static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
-                                        DCTELEM *block,
-                                        int n);
-static inline int mpeg2_decode_block_intra(MpegEncContext *s,
-                                    DCTELEM *block,
-                                    int n);
-static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, DCTELEM *block, int n);
-static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n);
-static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred);
-static void exchange_uv(MpegEncContext *s);
-
-static const enum PixelFormat pixfmt_xvmc_mpg2_420[] = {
-                                           PIX_FMT_XVMC_MPEG2_IDCT,
-                                           PIX_FMT_XVMC_MPEG2_MC,
-                                           PIX_FMT_NONE};
-
-uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-
-#define INIT_2D_VLC_RL(rl, static_size)\
-{\
-    static RL_VLC_ELEM rl_vlc_table[static_size];\
-    INIT_VLC_STATIC(&rl.vlc, TEX_VLC_BITS, rl.n + 2,\
-             &rl.table_vlc[0][1], 4, 2,\
-             &rl.table_vlc[0][0], 4, 2, static_size);\
-\
-    rl.rl_vlc[0]= rl_vlc_table;\
-    init_2d_vlc_rl(&rl);\
-}
-
-static void init_2d_vlc_rl(RLTable *rl)
-{
-    int i;
-
-    for(i=0; i<rl->vlc.table_size; i++){
-        int code= rl->vlc.table[i][0];
-        int len = rl->vlc.table[i][1];
-        int level, run;
-
-        if(len==0){ // illegal code
-            run= 65;
-            level= MAX_LEVEL;
-        }else if(len<0){ //more bits needed
-            run= 0;
-            level= code;
-        }else{
-            if(code==rl->n){ //esc
-                run= 65;
-                level= 0;
-            }else if(code==rl->n+1){ //eob
-                run= 0;
-                level= 127;
-            }else{
-                run=   rl->table_run  [code] + 1;
-                level= rl->table_level[code];
-            }
-        }
-        rl->rl_vlc[0][i].len= len;
-        rl->rl_vlc[0][i].level= level;
-        rl->rl_vlc[0][i].run= run;
-    }
-}
-
-void ff_mpeg12_common_init(MpegEncContext *s)
-{
-
-    s->y_dc_scale_table=
-    s->c_dc_scale_table= ff_mpeg2_dc_scale_table[s->intra_dc_precision];
-
-}
-
-void ff_mpeg1_clean_buffers(MpegEncContext *s){
-    s->last_dc[0] = 1 << (7 + s->intra_dc_precision);
-    s->last_dc[1] = s->last_dc[0];
-    s->last_dc[2] = s->last_dc[0];
-    memset(s->last_mv, 0, sizeof(s->last_mv));
-}
-
-
-/******************************************/
-/* decoding */
-
-static VLC mv_vlc;
-static VLC mbincr_vlc;
-static VLC mb_ptype_vlc;
-static VLC mb_btype_vlc;
-static VLC mb_pat_vlc;
-
-av_cold void ff_mpeg12_init_vlcs(void)
-{
-    static int done = 0;
-
-    if (!done) {
-        done = 1;
-
-        INIT_VLC_STATIC(&dc_lum_vlc, DC_VLC_BITS, 12,
-                 ff_mpeg12_vlc_dc_lum_bits, 1, 1,
-                 ff_mpeg12_vlc_dc_lum_code, 2, 2, 512);
-        INIT_VLC_STATIC(&dc_chroma_vlc,  DC_VLC_BITS, 12,
-                 ff_mpeg12_vlc_dc_chroma_bits, 1, 1,
-                 ff_mpeg12_vlc_dc_chroma_code, 2, 2, 514);
-        INIT_VLC_STATIC(&mv_vlc, MV_VLC_BITS, 17,
-                 &ff_mpeg12_mbMotionVectorTable[0][1], 2, 1,
-                 &ff_mpeg12_mbMotionVectorTable[0][0], 2, 1, 518);
-        INIT_VLC_STATIC(&mbincr_vlc, MBINCR_VLC_BITS, 36,
-                 &ff_mpeg12_mbAddrIncrTable[0][1], 2, 1,
-                 &ff_mpeg12_mbAddrIncrTable[0][0], 2, 1, 538);
-        INIT_VLC_STATIC(&mb_pat_vlc, MB_PAT_VLC_BITS, 64,
-                 &ff_mpeg12_mbPatTable[0][1], 2, 1,
-                 &ff_mpeg12_mbPatTable[0][0], 2, 1, 512);
-
-        INIT_VLC_STATIC(&mb_ptype_vlc, MB_PTYPE_VLC_BITS, 7,
-                 &table_mb_ptype[0][1], 2, 1,
-                 &table_mb_ptype[0][0], 2, 1, 64);
-        INIT_VLC_STATIC(&mb_btype_vlc, MB_BTYPE_VLC_BITS, 11,
-                 &table_mb_btype[0][1], 2, 1,
-                 &table_mb_btype[0][0], 2, 1, 64);
-        init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]);
-        init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]);
-
-        INIT_2D_VLC_RL(ff_rl_mpeg1, 680);
-        INIT_2D_VLC_RL(ff_rl_mpeg2, 674);
-    }
-}
-
-static inline int get_dmv(MpegEncContext *s)
-{
-    if(get_bits1(&s->gb))
-        return 1 - (get_bits1(&s->gb) << 1);
-    else
-        return 0;
-}
-
-static inline int get_qscale(MpegEncContext *s)
-{
-    int qscale = get_bits(&s->gb, 5);
-    if (s->q_scale_type) {
-        return non_linear_qscale[qscale];
-    } else {
-        return qscale << 1;
-    }
-}
-
-/* motion type (for MPEG-2) */
-#define MT_FIELD 1
-#define MT_FRAME 2
-#define MT_16X8  2
-#define MT_DMV   3
-
-static int mpeg_decode_mb(MpegEncContext *s,
-                          DCTELEM block[12][64])
-{
-    int i, j, k, cbp, val, mb_type, motion_type;
-    const int mb_block_count = 4 + (1<< s->chroma_format);
-
-    dprintf(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
-
-    assert(s->mb_skipped==0);
-
-    if (s->mb_skip_run-- != 0) {
-        if (s->pict_type == FF_P_TYPE) {
-            s->mb_skipped = 1;
-            s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
-        } else {
-            int mb_type;
-
-            if(s->mb_x)
-                mb_type= s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1];
-            else
-                mb_type= s->current_picture.mb_type[ s->mb_width + (s->mb_y-1)*s->mb_stride - 1]; // FIXME not sure if this is allowed in MPEG at all
-            if(IS_INTRA(mb_type))
-                return -1;
-
-            s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]=
-                mb_type | MB_TYPE_SKIP;
-//            assert(s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride - 1]&(MB_TYPE_16x16|MB_TYPE_16x8));
-
-            if((s->mv[0][0][0]|s->mv[0][0][1]|s->mv[1][0][0]|s->mv[1][0][1])==0)
-                s->mb_skipped = 1;
-        }
-
-        return 0;
-    }
-
-    switch(s->pict_type) {
-    default:
-    case FF_I_TYPE:
-        if (get_bits1(&s->gb) == 0) {
-            if (get_bits1(&s->gb) == 0){
-                av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in I Frame at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-            mb_type = MB_TYPE_QUANT | MB_TYPE_INTRA;
-        } else {
-            mb_type = MB_TYPE_INTRA;
-        }
-        break;
-    case FF_P_TYPE:
-        mb_type = get_vlc2(&s->gb, mb_ptype_vlc.table, MB_PTYPE_VLC_BITS, 1);
-        if (mb_type < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in P Frame at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        mb_type = ptype2mb_type[ mb_type ];
-        break;
-    case FF_B_TYPE:
-        mb_type = get_vlc2(&s->gb, mb_btype_vlc.table, MB_BTYPE_VLC_BITS, 1);
-        if (mb_type < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "invalid mb type in B Frame at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        mb_type = btype2mb_type[ mb_type ];
-        break;
-    }
-    dprintf(s->avctx, "mb_type=%x\n", mb_type);
-//    motion_type = 0; /* avoid warning */
-    if (IS_INTRA(mb_type)) {
-        s->dsp.clear_blocks(s->block[0]);
-
-        if(!s->chroma_y_shift){
-            s->dsp.clear_blocks(s->block[6]);
-        }
-
-        /* compute DCT type */
-        if (s->picture_structure == PICT_FRAME && //FIXME add an interlaced_dct coded var?
-            !s->frame_pred_frame_dct) {
-            s->interlaced_dct = get_bits1(&s->gb);
-        }
-
-        if (IS_QUANT(mb_type))
-            s->qscale = get_qscale(s);
-
-        if (s->concealment_motion_vectors) {
-            /* just parse them */
-            if (s->picture_structure != PICT_FRAME)
-                skip_bits1(&s->gb); /* field select */
-
-            s->mv[0][0][0]= s->last_mv[0][0][0]= s->last_mv[0][1][0] =
-                mpeg_decode_motion(s, s->mpeg_f_code[0][0], s->last_mv[0][0][0]);
-            s->mv[0][0][1]= s->last_mv[0][0][1]= s->last_mv[0][1][1] =
-                mpeg_decode_motion(s, s->mpeg_f_code[0][1], s->last_mv[0][0][1]);
-
-            skip_bits1(&s->gb); /* marker */
-        }else
-            memset(s->last_mv, 0, sizeof(s->last_mv)); /* reset mv prediction */
-        s->mb_intra = 1;
-        //if 1, we memcpy blocks in xvmcvideo
-        if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1){
-            ff_xvmc_pack_pblocks(s,-1);//inter are always full blocks
-            if(s->swap_uv){
-                exchange_uv(s);
-            }
-        }
-
-        if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
-            if(s->flags2 & CODEC_FLAG2_FAST){
-                for(i=0;i<6;i++) {
-                    mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i);
-                }
-            }else{
-                for(i=0;i<mb_block_count;i++) {
-                    if (mpeg2_decode_block_intra(s, *s->pblocks[i], i) < 0)
-                        return -1;
-                }
-            }
-        } else {
-            for(i=0;i<6;i++) {
-                if (mpeg1_decode_block_intra(s, *s->pblocks[i], i) < 0)
-                    return -1;
-            }
-        }
-    } else {
-        if (mb_type & MB_TYPE_ZERO_MV){
-            assert(mb_type & MB_TYPE_CBP);
-
-            s->mv_dir = MV_DIR_FORWARD;
-            if(s->picture_structure == PICT_FRAME){
-                if(!s->frame_pred_frame_dct)
-                    s->interlaced_dct = get_bits1(&s->gb);
-                s->mv_type = MV_TYPE_16X16;
-            }else{
-                s->mv_type = MV_TYPE_FIELD;
-                mb_type |= MB_TYPE_INTERLACED;
-                s->field_select[0][0]= s->picture_structure - 1;
-            }
-
-            if (IS_QUANT(mb_type))
-                s->qscale = get_qscale(s);
-
-            s->last_mv[0][0][0] = 0;
-            s->last_mv[0][0][1] = 0;
-            s->last_mv[0][1][0] = 0;
-            s->last_mv[0][1][1] = 0;
-            s->mv[0][0][0] = 0;
-            s->mv[0][0][1] = 0;
-        }else{
-            assert(mb_type & MB_TYPE_L0L1);
-//FIXME decide if MBs in field pictures are MB_TYPE_INTERLACED
-            /* get additional motion vector type */
-            if (s->frame_pred_frame_dct)
-                motion_type = MT_FRAME;
-            else{
-                motion_type = get_bits(&s->gb, 2);
-                if (s->picture_structure == PICT_FRAME && HAS_CBP(mb_type))
-                    s->interlaced_dct = get_bits1(&s->gb);
-            }
-
-            if (IS_QUANT(mb_type))
-                s->qscale = get_qscale(s);
-
-            /* motion vectors */
-            s->mv_dir= (mb_type>>13)&3;
-            dprintf(s->avctx, "motion_type=%d\n", motion_type);
-            switch(motion_type) {
-            case MT_FRAME: /* or MT_16X8 */
-                if (s->picture_structure == PICT_FRAME) {
-                    mb_type |= MB_TYPE_16x16;
-                    s->mv_type = MV_TYPE_16X16;
-                    for(i=0;i<2;i++) {
-                        if (USES_LIST(mb_type, i)) {
-                            /* MT_FRAME */
-                            s->mv[i][0][0]= s->last_mv[i][0][0]= s->last_mv[i][1][0] =
-                                mpeg_decode_motion(s, s->mpeg_f_code[i][0], s->last_mv[i][0][0]);
-                            s->mv[i][0][1]= s->last_mv[i][0][1]= s->last_mv[i][1][1] =
-                                mpeg_decode_motion(s, s->mpeg_f_code[i][1], s->last_mv[i][0][1]);
-                            /* full_pel: only for MPEG-1 */
-                            if (s->full_pel[i]){
-                                s->mv[i][0][0] <<= 1;
-                                s->mv[i][0][1] <<= 1;
-                            }
-                        }
-                    }
-                } else {
-                    mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
-                    s->mv_type = MV_TYPE_16X8;
-                    for(i=0;i<2;i++) {
-                        if (USES_LIST(mb_type, i)) {
-                            /* MT_16X8 */
-                            for(j=0;j<2;j++) {
-                                s->field_select[i][j] = get_bits1(&s->gb);
-                                for(k=0;k<2;k++) {
-                                    val = mpeg_decode_motion(s, s->mpeg_f_code[i][k],
-                                                             s->last_mv[i][j][k]);
-                                    s->last_mv[i][j][k] = val;
-                                    s->mv[i][j][k] = val;
-                                }
-                            }
-                        }
-                    }
-                }
-                break;
-            case MT_FIELD:
-                s->mv_type = MV_TYPE_FIELD;
-                if (s->picture_structure == PICT_FRAME) {
-                    mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
-                    for(i=0;i<2;i++) {
-                        if (USES_LIST(mb_type, i)) {
-                            for(j=0;j<2;j++) {
-                                s->field_select[i][j] = get_bits1(&s->gb);
-                                val = mpeg_decode_motion(s, s->mpeg_f_code[i][0],
-                                                         s->last_mv[i][j][0]);
-                                s->last_mv[i][j][0] = val;
-                                s->mv[i][j][0] = val;
-                                dprintf(s->avctx, "fmx=%d\n", val);
-                                val = mpeg_decode_motion(s, s->mpeg_f_code[i][1],
-                                                         s->last_mv[i][j][1] >> 1);
-                                s->last_mv[i][j][1] = val << 1;
-                                s->mv[i][j][1] = val;
-                                dprintf(s->avctx, "fmy=%d\n", val);
-                            }
-                        }
-                    }
-                } else {
-                    mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;
-                    for(i=0;i<2;i++) {
-                        if (USES_LIST(mb_type, i)) {
-                            s->field_select[i][0] = get_bits1(&s->gb);
-                            for(k=0;k<2;k++) {
-                                val = mpeg_decode_motion(s, s->mpeg_f_code[i][k],
-                                                         s->last_mv[i][0][k]);
-                                s->last_mv[i][0][k] = val;
-                                s->last_mv[i][1][k] = val;
-                                s->mv[i][0][k] = val;
-                            }
-                        }
-                    }
-                }
-                break;
-            case MT_DMV:
-                s->mv_type = MV_TYPE_DMV;
-                for(i=0;i<2;i++) {
-                    if (USES_LIST(mb_type, i)) {
-                        int dmx, dmy, mx, my, m;
-                        const int my_shift= s->picture_structure == PICT_FRAME;
-
-                        mx = mpeg_decode_motion(s, s->mpeg_f_code[i][0],
-                                                s->last_mv[i][0][0]);
-                        s->last_mv[i][0][0] = mx;
-                        s->last_mv[i][1][0] = mx;
-                        dmx = get_dmv(s);
-                        my = mpeg_decode_motion(s, s->mpeg_f_code[i][1],
-                                                s->last_mv[i][0][1] >> my_shift);
-                        dmy = get_dmv(s);
-
-
-                        s->last_mv[i][0][1] = my<<my_shift;
-                        s->last_mv[i][1][1] = my<<my_shift;
-
-                        s->mv[i][0][0] = mx;
-                        s->mv[i][0][1] = my;
-                        s->mv[i][1][0] = mx;//not used
-                        s->mv[i][1][1] = my;//not used
-
-                        if (s->picture_structure == PICT_FRAME) {
-                            mb_type |= MB_TYPE_16x16 | MB_TYPE_INTERLACED;
-
-                            //m = 1 + 2 * s->top_field_first;
-                            m = s->top_field_first ? 1 : 3;
-
-                            /* top -> top pred */
-                            s->mv[i][2][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
-                            s->mv[i][2][1] = ((my * m + (my > 0)) >> 1) + dmy - 1;
-                            m = 4 - m;
-                            s->mv[i][3][0] = ((mx * m + (mx > 0)) >> 1) + dmx;
-                            s->mv[i][3][1] = ((my * m + (my > 0)) >> 1) + dmy + 1;
-                        } else {
-                            mb_type |= MB_TYPE_16x16;
-
-                            s->mv[i][2][0] = ((mx + (mx > 0)) >> 1) + dmx;
-                            s->mv[i][2][1] = ((my + (my > 0)) >> 1) + dmy;
-                            if(s->picture_structure == PICT_TOP_FIELD)
-                                s->mv[i][2][1]--;
-                            else
-                                s->mv[i][2][1]++;
-                        }
-                    }
-                }
-                break;
-            default:
-                av_log(s->avctx, AV_LOG_ERROR, "00 motion_type at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-        }
-
-        s->mb_intra = 0;
-        if (HAS_CBP(mb_type)) {
-            s->dsp.clear_blocks(s->block[0]);
-
-            cbp = get_vlc2(&s->gb, mb_pat_vlc.table, MB_PAT_VLC_BITS, 1);
-            if(mb_block_count > 6){
-                 cbp<<= mb_block_count-6;
-                 cbp |= get_bits(&s->gb, mb_block_count-6);
-                 s->dsp.clear_blocks(s->block[6]);
-            }
-            if (cbp <= 0){
-                av_log(s->avctx, AV_LOG_ERROR, "invalid cbp at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            //if 1, we memcpy blocks in xvmcvideo
-            if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1){
-                ff_xvmc_pack_pblocks(s,cbp);
-                if(s->swap_uv){
-                    exchange_uv(s);
-                }
-            }
-
-            if (s->codec_id == CODEC_ID_MPEG2VIDEO) {
-                if(s->flags2 & CODEC_FLAG2_FAST){
-                    for(i=0;i<6;i++) {
-                        if(cbp & 32) {
-                            mpeg2_fast_decode_block_non_intra(s, *s->pblocks[i], i);
-                        } else {
-                            s->block_last_index[i] = -1;
-                        }
-                        cbp+=cbp;
-                    }
-                }else{
-                    cbp<<= 12-mb_block_count;
-
-                    for(i=0;i<mb_block_count;i++) {
-                        if ( cbp & (1<<11) ) {
-                            if (mpeg2_decode_block_non_intra(s, *s->pblocks[i], i) < 0)
-                                return -1;
-                        } else {
-                            s->block_last_index[i] = -1;
-                        }
-                        cbp+=cbp;
-                    }
-                }
-            } else {
-                if(s->flags2 & CODEC_FLAG2_FAST){
-                    for(i=0;i<6;i++) {
-                        if (cbp & 32) {
-                            mpeg1_fast_decode_block_inter(s, *s->pblocks[i], i);
-                        } else {
-                            s->block_last_index[i] = -1;
-                        }
-                        cbp+=cbp;
-                    }
-                }else{
-                    for(i=0;i<6;i++) {
-                        if (cbp & 32) {
-                            if (mpeg1_decode_block_inter(s, *s->pblocks[i], i) < 0)
-                                return -1;
-                        } else {
-                            s->block_last_index[i] = -1;
-                        }
-                        cbp+=cbp;
-                    }
-                }
-            }
-        }else{
-            for(i=0;i<12;i++)
-                s->block_last_index[i] = -1;
-        }
-    }
-
-    s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]= mb_type;
-
-    return 0;
-}
-
-/* as H.263, but only 17 codes */
-static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
-{
-    int code, sign, val, l, shift;
-
-    code = get_vlc2(&s->gb, mv_vlc.table, MV_VLC_BITS, 2);
-    if (code == 0) {
-        return pred;
-    }
-    if (code < 0) {
-        return 0xffff;
-    }
-
-    sign = get_bits1(&s->gb);
-    shift = fcode - 1;
-    val = code;
-    if (shift) {
-        val = (val - 1) << shift;
-        val |= get_bits(&s->gb, shift);
-        val++;
-    }
-    if (sign)
-        val = -val;
-    val += pred;
-
-    /* modulo decoding */
-    l= INT_BIT - 5 - shift;
-    val = (val<<l)>>l;
-    return val;
-}
-
-static inline int mpeg1_decode_block_intra(MpegEncContext *s,
-                               DCTELEM *block,
-                               int n)
-{
-    int level, dc, diff, i, j, run;
-    int component;
-    RLTable *rl = &ff_rl_mpeg1;
-    uint8_t * const scantable= s->intra_scantable.permutated;
-    const uint16_t *quant_matrix= s->intra_matrix;
-    const int qscale= s->qscale;
-
-    /* DC coefficient */
-    component = (n <= 3 ? 0 : n - 4 + 1);
-    diff = decode_dc(&s->gb, component);
-    if (diff >= 0xffff)
-        return -1;
-    dc = s->last_dc[component];
-    dc += diff;
-    s->last_dc[component] = dc;
-    block[0] = dc*quant_matrix[0];
-    dprintf(s->avctx, "dc=%d diff=%d\n", dc, diff);
-    i = 0;
-    {
-        OPEN_READER(re, &s->gb);
-        /* now quantify & encode AC coefficients */
-        for(;;) {
-            UPDATE_CACHE(re, &s->gb);
-            GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if(level == 127){
-                break;
-            } else if(level != 0) {
-                i += run;
-                j = scantable[i];
-                level= (level*qscale*quant_matrix[j])>>4;
-                level= (level-1)|1;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                LAST_SKIP_BITS(re, &s->gb, 1);
-            } else {
-                /* escape */
-                run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-                UPDATE_CACHE(re, &s->gb);
-                level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8);
-                if (level == -128) {
-                    level = SHOW_UBITS(re, &s->gb, 8) - 256; LAST_SKIP_BITS(re, &s->gb, 8);
-                } else if (level == 0) {
-                    level = SHOW_UBITS(re, &s->gb, 8)      ; LAST_SKIP_BITS(re, &s->gb, 8);
-                }
-                i += run;
-                j = scantable[i];
-                if(level<0){
-                    level= -level;
-                    level= (level*qscale*quant_matrix[j])>>4;
-                    level= (level-1)|1;
-                    level= -level;
-                }else{
-                    level= (level*qscale*quant_matrix[j])>>4;
-                    level= (level-1)|1;
-                }
-            }
-            if (i > 63){
-                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            block[j] = level;
-        }
-        CLOSE_READER(re, &s->gb);
-    }
-    s->block_last_index[n] = i;
-   return 0;
-}
-
-int ff_mpeg1_decode_block_intra(MpegEncContext *s,
-                                DCTELEM *block,
-                                int n)
-{
-    return mpeg1_decode_block_intra(s, block, n);
-}
-
-static inline int mpeg1_decode_block_inter(MpegEncContext *s,
-                               DCTELEM *block,
-                               int n)
-{
-    int level, i, j, run;
-    RLTable *rl = &ff_rl_mpeg1;
-    uint8_t * const scantable= s->intra_scantable.permutated;
-    const uint16_t *quant_matrix= s->inter_matrix;
-    const int qscale= s->qscale;
-
-    {
-        OPEN_READER(re, &s->gb);
-        i = -1;
-        // special case for first coefficient, no need to add second VLC table
-        UPDATE_CACHE(re, &s->gb);
-        if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
-            level= (3*qscale*quant_matrix[0])>>5;
-            level= (level-1)|1;
-            if(GET_CACHE(re, &s->gb)&0x40000000)
-                level= -level;
-            block[0] = level;
-            i++;
-            SKIP_BITS(re, &s->gb, 2);
-            if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-                goto end;
-        }
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
-        /* now quantify & encode AC coefficients */
-        for(;;) {
-            GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if(level != 0) {
-                i += run;
-                j = scantable[i];
-                level= ((level*2+1)*qscale*quant_matrix[j])>>5;
-                level= (level-1)|1;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                SKIP_BITS(re, &s->gb, 1);
-            } else {
-                /* escape */
-                run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-                UPDATE_CACHE(re, &s->gb);
-                level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8);
-                if (level == -128) {
-                    level = SHOW_UBITS(re, &s->gb, 8) - 256; SKIP_BITS(re, &s->gb, 8);
-                } else if (level == 0) {
-                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8);
-                }
-                i += run;
-                j = scantable[i];
-                if(level<0){
-                    level= -level;
-                    level= ((level*2+1)*qscale*quant_matrix[j])>>5;
-                    level= (level-1)|1;
-                    level= -level;
-                }else{
-                    level= ((level*2+1)*qscale*quant_matrix[j])>>5;
-                    level= (level-1)|1;
-                }
-            }
-            if (i > 63){
-                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            block[j] = level;
-#if MIN_CACHE_BITS < 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
-            if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-                break;
-#if MIN_CACHE_BITS >= 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
-        }
-end:
-        LAST_SKIP_BITS(re, &s->gb, 2);
-        CLOSE_READER(re, &s->gb);
-    }
-    s->block_last_index[n] = i;
-    return 0;
-}
-
-static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *block, int n)
-{
-    int level, i, j, run;
-    RLTable *rl = &ff_rl_mpeg1;
-    uint8_t * const scantable= s->intra_scantable.permutated;
-    const int qscale= s->qscale;
-
-    {
-        OPEN_READER(re, &s->gb);
-        i = -1;
-        // special case for first coefficient, no need to add second VLC table
-        UPDATE_CACHE(re, &s->gb);
-        if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
-            level= (3*qscale)>>1;
-            level= (level-1)|1;
-            if(GET_CACHE(re, &s->gb)&0x40000000)
-                level= -level;
-            block[0] = level;
-            i++;
-            SKIP_BITS(re, &s->gb, 2);
-            if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-                goto end;
-        }
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
-
-        /* now quantify & encode AC coefficients */
-        for(;;) {
-            GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if(level != 0) {
-                i += run;
-                j = scantable[i];
-                level= ((level*2+1)*qscale)>>1;
-                level= (level-1)|1;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                SKIP_BITS(re, &s->gb, 1);
-            } else {
-                /* escape */
-                run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-                UPDATE_CACHE(re, &s->gb);
-                level = SHOW_SBITS(re, &s->gb, 8); SKIP_BITS(re, &s->gb, 8);
-                if (level == -128) {
-                    level = SHOW_UBITS(re, &s->gb, 8) - 256; SKIP_BITS(re, &s->gb, 8);
-                } else if (level == 0) {
-                    level = SHOW_UBITS(re, &s->gb, 8)      ; SKIP_BITS(re, &s->gb, 8);
-                }
-                i += run;
-                j = scantable[i];
-                if(level<0){
-                    level= -level;
-                    level= ((level*2+1)*qscale)>>1;
-                    level= (level-1)|1;
-                    level= -level;
-                }else{
-                    level= ((level*2+1)*qscale)>>1;
-                    level= (level-1)|1;
-                }
-            }
-
-            block[j] = level;
-#if MIN_CACHE_BITS < 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
-            if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-                break;
-#if MIN_CACHE_BITS >= 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
-        }
-end:
-        LAST_SKIP_BITS(re, &s->gb, 2);
-        CLOSE_READER(re, &s->gb);
-    }
-    s->block_last_index[n] = i;
-    return 0;
-}
-
-
-static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
-                               DCTELEM *block,
-                               int n)
-{
-    int level, i, j, run;
-    RLTable *rl = &ff_rl_mpeg1;
-    uint8_t * const scantable= s->intra_scantable.permutated;
-    const uint16_t *quant_matrix;
-    const int qscale= s->qscale;
-    int mismatch;
-
-    mismatch = 1;
-
-    {
-        OPEN_READER(re, &s->gb);
-        i = -1;
-        if (n < 4)
-            quant_matrix = s->inter_matrix;
-        else
-            quant_matrix = s->chroma_inter_matrix;
-
-        // special case for first coefficient, no need to add second VLC table
-        UPDATE_CACHE(re, &s->gb);
-        if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
-            level= (3*qscale*quant_matrix[0])>>5;
-            if(GET_CACHE(re, &s->gb)&0x40000000)
-                level= -level;
-            block[0] = level;
-            mismatch ^= level;
-            i++;
-            SKIP_BITS(re, &s->gb, 2);
-            if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-                goto end;
-        }
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
-
-        /* now quantify & encode AC coefficients */
-        for(;;) {
-            GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if(level != 0) {
-                i += run;
-                j = scantable[i];
-                level= ((level*2+1)*qscale*quant_matrix[j])>>5;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                SKIP_BITS(re, &s->gb, 1);
-            } else {
-                /* escape */
-                run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-                UPDATE_CACHE(re, &s->gb);
-                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
-
-                i += run;
-                j = scantable[i];
-                if(level<0){
-                    level= ((-level*2+1)*qscale*quant_matrix[j])>>5;
-                    level= -level;
-                }else{
-                    level= ((level*2+1)*qscale*quant_matrix[j])>>5;
-                }
-            }
-            if (i > 63){
-                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            mismatch ^= level;
-            block[j] = level;
-#if MIN_CACHE_BITS < 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
-            if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-                break;
-#if MIN_CACHE_BITS >= 19
-            UPDATE_CACHE(re, &s->gb);
-#endif
-        }
-end:
-        LAST_SKIP_BITS(re, &s->gb, 2);
-        CLOSE_READER(re, &s->gb);
-    }
-    block[63] ^= (mismatch & 1);
-
-    s->block_last_index[n] = i;
-    return 0;
-}
-
-static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
-                               DCTELEM *block,
-                               int n)
-{
-    int level, i, j, run;
-    RLTable *rl = &ff_rl_mpeg1;
-    uint8_t * const scantable= s->intra_scantable.permutated;
-    const int qscale= s->qscale;
-    OPEN_READER(re, &s->gb);
-    i = -1;
-
-    // special case for first coefficient, no need to add second VLC table
-    UPDATE_CACHE(re, &s->gb);
-    if (((int32_t)GET_CACHE(re, &s->gb)) < 0) {
-        level= (3*qscale)>>1;
-        if(GET_CACHE(re, &s->gb)&0x40000000)
-            level= -level;
-        block[0] = level;
-        i++;
-        SKIP_BITS(re, &s->gb, 2);
-        if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-            goto end;
-    }
-#if MIN_CACHE_BITS < 19
-    UPDATE_CACHE(re, &s->gb);
-#endif
-
-    /* now quantify & encode AC coefficients */
-    for(;;) {
-        GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-        if(level != 0) {
-            i += run;
-            j = scantable[i];
-            level= ((level*2+1)*qscale)>>1;
-            level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-            SKIP_BITS(re, &s->gb, 1);
-        } else {
-            /* escape */
-            run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-            UPDATE_CACHE(re, &s->gb);
-            level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
-
-            i += run;
-            j = scantable[i];
-            if(level<0){
-                level= ((-level*2+1)*qscale)>>1;
-                level= -level;
-            }else{
-                level= ((level*2+1)*qscale)>>1;
-            }
-        }
-
-        block[j] = level;
-#if MIN_CACHE_BITS < 19
-        UPDATE_CACHE(re, &s->gb);
-#endif
-        if(((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
-            break;
-#if MIN_CACHE_BITS >=19
-        UPDATE_CACHE(re, &s->gb);
-#endif
-    }
-end:
-    LAST_SKIP_BITS(re, &s->gb, 2);
-    CLOSE_READER(re, &s->gb);
-    s->block_last_index[n] = i;
-    return 0;
-}
-
-
-static inline int mpeg2_decode_block_intra(MpegEncContext *s,
-                               DCTELEM *block,
-                               int n)
-{
-    int level, dc, diff, i, j, run;
-    int component;
-    RLTable *rl;
-    uint8_t * const scantable= s->intra_scantable.permutated;
-    const uint16_t *quant_matrix;
-    const int qscale= s->qscale;
-    int mismatch;
-
-    /* DC coefficient */
-    if (n < 4){
-        quant_matrix = s->intra_matrix;
-        component = 0;
-    }else{
-        quant_matrix = s->chroma_intra_matrix;
-        component = (n&1) + 1;
-    }
-    diff = decode_dc(&s->gb, component);
-    if (diff >= 0xffff)
-        return -1;
-    dc = s->last_dc[component];
-    dc += diff;
-    s->last_dc[component] = dc;
-    block[0] = dc << (3 - s->intra_dc_precision);
-    dprintf(s->avctx, "dc=%d\n", block[0]);
-    mismatch = block[0] ^ 1;
-    i = 0;
-    if (s->intra_vlc_format)
-        rl = &ff_rl_mpeg2;
-    else
-        rl = &ff_rl_mpeg1;
-
-    {
-        OPEN_READER(re, &s->gb);
-        /* now quantify & encode AC coefficients */
-        for(;;) {
-            UPDATE_CACHE(re, &s->gb);
-            GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if(level == 127){
-                break;
-            } else if(level != 0) {
-                i += run;
-                j = scantable[i];
-                level= (level*qscale*quant_matrix[j])>>4;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                LAST_SKIP_BITS(re, &s->gb, 1);
-            } else {
-                /* escape */
-                run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-                UPDATE_CACHE(re, &s->gb);
-                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
-                i += run;
-                j = scantable[i];
-                if(level<0){
-                    level= (-level*qscale*quant_matrix[j])>>4;
-                    level= -level;
-                }else{
-                    level= (level*qscale*quant_matrix[j])>>4;
-                }
-            }
-            if (i > 63){
-                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            mismatch^= level;
-            block[j] = level;
-        }
-        CLOSE_READER(re, &s->gb);
-    }
-    block[63]^= mismatch&1;
-
-    s->block_last_index[n] = i;
-    return 0;
-}
-
-static inline int mpeg2_fast_decode_block_intra(MpegEncContext *s,
-                               DCTELEM *block,
-                               int n)
-{
-    int level, dc, diff, j, run;
-    int component;
-    RLTable *rl;
-    uint8_t * scantable= s->intra_scantable.permutated;
-    const uint16_t *quant_matrix;
-    const int qscale= s->qscale;
-
-    /* DC coefficient */
-    if (n < 4){
-        quant_matrix = s->intra_matrix;
-        component = 0;
-    }else{
-        quant_matrix = s->chroma_intra_matrix;
-        component = (n&1) + 1;
-    }
-    diff = decode_dc(&s->gb, component);
-    if (diff >= 0xffff)
-        return -1;
-    dc = s->last_dc[component];
-    dc += diff;
-    s->last_dc[component] = dc;
-    block[0] = dc << (3 - s->intra_dc_precision);
-    if (s->intra_vlc_format)
-        rl = &ff_rl_mpeg2;
-    else
-        rl = &ff_rl_mpeg1;
-
-    {
-        OPEN_READER(re, &s->gb);
-        /* now quantify & encode AC coefficients */
-        for(;;) {
-            UPDATE_CACHE(re, &s->gb);
-            GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
-
-            if(level == 127){
-                break;
-            } else if(level != 0) {
-                scantable += run;
-                j = *scantable;
-                level= (level*qscale*quant_matrix[j])>>4;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                LAST_SKIP_BITS(re, &s->gb, 1);
-            } else {
-                /* escape */
-                run = SHOW_UBITS(re, &s->gb, 6)+1; LAST_SKIP_BITS(re, &s->gb, 6);
-                UPDATE_CACHE(re, &s->gb);
-                level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
-                scantable += run;
-                j = *scantable;
-                if(level<0){
-                    level= (-level*qscale*quant_matrix[j])>>4;
-                    level= -level;
-                }else{
-                    level= (level*qscale*quant_matrix[j])>>4;
-                }
-            }
-
-            block[j] = level;
-        }
-        CLOSE_READER(re, &s->gb);
-    }
-
-    s->block_last_index[n] = scantable - s->intra_scantable.permutated;
-    return 0;
-}
-
-typedef struct Mpeg1Context {
-    MpegEncContext mpeg_enc_ctx;
-    int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
-    int repeat_field; /* true if we must repeat the field */
-    AVPanScan pan_scan; /** some temporary storage for the panscan */
-    int slice_count;
-    int swap_uv;//indicate VCR2
-    int save_aspect_info;
-    int save_width, save_height, save_progressive_seq;
-    AVRational frame_rate_ext;       ///< MPEG-2 specific framerate modificator
-    int sync;                        ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
-} Mpeg1Context;
-
-static av_cold int mpeg_decode_init(AVCodecContext *avctx)
-{
-    Mpeg1Context *s = avctx->priv_data;
-    MpegEncContext *s2 = &s->mpeg_enc_ctx;
-    int i;
-
-    /* we need some permutation to store matrices,
-     * until MPV_common_init() sets the real permutation. */
-    for(i=0;i<64;i++)
-       s2->dsp.idct_permutation[i]=i;
-
-    MPV_decode_defaults(s2);
-
-    s->mpeg_enc_ctx.avctx= avctx;
-    s->mpeg_enc_ctx.flags= avctx->flags;
-    s->mpeg_enc_ctx.flags2= avctx->flags2;
-    ff_mpeg12_common_init(&s->mpeg_enc_ctx);
-    ff_mpeg12_init_vlcs();
-
-    s->mpeg_enc_ctx_allocated = 0;
-    s->mpeg_enc_ctx.picture_number = 0;
-    s->repeat_field = 0;
-    s->mpeg_enc_ctx.codec_id= avctx->codec->id;
-    avctx->color_range= AVCOL_RANGE_MPEG;
-    if (avctx->codec->id == CODEC_ID_MPEG1VIDEO)
-        avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
-    else
-        avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
-    return 0;
-}
-
-static void quant_matrix_rebuild(uint16_t *matrix, const uint8_t *old_perm,
-                                     const uint8_t *new_perm){
-    uint16_t temp_matrix[64];
-    int i;
-
-    memcpy(temp_matrix,matrix,64*sizeof(uint16_t));
-
-    for(i=0;i<64;i++){
-        matrix[new_perm[i]] = temp_matrix[old_perm[i]];
-    }
-}
-
-static enum PixelFormat mpeg_get_pixelformat(AVCodecContext *avctx){
-    Mpeg1Context *s1 = avctx->priv_data;
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-
-    if(avctx->xvmc_acceleration)
-        return avctx->get_format(avctx,pixfmt_xvmc_mpg2_420);
-    else if(avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){
-        if(avctx->codec_id == CODEC_ID_MPEG1VIDEO)
-            return PIX_FMT_VDPAU_MPEG1;
-        else
-            return PIX_FMT_VDPAU_MPEG2;
-    }else{
-        if(s->chroma_format <  2)
-            return avctx->get_format(avctx,ff_hwaccel_pixfmt_list_420);
-        else if(s->chroma_format == 2)
-            return PIX_FMT_YUV422P;
-        else
-            return PIX_FMT_YUV444P;
-    }
-}
-
-/* Call this function when we know all parameters.
- * It may be called in different places for MPEG-1 and MPEG-2. */
-static int mpeg_decode_postinit(AVCodecContext *avctx){
-    Mpeg1Context *s1 = avctx->priv_data;
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-    uint8_t old_permutation[64];
-
-    if (
-        (s1->mpeg_enc_ctx_allocated == 0)||
-        avctx->coded_width  != s->width ||
-        avctx->coded_height != s->height||
-        s1->save_width != s->width ||
-        s1->save_height != s->height ||
-        s1->save_aspect_info != s->aspect_ratio_info||
-        s1->save_progressive_seq != s->progressive_sequence ||
-        0)
-    {
-
-        if (s1->mpeg_enc_ctx_allocated) {
-            ParseContext pc= s->parse_context;
-            s->parse_context.buffer=0;
-            MPV_common_end(s);
-            s->parse_context= pc;
-        }
-
-        if( (s->width == 0 )||(s->height == 0))
-            return -2;
-
-        avcodec_set_dimensions(avctx, s->width, s->height);
-        avctx->bit_rate = s->bit_rate;
-        s1->save_aspect_info = s->aspect_ratio_info;
-        s1->save_width = s->width;
-        s1->save_height = s->height;
-        s1->save_progressive_seq = s->progressive_sequence;
-
-        /* low_delay may be forced, in this case we will have B-frames
-         * that behave like P-frames. */
-        avctx->has_b_frames = !(s->low_delay);
-
-        assert((avctx->sub_id==1) == (avctx->codec_id==CODEC_ID_MPEG1VIDEO));
-        if(avctx->codec_id==CODEC_ID_MPEG1VIDEO){
-            //MPEG-1 fps
-            avctx->time_base.den= ff_frame_rate_tab[s->frame_rate_index].num;
-            avctx->time_base.num= ff_frame_rate_tab[s->frame_rate_index].den;
-            //MPEG-1 aspect
-            avctx->sample_aspect_ratio= av_d2q(
-                    1.0/ff_mpeg1_aspect[s->aspect_ratio_info], 255);
-            avctx->ticks_per_frame=1;
-        }else{//MPEG-2
-        //MPEG-2 fps
-            av_reduce(
-                &s->avctx->time_base.den,
-                &s->avctx->time_base.num,
-                ff_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num*2,
-                ff_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
-                1<<30);
-            avctx->ticks_per_frame=2;
-        //MPEG-2 aspect
-            if(s->aspect_ratio_info > 1){
-                //we ignore the spec here as reality does not match the spec, see for example
-                // res_change_ffmpeg_aspect.ts and sequence-display-aspect.mpg
-                if( (s1->pan_scan.width == 0 )||(s1->pan_scan.height == 0) || 1){
-                    s->avctx->sample_aspect_ratio=
-                        av_div_q(
-                         ff_mpeg2_aspect[s->aspect_ratio_info],
-                         (AVRational){s->width, s->height}
-                         );
-                }else{
-                    s->avctx->sample_aspect_ratio=
-                        av_div_q(
-                         ff_mpeg2_aspect[s->aspect_ratio_info],
-                         (AVRational){s1->pan_scan.width, s1->pan_scan.height}
-                        );
-                }
-            }else{
-                s->avctx->sample_aspect_ratio=
-                    ff_mpeg2_aspect[s->aspect_ratio_info];
-            }
-        }//MPEG-2
-
-        avctx->pix_fmt = mpeg_get_pixelformat(avctx);
-        avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
-        //until then pix_fmt may be changed right after codec init
-        if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT ||
-            avctx->hwaccel ||
-            s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU )
-            if( avctx->idct_algo == FF_IDCT_AUTO )
-                avctx->idct_algo = FF_IDCT_SIMPLE;
-
-        /* Quantization matrices may need reordering
-         * if DCT permutation is changed. */
-        memcpy(old_permutation,s->dsp.idct_permutation,64*sizeof(uint8_t));
-
-        if (MPV_common_init(s) < 0)
-            return -2;
-
-        quant_matrix_rebuild(s->intra_matrix,       old_permutation,s->dsp.idct_permutation);
-        quant_matrix_rebuild(s->inter_matrix,       old_permutation,s->dsp.idct_permutation);
-        quant_matrix_rebuild(s->chroma_intra_matrix,old_permutation,s->dsp.idct_permutation);
-        quant_matrix_rebuild(s->chroma_inter_matrix,old_permutation,s->dsp.idct_permutation);
-
-        s1->mpeg_enc_ctx_allocated = 1;
-    }
-    return 0;
-}
-
-static int mpeg1_decode_picture(AVCodecContext *avctx,
-                                const uint8_t *buf, int buf_size)
-{
-    Mpeg1Context *s1 = avctx->priv_data;
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-    int ref, f_code, vbv_delay;
-
-    init_get_bits(&s->gb, buf, buf_size*8);
-
-    ref = get_bits(&s->gb, 10); /* temporal ref */
-    s->pict_type = get_bits(&s->gb, 3);
-    if(s->pict_type == 0 || s->pict_type > 3)
-        return -1;
-
-    vbv_delay= get_bits(&s->gb, 16);
-    if (s->pict_type == FF_P_TYPE || s->pict_type == FF_B_TYPE) {
-        s->full_pel[0] = get_bits1(&s->gb);
-        f_code = get_bits(&s->gb, 3);
-        if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
-            return -1;
-        s->mpeg_f_code[0][0] = f_code;
-        s->mpeg_f_code[0][1] = f_code;
-    }
-    if (s->pict_type == FF_B_TYPE) {
-        s->full_pel[1] = get_bits1(&s->gb);
-        f_code = get_bits(&s->gb, 3);
-        if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
-            return -1;
-        s->mpeg_f_code[1][0] = f_code;
-        s->mpeg_f_code[1][1] = f_code;
-    }
-    s->current_picture.pict_type= s->pict_type;
-    s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
-
-    if(avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(avctx, AV_LOG_DEBUG, "vbv_delay %d, ref %d type:%d\n", vbv_delay, ref, s->pict_type);
-
-    s->y_dc_scale = 8;
-    s->c_dc_scale = 8;
-    return 0;
-}
-
-static void mpeg_decode_sequence_extension(Mpeg1Context *s1)
-{
-    MpegEncContext *s= &s1->mpeg_enc_ctx;
-    int horiz_size_ext, vert_size_ext;
-    int bit_rate_ext;
-
-    skip_bits(&s->gb, 1); /* profile and level esc*/
-    s->avctx->profile= get_bits(&s->gb, 3);
-    s->avctx->level= get_bits(&s->gb, 4);
-    s->progressive_sequence = get_bits1(&s->gb); /* progressive_sequence */
-    s->chroma_format = get_bits(&s->gb, 2); /* chroma_format 1=420, 2=422, 3=444 */
-    horiz_size_ext = get_bits(&s->gb, 2);
-    vert_size_ext = get_bits(&s->gb, 2);
-    s->width |= (horiz_size_ext << 12);
-    s->height |= (vert_size_ext << 12);
-    bit_rate_ext = get_bits(&s->gb, 12);  /* XXX: handle it */
-    s->bit_rate += (bit_rate_ext << 18) * 400;
-    skip_bits1(&s->gb); /* marker */
-    s->avctx->rc_buffer_size += get_bits(&s->gb, 8)*1024*16<<10;
-
-    s->low_delay = get_bits1(&s->gb);
-    if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1;
-
-    s1->frame_rate_ext.num = get_bits(&s->gb, 2)+1;
-    s1->frame_rate_ext.den = get_bits(&s->gb, 5)+1;
-
-    dprintf(s->avctx, "sequence extension\n");
-    s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;
-    s->avctx->sub_id = 2; /* indicates MPEG-2 found */
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_DEBUG, "profile: %d, level: %d vbv buffer: %d, bitrate:%d\n",
-               s->avctx->profile, s->avctx->level, s->avctx->rc_buffer_size, s->bit_rate);
-
-}
-
-static void mpeg_decode_sequence_display_extension(Mpeg1Context *s1)
-{
-    MpegEncContext *s= &s1->mpeg_enc_ctx;
-    int color_description, w, h;
-
-    skip_bits(&s->gb, 3); /* video format */
-    color_description= get_bits1(&s->gb);
-    if(color_description){
-        s->avctx->color_primaries= get_bits(&s->gb, 8);
-        s->avctx->color_trc      = get_bits(&s->gb, 8);
-        s->avctx->colorspace     = get_bits(&s->gb, 8);
-    }
-    w= get_bits(&s->gb, 14);
-    skip_bits(&s->gb, 1); //marker
-    h= get_bits(&s->gb, 14);
-    skip_bits(&s->gb, 1); //marker
-
-    s1->pan_scan.width= 16*w;
-    s1->pan_scan.height=16*h;
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_DEBUG, "sde w:%d, h:%d\n", w, h);
-}
-
-static void mpeg_decode_picture_display_extension(Mpeg1Context *s1)
-{
-    MpegEncContext *s= &s1->mpeg_enc_ctx;
-    int i,nofco;
-
-    nofco = 1;
-    if(s->progressive_sequence){
-        if(s->repeat_first_field){
-            nofco++;
-            if(s->top_field_first)
-                nofco++;
-        }
-    }else{
-        if(s->picture_structure == PICT_FRAME){
-            nofco++;
-            if(s->repeat_first_field)
-                nofco++;
-        }
-    }
-    for(i=0; i<nofco; i++){
-        s1->pan_scan.position[i][0]= get_sbits(&s->gb, 16);
-        skip_bits(&s->gb, 1); //marker
-        s1->pan_scan.position[i][1]= get_sbits(&s->gb, 16);
-        skip_bits(&s->gb, 1); //marker
-    }
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_DEBUG, "pde (%d,%d) (%d,%d) (%d,%d)\n",
-            s1->pan_scan.position[0][0], s1->pan_scan.position[0][1],
-            s1->pan_scan.position[1][0], s1->pan_scan.position[1][1],
-            s1->pan_scan.position[2][0], s1->pan_scan.position[2][1]
-        );
-}
-
-static int load_matrix(MpegEncContext *s, uint16_t matrix0[64], uint16_t matrix1[64], int intra){
-    int i;
-
-    for(i=0; i<64; i++) {
-        int j = s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
-        int v = get_bits(&s->gb, 8);
-        if(v==0){
-            av_log(s->avctx, AV_LOG_ERROR, "matrix damaged\n");
-            return -1;
-        }
-        if(intra && i==0 && v!=8){
-            av_log(s->avctx, AV_LOG_ERROR, "intra matrix invalid, ignoring\n");
-            v= 8; // needed by pink.mpg / issue1046
-        }
-        matrix0[j] = v;
-        if(matrix1)
-            matrix1[j] = v;
-    }
-    return 0;
-}
-
-static void mpeg_decode_quant_matrix_extension(MpegEncContext *s)
-{
-    dprintf(s->avctx, "matrix extension\n");
-
-    if(get_bits1(&s->gb)) load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, 1);
-    if(get_bits1(&s->gb)) load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, 0);
-    if(get_bits1(&s->gb)) load_matrix(s, s->chroma_intra_matrix, NULL           , 1);
-    if(get_bits1(&s->gb)) load_matrix(s, s->chroma_inter_matrix, NULL           , 0);
-}
-
-static void mpeg_decode_picture_coding_extension(Mpeg1Context *s1)
-{
-    MpegEncContext *s= &s1->mpeg_enc_ctx;
-
-    s->full_pel[0] = s->full_pel[1] = 0;
-    s->mpeg_f_code[0][0] = get_bits(&s->gb, 4);
-    s->mpeg_f_code[0][1] = get_bits(&s->gb, 4);
-    s->mpeg_f_code[1][0] = get_bits(&s->gb, 4);
-    s->mpeg_f_code[1][1] = get_bits(&s->gb, 4);
-    if(!s->pict_type && s1->mpeg_enc_ctx_allocated){
-        av_log(s->avctx, AV_LOG_ERROR, "Missing picture start code, guessing missing values\n");
-        if(s->mpeg_f_code[1][0] == 15 && s->mpeg_f_code[1][1]==15){
-            if(s->mpeg_f_code[0][0] == 15 && s->mpeg_f_code[0][1] == 15)
-                s->pict_type= FF_I_TYPE;
-            else
-                s->pict_type= FF_P_TYPE;
-        }else
-            s->pict_type= FF_B_TYPE;
-        s->current_picture.pict_type= s->pict_type;
-        s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
-    }
-    s->intra_dc_precision = get_bits(&s->gb, 2);
-    s->picture_structure = get_bits(&s->gb, 2);
-    s->top_field_first = get_bits1(&s->gb);
-    s->frame_pred_frame_dct = get_bits1(&s->gb);
-    s->concealment_motion_vectors = get_bits1(&s->gb);
-    s->q_scale_type = get_bits1(&s->gb);
-    s->intra_vlc_format = get_bits1(&s->gb);
-    s->alternate_scan = get_bits1(&s->gb);
-    s->repeat_first_field = get_bits1(&s->gb);
-    s->chroma_420_type = get_bits1(&s->gb);
-    s->progressive_frame = get_bits1(&s->gb);
-
-    if(s->progressive_sequence && !s->progressive_frame){
-        s->progressive_frame= 1;
-        av_log(s->avctx, AV_LOG_ERROR, "interlaced frame in progressive sequence, ignoring\n");
-    }
-
-    if(s->picture_structure==0 || (s->progressive_frame && s->picture_structure!=PICT_FRAME)){
-        av_log(s->avctx, AV_LOG_ERROR, "picture_structure %d invalid, ignoring\n", s->picture_structure);
-        s->picture_structure= PICT_FRAME;
-    }
-
-    if(s->progressive_sequence && !s->frame_pred_frame_dct){
-        av_log(s->avctx, AV_LOG_ERROR, "invalid frame_pred_frame_dct\n");
-        s->frame_pred_frame_dct= 1;
-    }
-
-    if(s->picture_structure == PICT_FRAME){
-        s->first_field=0;
-        s->v_edge_pos= 16*s->mb_height;
-    }else{
-        s->first_field ^= 1;
-        s->v_edge_pos=  8*s->mb_height;
-        memset(s->mbskip_table, 0, s->mb_stride*s->mb_height);
-    }
-
-    if(s->alternate_scan){
-        ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_alternate_vertical_scan);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_alternate_vertical_scan);
-    }else{
-        ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_zigzag_direct);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_zigzag_direct);
-    }
-
-    /* composite display not parsed */
-    dprintf(s->avctx, "intra_dc_precision=%d\n", s->intra_dc_precision);
-    dprintf(s->avctx, "picture_structure=%d\n", s->picture_structure);
-    dprintf(s->avctx, "top field first=%d\n", s->top_field_first);
-    dprintf(s->avctx, "repeat first field=%d\n", s->repeat_first_field);
-    dprintf(s->avctx, "conceal=%d\n", s->concealment_motion_vectors);
-    dprintf(s->avctx, "intra_vlc_format=%d\n", s->intra_vlc_format);
-    dprintf(s->avctx, "alternate_scan=%d\n", s->alternate_scan);
-    dprintf(s->avctx, "frame_pred_frame_dct=%d\n", s->frame_pred_frame_dct);
-    dprintf(s->avctx, "progressive_frame=%d\n", s->progressive_frame);
-}
-
-static void exchange_uv(MpegEncContext *s){
-    DCTELEM (*tmp)[64];
-
-    tmp           = s->pblocks[4];
-    s->pblocks[4] = s->pblocks[5];
-    s->pblocks[5] = tmp;
-}
-
-static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size){
-    AVCodecContext *avctx= s->avctx;
-    Mpeg1Context *s1 = (Mpeg1Context*)s;
-
-    /* start frame decoding */
-    if(s->first_field || s->picture_structure==PICT_FRAME){
-        if(MPV_frame_start(s, avctx) < 0)
-            return -1;
-
-        ff_er_frame_start(s);
-
-        /* first check if we must repeat the frame */
-        s->current_picture_ptr->repeat_pict = 0;
-        if (s->repeat_first_field) {
-            if (s->progressive_sequence) {
-                if (s->top_field_first)
-                    s->current_picture_ptr->repeat_pict = 4;
-                else
-                    s->current_picture_ptr->repeat_pict = 2;
-            } else if (s->progressive_frame) {
-                s->current_picture_ptr->repeat_pict = 1;
-            }
-        }
-
-        *s->current_picture_ptr->pan_scan= s1->pan_scan;
-    }else{ //second field
-            int i;
-
-            if(!s->current_picture_ptr){
-                av_log(s->avctx, AV_LOG_ERROR, "first field missing\n");
-                return -1;
-            }
-
-            for(i=0; i<4; i++){
-                s->current_picture.data[i] = s->current_picture_ptr->data[i];
-                if(s->picture_structure == PICT_BOTTOM_FIELD){
-                    s->current_picture.data[i] += s->current_picture_ptr->linesize[i];
-                }
-            }
-    }
-
-    if (avctx->hwaccel) {
-        if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
-            return -1;
-    }
-
-// MPV_frame_start will call this function too,
-// but we need to call it on every field
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
-        if(ff_xvmc_field_start(s,avctx) < 0)
-            return -1;
-
-    return 0;
-}
-
-#define DECODE_SLICE_ERROR -1
-#define DECODE_SLICE_OK 0
-
-/**
- * decodes a slice. MpegEncContext.mb_y must be set to the MB row from the startcode
- * @return DECODE_SLICE_ERROR if the slice is damaged<br>
- *         DECODE_SLICE_OK if this slice is ok<br>
- */
-static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
-                             const uint8_t **buf, int buf_size)
-{
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-    AVCodecContext *avctx= s->avctx;
-    const int field_pic= s->picture_structure != PICT_FRAME;
-    const int lowres= s->avctx->lowres;
-
-    s->resync_mb_x=
-    s->resync_mb_y= -1;
-
-    assert(mb_y < s->mb_height);
-
-    init_get_bits(&s->gb, *buf, buf_size*8);
-
-    ff_mpeg1_clean_buffers(s);
-    s->interlaced_dct = 0;
-
-    s->qscale = get_qscale(s);
-
-    if(s->qscale == 0){
-        av_log(s->avctx, AV_LOG_ERROR, "qscale == 0\n");
-        return -1;
-    }
-
-    /* extra slice info */
-    while (get_bits1(&s->gb) != 0) {
-        skip_bits(&s->gb, 8);
-    }
-
-    s->mb_x=0;
-
-    if(mb_y==0 && s->codec_tag == AV_RL32("SLIF")){
-        skip_bits1(&s->gb);
-    }else{
-        for(;;) {
-            int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
-            if (code < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "first mb_incr damaged\n");
-                return -1;
-            }
-            if (code >= 33) {
-                if (code == 33) {
-                    s->mb_x += 33;
-                }
-                /* otherwise, stuffing, nothing to do */
-            } else {
-                s->mb_x += code;
-                break;
-            }
-        }
-    }
-
-    if(s->mb_x >= (unsigned)s->mb_width){
-        av_log(s->avctx, AV_LOG_ERROR, "initial skip overflow\n");
-        return -1;
-    }
-
-    if (avctx->hwaccel) {
-        const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
-        int start_code = -1;
-        buf_end = ff_find_start_code(buf_start + 2, *buf + buf_size, &start_code);
-        if (buf_end < *buf + buf_size)
-            buf_end -= 4;
-        s->mb_y = mb_y;
-        if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_end - buf_start) < 0)
-            return DECODE_SLICE_ERROR;
-        *buf = buf_end;
-        return DECODE_SLICE_OK;
-    }
-
-    s->resync_mb_x= s->mb_x;
-    s->resync_mb_y= s->mb_y= mb_y;
-    s->mb_skip_run= 0;
-    ff_init_block_index(s);
-
-    if (s->mb_y==0 && s->mb_x==0 && (s->first_field || s->picture_structure==PICT_FRAME)) {
-        if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-             av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%2d%2d%2d%2d %s %s %s %s %s dc:%d pstruct:%d fdct:%d cmv:%d qtype:%d ivlc:%d rff:%d %s\n",
-                 s->qscale, s->mpeg_f_code[0][0],s->mpeg_f_code[0][1],s->mpeg_f_code[1][0],s->mpeg_f_code[1][1],
-                 s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")),
-                 s->progressive_sequence ? "ps" :"", s->progressive_frame ? "pf" : "", s->alternate_scan ? "alt" :"", s->top_field_first ? "top" :"",
-                 s->intra_dc_precision, s->picture_structure, s->frame_pred_frame_dct, s->concealment_motion_vectors,
-                 s->q_scale_type, s->intra_vlc_format, s->repeat_first_field, s->chroma_420_type ? "420" :"");
-        }
-    }
-
-    for(;;) {
-        //If 1, we memcpy blocks in xvmcvideo.
-        if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration > 1)
-            ff_xvmc_init_block(s);//set s->block
-
-        if(mpeg_decode_mb(s, s->block) < 0)
-            return -1;
-
-        if(s->current_picture.motion_val[0] && !s->encoding){ //note motion_val is normally NULL unless we want to extract the MVs
-            const int wrap = s->b8_stride;
-            int xy = s->mb_x*2 + s->mb_y*2*wrap;
-            int b8_xy= 4*(s->mb_x + s->mb_y*s->mb_stride);
-            int motion_x, motion_y, dir, i;
-
-            for(i=0; i<2; i++){
-                for(dir=0; dir<2; dir++){
-                    if (s->mb_intra || (dir==1 && s->pict_type != FF_B_TYPE)) {
-                        motion_x = motion_y = 0;
-                    }else if (s->mv_type == MV_TYPE_16X16 || (s->mv_type == MV_TYPE_FIELD && field_pic)){
-                        motion_x = s->mv[dir][0][0];
-                        motion_y = s->mv[dir][0][1];
-                    } else /*if ((s->mv_type == MV_TYPE_FIELD) || (s->mv_type == MV_TYPE_16X8))*/ {
-                        motion_x = s->mv[dir][i][0];
-                        motion_y = s->mv[dir][i][1];
-                    }
-
-                    s->current_picture.motion_val[dir][xy    ][0] = motion_x;
-                    s->current_picture.motion_val[dir][xy    ][1] = motion_y;
-                    s->current_picture.motion_val[dir][xy + 1][0] = motion_x;
-                    s->current_picture.motion_val[dir][xy + 1][1] = motion_y;
-                    s->current_picture.ref_index [dir][b8_xy    ]=
-                    s->current_picture.ref_index [dir][b8_xy + 1]= s->field_select[dir][i];
-                    assert(s->field_select[dir][i]==0 || s->field_select[dir][i]==1);
-                }
-                xy += wrap;
-                b8_xy +=2;
-            }
-        }
-
-        s->dest[0] += 16 >> lowres;
-        s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift;
-        s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift;
-
-        MPV_decode_mb(s, s->block);
-
-        if (++s->mb_x >= s->mb_width) {
-            const int mb_size= 16>>s->avctx->lowres;
-
-            ff_draw_horiz_band(s, mb_size*(s->mb_y>>field_pic), mb_size);
-
-            s->mb_x = 0;
-            s->mb_y += 1<<field_pic;
-
-            if(s->mb_y >= s->mb_height){
-                int left= get_bits_left(&s->gb);
-                int is_d10= s->chroma_format==2 && s->pict_type==FF_I_TYPE && avctx->profile==0 && avctx->level==5
-                            && s->intra_dc_precision == 2 && s->q_scale_type == 1 && s->alternate_scan == 0
-                            && s->progressive_frame == 0 /* vbv_delay == 0xBBB || 0xE10*/;
-
-                if(left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23)) && !is_d10)
-                   || (avctx->error_recognition >= FF_ER_AGGRESSIVE && left>8)){
-                    av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n", left, show_bits(&s->gb, FFMIN(left, 23)));
-                    return -1;
-                }else
-                    goto eos;
-            }
-
-            ff_init_block_index(s);
-        }
-
-        /* skip mb handling */
-        if (s->mb_skip_run == -1) {
-            /* read increment again */
-            s->mb_skip_run = 0;
-            for(;;) {
-                int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2);
-                if (code < 0){
-                    av_log(s->avctx, AV_LOG_ERROR, "mb incr damaged\n");
-                    return -1;
-                }
-                if (code >= 33) {
-                    if (code == 33) {
-                        s->mb_skip_run += 33;
-                    }else if(code == 35){
-                        if(s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0){
-                            av_log(s->avctx, AV_LOG_ERROR, "slice mismatch\n");
-                            return -1;
-                        }
-                        goto eos; /* end of slice */
-                    }
-                    /* otherwise, stuffing, nothing to do */
-                } else {
-                    s->mb_skip_run += code;
-                    break;
-                }
-            }
-            if(s->mb_skip_run){
-                int i;
-                if(s->pict_type == FF_I_TYPE){
-                    av_log(s->avctx, AV_LOG_ERROR, "skipped MB in I frame at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
-                }
-
-                /* skip mb */
-                s->mb_intra = 0;
-                for(i=0;i<12;i++)
-                    s->block_last_index[i] = -1;
-                if(s->picture_structure == PICT_FRAME)
-                    s->mv_type = MV_TYPE_16X16;
-                else
-                    s->mv_type = MV_TYPE_FIELD;
-                if (s->pict_type == FF_P_TYPE) {
-                    /* if P type, zero motion vector is implied */
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv[0][0][0] = s->mv[0][0][1] = 0;
-                    s->last_mv[0][0][0] = s->last_mv[0][0][1] = 0;
-                    s->last_mv[0][1][0] = s->last_mv[0][1][1] = 0;
-                    s->field_select[0][0]= (s->picture_structure - 1) & 1;
-                } else {
-                    /* if B type, reuse previous vectors and directions */
-                    s->mv[0][0][0] = s->last_mv[0][0][0];
-                    s->mv[0][0][1] = s->last_mv[0][0][1];
-                    s->mv[1][0][0] = s->last_mv[1][0][0];
-                    s->mv[1][0][1] = s->last_mv[1][0][1];
-                }
-            }
-        }
-    }
-eos: // end of slice
-    *buf += (get_bits_count(&s->gb)-1)/8;
-//printf("y %d %d %d %d\n", s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y);
-    return 0;
-}
-
-static int slice_decode_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= *(void**)arg;
-    const uint8_t *buf= s->gb.buffer;
-    int mb_y= s->start_mb_y;
-    const int field_pic= s->picture_structure != PICT_FRAME;
-
-    s->error_count= (3*(s->end_mb_y - s->start_mb_y)*s->mb_width) >> field_pic;
-
-    for(;;){
-        uint32_t start_code;
-        int ret;
-
-        ret= mpeg_decode_slice((Mpeg1Context*)s, mb_y, &buf, s->gb.buffer_end - buf);
-        emms_c();
-//av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
-//ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, s->end_mb_y, s->error_count);
-        if(ret < 0){
-            if(s->resync_mb_x>=0 && s->resync_mb_y>=0)
-                ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
-        }else{
-            ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
-        }
-
-        if(s->mb_y == s->end_mb_y)
-            return 0;
-
-        start_code= -1;
-        buf = ff_find_start_code(buf, s->gb.buffer_end, &start_code);
-        mb_y= start_code - SLICE_MIN_START_CODE;
-        if(mb_y < 0 || mb_y >= s->end_mb_y)
-            return -1;
-    }
-
-    return 0; //not reached
-}
-
-/**
- * Handles slice ends.
- * @return 1 if it seems to be the last slice
- */
-static int slice_end(AVCodecContext *avctx, AVFrame *pict)
-{
-    Mpeg1Context *s1 = avctx->priv_data;
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-
-    if (!s1->mpeg_enc_ctx_allocated || !s->current_picture_ptr)
-        return 0;
-
-    if (s->avctx->hwaccel) {
-        if (s->avctx->hwaccel->end_frame(s->avctx) < 0)
-            av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n");
-    }
-
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
-        ff_xvmc_field_end(s);
-
-    /* end of slice reached */
-    if (/*s->mb_y<<field_pic == s->mb_height &&*/ !s->first_field) {
-        /* end of image */
-
-        s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_MPEG2;
-
-        ff_er_frame_end(s);
-
-        MPV_frame_end(s);
-
-        if (s->pict_type == FF_B_TYPE || s->low_delay) {
-            *pict= *(AVFrame*)s->current_picture_ptr;
-            ff_print_debug_info(s, pict);
-        } else {
-            s->picture_number++;
-            /* latency of 1 frame for I- and P-frames */
-            /* XXX: use another variable than picture_number */
-            if (s->last_picture_ptr != NULL) {
-                *pict= *(AVFrame*)s->last_picture_ptr;
-                 ff_print_debug_info(s, pict);
-            }
-        }
-
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
-static int mpeg1_decode_sequence(AVCodecContext *avctx,
-                                 const uint8_t *buf, int buf_size)
-{
-    Mpeg1Context *s1 = avctx->priv_data;
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-    int width,height;
-    int i, v, j;
-
-    init_get_bits(&s->gb, buf, buf_size*8);
-
-    width = get_bits(&s->gb, 12);
-    height = get_bits(&s->gb, 12);
-    if (width <= 0 || height <= 0)
-        return -1;
-    s->aspect_ratio_info= get_bits(&s->gb, 4);
-    if (s->aspect_ratio_info == 0) {
-        av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n");
-        if (avctx->error_recognition >= FF_ER_COMPLIANT)
-            return -1;
-    }
-    s->frame_rate_index = get_bits(&s->gb, 4);
-    if (s->frame_rate_index == 0 || s->frame_rate_index > 13)
-        return -1;
-    s->bit_rate = get_bits(&s->gb, 18) * 400;
-    if (get_bits1(&s->gb) == 0) /* marker */
-        return -1;
-    s->width = width;
-    s->height = height;
-
-    s->avctx->rc_buffer_size= get_bits(&s->gb, 10) * 1024*16;
-    skip_bits(&s->gb, 1);
-
-    /* get matrix */
-    if (get_bits1(&s->gb)) {
-        load_matrix(s, s->chroma_intra_matrix, s->intra_matrix, 1);
-    } else {
-        for(i=0;i<64;i++) {
-            j = s->dsp.idct_permutation[i];
-            v = ff_mpeg1_default_intra_matrix[i];
-            s->intra_matrix[j] = v;
-            s->chroma_intra_matrix[j] = v;
-        }
-    }
-    if (get_bits1(&s->gb)) {
-        load_matrix(s, s->chroma_inter_matrix, s->inter_matrix, 0);
-    } else {
-        for(i=0;i<64;i++) {
-            int j= s->dsp.idct_permutation[i];
-            v = ff_mpeg1_default_non_intra_matrix[i];
-            s->inter_matrix[j] = v;
-            s->chroma_inter_matrix[j] = v;
-        }
-    }
-
-    if(show_bits(&s->gb, 23) != 0){
-        av_log(s->avctx, AV_LOG_ERROR, "sequence header damaged\n");
-        return -1;
-    }
-
-    /* we set MPEG-2 parameters so that it emulates MPEG-1 */
-    s->progressive_sequence = 1;
-    s->progressive_frame = 1;
-    s->picture_structure = PICT_FRAME;
-    s->frame_pred_frame_dct = 1;
-    s->chroma_format = 1;
-    s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG1VIDEO;
-    avctx->sub_id = 1; /* indicates MPEG-1 */
-    s->out_format = FMT_MPEG1;
-    s->swap_uv = 0;//AFAIK VCR2 does not have SEQ_HEADER
-    if(s->flags & CODEC_FLAG_LOW_DELAY) s->low_delay=1;
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%d\n",
-               s->avctx->rc_buffer_size, s->bit_rate);
-
-    return 0;
-}
-
-static int vcr2_init_sequence(AVCodecContext *avctx)
-{
-    Mpeg1Context *s1 = avctx->priv_data;
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-    int i, v;
-
-    /* start new MPEG-1 context decoding */
-    s->out_format = FMT_MPEG1;
-    if (s1->mpeg_enc_ctx_allocated) {
-        MPV_common_end(s);
-    }
-    s->width  = avctx->coded_width;
-    s->height = avctx->coded_height;
-    avctx->has_b_frames= 0; //true?
-    s->low_delay= 1;
-
-    avctx->pix_fmt = mpeg_get_pixelformat(avctx);
-    avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
-
-    if( avctx->pix_fmt == PIX_FMT_XVMC_MPEG2_IDCT || avctx->hwaccel ||
-        s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU )
-        if( avctx->idct_algo == FF_IDCT_AUTO )
-            avctx->idct_algo = FF_IDCT_SIMPLE;
-
-    if (MPV_common_init(s) < 0)
-        return -1;
-    exchange_uv(s);//common init reset pblocks, so we swap them here
-    s->swap_uv = 1;// in case of xvmc we need to swap uv for each MB
-    s1->mpeg_enc_ctx_allocated = 1;
-
-    for(i=0;i<64;i++) {
-        int j= s->dsp.idct_permutation[i];
-        v = ff_mpeg1_default_intra_matrix[i];
-        s->intra_matrix[j] = v;
-        s->chroma_intra_matrix[j] = v;
-
-        v = ff_mpeg1_default_non_intra_matrix[i];
-        s->inter_matrix[j] = v;
-        s->chroma_inter_matrix[j] = v;
-    }
-
-    s->progressive_sequence = 1;
-    s->progressive_frame = 1;
-    s->picture_structure = PICT_FRAME;
-    s->frame_pred_frame_dct = 1;
-    s->chroma_format = 1;
-    s->codec_id= s->avctx->codec_id= CODEC_ID_MPEG2VIDEO;
-    avctx->sub_id = 2; /* indicates MPEG-2 */
-    s1->save_width           = s->width;
-    s1->save_height          = s->height;
-    s1->save_progressive_seq = s->progressive_sequence;
-    return 0;
-}
-
-
-static void mpeg_decode_user_data(AVCodecContext *avctx,
-                                  const uint8_t *p, int buf_size)
-{
-    const uint8_t *buf_end = p+buf_size;
-
-    /* we parse the DTG active format information */
-    if (buf_end - p >= 5 &&
-        p[0] == 'D' && p[1] == 'T' && p[2] == 'G' && p[3] == '1') {
-        int flags = p[4];
-        p += 5;
-        if (flags & 0x80) {
-            /* skip event id */
-            p += 2;
-        }
-        if (flags & 0x40) {
-            if (buf_end - p < 1)
-                return;
-            avctx->dtg_active_format = p[0] & 0x0f;
-        }
-    }
-}
-
-static void mpeg_decode_gop(AVCodecContext *avctx,
-                            const uint8_t *buf, int buf_size){
-    Mpeg1Context *s1 = avctx->priv_data;
-    MpegEncContext *s = &s1->mpeg_enc_ctx;
-
-    int drop_frame_flag;
-    int time_code_hours, time_code_minutes;
-    int time_code_seconds, time_code_pictures;
-    int broken_link;
-
-    init_get_bits(&s->gb, buf, buf_size*8);
-
-    drop_frame_flag = get_bits1(&s->gb);
-
-    time_code_hours=get_bits(&s->gb,5);
-    time_code_minutes = get_bits(&s->gb,6);
-    skip_bits1(&s->gb);//marker bit
-    time_code_seconds = get_bits(&s->gb,6);
-    time_code_pictures = get_bits(&s->gb,6);
-
-    s->closed_gop = get_bits1(&s->gb);
-    /*broken_link indicate that after editing the
-      reference frames of the first B-Frames after GOP I-Frame
-      are missing (open gop)*/
-    broken_link = get_bits1(&s->gb);
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_DEBUG, "GOP (%2d:%02d:%02d.[%02d]) closed_gop=%d broken_link=%d\n",
-            time_code_hours, time_code_minutes, time_code_seconds,
-            time_code_pictures, s->closed_gop, broken_link);
-}
-/**
- * Finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s)
-{
-    int i;
-    uint32_t state= pc->state;
-
-    /* EOF considered as end of frame */
-    if (buf_size == 0)
-        return 0;
-
-/*
- 0  frame start         -> 1/4
- 1  first_SEQEXT        -> 0/2
- 2  first field start   -> 3/0
- 3  second_SEQEXT       -> 2/0
- 4  searching end
-*/
-
-    for(i=0; i<buf_size; i++){
-        assert(pc->frame_start_found>=0 && pc->frame_start_found<=4);
-        if(pc->frame_start_found&1){
-            if(state == EXT_START_CODE && (buf[i]&0xF0) != 0x80)
-                pc->frame_start_found--;
-            else if(state == EXT_START_CODE+2){
-                if((buf[i]&3) == 3) pc->frame_start_found= 0;
-                else                pc->frame_start_found= (pc->frame_start_found+1)&3;
-            }
-            state++;
-        }else{
-            i= ff_find_start_code(buf+i, buf+buf_size, &state) - buf - 1;
-            if(pc->frame_start_found==0 && state >= SLICE_MIN_START_CODE && state <= SLICE_MAX_START_CODE){
-                i++;
-                pc->frame_start_found=4;
-            }
-            if(state == SEQ_END_CODE){
-                pc->state=-1;
-                return i+1;
-            }
-            if(pc->frame_start_found==2 && state == SEQ_START_CODE)
-                pc->frame_start_found= 0;
-            if(pc->frame_start_found<4 && state == EXT_START_CODE)
-                pc->frame_start_found++;
-            if(pc->frame_start_found == 4 && (state&0xFFFFFF00) == 0x100){
-                if(state < SLICE_MIN_START_CODE || state > SLICE_MAX_START_CODE){
-                    pc->frame_start_found=0;
-                    pc->state=-1;
-                    return i-3;
-                }
-            }
-            if(pc->frame_start_found == 0 && s && state == PICTURE_START_CODE){
-                ff_fetch_timestamp(s, i-3, 1);
-            }
-        }
-    }
-    pc->state= state;
-    return END_NOT_FOUND;
-}
-
-static int decode_chunks(AVCodecContext *avctx,
-                             AVFrame *picture, int *data_size,
-                             const uint8_t *buf, int buf_size);
-
-/* handle buffering and image synchronisation */
-static int mpeg_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    Mpeg1Context *s = avctx->priv_data;
-    AVFrame *picture = data;
-    MpegEncContext *s2 = &s->mpeg_enc_ctx;
-    dprintf(avctx, "fill_buffer\n");
-
-    if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
-        /* special case for last picture */
-        if (s2->low_delay==0 && s2->next_picture_ptr) {
-            *picture= *(AVFrame*)s2->next_picture_ptr;
-            s2->next_picture_ptr= NULL;
-
-            *data_size = sizeof(AVFrame);
-        }
-        return buf_size;
-    }
-
-    if(s2->flags&CODEC_FLAG_TRUNCATED){
-        int next= ff_mpeg1_find_frame_end(&s2->parse_context, buf, buf_size, NULL);
-
-        if( ff_combine_frame(&s2->parse_context, next, (const uint8_t **)&buf, &buf_size) < 0 )
-            return buf_size;
-    }
-
-#if 0
-    if (s->repeat_field % 2 == 1) {
-        s->repeat_field++;
-        //fprintf(stderr,"\nRepeating last frame: %d -> %d! pict: %d %d", avctx->frame_number-1, avctx->frame_number,
-        //        s2->picture_number, s->repeat_field);
-        if (avctx->flags & CODEC_FLAG_REPEAT_FIELD) {
-            *data_size = sizeof(AVPicture);
-            goto the_end;
-        }
-    }
-#endif
-
-    if(s->mpeg_enc_ctx_allocated==0 && avctx->codec_tag == AV_RL32("VCR2"))
-        vcr2_init_sequence(avctx);
-
-    s->slice_count= 0;
-
-    if(avctx->extradata && !avctx->frame_number)
-        decode_chunks(avctx, picture, data_size, avctx->extradata, avctx->extradata_size);
-
-    return decode_chunks(avctx, picture, data_size, buf, buf_size);
-}
-
-static int decode_chunks(AVCodecContext *avctx,
-                             AVFrame *picture, int *data_size,
-                             const uint8_t *buf, int buf_size)
-{
-    Mpeg1Context *s = avctx->priv_data;
-    MpegEncContext *s2 = &s->mpeg_enc_ctx;
-    const uint8_t *buf_ptr = buf;
-    const uint8_t *buf_end = buf + buf_size;
-    int ret, input_size;
-    int last_code= 0;
-
-    for(;;) {
-        /* find next start code */
-        uint32_t start_code = -1;
-        buf_ptr = ff_find_start_code(buf_ptr,buf_end, &start_code);
-        if (start_code > 0x1ff){
-            if(s2->pict_type != FF_B_TYPE || avctx->skip_frame <= AVDISCARD_DEFAULT){
-                if(avctx->thread_count > 1){
-                    int i;
-
-                    avctx->execute(avctx, slice_decode_thread,  &s2->thread_context[0], NULL, s->slice_count, sizeof(void*));
-                    for(i=0; i<s->slice_count; i++)
-                        s2->error_count += s2->thread_context[i]->error_count;
-                }
-
-                if (CONFIG_MPEG_VDPAU_DECODER && avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-                    ff_vdpau_mpeg_picture_complete(s2, buf, buf_size, s->slice_count);
-
-                if (slice_end(avctx, picture)) {
-                    if(s2->last_picture_ptr || s2->low_delay) //FIXME merge with the stuff in mpeg_decode_slice
-                        *data_size = sizeof(AVPicture);
-                }
-            }
-            s2->pict_type= 0;
-            return FFMAX(0, buf_ptr - buf - s2->parse_context.last_index);
-        }
-
-        input_size = buf_end - buf_ptr;
-
-        if(avctx->debug & FF_DEBUG_STARTCODE){
-            av_log(avctx, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, buf_ptr-buf, input_size);
-        }
-
-        /* prepare data for next start code */
-        switch(start_code) {
-        case SEQ_START_CODE:
-            if(last_code == 0){
-            mpeg1_decode_sequence(avctx, buf_ptr,
-                                    input_size);
-                s->sync=1;
-            }else{
-                av_log(avctx, AV_LOG_ERROR, "ignoring SEQ_START_CODE after %X\n", last_code);
-            }
-            break;
-
-        case PICTURE_START_CODE:
-            if(last_code == 0 || last_code == SLICE_MIN_START_CODE){
-            if(mpeg_decode_postinit(avctx) < 0){
-                av_log(avctx, AV_LOG_ERROR, "mpeg_decode_postinit() failure\n");
-                return -1;
-            }
-
-            /* we have a complete image: we try to decompress it */
-            if(mpeg1_decode_picture(avctx,
-                                    buf_ptr, input_size) < 0)
-                s2->pict_type=0;
-                s2->first_slice = 1;
-            last_code= PICTURE_START_CODE;
-            }else{
-                av_log(avctx, AV_LOG_ERROR, "ignoring pic after %X\n", last_code);
-            }
-            break;
-        case EXT_START_CODE:
-            init_get_bits(&s2->gb, buf_ptr, input_size*8);
-
-            switch(get_bits(&s2->gb, 4)) {
-            case 0x1:
-                if(last_code == 0){
-                mpeg_decode_sequence_extension(s);
-                }else{
-                    av_log(avctx, AV_LOG_ERROR, "ignoring seq ext after %X\n", last_code);
-                }
-                break;
-            case 0x2:
-                mpeg_decode_sequence_display_extension(s);
-                break;
-            case 0x3:
-                mpeg_decode_quant_matrix_extension(s2);
-                break;
-            case 0x7:
-                mpeg_decode_picture_display_extension(s);
-                break;
-            case 0x8:
-                if(last_code == PICTURE_START_CODE){
-                mpeg_decode_picture_coding_extension(s);
-                }else{
-                    av_log(avctx, AV_LOG_ERROR, "ignoring pic cod ext after %X\n", last_code);
-                }
-                break;
-            }
-            break;
-        case USER_START_CODE:
-            mpeg_decode_user_data(avctx,
-                                    buf_ptr, input_size);
-            break;
-        case GOP_START_CODE:
-            if(last_code == 0){
-            s2->first_field=0;
-            mpeg_decode_gop(avctx,
-                                    buf_ptr, input_size);
-                s->sync=1;
-            }else{
-                av_log(avctx, AV_LOG_ERROR, "ignoring GOP_START_CODE after %X\n", last_code);
-            }
-            break;
-        default:
-            if (start_code >= SLICE_MIN_START_CODE &&
-                start_code <= SLICE_MAX_START_CODE && last_code!=0) {
-                const int field_pic= s2->picture_structure != PICT_FRAME;
-                int mb_y= (start_code - SLICE_MIN_START_CODE) << field_pic;
-                last_code= SLICE_MIN_START_CODE;
-
-                if(s2->picture_structure == PICT_BOTTOM_FIELD)
-                    mb_y++;
-
-                if (mb_y >= s2->mb_height){
-                    av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height);
-                    return -1;
-                }
-
-                if(s2->last_picture_ptr==NULL){
-                /* Skip B-frames if we do not have reference frames and gop is not closed */
-                    if(s2->pict_type==FF_B_TYPE){
-                        if(!s2->closed_gop)
-                            break;
-                    }
-                }
-                if(s2->pict_type==FF_I_TYPE)
-                    s->sync=1;
-                if(s2->next_picture_ptr==NULL){
-                /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
-                    if(s2->pict_type==FF_P_TYPE && !s->sync) break;
-                }
-                /* Skip B-frames if we are in a hurry. */
-                if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
-                if(  (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
-                    ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
-                    || avctx->skip_frame >= AVDISCARD_ALL)
-                    break;
-                /* Skip everything if we are in a hurry>=5. */
-                if(avctx->hurry_up>=5) break;
-
-                if (!s->mpeg_enc_ctx_allocated) break;
-
-                if(s2->codec_id == CODEC_ID_MPEG2VIDEO){
-                    if(mb_y < avctx->skip_top || mb_y >= s2->mb_height - avctx->skip_bottom)
-                        break;
-                }
-
-                if(!s2->pict_type){
-                    av_log(avctx, AV_LOG_ERROR, "Missing picture start code\n");
-                    break;
-                }
-
-                if(s2->first_slice){
-                    s2->first_slice=0;
-                    if(mpeg_field_start(s2, buf, buf_size) < 0)
-                        return -1;
-                }
-                if(!s2->current_picture_ptr){
-                    av_log(avctx, AV_LOG_ERROR, "current_picture not initialized\n");
-                    return -1;
-                }
-
-                if (avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) {
-                    s->slice_count++;
-                    break;
-                }
-
-                if(avctx->thread_count > 1){
-                    int threshold= (s2->mb_height*s->slice_count + avctx->thread_count/2) / avctx->thread_count;
-                    if(threshold <= mb_y){
-                        MpegEncContext *thread_context= s2->thread_context[s->slice_count];
-
-                        thread_context->start_mb_y= mb_y;
-                        thread_context->end_mb_y  = s2->mb_height;
-                        if(s->slice_count){
-                            s2->thread_context[s->slice_count-1]->end_mb_y= mb_y;
-                            ff_update_duplicate_context(thread_context, s2);
-                        }
-                        init_get_bits(&thread_context->gb, buf_ptr, input_size*8);
-                        s->slice_count++;
-                    }
-                    buf_ptr += 2; //FIXME add minimum number of bytes per slice
-                }else{
-                    ret = mpeg_decode_slice(s, mb_y, &buf_ptr, input_size);
-                    emms_c();
-
-                    if(ret < 0){
-                        if(s2->resync_mb_x>=0 && s2->resync_mb_y>=0)
-                            ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
-                    }else{
-                        ff_er_add_slice(s2, s2->resync_mb_x, s2->resync_mb_y, s2->mb_x-1, s2->mb_y, AC_END|DC_END|MV_END);
-                    }
-                }
-            }
-            break;
-        }
-    }
-}
-
-static void flush(AVCodecContext *avctx){
-    Mpeg1Context *s = avctx->priv_data;
-
-    s->sync=0;
-
-    ff_mpeg_flush(avctx);
-}
-
-static int mpeg_decode_end(AVCodecContext *avctx)
-{
-    Mpeg1Context *s = avctx->priv_data;
-
-    if (s->mpeg_enc_ctx_allocated)
-        MPV_common_end(&s->mpeg_enc_ctx);
-    return 0;
-}
-
-AVCodec mpeg1video_decoder = {
-    "mpeg1video",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG1VIDEO,
-    sizeof(Mpeg1Context),
-    mpeg_decode_init,
-    NULL,
-    mpeg_decode_end,
-    mpeg_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
-};
-
-AVCodec mpeg2video_decoder = {
-    "mpeg2video",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG2VIDEO,
-    sizeof(Mpeg1Context),
-    mpeg_decode_init,
-    NULL,
-    mpeg_decode_end,
-    mpeg_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
-};
-
-//legacy decoder
-AVCodec mpegvideo_decoder = {
-    "mpegvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG2VIDEO,
-    sizeof(Mpeg1Context),
-    mpeg_decode_init,
-    NULL,
-    mpeg_decode_end,
-    mpeg_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
-};
-
-#if CONFIG_MPEG_XVMC_DECODER
-static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx){
-    if( avctx->thread_count > 1)
-        return -1;
-    if( !(avctx->slice_flags & SLICE_FLAG_CODED_ORDER) )
-        return -1;
-    if( !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD) ){
-        dprintf(avctx, "mpeg12.c: XvMC decoder will work better if SLICE_FLAG_ALLOW_FIELD is set\n");
-    }
-    mpeg_decode_init(avctx);
-
-    avctx->pix_fmt = PIX_FMT_XVMC_MPEG2_IDCT;
-    avctx->xvmc_acceleration = 2;//2 - the blocks are packed!
-
-    return 0;
-}
-
-AVCodec mpeg_xvmc_decoder = {
-    "mpegvideo_xvmc",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG2VIDEO_XVMC,
-    sizeof(Mpeg1Context),
-    mpeg_mc_decode_init,
-    NULL,
-    mpeg_decode_end,
-    mpeg_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED| CODEC_CAP_HWACCEL | CODEC_CAP_DELAY,
-    .flush= flush,
-    .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"),
-};
-
-#endif
-
-#if CONFIG_MPEG_VDPAU_DECODER
-AVCodec mpeg_vdpau_decoder = {
-    "mpegvideo_vdpau",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG2VIDEO,
-    sizeof(Mpeg1Context),
-    mpeg_decode_init,
-    NULL,
-    mpeg_decode_end,
-    mpeg_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
-    .flush= flush,
-    .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video (VDPAU acceleration)"),
-};
-#endif
-
-#if CONFIG_MPEG1_VDPAU_DECODER
-AVCodec mpeg1_vdpau_decoder = {
-    "mpeg1video_vdpau",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG1VIDEO,
-    sizeof(Mpeg1Context),
-    mpeg_decode_init,
-    NULL,
-    mpeg_decode_end,
-    mpeg_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_HWACCEL_VDPAU | CODEC_CAP_DELAY,
-    .flush= flush,
-    .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video (VDPAU acceleration)"),
-};
-#endif
-
diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
deleted file mode 100644
index 30bb675..0000000
--- a/libavcodec/mpeg12.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * MPEG1/2 common code
- * Copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPEG12_H
-#define AVCODEC_MPEG12_H
-
-#include "mpegvideo.h"
-
-#define DC_VLC_BITS 9
-#define TEX_VLC_BITS 9
-
-static VLC dc_lum_vlc;
-static VLC dc_chroma_vlc;
-
-extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-void ff_mpeg12_common_init(MpegEncContext *s);
-void ff_mpeg12_init_vlcs(void);
-
-static inline int decode_dc(GetBitContext *gb, int component)
-{
-    int code, diff;
-
-    if (component == 0) {
-        code = get_vlc2(gb, dc_lum_vlc.table, DC_VLC_BITS, 2);
-    } else {
-        code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2);
-    }
-    if (code < 0){
-        av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n");
-        return 0xffff;
-    }
-    if (code == 0) {
-        diff = 0;
-    } else {
-        diff = get_xbits(gb, code);
-    }
-    return diff;
-}
-
-extern int ff_mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n);
-
-#endif /* AVCODEC_MPEG12_H */
diff --git a/libavcodec/mpeg12data.c b/libavcodec/mpeg12data.c
deleted file mode 100644
index 8b1f563..0000000
--- a/libavcodec/mpeg12data.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * MPEG1/2 tables
- * copyright (c) 2000,2001 Fabrice Bellard
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG1/2 tables.
- */
-
-#include "mpeg12data.h"
-
-const uint16_t ff_mpeg1_default_intra_matrix[64] = {
-        8, 16, 19, 22, 26, 27, 29, 34,
-        16, 16, 22, 24, 27, 29, 34, 37,
-        19, 22, 26, 27, 29, 34, 34, 38,
-        22, 22, 26, 27, 29, 34, 37, 40,
-        22, 26, 27, 29, 32, 35, 40, 48,
-        26, 27, 29, 32, 35, 40, 48, 58,
-        26, 27, 29, 34, 38, 46, 56, 69,
-        27, 29, 35, 38, 46, 56, 69, 83
-};
-
-const uint16_t ff_mpeg1_default_non_intra_matrix[64] = {
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 16, 16, 16, 16,
-};
-
-const uint16_t ff_mpeg12_vlc_dc_lum_code[12] = {
-    0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff,
-};
-const unsigned char ff_mpeg12_vlc_dc_lum_bits[12] = {
-    3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9,
-};
-
-const uint16_t ff_mpeg12_vlc_dc_chroma_code[12] = {
-    0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff,
-};
-const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12] = {
-    2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10,
-};
-
-static const uint16_t mpeg1_vlc[113][2] = {
- { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 },
- { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 },
- { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 },
- { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 },
- { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 },
- { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 },
- { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 },
- { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 },
- { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 },
- { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 },
- { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 },
- { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 },
- { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 },
- { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 },
- { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 },
- { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 },
- { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 },
- { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 },
- { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 },
- { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 },
- { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
- { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 },
- { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 },
- { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 },
- { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 },
- { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 },
- { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 },
- { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 },
- { 0x1, 6 }, /* escape */
- { 0x2, 2 }, /* EOB */
-};
-
-static const uint16_t mpeg2_vlc[113][2] = {
-  {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
-  {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
-  {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
-  {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
-  {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
-  {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
-  {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
-  {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
-  {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
-  {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15},
-  {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
-  {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
-  {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
-  {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
-  {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7},
-  {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5},
-  {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6},
-  {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9},
-  {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16},
-  {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12},
-  {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13},
-  {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16},
-  {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16},
-  {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16},
-  {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12},
-  {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13},
-  {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16},
-  {0x1d,16}, {0x1c,16}, {0x1b,16},
-  {0x01,6}, /* escape */
-  {0x06,4}, /* EOB */
-};
-
-static const int8_t mpeg1_level[111] = {
-  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,
-  1,  2,  3,  4,  5,  6,  7,  8,
-  9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18,  1,  2,  3,  4,  5,  1,
-  2,  3,  4,  1,  2,  3,  1,  2,
-  3,  1,  2,  3,  1,  2,  1,  2,
-  1,  2,  1,  2,  1,  2,  1,  2,
-  1,  2,  1,  2,  1,  2,  1,  2,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,
-};
-
-static const int8_t mpeg1_run[111] = {
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  2,  2,  2,  2,  2,  3,
-  3,  3,  3,  4,  4,  4,  5,  5,
-  5,  6,  6,  6,  7,  7,  8,  8,
-  9,  9, 10, 10, 11, 11, 12, 12,
- 13, 13, 14, 14, 15, 15, 16, 16,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31,
-};
-
-RLTable ff_rl_mpeg1 = {
-    111,
-    111,
-    mpeg1_vlc,
-    mpeg1_run,
-    mpeg1_level,
-};
-
-RLTable ff_rl_mpeg2 = {
-    111,
-    111,
-    mpeg2_vlc,
-    mpeg1_run,
-    mpeg1_level,
-};
-
-const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] = {
-    {0x1, 1},
-    {0x3, 3},
-    {0x2, 3},
-    {0x3, 4},
-    {0x2, 4},
-    {0x3, 5},
-    {0x2, 5},
-    {0x7, 7},
-    {0x6, 7},
-    {0xb, 8},
-    {0xa, 8},
-    {0x9, 8},
-    {0x8, 8},
-    {0x7, 8},
-    {0x6, 8},
-    {0x17, 10},
-    {0x16, 10},
-    {0x15, 10},
-    {0x14, 10},
-    {0x13, 10},
-    {0x12, 10},
-    {0x23, 11},
-    {0x22, 11},
-    {0x21, 11},
-    {0x20, 11},
-    {0x1f, 11},
-    {0x1e, 11},
-    {0x1d, 11},
-    {0x1c, 11},
-    {0x1b, 11},
-    {0x1a, 11},
-    {0x19, 11},
-    {0x18, 11},
-    {0x8, 11}, /* escape */
-    {0xf, 11}, /* stuffing */
-    {0x0, 8}, /* end (and 15 more 0 bits should follow) */
-};
-
-const uint8_t ff_mpeg12_mbPatTable[64][2] = {
-    {0x1, 9},
-    {0xb, 5},
-    {0x9, 5},
-    {0xd, 6},
-    {0xd, 4},
-    {0x17, 7},
-    {0x13, 7},
-    {0x1f, 8},
-    {0xc, 4},
-    {0x16, 7},
-    {0x12, 7},
-    {0x1e, 8},
-    {0x13, 5},
-    {0x1b, 8},
-    {0x17, 8},
-    {0x13, 8},
-    {0xb, 4},
-    {0x15, 7},
-    {0x11, 7},
-    {0x1d, 8},
-    {0x11, 5},
-    {0x19, 8},
-    {0x15, 8},
-    {0x11, 8},
-    {0xf, 6},
-    {0xf, 8},
-    {0xd, 8},
-    {0x3, 9},
-    {0xf, 5},
-    {0xb, 8},
-    {0x7, 8},
-    {0x7, 9},
-    {0xa, 4},
-    {0x14, 7},
-    {0x10, 7},
-    {0x1c, 8},
-    {0xe, 6},
-    {0xe, 8},
-    {0xc, 8},
-    {0x2, 9},
-    {0x10, 5},
-    {0x18, 8},
-    {0x14, 8},
-    {0x10, 8},
-    {0xe, 5},
-    {0xa, 8},
-    {0x6, 8},
-    {0x6, 9},
-    {0x12, 5},
-    {0x1a, 8},
-    {0x16, 8},
-    {0x12, 8},
-    {0xd, 5},
-    {0x9, 8},
-    {0x5, 8},
-    {0x5, 9},
-    {0xc, 5},
-    {0x8, 8},
-    {0x4, 8},
-    {0x4, 9},
-    {0x7, 3},
-    {0xa, 5},
-    {0x8, 5},
-    {0xc, 6}
-};
-
-const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = {
-{ 0x1, 1 },
-{ 0x1, 2 },
-{ 0x1, 3 },
-{ 0x1, 4 },
-{ 0x3, 6 },
-{ 0x5, 7 },
-{ 0x4, 7 },
-{ 0x3, 7 },
-{ 0xb, 9 },
-{ 0xa, 9 },
-{ 0x9, 9 },
-{ 0x11, 10 },
-{ 0x10, 10 },
-{ 0xf, 10 },
-{ 0xe, 10 },
-{ 0xd, 10 },
-{ 0xc, 10 },
-};
-
-const AVRational ff_frame_rate_tab[] = {
-    {    0,    0},
-    {24000, 1001},
-    {   24,    1},
-    {   25,    1},
-    {30000, 1001},
-    {   30,    1},
-    {   50,    1},
-    {60000, 1001},
-    {   60,    1},
-  // Xing's 15fps: (9)
-    {   15,    1},
-  // libmpeg3's "Unofficial economy rates": (10-13)
-    {    5,    1},
-    {   10,    1},
-    {   12,    1},
-    {   15,    1},
-    {    0,    0},
-};
-
-const float ff_mpeg1_aspect[16]={
-    0.0000,
-    1.0000,
-    0.6735,
-    0.7031,
-
-    0.7615,
-    0.8055,
-    0.8437,
-    0.8935,
-
-    0.9157,
-    0.9815,
-    1.0255,
-    1.0695,
-
-    1.0950,
-    1.1575,
-    1.2015,
-};
-
-const AVRational ff_mpeg2_aspect[16]={
-    {0,1},
-    {1,1},
-    {4,3},
-    {16,9},
-    {221,100},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-    {0,1},
-};
diff --git a/libavcodec/mpeg12data.h b/libavcodec/mpeg12data.h
deleted file mode 100644
index 9695e9d..0000000
--- a/libavcodec/mpeg12data.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * MPEG1/2 tables
- * copyright (c) 2000,2001 Fabrice Bellard
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG1/2 tables.
- */
-
-#ifndef AVCODEC_MPEG12DATA_H
-#define AVCODEC_MPEG12DATA_H
-
-#include <stdint.h>
-#include "libavutil/rational.h"
-#include "rl.h"
-
-extern const uint16_t ff_mpeg1_default_intra_matrix[64];
-extern const uint16_t ff_mpeg1_default_non_intra_matrix[64];
-
-extern const uint16_t ff_mpeg12_vlc_dc_lum_code[12];
-extern const unsigned char ff_mpeg12_vlc_dc_lum_bits[12];
-extern const uint16_t ff_mpeg12_vlc_dc_chroma_code[12];
-extern const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12];
-
-extern RLTable ff_rl_mpeg1;
-extern RLTable ff_rl_mpeg2;
-
-extern const uint8_t ff_mpeg12_mbAddrIncrTable[36][2];
-extern const uint8_t ff_mpeg12_mbPatTable[64][2];
-
-extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2];
-
-extern const AVRational ff_frame_rate_tab[];
-
-extern const float ff_mpeg1_aspect[16];
-extern const AVRational ff_mpeg2_aspect[16];
-
-#endif /* AVCODEC_MPEG12DATA_H */
diff --git a/libavcodec/mpeg12decdata.h b/libavcodec/mpeg12decdata.h
deleted file mode 100644
index 66ca5c4..0000000
--- a/libavcodec/mpeg12decdata.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * MPEG1/2 decoder tables
- * copyright (c) 2000,2001 Fabrice Bellard
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG1/2 decoder tables.
- */
-
-#ifndef AVCODEC_MPEG12DECDATA_H
-#define AVCODEC_MPEG12DECDATA_H
-
-#include <stdint.h>
-#include "mpegvideo.h"
-
-
-#define MB_TYPE_ZERO_MV   0x20000000
-#define IS_ZERO_MV(a)   ((a)&MB_TYPE_ZERO_MV)
-
-static const uint8_t table_mb_ptype[7][2] = {
-    { 3, 5 }, // 0x01 MB_INTRA
-    { 1, 2 }, // 0x02 MB_PAT
-    { 1, 3 }, // 0x08 MB_FOR
-    { 1, 1 }, // 0x0A MB_FOR|MB_PAT
-    { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
-    { 1, 5 }, // 0x12 MB_QUANT|MB_PAT
-    { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
-};
-
-static const uint32_t ptype2mb_type[7] = {
-                    MB_TYPE_INTRA,
-                    MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
-                    MB_TYPE_L0,
-                    MB_TYPE_L0 | MB_TYPE_CBP,
-    MB_TYPE_QUANT | MB_TYPE_INTRA,
-    MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP | MB_TYPE_ZERO_MV | MB_TYPE_16x16,
-    MB_TYPE_QUANT | MB_TYPE_L0 | MB_TYPE_CBP,
-};
-
-static const uint8_t table_mb_btype[11][2] = {
-    { 3, 5 }, // 0x01 MB_INTRA
-    { 2, 3 }, // 0x04 MB_BACK
-    { 3, 3 }, // 0x06 MB_BACK|MB_PAT
-    { 2, 4 }, // 0x08 MB_FOR
-    { 3, 4 }, // 0x0A MB_FOR|MB_PAT
-    { 2, 2 }, // 0x0C MB_FOR|MB_BACK
-    { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT
-    { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA
-    { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT
-    { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT
-    { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT
-};
-
-static const uint32_t btype2mb_type[11] = {
-                    MB_TYPE_INTRA,
-                    MB_TYPE_L1,
-                    MB_TYPE_L1   | MB_TYPE_CBP,
-                    MB_TYPE_L0,
-                    MB_TYPE_L0   | MB_TYPE_CBP,
-                    MB_TYPE_L0L1,
-                    MB_TYPE_L0L1 | MB_TYPE_CBP,
-    MB_TYPE_QUANT | MB_TYPE_INTRA,
-    MB_TYPE_QUANT | MB_TYPE_L1   | MB_TYPE_CBP,
-    MB_TYPE_QUANT | MB_TYPE_L0   | MB_TYPE_CBP,
-    MB_TYPE_QUANT | MB_TYPE_L0L1 | MB_TYPE_CBP,
-};
-
-static const uint8_t non_linear_qscale[32] = {
-    0, 1, 2, 3, 4, 5, 6, 7,
-    8,10,12,14,16,18,20,22,
-    24,28,32,36,40,44,48,52,
-    56,64,72,80,88,96,104,112,
-};
-
-#endif /* AVCODEC_MPEG12DECDATA_H */
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
deleted file mode 100644
index bf36129..0000000
--- a/libavcodec/mpeg12enc.c
+++ /dev/null
@@ -1,959 +0,0 @@
-/*
- * MPEG1/2 encoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG1/2 encoder
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-
-#include "mpeg12.h"
-#include "mpeg12data.h"
-#include "bytestream.h"
-
-
-static const uint8_t inv_non_linear_qscale[13] = {
-    0, 2, 4, 6, 8,
-    9,10,11,12,13,14,15,16,
-};
-
-static const uint8_t svcd_scan_offset_placeholder[14] = {
-    0x10, 0x0E,
-    0x00, 0x80, 0x81,
-    0x00, 0x80, 0x81,
-    0xff, 0xff, 0xff,
-    0xff, 0xff, 0xff,
-};
-
-static void mpeg1_encode_block(MpegEncContext *s,
-                         DCTELEM *block,
-                         int component);
-static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code);    // RAL: f_code parameter added
-
-static uint8_t mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
-static uint8_t fcode_tab[MAX_MV*2+1];
-
-static uint8_t  uni_mpeg1_ac_vlc_len [64*64*2];
-static uint8_t  uni_mpeg2_ac_vlc_len [64*64*2];
-
-/* simple include everything table for dc, first byte is bits number next 3 are code*/
-static uint32_t mpeg1_lum_dc_uni[512];
-static uint32_t mpeg1_chr_dc_uni[512];
-
-static uint8_t mpeg1_index_run[2][64];
-static int8_t mpeg1_max_level[2][64];
-
-static void init_uni_ac_vlc(RLTable *rl, uint8_t *uni_ac_vlc_len){
-    int i;
-
-    for(i=0; i<128; i++){
-        int level= i-64;
-        int run;
-        for(run=0; run<64; run++){
-            int len, bits, code;
-
-            int alevel= FFABS(level);
-            int sign= (level>>31)&1;
-
-            if (alevel > rl->max_level[0][run])
-                code= 111; /*rl->n*/
-            else
-                code= rl->index_run[0][run] + alevel - 1;
-
-            if (code < 111 /* rl->n */) {
-                /* store the vlc & sign at once */
-                len=   rl->table_vlc[code][1]+1;
-                bits= (rl->table_vlc[code][0]<<1) + sign;
-            } else {
-                len=  rl->table_vlc[111/*rl->n*/][1]+6;
-                bits= rl->table_vlc[111/*rl->n*/][0]<<6;
-
-                bits|= run;
-                if (alevel < 128) {
-                    bits<<=8; len+=8;
-                    bits|= level & 0xff;
-                } else {
-                    bits<<=16; len+=16;
-                    bits|= level & 0xff;
-                    if (level < 0) {
-                        bits|= 0x8001 + level + 255;
-                    } else {
-                        bits|= level & 0xffff;
-                    }
-                }
-            }
-
-            uni_ac_vlc_len [UNI_AC_ENC_INDEX(run, i)]= len;
-        }
-    }
-}
-
-
-static int find_frame_rate_index(MpegEncContext *s){
-    int i;
-    int64_t dmin= INT64_MAX;
-    int64_t d;
-
-    for(i=1;i<14;i++) {
-        int64_t n0= 1001LL/ff_frame_rate_tab[i].den*ff_frame_rate_tab[i].num*s->avctx->time_base.num;
-        int64_t n1= 1001LL*s->avctx->time_base.den;
-        if(s->avctx->strict_std_compliance > FF_COMPLIANCE_INOFFICIAL && i>=9) break;
-
-        d = FFABS(n0 - n1);
-        if(d < dmin){
-            dmin=d;
-            s->frame_rate_index= i;
-        }
-    }
-    if(dmin)
-        return -1;
-    else
-        return 0;
-}
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    if(MPV_encode_init(avctx) < 0)
-        return -1;
-
-    if(find_frame_rate_index(s) < 0){
-        if(s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
-            av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d fps\n", avctx->time_base.den, avctx->time_base.num);
-            return -1;
-        }else{
-            av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, there may be AV sync issues\n", avctx->time_base.den, avctx->time_base.num);
-        }
-    }
-
-    if(avctx->profile == FF_PROFILE_UNKNOWN){
-        if(avctx->level != FF_LEVEL_UNKNOWN){
-            av_log(avctx, AV_LOG_ERROR, "Set profile and level\n");
-            return -1;
-        }
-        avctx->profile = s->chroma_format == CHROMA_420 ? 4 : 0; /* Main or 4:2:2 */
-    }
-
-    if(avctx->level == FF_LEVEL_UNKNOWN){
-        if(avctx->profile == 0){ /* 4:2:2 */
-            if(avctx->width <= 720 && avctx->height <= 608) avctx->level = 5; /* Main */
-            else                                            avctx->level = 2; /* High */
-        }else{
-            if(avctx->profile != 1 && s->chroma_format != CHROMA_420){
-                av_log(avctx, AV_LOG_ERROR, "Only High(1) and 4:2:2(0) profiles support 4:2:2 color sampling\n");
-                return -1;
-            }
-            if(avctx->width <= 720 && avctx->height <= 576) avctx->level = 8; /* Main */
-            else if(avctx->width <= 1440)                   avctx->level = 6; /* High 1440 */
-            else                                            avctx->level = 4; /* High */
-        }
-    }
-
-    if((avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) && s->frame_rate_index != 4){
-        av_log(avctx, AV_LOG_ERROR, "Drop frame time code only allowed with 1001/30000 fps\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static void put_header(MpegEncContext *s, int header)
-{
-    align_put_bits(&s->pb);
-    put_bits(&s->pb, 16, header>>16);
-    put_sbits(&s->pb, 16, header);
-}
-
-/* put sequence header if needed */
-static void mpeg1_encode_sequence_header(MpegEncContext *s)
-{
-        unsigned int vbv_buffer_size;
-        unsigned int fps, v;
-        int i;
-        uint64_t time_code;
-        float best_aspect_error= 1E10;
-        float aspect_ratio= av_q2d(s->avctx->sample_aspect_ratio);
-        int constraint_parameter_flag;
-
-        if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA)
-
-        if (s->current_picture.key_frame) {
-            AVRational framerate= ff_frame_rate_tab[s->frame_rate_index];
-
-            /* mpeg1 header repeated every gop */
-            put_header(s, SEQ_START_CODE);
-
-            put_sbits(&s->pb, 12, s->width );
-            put_sbits(&s->pb, 12, s->height);
-
-            for(i=1; i<15; i++){
-                float error= aspect_ratio;
-                if(s->codec_id == CODEC_ID_MPEG1VIDEO || i <=1)
-                    error-= 1.0/ff_mpeg1_aspect[i];
-                else
-                    error-= av_q2d(ff_mpeg2_aspect[i])*s->height/s->width;
-
-                error= FFABS(error);
-
-                if(error < best_aspect_error){
-                    best_aspect_error= error;
-                    s->aspect_ratio_info= i;
-                }
-            }
-
-            put_bits(&s->pb, 4, s->aspect_ratio_info);
-            put_bits(&s->pb, 4, s->frame_rate_index);
-
-            if(s->avctx->rc_max_rate){
-                v = (s->avctx->rc_max_rate + 399) / 400;
-                if (v > 0x3ffff && s->codec_id == CODEC_ID_MPEG1VIDEO)
-                    v = 0x3ffff;
-            }else{
-                v= 0x3FFFF;
-            }
-
-            if(s->avctx->rc_buffer_size)
-                vbv_buffer_size = s->avctx->rc_buffer_size;
-            else
-                /* VBV calculation: Scaled so that a VCD has the proper VBV size of 40 kilobytes */
-                vbv_buffer_size = (( 20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024;
-            vbv_buffer_size= (vbv_buffer_size + 16383) / 16384;
-
-            put_sbits(&s->pb, 18, v);
-            put_bits(&s->pb, 1, 1); /* marker */
-            put_sbits(&s->pb, 10, vbv_buffer_size);
-
-            constraint_parameter_flag=
-                s->width <= 768 && s->height <= 576 &&
-                s->mb_width * s->mb_height <= 396 &&
-                s->mb_width * s->mb_height * framerate.num <= framerate.den*396*25 &&
-                framerate.num <= framerate.den*30 &&
-                s->avctx->me_range && s->avctx->me_range < 128 &&
-                vbv_buffer_size <= 20 &&
-                v <= 1856000/400 &&
-                s->codec_id == CODEC_ID_MPEG1VIDEO;
-
-            put_bits(&s->pb, 1, constraint_parameter_flag);
-
-            ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
-            ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
-
-            if(s->codec_id == CODEC_ID_MPEG2VIDEO){
-                put_header(s, EXT_START_CODE);
-                put_bits(&s->pb, 4, 1); //seq ext
-
-                put_bits(&s->pb, 1, s->avctx->profile == 0); //escx 1 for 4:2:2 profile */
-
-                put_bits(&s->pb, 3, s->avctx->profile); //profile
-                put_bits(&s->pb, 4, s->avctx->level); //level
-
-                put_bits(&s->pb, 1, s->progressive_sequence);
-                put_bits(&s->pb, 2, s->chroma_format);
-                put_bits(&s->pb, 2, s->width >>12);
-                put_bits(&s->pb, 2, s->height>>12);
-                put_bits(&s->pb, 12, v>>18); //bitrate ext
-                put_bits(&s->pb, 1, 1); //marker
-                put_bits(&s->pb, 8, vbv_buffer_size >>10); //vbv buffer ext
-                put_bits(&s->pb, 1, s->low_delay);
-                put_bits(&s->pb, 2, 0); // frame_rate_ext_n
-                put_bits(&s->pb, 5, 0); // frame_rate_ext_d
-            }
-
-            put_header(s, GOP_START_CODE);
-            put_bits(&s->pb, 1, !!(s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE)); /* drop frame flag */
-            /* time code : we must convert from the real frame rate to a
-               fake mpeg frame rate in case of low frame rate */
-            fps = (framerate.num + framerate.den/2)/ framerate.den;
-            time_code = s->current_picture_ptr->coded_picture_number + s->avctx->timecode_frame_start;
-
-            s->gop_picture_number = s->current_picture_ptr->coded_picture_number;
-            if (s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) {
-                /* only works for NTSC 29.97 */
-                int d = time_code / 17982;
-                int m = time_code % 17982;
-                //if (m < 2) m += 2; /* not needed since -2,-1 / 1798 in C returns 0 */
-                time_code += 18 * d + 2 * ((m - 2) / 1798);
-            }
-            put_bits(&s->pb, 5, (uint32_t)((time_code / (fps * 3600)) % 24));
-            put_bits(&s->pb, 6, (uint32_t)((time_code / (fps * 60)) % 60));
-            put_bits(&s->pb, 1, 1);
-            put_bits(&s->pb, 6, (uint32_t)((time_code / fps) % 60));
-            put_bits(&s->pb, 6, (uint32_t)((time_code % fps)));
-            put_bits(&s->pb, 1, !!(s->flags & CODEC_FLAG_CLOSED_GOP));
-            put_bits(&s->pb, 1, 0); /* broken link */
-        }
-}
-
-static inline void encode_mb_skip_run(MpegEncContext *s, int run){
-    while (run >= 33) {
-        put_bits(&s->pb, 11, 0x008);
-        run -= 33;
-    }
-    put_bits(&s->pb, ff_mpeg12_mbAddrIncrTable[run][1],
-             ff_mpeg12_mbAddrIncrTable[run][0]);
-}
-
-static av_always_inline void put_qscale(MpegEncContext *s)
-{
-    if(s->q_scale_type){
-        assert(s->qscale>=1 && s->qscale <=12);
-        put_bits(&s->pb, 5, inv_non_linear_qscale[s->qscale]);
-    }else{
-        put_bits(&s->pb, 5, s->qscale);
-    }
-}
-
-void ff_mpeg1_encode_slice_header(MpegEncContext *s){
-    if (s->height > 2800) {
-        put_header(s, SLICE_MIN_START_CODE + (s->mb_y & 127));
-        put_bits(&s->pb, 3, s->mb_y >> 7);  /* slice_vertical_position_extension */
-    } else {
-        put_header(s, SLICE_MIN_START_CODE + s->mb_y);
-    }
-    put_qscale(s);
-    put_bits(&s->pb, 1, 0); /* slice extra information */
-}
-
-void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number)
-{
-    mpeg1_encode_sequence_header(s);
-
-    /* mpeg1 picture header */
-    put_header(s, PICTURE_START_CODE);
-    /* temporal reference */
-
-    // RAL: s->picture_number instead of s->fake_picture_number
-    put_bits(&s->pb, 10, (s->picture_number -
-                          s->gop_picture_number) & 0x3ff);
-    put_bits(&s->pb, 3, s->pict_type);
-
-    s->vbv_delay_ptr= s->pb.buf + put_bits_count(&s->pb)/8;
-    put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */
-
-    // RAL: Forward f_code also needed for B frames
-    if (s->pict_type == FF_P_TYPE || s->pict_type == FF_B_TYPE) {
-        put_bits(&s->pb, 1, 0); /* half pel coordinates */
-        if(s->codec_id == CODEC_ID_MPEG1VIDEO)
-            put_bits(&s->pb, 3, s->f_code); /* forward_f_code */
-        else
-            put_bits(&s->pb, 3, 7); /* forward_f_code */
-    }
-
-    // RAL: Backward f_code necessary for B frames
-    if (s->pict_type == FF_B_TYPE) {
-        put_bits(&s->pb, 1, 0); /* half pel coordinates */
-        if(s->codec_id == CODEC_ID_MPEG1VIDEO)
-            put_bits(&s->pb, 3, s->b_code); /* backward_f_code */
-        else
-            put_bits(&s->pb, 3, 7); /* backward_f_code */
-    }
-
-    put_bits(&s->pb, 1, 0); /* extra bit picture */
-
-    s->frame_pred_frame_dct = 1;
-    if(s->codec_id == CODEC_ID_MPEG2VIDEO){
-        put_header(s, EXT_START_CODE);
-        put_bits(&s->pb, 4, 8); //pic ext
-        if (s->pict_type == FF_P_TYPE || s->pict_type == FF_B_TYPE) {
-            put_bits(&s->pb, 4, s->f_code);
-            put_bits(&s->pb, 4, s->f_code);
-        }else{
-            put_bits(&s->pb, 8, 255);
-        }
-        if (s->pict_type == FF_B_TYPE) {
-            put_bits(&s->pb, 4, s->b_code);
-            put_bits(&s->pb, 4, s->b_code);
-        }else{
-            put_bits(&s->pb, 8, 255);
-        }
-        put_bits(&s->pb, 2, s->intra_dc_precision);
-
-        assert(s->picture_structure == PICT_FRAME);
-        put_bits(&s->pb, 2, s->picture_structure);
-        if (s->progressive_sequence) {
-            put_bits(&s->pb, 1, 0); /* no repeat */
-        } else {
-            put_bits(&s->pb, 1, s->current_picture_ptr->top_field_first);
-        }
-        /* XXX: optimize the generation of this flag with entropy
-           measures */
-        s->frame_pred_frame_dct = s->progressive_sequence;
-
-        put_bits(&s->pb, 1, s->frame_pred_frame_dct);
-        put_bits(&s->pb, 1, s->concealment_motion_vectors);
-        put_bits(&s->pb, 1, s->q_scale_type);
-        put_bits(&s->pb, 1, s->intra_vlc_format);
-        put_bits(&s->pb, 1, s->alternate_scan);
-        put_bits(&s->pb, 1, s->repeat_first_field);
-        s->progressive_frame = s->progressive_sequence;
-        put_bits(&s->pb, 1, s->chroma_format == CHROMA_420 ? s->progressive_frame : 0); /* chroma_420_type */
-        put_bits(&s->pb, 1, s->progressive_frame);
-        put_bits(&s->pb, 1, 0); //composite_display_flag
-    }
-    if(s->flags & CODEC_FLAG_SVCD_SCAN_OFFSET){
-        int i;
-
-        put_header(s, USER_START_CODE);
-        for(i=0; i<sizeof(svcd_scan_offset_placeholder); i++){
-            put_bits(&s->pb, 8, svcd_scan_offset_placeholder[i]);
-        }
-    }
-
-    s->mb_y=0;
-    ff_mpeg1_encode_slice_header(s);
-}
-
-static inline void put_mb_modes(MpegEncContext *s, int n, int bits,
-                                int has_mv, int field_motion)
-{
-    put_bits(&s->pb, n, bits);
-    if (!s->frame_pred_frame_dct) {
-        if (has_mv)
-            put_bits(&s->pb, 2, 2 - field_motion); /* motion_type: frame/field */
-        put_bits(&s->pb, 1, s->interlaced_dct);
-    }
-}
-
-static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s,
-                                                   DCTELEM block[6][64],
-                                                   int motion_x, int motion_y,
-                                                   int mb_block_count)
-{
-    int i, cbp;
-    const int mb_x = s->mb_x;
-    const int mb_y = s->mb_y;
-    const int first_mb= mb_x == s->resync_mb_x && mb_y == s->resync_mb_y;
-
-    /* compute cbp */
-    cbp = 0;
-    for(i=0;i<mb_block_count;i++) {
-        if (s->block_last_index[i] >= 0)
-            cbp |= 1 << (mb_block_count - 1 - i);
-    }
-
-    if (cbp == 0 && !first_mb && s->mv_type == MV_TYPE_16X16 &&
-        (mb_x != s->mb_width - 1 || (mb_y != s->mb_height - 1 && s->codec_id == CODEC_ID_MPEG1VIDEO)) &&
-        ((s->pict_type == FF_P_TYPE && (motion_x | motion_y) == 0) ||
-        (s->pict_type == FF_B_TYPE && s->mv_dir == s->last_mv_dir && (((s->mv_dir & MV_DIR_FORWARD) ? ((s->mv[0][0][0] - s->last_mv[0][0][0])|(s->mv[0][0][1] - s->last_mv[0][0][1])) : 0) |
-        ((s->mv_dir & MV_DIR_BACKWARD) ? ((s->mv[1][0][0] - s->last_mv[1][0][0])|(s->mv[1][0][1] - s->last_mv[1][0][1])) : 0)) == 0))) {
-        s->mb_skip_run++;
-        s->qscale -= s->dquant;
-        s->skip_count++;
-        s->misc_bits++;
-        s->last_bits++;
-        if(s->pict_type == FF_P_TYPE){
-            s->last_mv[0][1][0]= s->last_mv[0][0][0]=
-            s->last_mv[0][1][1]= s->last_mv[0][0][1]= 0;
-        }
-    } else {
-        if(first_mb){
-            assert(s->mb_skip_run == 0);
-            encode_mb_skip_run(s, s->mb_x);
-        }else{
-            encode_mb_skip_run(s, s->mb_skip_run);
-        }
-
-        if (s->pict_type == FF_I_TYPE) {
-            if(s->dquant && cbp){
-                put_mb_modes(s, 2, 1, 0, 0); /* macroblock_type : macroblock_quant = 1 */
-                put_qscale(s);
-            }else{
-                put_mb_modes(s, 1, 1, 0, 0); /* macroblock_type : macroblock_quant = 0 */
-                s->qscale -= s->dquant;
-            }
-            s->misc_bits+= get_bits_diff(s);
-            s->i_count++;
-        } else if (s->mb_intra) {
-            if(s->dquant && cbp){
-                put_mb_modes(s, 6, 0x01, 0, 0);
-                put_qscale(s);
-            }else{
-                put_mb_modes(s, 5, 0x03, 0, 0);
-                s->qscale -= s->dquant;
-            }
-            s->misc_bits+= get_bits_diff(s);
-            s->i_count++;
-            memset(s->last_mv, 0, sizeof(s->last_mv));
-        } else if (s->pict_type == FF_P_TYPE) {
-            if(s->mv_type == MV_TYPE_16X16){
-                if (cbp != 0) {
-                    if ((motion_x|motion_y) == 0) {
-                        if(s->dquant){
-                            put_mb_modes(s, 5, 1, 0, 0); /* macroblock_pattern & quant */
-                            put_qscale(s);
-                        }else{
-                            put_mb_modes(s, 2, 1, 0, 0); /* macroblock_pattern only */
-                        }
-                        s->misc_bits+= get_bits_diff(s);
-                    } else {
-                        if(s->dquant){
-                            put_mb_modes(s, 5, 2, 1, 0); /* motion + cbp */
-                            put_qscale(s);
-                        }else{
-                            put_mb_modes(s, 1, 1, 1, 0); /* motion + cbp */
-                        }
-                        s->misc_bits+= get_bits_diff(s);
-                        mpeg1_encode_motion(s, motion_x - s->last_mv[0][0][0], s->f_code);    // RAL: f_code parameter added
-                        mpeg1_encode_motion(s, motion_y - s->last_mv[0][0][1], s->f_code);    // RAL: f_code parameter added
-                        s->mv_bits+= get_bits_diff(s);
-                    }
-                } else {
-                    put_bits(&s->pb, 3, 1); /* motion only */
-                    if (!s->frame_pred_frame_dct)
-                        put_bits(&s->pb, 2, 2); /* motion_type: frame */
-                    s->misc_bits+= get_bits_diff(s);
-                    mpeg1_encode_motion(s, motion_x - s->last_mv[0][0][0], s->f_code);    // RAL: f_code parameter added
-                    mpeg1_encode_motion(s, motion_y - s->last_mv[0][0][1], s->f_code);    // RAL: f_code parameter added
-                    s->qscale -= s->dquant;
-                    s->mv_bits+= get_bits_diff(s);
-                }
-                s->last_mv[0][1][0]= s->last_mv[0][0][0]= motion_x;
-                s->last_mv[0][1][1]= s->last_mv[0][0][1]= motion_y;
-            }else{
-                assert(!s->frame_pred_frame_dct && s->mv_type == MV_TYPE_FIELD);
-
-                if (cbp) {
-                    if(s->dquant){
-                        put_mb_modes(s, 5, 2, 1, 1); /* motion + cbp */
-                        put_qscale(s);
-                    }else{
-                        put_mb_modes(s, 1, 1, 1, 1); /* motion + cbp */
-                    }
-                } else {
-                    put_bits(&s->pb, 3, 1); /* motion only */
-                    put_bits(&s->pb, 2, 1); /* motion_type: field */
-                    s->qscale -= s->dquant;
-                }
-                s->misc_bits+= get_bits_diff(s);
-                for(i=0; i<2; i++){
-                    put_bits(&s->pb, 1, s->field_select[0][i]);
-                    mpeg1_encode_motion(s, s->mv[0][i][0] -  s->last_mv[0][i][0]    , s->f_code);
-                    mpeg1_encode_motion(s, s->mv[0][i][1] - (s->last_mv[0][i][1]>>1), s->f_code);
-                    s->last_mv[0][i][0]=   s->mv[0][i][0];
-                    s->last_mv[0][i][1]= 2*s->mv[0][i][1];
-                }
-                s->mv_bits+= get_bits_diff(s);
-            }
-            if(cbp) {
-                if (s->chroma_y_shift) {
-                    put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp][1], ff_mpeg12_mbPatTable[cbp][0]);
-                } else {
-                    put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp>>2][1], ff_mpeg12_mbPatTable[cbp>>2][0]);
-                    put_sbits(&s->pb, 2, cbp);
-                }
-            }
-            s->f_count++;
-        } else{
-            if(s->mv_type == MV_TYPE_16X16){
-                if (cbp){    // With coded bloc pattern
-                    if (s->dquant) {
-                        if(s->mv_dir == MV_DIR_FORWARD)
-                            put_mb_modes(s, 6, 3, 1, 0);
-                        else
-                            put_mb_modes(s, 8-s->mv_dir, 2, 1, 0);
-                        put_qscale(s);
-                    } else {
-                        put_mb_modes(s, 5-s->mv_dir, 3, 1, 0);
-                    }
-                }else{    // No coded bloc pattern
-                    put_bits(&s->pb, 5-s->mv_dir, 2);
-                    if (!s->frame_pred_frame_dct)
-                        put_bits(&s->pb, 2, 2); /* motion_type: frame */
-                    s->qscale -= s->dquant;
-                }
-                s->misc_bits += get_bits_diff(s);
-                if (s->mv_dir&MV_DIR_FORWARD){
-                    mpeg1_encode_motion(s, s->mv[0][0][0] - s->last_mv[0][0][0], s->f_code);
-                    mpeg1_encode_motion(s, s->mv[0][0][1] - s->last_mv[0][0][1], s->f_code);
-                    s->last_mv[0][0][0]=s->last_mv[0][1][0]= s->mv[0][0][0];
-                    s->last_mv[0][0][1]=s->last_mv[0][1][1]= s->mv[0][0][1];
-                    s->f_count++;
-                }
-                if (s->mv_dir&MV_DIR_BACKWARD){
-                    mpeg1_encode_motion(s, s->mv[1][0][0] - s->last_mv[1][0][0], s->b_code);
-                    mpeg1_encode_motion(s, s->mv[1][0][1] - s->last_mv[1][0][1], s->b_code);
-                    s->last_mv[1][0][0]=s->last_mv[1][1][0]= s->mv[1][0][0];
-                    s->last_mv[1][0][1]=s->last_mv[1][1][1]= s->mv[1][0][1];
-                    s->b_count++;
-                }
-            }else{
-                assert(s->mv_type == MV_TYPE_FIELD);
-                assert(!s->frame_pred_frame_dct);
-                if (cbp){    // With coded bloc pattern
-                    if (s->dquant) {
-                        if(s->mv_dir == MV_DIR_FORWARD)
-                            put_mb_modes(s, 6, 3, 1, 1);
-                        else
-                            put_mb_modes(s, 8-s->mv_dir, 2, 1, 1);
-                        put_qscale(s);
-                    } else {
-                        put_mb_modes(s, 5-s->mv_dir, 3, 1, 1);
-                    }
-                }else{    // No coded bloc pattern
-                    put_bits(&s->pb, 5-s->mv_dir, 2);
-                    put_bits(&s->pb, 2, 1); /* motion_type: field */
-                    s->qscale -= s->dquant;
-                }
-                s->misc_bits += get_bits_diff(s);
-                if (s->mv_dir&MV_DIR_FORWARD){
-                    for(i=0; i<2; i++){
-                        put_bits(&s->pb, 1, s->field_select[0][i]);
-                        mpeg1_encode_motion(s, s->mv[0][i][0] -  s->last_mv[0][i][0]    , s->f_code);
-                        mpeg1_encode_motion(s, s->mv[0][i][1] - (s->last_mv[0][i][1]>>1), s->f_code);
-                        s->last_mv[0][i][0]=   s->mv[0][i][0];
-                        s->last_mv[0][i][1]= 2*s->mv[0][i][1];
-                    }
-                    s->f_count++;
-                }
-                if (s->mv_dir&MV_DIR_BACKWARD){
-                    for(i=0; i<2; i++){
-                        put_bits(&s->pb, 1, s->field_select[1][i]);
-                        mpeg1_encode_motion(s, s->mv[1][i][0] -  s->last_mv[1][i][0]    , s->b_code);
-                        mpeg1_encode_motion(s, s->mv[1][i][1] - (s->last_mv[1][i][1]>>1), s->b_code);
-                        s->last_mv[1][i][0]=   s->mv[1][i][0];
-                        s->last_mv[1][i][1]= 2*s->mv[1][i][1];
-                    }
-                    s->b_count++;
-                }
-            }
-            s->mv_bits += get_bits_diff(s);
-            if(cbp) {
-                if (s->chroma_y_shift) {
-                    put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp][1], ff_mpeg12_mbPatTable[cbp][0]);
-                } else {
-                    put_bits(&s->pb, ff_mpeg12_mbPatTable[cbp>>2][1], ff_mpeg12_mbPatTable[cbp>>2][0]);
-                    put_sbits(&s->pb, 2, cbp);
-                }
-            }
-        }
-        for(i=0;i<mb_block_count;i++) {
-            if (cbp & (1 << (mb_block_count - 1 - i))) {
-                mpeg1_encode_block(s, block[i], i);
-            }
-        }
-        s->mb_skip_run = 0;
-        if(s->mb_intra)
-            s->i_tex_bits+= get_bits_diff(s);
-        else
-            s->p_tex_bits+= get_bits_diff(s);
-    }
-}
-
-void mpeg1_encode_mb(MpegEncContext *s, DCTELEM block[6][64], int motion_x, int motion_y)
-{
-    if (s->chroma_format == CHROMA_420) mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 6);
-    else                                mpeg1_encode_mb_internal(s, block, motion_x, motion_y, 8);
-}
-
-// RAL: Parameter added: f_or_b_code
-static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code)
-{
-    if (val == 0) {
-        /* zero vector */
-        put_bits(&s->pb,
-                 ff_mpeg12_mbMotionVectorTable[0][1],
-                 ff_mpeg12_mbMotionVectorTable[0][0]);
-    } else {
-        int code, sign, bits;
-        int bit_size = f_or_b_code - 1;
-        int range = 1 << bit_size;
-        /* modulo encoding */
-        int l= INT_BIT - 5 - bit_size;
-        val= (val<<l)>>l;
-
-        if (val >= 0) {
-            val--;
-            code = (val >> bit_size) + 1;
-            bits = val & (range - 1);
-            sign = 0;
-        } else {
-            val = -val;
-            val--;
-            code = (val >> bit_size) + 1;
-            bits = val & (range - 1);
-            sign = 1;
-        }
-
-        assert(code > 0 && code <= 16);
-
-        put_bits(&s->pb,
-                 ff_mpeg12_mbMotionVectorTable[code][1],
-                 ff_mpeg12_mbMotionVectorTable[code][0]);
-
-        put_bits(&s->pb, 1, sign);
-        if (bit_size > 0) {
-            put_bits(&s->pb, bit_size, bits);
-        }
-    }
-}
-
-void ff_mpeg1_encode_init(MpegEncContext *s)
-{
-    static int done=0;
-
-    ff_mpeg12_common_init(s);
-
-    if(!done){
-        int f_code;
-        int mv;
-        int i;
-
-        done=1;
-        init_rl(&ff_rl_mpeg1, ff_mpeg12_static_rl_table_store[0]);
-        init_rl(&ff_rl_mpeg2, ff_mpeg12_static_rl_table_store[1]);
-
-        for(i=0; i<64; i++)
-        {
-                mpeg1_max_level[0][i]= ff_rl_mpeg1.max_level[0][i];
-                mpeg1_index_run[0][i]= ff_rl_mpeg1.index_run[0][i];
-        }
-
-        init_uni_ac_vlc(&ff_rl_mpeg1, uni_mpeg1_ac_vlc_len);
-        if(s->intra_vlc_format)
-            init_uni_ac_vlc(&ff_rl_mpeg2, uni_mpeg2_ac_vlc_len);
-
-        /* build unified dc encoding tables */
-        for(i=-255; i<256; i++)
-        {
-                int adiff, index;
-                int bits, code;
-                int diff=i;
-
-                adiff = FFABS(diff);
-                if(diff<0) diff--;
-                index = av_log2(2*adiff);
-
-                bits= ff_mpeg12_vlc_dc_lum_bits[index] + index;
-                code= (ff_mpeg12_vlc_dc_lum_code[index]<<index) + (diff & ((1 << index) - 1));
-                mpeg1_lum_dc_uni[i+255]= bits + (code<<8);
-
-                bits= ff_mpeg12_vlc_dc_chroma_bits[index] + index;
-                code= (ff_mpeg12_vlc_dc_chroma_code[index]<<index) + (diff & ((1 << index) - 1));
-                mpeg1_chr_dc_uni[i+255]= bits + (code<<8);
-        }
-
-        for(f_code=1; f_code<=MAX_FCODE; f_code++){
-            for(mv=-MAX_MV; mv<=MAX_MV; mv++){
-                int len;
-
-                if(mv==0) len= ff_mpeg12_mbMotionVectorTable[0][1];
-                else{
-                    int val, bit_size, range, code;
-
-                    bit_size = f_code - 1;
-                    range = 1 << bit_size;
-
-                    val=mv;
-                    if (val < 0)
-                        val = -val;
-                    val--;
-                    code = (val >> bit_size) + 1;
-                    if(code<17){
-                        len= ff_mpeg12_mbMotionVectorTable[code][1] + 1 + bit_size;
-                    }else{
-                        len= ff_mpeg12_mbMotionVectorTable[16][1] + 2 + bit_size;
-                    }
-                }
-
-                mv_penalty[f_code][mv+MAX_MV]= len;
-            }
-        }
-
-
-        for(f_code=MAX_FCODE; f_code>0; f_code--){
-            for(mv=-(8<<f_code); mv<(8<<f_code); mv++){
-                fcode_tab[mv+MAX_MV]= f_code;
-            }
-        }
-    }
-    s->me.mv_penalty= mv_penalty;
-    s->fcode_tab= fcode_tab;
-    if(s->codec_id == CODEC_ID_MPEG1VIDEO){
-        s->min_qcoeff=-255;
-        s->max_qcoeff= 255;
-    }else{
-        s->min_qcoeff=-2047;
-        s->max_qcoeff= 2047;
-    }
-    if (s->intra_vlc_format) {
-        s->intra_ac_vlc_length=
-        s->intra_ac_vlc_last_length= uni_mpeg2_ac_vlc_len;
-    } else {
-        s->intra_ac_vlc_length=
-        s->intra_ac_vlc_last_length= uni_mpeg1_ac_vlc_len;
-    }
-    s->inter_ac_vlc_length=
-    s->inter_ac_vlc_last_length= uni_mpeg1_ac_vlc_len;
-}
-
-static inline void encode_dc(MpegEncContext *s, int diff, int component)
-{
-  if(((unsigned) (diff+255)) >= 511){
-        int index;
-
-        if(diff<0){
-            index= av_log2_16bit(-2*diff);
-            diff--;
-        }else{
-            index= av_log2_16bit(2*diff);
-        }
-        if (component == 0) {
-            put_bits(
-                &s->pb,
-                ff_mpeg12_vlc_dc_lum_bits[index] + index,
-                (ff_mpeg12_vlc_dc_lum_code[index]<<index) + (diff & ((1 << index) - 1)));
-        }else{
-            put_bits(
-                &s->pb,
-                ff_mpeg12_vlc_dc_chroma_bits[index] + index,
-                (ff_mpeg12_vlc_dc_chroma_code[index]<<index) + (diff & ((1 << index) - 1)));
-        }
-  }else{
-    if (component == 0) {
-        put_bits(
-            &s->pb,
-            mpeg1_lum_dc_uni[diff+255]&0xFF,
-            mpeg1_lum_dc_uni[diff+255]>>8);
-    } else {
-        put_bits(
-            &s->pb,
-            mpeg1_chr_dc_uni[diff+255]&0xFF,
-            mpeg1_chr_dc_uni[diff+255]>>8);
-    }
-  }
-}
-
-static void mpeg1_encode_block(MpegEncContext *s,
-                               DCTELEM *block,
-                               int n)
-{
-    int alevel, level, last_non_zero, dc, diff, i, j, run, last_index, sign;
-    int code, component;
-    const uint16_t (*table_vlc)[2] = ff_rl_mpeg1.table_vlc;
-
-    last_index = s->block_last_index[n];
-
-    /* DC coef */
-    if (s->mb_intra) {
-        component = (n <= 3 ? 0 : (n&1) + 1);
-        dc = block[0]; /* overflow is impossible */
-        diff = dc - s->last_dc[component];
-        encode_dc(s, diff, component);
-        s->last_dc[component] = dc;
-        i = 1;
-        if (s->intra_vlc_format)
-            table_vlc = ff_rl_mpeg2.table_vlc;
-    } else {
-        /* encode the first coefficient : needs to be done here because
-           it is handled slightly differently */
-        level = block[0];
-        if (abs(level) == 1) {
-                code = ((uint32_t)level >> 31); /* the sign bit */
-                put_bits(&s->pb, 2, code | 0x02);
-                i = 1;
-        } else {
-            i = 0;
-            last_non_zero = -1;
-            goto next_coef;
-        }
-    }
-
-    /* now quantify & encode AC coefs */
-    last_non_zero = i - 1;
-
-    for(;i<=last_index;i++) {
-        j = s->intra_scantable.permutated[i];
-        level = block[j];
-    next_coef:
-#if 0
-        if (level != 0)
-            dprintf(s->avctx, "level[%d]=%d\n", i, level);
-#endif
-        /* encode using VLC */
-        if (level != 0) {
-            run = i - last_non_zero - 1;
-
-            alevel= level;
-            MASK_ABS(sign, alevel)
-            sign&=1;
-
-            if (alevel <= mpeg1_max_level[0][run]){
-                code= mpeg1_index_run[0][run] + alevel - 1;
-                /* store the vlc & sign at once */
-                put_bits(&s->pb, table_vlc[code][1]+1, (table_vlc[code][0]<<1) + sign);
-            } else {
-                /* escape seems to be pretty rare <5% so I do not optimize it */
-                put_bits(&s->pb, table_vlc[111][1], table_vlc[111][0]);
-                /* escape: only clip in this case */
-                put_bits(&s->pb, 6, run);
-                if(s->codec_id == CODEC_ID_MPEG1VIDEO){
-                    if (alevel < 128) {
-                        put_sbits(&s->pb, 8, level);
-                    } else {
-                        if (level < 0) {
-                            put_bits(&s->pb, 16, 0x8001 + level + 255);
-                        } else {
-                            put_sbits(&s->pb, 16, level);
-                        }
-                    }
-                }else{
-                    put_sbits(&s->pb, 12, level);
-                }
-            }
-            last_non_zero = i;
-        }
-    }
-    /* end of block */
-    put_bits(&s->pb, table_vlc[112][1], table_vlc[112][0]);
-}
-
-AVCodec mpeg1video_encoder = {
-    "mpeg1video",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG1VIDEO,
-    sizeof(MpegEncContext),
-    encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .supported_framerates= ff_frame_rate_tab+1,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .capabilities= CODEC_CAP_DELAY,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-1 video"),
-};
-
-AVCodec mpeg2video_encoder = {
-    "mpeg2video",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG2VIDEO,
-    sizeof(MpegEncContext),
-    encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .supported_framerates= ff_frame_rate_tab+1,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE},
-    .capabilities= CODEC_CAP_DELAY,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-2 video"),
-};
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
deleted file mode 100644
index 7507212..0000000
--- a/libavcodec/mpeg4audio.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * MPEG-4 Audio common code
- * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier at free.fr>
- * Copyright (c) 2009 Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "get_bits.h"
-#include "put_bits.h"
-#include "mpeg4audio.h"
-
-/**
- * Parse MPEG-4 audio configuration for ALS object type.
- * @param[in] gb       bit reader context
- * @param[in] c        MPEG4AudioConfig structure to fill
- * @return on success 0 is returned, otherwise a value < 0
- */
-static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c)
-{
-    if (get_bits_left(gb) < 112)
-        return -1;
-
-    if (get_bits_long(gb, 32) != MKBETAG('A','L','S','\0'))
-        return -1;
-
-    // override AudioSpecificConfig channel configuration and sample rate
-    // which are buggy in old ALS conformance files
-    c->sample_rate = get_bits_long(gb, 32);
-
-    // skip number of samples
-    skip_bits_long(gb, 32);
-
-    // read number of channels
-    c->chan_config = 0;
-    c->channels    = get_bits(gb, 16) + 1;
-
-    return 0;
-}
-
-const int ff_mpeg4audio_sample_rates[16] = {
-    96000, 88200, 64000, 48000, 44100, 32000,
-    24000, 22050, 16000, 12000, 11025, 8000, 7350
-};
-
-const uint8_t ff_mpeg4audio_channels[8] = {
-    0, 1, 2, 3, 4, 5, 6, 8
-};
-
-static inline int get_object_type(GetBitContext *gb)
-{
-    int object_type = get_bits(gb, 5);
-    if (object_type == AOT_ESCAPE)
-        object_type = 32 + get_bits(gb, 6);
-    return object_type;
-}
-
-static inline int get_sample_rate(GetBitContext *gb, int *index)
-{
-    *index = get_bits(gb, 4);
-    return *index == 0x0f ? get_bits(gb, 24) :
-        ff_mpeg4audio_sample_rates[*index];
-}
-
-int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size)
-{
-    GetBitContext gb;
-    int specific_config_bitindex;
-
-    init_get_bits(&gb, buf, buf_size*8);
-    c->object_type = get_object_type(&gb);
-    c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
-    c->chan_config = get_bits(&gb, 4);
-    if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
-        c->channels = ff_mpeg4audio_channels[c->chan_config];
-    c->sbr = -1;
-    c->ps  = -1;
-    if (c->object_type == AOT_SBR || (c->object_type == AOT_PS &&
-        // check for W6132 Annex YYYY draft MP3onMP4
-        !(show_bits(&gb, 3) & 0x03 && !(show_bits(&gb, 9) & 0x3F)))) {
-        if (c->object_type == AOT_PS)
-            c->ps = 1;
-        c->ext_object_type = AOT_SBR;
-        c->sbr = 1;
-        c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index);
-        c->object_type = get_object_type(&gb);
-        if (c->object_type == AOT_ER_BSAC)
-            c->ext_chan_config = get_bits(&gb, 4);
-    } else {
-        c->ext_object_type = AOT_NULL;
-        c->ext_sample_rate = 0;
-    }
-    specific_config_bitindex = get_bits_count(&gb);
-
-    if (c->object_type == AOT_ALS) {
-        skip_bits(&gb, 5);
-        if (show_bits_long(&gb, 24) != MKBETAG('\0','A','L','S'))
-            skip_bits_long(&gb, 24);
-
-        specific_config_bitindex = get_bits_count(&gb);
-
-        if (parse_config_ALS(&gb, c))
-            return -1;
-    }
-
-    if (c->ext_object_type != AOT_SBR) {
-        while (get_bits_left(&gb) > 15) {
-            if (show_bits(&gb, 11) == 0x2b7) { // sync extension
-                get_bits(&gb, 11);
-                c->ext_object_type = get_object_type(&gb);
-                if (c->ext_object_type == AOT_SBR && (c->sbr = get_bits1(&gb)) == 1)
-                    c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index);
-                if (get_bits_left(&gb) > 11 && get_bits(&gb, 11) == 0x548)
-                    c->ps = get_bits1(&gb);
-                break;
-            } else
-                get_bits1(&gb); // skip 1 bit
-        }
-    }
-    return specific_config_bitindex;
-}
-
-static av_always_inline unsigned int copy_bits(PutBitContext *pb,
-                                               GetBitContext *gb,
-                                               int bits)
-{
-    unsigned int el = get_bits(gb, bits);
-    put_bits(pb, bits, el);
-    return el;
-}
-
-int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb)
-{
-    int five_bit_ch, four_bit_ch, comment_size, bits;
-    int offset = put_bits_count(pb);
-
-    copy_bits(pb, gb, 10);                  //Tag, Object Type, Frequency
-    five_bit_ch  = copy_bits(pb, gb, 4);    //Front
-    five_bit_ch += copy_bits(pb, gb, 4);    //Side
-    five_bit_ch += copy_bits(pb, gb, 4);    //Back
-    four_bit_ch  = copy_bits(pb, gb, 2);    //LFE
-    four_bit_ch += copy_bits(pb, gb, 3);    //Data
-    five_bit_ch += copy_bits(pb, gb, 4);    //Coupling
-    if (copy_bits(pb, gb, 1))               //Mono Mixdown
-        copy_bits(pb, gb, 4);
-    if (copy_bits(pb, gb, 1))               //Stereo Mixdown
-        copy_bits(pb, gb, 4);
-    if (copy_bits(pb, gb, 1))               //Matrix Mixdown
-        copy_bits(pb, gb, 3);
-    for (bits = five_bit_ch*5+four_bit_ch*4; bits > 16; bits -= 16)
-        copy_bits(pb, gb, 16);
-    if (bits)
-        copy_bits(pb, gb, bits);
-    align_put_bits(pb);
-    align_get_bits(gb);
-    comment_size = copy_bits(pb, gb, 8);
-    for (; comment_size > 0; comment_size--)
-        copy_bits(pb, gb, 8);
-
-    return put_bits_count(pb) - offset;
-}
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
deleted file mode 100644
index b941850..0000000
--- a/libavcodec/mpeg4audio.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * MPEG-4 Audio common header
- * Copyright (c) 2008 Baptiste Coudurier <baptiste.coudurier at free.fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPEG4AUDIO_H
-#define AVCODEC_MPEG4AUDIO_H
-
-#include <stdint.h>
-#include "get_bits.h"
-#include "put_bits.h"
-
-typedef struct {
-    int object_type;
-    int sampling_index;
-    int sample_rate;
-    int chan_config;
-    int sbr; //< -1 implicit, 1 presence
-    int ext_object_type;
-    int ext_sampling_index;
-    int ext_sample_rate;
-    int ext_chan_config;
-    int channels;
-    int ps;  //< -1 implicit, 1 presence
-} MPEG4AudioConfig;
-
-extern const int ff_mpeg4audio_sample_rates[16];
-extern const uint8_t ff_mpeg4audio_channels[8];
-/**
- * Parse MPEG-4 systems extradata to retrieve audio configuration.
- * @param[in] c        MPEG4AudioConfig structure to fill.
- * @param[in] buf      Extradata from container.
- * @param[in] buf_size Extradata size.
- * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata.
- */
-int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size);
-
-enum AudioObjectType {
-    AOT_NULL,
-                               // Support?                Name
-    AOT_AAC_MAIN,              ///< Y                       Main
-    AOT_AAC_LC,                ///< Y                       Low Complexity
-    AOT_AAC_SSR,               ///< N (code in SoC repo)    Scalable Sample Rate
-    AOT_AAC_LTP,               ///< N (code in SoC repo)    Long Term Prediction
-    AOT_SBR,                   ///< Y                       Spectral Band Replication
-    AOT_AAC_SCALABLE,          ///< N                       Scalable
-    AOT_TWINVQ,                ///< N                       Twin Vector Quantizer
-    AOT_CELP,                  ///< N                       Code Excited Linear Prediction
-    AOT_HVXC,                  ///< N                       Harmonic Vector eXcitation Coding
-    AOT_TTSI             = 12, ///< N                       Text-To-Speech Interface
-    AOT_MAINSYNTH,             ///< N                       Main Synthesis
-    AOT_WAVESYNTH,             ///< N                       Wavetable Synthesis
-    AOT_MIDI,                  ///< N                       General MIDI
-    AOT_SAFX,                  ///< N                       Algorithmic Synthesis and Audio Effects
-    AOT_ER_AAC_LC,             ///< N                       Error Resilient Low Complexity
-    AOT_ER_AAC_LTP       = 19, ///< N                       Error Resilient Long Term Prediction
-    AOT_ER_AAC_SCALABLE,       ///< N                       Error Resilient Scalable
-    AOT_ER_TWINVQ,             ///< N                       Error Resilient Twin Vector Quantizer
-    AOT_ER_BSAC,               ///< N                       Error Resilient Bit-Sliced Arithmetic Coding
-    AOT_ER_AAC_LD,             ///< N                       Error Resilient Low Delay
-    AOT_ER_CELP,               ///< N                       Error Resilient Code Excited Linear Prediction
-    AOT_ER_HVXC,               ///< N                       Error Resilient Harmonic Vector eXcitation Coding
-    AOT_ER_HILN,               ///< N                       Error Resilient Harmonic and Individual Lines plus Noise
-    AOT_ER_PARAM,              ///< N                       Error Resilient Parametric
-    AOT_SSC,                   ///< N                       SinuSoidal Coding
-    AOT_PS,                    ///< N                       Parametric Stereo
-    AOT_SURROUND,              ///< N                       MPEG Surround
-    AOT_ESCAPE,                ///< Y                       Escape Value
-    AOT_L1,                    ///< Y                       Layer 1
-    AOT_L2,                    ///< Y                       Layer 2
-    AOT_L3,                    ///< Y                       Layer 3
-    AOT_DST,                   ///< N                       Direct Stream Transfer
-    AOT_ALS,                   ///< Y                       Audio LosslesS
-    AOT_SLS,                   ///< N                       Scalable LosslesS
-    AOT_SLS_NON_CORE,          ///< N                       Scalable LosslesS (non core)
-    AOT_ER_AAC_ELD,            ///< N                       Error Resilient Enhanced Low Delay
-    AOT_SMR_SIMPLE,            ///< N                       Symbolic Music Representation Simple
-    AOT_SMR_MAIN,              ///< N                       Symbolic Music Representation Main
-    AOT_USAC_NOSBR,            ///< N                       Unified Speech and Audio Coding (no SBR)
-    AOT_SAOC,                  ///< N                       Spatial Audio Object Coding
-    AOT_LD_SURROUND,           ///< N                       Low Delay MPEG Surround
-    AOT_USAC,                  ///< N                       Unified Speech and Audio Coding
-};
-
-#define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE
-                         ///<marker and the comment
-
-int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb);
-
-#endif /* AVCODEC_MPEG4AUDIO_H */
diff --git a/libavcodec/mpeg4data.h b/libavcodec/mpeg4data.h
deleted file mode 100644
index bef5f88..0000000
--- a/libavcodec/mpeg4data.h
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * copyright (c) 2000,2001 Fabrice Bellard
- * H263+ support
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mpeg4 tables.
- */
-
-#ifndef AVCODEC_MPEG4DATA_H
-#define AVCODEC_MPEG4DATA_H
-
-#include <stdint.h>
-#include "mpegvideo.h"
-
-/* dc encoding for mpeg4 */
-const uint8_t ff_mpeg4_DCtab_lum[13][2] =
-{
-    {3,3}, {3,2}, {2,2}, {2,3}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7},
-    {1,8}, {1,9}, {1,10}, {1,11},
-};
-
-const uint8_t ff_mpeg4_DCtab_chrom[13][2] =
-{
-    {3,2}, {2,2}, {1,2}, {1,3}, {1,4}, {1,5}, {1,6}, {1,7}, {1,8},
-    {1,9}, {1,10}, {1,11}, {1,12},
-};
-
-const uint16_t ff_mpeg4_intra_vlc[103][2] = {
-{ 0x2, 2 },
-{ 0x6, 3 },{ 0xf, 4 },{ 0xd, 5 },{ 0xc, 5 },
-{ 0x15, 6 },{ 0x13, 6 },{ 0x12, 6 },{ 0x17, 7 },
-{ 0x1f, 8 },{ 0x1e, 8 },{ 0x1d, 8 },{ 0x25, 9 },
-{ 0x24, 9 },{ 0x23, 9 },{ 0x21, 9 },{ 0x21, 10 },
-{ 0x20, 10 },{ 0xf, 10 },{ 0xe, 10 },{ 0x7, 11 },
-{ 0x6, 11 },{ 0x20, 11 },{ 0x21, 11 },{ 0x50, 12 },
-{ 0x51, 12 },{ 0x52, 12 },{ 0xe, 4 },{ 0x14, 6 },
-{ 0x16, 7 },{ 0x1c, 8 },{ 0x20, 9 },{ 0x1f, 9 },
-{ 0xd, 10 },{ 0x22, 11 },{ 0x53, 12 },{ 0x55, 12 },
-{ 0xb, 5 },{ 0x15, 7 },{ 0x1e, 9 },{ 0xc, 10 },
-{ 0x56, 12 },{ 0x11, 6 },{ 0x1b, 8 },{ 0x1d, 9 },
-{ 0xb, 10 },{ 0x10, 6 },{ 0x22, 9 },{ 0xa, 10 },
-{ 0xd, 6 },{ 0x1c, 9 },{ 0x8, 10 },{ 0x12, 7 },
-{ 0x1b, 9 },{ 0x54, 12 },{ 0x14, 7 },{ 0x1a, 9 },
-{ 0x57, 12 },{ 0x19, 8 },{ 0x9, 10 },{ 0x18, 8 },
-{ 0x23, 11 },{ 0x17, 8 },{ 0x19, 9 },{ 0x18, 9 },
-{ 0x7, 10 },{ 0x58, 12 },{ 0x7, 4 },{ 0xc, 6 },
-{ 0x16, 8 },{ 0x17, 9 },{ 0x6, 10 },{ 0x5, 11 },
-{ 0x4, 11 },{ 0x59, 12 },{ 0xf, 6 },{ 0x16, 9 },
-{ 0x5, 10 },{ 0xe, 6 },{ 0x4, 10 },{ 0x11, 7 },
-{ 0x24, 11 },{ 0x10, 7 },{ 0x25, 11 },{ 0x13, 7 },
-{ 0x5a, 12 },{ 0x15, 8 },{ 0x5b, 12 },{ 0x14, 8 },
-{ 0x13, 8 },{ 0x1a, 8 },{ 0x15, 9 },{ 0x14, 9 },
-{ 0x13, 9 },{ 0x12, 9 },{ 0x11, 9 },{ 0x26, 11 },
-{ 0x27, 11 },{ 0x5c, 12 },{ 0x5d, 12 },{ 0x5e, 12 },
-{ 0x5f, 12 },{ 0x3, 7 },
-};
-
-const int8_t ff_mpeg4_intra_level[102] = {
-  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,  1,  2,  3,  4,  5,
-  6,  7,  8,  9, 10,  1,  2,  3,
-  4,  5,  1,  2,  3,  4,  1,  2,
-  3,  1,  2,  3,  1,  2,  3,  1,
-  2,  3,  1,  2,  1,  2,  1,  1,
-  1,  1,  1,  1,  2,  3,  4,  5,
-  6,  7,  8,  1,  2,  3,  1,  2,
-  1,  2,  1,  2,  1,  2,  1,  2,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,
-};
-
-const int8_t ff_mpeg4_intra_run[102] = {
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  2,  2,  2,
-  2,  2,  3,  3,  3,  3,  4,  4,
-  4,  5,  5,  5,  6,  6,  6,  7,
-  7,  7,  8,  8,  9,  9, 10, 11,
- 12, 13, 14,  0,  0,  0,  0,  0,
-  0,  0,  0,  1,  1,  1,  2,  2,
-  3,  3,  4,  4,  5,  5,  6,  6,
-  7,  8,  9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20,
-};
-
-RLTable ff_mpeg4_rl_intra = {
-    102,
-    67,
-    ff_mpeg4_intra_vlc,
-    ff_mpeg4_intra_run,
-    ff_mpeg4_intra_level,
-};
-
-/* Note this is identical to the intra rvlc except that it is reordered. */
-const uint16_t inter_rvlc[170][2]={
-{0x0006,  3},{0x0001,  4},{0x0004,  5},{0x001C,  7},
-{0x003C,  8},{0x003D,  8},{0x007C,  9},{0x00FC, 10},
-{0x00FD, 10},{0x01FC, 11},{0x01FD, 11},{0x03FC, 12},
-{0x07FC, 13},{0x07FD, 13},{0x0BFC, 13},{0x0BFD, 13},
-{0x0FFC, 14},{0x0FFD, 14},{0x1FFC, 15},{0x0007,  3},
-{0x000C,  6},{0x005C,  8},{0x007D,  9},{0x017C, 10},
-{0x02FC, 11},{0x03FD, 12},{0x0DFC, 13},{0x17FC, 14},
-{0x17FD, 14},{0x000A,  4},{0x001D,  7},{0x00BC,  9},
-{0x02FD, 11},{0x05FC, 12},{0x1BFC, 14},{0x1BFD, 14},
-{0x0005,  5},{0x005D,  8},{0x017D, 10},{0x05FD, 12},
-{0x0DFD, 13},{0x1DFC, 14},{0x1FFD, 15},{0x0008,  5},
-{0x006C,  8},{0x037C, 11},{0x0EFC, 13},{0x2FFC, 15},
-{0x0009,  5},{0x00BD,  9},{0x037D, 11},{0x0EFD, 13},
-{0x000D,  6},{0x01BC, 10},{0x06FC, 12},{0x1DFD, 14},
-{0x0014,  6},{0x01BD, 10},{0x06FD, 12},{0x2FFD, 15},
-{0x0015,  6},{0x01DC, 10},{0x0F7C, 13},{0x002C,  7},
-{0x01DD, 10},{0x1EFC, 14},{0x002D,  7},{0x03BC, 11},
-{0x0034,  7},{0x077C, 12},{0x006D,  8},{0x0F7D, 13},
-{0x0074,  8},{0x1EFD, 14},{0x0075,  8},{0x1F7C, 14},
-{0x00DC,  9},{0x1F7D, 14},{0x00DD,  9},{0x1FBC, 14},
-{0x00EC,  9},{0x37FC, 15},{0x01EC, 10},{0x01ED, 10},
-{0x01F4, 10},{0x03BD, 11},{0x03DC, 11},{0x03DD, 11},
-{0x03EC, 11},{0x03ED, 11},{0x03F4, 11},{0x077D, 12},
-{0x07BC, 12},{0x07BD, 12},{0x0FBC, 13},{0x0FBD, 13},
-{0x0FDC, 13},{0x0FDD, 13},{0x1FBD, 14},{0x1FDC, 14},
-{0x1FDD, 14},{0x37FD, 15},{0x3BFC, 15},
-{0x000B,  4},{0x0078,  8},{0x03F5, 11},{0x0FEC, 13},
-{0x1FEC, 14},{0x0012,  5},{0x00ED,  9},{0x07DC, 12},
-{0x1FED, 14},{0x3BFD, 15},{0x0013,  5},{0x03F8, 11},
-{0x3DFC, 15},{0x0018,  6},{0x07DD, 12},{0x0019,  6},
-{0x07EC, 12},{0x0022,  6},{0x0FED, 13},{0x0023,  6},
-{0x0FF4, 13},{0x0035,  7},{0x0FF5, 13},{0x0038,  7},
-{0x0FF8, 13},{0x0039,  7},{0x0FF9, 13},{0x0042,  7},
-{0x1FF4, 14},{0x0043,  7},{0x1FF5, 14},{0x0079,  8},
-{0x1FF8, 14},{0x0082,  8},{0x3DFD, 15},{0x0083,  8},
-{0x00F4,  9},{0x00F5,  9},{0x00F8,  9},{0x00F9,  9},
-{0x0102,  9},{0x0103,  9},{0x01F5, 10},{0x01F8, 10},
-{0x01F9, 10},{0x0202, 10},{0x0203, 10},{0x03F9, 11},
-{0x0402, 11},{0x0403, 11},{0x07ED, 12},{0x07F4, 12},
-{0x07F5, 12},{0x07F8, 12},{0x07F9, 12},{0x0802, 12},
-{0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14},
-{0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15},
-{0x3F7C, 15},{0x3F7D, 15},{0x0000, 4}
-};
-
-static const int8_t inter_rvlc_run[169]={
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  2,  2,  2,
- 2,  2,  2,  2,  3,  3,  3,  3,
- 3,  3,  3,  4,  4,  4,  4,  4,
- 5,  5,  5,  5,  6,  6,  6,  6,
- 7,  7,  7,  7,  8,  8,  8,  9,
- 9,  9, 10, 10, 11, 11, 12, 12,
-13, 13, 14, 14, 15, 15, 16, 16,
-17, 17, 18, 19, 20, 21, 22, 23,
-24, 25, 26, 27, 28, 29, 30, 31,
-32, 33, 34, 35, 36, 37, 38,
- 0,  0,  0,  0,  0,  1,  1,  1,
- 1,  1,  2,  2,  2,  3,  3,  4,
- 4,  5,  5,  6,  6,  7,  7,  8,
- 8,  9,  9, 10, 10, 11, 11, 12,
-12, 13, 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,
-};
-
-static const int8_t inter_rvlc_level[169]={
- 1,  2,  3,  4,  5,  6,  7,  8,
- 9, 10, 11, 12, 13, 14, 15, 16,
-17, 18, 19,  1,  2,  3,  4,  5,
- 6,  7,  8,  9, 10,  1,  2,  3,
- 4,  5,  6,  7,  1,  2,  3,  4,
- 5,  6,  7,  1,  2,  3,  4,  5,
- 1,  2,  3,  4,  1,  2,  3,  4,
- 1,  2,  3,  4,  1,  2,  3,  1,
- 2,  3,  1,  2,  1,  2,  1,  2,
- 1,  2,  1,  2,  1,  2,  1,  2,
- 1,  2,  1,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,
- 1,  2,  3,  4,  5,  1,  2,  3,
- 4,  5,  1,  2,  3,  1,  2,  1,
- 2,  1,  2,  1,  2,  1,  2,  1,
- 2,  1,  2,  1,  2,  1,  2,  1,
- 2,  1,  2,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,
-};
-
-RLTable rvlc_rl_inter = {
-    169,
-    103,
-    inter_rvlc,
-    inter_rvlc_run,
-    inter_rvlc_level,
-};
-
-const uint16_t intra_rvlc[170][2]={
-{0x0006,  3},{0x0007,  3},{0x000A,  4},{0x0009,  5},
-{0x0014,  6},{0x0015,  6},{0x0034,  7},{0x0074,  8},
-{0x0075,  8},{0x00DD,  9},{0x00EC,  9},{0x01EC, 10},
-{0x01ED, 10},{0x01F4, 10},{0x03EC, 11},{0x03ED, 11},
-{0x03F4, 11},{0x077D, 12},{0x07BC, 12},{0x0FBD, 13},
-{0x0FDC, 13},{0x07BD, 12},{0x0FDD, 13},{0x1FBD, 14},
-{0x1FDC, 14},{0x1FDD, 14},{0x1FFC, 15},{0x0001,  4},
-{0x0008,  5},{0x002D,  7},{0x006C,  8},{0x006D,  8},
-{0x00DC,  9},{0x01DD, 10},{0x03DC, 11},{0x03DD, 11},
-{0x077C, 12},{0x0FBC, 13},{0x1F7D, 14},{0x1FBC, 14},
-{0x0004,  5},{0x002C,  7},{0x00BC,  9},{0x01DC, 10},
-{0x03BC, 11},{0x03BD, 11},{0x0EFD, 13},{0x0F7C, 13},
-{0x0F7D, 13},{0x1EFD, 14},{0x1F7C, 14},{0x0005,  5},
-{0x005C,  8},{0x00BD,  9},{0x037D, 11},{0x06FC, 12},
-{0x0EFC, 13},{0x1DFD, 14},{0x1EFC, 14},{0x1FFD, 15},
-{0x000C,  6},{0x005D,  8},{0x01BD, 10},{0x03FD, 12},
-{0x06FD, 12},{0x1BFD, 14},{0x000D,  6},{0x007D,  9},
-{0x02FC, 11},{0x05FC, 12},{0x1BFC, 14},{0x1DFC, 14},
-{0x001C,  7},{0x017C, 10},{0x02FD, 11},{0x05FD, 12},
-{0x2FFC, 15},{0x001D,  7},{0x017D, 10},{0x037C, 11},
-{0x0DFD, 13},{0x2FFD, 15},{0x003C,  8},{0x01BC, 10},
-{0x0BFD, 13},{0x17FD, 14},{0x003D,  8},{0x01FD, 11},
-{0x0DFC, 13},{0x37FC, 15},{0x007C,  9},{0x03FC, 12},
-{0x00FC, 10},{0x0BFC, 13},{0x00FD, 10},{0x37FD, 15},
-{0x01FC, 11},{0x07FC, 13},{0x07FD, 13},{0x0FFC, 14},
-{0x0FFD, 14},{0x17FC, 14},{0x3BFC, 15},
-{0x000B,  4},{0x0078,  8},{0x03F5, 11},{0x0FEC, 13},
-{0x1FEC, 14},{0x0012,  5},{0x00ED,  9},{0x07DC, 12},
-{0x1FED, 14},{0x3BFD, 15},{0x0013,  5},{0x03F8, 11},
-{0x3DFC, 15},{0x0018,  6},{0x07DD, 12},{0x0019,  6},
-{0x07EC, 12},{0x0022,  6},{0x0FED, 13},{0x0023,  6},
-{0x0FF4, 13},{0x0035,  7},{0x0FF5, 13},{0x0038,  7},
-{0x0FF8, 13},{0x0039,  7},{0x0FF9, 13},{0x0042,  7},
-{0x1FF4, 14},{0x0043,  7},{0x1FF5, 14},{0x0079,  8},
-{0x1FF8, 14},{0x0082,  8},{0x3DFD, 15},{0x0083,  8},
-{0x00F4,  9},{0x00F5,  9},{0x00F8,  9},{0x00F9,  9},
-{0x0102,  9},{0x0103,  9},{0x01F5, 10},{0x01F8, 10},
-{0x01F9, 10},{0x0202, 10},{0x0203, 10},{0x03F9, 11},
-{0x0402, 11},{0x0403, 11},{0x07ED, 12},{0x07F4, 12},
-{0x07F5, 12},{0x07F8, 12},{0x07F9, 12},{0x0802, 12},
-{0x0803, 12},{0x1002, 13},{0x1003, 13},{0x1FF9, 14},
-{0x2002, 14},{0x2003, 14},{0x3EFC, 15},{0x3EFD, 15},
-{0x3F7C, 15},{0x3F7D, 15},{0x0000,  4}
-};
-
-static const int8_t intra_rvlc_run[169]={
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  0,  0,  0,  0,  0,
- 0,  0,  0,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 2,  2,  2,  2,  2,  2,  2,  2,
- 2,  2,  2,  3,  3,  3,  3,  3,
- 3,  3,  3,  3,  4,  4,  4,  4,
- 4,  4,  5,  5,  5,  5,  5,  5,
- 6,  6,  6,  6,  6,  7,  7,  7,
- 7,  7,  8,  8,  8,  8,  9,  9,
- 9,  9, 10, 10, 11, 11, 12, 12,
-13, 14, 15, 16, 17, 18, 19,
- 0,  0,  0,  0,  0,  1,  1,  1,
- 1,  1,  2,  2,  2,  3,  3,  4,
- 4,  5,  5,  6,  6,  7,  7,  8,
- 8,  9,  9, 10, 10, 11, 11, 12,
-12, 13, 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,
-};
-
-static const int8_t intra_rvlc_level[169]={
- 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,  1,  2,  3,  4,  5,
- 6,  7,  8,  9, 10, 11, 12, 13,
- 1,  2,  3,  4,  5,  6,  7,  8,
- 9, 10, 11,  1,  2,  3,  4,  5,
- 6,  7,  8,  9,  1,  2,  3,  4,
- 5,  6,  1,  2,  3,  4,  5,  6,
- 1,  2,  3,  4,  5,  1,  2,  3,
- 4,  5,  1,  2,  3,  4,  1,  2,
- 3,  4,  1,  2,  1,  2,  1,  2,
- 1,  1,  1,  1,  1,  1,  1,
- 1,  2,  3,  4,  5,  1,  2,  3,
- 4,  5,  1,  2,  3,  1,  2,  1,
- 2,  1,  2,  1,  2,  1,  2,  1,
- 2,  1,  2,  1,  2,  1,  2,  1,
- 2,  1,  2,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,  1,  1,  1,  1,  1,  1,
- 1,  1,
-};
-
-RLTable rvlc_rl_intra = {
-    169,
-    103,
-    intra_rvlc,
-    intra_rvlc_run,
-    intra_rvlc_level,
-};
-
-const uint16_t sprite_trajectory_tab[15][2] = {
- {0x00, 2}, {0x02, 3},  {0x03, 3},  {0x04, 3}, {0x05, 3}, {0x06, 3},
- {0x0E, 4}, {0x1E, 5},  {0x3E, 6},  {0x7E, 7}, {0xFE, 8},
- {0x1FE, 9},{0x3FE, 10},{0x7FE, 11},{0xFFE, 12},
-};
-
-const uint8_t mb_type_b_tab[4][2] = {
- {1, 1}, {1, 2}, {1, 3}, {1, 4},
-};
-
-/* these matrixes will be permuted for the idct */
-const int16_t ff_mpeg4_default_intra_matrix[64] = {
-  8, 17, 18, 19, 21, 23, 25, 27,
- 17, 18, 19, 21, 23, 25, 27, 28,
- 20, 21, 22, 23, 24, 26, 28, 30,
- 21, 22, 23, 24, 26, 28, 30, 32,
- 22, 23, 24, 26, 28, 30, 32, 35,
- 23, 24, 26, 28, 30, 32, 35, 38,
- 25, 26, 28, 30, 32, 35, 38, 41,
- 27, 28, 30, 32, 35, 38, 41, 45,
-};
-
-const int16_t ff_mpeg4_default_non_intra_matrix[64] = {
- 16, 17, 18, 19, 20, 21, 22, 23,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 18, 19, 20, 21, 22, 23, 24, 25,
- 19, 20, 21, 22, 23, 24, 26, 27,
- 20, 21, 22, 23, 25, 26, 27, 28,
- 21, 22, 23, 24, 26, 27, 28, 30,
- 22, 23, 24, 26, 27, 28, 30, 31,
- 23, 24, 25, 27, 28, 30, 31, 33,
-};
-
-const uint8_t ff_mpeg4_y_dc_scale_table[32]={
-//  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
-    0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,36,38,40,42,44,46
-};
-const uint8_t ff_mpeg4_c_dc_scale_table[32]={
-//  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
-    0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,20,21,22,23,24,25
-};
-
-const uint16_t ff_mpeg4_resync_prefix[8]={
-    0x7F00, 0x7E00, 0x7C00, 0x7800, 0x7000, 0x6000, 0x4000, 0x0000
-};
-
-const uint8_t mpeg4_dc_threshold[8]={
-    99, 13, 15, 17, 19, 21, 23, 0
-};
-
-#endif /* AVCODEC_MPEG4DATA_H */
diff --git a/libavcodec/mpeg4video.c b/libavcodec/mpeg4video.c
deleted file mode 100644
index dd4dd8a..0000000
--- a/libavcodec/mpeg4video.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * MPEG4 decoder / encoder common code.
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mpegvideo.h"
-#include "mpeg4video.h"
-#include "mpeg4data.h"
-
-uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s){
-    switch(s->pict_type){
-        case FF_I_TYPE:
-            return 16;
-        case FF_P_TYPE:
-        case FF_S_TYPE:
-            return s->f_code+15;
-        case FF_B_TYPE:
-            return FFMAX3(s->f_code, s->b_code, 2) + 15;
-        default:
-            return -1;
-    }
-}
-
-void ff_mpeg4_clean_buffers(MpegEncContext *s)
-{
-    int c_wrap, c_xy, l_wrap, l_xy;
-
-    l_wrap= s->b8_stride;
-    l_xy= (2*s->mb_y-1)*l_wrap + s->mb_x*2 - 1;
-    c_wrap= s->mb_stride;
-    c_xy= (s->mb_y-1)*c_wrap + s->mb_x - 1;
-
-#if 0
-    /* clean DC */
-    memsetw(s->dc_val[0] + l_xy, 1024, l_wrap*2+1);
-    memsetw(s->dc_val[1] + c_xy, 1024, c_wrap+1);
-    memsetw(s->dc_val[2] + c_xy, 1024, c_wrap+1);
-#endif
-
-    /* clean AC */
-    memset(s->ac_val[0] + l_xy, 0, (l_wrap*2+1)*16*sizeof(int16_t));
-    memset(s->ac_val[1] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));
-    memset(s->ac_val[2] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));
-
-    /* clean MV */
-    // we can't clear the MVs as they might be needed by a b frame
-//    memset(s->motion_val + l_xy, 0, (l_wrap*2+1)*2*sizeof(int16_t));
-//    memset(s->motion_val, 0, 2*sizeof(int16_t)*(2 + s->mb_width*2)*(2 + s->mb_height*2));
-    s->last_mv[0][0][0]=
-    s->last_mv[0][0][1]=
-    s->last_mv[1][0][0]=
-    s->last_mv[1][0][1]= 0;
-}
-
-#define tab_size ((signed)FF_ARRAY_ELEMS(s->direct_scale_mv[0]))
-#define tab_bias (tab_size/2)
-
-//used by mpeg4 and rv10 decoder
-void ff_mpeg4_init_direct_mv(MpegEncContext *s){
-    int i;
-    for(i=0; i<tab_size; i++){
-        s->direct_scale_mv[0][i] = (i-tab_bias)*s->pb_time/s->pp_time;
-        s->direct_scale_mv[1][i] = (i-tab_bias)*(s->pb_time-s->pp_time)/s->pp_time;
-    }
-}
-
-static inline void ff_mpeg4_set_one_direct_mv(MpegEncContext *s, int mx, int my, int i){
-    int xy= s->block_index[i];
-    uint16_t time_pp= s->pp_time;
-    uint16_t time_pb= s->pb_time;
-    int p_mx, p_my;
-
-    p_mx= s->next_picture.motion_val[0][xy][0];
-    if((unsigned)(p_mx + tab_bias) < tab_size){
-        s->mv[0][i][0] = s->direct_scale_mv[0][p_mx + tab_bias] + mx;
-        s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx
-                            : s->direct_scale_mv[1][p_mx + tab_bias];
-    }else{
-        s->mv[0][i][0] = p_mx*time_pb/time_pp + mx;
-        s->mv[1][i][0] = mx ? s->mv[0][i][0] - p_mx
-                            : p_mx*(time_pb - time_pp)/time_pp;
-    }
-    p_my= s->next_picture.motion_val[0][xy][1];
-    if((unsigned)(p_my + tab_bias) < tab_size){
-        s->mv[0][i][1] = s->direct_scale_mv[0][p_my + tab_bias] + my;
-        s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my
-                            : s->direct_scale_mv[1][p_my + tab_bias];
-    }else{
-        s->mv[0][i][1] = p_my*time_pb/time_pp + my;
-        s->mv[1][i][1] = my ? s->mv[0][i][1] - p_my
-                            : p_my*(time_pb - time_pp)/time_pp;
-    }
-}
-
-#undef tab_size
-#undef tab_bias
-
-/**
- *
- * @return the mb_type
- */
-int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){
-    const int mb_index= s->mb_x + s->mb_y*s->mb_stride;
-    const int colocated_mb_type= s->next_picture.mb_type[mb_index];
-    uint16_t time_pp;
-    uint16_t time_pb;
-    int i;
-
-    //FIXME avoid divides
-    // try special case with shifts for 1 and 3 B-frames?
-
-    if(IS_8X8(colocated_mb_type)){
-        s->mv_type = MV_TYPE_8X8;
-        for(i=0; i<4; i++){
-            ff_mpeg4_set_one_direct_mv(s, mx, my, i);
-        }
-        return MB_TYPE_DIRECT2 | MB_TYPE_8x8 | MB_TYPE_L0L1;
-    } else if(IS_INTERLACED(colocated_mb_type)){
-        s->mv_type = MV_TYPE_FIELD;
-        for(i=0; i<2; i++){
-            int field_select= s->next_picture.ref_index[0][4*mb_index + 2*i];
-            s->field_select[0][i]= field_select;
-            s->field_select[1][i]= i;
-            if(s->top_field_first){
-                time_pp= s->pp_field_time - field_select + i;
-                time_pb= s->pb_field_time - field_select + i;
-            }else{
-                time_pp= s->pp_field_time + field_select - i;
-                time_pb= s->pb_field_time + field_select - i;
-            }
-            s->mv[0][i][0] = s->p_field_mv_table[i][0][mb_index][0]*time_pb/time_pp + mx;
-            s->mv[0][i][1] = s->p_field_mv_table[i][0][mb_index][1]*time_pb/time_pp + my;
-            s->mv[1][i][0] = mx ? s->mv[0][i][0] - s->p_field_mv_table[i][0][mb_index][0]
-                                : s->p_field_mv_table[i][0][mb_index][0]*(time_pb - time_pp)/time_pp;
-            s->mv[1][i][1] = my ? s->mv[0][i][1] - s->p_field_mv_table[i][0][mb_index][1]
-                                : s->p_field_mv_table[i][0][mb_index][1]*(time_pb - time_pp)/time_pp;
-        }
-        return MB_TYPE_DIRECT2 | MB_TYPE_16x8 | MB_TYPE_L0L1 | MB_TYPE_INTERLACED;
-    }else{
-        ff_mpeg4_set_one_direct_mv(s, mx, my, 0);
-        s->mv[0][1][0] = s->mv[0][2][0] = s->mv[0][3][0] = s->mv[0][0][0];
-        s->mv[0][1][1] = s->mv[0][2][1] = s->mv[0][3][1] = s->mv[0][0][1];
-        s->mv[1][1][0] = s->mv[1][2][0] = s->mv[1][3][0] = s->mv[1][0][0];
-        s->mv[1][1][1] = s->mv[1][2][1] = s->mv[1][3][1] = s->mv[1][0][1];
-        if((s->avctx->workaround_bugs & FF_BUG_DIRECT_BLOCKSIZE) || !s->quarter_sample)
-            s->mv_type= MV_TYPE_16X16;
-        else
-            s->mv_type= MV_TYPE_8X8;
-        return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_L0L1; //Note see prev line
-    }
-}
-
diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
deleted file mode 100644
index aab3236..0000000
--- a/libavcodec/mpeg4video.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * MPEG4 encoder/decoder internal header.
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPEG4VIDEO_H
-#define AVCODEC_MPEG4VIDEO_H
-
-#include <stdint.h>
-#include "get_bits.h"
-#include "mpegvideo.h"
-#include "rl.h"
-
-// shapes
-#define RECT_SHAPE       0
-#define BIN_SHAPE        1
-#define BIN_ONLY_SHAPE   2
-#define GRAY_SHAPE       3
-
-#define SIMPLE_VO_TYPE             1
-#define CORE_VO_TYPE               3
-#define MAIN_VO_TYPE               4
-#define NBIT_VO_TYPE               5
-#define ARTS_VO_TYPE               10
-#define ACE_VO_TYPE                12
-#define ADV_SIMPLE_VO_TYPE         17
-
-// aspect_ratio_info
-#define EXTENDED_PAR 15
-
-//vol_sprite_usage / sprite_enable
-#define STATIC_SPRITE 1
-#define GMC_SPRITE 2
-
-#define MOTION_MARKER 0x1F001
-#define DC_MARKER     0x6B001
-
-#define VOS_STARTCODE        0x1B0
-#define USER_DATA_STARTCODE  0x1B2
-#define GOP_STARTCODE        0x1B3
-#define VISUAL_OBJ_STARTCODE 0x1B5
-#define VOP_STARTCODE        0x1B6
-
-/* dc encoding for mpeg4 */
-extern const uint8_t ff_mpeg4_DCtab_lum[13][2];
-extern const uint8_t ff_mpeg4_DCtab_chrom[13][2];
-
-extern const uint16_t ff_mpeg4_intra_vlc[103][2];
-extern RLTable ff_mpeg4_rl_intra;
-
-/* Note this is identical to the intra rvlc except that it is reordered. */
-extern const uint16_t inter_rvlc[170][2];
-extern RLTable rvlc_rl_inter;
-
-extern const uint16_t intra_rvlc[170][2];
-extern RLTable rvlc_rl_intra;
-
-extern const uint16_t sprite_trajectory_tab[15][2];
-extern const uint8_t mb_type_b_tab[4][2];
-
-/* these matrixes will be permuted for the idct */
-extern const int16_t ff_mpeg4_default_intra_matrix[64];
-extern const int16_t ff_mpeg4_default_non_intra_matrix[64];
-
-extern const uint8_t ff_mpeg4_y_dc_scale_table[32];
-extern const uint8_t ff_mpeg4_c_dc_scale_table[32];
-extern const uint16_t ff_mpeg4_resync_prefix[8];
-
-extern const uint8_t mpeg4_dc_threshold[8];
-
-void mpeg4_encode_mb(MpegEncContext *s,
-                    DCTELEM block[6][64],
-                    int motion_x, int motion_y);
-void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
-                   int dir);
-void ff_set_mpeg4_time(MpegEncContext * s);
-void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
-
-int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
-void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
-void ff_mpeg4_clean_buffers(MpegEncContext *s);
-void ff_mpeg4_stuffing(PutBitContext * pbc);
-void ff_mpeg4_init_partitions(MpegEncContext *s);
-void ff_mpeg4_merge_partitions(MpegEncContext *s);
-void ff_clean_mpeg4_qscales(MpegEncContext *s);
-int ff_mpeg4_decode_partitions(MpegEncContext *s);
-int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
-int mpeg4_decode_video_packet_header(MpegEncContext *s);
-void ff_mpeg4_init_direct_mv(MpegEncContext *s);
-
-/**
- *
- * @return the mb_type
- */
-int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);
-
-extern uint8_t ff_mpeg4_static_rl_table_store[3][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-
-#if 0 //3IV1 is quite rare and it slows things down a tiny bit
-#define IS_3IV1 s->codec_tag == AV_RL32("3IV1")
-#else
-#define IS_3IV1 0
-#endif
-
-
-/**
- * predicts the dc.
- * encoding quantized level -> quantized diff
- * decoding quantized diff -> quantized level
- * @param n block index (0-3 are luma, 4-5 are chroma)
- * @param dir_ptr pointer to an integer where the prediction direction will be stored
- */
-static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *dir_ptr, int encoding)
-{
-    int a, b, c, wrap, pred, scale, ret;
-    int16_t *dc_val;
-
-    /* find prediction */
-    if (n < 4) {
-        scale = s->y_dc_scale;
-    } else {
-        scale = s->c_dc_scale;
-    }
-    if(IS_3IV1)
-        scale= 8;
-
-    wrap= s->block_wrap[n];
-    dc_val = s->dc_val[0] + s->block_index[n];
-
-    /* B C
-     * A X
-     */
-    a = dc_val[ - 1];
-    b = dc_val[ - 1 - wrap];
-    c = dc_val[ - wrap];
-
-    /* outside slice handling (we can't do that by memset as we need the dc for error resilience) */
-    if(s->first_slice_line && n!=3){
-        if(n!=2) b=c= 1024;
-        if(n!=1 && s->mb_x == s->resync_mb_x) b=a= 1024;
-    }
-    if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1){
-        if(n==0 || n==4 || n==5)
-            b=1024;
-    }
-
-    if (abs(a - b) < abs(b - c)) {
-        pred = c;
-        *dir_ptr = 1; /* top */
-    } else {
-        pred = a;
-        *dir_ptr = 0; /* left */
-    }
-    /* we assume pred is positive */
-    pred = FASTDIV((pred + (scale >> 1)), scale);
-
-    if(encoding){
-        ret = level - pred;
-    }else{
-        level += pred;
-        ret= level;
-        if(s->error_recognition>=3){
-            if(level<0){
-                av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-            if(level*scale > 2048 + scale){
-                av_log(s->avctx, AV_LOG_ERROR, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-        }
-    }
-    level *=scale;
-    if(level&(~2047)){
-        if(level<0)
-            level=0;
-        else if(!(s->workaround_bugs&FF_BUG_DC_CLIP))
-            level=2047;
-    }
-    dc_val[0]= level;
-
-    return ret;
-}
-#endif
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
deleted file mode 100644
index 5dbda8b..0000000
--- a/libavcodec/mpeg4video_parser.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * MPEG4 Video frame extraction
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-#include "mpegvideo.h"
-#include "mpeg4video.h"
-#include "mpeg4video_parser.h"
-
-
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){
-    int vop_found, i;
-    uint32_t state;
-
-    vop_found= pc->frame_start_found;
-    state= pc->state;
-
-    i=0;
-    if(!vop_found){
-        for(i=0; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(state == 0x1B6){
-                i++;
-                vop_found=1;
-                break;
-            }
-        }
-    }
-
-    if(vop_found){
-        /* EOF considered as end of frame */
-        if (buf_size == 0)
-            return 0;
-        for(; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if((state&0xFFFFFF00) == 0x100){
-                pc->frame_start_found=0;
-                pc->state=-1;
-                return i-3;
-            }
-        }
-    }
-    pc->frame_start_found= vop_found;
-    pc->state= state;
-    return END_NOT_FOUND;
-}
-
-/* XXX: make it use less memory */
-static int av_mpeg4_decode_header(AVCodecParserContext *s1,
-                                  AVCodecContext *avctx,
-                                  const uint8_t *buf, int buf_size)
-{
-    ParseContext1 *pc = s1->priv_data;
-    MpegEncContext *s = pc->enc;
-    GetBitContext gb1, *gb = &gb1;
-    int ret;
-
-    s->avctx = avctx;
-    s->current_picture_ptr = &s->current_picture;
-
-    if (avctx->extradata_size && pc->first_picture){
-        init_get_bits(gb, avctx->extradata, avctx->extradata_size*8);
-        ret = ff_mpeg4_decode_picture_header(s, gb);
-    }
-
-    init_get_bits(gb, buf, 8 * buf_size);
-    ret = ff_mpeg4_decode_picture_header(s, gb);
-    if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height)) {
-        avcodec_set_dimensions(avctx, s->width, s->height);
-    }
-    s1->pict_type= s->pict_type;
-    pc->first_picture = 0;
-    return ret;
-}
-
-static av_cold int mpeg4video_parse_init(AVCodecParserContext *s)
-{
-    ParseContext1 *pc = s->priv_data;
-
-    pc->enc = av_mallocz(sizeof(MpegEncContext));
-    if (!pc->enc)
-        return -1;
-    pc->first_picture = 1;
-    return 0;
-}
-
-static int mpeg4video_parse(AVCodecParserContext *s,
-                           AVCodecContext *avctx,
-                           const uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size)
-{
-    ParseContext *pc = s->priv_data;
-    int next;
-
-    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
-        next= buf_size;
-    }else{
-        next= ff_mpeg4_find_frame_end(pc, buf, buf_size);
-
-        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-    }
-    av_mpeg4_decode_header(s, avctx, buf, buf_size);
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-
-AVCodecParser mpeg4video_parser = {
-    { CODEC_ID_MPEG4 },
-    sizeof(ParseContext1),
-    mpeg4video_parse_init,
-    mpeg4video_parse,
-    ff_parse1_close,
-    ff_mpeg4video_split,
-};
diff --git a/libavcodec/mpeg4video_parser.h b/libavcodec/mpeg4video_parser.h
deleted file mode 100644
index 822a24c..0000000
--- a/libavcodec/mpeg4video_parser.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * MPEG4 video parser prototypes
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MPEG4VIDEO_PARSER_H
-#define AVCODEC_MPEG4VIDEO_PARSER_H
-
-#include "parser.h"
-
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size);
-
-#endif /* AVCODEC_MPEG4VIDEO_PARSER_H */
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
deleted file mode 100644
index fa69c9e..0000000
--- a/libavcodec/mpeg4videodec.c
+++ /dev/null
@@ -1,2267 +0,0 @@
-/*
- * MPEG4 decoder.
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mpegvideo.h"
-#include "mpeg4video.h"
-#include "h263.h"
-
-// The defines below define the number of bits that are read at once for
-// reading vlc values. Changing these may improve speed and data cache needs
-// be aware though that decreasing them may need the number of stages that is
-// passed to get_vlc* to be increased.
-#define SPRITE_TRAJ_VLC_BITS 6
-#define DC_VLC_BITS 9
-#define MB_TYPE_B_VLC_BITS 4
-
-
-static VLC dc_lum, dc_chrom;
-static VLC sprite_trajectory;
-static VLC mb_type_b_vlc;
-
-static const int mb_type_b_map[4]= {
-    MB_TYPE_DIRECT2 | MB_TYPE_L0L1,
-    MB_TYPE_L0L1 | MB_TYPE_16x16,
-    MB_TYPE_L1 | MB_TYPE_16x16,
-    MB_TYPE_L0 | MB_TYPE_16x16,
-};
-
-/**
- * predicts the ac.
- * @param n block index (0-3 are luma, 4-5 are chroma)
- * @param dir the ac prediction direction
- */
-void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
-                   int dir)
-{
-    int i;
-    int16_t *ac_val, *ac_val1;
-    int8_t * const qscale_table= s->current_picture.qscale_table;
-
-    /* find prediction */
-    ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
-    ac_val1 = ac_val;
-    if (s->ac_pred) {
-        if (dir == 0) {
-            const int xy= s->mb_x-1 + s->mb_y*s->mb_stride;
-            /* left prediction */
-            ac_val -= 16;
-
-            if(s->mb_x==0 || s->qscale == qscale_table[xy] || n==1 || n==3){
-                /* same qscale */
-                for(i=1;i<8;i++) {
-                    block[s->dsp.idct_permutation[i<<3]] += ac_val[i];
-                }
-            }else{
-                /* different qscale, we must rescale */
-                for(i=1;i<8;i++) {
-                    block[s->dsp.idct_permutation[i<<3]] += ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
-                }
-            }
-        } else {
-            const int xy= s->mb_x + s->mb_y*s->mb_stride - s->mb_stride;
-            /* top prediction */
-            ac_val -= 16 * s->block_wrap[n];
-
-            if(s->mb_y==0 || s->qscale == qscale_table[xy] || n==2 || n==3){
-                /* same qscale */
-                for(i=1;i<8;i++) {
-                    block[s->dsp.idct_permutation[i]] += ac_val[i + 8];
-                }
-            }else{
-                /* different qscale, we must rescale */
-                for(i=1;i<8;i++) {
-                    block[s->dsp.idct_permutation[i]] += ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);
-                }
-            }
-        }
-    }
-    /* left copy */
-    for(i=1;i<8;i++)
-        ac_val1[i    ] = block[s->dsp.idct_permutation[i<<3]];
-
-    /* top copy */
-    for(i=1;i<8;i++)
-        ac_val1[8 + i] = block[s->dsp.idct_permutation[i   ]];
-
-}
-
-/**
- * check if the next stuff is a resync marker or the end.
- * @return 0 if not
- */
-static inline int mpeg4_is_resync(MpegEncContext *s){
-    int bits_count= get_bits_count(&s->gb);
-    int v= show_bits(&s->gb, 16);
-
-    if(s->workaround_bugs&FF_BUG_NO_PADDING){
-        return 0;
-    }
-
-    while(v<=0xFF){
-        if(s->pict_type==FF_B_TYPE || (v>>(8-s->pict_type)!=1) || s->partitioned_frame)
-            break;
-        skip_bits(&s->gb, 8+s->pict_type);
-        bits_count+= 8+s->pict_type;
-        v= show_bits(&s->gb, 16);
-    }
-
-    if(bits_count + 8 >= s->gb.size_in_bits){
-        v>>=8;
-        v|= 0x7F >> (7-(bits_count&7));
-
-        if(v==0x7F)
-            return 1;
-    }else{
-        if(v == ff_mpeg4_resync_prefix[bits_count&7]){
-            int len;
-            GetBitContext gb= s->gb;
-
-            skip_bits(&s->gb, 1);
-            align_get_bits(&s->gb);
-
-            for(len=0; len<32; len++){
-                if(get_bits1(&s->gb)) break;
-            }
-
-            s->gb= gb;
-
-            if(len>=ff_mpeg4_get_video_packet_prefix_length(s))
-                return 1;
-        }
-    }
-    return 0;
-}
-
-static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb)
-{
-    int i;
-    int a= 2<<s->sprite_warping_accuracy;
-    int rho= 3-s->sprite_warping_accuracy;
-    int r=16/a;
-    const int vop_ref[4][2]= {{0,0}, {s->width,0}, {0, s->height}, {s->width, s->height}}; // only true for rectangle shapes
-    int d[4][2]={{0,0}, {0,0}, {0,0}, {0,0}};
-    int sprite_ref[4][2];
-    int virtual_ref[2][2];
-    int w2, h2, w3, h3;
-    int alpha=0, beta=0;
-    int w= s->width;
-    int h= s->height;
-    int min_ab;
-
-    for(i=0; i<s->num_sprite_warping_points; i++){
-        int length;
-        int x=0, y=0;
-
-        length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
-        if(length){
-            x= get_xbits(gb, length);
-        }
-        if(!(s->divx_version==500 && s->divx_build==413)) skip_bits1(gb); /* marker bit */
-
-        length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);
-        if(length){
-            y=get_xbits(gb, length);
-        }
-        skip_bits1(gb); /* marker bit */
-        s->sprite_traj[i][0]= d[i][0]= x;
-        s->sprite_traj[i][1]= d[i][1]= y;
-    }
-    for(; i<4; i++)
-        s->sprite_traj[i][0]= s->sprite_traj[i][1]= 0;
-
-    while((1<<alpha)<w) alpha++;
-    while((1<<beta )<h) beta++; // there seems to be a typo in the mpeg4 std for the definition of w' and h'
-    w2= 1<<alpha;
-    h2= 1<<beta;
-
-// Note, the 4th point isn't used for GMC
-    if(s->divx_version==500 && s->divx_build==413){
-        sprite_ref[0][0]= a*vop_ref[0][0] + d[0][0];
-        sprite_ref[0][1]= a*vop_ref[0][1] + d[0][1];
-        sprite_ref[1][0]= a*vop_ref[1][0] + d[0][0] + d[1][0];
-        sprite_ref[1][1]= a*vop_ref[1][1] + d[0][1] + d[1][1];
-        sprite_ref[2][0]= a*vop_ref[2][0] + d[0][0] + d[2][0];
-        sprite_ref[2][1]= a*vop_ref[2][1] + d[0][1] + d[2][1];
-    } else {
-        sprite_ref[0][0]= (a>>1)*(2*vop_ref[0][0] + d[0][0]);
-        sprite_ref[0][1]= (a>>1)*(2*vop_ref[0][1] + d[0][1]);
-        sprite_ref[1][0]= (a>>1)*(2*vop_ref[1][0] + d[0][0] + d[1][0]);
-        sprite_ref[1][1]= (a>>1)*(2*vop_ref[1][1] + d[0][1] + d[1][1]);
-        sprite_ref[2][0]= (a>>1)*(2*vop_ref[2][0] + d[0][0] + d[2][0]);
-        sprite_ref[2][1]= (a>>1)*(2*vop_ref[2][1] + d[0][1] + d[2][1]);
-    }
-/*    sprite_ref[3][0]= (a>>1)*(2*vop_ref[3][0] + d[0][0] + d[1][0] + d[2][0] + d[3][0]);
-    sprite_ref[3][1]= (a>>1)*(2*vop_ref[3][1] + d[0][1] + d[1][1] + d[2][1] + d[3][1]); */
-
-// this is mostly identical to the mpeg4 std (and is totally unreadable because of that ...)
-// perhaps it should be reordered to be more readable ...
-// the idea behind this virtual_ref mess is to be able to use shifts later per pixel instead of divides
-// so the distance between points is converted from w&h based to w2&h2 based which are of the 2^x form
-    virtual_ref[0][0]= 16*(vop_ref[0][0] + w2)
-        + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + w2*(r*sprite_ref[1][0] - 16*vop_ref[1][0])),w);
-    virtual_ref[0][1]= 16*vop_ref[0][1]
-        + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + w2*(r*sprite_ref[1][1] - 16*vop_ref[1][1])),w);
-    virtual_ref[1][0]= 16*vop_ref[0][0]
-        + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + h2*(r*sprite_ref[2][0] - 16*vop_ref[2][0])),h);
-    virtual_ref[1][1]= 16*(vop_ref[0][1] + h2)
-        + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + h2*(r*sprite_ref[2][1] - 16*vop_ref[2][1])),h);
-
-    switch(s->num_sprite_warping_points)
-    {
-        case 0:
-            s->sprite_offset[0][0]= 0;
-            s->sprite_offset[0][1]= 0;
-            s->sprite_offset[1][0]= 0;
-            s->sprite_offset[1][1]= 0;
-            s->sprite_delta[0][0]= a;
-            s->sprite_delta[0][1]= 0;
-            s->sprite_delta[1][0]= 0;
-            s->sprite_delta[1][1]= a;
-            s->sprite_shift[0]= 0;
-            s->sprite_shift[1]= 0;
-            break;
-        case 1: //GMC only
-            s->sprite_offset[0][0]= sprite_ref[0][0] - a*vop_ref[0][0];
-            s->sprite_offset[0][1]= sprite_ref[0][1] - a*vop_ref[0][1];
-            s->sprite_offset[1][0]= ((sprite_ref[0][0]>>1)|(sprite_ref[0][0]&1)) - a*(vop_ref[0][0]/2);
-            s->sprite_offset[1][1]= ((sprite_ref[0][1]>>1)|(sprite_ref[0][1]&1)) - a*(vop_ref[0][1]/2);
-            s->sprite_delta[0][0]= a;
-            s->sprite_delta[0][1]= 0;
-            s->sprite_delta[1][0]= 0;
-            s->sprite_delta[1][1]= a;
-            s->sprite_shift[0]= 0;
-            s->sprite_shift[1]= 0;
-            break;
-        case 2:
-            s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+rho))
-                                                  + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][0])
-                                                  + ( r*sprite_ref[0][1] - virtual_ref[0][1])*(-vop_ref[0][1])
-                                                  + (1<<(alpha+rho-1));
-            s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+rho))
-                                                  + (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-vop_ref[0][0])
-                                                  + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][1])
-                                                  + (1<<(alpha+rho-1));
-            s->sprite_offset[1][0]= ( (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][0] + 1)
-                                     +( r*sprite_ref[0][1] - virtual_ref[0][1])*(-2*vop_ref[0][1] + 1)
-                                     +2*w2*r*sprite_ref[0][0]
-                                     - 16*w2
-                                     + (1<<(alpha+rho+1)));
-            s->sprite_offset[1][1]= ( (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-2*vop_ref[0][0] + 1)
-                                     +(-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][1] + 1)
-                                     +2*w2*r*sprite_ref[0][1]
-                                     - 16*w2
-                                     + (1<<(alpha+rho+1)));
-            s->sprite_delta[0][0]=   (-r*sprite_ref[0][0] + virtual_ref[0][0]);
-            s->sprite_delta[0][1]=   (+r*sprite_ref[0][1] - virtual_ref[0][1]);
-            s->sprite_delta[1][0]=   (-r*sprite_ref[0][1] + virtual_ref[0][1]);
-            s->sprite_delta[1][1]=   (-r*sprite_ref[0][0] + virtual_ref[0][0]);
-
-            s->sprite_shift[0]= alpha+rho;
-            s->sprite_shift[1]= alpha+rho+2;
-            break;
-        case 3:
-            min_ab= FFMIN(alpha, beta);
-            w3= w2>>min_ab;
-            h3= h2>>min_ab;
-            s->sprite_offset[0][0]=  (sprite_ref[0][0]<<(alpha+beta+rho-min_ab))
-                                   + (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-vop_ref[0][0])
-                                   + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-vop_ref[0][1])
-                                   + (1<<(alpha+beta+rho-min_ab-1));
-            s->sprite_offset[0][1]=  (sprite_ref[0][1]<<(alpha+beta+rho-min_ab))
-                                   + (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-vop_ref[0][0])
-                                   + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-vop_ref[0][1])
-                                   + (1<<(alpha+beta+rho-min_ab-1));
-            s->sprite_offset[1][0]=  (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-2*vop_ref[0][0] + 1)
-                                   + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-2*vop_ref[0][1] + 1)
-                                   + 2*w2*h3*r*sprite_ref[0][0]
-                                   - 16*w2*h3
-                                   + (1<<(alpha+beta+rho-min_ab+1));
-            s->sprite_offset[1][1]=  (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-2*vop_ref[0][0] + 1)
-                                   + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-2*vop_ref[0][1] + 1)
-                                   + 2*w2*h3*r*sprite_ref[0][1]
-                                   - 16*w2*h3
-                                   + (1<<(alpha+beta+rho-min_ab+1));
-            s->sprite_delta[0][0]=   (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3;
-            s->sprite_delta[0][1]=   (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3;
-            s->sprite_delta[1][0]=   (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3;
-            s->sprite_delta[1][1]=   (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3;
-
-            s->sprite_shift[0]= alpha + beta + rho - min_ab;
-            s->sprite_shift[1]= alpha + beta + rho - min_ab + 2;
-            break;
-    }
-    /* try to simplify the situation */
-    if(   s->sprite_delta[0][0] == a<<s->sprite_shift[0]
-       && s->sprite_delta[0][1] == 0
-       && s->sprite_delta[1][0] == 0
-       && s->sprite_delta[1][1] == a<<s->sprite_shift[0])
-    {
-        s->sprite_offset[0][0]>>=s->sprite_shift[0];
-        s->sprite_offset[0][1]>>=s->sprite_shift[0];
-        s->sprite_offset[1][0]>>=s->sprite_shift[1];
-        s->sprite_offset[1][1]>>=s->sprite_shift[1];
-        s->sprite_delta[0][0]= a;
-        s->sprite_delta[0][1]= 0;
-        s->sprite_delta[1][0]= 0;
-        s->sprite_delta[1][1]= a;
-        s->sprite_shift[0]= 0;
-        s->sprite_shift[1]= 0;
-        s->real_sprite_warping_points=1;
-    }
-    else{
-        int shift_y= 16 - s->sprite_shift[0];
-        int shift_c= 16 - s->sprite_shift[1];
-        for(i=0; i<2; i++){
-            s->sprite_offset[0][i]<<= shift_y;
-            s->sprite_offset[1][i]<<= shift_c;
-            s->sprite_delta[0][i]<<= shift_y;
-            s->sprite_delta[1][i]<<= shift_y;
-            s->sprite_shift[i]= 16;
-        }
-        s->real_sprite_warping_points= s->num_sprite_warping_points;
-    }
-}
-
-/**
- * decodes the next video packet.
- * @return <0 if something went wrong
- */
-int mpeg4_decode_video_packet_header(MpegEncContext *s)
-{
-    int mb_num_bits= av_log2(s->mb_num - 1) + 1;
-    int header_extension=0, mb_num, len;
-
-    /* is there enough space left for a video packet + header */
-    if( get_bits_count(&s->gb) > s->gb.size_in_bits-20) return -1;
-
-    for(len=0; len<32; len++){
-        if(get_bits1(&s->gb)) break;
-    }
-
-    if(len!=ff_mpeg4_get_video_packet_prefix_length(s)){
-        av_log(s->avctx, AV_LOG_ERROR, "marker does not match f_code\n");
-        return -1;
-    }
-
-    if(s->shape != RECT_SHAPE){
-        header_extension= get_bits1(&s->gb);
-        //FIXME more stuff here
-    }
-
-    mb_num= get_bits(&s->gb, mb_num_bits);
-    if(mb_num>=s->mb_num){
-        av_log(s->avctx, AV_LOG_ERROR, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num);
-        return -1;
-    }
-    if(s->pict_type == FF_B_TYPE){
-        while(s->next_picture.mbskip_table[ s->mb_index2xy[ mb_num ] ]) mb_num++;
-        if(mb_num >= s->mb_num) return -1; // slice contains just skipped MBs which where already decoded
-    }
-
-    s->mb_x= mb_num % s->mb_width;
-    s->mb_y= mb_num / s->mb_width;
-
-    if(s->shape != BIN_ONLY_SHAPE){
-        int qscale= get_bits(&s->gb, s->quant_precision);
-        if(qscale)
-            s->chroma_qscale=s->qscale= qscale;
-    }
-
-    if(s->shape == RECT_SHAPE){
-        header_extension= get_bits1(&s->gb);
-    }
-    if(header_extension){
-        int time_increment;
-        int time_incr=0;
-
-        while (get_bits1(&s->gb) != 0)
-            time_incr++;
-
-        check_marker(&s->gb, "before time_increment in video packed header");
-        time_increment= get_bits(&s->gb, s->time_increment_bits);
-        check_marker(&s->gb, "before vop_coding_type in video packed header");
-
-        skip_bits(&s->gb, 2); /* vop coding type */
-        //FIXME not rect stuff here
-
-        if(s->shape != BIN_ONLY_SHAPE){
-            skip_bits(&s->gb, 3); /* intra dc vlc threshold */
-//FIXME don't just ignore everything
-            if(s->pict_type == FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
-                mpeg4_decode_sprite_trajectory(s, &s->gb);
-                av_log(s->avctx, AV_LOG_ERROR, "untested\n");
-            }
-
-            //FIXME reduced res stuff here
-
-            if (s->pict_type != FF_I_TYPE) {
-                int f_code = get_bits(&s->gb, 3);       /* fcode_for */
-                if(f_code==0){
-                    av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (f_code=0)\n");
-                }
-            }
-            if (s->pict_type == FF_B_TYPE) {
-                int b_code = get_bits(&s->gb, 3);
-                if(b_code==0){
-                    av_log(s->avctx, AV_LOG_ERROR, "Error, video packet header damaged (b_code=0)\n");
-                }
-            }
-        }
-    }
-    //FIXME new-pred stuff
-
-    return 0;
-}
-
-/**
- * gets the average motion vector for a GMC MB.
- * @param n either 0 for the x component or 1 for y
- * @return the average MV for a GMC MB
- */
-static inline int get_amv(MpegEncContext *s, int n){
-    int x, y, mb_v, sum, dx, dy, shift;
-    int len = 1 << (s->f_code + 4);
-    const int a= s->sprite_warping_accuracy;
-
-    if(s->workaround_bugs & FF_BUG_AMV)
-        len >>= s->quarter_sample;
-
-    if(s->real_sprite_warping_points==1){
-        if(s->divx_version==500 && s->divx_build==413)
-            sum= s->sprite_offset[0][n] / (1<<(a - s->quarter_sample));
-        else
-            sum= RSHIFT(s->sprite_offset[0][n]<<s->quarter_sample, a);
-    }else{
-        dx= s->sprite_delta[n][0];
-        dy= s->sprite_delta[n][1];
-        shift= s->sprite_shift[0];
-        if(n) dy -= 1<<(shift + a + 1);
-        else  dx -= 1<<(shift + a + 1);
-        mb_v= s->sprite_offset[0][n] + dx*s->mb_x*16 + dy*s->mb_y*16;
-
-        sum=0;
-        for(y=0; y<16; y++){
-            int v;
-
-            v= mb_v + dy*y;
-            //XXX FIXME optimize
-            for(x=0; x<16; x++){
-                sum+= v>>shift;
-                v+= dx;
-            }
-        }
-        sum= RSHIFT(sum, a+8-s->quarter_sample);
-    }
-
-    if      (sum < -len) sum= -len;
-    else if (sum >= len) sum= len-1;
-
-    return sum;
-}
-
-/**
- * decodes the dc value.
- * @param n block index (0-3 are luma, 4-5 are chroma)
- * @param dir_ptr the prediction direction will be stored here
- * @return the quantized dc
- */
-static inline int mpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
-{
-    int level, code;
-
-    if (n < 4)
-        code = get_vlc2(&s->gb, dc_lum.table, DC_VLC_BITS, 1);
-    else
-        code = get_vlc2(&s->gb, dc_chrom.table, DC_VLC_BITS, 1);
-    if (code < 0 || code > 9 /* && s->nbit<9 */){
-        av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
-        return -1;
-    }
-    if (code == 0) {
-        level = 0;
-    } else {
-        if(IS_3IV1){
-            if(code==1)
-                level= 2*get_bits1(&s->gb)-1;
-            else{
-                if(get_bits1(&s->gb))
-                    level = get_bits(&s->gb, code-1) + (1<<(code-1));
-                else
-                    level = -get_bits(&s->gb, code-1) - (1<<(code-1));
-            }
-        }else{
-            level = get_xbits(&s->gb, code);
-        }
-
-        if (code > 8){
-            if(get_bits1(&s->gb)==0){ /* marker */
-                if(s->error_recognition>=2){
-                    av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n");
-                    return -1;
-                }
-            }
-        }
-    }
-
-    return ff_mpeg4_pred_dc(s, n, level, dir_ptr, 0);
-}
-
-/**
- * decodes first partition.
- * @return number of MBs decoded or <0 if an error occurred
- */
-static int mpeg4_decode_partition_a(MpegEncContext *s){
-    int mb_num;
-    static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
-
-    /* decode first partition */
-    mb_num=0;
-    s->first_slice_line=1;
-    for(; s->mb_y<s->mb_height; s->mb_y++){
-        ff_init_block_index(s);
-        for(; s->mb_x<s->mb_width; s->mb_x++){
-            const int xy= s->mb_x + s->mb_y*s->mb_stride;
-            int cbpc;
-            int dir=0;
-
-            mb_num++;
-            ff_update_block_index(s);
-            if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1)
-                s->first_slice_line=0;
-
-            if(s->pict_type==FF_I_TYPE){
-                int i;
-
-                do{
-                    if(show_bits_long(&s->gb, 19)==DC_MARKER){
-                        return mb_num-1;
-                    }
-
-                    cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
-                    if (cbpc < 0){
-                        av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
-                    }
-                }while(cbpc == 8);
-
-                s->cbp_table[xy]= cbpc & 3;
-                s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
-                s->mb_intra = 1;
-
-                if(cbpc & 4) {
-                    ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
-                }
-                s->current_picture.qscale_table[xy]= s->qscale;
-
-                s->mbintra_table[xy]= 1;
-                for(i=0; i<6; i++){
-                    int dc_pred_dir;
-                    int dc= mpeg4_decode_dc(s, i, &dc_pred_dir);
-                    if(dc < 0){
-                        av_log(s->avctx, AV_LOG_ERROR, "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
-                    }
-                    dir<<=1;
-                    if(dc_pred_dir) dir|=1;
-                }
-                s->pred_dir_table[xy]= dir;
-            }else{ /* P/S_TYPE */
-                int mx, my, pred_x, pred_y, bits;
-                int16_t * const mot_val= s->current_picture.motion_val[0][s->block_index[0]];
-                const int stride= s->b8_stride*2;
-
-try_again:
-                bits= show_bits(&s->gb, 17);
-                if(bits==MOTION_MARKER){
-                    return mb_num-1;
-                }
-                skip_bits1(&s->gb);
-                if(bits&0x10000){
-                    /* skip mb */
-                    if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
-                        s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0;
-                        mx= get_amv(s, 0);
-                        my= get_amv(s, 1);
-                    }else{
-                        s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-                        mx=my=0;
-                    }
-                    mot_val[0       ]= mot_val[2       ]=
-                    mot_val[0+stride]= mot_val[2+stride]= mx;
-                    mot_val[1       ]= mot_val[3       ]=
-                    mot_val[1+stride]= mot_val[3+stride]= my;
-
-                    if(s->mbintra_table[xy])
-                        ff_clean_intra_table_entries(s);
-                    continue;
-                }
-
-                cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
-                if (cbpc < 0){
-                    av_log(s->avctx, AV_LOG_ERROR, "cbpc corrupted at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
-                }
-                if(cbpc == 20)
-                    goto try_again;
-
-                s->cbp_table[xy]= cbpc&(8+3); //8 is dquant
-
-                s->mb_intra = ((cbpc & 4) != 0);
-
-                if(s->mb_intra){
-                    s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
-                    s->mbintra_table[xy]= 1;
-                    mot_val[0       ]= mot_val[2       ]=
-                    mot_val[0+stride]= mot_val[2+stride]= 0;
-                    mot_val[1       ]= mot_val[3       ]=
-                    mot_val[1+stride]= mot_val[3+stride]= 0;
-                }else{
-                    if(s->mbintra_table[xy])
-                        ff_clean_intra_table_entries(s);
-
-                    if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE && (cbpc & 16) == 0)
-                        s->mcsel= get_bits1(&s->gb);
-                    else s->mcsel= 0;
-
-                    if ((cbpc & 16) == 0) {
-                        /* 16x16 motion prediction */
-
-                        h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-                        if(!s->mcsel){
-                            mx = h263_decode_motion(s, pred_x, s->f_code);
-                            if (mx >= 0xffff)
-                                return -1;
-
-                            my = h263_decode_motion(s, pred_y, s->f_code);
-                            if (my >= 0xffff)
-                                return -1;
-                            s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
-                        } else {
-                            mx = get_amv(s, 0);
-                            my = get_amv(s, 1);
-                            s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0;
-                        }
-
-                        mot_val[0       ]= mot_val[2       ] =
-                        mot_val[0+stride]= mot_val[2+stride]= mx;
-                        mot_val[1       ]= mot_val[3       ]=
-                        mot_val[1+stride]= mot_val[3+stride]= my;
-                    } else {
-                        int i;
-                        s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
-                        for(i=0;i<4;i++) {
-                            int16_t *mot_val= h263_pred_motion(s, i, 0, &pred_x, &pred_y);
-                            mx = h263_decode_motion(s, pred_x, s->f_code);
-                            if (mx >= 0xffff)
-                                return -1;
-
-                            my = h263_decode_motion(s, pred_y, s->f_code);
-                            if (my >= 0xffff)
-                                return -1;
-                            mot_val[0] = mx;
-                            mot_val[1] = my;
-                        }
-                    }
-                }
-            }
-        }
-        s->mb_x= 0;
-    }
-
-    return mb_num;
-}
-
-/**
- * decode second partition.
- * @return <0 if an error occurred
- */
-static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count){
-    int mb_num=0;
-    static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
-
-    s->mb_x= s->resync_mb_x;
-    s->first_slice_line=1;
-    for(s->mb_y= s->resync_mb_y; mb_num < mb_count; s->mb_y++){
-        ff_init_block_index(s);
-        for(; mb_num < mb_count && s->mb_x<s->mb_width; s->mb_x++){
-            const int xy= s->mb_x + s->mb_y*s->mb_stride;
-
-            mb_num++;
-            ff_update_block_index(s);
-            if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1)
-                s->first_slice_line=0;
-
-            if(s->pict_type==FF_I_TYPE){
-                int ac_pred= get_bits1(&s->gb);
-                int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-                if(cbpy<0){
-                    av_log(s->avctx, AV_LOG_ERROR, "cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
-                }
-
-                s->cbp_table[xy]|= cbpy<<2;
-                s->current_picture.mb_type[xy] |= ac_pred*MB_TYPE_ACPRED;
-            }else{ /* P || S_TYPE */
-                if(IS_INTRA(s->current_picture.mb_type[xy])){
-                    int dir=0,i;
-                    int ac_pred = get_bits1(&s->gb);
-                    int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-
-                    if(cbpy<0){
-                        av_log(s->avctx, AV_LOG_ERROR, "I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
-                    }
-
-                    if(s->cbp_table[xy] & 8) {
-                        ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
-                    }
-                    s->current_picture.qscale_table[xy]= s->qscale;
-
-                    for(i=0; i<6; i++){
-                        int dc_pred_dir;
-                        int dc= mpeg4_decode_dc(s, i, &dc_pred_dir);
-                        if(dc < 0){
-                            av_log(s->avctx, AV_LOG_ERROR, "DC corrupted at %d %d\n", s->mb_x, s->mb_y);
-                            return -1;
-                        }
-                        dir<<=1;
-                        if(dc_pred_dir) dir|=1;
-                    }
-                    s->cbp_table[xy]&= 3; //remove dquant
-                    s->cbp_table[xy]|= cbpy<<2;
-                    s->current_picture.mb_type[xy] |= ac_pred*MB_TYPE_ACPRED;
-                    s->pred_dir_table[xy]= dir;
-                }else if(IS_SKIP(s->current_picture.mb_type[xy])){
-                    s->current_picture.qscale_table[xy]= s->qscale;
-                    s->cbp_table[xy]= 0;
-                }else{
-                    int cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-
-                    if(cbpy<0){
-                        av_log(s->avctx, AV_LOG_ERROR, "P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y);
-                        return -1;
-                    }
-
-                    if(s->cbp_table[xy] & 8) {
-                        ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
-                    }
-                    s->current_picture.qscale_table[xy]= s->qscale;
-
-                    s->cbp_table[xy]&= 3; //remove dquant
-                    s->cbp_table[xy]|= (cbpy^0xf)<<2;
-                }
-            }
-        }
-        if(mb_num >= mb_count) return 0;
-        s->mb_x= 0;
-    }
-    return 0;
-}
-
-/**
- * decodes the first & second partition
- * @return <0 if error (and sets error type in the error_status_table)
- */
-int ff_mpeg4_decode_partitions(MpegEncContext *s)
-{
-    int mb_num;
-    const int part_a_error= s->pict_type==FF_I_TYPE ? (DC_ERROR|MV_ERROR) : MV_ERROR;
-    const int part_a_end  = s->pict_type==FF_I_TYPE ? (DC_END  |MV_END)   : MV_END;
-
-    mb_num= mpeg4_decode_partition_a(s);
-    if(mb_num<0){
-        ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error);
-        return -1;
-    }
-
-    if(s->resync_mb_x + s->resync_mb_y*s->mb_width + mb_num > s->mb_num){
-        av_log(s->avctx, AV_LOG_ERROR, "slice below monitor ...\n");
-        ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, part_a_error);
-        return -1;
-    }
-
-    s->mb_num_left= mb_num;
-
-    if(s->pict_type==FF_I_TYPE){
-        while(show_bits(&s->gb, 9) == 1)
-            skip_bits(&s->gb, 9);
-        if(get_bits_long(&s->gb, 19)!=DC_MARKER){
-            av_log(s->avctx, AV_LOG_ERROR, "marker missing after first I partition at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-    }else{
-        while(show_bits(&s->gb, 10) == 1)
-            skip_bits(&s->gb, 10);
-        if(get_bits(&s->gb, 17)!=MOTION_MARKER){
-            av_log(s->avctx, AV_LOG_ERROR, "marker missing after first P partition at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-    }
-    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, part_a_end);
-
-    if( mpeg4_decode_partition_b(s, mb_num) < 0){
-        if(s->pict_type==FF_P_TYPE)
-            ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, DC_ERROR);
-        return -1;
-    }else{
-        if(s->pict_type==FF_P_TYPE)
-            ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, DC_END);
-    }
-
-    return 0;
-}
-
-/**
- * decodes a block.
- * @return <0 if an error occurred
- */
-static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
-                              int n, int coded, int intra, int rvlc)
-{
-    int level, i, last, run;
-    int dc_pred_dir;
-    RLTable * rl;
-    RL_VLC_ELEM * rl_vlc;
-    const uint8_t * scan_table;
-    int qmul, qadd;
-
-    //Note intra & rvlc should be optimized away if this is inlined
-
-    if(intra) {
-      if(s->use_intra_dc_vlc){
-        /* DC coef */
-        if(s->partitioned_frame){
-            level = s->dc_val[0][ s->block_index[n] ];
-            if(n<4) level= FASTDIV((level + (s->y_dc_scale>>1)), s->y_dc_scale);
-            else    level= FASTDIV((level + (s->c_dc_scale>>1)), s->c_dc_scale);
-            dc_pred_dir= (s->pred_dir_table[s->mb_x + s->mb_y*s->mb_stride]<<n)&32;
-        }else{
-            level = mpeg4_decode_dc(s, n, &dc_pred_dir);
-            if (level < 0)
-                return -1;
-        }
-        block[0] = level;
-        i = 0;
-      }else{
-            i = -1;
-            ff_mpeg4_pred_dc(s, n, 0, &dc_pred_dir, 0);
-      }
-      if (!coded)
-          goto not_coded;
-
-      if(rvlc){
-          rl = &rvlc_rl_intra;
-          rl_vlc = rvlc_rl_intra.rl_vlc[0];
-      }else{
-          rl = &ff_mpeg4_rl_intra;
-          rl_vlc = ff_mpeg4_rl_intra.rl_vlc[0];
-      }
-      if (s->ac_pred) {
-          if (dc_pred_dir == 0)
-              scan_table = s->intra_v_scantable.permutated; /* left */
-          else
-              scan_table = s->intra_h_scantable.permutated; /* top */
-      } else {
-            scan_table = s->intra_scantable.permutated;
-      }
-      qmul=1;
-      qadd=0;
-    } else {
-        i = -1;
-        if (!coded) {
-            s->block_last_index[n] = i;
-            return 0;
-        }
-        if(rvlc) rl = &rvlc_rl_inter;
-        else     rl = &ff_h263_rl_inter;
-
-        scan_table = s->intra_scantable.permutated;
-
-        if(s->mpeg_quant){
-            qmul=1;
-            qadd=0;
-            if(rvlc){
-                rl_vlc = rvlc_rl_inter.rl_vlc[0];
-            }else{
-                rl_vlc = ff_h263_rl_inter.rl_vlc[0];
-            }
-        }else{
-            qmul = s->qscale << 1;
-            qadd = (s->qscale - 1) | 1;
-            if(rvlc){
-                rl_vlc = rvlc_rl_inter.rl_vlc[s->qscale];
-            }else{
-                rl_vlc = ff_h263_rl_inter.rl_vlc[s->qscale];
-            }
-        }
-    }
-  {
-    OPEN_READER(re, &s->gb);
-    for(;;) {
-        UPDATE_CACHE(re, &s->gb);
-        GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
-        if (level==0) {
-          /* escape */
-          if(rvlc){
-                if(SHOW_UBITS(re, &s->gb, 1)==0){
-                    av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in rvlc esc\n");
-                    return -1;
-                }; SKIP_CACHE(re, &s->gb, 1);
-
-                last=  SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
-                run=   SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6);
-                SKIP_COUNTER(re, &s->gb, 1+1+6);
-                UPDATE_CACHE(re, &s->gb);
-
-                if(SHOW_UBITS(re, &s->gb, 1)==0){
-                    av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in rvlc esc\n");
-                    return -1;
-                }; SKIP_CACHE(re, &s->gb, 1);
-
-                level= SHOW_UBITS(re, &s->gb, 11); SKIP_CACHE(re, &s->gb, 11);
-
-                if(SHOW_UBITS(re, &s->gb, 5)!=0x10){
-                    av_log(s->avctx, AV_LOG_ERROR, "reverse esc missing\n");
-                    return -1;
-                }; SKIP_CACHE(re, &s->gb, 5);
-
-                level=  level * qmul + qadd;
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_CACHE(re, &s->gb, 1);
-                SKIP_COUNTER(re, &s->gb, 1+11+5+1);
-
-                i+= run + 1;
-                if(last) i+=192;
-          }else{
-            int cache;
-            cache= GET_CACHE(re, &s->gb);
-
-            if(IS_3IV1)
-                cache ^= 0xC0000000;
-
-            if (cache&0x80000000) {
-                if (cache&0x40000000) {
-                    /* third escape */
-                    SKIP_CACHE(re, &s->gb, 2);
-                    last=  SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
-                    run=   SHOW_UBITS(re, &s->gb, 6); LAST_SKIP_CACHE(re, &s->gb, 6);
-                    SKIP_COUNTER(re, &s->gb, 2+1+6);
-                    UPDATE_CACHE(re, &s->gb);
-
-                    if(IS_3IV1){
-                        level= SHOW_SBITS(re, &s->gb, 12); LAST_SKIP_BITS(re, &s->gb, 12);
-                    }else{
-                        if(SHOW_UBITS(re, &s->gb, 1)==0){
-                            av_log(s->avctx, AV_LOG_ERROR, "1. marker bit missing in 3. esc\n");
-                            return -1;
-                        }; SKIP_CACHE(re, &s->gb, 1);
-
-                        level= SHOW_SBITS(re, &s->gb, 12); SKIP_CACHE(re, &s->gb, 12);
-
-                        if(SHOW_UBITS(re, &s->gb, 1)==0){
-                            av_log(s->avctx, AV_LOG_ERROR, "2. marker bit missing in 3. esc\n");
-                            return -1;
-                        }; LAST_SKIP_CACHE(re, &s->gb, 1);
-
-                        SKIP_COUNTER(re, &s->gb, 1+12+1);
-                    }
-
-#if 0
-                    if(s->error_recognition >= FF_ER_COMPLIANT){
-                        const int abs_level= FFABS(level);
-                        if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
-                            const int run1= run - rl->max_run[last][abs_level] - 1;
-                            if(abs_level <= rl->max_level[last][run]){
-                                av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
-                                return -1;
-                            }
-                            if(s->error_recognition > FF_ER_COMPLIANT){
-                                if(abs_level <= rl->max_level[last][run]*2){
-                                    av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
-                                    return -1;
-                                }
-                                if(run1 >= 0 && abs_level <= rl->max_level[last][run1]){
-                                    av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
-                                    return -1;
-                                }
-                            }
-                        }
-                    }
-#endif
-                    if (level>0) level= level * qmul + qadd;
-                    else         level= level * qmul - qadd;
-
-                    if((unsigned)(level + 2048) > 4095){
-                        if(s->error_recognition > FF_ER_COMPLIANT){
-                            if(level > 2560 || level<-2560){
-                                av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc, qp=%d\n", s->qscale);
-                                return -1;
-                            }
-                        }
-                        level= level<0 ? -2048 : 2047;
-                    }
-
-                    i+= run + 1;
-                    if(last) i+=192;
-                } else {
-                    /* second escape */
-#if MIN_CACHE_BITS < 20
-                    LAST_SKIP_BITS(re, &s->gb, 2);
-                    UPDATE_CACHE(re, &s->gb);
-#else
-                    SKIP_BITS(re, &s->gb, 2);
-#endif
-                    GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
-                    i+= run + rl->max_run[run>>7][level/qmul] +1; //FIXME opt indexing
-                    level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                    LAST_SKIP_BITS(re, &s->gb, 1);
-                }
-            } else {
-                /* first escape */
-#if MIN_CACHE_BITS < 19
-                LAST_SKIP_BITS(re, &s->gb, 1);
-                UPDATE_CACHE(re, &s->gb);
-#else
-                SKIP_BITS(re, &s->gb, 1);
-#endif
-                GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
-                i+= run;
-                level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                LAST_SKIP_BITS(re, &s->gb, 1);
-            }
-          }
-        } else {
-            i+= run;
-            level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-            LAST_SKIP_BITS(re, &s->gb, 1);
-        }
-        if (i > 62){
-            i-= 192;
-            if(i&(~63)){
-                av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            block[scan_table[i]] = level;
-            break;
-        }
-
-        block[scan_table[i]] = level;
-    }
-    CLOSE_READER(re, &s->gb);
-  }
- not_coded:
-    if (intra) {
-        if(!s->use_intra_dc_vlc){
-            block[0] = ff_mpeg4_pred_dc(s, n, block[0], &dc_pred_dir, 0);
-
-            i -= i>>31; //if(i == -1) i=0;
-        }
-
-        mpeg4_pred_ac(s, block, n, dc_pred_dir);
-        if (s->ac_pred) {
-            i = 63; /* XXX: not optimal */
-        }
-    }
-    s->block_last_index[n] = i;
-    return 0;
-}
-
-/**
- * decode partition C of one MB.
- * @return <0 if an error occurred
- */
-static int mpeg4_decode_partitioned_mb(MpegEncContext *s, DCTELEM block[6][64])
-{
-    int cbp, mb_type;
-    const int xy= s->mb_x + s->mb_y*s->mb_stride;
-
-    mb_type= s->current_picture.mb_type[xy];
-    cbp = s->cbp_table[xy];
-
-    s->use_intra_dc_vlc= s->qscale < s->intra_dc_threshold;
-
-    if(s->current_picture.qscale_table[xy] != s->qscale){
-        ff_set_qscale(s, s->current_picture.qscale_table[xy] );
-    }
-
-    if (s->pict_type == FF_P_TYPE || s->pict_type==FF_S_TYPE) {
-        int i;
-        for(i=0; i<4; i++){
-            s->mv[0][i][0] = s->current_picture.motion_val[0][ s->block_index[i] ][0];
-            s->mv[0][i][1] = s->current_picture.motion_val[0][ s->block_index[i] ][1];
-        }
-        s->mb_intra = IS_INTRA(mb_type);
-
-        if (IS_SKIP(mb_type)) {
-            /* skip mb */
-            for(i=0;i<6;i++)
-                s->block_last_index[i] = -1;
-            s->mv_dir = MV_DIR_FORWARD;
-            s->mv_type = MV_TYPE_16X16;
-            if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
-                s->mcsel=1;
-                s->mb_skipped = 0;
-            }else{
-                s->mcsel=0;
-                s->mb_skipped = 1;
-            }
-        }else if(s->mb_intra){
-            s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]);
-        }else if(!s->mb_intra){
-//            s->mcsel= 0; //FIXME do we need to init that
-
-            s->mv_dir = MV_DIR_FORWARD;
-            if (IS_8X8(mb_type)) {
-                s->mv_type = MV_TYPE_8X8;
-            } else {
-                s->mv_type = MV_TYPE_16X16;
-            }
-        }
-    } else { /* I-Frame */
-        s->mb_intra = 1;
-        s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]);
-    }
-
-    if (!IS_SKIP(mb_type)) {
-        int i;
-        s->dsp.clear_blocks(s->block[0]);
-        /* decode each block */
-        for (i = 0; i < 6; i++) {
-            if(mpeg4_decode_block(s, block[i], i, cbp&32, s->mb_intra, s->rvlc) < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "texture corrupted at %d %d %d\n", s->mb_x, s->mb_y, s->mb_intra);
-                return -1;
-            }
-            cbp+=cbp;
-        }
-    }
-
-    /* per-MB end of slice check */
-
-    if(--s->mb_num_left <= 0){
-        if(mpeg4_is_resync(s))
-            return SLICE_END;
-        else
-            return SLICE_NOEND;
-    }else{
-        if(mpeg4_is_resync(s)){
-            const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
-            if(s->cbp_table[xy+delta])
-                return SLICE_END;
-        }
-        return SLICE_OK;
-    }
-}
-
-static int mpeg4_decode_mb(MpegEncContext *s,
-                      DCTELEM block[6][64])
-{
-    int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
-    int16_t *mot_val;
-    static int8_t quant_tab[4] = { -1, -2, 1, 2 };
-    const int xy= s->mb_x + s->mb_y * s->mb_stride;
-
-    assert(s->h263_pred);
-
-    if (s->pict_type == FF_P_TYPE || s->pict_type==FF_S_TYPE) {
-        do{
-            if (get_bits1(&s->gb)) {
-                /* skip mb */
-                s->mb_intra = 0;
-                for(i=0;i<6;i++)
-                    s->block_last_index[i] = -1;
-                s->mv_dir = MV_DIR_FORWARD;
-                s->mv_type = MV_TYPE_16X16;
-                if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE){
-                    s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0;
-                    s->mcsel=1;
-                    s->mv[0][0][0]= get_amv(s, 0);
-                    s->mv[0][0][1]= get_amv(s, 1);
-
-                    s->mb_skipped = 0;
-                }else{
-                    s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-                    s->mcsel=0;
-                    s->mv[0][0][0] = 0;
-                    s->mv[0][0][1] = 0;
-                    s->mb_skipped = 1;
-                }
-                goto end;
-            }
-            cbpc = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
-            if (cbpc < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-        }while(cbpc == 20);
-
-        s->dsp.clear_blocks(s->block[0]);
-        dquant = cbpc & 8;
-        s->mb_intra = ((cbpc & 4) != 0);
-        if (s->mb_intra) goto intra;
-
-        if(s->pict_type==FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE && (cbpc & 16) == 0)
-            s->mcsel= get_bits1(&s->gb);
-        else s->mcsel= 0;
-        cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1) ^ 0x0F;
-
-        cbp = (cbpc & 3) | (cbpy << 2);
-        if (dquant) {
-            ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
-        }
-        if((!s->progressive_sequence) && (cbp || (s->workaround_bugs&FF_BUG_XVID_ILACE)))
-            s->interlaced_dct= get_bits1(&s->gb);
-
-        s->mv_dir = MV_DIR_FORWARD;
-        if ((cbpc & 16) == 0) {
-            if(s->mcsel){
-                s->current_picture.mb_type[xy]= MB_TYPE_GMC | MB_TYPE_16x16 | MB_TYPE_L0;
-                /* 16x16 global motion prediction */
-                s->mv_type = MV_TYPE_16X16;
-                mx= get_amv(s, 0);
-                my= get_amv(s, 1);
-                s->mv[0][0][0] = mx;
-                s->mv[0][0][1] = my;
-            }else if((!s->progressive_sequence) && get_bits1(&s->gb)){
-                s->current_picture.mb_type[xy]= MB_TYPE_16x8 | MB_TYPE_L0 | MB_TYPE_INTERLACED;
-                /* 16x8 field motion prediction */
-                s->mv_type= MV_TYPE_FIELD;
-
-                s->field_select[0][0]= get_bits1(&s->gb);
-                s->field_select[0][1]= get_bits1(&s->gb);
-
-                h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-
-                for(i=0; i<2; i++){
-                    mx = h263_decode_motion(s, pred_x, s->f_code);
-                    if (mx >= 0xffff)
-                        return -1;
-
-                    my = h263_decode_motion(s, pred_y/2, s->f_code);
-                    if (my >= 0xffff)
-                        return -1;
-
-                    s->mv[0][i][0] = mx;
-                    s->mv[0][i][1] = my;
-                }
-            }else{
-                s->current_picture.mb_type[xy]= MB_TYPE_16x16 | MB_TYPE_L0;
-                /* 16x16 motion prediction */
-                s->mv_type = MV_TYPE_16X16;
-                h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-                mx = h263_decode_motion(s, pred_x, s->f_code);
-
-                if (mx >= 0xffff)
-                    return -1;
-
-                my = h263_decode_motion(s, pred_y, s->f_code);
-
-                if (my >= 0xffff)
-                    return -1;
-                s->mv[0][0][0] = mx;
-                s->mv[0][0][1] = my;
-            }
-        } else {
-            s->current_picture.mb_type[xy]= MB_TYPE_8x8 | MB_TYPE_L0;
-            s->mv_type = MV_TYPE_8X8;
-            for(i=0;i<4;i++) {
-                mot_val = h263_pred_motion(s, i, 0, &pred_x, &pred_y);
-                mx = h263_decode_motion(s, pred_x, s->f_code);
-                if (mx >= 0xffff)
-                    return -1;
-
-                my = h263_decode_motion(s, pred_y, s->f_code);
-                if (my >= 0xffff)
-                    return -1;
-                s->mv[0][i][0] = mx;
-                s->mv[0][i][1] = my;
-                mot_val[0] = mx;
-                mot_val[1] = my;
-            }
-        }
-    } else if(s->pict_type==FF_B_TYPE) {
-        int modb1; // first bit of modb
-        int modb2; // second bit of modb
-        int mb_type;
-
-        s->mb_intra = 0; //B-frames never contain intra blocks
-        s->mcsel=0;      //     ...               true gmc blocks
-
-        if(s->mb_x==0){
-            for(i=0; i<2; i++){
-                s->last_mv[i][0][0]=
-                s->last_mv[i][0][1]=
-                s->last_mv[i][1][0]=
-                s->last_mv[i][1][1]= 0;
-            }
-        }
-
-        /* if we skipped it in the future P Frame than skip it now too */
-        s->mb_skipped= s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]; // Note, skiptab=0 if last was GMC
-
-        if(s->mb_skipped){
-                /* skip mb */
-            for(i=0;i<6;i++)
-                s->block_last_index[i] = -1;
-
-            s->mv_dir = MV_DIR_FORWARD;
-            s->mv_type = MV_TYPE_16X16;
-            s->mv[0][0][0] = 0;
-            s->mv[0][0][1] = 0;
-            s->mv[1][0][0] = 0;
-            s->mv[1][0][1] = 0;
-            s->current_picture.mb_type[xy]= MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-            goto end;
-        }
-
-        modb1= get_bits1(&s->gb);
-        if(modb1){
-            mb_type= MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_L0L1; //like MB_TYPE_B_DIRECT but no vectors coded
-            cbp=0;
-        }else{
-            modb2= get_bits1(&s->gb);
-            mb_type= get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1);
-            if(mb_type<0){
-                av_log(s->avctx, AV_LOG_ERROR, "illegal MB_type\n");
-                return -1;
-            }
-            mb_type= mb_type_b_map[ mb_type ];
-            if(modb2) cbp= 0;
-            else{
-                s->dsp.clear_blocks(s->block[0]);
-                cbp= get_bits(&s->gb, 6);
-            }
-
-            if ((!IS_DIRECT(mb_type)) && cbp) {
-                if(get_bits1(&s->gb)){
-                    ff_set_qscale(s, s->qscale + get_bits1(&s->gb)*4 - 2);
-                }
-            }
-
-            if(!s->progressive_sequence){
-                if(cbp)
-                    s->interlaced_dct= get_bits1(&s->gb);
-
-                if(!IS_DIRECT(mb_type) && get_bits1(&s->gb)){
-                    mb_type |= MB_TYPE_16x8 | MB_TYPE_INTERLACED;
-                    mb_type &= ~MB_TYPE_16x16;
-
-                    if(USES_LIST(mb_type, 0)){
-                        s->field_select[0][0]= get_bits1(&s->gb);
-                        s->field_select[0][1]= get_bits1(&s->gb);
-                    }
-                    if(USES_LIST(mb_type, 1)){
-                        s->field_select[1][0]= get_bits1(&s->gb);
-                        s->field_select[1][1]= get_bits1(&s->gb);
-                    }
-                }
-            }
-
-            s->mv_dir = 0;
-            if((mb_type & (MB_TYPE_DIRECT2|MB_TYPE_INTERLACED)) == 0){
-                s->mv_type= MV_TYPE_16X16;
-
-                if(USES_LIST(mb_type, 0)){
-                    s->mv_dir = MV_DIR_FORWARD;
-
-                    mx = h263_decode_motion(s, s->last_mv[0][0][0], s->f_code);
-                    my = h263_decode_motion(s, s->last_mv[0][0][1], s->f_code);
-                    s->last_mv[0][1][0]= s->last_mv[0][0][0]= s->mv[0][0][0] = mx;
-                    s->last_mv[0][1][1]= s->last_mv[0][0][1]= s->mv[0][0][1] = my;
-                }
-
-                if(USES_LIST(mb_type, 1)){
-                    s->mv_dir |= MV_DIR_BACKWARD;
-
-                    mx = h263_decode_motion(s, s->last_mv[1][0][0], s->b_code);
-                    my = h263_decode_motion(s, s->last_mv[1][0][1], s->b_code);
-                    s->last_mv[1][1][0]= s->last_mv[1][0][0]= s->mv[1][0][0] = mx;
-                    s->last_mv[1][1][1]= s->last_mv[1][0][1]= s->mv[1][0][1] = my;
-                }
-            }else if(!IS_DIRECT(mb_type)){
-                s->mv_type= MV_TYPE_FIELD;
-
-                if(USES_LIST(mb_type, 0)){
-                    s->mv_dir = MV_DIR_FORWARD;
-
-                    for(i=0; i<2; i++){
-                        mx = h263_decode_motion(s, s->last_mv[0][i][0]  , s->f_code);
-                        my = h263_decode_motion(s, s->last_mv[0][i][1]/2, s->f_code);
-                        s->last_mv[0][i][0]=  s->mv[0][i][0] = mx;
-                        s->last_mv[0][i][1]= (s->mv[0][i][1] = my)*2;
-                    }
-                }
-
-                if(USES_LIST(mb_type, 1)){
-                    s->mv_dir |= MV_DIR_BACKWARD;
-
-                    for(i=0; i<2; i++){
-                        mx = h263_decode_motion(s, s->last_mv[1][i][0]  , s->b_code);
-                        my = h263_decode_motion(s, s->last_mv[1][i][1]/2, s->b_code);
-                        s->last_mv[1][i][0]=  s->mv[1][i][0] = mx;
-                        s->last_mv[1][i][1]= (s->mv[1][i][1] = my)*2;
-                    }
-                }
-            }
-        }
-
-        if(IS_DIRECT(mb_type)){
-            if(IS_SKIP(mb_type))
-                mx=my=0;
-            else{
-                mx = h263_decode_motion(s, 0, 1);
-                my = h263_decode_motion(s, 0, 1);
-            }
-
-            s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
-            mb_type |= ff_mpeg4_set_direct_mv(s, mx, my);
-        }
-        s->current_picture.mb_type[xy]= mb_type;
-    } else { /* I-Frame */
-        do{
-            cbpc = get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 2);
-            if (cbpc < 0){
-                av_log(s->avctx, AV_LOG_ERROR, "I cbpc damaged at %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-        }while(cbpc == 8);
-
-        dquant = cbpc & 4;
-        s->mb_intra = 1;
-intra:
-        s->ac_pred = get_bits1(&s->gb);
-        if(s->ac_pred)
-            s->current_picture.mb_type[xy]= MB_TYPE_INTRA | MB_TYPE_ACPRED;
-        else
-            s->current_picture.mb_type[xy]= MB_TYPE_INTRA;
-
-        cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-        if(cbpy<0){
-            av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        cbp = (cbpc & 3) | (cbpy << 2);
-
-        s->use_intra_dc_vlc= s->qscale < s->intra_dc_threshold;
-
-        if (dquant) {
-            ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 2)]);
-        }
-
-        if(!s->progressive_sequence)
-            s->interlaced_dct= get_bits1(&s->gb);
-
-        s->dsp.clear_blocks(s->block[0]);
-        /* decode each block */
-        for (i = 0; i < 6; i++) {
-            if (mpeg4_decode_block(s, block[i], i, cbp&32, 1, 0) < 0)
-                return -1;
-            cbp+=cbp;
-        }
-        goto end;
-    }
-
-    /* decode each block */
-    for (i = 0; i < 6; i++) {
-        if (mpeg4_decode_block(s, block[i], i, cbp&32, 0, 0) < 0)
-            return -1;
-        cbp+=cbp;
-    }
-end:
-
-        /* per-MB end of slice check */
-    if(s->codec_id==CODEC_ID_MPEG4){
-        if(mpeg4_is_resync(s)){
-            const int delta= s->mb_x + 1 == s->mb_width ? 2 : 1;
-            if(s->pict_type==FF_B_TYPE && s->next_picture.mbskip_table[xy + delta])
-                return SLICE_OK;
-            return SLICE_END;
-        }
-    }
-
-    return SLICE_OK;
-}
-
-
-static int mpeg4_decode_gop_header(MpegEncContext * s, GetBitContext *gb){
-    int hours, minutes, seconds;
-
-    hours= get_bits(gb, 5);
-    minutes= get_bits(gb, 6);
-    skip_bits1(gb);
-    seconds= get_bits(gb, 6);
-
-    s->time_base= seconds + 60*(minutes + 60*hours);
-
-    skip_bits1(gb);
-    skip_bits1(gb);
-
-    return 0;
-}
-
-static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
-    int width, height, vo_ver_id;
-
-    /* vol header */
-    skip_bits(gb, 1); /* random access */
-    s->vo_type= get_bits(gb, 8);
-    if (get_bits1(gb) != 0) { /* is_ol_id */
-        vo_ver_id = get_bits(gb, 4); /* vo_ver_id */
-        skip_bits(gb, 3); /* vo_priority */
-    } else {
-        vo_ver_id = 1;
-    }
-    s->aspect_ratio_info= get_bits(gb, 4);
-    if(s->aspect_ratio_info == FF_ASPECT_EXTENDED){
-        s->avctx->sample_aspect_ratio.num= get_bits(gb, 8); // par_width
-        s->avctx->sample_aspect_ratio.den= get_bits(gb, 8); // par_height
-    }else{
-        s->avctx->sample_aspect_ratio= ff_h263_pixel_aspect[s->aspect_ratio_info];
-    }
-
-    if ((s->vol_control_parameters=get_bits1(gb))) { /* vol control parameter */
-        int chroma_format= get_bits(gb, 2);
-        if(chroma_format!=CHROMA_420){
-            av_log(s->avctx, AV_LOG_ERROR, "illegal chroma format\n");
-        }
-        s->low_delay= get_bits1(gb);
-        if(get_bits1(gb)){ /* vbv parameters */
-            get_bits(gb, 15);   /* first_half_bitrate */
-            skip_bits1(gb);     /* marker */
-            get_bits(gb, 15);   /* latter_half_bitrate */
-            skip_bits1(gb);     /* marker */
-            get_bits(gb, 15);   /* first_half_vbv_buffer_size */
-            skip_bits1(gb);     /* marker */
-            get_bits(gb, 3);    /* latter_half_vbv_buffer_size */
-            get_bits(gb, 11);   /* first_half_vbv_occupancy */
-            skip_bits1(gb);     /* marker */
-            get_bits(gb, 15);   /* latter_half_vbv_occupancy */
-            skip_bits1(gb);     /* marker */
-        }
-    }else{
-        // set low delay flag only once the smartest? low delay detection won't be overriden
-        if(s->picture_number==0)
-            s->low_delay=0;
-    }
-
-    s->shape = get_bits(gb, 2); /* vol shape */
-    if(s->shape != RECT_SHAPE) av_log(s->avctx, AV_LOG_ERROR, "only rectangular vol supported\n");
-    if(s->shape == GRAY_SHAPE && vo_ver_id != 1){
-        av_log(s->avctx, AV_LOG_ERROR, "Gray shape not supported\n");
-        skip_bits(gb, 4);  //video_object_layer_shape_extension
-    }
-
-    check_marker(gb, "before time_increment_resolution");
-
-    s->avctx->time_base.den = get_bits(gb, 16);
-    if(!s->avctx->time_base.den){
-        av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n");
-        return -1;
-    }
-
-    s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1;
-    if (s->time_increment_bits < 1)
-        s->time_increment_bits = 1;
-
-    check_marker(gb, "before fixed_vop_rate");
-
-    if (get_bits1(gb) != 0) {   /* fixed_vop_rate  */
-        s->avctx->time_base.num = get_bits(gb, s->time_increment_bits);
-    }else
-        s->avctx->time_base.num = 1;
-
-    s->t_frame=0;
-
-    if (s->shape != BIN_ONLY_SHAPE) {
-        if (s->shape == RECT_SHAPE) {
-            skip_bits1(gb);   /* marker */
-            width = get_bits(gb, 13);
-            skip_bits1(gb);   /* marker */
-            height = get_bits(gb, 13);
-            skip_bits1(gb);   /* marker */
-            if(width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))){ /* they should be non zero but who knows ... */
-                s->width = width;
-                s->height = height;
-            }
-        }
-
-        s->progressive_sequence=
-        s->progressive_frame= get_bits1(gb)^1;
-        s->interlaced_dct=0;
-        if(!get_bits1(gb) && (s->avctx->debug & FF_DEBUG_PICT_INFO))
-            av_log(s->avctx, AV_LOG_INFO, "MPEG4 OBMC not supported (very likely buggy encoder)\n");   /* OBMC Disable */
-        if (vo_ver_id == 1) {
-            s->vol_sprite_usage = get_bits1(gb); /* vol_sprite_usage */
-        } else {
-            s->vol_sprite_usage = get_bits(gb, 2); /* vol_sprite_usage */
-        }
-        if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "Static Sprites not supported\n");
-        if(s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE){
-            if(s->vol_sprite_usage==STATIC_SPRITE){
-                s->sprite_width = get_bits(gb, 13);
-                skip_bits1(gb); /* marker */
-                s->sprite_height= get_bits(gb, 13);
-                skip_bits1(gb); /* marker */
-                s->sprite_left  = get_bits(gb, 13);
-                skip_bits1(gb); /* marker */
-                s->sprite_top   = get_bits(gb, 13);
-                skip_bits1(gb); /* marker */
-            }
-            s->num_sprite_warping_points= get_bits(gb, 6);
-            if(s->num_sprite_warping_points > 3){
-                av_log(s->avctx, AV_LOG_ERROR, "%d sprite_warping_points\n", s->num_sprite_warping_points);
-                s->num_sprite_warping_points= 0;
-                return -1;
-            }
-            s->sprite_warping_accuracy = get_bits(gb, 2);
-            s->sprite_brightness_change= get_bits1(gb);
-            if(s->vol_sprite_usage==STATIC_SPRITE)
-                s->low_latency_sprite= get_bits1(gb);
-        }
-        // FIXME sadct disable bit if verid!=1 && shape not rect
-
-        if (get_bits1(gb) == 1) {   /* not_8_bit */
-            s->quant_precision = get_bits(gb, 4); /* quant_precision */
-            if(get_bits(gb, 4)!=8) av_log(s->avctx, AV_LOG_ERROR, "N-bit not supported\n"); /* bits_per_pixel */
-            if(s->quant_precision!=5) av_log(s->avctx, AV_LOG_ERROR, "quant precision %d\n", s->quant_precision);
-        } else {
-            s->quant_precision = 5;
-        }
-
-        // FIXME a bunch of grayscale shape things
-
-        if((s->mpeg_quant=get_bits1(gb))){ /* vol_quant_type */
-            int i, v;
-
-            /* load default matrixes */
-            for(i=0; i<64; i++){
-                int j= s->dsp.idct_permutation[i];
-                v= ff_mpeg4_default_intra_matrix[i];
-                s->intra_matrix[j]= v;
-                s->chroma_intra_matrix[j]= v;
-
-                v= ff_mpeg4_default_non_intra_matrix[i];
-                s->inter_matrix[j]= v;
-                s->chroma_inter_matrix[j]= v;
-            }
-
-            /* load custom intra matrix */
-            if(get_bits1(gb)){
-                int last=0;
-                for(i=0; i<64; i++){
-                    int j;
-                    v= get_bits(gb, 8);
-                    if(v==0) break;
-
-                    last= v;
-                    j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
-                    s->intra_matrix[j]= v;
-                    s->chroma_intra_matrix[j]= v;
-                }
-
-                /* replicate last value */
-                for(; i<64; i++){
-                    int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
-                    s->intra_matrix[j]= last;
-                    s->chroma_intra_matrix[j]= last;
-                }
-            }
-
-            /* load custom non intra matrix */
-            if(get_bits1(gb)){
-                int last=0;
-                for(i=0; i<64; i++){
-                    int j;
-                    v= get_bits(gb, 8);
-                    if(v==0) break;
-
-                    last= v;
-                    j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
-                    s->inter_matrix[j]= v;
-                    s->chroma_inter_matrix[j]= v;
-                }
-
-                /* replicate last value */
-                for(; i<64; i++){
-                    int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
-                    s->inter_matrix[j]= last;
-                    s->chroma_inter_matrix[j]= last;
-                }
-            }
-
-            // FIXME a bunch of grayscale shape things
-        }
-
-        if(vo_ver_id != 1)
-             s->quarter_sample= get_bits1(gb);
-        else s->quarter_sample=0;
-
-        if(!get_bits1(gb)){
-            int pos= get_bits_count(gb);
-            int estimation_method= get_bits(gb, 2);
-            if(estimation_method<2){
-                if(!get_bits1(gb)){
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //opaque
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //transparent
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //intra_cae
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //inter_cae
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //no_update
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //upampling
-                }
-                if(!get_bits1(gb)){
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //intra_blocks
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //inter_blocks
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //inter4v_blocks
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //not coded blocks
-                }
-                if(!check_marker(gb, "in complexity estimation part 1")){
-                    skip_bits_long(gb, pos - get_bits_count(gb));
-                    goto no_cplx_est;
-                }
-                if(!get_bits1(gb)){
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //dct_coeffs
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //dct_lines
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //vlc_syms
-                    s->cplx_estimation_trash_i += 4*get_bits1(gb); //vlc_bits
-                }
-                if(!get_bits1(gb)){
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //apm
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //npm
-                    s->cplx_estimation_trash_b += 8*get_bits1(gb); //interpolate_mc_q
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //forwback_mc_q
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //halfpel2
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //halfpel4
-                }
-                if(!check_marker(gb, "in complexity estimation part 2")){
-                    skip_bits_long(gb, pos - get_bits_count(gb));
-                    goto no_cplx_est;
-                }
-                if(estimation_method==1){
-                    s->cplx_estimation_trash_i += 8*get_bits1(gb); //sadct
-                    s->cplx_estimation_trash_p += 8*get_bits1(gb); //qpel
-                }
-            }else
-                av_log(s->avctx, AV_LOG_ERROR, "Invalid Complexity estimation method %d\n", estimation_method);
-        }else{
-no_cplx_est:
-            s->cplx_estimation_trash_i=
-            s->cplx_estimation_trash_p=
-            s->cplx_estimation_trash_b= 0;
-        }
-
-        s->resync_marker= !get_bits1(gb); /* resync_marker_disabled */
-
-        s->data_partitioning= get_bits1(gb);
-        if(s->data_partitioning){
-            s->rvlc= get_bits1(gb);
-        }
-
-        if(vo_ver_id != 1) {
-            s->new_pred= get_bits1(gb);
-            if(s->new_pred){
-                av_log(s->avctx, AV_LOG_ERROR, "new pred not supported\n");
-                skip_bits(gb, 2); /* requested upstream message type */
-                skip_bits1(gb); /* newpred segment type */
-            }
-            s->reduced_res_vop= get_bits1(gb);
-            if(s->reduced_res_vop) av_log(s->avctx, AV_LOG_ERROR, "reduced resolution VOP not supported\n");
-        }
-        else{
-            s->new_pred=0;
-            s->reduced_res_vop= 0;
-        }
-
-        s->scalability= get_bits1(gb);
-
-        if (s->scalability) {
-            GetBitContext bak= *gb;
-            int ref_layer_id;
-            int ref_layer_sampling_dir;
-            int h_sampling_factor_n;
-            int h_sampling_factor_m;
-            int v_sampling_factor_n;
-            int v_sampling_factor_m;
-
-            s->hierachy_type= get_bits1(gb);
-            ref_layer_id= get_bits(gb, 4);
-            ref_layer_sampling_dir= get_bits1(gb);
-            h_sampling_factor_n= get_bits(gb, 5);
-            h_sampling_factor_m= get_bits(gb, 5);
-            v_sampling_factor_n= get_bits(gb, 5);
-            v_sampling_factor_m= get_bits(gb, 5);
-            s->enhancement_type= get_bits1(gb);
-
-            if(   h_sampling_factor_n==0 || h_sampling_factor_m==0
-               || v_sampling_factor_n==0 || v_sampling_factor_m==0){
-                /* illegal scalability header (VERY broken encoder),
-                 * trying to workaround */
-                s->scalability=0;
-                *gb= bak;
-            }else
-                av_log(s->avctx, AV_LOG_ERROR, "scalability not supported\n");
-
-            // bin shape stuff FIXME
-        }
-    }
-    return 0;
-}
-
-/**
- * decodes the user data stuff in the header.
- * Also initializes divx/xvid/lavc_version/build.
- */
-static int decode_user_data(MpegEncContext *s, GetBitContext *gb){
-    char buf[256];
-    int i;
-    int e;
-    int ver = 0, build = 0, ver2 = 0, ver3 = 0;
-    char last;
-
-    for(i=0; i<255 && get_bits_count(gb) < gb->size_in_bits; i++){
-        if(show_bits(gb, 23) == 0) break;
-        buf[i]= get_bits(gb, 8);
-    }
-    buf[i]=0;
-
-    /* divx detection */
-    e=sscanf(buf, "DivX%dBuild%d%c", &ver, &build, &last);
-    if(e<2)
-        e=sscanf(buf, "DivX%db%d%c", &ver, &build, &last);
-    if(e>=2){
-        s->divx_version= ver;
-        s->divx_build= build;
-        s->divx_packed= e==3 && last=='p';
-        if(s->divx_packed && !s->showed_packed_warning) {
-            av_log(s->avctx, AV_LOG_WARNING, "Invalid and inefficient vfw-avi packed B frames detected\n");
-            s->showed_packed_warning=1;
-        }
-    }
-
-    /* ffmpeg detection */
-    e=sscanf(buf, "FFmpe%*[^b]b%d", &build)+3;
-    if(e!=4)
-        e=sscanf(buf, "FFmpeg v%d.%d.%d / libavcodec build: %d", &ver, &ver2, &ver3, &build);
-    if(e!=4){
-        e=sscanf(buf, "Lavc%d.%d.%d", &ver, &ver2, &ver3)+1;
-        if (e>1)
-            build= (ver<<16) + (ver2<<8) + ver3;
-    }
-    if(e!=4){
-        if(strcmp(buf, "ffmpeg")==0){
-            s->lavc_build= 4600;
-        }
-    }
-    if(e==4){
-        s->lavc_build= build;
-    }
-
-    /* Xvid detection */
-    e=sscanf(buf, "XviD%d", &build);
-    if(e==1){
-        s->xvid_build= build;
-    }
-
-    return 0;
-}
-
-static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){
-    int time_incr, time_increment;
-
-    s->pict_type = get_bits(gb, 2) + FF_I_TYPE;        /* pict type: I = 0 , P = 1 */
-    if(s->pict_type==FF_B_TYPE && s->low_delay && s->vol_control_parameters==0 && !(s->flags & CODEC_FLAG_LOW_DELAY)){
-        av_log(s->avctx, AV_LOG_ERROR, "low_delay flag incorrectly, clearing it\n");
-        s->low_delay=0;
-    }
-
-    s->partitioned_frame= s->data_partitioning && s->pict_type!=FF_B_TYPE;
-    if(s->partitioned_frame)
-        s->decode_mb= mpeg4_decode_partitioned_mb;
-    else
-        s->decode_mb= mpeg4_decode_mb;
-
-    time_incr=0;
-    while (get_bits1(gb) != 0)
-        time_incr++;
-
-    check_marker(gb, "before time_increment");
-
-    if(s->time_increment_bits==0 || !(show_bits(gb, s->time_increment_bits+1)&1)){
-        av_log(s->avctx, AV_LOG_ERROR, "hmm, seems the headers are not complete, trying to guess time_increment_bits\n");
-
-        for(s->time_increment_bits=1 ;s->time_increment_bits<16; s->time_increment_bits++){
-            if (    s->pict_type == FF_P_TYPE
-                || (s->pict_type == FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE)) {
-                if((show_bits(gb, s->time_increment_bits+6)&0x37) == 0x30) break;
-            }else
-                if((show_bits(gb, s->time_increment_bits+5)&0x1F) == 0x18) break;
-        }
-
-        av_log(s->avctx, AV_LOG_ERROR, "my guess is %d bits ;)\n",s->time_increment_bits);
-    }
-
-    if(IS_3IV1) time_increment= get_bits1(gb); //FIXME investigate further
-    else time_increment= get_bits(gb, s->time_increment_bits);
-
-    if(s->pict_type!=FF_B_TYPE){
-        s->last_time_base= s->time_base;
-        s->time_base+= time_incr;
-        s->time= s->time_base*s->avctx->time_base.den + time_increment;
-        if(s->workaround_bugs&FF_BUG_UMP4){
-            if(s->time < s->last_non_b_time){
-                /* header is not mpeg-4-compatible, broken encoder,
-                 * trying to workaround */
-                s->time_base++;
-                s->time+= s->avctx->time_base.den;
-            }
-        }
-        s->pp_time= s->time - s->last_non_b_time;
-        s->last_non_b_time= s->time;
-    }else{
-        s->time= (s->last_time_base + time_incr)*s->avctx->time_base.den + time_increment;
-        s->pb_time= s->pp_time - (s->last_non_b_time - s->time);
-        if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){
-            /* messed up order, maybe after seeking? skipping current b-frame */
-            return FRAME_SKIPPED;
-        }
-        ff_mpeg4_init_direct_mv(s);
-
-        if(s->t_frame==0) s->t_frame= s->pb_time;
-        if(s->t_frame==0) s->t_frame=1; // 1/0 protection
-        s->pp_field_time= (  ROUNDED_DIV(s->last_non_b_time, s->t_frame)
-                           - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2;
-        s->pb_field_time= (  ROUNDED_DIV(s->time, s->t_frame)
-                           - ROUNDED_DIV(s->last_non_b_time - s->pp_time, s->t_frame))*2;
-        if(!s->progressive_sequence){
-            if(s->pp_field_time <= s->pb_field_time || s->pb_field_time <= 1)
-                return FRAME_SKIPPED;
-        }
-    }
-
-    if(s->avctx->time_base.num)
-        s->current_picture_ptr->pts= (s->time + s->avctx->time_base.num/2) / s->avctx->time_base.num;
-    else
-        s->current_picture_ptr->pts= AV_NOPTS_VALUE;
-    if(s->avctx->debug&FF_DEBUG_PTS)
-        av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %"PRId64"\n", s->current_picture_ptr->pts);
-
-    check_marker(gb, "before vop_coded");
-
-    /* vop coded */
-    if (get_bits1(gb) != 1){
-        if(s->avctx->debug&FF_DEBUG_PICT_INFO)
-            av_log(s->avctx, AV_LOG_ERROR, "vop not coded\n");
-        return FRAME_SKIPPED;
-    }
-    if (s->shape != BIN_ONLY_SHAPE && ( s->pict_type == FF_P_TYPE
-                          || (s->pict_type == FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE))) {
-        /* rounding type for motion estimation */
-        s->no_rounding = get_bits1(gb);
-    } else {
-        s->no_rounding = 0;
-    }
-//FIXME reduced res stuff
-
-     if (s->shape != RECT_SHAPE) {
-         if (s->vol_sprite_usage != 1 || s->pict_type != FF_I_TYPE) {
-             int width, height, hor_spat_ref, ver_spat_ref;
-
-             width = get_bits(gb, 13);
-             skip_bits1(gb);   /* marker */
-             height = get_bits(gb, 13);
-             skip_bits1(gb);   /* marker */
-             hor_spat_ref = get_bits(gb, 13); /* hor_spat_ref */
-             skip_bits1(gb);   /* marker */
-             ver_spat_ref = get_bits(gb, 13); /* ver_spat_ref */
-         }
-         skip_bits1(gb); /* change_CR_disable */
-
-         if (get_bits1(gb) != 0) {
-             skip_bits(gb, 8); /* constant_alpha_value */
-         }
-     }
-//FIXME complexity estimation stuff
-
-     if (s->shape != BIN_ONLY_SHAPE) {
-         skip_bits_long(gb, s->cplx_estimation_trash_i);
-         if(s->pict_type != FF_I_TYPE)
-            skip_bits_long(gb, s->cplx_estimation_trash_p);
-         if(s->pict_type == FF_B_TYPE)
-            skip_bits_long(gb, s->cplx_estimation_trash_b);
-
-         s->intra_dc_threshold= mpeg4_dc_threshold[ get_bits(gb, 3) ];
-         if(!s->progressive_sequence){
-             s->top_field_first= get_bits1(gb);
-             s->alternate_scan= get_bits1(gb);
-         }else
-             s->alternate_scan= 0;
-     }
-
-     if(s->alternate_scan){
-         ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_alternate_vertical_scan);
-         ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_alternate_vertical_scan);
-         ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_vertical_scan);
-         ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
-     } else{
-         ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_zigzag_direct);
-         ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_zigzag_direct);
-         ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
-         ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
-     }
-
-     if(s->pict_type == FF_S_TYPE && (s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE)){
-         mpeg4_decode_sprite_trajectory(s, gb);
-         if(s->sprite_brightness_change) av_log(s->avctx, AV_LOG_ERROR, "sprite_brightness_change not supported\n");
-         if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n");
-     }
-
-     if (s->shape != BIN_ONLY_SHAPE) {
-         s->chroma_qscale= s->qscale = get_bits(gb, s->quant_precision);
-         if(s->qscale==0){
-             av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (qscale=0)\n");
-             return -1; // makes no sense to continue, as there is nothing left from the image then
-         }
-
-         if (s->pict_type != FF_I_TYPE) {
-             s->f_code = get_bits(gb, 3);       /* fcode_for */
-             if(s->f_code==0){
-                 av_log(s->avctx, AV_LOG_ERROR, "Error, header damaged or not MPEG4 header (f_code=0)\n");
-                 return -1; // makes no sense to continue, as the MV decoding will break very quickly
-             }
-         }else
-             s->f_code=1;
-
-         if (s->pict_type == FF_B_TYPE) {
-             s->b_code = get_bits(gb, 3);
-         }else
-             s->b_code=1;
-
-         if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-             av_log(s->avctx, AV_LOG_DEBUG, "qp:%d fc:%d,%d %s size:%d pro:%d alt:%d top:%d %spel part:%d resync:%d w:%d a:%d rnd:%d vot:%d%s dc:%d ce:%d/%d/%d\n",
-                 s->qscale, s->f_code, s->b_code,
-                 s->pict_type == FF_I_TYPE ? "I" : (s->pict_type == FF_P_TYPE ? "P" : (s->pict_type == FF_B_TYPE ? "B" : "S")),
-                 gb->size_in_bits,s->progressive_sequence, s->alternate_scan, s->top_field_first,
-                 s->quarter_sample ? "q" : "h", s->data_partitioning, s->resync_marker, s->num_sprite_warping_points,
-                 s->sprite_warping_accuracy, 1-s->no_rounding, s->vo_type, s->vol_control_parameters ? " VOLC" : " ", s->intra_dc_threshold, s->cplx_estimation_trash_i, s->cplx_estimation_trash_p, s->cplx_estimation_trash_b);
-         }
-
-         if(!s->scalability){
-             if (s->shape!=RECT_SHAPE && s->pict_type!=FF_I_TYPE) {
-                 skip_bits1(gb); // vop shape coding type
-             }
-         }else{
-             if(s->enhancement_type){
-                 int load_backward_shape= get_bits1(gb);
-                 if(load_backward_shape){
-                     av_log(s->avctx, AV_LOG_ERROR, "load backward shape isn't supported\n");
-                 }
-             }
-             skip_bits(gb, 2); //ref_select_code
-         }
-     }
-     /* detect buggy encoders which don't set the low_delay flag (divx4/xvid/opendivx)*/
-     // note we cannot detect divx5 without b-frames easily (although it's buggy too)
-     if(s->vo_type==0 && s->vol_control_parameters==0 && s->divx_version==-1 && s->picture_number==0){
-         av_log(s->avctx, AV_LOG_ERROR, "looks like this file was encoded with (divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
-         s->low_delay=1;
-     }
-
-     s->picture_number++; // better than pic number==0 always ;)
-
-     s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; //FIXME add short header support
-     s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
-
-     if(s->workaround_bugs&FF_BUG_EDGE){
-         s->h_edge_pos= s->width;
-         s->v_edge_pos= s->height;
-     }
-     return 0;
-}
-
-/**
- * decode mpeg4 headers
- * @return <0 if no VOP found (or a damaged one)
- *         FRAME_SKIPPED if a not coded VOP is found
- *         0 if a VOP is found
- */
-int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb)
-{
-    int startcode, v;
-
-    /* search next start code */
-    align_get_bits(gb);
-
-    if(s->codec_tag == AV_RL32("WV1F") && show_bits(gb, 24) == 0x575630){
-        skip_bits(gb, 24);
-        if(get_bits(gb, 8) == 0xF0)
-            goto end;
-    }
-
-    startcode = 0xff;
-    for(;;) {
-        if(get_bits_count(gb) >= gb->size_in_bits){
-            if(gb->size_in_bits==8 && (s->divx_version>=0 || s->xvid_build>=0)){
-                av_log(s->avctx, AV_LOG_ERROR, "frame skip %d\n", gb->size_in_bits);
-                return FRAME_SKIPPED; //divx bug
-            }else
-                return -1; //end of stream
-        }
-
-        /* use the bits after the test */
-        v = get_bits(gb, 8);
-        startcode = ((startcode << 8) | v) & 0xffffffff;
-
-        if((startcode&0xFFFFFF00) != 0x100)
-            continue; //no startcode
-
-        if(s->avctx->debug&FF_DEBUG_STARTCODE){
-            av_log(s->avctx, AV_LOG_DEBUG, "startcode: %3X ", startcode);
-            if     (startcode<=0x11F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Start");
-            else if(startcode<=0x12F) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Layer Start");
-            else if(startcode<=0x13F) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
-            else if(startcode<=0x15F) av_log(s->avctx, AV_LOG_DEBUG, "FGS bp start");
-            else if(startcode<=0x1AF) av_log(s->avctx, AV_LOG_DEBUG, "Reserved");
-            else if(startcode==0x1B0) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq Start");
-            else if(startcode==0x1B1) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Seq End");
-            else if(startcode==0x1B2) av_log(s->avctx, AV_LOG_DEBUG, "User Data");
-            else if(startcode==0x1B3) av_log(s->avctx, AV_LOG_DEBUG, "Group of VOP start");
-            else if(startcode==0x1B4) av_log(s->avctx, AV_LOG_DEBUG, "Video Session Error");
-            else if(startcode==0x1B5) av_log(s->avctx, AV_LOG_DEBUG, "Visual Object Start");
-            else if(startcode==0x1B6) av_log(s->avctx, AV_LOG_DEBUG, "Video Object Plane start");
-            else if(startcode==0x1B7) av_log(s->avctx, AV_LOG_DEBUG, "slice start");
-            else if(startcode==0x1B8) av_log(s->avctx, AV_LOG_DEBUG, "extension start");
-            else if(startcode==0x1B9) av_log(s->avctx, AV_LOG_DEBUG, "fgs start");
-            else if(startcode==0x1BA) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object start");
-            else if(startcode==0x1BB) av_log(s->avctx, AV_LOG_DEBUG, "FBA Object Plane start");
-            else if(startcode==0x1BC) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object start");
-            else if(startcode==0x1BD) av_log(s->avctx, AV_LOG_DEBUG, "Mesh Object Plane start");
-            else if(startcode==0x1BE) av_log(s->avctx, AV_LOG_DEBUG, "Still Texture Object start");
-            else if(startcode==0x1BF) av_log(s->avctx, AV_LOG_DEBUG, "Texture Spatial Layer start");
-            else if(startcode==0x1C0) av_log(s->avctx, AV_LOG_DEBUG, "Texture SNR Layer start");
-            else if(startcode==0x1C1) av_log(s->avctx, AV_LOG_DEBUG, "Texture Tile start");
-            else if(startcode==0x1C2) av_log(s->avctx, AV_LOG_DEBUG, "Texture Shape Layer start");
-            else if(startcode==0x1C3) av_log(s->avctx, AV_LOG_DEBUG, "stuffing start");
-            else if(startcode<=0x1C5) av_log(s->avctx, AV_LOG_DEBUG, "reserved");
-            else if(startcode<=0x1FF) av_log(s->avctx, AV_LOG_DEBUG, "System start");
-            av_log(s->avctx, AV_LOG_DEBUG, " at %d\n", get_bits_count(gb));
-        }
-
-        if(startcode >= 0x120 && startcode <= 0x12F){
-            if(decode_vol_header(s, gb) < 0)
-                return -1;
-        }
-        else if(startcode == USER_DATA_STARTCODE){
-            decode_user_data(s, gb);
-        }
-        else if(startcode == GOP_STARTCODE){
-            mpeg4_decode_gop_header(s, gb);
-        }
-        else if(startcode == VOP_STARTCODE){
-            break;
-        }
-
-        align_get_bits(gb);
-        startcode = 0xff;
-    }
-end:
-    if(s->flags& CODEC_FLAG_LOW_DELAY)
-        s->low_delay=1;
-    s->avctx->has_b_frames= !s->low_delay;
-    return decode_vop_header(s, gb);
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    int ret;
-    static int done = 0;
-
-    s->divx_version=
-    s->divx_build=
-    s->xvid_build=
-    s->lavc_build= -1;
-
-    if((ret=ff_h263_decode_init(avctx)) < 0)
-        return ret;
-
-    if (!done) {
-        done = 1;
-
-        init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
-        init_rl(&rvlc_rl_inter, ff_mpeg4_static_rl_table_store[1]);
-        init_rl(&rvlc_rl_intra, ff_mpeg4_static_rl_table_store[2]);
-        INIT_VLC_RL(ff_mpeg4_rl_intra, 554);
-        INIT_VLC_RL(rvlc_rl_inter, 1072);
-        INIT_VLC_RL(rvlc_rl_intra, 1072);
-        INIT_VLC_STATIC(&dc_lum, DC_VLC_BITS, 10 /* 13 */,
-                 &ff_mpeg4_DCtab_lum[0][1], 2, 1,
-                 &ff_mpeg4_DCtab_lum[0][0], 2, 1, 512);
-        INIT_VLC_STATIC(&dc_chrom, DC_VLC_BITS, 10 /* 13 */,
-                 &ff_mpeg4_DCtab_chrom[0][1], 2, 1,
-                 &ff_mpeg4_DCtab_chrom[0][0], 2, 1, 512);
-        INIT_VLC_STATIC(&sprite_trajectory, SPRITE_TRAJ_VLC_BITS, 15,
-                 &sprite_trajectory_tab[0][1], 4, 2,
-                 &sprite_trajectory_tab[0][0], 4, 2, 128);
-        INIT_VLC_STATIC(&mb_type_b_vlc, MB_TYPE_B_VLC_BITS, 4,
-                 &mb_type_b_tab[0][1], 2, 1,
-                 &mb_type_b_tab[0][0], 2, 1, 16);
-    }
-
-    s->h263_pred = 1;
-    s->low_delay = 0; //default, might be overriden in the vol header during header parsing
-    s->decode_mb= mpeg4_decode_mb;
-    s->time_increment_bits = 4; /* default value for broken headers */
-    avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
-
-    return 0;
-}
-
-AVCodec mpeg4_decoder = {
-    "mpeg4",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG4,
-    sizeof(MpegEncContext),
-    decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
-    .flush= ff_mpeg_flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
-    .pix_fmts= ff_hwaccel_pixfmt_list_420,
-};
-
-
-#if CONFIG_MPEG4_VDPAU_DECODER
-AVCodec mpeg4_vdpau_decoder = {
-    "mpeg4_vdpau",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG4,
-    sizeof(MpegEncContext),
-    decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 (VDPAU)"),
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE},
-};
-#endif
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
deleted file mode 100644
index 79190f0..0000000
--- a/libavcodec/mpeg4videoenc.c
+++ /dev/null
@@ -1,1352 +0,0 @@
-/*
- * MPEG4 encoder.
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2010 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mpegvideo.h"
-#include "h263.h"
-#include "mpeg4video.h"
-
-//The uni_DCtab_* tables below contain unified bits+length tables to encode DC
-//differences in mpeg4. Unified in the sense that the specification specifies
-//this encoding in several steps.
-static uint8_t uni_DCtab_lum_len[512];
-static uint8_t uni_DCtab_chrom_len[512];
-static uint16_t uni_DCtab_lum_bits[512];
-static uint16_t uni_DCtab_chrom_bits[512];
-
-//unified encoding tables for run length encoding of coefficients
-//unified in the sense that the specification specifies the encoding in several steps.
-static uint32_t uni_mpeg4_intra_rl_bits[64*64*2*2];
-static uint8_t  uni_mpeg4_intra_rl_len [64*64*2*2];
-static uint32_t uni_mpeg4_inter_rl_bits[64*64*2*2];
-static uint8_t  uni_mpeg4_inter_rl_len [64*64*2*2];
-//#define UNI_MPEG4_ENC_INDEX(last,run,level) ((last)*128 + (run)*256 + (level))
-//#define UNI_MPEG4_ENC_INDEX(last,run,level) ((last)*128*64 + (run) + (level)*64)
-#define UNI_MPEG4_ENC_INDEX(last,run,level) ((last)*128*64 + (run)*128 + (level))
-
-/* mpeg4
-inter
-max level: 24/6
-max run: 53/63
-
-intra
-max level: 53/16
-max run: 29/41
-*/
-
-
-/**
- * Returns the number of bits that encoding the 8x8 block in block would need.
- * @param[in]  block_last_index last index in scantable order that refers to a non zero element in block.
- */
-static inline int get_block_rate(MpegEncContext * s, DCTELEM block[64], int block_last_index, uint8_t scantable[64]){
-    int last=0;
-    int j;
-    int rate=0;
-
-    for(j=1; j<=block_last_index; j++){
-        const int index= scantable[j];
-        int level= block[index];
-        if(level){
-            level+= 64;
-            if((level&(~127)) == 0){
-                if(j<block_last_index) rate+= s->intra_ac_vlc_length     [UNI_AC_ENC_INDEX(j-last-1, level)];
-                else                   rate+= s->intra_ac_vlc_last_length[UNI_AC_ENC_INDEX(j-last-1, level)];
-            }else
-                rate += s->ac_esc_length;
-
-            last= j;
-        }
-    }
-
-    return rate;
-}
-
-
-/**
- * Restores the ac coefficients in block that have been changed by decide_ac_pred().
- * This function also restores s->block_last_index.
- * @param[in,out] block MB coefficients, these will be restored
- * @param[in] dir ac prediction direction for each 8x8 block
- * @param[out] st scantable for each 8x8 block
- * @param[in] zigzag_last_index index refering to the last non zero coefficient in zigzag order
- */
-static inline void restore_ac_coeffs(MpegEncContext * s, DCTELEM block[6][64], const int dir[6], uint8_t *st[6], const int zigzag_last_index[6])
-{
-    int i, n;
-    memcpy(s->block_last_index, zigzag_last_index, sizeof(int)*6);
-
-    for(n=0; n<6; n++){
-        int16_t *ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
-
-        st[n]= s->intra_scantable.permutated;
-        if(dir[n]){
-            /* top prediction */
-            for(i=1; i<8; i++){
-                block[n][s->dsp.idct_permutation[i   ]] = ac_val[i+8];
-            }
-        }else{
-            /* left prediction */
-            for(i=1; i<8; i++){
-                block[n][s->dsp.idct_permutation[i<<3]]= ac_val[i  ];
-            }
-        }
-    }
-}
-
-/**
- * Returns the optimal value (0 or 1) for the ac_pred element for the given MB in mpeg4.
- * This function will also update s->block_last_index and s->ac_val.
- * @param[in,out] block MB coefficients, these will be updated if 1 is returned
- * @param[in] dir ac prediction direction for each 8x8 block
- * @param[out] st scantable for each 8x8 block
- * @param[out] zigzag_last_index index refering to the last non zero coefficient in zigzag order
- */
-static inline int decide_ac_pred(MpegEncContext * s, DCTELEM block[6][64], const int dir[6], uint8_t *st[6], int zigzag_last_index[6])
-{
-    int score= 0;
-    int i, n;
-    int8_t * const qscale_table= s->current_picture.qscale_table;
-
-    memcpy(zigzag_last_index, s->block_last_index, sizeof(int)*6);
-
-    for(n=0; n<6; n++){
-        int16_t *ac_val, *ac_val1;
-
-        score -= get_block_rate(s, block[n], s->block_last_index[n], s->intra_scantable.permutated);
-
-        ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
-        ac_val1= ac_val;
-        if(dir[n]){
-            const int xy= s->mb_x + s->mb_y*s->mb_stride - s->mb_stride;
-            /* top prediction */
-            ac_val-= s->block_wrap[n]*16;
-            if(s->mb_y==0 || s->qscale == qscale_table[xy] || n==2 || n==3){
-                /* same qscale */
-                for(i=1; i<8; i++){
-                    const int level= block[n][s->dsp.idct_permutation[i   ]];
-                    block[n][s->dsp.idct_permutation[i   ]] = level - ac_val[i+8];
-                    ac_val1[i  ]=    block[n][s->dsp.idct_permutation[i<<3]];
-                    ac_val1[i+8]= level;
-                }
-            }else{
-                /* different qscale, we must rescale */
-                for(i=1; i<8; i++){
-                    const int level= block[n][s->dsp.idct_permutation[i   ]];
-                    block[n][s->dsp.idct_permutation[i   ]] = level - ROUNDED_DIV(ac_val[i + 8]*qscale_table[xy], s->qscale);
-                    ac_val1[i  ]=    block[n][s->dsp.idct_permutation[i<<3]];
-                    ac_val1[i+8]= level;
-                }
-            }
-            st[n]= s->intra_h_scantable.permutated;
-        }else{
-            const int xy= s->mb_x-1 + s->mb_y*s->mb_stride;
-            /* left prediction */
-            ac_val-= 16;
-            if(s->mb_x==0 || s->qscale == qscale_table[xy] || n==1 || n==3){
-                /* same qscale */
-                for(i=1; i<8; i++){
-                    const int level= block[n][s->dsp.idct_permutation[i<<3]];
-                    block[n][s->dsp.idct_permutation[i<<3]]= level - ac_val[i];
-                    ac_val1[i  ]= level;
-                    ac_val1[i+8]=    block[n][s->dsp.idct_permutation[i   ]];
-                }
-            }else{
-                /* different qscale, we must rescale */
-                for(i=1; i<8; i++){
-                    const int level= block[n][s->dsp.idct_permutation[i<<3]];
-                    block[n][s->dsp.idct_permutation[i<<3]]= level - ROUNDED_DIV(ac_val[i]*qscale_table[xy], s->qscale);
-                    ac_val1[i  ]= level;
-                    ac_val1[i+8]=    block[n][s->dsp.idct_permutation[i   ]];
-                }
-            }
-            st[n]= s->intra_v_scantable.permutated;
-        }
-
-        for(i=63; i>0; i--) //FIXME optimize
-            if(block[n][ st[n][i] ]) break;
-        s->block_last_index[n]= i;
-
-        score += get_block_rate(s, block[n], s->block_last_index[n], st[n]);
-    }
-
-    if(score < 0){
-        return 1;
-    }else{
-        restore_ac_coeffs(s, block, dir, st, zigzag_last_index);
-        return 0;
-    }
-}
-
-/**
- * modify mb_type & qscale so that encoding is acually possible in mpeg4
- */
-void ff_clean_mpeg4_qscales(MpegEncContext *s){
-    int i;
-    int8_t * const qscale_table= s->current_picture.qscale_table;
-
-    ff_clean_h263_qscales(s);
-
-    if(s->pict_type== FF_B_TYPE){
-        int odd=0;
-        /* ok, come on, this isn't funny anymore, there's more code for handling this mpeg4 mess than for the actual adaptive quantization */
-
-        for(i=0; i<s->mb_num; i++){
-            int mb_xy= s->mb_index2xy[i];
-            odd += qscale_table[mb_xy]&1;
-        }
-
-        if(2*odd > s->mb_num) odd=1;
-        else                  odd=0;
-
-        for(i=0; i<s->mb_num; i++){
-            int mb_xy= s->mb_index2xy[i];
-            if((qscale_table[mb_xy]&1) != odd)
-                qscale_table[mb_xy]++;
-            if(qscale_table[mb_xy] > 31)
-                qscale_table[mb_xy]= 31;
-        }
-
-        for(i=1; i<s->mb_num; i++){
-            int mb_xy= s->mb_index2xy[i];
-            if(qscale_table[mb_xy] != qscale_table[s->mb_index2xy[i-1]] && (s->mb_type[mb_xy]&CANDIDATE_MB_TYPE_DIRECT)){
-                s->mb_type[mb_xy]|= CANDIDATE_MB_TYPE_BIDIR;
-            }
-        }
-    }
-}
-
-
-/**
- * encodes the dc value.
- * @param n block index (0-3 are luma, 4-5 are chroma)
- */
-static inline void mpeg4_encode_dc(PutBitContext * s, int level, int n)
-{
-#if 1
-    /* DC will overflow if level is outside the [-255,255] range. */
-    level+=256;
-    if (n < 4) {
-        /* luminance */
-        put_bits(s, uni_DCtab_lum_len[level], uni_DCtab_lum_bits[level]);
-    } else {
-        /* chrominance */
-        put_bits(s, uni_DCtab_chrom_len[level], uni_DCtab_chrom_bits[level]);
-    }
-#else
-    int size, v;
-    /* find number of bits */
-    size = 0;
-    v = abs(level);
-    while (v) {
-        v >>= 1;
-        size++;
-    }
-
-    if (n < 4) {
-        /* luminance */
-        put_bits(&s->pb, ff_mpeg4_DCtab_lum[size][1], ff_mpeg4_DCtab_lum[size][0]);
-    } else {
-        /* chrominance */
-        put_bits(&s->pb, ff_mpeg4_DCtab_chrom[size][1], ff_mpeg4_DCtab_chrom[size][0]);
-    }
-
-    /* encode remaining bits */
-    if (size > 0) {
-        if (level < 0)
-            level = (-level) ^ ((1 << size) - 1);
-        put_bits(&s->pb, size, level);
-        if (size > 8)
-            put_bits(&s->pb, 1, 1);
-    }
-#endif
-}
-
-static inline int mpeg4_get_dc_length(int level, int n){
-    if (n < 4) {
-        return uni_DCtab_lum_len[level + 256];
-    } else {
-        return uni_DCtab_chrom_len[level + 256];
-    }
-}
-
-/**
- * encodes a 8x8 block
- * @param n block index (0-3 are luma, 4-5 are chroma)
- */
-static inline void mpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n, int intra_dc,
-                               uint8_t *scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb)
-{
-    int i, last_non_zero;
-#if 0 //variables for the outcommented version
-    int code, sign, last;
-#endif
-    const RLTable *rl;
-    uint32_t *bits_tab;
-    uint8_t *len_tab;
-    const int last_index = s->block_last_index[n];
-
-    if (s->mb_intra) { //Note gcc (3.2.1 at least) will optimize this away
-        /* mpeg4 based DC predictor */
-        mpeg4_encode_dc(dc_pb, intra_dc, n);
-        if(last_index<1) return;
-        i = 1;
-        rl = &ff_mpeg4_rl_intra;
-        bits_tab= uni_mpeg4_intra_rl_bits;
-        len_tab = uni_mpeg4_intra_rl_len;
-    } else {
-        if(last_index<0) return;
-        i = 0;
-        rl = &ff_h263_rl_inter;
-        bits_tab= uni_mpeg4_inter_rl_bits;
-        len_tab = uni_mpeg4_inter_rl_len;
-    }
-
-    /* AC coefs */
-    last_non_zero = i - 1;
-#if 1
-    for (; i < last_index; i++) {
-        int level = block[ scan_table[i] ];
-        if (level) {
-            int run = i - last_non_zero - 1;
-            level+=64;
-            if((level&(~127)) == 0){
-                const int index= UNI_MPEG4_ENC_INDEX(0, run, level);
-                put_bits(ac_pb, len_tab[index], bits_tab[index]);
-            }else{ //ESC3
-                put_bits(ac_pb, 7+2+1+6+1+12+1, (3<<23)+(3<<21)+(0<<20)+(run<<14)+(1<<13)+(((level-64)&0xfff)<<1)+1);
-            }
-            last_non_zero = i;
-        }
-    }
-    /*if(i<=last_index)*/{
-        int level = block[ scan_table[i] ];
-        int run = i - last_non_zero - 1;
-        level+=64;
-        if((level&(~127)) == 0){
-            const int index= UNI_MPEG4_ENC_INDEX(1, run, level);
-            put_bits(ac_pb, len_tab[index], bits_tab[index]);
-        }else{ //ESC3
-            put_bits(ac_pb, 7+2+1+6+1+12+1, (3<<23)+(3<<21)+(1<<20)+(run<<14)+(1<<13)+(((level-64)&0xfff)<<1)+1);
-        }
-    }
-#else
-    for (; i <= last_index; i++) {
-        const int slevel = block[ scan_table[i] ];
-        if (slevel) {
-            int level;
-            int run = i - last_non_zero - 1;
-            last = (i == last_index);
-            sign = 0;
-            level = slevel;
-            if (level < 0) {
-                sign = 1;
-                level = -level;
-            }
-            code = get_rl_index(rl, last, run, level);
-            put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-            if (code == rl->n) {
-                int level1, run1;
-                level1 = level - rl->max_level[last][run];
-                if (level1 < 1)
-                    goto esc2;
-                code = get_rl_index(rl, last, run, level1);
-                if (code == rl->n) {
-                esc2:
-                    put_bits(ac_pb, 1, 1);
-                    if (level > MAX_LEVEL)
-                        goto esc3;
-                    run1 = run - rl->max_run[last][level] - 1;
-                    if (run1 < 0)
-                        goto esc3;
-                    code = get_rl_index(rl, last, run1, level);
-                    if (code == rl->n) {
-                    esc3:
-                        /* third escape */
-                        put_bits(ac_pb, 1, 1);
-                        put_bits(ac_pb, 1, last);
-                        put_bits(ac_pb, 6, run);
-                        put_bits(ac_pb, 1, 1);
-                        put_sbits(ac_pb, 12, slevel);
-                        put_bits(ac_pb, 1, 1);
-                    } else {
-                        /* second escape */
-                        put_bits(ac_pb, 1, 0);
-                        put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-                        put_bits(ac_pb, 1, sign);
-                    }
-                } else {
-                    /* first escape */
-                    put_bits(ac_pb, 1, 0);
-                    put_bits(ac_pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-                    put_bits(ac_pb, 1, sign);
-                }
-            } else {
-                put_bits(ac_pb, 1, sign);
-            }
-            last_non_zero = i;
-        }
-    }
-#endif
-}
-
-static int mpeg4_get_block_length(MpegEncContext * s, DCTELEM * block, int n, int intra_dc,
-                               uint8_t *scan_table)
-{
-    int i, last_non_zero;
-    uint8_t *len_tab;
-    const int last_index = s->block_last_index[n];
-    int len=0;
-
-    if (s->mb_intra) { //Note gcc (3.2.1 at least) will optimize this away
-        /* mpeg4 based DC predictor */
-        len += mpeg4_get_dc_length(intra_dc, n);
-        if(last_index<1) return len;
-        i = 1;
-        len_tab = uni_mpeg4_intra_rl_len;
-    } else {
-        if(last_index<0) return 0;
-        i = 0;
-        len_tab = uni_mpeg4_inter_rl_len;
-    }
-
-    /* AC coefs */
-    last_non_zero = i - 1;
-    for (; i < last_index; i++) {
-        int level = block[ scan_table[i] ];
-        if (level) {
-            int run = i - last_non_zero - 1;
-            level+=64;
-            if((level&(~127)) == 0){
-                const int index= UNI_MPEG4_ENC_INDEX(0, run, level);
-                len += len_tab[index];
-            }else{ //ESC3
-                len += 7+2+1+6+1+12+1;
-            }
-            last_non_zero = i;
-        }
-    }
-    /*if(i<=last_index)*/{
-        int level = block[ scan_table[i] ];
-        int run = i - last_non_zero - 1;
-        level+=64;
-        if((level&(~127)) == 0){
-            const int index= UNI_MPEG4_ENC_INDEX(1, run, level);
-            len += len_tab[index];
-        }else{ //ESC3
-            len += 7+2+1+6+1+12+1;
-        }
-    }
-
-    return len;
-}
-
-static inline void mpeg4_encode_blocks(MpegEncContext * s, DCTELEM block[6][64], int intra_dc[6],
-                               uint8_t **scan_table, PutBitContext *dc_pb, PutBitContext *ac_pb){
-    int i;
-
-    if(scan_table){
-        if(s->flags2 & CODEC_FLAG2_NO_OUTPUT){
-            for (i = 0; i < 6; i++) {
-                skip_put_bits(&s->pb, mpeg4_get_block_length(s, block[i], i, intra_dc[i], scan_table[i]));
-            }
-        }else{
-            /* encode each block */
-            for (i = 0; i < 6; i++) {
-                mpeg4_encode_block(s, block[i], i, intra_dc[i], scan_table[i], dc_pb, ac_pb);
-            }
-        }
-    }else{
-        if(s->flags2 & CODEC_FLAG2_NO_OUTPUT){
-            for (i = 0; i < 6; i++) {
-                skip_put_bits(&s->pb, mpeg4_get_block_length(s, block[i], i, 0, s->intra_scantable.permutated));
-            }
-        }else{
-            /* encode each block */
-            for (i = 0; i < 6; i++) {
-                mpeg4_encode_block(s, block[i], i, 0, s->intra_scantable.permutated, dc_pb, ac_pb);
-            }
-        }
-    }
-}
-
-//FIXME this is duplicated to h263.c
-static const int dquant_code[5]= {1,0,9,2,3};
-
-void mpeg4_encode_mb(MpegEncContext * s,
-                    DCTELEM block[6][64],
-                    int motion_x, int motion_y)
-{
-    int cbpc, cbpy, pred_x, pred_y;
-    PutBitContext * const pb2    = s->data_partitioning                         ? &s->pb2    : &s->pb;
-    PutBitContext * const tex_pb = s->data_partitioning && s->pict_type!=FF_B_TYPE ? &s->tex_pb : &s->pb;
-    PutBitContext * const dc_pb  = s->data_partitioning && s->pict_type!=FF_I_TYPE ? &s->pb2    : &s->pb;
-    const int interleaved_stats= (s->flags&CODEC_FLAG_PASS1) && !s->data_partitioning ? 1 : 0;
-
-    if (!s->mb_intra) {
-        int i, cbp;
-
-        if(s->pict_type==FF_B_TYPE){
-            static const int mb_type_table[8]= {-1, 3, 2, 1,-1,-1,-1, 0}; /* convert from mv_dir to type */
-            int mb_type=  mb_type_table[s->mv_dir];
-
-            if(s->mb_x==0){
-                for(i=0; i<2; i++){
-                    s->last_mv[i][0][0]=
-                    s->last_mv[i][0][1]=
-                    s->last_mv[i][1][0]=
-                    s->last_mv[i][1][1]= 0;
-                }
-            }
-
-            assert(s->dquant>=-2 && s->dquant<=2);
-            assert((s->dquant&1)==0);
-            assert(mb_type>=0);
-
-            /* nothing to do if this MB was skipped in the next P Frame */
-            if(s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]){ //FIXME avoid DCT & ...
-                s->skip_count++;
-                s->mv[0][0][0]=
-                s->mv[0][0][1]=
-                s->mv[1][0][0]=
-                s->mv[1][0][1]= 0;
-                s->mv_dir= MV_DIR_FORWARD; //doesn't matter
-                s->qscale -= s->dquant;
-//                s->mb_skipped=1;
-
-                return;
-            }
-
-            cbp= get_b_cbp(s, block, motion_x, motion_y, mb_type);
-
-            if ((cbp | motion_x | motion_y | mb_type) ==0) {
-                /* direct MB with MV={0,0} */
-                assert(s->dquant==0);
-
-                put_bits(&s->pb, 1, 1); /* mb not coded modb1=1 */
-
-                if(interleaved_stats){
-                    s->misc_bits++;
-                    s->last_bits++;
-                }
-                s->skip_count++;
-                return;
-            }
-
-            put_bits(&s->pb, 1, 0);     /* mb coded modb1=0 */
-            put_bits(&s->pb, 1, cbp ? 0 : 1); /* modb2 */ //FIXME merge
-            put_bits(&s->pb, mb_type+1, 1); // this table is so simple that we don't need it :)
-            if(cbp) put_bits(&s->pb, 6, cbp);
-
-            if(cbp && mb_type){
-                if(s->dquant)
-                    put_bits(&s->pb, 2, (s->dquant>>2)+3);
-                else
-                    put_bits(&s->pb, 1, 0);
-            }else
-                s->qscale -= s->dquant;
-
-            if(!s->progressive_sequence){
-                if(cbp)
-                    put_bits(&s->pb, 1, s->interlaced_dct);
-                if(mb_type) // not direct mode
-                    put_bits(&s->pb, 1, s->mv_type == MV_TYPE_FIELD);
-            }
-
-            if(interleaved_stats){
-                s->misc_bits+= get_bits_diff(s);
-            }
-
-            if(mb_type == 0){
-                assert(s->mv_dir & MV_DIRECT);
-                ff_h263_encode_motion_vector(s, motion_x, motion_y, 1);
-                s->b_count++;
-                s->f_count++;
-            }else{
-                assert(mb_type > 0 && mb_type < 4);
-                if(s->mv_type != MV_TYPE_FIELD){
-                    if(s->mv_dir & MV_DIR_FORWARD){
-                        ff_h263_encode_motion_vector(s, s->mv[0][0][0] - s->last_mv[0][0][0],
-                                                        s->mv[0][0][1] - s->last_mv[0][0][1], s->f_code);
-                        s->last_mv[0][0][0]= s->last_mv[0][1][0]= s->mv[0][0][0];
-                        s->last_mv[0][0][1]= s->last_mv[0][1][1]= s->mv[0][0][1];
-                        s->f_count++;
-                    }
-                    if(s->mv_dir & MV_DIR_BACKWARD){
-                        ff_h263_encode_motion_vector(s, s->mv[1][0][0] - s->last_mv[1][0][0],
-                                                        s->mv[1][0][1] - s->last_mv[1][0][1], s->b_code);
-                        s->last_mv[1][0][0]= s->last_mv[1][1][0]= s->mv[1][0][0];
-                        s->last_mv[1][0][1]= s->last_mv[1][1][1]= s->mv[1][0][1];
-                        s->b_count++;
-                    }
-                }else{
-                    if(s->mv_dir & MV_DIR_FORWARD){
-                        put_bits(&s->pb, 1, s->field_select[0][0]);
-                        put_bits(&s->pb, 1, s->field_select[0][1]);
-                    }
-                    if(s->mv_dir & MV_DIR_BACKWARD){
-                        put_bits(&s->pb, 1, s->field_select[1][0]);
-                        put_bits(&s->pb, 1, s->field_select[1][1]);
-                    }
-                    if(s->mv_dir & MV_DIR_FORWARD){
-                        for(i=0; i<2; i++){
-                            ff_h263_encode_motion_vector(s, s->mv[0][i][0] - s->last_mv[0][i][0]  ,
-                                                            s->mv[0][i][1] - s->last_mv[0][i][1]/2, s->f_code);
-                            s->last_mv[0][i][0]= s->mv[0][i][0];
-                            s->last_mv[0][i][1]= s->mv[0][i][1]*2;
-                        }
-                        s->f_count++;
-                    }
-                    if(s->mv_dir & MV_DIR_BACKWARD){
-                        for(i=0; i<2; i++){
-                            ff_h263_encode_motion_vector(s, s->mv[1][i][0] - s->last_mv[1][i][0]  ,
-                                                            s->mv[1][i][1] - s->last_mv[1][i][1]/2, s->b_code);
-                            s->last_mv[1][i][0]= s->mv[1][i][0];
-                            s->last_mv[1][i][1]= s->mv[1][i][1]*2;
-                        }
-                        s->b_count++;
-                    }
-                }
-            }
-
-            if(interleaved_stats){
-                s->mv_bits+= get_bits_diff(s);
-            }
-
-            mpeg4_encode_blocks(s, block, NULL, NULL, NULL, &s->pb);
-
-            if(interleaved_stats){
-                s->p_tex_bits+= get_bits_diff(s);
-            }
-
-        }else{ /* s->pict_type==FF_B_TYPE */
-            cbp= get_p_cbp(s, block, motion_x, motion_y);
-
-            if ((cbp | motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16) {
-                /* check if the B frames can skip it too, as we must skip it if we skip here
-                   why didn't they just compress the skip-mb bits instead of reusing them ?! */
-                if(s->max_b_frames>0){
-                    int i;
-                    int x,y, offset;
-                    uint8_t *p_pic;
-
-                    x= s->mb_x*16;
-                    y= s->mb_y*16;
-                    if(x+16 > s->width)  x= s->width-16;
-                    if(y+16 > s->height) y= s->height-16;
-
-                    offset= x + y*s->linesize;
-                    p_pic= s->new_picture.data[0] + offset;
-
-                    s->mb_skipped=1;
-                    for(i=0; i<s->max_b_frames; i++){
-                        uint8_t *b_pic;
-                        int diff;
-                        Picture *pic= s->reordered_input_picture[i+1];
-
-                        if(pic==NULL || pic->pict_type!=FF_B_TYPE) break;
-
-                        b_pic= pic->data[0] + offset;
-                        if(pic->type != FF_BUFFER_TYPE_SHARED)
-                            b_pic+= INPLACE_OFFSET;
-                        diff= s->dsp.sad[0](NULL, p_pic, b_pic, s->linesize, 16);
-                        if(diff>s->qscale*70){ //FIXME check that 70 is optimal
-                            s->mb_skipped=0;
-                            break;
-                        }
-                    }
-                }else
-                    s->mb_skipped=1;
-
-                if(s->mb_skipped==1){
-                    /* skip macroblock */
-                    put_bits(&s->pb, 1, 1);
-
-                    if(interleaved_stats){
-                        s->misc_bits++;
-                        s->last_bits++;
-                    }
-                    s->skip_count++;
-
-                    return;
-                }
-            }
-
-            put_bits(&s->pb, 1, 0);     /* mb coded */
-            cbpc = cbp & 3;
-            cbpy = cbp >> 2;
-            cbpy ^= 0xf;
-            if(s->mv_type==MV_TYPE_16X16){
-                if(s->dquant) cbpc+= 8;
-                put_bits(&s->pb,
-                        ff_h263_inter_MCBPC_bits[cbpc],
-                        ff_h263_inter_MCBPC_code[cbpc]);
-
-                put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
-                if(s->dquant)
-                    put_bits(pb2, 2, dquant_code[s->dquant+2]);
-
-                if(!s->progressive_sequence){
-                    if(cbp)
-                        put_bits(pb2, 1, s->interlaced_dct);
-                    put_bits(pb2, 1, 0);
-                }
-
-                if(interleaved_stats){
-                    s->misc_bits+= get_bits_diff(s);
-                }
-
-                /* motion vectors: 16x16 mode */
-                h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-
-                ff_h263_encode_motion_vector(s, motion_x - pred_x,
-                                                motion_y - pred_y, s->f_code);
-            }else if(s->mv_type==MV_TYPE_FIELD){
-                if(s->dquant) cbpc+= 8;
-                put_bits(&s->pb,
-                        ff_h263_inter_MCBPC_bits[cbpc],
-                        ff_h263_inter_MCBPC_code[cbpc]);
-
-                put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
-                if(s->dquant)
-                    put_bits(pb2, 2, dquant_code[s->dquant+2]);
-
-                assert(!s->progressive_sequence);
-                if(cbp)
-                    put_bits(pb2, 1, s->interlaced_dct);
-                put_bits(pb2, 1, 1);
-
-                if(interleaved_stats){
-                    s->misc_bits+= get_bits_diff(s);
-                }
-
-                /* motion vectors: 16x8 interlaced mode */
-                h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-                pred_y /=2;
-
-                put_bits(&s->pb, 1, s->field_select[0][0]);
-                put_bits(&s->pb, 1, s->field_select[0][1]);
-
-                ff_h263_encode_motion_vector(s, s->mv[0][0][0] - pred_x,
-                                                s->mv[0][0][1] - pred_y, s->f_code);
-                ff_h263_encode_motion_vector(s, s->mv[0][1][0] - pred_x,
-                                                s->mv[0][1][1] - pred_y, s->f_code);
-            }else{
-                assert(s->mv_type==MV_TYPE_8X8);
-                put_bits(&s->pb,
-                        ff_h263_inter_MCBPC_bits[cbpc+16],
-                        ff_h263_inter_MCBPC_code[cbpc+16]);
-                put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
-
-                if(!s->progressive_sequence){
-                    if(cbp)
-                        put_bits(pb2, 1, s->interlaced_dct);
-                }
-
-                if(interleaved_stats){
-                    s->misc_bits+= get_bits_diff(s);
-                }
-
-                for(i=0; i<4; i++){
-                    /* motion vectors: 8x8 mode*/
-                    h263_pred_motion(s, i, 0, &pred_x, &pred_y);
-
-                    ff_h263_encode_motion_vector(s, s->current_picture.motion_val[0][ s->block_index[i] ][0] - pred_x,
-                                                    s->current_picture.motion_val[0][ s->block_index[i] ][1] - pred_y, s->f_code);
-                }
-            }
-
-            if(interleaved_stats){
-                s->mv_bits+= get_bits_diff(s);
-            }
-
-            mpeg4_encode_blocks(s, block, NULL, NULL, NULL, tex_pb);
-
-            if(interleaved_stats){
-                s->p_tex_bits+= get_bits_diff(s);
-            }
-            s->f_count++;
-        }
-    } else {
-        int cbp;
-        int dc_diff[6];   //dc values with the dc prediction subtracted
-        int dir[6];  //prediction direction
-        int zigzag_last_index[6];
-        uint8_t *scan_table[6];
-        int i;
-
-        for(i=0; i<6; i++){
-            dc_diff[i]= ff_mpeg4_pred_dc(s, i, block[i][0], &dir[i], 1);
-        }
-
-        if(s->flags & CODEC_FLAG_AC_PRED){
-            s->ac_pred= decide_ac_pred(s, block, dir, scan_table, zigzag_last_index);
-        }else{
-            for(i=0; i<6; i++)
-                scan_table[i]= s->intra_scantable.permutated;
-        }
-
-        /* compute cbp */
-        cbp = 0;
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 1)
-                cbp |= 1 << (5 - i);
-        }
-
-        cbpc = cbp & 3;
-        if (s->pict_type == FF_I_TYPE) {
-            if(s->dquant) cbpc+=4;
-            put_bits(&s->pb,
-                ff_h263_intra_MCBPC_bits[cbpc],
-                ff_h263_intra_MCBPC_code[cbpc]);
-        } else {
-            if(s->dquant) cbpc+=8;
-            put_bits(&s->pb, 1, 0);     /* mb coded */
-            put_bits(&s->pb,
-                ff_h263_inter_MCBPC_bits[cbpc + 4],
-                ff_h263_inter_MCBPC_code[cbpc + 4]);
-        }
-        put_bits(pb2, 1, s->ac_pred);
-        cbpy = cbp >> 2;
-        put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]);
-        if(s->dquant)
-            put_bits(dc_pb, 2, dquant_code[s->dquant+2]);
-
-        if(!s->progressive_sequence){
-            put_bits(dc_pb, 1, s->interlaced_dct);
-        }
-
-        if(interleaved_stats){
-            s->misc_bits+= get_bits_diff(s);
-        }
-
-        mpeg4_encode_blocks(s, block, dc_diff, scan_table, dc_pb, tex_pb);
-
-        if(interleaved_stats){
-            s->i_tex_bits+= get_bits_diff(s);
-        }
-        s->i_count++;
-
-        /* restore ac coeffs & last_index stuff if we messed them up with the prediction */
-        if(s->ac_pred)
-            restore_ac_coeffs(s, block, dir, scan_table, zigzag_last_index);
-    }
-}
-
-/**
- * add mpeg4 stuffing bits (01...1)
- */
-void ff_mpeg4_stuffing(PutBitContext * pbc)
-{
-    int length;
-    put_bits(pbc, 1, 0);
-    length= (-put_bits_count(pbc))&7;
-    if(length) put_bits(pbc, length, (1<<length)-1);
-}
-
-/* must be called before writing the header */
-void ff_set_mpeg4_time(MpegEncContext * s){
-    if(s->pict_type==FF_B_TYPE){
-        ff_mpeg4_init_direct_mv(s);
-    }else{
-        s->last_time_base= s->time_base;
-        s->time_base= s->time/s->avctx->time_base.den;
-    }
-}
-
-static void mpeg4_encode_gop_header(MpegEncContext * s){
-    int hours, minutes, seconds;
-    int64_t time;
-
-    put_bits(&s->pb, 16, 0);
-    put_bits(&s->pb, 16, GOP_STARTCODE);
-
-    time= s->current_picture_ptr->pts;
-    if(s->reordered_input_picture[1])
-        time= FFMIN(time, s->reordered_input_picture[1]->pts);
-    time= time*s->avctx->time_base.num;
-
-    seconds= time/s->avctx->time_base.den;
-    minutes= seconds/60; seconds %= 60;
-    hours= minutes/60; minutes %= 60;
-    hours%=24;
-
-    put_bits(&s->pb, 5, hours);
-    put_bits(&s->pb, 6, minutes);
-    put_bits(&s->pb, 1, 1);
-    put_bits(&s->pb, 6, seconds);
-
-    put_bits(&s->pb, 1, !!(s->flags&CODEC_FLAG_CLOSED_GOP));
-    put_bits(&s->pb, 1, 0); //broken link == NO
-
-    s->last_time_base= time / s->avctx->time_base.den;
-
-    ff_mpeg4_stuffing(&s->pb);
-}
-
-static void mpeg4_encode_visual_object_header(MpegEncContext * s){
-    int profile_and_level_indication;
-    int vo_ver_id;
-
-    if(s->avctx->profile != FF_PROFILE_UNKNOWN){
-        profile_and_level_indication = s->avctx->profile << 4;
-    }else if(s->max_b_frames || s->quarter_sample){
-        profile_and_level_indication= 0xF0; // adv simple
-    }else{
-        profile_and_level_indication= 0x00; // simple
-    }
-
-    if(s->avctx->level != FF_LEVEL_UNKNOWN){
-        profile_and_level_indication |= s->avctx->level;
-    }else{
-        profile_and_level_indication |= 1; //level 1
-    }
-
-    if(profile_and_level_indication>>4 == 0xF){
-        vo_ver_id= 5;
-    }else{
-        vo_ver_id= 1;
-    }
-
-    //FIXME levels
-
-    put_bits(&s->pb, 16, 0);
-    put_bits(&s->pb, 16, VOS_STARTCODE);
-
-    put_bits(&s->pb, 8, profile_and_level_indication);
-
-    put_bits(&s->pb, 16, 0);
-    put_bits(&s->pb, 16, VISUAL_OBJ_STARTCODE);
-
-    put_bits(&s->pb, 1, 1);
-        put_bits(&s->pb, 4, vo_ver_id);
-        put_bits(&s->pb, 3, 1); //priority
-
-    put_bits(&s->pb, 4, 1); //visual obj type== video obj
-
-    put_bits(&s->pb, 1, 0); //video signal type == no clue //FIXME
-
-    ff_mpeg4_stuffing(&s->pb);
-}
-
-static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number)
-{
-    int vo_ver_id;
-
-    if (!CONFIG_MPEG4_ENCODER)  return;
-
-    if(s->max_b_frames || s->quarter_sample){
-        vo_ver_id= 5;
-        s->vo_type= ADV_SIMPLE_VO_TYPE;
-    }else{
-        vo_ver_id= 1;
-        s->vo_type= SIMPLE_VO_TYPE;
-    }
-
-    put_bits(&s->pb, 16, 0);
-    put_bits(&s->pb, 16, 0x100 + vo_number);        /* video obj */
-    put_bits(&s->pb, 16, 0);
-    put_bits(&s->pb, 16, 0x120 + vol_number);       /* video obj layer */
-
-    put_bits(&s->pb, 1, 0);             /* random access vol */
-    put_bits(&s->pb, 8, s->vo_type);    /* video obj type indication */
-    if(s->workaround_bugs & FF_BUG_MS) {
-        put_bits(&s->pb, 1, 0);         /* is obj layer id= no */
-    } else {
-        put_bits(&s->pb, 1, 1);         /* is obj layer id= yes */
-        put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */
-        put_bits(&s->pb, 3, 1);         /* is obj layer priority */
-    }
-
-    s->aspect_ratio_info= ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
-
-    put_bits(&s->pb, 4, s->aspect_ratio_info);/* aspect ratio info */
-    if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){
-        put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num);
-        put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den);
-    }
-
-    if(s->workaround_bugs & FF_BUG_MS) { //
-        put_bits(&s->pb, 1, 0);         /* vol control parameters= no @@@ */
-    } else {
-        put_bits(&s->pb, 1, 1);         /* vol control parameters= yes */
-        put_bits(&s->pb, 2, 1);         /* chroma format YUV 420/YV12 */
-        put_bits(&s->pb, 1, s->low_delay);
-        put_bits(&s->pb, 1, 0);         /* vbv parameters= no */
-    }
-
-    put_bits(&s->pb, 2, RECT_SHAPE);    /* vol shape= rectangle */
-    put_bits(&s->pb, 1, 1);             /* marker bit */
-
-    put_bits(&s->pb, 16, s->avctx->time_base.den);
-    if (s->time_increment_bits < 1)
-        s->time_increment_bits = 1;
-    put_bits(&s->pb, 1, 1);             /* marker bit */
-    put_bits(&s->pb, 1, 0);             /* fixed vop rate=no */
-    put_bits(&s->pb, 1, 1);             /* marker bit */
-    put_bits(&s->pb, 13, s->width);     /* vol width */
-    put_bits(&s->pb, 1, 1);             /* marker bit */
-    put_bits(&s->pb, 13, s->height);    /* vol height */
-    put_bits(&s->pb, 1, 1);             /* marker bit */
-    put_bits(&s->pb, 1, s->progressive_sequence ? 0 : 1);
-    put_bits(&s->pb, 1, 1);             /* obmc disable */
-    if (vo_ver_id == 1) {
-        put_bits(&s->pb, 1, s->vol_sprite_usage);       /* sprite enable */
-    }else{
-        put_bits(&s->pb, 2, s->vol_sprite_usage);       /* sprite enable */
-    }
-
-    put_bits(&s->pb, 1, 0);             /* not 8 bit == false */
-    put_bits(&s->pb, 1, s->mpeg_quant); /* quant type= (0=h263 style)*/
-
-    if(s->mpeg_quant){
-        ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
-        ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);
-    }
-
-    if (vo_ver_id != 1)
-        put_bits(&s->pb, 1, s->quarter_sample);
-    put_bits(&s->pb, 1, 1);             /* complexity estimation disable */
-    s->resync_marker= s->rtp_mode;
-    put_bits(&s->pb, 1, s->resync_marker ? 0 : 1);/* resync marker disable */
-    put_bits(&s->pb, 1, s->data_partitioning ? 1 : 0);
-    if(s->data_partitioning){
-        put_bits(&s->pb, 1, 0);         /* no rvlc */
-    }
-
-    if (vo_ver_id != 1){
-        put_bits(&s->pb, 1, 0);         /* newpred */
-        put_bits(&s->pb, 1, 0);         /* reduced res vop */
-    }
-    put_bits(&s->pb, 1, 0);             /* scalability */
-
-    ff_mpeg4_stuffing(&s->pb);
-
-    /* user data */
-    if(!(s->flags & CODEC_FLAG_BITEXACT)){
-        put_bits(&s->pb, 16, 0);
-        put_bits(&s->pb, 16, 0x1B2);    /* user_data */
-        ff_put_string(&s->pb, LIBAVCODEC_IDENT, 0);
-    }
-}
-
-/* write mpeg4 VOP header */
-void mpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
-{
-    int time_incr;
-    int time_div, time_mod;
-
-    if(s->pict_type==FF_I_TYPE){
-        if(!(s->flags&CODEC_FLAG_GLOBAL_HEADER)){
-            if(s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT) //HACK, the reference sw is buggy
-                mpeg4_encode_visual_object_header(s);
-            if(s->strict_std_compliance < FF_COMPLIANCE_VERY_STRICT || picture_number==0) //HACK, the reference sw is buggy
-                mpeg4_encode_vol_header(s, 0, 0);
-        }
-        if(!(s->workaround_bugs & FF_BUG_MS))
-            mpeg4_encode_gop_header(s);
-    }
-
-    s->partitioned_frame= s->data_partitioning && s->pict_type!=FF_B_TYPE;
-
-    put_bits(&s->pb, 16, 0);                /* vop header */
-    put_bits(&s->pb, 16, VOP_STARTCODE);    /* vop header */
-    put_bits(&s->pb, 2, s->pict_type - 1);  /* pict type: I = 0 , P = 1 */
-
-    assert(s->time>=0);
-    time_div= s->time/s->avctx->time_base.den;
-    time_mod= s->time%s->avctx->time_base.den;
-    time_incr= time_div - s->last_time_base;
-    assert(time_incr >= 0);
-    while(time_incr--)
-        put_bits(&s->pb, 1, 1);
-
-    put_bits(&s->pb, 1, 0);
-
-    put_bits(&s->pb, 1, 1);                             /* marker */
-    put_bits(&s->pb, s->time_increment_bits, time_mod); /* time increment */
-    put_bits(&s->pb, 1, 1);                             /* marker */
-    put_bits(&s->pb, 1, 1);                             /* vop coded */
-    if (    s->pict_type == FF_P_TYPE
-        || (s->pict_type == FF_S_TYPE && s->vol_sprite_usage==GMC_SPRITE)) {
-        put_bits(&s->pb, 1, s->no_rounding);    /* rounding type */
-    }
-    put_bits(&s->pb, 3, 0);     /* intra dc VLC threshold */
-    if(!s->progressive_sequence){
-         put_bits(&s->pb, 1, s->current_picture_ptr->top_field_first);
-         put_bits(&s->pb, 1, s->alternate_scan);
-    }
-    //FIXME sprite stuff
-
-    put_bits(&s->pb, 5, s->qscale);
-
-    if (s->pict_type != FF_I_TYPE)
-        put_bits(&s->pb, 3, s->f_code); /* fcode_for */
-    if (s->pict_type == FF_B_TYPE)
-        put_bits(&s->pb, 3, s->b_code); /* fcode_back */
-}
-
-
-static void init_uni_dc_tab(void)
-{
-    int level, uni_code, uni_len;
-
-    for(level=-256; level<256; level++){
-        int size, v, l;
-        /* find number of bits */
-        size = 0;
-        v = abs(level);
-        while (v) {
-            v >>= 1;
-            size++;
-        }
-
-        if (level < 0)
-            l= (-level) ^ ((1 << size) - 1);
-        else
-            l= level;
-
-        /* luminance */
-        uni_code= ff_mpeg4_DCtab_lum[size][0];
-        uni_len = ff_mpeg4_DCtab_lum[size][1];
-
-        if (size > 0) {
-            uni_code<<=size; uni_code|=l;
-            uni_len+=size;
-            if (size > 8){
-                uni_code<<=1; uni_code|=1;
-                uni_len++;
-            }
-        }
-        uni_DCtab_lum_bits[level+256]= uni_code;
-        uni_DCtab_lum_len [level+256]= uni_len;
-
-        /* chrominance */
-        uni_code= ff_mpeg4_DCtab_chrom[size][0];
-        uni_len = ff_mpeg4_DCtab_chrom[size][1];
-
-        if (size > 0) {
-            uni_code<<=size; uni_code|=l;
-            uni_len+=size;
-            if (size > 8){
-                uni_code<<=1; uni_code|=1;
-                uni_len++;
-            }
-        }
-        uni_DCtab_chrom_bits[level+256]= uni_code;
-        uni_DCtab_chrom_len [level+256]= uni_len;
-
-    }
-}
-
-static void init_uni_mpeg4_rl_tab(RLTable *rl, uint32_t *bits_tab, uint8_t *len_tab){
-    int slevel, run, last;
-
-    assert(MAX_LEVEL >= 64);
-    assert(MAX_RUN   >= 63);
-
-    for(slevel=-64; slevel<64; slevel++){
-        if(slevel==0) continue;
-        for(run=0; run<64; run++){
-            for(last=0; last<=1; last++){
-                const int index= UNI_MPEG4_ENC_INDEX(last, run, slevel+64);
-                int level= slevel < 0 ? -slevel : slevel;
-                int sign= slevel < 0 ? 1 : 0;
-                int bits, len, code;
-                int level1, run1;
-
-                len_tab[index]= 100;
-
-                /* ESC0 */
-                code= get_rl_index(rl, last, run, level);
-                bits= rl->table_vlc[code][0];
-                len=  rl->table_vlc[code][1];
-                bits=bits*2+sign; len++;
-
-                if(code!=rl->n && len < len_tab[index]){
-                    bits_tab[index]= bits;
-                    len_tab [index]= len;
-                }
-                /* ESC1 */
-                bits= rl->table_vlc[rl->n][0];
-                len=  rl->table_vlc[rl->n][1];
-                bits=bits*2;    len++; //esc1
-                level1= level - rl->max_level[last][run];
-                if(level1>0){
-                    code= get_rl_index(rl, last, run, level1);
-                    bits<<= rl->table_vlc[code][1];
-                    len  += rl->table_vlc[code][1];
-                    bits += rl->table_vlc[code][0];
-                    bits=bits*2+sign; len++;
-
-                    if(code!=rl->n && len < len_tab[index]){
-                        bits_tab[index]= bits;
-                        len_tab [index]= len;
-                    }
-                }
-                /* ESC2 */
-                bits= rl->table_vlc[rl->n][0];
-                len=  rl->table_vlc[rl->n][1];
-                bits=bits*4+2;    len+=2; //esc2
-                run1 = run - rl->max_run[last][level] - 1;
-                if(run1>=0){
-                    code= get_rl_index(rl, last, run1, level);
-                    bits<<= rl->table_vlc[code][1];
-                    len  += rl->table_vlc[code][1];
-                    bits += rl->table_vlc[code][0];
-                    bits=bits*2+sign; len++;
-
-                    if(code!=rl->n && len < len_tab[index]){
-                        bits_tab[index]= bits;
-                        len_tab [index]= len;
-                    }
-                }
-                /* ESC3 */
-                bits= rl->table_vlc[rl->n][0];
-                len = rl->table_vlc[rl->n][1];
-                bits=bits*4+3;    len+=2; //esc3
-                bits=bits*2+last; len++;
-                bits=bits*64+run; len+=6;
-                bits=bits*2+1;    len++;  //marker
-                bits=bits*4096+(slevel&0xfff); len+=12;
-                bits=bits*2+1;    len++;  //marker
-
-                if(len < len_tab[index]){
-                    bits_tab[index]= bits;
-                    len_tab [index]= len;
-                }
-            }
-        }
-    }
-}
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    int ret;
-    static int done = 0;
-
-    if((ret=MPV_encode_init(avctx)) < 0)
-        return ret;
-
-    if (!done) {
-        done = 1;
-
-        init_uni_dc_tab();
-
-        init_rl(&ff_mpeg4_rl_intra, ff_mpeg4_static_rl_table_store[0]);
-
-        init_uni_mpeg4_rl_tab(&ff_mpeg4_rl_intra, uni_mpeg4_intra_rl_bits, uni_mpeg4_intra_rl_len);
-        init_uni_mpeg4_rl_tab(&ff_h263_rl_inter, uni_mpeg4_inter_rl_bits, uni_mpeg4_inter_rl_len);
-    }
-
-    s->min_qcoeff= -2048;
-    s->max_qcoeff=  2047;
-    s->intra_ac_vlc_length     = uni_mpeg4_intra_rl_len;
-    s->intra_ac_vlc_last_length= uni_mpeg4_intra_rl_len + 128*64;
-    s->inter_ac_vlc_length     = uni_mpeg4_inter_rl_len;
-    s->inter_ac_vlc_last_length= uni_mpeg4_inter_rl_len + 128*64;
-    s->luma_dc_vlc_length= uni_DCtab_lum_len;
-    s->chroma_dc_vlc_length= uni_DCtab_chrom_len;
-    s->ac_esc_length= 7+2+1+6+1+12+1;
-    s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table;
-    s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
-
-    if(s->flags & CODEC_FLAG_GLOBAL_HEADER){
-
-        s->avctx->extradata= av_malloc(1024);
-        init_put_bits(&s->pb, s->avctx->extradata, 1024);
-
-        if(!(s->workaround_bugs & FF_BUG_MS))
-            mpeg4_encode_visual_object_header(s);
-        mpeg4_encode_vol_header(s, 0, 0);
-
-//            ff_mpeg4_stuffing(&s->pb); ?
-        flush_put_bits(&s->pb);
-        s->avctx->extradata_size= (put_bits_count(&s->pb)+7)>>3;
-    }
-    return 0;
-}
-
-void ff_mpeg4_init_partitions(MpegEncContext *s)
-{
-    uint8_t *start= put_bits_ptr(&s->pb);
-    uint8_t *end= s->pb.buf_end;
-    int size= end - start;
-    int pb_size = (((intptr_t)start + size/3)&(~3)) - (intptr_t)start;
-    int tex_size= (size - 2*pb_size)&(~3);
-
-    set_put_bits_buffer_size(&s->pb, pb_size);
-    init_put_bits(&s->tex_pb, start + pb_size           , tex_size);
-    init_put_bits(&s->pb2   , start + pb_size + tex_size, pb_size);
-}
-
-void ff_mpeg4_merge_partitions(MpegEncContext *s)
-{
-    const int pb2_len   = put_bits_count(&s->pb2   );
-    const int tex_pb_len= put_bits_count(&s->tex_pb);
-    const int bits= put_bits_count(&s->pb);
-
-    if(s->pict_type==FF_I_TYPE){
-        put_bits(&s->pb, 19, DC_MARKER);
-        s->misc_bits+=19 + pb2_len + bits - s->last_bits;
-        s->i_tex_bits+= tex_pb_len;
-    }else{
-        put_bits(&s->pb, 17, MOTION_MARKER);
-        s->misc_bits+=17 + pb2_len;
-        s->mv_bits+= bits - s->last_bits;
-        s->p_tex_bits+= tex_pb_len;
-    }
-
-    flush_put_bits(&s->pb2);
-    flush_put_bits(&s->tex_pb);
-
-    set_put_bits_buffer_size(&s->pb, s->pb2.buf_end - s->pb.buf);
-    ff_copy_bits(&s->pb, s->pb2.buf   , pb2_len);
-    ff_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len);
-    s->last_bits= put_bits_count(&s->pb);
-}
-
-
-void ff_mpeg4_encode_video_packet_header(MpegEncContext *s)
-{
-    int mb_num_bits= av_log2(s->mb_num - 1) + 1;
-
-    put_bits(&s->pb, ff_mpeg4_get_video_packet_prefix_length(s), 0);
-    put_bits(&s->pb, 1, 1);
-
-    put_bits(&s->pb, mb_num_bits, s->mb_x + s->mb_y*s->mb_width);
-    put_bits(&s->pb, s->quant_precision, s->qscale);
-    put_bits(&s->pb, 1, 0); /* no HEC */
-}
-
-AVCodec mpeg4_encoder = {
-    "mpeg4",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MPEG4,
-    sizeof(MpegEncContext),
-    encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .capabilities= CODEC_CAP_DELAY,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
-};
diff --git a/libavcodec/mpegaudio.c b/libavcodec/mpegaudio.c
deleted file mode 100644
index cba5299..0000000
--- a/libavcodec/mpegaudio.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * MPEG Audio common code
- * Copyright (c) 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG Audio common code.
- */
-
-#include "mpegaudio.h"
-
-
-/* bitrate is in kb/s */
-int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf)
-{
-    int ch_bitrate, table;
-
-    ch_bitrate = bitrate / nb_channels;
-    if (!lsf) {
-        if ((freq == 48000 && ch_bitrate >= 56) ||
-            (ch_bitrate >= 56 && ch_bitrate <= 80))
-            table = 0;
-        else if (freq != 48000 && ch_bitrate >= 96)
-            table = 1;
-        else if (freq != 32000 && ch_bitrate <= 48)
-            table = 2;
-        else
-            table = 3;
-    } else {
-        table = 4;
-    }
-    return table;
-}
diff --git a/libavcodec/mpegaudio.h b/libavcodec/mpegaudio.h
deleted file mode 100644
index 26ec2be..0000000
--- a/libavcodec/mpegaudio.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mpeg audio declarations for both encoder and decoder.
- */
-
-#ifndef AVCODEC_MPEGAUDIO_H
-#define AVCODEC_MPEGAUDIO_H
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-
-#define CONFIG_AUDIO_NONSHORT 0
-
-/* max frame size, in samples */
-#define MPA_FRAME_SIZE 1152
-
-/* max compressed frame size */
-#define MPA_MAX_CODED_FRAME_SIZE 1792
-
-#define MPA_MAX_CHANNELS 2
-
-#define SBLIMIT 32 /* number of subbands */
-
-#define MPA_STEREO  0
-#define MPA_JSTEREO 1
-#define MPA_DUAL    2
-#define MPA_MONO    3
-
-/* header + layer + bitrate + freq + lsf/mpeg25 */
-#define SAME_HEADER_MASK \
-   (0xffe00000 | (3 << 17) | (0xf << 12) | (3 << 10) | (3 << 19))
-
-#define MP3_MASK 0xFFFE0CCF
-
-#if CONFIG_MPEGAUDIO_HP
-#define FRAC_BITS   23   /* fractional bits for sb_samples and dct */
-#define WFRAC_BITS  16   /* fractional bits for window */
-#else
-#define FRAC_BITS   15   /* fractional bits for sb_samples and dct */
-#define WFRAC_BITS  14   /* fractional bits for window */
-#endif
-
-#define FRAC_ONE    (1 << FRAC_BITS)
-
-#define FIX(a)   ((int)((a) * FRAC_ONE))
-
-#if CONFIG_MPEGAUDIO_HP && CONFIG_AUDIO_NONSHORT
-typedef int32_t OUT_INT;
-#define OUT_MAX INT32_MAX
-#define OUT_MIN INT32_MIN
-#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31)
-#define OUT_FMT SAMPLE_FMT_S32
-#else
-typedef int16_t OUT_INT;
-#define OUT_MAX INT16_MAX
-#define OUT_MIN INT16_MIN
-#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
-#define OUT_FMT SAMPLE_FMT_S16
-#endif
-
-#if FRAC_BITS <= 15
-typedef int16_t MPA_INT;
-#else
-typedef int32_t MPA_INT;
-#endif
-
-#define BACKSTEP_SIZE 512
-#define EXTRABYTES 24
-
-/* layer 3 "granule" */
-typedef struct GranuleDef {
-    uint8_t scfsi;
-    int part2_3_length;
-    int big_values;
-    int global_gain;
-    int scalefac_compress;
-    uint8_t block_type;
-    uint8_t switch_point;
-    int table_select[3];
-    int subblock_gain[3];
-    uint8_t scalefac_scale;
-    uint8_t count1table_select;
-    int region_size[3]; /* number of huffman codes in each region */
-    int preflag;
-    int short_start, long_end; /* long/short band indexes */
-    uint8_t scale_factors[40];
-    int32_t sb_hybrid[SBLIMIT * 18]; /* 576 samples */
-} GranuleDef;
-
-#define MPA_DECODE_HEADER \
-    int frame_size; \
-    int error_protection; \
-    int layer; \
-    int sample_rate; \
-    int sample_rate_index; /* between 0 and 8 */ \
-    int bit_rate; \
-    int nb_channels; \
-    int mode; \
-    int mode_ext; \
-    int lsf;
-
-typedef struct MPADecodeHeader {
-  MPA_DECODE_HEADER
-} MPADecodeHeader;
-
-typedef struct MPADecodeContext {
-    MPA_DECODE_HEADER
-    uint8_t last_buf[2*BACKSTEP_SIZE + EXTRABYTES];
-    int last_buf_size;
-    /* next header (used in free format parsing) */
-    uint32_t free_format_next_header;
-    GetBitContext gb;
-    GetBitContext in_gb;
-    DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512 * 2];
-    int synth_buf_offset[MPA_MAX_CHANNELS];
-    DECLARE_ALIGNED(16, int32_t, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT];
-    int32_t mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
-    GranuleDef granules[2][2]; /* Used in Layer 3 */
-#ifdef DEBUG
-    int frame_count;
-#endif
-    void (*compute_antialias)(struct MPADecodeContext *s, struct GranuleDef *g);
-    int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3
-    int dither_state;
-    int error_recognition;
-    AVCodecContext* avctx;
-} MPADecodeContext;
-
-/* layer 3 huffman tables */
-typedef struct HuffTable {
-    int xsize;
-    const uint8_t *bits;
-    const uint16_t *codes;
-} HuffTable;
-
-int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf);
-int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
-extern MPA_INT ff_mpa_synth_window[];
-void ff_mpa_synth_init(MPA_INT *window);
-void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
-                         MPA_INT *window, int *dither_state,
-                         OUT_INT *samples, int incr,
-                         int32_t sb_samples[SBLIMIT]);
-
-/* fast header check for resync */
-static inline int ff_mpa_check_header(uint32_t header){
-    /* header */
-    if ((header & 0xffe00000) != 0xffe00000)
-        return -1;
-    /* layer check */
-    if ((header & (3<<17)) == 0)
-        return -1;
-    /* bit rate */
-    if ((header & (0xf<<12)) == 0xf<<12)
-        return -1;
-    /* frequency */
-    if ((header & (3<<10)) == 3<<10)
-        return -1;
-    return 0;
-}
-
-#endif /* AVCODEC_MPEGAUDIO_H */
diff --git a/libavcodec/mpegaudio3.h b/libavcodec/mpegaudio3.h
deleted file mode 100644
index c374a59..0000000
--- a/libavcodec/mpegaudio3.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2007 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* layer 3 "granule" */
-typedef struct GranuleDef {
-    uint8_t scfsi;
-    int part2_3_length;
-    int big_values;
-    int global_gain;
-    int scalefac_compress;
-    uint8_t block_type;
-    uint8_t switch_point;
-    int table_select[3];
-    int subblock_gain[3];
-    uint8_t scalefac_scale;
-    uint8_t count1table_select;
-    int region_size[3]; /* number of huffman codes in each region */
-    int preflag;
-    int short_start, long_end; /* long/short band indexes */
-    uint8_t scale_factors[40];
-    int32_t sb_hybrid[SBLIMIT * 18]; /* 576 samples */
-} GranuleDef;
-
-void ff_mp3_init(void);
-
-/**
- * Compute huffman coded region sizes.
- */
-void ff_init_short_region(MPADecodeContext *s, GranuleDef *g);
-
-/**
- * Compute huffman coded region sizes.
- */
-void ff_init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int ra2);
-
-void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g);
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
deleted file mode 100644
index 6d7ab8a..0000000
--- a/libavcodec/mpegaudio_parser.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * MPEG Audio parser
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-#include "mpegaudio.h"
-#include "mpegaudiodecheader.h"
-
-
-typedef struct MpegAudioParseContext {
-    ParseContext pc;
-    int frame_size;
-    uint32_t header;
-    int header_count;
-} MpegAudioParseContext;
-
-#define MPA_HEADER_SIZE 4
-
-/* header + layer + bitrate + freq + lsf/mpeg25 */
-#undef SAME_HEADER_MASK /* mpegaudio.h defines different version */
-#define SAME_HEADER_MASK \
-   (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19))
-
-/* useful helper to get mpeg audio stream infos. Return -1 if error in
-   header, otherwise the coded frame size in bytes */
-int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
-{
-    MPADecodeHeader s1, *s = &s1;
-
-    if (ff_mpa_check_header(head) != 0)
-        return -1;
-
-    if (ff_mpegaudio_decode_header(s, head) != 0) {
-        return -1;
-    }
-
-    switch(s->layer) {
-    case 1:
-        avctx->codec_id = CODEC_ID_MP1;
-        *frame_size = 384;
-        break;
-    case 2:
-        avctx->codec_id = CODEC_ID_MP2;
-        *frame_size = 1152;
-        break;
-    default:
-    case 3:
-        avctx->codec_id = CODEC_ID_MP3;
-        if (s->lsf)
-            *frame_size = 576;
-        else
-            *frame_size = 1152;
-        break;
-    }
-
-    *sample_rate = s->sample_rate;
-    *channels = s->nb_channels;
-    *bit_rate = s->bit_rate;
-    avctx->sub_id = s->layer;
-    return s->frame_size;
-}
-
-static int mpegaudio_parse(AVCodecParserContext *s1,
-                           AVCodecContext *avctx,
-                           const uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size)
-{
-    MpegAudioParseContext *s = s1->priv_data;
-    ParseContext *pc = &s->pc;
-    uint32_t state= pc->state;
-    int i;
-    int next= END_NOT_FOUND;
-
-    for(i=0; i<buf_size; ){
-        if(s->frame_size){
-            int inc= FFMIN(buf_size - i, s->frame_size);
-            i += inc;
-            s->frame_size -= inc;
-
-            if(!s->frame_size){
-                next= i;
-                break;
-            }
-        }else{
-            while(i<buf_size){
-                int ret, sr, channels, bit_rate, frame_size;
-
-                state= (state<<8) + buf[i++];
-
-                ret = ff_mpa_decode_header(avctx, state, &sr, &channels, &frame_size, &bit_rate);
-                if (ret < 4) {
-                    s->header_count= -2;
-                } else {
-                    if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
-                        s->header_count= -3;
-                    s->header= state;
-                    s->header_count++;
-                    s->frame_size = ret-4;
-
-                    if(s->header_count > 1){
-                        avctx->sample_rate= sr;
-                        avctx->channels   = channels;
-                        avctx->frame_size = frame_size;
-                        avctx->bit_rate   = bit_rate;
-                    }
-                    break;
-                }
-            }
-        }
-    }
-
-    pc->state= state;
-    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-        *poutbuf = NULL;
-        *poutbuf_size = 0;
-        return buf_size;
-    }
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-
-AVCodecParser mpegaudio_parser = {
-    { CODEC_ID_MP1, CODEC_ID_MP2, CODEC_ID_MP3 },
-    sizeof(MpegAudioParseContext),
-    NULL,
-    mpegaudio_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/mpegaudio_tablegen.c b/libavcodec/mpegaudio_tablegen.c
deleted file mode 100644
index 70d145b..0000000
--- a/libavcodec/mpegaudio_tablegen.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Generate a header file for hardcoded mpegaudiodec tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#include "mpegaudio_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    mpegaudio_tableinit();
-
-    write_fileheader();
-
-    printf("static const int8_t table_4_3_exp[TABLE_4_3_SIZE] = {\n");
-    write_int8_array(table_4_3_exp, TABLE_4_3_SIZE);
-    printf("};\n");
-
-    printf("static const uint32_t table_4_3_value[TABLE_4_3_SIZE] = {\n");
-    write_uint32_array(table_4_3_value, TABLE_4_3_SIZE);
-    printf("};\n");
-
-    printf("static const uint32_t exp_table[512] = {\n");
-    write_uint32_array(exp_table, 512);
-    printf("};\n");
-
-    printf("static const uint32_t expval_table[512][16] = {\n");
-    write_uint32_2d_array(expval_table, 512, 16);
-    printf("};\n");
-
-    return 0;
-}
diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h
deleted file mode 100644
index 9d056cb..0000000
--- a/libavcodec/mpegaudio_tablegen.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Header file for hardcoded mpegaudiodec tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef MPEGAUDIO_TABLEGEN_H
-#define MPEGAUDIO_TABLEGEN_H
-
-#include <stdint.h>
-// do not use libavutil/mathematics.h since this is compiled both
-// for the host and the target and config.h is only valid for the target
-#include <math.h>
-
-#define TABLE_4_3_SIZE (8191 + 16)*4
-#if CONFIG_HARDCODED_TABLES
-#define mpegaudio_tableinit()
-#include "libavcodec/mpegaudio_tables.h"
-#else
-static int8_t   table_4_3_exp[TABLE_4_3_SIZE];
-static uint32_t table_4_3_value[TABLE_4_3_SIZE];
-static uint32_t exp_table[512];
-static uint32_t expval_table[512][16];
-
-static void mpegaudio_tableinit(void)
-{
-    int i, value, exponent;
-    for (i = 1; i < TABLE_4_3_SIZE; i++) {
-        double value = i / 4;
-        double f, fm;
-        int e, m;
-        f  = value * cbrtf(value) * pow(2, (i & 3) * 0.25);
-        fm = frexp(f, &e);
-        m  = (uint32_t)(fm * (1LL << 31) + 0.5);
-        e += FRAC_BITS - 31 + 5 - 100;
-
-        /* normalized to FRAC_BITS */
-        table_4_3_value[i] =  m;
-        table_4_3_exp[i]   = -e;
-    }
-    for (exponent = 0; exponent < 512; exponent++) {
-        for (value = 0; value < 16; value++) {
-            double f = (double)value * cbrtf(value) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5);
-            expval_table[exponent][value] = llrint(f);
-        }
-        exp_table[exponent] = expval_table[exponent][1];
-    }
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* MPEGAUDIO_TABLEGEN_H */
diff --git a/libavcodec/mpegaudiodata.c b/libavcodec/mpegaudiodata.c
deleted file mode 100644
index c9dabf3..0000000
--- a/libavcodec/mpegaudiodata.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * MPEG Audio common tables
- * copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mpeg audio layer common tables.
- */
-
-#include "mpegaudiodata.h"
-
-
-const uint16_t ff_mpa_bitrate_tab[2][3][15] = {
-    { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
-      {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
-      {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
-    { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256},
-      {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160},
-      {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}
-    }
-};
-
-const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 };
-
-/*******************************************************/
-/* half mpeg encoding window (full precision) */
-const int32_t ff_mpa_enwindow[257] = {
-     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,
-};
-
-/*******************************************************/
-/* layer 2 tables */
-
-const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 };
-
-const int ff_mpa_quant_steps[17] = {
-    3,     5,    7,    9,    15,
-    31,    63,  127,  255,   511,
-    1023,  2047, 4095, 8191, 16383,
-    32767, 65535
-};
-
-/* we use a negative value if grouped */
-const int ff_mpa_quant_bits[17] = {
-    -5,  -7,  3, -10, 4,
-     5,  6,  7,  8,  9,
-    10, 11, 12, 13, 14,
-    15, 16
-};
-
-/* encoding tables which give the quantization index. Note how it is
-   possible to store them efficiently ! */
-static const unsigned char alloc_table_1[] = {
- 4,  0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
- 4,  0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
- 4,  0,  2,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 3,  0,  1,  2,  3,  4,  5, 16,
- 2,  0,  1, 16,
- 2,  0,  1, 16,
- 2,  0,  1, 16,
- 2,  0,  1, 16,
- 2,  0,  1, 16,
- 2,  0,  1, 16,
- 2,  0,  1, 16,
-};
-
-static const unsigned char alloc_table_3[] = {
- 4,  0,  1,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
- 4,  0,  1,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
-};
-
-static const unsigned char alloc_table_4[] = {
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
- 4,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 3,  0,  1,  3,  4,  5,  6,  7,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
- 2,  0,  1,  3,
-};
-
-const unsigned char * const ff_mpa_alloc_tables[5] =
-{ alloc_table_1, alloc_table_1, alloc_table_3, alloc_table_3, alloc_table_4, };
diff --git a/libavcodec/mpegaudiodata.h b/libavcodec/mpegaudiodata.h
deleted file mode 100644
index 5626e3d..0000000
--- a/libavcodec/mpegaudiodata.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * MPEG Audio common tables
- * copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mpeg audio layer common tables.
- */
-
-#ifndef AVCODEC_MPEGAUDIODATA_H
-#define AVCODEC_MPEGAUDIODATA_H
-
-#include "libavutil/common.h"
-
-#define MODE_EXT_MS_STEREO 2
-#define MODE_EXT_I_STEREO  1
-
-extern const uint16_t ff_mpa_bitrate_tab[2][3][15];
-extern const uint16_t ff_mpa_freq_tab[3];
-extern const int32_t ff_mpa_enwindow[257];
-extern const int ff_mpa_sblimit_table[5];
-extern const int ff_mpa_quant_steps[17];
-extern const int ff_mpa_quant_bits[17];
-extern const unsigned char * const ff_mpa_alloc_tables[5];
-
-#endif /* AVCODEC_MPEGAUDIODATA_H */
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
deleted file mode 100644
index 25fad80..0000000
--- a/libavcodec/mpegaudiodec.c
+++ /dev/null
@@ -1,2571 +0,0 @@
-/*
- * MPEG Audio decoder
- * Copyright (c) 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG Audio decoder.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-
-/*
- * TODO:
- *  - in low precision mode, use more 16 bit multiplies in synth filter
- *  - test lsf / mpeg25 extensively.
- */
-
-#include "mpegaudio.h"
-#include "mpegaudiodecheader.h"
-
-#include "mathops.h"
-
-/* WARNING: only correct for posititive numbers */
-#define FIXR(a)   ((int)((a) * FRAC_ONE + 0.5))
-#define FRAC_RND(a) (((a) + (FRAC_ONE/2)) >> FRAC_BITS)
-
-#define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5))
-
-/****************/
-
-#define HEADER_SIZE 4
-
-#include "mpegaudiodata.h"
-#include "mpegaudiodectab.h"
-
-static void compute_antialias_integer(MPADecodeContext *s, GranuleDef *g);
-static void compute_antialias_float(MPADecodeContext *s, GranuleDef *g);
-
-/* vlc structure for decoding layer 3 huffman tables */
-static VLC huff_vlc[16];
-static VLC_TYPE huff_vlc_tables[
-  0+128+128+128+130+128+154+166+
-  142+204+190+170+542+460+662+414
-  ][2];
-static const int huff_vlc_tables_sizes[16] = {
-  0, 128, 128, 128, 130, 128, 154, 166,
-  142, 204, 190, 170, 542, 460, 662, 414
-};
-static VLC huff_quad_vlc[2];
-static VLC_TYPE huff_quad_vlc_tables[128+16][2];
-static const int huff_quad_vlc_tables_sizes[2] = {
-  128, 16
-};
-/* computed from band_size_long */
-static uint16_t band_index_long[9][23];
-#include "mpegaudio_tablegen.h"
-/* intensity stereo coef table */
-static int32_t is_table[2][16];
-static int32_t is_table_lsf[2][2][16];
-static int32_t csa_table[8][4];
-static float csa_table_float[8][4];
-static int32_t mdct_win[8][36];
-
-/* lower 2 bits: modulo 3, higher bits: shift */
-static uint16_t scale_factor_modshift[64];
-/* [i][j]:  2^(-j/3) * FRAC_ONE * 2^(i+2) / (2^(i+2) - 1) */
-static int32_t scale_factor_mult[15][3];
-/* mult table for layer 2 group quantization */
-
-#define SCALE_GEN(v) \
-{ FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) }
-
-static const int32_t scale_factor_mult2[3][3] = {
-    SCALE_GEN(4.0 / 3.0), /* 3 steps */
-    SCALE_GEN(4.0 / 5.0), /* 5 steps */
-    SCALE_GEN(4.0 / 9.0), /* 9 steps */
-};
-
-DECLARE_ALIGNED(16, MPA_INT, ff_mpa_synth_window)[512];
-
-/**
- * Convert region offsets to region sizes and truncate
- * size to big_values.
- */
-static void ff_region_offset2size(GranuleDef *g){
-    int i, k, j=0;
-    g->region_size[2] = (576 / 2);
-    for(i=0;i<3;i++) {
-        k = FFMIN(g->region_size[i], g->big_values);
-        g->region_size[i] = k - j;
-        j = k;
-    }
-}
-
-static void ff_init_short_region(MPADecodeContext *s, GranuleDef *g){
-    if (g->block_type == 2)
-        g->region_size[0] = (36 / 2);
-    else {
-        if (s->sample_rate_index <= 2)
-            g->region_size[0] = (36 / 2);
-        else if (s->sample_rate_index != 8)
-            g->region_size[0] = (54 / 2);
-        else
-            g->region_size[0] = (108 / 2);
-    }
-    g->region_size[1] = (576 / 2);
-}
-
-static void ff_init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int ra2){
-    int l;
-    g->region_size[0] =
-        band_index_long[s->sample_rate_index][ra1 + 1] >> 1;
-    /* should not overflow */
-    l = FFMIN(ra1 + ra2 + 2, 22);
-    g->region_size[1] =
-        band_index_long[s->sample_rate_index][l] >> 1;
-}
-
-static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g){
-    if (g->block_type == 2) {
-        if (g->switch_point) {
-            /* if switched mode, we handle the 36 first samples as
-                long blocks.  For 8000Hz, we handle the 48 first
-                exponents as long blocks (XXX: check this!) */
-            if (s->sample_rate_index <= 2)
-                g->long_end = 8;
-            else if (s->sample_rate_index != 8)
-                g->long_end = 6;
-            else
-                g->long_end = 4; /* 8000 Hz */
-
-            g->short_start = 2 + (s->sample_rate_index != 8);
-        } else {
-            g->long_end = 0;
-            g->short_start = 0;
-        }
-    } else {
-        g->short_start = 13;
-        g->long_end = 22;
-    }
-}
-
-/* layer 1 unscaling */
-/* n = number of bits of the mantissa minus 1 */
-static inline int l1_unscale(int n, int mant, int scale_factor)
-{
-    int shift, mod;
-    int64_t val;
-
-    shift = scale_factor_modshift[scale_factor];
-    mod = shift & 3;
-    shift >>= 2;
-    val = MUL64(mant + (-1 << n) + 1, scale_factor_mult[n-1][mod]);
-    shift += n;
-    /* NOTE: at this point, 1 <= shift >= 21 + 15 */
-    return (int)((val + (1LL << (shift - 1))) >> shift);
-}
-
-static inline int l2_unscale_group(int steps, int mant, int scale_factor)
-{
-    int shift, mod, val;
-
-    shift = scale_factor_modshift[scale_factor];
-    mod = shift & 3;
-    shift >>= 2;
-
-    val = (mant - (steps >> 1)) * scale_factor_mult2[steps >> 2][mod];
-    /* NOTE: at this point, 0 <= shift <= 21 */
-    if (shift > 0)
-        val = (val + (1 << (shift - 1))) >> shift;
-    return val;
-}
-
-/* compute value^(4/3) * 2^(exponent/4). It normalized to FRAC_BITS */
-static inline int l3_unscale(int value, int exponent)
-{
-    unsigned int m;
-    int e;
-
-    e = table_4_3_exp  [4*value + (exponent&3)];
-    m = table_4_3_value[4*value + (exponent&3)];
-    e -= (exponent >> 2);
-    assert(e>=1);
-    if (e > 31)
-        return 0;
-    m = (m + (1 << (e-1))) >> e;
-
-    return m;
-}
-
-/* all integer n^(4/3) computation code */
-#define DEV_ORDER 13
-
-#define POW_FRAC_BITS 24
-#define POW_FRAC_ONE    (1 << POW_FRAC_BITS)
-#define POW_FIX(a)   ((int)((a) * POW_FRAC_ONE))
-#define POW_MULL(a,b) (((int64_t)(a) * (int64_t)(b)) >> POW_FRAC_BITS)
-
-static int dev_4_3_coefs[DEV_ORDER];
-
-#if 0 /* unused */
-static int pow_mult3[3] = {
-    POW_FIX(1.0),
-    POW_FIX(1.25992104989487316476),
-    POW_FIX(1.58740105196819947474),
-};
-#endif
-
-static av_cold void int_pow_init(void)
-{
-    int i, a;
-
-    a = POW_FIX(1.0);
-    for(i=0;i<DEV_ORDER;i++) {
-        a = POW_MULL(a, POW_FIX(4.0 / 3.0) - i * POW_FIX(1.0)) / (i + 1);
-        dev_4_3_coefs[i] = a;
-    }
-}
-
-#if 0 /* unused, remove? */
-/* return the mantissa and the binary exponent */
-static int int_pow(int i, int *exp_ptr)
-{
-    int e, er, eq, j;
-    int a, a1;
-
-    /* renormalize */
-    a = i;
-    e = POW_FRAC_BITS;
-    while (a < (1 << (POW_FRAC_BITS - 1))) {
-        a = a << 1;
-        e--;
-    }
-    a -= (1 << POW_FRAC_BITS);
-    a1 = 0;
-    for(j = DEV_ORDER - 1; j >= 0; j--)
-        a1 = POW_MULL(a, dev_4_3_coefs[j] + a1);
-    a = (1 << POW_FRAC_BITS) + a1;
-    /* exponent compute (exact) */
-    e = e * 4;
-    er = e % 3;
-    eq = e / 3;
-    a = POW_MULL(a, pow_mult3[er]);
-    while (a >= 2 * POW_FRAC_ONE) {
-        a = a >> 1;
-        eq++;
-    }
-    /* convert to float */
-    while (a < POW_FRAC_ONE) {
-        a = a << 1;
-        eq--;
-    }
-    /* now POW_FRAC_ONE <= a < 2 * POW_FRAC_ONE */
-#if POW_FRAC_BITS > FRAC_BITS
-    a = (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS);
-    /* correct overflow */
-    if (a >= 2 * (1 << FRAC_BITS)) {
-        a = a >> 1;
-        eq++;
-    }
-#endif
-    *exp_ptr = eq;
-    return a;
-}
-#endif
-
-static av_cold int decode_init(AVCodecContext * avctx)
-{
-    MPADecodeContext *s = avctx->priv_data;
-    static int init=0;
-    int i, j, k;
-
-    s->avctx = avctx;
-
-    avctx->sample_fmt= OUT_FMT;
-    s->error_recognition= avctx->error_recognition;
-
-    if(avctx->antialias_algo != FF_AA_FLOAT)
-        s->compute_antialias= compute_antialias_integer;
-    else
-        s->compute_antialias= compute_antialias_float;
-
-    if (!init && !avctx->parse_only) {
-        int offset;
-
-        /* scale factors table for layer 1/2 */
-        for(i=0;i<64;i++) {
-            int shift, mod;
-            /* 1.0 (i = 3) is normalized to 2 ^ FRAC_BITS */
-            shift = (i / 3);
-            mod = i % 3;
-            scale_factor_modshift[i] = mod | (shift << 2);
-        }
-
-        /* scale factor multiply for layer 1 */
-        for(i=0;i<15;i++) {
-            int n, norm;
-            n = i + 2;
-            norm = ((INT64_C(1) << n) * FRAC_ONE) / ((1 << n) - 1);
-            scale_factor_mult[i][0] = MULL(FIXR(1.0 * 2.0), norm, FRAC_BITS);
-            scale_factor_mult[i][1] = MULL(FIXR(0.7937005259 * 2.0), norm, FRAC_BITS);
-            scale_factor_mult[i][2] = MULL(FIXR(0.6299605249 * 2.0), norm, FRAC_BITS);
-            dprintf(avctx, "%d: norm=%x s=%x %x %x\n",
-                    i, norm,
-                    scale_factor_mult[i][0],
-                    scale_factor_mult[i][1],
-                    scale_factor_mult[i][2]);
-        }
-
-        ff_mpa_synth_init(ff_mpa_synth_window);
-
-        /* huffman decode tables */
-        offset = 0;
-        for(i=1;i<16;i++) {
-            const HuffTable *h = &mpa_huff_tables[i];
-            int xsize, x, y;
-            uint8_t  tmp_bits [512];
-            uint16_t tmp_codes[512];
-
-            memset(tmp_bits , 0, sizeof(tmp_bits ));
-            memset(tmp_codes, 0, sizeof(tmp_codes));
-
-            xsize = h->xsize;
-
-            j = 0;
-            for(x=0;x<xsize;x++) {
-                for(y=0;y<xsize;y++){
-                    tmp_bits [(x << 5) | y | ((x&&y)<<4)]= h->bits [j  ];
-                    tmp_codes[(x << 5) | y | ((x&&y)<<4)]= h->codes[j++];
-                }
-            }
-
-            /* XXX: fail test */
-            huff_vlc[i].table = huff_vlc_tables+offset;
-            huff_vlc[i].table_allocated = huff_vlc_tables_sizes[i];
-            init_vlc(&huff_vlc[i], 7, 512,
-                     tmp_bits, 1, 1, tmp_codes, 2, 2,
-                     INIT_VLC_USE_NEW_STATIC);
-            offset += huff_vlc_tables_sizes[i];
-        }
-        assert(offset == FF_ARRAY_ELEMS(huff_vlc_tables));
-
-        offset = 0;
-        for(i=0;i<2;i++) {
-            huff_quad_vlc[i].table = huff_quad_vlc_tables+offset;
-            huff_quad_vlc[i].table_allocated = huff_quad_vlc_tables_sizes[i];
-            init_vlc(&huff_quad_vlc[i], i == 0 ? 7 : 4, 16,
-                     mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1,
-                     INIT_VLC_USE_NEW_STATIC);
-            offset += huff_quad_vlc_tables_sizes[i];
-        }
-        assert(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables));
-
-        for(i=0;i<9;i++) {
-            k = 0;
-            for(j=0;j<22;j++) {
-                band_index_long[i][j] = k;
-                k += band_size_long[i][j];
-            }
-            band_index_long[i][22] = k;
-        }
-
-        /* compute n ^ (4/3) and store it in mantissa/exp format */
-
-        int_pow_init();
-        mpegaudio_tableinit();
-
-        for(i=0;i<7;i++) {
-            float f;
-            int v;
-            if (i != 6) {
-                f = tan((double)i * M_PI / 12.0);
-                v = FIXR(f / (1.0 + f));
-            } else {
-                v = FIXR(1.0);
-            }
-            is_table[0][i] = v;
-            is_table[1][6 - i] = v;
-        }
-        /* invalid values */
-        for(i=7;i<16;i++)
-            is_table[0][i] = is_table[1][i] = 0.0;
-
-        for(i=0;i<16;i++) {
-            double f;
-            int e, k;
-
-            for(j=0;j<2;j++) {
-                e = -(j + 1) * ((i + 1) >> 1);
-                f = pow(2.0, e / 4.0);
-                k = i & 1;
-                is_table_lsf[j][k ^ 1][i] = FIXR(f);
-                is_table_lsf[j][k][i] = FIXR(1.0);
-                dprintf(avctx, "is_table_lsf %d %d: %x %x\n",
-                        i, j, is_table_lsf[j][0][i], is_table_lsf[j][1][i]);
-            }
-        }
-
-        for(i=0;i<8;i++) {
-            float ci, cs, ca;
-            ci = ci_table[i];
-            cs = 1.0 / sqrt(1.0 + ci * ci);
-            ca = cs * ci;
-            csa_table[i][0] = FIXHR(cs/4);
-            csa_table[i][1] = FIXHR(ca/4);
-            csa_table[i][2] = FIXHR(ca/4) + FIXHR(cs/4);
-            csa_table[i][3] = FIXHR(ca/4) - FIXHR(cs/4);
-            csa_table_float[i][0] = cs;
-            csa_table_float[i][1] = ca;
-            csa_table_float[i][2] = ca + cs;
-            csa_table_float[i][3] = ca - cs;
-        }
-
-        /* compute mdct windows */
-        for(i=0;i<36;i++) {
-            for(j=0; j<4; j++){
-                double d;
-
-                if(j==2 && i%3 != 1)
-                    continue;
-
-                d= sin(M_PI * (i + 0.5) / 36.0);
-                if(j==1){
-                    if     (i>=30) d= 0;
-                    else if(i>=24) d= sin(M_PI * (i - 18 + 0.5) / 12.0);
-                    else if(i>=18) d= 1;
-                }else if(j==3){
-                    if     (i<  6) d= 0;
-                    else if(i< 12) d= sin(M_PI * (i -  6 + 0.5) / 12.0);
-                    else if(i< 18) d= 1;
-                }
-                //merge last stage of imdct into the window coefficients
-                d*= 0.5 / cos(M_PI*(2*i + 19)/72);
-
-                if(j==2)
-                    mdct_win[j][i/3] = FIXHR((d / (1<<5)));
-                else
-                    mdct_win[j][i  ] = FIXHR((d / (1<<5)));
-            }
-        }
-
-        /* NOTE: we do frequency inversion adter the MDCT by changing
-           the sign of the right window coefs */
-        for(j=0;j<4;j++) {
-            for(i=0;i<36;i+=2) {
-                mdct_win[j + 4][i] = mdct_win[j][i];
-                mdct_win[j + 4][i + 1] = -mdct_win[j][i + 1];
-            }
-        }
-
-        init = 1;
-    }
-
-    if (avctx->codec_id == CODEC_ID_MP3ADU)
-        s->adu_mode = 1;
-    return 0;
-}
-
-/* tab[i][j] = 1.0 / (2.0 * cos(pi*(2*k+1) / 2^(6 - j))) */
-
-/* cos(i*pi/64) */
-
-#define COS0_0  FIXHR(0.50060299823519630134/2)
-#define COS0_1  FIXHR(0.50547095989754365998/2)
-#define COS0_2  FIXHR(0.51544730992262454697/2)
-#define COS0_3  FIXHR(0.53104259108978417447/2)
-#define COS0_4  FIXHR(0.55310389603444452782/2)
-#define COS0_5  FIXHR(0.58293496820613387367/2)
-#define COS0_6  FIXHR(0.62250412303566481615/2)
-#define COS0_7  FIXHR(0.67480834145500574602/2)
-#define COS0_8  FIXHR(0.74453627100229844977/2)
-#define COS0_9  FIXHR(0.83934964541552703873/2)
-#define COS0_10 FIXHR(0.97256823786196069369/2)
-#define COS0_11 FIXHR(1.16943993343288495515/4)
-#define COS0_12 FIXHR(1.48416461631416627724/4)
-#define COS0_13 FIXHR(2.05778100995341155085/8)
-#define COS0_14 FIXHR(3.40760841846871878570/8)
-#define COS0_15 FIXHR(10.19000812354805681150/32)
-
-#define COS1_0 FIXHR(0.50241928618815570551/2)
-#define COS1_1 FIXHR(0.52249861493968888062/2)
-#define COS1_2 FIXHR(0.56694403481635770368/2)
-#define COS1_3 FIXHR(0.64682178335999012954/2)
-#define COS1_4 FIXHR(0.78815462345125022473/2)
-#define COS1_5 FIXHR(1.06067768599034747134/4)
-#define COS1_6 FIXHR(1.72244709823833392782/4)
-#define COS1_7 FIXHR(5.10114861868916385802/16)
-
-#define COS2_0 FIXHR(0.50979557910415916894/2)
-#define COS2_1 FIXHR(0.60134488693504528054/2)
-#define COS2_2 FIXHR(0.89997622313641570463/2)
-#define COS2_3 FIXHR(2.56291544774150617881/8)
-
-#define COS3_0 FIXHR(0.54119610014619698439/2)
-#define COS3_1 FIXHR(1.30656296487637652785/4)
-
-#define COS4_0 FIXHR(0.70710678118654752439/2)
-
-/* butterfly operator */
-#define BF(a, b, c, s)\
-{\
-    tmp0 = tab[a] + tab[b];\
-    tmp1 = tab[a] - tab[b];\
-    tab[a] = tmp0;\
-    tab[b] = MULH(tmp1<<(s), c);\
-}
-
-#define BF1(a, b, c, d)\
-{\
-    BF(a, b, COS4_0, 1);\
-    BF(c, d,-COS4_0, 1);\
-    tab[c] += tab[d];\
-}
-
-#define BF2(a, b, c, d)\
-{\
-    BF(a, b, COS4_0, 1);\
-    BF(c, d,-COS4_0, 1);\
-    tab[c] += tab[d];\
-    tab[a] += tab[c];\
-    tab[c] += tab[b];\
-    tab[b] += tab[d];\
-}
-
-#define ADD(a, b) tab[a] += tab[b]
-
-/* DCT32 without 1/sqrt(2) coef zero scaling. */
-static void dct32(int32_t *out, int32_t *tab)
-{
-    int tmp0, tmp1;
-
-    /* pass 1 */
-    BF( 0, 31, COS0_0 , 1);
-    BF(15, 16, COS0_15, 5);
-    /* pass 2 */
-    BF( 0, 15, COS1_0 , 1);
-    BF(16, 31,-COS1_0 , 1);
-    /* pass 1 */
-    BF( 7, 24, COS0_7 , 1);
-    BF( 8, 23, COS0_8 , 1);
-    /* pass 2 */
-    BF( 7,  8, COS1_7 , 4);
-    BF(23, 24,-COS1_7 , 4);
-    /* pass 3 */
-    BF( 0,  7, COS2_0 , 1);
-    BF( 8, 15,-COS2_0 , 1);
-    BF(16, 23, COS2_0 , 1);
-    BF(24, 31,-COS2_0 , 1);
-    /* pass 1 */
-    BF( 3, 28, COS0_3 , 1);
-    BF(12, 19, COS0_12, 2);
-    /* pass 2 */
-    BF( 3, 12, COS1_3 , 1);
-    BF(19, 28,-COS1_3 , 1);
-    /* pass 1 */
-    BF( 4, 27, COS0_4 , 1);
-    BF(11, 20, COS0_11, 2);
-    /* pass 2 */
-    BF( 4, 11, COS1_4 , 1);
-    BF(20, 27,-COS1_4 , 1);
-    /* pass 3 */
-    BF( 3,  4, COS2_3 , 3);
-    BF(11, 12,-COS2_3 , 3);
-    BF(19, 20, COS2_3 , 3);
-    BF(27, 28,-COS2_3 , 3);
-    /* pass 4 */
-    BF( 0,  3, COS3_0 , 1);
-    BF( 4,  7,-COS3_0 , 1);
-    BF( 8, 11, COS3_0 , 1);
-    BF(12, 15,-COS3_0 , 1);
-    BF(16, 19, COS3_0 , 1);
-    BF(20, 23,-COS3_0 , 1);
-    BF(24, 27, COS3_0 , 1);
-    BF(28, 31,-COS3_0 , 1);
-
-
-
-    /* pass 1 */
-    BF( 1, 30, COS0_1 , 1);
-    BF(14, 17, COS0_14, 3);
-    /* pass 2 */
-    BF( 1, 14, COS1_1 , 1);
-    BF(17, 30,-COS1_1 , 1);
-    /* pass 1 */
-    BF( 6, 25, COS0_6 , 1);
-    BF( 9, 22, COS0_9 , 1);
-    /* pass 2 */
-    BF( 6,  9, COS1_6 , 2);
-    BF(22, 25,-COS1_6 , 2);
-    /* pass 3 */
-    BF( 1,  6, COS2_1 , 1);
-    BF( 9, 14,-COS2_1 , 1);
-    BF(17, 22, COS2_1 , 1);
-    BF(25, 30,-COS2_1 , 1);
-
-    /* pass 1 */
-    BF( 2, 29, COS0_2 , 1);
-    BF(13, 18, COS0_13, 3);
-    /* pass 2 */
-    BF( 2, 13, COS1_2 , 1);
-    BF(18, 29,-COS1_2 , 1);
-    /* pass 1 */
-    BF( 5, 26, COS0_5 , 1);
-    BF(10, 21, COS0_10, 1);
-    /* pass 2 */
-    BF( 5, 10, COS1_5 , 2);
-    BF(21, 26,-COS1_5 , 2);
-    /* pass 3 */
-    BF( 2,  5, COS2_2 , 1);
-    BF(10, 13,-COS2_2 , 1);
-    BF(18, 21, COS2_2 , 1);
-    BF(26, 29,-COS2_2 , 1);
-    /* pass 4 */
-    BF( 1,  2, COS3_1 , 2);
-    BF( 5,  6,-COS3_1 , 2);
-    BF( 9, 10, COS3_1 , 2);
-    BF(13, 14,-COS3_1 , 2);
-    BF(17, 18, COS3_1 , 2);
-    BF(21, 22,-COS3_1 , 2);
-    BF(25, 26, COS3_1 , 2);
-    BF(29, 30,-COS3_1 , 2);
-
-    /* pass 5 */
-    BF1( 0,  1,  2,  3);
-    BF2( 4,  5,  6,  7);
-    BF1( 8,  9, 10, 11);
-    BF2(12, 13, 14, 15);
-    BF1(16, 17, 18, 19);
-    BF2(20, 21, 22, 23);
-    BF1(24, 25, 26, 27);
-    BF2(28, 29, 30, 31);
-
-    /* pass 6 */
-
-    ADD( 8, 12);
-    ADD(12, 10);
-    ADD(10, 14);
-    ADD(14,  9);
-    ADD( 9, 13);
-    ADD(13, 11);
-    ADD(11, 15);
-
-    out[ 0] = tab[0];
-    out[16] = tab[1];
-    out[ 8] = tab[2];
-    out[24] = tab[3];
-    out[ 4] = tab[4];
-    out[20] = tab[5];
-    out[12] = tab[6];
-    out[28] = tab[7];
-    out[ 2] = tab[8];
-    out[18] = tab[9];
-    out[10] = tab[10];
-    out[26] = tab[11];
-    out[ 6] = tab[12];
-    out[22] = tab[13];
-    out[14] = tab[14];
-    out[30] = tab[15];
-
-    ADD(24, 28);
-    ADD(28, 26);
-    ADD(26, 30);
-    ADD(30, 25);
-    ADD(25, 29);
-    ADD(29, 27);
-    ADD(27, 31);
-
-    out[ 1] = tab[16] + tab[24];
-    out[17] = tab[17] + tab[25];
-    out[ 9] = tab[18] + tab[26];
-    out[25] = tab[19] + tab[27];
-    out[ 5] = tab[20] + tab[28];
-    out[21] = tab[21] + tab[29];
-    out[13] = tab[22] + tab[30];
-    out[29] = tab[23] + tab[31];
-    out[ 3] = tab[24] + tab[20];
-    out[19] = tab[25] + tab[21];
-    out[11] = tab[26] + tab[22];
-    out[27] = tab[27] + tab[23];
-    out[ 7] = tab[28] + tab[18];
-    out[23] = tab[29] + tab[19];
-    out[15] = tab[30] + tab[17];
-    out[31] = tab[31];
-}
-
-#if FRAC_BITS <= 15
-
-static inline int round_sample(int *sum)
-{
-    int sum1;
-    sum1 = (*sum) >> OUT_SHIFT;
-    *sum &= (1<<OUT_SHIFT)-1;
-    return av_clip(sum1, OUT_MIN, OUT_MAX);
-}
-
-/* signed 16x16 -> 32 multiply add accumulate */
-#define MACS(rt, ra, rb) MAC16(rt, ra, rb)
-
-/* signed 16x16 -> 32 multiply */
-#define MULS(ra, rb) MUL16(ra, rb)
-
-#define MLSS(rt, ra, rb) MLS16(rt, ra, rb)
-
-#else
-
-static inline int round_sample(int64_t *sum)
-{
-    int sum1;
-    sum1 = (int)((*sum) >> OUT_SHIFT);
-    *sum &= (1<<OUT_SHIFT)-1;
-    return av_clip(sum1, OUT_MIN, OUT_MAX);
-}
-
-#   define MULS(ra, rb) MUL64(ra, rb)
-#   define MACS(rt, ra, rb) MAC64(rt, ra, rb)
-#   define MLSS(rt, ra, rb) MLS64(rt, ra, rb)
-#endif
-
-#define SUM8(op, sum, w, p)               \
-{                                         \
-    op(sum, (w)[0 * 64], (p)[0 * 64]);    \
-    op(sum, (w)[1 * 64], (p)[1 * 64]);    \
-    op(sum, (w)[2 * 64], (p)[2 * 64]);    \
-    op(sum, (w)[3 * 64], (p)[3 * 64]);    \
-    op(sum, (w)[4 * 64], (p)[4 * 64]);    \
-    op(sum, (w)[5 * 64], (p)[5 * 64]);    \
-    op(sum, (w)[6 * 64], (p)[6 * 64]);    \
-    op(sum, (w)[7 * 64], (p)[7 * 64]);    \
-}
-
-#define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \
-{                                               \
-    int tmp;\
-    tmp = p[0 * 64];\
-    op1(sum1, (w1)[0 * 64], tmp);\
-    op2(sum2, (w2)[0 * 64], tmp);\
-    tmp = p[1 * 64];\
-    op1(sum1, (w1)[1 * 64], tmp);\
-    op2(sum2, (w2)[1 * 64], tmp);\
-    tmp = p[2 * 64];\
-    op1(sum1, (w1)[2 * 64], tmp);\
-    op2(sum2, (w2)[2 * 64], tmp);\
-    tmp = p[3 * 64];\
-    op1(sum1, (w1)[3 * 64], tmp);\
-    op2(sum2, (w2)[3 * 64], tmp);\
-    tmp = p[4 * 64];\
-    op1(sum1, (w1)[4 * 64], tmp);\
-    op2(sum2, (w2)[4 * 64], tmp);\
-    tmp = p[5 * 64];\
-    op1(sum1, (w1)[5 * 64], tmp);\
-    op2(sum2, (w2)[5 * 64], tmp);\
-    tmp = p[6 * 64];\
-    op1(sum1, (w1)[6 * 64], tmp);\
-    op2(sum2, (w2)[6 * 64], tmp);\
-    tmp = p[7 * 64];\
-    op1(sum1, (w1)[7 * 64], tmp);\
-    op2(sum2, (w2)[7 * 64], tmp);\
-}
-
-void av_cold ff_mpa_synth_init(MPA_INT *window)
-{
-    int i;
-
-    /* max = 18760, max sum over all 16 coefs : 44736 */
-    for(i=0;i<257;i++) {
-        int v;
-        v = ff_mpa_enwindow[i];
-#if WFRAC_BITS < 16
-        v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
-#endif
-        window[i] = v;
-        if ((i & 63) != 0)
-            v = -v;
-        if (i != 0)
-            window[512 - i] = v;
-    }
-}
-
-/* 32 sub band synthesis filter. Input: 32 sub band samples, Output:
-   32 samples. */
-/* XXX: optimize by avoiding ring buffer usage */
-void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
-                         MPA_INT *window, int *dither_state,
-                         OUT_INT *samples, int incr,
-                         int32_t sb_samples[SBLIMIT])
-{
-    register MPA_INT *synth_buf;
-    register const MPA_INT *w, *w2, *p;
-    int j, offset;
-    OUT_INT *samples2;
-#if FRAC_BITS <= 15
-    int32_t tmp[32];
-    int sum, sum2;
-#else
-    int64_t sum, sum2;
-#endif
-
-    offset = *synth_buf_offset;
-    synth_buf = synth_buf_ptr + offset;
-
-#if FRAC_BITS <= 15
-    dct32(tmp, sb_samples);
-    for(j=0;j<32;j++) {
-        /* NOTE: can cause a loss in precision if very high amplitude
-           sound */
-        synth_buf[j] = av_clip_int16(tmp[j]);
-    }
-#else
-    dct32(synth_buf, sb_samples);
-#endif
-
-    /* copy to avoid wrap */
-    memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT));
-
-    samples2 = samples + 31 * incr;
-    w = window;
-    w2 = window + 31;
-
-    sum = *dither_state;
-    p = synth_buf + 16;
-    SUM8(MACS, sum, w, p);
-    p = synth_buf + 48;
-    SUM8(MLSS, sum, w + 32, p);
-    *samples = round_sample(&sum);
-    samples += incr;
-    w++;
-
-    /* we calculate two samples at the same time to avoid one memory
-       access per two sample */
-    for(j=1;j<16;j++) {
-        sum2 = 0;
-        p = synth_buf + 16 + j;
-        SUM8P2(sum, MACS, sum2, MLSS, w, w2, p);
-        p = synth_buf + 48 - j;
-        SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p);
-
-        *samples = round_sample(&sum);
-        samples += incr;
-        sum += sum2;
-        *samples2 = round_sample(&sum);
-        samples2 -= incr;
-        w++;
-        w2--;
-    }
-
-    p = synth_buf + 32;
-    SUM8(MLSS, sum, w + 32, p);
-    *samples = round_sample(&sum);
-    *dither_state= sum;
-
-    offset = (offset - 32) & 511;
-    *synth_buf_offset = offset;
-}
-
-#define C3 FIXHR(0.86602540378443864676/2)
-
-/* 0.5 / cos(pi*(2*i+1)/36) */
-static const int icos36[9] = {
-    FIXR(0.50190991877167369479),
-    FIXR(0.51763809020504152469), //0
-    FIXR(0.55168895948124587824),
-    FIXR(0.61038729438072803416),
-    FIXR(0.70710678118654752439), //1
-    FIXR(0.87172339781054900991),
-    FIXR(1.18310079157624925896),
-    FIXR(1.93185165257813657349), //2
-    FIXR(5.73685662283492756461),
-};
-
-/* 0.5 / cos(pi*(2*i+1)/36) */
-static const int icos36h[9] = {
-    FIXHR(0.50190991877167369479/2),
-    FIXHR(0.51763809020504152469/2), //0
-    FIXHR(0.55168895948124587824/2),
-    FIXHR(0.61038729438072803416/2),
-    FIXHR(0.70710678118654752439/2), //1
-    FIXHR(0.87172339781054900991/2),
-    FIXHR(1.18310079157624925896/4),
-    FIXHR(1.93185165257813657349/4), //2
-//    FIXHR(5.73685662283492756461),
-};
-
-/* 12 points IMDCT. We compute it "by hand" by factorizing obvious
-   cases. */
-static void imdct12(int *out, int *in)
-{
-    int in0, in1, in2, in3, in4, in5, t1, t2;
-
-    in0= in[0*3];
-    in1= in[1*3] + in[0*3];
-    in2= in[2*3] + in[1*3];
-    in3= in[3*3] + in[2*3];
-    in4= in[4*3] + in[3*3];
-    in5= in[5*3] + in[4*3];
-    in5 += in3;
-    in3 += in1;
-
-    in2= MULH(2*in2, C3);
-    in3= MULH(4*in3, C3);
-
-    t1 = in0 - in4;
-    t2 = MULH(2*(in1 - in5), icos36h[4]);
-
-    out[ 7]=
-    out[10]= t1 + t2;
-    out[ 1]=
-    out[ 4]= t1 - t2;
-
-    in0 += in4>>1;
-    in4 = in0 + in2;
-    in5 += 2*in1;
-    in1 = MULH(in5 + in3, icos36h[1]);
-    out[ 8]=
-    out[ 9]= in4 + in1;
-    out[ 2]=
-    out[ 3]= in4 - in1;
-
-    in0 -= in2;
-    in5 = MULH(2*(in5 - in3), icos36h[7]);
-    out[ 0]=
-    out[ 5]= in0 - in5;
-    out[ 6]=
-    out[11]= in0 + in5;
-}
-
-/* cos(pi*i/18) */
-#define C1 FIXHR(0.98480775301220805936/2)
-#define C2 FIXHR(0.93969262078590838405/2)
-#define C3 FIXHR(0.86602540378443864676/2)
-#define C4 FIXHR(0.76604444311897803520/2)
-#define C5 FIXHR(0.64278760968653932632/2)
-#define C6 FIXHR(0.5/2)
-#define C7 FIXHR(0.34202014332566873304/2)
-#define C8 FIXHR(0.17364817766693034885/2)
-
-
-/* using Lee like decomposition followed by hand coded 9 points DCT */
-static void imdct36(int *out, int *buf, int *in, int *win)
-{
-    int i, j, t0, t1, t2, t3, s0, s1, s2, s3;
-    int tmp[18], *tmp1, *in1;
-
-    for(i=17;i>=1;i--)
-        in[i] += in[i-1];
-    for(i=17;i>=3;i-=2)
-        in[i] += in[i-2];
-
-    for(j=0;j<2;j++) {
-        tmp1 = tmp + j;
-        in1 = in + j;
-#if 0
-//more accurate but slower
-        int64_t t0, t1, t2, t3;
-        t2 = in1[2*4] + in1[2*8] - in1[2*2];
-
-        t3 = (in1[2*0] + (int64_t)(in1[2*6]>>1))<<32;
-        t1 = in1[2*0] - in1[2*6];
-        tmp1[ 6] = t1 - (t2>>1);
-        tmp1[16] = t1 + t2;
-
-        t0 = MUL64(2*(in1[2*2] + in1[2*4]),    C2);
-        t1 = MUL64(   in1[2*4] - in1[2*8] , -2*C8);
-        t2 = MUL64(2*(in1[2*2] + in1[2*8]),   -C4);
-
-        tmp1[10] = (t3 - t0 - t2) >> 32;
-        tmp1[ 2] = (t3 + t0 + t1) >> 32;
-        tmp1[14] = (t3 + t2 - t1) >> 32;
-
-        tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3);
-        t2 = MUL64(2*(in1[2*1] + in1[2*5]),    C1);
-        t3 = MUL64(   in1[2*5] - in1[2*7] , -2*C7);
-        t0 = MUL64(2*in1[2*3], C3);
-
-        t1 = MUL64(2*(in1[2*1] + in1[2*7]),   -C5);
-
-        tmp1[ 0] = (t2 + t3 + t0) >> 32;
-        tmp1[12] = (t2 + t1 - t0) >> 32;
-        tmp1[ 8] = (t3 - t1 - t0) >> 32;
-#else
-        t2 = in1[2*4] + in1[2*8] - in1[2*2];
-
-        t3 = in1[2*0] + (in1[2*6]>>1);
-        t1 = in1[2*0] - in1[2*6];
-        tmp1[ 6] = t1 - (t2>>1);
-        tmp1[16] = t1 + t2;
-
-        t0 = MULH(2*(in1[2*2] + in1[2*4]),    C2);
-        t1 = MULH(   in1[2*4] - in1[2*8] , -2*C8);
-        t2 = MULH(2*(in1[2*2] + in1[2*8]),   -C4);
-
-        tmp1[10] = t3 - t0 - t2;
-        tmp1[ 2] = t3 + t0 + t1;
-        tmp1[14] = t3 + t2 - t1;
-
-        tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3);
-        t2 = MULH(2*(in1[2*1] + in1[2*5]),    C1);
-        t3 = MULH(   in1[2*5] - in1[2*7] , -2*C7);
-        t0 = MULH(2*in1[2*3], C3);
-
-        t1 = MULH(2*(in1[2*1] + in1[2*7]),   -C5);
-
-        tmp1[ 0] = t2 + t3 + t0;
-        tmp1[12] = t2 + t1 - t0;
-        tmp1[ 8] = t3 - t1 - t0;
-#endif
-    }
-
-    i = 0;
-    for(j=0;j<4;j++) {
-        t0 = tmp[i];
-        t1 = tmp[i + 2];
-        s0 = t1 + t0;
-        s2 = t1 - t0;
-
-        t2 = tmp[i + 1];
-        t3 = tmp[i + 3];
-        s1 = MULH(2*(t3 + t2), icos36h[j]);
-        s3 = MULL(t3 - t2, icos36[8 - j], FRAC_BITS);
-
-        t0 = s0 + s1;
-        t1 = s0 - s1;
-        out[(9 + j)*SBLIMIT] =  MULH(t1, win[9 + j]) + buf[9 + j];
-        out[(8 - j)*SBLIMIT] =  MULH(t1, win[8 - j]) + buf[8 - j];
-        buf[9 + j] = MULH(t0, win[18 + 9 + j]);
-        buf[8 - j] = MULH(t0, win[18 + 8 - j]);
-
-        t0 = s2 + s3;
-        t1 = s2 - s3;
-        out[(9 + 8 - j)*SBLIMIT] =  MULH(t1, win[9 + 8 - j]) + buf[9 + 8 - j];
-        out[(        j)*SBLIMIT] =  MULH(t1, win[        j]) + buf[        j];
-        buf[9 + 8 - j] = MULH(t0, win[18 + 9 + 8 - j]);
-        buf[      + j] = MULH(t0, win[18         + j]);
-        i += 4;
-    }
-
-    s0 = tmp[16];
-    s1 = MULH(2*tmp[17], icos36h[4]);
-    t0 = s0 + s1;
-    t1 = s0 - s1;
-    out[(9 + 4)*SBLIMIT] =  MULH(t1, win[9 + 4]) + buf[9 + 4];
-    out[(8 - 4)*SBLIMIT] =  MULH(t1, win[8 - 4]) + buf[8 - 4];
-    buf[9 + 4] = MULH(t0, win[18 + 9 + 4]);
-    buf[8 - 4] = MULH(t0, win[18 + 8 - 4]);
-}
-
-/* return the number of decoded frames */
-static int mp_decode_layer1(MPADecodeContext *s)
-{
-    int bound, i, v, n, ch, j, mant;
-    uint8_t allocation[MPA_MAX_CHANNELS][SBLIMIT];
-    uint8_t scale_factors[MPA_MAX_CHANNELS][SBLIMIT];
-
-    if (s->mode == MPA_JSTEREO)
-        bound = (s->mode_ext + 1) * 4;
-    else
-        bound = SBLIMIT;
-
-    /* allocation bits */
-    for(i=0;i<bound;i++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            allocation[ch][i] = get_bits(&s->gb, 4);
-        }
-    }
-    for(i=bound;i<SBLIMIT;i++) {
-        allocation[0][i] = get_bits(&s->gb, 4);
-    }
-
-    /* scale factors */
-    for(i=0;i<bound;i++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            if (allocation[ch][i])
-                scale_factors[ch][i] = get_bits(&s->gb, 6);
-        }
-    }
-    for(i=bound;i<SBLIMIT;i++) {
-        if (allocation[0][i]) {
-            scale_factors[0][i] = get_bits(&s->gb, 6);
-            scale_factors[1][i] = get_bits(&s->gb, 6);
-        }
-    }
-
-    /* compute samples */
-    for(j=0;j<12;j++) {
-        for(i=0;i<bound;i++) {
-            for(ch=0;ch<s->nb_channels;ch++) {
-                n = allocation[ch][i];
-                if (n) {
-                    mant = get_bits(&s->gb, n + 1);
-                    v = l1_unscale(n, mant, scale_factors[ch][i]);
-                } else {
-                    v = 0;
-                }
-                s->sb_samples[ch][j][i] = v;
-            }
-        }
-        for(i=bound;i<SBLIMIT;i++) {
-            n = allocation[0][i];
-            if (n) {
-                mant = get_bits(&s->gb, n + 1);
-                v = l1_unscale(n, mant, scale_factors[0][i]);
-                s->sb_samples[0][j][i] = v;
-                v = l1_unscale(n, mant, scale_factors[1][i]);
-                s->sb_samples[1][j][i] = v;
-            } else {
-                s->sb_samples[0][j][i] = 0;
-                s->sb_samples[1][j][i] = 0;
-            }
-        }
-    }
-    return 12;
-}
-
-static int mp_decode_layer2(MPADecodeContext *s)
-{
-    int sblimit; /* number of used subbands */
-    const unsigned char *alloc_table;
-    int table, bit_alloc_bits, i, j, ch, bound, v;
-    unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT];
-    unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT];
-    unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3], *sf;
-    int scale, qindex, bits, steps, k, l, m, b;
-
-    /* select decoding table */
-    table = ff_mpa_l2_select_table(s->bit_rate / 1000, s->nb_channels,
-                            s->sample_rate, s->lsf);
-    sblimit = ff_mpa_sblimit_table[table];
-    alloc_table = ff_mpa_alloc_tables[table];
-
-    if (s->mode == MPA_JSTEREO)
-        bound = (s->mode_ext + 1) * 4;
-    else
-        bound = sblimit;
-
-    dprintf(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit);
-
-    /* sanity check */
-    if( bound > sblimit ) bound = sblimit;
-
-    /* parse bit allocation */
-    j = 0;
-    for(i=0;i<bound;i++) {
-        bit_alloc_bits = alloc_table[j];
-        for(ch=0;ch<s->nb_channels;ch++) {
-            bit_alloc[ch][i] = get_bits(&s->gb, bit_alloc_bits);
-        }
-        j += 1 << bit_alloc_bits;
-    }
-    for(i=bound;i<sblimit;i++) {
-        bit_alloc_bits = alloc_table[j];
-        v = get_bits(&s->gb, bit_alloc_bits);
-        bit_alloc[0][i] = v;
-        bit_alloc[1][i] = v;
-        j += 1 << bit_alloc_bits;
-    }
-
-    /* scale codes */
-    for(i=0;i<sblimit;i++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            if (bit_alloc[ch][i])
-                scale_code[ch][i] = get_bits(&s->gb, 2);
-        }
-    }
-
-    /* scale factors */
-    for(i=0;i<sblimit;i++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            if (bit_alloc[ch][i]) {
-                sf = scale_factors[ch][i];
-                switch(scale_code[ch][i]) {
-                default:
-                case 0:
-                    sf[0] = get_bits(&s->gb, 6);
-                    sf[1] = get_bits(&s->gb, 6);
-                    sf[2] = get_bits(&s->gb, 6);
-                    break;
-                case 2:
-                    sf[0] = get_bits(&s->gb, 6);
-                    sf[1] = sf[0];
-                    sf[2] = sf[0];
-                    break;
-                case 1:
-                    sf[0] = get_bits(&s->gb, 6);
-                    sf[2] = get_bits(&s->gb, 6);
-                    sf[1] = sf[0];
-                    break;
-                case 3:
-                    sf[0] = get_bits(&s->gb, 6);
-                    sf[2] = get_bits(&s->gb, 6);
-                    sf[1] = sf[2];
-                    break;
-                }
-            }
-        }
-    }
-
-    /* samples */
-    for(k=0;k<3;k++) {
-        for(l=0;l<12;l+=3) {
-            j = 0;
-            for(i=0;i<bound;i++) {
-                bit_alloc_bits = alloc_table[j];
-                for(ch=0;ch<s->nb_channels;ch++) {
-                    b = bit_alloc[ch][i];
-                    if (b) {
-                        scale = scale_factors[ch][i][k];
-                        qindex = alloc_table[j+b];
-                        bits = ff_mpa_quant_bits[qindex];
-                        if (bits < 0) {
-                            /* 3 values at the same time */
-                            v = get_bits(&s->gb, -bits);
-                            steps = ff_mpa_quant_steps[qindex];
-                            s->sb_samples[ch][k * 12 + l + 0][i] =
-                                l2_unscale_group(steps, v % steps, scale);
-                            v = v / steps;
-                            s->sb_samples[ch][k * 12 + l + 1][i] =
-                                l2_unscale_group(steps, v % steps, scale);
-                            v = v / steps;
-                            s->sb_samples[ch][k * 12 + l + 2][i] =
-                                l2_unscale_group(steps, v, scale);
-                        } else {
-                            for(m=0;m<3;m++) {
-                                v = get_bits(&s->gb, bits);
-                                v = l1_unscale(bits - 1, v, scale);
-                                s->sb_samples[ch][k * 12 + l + m][i] = v;
-                            }
-                        }
-                    } else {
-                        s->sb_samples[ch][k * 12 + l + 0][i] = 0;
-                        s->sb_samples[ch][k * 12 + l + 1][i] = 0;
-                        s->sb_samples[ch][k * 12 + l + 2][i] = 0;
-                    }
-                }
-                /* next subband in alloc table */
-                j += 1 << bit_alloc_bits;
-            }
-            /* XXX: find a way to avoid this duplication of code */
-            for(i=bound;i<sblimit;i++) {
-                bit_alloc_bits = alloc_table[j];
-                b = bit_alloc[0][i];
-                if (b) {
-                    int mant, scale0, scale1;
-                    scale0 = scale_factors[0][i][k];
-                    scale1 = scale_factors[1][i][k];
-                    qindex = alloc_table[j+b];
-                    bits = ff_mpa_quant_bits[qindex];
-                    if (bits < 0) {
-                        /* 3 values at the same time */
-                        v = get_bits(&s->gb, -bits);
-                        steps = ff_mpa_quant_steps[qindex];
-                        mant = v % steps;
-                        v = v / steps;
-                        s->sb_samples[0][k * 12 + l + 0][i] =
-                            l2_unscale_group(steps, mant, scale0);
-                        s->sb_samples[1][k * 12 + l + 0][i] =
-                            l2_unscale_group(steps, mant, scale1);
-                        mant = v % steps;
-                        v = v / steps;
-                        s->sb_samples[0][k * 12 + l + 1][i] =
-                            l2_unscale_group(steps, mant, scale0);
-                        s->sb_samples[1][k * 12 + l + 1][i] =
-                            l2_unscale_group(steps, mant, scale1);
-                        s->sb_samples[0][k * 12 + l + 2][i] =
-                            l2_unscale_group(steps, v, scale0);
-                        s->sb_samples[1][k * 12 + l + 2][i] =
-                            l2_unscale_group(steps, v, scale1);
-                    } else {
-                        for(m=0;m<3;m++) {
-                            mant = get_bits(&s->gb, bits);
-                            s->sb_samples[0][k * 12 + l + m][i] =
-                                l1_unscale(bits - 1, mant, scale0);
-                            s->sb_samples[1][k * 12 + l + m][i] =
-                                l1_unscale(bits - 1, mant, scale1);
-                        }
-                    }
-                } else {
-                    s->sb_samples[0][k * 12 + l + 0][i] = 0;
-                    s->sb_samples[0][k * 12 + l + 1][i] = 0;
-                    s->sb_samples[0][k * 12 + l + 2][i] = 0;
-                    s->sb_samples[1][k * 12 + l + 0][i] = 0;
-                    s->sb_samples[1][k * 12 + l + 1][i] = 0;
-                    s->sb_samples[1][k * 12 + l + 2][i] = 0;
-                }
-                /* next subband in alloc table */
-                j += 1 << bit_alloc_bits;
-            }
-            /* fill remaining samples to zero */
-            for(i=sblimit;i<SBLIMIT;i++) {
-                for(ch=0;ch<s->nb_channels;ch++) {
-                    s->sb_samples[ch][k * 12 + l + 0][i] = 0;
-                    s->sb_samples[ch][k * 12 + l + 1][i] = 0;
-                    s->sb_samples[ch][k * 12 + l + 2][i] = 0;
-                }
-            }
-        }
-    }
-    return 3 * 12;
-}
-
-#define SPLIT(dst,sf,n)\
-    if(n==3){\
-        int m= (sf*171)>>9;\
-        dst= sf - 3*m;\
-        sf=m;\
-    }else if(n==4){\
-        dst= sf&3;\
-        sf>>=2;\
-    }else if(n==5){\
-        int m= (sf*205)>>10;\
-        dst= sf - 5*m;\
-        sf=m;\
-    }else if(n==6){\
-        int m= (sf*171)>>10;\
-        dst= sf - 6*m;\
-        sf=m;\
-    }else{\
-        dst=0;\
-    }
-
-static av_always_inline void lsf_sf_expand(int *slen,
-                                 int sf, int n1, int n2, int n3)
-{
-    SPLIT(slen[3], sf, n3)
-    SPLIT(slen[2], sf, n2)
-    SPLIT(slen[1], sf, n1)
-    slen[0] = sf;
-}
-
-static void exponents_from_scale_factors(MPADecodeContext *s,
-                                         GranuleDef *g,
-                                         int16_t *exponents)
-{
-    const uint8_t *bstab, *pretab;
-    int len, i, j, k, l, v0, shift, gain, gains[3];
-    int16_t *exp_ptr;
-
-    exp_ptr = exponents;
-    gain = g->global_gain - 210;
-    shift = g->scalefac_scale + 1;
-
-    bstab = band_size_long[s->sample_rate_index];
-    pretab = mpa_pretab[g->preflag];
-    for(i=0;i<g->long_end;i++) {
-        v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400;
-        len = bstab[i];
-        for(j=len;j>0;j--)
-            *exp_ptr++ = v0;
-    }
-
-    if (g->short_start < 13) {
-        bstab = band_size_short[s->sample_rate_index];
-        gains[0] = gain - (g->subblock_gain[0] << 3);
-        gains[1] = gain - (g->subblock_gain[1] << 3);
-        gains[2] = gain - (g->subblock_gain[2] << 3);
-        k = g->long_end;
-        for(i=g->short_start;i<13;i++) {
-            len = bstab[i];
-            for(l=0;l<3;l++) {
-                v0 = gains[l] - (g->scale_factors[k++] << shift) + 400;
-                for(j=len;j>0;j--)
-                *exp_ptr++ = v0;
-            }
-        }
-    }
-}
-
-/* handle n = 0 too */
-static inline int get_bitsz(GetBitContext *s, int n)
-{
-    if (n == 0)
-        return 0;
-    else
-        return get_bits(s, n);
-}
-
-
-static void switch_buffer(MPADecodeContext *s, int *pos, int *end_pos, int *end_pos2){
-    if(s->in_gb.buffer && *pos >= s->gb.size_in_bits){
-        s->gb= s->in_gb;
-        s->in_gb.buffer=NULL;
-        assert((get_bits_count(&s->gb) & 7) == 0);
-        skip_bits_long(&s->gb, *pos - *end_pos);
-        *end_pos2=
-        *end_pos= *end_pos2 + get_bits_count(&s->gb) - *pos;
-        *pos= get_bits_count(&s->gb);
-    }
-}
-
-static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
-                          int16_t *exponents, int end_pos2)
-{
-    int s_index;
-    int i;
-    int last_pos, bits_left;
-    VLC *vlc;
-    int end_pos= FFMIN(end_pos2, s->gb.size_in_bits);
-
-    /* low frequencies (called big values) */
-    s_index = 0;
-    for(i=0;i<3;i++) {
-        int j, k, l, linbits;
-        j = g->region_size[i];
-        if (j == 0)
-            continue;
-        /* select vlc table */
-        k = g->table_select[i];
-        l = mpa_huff_data[k][0];
-        linbits = mpa_huff_data[k][1];
-        vlc = &huff_vlc[l];
-
-        if(!l){
-            memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*2*j);
-            s_index += 2*j;
-            continue;
-        }
-
-        /* read huffcode and compute each couple */
-        for(;j>0;j--) {
-            int exponent, x, y, v;
-            int pos= get_bits_count(&s->gb);
-
-            if (pos >= end_pos){
-//                av_log(NULL, AV_LOG_ERROR, "pos: %d %d %d %d\n", pos, end_pos, end_pos2, s_index);
-                switch_buffer(s, &pos, &end_pos, &end_pos2);
-//                av_log(NULL, AV_LOG_ERROR, "new pos: %d %d\n", pos, end_pos);
-                if(pos >= end_pos)
-                    break;
-            }
-            y = get_vlc2(&s->gb, vlc->table, 7, 3);
-
-            if(!y){
-                g->sb_hybrid[s_index  ] =
-                g->sb_hybrid[s_index+1] = 0;
-                s_index += 2;
-                continue;
-            }
-
-            exponent= exponents[s_index];
-
-            dprintf(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n",
-                    i, g->region_size[i] - j, x, y, exponent);
-            if(y&16){
-                x = y >> 5;
-                y = y & 0x0f;
-                if (x < 15){
-                    v = expval_table[ exponent ][ x ];
-//                      v = expval_table[ (exponent&3) ][ x ] >> FFMIN(0 - (exponent>>2), 31);
-                }else{
-                    x += get_bitsz(&s->gb, linbits);
-                    v = l3_unscale(x, exponent);
-                }
-                if (get_bits1(&s->gb))
-                    v = -v;
-                g->sb_hybrid[s_index] = v;
-                if (y < 15){
-                    v = expval_table[ exponent ][ y ];
-                }else{
-                    y += get_bitsz(&s->gb, linbits);
-                    v = l3_unscale(y, exponent);
-                }
-                if (get_bits1(&s->gb))
-                    v = -v;
-                g->sb_hybrid[s_index+1] = v;
-            }else{
-                x = y >> 5;
-                y = y & 0x0f;
-                x += y;
-                if (x < 15){
-                    v = expval_table[ exponent ][ x ];
-                }else{
-                    x += get_bitsz(&s->gb, linbits);
-                    v = l3_unscale(x, exponent);
-                }
-                if (get_bits1(&s->gb))
-                    v = -v;
-                g->sb_hybrid[s_index+!!y] = v;
-                g->sb_hybrid[s_index+ !y] = 0;
-            }
-            s_index+=2;
-        }
-    }
-
-    /* high frequencies */
-    vlc = &huff_quad_vlc[g->count1table_select];
-    last_pos=0;
-    while (s_index <= 572) {
-        int pos, code;
-        pos = get_bits_count(&s->gb);
-        if (pos >= end_pos) {
-            if (pos > end_pos2 && last_pos){
-                /* some encoders generate an incorrect size for this
-                   part. We must go back into the data */
-                s_index -= 4;
-                skip_bits_long(&s->gb, last_pos - pos);
-                av_log(s->avctx, AV_LOG_INFO, "overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos);
-                if(s->error_recognition >= FF_ER_COMPLIANT)
-                    s_index=0;
-                break;
-            }
-//                av_log(NULL, AV_LOG_ERROR, "pos2: %d %d %d %d\n", pos, end_pos, end_pos2, s_index);
-            switch_buffer(s, &pos, &end_pos, &end_pos2);
-//                av_log(NULL, AV_LOG_ERROR, "new pos2: %d %d %d\n", pos, end_pos, s_index);
-            if(pos >= end_pos)
-                break;
-        }
-        last_pos= pos;
-
-        code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1);
-        dprintf(s->avctx, "t=%d code=%d\n", g->count1table_select, code);
-        g->sb_hybrid[s_index+0]=
-        g->sb_hybrid[s_index+1]=
-        g->sb_hybrid[s_index+2]=
-        g->sb_hybrid[s_index+3]= 0;
-        while(code){
-            static const int idxtab[16]={3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};
-            int v;
-            int pos= s_index+idxtab[code];
-            code ^= 8>>idxtab[code];
-            v = exp_table[ exponents[pos] ];
-//            v = exp_table[ (exponents[pos]&3) ] >> FFMIN(0 - (exponents[pos]>>2), 31);
-            if(get_bits1(&s->gb))
-                v = -v;
-            g->sb_hybrid[pos] = v;
-        }
-        s_index+=4;
-    }
-    /* skip extension bits */
-    bits_left = end_pos2 - get_bits_count(&s->gb);
-//av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
-    if (bits_left < 0 && s->error_recognition >= FF_ER_COMPLIANT) {
-        av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
-        s_index=0;
-    }else if(bits_left > 0 && s->error_recognition >= FF_ER_AGGRESSIVE){
-        av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
-        s_index=0;
-    }
-    memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid)*(576 - s_index));
-    skip_bits_long(&s->gb, bits_left);
-
-    i= get_bits_count(&s->gb);
-    switch_buffer(s, &i, &end_pos, &end_pos2);
-
-    return 0;
-}
-
-/* Reorder short blocks from bitstream order to interleaved order. It
-   would be faster to do it in parsing, but the code would be far more
-   complicated */
-static void reorder_block(MPADecodeContext *s, GranuleDef *g)
-{
-    int i, j, len;
-    int32_t *ptr, *dst, *ptr1;
-    int32_t tmp[576];
-
-    if (g->block_type != 2)
-        return;
-
-    if (g->switch_point) {
-        if (s->sample_rate_index != 8) {
-            ptr = g->sb_hybrid + 36;
-        } else {
-            ptr = g->sb_hybrid + 48;
-        }
-    } else {
-        ptr = g->sb_hybrid;
-    }
-
-    for(i=g->short_start;i<13;i++) {
-        len = band_size_short[s->sample_rate_index][i];
-        ptr1 = ptr;
-        dst = tmp;
-        for(j=len;j>0;j--) {
-            *dst++ = ptr[0*len];
-            *dst++ = ptr[1*len];
-            *dst++ = ptr[2*len];
-            ptr++;
-        }
-        ptr+=2*len;
-        memcpy(ptr1, tmp, len * 3 * sizeof(*ptr1));
-    }
-}
-
-#define ISQRT2 FIXR(0.70710678118654752440)
-
-static void compute_stereo(MPADecodeContext *s,
-                           GranuleDef *g0, GranuleDef *g1)
-{
-    int i, j, k, l;
-    int32_t v1, v2;
-    int sf_max, tmp0, tmp1, sf, len, non_zero_found;
-    int32_t (*is_tab)[16];
-    int32_t *tab0, *tab1;
-    int non_zero_found_short[3];
-
-    /* intensity stereo */
-    if (s->mode_ext & MODE_EXT_I_STEREO) {
-        if (!s->lsf) {
-            is_tab = is_table;
-            sf_max = 7;
-        } else {
-            is_tab = is_table_lsf[g1->scalefac_compress & 1];
-            sf_max = 16;
-        }
-
-        tab0 = g0->sb_hybrid + 576;
-        tab1 = g1->sb_hybrid + 576;
-
-        non_zero_found_short[0] = 0;
-        non_zero_found_short[1] = 0;
-        non_zero_found_short[2] = 0;
-        k = (13 - g1->short_start) * 3 + g1->long_end - 3;
-        for(i = 12;i >= g1->short_start;i--) {
-            /* for last band, use previous scale factor */
-            if (i != 11)
-                k -= 3;
-            len = band_size_short[s->sample_rate_index][i];
-            for(l=2;l>=0;l--) {
-                tab0 -= len;
-                tab1 -= len;
-                if (!non_zero_found_short[l]) {
-                    /* test if non zero band. if so, stop doing i-stereo */
-                    for(j=0;j<len;j++) {
-                        if (tab1[j] != 0) {
-                            non_zero_found_short[l] = 1;
-                            goto found1;
-                        }
-                    }
-                    sf = g1->scale_factors[k + l];
-                    if (sf >= sf_max)
-                        goto found1;
-
-                    v1 = is_tab[0][sf];
-                    v2 = is_tab[1][sf];
-                    for(j=0;j<len;j++) {
-                        tmp0 = tab0[j];
-                        tab0[j] = MULL(tmp0, v1, FRAC_BITS);
-                        tab1[j] = MULL(tmp0, v2, FRAC_BITS);
-                    }
-                } else {
-                found1:
-                    if (s->mode_ext & MODE_EXT_MS_STEREO) {
-                        /* lower part of the spectrum : do ms stereo
-                           if enabled */
-                        for(j=0;j<len;j++) {
-                            tmp0 = tab0[j];
-                            tmp1 = tab1[j];
-                            tab0[j] = MULL(tmp0 + tmp1, ISQRT2, FRAC_BITS);
-                            tab1[j] = MULL(tmp0 - tmp1, ISQRT2, FRAC_BITS);
-                        }
-                    }
-                }
-            }
-        }
-
-        non_zero_found = non_zero_found_short[0] |
-            non_zero_found_short[1] |
-            non_zero_found_short[2];
-
-        for(i = g1->long_end - 1;i >= 0;i--) {
-            len = band_size_long[s->sample_rate_index][i];
-            tab0 -= len;
-            tab1 -= len;
-            /* test if non zero band. if so, stop doing i-stereo */
-            if (!non_zero_found) {
-                for(j=0;j<len;j++) {
-                    if (tab1[j] != 0) {
-                        non_zero_found = 1;
-                        goto found2;
-                    }
-                }
-                /* for last band, use previous scale factor */
-                k = (i == 21) ? 20 : i;
-                sf = g1->scale_factors[k];
-                if (sf >= sf_max)
-                    goto found2;
-                v1 = is_tab[0][sf];
-                v2 = is_tab[1][sf];
-                for(j=0;j<len;j++) {
-                    tmp0 = tab0[j];
-                    tab0[j] = MULL(tmp0, v1, FRAC_BITS);
-                    tab1[j] = MULL(tmp0, v2, FRAC_BITS);
-                }
-            } else {
-            found2:
-                if (s->mode_ext & MODE_EXT_MS_STEREO) {
-                    /* lower part of the spectrum : do ms stereo
-                       if enabled */
-                    for(j=0;j<len;j++) {
-                        tmp0 = tab0[j];
-                        tmp1 = tab1[j];
-                        tab0[j] = MULL(tmp0 + tmp1, ISQRT2, FRAC_BITS);
-                        tab1[j] = MULL(tmp0 - tmp1, ISQRT2, FRAC_BITS);
-                    }
-                }
-            }
-        }
-    } else if (s->mode_ext & MODE_EXT_MS_STEREO) {
-        /* ms stereo ONLY */
-        /* NOTE: the 1/sqrt(2) normalization factor is included in the
-           global gain */
-        tab0 = g0->sb_hybrid;
-        tab1 = g1->sb_hybrid;
-        for(i=0;i<576;i++) {
-            tmp0 = tab0[i];
-            tmp1 = tab1[i];
-            tab0[i] = tmp0 + tmp1;
-            tab1[i] = tmp0 - tmp1;
-        }
-    }
-}
-
-static void compute_antialias_integer(MPADecodeContext *s,
-                              GranuleDef *g)
-{
-    int32_t *ptr, *csa;
-    int n, i;
-
-    /* we antialias only "long" bands */
-    if (g->block_type == 2) {
-        if (!g->switch_point)
-            return;
-        /* XXX: check this for 8000Hz case */
-        n = 1;
-    } else {
-        n = SBLIMIT - 1;
-    }
-
-    ptr = g->sb_hybrid + 18;
-    for(i = n;i > 0;i--) {
-        int tmp0, tmp1, tmp2;
-        csa = &csa_table[0][0];
-#define INT_AA(j) \
-            tmp0 = ptr[-1-j];\
-            tmp1 = ptr[   j];\
-            tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\
-            ptr[-1-j] = 4*(tmp2 - MULH(tmp1, csa[2+4*j]));\
-            ptr[   j] = 4*(tmp2 + MULH(tmp0, csa[3+4*j]));
-
-        INT_AA(0)
-        INT_AA(1)
-        INT_AA(2)
-        INT_AA(3)
-        INT_AA(4)
-        INT_AA(5)
-        INT_AA(6)
-        INT_AA(7)
-
-        ptr += 18;
-    }
-}
-
-static void compute_antialias_float(MPADecodeContext *s,
-                              GranuleDef *g)
-{
-    int32_t *ptr;
-    int n, i;
-
-    /* we antialias only "long" bands */
-    if (g->block_type == 2) {
-        if (!g->switch_point)
-            return;
-        /* XXX: check this for 8000Hz case */
-        n = 1;
-    } else {
-        n = SBLIMIT - 1;
-    }
-
-    ptr = g->sb_hybrid + 18;
-    for(i = n;i > 0;i--) {
-        float tmp0, tmp1;
-        float *csa = &csa_table_float[0][0];
-#define FLOAT_AA(j)\
-        tmp0= ptr[-1-j];\
-        tmp1= ptr[   j];\
-        ptr[-1-j] = lrintf(tmp0 * csa[0+4*j] - tmp1 * csa[1+4*j]);\
-        ptr[   j] = lrintf(tmp0 * csa[1+4*j] + tmp1 * csa[0+4*j]);
-
-        FLOAT_AA(0)
-        FLOAT_AA(1)
-        FLOAT_AA(2)
-        FLOAT_AA(3)
-        FLOAT_AA(4)
-        FLOAT_AA(5)
-        FLOAT_AA(6)
-        FLOAT_AA(7)
-
-        ptr += 18;
-    }
-}
-
-static void compute_imdct(MPADecodeContext *s,
-                          GranuleDef *g,
-                          int32_t *sb_samples,
-                          int32_t *mdct_buf)
-{
-    int32_t *ptr, *win, *win1, *buf, *out_ptr, *ptr1;
-    int32_t out2[12];
-    int i, j, mdct_long_end, v, sblimit;
-
-    /* find last non zero block */
-    ptr = g->sb_hybrid + 576;
-    ptr1 = g->sb_hybrid + 2 * 18;
-    while (ptr >= ptr1) {
-        ptr -= 6;
-        v = ptr[0] | ptr[1] | ptr[2] | ptr[3] | ptr[4] | ptr[5];
-        if (v != 0)
-            break;
-    }
-    sblimit = ((ptr - g->sb_hybrid) / 18) + 1;
-
-    if (g->block_type == 2) {
-        /* XXX: check for 8000 Hz */
-        if (g->switch_point)
-            mdct_long_end = 2;
-        else
-            mdct_long_end = 0;
-    } else {
-        mdct_long_end = sblimit;
-    }
-
-    buf = mdct_buf;
-    ptr = g->sb_hybrid;
-    for(j=0;j<mdct_long_end;j++) {
-        /* apply window & overlap with previous buffer */
-        out_ptr = sb_samples + j;
-        /* select window */
-        if (g->switch_point && j < 2)
-            win1 = mdct_win[0];
-        else
-            win1 = mdct_win[g->block_type];
-        /* select frequency inversion */
-        win = win1 + ((4 * 36) & -(j & 1));
-        imdct36(out_ptr, buf, ptr, win);
-        out_ptr += 18*SBLIMIT;
-        ptr += 18;
-        buf += 18;
-    }
-    for(j=mdct_long_end;j<sblimit;j++) {
-        /* select frequency inversion */
-        win = mdct_win[2] + ((4 * 36) & -(j & 1));
-        out_ptr = sb_samples + j;
-
-        for(i=0; i<6; i++){
-            *out_ptr = buf[i];
-            out_ptr += SBLIMIT;
-        }
-        imdct12(out2, ptr + 0);
-        for(i=0;i<6;i++) {
-            *out_ptr = MULH(out2[i], win[i]) + buf[i + 6*1];
-            buf[i + 6*2] = MULH(out2[i + 6], win[i + 6]);
-            out_ptr += SBLIMIT;
-        }
-        imdct12(out2, ptr + 1);
-        for(i=0;i<6;i++) {
-            *out_ptr = MULH(out2[i], win[i]) + buf[i + 6*2];
-            buf[i + 6*0] = MULH(out2[i + 6], win[i + 6]);
-            out_ptr += SBLIMIT;
-        }
-        imdct12(out2, ptr + 2);
-        for(i=0;i<6;i++) {
-            buf[i + 6*0] = MULH(out2[i], win[i]) + buf[i + 6*0];
-            buf[i + 6*1] = MULH(out2[i + 6], win[i + 6]);
-            buf[i + 6*2] = 0;
-        }
-        ptr += 18;
-        buf += 18;
-    }
-    /* zero bands */
-    for(j=sblimit;j<SBLIMIT;j++) {
-        /* overlap */
-        out_ptr = sb_samples + j;
-        for(i=0;i<18;i++) {
-            *out_ptr = buf[i];
-            buf[i] = 0;
-            out_ptr += SBLIMIT;
-        }
-        buf += 18;
-    }
-}
-
-/* main layer3 decoding function */
-static int mp_decode_layer3(MPADecodeContext *s)
-{
-    int nb_granules, main_data_begin, private_bits;
-    int gr, ch, blocksplit_flag, i, j, k, n, bits_pos;
-    GranuleDef *g;
-    int16_t exponents[576];
-
-    /* read side info */
-    if (s->lsf) {
-        main_data_begin = get_bits(&s->gb, 8);
-        private_bits = get_bits(&s->gb, s->nb_channels);
-        nb_granules = 1;
-    } else {
-        main_data_begin = get_bits(&s->gb, 9);
-        if (s->nb_channels == 2)
-            private_bits = get_bits(&s->gb, 3);
-        else
-            private_bits = get_bits(&s->gb, 5);
-        nb_granules = 2;
-        for(ch=0;ch<s->nb_channels;ch++) {
-            s->granules[ch][0].scfsi = 0;/* all scale factors are transmitted */
-            s->granules[ch][1].scfsi = get_bits(&s->gb, 4);
-        }
-    }
-
-    for(gr=0;gr<nb_granules;gr++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            dprintf(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch);
-            g = &s->granules[ch][gr];
-            g->part2_3_length = get_bits(&s->gb, 12);
-            g->big_values = get_bits(&s->gb, 9);
-            if(g->big_values > 288){
-                av_log(s->avctx, AV_LOG_ERROR, "big_values too big\n");
-                return -1;
-            }
-
-            g->global_gain = get_bits(&s->gb, 8);
-            /* if MS stereo only is selected, we precompute the
-               1/sqrt(2) renormalization factor */
-            if ((s->mode_ext & (MODE_EXT_MS_STEREO | MODE_EXT_I_STEREO)) ==
-                MODE_EXT_MS_STEREO)
-                g->global_gain -= 2;
-            if (s->lsf)
-                g->scalefac_compress = get_bits(&s->gb, 9);
-            else
-                g->scalefac_compress = get_bits(&s->gb, 4);
-            blocksplit_flag = get_bits1(&s->gb);
-            if (blocksplit_flag) {
-                g->block_type = get_bits(&s->gb, 2);
-                if (g->block_type == 0){
-                    av_log(s->avctx, AV_LOG_ERROR, "invalid block type\n");
-                    return -1;
-                }
-                g->switch_point = get_bits1(&s->gb);
-                for(i=0;i<2;i++)
-                    g->table_select[i] = get_bits(&s->gb, 5);
-                for(i=0;i<3;i++)
-                    g->subblock_gain[i] = get_bits(&s->gb, 3);
-                ff_init_short_region(s, g);
-            } else {
-                int region_address1, region_address2;
-                g->block_type = 0;
-                g->switch_point = 0;
-                for(i=0;i<3;i++)
-                    g->table_select[i] = get_bits(&s->gb, 5);
-                /* compute huffman coded region sizes */
-                region_address1 = get_bits(&s->gb, 4);
-                region_address2 = get_bits(&s->gb, 3);
-                dprintf(s->avctx, "region1=%d region2=%d\n",
-                        region_address1, region_address2);
-                ff_init_long_region(s, g, region_address1, region_address2);
-            }
-            ff_region_offset2size(g);
-            ff_compute_band_indexes(s, g);
-
-            g->preflag = 0;
-            if (!s->lsf)
-                g->preflag = get_bits1(&s->gb);
-            g->scalefac_scale = get_bits1(&s->gb);
-            g->count1table_select = get_bits1(&s->gb);
-            dprintf(s->avctx, "block_type=%d switch_point=%d\n",
-                    g->block_type, g->switch_point);
-        }
-    }
-
-  if (!s->adu_mode) {
-    const uint8_t *ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3);
-    assert((get_bits_count(&s->gb) & 7) == 0);
-    /* now we get bits from the main_data_begin offset */
-    dprintf(s->avctx, "seekback: %d\n", main_data_begin);
-//av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size);
-
-    memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES);
-    s->in_gb= s->gb;
-        init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8);
-        skip_bits_long(&s->gb, 8*(s->last_buf_size - main_data_begin));
-  }
-
-    for(gr=0;gr<nb_granules;gr++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            g = &s->granules[ch][gr];
-            if(get_bits_count(&s->gb)<0){
-                av_log(s->avctx, AV_LOG_DEBUG, "mdb:%d, lastbuf:%d skipping granule %d\n",
-                                            main_data_begin, s->last_buf_size, gr);
-                skip_bits_long(&s->gb, g->part2_3_length);
-                memset(g->sb_hybrid, 0, sizeof(g->sb_hybrid));
-                if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->in_gb.buffer){
-                    skip_bits_long(&s->in_gb, get_bits_count(&s->gb) - s->gb.size_in_bits);
-                    s->gb= s->in_gb;
-                    s->in_gb.buffer=NULL;
-                }
-                continue;
-            }
-
-            bits_pos = get_bits_count(&s->gb);
-
-            if (!s->lsf) {
-                uint8_t *sc;
-                int slen, slen1, slen2;
-
-                /* MPEG1 scale factors */
-                slen1 = slen_table[0][g->scalefac_compress];
-                slen2 = slen_table[1][g->scalefac_compress];
-                dprintf(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2);
-                if (g->block_type == 2) {
-                    n = g->switch_point ? 17 : 18;
-                    j = 0;
-                    if(slen1){
-                        for(i=0;i<n;i++)
-                            g->scale_factors[j++] = get_bits(&s->gb, slen1);
-                    }else{
-                        for(i=0;i<n;i++)
-                            g->scale_factors[j++] = 0;
-                    }
-                    if(slen2){
-                        for(i=0;i<18;i++)
-                            g->scale_factors[j++] = get_bits(&s->gb, slen2);
-                        for(i=0;i<3;i++)
-                            g->scale_factors[j++] = 0;
-                    }else{
-                        for(i=0;i<21;i++)
-                            g->scale_factors[j++] = 0;
-                    }
-                } else {
-                    sc = s->granules[ch][0].scale_factors;
-                    j = 0;
-                    for(k=0;k<4;k++) {
-                        n = (k == 0 ? 6 : 5);
-                        if ((g->scfsi & (0x8 >> k)) == 0) {
-                            slen = (k < 2) ? slen1 : slen2;
-                            if(slen){
-                                for(i=0;i<n;i++)
-                                    g->scale_factors[j++] = get_bits(&s->gb, slen);
-                            }else{
-                                for(i=0;i<n;i++)
-                                    g->scale_factors[j++] = 0;
-                            }
-                        } else {
-                            /* simply copy from last granule */
-                            for(i=0;i<n;i++) {
-                                g->scale_factors[j] = sc[j];
-                                j++;
-                            }
-                        }
-                    }
-                    g->scale_factors[j++] = 0;
-                }
-            } else {
-                int tindex, tindex2, slen[4], sl, sf;
-
-                /* LSF scale factors */
-                if (g->block_type == 2) {
-                    tindex = g->switch_point ? 2 : 1;
-                } else {
-                    tindex = 0;
-                }
-                sf = g->scalefac_compress;
-                if ((s->mode_ext & MODE_EXT_I_STEREO) && ch == 1) {
-                    /* intensity stereo case */
-                    sf >>= 1;
-                    if (sf < 180) {
-                        lsf_sf_expand(slen, sf, 6, 6, 0);
-                        tindex2 = 3;
-                    } else if (sf < 244) {
-                        lsf_sf_expand(slen, sf - 180, 4, 4, 0);
-                        tindex2 = 4;
-                    } else {
-                        lsf_sf_expand(slen, sf - 244, 3, 0, 0);
-                        tindex2 = 5;
-                    }
-                } else {
-                    /* normal case */
-                    if (sf < 400) {
-                        lsf_sf_expand(slen, sf, 5, 4, 4);
-                        tindex2 = 0;
-                    } else if (sf < 500) {
-                        lsf_sf_expand(slen, sf - 400, 5, 4, 0);
-                        tindex2 = 1;
-                    } else {
-                        lsf_sf_expand(slen, sf - 500, 3, 0, 0);
-                        tindex2 = 2;
-                        g->preflag = 1;
-                    }
-                }
-
-                j = 0;
-                for(k=0;k<4;k++) {
-                    n = lsf_nsf_table[tindex2][tindex][k];
-                    sl = slen[k];
-                    if(sl){
-                        for(i=0;i<n;i++)
-                            g->scale_factors[j++] = get_bits(&s->gb, sl);
-                    }else{
-                        for(i=0;i<n;i++)
-                            g->scale_factors[j++] = 0;
-                    }
-                }
-                /* XXX: should compute exact size */
-                for(;j<40;j++)
-                    g->scale_factors[j] = 0;
-            }
-
-            exponents_from_scale_factors(s, g, exponents);
-
-            /* read Huffman coded residue */
-            huffman_decode(s, g, exponents, bits_pos + g->part2_3_length);
-        } /* ch */
-
-        if (s->nb_channels == 2)
-            compute_stereo(s, &s->granules[0][gr], &s->granules[1][gr]);
-
-        for(ch=0;ch<s->nb_channels;ch++) {
-            g = &s->granules[ch][gr];
-
-            reorder_block(s, g);
-            s->compute_antialias(s, g);
-            compute_imdct(s, g, &s->sb_samples[ch][18 * gr][0], s->mdct_buf[ch]);
-        }
-    } /* gr */
-    if(get_bits_count(&s->gb)<0)
-        skip_bits_long(&s->gb, -get_bits_count(&s->gb));
-    return nb_granules * 18;
-}
-
-static int mp_decode_frame(MPADecodeContext *s,
-                           OUT_INT *samples, const uint8_t *buf, int buf_size)
-{
-    int i, nb_frames, ch;
-    OUT_INT *samples_ptr;
-
-    init_get_bits(&s->gb, buf + HEADER_SIZE, (buf_size - HEADER_SIZE)*8);
-
-    /* skip error protection field */
-    if (s->error_protection)
-        skip_bits(&s->gb, 16);
-
-    dprintf(s->avctx, "frame %d:\n", s->frame_count);
-    switch(s->layer) {
-    case 1:
-        s->avctx->frame_size = 384;
-        nb_frames = mp_decode_layer1(s);
-        break;
-    case 2:
-        s->avctx->frame_size = 1152;
-        nb_frames = mp_decode_layer2(s);
-        break;
-    case 3:
-        s->avctx->frame_size = s->lsf ? 576 : 1152;
-    default:
-        nb_frames = mp_decode_layer3(s);
-
-        s->last_buf_size=0;
-        if(s->in_gb.buffer){
-            align_get_bits(&s->gb);
-            i= get_bits_left(&s->gb)>>3;
-            if(i >= 0 && i <= BACKSTEP_SIZE){
-                memmove(s->last_buf, s->gb.buffer + (get_bits_count(&s->gb)>>3), i);
-                s->last_buf_size=i;
-            }else
-                av_log(s->avctx, AV_LOG_ERROR, "invalid old backstep %d\n", i);
-            s->gb= s->in_gb;
-            s->in_gb.buffer= NULL;
-        }
-
-        align_get_bits(&s->gb);
-        assert((get_bits_count(&s->gb) & 7) == 0);
-        i= get_bits_left(&s->gb)>>3;
-
-        if(i<0 || i > BACKSTEP_SIZE || nb_frames<0){
-            if(i<0)
-                av_log(s->avctx, AV_LOG_ERROR, "invalid new backstep %d\n", i);
-            i= FFMIN(BACKSTEP_SIZE, buf_size - HEADER_SIZE);
-        }
-        assert(i <= buf_size - HEADER_SIZE && i>= 0);
-        memcpy(s->last_buf + s->last_buf_size, s->gb.buffer + buf_size - HEADER_SIZE - i, i);
-        s->last_buf_size += i;
-
-        break;
-    }
-
-    /* apply the synthesis filter */
-    for(ch=0;ch<s->nb_channels;ch++) {
-        samples_ptr = samples + ch;
-        for(i=0;i<nb_frames;i++) {
-            ff_mpa_synth_filter(s->synth_buf[ch], &(s->synth_buf_offset[ch]),
-                         ff_mpa_synth_window, &s->dither_state,
-                         samples_ptr, s->nb_channels,
-                         s->sb_samples[ch][i]);
-            samples_ptr += 32 * s->nb_channels;
-        }
-    }
-
-    return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels;
-}
-
-static int decode_frame(AVCodecContext * avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MPADecodeContext *s = avctx->priv_data;
-    uint32_t header;
-    int out_size;
-    OUT_INT *out_samples = data;
-
-    if(buf_size < HEADER_SIZE)
-        return -1;
-
-    header = AV_RB32(buf);
-    if(ff_mpa_check_header(header) < 0){
-        av_log(avctx, AV_LOG_ERROR, "Header missing\n");
-        return -1;
-    }
-
-    if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
-        /* free format: prepare to compute frame size */
-        s->frame_size = -1;
-        return -1;
-    }
-    /* update codec info */
-    avctx->channels = s->nb_channels;
-    avctx->bit_rate = s->bit_rate;
-    avctx->sub_id = s->layer;
-
-    if(*data_size < 1152*avctx->channels*sizeof(OUT_INT))
-        return -1;
-    *data_size = 0;
-
-    if(s->frame_size<=0 || s->frame_size > buf_size){
-        av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
-        return -1;
-    }else if(s->frame_size < buf_size){
-        av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n");
-        buf_size= s->frame_size;
-    }
-
-    out_size = mp_decode_frame(s, out_samples, buf, buf_size);
-    if(out_size>=0){
-        *data_size = out_size;
-        avctx->sample_rate = s->sample_rate;
-        //FIXME maybe move the other codec info stuff from above here too
-    }else
-        av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); //FIXME return -1 / but also return the number of bytes consumed
-    s->frame_size = 0;
-    return buf_size;
-}
-
-static void flush(AVCodecContext *avctx){
-    MPADecodeContext *s = avctx->priv_data;
-    memset(s->synth_buf, 0, sizeof(s->synth_buf));
-    s->last_buf_size= 0;
-}
-
-#if CONFIG_MP3ADU_DECODER
-static int decode_frame_adu(AVCodecContext * avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MPADecodeContext *s = avctx->priv_data;
-    uint32_t header;
-    int len, out_size;
-    OUT_INT *out_samples = data;
-
-    len = buf_size;
-
-    // Discard too short frames
-    if (buf_size < HEADER_SIZE) {
-        *data_size = 0;
-        return buf_size;
-    }
-
-
-    if (len > MPA_MAX_CODED_FRAME_SIZE)
-        len = MPA_MAX_CODED_FRAME_SIZE;
-
-    // Get header and restore sync word
-    header = AV_RB32(buf) | 0xffe00000;
-
-    if (ff_mpa_check_header(header) < 0) { // Bad header, discard frame
-        *data_size = 0;
-        return buf_size;
-    }
-
-    ff_mpegaudio_decode_header((MPADecodeHeader *)s, header);
-    /* update codec info */
-    avctx->sample_rate = s->sample_rate;
-    avctx->channels = s->nb_channels;
-    avctx->bit_rate = s->bit_rate;
-    avctx->sub_id = s->layer;
-
-    s->frame_size = len;
-
-    if (avctx->parse_only) {
-        out_size = buf_size;
-    } else {
-        out_size = mp_decode_frame(s, out_samples, buf, buf_size);
-    }
-
-    *data_size = out_size;
-    return buf_size;
-}
-#endif /* CONFIG_MP3ADU_DECODER */
-
-#if CONFIG_MP3ON4_DECODER
-
-/**
- * Context for MP3On4 decoder
- */
-typedef struct MP3On4DecodeContext {
-    int frames;   ///< number of mp3 frames per block (number of mp3 decoder instances)
-    int syncword; ///< syncword patch
-    const uint8_t *coff; ///< channels offsets in output buffer
-    MPADecodeContext *mp3decctx[5]; ///< MPADecodeContext for every decoder instance
-} MP3On4DecodeContext;
-
-#include "mpeg4audio.h"
-
-/* Next 3 arrays are indexed by channel config number (passed via codecdata) */
-static const uint8_t mp3Frames[8] = {0,1,1,2,3,3,4,5};   /* number of mp3 decoder instances */
-/* offsets into output buffer, assume output order is FL FR BL BR C LFE */
-static const uint8_t chan_offset[8][5] = {
-    {0},
-    {0},            // C
-    {0},            // FLR
-    {2,0},          // C FLR
-    {2,0,3},        // C FLR BS
-    {4,0,2},        // C FLR BLRS
-    {4,0,2,5},      // C FLR BLRS LFE
-    {4,0,2,6,5},    // C FLR BLRS BLR LFE
-};
-
-
-static int decode_init_mp3on4(AVCodecContext * avctx)
-{
-    MP3On4DecodeContext *s = avctx->priv_data;
-    MPEG4AudioConfig cfg;
-    int i;
-
-    if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) {
-        av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n");
-        return -1;
-    }
-
-    ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size);
-    if (!cfg.chan_config || cfg.chan_config > 7) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n");
-        return -1;
-    }
-    s->frames = mp3Frames[cfg.chan_config];
-    s->coff = chan_offset[cfg.chan_config];
-    avctx->channels = ff_mpeg4audio_channels[cfg.chan_config];
-
-    if (cfg.sample_rate < 16000)
-        s->syncword = 0xffe00000;
-    else
-        s->syncword = 0xfff00000;
-
-    /* Init the first mp3 decoder in standard way, so that all tables get builded
-     * We replace avctx->priv_data with the context of the first decoder so that
-     * decode_init() does not have to be changed.
-     * Other decoders will be initialized here copying data from the first context
-     */
-    // Allocate zeroed memory for the first decoder context
-    s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext));
-    // Put decoder context in place to make init_decode() happy
-    avctx->priv_data = s->mp3decctx[0];
-    decode_init(avctx);
-    // Restore mp3on4 context pointer
-    avctx->priv_data = s;
-    s->mp3decctx[0]->adu_mode = 1; // Set adu mode
-
-    /* Create a separate codec/context for each frame (first is already ok).
-     * Each frame is 1 or 2 channels - up to 5 frames allowed
-     */
-    for (i = 1; i < s->frames; i++) {
-        s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext));
-        s->mp3decctx[i]->compute_antialias = s->mp3decctx[0]->compute_antialias;
-        s->mp3decctx[i]->adu_mode = 1;
-        s->mp3decctx[i]->avctx = avctx;
-    }
-
-    return 0;
-}
-
-
-static av_cold int decode_close_mp3on4(AVCodecContext * avctx)
-{
-    MP3On4DecodeContext *s = avctx->priv_data;
-    int i;
-
-    for (i = 0; i < s->frames; i++)
-        if (s->mp3decctx[i])
-            av_free(s->mp3decctx[i]);
-
-    return 0;
-}
-
-
-static int decode_frame_mp3on4(AVCodecContext * avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MP3On4DecodeContext *s = avctx->priv_data;
-    MPADecodeContext *m;
-    int fsize, len = buf_size, out_size = 0;
-    uint32_t header;
-    OUT_INT *out_samples = data;
-    OUT_INT decoded_buf[MPA_FRAME_SIZE * MPA_MAX_CHANNELS];
-    OUT_INT *outptr, *bp;
-    int fr, j, n;
-
-    if(*data_size < MPA_FRAME_SIZE * MPA_MAX_CHANNELS * s->frames * sizeof(OUT_INT))
-        return -1;
-
-    *data_size = 0;
-    // Discard too short frames
-    if (buf_size < HEADER_SIZE)
-        return -1;
-
-    // If only one decoder interleave is not needed
-    outptr = s->frames == 1 ? out_samples : decoded_buf;
-
-    avctx->bit_rate = 0;
-
-    for (fr = 0; fr < s->frames; fr++) {
-        fsize = AV_RB16(buf) >> 4;
-        fsize = FFMIN3(fsize, len, MPA_MAX_CODED_FRAME_SIZE);
-        m = s->mp3decctx[fr];
-        assert (m != NULL);
-
-        header = (AV_RB32(buf) & 0x000fffff) | s->syncword; // patch header
-
-        if (ff_mpa_check_header(header) < 0) // Bad header, discard block
-            break;
-
-        ff_mpegaudio_decode_header((MPADecodeHeader *)m, header);
-        out_size += mp_decode_frame(m, outptr, buf, fsize);
-        buf += fsize;
-        len -= fsize;
-
-        if(s->frames > 1) {
-            n = m->avctx->frame_size*m->nb_channels;
-            /* interleave output data */
-            bp = out_samples + s->coff[fr];
-            if(m->nb_channels == 1) {
-                for(j = 0; j < n; j++) {
-                    *bp = decoded_buf[j];
-                    bp += avctx->channels;
-                }
-            } else {
-                for(j = 0; j < n; j++) {
-                    bp[0] = decoded_buf[j++];
-                    bp[1] = decoded_buf[j];
-                    bp += avctx->channels;
-                }
-            }
-        }
-        avctx->bit_rate += m->bit_rate;
-    }
-
-    /* update codec info */
-    avctx->sample_rate = s->mp3decctx[0]->sample_rate;
-
-    *data_size = out_size;
-    return buf_size;
-}
-#endif /* CONFIG_MP3ON4_DECODER */
-
-#if CONFIG_MP1_DECODER
-AVCodec mp1_decoder =
-{
-    "mp1",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP1,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
-};
-#endif
-#if CONFIG_MP2_DECODER
-AVCodec mp2_decoder =
-{
-    "mp2",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP2,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
-};
-#endif
-#if CONFIG_MP3_DECODER
-AVCodec mp3_decoder =
-{
-    "mp3",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
-};
-#endif
-#if CONFIG_MP3ADU_DECODER
-AVCodec mp3adu_decoder =
-{
-    "mp3adu",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3ADU,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame_adu,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
-};
-#endif
-#if CONFIG_MP3ON4_DECODER
-AVCodec mp3on4_decoder =
-{
-    "mp3on4",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3ON4,
-    sizeof(MP3On4DecodeContext),
-    decode_init_mp3on4,
-    NULL,
-    decode_close_mp3on4,
-    decode_frame_mp3on4,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"),
-};
-#endif
diff --git a/libavcodec/mpegaudiodecheader.c b/libavcodec/mpegaudiodecheader.c
deleted file mode 100644
index 67f882f..0000000
--- a/libavcodec/mpegaudiodecheader.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * MPEG Audio header decoder
- * Copyright (c) 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG Audio header decoder.
- */
-
-//#define DEBUG
-#include "avcodec.h"
-#include "mpegaudio.h"
-#include "mpegaudiodata.h"
-#include "mpegaudiodecheader.h"
-
-
-int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
-{
-    int sample_rate, frame_size, mpeg25, padding;
-    int sample_rate_index, bitrate_index;
-    if (header & (1<<20)) {
-        s->lsf = (header & (1<<19)) ? 0 : 1;
-        mpeg25 = 0;
-    } else {
-        s->lsf = 1;
-        mpeg25 = 1;
-    }
-
-    s->layer = 4 - ((header >> 17) & 3);
-    /* extract frequency */
-    sample_rate_index = (header >> 10) & 3;
-    sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
-    sample_rate_index += 3 * (s->lsf + mpeg25);
-    s->sample_rate_index = sample_rate_index;
-    s->error_protection = ((header >> 16) & 1) ^ 1;
-    s->sample_rate = sample_rate;
-
-    bitrate_index = (header >> 12) & 0xf;
-    padding = (header >> 9) & 1;
-    //extension = (header >> 8) & 1;
-    s->mode = (header >> 6) & 3;
-    s->mode_ext = (header >> 4) & 3;
-    //copyright = (header >> 3) & 1;
-    //original = (header >> 2) & 1;
-    //emphasis = header & 3;
-
-    if (s->mode == MPA_MONO)
-        s->nb_channels = 1;
-    else
-        s->nb_channels = 2;
-
-    if (bitrate_index != 0) {
-        frame_size = ff_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
-        s->bit_rate = frame_size * 1000;
-        switch(s->layer) {
-        case 1:
-            frame_size = (frame_size * 12000) / sample_rate;
-            frame_size = (frame_size + padding) * 4;
-            break;
-        case 2:
-            frame_size = (frame_size * 144000) / sample_rate;
-            frame_size += padding;
-            break;
-        default:
-        case 3:
-            frame_size = (frame_size * 144000) / (sample_rate << s->lsf);
-            frame_size += padding;
-            break;
-        }
-        s->frame_size = frame_size;
-    } else {
-        /* if no frame size computed, signal it */
-        return 1;
-    }
-
-#if defined(DEBUG)
-    dprintf(NULL, "layer%d, %d Hz, %d kbits/s, ",
-           s->layer, s->sample_rate, s->bit_rate);
-    if (s->nb_channels == 2) {
-        if (s->layer == 3) {
-            if (s->mode_ext & MODE_EXT_MS_STEREO)
-                dprintf(NULL, "ms-");
-            if (s->mode_ext & MODE_EXT_I_STEREO)
-                dprintf(NULL, "i-");
-        }
-        dprintf(NULL, "stereo");
-    } else {
-        dprintf(NULL, "mono");
-    }
-    dprintf(NULL, "\n");
-#endif
-    return 0;
-}
diff --git a/libavcodec/mpegaudiodecheader.h b/libavcodec/mpegaudiodecheader.h
deleted file mode 100644
index 5578618..0000000
--- a/libavcodec/mpegaudiodecheader.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * MPEG Audio header decoder
- * Copyright (c) 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MPEG Audio header decoder.
- */
-
-#ifndef AVCODEC_MPEGAUDIODECHEADER_H
-#define AVCODEC_MPEGAUDIODECHEADER_H
-
-#include "libavutil/common.h"
-#include "mpegaudio.h"
-
-
-/* header decoding. MUST check the header before because no
-   consistency check is done there. Return 1 if free format found and
-   that the frame size must be computed externally */
-int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
-
-#endif /* AVCODEC_MPEGAUDIODECHEADER_H */
diff --git a/libavcodec/mpegaudiodectab.h b/libavcodec/mpegaudiodectab.h
deleted file mode 100644
index 234a70e..0000000
--- a/libavcodec/mpegaudiodectab.h
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * MPEG Audio decoder
- * copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mpeg audio layer decoder tables.
- */
-
-#ifndef AVCODEC_MPEGAUDIODECTAB_H
-#define AVCODEC_MPEGAUDIODECTAB_H
-
-#include <stdint.h>
-#include "mpegaudio.h"
-
-/*******************************************************/
-/* layer 3 tables */
-
-/* layer3 scale factor size */
-static const uint8_t slen_table[2][16] = {
-    { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
-    { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 },
-};
-
-/* number of lsf scale factors for a given size */
-static const uint8_t lsf_nsf_table[6][3][4] = {
-    { {  6,  5,  5, 5 }, {  9,  9,  9, 9 }, {  6,  9,  9, 9 } },
-    { {  6,  5,  7, 3 }, {  9,  9, 12, 6 }, {  6,  9, 12, 6 } },
-    { { 11, 10,  0, 0 }, { 18, 18,  0, 0 }, { 15, 18,  0, 0 } },
-    { {  7,  7,  7, 0 }, { 12, 12, 12, 0 }, {  6, 15, 12, 0 } },
-    { {  6,  6,  6, 3 }, { 12,  9,  9, 6 }, {  6, 12,  9, 6 } },
-    { {  8,  8,  5, 0 }, { 15, 12,  9, 0 }, {  6, 18,  9, 0 } },
-};
-
-/* mpegaudio layer 3 huffman tables */
-
-static const uint16_t mpa_huffcodes_1[4] = {
- 0x0001, 0x0001, 0x0001, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_1[4] = {
-  1,  3,  2,  3,
-};
-
-static const uint16_t mpa_huffcodes_2[9] = {
- 0x0001, 0x0002, 0x0001, 0x0003, 0x0001, 0x0001, 0x0003, 0x0002,
- 0x0000,
-};
-
-static const uint8_t mpa_huffbits_2[9] = {
-  1,  3,  6,  3,  3,  5,  5,  5,
-  6,
-};
-
-static const uint16_t mpa_huffcodes_3[9] = {
- 0x0003, 0x0002, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0002,
- 0x0000,
-};
-
-static const uint8_t mpa_huffbits_3[9] = {
-  2,  2,  6,  3,  2,  5,  5,  5,
-  6,
-};
-
-static const uint16_t mpa_huffcodes_5[16] = {
- 0x0001, 0x0002, 0x0006, 0x0005, 0x0003, 0x0001, 0x0004, 0x0004,
- 0x0007, 0x0005, 0x0007, 0x0001, 0x0006, 0x0001, 0x0001, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_5[16] = {
-  1,  3,  6,  7,  3,  3,  6,  7,
-  6,  6,  7,  8,  7,  6,  7,  8,
-};
-
-static const uint16_t mpa_huffcodes_6[16] = {
- 0x0007, 0x0003, 0x0005, 0x0001, 0x0006, 0x0002, 0x0003, 0x0002,
- 0x0005, 0x0004, 0x0004, 0x0001, 0x0003, 0x0003, 0x0002, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_6[16] = {
-  3,  3,  5,  7,  3,  2,  4,  5,
-  4,  4,  5,  6,  6,  5,  6,  7,
-};
-
-static const uint16_t mpa_huffcodes_7[36] = {
- 0x0001, 0x0002, 0x000a, 0x0013, 0x0010, 0x000a, 0x0003, 0x0003,
- 0x0007, 0x000a, 0x0005, 0x0003, 0x000b, 0x0004, 0x000d, 0x0011,
- 0x0008, 0x0004, 0x000c, 0x000b, 0x0012, 0x000f, 0x000b, 0x0002,
- 0x0007, 0x0006, 0x0009, 0x000e, 0x0003, 0x0001, 0x0006, 0x0004,
- 0x0005, 0x0003, 0x0002, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_7[36] = {
-  1,  3,  6,  8,  8,  9,  3,  4,
-  6,  7,  7,  8,  6,  5,  7,  8,
-  8,  9,  7,  7,  8,  9,  9,  9,
-  7,  7,  8,  9,  9, 10,  8,  8,
-  9, 10, 10, 10,
-};
-
-static const uint16_t mpa_huffcodes_8[36] = {
- 0x0003, 0x0004, 0x0006, 0x0012, 0x000c, 0x0005, 0x0005, 0x0001,
- 0x0002, 0x0010, 0x0009, 0x0003, 0x0007, 0x0003, 0x0005, 0x000e,
- 0x0007, 0x0003, 0x0013, 0x0011, 0x000f, 0x000d, 0x000a, 0x0004,
- 0x000d, 0x0005, 0x0008, 0x000b, 0x0005, 0x0001, 0x000c, 0x0004,
- 0x0004, 0x0001, 0x0001, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_8[36] = {
-  2,  3,  6,  8,  8,  9,  3,  2,
-  4,  8,  8,  8,  6,  4,  6,  8,
-  8,  9,  8,  8,  8,  9,  9, 10,
-  8,  7,  8,  9, 10, 10,  9,  8,
-  9,  9, 11, 11,
-};
-
-static const uint16_t mpa_huffcodes_9[36] = {
- 0x0007, 0x0005, 0x0009, 0x000e, 0x000f, 0x0007, 0x0006, 0x0004,
- 0x0005, 0x0005, 0x0006, 0x0007, 0x0007, 0x0006, 0x0008, 0x0008,
- 0x0008, 0x0005, 0x000f, 0x0006, 0x0009, 0x000a, 0x0005, 0x0001,
- 0x000b, 0x0007, 0x0009, 0x0006, 0x0004, 0x0001, 0x000e, 0x0004,
- 0x0006, 0x0002, 0x0006, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_9[36] = {
-  3,  3,  5,  6,  8,  9,  3,  3,
-  4,  5,  6,  8,  4,  4,  5,  6,
-  7,  8,  6,  5,  6,  7,  7,  8,
-  7,  6,  7,  7,  8,  9,  8,  7,
-  8,  8,  9,  9,
-};
-
-static const uint16_t mpa_huffcodes_10[64] = {
- 0x0001, 0x0002, 0x000a, 0x0017, 0x0023, 0x001e, 0x000c, 0x0011,
- 0x0003, 0x0003, 0x0008, 0x000c, 0x0012, 0x0015, 0x000c, 0x0007,
- 0x000b, 0x0009, 0x000f, 0x0015, 0x0020, 0x0028, 0x0013, 0x0006,
- 0x000e, 0x000d, 0x0016, 0x0022, 0x002e, 0x0017, 0x0012, 0x0007,
- 0x0014, 0x0013, 0x0021, 0x002f, 0x001b, 0x0016, 0x0009, 0x0003,
- 0x001f, 0x0016, 0x0029, 0x001a, 0x0015, 0x0014, 0x0005, 0x0003,
- 0x000e, 0x000d, 0x000a, 0x000b, 0x0010, 0x0006, 0x0005, 0x0001,
- 0x0009, 0x0008, 0x0007, 0x0008, 0x0004, 0x0004, 0x0002, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_10[64] = {
-  1,  3,  6,  8,  9,  9,  9, 10,
-  3,  4,  6,  7,  8,  9,  8,  8,
-  6,  6,  7,  8,  9, 10,  9,  9,
-  7,  7,  8,  9, 10, 10,  9, 10,
-  8,  8,  9, 10, 10, 10, 10, 10,
-  9,  9, 10, 10, 11, 11, 10, 11,
-  8,  8,  9, 10, 10, 10, 11, 11,
-  9,  8,  9, 10, 10, 11, 11, 11,
-};
-
-static const uint16_t mpa_huffcodes_11[64] = {
- 0x0003, 0x0004, 0x000a, 0x0018, 0x0022, 0x0021, 0x0015, 0x000f,
- 0x0005, 0x0003, 0x0004, 0x000a, 0x0020, 0x0011, 0x000b, 0x000a,
- 0x000b, 0x0007, 0x000d, 0x0012, 0x001e, 0x001f, 0x0014, 0x0005,
- 0x0019, 0x000b, 0x0013, 0x003b, 0x001b, 0x0012, 0x000c, 0x0005,
- 0x0023, 0x0021, 0x001f, 0x003a, 0x001e, 0x0010, 0x0007, 0x0005,
- 0x001c, 0x001a, 0x0020, 0x0013, 0x0011, 0x000f, 0x0008, 0x000e,
- 0x000e, 0x000c, 0x0009, 0x000d, 0x000e, 0x0009, 0x0004, 0x0001,
- 0x000b, 0x0004, 0x0006, 0x0006, 0x0006, 0x0003, 0x0002, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_11[64] = {
-  2,  3,  5,  7,  8,  9,  8,  9,
-  3,  3,  4,  6,  8,  8,  7,  8,
-  5,  5,  6,  7,  8,  9,  8,  8,
-  7,  6,  7,  9,  8, 10,  8,  9,
-  8,  8,  8,  9,  9, 10,  9, 10,
-  8,  8,  9, 10, 10, 11, 10, 11,
-  8,  7,  7,  8,  9, 10, 10, 10,
-  8,  7,  8,  9, 10, 10, 10, 10,
-};
-
-static const uint16_t mpa_huffcodes_12[64] = {
- 0x0009, 0x0006, 0x0010, 0x0021, 0x0029, 0x0027, 0x0026, 0x001a,
- 0x0007, 0x0005, 0x0006, 0x0009, 0x0017, 0x0010, 0x001a, 0x000b,
- 0x0011, 0x0007, 0x000b, 0x000e, 0x0015, 0x001e, 0x000a, 0x0007,
- 0x0011, 0x000a, 0x000f, 0x000c, 0x0012, 0x001c, 0x000e, 0x0005,
- 0x0020, 0x000d, 0x0016, 0x0013, 0x0012, 0x0010, 0x0009, 0x0005,
- 0x0028, 0x0011, 0x001f, 0x001d, 0x0011, 0x000d, 0x0004, 0x0002,
- 0x001b, 0x000c, 0x000b, 0x000f, 0x000a, 0x0007, 0x0004, 0x0001,
- 0x001b, 0x000c, 0x0008, 0x000c, 0x0006, 0x0003, 0x0001, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_12[64] = {
-  4,  3,  5,  7,  8,  9,  9,  9,
-  3,  3,  4,  5,  7,  7,  8,  8,
-  5,  4,  5,  6,  7,  8,  7,  8,
-  6,  5,  6,  6,  7,  8,  8,  8,
-  7,  6,  7,  7,  8,  8,  8,  9,
-  8,  7,  8,  8,  8,  9,  8,  9,
-  8,  7,  7,  8,  8,  9,  9, 10,
-  9,  8,  8,  9,  9,  9,  9, 10,
-};
-
-static const uint16_t mpa_huffcodes_13[256] = {
- 0x0001, 0x0005, 0x000e, 0x0015, 0x0022, 0x0033, 0x002e, 0x0047,
- 0x002a, 0x0034, 0x0044, 0x0034, 0x0043, 0x002c, 0x002b, 0x0013,
- 0x0003, 0x0004, 0x000c, 0x0013, 0x001f, 0x001a, 0x002c, 0x0021,
- 0x001f, 0x0018, 0x0020, 0x0018, 0x001f, 0x0023, 0x0016, 0x000e,
- 0x000f, 0x000d, 0x0017, 0x0024, 0x003b, 0x0031, 0x004d, 0x0041,
- 0x001d, 0x0028, 0x001e, 0x0028, 0x001b, 0x0021, 0x002a, 0x0010,
- 0x0016, 0x0014, 0x0025, 0x003d, 0x0038, 0x004f, 0x0049, 0x0040,
- 0x002b, 0x004c, 0x0038, 0x0025, 0x001a, 0x001f, 0x0019, 0x000e,
- 0x0023, 0x0010, 0x003c, 0x0039, 0x0061, 0x004b, 0x0072, 0x005b,
- 0x0036, 0x0049, 0x0037, 0x0029, 0x0030, 0x0035, 0x0017, 0x0018,
- 0x003a, 0x001b, 0x0032, 0x0060, 0x004c, 0x0046, 0x005d, 0x0054,
- 0x004d, 0x003a, 0x004f, 0x001d, 0x004a, 0x0031, 0x0029, 0x0011,
- 0x002f, 0x002d, 0x004e, 0x004a, 0x0073, 0x005e, 0x005a, 0x004f,
- 0x0045, 0x0053, 0x0047, 0x0032, 0x003b, 0x0026, 0x0024, 0x000f,
- 0x0048, 0x0022, 0x0038, 0x005f, 0x005c, 0x0055, 0x005b, 0x005a,
- 0x0056, 0x0049, 0x004d, 0x0041, 0x0033, 0x002c, 0x002b, 0x002a,
- 0x002b, 0x0014, 0x001e, 0x002c, 0x0037, 0x004e, 0x0048, 0x0057,
- 0x004e, 0x003d, 0x002e, 0x0036, 0x0025, 0x001e, 0x0014, 0x0010,
- 0x0035, 0x0019, 0x0029, 0x0025, 0x002c, 0x003b, 0x0036, 0x0051,
- 0x0042, 0x004c, 0x0039, 0x0036, 0x0025, 0x0012, 0x0027, 0x000b,
- 0x0023, 0x0021, 0x001f, 0x0039, 0x002a, 0x0052, 0x0048, 0x0050,
- 0x002f, 0x003a, 0x0037, 0x0015, 0x0016, 0x001a, 0x0026, 0x0016,
- 0x0035, 0x0019, 0x0017, 0x0026, 0x0046, 0x003c, 0x0033, 0x0024,
- 0x0037, 0x001a, 0x0022, 0x0017, 0x001b, 0x000e, 0x0009, 0x0007,
- 0x0022, 0x0020, 0x001c, 0x0027, 0x0031, 0x004b, 0x001e, 0x0034,
- 0x0030, 0x0028, 0x0034, 0x001c, 0x0012, 0x0011, 0x0009, 0x0005,
- 0x002d, 0x0015, 0x0022, 0x0040, 0x0038, 0x0032, 0x0031, 0x002d,
- 0x001f, 0x0013, 0x000c, 0x000f, 0x000a, 0x0007, 0x0006, 0x0003,
- 0x0030, 0x0017, 0x0014, 0x0027, 0x0024, 0x0023, 0x0035, 0x0015,
- 0x0010, 0x0017, 0x000d, 0x000a, 0x0006, 0x0001, 0x0004, 0x0002,
- 0x0010, 0x000f, 0x0011, 0x001b, 0x0019, 0x0014, 0x001d, 0x000b,
- 0x0011, 0x000c, 0x0010, 0x0008, 0x0001, 0x0001, 0x0000, 0x0001,
-};
-
-static const uint8_t mpa_huffbits_13[256] = {
-  1,  4,  6,  7,  8,  9,  9, 10,
-  9, 10, 11, 11, 12, 12, 13, 13,
-  3,  4,  6,  7,  8,  8,  9,  9,
-  9,  9, 10, 10, 11, 12, 12, 12,
-  6,  6,  7,  8,  9,  9, 10, 10,
-  9, 10, 10, 11, 11, 12, 13, 13,
-  7,  7,  8,  9,  9, 10, 10, 10,
- 10, 11, 11, 11, 11, 12, 13, 13,
-  8,  7,  9,  9, 10, 10, 11, 11,
- 10, 11, 11, 12, 12, 13, 13, 14,
-  9,  8,  9, 10, 10, 10, 11, 11,
- 11, 11, 12, 11, 13, 13, 14, 14,
-  9,  9, 10, 10, 11, 11, 11, 11,
- 11, 12, 12, 12, 13, 13, 14, 14,
- 10,  9, 10, 11, 11, 11, 12, 12,
- 12, 12, 13, 13, 13, 14, 16, 16,
-  9,  8,  9, 10, 10, 11, 11, 12,
- 12, 12, 12, 13, 13, 14, 15, 15,
- 10,  9, 10, 10, 11, 11, 11, 13,
- 12, 13, 13, 14, 14, 14, 16, 15,
- 10, 10, 10, 11, 11, 12, 12, 13,
- 12, 13, 14, 13, 14, 15, 16, 17,
- 11, 10, 10, 11, 12, 12, 12, 12,
- 13, 13, 13, 14, 15, 15, 15, 16,
- 11, 11, 11, 12, 12, 13, 12, 13,
- 14, 14, 15, 15, 15, 16, 16, 16,
- 12, 11, 12, 13, 13, 13, 14, 14,
- 14, 14, 14, 15, 16, 15, 16, 16,
- 13, 12, 12, 13, 13, 13, 15, 14,
- 14, 17, 15, 15, 15, 17, 16, 16,
- 12, 12, 13, 14, 14, 14, 15, 14,
- 15, 15, 16, 16, 19, 18, 19, 16,
-};
-
-static const uint16_t mpa_huffcodes_15[256] = {
- 0x0007, 0x000c, 0x0012, 0x0035, 0x002f, 0x004c, 0x007c, 0x006c,
- 0x0059, 0x007b, 0x006c, 0x0077, 0x006b, 0x0051, 0x007a, 0x003f,
- 0x000d, 0x0005, 0x0010, 0x001b, 0x002e, 0x0024, 0x003d, 0x0033,
- 0x002a, 0x0046, 0x0034, 0x0053, 0x0041, 0x0029, 0x003b, 0x0024,
- 0x0013, 0x0011, 0x000f, 0x0018, 0x0029, 0x0022, 0x003b, 0x0030,
- 0x0028, 0x0040, 0x0032, 0x004e, 0x003e, 0x0050, 0x0038, 0x0021,
- 0x001d, 0x001c, 0x0019, 0x002b, 0x0027, 0x003f, 0x0037, 0x005d,
- 0x004c, 0x003b, 0x005d, 0x0048, 0x0036, 0x004b, 0x0032, 0x001d,
- 0x0034, 0x0016, 0x002a, 0x0028, 0x0043, 0x0039, 0x005f, 0x004f,
- 0x0048, 0x0039, 0x0059, 0x0045, 0x0031, 0x0042, 0x002e, 0x001b,
- 0x004d, 0x0025, 0x0023, 0x0042, 0x003a, 0x0034, 0x005b, 0x004a,
- 0x003e, 0x0030, 0x004f, 0x003f, 0x005a, 0x003e, 0x0028, 0x0026,
- 0x007d, 0x0020, 0x003c, 0x0038, 0x0032, 0x005c, 0x004e, 0x0041,
- 0x0037, 0x0057, 0x0047, 0x0033, 0x0049, 0x0033, 0x0046, 0x001e,
- 0x006d, 0x0035, 0x0031, 0x005e, 0x0058, 0x004b, 0x0042, 0x007a,
- 0x005b, 0x0049, 0x0038, 0x002a, 0x0040, 0x002c, 0x0015, 0x0019,
- 0x005a, 0x002b, 0x0029, 0x004d, 0x0049, 0x003f, 0x0038, 0x005c,
- 0x004d, 0x0042, 0x002f, 0x0043, 0x0030, 0x0035, 0x0024, 0x0014,
- 0x0047, 0x0022, 0x0043, 0x003c, 0x003a, 0x0031, 0x0058, 0x004c,
- 0x0043, 0x006a, 0x0047, 0x0036, 0x0026, 0x0027, 0x0017, 0x000f,
- 0x006d, 0x0035, 0x0033, 0x002f, 0x005a, 0x0052, 0x003a, 0x0039,
- 0x0030, 0x0048, 0x0039, 0x0029, 0x0017, 0x001b, 0x003e, 0x0009,
- 0x0056, 0x002a, 0x0028, 0x0025, 0x0046, 0x0040, 0x0034, 0x002b,
- 0x0046, 0x0037, 0x002a, 0x0019, 0x001d, 0x0012, 0x000b, 0x000b,
- 0x0076, 0x0044, 0x001e, 0x0037, 0x0032, 0x002e, 0x004a, 0x0041,
- 0x0031, 0x0027, 0x0018, 0x0010, 0x0016, 0x000d, 0x000e, 0x0007,
- 0x005b, 0x002c, 0x0027, 0x0026, 0x0022, 0x003f, 0x0034, 0x002d,
- 0x001f, 0x0034, 0x001c, 0x0013, 0x000e, 0x0008, 0x0009, 0x0003,
- 0x007b, 0x003c, 0x003a, 0x0035, 0x002f, 0x002b, 0x0020, 0x0016,
- 0x0025, 0x0018, 0x0011, 0x000c, 0x000f, 0x000a, 0x0002, 0x0001,
- 0x0047, 0x0025, 0x0022, 0x001e, 0x001c, 0x0014, 0x0011, 0x001a,
- 0x0015, 0x0010, 0x000a, 0x0006, 0x0008, 0x0006, 0x0002, 0x0000,
-};
-
-static const uint8_t mpa_huffbits_15[256] = {
-  3,  4,  5,  7,  7,  8,  9,  9,
-  9, 10, 10, 11, 11, 11, 12, 13,
-  4,  3,  5,  6,  7,  7,  8,  8,
-  8,  9,  9, 10, 10, 10, 11, 11,
-  5,  5,  5,  6,  7,  7,  8,  8,
-  8,  9,  9, 10, 10, 11, 11, 11,
-  6,  6,  6,  7,  7,  8,  8,  9,
-  9,  9, 10, 10, 10, 11, 11, 11,
-  7,  6,  7,  7,  8,  8,  9,  9,
-  9,  9, 10, 10, 10, 11, 11, 11,
-  8,  7,  7,  8,  8,  8,  9,  9,
-  9,  9, 10, 10, 11, 11, 11, 12,
-  9,  7,  8,  8,  8,  9,  9,  9,
-  9, 10, 10, 10, 11, 11, 12, 12,
-  9,  8,  8,  9,  9,  9,  9, 10,
- 10, 10, 10, 10, 11, 11, 11, 12,
-  9,  8,  8,  9,  9,  9,  9, 10,
- 10, 10, 10, 11, 11, 12, 12, 12,
-  9,  8,  9,  9,  9,  9, 10, 10,
- 10, 11, 11, 11, 11, 12, 12, 12,
- 10,  9,  9,  9, 10, 10, 10, 10,
- 10, 11, 11, 11, 11, 12, 13, 12,
- 10,  9,  9,  9, 10, 10, 10, 10,
- 11, 11, 11, 11, 12, 12, 12, 13,
- 11, 10,  9, 10, 10, 10, 11, 11,
- 11, 11, 11, 11, 12, 12, 13, 13,
- 11, 10, 10, 10, 10, 11, 11, 11,
- 11, 12, 12, 12, 12, 12, 13, 13,
- 12, 11, 11, 11, 11, 11, 11, 11,
- 12, 12, 12, 12, 13, 13, 12, 13,
- 12, 11, 11, 11, 11, 11, 11, 12,
- 12, 12, 12, 12, 13, 13, 13, 13,
-};
-
-static const uint16_t mpa_huffcodes_16[256] = {
- 0x0001, 0x0005, 0x000e, 0x002c, 0x004a, 0x003f, 0x006e, 0x005d,
- 0x00ac, 0x0095, 0x008a, 0x00f2, 0x00e1, 0x00c3, 0x0178, 0x0011,
- 0x0003, 0x0004, 0x000c, 0x0014, 0x0023, 0x003e, 0x0035, 0x002f,
- 0x0053, 0x004b, 0x0044, 0x0077, 0x00c9, 0x006b, 0x00cf, 0x0009,
- 0x000f, 0x000d, 0x0017, 0x0026, 0x0043, 0x003a, 0x0067, 0x005a,
- 0x00a1, 0x0048, 0x007f, 0x0075, 0x006e, 0x00d1, 0x00ce, 0x0010,
- 0x002d, 0x0015, 0x0027, 0x0045, 0x0040, 0x0072, 0x0063, 0x0057,
- 0x009e, 0x008c, 0x00fc, 0x00d4, 0x00c7, 0x0183, 0x016d, 0x001a,
- 0x004b, 0x0024, 0x0044, 0x0041, 0x0073, 0x0065, 0x00b3, 0x00a4,
- 0x009b, 0x0108, 0x00f6, 0x00e2, 0x018b, 0x017e, 0x016a, 0x0009,
- 0x0042, 0x001e, 0x003b, 0x0038, 0x0066, 0x00b9, 0x00ad, 0x0109,
- 0x008e, 0x00fd, 0x00e8, 0x0190, 0x0184, 0x017a, 0x01bd, 0x0010,
- 0x006f, 0x0036, 0x0034, 0x0064, 0x00b8, 0x00b2, 0x00a0, 0x0085,
- 0x0101, 0x00f4, 0x00e4, 0x00d9, 0x0181, 0x016e, 0x02cb, 0x000a,
- 0x0062, 0x0030, 0x005b, 0x0058, 0x00a5, 0x009d, 0x0094, 0x0105,
- 0x00f8, 0x0197, 0x018d, 0x0174, 0x017c, 0x0379, 0x0374, 0x0008,
- 0x0055, 0x0054, 0x0051, 0x009f, 0x009c, 0x008f, 0x0104, 0x00f9,
- 0x01ab, 0x0191, 0x0188, 0x017f, 0x02d7, 0x02c9, 0x02c4, 0x0007,
- 0x009a, 0x004c, 0x0049, 0x008d, 0x0083, 0x0100, 0x00f5, 0x01aa,
- 0x0196, 0x018a, 0x0180, 0x02df, 0x0167, 0x02c6, 0x0160, 0x000b,
- 0x008b, 0x0081, 0x0043, 0x007d, 0x00f7, 0x00e9, 0x00e5, 0x00db,
- 0x0189, 0x02e7, 0x02e1, 0x02d0, 0x0375, 0x0372, 0x01b7, 0x0004,
- 0x00f3, 0x0078, 0x0076, 0x0073, 0x00e3, 0x00df, 0x018c, 0x02ea,
- 0x02e6, 0x02e0, 0x02d1, 0x02c8, 0x02c2, 0x00df, 0x01b4, 0x0006,
- 0x00ca, 0x00e0, 0x00de, 0x00da, 0x00d8, 0x0185, 0x0182, 0x017d,
- 0x016c, 0x0378, 0x01bb, 0x02c3, 0x01b8, 0x01b5, 0x06c0, 0x0004,
- 0x02eb, 0x00d3, 0x00d2, 0x00d0, 0x0172, 0x017b, 0x02de, 0x02d3,
- 0x02ca, 0x06c7, 0x0373, 0x036d, 0x036c, 0x0d83, 0x0361, 0x0002,
- 0x0179, 0x0171, 0x0066, 0x00bb, 0x02d6, 0x02d2, 0x0166, 0x02c7,
- 0x02c5, 0x0362, 0x06c6, 0x0367, 0x0d82, 0x0366, 0x01b2, 0x0000,
- 0x000c, 0x000a, 0x0007, 0x000b, 0x000a, 0x0011, 0x000b, 0x0009,
- 0x000d, 0x000c, 0x000a, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003,
-};
-
-static const uint8_t mpa_huffbits_16[256] = {
-  1,  4,  6,  8,  9,  9, 10, 10,
- 11, 11, 11, 12, 12, 12, 13,  9,
-  3,  4,  6,  7,  8,  9,  9,  9,
- 10, 10, 10, 11, 12, 11, 12,  8,
-  6,  6,  7,  8,  9,  9, 10, 10,
- 11, 10, 11, 11, 11, 12, 12,  9,
-  8,  7,  8,  9,  9, 10, 10, 10,
- 11, 11, 12, 12, 12, 13, 13, 10,
-  9,  8,  9,  9, 10, 10, 11, 11,
- 11, 12, 12, 12, 13, 13, 13,  9,
-  9,  8,  9,  9, 10, 11, 11, 12,
- 11, 12, 12, 13, 13, 13, 14, 10,
- 10,  9,  9, 10, 11, 11, 11, 11,
- 12, 12, 12, 12, 13, 13, 14, 10,
- 10,  9, 10, 10, 11, 11, 11, 12,
- 12, 13, 13, 13, 13, 15, 15, 10,
- 10, 10, 10, 11, 11, 11, 12, 12,
- 13, 13, 13, 13, 14, 14, 14, 10,
- 11, 10, 10, 11, 11, 12, 12, 13,
- 13, 13, 13, 14, 13, 14, 13, 11,
- 11, 11, 10, 11, 12, 12, 12, 12,
- 13, 14, 14, 14, 15, 15, 14, 10,
- 12, 11, 11, 11, 12, 12, 13, 14,
- 14, 14, 14, 14, 14, 13, 14, 11,
- 12, 12, 12, 12, 12, 13, 13, 13,
- 13, 15, 14, 14, 14, 14, 16, 11,
- 14, 12, 12, 12, 13, 13, 14, 14,
- 14, 16, 15, 15, 15, 17, 15, 11,
- 13, 13, 11, 12, 14, 14, 13, 14,
- 14, 15, 16, 15, 17, 15, 14, 11,
-  9,  8,  8,  9,  9, 10, 10, 10,
- 11, 11, 11, 11, 11, 11, 11,  8,
-};
-
-static const uint16_t mpa_huffcodes_24[256] = {
- 0x000f, 0x000d, 0x002e, 0x0050, 0x0092, 0x0106, 0x00f8, 0x01b2,
- 0x01aa, 0x029d, 0x028d, 0x0289, 0x026d, 0x0205, 0x0408, 0x0058,
- 0x000e, 0x000c, 0x0015, 0x0026, 0x0047, 0x0082, 0x007a, 0x00d8,
- 0x00d1, 0x00c6, 0x0147, 0x0159, 0x013f, 0x0129, 0x0117, 0x002a,
- 0x002f, 0x0016, 0x0029, 0x004a, 0x0044, 0x0080, 0x0078, 0x00dd,
- 0x00cf, 0x00c2, 0x00b6, 0x0154, 0x013b, 0x0127, 0x021d, 0x0012,
- 0x0051, 0x0027, 0x004b, 0x0046, 0x0086, 0x007d, 0x0074, 0x00dc,
- 0x00cc, 0x00be, 0x00b2, 0x0145, 0x0137, 0x0125, 0x010f, 0x0010,
- 0x0093, 0x0048, 0x0045, 0x0087, 0x007f, 0x0076, 0x0070, 0x00d2,
- 0x00c8, 0x00bc, 0x0160, 0x0143, 0x0132, 0x011d, 0x021c, 0x000e,
- 0x0107, 0x0042, 0x0081, 0x007e, 0x0077, 0x0072, 0x00d6, 0x00ca,
- 0x00c0, 0x00b4, 0x0155, 0x013d, 0x012d, 0x0119, 0x0106, 0x000c,
- 0x00f9, 0x007b, 0x0079, 0x0075, 0x0071, 0x00d7, 0x00ce, 0x00c3,
- 0x00b9, 0x015b, 0x014a, 0x0134, 0x0123, 0x0110, 0x0208, 0x000a,
- 0x01b3, 0x0073, 0x006f, 0x006d, 0x00d3, 0x00cb, 0x00c4, 0x00bb,
- 0x0161, 0x014c, 0x0139, 0x012a, 0x011b, 0x0213, 0x017d, 0x0011,
- 0x01ab, 0x00d4, 0x00d0, 0x00cd, 0x00c9, 0x00c1, 0x00ba, 0x00b1,
- 0x00a9, 0x0140, 0x012f, 0x011e, 0x010c, 0x0202, 0x0179, 0x0010,
- 0x014f, 0x00c7, 0x00c5, 0x00bf, 0x00bd, 0x00b5, 0x00ae, 0x014d,
- 0x0141, 0x0131, 0x0121, 0x0113, 0x0209, 0x017b, 0x0173, 0x000b,
- 0x029c, 0x00b8, 0x00b7, 0x00b3, 0x00af, 0x0158, 0x014b, 0x013a,
- 0x0130, 0x0122, 0x0115, 0x0212, 0x017f, 0x0175, 0x016e, 0x000a,
- 0x028c, 0x015a, 0x00ab, 0x00a8, 0x00a4, 0x013e, 0x0135, 0x012b,
- 0x011f, 0x0114, 0x0107, 0x0201, 0x0177, 0x0170, 0x016a, 0x0006,
- 0x0288, 0x0142, 0x013c, 0x0138, 0x0133, 0x012e, 0x0124, 0x011c,
- 0x010d, 0x0105, 0x0200, 0x0178, 0x0172, 0x016c, 0x0167, 0x0004,
- 0x026c, 0x012c, 0x0128, 0x0126, 0x0120, 0x011a, 0x0111, 0x010a,
- 0x0203, 0x017c, 0x0176, 0x0171, 0x016d, 0x0169, 0x0165, 0x0002,
- 0x0409, 0x0118, 0x0116, 0x0112, 0x010b, 0x0108, 0x0103, 0x017e,
- 0x017a, 0x0174, 0x016f, 0x016b, 0x0168, 0x0166, 0x0164, 0x0000,
- 0x002b, 0x0014, 0x0013, 0x0011, 0x000f, 0x000d, 0x000b, 0x0009,
- 0x0007, 0x0006, 0x0004, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003,
-};
-
-static const uint8_t mpa_huffbits_24[256] = {
-  4,  4,  6,  7,  8,  9,  9, 10,
- 10, 11, 11, 11, 11, 11, 12,  9,
-  4,  4,  5,  6,  7,  8,  8,  9,
-  9,  9, 10, 10, 10, 10, 10,  8,
-  6,  5,  6,  7,  7,  8,  8,  9,
-  9,  9,  9, 10, 10, 10, 11,  7,
-  7,  6,  7,  7,  8,  8,  8,  9,
-  9,  9,  9, 10, 10, 10, 10,  7,
-  8,  7,  7,  8,  8,  8,  8,  9,
-  9,  9, 10, 10, 10, 10, 11,  7,
-  9,  7,  8,  8,  8,  8,  9,  9,
-  9,  9, 10, 10, 10, 10, 10,  7,
-  9,  8,  8,  8,  8,  9,  9,  9,
-  9, 10, 10, 10, 10, 10, 11,  7,
- 10,  8,  8,  8,  9,  9,  9,  9,
- 10, 10, 10, 10, 10, 11, 11,  8,
- 10,  9,  9,  9,  9,  9,  9,  9,
-  9, 10, 10, 10, 10, 11, 11,  8,
- 10,  9,  9,  9,  9,  9,  9, 10,
- 10, 10, 10, 10, 11, 11, 11,  8,
- 11,  9,  9,  9,  9, 10, 10, 10,
- 10, 10, 10, 11, 11, 11, 11,  8,
- 11, 10,  9,  9,  9, 10, 10, 10,
- 10, 10, 10, 11, 11, 11, 11,  8,
- 11, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 11, 11, 11, 11, 11,  8,
- 11, 10, 10, 10, 10, 10, 10, 10,
- 11, 11, 11, 11, 11, 11, 11,  8,
- 12, 10, 10, 10, 10, 10, 10, 11,
- 11, 11, 11, 11, 11, 11, 11,  8,
-  8,  7,  7,  7,  7,  7,  7,  7,
-  7,  7,  7,  8,  8,  8,  8,  4,
-};
-
-static const HuffTable mpa_huff_tables[16] = {
-{ 1, NULL, NULL },
-{ 2, mpa_huffbits_1, mpa_huffcodes_1 },
-{ 3, mpa_huffbits_2, mpa_huffcodes_2 },
-{ 3, mpa_huffbits_3, mpa_huffcodes_3 },
-{ 4, mpa_huffbits_5, mpa_huffcodes_5 },
-{ 4, mpa_huffbits_6, mpa_huffcodes_6 },
-{ 6, mpa_huffbits_7, mpa_huffcodes_7 },
-{ 6, mpa_huffbits_8, mpa_huffcodes_8 },
-{ 6, mpa_huffbits_9, mpa_huffcodes_9 },
-{ 8, mpa_huffbits_10, mpa_huffcodes_10 },
-{ 8, mpa_huffbits_11, mpa_huffcodes_11 },
-{ 8, mpa_huffbits_12, mpa_huffcodes_12 },
-{ 16, mpa_huffbits_13, mpa_huffcodes_13 },
-{ 16, mpa_huffbits_15, mpa_huffcodes_15 },
-{ 16, mpa_huffbits_16, mpa_huffcodes_16 },
-{ 16, mpa_huffbits_24, mpa_huffcodes_24 },
-};
-
-static const uint8_t mpa_huff_data[32][2] = {
-{ 0, 0 },
-{ 1, 0 },
-{ 2, 0 },
-{ 3, 0 },
-{ 0, 0 },
-{ 4, 0 },
-{ 5, 0 },
-{ 6, 0 },
-{ 7, 0 },
-{ 8, 0 },
-{ 9, 0 },
-{ 10, 0 },
-{ 11, 0 },
-{ 12, 0 },
-{ 0, 0 },
-{ 13, 0 },
-{ 14, 1 },
-{ 14, 2 },
-{ 14, 3 },
-{ 14, 4 },
-{ 14, 6 },
-{ 14, 8 },
-{ 14, 10 },
-{ 14, 13 },
-{ 15, 4 },
-{ 15, 5 },
-{ 15, 6 },
-{ 15, 7 },
-{ 15, 8 },
-{ 15, 9 },
-{ 15, 11 },
-{ 15, 13 },
-};
-
-
-/* huffman tables for quadrules */
-static const uint8_t mpa_quad_codes[2][16] = {
-    {  1,  5,  4,  5,  6,  5,  4,  4, 7,  3,  6,  0,  7,  2,  3,  1, },
-    { 15, 14, 13, 12, 11, 10,  9,  8, 7,  6,  5,  4,  3,  2,  1,  0, },
-};
-
-static const uint8_t mpa_quad_bits[2][16] = {
-    { 1, 4, 4, 5, 4, 6, 5, 6, 4, 5, 5, 6, 5, 6, 6, 6, },
-    { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, },
-};
-
-/* band size tables */
-static const uint8_t band_size_long[9][22] = {
-{ 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
-  12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158, }, /* 44100 */
-{ 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10,
-  12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192, }, /* 48000 */
-{ 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12,
-  16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26, }, /* 32000 */
-{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
-  20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 22050 */
-{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
-  18, 22, 26, 32, 38, 46, 52, 64, 70, 76, 36, }, /* 24000 */
-{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
-  20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 16000 */
-{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
-  20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 11025 */
-{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
-  20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 12000 */
-{ 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32,
-  40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2, }, /* 8000 */
-};
-
-static const uint8_t band_size_short[9][13] = {
-{ 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56, }, /* 44100 */
-{ 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66, }, /* 48000 */
-{ 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12, }, /* 32000 */
-{ 4, 4, 4, 6, 6, 8, 10, 14, 18, 26, 32, 42, 18, }, /* 22050 */
-{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 32, 44, 12, }, /* 24000 */
-{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18, }, /* 16000 */
-{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18, }, /* 11025 */
-{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18, }, /* 12000 */
-{ 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26, }, /* 8000 */
-};
-
-static const uint8_t mpa_pretab[2][22] = {
-    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 },
-};
-
-/* table for alias reduction (XXX: store it as integer !) */
-static const float ci_table[8] = {
-    -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037,
-};
-
-#endif /* AVCODEC_MPEGAUDIODECTAB_H */
diff --git a/libavcodec/mpegaudioenc.c b/libavcodec/mpegaudioenc.c
deleted file mode 100644
index 264175e..0000000
--- a/libavcodec/mpegaudioenc.c
+++ /dev/null
@@ -1,805 +0,0 @@
-/*
- * The simplest mpeg audio layer 2 encoder
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * The simplest mpeg audio layer 2 encoder.
- */
-
-#include "avcodec.h"
-#include "put_bits.h"
-
-#undef  CONFIG_MPEGAUDIO_HP
-#define CONFIG_MPEGAUDIO_HP 0
-#include "mpegaudio.h"
-
-/* currently, cannot change these constants (need to modify
-   quantization stage) */
-#define MUL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS)
-
-#define SAMPLES_BUF_SIZE 4096
-
-typedef struct MpegAudioContext {
-    PutBitContext pb;
-    int nb_channels;
-    int freq, bit_rate;
-    int lsf;           /* 1 if mpeg2 low bitrate selected */
-    int bitrate_index; /* bit rate */
-    int freq_index;
-    int frame_size; /* frame size, in bits, without padding */
-    int64_t nb_samples; /* total number of samples encoded */
-    /* padding computation */
-    int frame_frac, frame_frac_incr, do_padding;
-    short samples_buf[MPA_MAX_CHANNELS][SAMPLES_BUF_SIZE]; /* buffer for filter */
-    int samples_offset[MPA_MAX_CHANNELS];       /* offset in samples_buf */
-    int sb_samples[MPA_MAX_CHANNELS][3][12][SBLIMIT];
-    unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3]; /* scale factors */
-    /* code to group 3 scale factors */
-    unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT];
-    int sblimit; /* number of used subbands */
-    const unsigned char *alloc_table;
-} MpegAudioContext;
-
-/* define it to use floats in quantization (I don't like floats !) */
-#define USE_FLOATS
-
-#include "mpegaudiodata.h"
-#include "mpegaudiotab.h"
-
-static av_cold int MPA_encode_init(AVCodecContext *avctx)
-{
-    MpegAudioContext *s = avctx->priv_data;
-    int freq = avctx->sample_rate;
-    int bitrate = avctx->bit_rate;
-    int channels = avctx->channels;
-    int i, v, table;
-    float a;
-
-    if (channels <= 0 || channels > 2){
-        av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed in mp2\n", channels);
-        return -1;
-    }
-    bitrate = bitrate / 1000;
-    s->nb_channels = channels;
-    s->freq = freq;
-    s->bit_rate = bitrate * 1000;
-    avctx->frame_size = MPA_FRAME_SIZE;
-
-    /* encoding freq */
-    s->lsf = 0;
-    for(i=0;i<3;i++) {
-        if (ff_mpa_freq_tab[i] == freq)
-            break;
-        if ((ff_mpa_freq_tab[i] / 2) == freq) {
-            s->lsf = 1;
-            break;
-        }
-    }
-    if (i == 3){
-        av_log(avctx, AV_LOG_ERROR, "Sampling rate %d is not allowed in mp2\n", freq);
-        return -1;
-    }
-    s->freq_index = i;
-
-    /* encoding bitrate & frequency */
-    for(i=0;i<15;i++) {
-        if (ff_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
-            break;
-    }
-    if (i == 15){
-        av_log(avctx, AV_LOG_ERROR, "bitrate %d is not allowed in mp2\n", bitrate);
-        return -1;
-    }
-    s->bitrate_index = i;
-
-    /* compute total header size & pad bit */
-
-    a = (float)(bitrate * 1000 * MPA_FRAME_SIZE) / (freq * 8.0);
-    s->frame_size = ((int)a) * 8;
-
-    /* frame fractional size to compute padding */
-    s->frame_frac = 0;
-    s->frame_frac_incr = (int)((a - floor(a)) * 65536.0);
-
-    /* select the right allocation table */
-    table = ff_mpa_l2_select_table(bitrate, s->nb_channels, freq, s->lsf);
-
-    /* number of used subbands */
-    s->sblimit = ff_mpa_sblimit_table[table];
-    s->alloc_table = ff_mpa_alloc_tables[table];
-
-    dprintf(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n",
-            bitrate, freq, s->frame_size, table, s->frame_frac_incr);
-
-    for(i=0;i<s->nb_channels;i++)
-        s->samples_offset[i] = 0;
-
-    for(i=0;i<257;i++) {
-        int v;
-        v = ff_mpa_enwindow[i];
-#if WFRAC_BITS != 16
-        v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
-#endif
-        filter_bank[i] = v;
-        if ((i & 63) != 0)
-            v = -v;
-        if (i != 0)
-            filter_bank[512 - i] = v;
-    }
-
-    for(i=0;i<64;i++) {
-        v = (int)(pow(2.0, (3 - i) / 3.0) * (1 << 20));
-        if (v <= 0)
-            v = 1;
-        scale_factor_table[i] = v;
-#ifdef USE_FLOATS
-        scale_factor_inv_table[i] = pow(2.0, -(3 - i) / 3.0) / (float)(1 << 20);
-#else
-#define P 15
-        scale_factor_shift[i] = 21 - P - (i / 3);
-        scale_factor_mult[i] = (1 << P) * pow(2.0, (i % 3) / 3.0);
-#endif
-    }
-    for(i=0;i<128;i++) {
-        v = i - 64;
-        if (v <= -3)
-            v = 0;
-        else if (v < 0)
-            v = 1;
-        else if (v == 0)
-            v = 2;
-        else if (v < 3)
-            v = 3;
-        else
-            v = 4;
-        scale_diff_table[i] = v;
-    }
-
-    for(i=0;i<17;i++) {
-        v = ff_mpa_quant_bits[i];
-        if (v < 0)
-            v = -v;
-        else
-            v = v * 3;
-        total_quant_bits[i] = 12 * v;
-    }
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    return 0;
-}
-
-/* 32 point floating point IDCT without 1/sqrt(2) coef zero scaling */
-static void idct32(int *out, int *tab)
-{
-    int i, j;
-    int *t, *t1, xr;
-    const int *xp = costab32;
-
-    for(j=31;j>=3;j-=2) tab[j] += tab[j - 2];
-
-    t = tab + 30;
-    t1 = tab + 2;
-    do {
-        t[0] += t[-4];
-        t[1] += t[1 - 4];
-        t -= 4;
-    } while (t != t1);
-
-    t = tab + 28;
-    t1 = tab + 4;
-    do {
-        t[0] += t[-8];
-        t[1] += t[1-8];
-        t[2] += t[2-8];
-        t[3] += t[3-8];
-        t -= 8;
-    } while (t != t1);
-
-    t = tab;
-    t1 = tab + 32;
-    do {
-        t[ 3] = -t[ 3];
-        t[ 6] = -t[ 6];
-
-        t[11] = -t[11];
-        t[12] = -t[12];
-        t[13] = -t[13];
-        t[15] = -t[15];
-        t += 16;
-    } while (t != t1);
-
-
-    t = tab;
-    t1 = tab + 8;
-    do {
-        int x1, x2, x3, x4;
-
-        x3 = MUL(t[16], FIX(SQRT2*0.5));
-        x4 = t[0] - x3;
-        x3 = t[0] + x3;
-
-        x2 = MUL(-(t[24] + t[8]), FIX(SQRT2*0.5));
-        x1 = MUL((t[8] - x2), xp[0]);
-        x2 = MUL((t[8] + x2), xp[1]);
-
-        t[ 0] = x3 + x1;
-        t[ 8] = x4 - x2;
-        t[16] = x4 + x2;
-        t[24] = x3 - x1;
-        t++;
-    } while (t != t1);
-
-    xp += 2;
-    t = tab;
-    t1 = tab + 4;
-    do {
-        xr = MUL(t[28],xp[0]);
-        t[28] = (t[0] - xr);
-        t[0] = (t[0] + xr);
-
-        xr = MUL(t[4],xp[1]);
-        t[ 4] = (t[24] - xr);
-        t[24] = (t[24] + xr);
-
-        xr = MUL(t[20],xp[2]);
-        t[20] = (t[8] - xr);
-        t[ 8] = (t[8] + xr);
-
-        xr = MUL(t[12],xp[3]);
-        t[12] = (t[16] - xr);
-        t[16] = (t[16] + xr);
-        t++;
-    } while (t != t1);
-    xp += 4;
-
-    for (i = 0; i < 4; i++) {
-        xr = MUL(tab[30-i*4],xp[0]);
-        tab[30-i*4] = (tab[i*4] - xr);
-        tab[   i*4] = (tab[i*4] + xr);
-
-        xr = MUL(tab[ 2+i*4],xp[1]);
-        tab[ 2+i*4] = (tab[28-i*4] - xr);
-        tab[28-i*4] = (tab[28-i*4] + xr);
-
-        xr = MUL(tab[31-i*4],xp[0]);
-        tab[31-i*4] = (tab[1+i*4] - xr);
-        tab[ 1+i*4] = (tab[1+i*4] + xr);
-
-        xr = MUL(tab[ 3+i*4],xp[1]);
-        tab[ 3+i*4] = (tab[29-i*4] - xr);
-        tab[29-i*4] = (tab[29-i*4] + xr);
-
-        xp += 2;
-    }
-
-    t = tab + 30;
-    t1 = tab + 1;
-    do {
-        xr = MUL(t1[0], *xp);
-        t1[0] = (t[0] - xr);
-        t[0] = (t[0] + xr);
-        t -= 2;
-        t1 += 2;
-        xp++;
-    } while (t >= tab);
-
-    for(i=0;i<32;i++) {
-        out[i] = tab[bitinv32[i]];
-    }
-}
-
-#define WSHIFT (WFRAC_BITS + 15 - FRAC_BITS)
-
-static void filter(MpegAudioContext *s, int ch, short *samples, int incr)
-{
-    short *p, *q;
-    int sum, offset, i, j;
-    int tmp[64];
-    int tmp1[32];
-    int *out;
-
-    //    print_pow1(samples, 1152);
-
-    offset = s->samples_offset[ch];
-    out = &s->sb_samples[ch][0][0][0];
-    for(j=0;j<36;j++) {
-        /* 32 samples at once */
-        for(i=0;i<32;i++) {
-            s->samples_buf[ch][offset + (31 - i)] = samples[0];
-            samples += incr;
-        }
-
-        /* filter */
-        p = s->samples_buf[ch] + offset;
-        q = filter_bank;
-        /* maxsum = 23169 */
-        for(i=0;i<64;i++) {
-            sum = p[0*64] * q[0*64];
-            sum += p[1*64] * q[1*64];
-            sum += p[2*64] * q[2*64];
-            sum += p[3*64] * q[3*64];
-            sum += p[4*64] * q[4*64];
-            sum += p[5*64] * q[5*64];
-            sum += p[6*64] * q[6*64];
-            sum += p[7*64] * q[7*64];
-            tmp[i] = sum;
-            p++;
-            q++;
-        }
-        tmp1[0] = tmp[16] >> WSHIFT;
-        for( i=1; i<=16; i++ ) tmp1[i] = (tmp[i+16]+tmp[16-i]) >> WSHIFT;
-        for( i=17; i<=31; i++ ) tmp1[i] = (tmp[i+16]-tmp[80-i]) >> WSHIFT;
-
-        idct32(out, tmp1);
-
-        /* advance of 32 samples */
-        offset -= 32;
-        out += 32;
-        /* handle the wrap around */
-        if (offset < 0) {
-            memmove(s->samples_buf[ch] + SAMPLES_BUF_SIZE - (512 - 32),
-                    s->samples_buf[ch], (512 - 32) * 2);
-            offset = SAMPLES_BUF_SIZE - 512;
-        }
-    }
-    s->samples_offset[ch] = offset;
-
-    //    print_pow(s->sb_samples, 1152);
-}
-
-static void compute_scale_factors(unsigned char scale_code[SBLIMIT],
-                                  unsigned char scale_factors[SBLIMIT][3],
-                                  int sb_samples[3][12][SBLIMIT],
-                                  int sblimit)
-{
-    int *p, vmax, v, n, i, j, k, code;
-    int index, d1, d2;
-    unsigned char *sf = &scale_factors[0][0];
-
-    for(j=0;j<sblimit;j++) {
-        for(i=0;i<3;i++) {
-            /* find the max absolute value */
-            p = &sb_samples[i][0][j];
-            vmax = abs(*p);
-            for(k=1;k<12;k++) {
-                p += SBLIMIT;
-                v = abs(*p);
-                if (v > vmax)
-                    vmax = v;
-            }
-            /* compute the scale factor index using log 2 computations */
-            if (vmax > 1) {
-                n = av_log2(vmax);
-                /* n is the position of the MSB of vmax. now
-                   use at most 2 compares to find the index */
-                index = (21 - n) * 3 - 3;
-                if (index >= 0) {
-                    while (vmax <= scale_factor_table[index+1])
-                        index++;
-                } else {
-                    index = 0; /* very unlikely case of overflow */
-                }
-            } else {
-                index = 62; /* value 63 is not allowed */
-            }
-
-#if 0
-            printf("%2d:%d in=%x %x %d\n",
-                   j, i, vmax, scale_factor_table[index], index);
-#endif
-            /* store the scale factor */
-            assert(index >=0 && index <= 63);
-            sf[i] = index;
-        }
-
-        /* compute the transmission factor : look if the scale factors
-           are close enough to each other */
-        d1 = scale_diff_table[sf[0] - sf[1] + 64];
-        d2 = scale_diff_table[sf[1] - sf[2] + 64];
-
-        /* handle the 25 cases */
-        switch(d1 * 5 + d2) {
-        case 0*5+0:
-        case 0*5+4:
-        case 3*5+4:
-        case 4*5+0:
-        case 4*5+4:
-            code = 0;
-            break;
-        case 0*5+1:
-        case 0*5+2:
-        case 4*5+1:
-        case 4*5+2:
-            code = 3;
-            sf[2] = sf[1];
-            break;
-        case 0*5+3:
-        case 4*5+3:
-            code = 3;
-            sf[1] = sf[2];
-            break;
-        case 1*5+0:
-        case 1*5+4:
-        case 2*5+4:
-            code = 1;
-            sf[1] = sf[0];
-            break;
-        case 1*5+1:
-        case 1*5+2:
-        case 2*5+0:
-        case 2*5+1:
-        case 2*5+2:
-            code = 2;
-            sf[1] = sf[2] = sf[0];
-            break;
-        case 2*5+3:
-        case 3*5+3:
-            code = 2;
-            sf[0] = sf[1] = sf[2];
-            break;
-        case 3*5+0:
-        case 3*5+1:
-        case 3*5+2:
-            code = 2;
-            sf[0] = sf[2] = sf[1];
-            break;
-        case 1*5+3:
-            code = 2;
-            if (sf[0] > sf[2])
-              sf[0] = sf[2];
-            sf[1] = sf[2] = sf[0];
-            break;
-        default:
-            assert(0); //cannot happen
-            code = 0;           /* kill warning */
-        }
-
-#if 0
-        printf("%d: %2d %2d %2d %d %d -> %d\n", j,
-               sf[0], sf[1], sf[2], d1, d2, code);
-#endif
-        scale_code[j] = code;
-        sf += 3;
-    }
-}
-
-/* The most important function : psycho acoustic module. In this
-   encoder there is basically none, so this is the worst you can do,
-   but also this is the simpler. */
-static void psycho_acoustic_model(MpegAudioContext *s, short smr[SBLIMIT])
-{
-    int i;
-
-    for(i=0;i<s->sblimit;i++) {
-        smr[i] = (int)(fixed_smr[i] * 10);
-    }
-}
-
-
-#define SB_NOTALLOCATED  0
-#define SB_ALLOCATED     1
-#define SB_NOMORE        2
-
-/* Try to maximize the smr while using a number of bits inferior to
-   the frame size. I tried to make the code simpler, faster and
-   smaller than other encoders :-) */
-static void compute_bit_allocation(MpegAudioContext *s,
-                                   short smr1[MPA_MAX_CHANNELS][SBLIMIT],
-                                   unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT],
-                                   int *padding)
-{
-    int i, ch, b, max_smr, max_ch, max_sb, current_frame_size, max_frame_size;
-    int incr;
-    short smr[MPA_MAX_CHANNELS][SBLIMIT];
-    unsigned char subband_status[MPA_MAX_CHANNELS][SBLIMIT];
-    const unsigned char *alloc;
-
-    memcpy(smr, smr1, s->nb_channels * sizeof(short) * SBLIMIT);
-    memset(subband_status, SB_NOTALLOCATED, s->nb_channels * SBLIMIT);
-    memset(bit_alloc, 0, s->nb_channels * SBLIMIT);
-
-    /* compute frame size and padding */
-    max_frame_size = s->frame_size;
-    s->frame_frac += s->frame_frac_incr;
-    if (s->frame_frac >= 65536) {
-        s->frame_frac -= 65536;
-        s->do_padding = 1;
-        max_frame_size += 8;
-    } else {
-        s->do_padding = 0;
-    }
-
-    /* compute the header + bit alloc size */
-    current_frame_size = 32;
-    alloc = s->alloc_table;
-    for(i=0;i<s->sblimit;i++) {
-        incr = alloc[0];
-        current_frame_size += incr * s->nb_channels;
-        alloc += 1 << incr;
-    }
-    for(;;) {
-        /* look for the subband with the largest signal to mask ratio */
-        max_sb = -1;
-        max_ch = -1;
-        max_smr = INT_MIN;
-        for(ch=0;ch<s->nb_channels;ch++) {
-            for(i=0;i<s->sblimit;i++) {
-                if (smr[ch][i] > max_smr && subband_status[ch][i] != SB_NOMORE) {
-                    max_smr = smr[ch][i];
-                    max_sb = i;
-                    max_ch = ch;
-                }
-            }
-        }
-#if 0
-        printf("current=%d max=%d max_sb=%d alloc=%d\n",
-               current_frame_size, max_frame_size, max_sb,
-               bit_alloc[max_sb]);
-#endif
-        if (max_sb < 0)
-            break;
-
-        /* find alloc table entry (XXX: not optimal, should use
-           pointer table) */
-        alloc = s->alloc_table;
-        for(i=0;i<max_sb;i++) {
-            alloc += 1 << alloc[0];
-        }
-
-        if (subband_status[max_ch][max_sb] == SB_NOTALLOCATED) {
-            /* nothing was coded for this band: add the necessary bits */
-            incr = 2 + nb_scale_factors[s->scale_code[max_ch][max_sb]] * 6;
-            incr += total_quant_bits[alloc[1]];
-        } else {
-            /* increments bit allocation */
-            b = bit_alloc[max_ch][max_sb];
-            incr = total_quant_bits[alloc[b + 1]] -
-                total_quant_bits[alloc[b]];
-        }
-
-        if (current_frame_size + incr <= max_frame_size) {
-            /* can increase size */
-            b = ++bit_alloc[max_ch][max_sb];
-            current_frame_size += incr;
-            /* decrease smr by the resolution we added */
-            smr[max_ch][max_sb] = smr1[max_ch][max_sb] - quant_snr[alloc[b]];
-            /* max allocation size reached ? */
-            if (b == ((1 << alloc[0]) - 1))
-                subband_status[max_ch][max_sb] = SB_NOMORE;
-            else
-                subband_status[max_ch][max_sb] = SB_ALLOCATED;
-        } else {
-            /* cannot increase the size of this subband */
-            subband_status[max_ch][max_sb] = SB_NOMORE;
-        }
-    }
-    *padding = max_frame_size - current_frame_size;
-    assert(*padding >= 0);
-
-#if 0
-    for(i=0;i<s->sblimit;i++) {
-        printf("%d ", bit_alloc[i]);
-    }
-    printf("\n");
-#endif
-}
-
-/*
- * Output the mpeg audio layer 2 frame. Note how the code is small
- * compared to other encoders :-)
- */
-static void encode_frame(MpegAudioContext *s,
-                         unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT],
-                         int padding)
-{
-    int i, j, k, l, bit_alloc_bits, b, ch;
-    unsigned char *sf;
-    int q[3];
-    PutBitContext *p = &s->pb;
-
-    /* header */
-
-    put_bits(p, 12, 0xfff);
-    put_bits(p, 1, 1 - s->lsf); /* 1 = mpeg1 ID, 0 = mpeg2 lsf ID */
-    put_bits(p, 2, 4-2);  /* layer 2 */
-    put_bits(p, 1, 1); /* no error protection */
-    put_bits(p, 4, s->bitrate_index);
-    put_bits(p, 2, s->freq_index);
-    put_bits(p, 1, s->do_padding); /* use padding */
-    put_bits(p, 1, 0);             /* private_bit */
-    put_bits(p, 2, s->nb_channels == 2 ? MPA_STEREO : MPA_MONO);
-    put_bits(p, 2, 0); /* mode_ext */
-    put_bits(p, 1, 0); /* no copyright */
-    put_bits(p, 1, 1); /* original */
-    put_bits(p, 2, 0); /* no emphasis */
-
-    /* bit allocation */
-    j = 0;
-    for(i=0;i<s->sblimit;i++) {
-        bit_alloc_bits = s->alloc_table[j];
-        for(ch=0;ch<s->nb_channels;ch++) {
-            put_bits(p, bit_alloc_bits, bit_alloc[ch][i]);
-        }
-        j += 1 << bit_alloc_bits;
-    }
-
-    /* scale codes */
-    for(i=0;i<s->sblimit;i++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            if (bit_alloc[ch][i])
-                put_bits(p, 2, s->scale_code[ch][i]);
-        }
-    }
-
-    /* scale factors */
-    for(i=0;i<s->sblimit;i++) {
-        for(ch=0;ch<s->nb_channels;ch++) {
-            if (bit_alloc[ch][i]) {
-                sf = &s->scale_factors[ch][i][0];
-                switch(s->scale_code[ch][i]) {
-                case 0:
-                    put_bits(p, 6, sf[0]);
-                    put_bits(p, 6, sf[1]);
-                    put_bits(p, 6, sf[2]);
-                    break;
-                case 3:
-                case 1:
-                    put_bits(p, 6, sf[0]);
-                    put_bits(p, 6, sf[2]);
-                    break;
-                case 2:
-                    put_bits(p, 6, sf[0]);
-                    break;
-                }
-            }
-        }
-    }
-
-    /* quantization & write sub band samples */
-
-    for(k=0;k<3;k++) {
-        for(l=0;l<12;l+=3) {
-            j = 0;
-            for(i=0;i<s->sblimit;i++) {
-                bit_alloc_bits = s->alloc_table[j];
-                for(ch=0;ch<s->nb_channels;ch++) {
-                    b = bit_alloc[ch][i];
-                    if (b) {
-                        int qindex, steps, m, sample, bits;
-                        /* we encode 3 sub band samples of the same sub band at a time */
-                        qindex = s->alloc_table[j+b];
-                        steps = ff_mpa_quant_steps[qindex];
-                        for(m=0;m<3;m++) {
-                            sample = s->sb_samples[ch][k][l + m][i];
-                            /* divide by scale factor */
-#ifdef USE_FLOATS
-                            {
-                                float a;
-                                a = (float)sample * scale_factor_inv_table[s->scale_factors[ch][i][k]];
-                                q[m] = (int)((a + 1.0) * steps * 0.5);
-                            }
-#else
-                            {
-                                int q1, e, shift, mult;
-                                e = s->scale_factors[ch][i][k];
-                                shift = scale_factor_shift[e];
-                                mult = scale_factor_mult[e];
-
-                                /* normalize to P bits */
-                                if (shift < 0)
-                                    q1 = sample << (-shift);
-                                else
-                                    q1 = sample >> shift;
-                                q1 = (q1 * mult) >> P;
-                                q[m] = ((q1 + (1 << P)) * steps) >> (P + 1);
-                            }
-#endif
-                            if (q[m] >= steps)
-                                q[m] = steps - 1;
-                            assert(q[m] >= 0 && q[m] < steps);
-                        }
-                        bits = ff_mpa_quant_bits[qindex];
-                        if (bits < 0) {
-                            /* group the 3 values to save bits */
-                            put_bits(p, -bits,
-                                     q[0] + steps * (q[1] + steps * q[2]));
-#if 0
-                            printf("%d: gr1 %d\n",
-                                   i, q[0] + steps * (q[1] + steps * q[2]));
-#endif
-                        } else {
-#if 0
-                            printf("%d: gr3 %d %d %d\n",
-                                   i, q[0], q[1], q[2]);
-#endif
-                            put_bits(p, bits, q[0]);
-                            put_bits(p, bits, q[1]);
-                            put_bits(p, bits, q[2]);
-                        }
-                    }
-                }
-                /* next subband in alloc table */
-                j += 1 << bit_alloc_bits;
-            }
-        }
-    }
-
-    /* padding */
-    for(i=0;i<padding;i++)
-        put_bits(p, 1, 0);
-
-    /* flush */
-    flush_put_bits(p);
-}
-
-static int MPA_encode_frame(AVCodecContext *avctx,
-                            unsigned char *frame, int buf_size, void *data)
-{
-    MpegAudioContext *s = avctx->priv_data;
-    short *samples = data;
-    short smr[MPA_MAX_CHANNELS][SBLIMIT];
-    unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT];
-    int padding, i;
-
-    for(i=0;i<s->nb_channels;i++) {
-        filter(s, i, samples + i, s->nb_channels);
-    }
-
-    for(i=0;i<s->nb_channels;i++) {
-        compute_scale_factors(s->scale_code[i], s->scale_factors[i],
-                              s->sb_samples[i], s->sblimit);
-    }
-    for(i=0;i<s->nb_channels;i++) {
-        psycho_acoustic_model(s, smr[i]);
-    }
-    compute_bit_allocation(s, smr, bit_alloc, &padding);
-
-    init_put_bits(&s->pb, frame, MPA_MAX_CODED_FRAME_SIZE);
-
-    encode_frame(s, bit_alloc, padding);
-
-    s->nb_samples += MPA_FRAME_SIZE;
-    return put_bits_ptr(&s->pb) - s->pb.buf;
-}
-
-static av_cold int MPA_encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-    return 0;
-}
-
-AVCodec mp2_encoder = {
-    "mp2",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP2,
-    sizeof(MpegAudioContext),
-    MPA_encode_init,
-    MPA_encode_frame,
-    MPA_encode_close,
-    NULL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .supported_samplerates= (const int[]){44100, 48000,  32000, 22050, 24000, 16000, 0},
-    .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
-};
-
-#undef FIX
diff --git a/libavcodec/mpegaudiotab.h b/libavcodec/mpegaudiotab.h
deleted file mode 100644
index 35129e6..0000000
--- a/libavcodec/mpegaudiotab.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * mpeg audio layer 2 tables. Most of them come from the mpeg audio
- * specification.
- *
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mpeg audio layer 2 tables.
- * Most of them come from the mpeg audio specification.
- */
-
-#ifndef AVCODEC_MPEGAUDIOTAB_H
-#define AVCODEC_MPEGAUDIOTAB_H
-
-#include <stdint.h>
-#include "mpegaudio.h"
-
-#define SQRT2 1.41421356237309514547
-
-static const int costab32[30] = {
-    FIX(0.54119610014619701222),
-    FIX(1.3065629648763763537),
-
-    FIX(0.50979557910415917998),
-    FIX(2.5629154477415054814),
-    FIX(0.89997622313641556513),
-    FIX(0.60134488693504528634),
-
-    FIX(0.5024192861881556782),
-    FIX(5.1011486186891552563),
-    FIX(0.78815462345125020249),
-    FIX(0.64682178335999007679),
-    FIX(0.56694403481635768927),
-    FIX(1.0606776859903470633),
-    FIX(1.7224470982383341955),
-    FIX(0.52249861493968885462),
-
-    FIX(10.19000812354803287),
-    FIX(0.674808341455005678),
-    FIX(1.1694399334328846596),
-    FIX(0.53104259108978413284),
-    FIX(2.0577810099534108446),
-    FIX(0.58293496820613388554),
-    FIX(0.83934964541552681272),
-    FIX(0.50547095989754364798),
-    FIX(3.4076084184687189804),
-    FIX(0.62250412303566482475),
-    FIX(0.97256823786196078263),
-    FIX(0.51544730992262455249),
-    FIX(1.4841646163141661852),
-    FIX(0.5531038960344445421),
-    FIX(0.74453627100229857749),
-    FIX(0.5006029982351962726),
-};
-
-static const int bitinv32[32] = {
-    0,  16,  8, 24,  4,  20,  12,  28,
-    2,  18, 10, 26,  6,  22,  14,  30,
-    1,  17,  9, 25,  5,  21,  13,  29,
-    3,  19, 11, 27,  7,  23,  15,  31
-};
-
-
-static int16_t filter_bank[512];
-
-static int scale_factor_table[64];
-#ifdef USE_FLOATS
-static float scale_factor_inv_table[64];
-#else
-static int8_t scale_factor_shift[64];
-static unsigned short scale_factor_mult[64];
-#endif
-static unsigned char scale_diff_table[128];
-
-/* total number of bits per allocation group */
-static unsigned short total_quant_bits[17];
-
-/* signal to noise ratio of each quantification step (could be
-   computed from quant_steps[]). The values are dB multiplied by 10
-*/
-static const unsigned short quant_snr[17] = {
-     70, 110, 160, 208,
-    253, 316, 378, 439,
-    499, 559, 620, 680,
-    740, 800, 861, 920,
-    980
-};
-
-/* fixed psycho acoustic model. Values of SNR taken from the 'toolame'
-   project */
-static const float fixed_smr[SBLIMIT] =  {
-    30, 17, 16, 10, 3, 12, 8, 2.5,
-    5, 5, 6, 6, 5, 6, 10, 6,
-    -4, -10, -21, -30, -42, -55, -68, -75,
-    -75, -75, -75, -75, -91, -107, -110, -108
-};
-
-static const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 };
-
-#endif /* AVCODEC_MPEGAUDIOTAB_H */
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
deleted file mode 100644
index e11fee8..0000000
--- a/libavcodec/mpegvideo.c
+++ /dev/null
@@ -1,2414 +0,0 @@
-/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * The simplest mpeg encoder (well, it was the simplest!).
- */
-
-#include "libavutil/intmath.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mpegvideo_common.h"
-#include "mjpegenc.h"
-#include "msmpeg4.h"
-#include "faandct.h"
-#include "xvmc_internal.h"
-#include <limits.h>
-
-//#undef NDEBUG
-//#include <assert.h>
-
-static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_h263_intra_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale);
-static void dct_unquantize_h263_inter_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale);
-
-
-/* enable all paranoid tests for rounding, overflows, etc... */
-//#define PARANOID
-
-//#define DEBUG
-
-
-static const uint8_t ff_default_chroma_qscale_table[32]={
-//  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
-    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
-};
-
-const uint8_t ff_mpeg1_dc_scale_table[128]={
-//  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
-    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-};
-
-static const uint8_t mpeg2_dc_scale_table1[128]={
-//  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
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-};
-
-static const uint8_t mpeg2_dc_scale_table2[128]={
-//  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
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-};
-
-static const uint8_t mpeg2_dc_scale_table3[128]={
-//  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
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-};
-
-const uint8_t * const ff_mpeg2_dc_scale_table[4]={
-    ff_mpeg1_dc_scale_table,
-    mpeg2_dc_scale_table1,
-    mpeg2_dc_scale_table2,
-    mpeg2_dc_scale_table3,
-};
-
-const enum PixelFormat ff_pixfmt_list_420[] = {
-    PIX_FMT_YUV420P,
-    PIX_FMT_NONE
-};
-
-const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = {
-    PIX_FMT_DXVA2_VLD,
-    PIX_FMT_VAAPI_VLD,
-    PIX_FMT_YUV420P,
-    PIX_FMT_NONE
-};
-
-const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){
-    int i;
-
-    assert(p<=end);
-    if(p>=end)
-        return end;
-
-    for(i=0; i<3; i++){
-        uint32_t tmp= *state << 8;
-        *state= tmp + *(p++);
-        if(tmp == 0x100 || p==end)
-            return p;
-    }
-
-    while(p<end){
-        if     (p[-1] > 1      ) p+= 3;
-        else if(p[-2]          ) p+= 2;
-        else if(p[-3]|(p[-1]-1)) p++;
-        else{
-            p++;
-            break;
-        }
-    }
-
-    p= FFMIN(p, end)-4;
-    *state= AV_RB32(p);
-
-    return p+4;
-}
-
-/* init common dct for both encoder and decoder */
-av_cold int ff_dct_common_init(MpegEncContext *s)
-{
-    s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c;
-    s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c;
-    s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c;
-    s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c;
-    s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c;
-    if(s->flags & CODEC_FLAG_BITEXACT)
-        s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
-    s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
-
-#if   HAVE_MMX
-    MPV_common_init_mmx(s);
-#elif ARCH_ALPHA
-    MPV_common_init_axp(s);
-#elif CONFIG_MLIB
-    MPV_common_init_mlib(s);
-#elif HAVE_MMI
-    MPV_common_init_mmi(s);
-#elif ARCH_ARM
-    MPV_common_init_arm(s);
-#elif HAVE_ALTIVEC
-    MPV_common_init_altivec(s);
-#elif ARCH_BFIN
-    MPV_common_init_bfin(s);
-#endif
-
-    /* load & permutate scantables
-       note: only wmv uses different ones
-    */
-    if(s->alternate_scan){
-        ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_alternate_vertical_scan);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_alternate_vertical_scan);
-    }else{
-        ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_zigzag_direct);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_zigzag_direct);
-    }
-    ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
-    ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
-
-    return 0;
-}
-
-void ff_copy_picture(Picture *dst, Picture *src){
-    *dst = *src;
-    dst->type= FF_BUFFER_TYPE_COPY;
-}
-
-/**
- * Releases a frame buffer
- */
-static void free_frame_buffer(MpegEncContext *s, Picture *pic)
-{
-    s->avctx->release_buffer(s->avctx, (AVFrame*)pic);
-    av_freep(&pic->hwaccel_picture_private);
-}
-
-/**
- * Allocates a frame buffer
- */
-static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
-{
-    int r;
-
-    if (s->avctx->hwaccel) {
-        assert(!pic->hwaccel_picture_private);
-        if (s->avctx->hwaccel->priv_data_size) {
-            pic->hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);
-            if (!pic->hwaccel_picture_private) {
-                av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
-                return -1;
-            }
-        }
-    }
-
-    r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic);
-
-    if (r<0 || !pic->age || !pic->type || !pic->data[0]) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
-        av_freep(&pic->hwaccel_picture_private);
-        return -1;
-    }
-
-    if (s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n");
-        free_frame_buffer(s, pic);
-        return -1;
-    }
-
-    if (pic->linesize[1] != pic->linesize[2]) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride mismatch)\n");
-        free_frame_buffer(s, pic);
-        return -1;
-    }
-
-    return 0;
-}
-
-/**
- * allocates a Picture
- * The pixels are allocated/set by calling get_buffer() if shared=0
- */
-int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared){
-    const int big_mb_num= s->mb_stride*(s->mb_height+1) + 1; //the +1 is needed so memset(,,stride*height) does not sig11
-    const int mb_array_size= s->mb_stride*s->mb_height;
-    const int b8_array_size= s->b8_stride*s->mb_height*2;
-    const int b4_array_size= s->b4_stride*s->mb_height*4;
-    int i;
-    int r= -1;
-
-    if(shared){
-        assert(pic->data[0]);
-        assert(pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED);
-        pic->type= FF_BUFFER_TYPE_SHARED;
-    }else{
-        assert(!pic->data[0]);
-
-        if (alloc_frame_buffer(s, pic) < 0)
-            return -1;
-
-        s->linesize  = pic->linesize[0];
-        s->uvlinesize= pic->linesize[1];
-    }
-
-    if(pic->qscale_table==NULL){
-        if (s->encoding) {
-            FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_var   , mb_array_size * sizeof(int16_t)  , fail)
-            FF_ALLOCZ_OR_GOTO(s->avctx, pic->mc_mb_var, mb_array_size * sizeof(int16_t)  , fail)
-            FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_mean  , mb_array_size * sizeof(int8_t )  , fail)
-        }
-
-        FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(uint8_t)+2, fail) //the +2 is for the slice end check
-        FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table , mb_array_size * sizeof(uint8_t)  , fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_type_base , (big_mb_num + s->mb_stride) * sizeof(uint32_t), fail)
-        pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1;
-        if(s->out_format == FMT_H264){
-            for(i=0; i<2; i++){
-                FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b4_array_size+4)  * sizeof(int16_t), fail)
-                pic->motion_val[i]= pic->motion_val_base[i]+4;
-                FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], 4*mb_array_size * sizeof(uint8_t), fail)
-            }
-            pic->motion_subsample_log2= 2;
-        }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){
-            for(i=0; i<2; i++){
-                FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b8_array_size+4) * sizeof(int16_t), fail)
-                pic->motion_val[i]= pic->motion_val_base[i]+4;
-                FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], 4*mb_array_size * sizeof(uint8_t), fail)
-            }
-            pic->motion_subsample_log2= 3;
-        }
-        if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
-            FF_ALLOCZ_OR_GOTO(s->avctx, pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6, fail)
-        }
-        pic->qstride= s->mb_stride;
-        FF_ALLOCZ_OR_GOTO(s->avctx, pic->pan_scan , 1 * sizeof(AVPanScan), fail)
-    }
-
-    /* It might be nicer if the application would keep track of these
-     * but it would require an API change. */
-    memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1);
-    s->prev_pict_types[0]= s->dropable ? FF_B_TYPE : s->pict_type;
-    if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == FF_B_TYPE)
-        pic->age= INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway.
-
-    return 0;
-fail: //for the FF_ALLOCZ_OR_GOTO macro
-    if(r>=0)
-        free_frame_buffer(s, pic);
-    return -1;
-}
-
-/**
- * deallocates a picture
- */
-static void free_picture(MpegEncContext *s, Picture *pic){
-    int i;
-
-    if(pic->data[0] && pic->type!=FF_BUFFER_TYPE_SHARED){
-        free_frame_buffer(s, pic);
-    }
-
-    av_freep(&pic->mb_var);
-    av_freep(&pic->mc_mb_var);
-    av_freep(&pic->mb_mean);
-    av_freep(&pic->mbskip_table);
-    av_freep(&pic->qscale_table);
-    av_freep(&pic->mb_type_base);
-    av_freep(&pic->dct_coeff);
-    av_freep(&pic->pan_scan);
-    pic->mb_type= NULL;
-    for(i=0; i<2; i++){
-        av_freep(&pic->motion_val_base[i]);
-        av_freep(&pic->ref_index[i]);
-    }
-
-    if(pic->type == FF_BUFFER_TYPE_SHARED){
-        for(i=0; i<4; i++){
-            pic->base[i]=
-            pic->data[i]= NULL;
-        }
-        pic->type= 0;
-    }
-}
-
-static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){
-    int i;
-
-    // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264)
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width+64)*2*21*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance
-    s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;
-
-     //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer()
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad,  (s->width+64)*4*16*2*sizeof(uint8_t), fail)
-    s->me.temp=         s->me.scratchpad;
-    s->rd_scratchpad=   s->me.scratchpad;
-    s->b_scratchpad=    s->me.scratchpad;
-    s->obmc_scratchpad= s->me.scratchpad + 16;
-    if (s->encoding) {
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->me.map      , ME_MAP_SIZE*sizeof(uint32_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail)
-        if(s->avctx->noise_reduction){
-            FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_error_sum, 2 * 64 * sizeof(int), fail)
-        }
-    }
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64*12*2 * sizeof(DCTELEM), fail)
-    s->block= s->blocks[0];
-
-    for(i=0;i<12;i++){
-        s->pblocks[i] = &s->block[i];
-    }
-    return 0;
-fail:
-    return -1; //free() through MPV_common_end()
-}
-
-static void free_duplicate_context(MpegEncContext *s){
-    if(s==NULL) return;
-
-    av_freep(&s->allocated_edge_emu_buffer); s->edge_emu_buffer= NULL;
-    av_freep(&s->me.scratchpad);
-    s->me.temp=
-    s->rd_scratchpad=
-    s->b_scratchpad=
-    s->obmc_scratchpad= NULL;
-
-    av_freep(&s->dct_error_sum);
-    av_freep(&s->me.map);
-    av_freep(&s->me.score_map);
-    av_freep(&s->blocks);
-    s->block= NULL;
-}
-
-static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src){
-#define COPY(a) bak->a= src->a
-    COPY(allocated_edge_emu_buffer);
-    COPY(edge_emu_buffer);
-    COPY(me.scratchpad);
-    COPY(me.temp);
-    COPY(rd_scratchpad);
-    COPY(b_scratchpad);
-    COPY(obmc_scratchpad);
-    COPY(me.map);
-    COPY(me.score_map);
-    COPY(blocks);
-    COPY(block);
-    COPY(start_mb_y);
-    COPY(end_mb_y);
-    COPY(me.map_generation);
-    COPY(pb);
-    COPY(dct_error_sum);
-    COPY(dct_count[0]);
-    COPY(dct_count[1]);
-#undef COPY
-}
-
-void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){
-    MpegEncContext bak;
-    int i;
-    //FIXME copy only needed parts
-//START_TIMER
-    backup_duplicate_context(&bak, dst);
-    memcpy(dst, src, sizeof(MpegEncContext));
-    backup_duplicate_context(dst, &bak);
-    for(i=0;i<12;i++){
-        dst->pblocks[i] = &dst->block[i];
-    }
-//STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads
-}
-
-/**
- * sets the given MpegEncContext to common defaults (same for encoding and decoding).
- * the changed fields will not depend upon the prior state of the MpegEncContext.
- */
-void MPV_common_defaults(MpegEncContext *s){
-    s->y_dc_scale_table=
-    s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-    s->chroma_qscale_table= ff_default_chroma_qscale_table;
-    s->progressive_frame= 1;
-    s->progressive_sequence= 1;
-    s->picture_structure= PICT_FRAME;
-
-    s->coded_picture_number = 0;
-    s->picture_number = 0;
-    s->input_picture_number = 0;
-
-    s->picture_in_gop_number = 0;
-
-    s->f_code = 1;
-    s->b_code = 1;
-}
-
-/**
- * sets the given MpegEncContext to defaults for decoding.
- * the changed fields will not depend upon the prior state of the MpegEncContext.
- */
-void MPV_decode_defaults(MpegEncContext *s){
-    MPV_common_defaults(s);
-}
-
-/**
- * init common structure for both encoder and decoder.
- * this assumes that some variables like width/height are already set
- */
-av_cold int MPV_common_init(MpegEncContext *s)
-{
-    int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads;
-
-    if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
-        s->mb_height = (s->height + 31) / 32 * 2;
-    else
-        s->mb_height = (s->height + 15) / 16;
-
-    if(s->avctx->pix_fmt == PIX_FMT_NONE){
-        av_log(s->avctx, AV_LOG_ERROR, "decoding to PIX_FMT_NONE is not supported.\n");
-        return -1;
-    }
-
-    if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){
-        av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
-        return -1;
-    }
-
-    if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height))
-        return -1;
-
-    dsputil_init(&s->dsp, s->avctx);
-    ff_dct_common_init(s);
-
-    s->flags= s->avctx->flags;
-    s->flags2= s->avctx->flags2;
-
-    s->mb_width  = (s->width  + 15) / 16;
-    s->mb_stride = s->mb_width + 1;
-    s->b8_stride = s->mb_width*2 + 1;
-    s->b4_stride = s->mb_width*4 + 1;
-    mb_array_size= s->mb_height * s->mb_stride;
-    mv_table_size= (s->mb_height+2) * s->mb_stride + 1;
-
-    /* set chroma shifts */
-    avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift),
-                                                    &(s->chroma_y_shift) );
-
-    /* set default edge pos, will be overriden in decode_header if needed */
-    s->h_edge_pos= s->mb_width*16;
-    s->v_edge_pos= s->mb_height*16;
-
-    s->mb_num = s->mb_width * s->mb_height;
-
-    s->block_wrap[0]=
-    s->block_wrap[1]=
-    s->block_wrap[2]=
-    s->block_wrap[3]= s->b8_stride;
-    s->block_wrap[4]=
-    s->block_wrap[5]= s->mb_stride;
-
-    y_size = s->b8_stride * (2 * s->mb_height + 1);
-    c_size = s->mb_stride * (s->mb_height + 1);
-    yc_size = y_size + 2 * c_size;
-
-    /* convert fourcc to upper case */
-    s->codec_tag=          toupper( s->avctx->codec_tag     &0xFF)
-                        + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )
-                        + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16)
-                        + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);
-
-    s->stream_codec_tag=          toupper( s->avctx->stream_codec_tag     &0xFF)
-                               + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 )
-                               + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)
-                               + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);
-
-    s->avctx->coded_frame= (AVFrame*)&s->current_picture;
-
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num+1)*sizeof(int), fail) //error ressilience code looks cleaner with this
-    for(y=0; y<s->mb_height; y++){
-        for(x=0; x<s->mb_width; x++){
-            s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride;
-        }
-    }
-    s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed?
-
-    if (s->encoding) {
-        /* Allocate MV tables */
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base            , mv_table_size * 2 * sizeof(int16_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base       , mv_table_size * 2 * sizeof(int16_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base       , mv_table_size * 2 * sizeof(int16_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base     , mv_table_size * 2 * sizeof(int16_t), fail)
-        s->p_mv_table           = s->p_mv_table_base            + s->mb_stride + 1;
-        s->b_forw_mv_table      = s->b_forw_mv_table_base       + s->mb_stride + 1;
-        s->b_back_mv_table      = s->b_back_mv_table_base       + s->mb_stride + 1;
-        s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1;
-        s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1;
-        s->b_direct_mv_table    = s->b_direct_mv_table_base     + s->mb_stride + 1;
-
-        if(s->msmpeg4_version){
-            FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int), fail);
-        }
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
-
-        /* Allocate MB type table */
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type  , mb_array_size * sizeof(uint16_t), fail) //needed for encoding
-
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail)
-
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix  , 64*32   * sizeof(int), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix  , 64*32   * sizeof(int), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail)
-
-        if(s->avctx->noise_reduction){
-            FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail)
-        }
-    }
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail)
-    for(i = 0; i < MAX_PICTURE_COUNT; i++) {
-        avcodec_get_frame_defaults((AVFrame *)&s->picture[i]);
-    }
-
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table, mb_array_size*sizeof(uint8_t), fail)
-
-    if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){
-        /* interlaced direct mode decoding tables */
-            for(i=0; i<2; i++){
-                int j, k;
-                for(j=0; j<2; j++){
-                    for(k=0; k<2; k++){
-                        FF_ALLOCZ_OR_GOTO(s->avctx,    s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail)
-                        s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1;
-                    }
-                    FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail)
-                    FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail)
-                    s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]+ s->mb_stride + 1;
-                }
-                FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail)
-            }
-    }
-    if (s->out_format == FMT_H263) {
-        /* ac values */
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail);
-        s->ac_val[0] = s->ac_val_base + s->b8_stride + 1;
-        s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1;
-        s->ac_val[2] = s->ac_val[1] + c_size;
-
-        /* cbp values */
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail);
-        s->coded_block= s->coded_block_base + s->b8_stride + 1;
-
-        /* cbp, ac_pred, pred_dir */
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table     , mb_array_size * sizeof(uint8_t), fail)
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail)
-    }
-
-    if (s->h263_pred || s->h263_plus || !s->encoding) {
-        /* dc values */
-        //MN: we need these for error resilience of intra-frames
-        FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail);
-        s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
-        s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
-        s->dc_val[2] = s->dc_val[1] + c_size;
-        for(i=0;i<yc_size;i++)
-            s->dc_val_base[i] = 1024;
-    }
-
-    /* which mb is a intra block */
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
-    memset(s->mbintra_table, 1, mb_array_size);
-
-    /* init macroblock skip table */
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size+2, fail);
-    //Note the +1 is for a quicker mpeg4 slice_end detection
-    FF_ALLOCZ_OR_GOTO(s->avctx, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE, fail);
-
-    s->parse_context.state= -1;
-    if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){
-       s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
-       s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
-       s->visualization_buffer[2] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
-    }
-
-    s->context_initialized = 1;
-
-    s->thread_context[0]= s;
-    threads = s->avctx->thread_count;
-
-    for(i=1; i<threads; i++){
-        s->thread_context[i]= av_malloc(sizeof(MpegEncContext));
-        memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
-    }
-
-    for(i=0; i<threads; i++){
-        if(init_duplicate_context(s->thread_context[i], s) < 0)
-           goto fail;
-        s->thread_context[i]->start_mb_y= (s->mb_height*(i  ) + s->avctx->thread_count/2) / s->avctx->thread_count;
-        s->thread_context[i]->end_mb_y  = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count;
-    }
-
-    return 0;
- fail:
-    MPV_common_end(s);
-    return -1;
-}
-
-/* init common structure for both encoder and decoder */
-void MPV_common_end(MpegEncContext *s)
-{
-    int i, j, k;
-
-    for(i=0; i<s->avctx->thread_count; i++){
-        free_duplicate_context(s->thread_context[i]);
-    }
-    for(i=1; i<s->avctx->thread_count; i++){
-        av_freep(&s->thread_context[i]);
-    }
-
-    av_freep(&s->parse_context.buffer);
-    s->parse_context.buffer_size=0;
-
-    av_freep(&s->mb_type);
-    av_freep(&s->p_mv_table_base);
-    av_freep(&s->b_forw_mv_table_base);
-    av_freep(&s->b_back_mv_table_base);
-    av_freep(&s->b_bidir_forw_mv_table_base);
-    av_freep(&s->b_bidir_back_mv_table_base);
-    av_freep(&s->b_direct_mv_table_base);
-    s->p_mv_table= NULL;
-    s->b_forw_mv_table= NULL;
-    s->b_back_mv_table= NULL;
-    s->b_bidir_forw_mv_table= NULL;
-    s->b_bidir_back_mv_table= NULL;
-    s->b_direct_mv_table= NULL;
-    for(i=0; i<2; i++){
-        for(j=0; j<2; j++){
-            for(k=0; k<2; k++){
-                av_freep(&s->b_field_mv_table_base[i][j][k]);
-                s->b_field_mv_table[i][j][k]=NULL;
-            }
-            av_freep(&s->b_field_select_table[i][j]);
-            av_freep(&s->p_field_mv_table_base[i][j]);
-            s->p_field_mv_table[i][j]=NULL;
-        }
-        av_freep(&s->p_field_select_table[i]);
-    }
-
-    av_freep(&s->dc_val_base);
-    av_freep(&s->ac_val_base);
-    av_freep(&s->coded_block_base);
-    av_freep(&s->mbintra_table);
-    av_freep(&s->cbp_table);
-    av_freep(&s->pred_dir_table);
-
-    av_freep(&s->mbskip_table);
-    av_freep(&s->prev_pict_types);
-    av_freep(&s->bitstream_buffer);
-    s->allocated_bitstream_buffer_size=0;
-
-    av_freep(&s->avctx->stats_out);
-    av_freep(&s->ac_stats);
-    av_freep(&s->error_status_table);
-    av_freep(&s->mb_index2xy);
-    av_freep(&s->lambda_table);
-    av_freep(&s->q_intra_matrix);
-    av_freep(&s->q_inter_matrix);
-    av_freep(&s->q_intra_matrix16);
-    av_freep(&s->q_inter_matrix16);
-    av_freep(&s->input_picture);
-    av_freep(&s->reordered_input_picture);
-    av_freep(&s->dct_offset);
-
-    if(s->picture){
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            free_picture(s, &s->picture[i]);
-        }
-    }
-    av_freep(&s->picture);
-    s->context_initialized = 0;
-    s->last_picture_ptr=
-    s->next_picture_ptr=
-    s->current_picture_ptr= NULL;
-    s->linesize= s->uvlinesize= 0;
-
-    for(i=0; i<3; i++)
-        av_freep(&s->visualization_buffer[i]);
-
-    avcodec_default_free_buffers(s->avctx);
-}
-
-void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3])
-{
-    int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
-    uint8_t index_run[MAX_RUN+1];
-    int last, run, level, start, end, i;
-
-    /* If table is static, we can quit if rl->max_level[0] is not NULL */
-    if(static_store && rl->max_level[0])
-        return;
-
-    /* compute max_level[], max_run[] and index_run[] */
-    for(last=0;last<2;last++) {
-        if (last == 0) {
-            start = 0;
-            end = rl->last;
-        } else {
-            start = rl->last;
-            end = rl->n;
-        }
-
-        memset(max_level, 0, MAX_RUN + 1);
-        memset(max_run, 0, MAX_LEVEL + 1);
-        memset(index_run, rl->n, MAX_RUN + 1);
-        for(i=start;i<end;i++) {
-            run = rl->table_run[i];
-            level = rl->table_level[i];
-            if (index_run[run] == rl->n)
-                index_run[run] = i;
-            if (level > max_level[run])
-                max_level[run] = level;
-            if (run > max_run[level])
-                max_run[level] = run;
-        }
-        if(static_store)
-            rl->max_level[last] = static_store[last];
-        else
-            rl->max_level[last] = av_malloc(MAX_RUN + 1);
-        memcpy(rl->max_level[last], max_level, MAX_RUN + 1);
-        if(static_store)
-            rl->max_run[last] = static_store[last] + MAX_RUN + 1;
-        else
-            rl->max_run[last] = av_malloc(MAX_LEVEL + 1);
-        memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1);
-        if(static_store)
-            rl->index_run[last] = static_store[last] + MAX_RUN + MAX_LEVEL + 2;
-        else
-            rl->index_run[last] = av_malloc(MAX_RUN + 1);
-        memcpy(rl->index_run[last], index_run, MAX_RUN + 1);
-    }
-}
-
-void init_vlc_rl(RLTable *rl)
-{
-    int i, q;
-
-    for(q=0; q<32; q++){
-        int qmul= q*2;
-        int qadd= (q-1)|1;
-
-        if(q==0){
-            qmul=1;
-            qadd=0;
-        }
-        for(i=0; i<rl->vlc.table_size; i++){
-            int code= rl->vlc.table[i][0];
-            int len = rl->vlc.table[i][1];
-            int level, run;
-
-            if(len==0){ // illegal code
-                run= 66;
-                level= MAX_LEVEL;
-            }else if(len<0){ //more bits needed
-                run= 0;
-                level= code;
-            }else{
-                if(code==rl->n){ //esc
-                    run= 66;
-                    level= 0;
-                }else{
-                    run=   rl->table_run  [code] + 1;
-                    level= rl->table_level[code] * qmul + qadd;
-                    if(code >= rl->last) run+=192;
-                }
-            }
-            rl->rl_vlc[q][i].len= len;
-            rl->rl_vlc[q][i].level= level;
-            rl->rl_vlc[q][i].run= run;
-        }
-    }
-}
-
-int ff_find_unused_picture(MpegEncContext *s, int shared){
-    int i;
-
-    if(shared){
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0]==NULL && s->picture[i].type==0) return i;
-        }
-    }else{
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) return i; //FIXME
-        }
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0]==NULL) return i;
-        }
-    }
-
-    av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n");
-    /* We could return -1, but the codec would crash trying to draw into a
-     * non-existing frame anyway. This is safer than waiting for a random crash.
-     * Also the return of this is never useful, an encoder must only allocate
-     * as much as allowed in the specification. This has no relationship to how
-     * much libavcodec could allocate (and MAX_PICTURE_COUNT is always large
-     * enough for such valid streams).
-     * Plus, a decoder has to check stream validity and remove frames if too
-     * many reference frames are around. Waiting for "OOM" is not correct at
-     * all. Similarly, missing reference frames have to be replaced by
-     * interpolated/MC frames, anything else is a bug in the codec ...
-     */
-    abort();
-    return -1;
-}
-
-static void update_noise_reduction(MpegEncContext *s){
-    int intra, i;
-
-    for(intra=0; intra<2; intra++){
-        if(s->dct_count[intra] > (1<<16)){
-            for(i=0; i<64; i++){
-                s->dct_error_sum[intra][i] >>=1;
-            }
-            s->dct_count[intra] >>= 1;
-        }
-
-        for(i=0; i<64; i++){
-            s->dct_offset[intra][i]= (s->avctx->noise_reduction * s->dct_count[intra] + s->dct_error_sum[intra][i]/2) / (s->dct_error_sum[intra][i]+1);
-        }
-    }
-}
-
-/**
- * generic function for encode/decode called after coding/decoding the header and before a frame is coded/decoded
- */
-int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
-{
-    int i;
-    Picture *pic;
-    s->mb_skipped = 0;
-
-    assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3);
-
-    /* mark&release old frames */
-    if (s->pict_type != FF_B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) {
-      if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){
-          free_frame_buffer(s, s->last_picture_ptr);
-
-        /* release forgotten pictures */
-        /* if(mpeg124/h263) */
-        if(!s->encoding){
-            for(i=0; i<MAX_PICTURE_COUNT; i++){
-                if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){
-                    av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n");
-                    free_frame_buffer(s, &s->picture[i]);
-                }
-            }
-        }
-      }
-    }
-
-    if(!s->encoding){
-        /* release non reference frames */
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
-                free_frame_buffer(s, &s->picture[i]);
-            }
-        }
-
-        if(s->current_picture_ptr && s->current_picture_ptr->data[0]==NULL)
-            pic= s->current_picture_ptr; //we already have a unused image (maybe it was set before reading the header)
-        else{
-            i= ff_find_unused_picture(s, 0);
-            pic= &s->picture[i];
-        }
-
-        pic->reference= 0;
-        if (!s->dropable){
-            if (s->codec_id == CODEC_ID_H264)
-                pic->reference = s->picture_structure;
-            else if (s->pict_type != FF_B_TYPE)
-                pic->reference = 3;
-        }
-
-        pic->coded_picture_number= s->coded_picture_number++;
-
-        if(ff_alloc_picture(s, pic, 0) < 0)
-            return -1;
-
-        s->current_picture_ptr= pic;
-        s->current_picture_ptr->top_field_first= s->top_field_first; //FIXME use only the vars from current_pic
-        s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence;
-    }
-
-    s->current_picture_ptr->pict_type= s->pict_type;
-//    if(s->flags && CODEC_FLAG_QSCALE)
-  //      s->current_picture_ptr->quality= s->new_picture_ptr->quality;
-    s->current_picture_ptr->key_frame= s->pict_type == FF_I_TYPE;
-
-    ff_copy_picture(&s->current_picture, s->current_picture_ptr);
-
-    if (s->pict_type != FF_B_TYPE) {
-        s->last_picture_ptr= s->next_picture_ptr;
-        if(!s->dropable)
-            s->next_picture_ptr= s->current_picture_ptr;
-    }
-/*    av_log(s->avctx, AV_LOG_DEBUG, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr,
-        s->last_picture_ptr    ? s->last_picture_ptr->data[0] : NULL,
-        s->next_picture_ptr    ? s->next_picture_ptr->data[0] : NULL,
-        s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL,
-        s->pict_type, s->dropable);*/
-
-    if(s->codec_id != CODEC_ID_H264){
-        if((s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && s->pict_type!=FF_I_TYPE){
-            av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
-            /* Allocate a dummy frame */
-            i= ff_find_unused_picture(s, 0);
-            s->last_picture_ptr= &s->picture[i];
-            if(ff_alloc_picture(s, s->last_picture_ptr, 0) < 0)
-                return -1;
-        }
-        if((s->next_picture_ptr==NULL || s->next_picture_ptr->data[0]==NULL) && s->pict_type==FF_B_TYPE){
-            /* Allocate a dummy frame */
-            i= ff_find_unused_picture(s, 0);
-            s->next_picture_ptr= &s->picture[i];
-            if(ff_alloc_picture(s, s->next_picture_ptr, 0) < 0)
-                return -1;
-        }
-    }
-
-    if(s->last_picture_ptr) ff_copy_picture(&s->last_picture, s->last_picture_ptr);
-    if(s->next_picture_ptr) ff_copy_picture(&s->next_picture, s->next_picture_ptr);
-
-    assert(s->pict_type == FF_I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0]));
-
-    if(s->picture_structure!=PICT_FRAME && s->out_format != FMT_H264){
-        int i;
-        for(i=0; i<4; i++){
-            if(s->picture_structure == PICT_BOTTOM_FIELD){
-                 s->current_picture.data[i] += s->current_picture.linesize[i];
-            }
-            s->current_picture.linesize[i] *= 2;
-            s->last_picture.linesize[i] *=2;
-            s->next_picture.linesize[i] *=2;
-        }
-    }
-
-    s->hurry_up= s->avctx->hurry_up;
-    s->error_recognition= avctx->error_recognition;
-
-    /* set dequantizer, we can't do it during init as it might change for mpeg4
-       and we can't do it in the header decode as init is not called for mpeg4 there yet */
-    if(s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO){
-        s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
-        s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
-    }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){
-        s->dct_unquantize_intra = s->dct_unquantize_h263_intra;
-        s->dct_unquantize_inter = s->dct_unquantize_h263_inter;
-    }else{
-        s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra;
-        s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter;
-    }
-
-    if(s->dct_error_sum){
-        assert(s->avctx->noise_reduction && s->encoding);
-
-        update_noise_reduction(s);
-    }
-
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration)
-        return ff_xvmc_field_start(s, avctx);
-
-    return 0;
-}
-
-/* generic function for encode/decode called after a frame has been coded/decoded */
-void MPV_frame_end(MpegEncContext *s)
-{
-    int i;
-    /* draw edge for correct motion prediction if outside */
-    //just to make sure that all data is rendered.
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
-        ff_xvmc_field_end(s);
-    }else if(!s->avctx->hwaccel
-       && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-       && s->unrestricted_mv
-       && s->current_picture.reference
-       && !s->intra_only
-       && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
-            s->dsp.draw_edges(s->current_picture.data[0], s->linesize  , s->h_edge_pos   , s->v_edge_pos   , EDGE_WIDTH  );
-            s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
-            s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
-    }
-    emms_c();
-
-    s->last_pict_type    = s->pict_type;
-    s->last_lambda_for[s->pict_type]= s->current_picture_ptr->quality;
-    if(s->pict_type!=FF_B_TYPE){
-        s->last_non_b_pict_type= s->pict_type;
-    }
-#if 0
-        /* copy back current_picture variables */
-    for(i=0; i<MAX_PICTURE_COUNT; i++){
-        if(s->picture[i].data[0] == s->current_picture.data[0]){
-            s->picture[i]= s->current_picture;
-            break;
-        }
-    }
-    assert(i<MAX_PICTURE_COUNT);
-#endif
-
-    if(s->encoding){
-        /* release non-reference frames */
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
-                free_frame_buffer(s, &s->picture[i]);
-            }
-        }
-    }
-    // clear copies, to avoid confusion
-#if 0
-    memset(&s->last_picture, 0, sizeof(Picture));
-    memset(&s->next_picture, 0, sizeof(Picture));
-    memset(&s->current_picture, 0, sizeof(Picture));
-#endif
-    s->avctx->coded_frame= (AVFrame*)s->current_picture_ptr;
-}
-
-/**
- * draws an line from (ex, ey) -> (sx, sy).
- * @param w width of the image
- * @param h height of the image
- * @param stride stride/linesize of the image
- * @param color color of the arrow
- */
-static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){
-    int x, y, fr, f;
-
-    sx= av_clip(sx, 0, w-1);
-    sy= av_clip(sy, 0, h-1);
-    ex= av_clip(ex, 0, w-1);
-    ey= av_clip(ey, 0, h-1);
-
-    buf[sy*stride + sx]+= color;
-
-    if(FFABS(ex - sx) > FFABS(ey - sy)){
-        if(sx > ex){
-            FFSWAP(int, sx, ex);
-            FFSWAP(int, sy, ey);
-        }
-        buf+= sx + sy*stride;
-        ex-= sx;
-        f= ((ey-sy)<<16)/ex;
-        for(x= 0; x <= ex; x++){
-            y = (x*f)>>16;
-            fr= (x*f)&0xFFFF;
-            buf[ y   *stride + x]+= (color*(0x10000-fr))>>16;
-            buf[(y+1)*stride + x]+= (color*         fr )>>16;
-        }
-    }else{
-        if(sy > ey){
-            FFSWAP(int, sx, ex);
-            FFSWAP(int, sy, ey);
-        }
-        buf+= sx + sy*stride;
-        ey-= sy;
-        if(ey) f= ((ex-sx)<<16)/ey;
-        else   f= 0;
-        for(y= 0; y <= ey; y++){
-            x = (y*f)>>16;
-            fr= (y*f)&0xFFFF;
-            buf[y*stride + x  ]+= (color*(0x10000-fr))>>16;
-            buf[y*stride + x+1]+= (color*         fr )>>16;
-        }
-    }
-}
-
-/**
- * draws an arrow from (ex, ey) -> (sx, sy).
- * @param w width of the image
- * @param h height of the image
- * @param stride stride/linesize of the image
- * @param color color of the arrow
- */
-static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){
-    int dx,dy;
-
-    sx= av_clip(sx, -100, w+100);
-    sy= av_clip(sy, -100, h+100);
-    ex= av_clip(ex, -100, w+100);
-    ey= av_clip(ey, -100, h+100);
-
-    dx= ex - sx;
-    dy= ey - sy;
-
-    if(dx*dx + dy*dy > 3*3){
-        int rx=  dx + dy;
-        int ry= -dx + dy;
-        int length= ff_sqrt((rx*rx + ry*ry)<<8);
-
-        //FIXME subpixel accuracy
-        rx= ROUNDED_DIV(rx*3<<4, length);
-        ry= ROUNDED_DIV(ry*3<<4, length);
-
-        draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color);
-        draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color);
-    }
-    draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
-}
-
-/**
- * prints debuging info for the given picture.
- */
-void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){
-
-    if(s->avctx->hwaccel || !pict || !pict->mb_type) return;
-
-    if(s->avctx->debug&(FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)){
-        int x,y;
-
-        av_log(s->avctx,AV_LOG_DEBUG,"New frame, type: ");
-        switch (pict->pict_type) {
-            case FF_I_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"I\n"); break;
-            case FF_P_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"P\n"); break;
-            case FF_B_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"B\n"); break;
-            case FF_S_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"S\n"); break;
-            case FF_SI_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"SI\n"); break;
-            case FF_SP_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"SP\n"); break;
-        }
-        for(y=0; y<s->mb_height; y++){
-            for(x=0; x<s->mb_width; x++){
-                if(s->avctx->debug&FF_DEBUG_SKIP){
-                    int count= s->mbskip_table[x + y*s->mb_stride];
-                    if(count>9) count=9;
-                    av_log(s->avctx, AV_LOG_DEBUG, "%1d", count);
-                }
-                if(s->avctx->debug&FF_DEBUG_QP){
-                    av_log(s->avctx, AV_LOG_DEBUG, "%2d", pict->qscale_table[x + y*s->mb_stride]);
-                }
-                if(s->avctx->debug&FF_DEBUG_MB_TYPE){
-                    int mb_type= pict->mb_type[x + y*s->mb_stride];
-                    //Type & MV direction
-                    if(IS_PCM(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "P");
-                    else if(IS_INTRA(mb_type) && IS_ACPRED(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "A");
-                    else if(IS_INTRA4x4(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "i");
-                    else if(IS_INTRA16x16(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "I");
-                    else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "d");
-                    else if(IS_DIRECT(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "D");
-                    else if(IS_GMC(mb_type) && IS_SKIP(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "g");
-                    else if(IS_GMC(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "G");
-                    else if(IS_SKIP(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "S");
-                    else if(!USES_LIST(mb_type, 1))
-                        av_log(s->avctx, AV_LOG_DEBUG, ">");
-                    else if(!USES_LIST(mb_type, 0))
-                        av_log(s->avctx, AV_LOG_DEBUG, "<");
-                    else{
-                        assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
-                        av_log(s->avctx, AV_LOG_DEBUG, "X");
-                    }
-
-                    //segmentation
-                    if(IS_8X8(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "+");
-                    else if(IS_16X8(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "-");
-                    else if(IS_8X16(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "|");
-                    else if(IS_INTRA(mb_type) || IS_16X16(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, " ");
-                    else
-                        av_log(s->avctx, AV_LOG_DEBUG, "?");
-
-
-                    if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264)
-                        av_log(s->avctx, AV_LOG_DEBUG, "=");
-                    else
-                        av_log(s->avctx, AV_LOG_DEBUG, " ");
-                }
-//                av_log(s->avctx, AV_LOG_DEBUG, " ");
-            }
-            av_log(s->avctx, AV_LOG_DEBUG, "\n");
-        }
-    }
-
-    if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){
-        const int shift= 1 + s->quarter_sample;
-        int mb_y;
-        uint8_t *ptr;
-        int i;
-        int h_chroma_shift, v_chroma_shift, block_height;
-        const int width = s->avctx->width;
-        const int height= s->avctx->height;
-        const int mv_sample_log2= 4 - pict->motion_subsample_log2;
-        const int mv_stride= (s->mb_width << mv_sample_log2) + (s->codec_id == CODEC_ID_H264 ? 0 : 1);
-        s->low_delay=0; //needed to see the vectors without trashing the buffers
-
-        avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-        for(i=0; i<3; i++){
-            memcpy(s->visualization_buffer[i], pict->data[i], (i==0) ? pict->linesize[i]*height:pict->linesize[i]*height >> v_chroma_shift);
-            pict->data[i]= s->visualization_buffer[i];
-        }
-        pict->type= FF_BUFFER_TYPE_COPY;
-        ptr= pict->data[0];
-        block_height = 16>>v_chroma_shift;
-
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            int mb_x;
-            for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                const int mb_index= mb_x + mb_y*s->mb_stride;
-                if((s->avctx->debug_mv) && pict->motion_val){
-                  int type;
-                  for(type=0; type<3; type++){
-                    int direction = 0;
-                    switch (type) {
-                      case 0: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_P_FOR)) || (pict->pict_type!=FF_P_TYPE))
-                                continue;
-                              direction = 0;
-                              break;
-                      case 1: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_FOR)) || (pict->pict_type!=FF_B_TYPE))
-                                continue;
-                              direction = 0;
-                              break;
-                      case 2: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_BACK)) || (pict->pict_type!=FF_B_TYPE))
-                                continue;
-                              direction = 1;
-                              break;
-                    }
-                    if(!USES_LIST(pict->mb_type[mb_index], direction))
-                        continue;
-
-                    if(IS_8X8(pict->mb_type[mb_index])){
-                      int i;
-                      for(i=0; i<4; i++){
-                        int sx= mb_x*16 + 4 + 8*(i&1);
-                        int sy= mb_y*16 + 4 + 8*(i>>1);
-                        int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << (mv_sample_log2-1);
-                        int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
-                        int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
-                        draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);
-                      }
-                    }else if(IS_16X8(pict->mb_type[mb_index])){
-                      int i;
-                      for(i=0; i<2; i++){
-                        int sx=mb_x*16 + 8;
-                        int sy=mb_y*16 + 4 + 8*i;
-                        int xy= (mb_x*2 + (mb_y*2 + i)*mv_stride) << (mv_sample_log2-1);
-                        int mx=(pict->motion_val[direction][xy][0]>>shift);
-                        int my=(pict->motion_val[direction][xy][1]>>shift);
-
-                        if(IS_INTERLACED(pict->mb_type[mb_index]))
-                            my*=2;
-
-                        draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100);
-                      }
-                    }else if(IS_8X16(pict->mb_type[mb_index])){
-                      int i;
-                      for(i=0; i<2; i++){
-                        int sx=mb_x*16 + 4 + 8*i;
-                        int sy=mb_y*16 + 8;
-                        int xy= (mb_x*2 + i + mb_y*2*mv_stride) << (mv_sample_log2-1);
-                        int mx=(pict->motion_val[direction][xy][0]>>shift);
-                        int my=(pict->motion_val[direction][xy][1]>>shift);
-
-                        if(IS_INTERLACED(pict->mb_type[mb_index]))
-                            my*=2;
-
-                        draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100);
-                      }
-                    }else{
-                      int sx= mb_x*16 + 8;
-                      int sy= mb_y*16 + 8;
-                      int xy= (mb_x + mb_y*mv_stride) << mv_sample_log2;
-                      int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
-                      int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
-                      draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);
-                    }
-                  }
-                }
-                if((s->avctx->debug&FF_DEBUG_VIS_QP) && pict->motion_val){
-                    uint64_t c= (pict->qscale_table[mb_index]*128/31) * 0x0101010101010101ULL;
-                    int y;
-                    for(y=0; y<block_height; y++){
-                        *(uint64_t*)(pict->data[1] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[1])= c;
-                        *(uint64_t*)(pict->data[2] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[2])= c;
-                    }
-                }
-                if((s->avctx->debug&FF_DEBUG_VIS_MB_TYPE) && pict->motion_val){
-                    int mb_type= pict->mb_type[mb_index];
-                    uint64_t u,v;
-                    int y;
-#define COLOR(theta, r)\
-u= (int)(128 + r*cos(theta*3.141592/180));\
-v= (int)(128 + r*sin(theta*3.141592/180));
-
-
-                    u=v=128;
-                    if(IS_PCM(mb_type)){
-                        COLOR(120,48)
-                    }else if((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) || IS_INTRA16x16(mb_type)){
-                        COLOR(30,48)
-                    }else if(IS_INTRA4x4(mb_type)){
-                        COLOR(90,48)
-                    }else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type)){
-//                        COLOR(120,48)
-                    }else if(IS_DIRECT(mb_type)){
-                        COLOR(150,48)
-                    }else if(IS_GMC(mb_type) && IS_SKIP(mb_type)){
-                        COLOR(170,48)
-                    }else if(IS_GMC(mb_type)){
-                        COLOR(190,48)
-                    }else if(IS_SKIP(mb_type)){
-//                        COLOR(180,48)
-                    }else if(!USES_LIST(mb_type, 1)){
-                        COLOR(240,48)
-                    }else if(!USES_LIST(mb_type, 0)){
-                        COLOR(0,48)
-                    }else{
-                        assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
-                        COLOR(300,48)
-                    }
-
-                    u*= 0x0101010101010101ULL;
-                    v*= 0x0101010101010101ULL;
-                    for(y=0; y<block_height; y++){
-                        *(uint64_t*)(pict->data[1] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[1])= u;
-                        *(uint64_t*)(pict->data[2] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[2])= v;
-                    }
-
-                    //segmentation
-                    if(IS_8X8(mb_type) || IS_16X8(mb_type)){
-                        *(uint64_t*)(pict->data[0] + 16*mb_x + 0 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL;
-                        *(uint64_t*)(pict->data[0] + 16*mb_x + 8 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL;
-                    }
-                    if(IS_8X8(mb_type) || IS_8X16(mb_type)){
-                        for(y=0; y<16; y++)
-                            pict->data[0][16*mb_x + 8 + (16*mb_y + y)*pict->linesize[0]]^= 0x80;
-                    }
-                    if(IS_8X8(mb_type) && mv_sample_log2 >= 2){
-                        int dm= 1 << (mv_sample_log2-2);
-                        for(i=0; i<4; i++){
-                            int sx= mb_x*16 + 8*(i&1);
-                            int sy= mb_y*16 + 8*(i>>1);
-                            int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << (mv_sample_log2-1);
-                            //FIXME bidir
-                            int32_t *mv = (int32_t*)&pict->motion_val[0][xy];
-                            if(mv[0] != mv[dm] || mv[dm*mv_stride] != mv[dm*(mv_stride+1)])
-                                for(y=0; y<8; y++)
-                                    pict->data[0][sx + 4 + (sy + y)*pict->linesize[0]]^= 0x80;
-                            if(mv[0] != mv[dm*mv_stride] || mv[dm] != mv[dm*(mv_stride+1)])
-                                *(uint64_t*)(pict->data[0] + sx + (sy + 4)*pict->linesize[0])^= 0x8080808080808080ULL;
-                        }
-                    }
-
-                    if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264){
-                        // hmm
-                    }
-                }
-                s->mbskip_table[mb_index]=0;
-            }
-        }
-    }
-}
-
-static inline int hpel_motion_lowres(MpegEncContext *s,
-                                  uint8_t *dest, uint8_t *src,
-                                  int field_based, int field_select,
-                                  int src_x, int src_y,
-                                  int width, int height, int stride,
-                                  int h_edge_pos, int v_edge_pos,
-                                  int w, int h, h264_chroma_mc_func *pix_op,
-                                  int motion_x, int motion_y)
-{
-    const int lowres= s->avctx->lowres;
-    const int op_index= FFMIN(lowres, 2);
-    const int s_mask= (2<<lowres)-1;
-    int emu=0;
-    int sx, sy;
-
-    if(s->quarter_sample){
-        motion_x/=2;
-        motion_y/=2;
-    }
-
-    sx= motion_x & s_mask;
-    sy= motion_y & s_mask;
-    src_x += motion_x >> (lowres+1);
-    src_y += motion_y >> (lowres+1);
-
-    src += src_y * stride + src_x;
-
-    if(   (unsigned)src_x > h_edge_pos                 - (!!sx) - w
-       || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
-                            src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
-        src= s->edge_emu_buffer;
-        emu=1;
-    }
-
-    sx= (sx << 2) >> lowres;
-    sy= (sy << 2) >> lowres;
-    if(field_select)
-        src += s->linesize;
-    pix_op[op_index](dest, src, stride, h, sx, sy);
-    return emu;
-}
-
-/* apply one mpeg motion vector to the three components */
-static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               int field_based, int bottom_field, int field_select,
-                               uint8_t **ref_picture, h264_chroma_mc_func *pix_op,
-                               int motion_x, int motion_y, int h, int mb_y)
-{
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy, uvsx, uvsy;
-    const int lowres= s->avctx->lowres;
-    const int op_index= FFMIN(lowres, 2);
-    const int block_s= 8>>lowres;
-    const int s_mask= (2<<lowres)-1;
-    const int h_edge_pos = s->h_edge_pos >> lowres;
-    const int v_edge_pos = s->v_edge_pos >> lowres;
-    linesize   = s->current_picture.linesize[0] << field_based;
-    uvlinesize = s->current_picture.linesize[1] << field_based;
-
-    if(s->quarter_sample){ //FIXME obviously not perfect but qpel will not work in lowres anyway
-        motion_x/=2;
-        motion_y/=2;
-    }
-
-    if(field_based){
-        motion_y += (bottom_field - field_select)*((1<<lowres)-1);
-    }
-
-    sx= motion_x & s_mask;
-    sy= motion_y & s_mask;
-    src_x = s->mb_x*2*block_s               + (motion_x >> (lowres+1));
-    src_y =(   mb_y*2*block_s>>field_based) + (motion_y >> (lowres+1));
-
-    if (s->out_format == FMT_H263) {
-        uvsx = ((motion_x>>1) & s_mask) | (sx&1);
-        uvsy = ((motion_y>>1) & s_mask) | (sy&1);
-        uvsrc_x = src_x>>1;
-        uvsrc_y = src_y>>1;
-    }else if(s->out_format == FMT_H261){//even chroma mv's are full pel in H261
-        mx = motion_x / 4;
-        my = motion_y / 4;
-        uvsx = (2*mx) & s_mask;
-        uvsy = (2*my) & s_mask;
-        uvsrc_x = s->mb_x*block_s               + (mx >> lowres);
-        uvsrc_y =    mb_y*block_s               + (my >> lowres);
-    } else {
-        mx = motion_x / 2;
-        my = motion_y / 2;
-        uvsx = mx & s_mask;
-        uvsy = my & s_mask;
-        uvsrc_x = s->mb_x*block_s               + (mx >> (lowres+1));
-        uvsrc_y =(   mb_y*block_s>>field_based) + (my >> (lowres+1));
-    }
-
-    ptr_y  = ref_picture[0] + src_y * linesize + src_x;
-    ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
-    ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
-    if(   (unsigned)src_x > h_edge_pos                 - (!!sx) - 2*block_s
-       || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
-                             src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
-            ptr_y = s->edge_emu_buffer;
-            if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
-                ff_emulated_edge_mc(uvbuf  , ptr_cb, s->uvlinesize, 9, 9+field_based,
-                                 uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
-                ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based,
-                                 uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
-                ptr_cb= uvbuf;
-                ptr_cr= uvbuf+16;
-            }
-    }
-
-    if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
-        dest_y += s->linesize;
-        dest_cb+= s->uvlinesize;
-        dest_cr+= s->uvlinesize;
-    }
-
-    if(field_select){
-        ptr_y += s->linesize;
-        ptr_cb+= s->uvlinesize;
-        ptr_cr+= s->uvlinesize;
-    }
-
-    sx= (sx << 2) >> lowres;
-    sy= (sy << 2) >> lowres;
-    pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy);
-
-    if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-        uvsx= (uvsx << 2) >> lowres;
-        uvsy= (uvsy << 2) >> lowres;
-        pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
-        pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
-    }
-    //FIXME h261 lowres loop filter
-}
-
-static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
-                                     uint8_t *dest_cb, uint8_t *dest_cr,
-                                     uint8_t **ref_picture,
-                                     h264_chroma_mc_func *pix_op,
-                                     int mx, int my){
-    const int lowres= s->avctx->lowres;
-    const int op_index= FFMIN(lowres, 2);
-    const int block_s= 8>>lowres;
-    const int s_mask= (2<<lowres)-1;
-    const int h_edge_pos = s->h_edge_pos >> (lowres+1);
-    const int v_edge_pos = s->v_edge_pos >> (lowres+1);
-    int emu=0, src_x, src_y, offset, sx, sy;
-    uint8_t *ptr;
-
-    if(s->quarter_sample){
-        mx/=2;
-        my/=2;
-    }
-
-    /* In case of 8X8, we construct a single chroma motion vector
-       with a special rounding */
-    mx= ff_h263_round_chroma(mx);
-    my= ff_h263_round_chroma(my);
-
-    sx= mx & s_mask;
-    sy= my & s_mask;
-    src_x = s->mb_x*block_s + (mx >> (lowres+1));
-    src_y = s->mb_y*block_s + (my >> (lowres+1));
-
-    offset = src_y * s->uvlinesize + src_x;
-    ptr = ref_picture[1] + offset;
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x > h_edge_pos - (!!sx) - block_s
-           || (unsigned)src_y > v_edge_pos - (!!sy) - block_s){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
-            ptr= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    sx= (sx << 2) >> lowres;
-    sy= (sy << 2) >> lowres;
-    pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);
-
-    ptr = ref_picture[2] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
-        ptr= s->edge_emu_buffer;
-    }
-    pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
-}
-
-/**
- * motion compensation of a single macroblock
- * @param s context
- * @param dest_y luma destination pointer
- * @param dest_cb chroma cb/u destination pointer
- * @param dest_cr chroma cr/v destination pointer
- * @param dir direction (0->forward, 1->backward)
- * @param ref_picture array[3] of pointers to the 3 planes of the reference picture
- * @param pic_op halfpel motion compensation function (average or put normally)
- * the motion vectors are taken from s->mv and the MV type from s->mv_type
- */
-static inline void MPV_motion_lowres(MpegEncContext *s,
-                              uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                              int dir, uint8_t **ref_picture,
-                              h264_chroma_mc_func *pix_op)
-{
-    int mx, my;
-    int mb_x, mb_y, i;
-    const int lowres= s->avctx->lowres;
-    const int block_s= 8>>lowres;
-
-    mb_x = s->mb_x;
-    mb_y = s->mb_y;
-
-    switch(s->mv_type) {
-    case MV_TYPE_16X16:
-        mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                    0, 0, 0,
-                    ref_picture, pix_op,
-                    s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s, mb_y);
-        break;
-    case MV_TYPE_8X8:
-        mx = 0;
-        my = 0;
-            for(i=0;i<4;i++) {
-                hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) * s->linesize)*block_s,
-                            ref_picture[0], 0, 0,
-                            (2*mb_x + (i & 1))*block_s, (2*mb_y + (i >>1))*block_s,
-                            s->width, s->height, s->linesize,
-                            s->h_edge_pos >> lowres, s->v_edge_pos >> lowres,
-                            block_s, block_s, pix_op,
-                            s->mv[dir][i][0], s->mv[dir][i][1]);
-
-                mx += s->mv[dir][i][0];
-                my += s->mv[dir][i][1];
-            }
-
-        if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
-            chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my);
-        break;
-    case MV_TYPE_FIELD:
-        if (s->picture_structure == PICT_FRAME) {
-            /* top field */
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        1, 0, s->field_select[dir][0],
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], block_s, mb_y);
-            /* bottom field */
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        1, 1, s->field_select[dir][1],
-                        ref_picture, pix_op,
-                        s->mv[dir][1][0], s->mv[dir][1][1], block_s, mb_y);
-        } else {
-            if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != FF_B_TYPE && !s->first_field){
-                ref_picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][0],
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s, mb_y>>1);
-        }
-        break;
-    case MV_TYPE_16X8:
-        for(i=0; i<2; i++){
-            uint8_t ** ref2picture;
-
-            if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == FF_B_TYPE || s->first_field){
-                ref2picture= ref_picture;
-            }else{
-                ref2picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][i],
-                        ref2picture, pix_op,
-                        s->mv[dir][i][0], s->mv[dir][i][1] + 2*block_s*i, block_s, mb_y>>1);
-
-            dest_y += 2*block_s*s->linesize;
-            dest_cb+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize;
-            dest_cr+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize;
-        }
-        break;
-    case MV_TYPE_DMV:
-        if(s->picture_structure == PICT_FRAME){
-            for(i=0; i<2; i++){
-                int j;
-                for(j=0; j<2; j++){
-                    mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                                1, j, j^i,
-                                ref_picture, pix_op,
-                                s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], block_s, mb_y);
-                }
-                pix_op = s->dsp.avg_h264_chroma_pixels_tab;
-            }
-        }else{
-            for(i=0; i<2; i++){
-                mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                            0, 0, s->picture_structure != i+1,
-                            ref_picture, pix_op,
-                            s->mv[dir][2*i][0],s->mv[dir][2*i][1],2*block_s, mb_y>>1);
-
-                // after put we make avg of the same block
-                pix_op = s->dsp.avg_h264_chroma_pixels_tab;
-
-                //opposite parity is always in the same frame if this is second field
-                if(!s->first_field){
-                    ref_picture = s->current_picture_ptr->data;
-                }
-            }
-        }
-    break;
-    default: assert(0);
-    }
-}
-
-/* put block[] to dest[] */
-static inline void put_dct(MpegEncContext *s,
-                           DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
-{
-    s->dct_unquantize_intra(s, block, i, qscale);
-    s->dsp.idct_put (dest, line_size, block);
-}
-
-/* add block[] to dest[] */
-static inline void add_dct(MpegEncContext *s,
-                           DCTELEM *block, int i, uint8_t *dest, int line_size)
-{
-    if (s->block_last_index[i] >= 0) {
-        s->dsp.idct_add (dest, line_size, block);
-    }
-}
-
-static inline void add_dequant_dct(MpegEncContext *s,
-                           DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
-{
-    if (s->block_last_index[i] >= 0) {
-        s->dct_unquantize_inter(s, block, i, qscale);
-
-        s->dsp.idct_add (dest, line_size, block);
-    }
-}
-
-/**
- * cleans dc, ac, coded_block for the current non intra MB
- */
-void ff_clean_intra_table_entries(MpegEncContext *s)
-{
-    int wrap = s->b8_stride;
-    int xy = s->block_index[0];
-
-    s->dc_val[0][xy           ] =
-    s->dc_val[0][xy + 1       ] =
-    s->dc_val[0][xy     + wrap] =
-    s->dc_val[0][xy + 1 + wrap] = 1024;
-    /* ac pred */
-    memset(s->ac_val[0][xy       ], 0, 32 * sizeof(int16_t));
-    memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t));
-    if (s->msmpeg4_version>=3) {
-        s->coded_block[xy           ] =
-        s->coded_block[xy + 1       ] =
-        s->coded_block[xy     + wrap] =
-        s->coded_block[xy + 1 + wrap] = 0;
-    }
-    /* chroma */
-    wrap = s->mb_stride;
-    xy = s->mb_x + s->mb_y * wrap;
-    s->dc_val[1][xy] =
-    s->dc_val[2][xy] = 1024;
-    /* ac pred */
-    memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t));
-    memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t));
-
-    s->mbintra_table[xy]= 0;
-}
-
-/* generic function called after a macroblock has been parsed by the
-   decoder or after it has been encoded by the encoder.
-
-   Important variables used:
-   s->mb_intra : true if intra macroblock
-   s->mv_dir   : motion vector direction
-   s->mv_type  : motion vector type
-   s->mv       : motion vector
-   s->interlaced_dct : true if interlaced dct used (mpeg2)
- */
-static av_always_inline
-void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
-                            int lowres_flag, int is_mpeg12)
-{
-    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-    if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){
-        ff_xvmc_decode_mb(s);//xvmc uses pblocks
-        return;
-    }
-
-    if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
-       /* save DCT coefficients */
-       int i,j;
-       DCTELEM *dct = &s->current_picture.dct_coeff[mb_xy*64*6];
-       for(i=0; i<6; i++)
-           for(j=0; j<64; j++)
-               *dct++ = block[i][s->dsp.idct_permutation[j]];
-    }
-
-    s->current_picture.qscale_table[mb_xy]= s->qscale;
-
-    /* update DC predictors for P macroblocks */
-    if (!s->mb_intra) {
-        if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) {
-            if(s->mbintra_table[mb_xy])
-                ff_clean_intra_table_entries(s);
-        } else {
-            s->last_dc[0] =
-            s->last_dc[1] =
-            s->last_dc[2] = 128 << s->intra_dc_precision;
-        }
-    }
-    else if (!is_mpeg12 && (s->h263_pred || s->h263_aic))
-        s->mbintra_table[mb_xy]=1;
-
-    if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==FF_B_TYPE) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { //FIXME precalc
-        uint8_t *dest_y, *dest_cb, *dest_cr;
-        int dct_linesize, dct_offset;
-        op_pixels_func (*op_pix)[4];
-        qpel_mc_func (*op_qpix)[16];
-        const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
-        const int uvlinesize= s->current_picture.linesize[1];
-        const int readable= s->pict_type != FF_B_TYPE || s->encoding || s->avctx->draw_horiz_band || lowres_flag;
-        const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8;
-
-        /* avoid copy if macroblock skipped in last frame too */
-        /* skip only during decoding as we might trash the buffers during encoding a bit */
-        if(!s->encoding){
-            uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
-            const int age= s->current_picture.age;
-
-            assert(age);
-
-            if (s->mb_skipped) {
-                s->mb_skipped= 0;
-                assert(s->pict_type!=FF_I_TYPE);
-
-                (*mbskip_ptr) ++; /* indicate that this time we skipped it */
-                if(*mbskip_ptr >99) *mbskip_ptr= 99;
-
-                /* if previous was skipped too, then nothing to do !  */
-                if (*mbskip_ptr >= age && s->current_picture.reference){
-                    return;
-                }
-            } else if(!s->current_picture.reference){
-                (*mbskip_ptr) ++; /* increase counter so the age can be compared cleanly */
-                if(*mbskip_ptr >99) *mbskip_ptr= 99;
-            } else{
-                *mbskip_ptr = 0; /* not skipped */
-            }
-        }
-
-        dct_linesize = linesize << s->interlaced_dct;
-        dct_offset =(s->interlaced_dct)? linesize : linesize*block_size;
-
-        if(readable){
-            dest_y=  s->dest[0];
-            dest_cb= s->dest[1];
-            dest_cr= s->dest[2];
-        }else{
-            dest_y = s->b_scratchpad;
-            dest_cb= s->b_scratchpad+16*linesize;
-            dest_cr= s->b_scratchpad+32*linesize;
-        }
-
-        if (!s->mb_intra) {
-            /* motion handling */
-            /* decoding or more than one mb_type (MC was already done otherwise) */
-            if(!s->encoding){
-                if(lowres_flag){
-                    h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab;
-
-                    if (s->mv_dir & MV_DIR_FORWARD) {
-                        MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix);
-                        op_pix = s->dsp.avg_h264_chroma_pixels_tab;
-                    }
-                    if (s->mv_dir & MV_DIR_BACKWARD) {
-                        MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix);
-                    }
-                }else{
-                    op_qpix= s->me.qpel_put;
-                    if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){
-                        op_pix = s->dsp.put_pixels_tab;
-                    }else{
-                        op_pix = s->dsp.put_no_rnd_pixels_tab;
-                    }
-                    if (s->mv_dir & MV_DIR_FORWARD) {
-                        MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
-                        op_pix = s->dsp.avg_pixels_tab;
-                        op_qpix= s->me.qpel_avg;
-                    }
-                    if (s->mv_dir & MV_DIR_BACKWARD) {
-                        MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
-                    }
-                }
-            }
-
-            /* skip dequant / idct if we are really late ;) */
-            if(s->hurry_up>1) goto skip_idct;
-            if(s->avctx->skip_idct){
-                if(  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
-                   ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
-                   || s->avctx->skip_idct >= AVDISCARD_ALL)
-                    goto skip_idct;
-            }
-
-            /* add dct residue */
-            if(s->encoding || !(   s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO
-                                || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){
-                add_dequant_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                add_dequant_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                    if (s->chroma_y_shift){
-                        add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                    }else{
-                        dct_linesize >>= 1;
-                        dct_offset >>=1;
-                        add_dequant_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
-                    }
-                }
-            } else if(is_mpeg12 || (s->codec_id != CODEC_ID_WMV2)){
-                add_dct(s, block[0], 0, dest_y                          , dct_linesize);
-                add_dct(s, block[1], 1, dest_y              + block_size, dct_linesize);
-                add_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize);
-                add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
-
-                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                    if(s->chroma_y_shift){//Chroma420
-                        add_dct(s, block[4], 4, dest_cb, uvlinesize);
-                        add_dct(s, block[5], 5, dest_cr, uvlinesize);
-                    }else{
-                        //chroma422
-                        dct_linesize = uvlinesize << s->interlaced_dct;
-                        dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;
-
-                        add_dct(s, block[4], 4, dest_cb, dct_linesize);
-                        add_dct(s, block[5], 5, dest_cr, dct_linesize);
-                        add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
-                        add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
-                        if(!s->chroma_x_shift){//Chroma444
-                            add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
-                            add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
-                            add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
-                            add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
-                        }
-                    }
-                }//fi gray
-            }
-            else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) {
-                ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
-            }
-        } else {
-            /* dct only in intra block */
-            if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){
-                put_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                put_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                put_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                    if(s->chroma_y_shift){
-                        put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                    }else{
-                        dct_offset >>=1;
-                        dct_linesize >>=1;
-                        put_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
-                    }
-                }
-            }else{
-                s->dsp.idct_put(dest_y                          , dct_linesize, block[0]);
-                s->dsp.idct_put(dest_y              + block_size, dct_linesize, block[1]);
-                s->dsp.idct_put(dest_y + dct_offset             , dct_linesize, block[2]);
-                s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
-
-                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                    if(s->chroma_y_shift){
-                        s->dsp.idct_put(dest_cb, uvlinesize, block[4]);
-                        s->dsp.idct_put(dest_cr, uvlinesize, block[5]);
-                    }else{
-
-                        dct_linesize = uvlinesize << s->interlaced_dct;
-                        dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;
-
-                        s->dsp.idct_put(dest_cb,              dct_linesize, block[4]);
-                        s->dsp.idct_put(dest_cr,              dct_linesize, block[5]);
-                        s->dsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
-                        s->dsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
-                        if(!s->chroma_x_shift){//Chroma444
-                            s->dsp.idct_put(dest_cb + 8,              dct_linesize, block[8]);
-                            s->dsp.idct_put(dest_cr + 8,              dct_linesize, block[9]);
-                            s->dsp.idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
-                            s->dsp.idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]);
-                        }
-                    }
-                }//gray
-            }
-        }
-skip_idct:
-        if(!readable){
-            s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y ,   linesize,16);
-            s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift);
-            s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift);
-        }
-    }
-}
-
-void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
-#if !CONFIG_SMALL
-    if(s->out_format == FMT_MPEG1) {
-        if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 1);
-        else                 MPV_decode_mb_internal(s, block, 0, 1);
-    } else
-#endif
-    if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0);
-    else                  MPV_decode_mb_internal(s, block, 0, 0);
-}
-
-/**
- *
- * @param h is the normal height, this will be reduced automatically if needed for the last row
- */
-void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
-    if (s->avctx->draw_horiz_band) {
-        AVFrame *src;
-        const int field_pic= s->picture_structure != PICT_FRAME;
-        int offset[4];
-
-        h= FFMIN(h, (s->avctx->height>>field_pic) - y);
-
-        if(field_pic && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)){
-            h <<= 1;
-            y <<= 1;
-            if(s->first_field) return;
-        }
-
-        if(s->pict_type==FF_B_TYPE || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
-            src= (AVFrame*)s->current_picture_ptr;
-        else if(s->last_picture_ptr)
-            src= (AVFrame*)s->last_picture_ptr;
-        else
-            return;
-
-        if(s->pict_type==FF_B_TYPE && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){
-            offset[0]=
-            offset[1]=
-            offset[2]=
-            offset[3]= 0;
-        }else{
-            offset[0]= y * s->linesize;
-            offset[1]=
-            offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;
-            offset[3]= 0;
-        }
-
-        emms_c();
-
-        s->avctx->draw_horiz_band(s->avctx, src, offset,
-                                  y, s->picture_structure, h);
-    }
-}
-
-void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
-    const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
-    const int uvlinesize= s->current_picture.linesize[1];
-    const int mb_size= 4 - s->avctx->lowres;
-
-    s->block_index[0]= s->b8_stride*(s->mb_y*2    ) - 2 + s->mb_x*2;
-    s->block_index[1]= s->b8_stride*(s->mb_y*2    ) - 1 + s->mb_x*2;
-    s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;
-    s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
-    s->block_index[4]= s->mb_stride*(s->mb_y + 1)                + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
-    s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
-    //block_index is not used by mpeg2, so it is not affected by chroma_format
-
-    s->dest[0] = s->current_picture.data[0] + ((s->mb_x - 1) << mb_size);
-    s->dest[1] = s->current_picture.data[1] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
-    s->dest[2] = s->current_picture.data[2] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
-
-    if(!(s->pict_type==FF_B_TYPE && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME))
-    {
-        if(s->picture_structure==PICT_FRAME){
-        s->dest[0] += s->mb_y *   linesize << mb_size;
-        s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
-        s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
-        }else{
-            s->dest[0] += (s->mb_y>>1) *   linesize << mb_size;
-            s->dest[1] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);
-            s->dest[2] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift);
-            assert((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD));
-        }
-    }
-}
-
-void ff_mpeg_flush(AVCodecContext *avctx){
-    int i;
-    MpegEncContext *s = avctx->priv_data;
-
-    if(s==NULL || s->picture==NULL)
-        return;
-
-    for(i=0; i<MAX_PICTURE_COUNT; i++){
-       if(s->picture[i].data[0] && (   s->picture[i].type == FF_BUFFER_TYPE_INTERNAL
-                                    || s->picture[i].type == FF_BUFFER_TYPE_USER))
-        free_frame_buffer(s, &s->picture[i]);
-    }
-    s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL;
-
-    s->mb_x= s->mb_y= 0;
-    s->closed_gop= 0;
-
-    s->parse_context.state= -1;
-    s->parse_context.frame_start_found= 0;
-    s->parse_context.overread= 0;
-    s->parse_context.overread_index= 0;
-    s->parse_context.index= 0;
-    s->parse_context.last_index= 0;
-    s->bitstream_buffer_size=0;
-    s->pp_time=0;
-}
-
-static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-
-    nCoeffs= s->block_last_index[n];
-
-    if (n < 4)
-        block[0] = block[0] * s->y_dc_scale;
-    else
-        block[0] = block[0] * s->c_dc_scale;
-    /* XXX: only mpeg1 */
-    quant_matrix = s->intra_matrix;
-    for(i=1;i<=nCoeffs;i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = (level - 1) | 1;
-                level = -level;
-            } else {
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = (level - 1) | 1;
-            }
-            block[j] = level;
-        }
-    }
-}
-
-static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-
-    nCoeffs= s->block_last_index[n];
-
-    quant_matrix = s->inter_matrix;
-    for(i=0; i<=nCoeffs; i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-                level = (level - 1) | 1;
-                level = -level;
-            } else {
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-                level = (level - 1) | 1;
-            }
-            block[j] = level;
-        }
-    }
-}
-
-static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-
-    if(s->alternate_scan) nCoeffs= 63;
-    else nCoeffs= s->block_last_index[n];
-
-    if (n < 4)
-        block[0] = block[0] * s->y_dc_scale;
-    else
-        block[0] = block[0] * s->c_dc_scale;
-    quant_matrix = s->intra_matrix;
-    for(i=1;i<=nCoeffs;i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = -level;
-            } else {
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-            }
-            block[j] = level;
-        }
-    }
-}
-
-static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-    int sum=-1;
-
-    if(s->alternate_scan) nCoeffs= 63;
-    else nCoeffs= s->block_last_index[n];
-
-    if (n < 4)
-        block[0] = block[0] * s->y_dc_scale;
-    else
-        block[0] = block[0] * s->c_dc_scale;
-    quant_matrix = s->intra_matrix;
-    for(i=1;i<=nCoeffs;i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = -level;
-            } else {
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-            }
-            block[j] = level;
-            sum+=level;
-        }
-    }
-    block[63]^=sum&1;
-}
-
-static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-    int sum=-1;
-
-    if(s->alternate_scan) nCoeffs= 63;
-    else nCoeffs= s->block_last_index[n];
-
-    quant_matrix = s->inter_matrix;
-    for(i=0; i<=nCoeffs; i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-                level = -level;
-            } else {
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-            }
-            block[j] = level;
-            sum+=level;
-        }
-    }
-    block[63]^=sum&1;
-}
-
-static void dct_unquantize_h263_intra_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    int i, level, qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    qmul = qscale << 1;
-
-    if (!s->h263_aic) {
-        if (n < 4)
-            block[0] = block[0] * s->y_dc_scale;
-        else
-            block[0] = block[0] * s->c_dc_scale;
-        qadd = (qscale - 1) | 1;
-    }else{
-        qadd = 0;
-    }
-    if(s->ac_pred)
-        nCoeffs=63;
-    else
-        nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    for(i=1; i<=nCoeffs; i++) {
-        level = block[i];
-        if (level) {
-            if (level < 0) {
-                level = level * qmul - qadd;
-            } else {
-                level = level * qmul + qadd;
-            }
-            block[i] = level;
-        }
-    }
-}
-
-static void dct_unquantize_h263_inter_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    int i, level, qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    qadd = (qscale - 1) | 1;
-    qmul = qscale << 1;
-
-    nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    for(i=0; i<=nCoeffs; i++) {
-        level = block[i];
-        if (level) {
-            if (level < 0) {
-                level = level * qmul - qadd;
-            } else {
-                level = level * qmul + qadd;
-            }
-            block[i] = level;
-        }
-    }
-}
-
-/**
- * set qscale and update qscale dependent variables.
- */
-void ff_set_qscale(MpegEncContext * s, int qscale)
-{
-    if (qscale < 1)
-        qscale = 1;
-    else if (qscale > 31)
-        qscale = 31;
-
-    s->qscale = qscale;
-    s->chroma_qscale= s->chroma_qscale_table[qscale];
-
-    s->y_dc_scale= s->y_dc_scale_table[ qscale ];
-    s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ];
-}
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
deleted file mode 100644
index 8cd20b7..0000000
--- a/libavcodec/mpegvideo.h
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * Generic DCT based hybrid video encoder
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mpegvideo header.
- */
-
-#ifndef AVCODEC_MPEGVIDEO_H
-#define AVCODEC_MPEGVIDEO_H
-
-#include "dsputil.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "ratecontrol.h"
-#include "parser.h"
-#include "mpeg12data.h"
-#include "rl.h"
-
-#define FRAME_SKIPPED 100 ///< return value for header parsers if frame is not coded
-
-enum OutputFormat {
-    FMT_MPEG1,
-    FMT_H261,
-    FMT_H263,
-    FMT_MJPEG,
-    FMT_H264,
-};
-
-#define MPEG_BUF_SIZE (16 * 1024)
-
-#define QMAT_SHIFT_MMX 16
-#define QMAT_SHIFT 22
-
-#define MAX_FCODE 7
-#define MAX_MV 2048
-
-#define MAX_THREADS 16
-
-#define MAX_PICTURE_COUNT 32
-
-#define ME_MAP_SIZE 64
-#define ME_MAP_SHIFT 3
-#define ME_MAP_MV_BITS 11
-
-#define MAX_MB_BYTES (30*16*16*3/8 + 120)
-
-#define INPLACE_OFFSET 16
-
-/* Start codes. */
-#define SEQ_END_CODE            0x000001b7
-#define SEQ_START_CODE          0x000001b3
-#define GOP_START_CODE          0x000001b8
-#define PICTURE_START_CODE      0x00000100
-#define SLICE_MIN_START_CODE    0x00000101
-#define SLICE_MAX_START_CODE    0x000001af
-#define EXT_START_CODE          0x000001b5
-#define USER_START_CODE         0x000001b2
-
-/**
- * Picture.
- */
-typedef struct Picture{
-    FF_COMMON_FRAME
-
-    /**
-     * halfpel luma planes.
-     */
-    uint8_t *interpolated[3];
-    int16_t (*motion_val_base[2])[2];
-    uint32_t *mb_type_base;
-#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 //default mb_type if there is just one type
-#define IS_INTRA4x4(a)   ((a)&MB_TYPE_INTRA4x4)
-#define IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16)
-#define IS_PCM(a)        ((a)&MB_TYPE_INTRA_PCM)
-#define IS_INTRA(a)      ((a)&7)
-#define IS_INTER(a)      ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))
-#define IS_SKIP(a)       ((a)&MB_TYPE_SKIP)
-#define IS_INTRA_PCM(a)  ((a)&MB_TYPE_INTRA_PCM)
-#define IS_INTERLACED(a) ((a)&MB_TYPE_INTERLACED)
-#define IS_DIRECT(a)     ((a)&MB_TYPE_DIRECT2)
-#define IS_GMC(a)        ((a)&MB_TYPE_GMC)
-#define IS_16X16(a)      ((a)&MB_TYPE_16x16)
-#define IS_16X8(a)       ((a)&MB_TYPE_16x8)
-#define IS_8X16(a)       ((a)&MB_TYPE_8x16)
-#define IS_8X8(a)        ((a)&MB_TYPE_8x8)
-#define IS_SUB_8X8(a)    ((a)&MB_TYPE_16x16) //note reused
-#define IS_SUB_8X4(a)    ((a)&MB_TYPE_16x8)  //note reused
-#define IS_SUB_4X8(a)    ((a)&MB_TYPE_8x16)  //note reused
-#define IS_SUB_4X4(a)    ((a)&MB_TYPE_8x8)   //note reused
-#define IS_ACPRED(a)     ((a)&MB_TYPE_ACPRED)
-#define IS_QUANT(a)      ((a)&MB_TYPE_QUANT)
-#define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0<<((part)+2*(list))))
-#define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0|MB_TYPE_P1L0)<<(2*(list)))) ///< does this mb use listX, note does not work if subMBs
-#define HAS_CBP(a)        ((a)&MB_TYPE_CBP)
-
-    int field_poc[2];           ///< h264 top/bottom POC
-    int poc;                    ///< h264 frame POC
-    int frame_num;              ///< h264 frame_num (raw frame_num from slice header)
-    int mmco_reset;             ///< h264 MMCO_RESET set this 1. Reordering code must not mix pictures before and after MMCO_RESET.
-    int pic_id;                 /**< h264 pic_num (short -> no wrap version of pic_num,
-                                     pic_num & max_pic_num; long -> long_pic_num) */
-    int long_ref;               ///< 1->long term reference 0->short term reference
-    int ref_poc[2][2][16];      ///< h264 POCs of the frames used as reference (FIXME need per slice)
-    int ref_count[2][2];        ///< number of entries in ref_poc              (FIXME need per slice)
-    int mbaff;                  ///< h264 1 -> MBAFF frame 0-> not MBAFF
-
-    int mb_var_sum;             ///< sum of MB variance for current frame
-    int mc_mb_var_sum;          ///< motion compensated MB variance for current frame
-    uint16_t *mb_var;           ///< Table for MB variances
-    uint16_t *mc_mb_var;        ///< Table for motion compensated MB variances
-    uint8_t *mb_mean;           ///< Table for MB luminance
-    int32_t *mb_cmp_score;      ///< Table for MB cmp scores, for mb decision FIXME remove
-    int b_frame_score;          /* */
-} Picture;
-
-struct MpegEncContext;
-
-/**
- * Motion estimation context.
- */
-typedef struct MotionEstContext{
-    AVCodecContext *avctx;
-    int skip;                          ///< set if ME is skipped for the current MB
-    int co_located_mv[4][2];           ///< mv from last P-frame for direct mode ME
-    int direct_basis_mv[4][2];
-    uint8_t *scratchpad;               ///< data area for the ME algo, so that the ME does not need to malloc/free
-    uint8_t *best_mb;
-    uint8_t *temp_mb[2];
-    uint8_t *temp;
-    int best_bits;
-    uint32_t *map;                     ///< map to avoid duplicate evaluations
-    uint32_t *score_map;               ///< map to store the scores
-    int map_generation;
-    int pre_penalty_factor;
-    int penalty_factor;                /*!< an estimate of the bits required to
-                                        code a given mv value, e.g. (1,0) takes
-                                        more bits than (0,0). We have to
-                                        estimate whether any reduction in
-                                        residual is worth the extra bits. */
-    int sub_penalty_factor;
-    int mb_penalty_factor;
-    int flags;
-    int sub_flags;
-    int mb_flags;
-    int pre_pass;                      ///< = 1 for the pre pass
-    int dia_size;
-    int xmin;
-    int xmax;
-    int ymin;
-    int ymax;
-    int pred_x;
-    int pred_y;
-    uint8_t *src[4][4];
-    uint8_t *ref[4][4];
-    int stride;
-    int uvstride;
-    /* temp variables for picture complexity calculation */
-    int mc_mb_var_sum_temp;
-    int mb_var_sum_temp;
-    int scene_change_score;
-/*    cmp, chroma_cmp;*/
-    op_pixels_func (*hpel_put)[4];
-    op_pixels_func (*hpel_avg)[4];
-    qpel_mc_func (*qpel_put)[16];
-    qpel_mc_func (*qpel_avg)[16];
-    uint8_t (*mv_penalty)[MAX_MV*2+1];  ///< amount of bits needed to encode a MV
-    uint8_t *current_mv_penalty;
-    int (*sub_motion_search)(struct MpegEncContext * s,
-                                  int *mx_ptr, int *my_ptr, int dmin,
-                                  int src_index, int ref_index,
-                                  int size, int h);
-}MotionEstContext;
-
-/**
- * MpegEncContext.
- */
-typedef struct MpegEncContext {
-    struct AVCodecContext *avctx;
-    /* the following parameters must be initialized before encoding */
-    int width, height;///< picture size. must be a multiple of 16
-    int gop_size;
-    int intra_only;   ///< if true, only intra pictures are generated
-    int bit_rate;     ///< wanted bit rate
-    enum OutputFormat out_format; ///< output format
-    int h263_pred;    ///< use mpeg4/h263 ac/dc predictions
-    int pb_frame;     ///< PB frame mode (0 = none, 1 = base, 2 = improved)
-
-/* the following codec id fields are deprecated in favor of codec_id */
-    int h263_plus;    ///< h263 plus headers
-    int h263_msmpeg4; ///< generate MSMPEG4 compatible stream (deprecated, use msmpeg4_version instead)
-    int h263_flv;     ///< use flv h263 header
-
-    enum CodecID codec_id;     /* see CODEC_ID_xxx */
-    int fixed_qscale; ///< fixed qscale if non zero
-    int encoding;     ///< true if we are encoding (vs decoding)
-    int flags;        ///< AVCodecContext.flags (HQ, MV4, ...)
-    int flags2;       ///< AVCodecContext.flags2
-    int max_b_frames; ///< max number of b-frames for encoding
-    int luma_elim_threshold;
-    int chroma_elim_threshold;
-    int strict_std_compliance; ///< strictly follow the std (MPEG4, ...)
-    int workaround_bugs;       ///< workaround bugs in encoders which cannot be detected automatically
-    int codec_tag;             ///< internal codec_tag upper case converted from avctx codec_tag
-    int stream_codec_tag;      ///< internal stream_codec_tag upper case converted from avctx stream_codec_tag
-    /* the following fields are managed internally by the encoder */
-
-    /** bit output */
-    PutBitContext pb;
-
-    /* sequence parameters */
-    int context_initialized;
-    int input_picture_number;  ///< used to set pic->display_picture_number, should not be used for/by anything else
-    int coded_picture_number;  ///< used to set pic->coded_picture_number, should not be used for/by anything else
-    int picture_number;       //FIXME remove, unclear definition
-    int picture_in_gop_number; ///< 0-> first pic in gop, ...
-    int b_frames_since_non_b;  ///< used for encoding, relative to not yet reordered input
-    int64_t user_specified_pts;///< last non zero pts from AVFrame which was passed into avcodec_encode_video()
-    int mb_width, mb_height;   ///< number of MBs horizontally & vertically
-    int mb_stride;             ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
-    int b8_stride;             ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
-    int b4_stride;             ///< 4*mb_width+1 used for some 4x4 block arrays to allow simple addressing
-    int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replication)
-    int mb_num;                ///< number of MBs of a picture
-    int linesize;              ///< line size, in bytes, may be different from width
-    int uvlinesize;            ///< line size, for chroma in bytes, may be different from width
-    Picture *picture;          ///< main picture buffer
-    Picture **input_picture;   ///< next pictures on display order for encoding
-    Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding
-
-    int start_mb_y;            ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
-    int end_mb_y;              ///< end   mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y)
-    struct MpegEncContext *thread_context[MAX_THREADS];
-
-    /**
-     * copy of the previous picture structure.
-     * note, linesize & data, might not match the previous picture (for field pictures)
-     */
-    Picture last_picture;
-
-    /**
-     * copy of the next picture structure.
-     * note, linesize & data, might not match the next picture (for field pictures)
-     */
-    Picture next_picture;
-
-    /**
-     * copy of the source picture structure for encoding.
-     * note, linesize & data, might not match the source picture (for field pictures)
-     */
-    Picture new_picture;
-
-    /**
-     * copy of the current picture structure.
-     * note, linesize & data, might not match the current picture (for field pictures)
-     */
-    Picture current_picture;    ///< buffer to store the decompressed current picture
-
-    Picture *last_picture_ptr;     ///< pointer to the previous picture.
-    Picture *next_picture_ptr;     ///< pointer to the next picture (for bidir pred)
-    Picture *current_picture_ptr;  ///< pointer to the current picture
-    uint8_t *visualization_buffer[3]; //< temporary buffer vor MV visualization
-    int last_dc[3];                ///< last DC values for MPEG1
-    int16_t *dc_val_base;
-    int16_t *dc_val[3];            ///< used for mpeg4 DC prediction, all 3 arrays must be continuous
-    int16_t dc_cache[4*5];
-    int y_dc_scale, c_dc_scale;
-    const uint8_t *y_dc_scale_table;     ///< qscale -> y_dc_scale table
-    const uint8_t *c_dc_scale_table;     ///< qscale -> c_dc_scale table
-    const uint8_t *chroma_qscale_table;  ///< qscale -> chroma_qscale (h263)
-    uint8_t *coded_block_base;
-    uint8_t *coded_block;          ///< used for coded block pattern prediction (msmpeg4v3, wmv1)
-    int16_t (*ac_val_base)[16];
-    int16_t (*ac_val[3])[16];      ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous
-    int ac_pred;
-    uint8_t *prev_pict_types;     ///< previous picture types in bitstream order, used for mb skip
-#define PREV_PICT_TYPES_BUFFER_SIZE 256
-    int mb_skipped;                ///< MUST BE SET only during DECODING
-    uint8_t *mbskip_table;        /**< used to avoid copy if macroblock skipped (for black regions for example)
-                                   and used for b-frame encoding & decoding (contains skip table of next P Frame) */
-    uint8_t *mbintra_table;       ///< used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding
-    uint8_t *cbp_table;           ///< used to store cbp, ac_pred for partitioned decoding
-    uint8_t *pred_dir_table;      ///< used to store pred_dir for partitioned decoding
-    uint8_t *allocated_edge_emu_buffer;
-    uint8_t *edge_emu_buffer;     ///< points into the middle of allocated_edge_emu_buffer
-    uint8_t *rd_scratchpad;       ///< scratchpad for rate distortion mb decision
-    uint8_t *obmc_scratchpad;
-    uint8_t *b_scratchpad;        ///< scratchpad used for writing into write only buffers
-
-    int qscale;                 ///< QP
-    int chroma_qscale;          ///< chroma QP
-    unsigned int lambda;        ///< lagrange multipler used in rate distortion
-    unsigned int lambda2;       ///< (lambda*lambda) >> FF_LAMBDA_SHIFT
-    int *lambda_table;
-    int adaptive_quant;         ///< use adaptive quantization
-    int dquant;                 ///< qscale difference to prev qscale
-    int closed_gop;             ///< MPEG1/2 GOP is closed
-    int pict_type;              ///< FF_I_TYPE, FF_P_TYPE, FF_B_TYPE, ...
-    int last_pict_type; //FIXME removes
-    int last_non_b_pict_type;   ///< used for mpeg4 gmc b-frames & ratecontrol
-    int dropable;
-    int frame_rate_index;
-    int last_lambda_for[5];     ///< last lambda for a specific pict type
-    int skipdct;                ///< skip dct and code zero residual
-
-    /* motion compensation */
-    int unrestricted_mv;        ///< mv can point outside of the coded picture
-    int h263_long_vectors;      ///< use horrible h263v1 long vector mode
-    int decode;                 ///< if 0 then decoding will be skipped (for encoding b frames for example)
-
-    DSPContext dsp;             ///< pointers for accelerated dsp functions
-    int f_code;                 ///< forward MV resolution
-    int b_code;                 ///< backward MV resolution for B Frames (mpeg4)
-    int16_t (*p_mv_table_base)[2];
-    int16_t (*b_forw_mv_table_base)[2];
-    int16_t (*b_back_mv_table_base)[2];
-    int16_t (*b_bidir_forw_mv_table_base)[2];
-    int16_t (*b_bidir_back_mv_table_base)[2];
-    int16_t (*b_direct_mv_table_base)[2];
-    int16_t (*p_field_mv_table_base[2][2])[2];
-    int16_t (*b_field_mv_table_base[2][2][2])[2];
-    int16_t (*p_mv_table)[2];            ///< MV table (1MV per MB) p-frame encoding
-    int16_t (*b_forw_mv_table)[2];       ///< MV table (1MV per MB) forward mode b-frame encoding
-    int16_t (*b_back_mv_table)[2];       ///< MV table (1MV per MB) backward mode b-frame encoding
-    int16_t (*b_bidir_forw_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding
-    int16_t (*b_bidir_back_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding
-    int16_t (*b_direct_mv_table)[2];     ///< MV table (1MV per MB) direct mode b-frame encoding
-    int16_t (*p_field_mv_table[2][2])[2];   ///< MV table (2MV per MB) interlaced p-frame encoding
-    int16_t (*b_field_mv_table[2][2][2])[2];///< MV table (4MV per MB) interlaced b-frame encoding
-    uint8_t (*p_field_select_table[2]);
-    uint8_t (*b_field_select_table[2][2]);
-    int me_method;                       ///< ME algorithm
-    int mv_dir;
-#define MV_DIR_FORWARD   1
-#define MV_DIR_BACKWARD  2
-#define MV_DIRECT        4 ///< bidirectional mode where the difference equals the MV of the last P/S/I-Frame (mpeg4)
-    int mv_type;
-#define MV_TYPE_16X16       0   ///< 1 vector for the whole mb
-#define MV_TYPE_8X8         1   ///< 4 vectors (h263, mpeg4 4MV)
-#define MV_TYPE_16X8        2   ///< 2 vectors, one per 16x8 block
-#define MV_TYPE_FIELD       3   ///< 2 vectors, one per field
-#define MV_TYPE_DMV         4   ///< 2 vectors, special mpeg2 Dual Prime Vectors
-    /**motion vectors for a macroblock
-       first coordinate : 0 = forward 1 = backward
-       second "         : depend on type
-       third  "         : 0 = x, 1 = y
-    */
-    int mv[2][4][2];
-    int field_select[2][2];
-    int last_mv[2][2][2];             ///< last MV, used for MV prediction in MPEG1 & B-frame MPEG4
-    uint8_t *fcode_tab;               ///< smallest fcode needed for each MV
-    int16_t direct_scale_mv[2][64];   ///< precomputed to avoid divisions in ff_mpeg4_set_direct_mv
-
-    MotionEstContext me;
-
-    int no_rounding;  /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
-                        for b-frames rounding mode is always 0 */
-
-    int hurry_up;     /**< when set to 1 during decoding, b frames will be skipped
-                         when set to 2 idct/dequant will be skipped too */
-
-    /* macroblock layer */
-    int mb_x, mb_y;
-    int mb_skip_run;
-    int mb_intra;
-    uint16_t *mb_type;           ///< Table for candidate MB types for encoding
-#define CANDIDATE_MB_TYPE_INTRA    0x01
-#define CANDIDATE_MB_TYPE_INTER    0x02
-#define CANDIDATE_MB_TYPE_INTER4V  0x04
-#define CANDIDATE_MB_TYPE_SKIPPED   0x08
-//#define MB_TYPE_GMC      0x10
-
-#define CANDIDATE_MB_TYPE_DIRECT   0x10
-#define CANDIDATE_MB_TYPE_FORWARD  0x20
-#define CANDIDATE_MB_TYPE_BACKWARD 0x40
-#define CANDIDATE_MB_TYPE_BIDIR    0x80
-
-#define CANDIDATE_MB_TYPE_INTER_I    0x100
-#define CANDIDATE_MB_TYPE_FORWARD_I  0x200
-#define CANDIDATE_MB_TYPE_BACKWARD_I 0x400
-#define CANDIDATE_MB_TYPE_BIDIR_I    0x800
-
-#define CANDIDATE_MB_TYPE_DIRECT0    0x1000
-
-    int block_index[6]; ///< index to current MB in block based arrays with edges
-    int block_wrap[6];
-    uint8_t *dest[3];
-
-    int *mb_index2xy;        ///< mb_index -> mb_x + mb_y*mb_stride
-
-    /** matrix transmitted in the bitstream */
-    uint16_t intra_matrix[64];
-    uint16_t chroma_intra_matrix[64];
-    uint16_t inter_matrix[64];
-    uint16_t chroma_inter_matrix[64];
-#define QUANT_BIAS_SHIFT 8
-    int intra_quant_bias;    ///< bias for the quantizer
-    int inter_quant_bias;    ///< bias for the quantizer
-    int min_qcoeff;          ///< minimum encodable coefficient
-    int max_qcoeff;          ///< maximum encodable coefficient
-    int ac_esc_length;       ///< num of bits needed to encode the longest esc
-    uint8_t *intra_ac_vlc_length;
-    uint8_t *intra_ac_vlc_last_length;
-    uint8_t *inter_ac_vlc_length;
-    uint8_t *inter_ac_vlc_last_length;
-    uint8_t *luma_dc_vlc_length;
-    uint8_t *chroma_dc_vlc_length;
-#define UNI_AC_ENC_INDEX(run,level) ((run)*128 + (level))
-
-    int coded_score[8];
-
-    /** precomputed matrix (combine qscale and DCT renorm) */
-    int (*q_intra_matrix)[64];
-    int (*q_inter_matrix)[64];
-    /** identical to the above but for MMX & these are not permutated, second 64 entries are bias*/
-    uint16_t (*q_intra_matrix16)[2][64];
-    uint16_t (*q_inter_matrix16)[2][64];
-    int block_last_index[12];  ///< last non zero coefficient in block
-    /* scantables */
-    ScanTable intra_scantable;
-    ScanTable intra_h_scantable;
-    ScanTable intra_v_scantable;
-    ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage
-
-    /* noise reduction */
-    int (*dct_error_sum)[64];
-    int dct_count[2];
-    uint16_t (*dct_offset)[64];
-
-    void *opaque;              ///< private data for the user
-
-    /* bit rate control */
-    int64_t wanted_bits;
-    int64_t total_bits;
-    int frame_bits;                ///< bits used for the current frame
-    int next_lambda;               ///< next lambda used for retrying to encode a frame
-    RateControlContext rc_context; ///< contains stuff only accessed in ratecontrol.c
-
-    /* statistics, used for 2-pass encoding */
-    int mv_bits;
-    int header_bits;
-    int i_tex_bits;
-    int p_tex_bits;
-    int i_count;
-    int f_count;
-    int b_count;
-    int skip_count;
-    int misc_bits; ///< cbp, mb_type
-    int last_bits; ///< temp var used for calculating the above vars
-
-    /* error concealment / resync */
-    int error_count;
-    uint8_t *error_status_table;       ///< table of the error status of each MB
-#define VP_START            1          ///< current MB is the first after a resync marker
-#define AC_ERROR            2
-#define DC_ERROR            4
-#define MV_ERROR            8
-#define AC_END              16
-#define DC_END              32
-#define MV_END              64
-//FIXME some prefix?
-
-    int resync_mb_x;                 ///< x position of last resync marker
-    int resync_mb_y;                 ///< y position of last resync marker
-    GetBitContext last_resync_gb;    ///< used to search for the next resync marker
-    int mb_num_left;                 ///< number of MBs left in this video packet (for partitioned Slices only)
-    int next_p_frame_damaged;        ///< set if the next p frame is damaged, to avoid showing trashed b frames
-    int error_recognition;
-
-    ParseContext parse_context;
-
-    /* H.263 specific */
-    int gob_index;
-    int obmc;                       ///< overlapped block motion compensation
-    int showed_packed_warning;      ///< flag for having shown the warning about divxs invalid b frames
-
-    /* H.263+ specific */
-    int umvplus;                    ///< == H263+ && unrestricted_mv
-    int h263_aic;                   ///< Advanded INTRA Coding (AIC)
-    int h263_aic_dir;               ///< AIC direction: 0 = left, 1 = top
-    int h263_slice_structured;
-    int alt_inter_vlc;              ///< alternative inter vlc
-    int modified_quant;
-    int loop_filter;
-    int custom_pcf;
-
-    /* mpeg4 specific */
-    int time_increment_bits;        ///< number of bits to represent the fractional part of time
-    int last_time_base;
-    int time_base;                  ///< time in seconds of last I,P,S Frame
-    int64_t time;                   ///< time of current frame
-    int64_t last_non_b_time;
-    uint16_t pp_time;               ///< time distance between the last 2 p,s,i frames
-    uint16_t pb_time;               ///< time distance between the last b and p,s,i frame
-    uint16_t pp_field_time;
-    uint16_t pb_field_time;         ///< like above, just for interlaced
-    int shape;
-    int vol_sprite_usage;
-    int sprite_width;
-    int sprite_height;
-    int sprite_left;
-    int sprite_top;
-    int sprite_brightness_change;
-    int num_sprite_warping_points;
-    int real_sprite_warping_points;
-    uint16_t sprite_traj[4][2];      ///< sprite trajectory points
-    int sprite_offset[2][2];         ///< sprite offset[isChroma][isMVY]
-    int sprite_delta[2][2];          ///< sprite_delta [isY][isMVY]
-    int sprite_shift[2];             ///< sprite shift [isChroma]
-    int mcsel;
-    int quant_precision;
-    int quarter_sample;              ///< 1->qpel, 0->half pel ME/MC
-    int scalability;
-    int hierachy_type;
-    int enhancement_type;
-    int new_pred;
-    int reduced_res_vop;
-    int aspect_ratio_info; //FIXME remove
-    int sprite_warping_accuracy;
-    int low_latency_sprite;
-    int data_partitioning;           ///< data partitioning flag from header
-    int partitioned_frame;           ///< is current frame partitioned
-    int rvlc;                        ///< reversible vlc
-    int resync_marker;               ///< could this stream contain resync markers
-    int low_delay;                   ///< no reordering needed / has no b-frames
-    int vo_type;
-    int vol_control_parameters;      ///< does the stream contain the low_delay flag, used to workaround buggy encoders
-    int intra_dc_threshold;          ///< QP above whch the ac VLC should be used for intra dc
-    int use_intra_dc_vlc;
-    PutBitContext tex_pb;            ///< used for data partitioned VOPs
-    PutBitContext pb2;               ///< used for data partitioned VOPs
-    int mpeg_quant;
-    int t_frame;                       ///< time distance of first I -> B, used for interlaced b frames
-    int padding_bug_score;             ///< used to detect the VERY common padding bug in MPEG4
-    int cplx_estimation_trash_i;
-    int cplx_estimation_trash_p;
-    int cplx_estimation_trash_b;
-
-    /* divx specific, used to workaround (many) bugs in divx5 */
-    int divx_version;
-    int divx_build;
-    int divx_packed;
-    uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them
-    int bitstream_buffer_size;
-    unsigned int allocated_bitstream_buffer_size;
-
-    int xvid_build;
-
-    /* lavc specific stuff, used to workaround bugs in libavcodec */
-    int lavc_build;
-
-    /* RV10 specific */
-    int rv10_version; ///< RV10 version: 0 or 3
-    int rv10_first_dc_coded[3];
-    int orig_width, orig_height;
-
-    /* MJPEG specific */
-    struct MJpegContext *mjpeg_ctx;
-    int mjpeg_vsample[3];       ///< vertical sampling factors, default = {2, 1, 1}
-    int mjpeg_hsample[3];       ///< horizontal sampling factors, default = {2, 1, 1}
-
-    /* MSMPEG4 specific */
-    int mv_table_index;
-    int rl_table_index;
-    int rl_chroma_table_index;
-    int dc_table_index;
-    int use_skip_mb_code;
-    int slice_height;      ///< in macroblocks
-    int first_slice_line;  ///< used in mpeg4 too to handle resync markers
-    int flipflop_rounding;
-    int msmpeg4_version;   ///< 0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8
-    int per_mb_rl_table;
-    int esc3_level_length;
-    int esc3_run_length;
-    /** [mb_intra][isChroma][level][run][last] */
-    int (*ac_stats)[2][MAX_LEVEL+1][MAX_RUN+1][2];
-    int inter_intra_pred;
-    int mspel;
-
-    /* decompression specific */
-    GetBitContext gb;
-
-    /* Mpeg1 specific */
-    int gop_picture_number;  ///< index of the first picture of a GOP based on fake_pic_num & mpeg1 specific
-    int last_mv_dir;         ///< last mv_dir, used for b frame encoding
-    int broken_link;         ///< no_output_of_prior_pics_flag
-    uint8_t *vbv_delay_ptr;  ///< pointer to vbv_delay in the bitstream
-
-    /* MPEG-2-specific - I wished not to have to support this mess. */
-    int progressive_sequence;
-    int mpeg_f_code[2][2];
-    int picture_structure;
-/* picture type */
-#define PICT_TOP_FIELD     1
-#define PICT_BOTTOM_FIELD  2
-#define PICT_FRAME         3
-
-    int intra_dc_precision;
-    int frame_pred_frame_dct;
-    int top_field_first;
-    int concealment_motion_vectors;
-    int q_scale_type;
-    int intra_vlc_format;
-    int alternate_scan;
-    int repeat_first_field;
-    int chroma_420_type;
-    int chroma_format;
-#define CHROMA_420 1
-#define CHROMA_422 2
-#define CHROMA_444 3
-    int chroma_x_shift;//depend on pix_format, that depend on chroma_format
-    int chroma_y_shift;
-
-    int progressive_frame;
-    int full_pel[2];
-    int interlaced_dct;
-    int first_slice;
-    int first_field;         ///< is 1 for the first field of a field picture 0 otherwise
-
-    /* RTP specific */
-    int rtp_mode;
-
-    uint8_t *ptr_lastgob;
-    int swap_uv;             //vcr2 codec is an MPEG-2 variant with U and V swapped
-    DCTELEM (*pblocks[12])[64];
-
-    DCTELEM (*block)[64]; ///< points to one of the following blocks
-    DCTELEM (*blocks)[8][64]; // for HQ mode we need to keep the best block
-    int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]); // used by some codecs to avoid a switch()
-#define SLICE_OK         0
-#define SLICE_ERROR     -1
-#define SLICE_END       -2 ///<end marker found
-#define SLICE_NOEND     -3 ///<no end marker or error found but mb count exceeded
-
-    void (*dct_unquantize_mpeg1_intra)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_mpeg1_inter)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_mpeg2_intra)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_mpeg2_inter)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_h263_intra)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_h263_inter)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_h261_intra)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_h261_inter)(struct MpegEncContext *s,
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_intra)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    void (*dct_unquantize_inter)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
-                           DCTELEM *block/*align 16*/, int n, int qscale);
-    int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow);
-    int (*fast_dct_quantize)(struct MpegEncContext *s, DCTELEM *block/*align 16*/, int n, int qscale, int *overflow);
-    void (*denoise_dct)(struct MpegEncContext *s, DCTELEM *block);
-} MpegEncContext;
-
-
-void MPV_decode_defaults(MpegEncContext *s);
-int MPV_common_init(MpegEncContext *s);
-void MPV_common_end(MpegEncContext *s);
-void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]);
-int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
-void MPV_frame_end(MpegEncContext *s);
-int MPV_encode_init(AVCodecContext *avctx);
-int MPV_encode_end(AVCodecContext *avctx);
-int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data);
-void MPV_common_init_mmx(MpegEncContext *s);
-void MPV_common_init_axp(MpegEncContext *s);
-void MPV_common_init_mlib(MpegEncContext *s);
-void MPV_common_init_mmi(MpegEncContext *s);
-void MPV_common_init_arm(MpegEncContext *s);
-void MPV_common_init_altivec(MpegEncContext *s);
-void MPV_common_init_bfin(MpegEncContext *s);
-void ff_clean_intra_table_entries(MpegEncContext *s);
-void ff_draw_horiz_band(MpegEncContext *s, int y, int h);
-void ff_mpeg_flush(AVCodecContext *avctx);
-void ff_print_debug_info(MpegEncContext *s, AVFrame *pict);
-void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix);
-int ff_find_unused_picture(MpegEncContext *s, int shared);
-void ff_denoise_dct(MpegEncContext *s, DCTELEM *block);
-void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src);
-const uint8_t *ff_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state);
-void ff_set_qscale(MpegEncContext * s, int qscale);
-
-void ff_er_frame_start(MpegEncContext *s);
-void ff_er_frame_end(MpegEncContext *s);
-void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status);
-
-int ff_dct_common_init(MpegEncContext *s);
-void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64],
-                       const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra);
-
-void ff_init_block_index(MpegEncContext *s);
-void ff_copy_picture(Picture *dst, Picture *src);
-
-/**
- * allocates a Picture
- * The pixels are allocated/set by calling get_buffer() if shared=0
- */
-int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared);
-
-extern const enum PixelFormat ff_pixfmt_list_420[];
-extern const enum PixelFormat ff_hwaccel_pixfmt_list_420[];
-
-static inline void ff_update_block_index(MpegEncContext *s){
-    const int block_size= 8>>s->avctx->lowres;
-
-    s->block_index[0]+=2;
-    s->block_index[1]+=2;
-    s->block_index[2]+=2;
-    s->block_index[3]+=2;
-    s->block_index[4]++;
-    s->block_index[5]++;
-    s->dest[0]+= 2*block_size;
-    s->dest[1]+= block_size;
-    s->dest[2]+= block_size;
-}
-
-static inline int get_bits_diff(MpegEncContext *s){
-    const int bits= put_bits_count(&s->pb);
-    const int last= s->last_bits;
-
-    s->last_bits = bits;
-
-    return bits - last;
-}
-
-static inline int ff_h263_round_chroma(int x){
-    static const uint8_t h263_chroma_roundtab[16] = {
-    //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-        0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
-    };
-    return h263_chroma_roundtab[x & 0xf] + (x >> 3);
-}
-
-/* motion_est.c */
-void ff_estimate_p_frame_motion(MpegEncContext * s,
-                             int mb_x, int mb_y);
-void ff_estimate_b_frame_motion(MpegEncContext * s,
-                             int mb_x, int mb_y);
-int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type);
-void ff_fix_long_p_mvs(MpegEncContext * s);
-void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select,
-                     int16_t (*mv_table)[2], int f_code, int type, int truncate);
-int ff_init_me(MpegEncContext *s);
-int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y);
-int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr,
-                             int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
-                             int ref_mv_scale, int size, int h);
-int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index,
-                               int ref_index, int size, int h, int add_rate);
-
-/* mpeg12.c */
-extern const uint8_t ff_mpeg1_dc_scale_table[128];
-extern const uint8_t * const ff_mpeg2_dc_scale_table[4];
-
-void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
-void mpeg1_encode_mb(MpegEncContext *s,
-                     DCTELEM block[6][64],
-                     int motion_x, int motion_y);
-void ff_mpeg1_encode_init(MpegEncContext *s);
-void ff_mpeg1_encode_slice_header(MpegEncContext *s);
-void ff_mpeg1_clean_buffers(MpegEncContext *s);
-int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size, AVCodecParserContext *s);
-
-extern const uint8_t ff_aic_dc_scale_table[32];
-extern const uint8_t ff_h263_chroma_qscale_table[32];
-extern const uint8_t ff_h263_loop_filter_strength[32];
-
-/* h261.c */
-void ff_h261_loop_filter(MpegEncContext *s);
-void ff_h261_reorder_mb_index(MpegEncContext* s);
-void ff_h261_encode_mb(MpegEncContext *s,
-                    DCTELEM block[6][64],
-                    int motion_x, int motion_y);
-void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number);
-void ff_h261_encode_init(MpegEncContext *s);
-int ff_h261_get_picture_format(int width, int height);
-
-
-/* rv10.c */
-void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
-int rv_decode_dc(MpegEncContext *s, int n);
-void rv20_encode_picture_header(MpegEncContext *s, int picture_number);
-
-
-/* msmpeg4.c */
-void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number);
-void msmpeg4_encode_ext_header(MpegEncContext * s);
-void msmpeg4_encode_mb(MpegEncContext * s,
-                       DCTELEM block[6][64],
-                       int motion_x, int motion_y);
-int msmpeg4_decode_picture_header(MpegEncContext * s);
-int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
-int ff_msmpeg4_decode_init(AVCodecContext *avctx);
-void ff_msmpeg4_encode_init(MpegEncContext *s);
-int ff_wmv2_decode_picture_header(MpegEncContext * s);
-int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s);
-void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr);
-void ff_mspel_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
-                               int motion_x, int motion_y, int h);
-int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number);
-void ff_wmv2_encode_mb(MpegEncContext * s,
-                       DCTELEM block[6][64],
-                       int motion_x, int motion_y);
-
-#endif /* AVCODEC_MPEGVIDEO_H */
-
diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_common.h
deleted file mode 100644
index 7310666..0000000
--- a/libavcodec/mpegvideo_common.h
+++ /dev/null
@@ -1,901 +0,0 @@
-/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * The simplest mpeg encoder (well, it was the simplest!).
- */
-
-#ifndef AVCODEC_MPEGVIDEO_COMMON_H
-#define AVCODEC_MPEGVIDEO_COMMON_H
-
-#include <string.h>
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mjpegenc.h"
-#include "msmpeg4.h"
-#include "faandct.h"
-#include <limits.h>
-
-int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-void  denoise_dct_c(MpegEncContext *s, DCTELEM *block);
-
-/**
- * allocates a Picture
- * The pixels are allocated/set by calling get_buffer() if shared=0
- */
-int alloc_picture(MpegEncContext *s, Picture *pic, int shared);
-
-/**
- * sets the given MpegEncContext to common defaults (same for encoding and decoding).
- * the changed fields will not depend upon the prior state of the MpegEncContext.
- */
-void MPV_common_defaults(MpegEncContext *s);
-
-static inline void gmc1_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               uint8_t **ref_picture)
-{
-    uint8_t *ptr;
-    int offset, src_x, src_y, linesize, uvlinesize;
-    int motion_x, motion_y;
-    int emu=0;
-
-    motion_x= s->sprite_offset[0][0];
-    motion_y= s->sprite_offset[0][1];
-    src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy+1));
-    src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1));
-    motion_x<<=(3-s->sprite_warping_accuracy);
-    motion_y<<=(3-s->sprite_warping_accuracy);
-    src_x = av_clip(src_x, -16, s->width);
-    if (src_x == s->width)
-        motion_x =0;
-    src_y = av_clip(src_y, -16, s->height);
-    if (src_y == s->height)
-        motion_y =0;
-
-    linesize = s->linesize;
-    uvlinesize = s->uvlinesize;
-
-    ptr = ref_picture[0] + (src_y * linesize) + src_x;
-
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x >= s->h_edge_pos - 17
-           || (unsigned)src_y >= s->v_edge_pos - 17){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
-            ptr= s->edge_emu_buffer;
-        }
-    }
-
-    if((motion_x|motion_y)&7){
-        s->dsp.gmc1(dest_y  , ptr  , linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
-        s->dsp.gmc1(dest_y+8, ptr+8, linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
-    }else{
-        int dxy;
-
-        dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2);
-        if (s->no_rounding){
-            s->dsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16);
-        }else{
-            s->dsp.put_pixels_tab       [0][dxy](dest_y, ptr, linesize, 16);
-        }
-    }
-
-    if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
-
-    motion_x= s->sprite_offset[1][0];
-    motion_y= s->sprite_offset[1][1];
-    src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy+1));
-    src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1));
-    motion_x<<=(3-s->sprite_warping_accuracy);
-    motion_y<<=(3-s->sprite_warping_accuracy);
-    src_x = av_clip(src_x, -8, s->width>>1);
-    if (src_x == s->width>>1)
-        motion_x =0;
-    src_y = av_clip(src_y, -8, s->height>>1);
-    if (src_y == s->height>>1)
-        motion_y =0;
-
-    offset = (src_y * uvlinesize) + src_x;
-    ptr = ref_picture[1] + offset;
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x >= (s->h_edge_pos>>1) - 9
-           || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ptr= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
-
-    ptr = ref_picture[2] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
-    }
-    s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
-
-    return;
-}
-
-static inline void gmc_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               uint8_t **ref_picture)
-{
-    uint8_t *ptr;
-    int linesize, uvlinesize;
-    const int a= s->sprite_warping_accuracy;
-    int ox, oy;
-
-    linesize = s->linesize;
-    uvlinesize = s->uvlinesize;
-
-    ptr = ref_picture[0];
-
-    ox= s->sprite_offset[0][0] + s->sprite_delta[0][0]*s->mb_x*16 + s->sprite_delta[0][1]*s->mb_y*16;
-    oy= s->sprite_offset[0][1] + s->sprite_delta[1][0]*s->mb_x*16 + s->sprite_delta[1][1]*s->mb_y*16;
-
-    s->dsp.gmc(dest_y, ptr, linesize, 16,
-           ox,
-           oy,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos, s->v_edge_pos);
-    s->dsp.gmc(dest_y+8, ptr, linesize, 16,
-           ox + s->sprite_delta[0][0]*8,
-           oy + s->sprite_delta[1][0]*8,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos, s->v_edge_pos);
-
-    if(CONFIG_GRAY && s->flags&CODEC_FLAG_GRAY) return;
-
-    ox= s->sprite_offset[1][0] + s->sprite_delta[0][0]*s->mb_x*8 + s->sprite_delta[0][1]*s->mb_y*8;
-    oy= s->sprite_offset[1][1] + s->sprite_delta[1][0]*s->mb_x*8 + s->sprite_delta[1][1]*s->mb_y*8;
-
-    ptr = ref_picture[1];
-    s->dsp.gmc(dest_cb, ptr, uvlinesize, 8,
-           ox,
-           oy,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos>>1, s->v_edge_pos>>1);
-
-    ptr = ref_picture[2];
-    s->dsp.gmc(dest_cr, ptr, uvlinesize, 8,
-           ox,
-           oy,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos>>1, s->v_edge_pos>>1);
-}
-
-static inline int hpel_motion(MpegEncContext *s,
-                                  uint8_t *dest, uint8_t *src,
-                                  int field_based, int field_select,
-                                  int src_x, int src_y,
-                                  int width, int height, int stride,
-                                  int h_edge_pos, int v_edge_pos,
-                                  int w, int h, op_pixels_func *pix_op,
-                                  int motion_x, int motion_y)
-{
-    int dxy;
-    int emu=0;
-
-    dxy = ((motion_y & 1) << 1) | (motion_x & 1);
-    src_x += motion_x >> 1;
-    src_y += motion_y >> 1;
-
-    /* WARNING: do no forget half pels */
-    src_x = av_clip(src_x, -16, width); //FIXME unneeded for emu?
-    if (src_x == width)
-        dxy &= ~1;
-    src_y = av_clip(src_y, -16, height);
-    if (src_y == height)
-        dxy &= ~2;
-    src += src_y * stride + src_x;
-
-    if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
-        if(   (unsigned)src_x > h_edge_pos - (motion_x&1) - w
-           || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
-            ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
-                             src_x, src_y<<field_based, h_edge_pos, s->v_edge_pos);
-            src= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    if(field_select)
-        src += s->linesize;
-    pix_op[dxy](dest, src, stride, h);
-    return emu;
-}
-
-static av_always_inline
-void mpeg_motion_internal(MpegEncContext *s,
-                 uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                 int field_based, int bottom_field, int field_select,
-                 uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
-                 int motion_x, int motion_y, int h, int is_mpeg12, int mb_y)
-{
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int dxy, uvdxy, mx, my, src_x, src_y,
-        uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
-
-#if 0
-if(s->quarter_sample)
-{
-    motion_x>>=1;
-    motion_y>>=1;
-}
-#endif
-
-    v_edge_pos = s->v_edge_pos >> field_based;
-    linesize   = s->current_picture.linesize[0] << field_based;
-    uvlinesize = s->current_picture.linesize[1] << field_based;
-
-    dxy = ((motion_y & 1) << 1) | (motion_x & 1);
-    src_x = s->mb_x* 16               + (motion_x >> 1);
-    src_y =(   mb_y<<(4-field_based)) + (motion_y >> 1);
-
-    if (!is_mpeg12 && s->out_format == FMT_H263) {
-        if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){
-            mx = (motion_x>>1)|(motion_x&1);
-            my = motion_y >>1;
-            uvdxy = ((my & 1) << 1) | (mx & 1);
-            uvsrc_x = s->mb_x* 8               + (mx >> 1);
-            uvsrc_y =(   mb_y<<(3-field_based))+ (my >> 1);
-        }else{
-            uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
-            uvsrc_x = src_x>>1;
-            uvsrc_y = src_y>>1;
-        }
-    }else if(!is_mpeg12 && s->out_format == FMT_H261){//even chroma mv's are full pel in H261
-        mx = motion_x / 4;
-        my = motion_y / 4;
-        uvdxy = 0;
-        uvsrc_x = s->mb_x*8 + mx;
-        uvsrc_y =    mb_y*8 + my;
-    } else {
-        if(s->chroma_y_shift){
-            mx = motion_x / 2;
-            my = motion_y / 2;
-            uvdxy = ((my & 1) << 1) | (mx & 1);
-            uvsrc_x = s->mb_x* 8               + (mx >> 1);
-            uvsrc_y =(   mb_y<<(3-field_based))+ (my >> 1);
-        } else {
-            if(s->chroma_x_shift){
-            //Chroma422
-                mx = motion_x / 2;
-                uvdxy = ((motion_y & 1) << 1) | (mx & 1);
-                uvsrc_x = s->mb_x* 8           + (mx >> 1);
-                uvsrc_y = src_y;
-            } else {
-            //Chroma444
-                uvdxy = dxy;
-                uvsrc_x = src_x;
-                uvsrc_y = src_y;
-            }
-        }
-    }
-
-    ptr_y  = ref_picture[0] + src_y * linesize + src_x;
-    ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
-    ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
-    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16
-       || (unsigned)src_y >    v_edge_pos - (motion_y&1) - h){
-            if(is_mpeg12 || s->codec_id == CODEC_ID_MPEG2VIDEO ||
-               s->codec_id == CODEC_ID_MPEG1VIDEO){
-                av_log(s->avctx,AV_LOG_DEBUG,
-                        "MPEG motion vector out of boundary (%d %d)\n", src_x, src_y);
-                return;
-            }
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
-                                17, 17+field_based,
-                                src_x, src_y<<field_based,
-                                s->h_edge_pos, s->v_edge_pos);
-            ptr_y = s->edge_emu_buffer;
-            if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-                uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
-                ff_emulated_edge_mc(uvbuf ,
-                                    ptr_cb, s->uvlinesize,
-                                    9, 9+field_based,
-                                    uvsrc_x, uvsrc_y<<field_based,
-                                    s->h_edge_pos>>1, s->v_edge_pos>>1);
-                ff_emulated_edge_mc(uvbuf+16,
-                                    ptr_cr, s->uvlinesize,
-                                    9, 9+field_based,
-                                    uvsrc_x, uvsrc_y<<field_based,
-                                    s->h_edge_pos>>1, s->v_edge_pos>>1);
-                ptr_cb= uvbuf;
-                ptr_cr= uvbuf+16;
-            }
-    }
-
-    if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
-        dest_y += s->linesize;
-        dest_cb+= s->uvlinesize;
-        dest_cr+= s->uvlinesize;
-    }
-
-    if(field_select){
-        ptr_y += s->linesize;
-        ptr_cb+= s->uvlinesize;
-        ptr_cr+= s->uvlinesize;
-    }
-
-    pix_op[0][dxy](dest_y, ptr_y, linesize, h);
-
-    if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-        pix_op[s->chroma_x_shift][uvdxy]
-                (dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift);
-        pix_op[s->chroma_x_shift][uvdxy]
-                (dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
-    }
-    if(!is_mpeg12 && (CONFIG_H261_ENCODER || CONFIG_H261_DECODER) &&
-         s->out_format == FMT_H261){
-        ff_h261_loop_filter(s);
-    }
-}
-/* apply one mpeg motion vector to the three components */
-static av_always_inline
-void mpeg_motion(MpegEncContext *s,
-                 uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                 int field_based, int bottom_field, int field_select,
-                 uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
-                 int motion_x, int motion_y, int h, int mb_y)
-{
-#if !CONFIG_SMALL
-    if(s->out_format == FMT_MPEG1)
-        mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based,
-                    bottom_field, field_select, ref_picture, pix_op,
-                    motion_x, motion_y, h, 1, mb_y);
-    else
-#endif
-        mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based,
-                    bottom_field, field_select, ref_picture, pix_op,
-                    motion_x, motion_y, h, 0, mb_y);
-}
-
-//FIXME move to dsputil, avg variant, 16x16 version
-static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride){
-    int x;
-    uint8_t * const top   = src[1];
-    uint8_t * const left  = src[2];
-    uint8_t * const mid   = src[0];
-    uint8_t * const right = src[3];
-    uint8_t * const bottom= src[4];
-#define OBMC_FILTER(x, t, l, m, r, b)\
-    dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3
-#define OBMC_FILTER4(x, t, l, m, r, b)\
-    OBMC_FILTER(x         , t, l, m, r, b);\
-    OBMC_FILTER(x+1       , t, l, m, r, b);\
-    OBMC_FILTER(x  +stride, t, l, m, r, b);\
-    OBMC_FILTER(x+1+stride, t, l, m, r, b);
-
-    x=0;
-    OBMC_FILTER (x  , 2, 2, 4, 0, 0);
-    OBMC_FILTER (x+1, 2, 1, 5, 0, 0);
-    OBMC_FILTER4(x+2, 2, 1, 5, 0, 0);
-    OBMC_FILTER4(x+4, 2, 0, 5, 1, 0);
-    OBMC_FILTER (x+6, 2, 0, 5, 1, 0);
-    OBMC_FILTER (x+7, 2, 0, 4, 2, 0);
-    x+= stride;
-    OBMC_FILTER (x  , 1, 2, 5, 0, 0);
-    OBMC_FILTER (x+1, 1, 2, 5, 0, 0);
-    OBMC_FILTER (x+6, 1, 0, 5, 2, 0);
-    OBMC_FILTER (x+7, 1, 0, 5, 2, 0);
-    x+= stride;
-    OBMC_FILTER4(x  , 1, 2, 5, 0, 0);
-    OBMC_FILTER4(x+2, 1, 1, 6, 0, 0);
-    OBMC_FILTER4(x+4, 1, 0, 6, 1, 0);
-    OBMC_FILTER4(x+6, 1, 0, 5, 2, 0);
-    x+= 2*stride;
-    OBMC_FILTER4(x  , 0, 2, 5, 0, 1);
-    OBMC_FILTER4(x+2, 0, 1, 6, 0, 1);
-    OBMC_FILTER4(x+4, 0, 0, 6, 1, 1);
-    OBMC_FILTER4(x+6, 0, 0, 5, 2, 1);
-    x+= 2*stride;
-    OBMC_FILTER (x  , 0, 2, 5, 0, 1);
-    OBMC_FILTER (x+1, 0, 2, 5, 0, 1);
-    OBMC_FILTER4(x+2, 0, 1, 5, 0, 2);
-    OBMC_FILTER4(x+4, 0, 0, 5, 1, 2);
-    OBMC_FILTER (x+6, 0, 0, 5, 2, 1);
-    OBMC_FILTER (x+7, 0, 0, 5, 2, 1);
-    x+= stride;
-    OBMC_FILTER (x  , 0, 2, 4, 0, 2);
-    OBMC_FILTER (x+1, 0, 1, 5, 0, 2);
-    OBMC_FILTER (x+6, 0, 0, 5, 1, 2);
-    OBMC_FILTER (x+7, 0, 0, 4, 2, 2);
-}
-
-/* obmc for 1 8x8 luma block */
-static inline void obmc_motion(MpegEncContext *s,
-                               uint8_t *dest, uint8_t *src,
-                               int src_x, int src_y,
-                               op_pixels_func *pix_op,
-                               int16_t mv[5][2]/* mid top left right bottom*/)
-#define MID    0
-{
-    int i;
-    uint8_t *ptr[5];
-
-    assert(s->quarter_sample==0);
-
-    for(i=0; i<5; i++){
-        if(i && mv[i][0]==mv[MID][0] && mv[i][1]==mv[MID][1]){
-            ptr[i]= ptr[MID];
-        }else{
-            ptr[i]= s->obmc_scratchpad + 8*(i&1) + s->linesize*8*(i>>1);
-            hpel_motion(s, ptr[i], src, 0, 0,
-                        src_x, src_y,
-                        s->width, s->height, s->linesize,
-                        s->h_edge_pos, s->v_edge_pos,
-                        8, 8, pix_op,
-                        mv[i][0], mv[i][1]);
-        }
-    }
-
-    put_obmc(dest, ptr, s->linesize);
-}
-
-static inline void qpel_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               int field_based, int bottom_field, int field_select,
-                               uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
-                               qpel_mc_func (*qpix_op)[16],
-                               int motion_x, int motion_y, int h)
-{
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, linesize, uvlinesize;
-
-    dxy = ((motion_y & 3) << 2) | (motion_x & 3);
-    src_x = s->mb_x *  16                 + (motion_x >> 2);
-    src_y = s->mb_y * (16 >> field_based) + (motion_y >> 2);
-
-    v_edge_pos = s->v_edge_pos >> field_based;
-    linesize = s->linesize << field_based;
-    uvlinesize = s->uvlinesize << field_based;
-
-    if(field_based){
-        mx= motion_x/2;
-        my= motion_y>>1;
-    }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA2){
-        static const int rtab[8]= {0,0,1,1,0,0,0,1};
-        mx= (motion_x>>1) + rtab[motion_x&7];
-        my= (motion_y>>1) + rtab[motion_y&7];
-    }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA){
-        mx= (motion_x>>1)|(motion_x&1);
-        my= (motion_y>>1)|(motion_y&1);
-    }else{
-        mx= motion_x/2;
-        my= motion_y/2;
-    }
-    mx= (mx>>1)|(mx&1);
-    my= (my>>1)|(my&1);
-
-    uvdxy= (mx&1) | ((my&1)<<1);
-    mx>>=1;
-    my>>=1;
-
-    uvsrc_x = s->mb_x *  8                 + mx;
-    uvsrc_y = s->mb_y * (8 >> field_based) + my;
-
-    ptr_y  = ref_picture[0] +   src_y *   linesize +   src_x;
-    ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
-    ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
-    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 16
-       || (unsigned)src_y >    v_edge_pos - (motion_y&3) - h  ){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
-                            17, 17+field_based, src_x, src_y<<field_based,
-                            s->h_edge_pos, s->v_edge_pos);
-        ptr_y= s->edge_emu_buffer;
-        if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-            uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
-            ff_emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize,
-                                9, 9 + field_based,
-                                uvsrc_x, uvsrc_y<<field_based,
-                                s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ff_emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize,
-                                9, 9 + field_based,
-                                uvsrc_x, uvsrc_y<<field_based,
-                                s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ptr_cb= uvbuf;
-            ptr_cr= uvbuf + 16;
-        }
-    }
-
-    if(!field_based)
-        qpix_op[0][dxy](dest_y, ptr_y, linesize);
-    else{
-        if(bottom_field){
-            dest_y += s->linesize;
-            dest_cb+= s->uvlinesize;
-            dest_cr+= s->uvlinesize;
-        }
-
-        if(field_select){
-            ptr_y  += s->linesize;
-            ptr_cb += s->uvlinesize;
-            ptr_cr += s->uvlinesize;
-        }
-        //damn interlaced mode
-        //FIXME boundary mirroring is not exactly correct here
-        qpix_op[1][dxy](dest_y  , ptr_y  , linesize);
-        qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize);
-    }
-    if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
-        pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1);
-        pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1);
-    }
-}
-
-/**
- * h263 chroma 4mv motion compensation.
- */
-static inline void chroma_4mv_motion(MpegEncContext *s,
-                                     uint8_t *dest_cb, uint8_t *dest_cr,
-                                     uint8_t **ref_picture,
-                                     op_pixels_func *pix_op,
-                                     int mx, int my){
-    int dxy, emu=0, src_x, src_y, offset;
-    uint8_t *ptr;
-
-    /* In case of 8X8, we construct a single chroma motion vector
-       with a special rounding */
-    mx= ff_h263_round_chroma(mx);
-    my= ff_h263_round_chroma(my);
-
-    dxy = ((my & 1) << 1) | (mx & 1);
-    mx >>= 1;
-    my >>= 1;
-
-    src_x = s->mb_x * 8 + mx;
-    src_y = s->mb_y * 8 + my;
-    src_x = av_clip(src_x, -8, s->width/2);
-    if (src_x == s->width/2)
-        dxy &= ~1;
-    src_y = av_clip(src_y, -8, s->height/2);
-    if (src_y == s->height/2)
-        dxy &= ~2;
-
-    offset = (src_y * (s->uvlinesize)) + src_x;
-    ptr = ref_picture[1] + offset;
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8
-           || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
-                                9, 9, src_x, src_y,
-                                s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ptr= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8);
-
-    ptr = ref_picture[2] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
-                            9, 9, src_x, src_y,
-                            s->h_edge_pos>>1, s->v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
-    }
-    pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8);
-}
-
-static inline void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir){
-    /* fetch pixels for estimated mv 4 macroblocks ahead
-     * optimized for 64byte cache lines */
-    const int shift = s->quarter_sample ? 2 : 1;
-    const int mx= (s->mv[dir][0][0]>>shift) + 16*s->mb_x + 8;
-    const int my= (s->mv[dir][0][1]>>shift) + 16*s->mb_y;
-    int off= mx + (my + (s->mb_x&3)*4)*s->linesize + 64;
-    s->dsp.prefetch(pix[0]+off, s->linesize, 4);
-    off= (mx>>1) + ((my>>1) + (s->mb_x&7))*s->uvlinesize + 64;
-    s->dsp.prefetch(pix[1]+off, pix[2]-pix[1], 2);
-}
-
-/**
- * motion compensation of a single macroblock
- * @param s context
- * @param dest_y luma destination pointer
- * @param dest_cb chroma cb/u destination pointer
- * @param dest_cr chroma cr/v destination pointer
- * @param dir direction (0->forward, 1->backward)
- * @param ref_picture array[3] of pointers to the 3 planes of the reference picture
- * @param pic_op halfpel motion compensation function (average or put normally)
- * @param pic_op qpel motion compensation function (average or put normally)
- * the motion vectors are taken from s->mv and the MV type from s->mv_type
- */
-static av_always_inline void MPV_motion_internal(MpegEncContext *s,
-                              uint8_t *dest_y, uint8_t *dest_cb,
-                              uint8_t *dest_cr, int dir,
-                              uint8_t **ref_picture,
-                              op_pixels_func (*pix_op)[4],
-                              qpel_mc_func (*qpix_op)[16], int is_mpeg12)
-{
-    int dxy, mx, my, src_x, src_y, motion_x, motion_y;
-    int mb_x, mb_y, i;
-    uint8_t *ptr, *dest;
-
-    mb_x = s->mb_x;
-    mb_y = s->mb_y;
-
-    prefetch_motion(s, ref_picture, dir);
-
-    if(!is_mpeg12 && s->obmc && s->pict_type != FF_B_TYPE){
-        int16_t mv_cache[4][4][2];
-        const int xy= s->mb_x + s->mb_y*s->mb_stride;
-        const int mot_stride= s->b8_stride;
-        const int mot_xy= mb_x*2 + mb_y*2*mot_stride;
-
-        assert(!s->mb_skipped);
-
-        memcpy(mv_cache[1][1], s->current_picture.motion_val[0][mot_xy           ], sizeof(int16_t)*4);
-        memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
-        memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
-
-        if(mb_y==0 || IS_INTRA(s->current_picture.mb_type[xy-s->mb_stride])){
-            memcpy(mv_cache[0][1], mv_cache[1][1], sizeof(int16_t)*4);
-        }else{
-            memcpy(mv_cache[0][1], s->current_picture.motion_val[0][mot_xy-mot_stride], sizeof(int16_t)*4);
-        }
-
-        if(mb_x==0 || IS_INTRA(s->current_picture.mb_type[xy-1])){
-            *(int32_t*)mv_cache[1][0]= *(int32_t*)mv_cache[1][1];
-            *(int32_t*)mv_cache[2][0]= *(int32_t*)mv_cache[2][1];
-        }else{
-            *(int32_t*)mv_cache[1][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1];
-            *(int32_t*)mv_cache[2][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1+mot_stride];
-        }
-
-        if(mb_x+1>=s->mb_width || IS_INTRA(s->current_picture.mb_type[xy+1])){
-            *(int32_t*)mv_cache[1][3]= *(int32_t*)mv_cache[1][2];
-            *(int32_t*)mv_cache[2][3]= *(int32_t*)mv_cache[2][2];
-        }else{
-            *(int32_t*)mv_cache[1][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2];
-            *(int32_t*)mv_cache[2][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2+mot_stride];
-        }
-
-        mx = 0;
-        my = 0;
-        for(i=0;i<4;i++) {
-            const int x= (i&1)+1;
-            const int y= (i>>1)+1;
-            int16_t mv[5][2]= {
-                {mv_cache[y][x  ][0], mv_cache[y][x  ][1]},
-                {mv_cache[y-1][x][0], mv_cache[y-1][x][1]},
-                {mv_cache[y][x-1][0], mv_cache[y][x-1][1]},
-                {mv_cache[y][x+1][0], mv_cache[y][x+1][1]},
-                {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}};
-            //FIXME cleanup
-            obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
-                        ref_picture[0],
-                        mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
-                        pix_op[1],
-                        mv);
-
-            mx += mv[0][0];
-            my += mv[0][1];
-        }
-        if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
-            chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
-
-        return;
-    }
-
-    switch(s->mv_type) {
-    case MV_TYPE_16X16:
-        if(s->mcsel){
-            if(s->real_sprite_warping_points==1){
-                gmc1_motion(s, dest_y, dest_cb, dest_cr,
-                            ref_picture);
-            }else{
-                gmc_motion(s, dest_y, dest_cb, dest_cr,
-                            ref_picture);
-            }
-        }else if(!is_mpeg12 && s->quarter_sample){
-            qpel_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, 0,
-                        ref_picture, pix_op, qpix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16);
-        }else if(!is_mpeg12 && (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) && s->mspel){
-            ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16);
-        }else
-        {
-            mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, 0,
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y);
-        }
-        break;
-    case MV_TYPE_8X8:
-    if (!is_mpeg12) {
-        mx = 0;
-        my = 0;
-        if(s->quarter_sample){
-            for(i=0;i<4;i++) {
-                motion_x = s->mv[dir][i][0];
-                motion_y = s->mv[dir][i][1];
-
-                dxy = ((motion_y & 3) << 2) | (motion_x & 3);
-                src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8;
-                src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8;
-
-                /* WARNING: do no forget half pels */
-                src_x = av_clip(src_x, -16, s->width);
-                if (src_x == s->width)
-                    dxy &= ~3;
-                src_y = av_clip(src_y, -16, s->height);
-                if (src_y == s->height)
-                    dxy &= ~12;
-
-                ptr = ref_picture[0] + (src_y * s->linesize) + (src_x);
-                if(s->flags&CODEC_FLAG_EMU_EDGE){
-                    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8
-                       || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){
-                        ff_emulated_edge_mc(s->edge_emu_buffer, ptr,
-                                            s->linesize, 9, 9,
-                                            src_x, src_y,
-                                            s->h_edge_pos, s->v_edge_pos);
-                        ptr= s->edge_emu_buffer;
-                    }
-                }
-                dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize;
-                qpix_op[1][dxy](dest, ptr, s->linesize);
-
-                mx += s->mv[dir][i][0]/2;
-                my += s->mv[dir][i][1]/2;
-            }
-        }else{
-            for(i=0;i<4;i++) {
-                hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
-                            ref_picture[0], 0, 0,
-                            mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
-                            s->width, s->height, s->linesize,
-                            s->h_edge_pos, s->v_edge_pos,
-                            8, 8, pix_op[1],
-                            s->mv[dir][i][0], s->mv[dir][i][1]);
-
-                mx += s->mv[dir][i][0];
-                my += s->mv[dir][i][1];
-            }
-        }
-
-        if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
-            chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
-    }
-        break;
-    case MV_TYPE_FIELD:
-        if (s->picture_structure == PICT_FRAME) {
-            if(!is_mpeg12 && s->quarter_sample){
-                for(i=0; i<2; i++){
-                    qpel_motion(s, dest_y, dest_cb, dest_cr,
-                                1, i, s->field_select[dir][i],
-                                ref_picture, pix_op, qpix_op,
-                                s->mv[dir][i][0], s->mv[dir][i][1], 8);
-                }
-            }else{
-                /* top field */
-                mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                            1, 0, s->field_select[dir][0],
-                            ref_picture, pix_op,
-                            s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y);
-                /* bottom field */
-                mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                            1, 1, s->field_select[dir][1],
-                            ref_picture, pix_op,
-                            s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
-            }
-        } else {
-            if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != FF_B_TYPE && !s->first_field){
-                ref_picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][0],
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y>>1);
-        }
-        break;
-    case MV_TYPE_16X8:
-        for(i=0; i<2; i++){
-            uint8_t ** ref2picture;
-
-            if(s->picture_structure == s->field_select[dir][i] + 1
-               || s->pict_type == FF_B_TYPE || s->first_field){
-                ref2picture= ref_picture;
-            }else{
-                ref2picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][i],
-                        ref2picture, pix_op,
-                        s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8, mb_y>>1);
-
-            dest_y += 16*s->linesize;
-            dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize;
-            dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize;
-        }
-        break;
-    case MV_TYPE_DMV:
-        if(s->picture_structure == PICT_FRAME){
-            for(i=0; i<2; i++){
-                int j;
-                for(j=0; j<2; j++){
-                    mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                                1, j, j^i,
-                                ref_picture, pix_op,
-                                s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8, mb_y);
-                }
-                pix_op = s->dsp.avg_pixels_tab;
-            }
-        }else{
-            for(i=0; i<2; i++){
-                mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                            0, 0, s->picture_structure != i+1,
-                            ref_picture, pix_op,
-                            s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1);
-
-                // after put we make avg of the same block
-                pix_op=s->dsp.avg_pixels_tab;
-
-                //opposite parity is always in the same frame if this is second field
-                if(!s->first_field){
-                    ref_picture = s->current_picture_ptr->data;
-                }
-            }
-        }
-    break;
-    default: assert(0);
-    }
-}
-
-static inline void MPV_motion(MpegEncContext *s,
-                              uint8_t *dest_y, uint8_t *dest_cb,
-                              uint8_t *dest_cr, int dir,
-                              uint8_t **ref_picture,
-                              op_pixels_func (*pix_op)[4],
-                              qpel_mc_func (*qpix_op)[16])
-{
-#if !CONFIG_SMALL
-    if(s->out_format == FMT_MPEG1)
-        MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
-                            ref_picture, pix_op, qpix_op, 1);
-    else
-#endif
-        MPV_motion_internal(s, dest_y, dest_cb, dest_cr, dir,
-                            ref_picture, pix_op, qpix_op, 0);
-}
-#endif /* AVCODEC_MPEGVIDEO_COMMON_H */
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
deleted file mode 100644
index a8616d0..0000000
--- a/libavcodec/mpegvideo_enc.c
+++ /dev/null
@@ -1,3842 +0,0 @@
-/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * The simplest mpeg encoder (well, it was the simplest!).
- */
-
-#include "libavutil/intmath.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mpegvideo_common.h"
-#include "h263.h"
-#include "mjpegenc.h"
-#include "msmpeg4.h"
-#include "faandct.h"
-#include "aandcttab.h"
-#include "flv.h"
-#include "mpeg4video.h"
-#include "internal.h"
-#include <limits.h>
-
-//#undef NDEBUG
-//#include <assert.h>
-
-static int encode_picture(MpegEncContext *s, int picture_number);
-static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale);
-static int sse_mb(MpegEncContext *s);
-
-/* enable all paranoid tests for rounding, overflows, etc... */
-//#define PARANOID
-
-//#define DEBUG
-
-static uint8_t default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1];
-static uint8_t default_fcode_tab[MAX_MV*2+1];
-
-void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64],
-                           const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra)
-{
-    int qscale;
-    int shift=0;
-
-    for(qscale=qmin; qscale<=qmax; qscale++){
-        int i;
-        if (dsp->fdct == ff_jpeg_fdct_islow
-#ifdef FAAN_POSTSCALE
-            || dsp->fdct == ff_faandct
-#endif
-            ) {
-            for(i=0;i<64;i++) {
-                const int j= dsp->idct_permutation[i];
-                /* 16 <= qscale * quant_matrix[i] <= 7905 */
-                /* 19952             <= ff_aanscales[i] * qscale * quant_matrix[i]               <= 249205026 */
-                /* (1 << 36) / 19952 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= (1 << 36) / 249205026 */
-                /* 3444240           >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= 275 */
-
-                qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) /
-                                (qscale * quant_matrix[j]));
-            }
-        } else if (dsp->fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
-                   || dsp->fdct == ff_faandct
-#endif
-                   ) {
-            for(i=0;i<64;i++) {
-                const int j= dsp->idct_permutation[i];
-                /* 16 <= qscale * quant_matrix[i] <= 7905 */
-                /* 19952             <= ff_aanscales[i] * qscale * quant_matrix[i]               <= 249205026 */
-                /* (1 << 36) / 19952 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */
-                /* 3444240           >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= 275 */
-
-                qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) /
-                                (ff_aanscales[i] * qscale * quant_matrix[j]));
-            }
-        } else {
-            for(i=0;i<64;i++) {
-                const int j= dsp->idct_permutation[i];
-                /* We can safely suppose that 16 <= quant_matrix[i] <= 255
-                   So 16           <= qscale * quant_matrix[i]             <= 7905
-                   so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905
-                   so 32768        >= (1<<19) / (qscale * quant_matrix[i]) >= 67
-                */
-                qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j]));
-//                qmat  [qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]);
-                qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]);
-
-                if(qmat16[qscale][0][i]==0 || qmat16[qscale][0][i]==128*256) qmat16[qscale][0][i]=128*256-1;
-                qmat16[qscale][1][i]= ROUNDED_DIV(bias<<(16-QUANT_BIAS_SHIFT), qmat16[qscale][0][i]);
-            }
-        }
-
-        for(i=intra; i<64; i++){
-            int64_t max= 8191;
-            if (dsp->fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
-                   || dsp->fdct == ff_faandct
-#endif
-                   ) {
-                max = (8191LL*ff_aanscales[i]) >> 14;
-            }
-            while(((max * qmat[qscale][i]) >> shift) > INT_MAX){
-                shift++;
-            }
-        }
-    }
-    if(shift){
-        av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - shift);
-    }
-}
-
-static inline void update_qscale(MpegEncContext *s){
-    s->qscale= (s->lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
-    s->qscale= av_clip(s->qscale, s->avctx->qmin, s->avctx->qmax);
-
-    s->lambda2= (s->lambda*s->lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
-}
-
-void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix){
-    int i;
-
-    if(matrix){
-        put_bits(pb, 1, 1);
-        for(i=0;i<64;i++) {
-            put_bits(pb, 8, matrix[ ff_zigzag_direct[i] ]);
-        }
-    }else
-        put_bits(pb, 1, 0);
-}
-
-/**
- * init s->current_picture.qscale_table from s->lambda_table
- */
-void ff_init_qscale_tab(MpegEncContext *s){
-    int8_t * const qscale_table= s->current_picture.qscale_table;
-    int i;
-
-    for(i=0; i<s->mb_num; i++){
-        unsigned int lam= s->lambda_table[ s->mb_index2xy[i] ];
-        int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
-        qscale_table[ s->mb_index2xy[i] ]= av_clip(qp, s->avctx->qmin, s->avctx->qmax);
-    }
-}
-
-static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *src){
-    int i;
-
-    dst->pict_type              = src->pict_type;
-    dst->quality                = src->quality;
-    dst->coded_picture_number   = src->coded_picture_number;
-    dst->display_picture_number = src->display_picture_number;
-//    dst->reference              = src->reference;
-    dst->pts                    = src->pts;
-    dst->interlaced_frame       = src->interlaced_frame;
-    dst->top_field_first        = src->top_field_first;
-
-    if(s->avctx->me_threshold){
-        if(!src->motion_val[0])
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_val not set!\n");
-        if(!src->mb_type)
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.mb_type not set!\n");
-        if(!src->ref_index[0])
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.ref_index not set!\n");
-        if(src->motion_subsample_log2 != dst->motion_subsample_log2)
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesn't match! (%d!=%d)\n",
-            src->motion_subsample_log2, dst->motion_subsample_log2);
-
-        memcpy(dst->mb_type, src->mb_type, s->mb_stride * s->mb_height * sizeof(dst->mb_type[0]));
-
-        for(i=0; i<2; i++){
-            int stride= ((16*s->mb_width )>>src->motion_subsample_log2) + 1;
-            int height= ((16*s->mb_height)>>src->motion_subsample_log2);
-
-            if(src->motion_val[i] && src->motion_val[i] != dst->motion_val[i]){
-                memcpy(dst->motion_val[i], src->motion_val[i], 2*stride*height*sizeof(int16_t));
-            }
-            if(src->ref_index[i] && src->ref_index[i] != dst->ref_index[i]){
-                memcpy(dst->ref_index[i], src->ref_index[i], s->mb_stride*4*s->mb_height*sizeof(int8_t));
-            }
-        }
-    }
-}
-
-static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContext *src){
-#define COPY(a) dst->a= src->a
-    COPY(pict_type);
-    COPY(current_picture);
-    COPY(f_code);
-    COPY(b_code);
-    COPY(qscale);
-    COPY(lambda);
-    COPY(lambda2);
-    COPY(picture_in_gop_number);
-    COPY(gop_picture_number);
-    COPY(frame_pred_frame_dct); //FIXME don't set in encode_header
-    COPY(progressive_frame); //FIXME don't set in encode_header
-    COPY(partitioned_frame); //FIXME don't set in encode_header
-#undef COPY
-}
-
-/**
- * sets the given MpegEncContext to defaults for encoding.
- * the changed fields will not depend upon the prior state of the MpegEncContext.
- */
-static void MPV_encode_defaults(MpegEncContext *s){
-    int i;
-    MPV_common_defaults(s);
-
-    for(i=-16; i<16; i++){
-        default_fcode_tab[i + MAX_MV]= 1;
-    }
-    s->me.mv_penalty= default_mv_penalty;
-    s->fcode_tab= default_fcode_tab;
-}
-
-/* init video encoder */
-av_cold int MPV_encode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    int i;
-    int chroma_h_shift, chroma_v_shift;
-
-    MPV_encode_defaults(s);
-
-    switch (avctx->codec_id) {
-    case CODEC_ID_MPEG2VIDEO:
-        if(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){
-            av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n");
-            return -1;
-        }
-        break;
-    case CODEC_ID_LJPEG:
-    case CODEC_ID_MJPEG:
-        if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && avctx->pix_fmt != PIX_FMT_RGB32 &&
-           ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){
-            av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
-            return -1;
-        }
-        break;
-    default:
-        if(avctx->pix_fmt != PIX_FMT_YUV420P){
-            av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n");
-            return -1;
-        }
-    }
-
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_YUVJ422P:
-    case PIX_FMT_YUV422P:
-        s->chroma_format = CHROMA_422;
-        break;
-    case PIX_FMT_YUVJ420P:
-    case PIX_FMT_YUV420P:
-    default:
-        s->chroma_format = CHROMA_420;
-        break;
-    }
-
-    s->bit_rate = avctx->bit_rate;
-    s->width = avctx->width;
-    s->height = avctx->height;
-    if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){
-        av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n");
-        avctx->gop_size=600;
-    }
-    s->gop_size = avctx->gop_size;
-    s->avctx = avctx;
-    s->flags= avctx->flags;
-    s->flags2= avctx->flags2;
-    s->max_b_frames= avctx->max_b_frames;
-    s->codec_id= avctx->codec->id;
-    s->luma_elim_threshold  = avctx->luma_elim_threshold;
-    s->chroma_elim_threshold= avctx->chroma_elim_threshold;
-    s->strict_std_compliance= avctx->strict_std_compliance;
-    s->data_partitioning= avctx->flags & CODEC_FLAG_PART;
-    s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0;
-    s->mpeg_quant= avctx->mpeg_quant;
-    s->rtp_mode= !!avctx->rtp_payload_size;
-    s->intra_dc_precision= avctx->intra_dc_precision;
-    s->user_specified_pts = AV_NOPTS_VALUE;
-
-    if (s->gop_size <= 1) {
-        s->intra_only = 1;
-        s->gop_size = 12;
-    } else {
-        s->intra_only = 0;
-    }
-
-    s->me_method = avctx->me_method;
-
-    /* Fixed QSCALE */
-    s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE);
-
-    s->adaptive_quant= (   s->avctx->lumi_masking
-                        || s->avctx->dark_masking
-                        || s->avctx->temporal_cplx_masking
-                        || s->avctx->spatial_cplx_masking
-                        || s->avctx->p_masking
-                        || s->avctx->border_masking
-                        || (s->flags&CODEC_FLAG_QP_RD))
-                       && !s->fixed_qscale;
-
-    s->obmc= !!(s->flags & CODEC_FLAG_OBMC);
-    s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER);
-    s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN);
-    s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);
-    s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT);
-
-    if(avctx->rc_max_rate && !avctx->rc_buffer_size){
-        av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n");
-        return -1;
-    }
-
-    if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){
-        av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n");
-    }
-
-    if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){
-        av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n");
-        return -1;
-    }
-
-    if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){
-        av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n");
-        return -1;
-    }
-
-    if(avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate){
-        av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n");
-    }
-
-    if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){
-        av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n");
-        return -1;
-    }
-
-    if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){
-        av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n");
-        return -1;
-    }
-
-    if(   s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate
-       && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO)
-       && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){
-
-        av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n");
-    }
-
-    if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4
-       && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){
-        av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n");
-        return -1;
-    }
-
-    if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){
-        av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n");
-        return -1;
-    }
-
-    if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){
-        av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n");
-        return -1;
-    }
-
-    if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){
-        av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n");
-        return -1;
-    }
-
-    if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){
-        av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n");
-        return -1;
-    }
-
-    if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){
-        av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n");
-        return -1;
-    }
-
-    if ((s->codec_id == CODEC_ID_MPEG4 || s->codec_id == CODEC_ID_H263 ||
-         s->codec_id == CODEC_ID_H263P) &&
-        (avctx->sample_aspect_ratio.num > 255 || avctx->sample_aspect_ratio.den > 255)) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i, limit is 255/255\n",
-               avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
-        return -1;
-    }
-
-    if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN))
-       && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){
-        av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n");
-        return -1;
-    }
-
-    if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too
-        av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n");
-        return -1;
-    }
-
-    if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){
-        av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
-        return -1;
-    }
-
-    if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){
-        av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n");
-        return -1;
-    }
-
-    if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){
-        av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, set threshold to 1000000000\n");
-        return -1;
-    }
-
-    if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){
-        av_log(avctx, AV_LOG_ERROR, "intra vlc table not supported by codec\n");
-        return -1;
-    }
-
-    if(s->flags & CODEC_FLAG_LOW_DELAY){
-        if (s->codec_id != CODEC_ID_MPEG2VIDEO){
-            av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n");
-            return -1;
-        }
-        if (s->max_b_frames != 0){
-            av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n");
-            return -1;
-        }
-    }
-
-    if(s->q_scale_type == 1){
-        if(s->codec_id != CODEC_ID_MPEG2VIDEO){
-            av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n");
-            return -1;
-        }
-        if(avctx->qmax > 12){
-            av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n");
-            return -1;
-        }
-    }
-
-    if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4
-       && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO
-       && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){
-        av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n");
-        return -1;
-    }
-
-    if(s->avctx->thread_count < 1){
-        av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n");
-        return -1;
-    }
-
-    if(s->avctx->thread_count > 1)
-        s->rtp_mode= 1;
-
-    if(!avctx->time_base.den || !avctx->time_base.num){
-        av_log(avctx, AV_LOG_ERROR, "framerate not set\n");
-        return -1;
-    }
-
-    i= (INT_MAX/2+128)>>8;
-    if(avctx->me_threshold >= i){
-        av_log(avctx, AV_LOG_ERROR, "me_threshold too large, max is %d\n", i - 1);
-        return -1;
-    }
-    if(avctx->mb_threshold >= i){
-        av_log(avctx, AV_LOG_ERROR, "mb_threshold too large, max is %d\n", i - 1);
-        return -1;
-    }
-
-    if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){
-        av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n");
-        avctx->b_frame_strategy = 0;
-    }
-
-    i= av_gcd(avctx->time_base.den, avctx->time_base.num);
-    if(i > 1){
-        av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n");
-        avctx->time_base.den /= i;
-        avctx->time_base.num /= i;
-//        return -1;
-    }
-
-    if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO || s->codec_id==CODEC_ID_MJPEG){
-        s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x
-        s->inter_quant_bias= 0;
-    }else{
-        s->intra_quant_bias=0;
-        s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x
-    }
-
-    if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
-        s->intra_quant_bias= avctx->intra_quant_bias;
-    if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
-        s->inter_quant_bias= avctx->inter_quant_bias;
-
-    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift);
-
-    if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){
-        av_log(avctx, AV_LOG_ERROR, "timebase not supported by mpeg 4 standard\n");
-        return -1;
-    }
-    s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1;
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_MPEG1VIDEO:
-        s->out_format = FMT_MPEG1;
-        s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY);
-        avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
-        break;
-    case CODEC_ID_MPEG2VIDEO:
-        s->out_format = FMT_MPEG1;
-        s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY);
-        avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
-        s->rtp_mode= 1;
-        break;
-    case CODEC_ID_LJPEG:
-    case CODEC_ID_MJPEG:
-        s->out_format = FMT_MJPEG;
-        s->intra_only = 1; /* force intra only for jpeg */
-        if(avctx->codec->id == CODEC_ID_LJPEG && avctx->pix_fmt == PIX_FMT_BGRA){
-            s->mjpeg_vsample[0] = s->mjpeg_hsample[0] =
-            s->mjpeg_vsample[1] = s->mjpeg_hsample[1] =
-            s->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1;
-        }else{
-            s->mjpeg_vsample[0] = 2;
-            s->mjpeg_vsample[1] = 2>>chroma_v_shift;
-            s->mjpeg_vsample[2] = 2>>chroma_v_shift;
-            s->mjpeg_hsample[0] = 2;
-            s->mjpeg_hsample[1] = 2>>chroma_h_shift;
-            s->mjpeg_hsample[2] = 2>>chroma_h_shift;
-        }
-        if (!(CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER)
-            || ff_mjpeg_encode_init(s) < 0)
-            return -1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_H261:
-        if (!CONFIG_H261_ENCODER)  return -1;
-        if (ff_h261_get_picture_format(s->width, s->height) < 0) {
-            av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height);
-            return -1;
-        }
-        s->out_format = FMT_H261;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_H263:
-        if (!CONFIG_H263_ENCODER)  return -1;
-        if (ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height) == 7) {
-            av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height);
-            return -1;
-        }
-        s->out_format = FMT_H263;
-        s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_H263P:
-        s->out_format = FMT_H263;
-        s->h263_plus = 1;
-        /* Fx */
-        s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0;
-        s->h263_aic= (avctx->flags & CODEC_FLAG_AC_PRED) ? 1:0;
-        s->modified_quant= s->h263_aic;
-        s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0;
-        s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0;
-        s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0;
-        s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus;
-        s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0;
-
-        /* /Fx */
-        /* These are just to be sure */
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_FLV1:
-        s->out_format = FMT_H263;
-        s->h263_flv = 2; /* format = 1; 11-bit codes */
-        s->unrestricted_mv = 1;
-        s->rtp_mode=0; /* don't allow GOB */
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_RV10:
-        s->out_format = FMT_H263;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_RV20:
-        s->out_format = FMT_H263;
-        avctx->delay=0;
-        s->low_delay=1;
-        s->modified_quant=1;
-        s->h263_aic=1;
-        s->h263_plus=1;
-        s->loop_filter=1;
-        s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus;
-        break;
-    case CODEC_ID_MPEG4:
-        s->out_format = FMT_H263;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->low_delay= s->max_b_frames ? 0 : 1;
-        avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
-        break;
-    case CODEC_ID_MSMPEG4V1:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_MSMPEG4V2:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 2;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_MSMPEG4V3:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 3;
-        s->flipflop_rounding=1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_WMV1:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 4;
-        s->flipflop_rounding=1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_WMV2:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 5;
-        s->flipflop_rounding=1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    default:
-        return -1;
-    }
-
-    avctx->has_b_frames= !s->low_delay;
-
-    s->encoding = 1;
-
-    s->progressive_frame=
-    s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN));
-
-    /* init */
-    if (MPV_common_init(s) < 0)
-        return -1;
-
-    if(!s->dct_quantize)
-        s->dct_quantize = dct_quantize_c;
-    if(!s->denoise_dct)
-        s->denoise_dct = denoise_dct_c;
-    s->fast_dct_quantize = s->dct_quantize;
-    if(avctx->trellis)
-        s->dct_quantize = dct_quantize_trellis_c;
-
-    if((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant)
-        s->chroma_qscale_table= ff_h263_chroma_qscale_table;
-
-    s->quant_precision=5;
-
-    ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp);
-    ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp);
-
-    if (CONFIG_H261_ENCODER && s->out_format == FMT_H261)
-        ff_h261_encode_init(s);
-    if (CONFIG_H263_ENCODER && s->out_format == FMT_H263)
-        h263_encode_init(s);
-    if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version)
-        ff_msmpeg4_encode_init(s);
-    if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
-        && s->out_format == FMT_MPEG1)
-        ff_mpeg1_encode_init(s);
-
-    /* init q matrix */
-    for(i=0;i<64;i++) {
-        int j= s->dsp.idct_permutation[i];
-        if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){
-            s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i];
-            s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i];
-        }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){
-            s->intra_matrix[j] =
-            s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i];
-        }else
-        { /* mpeg1/2 */
-            s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i];
-            s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i];
-        }
-        if(s->avctx->intra_matrix)
-            s->intra_matrix[j] = s->avctx->intra_matrix[i];
-        if(s->avctx->inter_matrix)
-            s->inter_matrix[j] = s->avctx->inter_matrix[i];
-    }
-
-    /* precompute matrix */
-    /* for mjpeg, we do include qscale in the matrix */
-    if (s->out_format != FMT_MJPEG) {
-        ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16,
-                       s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1);
-        ff_convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16,
-                       s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0);
-    }
-
-    if(ff_rate_control_init(s) < 0)
-        return -1;
-
-    return 0;
-}
-
-av_cold int MPV_encode_end(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    ff_rate_control_uninit(s);
-
-    MPV_common_end(s);
-    if ((CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) && s->out_format == FMT_MJPEG)
-        ff_mjpeg_encode_close(s);
-
-    av_freep(&avctx->extradata);
-
-    return 0;
-}
-
-static int get_sae(uint8_t *src, int ref, int stride){
-    int x,y;
-    int acc=0;
-
-    for(y=0; y<16; y++){
-        for(x=0; x<16; x++){
-            acc+= FFABS(src[x+y*stride] - ref);
-        }
-    }
-
-    return acc;
-}
-
-static int get_intra_count(MpegEncContext *s, uint8_t *src, uint8_t *ref, int stride){
-    int x, y, w, h;
-    int acc=0;
-
-    w= s->width &~15;
-    h= s->height&~15;
-
-    for(y=0; y<h; y+=16){
-        for(x=0; x<w; x+=16){
-            int offset= x + y*stride;
-            int sad = s->dsp.sad[0](NULL, src + offset, ref + offset, stride, 16);
-            int mean= (s->dsp.pix_sum(src + offset, stride) + 128)>>8;
-            int sae = get_sae(src + offset, mean, stride);
-
-            acc+= sae + 500 < sad;
-        }
-    }
-    return acc;
-}
-
-
-static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
-    AVFrame *pic=NULL;
-    int64_t pts;
-    int i;
-    const int encoding_delay= s->max_b_frames;
-    int direct=1;
-
-    if(pic_arg){
-        pts= pic_arg->pts;
-        pic_arg->display_picture_number= s->input_picture_number++;
-
-        if(pts != AV_NOPTS_VALUE){
-            if(s->user_specified_pts != AV_NOPTS_VALUE){
-                int64_t time= pts;
-                int64_t last= s->user_specified_pts;
-
-                if(time <= last){
-                    av_log(s->avctx, AV_LOG_ERROR, "Error, Invalid timestamp=%"PRId64", last=%"PRId64"\n", pts, s->user_specified_pts);
-                    return -1;
-                }
-            }
-            s->user_specified_pts= pts;
-        }else{
-            if(s->user_specified_pts != AV_NOPTS_VALUE){
-                s->user_specified_pts=
-                pts= s->user_specified_pts + 1;
-                av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%"PRId64")\n", pts);
-            }else{
-                pts= pic_arg->display_picture_number;
-            }
-        }
-    }
-
-  if(pic_arg){
-    if(encoding_delay && !(s->flags&CODEC_FLAG_INPUT_PRESERVED)) direct=0;
-    if(pic_arg->linesize[0] != s->linesize) direct=0;
-    if(pic_arg->linesize[1] != s->uvlinesize) direct=0;
-    if(pic_arg->linesize[2] != s->uvlinesize) direct=0;
-
-//    av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize);
-
-    if(direct){
-        i= ff_find_unused_picture(s, 1);
-
-        pic= (AVFrame*)&s->picture[i];
-        pic->reference= 3;
-
-        for(i=0; i<4; i++){
-            pic->data[i]= pic_arg->data[i];
-            pic->linesize[i]= pic_arg->linesize[i];
-        }
-        if(ff_alloc_picture(s, (Picture*)pic, 1) < 0){
-            return -1;
-        }
-    }else{
-        i= ff_find_unused_picture(s, 0);
-
-        pic= (AVFrame*)&s->picture[i];
-        pic->reference= 3;
-
-        if(ff_alloc_picture(s, (Picture*)pic, 0) < 0){
-            return -1;
-        }
-
-        if(   pic->data[0] + INPLACE_OFFSET == pic_arg->data[0]
-           && pic->data[1] + INPLACE_OFFSET == pic_arg->data[1]
-           && pic->data[2] + INPLACE_OFFSET == pic_arg->data[2]){
-       // empty
-        }else{
-            int h_chroma_shift, v_chroma_shift;
-            avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-
-            for(i=0; i<3; i++){
-                int src_stride= pic_arg->linesize[i];
-                int dst_stride= i ? s->uvlinesize : s->linesize;
-                int h_shift= i ? h_chroma_shift : 0;
-                int v_shift= i ? v_chroma_shift : 0;
-                int w= s->width >>h_shift;
-                int h= s->height>>v_shift;
-                uint8_t *src= pic_arg->data[i];
-                uint8_t *dst= pic->data[i];
-
-                if(!s->avctx->rc_buffer_size)
-                    dst +=INPLACE_OFFSET;
-
-                if(src_stride==dst_stride)
-                    memcpy(dst, src, src_stride*h);
-                else{
-                    while(h--){
-                        memcpy(dst, src, w);
-                        dst += dst_stride;
-                        src += src_stride;
-                    }
-                }
-            }
-        }
-    }
-    copy_picture_attributes(s, pic, pic_arg);
-    pic->pts= pts; //we set this here to avoid modifiying pic_arg
-  }
-
-    /* shift buffer entries */
-    for(i=1; i<MAX_PICTURE_COUNT /*s->encoding_delay+1*/; i++)
-        s->input_picture[i-1]= s->input_picture[i];
-
-    s->input_picture[encoding_delay]= (Picture*)pic;
-
-    return 0;
-}
-
-static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){
-    int x, y, plane;
-    int score=0;
-    int64_t score64=0;
-
-    for(plane=0; plane<3; plane++){
-        const int stride= p->linesize[plane];
-        const int bw= plane ? 1 : 2;
-        for(y=0; y<s->mb_height*bw; y++){
-            for(x=0; x<s->mb_width*bw; x++){
-                int off= p->type == FF_BUFFER_TYPE_SHARED ? 0: 16;
-                int v= s->dsp.frame_skip_cmp[1](s, p->data[plane] + 8*(x + y*stride)+off, ref->data[plane] + 8*(x + y*stride), stride, 8);
-
-                switch(s->avctx->frame_skip_exp){
-                    case 0: score= FFMAX(score, v); break;
-                    case 1: score+= FFABS(v);break;
-                    case 2: score+= v*v;break;
-                    case 3: score64+= FFABS(v*v*(int64_t)v);break;
-                    case 4: score64+= v*v*(int64_t)(v*v);break;
-                }
-            }
-        }
-    }
-
-    if(score) score64= score;
-
-    if(score64 < s->avctx->frame_skip_threshold)
-        return 1;
-    if(score64 < ((s->avctx->frame_skip_factor * (int64_t)s->lambda)>>8))
-        return 1;
-    return 0;
-}
-
-static int estimate_best_b_count(MpegEncContext *s){
-    AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
-    AVCodecContext *c= avcodec_alloc_context();
-    AVFrame input[FF_MAX_B_FRAMES+2];
-    const int scale= s->avctx->brd_scale;
-    int i, j, out_size, p_lambda, b_lambda, lambda2;
-    int outbuf_size= s->width * s->height; //FIXME
-    uint8_t *outbuf= av_malloc(outbuf_size);
-    int64_t best_rd= INT64_MAX;
-    int best_b_count= -1;
-
-    assert(scale>=0 && scale <=3);
-
-//    emms_c();
-    p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality;
-    b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
-    if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
-    lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
-
-    c->width = s->width >> scale;
-    c->height= s->height>> scale;
-    c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/;
-    c->flags|= s->avctx->flags & CODEC_FLAG_QPEL;
-    c->mb_decision= s->avctx->mb_decision;
-    c->me_cmp= s->avctx->me_cmp;
-    c->mb_cmp= s->avctx->mb_cmp;
-    c->me_sub_cmp= s->avctx->me_sub_cmp;
-    c->pix_fmt = PIX_FMT_YUV420P;
-    c->time_base= s->avctx->time_base;
-    c->max_b_frames= s->max_b_frames;
-
-    if (avcodec_open(c, codec) < 0)
-        return -1;
-
-    for(i=0; i<s->max_b_frames+2; i++){
-        int ysize= c->width*c->height;
-        int csize= (c->width/2)*(c->height/2);
-        Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr;
-
-        avcodec_get_frame_defaults(&input[i]);
-        input[i].data[0]= av_malloc(ysize + 2*csize);
-        input[i].data[1]= input[i].data[0] + ysize;
-        input[i].data[2]= input[i].data[1] + csize;
-        input[i].linesize[0]= c->width;
-        input[i].linesize[1]=
-        input[i].linesize[2]= c->width/2;
-
-        if(pre_input_ptr && (!i || s->input_picture[i-1])) {
-            pre_input= *pre_input_ptr;
-
-            if(pre_input.type != FF_BUFFER_TYPE_SHARED && i) {
-                pre_input.data[0]+=INPLACE_OFFSET;
-                pre_input.data[1]+=INPLACE_OFFSET;
-                pre_input.data[2]+=INPLACE_OFFSET;
-            }
-
-            s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height);
-            s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1);
-            s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1);
-        }
-    }
-
-    for(j=0; j<s->max_b_frames+1; j++){
-        int64_t rd=0;
-
-        if(!s->input_picture[j])
-            break;
-
-        c->error[0]= c->error[1]= c->error[2]= 0;
-
-        input[0].pict_type= FF_I_TYPE;
-        input[0].quality= 1 * FF_QP2LAMBDA;
-        out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]);
-//        rd += (out_size * lambda2) >> FF_LAMBDA_SHIFT;
-
-        for(i=0; i<s->max_b_frames+1; i++){
-            int is_p= i % (j+1) == j || i==s->max_b_frames;
-
-            input[i+1].pict_type= is_p ? FF_P_TYPE : FF_B_TYPE;
-            input[i+1].quality= is_p ? p_lambda : b_lambda;
-            out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]);
-            rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
-        }
-
-        /* get the delayed frames */
-        while(out_size){
-            out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
-            rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
-        }
-
-        rd += c->error[0] + c->error[1] + c->error[2];
-
-        if(rd < best_rd){
-            best_rd= rd;
-            best_b_count= j;
-        }
-    }
-
-    av_freep(&outbuf);
-    avcodec_close(c);
-    av_freep(&c);
-
-    for(i=0; i<s->max_b_frames+2; i++){
-        av_freep(&input[i].data[0]);
-    }
-
-    return best_b_count;
-}
-
-static int select_input_picture(MpegEncContext *s){
-    int i;
-
-    for(i=1; i<MAX_PICTURE_COUNT; i++)
-        s->reordered_input_picture[i-1]= s->reordered_input_picture[i];
-    s->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL;
-
-    /* set next picture type & ordering */
-    if(s->reordered_input_picture[0]==NULL && s->input_picture[0]){
-        if(/*s->picture_in_gop_number >= s->gop_size ||*/ s->next_picture_ptr==NULL || s->intra_only){
-            s->reordered_input_picture[0]= s->input_picture[0];
-            s->reordered_input_picture[0]->pict_type= FF_I_TYPE;
-            s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++;
-        }else{
-            int b_frames;
-
-            if(s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor){
-                if(s->picture_in_gop_number < s->gop_size && skip_check(s, s->input_picture[0], s->next_picture_ptr)){
-                //FIXME check that te gop check above is +-1 correct
-//av_log(NULL, AV_LOG_DEBUG, "skip %p %"PRId64"\n", s->input_picture[0]->data[0], s->input_picture[0]->pts);
-
-                    if(s->input_picture[0]->type == FF_BUFFER_TYPE_SHARED){
-                        for(i=0; i<4; i++)
-                            s->input_picture[0]->data[i]= NULL;
-                        s->input_picture[0]->type= 0;
-                    }else{
-                        assert(   s->input_picture[0]->type==FF_BUFFER_TYPE_USER
-                               || s->input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL);
-
-                        s->avctx->release_buffer(s->avctx, (AVFrame*)s->input_picture[0]);
-                    }
-
-                    emms_c();
-                    ff_vbv_update(s, 0);
-
-                    goto no_output_pic;
-                }
-            }
-
-            if(s->flags&CODEC_FLAG_PASS2){
-                for(i=0; i<s->max_b_frames+1; i++){
-                    int pict_num= s->input_picture[0]->display_picture_number + i;
-
-                    if(pict_num >= s->rc_context.num_entries)
-                        break;
-                    if(!s->input_picture[i]){
-                        s->rc_context.entry[pict_num-1].new_pict_type = FF_P_TYPE;
-                        break;
-                    }
-
-                    s->input_picture[i]->pict_type=
-                        s->rc_context.entry[pict_num].new_pict_type;
-                }
-            }
-
-            if(s->avctx->b_frame_strategy==0){
-                b_frames= s->max_b_frames;
-                while(b_frames && !s->input_picture[b_frames]) b_frames--;
-            }else if(s->avctx->b_frame_strategy==1){
-                for(i=1; i<s->max_b_frames+1; i++){
-                    if(s->input_picture[i] && s->input_picture[i]->b_frame_score==0){
-                        s->input_picture[i]->b_frame_score=
-                            get_intra_count(s, s->input_picture[i  ]->data[0],
-                                               s->input_picture[i-1]->data[0], s->linesize) + 1;
-                    }
-                }
-                for(i=0; i<s->max_b_frames+1; i++){
-                    if(s->input_picture[i]==NULL || s->input_picture[i]->b_frame_score - 1 > s->mb_num/s->avctx->b_sensitivity) break;
-                }
-
-                b_frames= FFMAX(0, i-1);
-
-                /* reset scores */
-                for(i=0; i<b_frames+1; i++){
-                    s->input_picture[i]->b_frame_score=0;
-                }
-            }else if(s->avctx->b_frame_strategy==2){
-                b_frames= estimate_best_b_count(s);
-            }else{
-                av_log(s->avctx, AV_LOG_ERROR, "illegal b frame strategy\n");
-                b_frames=0;
-            }
-
-            emms_c();
-//static int b_count=0;
-//b_count+= b_frames;
-//av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count);
-
-            for(i= b_frames - 1; i>=0; i--){
-                int type= s->input_picture[i]->pict_type;
-                if(type && type != FF_B_TYPE)
-                    b_frames= i;
-            }
-            if(s->input_picture[b_frames]->pict_type == FF_B_TYPE && b_frames == s->max_b_frames){
-                av_log(s->avctx, AV_LOG_ERROR, "warning, too many b frames in a row\n");
-            }
-
-            if(s->picture_in_gop_number + b_frames >= s->gop_size){
-              if((s->flags2 & CODEC_FLAG2_STRICT_GOP) && s->gop_size > s->picture_in_gop_number){
-                    b_frames= s->gop_size - s->picture_in_gop_number - 1;
-              }else{
-                if(s->flags & CODEC_FLAG_CLOSED_GOP)
-                    b_frames=0;
-                s->input_picture[b_frames]->pict_type= FF_I_TYPE;
-              }
-            }
-
-            if(   (s->flags & CODEC_FLAG_CLOSED_GOP)
-               && b_frames
-               && s->input_picture[b_frames]->pict_type== FF_I_TYPE)
-                b_frames--;
-
-            s->reordered_input_picture[0]= s->input_picture[b_frames];
-            if(s->reordered_input_picture[0]->pict_type != FF_I_TYPE)
-                s->reordered_input_picture[0]->pict_type= FF_P_TYPE;
-            s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++;
-            for(i=0; i<b_frames; i++){
-                s->reordered_input_picture[i+1]= s->input_picture[i];
-                s->reordered_input_picture[i+1]->pict_type= FF_B_TYPE;
-                s->reordered_input_picture[i+1]->coded_picture_number= s->coded_picture_number++;
-            }
-        }
-    }
-no_output_pic:
-    if(s->reordered_input_picture[0]){
-        s->reordered_input_picture[0]->reference= s->reordered_input_picture[0]->pict_type!=FF_B_TYPE ? 3 : 0;
-
-        ff_copy_picture(&s->new_picture, s->reordered_input_picture[0]);
-
-        if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED || s->avctx->rc_buffer_size){
-            // input is a shared pix, so we can't modifiy it -> alloc a new one & ensure that the shared one is reuseable
-
-            int i= ff_find_unused_picture(s, 0);
-            Picture *pic= &s->picture[i];
-
-            pic->reference              = s->reordered_input_picture[0]->reference;
-            if(ff_alloc_picture(s, pic, 0) < 0){
-                return -1;
-            }
-
-            /* mark us unused / free shared pic */
-            if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_INTERNAL)
-                s->avctx->release_buffer(s->avctx, (AVFrame*)s->reordered_input_picture[0]);
-            for(i=0; i<4; i++)
-                s->reordered_input_picture[0]->data[i]= NULL;
-            s->reordered_input_picture[0]->type= 0;
-
-            copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]);
-
-            s->current_picture_ptr= pic;
-        }else{
-            // input is not a shared pix -> reuse buffer for current_pix
-
-            assert(   s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER
-                   || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL);
-
-            s->current_picture_ptr= s->reordered_input_picture[0];
-            for(i=0; i<4; i++){
-                s->new_picture.data[i]+= INPLACE_OFFSET;
-            }
-        }
-        ff_copy_picture(&s->current_picture, s->current_picture_ptr);
-
-        s->picture_number= s->new_picture.display_picture_number;
-//printf("dpn:%d\n", s->picture_number);
-    }else{
-       memset(&s->new_picture, 0, sizeof(Picture));
-    }
-    return 0;
-}
-
-int MPV_encode_picture(AVCodecContext *avctx,
-                       unsigned char *buf, int buf_size, void *data)
-{
-    MpegEncContext *s = avctx->priv_data;
-    AVFrame *pic_arg = data;
-    int i, stuffing_count;
-
-    for(i=0; i<avctx->thread_count; i++){
-        int start_y= s->thread_context[i]->start_mb_y;
-        int   end_y= s->thread_context[i]->  end_mb_y;
-        int h= s->mb_height;
-        uint8_t *start= buf + (size_t)(((int64_t) buf_size)*start_y/h);
-        uint8_t *end  = buf + (size_t)(((int64_t) buf_size)*  end_y/h);
-
-        init_put_bits(&s->thread_context[i]->pb, start, end - start);
-    }
-
-    s->picture_in_gop_number++;
-
-    if(load_input_picture(s, pic_arg) < 0)
-        return -1;
-
-    if(select_input_picture(s) < 0){
-        return -1;
-    }
-
-    /* output? */
-    if(s->new_picture.data[0]){
-        s->pict_type= s->new_picture.pict_type;
-//emms_c();
-//printf("qs:%f %f %d\n", s->new_picture.quality, s->current_picture.quality, s->qscale);
-        MPV_frame_start(s, avctx);
-vbv_retry:
-        if (encode_picture(s, s->picture_number) < 0)
-            return -1;
-
-        avctx->header_bits = s->header_bits;
-        avctx->mv_bits     = s->mv_bits;
-        avctx->misc_bits   = s->misc_bits;
-        avctx->i_tex_bits  = s->i_tex_bits;
-        avctx->p_tex_bits  = s->p_tex_bits;
-        avctx->i_count     = s->i_count;
-        avctx->p_count     = s->mb_num - s->i_count - s->skip_count; //FIXME f/b_count in avctx
-        avctx->skip_count  = s->skip_count;
-
-        MPV_frame_end(s);
-
-        if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
-            ff_mjpeg_encode_picture_trailer(s);
-
-        if(avctx->rc_buffer_size){
-            RateControlContext *rcc= &s->rc_context;
-            int max_size= rcc->buffer_index * avctx->rc_max_available_vbv_use;
-
-            if(put_bits_count(&s->pb) > max_size && s->lambda < s->avctx->lmax){
-                s->next_lambda= FFMAX(s->lambda+1, s->lambda*(s->qscale+1) / s->qscale);
-                if(s->adaptive_quant){
-                    int i;
-                    for(i=0; i<s->mb_height*s->mb_stride; i++)
-                        s->lambda_table[i]= FFMAX(s->lambda_table[i]+1, s->lambda_table[i]*(s->qscale+1) / s->qscale);
-                }
-                s->mb_skipped = 0;        //done in MPV_frame_start()
-                if(s->pict_type==FF_P_TYPE){ //done in encode_picture() so we must undo it
-                    if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4)
-                        s->no_rounding ^= 1;
-                }
-                if(s->pict_type!=FF_B_TYPE){
-                    s->time_base= s->last_time_base;
-                    s->last_non_b_time= s->time - s->pp_time;
-                }
-//                av_log(NULL, AV_LOG_ERROR, "R:%d ", s->next_lambda);
-                for(i=0; i<avctx->thread_count; i++){
-                    PutBitContext *pb= &s->thread_context[i]->pb;
-                    init_put_bits(pb, pb->buf, pb->buf_end - pb->buf);
-                }
-                goto vbv_retry;
-            }
-
-            assert(s->avctx->rc_max_rate);
-        }
-
-        if(s->flags&CODEC_FLAG_PASS1)
-            ff_write_pass1_stats(s);
-
-        for(i=0; i<4; i++){
-            s->current_picture_ptr->error[i]= s->current_picture.error[i];
-            avctx->error[i] += s->current_picture_ptr->error[i];
-        }
-
-        if(s->flags&CODEC_FLAG_PASS1)
-            assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb));
-        flush_put_bits(&s->pb);
-        s->frame_bits  = put_bits_count(&s->pb);
-
-        stuffing_count= ff_vbv_update(s, s->frame_bits);
-        if(stuffing_count){
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < stuffing_count + 50){
-                av_log(s->avctx, AV_LOG_ERROR, "stuffing too large\n");
-                return -1;
-            }
-
-            switch(s->codec_id){
-            case CODEC_ID_MPEG1VIDEO:
-            case CODEC_ID_MPEG2VIDEO:
-                while(stuffing_count--){
-                    put_bits(&s->pb, 8, 0);
-                }
-            break;
-            case CODEC_ID_MPEG4:
-                put_bits(&s->pb, 16, 0);
-                put_bits(&s->pb, 16, 0x1C3);
-                stuffing_count -= 4;
-                while(stuffing_count--){
-                    put_bits(&s->pb, 8, 0xFF);
-                }
-            break;
-            default:
-                av_log(s->avctx, AV_LOG_ERROR, "vbv buffer overflow\n");
-            }
-            flush_put_bits(&s->pb);
-            s->frame_bits  = put_bits_count(&s->pb);
-        }
-
-        /* update mpeg1/2 vbv_delay for CBR */
-        if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1
-           && 90000LL * (avctx->rc_buffer_size-1) <= s->avctx->rc_max_rate*0xFFFFLL){
-            int vbv_delay, min_delay;
-            double inbits = s->avctx->rc_max_rate*av_q2d(s->avctx->time_base);
-            int    minbits= s->frame_bits - 8*(s->vbv_delay_ptr - s->pb.buf - 1);
-            double bits   = s->rc_context.buffer_index + minbits - inbits;
-
-            if(bits<0)
-                av_log(s->avctx, AV_LOG_ERROR, "Internal error, negative bits\n");
-
-            assert(s->repeat_first_field==0);
-
-            vbv_delay=     bits * 90000                               / s->avctx->rc_max_rate;
-            min_delay= (minbits * 90000LL + s->avctx->rc_max_rate - 1)/ s->avctx->rc_max_rate;
-
-            vbv_delay= FFMAX(vbv_delay, min_delay);
-
-            assert(vbv_delay < 0xFFFF);
-
-            s->vbv_delay_ptr[0] &= 0xF8;
-            s->vbv_delay_ptr[0] |= vbv_delay>>13;
-            s->vbv_delay_ptr[1]  = vbv_delay>>5;
-            s->vbv_delay_ptr[2] &= 0x07;
-            s->vbv_delay_ptr[2] |= vbv_delay<<3;
-        }
-        s->total_bits += s->frame_bits;
-        avctx->frame_bits  = s->frame_bits;
-    }else{
-        assert((put_bits_ptr(&s->pb) == s->pb.buf));
-        s->frame_bits=0;
-    }
-    assert((s->frame_bits&7)==0);
-
-    return s->frame_bits/8;
-}
-
-static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold)
-{
-    static const char tab[64]=
-        {3,2,2,1,1,1,1,1,
-         1,1,1,1,1,1,1,1,
-         1,1,1,1,1,1,1,1,
-         0,0,0,0,0,0,0,0,
-         0,0,0,0,0,0,0,0,
-         0,0,0,0,0,0,0,0,
-         0,0,0,0,0,0,0,0,
-         0,0,0,0,0,0,0,0};
-    int score=0;
-    int run=0;
-    int i;
-    DCTELEM *block= s->block[n];
-    const int last_index= s->block_last_index[n];
-    int skip_dc;
-
-    if(threshold<0){
-        skip_dc=0;
-        threshold= -threshold;
-    }else
-        skip_dc=1;
-
-    /* Are all we could set to zero already zero? */
-    if(last_index<=skip_dc - 1) return;
-
-    for(i=0; i<=last_index; i++){
-        const int j = s->intra_scantable.permutated[i];
-        const int level = FFABS(block[j]);
-        if(level==1){
-            if(skip_dc && i==0) continue;
-            score+= tab[run];
-            run=0;
-        }else if(level>1){
-            return;
-        }else{
-            run++;
-        }
-    }
-    if(score >= threshold) return;
-    for(i=skip_dc; i<=last_index; i++){
-        const int j = s->intra_scantable.permutated[i];
-        block[j]=0;
-    }
-    if(block[0]) s->block_last_index[n]= 0;
-    else         s->block_last_index[n]= -1;
-}
-
-static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, int last_index)
-{
-    int i;
-    const int maxlevel= s->max_qcoeff;
-    const int minlevel= s->min_qcoeff;
-    int overflow=0;
-
-    if(s->mb_intra){
-        i=1; //skip clipping of intra dc
-    }else
-        i=0;
-
-    for(;i<=last_index; i++){
-        const int j= s->intra_scantable.permutated[i];
-        int level = block[j];
-
-        if     (level>maxlevel){
-            level=maxlevel;
-            overflow++;
-        }else if(level<minlevel){
-            level=minlevel;
-            overflow++;
-        }
-
-        block[j]= level;
-    }
-
-    if(overflow && s->avctx->mb_decision == FF_MB_DECISION_SIMPLE)
-        av_log(s->avctx, AV_LOG_INFO, "warning, clipping %d dct coefficients to %d..%d\n", overflow, minlevel, maxlevel);
-}
-
-static void get_visual_weight(int16_t *weight, uint8_t *ptr, int stride){
-    int x, y;
-//FIXME optimize
-    for(y=0; y<8; y++){
-        for(x=0; x<8; x++){
-            int x2, y2;
-            int sum=0;
-            int sqr=0;
-            int count=0;
-
-            for(y2= FFMAX(y-1, 0); y2 < FFMIN(8, y+2); y2++){
-                for(x2= FFMAX(x-1, 0); x2 < FFMIN(8, x+2); x2++){
-                    int v= ptr[x2 + y2*stride];
-                    sum += v;
-                    sqr += v*v;
-                    count++;
-                }
-            }
-            weight[x + 8*y]= (36*ff_sqrt(count*sqr - sum*sum)) / count;
-        }
-    }
-}
-
-static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
-{
-    int16_t weight[8][64];
-    DCTELEM orig[8][64];
-    const int mb_x= s->mb_x;
-    const int mb_y= s->mb_y;
-    int i;
-    int skip_dct[8];
-    int dct_offset   = s->linesize*8; //default for progressive frames
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int wrap_y, wrap_c;
-
-    for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct;
-
-    if(s->adaptive_quant){
-        const int last_qp= s->qscale;
-        const int mb_xy= mb_x + mb_y*s->mb_stride;
-
-        s->lambda= s->lambda_table[mb_xy];
-        update_qscale(s);
-
-        if(!(s->flags&CODEC_FLAG_QP_RD)){
-            s->qscale= s->current_picture_ptr->qscale_table[mb_xy];
-            s->dquant= s->qscale - last_qp;
-
-            if(s->out_format==FMT_H263){
-                s->dquant= av_clip(s->dquant, -2, 2);
-
-                if(s->codec_id==CODEC_ID_MPEG4){
-                    if(!s->mb_intra){
-                        if(s->pict_type == FF_B_TYPE){
-                            if(s->dquant&1 || s->mv_dir&MV_DIRECT)
-                                s->dquant= 0;
-                        }
-                        if(s->mv_type==MV_TYPE_8X8)
-                            s->dquant=0;
-                    }
-                }
-            }
-        }
-        ff_set_qscale(s, last_qp + s->dquant);
-    }else if(s->flags&CODEC_FLAG_QP_RD)
-        ff_set_qscale(s, s->qscale + s->dquant);
-
-    wrap_y = s->linesize;
-    wrap_c = s->uvlinesize;
-    ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16;
-    ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
-    ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
-
-    if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){
-        uint8_t *ebuf= s->edge_emu_buffer + 32;
-        ff_emulated_edge_mc(ebuf            , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width   , s->height);
-        ptr_y= ebuf;
-        ff_emulated_edge_mc(ebuf+18*wrap_y  , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
-        ptr_cb= ebuf+18*wrap_y;
-        ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
-        ptr_cr= ebuf+18*wrap_y+8;
-    }
-
-    if (s->mb_intra) {
-        if(s->flags&CODEC_FLAG_INTERLACED_DCT){
-            int progressive_score, interlaced_score;
-
-            s->interlaced_dct=0;
-            progressive_score= s->dsp.ildct_cmp[4](s, ptr_y           , NULL, wrap_y, 8)
-                              +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400;
-
-            if(progressive_score > 0){
-                interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y           , NULL, wrap_y*2, 8)
-                                  +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y  , NULL, wrap_y*2, 8);
-                if(progressive_score > interlaced_score){
-                    s->interlaced_dct=1;
-
-                    dct_offset= wrap_y;
-                    wrap_y<<=1;
-                    if (s->chroma_format == CHROMA_422)
-                        wrap_c<<=1;
-                }
-            }
-        }
-
-        s->dsp.get_pixels(s->block[0], ptr_y                 , wrap_y);
-        s->dsp.get_pixels(s->block[1], ptr_y              + 8, wrap_y);
-        s->dsp.get_pixels(s->block[2], ptr_y + dct_offset    , wrap_y);
-        s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y);
-
-        if(s->flags&CODEC_FLAG_GRAY){
-            skip_dct[4]= 1;
-            skip_dct[5]= 1;
-        }else{
-            s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);
-            s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);
-            if(!s->chroma_y_shift){ /* 422 */
-                s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c);
-                s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c);
-            }
-        }
-    }else{
-        op_pixels_func (*op_pix)[4];
-        qpel_mc_func (*op_qpix)[16];
-        uint8_t *dest_y, *dest_cb, *dest_cr;
-
-        dest_y  = s->dest[0];
-        dest_cb = s->dest[1];
-        dest_cr = s->dest[2];
-
-        if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){
-            op_pix = s->dsp.put_pixels_tab;
-            op_qpix= s->dsp.put_qpel_pixels_tab;
-        }else{
-            op_pix = s->dsp.put_no_rnd_pixels_tab;
-            op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab;
-        }
-
-        if (s->mv_dir & MV_DIR_FORWARD) {
-            MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
-            op_pix = s->dsp.avg_pixels_tab;
-            op_qpix= s->dsp.avg_qpel_pixels_tab;
-        }
-        if (s->mv_dir & MV_DIR_BACKWARD) {
-            MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
-        }
-
-        if(s->flags&CODEC_FLAG_INTERLACED_DCT){
-            int progressive_score, interlaced_score;
-
-            s->interlaced_dct=0;
-            progressive_score= s->dsp.ildct_cmp[0](s, dest_y           , ptr_y           , wrap_y, 8)
-                              +s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400;
-
-            if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400;
-
-            if(progressive_score>0){
-                interlaced_score = s->dsp.ildct_cmp[0](s, dest_y           , ptr_y           , wrap_y*2, 8)
-                                  +s->dsp.ildct_cmp[0](s, dest_y + wrap_y  , ptr_y + wrap_y  , wrap_y*2, 8);
-
-                if(progressive_score > interlaced_score){
-                    s->interlaced_dct=1;
-
-                    dct_offset= wrap_y;
-                    wrap_y<<=1;
-                    if (s->chroma_format == CHROMA_422)
-                        wrap_c<<=1;
-                }
-            }
-        }
-
-        s->dsp.diff_pixels(s->block[0], ptr_y                 , dest_y                 , wrap_y);
-        s->dsp.diff_pixels(s->block[1], ptr_y              + 8, dest_y              + 8, wrap_y);
-        s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset    , dest_y + dct_offset    , wrap_y);
-        s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y);
-
-        if(s->flags&CODEC_FLAG_GRAY){
-            skip_dct[4]= 1;
-            skip_dct[5]= 1;
-        }else{
-            s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);
-            s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
-            if(!s->chroma_y_shift){ /* 422 */
-                s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c);
-                s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c);
-            }
-        }
-        /* pre quantization */
-        if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){
-            //FIXME optimize
-            if(s->dsp.sad[1](NULL, ptr_y               , dest_y               , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1;
-            if(s->dsp.sad[1](NULL, ptr_y            + 8, dest_y            + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1;
-            if(s->dsp.sad[1](NULL, ptr_y +dct_offset   , dest_y +dct_offset   , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1;
-            if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1;
-            if(s->dsp.sad[1](NULL, ptr_cb              , dest_cb              , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1;
-            if(s->dsp.sad[1](NULL, ptr_cr              , dest_cr              , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1;
-            if(!s->chroma_y_shift){ /* 422 */
-                if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
-                if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
-            }
-        }
-    }
-
-    if(s->avctx->quantizer_noise_shaping){
-        if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y                 , wrap_y);
-        if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y              + 8, wrap_y);
-        if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset    , wrap_y);
-        if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
-        if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb                , wrap_c);
-        if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr                , wrap_c);
-        if(!s->chroma_y_shift){ /* 422 */
-            if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
-            if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
-        }
-        memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
-    }
-
-    /* DCT & quantize */
-    assert(s->out_format!=FMT_MJPEG || s->qscale==8);
-    {
-        for(i=0;i<mb_block_count;i++) {
-            if(!skip_dct[i]){
-                int overflow;
-                s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow);
-            // FIXME we could decide to change to quantizer instead of clipping
-            // JS: I don't think that would be a good idea it could lower quality instead
-            //     of improve it. Just INTRADC clipping deserves changes in quantizer
-                if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]);
-            }else
-                s->block_last_index[i]= -1;
-        }
-        if(s->avctx->quantizer_noise_shaping){
-            for(i=0;i<mb_block_count;i++) {
-                if(!skip_dct[i]){
-                    s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale);
-                }
-            }
-        }
-
-        if(s->luma_elim_threshold && !s->mb_intra)
-            for(i=0; i<4; i++)
-                dct_single_coeff_elimination(s, i, s->luma_elim_threshold);
-        if(s->chroma_elim_threshold && !s->mb_intra)
-            for(i=4; i<mb_block_count; i++)
-                dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
-
-        if(s->flags & CODEC_FLAG_CBP_RD){
-            for(i=0;i<mb_block_count;i++) {
-                if(s->block_last_index[i] == -1)
-                    s->coded_score[i]= INT_MAX/256;
-            }
-        }
-    }
-
-    if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){
-        s->block_last_index[4]=
-        s->block_last_index[5]= 0;
-        s->block[4][0]=
-        s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
-    }
-
-    //non c quantize code returns incorrect block_last_index FIXME
-    if(s->alternate_scan && s->dct_quantize != dct_quantize_c){
-        for(i=0; i<mb_block_count; i++){
-            int j;
-            if(s->block_last_index[i]>0){
-                for(j=63; j>0; j--){
-                    if(s->block[i][ s->intra_scantable.permutated[j] ]) break;
-                }
-                s->block_last_index[i]= j;
-            }
-        }
-    }
-
-    /* huffman encode */
-    switch(s->codec_id){ //FIXME funct ptr could be slightly faster
-    case CODEC_ID_MPEG1VIDEO:
-    case CODEC_ID_MPEG2VIDEO:
-        if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
-            mpeg1_encode_mb(s, s->block, motion_x, motion_y);
-        break;
-    case CODEC_ID_MPEG4:
-        if (CONFIG_MPEG4_ENCODER)
-            mpeg4_encode_mb(s, s->block, motion_x, motion_y);
-        break;
-    case CODEC_ID_MSMPEG4V2:
-    case CODEC_ID_MSMPEG4V3:
-    case CODEC_ID_WMV1:
-        if (CONFIG_MSMPEG4_ENCODER)
-            msmpeg4_encode_mb(s, s->block, motion_x, motion_y);
-        break;
-    case CODEC_ID_WMV2:
-        if (CONFIG_WMV2_ENCODER)
-            ff_wmv2_encode_mb(s, s->block, motion_x, motion_y);
-        break;
-    case CODEC_ID_H261:
-        if (CONFIG_H261_ENCODER)
-            ff_h261_encode_mb(s, s->block, motion_x, motion_y);
-        break;
-    case CODEC_ID_H263:
-    case CODEC_ID_H263P:
-    case CODEC_ID_FLV1:
-    case CODEC_ID_RV10:
-    case CODEC_ID_RV20:
-        if (CONFIG_H263_ENCODER)
-            h263_encode_mb(s, s->block, motion_x, motion_y);
-        break;
-    case CODEC_ID_MJPEG:
-        if (CONFIG_MJPEG_ENCODER)
-            ff_mjpeg_encode_mb(s, s->block);
-        break;
-    default:
-        assert(0);
-    }
-}
-
-static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
-{
-    if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y,  8, 6);
-    else                                encode_mb_internal(s, motion_x, motion_y, 16, 8);
-}
-
-static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){
-    int i;
-
-    memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop?
-
-    /* mpeg1 */
-    d->mb_skip_run= s->mb_skip_run;
-    for(i=0; i<3; i++)
-        d->last_dc[i]= s->last_dc[i];
-
-    /* statistics */
-    d->mv_bits= s->mv_bits;
-    d->i_tex_bits= s->i_tex_bits;
-    d->p_tex_bits= s->p_tex_bits;
-    d->i_count= s->i_count;
-    d->f_count= s->f_count;
-    d->b_count= s->b_count;
-    d->skip_count= s->skip_count;
-    d->misc_bits= s->misc_bits;
-    d->last_bits= 0;
-
-    d->mb_skipped= 0;
-    d->qscale= s->qscale;
-    d->dquant= s->dquant;
-
-    d->esc3_level_length= s->esc3_level_length;
-}
-
-static inline void copy_context_after_encode(MpegEncContext *d, MpegEncContext *s, int type){
-    int i;
-
-    memcpy(d->mv, s->mv, 2*4*2*sizeof(int));
-    memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop?
-
-    /* mpeg1 */
-    d->mb_skip_run= s->mb_skip_run;
-    for(i=0; i<3; i++)
-        d->last_dc[i]= s->last_dc[i];
-
-    /* statistics */
-    d->mv_bits= s->mv_bits;
-    d->i_tex_bits= s->i_tex_bits;
-    d->p_tex_bits= s->p_tex_bits;
-    d->i_count= s->i_count;
-    d->f_count= s->f_count;
-    d->b_count= s->b_count;
-    d->skip_count= s->skip_count;
-    d->misc_bits= s->misc_bits;
-
-    d->mb_intra= s->mb_intra;
-    d->mb_skipped= s->mb_skipped;
-    d->mv_type= s->mv_type;
-    d->mv_dir= s->mv_dir;
-    d->pb= s->pb;
-    if(s->data_partitioning){
-        d->pb2= s->pb2;
-        d->tex_pb= s->tex_pb;
-    }
-    d->block= s->block;
-    for(i=0; i<8; i++)
-        d->block_last_index[i]= s->block_last_index[i];
-    d->interlaced_dct= s->interlaced_dct;
-    d->qscale= s->qscale;
-
-    d->esc3_level_length= s->esc3_level_length;
-}
-
-static inline void encode_mb_hq(MpegEncContext *s, MpegEncContext *backup, MpegEncContext *best, int type,
-                           PutBitContext pb[2], PutBitContext pb2[2], PutBitContext tex_pb[2],
-                           int *dmin, int *next_block, int motion_x, int motion_y)
-{
-    int score;
-    uint8_t *dest_backup[3];
-
-    copy_context_before_encode(s, backup, type);
-
-    s->block= s->blocks[*next_block];
-    s->pb= pb[*next_block];
-    if(s->data_partitioning){
-        s->pb2   = pb2   [*next_block];
-        s->tex_pb= tex_pb[*next_block];
-    }
-
-    if(*next_block){
-        memcpy(dest_backup, s->dest, sizeof(s->dest));
-        s->dest[0] = s->rd_scratchpad;
-        s->dest[1] = s->rd_scratchpad + 16*s->linesize;
-        s->dest[2] = s->rd_scratchpad + 16*s->linesize + 8;
-        assert(s->linesize >= 32); //FIXME
-    }
-
-    encode_mb(s, motion_x, motion_y);
-
-    score= put_bits_count(&s->pb);
-    if(s->data_partitioning){
-        score+= put_bits_count(&s->pb2);
-        score+= put_bits_count(&s->tex_pb);
-    }
-
-    if(s->avctx->mb_decision == FF_MB_DECISION_RD){
-        MPV_decode_mb(s, s->block);
-
-        score *= s->lambda2;
-        score += sse_mb(s) << FF_LAMBDA_SHIFT;
-    }
-
-    if(*next_block){
-        memcpy(s->dest, dest_backup, sizeof(s->dest));
-    }
-
-    if(score<*dmin){
-        *dmin= score;
-        *next_block^=1;
-
-        copy_context_after_encode(best, s, type);
-    }
-}
-
-static int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, int h, int stride){
-    uint32_t *sq = ff_squareTbl + 256;
-    int acc=0;
-    int x,y;
-
-    if(w==16 && h==16)
-        return s->dsp.sse[0](NULL, src1, src2, stride, 16);
-    else if(w==8 && h==8)
-        return s->dsp.sse[1](NULL, src1, src2, stride, 8);
-
-    for(y=0; y<h; y++){
-        for(x=0; x<w; x++){
-            acc+= sq[src1[x + y*stride] - src2[x + y*stride]];
-        }
-    }
-
-    assert(acc>=0);
-
-    return acc;
-}
-
-static int sse_mb(MpegEncContext *s){
-    int w= 16;
-    int h= 16;
-
-    if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
-    if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
-
-    if(w==16 && h==16)
-      if(s->avctx->mb_cmp == FF_CMP_NSSE){
-        return  s->dsp.nsse[0](s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16)
-               +s->dsp.nsse[1](s, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8)
-               +s->dsp.nsse[1](s, s->new_picture.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8);
-      }else{
-        return  s->dsp.sse[0](NULL, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16)
-               +s->dsp.sse[1](NULL, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8)
-               +s->dsp.sse[1](NULL, s->new_picture.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8);
-      }
-    else
-        return  sse(s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize)
-               +sse(s, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], w>>1, h>>1, s->uvlinesize)
-               +sse(s, s->new_picture.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize);
-}
-
-static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= *(void**)arg;
-
-
-    s->me.pre_pass=1;
-    s->me.dia_size= s->avctx->pre_dia_size;
-    s->first_slice_line=1;
-    for(s->mb_y= s->end_mb_y-1; s->mb_y >= s->start_mb_y; s->mb_y--) {
-        for(s->mb_x=s->mb_width-1; s->mb_x >=0 ;s->mb_x--) {
-            ff_pre_estimate_p_frame_motion(s, s->mb_x, s->mb_y);
-        }
-        s->first_slice_line=0;
-    }
-
-    s->me.pre_pass=0;
-
-    return 0;
-}
-
-static int estimate_motion_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= *(void**)arg;
-
-    ff_check_alignment();
-
-    s->me.dia_size= s->avctx->dia_size;
-    s->first_slice_line=1;
-    for(s->mb_y= s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {
-        s->mb_x=0; //for block init below
-        ff_init_block_index(s);
-        for(s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
-            s->block_index[0]+=2;
-            s->block_index[1]+=2;
-            s->block_index[2]+=2;
-            s->block_index[3]+=2;
-
-            /* compute motion vector & mb_type and store in context */
-            if(s->pict_type==FF_B_TYPE)
-                ff_estimate_b_frame_motion(s, s->mb_x, s->mb_y);
-            else
-                ff_estimate_p_frame_motion(s, s->mb_x, s->mb_y);
-        }
-        s->first_slice_line=0;
-    }
-    return 0;
-}
-
-static int mb_var_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= *(void**)arg;
-    int mb_x, mb_y;
-
-    ff_check_alignment();
-
-    for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
-        for(mb_x=0; mb_x < s->mb_width; mb_x++) {
-            int xx = mb_x * 16;
-            int yy = mb_y * 16;
-            uint8_t *pix = s->new_picture.data[0] + (yy * s->linesize) + xx;
-            int varc;
-            int sum = s->dsp.pix_sum(pix, s->linesize);
-
-            varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8;
-
-            s->current_picture.mb_var [s->mb_stride * mb_y + mb_x] = varc;
-            s->current_picture.mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
-            s->me.mb_var_sum_temp    += varc;
-        }
-    }
-    return 0;
-}
-
-static void write_slice_end(MpegEncContext *s){
-    if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4){
-        if(s->partitioned_frame){
-            ff_mpeg4_merge_partitions(s);
-        }
-
-        ff_mpeg4_stuffing(&s->pb);
-    }else if(CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG){
-        ff_mjpeg_encode_stuffing(&s->pb);
-    }
-
-    align_put_bits(&s->pb);
-    flush_put_bits(&s->pb);
-
-    if((s->flags&CODEC_FLAG_PASS1) && !s->partitioned_frame)
-        s->misc_bits+= get_bits_diff(s);
-}
-
-static int encode_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= *(void**)arg;
-    int mb_x, mb_y, pdif = 0;
-    int chr_h= 16>>s->chroma_y_shift;
-    int i, j;
-    MpegEncContext best_s, backup_s;
-    uint8_t bit_buf[2][MAX_MB_BYTES];
-    uint8_t bit_buf2[2][MAX_MB_BYTES];
-    uint8_t bit_buf_tex[2][MAX_MB_BYTES];
-    PutBitContext pb[2], pb2[2], tex_pb[2];
-//printf("%d->%d\n", s->resync_mb_y, s->end_mb_y);
-
-    ff_check_alignment();
-
-    for(i=0; i<2; i++){
-        init_put_bits(&pb    [i], bit_buf    [i], MAX_MB_BYTES);
-        init_put_bits(&pb2   [i], bit_buf2   [i], MAX_MB_BYTES);
-        init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES);
-    }
-
-    s->last_bits= put_bits_count(&s->pb);
-    s->mv_bits=0;
-    s->misc_bits=0;
-    s->i_tex_bits=0;
-    s->p_tex_bits=0;
-    s->i_count=0;
-    s->f_count=0;
-    s->b_count=0;
-    s->skip_count=0;
-
-    for(i=0; i<3; i++){
-        /* init last dc values */
-        /* note: quant matrix value (8) is implied here */
-        s->last_dc[i] = 128 << s->intra_dc_precision;
-
-        s->current_picture.error[i] = 0;
-    }
-    s->mb_skip_run = 0;
-    memset(s->last_mv, 0, sizeof(s->last_mv));
-
-    s->last_mv_dir = 0;
-
-    switch(s->codec_id){
-    case CODEC_ID_H263:
-    case CODEC_ID_H263P:
-    case CODEC_ID_FLV1:
-        if (CONFIG_H263_ENCODER)
-            s->gob_index = ff_h263_get_gob_height(s);
-        break;
-    case CODEC_ID_MPEG4:
-        if(CONFIG_MPEG4_ENCODER && s->partitioned_frame)
-            ff_mpeg4_init_partitions(s);
-        break;
-    }
-
-    s->resync_mb_x=0;
-    s->resync_mb_y=0;
-    s->first_slice_line = 1;
-    s->ptr_lastgob = s->pb.buf;
-    for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
-//    printf("row %d at %X\n", s->mb_y, (int)s);
-        s->mb_x=0;
-        s->mb_y= mb_y;
-
-        ff_set_qscale(s, s->qscale);
-        ff_init_block_index(s);
-
-        for(mb_x=0; mb_x < s->mb_width; mb_x++) {
-            int xy= mb_y*s->mb_stride + mb_x; // removed const, H261 needs to adjust this
-            int mb_type= s->mb_type[xy];
-//            int d;
-            int dmin= INT_MAX;
-            int dir;
-
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){
-                av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                return -1;
-            }
-            if(s->data_partitioning){
-                if(   s->pb2   .buf_end - s->pb2   .buf - (put_bits_count(&s->    pb2)>>3) < MAX_MB_BYTES
-                   || s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){
-                    av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                    return -1;
-                }
-            }
-
-            s->mb_x = mb_x;
-            s->mb_y = mb_y;  // moved into loop, can get changed by H.261
-            ff_update_block_index(s);
-
-            if(CONFIG_H261_ENCODER && s->codec_id == CODEC_ID_H261){
-                ff_h261_reorder_mb_index(s);
-                xy= s->mb_y*s->mb_stride + s->mb_x;
-                mb_type= s->mb_type[xy];
-            }
-
-            /* write gob / video packet header  */
-            if(s->rtp_mode){
-                int current_packet_size, is_gob_start;
-
-                current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf);
-
-                is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0;
-
-                if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1;
-
-                switch(s->codec_id){
-                case CODEC_ID_H263:
-                case CODEC_ID_H263P:
-                    if(!s->h263_slice_structured)
-                        if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0;
-                    break;
-                case CODEC_ID_MPEG2VIDEO:
-                    if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1;
-                case CODEC_ID_MPEG1VIDEO:
-                    if(s->mb_skip_run) is_gob_start=0;
-                    break;
-                }
-
-                if(is_gob_start){
-                    if(s->start_mb_y != mb_y || mb_x!=0){
-                        write_slice_end(s);
-
-                        if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){
-                            ff_mpeg4_init_partitions(s);
-                        }
-                    }
-
-                    assert((put_bits_count(&s->pb)&7) == 0);
-                    current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob;
-
-                    if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){
-                        int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y;
-                        int d= 100 / s->avctx->error_rate;
-                        if(r % d == 0){
-                            current_packet_size=0;
-#ifndef ALT_BITSTREAM_WRITER
-                            s->pb.buf_ptr= s->ptr_lastgob;
-#endif
-                            assert(put_bits_ptr(&s->pb) == s->ptr_lastgob);
-                        }
-                    }
-
-                    if (s->avctx->rtp_callback){
-                        int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x;
-                        s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb);
-                    }
-
-                    switch(s->codec_id){
-                    case CODEC_ID_MPEG4:
-                        if (CONFIG_MPEG4_ENCODER) {
-                            ff_mpeg4_encode_video_packet_header(s);
-                            ff_mpeg4_clean_buffers(s);
-                        }
-                    break;
-                    case CODEC_ID_MPEG1VIDEO:
-                    case CODEC_ID_MPEG2VIDEO:
-                        if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) {
-                            ff_mpeg1_encode_slice_header(s);
-                            ff_mpeg1_clean_buffers(s);
-                        }
-                    break;
-                    case CODEC_ID_H263:
-                    case CODEC_ID_H263P:
-                        if (CONFIG_H263_ENCODER)
-                            h263_encode_gob_header(s, mb_y);
-                    break;
-                    }
-
-                    if(s->flags&CODEC_FLAG_PASS1){
-                        int bits= put_bits_count(&s->pb);
-                        s->misc_bits+= bits - s->last_bits;
-                        s->last_bits= bits;
-                    }
-
-                    s->ptr_lastgob += current_packet_size;
-                    s->first_slice_line=1;
-                    s->resync_mb_x=mb_x;
-                    s->resync_mb_y=mb_y;
-                }
-            }
-
-            if(  (s->resync_mb_x   == s->mb_x)
-               && s->resync_mb_y+1 == s->mb_y){
-                s->first_slice_line=0;
-            }
-
-            s->mb_skipped=0;
-            s->dquant=0; //only for QP_RD
-
-            if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){ // more than 1 MB type possible or CODEC_FLAG_QP_RD
-                int next_block=0;
-                int pb_bits_count, pb2_bits_count, tex_pb_bits_count;
-
-                copy_context_before_encode(&backup_s, s, -1);
-                backup_s.pb= s->pb;
-                best_s.data_partitioning= s->data_partitioning;
-                best_s.partitioned_frame= s->partitioned_frame;
-                if(s->data_partitioning){
-                    backup_s.pb2= s->pb2;
-                    backup_s.tex_pb= s->tex_pb;
-                }
-
-                if(mb_type&CANDIDATE_MB_TYPE_INTER){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = s->p_mv_table[xy][0];
-                    s->mv[0][0][1] = s->p_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_INTER_I){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->p_field_select_table[i][xy];
-                        s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
-                        s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = 0;
-                    s->mv[0][0][1] = 0;
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_INTER4V){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_8X8;
-                    s->mb_intra= 0;
-                    for(i=0; i<4; i++){
-                        s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
-                        s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_FORWARD){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
-                    s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[1][0][0] = s->b_back_mv_table[xy][0];
-                    s->mv[1][0][1] = s->b_back_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BIDIR){
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
-                    s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
-                    s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
-                    s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
-                        s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
-                        s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
-                        s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
-                        s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(dir=0; dir<2; dir++){
-                        for(i=0; i<2; i++){
-                            j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
-                            s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
-                            s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
-                        }
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_INTRA){
-                    s->mv_dir = 0;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 1;
-                    s->mv[0][0][0] = 0;
-                    s->mv[0][0][1] = 0;
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                    if(s->h263_pred || s->h263_aic){
-                        if(best_s.mb_intra)
-                            s->mbintra_table[mb_x + mb_y*s->mb_stride]=1;
-                        else
-                            ff_clean_intra_table_entries(s); //old mode?
-                    }
-                }
-
-                if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){
-                    if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD
-                        const int last_qp= backup_s.qscale;
-                        int qpi, qp, dc[6];
-                        DCTELEM ac[6][16];
-                        const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0;
-                        static const int dquant_tab[4]={-1,1,-2,2};
-
-                        assert(backup_s.dquant == 0);
-
-                        //FIXME intra
-                        s->mv_dir= best_s.mv_dir;
-                        s->mv_type = MV_TYPE_16X16;
-                        s->mb_intra= best_s.mb_intra;
-                        s->mv[0][0][0] = best_s.mv[0][0][0];
-                        s->mv[0][0][1] = best_s.mv[0][0][1];
-                        s->mv[1][0][0] = best_s.mv[1][0][0];
-                        s->mv[1][0][1] = best_s.mv[1][0][1];
-
-                        qpi = s->pict_type == FF_B_TYPE ? 2 : 0;
-                        for(; qpi<4; qpi++){
-                            int dquant= dquant_tab[qpi];
-                            qp= last_qp + dquant;
-                            if(qp < s->avctx->qmin || qp > s->avctx->qmax)
-                                continue;
-                            backup_s.dquant= dquant;
-                            if(s->mb_intra && s->dc_val[0]){
-                                for(i=0; i<6; i++){
-                                    dc[i]= s->dc_val[0][ s->block_index[i] ];
-                                    memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16);
-                                }
-                            }
-
-                            encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb,
-                                         &dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]);
-                            if(best_s.qscale != qp){
-                                if(s->mb_intra && s->dc_val[0]){
-                                    for(i=0; i<6; i++){
-                                        s->dc_val[0][ s->block_index[i] ]= dc[i];
-                                        memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-                if(CONFIG_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT){
-                    int mx= s->b_direct_mv_table[xy][0];
-                    int my= s->b_direct_mv_table[xy][1];
-
-                    backup_s.dquant = 0;
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
-                    s->mb_intra= 0;
-                    ff_mpeg4_set_direct_mv(s, mx, my);
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
-                                 &dmin, &next_block, mx, my);
-                }
-                if(CONFIG_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT0){
-                    backup_s.dquant = 0;
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
-                    s->mb_intra= 0;
-                    ff_mpeg4_set_direct_mv(s, 0, 0);
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){
-                    int coded=0;
-                    for(i=0; i<6; i++)
-                        coded |= s->block_last_index[i];
-                    if(coded){
-                        int mx,my;
-                        memcpy(s->mv, best_s.mv, sizeof(s->mv));
-                        if(CONFIG_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){
-                            mx=my=0; //FIXME find the one we actually used
-                            ff_mpeg4_set_direct_mv(s, mx, my);
-                        }else if(best_s.mv_dir&MV_DIR_BACKWARD){
-                            mx= s->mv[1][0][0];
-                            my= s->mv[1][0][1];
-                        }else{
-                            mx= s->mv[0][0][0];
-                            my= s->mv[0][0][1];
-                        }
-
-                        s->mv_dir= best_s.mv_dir;
-                        s->mv_type = best_s.mv_type;
-                        s->mb_intra= 0;
-/*                        s->mv[0][0][0] = best_s.mv[0][0][0];
-                        s->mv[0][0][1] = best_s.mv[0][0][1];
-                        s->mv[1][0][0] = best_s.mv[1][0][0];
-                        s->mv[1][0][1] = best_s.mv[1][0][1];*/
-                        backup_s.dquant= 0;
-                        s->skipdct=1;
-                        encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb,
-                                        &dmin, &next_block, mx, my);
-                        s->skipdct=0;
-                    }
-                }
-
-                s->current_picture.qscale_table[xy]= best_s.qscale;
-
-                copy_context_after_encode(s, &best_s, -1);
-
-                pb_bits_count= put_bits_count(&s->pb);
-                flush_put_bits(&s->pb);
-                ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count);
-                s->pb= backup_s.pb;
-
-                if(s->data_partitioning){
-                    pb2_bits_count= put_bits_count(&s->pb2);
-                    flush_put_bits(&s->pb2);
-                    ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count);
-                    s->pb2= backup_s.pb2;
-
-                    tex_pb_bits_count= put_bits_count(&s->tex_pb);
-                    flush_put_bits(&s->tex_pb);
-                    ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count);
-                    s->tex_pb= backup_s.tex_pb;
-                }
-                s->last_bits= put_bits_count(&s->pb);
-
-                if (CONFIG_H263_ENCODER &&
-                    s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE)
-                    ff_h263_update_motion_val(s);
-
-                if(next_block==0){ //FIXME 16 vs linesize16
-                    s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad                     , s->linesize  ,16);
-                    s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize    , s->uvlinesize, 8);
-                    s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8);
-                }
-
-                if(s->avctx->mb_decision == FF_MB_DECISION_BITS)
-                    MPV_decode_mb(s, s->block);
-            } else {
-                int motion_x = 0, motion_y = 0;
-                s->mv_type=MV_TYPE_16X16;
-                // only one MB-Type possible
-
-                switch(mb_type){
-                case CANDIDATE_MB_TYPE_INTRA:
-                    s->mv_dir = 0;
-                    s->mb_intra= 1;
-                    motion_x= s->mv[0][0][0] = 0;
-                    motion_y= s->mv[0][0][1] = 0;
-                    break;
-                case CANDIDATE_MB_TYPE_INTER:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mb_intra= 0;
-                    motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0];
-                    motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1];
-                    break;
-                case CANDIDATE_MB_TYPE_INTER_I:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->p_field_select_table[i][xy];
-                        s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
-                        s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
-                    }
-                    break;
-                case CANDIDATE_MB_TYPE_INTER4V:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_8X8;
-                    s->mb_intra= 0;
-                    for(i=0; i<4; i++){
-                        s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
-                        s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
-                    }
-                    break;
-                case CANDIDATE_MB_TYPE_DIRECT:
-                    if (CONFIG_MPEG4_ENCODER) {
-                        s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT;
-                        s->mb_intra= 0;
-                        motion_x=s->b_direct_mv_table[xy][0];
-                        motion_y=s->b_direct_mv_table[xy][1];
-                        ff_mpeg4_set_direct_mv(s, motion_x, motion_y);
-                    }
-                    break;
-                case CANDIDATE_MB_TYPE_DIRECT0:
-                    if (CONFIG_MPEG4_ENCODER) {
-                        s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT;
-                        s->mb_intra= 0;
-                        ff_mpeg4_set_direct_mv(s, 0, 0);
-                    }
-                    break;
-                case CANDIDATE_MB_TYPE_BIDIR:
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
-                    s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
-                    s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
-                    s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
-                    break;
-                case CANDIDATE_MB_TYPE_BACKWARD:
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mb_intra= 0;
-                    motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0];
-                    motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1];
-                    break;
-                case CANDIDATE_MB_TYPE_FORWARD:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mb_intra= 0;
-                    motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
-                    motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
-//                    printf(" %d %d ", motion_x, motion_y);
-                    break;
-                case CANDIDATE_MB_TYPE_FORWARD_I:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
-                        s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
-                        s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
-                    }
-                    break;
-                case CANDIDATE_MB_TYPE_BACKWARD_I:
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
-                        s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
-                        s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
-                    }
-                    break;
-                case CANDIDATE_MB_TYPE_BIDIR_I:
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(dir=0; dir<2; dir++){
-                        for(i=0; i<2; i++){
-                            j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
-                            s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
-                            s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
-                        }
-                    }
-                    break;
-                default:
-                    av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n");
-                }
-
-                encode_mb(s, motion_x, motion_y);
-
-                // RAL: Update last macroblock type
-                s->last_mv_dir = s->mv_dir;
-
-                if (CONFIG_H263_ENCODER &&
-                    s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE)
-                    ff_h263_update_motion_val(s);
-
-                MPV_decode_mb(s, s->block);
-            }
-
-            /* clean the MV table in IPS frames for direct mode in B frames */
-            if(s->mb_intra /* && I,P,S_TYPE */){
-                s->p_mv_table[xy][0]=0;
-                s->p_mv_table[xy][1]=0;
-            }
-
-            if(s->flags&CODEC_FLAG_PSNR){
-                int w= 16;
-                int h= 16;
-
-                if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
-                if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
-
-                s->current_picture.error[0] += sse(
-                    s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16,
-                    s->dest[0], w, h, s->linesize);
-                s->current_picture.error[1] += sse(
-                    s, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*chr_h,
-                    s->dest[1], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
-                s->current_picture.error[2] += sse(
-                    s, s->new_picture.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*chr_h,
-                    s->dest[2], w>>1, h>>s->chroma_y_shift, s->uvlinesize);
-            }
-            if(s->loop_filter){
-                if(CONFIG_H263_ENCODER && s->out_format == FMT_H263)
-                    ff_h263_loop_filter(s);
-            }
-//printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, put_bits_count(&s->pb));
-        }
-    }
-
-    //not beautiful here but we must write it before flushing so it has to be here
-    if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == FF_I_TYPE)
-        msmpeg4_encode_ext_header(s);
-
-    write_slice_end(s);
-
-    /* Send the last GOB if RTP */
-    if (s->avctx->rtp_callback) {
-        int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
-        pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob;
-        /* Call the RTP callback to send the last GOB */
-        emms_c();
-        s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
-    }
-
-    return 0;
-}
-
-#define MERGE(field) dst->field += src->field; src->field=0
-static void merge_context_after_me(MpegEncContext *dst, MpegEncContext *src){
-    MERGE(me.scene_change_score);
-    MERGE(me.mc_mb_var_sum_temp);
-    MERGE(me.mb_var_sum_temp);
-}
-
-static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src){
-    int i;
-
-    MERGE(dct_count[0]); //note, the other dct vars are not part of the context
-    MERGE(dct_count[1]);
-    MERGE(mv_bits);
-    MERGE(i_tex_bits);
-    MERGE(p_tex_bits);
-    MERGE(i_count);
-    MERGE(f_count);
-    MERGE(b_count);
-    MERGE(skip_count);
-    MERGE(misc_bits);
-    MERGE(error_count);
-    MERGE(padding_bug_score);
-    MERGE(current_picture.error[0]);
-    MERGE(current_picture.error[1]);
-    MERGE(current_picture.error[2]);
-
-    if(dst->avctx->noise_reduction){
-        for(i=0; i<64; i++){
-            MERGE(dct_error_sum[0][i]);
-            MERGE(dct_error_sum[1][i]);
-        }
-    }
-
-    assert(put_bits_count(&src->pb) % 8 ==0);
-    assert(put_bits_count(&dst->pb) % 8 ==0);
-    ff_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb));
-    flush_put_bits(&dst->pb);
-}
-
-static int estimate_qp(MpegEncContext *s, int dry_run){
-    if (s->next_lambda){
-        s->current_picture_ptr->quality=
-        s->current_picture.quality = s->next_lambda;
-        if(!dry_run) s->next_lambda= 0;
-    } else if (!s->fixed_qscale) {
-        s->current_picture_ptr->quality=
-        s->current_picture.quality = ff_rate_estimate_qscale(s, dry_run);
-        if (s->current_picture.quality < 0)
-            return -1;
-    }
-
-    if(s->adaptive_quant){
-        switch(s->codec_id){
-        case CODEC_ID_MPEG4:
-            if (CONFIG_MPEG4_ENCODER)
-                ff_clean_mpeg4_qscales(s);
-            break;
-        case CODEC_ID_H263:
-        case CODEC_ID_H263P:
-        case CODEC_ID_FLV1:
-            if (CONFIG_H263_ENCODER)
-                ff_clean_h263_qscales(s);
-            break;
-        default:
-            ff_init_qscale_tab(s);
-        }
-
-        s->lambda= s->lambda_table[0];
-        //FIXME broken
-    }else
-        s->lambda= s->current_picture.quality;
-//printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality);
-    update_qscale(s);
-    return 0;
-}
-
-/* must be called before writing the header */
-static void set_frame_distances(MpegEncContext * s){
-    assert(s->current_picture_ptr->pts != AV_NOPTS_VALUE);
-    s->time= s->current_picture_ptr->pts*s->avctx->time_base.num;
-
-    if(s->pict_type==FF_B_TYPE){
-        s->pb_time= s->pp_time - (s->last_non_b_time - s->time);
-        assert(s->pb_time > 0 && s->pb_time < s->pp_time);
-    }else{
-        s->pp_time= s->time - s->last_non_b_time;
-        s->last_non_b_time= s->time;
-        assert(s->picture_number==0 || s->pp_time > 0);
-    }
-}
-
-static int encode_picture(MpegEncContext *s, int picture_number)
-{
-    int i;
-    int bits;
-
-    s->picture_number = picture_number;
-
-    /* Reset the average MB variance */
-    s->me.mb_var_sum_temp    =
-    s->me.mc_mb_var_sum_temp = 0;
-
-    /* we need to initialize some time vars before we can encode b-frames */
-    // RAL: Condition added for MPEG1VIDEO
-    if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->h263_msmpeg4))
-        set_frame_distances(s);
-    if(CONFIG_MPEG4_ENCODER && s->codec_id == CODEC_ID_MPEG4)
-        ff_set_mpeg4_time(s);
-
-    s->me.scene_change_score=0;
-
-//    s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME rate distortion
-
-    if(s->pict_type==FF_I_TYPE){
-        if(s->msmpeg4_version >= 3) s->no_rounding=1;
-        else                        s->no_rounding=0;
-    }else if(s->pict_type!=FF_B_TYPE){
-        if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4)
-            s->no_rounding ^= 1;
-    }
-
-    if(s->flags & CODEC_FLAG_PASS2){
-        if (estimate_qp(s,1) < 0)
-            return -1;
-        ff_get_2pass_fcode(s);
-    }else if(!(s->flags & CODEC_FLAG_QSCALE)){
-        if(s->pict_type==FF_B_TYPE)
-            s->lambda= s->last_lambda_for[s->pict_type];
-        else
-            s->lambda= s->last_lambda_for[s->last_non_b_pict_type];
-        update_qscale(s);
-    }
-
-    s->mb_intra=0; //for the rate distortion & bit compare functions
-    for(i=1; i<s->avctx->thread_count; i++){
-        ff_update_duplicate_context(s->thread_context[i], s);
-    }
-
-    if(ff_init_me(s)<0)
-        return -1;
-
-    /* Estimate motion for every MB */
-    if(s->pict_type != FF_I_TYPE){
-        s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8;
-        s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8;
-        if(s->pict_type != FF_B_TYPE && s->avctx->me_threshold==0){
-            if((s->avctx->pre_me && s->last_non_b_pict_type==FF_I_TYPE) || s->avctx->pre_me==2){
-                s->avctx->execute(s->avctx, pre_estimate_motion_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*));
-            }
-        }
-
-        s->avctx->execute(s->avctx, estimate_motion_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*));
-    }else /* if(s->pict_type == FF_I_TYPE) */{
-        /* I-Frame */
-        for(i=0; i<s->mb_stride*s->mb_height; i++)
-            s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
-
-        if(!s->fixed_qscale){
-            /* finding spatial complexity for I-frame rate control */
-            s->avctx->execute(s->avctx, mb_var_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*));
-        }
-    }
-    for(i=1; i<s->avctx->thread_count; i++){
-        merge_context_after_me(s, s->thread_context[i]);
-    }
-    s->current_picture.mc_mb_var_sum= s->current_picture_ptr->mc_mb_var_sum= s->me.mc_mb_var_sum_temp;
-    s->current_picture.   mb_var_sum= s->current_picture_ptr->   mb_var_sum= s->me.   mb_var_sum_temp;
-    emms_c();
-
-    if(s->me.scene_change_score > s->avctx->scenechange_threshold && s->pict_type == FF_P_TYPE){
-        s->pict_type= FF_I_TYPE;
-        for(i=0; i<s->mb_stride*s->mb_height; i++)
-            s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
-//printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
-    }
-
-    if(!s->umvplus){
-        if(s->pict_type==FF_P_TYPE || s->pict_type==FF_S_TYPE) {
-            s->f_code= ff_get_best_fcode(s, s->p_mv_table, CANDIDATE_MB_TYPE_INTER);
-
-            if(s->flags & CODEC_FLAG_INTERLACED_ME){
-                int a,b;
-                a= ff_get_best_fcode(s, s->p_field_mv_table[0][0], CANDIDATE_MB_TYPE_INTER_I); //FIXME field_select
-                b= ff_get_best_fcode(s, s->p_field_mv_table[1][1], CANDIDATE_MB_TYPE_INTER_I);
-                s->f_code= FFMAX3(s->f_code, a, b);
-            }
-
-            ff_fix_long_p_mvs(s);
-            ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, 0);
-            if(s->flags & CODEC_FLAG_INTERLACED_ME){
-                int j;
-                for(i=0; i<2; i++){
-                    for(j=0; j<2; j++)
-                        ff_fix_long_mvs(s, s->p_field_select_table[i], j,
-                                        s->p_field_mv_table[i][j], s->f_code, CANDIDATE_MB_TYPE_INTER_I, 0);
-                }
-            }
-        }
-
-        if(s->pict_type==FF_B_TYPE){
-            int a, b;
-
-            a = ff_get_best_fcode(s, s->b_forw_mv_table, CANDIDATE_MB_TYPE_FORWARD);
-            b = ff_get_best_fcode(s, s->b_bidir_forw_mv_table, CANDIDATE_MB_TYPE_BIDIR);
-            s->f_code = FFMAX(a, b);
-
-            a = ff_get_best_fcode(s, s->b_back_mv_table, CANDIDATE_MB_TYPE_BACKWARD);
-            b = ff_get_best_fcode(s, s->b_bidir_back_mv_table, CANDIDATE_MB_TYPE_BIDIR);
-            s->b_code = FFMAX(a, b);
-
-            ff_fix_long_mvs(s, NULL, 0, s->b_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_FORWARD, 1);
-            ff_fix_long_mvs(s, NULL, 0, s->b_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BACKWARD, 1);
-            ff_fix_long_mvs(s, NULL, 0, s->b_bidir_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_BIDIR, 1);
-            ff_fix_long_mvs(s, NULL, 0, s->b_bidir_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BIDIR, 1);
-            if(s->flags & CODEC_FLAG_INTERLACED_ME){
-                int dir, j;
-                for(dir=0; dir<2; dir++){
-                    for(i=0; i<2; i++){
-                        for(j=0; j<2; j++){
-                            int type= dir ? (CANDIDATE_MB_TYPE_BACKWARD_I|CANDIDATE_MB_TYPE_BIDIR_I)
-                                          : (CANDIDATE_MB_TYPE_FORWARD_I |CANDIDATE_MB_TYPE_BIDIR_I);
-                            ff_fix_long_mvs(s, s->b_field_select_table[dir][i], j,
-                                            s->b_field_mv_table[dir][i][j], dir ? s->b_code : s->f_code, type, 1);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    if (estimate_qp(s, 0) < 0)
-        return -1;
-
-    if(s->qscale < 3 && s->max_qcoeff<=128 && s->pict_type==FF_I_TYPE && !(s->flags & CODEC_FLAG_QSCALE))
-        s->qscale= 3; //reduce clipping problems
-
-    if (s->out_format == FMT_MJPEG) {
-        /* for mjpeg, we do include qscale in the matrix */
-        for(i=1;i<64;i++){
-            int j= s->dsp.idct_permutation[i];
-
-            s->intra_matrix[j] = av_clip_uint8((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3);
-        }
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg2_dc_scale_table[s->intra_dc_precision];
-        s->intra_matrix[0] = ff_mpeg2_dc_scale_table[s->intra_dc_precision][8];
-        ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16,
-                       s->intra_matrix, s->intra_quant_bias, 8, 8, 1);
-        s->qscale= 8;
-    }
-
-    //FIXME var duplication
-    s->current_picture_ptr->key_frame=
-    s->current_picture.key_frame= s->pict_type == FF_I_TYPE; //FIXME pic_ptr
-    s->current_picture_ptr->pict_type=
-    s->current_picture.pict_type= s->pict_type;
-
-    if(s->current_picture.key_frame)
-        s->picture_in_gop_number=0;
-
-    s->last_bits= put_bits_count(&s->pb);
-    switch(s->out_format) {
-    case FMT_MJPEG:
-        if (CONFIG_MJPEG_ENCODER)
-            ff_mjpeg_encode_picture_header(s);
-        break;
-    case FMT_H261:
-        if (CONFIG_H261_ENCODER)
-            ff_h261_encode_picture_header(s, picture_number);
-        break;
-    case FMT_H263:
-        if (CONFIG_WMV2_ENCODER && s->codec_id == CODEC_ID_WMV2)
-            ff_wmv2_encode_picture_header(s, picture_number);
-        else if (CONFIG_MSMPEG4_ENCODER && s->h263_msmpeg4)
-            msmpeg4_encode_picture_header(s, picture_number);
-        else if (CONFIG_MPEG4_ENCODER && s->h263_pred)
-            mpeg4_encode_picture_header(s, picture_number);
-        else if (CONFIG_RV10_ENCODER && s->codec_id == CODEC_ID_RV10)
-            rv10_encode_picture_header(s, picture_number);
-        else if (CONFIG_RV20_ENCODER && s->codec_id == CODEC_ID_RV20)
-            rv20_encode_picture_header(s, picture_number);
-        else if (CONFIG_FLV_ENCODER && s->codec_id == CODEC_ID_FLV1)
-            ff_flv_encode_picture_header(s, picture_number);
-        else if (CONFIG_H263_ENCODER)
-            h263_encode_picture_header(s, picture_number);
-        break;
-    case FMT_MPEG1:
-        if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
-            mpeg1_encode_picture_header(s, picture_number);
-        break;
-    case FMT_H264:
-        break;
-    default:
-        assert(0);
-    }
-    bits= put_bits_count(&s->pb);
-    s->header_bits= bits - s->last_bits;
-
-    for(i=1; i<s->avctx->thread_count; i++){
-        update_duplicate_context_after_me(s->thread_context[i], s);
-    }
-    s->avctx->execute(s->avctx, encode_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*));
-    for(i=1; i<s->avctx->thread_count; i++){
-        merge_context_after_encode(s, s->thread_context[i]);
-    }
-    emms_c();
-    return 0;
-}
-
-void  denoise_dct_c(MpegEncContext *s, DCTELEM *block){
-    const int intra= s->mb_intra;
-    int i;
-
-    s->dct_count[intra]++;
-
-    for(i=0; i<64; i++){
-        int level= block[i];
-
-        if(level){
-            if(level>0){
-                s->dct_error_sum[intra][i] += level;
-                level -= s->dct_offset[intra][i];
-                if(level<0) level=0;
-            }else{
-                s->dct_error_sum[intra][i] -= level;
-                level += s->dct_offset[intra][i];
-                if(level>0) level=0;
-            }
-            block[i]= level;
-        }
-    }
-}
-
-int dct_quantize_trellis_c(MpegEncContext *s,
-                        DCTELEM *block, int n,
-                        int qscale, int *overflow){
-    const int *qmat;
-    const uint8_t *scantable= s->intra_scantable.scantable;
-    const uint8_t *perm_scantable= s->intra_scantable.permutated;
-    int max=0;
-    unsigned int threshold1, threshold2;
-    int bias=0;
-    int run_tab[65];
-    int level_tab[65];
-    int score_tab[65];
-    int survivor[65];
-    int survivor_count;
-    int last_run=0;
-    int last_level=0;
-    int last_score= 0;
-    int last_i;
-    int coeff[2][64];
-    int coeff_count[64];
-    int qmul, qadd, start_i, last_non_zero, i, dc;
-    const int esc_length= s->ac_esc_length;
-    uint8_t * length;
-    uint8_t * last_length;
-    const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
-
-    s->dsp.fdct (block);
-
-    if(s->dct_error_sum)
-        s->denoise_dct(s, block);
-    qmul= qscale*16;
-    qadd= ((qscale-1)|1)*8;
-
-    if (s->mb_intra) {
-        int q;
-        if (!s->h263_aic) {
-            if (n < 4)
-                q = s->y_dc_scale;
-            else
-                q = s->c_dc_scale;
-            q = q << 3;
-        } else{
-            /* For AIC we skip quant/dequant of INTRADC */
-            q = 1 << 3;
-            qadd=0;
-        }
-
-        /* note: block[0] is assumed to be positive */
-        block[0] = (block[0] + (q >> 1)) / q;
-        start_i = 1;
-        last_non_zero = 0;
-        qmat = s->q_intra_matrix[qscale];
-        if(s->mpeg_quant || s->out_format == FMT_MPEG1)
-            bias= 1<<(QMAT_SHIFT-1);
-        length     = s->intra_ac_vlc_length;
-        last_length= s->intra_ac_vlc_last_length;
-    } else {
-        start_i = 0;
-        last_non_zero = -1;
-        qmat = s->q_inter_matrix[qscale];
-        length     = s->inter_ac_vlc_length;
-        last_length= s->inter_ac_vlc_last_length;
-    }
-    last_i= start_i;
-
-    threshold1= (1<<QMAT_SHIFT) - bias - 1;
-    threshold2= (threshold1<<1);
-
-    for(i=63; i>=start_i; i--) {
-        const int j = scantable[i];
-        int level = block[j] * qmat[j];
-
-        if(((unsigned)(level+threshold1))>threshold2){
-            last_non_zero = i;
-            break;
-        }
-    }
-
-    for(i=start_i; i<=last_non_zero; i++) {
-        const int j = scantable[i];
-        int level = block[j] * qmat[j];
-
-//        if(   bias+level >= (1<<(QMAT_SHIFT - 3))
-//           || bias-level >= (1<<(QMAT_SHIFT - 3))){
-        if(((unsigned)(level+threshold1))>threshold2){
-            if(level>0){
-                level= (bias + level)>>QMAT_SHIFT;
-                coeff[0][i]= level;
-                coeff[1][i]= level-1;
-//                coeff[2][k]= level-2;
-            }else{
-                level= (bias - level)>>QMAT_SHIFT;
-                coeff[0][i]= -level;
-                coeff[1][i]= -level+1;
-//                coeff[2][k]= -level+2;
-            }
-            coeff_count[i]= FFMIN(level, 2);
-            assert(coeff_count[i]);
-            max |=level;
-        }else{
-            coeff[0][i]= (level>>31)|1;
-            coeff_count[i]= 1;
-        }
-    }
-
-    *overflow= s->max_qcoeff < max; //overflow might have happened
-
-    if(last_non_zero < start_i){
-        memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM));
-        return last_non_zero;
-    }
-
-    score_tab[start_i]= 0;
-    survivor[0]= start_i;
-    survivor_count= 1;
-
-    for(i=start_i; i<=last_non_zero; i++){
-        int level_index, j, zero_distortion;
-        int dct_coeff= FFABS(block[ scantable[i] ]);
-        int best_score=256*256*256*120;
-
-        if (   s->dsp.fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
-            || s->dsp.fdct == ff_faandct
-#endif
-           )
-            dct_coeff= (dct_coeff*ff_inv_aanscales[ scantable[i] ]) >> 12;
-        zero_distortion= dct_coeff*dct_coeff;
-
-        for(level_index=0; level_index < coeff_count[i]; level_index++){
-            int distortion;
-            int level= coeff[level_index][i];
-            const int alevel= FFABS(level);
-            int unquant_coeff;
-
-            assert(level);
-
-            if(s->out_format == FMT_H263){
-                unquant_coeff= alevel*qmul + qadd;
-            }else{ //MPEG1
-                j= s->dsp.idct_permutation[ scantable[i] ]; //FIXME optimize
-                if(s->mb_intra){
-                        unquant_coeff = (int)(  alevel  * qscale * s->intra_matrix[j]) >> 3;
-                        unquant_coeff =   (unquant_coeff - 1) | 1;
-                }else{
-                        unquant_coeff = (((  alevel  << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4;
-                        unquant_coeff =   (unquant_coeff - 1) | 1;
-                }
-                unquant_coeff<<= 3;
-            }
-
-            distortion= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distortion;
-            level+=64;
-            if((level&(~127)) == 0){
-                for(j=survivor_count-1; j>=0; j--){
-                    int run= i - survivor[j];
-                    int score= distortion + length[UNI_AC_ENC_INDEX(run, level)]*lambda;
-                    score += score_tab[i-run];
-
-                    if(score < best_score){
-                        best_score= score;
-                        run_tab[i+1]= run;
-                        level_tab[i+1]= level-64;
-                    }
-                }
-
-                if(s->out_format == FMT_H263){
-                    for(j=survivor_count-1; j>=0; j--){
-                        int run= i - survivor[j];
-                        int score= distortion + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda;
-                        score += score_tab[i-run];
-                        if(score < last_score){
-                            last_score= score;
-                            last_run= run;
-                            last_level= level-64;
-                            last_i= i+1;
-                        }
-                    }
-                }
-            }else{
-                distortion += esc_length*lambda;
-                for(j=survivor_count-1; j>=0; j--){
-                    int run= i - survivor[j];
-                    int score= distortion + score_tab[i-run];
-
-                    if(score < best_score){
-                        best_score= score;
-                        run_tab[i+1]= run;
-                        level_tab[i+1]= level-64;
-                    }
-                }
-
-                if(s->out_format == FMT_H263){
-                  for(j=survivor_count-1; j>=0; j--){
-                        int run= i - survivor[j];
-                        int score= distortion + score_tab[i-run];
-                        if(score < last_score){
-                            last_score= score;
-                            last_run= run;
-                            last_level= level-64;
-                            last_i= i+1;
-                        }
-                    }
-                }
-            }
-        }
-
-        score_tab[i+1]= best_score;
-
-        //Note: there is a vlc code in mpeg4 which is 1 bit shorter then another one with a shorter run and the same level
-        if(last_non_zero <= 27){
-            for(; survivor_count; survivor_count--){
-                if(score_tab[ survivor[survivor_count-1] ] <= best_score)
-                    break;
-            }
-        }else{
-            for(; survivor_count; survivor_count--){
-                if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda)
-                    break;
-            }
-        }
-
-        survivor[ survivor_count++ ]= i+1;
-    }
-
-    if(s->out_format != FMT_H263){
-        last_score= 256*256*256*120;
-        for(i= survivor[0]; i<=last_non_zero + 1; i++){
-            int score= score_tab[i];
-            if(i) score += lambda*2; //FIXME exacter?
-
-            if(score < last_score){
-                last_score= score;
-                last_i= i;
-                last_level= level_tab[i];
-                last_run= run_tab[i];
-            }
-        }
-    }
-
-    s->coded_score[n] = last_score;
-
-    dc= FFABS(block[0]);
-    last_non_zero= last_i - 1;
-    memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM));
-
-    if(last_non_zero < start_i)
-        return last_non_zero;
-
-    if(last_non_zero == 0 && start_i == 0){
-        int best_level= 0;
-        int best_score= dc * dc;
-
-        for(i=0; i<coeff_count[0]; i++){
-            int level= coeff[i][0];
-            int alevel= FFABS(level);
-            int unquant_coeff, score, distortion;
-
-            if(s->out_format == FMT_H263){
-                    unquant_coeff= (alevel*qmul + qadd)>>3;
-            }else{ //MPEG1
-                    unquant_coeff = (((  alevel  << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4;
-                    unquant_coeff =   (unquant_coeff - 1) | 1;
-            }
-            unquant_coeff = (unquant_coeff + 4) >> 3;
-            unquant_coeff<<= 3 + 3;
-
-            distortion= (unquant_coeff - dc) * (unquant_coeff - dc);
-            level+=64;
-            if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda;
-            else                    score= distortion + esc_length*lambda;
-
-            if(score < best_score){
-                best_score= score;
-                best_level= level - 64;
-            }
-        }
-        block[0]= best_level;
-        s->coded_score[n] = best_score - dc*dc;
-        if(best_level == 0) return -1;
-        else                return last_non_zero;
-    }
-
-    i= last_i;
-    assert(last_level);
-
-    block[ perm_scantable[last_non_zero] ]= last_level;
-    i -= last_run + 1;
-
-    for(; i>start_i; i -= run_tab[i] + 1){
-        block[ perm_scantable[i-1] ]= level_tab[i];
-    }
-
-    return last_non_zero;
-}
-
-//#define REFINE_STATS 1
-static int16_t basis[64][64];
-
-static void build_basis(uint8_t *perm){
-    int i, j, x, y;
-    emms_c();
-    for(i=0; i<8; i++){
-        for(j=0; j<8; j++){
-            for(y=0; y<8; y++){
-                for(x=0; x<8; x++){
-                    double s= 0.25*(1<<BASIS_SHIFT);
-                    int index= 8*i + j;
-                    int perm_index= perm[index];
-                    if(i==0) s*= sqrt(0.5);
-                    if(j==0) s*= sqrt(0.5);
-                    basis[perm_index][8*x + y]= lrintf(s * cos((M_PI/8.0)*i*(x+0.5)) * cos((M_PI/8.0)*j*(y+0.5)));
-                }
-            }
-        }
-    }
-}
-
-static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise?
-                        DCTELEM *block, int16_t *weight, DCTELEM *orig,
-                        int n, int qscale){
-    int16_t rem[64];
-    LOCAL_ALIGNED_16(DCTELEM, d1, [64]);
-    const uint8_t *scantable= s->intra_scantable.scantable;
-    const uint8_t *perm_scantable= s->intra_scantable.permutated;
-//    unsigned int threshold1, threshold2;
-//    int bias=0;
-    int run_tab[65];
-    int prev_run=0;
-    int prev_level=0;
-    int qmul, qadd, start_i, last_non_zero, i, dc;
-    uint8_t * length;
-    uint8_t * last_length;
-    int lambda;
-    int rle_index, run, q = 1, sum; //q is only used when s->mb_intra is true
-#ifdef REFINE_STATS
-static int count=0;
-static int after_last=0;
-static int to_zero=0;
-static int from_zero=0;
-static int raise=0;
-static int lower=0;
-static int messed_sign=0;
-#endif
-
-    if(basis[0][0] == 0)
-        build_basis(s->dsp.idct_permutation);
-
-    qmul= qscale*2;
-    qadd= (qscale-1)|1;
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                q = s->y_dc_scale;
-            else
-                q = s->c_dc_scale;
-        } else{
-            /* For AIC we skip quant/dequant of INTRADC */
-            q = 1;
-            qadd=0;
-        }
-        q <<= RECON_SHIFT-3;
-        /* note: block[0] is assumed to be positive */
-        dc= block[0]*q;
-//        block[0] = (block[0] + (q >> 1)) / q;
-        start_i = 1;
-//        if(s->mpeg_quant || s->out_format == FMT_MPEG1)
-//            bias= 1<<(QMAT_SHIFT-1);
-        length     = s->intra_ac_vlc_length;
-        last_length= s->intra_ac_vlc_last_length;
-    } else {
-        dc= 0;
-        start_i = 0;
-        length     = s->inter_ac_vlc_length;
-        last_length= s->inter_ac_vlc_last_length;
-    }
-    last_non_zero = s->block_last_index[n];
-
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-    dc += (1<<(RECON_SHIFT-1));
-    for(i=0; i<64; i++){
-        rem[i]= dc - (orig[i]<<RECON_SHIFT); //FIXME  use orig dirrectly instead of copying to rem[]
-    }
-#ifdef REFINE_STATS
-STOP_TIMER("memset rem[]")}
-#endif
-    sum=0;
-    for(i=0; i<64; i++){
-        int one= 36;
-        int qns=4;
-        int w;
-
-        w= FFABS(weight[i]) + qns*one;
-        w= 15 + (48*qns*one + w/2)/w; // 16 .. 63
-
-        weight[i] = w;
-//        w=weight[i] = (63*qns + (w/2)) / w;
-
-        assert(w>0);
-        assert(w<(1<<6));
-        sum += w*w;
-    }
-    lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6);
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-    run=0;
-    rle_index=0;
-    for(i=start_i; i<=last_non_zero; i++){
-        int j= perm_scantable[i];
-        const int level= block[j];
-        int coeff;
-
-        if(level){
-            if(level<0) coeff= qmul*level - qadd;
-            else        coeff= qmul*level + qadd;
-            run_tab[rle_index++]=run;
-            run=0;
-
-            s->dsp.add_8x8basis(rem, basis[j], coeff);
-        }else{
-            run++;
-        }
-    }
-#ifdef REFINE_STATS
-if(last_non_zero>0){
-STOP_TIMER("init rem[]")
-}
-}
-
-{START_TIMER
-#endif
-    for(;;){
-        int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0);
-        int best_coeff=0;
-        int best_change=0;
-        int run2, best_unquant_change=0, analyze_gradient;
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-        analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3;
-
-        if(analyze_gradient){
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-            for(i=0; i<64; i++){
-                int w= weight[i];
-
-                d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12);
-            }
-#ifdef REFINE_STATS
-STOP_TIMER("rem*w*w")}
-{START_TIMER
-#endif
-            s->dsp.fdct(d1);
-#ifdef REFINE_STATS
-STOP_TIMER("dct")}
-#endif
-        }
-
-        if(start_i){
-            const int level= block[0];
-            int change, old_coeff;
-
-            assert(s->mb_intra);
-
-            old_coeff= q*level;
-
-            for(change=-1; change<=1; change+=2){
-                int new_level= level + change;
-                int score, new_coeff;
-
-                new_coeff= q*new_level;
-                if(new_coeff >= 2048 || new_coeff < 0)
-                    continue;
-
-                score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff);
-                if(score<best_score){
-                    best_score= score;
-                    best_coeff= 0;
-                    best_change= change;
-                    best_unquant_change= new_coeff - old_coeff;
-                }
-            }
-        }
-
-        run=0;
-        rle_index=0;
-        run2= run_tab[rle_index++];
-        prev_level=0;
-        prev_run=0;
-
-        for(i=start_i; i<64; i++){
-            int j= perm_scantable[i];
-            const int level= block[j];
-            int change, old_coeff;
-
-            if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
-                break;
-
-            if(level){
-                if(level<0) old_coeff= qmul*level - qadd;
-                else        old_coeff= qmul*level + qadd;
-                run2= run_tab[rle_index++]; //FIXME ! maybe after last
-            }else{
-                old_coeff=0;
-                run2--;
-                assert(run2>=0 || i >= last_non_zero );
-            }
-
-            for(change=-1; change<=1; change+=2){
-                int new_level= level + change;
-                int score, new_coeff, unquant_change;
-
-                score=0;
-                if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
-                   continue;
-
-                if(new_level){
-                    if(new_level<0) new_coeff= qmul*new_level - qadd;
-                    else            new_coeff= qmul*new_level + qadd;
-                    if(new_coeff >= 2048 || new_coeff <= -2048)
-                        continue;
-                    //FIXME check for overflow
-
-                    if(level){
-                        if(level < 63 && level > -63){
-                            if(i < last_non_zero)
-                                score +=   length[UNI_AC_ENC_INDEX(run, new_level+64)]
-                                         - length[UNI_AC_ENC_INDEX(run, level+64)];
-                            else
-                                score +=   last_length[UNI_AC_ENC_INDEX(run, new_level+64)]
-                                         - last_length[UNI_AC_ENC_INDEX(run, level+64)];
-                        }
-                    }else{
-                        assert(FFABS(new_level)==1);
-
-                        if(analyze_gradient){
-                            int g= d1[ scantable[i] ];
-                            if(g && (g^new_level) >= 0)
-                                continue;
-                        }
-
-                        if(i < last_non_zero){
-                            int next_i= i + run2 + 1;
-                            int next_level= block[ perm_scantable[next_i] ] + 64;
-
-                            if(next_level&(~127))
-                                next_level= 0;
-
-                            if(next_i < last_non_zero)
-                                score +=   length[UNI_AC_ENC_INDEX(run, 65)]
-                                         + length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                         - length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
-                            else
-                                score +=  length[UNI_AC_ENC_INDEX(run, 65)]
-                                        + last_length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                        - last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
-                        }else{
-                            score += last_length[UNI_AC_ENC_INDEX(run, 65)];
-                            if(prev_level){
-                                score +=  length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
-                                        - last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
-                            }
-                        }
-                    }
-                }else{
-                    new_coeff=0;
-                    assert(FFABS(level)==1);
-
-                    if(i < last_non_zero){
-                        int next_i= i + run2 + 1;
-                        int next_level= block[ perm_scantable[next_i] ] + 64;
-
-                        if(next_level&(~127))
-                            next_level= 0;
-
-                        if(next_i < last_non_zero)
-                            score +=   length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
-                                     - length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                     - length[UNI_AC_ENC_INDEX(run, 65)];
-                        else
-                            score +=   last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
-                                     - last_length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                     - length[UNI_AC_ENC_INDEX(run, 65)];
-                    }else{
-                        score += -last_length[UNI_AC_ENC_INDEX(run, 65)];
-                        if(prev_level){
-                            score +=  last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
-                                    - length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
-                        }
-                    }
-                }
-
-                score *= lambda;
-
-                unquant_change= new_coeff - old_coeff;
-                assert((score < 100*lambda && score > -100*lambda) || lambda==0);
-
-                score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change);
-                if(score<best_score){
-                    best_score= score;
-                    best_coeff= i;
-                    best_change= change;
-                    best_unquant_change= unquant_change;
-                }
-            }
-            if(level){
-                prev_level= level + 64;
-                if(prev_level&(~127))
-                    prev_level= 0;
-                prev_run= run;
-                run=0;
-            }else{
-                run++;
-            }
-        }
-#ifdef REFINE_STATS
-STOP_TIMER("iterative step")}
-#endif
-
-        if(best_change){
-            int j= perm_scantable[ best_coeff ];
-
-            block[j] += best_change;
-
-            if(best_coeff > last_non_zero){
-                last_non_zero= best_coeff;
-                assert(block[j]);
-#ifdef REFINE_STATS
-after_last++;
-#endif
-            }else{
-#ifdef REFINE_STATS
-if(block[j]){
-    if(block[j] - best_change){
-        if(FFABS(block[j]) > FFABS(block[j] - best_change)){
-            raise++;
-        }else{
-            lower++;
-        }
-    }else{
-        from_zero++;
-    }
-}else{
-    to_zero++;
-}
-#endif
-                for(; last_non_zero>=start_i; last_non_zero--){
-                    if(block[perm_scantable[last_non_zero]])
-                        break;
-                }
-            }
-#ifdef REFINE_STATS
-count++;
-if(256*256*256*64 % count == 0){
-    printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number);
-}
-#endif
-            run=0;
-            rle_index=0;
-            for(i=start_i; i<=last_non_zero; i++){
-                int j= perm_scantable[i];
-                const int level= block[j];
-
-                 if(level){
-                     run_tab[rle_index++]=run;
-                     run=0;
-                 }else{
-                     run++;
-                 }
-            }
-
-            s->dsp.add_8x8basis(rem, basis[j], best_unquant_change);
-        }else{
-            break;
-        }
-    }
-#ifdef REFINE_STATS
-if(last_non_zero>0){
-STOP_TIMER("iterative search")
-}
-}
-#endif
-
-    return last_non_zero;
-}
-
-int dct_quantize_c(MpegEncContext *s,
-                        DCTELEM *block, int n,
-                        int qscale, int *overflow)
-{
-    int i, j, level, last_non_zero, q, start_i;
-    const int *qmat;
-    const uint8_t *scantable= s->intra_scantable.scantable;
-    int bias;
-    int max=0;
-    unsigned int threshold1, threshold2;
-
-    s->dsp.fdct (block);
-
-    if(s->dct_error_sum)
-        s->denoise_dct(s, block);
-
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                q = s->y_dc_scale;
-            else
-                q = s->c_dc_scale;
-            q = q << 3;
-        } else
-            /* For AIC we skip quant/dequant of INTRADC */
-            q = 1 << 3;
-
-        /* note: block[0] is assumed to be positive */
-        block[0] = (block[0] + (q >> 1)) / q;
-        start_i = 1;
-        last_non_zero = 0;
-        qmat = s->q_intra_matrix[qscale];
-        bias= s->intra_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT);
-    } else {
-        start_i = 0;
-        last_non_zero = -1;
-        qmat = s->q_inter_matrix[qscale];
-        bias= s->inter_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT);
-    }
-    threshold1= (1<<QMAT_SHIFT) - bias - 1;
-    threshold2= (threshold1<<1);
-    for(i=63;i>=start_i;i--) {
-        j = scantable[i];
-        level = block[j] * qmat[j];
-
-        if(((unsigned)(level+threshold1))>threshold2){
-            last_non_zero = i;
-            break;
-        }else{
-            block[j]=0;
-        }
-    }
-    for(i=start_i; i<=last_non_zero; i++) {
-        j = scantable[i];
-        level = block[j] * qmat[j];
-
-//        if(   bias+level >= (1<<QMAT_SHIFT)
-//           || bias-level >= (1<<QMAT_SHIFT)){
-        if(((unsigned)(level+threshold1))>threshold2){
-            if(level>0){
-                level= (bias + level)>>QMAT_SHIFT;
-                block[j]= level;
-            }else{
-                level= (bias - level)>>QMAT_SHIFT;
-                block[j]= -level;
-            }
-            max |=level;
-        }else{
-            block[j]=0;
-        }
-    }
-    *overflow= s->max_qcoeff < max; //overflow might have happened
-
-    /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */
-    if (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM)
-        ff_block_permute(block, s->dsp.idct_permutation, scantable, last_non_zero);
-
-    return last_non_zero;
-}
-
-AVCodec h263_encoder = {
-    "h263",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H263,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996"),
-};
-
-AVCodec h263p_encoder = {
-    "h263p",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_H263P,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"),
-};
-
-AVCodec msmpeg4v1_encoder = {
-    "msmpeg4v1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V1,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
-};
-
-AVCodec msmpeg4v2_encoder = {
-    "msmpeg4v2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V2,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
-};
-
-AVCodec msmpeg4v3_encoder = {
-    "msmpeg4",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V3,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
-};
-
-AVCodec wmv1_encoder = {
-    "wmv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WMV1,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
-};
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
deleted file mode 100644
index 546c3bd..0000000
--- a/libavcodec/mpegvideo_parser.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * MPEG1 / MPEG2 video parser
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-#include "mpegvideo.h"
-
-static void mpegvideo_extract_headers(AVCodecParserContext *s,
-                                      AVCodecContext *avctx,
-                                      const uint8_t *buf, int buf_size)
-{
-    ParseContext1 *pc = s->priv_data;
-    const uint8_t *buf_end = buf + buf_size;
-    uint32_t start_code;
-    int frame_rate_index, ext_type, bytes_left;
-    int frame_rate_ext_n, frame_rate_ext_d;
-    int picture_structure, top_field_first, repeat_first_field, progressive_frame;
-    int horiz_size_ext, vert_size_ext, bit_rate_ext;
-    int did_set_size=0;
-//FIXME replace the crap with get_bits()
-    s->repeat_pict = 0;
-
-    while (buf < buf_end) {
-        start_code= -1;
-        buf= ff_find_start_code(buf, buf_end, &start_code);
-        bytes_left = buf_end - buf;
-        switch(start_code) {
-        case PICTURE_START_CODE:
-            if (bytes_left >= 2) {
-                s->pict_type = (buf[1] >> 3) & 7;
-            }
-            break;
-        case SEQ_START_CODE:
-            if (bytes_left >= 7) {
-                pc->width  = (buf[0] << 4) | (buf[1] >> 4);
-                pc->height = ((buf[1] & 0x0f) << 8) | buf[2];
-                if(!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height){
-                    avcodec_set_dimensions(avctx, pc->width, pc->height);
-                    did_set_size=1;
-                }
-                frame_rate_index = buf[3] & 0xf;
-                pc->frame_rate.den = avctx->time_base.den = ff_frame_rate_tab[frame_rate_index].num;
-                pc->frame_rate.num = avctx->time_base.num = ff_frame_rate_tab[frame_rate_index].den;
-                avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
-                avctx->codec_id = CODEC_ID_MPEG1VIDEO;
-                avctx->sub_id = 1;
-            }
-            break;
-        case EXT_START_CODE:
-            if (bytes_left >= 1) {
-                ext_type = (buf[0] >> 4);
-                switch(ext_type) {
-                case 0x1: /* sequence extension */
-                    if (bytes_left >= 6) {
-                        horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7);
-                        vert_size_ext = (buf[2] >> 5) & 3;
-                        bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1);
-                        frame_rate_ext_n = (buf[5] >> 5) & 3;
-                        frame_rate_ext_d = (buf[5] & 0x1f);
-                        pc->progressive_sequence = buf[1] & (1 << 3);
-                        avctx->has_b_frames= !(buf[5] >> 7);
-
-                        pc->width  |=(horiz_size_ext << 12);
-                        pc->height |=( vert_size_ext << 12);
-                        avctx->bit_rate += (bit_rate_ext << 18) * 400;
-                        if(did_set_size)
-                            avcodec_set_dimensions(avctx, pc->width, pc->height);
-                        avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1) * 2;
-                        avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1);
-                        avctx->codec_id = CODEC_ID_MPEG2VIDEO;
-                        avctx->sub_id = 2; /* forces MPEG2 */
-                    }
-                    break;
-                case 0x8: /* picture coding extension */
-                    if (bytes_left >= 5) {
-                        picture_structure = buf[2]&3;
-                        top_field_first = buf[3] & (1 << 7);
-                        repeat_first_field = buf[3] & (1 << 1);
-                        progressive_frame = buf[4] & (1 << 7);
-
-                        /* check if we must repeat the frame */
-                        s->repeat_pict = 1;
-                        if (repeat_first_field) {
-                            if (pc->progressive_sequence) {
-                                if (top_field_first)
-                                    s->repeat_pict = 5;
-                                else
-                                    s->repeat_pict = 3;
-                            } else if (progressive_frame) {
-                                s->repeat_pict = 2;
-                            }
-                        }
-                    }
-                    break;
-                }
-            }
-            break;
-        case -1:
-            goto the_end;
-        default:
-            /* we stop parsing when we encounter a slice. It ensures
-               that this function takes a negligible amount of time */
-            if (start_code >= SLICE_MIN_START_CODE &&
-                start_code <= SLICE_MAX_START_CODE)
-                goto the_end;
-            break;
-        }
-    }
- the_end: ;
-}
-
-static int mpegvideo_parse(AVCodecParserContext *s,
-                           AVCodecContext *avctx,
-                           const uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size)
-{
-    ParseContext1 *pc1 = s->priv_data;
-    ParseContext *pc= &pc1->pc;
-    int next;
-
-    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
-        next= buf_size;
-    }else{
-        next= ff_mpeg1_find_frame_end(pc, buf, buf_size, s);
-
-        if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-
-    }
-    /* we have a full frame : we just parse the first few MPEG headers
-       to have the full timing information. The time take by this
-       function should be negligible for uncorrupted streams */
-    mpegvideo_extract_headers(s, avctx, buf, buf_size);
-#if 0
-    printf("pict_type=%d frame_rate=%0.3f repeat_pict=%d\n",
-           s->pict_type, (double)avctx->time_base.den / avctx->time_base.num, s->repeat_pict);
-#endif
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-static int mpegvideo_split(AVCodecContext *avctx,
-                           const uint8_t *buf, int buf_size)
-{
-    int i;
-    uint32_t state= -1;
-
-    for(i=0; i<buf_size; i++){
-        state= (state<<8) | buf[i];
-        if(state != 0x1B3 && state != 0x1B5 && state < 0x200 && state >= 0x100)
-            return i-3;
-    }
-    return 0;
-}
-
-AVCodecParser mpegvideo_parser = {
-    { CODEC_ID_MPEG1VIDEO, CODEC_ID_MPEG2VIDEO },
-    sizeof(ParseContext1),
-    NULL,
-    mpegvideo_parse,
-    ff_parse1_close,
-    mpegvideo_split,
-};
diff --git a/libavcodec/mpegvideo_xvmc.c b/libavcodec/mpegvideo_xvmc.c
deleted file mode 100644
index df81e5d..0000000
--- a/libavcodec/mpegvideo_xvmc.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * XVideo Motion Compensation
- * Copyright (c) 2003 Ivan Kalvachev
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <limits.h>
-#include <X11/extensions/XvMC.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#include "xvmc.h"
-#include "xvmc_internal.h"
-
-/**
- * Initializes the block field of the MpegEncContext pointer passed as
- * parameter after making sure that the data is not corrupted.
- * In order to implement something like direct rendering instead of decoding
- * coefficients in s->blocks and then copying them, copy them directly
- * into the data_blocks array provided by xvmc.
- */
-void ff_xvmc_init_block(MpegEncContext *s)
-{
-    struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2];
-    assert(render && render->xvmc_id == AV_XVMC_ID);
-
-    s->block = (DCTELEM (*)[64])(render->data_blocks + render->next_free_data_block_num * 64);
-}
-
-/**
- * Fills individual block pointers, so there are no gaps in the data_block array
- * in case not all blocks in the macroblock are coded.
- */
-void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp)
-{
-    int i, j = 0;
-    const int mb_block_count = 4 + (1 << s->chroma_format);
-
-    cbp <<= 12-mb_block_count;
-    for (i = 0; i < mb_block_count; i++) {
-        if (cbp & (1 << 11))
-            s->pblocks[i] = &s->block[j++];
-        else
-            s->pblocks[i] = NULL;
-        cbp += cbp;
-    }
-}
-
-/**
- * Finds and stores the surfaces that are used as reference frames.
- * This function should be called for every new field and/or frame.
- * It should be safe to call the function a few times for the same field.
- */
-int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx)
-{
-    struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.data[2];
-    const int mb_block_count = 4 + (1 << s->chroma_format);
-
-    assert(avctx);
-    if (!render || render->xvmc_id != AV_XVMC_ID ||
-        !render->data_blocks || !render->mv_blocks ||
-        (unsigned int)render->allocated_mv_blocks   > INT_MAX/(64*6) ||
-        (unsigned int)render->allocated_data_blocks > INT_MAX/64     ||
-        !render->p_surface) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Render token doesn't look as expected.\n");
-        return -1; // make sure that this is a render packet
-    }
-
-    if (render->filled_mv_blocks_num) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Rendering surface contains %i unprocessed blocks.\n",
-               render->filled_mv_blocks_num);
-        return -1;
-    }
-    if (render->allocated_mv_blocks   < 1 ||
-        render->allocated_data_blocks <  render->allocated_mv_blocks*mb_block_count ||
-        render->start_mv_blocks_num   >= render->allocated_mv_blocks                ||
-        render->next_free_data_block_num >
-                        render->allocated_data_blocks -
-                        mb_block_count*(render->allocated_mv_blocks-render->start_mv_blocks_num)) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Rendering surface doesn't provide enough block structures to work with.\n");
-        return -1;
-    }
-
-    render->picture_structure = s->picture_structure;
-    render->flags             = s->first_field ? 0 : XVMC_SECOND_FIELD;
-    render->p_future_surface  = NULL;
-    render->p_past_surface    = NULL;
-
-    switch(s->pict_type) {
-        case  FF_I_TYPE:
-            return 0; // no prediction from other frames
-        case  FF_B_TYPE:
-            next = (struct xvmc_pix_fmt*)s->next_picture.data[2];
-            if (!next)
-                return -1;
-            if (next->xvmc_id != AV_XVMC_ID)
-                return -1;
-            render->p_future_surface = next->p_surface;
-            // no return here, going to set forward prediction
-        case  FF_P_TYPE:
-            last = (struct xvmc_pix_fmt*)s->last_picture.data[2];
-            if (!last)
-                last = render; // predict second field from the first
-            if (last->xvmc_id != AV_XVMC_ID)
-                return -1;
-            render->p_past_surface = last->p_surface;
-            return 0;
-    }
-
-return -1;
-}
-
-/**
- * Completes frame/field rendering by passing any remaining blocks.
- * Normally ff_draw_horiz_band() is called for each slice, however,
- * some leftover blocks, for example from error_resilience(), may remain.
- * It should be safe to call the function a few times for the same field.
- */
-void ff_xvmc_field_end(MpegEncContext *s)
-{
-    struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2];
-    assert(render);
-
-    if (render->filled_mv_blocks_num > 0)
-        ff_draw_horiz_band(s, 0, 0);
-}
-
-/**
- * Synthesizes the data needed by XvMC to render one macroblock of data.
- * Fills all relevant fields, if necessary do IDCT.
- */
-void ff_xvmc_decode_mb(MpegEncContext *s)
-{
-    XvMCMacroBlock *mv_block;
-    struct xvmc_pix_fmt *render;
-    int i, cbp, blocks_per_mb;
-
-    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-
-
-    if (s->encoding) {
-        av_log(s->avctx, AV_LOG_ERROR, "XVMC doesn't support encoding!!!\n");
-        return;
-    }
-
-    // from MPV_decode_mb(), update DC predictors for P macroblocks
-    if (!s->mb_intra) {
-        s->last_dc[0] =
-        s->last_dc[1] =
-        s->last_dc[2] =  128 << s->intra_dc_precision;
-    }
-
-    // MC doesn't skip blocks
-    s->mb_skipped = 0;
-
-
-    // Do I need to export quant when I could not perform postprocessing?
-    // Anyway, it doesn't hurt.
-    s->current_picture.qscale_table[mb_xy] = s->qscale;
-
-    // start of XVMC-specific code
-    render = (struct xvmc_pix_fmt*)s->current_picture.data[2];
-    assert(render);
-    assert(render->xvmc_id == AV_XVMC_ID);
-    assert(render->mv_blocks);
-
-    // take the next free macroblock
-    mv_block = &render->mv_blocks[render->start_mv_blocks_num +
-                                  render->filled_mv_blocks_num];
-
-    mv_block->x        = s->mb_x;
-    mv_block->y        = s->mb_y;
-    mv_block->dct_type = s->interlaced_dct; // XVMC_DCT_TYPE_FRAME/FIELD;
-    if (s->mb_intra) {
-        mv_block->macroblock_type = XVMC_MB_TYPE_INTRA; // no MC, all done
-    } else {
-        mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN;
-
-        if (s->mv_dir & MV_DIR_FORWARD) {
-            mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD;
-            // PMV[n][dir][xy] = mv[dir][n][xy]
-            mv_block->PMV[0][0][0] = s->mv[0][0][0];
-            mv_block->PMV[0][0][1] = s->mv[0][0][1];
-            mv_block->PMV[1][0][0] = s->mv[0][1][0];
-            mv_block->PMV[1][0][1] = s->mv[0][1][1];
-        }
-        if (s->mv_dir & MV_DIR_BACKWARD) {
-            mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD;
-            mv_block->PMV[0][1][0] = s->mv[1][0][0];
-            mv_block->PMV[0][1][1] = s->mv[1][0][1];
-            mv_block->PMV[1][1][0] = s->mv[1][1][0];
-            mv_block->PMV[1][1][1] = s->mv[1][1][1];
-        }
-
-        switch(s->mv_type) {
-            case  MV_TYPE_16X16:
-                mv_block->motion_type = XVMC_PREDICTION_FRAME;
-                break;
-            case  MV_TYPE_16X8:
-                mv_block->motion_type = XVMC_PREDICTION_16x8;
-                break;
-            case  MV_TYPE_FIELD:
-                mv_block->motion_type = XVMC_PREDICTION_FIELD;
-                if (s->picture_structure == PICT_FRAME) {
-                    mv_block->PMV[0][0][1] <<= 1;
-                    mv_block->PMV[1][0][1] <<= 1;
-                    mv_block->PMV[0][1][1] <<= 1;
-                    mv_block->PMV[1][1][1] <<= 1;
-                }
-                break;
-            case  MV_TYPE_DMV:
-                mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME;
-                if (s->picture_structure == PICT_FRAME) {
-
-                    mv_block->PMV[0][0][0] = s->mv[0][0][0];      // top from top
-                    mv_block->PMV[0][0][1] = s->mv[0][0][1] << 1;
-
-                    mv_block->PMV[0][1][0] = s->mv[0][0][0];      // bottom from bottom
-                    mv_block->PMV[0][1][1] = s->mv[0][0][1] << 1;
-
-                    mv_block->PMV[1][0][0] = s->mv[0][2][0];      // dmv00, top from bottom
-                    mv_block->PMV[1][0][1] = s->mv[0][2][1] << 1; // dmv01
-
-                    mv_block->PMV[1][1][0] = s->mv[0][3][0];      // dmv10, bottom from top
-                    mv_block->PMV[1][1][1] = s->mv[0][3][1] << 1; // dmv11
-
-                } else {
-                    mv_block->PMV[0][1][0] = s->mv[0][2][0];      // dmv00
-                    mv_block->PMV[0][1][1] = s->mv[0][2][1];      // dmv01
-                }
-                break;
-            default:
-                assert(0);
-        }
-
-        mv_block->motion_vertical_field_select = 0;
-
-        // set correct field references
-        if (s->mv_type == MV_TYPE_FIELD || s->mv_type == MV_TYPE_16X8) {
-            mv_block->motion_vertical_field_select |= s->field_select[0][0];
-            mv_block->motion_vertical_field_select |= s->field_select[1][0] << 1;
-            mv_block->motion_vertical_field_select |= s->field_select[0][1] << 2;
-            mv_block->motion_vertical_field_select |= s->field_select[1][1] << 3;
-        }
-    } // !intra
-    // time to handle data blocks
-    mv_block->index = render->next_free_data_block_num;
-
-    blocks_per_mb = 6;
-    if (s->chroma_format >= 2) {
-        blocks_per_mb = 4 + (1 << s->chroma_format);
-    }
-
-    // calculate cbp
-    cbp = 0;
-    for (i = 0; i < blocks_per_mb; i++) {
-        cbp += cbp;
-        if (s->block_last_index[i] >= 0)
-            cbp++;
-    }
-
-    if (s->flags & CODEC_FLAG_GRAY) {
-        if (s->mb_intra) {                                   // intra frames are always full chroma blocks
-            for (i = 4; i < blocks_per_mb; i++) {
-                memset(s->pblocks[i], 0, sizeof(*s->pblocks[i]));  // so we need to clear them
-                if (!render->unsigned_intra)
-                    *s->pblocks[i][0] = 1 << 10;
-            }
-        } else {
-            cbp &= 0xf << (blocks_per_mb - 4);
-            blocks_per_mb = 4;                               // luminance blocks only
-        }
-    }
-    mv_block->coded_block_pattern = cbp;
-    if (cbp == 0)
-        mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN;
-
-    for (i = 0; i < blocks_per_mb; i++) {
-        if (s->block_last_index[i] >= 0) {
-            // I do not have unsigned_intra MOCO to test, hope it is OK.
-            if (s->mb_intra && (render->idct || (!render->idct && !render->unsigned_intra)))
-                *s->pblocks[i][0] -= 1 << 10;
-            if (!render->idct) {
-                s->dsp.idct(*s->pblocks[i]);
-                /* It is unclear if MC hardware requires pixel diff values to be
-                 * in the range [-255;255]. TODO: Clipping if such hardware is
-                 * ever found. As of now it would only be an unnecessary
-                 * slowdown. */
-            }
-            // copy blocks only if the codec doesn't support pblocks reordering
-            if (s->avctx->xvmc_acceleration == 1) {
-                memcpy(&render->data_blocks[render->next_free_data_block_num*64],
-                       s->pblocks[i], sizeof(*s->pblocks[i]));
-            }
-            render->next_free_data_block_num++;
-        }
-    }
-    render->filled_mv_blocks_num++;
-
-    assert(render->filled_mv_blocks_num     <= render->allocated_mv_blocks);
-    assert(render->next_free_data_block_num <= render->allocated_data_blocks);
-    /* The above conditions should not be able to fail as long as this function
-     * is used and the following 'if ()' automatically calls a callback to free
-     * blocks. */
-
-
-    if (render->filled_mv_blocks_num == render->allocated_mv_blocks)
-        ff_draw_horiz_band(s, 0, 0);
-}
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
deleted file mode 100644
index 84658fe..0000000
--- a/libavcodec/msmpeg4.c
+++ /dev/null
@@ -1,1976 +0,0 @@
-/*
- * MSMPEG4 backend for ffmpeg encoder and decoder
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MSMPEG4 backend for ffmpeg encoder and decoder.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "msmpeg4.h"
-#include "libavutil/x86_cpu.h"
-#include "h263.h"
-#include "mpeg4video.h"
-
-/*
- * You can also call this codec : MPEG4 with a twist !
- *
- * TODO:
- *        - (encoding) select best mv table (two choices)
- *        - (encoding) select best vlc/dc table
- */
-//#define DEBUG
-
-#define DC_VLC_BITS 9
-#define V2_INTRA_CBPC_VLC_BITS 3
-#define V2_MB_TYPE_VLC_BITS 7
-#define MV_VLC_BITS 9
-#define V2_MV_VLC_BITS 9
-#define TEX_VLC_BITS 9
-
-#define II_BITRATE 128*1024
-#define MBAC_BITRATE 50*1024
-
-#define DEFAULT_INTER_INDEX 3
-
-static uint32_t v2_dc_lum_table[512][2];
-static uint32_t v2_dc_chroma_table[512][2];
-
-/* vc1 externs */
-extern const uint8_t wmv3_dc_scale_table[32];
-
-#ifdef DEBUG
-int frame_count = 0;
-#endif
-
-#include "msmpeg4data.h"
-
-#if CONFIG_ENCODERS //strangely gcc includes this even if it is not referenced
-static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2];
-#endif //CONFIG_ENCODERS
-
-static uint8_t static_rl_table_store[NB_RL_TABLES][2][2*MAX_RUN + MAX_LEVEL + 3];
-
-/* This table is practically identical to the one from h263
- * except that it is inverted. */
-static av_cold void init_h263_dc_for_msmpeg4(void)
-{
-        int level, uni_code, uni_len;
-
-        for(level=-256; level<256; level++){
-            int size, v, l;
-            /* find number of bits */
-            size = 0;
-            v = abs(level);
-            while (v) {
-                v >>= 1;
-                    size++;
-            }
-
-            if (level < 0)
-                l= (-level) ^ ((1 << size) - 1);
-            else
-                l= level;
-
-            /* luminance h263 */
-            uni_code= ff_mpeg4_DCtab_lum[size][0];
-            uni_len = ff_mpeg4_DCtab_lum[size][1];
-            uni_code ^= (1<<uni_len)-1; //M$ does not like compatibility
-
-            if (size > 0) {
-                uni_code<<=size; uni_code|=l;
-                uni_len+=size;
-                if (size > 8){
-                    uni_code<<=1; uni_code|=1;
-                    uni_len++;
-                }
-            }
-            v2_dc_lum_table[level+256][0]= uni_code;
-            v2_dc_lum_table[level+256][1]= uni_len;
-
-            /* chrominance h263 */
-            uni_code= ff_mpeg4_DCtab_chrom[size][0];
-            uni_len = ff_mpeg4_DCtab_chrom[size][1];
-            uni_code ^= (1<<uni_len)-1; //M$ does not like compatibility
-
-            if (size > 0) {
-                uni_code<<=size; uni_code|=l;
-                uni_len+=size;
-                if (size > 8){
-                    uni_code<<=1; uni_code|=1;
-                    uni_len++;
-                }
-            }
-            v2_dc_chroma_table[level+256][0]= uni_code;
-            v2_dc_chroma_table[level+256][1]= uni_len;
-
-        }
-}
-
-static av_cold void common_init(MpegEncContext * s)
-{
-    static int initialized=0;
-
-    switch(s->msmpeg4_version){
-    case 1:
-    case 2:
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-        break;
-    case 3:
-        if(s->workaround_bugs){
-            s->y_dc_scale_table= old_ff_y_dc_scale_table;
-            s->c_dc_scale_table= wmv1_c_dc_scale_table;
-        } else{
-            s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table;
-            s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table;
-        }
-        break;
-    case 4:
-    case 5:
-        s->y_dc_scale_table= wmv1_y_dc_scale_table;
-        s->c_dc_scale_table= wmv1_c_dc_scale_table;
-        break;
-#if CONFIG_VC1_DECODER
-    case 6:
-        s->y_dc_scale_table= wmv3_dc_scale_table;
-        s->c_dc_scale_table= wmv3_dc_scale_table;
-        break;
-#endif
-
-    }
-
-
-    if(s->msmpeg4_version>=4){
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , wmv1_scantable[1]);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, wmv1_scantable[2]);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, wmv1_scantable[3]);
-        ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , wmv1_scantable[0]);
-    }
-    //Note the default tables are set in common_init in mpegvideo.c
-
-    if(!initialized){
-        initialized=1;
-
-        init_h263_dc_for_msmpeg4();
-    }
-}
-
-#if CONFIG_ENCODERS
-
-/* build the table which associate a (x,y) motion vector to a vlc */
-static void init_mv_table(MVTable *tab)
-{
-    int i, x, y;
-
-    tab->table_mv_index = av_malloc(sizeof(uint16_t) * 4096);
-    /* mark all entries as not used */
-    for(i=0;i<4096;i++)
-        tab->table_mv_index[i] = tab->n;
-
-    for(i=0;i<tab->n;i++) {
-        x = tab->table_mvx[i];
-        y = tab->table_mvy[i];
-        tab->table_mv_index[(x << 6) | y] = i;
-    }
-}
-
-void ff_msmpeg4_code012(PutBitContext *pb, int n)
-{
-    if (n == 0) {
-        put_bits(pb, 1, 0);
-    } else {
-        put_bits(pb, 1, 1);
-        put_bits(pb, 1, (n >= 2));
-    }
-}
-
-static int get_size_of_code(MpegEncContext * s, RLTable *rl, int last, int run, int level, int intra){
-    int size=0;
-    int code;
-    int run_diff= intra ? 0 : 1;
-
-    code = get_rl_index(rl, last, run, level);
-    size+= rl->table_vlc[code][1];
-    if (code == rl->n) {
-        int level1, run1;
-
-        level1 = level - rl->max_level[last][run];
-        if (level1 < 1)
-            goto esc2;
-        code = get_rl_index(rl, last, run, level1);
-        if (code == rl->n) {
-            esc2:
-            size++;
-            if (level > MAX_LEVEL)
-                goto esc3;
-            run1 = run - rl->max_run[last][level] - run_diff;
-            if (run1 < 0)
-                goto esc3;
-            code = get_rl_index(rl, last, run1, level);
-            if (code == rl->n) {
-            esc3:
-                /* third escape */
-                size+=1+1+6+8;
-            } else {
-                /* second escape */
-                size+= 1+1+ rl->table_vlc[code][1];
-            }
-        } else {
-            /* first escape */
-            size+= 1+1+ rl->table_vlc[code][1];
-        }
-    } else {
-        size++;
-    }
-    return size;
-}
-
-av_cold void ff_msmpeg4_encode_init(MpegEncContext *s)
-{
-    static int init_done=0;
-    int i;
-
-    common_init(s);
-    if(s->msmpeg4_version>=4){
-        s->min_qcoeff= -255;
-        s->max_qcoeff=  255;
-    }
-
-    if (!init_done) {
-        /* init various encoding tables */
-        init_done = 1;
-        init_mv_table(&mv_tables[0]);
-        init_mv_table(&mv_tables[1]);
-        for(i=0;i<NB_RL_TABLES;i++)
-            init_rl(&rl_table[i], static_rl_table_store[i]);
-
-        for(i=0; i<NB_RL_TABLES; i++){
-            int level;
-            for(level=0; level<=MAX_LEVEL; level++){
-                int run;
-                for(run=0; run<=MAX_RUN; run++){
-                    int last;
-                    for(last=0; last<2; last++){
-                        rl_length[i][level][run][last]= get_size_of_code(s, &rl_table[  i], last, run, level, 0);
-                    }
-                }
-            }
-        }
-    }
-}
-
-static void find_best_tables(MpegEncContext * s)
-{
-    int i;
-    int best       =-1, best_size       =9999999;
-    int chroma_best=-1, best_chroma_size=9999999;
-
-    for(i=0; i<3; i++){
-        int level;
-        int chroma_size=0;
-        int size=0;
-
-        if(i>0){// ;)
-            size++;
-            chroma_size++;
-        }
-        for(level=0; level<=MAX_LEVEL; level++){
-            int run;
-            for(run=0; run<=MAX_RUN; run++){
-                int last;
-                const int last_size= size + chroma_size;
-                for(last=0; last<2; last++){
-                    int inter_count       = s->ac_stats[0][0][level][run][last] + s->ac_stats[0][1][level][run][last];
-                    int intra_luma_count  = s->ac_stats[1][0][level][run][last];
-                    int intra_chroma_count= s->ac_stats[1][1][level][run][last];
-
-                    if(s->pict_type==FF_I_TYPE){
-                        size       += intra_luma_count  *rl_length[i  ][level][run][last];
-                        chroma_size+= intra_chroma_count*rl_length[i+3][level][run][last];
-                    }else{
-                        size+=        intra_luma_count  *rl_length[i  ][level][run][last]
-                                     +intra_chroma_count*rl_length[i+3][level][run][last]
-                                     +inter_count       *rl_length[i+3][level][run][last];
-                    }
-                }
-                if(last_size == size+chroma_size) break;
-            }
-        }
-        if(size<best_size){
-            best_size= size;
-            best= i;
-        }
-        if(chroma_size<best_chroma_size){
-            best_chroma_size= chroma_size;
-            chroma_best= i;
-        }
-    }
-
-//    printf("type:%d, best:%d, qp:%d, var:%d, mcvar:%d, size:%d //\n",
-//           s->pict_type, best, s->qscale, s->mb_var_sum, s->mc_mb_var_sum, best_size);
-
-    if(s->pict_type==FF_P_TYPE) chroma_best= best;
-
-    memset(s->ac_stats, 0, sizeof(int)*(MAX_LEVEL+1)*(MAX_RUN+1)*2*2*2);
-
-    s->rl_table_index       =        best;
-    s->rl_chroma_table_index= chroma_best;
-
-    if(s->pict_type != s->last_non_b_pict_type){
-        s->rl_table_index= 2;
-        if(s->pict_type==FF_I_TYPE)
-            s->rl_chroma_table_index= 1;
-        else
-            s->rl_chroma_table_index= 2;
-    }
-
-}
-
-/* write MSMPEG4 compatible frame header */
-void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number)
-{
-    find_best_tables(s);
-
-    align_put_bits(&s->pb);
-    put_bits(&s->pb, 2, s->pict_type - 1);
-
-    put_bits(&s->pb, 5, s->qscale);
-    if(s->msmpeg4_version<=2){
-        s->rl_table_index = 2;
-        s->rl_chroma_table_index = 2;
-    }
-
-    s->dc_table_index = 1;
-    s->mv_table_index = 1; /* only if P frame */
-    s->use_skip_mb_code = 1; /* only if P frame */
-    s->per_mb_rl_table = 0;
-    if(s->msmpeg4_version==4)
-        s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE && s->pict_type==FF_P_TYPE);
-//printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height);
-
-    if (s->pict_type == FF_I_TYPE) {
-        s->slice_height= s->mb_height/1;
-        put_bits(&s->pb, 5, 0x16 + s->mb_height/s->slice_height);
-
-        if(s->msmpeg4_version==4){
-            msmpeg4_encode_ext_header(s);
-            if(s->bit_rate>MBAC_BITRATE)
-                put_bits(&s->pb, 1, s->per_mb_rl_table);
-        }
-
-        if(s->msmpeg4_version>2){
-            if(!s->per_mb_rl_table){
-                ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index);
-                ff_msmpeg4_code012(&s->pb, s->rl_table_index);
-            }
-
-            put_bits(&s->pb, 1, s->dc_table_index);
-        }
-    } else {
-        put_bits(&s->pb, 1, s->use_skip_mb_code);
-
-        if(s->msmpeg4_version==4 && s->bit_rate>MBAC_BITRATE)
-            put_bits(&s->pb, 1, s->per_mb_rl_table);
-
-        if(s->msmpeg4_version>2){
-            if(!s->per_mb_rl_table)
-                ff_msmpeg4_code012(&s->pb, s->rl_table_index);
-
-            put_bits(&s->pb, 1, s->dc_table_index);
-
-            put_bits(&s->pb, 1, s->mv_table_index);
-        }
-    }
-
-    s->esc3_level_length= 0;
-    s->esc3_run_length= 0;
-}
-
-void msmpeg4_encode_ext_header(MpegEncContext * s)
-{
-        put_bits(&s->pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29
-
-        put_bits(&s->pb, 11, FFMIN(s->bit_rate/1024, 2047));
-
-        if(s->msmpeg4_version>=3)
-            put_bits(&s->pb, 1, s->flipflop_rounding);
-        else
-            assert(s->flipflop_rounding==0);
-}
-
-#endif //CONFIG_ENCODERS
-
-/* predict coded block */
-int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
-{
-    int xy, wrap, pred, a, b, c;
-
-    xy = s->block_index[n];
-    wrap = s->b8_stride;
-
-    /* B C
-     * A X
-     */
-    a = s->coded_block[xy - 1       ];
-    b = s->coded_block[xy - 1 - wrap];
-    c = s->coded_block[xy     - wrap];
-
-    if (b == c) {
-        pred = a;
-    } else {
-        pred = c;
-    }
-
-    /* store value */
-    *coded_block_ptr = &s->coded_block[xy];
-
-    return pred;
-}
-
-#if CONFIG_ENCODERS
-
-void ff_msmpeg4_encode_motion(MpegEncContext * s,
-                                  int mx, int my)
-{
-    int code;
-    MVTable *mv;
-
-    /* modulo encoding */
-    /* WARNING : you cannot reach all the MVs even with the modulo
-       encoding. This is a somewhat strange compromise they took !!!  */
-    if (mx <= -64)
-        mx += 64;
-    else if (mx >= 64)
-        mx -= 64;
-    if (my <= -64)
-        my += 64;
-    else if (my >= 64)
-        my -= 64;
-
-    mx += 32;
-    my += 32;
-#if 0
-    if ((unsigned)mx >= 64 ||
-        (unsigned)my >= 64)
-        av_log(s->avctx, AV_LOG_ERROR, "error mx=%d my=%d\n", mx, my);
-#endif
-    mv = &mv_tables[s->mv_table_index];
-
-    code = mv->table_mv_index[(mx << 6) | my];
-    put_bits(&s->pb,
-             mv->table_mv_bits[code],
-             mv->table_mv_code[code]);
-    if (code == mv->n) {
-        /* escape : code literally */
-        put_bits(&s->pb, 6, mx);
-        put_bits(&s->pb, 6, my);
-    }
-}
-
-void ff_msmpeg4_handle_slices(MpegEncContext *s){
-    if (s->mb_x == 0) {
-        if (s->slice_height && (s->mb_y % s->slice_height) == 0) {
-            if(s->msmpeg4_version < 4){
-                ff_mpeg4_clean_buffers(s);
-            }
-            s->first_slice_line = 1;
-        } else {
-            s->first_slice_line = 0;
-        }
-    }
-}
-
-static void msmpeg4v2_encode_motion(MpegEncContext * s, int val)
-{
-    int range, bit_size, sign, code, bits;
-
-    if (val == 0) {
-        /* zero vector */
-        code = 0;
-        put_bits(&s->pb, mvtab[code][1], mvtab[code][0]);
-    } else {
-        bit_size = s->f_code - 1;
-        range = 1 << bit_size;
-        if (val <= -64)
-            val += 64;
-        else if (val >= 64)
-            val -= 64;
-
-        if (val >= 0) {
-            sign = 0;
-        } else {
-            val = -val;
-            sign = 1;
-        }
-        val--;
-        code = (val >> bit_size) + 1;
-        bits = val & (range - 1);
-
-        put_bits(&s->pb, mvtab[code][1] + 1, (mvtab[code][0] << 1) | sign);
-        if (bit_size > 0) {
-            put_bits(&s->pb, bit_size, bits);
-        }
-    }
-}
-
-void msmpeg4_encode_mb(MpegEncContext * s,
-                       DCTELEM block[6][64],
-                       int motion_x, int motion_y)
-{
-    int cbp, coded_cbp, i;
-    int pred_x, pred_y;
-    uint8_t *coded_block;
-
-    ff_msmpeg4_handle_slices(s);
-
-    if (!s->mb_intra) {
-        /* compute cbp */
-        cbp = 0;
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0)
-                cbp |= 1 << (5 - i);
-        }
-        if (s->use_skip_mb_code && (cbp | motion_x | motion_y) == 0) {
-            /* skip macroblock */
-            put_bits(&s->pb, 1, 1);
-            s->last_bits++;
-            s->misc_bits++;
-            s->skip_count++;
-
-            return;
-        }
-        if (s->use_skip_mb_code)
-            put_bits(&s->pb, 1, 0);     /* mb coded */
-
-        if(s->msmpeg4_version<=2){
-            put_bits(&s->pb,
-                     v2_mb_type[cbp&3][1],
-                     v2_mb_type[cbp&3][0]);
-            if((cbp&3) != 3) coded_cbp= cbp ^ 0x3C;
-            else             coded_cbp= cbp;
-
-            put_bits(&s->pb,
-                     ff_h263_cbpy_tab[coded_cbp>>2][1],
-                     ff_h263_cbpy_tab[coded_cbp>>2][0]);
-
-            s->misc_bits += get_bits_diff(s);
-
-            h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-            msmpeg4v2_encode_motion(s, motion_x - pred_x);
-            msmpeg4v2_encode_motion(s, motion_y - pred_y);
-        }else{
-            put_bits(&s->pb,
-                     table_mb_non_intra[cbp + 64][1],
-                     table_mb_non_intra[cbp + 64][0]);
-
-            s->misc_bits += get_bits_diff(s);
-
-            /* motion vector */
-            h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-            ff_msmpeg4_encode_motion(s, motion_x - pred_x,
-                                  motion_y - pred_y);
-        }
-
-        s->mv_bits += get_bits_diff(s);
-
-        for (i = 0; i < 6; i++) {
-            ff_msmpeg4_encode_block(s, block[i], i);
-        }
-        s->p_tex_bits += get_bits_diff(s);
-    } else {
-        /* compute cbp */
-        cbp = 0;
-        coded_cbp = 0;
-        for (i = 0; i < 6; i++) {
-            int val, pred;
-            val = (s->block_last_index[i] >= 1);
-            cbp |= val << (5 - i);
-            if (i < 4) {
-                /* predict value for close blocks only for luma */
-                pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block);
-                *coded_block = val;
-                val = val ^ pred;
-            }
-            coded_cbp |= val << (5 - i);
-        }
-#if 0
-        if (coded_cbp)
-            printf("cbp=%x %x\n", cbp, coded_cbp);
-#endif
-
-        if(s->msmpeg4_version<=2){
-            if (s->pict_type == FF_I_TYPE) {
-                put_bits(&s->pb,
-                         v2_intra_cbpc[cbp&3][1], v2_intra_cbpc[cbp&3][0]);
-            } else {
-                if (s->use_skip_mb_code)
-                    put_bits(&s->pb, 1, 0);     /* mb coded */
-                put_bits(&s->pb,
-                         v2_mb_type[(cbp&3) + 4][1],
-                         v2_mb_type[(cbp&3) + 4][0]);
-            }
-            put_bits(&s->pb, 1, 0);             /* no AC prediction yet */
-            put_bits(&s->pb,
-                     ff_h263_cbpy_tab[cbp>>2][1],
-                     ff_h263_cbpy_tab[cbp>>2][0]);
-        }else{
-            if (s->pict_type == FF_I_TYPE) {
-                put_bits(&s->pb,
-                         ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]);
-            } else {
-                if (s->use_skip_mb_code)
-                    put_bits(&s->pb, 1, 0);     /* mb coded */
-                put_bits(&s->pb,
-                         table_mb_non_intra[cbp][1],
-                         table_mb_non_intra[cbp][0]);
-            }
-            put_bits(&s->pb, 1, 0);             /* no AC prediction yet */
-            if(s->inter_intra_pred){
-                s->h263_aic_dir=0;
-                put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]);
-            }
-        }
-        s->misc_bits += get_bits_diff(s);
-
-        for (i = 0; i < 6; i++) {
-            ff_msmpeg4_encode_block(s, block[i], i);
-        }
-        s->i_tex_bits += get_bits_diff(s);
-        s->i_count++;
-    }
-}
-
-#endif //CONFIG_ENCODERS
-
-static inline int msmpeg4v1_pred_dc(MpegEncContext * s, int n,
-                                    int32_t **dc_val_ptr)
-{
-    int i;
-
-    if (n < 4) {
-        i= 0;
-    } else {
-        i= n-3;
-    }
-
-    *dc_val_ptr= &s->last_dc[i];
-    return s->last_dc[i];
-}
-
-static int get_dc(uint8_t *src, int stride, int scale)
-{
-    int y;
-    int sum=0;
-    for(y=0; y<8; y++){
-        int x;
-        for(x=0; x<8; x++){
-            sum+=src[x + y*stride];
-        }
-    }
-    return FASTDIV((sum + (scale>>1)), scale);
-}
-
-/* dir = 0: left, dir = 1: top prediction */
-static inline int msmpeg4_pred_dc(MpegEncContext * s, int n,
-                             int16_t **dc_val_ptr, int *dir_ptr)
-{
-    int a, b, c, wrap, pred, scale;
-    int16_t *dc_val;
-
-    /* find prediction */
-    if (n < 4) {
-        scale = s->y_dc_scale;
-    } else {
-        scale = s->c_dc_scale;
-    }
-
-    wrap = s->block_wrap[n];
-    dc_val= s->dc_val[0] + s->block_index[n];
-
-    /* B C
-     * A X
-     */
-    a = dc_val[ - 1];
-    b = dc_val[ - 1 - wrap];
-    c = dc_val[ - wrap];
-
-    if(s->first_slice_line && (n&2)==0 && s->msmpeg4_version<4){
-        b=c=1024;
-    }
-
-    /* XXX: the following solution consumes divisions, but it does not
-       necessitate to modify mpegvideo.c. The problem comes from the
-       fact they decided to store the quantized DC (which would lead
-       to problems if Q could vary !) */
-#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE
-    __asm__ volatile(
-        "movl %3, %%eax         \n\t"
-        "shrl $1, %%eax         \n\t"
-        "addl %%eax, %2         \n\t"
-        "addl %%eax, %1         \n\t"
-        "addl %0, %%eax         \n\t"
-        "mull %4                \n\t"
-        "movl %%edx, %0         \n\t"
-        "movl %1, %%eax         \n\t"
-        "mull %4                \n\t"
-        "movl %%edx, %1         \n\t"
-        "movl %2, %%eax         \n\t"
-        "mull %4                \n\t"
-        "movl %%edx, %2         \n\t"
-        : "+b" (a), "+c" (b), "+D" (c)
-        : "g" (scale), "S" (ff_inverse[scale])
-        : "%eax", "%edx"
-    );
-#else
-    /* #elif ARCH_ALPHA */
-    /* Divisions are extremely costly on Alpha; optimize the most
-       common case. But they are costly everywhere...
-     */
-    if (scale == 8) {
-        a = (a + (8 >> 1)) / 8;
-        b = (b + (8 >> 1)) / 8;
-        c = (c + (8 >> 1)) / 8;
-    } else {
-        a = FASTDIV((a + (scale >> 1)), scale);
-        b = FASTDIV((b + (scale >> 1)), scale);
-        c = FASTDIV((c + (scale >> 1)), scale);
-    }
-#endif
-    /* XXX: WARNING: they did not choose the same test as MPEG4. This
-       is very important ! */
-    if(s->msmpeg4_version>3){
-        if(s->inter_intra_pred){
-            uint8_t *dest;
-            int wrap;
-
-            if(n==1){
-                pred=a;
-                *dir_ptr = 0;
-            }else if(n==2){
-                pred=c;
-                *dir_ptr = 1;
-            }else if(n==3){
-                if (abs(a - b) < abs(b - c)) {
-                    pred = c;
-                    *dir_ptr = 1;
-                } else {
-                    pred = a;
-                    *dir_ptr = 0;
-                }
-            }else{
-                if(n<4){
-                    wrap= s->linesize;
-                    dest= s->current_picture.data[0] + (((n>>1) + 2*s->mb_y) * 8*  wrap ) + ((n&1) + 2*s->mb_x) * 8;
-                }else{
-                    wrap= s->uvlinesize;
-                    dest= s->current_picture.data[n-3] + (s->mb_y * 8 * wrap) + s->mb_x * 8;
-                }
-                if(s->mb_x==0) a= (1024 + (scale>>1))/scale;
-                else           a= get_dc(dest-8, wrap, scale*8);
-                if(s->mb_y==0) c= (1024 + (scale>>1))/scale;
-                else           c= get_dc(dest-8*wrap, wrap, scale*8);
-
-                if (s->h263_aic_dir==0) {
-                    pred= a;
-                    *dir_ptr = 0;
-                }else if (s->h263_aic_dir==1) {
-                    if(n==0){
-                        pred= c;
-                        *dir_ptr = 1;
-                    }else{
-                        pred= a;
-                        *dir_ptr = 0;
-                    }
-                }else if (s->h263_aic_dir==2) {
-                    if(n==0){
-                        pred= a;
-                        *dir_ptr = 0;
-                    }else{
-                        pred= c;
-                        *dir_ptr = 1;
-                    }
-                } else {
-                    pred= c;
-                    *dir_ptr = 1;
-                }
-            }
-        }else{
-            if (abs(a - b) < abs(b - c)) {
-                pred = c;
-                *dir_ptr = 1;
-            } else {
-                pred = a;
-                *dir_ptr = 0;
-            }
-        }
-    }else{
-        if (abs(a - b) <= abs(b - c)) {
-            pred = c;
-            *dir_ptr = 1;
-        } else {
-            pred = a;
-            *dir_ptr = 0;
-        }
-    }
-
-    /* update predictor */
-    *dc_val_ptr = &dc_val[0];
-    return pred;
-}
-
-#define DC_MAX 119
-
-static void msmpeg4_encode_dc(MpegEncContext * s, int level, int n, int *dir_ptr)
-{
-    int sign, code;
-    int pred, extquant;
-    int extrabits = 0;
-
-    if(s->msmpeg4_version==1){
-        int32_t *dc_val;
-        pred = msmpeg4v1_pred_dc(s, n, &dc_val);
-
-        /* update predictor */
-        *dc_val= level;
-    }else{
-        int16_t *dc_val;
-        pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
-
-        /* update predictor */
-        if (n < 4) {
-            *dc_val = level * s->y_dc_scale;
-        } else {
-            *dc_val = level * s->c_dc_scale;
-        }
-    }
-
-    /* do the prediction */
-    level -= pred;
-
-    if(s->msmpeg4_version<=2){
-        if (n < 4) {
-            put_bits(&s->pb,
-                     v2_dc_lum_table[level+256][1],
-                     v2_dc_lum_table[level+256][0]);
-        }else{
-            put_bits(&s->pb,
-                     v2_dc_chroma_table[level+256][1],
-                     v2_dc_chroma_table[level+256][0]);
-        }
-    }else{
-        sign = 0;
-        if (level < 0) {
-            level = -level;
-            sign = 1;
-        }
-        code = level;
-        if (code > DC_MAX)
-            code = DC_MAX;
-        else if( s->msmpeg4_version>=6 ) {
-            if( s->qscale == 1 ) {
-                extquant = (level + 3) & 0x3;
-                code  = ((level+3)>>2);
-            } else if( s->qscale == 2 ) {
-                extquant = (level + 1) & 0x1;
-                code  = ((level+1)>>1);
-            }
-        }
-
-        if (s->dc_table_index == 0) {
-            if (n < 4) {
-                put_bits(&s->pb, ff_table0_dc_lum[code][1], ff_table0_dc_lum[code][0]);
-            } else {
-                put_bits(&s->pb, ff_table0_dc_chroma[code][1], ff_table0_dc_chroma[code][0]);
-            }
-        } else {
-            if (n < 4) {
-                put_bits(&s->pb, ff_table1_dc_lum[code][1], ff_table1_dc_lum[code][0]);
-            } else {
-                put_bits(&s->pb, ff_table1_dc_chroma[code][1], ff_table1_dc_chroma[code][0]);
-            }
-        }
-
-        if(s->msmpeg4_version>=6 && s->qscale<=2)
-            extrabits = 3 - s->qscale;
-
-        if (code == DC_MAX)
-            put_bits(&s->pb, 8 + extrabits, level);
-        else if(extrabits > 0)//== VC1 && s->qscale<=2
-            put_bits(&s->pb, extrabits, extquant);
-
-        if (level != 0) {
-            put_bits(&s->pb, 1, sign);
-        }
-    }
-}
-
-/* Encoding of a block. Very similar to MPEG4 except for a different
-   escape coding (same as H263) and more vlc tables.
- */
-void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n)
-{
-    int level, run, last, i, j, last_index;
-    int last_non_zero, sign, slevel;
-    int code, run_diff, dc_pred_dir;
-    const RLTable *rl;
-    const uint8_t *scantable;
-
-    if (s->mb_intra) {
-        msmpeg4_encode_dc(s, block[0], n, &dc_pred_dir);
-        i = 1;
-        if (n < 4) {
-            rl = &rl_table[s->rl_table_index];
-        } else {
-            rl = &rl_table[3 + s->rl_chroma_table_index];
-        }
-        run_diff = s->msmpeg4_version>=4;
-        scantable= s->intra_scantable.permutated;
-    } else {
-        i = 0;
-        rl = &rl_table[3 + s->rl_table_index];
-        if(s->msmpeg4_version<=2)
-            run_diff = 0;
-        else
-            run_diff = 1;
-        scantable= s->inter_scantable.permutated;
-    }
-
-    /* recalculate block_last_index for M$ wmv1 */
-    if(s->msmpeg4_version>=4 && s->msmpeg4_version<6 && s->block_last_index[n]>0){
-        for(last_index=63; last_index>=0; last_index--){
-            if(block[scantable[last_index]]) break;
-        }
-        s->block_last_index[n]= last_index;
-    }else
-        last_index = s->block_last_index[n];
-    /* AC coefs */
-    last_non_zero = i - 1;
-    for (; i <= last_index; i++) {
-        j = scantable[i];
-        level = block[j];
-        if (level) {
-            run = i - last_non_zero - 1;
-            last = (i == last_index);
-            sign = 0;
-            slevel = level;
-            if (level < 0) {
-                sign = 1;
-                level = -level;
-            }
-
-            if(level<=MAX_LEVEL && run<=MAX_RUN){
-                s->ac_stats[s->mb_intra][n>3][level][run][last]++;
-            }
-#if 0
-else
-    s->ac_stats[s->mb_intra][n>3][40][63][0]++; //esc3 like
-#endif
-            code = get_rl_index(rl, last, run, level);
-            put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-            if (code == rl->n) {
-                int level1, run1;
-
-                level1 = level - rl->max_level[last][run];
-                if (level1 < 1)
-                    goto esc2;
-                code = get_rl_index(rl, last, run, level1);
-                if (code == rl->n) {
-                esc2:
-                    put_bits(&s->pb, 1, 0);
-                    if (level > MAX_LEVEL)
-                        goto esc3;
-                    run1 = run - rl->max_run[last][level] - run_diff;
-                    if (run1 < 0)
-                        goto esc3;
-                    code = get_rl_index(rl, last, run1+1, level);
-                    if (s->msmpeg4_version == 4 && code == rl->n)
-                        goto esc3;
-                    code = get_rl_index(rl, last, run1, level);
-                    if (code == rl->n) {
-                    esc3:
-                        /* third escape */
-                        put_bits(&s->pb, 1, 0);
-                        put_bits(&s->pb, 1, last);
-                        if(s->msmpeg4_version>=4){
-                            if(s->esc3_level_length==0){
-                                s->esc3_level_length=8;
-                                s->esc3_run_length= 6;
-                                //ESCLVLSZ + ESCRUNSZ
-                                if(s->qscale<8)
-                                    put_bits(&s->pb, 6 + (s->msmpeg4_version>=6), 3);
-                                else
-                                    put_bits(&s->pb, 8, 3);
-                            }
-                            put_bits(&s->pb, s->esc3_run_length, run);
-                            put_bits(&s->pb, 1, sign);
-                            put_bits(&s->pb, s->esc3_level_length, level);
-                        }else{
-                            put_bits(&s->pb, 6, run);
-                            put_sbits(&s->pb, 8, slevel);
-                        }
-                    } else {
-                        /* second escape */
-                        put_bits(&s->pb, 1, 1);
-                        put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-                        put_bits(&s->pb, 1, sign);
-                    }
-                } else {
-                    /* first escape */
-                    put_bits(&s->pb, 1, 1);
-                    put_bits(&s->pb, rl->table_vlc[code][1], rl->table_vlc[code][0]);
-                    put_bits(&s->pb, 1, sign);
-                }
-            } else {
-                put_bits(&s->pb, 1, sign);
-            }
-            last_non_zero = i;
-        }
-    }
-}
-
-/****************************************/
-/* decoding stuff */
-
-VLC ff_mb_non_intra_vlc[4];
-static VLC v2_dc_lum_vlc;
-static VLC v2_dc_chroma_vlc;
-static VLC v2_intra_cbpc_vlc;
-static VLC v2_mb_type_vlc;
-static VLC v2_mv_vlc;
-VLC ff_inter_intra_vlc;
-
-/* This is identical to h263 except that its range is multiplied by 2. */
-static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
-{
-    int code, val, sign, shift;
-
-    code = get_vlc2(&s->gb, v2_mv_vlc.table, V2_MV_VLC_BITS, 2);
-//     printf("MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred);
-    if (code < 0)
-        return 0xffff;
-
-    if (code == 0)
-        return pred;
-    sign = get_bits1(&s->gb);
-    shift = f_code - 1;
-    val = code;
-    if (shift) {
-        val = (val - 1) << shift;
-        val |= get_bits(&s->gb, shift);
-        val++;
-    }
-    if (sign)
-        val = -val;
-
-    val += pred;
-    if (val <= -64)
-        val += 64;
-    else if (val >= 64)
-        val -= 64;
-
-    return val;
-}
-
-static int msmpeg4v12_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
-{
-    int cbp, code, i;
-
-    if (s->pict_type == FF_P_TYPE) {
-        if (s->use_skip_mb_code) {
-            if (get_bits1(&s->gb)) {
-                /* skip mb */
-                s->mb_intra = 0;
-                for(i=0;i<6;i++)
-                    s->block_last_index[i] = -1;
-                s->mv_dir = MV_DIR_FORWARD;
-                s->mv_type = MV_TYPE_16X16;
-                s->mv[0][0][0] = 0;
-                s->mv[0][0][1] = 0;
-                s->mb_skipped = 1;
-                return 0;
-            }
-        }
-
-        if(s->msmpeg4_version==2)
-            code = get_vlc2(&s->gb, v2_mb_type_vlc.table, V2_MB_TYPE_VLC_BITS, 1);
-        else
-            code = get_vlc2(&s->gb, ff_h263_inter_MCBPC_vlc.table, INTER_MCBPC_VLC_BITS, 2);
-        if(code<0 || code>7){
-            av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", code, s->mb_x, s->mb_y);
-            return -1;
-        }
-
-        s->mb_intra = code >>2;
-
-        cbp = code & 0x3;
-    } else {
-        s->mb_intra = 1;
-        if(s->msmpeg4_version==2)
-            cbp= get_vlc2(&s->gb, v2_intra_cbpc_vlc.table, V2_INTRA_CBPC_VLC_BITS, 1);
-        else
-            cbp= get_vlc2(&s->gb, ff_h263_intra_MCBPC_vlc.table, INTRA_MCBPC_VLC_BITS, 1);
-        if(cbp<0 || cbp>3){
-            av_log(s->avctx, AV_LOG_ERROR, "cbpc %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
-            return -1;
-        }
-    }
-
-    if (!s->mb_intra) {
-        int mx, my, cbpy;
-
-        cbpy= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1);
-        if(cbpy<0){
-            av_log(s->avctx, AV_LOG_ERROR, "cbpy %d invalid at %d %d\n", cbp, s->mb_x, s->mb_y);
-            return -1;
-        }
-
-        cbp|= cbpy<<2;
-        if(s->msmpeg4_version==1 || (cbp&3) != 3) cbp^= 0x3C;
-
-        h263_pred_motion(s, 0, 0, &mx, &my);
-        mx= msmpeg4v2_decode_motion(s, mx, 1);
-        my= msmpeg4v2_decode_motion(s, my, 1);
-
-        s->mv_dir = MV_DIR_FORWARD;
-        s->mv_type = MV_TYPE_16X16;
-        s->mv[0][0][0] = mx;
-        s->mv[0][0][1] = my;
-    } else {
-        if(s->msmpeg4_version==2){
-            s->ac_pred = get_bits1(&s->gb);
-            cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
-        } else{
-            s->ac_pred = 0;
-            cbp|= get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1)<<2; //FIXME check errors
-            if(s->pict_type==FF_P_TYPE) cbp^=0x3C;
-        }
-    }
-
-    s->dsp.clear_blocks(s->block[0]);
-    for (i = 0; i < 6; i++) {
-        if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
-        {
-             av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
-             return -1;
-        }
-    }
-    return 0;
-}
-
-static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
-{
-    int cbp, code, i;
-    uint8_t *coded_val;
-    uint32_t * const mb_type_ptr= &s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ];
-
-    if (s->pict_type == FF_P_TYPE) {
-        if (s->use_skip_mb_code) {
-            if (get_bits1(&s->gb)) {
-                /* skip mb */
-                s->mb_intra = 0;
-                for(i=0;i<6;i++)
-                    s->block_last_index[i] = -1;
-                s->mv_dir = MV_DIR_FORWARD;
-                s->mv_type = MV_TYPE_16X16;
-                s->mv[0][0][0] = 0;
-                s->mv[0][0][1] = 0;
-                s->mb_skipped = 1;
-                *mb_type_ptr = MB_TYPE_SKIP | MB_TYPE_L0 | MB_TYPE_16x16;
-
-                return 0;
-            }
-        }
-
-        code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[DEFAULT_INTER_INDEX].table, MB_NON_INTRA_VLC_BITS, 3);
-        if (code < 0)
-            return -1;
-        //s->mb_intra = (code & 0x40) ? 0 : 1;
-        s->mb_intra = (~code & 0x40) >> 6;
-
-        cbp = code & 0x3f;
-    } else {
-        s->mb_intra = 1;
-        code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
-        if (code < 0)
-            return -1;
-        /* predict coded block pattern */
-        cbp = 0;
-        for(i=0;i<6;i++) {
-            int val = ((code >> (5 - i)) & 1);
-            if (i < 4) {
-                int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
-                val = val ^ pred;
-                *coded_val = val;
-            }
-            cbp |= val << (5 - i);
-        }
-    }
-
-    if (!s->mb_intra) {
-        int mx, my;
-//printf("P at %d %d\n", s->mb_x, s->mb_y);
-        if(s->per_mb_rl_table && cbp){
-            s->rl_table_index = decode012(&s->gb);
-            s->rl_chroma_table_index = s->rl_table_index;
-        }
-        h263_pred_motion(s, 0, 0, &mx, &my);
-        if (ff_msmpeg4_decode_motion(s, &mx, &my) < 0)
-            return -1;
-        s->mv_dir = MV_DIR_FORWARD;
-        s->mv_type = MV_TYPE_16X16;
-        s->mv[0][0][0] = mx;
-        s->mv[0][0][1] = my;
-        *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16;
-    } else {
-//printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24));
-        s->ac_pred = get_bits1(&s->gb);
-        *mb_type_ptr = MB_TYPE_INTRA;
-        if(s->inter_intra_pred){
-            s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
-//            printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
-        }
-        if(s->per_mb_rl_table && cbp){
-            s->rl_table_index = decode012(&s->gb);
-            s->rl_chroma_table_index = s->rl_table_index;
-        }
-    }
-
-    s->dsp.clear_blocks(s->block[0]);
-    for (i = 0; i < 6; i++) {
-        if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
-        {
-            av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
-            return -1;
-        }
-    }
-
-    return 0;
-}
-
-/* init all vlc decoding tables */
-av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    static int done = 0;
-    int i;
-    MVTable *mv;
-
-    ff_h263_decode_init(avctx);
-
-    common_init(s);
-
-    if (!done) {
-        done = 1;
-
-        for(i=0;i<NB_RL_TABLES;i++) {
-            init_rl(&rl_table[i], static_rl_table_store[i]);
-        }
-        INIT_VLC_RL(rl_table[0], 642);
-        INIT_VLC_RL(rl_table[1], 1104);
-        INIT_VLC_RL(rl_table[2], 554);
-        INIT_VLC_RL(rl_table[3], 940);
-        INIT_VLC_RL(rl_table[4], 962);
-        INIT_VLC_RL(rl_table[5], 554);
-
-        mv = &mv_tables[0];
-        INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, mv->n + 1,
-                    mv->table_mv_bits, 1, 1,
-                    mv->table_mv_code, 2, 2, 3714);
-        mv = &mv_tables[1];
-        INIT_VLC_STATIC(&mv->vlc, MV_VLC_BITS, mv->n + 1,
-                    mv->table_mv_bits, 1, 1,
-                    mv->table_mv_code, 2, 2, 2694);
-
-        INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[0], DC_VLC_BITS, 120,
-                 &ff_table0_dc_lum[0][1], 8, 4,
-                 &ff_table0_dc_lum[0][0], 8, 4, 1158);
-        INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[0], DC_VLC_BITS, 120,
-                 &ff_table0_dc_chroma[0][1], 8, 4,
-                 &ff_table0_dc_chroma[0][0], 8, 4, 1118);
-        INIT_VLC_STATIC(&ff_msmp4_dc_luma_vlc[1], DC_VLC_BITS, 120,
-                 &ff_table1_dc_lum[0][1], 8, 4,
-                 &ff_table1_dc_lum[0][0], 8, 4, 1476);
-        INIT_VLC_STATIC(&ff_msmp4_dc_chroma_vlc[1], DC_VLC_BITS, 120,
-                 &ff_table1_dc_chroma[0][1], 8, 4,
-                 &ff_table1_dc_chroma[0][0], 8, 4, 1216);
-
-        INIT_VLC_STATIC(&v2_dc_lum_vlc, DC_VLC_BITS, 512,
-                 &v2_dc_lum_table[0][1], 8, 4,
-                 &v2_dc_lum_table[0][0], 8, 4, 1472);
-        INIT_VLC_STATIC(&v2_dc_chroma_vlc, DC_VLC_BITS, 512,
-                 &v2_dc_chroma_table[0][1], 8, 4,
-                 &v2_dc_chroma_table[0][0], 8, 4, 1506);
-
-        INIT_VLC_STATIC(&v2_intra_cbpc_vlc, V2_INTRA_CBPC_VLC_BITS, 4,
-                 &v2_intra_cbpc[0][1], 2, 1,
-                 &v2_intra_cbpc[0][0], 2, 1, 8);
-        INIT_VLC_STATIC(&v2_mb_type_vlc, V2_MB_TYPE_VLC_BITS, 8,
-                 &v2_mb_type[0][1], 2, 1,
-                 &v2_mb_type[0][0], 2, 1, 128);
-        INIT_VLC_STATIC(&v2_mv_vlc, V2_MV_VLC_BITS, 33,
-                 &mvtab[0][1], 2, 1,
-                 &mvtab[0][0], 2, 1, 538);
-
-        INIT_VLC_STATIC(&ff_mb_non_intra_vlc[0], MB_NON_INTRA_VLC_BITS, 128,
-                     &wmv2_inter_table[0][0][1], 8, 4,
-                     &wmv2_inter_table[0][0][0], 8, 4, 1636);
-        INIT_VLC_STATIC(&ff_mb_non_intra_vlc[1], MB_NON_INTRA_VLC_BITS, 128,
-                     &wmv2_inter_table[1][0][1], 8, 4,
-                     &wmv2_inter_table[1][0][0], 8, 4, 2648);
-        INIT_VLC_STATIC(&ff_mb_non_intra_vlc[2], MB_NON_INTRA_VLC_BITS, 128,
-                     &wmv2_inter_table[2][0][1], 8, 4,
-                     &wmv2_inter_table[2][0][0], 8, 4, 1532);
-        INIT_VLC_STATIC(&ff_mb_non_intra_vlc[3], MB_NON_INTRA_VLC_BITS, 128,
-                     &wmv2_inter_table[3][0][1], 8, 4,
-                     &wmv2_inter_table[3][0][0], 8, 4, 2488);
-
-        INIT_VLC_STATIC(&ff_msmp4_mb_i_vlc, MB_INTRA_VLC_BITS, 64,
-                 &ff_msmp4_mb_i_table[0][1], 4, 2,
-                 &ff_msmp4_mb_i_table[0][0], 4, 2, 536);
-
-        INIT_VLC_STATIC(&ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 4,
-                 &table_inter_intra[0][1], 2, 1,
-                 &table_inter_intra[0][0], 2, 1, 8);
-    }
-
-    switch(s->msmpeg4_version){
-    case 1:
-    case 2:
-        s->decode_mb= msmpeg4v12_decode_mb;
-        break;
-    case 3:
-    case 4:
-        s->decode_mb= msmpeg4v34_decode_mb;
-        break;
-    case 5:
-        if (CONFIG_WMV2_DECODER)
-            s->decode_mb= ff_wmv2_decode_mb;
-    case 6:
-        //FIXME + TODO VC1 decode mb
-        break;
-    }
-
-    s->slice_height= s->mb_height; //to avoid 1/0 if the first frame is not a keyframe
-
-    return 0;
-}
-
-int msmpeg4_decode_picture_header(MpegEncContext * s)
-{
-    int code;
-
-#if 0
-{
-int i;
-for(i=0; i<s->gb.size_in_bits; i++)
-    av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
-//    get_bits1(&s->gb);
-av_log(s->avctx, AV_LOG_DEBUG, "END\n");
-return -1;
-}
-#endif
-
-    if(s->msmpeg4_version==1){
-        int start_code;
-        start_code = (get_bits(&s->gb, 16)<<16) | get_bits(&s->gb, 16);
-        if(start_code!=0x00000100){
-            av_log(s->avctx, AV_LOG_ERROR, "invalid startcode\n");
-            return -1;
-        }
-
-        skip_bits(&s->gb, 5); // frame number */
-    }
-
-    s->pict_type = get_bits(&s->gb, 2) + 1;
-    if (s->pict_type != FF_I_TYPE &&
-        s->pict_type != FF_P_TYPE){
-        av_log(s->avctx, AV_LOG_ERROR, "invalid picture type\n");
-        return -1;
-    }
-#if 0
-{
-    static int had_i=0;
-    if(s->pict_type == FF_I_TYPE) had_i=1;
-    if(!had_i) return -1;
-}
-#endif
-    s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
-    if(s->qscale==0){
-        av_log(s->avctx, AV_LOG_ERROR, "invalid qscale\n");
-        return -1;
-    }
-
-    if (s->pict_type == FF_I_TYPE) {
-        code = get_bits(&s->gb, 5);
-        if(s->msmpeg4_version==1){
-            if(code==0 || code>s->mb_height){
-                av_log(s->avctx, AV_LOG_ERROR, "invalid slice height %d\n", code);
-                return -1;
-            }
-
-            s->slice_height = code;
-        }else{
-            /* 0x17: one slice, 0x18: two slices, ... */
-            if (code < 0x17){
-                av_log(s->avctx, AV_LOG_ERROR, "error, slice code was %X\n", code);
-                return -1;
-            }
-
-            s->slice_height = s->mb_height / (code - 0x16);
-        }
-
-        switch(s->msmpeg4_version){
-        case 1:
-        case 2:
-            s->rl_chroma_table_index = 2;
-            s->rl_table_index = 2;
-
-            s->dc_table_index = 0; //not used
-            break;
-        case 3:
-            s->rl_chroma_table_index = decode012(&s->gb);
-            s->rl_table_index = decode012(&s->gb);
-
-            s->dc_table_index = get_bits1(&s->gb);
-            break;
-        case 4:
-            msmpeg4_decode_ext_header(s, (2+5+5+17+7)/8);
-
-            if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
-            else                           s->per_mb_rl_table= 0;
-
-            if(!s->per_mb_rl_table){
-                s->rl_chroma_table_index = decode012(&s->gb);
-                s->rl_table_index = decode012(&s->gb);
-            }
-
-            s->dc_table_index = get_bits1(&s->gb);
-            s->inter_intra_pred= 0;
-            break;
-        }
-        s->no_rounding = 1;
-        if(s->avctx->debug&FF_DEBUG_PICT_INFO)
-            av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d slice:%d   \n",
-                s->qscale,
-                s->rl_chroma_table_index,
-                s->rl_table_index,
-                s->dc_table_index,
-                s->per_mb_rl_table,
-                s->slice_height);
-    } else {
-        switch(s->msmpeg4_version){
-        case 1:
-        case 2:
-            if(s->msmpeg4_version==1)
-                s->use_skip_mb_code = 1;
-            else
-                s->use_skip_mb_code = get_bits1(&s->gb);
-            s->rl_table_index = 2;
-            s->rl_chroma_table_index = s->rl_table_index;
-            s->dc_table_index = 0; //not used
-            s->mv_table_index = 0;
-            break;
-        case 3:
-            s->use_skip_mb_code = get_bits1(&s->gb);
-            s->rl_table_index = decode012(&s->gb);
-            s->rl_chroma_table_index = s->rl_table_index;
-
-            s->dc_table_index = get_bits1(&s->gb);
-
-            s->mv_table_index = get_bits1(&s->gb);
-            break;
-        case 4:
-            s->use_skip_mb_code = get_bits1(&s->gb);
-
-            if(s->bit_rate > MBAC_BITRATE) s->per_mb_rl_table= get_bits1(&s->gb);
-            else                           s->per_mb_rl_table= 0;
-
-            if(!s->per_mb_rl_table){
-                s->rl_table_index = decode012(&s->gb);
-                s->rl_chroma_table_index = s->rl_table_index;
-            }
-
-            s->dc_table_index = get_bits1(&s->gb);
-
-            s->mv_table_index = get_bits1(&s->gb);
-            s->inter_intra_pred= (s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
-            break;
-        }
-
-        if(s->avctx->debug&FF_DEBUG_PICT_INFO)
-            av_log(s->avctx, AV_LOG_DEBUG, "skip:%d rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d   \n",
-                s->use_skip_mb_code,
-                s->rl_table_index,
-                s->rl_chroma_table_index,
-                s->dc_table_index,
-                s->mv_table_index,
-                s->per_mb_rl_table,
-                s->qscale);
-
-        if(s->flipflop_rounding){
-            s->no_rounding ^= 1;
-        }else{
-            s->no_rounding = 0;
-        }
-    }
-//printf("%d %d %d %d %d\n", s->pict_type, s->bit_rate, s->inter_intra_pred, s->width, s->height);
-
-    s->esc3_level_length= 0;
-    s->esc3_run_length= 0;
-
-    return 0;
-}
-
-int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size)
-{
-    int left= buf_size*8 - get_bits_count(&s->gb);
-    int length= s->msmpeg4_version>=3 ? 17 : 16;
-    /* the alt_bitstream reader could read over the end so we need to check it */
-    if(left>=length && left<length+8)
-    {
-        int fps;
-
-        fps= get_bits(&s->gb, 5);
-        s->bit_rate= get_bits(&s->gb, 11)*1024;
-        if(s->msmpeg4_version>=3)
-            s->flipflop_rounding= get_bits1(&s->gb);
-        else
-            s->flipflop_rounding= 0;
-
-//        printf("fps:%2d bps:%2d roundingType:%1d\n", fps, s->bit_rate/1024, s->flipflop_rounding);
-    }
-    else if(left<length+8)
-    {
-        s->flipflop_rounding= 0;
-        if(s->msmpeg4_version != 2)
-            av_log(s->avctx, AV_LOG_ERROR, "ext header missing, %d left\n", left);
-    }
-    else
-    {
-        av_log(s->avctx, AV_LOG_ERROR, "I frame too long, ignoring ext header\n");
-    }
-
-    return 0;
-}
-
-static int msmpeg4_decode_dc(MpegEncContext * s, int n, int *dir_ptr)
-{
-    int level, pred;
-
-    if(s->msmpeg4_version<=2){
-        if (n < 4) {
-            level = get_vlc2(&s->gb, v2_dc_lum_vlc.table, DC_VLC_BITS, 3);
-        } else {
-            level = get_vlc2(&s->gb, v2_dc_chroma_vlc.table, DC_VLC_BITS, 3);
-        }
-        if (level < 0)
-            return -1;
-        level-=256;
-    }else{  //FIXME optimize use unified tables & index
-        if (n < 4) {
-            level = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-        } else {
-            level = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-        }
-        if (level < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n");
-            return -1;
-        }
-
-        if (level == DC_MAX) {
-            level = get_bits(&s->gb, 8);
-            if (get_bits1(&s->gb))
-                level = -level;
-        } else if (level != 0) {
-            if (get_bits1(&s->gb))
-                level = -level;
-        }
-    }
-
-    if(s->msmpeg4_version==1){
-        int32_t *dc_val;
-        pred = msmpeg4v1_pred_dc(s, n, &dc_val);
-        level += pred;
-
-        /* update predictor */
-        *dc_val= level;
-    }else{
-        int16_t *dc_val;
-        pred = msmpeg4_pred_dc(s, n, &dc_val, dir_ptr);
-        level += pred;
-
-        /* update predictor */
-        if (n < 4) {
-            *dc_val = level * s->y_dc_scale;
-        } else {
-            *dc_val = level * s->c_dc_scale;
-        }
-    }
-
-    return level;
-}
-
-//#define ERROR_DETAILS
-int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
-                              int n, int coded, const uint8_t *scan_table)
-{
-    int level, i, last, run, run_diff;
-    int av_uninit(dc_pred_dir);
-    RLTable *rl;
-    RL_VLC_ELEM *rl_vlc;
-    int qmul, qadd;
-
-    if (s->mb_intra) {
-        qmul=1;
-        qadd=0;
-
-        /* DC coef */
-        level = msmpeg4_decode_dc(s, n, &dc_pred_dir);
-
-        if (level < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale);
-            if(s->inter_intra_pred) level=0;
-            else                    return -1;
-        }
-        if (n < 4) {
-            rl = &rl_table[s->rl_table_index];
-            if(level > 256*s->y_dc_scale){
-                av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale);
-                if(!s->inter_intra_pred) return -1;
-            }
-        } else {
-            rl = &rl_table[3 + s->rl_chroma_table_index];
-            if(level > 256*s->c_dc_scale){
-                av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale);
-                if(!s->inter_intra_pred) return -1;
-            }
-        }
-        block[0] = level;
-
-        run_diff = s->msmpeg4_version >= 4;
-        i = 0;
-        if (!coded) {
-            goto not_coded;
-        }
-        if (s->ac_pred) {
-            if (dc_pred_dir == 0)
-                scan_table = s->intra_v_scantable.permutated; /* left */
-            else
-                scan_table = s->intra_h_scantable.permutated; /* top */
-        } else {
-            scan_table = s->intra_scantable.permutated;
-        }
-        rl_vlc= rl->rl_vlc[0];
-    } else {
-        qmul = s->qscale << 1;
-        qadd = (s->qscale - 1) | 1;
-        i = -1;
-        rl = &rl_table[3 + s->rl_table_index];
-
-        if(s->msmpeg4_version==2)
-            run_diff = 0;
-        else
-            run_diff = 1;
-
-        if (!coded) {
-            s->block_last_index[n] = i;
-            return 0;
-        }
-        if(!scan_table)
-            scan_table = s->inter_scantable.permutated;
-        rl_vlc= rl->rl_vlc[s->qscale];
-    }
-  {
-    OPEN_READER(re, &s->gb);
-    for(;;) {
-        UPDATE_CACHE(re, &s->gb);
-        GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0);
-        if (level==0) {
-            int cache;
-            cache= GET_CACHE(re, &s->gb);
-            /* escape */
-            if (s->msmpeg4_version==1 || (cache&0x80000000)==0) {
-                if (s->msmpeg4_version==1 || (cache&0x40000000)==0) {
-                    /* third escape */
-                    if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2);
-                    UPDATE_CACHE(re, &s->gb);
-                    if(s->msmpeg4_version<=3){
-                        last=  SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1);
-                        run=   SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
-                        level= SHOW_SBITS(re, &s->gb, 8); LAST_SKIP_CACHE(re, &s->gb, 8);
-                        SKIP_COUNTER(re, &s->gb, 1+6+8);
-                    }else{
-                        int sign;
-                        last=  SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
-                        if(!s->esc3_level_length){
-                            int ll;
-                            //printf("ESC-3 %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y);
-                            if(s->qscale<8){
-                                ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3);
-                                if(ll==0){
-                                    ll= 8+SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
-                                }
-                            }else{
-                                ll=2;
-                                while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){
-                                    ll++;
-                                    SKIP_BITS(re, &s->gb, 1);
-                                }
-                                if(ll<8) SKIP_BITS(re, &s->gb, 1);
-                            }
-
-                            s->esc3_level_length= ll;
-                            s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2);
-//printf("level length:%d, run length: %d\n", ll, s->esc3_run_length);
-                            UPDATE_CACHE(re, &s->gb);
-                        }
-                        run=   SHOW_UBITS(re, &s->gb, s->esc3_run_length);
-                        SKIP_BITS(re, &s->gb, s->esc3_run_length);
-
-                        sign=  SHOW_UBITS(re, &s->gb, 1);
-                        SKIP_BITS(re, &s->gb, 1);
-
-                        level= SHOW_UBITS(re, &s->gb, s->esc3_level_length);
-                        SKIP_BITS(re, &s->gb, s->esc3_level_length);
-                        if(sign) level= -level;
-                    }
-//printf("level: %d, run: %d at %d %d\n", level, run, s->mb_x, s->mb_y);
-#if 0 // waste of time / this will detect very few errors
-                    {
-                        const int abs_level= FFABS(level);
-                        const int run1= run - rl->max_run[last][abs_level] - run_diff;
-                        if(abs_level<=MAX_LEVEL && run<=MAX_RUN){
-                            if(abs_level <= rl->max_level[last][run]){
-                                av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n");
-                                return DECODING_AC_LOST;
-                            }
-                            if(abs_level <= rl->max_level[last][run]*2){
-                                av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n");
-                                return DECODING_AC_LOST;
-                            }
-                            if(run1>=0 && abs_level <= rl->max_level[last][run1]){
-                                av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n");
-                                return DECODING_AC_LOST;
-                            }
-                        }
-                    }
-#endif
-                    //level = level * qmul + (level>0) * qadd - (level<=0) * qadd ;
-                    if (level>0) level= level * qmul + qadd;
-                    else         level= level * qmul - qadd;
-#if 0 // waste of time too :(
-                    if(level>2048 || level<-2048){
-                        av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n");
-                        return DECODING_AC_LOST;
-                    }
-#endif
-                    i+= run + 1;
-                    if(last) i+=192;
-#ifdef ERROR_DETAILS
-                if(run==66)
-                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level);
-                else if((i>62 && i<192) || i>192+63)
-                    av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level);
-#endif
-                } else {
-                    /* second escape */
-#if MIN_CACHE_BITS < 23
-                    LAST_SKIP_BITS(re, &s->gb, 2);
-                    UPDATE_CACHE(re, &s->gb);
-#else
-                    SKIP_BITS(re, &s->gb, 2);
-#endif
-                    GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
-                    i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing
-                    level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                    LAST_SKIP_BITS(re, &s->gb, 1);
-#ifdef ERROR_DETAILS
-                if(run==66)
-                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level);
-                else if((i>62 && i<192) || i>192+63)
-                    av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level);
-#endif
-                }
-            } else {
-                /* first escape */
-#if MIN_CACHE_BITS < 22
-                LAST_SKIP_BITS(re, &s->gb, 1);
-                UPDATE_CACHE(re, &s->gb);
-#else
-                SKIP_BITS(re, &s->gb, 1);
-#endif
-                GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1);
-                i+= run;
-                level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing
-                level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-                LAST_SKIP_BITS(re, &s->gb, 1);
-#ifdef ERROR_DETAILS
-                if(run==66)
-                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level);
-                else if((i>62 && i<192) || i>192+63)
-                    av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level);
-#endif
-            }
-        } else {
-            i+= run;
-            level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
-            LAST_SKIP_BITS(re, &s->gb, 1);
-#ifdef ERROR_DETAILS
-                if(run==66)
-                    av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level);
-                else if((i>62 && i<192) || i>192+63)
-                    av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level);
-#endif
-        }
-        if (i > 62){
-            i-= 192;
-            if(i&(~63)){
-                const int left= get_bits_left(&s->gb);
-                if(((i+192 == 64 && level/qmul==-1) || s->error_recognition<=1) && left>=0){
-                    av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y);
-                    break;
-                }else{
-                    av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y);
-                    return -1;
-                }
-            }
-
-            block[scan_table[i]] = level;
-            break;
-        }
-
-        block[scan_table[i]] = level;
-    }
-    CLOSE_READER(re, &s->gb);
-  }
- not_coded:
-    if (s->mb_intra) {
-        mpeg4_pred_ac(s, block, n, dc_pred_dir);
-        if (s->ac_pred) {
-            i = 63; /* XXX: not optimal */
-        }
-    }
-    if(s->msmpeg4_version>=4 && i>0) i=63; //FIXME/XXX optimize
-    s->block_last_index[n] = i;
-
-    return 0;
-}
-
-int ff_msmpeg4_decode_motion(MpegEncContext * s,
-                                 int *mx_ptr, int *my_ptr)
-{
-    MVTable *mv;
-    int code, mx, my;
-
-    mv = &mv_tables[s->mv_table_index];
-
-    code = get_vlc2(&s->gb, mv->vlc.table, MV_VLC_BITS, 2);
-    if (code < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "illegal MV code at %d %d\n", s->mb_x, s->mb_y);
-        return -1;
-    }
-    if (code == mv->n) {
-//printf("MV ESC %X at %d %d\n", show_bits(&s->gb, 24), s->mb_x, s->mb_y);
-        mx = get_bits(&s->gb, 6);
-        my = get_bits(&s->gb, 6);
-    } else {
-        mx = mv->table_mvx[code];
-        my = mv->table_mvy[code];
-    }
-
-    mx += *mx_ptr - 32;
-    my += *my_ptr - 32;
-    /* WARNING : they do not do exactly modulo encoding */
-    if (mx <= -64)
-        mx += 64;
-    else if (mx >= 64)
-        mx -= 64;
-
-    if (my <= -64)
-        my += 64;
-    else if (my >= 64)
-        my -= 64;
-    *mx_ptr = mx;
-    *my_ptr = my;
-    return 0;
-}
-
-AVCodec msmpeg4v1_decoder = {
-    "msmpeg4v1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V1,
-    sizeof(MpegEncContext),
-    ff_msmpeg4_decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
-
-AVCodec msmpeg4v2_decoder = {
-    "msmpeg4v2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V2,
-    sizeof(MpegEncContext),
-    ff_msmpeg4_decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
-
-AVCodec msmpeg4v3_decoder = {
-    "msmpeg4",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V3,
-    sizeof(MpegEncContext),
-    ff_msmpeg4_decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
-
-AVCodec wmv1_decoder = {
-    "wmv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WMV1,
-    sizeof(MpegEncContext),
-    ff_msmpeg4_decode_init,
-    NULL,
-    ff_h263_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
diff --git a/libavcodec/msmpeg4.h b/libavcodec/msmpeg4.h
deleted file mode 100644
index 28372a0..0000000
--- a/libavcodec/msmpeg4.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * MSMPEG4 backend for ffmpeg encoder and decoder
- * copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- */
-
-#ifndef AVCODEC_MSMPEG4_H
-#define AVCODEC_MSMPEG4_H
-
-#include "config.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-
-#define INTER_INTRA_VLC_BITS 3
-#define MB_NON_INTRA_VLC_BITS 9
-#define MB_INTRA_VLC_BITS 9
-
-extern VLC ff_mb_non_intra_vlc[4];
-extern VLC ff_inter_intra_vlc;
-
-void ff_msmpeg4_code012(PutBitContext *pb, int n);
-void ff_msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int n);
-void ff_msmpeg4_handle_slices(MpegEncContext *s);
-void ff_msmpeg4_encode_motion(MpegEncContext * s, int mx, int my);
-int ff_msmpeg4_coded_block_pred(MpegEncContext * s, int n,
-                                uint8_t **coded_block_ptr);
-int ff_msmpeg4_decode_motion(MpegEncContext * s, int *mx_ptr, int *my_ptr);
-int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
-                            int n, int coded, const uint8_t *scan_table);
-int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
-
-#define CONFIG_MSMPEG4_DECODER (CONFIG_MSMPEG4V1_DECODER || \
-                                CONFIG_MSMPEG4V2_DECODER || \
-                                CONFIG_MSMPEG4V3_DECODER || \
-                                CONFIG_WMV2_DECODER      || \
-                                CONFIG_VC1_DECODER)
-#define CONFIG_MSMPEG4_ENCODER (CONFIG_MSMPEG4V1_ENCODER || \
-                                CONFIG_MSMPEG4V2_ENCODER || \
-                                CONFIG_MSMPEG4V3_ENCODER || \
-                                CONFIG_WMV2_ENCODER)
-
-#endif /* AVCODEC_MSMPEG4_H */
diff --git a/libavcodec/msmpeg4data.c b/libavcodec/msmpeg4data.c
deleted file mode 100644
index f72715d..0000000
--- a/libavcodec/msmpeg4data.c
+++ /dev/null
@@ -1,2001 +0,0 @@
-/*
- * MSMPEG4 backend for ffmpeg encoder and decoder
- * copyright (c) 2001 Fabrice Bellard
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MSMPEG4 data tables.
- */
-
-#include "msmpeg4data.h"
-
-VLC ff_msmp4_mb_i_vlc;
-VLC ff_msmp4_dc_luma_vlc[2];
-VLC ff_msmp4_dc_chroma_vlc[2];
-
-/* intra picture macroblock coded block pattern */
-const uint16_t ff_msmp4_mb_i_table[64][2] = {
-{  0x1, 1 },{  0x17,  6 },{   0x9,  5 },{   0x5,  5 },
-{  0x6, 5 },{  0x47,  9 },{  0x20,  7 },{  0x10,  7 },
-{  0x2, 5 },{  0x7c,  9 },{  0x3a,  7 },{  0x1d,  7 },
-{  0x2, 6 },{  0xec,  9 },{  0x77,  8 },{   0x0,  8 },
-{  0x3, 5 },{  0xb7,  9 },{  0x2c,  7 },{  0x13,  7 },
-{  0x1, 6 },{ 0x168, 10 },{  0x46,  8 },{  0x3f,  8 },
-{ 0x1e, 6 },{ 0x712, 13 },{  0xb5,  9 },{  0x42,  8 },
-{ 0x22, 7 },{ 0x1c5, 11 },{ 0x11e, 10 },{  0x87,  9 },
-{  0x6, 4 },{   0x3,  9 },{  0x1e,  7 },{  0x1c,  6 },
-{ 0x12, 7 },{ 0x388, 12 },{  0x44,  9 },{  0x70,  9 },
-{ 0x1f, 6 },{ 0x23e, 11 },{  0x39,  8 },{  0x8e,  9 },
-{  0x1, 7 },{ 0x1c6, 11 },{  0xb6,  9 },{  0x45,  9 },
-{ 0x14, 6 },{ 0x23f, 11 },{  0x7d,  9 },{  0x18,  9 },
-{  0x7, 7 },{ 0x1c7, 11 },{  0x86,  9 },{  0x19,  9 },
-{ 0x15, 6 },{ 0x1db, 10 },{   0x2,  9 },{  0x46,  9 },
-{  0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 },
-};
-
-/* non intra picture macroblock coded block pattern + mb type */
-const uint32_t table_mb_non_intra[128][2] = {
-{   0x40,  7 },{   0x13c9, 13 },{   0x9fd, 12 },{   0x1fc, 15 },
-{  0x9fc, 12 },{    0xa83, 18 },{ 0x12d34, 17 },{  0x83bc, 16 },
-{  0x83a, 12 },{    0x7f8, 17 },{   0x3fd, 16 },{   0x3ff, 16 },
-{   0x79, 13 },{    0xa82, 18 },{  0x969d, 16 },{   0x2a4, 16 },
-{  0x978, 12 },{    0x543, 17 },{  0x41df, 15 },{   0x7f9, 17 },
-{ 0x12f3, 13 },{  0x25a6b, 18 },{ 0x25ef9, 18 },{   0x3fa, 16 },
-{ 0x20ee, 14 },{  0x969ab, 20 },{  0x969c, 16 },{ 0x25ef8, 18 },
-{ 0x12d2, 13 },{    0xa85, 18 },{  0x969e, 16 },{  0x4bc8, 15 },
-{   0x3d, 12 },{  0x12f7f, 17 },{   0x2a2, 16 },{  0x969f, 16 },
-{ 0x25ee, 14 },{ 0x12d355, 21 },{ 0x12f7d, 17 },{ 0x12f7e, 17 },
-{  0x9e5, 12 },{    0xa81, 18 },{ 0x4b4d4, 19 },{  0x83bd, 16 },
-{   0x78, 13 },{   0x969b, 16 },{   0x3fe, 16 },{   0x2a5, 16 },
-{   0x7e, 13 },{    0xa80, 18 },{   0x2a3, 16 },{   0x3fb, 16 },
-{ 0x1076, 13 },{    0xa84, 18 },{   0x153, 15 },{  0x4bc9, 15 },
-{   0x55, 13 },{ 0x12d354, 21 },{  0x4bde, 15 },{  0x25e5, 14 },
-{  0x25b, 10 },{   0x4b4c, 15 },{   0x96b, 12 },{   0x96a, 12 },
-{    0x1,  2 },{      0x0,  7 },{    0x26,  6 },{   0x12b,  9 },
-{    0x7,  3 },{    0x20f, 10 },{     0x4,  9 },{    0x28, 12 },
-{    0x6,  3 },{    0x20a, 10 },{   0x128,  9 },{    0x2b, 12 },
-{   0x11,  5 },{     0x1b, 11 },{   0x13a,  9 },{   0x4ff, 11 },
-{    0x3,  4 },{    0x277, 10 },{   0x106,  9 },{   0x839, 12 },
-{    0xb,  4 },{    0x27b, 10 },{   0x12c,  9 },{   0x4bf, 11 },
-{    0x9,  6 },{     0x35, 12 },{   0x27e, 10 },{  0x13c8, 13 },
-{    0x1,  6 },{    0x4aa, 11 },{   0x208, 10 },{    0x29, 12 },
-{    0x1,  4 },{    0x254, 10 },{   0x12e,  9 },{   0x838, 12 },
-{   0x24,  6 },{    0x4f3, 11 },{   0x276, 10 },{  0x12f6, 13 },
-{    0x1,  5 },{    0x27a, 10 },{   0x13e,  9 },{    0x3e, 12 },
-{    0x8,  6 },{    0x413, 11 },{     0xc, 10 },{   0x4be, 11 },
-{   0x14,  5 },{    0x412, 11 },{   0x253, 10 },{   0x97a, 12 },
-{   0x21,  6 },{    0x4ab, 11 },{   0x20b, 10 },{    0x34, 12 },
-{   0x15,  5 },{    0x278, 10 },{   0x252, 10 },{   0x968, 12 },
-{    0x5,  5 },{      0xb, 10 },{    0x9c,  8 },{     0xe, 10 },
-};
-
-/* dc table 0 */
-
-const uint32_t ff_table0_dc_lum[120][2] = {
-{     0x1,  1 },{      0x1, 2 },{     0x1,  4 },{     0x1,  5 },
-{     0x5,  5 },{      0x7, 5 },{     0x8,  6 },{     0xc,  6 },
-{     0x0,  7 },{      0x2, 7 },{    0x12,  7 },{    0x1a,  7 },
-{     0x3,  8 },{      0x7, 8 },{    0x27,  8 },{    0x37,  8 },
-{     0x5,  9 },{     0x4c, 9 },{    0x6c,  9 },{    0x6d,  9 },
-{     0x8, 10 },{    0x19, 10 },{    0x9b, 10 },{    0x1b, 10 },
-{    0x9a, 10 },{    0x13, 11 },{    0x34, 11 },{    0x35, 11 },
-{    0x61, 12 },{    0x48, 13 },{    0xc4, 13 },{    0x4a, 13 },
-{    0xc6, 13 },{    0xc7, 13 },{    0x92, 14 },{   0x18b, 14 },
-{    0x93, 14 },{   0x183, 14 },{   0x182, 14 },{    0x96, 14 },
-{    0x97, 14 },{   0x180, 14 },{   0x314, 15 },{   0x315, 15 },
-{   0x605, 16 },{   0x604, 16 },{   0x606, 16 },{   0xc0e, 17 },
-{ 0x303cd, 23 },{ 0x303c9, 23 },{ 0x303c8, 23 },{ 0x303ca, 23 },
-{ 0x303cb, 23 },{ 0x303cc, 23 },{ 0x303ce, 23 },{ 0x303cf, 23 },
-{ 0x303d0, 23 },{ 0x303d1, 23 },{ 0x303d2, 23 },{ 0x303d3, 23 },
-{ 0x303d4, 23 },{ 0x303d5, 23 },{ 0x303d6, 23 },{ 0x303d7, 23 },
-{ 0x303d8, 23 },{ 0x303d9, 23 },{ 0x303da, 23 },{ 0x303db, 23 },
-{ 0x303dc, 23 },{ 0x303dd, 23 },{ 0x303de, 23 },{ 0x303df, 23 },
-{ 0x303e0, 23 },{ 0x303e1, 23 },{ 0x303e2, 23 },{ 0x303e3, 23 },
-{ 0x303e4, 23 },{ 0x303e5, 23 },{ 0x303e6, 23 },{ 0x303e7, 23 },
-{ 0x303e8, 23 },{ 0x303e9, 23 },{ 0x303ea, 23 },{ 0x303eb, 23 },
-{ 0x303ec, 23 },{ 0x303ed, 23 },{ 0x303ee, 23 },{ 0x303ef, 23 },
-{ 0x303f0, 23 },{ 0x303f1, 23 },{ 0x303f2, 23 },{ 0x303f3, 23 },
-{ 0x303f4, 23 },{ 0x303f5, 23 },{ 0x303f6, 23 },{ 0x303f7, 23 },
-{ 0x303f8, 23 },{ 0x303f9, 23 },{ 0x303fa, 23 },{ 0x303fb, 23 },
-{ 0x303fc, 23 },{ 0x303fd, 23 },{ 0x303fe, 23 },{ 0x303ff, 23 },
-{ 0x60780, 24 },{ 0x60781, 24 },{ 0x60782, 24 },{ 0x60783, 24 },
-{ 0x60784, 24 },{ 0x60785, 24 },{ 0x60786, 24 },{ 0x60787, 24 },
-{ 0x60788, 24 },{ 0x60789, 24 },{ 0x6078a, 24 },{ 0x6078b, 24 },
-{ 0x6078c, 24 },{ 0x6078d, 24 },{ 0x6078e, 24 },{ 0x6078f, 24 },
-};
-
-const uint32_t ff_table0_dc_chroma[120][2] = {
-{      0x0,  2 },{      0x1,  2 },{      0x5,  3 },{      0x9,  4 },
-{      0xd,  4 },{     0x11,  5 },{     0x1d,  5 },{     0x1f,  5 },
-{     0x21,  6 },{     0x31,  6 },{     0x38,  6 },{     0x33,  6 },
-{     0x39,  6 },{     0x3d,  6 },{     0x61,  7 },{     0x79,  7 },
-{     0x80,  8 },{     0xc8,  8 },{     0xca,  8 },{     0xf0,  8 },
-{     0x81,  8 },{     0xc0,  8 },{     0xc9,  8 },{    0x107,  9 },
-{    0x106,  9 },{    0x196,  9 },{    0x183,  9 },{    0x1e3,  9 },
-{    0x1e2,  9 },{    0x20a, 10 },{    0x20b, 10 },{    0x609, 11 },
-{    0x412, 11 },{    0x413, 11 },{    0x60b, 11 },{    0x411, 11 },
-{    0x60a, 11 },{    0x65f, 11 },{    0x410, 11 },{    0x65d, 11 },
-{    0x65e, 11 },{    0xcb8, 12 },{    0xc10, 12 },{    0xcb9, 12 },
-{   0x1823, 13 },{   0x3045, 14 },{   0x6089, 15 },{   0xc110, 16 },
-{ 0x304448, 22 },{ 0x304449, 22 },{ 0x30444a, 22 },{ 0x30444b, 22 },
-{ 0x30444c, 22 },{ 0x30444d, 22 },{ 0x30444e, 22 },{ 0x30444f, 22 },
-{ 0x304450, 22 },{ 0x304451, 22 },{ 0x304452, 22 },{ 0x304453, 22 },
-{ 0x304454, 22 },{ 0x304455, 22 },{ 0x304456, 22 },{ 0x304457, 22 },
-{ 0x304458, 22 },{ 0x304459, 22 },{ 0x30445a, 22 },{ 0x30445b, 22 },
-{ 0x30445c, 22 },{ 0x30445d, 22 },{ 0x30445e, 22 },{ 0x30445f, 22 },
-{ 0x304460, 22 },{ 0x304461, 22 },{ 0x304462, 22 },{ 0x304463, 22 },
-{ 0x304464, 22 },{ 0x304465, 22 },{ 0x304466, 22 },{ 0x304467, 22 },
-{ 0x304468, 22 },{ 0x304469, 22 },{ 0x30446a, 22 },{ 0x30446b, 22 },
-{ 0x30446c, 22 },{ 0x30446d, 22 },{ 0x30446e, 22 },{ 0x30446f, 22 },
-{ 0x304470, 22 },{ 0x304471, 22 },{ 0x304472, 22 },{ 0x304473, 22 },
-{ 0x304474, 22 },{ 0x304475, 22 },{ 0x304476, 22 },{ 0x304477, 22 },
-{ 0x304478, 22 },{ 0x304479, 22 },{ 0x30447a, 22 },{ 0x30447b, 22 },
-{ 0x30447c, 22 },{ 0x30447d, 22 },{ 0x30447e, 22 },{ 0x30447f, 22 },
-{ 0x608880, 23 },{ 0x608881, 23 },{ 0x608882, 23 },{ 0x608883, 23 },
-{ 0x608884, 23 },{ 0x608885, 23 },{ 0x608886, 23 },{ 0x608887, 23 },
-{ 0x608888, 23 },{ 0x608889, 23 },{ 0x60888a, 23 },{ 0x60888b, 23 },
-{ 0x60888c, 23 },{ 0x60888d, 23 },{ 0x60888e, 23 },{ 0x60888f, 23 },
-};
-
-/* dc table 1 */
-
-const uint32_t ff_table1_dc_lum[120][2] = {
-{      0x2,  2 },{      0x3,  2 },{      0x3,  3 },{      0x2,  4 },
-{      0x5,  4 },{      0x1,  5 },{      0x3,  5 },{      0x8,  5 },
-{      0x0,  6 },{      0x5,  6 },{      0xd,  6 },{      0xf,  6 },
-{     0x13,  6 },{      0x8,  7 },{     0x18,  7 },{     0x1c,  7 },
-{     0x24,  7 },{      0x4,  8 },{      0x6,  8 },{     0x12,  8 },
-{     0x32,  8 },{     0x3b,  8 },{     0x4a,  8 },{     0x4b,  8 },
-{      0xb,  9 },{     0x26,  9 },{     0x27,  9 },{     0x66,  9 },
-{     0x74,  9 },{     0x75,  9 },{     0x14, 10 },{     0x1c, 10 },
-{     0x1f, 10 },{     0x1d, 10 },{     0x2b, 11 },{     0x3d, 11 },
-{    0x19d, 11 },{    0x19f, 11 },{     0x54, 12 },{    0x339, 12 },
-{    0x338, 12 },{    0x33d, 12 },{     0xab, 13 },{     0xf1, 13 },
-{    0x678, 13 },{     0xf2, 13 },{    0x1e0, 14 },{    0x1e1, 14 },
-{    0x154, 14 },{    0xcf2, 14 },{    0x3cc, 15 },{    0x2ab, 15 },
-{   0x19e7, 15 },{    0x3ce, 15 },{   0x19e6, 15 },{    0x554, 16 },
-{    0x79f, 16 },{    0x555, 16 },{    0xf3d, 17 },{    0xf37, 17 },
-{    0xf3c, 17 },{    0xf35, 17 },{   0x1e6d, 18 },{   0x1e68, 18 },
-{   0x3cd8, 19 },{   0x3cd3, 19 },{   0x3cd9, 19 },{   0x79a4, 20 },
-{  0xf34ba, 25 },{  0xf34b4, 25 },{  0xf34b5, 25 },{  0xf34b6, 25 },
-{  0xf34b7, 25 },{  0xf34b8, 25 },{  0xf34b9, 25 },{  0xf34bb, 25 },
-{  0xf34bc, 25 },{  0xf34bd, 25 },{  0xf34be, 25 },{  0xf34bf, 25 },
-{ 0x1e6940, 26 },{ 0x1e6941, 26 },{ 0x1e6942, 26 },{ 0x1e6943, 26 },
-{ 0x1e6944, 26 },{ 0x1e6945, 26 },{ 0x1e6946, 26 },{ 0x1e6947, 26 },
-{ 0x1e6948, 26 },{ 0x1e6949, 26 },{ 0x1e694a, 26 },{ 0x1e694b, 26 },
-{ 0x1e694c, 26 },{ 0x1e694d, 26 },{ 0x1e694e, 26 },{ 0x1e694f, 26 },
-{ 0x1e6950, 26 },{ 0x1e6951, 26 },{ 0x1e6952, 26 },{ 0x1e6953, 26 },
-{ 0x1e6954, 26 },{ 0x1e6955, 26 },{ 0x1e6956, 26 },{ 0x1e6957, 26 },
-{ 0x1e6958, 26 },{ 0x1e6959, 26 },{ 0x1e695a, 26 },{ 0x1e695b, 26 },
-{ 0x1e695c, 26 },{ 0x1e695d, 26 },{ 0x1e695e, 26 },{ 0x1e695f, 26 },
-{ 0x1e6960, 26 },{ 0x1e6961, 26 },{ 0x1e6962, 26 },{ 0x1e6963, 26 },
-{ 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 },
-};
-
-const uint32_t ff_table1_dc_chroma[120][2] = {
-{       0x0,  2 },{       0x1,  2 },{       0x4,  3 },{       0x7,  3 },
-{       0xb,  4 },{       0xd,  4 },{      0x15,  5 },{      0x28,  6 },
-{      0x30,  6 },{      0x32,  6 },{      0x52,  7 },{      0x62,  7 },
-{      0x66,  7 },{      0xa6,  8 },{      0xc6,  8 },{      0xcf,  8 },
-{     0x14f,  9 },{     0x18e,  9 },{     0x19c,  9 },{     0x29d, 10 },
-{     0x33a, 10 },{     0x538, 11 },{     0x63c, 11 },{     0x63e, 11 },
-{     0x63f, 11 },{     0x676, 11 },{     0xa73, 12 },{     0xc7a, 12 },
-{     0xcef, 12 },{    0x14e5, 13 },{    0x19dd, 13 },{    0x29c8, 14 },
-{    0x29c9, 14 },{    0x63dd, 15 },{    0x33b8, 14 },{    0x33b9, 14 },
-{    0xc7b6, 16 },{    0x63d8, 15 },{    0x63df, 15 },{    0xc7b3, 16 },
-{    0xc7b4, 16 },{    0xc7b5, 16 },{    0x63de, 15 },{    0xc7b7, 16 },
-{    0xc7b8, 16 },{    0xc7b9, 16 },{   0x18f65, 17 },{   0x31ec8, 18 },
-{  0xc7b248, 24 },{  0xc7b249, 24 },{  0xc7b24a, 24 },{  0xc7b24b, 24 },
-{  0xc7b24c, 24 },{  0xc7b24d, 24 },{  0xc7b24e, 24 },{  0xc7b24f, 24 },
-{  0xc7b250, 24 },{  0xc7b251, 24 },{  0xc7b252, 24 },{  0xc7b253, 24 },
-{  0xc7b254, 24 },{  0xc7b255, 24 },{  0xc7b256, 24 },{  0xc7b257, 24 },
-{  0xc7b258, 24 },{  0xc7b259, 24 },{  0xc7b25a, 24 },{  0xc7b25b, 24 },
-{  0xc7b25c, 24 },{  0xc7b25d, 24 },{  0xc7b25e, 24 },{  0xc7b25f, 24 },
-{  0xc7b260, 24 },{  0xc7b261, 24 },{  0xc7b262, 24 },{  0xc7b263, 24 },
-{  0xc7b264, 24 },{  0xc7b265, 24 },{  0xc7b266, 24 },{  0xc7b267, 24 },
-{  0xc7b268, 24 },{  0xc7b269, 24 },{  0xc7b26a, 24 },{  0xc7b26b, 24 },
-{  0xc7b26c, 24 },{  0xc7b26d, 24 },{  0xc7b26e, 24 },{  0xc7b26f, 24 },
-{  0xc7b270, 24 },{  0xc7b271, 24 },{  0xc7b272, 24 },{  0xc7b273, 24 },
-{  0xc7b274, 24 },{  0xc7b275, 24 },{  0xc7b276, 24 },{  0xc7b277, 24 },
-{  0xc7b278, 24 },{  0xc7b279, 24 },{  0xc7b27a, 24 },{  0xc7b27b, 24 },
-{  0xc7b27c, 24 },{  0xc7b27d, 24 },{  0xc7b27e, 24 },{  0xc7b27f, 24 },
-{ 0x18f6480, 25 },{ 0x18f6481, 25 },{ 0x18f6482, 25 },{ 0x18f6483, 25 },
-{ 0x18f6484, 25 },{ 0x18f6485, 25 },{ 0x18f6486, 25 },{ 0x18f6487, 25 },
-{ 0x18f6488, 25 },{ 0x18f6489, 25 },{ 0x18f648a, 25 },{ 0x18f648b, 25 },
-{ 0x18f648c, 25 },{ 0x18f648d, 25 },{ 0x18f648e, 25 },{ 0x18f648f, 25 },
-};
-
-/* vlc table 0, for intra luma */
-
-static const uint16_t table0_vlc[133][2] = {
-{   0x1,  2 },{   0x6,  3 },{   0xf,  4 },{  0x16,  5 },
-{  0x20,  6 },{  0x18,  7 },{   0x8,  8 },{  0x9a,  8 },
-{  0x56,  9 },{ 0x13e,  9 },{  0xf0, 10 },{ 0x3a5, 10 },
-{  0x77, 11 },{ 0x1ef, 11 },{  0x9a, 12 },{  0x5d, 13 },
-{   0x1,  4 },{  0x11,  5 },{   0x2,  7 },{   0xb,  8 },
-{  0x12,  9 },{ 0x1d6,  9 },{ 0x27e, 10 },{ 0x191, 11 },
-{  0xea, 12 },{ 0x3dc, 12 },{ 0x13b, 13 },{   0x4,  5 },
-{  0x14,  7 },{  0x9e,  8 },{   0x9, 10 },{ 0x1ac, 11 },
-{ 0x1e2, 11 },{ 0x3ca, 12 },{  0x5f, 13 },{  0x17,  5 },
-{  0x4e,  7 },{  0x5e,  9 },{  0xf3, 10 },{ 0x1ad, 11 },
-{  0xec, 12 },{ 0x5f0, 13 },{   0xe,  6 },{  0xe1,  8 },
-{ 0x3a4, 10 },{  0x9c, 12 },{ 0x13d, 13 },{  0x3b,  6 },
-{  0x1c,  9 },{  0x14, 11 },{ 0x9be, 12 },{   0x6,  7 },
-{  0x7a,  9 },{ 0x190, 11 },{ 0x137, 13 },{  0x1b,  7 },
-{   0x8, 10 },{ 0x75c, 11 },{  0x71,  7 },{  0xd7, 10 },
-{ 0x9bf, 12 },{   0x7,  8 },{  0xaf, 10 },{ 0x4cc, 11 },
-{  0x34,  8 },{ 0x265, 10 },{  0x9f, 12 },{  0xe0,  8 },
-{  0x16, 11 },{ 0x327, 12 },{  0x15,  9 },{ 0x17d, 11 },
-{ 0xebb, 12 },{  0x14,  9 },{  0xf6, 10 },{ 0x1e4, 11 },
-{  0xcb, 10 },{ 0x99d, 12 },{  0xca, 10 },{ 0x2fc, 12 },
-{ 0x17f, 11 },{ 0x4cd, 11 },{ 0x2fd, 12 },{ 0x4fe, 11 },
-{ 0x13a, 13 },{   0xa,  4 },{  0x42,  7 },{ 0x1d3,  9 },
-{ 0x4dd, 11 },{  0x12,  5 },{  0xe8,  8 },{  0x4c, 11 },
-{ 0x136, 13 },{  0x39,  6 },{ 0x264, 10 },{ 0xeba, 12 },
-{   0x0,  7 },{  0xae, 10 },{ 0x99c, 12 },{  0x1f,  7 },
-{ 0x4de, 11 },{  0x43,  7 },{ 0x4dc, 11 },{   0x3,  8 },
-{ 0x3cb, 12 },{   0x6,  8 },{ 0x99e, 12 },{  0x2a,  8 },
-{ 0x5f1, 13 },{   0xf,  8 },{ 0x9fe, 12 },{  0x33,  8 },
-{ 0x9ff, 12 },{  0x98,  8 },{ 0x99f, 12 },{  0xea,  8 },
-{ 0x13c, 13 },{  0x2e,  8 },{ 0x192, 11 },{ 0x136,  9 },
-{  0x6a,  9 },{  0x15, 11 },{ 0x3af, 10 },{ 0x1e3, 11 },
-{  0x74, 11 },{  0xeb, 12 },{ 0x2f9, 12 },{  0x5c, 13 },
-{  0xed, 12 },{ 0x3dd, 12 },{ 0x326, 12 },{  0x5e, 13 },
-{  0x16,  7 },
-};
-
-static const int8_t table0_level[132] = {
-  1,  2,  3,  4,  5,  6,  7,  8,
-  9, 10, 11, 12, 13, 14, 15, 16,
-  1,  2,  3,  4,  5,  6,  7,  8,
-  9, 10, 11,  1,  2,  3,  4,  5,
-  6,  7,  8,  1,  2,  3,  4,  5,
-  6,  7,  1,  2,  3,  4,  5,  1,
-  2,  3,  4,  1,  2,  3,  4,  1,
-  2,  3,  1,  2,  3,  1,  2,  3,
-  1,  2,  3,  1,  2,  3,  1,  2,
-  3,  1,  2,  3,  1,  2,  1,  2,
-  1,  1,  1,  1,  1,  1,  2,  3,
-  4,  1,  2,  3,  4,  1,  2,  3,
-  1,  2,  3,  1,  2,  1,  2,  1,
-  2,  1,  2,  1,  2,  1,  2,  1,
-  2,  1,  2,  1,  2,  1,  2,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,
-};
-
-static const int8_t table0_run[132] = {
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  2,  2,  2,  2,  2,
-  2,  2,  2,  3,  3,  3,  3,  3,
-  3,  3,  4,  4,  4,  4,  4,  5,
-  5,  5,  5,  6,  6,  6,  6,  7,
-  7,  7,  8,  8,  8,  9,  9,  9,
- 10, 10, 10, 11, 11, 11, 12, 12,
- 12, 13, 13, 13, 14, 14, 15, 15,
- 16, 17, 18, 19, 20,  0,  0,  0,
-  0,  1,  1,  1,  1,  2,  2,  2,
-  3,  3,  3,  4,  4,  5,  5,  6,
-  6,  7,  7,  8,  8,  9,  9, 10,
- 10, 11, 11, 12, 12, 13, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26,
-};
-
-/* vlc table 1, for intra chroma and P macroblocks */
-
-static const uint16_t table1_vlc[149][2] = {
-{    0x4,  3 },{   0x14,  5 },{   0x17,  7 },{   0x7f,  8 },
-{  0x154,  9 },{  0x1f2, 10 },{   0xbf, 11 },{   0x65, 12 },
-{  0xaaa, 12 },{  0x630, 13 },{ 0x1597, 13 },{  0x3b7, 14 },
-{ 0x2b22, 14 },{  0xbe6, 15 },{    0xb,  4 },{   0x37,  7 },
-{   0x62,  9 },{    0x7, 11 },{  0x166, 12 },{   0xce, 13 },
-{ 0x1590, 13 },{  0x5f6, 14 },{  0xbe7, 15 },{    0x7,  5 },
-{   0x6d,  8 },{    0x3, 11 },{  0x31f, 12 },{  0x5f2, 14 },
-{    0x2,  6 },{   0x61,  9 },{   0x55, 12 },{  0x1df, 14 },
-{   0x1a,  6 },{   0x1e, 10 },{  0xac9, 12 },{ 0x2b23, 14 },
-{   0x1e,  6 },{   0x1f, 10 },{  0xac3, 12 },{ 0x2b2b, 14 },
-{    0x6,  7 },{    0x4, 11 },{  0x2f8, 13 },{   0x19,  7 },
-{    0x6, 11 },{  0x63d, 13 },{   0x57,  7 },{  0x182, 11 },
-{ 0x2aa2, 14 },{    0x4,  8 },{  0x180, 11 },{  0x59c, 14 },
-{   0x7d,  8 },{  0x164, 12 },{  0x76d, 15 },{    0x2,  9 },
-{  0x18d, 11 },{ 0x1581, 13 },{   0xad,  8 },{   0x60, 12 },
-{  0xc67, 14 },{   0x1c,  9 },{   0xee, 13 },{    0x3,  9 },
-{  0x2cf, 13 },{   0xd9,  9 },{ 0x1580, 13 },{    0x2, 11 },
-{  0x183, 11 },{   0x57, 12 },{   0x61, 12 },{   0x31, 11 },
-{   0x66, 12 },{  0x631, 13 },{  0x632, 13 },{   0xac, 13 },
-{  0x31d, 12 },{   0x76, 12 },{   0x3a, 11 },{  0x165, 12 },
-{  0xc66, 14 },{    0x3,  2 },{   0x54,  7 },{  0x2ab, 10 },
-{   0x16, 13 },{  0x5f7, 14 },{    0x5,  4 },{   0xf8,  9 },
-{  0xaa9, 12 },{   0x5f, 15 },{    0x4,  4 },{   0x1c, 10 },
-{ 0x1550, 13 },{    0x4,  5 },{   0x77, 11 },{  0x76c, 15 },
-{    0xe,  5 },{    0xa, 12 },{    0xc,  5 },{  0x562, 11 },
-{    0x4,  6 },{  0x31c, 12 },{    0x6,  6 },{   0xc8, 13 },
-{    0xd,  6 },{  0x1da, 13 },{    0x7,  6 },{   0xc9, 13 },
-{    0x1,  7 },{   0x2e, 14 },{   0x14,  7 },{ 0x1596, 13 },
-{    0xa,  7 },{  0xac2, 12 },{   0x16,  7 },{  0x15b, 14 },
-{   0x15,  7 },{  0x15a, 14 },{    0xf,  8 },{   0x5e, 15 },
-{   0x7e,  8 },{   0xab,  8 },{   0x2d,  9 },{   0xd8,  9 },
-{    0xb,  9 },{   0x14, 10 },{  0x2b3, 10 },{  0x1f3, 10 },
-{   0x3a, 10 },{    0x0, 10 },{   0x58, 10 },{   0x2e,  9 },
-{   0x5e, 10 },{  0x563, 11 },{   0xec, 12 },{   0x54, 12 },
-{  0xac1, 12 },{ 0x1556, 13 },{  0x2fa, 13 },{  0x181, 11 },
-{ 0x1557, 13 },{  0x59d, 14 },{ 0x2aa3, 14 },{ 0x2b2a, 14 },
-{  0x1de, 14 },{  0x63c, 13 },{   0xcf, 13 },{ 0x1594, 13 },
-{    0xd,  9 },
-};
-
-static const int8_t table1_level[148] = {
-  1,  2,  3,  4,  5,  6,  7,  8,
-  9, 10, 11, 12, 13, 14,  1,  2,
-  3,  4,  5,  6,  7,  8,  9,  1,
-  2,  3,  4,  5,  1,  2,  3,  4,
-  1,  2,  3,  4,  1,  2,  3,  4,
-  1,  2,  3,  1,  2,  3,  1,  2,
-  3,  1,  2,  3,  1,  2,  3,  1,
-  2,  3,  1,  2,  3,  1,  2,  1,
-  2,  1,  2,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  2,  3,  4,  5,  1,  2,
-  3,  4,  1,  2,  3,  1,  2,  3,
-  1,  2,  1,  2,  1,  2,  1,  2,
-  1,  2,  1,  2,  1,  2,  1,  2,
-  1,  2,  1,  2,  1,  2,  1,  2,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,
-};
-
-static const int8_t table1_run[148] = {
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  2,
-  2,  2,  2,  2,  3,  3,  3,  3,
-  4,  4,  4,  4,  5,  5,  5,  5,
-  6,  6,  6,  7,  7,  7,  8,  8,
-  8,  9,  9,  9, 10, 10, 10, 11,
- 11, 11, 12, 12, 12, 13, 13, 14,
- 14, 15, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28,
- 29,  0,  0,  0,  0,  0,  1,  1,
-  1,  1,  2,  2,  2,  3,  3,  3,
-  4,  4,  5,  5,  6,  6,  7,  7,
-  8,  8,  9,  9, 10, 10, 11, 11,
- 12, 12, 13, 13, 14, 14, 15, 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,
-};
-
-/* third vlc table */
-
-static const uint16_t table2_vlc[186][2] = {
-{    0x1,  2 },{    0x5,  3 },{    0xd,  4 },{   0x12,  5 },
-{    0xe,  6 },{   0x15,  7 },{   0x13,  8 },{   0x3f,  8 },
-{   0x4b,  9 },{  0x11f,  9 },{   0xb8, 10 },{  0x3e3, 10 },
-{  0x172, 11 },{  0x24d, 12 },{  0x3da, 12 },{  0x2dd, 13 },
-{ 0x1f55, 13 },{  0x5b9, 14 },{ 0x3eae, 14 },{    0x0,  4 },
-{   0x10,  5 },{    0x8,  7 },{   0x20,  8 },{   0x29,  9 },
-{  0x1f4,  9 },{  0x233, 10 },{  0x1e0, 11 },{  0x12a, 12 },
-{  0x3dd, 12 },{  0x50a, 13 },{ 0x1f29, 13 },{  0xa42, 14 },
-{ 0x1272, 15 },{ 0x1737, 15 },{    0x3,  5 },{   0x11,  7 },
-{   0xc4,  8 },{   0x4b, 10 },{   0xb4, 11 },{  0x7d4, 11 },
-{  0x345, 12 },{  0x2d7, 13 },{  0x7bf, 13 },{  0x938, 14 },
-{  0xbbb, 14 },{  0x95e, 15 },{   0x13,  5 },{   0x78,  7 },
-{   0x69,  9 },{  0x232, 10 },{  0x461, 11 },{  0x3ec, 12 },
-{  0x520, 13 },{ 0x1f2a, 13 },{ 0x3e50, 14 },{ 0x3e51, 14 },
-{ 0x1486, 15 },{    0xc,  6 },{   0x24,  9 },{   0x94, 11 },
-{  0x8c0, 12 },{  0xf09, 14 },{ 0x1ef0, 15 },{   0x3d,  6 },
-{   0x53,  9 },{  0x1a0, 11 },{  0x2d6, 13 },{  0xf08, 14 },
-{   0x13,  7 },{   0x7c,  9 },{  0x7c1, 11 },{  0x4ac, 14 },
-{   0x1b,  7 },{   0xa0, 10 },{  0x344, 12 },{  0xf79, 14 },
-{   0x79,  7 },{  0x3e1, 10 },{  0x2d4, 13 },{ 0x2306, 14 },
-{   0x21,  8 },{  0x23c, 10 },{  0xfae, 12 },{ 0x23de, 14 },
-{   0x35,  8 },{  0x175, 11 },{  0x7b3, 13 },{   0xc5,  8 },
-{  0x174, 11 },{  0x785, 13 },{   0x48,  9 },{  0x1a3, 11 },
-{  0x49e, 13 },{   0x2c,  9 },{   0xfa, 10 },{  0x7d6, 11 },
-{   0x92, 10 },{  0x5cc, 13 },{ 0x1ef1, 15 },{   0xa3, 10 },
-{  0x3ed, 12 },{  0x93e, 14 },{  0x1e2, 11 },{ 0x1273, 15 },
-{  0x7c4, 11 },{ 0x1487, 15 },{  0x291, 12 },{  0x293, 12 },
-{  0xf8a, 12 },{  0x509, 13 },{  0x508, 13 },{  0x78d, 13 },
-{  0x7be, 13 },{  0x78c, 13 },{  0x4ae, 14 },{  0xbba, 14 },
-{ 0x2307, 14 },{  0xb9a, 14 },{ 0x1736, 15 },{    0xe,  4 },
-{   0x45,  7 },{  0x1f3,  9 },{  0x47a, 11 },{  0x5dc, 13 },
-{ 0x23df, 14 },{   0x19,  5 },{   0x28,  9 },{  0x176, 11 },
-{  0x49d, 13 },{ 0x23dd, 14 },{   0x30,  6 },{   0xa2, 10 },
-{  0x2ef, 12 },{  0x5b8, 14 },{   0x3f,  6 },{   0xa5, 10 },
-{  0x3db, 12 },{  0x93f, 14 },{   0x44,  7 },{  0x7cb, 11 },
-{  0x95f, 15 },{   0x63,  7 },{  0x3c3, 12 },{   0x15,  8 },
-{  0x8f6, 12 },{   0x17,  8 },{  0x498, 13 },{   0x2c,  8 },
-{  0x7b2, 13 },{   0x2f,  8 },{ 0x1f54, 13 },{   0x8d,  8 },
-{  0x7bd, 13 },{   0x8e,  8 },{ 0x1182, 13 },{   0xfb,  8 },
-{  0x50b, 13 },{   0x2d,  8 },{  0x7c0, 11 },{   0x79,  9 },
-{ 0x1f5f, 13 },{   0x7a,  9 },{ 0x1f56, 13 },{  0x231, 10 },
-{  0x3e4, 10 },{  0x1a1, 11 },{  0x143, 11 },{  0x1f7, 11 },
-{  0x16f, 12 },{  0x292, 12 },{  0x2e7, 12 },{  0x16c, 12 },
-{  0x16d, 12 },{  0x3dc, 12 },{  0xf8b, 12 },{  0x499, 13 },
-{  0x3d8, 12 },{  0x78e, 13 },{  0x2d5, 13 },{ 0x1f5e, 13 },
-{ 0x1f2b, 13 },{  0x78f, 13 },{  0x4ad, 14 },{ 0x3eaf, 14 },
-{ 0x23dc, 14 },{   0x4a,  9 },
-};
-
-static const int8_t table2_level[185] = {
-  1,  2,  3,  4,  5,  6,  7,  8,
-  9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19,  1,  2,  3,  4,  5,
-  6,  7,  8,  9, 10, 11, 12, 13,
- 14, 15,  1,  2,  3,  4,  5,  6,
-  7,  8,  9, 10, 11, 12,  1,  2,
-  3,  4,  5,  6,  7,  8,  9, 10,
- 11,  1,  2,  3,  4,  5,  6,  1,
-  2,  3,  4,  5,  1,  2,  3,  4,
-  1,  2,  3,  4,  1,  2,  3,  4,
-  1,  2,  3,  4,  1,  2,  3,  1,
-  2,  3,  1,  2,  3,  1,  2,  3,
-  1,  2,  3,  1,  2,  3,  1,  2,
-  1,  2,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  2,  3,  4,  5,  6,  1,  2,  3,
-  4,  5,  1,  2,  3,  4,  1,  2,
-  3,  4,  1,  2,  3,  1,  2,  1,
-  2,  1,  2,  1,  2,  1,  2,  1,
-  2,  1,  2,  1,  2,  1,  2,  1,
-  2,  1,  2,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,
-};
-
-static const int8_t table2_run[185] = {
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  1,  1,  1,  1,  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,  3,  3,  3,  3,  3,
-  3,  4,  4,  4,  4,  4,  4,  5,
-  5,  5,  5,  5,  6,  6,  6,  6,
-  7,  7,  7,  7,  8,  8,  8,  8,
-  9,  9,  9,  9, 10, 10, 10, 11,
- 11, 11, 12, 12, 12, 13, 13, 13,
- 14, 14, 14, 15, 15, 15, 16, 16,
- 17, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30,  0,
-  0,  0,  0,  0,  0,  1,  1,  1,
-  1,  1,  2,  2,  2,  2,  3,  3,
-  3,  3,  4,  4,  4,  5,  5,  6,
-  6,  7,  7,  8,  8,  9,  9, 10,
- 10, 11, 11, 12, 12, 13, 13, 14,
- 14, 15, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36,
- 37,
-};
-
-/* second non intra vlc table */
-static const uint16_t table4_vlc[169][2] = {
-{    0x0,  3 },{    0x3,  4 },{    0xb,  5 },{   0x14,  6 },
-{   0x3f,  6 },{   0x5d,  7 },{   0xa2,  8 },{   0xac,  9 },
-{  0x16e,  9 },{  0x20a, 10 },{  0x2e2, 10 },{  0x432, 11 },
-{  0x5c9, 11 },{  0x827, 12 },{  0xb54, 12 },{  0x4e6, 13 },
-{ 0x105f, 13 },{ 0x172a, 13 },{ 0x20b2, 14 },{ 0x2d4e, 14 },
-{ 0x39f0, 14 },{ 0x4175, 15 },{ 0x5a9e, 15 },{    0x4,  4 },
-{   0x1e,  5 },{   0x42,  7 },{   0xb6,  8 },{  0x173,  9 },
-{  0x395, 10 },{  0x72e, 11 },{  0xb94, 12 },{ 0x16a4, 13 },
-{ 0x20b3, 14 },{ 0x2e45, 14 },{    0x5,  5 },{   0x40,  7 },
-{   0x49,  9 },{  0x28f, 10 },{  0x5cb, 11 },{  0x48a, 13 },
-{  0x9dd, 14 },{ 0x73e2, 15 },{   0x18,  5 },{   0x25,  8 },
-{   0x8a, 10 },{  0x51b, 11 },{  0xe5f, 12 },{  0x9c9, 14 },
-{ 0x139c, 15 },{   0x29,  6 },{   0x4f,  9 },{  0x412, 11 },
-{  0x48d, 13 },{ 0x2e41, 14 },{   0x38,  6 },{  0x10e,  9 },
-{  0x5a8, 11 },{ 0x105c, 13 },{ 0x39f2, 14 },{   0x58,  7 },
-{  0x21f, 10 },{  0xe7e, 12 },{ 0x39ff, 14 },{   0x23,  8 },
-{  0x2e3, 10 },{  0x4e5, 13 },{ 0x2e40, 14 },{   0xa1,  8 },
-{  0x5be, 11 },{  0x9c8, 14 },{   0x83,  8 },{  0x13a, 11 },
-{ 0x1721, 13 },{   0x44,  9 },{  0x276, 12 },{ 0x39f6, 14 },
-{   0x8b, 10 },{  0x4ef, 13 },{ 0x5a9b, 15 },{  0x208, 10 },
-{ 0x1cfe, 13 },{  0x399, 10 },{ 0x1cb4, 13 },{  0x39e, 10 },
-{ 0x39f3, 14 },{  0x5ab, 11 },{ 0x73e3, 15 },{  0x737, 11 },
-{ 0x5a9f, 15 },{  0x82d, 12 },{  0xe69, 12 },{  0xe68, 12 },
-{  0x433, 11 },{  0xb7b, 12 },{ 0x2df8, 14 },{ 0x2e56, 14 },
-{ 0x2e57, 14 },{ 0x39f7, 14 },{ 0x51a5, 15 },{    0x3,  3 },
-{   0x2a,  6 },{   0xe4,  8 },{  0x28e, 10 },{  0x735, 11 },
-{ 0x1058, 13 },{ 0x1cfa, 13 },{ 0x2df9, 14 },{ 0x4174, 15 },
-{    0x9,  4 },{   0x54,  8 },{  0x398, 10 },{  0x48b, 13 },
-{ 0x139d, 15 },{    0xd,  4 },{   0xad,  9 },{  0x826, 12 },
-{ 0x2d4c, 14 },{   0x11,  5 },{  0x16b,  9 },{  0xb7f, 12 },
-{ 0x51a4, 15 },{   0x19,  5 },{  0x21b, 10 },{ 0x16fd, 13 },
-{   0x1d,  5 },{  0x394, 10 },{ 0x28d3, 14 },{   0x2b,  6 },
-{  0x5bc, 11 },{ 0x5a9a, 15 },{   0x2f,  6 },{  0x247, 12 },
-{   0x10,  7 },{  0xa35, 12 },{   0x3e,  6 },{  0xb7a, 12 },
-{   0x59,  7 },{ 0x105e, 13 },{   0x26,  8 },{  0x9cf, 14 },
-{   0x55,  8 },{ 0x1cb5, 13 },{   0x57,  8 },{  0xe5b, 12 },
-{   0xa0,  8 },{ 0x1468, 13 },{  0x170,  9 },{   0x90, 10 },
-{  0x1ce,  9 },{  0x21a, 10 },{  0x218, 10 },{  0x168,  9 },
-{  0x21e, 10 },{  0x244, 12 },{  0x736, 11 },{  0x138, 11 },
-{  0x519, 11 },{  0xe5e, 12 },{  0x72c, 11 },{  0xb55, 12 },
-{  0x9dc, 14 },{ 0x20bb, 14 },{  0x48c, 13 },{ 0x1723, 13 },
-{ 0x2e44, 14 },{ 0x16a5, 13 },{  0x518, 11 },{ 0x39fe, 14 },
-{  0x169,  9 },
-};
-
-static const int8_t table4_level[168] = {
-  1,  2,  3,  4,  5,  6,  7,  8,
-  9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23,  1,
-  2,  3,  4,  5,  6,  7,  8,  9,
- 10, 11,  1,  2,  3,  4,  5,  6,
-  7,  8,  1,  2,  3,  4,  5,  6,
-  7,  1,  2,  3,  4,  5,  1,  2,
-  3,  4,  5,  1,  2,  3,  4,  1,
-  2,  3,  4,  1,  2,  3,  1,  2,
-  3,  1,  2,  3,  1,  2,  3,  1,
-  2,  1,  2,  1,  2,  1,  2,  1,
-  2,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  2,  3,  4,  5,
-  6,  7,  8,  9,  1,  2,  3,  4,
-  5,  1,  2,  3,  4,  1,  2,  3,
-  4,  1,  2,  3,  1,  2,  3,  1,
-  2,  3,  1,  2,  1,  2,  1,  2,
-  1,  2,  1,  2,  1,  2,  1,  2,
-  1,  2,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-};
-
-static const int8_t table4_run[168] = {
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  2,  2,  2,  2,  2,  2,
-  2,  2,  3,  3,  3,  3,  3,  3,
-  3,  4,  4,  4,  4,  4,  5,  5,
-  5,  5,  5,  6,  6,  6,  6,  7,
-  7,  7,  7,  8,  8,  8,  9,  9,
-  9, 10, 10, 10, 11, 11, 11, 12,
- 12, 13, 13, 14, 14, 15, 15, 16,
- 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  1,  1,  1,
-  1,  2,  2,  2,  2,  3,  3,  3,
-  3,  4,  4,  4,  5,  5,  5,  6,
-  6,  6,  7,  7,  8,  8,  9,  9,
- 10, 10, 11, 11, 12, 12, 13, 13,
- 14, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36,
-};
-
-extern const uint16_t inter_vlc[103][2];
-extern const int8_t inter_level[102];
-extern const int8_t inter_run[102];
-
-extern const uint16_t ff_mpeg4_intra_vlc[103][2];
-extern const int8_t ff_mpeg4_intra_level[102];
-extern const int8_t ff_mpeg4_intra_run[102];
-
-RLTable rl_table[NB_RL_TABLES] = {
-    /* intra luminance tables */
-    /* low motion  */
-    {
-        132,
-        85,
-        table0_vlc,
-        table0_run,
-        table0_level,
-    },
-    /* high motion */
-    {
-        185,
-        119,
-        table2_vlc,
-        table2_run,
-        table2_level,
-    },
-    /* mid-rate */
-    {
-        102,
-        67,
-        ff_mpeg4_intra_vlc,
-        ff_mpeg4_intra_run,
-        ff_mpeg4_intra_level,
-    },
-    /* intra chrominance / non intra tables */
-    /* low motion inter */
-    {
-        148,
-        81,
-        table1_vlc,
-        table1_run,
-        table1_level,
-    },
-    /* high motion inter */
-    {
-        168,
-        99,
-        table4_vlc,
-        table4_run,
-        table4_level,
-    },
-    /* mid rate inter */
-    {
-        102,
-        58,
-        inter_vlc,
-        inter_run,
-        inter_level,
-    },
-};
-
-/* motion vector table 0 */
-
-static const uint16_t table0_mv_code[1100] = {
- 0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001,
- 0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f,
- 0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b,
- 0x004d, 0x0003, 0x0022, 0x0023, 0x0025, 0x0027, 0x0042, 0x0048,
- 0x0049, 0x0050, 0x005c, 0x0091, 0x009f, 0x000e, 0x0043, 0x004c,
- 0x0054, 0x0056, 0x008c, 0x0098, 0x009a, 0x009b, 0x00b1, 0x00b2,
- 0x0120, 0x0121, 0x0126, 0x0133, 0x0139, 0x01a1, 0x01a4, 0x01a5,
- 0x01a6, 0x01a7, 0x01ae, 0x01af, 0x000b, 0x0019, 0x0085, 0x0090,
- 0x009b, 0x00aa, 0x00af, 0x010c, 0x010e, 0x011c, 0x011e, 0x0133,
- 0x0144, 0x0160, 0x0174, 0x0175, 0x0177, 0x0178, 0x0249, 0x024b,
- 0x0252, 0x0261, 0x0265, 0x0270, 0x0352, 0x0353, 0x0355, 0x0359,
- 0x0010, 0x0011, 0x0013, 0x0034, 0x0035, 0x0036, 0x0037, 0x003d,
- 0x003e, 0x0109, 0x0126, 0x0156, 0x021a, 0x021e, 0x023a, 0x023e,
- 0x028e, 0x028f, 0x02cf, 0x0491, 0x0494, 0x049f, 0x04a0, 0x04a3,
- 0x04a6, 0x04a7, 0x04ad, 0x04ae, 0x04c0, 0x04c4, 0x04c6, 0x04c8,
- 0x04c9, 0x04f5, 0x04f6, 0x04f7, 0x0680, 0x0682, 0x0683, 0x0688,
- 0x0689, 0x068d, 0x068e, 0x068f, 0x06a2, 0x06a3, 0x06a9, 0x06b0,
- 0x06b1, 0x06b4, 0x06b5, 0x0024, 0x0060, 0x0063, 0x0078, 0x0079,
- 0x0211, 0x0244, 0x0245, 0x0247, 0x0248, 0x0249, 0x024a, 0x024b,
- 0x026b, 0x02af, 0x02b8, 0x02bb, 0x0436, 0x0476, 0x0477, 0x047e,
- 0x04c8, 0x04c9, 0x04ca, 0x0514, 0x0586, 0x0587, 0x0598, 0x059d,
- 0x05d9, 0x05da, 0x0920, 0x0921, 0x093b, 0x093c, 0x093d, 0x0942,
- 0x0943, 0x0944, 0x0945, 0x0959, 0x095e, 0x095f, 0x0982, 0x0983,
- 0x098e, 0x098f, 0x09c4, 0x09e7, 0x09e8, 0x09e9, 0x0d02, 0x0d17,
- 0x0d18, 0x0d19, 0x0d41, 0x0d42, 0x0d43, 0x0d50, 0x0d5f, 0x0d6d,
- 0x0d6e, 0x0d6f, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
- 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x041e, 0x041f, 0x0420, 0x0421,
- 0x048c, 0x048d, 0x04d3, 0x04d4, 0x04d5, 0x055c, 0x055d, 0x0572,
- 0x0573, 0x0574, 0x0575, 0x08de, 0x08df, 0x08fe, 0x08ff, 0x0996,
- 0x0a36, 0x0a37, 0x0b08, 0x0b09, 0x0b0a, 0x0b0b, 0x0b32, 0x0b33,
- 0x0b34, 0x0b35, 0x0b36, 0x0b37, 0x0b38, 0x0b39, 0x0bb0, 0x0bf7,
- 0x0bf8, 0x0bf9, 0x0bfa, 0x0bfb, 0x0bfc, 0x0bfd, 0x0bfe, 0x0bff,
- 0x1254, 0x1255, 0x1256, 0x1257, 0x1270, 0x1271, 0x1272, 0x1273,
- 0x1274, 0x1275, 0x12ab, 0x12ac, 0x12ad, 0x12ae, 0x12af, 0x12b0,
- 0x12b1, 0x1315, 0x1316, 0x1317, 0x13bf, 0x13c0, 0x13c1, 0x13c2,
- 0x13c3, 0x13c4, 0x13c5, 0x13c6, 0x13c7, 0x13c8, 0x13c9, 0x13ca,
- 0x13cb, 0x13cc, 0x13cd, 0x1a06, 0x1a07, 0x1a28, 0x1a29, 0x1a2a,
- 0x1a2b, 0x1a2c, 0x1a2d, 0x1a80, 0x1abb, 0x1abc, 0x1abd, 0x1ad8,
- 0x1ad9, 0x0094, 0x0095, 0x0096, 0x0097, 0x00a0, 0x00a1, 0x00a2,
- 0x00a3, 0x0831, 0x0832, 0x0833, 0x0834, 0x0835, 0x0836, 0x0837,
- 0x0838, 0x0839, 0x083a, 0x083b, 0x0939, 0x093a, 0x093b, 0x093c,
- 0x093d, 0x093e, 0x093f, 0x09a0, 0x09a1, 0x09a2, 0x09a3, 0x09a4,
- 0x09a5, 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2,
- 0x11b3, 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba,
- 0x11bb, 0x132f, 0x1454, 0x1455, 0x1456, 0x1457, 0x1458, 0x1459,
- 0x145a, 0x145b, 0x145c, 0x145d, 0x145e, 0x145f, 0x1460, 0x1461,
- 0x1462, 0x1463, 0x1464, 0x1465, 0x1466, 0x1467, 0x1468, 0x1469,
- 0x146a, 0x146b, 0x17de, 0x17df, 0x17e0, 0x17e1, 0x17e2, 0x17e3,
- 0x17e4, 0x17e5, 0x17e6, 0x17e7, 0x17e8, 0x17e9, 0x17ea, 0x17eb,
- 0x17ec, 0x17ed, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545,
- 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d,
- 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555,
- 0x2628, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c,
- 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2772, 0x2773, 0x2774,
- 0x2775, 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c,
- 0x277d, 0x3503, 0x3544, 0x3545, 0x3546, 0x3547, 0x3560, 0x3561,
- 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, 0x3569,
- 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, 0x3571,
- 0x3572, 0x3573, 0x3574, 0x3575, 0x03f0, 0x103d, 0x103e, 0x103f,
- 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047,
- 0x1048, 0x1049, 0x104a, 0x104b, 0x104c, 0x104d, 0x104e, 0x104f,
- 0x1050, 0x1051, 0x1052, 0x1053, 0x1054, 0x1055, 0x1056, 0x1057,
- 0x1058, 0x1059, 0x105a, 0x105b, 0x105c, 0x105d, 0x105e, 0x105f,
- 0x1060, 0x1061, 0x1270, 0x1271, 0x21b8, 0x21b9, 0x21ba, 0x21bb,
- 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x21f0, 0x21f1, 0x21f2, 0x21f3,
- 0x21f4, 0x21f5, 0x21f6, 0x21f7, 0x21f8, 0x21f9, 0x21fa, 0x21fb,
- 0x21fc, 0x21fd, 0x21fe, 0x21ff, 0x2340, 0x2341, 0x2342, 0x2343,
- 0x2344, 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b,
- 0x234c, 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353,
- 0x2354, 0x2355, 0x2356, 0x2357, 0x265c, 0x2f88, 0x2f89, 0x2f8a,
- 0x2f8b, 0x2f8c, 0x2f8d, 0x2f8e, 0x2f8f, 0x2f90, 0x2f91, 0x2f92,
- 0x2f93, 0x2f94, 0x2f95, 0x2f96, 0x2f97, 0x2f98, 0x2f99, 0x2f9a,
- 0x2f9b, 0x2f9c, 0x2f9d, 0x2f9e, 0x2f9f, 0x2fa0, 0x2fa1, 0x2fa2,
- 0x2fa3, 0x2fa4, 0x2fa5, 0x2fa6, 0x2fa7, 0x2fa8, 0x2fa9, 0x2faa,
- 0x2fab, 0x2fac, 0x2fad, 0x2fae, 0x2faf, 0x2fb0, 0x2fb1, 0x2fb2,
- 0x2fb3, 0x2fb4, 0x2fb5, 0x2fb6, 0x2fb7, 0x2fb8, 0x2fb9, 0x2fba,
- 0x2fbb, 0x4c52, 0x4c53, 0x4e28, 0x4e29, 0x4e2a, 0x4e2b, 0x4e2c,
- 0x4e2d, 0x4e2e, 0x4e2f, 0x4e30, 0x4e31, 0x4e32, 0x4e33, 0x4e34,
- 0x4e35, 0x4e36, 0x4e37, 0x4e38, 0x4e39, 0x4e3a, 0x4e3b, 0x4e3c,
- 0x4e3d, 0x4e3e, 0x4e3f, 0x4e80, 0x4e81, 0x4e82, 0x4e83, 0x4e84,
- 0x4e85, 0x4e86, 0x4e87, 0x4e88, 0x4e89, 0x4e8a, 0x4e8b, 0x4e8c,
- 0x4e8d, 0x4e8e, 0x4e8f, 0x4e90, 0x4e91, 0x4e92, 0x4e93, 0x4e94,
- 0x4e95, 0x4e96, 0x4e97, 0x4e98, 0x4e99, 0x4e9a, 0x4e9b, 0x4e9c,
- 0x4e9d, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea1, 0x4ea2, 0x4ea3, 0x4ea4,
- 0x4ea5, 0x4ea6, 0x4ea7, 0x4ea8, 0x4ea9, 0x4eaa, 0x4eab, 0x4eac,
- 0x4ead, 0x4eae, 0x4eaf, 0x4eb0, 0x4eb1, 0x4eb2, 0x4eb3, 0x4eb4,
- 0x4eb5, 0x4eb6, 0x4eb7, 0x4eb8, 0x4eb9, 0x4eba, 0x4ebb, 0x4ebc,
- 0x4ebd, 0x4ebe, 0x4ebf, 0x4ec0, 0x4ec1, 0x4ec2, 0x4ec3, 0x4ec4,
- 0x4ec5, 0x4ec6, 0x4ec7, 0x4ec8, 0x4ec9, 0x4eca, 0x4ecb, 0x6a04,
- 0x6a05, 0x07e2, 0x07e3, 0x07e4, 0x07e5, 0x07e6, 0x07e7, 0x07e8,
- 0x07e9, 0x07ea, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, 0x07f0,
- 0x07f1, 0x07f2, 0x07f3, 0x07f4, 0x07f5, 0x07f6, 0x07f7, 0x07f8,
- 0x07f9, 0x07fa, 0x07fb, 0x07fc, 0x07fd, 0x07fe, 0x07ff, 0x2000,
- 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008,
- 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x200e, 0x200f, 0x2010,
- 0x2011, 0x2012, 0x2013, 0x2014, 0x2015, 0x2016, 0x2017, 0x2018,
- 0x2019, 0x201a, 0x201b, 0x201c, 0x201d, 0x201e, 0x201f, 0x2020,
- 0x2021, 0x2022, 0x2023, 0x2024, 0x2025, 0x2026, 0x2027, 0x2028,
- 0x2029, 0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0x202f, 0x2030,
- 0x2031, 0x2032, 0x2033, 0x2034, 0x2035, 0x2036, 0x2037, 0x2038,
- 0x2039, 0x203a, 0x203b, 0x203c, 0x203d, 0x203e, 0x203f, 0x2040,
- 0x2041, 0x2042, 0x2043, 0x2044, 0x2045, 0x2046, 0x2047, 0x2048,
- 0x2049, 0x204a, 0x204b, 0x204c, 0x204d, 0x204e, 0x204f, 0x2050,
- 0x2051, 0x2052, 0x2053, 0x2054, 0x2055, 0x2056, 0x2057, 0x2058,
- 0x2059, 0x205a, 0x205b, 0x205c, 0x205d, 0x205e, 0x205f, 0x2060,
- 0x2061, 0x2062, 0x2063, 0x2064, 0x2065, 0x2066, 0x2067, 0x2068,
- 0x2069, 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f, 0x2070,
- 0x2071, 0x2072, 0x2073, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078,
- 0x2079, 0x4cba, 0x4cbb, 0x5d88, 0x5d89, 0x5d8a, 0x5d8b, 0x5d8c,
- 0x5d8d, 0x5d8e, 0x5d8f, 0x5db0, 0x5db1, 0x5db2, 0x5db3, 0x5db4,
- 0x5db5, 0x5db6, 0x5db7, 0x5db8, 0x5db9, 0x5dba, 0x5dbb, 0x5dbc,
- 0x5dbd, 0x5dbe, 0x5dbf, 0x5e40, 0x5e41, 0x5e42, 0x5e43, 0x5e44,
- 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x5e49, 0x5e4a, 0x5e4b, 0x5e4c,
- 0x5e4d, 0x5e4e, 0x5e4f, 0x5e50, 0x5e51, 0x5e52, 0x5e53, 0x5e54,
- 0x5e55, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, 0x5e5b, 0x5e5c,
- 0x5e5d, 0x5e5e, 0x5e5f, 0x5e60, 0x5e61, 0x5e62, 0x5e63, 0x5e64,
- 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c,
- 0x5e6d, 0x5e6e, 0x5e6f, 0x5e70, 0x5e71, 0x5e72, 0x5e73, 0x5e74,
- 0x5e75, 0x5e76, 0x5e77, 0x5e78, 0x5e79, 0x5e7a, 0x5e7b, 0x5e7c,
- 0x5e7d, 0x5e7e, 0x5e7f, 0x5e80, 0x5e81, 0x5e82, 0x5e83, 0x5e84,
- 0x5e85, 0x5e86, 0x5e87, 0x5e88, 0x5e89, 0x5e8a, 0x5e8b, 0x5e8c,
- 0x5e8d, 0x5e8e, 0x5e8f, 0x5e90, 0x5e91, 0x5e92, 0x5e93, 0x5e94,
- 0x5e95, 0x5e96, 0x5e97, 0x5e98, 0x5e99, 0x5e9a, 0x5e9b, 0x5e9c,
- 0x5e9d, 0x5e9e, 0x5e9f, 0x5ea0, 0x5ea1, 0x5ea2, 0x5ea3, 0x5ea4,
- 0x5ea5, 0x5ea6, 0x5ea7, 0x5ea8, 0x5ea9, 0x5eaa, 0x5eab, 0x5eac,
- 0x5ead, 0x5eae, 0x5eaf, 0x5eb0, 0x5eb1, 0x5eb2, 0x5eb3, 0x5eb4,
- 0x5eb5, 0x5eb6, 0x5eb7, 0x5eb8, 0x5eb9, 0x5eba, 0x5ebb, 0x5ebc,
- 0x5ebd, 0x5ebe, 0x5ebf, 0x5ec0, 0x5ec1, 0x5ec2, 0x5ec3, 0x5ec4,
- 0x5ec5, 0x5ec6, 0x5ec7, 0x5ec8, 0x5ec9, 0x5eca, 0x5ecb, 0x5ecc,
- 0x5ecd, 0x5ece, 0x5ecf, 0x5ed0, 0x5ed1, 0x5ed2, 0x5ed3, 0x5ed4,
- 0x5ed5, 0x5ed6, 0x5ed7, 0x5ed8, 0x5ed9, 0x5eda, 0x5edb, 0x5edc,
- 0x5edd, 0x5ede, 0x5edf, 0x5ee0, 0x5ee1, 0x5ee2, 0x5ee3, 0x5ee4,
- 0x5ee5, 0x5ee6, 0x5ee7, 0x5ee8, 0x5ee9, 0x5eea, 0x5eeb, 0x5eec,
- 0x5eed, 0x5eee, 0x5eef, 0x5ef0, 0x5ef1, 0x5ef2, 0x5ef3, 0x5ef4,
- 0x5ef5, 0x5ef6, 0x5ef7, 0x5ef8, 0x5ef9, 0x5efa, 0x5efb, 0x5efc,
- 0x5efd, 0x5efe, 0x5eff, 0x5f00, 0x5f01, 0x5f02, 0x5f03, 0x5f04,
- 0x5f05, 0x5f06, 0x5f07, 0x5f08, 0x5f09, 0x5f0a, 0x5f0b, 0x5f0c,
- 0x5f0d, 0x5f0e, 0x5f0f, 0x0000,
-};
-
-static const uint8_t table0_mv_bits[1100] = {
-  1,  4,  4,  4,  5,  5,  5,  6,
-  6,  6,  7,  7,  7,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17,  8,
-};
-
-static const uint8_t table0_mvx[1099] = {
- 32, 32, 31, 32, 33, 31, 33, 31,
- 33, 32, 34, 32, 30, 32, 31, 34,
- 35, 32, 34, 33, 29, 33, 30, 30,
- 31, 31, 35, 29, 33, 35, 33, 34,
- 31, 29, 30, 34, 30, 36, 28, 32,
- 34, 37, 30, 27, 32, 25, 39, 32,
- 34, 32, 35, 35, 35, 31, 35, 29,
- 32, 29, 30, 29, 37, 27, 36, 38,
- 37, 33, 32, 31, 29, 31, 28, 36,
- 33, 30, 34, 33, 33, 28, 27, 25,
- 31, 26, 39, 32, 32, 31, 33, 39,
- 31, 38, 28, 36, 21, 23, 43, 36,
- 34, 41, 30, 25, 28, 31, 30, 34,
- 38, 35, 61, 34, 28, 30, 37, 37,
- 35, 27, 36,  3, 59, 38, 37, 32,
- 31, 29, 26, 33, 37, 33, 27, 27,
- 35, 34, 34, 40, 42, 33, 32, 29,
-  4,  5, 28, 24, 25, 35, 39, 38,
- 32, 23, 27, 32, 30, 35, 26, 34,
- 60, 36, 29, 22, 26, 41,  7, 30,
- 38, 30, 36, 29, 30, 41, 26, 25,
- 32, 34, 24, 39,  1, 25, 39, 32,
- 28, 29, 32, 38, 26, 36, 28, 63,
- 28, 39, 23, 21, 26, 35, 31, 35,
- 57, 31, 29, 29, 28, 30, 27, 35,
-  2, 38, 40, 34, 37, 29, 38, 43,
- 26, 32, 33, 42, 24, 40, 28, 32,
- 32, 32, 36, 32, 43, 25, 21, 31,
- 30, 31, 41, 29, 33, 37, 26, 37,
- 27, 59, 23, 33, 35, 31, 31, 37,
- 38, 39, 32, 23, 32, 27, 37, 36,
- 31, 40, 25, 27, 38, 31, 36, 28,
- 31, 36, 25, 45,  3, 34, 38, 39,
- 40, 38, 30, 32, 19, 24, 25, 26,
- 45, 20, 24, 33, 33, 31, 41, 34,
- 39, 47, 40, 58, 59, 41, 33,  3,
- 17, 61, 42, 30, 26, 29, 36, 61,
- 33, 37, 62, 28, 25, 38, 25, 38,
- 17, 23, 34, 33, 21, 33, 49, 27,
- 32, 23, 27, 22, 24, 22, 39, 43,
- 27, 37,  6, 42, 47, 26, 30, 31,
- 41, 39, 33, 22, 45, 36, 32, 45,
- 19, 22, 30,  5,  5, 17, 29, 22,
- 31, 31, 43, 37, 27, 32, 32, 32,
- 33, 34, 43, 35, 29, 26, 22, 32,
- 19, 32, 25, 31, 41, 49, 28, 34,
- 28, 39, 34, 19, 37, 38, 29, 21,
- 36, 42, 24, 48, 16, 28, 49, 22,
- 34, 31, 38, 39, 44, 11, 35, 30,
- 33, 33, 23, 28, 33, 46, 15, 13,
- 24, 41, 24, 34, 34, 30, 26, 24,
- 14, 60, 21, 29, 39, 23, 35, 37,
- 63, 45, 33, 34, 47, 41, 22, 42,
- 35, 35, 23, 32, 35, 43, 32,  7,
- 31, 41, 20, 31, 16, 13, 63, 25,
- 30, 32, 35, 30, 30, 31, 42, 47,
- 39, 38, 40, 40, 51, 55, 56, 18,
- 21, 39, 39, 33, 17, 41, 23, 24,
- 43, 25, 31, 20, 19, 45,  1, 34,
- 31, 22, 35, 15, 46, 46, 35, 31,
- 28, 29, 29, 23, 41, 27, 14, 53,
- 53, 27, 24, 32, 57, 32, 17, 42,
- 37, 29, 33,  1, 25, 32, 32, 63,
- 26, 40, 44, 36, 31, 39, 20, 20,
- 44, 23, 33, 34, 35, 33, 33, 28,
- 41, 23, 41, 41, 29, 25, 26, 49,
- 29, 24, 37, 49, 50, 51, 51, 26,
- 39, 25, 26, 15, 39, 18, 42, 17,
-  4, 31, 32, 32, 60,  1, 42, 32,
-  0, 12, 19, 35, 21, 41, 17, 26,
- 20, 45, 46, 32, 37, 22, 47, 29,
- 31, 27, 29, 30, 21, 33, 35, 18,
- 25, 33, 50, 51, 42,  2, 15, 51,
- 53, 33, 25, 29, 55, 37, 38, 33,
- 38, 59, 38, 33, 39, 13, 32, 40,
- 61, 61, 32,  9, 44,  3, 31, 29,
- 25, 31, 27, 23,  9, 25,  9, 29,
- 20, 30, 30, 42, 18, 28, 25, 28,
- 28, 21, 29, 43, 29, 43, 26, 44,
- 44, 21, 38, 21, 24, 45, 45, 35,
- 39, 22, 35, 36, 34, 34, 45, 34,
- 29, 31, 46, 25, 46, 16, 17, 31,
- 20, 32, 47, 47, 47, 32, 49, 49,
- 49, 31,  1, 27, 28, 39, 39, 21,
- 36, 23, 51,  2, 40, 51, 32, 53,
- 24, 30, 24, 30, 21, 40, 57, 57,
- 31, 41, 58, 32, 12,  4, 32, 34,
- 59, 31, 32, 13,  9, 35, 26, 35,
- 37, 61, 37, 63, 26, 29, 41, 38,
- 23, 20, 41, 26, 41, 42, 42, 42,
- 26, 26, 26, 26,  1, 26, 37, 37,
- 37, 23, 34, 42, 27, 43, 34, 27,
- 31, 24, 33, 16,  3, 31, 24, 33,
- 24,  4, 44, 44, 11, 44, 31, 13,
- 13, 44, 45, 13, 25, 22, 38, 26,
- 38, 38, 39, 32, 30, 39, 30, 22,
- 32, 26, 30, 47, 47, 47, 19, 47,
- 30, 31, 35,  8, 23, 47, 47, 27,
- 35, 47, 31, 48, 35, 19, 36, 49,
- 49, 33, 31, 39, 27, 39, 49, 49,
- 50, 50, 50, 39, 31, 51, 51, 39,
- 28, 33, 33, 21, 40, 31, 52, 53,
- 40, 53,  9, 33, 31, 53, 54, 54,
- 54, 55, 55, 34, 15, 56, 25, 56,
- 21, 21, 40, 40, 25, 40, 58, 36,
-  5, 41, 41, 12, 60, 41, 41, 37,
- 22, 61, 18, 29, 29, 30, 61, 30,
- 61, 62, 62, 30, 30, 63, 18, 13,
- 30, 23, 19, 20, 20, 41, 13,  2,
-  5,  5,  1,  5, 32,  6, 32, 35,
- 20, 35, 27, 35, 35, 36, 36, 13,
- 36, 41, 41, 41,  3, 30, 42, 27,
- 20, 30, 27, 28, 30, 21, 33, 33,
- 14, 24, 30, 42, 24, 33, 25, 42,
- 43, 14, 43, 43, 14, 43,  7, 36,
- 37, 37, 37, 37,  7, 14, 25, 43,
- 43, 44, 15, 37,  7,  7,  3,  1,
-  8, 15, 15,  8, 44, 44, 44, 45,
- 45, 45, 45,  8,  8, 45, 21, 45,
- 28, 28, 28, 21, 28, 28, 22, 37,
- 46, 46, 37,  8, 29, 37, 29, 22,
- 46, 37, 22, 29, 47, 47, 38, 38,
- 16, 38, 38, 33, 38, 22, 47, 47,
- 29, 25, 16,  0, 48,  1, 34, 48,
- 48, 34, 25, 26, 26, 49, 49, 26,
-  1, 49,  4, 26,  4, 49,  1,  9,
- 49, 49, 49, 10, 49, 17, 38, 17,
- 17, 50, 38, 50, 50, 22, 38, 51,
- 38, 38, 51, 39, 39, 18, 22, 39,
- 51, 22, 52, 52, 52, 39, 53, 53,
- 10, 23, 18, 29, 10, 53, 29, 54,
- 11, 54, 11, 11, 55,  1, 18, 55,
- 55, 55, 55, 55, 55, 29, 34, 18,
- 29, 56, 56, 34, 57, 34, 34, 29,
- 29, 57, 57, 35, 35, 35, 35, 35,
- 39, 35, 59, 59, 18, 59, 39, 30,
- 18, 40, 60, 60, 61, 30, 18, 61,
- 61, 19, 19,
-};
-
-static const uint8_t table0_mvy[1099] = {
- 32, 31, 32, 33, 32, 31, 31, 33,
- 33, 34, 32, 30, 32, 35, 34, 31,
- 32, 29, 33, 30, 32, 34, 33, 31,
- 30, 35, 31, 31, 29, 33, 35, 30,
- 29, 33, 34, 34, 30, 32, 32, 36,
- 29, 32, 35, 32, 28, 32, 32, 27,
- 35, 37, 34, 29, 30, 36, 35, 34,
- 25, 30, 29, 35, 33, 31, 31, 32,
- 31, 28, 39, 28, 29, 37, 31, 33,
- 27, 36, 28, 36, 37, 33, 33, 31,
- 27, 32, 31, 38, 26, 25, 25, 33,
- 39, 31, 34, 30, 32, 32, 32, 34,
- 36, 32, 28, 33, 30, 38, 37, 27,
- 33, 28, 32, 37, 35, 38, 29, 34,
- 27, 29, 29, 32, 32, 34, 35,  3,
- 26, 36, 31, 38, 30, 26, 35, 34,
- 37, 26, 25, 32, 32, 39, 23, 37,
- 32, 32, 29, 32, 29, 36, 29, 30,
- 41, 31, 30, 21, 39, 25, 34, 38,
- 32, 35, 39, 32, 33, 33, 32, 27,
- 29, 25, 28, 27, 26, 31, 30, 35,
- 24, 24, 31, 34, 32, 30, 35, 40,
- 28, 38,  5, 35, 29, 36, 36, 32,
- 38, 30, 33, 31, 35, 26, 23, 38,
- 32, 41, 28, 25, 37, 40, 37, 39,
- 32, 36, 33, 39, 25, 26, 28, 31,
- 28, 42, 23, 31, 33, 31, 39,  1,
- 59, 22, 27,  4, 33, 34, 33, 24,
- 41,  3, 35, 41, 41, 28, 36, 36,
- 28, 33, 35, 21, 23, 21, 22, 37,
- 27, 27, 43, 29, 60, 39, 27, 25,
- 59, 34, 27, 27, 26, 40, 37, 27,
- 61, 26, 39, 33, 31, 22, 37, 25,
- 30, 25, 24, 61, 31, 34, 25, 38,
- 32, 32, 30,  3, 61, 43, 29, 23,
- 28, 32, 28, 32, 31, 34,  5, 33,
- 32, 33, 33, 42, 37, 23, 38, 31,
- 40, 26, 32, 26, 37, 38, 36, 24,
- 29, 30, 20, 22, 29, 24, 32, 41,
-  2, 34, 25, 33, 29, 31, 39, 35,
- 36, 24, 32, 30, 33, 27, 44, 60,
- 30, 36, 19, 34, 31, 24, 16, 35,
- 32, 38, 21, 33, 31, 31, 21, 35,
-  5, 17, 29, 38, 38, 18, 58, 19,
- 43, 41, 30, 41, 43, 39, 29,  7,
- 29, 17, 28, 19, 28, 31, 25, 19,
- 40, 26, 21, 33, 39, 23, 40, 30,
- 39, 34, 35, 32, 32, 24, 33, 30,
- 40, 47, 39, 37, 32, 33, 24, 23,
- 45, 47, 27, 23, 42, 32, 32, 33,
- 36, 37, 37, 17, 18, 22, 40, 38,
- 32, 31, 35, 24, 17, 25, 17, 23,
- 33, 34, 51, 42, 31, 36, 36, 29,
- 21, 22, 37, 44, 43, 25, 47, 33,
- 45, 27, 31, 58, 31, 32, 31, 38,
- 43, 20, 47, 45, 54,  1, 26, 34,
- 38, 14, 22, 24, 33, 34, 32, 32,
- 37, 21, 23, 49, 35, 23, 28, 39,
- 39, 23, 55, 33, 30, 30, 63, 16,
- 42, 28, 13, 33, 33, 35, 19, 46,
- 43, 17, 19, 36, 39, 24, 31, 32,
- 33, 26, 28, 62, 33, 63, 33, 39,
- 19, 49, 17, 31, 43, 13, 15, 29,
- 25, 35, 33, 23, 49, 41, 28, 29,
- 34, 38,  7, 61, 11, 50, 13, 41,
- 19, 47, 25, 26, 15, 42, 41, 29,
- 45, 27, 17, 35, 32, 29, 32, 24,
- 13, 26, 26, 31, 24, 33, 28, 30,
- 31, 11, 45, 46, 33, 33, 35, 57,
- 32, 32, 35, 45, 34, 11, 37, 42,
- 39, 37, 31, 49, 21, 27, 29, 47,
- 53, 40, 51, 16, 26,  1, 40, 30,
- 41, 44, 34, 25, 27, 31, 35, 35,
- 31, 15, 49,  1, 35, 40,  5, 58,
- 21, 29, 22, 59, 45, 31,  9, 26,
-  9, 29, 11, 32, 30,  3, 13, 20,
- 18, 20, 11,  3, 29, 40, 31, 53,
- 30, 17, 20, 37, 31, 42, 47, 47,
- 54, 38,  9, 34, 13, 37, 21, 25,
- 27, 43, 42, 45, 40, 25, 27, 46,
- 22, 25, 53, 20,  2, 14, 39, 15,
- 22, 44, 34, 21, 38, 33, 27, 48,
- 34, 52, 35, 47, 49, 54,  2, 13,
- 23, 52, 29, 45, 22, 49, 54, 21,
- 40, 42, 31, 30, 29, 34,  0, 25,
- 23, 51, 24, 59, 28, 38, 29, 31,
-  2, 13, 31,  8, 31, 33, 12, 45,
- 41,  7, 14, 30, 25, 18, 43, 20,
- 43, 35, 44,  1, 49, 42, 42, 18,
- 41, 38, 41, 44, 53, 11, 20, 25,
- 45, 46, 47, 48, 39, 52, 46, 49,
- 63, 55, 44, 38, 13, 13, 57, 22,
- 51, 16, 12, 28, 35, 57, 25, 20,
- 26, 28, 28, 29, 32, 31, 62, 34,
- 35, 35, 19, 49, 48, 39, 40, 18,
- 43, 46, 11,  6, 48, 19, 49, 41,
- 10, 23, 58, 17, 21, 23, 34, 30,
- 60,  0, 44, 34, 26, 37, 46, 43,
- 49, 59,  4, 34, 59, 37, 22, 25,
- 28, 46,  6, 40, 59, 42, 36, 61,
- 28, 30, 31, 43, 10, 22, 23, 47,
- 20, 52, 55, 36, 25, 16,  1, 11,
- 27, 29,  5, 63, 18, 41, 31, 34,
- 38,  1,  5, 13, 28, 31, 17, 38,
- 39, 41, 36, 37, 22, 39, 33, 43,
- 43, 15, 17, 49, 30, 21, 22, 20,
- 10, 17, 25, 54, 57,  3, 34,  8,
- 36, 25, 31, 14, 15, 19, 29, 25,
- 18, 39, 53, 22, 27, 20, 29, 33,
- 41, 42, 35, 62, 50, 29, 53, 50,
- 35, 55, 42, 61, 63,  4,  7, 42,
- 21, 46, 47, 49, 27, 46, 17, 55,
- 41, 50, 63,  4, 56, 18,  8, 10,
- 18, 51, 63, 36, 55, 18,  5, 55,
-  9, 29, 17, 21, 30, 27,  1, 59,
-  7, 11, 12, 15,  5, 42, 24, 41,
- 43,  7, 27, 22, 25, 31, 30, 37,
- 22, 39, 53, 29, 36, 37, 48,  0,
-  5, 13, 17, 31, 32, 26, 46, 28,
- 44, 45, 46, 53, 49, 51,  3, 41,
-  3, 22, 42, 33,  5, 45,  7, 22,
- 40, 53, 24, 14, 25, 27, 10, 12,
- 34, 16, 17, 53, 20, 26, 39, 45,
- 18, 45, 35, 33, 31, 49,  4, 39,
- 42, 11, 51,  5, 13, 26, 27, 17,
- 52, 30,  0, 22, 12, 34, 62, 36,
- 38, 41, 47, 30, 63, 38, 41, 43,
- 59, 33, 45, 37, 38, 40, 47, 24,
- 48, 49, 30,  1, 10, 22, 49, 15,
- 39, 59, 31, 32, 33, 18, 13, 15,
- 31, 21, 27, 44, 42, 39, 46, 17,
- 26, 32, 30, 31,  0, 30, 34,  9,
- 12, 13, 25, 31, 32, 55, 43, 35,
- 61, 33, 35, 46, 25, 47, 48, 62,
- 63, 38, 61,  1,  2,  5,  7,  9,
- 46, 10, 34, 35, 36, 55, 51,  7,
- 40, 23, 34, 37,  5, 13, 42, 18,
- 25, 27, 28,
-};
-
-/* motion vector table 1 */
-static const uint16_t table1_mv_code[1100] = {
- 0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c,
- 0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041,
- 0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069,
- 0x006b, 0x00a6, 0x00c1, 0x00cb, 0x00cc, 0x00ce, 0x00da, 0x00e8,
- 0x00ee, 0x0087, 0x0090, 0x009e, 0x009f, 0x00ba, 0x00ca, 0x00d8,
- 0x00db, 0x00df, 0x0104, 0x0109, 0x010c, 0x0143, 0x0145, 0x014a,
- 0x0156, 0x015c, 0x01b3, 0x01d3, 0x01da, 0x0103, 0x0109, 0x010b,
- 0x0122, 0x0127, 0x0134, 0x0161, 0x0164, 0x0176, 0x0184, 0x018d,
- 0x018e, 0x018f, 0x0190, 0x0193, 0x0196, 0x019d, 0x019e, 0x019f,
- 0x01a9, 0x01b2, 0x01b4, 0x01ba, 0x01bb, 0x01bc, 0x0201, 0x0202,
- 0x0205, 0x0207, 0x020d, 0x0210, 0x0211, 0x0215, 0x021b, 0x021f,
- 0x0281, 0x0285, 0x0290, 0x029c, 0x029d, 0x02a2, 0x02a7, 0x02a8,
- 0x02aa, 0x02b0, 0x02b1, 0x02b4, 0x02bc, 0x02bf, 0x0320, 0x0326,
- 0x0327, 0x0329, 0x032a, 0x0336, 0x0360, 0x0362, 0x0363, 0x0372,
- 0x03b2, 0x03bc, 0x03bd, 0x0203, 0x0205, 0x021a, 0x0249, 0x024a,
- 0x024c, 0x02c7, 0x02ca, 0x02ce, 0x02ef, 0x030d, 0x0322, 0x0325,
- 0x0338, 0x0373, 0x037a, 0x0409, 0x0415, 0x0416, 0x0418, 0x0428,
- 0x042d, 0x042f, 0x0434, 0x0508, 0x0509, 0x0510, 0x0511, 0x051c,
- 0x051e, 0x0524, 0x0541, 0x0543, 0x0546, 0x0547, 0x054d, 0x0557,
- 0x055f, 0x056a, 0x056c, 0x056d, 0x056f, 0x0576, 0x0577, 0x057a,
- 0x057b, 0x057c, 0x057d, 0x0600, 0x0601, 0x0603, 0x0614, 0x0616,
- 0x0617, 0x061c, 0x061f, 0x0642, 0x0648, 0x0649, 0x064a, 0x064b,
- 0x0657, 0x0668, 0x0669, 0x066b, 0x066e, 0x067f, 0x06c2, 0x06c8,
- 0x06cb, 0x06de, 0x06df, 0x06e2, 0x06e3, 0x06ef, 0x0748, 0x074b,
- 0x076e, 0x076f, 0x077c, 0x0409, 0x0423, 0x0428, 0x0429, 0x042a,
- 0x042b, 0x0432, 0x0433, 0x0496, 0x049a, 0x04d5, 0x04db, 0x0581,
- 0x0582, 0x058b, 0x058c, 0x058d, 0x0598, 0x0599, 0x059a, 0x059e,
- 0x05dd, 0x0619, 0x0632, 0x0633, 0x0648, 0x0672, 0x06a1, 0x06a2,
- 0x06a3, 0x06af, 0x06e2, 0x06e3, 0x06e4, 0x0800, 0x0801, 0x0802,
- 0x0803, 0x081a, 0x081b, 0x0829, 0x082f, 0x0832, 0x083e, 0x083f,
- 0x0852, 0x0853, 0x0858, 0x086b, 0x0877, 0x0878, 0x0879, 0x087a,
- 0x087b, 0x0a00, 0x0a01, 0x0a0d, 0x0a0e, 0x0a0f, 0x0a24, 0x0a37,
- 0x0a3a, 0x0a3b, 0x0a3e, 0x0a46, 0x0a47, 0x0a4a, 0x0a4b, 0x0a5f,
- 0x0a79, 0x0a7a, 0x0a7b, 0x0a80, 0x0a81, 0x0a84, 0x0a85, 0x0a99,
- 0x0aa5, 0x0aa6, 0x0ab8, 0x0aba, 0x0abb, 0x0abc, 0x0abd, 0x0ac8,
- 0x0ace, 0x0acf, 0x0ad7, 0x0adc, 0x0aeb, 0x0c04, 0x0c25, 0x0c26,
- 0x0c27, 0x0c2a, 0x0c2b, 0x0c3a, 0x0c3b, 0x0c3c, 0x0c3d, 0x0ca0,
- 0x0cad, 0x0cd4, 0x0cd5, 0x0cfc, 0x0cfd, 0x0d86, 0x0d92, 0x0d93,
- 0x0d94, 0x0d95, 0x0db0, 0x0db8, 0x0db9, 0x0dba, 0x0dbb, 0x0dc0,
- 0x0dc2, 0x0dc3, 0x0dda, 0x0ddb, 0x0ddc, 0x0ddd, 0x0e92, 0x0e93,
- 0x0e94, 0x0e95, 0x0ec7, 0x0ecc, 0x0ece, 0x0ecf, 0x0ed8, 0x0ed9,
- 0x0eda, 0x0edb, 0x0808, 0x0809, 0x080a, 0x0810, 0x0811, 0x0844,
- 0x0845, 0x0861, 0x0862, 0x0863, 0x086c, 0x0922, 0x0923, 0x092e,
- 0x092f, 0x0936, 0x0937, 0x09b1, 0x09b2, 0x09b3, 0x09b4, 0x09b5,
- 0x09b8, 0x09b9, 0x09ba, 0x09bb, 0x09bc, 0x09bd, 0x09be, 0x09bf,
- 0x0b00, 0x0b15, 0x0b2c, 0x0b2d, 0x0b2e, 0x0b2f, 0x0b36, 0x0bb9,
- 0x0c28, 0x0c2a, 0x0c2b, 0x0c2c, 0x0c2d, 0x0c2e, 0x0c2f, 0x0c30,
- 0x0c31, 0x0c38, 0x0c60, 0x0c61, 0x0c62, 0x0c63, 0x0c8d, 0x0c8e,
- 0x0c8f, 0x0c92, 0x0cbe, 0x0cbf, 0x0ce6, 0x0ce7, 0x0d40, 0x0d41,
- 0x0d57, 0x0d58, 0x0d59, 0x0d5a, 0x0d5b, 0x0d5c, 0x0d5d, 0x0d98,
- 0x0d99, 0x0d9a, 0x0d9b, 0x0d9c, 0x0d9d, 0x0dad, 0x0dae, 0x0daf,
- 0x0dc0, 0x0dc1, 0x0dc2, 0x0dc3, 0x0dca, 0x0dcb, 0x0dec, 0x0ded,
- 0x0dee, 0x0def, 0x1018, 0x1022, 0x1023, 0x1030, 0x1031, 0x1032,
- 0x1033, 0x1050, 0x1051, 0x105c, 0x1074, 0x1075, 0x1076, 0x1077,
- 0x1078, 0x1079, 0x107a, 0x107b, 0x10b2, 0x10b3, 0x10b8, 0x10b9,
- 0x10ba, 0x10bb, 0x10d4, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x1404,
- 0x1405, 0x1406, 0x1407, 0x1410, 0x1411, 0x1412, 0x1413, 0x1414,
- 0x1415, 0x1416, 0x1417, 0x1418, 0x1419, 0x1466, 0x1467, 0x1468,
- 0x1469, 0x146a, 0x146b, 0x146c, 0x146d, 0x147e, 0x147f, 0x1488,
- 0x1489, 0x148a, 0x148b, 0x14b6, 0x14b7, 0x14b8, 0x14b9, 0x14ba,
- 0x14bb, 0x14bc, 0x14bd, 0x14f0, 0x14f1, 0x14f8, 0x14f9, 0x14fa,
- 0x14fb, 0x14fc, 0x14fd, 0x14fe, 0x14ff, 0x152a, 0x152b, 0x152c,
- 0x152d, 0x152e, 0x152f, 0x1530, 0x1531, 0x1548, 0x1549, 0x154e,
- 0x154f, 0x1558, 0x1559, 0x155a, 0x155b, 0x1572, 0x159a, 0x159b,
- 0x15ac, 0x15ba, 0x15bb, 0x15d0, 0x15d1, 0x15d2, 0x15d3, 0x15d4,
- 0x15d5, 0x181d, 0x181e, 0x181f, 0x1840, 0x1841, 0x1842, 0x1843,
- 0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x1861, 0x1862,
- 0x1863, 0x1864, 0x1865, 0x1866, 0x1867, 0x1868, 0x1869, 0x186a,
- 0x186b, 0x186c, 0x186d, 0x186e, 0x191b, 0x191c, 0x191d, 0x191e,
- 0x191f, 0x1942, 0x1943, 0x1944, 0x1945, 0x1946, 0x1947, 0x1958,
- 0x1959, 0x19ed, 0x19ee, 0x19ef, 0x19f0, 0x19f1, 0x19f2, 0x19f3,
- 0x19f4, 0x19f5, 0x19f6, 0x19f7, 0x1b0e, 0x1b0f, 0x1b62, 0x1b63,
- 0x1b64, 0x1b65, 0x1b66, 0x1b67, 0x1b68, 0x1b69, 0x1b6a, 0x1b6b,
- 0x1b6c, 0x1b6d, 0x1b6e, 0x1b6f, 0x1b82, 0x1ba8, 0x1ba9, 0x1baa,
- 0x1bab, 0x1bac, 0x1bad, 0x1bae, 0x1baf, 0x1bb0, 0x1bb1, 0x1bb2,
- 0x1bb3, 0x1d80, 0x1d81, 0x1d82, 0x1d83, 0x1d84, 0x1d85, 0x1d86,
- 0x1d87, 0x1d88, 0x1d89, 0x1d8a, 0x1d8b, 0x1d8c, 0x1d8d, 0x1007,
- 0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x100e, 0x100f,
- 0x1016, 0x1080, 0x1081, 0x1082, 0x1083, 0x1084, 0x1085, 0x1086,
- 0x1087, 0x10c0, 0x123a, 0x123b, 0x123c, 0x123d, 0x123e, 0x123f,
- 0x1240, 0x1241, 0x1242, 0x1243, 0x1350, 0x1352, 0x1353, 0x1358,
- 0x1359, 0x135a, 0x135b, 0x135c, 0x135d, 0x135e, 0x135f, 0x1360,
- 0x1361, 0x1602, 0x1603, 0x160c, 0x160d, 0x160e, 0x160f, 0x1620,
- 0x1621, 0x1622, 0x1623, 0x1624, 0x1625, 0x1626, 0x1627, 0x1628,
- 0x1629, 0x166e, 0x166f, 0x167c, 0x167d, 0x167e, 0x167f, 0x1770,
- 0x1771, 0x1852, 0x1853, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876,
- 0x1877, 0x1878, 0x1879, 0x187a, 0x187b, 0x187c, 0x187d, 0x187e,
- 0x187f, 0x1918, 0x1919, 0x1926, 0x1927, 0x1970, 0x1971, 0x1972,
- 0x1973, 0x1974, 0x1975, 0x1976, 0x1977, 0x1978, 0x1979, 0x197a,
- 0x197b, 0x1aa0, 0x1aa1, 0x1aa2, 0x1aa3, 0x1aa4, 0x1aa5, 0x1aa6,
- 0x1aa7, 0x1aa8, 0x1aa9, 0x1aaa, 0x1aab, 0x1aac, 0x1aad, 0x1b3c,
- 0x1b3d, 0x1b3e, 0x1b3f, 0x1b50, 0x1b51, 0x1b52, 0x1b53, 0x1b54,
- 0x1b55, 0x1b56, 0x1b57, 0x1b58, 0x1b59, 0x2032, 0x2033, 0x2034,
- 0x2035, 0x2036, 0x2037, 0x2038, 0x2039, 0x203a, 0x203b, 0x203c,
- 0x203d, 0x203e, 0x203f, 0x2040, 0x2041, 0x2042, 0x2043, 0x20ba,
- 0x20bb, 0x20cc, 0x20cd, 0x20ce, 0x20cf, 0x20e0, 0x20e1, 0x20e2,
- 0x20e3, 0x20e4, 0x20e5, 0x20e6, 0x20e7, 0x21aa, 0x21ab, 0x21c0,
- 0x21c1, 0x21c2, 0x21c3, 0x21c4, 0x21c5, 0x21c6, 0x21c7, 0x21c8,
- 0x21c9, 0x21ca, 0x21cb, 0x21cc, 0x21cd, 0x21ce, 0x21cf, 0x21d0,
- 0x21d1, 0x21d2, 0x21d3, 0x2894, 0x2895, 0x2896, 0x2897, 0x2898,
- 0x2899, 0x289a, 0x289b, 0x289c, 0x289d, 0x289e, 0x289f, 0x28c0,
- 0x28c1, 0x28c2, 0x28c3, 0x28c4, 0x28c5, 0x28c6, 0x28c7, 0x28c8,
- 0x28c9, 0x28ca, 0x28cb, 0x2930, 0x2931, 0x2932, 0x2933, 0x2934,
- 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c,
- 0x293d, 0x293e, 0x293f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964,
- 0x2965, 0x2966, 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x2a40,
- 0x2a41, 0x2a42, 0x2a43, 0x2a44, 0x2a45, 0x2a46, 0x2a47, 0x2a48,
- 0x2a49, 0x2a4a, 0x2a4b, 0x2a4c, 0x2a4d, 0x2a4e, 0x2a4f, 0x2a50,
- 0x2a51, 0x2a52, 0x2a53, 0x2ae6, 0x2ae7, 0x2b24, 0x2b25, 0x2b26,
- 0x2b27, 0x2b28, 0x2b29, 0x2b2a, 0x2b2b, 0x2b2c, 0x2b2d, 0x2b2e,
- 0x2b2f, 0x2b30, 0x2b31, 0x2b32, 0x2b33, 0x2b5a, 0x2b5b, 0x3014,
- 0x3015, 0x3016, 0x3017, 0x3020, 0x3021, 0x3022, 0x3023, 0x3024,
- 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c,
- 0x302d, 0x302e, 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034,
- 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, 0x30c0, 0x30c1, 0x30de,
- 0x30df, 0x3218, 0x3219, 0x321a, 0x321b, 0x321c, 0x321d, 0x321e,
- 0x321f, 0x3220, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226,
- 0x3227, 0x3228, 0x3229, 0x322a, 0x322b, 0x322c, 0x322d, 0x322e,
- 0x322f, 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3378,
- 0x3379, 0x337a, 0x337b, 0x337c, 0x337d, 0x337e, 0x337f, 0x33c0,
- 0x33c1, 0x33c2, 0x33c3, 0x33c4, 0x33c5, 0x33c6, 0x33c7, 0x33c8,
- 0x33c9, 0x33ca, 0x33cb, 0x33cc, 0x33cd, 0x33ce, 0x33cf, 0x33d0,
- 0x33d1, 0x33d2, 0x33d3, 0x33d4, 0x33d5, 0x33d6, 0x33d7, 0x33d8,
- 0x33d9, 0x3706, 0x3707, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734,
- 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c,
- 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744,
- 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c,
- 0x374d, 0x374e, 0x374f, 0x3b34, 0x3b35, 0x3b36, 0x3b37, 0x3be8,
- 0x3be9, 0x3bea, 0x3beb, 0x3bec, 0x3bed, 0x3bee, 0x3bef, 0x3bf0,
- 0x3bf1, 0x3bf2, 0x3bf3, 0x3bf4, 0x3bf5, 0x3bf6, 0x3bf7, 0x3bf8,
- 0x3bf9, 0x3bfa, 0x3bfb, 0x3bfc, 0x3bfd, 0x3bfe, 0x3bff, 0x2000,
- 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008,
- 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x202e, 0x202f, 0x2182,
- 0x2183, 0x21b4, 0x21b5, 0x21b6, 0x21b7, 0x21b8, 0x21b9, 0x21ba,
- 0x21bb, 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x2460, 0x2461, 0x2462,
- 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a,
- 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472,
- 0x2473, 0x26a2, 0x26a3, 0x000b,
-};
-
-static const uint8_t table1_mv_bits[1100] = {
-  2,  4,  4,  4,  5,  5,  5,  5,
-  6,  6,  7,  7,  7,  7,  7,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15,  4,
-};
-
-static const uint8_t table1_mvx[1099] = {
- 32, 31, 32, 31, 33, 32, 33, 33,
- 31, 34, 30, 32, 32, 34, 35, 32,
- 34, 33, 29, 30, 30, 32, 31, 31,
- 33, 35, 35, 33, 31, 29, 29, 33,
- 34, 30, 31, 28, 36, 30, 34, 32,
- 32, 37, 32, 32, 25, 27, 39, 32,
- 32, 32, 38, 35, 36, 32, 37, 61,
- 26, 32, 34, 35,  3, 35, 27, 28,
- 29, 34, 28, 37, 31, 36, 32, 27,
- 31, 30, 29, 39, 33, 29, 33, 35,
- 25, 25, 29, 33, 31, 31, 31, 33,
- 32, 30, 32, 32, 41, 39, 33, 36,
- 32, 28, 34, 36, 38, 24, 60, 31,
- 23, 28, 32, 33, 59, 32, 40, 30,
-  5, 34, 32, 38, 32, 30, 43,  4,
- 32, 32, 42, 31, 31, 32, 26, 38,
- 26, 22, 21, 37, 61, 63, 37, 31,
- 32, 33,  2,  1, 23, 33, 41, 27,
- 35, 30, 38, 23, 33,  3, 28, 34,
- 34, 27, 41, 29, 39, 35, 36, 29,
- 32, 27, 30, 32, 24, 61, 37, 26,
- 59, 25, 35, 27, 36, 37, 30, 31,
- 34, 40,  3, 28, 34, 39, 32, 31,
- 32, 30, 24, 28, 35, 36, 26, 32,
- 31, 33, 29, 33, 39, 25, 30, 24,
- 35, 59, 29, 34, 25, 30, 21, 35,
- 43, 40, 32, 29,  5, 28, 31, 62,
- 33, 33, 25, 31, 21, 31, 43, 31,
- 34, 33, 20, 40, 39, 31, 31, 57,
- 38, 32, 42, 33, 32, 31, 32, 29,
- 30, 44,  5, 31, 22, 34, 36, 17,
- 38, 58, 38, 35, 32, 60, 35, 24,
- 32, 38, 16, 45, 42, 32, 31, 29,
-  4, 30, 17, 40, 46, 48, 63, 32,
- 42, 19, 41, 22, 28, 36, 45, 33,
- 33, 32, 29,  7, 41, 42, 18, 33,
- 33, 32, 22, 37,  1, 26, 22, 23,
- 49, 28, 26, 27, 32, 33, 27, 23,
- 28, 36, 15,  6, 34, 27, 31, 26,
- 23,  2, 33, 32, 34, 41, 28, 32,
- 41,  0, 36, 38, 34, 31, 47, 32,
- 17, 31, 39, 33, 37, 51, 30, 47,
- 32, 50, 32, 19, 63, 30, 25, 27,
- 33, 62, 24, 31, 27, 30, 37, 31,
- 45, 32, 39, 20, 46, 47, 35, 19,
- 34,  1, 49, 21, 21, 14, 51, 26,
- 23, 31, 36, 35, 58, 29, 29, 21,
- 20, 42, 13, 28, 12, 40, 31, 33,
- 39, 60, 32, 44, 33, 31, 28, 37,
- 29, 32, 30, 49, 43, 28, 39, 25,
- 32, 48,  2, 15, 20, 25, 31, 28,
- 21, 24, 25, 15, 31, 17, 37, 43,
- 18, 32, 33, 24, 33, 36, 13, 33,
- 31, 39, 11, 31, 33, 32, 39, 37,
- 32, 32, 29, 17, 44, 46, 36, 35,
- 26, 37, 58, 32, 34, 38,  8, 38,
- 38, 22, 29, 25, 16, 35, 32, 35,
- 33, 43, 18, 46, 38, 50, 33, 18,
- 53, 60, 13, 32, 36, 33, 51, 36,
- 43, 45, 27, 42, 29, 24, 30, 25,
- 31, 52, 31, 35, 38,  9, 22, 34,
-  4, 17, 28, 55, 42, 25, 17, 20,
- 47, 34, 33, 16, 40, 25, 16, 30,
- 53, 29, 10, 11, 14, 26, 33,  4,
- 35, 44, 26, 16, 31, 26, 34, 38,
- 29, 31, 30, 24, 22, 61, 32,  9,
- 45, 34, 31, 19,  9, 31, 46, 31,
- 35, 54, 29, 57, 30, 50,  3, 31,
- 63, 34, 47, 41, 51, 18, 31, 14,
- 37, 38, 31, 24, 32, 31, 50, 33,
- 31, 54, 27,  9, 33, 23, 19, 32,
- 29, 29, 33, 28, 47, 49, 30, 47,
- 33, 27, 25, 54, 44, 45, 50, 58,
- 51, 48, 33, 59, 33, 34, 57, 13,
- 26, 33, 13, 48, 30, 11,  7, 56,
- 34, 55, 26,  0, 26, 35,  1, 51,
- 33, 53, 31, 45, 12, 29, 29, 51,
- 31, 48,  2,  6, 34, 30, 28, 33,
- 60, 40, 27, 46, 31,  9, 35, 29,
- 31, 39, 55, 46, 19, 37, 62, 34,
- 30, 16, 19, 49, 41, 41, 39, 37,
- 14,  5, 13, 35, 55, 30, 40, 40,
- 42,  8, 20, 25, 45, 35, 33, 36,
- 54, 38, 27, 37, 62, 40, 15, 59,
- 49, 31, 29, 34, 34, 39, 24, 29,
- 25, 29, 21, 29, 10, 61, 33, 49,
- 35, 34,  3, 38, 39, 29,  7, 41,
-  1, 35,  4, 23, 15, 23, 11, 37,
- 28, 35, 30, 30, 24,  1, 43, 56,
-  8, 34, 42, 24, 45, 30, 20, 23,
-  8, 38, 22, 33, 17, 52, 34, 22,
- 53, 43, 44,  1, 27, 31, 41, 43,
- 41, 30, 31, 36, 30,  5, 55, 31,
- 33, 30, 40, 23, 15, 29, 34, 34,
- 59, 34, 30, 11, 13, 38,  5,  0,
- 30, 42,  5, 30, 29, 34, 10, 44,
- 30, 63, 35, 12,  3, 26, 15, 17,
- 25, 34, 43, 39, 34, 56, 29, 23,
- 30, 12, 30, 10, 35,  9, 24, 58,
- 10, 12, 54, 33, 37, 20, 41, 35,
- 29, 18, 61, 30, 40, 24, 39, 53,
- 62, 26, 29, 33, 34, 53, 49, 21,
- 27, 11, 63, 20, 26, 23,  7, 13,
-  6, 47, 29, 30,  9, 51, 22, 34,
- 21, 25, 33, 56, 57, 30, 38, 51,
- 51, 38, 63, 28, 40, 35, 33, 18,
- 33, 33, 24, 58, 58, 34, 49, 29,
- 43,  4,  1,  4, 42, 35, 35, 30,
- 17,  5, 56, 61, 25, 37, 36, 55,
- 28, 35, 29, 50, 48, 52,  2, 42,
- 34, 40, 46, 46, 43, 35, 29, 48,
- 20, 29, 31, 41,  7, 30, 35, 19,
- 14, 21,  8, 39, 39, 40, 46, 55,
- 34,  6, 30, 34, 37, 25, 37, 33,
- 22, 44, 52, 17, 35, 29, 36, 35,
- 40, 37, 28, 30, 50, 14, 28, 55,
-  6, 23, 19, 14, 30,  3, 30, 28,
- 28, 61, 61, 47, 45, 48, 40, 40,
- 34, 34, 25, 30, 29, 35,  4, 26,
- 53, 50, 26, 41, 27, 59, 27, 38,
- 39,  3, 50, 43, 47, 23, 33, 55,
- 35, 21, 23, 35, 61, 33, 46, 52,
- 35, 34, 24, 30, 43, 16, 37, 21,
-  2, 24, 45, 34, 30, 55, 55,  1,
- 29, 29, 26, 28, 25, 31, 36, 22,
- 17, 30, 52,  2, 44, 44, 57, 26,
- 62, 41, 39, 57, 26, 46, 49, 11,
- 16, 19,  5, 59, 38, 39, 58, 38,
- 25, 49, 50, 22, 28, 59,  9, 59,
-  7, 28, 55, 17,  4, 35, 50, 21,
- 29, 44, 47, 18, 24, 19, 25, 42,
- 35,  3, 51, 35, 16, 35, 30, 63,
- 57, 39, 39, 25, 35, 38,  9, 16,
- 36, 45, 31, 60, 14, 34, 42, 24,
-  0, 37, 18, 61, 57, 37, 28, 53,
- 20, 46, 14, 47, 38, 38, 38,  9,
- 34, 39, 43, 17, 39, 59,  5, 27,
-  0, 12, 27,
-};
-
-static const uint8_t table1_mvy[1099] = {
- 32, 32, 31, 31, 32, 33, 31, 33,
- 33, 32, 32, 30, 34, 31, 32, 29,
- 33, 30, 32, 33, 31, 35, 34, 30,
- 34, 31, 33, 29, 29, 31, 33, 35,
- 30, 30, 35, 32, 32, 34, 34, 28,
- 25, 32, 36, 27, 32, 32, 32, 37,
- 39,  3, 32, 30, 31, 26, 31, 32,
- 32, 38, 29, 29, 32, 34, 31, 31,
- 34, 35, 33, 33, 28, 33,  1, 33,
- 27, 29, 30, 31, 28, 29, 37, 35,
- 31, 33, 35, 27, 36, 37, 25, 25,
- 61, 35,  4,  5, 32, 33, 36, 30,
- 23, 30, 28, 34, 31, 32, 32, 39,
- 32, 34, 21, 39, 32, 59, 32, 28,
- 32, 36, 60, 33, 24, 36, 32, 32,
- 41,  2, 32, 38, 26, 22, 33, 30,
- 31, 32, 32, 30, 31, 32, 29,  3,
- 40, 38, 32, 32, 33, 26, 31, 34,
- 28, 38, 34, 31,  3, 31, 35, 38,
- 27, 35, 33, 28, 29, 27, 29, 27,
- 43, 29, 37, 63, 31, 33, 34, 30,
- 31, 30, 37, 30, 35, 35, 26, 41,
- 37, 31, 33, 28, 26, 30, 42, 24,
-  7, 27, 33, 29, 36, 28, 34, 57,
- 23, 41, 36, 23, 35, 34, 25, 30,
- 25, 33, 25, 25, 29, 24, 33, 39,
- 33, 33,  0, 37, 31, 36, 21, 32,
- 61, 24, 35, 61, 31,  5, 31, 59,
- 39, 21, 32, 30, 34, 22, 40, 32,
- 29, 16, 31,  5, 62,  2, 20, 39,
- 39, 32, 33,  1, 31, 24, 36, 32,
- 36, 32, 28, 26,  6, 31, 38, 34,
- 58, 35, 32, 33, 33, 17, 43, 26,
- 31, 40, 31, 34, 32, 32, 31, 19,
- 30, 32, 29, 33, 38, 38, 32, 59,
- 40, 18, 38, 32, 35, 34, 32, 17,
-  1, 15, 30, 28, 31, 28, 34, 29,
- 32, 27, 35, 27, 49, 22, 37, 34,
- 37, 26, 32, 32, 22, 28, 45, 29,
- 30, 31, 43, 46, 41, 30, 26, 13,
- 34, 32, 27, 38, 42, 42, 33, 47,
- 33, 60, 27, 42, 25, 32, 22, 32,
- 48, 32, 45, 33, 33, 41, 27, 25,
- 19, 31, 35, 19, 36, 42, 27, 17,
- 31, 44, 28, 33, 33, 31, 23, 31,
- 40, 33, 31, 34, 30, 32, 33, 36,
- 35, 47, 37, 41, 31, 23, 41, 29,
- 30, 35, 32, 25, 32, 28, 58,  2,
- 37, 33, 14, 33, 49, 20, 39, 36,
- 21,  9, 23, 33, 35, 24, 39, 37,
- 11, 33, 30, 31, 31, 28, 51, 40,
- 35, 29, 25, 33, 46, 35, 37, 30,
- 30,  8, 63, 28, 15, 40, 33, 45,
- 49, 25, 32,  4, 47, 51, 36, 39,
- 53, 10, 24, 29, 30, 31, 25, 40,
- 38, 38, 33, 56, 23, 27, 32, 37,
- 26, 29, 43, 36, 33, 24, 55, 43,
-  9, 29, 34, 34, 24, 33, 18, 33,
- 33, 30, 31, 50, 24, 60, 30, 39,
- 34, 30, 39, 28, 22, 38,  2, 26,
- 63, 32, 57, 21, 39, 33, 28, 18,
- 30, 34, 22, 33, 29, 41, 30, 34,
- 35, 21, 13, 34, 35, 39, 30, 46,
- 32, 42, 32, 31, 33, 26, 11, 33,
- 22, 31, 25, 31, 53, 27, 43, 25,
- 40, 50, 21, 36, 38, 30, 12, 31,
- 34, 20, 15, 29, 32, 62, 30, 13,
- 17, 32, 19, 31, 20, 31, 30,  7,
-  1, 17, 34, 37, 31, 31, 44, 34,
- 26, 40, 16, 37, 52, 48, 30, 20,
- 18, 33, 38, 29,  7, 25, 30, 54,
- 45, 47, 46, 41, 29, 29, 16, 30,
- 14, 26, 38, 34, 34, 29, 34, 30,
- 29, 30, 57, 30,  4, 46, 33, 29,
- 39, 44, 30, 31, 50, 33, 31, 32,
- 19, 32, 40, 31, 37, 47,  1, 35,
- 16, 31,  0, 35, 33,  1, 17, 34,
-  9, 34, 33, 31, 49, 43, 42, 51,
- 34, 29, 23, 29, 14, 30, 45, 49,
- 11, 24, 31, 28, 35, 41, 30, 44,
- 18, 29, 34, 35, 36, 25, 26, 21,
- 31, 30, 34, 19, 34, 44, 36, 38,
- 25, 31, 28, 23, 37,  3, 55, 41,
- 30, 22, 41, 24, 33, 26, 35, 35,
- 30, 55, 51, 47, 48, 38, 24, 15,
- 21, 50, 25, 46, 30, 29, 10, 34,
- 42, 45, 29, 42, 22,  3, 33, 27,
- 34,  1, 34, 28, 34, 36, 35, 23,
- 23, 13, 58,  3, 26, 63, 25, 31,
- 34, 61, 38, 39, 25, 61, 29, 37,
- 30, 41, 26, 48, 28, 33, 50, 35,
- 30, 37, 29, 29, 40,  6, 39, 28,
- 28, 19,  8, 22, 45, 34, 35, 10,
- 58, 17, 37, 39, 30, 18, 54, 14,
- 29, 16, 59, 30, 35, 23, 35, 30,
- 47, 36, 29, 55, 20, 12, 31, 35,
- 14, 29, 18, 34, 34, 24, 29, 26,
- 22,  2, 27, 23,  8, 30, 55, 38,
- 60, 31,  4, 34, 49, 34, 27, 34,
- 33, 30, 31, 54, 42, 35, 38, 46,
- 44, 26, 27,  9, 39, 25, 21, 29,
- 28, 42, 13,  0,  5, 34, 37, 28,
- 24, 29, 63, 26, 22, 27, 29, 25,
- 33, 25, 61,  0, 35, 25, 36, 15,
- 27, 40, 53, 33,  3, 10, 16, 37,
- 38, 18, 30, 46, 27,  9,  6, 29,
- 62,  8, 42, 28, 29,  3, 25, 16,
- 26, 29, 35, 28, 27, 51, 61, 48,
- 37,  9, 34,  7, 49, 45, 20, 29,
- 21,  5,  5, 29, 28, 34, 29, 24,
- 10, 24, 35, 36, 38, 55, 11, 36,
- 38, 53, 54, 26, 30, 49, 20, 27,
- 30, 39, 33, 41, 49, 22, 38, 38,
-  4, 30,  8,  9,  3, 24, 22, 50,
- 37, 36, 31, 27,  2,  9, 42, 63,
- 25, 19, 44,  1, 28, 28, 48, 30,
- 34, 41, 41, 38, 12, 27, 15,  0,
- 16, 34, 35, 38, 28, 29, 40, 42,
- 51, 52, 45, 54, 59, 59, 42, 44,
- 37, 26, 46, 24, 15, 39, 22, 46,
- 19, 35, 38, 17, 37, 23, 52, 55,
- 50, 37, 26, 11, 37, 12, 24, 30,
- 16, 13, 22, 13, 36, 35, 40, 41,
- 34, 41, 26, 53, 51,  5, 21, 30,
-  2, 63, 41, 20,  1, 56, 21, 24,
- 25,  5, 28, 35, 26, 28, 30, 18,
- 29, 23, 40, 34, 20, 42, 39, 34,
- 28, 61, 38, 27, 62,  9, 36, 17,
-  9, 49, 24, 25, 54, 34, 39, 37,
-  3,  1, 25, 38, 38, 44, 35, 36,
- 12, 60, 36, 38, 40, 25, 43, 39,
- 53, 28, 39, 57, 46, 10, 52, 27,
- 35, 42, 45, 59, 15, 60, 38, 24,
- 23, 39, 12, 29, 24,  0, 20, 16,
- 28, 43, 35, 28,  1, 49,  4, 21,
- 42, 39, 29,  3, 44, 21, 53, 55,
- 11,  5,  3, 39, 53, 28, 25, 19,
- 34, 28, 21,
-};
-
-MVTable mv_tables[2] = {
-    {
-        1099,
-        table0_mv_code,
-        table0_mv_bits,
-        table0_mvx,
-        table0_mvy,
-    },
-    {
-        1099,
-        table1_mv_code,
-        table1_mv_bits,
-        table1_mvx,
-        table1_mvy,
-    }
-};
-
-const uint8_t v2_mb_type[8][2] = {
- {1, 1}, {0   , 2}, {3   , 3}, {9   , 5},
- {5, 4}, {0x21, 7}, {0x20, 7}, {0x11, 6},
-};
-
-const uint8_t v2_intra_cbpc[4][2] = {
- {1, 1}, {0, 3}, {1, 3}, {1, 2},
-};
-
-const uint8_t wmv1_y_dc_scale_table[32]={
-//  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
-    0, 8, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21
-};
-const uint8_t wmv1_c_dc_scale_table[32]={
-//  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
-    0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22
-};
-
-const uint8_t old_ff_y_dc_scale_table[32]={
-//  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
-    0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
-};
-
-const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={
-  {
-    0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
-    0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
-    0x30, 0x38, 0x29, 0x21, 0x1A, 0x13, 0x0C, 0x05,
-    0x06, 0x0D, 0x14, 0x1B, 0x22, 0x31, 0x39, 0x3A,
-    0x32, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F,
-    0x16, 0x1D, 0x24, 0x2B, 0x33, 0x3B, 0x3C, 0x34,
-    0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x35,
-    0x3D, 0x3E, 0x36, 0x2E, 0x27, 0x2F, 0x37, 0x3F,
-  },
-  {
-    0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11,
-    0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28,
-    0x21, 0x30, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D,
-    0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A,
-    0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D,
-    0x24, 0x2B, 0x32, 0x3A, 0x33, 0x3B, 0x2C, 0x25,
-    0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3C, 0x35,
-    0x3D, 0x2E, 0x27, 0x2F, 0x36, 0x3E, 0x37, 0x3F,
-  },
-  {
-    0x00, 0x01, 0x08, 0x02, 0x03, 0x09, 0x10, 0x18,
-    0x11, 0x0A, 0x04, 0x05, 0x0B, 0x12, 0x19, 0x20,
-    0x28, 0x30, 0x21, 0x1A, 0x13, 0x0C, 0x06, 0x07,
-    0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39,
-    0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x0F, 0x16, 0x1D,
-    0x24, 0x2B, 0x32, 0x3A, 0x33, 0x2C, 0x25, 0x1E,
-    0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3B, 0x3C, 0x35,
-    0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F,
-  },
-  {
-    0x00, 0x08, 0x10, 0x01, 0x18, 0x20, 0x28, 0x09,
-    0x02, 0x03, 0x0A, 0x11, 0x19, 0x30, 0x38, 0x29,
-    0x21, 0x1A, 0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13,
-    0x1B, 0x22, 0x31, 0x39, 0x32, 0x2A, 0x23, 0x1C,
-    0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1D, 0x24,
-    0x2B, 0x33, 0x3A, 0x3B, 0x34, 0x2C, 0x25, 0x1E,
-    0x16, 0x0F, 0x17, 0x1F, 0x26, 0x2D, 0x3C, 0x35,
-    0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F,
-  }
-};
-
-const uint8_t table_inter_intra[4][2]={
-    {0,1} /*Luma-Left Chroma-Left*/,
-    {2,2} /*Luma-Top  Chroma-Left*/,
-    {6,3} /*luma-Left Chroma-Top */,
-    {7,3} /*luma-Top  Chroma-Top */
-};
-
-static const uint32_t table_mb_non_intra2[128][2] = {
-{0x0000A7, 14}, {0x01B2B8, 18}, {0x01B28E, 18}, {0x036575, 19},
-{0x006CAC, 16}, {0x000A69, 18}, {0x002934, 20}, {0x00526B, 21},
-{0x006CA1, 16}, {0x01B2B9, 18}, {0x0029AD, 20}, {0x029353, 24},
-{0x006CA7, 16}, {0x006CAB, 16}, {0x01B2BB, 18}, {0x00029B, 16},
-{0x00D944, 17}, {0x000A6A, 18}, {0x0149A8, 23}, {0x03651F, 19},
-{0x006CAF, 16}, {0x000A4C, 18}, {0x03651E, 19}, {0x000A48, 18},
-{0x00299C, 20}, {0x00299F, 20}, {0x029352, 24}, {0x0029AC, 20},
-{0x000296, 16}, {0x00D946, 17}, {0x000A68, 18}, {0x000298, 16},
-{0x000527, 17}, {0x00D94D, 17}, {0x0014D7, 19}, {0x036574, 19},
-{0x000A5C, 18}, {0x01B299, 18}, {0x00299D, 20}, {0x00299E, 20},
-{0x000525, 17}, {0x000A66, 18}, {0x00A4D5, 22}, {0x00149B, 19},
-{0x000295, 16}, {0x006CAD, 16}, {0x000A49, 18}, {0x000521, 17},
-{0x006CAA, 16}, {0x00D945, 17}, {0x01B298, 18}, {0x00052F, 17},
-{0x003654, 15}, {0x006CA0, 16}, {0x000532, 17}, {0x000291, 16},
-{0x003652, 15}, {0x000520, 17}, {0x000A5D, 18}, {0x000294, 16},
-{0x00009B, 11}, {0x0006E2, 12}, {0x000028, 12}, {0x0001B0, 10},
-{0x000001,  3}, {0x000010,  8}, {0x00002F,  6}, {0x00004C, 10},
-{0x00000D,  4}, {0x000000, 10}, {0x000006,  9}, {0x000134, 12},
-{0x00000C,  4}, {0x000007, 10}, {0x000007,  9}, {0x0006E1, 12},
-{0x00000E,  5}, {0x0000DA,  9}, {0x000022,  9}, {0x000364, 11},
-{0x00000F,  4}, {0x000006, 10}, {0x00000F,  9}, {0x000135, 12},
-{0x000014,  5}, {0x0000DD,  9}, {0x000004,  9}, {0x000015, 11},
-{0x00001A,  6}, {0x0001B3, 10}, {0x000005, 10}, {0x0006E3, 12},
-{0x00000C,  5}, {0x0000B9,  8}, {0x000004,  8}, {0x0000DB,  9},
-{0x00000E,  4}, {0x00000B, 10}, {0x000023,  9}, {0x0006CB, 12},
-{0x000005,  6}, {0x0001B1, 10}, {0x000001, 10}, {0x0006E0, 12},
-{0x000011,  5}, {0x0000DF,  9}, {0x00000E,  9}, {0x000373, 11},
-{0x000003,  5}, {0x0000B8,  8}, {0x000006,  8}, {0x000175,  9},
-{0x000015,  5}, {0x000174,  9}, {0x000027,  9}, {0x000372, 11},
-{0x000010,  5}, {0x0000BB,  8}, {0x000005,  8}, {0x0000DE,  9},
-{0x00000F,  5}, {0x000001,  9}, {0x000012,  8}, {0x000004, 10},
-{0x000002,  3}, {0x000016,  5}, {0x000009,  4}, {0x000001,  5},
-};
-
-static const uint32_t table_mb_non_intra3[128][2] = {
-{0x0002A1, 10}, {0x005740, 15}, {0x01A0BF, 18}, {0x015D19, 17},
-{0x001514, 13}, {0x00461E, 15}, {0x015176, 17}, {0x015177, 17},
-{0x0011AD, 13}, {0x00682E, 16}, {0x0682F9, 20}, {0x03417D, 19},
-{0x001A36, 14}, {0x002A2D, 14}, {0x00D05E, 17}, {0x006824, 16},
-{0x001515, 13}, {0x00545C, 15}, {0x0230E9, 18}, {0x011AFA, 17},
-{0x0015D7, 13}, {0x005747, 15}, {0x008D79, 16}, {0x006825, 16},
-{0x002BA2, 14}, {0x00A8BA, 16}, {0x0235F6, 18}, {0x015D18, 17},
-{0x0011AE, 13}, {0x00346F, 15}, {0x008C3B, 16}, {0x00346E, 15},
-{0x000D1A, 13}, {0x00461F, 15}, {0x0682F8, 20}, {0x011875, 17},
-{0x002BA1, 14}, {0x008D61, 16}, {0x0235F7, 18}, {0x0230E8, 18},
-{0x001513, 13}, {0x008D7B, 16}, {0x011AF4, 17}, {0x011AF5, 17},
-{0x001185, 13}, {0x0046BF, 15}, {0x008D60, 16}, {0x008D7C, 16},
-{0x001512, 13}, {0x00461C, 15}, {0x00AE8D, 16}, {0x008D78, 16},
-{0x000D0E, 13}, {0x003413, 15}, {0x0046B1, 15}, {0x003416, 15},
-{0x000AEA, 12}, {0x002A2C, 14}, {0x005741, 15}, {0x002A2F, 14},
-{0x000158,  9}, {0x0008D2, 12}, {0x00054C, 11}, {0x000686, 12},
-{0x000000,  2}, {0x000069,  8}, {0x00006B,  8}, {0x00068C, 12},
-{0x000007,  3}, {0x00015E,  9}, {0x0002A3, 10}, {0x000AE9, 12},
-{0x000006,  3}, {0x000231, 10}, {0x0002B8, 10}, {0x001A08, 14},
-{0x000010,  5}, {0x0001A9, 10}, {0x000342, 11}, {0x000A88, 12},
-{0x000004,  4}, {0x0001A2, 10}, {0x0002A4, 10}, {0x001184, 13},
-{0x000012,  5}, {0x000232, 10}, {0x0002B2, 10}, {0x000680, 12},
-{0x00001B,  6}, {0x00046A, 11}, {0x00068E, 12}, {0x002359, 14},
-{0x000016,  5}, {0x00015F,  9}, {0x0002A0, 10}, {0x00054D, 11},
-{0x000005,  4}, {0x000233, 10}, {0x0002B9, 10}, {0x0015D6, 13},
-{0x000022,  6}, {0x000468, 11}, {0x000683, 12}, {0x001A0A, 14},
-{0x000013,  5}, {0x000236, 10}, {0x0002BB, 10}, {0x001186, 13},
-{0x000017,  5}, {0x0001AB, 10}, {0x0002A7, 10}, {0x0008D3, 12},
-{0x000014,  5}, {0x000237, 10}, {0x000460, 11}, {0x000D0F, 13},
-{0x000019,  6}, {0x0001AA, 10}, {0x0002B3, 10}, {0x000681, 12},
-{0x000018,  6}, {0x0001A8, 10}, {0x0002A5, 10}, {0x00068F, 12},
-{0x000007,  4}, {0x000055,  7}, {0x000047,  7}, {0x0000AD,  8},
-};
-
-static const uint32_t table_mb_non_intra4[128][2] = {
-{0x0000D4,  8}, {0x0021C5, 14}, {0x00F18A, 16}, {0x00D5BC, 16},
-{0x000879, 12}, {0x00354D, 14}, {0x010E3F, 17}, {0x010F54, 17},
-{0x000866, 12}, {0x00356E, 14}, {0x010F55, 17}, {0x010E3E, 17},
-{0x0010CE, 13}, {0x003C84, 14}, {0x00D5BD, 16}, {0x00F18B, 16},
-{0x000868, 12}, {0x00438C, 15}, {0x0087AB, 16}, {0x00790B, 15},
-{0x000F10, 12}, {0x00433D, 15}, {0x006AD3, 15}, {0x00790A, 15},
-{0x001AA7, 13}, {0x0043D4, 15}, {0x00871E, 16}, {0x006ADF, 15},
-{0x000D7C, 12}, {0x003C94, 14}, {0x00438D, 15}, {0x006AD2, 15},
-{0x0006BC, 11}, {0x0021E9, 14}, {0x006ADA, 15}, {0x006A99, 15},
-{0x0010F7, 13}, {0x004389, 15}, {0x006ADB, 15}, {0x0078C4, 15},
-{0x000D56, 12}, {0x0035F7, 14}, {0x00438E, 15}, {0x006A98, 15},
-{0x000D52, 12}, {0x003C95, 14}, {0x004388, 15}, {0x00433C, 15},
-{0x000D54, 12}, {0x001E4B, 13}, {0x003C63, 14}, {0x003C83, 14},
-{0x000861, 12}, {0x0021EB, 14}, {0x00356C, 14}, {0x0035F6, 14},
-{0x000863, 12}, {0x00219F, 14}, {0x003568, 14}, {0x003C82, 14},
-{0x0001AE,  9}, {0x0010C0, 13}, {0x000F11, 12}, {0x001AFA, 13},
-{0x000000,  1}, {0x0000F0,  8}, {0x0001AD,  9}, {0x0010C1, 13},
-{0x00000A,  4}, {0x0003C5, 10}, {0x000789, 11}, {0x001AB5, 13},
-{0x000009,  4}, {0x000435, 11}, {0x000793, 11}, {0x001E40, 13},
-{0x00001D,  5}, {0x0003CB, 10}, {0x000878, 12}, {0x001AAF, 13},
-{0x00000B,  4}, {0x0003C7, 10}, {0x000791, 11}, {0x001AAB, 13},
-{0x00001F,  5}, {0x000436, 11}, {0x0006BF, 11}, {0x000F19, 12},
-{0x00003D,  6}, {0x000D51, 12}, {0x0010C4, 13}, {0x0021E8, 14},
-{0x000036,  6}, {0x000437, 11}, {0x0006AF, 11}, {0x0010C5, 13},
-{0x00000C,  4}, {0x000432, 11}, {0x000794, 11}, {0x001E30, 13},
-{0x000042,  7}, {0x000870, 12}, {0x000F24, 12}, {0x001E43, 13},
-{0x000020,  6}, {0x00043E, 11}, {0x000795, 11}, {0x001AAA, 13},
-{0x000037,  6}, {0x0006AC, 11}, {0x0006AE, 11}, {0x0010F6, 13},
-{0x000034,  6}, {0x00043A, 11}, {0x000D50, 12}, {0x001AAE, 13},
-{0x000039,  6}, {0x00043F, 11}, {0x00078D, 11}, {0x0010D2, 13},
-{0x000038,  6}, {0x00043B, 11}, {0x0006BD, 11}, {0x0010D3, 13},
-{0x000011,  5}, {0x0001AC,  9}, {0x0000F3,  8}, {0x000439, 11},
-};
-
-const uint32_t (* const wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={
-    table_mb_non_intra2,
-    table_mb_non_intra3,
-    table_mb_non_intra4,
-    table_mb_non_intra,
-};
-
-const uint8_t wmv2_scantableA[64]={
-0x00, 0x01, 0x02, 0x08, 0x03, 0x09, 0x0A, 0x10,
-0x04, 0x0B, 0x11, 0x18, 0x12, 0x0C, 0x05, 0x13,
-0x19, 0x0D, 0x14, 0x1A, 0x1B, 0x06, 0x15, 0x1C,
-0x0E, 0x16, 0x1D, 0x07, 0x1E, 0x0F, 0x17, 0x1F,
-};
-
-const uint8_t wmv2_scantableB[64]={
-0x00, 0x08, 0x01, 0x10, 0x09, 0x18, 0x11, 0x02,
-0x20, 0x0A, 0x19, 0x28, 0x12, 0x30, 0x21, 0x1A,
-0x38, 0x29, 0x22, 0x03, 0x31, 0x39, 0x0B, 0x2A,
-0x13, 0x32, 0x1B, 0x3A, 0x23, 0x2B, 0x33, 0x3B,
-};
diff --git a/libavcodec/msmpeg4data.h b/libavcodec/msmpeg4data.h
deleted file mode 100644
index 623d957..0000000
--- a/libavcodec/msmpeg4data.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * MSMPEG4 backend for ffmpeg encoder and decoder
- * copyright (c) 2001 Fabrice Bellard
- * copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MSMPEG4 data tables.
- */
-
-#ifndef AVCODEC_MSMPEG4DATA_H
-#define AVCODEC_MSMPEG4DATA_H
-
-#include "libavutil/common.h"
-#include "get_bits.h"
-#include "rl.h"
-
-/* motion vector table */
-typedef struct MVTable {
-    int n;
-    const uint16_t *table_mv_code;
-    const uint8_t *table_mv_bits;
-    const uint8_t *table_mvx;
-    const uint8_t *table_mvy;
-    uint16_t *table_mv_index; /* encoding: convert mv to index in table_mv */
-    VLC vlc;                /* decoding: vlc */
-} MVTable;
-
-extern VLC ff_msmp4_mb_i_vlc;
-extern VLC ff_msmp4_dc_luma_vlc[2];
-extern VLC ff_msmp4_dc_chroma_vlc[2];
-
-/* intra picture macroblock coded block pattern */
-extern const uint16_t ff_msmp4_mb_i_table[64][2];
-
-#define WMV1_SCANTABLE_COUNT 4
-
-extern const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64];
-
-#define NB_RL_TABLES  6
-
-extern RLTable rl_table[NB_RL_TABLES];
-
-extern const uint8_t wmv1_y_dc_scale_table[32];
-extern const uint8_t wmv1_c_dc_scale_table[32];
-extern const uint8_t old_ff_y_dc_scale_table[32];
-
-extern MVTable mv_tables[2];
-
-extern const uint8_t v2_mb_type[8][2];
-extern const uint8_t v2_intra_cbpc[4][2];
-
-extern const uint32_t table_mb_non_intra[128][2];
-extern const uint8_t  table_inter_intra[4][2];
-
-extern const uint32_t ff_table0_dc_lum[120][2];
-extern const uint32_t ff_table1_dc_lum[120][2];
-extern const uint32_t ff_table0_dc_chroma[120][2];
-extern const uint32_t ff_table1_dc_chroma[120][2];
-
-#define WMV2_INTER_CBP_TABLE_COUNT 4
-extern const uint32_t (* const wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2];
-
-extern const uint8_t wmv2_scantableA[64];
-extern const uint8_t wmv2_scantableB[64];
-
-#endif /* AVCODEC_MSMPEG4DATA_H */
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
deleted file mode 100644
index 28eb5d3..0000000
--- a/libavcodec/msrle.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Micrsoft RLE Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MS RLE Video Decoder by Mike Melanson (melanson at pcisys.net)
- * For more information about the MS RLE format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *
- * The MS RLE decoder outputs PAL8 colorspace data.
- *
- * Note that this decoder expects the palette colors from the end of the
- * BITMAPINFO header passed through palctrl.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "msrledec.h"
-
-typedef struct MsrleContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *buf;
-    int size;
-
-} MsrleContext;
-
-static av_cold int msrle_decode_init(AVCodecContext *avctx)
-{
-    MsrleContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    switch (avctx->bits_per_coded_sample) {
-    case 4:
-    case 8:
-        avctx->pix_fmt = PIX_FMT_PAL8;
-        break;
-    case 24:
-        avctx->pix_fmt = PIX_FMT_BGR24;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");
-        return -1;
-    }
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int msrle_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MsrleContext *s = avctx->priv_data;
-    int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    if (s->avctx->palctrl) {
-        /* make the palette available */
-        memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
-        if (s->avctx->palctrl->palette_changed) {
-            s->frame.palette_has_changed = 1;
-            s->avctx->palctrl->palette_changed = 0;
-        }
-    }
-
-    /* FIXME how to correctly detect RLE ??? */
-    if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
-        int linesize = avctx->width * avctx->bits_per_coded_sample / 8;
-        uint8_t *ptr = s->frame.data[0];
-        uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
-        int i, j;
-
-        for (i = 0; i < avctx->height; i++) {
-            if (avctx->bits_per_coded_sample == 4) {
-                for (j = 0; j < avctx->width - 1; j += 2) {
-                    ptr[j+0] = buf[j>>1] >> 4;
-                    ptr[j+1] = buf[j>>1] & 0xF;
-                }
-                if (avctx->width & 1)
-                    ptr[j+0] = buf[j>>1] >> 4;
-            } else {
-                memcpy(ptr, buf, linesize);
-            }
-            buf -= istride;
-            ptr += s->frame.linesize[0];
-        }
-    } else {
-        ff_msrle_decode(avctx, (AVPicture*)&s->frame, avctx->bits_per_coded_sample, buf, buf_size);
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int msrle_decode_end(AVCodecContext *avctx)
-{
-    MsrleContext *s = avctx->priv_data;
-
-    /* release the last frame */
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec msrle_decoder = {
-    "msrle",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSRLE,
-    sizeof(MsrleContext),
-    msrle_decode_init,
-    NULL,
-    msrle_decode_end,
-    msrle_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("Microsoft RLE"),
-};
diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
deleted file mode 100644
index 6e16d53..0000000
--- a/libavcodec/msrledec.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Microsoft RLE decoder
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MS RLE decoder based on decoder by Mike Melanson and my own for TSCC
- * For more information about the MS RLE format, visit:
- *   http://www.multimedia.cx/msrle.txt
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "msrledec.h"
-
-#define FETCH_NEXT_STREAM_BYTE() \
-    if (stream_ptr >= data_size) \
-    { \
-      av_log(avctx, AV_LOG_ERROR, " MS RLE: stream ptr just went out of bounds (1)\n"); \
-      return -1; \
-    } \
-    stream_byte = data[stream_ptr++];
-
-static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic,
-                              const uint8_t *data, int data_size)
-{
-    int stream_ptr = 0;
-    unsigned char rle_code;
-    unsigned char extra_byte, odd_pixel;
-    unsigned char stream_byte;
-    int pixel_ptr = 0;
-    int row_dec = pic->linesize[0];
-    int row_ptr = (avctx->height - 1) * row_dec;
-    int frame_size = row_dec * avctx->height;
-    int i;
-
-    while (row_ptr >= 0) {
-        FETCH_NEXT_STREAM_BYTE();
-        rle_code = stream_byte;
-        if (rle_code == 0) {
-            /* fetch the next byte to see how to handle escape code */
-            FETCH_NEXT_STREAM_BYTE();
-            if (stream_byte == 0) {
-                /* line is done, goto the next one */
-                row_ptr -= row_dec;
-                pixel_ptr = 0;
-            } else if (stream_byte == 1) {
-                /* decode is done */
-                return 0;
-            } else if (stream_byte == 2) {
-                /* reposition frame decode coordinates */
-                FETCH_NEXT_STREAM_BYTE();
-                pixel_ptr += stream_byte;
-                FETCH_NEXT_STREAM_BYTE();
-                row_ptr -= stream_byte * row_dec;
-        } else {
-            // copy pixels from encoded stream
-            odd_pixel =  stream_byte & 1;
-            rle_code = (stream_byte + 1) / 2;
-            extra_byte = rle_code & 0x01;
-            if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
-                (row_ptr < 0)) {
-                av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
-                return -1;
-            }
-
-            for (i = 0; i < rle_code; i++) {
-                if (pixel_ptr >= avctx->width)
-                    break;
-                FETCH_NEXT_STREAM_BYTE();
-                pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
-                pixel_ptr++;
-                if (i + 1 == rle_code && odd_pixel)
-                    break;
-                if (pixel_ptr >= avctx->width)
-                    break;
-                pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
-                pixel_ptr++;
-            }
-
-            // if the RLE code is odd, skip a byte in the stream
-            if (extra_byte)
-              stream_ptr++;
-            }
-        } else {
-            // decode a run of data
-            if ((row_ptr + pixel_ptr + stream_byte > frame_size) ||
-                (row_ptr < 0)) {
-                av_log(avctx, AV_LOG_ERROR, " MS RLE: frame ptr just went out of bounds (1)\n");
-                return -1;
-            }
-            FETCH_NEXT_STREAM_BYTE();
-            for (i = 0; i < rle_code; i++) {
-                if (pixel_ptr >= avctx->width)
-                    break;
-                if ((i & 1) == 0)
-                    pic->data[0][row_ptr + pixel_ptr] = stream_byte >> 4;
-                else
-                    pic->data[0][row_ptr + pixel_ptr] = stream_byte & 0x0F;
-                pixel_ptr++;
-            }
-        }
-    }
-
-    /* one last sanity check on the way out */
-    if (stream_ptr < data_size) {
-        av_log(avctx, AV_LOG_ERROR, " MS RLE: ended frame decode with bytes left over (%d < %d)\n",
-            stream_ptr, data_size);
-        return -1;
-    }
-
-    return 0;
-}
-
-
-static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, int depth,
-                                    const uint8_t *data, int srcsize)
-{
-    uint8_t *output, *output_end;
-    const uint8_t* src = data;
-    int p1, p2, line=avctx->height - 1, pos=0, i;
-    uint16_t av_uninit(pix16);
-    uint32_t av_uninit(pix32);
-
-    output = pic->data[0] + (avctx->height - 1) * pic->linesize[0];
-    output_end = pic->data[0] + (avctx->height) * pic->linesize[0];
-    while(src < data + srcsize) {
-        p1 = *src++;
-        if(p1 == 0) { //Escape code
-            p2 = *src++;
-            if(p2 == 0) { //End-of-line
-                output = pic->data[0] + (--line) * pic->linesize[0];
-                if (line < 0 && !(src+1 < data + srcsize && AV_RB16(src) == 1)) {
-                    av_log(avctx, AV_LOG_ERROR, "Next line is beyond picture bounds\n");
-                    return -1;
-                }
-                pos = 0;
-                continue;
-            } else if(p2 == 1) { //End-of-picture
-                return 0;
-            } else if(p2 == 2) { //Skip
-                p1 = *src++;
-                p2 = *src++;
-                line -= p2;
-                if (line < 0){
-                    av_log(avctx, AV_LOG_ERROR, "Skip beyond picture bounds\n");
-                    return -1;
-                }
-                pos += p1;
-                output = pic->data[0] + line * pic->linesize[0] + pos * (depth >> 3);
-                continue;
-            }
-            // Copy data
-            if ((pic->linesize[0] > 0 && output + p2 * (depth >> 3) > output_end)
-              ||(pic->linesize[0] < 0 && output + p2 * (depth >> 3) < output_end)) {
-                src += p2 * (depth >> 3);
-                continue;
-            }
-            if ((depth == 8) || (depth == 24)) {
-                for(i = 0; i < p2 * (depth >> 3); i++) {
-                    *output++ = *src++;
-                }
-                // RLE8 copy is actually padded - and runs are not!
-                if(depth == 8 && (p2 & 1)) {
-                    src++;
-                }
-            } else if (depth == 16) {
-                for(i = 0; i < p2; i++) {
-                    pix16 = AV_RL16(src);
-                    src += 2;
-                    *(uint16_t*)output = pix16;
-                    output += 2;
-                }
-            } else if (depth == 32) {
-                for(i = 0; i < p2; i++) {
-                    pix32 = AV_RL32(src);
-                    src += 4;
-                    *(uint32_t*)output = pix32;
-                    output += 4;
-                }
-            }
-            pos += p2;
-        } else { //run of pixels
-            uint8_t pix[3]; //original pixel
-            switch(depth){
-            case  8: pix[0] = *src++;
-                     break;
-            case 16: pix16 = AV_RL16(src);
-                     src += 2;
-                     break;
-            case 24: pix[0] = *src++;
-                     pix[1] = *src++;
-                     pix[2] = *src++;
-                     break;
-            case 32: pix32 = AV_RL32(src);
-                     src += 4;
-                     break;
-            }
-            if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end)
-              ||(pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end))
-                continue;
-            for(i = 0; i < p1; i++) {
-                switch(depth){
-                case  8: *output++ = pix[0];
-                         break;
-                case 16: *(uint16_t*)output = pix16;
-                         output += 2;
-                         break;
-                case 24: *output++ = pix[0];
-                         *output++ = pix[1];
-                         *output++ = pix[2];
-                         break;
-                case 32: *(uint32_t*)output = pix32;
-                         output += 4;
-                         break;
-                }
-            }
-            pos += p1;
-        }
-    }
-
-    av_log(avctx, AV_LOG_WARNING, "MS RLE warning: no end-of-picture code\n");
-    return 0;
-}
-
-
-int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, int depth,
-                    const uint8_t* data, int data_size)
-{
-    switch(depth){
-    case  4:
-        return msrle_decode_pal4(avctx, pic, data, data_size);
-    case  8:
-    case 16:
-    case 24:
-    case 32:
-        return msrle_decode_8_16_24_32(avctx, pic, depth, data, data_size);
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Unknown depth %d\n", depth);
-        return -1;
-    }
-}
-
diff --git a/libavcodec/msrledec.h b/libavcodec/msrledec.h
deleted file mode 100644
index 7495de5..0000000
--- a/libavcodec/msrledec.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Microsoft RLE decoder
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_MSRLEDEC_H
-#define AVCODEC_MSRLEDEC_H
-
-#include "avcodec.h"
-
-/**
- * Decodes stream in MS RLE format into frame.
- *
- * @param avctx     codec context
- * @param pic       destination frame
- * @param depth     bit depth
- * @param data      input stream
- * @param data_size input size
- */
-int ff_msrle_decode(AVCodecContext *avctx, AVPicture *pic, int depth,
-                    const uint8_t* data, int data_size);
-
-#endif /* AVCODEC_MSRLEDEC_H */
-
diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c
deleted file mode 100644
index 30aca39..0000000
--- a/libavcodec/msvideo1.c
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Microsoft Video-1 Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Microsoft Video-1 Decoder by Mike Melanson (melanson at pcisys.net)
- * For more information about the MS Video-1 format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *
- * This decoder outputs either PAL8 or RGB555 data, depending on the
- * whether a RGB palette was passed through palctrl;
- * if it's present, then the data is PAL8; RGB555 otherwise.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#define PALETTE_COUNT 256
-#define CHECK_STREAM_PTR(n) \
-  if ((stream_ptr + n) > s->size ) { \
-    av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \
-      stream_ptr + n, s->size); \
-    return; \
-  }
-
-typedef struct Msvideo1Context {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *buf;
-    int size;
-
-    int mode_8bit;  /* if it's not 8-bit, it's 16-bit */
-
-} Msvideo1Context;
-
-static av_cold int msvideo1_decode_init(AVCodecContext *avctx)
-{
-    Msvideo1Context *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    /* figure out the colorspace based on the presence of a palette */
-    if (s->avctx->palctrl) {
-        s->mode_8bit = 1;
-        avctx->pix_fmt = PIX_FMT_PAL8;
-    } else {
-        s->mode_8bit = 0;
-        avctx->pix_fmt = PIX_FMT_RGB555;
-    }
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static void msvideo1_decode_8bit(Msvideo1Context *s)
-{
-    int block_ptr, pixel_ptr;
-    int total_blocks;
-    int pixel_x, pixel_y;  /* pixel width and height iterators */
-    int block_x, block_y;  /* block width and height iterators */
-    int blocks_wide, blocks_high;  /* width and height in 4x4 blocks */
-    int block_inc;
-    int row_dec;
-
-    /* decoding parameters */
-    int stream_ptr;
-    unsigned char byte_a, byte_b;
-    unsigned short flags;
-    int skip_blocks;
-    unsigned char colors[8];
-    unsigned char *pixels = s->frame.data[0];
-    int stride = s->frame.linesize[0];
-
-    stream_ptr = 0;
-    skip_blocks = 0;
-    blocks_wide = s->avctx->width / 4;
-    blocks_high = s->avctx->height / 4;
-    total_blocks = blocks_wide * blocks_high;
-    block_inc = 4;
-    row_dec = stride + 4;
-
-    for (block_y = blocks_high; block_y > 0; block_y--) {
-        block_ptr = ((block_y * 4) - 1) * stride;
-        for (block_x = blocks_wide; block_x > 0; block_x--) {
-            /* check if this block should be skipped */
-            if (skip_blocks) {
-                block_ptr += block_inc;
-                skip_blocks--;
-                total_blocks--;
-                continue;
-            }
-
-            pixel_ptr = block_ptr;
-
-            /* get the next two bytes in the encoded data stream */
-            CHECK_STREAM_PTR(2);
-            byte_a = s->buf[stream_ptr++];
-            byte_b = s->buf[stream_ptr++];
-
-            /* check if the decode is finished */
-            if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0))
-                return;
-            else if ((byte_b & 0xFC) == 0x84) {
-                /* skip code, but don't count the current block */
-                skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1;
-            } else if (byte_b < 0x80) {
-                /* 2-color encoding */
-                flags = (byte_b << 8) | byte_a;
-
-                CHECK_STREAM_PTR(2);
-                colors[0] = s->buf[stream_ptr++];
-                colors[1] = s->buf[stream_ptr++];
-
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
-                        pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1];
-                    pixel_ptr -= row_dec;
-                }
-            } else if (byte_b >= 0x90) {
-                /* 8-color encoding */
-                flags = (byte_b << 8) | byte_a;
-
-                CHECK_STREAM_PTR(8);
-                memcpy(colors, &s->buf[stream_ptr], 8);
-                stream_ptr += 8;
-
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
-                        pixels[pixel_ptr++] =
-                            colors[((pixel_y & 0x2) << 1) +
-                                (pixel_x & 0x2) + ((flags & 0x1) ^ 1)];
-                    pixel_ptr -= row_dec;
-                }
-            } else {
-                /* 1-color encoding */
-                colors[0] = byte_a;
-
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++)
-                        pixels[pixel_ptr++] = colors[0];
-                    pixel_ptr -= row_dec;
-                }
-            }
-
-            block_ptr += block_inc;
-            total_blocks--;
-        }
-    }
-
-    /* make the palette available on the way out */
-    if (s->avctx->pix_fmt == PIX_FMT_PAL8) {
-        memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
-        if (s->avctx->palctrl->palette_changed) {
-            s->frame.palette_has_changed = 1;
-            s->avctx->palctrl->palette_changed = 0;
-        }
-    }
-}
-
-static void msvideo1_decode_16bit(Msvideo1Context *s)
-{
-    int block_ptr, pixel_ptr;
-    int total_blocks;
-    int pixel_x, pixel_y;  /* pixel width and height iterators */
-    int block_x, block_y;  /* block width and height iterators */
-    int blocks_wide, blocks_high;  /* width and height in 4x4 blocks */
-    int block_inc;
-    int row_dec;
-
-    /* decoding parameters */
-    int stream_ptr;
-    unsigned char byte_a, byte_b;
-    unsigned short flags;
-    int skip_blocks;
-    unsigned short colors[8];
-    unsigned short *pixels = (unsigned short *)s->frame.data[0];
-    int stride = s->frame.linesize[0] / 2;
-
-    stream_ptr = 0;
-    skip_blocks = 0;
-    blocks_wide = s->avctx->width / 4;
-    blocks_high = s->avctx->height / 4;
-    total_blocks = blocks_wide * blocks_high;
-    block_inc = 4;
-    row_dec = stride + 4;
-
-    for (block_y = blocks_high; block_y > 0; block_y--) {
-        block_ptr = ((block_y * 4) - 1) * stride;
-        for (block_x = blocks_wide; block_x > 0; block_x--) {
-            /* check if this block should be skipped */
-            if (skip_blocks) {
-                block_ptr += block_inc;
-                skip_blocks--;
-                total_blocks--;
-                continue;
-            }
-
-            pixel_ptr = block_ptr;
-
-            /* get the next two bytes in the encoded data stream */
-            CHECK_STREAM_PTR(2);
-            byte_a = s->buf[stream_ptr++];
-            byte_b = s->buf[stream_ptr++];
-
-            /* check if the decode is finished */
-            if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0)) {
-                return;
-            } else if ((byte_b & 0xFC) == 0x84) {
-                /* skip code, but don't count the current block */
-                skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1;
-            } else if (byte_b < 0x80) {
-                /* 2- or 8-color encoding modes */
-                flags = (byte_b << 8) | byte_a;
-
-                CHECK_STREAM_PTR(4);
-                colors[0] = AV_RL16(&s->buf[stream_ptr]);
-                stream_ptr += 2;
-                colors[1] = AV_RL16(&s->buf[stream_ptr]);
-                stream_ptr += 2;
-
-                if (colors[0] & 0x8000) {
-                    /* 8-color encoding */
-                    CHECK_STREAM_PTR(12);
-                    colors[2] = AV_RL16(&s->buf[stream_ptr]);
-                    stream_ptr += 2;
-                    colors[3] = AV_RL16(&s->buf[stream_ptr]);
-                    stream_ptr += 2;
-                    colors[4] = AV_RL16(&s->buf[stream_ptr]);
-                    stream_ptr += 2;
-                    colors[5] = AV_RL16(&s->buf[stream_ptr]);
-                    stream_ptr += 2;
-                    colors[6] = AV_RL16(&s->buf[stream_ptr]);
-                    stream_ptr += 2;
-                    colors[7] = AV_RL16(&s->buf[stream_ptr]);
-                    stream_ptr += 2;
-
-                    for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                        for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
-                            pixels[pixel_ptr++] =
-                                colors[((pixel_y & 0x2) << 1) +
-                                    (pixel_x & 0x2) + ((flags & 0x1) ^ 1)];
-                        pixel_ptr -= row_dec;
-                    }
-                } else {
-                    /* 2-color encoding */
-                    for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                        for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1)
-                            pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1];
-                        pixel_ptr -= row_dec;
-                    }
-                }
-            } else {
-                /* otherwise, it's a 1-color block */
-                colors[0] = (byte_b << 8) | byte_a;
-
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++)
-                        pixels[pixel_ptr++] = colors[0];
-                    pixel_ptr -= row_dec;
-                }
-            }
-
-            block_ptr += block_inc;
-            total_blocks--;
-        }
-    }
-}
-
-static int msvideo1_decode_frame(AVCodecContext *avctx,
-                                void *data, int *data_size,
-                                AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    Msvideo1Context *s = avctx->priv_data;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    if (s->mode_8bit)
-        msvideo1_decode_8bit(s);
-    else
-        msvideo1_decode_16bit(s);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int msvideo1_decode_end(AVCodecContext *avctx)
-{
-    Msvideo1Context *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec msvideo1_decoder = {
-    "msvideo1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_MSVIDEO1,
-    sizeof(Msvideo1Context),
-    msvideo1_decode_init,
-    NULL,
-    msvideo1_decode_end,
-    msvideo1_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name= NULL_IF_CONFIG_SMALL("Microsoft Video 1"),
-};
diff --git a/libavcodec/nellymoser.c b/libavcodec/nellymoser.c
deleted file mode 100644
index 0716c25..0000000
--- a/libavcodec/nellymoser.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Common code between Nellymoser encoder and decoder
- * Copyright (c) 2007 a840bda5870ba11f19698ff6eb9581dfb0f95fa5,
- *                    539459aeb7d425140b62a3ec7dbf6dc8e408a306, and
- *                    520e17cd55896441042b14df2566a6eb610ed444
- * Copyright (c) 2007 Loic Minier <lool at dooz.org>
- *                    Benjamin Larsson
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * @file
- * The 3 alphanumeric copyright notices are md5summed they are from the original
- * implementors. The original code is available from http://code.google.com/p/nelly2pcm/
- */
-
-#include "nellymoser.h"
-#include "avcodec.h"
-#include "dsputil.h"
-
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-
-const float ff_nelly_dequantization_table[127] = {
- 0.0000000000,
-
--0.8472560048, 0.7224709988,
-
--1.5247479677,-0.4531480074, 0.3753609955, 1.4717899561,
-
--1.9822579622,-1.1929379702,-0.5829370022,-0.0693780035, 0.3909569979, 0.9069200158, 1.4862740040, 2.2215409279,
-
--2.3887870312,-1.8067539930,-1.4105420113,-1.0773609877,-0.7995010018,-0.5558109879,-0.3334020078,-0.1324490011,
- 0.0568020009, 0.2548770010, 0.4773550034, 0.7386850119, 1.0443060398, 1.3954459429, 1.8098750114, 2.3918759823,
-
--2.3893830776,-1.9884680510,-1.7514040470,-1.5643119812,-1.3922129869,-1.2164649963,-1.0469499826,-0.8905100226,
--0.7645580173,-0.6454579830,-0.5259280205,-0.4059549868,-0.3029719889,-0.2096900046,-0.1239869967,-0.0479229987,
- 0.0257730000, 0.1001340002, 0.1737180054, 0.2585540116, 0.3522900045, 0.4569880068, 0.5767750144, 0.7003160119,
- 0.8425520062, 1.0093879700, 1.1821349859, 1.3534560204, 1.5320819616, 1.7332619429, 1.9722349644, 2.3978140354,
-
--2.5756309032,-2.0573320389,-1.8984919786,-1.7727810144,-1.6662600040,-1.5742180347,-1.4993319511,-1.4316639900,
--1.3652280569,-1.3000990152,-1.2280930281,-1.1588579416,-1.0921250582,-1.0135740042,-0.9202849865,-0.8287050128,
--0.7374889851,-0.6447759867,-0.5590940118,-0.4857139885,-0.4110319912,-0.3459700048,-0.2851159871,-0.2341620028,
--0.1870580018,-0.1442500055,-0.1107169986,-0.0739680007,-0.0365610011,-0.0073290002, 0.0203610007, 0.0479039997,
- 0.0751969963, 0.0980999991, 0.1220389977, 0.1458999962, 0.1694349945, 0.1970459968, 0.2252430022, 0.2556869984,
- 0.2870100141, 0.3197099864, 0.3525829911, 0.3889069855, 0.4334920049, 0.4769459963, 0.5204820037, 0.5644530058,
- 0.6122040153, 0.6685929894, 0.7341650128, 0.8032159805, 0.8784040213, 0.9566209912, 1.0397069454, 1.1293770075,
- 1.2211159468, 1.3080279827, 1.4024800062, 1.5056819916, 1.6227730513, 1.7724959850, 1.9430880547, 2.2903931141
-};
-
-const uint8_t ff_nelly_band_sizes_table[NELLY_BANDS] = {
-2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 12, 14, 15
-};
-
-const uint16_t ff_nelly_init_table[64] = {
-3134, 5342, 6870, 7792, 8569, 9185, 9744, 10191, 10631, 11061, 11434, 11770,
-12116, 12513, 12925, 13300, 13674, 14027, 14352, 14716, 15117, 15477, 15824,
-16157, 16513, 16804, 17090, 17401, 17679, 17948, 18238, 18520, 18764, 19078,
-19381, 19640, 19921, 20205, 20500, 20813, 21162, 21465, 21794, 22137, 22453,
-22756, 23067, 23350, 23636, 23926, 24227, 24521, 24819, 25107, 25414, 25730,
-26120, 26497, 26895, 27344, 27877, 28463, 29426, 31355
-};
-
-const int16_t ff_nelly_delta_table[32] = {
--11725, -9420, -7910, -6801, -5948, -5233, -4599, -4039, -3507, -3030, -2596,
--2170, -1774, -1383, -1016, -660, -329, -1, 337, 696, 1085, 1512, 1962, 2433,
-2968, 3569, 4314, 5279, 6622, 8154, 10076, 12975
-};
-
-static inline int signed_shift(int i, int shift) {
-    if (shift > 0)
-        return i << shift;
-    return i >> -shift;
-}
-
-static int sum_bits(short *buf, short shift, short off)
-{
-    int i, ret = 0;
-
-    for (i = 0; i < NELLY_FILL_LEN; i++) {
-        int b = buf[i]-off;
-        b = ((b>>(shift-1))+1)>>1;
-        ret += av_clip(b, 0, NELLY_BIT_CAP);
-    }
-
-    return ret;
-}
-
-static int headroom(int *la)
-{
-    int l;
-    if (*la == 0) {
-        return 31;
-    }
-    l = 30 - av_log2(FFABS(*la));
-    *la <<= l;
-    return l;
-}
-
-
-void ff_nelly_get_sample_bits(const float *buf, int *bits)
-{
-    int i, j;
-    short sbuf[128];
-    int bitsum = 0, last_bitsum, small_bitsum, big_bitsum;
-    short shift, shift_saved;
-    int max, sum, last_off, tmp;
-    int big_off, small_off;
-    int off;
-
-    max = 0;
-    for (i = 0; i < NELLY_FILL_LEN; i++) {
-        max = FFMAX(max, buf[i]);
-    }
-    shift = -16;
-    shift += headroom(&max);
-
-    sum = 0;
-    for (i = 0; i < NELLY_FILL_LEN; i++) {
-        sbuf[i] = signed_shift(buf[i], shift);
-        sbuf[i] = (3*sbuf[i])>>2;
-        sum += sbuf[i];
-    }
-
-    shift += 11;
-    shift_saved = shift;
-    sum -= NELLY_DETAIL_BITS << shift;
-    shift += headroom(&sum);
-    small_off = (NELLY_BASE_OFF * (sum>>16)) >> 15;
-    shift = shift_saved - (NELLY_BASE_SHIFT+shift-31);
-
-    small_off = signed_shift(small_off, shift);
-
-    bitsum = sum_bits(sbuf, shift_saved, small_off);
-
-    if (bitsum != NELLY_DETAIL_BITS) {
-        off = bitsum - NELLY_DETAIL_BITS;
-
-        for(shift=0; FFABS(off) <= 16383; shift++)
-            off *= 2;
-
-        off = (off * NELLY_BASE_OFF) >> 15;
-        shift = shift_saved-(NELLY_BASE_SHIFT+shift-15);
-
-        off = signed_shift(off, shift);
-
-        for (j = 1; j < 20; j++) {
-            last_off = small_off;
-            small_off += off;
-            last_bitsum = bitsum;
-
-            bitsum = sum_bits(sbuf, shift_saved, small_off);
-
-            if ((bitsum-NELLY_DETAIL_BITS) * (last_bitsum-NELLY_DETAIL_BITS) <= 0)
-                break;
-        }
-
-        if (bitsum > NELLY_DETAIL_BITS) {
-            big_off = small_off;
-            small_off = last_off;
-            big_bitsum=bitsum;
-            small_bitsum=last_bitsum;
-        } else {
-            big_off = last_off;
-            big_bitsum=last_bitsum;
-            small_bitsum=bitsum;
-        }
-
-        while (bitsum != NELLY_DETAIL_BITS && j <= 19) {
-            off = (big_off+small_off)>>1;
-            bitsum = sum_bits(sbuf, shift_saved, off);
-            if (bitsum > NELLY_DETAIL_BITS) {
-                big_off=off;
-                big_bitsum=bitsum;
-            } else {
-                small_off = off;
-                small_bitsum=bitsum;
-            }
-            j++;
-        }
-
-        if (abs(big_bitsum-NELLY_DETAIL_BITS) >=
-            abs(small_bitsum-NELLY_DETAIL_BITS)) {
-            bitsum = small_bitsum;
-        } else {
-            small_off = big_off;
-            bitsum = big_bitsum;
-        }
-    }
-
-    for (i = 0; i < NELLY_FILL_LEN; i++) {
-        tmp = sbuf[i]-small_off;
-        tmp = ((tmp>>(shift_saved-1))+1)>>1;
-        bits[i] = av_clip(tmp, 0, NELLY_BIT_CAP);
-    }
-
-    if (bitsum > NELLY_DETAIL_BITS) {
-        tmp = i = 0;
-        while (tmp < NELLY_DETAIL_BITS) {
-            tmp += bits[i];
-            i++;
-        }
-
-        bits[i-1] -= tmp - NELLY_DETAIL_BITS;
-        for(; i < NELLY_FILL_LEN; i++)
-            bits[i] = 0;
-    }
-}
-
diff --git a/libavcodec/nellymoser.h b/libavcodec/nellymoser.h
deleted file mode 100644
index 88d9aa6..0000000
--- a/libavcodec/nellymoser.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Common code between Nellymoser encoder and decoder
- * Copyright (c) 2007 a840bda5870ba11f19698ff6eb9581dfb0f95fa5,
- *                    539459aeb7d425140b62a3ec7dbf6dc8e408a306, and
- *                    520e17cd55896441042b14df2566a6eb610ed444
- * Copyright (c) 2007 Loic Minier <lool at dooz.org>
- *                    Benjamin Larsson
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * @file
- * The 3 alphanumeric copyright notices are md5summed they are from the original
- * implementors. The original code is available from http://code.google.com/p/nelly2pcm/
- */
-
-#ifndef AVCODEC_NELLYMOSER_H
-#define AVCODEC_NELLYMOSER_H
-
-#include "avcodec.h"
-
-#define NELLY_BANDS       23
-#define NELLY_BLOCK_LEN   64
-#define NELLY_HEADER_BITS 116
-#define NELLY_DETAIL_BITS 198
-#define NELLY_BUF_LEN     128
-#define NELLY_FILL_LEN    124
-#define NELLY_BIT_CAP     6
-#define NELLY_BASE_OFF    4228
-#define NELLY_BASE_SHIFT  19
-#define NELLY_SAMPLES     (2 * NELLY_BUF_LEN)
-
-extern const float    ff_nelly_dequantization_table[127];
-extern const uint8_t  ff_nelly_band_sizes_table[NELLY_BANDS];
-extern const uint16_t ff_nelly_init_table[64];
-extern const int16_t  ff_nelly_delta_table[32];
-
-void ff_nelly_get_sample_bits(const float *buf, int *bits);
-
-#endif
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
deleted file mode 100644
index 82a3f07..0000000
--- a/libavcodec/nellymoserdec.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * NellyMoser audio decoder
- * Copyright (c) 2007 a840bda5870ba11f19698ff6eb9581dfb0f95fa5,
- *                    539459aeb7d425140b62a3ec7dbf6dc8e408a306, and
- *                    520e17cd55896441042b14df2566a6eb610ed444
- * Copyright (c) 2007 Loic Minier <lool at dooz.org>
- *                    Benjamin Larsson
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * @file
- * The 3 alphanumeric copyright notices are md5summed they are from the original
- * implementors. The original code is available from http://code.google.com/p/nelly2pcm/
- */
-
-#include "nellymoser.h"
-#include "libavutil/lfg.h"
-#include "libavutil/random_seed.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "fft.h"
-
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-
-
-typedef struct NellyMoserDecodeContext {
-    AVCodecContext* avctx;
-    DECLARE_ALIGNED(16, float,float_buf)[NELLY_SAMPLES];
-    float           state[128];
-    AVLFG           random_state;
-    GetBitContext   gb;
-    int             add_bias;
-    float           scale_bias;
-    DSPContext      dsp;
-    FFTContext      imdct_ctx;
-    DECLARE_ALIGNED(16, float,imdct_out)[NELLY_BUF_LEN * 2];
-} NellyMoserDecodeContext;
-
-static void overlap_and_window(NellyMoserDecodeContext *s, float *state, float *audio, float *a_in)
-{
-    int bot, top;
-
-    bot = 0;
-    top = NELLY_BUF_LEN-1;
-
-    while (bot < NELLY_BUF_LEN) {
-        audio[bot] = a_in [bot]*ff_sine_128[bot]
-                    +state[bot]*ff_sine_128[top] + s->add_bias;
-
-        bot++;
-        top--;
-    }
-    memcpy(state, a_in + NELLY_BUF_LEN, sizeof(float)*NELLY_BUF_LEN);
-}
-
-static void nelly_decode_block(NellyMoserDecodeContext *s,
-                               const unsigned char block[NELLY_BLOCK_LEN],
-                               float audio[NELLY_SAMPLES])
-{
-    int i,j;
-    float buf[NELLY_FILL_LEN], pows[NELLY_FILL_LEN];
-    float *aptr, *bptr, *pptr, val, pval;
-    int bits[NELLY_BUF_LEN];
-    unsigned char v;
-
-    init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);
-
-    bptr = buf;
-    pptr = pows;
-    val = ff_nelly_init_table[get_bits(&s->gb, 6)];
-    for (i=0 ; i<NELLY_BANDS ; i++) {
-        if (i > 0)
-            val += ff_nelly_delta_table[get_bits(&s->gb, 5)];
-        pval = -pow(2, val/2048) * s->scale_bias;
-        for (j = 0; j < ff_nelly_band_sizes_table[i]; j++) {
-            *bptr++ = val;
-            *pptr++ = pval;
-        }
-
-    }
-
-    ff_nelly_get_sample_bits(buf, bits);
-
-    for (i = 0; i < 2; i++) {
-        aptr = audio + i * NELLY_BUF_LEN;
-
-        init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);
-        skip_bits_long(&s->gb, NELLY_HEADER_BITS + i*NELLY_DETAIL_BITS);
-
-        for (j = 0; j < NELLY_FILL_LEN; j++) {
-            if (bits[j] <= 0) {
-                aptr[j] = M_SQRT1_2*pows[j];
-                if (av_lfg_get(&s->random_state) & 1)
-                    aptr[j] *= -1.0;
-            } else {
-                v = get_bits(&s->gb, bits[j]);
-                aptr[j] = ff_nelly_dequantization_table[(1<<bits[j])-1+v]*pows[j];
-            }
-        }
-        memset(&aptr[NELLY_FILL_LEN], 0,
-               (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));
-
-        ff_imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
-        /* XXX: overlapping and windowing should be part of a more
-           generic imdct function */
-        overlap_and_window(s, s->state, aptr, s->imdct_out);
-    }
-}
-
-static av_cold int decode_init(AVCodecContext * avctx) {
-    NellyMoserDecodeContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    av_lfg_init(&s->random_state, 0);
-    ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0);
-
-    dsputil_init(&s->dsp, avctx);
-
-    if(s->dsp.float_to_int16 == ff_float_to_int16_c) {
-        s->add_bias = 385;
-        s->scale_bias = 1.0/(8*32768);
-    } else {
-        s->add_bias = 0;
-        s->scale_bias = 1.0/(1*8);
-    }
-
-    /* Generate overlap window */
-    if (!ff_sine_128[127])
-        ff_init_ff_sine_windows(7);
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    avctx->channel_layout = CH_LAYOUT_MONO;
-    return 0;
-}
-
-static int decode_tag(AVCodecContext * avctx,
-                      void *data, int *data_size,
-                      AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    NellyMoserDecodeContext *s = avctx->priv_data;
-    int blocks, i;
-    int16_t* samples;
-    *data_size = 0;
-    samples = (int16_t*)data;
-
-    if (buf_size < avctx->block_align)
-        return buf_size;
-
-    switch (buf_size) {
-        case 64:    // 8000Hz
-            blocks = 1; break;
-        case 128:   // 11025Hz
-            blocks = 2; break;
-        case 192:   // 16000Hz
-            blocks = 3; break;
-        case 256:   // 22050Hz
-            blocks = 4; break;
-        case 512:   // 44100Hz
-            blocks = 8; break;
-        default:
-            av_log(avctx, AV_LOG_DEBUG, "Tag size %d.\n", buf_size);
-            return buf_size;
-    }
-
-    for (i=0 ; i<blocks ; i++) {
-        nelly_decode_block(s, &buf[i*NELLY_BLOCK_LEN], s->float_buf);
-        s->dsp.float_to_int16(&samples[i*NELLY_SAMPLES], s->float_buf, NELLY_SAMPLES);
-        *data_size += NELLY_SAMPLES*sizeof(int16_t);
-    }
-
-    return buf_size;
-}
-
-static av_cold int decode_end(AVCodecContext * avctx) {
-    NellyMoserDecodeContext *s = avctx->priv_data;
-
-    ff_mdct_end(&s->imdct_ctx);
-    return 0;
-}
-
-AVCodec nellymoser_decoder = {
-    "nellymoser",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_NELLYMOSER,
-    sizeof(NellyMoserDecodeContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_tag,
-    .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
-};
-
diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c
deleted file mode 100644
index dd9a271..0000000
--- a/libavcodec/nellymoserenc.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * Nellymoser encoder
- * This code is developed as part of Google Summer of Code 2008 Program.
- *
- * Copyright (c) 2008 Bartlomiej Wolowiec
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Nellymoser encoder
- * by Bartlomiej Wolowiec
- *
- * Generic codec information: libavcodec/nellymoserdec.c
- *
- * Some information also from: http://samples.mplayerhq.hu/A-codecs/Nelly_Moser/ASAO/ASAO.zip
- *                             (Copyright Joseph Artsimovich and UAB "DKD")
- *
- * for more information about nellymoser format, visit:
- * http://wiki.multimedia.cx/index.php?title=Nellymoser
- */
-
-#include "nellymoser.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "fft.h"
-
-#define BITSTREAM_WRITER_LE
-#include "put_bits.h"
-
-#define POW_TABLE_SIZE (1<<11)
-#define POW_TABLE_OFFSET 3
-#define OPT_SIZE ((1<<15) + 3000)
-
-typedef struct NellyMoserEncodeContext {
-    AVCodecContext  *avctx;
-    int             last_frame;
-    int             bufsel;
-    int             have_saved;
-    DSPContext      dsp;
-    FFTContext      mdct_ctx;
-    DECLARE_ALIGNED(16, float, mdct_out)[NELLY_SAMPLES];
-    DECLARE_ALIGNED(16, float, in_buff)[NELLY_SAMPLES];
-    DECLARE_ALIGNED(16, float, buf)[2][3 * NELLY_BUF_LEN];     ///< sample buffer
-    float           (*opt )[NELLY_BANDS];
-    uint8_t         (*path)[NELLY_BANDS];
-} NellyMoserEncodeContext;
-
-static float pow_table[POW_TABLE_SIZE];     ///< -pow(2, -i / 2048.0 - 3.0);
-
-static const uint8_t sf_lut[96] = {
-     0,  1,  1,  1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  4,  4,
-     5,  5,  5,  6,  7,  7,  8,  8,  9, 10, 11, 11, 12, 13, 13, 14,
-    15, 15, 16, 17, 17, 18, 19, 19, 20, 21, 22, 22, 23, 24, 25, 26,
-    27, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40,
-    41, 41, 42, 43, 44, 45, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53,
-    54, 55, 55, 56, 57, 57, 58, 59, 59, 60, 60, 60, 61, 61, 61, 62,
-};
-
-static const uint8_t sf_delta_lut[78] = {
-     0,  1,  1,  1,  1,  1,  1,  2,  2,  2,  2,  3,  3,  3,  4,  4,
-     4,  5,  5,  5,  6,  6,  7,  7,  8,  8,  9, 10, 10, 11, 11, 12,
-    13, 13, 14, 15, 16, 17, 17, 18, 19, 19, 20, 21, 21, 22, 22, 23,
-    23, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 27, 28,
-    28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 30,
-};
-
-static const uint8_t quant_lut[230] = {
-     0,
-
-     0,  1,  2,
-
-     0,  1,  2,  3,  4,  5,  6,
-
-     0,  1,  1,  2,  2,  3,  3,  4,  5,  6,  7,  8,  9, 10, 11, 11,
-    12, 13, 13, 13, 14,
-
-     0,  1,  1,  2,  2,  2,  3,  3,  4,  4,  5,  5,  6,  6,  7,  8,
-     8,  9, 10, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
-    22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 29,
-    30,
-
-     0,  1,  1,  1,  1,  1,  1,  2,  2,  2,  2,  2,  3,  3,  3,  3,
-     4,  4,  4,  5,  5,  5,  6,  6,  7,  7,  7,  8,  8,  9,  9,  9,
-    10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15,
-    15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20,
-    21, 21, 22, 22, 23, 23, 24, 25, 26, 26, 27, 28, 29, 30, 31, 32,
-    33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42, 43, 44, 44, 45, 45,
-    46, 47, 47, 48, 48, 49, 49, 50, 50, 50, 51, 51, 51, 52, 52, 52,
-    53, 53, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57, 57,
-    58, 58, 58, 58, 59, 59, 59, 59, 60, 60, 60, 60, 60, 61, 61, 61,
-    61, 61, 61, 61, 62,
-};
-
-static const float quant_lut_mul[7] = { 0.0,  0.0,  2.0,  2.0,  5.0, 12.0,  36.6 };
-static const float quant_lut_add[7] = { 0.0,  0.0,  2.0,  7.0, 21.0, 56.0, 157.0 };
-static const uint8_t quant_lut_offset[8] = { 0, 0, 1, 4, 11, 32, 81, 230 };
-
-static void apply_mdct(NellyMoserEncodeContext *s)
-{
-    memcpy(s->in_buff, s->buf[s->bufsel], NELLY_BUF_LEN * sizeof(float));
-    s->dsp.vector_fmul(s->in_buff, ff_sine_128, NELLY_BUF_LEN);
-    s->dsp.vector_fmul_reverse(s->in_buff + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128,
-                               NELLY_BUF_LEN);
-    ff_mdct_calc(&s->mdct_ctx, s->mdct_out, s->in_buff);
-
-    s->dsp.vector_fmul(s->buf[s->bufsel] + NELLY_BUF_LEN, ff_sine_128, NELLY_BUF_LEN);
-    s->dsp.vector_fmul_reverse(s->buf[s->bufsel] + 2 * NELLY_BUF_LEN, s->buf[1 - s->bufsel], ff_sine_128,
-                               NELLY_BUF_LEN);
-    ff_mdct_calc(&s->mdct_ctx, s->mdct_out + NELLY_BUF_LEN, s->buf[s->bufsel] + NELLY_BUF_LEN);
-}
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    NellyMoserEncodeContext *s = avctx->priv_data;
-    int i;
-
-    if (avctx->channels != 1) {
-        av_log(avctx, AV_LOG_ERROR, "Nellymoser supports only 1 channel\n");
-        return -1;
-    }
-
-    if (avctx->sample_rate != 8000 && avctx->sample_rate != 16000 &&
-        avctx->sample_rate != 11025 &&
-        avctx->sample_rate != 22050 && avctx->sample_rate != 44100 &&
-        avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
-        av_log(avctx, AV_LOG_ERROR, "Nellymoser works only with 8000, 16000, 11025, 22050 and 44100 sample rate\n");
-        return -1;
-    }
-
-    avctx->frame_size = NELLY_SAMPLES;
-    s->avctx = avctx;
-    ff_mdct_init(&s->mdct_ctx, 8, 0, 1.0);
-    dsputil_init(&s->dsp, avctx);
-
-    /* Generate overlap window */
-    ff_sine_window_init(ff_sine_128, 128);
-    for (i = 0; i < POW_TABLE_SIZE; i++)
-        pow_table[i] = -pow(2, -i / 2048.0 - 3.0 + POW_TABLE_OFFSET);
-
-    if (s->avctx->trellis) {
-        s->opt  = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float  ));
-        s->path = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t));
-    }
-
-    return 0;
-}
-
-static av_cold int encode_end(AVCodecContext *avctx)
-{
-    NellyMoserEncodeContext *s = avctx->priv_data;
-
-    ff_mdct_end(&s->mdct_ctx);
-
-    if (s->avctx->trellis) {
-        av_free(s->opt);
-        av_free(s->path);
-    }
-
-    return 0;
-}
-
-#define find_best(val, table, LUT, LUT_add, LUT_size) \
-    best_idx = \
-        LUT[av_clip ((lrintf(val) >> 8) + LUT_add, 0, LUT_size - 1)]; \
-    if (fabs(val - table[best_idx]) > fabs(val - table[best_idx + 1])) \
-        best_idx++;
-
-static void get_exponent_greedy(NellyMoserEncodeContext *s, float *cand, int *idx_table)
-{
-    int band, best_idx, power_idx = 0;
-    float power_candidate;
-
-    //base exponent
-    find_best(cand[0], ff_nelly_init_table, sf_lut, -20, 96);
-    idx_table[0] = best_idx;
-    power_idx = ff_nelly_init_table[best_idx];
-
-    for (band = 1; band < NELLY_BANDS; band++) {
-        power_candidate = cand[band] - power_idx;
-        find_best(power_candidate, ff_nelly_delta_table, sf_delta_lut, 37, 78);
-        idx_table[band] = best_idx;
-        power_idx += ff_nelly_delta_table[best_idx];
-    }
-}
-
-static inline float distance(float x, float y, int band)
-{
-    //return pow(fabs(x-y), 2.0);
-    float tmp = x - y;
-    return tmp * tmp;
-}
-
-static void get_exponent_dynamic(NellyMoserEncodeContext *s, float *cand, int *idx_table)
-{
-    int i, j, band, best_idx;
-    float power_candidate, best_val;
-
-    float  (*opt )[NELLY_BANDS] = s->opt ;
-    uint8_t(*path)[NELLY_BANDS] = s->path;
-
-    for (i = 0; i < NELLY_BANDS * OPT_SIZE; i++) {
-        opt[0][i] = INFINITY;
-    }
-
-    for (i = 0; i < 64; i++) {
-        opt[0][ff_nelly_init_table[i]] = distance(cand[0], ff_nelly_init_table[i], 0);
-        path[0][ff_nelly_init_table[i]] = i;
-    }
-
-    for (band = 1; band < NELLY_BANDS; band++) {
-        int q, c = 0;
-        float tmp;
-        int idx_min, idx_max, idx;
-        power_candidate = cand[band];
-        for (q = 1000; !c && q < OPT_SIZE; q <<= 2) {
-            idx_min = FFMAX(0, cand[band] - q);
-            idx_max = FFMIN(OPT_SIZE, cand[band - 1] + q);
-            for (i = FFMAX(0, cand[band - 1] - q); i < FFMIN(OPT_SIZE, cand[band - 1] + q); i++) {
-                if ( isinf(opt[band - 1][i]) )
-                    continue;
-                for (j = 0; j < 32; j++) {
-                    idx = i + ff_nelly_delta_table[j];
-                    if (idx > idx_max)
-                        break;
-                    if (idx >= idx_min) {
-                        tmp = opt[band - 1][i] + distance(idx, power_candidate, band);
-                        if (opt[band][idx] > tmp) {
-                            opt[band][idx] = tmp;
-                            path[band][idx] = j;
-                            c = 1;
-                        }
-                    }
-                }
-            }
-        }
-        assert(c); //FIXME
-    }
-
-    best_val = INFINITY;
-    best_idx = -1;
-    band = NELLY_BANDS - 1;
-    for (i = 0; i < OPT_SIZE; i++) {
-        if (best_val > opt[band][i]) {
-            best_val = opt[band][i];
-            best_idx = i;
-        }
-    }
-    for (band = NELLY_BANDS - 1; band >= 0; band--) {
-        idx_table[band] = path[band][best_idx];
-        if (band) {
-            best_idx -= ff_nelly_delta_table[path[band][best_idx]];
-        }
-    }
-}
-
-/**
- * Encodes NELLY_SAMPLES samples. It assumes, that samples contains 3 * NELLY_BUF_LEN values
- *  @param s               encoder context
- *  @param output          output buffer
- *  @param output_size     size of output buffer
- */
-static void encode_block(NellyMoserEncodeContext *s, unsigned char *output, int output_size)
-{
-    PutBitContext pb;
-    int i, j, band, block, best_idx, power_idx = 0;
-    float power_val, coeff, coeff_sum;
-    float pows[NELLY_FILL_LEN];
-    int bits[NELLY_BUF_LEN], idx_table[NELLY_BANDS];
-    float cand[NELLY_BANDS];
-
-    apply_mdct(s);
-
-    init_put_bits(&pb, output, output_size * 8);
-
-    i = 0;
-    for (band = 0; band < NELLY_BANDS; band++) {
-        coeff_sum = 0;
-        for (j = 0; j < ff_nelly_band_sizes_table[band]; i++, j++) {
-            coeff_sum += s->mdct_out[i                ] * s->mdct_out[i                ]
-                       + s->mdct_out[i + NELLY_BUF_LEN] * s->mdct_out[i + NELLY_BUF_LEN];
-        }
-        cand[band] =
-            log(FFMAX(1.0, coeff_sum / (ff_nelly_band_sizes_table[band] << 7))) * 1024.0 / M_LN2;
-    }
-
-    if (s->avctx->trellis) {
-        get_exponent_dynamic(s, cand, idx_table);
-    } else {
-        get_exponent_greedy(s, cand, idx_table);
-    }
-
-    i = 0;
-    for (band = 0; band < NELLY_BANDS; band++) {
-        if (band) {
-            power_idx += ff_nelly_delta_table[idx_table[band]];
-            put_bits(&pb, 5, idx_table[band]);
-        } else {
-            power_idx = ff_nelly_init_table[idx_table[0]];
-            put_bits(&pb, 6, idx_table[0]);
-        }
-        power_val = pow_table[power_idx & 0x7FF] / (1 << ((power_idx >> 11) + POW_TABLE_OFFSET));
-        for (j = 0; j < ff_nelly_band_sizes_table[band]; i++, j++) {
-            s->mdct_out[i] *= power_val;
-            s->mdct_out[i + NELLY_BUF_LEN] *= power_val;
-            pows[i] = power_idx;
-        }
-    }
-
-    ff_nelly_get_sample_bits(pows, bits);
-
-    for (block = 0; block < 2; block++) {
-        for (i = 0; i < NELLY_FILL_LEN; i++) {
-            if (bits[i] > 0) {
-                const float *table = ff_nelly_dequantization_table + (1 << bits[i]) - 1;
-                coeff = s->mdct_out[block * NELLY_BUF_LEN + i];
-                best_idx =
-                    quant_lut[av_clip (
-                            coeff * quant_lut_mul[bits[i]] + quant_lut_add[bits[i]],
-                            quant_lut_offset[bits[i]],
-                            quant_lut_offset[bits[i]+1] - 1
-                            )];
-                if (fabs(coeff - table[best_idx]) > fabs(coeff - table[best_idx + 1]))
-                    best_idx++;
-
-                put_bits(&pb, bits[i], best_idx);
-            }
-        }
-        if (!block)
-            put_bits(&pb, NELLY_HEADER_BITS + NELLY_DETAIL_BITS - put_bits_count(&pb), 0);
-    }
-
-    flush_put_bits(&pb);
-}
-
-static int encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data)
-{
-    NellyMoserEncodeContext *s = avctx->priv_data;
-    int16_t *samples = data;
-    int i;
-
-    if (s->last_frame)
-        return 0;
-
-    if (data) {
-        for (i = 0; i < avctx->frame_size; i++) {
-            s->buf[s->bufsel][i] = samples[i];
-        }
-        for (; i < NELLY_SAMPLES; i++) {
-            s->buf[s->bufsel][i] = 0;
-        }
-        s->bufsel = 1 - s->bufsel;
-        if (!s->have_saved) {
-            s->have_saved = 1;
-            return 0;
-        }
-    } else {
-        memset(s->buf[s->bufsel], 0, sizeof(s->buf[0][0]) * NELLY_BUF_LEN);
-        s->bufsel = 1 - s->bufsel;
-        s->last_frame = 1;
-    }
-
-    if (s->have_saved) {
-        encode_block(s, frame, buf_size);
-        return NELLY_BLOCK_LEN;
-    }
-    return 0;
-}
-
-AVCodec nellymoser_encoder = {
-    .name = "nellymoser",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_NELLYMOSER,
-    .priv_data_size = sizeof(NellyMoserEncodeContext),
-    .init = encode_init,
-    .encode = encode_frame,
-    .close = encode_end,
-    .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY,
-    .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"),
-};
diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
deleted file mode 100644
index c49dd1f..0000000
--- a/libavcodec/noise_bsf.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-
-
-static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    unsigned int *state= bsfc->priv_data;
-    int amount= args ? atoi(args) : (*state % 10001+1);
-    int i;
-
-    *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-    memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    for(i=0; i<buf_size; i++){
-        (*state) += (*poutbuf)[i] + 1;
-        if(*state % amount == 0)
-            (*poutbuf)[i] = *state;
-    }
-    return 1;
-}
-
-AVBitStreamFilter noise_bsf={
-    "noise",
-    sizeof(int),
-    noise,
-};
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
deleted file mode 100644
index 791f450..0000000
--- a/libavcodec/nuv.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * NuppelVideo decoder
- * Copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "libavutil/bswap.h"
-#include "libavutil/lzo.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "rtjpeg.h"
-
-typedef struct {
-    AVFrame pic;
-    int codec_frameheader;
-    int quality;
-    int width, height;
-    unsigned int decomp_size;
-    unsigned char* decomp_buf;
-    uint32_t lq[64], cq[64];
-    RTJpegContext rtj;
-    DSPContext dsp;
-} NuvContext;
-
-static const uint8_t fallback_lquant[] = {
-    16,  11,  10,  16,  24,  40,  51,  61,
-    12,  12,  14,  19,  26,  58,  60,  55,
-    14,  13,  16,  24,  40,  57,  69,  56,
-    14,  17,  22,  29,  51,  87,  80,  62,
-    18,  22,  37,  56,  68, 109, 103,  77,
-    24,  35,  55,  64,  81, 104, 113,  92,
-    49,  64,  78,  87, 103, 121, 120, 101,
-    72,  92,  95,  98, 112, 100, 103,  99
-};
-
-static const uint8_t fallback_cquant[] = {
-    17, 18, 24, 47, 99, 99, 99, 99,
-    18, 21, 26, 66, 99, 99, 99, 99,
-    24, 26, 56, 99, 99, 99, 99, 99,
-    47, 66, 99, 99, 99, 99, 99, 99,
-    99, 99, 99, 99, 99, 99, 99, 99,
-    99, 99, 99, 99, 99, 99, 99, 99,
-    99, 99, 99, 99, 99, 99, 99, 99,
-    99, 99, 99, 99, 99, 99, 99, 99
-};
-
-/**
- * \brief copy frame data from buffer to AVFrame, handling stride.
- * \param f destination AVFrame
- * \param src source buffer, does not use any line-stride
- * \param width width of the video frame
- * \param height height of the video frame
- */
-static void copy_frame(AVFrame *f, const uint8_t *src,
-                       int width, int height) {
-    AVPicture pic;
-    avpicture_fill(&pic, src, PIX_FMT_YUV420P, width, height);
-    av_picture_copy((AVPicture *)f, &pic, PIX_FMT_YUV420P, width, height);
-}
-
-/**
- * \brief extract quantization tables from codec data into our context
- */
-static int get_quant(AVCodecContext *avctx, NuvContext *c,
-                     const uint8_t *buf, int size) {
-    int i;
-    if (size < 2 * 64 * 4) {
-        av_log(avctx, AV_LOG_ERROR, "insufficient rtjpeg quant data\n");
-        return -1;
-    }
-    for (i = 0; i < 64; i++, buf += 4)
-        c->lq[i] = AV_RL32(buf);
-    for (i = 0; i < 64; i++, buf += 4)
-        c->cq[i] = AV_RL32(buf);
-    return 0;
-}
-
-/**
- * \brief set quantization tables from a quality value
- */
-static void get_quant_quality(NuvContext *c, int quality) {
-    int i;
-    quality = FFMAX(quality, 1);
-    for (i = 0; i < 64; i++) {
-        c->lq[i] = (fallback_lquant[i] << 7) / quality;
-        c->cq[i] = (fallback_cquant[i] << 7) / quality;
-    }
-}
-
-static int codec_reinit(AVCodecContext *avctx, int width, int height, int quality) {
-    NuvContext *c = avctx->priv_data;
-    width = (width + 1) & ~1;
-    height = (height + 1) & ~1;
-    if (quality >= 0)
-        get_quant_quality(c, quality);
-    if (width != c->width || height != c->height) {
-        if (avcodec_check_dimensions(avctx, height, width) < 0)
-            return 0;
-        avctx->width = c->width = width;
-        avctx->height = c->height = height;
-        c->decomp_size = c->height * c->width * 3 / 2;
-        c->decomp_buf = av_realloc(c->decomp_buf, c->decomp_size + AV_LZO_OUTPUT_PADDING);
-        if (!c->decomp_buf) {
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-            return 0;
-        }
-        rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
-    } else if (quality != c->quality)
-        rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
-    return 1;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    NuvContext *c = avctx->priv_data;
-    AVFrame *picture = data;
-    int orig_size = buf_size;
-    int keyframe;
-    int result;
-    enum {NUV_UNCOMPRESSED = '0', NUV_RTJPEG = '1',
-          NUV_RTJPEG_IN_LZO = '2', NUV_LZO = '3',
-          NUV_BLACK = 'N', NUV_COPY_LAST = 'L'} comptype;
-
-    if (buf_size < 12) {
-        av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
-        return -1;
-    }
-
-    // codec data (rtjpeg quant tables)
-    if (buf[0] == 'D' && buf[1] == 'R') {
-        int ret;
-        // skip rest of the frameheader.
-        buf = &buf[12];
-        buf_size -= 12;
-        ret = get_quant(avctx, c, buf, buf_size);
-        if (ret < 0)
-            return ret;
-        rtjpeg_decode_init(&c->rtj, &c->dsp, c->width, c->height, c->lq, c->cq);
-        return orig_size;
-    }
-
-    if (buf[0] != 'V' || buf_size < 12) {
-        av_log(avctx, AV_LOG_ERROR, "not a nuv video frame\n");
-        return -1;
-    }
-    comptype = buf[1];
-    switch (comptype) {
-        case NUV_RTJPEG_IN_LZO:
-        case NUV_RTJPEG:
-            keyframe = !buf[2]; break;
-        case NUV_COPY_LAST:
-            keyframe = 0; break;
-        default:
-            keyframe = 1; break;
-    }
-    // skip rest of the frameheader.
-    buf = &buf[12];
-    buf_size -= 12;
-    if (comptype == NUV_RTJPEG_IN_LZO || comptype == NUV_LZO) {
-        int outlen = c->decomp_size, inlen = buf_size;
-        if (av_lzo1x_decode(c->decomp_buf, &outlen, buf, &inlen))
-            av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n");
-        buf = c->decomp_buf;
-        buf_size = c->decomp_size;
-    }
-    if (c->codec_frameheader) {
-        int w, h, q;
-        if (buf_size < 12) {
-            av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame\n");
-            return -1;
-        }
-        w = AV_RL16(&buf[6]);
-        h = AV_RL16(&buf[8]);
-        q = buf[10];
-        if (!codec_reinit(avctx, w, h, q))
-            return -1;
-        buf = &buf[12];
-        buf_size -= 12;
-    }
-
-    if (keyframe && c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    c->pic.reference = 3;
-    c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
-                          FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    result = avctx->reget_buffer(avctx, &c->pic);
-    if (result < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    c->pic.pict_type = keyframe ? FF_I_TYPE : FF_P_TYPE;
-    c->pic.key_frame = keyframe;
-    // decompress/copy/whatever data
-    switch (comptype) {
-        case NUV_LZO:
-        case NUV_UNCOMPRESSED: {
-            int height = c->height;
-            if (buf_size < c->width * height * 3 / 2) {
-                av_log(avctx, AV_LOG_ERROR, "uncompressed frame too short\n");
-                height = buf_size / c->width / 3 * 2;
-            }
-            copy_frame(&c->pic, buf, c->width, height);
-            break;
-        }
-        case NUV_RTJPEG_IN_LZO:
-        case NUV_RTJPEG: {
-            rtjpeg_decode_frame_yuv420(&c->rtj, &c->pic, buf, buf_size);
-            break;
-        }
-        case NUV_BLACK: {
-            memset(c->pic.data[0], 0, c->width * c->height);
-            memset(c->pic.data[1], 128, c->width * c->height / 4);
-            memset(c->pic.data[2], 128, c->width * c->height / 4);
-            break;
-        }
-        case NUV_COPY_LAST: {
-            /* nothing more to do here */
-            break;
-        }
-        default:
-            av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
-            return -1;
-    }
-
-    *picture = c->pic;
-    *data_size = sizeof(AVFrame);
-    return orig_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx) {
-    NuvContext *c = avctx->priv_data;
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-    c->pic.data[0] = NULL;
-    c->decomp_buf = NULL;
-    c->quality = -1;
-    c->width = 0;
-    c->height = 0;
-    c->codec_frameheader = avctx->codec_tag == MKTAG('R', 'J', 'P', 'G');
-    if (avctx->extradata_size)
-        get_quant(avctx, c, avctx->extradata, avctx->extradata_size);
-    dsputil_init(&c->dsp, avctx);
-    if (!codec_reinit(avctx, avctx->width, avctx->height, -1))
-        return 1;
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx) {
-    NuvContext *c = avctx->priv_data;
-    av_freep(&c->decomp_buf);
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    return 0;
-}
-
-AVCodec nuv_decoder = {
-    "nuv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_NUV,
-    sizeof(NuvContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"),
-};
-
diff --git a/libavcodec/opt.c b/libavcodec/opt.c
deleted file mode 100644
index f9cba05..0000000
--- a/libavcodec/opt.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * AVOptions
- * Copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * AVOptions
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "avcodec.h"
-#include "opt.h"
-#include "eval.h"
-
-//FIXME order them and do a bin search
-const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags){
-    AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
-    const AVOption *o= c->option;
-
-    for(;o && o->name; o++){
-        if(!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags )
-            return o;
-    }
-    return NULL;
-}
-
-const AVOption *av_next_option(void *obj, const AVOption *last){
-    if(last && last[1].name) return ++last;
-    else if(last)            return NULL;
-    else                     return (*(AVClass**)obj)->option;
-}
-
-static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out){
-    const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
-    void *dst;
-    if(o_out)
-        *o_out= o;
-    if(!o || o->offset<=0)
-        return AVERROR(ENOENT);
-
-    if(o->max*den < num*intnum || o->min*den > num*intnum) {
-        av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);
-        return AVERROR(ERANGE);
-    }
-
-    dst= ((uint8_t*)obj) + o->offset;
-
-    switch(o->type){
-    case FF_OPT_TYPE_FLAGS:
-    case FF_OPT_TYPE_INT:   *(int       *)dst= llrint(num/den)*intnum; break;
-    case FF_OPT_TYPE_INT64: *(int64_t   *)dst= llrint(num/den)*intnum; break;
-    case FF_OPT_TYPE_FLOAT: *(float     *)dst= num*intnum/den;         break;
-    case FF_OPT_TYPE_DOUBLE:*(double    *)dst= num*intnum/den;         break;
-    case FF_OPT_TYPE_RATIONAL:
-        if((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};
-        else                *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);
-        break;
-    default:
-        return AVERROR(EINVAL);
-    }
-    return 0;
-}
-
-static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){
-    const AVOption *o = NULL;
-    if (av_set_number2(obj, name, num, den, intnum, &o) < 0)
-        return NULL;
-    else
-        return o;
-}
-
-static const double const_values[]={
-    M_PI,
-    M_E,
-    FF_QP2LAMBDA,
-    0
-};
-
-static const char * const const_names[]={
-    "PI",
-    "E",
-    "QP2LAMBDA",
-    0
-};
-
-static int hexchar2int(char c) {
-    if (c >= '0' && c <= '9') return c - '0';
-    if (c >= 'a' && c <= 'f') return c - 'a' + 10;
-    if (c >= 'A' && c <= 'F') return c - 'A' + 10;
-    return -1;
-}
-
-int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out){
-    int ret;
-    const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
-    if (o_out)
-        *o_out = o;
-    if(!o)
-        return AVERROR(ENOENT);
-    if(!val || o->offset<=0)
-        return AVERROR(EINVAL);
-
-    if(o->type == FF_OPT_TYPE_BINARY){
-        uint8_t **dst = (uint8_t **)(((uint8_t*)obj) + o->offset);
-        int *lendst = (int *)(dst + 1);
-        uint8_t *bin, *ptr;
-        int len = strlen(val);
-        av_freep(dst);
-        *lendst = 0;
-        if (len & 1) return AVERROR(EINVAL);
-        len /= 2;
-        ptr = bin = av_malloc(len);
-        while (*val) {
-            int a = hexchar2int(*val++);
-            int b = hexchar2int(*val++);
-            if (a < 0 || b < 0) {
-                av_free(bin);
-                return AVERROR(EINVAL);
-            }
-            *ptr++ = (a << 4) | b;
-        }
-        *dst = bin;
-        *lendst = len;
-        return 0;
-    }
-    if(o->type != FF_OPT_TYPE_STRING){
-        int notfirst=0;
-        for(;;){
-            int i;
-            char buf[256];
-            int cmd=0;
-            double d;
-            const char *error = NULL;
-
-            if(*val == '+' || *val == '-')
-                cmd= *(val++);
-
-            for(i=0; i<sizeof(buf)-1 && val[i] && val[i]!='+' && val[i]!='-'; i++)
-                buf[i]= val[i];
-            buf[i]=0;
-
-            d = ff_parse_and_eval_expr(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &error);
-            if(isnan(d)) {
-                const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0);
-                if(o_named && o_named->type == FF_OPT_TYPE_CONST)
-                    d= o_named->default_val;
-                else if(!strcmp(buf, "default")) d= o->default_val;
-                else if(!strcmp(buf, "max"    )) d= o->max;
-                else if(!strcmp(buf, "min"    )) d= o->min;
-                else if(!strcmp(buf, "none"   )) d= 0;
-                else if(!strcmp(buf, "all"    )) d= ~0;
-                else {
-                    if (error)
-                        av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error);
-                    return AVERROR(EINVAL);
-                }
-            }
-            if(o->type == FF_OPT_TYPE_FLAGS){
-                if     (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d;
-                else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d;
-            }else{
-                if     (cmd=='+') d= notfirst*av_get_double(obj, name, NULL) + d;
-                else if(cmd=='-') d= notfirst*av_get_double(obj, name, NULL) - d;
-            }
-
-            if ((ret = av_set_number2(obj, name, d, 1, 1, o_out)) < 0)
-                return ret;
-            val+= i;
-            if(!*val)
-                return 0;
-            notfirst=1;
-        }
-        return AVERROR(EINVAL);
-    }
-
-    if(alloc){
-        av_free(*(void**)(((uint8_t*)obj) + o->offset));
-        val= av_strdup(val);
-    }
-
-    memcpy(((uint8_t*)obj) + o->offset, &val, sizeof(val));
-    return 0;
-}
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc){
-    const AVOption *o;
-    if (av_set_string3(obj, name, val, alloc, &o) < 0)
-        return NULL;
-    return o;
-}
-
-const AVOption *av_set_string(void *obj, const char *name, const char *val){
-    const AVOption *o;
-    if (av_set_string3(obj, name, val, 0, &o) < 0)
-        return NULL;
-    return o;
-}
-#endif
-
-const AVOption *av_set_double(void *obj, const char *name, double n){
-    return av_set_number(obj, name, n, 1, 1);
-}
-
-const AVOption *av_set_q(void *obj, const char *name, AVRational n){
-    return av_set_number(obj, name, n.num, n.den, 1);
-}
-
-const AVOption *av_set_int(void *obj, const char *name, int64_t n){
-    return av_set_number(obj, name, 1, 1, n);
-}
-
-/**
- *
- * @param buf a buffer which is used for returning non string values as strings, can be NULL
- * @param buf_len allocated length in bytes of buf
- */
-const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len){
-    const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
-    void *dst;
-    uint8_t *bin;
-    int len, i;
-    if(!o || o->offset<=0)
-        return NULL;
-    if(o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len))
-        return NULL;
-
-    dst= ((uint8_t*)obj) + o->offset;
-    if(o_out) *o_out= o;
-
-    switch(o->type){
-    case FF_OPT_TYPE_FLAGS:     snprintf(buf, buf_len, "0x%08X",*(int    *)dst);break;
-    case FF_OPT_TYPE_INT:       snprintf(buf, buf_len, "%d" , *(int    *)dst);break;
-    case FF_OPT_TYPE_INT64:     snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break;
-    case FF_OPT_TYPE_FLOAT:     snprintf(buf, buf_len, "%f" , *(float  *)dst);break;
-    case FF_OPT_TYPE_DOUBLE:    snprintf(buf, buf_len, "%f" , *(double *)dst);break;
-    case FF_OPT_TYPE_RATIONAL:  snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break;
-    case FF_OPT_TYPE_STRING:    return *(void**)dst;
-    case FF_OPT_TYPE_BINARY:
-        len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *));
-        if(len >= (buf_len + 1)/2) return NULL;
-        bin = *(uint8_t**)dst;
-        for(i = 0; i < len; i++) snprintf(buf + i*2, 3, "%02X", bin[i]);
-        break;
-    default: return NULL;
-    }
-    return buf;
-}
-
-static int av_get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum){
-    const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
-    void *dst;
-    if(!o || o->offset<=0)
-        goto error;
-
-    dst= ((uint8_t*)obj) + o->offset;
-
-    if(o_out) *o_out= o;
-
-    switch(o->type){
-    case FF_OPT_TYPE_FLAGS:     *intnum= *(unsigned int*)dst;return 0;
-    case FF_OPT_TYPE_INT:       *intnum= *(int    *)dst;return 0;
-    case FF_OPT_TYPE_INT64:     *intnum= *(int64_t*)dst;return 0;
-    case FF_OPT_TYPE_FLOAT:     *num=    *(float  *)dst;return 0;
-    case FF_OPT_TYPE_DOUBLE:    *num=    *(double *)dst;return 0;
-    case FF_OPT_TYPE_RATIONAL:  *intnum= ((AVRational*)dst)->num;
-                                *den   = ((AVRational*)dst)->den;
-                                                        return 0;
-    }
-error:
-    *den=*intnum=0;
-    return -1;
-}
-
-double av_get_double(void *obj, const char *name, const AVOption **o_out){
-    int64_t intnum=1;
-    double num=1;
-    int den=1;
-
-    av_get_number(obj, name, o_out, &num, &den, &intnum);
-    return num*intnum/den;
-}
-
-AVRational av_get_q(void *obj, const char *name, const AVOption **o_out){
-    int64_t intnum=1;
-    double num=1;
-    int den=1;
-
-    av_get_number(obj, name, o_out, &num, &den, &intnum);
-    if(num == 1.0 && (int)intnum == intnum)
-        return (AVRational){intnum, den};
-    else
-        return av_d2q(num*intnum/den, 1<<24);
-}
-
-int64_t av_get_int(void *obj, const char *name, const AVOption **o_out){
-    int64_t intnum=1;
-    double num=1;
-    int den=1;
-
-    av_get_number(obj, name, o_out, &num, &den, &intnum);
-    return num*intnum/den;
-}
-
-static void opt_list(void *obj, void *av_log_obj, const char *unit)
-{
-    const AVOption *opt=NULL;
-
-    while((opt= av_next_option(obj, opt))){
-        if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM)))
-            continue;
-
-        /* Don't print CONST's on level one.
-         * Don't print anything but CONST's on level two.
-         * Only print items from the requested unit.
-         */
-        if (!unit && opt->type==FF_OPT_TYPE_CONST)
-            continue;
-        else if (unit && opt->type!=FF_OPT_TYPE_CONST)
-            continue;
-        else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit))
-            continue;
-        else if (unit && opt->type == FF_OPT_TYPE_CONST)
-            av_log(av_log_obj, AV_LOG_INFO, "   %-15s ", opt->name);
-        else
-            av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
-
-        switch( opt->type )
-        {
-            case FF_OPT_TYPE_FLAGS:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>" );
-                break;
-            case FF_OPT_TYPE_INT:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<int>" );
-                break;
-            case FF_OPT_TYPE_INT64:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<int64>" );
-                break;
-            case FF_OPT_TYPE_DOUBLE:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<double>" );
-                break;
-            case FF_OPT_TYPE_FLOAT:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<float>" );
-                break;
-            case FF_OPT_TYPE_STRING:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<string>" );
-                break;
-            case FF_OPT_TYPE_RATIONAL:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<rational>" );
-                break;
-            case FF_OPT_TYPE_BINARY:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<binary>" );
-                break;
-            case FF_OPT_TYPE_CONST:
-            default:
-                av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" );
-                break;
-        }
-        av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.');
-        av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.');
-        av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM   ) ? 'V' : '.');
-        av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM   ) ? 'A' : '.');
-        av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
-
-        if(opt->help)
-            av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
-        av_log(av_log_obj, AV_LOG_INFO, "\n");
-        if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
-            opt_list(obj, av_log_obj, opt->unit);
-        }
-    }
-}
-
-int av_opt_show(void *obj, void *av_log_obj){
-    if(!obj)
-        return -1;
-
-    av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name);
-
-    opt_list(obj, av_log_obj, NULL);
-
-    return 0;
-}
-
-/** Set the values of the AVCodecContext or AVFormatContext structure.
- * They are set to the defaults specified in the according AVOption options
- * array default_val field.
- *
- * @param s AVCodecContext or AVFormatContext for which the defaults will be set
- */
-void av_opt_set_defaults2(void *s, int mask, int flags)
-{
-    const AVOption *opt = NULL;
-    while ((opt = av_next_option(s, opt)) != NULL) {
-        if((opt->flags & mask) != flags)
-            continue;
-        switch(opt->type) {
-            case FF_OPT_TYPE_CONST:
-                /* Nothing to be done here */
-            break;
-            case FF_OPT_TYPE_FLAGS:
-            case FF_OPT_TYPE_INT: {
-                int val;
-                val = opt->default_val;
-                av_set_int(s, opt->name, val);
-            }
-            break;
-            case FF_OPT_TYPE_INT64:
-                if((double)(opt->default_val+0.6) == opt->default_val)
-                    av_log(s, AV_LOG_DEBUG, "loss of precision in default of %s\n", opt->name);
-                av_set_int(s, opt->name, opt->default_val);
-            break;
-            case FF_OPT_TYPE_FLOAT: {
-                double val;
-                val = opt->default_val;
-                av_set_double(s, opt->name, val);
-            }
-            break;
-            case FF_OPT_TYPE_RATIONAL: {
-                AVRational val;
-                val = av_d2q(opt->default_val, INT_MAX);
-                av_set_q(s, opt->name, val);
-            }
-            break;
-            case FF_OPT_TYPE_STRING:
-            case FF_OPT_TYPE_BINARY:
-                /* Cannot set default for string as default_val is of type * double */
-            break;
-            default:
-                av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name);
-        }
-    }
-}
-
-void av_opt_set_defaults(void *s){
-    av_opt_set_defaults2(s, 0, 0);
-}
-
diff --git a/libavcodec/opt.h b/libavcodec/opt.h
deleted file mode 100644
index 55ca4ea..0000000
--- a/libavcodec/opt.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * AVOptions
- * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_OPT_H
-#define AVCODEC_OPT_H
-
-/**
- * @file
- * AVOptions
- */
-
-#include "libavutil/rational.h"
-#include "avcodec.h"
-
-enum AVOptionType{
-    FF_OPT_TYPE_FLAGS,
-    FF_OPT_TYPE_INT,
-    FF_OPT_TYPE_INT64,
-    FF_OPT_TYPE_DOUBLE,
-    FF_OPT_TYPE_FLOAT,
-    FF_OPT_TYPE_STRING,
-    FF_OPT_TYPE_RATIONAL,
-    FF_OPT_TYPE_BINARY,  ///< offset must point to a pointer immediately followed by an int for the length
-    FF_OPT_TYPE_CONST=128,
-};
-
-/**
- * AVOption
- */
-typedef struct AVOption {
-    const char *name;
-
-    /**
-     * short English help text
-     * @todo What about other languages?
-     */
-    const char *help;
-
-    /**
-     * The offset relative to the context structure where the option
-     * value is stored. It should be 0 for named constants.
-     */
-    int offset;
-    enum AVOptionType type;
-
-    /**
-     * the default value for scalar options
-     */
-    double default_val;
-    double min;                 ///< minimum valid value for the option
-    double max;                 ///< maximum valid value for the option
-
-    int flags;
-#define AV_OPT_FLAG_ENCODING_PARAM  1   ///< a generic parameter which can be set by the user for muxing or encoding
-#define AV_OPT_FLAG_DECODING_PARAM  2   ///< a generic parameter which can be set by the user for demuxing or decoding
-#define AV_OPT_FLAG_METADATA        4   ///< some data extracted or inserted into the file like title, comment, ...
-#define AV_OPT_FLAG_AUDIO_PARAM     8
-#define AV_OPT_FLAG_VIDEO_PARAM     16
-#define AV_OPT_FLAG_SUBTITLE_PARAM  32
-//FIXME think about enc-audio, ... style flags
-
-    /**
-     * The logical unit to which the option belongs. Non-constant
-     * options and corresponding named constants share the same
-     * unit. May be NULL.
-     */
-    const char *unit;
-} AVOption;
-
-/**
- * AVOption2.
- * THIS IS NOT PART OF THE API/ABI YET!
- * This is identical to AVOption except that default_val was replaced by
- * an union, it should be compatible with AVOption on normal platforms.
- */
-typedef struct AVOption2 {
-    const char *name;
-
-    /**
-     * short English help text
-     * @todo What about other languages?
-     */
-    const char *help;
-
-    /**
-     * The offset relative to the context structure where the option
-     * value is stored. It should be 0 for named constants.
-     */
-    int offset;
-    enum AVOptionType type;
-
-    /**
-     * the default value for scalar options
-     */
-    union {
-        double dbl;
-        const char *str;
-    } default_val;
-
-    double min;                 ///< minimum valid value for the option
-    double max;                 ///< maximum valid value for the option
-
-    int flags;
-/*
-#define AV_OPT_FLAG_ENCODING_PARAM  1   ///< a generic parameter which can be set by the user for muxing or encoding
-#define AV_OPT_FLAG_DECODING_PARAM  2   ///< a generic parameter which can be set by the user for demuxing or decoding
-#define AV_OPT_FLAG_METADATA        4   ///< some data extracted or inserted into the file like title, comment, ...
-#define AV_OPT_FLAG_AUDIO_PARAM     8
-#define AV_OPT_FLAG_VIDEO_PARAM     16
-#define AV_OPT_FLAG_SUBTITLE_PARAM  32
-*/
-//FIXME think about enc-audio, ... style flags
-
-    /**
-     * The logical unit to which the option belongs. Non-constant
-     * options and corresponding named constants share the same
-     * unit. May be NULL.
-     */
-    const char *unit;
-} AVOption2;
-
-
-/**
- * Looks for an option in obj. Looks only for the options which
- * have the flags set as specified in mask and flags (that is,
- * for which it is the case that opt->flags & mask == flags).
- *
- * @param[in] obj a pointer to a struct whose first element is a
- * pointer to an AVClass
- * @param[in] name the name of the option to look for
- * @param[in] unit the unit of the option to look for, or any if NULL
- * @return a pointer to the option found, or NULL if no option
- * has been found
- */
-const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags);
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-/**
- * @see av_set_string2()
- */
-attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val);
-
-/**
- * @return a pointer to the AVOption corresponding to the field set or
- * NULL if no matching AVOption exists, or if the value val is not
- * valid
- * @see av_set_string3()
- */
-attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc);
-#endif
-
-/**
- * Sets the field of obj with the given name to value.
- *
- * @param[in] obj A struct whose first element is a pointer to an
- * AVClass.
- * @param[in] name the name of the field to set
- * @param[in] val The value to set. If the field is not of a string
- * type, then the given string is parsed.
- * SI postfixes and some named scalars are supported.
- * If the field is of a numeric type, it has to be a numeric or named
- * scalar. Behavior with more than one scalar and +- infix operators
- * is undefined.
- * If the field is of a flags type, it has to be a sequence of numeric
- * scalars or named flags separated by '+' or '-'. Prefixing a flag
- * with '+' causes it to be set without affecting the other flags;
- * similarly, '-' unsets a flag.
- * @param[out] o_out if non-NULL put here a pointer to the AVOption
- * found
- * @param alloc when 1 then the old value will be av_freed() and the
- *                     new av_strduped()
- *              when 0 then no av_free() nor av_strdup() will be used
- * @return 0 if the value has been set, or an AVERROR code in case of
- * error:
- * AVERROR(ENOENT) if no matching option exists
- * AVERROR(ERANGE) if the value is out of range
- * AVERROR(EINVAL) if the value is not valid
- */
-int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out);
-
-const AVOption *av_set_double(void *obj, const char *name, double n);
-const AVOption *av_set_q(void *obj, const char *name, AVRational n);
-const AVOption *av_set_int(void *obj, const char *name, int64_t n);
-double av_get_double(void *obj, const char *name, const AVOption **o_out);
-AVRational av_get_q(void *obj, const char *name, const AVOption **o_out);
-int64_t av_get_int(void *obj, const char *name, const AVOption **o_out);
-const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len);
-const AVOption *av_next_option(void *obj, const AVOption *last);
-int av_opt_show(void *obj, void *av_log_obj);
-void av_opt_set_defaults(void *s);
-void av_opt_set_defaults2(void *s, int mask, int flags);
-
-#endif /* AVCODEC_OPT_H */
diff --git a/libavcodec/options.c b/libavcodec/options.c
deleted file mode 100644
index 97d705e..0000000
--- a/libavcodec/options.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Options definition for AVCodecContext.
- */
-
-#include "avcodec.h"
-#include "opt.h"
-#include <float.h>              /* FLT_MIN, FLT_MAX */
-
-static const char* context_to_name(void* ptr) {
-    AVCodecContext *avc= ptr;
-
-    if(avc && avc->codec && avc->codec->name)
-        return avc->codec->name;
-    else
-        return "NULL";
-}
-
-#define OFFSET(x) offsetof(AVCodecContext,x)
-#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
-//these names are too long to be readable
-#define V AV_OPT_FLAG_VIDEO_PARAM
-#define A AV_OPT_FLAG_AUDIO_PARAM
-#define S AV_OPT_FLAG_SUBTITLE_PARAM
-#define E AV_OPT_FLAG_ENCODING_PARAM
-#define D AV_OPT_FLAG_DECODING_PARAM
-
-#define AV_CODEC_DEFAULT_BITRATE 200*1000
-
-static const AVOption options[]={
-{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE, INT_MIN, INT_MAX, V|E},
-{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, 64*1000, INT_MIN, INT_MAX, A|E},
-{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, AV_CODEC_DEFAULT_BITRATE*20, 1, INT_MAX, V|E},
-{"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, 0, UINT_MAX, V|A|E|D, "flags"},
-{"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_4MV, INT_MIN, INT_MAX, V|E, "flags"},
-{"obmc", "use overlapped block motion compensation (h263+)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_OBMC, INT_MIN, INT_MAX, V|E, "flags"},
-{"qpel", "use 1/4 pel motion compensation", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QPEL, INT_MIN, INT_MAX, V|E, "flags"},
-{"loop", "use loop filter", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOOP_FILTER, INT_MIN, INT_MAX, V|E, "flags"},
-{"qscale", "use fixed qscale", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QSCALE, INT_MIN, INT_MAX, 0, "flags"},
-{"gmc", "use gmc", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GMC, INT_MIN, INT_MAX, V|E, "flags"},
-{"mv0", "always try a mb with mv=<0,0>", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_MV0, INT_MIN, INT_MAX, V|E, "flags"},
-{"part", "use data partitioning", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PART, INT_MIN, INT_MAX, V|E, "flags"},
-{"input_preserved", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INPUT_PRESERVED, INT_MIN, INT_MAX, 0, "flags"},
-{"pass1", "use internal 2pass ratecontrol in first  pass mode", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PASS1, INT_MIN, INT_MAX, 0, "flags"},
-{"pass2", "use internal 2pass ratecontrol in second pass mode", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PASS2, INT_MIN, INT_MAX, 0, "flags"},
-{"extern_huff", "use external huffman table (for mjpeg)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_EXTERN_HUFF, INT_MIN, INT_MAX, 0, "flags"},
-{"gray", "only decode/encode grayscale", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GRAY, INT_MIN, INT_MAX, V|E|D, "flags"},
-{"emu_edge", "don't draw edges", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_EMU_EDGE, INT_MIN, INT_MAX, 0, "flags"},
-{"psnr", "error[?] variables will be set during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_PSNR, INT_MIN, INT_MAX, V|E, "flags"},
-{"truncated", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRUNCATED, INT_MIN, INT_MAX, 0, "flags"},
-{"naq", "normalize adaptive quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_NORMALIZE_AQP, INT_MIN, INT_MAX, V|E, "flags"},
-{"ildct", "use interlaced dct", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_DCT, INT_MIN, INT_MAX, V|E, "flags"},
-{"low_delay", "force low delay", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOW_DELAY, INT_MIN, INT_MAX, V|D|E, "flags"},
-{"alt", "enable alternate scantable (mpeg2/mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_ALT_SCAN, INT_MIN, INT_MAX, V|E, "flags"},
-{"global_header", "place global headers in extradata instead of every keyframe", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GLOBAL_HEADER, INT_MIN, INT_MAX, V|A|E, "flags"},
-{"bitexact", "use only bitexact stuff (except (i)dct)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_BITEXACT, INT_MIN, INT_MAX, A|V|S|D|E, "flags"},
-{"aic", "h263 advanced intra coding / mpeg4 ac prediction", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_AC_PRED, INT_MIN, INT_MAX, V|E, "flags"},
-{"umv", "use unlimited motion vectors", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_UMV, INT_MIN, INT_MAX, V|E, "flags"},
-{"cbp", "use rate distortion optimization for cbp", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_CBP_RD, INT_MIN, INT_MAX, V|E, "flags"},
-{"qprd", "use rate distortion optimization for qp selection", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_QP_RD, INT_MIN, INT_MAX, V|E, "flags"},
-{"aiv", "h263 alternative inter vlc", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_AIV, INT_MIN, INT_MAX, V|E, "flags"},
-{"slice", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_SLICE_STRUCT, INT_MIN, INT_MAX, V|E, "flags"},
-{"ilme", "interlaced motion estimation", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_ME, INT_MIN, INT_MAX, V|E, "flags"},
-{"scan_offset", "will reserve space for svcd scan offset user data", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_SVCD_SCAN_OFFSET, INT_MIN, INT_MAX, V|E, "flags"},
-{"cgop", "closed gop", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_CLOSED_GOP, INT_MIN, INT_MAX, V|E, "flags"},
-{"fast", "allow non spec compliant speedup tricks", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FAST, INT_MIN, INT_MAX, V|E, "flags2"},
-{"sgop", "strictly enforce gop size", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_STRICT_GOP, INT_MIN, INT_MAX, V|E, "flags2"},
-{"noout", "skip bitstream encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NO_OUTPUT, INT_MIN, INT_MAX, V|E, "flags2"},
-{"local_header", "place global headers at every keyframe instead of in extradata", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_LOCAL_HEADER, INT_MIN, INT_MAX, V|E, "flags2"},
-{"sub_id", NULL, OFFSET(sub_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"me_method", "set motion estimation method", OFFSET(me_method), FF_OPT_TYPE_INT, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method"},
-{"zero", "zero motion estimation (fastest)", 0, FF_OPT_TYPE_CONST, ME_ZERO, INT_MIN, INT_MAX, V|E, "me_method" },
-{"full", "full motion estimation (slowest)", 0, FF_OPT_TYPE_CONST, ME_FULL, INT_MIN, INT_MAX, V|E, "me_method" },
-{"epzs", "EPZS motion estimation (default)", 0, FF_OPT_TYPE_CONST, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method" },
-{"esa", "esa motion estimation (alias for full)", 0, FF_OPT_TYPE_CONST, ME_FULL, INT_MIN, INT_MAX, V|E, "me_method" },
-{"tesa", "tesa motion estimation", 0, FF_OPT_TYPE_CONST, ME_TESA, INT_MIN, INT_MAX, V|E, "me_method" },
-{"dia", "dia motion estimation (alias for epzs)", 0, FF_OPT_TYPE_CONST, ME_EPZS, INT_MIN, INT_MAX, V|E, "me_method" },
-{"log", "log motion estimation", 0, FF_OPT_TYPE_CONST, ME_LOG, INT_MIN, INT_MAX, V|E, "me_method" },
-{"phods", "phods motion estimation", 0, FF_OPT_TYPE_CONST, ME_PHODS, INT_MIN, INT_MAX, V|E, "me_method" },
-{"x1", "X1 motion estimation", 0, FF_OPT_TYPE_CONST, ME_X1, INT_MIN, INT_MAX, V|E, "me_method" },
-{"hex", "hex motion estimation", 0, FF_OPT_TYPE_CONST, ME_HEX, INT_MIN, INT_MAX, V|E, "me_method" },
-{"umh", "umh motion estimation", 0, FF_OPT_TYPE_CONST, ME_UMH, INT_MIN, INT_MAX, V|E, "me_method" },
-{"iter", "iter motion estimation", 0, FF_OPT_TYPE_CONST, ME_ITER, INT_MIN, INT_MAX, V|E, "me_method" },
-{"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX},
-{"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E},
-{"rate_emu", "frame rate emulation", OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E},
-{"frame_size", NULL, OFFSET(frame_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E},
-{"frame_number", NULL, OFFSET(frame_number), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-#if LIBAVCODEC_VERSION_MAJOR < 53
-{"real_pict_num", NULL, OFFSET(real_pict_num), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-#endif
-{"delay", NULL, OFFSET(delay), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"qcomp", "video quantizer scale compression (VBR)", OFFSET(qcompress), FF_OPT_TYPE_FLOAT, 0.5, -FLT_MAX, FLT_MAX, V|E},
-{"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), FF_OPT_TYPE_FLOAT, 0.5, 0, FLT_MAX, V|E},
-{"qmin", "min video quantizer scale (VBR)", OFFSET(qmin), FF_OPT_TYPE_INT, 2, 1, 51, V|E},
-{"qmax", "max video quantizer scale (VBR)", OFFSET(qmax), FF_OPT_TYPE_INT, 31, 1, 51, V|E},
-{"qdiff", "max difference between the quantizer scale (VBR)", OFFSET(max_qdiff), FF_OPT_TYPE_INT, 3, INT_MIN, INT_MAX, V|E},
-{"bf", "use 'frames' B frames", OFFSET(max_b_frames), FF_OPT_TYPE_INT, DEFAULT, 0, FF_MAX_B_FRAMES, V|E},
-{"b_qfactor", "qp factor between p and b frames", OFFSET(b_quant_factor), FF_OPT_TYPE_FLOAT, 1.25, -FLT_MAX, FLT_MAX, V|E},
-{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
-{"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
-{"hurry_up", NULL, OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
-{"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"i_tex_bits", NULL, OFFSET(i_tex_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"p_tex_bits", NULL, OFFSET(p_tex_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"i_count", NULL, OFFSET(i_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"p_count", NULL, OFFSET(p_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"skip_count", NULL, OFFSET(skip_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"misc_bits", NULL, OFFSET(misc_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"frame_bits", NULL, OFFSET(frame_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"codec_tag", NULL, OFFSET(codec_tag), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"bug", "workaround not auto detected encoder bugs", OFFSET(workaround_bugs), FF_OPT_TYPE_FLAGS, FF_BUG_AUTODETECT, INT_MIN, INT_MAX, V|D, "bug"},
-{"autodetect", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_AUTODETECT, INT_MIN, INT_MAX, V|D, "bug"},
-{"old_msmpeg4", "some old lavc generated msmpeg4v3 files (no autodetection)", 0, FF_OPT_TYPE_CONST, FF_BUG_OLD_MSMPEG4, INT_MIN, INT_MAX, V|D, "bug"},
-{"xvid_ilace", "Xvid interlacing bug (autodetected if fourcc==XVIX)", 0, FF_OPT_TYPE_CONST, FF_BUG_XVID_ILACE, INT_MIN, INT_MAX, V|D, "bug"},
-{"ump4", "(autodetected if fourcc==UMP4)", 0, FF_OPT_TYPE_CONST, FF_BUG_UMP4, INT_MIN, INT_MAX, V|D, "bug"},
-{"no_padding", "padding bug (autodetected)", 0, FF_OPT_TYPE_CONST, FF_BUG_NO_PADDING, INT_MIN, INT_MAX, V|D, "bug"},
-{"amv", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_AMV, INT_MIN, INT_MAX, V|D, "bug"},
-{"ac_vlc", "illegal vlc bug (autodetected per fourcc)", 0, FF_OPT_TYPE_CONST, FF_BUG_AC_VLC, INT_MIN, INT_MAX, V|D, "bug"},
-{"qpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_QPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"},
-{"std_qpel", "old standard qpel (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_STD_QPEL, INT_MIN, INT_MAX, V|D, "bug"},
-{"qpel_chroma2", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_QPEL_CHROMA2, INT_MIN, INT_MAX, V|D, "bug"},
-{"direct_blocksize", "direct-qpel-blocksize bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_DIRECT_BLOCKSIZE, INT_MIN, INT_MAX, V|D, "bug"},
-{"edge", "edge padding bug (autodetected per fourcc/version)", 0, FF_OPT_TYPE_CONST, FF_BUG_EDGE, INT_MIN, INT_MAX, V|D, "bug"},
-{"hpel_chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_HPEL_CHROMA, INT_MIN, INT_MAX, V|D, "bug"},
-{"dc_clip", NULL, 0, FF_OPT_TYPE_CONST, FF_BUG_DC_CLIP, INT_MIN, INT_MAX, V|D, "bug"},
-{"ms", "workaround various bugs in microsofts broken decoders", 0, FF_OPT_TYPE_CONST, FF_BUG_MS, INT_MIN, INT_MAX, V|D, "bug"},
-{"trunc", "trancated frames", 0, FF_OPT_TYPE_CONST,FF_BUG_TRUNCATED, INT_MIN, INT_MAX, V|D, "bug"},
-{"lelim", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)", OFFSET(luma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"celim", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)", OFFSET(chroma_elim_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|V|D|E, "strict"},
-{"very", "strictly conform to a older more strict version of the spec or reference software", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_VERY_STRICT, INT_MIN, INT_MAX, V|D|E, "strict"},
-{"strict", "strictly conform to all the things in the spec no matter what consequences", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_STRICT, INT_MIN, INT_MAX, V|D|E, "strict"},
-{"normal", NULL, 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_NORMAL, INT_MIN, INT_MAX, V|D|E, "strict"},
-{"inofficial", "allow unofficial extensions", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_INOFFICIAL, INT_MIN, INT_MAX, V|D|E, "strict"},
-{"experimental", "allow non standardized experimental things", 0, FF_OPT_TYPE_CONST, FF_COMPLIANCE_EXPERIMENTAL, INT_MIN, INT_MAX, V|D|E, "strict"},
-{"b_qoffset", "qp offset between P and B frames", OFFSET(b_quant_offset), FF_OPT_TYPE_FLOAT, 1.25, -FLT_MAX, FLT_MAX, V|E},
-{"er", "set error detection aggressivity", OFFSET(error_recognition), FF_OPT_TYPE_INT, FF_ER_CAREFUL, INT_MIN, INT_MAX, A|V|D, "er"},
-{"careful", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_CAREFUL, INT_MIN, INT_MAX, V|D, "er"},
-{"compliant", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_COMPLIANT, INT_MIN, INT_MAX, V|D, "er"},
-{"aggressive", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_AGGRESSIVE, INT_MIN, INT_MAX, V|D, "er"},
-{"very_aggressive", NULL, 0, FF_OPT_TYPE_CONST, FF_ER_VERY_AGGRESSIVE, INT_MIN, INT_MAX, V|D, "er"},
-{"has_b_frames", NULL, OFFSET(has_b_frames), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"block_align", NULL, OFFSET(block_align), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"parse_only", NULL, OFFSET(parse_only), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"stats_out", NULL, OFFSET(stats_out), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX},
-{"stats_in", NULL, OFFSET(stats_in), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX},
-{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 99, V|E},
-{"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E},
-{"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"rc_override_count", NULL, OFFSET(rc_override_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"rc_eq", "set rate control equation", OFFSET(rc_eq), FF_OPT_TYPE_STRING, DEFAULT, CHAR_MIN, CHAR_MAX, V|E},
-{"maxrate", "set max video bitrate tolerance (in bits/s)", OFFSET(rc_max_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"minrate", "set min video bitrate tolerance (in bits/s)", OFFSET(rc_min_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|V|E},
-{"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), FF_OPT_TYPE_FLOAT, 1.0, -FLT_MAX, FLT_MAX, V|E},
-{"i_qfactor", "qp factor between P and I frames", OFFSET(i_quant_factor), FF_OPT_TYPE_FLOAT, -0.8, -FLT_MAX, FLT_MAX, V|E},
-{"i_qoffset", "qp offset between P and I frames", OFFSET(i_quant_offset), FF_OPT_TYPE_FLOAT, 0.0, -FLT_MAX, FLT_MAX, V|E},
-{"rc_init_cplx", "initial complexity for 1-pass encoding", OFFSET(rc_initial_cplx), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E},
-{"dct", "DCT algorithm", OFFSET(dct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E, "dct"},
-{"auto", "autoselect a good one (default)", 0, FF_OPT_TYPE_CONST, FF_DCT_AUTO, INT_MIN, INT_MAX, V|E, "dct"},
-{"fastint", "fast integer", 0, FF_OPT_TYPE_CONST, FF_DCT_FASTINT, INT_MIN, INT_MAX, V|E, "dct"},
-{"int", "accurate integer", 0, FF_OPT_TYPE_CONST, FF_DCT_INT, INT_MIN, INT_MAX, V|E, "dct"},
-{"mmx", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MMX, INT_MIN, INT_MAX, V|E, "dct"},
-{"mlib", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_MLIB, INT_MIN, INT_MAX, V|E, "dct"},
-{"altivec", NULL, 0, FF_OPT_TYPE_CONST, FF_DCT_ALTIVEC, INT_MIN, INT_MAX, V|E, "dct"},
-{"faan", "floating point AAN DCT", 0, FF_OPT_TYPE_CONST, FF_DCT_FAAN, INT_MIN, INT_MAX, V|E, "dct"},
-{"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
-{"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
-{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
-{"p_mask", "inter masking", OFFSET(p_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
-{"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), FF_OPT_TYPE_FLOAT, 0, -FLT_MAX, FLT_MAX, V|E},
-{"idct", "select IDCT implementation", OFFSET(idct_algo), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|E|D, "idct"},
-{"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_AUTO, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"int", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_INT, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"simple", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLE, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"simplemmx", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEMMX, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"libmpeg2mmx", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_LIBMPEG2MMX, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"ps2", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_PS2, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"mlib", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_MLIB, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"arm", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_ARM, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"altivec", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_ALTIVEC, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"sh4", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SH4, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"simplearm", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARM, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"simplearmv5te", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARMV5TE, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"simplearmv6", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEARMV6, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"simpleneon", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLENEON, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"simplealpha", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_SIMPLEALPHA, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"h264", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_H264, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"vp3", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_VP3, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"ipp", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_IPP, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"xvidmmx", NULL, 0, FF_OPT_TYPE_CONST, FF_IDCT_XVIDMMX, INT_MIN, INT_MAX, V|E|D, "idct"},
-{"faani", "floating point AAN IDCT", 0, FF_OPT_TYPE_CONST, FF_IDCT_FAAN, INT_MIN, INT_MAX, V|D|E, "idct"},
-{"slice_count", NULL, OFFSET(slice_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"ec", "set error concealment strategy", OFFSET(error_concealment), FF_OPT_TYPE_FLAGS, 3, INT_MIN, INT_MAX, V|D, "ec"},
-{"guess_mvs", "iterative motion vector (MV) search (slow)", 0, FF_OPT_TYPE_CONST, FF_EC_GUESS_MVS, INT_MIN, INT_MAX, V|D, "ec"},
-{"deblock", "use strong deblock filter for damaged MBs", 0, FF_OPT_TYPE_CONST, FF_EC_DEBLOCK, INT_MIN, INT_MAX, V|D, "ec"},
-{"bits_per_coded_sample", NULL, OFFSET(bits_per_coded_sample), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"pred", "prediction method", OFFSET(prediction_method), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "pred"},
-{"left", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_LEFT, INT_MIN, INT_MAX, V|E, "pred"},
-{"plane", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_PLANE, INT_MIN, INT_MAX, V|E, "pred"},
-{"median", NULL, 0, FF_OPT_TYPE_CONST, FF_PRED_MEDIAN, INT_MIN, INT_MAX, V|E, "pred"},
-{"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio), FF_OPT_TYPE_RATIONAL, DEFAULT, 0, 10, V|E},
-{"debug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, V|A|S|E|D, "debug"},
-{"pict", "picture info", 0, FF_OPT_TYPE_CONST, FF_DEBUG_PICT_INFO, INT_MIN, INT_MAX, V|D, "debug"},
-{"rc", "rate control", 0, FF_OPT_TYPE_CONST, FF_DEBUG_RC, INT_MIN, INT_MAX, V|E, "debug"},
-{"bitstream", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BITSTREAM, INT_MIN, INT_MAX, V|D, "debug"},
-{"mb_type", "macroblock (MB) type", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"},
-{"qp", "per-block quantization parameter (QP)", 0, FF_OPT_TYPE_CONST, FF_DEBUG_QP, INT_MIN, INT_MAX, V|D, "debug"},
-{"mv", "motion vector", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MV, INT_MIN, INT_MAX, V|D, "debug"},
-{"dct_coeff", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_DCT_COEFF, INT_MIN, INT_MAX, V|D, "debug"},
-{"skip", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_SKIP, INT_MIN, INT_MAX, V|D, "debug"},
-{"startcode", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_STARTCODE, INT_MIN, INT_MAX, V|D, "debug"},
-{"pts", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_PTS, INT_MIN, INT_MAX, V|D, "debug"},
-{"er", "error recognition", 0, FF_OPT_TYPE_CONST, FF_DEBUG_ER, INT_MIN, INT_MAX, V|D, "debug"},
-{"mmco", "memory management control operations (H.264)", 0, FF_OPT_TYPE_CONST, FF_DEBUG_MMCO, INT_MIN, INT_MAX, V|D, "debug"},
-{"bugs", NULL, 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUGS, INT_MIN, INT_MAX, V|D, "debug"},
-{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_QP, INT_MIN, INT_MAX, V|D, "debug"},
-{"vis_mb_type", "visualize block types", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MB_TYPE, INT_MIN, INT_MAX, V|D, "debug"},
-{"buffers", "picture buffer allocations", 0, FF_OPT_TYPE_CONST, FF_DEBUG_BUFFERS, INT_MIN, INT_MAX, V|D, "debug"},
-{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, V|D, "debug_mv"},
-{"pf", "forward predicted MVs of P-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_P_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
-{"bf", "forward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_FOR, INT_MIN, INT_MAX, V|D, "debug_mv"},
-{"bb", "backward predicted MVs of B-frames", 0, FF_OPT_TYPE_CONST, FF_DEBUG_VIS_MV_B_BACK, INT_MIN, INT_MAX, V|D, "debug_mv"},
-{"mb_qmin", "obsolete, use qmin", OFFSET(mb_qmin), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"mb_qmax", "obsolete, use qmax", OFFSET(mb_qmax), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"cmp", "full pel me compare function", OFFSET(me_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"subcmp", "sub pel me compare function", OFFSET(me_sub_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"ildctcmp", "interlaced dct compare function", OFFSET(ildct_cmp), FF_OPT_TYPE_INT, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"preme", "pre motion estimation", OFFSET(pre_me), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"sad", "sum of absolute differences, fast (default)", 0, FF_OPT_TYPE_CONST, FF_CMP_SAD, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"sse", "sum of squared errors", 0, FF_OPT_TYPE_CONST, FF_CMP_SSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"satd", "sum of absolute Hadamard transformed differences", 0, FF_OPT_TYPE_CONST, FF_CMP_SATD, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"dct", "sum of absolute DCT transformed differences", 0, FF_OPT_TYPE_CONST, FF_CMP_DCT, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, FF_OPT_TYPE_CONST, FF_CMP_PSNR, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"bit", "number of bits needed for the block", 0, FF_OPT_TYPE_CONST, FF_CMP_BIT, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"rd", "rate distortion optimal, slow", 0, FF_OPT_TYPE_CONST, FF_CMP_RD, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"zero", "0", 0, FF_OPT_TYPE_CONST, FF_CMP_ZERO, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"vsad", "sum of absolute vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSAD, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"vsse","sum of squared vertical differences", 0, FF_OPT_TYPE_CONST, FF_CMP_VSSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"nsse", "noise preserving sum of squared differences", 0, FF_OPT_TYPE_CONST, FF_CMP_NSSE, INT_MIN, INT_MAX, V|E, "cmp_func"},
-#if CONFIG_SNOW_ENCODER
-{"w53", "5/3 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W53, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"w97", "9/7 wavelet, only used in snow", 0, FF_OPT_TYPE_CONST, FF_CMP_W97, INT_MIN, INT_MAX, V|E, "cmp_func"},
-#endif
-{"dctmax", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_DCTMAX, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"chroma", NULL, 0, FF_OPT_TYPE_CONST, FF_CMP_CHROMA, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"subq", "sub pel motion estimation quality", OFFSET(me_subpel_quality), FF_OPT_TYPE_INT, 8, INT_MIN, INT_MAX, V|E},
-{"dtg_active_format", NULL, OFFSET(dtg_active_format), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"ibias", "intra quant bias", OFFSET(intra_quant_bias), FF_OPT_TYPE_INT, FF_DEFAULT_QUANT_BIAS, INT_MIN, INT_MAX, V|E},
-{"pbias", "inter quant bias", OFFSET(inter_quant_bias), FF_OPT_TYPE_INT, FF_DEFAULT_QUANT_BIAS, INT_MIN, INT_MAX, V|E},
-{"color_table_id", NULL, OFFSET(color_table_id), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"internal_buffer_count", NULL, OFFSET(internal_buffer_count), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"global_quality", NULL, OFFSET(global_quality), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"coder", NULL, OFFSET(coder_type), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "coder"},
-{"vlc", "variable length coder / huffman coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_VLC, INT_MIN, INT_MAX, V|E, "coder"},
-{"ac", "arithmetic coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_AC, INT_MIN, INT_MAX, V|E, "coder"},
-{"raw", "raw (no encoding)", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_RAW, INT_MIN, INT_MAX, V|E, "coder"},
-{"rle", "run-length coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_RLE, INT_MIN, INT_MAX, V|E, "coder"},
-{"deflate", "deflate-based coder", 0, FF_OPT_TYPE_CONST, FF_CODER_TYPE_DEFLATE, INT_MIN, INT_MAX, V|E, "coder"},
-{"context", "context model", OFFSET(context_model), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"slice_flags", NULL, OFFSET(slice_flags), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E, "mbd"},
-{"simple", "use mbcmp (default)", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_SIMPLE, INT_MIN, INT_MAX, V|E, "mbd"},
-{"bits", "use fewest bits", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_BITS, INT_MIN, INT_MAX, V|E, "mbd"},
-{"rd", "use best rate distortion", 0, FF_OPT_TYPE_CONST, FF_MB_DECISION_RD, INT_MIN, INT_MAX, V|E, "mbd"},
-{"stream_codec_tag", NULL, OFFSET(stream_codec_tag), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"lmin", "min lagrange factor (VBR)", OFFSET(lmin), FF_OPT_TYPE_INT,  2*FF_QP2LAMBDA, 0, INT_MAX, V|E},
-{"lmax", "max lagrange factor (VBR)", OFFSET(lmax), FF_OPT_TYPE_INT, 31*FF_QP2LAMBDA, 0, INT_MAX, V|E},
-{"nr", "noise reduction", OFFSET(noise_reduction), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"inter_threshold", NULL, OFFSET(inter_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"flags2", NULL, OFFSET(flags2), FF_OPT_TYPE_FLAGS, CODEC_FLAG2_FASTPSKIP|CODEC_FLAG2_BIT_RESERVOIR|CODEC_FLAG2_PSY|CODEC_FLAG2_MBTREE, 0, UINT_MAX, V|A|E|D, "flags2"},
-{"error", NULL, OFFSET(error_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"antialias", "MP3 antialias algorithm", OFFSET(antialias_algo), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D, "aa"},
-{"auto", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_AUTO, INT_MIN, INT_MAX, V|D, "aa"},
-{"fastint", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FASTINT, INT_MIN, INT_MAX, V|D, "aa"},
-{"int", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_INT, INT_MIN, INT_MAX, V|D, "aa"},
-{"float", NULL, 0, FF_OPT_TYPE_CONST, FF_AA_FLOAT, INT_MIN, INT_MAX, V|D, "aa"},
-{"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"threads", NULL, OFFSET(thread_count), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E|D},
-{"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
-{"nssew", "nsse weight", OFFSET(nsse_weight), FF_OPT_TYPE_INT, 8, INT_MIN, INT_MAX, V|E},
-{"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
-{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
-{"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
-{"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
-{"aac_main", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_MAIN, INT_MIN, INT_MAX, A|E, "profile"},
-{"aac_low", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_LOW, INT_MIN, INT_MAX, A|E, "profile"},
-{"aac_ssr", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_SSR, INT_MIN, INT_MAX, A|E, "profile"},
-{"aac_ltp", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_LTP, INT_MIN, INT_MAX, A|E, "profile"},
-{"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
-{"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
-{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D},
-{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), FF_OPT_TYPE_INT, FF_CMP_DCTMAX, INT_MIN, INT_MAX, V|E, "cmp_func"},
-{"border_mask", "increases the quantizer for macroblocks close to borders", OFFSET(border_masking), FF_OPT_TYPE_FLOAT, DEFAULT, -FLT_MAX, FLT_MAX, V|E},
-{"mblmin", "min macroblock lagrange factor (VBR)", OFFSET(mb_lmin), FF_OPT_TYPE_INT, FF_QP2LAMBDA * 2, 1, FF_LAMBDA_MAX, V|E},
-{"mblmax", "max macroblock lagrange factor (VBR)", OFFSET(mb_lmax), FF_OPT_TYPE_INT, FF_QP2LAMBDA * 31, 1, FF_LAMBDA_MAX, V|E},
-{"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), FF_OPT_TYPE_INT, 256, INT_MIN, INT_MAX, V|E},
-{"skip_loop_filter", NULL, OFFSET(skip_loop_filter), FF_OPT_TYPE_INT, AVDISCARD_DEFAULT, INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"skip_idct"       , NULL, OFFSET(skip_idct)       , FF_OPT_TYPE_INT, AVDISCARD_DEFAULT, INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"skip_frame"      , NULL, OFFSET(skip_frame)      , FF_OPT_TYPE_INT, AVDISCARD_DEFAULT, INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"none"            , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_NONE   , INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"default"         , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_DEFAULT, INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"noref"           , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_NONREF , INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"bidir"           , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_BIDIR  , INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"nokey"           , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_NONKEY , INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"all"             , NULL, 0, FF_OPT_TYPE_CONST, AVDISCARD_ALL    , INT_MIN, INT_MAX, V|D, "avdiscard"},
-{"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), FF_OPT_TYPE_INT, 1, 0, 4, V|E},
-{"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), FF_OPT_TYPE_INT, DEFAULT, 0, 10, V|E},
-{"crf", "enables constant quality mode, and selects the quality (x264)", OFFSET(crf), FF_OPT_TYPE_FLOAT, DEFAULT, 0, 51, V|E},
-{"cqp", "constant quantization parameter rate control method", OFFSET(cqp), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, V|E},
-{"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), FF_OPT_TYPE_INT, 25, INT_MIN, INT_MAX, V|E},
-{"refs", "reference frames to consider for motion compensation (Snow)", OFFSET(refs), FF_OPT_TYPE_INT, 1, INT_MIN, INT_MAX, V|E},
-{"chromaoffset", "chroma qp offset from luma", OFFSET(chromaoffset), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
-{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|A|E},
-{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), FF_OPT_TYPE_INT, 2, INT_MIN, INT_MAX, V|E},
-{"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BPYRAMID, INT_MIN, INT_MAX, V|E, "flags2"},
-{"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_WPRED, INT_MIN, INT_MAX, V|E, "flags2"},
-{"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MIXED_REFS, INT_MIN, INT_MAX, V|E, "flags2"},
-{"dct8x8", "high profile 8x8 transform (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_8X8DCT, INT_MIN, INT_MAX, V|E, "flags2"},
-{"fastpskip", "fast pskip (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_FASTPSKIP, INT_MIN, INT_MAX, V|E, "flags2"},
-{"aud", "access unit delimiters (H.264)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_AUD, INT_MIN, INT_MAX, V|E, "flags2"},
-{"skiprd", "RD optimal MB level residual skipping", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_SKIP_RD, INT_MIN, INT_MAX, V|E, "flags2"},
-{"complexityblur", "reduce fluctuations in qp (before curve compression)", OFFSET(complexityblur), FF_OPT_TYPE_FLOAT, 20.0, FLT_MIN, FLT_MAX, V|E},
-{"deblockalpha", "in-loop deblocking filter alphac0 parameter", OFFSET(deblockalpha), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E},
-{"deblockbeta", "in-loop deblocking filter beta parameter", OFFSET(deblockbeta), FF_OPT_TYPE_INT, DEFAULT, -6, 6, V|E},
-{"partitions", "macroblock subpartition sizes to consider", OFFSET(partitions), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, V|E, "partitions"},
-{"parti4x4", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_I4X4, INT_MIN, INT_MAX, V|E, "partitions"},
-{"parti8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_I8X8, INT_MIN, INT_MAX, V|E, "partitions"},
-{"partp4x4", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P4X4, INT_MIN, INT_MAX, V|E, "partitions"},
-{"partp8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_P8X8, INT_MIN, INT_MAX, V|E, "partitions"},
-{"partb8x8", NULL, 0, FF_OPT_TYPE_CONST, X264_PART_B8X8, INT_MIN, INT_MAX, V|E, "partitions"},
-{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), FF_OPT_TYPE_INT, 6, 0, INT_MAX, V|E},
-{"mv0_threshold", NULL, OFFSET(mv0_threshold), FF_OPT_TYPE_INT, 256, 0, INT_MAX, V|E},
-{"ivlc", "intra vlc table", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_INTRA_VLC, INT_MIN, INT_MAX, V|E, "flags2"},
-{"b_sensitivity", "adjusts sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), FF_OPT_TYPE_INT, 40, 1, INT_MAX, V|E},
-{"compression_level", NULL, OFFSET(compression_level), FF_OPT_TYPE_INT, FF_COMPRESSION_DEFAULT, INT_MIN, INT_MAX, V|A|E},
-{"use_lpc", "sets whether to use LPC mode (FLAC)", OFFSET(use_lpc), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
-{"lpc_coeff_precision", "LPC coefficient precision (FLAC)", OFFSET(lpc_coeff_precision), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|E},
-{"min_prediction_order", NULL, OFFSET(min_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
-{"max_prediction_order", NULL, OFFSET(max_prediction_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
-{"prediction_order_method", "search method for selecting prediction order", OFFSET(prediction_order_method), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
-{"min_partition_order", NULL, OFFSET(min_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
-{"max_partition_order", NULL, OFFSET(max_partition_order), FF_OPT_TYPE_INT, -1, INT_MIN, INT_MAX, A|E},
-{"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT64, 0, 0, INT64_MAX, V|E},
-{"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"},
-{"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
-{"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|D},
-{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, 1.0, 0.0, 1.0, A|D},
-{"reservoir", "use bit reservoir", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BIT_RESERVOIR, INT_MIN, INT_MAX, A|E, "flags2"},
-{"mbtree", "use macroblock tree ratecontrol (x264 only)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MBTREE, INT_MIN, INT_MAX, V|E, "flags2"},
-{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
-{"channel_layout", NULL, OFFSET(channel_layout), FF_OPT_TYPE_INT64, DEFAULT, 0, INT64_MAX, A|E|D, "channel_layout"},
-{"request_channel_layout", NULL, OFFSET(request_channel_layout), FF_OPT_TYPE_INT64, DEFAULT, 0, INT64_MAX, A|D, "request_channel_layout"},
-{"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), FF_OPT_TYPE_FLOAT, 1.0/3, 0.0, FLT_MAX, V|E},
-{"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use),  FF_OPT_TYPE_FLOAT, 3,     0.0, FLT_MAX, V|E},
-{"ticks_per_frame", NULL, OFFSET(ticks_per_frame), FF_OPT_TYPE_INT, 1, 1, INT_MAX, A|V|E|D},
-{"color_primaries", NULL, OFFSET(color_primaries), FF_OPT_TYPE_INT, AVCOL_PRI_UNSPECIFIED, 1, AVCOL_PRI_NB-1, V|E|D},
-{"color_trc", NULL, OFFSET(color_trc), FF_OPT_TYPE_INT, AVCOL_TRC_UNSPECIFIED, 1, AVCOL_TRC_NB-1, V|E|D},
-{"colorspace", NULL, OFFSET(colorspace), FF_OPT_TYPE_INT, AVCOL_SPC_UNSPECIFIED, 1, AVCOL_SPC_NB-1, V|E|D},
-{"color_range", NULL, OFFSET(color_range), FF_OPT_TYPE_INT, AVCOL_RANGE_UNSPECIFIED, 0, AVCOL_RANGE_NB-1, V|E|D},
-{"chroma_sample_location", NULL, OFFSET(chroma_sample_location), FF_OPT_TYPE_INT, AVCHROMA_LOC_UNSPECIFIED, 0, AVCHROMA_LOC_NB-1, V|E|D},
-{"psy", "use psycho visual optimization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_PSY, INT_MIN, INT_MAX, V|E, "flags2"},
-{"psy_rd", "specify psycho visual strength", OFFSET(psy_rd), FF_OPT_TYPE_FLOAT, 1.0, 0, FLT_MAX, V|E},
-{"psy_trellis", "specify psycho visual trellis", OFFSET(psy_trellis), FF_OPT_TYPE_FLOAT, 0, 0, FLT_MAX, V|E},
-{"aq_mode", "specify aq method", OFFSET(aq_mode), FF_OPT_TYPE_INT, 1, 0, INT_MAX, V|E},
-{"aq_strength", "specify aq strength", OFFSET(aq_strength), FF_OPT_TYPE_FLOAT, 1.0, 0, FLT_MAX, V|E},
-{"rc_lookahead", "specify number of frames to look ahead for frametype", OFFSET(rc_lookahead), FF_OPT_TYPE_INT, 40, 0, INT_MAX, V|E},
-{"ssim", "ssim will be calculated during encoding", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_SSIM, INT_MIN, INT_MAX, V|E, "flags2"},
-{NULL},
-};
-
-#undef A
-#undef V
-#undef S
-#undef E
-#undef D
-#undef DEFAULT
-
-static const AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options, LIBAVUTIL_VERSION_INT };
-
-void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
-    int flags=0;
-    memset(s, 0, sizeof(AVCodecContext));
-
-    s->av_class= &av_codec_context_class;
-
-    s->codec_type = codec_type;
-    if(codec_type == AVMEDIA_TYPE_AUDIO)
-        flags= AV_OPT_FLAG_AUDIO_PARAM;
-    else if(codec_type == AVMEDIA_TYPE_VIDEO)
-        flags= AV_OPT_FLAG_VIDEO_PARAM;
-    else if(codec_type == AVMEDIA_TYPE_SUBTITLE)
-        flags= AV_OPT_FLAG_SUBTITLE_PARAM;
-    av_opt_set_defaults2(s, flags, flags);
-
-    s->time_base= (AVRational){0,1};
-    s->get_buffer= avcodec_default_get_buffer;
-    s->release_buffer= avcodec_default_release_buffer;
-    s->get_format= avcodec_default_get_format;
-    s->execute= avcodec_default_execute;
-    s->execute2= avcodec_default_execute2;
-    s->sample_aspect_ratio= (AVRational){0,1};
-    s->pix_fmt= PIX_FMT_NONE;
-    s->sample_fmt= SAMPLE_FMT_NONE;
-
-    s->palctrl = NULL;
-    s->reget_buffer= avcodec_default_reget_buffer;
-    s->reordered_opaque= AV_NOPTS_VALUE;
-}
-
-AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
-    AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
-
-    if(avctx==NULL) return NULL;
-
-    avcodec_get_context_defaults2(avctx, codec_type);
-
-    return avctx;
-}
-
-void avcodec_get_context_defaults(AVCodecContext *s){
-    avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
-}
-
-AVCodecContext *avcodec_alloc_context(void){
-    return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
-}
-
-int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
-{
-    if (dest->codec) { // check that the dest context is uninitialized
-        av_log(dest, AV_LOG_ERROR,
-               "Tried to copy AVCodecContext %p into already-initialized %p\n",
-               src, dest);
-        return AVERROR(EINVAL);
-    }
-    memcpy(dest, src, sizeof(*dest));
-
-    /* set values specific to opened codecs back to their default state */
-    dest->priv_data       = NULL;
-    dest->codec           = NULL;
-    dest->palctrl         = NULL;
-    dest->slice_offset    = NULL;
-    dest->internal_buffer = NULL;
-    dest->hwaccel         = NULL;
-    dest->thread_opaque   = NULL;
-
-    /* reallocate values that should be allocated separately */
-    dest->rc_eq           = NULL;
-    dest->extradata       = NULL;
-    dest->intra_matrix    = NULL;
-    dest->inter_matrix    = NULL;
-    dest->rc_override     = NULL;
-    if (src->rc_eq) {
-        dest->rc_eq = av_strdup(src->rc_eq);
-        if (!dest->rc_eq)
-            return AVERROR(ENOMEM);
-    }
-
-#define alloc_and_copy_or_fail(obj, size, pad) \
-    if (src->obj && size > 0) { \
-        dest->obj = av_malloc(size + pad); \
-        if (!dest->obj) \
-            goto fail; \
-        memcpy(dest->obj, src->obj, size); \
-        if (pad) \
-            memset(((uint8_t *) dest->obj) + size, 0, pad); \
-    }
-    alloc_and_copy_or_fail(extradata,    src->extradata_size,
-                           FF_INPUT_BUFFER_PADDING_SIZE);
-    alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);
-    alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0);
-    alloc_and_copy_or_fail(rc_override,  src->rc_override_count * sizeof(*src->rc_override), 0);
-#undef alloc_and_copy_or_fail
-
-    return 0;
-
-fail:
-    av_freep(&dest->rc_override);
-    av_freep(&dest->intra_matrix);
-    av_freep(&dest->inter_matrix);
-    av_freep(&dest->extradata);
-    av_freep(&dest->rc_eq);
-    return AVERROR(ENOMEM);
-}
diff --git a/libavcodec/os2thread.c b/libavcodec/os2thread.c
deleted file mode 100644
index 3d1367c..0000000
--- a/libavcodec/os2thread.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-//#define DEBUG
-
-// Ported by Vlad Stelmahovsky
-
-#include "avcodec.h"
-
-#define INCL_DOS
-#define INCL_DOSERRORS
-#define INCL_DOSDEVIOCTL
-#include <os2.h>
-
-typedef struct ThreadContext{
-    AVCodecContext *avctx;
-    int thread;
-    HEV work_sem;
-    HEV done_sem;
-    int (*func)(AVCodecContext *c, void *arg);
-    void *arg;
-    int ret;
-}ThreadContext;
-
-
-static void attribute_align_arg thread_func(void *v){
-    ThreadContext *c= v;
-
-    for(;;){
-        //printf("thread_func %X enter wait\n", (int)v); fflush(stdout);
-        DosWaitEventSem(c->work_sem, SEM_INDEFINITE_WAIT);
-//        WaitForSingleObject(c->work_sem, INFINITE);
-//printf("thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout);
-        if(c->func)
-            c->ret= c->func(c->avctx, c->arg);
-        else
-            return;
-        //printf("thread_func %X signal complete\n", (int)v); fflush(stdout);
-        DosPostEventSem(c->done_sem);
-//        ReleaseSemaphore(c->done_sem, 1, 0);
-    }
-
-    return;
-}
-
-/**
- * free what has been allocated by avcodec_thread_init().
- * must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running
- */
-void avcodec_thread_free(AVCodecContext *s){
-    ThreadContext *c= s->thread_opaque;
-    int i;
-
-    for(i=0; i<s->thread_count; i++){
-
-        c[i].func= NULL;
-        DosPostEventSem(c[i].work_sem);
-        //        ReleaseSemaphore(c[i].work_sem, 1, 0);
-        DosWaitThread((PTID)&c[i].thread,DCWW_WAIT);
-//        WaitForSingleObject(c[i].thread, INFINITE);
-        if(c[i].work_sem) DosCloseEventSem(c[i].work_sem);//CloseHandle(c[i].work_sem);
-        if(c[i].done_sem) DosCloseEventSem(c[i].done_sem);//CloseHandle(c[i].done_sem);
-    }
-
-    av_freep(&s->thread_opaque);
-}
-
-static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
-    ThreadContext *c= s->thread_opaque;
-    int i;
-
-    assert(s == c->avctx);
-    assert(count <= s->thread_count);
-
-    /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */
-
-    for(i=0; i<count; i++){
-
-        c[i].arg= (char*)arg + i*size;
-        c[i].func= func;
-        c[i].ret= 12345;
-
-        DosPostEventSem(c[i].work_sem);
-//        ReleaseSemaphore(c[i].work_sem, 1, 0);
-    }
-    for(i=0; i<count; i++){
-        DosWaitEventSem(c[i].done_sem,SEM_INDEFINITE_WAIT);
-//        WaitForSingleObject(c[i].done_sem, INFINITE);
-
-        c[i].func= NULL;
-        if(ret) ret[i]= c[i].ret;
-    }
-    return 0;
-}
-
-int avcodec_thread_init(AVCodecContext *s, int thread_count){
-    int i;
-    ThreadContext *c;
-    uint32_t threadid;
-
-    s->thread_count= thread_count;
-
-    if (thread_count <= 1)
-        return 0;
-
-    assert(!s->thread_opaque);
-    c= av_mallocz(sizeof(ThreadContext)*thread_count);
-    s->thread_opaque= c;
-
-    for(i=0; i<thread_count; i++){
-//printf("init semaphors %d\n", i); fflush(stdout);
-        c[i].avctx= s;
-
-        if (DosCreateEventSem(NULL,&c[i].work_sem,DC_SEM_SHARED,0))
-            goto fail;
-        if (DosCreateEventSem(NULL,&c[i].done_sem,DC_SEM_SHARED,0))
-            goto fail;
-
-//printf("create thread %d\n", i); fflush(stdout);
-//        c[i].thread = (HANDLE)_beginthreadex(NULL, 0, thread_func, &c[i], 0, &threadid );
-        c[i].thread = _beginthread(thread_func, NULL, 0x10000, &c[i]);
-        if( c[i].thread <= 0 ) goto fail;
-    }
-//printf("init done\n"); fflush(stdout);
-
-    s->execute= avcodec_thread_execute;
-
-    return 0;
-fail:
-    avcodec_thread_free(s);
-    return -1;
-}
diff --git a/libavcodec/pamenc.c b/libavcodec/pamenc.c
deleted file mode 100644
index ae0ea3a..0000000
--- a/libavcodec/pamenc.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * PAM image format
- * Copyright (c) 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "pnm.h"
-
-
-static int pam_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
-                            int buf_size, void *data)
-{
-    PNMContext *s     = avctx->priv_data;
-    AVFrame *pict     = data;
-    AVFrame * const p = (AVFrame*)&s->picture;
-    int i, h, w, n, linesize, depth, maxval;
-    const char *tuple_type;
-    uint8_t *ptr;
-
-    if (buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200) {
-        av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-
-    *p           = *pict;
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-
-    s->bytestream_start =
-    s->bytestream       = outbuf;
-    s->bytestream_end   = outbuf+buf_size;
-
-    h = avctx->height;
-    w = avctx->width;
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_MONOWHITE:
-        n          = (w + 7) >> 3;
-        depth      = 1;
-        maxval     = 1;
-        tuple_type = "BLACKANDWHITE";
-        break;
-    case PIX_FMT_GRAY8:
-        n          = w;
-        depth      = 1;
-        maxval     = 255;
-        tuple_type = "GRAYSCALE";
-        break;
-    case PIX_FMT_RGB24:
-        n          = w * 3;
-        depth      = 3;
-        maxval     = 255;
-        tuple_type = "RGB";
-        break;
-    case PIX_FMT_RGB32:
-        n          = w * 4;
-        depth      = 4;
-        maxval     = 255;
-        tuple_type = "RGB_ALPHA";
-        break;
-    default:
-        return -1;
-    }
-    snprintf(s->bytestream, s->bytestream_end - s->bytestream,
-             "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLETYPE %s\nENDHDR\n",
-             w, h, depth, maxval, tuple_type);
-    s->bytestream += strlen(s->bytestream);
-
-    ptr      = p->data[0];
-    linesize = p->linesize[0];
-
-    if (avctx->pix_fmt == PIX_FMT_RGB32) {
-        int j;
-        unsigned int v;
-
-        for (i = 0; i < h; i++) {
-            for (j = 0; j < w; j++) {
-                v = ((uint32_t *)ptr)[j];
-                bytestream_put_be24(&s->bytestream, v);
-                *s->bytestream++ = v >> 24;
-            }
-            ptr += linesize;
-        }
-    } else {
-        for (i = 0; i < h; i++) {
-            memcpy(s->bytestream, ptr, n);
-            s->bytestream += n;
-            ptr           += linesize;
-        }
-    }
-    return s->bytestream - s->bytestream_start;
-}
-
-
-AVCodec pam_encoder = {
-    "pam",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PAM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    pam_encode_frame,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
-};
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
deleted file mode 100644
index 864b5f2..0000000
--- a/libavcodec/parser.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Audio and Video frame extraction
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-
-static AVCodecParser *av_first_parser = NULL;
-
-AVCodecParser* av_parser_next(AVCodecParser *p){
-    if(p) return p->next;
-    else  return av_first_parser;
-}
-
-void av_register_codec_parser(AVCodecParser *parser)
-{
-    parser->next = av_first_parser;
-    av_first_parser = parser;
-}
-
-AVCodecParserContext *av_parser_init(int codec_id)
-{
-    AVCodecParserContext *s;
-    AVCodecParser *parser;
-    int ret;
-
-    if(codec_id == CODEC_ID_NONE)
-        return NULL;
-
-    for(parser = av_first_parser; parser != NULL; parser = parser->next) {
-        if (parser->codec_ids[0] == codec_id ||
-            parser->codec_ids[1] == codec_id ||
-            parser->codec_ids[2] == codec_id ||
-            parser->codec_ids[3] == codec_id ||
-            parser->codec_ids[4] == codec_id)
-            goto found;
-    }
-    return NULL;
- found:
-    s = av_mallocz(sizeof(AVCodecParserContext));
-    if (!s)
-        return NULL;
-    s->parser = parser;
-    s->priv_data = av_mallocz(parser->priv_data_size);
-    if (!s->priv_data) {
-        av_free(s);
-        return NULL;
-    }
-    if (parser->parser_init) {
-        ret = parser->parser_init(s);
-        if (ret != 0) {
-            av_free(s->priv_data);
-            av_free(s);
-            return NULL;
-        }
-    }
-    s->fetch_timestamp=1;
-    s->pict_type = FF_I_TYPE;
-    s->key_frame = -1;
-    s->convergence_duration = AV_NOPTS_VALUE;
-    s->dts_sync_point       = INT_MIN;
-    s->dts_ref_dts_delta    = INT_MIN;
-    s->pts_dts_delta        = INT_MIN;
-    return s;
-}
-
-void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){
-    int i;
-
-    s->dts= s->pts= AV_NOPTS_VALUE;
-    s->pos= -1;
-    s->offset= 0;
-    for(i = 0; i < AV_PARSER_PTS_NB; i++) {
-        if (   s->cur_offset + off >= s->cur_frame_offset[i]
-            && (s->frame_offset < s->cur_frame_offset[i] ||
-              (!s->frame_offset && !s->next_frame_offset)) // first field/frame
-            //check is disabled  because mpeg-ts doesnt send complete PES packets
-            && /*s->next_frame_offset + off <*/  s->cur_frame_end[i]){
-            s->dts= s->cur_frame_dts[i];
-            s->pts= s->cur_frame_pts[i];
-            s->pos= s->cur_frame_pos[i];
-            s->offset = s->next_frame_offset - s->cur_frame_offset[i];
-            if(remove)
-                s->cur_frame_offset[i]= INT64_MAX;
-            if(s->cur_offset + off < s->cur_frame_end[i])
-                break;
-        }
-    }
-}
-
-/**
- *
- * @param buf           input
- * @param buf_size      input length, to signal EOF, this should be 0 (so that the last frame can be output)
- * @param pts           input presentation timestamp
- * @param dts           input decoding timestamp
- * @param poutbuf       will contain a pointer to the first byte of the output frame
- * @param poutbuf_size  will contain the length of the output frame
- * @return the number of bytes of the input bitstream used
- *
- * Example:
- * @code
- *   while(in_len){
- *       len = av_parser_parse(myparser, AVCodecContext, &data, &size,
- *                                       in_data, in_len,
- *                                       pts, dts);
- *       in_data += len;
- *       in_len  -= len;
- *
- *       if(size)
- *          decode_frame(data, size);
- *   }
- * @endcode
- *
- * @deprecated Use av_parser_parse2() instead.
- */
-int av_parser_parse(AVCodecParserContext *s,
-                    AVCodecContext *avctx,
-                    uint8_t **poutbuf, int *poutbuf_size,
-                    const uint8_t *buf, int buf_size,
-                    int64_t pts, int64_t dts)
-{
-    return av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE);
-}
-
-int av_parser_parse2(AVCodecParserContext *s,
-                     AVCodecContext *avctx,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size,
-                     int64_t pts, int64_t dts,
-                     int64_t pos)
-{
-    int index, i;
-    uint8_t dummy_buf[FF_INPUT_BUFFER_PADDING_SIZE];
-
-    if (buf_size == 0) {
-        /* padding is always necessary even if EOF, so we add it here */
-        memset(dummy_buf, 0, sizeof(dummy_buf));
-        buf = dummy_buf;
-    } else if (s->cur_offset + buf_size !=
-               s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */
-        /* add a new packet descriptor */
-            i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1);
-            s->cur_frame_start_index = i;
-            s->cur_frame_offset[i] = s->cur_offset;
-            s->cur_frame_end[i] = s->cur_offset + buf_size;
-            s->cur_frame_pts[i] = pts;
-            s->cur_frame_dts[i] = dts;
-            s->cur_frame_pos[i] = pos;
-    }
-
-    if (s->fetch_timestamp){
-        s->fetch_timestamp=0;
-        s->last_pts = s->pts;
-        s->last_dts = s->dts;
-        s->last_pos = s->pos;
-        ff_fetch_timestamp(s, 0, 0);
-    }
-
-    /* WARNING: the returned index can be negative */
-    index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size);
-//av_log(NULL, AV_LOG_DEBUG, "parser: in:%"PRId64", %"PRId64", out:%"PRId64", %"PRId64", in:%d out:%d id:%d\n", pts, dts, s->last_pts, s->last_dts, buf_size, *poutbuf_size, avctx->codec_id);
-    /* update the file pointer */
-    if (*poutbuf_size) {
-        /* fill the data for the current frame */
-        s->frame_offset = s->next_frame_offset;
-
-        /* offset of the next frame */
-        s->next_frame_offset = s->cur_offset + index;
-        s->fetch_timestamp=1;
-    }
-    if (index < 0)
-        index = 0;
-    s->cur_offset += index;
-    return index;
-}
-
-/**
- *
- * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
- * @deprecated use AVBitstreamFilter
- */
-int av_parser_change(AVCodecParserContext *s,
-                     AVCodecContext *avctx,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-
-    if(s && s->parser->split){
-        if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){
-            int i= s->parser->split(avctx, buf, buf_size);
-            buf += i;
-            buf_size -= i;
-        }
-    }
-
-    /* cast to avoid warning about discarding qualifiers */
-    *poutbuf= (uint8_t *) buf;
-    *poutbuf_size= buf_size;
-    if(avctx->extradata){
-        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
-            /*||(s->pict_type != FF_I_TYPE && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
-            /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
-            int size= buf_size + avctx->extradata_size;
-            *poutbuf_size= size;
-            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
-            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-            return 1;
-        }
-    }
-
-    return 0;
-}
-
-void av_parser_close(AVCodecParserContext *s)
-{
-    if(s){
-        if (s->parser->parser_close)
-            s->parser->parser_close(s);
-        av_free(s->priv_data);
-        av_free(s);
-    }
-}
-
-/*****************************************************/
-
-/**
- * combines the (truncated) bitstream to a complete frame
- * @return -1 if no complete frame could be created, AVERROR(ENOMEM) if there was a memory allocation error
- */
-int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
-{
-#if 0
-    if(pc->overread){
-        printf("overread %d, state:%X next:%d index:%d o_index:%d\n", pc->overread, pc->state, next, pc->index, pc->overread_index);
-        printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
-    }
-#endif
-
-    /* Copy overread bytes from last frame into buffer. */
-    for(; pc->overread>0; pc->overread--){
-        pc->buffer[pc->index++]= pc->buffer[pc->overread_index++];
-    }
-
-    /* flush remaining if EOF */
-    if(!*buf_size && next == END_NOT_FOUND){
-        next= 0;
-    }
-
-    pc->last_index= pc->index;
-
-    /* copy into buffer end return */
-    if(next == END_NOT_FOUND){
-        void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
-
-        if(!new_buffer)
-            return AVERROR(ENOMEM);
-        pc->buffer = new_buffer;
-        memcpy(&pc->buffer[pc->index], *buf, *buf_size);
-        pc->index += *buf_size;
-        return -1;
-    }
-
-    *buf_size=
-    pc->overread_index= pc->index + next;
-
-    /* append to buffer */
-    if(pc->index){
-        void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
-
-        if(!new_buffer)
-            return AVERROR(ENOMEM);
-        pc->buffer = new_buffer;
-        memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE );
-        pc->index = 0;
-        *buf= pc->buffer;
-    }
-
-    /* store overread bytes */
-    for(;next < 0; next++){
-        pc->state = (pc->state<<8) | pc->buffer[pc->last_index + next];
-        pc->state64 = (pc->state64<<8) | pc->buffer[pc->last_index + next];
-        pc->overread++;
-    }
-
-#if 0
-    if(pc->overread){
-        printf("overread %d, state:%X next:%d index:%d o_index:%d\n", pc->overread, pc->state, next, pc->index, pc->overread_index);
-        printf("%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]);
-    }
-#endif
-
-    return 0;
-}
-
-void ff_parse_close(AVCodecParserContext *s)
-{
-    ParseContext *pc = s->priv_data;
-
-    av_freep(&pc->buffer);
-}
-
-void ff_parse1_close(AVCodecParserContext *s)
-{
-    ParseContext1 *pc1 = s->priv_data;
-
-    av_free(pc1->pc.buffer);
-    av_free(pc1->enc);
-}
-
-/*************************/
-
-int ff_mpeg4video_split(AVCodecContext *avctx,
-                           const uint8_t *buf, int buf_size)
-{
-    int i;
-    uint32_t state= -1;
-
-    for(i=0; i<buf_size; i++){
-        state= (state<<8) | buf[i];
-        if(state == 0x1B3 || state == 0x1B6)
-            return i-3;
-    }
-    return 0;
-}
diff --git a/libavcodec/parser.h b/libavcodec/parser.h
deleted file mode 100644
index 6274bb2..0000000
--- a/libavcodec/parser.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * AVCodecParser prototypes and definitions
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PARSER_H
-#define AVCODEC_PARSER_H
-
-#include "avcodec.h"
-
-typedef struct ParseContext{
-    uint8_t *buffer;
-    int index;
-    int last_index;
-    unsigned int buffer_size;
-    uint32_t state;             ///< contains the last few bytes in MSB order
-    int frame_start_found;
-    int overread;               ///< the number of bytes which where irreversibly read from the next frame
-    int overread_index;         ///< the index into ParseContext.buffer of the overread bytes
-    uint64_t state64;           ///< contains the last 8 bytes in MSB order
-} ParseContext;
-
-struct MpegEncContext;
-
-typedef struct ParseContext1{
-    ParseContext pc;
-/* XXX/FIXME PC1 vs. PC */
-    /* MPEG-2-specific */
-    AVRational frame_rate;
-    int progressive_sequence;
-    int width, height;
-
-    /* XXX: suppress that, needed by MPEG-4 */
-    struct MpegEncContext *enc;
-    int first_picture;
-} ParseContext1;
-
-#define END_NOT_FOUND (-100)
-
-int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size);
-int ff_mpeg4video_split(AVCodecContext *avctx, const uint8_t *buf,
-                        int buf_size);
-void ff_parse_close(AVCodecParserContext *s);
-void ff_parse1_close(AVCodecParserContext *s);
-
-/**
- * Fetches timestamps for a specific byte within the current access unit.
- * @param off byte position within the access unit
- * @param remove Found timestamps will be removed if set to 1, kept if set to 0.
- */
-void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove);
-
-#endif /* AVCODEC_PARSER_H */
diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c
deleted file mode 100644
index c2343a6..0000000
--- a/libavcodec/pcm-mpeg.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * LPCM codecs for PCM formats found in MPEG streams
- * Copyright (c) 2009 Christian Schmidt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * PCM codecs for encodings found in MPEG streams (DVD/Blu-ray)
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-/*
- * Channel Mapping according to
- * Blu-ray Disc Read-Only Format Version 1
- * Part 3: Audio Visual Basic Specifications
- * mono     M1    X
- * stereo   L     R
- * 3/0      L     R    C    X
- * 2/1      L     R    S    X
- * 3/1      L     R    C    S
- * 2/2      L     R    LS   RS
- * 3/2      L     R    C    LS    RS    X
- * 3/2+lfe  L     R    C    LS    RS    lfe
- * 3/4      L     R    C    LS    Rls   Rrs  RS   X
- * 3/4+lfe  L     R    C    LS    Rls   Rrs  RS   lfe
- */
-
-/**
- * Parse the header of a LPCM frame read from a MPEG-TS stream
- * @param avctx the codec context
- * @param header pointer to the first four bytes of the data packet
- */
-static int pcm_bluray_parse_header(AVCodecContext *avctx,
-                                   const uint8_t *header)
-{
-    static const uint8_t bits_per_samples[4] = { 0, 16, 20, 24 };
-    static const uint32_t channel_layouts[16] = {
-        0, CH_LAYOUT_MONO, 0, CH_LAYOUT_STEREO, CH_LAYOUT_SURROUND,
-        CH_LAYOUT_2_1, CH_LAYOUT_4POINT0, CH_LAYOUT_2_2, CH_LAYOUT_5POINT0,
-        CH_LAYOUT_5POINT1, CH_LAYOUT_7POINT0, CH_LAYOUT_7POINT1, 0, 0, 0, 0
-    };
-    static const uint8_t channels[16] = {
-        0, 1, 0, 2, 3, 3, 4, 4, 5, 6, 7, 8, 0, 0, 0, 0
-    };
-    uint8_t channel_layout = header[2] >> 4;
-
-    if (avctx->debug & FF_DEBUG_PICT_INFO)
-        dprintf(avctx, "pcm_bluray_parse_header: header = %02x%02x%02x%02x\n",
-                header[0], header[1], header[2], header[3]);
-
-    /* get the sample depth and derive the sample format from it */
-    avctx->bits_per_coded_sample = bits_per_samples[header[3] >> 6];
-    if (!avctx->bits_per_coded_sample) {
-        av_log(avctx, AV_LOG_ERROR, "unsupported sample depth (0)\n");
-        return -1;
-    }
-    avctx->sample_fmt = avctx->bits_per_coded_sample == 16 ? SAMPLE_FMT_S16 :
-                                                             SAMPLE_FMT_S32;
-
-    /* get the sample rate. Not all values are known or exist. */
-    switch (header[2] & 0x0f) {
-    case 1:
-        avctx->sample_rate = 48000;
-        break;
-    case 4:
-        avctx->sample_rate = 96000;
-        break;
-    case 5:
-        avctx->sample_rate = 192000;
-        break;
-    default:
-        avctx->sample_rate = 0;
-        av_log(avctx, AV_LOG_ERROR, "unsupported sample rate (%d)\n",
-               header[2] & 0x0f);
-        return -1;
-    }
-
-    /*
-     * get the channel number (and mapping). Not all values are known or exist.
-     * It must be noted that the number of channels in the MPEG stream can
-     * differ from the actual meaningful number, e.g. mono audio still has two
-     * channels, one being empty.
-     */
-    avctx->channel_layout  = channel_layouts[channel_layout];
-    avctx->channels        =        channels[channel_layout];
-    if (!avctx->channels) {
-        av_log(avctx, AV_LOG_ERROR, "unsupported channel configuration (%d)\n",
-               channel_layout);
-        return -1;
-    }
-
-    avctx->bit_rate = avctx->channels * avctx->sample_rate *
-                      avctx->bits_per_coded_sample;
-
-    if (avctx->debug & FF_DEBUG_PICT_INFO)
-        dprintf(avctx,
-                "pcm_bluray_parse_header: %d channels, %d bits per sample, %d kHz, %d kbit\n",
-                avctx->channels, avctx->bits_per_coded_sample,
-                avctx->sample_rate, avctx->bit_rate);
-    return 0;
-}
-
-static int pcm_bluray_decode_frame(AVCodecContext *avctx,
-                                   void *data,
-                                   int *data_size,
-                                   AVPacket *avpkt)
-{
-    const uint8_t *src = avpkt->data;
-    int buf_size = avpkt->size;
-    int num_source_channels, channel, retval;
-    int sample_size, samples, output_size;
-    int16_t *dst16 = data;
-    int32_t *dst32 = data;
-
-    if (buf_size < 4) {
-        av_log(avctx, AV_LOG_ERROR, "PCM packet too small\n");
-        return -1;
-    }
-
-    if (pcm_bluray_parse_header(avctx, src))
-        return -1;
-    src += 4;
-    buf_size -= 4;
-
-    /* There's always an even number of channels in the source */
-    num_source_channels = FFALIGN(avctx->channels, 2);
-    sample_size = (num_source_channels * avctx->bits_per_coded_sample) >> 3;
-    samples = buf_size / sample_size;
-
-    output_size = samples * avctx->channels *
-                  (avctx->sample_fmt == SAMPLE_FMT_S32 ? 4 : 2);
-    if (output_size > *data_size) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Insufficient output buffer space (%d bytes, needed %d bytes)\n",
-               *data_size, output_size);
-        return -1;
-    }
-    *data_size = output_size;
-
-    if (samples) {
-        switch (avctx->channel_layout) {
-            /* cases with same number of source and coded channels */
-        case CH_LAYOUT_STEREO:
-        case CH_LAYOUT_4POINT0:
-        case CH_LAYOUT_2_2:
-            samples *= num_source_channels;
-            if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
-#if HAVE_BIGENDIAN
-                memcpy(dst16, src, output_size);
-#else
-                do {
-                    *dst16++ = bytestream_get_be16(&src);
-                } while (--samples);
-#endif
-            } else {
-                do {
-                    *dst32++ = bytestream_get_be24(&src) << 8;
-                } while (--samples);
-            }
-            break;
-        /* cases where number of source channels = coded channels + 1 */
-        case CH_LAYOUT_MONO:
-        case CH_LAYOUT_SURROUND:
-        case CH_LAYOUT_2_1:
-        case CH_LAYOUT_5POINT0:
-            if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
-                do {
-#if HAVE_BIGENDIAN
-                    memcpy(dst16, src, avctx->channels * 2);
-                    dst16 += avctx->channels;
-                    src += sample_size;
-#else
-                    channel = avctx->channels;
-                    do {
-                        *dst16++ = bytestream_get_be16(&src);
-                    } while (--channel);
-                    src += 2;
-#endif
-                } while (--samples);
-            } else {
-                do {
-                    channel = avctx->channels;
-                    do {
-                        *dst32++ = bytestream_get_be24(&src) << 8;
-                    } while (--channel);
-                    src += 3;
-                } while (--samples);
-            }
-            break;
-            /* remapping: L, R, C, LBack, RBack, LF */
-        case CH_LAYOUT_5POINT1:
-            if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
-                do {
-                    dst16[0] = bytestream_get_be16(&src);
-                    dst16[1] = bytestream_get_be16(&src);
-                    dst16[2] = bytestream_get_be16(&src);
-                    dst16[4] = bytestream_get_be16(&src);
-                    dst16[5] = bytestream_get_be16(&src);
-                    dst16[3] = bytestream_get_be16(&src);
-                    dst16 += 6;
-                } while (--samples);
-            } else {
-                do {
-                    dst32[0] = bytestream_get_be24(&src) << 8;
-                    dst32[1] = bytestream_get_be24(&src) << 8;
-                    dst32[2] = bytestream_get_be24(&src) << 8;
-                    dst32[4] = bytestream_get_be24(&src) << 8;
-                    dst32[5] = bytestream_get_be24(&src) << 8;
-                    dst32[3] = bytestream_get_be24(&src) << 8;
-                    dst32 += 6;
-                } while (--samples);
-            }
-            break;
-            /* remapping: L, R, C, LSide, LBack, RBack, RSide, <unused> */
-        case CH_LAYOUT_7POINT0:
-            if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
-                do {
-                    dst16[0] = bytestream_get_be16(&src);
-                    dst16[1] = bytestream_get_be16(&src);
-                    dst16[2] = bytestream_get_be16(&src);
-                    dst16[5] = bytestream_get_be16(&src);
-                    dst16[3] = bytestream_get_be16(&src);
-                    dst16[4] = bytestream_get_be16(&src);
-                    dst16[6] = bytestream_get_be16(&src);
-                    dst16 += 7;
-                    src += 2;
-                } while (--samples);
-            } else {
-                do {
-                    dst32[0] = bytestream_get_be24(&src) << 8;
-                    dst32[1] = bytestream_get_be24(&src) << 8;
-                    dst32[2] = bytestream_get_be24(&src) << 8;
-                    dst32[5] = bytestream_get_be24(&src) << 8;
-                    dst32[3] = bytestream_get_be24(&src) << 8;
-                    dst32[4] = bytestream_get_be24(&src) << 8;
-                    dst32[6] = bytestream_get_be24(&src) << 8;
-                    dst32 += 7;
-                    src += 3;
-                } while (--samples);
-            }
-            break;
-            /* remapping: L, R, C, LSide, LBack, RBack, RSide, LF */
-        case CH_LAYOUT_7POINT1:
-            if (SAMPLE_FMT_S16 == avctx->sample_fmt) {
-                do {
-                    dst16[0] = bytestream_get_be16(&src);
-                    dst16[1] = bytestream_get_be16(&src);
-                    dst16[2] = bytestream_get_be16(&src);
-                    dst16[6] = bytestream_get_be16(&src);
-                    dst16[4] = bytestream_get_be16(&src);
-                    dst16[5] = bytestream_get_be16(&src);
-                    dst16[7] = bytestream_get_be16(&src);
-                    dst16[3] = bytestream_get_be16(&src);
-                    dst16 += 8;
-                } while (--samples);
-            } else {
-                do {
-                    dst32[0] = bytestream_get_be24(&src) << 8;
-                    dst32[1] = bytestream_get_be24(&src) << 8;
-                    dst32[2] = bytestream_get_be24(&src) << 8;
-                    dst32[6] = bytestream_get_be24(&src) << 8;
-                    dst32[4] = bytestream_get_be24(&src) << 8;
-                    dst32[5] = bytestream_get_be24(&src) << 8;
-                    dst32[7] = bytestream_get_be24(&src) << 8;
-                    dst32[3] = bytestream_get_be24(&src) << 8;
-                    dst32 += 8;
-                } while (--samples);
-            }
-            break;
-        }
-    }
-
-    retval = src - avpkt->data;
-    if (avctx->debug & FF_DEBUG_BITSTREAM)
-        dprintf(avctx, "pcm_bluray_decode_frame: decoded %d -> %d bytes\n",
-                retval, *data_size);
-    return retval;
-}
-
-AVCodec pcm_bluray_decoder = {
-    "pcm_bluray",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_PCM_BLURAY,
-    0,
-    NULL,
-    NULL,
-    NULL,
-    pcm_bluray_decode_frame,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16, SAMPLE_FMT_S32,
-                                         SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"),
-};
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
deleted file mode 100644
index 746a520..0000000
--- a/libavcodec/pcm.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/*
- * PCM codecs
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * PCM codecs
- */
-
-#include "avcodec.h"
-#include "libavutil/common.h" /* for av_reverse */
-#include "bytestream.h"
-#include "pcm_tablegen.h"
-
-#define MAX_CHANNELS 64
-
-static av_cold int pcm_encode_init(AVCodecContext *avctx)
-{
-    avctx->frame_size = 1;
-    switch(avctx->codec->id) {
-    case CODEC_ID_PCM_ALAW:
-        pcm_alaw_tableinit();
-        break;
-    case CODEC_ID_PCM_MULAW:
-        pcm_ulaw_tableinit();
-        break;
-    default:
-        break;
-    }
-
-    avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
-    avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    return 0;
-}
-
-static av_cold int pcm_encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-/**
- * Write PCM samples macro
- * @param type Datatype of native machine format
- * @param endian bytestream_put_xxx() suffix
- * @param src Source pointer (variable name)
- * @param dst Destination pointer (variable name)
- * @param n Total number of samples (variable name)
- * @param shift Bitshift (bits)
- * @param offset Sample value offset
- */
-#define ENCODE(type, endian, src, dst, n, shift, offset) \
-    samples_##type = (type*)src; \
-    for(;n>0;n--) { \
-        register type v = (*samples_##type++ >> shift) + offset; \
-        bytestream_put_##endian(&dst, v); \
-    }
-
-static int pcm_encode_frame(AVCodecContext *avctx,
-                            unsigned char *frame, int buf_size, void *data)
-{
-    int n, sample_size, v;
-    short *samples;
-    unsigned char *dst;
-    uint8_t *srcu8;
-    int16_t *samples_int16_t;
-    int32_t *samples_int32_t;
-    int64_t *samples_int64_t;
-    uint16_t *samples_uint16_t;
-    uint32_t *samples_uint32_t;
-
-    sample_size = av_get_bits_per_sample(avctx->codec->id)/8;
-    n = buf_size / sample_size;
-    samples = data;
-    dst = frame;
-
-    if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) {
-        av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n");
-        return -1;
-    }
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_PCM_U32LE:
-        ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000)
-        break;
-    case CODEC_ID_PCM_U32BE:
-        ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000)
-        break;
-    case CODEC_ID_PCM_S24LE:
-        ENCODE(int32_t, le24, samples, dst, n, 8, 0)
-        break;
-    case CODEC_ID_PCM_S24BE:
-        ENCODE(int32_t, be24, samples, dst, n, 8, 0)
-        break;
-    case CODEC_ID_PCM_U24LE:
-        ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000)
-        break;
-    case CODEC_ID_PCM_U24BE:
-        ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000)
-        break;
-    case CODEC_ID_PCM_S24DAUD:
-        for(;n>0;n--) {
-            uint32_t tmp = av_reverse[(*samples >> 8) & 0xff] +
-                           (av_reverse[*samples & 0xff] << 8);
-            tmp <<= 4; // sync flags would go here
-            bytestream_put_be24(&dst, tmp);
-            samples++;
-        }
-        break;
-    case CODEC_ID_PCM_U16LE:
-        ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000)
-        break;
-    case CODEC_ID_PCM_U16BE:
-        ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000)
-        break;
-    case CODEC_ID_PCM_S8:
-        srcu8= data;
-        for(;n>0;n--) {
-            v = *srcu8++;
-            *dst++ = v - 128;
-        }
-        break;
-#if HAVE_BIGENDIAN
-    case CODEC_ID_PCM_F64LE:
-        ENCODE(int64_t, le64, samples, dst, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_S32LE:
-    case CODEC_ID_PCM_F32LE:
-        ENCODE(int32_t, le32, samples, dst, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_S16LE:
-        ENCODE(int16_t, le16, samples, dst, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_F64BE:
-    case CODEC_ID_PCM_F32BE:
-    case CODEC_ID_PCM_S32BE:
-    case CODEC_ID_PCM_S16BE:
-#else
-    case CODEC_ID_PCM_F64BE:
-        ENCODE(int64_t, be64, samples, dst, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_F32BE:
-    case CODEC_ID_PCM_S32BE:
-        ENCODE(int32_t, be32, samples, dst, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_S16BE:
-        ENCODE(int16_t, be16, samples, dst, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_F64LE:
-    case CODEC_ID_PCM_F32LE:
-    case CODEC_ID_PCM_S32LE:
-    case CODEC_ID_PCM_S16LE:
-#endif /* HAVE_BIGENDIAN */
-    case CODEC_ID_PCM_U8:
-        memcpy(dst, samples, n*sample_size);
-        dst += n*sample_size;
-        break;
-    case CODEC_ID_PCM_ZORK:
-        for(;n>0;n--) {
-            v= *samples++ >> 8;
-            if(v<0)   v = -v;
-            else      v+= 128;
-            *dst++ = v;
-        }
-        break;
-    case CODEC_ID_PCM_ALAW:
-        for(;n>0;n--) {
-            v = *samples++;
-            *dst++ = linear_to_alaw[(v + 32768) >> 2];
-        }
-        break;
-    case CODEC_ID_PCM_MULAW:
-        for(;n>0;n--) {
-            v = *samples++;
-            *dst++ = linear_to_ulaw[(v + 32768) >> 2];
-        }
-        break;
-    default:
-        return -1;
-    }
-    //avctx->frame_size = (dst - frame) / (sample_size * avctx->channels);
-
-    return dst - frame;
-}
-
-typedef struct PCMDecode {
-    short table[256];
-} PCMDecode;
-
-static av_cold int pcm_decode_init(AVCodecContext * avctx)
-{
-    PCMDecode *s = avctx->priv_data;
-    int i;
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_PCM_ALAW:
-        for(i=0;i<256;i++)
-            s->table[i] = alaw2linear(i);
-        break;
-    case CODEC_ID_PCM_MULAW:
-        for(i=0;i<256;i++)
-            s->table[i] = ulaw2linear(i);
-        break;
-    default:
-        break;
-    }
-
-    avctx->sample_fmt = avctx->codec->sample_fmts[0];
-    return 0;
-}
-
-/**
- * Read PCM samples macro
- * @param type Datatype of native machine format
- * @param endian bytestream_get_xxx() endian suffix
- * @param src Source pointer (variable name)
- * @param dst Destination pointer (variable name)
- * @param n Total number of samples (variable name)
- * @param shift Bitshift (bits)
- * @param offset Sample value offset
- */
-#define DECODE(type, endian, src, dst, n, shift, offset) \
-    dst_##type = (type*)dst; \
-    for(;n>0;n--) { \
-        register type v = bytestream_get_##endian(&src); \
-        *dst_##type++ = (v - offset) << shift; \
-    } \
-    dst = (short*)dst_##type;
-
-static int pcm_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    PCMDecode *s = avctx->priv_data;
-    int sample_size, c, n;
-    short *samples;
-    const uint8_t *src, *src8, *src2[MAX_CHANNELS];
-    uint8_t *dstu8;
-    int16_t *dst_int16_t;
-    int32_t *dst_int32_t;
-    int64_t *dst_int64_t;
-    uint16_t *dst_uint16_t;
-    uint32_t *dst_uint32_t;
-
-    samples = data;
-    src = buf;
-
-    if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) {
-        av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n");
-        return -1;
-    }
-
-    if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
-        av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
-        return -1;
-    }
-
-    sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
-
-    /* av_get_bits_per_sample returns 0 for CODEC_ID_PCM_DVD */
-    if (CODEC_ID_PCM_DVD == avctx->codec_id)
-        /* 2 samples are interleaved per block in PCM_DVD */
-        sample_size = avctx->bits_per_coded_sample * 2 / 8;
-
-    n = avctx->channels * sample_size;
-
-    if(n && buf_size % n){
-        if (buf_size < n) {
-            av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
-            return -1;
-        }else
-            buf_size -= buf_size % n;
-    }
-
-    buf_size= FFMIN(buf_size, *data_size/2);
-    *data_size=0;
-
-    n = buf_size/sample_size;
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_PCM_U32LE:
-        DECODE(uint32_t, le32, src, samples, n, 0, 0x80000000)
-        break;
-    case CODEC_ID_PCM_U32BE:
-        DECODE(uint32_t, be32, src, samples, n, 0, 0x80000000)
-        break;
-    case CODEC_ID_PCM_S24LE:
-        DECODE(int32_t, le24, src, samples, n, 8, 0)
-        break;
-    case CODEC_ID_PCM_S24BE:
-        DECODE(int32_t, be24, src, samples, n, 8, 0)
-        break;
-    case CODEC_ID_PCM_U24LE:
-        DECODE(uint32_t, le24, src, samples, n, 8, 0x800000)
-        break;
-    case CODEC_ID_PCM_U24BE:
-        DECODE(uint32_t, be24, src, samples, n, 8, 0x800000)
-        break;
-    case CODEC_ID_PCM_S24DAUD:
-        for(;n>0;n--) {
-          uint32_t v = bytestream_get_be24(&src);
-          v >>= 4; // sync flags are here
-          *samples++ = av_reverse[(v >> 8) & 0xff] +
-                       (av_reverse[v & 0xff] << 8);
-        }
-        break;
-    case CODEC_ID_PCM_S16LE_PLANAR:
-        n /= avctx->channels;
-        for(c=0;c<avctx->channels;c++)
-            src2[c] = &src[c*n*2];
-        for(;n>0;n--)
-            for(c=0;c<avctx->channels;c++)
-                *samples++ = bytestream_get_le16(&src2[c]);
-        src = src2[avctx->channels-1];
-        break;
-    case CODEC_ID_PCM_U16LE:
-        DECODE(uint16_t, le16, src, samples, n, 0, 0x8000)
-        break;
-    case CODEC_ID_PCM_U16BE:
-        DECODE(uint16_t, be16, src, samples, n, 0, 0x8000)
-        break;
-    case CODEC_ID_PCM_S8:
-        dstu8= (uint8_t*)samples;
-        for(;n>0;n--) {
-            *dstu8++ = *src++ + 128;
-        }
-        samples= (short*)dstu8;
-        break;
-#if HAVE_BIGENDIAN
-    case CODEC_ID_PCM_F64LE:
-        DECODE(int64_t, le64, src, samples, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_S32LE:
-    case CODEC_ID_PCM_F32LE:
-        DECODE(int32_t, le32, src, samples, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_S16LE:
-        DECODE(int16_t, le16, src, samples, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_F64BE:
-    case CODEC_ID_PCM_F32BE:
-    case CODEC_ID_PCM_S32BE:
-    case CODEC_ID_PCM_S16BE:
-#else
-    case CODEC_ID_PCM_F64BE:
-        DECODE(int64_t, be64, src, samples, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_F32BE:
-    case CODEC_ID_PCM_S32BE:
-        DECODE(int32_t, be32, src, samples, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_S16BE:
-        DECODE(int16_t, be16, src, samples, n, 0, 0)
-        break;
-    case CODEC_ID_PCM_F64LE:
-    case CODEC_ID_PCM_F32LE:
-    case CODEC_ID_PCM_S32LE:
-    case CODEC_ID_PCM_S16LE:
-#endif /* HAVE_BIGENDIAN */
-    case CODEC_ID_PCM_U8:
-        memcpy(samples, src, n*sample_size);
-        src += n*sample_size;
-        samples = (short*)((uint8_t*)data + n*sample_size);
-        break;
-    case CODEC_ID_PCM_ZORK:
-        for(;n>0;n--) {
-            int x= *src++;
-            if(x&128) x-= 128;
-            else      x = -x;
-            *samples++ = x << 8;
-        }
-        break;
-    case CODEC_ID_PCM_ALAW:
-    case CODEC_ID_PCM_MULAW:
-        for(;n>0;n--) {
-            *samples++ = s->table[*src++];
-        }
-        break;
-    case CODEC_ID_PCM_DVD:
-        dst_int32_t = data;
-        n /= avctx->channels;
-        switch (avctx->bits_per_coded_sample) {
-        case 20:
-            while (n--) {
-                c = avctx->channels;
-                src8 = src + 4*c;
-                while (c--) {
-                    *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8   &0xf0) << 8);
-                    *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++ &0x0f) << 12);
-                }
-                src = src8;
-            }
-            break;
-        case 24:
-            while (n--) {
-                c = avctx->channels;
-                src8 = src + 4*c;
-                while (c--) {
-                    *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
-                    *dst_int32_t++ = (bytestream_get_be16(&src) << 16) + ((*src8++) << 8);
-                }
-                src = src8;
-            }
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
-            return -1;
-            break;
-        }
-        samples = (short *) dst_int32_t;
-        break;
-    default:
-        return -1;
-    }
-    *data_size = (uint8_t *)samples - (uint8_t *)data;
-    return src - buf;
-}
-
-#if CONFIG_ENCODERS
-#define PCM_ENCODER(id,sample_fmt_,name,long_name_) \
-AVCodec name ## _encoder = {                    \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    0,                                          \
-    pcm_encode_init,                            \
-    pcm_encode_frame,                           \
-    pcm_encode_close,                           \
-    NULL,                                       \
-    .sample_fmts = (const enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
-#else
-#define PCM_ENCODER(id,sample_fmt_,name,long_name_)
-#endif
-
-#if CONFIG_DECODERS
-#define PCM_DECODER(id,sample_fmt_,name,long_name_)         \
-AVCodec name ## _decoder = {                    \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    sizeof(PCMDecode),                          \
-    pcm_decode_init,                            \
-    NULL,                                       \
-    NULL,                                       \
-    pcm_decode_frame,                           \
-    .sample_fmts = (const enum SampleFormat[]){sample_fmt_,SAMPLE_FMT_NONE}, \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
-};
-#else
-#define PCM_DECODER(id,sample_fmt_,name,long_name_)
-#endif
-
-#define PCM_CODEC(id, sample_fmt_, name, long_name_)         \
-    PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_)
-
-/* Note: Do not forget to add new entries to the Makefile as well. */
-PCM_CODEC  (CODEC_ID_PCM_ALAW,  SAMPLE_FMT_S16, pcm_alaw, "PCM A-law");
-PCM_CODEC  (CODEC_ID_PCM_DVD,   SAMPLE_FMT_S32, pcm_dvd, "PCM signed 20|24-bit big-endian");
-PCM_CODEC  (CODEC_ID_PCM_F32BE, SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian");
-PCM_CODEC  (CODEC_ID_PCM_F32LE, SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian");
-PCM_CODEC  (CODEC_ID_PCM_F64BE, SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian");
-PCM_CODEC  (CODEC_ID_PCM_F64LE, SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian");
-PCM_CODEC  (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law");
-PCM_CODEC  (CODEC_ID_PCM_S8,    SAMPLE_FMT_U8,  pcm_s8, "PCM signed 8-bit");
-PCM_CODEC  (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian");
-PCM_CODEC  (CODEC_ID_PCM_S16LE, SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian");
-PCM_DECODER(CODEC_ID_PCM_S16LE_PLANAR, SAMPLE_FMT_S16, pcm_s16le_planar, "PCM 16-bit little-endian planar");
-PCM_CODEC  (CODEC_ID_PCM_S24BE, SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian");
-PCM_CODEC  (CODEC_ID_PCM_S24DAUD, SAMPLE_FMT_S16,  pcm_s24daud, "PCM D-Cinema audio signed 24-bit");
-PCM_CODEC  (CODEC_ID_PCM_S24LE, SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian");
-PCM_CODEC  (CODEC_ID_PCM_S32BE, SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian");
-PCM_CODEC  (CODEC_ID_PCM_S32LE, SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian");
-PCM_CODEC  (CODEC_ID_PCM_U8,    SAMPLE_FMT_U8,  pcm_u8, "PCM unsigned 8-bit");
-PCM_CODEC  (CODEC_ID_PCM_U16BE, SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian");
-PCM_CODEC  (CODEC_ID_PCM_U16LE, SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian");
-PCM_CODEC  (CODEC_ID_PCM_U24BE, SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian");
-PCM_CODEC  (CODEC_ID_PCM_U24LE, SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian");
-PCM_CODEC  (CODEC_ID_PCM_U32BE, SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian");
-PCM_CODEC  (CODEC_ID_PCM_U32LE, SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian");
-PCM_CODEC  (CODEC_ID_PCM_ZORK,  SAMPLE_FMT_S16, pcm_zork, "PCM Zork");
diff --git a/libavcodec/pcm_tablegen.c b/libavcodec/pcm_tablegen.c
deleted file mode 100644
index 57ecb43..0000000
--- a/libavcodec/pcm_tablegen.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Generate a header file for hardcoded PCM tables
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#include "pcm_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    pcm_alaw_tableinit();
-    pcm_ulaw_tableinit();
-
-    write_fileheader();
-
-    printf("static const uint8_t linear_to_alaw[1 << 14] = {\n");
-    write_uint8_array(linear_to_alaw, 1 << 14);
-    printf("};\n");
-
-    printf("static const uint8_t linear_to_ulaw[1 << 14] = {\n");
-    write_uint8_array(linear_to_ulaw, 1 << 14);
-    printf("};\n");
-
-    return 0;
-}
-
diff --git a/libavcodec/pcm_tablegen.h b/libavcodec/pcm_tablegen.h
deleted file mode 100644
index 8921baa..0000000
--- a/libavcodec/pcm_tablegen.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Header file for hardcoded PCM tables
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef PCM_TABLEGEN_H
-#define PCM_TABLEGEN_H
-
-#include <stdint.h>
-#include "../libavutil/attributes.h"
-
-/* from g711.c by SUN microsystems (unrestricted use) */
-
-#define         SIGN_BIT        (0x80)      /* Sign bit for a A-law byte. */
-#define         QUANT_MASK      (0xf)       /* Quantization field mask. */
-#define         NSEGS           (8)         /* Number of A-law segments. */
-#define         SEG_SHIFT       (4)         /* Left shift for segment number. */
-#define         SEG_MASK        (0x70)      /* Segment field mask. */
-
-#define         BIAS            (0x84)      /* Bias for linear code. */
-
-/*
- * alaw2linear() - Convert an A-law value to 16-bit linear PCM
- *
- */
-static av_cold int alaw2linear(unsigned char a_val)
-{
-        int t;
-        int seg;
-
-        a_val ^= 0x55;
-
-        t = a_val & QUANT_MASK;
-        seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT;
-        if(seg) t= (t + t + 1 + 32) << (seg + 2);
-        else    t= (t + t + 1     ) << 3;
-
-        return (a_val & SIGN_BIT) ? t : -t;
-}
-
-static av_cold int ulaw2linear(unsigned char u_val)
-{
-        int t;
-
-        /* Complement to obtain normal u-law value. */
-        u_val = ~u_val;
-
-        /*
-         * Extract and bias the quantization bits. Then
-         * shift up by the segment number and subtract out the bias.
-         */
-        t = ((u_val & QUANT_MASK) << 3) + BIAS;
-        t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT;
-
-        return (u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS);
-}
-
-#if CONFIG_HARDCODED_TABLES
-#define pcm_alaw_tableinit()
-#define pcm_ulaw_tableinit()
-#include "libavcodec/pcm_tables.h"
-#else
-/* 16384 entries per table */
-static uint8_t linear_to_alaw[16384];
-static uint8_t linear_to_ulaw[16384];
-
-static av_cold void build_xlaw_table(uint8_t *linear_to_xlaw,
-                             int (*xlaw2linear)(unsigned char),
-                             int mask)
-{
-    int i, j, v, v1, v2;
-
-    j = 0;
-    for(i=0;i<128;i++) {
-        if (i != 127) {
-            v1 = xlaw2linear(i ^ mask);
-            v2 = xlaw2linear((i + 1) ^ mask);
-            v = (v1 + v2 + 4) >> 3;
-        } else {
-            v = 8192;
-        }
-        for(;j<v;j++) {
-            linear_to_xlaw[8192 + j] = (i ^ mask);
-            if (j > 0)
-                linear_to_xlaw[8192 - j] = (i ^ (mask ^ 0x80));
-        }
-    }
-    linear_to_xlaw[0] = linear_to_xlaw[1];
-}
-
-static void pcm_alaw_tableinit(void)
-{
-    build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5);
-}
-
-static void pcm_ulaw_tableinit(void)
-{
-    build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff);
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* PCM_TABLEGEN_H */
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
deleted file mode 100644
index 2174184..0000000
--- a/libavcodec/pcx.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * PC Paintbrush PCX (.pcx) image decoder
- * Copyright (c) 2007, 2008 Ivo van Poorten
- *
- * This decoder does not support CGA palettes. I am unable to find samples
- * and Netpbm cannot generate them.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "get_bits.h"
-
-typedef struct PCXContext {
-    AVFrame picture;
-} PCXContext;
-
-static av_cold int pcx_init(AVCodecContext *avctx) {
-    PCXContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame= &s->picture;
-
-    return 0;
-}
-
-/**
- * @return advanced src pointer
- */
-static const uint8_t *pcx_rle_decode(const uint8_t *src, uint8_t *dst,
-                            unsigned int bytes_per_scanline, int compressed) {
-    unsigned int i = 0;
-    unsigned char run, value;
-
-    if (compressed) {
-        while (i<bytes_per_scanline) {
-            run = 1;
-            value = *src++;
-            if (value >= 0xc0) {
-                run = value & 0x3f;
-                value = *src++;
-            }
-            while (i<bytes_per_scanline && run--)
-                dst[i++] = value;
-        }
-    } else {
-        memcpy(dst, src, bytes_per_scanline);
-        src += bytes_per_scanline;
-    }
-
-    return src;
-}
-
-static void pcx_palette(const uint8_t **src, uint32_t *dst, unsigned int pallen) {
-    unsigned int i;
-
-    for (i=0; i<pallen; i++)
-        *dst++ = bytestream_get_be24(src);
-    if (pallen < 256)
-        memset(dst, 0, (256 - pallen) * sizeof(*dst));
-}
-
-static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                            AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    PCXContext * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p = &s->picture;
-    int compressed, xmin, ymin, xmax, ymax;
-    unsigned int w, h, bits_per_pixel, bytes_per_line, nplanes, stride, y, x,
-                 bytes_per_scanline;
-    uint8_t *ptr;
-    uint8_t const *bufstart = buf;
-
-    if (buf[0] != 0x0a || buf[1] > 5) {
-        av_log(avctx, AV_LOG_ERROR, "this is not PCX encoded data\n");
-        return -1;
-    }
-
-    compressed = buf[2];
-    xmin = AV_RL16(buf+ 4);
-    ymin = AV_RL16(buf+ 6);
-    xmax = AV_RL16(buf+ 8);
-    ymax = AV_RL16(buf+10);
-
-    if (xmax < xmin || ymax < ymin) {
-        av_log(avctx, AV_LOG_ERROR, "invalid image dimensions\n");
-        return -1;
-    }
-
-    w = xmax - xmin + 1;
-    h = ymax - ymin + 1;
-
-    bits_per_pixel     = buf[3];
-    bytes_per_line     = AV_RL16(buf+66);
-    nplanes            = buf[65];
-    bytes_per_scanline = nplanes * bytes_per_line;
-
-    if (bytes_per_scanline < w * bits_per_pixel * nplanes / 8) {
-        av_log(avctx, AV_LOG_ERROR, "PCX data is corrupted\n");
-        return -1;
-    }
-
-    switch ((nplanes<<8) + bits_per_pixel) {
-        case 0x0308:
-            avctx->pix_fmt = PIX_FMT_RGB24;
-            break;
-        case 0x0108:
-        case 0x0104:
-        case 0x0102:
-        case 0x0101:
-        case 0x0401:
-        case 0x0301:
-        case 0x0201:
-            avctx->pix_fmt = PIX_FMT_PAL8;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "invalid PCX file\n");
-            return -1;
-    }
-
-    buf += 128;
-
-    if (p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    if (avcodec_check_dimensions(avctx, w, h))
-        return -1;
-    if (w != avctx->width || h != avctx->height)
-        avcodec_set_dimensions(avctx, w, h);
-    if (avctx->get_buffer(avctx, p) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    p->pict_type = FF_I_TYPE;
-
-    ptr    = p->data[0];
-    stride = p->linesize[0];
-
-    if (nplanes == 3 && bits_per_pixel == 8) {
-        uint8_t scanline[bytes_per_scanline];
-
-        for (y=0; y<h; y++) {
-            buf = pcx_rle_decode(buf, scanline, bytes_per_scanline, compressed);
-
-            for (x=0; x<w; x++) {
-                ptr[3*x  ] = scanline[x                    ];
-                ptr[3*x+1] = scanline[x+ bytes_per_line    ];
-                ptr[3*x+2] = scanline[x+(bytes_per_line<<1)];
-            }
-
-            ptr += stride;
-        }
-
-    } else if (nplanes == 1 && bits_per_pixel == 8) {
-        uint8_t scanline[bytes_per_scanline];
-        const uint8_t *palstart = bufstart + buf_size - 769;
-
-        for (y=0; y<h; y++, ptr+=stride) {
-            buf = pcx_rle_decode(buf, scanline, bytes_per_scanline, compressed);
-            memcpy(ptr, scanline, w);
-        }
-
-        if (buf != palstart) {
-            av_log(avctx, AV_LOG_WARNING, "image data possibly corrupted\n");
-            buf = palstart;
-        }
-        if (*buf++ != 12) {
-            av_log(avctx, AV_LOG_ERROR, "expected palette after image data\n");
-            return -1;
-        }
-
-    } else if (nplanes == 1) {   /* all packed formats, max. 16 colors */
-        uint8_t scanline[bytes_per_scanline];
-        GetBitContext s;
-
-        for (y=0; y<h; y++) {
-            init_get_bits(&s, scanline, bytes_per_scanline<<3);
-
-            buf = pcx_rle_decode(buf, scanline, bytes_per_scanline, compressed);
-
-            for (x=0; x<w; x++)
-                ptr[x] = get_bits(&s, bits_per_pixel);
-            ptr += stride;
-        }
-
-    } else {    /* planar, 4, 8 or 16 colors */
-        uint8_t scanline[bytes_per_scanline];
-        int i;
-
-        for (y=0; y<h; y++) {
-            buf = pcx_rle_decode(buf, scanline, bytes_per_scanline, compressed);
-
-            for (x=0; x<w; x++) {
-                int m = 0x80 >> (x&7), v = 0;
-                for (i=nplanes - 1; i>=0; i--) {
-                    v <<= 1;
-                    v  += !!(scanline[i*bytes_per_line + (x>>3)] & m);
-                }
-                ptr[x] = v;
-            }
-            ptr += stride;
-        }
-    }
-
-    if (nplanes == 1 && bits_per_pixel == 8) {
-        pcx_palette(&buf, (uint32_t *) p->data[1], 256);
-    } else if (bits_per_pixel < 8) {
-        const uint8_t *palette = bufstart+16;
-        pcx_palette(&palette, (uint32_t *) p->data[1], 16);
-    }
-
-    *picture = s->picture;
-    *data_size = sizeof(AVFrame);
-
-    return buf - bufstart;
-}
-
-static av_cold int pcx_end(AVCodecContext *avctx) {
-    PCXContext *s = avctx->priv_data;
-
-    if(s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-AVCodec pcx_decoder = {
-    "pcx",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PCX,
-    sizeof(PCXContext),
-    pcx_init,
-    NULL,
-    pcx_end,
-    pcx_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"),
-};
diff --git a/libavcodec/pcxenc.c b/libavcodec/pcxenc.c
deleted file mode 100644
index a3ce284..0000000
--- a/libavcodec/pcxenc.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * PC Paintbrush PCX (.pcx) image encoder
- * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * PCX image encoder
- * @file
- * @author Daniel Verkamp
- * @sa http://www.qzx.com/pc-gpe/pcx.txt
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-typedef struct PCXContext {
-    AVFrame picture;
-} PCXContext;
-
-static const uint32_t monoblack_pal[] = { 0x000000, 0xFFFFFF };
-
-static av_cold int pcx_encode_init(AVCodecContext *avctx)
-{
-    PCXContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame = &s->picture;
-
-    return 0;
-}
-
-/**
- * PCX run-length encoder
- * @param dst output buffer
- * @param dst_size size of output buffer
- * @param src input buffer
- * @param src_plane_size size of one plane of input buffer in bytes
- * @param nplanes number of planes in input buffer
- * @return number of bytes written to dst or -1 on error
- * @bug will not work for nplanes != 1 && bpp != 8
- */
-static int pcx_rle_encode(      uint8_t *dst, int dst_size,
-                          const uint8_t *src, int src_plane_size, int nplanes)
-{
-    int p;
-    const uint8_t *dst_start = dst;
-
-    // check worst-case upper bound on dst_size
-    if (dst_size < 2LL * src_plane_size * nplanes || src_plane_size <= 0)
-        return -1;
-
-    for (p = 0; p < nplanes; p++) {
-        int count = 1;
-        const uint8_t *src_plane = src + p;
-        const uint8_t *src_plane_end = src_plane + src_plane_size * nplanes;
-        uint8_t prev = *src_plane;
-        src_plane += nplanes;
-
-        for (; ; src_plane += nplanes) {
-            if (src_plane < src_plane_end && *src_plane == prev && count < 0x3F) {
-                // current byte is same as prev
-                ++count;
-            } else {
-                // output prev * count
-                if (count != 1 || prev >= 0xC0)
-                    *dst++ = 0xC0 | count;
-                *dst++ = prev;
-
-                if (src_plane == src_plane_end)
-                    break;
-
-                // start new run
-                count = 1;
-                prev = *src_plane;
-            }
-        }
-    }
-
-    return dst - dst_start;
-}
-
-static int pcx_encode_frame(AVCodecContext *avctx,
-                            unsigned char *buf, int buf_size, void *data)
-{
-    PCXContext *s = avctx->priv_data;
-    AVFrame *const pict = &s->picture;
-    const uint8_t *buf_start = buf;
-    const uint8_t *buf_end   = buf + buf_size;
-
-    int bpp, nplanes, i, y, line_bytes, written;
-    const uint32_t *pal = NULL;
-    const uint8_t *src;
-
-    *pict = *(AVFrame *)data;
-    pict->pict_type = FF_I_TYPE;
-    pict->key_frame = 1;
-
-    if (avctx->width > 65535 || avctx->height > 65535) {
-        av_log(avctx, AV_LOG_ERROR, "image dimensions do not fit in 16 bits\n");
-        return -1;
-    }
-
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_RGB24:
-        bpp = 8;
-        nplanes = 3;
-        break;
-    case PIX_FMT_RGB8:
-    case PIX_FMT_BGR8:
-    case PIX_FMT_RGB4_BYTE:
-    case PIX_FMT_BGR4_BYTE:
-    case PIX_FMT_GRAY8:
-    case PIX_FMT_PAL8:
-        bpp = 8;
-        nplanes = 1;
-        pal = (uint32_t *)pict->data[1];
-        break;
-    case PIX_FMT_MONOBLACK:
-        bpp = 1;
-        nplanes = 1;
-        pal = monoblack_pal;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "unsupported pixfmt\n");
-        return -1;
-    }
-
-    line_bytes = (avctx->width * bpp + 7) >> 3;
-    line_bytes = (line_bytes + 1) & ~1;
-
-    bytestream_put_byte(&buf, 10);                  // manufacturer
-    bytestream_put_byte(&buf, 5);                   // version
-    bytestream_put_byte(&buf, 1);                   // encoding
-    bytestream_put_byte(&buf, bpp);                 // bits per pixel per plane
-    bytestream_put_le16(&buf, 0);                   // x min
-    bytestream_put_le16(&buf, 0);                   // y min
-    bytestream_put_le16(&buf, avctx->width - 1);    // x max
-    bytestream_put_le16(&buf, avctx->height - 1);   // y max
-    bytestream_put_le16(&buf, 0);                   // horizontal DPI
-    bytestream_put_le16(&buf, 0);                   // vertical DPI
-    for (i = 0; i < 16; i++)
-        bytestream_put_be24(&buf, pal ? pal[i] : 0);// palette (<= 16 color only)
-    bytestream_put_byte(&buf, 0);                   // reserved
-    bytestream_put_byte(&buf, nplanes);             // number of planes
-    bytestream_put_le16(&buf, line_bytes);          // scanline plane size in bytes
-
-    while (buf - buf_start < 128)
-        *buf++= 0;
-
-    src = pict->data[0];
-
-    for (y = 0; y < avctx->height; y++) {
-        if ((written = pcx_rle_encode(buf, buf_end - buf,
-                                      src, line_bytes, nplanes)) < 0) {
-            av_log(avctx, AV_LOG_ERROR, "buffer too small\n");
-            return -1;
-        }
-        buf += written;
-        src += pict->linesize[0];
-    }
-
-    if (nplanes == 1 && bpp == 8) {
-        if (buf_end - buf < 257) {
-            av_log(avctx, AV_LOG_ERROR, "buffer too small\n");
-            return -1;
-        }
-        bytestream_put_byte(&buf, 12);
-        for (i = 0; i < 256; i++) {
-            bytestream_put_be24(&buf, pal[i]);
-        }
-    }
-
-    return buf - buf_start;
-}
-
-AVCodec pcx_encoder = {
-    "pcx",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PCX,
-    sizeof(PCXContext),
-    pcx_encode_init,
-    pcx_encode_frame,
-    NULL,
-    .pix_fmts = (const enum PixelFormat[]){
-        PIX_FMT_RGB24,
-        PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8,
-        PIX_FMT_MONOBLACK,
-        PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"),
-};
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
deleted file mode 100644
index 5512006..0000000
--- a/libavcodec/pgssubdec.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/*
- * PGS subtitle decoder
- * Copyright (c) 2009 Stephen Backway
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * PGS subtitle decoder
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "colorspace.h"
-#include "bytestream.h"
-
-//#define DEBUG_PACKET_CONTENTS
-
-#define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
-
-enum SegmentType {
-    PALETTE_SEGMENT      = 0x14,
-    PICTURE_SEGMENT      = 0x15,
-    PRESENTATION_SEGMENT = 0x16,
-    WINDOW_SEGMENT       = 0x17,
-    DISPLAY_SEGMENT      = 0x80,
-};
-
-typedef struct PGSSubPresentation {
-    int x;
-    int y;
-    int video_w;
-    int video_h;
-    int id_number;
-} PGSSubPresentation;
-
-typedef struct PGSSubPicture {
-    int          w;
-    int          h;
-    uint8_t      *rle;
-    unsigned int rle_buffer_size, rle_data_len;
-} PGSSubPicture;
-
-typedef struct PGSSubContext {
-    PGSSubPresentation presentation;
-    uint32_t           clut[256];
-    PGSSubPicture      picture;
-} PGSSubContext;
-
-static av_cold int init_decoder(AVCodecContext *avctx)
-{
-    avctx->pix_fmt     = PIX_FMT_RGB32;
-
-    return 0;
-}
-
-static av_cold int close_decoder(AVCodecContext *avctx)
-{
-    PGSSubContext *ctx = avctx->priv_data;
-
-    av_freep(&ctx->picture.rle);
-    ctx->picture.rle_buffer_size  = 0;
-
-    return 0;
-}
-
-/**
- * Decodes the RLE data.
- *
- * The subtitle is stored as an Run Length Encoded image.
- *
- * @param avctx contains the current codec context
- * @param sub pointer to the processed subtitle data
- * @param buf pointer to the RLE data to process
- * @param buf_size size of the RLE data to process
- */
-static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
-                      const uint8_t *buf, unsigned int buf_size)
-{
-    const uint8_t *rle_bitmap_end;
-    int pixel_count, line_count;
-
-    rle_bitmap_end = buf + buf_size;
-
-    sub->rects[0]->pict.data[0] = av_malloc(sub->rects[0]->w * sub->rects[0]->h);
-
-    if (!sub->rects[0]->pict.data[0])
-        return -1;
-
-    pixel_count = 0;
-    line_count  = 0;
-
-    while (buf < rle_bitmap_end && line_count < sub->rects[0]->h) {
-        uint8_t flags, color;
-        int run;
-
-        color = bytestream_get_byte(&buf);
-        run   = 1;
-
-        if (color == 0x00) {
-            flags = bytestream_get_byte(&buf);
-            run   = flags & 0x3f;
-            if (flags & 0x40)
-                run = (run << 8) + bytestream_get_byte(&buf);
-            color = flags & 0x80 ? bytestream_get_byte(&buf) : 0;
-        }
-
-        if (run > 0 && pixel_count + run <= sub->rects[0]->w * sub->rects[0]->h) {
-            memset(sub->rects[0]->pict.data[0] + pixel_count, color, run);
-            pixel_count += run;
-        } else if (!run) {
-            /*
-             * New Line. Check if correct pixels decoded, if not display warning
-             * and adjust bitmap pointer to correct new line position.
-             */
-            if (pixel_count % sub->rects[0]->w > 0)
-                av_log(avctx, AV_LOG_ERROR, "Decoded %d pixels, when line should be %d pixels\n",
-                       pixel_count % sub->rects[0]->w, sub->rects[0]->w);
-            line_count++;
-        }
-    }
-
-    dprintf(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h);
-
-    return 0;
-}
-
-/**
- * Parses the picture segment packet.
- *
- * The picture segment contains details on the sequence id,
- * width, height and Run Length Encoded (RLE) bitmap data.
- *
- * @param avctx contains the current codec context
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
- * @todo TODO: Enable support for RLE data over multiple packets
- */
-static int parse_picture_segment(AVCodecContext *avctx,
-                                  const uint8_t *buf, int buf_size)
-{
-    PGSSubContext *ctx = avctx->priv_data;
-
-    uint8_t sequence_desc;
-    unsigned int rle_bitmap_len, width, height;
-
-    /* skip 3 unknown bytes: Object ID (2 bytes), Version Number */
-    buf += 3;
-
-    /* Read the Sequence Description to determine if start of RLE data or appended to previous RLE */
-    sequence_desc = bytestream_get_byte(&buf);
-
-    if (!(sequence_desc & 0x80)) {
-        av_log(avctx, AV_LOG_ERROR, "Decoder does not support object data over multiple packets.\n");
-        return -1;
-    }
-
-    /* Decode rle bitmap length */
-    rle_bitmap_len = bytestream_get_be24(&buf);
-
-    /* Check to ensure we have enough data for rle_bitmap_length if just a single packet */
-    if (rle_bitmap_len > buf_size - 7) {
-        av_log(avctx, AV_LOG_ERROR, "Not enough RLE data for specified length of %d.\n", rle_bitmap_len);
-        return -1;
-    }
-
-    ctx->picture.rle_data_len = rle_bitmap_len;
-
-    /* Get bitmap dimensions from data */
-    width  = bytestream_get_be16(&buf);
-    height = bytestream_get_be16(&buf);
-
-    /* Make sure the bitmap is not too large */
-    if (ctx->presentation.video_w < width || ctx->presentation.video_h < height) {
-        av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger then video.\n");
-        return -1;
-    }
-
-    ctx->picture.w = width;
-    ctx->picture.h = height;
-
-    av_fast_malloc(&ctx->picture.rle, &ctx->picture.rle_buffer_size, rle_bitmap_len);
-
-    if (!ctx->picture.rle)
-        return -1;
-
-    memcpy(ctx->picture.rle, buf, rle_bitmap_len);
-
-    return 0;
-}
-
-/**
- * Parses the palette segment packet.
- *
- * The palette segment contains details of the palette,
- * a maximum of 256 colors can be defined.
- *
- * @param avctx contains the current codec context
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
- */
-static void parse_palette_segment(AVCodecContext *avctx,
-                                  const uint8_t *buf, int buf_size)
-{
-    PGSSubContext *ctx = avctx->priv_data;
-
-    const uint8_t *buf_end = buf + buf_size;
-    const uint8_t *cm      = ff_cropTbl + MAX_NEG_CROP;
-    int color_id;
-    int y, cb, cr, alpha;
-    int r, g, b, r_add, g_add, b_add;
-
-    /* Skip two null bytes */
-    buf += 2;
-
-    while (buf < buf_end) {
-        color_id  = bytestream_get_byte(&buf);
-        y         = bytestream_get_byte(&buf);
-        cb        = bytestream_get_byte(&buf);
-        cr        = bytestream_get_byte(&buf);
-        alpha     = bytestream_get_byte(&buf);
-
-        YUV_TO_RGB1(cb, cr);
-        YUV_TO_RGB2(r, g, b, y);
-
-        dprintf(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
-
-        /* Store color in palette */
-        ctx->clut[color_id] = RGBA(r,g,b,alpha);
-    }
-}
-
-/**
- * Parses the presentation segment packet.
- *
- * The presentation segment contains details on the video
- * width, video height, x & y subtitle position.
- *
- * @param avctx contains the current codec context
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
- * @todo TODO: Implement cropping
- * @todo TODO: Implement forcing of subtitles
- * @todo TODO: Blanking of subtitle
- */
-static void parse_presentation_segment(AVCodecContext *avctx,
-                                       const uint8_t *buf, int buf_size)
-{
-    PGSSubContext *ctx = avctx->priv_data;
-
-    int x, y;
-    uint8_t block;
-
-    ctx->presentation.video_w = bytestream_get_be16(&buf);
-    ctx->presentation.video_h = bytestream_get_be16(&buf);
-
-    dprintf(avctx, "Video Dimensions %dx%d\n",
-            ctx->presentation.video_w, ctx->presentation.video_h);
-
-    /* Skip 1 bytes of unknown, frame rate? */
-    buf++;
-
-    ctx->presentation.id_number = bytestream_get_be16(&buf);
-
-    /* Next byte is the state. */
-    block = bytestream_get_byte(&buf);;
-    if (block == 0x80) {
-        /*
-         * Skip 7 bytes of unknown:
-         *     palette_update_flag (0x80),
-         *     palette_id_to_use,
-         *     Object Number (if > 0 determines if more data to process),
-         *     object_id_ref (2 bytes),
-         *     window_id_ref,
-         *     composition_flag (0x80 - object cropped, 0x40 - object forced)
-         */
-        buf += 7;
-
-        x = bytestream_get_be16(&buf);
-        y = bytestream_get_be16(&buf);
-
-        /* TODO If cropping, cropping_x, cropping_y, cropping_width, cropping_height (all 2 bytes).*/
-
-        dprintf(avctx, "Subtitle Placement x=%d, y=%d\n", x, y);
-
-        if (x > ctx->presentation.video_w || y > ctx->presentation.video_h) {
-            av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n",
-                   x, y, ctx->presentation.video_w, ctx->presentation.video_h);
-            x = 0; y = 0;
-        }
-
-        /* Fill in dimensions */
-        ctx->presentation.x = x;
-        ctx->presentation.y = y;
-    } else if (block == 0x00) {
-        /* TODO: Blank context as subtitle should not be displayed.
-         *       If the subtitle is blanked now the subtitle is not
-         *       on screen long enough to read, due to a delay in
-         *       initial display timing.
-         */
-    }
-}
-
-/**
- * Parses the display segment packet.
- *
- * The display segment controls the updating of the display.
- *
- * @param avctx contains the current codec context
- * @param data pointer to the data pertaining the subtitle to display
- * @param buf pointer to the packet to process
- * @param buf_size size of packet to process
- * @todo TODO: Fix start time, relies on correct PTS, currently too late
- *
- * @todo TODO: Fix end time, normally cleared by a second display
- * @todo       segment, which is currently ignored as it clears
- * @todo       the subtitle too early.
- */
-static int display_end_segment(AVCodecContext *avctx, void *data,
-                               const uint8_t *buf, int buf_size)
-{
-    AVSubtitle    *sub = data;
-    PGSSubContext *ctx = avctx->priv_data;
-
-    /*
-     *      The end display time is a timeout value and is only reached
-     *      if the next subtitle is later then timeout or subtitle has
-     *      not been cleared by a subsequent empty display command.
-     */
-
-    memset(sub, 0, sizeof(*sub));
-    sub->start_display_time = 0;
-    sub->end_display_time   = 20000;
-    sub->format             = 0;
-
-    sub->rects     = av_mallocz(sizeof(*sub->rects));
-    sub->rects[0]  = av_mallocz(sizeof(*sub->rects[0]));
-    sub->num_rects = 1;
-
-    sub->rects[0]->x    = ctx->presentation.x;
-    sub->rects[0]->y    = ctx->presentation.y;
-    sub->rects[0]->w    = ctx->picture.w;
-    sub->rects[0]->h    = ctx->picture.h;
-    sub->rects[0]->type = SUBTITLE_BITMAP;
-
-    /* Process bitmap */
-    sub->rects[0]->pict.linesize[0] = ctx->picture.w;
-
-    if (ctx->picture.rle)
-        if(decode_rle(avctx, sub, ctx->picture.rle, ctx->picture.rle_data_len) < 0)
-            return 0;
-
-    /* Allocate memory for colors */
-    sub->rects[0]->nb_colors    = 256;
-    sub->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
-
-    memcpy(sub->rects[0]->pict.data[1], ctx->clut, sub->rects[0]->nb_colors * sizeof(uint32_t));
-
-    return 1;
-}
-
-static int decode(AVCodecContext *avctx, void *data, int *data_size,
-                  AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-
-    const uint8_t *buf_end;
-    uint8_t       segment_type;
-    int           segment_length;
-
-#ifdef DEBUG_PACKET_CONTENTS
-    int i;
-
-    av_log(avctx, AV_LOG_INFO, "PGS sub packet:\n");
-
-    for (i = 0; i < buf_size; i++) {
-        av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]);
-        if (i % 16 == 15)
-            av_log(avctx, AV_LOG_INFO, "\n");
-    }
-
-    if (i & 15)
-        av_log(avctx, AV_LOG_INFO, "\n");
-#endif
-
-    *data_size = 0;
-
-    /* Ensure that we have received at a least a segment code and segment length */
-    if (buf_size < 3)
-        return -1;
-
-    buf_end = buf + buf_size;
-
-    /* Step through buffer to identify segments */
-    while (buf < buf_end) {
-        segment_type   = bytestream_get_byte(&buf);
-        segment_length = bytestream_get_be16(&buf);
-
-        dprintf(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type);
-
-        if (segment_type != DISPLAY_SEGMENT && segment_length > buf_end - buf)
-            break;
-
-        switch (segment_type) {
-        case PALETTE_SEGMENT:
-            parse_palette_segment(avctx, buf, segment_length);
-            break;
-        case PICTURE_SEGMENT:
-            parse_picture_segment(avctx, buf, segment_length);
-            break;
-        case PRESENTATION_SEGMENT:
-            parse_presentation_segment(avctx, buf, segment_length);
-            break;
-        case WINDOW_SEGMENT:
-            /*
-             * Window Segment Structure (No new information provided):
-             *     2 bytes: Unkown,
-             *     2 bytes: X position of subtitle,
-             *     2 bytes: Y position of subtitle,
-             *     2 bytes: Width of subtitle,
-             *     2 bytes: Height of subtitle.
-             */
-            break;
-        case DISPLAY_SEGMENT:
-            *data_size = display_end_segment(avctx, data, buf, segment_length);
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unknown subtitle segment type 0x%x, length %d\n",
-                   segment_type, segment_length);
-            break;
-        }
-
-        buf += segment_length;
-    }
-
-    return buf_size;
-}
-
-AVCodec pgssub_decoder = {
-    "pgssub",
-    AVMEDIA_TYPE_SUBTITLE,
-    CODEC_ID_HDMV_PGS_SUBTITLE,
-    sizeof(PGSSubContext),
-    init_decoder,
-    NULL,
-    close_decoder,
-    decode,
-    .long_name = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"),
-};
diff --git a/libavcodec/png.c b/libavcodec/png.c
deleted file mode 100644
index 534dc68..0000000
--- a/libavcodec/png.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * PNG image format
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "bytestream.h"
-#include "png.h"
-
-const uint8_t ff_pngsig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
-const uint8_t ff_mngsig[8] = {138, 77, 78, 71, 13, 10, 26, 10};
-
-/* Mask to determine which y pixels are valid in a pass */
-const uint8_t ff_png_pass_ymask[NB_PASSES] = {
-    0x80, 0x80, 0x08, 0x88, 0x22, 0xaa, 0x55,
-};
-
-/* minimum x value */
-const uint8_t ff_png_pass_xmin[NB_PASSES] = {
-    0, 4, 0, 2, 0, 1, 0
-};
-
-/* x shift to get row width */
-const uint8_t ff_png_pass_xshift[NB_PASSES] = {
-    3, 3, 2, 2, 1, 1, 0
-};
-
-/* Mask to determine which pixels are valid in a pass */
-const uint8_t ff_png_pass_mask[NB_PASSES] = {
-    0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff
-};
-
-void *ff_png_zalloc(void *opaque, unsigned int items, unsigned int size)
-{
-    if(items >= UINT_MAX / size)
-        return NULL;
-    return av_malloc(items * size);
-}
-
-void ff_png_zfree(void *opaque, void *ptr)
-{
-    av_free(ptr);
-}
-
-int ff_png_get_nb_channels(int color_type)
-{
-    int channels;
-    channels = 1;
-    if ((color_type & (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)) ==
-        PNG_COLOR_MASK_COLOR)
-        channels = 3;
-    if (color_type & PNG_COLOR_MASK_ALPHA)
-        channels++;
-    return channels;
-}
-
-/* compute the row size of an interleaved pass */
-int ff_png_pass_row_size(int pass, int bits_per_pixel, int width)
-{
-    int shift, xmin, pass_width;
-
-    xmin = ff_png_pass_xmin[pass];
-    if (width <= xmin)
-        return 0;
-    shift = ff_png_pass_xshift[pass];
-    pass_width = (width - xmin + (1 << shift) - 1) >> shift;
-    return (pass_width * bits_per_pixel + 7) >> 3;
-}
diff --git a/libavcodec/png.h b/libavcodec/png.h
deleted file mode 100644
index 7c0ab9f..0000000
--- a/libavcodec/png.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * PNG image format
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PNG_H
-#define AVCODEC_PNG_H
-
-#include <stdint.h>
-
-#define PNG_COLOR_MASK_PALETTE    1
-#define PNG_COLOR_MASK_COLOR      2
-#define PNG_COLOR_MASK_ALPHA      4
-
-#define PNG_COLOR_TYPE_GRAY 0
-#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
-#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
-#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
-#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
-
-#define PNG_FILTER_TYPE_LOCO   64
-#define PNG_FILTER_VALUE_NONE  0
-#define PNG_FILTER_VALUE_SUB   1
-#define PNG_FILTER_VALUE_UP    2
-#define PNG_FILTER_VALUE_AVG   3
-#define PNG_FILTER_VALUE_PAETH 4
-#define PNG_FILTER_VALUE_MIXED 5
-
-#define PNG_IHDR      0x0001
-#define PNG_IDAT      0x0002
-#define PNG_ALLIMAGE  0x0004
-#define PNG_PLTE      0x0008
-
-#define NB_PASSES 7
-
-extern const uint8_t ff_pngsig[8];
-extern const uint8_t ff_mngsig[8];
-
-/* Mask to determine which y pixels are valid in a pass */
-extern const uint8_t ff_png_pass_ymask[NB_PASSES];
-
-/* minimum x value */
-extern const uint8_t ff_png_pass_xmin[NB_PASSES];
-
-/* x shift to get row width */
-extern const uint8_t ff_png_pass_xshift[NB_PASSES];
-
-/* Mask to determine which pixels are valid in a pass */
-extern const uint8_t ff_png_pass_mask[NB_PASSES];
-
-void *ff_png_zalloc(void *opaque, unsigned int items, unsigned int size);
-
-void ff_png_zfree(void *opaque, void *ptr);
-
-int ff_png_get_nb_channels(int color_type);
-
-/* compute the row size of an interleaved pass */
-int ff_png_pass_row_size(int pass, int bits_per_pixel, int width);
-
-void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp);
-
-#endif /* AVCODEC_PNG_H */
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
deleted file mode 100644
index 03859a9..0000000
--- a/libavcodec/pngdec.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/*
- * PNG image format
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "bytestream.h"
-#include "png.h"
-#include "dsputil.h"
-
-/* TODO:
- * - add 2, 4 and 16 bit depth support
- */
-
-#include <zlib.h>
-
-//#define DEBUG
-
-typedef struct PNGDecContext {
-    DSPContext dsp;
-
-    const uint8_t *bytestream;
-    const uint8_t *bytestream_start;
-    const uint8_t *bytestream_end;
-    AVFrame picture1, picture2;
-    AVFrame *current_picture, *last_picture;
-
-    int state;
-    int width, height;
-    int bit_depth;
-    int color_type;
-    int compression_type;
-    int interlace_type;
-    int filter_type;
-    int channels;
-    int bits_per_pixel;
-    int bpp;
-
-    uint8_t *image_buf;
-    int image_linesize;
-    uint32_t palette[256];
-    uint8_t *crow_buf;
-    uint8_t *last_row;
-    uint8_t *tmp_row;
-    int pass;
-    int crow_size; /* compressed row size (include filter type) */
-    int row_size; /* decompressed row size */
-    int pass_row_size; /* decompress row size of the current pass */
-    int y;
-    z_stream zstream;
-} PNGDecContext;
-
-/* Mask to determine which y pixels can be written in a pass */
-static const uint8_t png_pass_dsp_ymask[NB_PASSES] = {
-    0xff, 0xff, 0x0f, 0xcc, 0x33, 0xff, 0x55,
-};
-
-/* Mask to determine which pixels to overwrite while displaying */
-static const uint8_t png_pass_dsp_mask[NB_PASSES] = {
-    0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff
-};
-
-/* NOTE: we try to construct a good looking image at each pass. width
-   is the original image width. We also do pixel format conversion at
-   this stage */
-static void png_put_interlaced_row(uint8_t *dst, int width,
-                                   int bits_per_pixel, int pass,
-                                   int color_type, const uint8_t *src)
-{
-    int x, mask, dsp_mask, j, src_x, b, bpp;
-    uint8_t *d;
-    const uint8_t *s;
-
-    mask = ff_png_pass_mask[pass];
-    dsp_mask = png_pass_dsp_mask[pass];
-    switch(bits_per_pixel) {
-    case 1:
-        /* we must initialize the line to zero before writing to it */
-        if (pass == 0)
-            memset(dst, 0, (width + 7) >> 3);
-        src_x = 0;
-        for(x = 0; x < width; x++) {
-            j = (x & 7);
-            if ((dsp_mask << j) & 0x80) {
-                b = (src[src_x >> 3] >> (7 - (src_x & 7))) & 1;
-                dst[x >> 3] |= b << (7 - j);
-            }
-            if ((mask << j) & 0x80)
-                src_x++;
-        }
-        break;
-    default:
-        bpp = bits_per_pixel >> 3;
-        d = dst;
-        s = src;
-        if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-            for(x = 0; x < width; x++) {
-                j = x & 7;
-                if ((dsp_mask << j) & 0x80) {
-                    *(uint32_t *)d = (s[3] << 24) | (s[0] << 16) | (s[1] << 8) | s[2];
-                }
-                d += bpp;
-                if ((mask << j) & 0x80)
-                    s += bpp;
-            }
-        } else {
-            for(x = 0; x < width; x++) {
-                j = x & 7;
-                if ((dsp_mask << j) & 0x80) {
-                    memcpy(d, s, bpp);
-                }
-                d += bpp;
-                if ((mask << j) & 0x80)
-                    s += bpp;
-            }
-        }
-        break;
-    }
-}
-
-void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
-{
-    int i;
-    for(i = 0; i < w; i++) {
-        int a, b, c, p, pa, pb, pc;
-
-        a = dst[i - bpp];
-        b = top[i];
-        c = top[i - bpp];
-
-        p = b - c;
-        pc = a - c;
-
-        pa = abs(p);
-        pb = abs(pc);
-        pc = abs(p + pc);
-
-        if (pa <= pb && pa <= pc)
-            p = a;
-        else if (pb <= pc)
-            p = b;
-        else
-            p = c;
-        dst[i] = p + src[i];
-    }
-}
-
-#define UNROLL1(bpp, op) {\
-                 r = dst[0];\
-    if(bpp >= 2) g = dst[1];\
-    if(bpp >= 3) b = dst[2];\
-    if(bpp >= 4) a = dst[3];\
-    for(; i < size; i+=bpp) {\
-        dst[i+0] = r = op(r, src[i+0], last[i+0]);\
-        if(bpp == 1) continue;\
-        dst[i+1] = g = op(g, src[i+1], last[i+1]);\
-        if(bpp == 2) continue;\
-        dst[i+2] = b = op(b, src[i+2], last[i+2]);\
-        if(bpp == 3) continue;\
-        dst[i+3] = a = op(a, src[i+3], last[i+3]);\
-    }\
-}
-
-#define UNROLL_FILTER(op)\
-         if(bpp == 1) UNROLL1(1, op)\
-    else if(bpp == 2) UNROLL1(2, op)\
-    else if(bpp == 3) UNROLL1(3, op)\
-    else if(bpp == 4) UNROLL1(4, op)\
-    else {\
-        for (; i < size; i += bpp) {\
-            int j;\
-            for (j = 0; j < bpp; j++)\
-                dst[i+j] = op(dst[i+j-bpp], src[i+j], last[i+j]);\
-        }\
-    }
-
-/* NOTE: 'dst' can be equal to 'last' */
-static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type,
-                           uint8_t *src, uint8_t *last, int size, int bpp)
-{
-    int i, p, r, g, b, a;
-
-    switch(filter_type) {
-    case PNG_FILTER_VALUE_NONE:
-        memcpy(dst, src, size);
-        break;
-    case PNG_FILTER_VALUE_SUB:
-        for(i = 0; i < bpp; i++) {
-            dst[i] = src[i];
-        }
-        if(bpp == 4) {
-            p = *(int*)dst;
-            for(; i < size; i+=bpp) {
-                int s = *(int*)(src+i);
-                p = ((s&0x7f7f7f7f) + (p&0x7f7f7f7f)) ^ ((s^p)&0x80808080);
-                *(int*)(dst+i) = p;
-            }
-        } else {
-#define OP_SUB(x,s,l) x+s
-            UNROLL_FILTER(OP_SUB);
-        }
-        break;
-    case PNG_FILTER_VALUE_UP:
-        dsp->add_bytes_l2(dst, src, last, size);
-        break;
-    case PNG_FILTER_VALUE_AVG:
-        for(i = 0; i < bpp; i++) {
-            p = (last[i] >> 1);
-            dst[i] = p + src[i];
-        }
-#define OP_AVG(x,s,l) (((x + l) >> 1) + s) & 0xff
-        UNROLL_FILTER(OP_AVG);
-        break;
-    case PNG_FILTER_VALUE_PAETH:
-        for(i = 0; i < bpp; i++) {
-            p = last[i];
-            dst[i] = p + src[i];
-        }
-        if(bpp > 1 && size > 4) {
-            // would write off the end of the array if we let it process the last pixel with bpp=3
-            int w = bpp==4 ? size : size-3;
-            dsp->add_png_paeth_prediction(dst+i, src+i, last+i, w-i, bpp);
-            i = w;
-        }
-        ff_add_png_paeth_prediction(dst+i, src+i, last+i, size-i, bpp);
-        break;
-    }
-}
-
-static av_always_inline void convert_to_rgb32_loco(uint8_t *dst, const uint8_t *src, int width, int loco)
-{
-    int j;
-    unsigned int r, g, b, a;
-
-    for(j = 0;j < width; j++) {
-        r = src[0];
-        g = src[1];
-        b = src[2];
-        a = src[3];
-        if(loco) {
-            r = (r+g)&0xff;
-            b = (b+g)&0xff;
-        }
-        *(uint32_t *)dst = (a << 24) | (r << 16) | (g << 8) | b;
-        dst += 4;
-        src += 4;
-    }
-}
-
-static void convert_to_rgb32(uint8_t *dst, const uint8_t *src, int width, int loco)
-{
-    if(loco)
-        convert_to_rgb32_loco(dst, src, width, 1);
-    else
-        convert_to_rgb32_loco(dst, src, width, 0);
-}
-
-static void deloco_rgb24(uint8_t *dst, int size)
-{
-    int i;
-    for(i=0; i<size; i+=3) {
-        int g = dst[i+1];
-        dst[i+0] += g;
-        dst[i+2] += g;
-    }
-}
-
-/* process exactly one decompressed row */
-static void png_handle_row(PNGDecContext *s)
-{
-    uint8_t *ptr, *last_row;
-    int got_line;
-
-    if (!s->interlace_type) {
-        ptr = s->image_buf + s->image_linesize * s->y;
-        /* need to swap bytes correctly for RGB_ALPHA */
-        if (s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-            png_filter_row(&s->dsp, s->tmp_row, s->crow_buf[0], s->crow_buf + 1,
-                           s->last_row, s->row_size, s->bpp);
-            convert_to_rgb32(ptr, s->tmp_row, s->width, s->filter_type == PNG_FILTER_TYPE_LOCO);
-            FFSWAP(uint8_t*, s->last_row, s->tmp_row);
-        } else {
-            /* in normal case, we avoid one copy */
-            if (s->y == 0)
-                last_row = s->last_row;
-            else
-                last_row = ptr - s->image_linesize;
-
-            png_filter_row(&s->dsp, ptr, s->crow_buf[0], s->crow_buf + 1,
-                           last_row, s->row_size, s->bpp);
-        }
-        /* loco lags by 1 row so that it doesn't interfere with top prediction */
-        if (s->filter_type == PNG_FILTER_TYPE_LOCO &&
-            s->color_type == PNG_COLOR_TYPE_RGB && s->y > 0)
-            deloco_rgb24(ptr - s->image_linesize, s->row_size);
-        s->y++;
-        if (s->y == s->height) {
-            s->state |= PNG_ALLIMAGE;
-            if (s->filter_type == PNG_FILTER_TYPE_LOCO &&
-                s->color_type == PNG_COLOR_TYPE_RGB)
-                deloco_rgb24(ptr, s->row_size);
-        }
-    } else {
-        got_line = 0;
-        for(;;) {
-            ptr = s->image_buf + s->image_linesize * s->y;
-            if ((ff_png_pass_ymask[s->pass] << (s->y & 7)) & 0x80) {
-                /* if we already read one row, it is time to stop to
-                   wait for the next one */
-                if (got_line)
-                    break;
-                png_filter_row(&s->dsp, s->tmp_row, s->crow_buf[0], s->crow_buf + 1,
-                               s->last_row, s->pass_row_size, s->bpp);
-                FFSWAP(uint8_t*, s->last_row, s->tmp_row);
-                got_line = 1;
-            }
-            if ((png_pass_dsp_ymask[s->pass] << (s->y & 7)) & 0x80) {
-                /* NOTE: RGB32 is handled directly in png_put_interlaced_row */
-                png_put_interlaced_row(ptr, s->width, s->bits_per_pixel, s->pass,
-                                       s->color_type, s->last_row);
-            }
-            s->y++;
-            if (s->y == s->height) {
-                for(;;) {
-                    if (s->pass == NB_PASSES - 1) {
-                        s->state |= PNG_ALLIMAGE;
-                        goto the_end;
-                    } else {
-                        s->pass++;
-                        s->y = 0;
-                        s->pass_row_size = ff_png_pass_row_size(s->pass,
-                                                             s->bits_per_pixel,
-                                                             s->width);
-                        s->crow_size = s->pass_row_size + 1;
-                        if (s->pass_row_size != 0)
-                            break;
-                        /* skip pass if empty row */
-                    }
-                }
-            }
-        }
-    the_end: ;
-    }
-}
-
-static int png_decode_idat(PNGDecContext *s, int length)
-{
-    int ret;
-    s->zstream.avail_in = length;
-    s->zstream.next_in = s->bytestream;
-    s->bytestream += length;
-
-    if(s->bytestream > s->bytestream_end)
-        return -1;
-
-    /* decode one line if possible */
-    while (s->zstream.avail_in > 0) {
-        ret = inflate(&s->zstream, Z_PARTIAL_FLUSH);
-        if (ret != Z_OK && ret != Z_STREAM_END) {
-            return -1;
-        }
-        if (s->zstream.avail_out == 0) {
-            if (!(s->state & PNG_ALLIMAGE)) {
-                png_handle_row(s);
-            }
-            s->zstream.avail_out = s->crow_size;
-            s->zstream.next_out = s->crow_buf;
-        }
-    }
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    PNGDecContext * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame *p;
-    uint8_t *crow_buf_base = NULL;
-    uint32_t tag, length;
-    int ret, crc;
-
-    FFSWAP(AVFrame *, s->current_picture, s->last_picture);
-    avctx->coded_frame= s->current_picture;
-    p = s->current_picture;
-
-    s->bytestream_start=
-    s->bytestream= buf;
-    s->bytestream_end= buf + buf_size;
-
-    /* check signature */
-    if (memcmp(s->bytestream, ff_pngsig, 8) != 0 &&
-        memcmp(s->bytestream, ff_mngsig, 8) != 0)
-        return -1;
-    s->bytestream+= 8;
-    s->y=
-    s->state=0;
-//    memset(s, 0, sizeof(PNGDecContext));
-    /* init the zlib */
-    s->zstream.zalloc = ff_png_zalloc;
-    s->zstream.zfree = ff_png_zfree;
-    s->zstream.opaque = NULL;
-    ret = inflateInit(&s->zstream);
-    if (ret != Z_OK)
-        return -1;
-    for(;;) {
-        int tag32;
-        if (s->bytestream >= s->bytestream_end)
-            goto fail;
-        length = bytestream_get_be32(&s->bytestream);
-        if (length > 0x7fffffff)
-            goto fail;
-        tag32 = bytestream_get_be32(&s->bytestream);
-        tag = bswap_32(tag32);
-        dprintf(avctx, "png: tag=%c%c%c%c length=%u\n",
-                (tag & 0xff),
-                ((tag >> 8) & 0xff),
-                ((tag >> 16) & 0xff),
-                ((tag >> 24) & 0xff), length);
-        switch(tag) {
-        case MKTAG('I', 'H', 'D', 'R'):
-            if (length != 13)
-                goto fail;
-            s->width = bytestream_get_be32(&s->bytestream);
-            s->height = bytestream_get_be32(&s->bytestream);
-            if(avcodec_check_dimensions(avctx, s->width, s->height)){
-                s->width= s->height= 0;
-                goto fail;
-            }
-            s->bit_depth = *s->bytestream++;
-            s->color_type = *s->bytestream++;
-            s->compression_type = *s->bytestream++;
-            s->filter_type = *s->bytestream++;
-            s->interlace_type = *s->bytestream++;
-            crc = bytestream_get_be32(&s->bytestream);
-            s->state |= PNG_IHDR;
-            dprintf(avctx, "width=%d height=%d depth=%d color_type=%d compression_type=%d filter_type=%d interlace_type=%d\n",
-                    s->width, s->height, s->bit_depth, s->color_type,
-                    s->compression_type, s->filter_type, s->interlace_type);
-            break;
-        case MKTAG('I', 'D', 'A', 'T'):
-            if (!(s->state & PNG_IHDR))
-                goto fail;
-            if (!(s->state & PNG_IDAT)) {
-                /* init image info */
-                avctx->width = s->width;
-                avctx->height = s->height;
-
-                s->channels = ff_png_get_nb_channels(s->color_type);
-                s->bits_per_pixel = s->bit_depth * s->channels;
-                s->bpp = (s->bits_per_pixel + 7) >> 3;
-                s->row_size = (avctx->width * s->bits_per_pixel + 7) >> 3;
-
-                if (s->bit_depth == 8 &&
-                    s->color_type == PNG_COLOR_TYPE_RGB) {
-                    avctx->pix_fmt = PIX_FMT_RGB24;
-                } else if (s->bit_depth == 8 &&
-                           s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-                    avctx->pix_fmt = PIX_FMT_RGB32;
-                } else if (s->bit_depth == 8 &&
-                           s->color_type == PNG_COLOR_TYPE_GRAY) {
-                    avctx->pix_fmt = PIX_FMT_GRAY8;
-                } else if (s->bit_depth == 16 &&
-                           s->color_type == PNG_COLOR_TYPE_GRAY) {
-                    avctx->pix_fmt = PIX_FMT_GRAY16BE;
-                } else if (s->bit_depth == 16 &&
-                           s->color_type == PNG_COLOR_TYPE_RGB) {
-                    avctx->pix_fmt = PIX_FMT_RGB48BE;
-                } else if (s->bit_depth == 1 &&
-                           s->color_type == PNG_COLOR_TYPE_GRAY) {
-                    avctx->pix_fmt = PIX_FMT_MONOBLACK;
-                } else if (s->color_type == PNG_COLOR_TYPE_PALETTE) {
-                    avctx->pix_fmt = PIX_FMT_PAL8;
-                } else if (s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
-                    avctx->pix_fmt = PIX_FMT_Y400A;
-                } else {
-                    goto fail;
-                }
-                if(p->data[0])
-                    avctx->release_buffer(avctx, p);
-
-                p->reference= 0;
-                if(avctx->get_buffer(avctx, p) < 0){
-                    av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-                    goto fail;
-                }
-                p->pict_type= FF_I_TYPE;
-                p->key_frame= 1;
-                p->interlaced_frame = !!s->interlace_type;
-
-                /* compute the compressed row size */
-                if (!s->interlace_type) {
-                    s->crow_size = s->row_size + 1;
-                } else {
-                    s->pass = 0;
-                    s->pass_row_size = ff_png_pass_row_size(s->pass,
-                                                         s->bits_per_pixel,
-                                                         s->width);
-                    s->crow_size = s->pass_row_size + 1;
-                }
-                dprintf(avctx, "row_size=%d crow_size =%d\n",
-                        s->row_size, s->crow_size);
-                s->image_buf = p->data[0];
-                s->image_linesize = p->linesize[0];
-                /* copy the palette if needed */
-                if (s->color_type == PNG_COLOR_TYPE_PALETTE)
-                    memcpy(p->data[1], s->palette, 256 * sizeof(uint32_t));
-                /* empty row is used if differencing to the first row */
-                s->last_row = av_mallocz(s->row_size);
-                if (!s->last_row)
-                    goto fail;
-                if (s->interlace_type ||
-                    s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-                    s->tmp_row = av_malloc(s->row_size);
-                    if (!s->tmp_row)
-                        goto fail;
-                }
-                /* compressed row */
-                crow_buf_base = av_malloc(s->row_size + 16);
-                if (!crow_buf_base)
-                    goto fail;
-
-                /* we want crow_buf+1 to be 16-byte aligned */
-                s->crow_buf = crow_buf_base + 15;
-                s->zstream.avail_out = s->crow_size;
-                s->zstream.next_out = s->crow_buf;
-            }
-            s->state |= PNG_IDAT;
-            if (png_decode_idat(s, length) < 0)
-                goto fail;
-            /* skip crc */
-            crc = bytestream_get_be32(&s->bytestream);
-            break;
-        case MKTAG('P', 'L', 'T', 'E'):
-            {
-                int n, i, r, g, b;
-
-                if ((length % 3) != 0 || length > 256 * 3)
-                    goto skip_tag;
-                /* read the palette */
-                n = length / 3;
-                for(i=0;i<n;i++) {
-                    r = *s->bytestream++;
-                    g = *s->bytestream++;
-                    b = *s->bytestream++;
-                    s->palette[i] = (0xff << 24) | (r << 16) | (g << 8) | b;
-                }
-                for(;i<256;i++) {
-                    s->palette[i] = (0xff << 24);
-                }
-                s->state |= PNG_PLTE;
-                crc = bytestream_get_be32(&s->bytestream);
-            }
-            break;
-        case MKTAG('t', 'R', 'N', 'S'):
-            {
-                int v, i;
-
-                /* read the transparency. XXX: Only palette mode supported */
-                if (s->color_type != PNG_COLOR_TYPE_PALETTE ||
-                    length > 256 ||
-                    !(s->state & PNG_PLTE))
-                    goto skip_tag;
-                for(i=0;i<length;i++) {
-                    v = *s->bytestream++;
-                    s->palette[i] = (s->palette[i] & 0x00ffffff) | (v << 24);
-                }
-                crc = bytestream_get_be32(&s->bytestream);
-            }
-            break;
-        case MKTAG('I', 'E', 'N', 'D'):
-            if (!(s->state & PNG_ALLIMAGE))
-                goto fail;
-            crc = bytestream_get_be32(&s->bytestream);
-            goto exit_loop;
-        default:
-            /* skip tag */
-        skip_tag:
-            s->bytestream += length + 4;
-            break;
-        }
-    }
- exit_loop:
-     /* handle p-frames only if a predecessor frame is available */
-     if(s->last_picture->data[0] != NULL) {
-         if(!(avpkt->flags & AV_PKT_FLAG_KEY)) {
-            int i, j;
-            uint8_t *pd = s->current_picture->data[0];
-            uint8_t *pd_last = s->last_picture->data[0];
-
-            for(j=0; j < s->height; j++) {
-                for(i=0; i < s->width * s->bpp; i++) {
-                    pd[i] += pd_last[i];
-                }
-                pd += s->image_linesize;
-                pd_last += s->image_linesize;
-            }
-        }
-    }
-
-    *picture= *s->current_picture;
-    *data_size = sizeof(AVFrame);
-
-    ret = s->bytestream - s->bytestream_start;
- the_end:
-    inflateEnd(&s->zstream);
-    av_free(crow_buf_base);
-    s->crow_buf = NULL;
-    av_freep(&s->last_row);
-    av_freep(&s->tmp_row);
-    return ret;
- fail:
-    ret = -1;
-    goto the_end;
-}
-
-static av_cold int png_dec_init(AVCodecContext *avctx){
-    PNGDecContext *s = avctx->priv_data;
-
-    s->current_picture = &s->picture1;
-    s->last_picture = &s->picture2;
-    avcodec_get_frame_defaults(&s->picture1);
-    avcodec_get_frame_defaults(&s->picture2);
-    dsputil_init(&s->dsp, avctx);
-
-    return 0;
-}
-
-static av_cold int png_dec_end(AVCodecContext *avctx)
-{
-    PNGDecContext *s = avctx->priv_data;
-
-    if (s->picture1.data[0])
-        avctx->release_buffer(avctx, &s->picture1);
-    if (s->picture2.data[0])
-        avctx->release_buffer(avctx, &s->picture2);
-
-    return 0;
-}
-
-AVCodec png_decoder = {
-    "png",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PNG,
-    sizeof(PNGDecContext),
-    png_dec_init,
-    NULL,
-    png_dec_end,
-    decode_frame,
-    CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("PNG image"),
-};
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
deleted file mode 100644
index 615bcc4..0000000
--- a/libavcodec/pngenc.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * PNG image format
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "bytestream.h"
-#include "dsputil.h"
-#include "png.h"
-
-/* TODO:
- * - add 2, 4 and 16 bit depth support
- */
-
-#include <zlib.h>
-
-//#define DEBUG
-
-#define IOBUF_SIZE 4096
-
-typedef struct PNGEncContext {
-    DSPContext dsp;
-
-    uint8_t *bytestream;
-    uint8_t *bytestream_start;
-    uint8_t *bytestream_end;
-    AVFrame picture;
-
-    int filter_type;
-
-    z_stream zstream;
-    uint8_t buf[IOBUF_SIZE];
-} PNGEncContext;
-
-static void png_get_interlaced_row(uint8_t *dst, int row_size,
-                                   int bits_per_pixel, int pass,
-                                   const uint8_t *src, int width)
-{
-    int x, mask, dst_x, j, b, bpp;
-    uint8_t *d;
-    const uint8_t *s;
-
-    mask = ff_png_pass_mask[pass];
-    switch(bits_per_pixel) {
-    case 1:
-        memset(dst, 0, row_size);
-        dst_x = 0;
-        for(x = 0; x < width; x++) {
-            j = (x & 7);
-            if ((mask << j) & 0x80) {
-                b = (src[x >> 3] >> (7 - j)) & 1;
-                dst[dst_x >> 3] |= b << (7 - (dst_x & 7));
-                dst_x++;
-            }
-        }
-        break;
-    default:
-        bpp = bits_per_pixel >> 3;
-        d = dst;
-        s = src;
-        for(x = 0; x < width; x++) {
-            j = x & 7;
-            if ((mask << j) & 0x80) {
-                memcpy(d, s, bpp);
-                d += bpp;
-            }
-            s += bpp;
-        }
-        break;
-    }
-}
-
-static void sub_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)
-{
-    int i;
-    for(i = 0; i < w; i++) {
-        int a, b, c, p, pa, pb, pc;
-
-        a = src[i - bpp];
-        b = top[i];
-        c = top[i - bpp];
-
-        p = b - c;
-        pc = a - c;
-
-        pa = abs(p);
-        pb = abs(pc);
-        pc = abs(p + pc);
-
-        if (pa <= pb && pa <= pc)
-            p = a;
-        else if (pb <= pc)
-            p = b;
-        else
-            p = c;
-        dst[i] = src[i] - p;
-    }
-}
-
-static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type,
-                           uint8_t *src, uint8_t *top, int size, int bpp)
-{
-    int i;
-
-    switch(filter_type) {
-    case PNG_FILTER_VALUE_NONE:
-        memcpy(dst, src, size);
-        break;
-    case PNG_FILTER_VALUE_SUB:
-        dsp->diff_bytes(dst, src, src-bpp, size);
-        memcpy(dst, src, bpp);
-        break;
-    case PNG_FILTER_VALUE_UP:
-        dsp->diff_bytes(dst, src, top, size);
-        break;
-    case PNG_FILTER_VALUE_AVG:
-        for(i = 0; i < bpp; i++)
-            dst[i] = src[i] - (top[i] >> 1);
-        for(; i < size; i++)
-            dst[i] = src[i] - ((src[i-bpp] + top[i]) >> 1);
-        break;
-    case PNG_FILTER_VALUE_PAETH:
-        for(i = 0; i < bpp; i++)
-            dst[i] = src[i] - top[i];
-        sub_png_paeth_prediction(dst+i, src+i, top+i, size-i, bpp);
-        break;
-    }
-}
-
-static uint8_t *png_choose_filter(PNGEncContext *s, uint8_t *dst,
-                                  uint8_t *src, uint8_t *top, int size, int bpp)
-{
-    int pred = s->filter_type;
-    assert(bpp || !pred);
-    if(!top && pred)
-        pred = PNG_FILTER_VALUE_SUB;
-    if(pred == PNG_FILTER_VALUE_MIXED) {
-        int i;
-        int cost, bcost = INT_MAX;
-        uint8_t *buf1 = dst, *buf2 = dst + size + 16;
-        for(pred=0; pred<5; pred++) {
-            png_filter_row(&s->dsp, buf1+1, pred, src, top, size, bpp);
-            buf1[0] = pred;
-            cost = 0;
-            for(i=0; i<=size; i++)
-                cost += abs((int8_t)buf1[i]);
-            if(cost < bcost) {
-                bcost = cost;
-                FFSWAP(uint8_t*, buf1, buf2);
-            }
-        }
-        return buf2;
-    } else {
-        png_filter_row(&s->dsp, dst+1, pred, src, top, size, bpp);
-        dst[0] = pred;
-        return dst;
-    }
-}
-
-static void convert_from_rgb32(uint8_t *dst, const uint8_t *src, int width)
-{
-    uint8_t *d;
-    int j;
-    unsigned int v;
-
-    d = dst;
-    for(j = 0; j < width; j++) {
-        v = ((const uint32_t *)src)[j];
-        d[0] = v >> 16;
-        d[1] = v >> 8;
-        d[2] = v;
-        d[3] = v >> 24;
-        d += 4;
-    }
-}
-
-static void png_write_chunk(uint8_t **f, uint32_t tag,
-                            const uint8_t *buf, int length)
-{
-    uint32_t crc;
-    uint8_t tagbuf[4];
-
-    bytestream_put_be32(f, length);
-    crc = crc32(0, Z_NULL, 0);
-    AV_WL32(tagbuf, tag);
-    crc = crc32(crc, tagbuf, 4);
-    bytestream_put_be32(f, bswap_32(tag));
-    if (length > 0) {
-        crc = crc32(crc, buf, length);
-        memcpy(*f, buf, length);
-        *f += length;
-    }
-    bytestream_put_be32(f, crc);
-}
-
-/* XXX: do filtering */
-static int png_write_row(PNGEncContext *s, const uint8_t *data, int size)
-{
-    int ret;
-
-    s->zstream.avail_in = size;
-    s->zstream.next_in = (uint8_t *)data;
-    while (s->zstream.avail_in > 0) {
-        ret = deflate(&s->zstream, Z_NO_FLUSH);
-        if (ret != Z_OK)
-            return -1;
-        if (s->zstream.avail_out == 0) {
-            if(s->bytestream_end - s->bytestream > IOBUF_SIZE + 100)
-                png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, IOBUF_SIZE);
-            s->zstream.avail_out = IOBUF_SIZE;
-            s->zstream.next_out = s->buf;
-        }
-    }
-    return 0;
-}
-
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    PNGEncContext *s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= &s->picture;
-    int bit_depth, color_type, y, len, row_size, ret, is_progressive;
-    int bits_per_pixel, pass_row_size;
-    int compression_level;
-    uint8_t *ptr, *top;
-    uint8_t *crow_base = NULL, *crow_buf, *crow;
-    uint8_t *progressive_buf = NULL;
-    uint8_t *rgba_buf = NULL;
-    uint8_t *top_buf = NULL;
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    s->bytestream_start=
-    s->bytestream= buf;
-    s->bytestream_end= buf+buf_size;
-
-    is_progressive = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT);
-    switch(avctx->pix_fmt) {
-    case PIX_FMT_RGB32:
-        bit_depth = 8;
-        color_type = PNG_COLOR_TYPE_RGB_ALPHA;
-        break;
-    case PIX_FMT_RGB24:
-        bit_depth = 8;
-        color_type = PNG_COLOR_TYPE_RGB;
-        break;
-    case PIX_FMT_GRAY8:
-        bit_depth = 8;
-        color_type = PNG_COLOR_TYPE_GRAY;
-        break;
-    case PIX_FMT_MONOBLACK:
-        bit_depth = 1;
-        color_type = PNG_COLOR_TYPE_GRAY;
-        break;
-    case PIX_FMT_PAL8:
-        bit_depth = 8;
-        color_type = PNG_COLOR_TYPE_PALETTE;
-        break;
-    default:
-        return -1;
-    }
-    bits_per_pixel = ff_png_get_nb_channels(color_type) * bit_depth;
-    row_size = (avctx->width * bits_per_pixel + 7) >> 3;
-
-    s->zstream.zalloc = ff_png_zalloc;
-    s->zstream.zfree = ff_png_zfree;
-    s->zstream.opaque = NULL;
-    compression_level = avctx->compression_level == FF_COMPRESSION_DEFAULT ?
-                            Z_DEFAULT_COMPRESSION :
-                            av_clip(avctx->compression_level, 0, 9);
-    ret = deflateInit2(&s->zstream, compression_level,
-                       Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY);
-    if (ret != Z_OK)
-        return -1;
-    crow_base = av_malloc((row_size + 32) << (s->filter_type == PNG_FILTER_VALUE_MIXED));
-    if (!crow_base)
-        goto fail;
-    crow_buf = crow_base + 15; // pixel data should be aligned, but there's a control byte before it
-    if (is_progressive) {
-        progressive_buf = av_malloc(row_size + 1);
-        if (!progressive_buf)
-            goto fail;
-    }
-    if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-        rgba_buf = av_malloc(row_size + 1);
-        if (!rgba_buf)
-            goto fail;
-    }
-    if (is_progressive || color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-        top_buf = av_malloc(row_size + 1);
-        if (!top_buf)
-            goto fail;
-    }
-
-    /* write png header */
-    memcpy(s->bytestream, ff_pngsig, 8);
-    s->bytestream += 8;
-
-    AV_WB32(s->buf, avctx->width);
-    AV_WB32(s->buf + 4, avctx->height);
-    s->buf[8] = bit_depth;
-    s->buf[9] = color_type;
-    s->buf[10] = 0; /* compression type */
-    s->buf[11] = 0; /* filter type */
-    s->buf[12] = is_progressive; /* interlace type */
-
-    png_write_chunk(&s->bytestream, MKTAG('I', 'H', 'D', 'R'), s->buf, 13);
-
-    /* put the palette if needed */
-    if (color_type == PNG_COLOR_TYPE_PALETTE) {
-        int has_alpha, alpha, i;
-        unsigned int v;
-        uint32_t *palette;
-        uint8_t *alpha_ptr;
-
-        palette = (uint32_t *)p->data[1];
-        ptr = s->buf;
-        alpha_ptr = s->buf + 256 * 3;
-        has_alpha = 0;
-        for(i = 0; i < 256; i++) {
-            v = palette[i];
-            alpha = v >> 24;
-            if (alpha && alpha != 0xff)
-                has_alpha = 1;
-            *alpha_ptr++ = alpha;
-            bytestream_put_be24(&ptr, v);
-        }
-        png_write_chunk(&s->bytestream, MKTAG('P', 'L', 'T', 'E'), s->buf, 256 * 3);
-        if (has_alpha) {
-            png_write_chunk(&s->bytestream, MKTAG('t', 'R', 'N', 'S'), s->buf + 256 * 3, 256);
-        }
-    }
-
-    /* now put each row */
-    s->zstream.avail_out = IOBUF_SIZE;
-    s->zstream.next_out = s->buf;
-    if (is_progressive) {
-        int pass;
-
-        for(pass = 0; pass < NB_PASSES; pass++) {
-            /* NOTE: a pass is completely omited if no pixels would be
-               output */
-            pass_row_size = ff_png_pass_row_size(pass, bits_per_pixel, avctx->width);
-            if (pass_row_size > 0) {
-                top = NULL;
-                for(y = 0; y < avctx->height; y++) {
-                    if ((ff_png_pass_ymask[pass] << (y & 7)) & 0x80) {
-                        ptr = p->data[0] + y * p->linesize[0];
-                        FFSWAP(uint8_t*, progressive_buf, top_buf);
-                        if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-                            convert_from_rgb32(rgba_buf, ptr, avctx->width);
-                            ptr = rgba_buf;
-                        }
-                        png_get_interlaced_row(progressive_buf, pass_row_size,
-                                               bits_per_pixel, pass,
-                                               ptr, avctx->width);
-                        crow = png_choose_filter(s, crow_buf, progressive_buf, top, pass_row_size, bits_per_pixel>>3);
-                        png_write_row(s, crow, pass_row_size + 1);
-                        top = progressive_buf;
-                    }
-                }
-            }
-        }
-    } else {
-        top = NULL;
-        for(y = 0; y < avctx->height; y++) {
-            ptr = p->data[0] + y * p->linesize[0];
-            if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
-                FFSWAP(uint8_t*, rgba_buf, top_buf);
-                convert_from_rgb32(rgba_buf, ptr, avctx->width);
-                ptr = rgba_buf;
-            }
-            crow = png_choose_filter(s, crow_buf, ptr, top, row_size, bits_per_pixel>>3);
-            png_write_row(s, crow, row_size + 1);
-            top = ptr;
-        }
-    }
-    /* compress last bytes */
-    for(;;) {
-        ret = deflate(&s->zstream, Z_FINISH);
-        if (ret == Z_OK || ret == Z_STREAM_END) {
-            len = IOBUF_SIZE - s->zstream.avail_out;
-            if (len > 0 && s->bytestream_end - s->bytestream > len + 100) {
-                png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, len);
-            }
-            s->zstream.avail_out = IOBUF_SIZE;
-            s->zstream.next_out = s->buf;
-            if (ret == Z_STREAM_END)
-                break;
-        } else {
-            goto fail;
-        }
-    }
-    png_write_chunk(&s->bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0);
-
-    ret = s->bytestream - s->bytestream_start;
- the_end:
-    av_free(crow_base);
-    av_free(progressive_buf);
-    av_free(rgba_buf);
-    av_free(top_buf);
-    deflateEnd(&s->zstream);
-    return ret;
- fail:
-    ret = -1;
-    goto the_end;
-}
-
-static av_cold int png_enc_init(AVCodecContext *avctx){
-    PNGEncContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame= &s->picture;
-    dsputil_init(&s->dsp, avctx);
-
-    s->filter_type = av_clip(avctx->prediction_method, PNG_FILTER_VALUE_NONE, PNG_FILTER_VALUE_MIXED);
-    if(avctx->pix_fmt == PIX_FMT_MONOBLACK)
-        s->filter_type = PNG_FILTER_VALUE_NONE;
-
-    return 0;
-}
-
-AVCodec png_encoder = {
-    "png",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PNG,
-    sizeof(PNGEncContext),
-    png_enc_init,
-    encode_frame,
-    NULL, //encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("PNG image"),
-};
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
deleted file mode 100644
index cb6a713..0000000
--- a/libavcodec/pnm.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * PNM image format
- * Copyright (c) 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "pnm.h"
-
-static inline int pnm_space(int c)
-{
-    return c == ' ' || c == '\n' || c == '\r' || c == '\t';
-}
-
-static void pnm_get(PNMContext *sc, char *str, int buf_size)
-{
-    char *s;
-    int c;
-
-    /* skip spaces and comments */
-    for (;;) {
-        c = *sc->bytestream++;
-        if (c == '#')  {
-            do {
-                c = *sc->bytestream++;
-            } while (c != '\n' && sc->bytestream < sc->bytestream_end);
-        } else if (!pnm_space(c)) {
-            break;
-        }
-    }
-
-    s = str;
-    while (sc->bytestream < sc->bytestream_end && !pnm_space(c)) {
-        if ((s - str)  < buf_size - 1)
-            *s++ = c;
-        c = *sc->bytestream++;
-    }
-    *s = '\0';
-}
-
-int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
-{
-    char buf1[32], tuple_type[32];
-    int h, w, depth, maxval;
-
-    pnm_get(s, buf1, sizeof(buf1));
-    s->type= buf1[1]-'0';
-    if(buf1[0] != 'P')
-        return -1;
-
-    if (s->type==1 || s->type==4) {
-        avctx->pix_fmt = PIX_FMT_MONOWHITE;
-    } else if (s->type==2 || s->type==5) {
-        if (avctx->codec_id == CODEC_ID_PGMYUV)
-            avctx->pix_fmt = PIX_FMT_YUV420P;
-        else
-            avctx->pix_fmt = PIX_FMT_GRAY8;
-    } else if (s->type==3 || s->type==6) {
-        avctx->pix_fmt = PIX_FMT_RGB24;
-    } else if (s->type==7) {
-        w      = -1;
-        h      = -1;
-        maxval = -1;
-        depth  = -1;
-        tuple_type[0] = '\0';
-        for (;;) {
-            pnm_get(s, buf1, sizeof(buf1));
-            if (!strcmp(buf1, "WIDTH")) {
-                pnm_get(s, buf1, sizeof(buf1));
-                w = strtol(buf1, NULL, 10);
-            } else if (!strcmp(buf1, "HEIGHT")) {
-                pnm_get(s, buf1, sizeof(buf1));
-                h = strtol(buf1, NULL, 10);
-            } else if (!strcmp(buf1, "DEPTH")) {
-                pnm_get(s, buf1, sizeof(buf1));
-                depth = strtol(buf1, NULL, 10);
-            } else if (!strcmp(buf1, "MAXVAL")) {
-                pnm_get(s, buf1, sizeof(buf1));
-                maxval = strtol(buf1, NULL, 10);
-            } else if (!strcmp(buf1, "TUPLETYPE")) {
-                pnm_get(s, tuple_type, sizeof(tuple_type));
-            } else if (!strcmp(buf1, "ENDHDR")) {
-                break;
-            } else {
-                return -1;
-            }
-        }
-        /* check that all tags are present */
-        if (w <= 0 || h <= 0 || maxval <= 0 || depth <= 0 || tuple_type[0] == '\0' || avcodec_check_dimensions(avctx, w, h))
-            return -1;
-
-        avctx->width  = w;
-        avctx->height = h;
-        if (depth == 1) {
-            if (maxval == 1)
-                avctx->pix_fmt = PIX_FMT_MONOWHITE;
-            else
-                avctx->pix_fmt = PIX_FMT_GRAY8;
-        } else if (depth == 3) {
-            if (maxval < 256) {
-            avctx->pix_fmt = PIX_FMT_RGB24;
-            } else {
-                av_log(avctx, AV_LOG_ERROR, "16-bit components are only supported for grayscale\n");
-                avctx->pix_fmt = PIX_FMT_NONE;
-                return -1;
-            }
-        } else if (depth == 4) {
-            avctx->pix_fmt = PIX_FMT_RGB32;
-        } else {
-            return -1;
-        }
-        return 0;
-    } else {
-        return -1;
-    }
-    pnm_get(s, buf1, sizeof(buf1));
-    avctx->width = atoi(buf1);
-    if (avctx->width <= 0)
-        return -1;
-    pnm_get(s, buf1, sizeof(buf1));
-    avctx->height = atoi(buf1);
-    if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))
-        return -1;
-    if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
-        pnm_get(s, buf1, sizeof(buf1));
-        s->maxval = atoi(buf1);
-        if (s->maxval >= 256) {
-            if (avctx->pix_fmt == PIX_FMT_GRAY8) {
-                avctx->pix_fmt = PIX_FMT_GRAY16BE;
-                if (s->maxval != 65535)
-                    avctx->pix_fmt = PIX_FMT_GRAY16;
-            } else if (avctx->pix_fmt == PIX_FMT_RGB24) {
-                if (s->maxval > 255)
-                    avctx->pix_fmt = PIX_FMT_RGB48BE;
-            } else {
-                av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format\n");
-                avctx->pix_fmt = PIX_FMT_NONE;
-                return -1;
-            }
-        }
-    }else
-        s->maxval=1;
-    /* more check if YUV420 */
-    if (avctx->pix_fmt == PIX_FMT_YUV420P) {
-        if ((avctx->width & 1) != 0)
-            return -1;
-        h = (avctx->height * 2);
-        if ((h % 3) != 0)
-            return -1;
-        h /= 3;
-        avctx->height = h;
-    }
-    return 0;
-}
-
-av_cold int ff_pnm_end(AVCodecContext *avctx)
-{
-    PNMContext *s = avctx->priv_data;
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-av_cold int ff_pnm_init(AVCodecContext *avctx)
-{
-    PNMContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults((AVFrame*)&s->picture);
-    avctx->coded_frame = (AVFrame*)&s->picture;
-
-    return 0;
-}
diff --git a/libavcodec/pnm.h b/libavcodec/pnm.h
deleted file mode 100644
index ac4b108..0000000
--- a/libavcodec/pnm.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * PNM image format
- * Copyright (c) 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PNM_H
-#define AVCODEC_PNM_H
-
-#include "avcodec.h"
-
-typedef struct PNMContext {
-    uint8_t *bytestream;
-    uint8_t *bytestream_start;
-    uint8_t *bytestream_end;
-    AVFrame picture;
-    int maxval;                 ///< maximum value of a pixel
-    int type;
-} PNMContext;
-
-int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s);
-av_cold int ff_pnm_end(AVCodecContext *avctx);
-av_cold int ff_pnm_init(AVCodecContext *avctx);
-
-#endif /* AVCODEC_PNM_H */
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
deleted file mode 100644
index b8ba1a8..0000000
--- a/libavcodec/pnm_parser.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * PNM image parser
- * Copyright (c) 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h" //for ParseContext
-#include "pnm.h"
-
-
-static int pnm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
-                     const uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size)
-{
-    ParseContext *pc = s->priv_data;
-    PNMContext pnmctx;
-    int next;
-
-    for (; pc->overread > 0; pc->overread--) {
-        pc->buffer[pc->index++]= pc->buffer[pc->overread_index++];
-    }
-retry:
-    if (pc->index) {
-        pnmctx.bytestream_start =
-        pnmctx.bytestream       = pc->buffer;
-        pnmctx.bytestream_end   = pc->buffer + pc->index;
-    } else {
-        pnmctx.bytestream_start =
-        pnmctx.bytestream       = (uint8_t *) buf; /* casts avoid warnings */
-        pnmctx.bytestream_end   = (uint8_t *) buf + buf_size;
-    }
-    if (ff_pnm_decode_header(avctx, &pnmctx) < 0) {
-        if (pnmctx.bytestream < pnmctx.bytestream_end) {
-            if (pc->index) {
-                pc->index = 0;
-            } else {
-                buf++;
-                buf_size--;
-            }
-            goto retry;
-        }
-#if 0
-        if (pc->index && pc->index * 2 + FF_INPUT_BUFFER_PADDING_SIZE < pc->buffer_size && buf_size > pc->index) {
-            memcpy(pc->buffer + pc->index, buf, pc->index);
-            pc->index += pc->index;
-            buf       += pc->index;
-            buf_size  -= pc->index;
-            goto retry;
-        }
-#endif
-        next = END_NOT_FOUND;
-    } else {
-        next = pnmctx.bytestream - pnmctx.bytestream_start
-               + avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
-        if (pnmctx.bytestream_start != buf)
-            next -= pc->index;
-        if (next > buf_size)
-            next = END_NOT_FOUND;
-    }
-
-    if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
-        *poutbuf      = NULL;
-        *poutbuf_size = 0;
-        return buf_size;
-    }
-    *poutbuf      = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-AVCodecParser pnm_parser = {
-    { CODEC_ID_PGM, CODEC_ID_PGMYUV, CODEC_ID_PPM, CODEC_ID_PBM, CODEC_ID_PAM},
-    sizeof(ParseContext),
-    NULL,
-    pnm_parse,
-    ff_parse_close,
-};
diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c
deleted file mode 100644
index 66033c1..0000000
--- a/libavcodec/pnmdec.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * PNM image format
- * Copyright (c) 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "put_bits.h"
-#include "pnm.h"
-
-
-static int pnm_decode_frame(AVCodecContext *avctx, void *data,
-                            int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf   = avpkt->data;
-    int buf_size         = avpkt->size;
-    PNMContext * const s = avctx->priv_data;
-    AVFrame *picture     = data;
-    AVFrame * const p    = (AVFrame*)&s->picture;
-    int i, j, n, linesize, h, upgrade = 0;
-    unsigned char *ptr;
-    int components, sample_len;
-
-    s->bytestream_start =
-    s->bytestream       = buf;
-    s->bytestream_end   = buf + buf_size;
-
-    if (ff_pnm_decode_header(avctx, s) < 0)
-        return -1;
-
-    if (p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 0;
-    if (avctx->get_buffer(avctx, p) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-
-    switch (avctx->pix_fmt) {
-    default:
-        return -1;
-    case PIX_FMT_RGB48BE:
-        n = avctx->width * 6;
-        components=3;
-        sample_len=16;
-        goto do_read;
-    case PIX_FMT_RGB24:
-        n = avctx->width * 3;
-        components=3;
-        sample_len=8;
-        goto do_read;
-    case PIX_FMT_GRAY8:
-        n = avctx->width;
-        components=1;
-        sample_len=8;
-        if (s->maxval < 255)
-            upgrade = 1;
-        goto do_read;
-    case PIX_FMT_GRAY16BE:
-    case PIX_FMT_GRAY16LE:
-        n = avctx->width * 2;
-        components=1;
-        sample_len=16;
-        if (s->maxval < 65535)
-            upgrade = 2;
-        goto do_read;
-    case PIX_FMT_MONOWHITE:
-    case PIX_FMT_MONOBLACK:
-        n = (avctx->width + 7) >> 3;
-        components=1;
-        sample_len=1;
-    do_read:
-        ptr      = p->data[0];
-        linesize = p->linesize[0];
-        if (s->bytestream + n * avctx->height > s->bytestream_end)
-            return -1;
-        if(s->type < 4){
-            for (i=0; i<avctx->height; i++) {
-                PutBitContext pb;
-                init_put_bits(&pb, ptr, linesize);
-                for(j=0; j<avctx->width * components; j++){
-                    unsigned int c=0;
-                    int v=0;
-                    while(s->bytestream < s->bytestream_end && (*s->bytestream < '0' || *s->bytestream > '9' ))
-                        s->bytestream++;
-                    if(s->bytestream >= s->bytestream_end)
-                        return -1;
-                    do{
-                        v= 10*v + c;
-                        c= (*s->bytestream++) - '0';
-                    }while(c <= 9);
-                    put_bits(&pb, sample_len, (((1<<sample_len)-1)*v + (s->maxval>>1))/s->maxval);
-                }
-                flush_put_bits(&pb);
-                ptr+= linesize;
-            }
-        }else{
-        for (i = 0; i < avctx->height; i++) {
-            if (!upgrade)
-                memcpy(ptr, s->bytestream, n);
-            else if (upgrade == 1) {
-                unsigned int j, f = (255 * 128 + s->maxval / 2) / s->maxval;
-                for (j = 0; j < n; j++)
-                    ptr[j] = (s->bytestream[j] * f + 64) >> 7;
-            } else if (upgrade == 2) {
-                unsigned int j, v, f = (65535 * 32768 + s->maxval / 2) / s->maxval;
-                for (j = 0; j < n / 2; j++) {
-                    v = be2me_16(((uint16_t *)s->bytestream)[j]);
-                    ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
-                }
-            }
-            s->bytestream += n;
-            ptr           += linesize;
-        }
-        }
-        break;
-    case PIX_FMT_YUV420P:
-        {
-            unsigned char *ptr1, *ptr2;
-
-            n        = avctx->width;
-            ptr      = p->data[0];
-            linesize = p->linesize[0];
-            if (s->bytestream + n * avctx->height * 3 / 2 > s->bytestream_end)
-                return -1;
-            for (i = 0; i < avctx->height; i++) {
-                memcpy(ptr, s->bytestream, n);
-                s->bytestream += n;
-                ptr           += linesize;
-            }
-            ptr1 = p->data[1];
-            ptr2 = p->data[2];
-            n >>= 1;
-            h = avctx->height >> 1;
-            for (i = 0; i < h; i++) {
-                memcpy(ptr1, s->bytestream, n);
-                s->bytestream += n;
-                memcpy(ptr2, s->bytestream, n);
-                s->bytestream += n;
-                ptr1 += p->linesize[1];
-                ptr2 += p->linesize[2];
-            }
-        }
-        break;
-    case PIX_FMT_RGB32:
-        ptr      = p->data[0];
-        linesize = p->linesize[0];
-        if (s->bytestream + avctx->width * avctx->height * 4 > s->bytestream_end)
-            return -1;
-        for (i = 0; i < avctx->height; i++) {
-            int j, r, g, b, a;
-
-            for (j = 0; j < avctx->width; j++) {
-                r = *s->bytestream++;
-                g = *s->bytestream++;
-                b = *s->bytestream++;
-                a = *s->bytestream++;
-                ((uint32_t *)ptr)[j] = (a << 24) | (r << 16) | (g << 8) | b;
-            }
-            ptr += linesize;
-        }
-        break;
-    }
-    *picture   = *(AVFrame*)&s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return s->bytestream - s->bytestream_start;
-}
-
-
-#if CONFIG_PGM_DECODER
-AVCodec pgm_decoder = {
-    "pgm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PGM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    NULL,
-    ff_pnm_end,
-    pnm_decode_frame,
-    CODEC_CAP_DR1,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
-};
-#endif
-
-#if CONFIG_PGMYUV_DECODER
-AVCodec pgmyuv_decoder = {
-    "pgmyuv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PGMYUV,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    NULL,
-    ff_pnm_end,
-    pnm_decode_frame,
-    CODEC_CAP_DR1,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
-};
-#endif
-
-#if CONFIG_PPM_DECODER
-AVCodec ppm_decoder = {
-    "ppm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PPM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    NULL,
-    ff_pnm_end,
-    pnm_decode_frame,
-    CODEC_CAP_DR1,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
-};
-#endif
-
-#if CONFIG_PBM_DECODER
-AVCodec pbm_decoder = {
-    "pbm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PBM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    NULL,
-    ff_pnm_end,
-    pnm_decode_frame,
-    CODEC_CAP_DR1,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
-};
-#endif
-
-#if CONFIG_PAM_DECODER
-AVCodec pam_decoder = {
-    "pam",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PAM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    NULL,
-    ff_pnm_end,
-    pnm_decode_frame,
-    CODEC_CAP_DR1,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"),
-};
-#endif
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
deleted file mode 100644
index 1fbf665..0000000
--- a/libavcodec/pnmenc.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * PNM image format
- * Copyright (c) 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "pnm.h"
-
-
-static int pnm_encode_frame(AVCodecContext *avctx, unsigned char *outbuf,
-                            int buf_size, void *data)
-{
-    PNMContext *s     = avctx->priv_data;
-    AVFrame *pict     = data;
-    AVFrame * const p = (AVFrame*)&s->picture;
-    int i, h, h1, c, n, linesize;
-    uint8_t *ptr, *ptr1, *ptr2;
-
-    if (buf_size < avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height) + 200) {
-        av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-
-    *p           = *pict;
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-
-    s->bytestream_start =
-    s->bytestream       = outbuf;
-    s->bytestream_end   = outbuf + buf_size;
-
-    h  = avctx->height;
-    h1 = h;
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_MONOWHITE:
-        c  = '4';
-        n  = (avctx->width + 7) >> 3;
-        break;
-    case PIX_FMT_GRAY8:
-        c  = '5';
-        n  = avctx->width;
-        break;
-    case PIX_FMT_GRAY16BE:
-        c  = '5';
-        n  = avctx->width * 2;
-        break;
-    case PIX_FMT_RGB24:
-        c  = '6';
-        n  = avctx->width * 3;
-        break;
-    case PIX_FMT_RGB48BE:
-        c  = '6';
-        n  = avctx->width * 6;
-        break;
-    case PIX_FMT_YUV420P:
-        c  = '5';
-        n  = avctx->width;
-        h1 = (h * 3) / 2;
-        break;
-    default:
-        return -1;
-    }
-    snprintf(s->bytestream, s->bytestream_end - s->bytestream,
-             "P%c\n%d %d\n", c, avctx->width, h1);
-    s->bytestream += strlen(s->bytestream);
-    if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
-        snprintf(s->bytestream, s->bytestream_end - s->bytestream,
-                 "%d\n", (avctx->pix_fmt != PIX_FMT_GRAY16BE && avctx->pix_fmt != PIX_FMT_RGB48BE) ? 255 : 65535);
-        s->bytestream += strlen(s->bytestream);
-    }
-
-    ptr      = p->data[0];
-    linesize = p->linesize[0];
-    for (i = 0; i < h; i++) {
-        memcpy(s->bytestream, ptr, n);
-        s->bytestream += n;
-        ptr           += linesize;
-    }
-
-    if (avctx->pix_fmt == PIX_FMT_YUV420P) {
-        h >>= 1;
-        n >>= 1;
-        ptr1 = p->data[1];
-        ptr2 = p->data[2];
-        for (i = 0; i < h; i++) {
-            memcpy(s->bytestream, ptr1, n);
-            s->bytestream += n;
-            memcpy(s->bytestream, ptr2, n);
-            s->bytestream += n;
-                ptr1 += p->linesize[1];
-                ptr2 += p->linesize[2];
-        }
-    }
-    return s->bytestream - s->bytestream_start;
-}
-
-
-#if CONFIG_PGM_ENCODER
-AVCodec pgm_encoder = {
-    "pgm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PGM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    pnm_encode_frame,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"),
-};
-#endif
-
-#if CONFIG_PGMYUV_ENCODER
-AVCodec pgmyuv_encoder = {
-    "pgmyuv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PGMYUV,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    pnm_encode_frame,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"),
-};
-#endif
-
-#if CONFIG_PPM_ENCODER
-AVCodec ppm_encoder = {
-    "ppm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PPM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    pnm_encode_frame,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"),
-};
-#endif
-
-#if CONFIG_PBM_ENCODER
-AVCodec pbm_encoder = {
-    "pbm",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PBM,
-    sizeof(PNMContext),
-    ff_pnm_init,
-    pnm_encode_frame,
-    .pix_fmts  = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"),
-};
-#endif
diff --git a/libavcodec/ppc/Makefile b/libavcodec/ppc/Makefile
deleted file mode 100644
index 5d5a59b..0000000
--- a/libavcodec/ppc/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-OBJS                                   += ppc/dsputil_ppc.o             \
-
-ALTIVEC-OBJS-$(CONFIG_H264DSP)         += ppc/h264_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VC1_DECODER)     += ppc/vc1dsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VP3_DECODER)     += ppc/vp3dsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VP5_DECODER)     += ppc/vp3dsp_altivec.o
-ALTIVEC-OBJS-$(CONFIG_VP6_DECODER)     += ppc/vp3dsp_altivec.o
-
-OBJS-$(HAVE_ALTIVEC)                   += ppc/check_altivec.o           \
-                                          ppc/dsputil_altivec.o         \
-                                          ppc/fdct_altivec.o            \
-                                          ppc/fft_altivec.o             \
-                                          ppc/float_altivec.o           \
-                                          ppc/gmc_altivec.o             \
-                                          ppc/idct_altivec.o            \
-                                          ppc/int_altivec.o             \
-                                          ppc/mpegvideo_altivec.o       \
-                                          $(ALTIVEC-OBJS-yes)
diff --git a/libavcodec/ppc/check_altivec.c b/libavcodec/ppc/check_altivec.c
deleted file mode 100644
index c8bc6ed..0000000
--- a/libavcodec/ppc/check_altivec.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-/**
- * @file
- * Checks for AltiVec presence.
- */
-
-#ifdef __APPLE__
-#undef _POSIX_C_SOURCE
-#include <sys/sysctl.h>
-#elif defined(__OpenBSD__)
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <machine/cpu.h>
-#elif defined(__AMIGAOS4__)
-#include <exec/exec.h>
-#include <interfaces/exec.h>
-#include <proto/exec.h>
-#endif /* __APPLE__ */
-
-#include "config.h"
-#include "dsputil_altivec.h"
-
-/**
- * This function MAY rely on signal() or fork() in order to make sure AltiVec
- * is present.
- */
-
-int has_altivec(void)
-{
-#ifdef __AMIGAOS4__
-    ULONG result = 0;
-    extern struct ExecIFace *IExec;
-
-    IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
-    if (result == VECTORTYPE_ALTIVEC) return 1;
-    return 0;
-#elif defined(__APPLE__) || defined(__OpenBSD__)
-#ifdef __OpenBSD__
-    int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
-#else
-    int sels[2] = {CTL_HW, HW_VECTORUNIT};
-#endif
-    int has_vu = 0;
-    size_t len = sizeof(has_vu);
-    int err;
-
-    err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
-
-    if (err == 0) return has_vu != 0;
-    return 0;
-#elif CONFIG_RUNTIME_CPUDETECT
-    int proc_ver;
-    // Support of mfspr PVR emulation added in Linux 2.6.17.
-    __asm__ volatile("mfspr %0, 287" : "=r" (proc_ver));
-    proc_ver >>= 16;
-    if (proc_ver  & 0x8000 ||
-        proc_ver == 0x000c ||
-        proc_ver == 0x0039 || proc_ver == 0x003c ||
-        proc_ver == 0x0044 || proc_ver == 0x0045 ||
-        proc_ver == 0x0070)
-        return 1;
-    return 0;
-#else
-    // Since we were compiled for AltiVec, just assume we have it
-    // until someone comes up with a proper way (not involving signal hacks).
-    return 1;
-#endif /* __AMIGAOS4__ */
-}
-
diff --git a/libavcodec/ppc/dsputil_altivec.c b/libavcodec/ppc/dsputil_altivec.c
deleted file mode 100644
index 925b6c8..0000000
--- a/libavcodec/ppc/dsputil_altivec.c
+++ /dev/null
@@ -1,1457 +0,0 @@
-/*
- * Copyright (c) 2002 Brian Foley
- * Copyright (c) 2002 Dieter Shirley
- * Copyright (c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-#include "libavcodec/dsputil.h"
-#include "dsputil_ppc.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
-#include "dsputil_altivec.h"
-
-static int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int i;
-    int s;
-    const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
-    vector unsigned char *tv;
-    vector unsigned char pix1v, pix2v, pix2iv, avgv, t5;
-    vector unsigned int sad;
-    vector signed int sumdiffs;
-
-    s = 0;
-    sad = (vector unsigned int)vec_splat_u32(0);
-    for (i = 0; i < h; i++) {
-        /* Read unaligned pixels into our vectors. The vectors are as follows:
-           pix1v: pix1[0]-pix1[15]
-           pix2v: pix2[0]-pix2[15]      pix2iv: pix2[1]-pix2[16] */
-        tv = (vector unsigned char *) pix1;
-        pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1));
-
-        tv = (vector unsigned char *) &pix2[0];
-        pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[0]));
-
-        tv = (vector unsigned char *) &pix2[1];
-        pix2iv = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[1]));
-
-        /* Calculate the average vector */
-        avgv = vec_avg(pix2v, pix2iv);
-
-        /* Calculate a sum of abs differences vector */
-        t5 = vec_sub(vec_max(pix1v, avgv), vec_min(pix1v, avgv));
-
-        /* Add each 4 pixel group together and put 4 results into sad */
-        sad = vec_sum4s(t5, sad);
-
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-    /* Sum up the four partial sums, and put the result into s */
-    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
-    sumdiffs = vec_splat(sumdiffs, 3);
-    vec_ste(sumdiffs, 0, &s);
-
-    return s;
-}
-
-static int sad16_y2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int i;
-    int s;
-    const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
-    vector unsigned char *tv;
-    vector unsigned char pix1v, pix2v, pix3v, avgv, t5;
-    vector unsigned int sad;
-    vector signed int sumdiffs;
-    uint8_t *pix3 = pix2 + line_size;
-
-    s = 0;
-    sad = (vector unsigned int)vec_splat_u32(0);
-
-    /* Due to the fact that pix3 = pix2 + line_size, the pix3 of one
-       iteration becomes pix2 in the next iteration. We can use this
-       fact to avoid a potentially expensive unaligned read, each
-       time around the loop.
-       Read unaligned pixels into our vectors. The vectors are as follows:
-       pix2v: pix2[0]-pix2[15]
-       Split the pixel vectors into shorts */
-    tv = (vector unsigned char *) &pix2[0];
-    pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[0]));
-
-    for (i = 0; i < h; i++) {
-        /* Read unaligned pixels into our vectors. The vectors are as follows:
-           pix1v: pix1[0]-pix1[15]
-           pix3v: pix3[0]-pix3[15] */
-        tv = (vector unsigned char *) pix1;
-        pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1));
-
-        tv = (vector unsigned char *) &pix3[0];
-        pix3v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix3[0]));
-
-        /* Calculate the average vector */
-        avgv = vec_avg(pix2v, pix3v);
-
-        /* Calculate a sum of abs differences vector */
-        t5 = vec_sub(vec_max(pix1v, avgv), vec_min(pix1v, avgv));
-
-        /* Add each 4 pixel group together and put 4 results into sad */
-        sad = vec_sum4s(t5, sad);
-
-        pix1 += line_size;
-        pix2v = pix3v;
-        pix3 += line_size;
-
-    }
-
-    /* Sum up the four partial sums, and put the result into s */
-    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
-    sumdiffs = vec_splat(sumdiffs, 3);
-    vec_ste(sumdiffs, 0, &s);
-    return s;
-}
-
-static int sad16_xy2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int i;
-    int s;
-    uint8_t *pix3 = pix2 + line_size;
-    const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
-    const vector unsigned short two = (const vector unsigned short)vec_splat_u16(2);
-    vector unsigned char *tv, avgv, t5;
-    vector unsigned char pix1v, pix2v, pix3v, pix2iv, pix3iv;
-    vector unsigned short pix2lv, pix2hv, pix2ilv, pix2ihv;
-    vector unsigned short pix3lv, pix3hv, pix3ilv, pix3ihv;
-    vector unsigned short avghv, avglv;
-    vector unsigned short t1, t2, t3, t4;
-    vector unsigned int sad;
-    vector signed int sumdiffs;
-
-    sad = (vector unsigned int)vec_splat_u32(0);
-
-    s = 0;
-
-    /* Due to the fact that pix3 = pix2 + line_size, the pix3 of one
-       iteration becomes pix2 in the next iteration. We can use this
-       fact to avoid a potentially expensive unaligned read, as well
-       as some splitting, and vector addition each time around the loop.
-       Read unaligned pixels into our vectors. The vectors are as follows:
-       pix2v: pix2[0]-pix2[15]  pix2iv: pix2[1]-pix2[16]
-       Split the pixel vectors into shorts */
-    tv = (vector unsigned char *) &pix2[0];
-    pix2v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[0]));
-
-    tv = (vector unsigned char *) &pix2[1];
-    pix2iv = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix2[1]));
-
-    pix2hv  = (vector unsigned short) vec_mergeh(zero, pix2v);
-    pix2lv  = (vector unsigned short) vec_mergel(zero, pix2v);
-    pix2ihv = (vector unsigned short) vec_mergeh(zero, pix2iv);
-    pix2ilv = (vector unsigned short) vec_mergel(zero, pix2iv);
-    t1 = vec_add(pix2hv, pix2ihv);
-    t2 = vec_add(pix2lv, pix2ilv);
-
-    for (i = 0; i < h; i++) {
-        /* Read unaligned pixels into our vectors. The vectors are as follows:
-           pix1v: pix1[0]-pix1[15]
-           pix3v: pix3[0]-pix3[15]      pix3iv: pix3[1]-pix3[16] */
-        tv = (vector unsigned char *) pix1;
-        pix1v = vec_perm(tv[0], tv[1], vec_lvsl(0, pix1));
-
-        tv = (vector unsigned char *) &pix3[0];
-        pix3v = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix3[0]));
-
-        tv = (vector unsigned char *) &pix3[1];
-        pix3iv = vec_perm(tv[0], tv[1], vec_lvsl(0, &pix3[1]));
-
-        /* Note that AltiVec does have vec_avg, but this works on vector pairs
-           and rounds up. We could do avg(avg(a,b),avg(c,d)), but the rounding
-           would mean that, for example, avg(3,0,0,1) = 2, when it should be 1.
-           Instead, we have to split the pixel vectors into vectors of shorts,
-           and do the averaging by hand. */
-
-        /* Split the pixel vectors into shorts */
-        pix3hv  = (vector unsigned short) vec_mergeh(zero, pix3v);
-        pix3lv  = (vector unsigned short) vec_mergel(zero, pix3v);
-        pix3ihv = (vector unsigned short) vec_mergeh(zero, pix3iv);
-        pix3ilv = (vector unsigned short) vec_mergel(zero, pix3iv);
-
-        /* Do the averaging on them */
-        t3 = vec_add(pix3hv, pix3ihv);
-        t4 = vec_add(pix3lv, pix3ilv);
-
-        avghv = vec_sr(vec_add(vec_add(t1, t3), two), two);
-        avglv = vec_sr(vec_add(vec_add(t2, t4), two), two);
-
-        /* Pack the shorts back into a result */
-        avgv = vec_pack(avghv, avglv);
-
-        /* Calculate a sum of abs differences vector */
-        t5 = vec_sub(vec_max(pix1v, avgv), vec_min(pix1v, avgv));
-
-        /* Add each 4 pixel group together and put 4 results into sad */
-        sad = vec_sum4s(t5, sad);
-
-        pix1 += line_size;
-        pix3 += line_size;
-        /* Transfer the calculated values for pix3 into pix2 */
-        t1 = t3;
-        t2 = t4;
-    }
-    /* Sum up the four partial sums, and put the result into s */
-    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
-    sumdiffs = vec_splat(sumdiffs, 3);
-    vec_ste(sumdiffs, 0, &s);
-
-    return s;
-}
-
-static int sad16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int i;
-    int s;
-    const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
-    vector unsigned char perm1, perm2, *pix1v, *pix2v;
-    vector unsigned char t1, t2, t3,t4, t5;
-    vector unsigned int sad;
-    vector signed int sumdiffs;
-
-    sad = (vector unsigned int)vec_splat_u32(0);
-
-
-    for (i = 0; i < h; i++) {
-        /* Read potentially unaligned pixels into t1 and t2 */
-        perm1 = vec_lvsl(0, pix1);
-        pix1v = (vector unsigned char *) pix1;
-        perm2 = vec_lvsl(0, pix2);
-        pix2v = (vector unsigned char *) pix2;
-        t1 = vec_perm(pix1v[0], pix1v[1], perm1);
-        t2 = vec_perm(pix2v[0], pix2v[1], perm2);
-
-        /* Calculate a sum of abs differences vector */
-        t3 = vec_max(t1, t2);
-        t4 = vec_min(t1, t2);
-        t5 = vec_sub(t3, t4);
-
-        /* Add each 4 pixel group together and put 4 results into sad */
-        sad = vec_sum4s(t5, sad);
-
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-
-    /* Sum up the four partial sums, and put the result into s */
-    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
-    sumdiffs = vec_splat(sumdiffs, 3);
-    vec_ste(sumdiffs, 0, &s);
-
-    return s;
-}
-
-static int sad8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int i;
-    int s;
-    const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
-    vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v;
-    vector unsigned char t1, t2, t3,t4, t5;
-    vector unsigned int sad;
-    vector signed int sumdiffs;
-
-    sad = (vector unsigned int)vec_splat_u32(0);
-
-    permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};
-
-    for (i = 0; i < h; i++) {
-        /* Read potentially unaligned pixels into t1 and t2
-           Since we're reading 16 pixels, and actually only want 8,
-           mask out the last 8 pixels. The 0s don't change the sum. */
-        perm1 = vec_lvsl(0, pix1);
-        pix1v = (vector unsigned char *) pix1;
-        perm2 = vec_lvsl(0, pix2);
-        pix2v = (vector unsigned char *) pix2;
-        t1 = vec_and(vec_perm(pix1v[0], pix1v[1], perm1), permclear);
-        t2 = vec_and(vec_perm(pix2v[0], pix2v[1], perm2), permclear);
-
-        /* Calculate a sum of abs differences vector */
-        t3 = vec_max(t1, t2);
-        t4 = vec_min(t1, t2);
-        t5 = vec_sub(t3, t4);
-
-        /* Add each 4 pixel group together and put 4 results into sad */
-        sad = vec_sum4s(t5, sad);
-
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-
-    /* Sum up the four partial sums, and put the result into s */
-    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
-    sumdiffs = vec_splat(sumdiffs, 3);
-    vec_ste(sumdiffs, 0, &s);
-
-    return s;
-}
-
-static int pix_norm1_altivec(uint8_t *pix, int line_size)
-{
-    int i;
-    int s;
-    const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
-    vector unsigned char *tv;
-    vector unsigned char pixv;
-    vector unsigned int sv;
-    vector signed int sum;
-
-    sv = (vector unsigned int)vec_splat_u32(0);
-
-    s = 0;
-    for (i = 0; i < 16; i++) {
-        /* Read in the potentially unaligned pixels */
-        tv = (vector unsigned char *) pix;
-        pixv = vec_perm(tv[0], tv[1], vec_lvsl(0, pix));
-
-        /* Square the values, and add them to our sum */
-        sv = vec_msum(pixv, pixv, sv);
-
-        pix += line_size;
-    }
-    /* Sum up the four partial sums, and put the result into s */
-    sum = vec_sums((vector signed int) sv, (vector signed int) zero);
-    sum = vec_splat(sum, 3);
-    vec_ste(sum, 0, &s);
-
-    return s;
-}
-
-/**
- * Sum of Squared Errors for a 8x8 block.
- * AltiVec-enhanced.
- * It's the sad8_altivec code above w/ squaring added.
- */
-static int sse8_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int i;
-    int s;
-    const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
-    vector unsigned char perm1, perm2, permclear, *pix1v, *pix2v;
-    vector unsigned char t1, t2, t3,t4, t5;
-    vector unsigned int sum;
-    vector signed int sumsqr;
-
-    sum = (vector unsigned int)vec_splat_u32(0);
-
-    permclear = (vector unsigned char){255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0};
-
-
-    for (i = 0; i < h; i++) {
-        /* Read potentially unaligned pixels into t1 and t2
-           Since we're reading 16 pixels, and actually only want 8,
-           mask out the last 8 pixels. The 0s don't change the sum. */
-        perm1 = vec_lvsl(0, pix1);
-        pix1v = (vector unsigned char *) pix1;
-        perm2 = vec_lvsl(0, pix2);
-        pix2v = (vector unsigned char *) pix2;
-        t1 = vec_and(vec_perm(pix1v[0], pix1v[1], perm1), permclear);
-        t2 = vec_and(vec_perm(pix2v[0], pix2v[1], perm2), permclear);
-
-        /* Since we want to use unsigned chars, we can take advantage
-           of the fact that abs(a-b)^2 = (a-b)^2. */
-
-        /* Calculate abs differences vector */
-        t3 = vec_max(t1, t2);
-        t4 = vec_min(t1, t2);
-        t5 = vec_sub(t3, t4);
-
-        /* Square the values and add them to our sum */
-        sum = vec_msum(t5, t5, sum);
-
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-
-    /* Sum up the four partial sums, and put the result into s */
-    sumsqr = vec_sums((vector signed int) sum, (vector signed int) zero);
-    sumsqr = vec_splat(sumsqr, 3);
-    vec_ste(sumsqr, 0, &s);
-
-    return s;
-}
-
-/**
- * Sum of Squared Errors for a 16x16 block.
- * AltiVec-enhanced.
- * It's the sad16_altivec code above w/ squaring added.
- */
-static int sse16_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
-{
-    int i;
-    int s;
-    const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
-    vector unsigned char perm1, perm2, *pix1v, *pix2v;
-    vector unsigned char t1, t2, t3,t4, t5;
-    vector unsigned int sum;
-    vector signed int sumsqr;
-
-    sum = (vector unsigned int)vec_splat_u32(0);
-
-    for (i = 0; i < h; i++) {
-        /* Read potentially unaligned pixels into t1 and t2 */
-        perm1 = vec_lvsl(0, pix1);
-        pix1v = (vector unsigned char *) pix1;
-        perm2 = vec_lvsl(0, pix2);
-        pix2v = (vector unsigned char *) pix2;
-        t1 = vec_perm(pix1v[0], pix1v[1], perm1);
-        t2 = vec_perm(pix2v[0], pix2v[1], perm2);
-
-        /* Since we want to use unsigned chars, we can take advantage
-           of the fact that abs(a-b)^2 = (a-b)^2. */
-
-        /* Calculate abs differences vector */
-        t3 = vec_max(t1, t2);
-        t4 = vec_min(t1, t2);
-        t5 = vec_sub(t3, t4);
-
-        /* Square the values and add them to our sum */
-        sum = vec_msum(t5, t5, sum);
-
-        pix1 += line_size;
-        pix2 += line_size;
-    }
-
-    /* Sum up the four partial sums, and put the result into s */
-    sumsqr = vec_sums((vector signed int) sum, (vector signed int) zero);
-    sumsqr = vec_splat(sumsqr, 3);
-    vec_ste(sumsqr, 0, &s);
-
-    return s;
-}
-
-static int pix_sum_altivec(uint8_t * pix, int line_size)
-{
-    const vector unsigned int zero = (const vector unsigned int)vec_splat_u32(0);
-    vector unsigned char perm, *pixv;
-    vector unsigned char t1;
-    vector unsigned int sad;
-    vector signed int sumdiffs;
-
-    int i;
-    int s;
-
-    sad = (vector unsigned int)vec_splat_u32(0);
-
-    for (i = 0; i < 16; i++) {
-        /* Read the potentially unaligned 16 pixels into t1 */
-        perm = vec_lvsl(0, pix);
-        pixv = (vector unsigned char *) pix;
-        t1 = vec_perm(pixv[0], pixv[1], perm);
-
-        /* Add each 4 pixel group together and put 4 results into sad */
-        sad = vec_sum4s(t1, sad);
-
-        pix += line_size;
-    }
-
-    /* Sum up the four partial sums, and put the result into s */
-    sumdiffs = vec_sums((vector signed int) sad, (vector signed int) zero);
-    sumdiffs = vec_splat(sumdiffs, 3);
-    vec_ste(sumdiffs, 0, &s);
-
-    return s;
-}
-
-static void get_pixels_altivec(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
-{
-    int i;
-    vector unsigned char perm, bytes, *pixv;
-    const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
-    vector signed short shorts;
-
-    for (i = 0; i < 8; i++) {
-        // Read potentially unaligned pixels.
-        // We're reading 16 pixels, and actually only want 8,
-        // but we simply ignore the extras.
-        perm = vec_lvsl(0, pixels);
-        pixv = (vector unsigned char *) pixels;
-        bytes = vec_perm(pixv[0], pixv[1], perm);
-
-        // convert the bytes into shorts
-        shorts = (vector signed short)vec_mergeh(zero, bytes);
-
-        // save the data to the block, we assume the block is 16-byte aligned
-        vec_st(shorts, i*16, (vector signed short*)block);
-
-        pixels += line_size;
-    }
-}
-
-static void diff_pixels_altivec(DCTELEM *restrict block, const uint8_t *s1,
-        const uint8_t *s2, int stride)
-{
-    int i;
-    vector unsigned char perm, bytes, *pixv;
-    const vector unsigned char zero = (const vector unsigned char)vec_splat_u8(0);
-    vector signed short shorts1, shorts2;
-
-    for (i = 0; i < 4; i++) {
-        // Read potentially unaligned pixels
-        // We're reading 16 pixels, and actually only want 8,
-        // but we simply ignore the extras.
-        perm = vec_lvsl(0, s1);
-        pixv = (vector unsigned char *) s1;
-        bytes = vec_perm(pixv[0], pixv[1], perm);
-
-        // convert the bytes into shorts
-        shorts1 = (vector signed short)vec_mergeh(zero, bytes);
-
-        // Do the same for the second block of pixels
-        perm = vec_lvsl(0, s2);
-        pixv = (vector unsigned char *) s2;
-        bytes = vec_perm(pixv[0], pixv[1], perm);
-
-        // convert the bytes into shorts
-        shorts2 = (vector signed short)vec_mergeh(zero, bytes);
-
-        // Do the subtraction
-        shorts1 = vec_sub(shorts1, shorts2);
-
-        // save the data to the block, we assume the block is 16-byte aligned
-        vec_st(shorts1, 0, (vector signed short*)block);
-
-        s1 += stride;
-        s2 += stride;
-        block += 8;
-
-
-        // The code below is a copy of the code above... This is a manual
-        // unroll.
-
-        // Read potentially unaligned pixels
-        // We're reading 16 pixels, and actually only want 8,
-        // but we simply ignore the extras.
-        perm = vec_lvsl(0, s1);
-        pixv = (vector unsigned char *) s1;
-        bytes = vec_perm(pixv[0], pixv[1], perm);
-
-        // convert the bytes into shorts
-        shorts1 = (vector signed short)vec_mergeh(zero, bytes);
-
-        // Do the same for the second block of pixels
-        perm = vec_lvsl(0, s2);
-        pixv = (vector unsigned char *) s2;
-        bytes = vec_perm(pixv[0], pixv[1], perm);
-
-        // convert the bytes into shorts
-        shorts2 = (vector signed short)vec_mergeh(zero, bytes);
-
-        // Do the subtraction
-        shorts1 = vec_sub(shorts1, shorts2);
-
-        // save the data to the block, we assume the block is 16-byte aligned
-        vec_st(shorts1, 0, (vector signed short*)block);
-
-        s1 += stride;
-        s2 += stride;
-        block += 8;
-    }
-}
-
-
-static void clear_block_altivec(DCTELEM *block) {
-    LOAD_ZERO;
-    vec_st(zero_s16v,   0, block);
-    vec_st(zero_s16v,  16, block);
-    vec_st(zero_s16v,  32, block);
-    vec_st(zero_s16v,  48, block);
-    vec_st(zero_s16v,  64, block);
-    vec_st(zero_s16v,  80, block);
-    vec_st(zero_s16v,  96, block);
-    vec_st(zero_s16v, 112, block);
-}
-
-
-static void add_bytes_altivec(uint8_t *dst, uint8_t *src, int w) {
-    register int i;
-    register vector unsigned char vdst, vsrc;
-
-    /* dst and src are 16 bytes-aligned (guaranteed) */
-    for (i = 0 ; (i + 15) < w ; i+=16) {
-        vdst = vec_ld(i, (unsigned char*)dst);
-        vsrc = vec_ld(i, (unsigned char*)src);
-        vdst = vec_add(vsrc, vdst);
-        vec_st(vdst, i, (unsigned char*)dst);
-    }
-    /* if w is not a multiple of 16 */
-    for (; (i < w) ; i++) {
-        dst[i] = src[i];
-    }
-}
-
-/* next one assumes that ((line_size % 16) == 0) */
-void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_put_pixels16_num, 1);
-    register vector unsigned char pixelsv1, pixelsv2;
-    register vector unsigned char pixelsv1B, pixelsv2B;
-    register vector unsigned char pixelsv1C, pixelsv2C;
-    register vector unsigned char pixelsv1D, pixelsv2D;
-
-    register vector unsigned char perm = vec_lvsl(0, pixels);
-    int i;
-    register int line_size_2 = line_size << 1;
-    register int line_size_3 = line_size + line_size_2;
-    register int line_size_4 = line_size << 2;
-
-POWERPC_PERF_START_COUNT(altivec_put_pixels16_num, 1);
-// hand-unrolling the loop by 4 gains about 15%
-// mininum execution time goes from 74 to 60 cycles
-// it's faster than -funroll-loops, but using
-// -funroll-loops w/ this is bad - 74 cycles again.
-// all this is on a 7450, tuning for the 7450
-#if 0
-    for (i = 0; i < h; i++) {
-        pixelsv1 = vec_ld(0, pixels);
-        pixelsv2 = vec_ld(16, pixels);
-        vec_st(vec_perm(pixelsv1, pixelsv2, perm),
-               0, block);
-        pixels+=line_size;
-        block +=line_size;
-    }
-#else
-    for (i = 0; i < h; i += 4) {
-        pixelsv1  = vec_ld( 0, pixels);
-        pixelsv2  = vec_ld(15, pixels);
-        pixelsv1B = vec_ld(line_size, pixels);
-        pixelsv2B = vec_ld(15 + line_size, pixels);
-        pixelsv1C = vec_ld(line_size_2, pixels);
-        pixelsv2C = vec_ld(15 + line_size_2, pixels);
-        pixelsv1D = vec_ld(line_size_3, pixels);
-        pixelsv2D = vec_ld(15 + line_size_3, pixels);
-        vec_st(vec_perm(pixelsv1, pixelsv2, perm),
-               0, (unsigned char*)block);
-        vec_st(vec_perm(pixelsv1B, pixelsv2B, perm),
-               line_size, (unsigned char*)block);
-        vec_st(vec_perm(pixelsv1C, pixelsv2C, perm),
-               line_size_2, (unsigned char*)block);
-        vec_st(vec_perm(pixelsv1D, pixelsv2D, perm),
-               line_size_3, (unsigned char*)block);
-        pixels+=line_size_4;
-        block +=line_size_4;
-    }
-#endif
-POWERPC_PERF_STOP_COUNT(altivec_put_pixels16_num, 1);
-}
-
-/* next one assumes that ((line_size % 16) == 0) */
-#define op_avg(a,b)  a = ( ((a)|(b)) - ((((a)^(b))&0xFEFEFEFEUL)>>1) )
-void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_avg_pixels16_num, 1);
-    register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;
-    register vector unsigned char perm = vec_lvsl(0, pixels);
-    int i;
-
-POWERPC_PERF_START_COUNT(altivec_avg_pixels16_num, 1);
-
-    for (i = 0; i < h; i++) {
-        pixelsv1 = vec_ld( 0, pixels);
-        pixelsv2 = vec_ld(16,pixels);
-        blockv = vec_ld(0, block);
-        pixelsv = vec_perm(pixelsv1, pixelsv2, perm);
-        blockv = vec_avg(blockv,pixelsv);
-        vec_st(blockv, 0, (unsigned char*)block);
-        pixels+=line_size;
-        block +=line_size;
-    }
-
-POWERPC_PERF_STOP_COUNT(altivec_avg_pixels16_num, 1);
-}
-
-/* next one assumes that ((line_size % 8) == 0) */
-static void avg_pixels8_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_avg_pixels8_num, 1);
-    register vector unsigned char pixelsv1, pixelsv2, pixelsv, blockv;
-    int i;
-
-POWERPC_PERF_START_COUNT(altivec_avg_pixels8_num, 1);
-
-   for (i = 0; i < h; i++) {
-       /* block is 8 bytes-aligned, so we're either in the
-          left block (16 bytes-aligned) or in the right block (not) */
-       int rightside = ((unsigned long)block & 0x0000000F);
-
-       blockv = vec_ld(0, block);
-       pixelsv1 = vec_ld( 0, pixels);
-       pixelsv2 = vec_ld(16, pixels);
-       pixelsv = vec_perm(pixelsv1, pixelsv2, vec_lvsl(0, pixels));
-
-       if (rightside) {
-           pixelsv = vec_perm(blockv, pixelsv, vcprm(0,1,s0,s1));
-       } else {
-           pixelsv = vec_perm(blockv, pixelsv, vcprm(s0,s1,2,3));
-       }
-
-       blockv = vec_avg(blockv, pixelsv);
-
-       vec_st(blockv, 0, block);
-
-       pixels += line_size;
-       block += line_size;
-   }
-
-POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_num, 1);
-}
-
-/* next one assumes that ((line_size % 8) == 0) */
-static void put_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_put_pixels8_xy2_num, 1);
-    register int i;
-    register vector unsigned char pixelsv1, pixelsv2, pixelsavg;
-    register vector unsigned char blockv, temp1, temp2;
-    register vector unsigned short pixelssum1, pixelssum2, temp3;
-    register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0);
-    register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);
-
-    temp1 = vec_ld(0, pixels);
-    temp2 = vec_ld(16, pixels);
-    pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));
-    if ((((unsigned long)pixels) & 0x0000000F) ==  0x0000000F) {
-        pixelsv2 = temp2;
-    } else {
-        pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels));
-    }
-    pixelsv1 = vec_mergeh(vczero, pixelsv1);
-    pixelsv2 = vec_mergeh(vczero, pixelsv2);
-    pixelssum1 = vec_add((vector unsigned short)pixelsv1,
-                         (vector unsigned short)pixelsv2);
-    pixelssum1 = vec_add(pixelssum1, vctwo);
-
-POWERPC_PERF_START_COUNT(altivec_put_pixels8_xy2_num, 1);
-    for (i = 0; i < h ; i++) {
-        int rightside = ((unsigned long)block & 0x0000000F);
-        blockv = vec_ld(0, block);
-
-        temp1 = vec_ld(line_size, pixels);
-        temp2 = vec_ld(line_size + 16, pixels);
-        pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels));
-        if (((((unsigned long)pixels) + line_size) & 0x0000000F) ==  0x0000000F) {
-            pixelsv2 = temp2;
-        } else {
-            pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels));
-        }
-
-        pixelsv1 = vec_mergeh(vczero, pixelsv1);
-        pixelsv2 = vec_mergeh(vczero, pixelsv2);
-        pixelssum2 = vec_add((vector unsigned short)pixelsv1,
-                             (vector unsigned short)pixelsv2);
-        temp3 = vec_add(pixelssum1, pixelssum2);
-        temp3 = vec_sra(temp3, vctwo);
-        pixelssum1 = vec_add(pixelssum2, vctwo);
-        pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero);
-
-        if (rightside) {
-            blockv = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1));
-        } else {
-            blockv = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3));
-        }
-
-        vec_st(blockv, 0, block);
-
-        block += line_size;
-        pixels += line_size;
-    }
-
-POWERPC_PERF_STOP_COUNT(altivec_put_pixels8_xy2_num, 1);
-}
-
-/* next one assumes that ((line_size % 8) == 0) */
-static void put_no_rnd_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels8_xy2_num, 1);
-    register int i;
-    register vector unsigned char pixelsv1, pixelsv2, pixelsavg;
-    register vector unsigned char blockv, temp1, temp2;
-    register vector unsigned short pixelssum1, pixelssum2, temp3;
-    register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0);
-    register const vector unsigned short vcone = (const vector unsigned short)vec_splat_u16(1);
-    register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);
-
-    temp1 = vec_ld(0, pixels);
-    temp2 = vec_ld(16, pixels);
-    pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));
-    if ((((unsigned long)pixels) & 0x0000000F) ==  0x0000000F) {
-        pixelsv2 = temp2;
-    } else {
-        pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels));
-    }
-    pixelsv1 = vec_mergeh(vczero, pixelsv1);
-    pixelsv2 = vec_mergeh(vczero, pixelsv2);
-    pixelssum1 = vec_add((vector unsigned short)pixelsv1,
-                         (vector unsigned short)pixelsv2);
-    pixelssum1 = vec_add(pixelssum1, vcone);
-
-POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);
-    for (i = 0; i < h ; i++) {
-        int rightside = ((unsigned long)block & 0x0000000F);
-        blockv = vec_ld(0, block);
-
-        temp1 = vec_ld(line_size, pixels);
-        temp2 = vec_ld(line_size + 16, pixels);
-        pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels));
-        if (((((unsigned long)pixels) + line_size) & 0x0000000F) ==  0x0000000F) {
-            pixelsv2 = temp2;
-        } else {
-            pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels));
-        }
-
-        pixelsv1 = vec_mergeh(vczero, pixelsv1);
-        pixelsv2 = vec_mergeh(vczero, pixelsv2);
-        pixelssum2 = vec_add((vector unsigned short)pixelsv1,
-                             (vector unsigned short)pixelsv2);
-        temp3 = vec_add(pixelssum1, pixelssum2);
-        temp3 = vec_sra(temp3, vctwo);
-        pixelssum1 = vec_add(pixelssum2, vcone);
-        pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero);
-
-        if (rightside) {
-            blockv = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1));
-        } else {
-            blockv = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3));
-        }
-
-        vec_st(blockv, 0, block);
-
-        block += line_size;
-        pixels += line_size;
-    }
-
-POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels8_xy2_num, 1);
-}
-
-/* next one assumes that ((line_size % 16) == 0) */
-static void put_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_put_pixels16_xy2_num, 1);
-    register int i;
-    register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4;
-    register vector unsigned char blockv, temp1, temp2;
-    register vector unsigned short temp3, temp4,
-        pixelssum1, pixelssum2, pixelssum3, pixelssum4;
-    register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0);
-    register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);
-
-POWERPC_PERF_START_COUNT(altivec_put_pixels16_xy2_num, 1);
-
-    temp1 = vec_ld(0, pixels);
-    temp2 = vec_ld(16, pixels);
-    pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));
-    if ((((unsigned long)pixels) & 0x0000000F) ==  0x0000000F) {
-        pixelsv2 = temp2;
-    } else {
-        pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels));
-    }
-    pixelsv3 = vec_mergel(vczero, pixelsv1);
-    pixelsv4 = vec_mergel(vczero, pixelsv2);
-    pixelsv1 = vec_mergeh(vczero, pixelsv1);
-    pixelsv2 = vec_mergeh(vczero, pixelsv2);
-    pixelssum3 = vec_add((vector unsigned short)pixelsv3,
-                         (vector unsigned short)pixelsv4);
-    pixelssum3 = vec_add(pixelssum3, vctwo);
-    pixelssum1 = vec_add((vector unsigned short)pixelsv1,
-                         (vector unsigned short)pixelsv2);
-    pixelssum1 = vec_add(pixelssum1, vctwo);
-
-    for (i = 0; i < h ; i++) {
-        blockv = vec_ld(0, block);
-
-        temp1 = vec_ld(line_size, pixels);
-        temp2 = vec_ld(line_size + 16, pixels);
-        pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels));
-        if (((((unsigned long)pixels) + line_size) & 0x0000000F) ==  0x0000000F) {
-            pixelsv2 = temp2;
-        } else {
-            pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels));
-        }
-
-        pixelsv3 = vec_mergel(vczero, pixelsv1);
-        pixelsv4 = vec_mergel(vczero, pixelsv2);
-        pixelsv1 = vec_mergeh(vczero, pixelsv1);
-        pixelsv2 = vec_mergeh(vczero, pixelsv2);
-
-        pixelssum4 = vec_add((vector unsigned short)pixelsv3,
-                             (vector unsigned short)pixelsv4);
-        pixelssum2 = vec_add((vector unsigned short)pixelsv1,
-                             (vector unsigned short)pixelsv2);
-        temp4 = vec_add(pixelssum3, pixelssum4);
-        temp4 = vec_sra(temp4, vctwo);
-        temp3 = vec_add(pixelssum1, pixelssum2);
-        temp3 = vec_sra(temp3, vctwo);
-
-        pixelssum3 = vec_add(pixelssum4, vctwo);
-        pixelssum1 = vec_add(pixelssum2, vctwo);
-
-        blockv = vec_packsu(temp3, temp4);
-
-        vec_st(blockv, 0, block);
-
-        block += line_size;
-        pixels += line_size;
-    }
-
-POWERPC_PERF_STOP_COUNT(altivec_put_pixels16_xy2_num, 1);
-}
-
-/* next one assumes that ((line_size % 16) == 0) */
-static void put_no_rnd_pixels16_xy2_altivec(uint8_t * block, const uint8_t * pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_put_no_rnd_pixels16_xy2_num, 1);
-    register int i;
-    register vector unsigned char pixelsv1, pixelsv2, pixelsv3, pixelsv4;
-    register vector unsigned char blockv, temp1, temp2;
-    register vector unsigned short temp3, temp4,
-        pixelssum1, pixelssum2, pixelssum3, pixelssum4;
-    register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0);
-    register const vector unsigned short vcone = (const vector unsigned short)vec_splat_u16(1);
-    register const vector unsigned short vctwo = (const vector unsigned short)vec_splat_u16(2);
-
-POWERPC_PERF_START_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1);
-
-    temp1 = vec_ld(0, pixels);
-    temp2 = vec_ld(16, pixels);
-    pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));
-    if ((((unsigned long)pixels) & 0x0000000F) ==  0x0000000F) {
-        pixelsv2 = temp2;
-    } else {
-        pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels));
-    }
-    pixelsv3 = vec_mergel(vczero, pixelsv1);
-    pixelsv4 = vec_mergel(vczero, pixelsv2);
-    pixelsv1 = vec_mergeh(vczero, pixelsv1);
-    pixelsv2 = vec_mergeh(vczero, pixelsv2);
-    pixelssum3 = vec_add((vector unsigned short)pixelsv3,
-                         (vector unsigned short)pixelsv4);
-    pixelssum3 = vec_add(pixelssum3, vcone);
-    pixelssum1 = vec_add((vector unsigned short)pixelsv1,
-                         (vector unsigned short)pixelsv2);
-    pixelssum1 = vec_add(pixelssum1, vcone);
-
-    for (i = 0; i < h ; i++) {
-        blockv = vec_ld(0, block);
-
-        temp1 = vec_ld(line_size, pixels);
-        temp2 = vec_ld(line_size + 16, pixels);
-        pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels));
-        if (((((unsigned long)pixels) + line_size) & 0x0000000F) ==  0x0000000F) {
-            pixelsv2 = temp2;
-        } else {
-            pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels));
-        }
-
-        pixelsv3 = vec_mergel(vczero, pixelsv1);
-        pixelsv4 = vec_mergel(vczero, pixelsv2);
-        pixelsv1 = vec_mergeh(vczero, pixelsv1);
-        pixelsv2 = vec_mergeh(vczero, pixelsv2);
-
-        pixelssum4 = vec_add((vector unsigned short)pixelsv3,
-                             (vector unsigned short)pixelsv4);
-        pixelssum2 = vec_add((vector unsigned short)pixelsv1,
-                             (vector unsigned short)pixelsv2);
-        temp4 = vec_add(pixelssum3, pixelssum4);
-        temp4 = vec_sra(temp4, vctwo);
-        temp3 = vec_add(pixelssum1, pixelssum2);
-        temp3 = vec_sra(temp3, vctwo);
-
-        pixelssum3 = vec_add(pixelssum4, vcone);
-        pixelssum1 = vec_add(pixelssum2, vcone);
-
-        blockv = vec_packsu(temp3, temp4);
-
-        vec_st(blockv, 0, block);
-
-        block += line_size;
-        pixels += line_size;
-    }
-
-POWERPC_PERF_STOP_COUNT(altivec_put_no_rnd_pixels16_xy2_num, 1);
-}
-
-static int hadamard8_diff8x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){
-POWERPC_PERF_DECLARE(altivec_hadamard8_diff8x8_num, 1);
-    int sum;
-    register const vector unsigned char vzero =
-                            (const vector unsigned char)vec_splat_u8(0);
-    register vector signed short temp0, temp1, temp2, temp3, temp4,
-                                 temp5, temp6, temp7;
-POWERPC_PERF_START_COUNT(altivec_hadamard8_diff8x8_num, 1);
-    {
-    register const vector signed short vprod1 =(const vector signed short)
-                                               { 1,-1, 1,-1, 1,-1, 1,-1 };
-    register const vector signed short vprod2 =(const vector signed short)
-                                               { 1, 1,-1,-1, 1, 1,-1,-1 };
-    register const vector signed short vprod3 =(const vector signed short)
-                                               { 1, 1, 1, 1,-1,-1,-1,-1 };
-    register const vector unsigned char perm1 = (const vector unsigned char)
-        {0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
-         0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D};
-    register const vector unsigned char perm2 = (const vector unsigned char)
-        {0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
-         0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B};
-    register const vector unsigned char perm3 = (const vector unsigned char)
-        {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
-
-#define ONEITERBUTTERFLY(i, res)                                          \
-    {                                                                     \
-    register vector unsigned char src1, src2, srcO;                   \
-    register vector unsigned char dst1, dst2, dstO;                   \
-    register vector signed short srcV, dstV;                          \
-    register vector signed short but0, but1, but2, op1, op2, op3;     \
-    src1 = vec_ld(stride * i, src);                                   \
-    src2 = vec_ld((stride * i) + 15, src);                            \
-    srcO = vec_perm(src1, src2, vec_lvsl(stride * i, src));           \
-    dst1 = vec_ld(stride * i, dst);                                   \
-    dst2 = vec_ld((stride * i) + 15, dst);                            \
-    dstO = vec_perm(dst1, dst2, vec_lvsl(stride * i, dst));           \
-    /* promote the unsigned chars to signed shorts */                 \
-    /* we're in the 8x8 function, we only care for the first 8 */     \
-    srcV = (vector signed short)vec_mergeh((vector signed char)vzero, \
-           (vector signed char)srcO);                                 \
-    dstV = (vector signed short)vec_mergeh((vector signed char)vzero, \
-           (vector signed char)dstO);                                 \
-    /* subtractions inside the first butterfly */                     \
-    but0 = vec_sub(srcV, dstV);                                       \
-    op1  = vec_perm(but0, but0, perm1);                               \
-    but1 = vec_mladd(but0, vprod1, op1);                              \
-    op2  = vec_perm(but1, but1, perm2);                               \
-    but2 = vec_mladd(but1, vprod2, op2);                              \
-    op3  = vec_perm(but2, but2, perm3);                               \
-    res  = vec_mladd(but2, vprod3, op3);                              \
-    }
-    ONEITERBUTTERFLY(0, temp0);
-    ONEITERBUTTERFLY(1, temp1);
-    ONEITERBUTTERFLY(2, temp2);
-    ONEITERBUTTERFLY(3, temp3);
-    ONEITERBUTTERFLY(4, temp4);
-    ONEITERBUTTERFLY(5, temp5);
-    ONEITERBUTTERFLY(6, temp6);
-    ONEITERBUTTERFLY(7, temp7);
-    }
-#undef ONEITERBUTTERFLY
-    {
-    register vector signed int vsum;
-    register vector signed short line0 = vec_add(temp0, temp1);
-    register vector signed short line1 = vec_sub(temp0, temp1);
-    register vector signed short line2 = vec_add(temp2, temp3);
-    register vector signed short line3 = vec_sub(temp2, temp3);
-    register vector signed short line4 = vec_add(temp4, temp5);
-    register vector signed short line5 = vec_sub(temp4, temp5);
-    register vector signed short line6 = vec_add(temp6, temp7);
-    register vector signed short line7 = vec_sub(temp6, temp7);
-
-    register vector signed short line0B = vec_add(line0, line2);
-    register vector signed short line2B = vec_sub(line0, line2);
-    register vector signed short line1B = vec_add(line1, line3);
-    register vector signed short line3B = vec_sub(line1, line3);
-    register vector signed short line4B = vec_add(line4, line6);
-    register vector signed short line6B = vec_sub(line4, line6);
-    register vector signed short line5B = vec_add(line5, line7);
-    register vector signed short line7B = vec_sub(line5, line7);
-
-    register vector signed short line0C = vec_add(line0B, line4B);
-    register vector signed short line4C = vec_sub(line0B, line4B);
-    register vector signed short line1C = vec_add(line1B, line5B);
-    register vector signed short line5C = vec_sub(line1B, line5B);
-    register vector signed short line2C = vec_add(line2B, line6B);
-    register vector signed short line6C = vec_sub(line2B, line6B);
-    register vector signed short line3C = vec_add(line3B, line7B);
-    register vector signed short line7C = vec_sub(line3B, line7B);
-
-    vsum = vec_sum4s(vec_abs(line0C), vec_splat_s32(0));
-    vsum = vec_sum4s(vec_abs(line1C), vsum);
-    vsum = vec_sum4s(vec_abs(line2C), vsum);
-    vsum = vec_sum4s(vec_abs(line3C), vsum);
-    vsum = vec_sum4s(vec_abs(line4C), vsum);
-    vsum = vec_sum4s(vec_abs(line5C), vsum);
-    vsum = vec_sum4s(vec_abs(line6C), vsum);
-    vsum = vec_sum4s(vec_abs(line7C), vsum);
-    vsum = vec_sums(vsum, (vector signed int)vzero);
-    vsum = vec_splat(vsum, 3);
-    vec_ste(vsum, 0, &sum);
-    }
-POWERPC_PERF_STOP_COUNT(altivec_hadamard8_diff8x8_num, 1);
-    return sum;
-}
-
-/*
-16x8 works with 16 elements; it allows to avoid replicating loads, and
-give the compiler more rooms for scheduling.  It's only used from
-inside hadamard8_diff16_altivec.
-
-Unfortunately, it seems gcc-3.3 is a bit dumb, and the compiled code has a LOT
-of spill code, it seems gcc (unlike xlc) cannot keep everything in registers
-by itself. The following code include hand-made registers allocation. It's not
-clean, but on a 7450 the resulting code is much faster (best case fall from
-700+ cycles to 550).
-
-xlc doesn't add spill code, but it doesn't know how to schedule for the 7450,
-and its code isn't much faster than gcc-3.3 on the 7450 (but uses 25% less
-instructions...)
-
-On the 970, the hand-made RA is still a win (around 690 vs. around 780), but
-xlc goes to around 660 on the regular C code...
-*/
-
-static int hadamard8_diff16x8_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h) {
-    int sum;
-    register vector signed short
-        temp0 __asm__ ("v0"),
-        temp1 __asm__ ("v1"),
-        temp2 __asm__ ("v2"),
-        temp3 __asm__ ("v3"),
-        temp4 __asm__ ("v4"),
-        temp5 __asm__ ("v5"),
-        temp6 __asm__ ("v6"),
-        temp7 __asm__ ("v7");
-    register vector signed short
-        temp0S __asm__ ("v8"),
-        temp1S __asm__ ("v9"),
-        temp2S __asm__ ("v10"),
-        temp3S __asm__ ("v11"),
-        temp4S __asm__ ("v12"),
-        temp5S __asm__ ("v13"),
-        temp6S __asm__ ("v14"),
-        temp7S __asm__ ("v15");
-    register const vector unsigned char vzero __asm__ ("v31") =
-        (const vector unsigned char)vec_splat_u8(0);
-    {
-    register const vector signed short vprod1 __asm__ ("v16") =
-        (const vector signed short){ 1,-1, 1,-1, 1,-1, 1,-1 };
-    register const vector signed short vprod2 __asm__ ("v17") =
-        (const vector signed short){ 1, 1,-1,-1, 1, 1,-1,-1 };
-    register const vector signed short vprod3 __asm__ ("v18") =
-        (const vector signed short){ 1, 1, 1, 1,-1,-1,-1,-1 };
-    register const vector unsigned char perm1 __asm__ ("v19") =
-        (const vector unsigned char)
-        {0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05,
-         0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D};
-    register const vector unsigned char perm2 __asm__ ("v20") =
-        (const vector unsigned char)
-        {0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03,
-         0x0C, 0x0D, 0x0E, 0x0F, 0x08, 0x09, 0x0A, 0x0B};
-    register const vector unsigned char perm3 __asm__ ("v21") =
-        (const vector unsigned char)
-        {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-         0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
-
-#define ONEITERBUTTERFLY(i, res1, res2)                               \
-    {                                                                 \
-    register vector unsigned char src1 __asm__ ("v22"),               \
-                                  src2 __asm__ ("v23"),               \
-                                  dst1 __asm__ ("v24"),               \
-                                  dst2 __asm__ ("v25"),               \
-                                  srcO __asm__ ("v22"),               \
-                                  dstO __asm__ ("v23");               \
-                                                                      \
-    register vector signed short  srcV  __asm__ ("v24"),              \
-                                  dstV  __asm__ ("v25"),              \
-                                  srcW  __asm__ ("v26"),              \
-                                  dstW  __asm__ ("v27"),              \
-                                  but0  __asm__ ("v28"),              \
-                                  but0S __asm__ ("v29"),              \
-                                  op1   __asm__ ("v30"),              \
-                                  but1  __asm__ ("v22"),              \
-                                  op1S  __asm__ ("v23"),              \
-                                  but1S __asm__ ("v24"),              \
-                                  op2   __asm__ ("v25"),              \
-                                  but2  __asm__ ("v26"),              \
-                                  op2S  __asm__ ("v27"),              \
-                                  but2S __asm__ ("v28"),              \
-                                  op3   __asm__ ("v29"),              \
-                                  op3S  __asm__ ("v30");              \
-                                                                      \
-    src1 = vec_ld(stride * i, src);                                   \
-    src2 = vec_ld((stride * i) + 16, src);                            \
-    srcO = vec_perm(src1, src2, vec_lvsl(stride * i, src));           \
-    dst1 = vec_ld(stride * i, dst);                                   \
-    dst2 = vec_ld((stride * i) + 16, dst);                            \
-    dstO = vec_perm(dst1, dst2, vec_lvsl(stride * i, dst));           \
-    /* promote the unsigned chars to signed shorts */                 \
-    srcV = (vector signed short)vec_mergeh((vector signed char)vzero, \
-           (vector signed char)srcO);                                 \
-    dstV = (vector signed short)vec_mergeh((vector signed char)vzero, \
-           (vector signed char)dstO);                                 \
-    srcW = (vector signed short)vec_mergel((vector signed char)vzero, \
-           (vector signed char)srcO);                                 \
-    dstW = (vector signed short)vec_mergel((vector signed char)vzero, \
-           (vector signed char)dstO);                                 \
-    /* subtractions inside the first butterfly */                     \
-    but0 = vec_sub(srcV, dstV);                                       \
-    but0S = vec_sub(srcW, dstW);                                      \
-    op1 = vec_perm(but0, but0, perm1);                                \
-    but1 = vec_mladd(but0, vprod1, op1);                              \
-    op1S = vec_perm(but0S, but0S, perm1);                             \
-    but1S = vec_mladd(but0S, vprod1, op1S);                           \
-    op2 = vec_perm(but1, but1, perm2);                                \
-    but2 = vec_mladd(but1, vprod2, op2);                              \
-    op2S = vec_perm(but1S, but1S, perm2);                             \
-    but2S = vec_mladd(but1S, vprod2, op2S);                           \
-    op3 = vec_perm(but2, but2, perm3);                                \
-    res1 = vec_mladd(but2, vprod3, op3);                              \
-    op3S = vec_perm(but2S, but2S, perm3);                             \
-    res2 = vec_mladd(but2S, vprod3, op3S);                            \
-    }
-    ONEITERBUTTERFLY(0, temp0, temp0S);
-    ONEITERBUTTERFLY(1, temp1, temp1S);
-    ONEITERBUTTERFLY(2, temp2, temp2S);
-    ONEITERBUTTERFLY(3, temp3, temp3S);
-    ONEITERBUTTERFLY(4, temp4, temp4S);
-    ONEITERBUTTERFLY(5, temp5, temp5S);
-    ONEITERBUTTERFLY(6, temp6, temp6S);
-    ONEITERBUTTERFLY(7, temp7, temp7S);
-    }
-#undef ONEITERBUTTERFLY
-    {
-    register vector signed int vsum;
-    register vector signed short line0S, line1S, line2S, line3S, line4S,
-                                 line5S, line6S, line7S, line0BS,line2BS,
-                                 line1BS,line3BS,line4BS,line6BS,line5BS,
-                                 line7BS,line0CS,line4CS,line1CS,line5CS,
-                                 line2CS,line6CS,line3CS,line7CS;
-
-    register vector signed short line0 = vec_add(temp0, temp1);
-    register vector signed short line1 = vec_sub(temp0, temp1);
-    register vector signed short line2 = vec_add(temp2, temp3);
-    register vector signed short line3 = vec_sub(temp2, temp3);
-    register vector signed short line4 = vec_add(temp4, temp5);
-    register vector signed short line5 = vec_sub(temp4, temp5);
-    register vector signed short line6 = vec_add(temp6, temp7);
-    register vector signed short line7 = vec_sub(temp6, temp7);
-
-    register vector signed short line0B = vec_add(line0, line2);
-    register vector signed short line2B = vec_sub(line0, line2);
-    register vector signed short line1B = vec_add(line1, line3);
-    register vector signed short line3B = vec_sub(line1, line3);
-    register vector signed short line4B = vec_add(line4, line6);
-    register vector signed short line6B = vec_sub(line4, line6);
-    register vector signed short line5B = vec_add(line5, line7);
-    register vector signed short line7B = vec_sub(line5, line7);
-
-    register vector signed short line0C = vec_add(line0B, line4B);
-    register vector signed short line4C = vec_sub(line0B, line4B);
-    register vector signed short line1C = vec_add(line1B, line5B);
-    register vector signed short line5C = vec_sub(line1B, line5B);
-    register vector signed short line2C = vec_add(line2B, line6B);
-    register vector signed short line6C = vec_sub(line2B, line6B);
-    register vector signed short line3C = vec_add(line3B, line7B);
-    register vector signed short line7C = vec_sub(line3B, line7B);
-
-    vsum = vec_sum4s(vec_abs(line0C), vec_splat_s32(0));
-    vsum = vec_sum4s(vec_abs(line1C), vsum);
-    vsum = vec_sum4s(vec_abs(line2C), vsum);
-    vsum = vec_sum4s(vec_abs(line3C), vsum);
-    vsum = vec_sum4s(vec_abs(line4C), vsum);
-    vsum = vec_sum4s(vec_abs(line5C), vsum);
-    vsum = vec_sum4s(vec_abs(line6C), vsum);
-    vsum = vec_sum4s(vec_abs(line7C), vsum);
-
-    line0S = vec_add(temp0S, temp1S);
-    line1S = vec_sub(temp0S, temp1S);
-    line2S = vec_add(temp2S, temp3S);
-    line3S = vec_sub(temp2S, temp3S);
-    line4S = vec_add(temp4S, temp5S);
-    line5S = vec_sub(temp4S, temp5S);
-    line6S = vec_add(temp6S, temp7S);
-    line7S = vec_sub(temp6S, temp7S);
-
-    line0BS = vec_add(line0S, line2S);
-    line2BS = vec_sub(line0S, line2S);
-    line1BS = vec_add(line1S, line3S);
-    line3BS = vec_sub(line1S, line3S);
-    line4BS = vec_add(line4S, line6S);
-    line6BS = vec_sub(line4S, line6S);
-    line5BS = vec_add(line5S, line7S);
-    line7BS = vec_sub(line5S, line7S);
-
-    line0CS = vec_add(line0BS, line4BS);
-    line4CS = vec_sub(line0BS, line4BS);
-    line1CS = vec_add(line1BS, line5BS);
-    line5CS = vec_sub(line1BS, line5BS);
-    line2CS = vec_add(line2BS, line6BS);
-    line6CS = vec_sub(line2BS, line6BS);
-    line3CS = vec_add(line3BS, line7BS);
-    line7CS = vec_sub(line3BS, line7BS);
-
-    vsum = vec_sum4s(vec_abs(line0CS), vsum);
-    vsum = vec_sum4s(vec_abs(line1CS), vsum);
-    vsum = vec_sum4s(vec_abs(line2CS), vsum);
-    vsum = vec_sum4s(vec_abs(line3CS), vsum);
-    vsum = vec_sum4s(vec_abs(line4CS), vsum);
-    vsum = vec_sum4s(vec_abs(line5CS), vsum);
-    vsum = vec_sum4s(vec_abs(line6CS), vsum);
-    vsum = vec_sum4s(vec_abs(line7CS), vsum);
-    vsum = vec_sums(vsum, (vector signed int)vzero);
-    vsum = vec_splat(vsum, 3);
-    vec_ste(vsum, 0, &sum);
-    }
-    return sum;
-}
-
-static int hadamard8_diff16_altivec(/*MpegEncContext*/ void *s, uint8_t *dst, uint8_t *src, int stride, int h){
-POWERPC_PERF_DECLARE(altivec_hadamard8_diff16_num, 1);
-    int score;
-POWERPC_PERF_START_COUNT(altivec_hadamard8_diff16_num, 1);
-    score = hadamard8_diff16x8_altivec(s, dst, src, stride, 8);
-    if (h==16) {
-        dst += 8*stride;
-        src += 8*stride;
-        score += hadamard8_diff16x8_altivec(s, dst, src, stride, 8);
-    }
-POWERPC_PERF_STOP_COUNT(altivec_hadamard8_diff16_num, 1);
-    return score;
-}
-
-static void vorbis_inverse_coupling_altivec(float *mag, float *ang,
-                                            int blocksize)
-{
-    int i;
-    vector float m, a;
-    vector bool int t0, t1;
-    const vector unsigned int v_31 = //XXX
-        vec_add(vec_add(vec_splat_u32(15),vec_splat_u32(15)),vec_splat_u32(1));
-    for (i = 0; i < blocksize; i += 4) {
-        m = vec_ld(0, mag+i);
-        a = vec_ld(0, ang+i);
-        t0 = vec_cmple(m, (vector float)vec_splat_u32(0));
-        t1 = vec_cmple(a, (vector float)vec_splat_u32(0));
-        a = vec_xor(a, (vector float) vec_sl((vector unsigned int)t0, v_31));
-        t0 = (vector bool int)vec_and(a, t1);
-        t1 = (vector bool int)vec_andc(a, t1);
-        a = vec_sub(m, (vector float)t1);
-        m = vec_add(m, (vector float)t0);
-        vec_stl(a, 0, ang+i);
-        vec_stl(m, 0, mag+i);
-    }
-}
-
-/* next one assumes that ((line_size % 8) == 0) */
-static void avg_pixels8_xy2_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-POWERPC_PERF_DECLARE(altivec_avg_pixels8_xy2_num, 1);
-    register int i;
-    register vector unsigned char pixelsv1, pixelsv2, pixelsavg;
-    register vector unsigned char blockv, temp1, temp2, blocktemp;
-    register vector unsigned short pixelssum1, pixelssum2, temp3;
-
-    register const vector unsigned char vczero = (const vector unsigned char)
-                                        vec_splat_u8(0);
-    register const vector unsigned short vctwo = (const vector unsigned short)
-                                        vec_splat_u16(2);
-
-    temp1 = vec_ld(0, pixels);
-    temp2 = vec_ld(16, pixels);
-    pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(0, pixels));
-    if ((((unsigned long)pixels) & 0x0000000F) ==  0x0000000F) {
-        pixelsv2 = temp2;
-    } else {
-        pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(1, pixels));
-    }
-    pixelsv1 = vec_mergeh(vczero, pixelsv1);
-    pixelsv2 = vec_mergeh(vczero, pixelsv2);
-    pixelssum1 = vec_add((vector unsigned short)pixelsv1,
-                         (vector unsigned short)pixelsv2);
-    pixelssum1 = vec_add(pixelssum1, vctwo);
-
-POWERPC_PERF_START_COUNT(altivec_avg_pixels8_xy2_num, 1);
-    for (i = 0; i < h ; i++) {
-        int rightside = ((unsigned long)block & 0x0000000F);
-        blockv = vec_ld(0, block);
-
-        temp1 = vec_ld(line_size, pixels);
-        temp2 = vec_ld(line_size + 16, pixels);
-        pixelsv1 = vec_perm(temp1, temp2, vec_lvsl(line_size, pixels));
-        if (((((unsigned long)pixels) + line_size) & 0x0000000F) ==  0x0000000F) {
-            pixelsv2 = temp2;
-        } else {
-            pixelsv2 = vec_perm(temp1, temp2, vec_lvsl(line_size + 1, pixels));
-        }
-
-        pixelsv1 = vec_mergeh(vczero, pixelsv1);
-        pixelsv2 = vec_mergeh(vczero, pixelsv2);
-        pixelssum2 = vec_add((vector unsigned short)pixelsv1,
-                             (vector unsigned short)pixelsv2);
-        temp3 = vec_add(pixelssum1, pixelssum2);
-        temp3 = vec_sra(temp3, vctwo);
-        pixelssum1 = vec_add(pixelssum2, vctwo);
-        pixelsavg = vec_packsu(temp3, (vector unsigned short) vczero);
-
-        if (rightside) {
-            blocktemp = vec_perm(blockv, pixelsavg, vcprm(0, 1, s0, s1));
-        } else {
-            blocktemp = vec_perm(blockv, pixelsavg, vcprm(s0, s1, 2, 3));
-        }
-
-        blockv = vec_avg(blocktemp, blockv);
-        vec_st(blockv, 0, block);
-
-        block += line_size;
-        pixels += line_size;
-    }
-
-POWERPC_PERF_STOP_COUNT(altivec_avg_pixels8_xy2_num, 1);
-}
-
-void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx)
-{
-    c->pix_abs[0][1] = sad16_x2_altivec;
-    c->pix_abs[0][2] = sad16_y2_altivec;
-    c->pix_abs[0][3] = sad16_xy2_altivec;
-    c->pix_abs[0][0] = sad16_altivec;
-    c->pix_abs[1][0] = sad8_altivec;
-    c->sad[0]= sad16_altivec;
-    c->sad[1]= sad8_altivec;
-    c->pix_norm1 = pix_norm1_altivec;
-    c->sse[1]= sse8_altivec;
-    c->sse[0]= sse16_altivec;
-    c->pix_sum = pix_sum_altivec;
-    c->diff_pixels = diff_pixels_altivec;
-    c->get_pixels = get_pixels_altivec;
-    c->clear_block = clear_block_altivec;
-    c->add_bytes= add_bytes_altivec;
-    c->put_pixels_tab[0][0] = put_pixels16_altivec;
-    /* the two functions do the same thing, so use the same code */
-    c->put_no_rnd_pixels_tab[0][0] = put_pixels16_altivec;
-    c->avg_pixels_tab[0][0] = avg_pixels16_altivec;
-    c->avg_pixels_tab[1][0] = avg_pixels8_altivec;
-    c->avg_pixels_tab[1][3] = avg_pixels8_xy2_altivec;
-    c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec;
-    c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec;
-    c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec;
-    c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec;
-
-    c->hadamard8_diff[0] = hadamard8_diff16_altivec;
-    c->hadamard8_diff[1] = hadamard8_diff8x8_altivec;
-    if (CONFIG_VORBIS_DECODER)
-        c->vorbis_inverse_coupling = vorbis_inverse_coupling_altivec;
-}
diff --git a/libavcodec/ppc/dsputil_altivec.h b/libavcodec/ppc/dsputil_altivec.h
deleted file mode 100644
index 18f8dd8..0000000
--- a/libavcodec/ppc/dsputil_altivec.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2002 Brian Foley
- * Copyright (c) 2002 Dieter Shirley
- * Copyright (c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PPC_DSPUTIL_ALTIVEC_H
-#define AVCODEC_PPC_DSPUTIL_ALTIVEC_H
-
-#include <stdint.h>
-#include "libavcodec/dsputil.h"
-
-void put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-
-void avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, int line_size, int h);
-
-int has_altivec(void);
-
-void fdct_altivec(int16_t *block);
-void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
-                  int x16, int y16, int rounder);
-void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
-void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
-
-void ff_vp3_idct_altivec(DCTELEM *block);
-void ff_vp3_idct_put_altivec(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_altivec(uint8_t *dest, int line_size, DCTELEM *block);
-
-void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx);
-
-void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx);
-void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx);
-void float_init_altivec(DSPContext* c, AVCodecContext *avctx);
-void int_init_altivec(DSPContext* c, AVCodecContext *avctx);
-
-#endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */
diff --git a/libavcodec/ppc/dsputil_ppc.c b/libavcodec/ppc/dsputil_ppc.c
deleted file mode 100644
index cf0ac39..0000000
--- a/libavcodec/ppc/dsputil_ppc.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (c) 2002 Brian Foley
- * Copyright (c) 2002 Dieter Shirley
- * Copyright (c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-
-#include "dsputil_ppc.h"
-
-#include "dsputil_altivec.h"
-
-int mm_flags = 0;
-
-int mm_support(void)
-{
-    int result = 0;
-#if HAVE_ALTIVEC
-    if (has_altivec()) {
-        result |= FF_MM_ALTIVEC;
-    }
-#endif /* result */
-    return result;
-}
-
-#if CONFIG_POWERPC_PERF
-unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
-/* list below must match enum in dsputil_ppc.h */
-static unsigned char* perfname[] = {
-    "ff_fft_calc_altivec",
-    "gmc1_altivec",
-    "dct_unquantize_h263_altivec",
-    "fdct_altivec",
-    "idct_add_altivec",
-    "idct_put_altivec",
-    "put_pixels16_altivec",
-    "avg_pixels16_altivec",
-    "avg_pixels8_altivec",
-    "put_pixels8_xy2_altivec",
-    "put_no_rnd_pixels8_xy2_altivec",
-    "put_pixels16_xy2_altivec",
-    "put_no_rnd_pixels16_xy2_altivec",
-    "hadamard8_diff8x8_altivec",
-    "hadamard8_diff16_altivec",
-    "avg_pixels8_xy2_altivec",
-    "clear_blocks_dcbz32_ppc",
-    "clear_blocks_dcbz128_ppc",
-    "put_h264_chroma_mc8_altivec",
-    "avg_h264_chroma_mc8_altivec",
-    "put_h264_qpel16_h_lowpass_altivec",
-    "avg_h264_qpel16_h_lowpass_altivec",
-    "put_h264_qpel16_v_lowpass_altivec",
-    "avg_h264_qpel16_v_lowpass_altivec",
-    "put_h264_qpel16_hv_lowpass_altivec",
-    "avg_h264_qpel16_hv_lowpass_altivec",
-    ""
-};
-#include <stdio.h>
-#endif
-
-#if CONFIG_POWERPC_PERF
-void powerpc_display_perf_report(void)
-{
-    int i, j;
-    av_log(NULL, AV_LOG_INFO, "PowerPC performance report\n Values are from the PMC registers, and represent whatever the registers are set to record.\n");
-    for(i = 0 ; i < powerpc_perf_total ; i++) {
-        for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) {
-            if (perfdata[j][i][powerpc_data_num] != (unsigned long long)0)
-                av_log(NULL, AV_LOG_INFO,
-                       " Function \"%s\" (pmc%d):\n\tmin: %"PRIu64"\n\tmax: %"PRIu64"\n\tavg: %1.2lf (%"PRIu64")\n",
-                       perfname[i],
-                       j+1,
-                       perfdata[j][i][powerpc_data_min],
-                       perfdata[j][i][powerpc_data_max],
-                       (double)perfdata[j][i][powerpc_data_sum] /
-                       (double)perfdata[j][i][powerpc_data_num],
-                       perfdata[j][i][powerpc_data_num]);
-        }
-    }
-}
-#endif /* CONFIG_POWERPC_PERF */
-
-/* ***** WARNING ***** WARNING ***** WARNING ***** */
-/*
-clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a
-cache line size not equal to 32 bytes.
-Fortunately all processor used by Apple up to at least the 7450 (aka second
-generation G4) use 32 bytes cache line.
-This is due to the use of the 'dcbz' instruction. It simply clear to zero a
-single cache line, so you need to know the cache line size to use it !
-It's absurd, but it's fast...
-
-update 24/06/2003 : Apple released yesterday the G5, with a PPC970. cache line
-size: 128 bytes. Oups.
-The semantic of dcbz was changed, it always clear 32 bytes. so the function
-below will work, but will be slow. So I fixed check_dcbz_effect to use dcbzl,
-which is defined to clear a cache line (as dcbz before). So we still can
-distinguish, and use dcbz (32 bytes) or dcbzl (one cache line) as required.
-
-see <http://developer.apple.com/technotes/tn/tn2087.html>
-and <http://developer.apple.com/technotes/tn/tn2086.html>
-*/
-static void clear_blocks_dcbz32_ppc(DCTELEM *blocks)
-{
-POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz32, 1);
-    register int misal = ((unsigned long)blocks & 0x00000010);
-    register int i = 0;
-POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz32, 1);
-#if 1
-    if (misal) {
-        ((unsigned long*)blocks)[0] = 0L;
-        ((unsigned long*)blocks)[1] = 0L;
-        ((unsigned long*)blocks)[2] = 0L;
-        ((unsigned long*)blocks)[3] = 0L;
-        i += 16;
-    }
-    for ( ; i < sizeof(DCTELEM)*6*64-31 ; i += 32) {
-        __asm__ volatile("dcbz %0,%1" : : "b" (blocks), "r" (i) : "memory");
-    }
-    if (misal) {
-        ((unsigned long*)blocks)[188] = 0L;
-        ((unsigned long*)blocks)[189] = 0L;
-        ((unsigned long*)blocks)[190] = 0L;
-        ((unsigned long*)blocks)[191] = 0L;
-        i += 16;
-    }
-#else
-    memset(blocks, 0, sizeof(DCTELEM)*6*64);
-#endif
-POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1);
-}
-
-/* same as above, when dcbzl clear a whole 128B cache line
-   i.e. the PPC970 aka G5 */
-#if HAVE_DCBZL
-static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
-{
-POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz128, 1);
-    register int misal = ((unsigned long)blocks & 0x0000007f);
-    register int i = 0;
-POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz128, 1);
-#if 1
-    if (misal) {
-        // we could probably also optimize this case,
-        // but there's not much point as the machines
-        // aren't available yet (2003-06-26)
-        memset(blocks, 0, sizeof(DCTELEM)*6*64);
-    }
-    else
-        for ( ; i < sizeof(DCTELEM)*6*64 ; i += 128) {
-            __asm__ volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory");
-        }
-#else
-    memset(blocks, 0, sizeof(DCTELEM)*6*64);
-#endif
-POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz128, 1);
-}
-#else
-static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
-{
-    memset(blocks, 0, sizeof(DCTELEM)*6*64);
-}
-#endif
-
-#if HAVE_DCBZL
-/* check dcbz report how many bytes are set to 0 by dcbz */
-/* update 24/06/2003 : replace dcbz by dcbzl to get
-   the intended effect (Apple "fixed" dcbz)
-   unfortunately this cannot be used unless the assembler
-   knows about dcbzl ... */
-static long check_dcbzl_effect(void)
-{
-    register char *fakedata = av_malloc(1024);
-    register char *fakedata_middle;
-    register long zero = 0;
-    register long i = 0;
-    long count = 0;
-
-    if (!fakedata) {
-        return 0L;
-    }
-
-    fakedata_middle = (fakedata + 512);
-
-    memset(fakedata, 0xFF, 1024);
-
-    /* below the constraint "b" seems to mean "Address base register"
-       in gcc-3.3 / RS/6000 speaks. seems to avoid using r0, so.... */
-    __asm__ volatile("dcbzl %0, %1" : : "b" (fakedata_middle), "r" (zero));
-
-    for (i = 0; i < 1024 ; i ++) {
-        if (fakedata[i] == (char)0)
-            count++;
-    }
-
-    av_free(fakedata);
-
-    return count;
-}
-#else
-static long check_dcbzl_effect(void)
-{
-  return 0;
-}
-#endif
-
-static void prefetch_ppc(void *mem, int stride, int h)
-{
-    register const uint8_t *p = mem;
-    do {
-        __asm__ volatile ("dcbt 0,%0" : : "r" (p));
-        p+= stride;
-    } while(--h);
-}
-
-void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
-{
-    // Common optimizations whether AltiVec is available or not
-    c->prefetch = prefetch_ppc;
-    switch (check_dcbzl_effect()) {
-        case 32:
-            c->clear_blocks = clear_blocks_dcbz32_ppc;
-            break;
-        case 128:
-            c->clear_blocks = clear_blocks_dcbz128_ppc;
-            break;
-        default:
-            break;
-    }
-
-#if HAVE_ALTIVEC
-    if(CONFIG_H264_DECODER) dsputil_h264_init_ppc(c, avctx);
-
-    if (has_altivec()) {
-        mm_flags |= FF_MM_ALTIVEC;
-
-        dsputil_init_altivec(c, avctx);
-        if(CONFIG_VC1_DECODER)
-            vc1dsp_init_altivec(c, avctx);
-        float_init_altivec(c, avctx);
-        int_init_altivec(c, avctx);
-        c->gmc1 = gmc1_altivec;
-
-#if CONFIG_ENCODERS
-        if (avctx->dct_algo == FF_DCT_AUTO ||
-            avctx->dct_algo == FF_DCT_ALTIVEC) {
-            c->fdct = fdct_altivec;
-        }
-#endif //CONFIG_ENCODERS
-
-        if (avctx->lowres==0) {
-            if ((avctx->idct_algo == FF_IDCT_AUTO) ||
-                (avctx->idct_algo == FF_IDCT_ALTIVEC)) {
-                c->idct_put = idct_put_altivec;
-                c->idct_add = idct_add_altivec;
-                c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
-            }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) &&
-                     avctx->idct_algo==FF_IDCT_VP3){
-                c->idct_put = ff_vp3_idct_put_altivec;
-                c->idct_add = ff_vp3_idct_add_altivec;
-                c->idct     = ff_vp3_idct_altivec;
-                c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
-            }
-        }
-
-#if CONFIG_POWERPC_PERF
-        {
-            int i, j;
-            for (i = 0 ; i < powerpc_perf_total ; i++) {
-                for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) {
-                    perfdata[j][i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFFULL;
-                    perfdata[j][i][powerpc_data_max] = 0x0000000000000000ULL;
-                    perfdata[j][i][powerpc_data_sum] = 0x0000000000000000ULL;
-                    perfdata[j][i][powerpc_data_num] = 0x0000000000000000ULL;
-                }
-            }
-        }
-#endif /* CONFIG_POWERPC_PERF */
-    }
-#endif /* HAVE_ALTIVEC */
-}
diff --git a/libavcodec/ppc/dsputil_ppc.h b/libavcodec/ppc/dsputil_ppc.h
deleted file mode 100644
index d028574..0000000
--- a/libavcodec/ppc/dsputil_ppc.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2003-2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PPC_DSPUTIL_PPC_H
-#define AVCODEC_PPC_DSPUTIL_PPC_H
-
-#include "config.h"
-
-#if CONFIG_POWERPC_PERF
-void powerpc_display_perf_report(void);
-/* the 604* have 2, the G3* have 4, the G4s have 6,
-   and the G5 are completely different (they MUST use
-   ARCH_PPC64, and let's hope all future 64 bis PPC
-   will use the same PMCs... */
-#define POWERPC_NUM_PMC_ENABLED 6
-/* if you add to the enum below, also add to the perfname array
-   in dsputil_ppc.c */
-enum powerpc_perf_index {
-    altivec_fft_num = 0,
-    altivec_gmc1_num,
-    altivec_dct_unquantize_h263_num,
-    altivec_fdct,
-    altivec_idct_add_num,
-    altivec_idct_put_num,
-    altivec_put_pixels16_num,
-    altivec_avg_pixels16_num,
-    altivec_avg_pixels8_num,
-    altivec_put_pixels8_xy2_num,
-    altivec_put_no_rnd_pixels8_xy2_num,
-    altivec_put_pixels16_xy2_num,
-    altivec_put_no_rnd_pixels16_xy2_num,
-    altivec_hadamard8_diff8x8_num,
-    altivec_hadamard8_diff16_num,
-    altivec_avg_pixels8_xy2_num,
-    powerpc_clear_blocks_dcbz32,
-    powerpc_clear_blocks_dcbz128,
-    altivec_put_h264_chroma_mc8_num,
-    altivec_avg_h264_chroma_mc8_num,
-    altivec_put_h264_qpel16_h_lowpass_num,
-    altivec_avg_h264_qpel16_h_lowpass_num,
-    altivec_put_h264_qpel16_v_lowpass_num,
-    altivec_avg_h264_qpel16_v_lowpass_num,
-    altivec_put_h264_qpel16_hv_lowpass_num,
-    altivec_avg_h264_qpel16_hv_lowpass_num,
-    powerpc_perf_total
-};
-enum powerpc_data_index {
-    powerpc_data_min = 0,
-    powerpc_data_max,
-    powerpc_data_sum,
-    powerpc_data_num,
-    powerpc_data_total
-};
-extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
-
-#if !ARCH_PPC64
-#define POWERP_PMC_DATATYPE unsigned long
-#define POWERPC_GET_PMC1(a) __asm__ volatile("mfspr %0, 937" : "=r" (a))
-#define POWERPC_GET_PMC2(a) __asm__ volatile("mfspr %0, 938" : "=r" (a))
-#if (POWERPC_NUM_PMC_ENABLED > 2)
-#define POWERPC_GET_PMC3(a) __asm__ volatile("mfspr %0, 941" : "=r" (a))
-#define POWERPC_GET_PMC4(a) __asm__ volatile("mfspr %0, 942" : "=r" (a))
-#else
-#define POWERPC_GET_PMC3(a) do {} while (0)
-#define POWERPC_GET_PMC4(a) do {} while (0)
-#endif
-#if (POWERPC_NUM_PMC_ENABLED > 4)
-#define POWERPC_GET_PMC5(a) __asm__ volatile("mfspr %0, 929" : "=r" (a))
-#define POWERPC_GET_PMC6(a) __asm__ volatile("mfspr %0, 930" : "=r" (a))
-#else
-#define POWERPC_GET_PMC5(a) do {} while (0)
-#define POWERPC_GET_PMC6(a) do {} while (0)
-#endif
-#else /* ARCH_PPC64 */
-#define POWERP_PMC_DATATYPE unsigned long long
-#define POWERPC_GET_PMC1(a) __asm__ volatile("mfspr %0, 771" : "=r" (a))
-#define POWERPC_GET_PMC2(a) __asm__ volatile("mfspr %0, 772" : "=r" (a))
-#if (POWERPC_NUM_PMC_ENABLED > 2)
-#define POWERPC_GET_PMC3(a) __asm__ volatile("mfspr %0, 773" : "=r" (a))
-#define POWERPC_GET_PMC4(a) __asm__ volatile("mfspr %0, 774" : "=r" (a))
-#else
-#define POWERPC_GET_PMC3(a) do {} while (0)
-#define POWERPC_GET_PMC4(a) do {} while (0)
-#endif
-#if (POWERPC_NUM_PMC_ENABLED > 4)
-#define POWERPC_GET_PMC5(a) __asm__ volatile("mfspr %0, 775" : "=r" (a))
-#define POWERPC_GET_PMC6(a) __asm__ volatile("mfspr %0, 776" : "=r" (a))
-#else
-#define POWERPC_GET_PMC5(a) do {} while (0)
-#define POWERPC_GET_PMC6(a) do {} while (0)
-#endif
-#endif /* ARCH_PPC64 */
-#define POWERPC_PERF_DECLARE(a, cond)       \
-    POWERP_PMC_DATATYPE                     \
-        pmc_start[POWERPC_NUM_PMC_ENABLED], \
-        pmc_stop[POWERPC_NUM_PMC_ENABLED],  \
-        pmc_loop_index;
-#define POWERPC_PERF_START_COUNT(a, cond) do { \
-    POWERPC_GET_PMC6(pmc_start[5]); \
-    POWERPC_GET_PMC5(pmc_start[4]); \
-    POWERPC_GET_PMC4(pmc_start[3]); \
-    POWERPC_GET_PMC3(pmc_start[2]); \
-    POWERPC_GET_PMC2(pmc_start[1]); \
-    POWERPC_GET_PMC1(pmc_start[0]); \
-    } while (0)
-#define POWERPC_PERF_STOP_COUNT(a, cond) do { \
-    POWERPC_GET_PMC1(pmc_stop[0]);            \
-    POWERPC_GET_PMC2(pmc_stop[1]);            \
-    POWERPC_GET_PMC3(pmc_stop[2]);            \
-    POWERPC_GET_PMC4(pmc_stop[3]);            \
-    POWERPC_GET_PMC5(pmc_stop[4]);            \
-    POWERPC_GET_PMC6(pmc_stop[5]);            \
-    if (cond) {                               \
-        for(pmc_loop_index = 0;               \
-            pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \
-            pmc_loop_index++) {               \
-            if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) {  \
-                POWERP_PMC_DATATYPE diff =                                \
-                  pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index];   \
-                if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \
-                    perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \
-                if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \
-                    perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \
-                perfdata[pmc_loop_index][a][powerpc_data_sum] += diff;    \
-                perfdata[pmc_loop_index][a][powerpc_data_num] ++;         \
-            }                                 \
-        }                                     \
-    }                                         \
-} while (0)
-#else /* CONFIG_POWERPC_PERF */
-// those are needed to avoid empty statements.
-#define POWERPC_PERF_DECLARE(a, cond)        int altivec_placeholder __attribute__ ((unused))
-#define POWERPC_PERF_START_COUNT(a, cond)    do {} while (0)
-#define POWERPC_PERF_STOP_COUNT(a, cond)     do {} while (0)
-#endif /* CONFIG_POWERPC_PERF */
-
-#endif /*  AVCODEC_PPC_DSPUTIL_PPC_H */
diff --git a/libavcodec/ppc/fdct_altivec.c b/libavcodec/ppc/fdct_altivec.c
deleted file mode 100644
index 8f3bc26..0000000
--- a/libavcodec/ppc/fdct_altivec.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * Copyright (C) 2003  James Klicman <james at klicman.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-#include "libavutil/common.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_ppc.h"
-#include "dsputil_altivec.h"
-
-#define vs16(v) ((vector signed short)(v))
-#define vs32(v) ((vector signed int)(v))
-#define vu8(v)  ((vector unsigned char)(v))
-#define vu16(v) ((vector unsigned short)(v))
-#define vu32(v) ((vector unsigned int)(v))
-
-
-#define C1     0.98078525066375732421875000 /* cos(1*PI/16) */
-#define C2     0.92387950420379638671875000 /* cos(2*PI/16) */
-#define C3     0.83146959543228149414062500 /* cos(3*PI/16) */
-#define C4     0.70710676908493041992187500 /* cos(4*PI/16) */
-#define C5     0.55557024478912353515625000 /* cos(5*PI/16) */
-#define C6     0.38268342614173889160156250 /* cos(6*PI/16) */
-#define C7     0.19509032368659973144531250 /* cos(7*PI/16) */
-#define SQRT_2 1.41421353816986083984375000 /* sqrt(2)      */
-
-
-#define W0 -(2 * C2)
-#define W1 (2 * C6)
-#define W2 (SQRT_2 * C6)
-#define W3 (SQRT_2 * C3)
-#define W4 (SQRT_2 * (-C1 + C3 + C5 - C7))
-#define W5 (SQRT_2 * ( C1 + C3 - C5 + C7))
-#define W6 (SQRT_2 * ( C1 + C3 + C5 - C7))
-#define W7 (SQRT_2 * ( C1 + C3 - C5 - C7))
-#define W8 (SQRT_2 * ( C7 - C3))
-#define W9 (SQRT_2 * (-C1 - C3))
-#define WA (SQRT_2 * (-C3 - C5))
-#define WB (SQRT_2 * ( C5 - C3))
-
-
-static vector float fdctconsts[3] = {
-    { W0, W1, W2, W3 },
-    { W4, W5, W6, W7 },
-    { W8, W9, WA, WB }
-};
-
-#define LD_W0 vec_splat(cnsts0, 0)
-#define LD_W1 vec_splat(cnsts0, 1)
-#define LD_W2 vec_splat(cnsts0, 2)
-#define LD_W3 vec_splat(cnsts0, 3)
-#define LD_W4 vec_splat(cnsts1, 0)
-#define LD_W5 vec_splat(cnsts1, 1)
-#define LD_W6 vec_splat(cnsts1, 2)
-#define LD_W7 vec_splat(cnsts1, 3)
-#define LD_W8 vec_splat(cnsts2, 0)
-#define LD_W9 vec_splat(cnsts2, 1)
-#define LD_WA vec_splat(cnsts2, 2)
-#define LD_WB vec_splat(cnsts2, 3)
-
-
-#define FDCTROW(b0,b1,b2,b3,b4,b5,b6,b7) /* {{{ */                  \
-    x0 = vec_add(b0, b7);               /* x0 = b0 + b7; */         \
-    x7 = vec_sub(b0, b7);               /* x7 = b0 - b7; */         \
-    x1 = vec_add(b1, b6);               /* x1 = b1 + b6; */         \
-    x6 = vec_sub(b1, b6);               /* x6 = b1 - b6; */         \
-    x2 = vec_add(b2, b5);               /* x2 = b2 + b5; */         \
-    x5 = vec_sub(b2, b5);               /* x5 = b2 - b5; */         \
-    x3 = vec_add(b3, b4);               /* x3 = b3 + b4; */         \
-    x4 = vec_sub(b3, b4);               /* x4 = b3 - b4; */         \
-                                                                    \
-    b7 = vec_add(x0, x3);               /* b7 = x0 + x3; */         \
-    b1 = vec_add(x1, x2);               /* b1 = x1 + x2; */         \
-    b0 = vec_add(b7, b1);               /* b0 = b7 + b1; */         \
-    b4 = vec_sub(b7, b1);               /* b4 = b7 - b1; */         \
-                                                                    \
-    b2 = vec_sub(x0, x3);               /* b2 = x0 - x3; */         \
-    b6 = vec_sub(x1, x2);               /* b6 = x1 - x2; */         \
-    b5 = vec_add(b6, b2);               /* b5 = b6 + b2; */         \
-    cnst = LD_W2;                                                   \
-    b5 = vec_madd(cnst, b5, mzero);     /* b5 = b5 * W2; */         \
-    cnst = LD_W1;                                                   \
-    b2 = vec_madd(cnst, b2, b5);        /* b2 = b5 + b2 * W1; */    \
-    cnst = LD_W0;                                                   \
-    b6 = vec_madd(cnst, b6, b5);        /* b6 = b5 + b6 * W0; */    \
-                                                                    \
-    x0 = vec_add(x4, x7);               /* x0 = x4 + x7; */         \
-    x1 = vec_add(x5, x6);               /* x1 = x5 + x6; */         \
-    x2 = vec_add(x4, x6);               /* x2 = x4 + x6; */         \
-    x3 = vec_add(x5, x7);               /* x3 = x5 + x7; */         \
-    x8 = vec_add(x2, x3);               /* x8 = x2 + x3; */         \
-    cnst = LD_W3;                                                   \
-    x8 = vec_madd(cnst, x8, mzero);     /* x8 = x8 * W3; */         \
-                                                                    \
-    cnst = LD_W8;                                                   \
-    x0 = vec_madd(cnst, x0, mzero);     /* x0 *= W8; */             \
-    cnst = LD_W9;                                                   \
-    x1 = vec_madd(cnst, x1, mzero);     /* x1 *= W9; */             \
-    cnst = LD_WA;                                                   \
-    x2 = vec_madd(cnst, x2, x8);        /* x2 = x2 * WA + x8; */    \
-    cnst = LD_WB;                                                   \
-    x3 = vec_madd(cnst, x3, x8);        /* x3 = x3 * WB + x8; */    \
-                                                                    \
-    cnst = LD_W4;                                                   \
-    b7 = vec_madd(cnst, x4, x0);        /* b7 = x4 * W4 + x0; */    \
-    cnst = LD_W5;                                                   \
-    b5 = vec_madd(cnst, x5, x1);        /* b5 = x5 * W5 + x1; */    \
-    cnst = LD_W6;                                                   \
-    b3 = vec_madd(cnst, x6, x1);        /* b3 = x6 * W6 + x1; */    \
-    cnst = LD_W7;                                                   \
-    b1 = vec_madd(cnst, x7, x0);        /* b1 = x7 * W7 + x0; */    \
-                                                                    \
-    b7 = vec_add(b7, x2);               /* b7 = b7 + x2; */         \
-    b5 = vec_add(b5, x3);               /* b5 = b5 + x3; */         \
-    b3 = vec_add(b3, x2);               /* b3 = b3 + x2; */         \
-    b1 = vec_add(b1, x3);               /* b1 = b1 + x3; */         \
-    /* }}} */
-
-#define FDCTCOL(b0,b1,b2,b3,b4,b5,b6,b7) /* {{{ */                  \
-    x0 = vec_add(b0, b7);               /* x0 = b0 + b7; */         \
-    x7 = vec_sub(b0, b7);               /* x7 = b0 - b7; */         \
-    x1 = vec_add(b1, b6);               /* x1 = b1 + b6; */         \
-    x6 = vec_sub(b1, b6);               /* x6 = b1 - b6; */         \
-    x2 = vec_add(b2, b5);               /* x2 = b2 + b5; */         \
-    x5 = vec_sub(b2, b5);               /* x5 = b2 - b5; */         \
-    x3 = vec_add(b3, b4);               /* x3 = b3 + b4; */         \
-    x4 = vec_sub(b3, b4);               /* x4 = b3 - b4; */         \
-                                                                    \
-    b7 = vec_add(x0, x3);               /* b7 = x0 + x3; */         \
-    b1 = vec_add(x1, x2);               /* b1 = x1 + x2; */         \
-    b0 = vec_add(b7, b1);               /* b0 = b7 + b1; */         \
-    b4 = vec_sub(b7, b1);               /* b4 = b7 - b1; */         \
-                                                                    \
-    b2 = vec_sub(x0, x3);               /* b2 = x0 - x3; */         \
-    b6 = vec_sub(x1, x2);               /* b6 = x1 - x2; */         \
-    b5 = vec_add(b6, b2);               /* b5 = b6 + b2; */         \
-    cnst = LD_W2;                                                   \
-    b5 = vec_madd(cnst, b5, mzero);     /* b5 = b5 * W2; */         \
-    cnst = LD_W1;                                                   \
-    b2 = vec_madd(cnst, b2, b5);        /* b2 = b5 + b2 * W1; */    \
-    cnst = LD_W0;                                                   \
-    b6 = vec_madd(cnst, b6, b5);        /* b6 = b5 + b6 * W0; */    \
-                                                                    \
-    x0 = vec_add(x4, x7);               /* x0 = x4 + x7; */         \
-    x1 = vec_add(x5, x6);               /* x1 = x5 + x6; */         \
-    x2 = vec_add(x4, x6);               /* x2 = x4 + x6; */         \
-    x3 = vec_add(x5, x7);               /* x3 = x5 + x7; */         \
-    x8 = vec_add(x2, x3);               /* x8 = x2 + x3; */         \
-    cnst = LD_W3;                                                   \
-    x8 = vec_madd(cnst, x8, mzero);     /* x8 = x8 * W3; */         \
-                                                                    \
-    cnst = LD_W8;                                                   \
-    x0 = vec_madd(cnst, x0, mzero);     /* x0 *= W8; */             \
-    cnst = LD_W9;                                                   \
-    x1 = vec_madd(cnst, x1, mzero);     /* x1 *= W9; */             \
-    cnst = LD_WA;                                                   \
-    x2 = vec_madd(cnst, x2, x8);        /* x2 = x2 * WA + x8; */    \
-    cnst = LD_WB;                                                   \
-    x3 = vec_madd(cnst, x3, x8);        /* x3 = x3 * WB + x8; */    \
-                                                                    \
-    cnst = LD_W4;                                                   \
-    b7 = vec_madd(cnst, x4, x0);        /* b7 = x4 * W4 + x0; */    \
-    cnst = LD_W5;                                                   \
-    b5 = vec_madd(cnst, x5, x1);        /* b5 = x5 * W5 + x1; */    \
-    cnst = LD_W6;                                                   \
-    b3 = vec_madd(cnst, x6, x1);        /* b3 = x6 * W6 + x1; */    \
-    cnst = LD_W7;                                                   \
-    b1 = vec_madd(cnst, x7, x0);        /* b1 = x7 * W7 + x0; */    \
-                                                                    \
-    b7 = vec_add(b7, x2);               /* b7 += x2; */             \
-    b5 = vec_add(b5, x3);               /* b5 += x3; */             \
-    b3 = vec_add(b3, x2);               /* b3 += x2; */             \
-    b1 = vec_add(b1, x3);               /* b1 += x3; */             \
-    /* }}} */
-
-
-
-/* two dimensional discrete cosine transform */
-
-void fdct_altivec(int16_t *block)
-{
-POWERPC_PERF_DECLARE(altivec_fdct, 1);
-    vector signed short *bp;
-    vector float *cp;
-    vector float b00, b10, b20, b30, b40, b50, b60, b70;
-    vector float b01, b11, b21, b31, b41, b51, b61, b71;
-    vector float mzero, cnst, cnsts0, cnsts1, cnsts2;
-    vector float x0, x1, x2, x3, x4, x5, x6, x7, x8;
-
-    POWERPC_PERF_START_COUNT(altivec_fdct, 1);
-
-
-    /* setup constants {{{ */
-    /* mzero = -0.0 */
-    mzero = ((vector float)vec_splat_u32(-1));
-    mzero = ((vector float)vec_sl(vu32(mzero), vu32(mzero)));
-    cp = fdctconsts;
-    cnsts0 = vec_ld(0, cp); cp++;
-    cnsts1 = vec_ld(0, cp); cp++;
-    cnsts2 = vec_ld(0, cp);
-    /* }}} */
-
-
-    /* 8x8 matrix transpose (vector short[8]) {{{ */
-#define MERGE_S16(hl,a,b) vec_merge##hl(vs16(a), vs16(b))
-
-    bp = (vector signed short*)block;
-    b00 = ((vector float)vec_ld(0,    bp));
-    b40 = ((vector float)vec_ld(16*4, bp));
-    b01 = ((vector float)MERGE_S16(h, b00, b40));
-    b11 = ((vector float)MERGE_S16(l, b00, b40));
-    bp++;
-    b10 = ((vector float)vec_ld(0,    bp));
-    b50 = ((vector float)vec_ld(16*4, bp));
-    b21 = ((vector float)MERGE_S16(h, b10, b50));
-    b31 = ((vector float)MERGE_S16(l, b10, b50));
-    bp++;
-    b20 = ((vector float)vec_ld(0,    bp));
-    b60 = ((vector float)vec_ld(16*4, bp));
-    b41 = ((vector float)MERGE_S16(h, b20, b60));
-    b51 = ((vector float)MERGE_S16(l, b20, b60));
-    bp++;
-    b30 = ((vector float)vec_ld(0,    bp));
-    b70 = ((vector float)vec_ld(16*4, bp));
-    b61 = ((vector float)MERGE_S16(h, b30, b70));
-    b71 = ((vector float)MERGE_S16(l, b30, b70));
-
-    x0 = ((vector float)MERGE_S16(h, b01, b41));
-    x1 = ((vector float)MERGE_S16(l, b01, b41));
-    x2 = ((vector float)MERGE_S16(h, b11, b51));
-    x3 = ((vector float)MERGE_S16(l, b11, b51));
-    x4 = ((vector float)MERGE_S16(h, b21, b61));
-    x5 = ((vector float)MERGE_S16(l, b21, b61));
-    x6 = ((vector float)MERGE_S16(h, b31, b71));
-    x7 = ((vector float)MERGE_S16(l, b31, b71));
-
-    b00 = ((vector float)MERGE_S16(h, x0, x4));
-    b10 = ((vector float)MERGE_S16(l, x0, x4));
-    b20 = ((vector float)MERGE_S16(h, x1, x5));
-    b30 = ((vector float)MERGE_S16(l, x1, x5));
-    b40 = ((vector float)MERGE_S16(h, x2, x6));
-    b50 = ((vector float)MERGE_S16(l, x2, x6));
-    b60 = ((vector float)MERGE_S16(h, x3, x7));
-    b70 = ((vector float)MERGE_S16(l, x3, x7));
-
-#undef MERGE_S16
-    /* }}} */
-
-
-/* Some of the initial calculations can be done as vector short before
- * conversion to vector float.  The following code section takes advantage
- * of this.
- */
-#if 1
-    /* fdct rows {{{ */
-    x0 = ((vector float)vec_add(vs16(b00), vs16(b70)));
-    x7 = ((vector float)vec_sub(vs16(b00), vs16(b70)));
-    x1 = ((vector float)vec_add(vs16(b10), vs16(b60)));
-    x6 = ((vector float)vec_sub(vs16(b10), vs16(b60)));
-    x2 = ((vector float)vec_add(vs16(b20), vs16(b50)));
-    x5 = ((vector float)vec_sub(vs16(b20), vs16(b50)));
-    x3 = ((vector float)vec_add(vs16(b30), vs16(b40)));
-    x4 = ((vector float)vec_sub(vs16(b30), vs16(b40)));
-
-    b70 = ((vector float)vec_add(vs16(x0), vs16(x3)));
-    b10 = ((vector float)vec_add(vs16(x1), vs16(x2)));
-
-    b00 = ((vector float)vec_add(vs16(b70), vs16(b10)));
-    b40 = ((vector float)vec_sub(vs16(b70), vs16(b10)));
-
-#define CTF0(n) \
-    b##n##1 = ((vector float)vec_unpackl(vs16(b##n##0))); \
-    b##n##0 = ((vector float)vec_unpackh(vs16(b##n##0))); \
-    b##n##1 = vec_ctf(vs32(b##n##1), 0); \
-    b##n##0 = vec_ctf(vs32(b##n##0), 0);
-
-    CTF0(0);
-    CTF0(4);
-
-    b20 = ((vector float)vec_sub(vs16(x0), vs16(x3)));
-    b60 = ((vector float)vec_sub(vs16(x1), vs16(x2)));
-
-    CTF0(2);
-    CTF0(6);
-
-#undef CTF0
-
-    x0 = vec_add(b60, b20);
-    x1 = vec_add(b61, b21);
-
-    cnst = LD_W2;
-    x0 = vec_madd(cnst, x0, mzero);
-    x1 = vec_madd(cnst, x1, mzero);
-    cnst = LD_W1;
-    b20 = vec_madd(cnst, b20, x0);
-    b21 = vec_madd(cnst, b21, x1);
-    cnst = LD_W0;
-    b60 = vec_madd(cnst, b60, x0);
-    b61 = vec_madd(cnst, b61, x1);
-
-#define CTFX(x,b) \
-    b##0 = ((vector float)vec_unpackh(vs16(x))); \
-    b##1 = ((vector float)vec_unpackl(vs16(x))); \
-    b##0 = vec_ctf(vs32(b##0), 0); \
-    b##1 = vec_ctf(vs32(b##1), 0); \
-
-    CTFX(x4, b7);
-    CTFX(x5, b5);
-    CTFX(x6, b3);
-    CTFX(x7, b1);
-
-#undef CTFX
-
-
-    x0 = vec_add(b70, b10);
-    x1 = vec_add(b50, b30);
-    x2 = vec_add(b70, b30);
-    x3 = vec_add(b50, b10);
-    x8 = vec_add(x2, x3);
-    cnst = LD_W3;
-    x8 = vec_madd(cnst, x8, mzero);
-
-    cnst = LD_W8;
-    x0 = vec_madd(cnst, x0, mzero);
-    cnst = LD_W9;
-    x1 = vec_madd(cnst, x1, mzero);
-    cnst = LD_WA;
-    x2 = vec_madd(cnst, x2, x8);
-    cnst = LD_WB;
-    x3 = vec_madd(cnst, x3, x8);
-
-    cnst = LD_W4;
-    b70 = vec_madd(cnst, b70, x0);
-    cnst = LD_W5;
-    b50 = vec_madd(cnst, b50, x1);
-    cnst = LD_W6;
-    b30 = vec_madd(cnst, b30, x1);
-    cnst = LD_W7;
-    b10 = vec_madd(cnst, b10, x0);
-
-    b70 = vec_add(b70, x2);
-    b50 = vec_add(b50, x3);
-    b30 = vec_add(b30, x2);
-    b10 = vec_add(b10, x3);
-
-
-    x0 = vec_add(b71, b11);
-    x1 = vec_add(b51, b31);
-    x2 = vec_add(b71, b31);
-    x3 = vec_add(b51, b11);
-    x8 = vec_add(x2, x3);
-    cnst = LD_W3;
-    x8 = vec_madd(cnst, x8, mzero);
-
-    cnst = LD_W8;
-    x0 = vec_madd(cnst, x0, mzero);
-    cnst = LD_W9;
-    x1 = vec_madd(cnst, x1, mzero);
-    cnst = LD_WA;
-    x2 = vec_madd(cnst, x2, x8);
-    cnst = LD_WB;
-    x3 = vec_madd(cnst, x3, x8);
-
-    cnst = LD_W4;
-    b71 = vec_madd(cnst, b71, x0);
-    cnst = LD_W5;
-    b51 = vec_madd(cnst, b51, x1);
-    cnst = LD_W6;
-    b31 = vec_madd(cnst, b31, x1);
-    cnst = LD_W7;
-    b11 = vec_madd(cnst, b11, x0);
-
-    b71 = vec_add(b71, x2);
-    b51 = vec_add(b51, x3);
-    b31 = vec_add(b31, x2);
-    b11 = vec_add(b11, x3);
-    /* }}} */
-#else
-    /* convert to float {{{ */
-#define CTF(n) \
-    vs32(b##n##1) = vec_unpackl(vs16(b##n##0)); \
-    vs32(b##n##0) = vec_unpackh(vs16(b##n##0)); \
-    b##n##1 = vec_ctf(vs32(b##n##1), 0); \
-    b##n##0 = vec_ctf(vs32(b##n##0), 0); \
-
-    CTF(0);
-    CTF(1);
-    CTF(2);
-    CTF(3);
-    CTF(4);
-    CTF(5);
-    CTF(6);
-    CTF(7);
-
-#undef CTF
-    /* }}} */
-
-    FDCTROW(b00, b10, b20, b30, b40, b50, b60, b70);
-    FDCTROW(b01, b11, b21, b31, b41, b51, b61, b71);
-#endif
-
-
-    /* 8x8 matrix transpose (vector float[8][2]) {{{ */
-    x0 = vec_mergel(b00, b20);
-    x1 = vec_mergeh(b00, b20);
-    x2 = vec_mergel(b10, b30);
-    x3 = vec_mergeh(b10, b30);
-
-    b00 = vec_mergeh(x1, x3);
-    b10 = vec_mergel(x1, x3);
-    b20 = vec_mergeh(x0, x2);
-    b30 = vec_mergel(x0, x2);
-
-    x4 = vec_mergel(b41, b61);
-    x5 = vec_mergeh(b41, b61);
-    x6 = vec_mergel(b51, b71);
-    x7 = vec_mergeh(b51, b71);
-
-    b41 = vec_mergeh(x5, x7);
-    b51 = vec_mergel(x5, x7);
-    b61 = vec_mergeh(x4, x6);
-    b71 = vec_mergel(x4, x6);
-
-    x0 = vec_mergel(b01, b21);
-    x1 = vec_mergeh(b01, b21);
-    x2 = vec_mergel(b11, b31);
-    x3 = vec_mergeh(b11, b31);
-
-    x4 = vec_mergel(b40, b60);
-    x5 = vec_mergeh(b40, b60);
-    x6 = vec_mergel(b50, b70);
-    x7 = vec_mergeh(b50, b70);
-
-    b40 = vec_mergeh(x1, x3);
-    b50 = vec_mergel(x1, x3);
-    b60 = vec_mergeh(x0, x2);
-    b70 = vec_mergel(x0, x2);
-
-    b01 = vec_mergeh(x5, x7);
-    b11 = vec_mergel(x5, x7);
-    b21 = vec_mergeh(x4, x6);
-    b31 = vec_mergel(x4, x6);
-    /* }}} */
-
-
-    FDCTCOL(b00, b10, b20, b30, b40, b50, b60, b70);
-    FDCTCOL(b01, b11, b21, b31, b41, b51, b61, b71);
-
-
-    /* round, convert back to short {{{ */
-#define CTS(n) \
-    b##n##0 = vec_round(b##n##0); \
-    b##n##1 = vec_round(b##n##1); \
-    b##n##0 = ((vector float)vec_cts(b##n##0, 0)); \
-    b##n##1 = ((vector float)vec_cts(b##n##1, 0)); \
-    b##n##0 = ((vector float)vec_pack(vs32(b##n##0), vs32(b##n##1))); \
-    vec_st(vs16(b##n##0), 0, bp);
-
-    bp = (vector signed short*)block;
-    CTS(0); bp++;
-    CTS(1); bp++;
-    CTS(2); bp++;
-    CTS(3); bp++;
-    CTS(4); bp++;
-    CTS(5); bp++;
-    CTS(6); bp++;
-    CTS(7);
-
-#undef CTS
-    /* }}} */
-
-POWERPC_PERF_STOP_COUNT(altivec_fdct, 1);
-}
-
-/* vim:set foldmethod=marker foldlevel=0: */
diff --git a/libavcodec/ppc/fft_altivec.c b/libavcodec/ppc/fft_altivec.c
deleted file mode 100644
index ce35ab6..0000000
--- a/libavcodec/ppc/fft_altivec.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * FFT/IFFT transforms
- * AltiVec-enabled
- * Copyright (c) 2003 Romain Dolbeau <romain at dolbeau.org>
- * Based on code Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "libavcodec/fft.h"
-#include "dsputil_ppc.h"
-#include "util_altivec.h"
-#include "dsputil_altivec.h"
-
-/**
- * Do a complex FFT with the parameters defined in ff_fft_init(). The
- * input data must be permuted before with s->revtab table. No
- * 1.0/sqrt(n) normalization is done.
- * AltiVec-enabled
- * This code assumes that the 'z' pointer is 16 bytes-aligned
- * It also assumes all FFTComplex are 8 bytes-aligned pair of float
- * The code is exactly the same as the SSE version, except
- * that successive MUL + ADD/SUB have been merged into
- * fused multiply-add ('vec_madd' in altivec)
- */
-static void ff_fft_calc_altivec(FFTContext *s, FFTComplex *z)
-{
-POWERPC_PERF_DECLARE(altivec_fft_num, s->nbits >= 6);
-    register const vector float vczero = (const vector float)vec_splat_u32(0.);
-
-    int ln = s->nbits;
-    int j, np, np2;
-    int nblocks, nloops;
-    register FFTComplex *p, *q;
-    FFTComplex *cptr, *cptr1;
-    int k;
-
-POWERPC_PERF_START_COUNT(altivec_fft_num, s->nbits >= 6);
-
-    np = 1 << ln;
-
-    {
-        vector float *r, a, b, a1, c1, c2;
-
-        r = (vector float *)&z[0];
-
-        c1 = vcii(p,p,n,n);
-
-        if (s->inverse) {
-            c2 = vcii(p,p,n,p);
-        } else {
-            c2 = vcii(p,p,p,n);
-        }
-
-        j = (np >> 2);
-        do {
-            a = vec_ld(0, r);
-            a1 = vec_ld(sizeof(vector float), r);
-
-            b = vec_perm(a,a,vcprmle(1,0,3,2));
-            a = vec_madd(a,c1,b);
-            /* do the pass 0 butterfly */
-
-            b = vec_perm(a1,a1,vcprmle(1,0,3,2));
-            b = vec_madd(a1,c1,b);
-            /* do the pass 0 butterfly */
-
-            /* multiply third by -i */
-            b = vec_perm(b,b,vcprmle(2,3,1,0));
-
-            /* do the pass 1 butterfly */
-            vec_st(vec_madd(b,c2,a), 0, r);
-            vec_st(vec_nmsub(b,c2,a), sizeof(vector float), r);
-
-            r += 2;
-        } while (--j != 0);
-    }
-    /* pass 2 .. ln-1 */
-
-    nblocks = np >> 3;
-    nloops = 1 << 2;
-    np2 = np >> 1;
-
-    cptr1 = s->exptab1;
-    do {
-        p = z;
-        q = z + nloops;
-        j = nblocks;
-        do {
-            cptr = cptr1;
-            k = nloops >> 1;
-            do {
-                vector float a,b,c,t1;
-
-                a = vec_ld(0, (float*)p);
-                b = vec_ld(0, (float*)q);
-
-                /* complex mul */
-                c = vec_ld(0, (float*)cptr);
-                /*  cre*re cim*re */
-                t1 = vec_madd(c, vec_perm(b,b,vcprmle(2,2,0,0)),vczero);
-                c = vec_ld(sizeof(vector float), (float*)cptr);
-                /*  -cim*im cre*im */
-                b = vec_madd(c, vec_perm(b,b,vcprmle(3,3,1,1)),t1);
-
-                /* butterfly */
-                vec_st(vec_add(a,b), 0, (float*)p);
-                vec_st(vec_sub(a,b), 0, (float*)q);
-
-                p += 2;
-                q += 2;
-                cptr += 4;
-            } while (--k);
-
-            p += nloops;
-            q += nloops;
-        } while (--j);
-        cptr1 += nloops * 2;
-        nblocks = nblocks >> 1;
-        nloops = nloops << 1;
-    } while (nblocks != 0);
-
-POWERPC_PERF_STOP_COUNT(altivec_fft_num, s->nbits >= 6);
-}
-
-av_cold void ff_fft_init_altivec(FFTContext *s)
-{
-    s->fft_calc = ff_fft_calc_altivec;
-    s->split_radix = 0;
-}
diff --git a/libavcodec/ppc/float_altivec.c b/libavcodec/ppc/float_altivec.c
deleted file mode 100644
index d1f9f1a..0000000
--- a/libavcodec/ppc/float_altivec.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (c) 2006 Luca Barbato <lu_zero at gentoo.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-
-#include "dsputil_altivec.h"
-#include "util_altivec.h"
-
-static void vector_fmul_altivec(float *dst, const float *src, int len)
-{
-    int i;
-    vector float d0, d1, s, zero = (vector float)vec_splat_u32(0);
-    for(i=0; i<len-7; i+=8) {
-        d0 = vec_ld(0, dst+i);
-        s = vec_ld(0, src+i);
-        d1 = vec_ld(16, dst+i);
-        d0 = vec_madd(d0, s, zero);
-        d1 = vec_madd(d1, vec_ld(16,src+i), zero);
-        vec_st(d0, 0, dst+i);
-        vec_st(d1, 16, dst+i);
-    }
-}
-
-static void vector_fmul_reverse_altivec(float *dst, const float *src0,
-                                        const float *src1, int len)
-{
-    int i;
-    vector float d, s0, s1, h0, l0,
-                 s2, s3, zero = (vector float)vec_splat_u32(0);
-    src1 += len-4;
-    for(i=0; i<len-7; i+=8) {
-        s1 = vec_ld(0, src1-i);              // [a,b,c,d]
-        s0 = vec_ld(0, src0+i);
-        l0 = vec_mergel(s1, s1);             // [c,c,d,d]
-        s3 = vec_ld(-16, src1-i);
-        h0 = vec_mergeh(s1, s1);             // [a,a,b,b]
-        s2 = vec_ld(16, src0+i);
-        s1 = vec_mergeh(vec_mergel(l0,h0),   // [d,b,d,b]
-                        vec_mergeh(l0,h0));  // [c,a,c,a]
-                                             // [d,c,b,a]
-        l0 = vec_mergel(s3, s3);
-        d = vec_madd(s0, s1, zero);
-        h0 = vec_mergeh(s3, s3);
-        vec_st(d, 0, dst+i);
-        s3 = vec_mergeh(vec_mergel(l0,h0),
-                        vec_mergeh(l0,h0));
-        d = vec_madd(s2, s3, zero);
-        vec_st(d, 16, dst+i);
-    }
-}
-
-static void vector_fmul_add_altivec(float *dst, const float *src0,
-                                    const float *src1, const float *src2,
-                                    int len)
-{
-    int i;
-    vector float d, s0, s1, s2, t0, t1, edges;
-    vector unsigned char align = vec_lvsr(0,dst),
-                         mask = vec_lvsl(0, dst);
-
-    for (i=0; i<len-3; i+=4) {
-        t0 = vec_ld(0, dst+i);
-        t1 = vec_ld(15, dst+i);
-        s0 = vec_ld(0, src0+i);
-        s1 = vec_ld(0, src1+i);
-        s2 = vec_ld(0, src2+i);
-        edges = vec_perm(t1 ,t0, mask);
-        d = vec_madd(s0,s1,s2);
-        t1 = vec_perm(d, edges, align);
-        t0 = vec_perm(edges, d, align);
-        vec_st(t1, 15, dst+i);
-        vec_st(t0, 0, dst+i);
-    }
-}
-
-static void vector_fmul_window_altivec(float *dst, const float *src0, const float *src1, const float *win, float add_bias, int len)
-{
-    union {
-        vector float v;
-        float s[4];
-    } vadd;
-    vector float vadd_bias, zero, t0, t1, s0, s1, wi, wj;
-    const vector unsigned char reverse = vcprm(3,2,1,0);
-    int i,j;
-
-    dst += len;
-    win += len;
-    src0+= len;
-
-    vadd.s[0] = add_bias;
-    vadd_bias = vec_splat(vadd.v, 0);
-    zero = (vector float)vec_splat_u32(0);
-
-    for(i=-len*4, j=len*4-16; i<0; i+=16, j-=16) {
-        s0 = vec_ld(i, src0);
-        s1 = vec_ld(j, src1);
-        wi = vec_ld(i, win);
-        wj = vec_ld(j, win);
-
-        s1 = vec_perm(s1, s1, reverse);
-        wj = vec_perm(wj, wj, reverse);
-
-        t0 = vec_madd(s0, wj, vadd_bias);
-        t0 = vec_nmsub(s1, wi, t0);
-        t1 = vec_madd(s0, wi, vadd_bias);
-        t1 = vec_madd(s1, wj, t1);
-        t1 = vec_perm(t1, t1, reverse);
-
-        vec_st(t0, i, dst);
-        vec_st(t1, j, dst);
-    }
-}
-
-static void int32_to_float_fmul_scalar_altivec(float *dst, const int *src, float mul, int len)
-{
-    union {
-        vector float v;
-        float s[4];
-    } mul_u;
-    int i;
-    vector float src1, src2, dst1, dst2, mul_v, zero;
-
-    zero = (vector float)vec_splat_u32(0);
-    mul_u.s[0] = mul;
-    mul_v = vec_splat(mul_u.v, 0);
-
-    for(i=0; i<len; i+=8) {
-        src1 = vec_ctf(vec_ld(0,  src+i), 0);
-        src2 = vec_ctf(vec_ld(16, src+i), 0);
-        dst1 = vec_madd(src1, mul_v, zero);
-        dst2 = vec_madd(src2, mul_v, zero);
-        vec_st(dst1,  0, dst+i);
-        vec_st(dst2, 16, dst+i);
-    }
-}
-
-
-static vector signed short
-float_to_int16_one_altivec(const float *src)
-{
-    vector float s0 = vec_ld(0, src);
-    vector float s1 = vec_ld(16, src);
-    vector signed int t0 = vec_cts(s0, 0);
-    vector signed int t1 = vec_cts(s1, 0);
-    return vec_packs(t0,t1);
-}
-
-static void float_to_int16_altivec(int16_t *dst, const float *src, long len)
-{
-    int i;
-    vector signed short d0, d1, d;
-    vector unsigned char align;
-    if(((long)dst)&15) //FIXME
-    for(i=0; i<len-7; i+=8) {
-        d0 = vec_ld(0, dst+i);
-        d = float_to_int16_one_altivec(src+i);
-        d1 = vec_ld(15, dst+i);
-        d1 = vec_perm(d1, d0, vec_lvsl(0,dst+i));
-        align = vec_lvsr(0, dst+i);
-        d0 = vec_perm(d1, d, align);
-        d1 = vec_perm(d, d1, align);
-        vec_st(d0, 0, dst+i);
-        vec_st(d1,15, dst+i);
-    }
-    else
-    for(i=0; i<len-7; i+=8) {
-        d = float_to_int16_one_altivec(src+i);
-        vec_st(d, 0, dst+i);
-    }
-}
-
-static void
-float_to_int16_interleave_altivec(int16_t *dst, const float **src,
-                                  long len, int channels)
-{
-    int i;
-    vector signed short d0, d1, d2, c0, c1, t0, t1;
-    vector unsigned char align;
-    if(channels == 1)
-        float_to_int16_altivec(dst, src[0], len);
-    else
-        if (channels == 2) {
-        if(((long)dst)&15)
-        for(i=0; i<len-7; i+=8) {
-            d0 = vec_ld(0, dst + i);
-            t0 = float_to_int16_one_altivec(src[0] + i);
-            d1 = vec_ld(31, dst + i);
-            t1 = float_to_int16_one_altivec(src[1] + i);
-            c0 = vec_mergeh(t0, t1);
-            c1 = vec_mergel(t0, t1);
-            d2 = vec_perm(d1, d0, vec_lvsl(0, dst + i));
-            align = vec_lvsr(0, dst + i);
-            d0 = vec_perm(d2, c0, align);
-            d1 = vec_perm(c0, c1, align);
-            vec_st(d0,  0, dst + i);
-            d0 = vec_perm(c1, d2, align);
-            vec_st(d1, 15, dst + i);
-            vec_st(d0, 31, dst + i);
-            dst+=8;
-        }
-        else
-        for(i=0; i<len-7; i+=8) {
-            t0 = float_to_int16_one_altivec(src[0] + i);
-            t1 = float_to_int16_one_altivec(src[1] + i);
-            d0 = vec_mergeh(t0, t1);
-            d1 = vec_mergel(t0, t1);
-            vec_st(d0,  0, dst + i);
-            vec_st(d1, 16, dst + i);
-            dst+=8;
-        }
-    } else {
-        DECLARE_ALIGNED(16, int16_t, tmp)[len];
-        int c, j;
-        for (c = 0; c < channels; c++) {
-            float_to_int16_altivec(tmp, src[c], len);
-            for (i = 0, j = c; i < len; i++, j+=channels) {
-                dst[j] = tmp[i];
-            }
-        }
-   }
-}
-
-void float_init_altivec(DSPContext* c, AVCodecContext *avctx)
-{
-    c->vector_fmul = vector_fmul_altivec;
-    c->vector_fmul_reverse = vector_fmul_reverse_altivec;
-    c->vector_fmul_add = vector_fmul_add_altivec;
-    c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_altivec;
-    if(!(avctx->flags & CODEC_FLAG_BITEXACT)) {
-        c->vector_fmul_window = vector_fmul_window_altivec;
-        c->float_to_int16 = float_to_int16_altivec;
-        c->float_to_int16_interleave = float_to_int16_interleave_altivec;
-    }
-}
diff --git a/libavcodec/ppc/gmc_altivec.c b/libavcodec/ppc/gmc_altivec.c
deleted file mode 100644
index fa71047..0000000
--- a/libavcodec/ppc/gmc_altivec.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * GMC (Global Motion Compensation)
- * AltiVec-enabled
- * Copyright (c) 2003 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_ppc.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
-#include "dsputil_altivec.h"
-
-/*
-  altivec-enhanced gmc1. ATM this code assume stride is a multiple of 8,
-  to preserve proper dst alignment.
-*/
-#define GMC1_PERF_COND (h==8)
-void gmc1_altivec(uint8_t *dst /* align 8 */, uint8_t *src /* align1 */, int stride, int h, int x16, int y16, int rounder)
-{
-POWERPC_PERF_DECLARE(altivec_gmc1_num, GMC1_PERF_COND);
-    const DECLARE_ALIGNED(16, unsigned short, rounder_a) = rounder;
-    const DECLARE_ALIGNED(16, unsigned short, ABCD)[8] =
-        {
-            (16-x16)*(16-y16), /* A */
-            (   x16)*(16-y16), /* B */
-            (16-x16)*(   y16), /* C */
-            (   x16)*(   y16), /* D */
-            0, 0, 0, 0         /* padding */
-        };
-    register const vector unsigned char vczero = (const vector unsigned char)vec_splat_u8(0);
-    register const vector unsigned short vcsr8 = (const vector unsigned short)vec_splat_u16(8);
-    register vector unsigned char dstv, dstv2, src_0, src_1, srcvA, srcvB, srcvC, srcvD;
-    register vector unsigned short Av, Bv, Cv, Dv, rounderV, tempA, tempB, tempC, tempD;
-    int i;
-    unsigned long dst_odd = (unsigned long)dst & 0x0000000F;
-    unsigned long src_really_odd = (unsigned long)src & 0x0000000F;
-
-
-POWERPC_PERF_START_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
-
-    tempA = vec_ld(0, (unsigned short*)ABCD);
-    Av = vec_splat(tempA, 0);
-    Bv = vec_splat(tempA, 1);
-    Cv = vec_splat(tempA, 2);
-    Dv = vec_splat(tempA, 3);
-
-    rounderV = vec_splat((vec_u16)vec_lde(0, &rounder_a), 0);
-
-    // we'll be able to pick-up our 9 char elements
-    // at src from those 32 bytes
-    // we load the first batch here, as inside the loop
-    // we can re-use 'src+stride' from one iteration
-    // as the 'src' of the next.
-    src_0 = vec_ld(0, src);
-    src_1 = vec_ld(16, src);
-    srcvA = vec_perm(src_0, src_1, vec_lvsl(0, src));
-
-    if (src_really_odd != 0x0000000F) {
-        // if src & 0xF == 0xF, then (src+1) is properly aligned
-        // on the second vector.
-        srcvB = vec_perm(src_0, src_1, vec_lvsl(1, src));
-    } else {
-        srcvB = src_1;
-    }
-    srcvA = vec_mergeh(vczero, srcvA);
-    srcvB = vec_mergeh(vczero, srcvB);
-
-    for(i=0; i<h; i++) {
-        dst_odd = (unsigned long)dst & 0x0000000F;
-        src_really_odd = (((unsigned long)src) + stride) & 0x0000000F;
-
-        dstv = vec_ld(0, dst);
-
-        // we we'll be able to pick-up our 9 char elements
-        // at src + stride from those 32 bytes
-        // then reuse the resulting 2 vectors srvcC and srcvD
-        // as the next srcvA and srcvB
-        src_0 = vec_ld(stride + 0, src);
-        src_1 = vec_ld(stride + 16, src);
-        srcvC = vec_perm(src_0, src_1, vec_lvsl(stride + 0, src));
-
-        if (src_really_odd != 0x0000000F) {
-            // if src & 0xF == 0xF, then (src+1) is properly aligned
-            // on the second vector.
-            srcvD = vec_perm(src_0, src_1, vec_lvsl(stride + 1, src));
-        } else {
-            srcvD = src_1;
-        }
-
-        srcvC = vec_mergeh(vczero, srcvC);
-        srcvD = vec_mergeh(vczero, srcvD);
-
-
-        // OK, now we (finally) do the math :-)
-        // those four instructions replaces 32 int muls & 32 int adds.
-        // isn't AltiVec nice ?
-        tempA = vec_mladd((vector unsigned short)srcvA, Av, rounderV);
-        tempB = vec_mladd((vector unsigned short)srcvB, Bv, tempA);
-        tempC = vec_mladd((vector unsigned short)srcvC, Cv, tempB);
-        tempD = vec_mladd((vector unsigned short)srcvD, Dv, tempC);
-
-        srcvA = srcvC;
-        srcvB = srcvD;
-
-        tempD = vec_sr(tempD, vcsr8);
-
-        dstv2 = vec_pack(tempD, (vector unsigned short)vczero);
-
-        if (dst_odd) {
-            dstv2 = vec_perm(dstv, dstv2, vcprm(0,1,s0,s1));
-        } else {
-            dstv2 = vec_perm(dstv, dstv2, vcprm(s0,s1,2,3));
-        }
-
-        vec_st(dstv2, 0, dst);
-
-        dst += stride;
-        src += stride;
-    }
-
-POWERPC_PERF_STOP_COUNT(altivec_gmc1_num, GMC1_PERF_COND);
-}
diff --git a/libavcodec/ppc/h264_altivec.c b/libavcodec/ppc/h264_altivec.c
deleted file mode 100644
index 47e416b..0000000
--- a/libavcodec/ppc/h264_altivec.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/*
- * Copyright (c) 2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "libavcodec/h264data.h"
-#include "libavcodec/h264dsp.h"
-
-#include "dsputil_ppc.h"
-#include "dsputil_altivec.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
-
-#define PUT_OP_U8_ALTIVEC(d, s, dst) d = s
-#define AVG_OP_U8_ALTIVEC(d, s, dst) d = vec_avg(dst, s)
-
-#define OP_U8_ALTIVEC                          PUT_OP_U8_ALTIVEC
-#define PREFIX_h264_chroma_mc8_altivec         put_h264_chroma_mc8_altivec
-#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   put_no_rnd_vc1_chroma_mc8_altivec
-#define PREFIX_h264_chroma_mc8_num             altivec_put_h264_chroma_mc8_num
-#define PREFIX_h264_qpel16_h_lowpass_altivec   put_h264_qpel16_h_lowpass_altivec
-#define PREFIX_h264_qpel16_h_lowpass_num       altivec_put_h264_qpel16_h_lowpass_num
-#define PREFIX_h264_qpel16_v_lowpass_altivec   put_h264_qpel16_v_lowpass_altivec
-#define PREFIX_h264_qpel16_v_lowpass_num       altivec_put_h264_qpel16_v_lowpass_num
-#define PREFIX_h264_qpel16_hv_lowpass_altivec  put_h264_qpel16_hv_lowpass_altivec
-#define PREFIX_h264_qpel16_hv_lowpass_num      altivec_put_h264_qpel16_hv_lowpass_num
-#include "h264_template_altivec.c"
-#undef OP_U8_ALTIVEC
-#undef PREFIX_h264_chroma_mc8_altivec
-#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
-#undef PREFIX_h264_chroma_mc8_num
-#undef PREFIX_h264_qpel16_h_lowpass_altivec
-#undef PREFIX_h264_qpel16_h_lowpass_num
-#undef PREFIX_h264_qpel16_v_lowpass_altivec
-#undef PREFIX_h264_qpel16_v_lowpass_num
-#undef PREFIX_h264_qpel16_hv_lowpass_altivec
-#undef PREFIX_h264_qpel16_hv_lowpass_num
-
-#define OP_U8_ALTIVEC                          AVG_OP_U8_ALTIVEC
-#define PREFIX_h264_chroma_mc8_altivec         avg_h264_chroma_mc8_altivec
-#define PREFIX_no_rnd_vc1_chroma_mc8_altivec   avg_no_rnd_vc1_chroma_mc8_altivec
-#define PREFIX_h264_chroma_mc8_num             altivec_avg_h264_chroma_mc8_num
-#define PREFIX_h264_qpel16_h_lowpass_altivec   avg_h264_qpel16_h_lowpass_altivec
-#define PREFIX_h264_qpel16_h_lowpass_num       altivec_avg_h264_qpel16_h_lowpass_num
-#define PREFIX_h264_qpel16_v_lowpass_altivec   avg_h264_qpel16_v_lowpass_altivec
-#define PREFIX_h264_qpel16_v_lowpass_num       altivec_avg_h264_qpel16_v_lowpass_num
-#define PREFIX_h264_qpel16_hv_lowpass_altivec  avg_h264_qpel16_hv_lowpass_altivec
-#define PREFIX_h264_qpel16_hv_lowpass_num      altivec_avg_h264_qpel16_hv_lowpass_num
-#include "h264_template_altivec.c"
-#undef OP_U8_ALTIVEC
-#undef PREFIX_h264_chroma_mc8_altivec
-#undef PREFIX_no_rnd_vc1_chroma_mc8_altivec
-#undef PREFIX_h264_chroma_mc8_num
-#undef PREFIX_h264_qpel16_h_lowpass_altivec
-#undef PREFIX_h264_qpel16_h_lowpass_num
-#undef PREFIX_h264_qpel16_v_lowpass_altivec
-#undef PREFIX_h264_qpel16_v_lowpass_num
-#undef PREFIX_h264_qpel16_hv_lowpass_altivec
-#undef PREFIX_h264_qpel16_hv_lowpass_num
-
-#define H264_MC(OPNAME, SIZE, CODETYPE) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## CODETYPE (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){ \
-    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+1, half, stride, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+stride, half, stride, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
-    OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(dst, tmp, src, stride, SIZE, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
-    put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
-    DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
-}\
-
-static inline void put_pixels16_l2_altivec( uint8_t * dst, const uint8_t * src1,
-                                    const uint8_t * src2, int dst_stride,
-                                    int src_stride1, int h)
-{
-    int i;
-    vec_u8 a, b, d, tmp1, tmp2, mask, mask_, edges, align;
-
-    mask_ = vec_lvsl(0, src2);
-
-    for (i = 0; i < h; i++) {
-
-        tmp1 = vec_ld(i * src_stride1, src1);
-        mask = vec_lvsl(i * src_stride1, src1);
-        tmp2 = vec_ld(i * src_stride1 + 15, src1);
-
-        a = vec_perm(tmp1, tmp2, mask);
-
-        tmp1 = vec_ld(i * 16, src2);
-        tmp2 = vec_ld(i * 16 + 15, src2);
-
-        b = vec_perm(tmp1, tmp2, mask_);
-
-        tmp1 = vec_ld(0, dst);
-        mask = vec_lvsl(0, dst);
-        tmp2 = vec_ld(15, dst);
-
-        d = vec_avg(a, b);
-
-        edges = vec_perm(tmp2, tmp1, mask);
-
-        align = vec_lvsr(0, dst);
-
-        tmp2 = vec_perm(d, edges, align);
-        tmp1 = vec_perm(edges, d, align);
-
-        vec_st(tmp2, 15, dst);
-        vec_st(tmp1, 0 , dst);
-
-        dst += dst_stride;
-    }
-}
-
-static inline void avg_pixels16_l2_altivec( uint8_t * dst, const uint8_t * src1,
-                                    const uint8_t * src2, int dst_stride,
-                                    int src_stride1, int h)
-{
-    int i;
-    vec_u8 a, b, d, tmp1, tmp2, mask, mask_, edges, align;
-
-    mask_ = vec_lvsl(0, src2);
-
-    for (i = 0; i < h; i++) {
-
-        tmp1 = vec_ld(i * src_stride1, src1);
-        mask = vec_lvsl(i * src_stride1, src1);
-        tmp2 = vec_ld(i * src_stride1 + 15, src1);
-
-        a = vec_perm(tmp1, tmp2, mask);
-
-        tmp1 = vec_ld(i * 16, src2);
-        tmp2 = vec_ld(i * 16 + 15, src2);
-
-        b = vec_perm(tmp1, tmp2, mask_);
-
-        tmp1 = vec_ld(0, dst);
-        mask = vec_lvsl(0, dst);
-        tmp2 = vec_ld(15, dst);
-
-        d = vec_avg(vec_perm(tmp1, tmp2, mask), vec_avg(a, b));
-
-        edges = vec_perm(tmp2, tmp1, mask);
-
-        align = vec_lvsr(0, dst);
-
-        tmp2 = vec_perm(d, edges, align);
-        tmp1 = vec_perm(edges, d, align);
-
-        vec_st(tmp2, 15, dst);
-        vec_st(tmp1, 0 , dst);
-
-        dst += dst_stride;
-    }
-}
-
-/* Implemented but could be faster
-#define put_pixels16_l2_altivec(d,s1,s2,ds,s1s,h) put_pixels16_l2(d,s1,s2,ds,s1s,16,h)
-#define avg_pixels16_l2_altivec(d,s1,s2,ds,s1s,h) avg_pixels16_l2(d,s1,s2,ds,s1s,16,h)
- */
-
-H264_MC(put_, 16, altivec)
-H264_MC(avg_, 16, altivec)
-
-
-/****************************************************************************
- * IDCT transform:
- ****************************************************************************/
-
-#define VEC_1D_DCT(vb0,vb1,vb2,vb3,va0,va1,va2,va3)               \
-    /* 1st stage */                                               \
-    vz0 = vec_add(vb0,vb2);       /* temp[0] = Y[0] + Y[2] */     \
-    vz1 = vec_sub(vb0,vb2);       /* temp[1] = Y[0] - Y[2] */     \
-    vz2 = vec_sra(vb1,vec_splat_u16(1));                          \
-    vz2 = vec_sub(vz2,vb3);       /* temp[2] = Y[1].1/2 - Y[3] */ \
-    vz3 = vec_sra(vb3,vec_splat_u16(1));                          \
-    vz3 = vec_add(vb1,vz3);       /* temp[3] = Y[1] + Y[3].1/2 */ \
-    /* 2nd stage: output */                                       \
-    va0 = vec_add(vz0,vz3);       /* x[0] = temp[0] + temp[3] */  \
-    va1 = vec_add(vz1,vz2);       /* x[1] = temp[1] + temp[2] */  \
-    va2 = vec_sub(vz1,vz2);       /* x[2] = temp[1] - temp[2] */  \
-    va3 = vec_sub(vz0,vz3)        /* x[3] = temp[0] - temp[3] */
-
-#define VEC_TRANSPOSE_4(a0,a1,a2,a3,b0,b1,b2,b3) \
-    b0 = vec_mergeh( a0, a0 ); \
-    b1 = vec_mergeh( a1, a0 ); \
-    b2 = vec_mergeh( a2, a0 ); \
-    b3 = vec_mergeh( a3, a0 ); \
-    a0 = vec_mergeh( b0, b2 ); \
-    a1 = vec_mergel( b0, b2 ); \
-    a2 = vec_mergeh( b1, b3 ); \
-    a3 = vec_mergel( b1, b3 ); \
-    b0 = vec_mergeh( a0, a2 ); \
-    b1 = vec_mergel( a0, a2 ); \
-    b2 = vec_mergeh( a1, a3 ); \
-    b3 = vec_mergel( a1, a3 )
-
-#define VEC_LOAD_U8_ADD_S16_STORE_U8(va)                      \
-    vdst_orig = vec_ld(0, dst);                               \
-    vdst = vec_perm(vdst_orig, zero_u8v, vdst_mask);          \
-    vdst_ss = (vec_s16) vec_mergeh(zero_u8v, vdst);         \
-    va = vec_add(va, vdst_ss);                                \
-    va_u8 = vec_packsu(va, zero_s16v);                        \
-    va_u32 = vec_splat((vec_u32)va_u8, 0);                  \
-    vec_ste(va_u32, element, (uint32_t*)dst);
-
-static void ff_h264_idct_add_altivec(uint8_t *dst, DCTELEM *block, int stride)
-{
-    vec_s16 va0, va1, va2, va3;
-    vec_s16 vz0, vz1, vz2, vz3;
-    vec_s16 vtmp0, vtmp1, vtmp2, vtmp3;
-    vec_u8 va_u8;
-    vec_u32 va_u32;
-    vec_s16 vdst_ss;
-    const vec_u16 v6us = vec_splat_u16(6);
-    vec_u8 vdst, vdst_orig;
-    vec_u8 vdst_mask = vec_lvsl(0, dst);
-    int element = ((unsigned long)dst & 0xf) >> 2;
-    LOAD_ZERO;
-
-    block[0] += 32;  /* add 32 as a DC-level for rounding */
-
-    vtmp0 = vec_ld(0,block);
-    vtmp1 = vec_sld(vtmp0, vtmp0, 8);
-    vtmp2 = vec_ld(16,block);
-    vtmp3 = vec_sld(vtmp2, vtmp2, 8);
-
-    VEC_1D_DCT(vtmp0,vtmp1,vtmp2,vtmp3,va0,va1,va2,va3);
-    VEC_TRANSPOSE_4(va0,va1,va2,va3,vtmp0,vtmp1,vtmp2,vtmp3);
-    VEC_1D_DCT(vtmp0,vtmp1,vtmp2,vtmp3,va0,va1,va2,va3);
-
-    va0 = vec_sra(va0,v6us);
-    va1 = vec_sra(va1,v6us);
-    va2 = vec_sra(va2,v6us);
-    va3 = vec_sra(va3,v6us);
-
-    VEC_LOAD_U8_ADD_S16_STORE_U8(va0);
-    dst += stride;
-    VEC_LOAD_U8_ADD_S16_STORE_U8(va1);
-    dst += stride;
-    VEC_LOAD_U8_ADD_S16_STORE_U8(va2);
-    dst += stride;
-    VEC_LOAD_U8_ADD_S16_STORE_U8(va3);
-}
-
-#define IDCT8_1D_ALTIVEC(s0, s1, s2, s3, s4, s5, s6, s7,  d0, d1, d2, d3, d4, d5, d6, d7) {\
-    /*        a0  = SRC(0) + SRC(4); */ \
-    vec_s16 a0v = vec_add(s0, s4);    \
-    /*        a2  = SRC(0) - SRC(4); */ \
-    vec_s16 a2v = vec_sub(s0, s4);    \
-    /*        a4  =           (SRC(2)>>1) - SRC(6); */ \
-    vec_s16 a4v = vec_sub(vec_sra(s2, onev), s6);    \
-    /*        a6  =           (SRC(6)>>1) + SRC(2); */ \
-    vec_s16 a6v = vec_add(vec_sra(s6, onev), s2);    \
-    /*        b0  =         a0 + a6; */ \
-    vec_s16 b0v = vec_add(a0v, a6v);  \
-    /*        b2  =         a2 + a4; */ \
-    vec_s16 b2v = vec_add(a2v, a4v);  \
-    /*        b4  =         a2 - a4; */ \
-    vec_s16 b4v = vec_sub(a2v, a4v);  \
-    /*        b6  =         a0 - a6; */ \
-    vec_s16 b6v = vec_sub(a0v, a6v);  \
-    /* a1 =  SRC(5) - SRC(3) - SRC(7) - (SRC(7)>>1); */ \
-    /*        a1 =             (SRC(5)-SRC(3)) -  (SRC(7)  +  (SRC(7)>>1)); */ \
-    vec_s16 a1v = vec_sub( vec_sub(s5, s3), vec_add(s7, vec_sra(s7, onev)) ); \
-    /* a3 =  SRC(7) + SRC(1) - SRC(3) - (SRC(3)>>1); */ \
-    /*        a3 =             (SRC(7)+SRC(1)) -  (SRC(3)  +  (SRC(3)>>1)); */ \
-    vec_s16 a3v = vec_sub( vec_add(s7, s1), vec_add(s3, vec_sra(s3, onev)) );\
-    /* a5 =  SRC(7) - SRC(1) + SRC(5) + (SRC(5)>>1); */ \
-    /*        a5 =             (SRC(7)-SRC(1)) +   SRC(5) +   (SRC(5)>>1); */ \
-    vec_s16 a5v = vec_add( vec_sub(s7, s1), vec_add(s5, vec_sra(s5, onev)) );\
-    /*        a7 =                SRC(5)+SRC(3) +  SRC(1) +   (SRC(1)>>1); */ \
-    vec_s16 a7v = vec_add( vec_add(s5, s3), vec_add(s1, vec_sra(s1, onev)) );\
-    /*        b1 =                  (a7>>2)  +  a1; */ \
-    vec_s16 b1v = vec_add( vec_sra(a7v, twov), a1v); \
-    /*        b3 =          a3 +        (a5>>2); */ \
-    vec_s16 b3v = vec_add(a3v, vec_sra(a5v, twov)); \
-    /*        b5 =                  (a3>>2)  -   a5; */ \
-    vec_s16 b5v = vec_sub( vec_sra(a3v, twov), a5v); \
-    /*        b7 =           a7 -        (a1>>2); */ \
-    vec_s16 b7v = vec_sub( a7v, vec_sra(a1v, twov)); \
-    /* DST(0,    b0 + b7); */ \
-    d0 = vec_add(b0v, b7v); \
-    /* DST(1,    b2 + b5); */ \
-    d1 = vec_add(b2v, b5v); \
-    /* DST(2,    b4 + b3); */ \
-    d2 = vec_add(b4v, b3v); \
-    /* DST(3,    b6 + b1); */ \
-    d3 = vec_add(b6v, b1v); \
-    /* DST(4,    b6 - b1); */ \
-    d4 = vec_sub(b6v, b1v); \
-    /* DST(5,    b4 - b3); */ \
-    d5 = vec_sub(b4v, b3v); \
-    /* DST(6,    b2 - b5); */ \
-    d6 = vec_sub(b2v, b5v); \
-    /* DST(7,    b0 - b7); */ \
-    d7 = vec_sub(b0v, b7v); \
-}
-
-#define ALTIVEC_STORE_SUM_CLIP(dest, idctv, perm_ldv, perm_stv, sel) { \
-    /* unaligned load */                                       \
-    vec_u8 hv = vec_ld( 0, dest );                           \
-    vec_u8 lv = vec_ld( 7, dest );                           \
-    vec_u8 dstv   = vec_perm( hv, lv, (vec_u8)perm_ldv );  \
-    vec_s16 idct_sh6 = vec_sra(idctv, sixv);                 \
-    vec_u16 dst16 = (vec_u16)vec_mergeh(zero_u8v, dstv);   \
-    vec_s16 idstsum = vec_adds(idct_sh6, (vec_s16)dst16);  \
-    vec_u8 idstsum8 = vec_packsu(zero_s16v, idstsum);        \
-    vec_u8 edgehv;                                           \
-    /* unaligned store */                                      \
-    vec_u8 bodyv  = vec_perm( idstsum8, idstsum8, perm_stv );\
-    vec_u8 edgelv = vec_perm( sel, zero_u8v, perm_stv );     \
-    lv    = vec_sel( lv, bodyv, edgelv );                      \
-    vec_st( lv, 7, dest );                                     \
-    hv    = vec_ld( 0, dest );                                 \
-    edgehv = vec_perm( zero_u8v, sel, perm_stv );              \
-    hv    = vec_sel( hv, bodyv, edgehv );                      \
-    vec_st( hv, 0, dest );                                     \
- }
-
-static void ff_h264_idct8_add_altivec( uint8_t *dst, DCTELEM *dct, int stride ) {
-    vec_s16 s0, s1, s2, s3, s4, s5, s6, s7;
-    vec_s16 d0, d1, d2, d3, d4, d5, d6, d7;
-    vec_s16 idct0, idct1, idct2, idct3, idct4, idct5, idct6, idct7;
-
-    vec_u8 perm_ldv = vec_lvsl(0, dst);
-    vec_u8 perm_stv = vec_lvsr(8, dst);
-
-    const vec_u16 onev = vec_splat_u16(1);
-    const vec_u16 twov = vec_splat_u16(2);
-    const vec_u16 sixv = vec_splat_u16(6);
-
-    const vec_u8 sel = (vec_u8) {0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1};
-    LOAD_ZERO;
-
-    dct[0] += 32; // rounding for the >>6 at the end
-
-    s0 = vec_ld(0x00, (int16_t*)dct);
-    s1 = vec_ld(0x10, (int16_t*)dct);
-    s2 = vec_ld(0x20, (int16_t*)dct);
-    s3 = vec_ld(0x30, (int16_t*)dct);
-    s4 = vec_ld(0x40, (int16_t*)dct);
-    s5 = vec_ld(0x50, (int16_t*)dct);
-    s6 = vec_ld(0x60, (int16_t*)dct);
-    s7 = vec_ld(0x70, (int16_t*)dct);
-
-    IDCT8_1D_ALTIVEC(s0, s1, s2, s3, s4, s5, s6, s7,
-                     d0, d1, d2, d3, d4, d5, d6, d7);
-
-    TRANSPOSE8( d0,  d1,  d2,  d3,  d4,  d5,  d6, d7 );
-
-    IDCT8_1D_ALTIVEC(d0,  d1,  d2,  d3,  d4,  d5,  d6, d7,
-                     idct0, idct1, idct2, idct3, idct4, idct5, idct6, idct7);
-
-    ALTIVEC_STORE_SUM_CLIP(&dst[0*stride], idct0, perm_ldv, perm_stv, sel);
-    ALTIVEC_STORE_SUM_CLIP(&dst[1*stride], idct1, perm_ldv, perm_stv, sel);
-    ALTIVEC_STORE_SUM_CLIP(&dst[2*stride], idct2, perm_ldv, perm_stv, sel);
-    ALTIVEC_STORE_SUM_CLIP(&dst[3*stride], idct3, perm_ldv, perm_stv, sel);
-    ALTIVEC_STORE_SUM_CLIP(&dst[4*stride], idct4, perm_ldv, perm_stv, sel);
-    ALTIVEC_STORE_SUM_CLIP(&dst[5*stride], idct5, perm_ldv, perm_stv, sel);
-    ALTIVEC_STORE_SUM_CLIP(&dst[6*stride], idct6, perm_ldv, perm_stv, sel);
-    ALTIVEC_STORE_SUM_CLIP(&dst[7*stride], idct7, perm_ldv, perm_stv, sel);
-}
-
-static av_always_inline void h264_idct_dc_add_internal(uint8_t *dst, DCTELEM *block, int stride, int size)
-{
-    vec_s16 dc16;
-    vec_u8 dcplus, dcminus, v0, v1, v2, v3, aligner;
-    LOAD_ZERO;
-    DECLARE_ALIGNED(16, int, dc);
-    int i;
-
-    dc = (block[0] + 32) >> 6;
-    dc16 = vec_splat((vec_s16) vec_lde(0, &dc), 1);
-
-    if (size == 4)
-        dc16 = vec_sld(dc16, zero_s16v, 8);
-    dcplus = vec_packsu(dc16, zero_s16v);
-    dcminus = vec_packsu(vec_sub(zero_s16v, dc16), zero_s16v);
-
-    aligner = vec_lvsr(0, dst);
-    dcplus = vec_perm(dcplus, dcplus, aligner);
-    dcminus = vec_perm(dcminus, dcminus, aligner);
-
-    for (i = 0; i < size; i += 4) {
-        v0 = vec_ld(0, dst+0*stride);
-        v1 = vec_ld(0, dst+1*stride);
-        v2 = vec_ld(0, dst+2*stride);
-        v3 = vec_ld(0, dst+3*stride);
-
-        v0 = vec_adds(v0, dcplus);
-        v1 = vec_adds(v1, dcplus);
-        v2 = vec_adds(v2, dcplus);
-        v3 = vec_adds(v3, dcplus);
-
-        v0 = vec_subs(v0, dcminus);
-        v1 = vec_subs(v1, dcminus);
-        v2 = vec_subs(v2, dcminus);
-        v3 = vec_subs(v3, dcminus);
-
-        vec_st(v0, 0, dst+0*stride);
-        vec_st(v1, 0, dst+1*stride);
-        vec_st(v2, 0, dst+2*stride);
-        vec_st(v3, 0, dst+3*stride);
-
-        dst += 4*stride;
-    }
-}
-
-static void h264_idct_dc_add_altivec(uint8_t *dst, DCTELEM *block, int stride)
-{
-    h264_idct_dc_add_internal(dst, block, stride, 4);
-}
-
-static void ff_h264_idct8_dc_add_altivec(uint8_t *dst, DCTELEM *block, int stride)
-{
-    h264_idct_dc_add_internal(dst, block, stride, 8);
-}
-
-static void ff_h264_idct_add16_altivec(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        int nnz = nnzc[ scan8[i] ];
-        if(nnz){
-            if(nnz==1 && block[i*16]) h264_idct_dc_add_altivec(dst + block_offset[i], block + i*16, stride);
-            else                      ff_h264_idct_add_altivec(dst + block_offset[i], block + i*16, stride);
-        }
-    }
-}
-
-static void ff_h264_idct_add16intra_altivec(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        if(nnzc[ scan8[i] ]) ff_h264_idct_add_altivec(dst + block_offset[i], block + i*16, stride);
-        else if(block[i*16]) h264_idct_dc_add_altivec(dst + block_offset[i], block + i*16, stride);
-    }
-}
-
-static void ff_h264_idct8_add4_altivec(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i+=4){
-        int nnz = nnzc[ scan8[i] ];
-        if(nnz){
-            if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_altivec(dst + block_offset[i], block + i*16, stride);
-            else                      ff_h264_idct8_add_altivec   (dst + block_offset[i], block + i*16, stride);
-        }
-    }
-}
-
-static void ff_h264_idct_add8_altivec(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=16; i<16+8; i++){
-        if(nnzc[ scan8[i] ])
-            ff_h264_idct_add_altivec(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-        else if(block[i*16])
-            h264_idct_dc_add_altivec(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-    }
-}
-
-#define transpose4x16(r0, r1, r2, r3) {      \
-    register vec_u8 r4;                    \
-    register vec_u8 r5;                    \
-    register vec_u8 r6;                    \
-    register vec_u8 r7;                    \
-                                             \
-    r4 = vec_mergeh(r0, r2);  /*0, 2 set 0*/ \
-    r5 = vec_mergel(r0, r2);  /*0, 2 set 1*/ \
-    r6 = vec_mergeh(r1, r3);  /*1, 3 set 0*/ \
-    r7 = vec_mergel(r1, r3);  /*1, 3 set 1*/ \
-                                             \
-    r0 = vec_mergeh(r4, r6);  /*all set 0*/  \
-    r1 = vec_mergel(r4, r6);  /*all set 1*/  \
-    r2 = vec_mergeh(r5, r7);  /*all set 2*/  \
-    r3 = vec_mergel(r5, r7);  /*all set 3*/  \
-}
-
-static inline void write16x4(uint8_t *dst, int dst_stride,
-                             register vec_u8 r0, register vec_u8 r1,
-                             register vec_u8 r2, register vec_u8 r3) {
-    DECLARE_ALIGNED(16, unsigned char, result)[64];
-    uint32_t *src_int = (uint32_t *)result, *dst_int = (uint32_t *)dst;
-    int int_dst_stride = dst_stride/4;
-
-    vec_st(r0, 0, result);
-    vec_st(r1, 16, result);
-    vec_st(r2, 32, result);
-    vec_st(r3, 48, result);
-    /* FIXME: there has to be a better way!!!! */
-    *dst_int = *src_int;
-    *(dst_int+   int_dst_stride) = *(src_int + 1);
-    *(dst_int+ 2*int_dst_stride) = *(src_int + 2);
-    *(dst_int+ 3*int_dst_stride) = *(src_int + 3);
-    *(dst_int+ 4*int_dst_stride) = *(src_int + 4);
-    *(dst_int+ 5*int_dst_stride) = *(src_int + 5);
-    *(dst_int+ 6*int_dst_stride) = *(src_int + 6);
-    *(dst_int+ 7*int_dst_stride) = *(src_int + 7);
-    *(dst_int+ 8*int_dst_stride) = *(src_int + 8);
-    *(dst_int+ 9*int_dst_stride) = *(src_int + 9);
-    *(dst_int+10*int_dst_stride) = *(src_int + 10);
-    *(dst_int+11*int_dst_stride) = *(src_int + 11);
-    *(dst_int+12*int_dst_stride) = *(src_int + 12);
-    *(dst_int+13*int_dst_stride) = *(src_int + 13);
-    *(dst_int+14*int_dst_stride) = *(src_int + 14);
-    *(dst_int+15*int_dst_stride) = *(src_int + 15);
-}
-
-/** \brief performs a 6x16 transpose of data in src, and stores it to dst
-    \todo FIXME: see if we can't spare some vec_lvsl() by them factorizing
-    out of unaligned_load() */
-#define readAndTranspose16x6(src, src_stride, r8, r9, r10, r11, r12, r13) {\
-    register vec_u8 r0  = unaligned_load(0,             src);            \
-    register vec_u8 r1  = unaligned_load(   src_stride, src);            \
-    register vec_u8 r2  = unaligned_load(2* src_stride, src);            \
-    register vec_u8 r3  = unaligned_load(3* src_stride, src);            \
-    register vec_u8 r4  = unaligned_load(4* src_stride, src);            \
-    register vec_u8 r5  = unaligned_load(5* src_stride, src);            \
-    register vec_u8 r6  = unaligned_load(6* src_stride, src);            \
-    register vec_u8 r7  = unaligned_load(7* src_stride, src);            \
-    register vec_u8 r14 = unaligned_load(14*src_stride, src);            \
-    register vec_u8 r15 = unaligned_load(15*src_stride, src);            \
-                                                                           \
-    r8  = unaligned_load( 8*src_stride, src);                              \
-    r9  = unaligned_load( 9*src_stride, src);                              \
-    r10 = unaligned_load(10*src_stride, src);                              \
-    r11 = unaligned_load(11*src_stride, src);                              \
-    r12 = unaligned_load(12*src_stride, src);                              \
-    r13 = unaligned_load(13*src_stride, src);                              \
-                                                                           \
-    /*Merge first pairs*/                                                  \
-    r0 = vec_mergeh(r0, r8);    /*0, 8*/                                   \
-    r1 = vec_mergeh(r1, r9);    /*1, 9*/                                   \
-    r2 = vec_mergeh(r2, r10);   /*2,10*/                                   \
-    r3 = vec_mergeh(r3, r11);   /*3,11*/                                   \
-    r4 = vec_mergeh(r4, r12);   /*4,12*/                                   \
-    r5 = vec_mergeh(r5, r13);   /*5,13*/                                   \
-    r6 = vec_mergeh(r6, r14);   /*6,14*/                                   \
-    r7 = vec_mergeh(r7, r15);   /*7,15*/                                   \
-                                                                           \
-    /*Merge second pairs*/                                                 \
-    r8  = vec_mergeh(r0, r4);   /*0,4, 8,12 set 0*/                        \
-    r9  = vec_mergel(r0, r4);   /*0,4, 8,12 set 1*/                        \
-    r10 = vec_mergeh(r1, r5);   /*1,5, 9,13 set 0*/                        \
-    r11 = vec_mergel(r1, r5);   /*1,5, 9,13 set 1*/                        \
-    r12 = vec_mergeh(r2, r6);   /*2,6,10,14 set 0*/                        \
-    r13 = vec_mergel(r2, r6);   /*2,6,10,14 set 1*/                        \
-    r14 = vec_mergeh(r3, r7);   /*3,7,11,15 set 0*/                        \
-    r15 = vec_mergel(r3, r7);   /*3,7,11,15 set 1*/                        \
-                                                                           \
-    /*Third merge*/                                                        \
-    r0 = vec_mergeh(r8,  r12);  /*0,2,4,6,8,10,12,14 set 0*/               \
-    r1 = vec_mergel(r8,  r12);  /*0,2,4,6,8,10,12,14 set 1*/               \
-    r2 = vec_mergeh(r9,  r13);  /*0,2,4,6,8,10,12,14 set 2*/               \
-    r4 = vec_mergeh(r10, r14);  /*1,3,5,7,9,11,13,15 set 0*/               \
-    r5 = vec_mergel(r10, r14);  /*1,3,5,7,9,11,13,15 set 1*/               \
-    r6 = vec_mergeh(r11, r15);  /*1,3,5,7,9,11,13,15 set 2*/               \
-    /* Don't need to compute 3 and 7*/                                     \
-                                                                           \
-    /*Final merge*/                                                        \
-    r8  = vec_mergeh(r0, r4);   /*all set 0*/                              \
-    r9  = vec_mergel(r0, r4);   /*all set 1*/                              \
-    r10 = vec_mergeh(r1, r5);   /*all set 2*/                              \
-    r11 = vec_mergel(r1, r5);   /*all set 3*/                              \
-    r12 = vec_mergeh(r2, r6);   /*all set 4*/                              \
-    r13 = vec_mergel(r2, r6);   /*all set 5*/                              \
-    /* Don't need to compute 14 and 15*/                                   \
-                                                                           \
-}
-
-// out: o = |x-y| < a
-static inline vec_u8 diff_lt_altivec ( register vec_u8 x,
-                                         register vec_u8 y,
-                                         register vec_u8 a) {
-
-    register vec_u8 diff = vec_subs(x, y);
-    register vec_u8 diffneg = vec_subs(y, x);
-    register vec_u8 o = vec_or(diff, diffneg); /* |x-y| */
-    o = (vec_u8)vec_cmplt(o, a);
-    return o;
-}
-
-static inline vec_u8 h264_deblock_mask ( register vec_u8 p0,
-                                           register vec_u8 p1,
-                                           register vec_u8 q0,
-                                           register vec_u8 q1,
-                                           register vec_u8 alpha,
-                                           register vec_u8 beta) {
-
-    register vec_u8 mask;
-    register vec_u8 tempmask;
-
-    mask = diff_lt_altivec(p0, q0, alpha);
-    tempmask = diff_lt_altivec(p1, p0, beta);
-    mask = vec_and(mask, tempmask);
-    tempmask = diff_lt_altivec(q1, q0, beta);
-    mask = vec_and(mask, tempmask);
-
-    return mask;
-}
-
-// out: newp1 = clip((p2 + ((p0 + q0 + 1) >> 1)) >> 1, p1-tc0, p1+tc0)
-static inline vec_u8 h264_deblock_q1(register vec_u8 p0,
-                                       register vec_u8 p1,
-                                       register vec_u8 p2,
-                                       register vec_u8 q0,
-                                       register vec_u8 tc0) {
-
-    register vec_u8 average = vec_avg(p0, q0);
-    register vec_u8 temp;
-    register vec_u8 uncliped;
-    register vec_u8 ones;
-    register vec_u8 max;
-    register vec_u8 min;
-    register vec_u8 newp1;
-
-    temp = vec_xor(average, p2);
-    average = vec_avg(average, p2);     /*avg(p2, avg(p0, q0)) */
-    ones = vec_splat_u8(1);
-    temp = vec_and(temp, ones);         /*(p2^avg(p0, q0)) & 1 */
-    uncliped = vec_subs(average, temp); /*(p2+((p0+q0+1)>>1))>>1 */
-    max = vec_adds(p1, tc0);
-    min = vec_subs(p1, tc0);
-    newp1 = vec_max(min, uncliped);
-    newp1 = vec_min(max, newp1);
-    return newp1;
-}
-
-#define h264_deblock_p0_q0(p0, p1, q0, q1, tc0masked) {                                           \
-                                                                                                  \
-    const vec_u8 A0v = vec_sl(vec_splat_u8(10), vec_splat_u8(4));                               \
-                                                                                                  \
-    register vec_u8 pq0bit = vec_xor(p0,q0);                                                    \
-    register vec_u8 q1minus;                                                                    \
-    register vec_u8 p0minus;                                                                    \
-    register vec_u8 stage1;                                                                     \
-    register vec_u8 stage2;                                                                     \
-    register vec_u8 vec160;                                                                     \
-    register vec_u8 delta;                                                                      \
-    register vec_u8 deltaneg;                                                                   \
-                                                                                                  \
-    q1minus = vec_nor(q1, q1);                 /* 255 - q1 */                                     \
-    stage1 = vec_avg(p1, q1minus);             /* (p1 - q1 + 256)>>1 */                           \
-    stage2 = vec_sr(stage1, vec_splat_u8(1));  /* (p1 - q1 + 256)>>2 = 64 + (p1 - q1) >> 2 */     \
-    p0minus = vec_nor(p0, p0);                 /* 255 - p0 */                                     \
-    stage1 = vec_avg(q0, p0minus);             /* (q0 - p0 + 256)>>1 */                           \
-    pq0bit = vec_and(pq0bit, vec_splat_u8(1));                                                    \
-    stage2 = vec_avg(stage2, pq0bit);          /* 32 + ((q0 - p0)&1 + (p1 - q1) >> 2 + 1) >> 1 */ \
-    stage2 = vec_adds(stage2, stage1);         /* 160 + ((p0 - q0) + (p1 - q1) >> 2 + 1) >> 1 */  \
-    vec160 = vec_ld(0, &A0v);                                                                     \
-    deltaneg = vec_subs(vec160, stage2);       /* -d */                                           \
-    delta = vec_subs(stage2, vec160);          /* d */                                            \
-    deltaneg = vec_min(tc0masked, deltaneg);                                                      \
-    delta = vec_min(tc0masked, delta);                                                            \
-    p0 = vec_subs(p0, deltaneg);                                                                  \
-    q0 = vec_subs(q0, delta);                                                                     \
-    p0 = vec_adds(p0, delta);                                                                     \
-    q0 = vec_adds(q0, deltaneg);                                                                  \
-}
-
-#define h264_loop_filter_luma_altivec(p2, p1, p0, q0, q1, q2, alpha, beta, tc0) {            \
-    DECLARE_ALIGNED(16, unsigned char, temp)[16];                                             \
-    register vec_u8 alphavec;                                                              \
-    register vec_u8 betavec;                                                               \
-    register vec_u8 mask;                                                                  \
-    register vec_u8 p1mask;                                                                \
-    register vec_u8 q1mask;                                                                \
-    register vector signed   char tc0vec;                                                    \
-    register vec_u8 finaltc0;                                                              \
-    register vec_u8 tc0masked;                                                             \
-    register vec_u8 newp1;                                                                 \
-    register vec_u8 newq1;                                                                 \
-                                                                                             \
-    temp[0] = alpha;                                                                         \
-    temp[1] = beta;                                                                          \
-    alphavec = vec_ld(0, temp);                                                              \
-    betavec = vec_splat(alphavec, 0x1);                                                      \
-    alphavec = vec_splat(alphavec, 0x0);                                                     \
-    mask = h264_deblock_mask(p0, p1, q0, q1, alphavec, betavec); /*if in block */            \
-                                                                                             \
-    *((int *)temp) = *((int *)tc0);                                                          \
-    tc0vec = vec_ld(0, (signed char*)temp);                                                  \
-    tc0vec = vec_mergeh(tc0vec, tc0vec);                                                     \
-    tc0vec = vec_mergeh(tc0vec, tc0vec);                                                     \
-    mask = vec_and(mask, vec_cmpgt(tc0vec, vec_splat_s8(-1)));  /* if tc0[i] >= 0 */         \
-    finaltc0 = vec_and((vec_u8)tc0vec, mask);     /* tc = tc0 */                           \
-                                                                                             \
-    p1mask = diff_lt_altivec(p2, p0, betavec);                                               \
-    p1mask = vec_and(p1mask, mask);                             /* if ( |p2 - p0| < beta) */ \
-    tc0masked = vec_and(p1mask, (vec_u8)tc0vec);                                           \
-    finaltc0 = vec_sub(finaltc0, p1mask);                       /* tc++ */                   \
-    newp1 = h264_deblock_q1(p0, p1, p2, q0, tc0masked);                                      \
-    /*end if*/                                                                               \
-                                                                                             \
-    q1mask = diff_lt_altivec(q2, q0, betavec);                                               \
-    q1mask = vec_and(q1mask, mask);                             /* if ( |q2 - q0| < beta ) */\
-    tc0masked = vec_and(q1mask, (vec_u8)tc0vec);                                           \
-    finaltc0 = vec_sub(finaltc0, q1mask);                       /* tc++ */                   \
-    newq1 = h264_deblock_q1(p0, q1, q2, q0, tc0masked);                                      \
-    /*end if*/                                                                               \
-                                                                                             \
-    h264_deblock_p0_q0(p0, p1, q0, q1, finaltc0);                                            \
-    p1 = newp1;                                                                              \
-    q1 = newq1;                                                                              \
-}
-
-static void h264_v_loop_filter_luma_altivec(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) {
-
-    if ((tc0[0] & tc0[1] & tc0[2] & tc0[3]) >= 0) {
-        register vec_u8 p2 = vec_ld(-3*stride, pix);
-        register vec_u8 p1 = vec_ld(-2*stride, pix);
-        register vec_u8 p0 = vec_ld(-1*stride, pix);
-        register vec_u8 q0 = vec_ld(0, pix);
-        register vec_u8 q1 = vec_ld(stride, pix);
-        register vec_u8 q2 = vec_ld(2*stride, pix);
-        h264_loop_filter_luma_altivec(p2, p1, p0, q0, q1, q2, alpha, beta, tc0);
-        vec_st(p1, -2*stride, pix);
-        vec_st(p0, -1*stride, pix);
-        vec_st(q0, 0, pix);
-        vec_st(q1, stride, pix);
-    }
-}
-
-static void h264_h_loop_filter_luma_altivec(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0) {
-
-    register vec_u8 line0, line1, line2, line3, line4, line5;
-    if ((tc0[0] & tc0[1] & tc0[2] & tc0[3]) < 0)
-        return;
-    readAndTranspose16x6(pix-3, stride, line0, line1, line2, line3, line4, line5);
-    h264_loop_filter_luma_altivec(line0, line1, line2, line3, line4, line5, alpha, beta, tc0);
-    transpose4x16(line1, line2, line3, line4);
-    write16x4(pix-2, stride, line1, line2, line3, line4);
-}
-
-static av_always_inline
-void weight_h264_WxH_altivec(uint8_t *block, int stride, int log2_denom, int weight, int offset, int w, int h)
-{
-    int y, aligned;
-    vec_u8 vblock;
-    vec_s16 vtemp, vweight, voffset, v0, v1;
-    vec_u16 vlog2_denom;
-    DECLARE_ALIGNED(16, int32_t, temp)[4];
-    LOAD_ZERO;
-
-    offset <<= log2_denom;
-    if(log2_denom) offset += 1<<(log2_denom-1);
-    temp[0] = log2_denom;
-    temp[1] = weight;
-    temp[2] = offset;
-
-    vtemp = (vec_s16)vec_ld(0, temp);
-    vlog2_denom = (vec_u16)vec_splat(vtemp, 1);
-    vweight = vec_splat(vtemp, 3);
-    voffset = vec_splat(vtemp, 5);
-    aligned = !((unsigned long)block & 0xf);
-
-    for (y=0; y<h; y++) {
-        vblock = vec_ld(0, block);
-
-        v0 = (vec_s16)vec_mergeh(zero_u8v, vblock);
-        v1 = (vec_s16)vec_mergel(zero_u8v, vblock);
-
-        if (w == 16 || aligned) {
-            v0 = vec_mladd(v0, vweight, zero_s16v);
-            v0 = vec_adds(v0, voffset);
-            v0 = vec_sra(v0, vlog2_denom);
-        }
-        if (w == 16 || !aligned) {
-            v1 = vec_mladd(v1, vweight, zero_s16v);
-            v1 = vec_adds(v1, voffset);
-            v1 = vec_sra(v1, vlog2_denom);
-        }
-        vblock = vec_packsu(v0, v1);
-        vec_st(vblock, 0, block);
-
-        block += stride;
-    }
-}
-
-static av_always_inline
-void biweight_h264_WxH_altivec(uint8_t *dst, uint8_t *src, int stride, int log2_denom,
-                               int weightd, int weights, int offset, int w, int h)
-{
-    int y, dst_aligned, src_aligned;
-    vec_u8 vsrc, vdst;
-    vec_s16 vtemp, vweights, vweightd, voffset, v0, v1, v2, v3;
-    vec_u16 vlog2_denom;
-    DECLARE_ALIGNED(16, int32_t, temp)[4];
-    LOAD_ZERO;
-
-    offset = ((offset + 1) | 1) << log2_denom;
-    temp[0] = log2_denom+1;
-    temp[1] = weights;
-    temp[2] = weightd;
-    temp[3] = offset;
-
-    vtemp = (vec_s16)vec_ld(0, temp);
-    vlog2_denom = (vec_u16)vec_splat(vtemp, 1);
-    vweights = vec_splat(vtemp, 3);
-    vweightd = vec_splat(vtemp, 5);
-    voffset = vec_splat(vtemp, 7);
-    dst_aligned = !((unsigned long)dst & 0xf);
-    src_aligned = !((unsigned long)src & 0xf);
-
-    for (y=0; y<h; y++) {
-        vdst = vec_ld(0, dst);
-        vsrc = vec_ld(0, src);
-
-        v0 = (vec_s16)vec_mergeh(zero_u8v, vdst);
-        v1 = (vec_s16)vec_mergel(zero_u8v, vdst);
-        v2 = (vec_s16)vec_mergeh(zero_u8v, vsrc);
-        v3 = (vec_s16)vec_mergel(zero_u8v, vsrc);
-
-        if (w == 8) {
-            if (src_aligned)
-                v3 = v2;
-            else
-                v2 = v3;
-        }
-
-        if (w == 16 || dst_aligned) {
-            v0 = vec_mladd(v0, vweightd, zero_s16v);
-            v2 = vec_mladd(v2, vweights, zero_s16v);
-
-            v0 = vec_adds(v0, voffset);
-            v0 = vec_adds(v0, v2);
-            v0 = vec_sra(v0, vlog2_denom);
-        }
-        if (w == 16 || !dst_aligned) {
-            v1 = vec_mladd(v1, vweightd, zero_s16v);
-            v3 = vec_mladd(v3, vweights, zero_s16v);
-
-            v1 = vec_adds(v1, voffset);
-            v1 = vec_adds(v1, v3);
-            v1 = vec_sra(v1, vlog2_denom);
-        }
-        vdst = vec_packsu(v0, v1);
-        vec_st(vdst, 0, dst);
-
-        dst += stride;
-        src += stride;
-    }
-}
-
-#define H264_WEIGHT(W,H) \
-static void ff_weight_h264_pixels ## W ## x ## H ## _altivec(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \
-    weight_h264_WxH_altivec(block, stride, log2_denom, weight, offset, W, H); \
-}\
-static void ff_biweight_h264_pixels ## W ## x ## H ## _altivec(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset){ \
-    biweight_h264_WxH_altivec(dst, src, stride, log2_denom, weightd, weights, offset, W, H); \
-}
-
-H264_WEIGHT(16,16)
-H264_WEIGHT(16, 8)
-H264_WEIGHT( 8,16)
-H264_WEIGHT( 8, 8)
-H264_WEIGHT( 8, 4)
-
-void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx) {
-
-    if (has_altivec()) {
-        c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_altivec;
-        c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_altivec;
-        c->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_altivec;
-        c->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_altivec;
-
-#define dspfunc(PFX, IDX, NUM) \
-        c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_altivec; \
-        c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_altivec; \
-        c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_altivec; \
-        c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_altivec; \
-        c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_altivec; \
-        c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_altivec; \
-        c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_altivec; \
-        c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_altivec
-
-        dspfunc(put_h264_qpel, 0, 16);
-        dspfunc(avg_h264_qpel, 0, 16);
-#undef dspfunc
-    }
-}
-
-void ff_h264dsp_init_ppc(H264DSPContext *c)
-{
-    if (has_altivec()) {
-        c->h264_idct_add = ff_h264_idct_add_altivec;
-        c->h264_idct_add8 = ff_h264_idct_add8_altivec;
-        c->h264_idct_add16 = ff_h264_idct_add16_altivec;
-        c->h264_idct_add16intra = ff_h264_idct_add16intra_altivec;
-        c->h264_idct_dc_add= h264_idct_dc_add_altivec;
-        c->h264_idct8_dc_add = ff_h264_idct8_dc_add_altivec;
-        c->h264_idct8_add = ff_h264_idct8_add_altivec;
-        c->h264_idct8_add4 = ff_h264_idct8_add4_altivec;
-        c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_altivec;
-        c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_altivec;
-
-        c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels16x16_altivec;
-        c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels16x8_altivec;
-        c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels8x16_altivec;
-        c->weight_h264_pixels_tab[3] = ff_weight_h264_pixels8x8_altivec;
-        c->weight_h264_pixels_tab[4] = ff_weight_h264_pixels8x4_altivec;
-        c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels16x16_altivec;
-        c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels16x8_altivec;
-        c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels8x16_altivec;
-        c->biweight_h264_pixels_tab[3] = ff_biweight_h264_pixels8x8_altivec;
-        c->biweight_h264_pixels_tab[4] = ff_biweight_h264_pixels8x4_altivec;
-    }
-}
diff --git a/libavcodec/ppc/h264_template_altivec.c b/libavcodec/ppc/h264_template_altivec.c
deleted file mode 100644
index c0a4eb7..0000000
--- a/libavcodec/ppc/h264_template_altivec.c
+++ /dev/null
@@ -1,783 +0,0 @@
-/*
- * Copyright (c) 2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define DEBUG_ALIGNMENT
-#ifdef DEBUG_ALIGNMENT
-#define ASSERT_ALIGNED(ptr) assert(((unsigned long)ptr&0x0000000F));
-#else
-#define ASSERT_ALIGNED(ptr) ;
-#endif
-
-/* this code assume that stride % 16 == 0 */
-
-#define CHROMA_MC8_ALTIVEC_CORE(BIAS1, BIAS2) \
-        vsrc2ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc2uc);\
-        vsrc3ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc3uc);\
-\
-        psum = vec_mladd(vA, vsrc0ssH, BIAS1);\
-        psum = vec_mladd(vB, vsrc1ssH, psum);\
-        psum = vec_mladd(vC, vsrc2ssH, psum);\
-        psum = vec_mladd(vD, vsrc3ssH, psum);\
-        psum = BIAS2(psum);\
-        psum = vec_sr(psum, v6us);\
-\
-        vdst = vec_ld(0, dst);\
-        ppsum = (vec_u8)vec_pack(psum, psum);\
-        vfdst = vec_perm(vdst, ppsum, fperm);\
-\
-        OP_U8_ALTIVEC(fsum, vfdst, vdst);\
-\
-        vec_st(fsum, 0, dst);\
-\
-        vsrc0ssH = vsrc2ssH;\
-        vsrc1ssH = vsrc3ssH;\
-\
-        dst += stride;\
-        src += stride;
-
-#define CHROMA_MC8_ALTIVEC_CORE_SIMPLE \
-\
-        vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc);\
-        vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc);\
-\
-        psum = vec_mladd(vA, vsrc0ssH, v32ss);\
-        psum = vec_mladd(vE, vsrc1ssH, psum);\
-        psum = vec_sr(psum, v6us);\
-\
-        vdst = vec_ld(0, dst);\
-        ppsum = (vec_u8)vec_pack(psum, psum);\
-        vfdst = vec_perm(vdst, ppsum, fperm);\
-\
-        OP_U8_ALTIVEC(fsum, vfdst, vdst);\
-\
-        vec_st(fsum, 0, dst);\
-\
-        dst += stride;\
-        src += stride;
-
-#define noop(a) a
-#define add28(a) vec_add(v28ss, a)
-
-static void PREFIX_h264_chroma_mc8_altivec(uint8_t * dst, uint8_t * src,
-                                    int stride, int h, int x, int y) {
-  POWERPC_PERF_DECLARE(PREFIX_h264_chroma_mc8_num, 1);
-    DECLARE_ALIGNED(16, signed int, ABCD)[4] =
-                        {((8 - x) * (8 - y)),
-                         ((    x) * (8 - y)),
-                         ((8 - x) * (    y)),
-                         ((    x) * (    y))};
-    register int i;
-    vec_u8 fperm;
-    const vec_s32 vABCD = vec_ld(0, ABCD);
-    const vec_s16 vA = vec_splat((vec_s16)vABCD, 1);
-    const vec_s16 vB = vec_splat((vec_s16)vABCD, 3);
-    const vec_s16 vC = vec_splat((vec_s16)vABCD, 5);
-    const vec_s16 vD = vec_splat((vec_s16)vABCD, 7);
-    LOAD_ZERO;
-    const vec_s16 v32ss = vec_sl(vec_splat_s16(1),vec_splat_u16(5));
-    const vec_u16 v6us = vec_splat_u16(6);
-    register int loadSecond = (((unsigned long)src) % 16) <= 7 ? 0 : 1;
-    register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0;
-
-    vec_u8 vsrcAuc, av_uninit(vsrcBuc), vsrcperm0, vsrcperm1;
-    vec_u8 vsrc0uc, vsrc1uc;
-    vec_s16 vsrc0ssH, vsrc1ssH;
-    vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;
-    vec_s16 vsrc2ssH, vsrc3ssH, psum;
-    vec_u8 vdst, ppsum, vfdst, fsum;
-
-  POWERPC_PERF_START_COUNT(PREFIX_h264_chroma_mc8_num, 1);
-
-    if (((unsigned long)dst) % 16 == 0) {
-        fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
-                         0x14, 0x15, 0x16, 0x17,
-                         0x08, 0x09, 0x0A, 0x0B,
-                         0x0C, 0x0D, 0x0E, 0x0F};
-    } else {
-        fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,
-                         0x04, 0x05, 0x06, 0x07,
-                         0x18, 0x19, 0x1A, 0x1B,
-                         0x1C, 0x1D, 0x1E, 0x1F};
-    }
-
-    vsrcAuc = vec_ld(0, src);
-
-    if (loadSecond)
-        vsrcBuc = vec_ld(16, src);
-    vsrcperm0 = vec_lvsl(0, src);
-    vsrcperm1 = vec_lvsl(1, src);
-
-    vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);
-    if (reallyBadAlign)
-        vsrc1uc = vsrcBuc;
-    else
-        vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);
-
-    vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc0uc);
-    vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v,(vec_u8)vsrc1uc);
-
-    if (ABCD[3]) {
-        if (!loadSecond) {// -> !reallyBadAlign
-            for (i = 0 ; i < h ; i++) {
-                vsrcCuc = vec_ld(stride + 0, src);
-                vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
-                vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
-
-                CHROMA_MC8_ALTIVEC_CORE(v32ss, noop)
-            }
-        } else {
-            vec_u8 vsrcDuc;
-            for (i = 0 ; i < h ; i++) {
-                vsrcCuc = vec_ld(stride + 0, src);
-                vsrcDuc = vec_ld(stride + 16, src);
-                vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
-                if (reallyBadAlign)
-                    vsrc3uc = vsrcDuc;
-                else
-                    vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
-
-                CHROMA_MC8_ALTIVEC_CORE(v32ss, noop)
-            }
-        }
-    } else {
-        const vec_s16 vE = vec_add(vB, vC);
-        if (ABCD[2]) { // x == 0 B == 0
-            if (!loadSecond) {// -> !reallyBadAlign
-                for (i = 0 ; i < h ; i++) {
-                    vsrcCuc = vec_ld(stride + 0, src);
-                    vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
-                    CHROMA_MC8_ALTIVEC_CORE_SIMPLE
-
-                    vsrc0uc = vsrc1uc;
-                }
-            } else {
-                vec_u8 vsrcDuc;
-                for (i = 0 ; i < h ; i++) {
-                    vsrcCuc = vec_ld(stride + 0, src);
-                    vsrcDuc = vec_ld(stride + 15, src);
-                    vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
-                    CHROMA_MC8_ALTIVEC_CORE_SIMPLE
-
-                    vsrc0uc = vsrc1uc;
-                }
-            }
-        } else { // y == 0 C == 0
-            if (!loadSecond) {// -> !reallyBadAlign
-                for (i = 0 ; i < h ; i++) {
-                    vsrcCuc = vec_ld(0, src);
-                    vsrc0uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
-                    vsrc1uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
-
-                    CHROMA_MC8_ALTIVEC_CORE_SIMPLE
-                }
-            } else {
-                vec_u8 vsrcDuc;
-                for (i = 0 ; i < h ; i++) {
-                    vsrcCuc = vec_ld(0, src);
-                    vsrcDuc = vec_ld(15, src);
-                    vsrc0uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
-                    if (reallyBadAlign)
-                        vsrc1uc = vsrcDuc;
-                    else
-                        vsrc1uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
-
-                    CHROMA_MC8_ALTIVEC_CORE_SIMPLE
-                }
-            }
-        }
-    }
-    POWERPC_PERF_STOP_COUNT(PREFIX_h264_chroma_mc8_num, 1);
-}
-
-/* this code assume that stride % 16 == 0 */
-static void PREFIX_no_rnd_vc1_chroma_mc8_altivec(uint8_t * dst, uint8_t * src, int stride, int h, int x, int y) {
-   DECLARE_ALIGNED(16, signed int, ABCD)[4] =
-                        {((8 - x) * (8 - y)),
-                         ((    x) * (8 - y)),
-                         ((8 - x) * (    y)),
-                         ((    x) * (    y))};
-    register int i;
-    vec_u8 fperm;
-    const vec_s32 vABCD = vec_ld(0, ABCD);
-    const vec_s16 vA = vec_splat((vec_s16)vABCD, 1);
-    const vec_s16 vB = vec_splat((vec_s16)vABCD, 3);
-    const vec_s16 vC = vec_splat((vec_s16)vABCD, 5);
-    const vec_s16 vD = vec_splat((vec_s16)vABCD, 7);
-    LOAD_ZERO;
-    const vec_s16 v28ss = vec_sub(vec_sl(vec_splat_s16(1),vec_splat_u16(5)),vec_splat_s16(4));
-    const vec_u16 v6us  = vec_splat_u16(6);
-    register int loadSecond     = (((unsigned long)src) % 16) <= 7 ? 0 : 1;
-    register int reallyBadAlign = (((unsigned long)src) % 16) == 15 ? 1 : 0;
-
-    vec_u8 vsrcAuc, av_uninit(vsrcBuc), vsrcperm0, vsrcperm1;
-    vec_u8 vsrc0uc, vsrc1uc;
-    vec_s16 vsrc0ssH, vsrc1ssH;
-    vec_u8 vsrcCuc, vsrc2uc, vsrc3uc;
-    vec_s16 vsrc2ssH, vsrc3ssH, psum;
-    vec_u8 vdst, ppsum, vfdst, fsum;
-
-    if (((unsigned long)dst) % 16 == 0) {
-        fperm = (vec_u8){0x10, 0x11, 0x12, 0x13,
-                         0x14, 0x15, 0x16, 0x17,
-                         0x08, 0x09, 0x0A, 0x0B,
-                         0x0C, 0x0D, 0x0E, 0x0F};
-    } else {
-        fperm = (vec_u8){0x00, 0x01, 0x02, 0x03,
-                         0x04, 0x05, 0x06, 0x07,
-                         0x18, 0x19, 0x1A, 0x1B,
-                         0x1C, 0x1D, 0x1E, 0x1F};
-    }
-
-    vsrcAuc = vec_ld(0, src);
-
-    if (loadSecond)
-        vsrcBuc = vec_ld(16, src);
-    vsrcperm0 = vec_lvsl(0, src);
-    vsrcperm1 = vec_lvsl(1, src);
-
-    vsrc0uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm0);
-    if (reallyBadAlign)
-        vsrc1uc = vsrcBuc;
-    else
-        vsrc1uc = vec_perm(vsrcAuc, vsrcBuc, vsrcperm1);
-
-    vsrc0ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc0uc);
-    vsrc1ssH = (vec_s16)vec_mergeh(zero_u8v, (vec_u8)vsrc1uc);
-
-    if (!loadSecond) {// -> !reallyBadAlign
-        for (i = 0 ; i < h ; i++) {
-
-
-            vsrcCuc = vec_ld(stride + 0, src);
-
-            vsrc2uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm0);
-            vsrc3uc = vec_perm(vsrcCuc, vsrcCuc, vsrcperm1);
-
-            CHROMA_MC8_ALTIVEC_CORE(vec_splat_s16(0), add28)
-        }
-    } else {
-        vec_u8 vsrcDuc;
-        for (i = 0 ; i < h ; i++) {
-            vsrcCuc = vec_ld(stride + 0, src);
-            vsrcDuc = vec_ld(stride + 16, src);
-
-            vsrc2uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm0);
-            if (reallyBadAlign)
-                vsrc3uc = vsrcDuc;
-            else
-                vsrc3uc = vec_perm(vsrcCuc, vsrcDuc, vsrcperm1);
-
-            CHROMA_MC8_ALTIVEC_CORE(vec_splat_s16(0), add28)
-        }
-    }
-}
-
-#undef noop
-#undef add28
-#undef CHROMA_MC8_ALTIVEC_CORE
-
-/* this code assume stride % 16 == 0 */
-static void PREFIX_h264_qpel16_h_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
-    POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_h_lowpass_num, 1);
-    register int i;
-
-    LOAD_ZERO;
-    const vec_u8 permM2 = vec_lvsl(-2, src);
-    const vec_u8 permM1 = vec_lvsl(-1, src);
-    const vec_u8 permP0 = vec_lvsl(+0, src);
-    const vec_u8 permP1 = vec_lvsl(+1, src);
-    const vec_u8 permP2 = vec_lvsl(+2, src);
-    const vec_u8 permP3 = vec_lvsl(+3, src);
-    const vec_s16 v5ss = vec_splat_s16(5);
-    const vec_u16 v5us = vec_splat_u16(5);
-    const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
-    const vec_s16 v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4));
-
-    vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;
-
-    register int align = ((((unsigned long)src) - 2) % 16);
-
-    vec_s16 srcP0A, srcP0B, srcP1A, srcP1B,
-              srcP2A, srcP2B, srcP3A, srcP3B,
-              srcM1A, srcM1B, srcM2A, srcM2B,
-              sum1A, sum1B, sum2A, sum2B, sum3A, sum3B,
-              pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
-              psumA, psumB, sumA, sumB;
-
-    vec_u8 sum, vdst, fsum;
-
-    POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_h_lowpass_num, 1);
-
-    for (i = 0 ; i < 16 ; i ++) {
-        vec_u8 srcR1 = vec_ld(-2, src);
-        vec_u8 srcR2 = vec_ld(14, src);
-
-        switch (align) {
-        default: {
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = vec_perm(srcR1, srcR2, permP1);
-            srcP2 = vec_perm(srcR1, srcR2, permP2);
-            srcP3 = vec_perm(srcR1, srcR2, permP3);
-        } break;
-        case 11: {
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = vec_perm(srcR1, srcR2, permP1);
-            srcP2 = vec_perm(srcR1, srcR2, permP2);
-            srcP3 = srcR2;
-        } break;
-        case 12: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = vec_perm(srcR1, srcR2, permP1);
-            srcP2 = srcR2;
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        case 13: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = srcR2;
-            srcP2 = vec_perm(srcR2, srcR3, permP2);
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        case 14: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = srcR2;
-            srcP1 = vec_perm(srcR2, srcR3, permP1);
-            srcP2 = vec_perm(srcR2, srcR3, permP2);
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        case 15: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = srcR2;
-            srcP0 = vec_perm(srcR2, srcR3, permP0);
-            srcP1 = vec_perm(srcR2, srcR3, permP1);
-            srcP2 = vec_perm(srcR2, srcR3, permP2);
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        }
-
-        srcP0A = (vec_s16) vec_mergeh(zero_u8v, srcP0);
-        srcP0B = (vec_s16) vec_mergel(zero_u8v, srcP0);
-        srcP1A = (vec_s16) vec_mergeh(zero_u8v, srcP1);
-        srcP1B = (vec_s16) vec_mergel(zero_u8v, srcP1);
-
-        srcP2A = (vec_s16) vec_mergeh(zero_u8v, srcP2);
-        srcP2B = (vec_s16) vec_mergel(zero_u8v, srcP2);
-        srcP3A = (vec_s16) vec_mergeh(zero_u8v, srcP3);
-        srcP3B = (vec_s16) vec_mergel(zero_u8v, srcP3);
-
-        srcM1A = (vec_s16) vec_mergeh(zero_u8v, srcM1);
-        srcM1B = (vec_s16) vec_mergel(zero_u8v, srcM1);
-        srcM2A = (vec_s16) vec_mergeh(zero_u8v, srcM2);
-        srcM2B = (vec_s16) vec_mergel(zero_u8v, srcM2);
-
-        sum1A = vec_adds(srcP0A, srcP1A);
-        sum1B = vec_adds(srcP0B, srcP1B);
-        sum2A = vec_adds(srcM1A, srcP2A);
-        sum2B = vec_adds(srcM1B, srcP2B);
-        sum3A = vec_adds(srcM2A, srcP3A);
-        sum3B = vec_adds(srcM2B, srcP3B);
-
-        pp1A = vec_mladd(sum1A, v20ss, v16ss);
-        pp1B = vec_mladd(sum1B, v20ss, v16ss);
-
-        pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
-        pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
-
-        pp3A = vec_add(sum3A, pp1A);
-        pp3B = vec_add(sum3B, pp1B);
-
-        psumA = vec_sub(pp3A, pp2A);
-        psumB = vec_sub(pp3B, pp2B);
-
-        sumA = vec_sra(psumA, v5us);
-        sumB = vec_sra(psumB, v5us);
-
-        sum = vec_packsu(sumA, sumB);
-
-        ASSERT_ALIGNED(dst);
-        vdst = vec_ld(0, dst);
-
-        OP_U8_ALTIVEC(fsum, sum, vdst);
-
-        vec_st(fsum, 0, dst);
-
-        src += srcStride;
-        dst += dstStride;
-    }
-    POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_h_lowpass_num, 1);
-}
-
-/* this code assume stride % 16 == 0 */
-static void PREFIX_h264_qpel16_v_lowpass_altivec(uint8_t * dst, uint8_t * src, int dstStride, int srcStride) {
-    POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_v_lowpass_num, 1);
-
-    register int i;
-
-    LOAD_ZERO;
-    const vec_u8 perm = vec_lvsl(0, src);
-    const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
-    const vec_u16 v5us = vec_splat_u16(5);
-    const vec_s16 v5ss = vec_splat_s16(5);
-    const vec_s16 v16ss = vec_sl(vec_splat_s16(1),vec_splat_u16(4));
-
-    uint8_t *srcbis = src - (srcStride * 2);
-
-    const vec_u8 srcM2a = vec_ld(0, srcbis);
-    const vec_u8 srcM2b = vec_ld(16, srcbis);
-    const vec_u8 srcM2 = vec_perm(srcM2a, srcM2b, perm);
-    //srcbis += srcStride;
-    const vec_u8 srcM1a = vec_ld(0, srcbis += srcStride);
-    const vec_u8 srcM1b = vec_ld(16, srcbis);
-    const vec_u8 srcM1 = vec_perm(srcM1a, srcM1b, perm);
-    //srcbis += srcStride;
-    const vec_u8 srcP0a = vec_ld(0, srcbis += srcStride);
-    const vec_u8 srcP0b = vec_ld(16, srcbis);
-    const vec_u8 srcP0 = vec_perm(srcP0a, srcP0b, perm);
-    //srcbis += srcStride;
-    const vec_u8 srcP1a = vec_ld(0, srcbis += srcStride);
-    const vec_u8 srcP1b = vec_ld(16, srcbis);
-    const vec_u8 srcP1 = vec_perm(srcP1a, srcP1b, perm);
-    //srcbis += srcStride;
-    const vec_u8 srcP2a = vec_ld(0, srcbis += srcStride);
-    const vec_u8 srcP2b = vec_ld(16, srcbis);
-    const vec_u8 srcP2 = vec_perm(srcP2a, srcP2b, perm);
-    //srcbis += srcStride;
-
-    vec_s16 srcM2ssA = (vec_s16) vec_mergeh(zero_u8v, srcM2);
-    vec_s16 srcM2ssB = (vec_s16) vec_mergel(zero_u8v, srcM2);
-    vec_s16 srcM1ssA = (vec_s16) vec_mergeh(zero_u8v, srcM1);
-    vec_s16 srcM1ssB = (vec_s16) vec_mergel(zero_u8v, srcM1);
-    vec_s16 srcP0ssA = (vec_s16) vec_mergeh(zero_u8v, srcP0);
-    vec_s16 srcP0ssB = (vec_s16) vec_mergel(zero_u8v, srcP0);
-    vec_s16 srcP1ssA = (vec_s16) vec_mergeh(zero_u8v, srcP1);
-    vec_s16 srcP1ssB = (vec_s16) vec_mergel(zero_u8v, srcP1);
-    vec_s16 srcP2ssA = (vec_s16) vec_mergeh(zero_u8v, srcP2);
-    vec_s16 srcP2ssB = (vec_s16) vec_mergel(zero_u8v, srcP2);
-
-    vec_s16 pp1A, pp1B, pp2A, pp2B, pp3A, pp3B,
-              psumA, psumB, sumA, sumB,
-              srcP3ssA, srcP3ssB,
-              sum1A, sum1B, sum2A, sum2B, sum3A, sum3B;
-
-    vec_u8 sum, vdst, fsum, srcP3a, srcP3b, srcP3;
-
-    POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_v_lowpass_num, 1);
-
-    for (i = 0 ; i < 16 ; i++) {
-        srcP3a = vec_ld(0, srcbis += srcStride);
-        srcP3b = vec_ld(16, srcbis);
-        srcP3 = vec_perm(srcP3a, srcP3b, perm);
-        srcP3ssA = (vec_s16) vec_mergeh(zero_u8v, srcP3);
-        srcP3ssB = (vec_s16) vec_mergel(zero_u8v, srcP3);
-        //srcbis += srcStride;
-
-        sum1A = vec_adds(srcP0ssA, srcP1ssA);
-        sum1B = vec_adds(srcP0ssB, srcP1ssB);
-        sum2A = vec_adds(srcM1ssA, srcP2ssA);
-        sum2B = vec_adds(srcM1ssB, srcP2ssB);
-        sum3A = vec_adds(srcM2ssA, srcP3ssA);
-        sum3B = vec_adds(srcM2ssB, srcP3ssB);
-
-        srcM2ssA = srcM1ssA;
-        srcM2ssB = srcM1ssB;
-        srcM1ssA = srcP0ssA;
-        srcM1ssB = srcP0ssB;
-        srcP0ssA = srcP1ssA;
-        srcP0ssB = srcP1ssB;
-        srcP1ssA = srcP2ssA;
-        srcP1ssB = srcP2ssB;
-        srcP2ssA = srcP3ssA;
-        srcP2ssB = srcP3ssB;
-
-        pp1A = vec_mladd(sum1A, v20ss, v16ss);
-        pp1B = vec_mladd(sum1B, v20ss, v16ss);
-
-        pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
-        pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
-
-        pp3A = vec_add(sum3A, pp1A);
-        pp3B = vec_add(sum3B, pp1B);
-
-        psumA = vec_sub(pp3A, pp2A);
-        psumB = vec_sub(pp3B, pp2B);
-
-        sumA = vec_sra(psumA, v5us);
-        sumB = vec_sra(psumB, v5us);
-
-        sum = vec_packsu(sumA, sumB);
-
-        ASSERT_ALIGNED(dst);
-        vdst = vec_ld(0, dst);
-
-        OP_U8_ALTIVEC(fsum, sum, vdst);
-
-        vec_st(fsum, 0, dst);
-
-        dst += dstStride;
-    }
-    POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_v_lowpass_num, 1);
-}
-
-/* this code assume stride % 16 == 0 *and* tmp is properly aligned */
-static void PREFIX_h264_qpel16_hv_lowpass_altivec(uint8_t * dst, int16_t * tmp, uint8_t * src, int dstStride, int tmpStride, int srcStride) {
-    POWERPC_PERF_DECLARE(PREFIX_h264_qpel16_hv_lowpass_num, 1);
-    register int i;
-    LOAD_ZERO;
-    const vec_u8 permM2 = vec_lvsl(-2, src);
-    const vec_u8 permM1 = vec_lvsl(-1, src);
-    const vec_u8 permP0 = vec_lvsl(+0, src);
-    const vec_u8 permP1 = vec_lvsl(+1, src);
-    const vec_u8 permP2 = vec_lvsl(+2, src);
-    const vec_u8 permP3 = vec_lvsl(+3, src);
-    const vec_s16 v20ss = vec_sl(vec_splat_s16(5),vec_splat_u16(2));
-    const vec_u32 v10ui = vec_splat_u32(10);
-    const vec_s16 v5ss = vec_splat_s16(5);
-    const vec_s16 v1ss = vec_splat_s16(1);
-    const vec_s32 v512si = vec_sl(vec_splat_s32(1),vec_splat_u32(9));
-    const vec_u32 v16ui = vec_sl(vec_splat_u32(1),vec_splat_u32(4));
-
-    register int align = ((((unsigned long)src) - 2) % 16);
-
-    vec_s16 srcP0A, srcP0B, srcP1A, srcP1B,
-              srcP2A, srcP2B, srcP3A, srcP3B,
-              srcM1A, srcM1B, srcM2A, srcM2B,
-              sum1A, sum1B, sum2A, sum2B, sum3A, sum3B,
-              pp1A, pp1B, pp2A, pp2B, psumA, psumB;
-
-    const vec_u8 mperm = (const vec_u8)
-        {0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
-         0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F};
-    int16_t *tmpbis = tmp;
-
-    vec_s16 tmpM1ssA, tmpM1ssB, tmpM2ssA, tmpM2ssB,
-              tmpP0ssA, tmpP0ssB, tmpP1ssA, tmpP1ssB,
-              tmpP2ssA, tmpP2ssB;
-
-    vec_s32 pp1Ae, pp1Ao, pp1Be, pp1Bo, pp2Ae, pp2Ao, pp2Be, pp2Bo,
-              pp3Ae, pp3Ao, pp3Be, pp3Bo, pp1cAe, pp1cAo, pp1cBe, pp1cBo,
-              pp32Ae, pp32Ao, pp32Be, pp32Bo, sumAe, sumAo, sumBe, sumBo,
-              ssumAe, ssumAo, ssumBe, ssumBo;
-    vec_u8 fsum, sumv, sum, vdst;
-    vec_s16 ssume, ssumo;
-
-    POWERPC_PERF_START_COUNT(PREFIX_h264_qpel16_hv_lowpass_num, 1);
-    src -= (2 * srcStride);
-    for (i = 0 ; i < 21 ; i ++) {
-        vec_u8 srcM2, srcM1, srcP0, srcP1, srcP2, srcP3;
-        vec_u8 srcR1 = vec_ld(-2, src);
-        vec_u8 srcR2 = vec_ld(14, src);
-
-        switch (align) {
-        default: {
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = vec_perm(srcR1, srcR2, permP1);
-            srcP2 = vec_perm(srcR1, srcR2, permP2);
-            srcP3 = vec_perm(srcR1, srcR2, permP3);
-        } break;
-        case 11: {
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = vec_perm(srcR1, srcR2, permP1);
-            srcP2 = vec_perm(srcR1, srcR2, permP2);
-            srcP3 = srcR2;
-        } break;
-        case 12: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = vec_perm(srcR1, srcR2, permP1);
-            srcP2 = srcR2;
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        case 13: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = vec_perm(srcR1, srcR2, permP0);
-            srcP1 = srcR2;
-            srcP2 = vec_perm(srcR2, srcR3, permP2);
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        case 14: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = vec_perm(srcR1, srcR2, permM1);
-            srcP0 = srcR2;
-            srcP1 = vec_perm(srcR2, srcR3, permP1);
-            srcP2 = vec_perm(srcR2, srcR3, permP2);
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        case 15: {
-            vec_u8 srcR3 = vec_ld(30, src);
-            srcM2 = vec_perm(srcR1, srcR2, permM2);
-            srcM1 = srcR2;
-            srcP0 = vec_perm(srcR2, srcR3, permP0);
-            srcP1 = vec_perm(srcR2, srcR3, permP1);
-            srcP2 = vec_perm(srcR2, srcR3, permP2);
-            srcP3 = vec_perm(srcR2, srcR3, permP3);
-        } break;
-        }
-
-        srcP0A = (vec_s16) vec_mergeh(zero_u8v, srcP0);
-        srcP0B = (vec_s16) vec_mergel(zero_u8v, srcP0);
-        srcP1A = (vec_s16) vec_mergeh(zero_u8v, srcP1);
-        srcP1B = (vec_s16) vec_mergel(zero_u8v, srcP1);
-
-        srcP2A = (vec_s16) vec_mergeh(zero_u8v, srcP2);
-        srcP2B = (vec_s16) vec_mergel(zero_u8v, srcP2);
-        srcP3A = (vec_s16) vec_mergeh(zero_u8v, srcP3);
-        srcP3B = (vec_s16) vec_mergel(zero_u8v, srcP3);
-
-        srcM1A = (vec_s16) vec_mergeh(zero_u8v, srcM1);
-        srcM1B = (vec_s16) vec_mergel(zero_u8v, srcM1);
-        srcM2A = (vec_s16) vec_mergeh(zero_u8v, srcM2);
-        srcM2B = (vec_s16) vec_mergel(zero_u8v, srcM2);
-
-        sum1A = vec_adds(srcP0A, srcP1A);
-        sum1B = vec_adds(srcP0B, srcP1B);
-        sum2A = vec_adds(srcM1A, srcP2A);
-        sum2B = vec_adds(srcM1B, srcP2B);
-        sum3A = vec_adds(srcM2A, srcP3A);
-        sum3B = vec_adds(srcM2B, srcP3B);
-
-        pp1A = vec_mladd(sum1A, v20ss, sum3A);
-        pp1B = vec_mladd(sum1B, v20ss, sum3B);
-
-        pp2A = vec_mladd(sum2A, v5ss, zero_s16v);
-        pp2B = vec_mladd(sum2B, v5ss, zero_s16v);
-
-        psumA = vec_sub(pp1A, pp2A);
-        psumB = vec_sub(pp1B, pp2B);
-
-        vec_st(psumA, 0, tmp);
-        vec_st(psumB, 16, tmp);
-
-        src += srcStride;
-        tmp += tmpStride; /* int16_t*, and stride is 16, so it's OK here */
-    }
-
-    tmpM2ssA = vec_ld(0, tmpbis);
-    tmpM2ssB = vec_ld(16, tmpbis);
-    tmpbis += tmpStride;
-    tmpM1ssA = vec_ld(0, tmpbis);
-    tmpM1ssB = vec_ld(16, tmpbis);
-    tmpbis += tmpStride;
-    tmpP0ssA = vec_ld(0, tmpbis);
-    tmpP0ssB = vec_ld(16, tmpbis);
-    tmpbis += tmpStride;
-    tmpP1ssA = vec_ld(0, tmpbis);
-    tmpP1ssB = vec_ld(16, tmpbis);
-    tmpbis += tmpStride;
-    tmpP2ssA = vec_ld(0, tmpbis);
-    tmpP2ssB = vec_ld(16, tmpbis);
-    tmpbis += tmpStride;
-
-    for (i = 0 ; i < 16 ; i++) {
-        const vec_s16 tmpP3ssA = vec_ld(0, tmpbis);
-        const vec_s16 tmpP3ssB = vec_ld(16, tmpbis);
-
-        const vec_s16 sum1A = vec_adds(tmpP0ssA, tmpP1ssA);
-        const vec_s16 sum1B = vec_adds(tmpP0ssB, tmpP1ssB);
-        const vec_s16 sum2A = vec_adds(tmpM1ssA, tmpP2ssA);
-        const vec_s16 sum2B = vec_adds(tmpM1ssB, tmpP2ssB);
-        const vec_s16 sum3A = vec_adds(tmpM2ssA, tmpP3ssA);
-        const vec_s16 sum3B = vec_adds(tmpM2ssB, tmpP3ssB);
-
-        tmpbis += tmpStride;
-
-        tmpM2ssA = tmpM1ssA;
-        tmpM2ssB = tmpM1ssB;
-        tmpM1ssA = tmpP0ssA;
-        tmpM1ssB = tmpP0ssB;
-        tmpP0ssA = tmpP1ssA;
-        tmpP0ssB = tmpP1ssB;
-        tmpP1ssA = tmpP2ssA;
-        tmpP1ssB = tmpP2ssB;
-        tmpP2ssA = tmpP3ssA;
-        tmpP2ssB = tmpP3ssB;
-
-        pp1Ae = vec_mule(sum1A, v20ss);
-        pp1Ao = vec_mulo(sum1A, v20ss);
-        pp1Be = vec_mule(sum1B, v20ss);
-        pp1Bo = vec_mulo(sum1B, v20ss);
-
-        pp2Ae = vec_mule(sum2A, v5ss);
-        pp2Ao = vec_mulo(sum2A, v5ss);
-        pp2Be = vec_mule(sum2B, v5ss);
-        pp2Bo = vec_mulo(sum2B, v5ss);
-
-        pp3Ae = vec_sra((vec_s32)sum3A, v16ui);
-        pp3Ao = vec_mulo(sum3A, v1ss);
-        pp3Be = vec_sra((vec_s32)sum3B, v16ui);
-        pp3Bo = vec_mulo(sum3B, v1ss);
-
-        pp1cAe = vec_add(pp1Ae, v512si);
-        pp1cAo = vec_add(pp1Ao, v512si);
-        pp1cBe = vec_add(pp1Be, v512si);
-        pp1cBo = vec_add(pp1Bo, v512si);
-
-        pp32Ae = vec_sub(pp3Ae, pp2Ae);
-        pp32Ao = vec_sub(pp3Ao, pp2Ao);
-        pp32Be = vec_sub(pp3Be, pp2Be);
-        pp32Bo = vec_sub(pp3Bo, pp2Bo);
-
-        sumAe = vec_add(pp1cAe, pp32Ae);
-        sumAo = vec_add(pp1cAo, pp32Ao);
-        sumBe = vec_add(pp1cBe, pp32Be);
-        sumBo = vec_add(pp1cBo, pp32Bo);
-
-        ssumAe = vec_sra(sumAe, v10ui);
-        ssumAo = vec_sra(sumAo, v10ui);
-        ssumBe = vec_sra(sumBe, v10ui);
-        ssumBo = vec_sra(sumBo, v10ui);
-
-        ssume = vec_packs(ssumAe, ssumBe);
-        ssumo = vec_packs(ssumAo, ssumBo);
-
-        sumv = vec_packsu(ssume, ssumo);
-        sum = vec_perm(sumv, sumv, mperm);
-
-        ASSERT_ALIGNED(dst);
-        vdst = vec_ld(0, dst);
-
-        OP_U8_ALTIVEC(fsum, sum, vdst);
-
-        vec_st(fsum, 0, dst);
-
-        dst += dstStride;
-    }
-    POWERPC_PERF_STOP_COUNT(PREFIX_h264_qpel16_hv_lowpass_num, 1);
-}
diff --git a/libavcodec/ppc/idct_altivec.c b/libavcodec/ppc/idct_altivec.c
deleted file mode 100644
index 7c6b79e..0000000
--- a/libavcodec/ppc/idct_altivec.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2001 Michel Lespinasse
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * NOTE: This code is based on GPL code from the libmpeg2 project.  The
- * author, Michel Lespinasses, has given explicit permission to release
- * under LGPL as part of FFmpeg.
- */
-
-/*
- * FFmpeg integration by Dieter Shirley
- *
- * This file is a direct copy of the AltiVec IDCT module from the libmpeg2
- * project.  I've deleted all of the libmpeg2-specific code, renamed the
- * functions and reordered the function parameters.  The only change to the
- * IDCT function itself was to factor out the partial transposition, and to
- * perform a full transpose at the end of the function.
- */
-
-
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-#include "config.h"
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-#include "libavcodec/dsputil.h"
-#include "types_altivec.h"
-#include "dsputil_ppc.h"
-#include "dsputil_altivec.h"
-
-#define IDCT_HALF                                       \
-    /* 1st stage */                                     \
-    t1 = vec_mradds (a1, vx7, vx1 );                    \
-    t8 = vec_mradds (a1, vx1, vec_subs (zero, vx7));    \
-    t7 = vec_mradds (a2, vx5, vx3);                     \
-    t3 = vec_mradds (ma2, vx3, vx5);                    \
-                                                        \
-    /* 2nd stage */                                     \
-    t5 = vec_adds (vx0, vx4);                           \
-    t0 = vec_subs (vx0, vx4);                           \
-    t2 = vec_mradds (a0, vx6, vx2);                     \
-    t4 = vec_mradds (a0, vx2, vec_subs (zero, vx6));    \
-    t6 = vec_adds (t8, t3);                             \
-    t3 = vec_subs (t8, t3);                             \
-    t8 = vec_subs (t1, t7);                             \
-    t1 = vec_adds (t1, t7);                             \
-                                                        \
-    /* 3rd stage */                                     \
-    t7 = vec_adds (t5, t2);                             \
-    t2 = vec_subs (t5, t2);                             \
-    t5 = vec_adds (t0, t4);                             \
-    t0 = vec_subs (t0, t4);                             \
-    t4 = vec_subs (t8, t3);                             \
-    t3 = vec_adds (t8, t3);                             \
-                                                        \
-    /* 4th stage */                                     \
-    vy0 = vec_adds (t7, t1);                            \
-    vy7 = vec_subs (t7, t1);                            \
-    vy1 = vec_mradds (c4, t3, t5);                      \
-    vy6 = vec_mradds (mc4, t3, t5);                     \
-    vy2 = vec_mradds (c4, t4, t0);                      \
-    vy5 = vec_mradds (mc4, t4, t0);                     \
-    vy3 = vec_adds (t2, t6);                            \
-    vy4 = vec_subs (t2, t6);
-
-
-#define IDCT                                                            \
-    vec_s16 vx0, vx1, vx2, vx3, vx4, vx5, vx6, vx7;                \
-    vec_s16 vy0, vy1, vy2, vy3, vy4, vy5, vy6, vy7;                \
-    vec_s16 a0, a1, a2, ma2, c4, mc4, zero, bias;                  \
-    vec_s16 t0, t1, t2, t3, t4, t5, t6, t7, t8;                    \
-    vec_u16 shift;                                                 \
-                                                                        \
-    c4 = vec_splat (constants[0], 0);                                   \
-    a0 = vec_splat (constants[0], 1);                                   \
-    a1 = vec_splat (constants[0], 2);                                   \
-    a2 = vec_splat (constants[0], 3);                                   \
-    mc4 = vec_splat (constants[0], 4);                                  \
-    ma2 = vec_splat (constants[0], 5);                                  \
-    bias = (vec_s16)vec_splat ((vec_s32)constants[0], 3);     \
-                                                                        \
-    zero = vec_splat_s16 (0);                                           \
-    shift = vec_splat_u16 (4);                                          \
-                                                                        \
-    vx0 = vec_mradds (vec_sl (block[0], shift), constants[1], zero);    \
-    vx1 = vec_mradds (vec_sl (block[1], shift), constants[2], zero);    \
-    vx2 = vec_mradds (vec_sl (block[2], shift), constants[3], zero);    \
-    vx3 = vec_mradds (vec_sl (block[3], shift), constants[4], zero);    \
-    vx4 = vec_mradds (vec_sl (block[4], shift), constants[1], zero);    \
-    vx5 = vec_mradds (vec_sl (block[5], shift), constants[4], zero);    \
-    vx6 = vec_mradds (vec_sl (block[6], shift), constants[3], zero);    \
-    vx7 = vec_mradds (vec_sl (block[7], shift), constants[2], zero);    \
-                                                                        \
-    IDCT_HALF                                                           \
-                                                                        \
-    vx0 = vec_mergeh (vy0, vy4);                                        \
-    vx1 = vec_mergel (vy0, vy4);                                        \
-    vx2 = vec_mergeh (vy1, vy5);                                        \
-    vx3 = vec_mergel (vy1, vy5);                                        \
-    vx4 = vec_mergeh (vy2, vy6);                                        \
-    vx5 = vec_mergel (vy2, vy6);                                        \
-    vx6 = vec_mergeh (vy3, vy7);                                        \
-    vx7 = vec_mergel (vy3, vy7);                                        \
-                                                                        \
-    vy0 = vec_mergeh (vx0, vx4);                                        \
-    vy1 = vec_mergel (vx0, vx4);                                        \
-    vy2 = vec_mergeh (vx1, vx5);                                        \
-    vy3 = vec_mergel (vx1, vx5);                                        \
-    vy4 = vec_mergeh (vx2, vx6);                                        \
-    vy5 = vec_mergel (vx2, vx6);                                        \
-    vy6 = vec_mergeh (vx3, vx7);                                        \
-    vy7 = vec_mergel (vx3, vx7);                                        \
-                                                                        \
-    vx0 = vec_adds (vec_mergeh (vy0, vy4), bias);                       \
-    vx1 = vec_mergel (vy0, vy4);                                        \
-    vx2 = vec_mergeh (vy1, vy5);                                        \
-    vx3 = vec_mergel (vy1, vy5);                                        \
-    vx4 = vec_mergeh (vy2, vy6);                                        \
-    vx5 = vec_mergel (vy2, vy6);                                        \
-    vx6 = vec_mergeh (vy3, vy7);                                        \
-    vx7 = vec_mergel (vy3, vy7);                                        \
-                                                                        \
-    IDCT_HALF                                                           \
-                                                                        \
-    shift = vec_splat_u16 (6);                                          \
-    vx0 = vec_sra (vy0, shift);                                         \
-    vx1 = vec_sra (vy1, shift);                                         \
-    vx2 = vec_sra (vy2, shift);                                         \
-    vx3 = vec_sra (vy3, shift);                                         \
-    vx4 = vec_sra (vy4, shift);                                         \
-    vx5 = vec_sra (vy5, shift);                                         \
-    vx6 = vec_sra (vy6, shift);                                         \
-    vx7 = vec_sra (vy7, shift);
-
-
-static const vec_s16 constants[5] = {
-    {23170, 13573,  6518, 21895, -23170, -21895,    32,    31},
-    {16384, 22725, 21407, 19266,  16384,  19266, 21407, 22725},
-    {22725, 31521, 29692, 26722,  22725,  26722, 29692, 31521},
-    {21407, 29692, 27969, 25172,  21407,  25172, 27969, 29692},
-    {19266, 26722, 25172, 22654,  19266,  22654, 25172, 26722}
-};
-
-void idct_put_altivec(uint8_t* dest, int stride, int16_t *blk)
-{
-POWERPC_PERF_DECLARE(altivec_idct_put_num, 1);
-    vec_s16 *block = (vec_s16*)blk;
-    vec_u8 tmp;
-
-#if CONFIG_POWERPC_PERF
-POWERPC_PERF_START_COUNT(altivec_idct_put_num, 1);
-#endif
-    IDCT
-
-#define COPY(dest,src)                                          \
-    tmp = vec_packsu (src, src);                                \
-    vec_ste ((vec_u32)tmp, 0, (unsigned int *)dest);       \
-    vec_ste ((vec_u32)tmp, 4, (unsigned int *)dest);
-
-    COPY (dest, vx0)    dest += stride;
-    COPY (dest, vx1)    dest += stride;
-    COPY (dest, vx2)    dest += stride;
-    COPY (dest, vx3)    dest += stride;
-    COPY (dest, vx4)    dest += stride;
-    COPY (dest, vx5)    dest += stride;
-    COPY (dest, vx6)    dest += stride;
-    COPY (dest, vx7)
-
-POWERPC_PERF_STOP_COUNT(altivec_idct_put_num, 1);
-}
-
-void idct_add_altivec(uint8_t* dest, int stride, int16_t *blk)
-{
-POWERPC_PERF_DECLARE(altivec_idct_add_num, 1);
-    vec_s16 *block = (vec_s16*)blk;
-    vec_u8 tmp;
-    vec_s16 tmp2, tmp3;
-    vec_u8 perm0;
-    vec_u8 perm1;
-    vec_u8 p0, p1, p;
-
-#if CONFIG_POWERPC_PERF
-POWERPC_PERF_START_COUNT(altivec_idct_add_num, 1);
-#endif
-
-    IDCT
-
-    p0 = vec_lvsl (0, dest);
-    p1 = vec_lvsl (stride, dest);
-    p = vec_splat_u8 (-1);
-    perm0 = vec_mergeh (p, p0);
-    perm1 = vec_mergeh (p, p1);
-
-#define ADD(dest,src,perm)                                              \
-    /* *(uint64_t *)&tmp = *(uint64_t *)dest; */                        \
-    tmp = vec_ld (0, dest);                                             \
-    tmp2 = (vec_s16)vec_perm (tmp, (vec_u8)zero, perm);       \
-    tmp3 = vec_adds (tmp2, src);                                        \
-    tmp = vec_packsu (tmp3, tmp3);                                      \
-    vec_ste ((vec_u32)tmp, 0, (unsigned int *)dest);               \
-    vec_ste ((vec_u32)tmp, 4, (unsigned int *)dest);
-
-    ADD (dest, vx0, perm0)      dest += stride;
-    ADD (dest, vx1, perm1)      dest += stride;
-    ADD (dest, vx2, perm0)      dest += stride;
-    ADD (dest, vx3, perm1)      dest += stride;
-    ADD (dest, vx4, perm0)      dest += stride;
-    ADD (dest, vx5, perm1)      dest += stride;
-    ADD (dest, vx6, perm0)      dest += stride;
-    ADD (dest, vx7, perm1)
-
-POWERPC_PERF_STOP_COUNT(altivec_idct_add_num, 1);
-}
-
diff --git a/libavcodec/ppc/int_altivec.c b/libavcodec/ppc/int_altivec.c
deleted file mode 100644
index 7fb11dd..0000000
--- a/libavcodec/ppc/int_altivec.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2007 Luca Barbato <lu_zero at gentoo.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- ** @file
- ** integer misc ops.
- **/
-
-#include "config.h"
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-#include "libavcodec/dsputil.h"
-
-#include "dsputil_altivec.h"
-
-#include "types_altivec.h"
-
-static int ssd_int8_vs_int16_altivec(const int8_t *pix1, const int16_t *pix2,
-                                     int size) {
-    int i, size16;
-    vector signed char vpix1;
-    vector signed short vpix2, vdiff, vpix1l,vpix1h;
-    union { vector signed int vscore;
-            int32_t score[4];
-          } u;
-    u.vscore = vec_splat_s32(0);
-//
-//XXX lazy way, fix it later
-
-#define vec_unaligned_load(b) \
-    vec_perm(vec_ld(0,b),vec_ld(15,b),vec_lvsl(0, b));
-
-    size16 = size >> 4;
-    while(size16) {
-//        score += (pix1[i]-pix2[i])*(pix1[i]-pix2[i]);
-        //load pix1 and the first batch of pix2
-
-        vpix1 = vec_unaligned_load(pix1);
-        vpix2 = vec_unaligned_load(pix2);
-        pix2 += 8;
-        //unpack
-        vpix1h = vec_unpackh(vpix1);
-        vdiff  = vec_sub(vpix1h, vpix2);
-        vpix1l = vec_unpackl(vpix1);
-        // load another batch from pix2
-        vpix2 = vec_unaligned_load(pix2);
-        u.vscore = vec_msum(vdiff, vdiff, u.vscore);
-        vdiff  = vec_sub(vpix1l, vpix2);
-        u.vscore = vec_msum(vdiff, vdiff, u.vscore);
-        pix1 += 16;
-        pix2 += 8;
-        size16--;
-    }
-    u.vscore = vec_sums(u.vscore, vec_splat_s32(0));
-
-    size %= 16;
-    for (i = 0; i < size; i++) {
-        u.score[3] += (pix1[i]-pix2[i])*(pix1[i]-pix2[i]);
-    }
-    return u.score[3];
-}
-
-static int32_t scalarproduct_int16_altivec(int16_t * v1, int16_t * v2, int order, const int shift)
-{
-    int i;
-    LOAD_ZERO;
-    register vec_s16 vec1, *pv;
-    register vec_s32 res = vec_splat_s32(0), t;
-    register vec_u32 shifts;
-    int32_t ires;
-
-    shifts = zero_u32v;
-    if(shift & 0x10) shifts = vec_add(shifts, vec_sl(vec_splat_u32(0x08), vec_splat_u32(0x1)));
-    if(shift & 0x08) shifts = vec_add(shifts, vec_splat_u32(0x08));
-    if(shift & 0x04) shifts = vec_add(shifts, vec_splat_u32(0x04));
-    if(shift & 0x02) shifts = vec_add(shifts, vec_splat_u32(0x02));
-    if(shift & 0x01) shifts = vec_add(shifts, vec_splat_u32(0x01));
-
-    for(i = 0; i < order; i += 8){
-        pv = (vec_s16*)v1;
-        vec1 = vec_perm(pv[0], pv[1], vec_lvsl(0, v1));
-        t = vec_msum(vec1, vec_ld(0, v2), zero_s32v);
-        t = vec_sr(t, shifts);
-        res = vec_sums(t, res);
-        v1 += 8;
-        v2 += 8;
-    }
-    res = vec_splat(res, 3);
-    vec_ste(res, 0, &ires);
-    return ires;
-}
-
-static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
-{
-    LOAD_ZERO;
-    vec_s16 *pv1 = (vec_s16*)v1;
-    vec_s16 *pv2 = (vec_s16*)v2;
-    vec_s16 *pv3 = (vec_s16*)v3;
-    register vec_s16 muls = {mul,mul,mul,mul,mul,mul,mul,mul};
-    register vec_s16 t0, t1, i0, i1;
-    register vec_s16 i2 = pv2[0], i3 = pv3[0];
-    register vec_s32 res = zero_s32v;
-    register vec_u8 align = vec_lvsl(0, v2);
-    int32_t ires;
-    order >>= 4;
-    do {
-        t0 = vec_perm(i2, pv2[1], align);
-        i2 = pv2[2];
-        t1 = vec_perm(pv2[1], i2, align);
-        i0 = pv1[0];
-        i1 = pv1[1];
-        res = vec_msum(t0, i0, res);
-        res = vec_msum(t1, i1, res);
-        t0 = vec_perm(i3, pv3[1], align);
-        i3 = pv3[2];
-        t1 = vec_perm(pv3[1], i3, align);
-        pv1[0] = vec_mladd(t0, muls, i0);
-        pv1[1] = vec_mladd(t1, muls, i1);
-        pv1 += 2;
-        pv2 += 2;
-        pv3 += 2;
-    } while(--order);
-    res = vec_splat(vec_sums(res, zero_s32v), 3);
-    vec_ste(res, 0, &ires);
-    return ires;
-}
-
-void int_init_altivec(DSPContext* c, AVCodecContext *avctx)
-{
-    c->ssd_int8_vs_int16 = ssd_int8_vs_int16_altivec;
-    c->scalarproduct_int16 = scalarproduct_int16_altivec;
-    c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_altivec;
-}
diff --git a/libavcodec/ppc/mathops.h b/libavcodec/ppc/mathops.h
deleted file mode 100644
index dbd714f..0000000
--- a/libavcodec/ppc/mathops.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * simple math operations
- * Copyright (c) 2001, 2002 Fabrice Bellard
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PPC_MATHOPS_H
-#define AVCODEC_PPC_MATHOPS_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/common.h"
-
-#if HAVE_PPC4XX
-/* signed 16x16 -> 32 multiply add accumulate */
-#define MAC16(rt, ra, rb) \
-    __asm__ ("maclhw %0, %2, %3" : "=r" (rt) : "0" (rt), "r" (ra), "r" (rb));
-
-/* signed 16x16 -> 32 multiply */
-#define MUL16(ra, rb) \
-    ({ int __rt; \
-    __asm__ ("mullhw %0, %1, %2" : "=r" (__rt) : "r" (ra), "r" (rb)); \
-    __rt; })
-#endif
-
-#define MULH MULH
-static inline av_const int MULH(int a, int b){
-    int r;
-    __asm__ ("mulhw %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
-    return r;
-}
-
-#if !ARCH_PPC64
-static inline av_const int64_t MAC64(int64_t d, int a, int b)
-{
-    union { uint64_t x; unsigned hl[2]; } x = { d };
-    int h, l;
-    __asm__ ("mullw %3, %4, %5   \n\t"
-             "mulhw %2, %4, %5   \n\t"
-             "addc  %1, %1, %3   \n\t"
-             "adde  %0, %0, %2   \n\t"
-             : "+r"(x.hl[0]), "+r"(x.hl[1]), "=&r"(h), "=&r"(l)
-             : "r"(a), "r"(b));
-    return x.x;
-}
-#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
-
-static inline av_const int64_t MLS64(int64_t d, int a, int b)
-{
-    union { uint64_t x; unsigned hl[2]; } x = { d };
-    int h, l;
-    __asm__ ("mullw %3, %4, %5   \n\t"
-             "mulhw %2, %4, %5   \n\t"
-             "subfc %1, %3, %1   \n\t"
-             "subfe %0, %2, %0   \n\t"
-             : "+r"(x.hl[0]), "+r"(x.hl[1]), "=&r"(h), "=&r"(l)
-             : "r"(a), "r"(b));
-    return x.x;
-}
-#define MLS64(d, a, b) ((d) = MLS64(d, a, b))
-#endif
-
-#endif /* AVCODEC_PPC_MATHOPS_H */
diff --git a/libavcodec/ppc/mpegvideo_altivec.c b/libavcodec/ppc/mpegvideo_altivec.c
deleted file mode 100644
index 07e63be..0000000
--- a/libavcodec/ppc/mpegvideo_altivec.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/*
- * Copyright (c) 2002 Dieter Shirley
- *
- * dct_unquantize_h263_altivec:
- * Copyright (c) 2003 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-
-#include "dsputil_ppc.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
-#include "dsputil_altivec.h"
-
-// Swaps two variables (used for altivec registers)
-#define SWAP(a,b) \
-do { \
-    __typeof__(a) swap_temp=a; \
-    a=b; \
-    b=swap_temp; \
-} while (0)
-
-// transposes a matrix consisting of four vectors with four elements each
-#define TRANSPOSE4(a,b,c,d) \
-do { \
-    __typeof__(a) _trans_ach = vec_mergeh(a, c); \
-    __typeof__(a) _trans_acl = vec_mergel(a, c); \
-    __typeof__(a) _trans_bdh = vec_mergeh(b, d); \
-    __typeof__(a) _trans_bdl = vec_mergel(b, d); \
-                                                 \
-    a = vec_mergeh(_trans_ach, _trans_bdh);      \
-    b = vec_mergel(_trans_ach, _trans_bdh);      \
-    c = vec_mergeh(_trans_acl, _trans_bdl);      \
-    d = vec_mergel(_trans_acl, _trans_bdl);      \
-} while (0)
-
-
-// Loads a four-byte value (int or float) from the target address
-// into every element in the target vector.  Only works if the
-// target address is four-byte aligned (which should be always).
-#define LOAD4(vec, address) \
-{ \
-    __typeof__(vec)* _load_addr = (__typeof__(vec)*)(address);  \
-    vector unsigned char _perm_vec = vec_lvsl(0,(address));     \
-    vec = vec_ld(0, _load_addr);                                \
-    vec = vec_perm(vec, vec, _perm_vec);                        \
-    vec = vec_splat(vec, 0);                                    \
-}
-
-
-#define FOUROF(a) {a,a,a,a}
-
-static int dct_quantize_altivec(MpegEncContext* s,
-                         DCTELEM* data, int n,
-                         int qscale, int* overflow)
-{
-    int lastNonZero;
-    vector float row0, row1, row2, row3, row4, row5, row6, row7;
-    vector float alt0, alt1, alt2, alt3, alt4, alt5, alt6, alt7;
-    const vector float zero = (const vector float)FOUROF(0.);
-    // used after quantize step
-    int oldBaseValue = 0;
-
-    // Load the data into the row/alt vectors
-    {
-        vector signed short data0, data1, data2, data3, data4, data5, data6, data7;
-
-        data0 = vec_ld(0, data);
-        data1 = vec_ld(16, data);
-        data2 = vec_ld(32, data);
-        data3 = vec_ld(48, data);
-        data4 = vec_ld(64, data);
-        data5 = vec_ld(80, data);
-        data6 = vec_ld(96, data);
-        data7 = vec_ld(112, data);
-
-        // Transpose the data before we start
-        TRANSPOSE8(data0, data1, data2, data3, data4, data5, data6, data7);
-
-        // load the data into floating point vectors.  We load
-        // the high half of each row into the main row vectors
-        // and the low half into the alt vectors.
-        row0 = vec_ctf(vec_unpackh(data0), 0);
-        alt0 = vec_ctf(vec_unpackl(data0), 0);
-        row1 = vec_ctf(vec_unpackh(data1), 0);
-        alt1 = vec_ctf(vec_unpackl(data1), 0);
-        row2 = vec_ctf(vec_unpackh(data2), 0);
-        alt2 = vec_ctf(vec_unpackl(data2), 0);
-        row3 = vec_ctf(vec_unpackh(data3), 0);
-        alt3 = vec_ctf(vec_unpackl(data3), 0);
-        row4 = vec_ctf(vec_unpackh(data4), 0);
-        alt4 = vec_ctf(vec_unpackl(data4), 0);
-        row5 = vec_ctf(vec_unpackh(data5), 0);
-        alt5 = vec_ctf(vec_unpackl(data5), 0);
-        row6 = vec_ctf(vec_unpackh(data6), 0);
-        alt6 = vec_ctf(vec_unpackl(data6), 0);
-        row7 = vec_ctf(vec_unpackh(data7), 0);
-        alt7 = vec_ctf(vec_unpackl(data7), 0);
-    }
-
-    // The following block could exist as a separate an altivec dct
-                // function.  However, if we put it inline, the DCT data can remain
-                // in the vector local variables, as floats, which we'll use during the
-                // quantize step...
-    {
-        const vector float vec_0_298631336 = (vector float)FOUROF(0.298631336f);
-        const vector float vec_0_390180644 = (vector float)FOUROF(-0.390180644f);
-        const vector float vec_0_541196100 = (vector float)FOUROF(0.541196100f);
-        const vector float vec_0_765366865 = (vector float)FOUROF(0.765366865f);
-        const vector float vec_0_899976223 = (vector float)FOUROF(-0.899976223f);
-        const vector float vec_1_175875602 = (vector float)FOUROF(1.175875602f);
-        const vector float vec_1_501321110 = (vector float)FOUROF(1.501321110f);
-        const vector float vec_1_847759065 = (vector float)FOUROF(-1.847759065f);
-        const vector float vec_1_961570560 = (vector float)FOUROF(-1.961570560f);
-        const vector float vec_2_053119869 = (vector float)FOUROF(2.053119869f);
-        const vector float vec_2_562915447 = (vector float)FOUROF(-2.562915447f);
-        const vector float vec_3_072711026 = (vector float)FOUROF(3.072711026f);
-
-
-        int whichPass, whichHalf;
-
-        for(whichPass = 1; whichPass<=2; whichPass++) {
-            for(whichHalf = 1; whichHalf<=2; whichHalf++) {
-                vector float tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
-                vector float tmp10, tmp11, tmp12, tmp13;
-                vector float z1, z2, z3, z4, z5;
-
-                tmp0 = vec_add(row0, row7); // tmp0 = dataptr[0] + dataptr[7];
-                tmp7 = vec_sub(row0, row7); // tmp7 = dataptr[0] - dataptr[7];
-                tmp3 = vec_add(row3, row4); // tmp3 = dataptr[3] + dataptr[4];
-                tmp4 = vec_sub(row3, row4); // tmp4 = dataptr[3] - dataptr[4];
-                tmp1 = vec_add(row1, row6); // tmp1 = dataptr[1] + dataptr[6];
-                tmp6 = vec_sub(row1, row6); // tmp6 = dataptr[1] - dataptr[6];
-                tmp2 = vec_add(row2, row5); // tmp2 = dataptr[2] + dataptr[5];
-                tmp5 = vec_sub(row2, row5); // tmp5 = dataptr[2] - dataptr[5];
-
-                tmp10 = vec_add(tmp0, tmp3); // tmp10 = tmp0 + tmp3;
-                tmp13 = vec_sub(tmp0, tmp3); // tmp13 = tmp0 - tmp3;
-                tmp11 = vec_add(tmp1, tmp2); // tmp11 = tmp1 + tmp2;
-                tmp12 = vec_sub(tmp1, tmp2); // tmp12 = tmp1 - tmp2;
-
-
-                // dataptr[0] = (DCTELEM) ((tmp10 + tmp11) << PASS1_BITS);
-                row0 = vec_add(tmp10, tmp11);
-
-                // dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS);
-                row4 = vec_sub(tmp10, tmp11);
-
-
-                // z1 = MULTIPLY(tmp12 + tmp13, FIX_0_541196100);
-                z1 = vec_madd(vec_add(tmp12, tmp13), vec_0_541196100, (vector float)zero);
-
-                // dataptr[2] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp13, FIX_0_765366865),
-                //                                CONST_BITS-PASS1_BITS);
-                row2 = vec_madd(tmp13, vec_0_765366865, z1);
-
-                // dataptr[6] = (DCTELEM) DESCALE(z1 + MULTIPLY(tmp12, - FIX_1_847759065),
-                //                                CONST_BITS-PASS1_BITS);
-                row6 = vec_madd(tmp12, vec_1_847759065, z1);
-
-                z1 = vec_add(tmp4, tmp7); // z1 = tmp4 + tmp7;
-                z2 = vec_add(tmp5, tmp6); // z2 = tmp5 + tmp6;
-                z3 = vec_add(tmp4, tmp6); // z3 = tmp4 + tmp6;
-                z4 = vec_add(tmp5, tmp7); // z4 = tmp5 + tmp7;
-
-                // z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-                z5 = vec_madd(vec_add(z3, z4), vec_1_175875602, (vector float)zero);
-
-                // z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
-                z3 = vec_madd(z3, vec_1_961570560, z5);
-
-                // z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-                z4 = vec_madd(z4, vec_0_390180644, z5);
-
-                // The following adds are rolled into the multiplies above
-                // z3 = vec_add(z3, z5);  // z3 += z5;
-                // z4 = vec_add(z4, z5);  // z4 += z5;
-
-                // z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
-                // Wow!  It's actually more efficient to roll this multiply
-                // into the adds below, even thought the multiply gets done twice!
-                // z2 = vec_madd(z2, vec_2_562915447, (vector float)zero);
-
-                // z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
-                // Same with this one...
-                // z1 = vec_madd(z1, vec_0_899976223, (vector float)zero);
-
-                // tmp4 = MULTIPLY(tmp4, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
-                // dataptr[7] = (DCTELEM) DESCALE(tmp4 + z1 + z3, CONST_BITS-PASS1_BITS);
-                row7 = vec_madd(tmp4, vec_0_298631336, vec_madd(z1, vec_0_899976223, z3));
-
-                // tmp5 = MULTIPLY(tmp5, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
-                // dataptr[5] = (DCTELEM) DESCALE(tmp5 + z2 + z4, CONST_BITS-PASS1_BITS);
-                row5 = vec_madd(tmp5, vec_2_053119869, vec_madd(z2, vec_2_562915447, z4));
-
-                // tmp6 = MULTIPLY(tmp6, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
-                // dataptr[3] = (DCTELEM) DESCALE(tmp6 + z2 + z3, CONST_BITS-PASS1_BITS);
-                row3 = vec_madd(tmp6, vec_3_072711026, vec_madd(z2, vec_2_562915447, z3));
-
-                // tmp7 = MULTIPLY(tmp7, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
-                // dataptr[1] = (DCTELEM) DESCALE(tmp7 + z1 + z4, CONST_BITS-PASS1_BITS);
-                row1 = vec_madd(z1, vec_0_899976223, vec_madd(tmp7, vec_1_501321110, z4));
-
-                // Swap the row values with the alts.  If this is the first half,
-                // this sets up the low values to be acted on in the second half.
-                // If this is the second half, it puts the high values back in
-                // the row values where they are expected to be when we're done.
-                SWAP(row0, alt0);
-                SWAP(row1, alt1);
-                SWAP(row2, alt2);
-                SWAP(row3, alt3);
-                SWAP(row4, alt4);
-                SWAP(row5, alt5);
-                SWAP(row6, alt6);
-                SWAP(row7, alt7);
-            }
-
-            if (whichPass == 1) {
-                // transpose the data for the second pass
-
-                // First, block transpose the upper right with lower left.
-                SWAP(row4, alt0);
-                SWAP(row5, alt1);
-                SWAP(row6, alt2);
-                SWAP(row7, alt3);
-
-                // Now, transpose each block of four
-                TRANSPOSE4(row0, row1, row2, row3);
-                TRANSPOSE4(row4, row5, row6, row7);
-                TRANSPOSE4(alt0, alt1, alt2, alt3);
-                TRANSPOSE4(alt4, alt5, alt6, alt7);
-            }
-        }
-    }
-
-    // perform the quantize step, using the floating point data
-    // still in the row/alt registers
-    {
-        const int* biasAddr;
-        const vector signed int* qmat;
-        vector float bias, negBias;
-
-        if (s->mb_intra) {
-            vector signed int baseVector;
-
-            // We must cache element 0 in the intra case
-            // (it needs special handling).
-            baseVector = vec_cts(vec_splat(row0, 0), 0);
-            vec_ste(baseVector, 0, &oldBaseValue);
-
-            qmat = (vector signed int*)s->q_intra_matrix[qscale];
-            biasAddr = &(s->intra_quant_bias);
-        } else {
-            qmat = (vector signed int*)s->q_inter_matrix[qscale];
-            biasAddr = &(s->inter_quant_bias);
-        }
-
-        // Load the bias vector (We add 0.5 to the bias so that we're
-                                // rounding when we convert to int, instead of flooring.)
-        {
-            vector signed int biasInt;
-            const vector float negOneFloat = (vector float)FOUROF(-1.0f);
-            LOAD4(biasInt, biasAddr);
-            bias = vec_ctf(biasInt, QUANT_BIAS_SHIFT);
-            negBias = vec_madd(bias, negOneFloat, zero);
-        }
-
-        {
-            vector float q0, q1, q2, q3, q4, q5, q6, q7;
-
-            q0 = vec_ctf(qmat[0], QMAT_SHIFT);
-            q1 = vec_ctf(qmat[2], QMAT_SHIFT);
-            q2 = vec_ctf(qmat[4], QMAT_SHIFT);
-            q3 = vec_ctf(qmat[6], QMAT_SHIFT);
-            q4 = vec_ctf(qmat[8], QMAT_SHIFT);
-            q5 = vec_ctf(qmat[10], QMAT_SHIFT);
-            q6 = vec_ctf(qmat[12], QMAT_SHIFT);
-            q7 = vec_ctf(qmat[14], QMAT_SHIFT);
-
-            row0 = vec_sel(vec_madd(row0, q0, negBias), vec_madd(row0, q0, bias),
-                    vec_cmpgt(row0, zero));
-            row1 = vec_sel(vec_madd(row1, q1, negBias), vec_madd(row1, q1, bias),
-                    vec_cmpgt(row1, zero));
-            row2 = vec_sel(vec_madd(row2, q2, negBias), vec_madd(row2, q2, bias),
-                    vec_cmpgt(row2, zero));
-            row3 = vec_sel(vec_madd(row3, q3, negBias), vec_madd(row3, q3, bias),
-                    vec_cmpgt(row3, zero));
-            row4 = vec_sel(vec_madd(row4, q4, negBias), vec_madd(row4, q4, bias),
-                    vec_cmpgt(row4, zero));
-            row5 = vec_sel(vec_madd(row5, q5, negBias), vec_madd(row5, q5, bias),
-                    vec_cmpgt(row5, zero));
-            row6 = vec_sel(vec_madd(row6, q6, negBias), vec_madd(row6, q6, bias),
-                    vec_cmpgt(row6, zero));
-            row7 = vec_sel(vec_madd(row7, q7, negBias), vec_madd(row7, q7, bias),
-                    vec_cmpgt(row7, zero));
-
-            q0 = vec_ctf(qmat[1], QMAT_SHIFT);
-            q1 = vec_ctf(qmat[3], QMAT_SHIFT);
-            q2 = vec_ctf(qmat[5], QMAT_SHIFT);
-            q3 = vec_ctf(qmat[7], QMAT_SHIFT);
-            q4 = vec_ctf(qmat[9], QMAT_SHIFT);
-            q5 = vec_ctf(qmat[11], QMAT_SHIFT);
-            q6 = vec_ctf(qmat[13], QMAT_SHIFT);
-            q7 = vec_ctf(qmat[15], QMAT_SHIFT);
-
-            alt0 = vec_sel(vec_madd(alt0, q0, negBias), vec_madd(alt0, q0, bias),
-                    vec_cmpgt(alt0, zero));
-            alt1 = vec_sel(vec_madd(alt1, q1, negBias), vec_madd(alt1, q1, bias),
-                    vec_cmpgt(alt1, zero));
-            alt2 = vec_sel(vec_madd(alt2, q2, negBias), vec_madd(alt2, q2, bias),
-                    vec_cmpgt(alt2, zero));
-            alt3 = vec_sel(vec_madd(alt3, q3, negBias), vec_madd(alt3, q3, bias),
-                    vec_cmpgt(alt3, zero));
-            alt4 = vec_sel(vec_madd(alt4, q4, negBias), vec_madd(alt4, q4, bias),
-                    vec_cmpgt(alt4, zero));
-            alt5 = vec_sel(vec_madd(alt5, q5, negBias), vec_madd(alt5, q5, bias),
-                    vec_cmpgt(alt5, zero));
-            alt6 = vec_sel(vec_madd(alt6, q6, negBias), vec_madd(alt6, q6, bias),
-                    vec_cmpgt(alt6, zero));
-            alt7 = vec_sel(vec_madd(alt7, q7, negBias), vec_madd(alt7, q7, bias),
-                    vec_cmpgt(alt7, zero));
-        }
-
-
-    }
-
-    // Store the data back into the original block
-    {
-        vector signed short data0, data1, data2, data3, data4, data5, data6, data7;
-
-        data0 = vec_pack(vec_cts(row0, 0), vec_cts(alt0, 0));
-        data1 = vec_pack(vec_cts(row1, 0), vec_cts(alt1, 0));
-        data2 = vec_pack(vec_cts(row2, 0), vec_cts(alt2, 0));
-        data3 = vec_pack(vec_cts(row3, 0), vec_cts(alt3, 0));
-        data4 = vec_pack(vec_cts(row4, 0), vec_cts(alt4, 0));
-        data5 = vec_pack(vec_cts(row5, 0), vec_cts(alt5, 0));
-        data6 = vec_pack(vec_cts(row6, 0), vec_cts(alt6, 0));
-        data7 = vec_pack(vec_cts(row7, 0), vec_cts(alt7, 0));
-
-        {
-            // Clamp for overflow
-            vector signed int max_q_int, min_q_int;
-            vector signed short max_q, min_q;
-
-            LOAD4(max_q_int, &(s->max_qcoeff));
-            LOAD4(min_q_int, &(s->min_qcoeff));
-
-            max_q = vec_pack(max_q_int, max_q_int);
-            min_q = vec_pack(min_q_int, min_q_int);
-
-            data0 = vec_max(vec_min(data0, max_q), min_q);
-            data1 = vec_max(vec_min(data1, max_q), min_q);
-            data2 = vec_max(vec_min(data2, max_q), min_q);
-            data4 = vec_max(vec_min(data4, max_q), min_q);
-            data5 = vec_max(vec_min(data5, max_q), min_q);
-            data6 = vec_max(vec_min(data6, max_q), min_q);
-            data7 = vec_max(vec_min(data7, max_q), min_q);
-        }
-
-        {
-        vector bool char zero_01, zero_23, zero_45, zero_67;
-        vector signed char scanIndexes_01, scanIndexes_23, scanIndexes_45, scanIndexes_67;
-        vector signed char negOne = vec_splat_s8(-1);
-        vector signed char* scanPtr =
-                (vector signed char*)(s->intra_scantable.inverse);
-        signed char lastNonZeroChar;
-
-        // Determine the largest non-zero index.
-        zero_01 = vec_pack(vec_cmpeq(data0, (vector signed short)zero),
-                vec_cmpeq(data1, (vector signed short)zero));
-        zero_23 = vec_pack(vec_cmpeq(data2, (vector signed short)zero),
-                vec_cmpeq(data3, (vector signed short)zero));
-        zero_45 = vec_pack(vec_cmpeq(data4, (vector signed short)zero),
-                vec_cmpeq(data5, (vector signed short)zero));
-        zero_67 = vec_pack(vec_cmpeq(data6, (vector signed short)zero),
-                vec_cmpeq(data7, (vector signed short)zero));
-
-        // 64 biggest values
-        scanIndexes_01 = vec_sel(scanPtr[0], negOne, zero_01);
-        scanIndexes_23 = vec_sel(scanPtr[1], negOne, zero_23);
-        scanIndexes_45 = vec_sel(scanPtr[2], negOne, zero_45);
-        scanIndexes_67 = vec_sel(scanPtr[3], negOne, zero_67);
-
-        // 32 largest values
-        scanIndexes_01 = vec_max(scanIndexes_01, scanIndexes_23);
-        scanIndexes_45 = vec_max(scanIndexes_45, scanIndexes_67);
-
-        // 16 largest values
-        scanIndexes_01 = vec_max(scanIndexes_01, scanIndexes_45);
-
-        // 8 largest values
-        scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
-                vec_mergel(scanIndexes_01, negOne));
-
-        // 4 largest values
-        scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
-                vec_mergel(scanIndexes_01, negOne));
-
-        // 2 largest values
-        scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
-                vec_mergel(scanIndexes_01, negOne));
-
-        // largest value
-        scanIndexes_01 = vec_max(vec_mergeh(scanIndexes_01, negOne),
-                vec_mergel(scanIndexes_01, negOne));
-
-        scanIndexes_01 = vec_splat(scanIndexes_01, 0);
-
-
-        vec_ste(scanIndexes_01, 0, &lastNonZeroChar);
-
-        lastNonZero = lastNonZeroChar;
-
-        // While the data is still in vectors we check for the transpose IDCT permute
-        // and handle it using the vector unit if we can.  This is the permute used
-        // by the altivec idct, so it is common when using the altivec dct.
-
-        if ((lastNonZero > 0) && (s->dsp.idct_permutation_type == FF_TRANSPOSE_IDCT_PERM)) {
-            TRANSPOSE8(data0, data1, data2, data3, data4, data5, data6, data7);
-        }
-
-        vec_st(data0, 0, data);
-        vec_st(data1, 16, data);
-        vec_st(data2, 32, data);
-        vec_st(data3, 48, data);
-        vec_st(data4, 64, data);
-        vec_st(data5, 80, data);
-        vec_st(data6, 96, data);
-        vec_st(data7, 112, data);
-        }
-    }
-
-    // special handling of block[0]
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                oldBaseValue /= s->y_dc_scale;
-            else
-                oldBaseValue /= s->c_dc_scale;
-        }
-
-        // Divide by 8, rounding the result
-        data[0] = (oldBaseValue + 4) >> 3;
-    }
-
-    // We handled the transpose permutation above and we don't
-    // need to permute the "no" permutation case.
-    if ((lastNonZero > 0) &&
-        (s->dsp.idct_permutation_type != FF_TRANSPOSE_IDCT_PERM) &&
-        (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM)) {
-        ff_block_permute(data, s->dsp.idct_permutation,
-                s->intra_scantable.scantable, lastNonZero);
-    }
-
-    return lastNonZero;
-}
-
-/* AltiVec version of dct_unquantize_h263
-   this code assumes `block' is 16 bytes-aligned */
-static void dct_unquantize_h263_altivec(MpegEncContext *s,
-                                 DCTELEM *block, int n, int qscale)
-{
-POWERPC_PERF_DECLARE(altivec_dct_unquantize_h263_num, 1);
-    int i, level, qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-POWERPC_PERF_START_COUNT(altivec_dct_unquantize_h263_num, 1);
-
-    qadd = (qscale - 1) | 1;
-    qmul = qscale << 1;
-
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                block[0] = block[0] * s->y_dc_scale;
-            else
-                block[0] = block[0] * s->c_dc_scale;
-        }else
-            qadd = 0;
-        i = 1;
-        nCoeffs= 63; //does not always use zigzag table
-    } else {
-        i = 0;
-        nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
-    }
-
-    {
-        register const vector signed short vczero = (const vector signed short)vec_splat_s16(0);
-        DECLARE_ALIGNED(16, short, qmul8) = qmul;
-        DECLARE_ALIGNED(16, short, qadd8) = qadd;
-        register vector signed short blockv, qmulv, qaddv, nqaddv, temp1;
-        register vector bool short blockv_null, blockv_neg;
-        register short backup_0 = block[0];
-        register int j = 0;
-
-        qmulv = vec_splat((vec_s16)vec_lde(0, &qmul8), 0);
-        qaddv = vec_splat((vec_s16)vec_lde(0, &qadd8), 0);
-        nqaddv = vec_sub(vczero, qaddv);
-
-#if 0   // block *is* 16 bytes-aligned, it seems.
-        // first make sure block[j] is 16 bytes-aligned
-        for(j = 0; (j <= nCoeffs) && ((((unsigned long)block) + (j << 1)) & 0x0000000F) ; j++) {
-            level = block[j];
-            if (level) {
-                if (level < 0) {
-                    level = level * qmul - qadd;
-                } else {
-                    level = level * qmul + qadd;
-                }
-                block[j] = level;
-            }
-        }
-#endif
-
-        // vectorize all the 16 bytes-aligned blocks
-        // of 8 elements
-        for(; (j + 7) <= nCoeffs ; j+=8) {
-            blockv = vec_ld(j << 1, block);
-            blockv_neg = vec_cmplt(blockv, vczero);
-            blockv_null = vec_cmpeq(blockv, vczero);
-            // choose between +qadd or -qadd as the third operand
-            temp1 = vec_sel(qaddv, nqaddv, blockv_neg);
-            // multiply & add (block{i,i+7} * qmul [+-] qadd)
-            temp1 = vec_mladd(blockv, qmulv, temp1);
-            // put 0 where block[{i,i+7} used to have 0
-            blockv = vec_sel(temp1, blockv, blockv_null);
-            vec_st(blockv, j << 1, block);
-        }
-
-        // if nCoeffs isn't a multiple of 8, finish the job
-        // using good old scalar units.
-        // (we could do it using a truncated vector,
-        // but I'm not sure it's worth the hassle)
-        for(; j <= nCoeffs ; j++) {
-            level = block[j];
-            if (level) {
-                if (level < 0) {
-                    level = level * qmul - qadd;
-                } else {
-                    level = level * qmul + qadd;
-                }
-                block[j] = level;
-            }
-        }
-
-        if (i == 1) {
-            // cheat. this avoid special-casing the first iteration
-            block[0] = backup_0;
-        }
-    }
-POWERPC_PERF_STOP_COUNT(altivec_dct_unquantize_h263_num, nCoeffs == 63);
-}
-
-
-void MPV_common_init_altivec(MpegEncContext *s)
-{
-    if ((mm_flags & FF_MM_ALTIVEC) == 0) return;
-
-    if (s->avctx->lowres==0) {
-        if ((s->avctx->idct_algo == FF_IDCT_AUTO) ||
-            (s->avctx->idct_algo == FF_IDCT_ALTIVEC)) {
-            s->dsp.idct_put = idct_put_altivec;
-            s->dsp.idct_add = idct_add_altivec;
-            s->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
-        }
-    }
-
-    // Test to make sure that the dct required alignments are met.
-    if ((((long)(s->q_intra_matrix) & 0x0f) != 0) ||
-        (((long)(s->q_inter_matrix) & 0x0f) != 0)) {
-        av_log(s->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned "
-                "to use AltiVec DCT. Reverting to non-AltiVec version.\n");
-        return;
-    }
-
-    if (((long)(s->intra_scantable.inverse) & 0x0f) != 0) {
-        av_log(s->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned "
-                "to use AltiVec DCT. Reverting to non-AltiVec version.\n");
-        return;
-    }
-
-
-    if ((s->avctx->dct_algo == FF_DCT_AUTO) ||
-            (s->avctx->dct_algo == FF_DCT_ALTIVEC)) {
-#if 0 /* seems to cause trouble under some circumstances */
-        s->dct_quantize = dct_quantize_altivec;
-#endif
-        s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec;
-        s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec;
-    }
-}
diff --git a/libavcodec/ppc/types_altivec.h b/libavcodec/ppc/types_altivec.h
deleted file mode 100644
index 2870e83..0000000
--- a/libavcodec/ppc/types_altivec.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2006 Guillaume Poirier <gpoirier at mplayerhq.hu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PPC_TYPES_ALTIVEC_H
-#define AVCODEC_PPC_TYPES_ALTIVEC_H
-
-/***********************************************************************
- * Vector types
- **********************************************************************/
-#define vec_u8  vector unsigned char
-#define vec_s8  vector signed char
-#define vec_u16 vector unsigned short
-#define vec_s16 vector signed short
-#define vec_u32 vector unsigned int
-#define vec_s32 vector signed int
-
-/***********************************************************************
- * Null vector
- **********************************************************************/
-#define LOAD_ZERO const vec_u8 zerov = vec_splat_u8( 0 )
-
-#define zero_u8v  (vec_u8)  zerov
-#define zero_s8v  (vec_s8)  zerov
-#define zero_u16v (vec_u16) zerov
-#define zero_s16v (vec_s16) zerov
-#define zero_u32v (vec_u32) zerov
-#define zero_s32v (vec_s32) zerov
-
-#endif /* AVCODEC_PPC_TYPES_ALTIVEC_H */
diff --git a/libavcodec/ppc/util_altivec.h b/libavcodec/ppc/util_altivec.h
deleted file mode 100644
index 62f228a..0000000
--- a/libavcodec/ppc/util_altivec.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Contains misc utility macros and inline functions
- */
-
-#ifndef AVCODEC_PPC_UTIL_ALTIVEC_H
-#define AVCODEC_PPC_UTIL_ALTIVEC_H
-
-#include <stdint.h>
-
-#include "config.h"
-
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-// used to build registers permutation vectors (vcprm)
-// the 's' are for words in the _s_econd vector
-#define WORD_0 0x00,0x01,0x02,0x03
-#define WORD_1 0x04,0x05,0x06,0x07
-#define WORD_2 0x08,0x09,0x0a,0x0b
-#define WORD_3 0x0c,0x0d,0x0e,0x0f
-#define WORD_s0 0x10,0x11,0x12,0x13
-#define WORD_s1 0x14,0x15,0x16,0x17
-#define WORD_s2 0x18,0x19,0x1a,0x1b
-#define WORD_s3 0x1c,0x1d,0x1e,0x1f
-
-#define vcprm(a,b,c,d) (const vector unsigned char){WORD_ ## a, WORD_ ## b, WORD_ ## c, WORD_ ## d}
-#define vcii(a,b,c,d) (const vector float){FLOAT_ ## a, FLOAT_ ## b, FLOAT_ ## c, FLOAT_ ## d}
-
-// vcprmle is used to keep the same index as in the SSE version.
-// it's the same as vcprm, with the index inversed
-// ('le' is Little Endian)
-#define vcprmle(a,b,c,d) vcprm(d,c,b,a)
-
-// used to build inverse/identity vectors (vcii)
-// n is _n_egative, p is _p_ositive
-#define FLOAT_n -1.
-#define FLOAT_p 1.
-
-
-// Transpose 8x8 matrix of 16-bit elements (in-place)
-#define TRANSPOSE8(a,b,c,d,e,f,g,h) \
-do { \
-    vector signed short A1, B1, C1, D1, E1, F1, G1, H1; \
-    vector signed short A2, B2, C2, D2, E2, F2, G2, H2; \
- \
-    A1 = vec_mergeh (a, e); \
-    B1 = vec_mergel (a, e); \
-    C1 = vec_mergeh (b, f); \
-    D1 = vec_mergel (b, f); \
-    E1 = vec_mergeh (c, g); \
-    F1 = vec_mergel (c, g); \
-    G1 = vec_mergeh (d, h); \
-    H1 = vec_mergel (d, h); \
- \
-    A2 = vec_mergeh (A1, E1); \
-    B2 = vec_mergel (A1, E1); \
-    C2 = vec_mergeh (B1, F1); \
-    D2 = vec_mergel (B1, F1); \
-    E2 = vec_mergeh (C1, G1); \
-    F2 = vec_mergel (C1, G1); \
-    G2 = vec_mergeh (D1, H1); \
-    H2 = vec_mergel (D1, H1); \
- \
-    a = vec_mergeh (A2, E2); \
-    b = vec_mergel (A2, E2); \
-    c = vec_mergeh (B2, F2); \
-    d = vec_mergel (B2, F2); \
-    e = vec_mergeh (C2, G2); \
-    f = vec_mergel (C2, G2); \
-    g = vec_mergeh (D2, H2); \
-    h = vec_mergel (D2, H2); \
-} while (0)
-
-
-/** \brief loads unaligned vector \a *src with offset \a offset
-    and returns it */
-static inline vector unsigned char unaligned_load(int offset, uint8_t *src)
-{
-    register vector unsigned char first = vec_ld(offset, src);
-    register vector unsigned char second = vec_ld(offset+15, src);
-    register vector unsigned char mask = vec_lvsl(offset, src);
-    return vec_perm(first, second, mask);
-}
-
-#endif /* AVCODEC_PPC_UTIL_ALTIVEC_H */
diff --git a/libavcodec/ppc/vc1dsp_altivec.c b/libavcodec/ppc/vc1dsp_altivec.c
deleted file mode 100644
index a2f55f2..0000000
--- a/libavcodec/ppc/vc1dsp_altivec.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * VC-1 and WMV3 decoder - DSP functions AltiVec-optimized
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-
-#include "util_altivec.h"
-#include "dsputil_altivec.h"
-
-// main steps of 8x8 transform
-#define STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_rnd) \
-do { \
-    t0 = vec_sl(vec_add(s0, s4), vec_2); \
-    t0 = vec_add(vec_sl(t0, vec_1), t0); \
-    t0 = vec_add(t0, vec_rnd); \
-    t1 = vec_sl(vec_sub(s0, s4), vec_2); \
-    t1 = vec_add(vec_sl(t1, vec_1), t1); \
-    t1 = vec_add(t1, vec_rnd); \
-    t2 = vec_add(vec_sl(s6, vec_2), vec_sl(s6, vec_1)); \
-    t2 = vec_add(t2, vec_sl(s2, vec_4)); \
-    t3 = vec_add(vec_sl(s2, vec_2), vec_sl(s2, vec_1)); \
-    t3 = vec_sub(t3, vec_sl(s6, vec_4)); \
-    t4 = vec_add(t0, t2); \
-    t5 = vec_add(t1, t3); \
-    t6 = vec_sub(t1, t3); \
-    t7 = vec_sub(t0, t2); \
-\
-    t0 = vec_sl(vec_add(s1, s3), vec_4); \
-    t0 = vec_add(t0, vec_sl(s5, vec_3)); \
-    t0 = vec_add(t0, vec_sl(s7, vec_2)); \
-    t0 = vec_add(t0, vec_sub(s5, s3)); \
-\
-    t1 = vec_sl(vec_sub(s1, s5), vec_4); \
-    t1 = vec_sub(t1, vec_sl(s7, vec_3)); \
-    t1 = vec_sub(t1, vec_sl(s3, vec_2)); \
-    t1 = vec_sub(t1, vec_add(s1, s7)); \
-\
-    t2 = vec_sl(vec_sub(s7, s3), vec_4); \
-    t2 = vec_add(t2, vec_sl(s1, vec_3)); \
-    t2 = vec_add(t2, vec_sl(s5, vec_2)); \
-    t2 = vec_add(t2, vec_sub(s1, s7)); \
-\
-    t3 = vec_sl(vec_sub(s5, s7), vec_4); \
-    t3 = vec_sub(t3, vec_sl(s3, vec_3)); \
-    t3 = vec_add(t3, vec_sl(s1, vec_2)); \
-    t3 = vec_sub(t3, vec_add(s3, s5)); \
-\
-    s0 = vec_add(t4, t0); \
-    s1 = vec_add(t5, t1); \
-    s2 = vec_add(t6, t2); \
-    s3 = vec_add(t7, t3); \
-    s4 = vec_sub(t7, t3); \
-    s5 = vec_sub(t6, t2); \
-    s6 = vec_sub(t5, t1); \
-    s7 = vec_sub(t4, t0); \
-}while(0)
-
-#define SHIFT_HOR8(s0, s1, s2, s3, s4, s5, s6, s7) \
-do { \
-    s0 = vec_sra(s0, vec_3); \
-    s1 = vec_sra(s1, vec_3); \
-    s2 = vec_sra(s2, vec_3); \
-    s3 = vec_sra(s3, vec_3); \
-    s4 = vec_sra(s4, vec_3); \
-    s5 = vec_sra(s5, vec_3); \
-    s6 = vec_sra(s6, vec_3); \
-    s7 = vec_sra(s7, vec_3); \
-}while(0)
-
-#define SHIFT_VERT8(s0, s1, s2, s3, s4, s5, s6, s7) \
-do { \
-    s0 = vec_sra(s0, vec_7); \
-    s1 = vec_sra(s1, vec_7); \
-    s2 = vec_sra(s2, vec_7); \
-    s3 = vec_sra(s3, vec_7); \
-    s4 = vec_sra(vec_add(s4, vec_1s), vec_7); \
-    s5 = vec_sra(vec_add(s5, vec_1s), vec_7); \
-    s6 = vec_sra(vec_add(s6, vec_1s), vec_7); \
-    s7 = vec_sra(vec_add(s7, vec_1s), vec_7); \
-}while(0)
-
-/* main steps of 4x4 transform */
-#define STEP4(s0, s1, s2, s3, vec_rnd) \
-do { \
-    t1 = vec_add(vec_sl(s0, vec_4), s0); \
-    t1 = vec_add(t1, vec_rnd); \
-    t2 = vec_add(vec_sl(s2, vec_4), s2); \
-    t0 = vec_add(t1, t2); \
-    t1 = vec_sub(t1, t2); \
-    t3 = vec_sl(vec_sub(s3, s1), vec_1); \
-    t3 = vec_add(t3, vec_sl(t3, vec_2)); \
-    t2 = vec_add(t3, vec_sl(s1, vec_5)); \
-    t3 = vec_add(t3, vec_sl(s3, vec_3)); \
-    t3 = vec_add(t3, vec_sl(s3, vec_2)); \
-    s0 = vec_add(t0, t2); \
-    s1 = vec_sub(t1, t3); \
-    s2 = vec_add(t1, t3); \
-    s3 = vec_sub(t0, t2); \
-}while (0)
-
-#define SHIFT_HOR4(s0, s1, s2, s3) \
-    s0 = vec_sra(s0, vec_3); \
-    s1 = vec_sra(s1, vec_3); \
-    s2 = vec_sra(s2, vec_3); \
-    s3 = vec_sra(s3, vec_3);
-
-#define SHIFT_VERT4(s0, s1, s2, s3) \
-    s0 = vec_sra(s0, vec_7); \
-    s1 = vec_sra(s1, vec_7); \
-    s2 = vec_sra(s2, vec_7); \
-    s3 = vec_sra(s3, vec_7);
-
-/** Do inverse transform on 8x8 block
-*/
-static void vc1_inv_trans_8x8_altivec(DCTELEM block[64])
-{
-    vector signed short src0, src1, src2, src3, src4, src5, src6, src7;
-    vector signed int s0, s1, s2, s3, s4, s5, s6, s7;
-    vector signed int s8, s9, sA, sB, sC, sD, sE, sF;
-    vector signed int t0, t1, t2, t3, t4, t5, t6, t7;
-    const vector signed int vec_64 = vec_sl(vec_splat_s32(4), vec_splat_u32(4));
-    const vector unsigned int vec_7 = vec_splat_u32(7);
-    const vector unsigned int vec_4 = vec_splat_u32(4);
-    const vector  signed int vec_4s = vec_splat_s32(4);
-    const vector unsigned int vec_3 = vec_splat_u32(3);
-    const vector unsigned int vec_2 = vec_splat_u32(2);
-    const vector  signed int vec_1s = vec_splat_s32(1);
-    const vector unsigned int vec_1 = vec_splat_u32(1);
-
-
-    src0 = vec_ld(  0, block);
-    src1 = vec_ld( 16, block);
-    src2 = vec_ld( 32, block);
-    src3 = vec_ld( 48, block);
-    src4 = vec_ld( 64, block);
-    src5 = vec_ld( 80, block);
-    src6 = vec_ld( 96, block);
-    src7 = vec_ld(112, block);
-
-    TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7);
-    s0 = vec_unpackl(src0);
-    s1 = vec_unpackl(src1);
-    s2 = vec_unpackl(src2);
-    s3 = vec_unpackl(src3);
-    s4 = vec_unpackl(src4);
-    s5 = vec_unpackl(src5);
-    s6 = vec_unpackl(src6);
-    s7 = vec_unpackl(src7);
-    s8 = vec_unpackh(src0);
-    s9 = vec_unpackh(src1);
-    sA = vec_unpackh(src2);
-    sB = vec_unpackh(src3);
-    sC = vec_unpackh(src4);
-    sD = vec_unpackh(src5);
-    sE = vec_unpackh(src6);
-    sF = vec_unpackh(src7);
-    STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_4s);
-    SHIFT_HOR8(s0, s1, s2, s3, s4, s5, s6, s7);
-    STEP8(s8, s9, sA, sB, sC, sD, sE, sF, vec_4s);
-    SHIFT_HOR8(s8, s9, sA, sB, sC, sD, sE, sF);
-    src0 = vec_pack(s8, s0);
-    src1 = vec_pack(s9, s1);
-    src2 = vec_pack(sA, s2);
-    src3 = vec_pack(sB, s3);
-    src4 = vec_pack(sC, s4);
-    src5 = vec_pack(sD, s5);
-    src6 = vec_pack(sE, s6);
-    src7 = vec_pack(sF, s7);
-    TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7);
-
-    s0 = vec_unpackl(src0);
-    s1 = vec_unpackl(src1);
-    s2 = vec_unpackl(src2);
-    s3 = vec_unpackl(src3);
-    s4 = vec_unpackl(src4);
-    s5 = vec_unpackl(src5);
-    s6 = vec_unpackl(src6);
-    s7 = vec_unpackl(src7);
-    s8 = vec_unpackh(src0);
-    s9 = vec_unpackh(src1);
-    sA = vec_unpackh(src2);
-    sB = vec_unpackh(src3);
-    sC = vec_unpackh(src4);
-    sD = vec_unpackh(src5);
-    sE = vec_unpackh(src6);
-    sF = vec_unpackh(src7);
-    STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_64);
-    SHIFT_VERT8(s0, s1, s2, s3, s4, s5, s6, s7);
-    STEP8(s8, s9, sA, sB, sC, sD, sE, sF, vec_64);
-    SHIFT_VERT8(s8, s9, sA, sB, sC, sD, sE, sF);
-    src0 = vec_pack(s8, s0);
-    src1 = vec_pack(s9, s1);
-    src2 = vec_pack(sA, s2);
-    src3 = vec_pack(sB, s3);
-    src4 = vec_pack(sC, s4);
-    src5 = vec_pack(sD, s5);
-    src6 = vec_pack(sE, s6);
-    src7 = vec_pack(sF, s7);
-
-    vec_st(src0,  0, block);
-    vec_st(src1, 16, block);
-    vec_st(src2, 32, block);
-    vec_st(src3, 48, block);
-    vec_st(src4, 64, block);
-    vec_st(src5, 80, block);
-    vec_st(src6, 96, block);
-    vec_st(src7,112, block);
-}
-
-/** Do inverse transform on 8x4 part of block
-*/
-static void vc1_inv_trans_8x4_altivec(uint8_t *dest, int stride, DCTELEM *block)
-{
-    vector signed short src0, src1, src2, src3, src4, src5, src6, src7;
-    vector signed int s0, s1, s2, s3, s4, s5, s6, s7;
-    vector signed int s8, s9, sA, sB, sC, sD, sE, sF;
-    vector signed int t0, t1, t2, t3, t4, t5, t6, t7;
-    const vector signed int vec_64 = vec_sl(vec_splat_s32(4), vec_splat_u32(4));
-    const vector unsigned int vec_7 = vec_splat_u32(7);
-    const vector unsigned int vec_5 = vec_splat_u32(5);
-    const vector unsigned int vec_4 = vec_splat_u32(4);
-    const vector  signed int vec_4s = vec_splat_s32(4);
-    const vector unsigned int vec_3 = vec_splat_u32(3);
-    const vector unsigned int vec_2 = vec_splat_u32(2);
-    const vector unsigned int vec_1 = vec_splat_u32(1);
-    vector unsigned char tmp;
-    vector signed short tmp2, tmp3;
-    vector unsigned char perm0, perm1, p0, p1, p;
-
-    src0 = vec_ld(  0, block);
-    src1 = vec_ld( 16, block);
-    src2 = vec_ld( 32, block);
-    src3 = vec_ld( 48, block);
-    src4 = vec_ld( 64, block);
-    src5 = vec_ld( 80, block);
-    src6 = vec_ld( 96, block);
-    src7 = vec_ld(112, block);
-
-    TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7);
-    s0 = vec_unpackl(src0);
-    s1 = vec_unpackl(src1);
-    s2 = vec_unpackl(src2);
-    s3 = vec_unpackl(src3);
-    s4 = vec_unpackl(src4);
-    s5 = vec_unpackl(src5);
-    s6 = vec_unpackl(src6);
-    s7 = vec_unpackl(src7);
-    s8 = vec_unpackh(src0);
-    s9 = vec_unpackh(src1);
-    sA = vec_unpackh(src2);
-    sB = vec_unpackh(src3);
-    sC = vec_unpackh(src4);
-    sD = vec_unpackh(src5);
-    sE = vec_unpackh(src6);
-    sF = vec_unpackh(src7);
-    STEP8(s0, s1, s2, s3, s4, s5, s6, s7, vec_4s);
-    SHIFT_HOR8(s0, s1, s2, s3, s4, s5, s6, s7);
-    STEP8(s8, s9, sA, sB, sC, sD, sE, sF, vec_4s);
-    SHIFT_HOR8(s8, s9, sA, sB, sC, sD, sE, sF);
-    src0 = vec_pack(s8, s0);
-    src1 = vec_pack(s9, s1);
-    src2 = vec_pack(sA, s2);
-    src3 = vec_pack(sB, s3);
-    src4 = vec_pack(sC, s4);
-    src5 = vec_pack(sD, s5);
-    src6 = vec_pack(sE, s6);
-    src7 = vec_pack(sF, s7);
-    TRANSPOSE8(src0, src1, src2, src3, src4, src5, src6, src7);
-
-    s0 = vec_unpackh(src0);
-    s1 = vec_unpackh(src1);
-    s2 = vec_unpackh(src2);
-    s3 = vec_unpackh(src3);
-    s8 = vec_unpackl(src0);
-    s9 = vec_unpackl(src1);
-    sA = vec_unpackl(src2);
-    sB = vec_unpackl(src3);
-    STEP4(s0, s1, s2, s3, vec_64);
-    SHIFT_VERT4(s0, s1, s2, s3);
-    STEP4(s8, s9, sA, sB, vec_64);
-    SHIFT_VERT4(s8, s9, sA, sB);
-    src0 = vec_pack(s0, s8);
-    src1 = vec_pack(s1, s9);
-    src2 = vec_pack(s2, sA);
-    src3 = vec_pack(s3, sB);
-
-    p0 = vec_lvsl (0, dest);
-    p1 = vec_lvsl (stride, dest);
-    p = vec_splat_u8 (-1);
-    perm0 = vec_mergeh (p, p0);
-    perm1 = vec_mergeh (p, p1);
-
-#define ADD(dest,src,perm)                                              \
-    /* *(uint64_t *)&tmp = *(uint64_t *)dest; */                        \
-    tmp = vec_ld (0, dest);                                             \
-    tmp2 = (vector signed short)vec_perm (tmp, vec_splat_u8(0), perm);  \
-    tmp3 = vec_adds (tmp2, src);                                        \
-    tmp = vec_packsu (tmp3, tmp3);                                      \
-    vec_ste ((vector unsigned int)tmp, 0, (unsigned int *)dest);        \
-    vec_ste ((vector unsigned int)tmp, 4, (unsigned int *)dest);
-
-    ADD (dest, src0, perm0)      dest += stride;
-    ADD (dest, src1, perm1)      dest += stride;
-    ADD (dest, src2, perm0)      dest += stride;
-    ADD (dest, src3, perm1)
-}
-
-
-void vc1dsp_init_altivec(DSPContext* dsp, AVCodecContext *avctx) {
-    dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_altivec;
-    dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_altivec;
-}
diff --git a/libavcodec/ppc/vp3dsp_altivec.c b/libavcodec/ppc/vp3dsp_altivec.c
deleted file mode 100644
index b0509d8..0000000
--- a/libavcodec/ppc/vp3dsp_altivec.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2009 David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "util_altivec.h"
-#include "types_altivec.h"
-#include "dsputil_altivec.h"
-
-static const vec_s16 constants =
-    {0, 64277, 60547, 54491, 46341, 36410, 25080, 12785};
-static const vec_u8 interleave_high =
-    {0, 1, 16, 17, 4, 5, 20, 21, 8, 9, 24, 25, 12, 13, 28, 29};
-
-#define IDCT_START \
-    vec_s16 A, B, C, D, Ad, Bd, Cd, Dd, E, F, G, H;\
-    vec_s16 Ed, Gd, Add, Bdd, Fd, Hd;\
-    vec_s16 eight = vec_splat_s16(8);\
-    vec_u16 four = vec_splat_u16(4);\
-\
-    vec_s16 C1 = vec_splat(constants, 1);\
-    vec_s16 C2 = vec_splat(constants, 2);\
-    vec_s16 C3 = vec_splat(constants, 3);\
-    vec_s16 C4 = vec_splat(constants, 4);\
-    vec_s16 C5 = vec_splat(constants, 5);\
-    vec_s16 C6 = vec_splat(constants, 6);\
-    vec_s16 C7 = vec_splat(constants, 7);\
-\
-    vec_s16 b0 = vec_ld(0x00, block);\
-    vec_s16 b1 = vec_ld(0x10, block);\
-    vec_s16 b2 = vec_ld(0x20, block);\
-    vec_s16 b3 = vec_ld(0x30, block);\
-    vec_s16 b4 = vec_ld(0x40, block);\
-    vec_s16 b5 = vec_ld(0x50, block);\
-    vec_s16 b6 = vec_ld(0x60, block);\
-    vec_s16 b7 = vec_ld(0x70, block);
-
-// these functions do (a*C)>>16
-// things are tricky because a is signed, but C unsigned.
-// M15 is used if C fits in 15 bit unsigned (C6,C7)
-// M16 is used if C requires 16 bits unsigned
-static inline vec_s16 M15(vec_s16 a, vec_s16 C)
-{
-    return (vec_s16)vec_perm(vec_mule(a,C), vec_mulo(a,C), interleave_high);
-}
-static inline vec_s16 M16(vec_s16 a, vec_s16 C)
-{
-    return vec_add(a, M15(a, C));
-}
-
-#define IDCT_1D(ADD, SHIFT)\
-    A = vec_add(M16(b1, C1), M15(b7, C7));\
-    B = vec_sub(M15(b1, C7), M16(b7, C1));\
-    C = vec_add(M16(b3, C3), M16(b5, C5));\
-    D = vec_sub(M16(b5, C3), M16(b3, C5));\
-\
-    Ad = M16(vec_sub(A, C), C4);\
-    Bd = M16(vec_sub(B, D), C4);\
-\
-    Cd = vec_add(A, C);\
-    Dd = vec_add(B, D);\
-\
-    E = ADD(M16(vec_add(b0, b4), C4));\
-    F = ADD(M16(vec_sub(b0, b4), C4));\
-\
-    G = vec_add(M16(b2, C2), M15(b6, C6));\
-    H = vec_sub(M15(b2, C6), M16(b6, C2));\
-\
-    Ed = vec_sub(E, G);\
-    Gd = vec_add(E, G);\
-\
-    Add = vec_add(F, Ad);\
-    Bdd = vec_sub(Bd, H);\
-\
-    Fd = vec_sub(F, Ad);\
-    Hd = vec_add(Bd, H);\
-\
-    b0 = SHIFT(vec_add(Gd, Cd));\
-    b7 = SHIFT(vec_sub(Gd, Cd));\
-\
-    b1 = SHIFT(vec_add(Add, Hd));\
-    b2 = SHIFT(vec_sub(Add, Hd));\
-\
-    b3 = SHIFT(vec_add(Ed, Dd));\
-    b4 = SHIFT(vec_sub(Ed, Dd));\
-\
-    b5 = SHIFT(vec_add(Fd, Bdd));\
-    b6 = SHIFT(vec_sub(Fd, Bdd));
-
-#define NOP(a) a
-#define ADD8(a) vec_add(a, eight)
-#define SHIFT4(a) vec_sra(a, four)
-
-void ff_vp3_idct_altivec(DCTELEM block[64])
-{
-    IDCT_START
-
-    IDCT_1D(NOP, NOP)
-    TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);
-    IDCT_1D(ADD8, SHIFT4)
-
-    vec_st(b0, 0x00, block);
-    vec_st(b1, 0x10, block);
-    vec_st(b2, 0x20, block);
-    vec_st(b3, 0x30, block);
-    vec_st(b4, 0x40, block);
-    vec_st(b5, 0x50, block);
-    vec_st(b6, 0x60, block);
-    vec_st(b7, 0x70, block);
-}
-
-void ff_vp3_idct_put_altivec(uint8_t *dst, int stride, DCTELEM block[64])
-{
-    vec_u8 t;
-    IDCT_START
-
-    // pixels are signed; so add 128*16 in addition to the normal 8
-    vec_s16 v2048 = vec_sl(vec_splat_s16(1), vec_splat_u16(11));
-    eight = vec_add(eight, v2048);
-
-    IDCT_1D(NOP, NOP)
-    TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);
-    IDCT_1D(ADD8, SHIFT4)
-
-#define PUT(a)\
-    t = vec_packsu(a, a);\
-    vec_ste((vec_u32)t, 0, (unsigned int *)dst);\
-    vec_ste((vec_u32)t, 4, (unsigned int *)dst);
-
-    PUT(b0)     dst += stride;
-    PUT(b1)     dst += stride;
-    PUT(b2)     dst += stride;
-    PUT(b3)     dst += stride;
-    PUT(b4)     dst += stride;
-    PUT(b5)     dst += stride;
-    PUT(b6)     dst += stride;
-    PUT(b7)
-}
-
-void ff_vp3_idct_add_altivec(uint8_t *dst, int stride, DCTELEM block[64])
-{
-    LOAD_ZERO;
-    vec_u8 t, vdst;
-    vec_s16 vdst_16;
-    vec_u8 vdst_mask = vec_mergeh(vec_splat_u8(-1), vec_lvsl(0, dst));
-
-    IDCT_START
-
-    IDCT_1D(NOP, NOP)
-    TRANSPOSE8(b0, b1, b2, b3, b4, b5, b6, b7);
-    IDCT_1D(ADD8, SHIFT4)
-
-#define ADD(a)\
-    vdst = vec_ld(0, dst);\
-    vdst_16 = (vec_s16)vec_perm(vdst, zero_u8v, vdst_mask);\
-    vdst_16 = vec_adds(a, vdst_16);\
-    t = vec_packsu(vdst_16, vdst_16);\
-    vec_ste((vec_u32)t, 0, (unsigned int *)dst);\
-    vec_ste((vec_u32)t, 4, (unsigned int *)dst);
-
-    ADD(b0)     dst += stride;
-    ADD(b1)     dst += stride;
-    ADD(b2)     dst += stride;
-    ADD(b3)     dst += stride;
-    ADD(b4)     dst += stride;
-    ADD(b5)     dst += stride;
-    ADD(b6)     dst += stride;
-    ADD(b7)
-}
diff --git a/libavcodec/ps2/dsputil_mmi.c b/libavcodec/ps2/dsputil_mmi.c
deleted file mode 100644
index 15b5b56..0000000
--- a/libavcodec/ps2/dsputil_mmi.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * MMI optimized DSP utils
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * MMI optimization by Leon van Stuivenberg
- * clear_blocks_mmi() by BroadQ
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "mmi.h"
-
-void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_mmi_idct(DCTELEM *block);
-
-static void clear_blocks_mmi(DCTELEM * blocks)
-{
-        __asm__ volatile(
-        ".set noreorder    \n"
-        "addiu $9, %0, 768 \n"
-        "nop               \n"
-        "1:                \n"
-        "sq $0, 0(%0)      \n"
-        "move $8, %0       \n"
-        "addi %0, %0, 64   \n"
-        "sq $0, 16($8)     \n"
-        "slt $10, %0, $9   \n"
-        "sq $0, 32($8)     \n"
-        "bnez $10, 1b      \n"
-        "sq $0, 48($8)     \n"
-        ".set reorder      \n"
-        : "+r" (blocks) ::  "$8", "$9", "memory" );
-}
-
-
-static void get_pixels_mmi(DCTELEM *block, const uint8_t *pixels, int line_size)
-{
-        __asm__ volatile(
-        ".set   push            \n\t"
-        ".set   mips3           \n\t"
-        "ld     $8, 0(%0)       \n\t"
-        "add    %0, %0, %2      \n\t"
-        "ld     $9, 0(%0)       \n\t"
-        "add    %0, %0, %2      \n\t"
-        "ld     $10, 0(%0)      \n\t"
-        "pextlb $8, $0, $8      \n\t"
-        "sq     $8, 0(%1)       \n\t"
-        "add    %0, %0, %2      \n\t"
-        "ld     $8, 0(%0)       \n\t"
-        "pextlb $9, $0, $9      \n\t"
-        "sq     $9, 16(%1)      \n\t"
-        "add    %0, %0, %2      \n\t"
-        "ld     $9, 0(%0)       \n\t"
-        "pextlb $10, $0, $10    \n\t"
-        "sq     $10, 32(%1)     \n\t"
-        "add    %0, %0, %2      \n\t"
-        "ld     $10, 0(%0)      \n\t"
-        "pextlb $8, $0, $8      \n\t"
-        "sq     $8, 48(%1)      \n\t"
-        "add    %0, %0, %2      \n\t"
-        "ld     $8, 0(%0)       \n\t"
-        "pextlb $9, $0, $9      \n\t"
-        "sq     $9, 64(%1)      \n\t"
-        "add    %0, %0, %2      \n\t"
-        "ld     $9, 0(%0)       \n\t"
-        "pextlb $10, $0, $10    \n\t"
-        "sq     $10, 80(%1)     \n\t"
-        "pextlb $8, $0, $8      \n\t"
-        "sq     $8, 96(%1)      \n\t"
-        "pextlb $9, $0, $9      \n\t"
-        "sq     $9, 112(%1)     \n\t"
-        ".set   pop             \n\t"
-        : "+r" (pixels) : "r" (block), "r" (line_size) : "$8", "$9", "$10", "memory" );
-}
-
-
-static void put_pixels8_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-        __asm__ volatile(
-        ".set   push            \n\t"
-        ".set   mips3           \n\t"
-        "1:                     \n\t"
-        "ldr    $8, 0(%1)       \n\t"
-        "addiu  %2, %2, -1      \n\t"
-        "ldl    $8, 7(%1)       \n\t"
-        "add    %1, %1, %3      \n\t"
-        "sd     $8, 0(%0)       \n\t"
-        "add    %0, %0, %3      \n\t"
-        "bgtz   %2, 1b          \n\t"
-        ".set   pop             \n\t"
-        : "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
-        : "$8", "memory" );
-}
-
-
-static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-        __asm__ volatile (
-        ".set   push            \n\t"
-        ".set   mips3           \n\t"
-        "1:                     \n\t"
-        "ldr    $8, 0(%1)       \n\t"
-        "add    $11, %1, %3     \n\t"
-        "ldl    $8, 7(%1)       \n\t"
-        "add    $10, %0, %3     \n\t"
-        "ldr    $9, 8(%1)       \n\t"
-        "ldl    $9, 15(%1)      \n\t"
-        "ldr    $12, 0($11)     \n\t"
-        "add    %1, $11, %3     \n\t"
-        "ldl    $12, 7($11)     \n\t"
-        "pcpyld $8, $9, $8      \n\t"
-        "sq     $8, 0(%0)       \n\t"
-        "ldr    $13, 8($11)     \n\t"
-        "addiu  %2, %2, -2      \n\t"
-        "ldl    $13, 15($11)    \n\t"
-        "add    %0, $10, %3     \n\t"
-        "pcpyld $12, $13, $12   \n\t"
-        "sq     $12, 0($10)     \n\t"
-        "bgtz   %2, 1b          \n\t"
-        ".set   pop             \n\t"
-        : "+r" (block), "+r" (pixels), "+r" (h) : "r" (line_size)
-        : "$8", "$9", "$10", "$11", "$12", "$13", "memory" );
-}
-
-
-void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx)
-{
-    const int idct_algo= avctx->idct_algo;
-
-    c->clear_blocks = clear_blocks_mmi;
-
-    c->put_pixels_tab[1][0] = put_pixels8_mmi;
-    c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mmi;
-
-    c->put_pixels_tab[0][0] = put_pixels16_mmi;
-    c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mmi;
-
-    c->get_pixels = get_pixels_mmi;
-
-    if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_PS2){
-        c->idct_put= ff_mmi_idct_put;
-        c->idct_add= ff_mmi_idct_add;
-        c->idct    = ff_mmi_idct;
-        c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
-    }
-}
-
diff --git a/libavcodec/ps2/idct_mmi.c b/libavcodec/ps2/idct_mmi.c
deleted file mode 100644
index bfe362a..0000000
--- a/libavcodec/ps2/idct_mmi.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Originally provided by Intel at Application Note AP-922.
- *
- * Column code adapted from Peter Gubanov.
- * Copyright (c) 2000-2001 Peter Gubanov <peter at elecard.net.ru>
- * http://www.elecard.com/peter/idct.shtml
- * rounding trick copyright (c) 2000 Michel Lespinasse <walken at zoy.org>
- *
- * MMI port and (c) 2002 by Leon van Stuivenberg
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "libavcodec/dsputil.h"
-#include "mmi.h"
-
-#define BITS_INV_ACC    5       // 4 or 5 for IEEE
-#define SHIFT_INV_ROW   (16 - BITS_INV_ACC)
-#define SHIFT_INV_COL   (1 + BITS_INV_ACC)
-
-#define TG1             6518
-#define TG2             13573
-#define TG3             21895
-#define CS4             23170
-
-#define ROUNDER_0       0
-#define ROUNDER_1       16
-
-#define TAB_i_04        (32+0)
-#define TAB_i_17        (32+64)
-#define TAB_i_26        (32+128)
-#define TAB_i_35        (32+192)
-
-#define TG_1_16         (32+256+0)
-#define TG_2_16         (32+256+16)
-#define TG_3_16         (32+256+32)
-#define COS_4_16        (32+256+48)
-
-#define CLIPMAX         (32+256+64+0)
-
-static short consttable[] align16 = {
-/* rounder 0*/  // assume SHIFT_INV_ROW == 11
- 0x3ff, 1, 0x3ff, 1, 0x3ff, 1, 0x3ff, 1,
-/* rounder 1*/
- 0x3ff, 0, 0x3ff, 0, 0x3ff, 0, 0x3ff, 0,
-/* row 0/4*/
- 16384,  21407, -16384, -21407,  22725,  19266, -22725, -12873,
-  8867,  16384,   8867,  16384,   4520,  12873,  -4520,  19266,
- 16384,  -8867,  16384,  -8867,  12873, -22725,  19266, -22725,
- 21407, -16384, -21407,  16384,  19266,   4520, -12873,   4520,
-/* row 1/7*/
- 22725,  29692, -22725, -29692,  31521,  26722, -31521, -17855,
- 12299,  22725,  12299,  22725,   6270,  17855,  -6270,  26722,
- 22725, -12299,  22725, -12299,  17855, -31521,  26722, -31521,
- 29692, -22725, -29692,  22725,  26722,   6270, -17855,   6270,
-/* row 2/6*/
- 21407,  27969, -21407, -27969,  29692,  25172, -29692, -16819,
- 11585,  21407,  11585,  21407,   5906,  16819,  -5906,  25172,
- 21407, -11585,  21407, -11585,  16819, -29692,  25172, -29692,
- 27969, -21407, -27969,  21407,  25172,   5906, -16819,   5906,
-/*row 3/5*/
- 19266,  25172, -19266, -25172,  26722,  22654, -26722, -15137,
- 10426,  19266,  10426,  19266,   5315,  15137,  -5315,  22654,
- 19266, -10426,  19266, -10426,  15137, -26722,  22654, -26722,
- 25172, -19266, -25172,  19266,  22654,   5315, -15137,   5315,
-/*column constants*/
- TG1, TG1, TG1, TG1, TG1, TG1, TG1, TG1,
- TG2, TG2, TG2, TG2, TG2, TG2, TG2, TG2,
- TG3, TG3, TG3, TG3, TG3, TG3, TG3, TG3,
- CS4, CS4, CS4, CS4, CS4, CS4, CS4, CS4,
-/* clamp */
- 255, 255, 255, 255, 255, 255, 255, 255
-};
-
-
-#define DCT_8_INV_ROW1(blk, rowoff, taboff, rnd, outreg) { \
-        lq(blk, rowoff, $16);   /* r16 = x7  x5  x3  x1  x6  x4  x2  x0 */ \
-        /*slot*/ \
-        lq($24, 0+taboff, $17); /* r17 = w */ \
-        /*delay slot $16*/ \
-        lq($24, 16+taboff, $18);/* r18 = w */ \
-        prevh($16, $2);         /* r2  = x1  x3  x5  x7  x0  x2  x4  x6 */ \
-        lq($24, 32+taboff, $19);/* r19 = w */ \
-        phmadh($17, $16, $17);  /* r17 = b1"b0'a1"a0' */ \
-        lq($24, 48+taboff, $20);/* r20 = w */ \
-        phmadh($18, $2, $18);   /* r18 = b1'b0"a1'a0" */ \
-        phmadh($19, $16, $19);  /* r19 = b3"b2'a3"a2' */ \
-        phmadh($20, $2, $20);   /* r20 = b3'b2"a3'a2" */ \
-        paddw($17, $18, $17);   /* r17 = (b1)(b0)(a1)(a0) */ \
-        paddw($19, $20, $19);   /* r19 = (b3)(b2)(a3)(a2) */ \
-        pcpyld($19, $17, $18);  /* r18 = (a3)(a2)(a1)(a0) */ \
-        pcpyud($17, $19, $20);  /* r20 = (b3)(b2)(b1)(b0) */ \
-        paddw($18, rnd, $18);   /* r18 = (a3)(a2)(a1)(a0) */\
-        paddw($18, $20, $17);   /* r17 = ()()()(a0+b0) */ \
-        psubw($18, $20, $20);   /* r20 = ()()()(a0-b0) */ \
-        psraw($17, SHIFT_INV_ROW, $17); /* r17 = (y3 y2 y1 y0) */ \
-        psraw($20, SHIFT_INV_ROW, $20); /* r20 = (y4 y5 y6 y7) */ \
-        ppach($20, $17, outreg);/* out = y4 y5 y6 y7 y3 y2 y1 y0  Note order */ \
-\
-        prevh(outreg, $2);        \
-        pcpyud($2, $2, $2);        \
-        pcpyld($2, outreg, outreg);        \
-}
-
-
-#define DCT_8_INV_COL8() \
-\
-        lq($24, TG_3_16, $2);   /* r2  = tn3 */         \
-\
-        pmulth($11, $2, $17);   /* r17 = x3 * tn3 (6420) */ \
-        psraw($17, 15, $17);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $17, $17);   /* r17 = x3 * tn3 */    \
-        psubh($17, $13, $17);   /* r17 = tm35 */        \
-\
-        pmulth($13, $2, $18);   /* r18 = x5 * tn3 (6420) */ \
-        psraw($18, 15, $18);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $18, $18);   /* r18 = x5 * tn3 */    \
-        paddh($18, $11, $18);   /* r18 = tp35 */        \
-\
-        lq($24, TG_1_16, $2);   /* r2  = tn1 */         \
-\
-        pmulth($15, $2, $19);   /* r19 = x7 * tn1 (6420) */ \
-        psraw($19, 15, $19);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $19, $19);   /* r19 = x7 * tn1 */    \
-        paddh($19, $9, $19);    /* r19 = tp17 */        \
-\
-        pmulth($9, $2, $20);    /* r20 = x1 * tn1 (6420) */ \
-        psraw($20, 15, $20);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $20, $20);   /* r20 = x1 * tn1 */    \
-        psubh($20, $15, $20);   /* r20 = tm17 */        \
-\
-        psubh($19, $18, $3);    /* r3  = t1 */          \
-        paddh($20, $17, $16);   /* r16 = t2 */          \
-        psubh($20, $17, $23);   /* r23 = b3 */          \
-        paddh($19, $18, $20);   /* r20 = b0 */          \
-\
-        lq($24, COS_4_16, $2);  /* r2  = cs4 */         \
-\
-        paddh($3, $16, $21);    /* r21 = t1+t2 */       \
-        psubh($3, $16, $22);    /* r22 = t1-t2 */       \
-\
-        pmulth($21, $2, $21);   /* r21 = cs4 * (t1+t2) 6420 */ \
-        psraw($21, 15, $21);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $21, $21);   /* r21 = b1 */          \
-\
-        pmulth($22, $2, $22);   /* r22 = cs4 * (t1-t2) 6420 */ \
-        psraw($22, 15, $22);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $22, $22);   /* r22 = b2 */          \
-\
-        lq($24, TG_2_16, $2);   /* r2  = tn2 */         \
-\
-        pmulth($10, $2, $17);   /* r17 = x2 * tn2 (6420) */ \
-        psraw($17, 15, $17);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $17, $17);   /* r17 = x3 * tn3 */    \
-        psubh($17, $14, $17);   /* r17 = tm26 */        \
-\
-        pmulth($14, $2, $18);   /* r18 = x6 * tn2 (6420) */ \
-        psraw($18, 15, $18);    \
-        pmfhl_uw($3);           /* r3  = 7531 */        \
-        psraw($3, 15, $3);      \
-        pinteh($3, $18, $18);   /* r18 = x6 * tn2 */    \
-        paddh($18, $10, $18);   /* r18 = tp26 */        \
-\
-        paddh($8, $12, $2);     /* r2  = tp04 */        \
-        psubh($8, $12, $3);     /* r3  = tm04 */        \
-\
-        paddh($2, $18, $16);    /* r16 = a0 */          \
-        psubh($2, $18, $19);    /* r19 = a3 */          \
-        psubh($3, $17, $18);    /* r18 = a2 */          \
-        paddh($3, $17, $17);    /* r17 = a1 */
-
-
-#define DCT_8_INV_COL8_STORE(blk) \
-\
-        paddh($16, $20, $2);    /* y0  a0+b0 */ \
-        psubh($16, $20, $16);   /* y7  a0-b0 */ \
-        psrah($2, SHIFT_INV_COL, $2);           \
-        psrah($16, SHIFT_INV_COL, $16);         \
-        sq($2, 0, blk);                         \
-        sq($16, 112, blk);                      \
-\
-        paddh($17, $21, $3);    /* y1  a1+b1 */ \
-        psubh($17, $21, $17);   /* y6  a1-b1 */ \
-        psrah($3, SHIFT_INV_COL, $3);           \
-        psrah($17, SHIFT_INV_COL, $17);         \
-        sq($3, 16, blk);                        \
-        sq($17, 96, blk);                       \
-\
-        paddh($18, $22, $2);    /* y2  a2+b2 */ \
-        psubh($18, $22, $18);   /* y5  a2-b2 */ \
-        psrah($2, SHIFT_INV_COL, $2);           \
-        psrah($18, SHIFT_INV_COL, $18);         \
-        sq($2, 32, blk);                        \
-        sq($18, 80, blk);                       \
-\
-        paddh($19, $23, $3);    /* y3  a3+b3 */ \
-        psubh($19, $23, $19);   /* y4  a3-b3 */ \
-        psrah($3, SHIFT_INV_COL, $3);           \
-        psrah($19, SHIFT_INV_COL, $19);         \
-        sq($3, 48, blk);                        \
-        sq($19, 64, blk);
-
-
-
-#define DCT_8_INV_COL8_PMS() \
-        paddh($16, $20, $2);    /* y0  a0+b0 */ \
-        psubh($16, $20, $20);   /* y7  a0-b0 */ \
-        psrah($2, SHIFT_INV_COL, $16);          \
-        psrah($20, SHIFT_INV_COL, $20);         \
-\
-        paddh($17, $21, $3);    /* y1  a1+b1 */ \
-        psubh($17, $21, $21);   /* y6  a1-b1 */ \
-        psrah($3, SHIFT_INV_COL, $17);          \
-        psrah($21, SHIFT_INV_COL, $21);         \
-\
-        paddh($18, $22, $2);    /* y2  a2+b2 */ \
-        psubh($18, $22, $22);   /* y5  a2-b2 */ \
-        psrah($2, SHIFT_INV_COL, $18);          \
-        psrah($22, SHIFT_INV_COL, $22);         \
-\
-        paddh($19, $23, $3);    /* y3  a3+b3 */ \
-        psubh($19, $23, $23);   /* y4  a3-b3 */ \
-        psrah($3, SHIFT_INV_COL, $19);          \
-        psrah($23, SHIFT_INV_COL, $23);
-
-#define PUT(rs)                 \
-        pminh(rs, $11, $2);     \
-        pmaxh($2, $0, $2);      \
-        ppacb($0, $2, $2);      \
-        sd3(2, 0, 4);           \
-        __asm__ volatile ("add $4, $5, $4");
-
-#define DCT_8_INV_COL8_PUT() \
-        PUT($16);        \
-        PUT($17);        \
-        PUT($18);        \
-        PUT($19);        \
-        PUT($23);        \
-        PUT($22);        \
-        PUT($21);        \
-        PUT($20);
-
-#define ADD(rs)          \
-        ld3(4, 0, 2);        \
-        pextlb($0, $2, $2);  \
-        paddh($2, rs, $2);   \
-        pminh($2, $11, $2);  \
-        pmaxh($2, $0, $2);   \
-        ppacb($0, $2, $2);   \
-        sd3(2, 0, 4); \
-        __asm__ volatile ("add $4, $5, $4");
-
-/*fixme: schedule*/
-#define DCT_8_INV_COL8_ADD() \
-        ADD($16);        \
-        ADD($17);        \
-        ADD($18);        \
-        ADD($19);        \
-        ADD($23);        \
-        ADD($22);        \
-        ADD($21);        \
-        ADD($20);
-
-
-void ff_mmi_idct(int16_t * block)
-{
-        /* $4 = block */
-        __asm__ volatile("la $24, %0"::"m"(consttable[0]));
-        lq($24, ROUNDER_0, $8);
-        lq($24, ROUNDER_1, $7);
-        DCT_8_INV_ROW1($4, 0, TAB_i_04, $8, $8);
-        DCT_8_INV_ROW1($4, 16, TAB_i_17, $7, $9);
-        DCT_8_INV_ROW1($4, 32, TAB_i_26, $7, $10);
-        DCT_8_INV_ROW1($4, 48, TAB_i_35, $7, $11);
-        DCT_8_INV_ROW1($4, 64, TAB_i_04, $7, $12);
-        DCT_8_INV_ROW1($4, 80, TAB_i_35, $7, $13);
-        DCT_8_INV_ROW1($4, 96, TAB_i_26, $7, $14);
-        DCT_8_INV_ROW1($4, 112, TAB_i_17, $7, $15);
-        DCT_8_INV_COL8();
-        DCT_8_INV_COL8_STORE($4);
-
-        //let savedtemp regs be saved
-        __asm__ volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
-}
-
-
-void ff_mmi_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-        /* $4 = dest, $5 = line_size, $6 = block */
-        __asm__ volatile("la $24, %0"::"m"(consttable[0]));
-        lq($24, ROUNDER_0, $8);
-        lq($24, ROUNDER_1, $7);
-        DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8);
-        DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9);
-        DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10);
-        DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11);
-        DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12);
-        DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13);
-        DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14);
-        DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15);
-        DCT_8_INV_COL8();
-        lq($24, CLIPMAX, $11);
-        DCT_8_INV_COL8_PMS();
-        DCT_8_INV_COL8_PUT();
-
-        //let savedtemp regs be saved
-        __asm__ volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
-}
-
-
-void ff_mmi_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-        /* $4 = dest, $5 = line_size, $6 = block */
-        __asm__ volatile("la $24, %0"::"m"(consttable[0]));
-        lq($24, ROUNDER_0, $8);
-        lq($24, ROUNDER_1, $7);
-        DCT_8_INV_ROW1($6, 0, TAB_i_04, $8, $8);
-        DCT_8_INV_ROW1($6, 16, TAB_i_17, $7, $9);
-        DCT_8_INV_ROW1($6, 32, TAB_i_26, $7, $10);
-        DCT_8_INV_ROW1($6, 48, TAB_i_35, $7, $11);
-        DCT_8_INV_ROW1($6, 64, TAB_i_04, $7, $12);
-        DCT_8_INV_ROW1($6, 80, TAB_i_35, $7, $13);
-        DCT_8_INV_ROW1($6, 96, TAB_i_26, $7, $14);
-        DCT_8_INV_ROW1($6, 112, TAB_i_17, $7, $15);
-        DCT_8_INV_COL8();
-        lq($24, CLIPMAX, $11);
-        DCT_8_INV_COL8_PMS();
-        DCT_8_INV_COL8_ADD();
-
-        //let savedtemp regs be saved
-        __asm__ volatile(" ":::"$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23");
-}
-
diff --git a/libavcodec/ps2/mmi.h b/libavcodec/ps2/mmi.h
deleted file mode 100644
index 0265456..0000000
--- a/libavcodec/ps2/mmi.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * copyright (c) 2002 Leon van Stuivenberg
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PS2_MMI_H
-#define AVCODEC_PS2_MMI_H
-
-#define align16 __attribute__ ((aligned (16)))
-
-/*
-#define r0 $zero
-#define r1 $at          //assembler!
-#define r2 $v0          //return
-#define r3 $v1          //return
-#define r4 $a0          //arg
-#define r5 $a1          //arg
-#define r6 $a2          //arg
-#define r7 $a3          //arg
-#define r8 $t0          //temp
-#define r9 $t1          //temp
-#define r10 $t2         //temp
-#define r11 $t3         //temp
-#define r12 $t4         //temp
-#define r13 $t5         //temp
-#define r14 $t6         //temp
-#define r15 $t7         //temp
-#define r16 $s0         //saved temp
-#define r17 $s1         //saved temp
-#define r18 $s2         //saved temp
-#define r19 $s3         //saved temp
-#define r20 $s4         //saved temp
-#define r21 $s5         //saved temp
-#define r22 $s6         //saved temp
-#define r23 $s7         //saved temp
-#define r24 $t8         //temp
-#define r25 $t9         //temp
-#define r26 $k0         //kernel
-#define r27 $k1         //kernel
-#define r28 $gp         //global ptr
-#define r29 $sp         //stack ptr
-#define r30 $fp         //frame ptr
-#define r31 $ra         //return addr
-*/
-
-
-#define         lq(base, off, reg)        \
-        __asm__ volatile ("lq " #reg ", %0("#base ")" : : "i" (off) )
-
-#define         lq2(mem, reg)        \
-        __asm__ volatile ("lq " #reg ", %0" : : "r" (mem))
-
-#define         sq(reg, off, base)        \
-        __asm__ volatile ("sq " #reg ", %0("#base ")" : : "i" (off) )
-
-/*
-#define         ld(base, off, reg)        \
-        __asm__ volatile ("ld " #reg ", " #off "("#base ")")
-*/
-
-#define         ld3(base, off, reg)        \
-        __asm__ volatile (".word %0" : : "i" ( 0xdc000000 | (base<<21) | (reg<<16) | (off)))
-
-#define         ldr3(base, off, reg)        \
-        __asm__ volatile (".word %0" : : "i" ( 0x6c000000 | (base<<21) | (reg<<16) | (off)))
-
-#define         ldl3(base, off, reg)        \
-        __asm__ volatile (".word %0" : : "i" ( 0x68000000 | (base<<21) | (reg<<16) | (off)))
-
-/*
-#define         sd(reg, off, base)        \
-        __asm__ volatile ("sd " #reg ", " #off "("#base ")")
-*/
-//seems assembler has bug encoding mnemonic 'sd', so DIY
-#define         sd3(reg, off, base)        \
-        __asm__ volatile (".word %0" : : "i" ( 0xfc000000 | (base<<21) | (reg<<16) | (off)))
-
-#define         sw(reg, off, base)        \
-        __asm__ volatile ("sw " #reg ", " #off "("#base ")")
-
-#define         sq2(reg, mem)        \
-        __asm__ volatile ("sq " #reg ", %0" : : "m" (*(mem)))
-
-#define         pinth(rs, rt, rd) \
-        __asm__ volatile ("pinth  " #rd ", " #rs ", " #rt )
-
-#define         phmadh(rs, rt, rd) \
-        __asm__ volatile ("phmadh " #rd ", " #rs ", " #rt )
-
-#define         pcpyud(rs, rt, rd) \
-        __asm__ volatile ("pcpyud " #rd ", " #rs ", " #rt )
-
-#define         pcpyld(rs, rt, rd) \
-        __asm__ volatile ("pcpyld " #rd ", " #rs ", " #rt )
-
-#define         pcpyh(rt, rd) \
-        __asm__ volatile ("pcpyh  " #rd ", " #rt )
-
-#define         paddw(rs, rt, rd) \
-        __asm__ volatile ("paddw  " #rd ", " #rs ", " #rt )
-
-#define         pextlw(rs, rt, rd) \
-        __asm__ volatile ("pextlw " #rd ", " #rs ", " #rt )
-
-#define         pextuw(rs, rt, rd) \
-        __asm__ volatile ("pextuw " #rd ", " #rs ", " #rt )
-
-#define         pextlh(rs, rt, rd) \
-        __asm__ volatile ("pextlh " #rd ", " #rs ", " #rt )
-
-#define         pextuh(rs, rt, rd) \
-        __asm__ volatile ("pextuh " #rd ", " #rs ", " #rt )
-
-#define         psubw(rs, rt, rd) \
-        __asm__ volatile ("psubw  " #rd ", " #rs ", " #rt )
-
-#define         psraw(rt, sa, rd) \
-        __asm__ volatile ("psraw  " #rd ", " #rt ", %0" : : "i"(sa) )
-
-#define         ppach(rs, rt, rd) \
-        __asm__ volatile ("ppach  " #rd ", " #rs ", " #rt )
-
-#define         ppacb(rs, rt, rd) \
-        __asm__ volatile ("ppacb  " #rd ", " #rs ", " #rt )
-
-#define         prevh(rt, rd) \
-        __asm__ volatile ("prevh  " #rd ", " #rt )
-
-#define         pmulth(rs, rt, rd) \
-        __asm__ volatile ("pmulth " #rd ", " #rs ", " #rt )
-
-#define         pmaxh(rs, rt, rd) \
-        __asm__ volatile ("pmaxh " #rd ", " #rs ", " #rt )
-
-#define         pminh(rs, rt, rd) \
-        __asm__ volatile ("pminh " #rd ", " #rs ", " #rt )
-
-#define         pinteh(rs, rt, rd) \
-        __asm__ volatile ("pinteh  " #rd ", " #rs ", " #rt )
-
-#define         paddh(rs, rt, rd) \
-        __asm__ volatile ("paddh  " #rd ", " #rs ", " #rt )
-
-#define         psubh(rs, rt, rd) \
-        __asm__ volatile ("psubh  " #rd ", " #rs ", " #rt )
-
-#define         psrah(rt, sa, rd) \
-        __asm__ volatile ("psrah  " #rd ", " #rt ", %0" : : "i"(sa) )
-
-#define         pmfhl_uw(rd) \
-        __asm__ volatile ("pmfhl.uw  " #rd)
-
-#define         pextlb(rs, rt, rd) \
-        __asm__ volatile ("pextlb  " #rd ", " #rs ", " #rt )
-
-#endif /* AVCODEC_PS2_MMI_H */
diff --git a/libavcodec/ps2/mpegvideo_mmi.c b/libavcodec/ps2/mpegvideo_mmi.c
deleted file mode 100644
index 68c3b0d..0000000
--- a/libavcodec/ps2/mpegvideo_mmi.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
- * MMI optimization by Leon van Stuivenberg
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-
-static void dct_unquantize_h263_mmi(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    int level=0, qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    qadd = (qscale - 1) | 1;
-    qmul = qscale << 1;
-
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                level = block[0] * s->y_dc_scale;
-            else
-                level = block[0] * s->c_dc_scale;
-        }else {
-            qadd = 0;
-            level = block[0];
-        }
-        nCoeffs= 63; //does not always use zigzag table
-    } else {
-        nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
-    }
-
-    __asm__ volatile(
-        "add    $14, $0, %3     \n\t"
-        "pcpyld $8, %0, %0      \n\t"
-        "pcpyh  $8, $8          \n\t"   //r8 = qmul
-        "pcpyld $9, %1, %1      \n\t"
-        "pcpyh  $9, $9          \n\t"   //r9 = qadd
-        ".p2align 2             \n\t"
-        "1:                     \n\t"
-        "lq     $10, 0($14)     \n\t"   //r10 = level
-        "addi   $14, $14, 16    \n\t"   //block+=8
-        "addi   %2, %2, -8      \n\t"
-        "pcgth  $11, $0, $10    \n\t"   //r11 = level < 0 ? -1 : 0
-        "pcgth  $12, $10, $0    \n\t"   //r12 = level > 0 ? -1 : 0
-        "por    $12, $11, $12   \n\t"
-        "pmulth $10, $10, $8    \n\t"
-        "paddh  $13, $9, $11    \n\t"
-        "pxor   $13, $13, $11   \n\t"   //r13 = level < 0 ? -qadd : qadd
-        "pmfhl.uw $11           \n\t"
-        "pinteh $10, $11, $10   \n\t"   //r10 = level * qmul
-        "paddh  $10, $10, $13   \n\t"
-        "pand   $10, $10, $12   \n\t"
-        "sq     $10, -16($14)   \n\t"
-        "bgez   %2, 1b          \n\t"
-        :: "r"(qmul), "r" (qadd), "r" (nCoeffs), "r" (block) : "$8", "$9", "$10", "$11", "$12", "$13", "$14", "memory" );
-
-    if(s->mb_intra)
-        block[0]= level;
-}
-
-
-void MPV_common_init_mmi(MpegEncContext *s)
-{
-    s->dct_unquantize_h263_intra =
-    s->dct_unquantize_h263_inter = dct_unquantize_h263_mmi;
-}
-
-
diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c
deleted file mode 100644
index f87dbcf..0000000
--- a/libavcodec/psymodel.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * audio encoder psychoacoustic model
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "psymodel.h"
-#include "iirfilter.h"
-
-extern const FFPsyModel ff_aac_psy_model;
-
-av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx,
-                        int num_lens,
-                        const uint8_t **bands, const int* num_bands)
-{
-    ctx->avctx = avctx;
-    ctx->psy_bands = av_mallocz(sizeof(FFPsyBand) * PSY_MAX_BANDS * avctx->channels);
-    ctx->bands     = av_malloc (sizeof(ctx->bands[0])     * num_lens);
-    ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens);
-    memcpy(ctx->bands,     bands,     sizeof(ctx->bands[0])     *  num_lens);
-    memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) *  num_lens);
-    switch (ctx->avctx->codec_id) {
-    case CODEC_ID_AAC:
-        ctx->model = &ff_aac_psy_model;
-        break;
-    }
-    if (ctx->model->init)
-        return ctx->model->init(ctx);
-    return 0;
-}
-
-FFPsyWindowInfo ff_psy_suggest_window(FFPsyContext *ctx,
-                                      const int16_t *audio, const int16_t *la,
-                                      int channel, int prev_type)
-{
-    return ctx->model->window(ctx, audio, la, channel, prev_type);
-}
-
-void ff_psy_set_band_info(FFPsyContext *ctx, int channel,
-                          const float *coeffs, FFPsyWindowInfo *wi)
-{
-    ctx->model->analyze(ctx, channel, coeffs, wi);
-}
-
-av_cold void ff_psy_end(FFPsyContext *ctx)
-{
-    if (ctx->model->end)
-        ctx->model->end(ctx);
-    av_freep(&ctx->bands);
-    av_freep(&ctx->num_bands);
-    av_freep(&ctx->psy_bands);
-}
-
-typedef struct FFPsyPreprocessContext{
-    AVCodecContext *avctx;
-    float stereo_att;
-    struct FFIIRFilterCoeffs *fcoeffs;
-    struct FFIIRFilterState **fstate;
-}FFPsyPreprocessContext;
-
-#define FILT_ORDER 4
-
-av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *avctx)
-{
-    FFPsyPreprocessContext *ctx;
-    int i;
-    float cutoff_coeff = 0;
-    ctx        = av_mallocz(sizeof(FFPsyPreprocessContext));
-    ctx->avctx = avctx;
-
-    if (avctx->cutoff > 0)
-        cutoff_coeff = 2.0 * avctx->cutoff / avctx->sample_rate;
-
-    if (cutoff_coeff)
-    ctx->fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS,
-                                             FILT_ORDER, cutoff_coeff, 0.0, 0.0);
-    if (ctx->fcoeffs) {
-        ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels);
-        for (i = 0; i < avctx->channels; i++)
-            ctx->fstate[i] = ff_iir_filter_init_state(FILT_ORDER);
-    }
-    return ctx;
-}
-
-void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx,
-                       const int16_t *audio, int16_t *dest,
-                       int tag, int channels)
-{
-    int ch, i;
-    if (ctx->fstate) {
-        for (ch = 0; ch < channels; ch++)
-            ff_iir_filter(ctx->fcoeffs, ctx->fstate[tag+ch], ctx->avctx->frame_size,
-                          audio + ch, ctx->avctx->channels,
-                          dest  + ch, ctx->avctx->channels);
-    } else {
-        for (ch = 0; ch < channels; ch++)
-            for (i = 0; i < ctx->avctx->frame_size; i++)
-                dest[i*ctx->avctx->channels + ch] = audio[i*ctx->avctx->channels + ch];
-    }
-}
-
-av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx)
-{
-    int i;
-    ff_iir_filter_free_coeffs(ctx->fcoeffs);
-    if (ctx->fstate)
-        for (i = 0; i < ctx->avctx->channels; i++)
-            ff_iir_filter_free_state(ctx->fstate[i]);
-    av_freep(&ctx->fstate);
-}
-
diff --git a/libavcodec/psymodel.h b/libavcodec/psymodel.h
deleted file mode 100644
index bc19d49..0000000
--- a/libavcodec/psymodel.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * audio encoder psychoacoustic model
- * Copyright (C) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_PSYMODEL_H
-#define AVCODEC_PSYMODEL_H
-
-#include "avcodec.h"
-
-/** maximum possible number of bands */
-#define PSY_MAX_BANDS 128
-
-/**
- * single band psychoacoustic information
- */
-typedef struct FFPsyBand {
-    int   bits;
-    float energy;
-    float threshold;
-    float distortion;
-    float perceptual_weight;
-} FFPsyBand;
-
-/**
- * windowing related information
- */
-typedef struct FFPsyWindowInfo {
-    int window_type[3];               ///< window type (short/long/transitional, etc.) - current, previous and next
-    int window_shape;                 ///< window shape (sine/KBD/whatever)
-    int num_windows;                  ///< number of windows in a frame
-    int grouping[8];                  ///< window grouping (for e.g. AAC)
-    int *window_sizes;                ///< sequence of window sizes inside one frame (for eg. WMA)
-} FFPsyWindowInfo;
-
-/**
- * context used by psychoacoustic model
- */
-typedef struct FFPsyContext {
-    AVCodecContext *avctx;            ///< encoder context
-    const struct FFPsyModel *model;   ///< encoder-specific model functions
-
-    FFPsyBand *psy_bands;             ///< frame bands information
-
-    uint8_t **bands;                  ///< scalefactor band sizes for possible frame sizes
-    int     *num_bands;               ///< number of scalefactor bands for possible frame sizes
-    int num_lens;                     ///< number of scalefactor band sets
-
-    void* model_priv_data;            ///< psychoacoustic model implementation private data
-} FFPsyContext;
-
-/**
- * codec-specific psychoacoustic model implementation
- */
-typedef struct FFPsyModel {
-    const char *name;
-    int  (*init)   (FFPsyContext *apc);
-    FFPsyWindowInfo (*window)(FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type);
-    void (*analyze)(FFPsyContext *ctx, int channel, const float *coeffs, FFPsyWindowInfo *wi);
-    void (*end)    (FFPsyContext *apc);
-} FFPsyModel;
-
-/**
- * Initialize psychoacoustic model.
- *
- * @param ctx        model context
- * @param avctx      codec context
- * @param num_lens   number of possible frame lengths
- * @param bands      scalefactor band lengths for all frame lengths
- * @param num_bands  number of scalefactor bands for all frame lengths
- *
- * @return zero if successful, a negative value if not
- */
-av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx,
-                        int num_lens,
-                        const uint8_t **bands, const int* num_bands);
-
-/**
- * Suggest window sequence for channel.
- *
- * @param ctx       model context
- * @param audio     samples for the current frame
- * @param la        lookahead samples (NULL when unavailable)
- * @param channel   number of channel element to analyze
- * @param prev_type previous window type
- *
- * @return suggested window information in a structure
- */
-FFPsyWindowInfo ff_psy_suggest_window(FFPsyContext *ctx,
-                                      const int16_t *audio, const int16_t *la,
-                                      int channel, int prev_type);
-
-
-/**
- * Perform psychoacoustic analysis and set band info (threshold, energy).
- *
- * @param ctx     model context
- * @param channel audio channel number
- * @param coeffs  pointer to the transformed coefficients
- * @param wi      window information
- */
-void ff_psy_set_band_info(FFPsyContext *ctx, int channel, const float *coeffs,
-                          FFPsyWindowInfo *wi);
-
-/**
- * Cleanup model context at the end.
- *
- * @param ctx model context
- */
-av_cold void ff_psy_end(FFPsyContext *ctx);
-
-
-/**************************************************************************
- *                       Audio preprocessing stuff.                       *
- *       This should be moved into some audio filter eventually.          *
- **************************************************************************/
-struct FFPsyPreprocessContext;
-
-/**
- * psychoacoustic model audio preprocessing initialization
- */
-av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *avctx);
-
-/**
- * Preprocess several channel in audio frame in order to compress it better.
- *
- * @param ctx      preprocessing context
- * @param audio    samples to preprocess
- * @param dest     place to put filtered samples
- * @param tag      channel number
- * @param channels number of channel to preprocess (some additional work may be done on stereo pair)
- */
-void ff_psy_preprocess(struct FFPsyPreprocessContext *ctx,
-                       const int16_t *audio, int16_t *dest,
-                       int tag, int channels);
-
-/**
- * Cleanup audio preprocessing module.
- */
-av_cold void ff_psy_preprocess_end(struct FFPsyPreprocessContext *ctx);
-
-#endif /* AVCODEC_PSYMODEL_H */
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
deleted file mode 100644
index 1628b21..0000000
--- a/libavcodec/pthread.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2004 Roman Shaposhnik
- *
- * Many thanks to Steven M. Schultz for providing clever ideas and
- * to Michael Niedermayer <michaelni at gmx.at> for writing initial
- * implementation.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <pthread.h>
-
-#include "avcodec.h"
-
-typedef int (action_func)(AVCodecContext *c, void *arg);
-typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr);
-
-typedef struct ThreadContext {
-    pthread_t *workers;
-    action_func *func;
-    action_func2 *func2;
-    void *args;
-    int *rets;
-    int rets_count;
-    int job_count;
-    int job_size;
-
-    pthread_cond_t last_job_cond;
-    pthread_cond_t current_job_cond;
-    pthread_mutex_t current_job_lock;
-    int current_job;
-    int done;
-} ThreadContext;
-
-static void* attribute_align_arg worker(void *v)
-{
-    AVCodecContext *avctx = v;
-    ThreadContext *c = avctx->thread_opaque;
-    int our_job = c->job_count;
-    int thread_count = avctx->thread_count;
-    int self_id;
-
-    pthread_mutex_lock(&c->current_job_lock);
-    self_id = c->current_job++;
-    for (;;){
-        while (our_job >= c->job_count) {
-            if (c->current_job == thread_count + c->job_count)
-                pthread_cond_signal(&c->last_job_cond);
-
-            pthread_cond_wait(&c->current_job_cond, &c->current_job_lock);
-            our_job = self_id;
-
-            if (c->done) {
-                pthread_mutex_unlock(&c->current_job_lock);
-                return NULL;
-            }
-        }
-        pthread_mutex_unlock(&c->current_job_lock);
-
-        c->rets[our_job%c->rets_count] = c->func ? c->func(avctx, (char*)c->args + our_job*c->job_size):
-                                                   c->func2(avctx, c->args, our_job, self_id);
-
-        pthread_mutex_lock(&c->current_job_lock);
-        our_job = c->current_job++;
-    }
-}
-
-static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int thread_count)
-{
-    pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);
-    pthread_mutex_unlock(&c->current_job_lock);
-}
-
-void avcodec_thread_free(AVCodecContext *avctx)
-{
-    ThreadContext *c = avctx->thread_opaque;
-    int i;
-
-    pthread_mutex_lock(&c->current_job_lock);
-    c->done = 1;
-    pthread_cond_broadcast(&c->current_job_cond);
-    pthread_mutex_unlock(&c->current_job_lock);
-
-    for (i=0; i<avctx->thread_count; i++)
-         pthread_join(c->workers[i], NULL);
-
-    pthread_mutex_destroy(&c->current_job_lock);
-    pthread_cond_destroy(&c->current_job_cond);
-    pthread_cond_destroy(&c->last_job_cond);
-    av_free(c->workers);
-    av_freep(&avctx->thread_opaque);
-}
-
-static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
-{
-    ThreadContext *c= avctx->thread_opaque;
-    int dummy_ret;
-
-    if (job_count <= 0)
-        return 0;
-
-    pthread_mutex_lock(&c->current_job_lock);
-
-    c->current_job = avctx->thread_count;
-    c->job_count = job_count;
-    c->job_size = job_size;
-    c->args = arg;
-    c->func = func;
-    if (ret) {
-        c->rets = ret;
-        c->rets_count = job_count;
-    } else {
-        c->rets = &dummy_ret;
-        c->rets_count = 1;
-    }
-    pthread_cond_broadcast(&c->current_job_cond);
-
-    avcodec_thread_park_workers(c, avctx->thread_count);
-
-    return 0;
-}
-
-static int avcodec_thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg, int *ret, int job_count)
-{
-    ThreadContext *c= avctx->thread_opaque;
-    c->func2 = func2;
-    return avcodec_thread_execute(avctx, NULL, arg, ret, job_count, 0);
-}
-
-int avcodec_thread_init(AVCodecContext *avctx, int thread_count)
-{
-    int i;
-    ThreadContext *c;
-
-    avctx->thread_count = thread_count;
-
-    if (thread_count <= 1)
-        return 0;
-
-    c = av_mallocz(sizeof(ThreadContext));
-    if (!c)
-        return -1;
-
-    c->workers = av_mallocz(sizeof(pthread_t)*thread_count);
-    if (!c->workers) {
-        av_free(c);
-        return -1;
-    }
-
-    avctx->thread_opaque = c;
-    c->current_job = 0;
-    c->job_count = 0;
-    c->job_size = 0;
-    c->done = 0;
-    pthread_cond_init(&c->current_job_cond, NULL);
-    pthread_cond_init(&c->last_job_cond, NULL);
-    pthread_mutex_init(&c->current_job_lock, NULL);
-    pthread_mutex_lock(&c->current_job_lock);
-    for (i=0; i<thread_count; i++) {
-        if(pthread_create(&c->workers[i], NULL, worker, avctx)) {
-           avctx->thread_count = i;
-           pthread_mutex_unlock(&c->current_job_lock);
-           avcodec_thread_free(avctx);
-           return -1;
-        }
-    }
-
-    avcodec_thread_park_workers(c, thread_count);
-
-    avctx->execute = avcodec_thread_execute;
-    avctx->execute2 = avcodec_thread_execute2;
-    return 0;
-}
diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c
deleted file mode 100644
index d8798f2..0000000
--- a/libavcodec/ptx.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * V.Flash PTX (.ptx) image decoder
- * Copyright (c) 2007 Ivo van Poorten
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct PTXContext {
-    AVFrame picture;
-} PTXContext;
-
-static av_cold int ptx_init(AVCodecContext *avctx) {
-    PTXContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame= &s->picture;
-
-    return 0;
-}
-
-static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                            AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    PTXContext * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p = &s->picture;
-    unsigned int offset, w, h, y, stride, bytes_per_pixel;
-    uint8_t *ptr;
-
-    offset          = AV_RL16(buf);
-    w               = AV_RL16(buf+8);
-    h               = AV_RL16(buf+10);
-    bytes_per_pixel = AV_RL16(buf+12) >> 3;
-
-    if (bytes_per_pixel != 2) {
-        av_log(avctx, AV_LOG_ERROR, "image format is not rgb15, please report on ffmpeg-users mailing list\n");
-        return -1;
-    }
-
-    avctx->pix_fmt = PIX_FMT_RGB555;
-
-    if (offset != 0x2c)
-        av_log(avctx, AV_LOG_WARNING, "offset != 0x2c, untested due to lack of sample files\n");
-
-    buf += offset;
-
-    if (p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    if (avcodec_check_dimensions(avctx, w, h))
-        return -1;
-    if (w != avctx->width || h != avctx->height)
-        avcodec_set_dimensions(avctx, w, h);
-    if (avctx->get_buffer(avctx, p) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    p->pict_type = FF_I_TYPE;
-
-    ptr    = p->data[0];
-    stride = p->linesize[0];
-
-    for (y=0; y<h; y++) {
-#if HAVE_BIGENDIAN
-        unsigned int x;
-        for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
-            AV_WN16(ptr+x, AV_RL16(buf+x));
-#else
-        memcpy(ptr, buf, w*bytes_per_pixel);
-#endif
-        ptr += stride;
-        buf += w*bytes_per_pixel;
-    }
-
-    *picture = s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return offset + w*h*bytes_per_pixel;
-}
-
-static av_cold int ptx_end(AVCodecContext *avctx) {
-    PTXContext *s = avctx->priv_data;
-
-    if(s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-AVCodec ptx_decoder = {
-    "ptx",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_PTX,
-    sizeof(PTXContext),
-    ptx_init,
-    NULL,
-    ptx_end,
-    ptx_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"),
-};
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
deleted file mode 100644
index 80a514d..0000000
--- a/libavcodec/put_bits.h
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * bitstream writer API
- */
-
-#ifndef AVCODEC_PUT_BITS_H
-#define AVCODEC_PUT_BITS_H
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <assert.h>
-#include "libavutil/bswap.h"
-#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/log.h"
-#include "mathops.h"
-
-//#define ALT_BITSTREAM_WRITER
-//#define ALIGNED_BITSTREAM_WRITER
-
-/* buf and buf_end must be present and used by every alternative writer. */
-typedef struct PutBitContext {
-#ifdef ALT_BITSTREAM_WRITER
-    uint8_t *buf, *buf_end;
-    int index;
-#else
-    uint32_t bit_buf;
-    int bit_left;
-    uint8_t *buf, *buf_ptr, *buf_end;
-#endif
-    int size_in_bits;
-} PutBitContext;
-
-/**
- * Initializes the PutBitContext s.
- *
- * @param buffer the buffer where to put bits
- * @param buffer_size the size in bytes of buffer
- */
-static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
-{
-    if(buffer_size < 0) {
-        buffer_size = 0;
-        buffer = NULL;
-    }
-
-    s->size_in_bits= 8*buffer_size;
-    s->buf = buffer;
-    s->buf_end = s->buf + buffer_size;
-#ifdef ALT_BITSTREAM_WRITER
-    s->index=0;
-    ((uint32_t*)(s->buf))[0]=0;
-//    memset(buffer, 0, buffer_size);
-#else
-    s->buf_ptr = s->buf;
-    s->bit_left=32;
-    s->bit_buf=0;
-#endif
-}
-
-/**
- * Returns the total number of bits written to the bitstream.
- */
-static inline int put_bits_count(PutBitContext *s)
-{
-#ifdef ALT_BITSTREAM_WRITER
-    return s->index;
-#else
-    return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left;
-#endif
-}
-
-/**
- * Pads the end of the output stream with zeros.
- */
-static inline void flush_put_bits(PutBitContext *s)
-{
-#ifdef ALT_BITSTREAM_WRITER
-    align_put_bits(s);
-#else
-#ifndef BITSTREAM_WRITER_LE
-    s->bit_buf<<= s->bit_left;
-#endif
-    while (s->bit_left < 32) {
-        /* XXX: should test end of buffer */
-#ifdef BITSTREAM_WRITER_LE
-        *s->buf_ptr++=s->bit_buf;
-        s->bit_buf>>=8;
-#else
-        *s->buf_ptr++=s->bit_buf >> 24;
-        s->bit_buf<<=8;
-#endif
-        s->bit_left+=8;
-    }
-    s->bit_left=32;
-    s->bit_buf=0;
-#endif
-}
-
-#if defined(ALT_BITSTREAM_WRITER) || defined(BITSTREAM_WRITER_LE)
-#define align_put_bits align_put_bits_unsupported_here
-#define ff_put_string ff_put_string_unsupported_here
-#define ff_copy_bits ff_copy_bits_unsupported_here
-#else
-/**
- * Pads the bitstream with zeros up to the next byte boundary.
- */
-void align_put_bits(PutBitContext *s);
-
-/**
- * Puts the string string in the bitstream.
- *
- * @param terminate_string 0-terminates the written string if value is 1
- */
-void ff_put_string(PutBitContext *pb, const char *string, int terminate_string);
-
-/**
- * Copies the content of src to the bitstream.
- *
- * @param length the number of bits of src to copy
- */
-void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
-#endif
-
-/**
- * Writes up to 31 bits into a bitstream.
- * Use put_bits32 to write 32 bits.
- */
-static inline void put_bits(PutBitContext *s, int n, unsigned int value)
-#ifndef ALT_BITSTREAM_WRITER
-{
-    unsigned int bit_buf;
-    int bit_left;
-
-    //    printf("put_bits=%d %x\n", n, value);
-    assert(n <= 31 && value < (1U << n));
-
-    bit_buf = s->bit_buf;
-    bit_left = s->bit_left;
-
-    //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
-    /* XXX: optimize */
-#ifdef BITSTREAM_WRITER_LE
-    bit_buf |= value << (32 - bit_left);
-    if (n >= bit_left) {
-#if !HAVE_FAST_UNALIGNED
-        if (3 & (intptr_t) s->buf_ptr) {
-            AV_WL32(s->buf_ptr, bit_buf);
-        } else
-#endif
-        *(uint32_t *)s->buf_ptr = le2me_32(bit_buf);
-        s->buf_ptr+=4;
-        bit_buf = (bit_left==32)?0:value >> bit_left;
-        bit_left+=32;
-    }
-    bit_left-=n;
-#else
-    if (n < bit_left) {
-        bit_buf = (bit_buf<<n) | value;
-        bit_left-=n;
-    } else {
-        bit_buf<<=bit_left;
-        bit_buf |= value >> (n - bit_left);
-#if !HAVE_FAST_UNALIGNED
-        if (3 & (intptr_t) s->buf_ptr) {
-            AV_WB32(s->buf_ptr, bit_buf);
-        } else
-#endif
-        *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
-        //printf("bitbuf = %08x\n", bit_buf);
-        s->buf_ptr+=4;
-        bit_left+=32 - n;
-        bit_buf = value;
-    }
-#endif
-
-    s->bit_buf = bit_buf;
-    s->bit_left = bit_left;
-}
-#else  /* ALT_BITSTREAM_WRITER defined */
-{
-#    ifdef ALIGNED_BITSTREAM_WRITER
-#        if ARCH_X86
-    __asm__ volatile(
-        "movl %0, %%ecx                 \n\t"
-        "xorl %%eax, %%eax              \n\t"
-        "shrdl %%cl, %1, %%eax          \n\t"
-        "shrl %%cl, %1                  \n\t"
-        "movl %0, %%ecx                 \n\t"
-        "shrl $3, %%ecx                 \n\t"
-        "andl $0xFFFFFFFC, %%ecx        \n\t"
-        "bswapl %1                      \n\t"
-        "orl %1, (%2, %%ecx)            \n\t"
-        "bswapl %%eax                   \n\t"
-        "addl %3, %0                    \n\t"
-        "movl %%eax, 4(%2, %%ecx)       \n\t"
-        : "=&r" (s->index), "=&r" (value)
-        : "r" (s->buf), "r" (n), "0" (s->index), "1" (value<<(-n))
-        : "%eax", "%ecx"
-    );
-#        else
-    int index= s->index;
-    uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5);
-
-    value<<= 32-n;
-
-    ptr[0] |= be2me_32(value>>(index&31));
-    ptr[1]  = be2me_32(value<<(32-(index&31)));
-//if(n>24) printf("%d %d\n", n, value);
-    index+= n;
-    s->index= index;
-#        endif
-#    else //ALIGNED_BITSTREAM_WRITER
-#        if ARCH_X86
-    __asm__ volatile(
-        "movl $7, %%ecx                 \n\t"
-        "andl %0, %%ecx                 \n\t"
-        "addl %3, %%ecx                 \n\t"
-        "negl %%ecx                     \n\t"
-        "shll %%cl, %1                  \n\t"
-        "bswapl %1                      \n\t"
-        "movl %0, %%ecx                 \n\t"
-        "shrl $3, %%ecx                 \n\t"
-        "orl %1, (%%ecx, %2)            \n\t"
-        "addl %3, %0                    \n\t"
-        "movl $0, 4(%%ecx, %2)          \n\t"
-        : "=&r" (s->index), "=&r" (value)
-        : "r" (s->buf), "r" (n), "0" (s->index), "1" (value)
-        : "%ecx"
-    );
-#        else
-    int index= s->index;
-    uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3));
-
-    ptr[0] |= be2me_32(value<<(32-n-(index&7) ));
-    ptr[1] = 0;
-//if(n>24) printf("%d %d\n", n, value);
-    index+= n;
-    s->index= index;
-#        endif
-#    endif //!ALIGNED_BITSTREAM_WRITER
-}
-#endif
-
-static inline void put_sbits(PutBitContext *pb, int n, int32_t value)
-{
-    assert(n >= 0 && n <= 31);
-
-    put_bits(pb, n, value & ((1<<n)-1));
-}
-
-/**
- * Writes exactly 32 bits into a bitstream.
- */
-static void av_unused put_bits32(PutBitContext *s, uint32_t value)
-{
-    int lo = value & 0xffff;
-    int hi = value >> 16;
-#ifdef BITSTREAM_WRITER_LE
-    put_bits(s, 16, lo);
-    put_bits(s, 16, hi);
-#else
-    put_bits(s, 16, hi);
-    put_bits(s, 16, lo);
-#endif
-}
-
-/**
- * Returns the pointer to the byte where the bitstream writer will put
- * the next bit.
- */
-static inline uint8_t* put_bits_ptr(PutBitContext *s)
-{
-#ifdef ALT_BITSTREAM_WRITER
-        return s->buf + (s->index>>3);
-#else
-        return s->buf_ptr;
-#endif
-}
-
-/**
- * Skips the given number of bytes.
- * PutBitContext must be flushed & aligned to a byte boundary before calling this.
- */
-static inline void skip_put_bytes(PutBitContext *s, int n)
-{
-        assert((put_bits_count(s)&7)==0);
-#ifdef ALT_BITSTREAM_WRITER
-        FIXME may need some cleaning of the buffer
-        s->index += n<<3;
-#else
-        assert(s->bit_left==32);
-        s->buf_ptr += n;
-#endif
-}
-
-/**
- * Skips the given number of bits.
- * Must only be used if the actual values in the bitstream do not matter.
- * If n is 0 the behavior is undefined.
- */
-static inline void skip_put_bits(PutBitContext *s, int n)
-{
-#ifdef ALT_BITSTREAM_WRITER
-    s->index += n;
-#else
-    s->bit_left -= n;
-    s->buf_ptr-= 4*(s->bit_left>>5);
-    s->bit_left &= 31;
-#endif
-}
-
-/**
- * Changes the end of the buffer.
- *
- * @param size the new size in bytes of the buffer where to put bits
- */
-static inline void set_put_bits_buffer_size(PutBitContext *s, int size)
-{
-    s->buf_end= s->buf + size;
-}
-
-#endif /* AVCODEC_PUT_BITS_H */
diff --git a/libavcodec/qcelpdata.h b/libavcodec/qcelpdata.h
deleted file mode 100644
index d79cea9..0000000
--- a/libavcodec/qcelpdata.h
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * QCELP decoder
- * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_QCELPDATA_H
-#define AVCODEC_QCELPDATA_H
-
-/**
- * @file
- * Data tables for the QCELP decoder
- * @author Reynaldo H. Verdejo Pinochet
- * @remark FFmpeg merging spearheaded by Kenan Gillet
- * @remark Development mentored by Benjamin Larson
- */
-
-#include <stddef.h>
-#include <stdint.h>
-#include "libavutil/common.h"
-
-/**
- * QCELP unpacked data frame
- */
-typedef struct {
-/// @defgroup qcelp_codebook_parameters QCELP excitation codebook parameters
-/// @{
-    uint8_t cbsign[16]; ///!< sign of the codebook gain for each codebook subframe
-    uint8_t cbgain[16]; ///!< unsigned codebook gain for each codebook subframe
-    uint8_t cindex[16]; ///!< codebook index for each codebook subframe
-/// @}
-
-/// @defgroup qcelp_pitch_parameters QCELP pitch prediction parameters
-/// @{
-    uint8_t plag[4];    ///!< pitch lag for each pitch subframe
-    uint8_t pfrac[4];   ///!< fractional pitch lag for each pitch subframe
-    uint8_t pgain[4];   ///!< pitch gain for each pitch subframe
-/// @}
-
-    /**
-     * line spectral pair frequencies (LSP) for RATE_OCTAVE,
-     * line spectral pair frequencies grouped into five vectors
-     * of dimension two (LSPV) for other rates
-     */
-    uint8_t lspv[10];
-
-    /**
-     * reserved bits only present in bitrate 1, 1/4 and 1/8 packets
-     */
-    uint8_t reserved;
-} QCELPFrame;
-
-/**
- * pre-calculated table for hammsinc function
- * Only half of the table is needed because of symmetry.
- *
- * TIA/EIA/IS-733 2.4.5.2-2/3
- */
-static const float qcelp_hammsinc_table[4] = { -0.006822,  0.041249, -0.143459,  0.588863};
-
-typedef struct {
-    uint8_t index;  /*!< index into the QCELPContext structure */
-    uint8_t bitpos; /*!< position of the lowest bit in the value's byte */
-    uint8_t bitlen; /*!< number of bits to read */
-} QCELPBitmap;
-
-#define QCELP_OF(variable, bit, len) {offsetof(QCELPFrame, variable), bit, len}
-
-/**
- * bitmap unpacking tables for RATE_FULL
- *
- * TIA/EIA/IS-733 Table 2.4.7.1-1
- */
-static const QCELPBitmap qcelp_rate_full_bitmap[] = {
-                                // start on bit
-    QCELP_OF(lspv  [ 2], 0, 3), // 265
-    QCELP_OF(lspv  [ 1], 0, 7), // 262
-    QCELP_OF(lspv  [ 0], 0, 6), // 255
-    QCELP_OF(lspv  [ 4], 0, 6), // 249
-    QCELP_OF(lspv  [ 3], 0, 6), // 243
-    QCELP_OF(lspv  [ 2], 3, 4), // 237
-    QCELP_OF(cbsign[ 0], 0, 1), // 233
-    QCELP_OF(cbgain[ 0], 0, 4), // 232
-    QCELP_OF(pfrac [ 0], 0, 1), // 228
-    QCELP_OF(plag  [ 0], 0, 7), // 227
-    QCELP_OF(pgain [ 0], 0, 3), // 220
-    QCELP_OF(cindex[ 1], 0, 4), // 217
-    QCELP_OF(cbsign[ 1], 0, 1), // 213
-    QCELP_OF(cbgain[ 1], 0, 4), // 212
-    QCELP_OF(cindex[ 0], 0, 7), // 208
-    QCELP_OF(cbgain[ 3], 0, 1), // 201
-    QCELP_OF(cindex[ 2], 0, 7), // 200
-    QCELP_OF(cbsign[ 2], 0, 1), // 193
-    QCELP_OF(cbgain[ 2], 0, 4), // 192
-    QCELP_OF(cindex[ 1], 4, 3), // 188
-    QCELP_OF(plag  [ 1], 0, 3), // 185
-    QCELP_OF(pgain [ 1], 0, 3), // 182
-    QCELP_OF(cindex[ 3], 0, 7), // 179
-    QCELP_OF(cbsign[ 3], 0, 1), // 172
-    QCELP_OF(cbgain[ 3], 1, 2), // 171
-    QCELP_OF(cindex[ 4], 0, 6), // 169
-    QCELP_OF(cbsign[ 4], 0, 1), // 163
-    QCELP_OF(cbgain[ 4], 0, 4), // 162
-    QCELP_OF(pfrac [ 1], 0, 1), // 158
-    QCELP_OF(plag  [ 1], 3, 4), // 157
-    QCELP_OF(cbgain[ 6], 0, 3), // 153
-    QCELP_OF(cindex[ 5], 0, 7), // 150
-    QCELP_OF(cbsign[ 5], 0, 1), // 143
-    QCELP_OF(cbgain[ 5], 0, 4), // 142
-    QCELP_OF(cindex[ 4], 6, 1), // 138
-    QCELP_OF(cindex[ 7], 0, 3), // 137
-    QCELP_OF(cbsign[ 7], 0, 1), // 134
-    QCELP_OF(cbgain[ 7], 0, 3), // 133
-    QCELP_OF(cindex[ 6], 0, 7), // 130
-    QCELP_OF(cbsign[ 6], 0, 1), // 123
-    QCELP_OF(cbgain[ 6], 3, 1), // 122
-    QCELP_OF(cbgain[ 8], 0, 1), // 121
-    QCELP_OF(pfrac [ 2], 0, 1), // 120
-    QCELP_OF(plag  [ 2], 0, 7), // 119
-    QCELP_OF(pgain [ 2], 0, 3), // 112
-    QCELP_OF(cindex[ 7], 3, 4), // 109
-    QCELP_OF(cbsign[ 9], 0, 1), // 105
-    QCELP_OF(cbgain[ 9], 0, 4), // 104
-    QCELP_OF(cindex[ 8], 0, 7), // 100
-    QCELP_OF(cbsign[ 8], 0, 1), //  93
-    QCELP_OF(cbgain[ 8], 1, 3), //  92
-    QCELP_OF(cindex[10], 0, 4), //  89
-    QCELP_OF(cbsign[10], 0, 1), //  85
-    QCELP_OF(cbgain[10], 0, 4), //  84
-    QCELP_OF(cindex[ 9], 0, 7), //  80
-    QCELP_OF(pgain [ 3], 0, 2), //  73
-    QCELP_OF(cindex[11], 0, 7), //  71
-    QCELP_OF(cbsign[11], 0, 1), //  64
-    QCELP_OF(cbgain[11], 0, 3), //  63
-    QCELP_OF(cindex[10], 4, 3), //  60
-    QCELP_OF(cindex[12], 0, 2), //  57
-    QCELP_OF(cbsign[12], 0, 1), //  55
-    QCELP_OF(cbgain[12], 0, 4), //  54
-    QCELP_OF(pfrac [ 3], 0, 1), //  50
-    QCELP_OF(plag  [ 3], 0, 7), //  49
-    QCELP_OF(pgain [ 3], 2, 1), //  42
-    QCELP_OF(cindex[13], 0, 6), //  41
-    QCELP_OF(cbsign[13], 0, 1), //  35
-    QCELP_OF(cbgain[13], 0, 4), //  34
-    QCELP_OF(cindex[12], 2, 5), //  30
-    QCELP_OF(cbgain[15], 0, 3), //  25
-    QCELP_OF(cindex[14], 0, 7), //  22
-    QCELP_OF(cbsign[14], 0, 1), //  15
-    QCELP_OF(cbgain[14], 0, 4), //  14
-    QCELP_OF(cindex[13], 6, 1), //  10
-    QCELP_OF(reserved,   0, 2), //   9
-    QCELP_OF(cindex[15], 0, 7), //   7
-    QCELP_OF(cbsign[15], 0, 1)  //   0
-};
-
-/**
- * bitmap unpacking tables for RATE_HALF
- *
- * TIA/EIA/IS-733 Table 2.4.7.2-1
- */
-static const QCELPBitmap qcelp_rate_half_bitmap[] = {
-                               // start on bit
-    QCELP_OF(lspv  [2], 0, 3), // 123
-    QCELP_OF(lspv  [1], 0, 7), // 120
-    QCELP_OF(lspv  [0], 0, 6), // 113
-    QCELP_OF(lspv  [4], 0, 6), // 107
-    QCELP_OF(lspv  [3], 0, 6), // 101
-    QCELP_OF(lspv  [2], 3, 4), //  95
-    QCELP_OF(cbsign[0], 0, 1), //  91
-    QCELP_OF(cbgain[0], 0, 4), //  90
-    QCELP_OF(pfrac [0], 0, 1), //  86
-    QCELP_OF(plag  [0], 0, 7), //  85
-    QCELP_OF(pgain [0], 0, 3), //  78
-    QCELP_OF(plag  [1], 0, 6), //  75
-    QCELP_OF(pgain [1], 0, 3), //  69
-    QCELP_OF(cindex[0], 0, 7), //  66
-    QCELP_OF(pgain [2], 0, 2), //  59
-    QCELP_OF(cindex[1], 0, 7), //  57
-    QCELP_OF(cbsign[1], 0, 1), //  50
-    QCELP_OF(cbgain[1], 0, 4), //  49
-    QCELP_OF(pfrac [1], 0, 1), //  45
-    QCELP_OF(plag  [1], 6, 1), //  44
-    QCELP_OF(cindex[2], 0, 2), //  43
-    QCELP_OF(cbsign[2], 0, 1), //  41
-    QCELP_OF(cbgain[2], 0, 4), //  40
-    QCELP_OF(pfrac [2], 0, 1), //  36
-    QCELP_OF(plag  [2], 0, 7), //  35
-    QCELP_OF(pgain [2], 2, 1), //  28
-    QCELP_OF(pfrac [3], 0, 1), //  27
-    QCELP_OF(plag  [3], 0, 7), //  26
-    QCELP_OF(pgain [3], 0, 3), //  19
-    QCELP_OF(cindex[2], 2, 5), //  16
-    QCELP_OF(cindex[3], 0, 7), //  11
-    QCELP_OF(cbsign[3], 0, 1), //   4
-    QCELP_OF(cbgain[3], 0, 4)  //   3
-};
-
-/**
- * bitmap unpacking tables for RATE_QUARTER
- *
- * TIA/EIA/IS-733 Table 2.4.7.3-1
- */
-static const QCELPBitmap qcelp_rate_quarter_bitmap[] = {
-                               // start on bit
-    QCELP_OF(lspv  [2], 0, 3), // 53
-    QCELP_OF(lspv  [1], 0, 7), // 50
-    QCELP_OF(lspv  [0], 0, 6), // 43
-    QCELP_OF(lspv  [4], 0, 6), // 37
-    QCELP_OF(lspv  [3], 0, 6), // 31
-    QCELP_OF(lspv  [2], 3, 4), // 25
-    QCELP_OF(cbgain[3], 0, 4), // 21
-    QCELP_OF(cbgain[2], 0, 4), // 17
-    QCELP_OF(cbgain[1], 0, 4), // 13
-    QCELP_OF(cbgain[0], 0, 4), //  9
-    QCELP_OF(reserved,  0, 2), //  5
-    QCELP_OF(cbgain[4], 0, 4)  //  3
-};
-
-/**
- * bitmap unpacking tables for RATE_OCTAVE
- *
- * trick: CBSEED is written into QCELPContext.cbsign[15],
- * which is not used for RATE_OCTAVE.
- * CBSEED is only used to ensure the occurrence of random bit
- * patterns in the 16 first bits that are used as the seed.
- *
- * TIA/EIA/IS-733 Table 2.4.7.4-1
- */
-static const QCELPBitmap qcelp_rate_octave_bitmap[] = {
-                                // start on bit
-    QCELP_OF(cbsign[15], 3, 1), // 19
-    QCELP_OF(lspv   [0], 0, 1), // 18
-    QCELP_OF(lspv   [1], 0, 1), // 17
-    QCELP_OF(lspv   [2], 0, 1), // 16
-    QCELP_OF(cbsign[15], 2, 1), // 15
-    QCELP_OF(lspv   [3], 0, 1), // 14
-    QCELP_OF(lspv   [4], 0, 1), // 13
-    QCELP_OF(lspv   [5], 0, 1), // 12
-    QCELP_OF(cbsign[15], 1, 1), // 11
-    QCELP_OF(lspv   [6], 0, 1), // 10
-    QCELP_OF(lspv   [7], 0, 1), //  9
-    QCELP_OF(lspv   [8], 0, 1), //  8
-    QCELP_OF(cbsign[15], 0, 1), //  7
-    QCELP_OF(lspv   [9], 0, 1), //  6
-    QCELP_OF(cbgain [0], 0, 2), //  7
-    QCELP_OF(reserved,   0, 4)  //  3
-};
-
-/**
- * position of the bitmapping data for each packet type in
- * the QCELPContext
- */
-static const QCELPBitmap * const qcelp_unpacking_bitmaps_per_rate[5] = {
-    NULL,                     ///!< for SILENCE rate
-    qcelp_rate_octave_bitmap,
-    qcelp_rate_quarter_bitmap,
-    qcelp_rate_half_bitmap,
-    qcelp_rate_full_bitmap,
-};
-
-static const uint16_t qcelp_unpacking_bitmaps_lengths[5] = {
-    0, ///!< for SILENCE rate
-    FF_ARRAY_ELEMS(qcelp_rate_octave_bitmap),
-    FF_ARRAY_ELEMS(qcelp_rate_quarter_bitmap),
-    FF_ARRAY_ELEMS(qcelp_rate_half_bitmap),
-    FF_ARRAY_ELEMS(qcelp_rate_full_bitmap),
-};
-
-typedef uint16_t qcelp_vector[2];
-
-/**
- * LSP vector quantization tables in x*10000 form
- *
- * TIA/EIA/IS-733 tables 2.4.3.2.6.3-1 through 2.4.3.2.6.3-5
- */
-
-static const qcelp_vector qcelp_lspvq1[64]= {
-{ 327, 118},{ 919, 111},{ 427, 440},{1327, 185},
-{ 469,  50},{1272,  91},{ 892,  59},{1771, 193},
-{ 222, 158},{1100, 127},{ 827,  55},{ 978, 791},
-{ 665,  47},{ 700,1401},{ 670, 859},{1913,1048},
-{ 471, 215},{1046, 125},{ 645, 298},{1599, 160},
-{ 593,  39},{1187, 462},{ 749, 341},{1520, 511},
-{ 290, 792},{ 909, 362},{ 753,  81},{1111,1058},
-{ 519, 253},{ 828, 839},{ 685, 541},{1421,1258},
-{ 386, 130},{ 962, 119},{ 542, 387},{1431, 185},
-{ 526,  51},{1175, 260},{ 831, 167},{1728, 510},
-{ 273, 437},{1172, 113},{ 771, 144},{1122, 751},
-{ 619, 119},{ 492,1276},{ 658, 695},{1882, 615},
-{ 415, 200},{1018,  88},{ 681, 339},{1436, 325},
-{ 555, 122},{1042, 485},{ 826, 345},{1374, 743},
-{ 383,1018},{1005, 358},{ 704,  86},{1301, 586},
-{ 597, 241},{ 832, 621},{ 555, 573},{1504, 839}};
-
-static const qcelp_vector qcelp_lspvq2[128]= {
-{ 255, 293},{ 904, 219},{ 151,1211},{1447, 498},
-{ 470, 253},{1559, 177},{1547, 994},{2394, 242},
-{  91, 813},{ 857, 590},{ 934,1326},{1889, 282},
-{ 813, 472},{1057,1494},{ 450,3315},{2163,1895},
-{ 538, 532},{1399, 218},{ 146,1552},{1755, 626},
-{ 822, 202},{1299, 663},{ 706,1732},{2656, 401},
-{ 418, 745},{ 762,1038},{ 583,1748},{1746,1285},
-{ 527,1169},{1314, 830},{ 556,2116},{1073,2321},
-{ 297, 570},{ 981, 403},{ 468,1103},{1740, 243},
-{ 725, 179},{1255, 474},{1374,1362},{1922, 912},
-{ 285, 947},{ 930, 700},{ 593,1372},{1909, 576},
-{ 588, 916},{1110,1116},{ 224,2719},{1633,2220},
-{ 402, 520},{1061, 448},{ 402,1352},{1499, 775},
-{ 664, 589},{1081, 727},{ 801,2206},{2165,1157},
-{ 566, 802},{ 911,1116},{ 306,1703},{1792, 836},
-{ 655, 999},{1061,1038},{ 298,2089},{1110,1753},
-{ 361, 311},{ 970, 239},{ 265,1231},{1495, 573},
-{ 566, 262},{1569, 293},{1341,1144},{2271, 544},
-{ 214, 877},{ 847, 719},{ 794,1384},{2067, 274},
-{ 703, 688},{1099,1306},{ 391,2947},{2024,1670},
-{ 471, 525},{1245, 290},{ 264,1557},{1568, 807},
-{ 718, 399},{1193, 685},{ 883,1594},{2729, 764},
-{ 500, 754},{ 809,1108},{ 541,1648},{1523,1385},
-{ 614,1196},{1209, 847},{ 345,2242},{1442,1747},
-{ 199, 560},{1092, 194},{ 349,1253},{1653, 507},
-{ 625, 354},{1376, 431},{1187,1465},{2164, 872},
-{ 360, 974},{1008, 698},{ 704,1346},{2114, 452},
-{ 720, 816},{1240,1089},{ 439,2475},{1498,2040},
-{ 336, 718},{1213, 187},{ 451,1450},{1368, 885},
-{ 592, 578},{1131, 531},{ 861,1855},{1764,1500},
-{ 444, 970},{ 935, 903},{ 424,1687},{1633,1102},
-{ 793, 897},{1060, 897},{ 185,2011},{1205,1855}};
-
-static const qcelp_vector qcelp_lspvq3[128]= {
-{ 225, 283},{1296, 355},{ 543, 343},{2073, 274},
-{ 204,1099},{1562, 523},{1388, 161},{2784, 274},
-{ 112, 849},{1870, 175},{1189, 160},{1490,1088},
-{ 969,1115},{ 659,3322},{1158,1073},{3183,1363},
-{ 517, 223},{1740, 223},{ 704, 387},{2637, 234},
-{ 692,1005},{1287,1610},{ 952, 532},{2393, 646},
-{ 490, 552},{1619, 657},{ 845, 670},{1784,2280},
-{ 191,1775},{ 272,2868},{ 942, 952},{2628,1479},
-{ 278, 579},{1565, 218},{ 814, 180},{2379, 187},
-{ 276,1444},{1199,1223},{1200, 349},{3009, 307},
-{ 312, 844},{1898, 306},{ 863, 470},{1685,1241},
-{ 513,1727},{ 711,2233},{1085, 864},{3398, 527},
-{ 414, 440},{1356, 612},{ 964, 147},{2173, 738},
-{ 465,1292},{ 877,1749},{1104, 689},{2105,1311},
-{ 580, 864},{1895, 752},{ 652, 609},{1485,1699},
-{ 514,1400},{ 386,2131},{ 933, 798},{2473, 986},
-{ 334, 360},{1375, 398},{ 621, 276},{2183, 280},
-{ 311,1114},{1382, 807},{1284, 175},{2605, 636},
-{ 230, 816},{1739, 408},{1074, 176},{1619,1120},
-{ 784,1371},{ 448,3050},{1189, 880},{3039,1165},
-{ 424, 241},{1672, 186},{ 815, 333},{2432, 324},
-{ 584,1029},{1137,1546},{1015, 585},{2198, 995},
-{ 574, 581},{1746, 647},{ 733, 740},{1938,1737},
-{ 347,1710},{ 373,2429},{ 787,1061},{2439,1438},
-{ 185, 536},{1489, 178},{ 703, 216},{2178, 487},
-{ 154,1421},{1414, 994},{1103, 352},{3072, 473},
-{ 408, 819},{2055, 168},{ 998, 354},{1917,1140},
-{ 665,1799},{ 993,2213},{1234, 631},{3003, 762},
-{ 373, 620},{1518, 425},{ 913, 300},{1966, 836},
-{ 402,1185},{ 948,1385},{1121, 555},{1802,1509},
-{ 474, 886},{1888, 610},{ 739, 585},{1231,2379},
-{ 661,1335},{ 205,2211},{ 823, 822},{2480,1179}};
-
-static const qcelp_vector qcelp_lspvq4[64]= {
-{ 348, 311},{ 812,1145},{ 552, 461},{1826, 263},
-{ 601, 675},{1730, 172},{1523, 193},{2449, 277},
-{ 334, 668},{ 805,1441},{1319, 207},{1684, 910},
-{ 582,1318},{1403,1098},{ 979, 832},{2700,1359},
-{ 624, 228},{1292, 979},{ 800, 195},{2226, 285},
-{ 730, 862},{1537, 601},{1115, 509},{2720, 354},
-{ 218,1167},{1212,1538},{1074, 247},{1674,1710},
-{ 322,2142},{1263, 777},{ 981, 556},{2119,1710},
-{ 193, 596},{1035, 957},{ 694, 397},{1997, 253},
-{ 743, 603},{1584, 321},{1346, 346},{2221, 708},
-{ 451, 732},{1040,1415},{1184, 230},{1853, 919},
-{ 310,1661},{1625, 706},{ 856, 843},{2902, 702},
-{ 467, 348},{1108,1048},{ 859, 306},{1964, 463},
-{ 560,1013},{1425, 533},{1142, 634},{2391, 879},
-{ 397,1084},{1345,1700},{ 976, 248},{1887,1189},
-{ 644,2087},{1262, 603},{ 877, 550},{2203,1307}};
-
-static const qcelp_vector qcelp_lspvq5[64]= {
-{ 360, 222},{ 820,1097},{ 601, 319},{1656, 198},
-{ 604, 513},{1552, 141},{1391, 155},{2474, 261},
-{ 269, 785},{1463, 646},{1123, 191},{2015, 223},
-{ 785, 844},{1202,1011},{ 980, 807},{3014, 793},
-{ 570, 180},{1135,1382},{ 778, 256},{1901, 179},
-{ 807, 622},{1461, 458},{1231, 178},{2028, 821},
-{ 387, 927},{1496,1004},{ 888, 392},{2246, 341},
-{ 295,1462},{1156, 694},{1022, 473},{2226,1364},
-{ 210, 478},{1029,1020},{ 722, 181},{1730, 251},
-{ 730, 488},{1465, 293},{1303, 326},{2595, 387},
-{ 458, 584},{1569, 742},{1029, 173},{1910, 495},
-{ 605,1159},{1268, 719},{ 973, 646},{2872, 428},
-{ 443, 334},{ 835,1465},{ 912, 138},{1716, 442},
-{ 620, 778},{1316, 450},{1186, 335},{1446,1665},
-{ 486,1050},{1675,1019},{ 880, 278},{2214, 202},
-{ 539,1564},{1142, 533},{ 984, 391},{2130,1089}};
-
-static const qcelp_vector * const qcelp_lspvq[5] = {
-    qcelp_lspvq1,
-    qcelp_lspvq2,
-    qcelp_lspvq3,
-    qcelp_lspvq4,
-    qcelp_lspvq5
-};
-
-/**
- * the final gain scalefactor before clipping into a usable output float
- */
-#define QCELP_SCALE 8192.
-
-/**
- * table for computing Ga (decoded linear codebook gain magnitude)
- *
- * @note The table could fit in int16_t in x*8 form, but it seems
- *       to be slower on x86
- *
- * TIA/EIA/IS-733 2.4.6.2.1-3
- */
-
-static const float qcelp_g12ga[61] = {
-    1.000/QCELP_SCALE,   1.125/QCELP_SCALE,   1.250/QCELP_SCALE,   1.375/QCELP_SCALE,
-    1.625/QCELP_SCALE,   1.750/QCELP_SCALE,   2.000/QCELP_SCALE,   2.250/QCELP_SCALE,
-    2.500/QCELP_SCALE,   2.875/QCELP_SCALE,   3.125/QCELP_SCALE,   3.500/QCELP_SCALE,
-    4.000/QCELP_SCALE,   4.500/QCELP_SCALE,   5.000/QCELP_SCALE,   5.625/QCELP_SCALE,
-    6.250/QCELP_SCALE,   7.125/QCELP_SCALE,   8.000/QCELP_SCALE,   8.875/QCELP_SCALE,
-   10.000/QCELP_SCALE,  11.250/QCELP_SCALE,  12.625/QCELP_SCALE,  14.125/QCELP_SCALE,
-   15.875/QCELP_SCALE,  17.750/QCELP_SCALE,  20.000/QCELP_SCALE,  22.375/QCELP_SCALE,
-   25.125/QCELP_SCALE,  28.125/QCELP_SCALE,  31.625/QCELP_SCALE,  35.500/QCELP_SCALE,
-   39.750/QCELP_SCALE,  44.625/QCELP_SCALE,  50.125/QCELP_SCALE,  56.250/QCELP_SCALE,
-   63.125/QCELP_SCALE,  70.750/QCELP_SCALE,  79.375/QCELP_SCALE,  89.125/QCELP_SCALE,
-  100.000/QCELP_SCALE, 112.250/QCELP_SCALE, 125.875/QCELP_SCALE, 141.250/QCELP_SCALE,
-  158.500/QCELP_SCALE, 177.875/QCELP_SCALE, 199.500/QCELP_SCALE, 223.875/QCELP_SCALE,
-  251.250/QCELP_SCALE, 281.875/QCELP_SCALE, 316.250/QCELP_SCALE, 354.875/QCELP_SCALE,
-  398.125/QCELP_SCALE, 446.625/QCELP_SCALE, 501.125/QCELP_SCALE, 562.375/QCELP_SCALE,
-  631.000/QCELP_SCALE, 708.000/QCELP_SCALE, 794.375/QCELP_SCALE, 891.250/QCELP_SCALE,
- 1000.000/QCELP_SCALE};
-
-/**
- * circular codebook for rate 1 frames in x*100 form
- *
- * TIA/EIA/IS-733 2.4.6.1-2
- */
-static const int16_t qcelp_rate_full_codebook[128] = {
-     10,  -65,  -59,   12,  110,   34, -134,  157,
-    104,  -84,  -34, -115,   23, -101,    3,   45,
-   -101,  -16,  -59,   28,  -45,  134,  -67,   22,
-     61,  -29,  226,  -26,  -55, -179,  157,  -51,
-   -220,  -93,  -37,   60,  118,   74,  -48,  -95,
-   -181,  111,   36,  -52, -215,   78, -112,   39,
-    -17,  -47, -223,   19,   12,  -98, -142,  130,
-     54, -127,   21,  -12,   39,  -48,   12,  128,
-      6, -167,   82, -102,  -79,   55,  -44,   48,
-    -20,  -53,    8,  -61,   11,  -70, -157, -168,
-     20,  -56,  -74,   78,   33,  -63, -173,   -2,
-    -75,  -53, -146,   77,   66,  -29,    9,  -75,
-     65,  119,  -43,   76,  233,   98,  125, -156,
-    -27,   78,   -9,  170,  176,  143, -148,   -7,
-     27, -136,    5,   27,   18,  139,  204,    7,
-   -184, -197,   52,   -3,   78, -189,    8,  -65
-};
-#define QCELP_RATE_FULL_CODEBOOK_RATIO .01
-
-/**
- * circular codebook for rate 1/2 frames in x*2 form
- *
- * TIA/EIA/IS-733 2.4.6.1-1
- */
-static const int8_t qcelp_rate_half_codebook[128] = {
-     0, -4,  0, -3,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,
-     0, -3, -2,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  5,
-     0,  0,  0,  0,  0,  0,  4,  0,
-     0,  3,  2,  0,  3,  4,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  3,  0,  0,
-    -3,  3,  0,  0, -2,  0,  3,  0,
-     0,  0,  0,  0,  0,  0, -5,  0,
-     0,  0,  0,  3,  0,  0,  0,  3,
-     0,  0,  0,  0,  0,  0,  0,  4,
-     0,  0,  0,  0,  0,  0,  0,  0,
-     0,  3,  6, -3, -4,  0, -3, -3,
-     3, -3,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0
-};
-#define QCELP_RATE_HALF_CODEBOOK_RATIO 0.5
-
-/**
- * sqrt(1.887) is the maximum of the pseudorandom
- * white sequence used to generate the scaled codebook
- * vector for bitrate 1/4.
- *
- * TIA/EIA/IS-733 2.4.8.1.2
- */
-#define QCELP_SQRT1887 1.373681186
-
-/**
- * table for impulse response of BPF used to filter
- * the white excitation for bitrate 1/4 synthesis
- *
- * Only half the tables are needed because of symmetry.
- *
- * TIA/EIA/IS-733 2.4.8.1.2-1.1
- */
-static const double qcelp_rnd_fir_coefs[11] = {
-  -1.344519e-1, 1.735384e-2, -6.905826e-2, 2.434368e-2,
-  -8.210701e-2, 3.041388e-2, -9.251384e-2, 3.501983e-2,
-  -9.918777e-2, 3.749518e-2,  8.985137e-1
-};
-
-/**
- * This spread factor is used, for bitrate 1/8 and I_F_Q,
- * to force the LSP frequencies to be at least 80 Hz apart.
- *
- * TIA/EIA/IS-733 2.4.3.3.2
- */
-#define QCELP_LSP_SPREAD_FACTOR 0.02
-
-/**
- * predictor coefficient for the conversion of LSP codes
- * to LSP frequencies for 1/8 and I_F_Q
- *
- * TIA/EIA/IS-733 2.4.3.2.7-2
- */
-#define QCELP_LSP_OCTAVE_PREDICTOR 29.0/32
-
-/**
- * initial coefficient to perform bandwidth expansion on LPC
- *
- * @note: 0.9883 looks like an approximation of 253/256.
- *
- * TIA/EIA/IS-733 2.4.3.3.6 6
- */
-#define QCELP_BANDWIDTH_EXPANSION_COEFF 0.9883
-
-#endif /* AVCODEC_QCELPDATA_H */
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
deleted file mode 100644
index 97785ad..0000000
--- a/libavcodec/qcelpdec.c
+++ /dev/null
@@ -1,854 +0,0 @@
-/*
- * QCELP decoder
- * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QCELP decoder
- * @author Reynaldo H. Verdejo Pinochet
- * @remark FFmpeg merging spearheaded by Kenan Gillet
- * @remark Development mentored by Benjamin Larson
- */
-
-#include <stddef.h>
-
-#include "avcodec.h"
-#include "internal.h"
-#include "get_bits.h"
-
-#include "qcelpdata.h"
-
-#include "celp_math.h"
-#include "celp_filters.h"
-#include "acelp_filters.h"
-#include "acelp_vectors.h"
-#include "lsp.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-typedef enum
-{
-    I_F_Q = -1,    /*!< insufficient frame quality */
-    SILENCE,
-    RATE_OCTAVE,
-    RATE_QUARTER,
-    RATE_HALF,
-    RATE_FULL
-} qcelp_packet_rate;
-
-typedef struct
-{
-    GetBitContext     gb;
-    qcelp_packet_rate bitrate;
-    QCELPFrame        frame;    /*!< unpacked data frame */
-
-    uint8_t  erasure_count;
-    uint8_t  octave_count;      /*!< count the consecutive RATE_OCTAVE frames */
-    float    prev_lspf[10];
-    float    predictor_lspf[10];/*!< LSP predictor for RATE_OCTAVE and I_F_Q */
-    float    pitch_synthesis_filter_mem[303];
-    float    pitch_pre_filter_mem[303];
-    float    rnd_fir_filter_mem[180];
-    float    formant_mem[170];
-    float    last_codebook_gain;
-    int      prev_g1[2];
-    int      prev_bitrate;
-    float    pitch_gain[4];
-    uint8_t  pitch_lag[4];
-    uint16_t first16bits;
-    uint8_t  warned_buf_mismatch_bitrate;
-
-    /* postfilter */
-    float    postfilter_synth_mem[10];
-    float    postfilter_agc_mem;
-    float    postfilter_tilt_mem;
-} QCELPContext;
-
-/**
- * Initialize the speech codec according to the specification.
- *
- * TIA/EIA/IS-733 2.4.9
- */
-static av_cold int qcelp_decode_init(AVCodecContext *avctx)
-{
-    QCELPContext *q = avctx->priv_data;
-    int i;
-
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
-
-    for(i=0; i<10; i++)
-        q->prev_lspf[i] = (i+1)/11.;
-
-    return 0;
-}
-
-/**
- * Decodes the 10 quantized LSP frequencies from the LSPV/LSP
- * transmission codes of any bitrate and checks for badly received packets.
- *
- * @param q the context
- * @param lspf line spectral pair frequencies
- *
- * @return 0 on success, -1 if the packet is badly received
- *
- * TIA/EIA/IS-733 2.4.3.2.6.2-2, 2.4.8.7.3
- */
-static int decode_lspf(QCELPContext *q, float *lspf)
-{
-    int i;
-    float tmp_lspf, smooth, erasure_coeff;
-    const float *predictors;
-
-    if(q->bitrate == RATE_OCTAVE || q->bitrate == I_F_Q)
-    {
-        predictors = (q->prev_bitrate != RATE_OCTAVE &&
-                       q->prev_bitrate != I_F_Q ?
-                       q->prev_lspf : q->predictor_lspf);
-
-        if(q->bitrate == RATE_OCTAVE)
-        {
-            q->octave_count++;
-
-            for(i=0; i<10; i++)
-            {
-                q->predictor_lspf[i] =
-                             lspf[i] = (q->frame.lspv[i] ?  QCELP_LSP_SPREAD_FACTOR
-                                                         : -QCELP_LSP_SPREAD_FACTOR)
-                                     + predictors[i] * QCELP_LSP_OCTAVE_PREDICTOR
-                                     + (i + 1) * ((1 - QCELP_LSP_OCTAVE_PREDICTOR)/11);
-            }
-            smooth = (q->octave_count < 10 ? .875 : 0.1);
-        }else
-        {
-            erasure_coeff = QCELP_LSP_OCTAVE_PREDICTOR;
-
-            assert(q->bitrate == I_F_Q);
-
-            if(q->erasure_count > 1)
-                erasure_coeff *= (q->erasure_count < 4 ? 0.9 : 0.7);
-
-            for(i=0; i<10; i++)
-            {
-                q->predictor_lspf[i] =
-                             lspf[i] = (i + 1) * ( 1 - erasure_coeff)/11
-                                     + erasure_coeff * predictors[i];
-            }
-            smooth = 0.125;
-        }
-
-        // Check the stability of the LSP frequencies.
-        lspf[0] = FFMAX(lspf[0], QCELP_LSP_SPREAD_FACTOR);
-        for(i=1; i<10; i++)
-            lspf[i] = FFMAX(lspf[i], (lspf[i-1] + QCELP_LSP_SPREAD_FACTOR));
-
-        lspf[9] = FFMIN(lspf[9], (1.0 - QCELP_LSP_SPREAD_FACTOR));
-        for(i=9; i>0; i--)
-            lspf[i-1] = FFMIN(lspf[i-1], (lspf[i] - QCELP_LSP_SPREAD_FACTOR));
-
-        // Low-pass filter the LSP frequencies.
-        ff_weighted_vector_sumf(lspf, lspf, q->prev_lspf, smooth, 1.0-smooth, 10);
-    }else
-    {
-        q->octave_count = 0;
-
-        tmp_lspf = 0.;
-        for(i=0; i<5 ; i++)
-        {
-            lspf[2*i+0] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][0] * 0.0001;
-            lspf[2*i+1] = tmp_lspf += qcelp_lspvq[i][q->frame.lspv[i]][1] * 0.0001;
-        }
-
-        // Check for badly received packets.
-        if(q->bitrate == RATE_QUARTER)
-        {
-            if(lspf[9] <= .70 || lspf[9] >=  .97)
-                return -1;
-            for(i=3; i<10; i++)
-                if(fabs(lspf[i] - lspf[i-2]) < .08)
-                    return -1;
-        }else
-        {
-            if(lspf[9] <= .66 || lspf[9] >= .985)
-                return -1;
-            for(i=4; i<10; i++)
-                if (fabs(lspf[i] - lspf[i-4]) < .0931)
-                    return -1;
-        }
-    }
-    return 0;
-}
-
-/**
- * Converts codebook transmission codes to GAIN and INDEX.
- *
- * @param q the context
- * @param gain array holding the decoded gain
- *
- * TIA/EIA/IS-733 2.4.6.2
- */
-static void decode_gain_and_index(QCELPContext  *q,
-                                  float *gain) {
-    int   i, subframes_count, g1[16];
-    float slope;
-
-    if(q->bitrate >= RATE_QUARTER)
-    {
-        switch(q->bitrate)
-        {
-            case RATE_FULL: subframes_count = 16; break;
-            case RATE_HALF: subframes_count = 4;  break;
-            default:        subframes_count = 5;
-        }
-        for(i=0; i<subframes_count; i++)
-        {
-            g1[i] = 4 * q->frame.cbgain[i];
-            if(q->bitrate == RATE_FULL && !((i+1) & 3))
-            {
-                g1[i] += av_clip((g1[i-1] + g1[i-2] + g1[i-3]) / 3 - 6, 0, 32);
-            }
-
-            gain[i] = qcelp_g12ga[g1[i]];
-
-            if(q->frame.cbsign[i])
-            {
-                gain[i] = -gain[i];
-                q->frame.cindex[i] = (q->frame.cindex[i]-89) & 127;
-            }
-        }
-
-        q->prev_g1[0] = g1[i-2];
-        q->prev_g1[1] = g1[i-1];
-        q->last_codebook_gain = qcelp_g12ga[g1[i-1]];
-
-        if(q->bitrate == RATE_QUARTER)
-        {
-            // Provide smoothing of the unvoiced excitation energy.
-            gain[7] =     gain[4];
-            gain[6] = 0.4*gain[3] + 0.6*gain[4];
-            gain[5] =     gain[3];
-            gain[4] = 0.8*gain[2] + 0.2*gain[3];
-            gain[3] = 0.2*gain[1] + 0.8*gain[2];
-            gain[2] =     gain[1];
-            gain[1] = 0.6*gain[0] + 0.4*gain[1];
-        }
-    }else if (q->bitrate != SILENCE)
-    {
-        if(q->bitrate == RATE_OCTAVE)
-        {
-            g1[0] = 2 * q->frame.cbgain[0]
-                  + av_clip((q->prev_g1[0] + q->prev_g1[1]) / 2 - 5, 0, 54);
-            subframes_count = 8;
-        }else
-        {
-            assert(q->bitrate == I_F_Q);
-
-            g1[0] = q->prev_g1[1];
-            switch(q->erasure_count)
-            {
-                case 1 : break;
-                case 2 : g1[0] -= 1; break;
-                case 3 : g1[0] -= 2; break;
-                default: g1[0] -= 6;
-            }
-            if(g1[0] < 0)
-                g1[0] = 0;
-            subframes_count = 4;
-        }
-        // This interpolation is done to produce smoother background noise.
-        slope = 0.5*(qcelp_g12ga[g1[0]] - q->last_codebook_gain) / subframes_count;
-        for(i=1; i<=subframes_count; i++)
-            gain[i-1] = q->last_codebook_gain + slope * i;
-
-        q->last_codebook_gain = gain[i-2];
-        q->prev_g1[0] = q->prev_g1[1];
-        q->prev_g1[1] = g1[0];
-    }
-}
-
-/**
- * If the received packet is Rate 1/4 a further sanity check is made of the
- * codebook gain.
- *
- * @param cbgain the unpacked cbgain array
- * @return -1 if the sanity check fails, 0 otherwise
- *
- * TIA/EIA/IS-733 2.4.8.7.3
- */
-static int codebook_sanity_check_for_rate_quarter(const uint8_t *cbgain)
-{
-    int i, diff, prev_diff=0;
-
-    for(i=1; i<5; i++)
-    {
-        diff = cbgain[i] - cbgain[i-1];
-        if(FFABS(diff) > 10)
-            return -1;
-        else if(FFABS(diff - prev_diff) > 12)
-            return -1;
-        prev_diff = diff;
-    }
-    return 0;
-}
-
-/**
- * Computes the scaled codebook vector Cdn From INDEX and GAIN
- * for all rates.
- *
- * The specification lacks some information here.
- *
- * TIA/EIA/IS-733 has an omission on the codebook index determination
- * formula for RATE_FULL and RATE_HALF frames at section 2.4.8.1.1. It says
- * you have to subtract the decoded index parameter from the given scaled
- * codebook vector index 'n' to get the desired circular codebook index, but
- * it does not mention that you have to clamp 'n' to [0-9] in order to get
- * RI-compliant results.
- *
- * The reason for this mistake seems to be the fact they forgot to mention you
- * have to do these calculations per codebook subframe and adjust given
- * equation values accordingly.
- *
- * @param q the context
- * @param gain array holding the 4 pitch subframe gain values
- * @param cdn_vector array for the generated scaled codebook vector
- */
-static void compute_svector(QCELPContext *q, const float *gain,
-                            float *cdn_vector)
-{
-    int      i, j, k;
-    uint16_t cbseed, cindex;
-    float    *rnd, tmp_gain, fir_filter_value;
-
-    switch(q->bitrate)
-    {
-        case RATE_FULL:
-            for(i=0; i<16; i++)
-            {
-                tmp_gain = gain[i] * QCELP_RATE_FULL_CODEBOOK_RATIO;
-                cindex = -q->frame.cindex[i];
-                for(j=0; j<10; j++)
-                    *cdn_vector++ = tmp_gain * qcelp_rate_full_codebook[cindex++ & 127];
-            }
-        break;
-        case RATE_HALF:
-            for(i=0; i<4; i++)
-            {
-                tmp_gain = gain[i] * QCELP_RATE_HALF_CODEBOOK_RATIO;
-                cindex = -q->frame.cindex[i];
-                for (j = 0; j < 40; j++)
-                *cdn_vector++ = tmp_gain * qcelp_rate_half_codebook[cindex++ & 127];
-            }
-        break;
-        case RATE_QUARTER:
-            cbseed = (0x0003 & q->frame.lspv[4])<<14 |
-                     (0x003F & q->frame.lspv[3])<< 8 |
-                     (0x0060 & q->frame.lspv[2])<< 1 |
-                     (0x0007 & q->frame.lspv[1])<< 3 |
-                     (0x0038 & q->frame.lspv[0])>> 3 ;
-            rnd = q->rnd_fir_filter_mem + 20;
-            for(i=0; i<8; i++)
-            {
-                tmp_gain = gain[i] * (QCELP_SQRT1887 / 32768.0);
-                for(k=0; k<20; k++)
-                {
-                    cbseed = 521 * cbseed + 259;
-                    *rnd = (int16_t)cbseed;
-
-                    // FIR filter
-                    fir_filter_value = 0.0;
-                    for(j=0; j<10; j++)
-                        fir_filter_value += qcelp_rnd_fir_coefs[j ]
-                                          * (rnd[-j ] + rnd[-20+j]);
-
-                    fir_filter_value += qcelp_rnd_fir_coefs[10] * rnd[-10];
-                    *cdn_vector++ = tmp_gain * fir_filter_value;
-                    rnd++;
-                }
-            }
-            memcpy(q->rnd_fir_filter_mem, q->rnd_fir_filter_mem + 160, 20 * sizeof(float));
-        break;
-        case RATE_OCTAVE:
-            cbseed = q->first16bits;
-            for(i=0; i<8; i++)
-            {
-                tmp_gain = gain[i] * (QCELP_SQRT1887 / 32768.0);
-                for(j=0; j<20; j++)
-                {
-                    cbseed = 521 * cbseed + 259;
-                    *cdn_vector++ = tmp_gain * (int16_t)cbseed;
-                }
-            }
-        break;
-        case I_F_Q:
-            cbseed = -44; // random codebook index
-            for(i=0; i<4; i++)
-            {
-                tmp_gain = gain[i] * QCELP_RATE_FULL_CODEBOOK_RATIO;
-                for(j=0; j<40; j++)
-                    *cdn_vector++ = tmp_gain * qcelp_rate_full_codebook[cbseed++ & 127];
-            }
-        break;
-        case SILENCE:
-            memset(cdn_vector, 0, 160 * sizeof(float));
-        break;
-    }
-}
-
-/**
- * Apply generic gain control.
- *
- * @param v_out output vector
- * @param v_in gain-controlled vector
- * @param v_ref vector to control gain of
- *
- * TIA/EIA/IS-733 2.4.8.3, 2.4.8.6
- */
-static void apply_gain_ctrl(float *v_out, const float *v_ref,
-                            const float *v_in)
-{
-    int i;
-
-    for (i = 0; i < 160; i += 40)
-        ff_scale_vector_to_given_sum_of_squares(v_out + i, v_in + i,
-                                                ff_dot_productf(v_ref + i,
-                                                                v_ref + i, 40),
-                                                40);
-}
-
-/**
- * Apply filter in pitch-subframe steps.
- *
- * @param memory buffer for the previous state of the filter
- *        - must be able to contain 303 elements
- *        - the 143 first elements are from the previous state
- *        - the next 160 are for output
- * @param v_in input filter vector
- * @param gain per-subframe gain array, each element is between 0.0 and 2.0
- * @param lag per-subframe lag array, each element is
- *        - between 16 and 143 if its corresponding pfrac is 0,
- *        - between 16 and 139 otherwise
- * @param pfrac per-subframe boolean array, 1 if the lag is fractional, 0
- *        otherwise
- *
- * @return filter output vector
- */
-static const float *do_pitchfilter(float memory[303], const float v_in[160],
-                                   const float gain[4], const uint8_t *lag,
-                                   const uint8_t pfrac[4])
-{
-    int         i, j;
-    float       *v_lag, *v_out;
-    const float *v_len;
-
-    v_out = memory + 143; // Output vector starts at memory[143].
-
-    for(i=0; i<4; i++)
-    {
-        if(gain[i])
-        {
-            v_lag = memory + 143 + 40 * i - lag[i];
-            for(v_len=v_in+40; v_in<v_len; v_in++)
-            {
-                if(pfrac[i]) // If it is a fractional lag...
-                {
-                    for(j=0, *v_out=0.; j<4; j++)
-                        *v_out += qcelp_hammsinc_table[j] * (v_lag[j-4] + v_lag[3-j]);
-                }else
-                    *v_out = *v_lag;
-
-                *v_out = *v_in + gain[i] * *v_out;
-
-                v_lag++;
-                v_out++;
-            }
-        }else
-        {
-            memcpy(v_out, v_in, 40 * sizeof(float));
-            v_in  += 40;
-            v_out += 40;
-        }
-    }
-
-    memmove(memory, memory + 160, 143 * sizeof(float));
-    return memory + 143;
-}
-
-/**
- * Apply pitch synthesis filter and pitch prefilter to the scaled codebook vector.
- * TIA/EIA/IS-733 2.4.5.2, 2.4.8.7.2
- *
- * @param q the context
- * @param cdn_vector the scaled codebook vector
- */
-static void apply_pitch_filters(QCELPContext *q, float *cdn_vector)
-{
-    int         i;
-    const float *v_synthesis_filtered, *v_pre_filtered;
-
-    if(q->bitrate >= RATE_HALF ||
-       q->bitrate == SILENCE ||
-       (q->bitrate == I_F_Q && (q->prev_bitrate >= RATE_HALF)))
-    {
-
-        if(q->bitrate >= RATE_HALF)
-        {
-
-            // Compute gain & lag for the whole frame.
-            for(i=0; i<4; i++)
-            {
-                q->pitch_gain[i] = q->frame.plag[i] ? (q->frame.pgain[i] + 1) * 0.25 : 0.0;
-
-                q->pitch_lag[i] = q->frame.plag[i] + 16;
-            }
-        }else
-        {
-            float max_pitch_gain;
-
-            if (q->bitrate == I_F_Q)
-            {
-                  if (q->erasure_count < 3)
-                      max_pitch_gain = 0.9 - 0.3 * (q->erasure_count - 1);
-                  else
-                      max_pitch_gain = 0.0;
-            }else
-            {
-                assert(q->bitrate == SILENCE);
-                max_pitch_gain = 1.0;
-            }
-            for(i=0; i<4; i++)
-                q->pitch_gain[i] = FFMIN(q->pitch_gain[i], max_pitch_gain);
-
-            memset(q->frame.pfrac, 0, sizeof(q->frame.pfrac));
-        }
-
-        // pitch synthesis filter
-        v_synthesis_filtered = do_pitchfilter(q->pitch_synthesis_filter_mem,
-                                              cdn_vector, q->pitch_gain,
-                                              q->pitch_lag, q->frame.pfrac);
-
-        // pitch prefilter update
-        for(i=0; i<4; i++)
-            q->pitch_gain[i] = 0.5 * FFMIN(q->pitch_gain[i], 1.0);
-
-        v_pre_filtered = do_pitchfilter(q->pitch_pre_filter_mem,
-                                        v_synthesis_filtered,
-                                        q->pitch_gain, q->pitch_lag,
-                                        q->frame.pfrac);
-
-        apply_gain_ctrl(cdn_vector, v_synthesis_filtered, v_pre_filtered);
-    }else
-    {
-        memcpy(q->pitch_synthesis_filter_mem, cdn_vector + 17,
-               143 * sizeof(float));
-        memcpy(q->pitch_pre_filter_mem, cdn_vector + 17, 143 * sizeof(float));
-        memset(q->pitch_gain, 0, sizeof(q->pitch_gain));
-        memset(q->pitch_lag,  0, sizeof(q->pitch_lag));
-    }
-}
-
-/**
- * Reconstructs LPC coefficients from the line spectral pair frequencies
- * and performs bandwidth expansion.
- *
- * @param lspf line spectral pair frequencies
- * @param lpc linear predictive coding coefficients
- *
- * @note: bandwidth_expansion_coeff could be precalculated into a table
- *        but it seems to be slower on x86
- *
- * TIA/EIA/IS-733 2.4.3.3.5
- */
-static void lspf2lpc(const float *lspf, float *lpc)
-{
-    double lsp[10];
-    double bandwidth_expansion_coeff = QCELP_BANDWIDTH_EXPANSION_COEFF;
-    int   i;
-
-    for (i=0; i<10; i++)
-        lsp[i] = cos(M_PI * lspf[i]);
-
-    ff_acelp_lspd2lpc(lsp, lpc, 5);
-
-    for (i=0; i<10; i++)
-    {
-        lpc[i] *= bandwidth_expansion_coeff;
-        bandwidth_expansion_coeff *= QCELP_BANDWIDTH_EXPANSION_COEFF;
-    }
-}
-
-/**
- * Interpolates LSP frequencies and computes LPC coefficients
- * for a given bitrate & pitch subframe.
- *
- * TIA/EIA/IS-733 2.4.3.3.4, 2.4.8.7.2
- *
- * @param q the context
- * @param curr_lspf LSP frequencies vector of the current frame
- * @param lpc float vector for the resulting LPC
- * @param subframe_num frame number in decoded stream
- */
-static void interpolate_lpc(QCELPContext *q, const float *curr_lspf,
-                            float *lpc, const int subframe_num)
-{
-    float interpolated_lspf[10];
-    float weight;
-
-    if(q->bitrate >= RATE_QUARTER)
-        weight = 0.25 * (subframe_num + 1);
-    else if(q->bitrate == RATE_OCTAVE && !subframe_num)
-        weight = 0.625;
-    else
-        weight = 1.0;
-
-    if(weight != 1.0)
-    {
-        ff_weighted_vector_sumf(interpolated_lspf, curr_lspf, q->prev_lspf,
-                                weight, 1.0 - weight, 10);
-        lspf2lpc(interpolated_lspf, lpc);
-    }else if(q->bitrate >= RATE_QUARTER ||
-             (q->bitrate == I_F_Q && !subframe_num))
-        lspf2lpc(curr_lspf, lpc);
-    else if(q->bitrate == SILENCE && !subframe_num)
-        lspf2lpc(q->prev_lspf, lpc);
-}
-
-static qcelp_packet_rate buf_size2bitrate(const int buf_size)
-{
-    switch(buf_size)
-    {
-        case 35: return RATE_FULL;
-        case 17: return RATE_HALF;
-        case  8: return RATE_QUARTER;
-        case  4: return RATE_OCTAVE;
-        case  1: return SILENCE;
-    }
-
-    return I_F_Q;
-}
-
-/**
- * Determine the bitrate from the frame size and/or the first byte of the frame.
- *
- * @param avctx the AV codec context
- * @param buf_size length of the buffer
- * @param buf the bufffer
- *
- * @return the bitrate on success,
- *         I_F_Q  if the bitrate cannot be satisfactorily determined
- *
- * TIA/EIA/IS-733 2.4.8.7.1
- */
-static qcelp_packet_rate determine_bitrate(AVCodecContext *avctx, const int buf_size,
-                             const uint8_t **buf)
-{
-    qcelp_packet_rate bitrate;
-
-    if((bitrate = buf_size2bitrate(buf_size)) >= 0)
-    {
-        if(bitrate > **buf)
-        {
-            QCELPContext *q = avctx->priv_data;
-            if (!q->warned_buf_mismatch_bitrate)
-            {
-            av_log(avctx, AV_LOG_WARNING,
-                   "Claimed bitrate and buffer size mismatch.\n");
-                q->warned_buf_mismatch_bitrate = 1;
-            }
-            bitrate = **buf;
-        }else if(bitrate < **buf)
-        {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Buffer is too small for the claimed bitrate.\n");
-            return I_F_Q;
-        }
-        (*buf)++;
-    }else if((bitrate = buf_size2bitrate(buf_size + 1)) >= 0)
-    {
-        av_log(avctx, AV_LOG_WARNING,
-               "Bitrate byte is missing, guessing the bitrate from packet size.\n");
-    }else
-        return I_F_Q;
-
-    if(bitrate == SILENCE)
-    {
-        //FIXME: Remove experimental warning when tested with samples.
-        av_log_ask_for_sample(avctx, "'Blank frame handling is experimental.");
-    }
-    return bitrate;
-}
-
-static void warn_insufficient_frame_quality(AVCodecContext *avctx,
-                                            const char *message)
-{
-    av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n", avctx->frame_number,
-           message);
-}
-
-static void postfilter(QCELPContext *q, float *samples, float *lpc)
-{
-    static const float pow_0_775[10] = {
-        0.775000, 0.600625, 0.465484, 0.360750, 0.279582,
-        0.216676, 0.167924, 0.130141, 0.100859, 0.078166
-    }, pow_0_625[10] = {
-        0.625000, 0.390625, 0.244141, 0.152588, 0.095367,
-        0.059605, 0.037253, 0.023283, 0.014552, 0.009095
-    };
-    float lpc_s[10], lpc_p[10], pole_out[170], zero_out[160];
-    int n;
-
-    for (n = 0; n < 10; n++) {
-        lpc_s[n] = lpc[n] * pow_0_625[n];
-        lpc_p[n] = lpc[n] * pow_0_775[n];
-    }
-
-    ff_celp_lp_zero_synthesis_filterf(zero_out, lpc_s,
-                                      q->formant_mem + 10, 160, 10);
-    memcpy(pole_out, q->postfilter_synth_mem,       sizeof(float) * 10);
-    ff_celp_lp_synthesis_filterf(pole_out + 10, lpc_p, zero_out, 160, 10);
-    memcpy(q->postfilter_synth_mem, pole_out + 160, sizeof(float) * 10);
-
-    ff_tilt_compensation(&q->postfilter_tilt_mem, 0.3, pole_out + 10, 160);
-
-    ff_adaptive_gain_control(samples, pole_out + 10,
-        ff_dot_productf(q->formant_mem + 10, q->formant_mem + 10, 160),
-        160, 0.9375, &q->postfilter_agc_mem);
-}
-
-static int qcelp_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    QCELPContext *q = avctx->priv_data;
-    float *outbuffer = data;
-    int   i;
-    float quantized_lspf[10], lpc[10];
-    float gain[16];
-    float *formant_mem;
-
-    if((q->bitrate = determine_bitrate(avctx, buf_size, &buf)) == I_F_Q)
-    {
-        warn_insufficient_frame_quality(avctx, "bitrate cannot be determined.");
-        goto erasure;
-    }
-
-    if(q->bitrate == RATE_OCTAVE &&
-       (q->first16bits = AV_RB16(buf)) == 0xFFFF)
-    {
-        warn_insufficient_frame_quality(avctx, "Bitrate is 1/8 and first 16 bits are on.");
-        goto erasure;
-    }
-
-    if(q->bitrate > SILENCE)
-    {
-        const QCELPBitmap *bitmaps     = qcelp_unpacking_bitmaps_per_rate[q->bitrate];
-        const QCELPBitmap *bitmaps_end = qcelp_unpacking_bitmaps_per_rate[q->bitrate]
-                                       + qcelp_unpacking_bitmaps_lengths[q->bitrate];
-        uint8_t           *unpacked_data = (uint8_t *)&q->frame;
-
-        init_get_bits(&q->gb, buf, 8*buf_size);
-
-        memset(&q->frame, 0, sizeof(QCELPFrame));
-
-        for(; bitmaps < bitmaps_end; bitmaps++)
-            unpacked_data[bitmaps->index] |= get_bits(&q->gb, bitmaps->bitlen) << bitmaps->bitpos;
-
-        // Check for erasures/blanks on rates 1, 1/4 and 1/8.
-        if(q->frame.reserved)
-        {
-            warn_insufficient_frame_quality(avctx, "Wrong data in reserved frame area.");
-            goto erasure;
-        }
-        if(q->bitrate == RATE_QUARTER &&
-           codebook_sanity_check_for_rate_quarter(q->frame.cbgain))
-        {
-            warn_insufficient_frame_quality(avctx, "Codebook gain sanity check failed.");
-            goto erasure;
-        }
-
-        if(q->bitrate >= RATE_HALF)
-        {
-            for(i=0; i<4; i++)
-            {
-                if(q->frame.pfrac[i] && q->frame.plag[i] >= 124)
-                {
-                    warn_insufficient_frame_quality(avctx, "Cannot initialize pitch filter.");
-                    goto erasure;
-                }
-            }
-        }
-    }
-
-    decode_gain_and_index(q, gain);
-    compute_svector(q, gain, outbuffer);
-
-    if(decode_lspf(q, quantized_lspf) < 0)
-    {
-        warn_insufficient_frame_quality(avctx, "Badly received packets in frame.");
-        goto erasure;
-    }
-
-
-    apply_pitch_filters(q, outbuffer);
-
-    if(q->bitrate == I_F_Q)
-    {
-erasure:
-        q->bitrate = I_F_Q;
-        q->erasure_count++;
-        decode_gain_and_index(q, gain);
-        compute_svector(q, gain, outbuffer);
-        decode_lspf(q, quantized_lspf);
-        apply_pitch_filters(q, outbuffer);
-    }else
-        q->erasure_count = 0;
-
-    formant_mem = q->formant_mem + 10;
-    for(i=0; i<4; i++)
-    {
-        interpolate_lpc(q, quantized_lspf, lpc, i);
-        ff_celp_lp_synthesis_filterf(formant_mem, lpc, outbuffer + i * 40, 40,
-                                     10);
-        formant_mem += 40;
-    }
-
-    // postfilter, as per TIA/EIA/IS-733 2.4.8.6
-    postfilter(q, outbuffer, lpc);
-
-    memcpy(q->formant_mem, q->formant_mem + 160, 10 * sizeof(float));
-
-    memcpy(q->prev_lspf, quantized_lspf, sizeof(q->prev_lspf));
-    q->prev_bitrate = q->bitrate;
-
-    *data_size = 160 * sizeof(*outbuffer);
-
-    return *data_size;
-}
-
-AVCodec qcelp_decoder =
-{
-    .name   = "qcelp",
-    .type   = AVMEDIA_TYPE_AUDIO,
-    .id     = CODEC_ID_QCELP,
-    .init   = qcelp_decode_init,
-    .decode = qcelp_decode_frame,
-    .priv_data_size = sizeof(QCELPContext),
-    .long_name = NULL_IF_CONFIG_SMALL("QCELP / PureVoice"),
-};
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
deleted file mode 100644
index 6451fbe..0000000
--- a/libavcodec/qdm2.c
+++ /dev/null
@@ -1,1984 +0,0 @@
-/*
- * QDM2 compatible decoder
- * Copyright (c) 2003 Ewald Snel
- * Copyright (c) 2005 Benjamin Larsson
- * Copyright (c) 2005 Alex Beregszaszi
- * Copyright (c) 2005 Roberto Togni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QDM2 decoder
- * @author Ewald Snel, Benjamin Larsson, Alex Beregszaszi, Roberto Togni
- * The decoder is not perfect yet, there are still some distortions
- * especially on files encoded with 16 or 8 subbands.
- */
-
-#include <math.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-#include "mpegaudio.h"
-
-#include "qdm2data.h"
-#include "qdm2_tablegen.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-#define QDM2_LIST_ADD(list, size, packet) \
-do { \
-      if (size > 0) { \
-    list[size - 1].next = &list[size]; \
-      } \
-      list[size].packet = packet; \
-      list[size].next = NULL; \
-      size++; \
-} while(0)
-
-// Result is 8, 16 or 30
-#define QDM2_SB_USED(sub_sampling) (((sub_sampling) >= 2) ? 30 : 8 << (sub_sampling))
-
-#define FIX_NOISE_IDX(noise_idx) \
-  if ((noise_idx) >= 3840) \
-    (noise_idx) -= 3840; \
-
-#define SB_DITHERING_NOISE(sb,noise_idx) (noise_table[(noise_idx)++] * sb_noise_attenuation[(sb)])
-
-#define BITS_LEFT(length,gb) ((length) - get_bits_count ((gb)))
-
-#define SAMPLES_NEEDED \
-     av_log (NULL,AV_LOG_INFO,"This file triggers some untested code. Please contact the developers.\n");
-
-#define SAMPLES_NEEDED_2(why) \
-     av_log (NULL,AV_LOG_INFO,"This file triggers some missing code. Please contact the developers.\nPosition: %s\n",why);
-
-
-typedef int8_t sb_int8_array[2][30][64];
-
-/**
- * Subpacket
- */
-typedef struct {
-    int type;            ///< subpacket type
-    unsigned int size;   ///< subpacket size
-    const uint8_t *data; ///< pointer to subpacket data (points to input data buffer, it's not a private copy)
-} QDM2SubPacket;
-
-/**
- * A node in the subpacket list
- */
-typedef struct QDM2SubPNode {
-    QDM2SubPacket *packet;      ///< packet
-    struct QDM2SubPNode *next; ///< pointer to next packet in the list, NULL if leaf node
-} QDM2SubPNode;
-
-typedef struct {
-    float re;
-    float im;
-} QDM2Complex;
-
-typedef struct {
-    float level;
-    QDM2Complex *complex;
-    const float *table;
-    int   phase;
-    int   phase_shift;
-    int   duration;
-    short time_index;
-    short cutoff;
-} FFTTone;
-
-typedef struct {
-    int16_t sub_packet;
-    uint8_t channel;
-    int16_t offset;
-    int16_t exp;
-    uint8_t phase;
-} FFTCoefficient;
-
-typedef struct {
-    DECLARE_ALIGNED(16, QDM2Complex, complex)[MPA_MAX_CHANNELS][256];
-} QDM2FFT;
-
-/**
- * QDM2 decoder context
- */
-typedef struct {
-    /// Parameters from codec header, do not change during playback
-    int nb_channels;         ///< number of channels
-    int channels;            ///< number of channels
-    int group_size;          ///< size of frame group (16 frames per group)
-    int fft_size;            ///< size of FFT, in complex numbers
-    int checksum_size;       ///< size of data block, used also for checksum
-
-    /// Parameters built from header parameters, do not change during playback
-    int group_order;         ///< order of frame group
-    int fft_order;           ///< order of FFT (actually fftorder+1)
-    int fft_frame_size;      ///< size of fft frame, in components (1 comples = re + im)
-    int frame_size;          ///< size of data frame
-    int frequency_range;
-    int sub_sampling;        ///< subsampling: 0=25%, 1=50%, 2=100% */
-    int coeff_per_sb_select; ///< selector for "num. of coeffs. per subband" tables. Can be 0, 1, 2
-    int cm_table_select;     ///< selector for "coding method" tables. Can be 0, 1 (from init: 0-4)
-
-    /// Packets and packet lists
-    QDM2SubPacket sub_packets[16];      ///< the packets themselves
-    QDM2SubPNode sub_packet_list_A[16]; ///< list of all packets
-    QDM2SubPNode sub_packet_list_B[16]; ///< FFT packets B are on list
-    int sub_packets_B;                  ///< number of packets on 'B' list
-    QDM2SubPNode sub_packet_list_C[16]; ///< packets with errors?
-    QDM2SubPNode sub_packet_list_D[16]; ///< DCT packets
-
-    /// FFT and tones
-    FFTTone fft_tones[1000];
-    int fft_tone_start;
-    int fft_tone_end;
-    FFTCoefficient fft_coefs[1000];
-    int fft_coefs_index;
-    int fft_coefs_min_index[5];
-    int fft_coefs_max_index[5];
-    int fft_level_exp[6];
-    RDFTContext rdft_ctx;
-    QDM2FFT fft;
-
-    /// I/O data
-    const uint8_t *compressed_data;
-    int compressed_size;
-    float output_buffer[1024];
-
-    /// Synthesis filter
-    DECLARE_ALIGNED(16, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512*2];
-    int synth_buf_offset[MPA_MAX_CHANNELS];
-    DECLARE_ALIGNED(16, int32_t, sb_samples)[MPA_MAX_CHANNELS][128][SBLIMIT];
-
-    /// Mixed temporary data used in decoding
-    float tone_level[MPA_MAX_CHANNELS][30][64];
-    int8_t coding_method[MPA_MAX_CHANNELS][30][64];
-    int8_t quantized_coeffs[MPA_MAX_CHANNELS][10][8];
-    int8_t tone_level_idx_base[MPA_MAX_CHANNELS][30][8];
-    int8_t tone_level_idx_hi1[MPA_MAX_CHANNELS][3][8][8];
-    int8_t tone_level_idx_mid[MPA_MAX_CHANNELS][26][8];
-    int8_t tone_level_idx_hi2[MPA_MAX_CHANNELS][26];
-    int8_t tone_level_idx[MPA_MAX_CHANNELS][30][64];
-    int8_t tone_level_idx_temp[MPA_MAX_CHANNELS][30][64];
-
-    // Flags
-    int has_errors;         ///< packet has errors
-    int superblocktype_2_3; ///< select fft tables and some algorithm based on superblock type
-    int do_synth_filter;    ///< used to perform or skip synthesis filter
-
-    int sub_packet;
-    int noise_idx; ///< index for dithering noise table
-} QDM2Context;
-
-
-static uint8_t empty_buffer[FF_INPUT_BUFFER_PADDING_SIZE];
-
-static VLC vlc_tab_level;
-static VLC vlc_tab_diff;
-static VLC vlc_tab_run;
-static VLC fft_level_exp_alt_vlc;
-static VLC fft_level_exp_vlc;
-static VLC fft_stereo_exp_vlc;
-static VLC fft_stereo_phase_vlc;
-static VLC vlc_tab_tone_level_idx_hi1;
-static VLC vlc_tab_tone_level_idx_mid;
-static VLC vlc_tab_tone_level_idx_hi2;
-static VLC vlc_tab_type30;
-static VLC vlc_tab_type34;
-static VLC vlc_tab_fft_tone_offset[5];
-
-static const uint16_t qdm2_vlc_offs[] = {
-    0,260,566,598,894,1166,1230,1294,1678,1950,2214,2278,2310,2570,2834,3124,3448,3838,
-};
-
-static av_cold void qdm2_init_vlc(void)
-{
-    static int vlcs_initialized = 0;
-    static VLC_TYPE qdm2_table[3838][2];
-
-    if (!vlcs_initialized) {
-
-        vlc_tab_level.table = &qdm2_table[qdm2_vlc_offs[0]];
-        vlc_tab_level.table_allocated = qdm2_vlc_offs[1] - qdm2_vlc_offs[0];
-        init_vlc (&vlc_tab_level, 8, 24,
-            vlc_tab_level_huffbits, 1, 1,
-            vlc_tab_level_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_diff.table = &qdm2_table[qdm2_vlc_offs[1]];
-        vlc_tab_diff.table_allocated = qdm2_vlc_offs[2] - qdm2_vlc_offs[1];
-        init_vlc (&vlc_tab_diff, 8, 37,
-            vlc_tab_diff_huffbits, 1, 1,
-            vlc_tab_diff_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_run.table = &qdm2_table[qdm2_vlc_offs[2]];
-        vlc_tab_run.table_allocated = qdm2_vlc_offs[3] - qdm2_vlc_offs[2];
-        init_vlc (&vlc_tab_run, 5, 6,
-            vlc_tab_run_huffbits, 1, 1,
-            vlc_tab_run_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        fft_level_exp_alt_vlc.table = &qdm2_table[qdm2_vlc_offs[3]];
-        fft_level_exp_alt_vlc.table_allocated = qdm2_vlc_offs[4] - qdm2_vlc_offs[3];
-        init_vlc (&fft_level_exp_alt_vlc, 8, 28,
-            fft_level_exp_alt_huffbits, 1, 1,
-            fft_level_exp_alt_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-
-        fft_level_exp_vlc.table = &qdm2_table[qdm2_vlc_offs[4]];
-        fft_level_exp_vlc.table_allocated = qdm2_vlc_offs[5] - qdm2_vlc_offs[4];
-        init_vlc (&fft_level_exp_vlc, 8, 20,
-            fft_level_exp_huffbits, 1, 1,
-            fft_level_exp_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        fft_stereo_exp_vlc.table = &qdm2_table[qdm2_vlc_offs[5]];
-        fft_stereo_exp_vlc.table_allocated = qdm2_vlc_offs[6] - qdm2_vlc_offs[5];
-        init_vlc (&fft_stereo_exp_vlc, 6, 7,
-            fft_stereo_exp_huffbits, 1, 1,
-            fft_stereo_exp_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        fft_stereo_phase_vlc.table = &qdm2_table[qdm2_vlc_offs[6]];
-        fft_stereo_phase_vlc.table_allocated = qdm2_vlc_offs[7] - qdm2_vlc_offs[6];
-        init_vlc (&fft_stereo_phase_vlc, 6, 9,
-            fft_stereo_phase_huffbits, 1, 1,
-            fft_stereo_phase_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_tone_level_idx_hi1.table = &qdm2_table[qdm2_vlc_offs[7]];
-        vlc_tab_tone_level_idx_hi1.table_allocated = qdm2_vlc_offs[8] - qdm2_vlc_offs[7];
-        init_vlc (&vlc_tab_tone_level_idx_hi1, 8, 20,
-            vlc_tab_tone_level_idx_hi1_huffbits, 1, 1,
-            vlc_tab_tone_level_idx_hi1_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_tone_level_idx_mid.table = &qdm2_table[qdm2_vlc_offs[8]];
-        vlc_tab_tone_level_idx_mid.table_allocated = qdm2_vlc_offs[9] - qdm2_vlc_offs[8];
-        init_vlc (&vlc_tab_tone_level_idx_mid, 8, 24,
-            vlc_tab_tone_level_idx_mid_huffbits, 1, 1,
-            vlc_tab_tone_level_idx_mid_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_tone_level_idx_hi2.table = &qdm2_table[qdm2_vlc_offs[9]];
-        vlc_tab_tone_level_idx_hi2.table_allocated = qdm2_vlc_offs[10] - qdm2_vlc_offs[9];
-        init_vlc (&vlc_tab_tone_level_idx_hi2, 8, 24,
-            vlc_tab_tone_level_idx_hi2_huffbits, 1, 1,
-            vlc_tab_tone_level_idx_hi2_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_type30.table = &qdm2_table[qdm2_vlc_offs[10]];
-        vlc_tab_type30.table_allocated = qdm2_vlc_offs[11] - qdm2_vlc_offs[10];
-        init_vlc (&vlc_tab_type30, 6, 9,
-            vlc_tab_type30_huffbits, 1, 1,
-            vlc_tab_type30_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_type34.table = &qdm2_table[qdm2_vlc_offs[11]];
-        vlc_tab_type34.table_allocated = qdm2_vlc_offs[12] - qdm2_vlc_offs[11];
-        init_vlc (&vlc_tab_type34, 5, 10,
-            vlc_tab_type34_huffbits, 1, 1,
-            vlc_tab_type34_huffcodes, 1, 1, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_fft_tone_offset[0].table = &qdm2_table[qdm2_vlc_offs[12]];
-        vlc_tab_fft_tone_offset[0].table_allocated = qdm2_vlc_offs[13] - qdm2_vlc_offs[12];
-        init_vlc (&vlc_tab_fft_tone_offset[0], 8, 23,
-            vlc_tab_fft_tone_offset_0_huffbits, 1, 1,
-            vlc_tab_fft_tone_offset_0_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_fft_tone_offset[1].table = &qdm2_table[qdm2_vlc_offs[13]];
-        vlc_tab_fft_tone_offset[1].table_allocated = qdm2_vlc_offs[14] - qdm2_vlc_offs[13];
-        init_vlc (&vlc_tab_fft_tone_offset[1], 8, 28,
-            vlc_tab_fft_tone_offset_1_huffbits, 1, 1,
-            vlc_tab_fft_tone_offset_1_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_fft_tone_offset[2].table = &qdm2_table[qdm2_vlc_offs[14]];
-        vlc_tab_fft_tone_offset[2].table_allocated = qdm2_vlc_offs[15] - qdm2_vlc_offs[14];
-        init_vlc (&vlc_tab_fft_tone_offset[2], 8, 32,
-            vlc_tab_fft_tone_offset_2_huffbits, 1, 1,
-            vlc_tab_fft_tone_offset_2_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_fft_tone_offset[3].table = &qdm2_table[qdm2_vlc_offs[15]];
-        vlc_tab_fft_tone_offset[3].table_allocated = qdm2_vlc_offs[16] - qdm2_vlc_offs[15];
-        init_vlc (&vlc_tab_fft_tone_offset[3], 8, 35,
-            vlc_tab_fft_tone_offset_3_huffbits, 1, 1,
-            vlc_tab_fft_tone_offset_3_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlc_tab_fft_tone_offset[4].table = &qdm2_table[qdm2_vlc_offs[16]];
-        vlc_tab_fft_tone_offset[4].table_allocated = qdm2_vlc_offs[17] - qdm2_vlc_offs[16];
-        init_vlc (&vlc_tab_fft_tone_offset[4], 8, 38,
-            vlc_tab_fft_tone_offset_4_huffbits, 1, 1,
-            vlc_tab_fft_tone_offset_4_huffcodes, 2, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-
-        vlcs_initialized=1;
-    }
-}
-
-
-/* for floating point to fixed point conversion */
-static const float f2i_scale = (float) (1 << (FRAC_BITS - 15));
-
-
-static int qdm2_get_vlc (GetBitContext *gb, VLC *vlc, int flag, int depth)
-{
-    int value;
-
-    value = get_vlc2(gb, vlc->table, vlc->bits, depth);
-
-    /* stage-2, 3 bits exponent escape sequence */
-    if (value-- == 0)
-        value = get_bits (gb, get_bits (gb, 3) + 1);
-
-    /* stage-3, optional */
-    if (flag) {
-        int tmp = vlc_stage3_values[value];
-
-        if ((value & ~3) > 0)
-            tmp += get_bits (gb, (value >> 2));
-        value = tmp;
-    }
-
-    return value;
-}
-
-
-static int qdm2_get_se_vlc (VLC *vlc, GetBitContext *gb, int depth)
-{
-    int value = qdm2_get_vlc (gb, vlc, 0, depth);
-
-    return (value & 1) ? ((value + 1) >> 1) : -(value >> 1);
-}
-
-
-/**
- * QDM2 checksum
- *
- * @param data      pointer to data to be checksum'ed
- * @param length    data length
- * @param value     checksum value
- *
- * @return          0 if checksum is OK
- */
-static uint16_t qdm2_packet_checksum (const uint8_t *data, int length, int value) {
-    int i;
-
-    for (i=0; i < length; i++)
-        value -= data[i];
-
-    return (uint16_t)(value & 0xffff);
-}
-
-
-/**
- * Fills a QDM2SubPacket structure with packet type, size, and data pointer.
- *
- * @param gb            bitreader context
- * @param sub_packet    packet under analysis
- */
-static void qdm2_decode_sub_packet_header (GetBitContext *gb, QDM2SubPacket *sub_packet)
-{
-    sub_packet->type = get_bits (gb, 8);
-
-    if (sub_packet->type == 0) {
-        sub_packet->size = 0;
-        sub_packet->data = NULL;
-    } else {
-        sub_packet->size = get_bits (gb, 8);
-
-      if (sub_packet->type & 0x80) {
-          sub_packet->size <<= 8;
-          sub_packet->size  |= get_bits (gb, 8);
-          sub_packet->type  &= 0x7f;
-      }
-
-      if (sub_packet->type == 0x7f)
-          sub_packet->type |= (get_bits (gb, 8) << 8);
-
-      sub_packet->data = &gb->buffer[get_bits_count(gb) / 8]; // FIXME: this depends on bitreader internal data
-    }
-
-    av_log(NULL,AV_LOG_DEBUG,"Subpacket: type=%d size=%d start_offs=%x\n",
-        sub_packet->type, sub_packet->size, get_bits_count(gb) / 8);
-}
-
-
-/**
- * Return node pointer to first packet of requested type in list.
- *
- * @param list    list of subpackets to be scanned
- * @param type    type of searched subpacket
- * @return        node pointer for subpacket if found, else NULL
- */
-static QDM2SubPNode* qdm2_search_subpacket_type_in_list (QDM2SubPNode *list, int type)
-{
-    while (list != NULL && list->packet != NULL) {
-        if (list->packet->type == type)
-            return list;
-        list = list->next;
-    }
-    return NULL;
-}
-
-
-/**
- * Replaces 8 elements with their average value.
- * Called by qdm2_decode_superblock before starting subblock decoding.
- *
- * @param q       context
- */
-static void average_quantized_coeffs (QDM2Context *q)
-{
-    int i, j, n, ch, sum;
-
-    n = coeff_per_sb_for_avg[q->coeff_per_sb_select][QDM2_SB_USED(q->sub_sampling) - 1] + 1;
-
-    for (ch = 0; ch < q->nb_channels; ch++)
-        for (i = 0; i < n; i++) {
-            sum = 0;
-
-            for (j = 0; j < 8; j++)
-                sum += q->quantized_coeffs[ch][i][j];
-
-            sum /= 8;
-            if (sum > 0)
-                sum--;
-
-            for (j=0; j < 8; j++)
-                q->quantized_coeffs[ch][i][j] = sum;
-        }
-}
-
-
-/**
- * Build subband samples with noise weighted by q->tone_level.
- * Called by synthfilt_build_sb_samples.
- *
- * @param q     context
- * @param sb    subband index
- */
-static void build_sb_samples_from_noise (QDM2Context *q, int sb)
-{
-    int ch, j;
-
-    FIX_NOISE_IDX(q->noise_idx);
-
-    if (!q->nb_channels)
-        return;
-
-    for (ch = 0; ch < q->nb_channels; ch++)
-        for (j = 0; j < 64; j++) {
-            q->sb_samples[ch][j * 2][sb] = (int32_t)(f2i_scale * SB_DITHERING_NOISE(sb,q->noise_idx) * q->tone_level[ch][sb][j] + .5);
-            q->sb_samples[ch][j * 2 + 1][sb] = (int32_t)(f2i_scale * SB_DITHERING_NOISE(sb,q->noise_idx) * q->tone_level[ch][sb][j] + .5);
-        }
-}
-
-
-/**
- * Called while processing data from subpackets 11 and 12.
- * Used after making changes to coding_method array.
- *
- * @param sb               subband index
- * @param channels         number of channels
- * @param coding_method    q->coding_method[0][0][0]
- */
-static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
-{
-    int j,k;
-    int ch;
-    int run, case_val;
-    int switchtable[23] = {0,5,1,5,5,5,5,5,2,5,5,5,5,5,5,5,3,5,5,5,5,5,4};
-
-    for (ch = 0; ch < channels; ch++) {
-        for (j = 0; j < 64; ) {
-            if((coding_method[ch][sb][j] - 8) > 22) {
-                run = 1;
-                case_val = 8;
-            } else {
-                switch (switchtable[coding_method[ch][sb][j]-8]) {
-                    case 0: run = 10; case_val = 10; break;
-                    case 1: run = 1; case_val = 16; break;
-                    case 2: run = 5; case_val = 24; break;
-                    case 3: run = 3; case_val = 30; break;
-                    case 4: run = 1; case_val = 30; break;
-                    case 5: run = 1; case_val = 8; break;
-                    default: run = 1; case_val = 8; break;
-                }
-            }
-            for (k = 0; k < run; k++)
-                if (j + k < 128)
-                    if (coding_method[ch][sb + (j + k) / 64][(j + k) % 64] > coding_method[ch][sb][j])
-                        if (k > 0) {
-                           SAMPLES_NEEDED
-                            //not debugged, almost never used
-                            memset(&coding_method[ch][sb][j + k], case_val, k * sizeof(int8_t));
-                            memset(&coding_method[ch][sb][j + k], case_val, 3 * sizeof(int8_t));
-                        }
-            j += run;
-        }
-    }
-}
-
-
-/**
- * Related to synthesis filter
- * Called by process_subpacket_10
- *
- * @param q       context
- * @param flag    1 if called after getting data from subpacket 10, 0 if no subpacket 10
- */
-static void fill_tone_level_array (QDM2Context *q, int flag)
-{
-    int i, sb, ch, sb_used;
-    int tmp, tab;
-
-    // This should never happen
-    if (q->nb_channels <= 0)
-        return;
-
-    for (ch = 0; ch < q->nb_channels; ch++)
-        for (sb = 0; sb < 30; sb++)
-            for (i = 0; i < 8; i++) {
-                if ((tab=coeff_per_sb_for_dequant[q->coeff_per_sb_select][sb]) < (last_coeff[q->coeff_per_sb_select] - 1))
-                    tmp = q->quantized_coeffs[ch][tab + 1][i] * dequant_table[q->coeff_per_sb_select][tab + 1][sb]+
-                          q->quantized_coeffs[ch][tab][i] * dequant_table[q->coeff_per_sb_select][tab][sb];
-                else
-                    tmp = q->quantized_coeffs[ch][tab][i] * dequant_table[q->coeff_per_sb_select][tab][sb];
-                if(tmp < 0)
-                    tmp += 0xff;
-                q->tone_level_idx_base[ch][sb][i] = (tmp / 256) & 0xff;
-            }
-
-    sb_used = QDM2_SB_USED(q->sub_sampling);
-
-    if ((q->superblocktype_2_3 != 0) && !flag) {
-        for (sb = 0; sb < sb_used; sb++)
-            for (ch = 0; ch < q->nb_channels; ch++)
-                for (i = 0; i < 64; i++) {
-                    q->tone_level_idx[ch][sb][i] = q->tone_level_idx_base[ch][sb][i / 8];
-                    if (q->tone_level_idx[ch][sb][i] < 0)
-                        q->tone_level[ch][sb][i] = 0;
-                    else
-                        q->tone_level[ch][sb][i] = fft_tone_level_table[0][q->tone_level_idx[ch][sb][i] & 0x3f];
-                }
-    } else {
-        tab = q->superblocktype_2_3 ? 0 : 1;
-        for (sb = 0; sb < sb_used; sb++) {
-            if ((sb >= 4) && (sb <= 23)) {
-                for (ch = 0; ch < q->nb_channels; ch++)
-                    for (i = 0; i < 64; i++) {
-                        tmp = q->tone_level_idx_base[ch][sb][i / 8] -
-                              q->tone_level_idx_hi1[ch][sb / 8][i / 8][i % 8] -
-                              q->tone_level_idx_mid[ch][sb - 4][i / 8] -
-                              q->tone_level_idx_hi2[ch][sb - 4];
-                        q->tone_level_idx[ch][sb][i] = tmp & 0xff;
-                        if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp))
-                            q->tone_level[ch][sb][i] = 0;
-                        else
-                            q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f];
-                }
-            } else {
-                if (sb > 4) {
-                    for (ch = 0; ch < q->nb_channels; ch++)
-                        for (i = 0; i < 64; i++) {
-                            tmp = q->tone_level_idx_base[ch][sb][i / 8] -
-                                  q->tone_level_idx_hi1[ch][2][i / 8][i % 8] -
-                                  q->tone_level_idx_hi2[ch][sb - 4];
-                            q->tone_level_idx[ch][sb][i] = tmp & 0xff;
-                            if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp))
-                                q->tone_level[ch][sb][i] = 0;
-                            else
-                                q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f];
-                    }
-                } else {
-                    for (ch = 0; ch < q->nb_channels; ch++)
-                        for (i = 0; i < 64; i++) {
-                            tmp = q->tone_level_idx[ch][sb][i] = q->tone_level_idx_base[ch][sb][i / 8];
-                            if ((tmp < 0) || (!q->superblocktype_2_3 && !tmp))
-                                q->tone_level[ch][sb][i] = 0;
-                            else
-                                q->tone_level[ch][sb][i] = fft_tone_level_table[tab][tmp & 0x3f];
-                        }
-                }
-            }
-        }
-    }
-
-    return;
-}
-
-
-/**
- * Related to synthesis filter
- * Called by process_subpacket_11
- * c is built with data from subpacket 11
- * Most of this function is used only if superblock_type_2_3 == 0, never seen it in samples
- *
- * @param tone_level_idx
- * @param tone_level_idx_temp
- * @param coding_method        q->coding_method[0][0][0]
- * @param nb_channels          number of channels
- * @param c                    coming from subpacket 11, passed as 8*c
- * @param superblocktype_2_3   flag based on superblock packet type
- * @param cm_table_select      q->cm_table_select
- */
-static void fill_coding_method_array (sb_int8_array tone_level_idx, sb_int8_array tone_level_idx_temp,
-                sb_int8_array coding_method, int nb_channels,
-                int c, int superblocktype_2_3, int cm_table_select)
-{
-    int ch, sb, j;
-    int tmp, acc, esp_40, comp;
-    int add1, add2, add3, add4;
-    int64_t multres;
-
-    // This should never happen
-    if (nb_channels <= 0)
-        return;
-
-    if (!superblocktype_2_3) {
-        /* This case is untested, no samples available */
-        SAMPLES_NEEDED
-        for (ch = 0; ch < nb_channels; ch++)
-            for (sb = 0; sb < 30; sb++) {
-                for (j = 1; j < 63; j++) {  // The loop only iterates to 63 so the code doesn't overflow the buffer
-                    add1 = tone_level_idx[ch][sb][j] - 10;
-                    if (add1 < 0)
-                        add1 = 0;
-                    add2 = add3 = add4 = 0;
-                    if (sb > 1) {
-                        add2 = tone_level_idx[ch][sb - 2][j] + tone_level_idx_offset_table[sb][0] - 6;
-                        if (add2 < 0)
-                            add2 = 0;
-                    }
-                    if (sb > 0) {
-                        add3 = tone_level_idx[ch][sb - 1][j] + tone_level_idx_offset_table[sb][1] - 6;
-                        if (add3 < 0)
-                            add3 = 0;
-                    }
-                    if (sb < 29) {
-                        add4 = tone_level_idx[ch][sb + 1][j] + tone_level_idx_offset_table[sb][3] - 6;
-                        if (add4 < 0)
-                            add4 = 0;
-                    }
-                    tmp = tone_level_idx[ch][sb][j + 1] * 2 - add4 - add3 - add2 - add1;
-                    if (tmp < 0)
-                        tmp = 0;
-                    tone_level_idx_temp[ch][sb][j + 1] = tmp & 0xff;
-                }
-                tone_level_idx_temp[ch][sb][0] = tone_level_idx_temp[ch][sb][1];
-            }
-            acc = 0;
-            for (ch = 0; ch < nb_channels; ch++)
-                for (sb = 0; sb < 30; sb++)
-                    for (j = 0; j < 64; j++)
-                        acc += tone_level_idx_temp[ch][sb][j];
-
-            multres = 0x66666667 * (acc * 10);
-            esp_40 = (multres >> 32) / 8 + ((multres & 0xffffffff) >> 31);
-            for (ch = 0;  ch < nb_channels; ch++)
-                for (sb = 0; sb < 30; sb++)
-                    for (j = 0; j < 64; j++) {
-                        comp = tone_level_idx_temp[ch][sb][j]* esp_40 * 10;
-                        if (comp < 0)
-                            comp += 0xff;
-                        comp /= 256; // signed shift
-                        switch(sb) {
-                            case 0:
-                                if (comp < 30)
-                                    comp = 30;
-                                comp += 15;
-                                break;
-                            case 1:
-                                if (comp < 24)
-                                    comp = 24;
-                                comp += 10;
-                                break;
-                            case 2:
-                            case 3:
-                            case 4:
-                                if (comp < 16)
-                                    comp = 16;
-                        }
-                        if (comp <= 5)
-                            tmp = 0;
-                        else if (comp <= 10)
-                            tmp = 10;
-                        else if (comp <= 16)
-                            tmp = 16;
-                        else if (comp <= 24)
-                            tmp = -1;
-                        else
-                            tmp = 0;
-                        coding_method[ch][sb][j] = ((tmp & 0xfffa) + 30 )& 0xff;
-                    }
-            for (sb = 0; sb < 30; sb++)
-                fix_coding_method_array(sb, nb_channels, coding_method);
-            for (ch = 0; ch < nb_channels; ch++)
-                for (sb = 0; sb < 30; sb++)
-                    for (j = 0; j < 64; j++)
-                        if (sb >= 10) {
-                            if (coding_method[ch][sb][j] < 10)
-                                coding_method[ch][sb][j] = 10;
-                        } else {
-                            if (sb >= 2) {
-                                if (coding_method[ch][sb][j] < 16)
-                                    coding_method[ch][sb][j] = 16;
-                            } else {
-                                if (coding_method[ch][sb][j] < 30)
-                                    coding_method[ch][sb][j] = 30;
-                            }
-                        }
-    } else { // superblocktype_2_3 != 0
-        for (ch = 0; ch < nb_channels; ch++)
-            for (sb = 0; sb < 30; sb++)
-                for (j = 0; j < 64; j++)
-                    coding_method[ch][sb][j] = coding_method_table[cm_table_select][sb];
-    }
-
-    return;
-}
-
-
-/**
- *
- * Called by process_subpacket_11 to process more data from subpacket 11 with sb 0-8
- * Called by process_subpacket_12 to process data from subpacket 12 with sb 8-sb_used
- *
- * @param q         context
- * @param gb        bitreader context
- * @param length    packet length in bits
- * @param sb_min    lower subband processed (sb_min included)
- * @param sb_max    higher subband processed (sb_max excluded)
- */
-static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max)
-{
-    int sb, j, k, n, ch, run, channels;
-    int joined_stereo, zero_encoding, chs;
-    int type34_first;
-    float type34_div = 0;
-    float type34_predictor;
-    float samples[10], sign_bits[16];
-
-    if (length == 0) {
-        // If no data use noise
-        for (sb=sb_min; sb < sb_max; sb++)
-            build_sb_samples_from_noise (q, sb);
-
-        return;
-    }
-
-    for (sb = sb_min; sb < sb_max; sb++) {
-        FIX_NOISE_IDX(q->noise_idx);
-
-        channels = q->nb_channels;
-
-        if (q->nb_channels <= 1 || sb < 12)
-            joined_stereo = 0;
-        else if (sb >= 24)
-            joined_stereo = 1;
-        else
-            joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0;
-
-        if (joined_stereo) {
-            if (BITS_LEFT(length,gb) >= 16)
-                for (j = 0; j < 16; j++)
-                    sign_bits[j] = get_bits1 (gb);
-
-            for (j = 0; j < 64; j++)
-                if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j])
-                    q->coding_method[0][sb][j] = q->coding_method[1][sb][j];
-
-            fix_coding_method_array(sb, q->nb_channels, q->coding_method);
-            channels = 1;
-        }
-
-        for (ch = 0; ch < channels; ch++) {
-            zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0;
-            type34_predictor = 0.0;
-            type34_first = 1;
-
-            for (j = 0; j < 128; ) {
-                switch (q->coding_method[ch][sb][j / 2]) {
-                    case 8:
-                        if (BITS_LEFT(length,gb) >= 10) {
-                            if (zero_encoding) {
-                                for (k = 0; k < 5; k++) {
-                                    if ((j + 2 * k) >= 128)
-                                        break;
-                                    samples[2 * k] = get_bits1(gb) ? dequant_1bit[joined_stereo][2 * get_bits1(gb)] : 0;
-                                }
-                            } else {
-                                n = get_bits(gb, 8);
-                                for (k = 0; k < 5; k++)
-                                    samples[2 * k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]];
-                            }
-                            for (k = 0; k < 5; k++)
-                                samples[2 * k + 1] = SB_DITHERING_NOISE(sb,q->noise_idx);
-                        } else {
-                            for (k = 0; k < 10; k++)
-                                samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
-                        }
-                        run = 10;
-                        break;
-
-                    case 10:
-                        if (BITS_LEFT(length,gb) >= 1) {
-                            float f = 0.81;
-
-                            if (get_bits1(gb))
-                                f = -f;
-                            f -= noise_samples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0;
-                            samples[0] = f;
-                        } else {
-                            samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
-                        }
-                        run = 1;
-                        break;
-
-                    case 16:
-                        if (BITS_LEFT(length,gb) >= 10) {
-                            if (zero_encoding) {
-                                for (k = 0; k < 5; k++) {
-                                    if ((j + k) >= 128)
-                                        break;
-                                    samples[k] = (get_bits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * get_bits1(gb)];
-                                }
-                            } else {
-                                n = get_bits (gb, 8);
-                                for (k = 0; k < 5; k++)
-                                    samples[k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]];
-                            }
-                        } else {
-                            for (k = 0; k < 5; k++)
-                                samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
-                        }
-                        run = 5;
-                        break;
-
-                    case 24:
-                        if (BITS_LEFT(length,gb) >= 7) {
-                            n = get_bits(gb, 7);
-                            for (k = 0; k < 3; k++)
-                                samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5;
-                        } else {
-                            for (k = 0; k < 3; k++)
-                                samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
-                        }
-                        run = 3;
-                        break;
-
-                    case 30:
-                        if (BITS_LEFT(length,gb) >= 4)
-                            samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)];
-                        else
-                            samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
-
-                        run = 1;
-                        break;
-
-                    case 34:
-                        if (BITS_LEFT(length,gb) >= 7) {
-                            if (type34_first) {
-                                type34_div = (float)(1 << get_bits(gb, 2));
-                                samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0;
-                                type34_predictor = samples[0];
-                                type34_first = 0;
-                            } else {
-                                samples[0] = type34_delta[qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1)] / type34_div + type34_predictor;
-                                type34_predictor = samples[0];
-                            }
-                        } else {
-                            samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
-                        }
-                        run = 1;
-                        break;
-
-                    default:
-                        samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
-                        run = 1;
-                        break;
-                }
-
-                if (joined_stereo) {
-                    float tmp[10][MPA_MAX_CHANNELS];
-
-                    for (k = 0; k < run; k++) {
-                        tmp[k][0] = samples[k];
-                        tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k];
-                    }
-                    for (chs = 0; chs < q->nb_channels; chs++)
-                        for (k = 0; k < run; k++)
-                            if ((j + k) < 128)
-                                q->sb_samples[chs][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs] + .5);
-                } else {
-                    for (k = 0; k < run; k++)
-                        if ((j + k) < 128)
-                            q->sb_samples[ch][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[ch][sb][(j + k)/2] * samples[k] + .5);
-                }
-
-                j += run;
-            } // j loop
-        } // channel loop
-    } // subband loop
-}
-
-
-/**
- * Init the first element of a channel in quantized_coeffs with data from packet 10 (quantized_coeffs[ch][0]).
- * This is similar to process_subpacket_9, but for a single channel and for element [0]
- * same VLC tables as process_subpacket_9 are used.
- *
- * @param q         context
- * @param quantized_coeffs    pointer to quantized_coeffs[ch][0]
- * @param gb        bitreader context
- * @param length    packet length in bits
- */
-static void init_quantized_coeffs_elem0 (int8_t *quantized_coeffs, GetBitContext *gb, int length)
-{
-    int i, k, run, level, diff;
-
-    if (BITS_LEFT(length,gb) < 16)
-        return;
-    level = qdm2_get_vlc(gb, &vlc_tab_level, 0, 2);
-
-    quantized_coeffs[0] = level;
-
-    for (i = 0; i < 7; ) {
-        if (BITS_LEFT(length,gb) < 16)
-            break;
-        run = qdm2_get_vlc(gb, &vlc_tab_run, 0, 1) + 1;
-
-        if (BITS_LEFT(length,gb) < 16)
-            break;
-        diff = qdm2_get_se_vlc(&vlc_tab_diff, gb, 2);
-
-        for (k = 1; k <= run; k++)
-            quantized_coeffs[i + k] = (level + ((k * diff) / run));
-
-        level += diff;
-        i += run;
-    }
-}
-
-
-/**
- * Related to synthesis filter, process data from packet 10
- * Init part of quantized_coeffs via function init_quantized_coeffs_elem0
- * Init tone_level_idx_hi1, tone_level_idx_hi2, tone_level_idx_mid with data from packet 10
- *
- * @param q         context
- * @param gb        bitreader context
- * @param length    packet length in bits
- */
-static void init_tone_level_dequantization (QDM2Context *q, GetBitContext *gb, int length)
-{
-    int sb, j, k, n, ch;
-
-    for (ch = 0; ch < q->nb_channels; ch++) {
-        init_quantized_coeffs_elem0(q->quantized_coeffs[ch][0], gb, length);
-
-        if (BITS_LEFT(length,gb) < 16) {
-            memset(q->quantized_coeffs[ch][0], 0, 8);
-            break;
-        }
-    }
-
-    n = q->sub_sampling + 1;
-
-    for (sb = 0; sb < n; sb++)
-        for (ch = 0; ch < q->nb_channels; ch++)
-            for (j = 0; j < 8; j++) {
-                if (BITS_LEFT(length,gb) < 1)
-                    break;
-                if (get_bits1(gb)) {
-                    for (k=0; k < 8; k++) {
-                        if (BITS_LEFT(length,gb) < 16)
-                            break;
-                        q->tone_level_idx_hi1[ch][sb][j][k] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi1, 0, 2);
-                    }
-                } else {
-                    for (k=0; k < 8; k++)
-                        q->tone_level_idx_hi1[ch][sb][j][k] = 0;
-                }
-            }
-
-    n = QDM2_SB_USED(q->sub_sampling) - 4;
-
-    for (sb = 0; sb < n; sb++)
-        for (ch = 0; ch < q->nb_channels; ch++) {
-            if (BITS_LEFT(length,gb) < 16)
-                break;
-            q->tone_level_idx_hi2[ch][sb] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_hi2, 0, 2);
-            if (sb > 19)
-                q->tone_level_idx_hi2[ch][sb] -= 16;
-            else
-                for (j = 0; j < 8; j++)
-                    q->tone_level_idx_mid[ch][sb][j] = -16;
-        }
-
-    n = QDM2_SB_USED(q->sub_sampling) - 5;
-
-    for (sb = 0; sb < n; sb++)
-        for (ch = 0; ch < q->nb_channels; ch++)
-            for (j = 0; j < 8; j++) {
-                if (BITS_LEFT(length,gb) < 16)
-                    break;
-                q->tone_level_idx_mid[ch][sb][j] = qdm2_get_vlc(gb, &vlc_tab_tone_level_idx_mid, 0, 2) - 32;
-            }
-}
-
-/**
- * Process subpacket 9, init quantized_coeffs with data from it
- *
- * @param q       context
- * @param node    pointer to node with packet
- */
-static void process_subpacket_9 (QDM2Context *q, QDM2SubPNode *node)
-{
-    GetBitContext gb;
-    int i, j, k, n, ch, run, level, diff;
-
-    init_get_bits(&gb, node->packet->data, node->packet->size*8);
-
-    n = coeff_per_sb_for_avg[q->coeff_per_sb_select][QDM2_SB_USED(q->sub_sampling) - 1] + 1; // same as averagesomething function
-
-    for (i = 1; i < n; i++)
-        for (ch=0; ch < q->nb_channels; ch++) {
-            level = qdm2_get_vlc(&gb, &vlc_tab_level, 0, 2);
-            q->quantized_coeffs[ch][i][0] = level;
-
-            for (j = 0; j < (8 - 1); ) {
-                run = qdm2_get_vlc(&gb, &vlc_tab_run, 0, 1) + 1;
-                diff = qdm2_get_se_vlc(&vlc_tab_diff, &gb, 2);
-
-                for (k = 1; k <= run; k++)
-                    q->quantized_coeffs[ch][i][j + k] = (level + ((k*diff) / run));
-
-                level += diff;
-                j += run;
-            }
-        }
-
-    for (ch = 0; ch < q->nb_channels; ch++)
-        for (i = 0; i < 8; i++)
-            q->quantized_coeffs[ch][0][i] = 0;
-}
-
-
-/**
- * Process subpacket 10 if not null, else
- *
- * @param q         context
- * @param node      pointer to node with packet
- * @param length    packet length in bits
- */
-static void process_subpacket_10 (QDM2Context *q, QDM2SubPNode *node, int length)
-{
-    GetBitContext gb;
-
-    init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
-
-    if (length != 0) {
-        init_tone_level_dequantization(q, &gb, length);
-        fill_tone_level_array(q, 1);
-    } else {
-        fill_tone_level_array(q, 0);
-    }
-}
-
-
-/**
- * Process subpacket 11
- *
- * @param q         context
- * @param node      pointer to node with packet
- * @param length    packet length in bit
- */
-static void process_subpacket_11 (QDM2Context *q, QDM2SubPNode *node, int length)
-{
-    GetBitContext gb;
-
-    init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
-    if (length >= 32) {
-        int c = get_bits (&gb, 13);
-
-        if (c > 3)
-            fill_coding_method_array (q->tone_level_idx, q->tone_level_idx_temp, q->coding_method,
-                                      q->nb_channels, 8*c, q->superblocktype_2_3, q->cm_table_select);
-    }
-
-    synthfilt_build_sb_samples(q, &gb, length, 0, 8);
-}
-
-
-/**
- * Process subpacket 12
- *
- * @param q         context
- * @param node      pointer to node with packet
- * @param length    packet length in bits
- */
-static void process_subpacket_12 (QDM2Context *q, QDM2SubPNode *node, int length)
-{
-    GetBitContext gb;
-
-    init_get_bits(&gb, ((node == NULL) ? empty_buffer : node->packet->data), ((node == NULL) ? 0 : node->packet->size*8));
-    synthfilt_build_sb_samples(q, &gb, length, 8, QDM2_SB_USED(q->sub_sampling));
-}
-
-/*
- * Process new subpackets for synthesis filter
- *
- * @param q       context
- * @param list    list with synthesis filter packets (list D)
- */
-static void process_synthesis_subpackets (QDM2Context *q, QDM2SubPNode *list)
-{
-    QDM2SubPNode *nodes[4];
-
-    nodes[0] = qdm2_search_subpacket_type_in_list(list, 9);
-    if (nodes[0] != NULL)
-        process_subpacket_9(q, nodes[0]);
-
-    nodes[1] = qdm2_search_subpacket_type_in_list(list, 10);
-    if (nodes[1] != NULL)
-        process_subpacket_10(q, nodes[1], nodes[1]->packet->size << 3);
-    else
-        process_subpacket_10(q, NULL, 0);
-
-    nodes[2] = qdm2_search_subpacket_type_in_list(list, 11);
-    if (nodes[0] != NULL && nodes[1] != NULL && nodes[2] != NULL)
-        process_subpacket_11(q, nodes[2], (nodes[2]->packet->size << 3));
-    else
-        process_subpacket_11(q, NULL, 0);
-
-    nodes[3] = qdm2_search_subpacket_type_in_list(list, 12);
-    if (nodes[0] != NULL && nodes[1] != NULL && nodes[3] != NULL)
-        process_subpacket_12(q, nodes[3], (nodes[3]->packet->size << 3));
-    else
-        process_subpacket_12(q, NULL, 0);
-}
-
-
-/*
- * Decode superblock, fill packet lists.
- *
- * @param q    context
- */
-static void qdm2_decode_super_block (QDM2Context *q)
-{
-    GetBitContext gb;
-    QDM2SubPacket header, *packet;
-    int i, packet_bytes, sub_packet_size, sub_packets_D;
-    unsigned int next_index = 0;
-
-    memset(q->tone_level_idx_hi1, 0, sizeof(q->tone_level_idx_hi1));
-    memset(q->tone_level_idx_mid, 0, sizeof(q->tone_level_idx_mid));
-    memset(q->tone_level_idx_hi2, 0, sizeof(q->tone_level_idx_hi2));
-
-    q->sub_packets_B = 0;
-    sub_packets_D = 0;
-
-    average_quantized_coeffs(q); // average elements in quantized_coeffs[max_ch][10][8]
-
-    init_get_bits(&gb, q->compressed_data, q->compressed_size*8);
-    qdm2_decode_sub_packet_header(&gb, &header);
-
-    if (header.type < 2 || header.type >= 8) {
-        q->has_errors = 1;
-        av_log(NULL,AV_LOG_ERROR,"bad superblock type\n");
-        return;
-    }
-
-    q->superblocktype_2_3 = (header.type == 2 || header.type == 3);
-    packet_bytes = (q->compressed_size - get_bits_count(&gb) / 8);
-
-    init_get_bits(&gb, header.data, header.size*8);
-
-    if (header.type == 2 || header.type == 4 || header.type == 5) {
-        int csum = 257 * get_bits(&gb, 8) + 2 * get_bits(&gb, 8);
-
-        csum = qdm2_packet_checksum(q->compressed_data, q->checksum_size, csum);
-
-        if (csum != 0) {
-            q->has_errors = 1;
-            av_log(NULL,AV_LOG_ERROR,"bad packet checksum\n");
-            return;
-        }
-    }
-
-    q->sub_packet_list_B[0].packet = NULL;
-    q->sub_packet_list_D[0].packet = NULL;
-
-    for (i = 0; i < 6; i++)
-        if (--q->fft_level_exp[i] < 0)
-            q->fft_level_exp[i] = 0;
-
-    for (i = 0; packet_bytes > 0; i++) {
-        int j;
-
-        q->sub_packet_list_A[i].next = NULL;
-
-        if (i > 0) {
-            q->sub_packet_list_A[i - 1].next = &q->sub_packet_list_A[i];
-
-            /* seek to next block */
-            init_get_bits(&gb, header.data, header.size*8);
-            skip_bits(&gb, next_index*8);
-
-            if (next_index >= header.size)
-                break;
-        }
-
-        /* decode subpacket */
-        packet = &q->sub_packets[i];
-        qdm2_decode_sub_packet_header(&gb, packet);
-        next_index = packet->size + get_bits_count(&gb) / 8;
-        sub_packet_size = ((packet->size > 0xff) ? 1 : 0) + packet->size + 2;
-
-        if (packet->type == 0)
-            break;
-
-        if (sub_packet_size > packet_bytes) {
-            if (packet->type != 10 && packet->type != 11 && packet->type != 12)
-                break;
-            packet->size += packet_bytes - sub_packet_size;
-        }
-
-        packet_bytes -= sub_packet_size;
-
-        /* add subpacket to 'all subpackets' list */
-        q->sub_packet_list_A[i].packet = packet;
-
-        /* add subpacket to related list */
-        if (packet->type == 8) {
-            SAMPLES_NEEDED_2("packet type 8");
-            return;
-        } else if (packet->type >= 9 && packet->type <= 12) {
-            /* packets for MPEG Audio like Synthesis Filter */
-            QDM2_LIST_ADD(q->sub_packet_list_D, sub_packets_D, packet);
-        } else if (packet->type == 13) {
-            for (j = 0; j < 6; j++)
-                q->fft_level_exp[j] = get_bits(&gb, 6);
-        } else if (packet->type == 14) {
-            for (j = 0; j < 6; j++)
-                q->fft_level_exp[j] = qdm2_get_vlc(&gb, &fft_level_exp_vlc, 0, 2);
-        } else if (packet->type == 15) {
-            SAMPLES_NEEDED_2("packet type 15")
-            return;
-        } else if (packet->type >= 16 && packet->type < 48 && !fft_subpackets[packet->type - 16]) {
-            /* packets for FFT */
-            QDM2_LIST_ADD(q->sub_packet_list_B, q->sub_packets_B, packet);
-        }
-    } // Packet bytes loop
-
-/* **************************************************************** */
-    if (q->sub_packet_list_D[0].packet != NULL) {
-        process_synthesis_subpackets(q, q->sub_packet_list_D);
-        q->do_synth_filter = 1;
-    } else if (q->do_synth_filter) {
-        process_subpacket_10(q, NULL, 0);
-        process_subpacket_11(q, NULL, 0);
-        process_subpacket_12(q, NULL, 0);
-    }
-/* **************************************************************** */
-}
-
-
-static void qdm2_fft_init_coefficient (QDM2Context *q, int sub_packet,
-                       int offset, int duration, int channel,
-                       int exp, int phase)
-{
-    if (q->fft_coefs_min_index[duration] < 0)
-        q->fft_coefs_min_index[duration] = q->fft_coefs_index;
-
-    q->fft_coefs[q->fft_coefs_index].sub_packet = ((sub_packet >= 16) ? (sub_packet - 16) : sub_packet);
-    q->fft_coefs[q->fft_coefs_index].channel = channel;
-    q->fft_coefs[q->fft_coefs_index].offset = offset;
-    q->fft_coefs[q->fft_coefs_index].exp = exp;
-    q->fft_coefs[q->fft_coefs_index].phase = phase;
-    q->fft_coefs_index++;
-}
-
-
-static void qdm2_fft_decode_tones (QDM2Context *q, int duration, GetBitContext *gb, int b)
-{
-    int channel, stereo, phase, exp;
-    int local_int_4,  local_int_8,  stereo_phase,  local_int_10;
-    int local_int_14, stereo_exp, local_int_20, local_int_28;
-    int n, offset;
-
-    local_int_4 = 0;
-    local_int_28 = 0;
-    local_int_20 = 2;
-    local_int_8 = (4 - duration);
-    local_int_10 = 1 << (q->group_order - duration - 1);
-    offset = 1;
-
-    while (1) {
-        if (q->superblocktype_2_3) {
-            while ((n = qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2)) < 2) {
-                offset = 1;
-                if (n == 0) {
-                    local_int_4 += local_int_10;
-                    local_int_28 += (1 << local_int_8);
-                } else {
-                    local_int_4 += 8*local_int_10;
-                    local_int_28 += (8 << local_int_8);
-                }
-            }
-            offset += (n - 2);
-        } else {
-            offset += qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2);
-            while (offset >= (local_int_10 - 1)) {
-                offset += (1 - (local_int_10 - 1));
-                local_int_4  += local_int_10;
-                local_int_28 += (1 << local_int_8);
-            }
-        }
-
-        if (local_int_4 >= q->group_size)
-            return;
-
-        local_int_14 = (offset >> local_int_8);
-
-        if (q->nb_channels > 1) {
-            channel = get_bits1(gb);
-            stereo = get_bits1(gb);
-        } else {
-            channel = 0;
-            stereo = 0;
-        }
-
-        exp = qdm2_get_vlc(gb, (b ? &fft_level_exp_vlc : &fft_level_exp_alt_vlc), 0, 2);
-        exp += q->fft_level_exp[fft_level_index_table[local_int_14]];
-        exp = (exp < 0) ? 0 : exp;
-
-        phase = get_bits(gb, 3);
-        stereo_exp = 0;
-        stereo_phase = 0;
-
-        if (stereo) {
-            stereo_exp = (exp - qdm2_get_vlc(gb, &fft_stereo_exp_vlc, 0, 1));
-            stereo_phase = (phase - qdm2_get_vlc(gb, &fft_stereo_phase_vlc, 0, 1));
-            if (stereo_phase < 0)
-                stereo_phase += 8;
-        }
-
-        if (q->frequency_range > (local_int_14 + 1)) {
-            int sub_packet = (local_int_20 + local_int_28);
-
-            qdm2_fft_init_coefficient(q, sub_packet, offset, duration, channel, exp, phase);
-            if (stereo)
-                qdm2_fft_init_coefficient(q, sub_packet, offset, duration, (1 - channel), stereo_exp, stereo_phase);
-        }
-
-        offset++;
-    }
-}
-
-
-static void qdm2_decode_fft_packets (QDM2Context *q)
-{
-    int i, j, min, max, value, type, unknown_flag;
-    GetBitContext gb;
-
-    if (q->sub_packet_list_B[0].packet == NULL)
-        return;
-
-    /* reset minimum indexes for FFT coefficients */
-    q->fft_coefs_index = 0;
-    for (i=0; i < 5; i++)
-        q->fft_coefs_min_index[i] = -1;
-
-    /* process subpackets ordered by type, largest type first */
-    for (i = 0, max = 256; i < q->sub_packets_B; i++) {
-        QDM2SubPacket *packet= NULL;
-
-        /* find subpacket with largest type less than max */
-        for (j = 0, min = 0; j < q->sub_packets_B; j++) {
-            value = q->sub_packet_list_B[j].packet->type;
-            if (value > min && value < max) {
-                min = value;
-                packet = q->sub_packet_list_B[j].packet;
-            }
-        }
-
-        max = min;
-
-        /* check for errors (?) */
-        if (!packet)
-            return;
-
-        if (i == 0 && (packet->type < 16 || packet->type >= 48 || fft_subpackets[packet->type - 16]))
-            return;
-
-        /* decode FFT tones */
-        init_get_bits (&gb, packet->data, packet->size*8);
-
-        if (packet->type >= 32 && packet->type < 48 && !fft_subpackets[packet->type - 16])
-            unknown_flag = 1;
-        else
-            unknown_flag = 0;
-
-        type = packet->type;
-
-        if ((type >= 17 && type < 24) || (type >= 33 && type < 40)) {
-            int duration = q->sub_sampling + 5 - (type & 15);
-
-            if (duration >= 0 && duration < 4)
-                qdm2_fft_decode_tones(q, duration, &gb, unknown_flag);
-        } else if (type == 31) {
-            for (j=0; j < 4; j++)
-                qdm2_fft_decode_tones(q, j, &gb, unknown_flag);
-        } else if (type == 46) {
-            for (j=0; j < 6; j++)
-                q->fft_level_exp[j] = get_bits(&gb, 6);
-            for (j=0; j < 4; j++)
-            qdm2_fft_decode_tones(q, j, &gb, unknown_flag);
-        }
-    } // Loop on B packets
-
-    /* calculate maximum indexes for FFT coefficients */
-    for (i = 0, j = -1; i < 5; i++)
-        if (q->fft_coefs_min_index[i] >= 0) {
-            if (j >= 0)
-                q->fft_coefs_max_index[j] = q->fft_coefs_min_index[i];
-            j = i;
-        }
-    if (j >= 0)
-        q->fft_coefs_max_index[j] = q->fft_coefs_index;
-}
-
-
-static void qdm2_fft_generate_tone (QDM2Context *q, FFTTone *tone)
-{
-   float level, f[6];
-   int i;
-   QDM2Complex c;
-   const double iscale = 2.0*M_PI / 512.0;
-
-    tone->phase += tone->phase_shift;
-
-    /* calculate current level (maximum amplitude) of tone */
-    level = fft_tone_envelope_table[tone->duration][tone->time_index] * tone->level;
-    c.im = level * sin(tone->phase*iscale);
-    c.re = level * cos(tone->phase*iscale);
-
-    /* generate FFT coefficients for tone */
-    if (tone->duration >= 3 || tone->cutoff >= 3) {
-        tone->complex[0].im += c.im;
-        tone->complex[0].re += c.re;
-        tone->complex[1].im -= c.im;
-        tone->complex[1].re -= c.re;
-    } else {
-        f[1] = -tone->table[4];
-        f[0] =  tone->table[3] - tone->table[0];
-        f[2] =  1.0 - tone->table[2] - tone->table[3];
-        f[3] =  tone->table[1] + tone->table[4] - 1.0;
-        f[4] =  tone->table[0] - tone->table[1];
-        f[5] =  tone->table[2];
-        for (i = 0; i < 2; i++) {
-            tone->complex[fft_cutoff_index_table[tone->cutoff][i]].re += c.re * f[i];
-            tone->complex[fft_cutoff_index_table[tone->cutoff][i]].im += c.im *((tone->cutoff <= i) ? -f[i] : f[i]);
-        }
-        for (i = 0; i < 4; i++) {
-            tone->complex[i].re += c.re * f[i+2];
-            tone->complex[i].im += c.im * f[i+2];
-        }
-    }
-
-    /* copy the tone if it has not yet died out */
-    if (++tone->time_index < ((1 << (5 - tone->duration)) - 1)) {
-      memcpy(&q->fft_tones[q->fft_tone_end], tone, sizeof(FFTTone));
-      q->fft_tone_end = (q->fft_tone_end + 1) % 1000;
-    }
-}
-
-
-static void qdm2_fft_tone_synthesizer (QDM2Context *q, int sub_packet)
-{
-    int i, j, ch;
-    const double iscale = 0.25 * M_PI;
-
-    for (ch = 0; ch < q->channels; ch++) {
-        memset(q->fft.complex[ch], 0, q->fft_size * sizeof(QDM2Complex));
-    }
-
-
-    /* apply FFT tones with duration 4 (1 FFT period) */
-    if (q->fft_coefs_min_index[4] >= 0)
-        for (i = q->fft_coefs_min_index[4]; i < q->fft_coefs_max_index[4]; i++) {
-            float level;
-            QDM2Complex c;
-
-            if (q->fft_coefs[i].sub_packet != sub_packet)
-                break;
-
-            ch = (q->channels == 1) ? 0 : q->fft_coefs[i].channel;
-            level = (q->fft_coefs[i].exp < 0) ? 0.0 : fft_tone_level_table[q->superblocktype_2_3 ? 0 : 1][q->fft_coefs[i].exp & 63];
-
-            c.re = level * cos(q->fft_coefs[i].phase * iscale);
-            c.im = level * sin(q->fft_coefs[i].phase * iscale);
-            q->fft.complex[ch][q->fft_coefs[i].offset + 0].re += c.re;
-            q->fft.complex[ch][q->fft_coefs[i].offset + 0].im += c.im;
-            q->fft.complex[ch][q->fft_coefs[i].offset + 1].re -= c.re;
-            q->fft.complex[ch][q->fft_coefs[i].offset + 1].im -= c.im;
-        }
-
-    /* generate existing FFT tones */
-    for (i = q->fft_tone_end; i != q->fft_tone_start; ) {
-        qdm2_fft_generate_tone(q, &q->fft_tones[q->fft_tone_start]);
-        q->fft_tone_start = (q->fft_tone_start + 1) % 1000;
-    }
-
-    /* create and generate new FFT tones with duration 0 (long) to 3 (short) */
-    for (i = 0; i < 4; i++)
-        if (q->fft_coefs_min_index[i] >= 0) {
-            for (j = q->fft_coefs_min_index[i]; j < q->fft_coefs_max_index[i]; j++) {
-                int offset, four_i;
-                FFTTone tone;
-
-                if (q->fft_coefs[j].sub_packet != sub_packet)
-                    break;
-
-                four_i = (4 - i);
-                offset = q->fft_coefs[j].offset >> four_i;
-                ch = (q->channels == 1) ? 0 : q->fft_coefs[j].channel;
-
-                if (offset < q->frequency_range) {
-                    if (offset < 2)
-                        tone.cutoff = offset;
-                    else
-                        tone.cutoff = (offset >= 60) ? 3 : 2;
-
-                    tone.level = (q->fft_coefs[j].exp < 0) ? 0.0 : fft_tone_level_table[q->superblocktype_2_3 ? 0 : 1][q->fft_coefs[j].exp & 63];
-                    tone.complex = &q->fft.complex[ch][offset];
-                    tone.table = fft_tone_sample_table[i][q->fft_coefs[j].offset - (offset << four_i)];
-                    tone.phase = 64 * q->fft_coefs[j].phase - (offset << 8) - 128;
-                    tone.phase_shift = (2 * q->fft_coefs[j].offset + 1) << (7 - four_i);
-                    tone.duration = i;
-                    tone.time_index = 0;
-
-                    qdm2_fft_generate_tone(q, &tone);
-                }
-            }
-            q->fft_coefs_min_index[i] = j;
-        }
-}
-
-
-static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet)
-{
-    const float gain = (q->channels == 1 && q->nb_channels == 2) ? 0.5f : 1.0f;
-    int i;
-    q->fft.complex[channel][0].re *= 2.0f;
-    q->fft.complex[channel][0].im = 0.0f;
-    ff_rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
-    /* add samples to output buffer */
-    for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++)
-        q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain;
-}
-
-
-/**
- * @param q        context
- * @param index    subpacket number
- */
-static void qdm2_synthesis_filter (QDM2Context *q, int index)
-{
-    OUT_INT samples[MPA_MAX_CHANNELS * MPA_FRAME_SIZE];
-    int i, k, ch, sb_used, sub_sampling, dither_state = 0;
-
-    /* copy sb_samples */
-    sb_used = QDM2_SB_USED(q->sub_sampling);
-
-    for (ch = 0; ch < q->channels; ch++)
-        for (i = 0; i < 8; i++)
-            for (k=sb_used; k < SBLIMIT; k++)
-                q->sb_samples[ch][(8 * index) + i][k] = 0;
-
-    for (ch = 0; ch < q->nb_channels; ch++) {
-        OUT_INT *samples_ptr = samples + ch;
-
-        for (i = 0; i < 8; i++) {
-            ff_mpa_synth_filter(q->synth_buf[ch], &(q->synth_buf_offset[ch]),
-                ff_mpa_synth_window, &dither_state,
-                samples_ptr, q->nb_channels,
-                q->sb_samples[ch][(8 * index) + i]);
-            samples_ptr += 32 * q->nb_channels;
-        }
-    }
-
-    /* add samples to output buffer */
-    sub_sampling = (4 >> q->sub_sampling);
-
-    for (ch = 0; ch < q->channels; ch++)
-        for (i = 0; i < q->frame_size; i++)
-            q->output_buffer[q->channels * i + ch] += (float)(samples[q->nb_channels * sub_sampling * i + ch] >> (sizeof(OUT_INT)*8-16));
-}
-
-
-/**
- * Init static data (does not depend on specific file)
- *
- * @param q    context
- */
-static av_cold void qdm2_init(QDM2Context *q) {
-    static int initialized = 0;
-
-    if (initialized != 0)
-        return;
-    initialized = 1;
-
-    qdm2_init_vlc();
-    ff_mpa_synth_init(ff_mpa_synth_window);
-    softclip_table_init();
-    rnd_table_init();
-    init_noise_samples();
-
-    av_log(NULL, AV_LOG_DEBUG, "init done\n");
-}
-
-
-#if 0
-static void dump_context(QDM2Context *q)
-{
-    int i;
-#define PRINT(a,b) av_log(NULL,AV_LOG_DEBUG," %s = %d\n", a, b);
-    PRINT("compressed_data",q->compressed_data);
-    PRINT("compressed_size",q->compressed_size);
-    PRINT("frame_size",q->frame_size);
-    PRINT("checksum_size",q->checksum_size);
-    PRINT("channels",q->channels);
-    PRINT("nb_channels",q->nb_channels);
-    PRINT("fft_frame_size",q->fft_frame_size);
-    PRINT("fft_size",q->fft_size);
-    PRINT("sub_sampling",q->sub_sampling);
-    PRINT("fft_order",q->fft_order);
-    PRINT("group_order",q->group_order);
-    PRINT("group_size",q->group_size);
-    PRINT("sub_packet",q->sub_packet);
-    PRINT("frequency_range",q->frequency_range);
-    PRINT("has_errors",q->has_errors);
-    PRINT("fft_tone_end",q->fft_tone_end);
-    PRINT("fft_tone_start",q->fft_tone_start);
-    PRINT("fft_coefs_index",q->fft_coefs_index);
-    PRINT("coeff_per_sb_select",q->coeff_per_sb_select);
-    PRINT("cm_table_select",q->cm_table_select);
-    PRINT("noise_idx",q->noise_idx);
-
-    for (i = q->fft_tone_start; i < q->fft_tone_end; i++)
-    {
-    FFTTone *t = &q->fft_tones[i];
-
-    av_log(NULL,AV_LOG_DEBUG,"Tone (%d) dump:\n", i);
-    av_log(NULL,AV_LOG_DEBUG,"  level = %f\n", t->level);
-//  PRINT(" level", t->level);
-    PRINT(" phase", t->phase);
-    PRINT(" phase_shift", t->phase_shift);
-    PRINT(" duration", t->duration);
-    PRINT(" samples_im", t->samples_im);
-    PRINT(" samples_re", t->samples_re);
-    PRINT(" table", t->table);
-    }
-
-}
-#endif
-
-
-/**
- * Init parameters from codec extradata
- */
-static av_cold int qdm2_decode_init(AVCodecContext *avctx)
-{
-    QDM2Context *s = avctx->priv_data;
-    uint8_t *extradata;
-    int extradata_size;
-    int tmp_val, tmp, size;
-
-    /* extradata parsing
-
-    Structure:
-    wave {
-        frma (QDM2)
-        QDCA
-        QDCP
-    }
-
-    32  size (including this field)
-    32  tag (=frma)
-    32  type (=QDM2 or QDMC)
-
-    32  size (including this field, in bytes)
-    32  tag (=QDCA) // maybe mandatory parameters
-    32  unknown (=1)
-    32  channels (=2)
-    32  samplerate (=44100)
-    32  bitrate (=96000)
-    32  block size (=4096)
-    32  frame size (=256) (for one channel)
-    32  packet size (=1300)
-
-    32  size (including this field, in bytes)
-    32  tag (=QDCP) // maybe some tuneable parameters
-    32  float1 (=1.0)
-    32  zero ?
-    32  float2 (=1.0)
-    32  float3 (=1.0)
-    32  unknown (27)
-    32  unknown (8)
-    32  zero ?
-    */
-
-    if (!avctx->extradata || (avctx->extradata_size < 48)) {
-        av_log(avctx, AV_LOG_ERROR, "extradata missing or truncated\n");
-        return -1;
-    }
-
-    extradata = avctx->extradata;
-    extradata_size = avctx->extradata_size;
-
-    while (extradata_size > 7) {
-        if (!memcmp(extradata, "frmaQDM", 7))
-            break;
-        extradata++;
-        extradata_size--;
-    }
-
-    if (extradata_size < 12) {
-        av_log(avctx, AV_LOG_ERROR, "not enough extradata (%i)\n",
-               extradata_size);
-        return -1;
-    }
-
-    if (memcmp(extradata, "frmaQDM", 7)) {
-        av_log(avctx, AV_LOG_ERROR, "invalid headers, QDM? not found\n");
-        return -1;
-    }
-
-    if (extradata[7] == 'C') {
-//        s->is_qdmc = 1;
-        av_log(avctx, AV_LOG_ERROR, "stream is QDMC version 1, which is not supported\n");
-        return -1;
-    }
-
-    extradata += 8;
-    extradata_size -= 8;
-
-    size = AV_RB32(extradata);
-
-    if(size > extradata_size){
-        av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n",
-               extradata_size, size);
-        return -1;
-    }
-
-    extradata += 4;
-    av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size);
-    if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) {
-        av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n");
-        return -1;
-    }
-
-    extradata += 8;
-
-    avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
-    extradata += 4;
-
-    avctx->sample_rate = AV_RB32(extradata);
-    extradata += 4;
-
-    avctx->bit_rate = AV_RB32(extradata);
-    extradata += 4;
-
-    s->group_size = AV_RB32(extradata);
-    extradata += 4;
-
-    s->fft_size = AV_RB32(extradata);
-    extradata += 4;
-
-    s->checksum_size = AV_RB32(extradata);
-
-    s->fft_order = av_log2(s->fft_size) + 1;
-    s->fft_frame_size = 2 * s->fft_size; // complex has two floats
-
-    // something like max decodable tones
-    s->group_order = av_log2(s->group_size) + 1;
-    s->frame_size = s->group_size / 16; // 16 iterations per super block
-
-    s->sub_sampling = s->fft_order - 7;
-    s->frequency_range = 255 / (1 << (2 - s->sub_sampling));
-
-    switch ((s->sub_sampling * 2 + s->channels - 1)) {
-        case 0: tmp = 40; break;
-        case 1: tmp = 48; break;
-        case 2: tmp = 56; break;
-        case 3: tmp = 72; break;
-        case 4: tmp = 80; break;
-        case 5: tmp = 100;break;
-        default: tmp=s->sub_sampling; break;
-    }
-    tmp_val = 0;
-    if ((tmp * 1000) < avctx->bit_rate)  tmp_val = 1;
-    if ((tmp * 1440) < avctx->bit_rate)  tmp_val = 2;
-    if ((tmp * 1760) < avctx->bit_rate)  tmp_val = 3;
-    if ((tmp * 2240) < avctx->bit_rate)  tmp_val = 4;
-    s->cm_table_select = tmp_val;
-
-    if (s->sub_sampling == 0)
-        tmp = 7999;
-    else
-        tmp = ((-(s->sub_sampling -1)) & 8000) + 20000;
-    /*
-    0: 7999 -> 0
-    1: 20000 -> 2
-    2: 28000 -> 2
-    */
-    if (tmp < 8000)
-        s->coeff_per_sb_select = 0;
-    else if (tmp <= 16000)
-        s->coeff_per_sb_select = 1;
-    else
-        s->coeff_per_sb_select = 2;
-
-    // Fail on unknown fft order
-    if ((s->fft_order < 7) || (s->fft_order > 9)) {
-        av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order);
-        return -1;
-    }
-
-    ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R);
-
-    qdm2_init(s);
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-//    dump_context(s);
-    return 0;
-}
-
-
-static av_cold int qdm2_decode_close(AVCodecContext *avctx)
-{
-    QDM2Context *s = avctx->priv_data;
-
-    ff_rdft_end(&s->rdft_ctx);
-
-    return 0;
-}
-
-
-static void qdm2_decode (QDM2Context *q, const uint8_t *in, int16_t *out)
-{
-    int ch, i;
-    const int frame_size = (q->frame_size * q->channels);
-
-    /* select input buffer */
-    q->compressed_data = in;
-    q->compressed_size = q->checksum_size;
-
-//  dump_context(q);
-
-    /* copy old block, clear new block of output samples */
-    memmove(q->output_buffer, &q->output_buffer[frame_size], frame_size * sizeof(float));
-    memset(&q->output_buffer[frame_size], 0, frame_size * sizeof(float));
-
-    /* decode block of QDM2 compressed data */
-    if (q->sub_packet == 0) {
-        q->has_errors = 0; // zero it for a new super block
-        av_log(NULL,AV_LOG_DEBUG,"Superblock follows\n");
-        qdm2_decode_super_block(q);
-    }
-
-    /* parse subpackets */
-    if (!q->has_errors) {
-        if (q->sub_packet == 2)
-            qdm2_decode_fft_packets(q);
-
-        qdm2_fft_tone_synthesizer(q, q->sub_packet);
-    }
-
-    /* sound synthesis stage 1 (FFT) */
-    for (ch = 0; ch < q->channels; ch++) {
-        qdm2_calculate_fft(q, ch, q->sub_packet);
-
-        if (!q->has_errors && q->sub_packet_list_C[0].packet != NULL) {
-            SAMPLES_NEEDED_2("has errors, and C list is not empty")
-            return;
-        }
-    }
-
-    /* sound synthesis stage 2 (MPEG audio like synthesis filter) */
-    if (!q->has_errors && q->do_synth_filter)
-        qdm2_synthesis_filter(q, q->sub_packet);
-
-    q->sub_packet = (q->sub_packet + 1) % 16;
-
-    /* clip and convert output float[] to 16bit signed samples */
-    for (i = 0; i < frame_size; i++) {
-        int value = (int)q->output_buffer[i];
-
-        if (value > SOFTCLIP_THRESHOLD)
-            value = (value >  HARDCLIP_THRESHOLD) ?  32767 :  softclip_table[ value - SOFTCLIP_THRESHOLD];
-        else if (value < -SOFTCLIP_THRESHOLD)
-            value = (value < -HARDCLIP_THRESHOLD) ? -32767 : -softclip_table[-value - SOFTCLIP_THRESHOLD];
-
-        out[i] = value;
-    }
-}
-
-
-static int qdm2_decode_frame(AVCodecContext *avctx,
-            void *data, int *data_size,
-            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    QDM2Context *s = avctx->priv_data;
-
-    if(!buf)
-        return 0;
-    if(buf_size < s->checksum_size)
-        return -1;
-
-    *data_size = s->channels * s->frame_size * sizeof(int16_t);
-
-    av_log(avctx, AV_LOG_DEBUG, "decode(%d): %p[%d] -> %p[%d]\n",
-       buf_size, buf, s->checksum_size, data, *data_size);
-
-    qdm2_decode(s, buf, data);
-
-    // reading only when next superblock found
-    if (s->sub_packet == 0) {
-        return s->checksum_size;
-    }
-
-    return 0;
-}
-
-AVCodec qdm2_decoder =
-{
-    .name = "qdm2",
-    .type = AVMEDIA_TYPE_AUDIO,
-    .id = CODEC_ID_QDM2,
-    .priv_data_size = sizeof(QDM2Context),
-    .init = qdm2_decode_init,
-    .close = qdm2_decode_close,
-    .decode = qdm2_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"),
-};
diff --git a/libavcodec/qdm2_tablegen.c b/libavcodec/qdm2_tablegen.c
deleted file mode 100644
index c225bc4..0000000
--- a/libavcodec/qdm2_tablegen.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Generate a header file for hardcoded QDM2 tables
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#include "qdm2_tablegen.h"
-#include "tableprint.h"
-
-int main(void)
-{
-    softclip_table_init();
-    rnd_table_init();
-    init_noise_samples();
-
-    write_fileheader();
-
-    printf("static const uint16_t softclip_table[HARDCLIP_THRESHOLD - SOFTCLIP_THRESHOLD + 1] = {\n");
-    write_uint16_array(softclip_table, HARDCLIP_THRESHOLD - SOFTCLIP_THRESHOLD + 1);
-    printf("};\n");
-
-    printf("static const float noise_table[4096] = {\n");
-    write_float_array(noise_table, 4096);
-    printf("};\n");
-
-    printf("static const uint8_t random_dequant_index[256][5] = {\n");
-    write_uint8_2d_array(random_dequant_index, 256, 5);
-    printf("};\n");
-
-    printf("static const uint8_t random_dequant_type24[128][3] = {\n");
-    write_uint8_2d_array(random_dequant_type24, 128, 3);
-    printf("};\n");
-
-    printf("static const float noise_samples[128] = {\n");
-    write_float_array(noise_samples, 128);
-    printf("};\n");
-
-    return 0;
-}
diff --git a/libavcodec/qdm2_tablegen.h b/libavcodec/qdm2_tablegen.h
deleted file mode 100644
index de9ff0c..0000000
--- a/libavcodec/qdm2_tablegen.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Header file for hardcoded QDM2 tables
- *
- * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef QDM2_TABLEGEN_H
-#define QDM2_TABLEGEN_H
-
-#include <stdint.h>
-#include <math.h>
-#include "../libavutil/attributes.h"
-
-#define SOFTCLIP_THRESHOLD 27600
-#define HARDCLIP_THRESHOLD 35716
-
-#if CONFIG_HARDCODED_TABLES
-#define softclip_table_init()
-#define rnd_table_init()
-#define init_noise_samples()
-#include "libavcodec/qdm2_tables.h"
-#else
-static uint16_t softclip_table[HARDCLIP_THRESHOLD - SOFTCLIP_THRESHOLD + 1];
-static float noise_table[4096];
-static uint8_t random_dequant_index[256][5];
-static uint8_t random_dequant_type24[128][3];
-static float noise_samples[128];
-
-static av_cold void softclip_table_init(void) {
-    int i;
-    double dfl = SOFTCLIP_THRESHOLD - 32767;
-    float delta = 1.0 / -dfl;
-    for (i = 0; i < HARDCLIP_THRESHOLD - SOFTCLIP_THRESHOLD + 1; i++)
-        softclip_table[i] = SOFTCLIP_THRESHOLD - ((int)(sin((float)i * delta) * dfl) & 0x0000FFFF);
-}
-
-
-// random generated table
-static av_cold void rnd_table_init(void) {
-    int i,j;
-    uint32_t ldw,hdw;
-    uint64_t tmp64_1;
-    uint64_t random_seed = 0;
-    float delta = 1.0 / 16384.0;
-    for(i = 0; i < 4096 ;i++) {
-        random_seed = random_seed * 214013 + 2531011;
-        noise_table[i] = (delta * (float)(((int32_t)random_seed >> 16) & 0x00007FFF)- 1.0) * 1.3;
-    }
-
-    for (i = 0; i < 256 ;i++) {
-        random_seed = 81;
-        ldw = i;
-        for (j = 0; j < 5 ;j++) {
-            random_dequant_index[i][j] = (uint8_t)((ldw / random_seed) & 0xFF);
-            ldw = (uint32_t)ldw % (uint32_t)random_seed;
-            tmp64_1 = (random_seed * 0x55555556);
-            hdw = (uint32_t)(tmp64_1 >> 32);
-            random_seed = (uint64_t)(hdw + (ldw >> 31));
-        }
-    }
-    for (i = 0; i < 128 ;i++) {
-        random_seed = 25;
-        ldw = i;
-        for (j = 0; j < 3 ;j++) {
-            random_dequant_type24[i][j] = (uint8_t)((ldw / random_seed) & 0xFF);
-            ldw = (uint32_t)ldw % (uint32_t)random_seed;
-            tmp64_1 = (random_seed * 0x66666667);
-            hdw = (uint32_t)(tmp64_1 >> 33);
-            random_seed = hdw + (ldw >> 31);
-        }
-    }
-}
-
-
-static av_cold void init_noise_samples(void) {
-    int i;
-    int random_seed = 0;
-    float delta = 1.0 / 16384.0;
-    for (i = 0; i < 128;i++) {
-        random_seed = random_seed * 214013 + 2531011;
-        noise_samples[i] = (delta * (float)((random_seed >> 16) & 0x00007fff) - 1.0);
-    }
-}
-#endif /* CONFIG_HARDCODED_TABLES */
-
-#endif /* QDM2_TABLEGEN_H */
diff --git a/libavcodec/qdm2data.h b/libavcodec/qdm2data.h
deleted file mode 100644
index 355d613..0000000
--- a/libavcodec/qdm2data.h
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * QDM2 compatible decoder
- * Copyright (c) 2003 Ewald Snel
- * Copyright (c) 2005 Benjamin Larsson
- * Copyright (c) 2005 Alex Beregszaszi
- * Copyright (c) 2005 Roberto Togni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
- /**
- * @file
- * Various QDM2 tables.
- */
-
-#ifndef AVCODEC_QDM2DATA_H
-#define AVCODEC_QDM2DATA_H
-
-#include <stdint.h>
-
-/** VLC TABLES **/
-
-/* values in this table range from -1..23; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_level_huffcodes[24] = {
-    0x037c, 0x0004, 0x003c, 0x004c, 0x003a, 0x002c, 0x001c, 0x001a,
-    0x0024, 0x0014, 0x0001, 0x0002, 0x0000, 0x0003, 0x0007, 0x0005,
-    0x0006, 0x0008, 0x0009, 0x000a, 0x000c, 0x00fc, 0x007c, 0x017c
-};
-
-static const uint8_t vlc_tab_level_huffbits[24] = {
-    10, 6, 7, 7, 6, 6, 6, 6, 6, 5, 4, 4, 4, 3, 3, 3, 3, 4, 4, 5, 7, 8, 9, 10
-};
-
-/* values in this table range from -1..36; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_diff_huffcodes[37] = {
-    0x1c57, 0x0004, 0x0000, 0x0001, 0x0003, 0x0002, 0x000f, 0x000e,
-    0x0007, 0x0016, 0x0037, 0x0027, 0x0026, 0x0066, 0x0006, 0x0097,
-    0x0046, 0x01c6, 0x0017, 0x0786, 0x0086, 0x0257, 0x00d7, 0x0357,
-    0x00c6, 0x0386, 0x0186, 0x0000, 0x0157, 0x0c57, 0x0057, 0x0000,
-    0x0b86, 0x0000, 0x1457, 0x0000, 0x0457
-};
-
-static const uint8_t vlc_tab_diff_huffbits[37] = {
-    13, 3, 3, 2, 3, 3, 4, 4, 6, 5, 6, 6, 7, 7, 8, 8,
-    8, 9, 8, 11, 9, 10, 8, 10, 9, 12, 10, 0, 10, 13, 11, 0,
-    12, 0, 13, 0, 13
-};
-
-/* values in this table range from -1..5; adjust retrieved value by -1 */
-static const uint8_t vlc_tab_run_huffcodes[6] = {
-    0x1f, 0x00, 0x01, 0x03, 0x07, 0x0f
-};
-
-static const uint8_t vlc_tab_run_huffbits[6] = {
-    5, 1, 2, 3, 4, 5
-};
-
-/* values in this table range from -1..19; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_tone_level_idx_hi1_huffcodes[20] = {
-    0x5714, 0x000c, 0x0002, 0x0001, 0x0000, 0x0004, 0x0034, 0x0054,
-    0x0094, 0x0014, 0x0114, 0x0214, 0x0314, 0x0614, 0x0e14, 0x0f14,
-    0x2714, 0x0714, 0x1714, 0x3714
-};
-
-static const uint8_t vlc_tab_tone_level_idx_hi1_huffbits[20] = {
-    15, 4, 2, 1, 3, 5, 6, 7, 8, 10, 10, 11, 11, 12, 12, 12, 14, 14, 15, 14
-};
-
-/* values in this table range from -1..23; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_tone_level_idx_mid_huffcodes[24] = {
-    0x0fea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-    0x0000, 0x0000, 0x0000, 0x0000, 0x03ea, 0x00ea, 0x002a, 0x001a,
-    0x0006, 0x0001, 0x0000, 0x0002, 0x000a, 0x006a, 0x01ea, 0x07ea
-};
-
-static const uint8_t vlc_tab_tone_level_idx_mid_huffbits[24] = {
-    12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12
-};
-
-/* values in this table range from -1..23; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_tone_level_idx_hi2_huffcodes[24] = {
-    0x0664, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0064, 0x00e4,
-    0x00a4, 0x0068, 0x0004, 0x0008, 0x0014, 0x0018, 0x0000, 0x0001,
-    0x0002, 0x0003, 0x000c, 0x0028, 0x0024, 0x0164, 0x0000, 0x0264
-};
-
-static const uint8_t vlc_tab_tone_level_idx_hi2_huffbits[24] = {
-    11, 0, 0, 0, 0, 0, 10, 8, 8, 7, 6, 6, 5, 5, 4, 2, 2, 2, 4, 7, 8, 9, 0, 11
-};
-
-/* values in this table range from -1..8; adjust retrieved value by -1 */
-static const uint8_t vlc_tab_type30_huffcodes[9] = {
-    0x3c, 0x06, 0x00, 0x01, 0x03, 0x02, 0x04, 0x0c, 0x1c
-};
-
-static const uint8_t vlc_tab_type30_huffbits[9] = {
-    6, 3, 3, 2, 2, 3, 4, 5, 6
-};
-
-/* values in this table range from -1..9; adjust retrieved value by -1 */
-static const uint8_t vlc_tab_type34_huffcodes[10] = {
-    0x18, 0x00, 0x01, 0x04, 0x05, 0x07, 0x03, 0x02, 0x06, 0x08
-};
-
-static const uint8_t vlc_tab_type34_huffbits[10] = {
-    5, 4, 3, 3, 3, 3, 3, 3, 3, 5
-};
-
-/* values in this table range from -1..22; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_fft_tone_offset_0_huffcodes[23] = {
-    0x038e, 0x0001, 0x0000, 0x0022, 0x000a, 0x0006, 0x0012, 0x0002,
-    0x001e, 0x003e, 0x0056, 0x0016, 0x000e, 0x0032, 0x0072, 0x0042,
-    0x008e, 0x004e, 0x00f2, 0x002e, 0x0036, 0x00c2, 0x018e
-};
-
-static const uint8_t vlc_tab_fft_tone_offset_0_huffbits[23] = {
-    10, 1, 2, 6, 4, 5, 6, 7, 6, 6, 7, 7, 8, 7, 8, 8, 9, 7, 8, 6, 6, 8, 10
-};
-
-/* values in this table range from -1..27; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_fft_tone_offset_1_huffcodes[28] = {
-    0x07a4, 0x0001, 0x0020, 0x0012, 0x001c, 0x0008, 0x0006, 0x0010,
-    0x0000, 0x0014, 0x0004, 0x0032, 0x0070, 0x000c, 0x0002, 0x003a,
-    0x001a, 0x002c, 0x002a, 0x0022, 0x0024, 0x000a, 0x0064, 0x0030,
-    0x0062, 0x00a4, 0x01a4, 0x03a4
-};
-
-static const uint8_t vlc_tab_fft_tone_offset_1_huffbits[28] = {
-    11, 1, 6, 6, 5, 4, 3, 6, 6, 5, 6, 6, 7, 6, 6, 6,
-    6, 6, 6, 7, 8, 6, 7, 7, 7, 9, 10, 11
-};
-
-/* values in this table range from -1..31; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_fft_tone_offset_2_huffcodes[32] = {
-    0x1760, 0x0001, 0x0000, 0x0082, 0x000c, 0x0006, 0x0003, 0x0007,
-    0x0008, 0x0004, 0x0010, 0x0012, 0x0022, 0x001a, 0x0000, 0x0020,
-    0x000a, 0x0040, 0x004a, 0x006a, 0x002a, 0x0042, 0x0002, 0x0060,
-    0x00aa, 0x00e0, 0x00c2, 0x01c2, 0x0160, 0x0360, 0x0760, 0x0f60
-};
-
-static const uint8_t vlc_tab_fft_tone_offset_2_huffbits[32] = {
-    13, 2, 0, 8, 4, 3, 3, 3, 4, 4, 5, 5, 6, 5, 7, 7,
-    7, 7, 7, 7, 8, 8, 8, 9, 8, 8, 9, 9, 10, 11, 13, 12
-};
-
-/* values in this table range from -1..34; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_fft_tone_offset_3_huffcodes[35] = {
-    0x33ea, 0x0005, 0x0000, 0x000c, 0x0000, 0x0006, 0x0003, 0x0008,
-    0x0002, 0x0001, 0x0004, 0x0007, 0x001a, 0x000f, 0x001c, 0x002c,
-    0x000a, 0x001d, 0x002d, 0x002a, 0x000d, 0x004c, 0x008c, 0x006a,
-    0x00cd, 0x004d, 0x00ea, 0x020c, 0x030c, 0x010c, 0x01ea, 0x07ea,
-    0x0bea, 0x03ea, 0x13ea
-};
-
-static const uint8_t vlc_tab_fft_tone_offset_3_huffbits[35] = {
-    14, 4, 0, 10, 4, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6,
-    6, 5, 6, 7, 7, 7, 8, 8, 8, 8, 9, 10, 10, 10, 10, 11,
-    12, 13, 14
-};
-
-/* values in this table range from -1..37; adjust retrieved value by -1 */
-static const uint16_t vlc_tab_fft_tone_offset_4_huffcodes[38] = {
-    0x5282, 0x0016, 0x0000, 0x0136, 0x0004, 0x0000, 0x0007, 0x000a,
-    0x000e, 0x0003, 0x0001, 0x000d, 0x0006, 0x0009, 0x0012, 0x0005,
-    0x0025, 0x0022, 0x0015, 0x0002, 0x0076, 0x0035, 0x0042, 0x00c2,
-    0x0182, 0x00b6, 0x0036, 0x03c2, 0x0482, 0x01c2, 0x0682, 0x0882,
-    0x0a82, 0x0082, 0x0282, 0x1282, 0x3282, 0x2282
-};
-
-static const uint8_t vlc_tab_fft_tone_offset_4_huffbits[38] = {
-    15, 6, 0, 9, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 6,
-    6, 6, 6, 8, 7, 6, 8, 9, 9, 8, 9, 10, 11, 10, 11, 12,
-    12, 12, 14, 15, 14, 14
-};
-
-/** FFT TABLES **/
-
-/* values in this table range from -1..27; adjust retrieved value by -1 */
-static const uint16_t fft_level_exp_alt_huffcodes[28] = {
-    0x1ec6, 0x0006, 0x00c2, 0x0142, 0x0242, 0x0246, 0x00c6, 0x0046,
-    0x0042, 0x0146, 0x00a2, 0x0062, 0x0026, 0x0016, 0x000e, 0x0005,
-    0x0004, 0x0003, 0x0000, 0x0001, 0x000a, 0x0012, 0x0002, 0x0022,
-    0x01c6, 0x02c6, 0x06c6, 0x0ec6
-};
-
-static const uint8_t fft_level_exp_alt_huffbits[28] = {
-    13, 7, 8, 9, 10, 10, 10, 10, 10, 9, 8, 7, 6, 5, 4, 3,
-    3, 2, 3, 3, 4, 5, 7, 8, 9, 11, 12, 13
-};
-
-/* values in this table range from -1..19; adjust retrieved value by -1 */
-static const uint16_t fft_level_exp_huffcodes[20] = {
-    0x0f24, 0x0001, 0x0002, 0x0000, 0x0006, 0x0005, 0x0007, 0x000c,
-    0x000b, 0x0014, 0x0013, 0x0004, 0x0003, 0x0023, 0x0064, 0x00a4,
-    0x0024, 0x0124, 0x0324, 0x0724
-};
-
-static const uint8_t fft_level_exp_huffbits[20] = {
-    12, 3, 3, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 8, 9, 10, 11, 12
-};
-
-/* values in this table range from -1..6; adjust retrieved value by -1 */
-static const uint8_t fft_stereo_exp_huffcodes[7] = {
-    0x3e, 0x01, 0x00, 0x02, 0x06, 0x0e, 0x1e
-};
-
-static const uint8_t fft_stereo_exp_huffbits[7] = {
-    6, 1, 2, 3, 4, 5, 6
-};
-
-/* values in this table range from -1..8; adjust retrieved value by -1 */
-static const uint8_t fft_stereo_phase_huffcodes[9] = {
-    0x35, 0x02, 0x00, 0x01, 0x0d, 0x15, 0x05, 0x09, 0x03
-};
-
-static const uint8_t fft_stereo_phase_huffbits[9] = {
-    6, 2, 2, 4, 4, 6, 5, 4, 2
-};
-
-static const int fft_cutoff_index_table[4][2] = {
-    { 1, 2 }, {-1, 0 }, {-1,-2 }, { 0, 0 }
-};
-
-static const int16_t fft_level_index_table[256] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
-    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-};
-
-static const uint8_t last_coeff[3] = {
-    4, 7, 10
-};
-
-static const uint8_t coeff_per_sb_for_avg[3][30] = {
-    { 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
-    { 0, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 },
-    { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9 }
-};
-
-static const uint32_t dequant_table[3][10][30] = {
-    { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 256, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 51, 102, 154, 205, 256, 238, 219, 201, 183, 165, 146, 128, 110, 91, 73, 55, 37, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 18, 37, 55, 73, 91, 110, 128, 146, 165, 183, 201, 219, 238, 256, 228, 199, 171, 142, 114, 85, 57, 28 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
-    { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 85, 171, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 85, 171, 256, 219, 183, 146, 110, 73, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 73, 110, 146, 183, 219, 256, 228, 199, 171, 142, 114, 85, 57, 28, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 57, 85, 114, 142, 171, 199, 228, 256, 213, 171, 128, 85, 43 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
-    { { 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 256, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 256, 171, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 85, 171, 256, 192, 128, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 128, 192, 256, 205, 154, 102, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 102, 154, 205, 256, 213, 171, 128, 85, 43, 0, 0, 0, 0, 0, 0 },
-      { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 85, 128, 171, 213, 256, 213, 171, 128, 85, 43 } }
-};
-
-static const uint8_t coeff_per_sb_for_dequant[3][30] = {
-    { 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3 },
-    { 0, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6 },
-    { 0, 1, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9 }
-};
-
-/* first index is subband, 2nd index is 0, 1 or 3 (2 is unused) */
-static const int8_t tone_level_idx_offset_table[30][4] = {
-    { -50, -50,  0, -50 },
-    { -50, -50,  0, -50 },
-    { -50,  -9,  0, -19 },
-    { -16,  -6,  0, -12 },
-    { -11,  -4,  0,  -8 },
-    {  -8,  -3,  0,  -6 },
-    {  -7,  -3,  0,  -5 },
-    {  -6,  -2,  0,  -4 },
-    {  -5,  -2,  0,  -3 },
-    {  -4,  -1,  0,  -3 },
-    {  -4,  -1,  0,  -2 },
-    {  -3,  -1,  0,  -2 },
-    {  -3,  -1,  0,  -2 },
-    {  -3,  -1,  0,  -2 },
-    {  -2,  -1,  0,  -1 },
-    {  -2,  -1,  0,  -1 },
-    {  -2,  -1,  0,  -1 },
-    {  -2,   0,  0,  -1 },
-    {  -2,   0,  0,  -1 },
-    {  -1,   0,  0,  -1 },
-    {  -1,   0,  0,  -1 },
-    {  -1,   0,  0,  -1 },
-    {  -1,   0,  0,  -1 },
-    {  -1,   0,  0,  -1 },
-    {  -1,   0,  0,  -1 },
-    {  -1,   0,  0,  -1 },
-    {  -1,   0,  0,   0 },
-    {  -1,   0,  0,   0 },
-    {  -1,   0,  0,   0 },
-    {  -1,   0,  0,   0 }
-};
-
-/* all my samples have 1st index 0 or 1 */
-/* second index is subband, only indexes 0-29 seem to be used */
-static const int8_t coding_method_table[5][30] = {
-    { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10,
-      10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
-    },
-    { 34, 30, 24, 24, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10,
-      10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
-    },
-    { 34, 30, 30, 30, 24, 24, 16, 16, 16, 16, 16, 16, 10, 10, 10,
-      10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
-    },
-    { 34, 34, 30, 30, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 10, 10, 10, 10, 10, 10, 10, 10
-    },
-    { 34, 34, 30, 30, 30, 30, 30, 30, 24, 24, 24, 24, 24, 24, 24,
-      24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
-    },
-};
-
-static const int vlc_stage3_values[60] = {
-        0,     1,     2,     3,     4,     6,     8,    10,    12,    16,    20,    24,
-       28,    36,    44,    52,    60,    76,    92,   108,   124,   156,   188,   220,
-      252,   316,   380,   444,   508,   636,   764,   892,  1020,  1276,  1532,  1788,
-     2044,  2556,  3068,  3580,  4092,  5116,  6140,  7164,  8188, 10236, 12284, 14332,
-    16380, 20476, 24572, 28668, 32764, 40956, 49148, 57340, 65532, 81916, 98300,114684
-};
-
-static const float fft_tone_sample_table[4][16][5] = {
-    { { .0100000000f,-.0037037037f,-.0020000000f,-.0069444444f,-.0018416207f },
-      { .0416666667f, .0000000000f, .0000000000f,-.0208333333f,-.0123456791f },
-      { .1250000000f, .0558035709f, .0330687836f,-.0164473690f,-.0097465888f },
-      { .1562500000f, .0625000000f, .0370370370f,-.0062500000f,-.0037037037f },
-      { .1996007860f, .0781250000f, .0462962948f, .0022727272f, .0013468013f },
-      { .2000000000f, .0625000000f, .0370370373f, .0208333333f, .0074074073f },
-      { .2127659619f, .0555555556f, .0329218097f, .0208333333f, .0123456791f },
-      { .2173913121f, .0473484844f, .0280583613f, .0347222239f, .0205761325f },
-      { .2173913121f, .0347222239f, .0205761325f, .0473484844f, .0280583613f },
-      { .2127659619f, .0208333333f, .0123456791f, .0555555556f, .0329218097f },
-      { .2000000000f, .0208333333f, .0074074073f, .0625000000f, .0370370370f },
-      { .1996007860f, .0022727272f, .0013468013f, .0781250000f, .0462962948f },
-      { .1562500000f,-.0062500000f,-.0037037037f, .0625000000f, .0370370370f },
-      { .1250000000f,-.0164473690f,-.0097465888f, .0558035709f, .0330687836f },
-      { .0416666667f,-.0208333333f,-.0123456791f, .0000000000f, .0000000000f },
-      { .0100000000f,-.0069444444f,-.0018416207f,-.0037037037f,-.0020000000f } },
-
-    { { .0050000000f,-.0200000000f, .0125000000f,-.3030303030f, .0020000000f },
-      { .1041666642f, .0400000000f,-.0250000000f, .0333333333f,-.0200000000f },
-      { .1250000000f, .0100000000f, .0142857144f,-.0500000007f,-.0200000000f },
-      { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f },
-      { .1562500000f,-.0006250000f,-.00049382716f,-.000625000f,-.00049382716f },
-      { .1250000000f,-.0500000000f,-.0200000000f, .0100000000f, .0142857144f },
-      { .1041666667f, .0333333333f,-.0200000000f, .0400000000f,-.0250000000f },
-      { .0050000000f,-.3030303030f, .0020000001f,-.0200000000f, .0125000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } },
-
-    { { .1428571492f, .1250000000f,-.0285714287f,-.0357142873f, .0208333333f },
-      { .1818181818f, .0588235296f, .0333333333f, .0212765951f, .0100000000f },
-      { .1818181818f, .0212765951f, .0100000000f, .0588235296f, .0333333333f },
-      { .1428571492f,-.0357142873f, .0208333333f, .1250000000f,-.0285714287f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } },
-
-    { { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f },
-      { .0000000000f, .0000000000f, .0000000000f, .0000000000f, .0000000000f } }
-};
-
-static const float fft_tone_level_table[2][64] = { {
-/* pow ~ (i > 46) ? 0 : (((((i & 1) ? 431 : 304) << (i >> 1))) / 1024.0); */
-    0.17677669f, 0.42677650f, 0.60355347f, 0.85355347f,
-    1.20710683f, 1.68359375f, 2.37500000f, 3.36718750f,
-    4.75000000f, 6.73437500f, 9.50000000f, 13.4687500f,
-    19.0000000f, 26.9375000f, 38.0000000f, 53.8750000f,
-    76.0000000f, 107.750000f, 152.000000f, 215.500000f,
-    304.000000f, 431.000000f, 608.000000f, 862.000000f,
-    1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f,
-    4864.00000f, 6896.00000f, 9728.00000f, 13792.0000f,
-    19456.0000f, 27584.0000f, 38912.0000f, 55168.0000f,
-    77824.0000f, 110336.000f, 155648.000f, 220672.000f,
-    311296.000f, 441344.000f, 622592.000f, 882688.000f,
-    1245184.00f, 1765376.00f, 2490368.00f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
-  }, {
-/* pow = (i > 45) ? 0 : ((((i & 1) ? 431 : 304) << (i >> 1)) / 512.0); */
-    0.59375000f, 0.84179688f, 1.18750000f, 1.68359375f,
-    2.37500000f, 3.36718750f, 4.75000000f, 6.73437500f,
-    9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f,
-    38.0000000f, 53.8750000f, 76.0000000f, 107.750000f,
-    152.000000f, 215.500000f, 304.000000f, 431.000000f,
-    608.000000f, 862.000000f, 1216.00000f, 1724.00000f,
-    2432.00000f, 3448.00000f, 4864.00000f, 6896.00000f,
-    9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f,
-    38912.0000f, 55168.0000f, 77824.0000f, 110336.000f,
-    155648.000f, 220672.000f, 311296.000f, 441344.000f,
-    622592.000f, 882688.000f, 1245184.00f, 1765376.00f,
-    2490368.00f, 3530752.00f, 0.00000000f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f,
-    0.00000000f, 0.00000000f, 0.00000000f, 0.00000000f
-} };
-
-static const float fft_tone_envelope_table[4][31] = {
-    { .009607375f, .038060248f, .084265202f, .146446645f, .222214907f, .308658302f,
-      .402454883f, .500000060f, .597545207f, .691341758f, .777785182f, .853553414f,
-      .915734828f, .961939812f, .990392685f, 1.00000000f, .990392625f, .961939752f,
-      .915734768f, .853553295f, .777785063f, .691341639f, .597545087f, .500000000f,
-      .402454853f, .308658272f, .222214878f, .146446615f, .084265172f, .038060218f,
-      .009607345f },
-    { .038060248f, .146446645f, .308658302f, .500000060f, .691341758f, .853553414f,
-      .961939812f, 1.00000000f, .961939752f, .853553295f, .691341639f, .500000000f,
-      .308658272f, .146446615f, .038060218f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f },
-    { .146446645f, .500000060f, .853553414f, 1.00000000f, .853553295f, .500000000f,
-      .146446615f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f },
-    { .500000060f, 1.00000000f, .500000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f, .000000000f, .000000000f, .000000000f, .000000000f, .000000000f,
-      .000000000f }
-};
-
-static const float sb_noise_attenuation[32] = {
-    0.0f, 0.0f, 0.3f, 0.4f, 0.5f, 0.7f, 1.0f, 1.0f,
-    1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
-    1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
-    1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
-};
-
-static const uint8_t fft_subpackets[32] = {
-    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0
-};
-
-/* first index is joined_stereo, second index is 0 or 2 (1 is unused) */
-static const float dequant_1bit[2][3] = {
-    {-0.920000f, 0.000000f, 0.920000f },
-    {-0.890000f, 0.000000f, 0.890000f }
-};
-
-static const float type30_dequant[8] = {
-   -1.0f,-0.625f,-0.291666656732559f,0.0f,
-   0.25f,0.5f,0.75f,1.0f,
-};
-
-static const float type34_delta[10] = { // FIXME: covers 8 entries..
-    -1.0f,-0.60947573184967f,-0.333333343267441f,-0.138071194291115f,0.0f,
-    0.138071194291115f,0.333333343267441f,0.60947573184967f,1.0f,0.0f,
-};
-
-#endif /* AVCODEC_QDM2DATA_H */
diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c
deleted file mode 100644
index 5750058..0000000
--- a/libavcodec/qdrw.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * QuickDraw (qdrw) codec
- * Copyright (c) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Apple QuickDraw codec.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct QdrawContext{
-    AVCodecContext *avctx;
-    AVFrame pic;
-} QdrawContext;
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    QdrawContext * const a = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&a->pic;
-    uint8_t* outdata;
-    int colors;
-    int i;
-    uint32_t *pal;
-    int r, g, b;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    outdata = a->pic.data[0];
-
-    buf += 0x68; /* jump to palette */
-    colors = AV_RB32(buf);
-    buf += 4;
-
-    if(colors < 0 || colors > 256) {
-        av_log(avctx, AV_LOG_ERROR, "Error color count - %i(0x%X)\n", colors, colors);
-        return -1;
-    }
-
-    pal = (uint32_t*)p->data[1];
-    for (i = 0; i <= colors; i++) {
-        unsigned int idx;
-        idx = AV_RB16(buf); /* color index */
-        buf += 2;
-
-        if (idx > 255) {
-            av_log(avctx, AV_LOG_ERROR, "Palette index out of range: %u\n", idx);
-            buf += 6;
-            continue;
-        }
-        r = *buf++;
-        buf++;
-        g = *buf++;
-        buf++;
-        b = *buf++;
-        buf++;
-        pal[idx] = (r << 16) | (g << 8) | b;
-    }
-    p->palette_has_changed = 1;
-
-    buf += 18; /* skip unneeded data */
-    for (i = 0; i < avctx->height; i++) {
-        int size, left, code, pix;
-        const uint8_t *next;
-        uint8_t *out;
-        int tsize = 0;
-
-        /* decode line */
-        out = outdata;
-        size = AV_RB16(buf); /* size of packed line */
-        buf += 2;
-        left = size;
-        next = buf + size;
-        while (left > 0) {
-            code = *buf++;
-            if (code & 0x80 ) { /* run */
-                pix = *buf++;
-                if ((out + (257 - code)) > (outdata +  a->pic.linesize[0]))
-                    break;
-                memset(out, pix, 257 - code);
-                out += 257 - code;
-                tsize += 257 - code;
-                left -= 2;
-            } else { /* copy */
-                if ((out + code) > (outdata +  a->pic.linesize[0]))
-                    break;
-                memcpy(out, buf, code + 1);
-                out += code + 1;
-                buf += code + 1;
-                left -= 2 + code;
-                tsize += code + 1;
-            }
-        }
-        buf = next;
-        outdata += a->pic.linesize[0];
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = a->pic;
-
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-//    QdrawContext * const a = avctx->priv_data;
-
-    avctx->pix_fmt= PIX_FMT_PAL8;
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    QdrawContext * const a = avctx->priv_data;
-    AVFrame *pic = &a->pic;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    return 0;
-}
-
-AVCodec qdraw_decoder = {
-    "qdraw",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_QDRAW,
-    sizeof(QdrawContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Apple QuickDraw"),
-};
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
deleted file mode 100644
index e6a0b30..0000000
--- a/libavcodec/qpeg.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * QPEG codec
- * Copyright (c) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QPEG codec.
- */
-
-#include "avcodec.h"
-
-typedef struct QpegContext{
-    AVCodecContext *avctx;
-    AVFrame pic;
-    uint8_t *refdata;
-} QpegContext;
-
-static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size,
-                            int stride, int width, int height)
-{
-    int i;
-    int code;
-    int c0, c1;
-    int run, copy;
-    int filled = 0;
-    int rows_to_go;
-
-    rows_to_go = height;
-    height--;
-    dst = dst + height * stride;
-
-    while((size > 0) && (rows_to_go > 0)) {
-        code = *src++;
-        size--;
-        run = copy = 0;
-        if(code == 0xFC) /* end-of-picture code */
-            break;
-        if(code >= 0xF8) { /* very long run */
-            c0 = *src++;
-            c1 = *src++;
-            size -= 2;
-            run = ((code & 0x7) << 16) + (c0 << 8) + c1 + 2;
-        } else if (code >= 0xF0) { /* long run */
-            c0 = *src++;
-            size--;
-            run = ((code & 0xF) << 8) + c0 + 2;
-        } else if (code >= 0xE0) { /* short run */
-            run = (code & 0x1F) + 2;
-        } else if (code >= 0xC0) { /* very long copy */
-            c0 = *src++;
-            c1 = *src++;
-            size -= 2;
-            copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1;
-        } else if (code >= 0x80) { /* long copy */
-            c0 = *src++;
-            size--;
-            copy = ((code & 0x7F) << 8) + c0 + 1;
-        } else { /* short copy */
-            copy = code + 1;
-        }
-
-        /* perform actual run or copy */
-        if(run) {
-            int p;
-
-            p = *src++;
-            size--;
-            for(i = 0; i < run; i++) {
-                dst[filled++] = p;
-                if (filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    rows_to_go--;
-                    if(rows_to_go <= 0)
-                        break;
-                }
-            }
-        } else {
-            size -= copy;
-            for(i = 0; i < copy; i++) {
-                dst[filled++] = *src++;
-                if (filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    rows_to_go--;
-                    if(rows_to_go <= 0)
-                        break;
-                }
-            }
-        }
-    }
-}
-
-static const int qpeg_table_h[16] =
- { 0x00, 0x20, 0x20, 0x20, 0x18, 0x10, 0x10, 0x20, 0x10, 0x08, 0x18, 0x08, 0x08, 0x18, 0x10, 0x04};
-static const int qpeg_table_w[16] =
- { 0x00, 0x20, 0x18, 0x08, 0x18, 0x10, 0x20, 0x10, 0x08, 0x10, 0x20, 0x20, 0x08, 0x10, 0x18, 0x04};
-
-/* Decodes delta frames */
-static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
-                            int stride, int width, int height,
-                            int delta, const uint8_t *ctable, uint8_t *refdata)
-{
-    int i, j;
-    int code;
-    int filled = 0;
-    int orig_height;
-
-    /* copy prev frame */
-    for(i = 0; i < height; i++)
-        memcpy(refdata + (i * width), dst + (i * stride), width);
-
-    orig_height = height;
-    height--;
-    dst = dst + height * stride;
-
-    while((size > 0) && (height >= 0)) {
-        code = *src++;
-        size--;
-
-        if(delta) {
-            /* motion compensation */
-            while((code & 0xF0) == 0xF0) {
-                if(delta == 1) {
-                    int me_idx;
-                    int me_w, me_h, me_x, me_y;
-                    uint8_t *me_plane;
-                    int corr, val;
-
-                    /* get block size by index */
-                    me_idx = code & 0xF;
-                    me_w = qpeg_table_w[me_idx];
-                    me_h = qpeg_table_h[me_idx];
-
-                    /* extract motion vector */
-                    corr = *src++;
-                    size--;
-
-                    val = corr >> 4;
-                    if(val > 7)
-                        val -= 16;
-                    me_x = val;
-
-                    val = corr & 0xF;
-                    if(val > 7)
-                        val -= 16;
-                    me_y = val;
-
-                    /* check motion vector */
-                    if ((me_x + filled < 0) || (me_x + me_w + filled > width) ||
-                       (height - me_y - me_h < 0) || (height - me_y > orig_height) ||
-                       (filled + me_w > width) || (height - me_h < 0))
-                        av_log(NULL, AV_LOG_ERROR, "Bogus motion vector (%i,%i), block size %ix%i at %i,%i\n",
-                               me_x, me_y, me_w, me_h, filled, height);
-                    else {
-                        /* do motion compensation */
-                        me_plane = refdata + (filled + me_x) + (height - me_y) * width;
-                        for(j = 0; j < me_h; j++) {
-                            for(i = 0; i < me_w; i++)
-                                dst[filled + i - (j * stride)] = me_plane[i - (j * width)];
-                        }
-                    }
-                }
-                code = *src++;
-                size--;
-            }
-        }
-
-        if(code == 0xE0) /* end-of-picture code */
-            break;
-        if(code > 0xE0) { /* run code: 0xE1..0xFF */
-            int p;
-
-            code &= 0x1F;
-            p = *src++;
-            size--;
-            for(i = 0; i <= code; i++) {
-                dst[filled++] = p;
-                if(filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    height--;
-                }
-            }
-        } else if(code >= 0xC0) { /* copy code: 0xC0..0xDF */
-            code &= 0x1F;
-
-            for(i = 0; i <= code; i++) {
-                dst[filled++] = *src++;
-                if(filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    height--;
-                }
-            }
-            size -= code + 1;
-        } else if(code >= 0x80) { /* skip code: 0x80..0xBF */
-            int skip;
-
-            code &= 0x3F;
-            /* codes 0x80 and 0x81 are actually escape codes,
-               skip value minus constant is in the next byte */
-            if(!code)
-                skip = (*src++) + 64;
-            else if(code == 1)
-                skip = (*src++) + 320;
-            else
-                skip = code;
-            filled += skip;
-            while( filled >= width) {
-                filled -= width;
-                dst -= stride;
-                height--;
-                if(height < 0)
-                    break;
-            }
-        } else {
-            /* zero code treated as one-pixel skip */
-            if(code)
-                dst[filled++] = ctable[code & 0x7F];
-            else
-                filled++;
-            if(filled >= width) {
-                filled = 0;
-                dst -= stride;
-                height--;
-            }
-        }
-    }
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    QpegContext * const a = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&a->pic;
-    uint8_t* outdata;
-    int delta;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    outdata = a->pic.data[0];
-    if(buf[0x85] == 0x10) {
-        qpeg_decode_intra(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height);
-    } else {
-        delta = buf[0x85];
-        qpeg_decode_inter(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height, delta, buf + 4, a->refdata);
-    }
-
-    /* make the palette available on the way out */
-    memcpy(a->pic.data[1], a->avctx->palctrl->palette, AVPALETTE_SIZE);
-    if (a->avctx->palctrl->palette_changed) {
-        a->pic.palette_has_changed = 1;
-        a->avctx->palctrl->palette_changed = 0;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = a->pic;
-
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-    QpegContext * const a = avctx->priv_data;
-
-    if (!avctx->palctrl) {
-        av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n");
-        return -1;
-    }
-    a->avctx = avctx;
-    avctx->pix_fmt= PIX_FMT_PAL8;
-    a->refdata = av_malloc(avctx->width * avctx->height);
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    QpegContext * const a = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&a->pic;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    av_free(a->refdata);
-    return 0;
-}
-
-AVCodec qpeg_decoder = {
-    "qpeg",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_QPEG,
-    sizeof(QpegContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"),
-};
diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
deleted file mode 100644
index 1fd9a80..0000000
--- a/libavcodec/qtrle.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/*
- * Quicktime Animation (RLE) Video Decoder
- * Copyright (C) 2004 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QT RLE Video Decoder by Mike Melanson (melanson at pcisys.net)
- * For more information about the QT RLE format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *
- * The QT RLE decoder has seven modes of operation:
- * 1, 2, 4, 8, 16, 24, and 32 bits per pixel. For modes 1, 2, 4, and 8
- * the decoder outputs PAL8 colorspace data. 16-bit data yields RGB555
- * data. 24-bit data is RGB24 and 32-bit data is RGB32.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct QtrleContext {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *buf;
-    int size;
-
-} QtrleContext;
-
-#define CHECK_STREAM_PTR(n) \
-  if ((stream_ptr + n) > s->size) { \
-    av_log (s->avctx, AV_LOG_INFO, "Problem: stream_ptr out of bounds (%d >= %d)\n", \
-      stream_ptr + n, s->size); \
-    return; \
-  }
-
-#define CHECK_PIXEL_PTR(n) \
-  if ((pixel_ptr + n > pixel_limit) || (pixel_ptr + n < 0)) { \
-    av_log (s->avctx, AV_LOG_INFO, "Problem: pixel_ptr = %d, pixel_limit = %d\n", \
-      pixel_ptr + n, pixel_limit); \
-    return; \
-  } \
-
-static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
-{
-    int rle_code;
-    int pixel_ptr = 0;
-    int row_inc = s->frame.linesize[0];
-    unsigned char pi0, pi1;  /* 2 8-pixel values */
-    unsigned char *rgb = s->frame.data[0];
-    int pixel_limit = s->frame.linesize[0] * s->avctx->height;
-    int skip;
-
-    while (lines_to_change) {
-        CHECK_STREAM_PTR(2);
-        skip = s->buf[stream_ptr++];
-        rle_code = (signed char)s->buf[stream_ptr++];
-        if (rle_code == 0)
-            break;
-        if(skip & 0x80) {
-            lines_to_change--;
-            row_ptr += row_inc;
-            pixel_ptr = row_ptr + 2 * (skip & 0x7f);
-        } else
-            pixel_ptr += 2 * skip;
-        CHECK_PIXEL_PTR(0);  /* make sure pixel_ptr is positive */
-
-        if (rle_code < 0) {
-            /* decode the run length code */
-            rle_code = -rle_code;
-            /* get the next 2 bytes from the stream, treat them as groups
-             * of 8 pixels, and output them rle_code times */
-            CHECK_STREAM_PTR(2);
-            pi0 = s->buf[stream_ptr++];
-            pi1 = s->buf[stream_ptr++];
-            CHECK_PIXEL_PTR(rle_code * 2);
-
-            while (rle_code--) {
-                rgb[pixel_ptr++] = pi0;
-                rgb[pixel_ptr++] = pi1;
-            }
-        } else {
-            /* copy the same pixel directly to output 2 times */
-            rle_code *= 2;
-            CHECK_STREAM_PTR(rle_code);
-            CHECK_PIXEL_PTR(rle_code);
-
-            while (rle_code--)
-                rgb[pixel_ptr++] = s->buf[stream_ptr++];
-        }
-    }
-}
-
-static inline void qtrle_decode_2n4bpp(QtrleContext *s, int stream_ptr,
-                             int row_ptr, int lines_to_change, int bpp)
-{
-    int rle_code, i;
-    int pixel_ptr;
-    int row_inc = s->frame.linesize[0];
-    unsigned char pi[16];  /* 16 palette indices */
-    unsigned char *rgb = s->frame.data[0];
-    int pixel_limit = s->frame.linesize[0] * s->avctx->height;
-    int num_pixels = (bpp == 4) ? 8 : 16;
-
-    while (lines_to_change--) {
-        CHECK_STREAM_PTR(2);
-        pixel_ptr = row_ptr + (num_pixels * (s->buf[stream_ptr++] - 1));
-
-        while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
-            if (rle_code == 0) {
-                /* there's another skip code in the stream */
-                CHECK_STREAM_PTR(1);
-                pixel_ptr += (num_pixels * (s->buf[stream_ptr++] - 1));
-                CHECK_PIXEL_PTR(0);  /* make sure pixel_ptr is positive */
-            } else if (rle_code < 0) {
-                /* decode the run length code */
-                rle_code = -rle_code;
-                /* get the next 4 bytes from the stream, treat them as palette
-                 * indexes, and output them rle_code times */
-                CHECK_STREAM_PTR(4);
-                for (i = num_pixels-1; i >= 0; i--) {
-                    pi[num_pixels-1-i] = (s->buf[stream_ptr] >> ((i*bpp) & 0x07)) & ((1<<bpp)-1);
-                    stream_ptr+= ((i & ((num_pixels>>2)-1)) == 0);
-                }
-                CHECK_PIXEL_PTR(rle_code * num_pixels);
-                while (rle_code--) {
-                    for (i = 0; i < num_pixels; i++)
-                        rgb[pixel_ptr++] = pi[i];
-                }
-            } else {
-                /* copy the same pixel directly to output 4 times */
-                rle_code *= 4;
-                CHECK_STREAM_PTR(rle_code);
-                CHECK_PIXEL_PTR(rle_code*(num_pixels>>2));
-                while (rle_code--) {
-                    if(bpp == 4) {
-                        rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 4) & 0x0f;
-                        rgb[pixel_ptr++] = (s->buf[stream_ptr++]) & 0x0f;
-                    } else {
-                        rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 6) & 0x03;
-                        rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 4) & 0x03;
-                        rgb[pixel_ptr++] = ((s->buf[stream_ptr]) >> 2) & 0x03;
-                        rgb[pixel_ptr++] = (s->buf[stream_ptr++]) & 0x03;
-                    }
-                }
-            }
-        }
-        row_ptr += row_inc;
-    }
-}
-
-static void qtrle_decode_8bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
-{
-    int rle_code;
-    int pixel_ptr;
-    int row_inc = s->frame.linesize[0];
-    unsigned char pi1, pi2, pi3, pi4;  /* 4 palette indexes */
-    unsigned char *rgb = s->frame.data[0];
-    int pixel_limit = s->frame.linesize[0] * s->avctx->height;
-
-    while (lines_to_change--) {
-        CHECK_STREAM_PTR(2);
-        pixel_ptr = row_ptr + (4 * (s->buf[stream_ptr++] - 1));
-
-        while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
-            if (rle_code == 0) {
-                /* there's another skip code in the stream */
-                CHECK_STREAM_PTR(1);
-                pixel_ptr += (4 * (s->buf[stream_ptr++] - 1));
-                CHECK_PIXEL_PTR(0);  /* make sure pixel_ptr is positive */
-            } else if (rle_code < 0) {
-                /* decode the run length code */
-                rle_code = -rle_code;
-                /* get the next 4 bytes from the stream, treat them as palette
-                 * indexes, and output them rle_code times */
-                CHECK_STREAM_PTR(4);
-                pi1 = s->buf[stream_ptr++];
-                pi2 = s->buf[stream_ptr++];
-                pi3 = s->buf[stream_ptr++];
-                pi4 = s->buf[stream_ptr++];
-
-                CHECK_PIXEL_PTR(rle_code * 4);
-
-                while (rle_code--) {
-                    rgb[pixel_ptr++] = pi1;
-                    rgb[pixel_ptr++] = pi2;
-                    rgb[pixel_ptr++] = pi3;
-                    rgb[pixel_ptr++] = pi4;
-                }
-            } else {
-                /* copy the same pixel directly to output 4 times */
-                rle_code *= 4;
-                CHECK_STREAM_PTR(rle_code);
-                CHECK_PIXEL_PTR(rle_code);
-
-                while (rle_code--) {
-                    rgb[pixel_ptr++] = s->buf[stream_ptr++];
-                }
-            }
-        }
-        row_ptr += row_inc;
-    }
-}
-
-static void qtrle_decode_16bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
-{
-    int rle_code;
-    int pixel_ptr;
-    int row_inc = s->frame.linesize[0];
-    unsigned short rgb16;
-    unsigned char *rgb = s->frame.data[0];
-    int pixel_limit = s->frame.linesize[0] * s->avctx->height;
-
-    while (lines_to_change--) {
-        CHECK_STREAM_PTR(2);
-        pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 2;
-
-        while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
-            if (rle_code == 0) {
-                /* there's another skip code in the stream */
-                CHECK_STREAM_PTR(1);
-                pixel_ptr += (s->buf[stream_ptr++] - 1) * 2;
-                CHECK_PIXEL_PTR(0);  /* make sure pixel_ptr is positive */
-            } else if (rle_code < 0) {
-                /* decode the run length code */
-                rle_code = -rle_code;
-                CHECK_STREAM_PTR(2);
-                rgb16 = AV_RB16(&s->buf[stream_ptr]);
-                stream_ptr += 2;
-
-                CHECK_PIXEL_PTR(rle_code * 2);
-
-                while (rle_code--) {
-                    *(unsigned short *)(&rgb[pixel_ptr]) = rgb16;
-                    pixel_ptr += 2;
-                }
-            } else {
-                CHECK_STREAM_PTR(rle_code * 2);
-                CHECK_PIXEL_PTR(rle_code * 2);
-
-                /* copy pixels directly to output */
-                while (rle_code--) {
-                    rgb16 = AV_RB16(&s->buf[stream_ptr]);
-                    stream_ptr += 2;
-                    *(unsigned short *)(&rgb[pixel_ptr]) = rgb16;
-                    pixel_ptr += 2;
-                }
-            }
-        }
-        row_ptr += row_inc;
-    }
-}
-
-static void qtrle_decode_24bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
-{
-    int rle_code;
-    int pixel_ptr;
-    int row_inc = s->frame.linesize[0];
-    unsigned char r, g, b;
-    unsigned char *rgb = s->frame.data[0];
-    int pixel_limit = s->frame.linesize[0] * s->avctx->height;
-
-    while (lines_to_change--) {
-        CHECK_STREAM_PTR(2);
-        pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 3;
-
-        while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
-            if (rle_code == 0) {
-                /* there's another skip code in the stream */
-                CHECK_STREAM_PTR(1);
-                pixel_ptr += (s->buf[stream_ptr++] - 1) * 3;
-                CHECK_PIXEL_PTR(0);  /* make sure pixel_ptr is positive */
-            } else if (rle_code < 0) {
-                /* decode the run length code */
-                rle_code = -rle_code;
-                CHECK_STREAM_PTR(3);
-                r = s->buf[stream_ptr++];
-                g = s->buf[stream_ptr++];
-                b = s->buf[stream_ptr++];
-
-                CHECK_PIXEL_PTR(rle_code * 3);
-
-                while (rle_code--) {
-                    rgb[pixel_ptr++] = r;
-                    rgb[pixel_ptr++] = g;
-                    rgb[pixel_ptr++] = b;
-                }
-            } else {
-                CHECK_STREAM_PTR(rle_code * 3);
-                CHECK_PIXEL_PTR(rle_code * 3);
-
-                /* copy pixels directly to output */
-                while (rle_code--) {
-                    rgb[pixel_ptr++] = s->buf[stream_ptr++];
-                    rgb[pixel_ptr++] = s->buf[stream_ptr++];
-                    rgb[pixel_ptr++] = s->buf[stream_ptr++];
-                }
-            }
-        }
-        row_ptr += row_inc;
-    }
-}
-
-static void qtrle_decode_32bpp(QtrleContext *s, int stream_ptr, int row_ptr, int lines_to_change)
-{
-    int rle_code;
-    int pixel_ptr;
-    int row_inc = s->frame.linesize[0];
-    unsigned char a, r, g, b;
-    unsigned int argb;
-    unsigned char *rgb = s->frame.data[0];
-    int pixel_limit = s->frame.linesize[0] * s->avctx->height;
-
-    while (lines_to_change--) {
-        CHECK_STREAM_PTR(2);
-        pixel_ptr = row_ptr + (s->buf[stream_ptr++] - 1) * 4;
-
-        while ((rle_code = (signed char)s->buf[stream_ptr++]) != -1) {
-            if (rle_code == 0) {
-                /* there's another skip code in the stream */
-                CHECK_STREAM_PTR(1);
-                pixel_ptr += (s->buf[stream_ptr++] - 1) * 4;
-                CHECK_PIXEL_PTR(0);  /* make sure pixel_ptr is positive */
-            } else if (rle_code < 0) {
-                /* decode the run length code */
-                rle_code = -rle_code;
-                CHECK_STREAM_PTR(4);
-                a = s->buf[stream_ptr++];
-                r = s->buf[stream_ptr++];
-                g = s->buf[stream_ptr++];
-                b = s->buf[stream_ptr++];
-                argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
-
-                CHECK_PIXEL_PTR(rle_code * 4);
-
-                while (rle_code--) {
-                    *(unsigned int *)(&rgb[pixel_ptr]) = argb;
-                    pixel_ptr += 4;
-                }
-            } else {
-                CHECK_STREAM_PTR(rle_code * 4);
-                CHECK_PIXEL_PTR(rle_code * 4);
-
-                /* copy pixels directly to output */
-                while (rle_code--) {
-                    a = s->buf[stream_ptr++];
-                    r = s->buf[stream_ptr++];
-                    g = s->buf[stream_ptr++];
-                    b = s->buf[stream_ptr++];
-                    argb = (a << 24) | (r << 16) | (g << 8) | (b << 0);
-                    *(unsigned int *)(&rgb[pixel_ptr]) = argb;
-                    pixel_ptr += 4;
-                }
-            }
-        }
-        row_ptr += row_inc;
-    }
-}
-
-static av_cold int qtrle_decode_init(AVCodecContext *avctx)
-{
-    QtrleContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    switch (avctx->bits_per_coded_sample) {
-    case 1:
-    case 33:
-        avctx->pix_fmt = PIX_FMT_MONOWHITE;
-        break;
-
-    case 2:
-    case 4:
-    case 8:
-    case 34:
-    case 36:
-    case 40:
-        avctx->pix_fmt = PIX_FMT_PAL8;
-        break;
-
-    case 16:
-        avctx->pix_fmt = PIX_FMT_RGB555;
-        break;
-
-    case 24:
-        avctx->pix_fmt = PIX_FMT_RGB24;
-        break;
-
-    case 32:
-        avctx->pix_fmt = PIX_FMT_RGB32;
-        break;
-
-    default:
-        av_log (avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
-            avctx->bits_per_coded_sample);
-        break;
-    }
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int qtrle_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    QtrleContext *s = avctx->priv_data;
-    int header, start_line;
-    int stream_ptr, height, row_ptr;
-    int has_palette = 0;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
-                            FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
-        av_log (s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    /* check if this frame is even supposed to change */
-    if (s->size < 8)
-        goto done;
-
-    /* start after the chunk size */
-    stream_ptr = 4;
-
-    /* fetch the header */
-    header = AV_RB16(&s->buf[stream_ptr]);
-    stream_ptr += 2;
-
-    /* if a header is present, fetch additional decoding parameters */
-    if (header & 0x0008) {
-        if(s->size < 14)
-            goto done;
-        start_line = AV_RB16(&s->buf[stream_ptr]);
-        stream_ptr += 4;
-        height = AV_RB16(&s->buf[stream_ptr]);
-        stream_ptr += 4;
-    } else {
-        start_line = 0;
-        height = s->avctx->height;
-    }
-    row_ptr = s->frame.linesize[0] * start_line;
-
-    switch (avctx->bits_per_coded_sample) {
-    case 1:
-    case 33:
-        qtrle_decode_1bpp(s, stream_ptr, row_ptr, height);
-        break;
-
-    case 2:
-    case 34:
-        qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 2);
-        has_palette = 1;
-        break;
-
-    case 4:
-    case 36:
-        qtrle_decode_2n4bpp(s, stream_ptr, row_ptr, height, 4);
-        has_palette = 1;
-        break;
-
-    case 8:
-    case 40:
-        qtrle_decode_8bpp(s, stream_ptr, row_ptr, height);
-        has_palette = 1;
-        break;
-
-    case 16:
-        qtrle_decode_16bpp(s, stream_ptr, row_ptr, height);
-        break;
-
-    case 24:
-        qtrle_decode_24bpp(s, stream_ptr, row_ptr, height);
-        break;
-
-    case 32:
-        qtrle_decode_32bpp(s, stream_ptr, row_ptr, height);
-        break;
-
-    default:
-        av_log (s->avctx, AV_LOG_ERROR, "Unsupported colorspace: %d bits/sample?\n",
-            avctx->bits_per_coded_sample);
-        break;
-    }
-
-    if(has_palette) {
-        /* make the palette available on the way out */
-        memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
-        if (s->avctx->palctrl->palette_changed) {
-            s->frame.palette_has_changed = 1;
-            s->avctx->palctrl->palette_changed = 0;
-        }
-    }
-
-done:
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int qtrle_decode_end(AVCodecContext *avctx)
-{
-    QtrleContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec qtrle_decoder = {
-    "qtrle",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_QTRLE,
-    sizeof(QtrleContext),
-    qtrle_decode_init,
-    NULL,
-    qtrle_decode_end,
-    qtrle_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
-};
-
diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
deleted file mode 100644
index 7f95c7f..0000000
--- a/libavcodec/qtrleenc.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * Quicktime Animation (RLE) Video Encoder
- * Copyright (C) 2007 Clemens Fruhwirth
- * Copyright (C) 2007 Alexis Ballier
- *
- * This file is based on flashsvenc.c.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-/** Maximum RLE code for bulk copy */
-#define MAX_RLE_BULK   127
-/** Maximum RLE code for repeat */
-#define MAX_RLE_REPEAT 128
-/** Maximum RLE code for skip */
-#define MAX_RLE_SKIP   254
-
-typedef struct QtrleEncContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    int pixel_size;
-    AVPicture previous_frame;
-    unsigned int max_buf_size;
-    /**
-     * This array will contain at ith position the value of the best RLE code
-     * if the line started at pixel i
-     * There can be 3 values :
-     * skip (0)     : skip as much as possible pixels because they are equal to the
-     *                previous frame ones
-     * repeat (<-1) : repeat that pixel -rle_code times, still as much as
-     *                possible
-     * copy (>0)    : copy the raw next rle_code pixels */
-    signed char *rlecode_table;
-    /**
-     * This array will contain the length of the best rle encoding of the line
-     * starting at ith pixel */
-    int *length_table;
-    /**
-     * Will contain at ith position the number of consecutive pixels equal to the previous
-     * frame starting from pixel i */
-    uint8_t* skip_table;
-} QtrleEncContext;
-
-static av_cold int qtrle_encode_init(AVCodecContext *avctx)
-{
-    QtrleEncContext *s = avctx->priv_data;
-
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return -1;
-    }
-    s->avctx=avctx;
-
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_RGB555BE:
-        s->pixel_size = 2;
-        break;
-    case PIX_FMT_RGB24:
-        s->pixel_size = 3;
-        break;
-    case PIX_FMT_ARGB:
-        s->pixel_size = 4;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Unsupported colorspace.\n");
-        break;
-    }
-    avctx->bits_per_coded_sample = s->pixel_size*8;
-
-    s->rlecode_table = av_mallocz(s->avctx->width);
-    s->skip_table    = av_mallocz(s->avctx->width);
-    s->length_table  = av_mallocz((s->avctx->width + 1)*sizeof(int));
-    if (!s->skip_table || !s->length_table || !s->rlecode_table) {
-        av_log(avctx, AV_LOG_ERROR, "Error allocating memory.\n");
-        return -1;
-    }
-    if (avpicture_alloc(&s->previous_frame, avctx->pix_fmt, avctx->width, avctx->height) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Error allocating picture\n");
-        return -1;
-    }
-
-    s->max_buf_size = s->avctx->width*s->avctx->height*s->pixel_size /* image base material */
-                      + 15                                           /* header + footer */
-                      + s->avctx->height*2                           /* skip code+rle end */
-                      + s->avctx->width/MAX_RLE_BULK + 1             /* rle codes */;
-    avctx->coded_frame = &s->frame;
-    return 0;
-}
-
-/**
- * Computes the best RLE sequence for a line
- */
-static void qtrle_encode_line(QtrleEncContext *s, AVFrame *p, int line, uint8_t **buf)
-{
-    int width=s->avctx->width;
-    int i;
-    signed char rlecode;
-
-    /* We will use it to compute the best bulk copy sequence */
-    unsigned int bulkcount;
-    /* This will be the number of pixels equal to the preivous frame one's
-     * starting from the ith pixel */
-    unsigned int skipcount;
-    /* This will be the number of consecutive equal pixels in the current
-     * frame, starting from the ith one also */
-    unsigned int av_uninit(repeatcount);
-
-    /* The cost of the three different possibilities */
-    int total_bulk_cost;
-    int total_skip_cost;
-    int total_repeat_cost;
-
-    int temp_cost;
-    int j;
-
-    uint8_t *this_line = p->               data[0] + line*p->               linesize[0] +
-        (width - 1)*s->pixel_size;
-    uint8_t *prev_line = s->previous_frame.data[0] + line*s->previous_frame.linesize[0] +
-        (width - 1)*s->pixel_size;
-
-    s->length_table[width] = 0;
-    skipcount = 0;
-
-    for (i = width - 1; i >= 0; i--) {
-
-        if (!s->frame.key_frame && !memcmp(this_line, prev_line, s->pixel_size))
-            skipcount = FFMIN(skipcount + 1, MAX_RLE_SKIP);
-        else
-            skipcount = 0;
-
-        total_skip_cost  = s->length_table[i + skipcount] + 2;
-        s->skip_table[i] = skipcount;
-
-
-        if (i < width - 1 && !memcmp(this_line, this_line + s->pixel_size, s->pixel_size))
-            repeatcount = FFMIN(repeatcount + 1, MAX_RLE_REPEAT);
-        else
-            repeatcount = 1;
-
-        total_repeat_cost = s->length_table[i + repeatcount] + 1 + s->pixel_size;
-
-        /* skip code is free for the first pixel, it costs one byte for repeat and bulk copy
-         * so let's make it aware */
-        if (i == 0) {
-            total_skip_cost--;
-            total_repeat_cost++;
-        }
-
-        if (repeatcount > 1 && (skipcount == 0 || total_repeat_cost < total_skip_cost)) {
-            /* repeat is the best */
-            s->length_table[i]  = total_repeat_cost;
-            s->rlecode_table[i] = -repeatcount;
-        }
-        else if (skipcount > 0) {
-            /* skip is the best choice here */
-            s->length_table[i]  = total_skip_cost;
-            s->rlecode_table[i] = 0;
-        }
-        else {
-            /* We cannot do neither skip nor repeat
-             * thus we search for the best bulk copy to do */
-
-            int limit = FFMIN(width - i, MAX_RLE_BULK);
-
-            temp_cost = 1 + s->pixel_size + !i;
-            total_bulk_cost = INT_MAX;
-
-            for (j = 1; j <= limit; j++) {
-                if (s->length_table[i + j] + temp_cost < total_bulk_cost) {
-                    /* We have found a better bulk copy ... */
-                    total_bulk_cost = s->length_table[i + j] + temp_cost;
-                    bulkcount = j;
-                }
-                temp_cost += s->pixel_size;
-            }
-
-            s->length_table[i]  = total_bulk_cost;
-            s->rlecode_table[i] = bulkcount;
-        }
-
-        this_line -= s->pixel_size;
-        prev_line -= s->pixel_size;
-    }
-
-    /* Good ! Now we have the best sequence for this line, let's ouput it */
-
-    /* We do a special case for the first pixel so that we avoid testing it in
-     * the whole loop */
-
-    i=0;
-    this_line = p->               data[0] + line*p->linesize[0];
-
-    if (s->rlecode_table[0] == 0) {
-        bytestream_put_byte(buf, s->skip_table[0] + 1);
-        i += s->skip_table[0];
-    }
-    else bytestream_put_byte(buf, 1);
-
-
-    while (i < width) {
-        rlecode = s->rlecode_table[i];
-        bytestream_put_byte(buf, rlecode);
-        if (rlecode == 0) {
-            /* Write a skip sequence */
-            bytestream_put_byte(buf, s->skip_table[i] + 1);
-            i += s->skip_table[i];
-        }
-        else if (rlecode > 0) {
-            /* bulk copy */
-            bytestream_put_buffer(buf, this_line + i*s->pixel_size, rlecode*s->pixel_size);
-            i += rlecode;
-        }
-        else {
-            /* repeat the bits */
-            bytestream_put_buffer(buf, this_line + i*s->pixel_size, s->pixel_size);
-            i -= rlecode;
-        }
-    }
-    bytestream_put_byte(buf, -1); // end RLE line
-}
-
-/** Encodes frame including header */
-static int encode_frame(QtrleEncContext *s, AVFrame *p, uint8_t *buf)
-{
-    int i;
-    int start_line = 0;
-    int end_line = s->avctx->height;
-    uint8_t *orig_buf = buf;
-
-    if (!s->frame.key_frame) {
-        unsigned line_size = s->avctx->width * s->pixel_size;
-        for (start_line = 0; start_line < s->avctx->height; start_line++)
-            if (memcmp(p->data[0] + start_line*p->linesize[0],
-                       s->previous_frame.data[0] + start_line*s->previous_frame.linesize[0],
-                       line_size))
-                break;
-
-        for (end_line=s->avctx->height; end_line > start_line; end_line--)
-            if (memcmp(p->data[0] + (end_line - 1)*p->linesize[0],
-                       s->previous_frame.data[0] + (end_line - 1)*s->previous_frame.linesize[0],
-                       line_size))
-                break;
-    }
-
-    bytestream_put_be32(&buf, 0);                         // CHUNK SIZE, patched later
-
-    if ((start_line == 0 && end_line == s->avctx->height) || start_line == s->avctx->height)
-        bytestream_put_be16(&buf, 0);                     // header
-    else {
-        bytestream_put_be16(&buf, 8);                     // header
-        bytestream_put_be16(&buf, start_line);            // starting line
-        bytestream_put_be16(&buf, 0);                     // unknown
-        bytestream_put_be16(&buf, end_line - start_line); // lines to update
-        bytestream_put_be16(&buf, 0);                     // unknown
-    }
-    for (i = start_line; i < end_line; i++)
-        qtrle_encode_line(s, p, i, &buf);
-
-    bytestream_put_byte(&buf, 0);                         // zero skip code = frame finished
-    AV_WB32(orig_buf, buf - orig_buf);                    // patch the chunk size
-    return buf - orig_buf;
-}
-
-static int qtrle_encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
-{
-    QtrleEncContext * const s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p = &s->frame;
-    int chunksize;
-
-    *p = *pict;
-
-    if (buf_size < s->max_buf_size) {
-        /* Upper bound check for compressed data */
-        av_log(avctx, AV_LOG_ERROR, "buf_size %d <  %d\n", buf_size, s->max_buf_size);
-        return -1;
-    }
-
-    if (avctx->gop_size == 0 || (s->avctx->frame_number % avctx->gop_size) == 0) {
-        /* I-Frame */
-        p->pict_type = FF_I_TYPE;
-        p->key_frame = 1;
-    } else {
-        /* P-Frame */
-        p->pict_type = FF_P_TYPE;
-        p->key_frame = 0;
-    }
-
-    chunksize = encode_frame(s, pict, buf);
-
-    /* save the current frame */
-    av_picture_copy(&s->previous_frame, (AVPicture *)p, avctx->pix_fmt, avctx->width, avctx->height);
-    return chunksize;
-}
-
-static av_cold int qtrle_encode_end(AVCodecContext *avctx)
-{
-    QtrleEncContext *s = avctx->priv_data;
-
-    avpicture_free(&s->previous_frame);
-    av_free(s->rlecode_table);
-    av_free(s->length_table);
-    av_free(s->skip_table);
-    return 0;
-}
-
-AVCodec qtrle_encoder = {
-    "qtrle",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_QTRLE,
-    sizeof(QtrleEncContext),
-    qtrle_encode_init,
-    qtrle_encode_frame,
-    qtrle_encode_end,
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB555BE, PIX_FMT_ARGB, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"),
-};
diff --git a/libavcodec/r210dec.c b/libavcodec/r210dec.c
deleted file mode 100644
index 416f764..0000000
--- a/libavcodec/r210dec.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * R210 decoder
- *
- * Copyright (c) 2009 Reimar Doeffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "libavutil/bswap.h"
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    avctx->pix_fmt             = PIX_FMT_RGB48;
-    avctx->bits_per_raw_sample = 10;
-
-    avctx->coded_frame         = avcodec_alloc_frame();
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    int h, w;
-    AVFrame *pic = avctx->coded_frame;
-    const uint32_t *src = (const uint32_t *)avpkt->data;
-    int aligned_width = FFALIGN(avctx->width, 64);
-    uint8_t *dst_line;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    if (avpkt->size < 4 * aligned_width * avctx->height) {
-        av_log(avctx, AV_LOG_ERROR, "packet too small\n");
-        return -1;
-    }
-
-    pic->reference = 0;
-    if (avctx->get_buffer(avctx, pic) < 0)
-        return -1;
-
-    pic->pict_type = FF_I_TYPE;
-    pic->key_frame = 1;
-    dst_line = pic->data[0];
-
-    for (h = 0; h < avctx->height; h++) {
-        uint16_t *dst = (uint16_t *)dst_line;
-        for (w = 0; w < avctx->width; w++) {
-            uint32_t pixel = be2me_32(*src++);
-            uint16_t r, g, b;
-            b =  pixel <<  6;
-            g = (pixel >>  4) & 0xffc0;
-            r = (pixel >> 14) & 0xffc0;
-            *dst++ = r | (r >> 10);
-            *dst++ = g | (g >> 10);
-            *dst++ = b | (b >> 10);
-        }
-        src += aligned_width - avctx->width;
-        dst_line += pic->linesize[0];
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = *avctx->coded_frame;
-
-    return avpkt->size;
-}
-
-static av_cold int decode_close(AVCodecContext *avctx)
-{
-    AVFrame *pic = avctx->coded_frame;
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-AVCodec r210_decoder = {
-    "r210",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_R210,
-    0,
-    decode_init,
-    NULL,
-    decode_close,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
-};
diff --git a/libavcodec/ra144.c b/libavcodec/ra144.c
deleted file mode 100644
index efa62c4..0000000
--- a/libavcodec/ra144.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Real Audio 1.0 (14.4K)
- *
- * Copyright (c) 2008 Vitor Sessak
- * Copyright (c) 2003 Nick Kurshev
- *     Based on public domain decoder at http://www.honeypot.net/audio
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intmath.h"
-#include "avcodec.h"
-#include "get_bits.h"
-#include "ra144.h"
-#include "celp_filters.h"
-
-#define NBLOCKS         4       ///< number of subblocks within a block
-#define BLOCKSIZE       40      ///< subblock size in 16-bit words
-#define BUFFERSIZE      146     ///< the size of the adaptive codebook
-
-
-typedef struct {
-    AVCodecContext *avctx;
-
-    unsigned int     old_energy;        ///< previous frame energy
-
-    unsigned int     lpc_tables[2][10];
-
-    /** LPC coefficients: lpc_coef[0] is the coefficients of the current frame
-     *  and lpc_coef[1] of the previous one. */
-    unsigned int    *lpc_coef[2];
-
-    unsigned int     lpc_refl_rms[2];
-
-    /** The current subblock padded by the last 10 values of the previous one. */
-    int16_t curr_sblock[50];
-
-    /** Adaptive codebook, its size is two units bigger to avoid a
-     *  buffer overflow. */
-    uint16_t adapt_cb[146+2];
-} RA144Context;
-
-static av_cold int ra144_decode_init(AVCodecContext * avctx)
-{
-    RA144Context *ractx = avctx->priv_data;
-
-    ractx->avctx = avctx;
-
-    ractx->lpc_coef[0] = ractx->lpc_tables[0];
-    ractx->lpc_coef[1] = ractx->lpc_tables[1];
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-/**
- * Evaluate sqrt(x << 24). x must fit in 20 bits. This value is evaluated in an
- * odd way to make the output identical to the binary decoder.
- */
-static int t_sqrt(unsigned int x)
-{
-    int s = 2;
-    while (x > 0xfff) {
-        s++;
-        x >>= 2;
-    }
-
-    return ff_sqrt(x << 20) << s;
-}
-
-/**
- * Evaluate the LPC filter coefficients from the reflection coefficients.
- * Does the inverse of the eval_refl() function.
- */
-static void eval_coefs(int *coefs, const int *refl)
-{
-    int buffer[10];
-    int *b1 = buffer;
-    int *b2 = coefs;
-    int i, j;
-
-    for (i=0; i < 10; i++) {
-        b1[i] = refl[i] << 4;
-
-        for (j=0; j < i; j++)
-            b1[j] = ((refl[i] * b2[i-j-1]) >> 12) + b2[j];
-
-        FFSWAP(int *, b1, b2);
-    }
-
-    for (i=0; i < 10; i++)
-        coefs[i] >>= 4;
-}
-
-/**
- * Copy the last offset values of *source to *target. If those values are not
- * enough to fill the target buffer, fill it with another copy of those values.
- */
-static void copy_and_dup(int16_t *target, const int16_t *source, int offset)
-{
-    source += BUFFERSIZE - offset;
-
-    memcpy(target, source, FFMIN(BLOCKSIZE, offset)*sizeof(*target));
-    if (offset < BLOCKSIZE)
-        memcpy(target + offset, source, (BLOCKSIZE - offset)*sizeof(*target));
-}
-
-/** inverse root mean square */
-static int irms(const int16_t *data)
-{
-    unsigned int i, sum = 0;
-
-    for (i=0; i < BLOCKSIZE; i++)
-        sum += data[i] * data[i];
-
-    if (sum == 0)
-        return 0; /* OOPS - division by zero */
-
-    return 0x20000000 / (t_sqrt(sum) >> 8);
-}
-
-static void add_wav(int16_t *dest, int n, int skip_first, int *m,
-                    const int16_t *s1, const int8_t *s2, const int8_t *s3)
-{
-    int i;
-    int v[3];
-
-    v[0] = 0;
-    for (i=!skip_first; i<3; i++)
-        v[i] = (gain_val_tab[n][i] * m[i]) >> gain_exp_tab[n];
-
-    if (v[0]) {
-        for (i=0; i < BLOCKSIZE; i++)
-            dest[i] = (s1[i]*v[0] + s2[i]*v[1] + s3[i]*v[2]) >> 12;
-    } else {
-        for (i=0; i < BLOCKSIZE; i++)
-            dest[i] = (             s2[i]*v[1] + s3[i]*v[2]) >> 12;
-    }
-}
-
-static unsigned int rescale_rms(unsigned int rms, unsigned int energy)
-{
-    return (rms * energy) >> 10;
-}
-
-static unsigned int rms(const int *data)
-{
-    int i;
-    unsigned int res = 0x10000;
-    int b = 10;
-
-    for (i=0; i < 10; i++) {
-        res = (((0x1000000 - data[i]*data[i]) >> 12) * res) >> 12;
-
-        if (res == 0)
-            return 0;
-
-        while (res <= 0x3fff) {
-            b++;
-            res <<= 2;
-        }
-    }
-
-    return t_sqrt(res) >> b;
-}
-
-static void do_output_subblock(RA144Context *ractx, const uint16_t  *lpc_coefs,
-                               int gval, GetBitContext *gb)
-{
-    uint16_t buffer_a[40];
-    uint16_t *block;
-    int cba_idx = get_bits(gb, 7); // index of the adaptive CB, 0 if none
-    int gain    = get_bits(gb, 8);
-    int cb1_idx = get_bits(gb, 7);
-    int cb2_idx = get_bits(gb, 7);
-    int m[3];
-
-    if (cba_idx) {
-        cba_idx += BLOCKSIZE/2 - 1;
-        copy_and_dup(buffer_a, ractx->adapt_cb, cba_idx);
-        m[0] = (irms(buffer_a) * gval) >> 12;
-    } else {
-        m[0] = 0;
-    }
-
-    m[1] = (cb1_base[cb1_idx] * gval) >> 8;
-    m[2] = (cb2_base[cb2_idx] * gval) >> 8;
-
-    memmove(ractx->adapt_cb, ractx->adapt_cb + BLOCKSIZE,
-            (BUFFERSIZE - BLOCKSIZE) * sizeof(*ractx->adapt_cb));
-
-    block = ractx->adapt_cb + BUFFERSIZE - BLOCKSIZE;
-
-    add_wav(block, gain, cba_idx, m, cba_idx? buffer_a: NULL,
-            cb1_vects[cb1_idx], cb2_vects[cb2_idx]);
-
-    memcpy(ractx->curr_sblock, ractx->curr_sblock + 40,
-           10*sizeof(*ractx->curr_sblock));
-
-    if (ff_celp_lp_synthesis_filter(ractx->curr_sblock + 10, lpc_coefs,
-                                    block, BLOCKSIZE, 10, 1, 0xfff))
-        memset(ractx->curr_sblock, 0, 50*sizeof(*ractx->curr_sblock));
-}
-
-static void int_to_int16(int16_t *out, const int *inp)
-{
-    int i;
-
-    for (i=0; i < 10; i++)
-        *out++ = *inp++;
-}
-
-/**
- * Evaluate the reflection coefficients from the filter coefficients.
- * Does the inverse of the eval_coefs() function.
- *
- * @return 1 if one of the reflection coefficients is greater than
- *         4095, 0 if not.
- */
-static int eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
-{
-    int b, i, j;
-    int buffer1[10];
-    int buffer2[10];
-    int *bp1 = buffer1;
-    int *bp2 = buffer2;
-
-    for (i=0; i < 10; i++)
-        buffer2[i] = coefs[i];
-
-    refl[9] = bp2[9];
-
-    if ((unsigned) bp2[9] + 0x1000 > 0x1fff) {
-        av_log(avctx, AV_LOG_ERROR, "Overflow. Broken sample?\n");
-        return 1;
-    }
-
-    for (i=8; i >= 0; i--) {
-        b = 0x1000-((bp2[i+1] * bp2[i+1]) >> 12);
-
-        if (!b)
-            b = -2;
-
-        for (j=0; j <= i; j++)
-            bp1[j] = ((bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12)) * (0x1000000 / b)) >> 12;
-
-        if ((unsigned) bp1[i] + 0x1000 > 0x1fff)
-            return 1;
-
-        refl[i] = bp1[i];
-
-        FFSWAP(int *, bp1, bp2);
-    }
-    return 0;
-}
-
-static int interp(RA144Context *ractx, int16_t *out, int a,
-                  int copyold, int energy)
-{
-    int work[10];
-    int b = NBLOCKS - a;
-    int i;
-
-    // Interpolate block coefficients from the this frame's forth block and
-    // last frame's forth block.
-    for (i=0; i<10; i++)
-        out[i] = (a * ractx->lpc_coef[0][i] + b * ractx->lpc_coef[1][i])>> 2;
-
-    if (eval_refl(work, out, ractx->avctx)) {
-        // The interpolated coefficients are unstable, copy either new or old
-        // coefficients.
-        int_to_int16(out, ractx->lpc_coef[copyold]);
-        return rescale_rms(ractx->lpc_refl_rms[copyold], energy);
-    } else {
-        return rescale_rms(rms(work), energy);
-    }
-}
-
-/** Uncompress one block (20 bytes -> 160*2 bytes). */
-static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
-                              int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
-    unsigned int refl_rms[4];    // RMS of the reflection coefficients
-    uint16_t block_coefs[4][10]; // LPC coefficients of each sub-block
-    unsigned int lpc_refl[10];   // LPC reflection coefficients of the frame
-    int i, j;
-    int16_t *data = vdata;
-    unsigned int energy;
-
-    RA144Context *ractx = avctx->priv_data;
-    GetBitContext gb;
-
-    if (*data_size < 2*160)
-        return -1;
-
-    if(buf_size < 20) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Frame too small (%d bytes). Truncated file?\n", buf_size);
-        *data_size = 0;
-        return buf_size;
-    }
-    init_get_bits(&gb, buf, 20 * 8);
-
-    for (i=0; i<10; i++)
-        lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])];
-
-    eval_coefs(ractx->lpc_coef[0], lpc_refl);
-    ractx->lpc_refl_rms[0] = rms(lpc_refl);
-
-    energy = energy_tab[get_bits(&gb, 5)];
-
-    refl_rms[0] = interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);
-    refl_rms[1] = interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy,
-                    t_sqrt(energy*ractx->old_energy) >> 12);
-    refl_rms[2] = interp(ractx, block_coefs[2], 3, 0, energy);
-    refl_rms[3] = rescale_rms(ractx->lpc_refl_rms[0], energy);
-
-    int_to_int16(block_coefs[3], ractx->lpc_coef[0]);
-
-    for (i=0; i < 4; i++) {
-        do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb);
-
-        for (j=0; j < BLOCKSIZE; j++)
-            *data++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2);
-    }
-
-    ractx->old_energy = energy;
-    ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0];
-
-    FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]);
-
-    *data_size = 2*160;
-    return 20;
-}
-
-AVCodec ra_144_decoder =
-{
-    "real_144",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_RA_144,
-    sizeof(RA144Context),
-    ra144_decode_init,
-    NULL,
-    NULL,
-    ra144_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
-};
diff --git a/libavcodec/ra144.h b/libavcodec/ra144.h
deleted file mode 100644
index 4413530..0000000
--- a/libavcodec/ra144.h
+++ /dev/null
@@ -1,1506 +0,0 @@
-/*
- * Real Audio 1.0 (14.4K)
- * Copyright (c) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_RA144_H
-#define AVCODEC_RA144_H
-
-#include <stdint.h>
-
-static const int16_t gain_val_tab[256][3] = {
-    { 541, 956,  768}, { 877, 581,  568}, { 675,1574,  635}, {1248,1464,  668},
-    {1246, 839, 1394}, {2560,1386,  991}, { 925, 687,  608}, {2208, 797, 1144},
-    { 535, 832,  799}, { 762, 605, 1154}, { 832,1122, 1003}, {1180, 687, 1176},
-    {1292, 901,  732}, {1656, 689,  896}, {1750,1248,  848}, {2284, 942, 1022},
-    { 824,1472,  643}, { 517, 765,  512}, { 562,1816, 1522}, { 694,1826, 2700},
-    { 704, 524,  672}, {1442, 757, 2232}, { 884, 551, 1266}, {2232,1007, 1692},
-    { 932, 746,  777}, {1132, 822,  926}, {1226, 771,  611}, {2948,1342, 1008},
-    {1302, 594, 1158}, {1602, 636, 1128}, {3408, 910, 1438}, {1996, 614,  575},
-    { 665, 935,  628}, { 631,1192,  829}, { 644, 926, 1052}, { 879, 988, 1226},
-    { 941,2768, 2772}, { 565,1344, 2304}, { 547, 628,  740}, { 639, 532, 1074},
-    { 955,1208,  598}, {1124,1160,  900}, {1206, 899, 1242}, { 746, 533,  624},
-    {1458,1028,  735}, {1706,1102,  692}, {1898,1018, 1004}, {2176, 988,  735},
-    {1578, 782, 1642}, { 897, 516,  754}, {2068, 702, 1656}, {2344, 818, 1526},
-    { 907, 652,  592}, {1056, 652,  642}, {2124,1416,  780}, {2664,1250,  727},
-    {1894, 727, 1108}, {2196, 657,  981}, {4840, 920, 1704}, {4992,1238,  983},
-    {2420, 909, 1094}, {2760, 935, 1032}, {2800, 612,  853}, {3068, 832,  574},
-    { 523,1796,  923}, { 722,1916, 1382}, {1226,1542,  928}, { 758, 757,  584},
-    { 512,1134,  577}, { 615,1276,  698}, { 574,2568, 2356}, { 993,2728, 3512},
-    { 539, 890,  913}, { 694, 928, 1088}, { 805, 600, 1360}, {2160, 951, 3128},
-    { 816, 950,  590}, { 955, 847,  811}, {1094, 883,  556}, {1304, 888,  604},
-    { 863,1170,  855}, {1023, 997, 1032}, { 932,1228, 1280}, { 627, 564,  573},
-    { 876, 900, 1448}, {1030, 857, 1792}, {1294, 953, 1758}, {1612, 854, 1714},
-    {1090,1166,  631}, {1314,1202,  751}, {1480, 905,  795}, {1682,1016,  568},
-    {1494,1178,  983}, { 878, 613,  526}, {1728,1446,  779}, {2136,1348,  774},
-    { 950, 649,  939}, {1180, 703,  899}, {1236, 527, 1158}, {1450, 647,  972},
-    {1282, 647,  707}, {1460, 663,  644}, {1614, 572,  578}, {3516,1222,  821},
-    {2668, 729, 1682}, {3128, 585, 1502}, {3208, 733,  976}, {6800, 871, 1416},
-    {3480, 743, 1408}, {3764, 899, 1170}, {3772, 632,  875}, {4092, 732,  638},
-    {3112, 753, 2620}, {3372, 945, 1890}, {3768, 969, 2288}, {2016, 559,  854},
-    {1736, 729,  787}, {1940, 686,  547}, {2140, 635,  674}, {4480,1272,  828},
-    {3976, 592, 1666}, {4384, 621, 1388}, {4400, 801,  955}, {4656, 522,  646},
-    {4848, 625, 1636}, {4984, 591,  874}, {5352, 535, 1001}, {11216,938, 1184},
-    { 925,3280, 1476}, { 735,1580, 1088}, {1150,1576,  674}, { 655, 783,  528},
-    { 527,2052, 1354}, { 782,1704, 1880}, { 578, 910, 1026}, { 692, 882, 1468},
-    { 586, 683,  715}, { 739, 609,  717}, { 778, 773,  697}, { 922, 785,  813},
-    { 766, 651,  984}, { 978, 596, 1030}, {1070, 757, 1080}, {1324, 687, 1178},
-    {1108,2144,  979}, { 723, 982,  690}, { 936, 956,  527}, {1180,1002,  547},
-    { 517,1306,  825}, { 832,1184,  974}, {1024, 957,  903}, {1262,1090,  906},
-    {1028, 720,  649}, {1192, 679,  694}, {2468,1480,  979}, {2844,1370,  877},
-    {1310, 835,  848}, {1508, 839,  698}, {1742,1030,  769}, {1910, 852,  573},
-    {1280, 859, 1174}, {1584, 863, 1108}, {1686, 708, 1364}, {1942, 768, 1104},
-    { 891, 536,  690}, {1016, 560,  663}, {2172, 870, 1348}, {2404, 999, 1170},
-    {1890, 966,  889}, {2116, 912,  777}, {2296,1020,  714}, {4872,1844,  932},
-    {2392, 778,  929}, {2604, 772,  744}, {2764, 957,  722}, {5832,1532,  984},
-    {2188, 519, 1264}, {2332, 532,  922}, {5064, 995, 2412}, {2708, 571,  874},
-    {2408, 545,  666}, {5016,1084,  875}, {5376, 983, 1196}, {5536, 979,  730},
-    {5344, 634, 1744}, {5688, 706, 1348}, {5912, 977, 1190}, {6072, 905,  763},
-    {6048, 582, 1526}, {11968,1013,1816}, {12864,937, 1900}, {12560,1086, 998},
-    {1998, 684, 1884}, {2504, 633, 1992}, {1252, 567,  835}, {1478, 571,  973},
-    {2620, 769, 1414}, {2808, 952, 1142}, {2908, 712, 1028}, {2976, 686,  741},
-    {1462, 552,  714}, {3296, 991, 1452}, {1590, 615,  544}, {3480,1150,  824},
-    {3212, 832,  923}, {3276, 839,  531}, {3548, 786,  852}, {3732, 764,  570},
-    {5728, 906, 2616}, {6272, 804, 2252}, {3096, 535,  876}, {3228, 598,  649},
-    {6536, 759, 1436}, {6648, 993,  846}, {6864, 567, 1210},{14016,1012, 1302},
-    {3408, 548, 1098}, {7160,1008, 1742}, {7136,1000, 1182}, {7480,1032,  836},
-    {7448, 612, 1552}, {7744, 614,  816}, {8384, 777, 1438}, {8784, 694,  786},
-    { 882,1508, 1068}, { 597, 837,  766}, {1270, 954, 1408}, { 803, 550,  798},
-    {1398,1308,  798}, {1848,1534,  738}, { 970, 675,  608}, {1264, 706,  684},
-    {1716, 767, 1126}, {2108, 765, 1404}, {2236, 924, 1003}, {2472,1048,  611},
-    { 999, 942,  963}, {1094, 857,  935}, {2936, 926, 1138}, {1934, 746,  551},
-    {3336, 633, 1762}, {3764, 701, 1454}, {1890, 564,  636}, {4096,1126,  793},
-    {3936, 556, 1140}, {3936, 540,  740}, {4216, 764,  874}, {8480,1328, 1014},
-    {2184, 515, 1042}, {4432, 934, 1344}, {4784, 945, 1112}, {5016,1062,  733},
-    {9216,1020, 2028}, {9968, 924, 1188}, {5424, 909, 1206}, {6512, 744, 1086}
-};
-
-static const uint8_t gain_exp_tab[256] = {
-   15, 15, 15, 15, 15, 16, 14, 15, 14, 14, 14, 14, 14, 14, 14, 14,
-   14, 13, 14, 14, 13, 14, 13, 14, 13, 13, 13, 14, 13, 13, 14, 13,
-   13, 13, 13, 13, 14, 13, 12, 12, 13, 13, 13, 12, 13, 13, 13, 13,
-   13, 12, 13, 13, 12, 12, 13, 13, 13, 13, 14, 14, 13, 13, 13, 13,
-   13, 13, 13, 12, 12, 12, 13, 13, 12, 12, 12, 13, 12, 12, 12, 12,
-   12, 12, 12, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12,
-   12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 13, 13, 13, 13,
-   13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14,
-   13, 12, 12, 11, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-   12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 11, 11, 11, 11,
-   12, 12, 12, 12, 11, 11, 12, 12, 12, 12, 12, 13, 12, 12, 12, 13,
-   12, 12, 13, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14,
-   12, 12, 11, 11, 12, 12, 12, 12, 11, 12, 11, 12, 12, 12, 12, 12,
-   13, 13, 12, 12, 13, 13, 13, 14, 12, 13, 13, 13, 13, 13, 13, 13,
-   11, 10, 11, 10, 11, 11, 10, 10, 11, 11, 11, 11, 10,  9, 11, 10,
-   12, 12, 11, 12, 12, 12, 12, 13, 11, 12, 12, 12, 13, 13, 12, 12
-};
-
-static const int8_t cb1_vects[128][40]={
-    {
-     38,  -4,  15,  -4,  14, -13,  12, -11,  -2,  -6,
-     -6, -11, -45, -16, -11, -13,  -7,   6, -12,   4,
-    -20,   3, -16,  12,  -1,  12,  46,  24,   0,  33,
-     -3,   9, -12, -12,  -8,  -7,  17,  -6,   0,  -2,
-    }, {
-     60, -16,   3, -22,  10, -32,   0, -28, -17, -18,
-     -3, -25, -37, -23, -10,   3,   2,   3,   0,   3,
-    -14,   0, -14,  -1,   0,   2,  32,   9,  -1,  25,
-      7,  13,  -5,  13,   8,   1,   2,   8, -10,   6,
-    }, {
-     27, -12,  28,  -2,   6,  -7,  15,   9, -11,   1,
-    -13, -11, -40,   4, -29, -14, -19,  -5, -23,  -8,
-    -30, -13, -17,   0, -14,  12,  34,  20,  -2,  25,
-      2, -16,  -4, -12,  15,  16,  29,   7,  24,  10,
-    }, {
-     49, -24,  16, -20,   2, -26,   2,  -7, -25, -10,
-    -11, -25, -32,  -3, -27,   2,  -8,  -8, -11,  -9,
-    -24, -17, -16, -14, -13,   2,  20,   5,  -4,  17,
-     14, -12,   3,  13,  33,  25,  14,  23,  15,  19,
-    }, {
-     46,  -6,  21,   8,  -2, -16,  -5,  -8, -11,   4,
-      8,  15, -24,   4,  -2, -26,  -3, -16, -16, -14,
-     -9,  -2,  -1,   4,  19,   7,  36,  17,   9,  13,
-      0,  31,  -5, -12,   7,  -8,  11, -15, -13,  -4,
-    }, {
-     68, -18,   9,  -9,  -6, -35, -18, -25, -26,  -7,
-     10,   1, -16,  -3,  -1,  -9,   6, -19,  -4, -15,
-     -4,  -6,   0,  -8,  20,  -2,  23,   2,   7,   5,
-     12,  35,   1,  13,  24,   0,  -3,   0, -22,   4,
-    }, {
-     35, -14,  34,  10, -10, -10,  -1,  12, -20,  12,
-      0,  15, -18,  24, -20, -27, -14, -28, -27, -27,
-    -20, -19,  -2,  -8,   5,   7,  25,  13,   5,   5,
-      6,   5,   2, -12,  31,  15,  23,  -1,  12,   8,
-    }, {
-     57, -26,  22,  -7, -14, -28, -14,  -3, -35,   0,
-      3,   1, -11,  16, -18, -10,  -4, -31, -15, -28,
-    -14, -23,  -1, -21,   7,  -2,  11,  -1,   3,  -1,
-     18,   9,  10,  13,  49,  24,   8,  14,   2,  16,
-    }, {
-     25,  15,  22,  11,  18,   4,  15, -22,   8,  -2,
-    -17,  -9, -48, -20, -30, -17, -16,  11,  -1,  16,
-      2,  10,  -5,  26,  -2,  -4,  22,   0,   2,  10,
-     -6,  13, -14,  10, -23,   0,  10,  -2,   1,   0,
-    }, {
-     47,   3,  11,  -6,  15, -13,   2, -38,  -6, -13,
-    -15, -22, -40, -28, -28,   0,  -5,   8,  10,  15,
-      7,   7,  -4,  13,  -1, -14,   9, -14,   0,   2,
-      4,  18,  -7,  36,  -6,   8,  -3,  13,  -7,   8,
-    }, {
-     14,   7,  36,  13,  10,  10,  18,   0,   0,   5,
-    -25,  -8, -43,   0, -48, -18, -27,   0, -12,   3,
-     -7,  -6,  -7,  13, -15,  -5,  11,  -3,   0,   2,
-      0, -12,  -6,  10,   0,  23,  22,  11,  26,  12,
-    }, {
-     36,  -5,  24,  -4,   7,  -7,   6, -17, -14,  -5,
-    -22, -22, -35,  -8, -46,  -1, -17,  -3,   0,   2,
-     -2, -10,  -5,   0, -14, -15,  -2, -18,  -2,  -4,
-     11,  -7,   1,  36,  18,  32,   7,  27,  17,  20,
-    }, {
-     33,  13,  29,  24,   1,   1,  -2, -18,   0,   9,
-     -3,  17, -27,   0, -21, -30, -12, -11,  -5,  -2,
-     12,   4,   9,  19,  18,  -9,  13,  -6,  11,  -8,
-     -2,  35,  -8,  10,  -7,  -1,   4, -11, -10,  -2,
-    }, {
-     55,   1,  17,   6,  -1, -16, -15, -35, -15,  -2,
-      0,   4, -19,  -8, -20, -13,  -1, -14,   7,  -3,
-     18,   0,  10,   5,  19, -19,   0, -21,   8, -16,
-      9,  39,   0,  36,  10,   7,  -9,   4, -20,   5,
-    }, {
-     22,   5,  42,  26,  -6,   8,   1,   2,  -9,  17,
-    -10,  18, -21,  19, -39, -31, -23, -23, -16, -15,
-      2, -12,   7,   6,   5,  -9,   1, -10,   7, -16,
-      4,   9,   0,  10,  17,  22,  16,   2,  14,   9,
-    }, {
-     44,  -6,  30,   8,  -9, -10, -11, -14, -23,   5,
-     -8,   4, -14,  12, -37, -14, -12, -26,  -4, -16,
-      8, -16,   9,  -7,   6, -19, -12, -25,   5, -24,
-     15,  13,   8,  36,  34,  31,   1,  18,   4,  18,
-    }, {
-     -3,  -5,  -9,  -7,  15,  -1,   5,  13,   2,  12,
-      5,   2, -21, -23,  -2, -16,   0,   5,  -6,  13,
-    -23,   3, -32,  10, -15,   8,  44,  28,   9,  37,
-     -2,  13,  -9, -15, -12, -27,  -7, -12,   0, -11,
-    }, {
-     18, -17, -21, -25,  11, -19,  -6,  -3, -11,   0,
-      7, -11, -13, -31,  -1,   0,   9,   1,   5,  12,
-    -18,   0, -31,  -2, -13,  -1,  30,  14,   7,  29,
-      9,  18,  -1,  10,   4, -18, -22,   3, -10,  -2,
-    }, {
-    -13, -13,   3,  -5,   7,   4,   9,  34,  -5,  20,
-     -2,   3, -16,  -3, -20, -17, -11,  -7, -17,   0,
-    -34, -13, -33,  -2, -28,   8,  32,  24,   5,  29,
-      3, -12,   0, -15,  11,  -3,   3,   2,  24,   1,
-    }, {
-      8, -25,  -8, -23,   3, -13,  -3,  17, -20,   8,
-      0, -10,  -8, -11, -18,   0,  -1, -10,  -5,   0,
-    -28, -17, -32, -15, -26,  -1,  19,   9,   3,  21,
-     15,  -7,   6,   9,  29,   5, -10,  17,  15,   9,
-    }, {
-      4,  -6,  -3,   5,  -1,  -4, -11,  16,  -6,  23,
-     19,  29,   0,  -3,   6, -30,   3, -17, -10,  -5,
-    -13,  -2, -17,   3,   5,   3,  35,  21,  17,  17,
-      2,  35,  -2, -15,   3, -28, -13, -21, -13, -13,
-    }, {
-     26, -19, -15, -12,  -5, -22, -24,   0, -21,  12,
-     21,  15,   8, -11,   7, -12,  14, -20,   2,  -6,
-     -7,  -6, -16,  -9,   6,  -5,  21,   7,  15,  10,
-     13,  39,   5,  10,  20, -19, -28,  -5, -22,  -5,
-    }, {
-     -5, -15,   9,   7,  -9,   2,  -8,  37, -14,  31,
-     11,  29,   5,  16, -11, -30,  -7, -29, -21, -18,
-    -23, -19, -18,  -9,  -7,   3,  23,  17,  14,   9,
-      8,   9,   6, -15,  27,  -4,  -2,  -6,  12,  -1,
-    }, {
-     16, -27,  -2, -10, -13, -16, -20,  20, -29,  20,
-     14,  16,  13,   8,  -9, -13,   2, -33,  -9, -19,
-    -17, -23, -17, -22,  -6,  -6,   9,   2,  12,   2,
-     20,  13,  13,  10,  45,   4, -16,   8,   2,   7,
-    }, {
-    -16,  14,  -2,   8,  20,  17,   9,   2,  14,  16,
-     -6,   5, -24, -28, -21, -20,  -8,   9,   4,  25,
-     -1,  11, -22,  24, -15,  -8,  21,   5,  11,  14,
-     -5,  18, -11,   7, -27, -20, -14,  -7,   1,  -9,
-    }, {
-      6,   2, -14,  -9,  16,  -1,  -3, -14,   0,   5,
-     -3,  -8, -16, -36, -19,  -3,   1,   6,  17,  24,
-      4,   7, -21,  11, -14, -18,   7,  -9,   9,   7,
-      6,  22,  -3,  33, -10, -11, -28,   7,  -7,   0,
-    }, {
-    -26,   6,  11,  10,  12,  23,  12,  23,   5,  24,
-    -13,   5, -19,  -8, -38, -21, -20,  -2,  -6,  12,
-    -11,  -5, -23,  11, -29,  -9,   9,   0,   7,   6,
-      1,  -7,  -2,   7,  -3,   3,  -2,   6,  27,   3,
-    }, {
-     -4,  -6,   0,  -7,   8,   4,   0,   6,  -9,  13,
-    -11,  -7, -11, -15, -37,  -4,  -9,  -5,   5,  11,
-     -5,  -9, -22,  -1, -27, -18,  -4, -14,   5,   0,
-     12,  -3,   4,  32,  14,  12, -17,  22,  17,  11,
-    }, {
-     -8,  12,   3,  21,   3,  14,  -8,   5,   4,  28,
-      7,  32,  -2,  -8, -12, -34,  -4, -12,   1,   6,
-      9,   4,  -7,  17,   4, -13,  11,  -1,  19,  -4,
-      0,  39,  -4,   7, -11, -21, -20, -16, -10, -11,
-    }, {
-     13,   0,  -8,   3,   0,  -4, -21, -11,  -9,  16,
-     10,  18,   5, -16, -10, -16,   5, -15,  13,   5,
-     15,   1,  -6,   4,   6, -23,  -2, -16,  17, -12,
-     10,  44,   3,  33,   6, -12, -34,  -1, -20,  -3,
-    }, {
-    -18,   4,  17,  23,  -4,  20,  -4,  26,  -3,  36,
-      0,  32,   2,  12, -29, -34, -16, -24, -10,  -6,
-      0, -12,  -8,   4,  -8, -13,   0,  -6,  16, -12,
-      5,  13,   3,   7,  13,   3,  -8,  -2,  14,   0,
-    }, {
-      3,  -7,   5,   5,  -8,   2, -17,   9, -18,  24,
-      2,  19,  10,   4, -28, -17,  -5, -28,   2,  -7,
-      4, -15,  -7,  -8,  -6, -23, -13, -21,  14, -20,
-     17,  18,  11,  33,  30,  11, -23,  13,   5,   9,
-    }, {
-     60,  10,   7,  -1,   9,  -8,   6, -13,   2, -15,
-     -1, -10, -13, -11,  15,   0,   6,   9,  -1,   0,
-    -13,   1, -11,  -3, -13,  21,  13,  26,  -7,  31,
-    -10,  -7, -16, -33, -31, -10,  22,  -8,   1,  -2,
-    }, {
-     82,  -1,  -4, -19,   6, -27,  -6, -29, -12, -26,
-      1, -24,  -5, -18,  17,  17,  17,   6,  10,   0,
-     -7,  -2,  -9, -16, -12,  11,   0,  11,  -9,  23,
-      0,  -3,  -8,  -8, -13,  -1,   8,   7,  -7,   6,
-    }, {
-     49,   2,  21,   0,   1,  -2,   9,   8,  -6,  -6,
-     -8, -10,  -8,   9,  -2,   0,  -4,  -2, -13, -12,
-    -23, -15, -12, -16, -26,  21,   2,  21, -11,  23,
-     -4, -33,  -7, -33,  -6,  13,  34,   5,  27,  10,
-    }, {
-     71, -10,   9, -17,  -1, -20,  -3,  -8, -21, -18,
-     -6, -24,   0,   1,   0,  16,   6,  -5,   0, -13,
-    -17, -19, -11, -29, -25,  11, -11,   6, -13,  15,
-      7, -29,   0,  -8,  11,  22,  20,  21,  17,  18,
-    }, {
-     67,   8,  14,  11,  -7, -11, -11,  -9,  -7,  -3,
-     13,  16,   8,   9,  24, -12,  10, -13,  -5, -17,
-     -2,  -4,   3, -10,   6,  17,   4,  19,   0,  11,
-     -6,  13,  -9, -33, -14, -10,  16, -17, -10,  -4,
-    }, {
-     90,  -3,   2,  -6, -10, -29, -24, -26, -21, -15,
-     15,   2,  16,   1,  25,   4,  21, -16,   6, -18,
-      3,  -8,   5, -24,   8,   7,  -9,   4,  -1,   3,
-      5,  18,  -1,  -7,   2,  -1,   2,  -1, -19,   3,
-    }, {
-     57,   0,  27,  13, -14,  -5,  -7,  11, -15,   4,
-      5,  16,  13,  29,   6, -13,   0, -25, -16, -31,
-    -12, -22,   2, -23,  -6,  16,  -7,  14,  -2,   3,
-      0, -12,   0, -33,   9,  13,  28,  -3,  14,   7,
-    }, {
-     79, -11,  15,  -4, -18, -23, -20,  -5, -30,  -7,
-      7,   2,  21,  21,   8,   3,  10, -28,  -4, -31,
-     -6, -25,   3, -37,  -4,   7, -20,   0,  -4,  -4,
-     11,  -7,   6,  -8,  27,  22,  14,  12,   5,  16,
-    }, {
-     47,  30,  15,  14,  14,   9,   9, -23,  13, -10,
-    -12,  -7, -16, -15,  -3,  -3,  -1,  14,   9,  12,
-      9,   8,   0,  10, -14,   4,  -9,   2,  -5,   8,
-    -13,  -3, -18, -10, -45,  -3,  16,  -4,   4,   0,
-    }, {
-     69,  17,   3,  -3,  10,  -8,  -3, -40,  -1, -21,
-    -10, -21,  -8, -23,  -1,  13,   8,  11,  21,  11,
-     15,   4,   0,  -2, -13,  -5, -23, -12,  -7,   0,
-     -1,   0, -10,  14, -28,   5,   1,  11,  -5,   7,
-    }, {
-     36,  21,  28,  16,   6,  16,  12,  -2,   4,  -2,
-    -20,  -7, -11,   4, -20,  -4, -12,   2,  -1,   0,
-      0,  -8,  -2,  -2, -27,   4, -21,  -2,  -9,   0,
-     -6, -29,  -9, -10, -21,  21,  28,  10,  29,  11,
-    }, {
-     58,   9,  16,  -1,   2,  -2,   0, -19, -10, -13,
-    -17, -21,  -3,  -3, -19,  12,  -2,   0,  10,  -1,
-      5, -12,   0, -15, -26,  -5, -34, -16, -11,  -7,
-      4, -25,  -2,  14,  -3,  29,  13,  25,  20,  20,
-    }, {
-     55,  28,  21,  27,  -2,   7,  -8, -20,   4,   1,
-      1,  18,   5,   4,   5, -16,   2,  -8,   5,  -5,
-     19,   2,  14,   3,   6,   0, -18,  -4,   2, -11,
-     -8,  18, -11, -10, -29,  -3,  10, -13,  -8,  -3,
-    }, {
-     77,  16,   9,   9,  -6, -11, -21, -37, -10, -10,
-      4,   5,  13,  -3,   7,   0,  13, -11,  17,  -6,
-     25,  -1,  15,  -9,   7,  -9, -32, -19,   0, -18,
-      2,  22,  -3,  15, -12,   5,  -4,   2, -17,   5,
-    }, {
-     44,  20,  34,  29, -10,  13,  -4,   0,  -4,   9,
-     -5,  19,  10,  24, -11, -17,  -8, -20,  -5, -19,
-      9, -14,  12,  -9,  -6,   0, -30,  -9,   0, -19,
-     -2,  -7,  -2, -10,  -5,  20,  21,   1,  17,   9,
-    }, {
-     66,   8,  23,  11, -14,  -5, -17, -16, -19,  -2,
-     -3,   5,  18,  17, -10,   0,   1, -23,   6, -20,
-     15, -18,  14, -22,  -5, -10, -44, -23,  -2, -26,
-      9,  -3,   4,  14,  12,  29,   7,  16,   7,  18,
-    }, {
-     18,   9, -17,  -4,  11,   3,   0,  11,   7,   4,
-     10,   3,  10, -18,  24,  -3,  14,   7,   4,  10,
-    -16,   1, -27,  -4, -27,  17,  12,  30,   0,  35,
-     -9,  -3, -12, -36, -35, -30,  -2, -13,   2, -11,
-    }, {
-     40,  -2, -29, -22,   7, -14, -12,  -5,  -7,  -7,
-     12,  -9,  18, -26,  26,  14,  24,   4,  16,   9,
-    -10,  -2, -26, -18, -26,   7,  -1,  15,  -1,  27,
-      2,   0,  -4, -11, -17, -21, -16,   1,  -7,  -3,
-    }, {
-      8,   1,  -3,  -2,   3,  10,   3,  32,  -1,  12,
-      2,   4,  15,   1,   7,  -3,   2,  -4,  -6,  -3,
-    -26, -15, -29, -17, -40,  17,   0,  26,  -2,  27,
-     -2, -29,  -4, -36, -10,  -6,   9,   0,  27,   0,
-    }, {
-     30, -11, -15, -20,   0,  -8,  -9,  15, -15,   0,
-      5,  -9,  23,  -6,   8,  13,  13,  -7,   5,  -3,
-    -20, -19, -27, -31, -39,   7, -13,  11,  -4,  19,
-      8, -25,   3, -11,   7,   2,  -4,  16,  18,   9,
-    }, {
-     26,   7, -11,   8,  -5,   1, -17,  14,  -1,  15,
-     24,  30,  32,   1,  33, -16,  18, -14,   0,  -8,
-     -6,  -4, -12, -12,  -6,  13,   2,  23,   8,  15,
-     -4,  17,  -5, -36, -18, -30,  -8, -22, -10, -14,
-    }, {
-     48,  -4, -23,  -9,  -9, -17, -30,  -2, -16,   3,
-     26,  16,  40,  -6,  35,   1,  28, -17,  12,  -9,
-      0,  -8, -11, -25,  -5,   3, -10,   8,   6,   7,
-      6,  22,   1, -11,  -1, -21, -22,  -7, -19,  -5,
-    }, {
-     15,   0,   2,  10, -13,   7, -14,  35, -10,  23,
-     16,  31,  37,  21,  16, -17,   6, -26, -10, -21,
-    -16, -21, -13, -25, -19,  13,  -8,  19,   5,   7,
-      1,  -8,   2, -36,   5,  -6,   3,  -8,  15,  -1,
-    }, {
-     37, -12,  -9,  -7, -17, -11, -26,  18, -25,  12,
-     19,  17,  45,  14,  17,   0,  17, -30,   1, -22,
-    -10, -25, -12, -38, -18,   3, -22,   4,   3,   0,
-     13,  -3,  10, -11,  23,   2, -10,   7,   5,   7,
-    }, {
-      5,  29,  -9,  11,  15,  22,   3,   0,  18,   8,
-     -1,   6,   7, -23,   6,  -6,   5,  12,  15,  21,
-      5,   8, -17,   9, -28,   0, -11,   6,   2,  12,
-    -11,   0, -14, -13, -49, -22,  -8,  -9,   4,  -9,
-    }, {
-     27,  16, -21,  -6,  12,   3,  -9, -16,   3,  -2,
-      1,  -7,  15, -31,   7,  10,  16,   9,  27,  21,
-     11,   5, -16,  -3, -26,  -9, -24,  -7,   0,   4,
-      0,   4,  -6,  11, -32, -14, -23,   6,  -5,  -1,
-    }, {
-     -4,  20,   3,  13,   8,  28,   6,  21,  10,  16,
-     -8,   7,  12,  -3, -11,  -7,  -5,   0,   4,   8,
-     -4,  -8, -18,  -3, -41,   0, -22,   2,   0,   4,
-     -5, -25,  -6, -14, -25,   1,   2,   4,  29,   2,
-    }, {
-     17,   8,  -8,  -4,   4,  10,  -6,   5,  -4,   5,
-     -6,  -6,  20, -10,  -9,   9,   4,  -2,  16,   7,
-      1, -12, -17, -16, -39,  -9, -36, -12,  -2,  -3,
-      6, -21,   1,  11,  -7,  10, -11,  20,  20,  11,
-    }, {
-     13,  27,  -3,  24,  -1,  19, -14,   3,   9,  20,
-     12,  33,  29,  -3,  15, -20,   9,  -9,  11,   3,
-     16,   2,  -2,   2,  -7,  -3, -20,   0,  10,  -7,
-     -7,  22,  -7, -13, -33, -23, -14, -18,  -7, -12,
-    }, {
-     35,  15, -15,   6,  -4,   1, -27, -12,  -5,   8,
-     15,  19,  37, -11,  16,  -2,  20, -12,  23,   2,
-     22,  -1,  -1, -11,  -5, -13, -34, -14,   8, -14,
-      4,  26,   0,  11, -16, -14, -29,  -2, -17,  -3,
-    }, {
-      3,  19,   9,  26,  -8,  26, -10,  24,   0,  28,
-      5,  33,  34,  17,  -2, -20,  -1, -22,   0, -10,
-      6, -14,  -3, -10, -20,  -4, -32,  -4,   7, -15,
-      0,  -3,   0, -13,  -9,   0,  -3,  -4,  17,   0,
-    }, {
-     25,   7,  -2,   8, -12,   7, -23,   8, -13,  16,
-      7,  20,  42,   9,   0,  -3,   9, -25,  12, -10,
-     12, -18,  -2, -24, -19, -13, -46, -19,   5, -22,
-     10,   0,   8,  11,   8,   9, -17,  11,   7,   8,
-    }, {
-    -25,  -7,   2,  -8,  12,  -7,  23,  -8,  13, -16,
-     -7, -20, -42,  -9,   0,   3,  -9,  25, -12,  10,
-    -12,  18,   2,  24,  19,  13,  46,  19,  -5,  22,
-    -10,   0,  -8, -11,  -8,  -9,  17, -11,  -7,  -8,
-    }, {
-     -3, -19,  -9, -26,   8, -26,  10, -24,   0, -28,
-     -5, -33, -34, -17,   2,  20,   1,  22,   0,  10,
-     -6,  14,   3,  10,  20,   4,  32,   4,  -7,  15,
-      0,   3,   0,  13,   9,   0,   3,   4, -17,   0,
-    }, {
-    -35, -15,  15,  -6,   4,  -1,  27,  12,   5,  -8,
-    -15, -19, -37,  11, -16,   2, -20,  12, -23,  -2,
-    -22,   1,   1,  11,   5,  13,  34,  14,  -8,  14,
-     -4, -26,   0, -11,  16,  14,  29,   2,  17,   3,
-    }, {
-    -13, -27,   3, -24,   1, -19,  14,  -3,  -9, -20,
-    -12, -33, -29,   3, -15,  20,  -9,   9, -11,  -3,
-    -16,  -2,   2,  -2,   7,   3,  20,   0, -10,   7,
-      7, -22,   7,  13,  33,  23,  14,  18,   7,  12,
-    }, {
-    -17,  -8,   8,   4,  -4, -10,   6,  -5,   4,  -5,
-      6,   6, -20,  10,   9,  -9,  -4,   2, -16,  -7,
-     -1,  12,  17,  16,  39,   9,  36,  12,   2,   3,
-     -6,  21,  -1, -11,   7, -10,  11, -20, -20, -11,
-    }, {
-      4, -20,  -3, -13,  -8, -28,  -6, -21, -10, -16,
-      8,  -7, -12,   3,  11,   7,   5,   0,  -4,  -8,
-      4,   8,  18,   3,  41,   0,  22,  -2,   0,  -4,
-      5,  25,   6,  14,  25,  -1,  -2,  -4, -29,  -2,
-    }, {
-    -27, -16,  21,   6, -12,  -3,   9,  16,  -3,   2,
-     -1,   7, -15,  31,  -7, -10, -16,  -9, -27, -21,
-    -11,  -5,  16,   3,  26,   9,  24,   7,   0,  -4,
-      0,  -4,   6, -11,  32,  14,  23,  -6,   5,   1,
-    }, {
-     -5, -29,   9, -11, -15, -22,  -3,   0, -18,  -8,
-      1,  -6,  -7,  23,  -6,   6,  -5, -12, -15, -21,
-     -5,  -8,  17,  -9,  28,   0,  11,  -6,  -2, -12,
-     11,   0,  14,  13,  49,  22,   8,   9,  -4,   9,
-    }, {
-    -37,  12,   9,   7,  17,  11,  26, -18,  25, -12,
-    -19, -17, -45, -14, -17,   0, -17,  30,  -1,  22,
-     10,  25,  12,  38,  18,  -3,  22,  -4,  -3,   0,
-    -13,   3, -10,  11, -23,  -2,  10,  -7,  -5,  -7,
-    }, {
-    -15,   0,  -2, -10,  13,  -7,  14, -35,  10, -23,
-    -16, -31, -37, -21, -16,  17,  -6,  26,  10,  21,
-     16,  21,  13,  25,  19, -13,   8, -19,  -5,  -7,
-     -1,   8,  -2,  36,  -5,   6,  -3,   8, -15,   1,
-    }, {
-    -48,   4,  23,   9,   9,  17,  30,   2,  16,  -3,
-    -26, -16, -40,   6, -35,  -1, -28,  17, -12,   9,
-      0,   8,  11,  25,   5,  -3,  10,  -8,  -6,  -7,
-     -6, -22,  -1,  11,   1,  21,  22,   7,  19,   5,
-    }, {
-    -26,  -7,  11,  -8,   5,  -1,  17, -14,   1, -15,
-    -24, -30, -32,  -1, -33,  16, -18,  14,   0,   8,
-      6,   4,  12,  12,   6, -13,  -2, -23,  -8, -15,
-      4, -17,   5,  36,  18,  30,   8,  22,  10,  14,
-    }, {
-    -30,  11,  15,  20,   0,   8,   9, -15,  15,   0,
-     -5,   9, -23,   6,  -8, -13, -13,   7,  -5,   3,
-     20,  19,  27,  31,  39,  -7,  13, -11,   4, -19,
-     -8,  25,  -3,  11,  -7,  -2,   4, -16, -18,  -9,
-    }, {
-     -8,  -1,   3,   2,  -3, -10,  -3, -32,   1, -12,
-     -2,  -4, -15,  -1,  -7,   3,  -2,   4,   6,   3,
-     26,  15,  29,  17,  40, -17,   0, -26,   2, -27,
-      2,  29,   4,  36,  10,   6,  -9,   0, -27,   0,
-    }, {
-    -40,   2,  29,  22,  -7,  14,  12,   5,   7,   7,
-    -12,   9, -18,  26, -26, -14, -24,  -4, -16,  -9,
-     10,   2,  26,  18,  26,  -7,   1, -15,   1, -27,
-     -2,   0,   4,  11,  17,  21,  16,  -1,   7,   3,
-    }, {
-    -18,  -9,  17,   4, -11,  -3,   0, -11,  -7,  -4,
-    -10,  -3, -10,  18, -24,   3, -14,  -7,  -4, -10,
-     16,  -1,  27,   4,  27, -17, -12, -30,   0, -35,
-      9,   3,  12,  36,  35,  30,   2,  13,  -2,  11,
-    }, {
-    -66,  -8, -23, -11,  14,   5,  17,  16,  19,   2,
-      3,  -5, -18, -17,  10,   0,  -1,  23,  -6,  20,
-    -15,  18, -14,  22,   5,  10,  44,  23,   2,  26,
-     -9,   3,  -4, -14, -12, -29,  -7, -16,  -7, -18,
-    }, {
-    -44, -20, -34, -29,  10, -13,   4,   0,   4,  -9,
-      5, -19, -10, -24,  11,  17,   8,  20,   5,  19,
-     -9,  14, -12,   9,   6,   0,  30,   9,   0,  19,
-      2,   7,   2,  10,   5, -20, -21,  -1, -17,  -9,
-    }, {
-    -77, -16,  -9,  -9,   6,  11,  21,  37,  10,  10,
-     -4,  -5, -13,   3,  -7,   0, -13,  11, -17,   6,
-    -25,   1, -15,   9,  -7,   9,  32,  19,   0,  18,
-     -2, -22,   3, -15,  12,  -5,   4,  -2,  17,  -5,
-    }, {
-    -55, -28, -21, -27,   2,  -7,   8,  20,  -4,  -1,
-     -1, -18,  -5,  -4,  -5,  16,  -2,   8,  -5,   5,
-    -19,  -2, -14,  -3,  -6,   0,  18,   4,  -2,  11,
-      8, -18,  11,  10,  29,   3, -10,  13,   8,   3,
-    }, {
-    -58,  -9, -16,   1,  -2,   2,   0,  19,  10,  13,
-     17,  21,   3,   3,  19, -12,   2,   0, -10,   1,
-     -5,  12,   0,  15,  26,   5,  34,  16,  11,   7,
-     -4,  25,   2, -14,   3, -29, -13, -25, -20, -20,
-    }, {
-    -36, -21, -28, -16,  -6, -16, -12,   2,  -4,   2,
-     20,   7,  11,  -4,  20,   4,  12,  -2,   1,   0,
-      0,   8,   2,   2,  27,  -4,  21,   2,   9,   0,
-      6,  29,   9,  10,  21, -21, -28, -10, -29, -11,
-    }, {
-    -69, -17,  -3,   3, -10,   8,   3,  40,   1,  21,
-     10,  21,   8,  23,   1, -13,  -8, -11, -21, -11,
-    -15,  -4,   0,   2,  13,   5,  23,  12,   7,   0,
-      1,   0,  10, -14,  28,  -5,  -1, -11,   5,  -7,
-    }, {
-    -47, -30, -15, -14, -14,  -9,  -9,  23, -13,  10,
-     12,   7,  16,  15,   3,   3,   1, -14,  -9, -12,
-     -9,  -8,   0, -10,  14,  -4,   9,  -2,   5,  -8,
-     13,   3,  18,  10,  45,   3, -16,   4,  -4,   0,
-    }, {
-    -79,  11, -15,   4,  18,  23,  20,   5,  30,   7,
-     -7,  -2, -21, -21,  -8,  -3, -10,  28,   4,  31,
-      6,  25,  -3,  37,   4,  -7,  20,   0,   4,   4,
-    -11,   7,  -6,   8, -27, -22, -14, -12,  -5, -16,
-    }, {
-    -57,   0, -27, -13,  14,   5,   7, -11,  15,  -4,
-     -5, -16, -13, -29,  -6,  13,   0,  25,  16,  31,
-     12,  22,  -2,  23,   6, -16,   7, -14,   2,  -3,
-      0,  12,   0,  33,  -9, -13, -28,   3, -14,  -7,
-    }, {
-    -90,   3,  -2,   6,  10,  29,  24,  26,  21,  15,
-    -15,  -2, -16,  -1, -25,  -4, -21,  16,  -6,  18,
-     -3,   8,  -5,  24,  -8,  -7,   9,  -4,   1,  -3,
-     -5, -18,   1,   7,  -2,   1,  -2,   1,  19,  -3,
-    }, {
-    -67,  -8, -14, -11,   7,  11,  11,   9,   7,   3,
-    -13, -16,  -8,  -9, -24,  12, -10,  13,   5,  17,
-      2,   4,  -3,  10,  -6, -17,  -4, -19,   0, -11,
-      6, -13,   9,  33,  14,  10, -16,  17,  10,   4,
-    }, {
-    -71,  10,  -9,  17,   1,  20,   3,   8,  21,  18,
-      6,  24,   0,  -1,   0, -16,  -6,   5,   0,  13,
-     17,  19,  11,  29,  25, -11,  11,  -6,  13, -15,
-     -7,  29,   0,   8, -11, -22, -20, -21, -17, -18,
-    }, {
-    -49,  -2, -21,   0,  -1,   2,  -9,  -8,   6,   6,
-      8,  10,   8,  -9,   2,   0,   4,   2,  13,  12,
-     23,  15,  12,  16,  26, -21,  -2, -21,  11, -23,
-      4,  33,   7,  33,   6, -13, -34,  -5, -27, -10,
-    }, {
-    -82,   1,   4,  19,  -6,  27,   6,  29,  12,  26,
-     -1,  24,   5,  18, -17, -17, -17,  -6, -10,   0,
-      7,   2,   9,  16,  12, -11,   0, -11,   9, -23,
-      0,   3,   8,   8,  13,   1,  -8,  -7,   7,  -6,
-    }, {
-    -60, -10,  -7,   1,  -9,   8,  -6,  13,  -2,  15,
-      1,  10,  13,  11, -15,   0,  -6,  -9,   1,   0,
-     13,  -1,  11,   3,  13, -21, -13, -26,   7, -31,
-     10,   7,  16,  33,  31,  10, -22,   8,  -1,   2,
-    }, {
-     -3,   7,  -5,  -5,   8,  -2,  17,  -9,  18, -24,
-     -2, -19, -10,  -4,  28,  17,   5,  28,  -2,   7,
-     -4,  15,   7,   8,   6,  23,  13,  21, -14,  20,
-    -17, -18, -11, -33, -30, -11,  23, -13,  -5,  -9,
-    }, {
-     18,  -4, -17, -23,   4, -20,   4, -26,   3, -36,
-      0, -32,  -2, -12,  29,  34,  16,  24,  10,   6,
-      0,  12,   8,  -4,   8,  13,   0,   6, -16,  12,
-     -5, -13,  -3,  -7, -13,  -3,   8,   2, -14,   0,
-    }, {
-    -13,   0,   8,  -3,   0,   4,  21,  11,   9, -16,
-    -10, -18,  -5,  16,  10,  16,  -5,  15, -13,  -5,
-    -15,  -1,   6,  -4,  -6,  23,   2,  16, -17,  12,
-    -10, -44,  -3, -33,  -6,  12,  34,   1,  20,   3,
-    }, {
-      8, -12,  -3, -21,  -3, -14,   8,  -5,  -4, -28,
-     -7, -32,   2,   8,  12,  34,   4,  12,  -1,  -6,
-     -9,  -4,   7, -17,  -4,  13, -11,   1, -19,   4,
-      0, -39,   4,  -7,  11,  21,  20,  16,  10,  11,
-    }, {
-      4,   6,   0,   7,  -8,  -4,   0,  -6,   9, -13,
-     11,   7,  11,  15,  37,   4,   9,   5,  -5, -11,
-      5,   9,  22,   1,  27,  18,   4,  14,  -5,   0,
-    -12,   3,  -4, -32, -14, -12,  17, -22, -17, -11,
-    }, {
-     26,  -6, -11, -10, -12, -23, -12, -23,  -5, -24,
-     13,  -5,  19,   8,  38,  21,  20,   2,   6, -12,
-     11,   5,  23, -11,  29,   9,  -9,   0,  -7,  -6,
-     -1,   7,   2,  -7,   3,  -3,   2,  -6, -27,  -3,
-    }, {
-     -6,  -2,  14,   9, -16,   1,   3,  14,   0,  -5,
-      3,   8,  16,  36,  19,   3,  -1,  -6, -17, -24,
-     -4,  -7,  21, -11,  14,  18,  -7,   9,  -9,  -7,
-     -6, -22,   3, -33,  10,  11,  28,  -7,   7,   0,
-    }, {
-     16, -14,   2,  -8, -20, -17,  -9,  -2, -14, -16,
-      6,  -5,  24,  28,  21,  20,   8,  -9,  -4, -25,
-      1, -11,  22, -24,  15,   8, -21,  -5, -11, -14,
-      5, -18,  11,  -7,  27,  20,  14,   7,  -1,   9,
-    }, {
-    -16,  27,   2,  10,  13,  16,  20, -20,  29, -20,
-    -14, -16, -13,  -8,   9,  13,  -2,  33,   9,  19,
-     17,  23,  17,  22,   6,   6,  -9,  -2, -12,  -2,
-    -20, -13, -13, -10, -45,  -4,  16,  -8,  -2,  -7,
-    }, {
-      5,  15,  -9,  -7,   9,  -2,   8, -37,  14, -31,
-    -11, -29,  -5, -16,  11,  30,   7,  29,  21,  18,
-     23,  19,  18,   9,   7,  -3, -23, -17, -14,  -9,
-     -8,  -9,  -6,  15, -27,   4,   2,   6, -12,   1,
-    }, {
-    -26,  19,  15,  12,   5,  22,  24,   0,  21, -12,
-    -21, -15,  -8,  11,  -7,  12, -14,  20,  -2,   6,
-      7,   6,  16,   9,  -6,   5, -21,  -7, -15, -10,
-    -13, -39,  -5, -10, -20,  19,  28,   5,  22,   5,
-    }, {
-     -4,   6,   3,  -5,   1,   4,  11, -16,   6, -23,
-    -19, -29,   0,   3,  -6,  30,  -3,  17,  10,   5,
-     13,   2,  17,  -3,  -5,  -3, -35, -21, -17, -17,
-     -2, -35,   2,  15,  -3,  28,  13,  21,  13,  13,
-    }, {
-     -8,  25,   8,  23,  -3,  13,   3, -17,  20,  -8,
-      0,  10,   8,  11,  18,   0,   1,  10,   5,   0,
-     28,  17,  32,  15,  26,   1, -19,  -9,  -3, -21,
-    -15,   7,  -6,  -9, -29,  -5,  10, -17, -15,  -9,
-    }, {
-     13,  13,  -3,   5,  -7,  -4,  -9, -34,   5, -20,
-      2,  -3,  16,   3,  20,  17,  11,   7,  17,   0,
-     34,  13,  33,   2,  28,  -8, -32, -24,  -5, -29,
-     -3,  12,   0,  15, -11,   3,  -3,  -2, -24,  -1,
-    }, {
-    -18,  17,  21,  25, -11,  19,   6,   3,  11,   0,
-     -7,  11,  13,  31,   1,   0,  -9,  -1,  -5, -12,
-     18,   0,  31,   2,  13,   1, -30, -14,  -7, -29,
-     -9, -18,   1, -10,  -4,  18,  22,  -3,  10,   2,
-    }, {
-      3,   5,   9,   7, -15,   1,  -5, -13,  -2, -12,
-     -5,  -2,  21,  23,   2,  16,   0,  -5,   6, -13,
-     23,  -3,  32, -10,  15,  -8, -44, -28,  -9, -37,
-      2, -13,   9,  15,  12,  27,   7,  12,   0,  11,
-    }, {
-    -44,   6, -30,  -8,   9,  10,  11,  14,  23,  -5,
-      8,  -4,  14, -12,  37,  14,  12,  26,   4,  16,
-     -8,  16,  -9,   7,  -6,  19,  12,  25,  -5,  24,
-    -15, -13,  -8, -36, -34, -31,  -1, -18,  -4, -18,
-    }, {
-    -22,  -5, -42, -26,   6,  -8,  -1,  -2,   9, -17,
-     10, -18,  21, -19,  39,  31,  23,  23,  16,  15,
-     -2,  12,  -7,  -6,  -5,   9,  -1,  10,  -7,  16,
-     -4,  -9,   0, -10, -17, -22, -16,  -2, -14,  -9,
-    }, {
-    -55,  -1, -17,  -6,   1,  16,  15,  35,  15,   2,
-      0,  -4,  19,   8,  20,  13,   1,  14,  -7,   3,
-    -18,   0, -10,  -5, -19,  19,   0,  21,  -8,  16,
-     -9, -39,   0, -36, -10,  -7,   9,  -4,  20,  -5,
-    }, {
-    -33, -13, -29, -24,  -1,  -1,   2,  18,   0,  -9,
-      3, -17,  27,   0,  21,  30,  12,  11,   5,   2,
-    -12,  -4,  -9, -19, -18,   9, -13,   6, -11,   8,
-      2, -35,   8, -10,   7,   1,  -4,  11,  10,   2,
-    }, {
-    -36,   5, -24,   4,  -7,   7,  -6,  17,  14,   5,
-     22,  22,  35,   8,  46,   1,  17,   3,   0,  -2,
-      2,  10,   5,   0,  14,  15,   2,  18,   2,   4,
-    -11,   7,  -1, -36, -18, -32,  -7, -27, -17, -20,
-    }, {
-    -14,  -7, -36, -13, -10, -10, -18,   0,   0,  -5,
-     25,   8,  43,   0,  48,  18,  27,   0,  12,  -3,
-      7,   6,   7, -13,  15,   5, -11,   3,   0,  -2,
-      0,  12,   6, -10,   0, -23, -22, -11, -26, -12,
-    }, {
-    -47,  -3, -11,   6, -15,  13,  -2,  38,   6,  13,
-     15,  22,  40,  28,  28,   0,   5,  -8, -10, -15,
-     -7,  -7,   4, -13,   1,  14,  -9,  14,   0,  -2,
-     -4, -18,   7, -36,   6,  -8,   3, -13,   7,  -8,
-    }, {
-    -25, -15, -22, -11, -18,  -4, -15,  22,  -8,   2,
-     17,   9,  48,  20,  30,  17,  16, -11,   1, -16,
-     -2, -10,   5, -26,   2,   4, -22,   0,  -2, -10,
-      6, -13,  14, -10,  23,   0, -10,   2,  -1,   0,
-    }, {
-    -57,  26, -22,   7,  14,  28,  14,   3,  35,   0,
-     -3,  -1,  11, -16,  18,  10,   4,  31,  15,  28,
-     14,  23,   1,  21,  -7,   2, -11,   1,  -3,   1,
-    -18,  -9, -10, -13, -49, -24,  -8, -14,  -2, -16,
-    }, {
-    -35,  14, -34, -10,  10,  10,   1, -12,  20, -12,
-      0, -15,  18, -24,  20,  27,  14,  28,  27,  27,
-     20,  19,   2,   8,  -5,  -7, -25, -13,  -5,  -5,
-     -6,  -5,  -2,  12, -31, -15, -23,   1, -12,  -8,
-    }, {
-    -68,  18,  -9,   9,   6,  35,  18,  25,  26,   7,
-    -10,  -1,  16,   3,   1,   9,  -6,  19,   4,  15,
-      4,   6,   0,   8, -20,   2, -23,  -2,  -7,  -5,
-    -12, -35,  -1, -13, -24,   0,   3,   0,  22,  -4,
-    }, {
-    -46,   6, -21,  -8,   2,  16,   5,   8,  11,  -4,
-     -8, -15,  24,  -4,   2,  26,   3,  16,  16,  14,
-      9,   2,   1,  -4, -19,  -7, -36, -17,  -9, -13,
-      0, -31,   5,  12,  -7,   8, -11,  15,  13,   4,
-    }, {
-    -49,  24, -16,  20,  -2,  26,  -2,   7,  25,  10,
-     11,  25,  32,   3,  27,  -2,   8,   8,  11,   9,
-     24,  17,  16,  14,  13,  -2, -20,  -5,   4, -17,
-    -14,  12,  -3, -13, -33, -25, -14, -23, -15, -19,
-    }, {
-    -27,  12, -28,   2,  -6,   7, -15,  -9,  11,  -1,
-     13,  11,  40,  -4,  29,  14,  19,   5,  23,   8,
-     30,  13,  17,   0,  14, -12, -34, -20,   2, -25,
-     -2,  16,   4,  12, -15, -16, -29,  -7, -24, -10,
-    }, {
-    -60,  16,  -3,  22, -10,  32,   0,  28,  17,  18,
-      3,  25,  37,  23,  10,  -3,  -2,  -3,   0,  -3,
-     14,   0,  14,   1,   0,  -2, -32,  -9,   1, -25,
-     -7, -13,   5, -13,  -8,  -1,  -2,  -8,  10,  -6,
-    }, {
-    -38,   4, -15,   4, -14,  13, -12,  11,   2,   6,
-      6,  11,  45,  16,  11,  13,   7,  -6,  12,  -4,
-     20,  -3,  16, -12,   1, -12, -46, -24,   0, -33,
-      3,  -9,  12,  12,   8,   7, -17,   6,   0,   2
-    }
-};
-
-static const int8_t cb2_vects[128][40]={
-    {
-     73, -32, -60, -15, -26,  59,   2, -33,  30, -10,
-     -3, -17,   8,  30,  -1, -26,  -4, -22,  10,  16,
-    -36,  -5, -11,  56,  37,   6, -10,  -5, -13,  -3,
-      6,  -5,  11,   4, -19,  -5, -16,  41,  24,  13,
-    }, {
-      4, -11, -37,  23,  -5,  46,  -2, -29,  -5, -39,
-    -21,  -9,   0,  49,  12,  -9, -16, -26,  22,  15,
-    -45, -20,  -5,  40,  22,  17, -26,  31, -14,   2,
-    -14,  10,  30,  20, -27,  -9, -39,  39,  18,   5,
-    }, {
-     34, -25, -48, -28, -11,  34,  -2, -41,   9,  -7,
-    -17,  21,  20,  24, -17, -33,   0, -24,  10,  42,
-      3,  -5,  10,  42,  11,   8,  -3,   3,  16,   9,
-     22,  -2,   0, -33, -10,  18,   7,  58,  10,  28,
-    }, {
-    -34,  -4, -25,  10,   9,  21,  -7, -36, -26, -36,
-    -35,  28,  12,  42,  -3, -16, -12, -28,  21,  42,
-     -5, -21,  16,  26,  -4,  19, -19,  39,  15,  15,
-      1,  13,  19, -17, -17,  14, -15,  55,   4,  19,
-    }, {
-     28, -20, -51, -14,  -6,   7,   0, -26,  27,  -4,
-     18, -40,  -6,  16,  -1, -15,   0, -55,  -5, -16,
-    -19,  14,  -3,  49,  14,   1, -22, -30, -12,   0,
-     24,  15,   9, -17, -45, -29,   4,  28,  51,  35,
-    }, {
-    -40,   0, -28,  24,  14,  -5,  -4, -21,  -7, -33,
-      0, -32, -15,  35,  12,   1, -11, -58,   5, -16,
-    -28,   0,   1,  33,   0,  11, -39,   5, -14,   6,
-      3,  31,  28,  -1, -53, -33, -19,  25,  46,  26,
-    }, {
-    -11, -14, -39, -27,   9, -17,  -4, -33,   6,   0,
-      4,  -1,   5,  10, -17, -22,   5, -57,  -5,   9,
-     20,  13,  18,  35, -11,   3, -16, -22,  17,  13,
-     40,  19,  -1, -55, -35,  -5,  27,  44,  37,  49,
-    }, {
-    -80,   6, -16,  11,  30, -30,  -9, -28, -28, -29,
-    -13,   6,  -2,  28,  -3,  -5,  -7, -60,   5,   9,
-     11,  -1,  24,  19, -27,  13, -32,  13,  15,  19,
-     19,  35,  17, -39, -43,  -9,   4,  42,  32,  41,
-    }, {
-     78, -21, -43,   4, -38,  17,  17,  -5,  55,  24,
-    -15, -36,  14,   4,  24, -24,  12,   5,  17,  31,
-    -54,  -5,  -2,  27,  43, -12,   2,   9,  -9, -15,
-     22,  -3,  28,  21, -20,   3,  20,  28,   9,  -5,
-    }, {
-      9,  -1, -20,  43, -17,   3,  12,   0,  20,  -4,
-    -33, -29,   6,  22,  38,  -7,   0,   1,  29,  30,
-    -63, -21,   3,  11,  27,  -1, -14,  45, -10,  -9,
-      1,  12,  47,  37, -28,   0,  -2,  26,   4, -13,
-    }, {
-     39, -14, -30,  -8, -22,  -8,  12, -12,  34,  27,
-    -29,   2,  26,  -2,   8, -31,  16,   3,  17,  57,
-    -14,  -6,  19,  13,  16, -10,   8,  17,  20,  -2,
-     38,   0,  17, -16, -11,  27,  44,  45,  -4,   8,
-    }, {
-    -29,   5,  -7,  30,  -1, -21,   7,  -7,   0,   0,
-    -47,   9,  18,  15,  22, -14,   4,   0,  28,  57,
-    -23, -21,  25,  -2,   1,   0,  -7,  53,  19,   3,
-     17,  15,  36,   0, -19,  24,  21,  43,  -9,   0,
-    }, {
-     33, -10, -34,   5, -17, -35,  15,   1,  53,  30,
-      6, -59,   0, -10,  24, -13,  17, -27,   1,  -1,
-    -37,  13,   4,  20,  20, -18, -10, -16,  -8, -11,
-     39,  18,  26,   0, -46, -20,  41,  15,  37,  15,
-    }, {
-    -35,  10, -11,  44,   3, -48,  10,   6,  17,   2,
-    -11, -51,  -8,   8,  38,   3,   4, -31,  12,  -2,
-    -46,  -1,  10,   4,   5,  -7, -26,  19, -10,  -5,
-     18,  34,  45,  15, -54, -24,  18,  13,  31,   7,
-    }, {
-     -5,  -3, -21,  -7,  -2, -60,  10,  -5,  32,  34,
-     -7, -20,  11, -16,   8, -20,  21, -29,   1,  24,
-      2,  13,  27,   6,  -5, -15,  -3,  -8,  21,   1,
-     55,  21,  15, -38, -37,   3,  65,  32,  23,  30,
-    }, {
-    -74,  17,   0,  31,  18, -73,   5,   0,  -3,   5,
-    -25, -12,   3,   1,  22,  -3,   9, -33,  12,  24,
-     -6,  -2,  33,  -9, -21,  -5, -20,  27,  19,   7,
-     34,  37,  34, -22, -44,   0,  41,  29,  17,  21,
-    }, {
-     76, -35, -31, -28, -49,  43, -40,   0,  29, -14,
-      8,   5,  10,  18, -26, -46,   0,   7,   6,   3,
-    -25,  -7,  -2,  40,  28,  14,  18,  -3, -27, -28,
-     -8, -45, -13,  34, -13, -27, -15,  31,  12,   3,
-    }, {
-      7, -15,  -9,   9, -28,  29, -45,   5,  -6, -43,
-     -9,  12,   2,  36, -12, -30, -11,   3,  17,   3,
-    -34, -22,   3,  24,  12,  24,   2,  32, -28, -22,
-    -29, -29,   5,  50, -21, -31, -38,  29,   7,  -5,
-    }, {
-     36, -29, -19, -41, -34,  18, -45,  -6,   8, -10,
-     -5,  43,  23,  11, -42, -53,   5,   5,   6,  30,
-     14,  -8,  20,  26,   1,  16,  25,   4,   3, -15,
-      7, -41, -23,  -3,  -4,  -3,   8,  48,  -1,  17,
-    }, {
-    -32,  -8,   3,  -2, -13,   4, -50,  -1, -27, -39,
-    -23,  51,  15,  30, -27, -37,  -7,   1,  17,  29,
-      5, -23,  25,  10, -14,  26,   8,  41,   1,  -9,
-    -13, -26,  -5,  12, -12,  -7, -14,  45,  -6,   9,
-    }, {
-     31, -24, -23, -27, -29,  -9, -43,   8,  26,  -7,
-     30, -17,  -4,   3, -26, -35,   5, -24, -10, -28,
-     -9,  12,   5,  33,   5,   8,   5, -29, -26, -24,
-      9, -23, -14,  12, -39, -52,   5,  18,  39,  24,
-    }, {
-    -37,  -3,   0,  10,  -7, -22, -48,  12,  -8, -36,
-     12,  -9, -12,  22, -12, -19,  -6, -28,   0, -29,
-    -18,  -3,  11,  17, -10,  18, -10,   7, -27, -18,
-    -11,  -7,   3,  28, -47, -55, -18,  15,  34,  16,
-    }, {
-     -8, -17, -10, -40, -13, -34, -47,   0,   5,  -4,
-     16,  21,   8,  -2, -42, -43,  10, -26, -10,  -2,
-     31,  11,  27,  19, -21,  10,  12, -20,   3, -11,
-     25, -20, -25, -25, -29, -28,  28,  34,  25,  38,
-    }, {
-    -77,   2,  11,  -1,   7, -47, -52,   5, -29, -33,
-     -1,  28,   0,  15, -28, -26,  -2, -30,   0,  -2,
-     22,  -4,  33,   3, -36,  21,  -3,  15,   2,  -5,
-      4,  -4,  -6,  -9, -37, -31,   5,  32,  20,  30,
-    }, {
-     81, -25, -14,  -8, -61,   0, -25,  28,  54,  20,
-     -3, -14,  17,  -8,   0, -44,  16,  35,  13,  18,
-    -43,  -7,   6,  11,  33,  -4,  30,  11, -22, -40,
-      6, -43,   3,  50, -14, -18,  22,  18,  -1, -16,
-    }, {
-     12,  -4,   8,  29, -39, -12, -30,  33,  19,  -8,
-    -21,  -6,   8,   9,  13, -28,   4,  31,  24,  18,
-    -52, -23,  12,  -4,  18,   5,  14,  47, -24, -34,
-    -14, -27,  22,  66, -22, -22,  -1,  16,  -6, -24,
-    }, {
-     41, -18,  -2, -21, -45, -24, -30,  21,  33,  24,
-    -17,  24,  29, -15, -16, -51,  21,  33,  13,  45,
-     -3,  -8,  28,  -2,   7,  -2,  37,  19,   7, -27,
-     22, -39,  -7,  12,  -5,   5,  45,  35, -15,  -1,
-    }, {
-    -27,   1,  20,  17, -24, -38, -35,  26,  -1,  -4,
-    -35,  32,  21,   3,  -2, -35,   8,  29,  24,  44,
-    -12, -24,  34, -18,  -8,   7,  21,  55,   5, -21,
-      2, -23,  11,  28, -13,   1,  22,  33, -21, -10,
-    }, {
-     36, -13,  -5,  -7, -40, -51, -28,  36,  52,  27,
-     18, -36,   2, -22,   0, -33,  21,   2,  -3, -13,
-    -26,  11,  14,   4,  10, -10,  18, -14, -22, -36,
-     24, -21,   1,  28, -40, -42,  42,   5,  25,   5,
-    }, {
-    -32,   6,  17,  31, -19, -65, -33,  41,  16,  -1,
-      0, -29,  -6,  -4,  13, -17,   9,  -1,   8, -14,
-    -35,  -3,  19, -11,  -4,   0,   1,  21, -23, -30,
-      3,  -5,  20,  44, -48, -46,  19,   3,  20,  -3,
-    }, {
-     -3,  -7,   6, -20, -25, -77, -32,  29,  31,  30,
-      4,   2,  14, -29, -16, -40,  26,   0,  -3,  12,
-     13,  10,  36,  -9, -15,  -8,  24,  -6,   7, -22,
-     40, -17,  -8,  -9, -31, -18,  66,  22,  11,  19,
-    }, {
-    -72,  13,  29,  18,  -4, -90, -37,  34,  -4,   1,
-    -13,   9,   6, -11,  -2, -24,  13,  -3,   7,  11,
-      4,  -4,  42, -25, -31,   1,   8,  29,   6, -17,
-     19,  -2,  10,   6, -38, -22,  42,  19,   6,  11,
-    }, {
-    116, -20, -68, -30, -28,  83,  28, -18,  32, -22,
-    -13, -21,   5,  28,   5,  -7, -24,  -8, -22,  17,
-    -23,  30, -25,  45,  15,  -9, -11, -18,  22, -10,
-      4,  -2,  19, -12,  23,   3, -43,   2,  12,  -4,
-    }, {
-     47,   0, -45,   7,  -7,  69,  23, -13,  -2, -51,
-    -32, -14,  -3,  47,  19,   8, -37, -11, -10,  16,
-    -32,  15, -19,  29,   0,   1, -28,  18,  20,  -4,
-    -16,  13,  38,   3,  15,   0, -66,   0,   7, -13,
-    }, {
-     77, -13, -56, -43, -13,  57,  23, -26,  11, -19,
-    -27,  16,  17,  22, -10, -15, -19, -10, -22,  43,
-     16,  30,  -2,  31, -11,  -6,  -5,  -9,  52,   2,
-     20,   0,   8, -50,  33,  27, -19,  19,  -1,   9,
-    }, {
-      8,   6, -33,  -4,   7,  44,  18, -21, -23, -48,
-    -46,  24,   9,  40,   3,   1, -32, -13, -11,  43,
-      7,  14,   3,  15, -26,   3, -21,  26,  50,   8,
-      0,  16,  27, -34,  25,  23, -43,  17,  -6,   1,
-    }, {
-     71,  -9, -59, -29,  -8,  30,  26, -11,  30, -16,
-      8, -44,  -9,  14,   5,   2, -19, -40, -38, -15,
-     -7,  50, -17,  38,  -7, -14, -24, -43,  22,  -6,
-     22,  19,  17, -34,  -2, -20, -23, -10,  39,  16,
-    }, {
-      2,  11, -36,   9,  13,  17,  21,  -6,  -5, -45,
-    -10, -36, -18,  33,  19,  19, -31, -44, -27, -15,
-    -16,  34, -11,  22, -22,  -4, -40,  -7,  21,   0,
-      1,  35,  36, -18, -10, -24, -46, -12,  34,   8,
-    }, {
-     32,  -2, -47, -42,   7,   5,  21, -18,   9, -12,
-     -5,  -5,   2,   8, -10,  -4, -14, -42, -38,  10,
-     33,  49,   5,  24, -33, -12, -17, -35,  52,   6,
-     38,  22,   7, -72,   7,   3,   0,   6,  25,  30,
-    }, {
-    -36,  18, -24,  -3,  28,  -7,  16, -13, -26, -41,
-    -24,   1,  -5,  26,   3,  12, -27, -46, -27,  10,
-     24,  34,  10,   8, -49,  -2, -34,   0,  51,  12,
-     17,  38,  25, -56,   0,   0, -22,   3,  20,  22,
-    }, {
-    121,  -9, -50, -10, -40,  40,  43,   9,  58,  12,
-    -25, -41,  11,   2,  31,  -5,  -8,  19, -15,  32,
-    -41,  30, -16,  16,  20, -28,   0,  -3,  26, -22,
-     19,   0,  36,   4,  22,  12,  -6,  -9,  -1, -24,
-    }, {
-     52,  10, -27,  27, -18,  26,  38,  14,  23, -16,
-    -44, -33,   3,  20,  45,  10, -20,  15,  -3,  31,
-    -50,  14, -10,   0,   5, -17, -15,  32,  24, -16,
-     -1,  15,  55,  20,  14,   8, -29, -12,  -7, -32,
-    }, {
-     82,  -3, -38, -23, -24,  15,  38,   2,  37,  15,
-    -39,  -2,  23,  -4,  15, -12,  -3,  17, -15,  58,
-     -1,  29,   6,   2,  -5, -26,   7,   4,  56,  -9,
-     35,   3,  25, -33,  32,  36,  17,   7, -15,  -9,
-    }, {
-     13,  17, -15,  15,  -3,   1,  33,   7,   1, -12,
-    -58,   5,  15,  13,  29,   3, -16,  13,  -4,  57,
-    -10,  13,  11, -13, -21, -15,  -9,  40,  55,  -3,
-     14,  19,  44, -17,  24,  32,  -5,   4, -21, -18,
-    }, {
-     76,   1, -41,  -9, -19, -12,  41,  17,  55,  18,
-     -3, -63,  -3, -12,  30,   5,  -3, -12, -31,   0,
-    -24,  49,  -8,   9,  -1, -33, -12, -29,  27, -18,
-     37,  21,  34, -17,  -3, -11,  14, -23,  25,  -2,
-    }, {
-      7,  22, -18,  29,   1, -25,  36,  21,  20,  -9,
-    -22, -56, -11,   6,  45,  21, -15, -16, -20,  -1,
-    -33,  34,  -2,  -6, -17, -23, -28,   6,  25, -12,
-     16,  37,  53,  -1, -11, -15,  -8, -25,  20, -11,
-    }, {
-     37,   8, -29, -22,  -4, -37,  36,   9,  34,  22,
-    -17, -24,   8, -18,  15,  -2,   1, -14, -31,  25,
-     15,  48,  13,  -4, -28, -31,  -5, -21,  57,  -4,
-     53,  24,  23, -55,   6,  12,  37,  -6,  11,  11,
-    }, {
-    -31,  28,  -6,  16,  16, -50,  31,  14,   0,  -6,
-    -36, -17,   0,   0,  29,  14, -11, -18, -20,  25,
-      6,  33,  19, -20, -43, -21, -21,  14,  55,   0,
-     32,  40,  42, -39,  -1,   8,  14,  -8,   6,   3,
-    }, {
-    119, -24, -39, -44, -51,  66, -14,  15,  31, -26,
-     -1,   0,   7,  16, -19, -28, -19,  22, -26,   4,
-    -13,  28, -16,  29,   5,  -1,  16, -16,   8, -35,
-    -10, -42,  -4,  17,  29, -19, -42,  -7,   0, -15,
-    }, {
-     50,  -3, -16,  -5, -30,  53, -19,  20,  -3, -55,
-    -19,   8,   0,  34,  -5, -11, -32,  18, -15,   4,
-    -22,  13, -10,  13,  -9,   8,   0,  19,   7, -29,
-    -31, -26,  13,  33,  21, -22, -65,  -9,  -4, -23,
-    }, {
-     79, -17, -27, -56, -36,  41, -19,   8,  10, -22,
-    -15,  39,  20,   9, -35, -35, -15,  20, -26,  31,
-     26,  27,   6,  15, -20,   0,  23,  -8,  38, -22,
-      5, -38, -15, -20,  39,   4, -18,   9, -13,  -1,
-    }, {
-     10,   3,  -4, -18, -15,  27, -24,  13, -24, -51,
-    -34,  47,  12,  28, -21, -19, -27,  16, -15,  30,
-     17,  12,  12,   0, -36,  10,   7,  27,  37, -16,
-    -15, -22,   3,  -4,  31,   1, -42,   7, -18,  -9,
-    }, {
-     74, -12, -30, -42, -30,  14, -16,  23,  29, -19,
-     20, -21,  -7,   1, -19, -17, -14, -10, -43, -27,
-      3,  48,  -8,  22, -16,  -7,   4, -42,   9, -31,
-      6, -20,  -6,  -4,   3, -43, -22, -20,  28,   5,
-    }, {
-      5,   7,  -7,  -4,  -9,   0, -21,  28,  -6, -48,
-      2, -14, -15,  20,  -5,   0, -27, -14, -32, -28,
-     -5,  32,  -2,   6, -32,   3, -12,  -5,   8, -25,
-    -14,  -4,  12,  11,  -4, -47, -45, -22,  22,  -2,
-    }, {
-     34,  -6, -18, -55, -15, -11, -21,  16,   8, -16,
-      6,  16,   5,  -4, -35, -24, -10, -12, -43,  -1,
-     43,  47,  14,   8, -43,  -5,  10, -34,  39, -18,
-     22, -16, -17, -42,  13, -19,   1,  -3,  14,  20,
-    }, {
-    -34,  14,   4, -17,   5, -24, -26,  20, -27, -45,
-    -12,  24,  -2,  13, -21,  -8, -22, -16, -32,  -2,
-     34,  31,  20,  -7, -58,   5,  -5,   2,  38, -12,
-      2,  -1,   1, -26,   5, -23, -21,  -6,   8,  11,
-    }, {
-    124, -13, -21, -23, -62,  23,   0,  43,  57,   8,
-    -13, -18,  14, -10,   6, -26,  -3,  49, -19,  19,
-    -31,  27,  -7,   0,  11, -20,  29,  -1,  12, -47,
-      4, -39,  11,  34,  28,  -9,  -5, -19, -13, -34,
-    }, {
-     55,   6,   1,  14, -41,  10,  -4,  48,  22, -20,
-    -31, -10,   5,   7,  20,  -9, -16,  45,  -8,  19,
-    -40,  12,  -1, -15,  -4, -10,  12,  34,  11, -41,
-    -16, -24,  30,  49,  20, -13, -28, -22, -18, -43,
-    }, {
-     84,  -6,  -9, -36, -47,  -1,  -4,  36,  36,  12,
-    -27,  20,  26, -17,  -9, -33,   1,  47, -19,  46,
-      9,  27,  15, -13, -15, -18,  35,   6,  42, -33,
-     20, -36,   1,  -4,  38,  14,  18,  -2, -27, -20,
-    }, {
-     15,  13,  13,   1, -26, -14,  -9,  41,   1, -16,
-    -46,  27,  18,   1,   4, -16, -11,  43,  -8,  45,
-      0,  11,  21, -29, -30,  -8,  19,  42,  41, -28,
-      0, -20,  20,  11,  30,  10,  -4,  -5, -32, -28,
-    }, {
-     79,  -2, -12, -22, -42, -28,  -1,  51,  54,  15,
-      8, -41,   0, -24,   6, -15,   1,  17, -36, -12,
-    -14,  47,   0,  -6, -11, -26,  16, -27,  13, -43,
-     22, -18,  10,  12,   2, -34,  15, -33,  13, -13,
-    }, {
-     10,  18,  10,  15, -21, -41,  -6,  56,  19, -13,
-     -9, -33,  -9,  -6,  20,   1, -11,  13, -24, -13,
-    -23,  32,   6, -22, -26, -15,   0,   8,  12, -37,
-      1,  -2,  28,  27,  -5, -37,  -7, -35,   8, -21,
-    }, {
-     39,   4,   0, -35, -27, -53,  -6,  44,  33,  18,
-     -5,  -2,  11, -31,  -9, -22,   6,  15, -36,  13,
-     25,  46,  23, -20, -37, -24,  23, -19,  43, -29,
-     38, -14,   0, -26,  12, -10,  38, -16,   0,   0,
-    }, {
-    -29,  25,  22,   2,  -6, -67, -11,  49,  -1, -10,
-    -24,   5,   3, -13,   4,  -5,  -6,  11, -25,  12,
-     16,  31,  28, -36, -53, -13,   6,  16,  42, -24,
-     17,   1,  18, -10,   4, -13,  15, -18,  -5,  -7,
-    }, {
-     29, -25, -22,  -2,   6,  67,  11, -49,   1,  10,
-     24,  -5,  -3,  13,  -4,   5,   6, -11,  25, -12,
-    -16, -31, -28,  36,  53,  13,  -6, -16, -42,  24,
-    -17,  -1, -18,  10,  -4,  13, -15,  18,   5,   7,
-    }, {
-    -39,  -4,   0,  35,  27,  53,   6, -44, -33, -18,
-      5,   2, -11,  31,   9,  22,  -6, -15,  36, -13,
-    -25, -46, -23,  20,  37,  24, -23,  19, -43,  29,
-    -38,  14,   0,  26, -12,  10, -38,  16,   0,   0,
-    }, {
-    -10, -18, -10, -15,  21,  41,   6, -56, -19,  13,
-      9,  33,   9,   6, -20,  -1,  11, -13,  24,  13,
-     23, -32,  -6,  22,  26,  15,   0,  -8, -12,  37,
-     -1,   2, -28, -27,   5,  37,   7,  35,  -8,  21,
-    }, {
-    -79,   2,  12,  22,  42,  28,   1, -51, -54, -15,
-     -8,  41,   0,  24,  -6,  15,  -1, -17,  36,  12,
-     14, -47,   0,   6,  11,  26, -16,  27, -13,  43,
-    -22,  18, -10, -12,  -2,  34, -15,  33, -13,  13,
-    }, {
-    -15, -13, -13,  -1,  26,  14,   9, -41,  -1,  16,
-     46, -27, -18,  -1,  -4,  16,  11, -43,   8, -45,
-      0, -11, -21,  29,  30,   8, -19, -42, -41,  28,
-      0,  20, -20, -11, -30, -10,   4,   5,  32,  28,
-    }, {
-    -84,   6,   9,  36,  47,   1,   4, -36, -36, -12,
-     27, -20, -26,  17,   9,  33,  -1, -47,  19, -46,
-     -9, -27, -15,  13,  15,  18, -35,  -6, -42,  33,
-    -20,  36,  -1,   4, -38, -14, -18,   2,  27,  20,
-    }, {
-    -55,  -6,  -1, -14,  41, -10,   4, -48, -22,  20,
-     31,  10,  -5,  -7, -20,   9,  16, -45,   8, -19,
-     40, -12,   1,  15,   4,  10, -12, -34, -11,  41,
-     16,  24, -30, -49, -20,  13,  28,  22,  18,  43,
-    }, {
-   -124,  13,  21,  23,  62, -23,   0, -43, -57,  -8,
-     13,  18, -14,  10,  -6,  26,   3, -49,  19, -19,
-     31, -27,   7,   0, -11,  20, -29,   1, -12,  47,
-     -4,  39, -11, -34, -28,   9,   5,  19,  13,  34,
-    }, {
-     34, -14,  -4,  17,  -5,  24,  26, -20,  27,  45,
-     12, -24,   2, -13,  21,   8,  22,  16,  32,   2,
-    -34, -31, -20,   7,  58,  -5,   5,  -2, -38,  12,
-     -2,   1,  -1,  26,  -5,  23,  21,   6,  -8, -11,
-    }, {
-    -34,   6,  18,  55,  15,  11,  21, -16,  -8,  16,
-     -6, -16,  -5,   4,  35,  24,  10,  12,  43,   1,
-    -43, -47, -14,  -8,  43,   5, -10,  34, -39,  18,
-    -22,  16,  17,  42, -13,  19,  -1,   3, -14, -20,
-    }, {
-     -5,  -7,   7,   4,   9,   0,  21, -28,   6,  48,
-     -2,  14,  15, -20,   5,   0,  27,  14,  32,  28,
-      5, -32,   2,  -6,  32,  -3,  12,   5,  -8,  25,
-     14,   4, -12, -11,   4,  47,  45,  22, -22,   2,
-    }, {
-    -74,  12,  30,  42,  30, -14,  16, -23, -29,  19,
-    -20,  21,   7,  -1,  19,  17,  14,  10,  43,  27,
-     -3, -48,   8, -22,  16,   7,  -4,  42,  -9,  31,
-     -6,  20,   6,   4,  -3,  43,  22,  20, -28,  -5,
-    }, {
-    -10,  -3,   4,  18,  15, -27,  24, -13,  24,  51,
-     34, -47, -12, -28,  21,  19,  27, -16,  15, -30,
-    -17, -12, -12,   0,  36, -10,  -7, -27, -37,  16,
-     15,  22,  -3,   4, -31,  -1,  42,  -7,  18,   9,
-    }, {
-    -79,  17,  27,  56,  36, -41,  19,  -8, -10,  22,
-     15, -39, -20,  -9,  35,  35,  15, -20,  26, -31,
-    -26, -27,  -6, -15,  20,   0, -23,   8, -38,  22,
-     -5,  38,  15,  20, -39,  -4,  18,  -9,  13,   1,
-    }, {
-    -50,   3,  16,   5,  30, -53,  19, -20,   3,  55,
-     19,  -8,   0, -34,   5,  11,  32, -18,  15,  -4,
-     22, -13,  10, -13,   9,  -8,   0, -19,  -7,  29,
-     31,  26, -13, -33, -21,  22,  65,   9,   4,  23,
-    }, {
-   -119,  24,  39,  44,  51, -66,  14, -15, -31,  26,
-      1,   0,  -7, -16,  19,  28,  19, -22,  26,  -4,
-     13, -28,  16, -29,  -5,   1, -16,  16,  -8,  35,
-     10,  42,   4, -17, -29,  19,  42,   7,   0,  15,
-    }, {
-     31, -28,   6, -16, -16,  50, -31, -14,   0,   6,
-     36,  17,   0,   0, -29, -14,  11,  18,  20, -25,
-     -6, -33, -19,  20,  43,  21,  21, -14, -55,   0,
-    -32, -40, -42,  39,   1,  -8, -14,   8,  -6,  -3,
-    }, {
-    -37,  -8,  29,  22,   4,  37, -36,  -9, -34, -22,
-     17,  24,  -8,  18, -15,   2,  -1,  14,  31, -25,
-    -15, -48, -13,   4,  28,  31,   5,  21, -57,   4,
-    -53, -24, -23,  55,  -6, -12, -37,   6, -11, -11,
-    }, {
-     -7, -22,  18, -29,  -1,  25, -36, -21, -20,   9,
-     22,  56,  11,  -6, -45, -21,  15,  16,  20,   1,
-     33, -34,   2,   6,  17,  23,  28,  -6, -25,  12,
-    -16, -37, -53,   1,  11,  15,   8,  25, -20,  11,
-    }, {
-    -76,  -1,  41,   9,  19,  12, -41, -17, -55, -18,
-      3,  63,   3,  12, -30,  -5,   3,  12,  31,   0,
-     24, -49,   8,  -9,   1,  33,  12,  29, -27,  18,
-    -37, -21, -34,  17,   3,  11, -14,  23, -25,   2,
-    }, {
-    -13, -17,  15, -15,   3,  -1, -33,  -7,  -1,  12,
-     58,  -5, -15, -13, -29,  -3,  16, -13,   4, -57,
-     10, -13, -11,  13,  21,  15,   9, -40, -55,   3,
-    -14, -19, -44,  17, -24, -32,   5,  -4,  21,  18,
-    }, {
-    -82,   3,  38,  23,  24, -15, -38,  -2, -37, -15,
-     39,   2, -23,   4, -15,  12,   3, -17,  15, -58,
-      1, -29,  -6,  -2,   5,  26,  -7,  -4, -56,   9,
-    -35,  -3, -25,  33, -32, -36, -17,  -7,  15,   9,
-    }, {
-    -52, -10,  27, -27,  18, -26, -38, -14, -23,  16,
-     44,  33,  -3, -20, -45, -10,  20, -15,   3, -31,
-     50, -14,  10,   0,  -5,  17,  15, -32, -24,  16,
-      1, -15, -55, -20, -14,  -8,  29,  12,   7,  32,
-    }, {
-   -121,   9,  50,  10,  40, -40, -43,  -9, -58, -12,
-     25,  41, -11,  -2, -31,   5,   8, -19,  15, -32,
-     41, -30,  16, -16, -20,  28,   0,   3, -26,  22,
-    -19,   0, -36,  -4, -22, -12,   6,   9,   1,  24,
-    }, {
-     36, -18,  24,   3, -28,   7, -16,  13,  26,  41,
-     24,  -1,   5, -26,  -3, -12,  27,  46,  27, -10,
-    -24, -34, -10,  -8,  49,   2,  34,   0, -51, -12,
-    -17, -38, -25,  56,   0,   0,  22,  -3, -20, -22,
-    }, {
-    -32,   2,  47,  42,  -7,  -5, -21,  18,  -9,  12,
-      5,   5,  -2,  -8,  10,   4,  14,  42,  38, -10,
-    -33, -49,  -5, -24,  33,  12,  17,  35, -52,  -6,
-    -38, -22,  -7,  72,  -7,  -3,   0,  -6, -25, -30,
-    }, {
-     -2, -11,  36,  -9, -13, -17, -21,   6,   5,  45,
-     10,  36,  18, -33, -19, -19,  31,  44,  27,  15,
-     16, -34,  11, -22,  22,   4,  40,   7, -21,   0,
-     -1, -35, -36,  18,  10,  24,  46,  12, -34,  -8,
-    }, {
-    -71,   9,  59,  29,   8, -30, -26,  11, -30,  16,
-     -8,  44,   9, -14,  -5,  -2,  19,  40,  38,  15,
-      7, -50,  17, -38,   7,  14,  24,  43, -22,   6,
-    -22, -19, -17,  34,   2,  20,  23,  10, -39, -16,
-    }, {
-     -8,  -6,  33,   4,  -7, -44, -18,  21,  23,  48,
-     46, -24,  -9, -40,  -3,  -1,  32,  13,  11, -43,
-     -7, -14,  -3, -15,  26,  -3,  21, -26, -50,  -8,
-      0, -16, -27,  34, -25, -23,  43, -17,   6,  -1,
-    }, {
-    -77,  13,  56,  43,  13, -57, -23,  26, -11,  19,
-     27, -16, -17, -22,  10,  15,  19,  10,  22, -43,
-    -16, -30,   2, -31,  11,   6,   5,   9, -52,  -2,
-    -20,   0,  -8,  50, -33, -27,  19, -19,   1,  -9,
-    }, {
-    -47,   0,  45,  -7,   7, -69, -23,  13,   2,  51,
-     32,  14,   3, -47, -19,  -8,  37,  11,  10, -16,
-     32, -15,  19, -29,   0,  -1,  28, -18, -20,   4,
-     16, -13, -38,  -3, -15,   0,  66,   0,  -7,  13,
-    }, {
-   -116,  20,  68,  30,  28, -83, -28,  18, -32,  22,
-     13,  21,  -5, -28,  -5,   7,  24,   8,  22, -17,
-     23, -30,  25, -45, -15,   9,  11,  18, -22,  10,
-     -4,   2, -19,  12, -23,  -3,  43,  -2, -12,   4,
-    }, {
-     72, -13, -29, -18,   4,  90,  37, -34,   4,  -1,
-     13,  -9,  -6,  11,   2,  24, -13,   3,  -7, -11,
-     -4,   4, -42,  25,  31,  -1,  -8, -29,  -6,  17,
-    -19,   2, -10,  -6,  38,  22, -42, -19,  -6, -11,
-    }, {
-      3,   7,  -6,  20,  25,  77,  32, -29, -31, -30,
-     -4,  -2, -14,  29,  16,  40, -26,   0,   3, -12,
-    -13, -10, -36,   9,  15,   8, -24,   6,  -7,  22,
-    -40,  17,   8,   9,  31,  18, -66, -22, -11, -19,
-    }, {
-     32,  -6, -17, -31,  19,  65,  33, -41, -16,   1,
-      0,  29,   6,   4, -13,  17,  -9,   1,  -8,  14,
-     35,   3, -19,  11,   4,   0,  -1, -21,  23,  30,
-     -3,   5, -20, -44,  48,  46, -19,  -3, -20,   3,
-    }, {
-    -36,  13,   5,   7,  40,  51,  28, -36, -52, -27,
-    -18,  36,  -2,  22,   0,  33, -21,  -2,   3,  13,
-     26, -11, -14,  -4, -10,  10, -18,  14,  22,  36,
-    -24,  21,  -1, -28,  40,  42, -42,  -5, -25,  -5,
-    }, {
-     27,  -1, -20, -17,  24,  38,  35, -26,   1,   4,
-     35, -32, -21,  -3,   2,  35,  -8, -29, -24, -44,
-     12,  24, -34,  18,   8,  -7, -21, -55,  -5,  21,
-     -2,  23, -11, -28,  13,  -1, -22, -33,  21,  10,
-    }, {
-    -41,  18,   2,  21,  45,  24,  30, -21, -33, -24,
-     17, -24, -29,  15,  16,  51, -21, -33, -13, -45,
-      3,   8, -28,   2,  -7,   2, -37, -19,  -7,  27,
-    -22,  39,   7, -12,   5,  -5, -45, -35,  15,   1,
-    }, {
-    -12,   4,  -8, -29,  39,  12,  30, -33, -19,   8,
-     21,   6,  -8,  -9, -13,  28,  -4, -31, -24, -18,
-     52,  23, -12,   4, -18,  -5, -14, -47,  24,  34,
-     14,  27, -22, -66,  22,  22,   1, -16,   6,  24,
-    }, {
-    -81,  25,  14,   8,  61,   0,  25, -28, -54, -20,
-      3,  14, -17,   8,   0,  44, -16, -35, -13, -18,
-     43,   7,  -6, -11, -33,   4, -30, -11,  22,  40,
-     -6,  43,  -3, -50,  14,  18, -22, -18,   1,  16,
-    }, {
-     77,  -2, -11,   1,  -7,  47,  52,  -5,  29,  33,
-      1, -28,   0, -15,  28,  26,   2,  30,   0,   2,
-    -22,   4, -33,  -3,  36, -21,   3, -15,  -2,   5,
-     -4,   4,   6,   9,  37,  31,  -5, -32, -20, -30,
-    }, {
-      8,  17,  10,  40,  13,  34,  47,   0,  -5,   4,
-    -16, -21,  -8,   2,  42,  43, -10,  26,  10,   2,
-    -31, -11, -27, -19,  21, -10, -12,  20,  -3,  11,
-    -25,  20,  25,  25,  29,  28, -28, -34, -25, -38,
-    }, {
-     37,   3,   0, -10,   7,  22,  48, -12,   8,  36,
-    -12,   9,  12, -22,  12,  19,   6,  28,   0,  29,
-     18,   3, -11, -17,  10, -18,  10,  -7,  27,  18,
-     11,   7,  -3, -28,  47,  55,  18, -15, -34, -16,
-    }, {
-    -31,  24,  23,  27,  29,   9,  43,  -8, -26,   7,
-    -30,  17,   4,  -3,  26,  35,  -5,  24,  10,  28,
-      9, -12,  -5, -33,  -5,  -8,  -5,  29,  26,  24,
-     -9,  23,  14, -12,  39,  52,  -5, -18, -39, -24,
-    }, {
-     32,   8,  -3,   2,  13,  -4,  50,   1,  27,  39,
-     23, -51, -15, -30,  27,  37,   7,  -1, -17, -29,
-     -5,  23, -25, -10,  14, -26,  -8, -41,  -1,   9,
-     13,  26,   5, -12,  12,   7,  14, -45,   6,  -9,
-    }, {
-    -36,  29,  19,  41,  34, -18,  45,   6,  -8,  10,
-      5, -43, -23, -11,  42,  53,  -5,  -5,  -6, -30,
-    -14,   8, -20, -26,  -1, -16, -25,  -4,  -3,  15,
-     -7,  41,  23,   3,   4,   3,  -8, -48,   1, -17,
-    }, {
-     -7,  15,   9,  -9,  28, -29,  45,  -5,   6,  43,
-      9, -12,  -2, -36,  12,  30,  11,  -3, -17,  -3,
-     34,  22,  -3, -24, -12, -24,  -2, -32,  28,  22,
-     29,  29,  -5, -50,  21,  31,  38, -29,  -7,   5,
-    }, {
-    -76,  35,  31,  28,  49, -43,  40,   0, -29,  14,
-     -8,  -5, -10, -18,  26,  46,   0,  -7,  -6,  -3,
-     25,   7,   2, -40, -28, -14, -18,   3,  27,  28,
-      8,  45,  13, -34,  13,  27,  15, -31, -12,  -3,
-    }, {
-     74, -17,   0, -31, -18,  73,  -5,   0,   3,  -5,
-     25,  12,  -3,  -1, -22,   3,  -9,  33, -12, -24,
-      6,   2, -33,   9,  21,   5,  20, -27, -19,  -7,
-    -34, -37, -34,  22,  44,   0, -41, -29, -17, -21,
-    }, {
-      5,   3,  21,   7,   2,  60, -10,   5, -32, -34,
-      7,  20, -11,  16,  -8,  20, -21,  29,  -1, -24,
-     -2, -13, -27,  -6,   5,  15,   3,   8, -21,  -1,
-    -55, -21, -15,  38,  37,  -3, -65, -32, -23, -30,
-    }, {
-     35, -10,  11, -44,  -3,  48, -10,  -6, -17,  -2,
-     11,  51,   8,  -8, -38,  -3,  -4,  31, -12,   2,
-     46,   1, -10,  -4,  -5,   7,  26, -19,  10,   5,
-    -18, -34, -45, -15,  54,  24, -18, -13, -31,  -7,
-    }, {
-    -33,  10,  34,  -5,  17,  35, -15,  -1, -53, -30,
-     -6,  59,   0,  10, -24,  13, -17,  27,  -1,   1,
-     37, -13,  -4, -20, -20,  18,  10,  16,   8,  11,
-    -39, -18, -26,   0,  46,  20, -41, -15, -37, -15,
-    }, {
-     29,  -5,   7, -30,   1,  21,  -7,   7,   0,   0,
-     47,  -9, -18, -15, -22,  14,  -4,   0, -28, -57,
-     23,  21, -25,   2,  -1,   0,   7, -53, -19,  -3,
-    -17, -15, -36,   0,  19, -24, -21, -43,   9,   0,
-    }, {
-    -39,  14,  30,   8,  22,   8, -12,  12, -34, -27,
-     29,  -2, -26,   2,  -8,  31, -16,  -3, -17, -57,
-     14,   6, -19, -13, -16,  10,  -8, -17, -20,   2,
-    -38,   0, -17,  16,  11, -27, -44, -45,   4,  -8,
-    }, {
-     -9,   1,  20, -43,  17,  -3, -12,   0, -20,   4,
-     33,  29,  -6, -22, -38,   7,   0,  -1, -29, -30,
-     63,  21,  -3, -11, -27,   1,  14, -45,  10,   9,
-     -1, -12, -47, -37,  28,   0,   2, -26,  -4,  13,
-    }, {
-    -78,  21,  43,  -4,  38, -17, -17,   5, -55, -24,
-     15,  36, -14,  -4, -24,  24, -12,  -5, -17, -31,
-     54,   5,   2, -27, -43,  12,  -2,  -9,   9,  15,
-    -22,   3, -28, -21,  20,  -3, -20, -28,  -9,   5,
-    }, {
-     80,  -6,  16, -11, -30,  30,   9,  28,  28,  29,
-     13,  -6,   2, -28,   3,   5,   7,  60,  -5,  -9,
-    -11,   1, -24, -19,  27, -13,  32, -13, -15, -19,
-    -19, -35, -17,  39,  43,   9,  -4, -42, -32, -41,
-    }, {
-     11,  14,  39,  27,  -9,  17,   4,  33,  -6,   0,
-     -4,   1,  -5, -10,  17,  22,  -5,  57,   5,  -9,
-    -20, -13, -18, -35,  11,  -3,  16,  22, -17, -13,
-    -40, -19,   1,  55,  35,   5, -27, -44, -37, -49,
-    }, {
-     40,   0,  28, -24, -14,   5,   4,  21,   7,  33,
-      0,  32,  15, -35, -12,  -1,  11,  58,  -5,  16,
-     28,   0,  -1, -33,   0, -11,  39,  -5,  14,  -6,
-     -3, -31, -28,   1,  53,  33,  19, -25, -46, -26,
-    }, {
-    -28,  20,  51,  14,   6,  -7,   0,  26, -27,   4,
-    -18,  40,   6, -16,   1,  15,   0,  55,   5,  16,
-     19, -14,   3, -49, -14,  -1,  22,  30,  12,   0,
-    -24, -15,  -9,  17,  45,  29,  -4, -28, -51, -35,
-    }, {
-     34,   4,  25, -10,  -9, -21,   7,  36,  26,  36,
-     35, -28, -12, -42,   3,  16,  12,  28, -21, -42,
-      5,  21, -16, -26,   4, -19,  19, -39, -15, -15,
-     -1, -13, -19,  17,  17, -14,  15, -55,  -4, -19,
-    }, {
-    -34,  25,  48,  28,  11, -34,   2,  41,  -9,   7,
-     17, -21, -20, -24,  17,  33,   0,  24, -10, -42,
-     -3,   5, -10, -42, -11,  -8,   3,  -3, -16,  -9,
-    -22,   2,   0,  33,  10, -18,  -7, -58, -10, -28,
-    }, {
-     -4,  11,  37, -23,   5, -46,   2,  29,   5,  39,
-     21,   9,   0, -49, -12,   9,  16,  26, -22, -15,
-     45,  20,   5, -40, -22, -17,  26, -31,  14,  -2,
-     14, -10, -30, -20,  27,   9,  39, -39, -18,  -5,
-    }, {
-    -73,  32,  60,  15,  26, -59,  -2,  33, -30,  10,
-      3,  17,  -8, -30,   1,  26,   4,  22, -10, -16,
-     36,   5,  11, -56, -37,  -6,  10,   5,  13,   3,
-     -6,   5, -11,  -4,  19,   5,  16, -41, -24, -13
-    }
-};
-
-static const uint16_t cb1_base[128]={
-    19657, 18474, 18365, 17520, 21048, 18231, 18584, 16671,
-    20363, 19069, 19409, 18430, 21844, 18753, 19613, 17411,
-    20389, 21772, 20129, 21702, 20978, 20472, 19627, 19387,
-    21477, 23134, 21841, 23919, 22089, 21519, 21134, 20852,
-    19675, 17821, 19044, 17477, 19986, 16955, 18446, 16086,
-    21138, 18899, 20952, 18929, 21452, 17833, 20104, 17159,
-    19770, 20056, 20336, 20866, 19329, 18217, 18908, 18004,
-    21556, 21948, 23079, 23889, 20922, 19544, 20984, 19781,
-    19781, 20984, 19544, 20922, 23889, 23079, 21948, 21556,
-    18004, 18908, 18217, 19329, 20866, 20336, 20056, 19770,
-    17159, 20104, 17833, 21452, 18929, 20952, 18899, 21138,
-    16086, 18446, 16955, 19986, 17477, 19044, 17821, 19675,
-    20852, 21134, 21519, 22089, 23919, 21841, 23134, 21477,
-    19387, 19627, 20472, 20978, 21702, 20129, 21772, 20389,
-    17411, 19613, 18753, 21844, 18430, 19409, 19069, 20363,
-    16671, 18584, 18231, 21048, 17520, 18365, 18474, 19657,
-};
-
-static const uint16_t cb2_base[128]={
-    12174, 13380, 13879, 13832, 13170, 13227, 13204, 12053,
-    12410, 13988, 14348, 14631, 13100, 13415, 13224, 12268,
-    11982, 13825, 13499, 14210, 13877, 14788, 13811, 13109,
-    11449, 13275, 12833, 13717, 12728, 13696, 12759, 12405,
-    10230, 12185, 11628, 13161, 11762, 13458, 12312, 12818,
-    10443, 12773, 12011, 14020, 11818, 13825, 12453, 13226,
-    10446, 13162, 11881, 14300, 12859, 16288, 13490, 15053,
-    10155, 12820, 11519, 13973, 12041, 15081, 12635, 14198,
-    14198, 12635, 15081, 12041, 13973, 11519, 12820, 10155,
-    15053, 13490, 16288, 12859, 14300, 11881, 13162, 10446,
-    13226, 12453, 13825, 11818, 14020, 12011, 12773, 10443,
-    12818, 12312, 13458, 11762, 13161, 11628, 12185, 10230,
-    12405, 12759, 13696, 12728, 13717, 12833, 13275, 11449,
-    13109, 13811, 14788, 13877, 14210, 13499, 13825, 11982,
-    12268, 13224, 13415, 13100, 14631, 14348, 13988, 12410,
-    12053, 13204, 13227, 13170, 13832, 13879, 13380, 12174,
-};
-
-static const int16_t energy_tab[32]={
-        0,    16,    20,    25,    32,    41,    51,    65,
-       81,   103,   129,   163,   205,   259,   326,   410,
-      516,   650,   819,  1031,  1298,  1634,  2057,  2590,
-     3261,  4105,  5168,  6507,  8192, 10313, 12983, 16345
-};
-
-static const int16_t lpc_refl_cb1[64]={
-    -4041, -4018, -3998, -3977, -3954, -3930, -3906, -3879,
-    -3852, -3825, -3795, -3764, -3731, -3699, -3666, -3631,
-    -3594, -3555, -3513, -3468, -3420, -3372, -3321, -3268,
-    -3212, -3153, -3090, -3021, -2944, -2863, -2772, -2676,
-    -2565, -2445, -2328, -2202, -2072, -1941, -1808, -1660,
-    -1508, -1348, -1185,  -994,  -798,  -600,  -374,  -110,
-      152,   447,   720,   982,  1229,  1456,  1682,  1916,
-     2130,  2353,  2595,  2853,  3118,  3363,  3588,  3814
-};
-
-static const int16_t lpc_refl_cb2[32]={
-    -3091, -2386, -1871, -1425, -1021,  -649,  -316,   -20,
-      267,   544,   810,  1065,  1305,  1534,  1756,  1970,
-     2171,  2359,  2536,  2700,  2854,  2996,  3133,  3263,
-     3386,  3499,  3603,  3701,  3789,  3870,  3947,  4020
-};
-
-static const int16_t lpc_refl_cb3[32]={
-    -3525, -3295, -3081, -2890, -2696, -2511, -2328, -2149,
-    -1979, -1817, -1658, -1498, -1341, -1188, -1032,  -876,
-     -721,  -561,  -394,  -228,   -54,   119,   296,   484,
-      683,   895,  1123,  1373,  1651,  1965,  2360,  2854
-};
-
-static const int16_t lpc_refl_cb4[16]={
-    -1845, -1057,  -522,   -77,   301,   647,   975,  1285,
-     1582,  1873,  2163,  2452,  2735,  3017,  3299,  3569
-};
-
-static const int16_t lpc_refl_cb5[16]={
-    -2691, -2187, -1788, -1435, -1118,  -837,  -571,  -316,
-      -59,   201,   470,   759,  1077,  1457,  1908,  2495
-};
-
-static const int16_t lpc_refl_cb6[8]={
-    -1372,  -474,   133,   632,  1100,  1571,  2075,  2672
-};
-
-static const int16_t lpc_refl_cb7[8]={
-    -2389, -1787, -1231,  -717,  -239,   234,   770,  1474
-};
-
-static const int16_t lpc_refl_cb8[8]={
-    -1569,  -864,  -296,   200,   670,  1151,  1709,  2385
-};
-
-static const int16_t lpc_refl_cb9[8]={
-    -2200, -1608, -1062,  -569,  -120,   338,   863,  1621
-};
-
-static const int16_t lpc_refl_cb10[4]={
-     -617,   190,   802,  1483
-};
-
-static const int16_t * const lpc_refl_cb[10]={
-    lpc_refl_cb1, lpc_refl_cb2, lpc_refl_cb3, lpc_refl_cb4, lpc_refl_cb5,
-    lpc_refl_cb6, lpc_refl_cb7, lpc_refl_cb8, lpc_refl_cb9, lpc_refl_cb10
-};
-
-#endif /* AVCODEC_RA144_H */
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
deleted file mode 100644
index 20a21f5..0000000
--- a/libavcodec/ra288.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * RealAudio 2.0 (28.8K)
- * Copyright (c) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-#include "ra288.h"
-#include "lpc.h"
-#include "celp_math.h"
-#include "celp_filters.h"
-
-typedef struct {
-    float sp_lpc[36];      ///< LPC coefficients for speech data (spec: A)
-    float gain_lpc[10];    ///< LPC coefficients for gain        (spec: GB)
-
-    /** speech data history                                      (spec: SB).
-     *  Its first 70 coefficients are updated only at backward filtering.
-     */
-    float sp_hist[111];
-
-    /// speech part of the gain autocorrelation                  (spec: REXP)
-    float sp_rec[37];
-
-    /** log-gain history                                         (spec: SBLG).
-     *  Its first 28 coefficients are updated only at backward filtering.
-     */
-    float gain_hist[38];
-
-    /// recursive part of the gain autocorrelation               (spec: REXPLG)
-    float gain_rec[11];
-} RA288Context;
-
-static av_cold int ra288_decode_init(AVCodecContext *avctx)
-{
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
-    return 0;
-}
-
-static void apply_window(float *tgt, const float *m1, const float *m2, int n)
-{
-    while (n--)
-        *tgt++ = *m1++ * *m2++;
-}
-
-static void convolve(float *tgt, const float *src, int len, int n)
-{
-    for (; n >= 0; n--)
-        tgt[n] = ff_dot_productf(src, src - n, len);
-
-}
-
-static void decode(RA288Context *ractx, float gain, int cb_coef)
-{
-    int i;
-    double sumsum;
-    float sum, buffer[5];
-    float *block = ractx->sp_hist + 70 + 36; // current block
-    float *gain_block = ractx->gain_hist + 28;
-
-    memmove(ractx->sp_hist + 70, ractx->sp_hist + 75, 36*sizeof(*block));
-
-    /* block 46 of G.728 spec */
-    sum = 32.;
-    for (i=0; i < 10; i++)
-        sum -= gain_block[9-i] * ractx->gain_lpc[i];
-
-    /* block 47 of G.728 spec */
-    sum = av_clipf(sum, 0, 60);
-
-    /* block 48 of G.728 spec */
-    /* exp(sum * 0.1151292546497) == pow(10.0,sum/20) */
-    sumsum = exp(sum * 0.1151292546497) * gain * (1.0/(1<<23));
-
-    for (i=0; i < 5; i++)
-        buffer[i] = codetable[cb_coef][i] * sumsum;
-
-    sum = ff_dot_productf(buffer, buffer, 5) * ((1<<24)/5.);
-
-    sum = FFMAX(sum, 1);
-
-    /* shift and store */
-    memmove(gain_block, gain_block + 1, 9 * sizeof(*gain_block));
-
-    gain_block[9] = 10 * log10(sum) - 32;
-
-    ff_celp_lp_synthesis_filterf(block, ractx->sp_lpc, buffer, 5, 36);
-}
-
-/**
- * Hybrid window filtering, see blocks 36 and 49 of the G.728 specification.
- *
- * @param order   filter order
- * @param n       input length
- * @param non_rec number of non-recursive samples
- * @param out     filter output
- * @param hist    pointer to the input history of the filter
- * @param out     pointer to the non-recursive part of the output
- * @param out2    pointer to the recursive part of the output
- * @param window  pointer to the windowing function table
- */
-static void do_hybrid_window(int order, int n, int non_rec, float *out,
-                             float *hist, float *out2, const float *window)
-{
-    int i;
-    float buffer1[order + 1];
-    float buffer2[order + 1];
-    float work[order + n + non_rec];
-
-    apply_window(work, window, hist, order + n + non_rec);
-
-    convolve(buffer1, work + order    , n      , order);
-    convolve(buffer2, work + order + n, non_rec, order);
-
-    for (i=0; i <= order; i++) {
-        out2[i] = out2[i] * 0.5625 + buffer1[i];
-        out [i] = out2[i]          + buffer2[i];
-    }
-
-    /* Multiply by the white noise correcting factor (WNCF). */
-    *out *= 257./256.;
-}
-
-/**
- * Backward synthesis filter, find the LPC coefficients from past speech data.
- */
-static void backward_filter(float *hist, float *rec, const float *window,
-                            float *lpc, const float *tab,
-                            int order, int n, int non_rec, int move_size)
-{
-    float temp[order+1];
-
-    do_hybrid_window(order, n, non_rec, temp, hist, rec, window);
-
-    if (!compute_lpc_coefs(temp, order, lpc, 0, 1, 1))
-        apply_window(lpc, lpc, tab, order);
-
-    memmove(hist, hist + n, move_size*sizeof(*hist));
-}
-
-static int ra288_decode_frame(AVCodecContext * avctx, void *data,
-                              int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    float *out = data;
-    int i, j;
-    RA288Context *ractx = avctx->priv_data;
-    GetBitContext gb;
-
-    if (buf_size < avctx->block_align) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Error! Input buffer is too small [%d<%d]\n",
-               buf_size, avctx->block_align);
-        return 0;
-    }
-
-    if (*data_size < 32*5*4)
-        return -1;
-
-    init_get_bits(&gb, buf, avctx->block_align * 8);
-
-    for (i=0; i < 32; i++) {
-        float gain = amptable[get_bits(&gb, 3)];
-        int cb_coef = get_bits(&gb, 6 + (i&1));
-
-        decode(ractx, gain, cb_coef);
-
-        for (j=0; j < 5; j++)
-            *(out++) = ractx->sp_hist[70 + 36 + j];
-
-        if ((i & 7) == 3) {
-            backward_filter(ractx->sp_hist, ractx->sp_rec, syn_window,
-                            ractx->sp_lpc, syn_bw_tab, 36, 40, 35, 70);
-
-            backward_filter(ractx->gain_hist, ractx->gain_rec, gain_window,
-                            ractx->gain_lpc, gain_bw_tab, 10, 8, 20, 28);
-        }
-    }
-
-    *data_size = (char *)out - (char *)data;
-    return avctx->block_align;
-}
-
-AVCodec ra_288_decoder =
-{
-    "real_288",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_RA_288,
-    sizeof(RA288Context),
-    ra288_decode_init,
-    NULL,
-    NULL,
-    ra288_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"),
-};
diff --git a/libavcodec/ra288.h b/libavcodec/ra288.h
deleted file mode 100644
index d7fd4b5..0000000
--- a/libavcodec/ra288.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * RealAudio 2.0 (28.8K)
- * Copyright (c) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_RA288_H
-#define AVCODEC_RA288_H
-
-#include <stdint.h>
-
-static const float amptable[8]={
-     0.515625,  0.90234375,  1.57910156,  2.76342773,
-    -0.515625, -0.90234375, -1.57910156, -2.76342773
-};
-
-static const int16_t codetable[128][5]={
-    {   668, -2950, -1254, -1790, -2553}, { -5032, -4577, -1045,  2908,  3318},
-    { -2819, -2677,  -948, -2825, -4450}, { -6679,  -340,  1482, -1276,  1262},
-    {  -562, -6757,  1281,   179, -1274}, { -2512, -7130, -4925,  6913,  2411},
-    { -2478,  -156,  4683, -3873,     0}, { -8208,  2140,  -478, -2785,   533},
-    {  1889,  2759,  1381, -6955, -5913}, {  5082, -2460, -5778,  1797,   568},
-    { -2208, -3309, -4523, -6236, -7505}, { -2719,  4358, -2988, -1149,  2664},
-    {  1259,   995,  2711, -2464,-10390}, {  1722, -7569, -2742,  2171, -2329},
-    {  1032,   747,  -858, -7946,-12843}, {  3106,  4856, -4193, -2541,  1035},
-    {  1862,  -960, -6628,   410,  5882}, { -2493, -2628, -4000,   -60,  7202},
-    { -2672,  1446,  1536, -3831,  1233}, { -5302,  6912,  1589, -4187,  3665},
-    { -3456, -8170, -7709,  1384,  4698}, { -4699, -6209,-11176,  8104, 16830},
-    {   930,  7004,  1269, -8977,  2567}, {  4649, 11804,  3441, -5657,  1199},
-    {  2542,  -183, -8859, -7976,  3230}, { -2872, -2011, -9713, -8385, 12983},
-    {  3086,  2140, -3680, -9643, -2896}, { -7609,  6515, -2283, -2522,  6332},
-    { -3333, -5620, -9130,-11131,  5543}, {  -407, -6721,-17466, -2889, 11568},
-    {  3692,  6796,  -262,-10846, -1856}, {  7275, 13404, -2989,-10595,  4936},
-    {   244, -2219,  2656,  3776, -5412}, { -4043, -5934,  2131,   863, -2866},
-    { -3302,  1743, -2006,  -128, -2052}, { -6361,  3342, -1583,   -21,  1142},
-    { -3837, -1831,  6397,  2545, -2848}, { -9332, -6528,  5309,  1986, -2245},
-    { -4490,   748,  1935, -3027,  -493}, { -9255,  5366,  3193, -4493,  1784},
-    {  4784,  -370,  1866,  1057, -1889}, {  7342, -2690, -2577,   676,  -611},
-    {  -502,  2235, -1850, -1777, -2049}, {  1011,  3880, -2465,  2209,  -152},
-    {  2592,  2829,  5588,  2839, -7306}, { -3049, -4918,  5955,  9201, -4447},
-    {   697,  3908,  5798, -4451, -4644}, { -2121,  5444, -2570,   321, -1202},
-    {  2846, -2086,  3532,   566,  -708}, { -4279,   950,  4980,  3749,   452},
-    { -2484,  3502,  1719,  -170,   238}, { -3435,   263,  2114, -2005,  2361},
-    { -7338, -1208,  9347, -1216, -4013}, {-13498,  -439,  8028, -4232,   361},
-    { -3729,  5433,  2004, -4727, -1259}, { -3986,  7743,  8429, -3691,  -987},
-    {  5198,  -423,  1150, -1281,   816}, {  7409,  4109, -3949,  2690,    30},
-    {  1246,  3055,   -35, -1370,  -246}, { -1489,  5635,  -678, -2627,  3170},
-    {  4830, -4585,  2008, -1062,   799}, {  -129,   717,  4594, 14937, 10706},
-    {   417,  2759,  1850, -5057, -1153}, { -3887,  7361, -5768,  4285,   666},
-    {  1443,  -938,    20, -2119, -1697}, { -3712, -3402, -2212,   110,  2136},
-    { -2952,    12, -1568, -3500, -1855}, { -1315, -1731,  1160,  -558,  1709},
-    {    88, -4569,   194,  -454, -2957}, { -2839, -1666,  -273,  2084,  -155},
-    {  -189, -2376,  1663, -1040, -2449}, { -2842, -1369,   636,  -248, -2677},
-    {  1517,    79, -3013, -3669,  -973}, {  1913, -2493, -5312,  -749,  1271},
-    { -2903, -3324, -3756, -3690, -1829}, { -2913, -1547, -2760, -1406,  1124},
-    {  1844, -1834,   456,   706, -4272}, {   467, -4256, -1909,  1521,  1134},
-    {  -127,  -994,  -637, -1491, -6494}, {   873, -2045, -3828, -2792,  -578},
-    {  2311, -1817,  2632, -3052,  1968}, {   641,  1194,  1893,  4107,  6342},
-    {   -45,  1198,  2160, -1449,  2203}, { -2004,  1713,  3518,  2652,  4251},
-    {  2936, -3968,  1280,   131, -1476}, {  2827,     8, -1928,  2658,  3513},
-    {  3199,  -816,  2687, -1741, -1407}, {  2948,  4029,   394,  -253,  1298},
-    {  4286,    51, -4507,   -32,  -659}, {  3903,  5646, -5588, -2592,  5707},
-    {  -606,  1234, -1607, -5187,   664}, {  -525,  3620, -2192, -2527,  1707},
-    {  4297, -3251, -2283,   812, -2264}, {  5765,   528, -3287,  1352,  1672},
-    {  2735,  1241, -1103, -3273, -3407}, {  4033,  1648, -2965, -1174,  1444},
-    {    74,   918,  1999,   915, -1026}, { -2496, -1605,  2034,  2950,   229},
-    { -2168,  2037,    15, -1264,  -208}, { -3552,  1530,   581,  1491,   962},
-    { -2613, -2338,  3621, -1488, -2185}, { -1747,    81,  5538,  1432, -2257},
-    { -1019,   867,   214, -2284, -1510}, { -1684,  2816,  -229,  2551, -1389},
-    {  2707,   504,   479,  2783, -1009}, {  2517, -1487, -1596,   621,  1929},
-    {  -148,  2206, -4288,  1292, -1401}, {  -527,  1243, -2731,  1909,  1280},
-    {  2149, -1501,  3688,   610, -4591}, {  3306, -3369,  1875,  3636, -1217},
-    {  2574,  2513,  1449, -3074, -4979}, {   814,  1826, -2497,  4234, -4077},
-    {  1664,  -220,  3418,  1002,  1115}, {   781,  1658,  3919,  6130,  3140},
-    {  1148,  4065,  1516,   815,   199}, {  1191,  2489,  2561,  2421,  2443},
-    {   770, -5915,  5515,  -368, -3199}, {  1190,  1047,  3742,  6927, -2089},
-    {   292,  3099,  4308,  -758, -2455}, {   523,  3921,  4044,  1386,    85},
-    {  4367,  1006, -1252, -1466, -1383}, {  3852,  1579,   -77,  2064,   868},
-    {  5109,  2919,  -202,   359,  -509}, {  3650,  3206,  2303,  1693,  1296},
-    {  2905, -3907,   229, -1196, -2332}, {  5977, -3585,   805,  3825, -3138},
-    {  3746,  -606,    53,  -269, -3301}, {   606,  2018, -1316,  4064,   398}
-};
-
-static const float syn_window[111]={
-  0.576690972, 0.580838025, 0.585013986, 0.589219987, 0.59345597,  0.597723007,
-  0.602020264, 0.606384277, 0.610748291, 0.615142822, 0.619598389, 0.624084473,
-  0.628570557, 0.633117676, 0.637695313, 0.642272949, 0.646911621, 0.651580811,
-  0.656280518, 0.66104126,  0.665802002, 0.670593262, 0.675445557, 0.680328369,
-  0.685241699, 0.690185547, 0.695159912, 0.700164795, 0.705230713, 0.710327148,
-  0.715454102, 0.720611572, 0.725830078, 0.731048584, 0.736328125, 0.741638184,
-  0.747009277, 0.752380371, 0.7578125,   0.763305664, 0.768798828, 0.774353027,
-  0.779937744, 0.785583496, 0.791229248, 0.796936035, 0.802703857, 0.808502197,
-  0.814331055, 0.820220947, 0.826141357, 0.832092285, 0.838104248, 0.844146729,
-  0.850250244, 0.856384277, 0.862548828, 0.868774414, 0.875061035, 0.881378174,
-  0.88772583,  0.894134521, 0.900604248, 0.907104492, 0.913635254, 0.920227051,
-  0.926879883, 0.933563232, 0.940307617, 0.94708252,  0.953918457, 0.96081543,
-  0.96774292,  0.974731445, 0.981781006, 0.988861084, 0.994842529, 0.998565674,
-  0.999969482, 0.99911499,  0.996002197, 0.990600586, 0.982910156, 0.973022461,
-  0.960876465, 0.946533203, 0.930053711, 0.911437988, 0.89074707,  0.868041992,
-  0.843322754, 0.816680908, 0.788208008, 0.757904053, 0.725891113, 0.692199707,
-  0.656921387, 0.620178223, 0.582000732, 0.542480469, 0.501739502, 0.459838867,
-  0.416900635, 0.373016357, 0.328277588, 0.282775879, 0.236663818, 0.189971924,
-  0.142852783, 0.0954284668,0.0477600098
-};
-
-static const float gain_window[38]={
-  0.505699992, 0.524200022, 0.54339999,  0.563300014, 0.583953857, 0.60534668,
-  0.627502441, 0.650482178, 0.674316406, 0.699005127, 0.724578857, 0.75112915,
-  0.778625488, 0.807128906, 0.836669922, 0.86730957,  0.899078369, 0.932006836,
-  0.961486816, 0.982757568, 0.995635986, 1,           0.995819092, 0.983154297,
-  0.96206665,  0.932769775, 0.895507813, 0.850585938, 0.798400879, 0.739379883,
-  0.674072266, 0.602996826, 0.526763916, 0.446014404, 0.361480713, 0.273834229,
-  0.183868408, 0.0923461914
-};
-
-/** synthesis bandwidth broadening table */
-static const float syn_bw_tab[36]={
-  0.98828125,  0.976699829, 0.965254128, 0.953942537, 0.942763507, 0.931715488,
-  0.920796931, 0.910006344, 0.899342179, 0.888803005, 0.878387332, 0.868093729,
-  0.857920766, 0.847867012, 0.837931097, 0.828111589, 0.818407178, 0.808816493,
-  0.799338162, 0.789970934, 0.780713439, 0.771564424, 0.762522638, 0.753586829,
-  0.744755745, 0.736028135, 0.727402806, 0.718878567, 0.710454226, 0.702128589,
-  0.693900526, 0.685768902, 0.677732527, 0.669790328, 0.66194123,  0.654184103
-};
-
-/** gain bandwidth broadening table */
-static const float gain_bw_tab[10]={
-  0.90625,     0.821289063, 0.74432373,  0.674499512, 0.61126709,
-  0.553955078, 0.50201416,  0.454956055, 0.41229248,  0.373657227
-};
-
-#endif /* AVCODEC_RA288_H */
diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c
deleted file mode 100644
index 04c2738..0000000
--- a/libavcodec/rangecoder.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Range coder
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Range coder.
- * based upon
- *    "Range encoding: an algorithm for removing redundancy from a digitised
- *                     message.
- *     G. N. N. Martin                  Presented in March 1979 to the Video &
- *                                      Data Recording Conference,
- *     IBM UK Scientific Center         held in Southampton July 24-27 1979."
- *
- */
-
-#include <string.h>
-
-#include "avcodec.h"
-#include "rangecoder.h"
-#include "bytestream.h"
-
-
-void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size){
-    c->bytestream_start=
-    c->bytestream= buf;
-    c->bytestream_end= buf + buf_size;
-
-    c->low= 0;
-    c->range= 0xFF00;
-    c->outstanding_count= 0;
-    c->outstanding_byte= -1;
-}
-
-void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size){
-    /* cast to avoid compiler warning */
-    ff_init_range_encoder(c, (uint8_t *) buf, buf_size);
-
-    c->low = bytestream_get_be16(&c->bytestream);
-}
-
-void ff_build_rac_states(RangeCoder *c, int factor, int max_p){
-    const int64_t one= 1LL<<32;
-    int64_t p;
-    int last_p8, p8, i;
-
-    memset(c->zero_state, 0, sizeof(c->zero_state));
-    memset(c-> one_state, 0, sizeof(c-> one_state));
-
-    last_p8= 0;
-    p= one/2;
-    for(i=0; i<128; i++){
-        p8= (256*p + one/2) >> 32; //FIXME try without the one
-        if(p8 <= last_p8) p8= last_p8+1;
-        if(last_p8 && last_p8<256 && p8<=max_p)
-            c->one_state[last_p8]= p8;
-
-        p+= ((one-p)*factor + one/2) >> 32;
-        last_p8= p8;
-    }
-
-    for(i=256-max_p; i<=max_p; i++){
-        if(c->one_state[i])
-            continue;
-
-        p= (i*one + 128) >> 8;
-        p+= ((one-p)*factor + one/2) >> 32;
-        p8= (256*p + one/2) >> 32; //FIXME try without the one
-        if(p8 <= i) p8= i+1;
-        if(p8 > max_p) p8= max_p;
-        c->one_state[    i]=     p8;
-    }
-
-    for(i=1; i<255; i++)
-        c->zero_state[i]= 256-c->one_state[256-i];
-}
-
-/**
- *
- * @return the number of bytes written
- */
-int ff_rac_terminate(RangeCoder *c){
-    c->range=0xFF;
-    c->low +=0xFF;
-    renorm_encoder(c);
-    c->range=0xFF;
-    renorm_encoder(c);
-
-    assert(c->low   == 0);
-    assert(c->range >= 0x100);
-
-    return c->bytestream - c->bytestream_start;
-}
-
-#ifdef TEST
-#define SIZE 10240
-
-#include "libavutil/lfg.h"
-
-int main(void){
-    RangeCoder c;
-    uint8_t b[9*SIZE];
-    uint8_t r[9*SIZE];
-    int i;
-    uint8_t state[10]= {0};
-    AVLFG prng;
-
-    av_lfg_init(&prng, 1);
-
-    ff_init_range_encoder(&c, b, SIZE);
-    ff_build_rac_states(&c, 0.05*(1LL<<32), 128+64+32+16);
-
-    memset(state, 128, sizeof(state));
-
-    for(i=0; i<SIZE; i++){
-        r[i] = av_lfg_get(&prng) % 7;
-    }
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        put_rac(&c, state, r[i]&1);
-STOP_TIMER("put_rac")
-    }
-
-    ff_rac_terminate(&c);
-
-    ff_init_range_decoder(&c, b, SIZE);
-
-    memset(state, 128, sizeof(state));
-
-    for(i=0; i<SIZE; i++){
-START_TIMER
-        if( (r[i]&1) != get_rac(&c, state) )
-            av_log(NULL, AV_LOG_DEBUG, "rac failure at %d\n", i);
-STOP_TIMER("get_rac")
-    }
-
-    return 0;
-}
-#endif /* TEST */
diff --git a/libavcodec/rangecoder.h b/libavcodec/rangecoder.h
deleted file mode 100644
index 47c0362..0000000
--- a/libavcodec/rangecoder.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Range coder
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Range coder.
- */
-
-#ifndef AVCODEC_RANGECODER_H
-#define AVCODEC_RANGECODER_H
-
-#include <stdint.h>
-#include <assert.h>
-#include "libavutil/common.h"
-
-typedef struct RangeCoder{
-    int low;
-    int range;
-    int outstanding_count;
-    int outstanding_byte;
-    uint8_t zero_state[256];
-    uint8_t  one_state[256];
-    uint8_t *bytestream_start;
-    uint8_t *bytestream;
-    uint8_t *bytestream_end;
-}RangeCoder;
-
-void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size);
-void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf, int buf_size);
-int ff_rac_terminate(RangeCoder *c);
-void ff_build_rac_states(RangeCoder *c, int factor, int max_p);
-
-static inline void renorm_encoder(RangeCoder *c){
-    //FIXME optimize
-    while(c->range < 0x100){
-        if(c->outstanding_byte < 0){
-            c->outstanding_byte= c->low>>8;
-        }else if(c->low <= 0xFF00){
-            *c->bytestream++ = c->outstanding_byte;
-            for(;c->outstanding_count; c->outstanding_count--)
-                *c->bytestream++ = 0xFF;
-            c->outstanding_byte= c->low>>8;
-        }else if(c->low >= 0x10000){
-            *c->bytestream++ = c->outstanding_byte + 1;
-            for(;c->outstanding_count; c->outstanding_count--)
-                *c->bytestream++ = 0x00;
-            c->outstanding_byte= (c->low>>8) & 0xFF;
-        }else{
-            c->outstanding_count++;
-        }
-
-        c->low = (c->low & 0xFF)<<8;
-        c->range <<= 8;
-    }
-}
-
-static inline int get_rac_count(RangeCoder *c){
-    int x= c->bytestream - c->bytestream_start + c->outstanding_count;
-    if(c->outstanding_byte >= 0)
-        x++;
-    return 8*x - av_log2(c->range);
-}
-
-static inline void put_rac(RangeCoder *c, uint8_t * const state, int bit){
-    int range1= (c->range * (*state)) >> 8;
-
-    assert(*state);
-    assert(range1 < c->range);
-    assert(range1 > 0);
-    if(!bit){
-        c->range -= range1;
-        *state= c->zero_state[*state];
-    }else{
-        c->low += c->range - range1;
-        c->range = range1;
-        *state= c->one_state[*state];
-    }
-
-    renorm_encoder(c);
-}
-
-static inline void refill(RangeCoder *c){
-    if(c->range < 0x100){
-        c->range <<= 8;
-        c->low <<= 8;
-        if(c->bytestream < c->bytestream_end)
-            c->low+= c->bytestream[0];
-        c->bytestream++;
-    }
-}
-
-static inline int get_rac(RangeCoder *c, uint8_t * const state){
-    int range1= (c->range * (*state)) >> 8;
-    int av_unused one_mask;
-
-    c->range -= range1;
-#if 1
-    if(c->low < c->range){
-        *state= c->zero_state[*state];
-        refill(c);
-        return 0;
-    }else{
-        c->low -= c->range;
-        *state= c->one_state[*state];
-        c->range = range1;
-        refill(c);
-        return 1;
-    }
-#else
-    one_mask= (c->range - c->low-1)>>31;
-
-    c->low -= c->range & one_mask;
-    c->range += (range1 - c->range) & one_mask;
-
-    *state= c->zero_state[(*state) + (256&one_mask)];
-
-    refill(c);
-
-    return one_mask&1;
-#endif
-}
-
-#endif /* AVCODEC_RANGECODER_H */
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
deleted file mode 100644
index e52ef1a..0000000
--- a/libavcodec/ratecontrol.c
+++ /dev/null
@@ -1,961 +0,0 @@
-/*
- * Rate control for video encoders
- *
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Rate control for video encoders.
- */
-
-#include "libavutil/intmath.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "ratecontrol.h"
-#include "mpegvideo.h"
-#include "eval.h"
-
-#undef NDEBUG // Always check asserts, the speed effect is far too small to disable them.
-#include <assert.h>
-
-#ifndef M_E
-#define M_E 2.718281828
-#endif
-
-static int init_pass2(MpegEncContext *s);
-static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num);
-
-void ff_write_pass1_stats(MpegEncContext *s){
-    snprintf(s->avctx->stats_out, 256, "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d;\n",
-            s->current_picture_ptr->display_picture_number, s->current_picture_ptr->coded_picture_number, s->pict_type,
-            s->current_picture.quality, s->i_tex_bits, s->p_tex_bits, s->mv_bits, s->misc_bits,
-            s->f_code, s->b_code, s->current_picture.mc_mb_var_sum, s->current_picture.mb_var_sum, s->i_count, s->skip_count, s->header_bits);
-}
-
-static inline double qp2bits(RateControlEntry *rce, double qp){
-    if(qp<=0.0){
-        av_log(NULL, AV_LOG_ERROR, "qp<=0.0\n");
-    }
-    return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ qp;
-}
-
-static inline double bits2qp(RateControlEntry *rce, double bits){
-    if(bits<0.9){
-        av_log(NULL, AV_LOG_ERROR, "bits<0.9\n");
-    }
-    return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ bits;
-}
-
-int ff_rate_control_init(MpegEncContext *s)
-{
-    RateControlContext *rcc= &s->rc_context;
-    int i;
-    const char *error = NULL;
-    static const char * const const_names[]={
-        "PI",
-        "E",
-        "iTex",
-        "pTex",
-        "tex",
-        "mv",
-        "fCode",
-        "iCount",
-        "mcVar",
-        "var",
-        "isI",
-        "isP",
-        "isB",
-        "avgQP",
-        "qComp",
-/*        "lastIQP",
-        "lastPQP",
-        "lastBQP",
-        "nextNonBQP",*/
-        "avgIITex",
-        "avgPITex",
-        "avgPPTex",
-        "avgBPTex",
-        "avgTex",
-        NULL
-    };
-    static double (* const func1[])(void *, double)={
-        (void *)bits2qp,
-        (void *)qp2bits,
-        NULL
-    };
-    static const char * const func1_names[]={
-        "bits2qp",
-        "qp2bits",
-        NULL
-    };
-    emms_c();
-
-    rcc->rc_eq_eval = ff_parse_expr(s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1, func1_names, NULL, NULL, &error);
-    if (!rcc->rc_eq_eval) {
-        av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\": %s\n", s->avctx->rc_eq, error? error : "");
-        return -1;
-    }
-
-    for(i=0; i<5; i++){
-        rcc->pred[i].coeff= FF_QP2LAMBDA * 7.0;
-        rcc->pred[i].count= 1.0;
-
-        rcc->pred[i].decay= 0.4;
-        rcc->i_cplx_sum [i]=
-        rcc->p_cplx_sum [i]=
-        rcc->mv_bits_sum[i]=
-        rcc->qscale_sum [i]=
-        rcc->frame_count[i]= 1; // 1 is better because of 1/0 and such
-        rcc->last_qscale_for[i]=FF_QP2LAMBDA * 5;
-    }
-    rcc->buffer_index= s->avctx->rc_initial_buffer_occupancy;
-
-    if(s->flags&CODEC_FLAG_PASS2){
-        int i;
-        char *p;
-
-        /* find number of pics */
-        p= s->avctx->stats_in;
-        for(i=-1; p; i++){
-            p= strchr(p+1, ';');
-        }
-        i+= s->max_b_frames;
-        if(i<=0 || i>=INT_MAX / sizeof(RateControlEntry))
-            return -1;
-        rcc->entry = av_mallocz(i*sizeof(RateControlEntry));
-        rcc->num_entries= i;
-
-        /* init all to skipped p frames (with b frames we might have a not encoded frame at the end FIXME) */
-        for(i=0; i<rcc->num_entries; i++){
-            RateControlEntry *rce= &rcc->entry[i];
-            rce->pict_type= rce->new_pict_type=FF_P_TYPE;
-            rce->qscale= rce->new_qscale=FF_QP2LAMBDA * 2;
-            rce->misc_bits= s->mb_num + 10;
-            rce->mb_var_sum= s->mb_num*100;
-        }
-
-        /* read stats */
-        p= s->avctx->stats_in;
-        for(i=0; i<rcc->num_entries - s->max_b_frames; i++){
-            RateControlEntry *rce;
-            int picture_number;
-            int e;
-            char *next;
-
-            next= strchr(p, ';');
-            if(next){
-                (*next)=0; //sscanf in unbelievably slow on looong strings //FIXME copy / do not write
-                next++;
-            }
-            e= sscanf(p, " in:%d ", &picture_number);
-
-            assert(picture_number >= 0);
-            assert(picture_number < rcc->num_entries);
-            rce= &rcc->entry[picture_number];
-
-            e+=sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d",
-                   &rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits,
-                   &rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count, &rce->skip_count, &rce->header_bits);
-            if(e!=14){
-                av_log(s->avctx, AV_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e);
-                return -1;
-            }
-
-            p= next;
-        }
-
-        if(init_pass2(s) < 0) return -1;
-
-        //FIXME maybe move to end
-        if((s->flags&CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) {
-#if CONFIG_LIBXVID
-            return ff_xvid_rate_control_init(s);
-#else
-            av_log(s->avctx, AV_LOG_ERROR, "Xvid ratecontrol requires libavcodec compiled with Xvid support.\n");
-            return -1;
-#endif
-        }
-    }
-
-    if(!(s->flags&CODEC_FLAG_PASS2)){
-
-        rcc->short_term_qsum=0.001;
-        rcc->short_term_qcount=0.001;
-
-        rcc->pass1_rc_eq_output_sum= 0.001;
-        rcc->pass1_wanted_bits=0.001;
-
-        if(s->avctx->qblur > 1.0){
-            av_log(s->avctx, AV_LOG_ERROR, "qblur too large\n");
-            return -1;
-        }
-        /* init stuff with the user specified complexity */
-        if(s->avctx->rc_initial_cplx){
-            for(i=0; i<60*30; i++){
-                double bits= s->avctx->rc_initial_cplx * (i/10000.0 + 1.0)*s->mb_num;
-                RateControlEntry rce;
-
-                if     (i%((s->gop_size+3)/4)==0) rce.pict_type= FF_I_TYPE;
-                else if(i%(s->max_b_frames+1))    rce.pict_type= FF_B_TYPE;
-                else                              rce.pict_type= FF_P_TYPE;
-
-                rce.new_pict_type= rce.pict_type;
-                rce.mc_mb_var_sum= bits*s->mb_num/100000;
-                rce.mb_var_sum   = s->mb_num;
-                rce.qscale   = FF_QP2LAMBDA * 2;
-                rce.f_code   = 2;
-                rce.b_code   = 1;
-                rce.misc_bits= 1;
-
-                if(s->pict_type== FF_I_TYPE){
-                    rce.i_count   = s->mb_num;
-                    rce.i_tex_bits= bits;
-                    rce.p_tex_bits= 0;
-                    rce.mv_bits= 0;
-                }else{
-                    rce.i_count   = 0; //FIXME we do know this approx
-                    rce.i_tex_bits= 0;
-                    rce.p_tex_bits= bits*0.9;
-                    rce.mv_bits= bits*0.1;
-                }
-                rcc->i_cplx_sum [rce.pict_type] += rce.i_tex_bits*rce.qscale;
-                rcc->p_cplx_sum [rce.pict_type] += rce.p_tex_bits*rce.qscale;
-                rcc->mv_bits_sum[rce.pict_type] += rce.mv_bits;
-                rcc->frame_count[rce.pict_type] ++;
-
-                get_qscale(s, &rce, rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum, i);
-                rcc->pass1_wanted_bits+= s->bit_rate/(1/av_q2d(s->avctx->time_base)); //FIXME misbehaves a little for variable fps
-            }
-        }
-
-    }
-
-    return 0;
-}
-
-void ff_rate_control_uninit(MpegEncContext *s)
-{
-    RateControlContext *rcc= &s->rc_context;
-    emms_c();
-
-    ff_free_expr(rcc->rc_eq_eval);
-    av_freep(&rcc->entry);
-
-#if CONFIG_LIBXVID
-    if((s->flags&CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID)
-        ff_xvid_rate_control_uninit(s);
-#endif
-}
-
-int ff_vbv_update(MpegEncContext *s, int frame_size){
-    RateControlContext *rcc= &s->rc_context;
-    const double fps= 1/av_q2d(s->avctx->time_base);
-    const int buffer_size= s->avctx->rc_buffer_size;
-    const double min_rate= s->avctx->rc_min_rate/fps;
-    const double max_rate= s->avctx->rc_max_rate/fps;
-
-//printf("%d %f %d %f %f\n", buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate);
-    if(buffer_size){
-        int left;
-
-        rcc->buffer_index-= frame_size;
-        if(rcc->buffer_index < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "rc buffer underflow\n");
-            rcc->buffer_index= 0;
-        }
-
-        left= buffer_size - rcc->buffer_index - 1;
-        rcc->buffer_index += av_clip(left, min_rate, max_rate);
-
-        if(rcc->buffer_index > buffer_size){
-            int stuffing= ceil((rcc->buffer_index - buffer_size)/8);
-
-            if(stuffing < 4 && s->codec_id == CODEC_ID_MPEG4)
-                stuffing=4;
-            rcc->buffer_index -= 8*stuffing;
-
-            if(s->avctx->debug & FF_DEBUG_RC)
-                av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n", stuffing);
-
-            return stuffing;
-        }
-    }
-    return 0;
-}
-
-/**
- * modifies the bitrate curve from pass1 for one frame
- */
-static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num){
-    RateControlContext *rcc= &s->rc_context;
-    AVCodecContext *a= s->avctx;
-    double q, bits;
-    const int pict_type= rce->new_pict_type;
-    const double mb_num= s->mb_num;
-    int i;
-
-    double const_values[]={
-        M_PI,
-        M_E,
-        rce->i_tex_bits*rce->qscale,
-        rce->p_tex_bits*rce->qscale,
-        (rce->i_tex_bits + rce->p_tex_bits)*(double)rce->qscale,
-        rce->mv_bits/mb_num,
-        rce->pict_type == FF_B_TYPE ? (rce->f_code + rce->b_code)*0.5 : rce->f_code,
-        rce->i_count/mb_num,
-        rce->mc_mb_var_sum/mb_num,
-        rce->mb_var_sum/mb_num,
-        rce->pict_type == FF_I_TYPE,
-        rce->pict_type == FF_P_TYPE,
-        rce->pict_type == FF_B_TYPE,
-        rcc->qscale_sum[pict_type] / (double)rcc->frame_count[pict_type],
-        a->qcompress,
-/*        rcc->last_qscale_for[FF_I_TYPE],
-        rcc->last_qscale_for[FF_P_TYPE],
-        rcc->last_qscale_for[FF_B_TYPE],
-        rcc->next_non_b_qscale,*/
-        rcc->i_cplx_sum[FF_I_TYPE] / (double)rcc->frame_count[FF_I_TYPE],
-        rcc->i_cplx_sum[FF_P_TYPE] / (double)rcc->frame_count[FF_P_TYPE],
-        rcc->p_cplx_sum[FF_P_TYPE] / (double)rcc->frame_count[FF_P_TYPE],
-        rcc->p_cplx_sum[FF_B_TYPE] / (double)rcc->frame_count[FF_B_TYPE],
-        (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type],
-        0
-    };
-
-    bits= ff_eval_expr(rcc->rc_eq_eval, const_values, rce);
-    if (isnan(bits)) {
-        av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq);
-        return -1;
-    }
-
-    rcc->pass1_rc_eq_output_sum+= bits;
-    bits*=rate_factor;
-    if(bits<0.0) bits=0.0;
-    bits+= 1.0; //avoid 1/0 issues
-
-    /* user override */
-    for(i=0; i<s->avctx->rc_override_count; i++){
-        RcOverride *rco= s->avctx->rc_override;
-        if(rco[i].start_frame > frame_num) continue;
-        if(rco[i].end_frame   < frame_num) continue;
-
-        if(rco[i].qscale)
-            bits= qp2bits(rce, rco[i].qscale); //FIXME move at end to really force it?
-        else
-            bits*= rco[i].quality_factor;
-    }
-
-    q= bits2qp(rce, bits);
-
-    /* I/B difference */
-    if     (pict_type==FF_I_TYPE && s->avctx->i_quant_factor<0.0)
-        q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
-    else if(pict_type==FF_B_TYPE && s->avctx->b_quant_factor<0.0)
-        q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
-    if(q<1) q=1;
-
-    return q;
-}
-
-static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, double q){
-    RateControlContext *rcc= &s->rc_context;
-    AVCodecContext *a= s->avctx;
-    const int pict_type= rce->new_pict_type;
-    const double last_p_q    = rcc->last_qscale_for[FF_P_TYPE];
-    const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
-
-    if     (pict_type==FF_I_TYPE && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==FF_P_TYPE))
-        q= last_p_q    *FFABS(a->i_quant_factor) + a->i_quant_offset;
-    else if(pict_type==FF_B_TYPE && a->b_quant_factor>0.0)
-        q= last_non_b_q*    a->b_quant_factor  + a->b_quant_offset;
-    if(q<1) q=1;
-
-    /* last qscale / qdiff stuff */
-    if(rcc->last_non_b_pict_type==pict_type || pict_type!=FF_I_TYPE){
-        double last_q= rcc->last_qscale_for[pict_type];
-        const int maxdiff= FF_QP2LAMBDA * a->max_qdiff;
-
-        if     (q > last_q + maxdiff) q= last_q + maxdiff;
-        else if(q < last_q - maxdiff) q= last_q - maxdiff;
-    }
-
-    rcc->last_qscale_for[pict_type]= q; //Note we cannot do that after blurring
-
-    if(pict_type!=FF_B_TYPE)
-        rcc->last_non_b_pict_type= pict_type;
-
-    return q;
-}
-
-/**
- * gets the qmin & qmax for pict_type
- */
-static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type){
-    int qmin= s->avctx->lmin;
-    int qmax= s->avctx->lmax;
-
-    assert(qmin <= qmax);
-
-    if(pict_type==FF_B_TYPE){
-        qmin= (int)(qmin*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
-        qmax= (int)(qmax*FFABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
-    }else if(pict_type==FF_I_TYPE){
-        qmin= (int)(qmin*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
-        qmax= (int)(qmax*FFABS(s->avctx->i_quant_factor)+s->avctx->i_quant_offset + 0.5);
-    }
-
-    qmin= av_clip(qmin, 1, FF_LAMBDA_MAX);
-    qmax= av_clip(qmax, 1, FF_LAMBDA_MAX);
-
-    if(qmax<qmin) qmax= qmin;
-
-    *qmin_ret= qmin;
-    *qmax_ret= qmax;
-}
-
-static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q, int frame_num){
-    RateControlContext *rcc= &s->rc_context;
-    int qmin, qmax;
-    const int pict_type= rce->new_pict_type;
-    const double buffer_size= s->avctx->rc_buffer_size;
-    const double fps= 1/av_q2d(s->avctx->time_base);
-    const double min_rate= s->avctx->rc_min_rate / fps;
-    const double max_rate= s->avctx->rc_max_rate / fps;
-
-    get_qminmax(&qmin, &qmax, s, pict_type);
-
-    /* modulation */
-    if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==FF_P_TYPE)
-        q*= s->avctx->rc_qmod_amp;
-
-//printf("q:%f\n", q);
-    /* buffer overflow/underflow protection */
-    if(buffer_size){
-        double expected_size= rcc->buffer_index;
-        double q_limit;
-
-        if(min_rate){
-            double d= 2*(buffer_size - expected_size)/buffer_size;
-            if(d>1.0) d=1.0;
-            else if(d<0.0001) d=0.0001;
-            q*= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
-
-            q_limit= bits2qp(rce, FFMAX((min_rate - buffer_size + rcc->buffer_index) * s->avctx->rc_min_vbv_overflow_use, 1));
-            if(q > q_limit){
-                if(s->avctx->debug&FF_DEBUG_RC){
-                    av_log(s->avctx, AV_LOG_DEBUG, "limiting QP %f -> %f\n", q, q_limit);
-                }
-                q= q_limit;
-            }
-        }
-
-        if(max_rate){
-            double d= 2*expected_size/buffer_size;
-            if(d>1.0) d=1.0;
-            else if(d<0.0001) d=0.0001;
-            q/= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
-
-            q_limit= bits2qp(rce, FFMAX(rcc->buffer_index * s->avctx->rc_max_available_vbv_use, 1));
-            if(q < q_limit){
-                if(s->avctx->debug&FF_DEBUG_RC){
-                    av_log(s->avctx, AV_LOG_DEBUG, "limiting QP %f -> %f\n", q, q_limit);
-                }
-                q= q_limit;
-            }
-        }
-    }
-//printf("q:%f max:%f min:%f size:%f index:%d bits:%f agr:%f\n", q,max_rate, min_rate, buffer_size, rcc->buffer_index, bits, s->avctx->rc_buffer_aggressivity);
-    if(s->avctx->rc_qsquish==0.0 || qmin==qmax){
-        if     (q<qmin) q=qmin;
-        else if(q>qmax) q=qmax;
-    }else{
-        double min2= log(qmin);
-        double max2= log(qmax);
-
-        q= log(q);
-        q= (q - min2)/(max2-min2) - 0.5;
-        q*= -4.0;
-        q= 1.0/(1.0 + exp(q));
-        q= q*(max2-min2) + min2;
-
-        q= exp(q);
-    }
-
-    return q;
-}
-
-//----------------------------------
-// 1 Pass Code
-
-static double predict_size(Predictor *p, double q, double var)
-{
-     return p->coeff*var / (q*p->count);
-}
-
-/*
-static double predict_qp(Predictor *p, double size, double var)
-{
-//printf("coeff:%f, count:%f, var:%f, size:%f//\n", p->coeff, p->count, var, size);
-     return p->coeff*var / (size*p->count);
-}
-*/
-
-static void update_predictor(Predictor *p, double q, double var, double size)
-{
-    double new_coeff= size*q / (var + 1);
-    if(var<10) return;
-
-    p->count*= p->decay;
-    p->coeff*= p->decay;
-    p->count++;
-    p->coeff+= new_coeff;
-}
-
-static void adaptive_quantization(MpegEncContext *s, double q){
-    int i;
-    const float lumi_masking= s->avctx->lumi_masking / (128.0*128.0);
-    const float dark_masking= s->avctx->dark_masking / (128.0*128.0);
-    const float temp_cplx_masking= s->avctx->temporal_cplx_masking;
-    const float spatial_cplx_masking = s->avctx->spatial_cplx_masking;
-    const float p_masking = s->avctx->p_masking;
-    const float border_masking = s->avctx->border_masking;
-    float bits_sum= 0.0;
-    float cplx_sum= 0.0;
-    float cplx_tab[s->mb_num];
-    float bits_tab[s->mb_num];
-    const int qmin= s->avctx->mb_lmin;
-    const int qmax= s->avctx->mb_lmax;
-    Picture * const pic= &s->current_picture;
-    const int mb_width = s->mb_width;
-    const int mb_height = s->mb_height;
-
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[i];
-        float temp_cplx= sqrt(pic->mc_mb_var[mb_xy]); //FIXME merge in pow()
-        float spat_cplx= sqrt(pic->mb_var[mb_xy]);
-        const int lumi= pic->mb_mean[mb_xy];
-        float bits, cplx, factor;
-        int mb_x = mb_xy % s->mb_stride;
-        int mb_y = mb_xy / s->mb_stride;
-        int mb_distance;
-        float mb_factor = 0.0;
-#if 0
-        if(spat_cplx < q/3) spat_cplx= q/3; //FIXME finetune
-        if(temp_cplx < q/3) temp_cplx= q/3; //FIXME finetune
-#endif
-        if(spat_cplx < 4) spat_cplx= 4; //FIXME finetune
-        if(temp_cplx < 4) temp_cplx= 4; //FIXME finetune
-
-        if((s->mb_type[mb_xy]&CANDIDATE_MB_TYPE_INTRA)){//FIXME hq mode
-            cplx= spat_cplx;
-            factor= 1.0 + p_masking;
-        }else{
-            cplx= temp_cplx;
-            factor= pow(temp_cplx, - temp_cplx_masking);
-        }
-        factor*=pow(spat_cplx, - spatial_cplx_masking);
-
-        if(lumi>127)
-            factor*= (1.0 - (lumi-128)*(lumi-128)*lumi_masking);
-        else
-            factor*= (1.0 - (lumi-128)*(lumi-128)*dark_masking);
-
-        if(mb_x < mb_width/5){
-            mb_distance = mb_width/5 - mb_x;
-            mb_factor = (float)mb_distance / (float)(mb_width/5);
-        }else if(mb_x > 4*mb_width/5){
-            mb_distance = mb_x - 4*mb_width/5;
-            mb_factor = (float)mb_distance / (float)(mb_width/5);
-        }
-        if(mb_y < mb_height/5){
-            mb_distance = mb_height/5 - mb_y;
-            mb_factor = FFMAX(mb_factor, (float)mb_distance / (float)(mb_height/5));
-        }else if(mb_y > 4*mb_height/5){
-            mb_distance = mb_y - 4*mb_height/5;
-            mb_factor = FFMAX(mb_factor, (float)mb_distance / (float)(mb_height/5));
-        }
-
-        factor*= 1.0 - border_masking*mb_factor;
-
-        if(factor<0.00001) factor= 0.00001;
-
-        bits= cplx*factor;
-        cplx_sum+= cplx;
-        bits_sum+= bits;
-        cplx_tab[i]= cplx;
-        bits_tab[i]= bits;
-    }
-
-    /* handle qmin/qmax clipping */
-    if(s->flags&CODEC_FLAG_NORMALIZE_AQP){
-        float factor= bits_sum/cplx_sum;
-        for(i=0; i<s->mb_num; i++){
-            float newq= q*cplx_tab[i]/bits_tab[i];
-            newq*= factor;
-
-            if     (newq > qmax){
-                bits_sum -= bits_tab[i];
-                cplx_sum -= cplx_tab[i]*q/qmax;
-            }
-            else if(newq < qmin){
-                bits_sum -= bits_tab[i];
-                cplx_sum -= cplx_tab[i]*q/qmin;
-            }
-        }
-        if(bits_sum < 0.001) bits_sum= 0.001;
-        if(cplx_sum < 0.001) cplx_sum= 0.001;
-    }
-
-    for(i=0; i<s->mb_num; i++){
-        const int mb_xy= s->mb_index2xy[i];
-        float newq= q*cplx_tab[i]/bits_tab[i];
-        int intq;
-
-        if(s->flags&CODEC_FLAG_NORMALIZE_AQP){
-            newq*= bits_sum/cplx_sum;
-        }
-
-        intq= (int)(newq + 0.5);
-
-        if     (intq > qmax) intq= qmax;
-        else if(intq < qmin) intq= qmin;
-//if(i%s->mb_width==0) printf("\n");
-//printf("%2d%3d ", intq, ff_sqrt(s->mc_mb_var[i]));
-        s->lambda_table[mb_xy]= intq;
-    }
-}
-
-void ff_get_2pass_fcode(MpegEncContext *s){
-    RateControlContext *rcc= &s->rc_context;
-    int picture_number= s->picture_number;
-    RateControlEntry *rce;
-
-    rce= &rcc->entry[picture_number];
-    s->f_code= rce->f_code;
-    s->b_code= rce->b_code;
-}
-
-//FIXME rd or at least approx for dquant
-
-float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run)
-{
-    float q;
-    int qmin, qmax;
-    float br_compensation;
-    double diff;
-    double short_term_q;
-    double fps;
-    int picture_number= s->picture_number;
-    int64_t wanted_bits;
-    RateControlContext *rcc= &s->rc_context;
-    AVCodecContext *a= s->avctx;
-    RateControlEntry local_rce, *rce;
-    double bits;
-    double rate_factor;
-    int var;
-    const int pict_type= s->pict_type;
-    Picture * const pic= &s->current_picture;
-    emms_c();
-
-#if CONFIG_LIBXVID
-    if((s->flags&CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID)
-        return ff_xvid_rate_estimate_qscale(s, dry_run);
-#endif
-
-    get_qminmax(&qmin, &qmax, s, pict_type);
-
-    fps= 1/av_q2d(s->avctx->time_base);
-//printf("input_pic_num:%d pic_num:%d frame_rate:%d\n", s->input_picture_number, s->picture_number, s->frame_rate);
-        /* update predictors */
-    if(picture_number>2 && !dry_run){
-        const int last_var= s->last_pict_type == FF_I_TYPE ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
-        update_predictor(&rcc->pred[s->last_pict_type], rcc->last_qscale, sqrt(last_var), s->frame_bits);
-    }
-
-    if(s->flags&CODEC_FLAG_PASS2){
-        assert(picture_number>=0);
-        assert(picture_number<rcc->num_entries);
-        rce= &rcc->entry[picture_number];
-        wanted_bits= rce->expected_bits;
-    }else{
-        Picture *dts_pic;
-        rce= &local_rce;
-
-        //FIXME add a dts field to AVFrame and ensure its set and use it here instead of reordering
-        //but the reordering is simpler for now until h.264 b pyramid must be handeld
-        if(s->pict_type == FF_B_TYPE || s->low_delay)
-            dts_pic= s->current_picture_ptr;
-        else
-            dts_pic= s->last_picture_ptr;
-
-//if(dts_pic)
-//            av_log(NULL, AV_LOG_ERROR, "%Ld %Ld %Ld %d\n", s->current_picture_ptr->pts, s->user_specified_pts, dts_pic->pts, picture_number);
-
-        if(!dts_pic || dts_pic->pts == AV_NOPTS_VALUE)
-            wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps);
-        else
-            wanted_bits= (uint64_t)(s->bit_rate*(double)dts_pic->pts/fps);
-    }
-
-    diff= s->total_bits - wanted_bits;
-    br_compensation= (a->bit_rate_tolerance - diff)/a->bit_rate_tolerance;
-    if(br_compensation<=0.0) br_compensation=0.001;
-
-    var= pict_type == FF_I_TYPE ? pic->mb_var_sum : pic->mc_mb_var_sum;
-
-    short_term_q = 0; /* avoid warning */
-    if(s->flags&CODEC_FLAG_PASS2){
-        if(pict_type!=FF_I_TYPE)
-            assert(pict_type == rce->new_pict_type);
-
-        q= rce->new_qscale / br_compensation;
-//printf("%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, br_compensation, s->frame_bits, var, pict_type);
-    }else{
-        rce->pict_type=
-        rce->new_pict_type= pict_type;
-        rce->mc_mb_var_sum= pic->mc_mb_var_sum;
-        rce->mb_var_sum   = pic->   mb_var_sum;
-        rce->qscale   = FF_QP2LAMBDA * 2;
-        rce->f_code   = s->f_code;
-        rce->b_code   = s->b_code;
-        rce->misc_bits= 1;
-
-        bits= predict_size(&rcc->pred[pict_type], rce->qscale, sqrt(var));
-        if(pict_type== FF_I_TYPE){
-            rce->i_count   = s->mb_num;
-            rce->i_tex_bits= bits;
-            rce->p_tex_bits= 0;
-            rce->mv_bits= 0;
-        }else{
-            rce->i_count   = 0; //FIXME we do know this approx
-            rce->i_tex_bits= 0;
-            rce->p_tex_bits= bits*0.9;
-
-            rce->mv_bits= bits*0.1;
-        }
-        rcc->i_cplx_sum [pict_type] += rce->i_tex_bits*rce->qscale;
-        rcc->p_cplx_sum [pict_type] += rce->p_tex_bits*rce->qscale;
-        rcc->mv_bits_sum[pict_type] += rce->mv_bits;
-        rcc->frame_count[pict_type] ++;
-
-        bits= rce->i_tex_bits + rce->p_tex_bits;
-        rate_factor= rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum * br_compensation;
-
-        q= get_qscale(s, rce, rate_factor, picture_number);
-        if (q < 0)
-            return -1;
-
-        assert(q>0.0);
-//printf("%f ", q);
-        q= get_diff_limited_q(s, rce, q);
-//printf("%f ", q);
-        assert(q>0.0);
-
-        if(pict_type==FF_P_TYPE || s->intra_only){ //FIXME type dependent blur like in 2-pass
-            rcc->short_term_qsum*=a->qblur;
-            rcc->short_term_qcount*=a->qblur;
-
-            rcc->short_term_qsum+= q;
-            rcc->short_term_qcount++;
-//printf("%f ", q);
-            q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount;
-//printf("%f ", q);
-        }
-        assert(q>0.0);
-
-        q= modify_qscale(s, rce, q, picture_number);
-
-        rcc->pass1_wanted_bits+= s->bit_rate/fps;
-
-        assert(q>0.0);
-    }
-
-    if(s->avctx->debug&FF_DEBUG_RC){
-        av_log(s->avctx, AV_LOG_DEBUG, "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f size:%d var:%d/%d br:%d fps:%d\n",
-        av_get_pict_type_char(pict_type), qmin, q, qmax, picture_number, (int)wanted_bits/1000, (int)s->total_bits/1000,
-        br_compensation, short_term_q, s->frame_bits, pic->mb_var_sum, pic->mc_mb_var_sum, s->bit_rate/1000, (int)fps
-        );
-    }
-
-    if     (q<qmin) q=qmin;
-    else if(q>qmax) q=qmax;
-
-    if(s->adaptive_quant)
-        adaptive_quantization(s, q);
-    else
-        q= (int)(q + 0.5);
-
-    if(!dry_run){
-        rcc->last_qscale= q;
-        rcc->last_mc_mb_var_sum= pic->mc_mb_var_sum;
-        rcc->last_mb_var_sum= pic->mb_var_sum;
-    }
-#if 0
-{
-    static int mvsum=0, texsum=0;
-    mvsum += s->mv_bits;
-    texsum += s->i_tex_bits + s->p_tex_bits;
-    printf("%d %d//\n\n", mvsum, texsum);
-}
-#endif
-    return q;
-}
-
-//----------------------------------------------
-// 2-Pass code
-
-static int init_pass2(MpegEncContext *s)
-{
-    RateControlContext *rcc= &s->rc_context;
-    AVCodecContext *a= s->avctx;
-    int i, toobig;
-    double fps= 1/av_q2d(s->avctx->time_base);
-    double complexity[5]={0,0,0,0,0};   // aproximate bits at quant=1
-    uint64_t const_bits[5]={0,0,0,0,0}; // quantizer independent bits
-    uint64_t all_const_bits;
-    uint64_t all_available_bits= (uint64_t)(s->bit_rate*(double)rcc->num_entries/fps);
-    double rate_factor=0;
-    double step;
-    //int last_i_frame=-10000000;
-    const int filter_size= (int)(a->qblur*4) | 1;
-    double expected_bits;
-    double *qscale, *blurred_qscale, qscale_sum;
-
-    /* find complexity & const_bits & decide the pict_types */
-    for(i=0; i<rcc->num_entries; i++){
-        RateControlEntry *rce= &rcc->entry[i];
-
-        rce->new_pict_type= rce->pict_type;
-        rcc->i_cplx_sum [rce->pict_type] += rce->i_tex_bits*rce->qscale;
-        rcc->p_cplx_sum [rce->pict_type] += rce->p_tex_bits*rce->qscale;
-        rcc->mv_bits_sum[rce->pict_type] += rce->mv_bits;
-        rcc->frame_count[rce->pict_type] ++;
-
-        complexity[rce->new_pict_type]+= (rce->i_tex_bits+ rce->p_tex_bits)*(double)rce->qscale;
-        const_bits[rce->new_pict_type]+= rce->mv_bits + rce->misc_bits;
-    }
-    all_const_bits= const_bits[FF_I_TYPE] + const_bits[FF_P_TYPE] + const_bits[FF_B_TYPE];
-
-    if(all_available_bits < all_const_bits){
-        av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is too low\n");
-        return -1;
-    }
-
-    qscale= av_malloc(sizeof(double)*rcc->num_entries);
-    blurred_qscale= av_malloc(sizeof(double)*rcc->num_entries);
-    toobig = 0;
-
-    for(step=256*256; step>0.0000001; step*=0.5){
-        expected_bits=0;
-        rate_factor+= step;
-
-        rcc->buffer_index= s->avctx->rc_buffer_size/2;
-
-        /* find qscale */
-        for(i=0; i<rcc->num_entries; i++){
-            qscale[i]= get_qscale(s, &rcc->entry[i], rate_factor, i);
-        }
-        assert(filter_size%2==1);
-
-        /* fixed I/B QP relative to P mode */
-        for(i=rcc->num_entries-1; i>=0; i--){
-            RateControlEntry *rce= &rcc->entry[i];
-
-            qscale[i]= get_diff_limited_q(s, rce, qscale[i]);
-        }
-
-        /* smooth curve */
-        for(i=0; i<rcc->num_entries; i++){
-            RateControlEntry *rce= &rcc->entry[i];
-            const int pict_type= rce->new_pict_type;
-            int j;
-            double q=0.0, sum=0.0;
-
-            for(j=0; j<filter_size; j++){
-                int index= i+j-filter_size/2;
-                double d= index-i;
-                double coeff= a->qblur==0 ? 1.0 : exp(-d*d/(a->qblur * a->qblur));
-
-                if(index < 0 || index >= rcc->num_entries) continue;
-                if(pict_type != rcc->entry[index].new_pict_type) continue;
-                q+= qscale[index] * coeff;
-                sum+= coeff;
-            }
-            blurred_qscale[i]= q/sum;
-        }
-
-        /* find expected bits */
-        for(i=0; i<rcc->num_entries; i++){
-            RateControlEntry *rce= &rcc->entry[i];
-            double bits;
-            rce->new_qscale= modify_qscale(s, rce, blurred_qscale[i], i);
-            bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits;
-//printf("%d %f\n", rce->new_bits, blurred_qscale[i]);
-            bits += 8*ff_vbv_update(s, bits);
-
-            rce->expected_bits= expected_bits;
-            expected_bits += bits;
-        }
-
-        /*
-        av_log(s->avctx, AV_LOG_INFO,
-            "expected_bits: %f all_available_bits: %d rate_factor: %f\n",
-            expected_bits, (int)all_available_bits, rate_factor);
-        */
-        if(expected_bits > all_available_bits) {
-            rate_factor-= step;
-            ++toobig;
-        }
-    }
-    av_free(qscale);
-    av_free(blurred_qscale);
-
-    /* check bitrate calculations and print info */
-    qscale_sum = 0.0;
-    for(i=0; i<rcc->num_entries; i++){
-        /* av_log(s->avctx, AV_LOG_DEBUG, "[lavc rc] entry[%d].new_qscale = %.3f  qp = %.3f\n",
-            i, rcc->entry[i].new_qscale, rcc->entry[i].new_qscale / FF_QP2LAMBDA); */
-        qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, s->avctx->qmin, s->avctx->qmax);
-    }
-    assert(toobig <= 40);
-    av_log(s->avctx, AV_LOG_DEBUG,
-        "[lavc rc] requested bitrate: %d bps  expected bitrate: %d bps\n",
-        s->bit_rate,
-        (int)(expected_bits / ((double)all_available_bits/s->bit_rate)));
-    av_log(s->avctx, AV_LOG_DEBUG,
-        "[lavc rc] estimated target average qp: %.3f\n",
-        (float)qscale_sum / rcc->num_entries);
-    if (toobig == 0) {
-        av_log(s->avctx, AV_LOG_INFO,
-            "[lavc rc] Using all of requested bitrate is not "
-            "necessary for this video with these parameters.\n");
-    } else if (toobig == 40) {
-        av_log(s->avctx, AV_LOG_ERROR,
-            "[lavc rc] Error: bitrate too low for this video "
-            "with these parameters.\n");
-        return -1;
-    } else if (fabs(expected_bits/all_available_bits - 1.0) > 0.01) {
-        av_log(s->avctx, AV_LOG_ERROR,
-            "[lavc rc] Error: 2pass curve failed to converge\n");
-        return -1;
-    }
-
-    return 0;
-}
diff --git a/libavcodec/ratecontrol.h b/libavcodec/ratecontrol.h
deleted file mode 100644
index d5fe2bc..0000000
--- a/libavcodec/ratecontrol.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Ratecontrol
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_RATECONTROL_H
-#define AVCODEC_RATECONTROL_H
-
-/**
- * @file
- * ratecontrol header.
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include "eval.h"
-
-typedef struct Predictor{
-    double coeff;
-    double count;
-    double decay;
-} Predictor;
-
-typedef struct RateControlEntry{
-    int pict_type;
-    float qscale;
-    int mv_bits;
-    int i_tex_bits;
-    int p_tex_bits;
-    int misc_bits;
-    int header_bits;
-    uint64_t expected_bits;
-    int new_pict_type;
-    float new_qscale;
-    int mc_mb_var_sum;
-    int mb_var_sum;
-    int i_count;
-    int skip_count;
-    int f_code;
-    int b_code;
-}RateControlEntry;
-
-/**
- * rate control context.
- */
-typedef struct RateControlContext{
-    FILE *stats_file;
-    int num_entries;              ///< number of RateControlEntries
-    RateControlEntry *entry;
-    double buffer_index;          ///< amount of bits in the video/audio buffer
-    Predictor pred[5];
-    double short_term_qsum;       ///< sum of recent qscales
-    double short_term_qcount;     ///< count of recent qscales
-    double pass1_rc_eq_output_sum;///< sum of the output of the rc equation, this is used for normalization
-    double pass1_wanted_bits;     ///< bits which should have been outputed by the pass1 code (including complexity init)
-    double last_qscale;
-    double last_qscale_for[5];    ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff
-    int last_mc_mb_var_sum;
-    int last_mb_var_sum;
-    uint64_t i_cplx_sum[5];
-    uint64_t p_cplx_sum[5];
-    uint64_t mv_bits_sum[5];
-    uint64_t qscale_sum[5];
-    int frame_count[5];
-    int last_non_b_pict_type;
-
-    void *non_lavc_opaque;        ///< context for non lavc rc code (for example xvid)
-    float dry_run_qscale;         ///< for xvid rc
-    int last_picture_number;      ///< for xvid rc
-    AVExpr * rc_eq_eval;
-}RateControlContext;
-
-struct MpegEncContext;
-
-/* rate control */
-int ff_rate_control_init(struct MpegEncContext *s);
-float ff_rate_estimate_qscale(struct MpegEncContext *s, int dry_run);
-void ff_write_pass1_stats(struct MpegEncContext *s);
-void ff_rate_control_uninit(struct MpegEncContext *s);
-int ff_vbv_update(struct MpegEncContext *s, int frame_size);
-void ff_get_2pass_fcode(struct MpegEncContext *s);
-
-int ff_xvid_rate_control_init(struct MpegEncContext *s);
-void ff_xvid_rate_control_uninit(struct MpegEncContext *s);
-float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run);
-
-#endif /* AVCODEC_RATECONTROL_H */
-
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
deleted file mode 100644
index c2ce3bc..0000000
--- a/libavcodec/raw.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Raw Video Codec
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Raw Video Codec
- */
-
-#include "avcodec.h"
-#include "raw.h"
-
-const PixelFormatTag ff_raw_pixelFormatTags[] = {
-    { PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */
-    { PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') },
-    { PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') },
-    { PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') },
-    { PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') },
-    { PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') },
-    { PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') },
-    { PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') },
-    { PIX_FMT_GRAY8,   MKTAG('Y', '8', '0', '0') },
-    { PIX_FMT_GRAY8,   MKTAG(' ', ' ', 'Y', '8') },
-
-
-    { PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */
-    { PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') },
-    { PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') },
-    { PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') },
-    { PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') },
-    { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') },
-    { PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') },
-    { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') },
-    { PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') },
-    { PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') },
-    { PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') },
-    { PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */
-    { PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */
-    { PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') },
-    { PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
-    { PIX_FMT_GRAY8,   MKTAG('G', 'R', 'E', 'Y') },
-    { PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) },
-    { PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) },
-    { PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) },
-    { PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) },
-    { PIX_FMT_RGB565LE, MKTAG( 3 ,  0 ,  0 ,  0) },
-
-    /* quicktime */
-    { PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') },
-    { PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') },
-    { PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */
-    { PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
-    { PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
-    { PIX_FMT_PAL8,    MKTAG('W', 'R', 'A', 'W') },
-
-    { PIX_FMT_NONE, 0 },
-};
-
-unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat fmt)
-{
-    const PixelFormatTag * tags = ff_raw_pixelFormatTags;
-    while (tags->pix_fmt >= 0) {
-        if (tags->pix_fmt == fmt)
-            return tags->fourcc;
-        tags++;
-    }
-    return 0;
-}
diff --git a/libavcodec/raw.h b/libavcodec/raw.h
deleted file mode 100644
index e74006a..0000000
--- a/libavcodec/raw.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Raw Video Codec
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Raw Video Codec
- */
-
-#ifndef AVCODEC_RAW_H
-#define AVCODEC_RAW_H
-
-#include "avcodec.h"
-
-typedef struct PixelFormatTag {
-    enum PixelFormat pix_fmt;
-    unsigned int fourcc;
-} PixelFormatTag;
-
-extern const PixelFormatTag ff_raw_pixelFormatTags[];
-
-#endif /* AVCODEC_RAW_H */
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
deleted file mode 100644
index 8b398d2..0000000
--- a/libavcodec/rawdec.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Raw Video Decoder
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Raw Video Decoder
- */
-
-#include "avcodec.h"
-#include "raw.h"
-#include "libavutil/intreadwrite.h"
-
-typedef struct RawVideoContext {
-    unsigned char * buffer;  /* block of memory for holding one frame */
-    int             length;  /* number of bytes in buffer */
-    int flip;
-    AVFrame pic;             ///< AVCodecContext.coded_frame
-} RawVideoContext;
-
-static const PixelFormatTag pixelFormatBpsAVI[] = {
-    { PIX_FMT_PAL8,    4 },
-    { PIX_FMT_PAL8,    8 },
-    { PIX_FMT_RGB555, 15 },
-    { PIX_FMT_RGB555, 16 },
-    { PIX_FMT_BGR24,  24 },
-    { PIX_FMT_RGB32,  32 },
-    { PIX_FMT_NONE, 0 },
-};
-
-static const PixelFormatTag pixelFormatBpsMOV[] = {
-    { PIX_FMT_MONOWHITE, 1 },
-    { PIX_FMT_PAL8,      2 },
-    { PIX_FMT_PAL8,      4 },
-    { PIX_FMT_PAL8,      8 },
-    // FIXME swscale does not support 16 bit in .mov, sample 16bit.mov
-    // http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html
-    { PIX_FMT_RGB555BE, 16 },
-    { PIX_FMT_RGB24,    24 },
-    { PIX_FMT_ARGB,     32 },
-    { PIX_FMT_NONE, 0 },
-};
-
-static enum PixelFormat findPixelFormat(const PixelFormatTag *tags, unsigned int fourcc)
-{
-    while (tags->pix_fmt >= 0) {
-        if (tags->fourcc == fourcc)
-            return tags->pix_fmt;
-        tags++;
-    }
-    return PIX_FMT_YUV420P;
-}
-
-static av_cold int raw_init_decoder(AVCodecContext *avctx)
-{
-    RawVideoContext *context = avctx->priv_data;
-
-    if (avctx->codec_tag == MKTAG('r','a','w',' '))
-        avctx->pix_fmt = findPixelFormat(pixelFormatBpsMOV, avctx->bits_per_coded_sample);
-    else if (avctx->codec_tag)
-        avctx->pix_fmt = findPixelFormat(ff_raw_pixelFormatTags, avctx->codec_tag);
-    else if (avctx->bits_per_coded_sample)
-        avctx->pix_fmt = findPixelFormat(pixelFormatBpsAVI, avctx->bits_per_coded_sample);
-
-    context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
-    context->buffer = av_malloc(context->length);
-    context->pic.pict_type = FF_I_TYPE;
-    context->pic.key_frame = 1;
-
-    avctx->coded_frame= &context->pic;
-
-    if (!context->buffer)
-        return -1;
-
-    if((avctx->extradata_size >= 9 && !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9)) ||
-       avctx->codec_tag == MKTAG( 3 ,  0 ,  0 ,  0 ))
-        context->flip=1;
-
-    return 0;
-}
-
-static void flip(AVCodecContext *avctx, AVPicture * picture){
-    picture->data[0] += picture->linesize[0] * (avctx->height-1);
-    picture->linesize[0] *= -1;
-}
-
-static int raw_decode(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    RawVideoContext *context = avctx->priv_data;
-
-    AVFrame * frame = (AVFrame *) data;
-    AVPicture * picture = (AVPicture *) data;
-
-    frame->interlaced_frame = avctx->coded_frame->interlaced_frame;
-    frame->top_field_first = avctx->coded_frame->top_field_first;
-
-    //2bpp and 4bpp raw in avi and mov (yes this is ugly ...)
-    if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
-       avctx->pix_fmt==PIX_FMT_PAL8 &&
-       (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
-        int i;
-        uint8_t *dst = context->buffer + 256*4;
-        buf_size = context->length - 256*4;
-        if (avctx->bits_per_coded_sample == 4){
-            for(i=0; 2*i+1 < buf_size; i++){
-                dst[2*i+0]= buf[i]>>4;
-                dst[2*i+1]= buf[i]&15;
-            }
-        } else
-            for(i=0; 4*i+3 < buf_size; i++){
-                dst[4*i+0]= buf[i]>>6;
-                dst[4*i+1]= buf[i]>>4&3;
-                dst[4*i+2]= buf[i]>>2&3;
-                dst[4*i+3]= buf[i]   &3;
-            }
-        buf= dst;
-    }
-
-    if(avctx->codec_tag == MKTAG('A', 'V', '1', 'x') ||
-       avctx->codec_tag == MKTAG('A', 'V', 'u', 'p'))
-        buf += buf_size - context->length;
-
-    if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0))
-        return -1;
-
-    avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height);
-    if(avctx->pix_fmt==PIX_FMT_PAL8 && buf_size < context->length){
-        frame->data[1]= context->buffer;
-    }
-    if (avctx->palctrl && avctx->palctrl->palette_changed) {
-        memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
-        avctx->palctrl->palette_changed = 0;
-    }
-    if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size)
-        frame->linesize[0] = (frame->linesize[0]+3)&~3;
-
-    if(context->flip)
-        flip(avctx, picture);
-
-    if (   avctx->codec_tag == MKTAG('Y', 'V', '1', '2')
-        || avctx->codec_tag == MKTAG('Y', 'V', 'U', '9'))
-        FFSWAP(uint8_t *, picture->data[1], picture->data[2]);
-
-    if(avctx->codec_tag == AV_RL32("yuv2") &&
-       avctx->pix_fmt   == PIX_FMT_YUYV422) {
-        int x, y;
-        uint8_t *line = picture->data[0];
-        for(y = 0; y < avctx->height; y++) {
-            for(x = 0; x < avctx->width; x++)
-                line[2*x + 1] ^= 0x80;
-            line += picture->linesize[0];
-        }
-    }
-
-    *data_size = sizeof(AVPicture);
-    return buf_size;
-}
-
-static av_cold int raw_close_decoder(AVCodecContext *avctx)
-{
-    RawVideoContext *context = avctx->priv_data;
-
-    av_freep(&context->buffer);
-    return 0;
-}
-
-AVCodec rawvideo_decoder = {
-    "rawvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RAWVIDEO,
-    sizeof(RawVideoContext),
-    raw_init_decoder,
-    NULL,
-    raw_close_decoder,
-    raw_decode,
-    .long_name = NULL_IF_CONFIG_SMALL("raw video"),
-};
diff --git a/libavcodec/rawenc.c b/libavcodec/rawenc.c
deleted file mode 100644
index 4199704..0000000
--- a/libavcodec/rawenc.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Raw Video Encoder
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Raw Video Encoder
- */
-
-#include "avcodec.h"
-#include "raw.h"
-#include "libavutil/pixdesc.h"
-#include "libavutil/intreadwrite.h"
-
-static av_cold int raw_init_encoder(AVCodecContext *avctx)
-{
-    avctx->coded_frame = (AVFrame *)avctx->priv_data;
-    avctx->coded_frame->pict_type = FF_I_TYPE;
-    avctx->coded_frame->key_frame = 1;
-    avctx->bits_per_coded_sample = av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]);
-    if(!avctx->codec_tag)
-        avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);
-    return 0;
-}
-
-static int raw_encode(AVCodecContext *avctx,
-                            unsigned char *frame, int buf_size, void *data)
-{
-    int ret = avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width,
-                                               avctx->height, frame, buf_size);
-
-    if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 &&
-       avctx->pix_fmt   == PIX_FMT_YUYV422) {
-        int x;
-        for(x = 1; x < avctx->height*avctx->width*2; x += 2)
-            frame[x] ^= 0x80;
-    }
-    return ret;
-}
-
-AVCodec rawvideo_encoder = {
-    "rawvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RAWVIDEO,
-    sizeof(AVFrame),
-    raw_init_encoder,
-    raw_encode,
-    .long_name = NULL_IF_CONFIG_SMALL("raw video"),
-};
diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c
deleted file mode 100644
index f37263b..0000000
--- a/libavcodec/rdft.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * (I)RDFT transforms
- * Copyright (c) 2009 Alex Converse <alex dot converse at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <stdlib.h>
-#include <math.h>
-#include "libavutil/mathematics.h"
-#include "fft.h"
-
-/**
- * @file
- * (Inverse) Real Discrete Fourier Transforms.
- */
-
-/* sin(2*pi*x/n) for 0<=x<n/4, followed by n/2<=x<3n/4 */
-#if !CONFIG_HARDCODED_TABLES
-SINTABLE(16);
-SINTABLE(32);
-SINTABLE(64);
-SINTABLE(128);
-SINTABLE(256);
-SINTABLE(512);
-SINTABLE(1024);
-SINTABLE(2048);
-SINTABLE(4096);
-SINTABLE(8192);
-SINTABLE(16384);
-SINTABLE(32768);
-SINTABLE(65536);
-#endif
-SINTABLE_CONST FFTSample * const ff_sin_tabs[] = {
-    NULL, NULL, NULL, NULL,
-    ff_sin_16, ff_sin_32, ff_sin_64, ff_sin_128, ff_sin_256, ff_sin_512, ff_sin_1024,
-    ff_sin_2048, ff_sin_4096, ff_sin_8192, ff_sin_16384, ff_sin_32768, ff_sin_65536,
-};
-
-/** Map one real FFT into two parallel real even and odd FFTs. Then interleave
- * the two real FFTs into one complex FFT. Unmangle the results.
- * ref: http://www.engineeringproductivitytools.com/stuff/T0001/PT10.HTM
- */
-static void ff_rdft_calc_c(RDFTContext* s, FFTSample* data)
-{
-    int i, i1, i2;
-    FFTComplex ev, od;
-    const int n = 1 << s->nbits;
-    const float k1 = 0.5;
-    const float k2 = 0.5 - s->inverse;
-    const FFTSample *tcos = s->tcos;
-    const FFTSample *tsin = s->tsin;
-
-    if (!s->inverse) {
-        ff_fft_permute(&s->fft, (FFTComplex*)data);
-        ff_fft_calc(&s->fft, (FFTComplex*)data);
-    }
-    /* i=0 is a special case because of packing, the DC term is real, so we
-       are going to throw the N/2 term (also real) in with it. */
-    ev.re = data[0];
-    data[0] = ev.re+data[1];
-    data[1] = ev.re-data[1];
-    for (i = 1; i < (n>>2); i++) {
-        i1 = 2*i;
-        i2 = n-i1;
-        /* Separate even and odd FFTs */
-        ev.re =  k1*(data[i1  ]+data[i2  ]);
-        od.im = -k2*(data[i1  ]-data[i2  ]);
-        ev.im =  k1*(data[i1+1]-data[i2+1]);
-        od.re =  k2*(data[i1+1]+data[i2+1]);
-        /* Apply twiddle factors to the odd FFT and add to the even FFT */
-        data[i1  ] =  ev.re + od.re*tcos[i] - od.im*tsin[i];
-        data[i1+1] =  ev.im + od.im*tcos[i] + od.re*tsin[i];
-        data[i2  ] =  ev.re - od.re*tcos[i] + od.im*tsin[i];
-        data[i2+1] = -ev.im + od.im*tcos[i] + od.re*tsin[i];
-    }
-    data[2*i+1]=s->sign_convention*data[2*i+1];
-    if (s->inverse) {
-        data[0] *= k1;
-        data[1] *= k1;
-        ff_fft_permute(&s->fft, (FFTComplex*)data);
-        ff_fft_calc(&s->fft, (FFTComplex*)data);
-    }
-}
-
-av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans)
-{
-    int n = 1 << nbits;
-    int i;
-    const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 1)*2*M_PI/n;
-
-    s->nbits           = nbits;
-    s->inverse         = trans == IDFT_C2R || trans == DFT_C2R;
-    s->sign_convention = trans == IDFT_R2C || trans == DFT_C2R ? 1 : -1;
-
-    if (nbits < 4 || nbits > 16)
-        return -1;
-
-    if (ff_fft_init(&s->fft, nbits-1, trans == IDFT_C2R || trans == IDFT_R2C) < 0)
-        return -1;
-
-    ff_init_ff_cos_tabs(nbits);
-    s->tcos = ff_cos_tabs[nbits];
-    s->tsin = ff_sin_tabs[nbits]+(trans == DFT_R2C || trans == DFT_C2R)*(n>>2);
-#if !CONFIG_HARDCODED_TABLES
-    for (i = 0; i < (n>>2); i++) {
-        s->tsin[i] = sin(i*theta);
-    }
-#endif
-    s->rdft_calc   = ff_rdft_calc_c;
-
-    if (ARCH_ARM) ff_rdft_init_arm(s);
-
-    return 0;
-}
-
-av_cold void ff_rdft_end(RDFTContext *s)
-{
-    ff_fft_end(&s->fft);
-}
diff --git a/libavcodec/rectangle.h b/libavcodec/rectangle.h
deleted file mode 100644
index cf4a9cc..0000000
--- a/libavcodec/rectangle.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * rectangle filling function
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * useful rectangle filling function
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_RECTANGLE_H
-#define AVCODEC_RECTANGLE_H
-
-#include <assert.h>
-#include "config.h"
-#include "libavutil/common.h"
-#include "dsputil.h"
-
-/**
- * fill a rectangle.
- * @param h height of the rectangle, should be a constant
- * @param w width of the rectangle, should be a constant
- * @param size the size of val (1, 2 or 4), should be a constant
- */
-static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){
-    uint8_t *p= (uint8_t*)vp;
-    assert(size==1 || size==2 || size==4);
-    assert(w<=4);
-
-    w      *= size;
-    stride *= size;
-
-    assert((((long)vp)&(FFMIN(w, STRIDE_ALIGN)-1)) == 0);
-    assert((stride&(w-1))==0);
-    if(w==2){
-        const uint16_t v= size==4 ? val : val*0x0101;
-        *(uint16_t*)(p + 0*stride)= v;
-        if(h==1) return;
-        *(uint16_t*)(p + 1*stride)= v;
-        if(h==2) return;
-        *(uint16_t*)(p + 2*stride)= v;
-        *(uint16_t*)(p + 3*stride)= v;
-    }else if(w==4){
-        const uint32_t v= size==4 ? val : size==2 ? val*0x00010001 : val*0x01010101;
-        *(uint32_t*)(p + 0*stride)= v;
-        if(h==1) return;
-        *(uint32_t*)(p + 1*stride)= v;
-        if(h==2) return;
-        *(uint32_t*)(p + 2*stride)= v;
-        *(uint32_t*)(p + 3*stride)= v;
-    }else if(w==8){
-    //gcc can't optimize 64bit math on x86_32
-#if HAVE_FAST_64BIT
-        const uint64_t v=  size==2 ? val*0x0001000100010001ULL : val*0x0100000001ULL;
-        *(uint64_t*)(p + 0*stride)= v;
-        if(h==1) return;
-        *(uint64_t*)(p + 1*stride)= v;
-        if(h==2) return;
-        *(uint64_t*)(p + 2*stride)= v;
-        *(uint64_t*)(p + 3*stride)= v;
-    }else if(w==16){
-        const uint64_t v= val*0x0100000001ULL;
-        *(uint64_t*)(p + 0+0*stride)= v;
-        *(uint64_t*)(p + 8+0*stride)= v;
-        *(uint64_t*)(p + 0+1*stride)= v;
-        *(uint64_t*)(p + 8+1*stride)= v;
-        if(h==2) return;
-        *(uint64_t*)(p + 0+2*stride)= v;
-        *(uint64_t*)(p + 8+2*stride)= v;
-        *(uint64_t*)(p + 0+3*stride)= v;
-        *(uint64_t*)(p + 8+3*stride)= v;
-#else
-        const uint32_t v= size==2 ? val*0x00010001 : val;
-        *(uint32_t*)(p + 0+0*stride)= v;
-        *(uint32_t*)(p + 4+0*stride)= v;
-        if(h==1) return;
-        *(uint32_t*)(p + 0+1*stride)= v;
-        *(uint32_t*)(p + 4+1*stride)= v;
-        if(h==2) return;
-        *(uint32_t*)(p + 0+2*stride)= v;
-        *(uint32_t*)(p + 4+2*stride)= v;
-        *(uint32_t*)(p + 0+3*stride)= v;
-        *(uint32_t*)(p + 4+3*stride)= v;
-    }else if(w==16){
-        *(uint32_t*)(p + 0+0*stride)= val;
-        *(uint32_t*)(p + 4+0*stride)= val;
-        *(uint32_t*)(p + 8+0*stride)= val;
-        *(uint32_t*)(p +12+0*stride)= val;
-        *(uint32_t*)(p + 0+1*stride)= val;
-        *(uint32_t*)(p + 4+1*stride)= val;
-        *(uint32_t*)(p + 8+1*stride)= val;
-        *(uint32_t*)(p +12+1*stride)= val;
-        if(h==2) return;
-        *(uint32_t*)(p + 0+2*stride)= val;
-        *(uint32_t*)(p + 4+2*stride)= val;
-        *(uint32_t*)(p + 8+2*stride)= val;
-        *(uint32_t*)(p +12+2*stride)= val;
-        *(uint32_t*)(p + 0+3*stride)= val;
-        *(uint32_t*)(p + 4+3*stride)= val;
-        *(uint32_t*)(p + 8+3*stride)= val;
-        *(uint32_t*)(p +12+3*stride)= val;
-#endif
-    }else
-        assert(0);
-    assert(h==4);
-}
-
-#endif /* AVCODEC_RECTANGLE_H */
diff --git a/libavcodec/remove_extradata_bsf.c b/libavcodec/remove_extradata_bsf.c
deleted file mode 100644
index 95bd98b..0000000
--- a/libavcodec/remove_extradata_bsf.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-
-
-static int remove_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
-                     uint8_t **poutbuf, int *poutbuf_size,
-                     const uint8_t *buf, int buf_size, int keyframe){
-    int cmd= args ? *args : 0;
-    AVCodecParserContext *s;
-
-    if(!bsfc->parser){
-        bsfc->parser= av_parser_init(avctx->codec_id);
-    }
-    s= bsfc->parser;
-
-    if(s && s->parser->split){
-        if(  (((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) && cmd=='a')
-           ||(!keyframe && cmd=='k')
-           ||(cmd=='e' || !cmd)
-          ){
-            int i= s->parser->split(avctx, buf, buf_size);
-            buf += i;
-            buf_size -= i;
-        }
-    }
-    *poutbuf= (uint8_t *) buf;
-    *poutbuf_size= buf_size;
-
-    return 0;
-}
-
-AVBitStreamFilter remove_extradata_bsf={
-    "remove_extra",
-    0,
-    remove_extradata,
-};
diff --git a/libavcodec/resample.c b/libavcodec/resample.c
deleted file mode 100644
index b008180..0000000
--- a/libavcodec/resample.c
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * samplerate conversion for both audio and video
- * Copyright (c) 2000 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * samplerate conversion for both audio and video
- */
-
-#include "avcodec.h"
-#include "audioconvert.h"
-#include "opt.h"
-
-struct AVResampleContext;
-
-static const char *context_to_name(void *ptr)
-{
-    return "audioresample";
-}
-
-static const AVOption options[] = {{NULL}};
-static const AVClass audioresample_context_class = { "ReSampleContext", context_to_name, options, LIBAVUTIL_VERSION_INT };
-
-struct ReSampleContext {
-    struct AVResampleContext *resample_context;
-    short *temp[2];
-    int temp_len;
-    float ratio;
-    /* channel convert */
-    int input_channels, output_channels, filter_channels;
-    AVAudioConvert *convert_ctx[2];
-    enum SampleFormat sample_fmt[2]; ///< input and output sample format
-    unsigned sample_size[2];         ///< size of one sample in sample_fmt
-    short *buffer[2];                ///< buffers used for conversion to S16
-    unsigned buffer_size[2];         ///< sizes of allocated buffers
-};
-
-/* n1: number of samples */
-static void stereo_to_mono(short *output, short *input, int n1)
-{
-    short *p, *q;
-    int n = n1;
-
-    p = input;
-    q = output;
-    while (n >= 4) {
-        q[0] = (p[0] + p[1]) >> 1;
-        q[1] = (p[2] + p[3]) >> 1;
-        q[2] = (p[4] + p[5]) >> 1;
-        q[3] = (p[6] + p[7]) >> 1;
-        q += 4;
-        p += 8;
-        n -= 4;
-    }
-    while (n > 0) {
-        q[0] = (p[0] + p[1]) >> 1;
-        q++;
-        p += 2;
-        n--;
-    }
-}
-
-/* n1: number of samples */
-static void mono_to_stereo(short *output, short *input, int n1)
-{
-    short *p, *q;
-    int n = n1;
-    int v;
-
-    p = input;
-    q = output;
-    while (n >= 4) {
-        v = p[0]; q[0] = v; q[1] = v;
-        v = p[1]; q[2] = v; q[3] = v;
-        v = p[2]; q[4] = v; q[5] = v;
-        v = p[3]; q[6] = v; q[7] = v;
-        q += 8;
-        p += 4;
-        n -= 4;
-    }
-    while (n > 0) {
-        v = p[0]; q[0] = v; q[1] = v;
-        q += 2;
-        p += 1;
-        n--;
-    }
-}
-
-/* XXX: should use more abstract 'N' channels system */
-static void stereo_split(short *output1, short *output2, short *input, int n)
-{
-    int i;
-
-    for(i=0;i<n;i++) {
-        *output1++ = *input++;
-        *output2++ = *input++;
-    }
-}
-
-static void stereo_mux(short *output, short *input1, short *input2, int n)
-{
-    int i;
-
-    for(i=0;i<n;i++) {
-        *output++ = *input1++;
-        *output++ = *input2++;
-    }
-}
-
-static void ac3_5p1_mux(short *output, short *input1, short *input2, int n)
-{
-    int i;
-    short l,r;
-
-    for(i=0;i<n;i++) {
-      l=*input1++;
-      r=*input2++;
-      *output++ = l;           /* left */
-      *output++ = (l/2)+(r/2); /* center */
-      *output++ = r;           /* right */
-      *output++ = 0;           /* left surround */
-      *output++ = 0;           /* right surroud */
-      *output++ = 0;           /* low freq */
-    }
-}
-
-ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
-                                        int output_rate, int input_rate,
-                                        enum SampleFormat sample_fmt_out,
-                                        enum SampleFormat sample_fmt_in,
-                                        int filter_length, int log2_phase_count,
-                                        int linear, double cutoff)
-{
-    ReSampleContext *s;
-
-    if ( input_channels > 2)
-      {
-        av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.\n");
-        return NULL;
-      }
-
-    s = av_mallocz(sizeof(ReSampleContext));
-    if (!s)
-      {
-        av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.\n");
-        return NULL;
-      }
-
-    s->ratio = (float)output_rate / (float)input_rate;
-
-    s->input_channels = input_channels;
-    s->output_channels = output_channels;
-
-    s->filter_channels = s->input_channels;
-    if (s->output_channels < s->filter_channels)
-        s->filter_channels = s->output_channels;
-
-    s->sample_fmt [0] = sample_fmt_in;
-    s->sample_fmt [1] = sample_fmt_out;
-    s->sample_size[0] = av_get_bits_per_sample_format(s->sample_fmt[0])>>3;
-    s->sample_size[1] = av_get_bits_per_sample_format(s->sample_fmt[1])>>3;
-
-    if (s->sample_fmt[0] != SAMPLE_FMT_S16) {
-        if (!(s->convert_ctx[0] = av_audio_convert_alloc(SAMPLE_FMT_S16, 1,
-                                                         s->sample_fmt[0], 1, NULL, 0))) {
-            av_log(s, AV_LOG_ERROR,
-                   "Cannot convert %s sample format to s16 sample format\n",
-                   avcodec_get_sample_fmt_name(s->sample_fmt[0]));
-            av_free(s);
-            return NULL;
-        }
-    }
-
-    if (s->sample_fmt[1] != SAMPLE_FMT_S16) {
-        if (!(s->convert_ctx[1] = av_audio_convert_alloc(s->sample_fmt[1], 1,
-                                                         SAMPLE_FMT_S16, 1, NULL, 0))) {
-            av_log(s, AV_LOG_ERROR,
-                   "Cannot convert s16 sample format to %s sample format\n",
-                   avcodec_get_sample_fmt_name(s->sample_fmt[1]));
-            av_audio_convert_free(s->convert_ctx[0]);
-            av_free(s);
-            return NULL;
-        }
-    }
-
-/*
- * AC-3 output is the only case where filter_channels could be greater than 2.
- * input channels can't be greater than 2, so resample the 2 channels and then
- * expand to 6 channels after the resampling.
- */
-    if(s->filter_channels>2)
-      s->filter_channels = 2;
-
-#define TAPS 16
-    s->resample_context= av_resample_init(output_rate, input_rate,
-                         filter_length, log2_phase_count, linear, cutoff);
-
-    *(const AVClass**)s->resample_context = &audioresample_context_class;
-
-    return s;
-}
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-ReSampleContext *audio_resample_init(int output_channels, int input_channels,
-                                     int output_rate, int input_rate)
-{
-    return av_audio_resample_init(output_channels, input_channels,
-                                  output_rate, input_rate,
-                                  SAMPLE_FMT_S16, SAMPLE_FMT_S16,
-                                  TAPS, 10, 0, 0.8);
-}
-#endif
-
-/* resample audio. 'nb_samples' is the number of input samples */
-/* XXX: optimize it ! */
-int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples)
-{
-    int i, nb_samples1;
-    short *bufin[2];
-    short *bufout[2];
-    short *buftmp2[2], *buftmp3[2];
-    short *output_bak = NULL;
-    int lenout;
-
-    if (s->input_channels == s->output_channels && s->ratio == 1.0 && 0) {
-        /* nothing to do */
-        memcpy(output, input, nb_samples * s->input_channels * sizeof(short));
-        return nb_samples;
-    }
-
-    if (s->sample_fmt[0] != SAMPLE_FMT_S16) {
-        int istride[1] = { s->sample_size[0] };
-        int ostride[1] = { 2 };
-        const void *ibuf[1] = { input };
-        void       *obuf[1];
-        unsigned input_size = nb_samples*s->input_channels*2;
-
-        if (!s->buffer_size[0] || s->buffer_size[0] < input_size) {
-            av_free(s->buffer[0]);
-            s->buffer_size[0] = input_size;
-            s->buffer[0] = av_malloc(s->buffer_size[0]);
-            if (!s->buffer[0]) {
-                av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n");
-                return 0;
-            }
-        }
-
-        obuf[0] = s->buffer[0];
-
-        if (av_audio_convert(s->convert_ctx[0], obuf, ostride,
-                             ibuf, istride, nb_samples*s->input_channels) < 0) {
-            av_log(s->resample_context, AV_LOG_ERROR, "Audio sample format conversion failed\n");
-            return 0;
-        }
-
-        input  = s->buffer[0];
-    }
-
-    lenout= 4*nb_samples * s->ratio + 16;
-
-    if (s->sample_fmt[1] != SAMPLE_FMT_S16) {
-        output_bak = output;
-
-        if (!s->buffer_size[1] || s->buffer_size[1] < lenout) {
-            av_free(s->buffer[1]);
-            s->buffer_size[1] = lenout;
-            s->buffer[1] = av_malloc(s->buffer_size[1]);
-            if (!s->buffer[1]) {
-                av_log(s->resample_context, AV_LOG_ERROR, "Could not allocate buffer\n");
-                return 0;
-            }
-        }
-
-        output = s->buffer[1];
-    }
-
-    /* XXX: move those malloc to resample init code */
-    for(i=0; i<s->filter_channels; i++){
-        bufin[i]= av_malloc( (nb_samples + s->temp_len) * sizeof(short) );
-        memcpy(bufin[i], s->temp[i], s->temp_len * sizeof(short));
-        buftmp2[i] = bufin[i] + s->temp_len;
-    }
-
-    /* make some zoom to avoid round pb */
-    bufout[0]= av_malloc( lenout * sizeof(short) );
-    bufout[1]= av_malloc( lenout * sizeof(short) );
-
-    if (s->input_channels == 2 &&
-        s->output_channels == 1) {
-        buftmp3[0] = output;
-        stereo_to_mono(buftmp2[0], input, nb_samples);
-    } else if (s->output_channels >= 2 && s->input_channels == 1) {
-        buftmp3[0] = bufout[0];
-        memcpy(buftmp2[0], input, nb_samples*sizeof(short));
-    } else if (s->output_channels >= 2) {
-        buftmp3[0] = bufout[0];
-        buftmp3[1] = bufout[1];
-        stereo_split(buftmp2[0], buftmp2[1], input, nb_samples);
-    } else {
-        buftmp3[0] = output;
-        memcpy(buftmp2[0], input, nb_samples*sizeof(short));
-    }
-
-    nb_samples += s->temp_len;
-
-    /* resample each channel */
-    nb_samples1 = 0; /* avoid warning */
-    for(i=0;i<s->filter_channels;i++) {
-        int consumed;
-        int is_last= i+1 == s->filter_channels;
-
-        nb_samples1 = av_resample(s->resample_context, buftmp3[i], bufin[i], &consumed, nb_samples, lenout, is_last);
-        s->temp_len= nb_samples - consumed;
-        s->temp[i]= av_realloc(s->temp[i], s->temp_len*sizeof(short));
-        memcpy(s->temp[i], bufin[i] + consumed, s->temp_len*sizeof(short));
-    }
-
-    if (s->output_channels == 2 && s->input_channels == 1) {
-        mono_to_stereo(output, buftmp3[0], nb_samples1);
-    } else if (s->output_channels == 2) {
-        stereo_mux(output, buftmp3[0], buftmp3[1], nb_samples1);
-    } else if (s->output_channels == 6) {
-        ac3_5p1_mux(output, buftmp3[0], buftmp3[1], nb_samples1);
-    }
-
-    if (s->sample_fmt[1] != SAMPLE_FMT_S16) {
-        int istride[1] = { 2 };
-        int ostride[1] = { s->sample_size[1] };
-        const void *ibuf[1] = { output };
-        void       *obuf[1] = { output_bak };
-
-        if (av_audio_convert(s->convert_ctx[1], obuf, ostride,
-                             ibuf, istride, nb_samples1*s->output_channels) < 0) {
-            av_log(s->resample_context, AV_LOG_ERROR, "Audio sample format convertion failed\n");
-            return 0;
-        }
-    }
-
-    for(i=0; i<s->filter_channels; i++)
-        av_free(bufin[i]);
-
-    av_free(bufout[0]);
-    av_free(bufout[1]);
-    return nb_samples1;
-}
-
-void audio_resample_close(ReSampleContext *s)
-{
-    av_resample_close(s->resample_context);
-    av_freep(&s->temp[0]);
-    av_freep(&s->temp[1]);
-    av_freep(&s->buffer[0]);
-    av_freep(&s->buffer[1]);
-    av_audio_convert_free(s->convert_ctx[0]);
-    av_audio_convert_free(s->convert_ctx[1]);
-    av_free(s);
-}
diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c
deleted file mode 100644
index 45f41a1..0000000
--- a/libavcodec/resample2.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * audio resampling
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * audio resampling
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-#ifndef CONFIG_RESAMPLE_HP
-#define FILTER_SHIFT 15
-
-#define FELEM int16_t
-#define FELEM2 int32_t
-#define FELEML int64_t
-#define FELEM_MAX INT16_MAX
-#define FELEM_MIN INT16_MIN
-#define WINDOW_TYPE 9
-#elif !defined(CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE)
-#define FILTER_SHIFT 30
-
-#define FELEM int32_t
-#define FELEM2 int64_t
-#define FELEML int64_t
-#define FELEM_MAX INT32_MAX
-#define FELEM_MIN INT32_MIN
-#define WINDOW_TYPE 12
-#else
-#define FILTER_SHIFT 0
-
-#define FELEM double
-#define FELEM2 double
-#define FELEML double
-#define WINDOW_TYPE 24
-#endif
-
-
-typedef struct AVResampleContext{
-    const AVClass *av_class;
-    FELEM *filter_bank;
-    int filter_length;
-    int ideal_dst_incr;
-    int dst_incr;
-    int index;
-    int frac;
-    int src_incr;
-    int compensation_distance;
-    int phase_shift;
-    int phase_mask;
-    int linear;
-}AVResampleContext;
-
-/**
- * 0th order modified bessel function of the first kind.
- */
-static double bessel(double x){
-    double v=1;
-    double lastv=0;
-    double t=1;
-    int i;
-
-    x= x*x/4;
-    for(i=1; v != lastv; i++){
-        lastv=v;
-        t *= x/(i*i);
-        v += t;
-    }
-    return v;
-}
-
-/**
- * builds a polyphase filterbank.
- * @param factor resampling factor
- * @param scale wanted sum of coefficients for each filter
- * @param type 0->cubic, 1->blackman nuttall windowed sinc, 2..16->kaiser windowed sinc beta=2..16
- */
-static void build_filter(FELEM *filter, double factor, int tap_count, int phase_count, int scale, int type){
-    int ph, i;
-    double x, y, w, tab[tap_count];
-    const int center= (tap_count-1)/2;
-
-    /* if upsampling, only need to interpolate, no filter */
-    if (factor > 1.0)
-        factor = 1.0;
-
-    for(ph=0;ph<phase_count;ph++) {
-        double norm = 0;
-        for(i=0;i<tap_count;i++) {
-            x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor;
-            if (x == 0) y = 1.0;
-            else        y = sin(x) / x;
-            switch(type){
-            case 0:{
-                const float d= -0.5; //first order derivative = -0.5
-                x = fabs(((double)(i - center) - (double)ph / phase_count) * factor);
-                if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*(            -x*x + x*x*x);
-                else      y=                       d*(-4 + 8*x - 5*x*x + x*x*x);
-                break;}
-            case 1:
-                w = 2.0*x / (factor*tap_count) + M_PI;
-                y *= 0.3635819 - 0.4891775 * cos(w) + 0.1365995 * cos(2*w) - 0.0106411 * cos(3*w);
-                break;
-            default:
-                w = 2.0*x / (factor*tap_count*M_PI);
-                y *= bessel(type*sqrt(FFMAX(1-w*w, 0)));
-                break;
-            }
-
-            tab[i] = y;
-            norm += y;
-        }
-
-        /* normalize so that an uniform color remains the same */
-        for(i=0;i<tap_count;i++) {
-#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE
-            filter[ph * tap_count + i] = tab[i] / norm;
-#else
-            filter[ph * tap_count + i] = av_clip(lrintf(tab[i] * scale / norm), FELEM_MIN, FELEM_MAX);
-#endif
-        }
-    }
-#if 0
-    {
-#define LEN 1024
-        int j,k;
-        double sine[LEN + tap_count];
-        double filtered[LEN];
-        double maxff=-2, minff=2, maxsf=-2, minsf=2;
-        for(i=0; i<LEN; i++){
-            double ss=0, sf=0, ff=0;
-            for(j=0; j<LEN+tap_count; j++)
-                sine[j]= cos(i*j*M_PI/LEN);
-            for(j=0; j<LEN; j++){
-                double sum=0;
-                ph=0;
-                for(k=0; k<tap_count; k++)
-                    sum += filter[ph * tap_count + k] * sine[k+j];
-                filtered[j]= sum / (1<<FILTER_SHIFT);
-                ss+= sine[j + center] * sine[j + center];
-                ff+= filtered[j] * filtered[j];
-                sf+= sine[j + center] * filtered[j];
-            }
-            ss= sqrt(2*ss/LEN);
-            ff= sqrt(2*ff/LEN);
-            sf= 2*sf/LEN;
-            maxff= FFMAX(maxff, ff);
-            minff= FFMIN(minff, ff);
-            maxsf= FFMAX(maxsf, sf);
-            minsf= FFMIN(minsf, sf);
-            if(i%11==0){
-                av_log(NULL, AV_LOG_ERROR, "i:%4d ss:%f ff:%13.6e-%13.6e sf:%13.6e-%13.6e\n", i, ss, maxff, minff, maxsf, minsf);
-                minff=minsf= 2;
-                maxff=maxsf= -2;
-            }
-        }
-    }
-#endif
-}
-
-AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){
-    AVResampleContext *c= av_mallocz(sizeof(AVResampleContext));
-    double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
-    int phase_count= 1<<phase_shift;
-
-    c->phase_shift= phase_shift;
-    c->phase_mask= phase_count-1;
-    c->linear= linear;
-
-    c->filter_length= FFMAX((int)ceil(filter_size/factor), 1);
-    c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM));
-    build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTER_SHIFT, WINDOW_TYPE);
-    memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM));
-    c->filter_bank[c->filter_length*phase_count]= c->filter_bank[c->filter_length - 1];
-
-    c->src_incr= out_rate;
-    c->ideal_dst_incr= c->dst_incr= in_rate * phase_count;
-    c->index= -phase_count*((c->filter_length-1)/2);
-
-    return c;
-}
-
-void av_resample_close(AVResampleContext *c){
-    av_freep(&c->filter_bank);
-    av_freep(&c);
-}
-
-void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){
-//    sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr;
-    c->compensation_distance= compensation_distance;
-    c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance;
-}
-
-int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx){
-    int dst_index, i;
-    int index= c->index;
-    int frac= c->frac;
-    int dst_incr_frac= c->dst_incr % c->src_incr;
-    int dst_incr=      c->dst_incr / c->src_incr;
-    int compensation_distance= c->compensation_distance;
-
-  if(compensation_distance == 0 && c->filter_length == 1 && c->phase_shift==0){
-        int64_t index2= ((int64_t)index)<<32;
-        int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr;
-        dst_size= FFMIN(dst_size, (src_size-1-index) * (int64_t)c->src_incr / c->dst_incr);
-
-        for(dst_index=0; dst_index < dst_size; dst_index++){
-            dst[dst_index] = src[index2>>32];
-            index2 += incr;
-        }
-        frac += dst_index * dst_incr_frac;
-        index += dst_index * dst_incr;
-        index += frac / c->src_incr;
-        frac %= c->src_incr;
-  }else{
-    for(dst_index=0; dst_index < dst_size; dst_index++){
-        FELEM *filter= c->filter_bank + c->filter_length*(index & c->phase_mask);
-        int sample_index= index >> c->phase_shift;
-        FELEM2 val=0;
-
-        if(sample_index < 0){
-            for(i=0; i<c->filter_length; i++)
-                val += src[FFABS(sample_index + i) % src_size] * filter[i];
-        }else if(sample_index + c->filter_length > src_size){
-            break;
-        }else if(c->linear){
-            FELEM2 v2=0;
-            for(i=0; i<c->filter_length; i++){
-                val += src[sample_index + i] * (FELEM2)filter[i];
-                v2  += src[sample_index + i] * (FELEM2)filter[i + c->filter_length];
-            }
-            val+=(v2-val)*(FELEML)frac / c->src_incr;
-        }else{
-            for(i=0; i<c->filter_length; i++){
-                val += src[sample_index + i] * (FELEM2)filter[i];
-            }
-        }
-
-#ifdef CONFIG_RESAMPLE_AUDIOPHILE_KIDDY_MODE
-        dst[dst_index] = av_clip_int16(lrintf(val));
-#else
-        val = (val + (1<<(FILTER_SHIFT-1)))>>FILTER_SHIFT;
-        dst[dst_index] = (unsigned)(val + 32768) > 65535 ? (val>>31) ^ 32767 : val;
-#endif
-
-        frac += dst_incr_frac;
-        index += dst_incr;
-        if(frac >= c->src_incr){
-            frac -= c->src_incr;
-            index++;
-        }
-
-        if(dst_index + 1 == compensation_distance){
-            compensation_distance= 0;
-            dst_incr_frac= c->ideal_dst_incr % c->src_incr;
-            dst_incr=      c->ideal_dst_incr / c->src_incr;
-        }
-    }
-  }
-    *consumed= FFMAX(index, 0) >> c->phase_shift;
-    if(index>=0) index &= c->phase_mask;
-
-    if(compensation_distance){
-        compensation_distance -= dst_index;
-        assert(compensation_distance > 0);
-    }
-    if(update_ctx){
-        c->frac= frac;
-        c->index= index;
-        c->dst_incr= dst_incr_frac + c->src_incr*dst_incr;
-        c->compensation_distance= compensation_distance;
-    }
-#if 0
-    if(update_ctx && !c->compensation_distance){
-#undef rand
-        av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2);
-av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->compensation_distance);
-    }
-#endif
-
-    return dst_index;
-}
diff --git a/libavcodec/rl.h b/libavcodec/rl.h
deleted file mode 100644
index b244589..0000000
--- a/libavcodec/rl.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2000-2002 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * rl header.
- */
-
-#ifndef AVCODEC_RL_H
-#define AVCODEC_RL_H
-
-#include <stdint.h>
-#include "get_bits.h"
-
-/* run length table */
-#define MAX_RUN    64
-#define MAX_LEVEL  64
-
-/** RLTable. */
-typedef struct RLTable {
-    int n;                         ///< number of entries of table_vlc minus 1
-    int last;                      ///< number of values for last = 0
-    const uint16_t (*table_vlc)[2];
-    const int8_t *table_run;
-    const int8_t *table_level;
-    uint8_t *index_run[2];         ///< encoding only
-    int8_t *max_level[2];          ///< encoding & decoding
-    int8_t *max_run[2];            ///< encoding & decoding
-    VLC vlc;                       ///< decoding only deprecated FIXME remove
-    RL_VLC_ELEM *rl_vlc[32];       ///< decoding only
-} RLTable;
-
-/**
- *
- * @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold
- *                     the level and run tables, if this is NULL av_malloc() will be used
- */
-void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]);
-void init_vlc_rl(RLTable *rl);
-
-#define INIT_VLC_RL(rl, static_size)\
-{\
-    int q;\
-    static RL_VLC_ELEM rl_vlc_table[32][static_size];\
-    INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\
-             &rl.table_vlc[0][1], 4, 2,\
-             &rl.table_vlc[0][0], 4, 2, static_size);\
-\
-    if(!rl.rl_vlc[0]){\
-        for(q=0; q<32; q++)\
-            rl.rl_vlc[q]= rl_vlc_table[q];\
-\
-        init_vlc_rl(&rl);\
-    }\
-}
-
-static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
-{
-    int index;
-    index = rl->index_run[last][run];
-    if (index >= rl->n)
-        return rl->n;
-    if (level > rl->max_level[last][run])
-        return rl->n;
-    return index + level - 1;
-}
-
-#endif /* AVCODEC_RL_H */
diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c
deleted file mode 100644
index 30f5e83..0000000
--- a/libavcodec/rl2.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * RL2 Video Decoder
- * Copyright (C) 2008 Sascha Sommer (saschasommer at freenet.de)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * RL2 Video Decoder
- * @file
- * @author Sascha Sommer (saschasommer at freenet.de)
- * For more information about the RL2 format, visit:
- *   http://wiki.multimedia.cx/index.php?title=RL2
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-
-#define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr count, palette
-
-typedef struct Rl2Context {
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    unsigned short video_base; ///< initial drawing offset
-    unsigned int clr_count;    ///< number of used colors (currently unused)
-    unsigned char* back_frame; ///< background frame
-    unsigned int palette[AVPALETTE_COUNT];
-} Rl2Context;
-
-/**
- * Run Length Decode a single 320x200 frame
- * @param s rl2 context
- * @param buf input buffer
- * @param size input buffer size
- * @param out ouput buffer
- * @param stride stride of the output buffer
- * @param video_base offset of the rle data inside the frame
- */
-static void rl2_rle_decode(Rl2Context *s,const unsigned char* in,int size,
-                               unsigned char* out,int stride,int video_base){
-    int base_x = video_base % s->avctx->width;
-    int base_y = video_base / s->avctx->width;
-    int stride_adj = stride - s->avctx->width;
-    int i;
-    const unsigned char* back_frame = s->back_frame;
-    const unsigned char* in_end = in + size;
-    const unsigned char* out_end = out + stride * s->avctx->height;
-    unsigned char* line_end = out + s->avctx->width;
-
-    /** copy start of the background frame */
-    for(i=0;i<=base_y;i++){
-        if(s->back_frame)
-            memcpy(out,back_frame,s->avctx->width);
-        out += stride;
-        back_frame += s->avctx->width;
-    }
-    back_frame += base_x - s->avctx->width;
-    line_end = out - stride_adj;
-    out += base_x - stride;
-
-    /** decode the variable part of the frame */
-    while(in < in_end){
-        unsigned char val = *in++;
-        int len = 1;
-        if(val >= 0x80){
-            if(in >= in_end)
-                break;
-            len = *in++;
-            if(!len)
-                break;
-        }
-
-        if(len >= out_end - out)
-            break;
-
-        if(s->back_frame)
-            val |= 0x80;
-        else
-            val &= ~0x80;
-
-        while(len--){
-            *out++ = (val == 0x80)? *back_frame:val;
-            back_frame++;
-            if(out == line_end){
-                 out += stride_adj;
-                 line_end += stride;
-                 if(len >= out_end - out)
-                     break;
-            }
-        }
-    }
-
-    /** copy the rest from the background frame */
-    if(s->back_frame){
-        while(out < out_end){
-            memcpy(out, back_frame, line_end - out);
-            back_frame += line_end - out;
-            out = line_end + stride_adj;
-            line_end += stride;
-        }
-    }
-}
-
-
-/**
- * Initialize the decoder
- * @param avctx decoder context
- * @return 0 success, -1 on error
- */
-static av_cold int rl2_decode_init(AVCodecContext *avctx)
-{
-    Rl2Context *s = avctx->priv_data;
-    int back_size;
-    int i;
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    /** parse extra data */
-    if(!avctx->extradata || avctx->extradata_size < EXTRADATA1_SIZE){
-        av_log(avctx, AV_LOG_ERROR, "invalid extradata size\n");
-        return -1;
-    }
-
-    /** get frame_offset */
-    s->video_base = AV_RL16(&avctx->extradata[0]);
-    s->clr_count = AV_RL32(&avctx->extradata[2]);
-
-    if(s->video_base >= avctx->width * avctx->height){
-        av_log(avctx, AV_LOG_ERROR, "invalid video_base\n");
-        return -1;
-    }
-
-    /** initialize palette */
-    for(i=0;i<AVPALETTE_COUNT;i++)
-        s->palette[i] = AV_RB24(&avctx->extradata[6 + i * 3]);
-
-    /** decode background frame if present */
-    back_size = avctx->extradata_size - EXTRADATA1_SIZE;
-
-    if(back_size > 0){
-        unsigned char* back_frame = av_mallocz(avctx->width*avctx->height);
-        if(!back_frame)
-            return -1;
-        rl2_rle_decode(s,avctx->extradata + EXTRADATA1_SIZE,back_size,
-                           back_frame,avctx->width,0);
-        s->back_frame = back_frame;
-    }
-    return 0;
-}
-
-
-/**
- * Decode a single frame
- * @param avctx decoder context
- * @param data decoded frame
- * @param data_size size of the decoded frame
- * @param buf input buffer
- * @param buf_size input buffer size
- * @return 0 success, -1 on error
- */
-static int rl2_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    Rl2Context *s = avctx->priv_data;
-
-    if(s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    /** get buffer */
-    s->frame.reference= 0;
-    if(avctx->get_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    /** run length decode */
-    rl2_rle_decode(s,buf,buf_size,s->frame.data[0],s->frame.linesize[0],s->video_base);
-
-    /** make the palette available on the way out */
-    memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /** report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-/**
- * Uninit decoder
- * @param avctx decoder context
- * @return 0 success, -1 on error
- */
-static av_cold int rl2_decode_end(AVCodecContext *avctx)
-{
-    Rl2Context *s = avctx->priv_data;
-
-    if(s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    av_free(s->back_frame);
-
-    return 0;
-}
-
-
-AVCodec rl2_decoder = {
-    "rl2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RL2,
-    sizeof(Rl2Context),
-    rl2_decode_init,
-    NULL,
-    rl2_decode_end,
-    rl2_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("RL2 video"),
-};
-
diff --git a/libavcodec/rle.c b/libavcodec/rle.c
deleted file mode 100644
index 6e468f8..0000000
--- a/libavcodec/rle.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * RLE encoder
- * Copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "rle.h"
-
-/**
- * Count up to 127 consecutive pixels which are either all the same or
- * all differ from the previous and next pixels.
- * @param start Pointer to the first pixel
- * @param len Maximum number of pixels
- * @param bpp Bytes per pixel
- * @param same 1 if searching for identical pixel values.  0 for differing
- * @return Number of matching consecutive pixels found
- */
-static int count_pixels(const uint8_t *start, int len, int bpp, int same)
-{
-    const uint8_t *pos;
-    int count = 1;
-
-    for(pos = start + bpp; count < FFMIN(127, len); pos += bpp, count ++) {
-        if(same != !memcmp(pos-bpp, pos, bpp)) {
-            if(!same) {
-                /* if bpp == 1, then 0 1 1 0 is more efficiently encoded as a single
-                 * raw block of pixels.  for larger bpp, RLE is as good or better */
-                if(bpp == 1 && count + 1 < FFMIN(127, len) && *pos != *(pos+1))
-                    continue;
-
-                /* if RLE can encode the next block better than as a raw block,
-                 * back up and leave _all_ the identical pixels for RLE */
-                count --;
-            }
-            break;
-        }
-    }
-
-    return count;
-}
-
-int ff_rle_encode(uint8_t *outbuf, int out_size, const uint8_t *ptr , int bpp, int w,
-                  int add_rep, int xor_rep, int add_raw, int xor_raw)
-{
-    int count, x;
-    uint8_t *out = outbuf;
-
-    for(x = 0; x < w; x += count) {
-        /* see if we can encode the next set of pixels with RLE */
-        if((count = count_pixels(ptr, w-x, bpp, 1)) > 1) {
-            if(out + bpp + 1 > outbuf + out_size) return -1;
-            *out++ = (count ^ xor_rep) + add_rep;
-            memcpy(out, ptr, bpp);
-            out += bpp;
-        } else {
-            /* fall back on uncompressed */
-            count = count_pixels(ptr, w-x, bpp, 0);
-            if(out + bpp*count >= outbuf + out_size) return -1;
-            *out++ = (count ^ xor_raw) + add_raw;
-
-            memcpy(out, ptr, bpp * count);
-            out += bpp * count;
-        }
-
-        ptr += count * bpp;
-    }
-
-    return out - outbuf;
-}
diff --git a/libavcodec/rle.h b/libavcodec/rle.h
deleted file mode 100644
index f892443..0000000
--- a/libavcodec/rle.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * RLE encoder
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_RLE_H
-#define AVCODEC_RLE_H
-
-#include <stdint.h>
-
-/**
- * RLE compress the row, with maximum size of out_size. Value before repeated bytes is (count ^ xor_rep) + add_rep.
- *                                                      Value before raw bytes is      (count ^ xor_raw) + add_raw.
- * @param outbuf Output buffer
- * @param out_size Maximum output size
- * @param ptr Input buffer
- * @param bpp Bytes per pixel
- * @param w Image width
- * @return Size of output in bytes, or -1 if larger than out_size
- */
-int ff_rle_encode(uint8_t *outbuf, int out_size, const uint8_t *inbuf, int bpp, int w,
-                  int add_rep, int xor_rep, int add_raw, int xor_raw);
-
-#endif /* AVCODEC_RLE_H */
diff --git a/libavcodec/roqaudioenc.c b/libavcodec/roqaudioenc.c
deleted file mode 100644
index 11fd6f0..0000000
--- a/libavcodec/roqaudioenc.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * RoQ audio encoder
- *
- * Copyright (c) 2005 Eric Lasota
- *    Based on RoQ specs (c)2001 Tim Ferguson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intmath.h"
-#include "avcodec.h"
-#include "bytestream.h"
-
-#define ROQ_FIRST_FRAME_SIZE     (735*8)
-#define ROQ_FRAME_SIZE           735
-
-
-#define MAX_DPCM (127*127)
-
-
-typedef struct
-{
-    short lastSample[2];
-} ROQDPCMContext;
-
-static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
-{
-    ROQDPCMContext *context = avctx->priv_data;
-
-    if (avctx->channels > 2) {
-        av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
-        return -1;
-    }
-    if (avctx->sample_rate != 22050) {
-        av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
-        return -1;
-    }
-    if (avctx->sample_fmt != SAMPLE_FMT_S16) {
-        av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n");
-        return -1;
-    }
-
-    avctx->frame_size = ROQ_FIRST_FRAME_SIZE;
-
-    context->lastSample[0] = context->lastSample[1] = 0;
-
-    avctx->coded_frame= avcodec_alloc_frame();
-    avctx->coded_frame->key_frame= 1;
-
-    return 0;
-}
-
-static unsigned char dpcm_predict(short *previous, short current)
-{
-    int diff;
-    int negative;
-    int result;
-    int predicted;
-
-    diff = current - *previous;
-
-    negative = diff<0;
-    diff = FFABS(diff);
-
-    if (diff >= MAX_DPCM)
-        result = 127;
-    else {
-        result = ff_sqrt(diff);
-        result += diff > result*result+result;
-    }
-
-    /* See if this overflows */
- retry:
-    diff = result*result;
-    if (negative)
-        diff = -diff;
-    predicted = *previous + diff;
-
-    /* If it overflows, back off a step */
-    if (predicted > 32767 || predicted < -32768) {
-        result--;
-        goto retry;
-    }
-
-    /* Add the sign bit */
-    result |= negative << 7;   //if (negative) result |= 128;
-
-    *previous = predicted;
-
-    return result;
-}
-
-static int roq_dpcm_encode_frame(AVCodecContext *avctx,
-                unsigned char *frame, int buf_size, void *data)
-{
-    int i, samples, stereo, ch;
-    short *in;
-    unsigned char *out;
-
-    ROQDPCMContext *context = avctx->priv_data;
-
-    stereo = (avctx->channels == 2);
-
-    if (stereo) {
-        context->lastSample[0] &= 0xFF00;
-        context->lastSample[1] &= 0xFF00;
-    }
-
-    out = frame;
-    in = data;
-
-    bytestream_put_byte(&out, stereo ? 0x21 : 0x20);
-    bytestream_put_byte(&out, 0x10);
-    bytestream_put_le32(&out, avctx->frame_size*avctx->channels);
-
-    if (stereo) {
-        bytestream_put_byte(&out, (context->lastSample[1])>>8);
-        bytestream_put_byte(&out, (context->lastSample[0])>>8);
-    } else
-        bytestream_put_le16(&out, context->lastSample[0]);
-
-    /* Write the actual samples */
-    samples = avctx->frame_size;
-    for (i=0; i<samples; i++)
-        for (ch=0; ch<avctx->channels; ch++)
-            *out++ = dpcm_predict(&context->lastSample[ch], *in++);
-
-    /* Use smaller frames from now on */
-    avctx->frame_size = ROQ_FRAME_SIZE;
-
-    /* Return the result size */
-    return out - frame;
-}
-
-static av_cold int roq_dpcm_encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-AVCodec roq_dpcm_encoder = {
-    "roq_dpcm",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_ROQ_DPCM,
-    sizeof(ROQDPCMContext),
-    roq_dpcm_encode_init,
-    roq_dpcm_encode_frame,
-    roq_dpcm_encode_close,
-    NULL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
-};
diff --git a/libavcodec/roqvideo.c b/libavcodec/roqvideo.c
deleted file mode 100644
index 830eb7b..0000000
--- a/libavcodec/roqvideo.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2003 Mike Melanson
- * Copyright (C) 2003 Dr. Tim Ferguson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * id RoQ Video common functions based on work by Dr. Tim Ferguson
- */
-
-#include "avcodec.h"
-#include "roqvideo.h"
-
-static inline void block_copy(unsigned char *out, unsigned char *in,
-                              int outstride, int instride, int sz)
-{
-    int rows = sz;
-    while(rows--) {
-        memcpy(out, in, sz);
-        out += outstride;
-        in += instride;
-    }
-}
-
-void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell)
-{
-    unsigned char *bptr;
-    int boffs,stride;
-
-    stride = ri->current_frame->linesize[0];
-    boffs = y*stride + x;
-
-    bptr = ri->current_frame->data[0] + boffs;
-    bptr[0       ] = cell->y[0];
-    bptr[1       ] = cell->y[1];
-    bptr[stride  ] = cell->y[2];
-    bptr[stride+1] = cell->y[3];
-
-    stride = ri->current_frame->linesize[1];
-    boffs = y*stride + x;
-
-    bptr = ri->current_frame->data[1] + boffs;
-    bptr[0       ] =
-    bptr[1       ] =
-    bptr[stride  ] =
-    bptr[stride+1] = cell->u;
-
-    bptr = ri->current_frame->data[2] + boffs;
-    bptr[0       ] =
-    bptr[1       ] =
-    bptr[stride  ] =
-    bptr[stride+1] = cell->v;
-}
-
-void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell)
-{
-    unsigned char *bptr;
-    int boffs,stride;
-
-    stride = ri->current_frame->linesize[0];
-    boffs = y*stride + x;
-
-    bptr = ri->current_frame->data[0] + boffs;
-    bptr[         0] = bptr[         1] = bptr[stride    ] = bptr[stride  +1] = cell->y[0];
-    bptr[         2] = bptr[         3] = bptr[stride  +2] = bptr[stride  +3] = cell->y[1];
-    bptr[stride*2  ] = bptr[stride*2+1] = bptr[stride*3  ] = bptr[stride*3+1] = cell->y[2];
-    bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->y[3];
-
-    stride = ri->current_frame->linesize[1];
-    boffs = y*stride + x;
-
-    bptr = ri->current_frame->data[1] + boffs;
-    bptr[         0] = bptr[         1] = bptr[stride    ] = bptr[stride  +1] =
-    bptr[         2] = bptr[         3] = bptr[stride  +2] = bptr[stride  +3] =
-    bptr[stride*2  ] = bptr[stride*2+1] = bptr[stride*3  ] = bptr[stride*3+1] =
-    bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->u;
-
-    bptr = ri->current_frame->data[2] + boffs;
-    bptr[         0] = bptr[         1] = bptr[stride    ] = bptr[stride  +1] =
-    bptr[         2] = bptr[         3] = bptr[stride  +2] = bptr[stride  +3] =
-    bptr[stride*2  ] = bptr[stride*2+1] = bptr[stride*3  ] = bptr[stride*3+1] =
-    bptr[stride*2+2] = bptr[stride*2+3] = bptr[stride*3+2] = bptr[stride*3+3] = cell->v;
-}
-
-
-static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax,
-                                        int deltay, int sz)
-{
-    int mx, my, cp;
-
-    mx = x + deltax;
-    my = y + deltay;
-
-    /* check MV against frame boundaries */
-    if ((mx < 0) || (mx > ri->width - sz) ||
-        (my < 0) || (my > ri->height - sz)) {
-        av_log(ri->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",
-            mx, my, ri->width, ri->height);
-        return;
-    }
-
-    for(cp = 0; cp < 3; cp++) {
-        int outstride = ri->current_frame->linesize[cp];
-        int instride  = ri->last_frame   ->linesize[cp];
-        block_copy(ri->current_frame->data[cp] + y*outstride + x,
-                   ri->last_frame->data[cp] + my*instride + mx,
-                   outstride, instride, sz);
-    }
-}
-
-
-void ff_apply_motion_4x4(RoqContext *ri, int x, int y,
-                             int deltax, int deltay)
-{
-    apply_motion_generic(ri, x, y, deltax, deltay, 4);
-}
-
-void ff_apply_motion_8x8(RoqContext *ri, int x, int y,
-                             int deltax, int deltay)
-{
-    apply_motion_generic(ri, x, y, deltax, deltay, 8);
-}
diff --git a/libavcodec/roqvideo.h b/libavcodec/roqvideo.h
deleted file mode 100644
index 3fe11c6..0000000
--- a/libavcodec/roqvideo.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2003 Mike Melanson
- * Copyright (C) 2003 Dr. Tim Ferguson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ROQVIDEO_H
-#define AVCODEC_ROQVIDEO_H
-
-#include "libavutil/lfg.h"
-#include "avcodec.h"
-#include "dsputil.h"
-
-typedef struct {
-    unsigned char y[4];
-    unsigned char u, v;
-} roq_cell;
-
-typedef struct {
-    int idx[4];
-} roq_qcell;
-
-typedef struct {
-    int d[2];
-} motion_vect;
-
-struct RoqTempData;
-
-typedef struct RoqContext {
-
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame frames[2];
-    AVFrame *last_frame;
-    AVFrame *current_frame;
-    int first_frame;
-
-    roq_cell cb2x2[256];
-    roq_qcell cb4x4[256];
-
-    const unsigned char *buf;
-    int size;
-    int width, height;
-
-    /* Encoder only data */
-    AVLFG randctx;
-    uint64_t lambda;
-
-    motion_vect *this_motion4;
-    motion_vect *last_motion4;
-
-    motion_vect *this_motion8;
-    motion_vect *last_motion8;
-
-    unsigned int framesSinceKeyframe;
-
-    AVFrame *frame_to_enc;
-    uint8_t *out_buf;
-    struct RoqTempData *tmpData;
-} RoqContext;
-
-#define RoQ_INFO              0x1001
-#define RoQ_QUAD_CODEBOOK     0x1002
-#define RoQ_QUAD_VQ           0x1011
-#define RoQ_SOUND_MONO        0x1020
-#define RoQ_SOUND_STEREO      0x1021
-
-#define RoQ_ID_MOT              0x00
-#define RoQ_ID_FCC              0x01
-#define RoQ_ID_SLD              0x02
-#define RoQ_ID_CCC              0x03
-
-void ff_apply_vector_2x2(RoqContext *ri, int x, int y, roq_cell *cell);
-void ff_apply_vector_4x4(RoqContext *ri, int x, int y, roq_cell *cell);
-
-void ff_apply_motion_4x4(RoqContext *ri, int x, int y, int deltax, int deltay);
-
-void ff_apply_motion_8x8(RoqContext *ri, int x, int y, int deltax, int deltay);
-
-#endif /* AVCODEC_ROQVIDEO_H */
diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c
deleted file mode 100644
index 7c6f5ff..0000000
--- a/libavcodec/roqvideodec.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * id RoQ Video Decoder by Dr. Tim Ferguson
- * For more information about the id RoQ format, visit:
- *   http://www.csse.monash.edu.au/~timf/
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "roqvideo.h"
-
-static void roqvideo_decode_frame(RoqContext *ri)
-{
-    unsigned int chunk_id = 0, chunk_arg = 0;
-    unsigned long chunk_size = 0;
-    int i, j, k, nv1, nv2, vqflg = 0, vqflg_pos = -1;
-    int vqid, bpos, xpos, ypos, xp, yp, x, y, mx, my;
-    int frame_stats[2][4] = {{0},{0}};
-    roq_qcell *qcell;
-    const unsigned char *buf = ri->buf;
-    const unsigned char *buf_end = ri->buf + ri->size;
-
-    while (buf < buf_end) {
-        chunk_id = bytestream_get_le16(&buf);
-        chunk_size = bytestream_get_le32(&buf);
-        chunk_arg = bytestream_get_le16(&buf);
-
-        if(chunk_id == RoQ_QUAD_VQ)
-            break;
-        if(chunk_id == RoQ_QUAD_CODEBOOK) {
-            if((nv1 = chunk_arg >> 8) == 0)
-                nv1 = 256;
-            if((nv2 = chunk_arg & 0xff) == 0 && nv1 * 6 < chunk_size)
-                nv2 = 256;
-            for(i = 0; i < nv1; i++) {
-                ri->cb2x2[i].y[0] = *buf++;
-                ri->cb2x2[i].y[1] = *buf++;
-                ri->cb2x2[i].y[2] = *buf++;
-                ri->cb2x2[i].y[3] = *buf++;
-                ri->cb2x2[i].u = *buf++;
-                ri->cb2x2[i].v = *buf++;
-            }
-            for(i = 0; i < nv2; i++)
-                for(j = 0; j < 4; j++)
-                    ri->cb4x4[i].idx[j] = *buf++;
-        }
-    }
-
-    bpos = xpos = ypos = 0;
-    while(bpos < chunk_size) {
-        for (yp = ypos; yp < ypos + 16; yp += 8)
-            for (xp = xpos; xp < xpos + 16; xp += 8) {
-                if (vqflg_pos < 0) {
-                    vqflg = buf[bpos++]; vqflg |= (buf[bpos++] << 8);
-                    vqflg_pos = 7;
-                }
-                vqid = (vqflg >> (vqflg_pos * 2)) & 0x3;
-                frame_stats[0][vqid]++;
-                vqflg_pos--;
-
-                switch(vqid) {
-                case RoQ_ID_MOT:
-                    break;
-                case RoQ_ID_FCC:
-                    mx = 8 - (buf[bpos] >> 4) - ((signed char) (chunk_arg >> 8));
-                    my = 8 - (buf[bpos++] & 0xf) - ((signed char) chunk_arg);
-                    ff_apply_motion_8x8(ri, xp, yp, mx, my);
-                    break;
-                case RoQ_ID_SLD:
-                    qcell = ri->cb4x4 + buf[bpos++];
-                    ff_apply_vector_4x4(ri, xp, yp, ri->cb2x2 + qcell->idx[0]);
-                    ff_apply_vector_4x4(ri, xp+4, yp, ri->cb2x2 + qcell->idx[1]);
-                    ff_apply_vector_4x4(ri, xp, yp+4, ri->cb2x2 + qcell->idx[2]);
-                    ff_apply_vector_4x4(ri, xp+4, yp+4, ri->cb2x2 + qcell->idx[3]);
-                    break;
-                case RoQ_ID_CCC:
-                    for (k = 0; k < 4; k++) {
-                        x = xp; y = yp;
-                        if(k & 0x01) x += 4;
-                        if(k & 0x02) y += 4;
-
-                        if (vqflg_pos < 0) {
-                            vqflg = buf[bpos++];
-                            vqflg |= (buf[bpos++] << 8);
-                            vqflg_pos = 7;
-                        }
-                        vqid = (vqflg >> (vqflg_pos * 2)) & 0x3;
-                        frame_stats[1][vqid]++;
-                        vqflg_pos--;
-                        switch(vqid) {
-                        case RoQ_ID_MOT:
-                            break;
-                        case RoQ_ID_FCC:
-                            mx = 8 - (buf[bpos] >> 4) - ((signed char) (chunk_arg >> 8));
-                            my = 8 - (buf[bpos++] & 0xf) - ((signed char) chunk_arg);
-                            ff_apply_motion_4x4(ri, x, y, mx, my);
-                            break;
-                        case RoQ_ID_SLD:
-                            qcell = ri->cb4x4 + buf[bpos++];
-                            ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + qcell->idx[0]);
-                            ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + qcell->idx[1]);
-                            ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + qcell->idx[2]);
-                            ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + qcell->idx[3]);
-                            break;
-                        case RoQ_ID_CCC:
-                            ff_apply_vector_2x2(ri, x, y, ri->cb2x2 + buf[bpos]);
-                            ff_apply_vector_2x2(ri, x+2, y, ri->cb2x2 + buf[bpos+1]);
-                            ff_apply_vector_2x2(ri, x, y+2, ri->cb2x2 + buf[bpos+2]);
-                            ff_apply_vector_2x2(ri, x+2, y+2, ri->cb2x2 + buf[bpos+3]);
-                            bpos += 4;
-                            break;
-                        }
-                    }
-                    break;
-                default:
-                    av_log(ri->avctx, AV_LOG_ERROR, "Unknown vq code: %d\n", vqid);
-            }
-        }
-
-        xpos += 16;
-        if (xpos >= ri->width) {
-            xpos -= ri->width;
-            ypos += 16;
-        }
-        if(ypos >= ri->height)
-            break;
-    }
-}
-
-
-static av_cold int roq_decode_init(AVCodecContext *avctx)
-{
-    RoqContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->width = avctx->width;
-    s->height = avctx->height;
-    s->last_frame    = &s->frames[0];
-    s->current_frame = &s->frames[1];
-    avctx->pix_fmt = PIX_FMT_YUV444P;
-
-    return 0;
-}
-
-static int roq_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    RoqContext *s = avctx->priv_data;
-    int copy= !s->current_frame->data[0];
-
-    if (avctx->reget_buffer(avctx, s->current_frame)) {
-        av_log(avctx, AV_LOG_ERROR, "  RoQ: get_buffer() failed\n");
-        return -1;
-    }
-
-    if(copy)
-        av_picture_copy((AVPicture*)s->current_frame, (AVPicture*)s->last_frame,
-                        avctx->pix_fmt, avctx->width, avctx->height);
-
-    s->buf = buf;
-    s->size = buf_size;
-    roqvideo_decode_frame(s);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = *s->current_frame;
-
-    /* shuffle frames */
-    FFSWAP(AVFrame *, s->current_frame, s->last_frame);
-
-    return buf_size;
-}
-
-static av_cold int roq_decode_end(AVCodecContext *avctx)
-{
-    RoqContext *s = avctx->priv_data;
-
-    /* release the last frame */
-    if (s->last_frame->data[0])
-        avctx->release_buffer(avctx, s->last_frame);
-    if (s->current_frame->data[0])
-        avctx->release_buffer(avctx, s->current_frame);
-
-    return 0;
-}
-
-AVCodec roq_decoder = {
-    "roqvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ROQ,
-    sizeof(RoqContext),
-    roq_decode_init,
-    NULL,
-    roq_decode_end,
-    roq_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
-};
diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c
deleted file mode 100644
index f9fbb64..0000000
--- a/libavcodec/roqvideoenc.c
+++ /dev/null
@@ -1,1069 +0,0 @@
-/*
- * RoQ Video Encoder.
- *
- * Copyright (C) 2007 Vitor Sessak <vitor1001 at gmail.com>
- * Copyright (C) 2004-2007 Eric Lasota
- *    Based on RoQ specs (C) 2001 Tim Ferguson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * id RoQ encoder by Vitor. Based on the Switchblade3 library and the
- * Switchblade3 FFmpeg glue by Eric Lasota.
- */
-
-/*
- * COSTS:
- * Level 1:
- *  SKIP - 2 bits
- *  MOTION - 2 + 8 bits
- *  CODEBOOK - 2 + 8 bits
- *  SUBDIVIDE - 2 + combined subcel cost
- *
- * Level 2:
- *  SKIP - 2 bits
- *  MOTION - 2 + 8 bits
- *  CODEBOOK - 2 + 8 bits
- *  SUBDIVIDE - 2 + 4*8 bits
- *
- * Maximum cost: 138 bits per cel
- *
- * Proper evaluation requires LCD fraction comparison, which requires
- * Squared Error (SE) loss * savings increase
- *
- * Maximum savings increase: 136 bits
- * Maximum SE loss without overflow: 31580641
- * Components in 8x8 supercel: 192
- * Maximum SE precision per component: 164482
- *    >65025, so no truncation is needed (phew)
- */
-
-#include <string.h>
-
-#include "roqvideo.h"
-#include "bytestream.h"
-#include "elbg.h"
-#include "mathops.h"
-
-#define CHROMA_BIAS 1
-
-/**
- * Maximum number of generated 4x4 codebooks. Can't be 256 to workaround a
- * Quake 3 bug.
- */
-#define MAX_CBS_4x4 255
-
-#define MAX_CBS_2x2 256 ///< Maximum number of 2x2 codebooks.
-
-/* The cast is useful when multiplying it by INT_MAX */
-#define ROQ_LAMBDA_SCALE ((uint64_t) FF_LAMBDA_SCALE)
-
-/* Macroblock support functions */
-static void unpack_roq_cell(roq_cell *cell, uint8_t u[4*3])
-{
-    memcpy(u  , cell->y, 4);
-    memset(u+4, cell->u, 4);
-    memset(u+8, cell->v, 4);
-}
-
-static void unpack_roq_qcell(uint8_t cb2[], roq_qcell *qcell, uint8_t u[4*4*3])
-{
-    int i,cp;
-    static const int offsets[4] = {0, 2, 8, 10};
-
-    for (cp=0; cp<3; cp++)
-        for (i=0; i<4; i++) {
-            u[4*4*cp + offsets[i]  ] = cb2[qcell->idx[i]*2*2*3 + 4*cp  ];
-            u[4*4*cp + offsets[i]+1] = cb2[qcell->idx[i]*2*2*3 + 4*cp+1];
-            u[4*4*cp + offsets[i]+4] = cb2[qcell->idx[i]*2*2*3 + 4*cp+2];
-            u[4*4*cp + offsets[i]+5] = cb2[qcell->idx[i]*2*2*3 + 4*cp+3];
-        }
-}
-
-
-static void enlarge_roq_mb4(uint8_t base[3*16], uint8_t u[3*64])
-{
-    int x,y,cp;
-
-    for(cp=0; cp<3; cp++)
-        for(y=0; y<8; y++)
-            for(x=0; x<8; x++)
-                *u++ = base[(y/2)*4 + (x/2) + 16*cp];
-}
-
-static inline int square(int x)
-{
-    return x*x;
-}
-
-static inline int eval_sse(uint8_t *a, uint8_t *b, int count)
-{
-    int diff=0;
-
-    while(count--)
-        diff += square(*b++ - *a++);
-
-    return diff;
-}
-
-// FIXME Could use DSPContext.sse, but it is not so speed critical (used
-// just for motion estimation).
-static int block_sse(uint8_t **buf1, uint8_t **buf2, int x1, int y1, int x2,
-                     int y2, int *stride1, int *stride2, int size)
-{
-    int i, k;
-    int sse=0;
-
-    for (k=0; k<3; k++) {
-        int bias = (k ? CHROMA_BIAS : 4);
-        for (i=0; i<size; i++)
-            sse += bias*eval_sse(buf1[k] + (y1+i)*stride1[k] + x1,
-                                 buf2[k] + (y2+i)*stride2[k] + x2, size);
-    }
-
-    return sse;
-}
-
-static int eval_motion_dist(RoqContext *enc, int x, int y, motion_vect vect,
-                             int size)
-{
-    int mx=vect.d[0];
-    int my=vect.d[1];
-
-    if (mx < -7 || mx > 7)
-        return INT_MAX;
-
-    if (my < -7 || my > 7)
-        return INT_MAX;
-
-    mx += x;
-    my += y;
-
-    if ((unsigned) mx > enc->width-size || (unsigned) my > enc->height-size)
-        return INT_MAX;
-
-    return block_sse(enc->frame_to_enc->data, enc->last_frame->data, x, y,
-                     mx, my,
-                     enc->frame_to_enc->linesize, enc->last_frame->linesize,
-                     size);
-}
-
-/**
- * Returns distortion between two macroblocks
- */
-static inline int squared_diff_macroblock(uint8_t a[], uint8_t b[], int size)
-{
-    int cp, sdiff=0;
-
-    for(cp=0;cp<3;cp++) {
-        int bias = (cp ? CHROMA_BIAS : 4);
-        sdiff += bias*eval_sse(a, b, size*size);
-        a += size*size;
-        b += size*size;
-    }
-
-    return sdiff;
-}
-
-typedef struct
-{
-    int eval_dist[4];
-    int best_bit_use;
-    int best_coding;
-
-    int subCels[4];
-    motion_vect motion;
-    int cbEntry;
-} SubcelEvaluation;
-
-typedef struct
-{
-    int eval_dist[4];
-    int best_coding;
-
-    SubcelEvaluation subCels[4];
-
-    motion_vect motion;
-    int cbEntry;
-
-    int sourceX, sourceY;
-} CelEvaluation;
-
-typedef struct
-{
-    int numCB4;
-    int numCB2;
-    int usedCB2[MAX_CBS_2x2];
-    int usedCB4[MAX_CBS_4x4];
-    uint8_t unpacked_cb2[MAX_CBS_2x2*2*2*3];
-    uint8_t unpacked_cb4[MAX_CBS_4x4*4*4*3];
-    uint8_t unpacked_cb4_enlarged[MAX_CBS_4x4*8*8*3];
-} RoqCodebooks;
-
-/**
- * Temporary vars
- */
-typedef struct RoqTempData
-{
-    CelEvaluation *cel_evals;
-
-    int f2i4[MAX_CBS_4x4];
-    int i2f4[MAX_CBS_4x4];
-    int f2i2[MAX_CBS_2x2];
-    int i2f2[MAX_CBS_2x2];
-
-    int mainChunkSize;
-
-    int numCB4;
-    int numCB2;
-
-    RoqCodebooks codebooks;
-
-    int *closest_cb2;
-    int used_option[4];
-} RoqTempdata;
-
-/**
- * Initializes cel evaluators and sets their source coordinates
- */
-static void create_cel_evals(RoqContext *enc, RoqTempdata *tempData)
-{
-    int n=0, x, y, i;
-
-    tempData->cel_evals = av_malloc(enc->width*enc->height/64 * sizeof(CelEvaluation));
-
-    /* Map to the ROQ quadtree order */
-    for (y=0; y<enc->height; y+=16)
-        for (x=0; x<enc->width; x+=16)
-            for(i=0; i<4; i++) {
-                tempData->cel_evals[n  ].sourceX = x + (i&1)*8;
-                tempData->cel_evals[n++].sourceY = y + (i&2)*4;
-            }
-}
-
-/**
- * Get macroblocks from parts of the image
- */
-static void get_frame_mb(AVFrame *frame, int x, int y, uint8_t mb[], int dim)
-{
-    int i, j, cp;
-
-    for (cp=0; cp<3; cp++) {
-        int stride = frame->linesize[cp];
-        for (i=0; i<dim; i++)
-            for (j=0; j<dim; j++)
-                *mb++ = frame->data[cp][(y+i)*stride + x + j];
-    }
-}
-
-/**
- * Find the codebook with the lowest distortion from an image
- */
-static int index_mb(uint8_t cluster[], uint8_t cb[], int numCB,
-                    int *outIndex, int dim)
-{
-    int i, lDiff = INT_MAX, pick=0;
-
-    /* Diff against the others */
-    for (i=0; i<numCB; i++) {
-        int diff = squared_diff_macroblock(cluster, cb + i*dim*dim*3, dim);
-        if (diff < lDiff) {
-            lDiff = diff;
-            pick = i;
-        }
-    }
-
-    *outIndex = pick;
-    return lDiff;
-}
-
-#define EVAL_MOTION(MOTION) \
-    do { \
-        diff = eval_motion_dist(enc, j, i, MOTION, blocksize); \
-            \
-        if (diff < lowestdiff) { \
-            lowestdiff = diff; \
-            bestpick = MOTION; \
-        } \
-    } while(0)
-
-static void motion_search(RoqContext *enc, int blocksize)
-{
-    static const motion_vect offsets[8] = {
-        {{ 0,-1}},
-        {{ 0, 1}},
-        {{-1, 0}},
-        {{ 1, 0}},
-        {{-1, 1}},
-        {{ 1,-1}},
-        {{-1,-1}},
-        {{ 1, 1}},
-    };
-
-    int diff, lowestdiff, oldbest;
-    int off[3];
-    motion_vect bestpick = {{0,0}};
-    int i, j, k, offset;
-
-    motion_vect *last_motion;
-    motion_vect *this_motion;
-    motion_vect vect, vect2;
-
-    int max=(enc->width/blocksize)*enc->height/blocksize;
-
-    if (blocksize == 4) {
-        last_motion = enc->last_motion4;
-        this_motion = enc->this_motion4;
-    } else {
-        last_motion = enc->last_motion8;
-        this_motion = enc->this_motion8;
-    }
-
-    for (i=0; i<enc->height; i+=blocksize)
-        for (j=0; j<enc->width; j+=blocksize) {
-            lowestdiff = eval_motion_dist(enc, j, i, (motion_vect) {{0,0}},
-                                          blocksize);
-            bestpick.d[0] = 0;
-            bestpick.d[1] = 0;
-
-            if (blocksize == 4)
-                EVAL_MOTION(enc->this_motion8[(i/8)*(enc->width/8) + j/8]);
-
-            offset = (i/blocksize)*enc->width/blocksize + j/blocksize;
-            if (offset < max && offset >= 0)
-                EVAL_MOTION(last_motion[offset]);
-
-            offset++;
-            if (offset < max && offset >= 0)
-                EVAL_MOTION(last_motion[offset]);
-
-            offset = (i/blocksize + 1)*enc->width/blocksize + j/blocksize;
-            if (offset < max && offset >= 0)
-                EVAL_MOTION(last_motion[offset]);
-
-            off[0]= (i/blocksize)*enc->width/blocksize + j/blocksize - 1;
-            off[1]= off[0] - enc->width/blocksize + 1;
-            off[2]= off[1] + 1;
-
-            if (i) {
-
-                for(k=0; k<2; k++)
-                    vect.d[k]= mid_pred(this_motion[off[0]].d[k],
-                                        this_motion[off[1]].d[k],
-                                        this_motion[off[2]].d[k]);
-
-                EVAL_MOTION(vect);
-                for(k=0; k<3; k++)
-                    EVAL_MOTION(this_motion[off[k]]);
-            } else if(j)
-                EVAL_MOTION(this_motion[off[0]]);
-
-            vect = bestpick;
-
-            oldbest = -1;
-            while (oldbest != lowestdiff) {
-                oldbest = lowestdiff;
-                for (k=0; k<8; k++) {
-                    vect2 = vect;
-                    vect2.d[0] += offsets[k].d[0];
-                    vect2.d[1] += offsets[k].d[1];
-                    EVAL_MOTION(vect2);
-                }
-                vect = bestpick;
-            }
-            offset = (i/blocksize)*enc->width/blocksize + j/blocksize;
-            this_motion[offset] = bestpick;
-        }
-}
-
-/**
- * Gets distortion for all options available to a subcel
- */
-static void gather_data_for_subcel(SubcelEvaluation *subcel, int x,
-                                   int y, RoqContext *enc, RoqTempdata *tempData)
-{
-    uint8_t mb4[4*4*3];
-    uint8_t mb2[2*2*3];
-    int cluster_index;
-    int i, best_dist;
-
-    static const int bitsUsed[4] = {2, 10, 10, 34};
-
-    if (enc->framesSinceKeyframe >= 1) {
-        subcel->motion = enc->this_motion4[y*enc->width/16 + x/4];
-
-        subcel->eval_dist[RoQ_ID_FCC] =
-            eval_motion_dist(enc, x, y,
-                             enc->this_motion4[y*enc->width/16 + x/4], 4);
-    } else
-        subcel->eval_dist[RoQ_ID_FCC] = INT_MAX;
-
-    if (enc->framesSinceKeyframe >= 2)
-        subcel->eval_dist[RoQ_ID_MOT] = block_sse(enc->frame_to_enc->data,
-                                                  enc->current_frame->data, x,
-                                                  y, x, y,
-                                                  enc->frame_to_enc->linesize,
-                                                  enc->current_frame->linesize,
-                                                  4);
-    else
-        subcel->eval_dist[RoQ_ID_MOT] = INT_MAX;
-
-    cluster_index = y*enc->width/16 + x/4;
-
-    get_frame_mb(enc->frame_to_enc, x, y, mb4, 4);
-
-    subcel->eval_dist[RoQ_ID_SLD] = index_mb(mb4,
-                                             tempData->codebooks.unpacked_cb4,
-                                             tempData->codebooks.numCB4,
-                                             &subcel->cbEntry, 4);
-
-    subcel->eval_dist[RoQ_ID_CCC] = 0;
-
-    for(i=0;i<4;i++) {
-        subcel->subCels[i] = tempData->closest_cb2[cluster_index*4+i];
-
-        get_frame_mb(enc->frame_to_enc, x+2*(i&1),
-                     y+(i&2), mb2, 2);
-
-        subcel->eval_dist[RoQ_ID_CCC] +=
-            squared_diff_macroblock(tempData->codebooks.unpacked_cb2 + subcel->subCels[i]*2*2*3, mb2, 2);
-    }
-
-    best_dist = INT_MAX;
-    for (i=0; i<4; i++)
-        if (ROQ_LAMBDA_SCALE*subcel->eval_dist[i] + enc->lambda*bitsUsed[i] <
-            best_dist) {
-            subcel->best_coding = i;
-            subcel->best_bit_use = bitsUsed[i];
-            best_dist = ROQ_LAMBDA_SCALE*subcel->eval_dist[i] +
-                enc->lambda*bitsUsed[i];
-        }
-}
-
-/**
- * Gets distortion for all options available to a cel
- */
-static void gather_data_for_cel(CelEvaluation *cel, RoqContext *enc,
-                                RoqTempdata *tempData)
-{
-    uint8_t mb8[8*8*3];
-    int index = cel->sourceY*enc->width/64 + cel->sourceX/8;
-    int i, j, best_dist, divide_bit_use;
-
-    int bitsUsed[4] = {2, 10, 10, 0};
-
-    if (enc->framesSinceKeyframe >= 1) {
-        cel->motion = enc->this_motion8[index];
-
-        cel->eval_dist[RoQ_ID_FCC] =
-            eval_motion_dist(enc, cel->sourceX, cel->sourceY,
-                             enc->this_motion8[index], 8);
-    } else
-        cel->eval_dist[RoQ_ID_FCC] = INT_MAX;
-
-    if (enc->framesSinceKeyframe >= 2)
-        cel->eval_dist[RoQ_ID_MOT] = block_sse(enc->frame_to_enc->data,
-                                               enc->current_frame->data,
-                                               cel->sourceX, cel->sourceY,
-                                               cel->sourceX, cel->sourceY,
-                                               enc->frame_to_enc->linesize,
-                                               enc->current_frame->linesize,8);
-    else
-        cel->eval_dist[RoQ_ID_MOT] = INT_MAX;
-
-    get_frame_mb(enc->frame_to_enc, cel->sourceX, cel->sourceY, mb8, 8);
-
-    cel->eval_dist[RoQ_ID_SLD] =
-        index_mb(mb8, tempData->codebooks.unpacked_cb4_enlarged,
-                 tempData->codebooks.numCB4, &cel->cbEntry, 8);
-
-    gather_data_for_subcel(cel->subCels + 0, cel->sourceX+0, cel->sourceY+0, enc, tempData);
-    gather_data_for_subcel(cel->subCels + 1, cel->sourceX+4, cel->sourceY+0, enc, tempData);
-    gather_data_for_subcel(cel->subCels + 2, cel->sourceX+0, cel->sourceY+4, enc, tempData);
-    gather_data_for_subcel(cel->subCels + 3, cel->sourceX+4, cel->sourceY+4, enc, tempData);
-
-    cel->eval_dist[RoQ_ID_CCC] = 0;
-    divide_bit_use = 0;
-    for (i=0; i<4; i++) {
-        cel->eval_dist[RoQ_ID_CCC] +=
-            cel->subCels[i].eval_dist[cel->subCels[i].best_coding];
-        divide_bit_use += cel->subCels[i].best_bit_use;
-    }
-
-    best_dist = INT_MAX;
-    bitsUsed[3] = 2 + divide_bit_use;
-
-    for (i=0; i<4; i++)
-        if (ROQ_LAMBDA_SCALE*cel->eval_dist[i] + enc->lambda*bitsUsed[i] <
-            best_dist) {
-            cel->best_coding = i;
-            best_dist = ROQ_LAMBDA_SCALE*cel->eval_dist[i] +
-                enc->lambda*bitsUsed[i];
-        }
-
-    tempData->used_option[cel->best_coding]++;
-    tempData->mainChunkSize += bitsUsed[cel->best_coding];
-
-    if (cel->best_coding == RoQ_ID_SLD)
-        tempData->codebooks.usedCB4[cel->cbEntry]++;
-
-    if (cel->best_coding == RoQ_ID_CCC)
-        for (i=0; i<4; i++) {
-            if (cel->subCels[i].best_coding == RoQ_ID_SLD)
-                tempData->codebooks.usedCB4[cel->subCels[i].cbEntry]++;
-            else if (cel->subCels[i].best_coding == RoQ_ID_CCC)
-                for (j=0; j<4; j++)
-                    tempData->codebooks.usedCB2[cel->subCels[i].subCels[j]]++;
-        }
-}
-
-static void remap_codebooks(RoqContext *enc, RoqTempdata *tempData)
-{
-    int i, j, idx=0;
-
-    /* Make remaps for the final codebook usage */
-    for (i=0; i<MAX_CBS_4x4; i++) {
-        if (tempData->codebooks.usedCB4[i]) {
-            tempData->i2f4[i] = idx;
-            tempData->f2i4[idx] = i;
-            for (j=0; j<4; j++)
-                tempData->codebooks.usedCB2[enc->cb4x4[i].idx[j]]++;
-            idx++;
-        }
-    }
-
-    tempData->numCB4 = idx;
-
-    idx = 0;
-    for (i=0; i<MAX_CBS_2x2; i++) {
-        if (tempData->codebooks.usedCB2[i]) {
-            tempData->i2f2[i] = idx;
-            tempData->f2i2[idx] = i;
-            idx++;
-        }
-    }
-    tempData->numCB2 = idx;
-
-}
-
-/**
- * Write codebook chunk
- */
-static void write_codebooks(RoqContext *enc, RoqTempdata *tempData)
-{
-    int i, j;
-    uint8_t **outp= &enc->out_buf;
-
-    if (tempData->numCB2) {
-        bytestream_put_le16(outp, RoQ_QUAD_CODEBOOK);
-        bytestream_put_le32(outp, tempData->numCB2*6 + tempData->numCB4*4);
-        bytestream_put_byte(outp, tempData->numCB4);
-        bytestream_put_byte(outp, tempData->numCB2);
-
-        for (i=0; i<tempData->numCB2; i++) {
-            bytestream_put_buffer(outp, enc->cb2x2[tempData->f2i2[i]].y, 4);
-            bytestream_put_byte(outp, enc->cb2x2[tempData->f2i2[i]].u);
-            bytestream_put_byte(outp, enc->cb2x2[tempData->f2i2[i]].v);
-        }
-
-        for (i=0; i<tempData->numCB4; i++)
-            for (j=0; j<4; j++)
-                bytestream_put_byte(outp, tempData->i2f2[enc->cb4x4[tempData->f2i4[i]].idx[j]]);
-
-    }
-}
-
-static inline uint8_t motion_arg(motion_vect mot)
-{
-    uint8_t ax = 8 - ((uint8_t) mot.d[0]);
-    uint8_t ay = 8 - ((uint8_t) mot.d[1]);
-    return ((ax&15)<<4) | (ay&15);
-}
-
-typedef struct
-{
-    int typeSpool;
-    int typeSpoolLength;
-    uint8_t argumentSpool[64];
-    uint8_t *args;
-    uint8_t **pout;
-} CodingSpool;
-
-/* NOTE: Typecodes must be spooled AFTER arguments!! */
-static void write_typecode(CodingSpool *s, uint8_t type)
-{
-    s->typeSpool |= (type & 3) << (14 - s->typeSpoolLength);
-    s->typeSpoolLength += 2;
-    if (s->typeSpoolLength == 16) {
-        bytestream_put_le16(s->pout, s->typeSpool);
-        bytestream_put_buffer(s->pout, s->argumentSpool,
-                              s->args - s->argumentSpool);
-        s->typeSpoolLength = 0;
-        s->typeSpool = 0;
-        s->args = s->argumentSpool;
-    }
-}
-
-static void reconstruct_and_encode_image(RoqContext *enc, RoqTempdata *tempData, int w, int h, int numBlocks)
-{
-    int i, j, k;
-    int x, y;
-    int subX, subY;
-    int dist=0;
-
-    roq_qcell *qcell;
-    CelEvaluation *eval;
-
-    CodingSpool spool;
-
-    spool.typeSpool=0;
-    spool.typeSpoolLength=0;
-    spool.args = spool.argumentSpool;
-    spool.pout = &enc->out_buf;
-
-    if (tempData->used_option[RoQ_ID_CCC]%2)
-        tempData->mainChunkSize+=8; //FIXME
-
-    /* Write the video chunk header */
-    bytestream_put_le16(&enc->out_buf, RoQ_QUAD_VQ);
-    bytestream_put_le32(&enc->out_buf, tempData->mainChunkSize/8);
-    bytestream_put_byte(&enc->out_buf, 0x0);
-    bytestream_put_byte(&enc->out_buf, 0x0);
-
-    for (i=0; i<numBlocks; i++) {
-        eval = tempData->cel_evals + i;
-
-        x = eval->sourceX;
-        y = eval->sourceY;
-        dist += eval->eval_dist[eval->best_coding];
-
-        switch (eval->best_coding) {
-        case RoQ_ID_MOT:
-            write_typecode(&spool, RoQ_ID_MOT);
-            break;
-
-        case RoQ_ID_FCC:
-            bytestream_put_byte(&spool.args, motion_arg(eval->motion));
-
-            write_typecode(&spool, RoQ_ID_FCC);
-            ff_apply_motion_8x8(enc, x, y,
-                                eval->motion.d[0], eval->motion.d[1]);
-            break;
-
-        case RoQ_ID_SLD:
-            bytestream_put_byte(&spool.args, tempData->i2f4[eval->cbEntry]);
-            write_typecode(&spool, RoQ_ID_SLD);
-
-            qcell = enc->cb4x4 + eval->cbEntry;
-            ff_apply_vector_4x4(enc, x  , y  , enc->cb2x2 + qcell->idx[0]);
-            ff_apply_vector_4x4(enc, x+4, y  , enc->cb2x2 + qcell->idx[1]);
-            ff_apply_vector_4x4(enc, x  , y+4, enc->cb2x2 + qcell->idx[2]);
-            ff_apply_vector_4x4(enc, x+4, y+4, enc->cb2x2 + qcell->idx[3]);
-            break;
-
-        case RoQ_ID_CCC:
-            write_typecode(&spool, RoQ_ID_CCC);
-
-            for (j=0; j<4; j++) {
-                subX = x + 4*(j&1);
-                subY = y + 2*(j&2);
-
-                switch(eval->subCels[j].best_coding) {
-                case RoQ_ID_MOT:
-                    break;
-
-                case RoQ_ID_FCC:
-                    bytestream_put_byte(&spool.args,
-                                        motion_arg(eval->subCels[j].motion));
-
-                    ff_apply_motion_4x4(enc, subX, subY,
-                                        eval->subCels[j].motion.d[0],
-                                        eval->subCels[j].motion.d[1]);
-                    break;
-
-                case RoQ_ID_SLD:
-                    bytestream_put_byte(&spool.args,
-                                        tempData->i2f4[eval->subCels[j].cbEntry]);
-
-                    qcell = enc->cb4x4 + eval->subCels[j].cbEntry;
-
-                    ff_apply_vector_2x2(enc, subX  , subY  ,
-                                        enc->cb2x2 + qcell->idx[0]);
-                    ff_apply_vector_2x2(enc, subX+2, subY  ,
-                                        enc->cb2x2 + qcell->idx[1]);
-                    ff_apply_vector_2x2(enc, subX  , subY+2,
-                                        enc->cb2x2 + qcell->idx[2]);
-                    ff_apply_vector_2x2(enc, subX+2, subY+2,
-                                        enc->cb2x2 + qcell->idx[3]);
-                    break;
-
-                case RoQ_ID_CCC:
-                    for (k=0; k<4; k++) {
-                        int cb_idx = eval->subCels[j].subCels[k];
-                        bytestream_put_byte(&spool.args,
-                                            tempData->i2f2[cb_idx]);
-
-                        ff_apply_vector_2x2(enc, subX + 2*(k&1), subY + (k&2),
-                                            enc->cb2x2 + cb_idx);
-                    }
-                    break;
-                }
-                write_typecode(&spool, eval->subCels[j].best_coding);
-            }
-            break;
-        }
-    }
-
-    /* Flush the remainder of the argument/type spool */
-    while (spool.typeSpoolLength)
-        write_typecode(&spool, 0x0);
-
-#if 0
-    uint8_t *fdata[3] = {enc->frame_to_enc->data[0],
-                           enc->frame_to_enc->data[1],
-                           enc->frame_to_enc->data[2]};
-    uint8_t *cdata[3] = {enc->current_frame->data[0],
-                           enc->current_frame->data[1],
-                           enc->current_frame->data[2]};
-    av_log(enc->avctx, AV_LOG_ERROR, "Expected distortion: %i Actual: %i\n",
-           dist,
-           block_sse(fdata, cdata, 0, 0, 0, 0,
-                     enc->frame_to_enc->linesize,
-                     enc->current_frame->linesize,
-                     enc->width));  //WARNING: Square dimensions implied...
-#endif
-}
-
-
-/**
- * Create a single YUV cell from a 2x2 section of the image
- */
-static inline void frame_block_to_cell(uint8_t *block, uint8_t **data,
-                                       int top, int left, int *stride)
-{
-    int i, j, u=0, v=0;
-
-    for (i=0; i<2; i++)
-        for (j=0; j<2; j++) {
-            int x = (top+i)*stride[0] + left + j;
-            *block++ = data[0][x];
-            x = (top+i)*stride[1] + left + j;
-            u       += data[1][x];
-            v       += data[2][x];
-        }
-
-    *block++ = (u+2)/4;
-    *block++ = (v+2)/4;
-}
-
-/**
- * Creates YUV clusters for the entire image
- */
-static void create_clusters(AVFrame *frame, int w, int h, uint8_t *yuvClusters)
-{
-    int i, j, k, l;
-
-    for (i=0; i<h; i+=4)
-        for (j=0; j<w; j+=4) {
-            for (k=0; k < 2; k++)
-                for (l=0; l < 2; l++)
-                    frame_block_to_cell(yuvClusters + (l + 2*k)*6, frame->data,
-                                        i+2*k, j+2*l, frame->linesize);
-            yuvClusters += 24;
-        }
-}
-
-static void generate_codebook(RoqContext *enc, RoqTempdata *tempdata,
-                              int *points, int inputCount, roq_cell *results,
-                              int size, int cbsize)
-{
-    int i, j, k;
-    int c_size = size*size/4;
-    int *buf;
-    int *codebook = av_malloc(6*c_size*cbsize*sizeof(int));
-    int *closest_cb;
-
-    if (size == 4)
-        closest_cb = av_malloc(6*c_size*inputCount*sizeof(int));
-    else
-        closest_cb = tempdata->closest_cb2;
-
-    ff_init_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx);
-    ff_do_elbg(points, 6*c_size, inputCount, codebook, cbsize, 1, closest_cb, &enc->randctx);
-
-    if (size == 4)
-        av_free(closest_cb);
-
-    buf = codebook;
-    for (i=0; i<cbsize; i++)
-        for (k=0; k<c_size; k++) {
-            for(j=0; j<4; j++)
-                results->y[j] = *buf++;
-
-            results->u =    (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS;
-            results->v =    (*buf++ + CHROMA_BIAS/2)/CHROMA_BIAS;
-            results++;
-        }
-
-    av_free(codebook);
-}
-
-static void generate_new_codebooks(RoqContext *enc, RoqTempdata *tempData)
-{
-    int i,j;
-    RoqCodebooks *codebooks = &tempData->codebooks;
-    int max = enc->width*enc->height/16;
-    uint8_t mb2[3*4];
-    roq_cell *results4 = av_malloc(sizeof(roq_cell)*MAX_CBS_4x4*4);
-    uint8_t *yuvClusters=av_malloc(sizeof(int)*max*6*4);
-    int *points = av_malloc(max*6*4*sizeof(int));
-    int bias;
-
-    /* Subsample YUV data */
-    create_clusters(enc->frame_to_enc, enc->width, enc->height, yuvClusters);
-
-    /* Cast to integer and apply chroma bias */
-    for (i=0; i<max*24; i++) {
-        bias = ((i%6)<4) ? 1 : CHROMA_BIAS;
-        points[i] = bias*yuvClusters[i];
-    }
-
-    /* Create 4x4 codebooks */
-    generate_codebook(enc, tempData, points, max, results4, 4, MAX_CBS_4x4);
-
-    codebooks->numCB4 = MAX_CBS_4x4;
-
-    tempData->closest_cb2 = av_malloc(max*4*sizeof(int));
-
-    /* Create 2x2 codebooks */
-    generate_codebook(enc, tempData, points, max*4, enc->cb2x2, 2, MAX_CBS_2x2);
-
-    codebooks->numCB2 = MAX_CBS_2x2;
-
-    /* Unpack 2x2 codebook clusters */
-    for (i=0; i<codebooks->numCB2; i++)
-        unpack_roq_cell(enc->cb2x2 + i, codebooks->unpacked_cb2 + i*2*2*3);
-
-    /* Index all 4x4 entries to the 2x2 entries, unpack, and enlarge */
-    for (i=0; i<codebooks->numCB4; i++) {
-        for (j=0; j<4; j++) {
-            unpack_roq_cell(&results4[4*i + j], mb2);
-            index_mb(mb2, codebooks->unpacked_cb2, codebooks->numCB2,
-                     &enc->cb4x4[i].idx[j], 2);
-        }
-        unpack_roq_qcell(codebooks->unpacked_cb2, enc->cb4x4 + i,
-                         codebooks->unpacked_cb4 + i*4*4*3);
-        enlarge_roq_mb4(codebooks->unpacked_cb4 + i*4*4*3,
-                        codebooks->unpacked_cb4_enlarged + i*8*8*3);
-    }
-
-    av_free(yuvClusters);
-    av_free(points);
-    av_free(results4);
-}
-
-static void roq_encode_video(RoqContext *enc)
-{
-    RoqTempdata *tempData = enc->tmpData;
-    int i;
-
-    memset(tempData, 0, sizeof(*tempData));
-
-    create_cel_evals(enc, tempData);
-
-    generate_new_codebooks(enc, tempData);
-
-    if (enc->framesSinceKeyframe >= 1) {
-        motion_search(enc, 8);
-        motion_search(enc, 4);
-    }
-
- retry_encode:
-    for (i=0; i<enc->width*enc->height/64; i++)
-        gather_data_for_cel(tempData->cel_evals + i, enc, tempData);
-
-    /* Quake 3 can't handle chunks bigger than 65536 bytes */
-    if (tempData->mainChunkSize/8 > 65536) {
-        enc->lambda *= .8;
-        goto retry_encode;
-    }
-
-    remap_codebooks(enc, tempData);
-
-    write_codebooks(enc, tempData);
-
-    reconstruct_and_encode_image(enc, tempData, enc->width, enc->height,
-                                 enc->width*enc->height/64);
-
-    enc->avctx->coded_frame = enc->current_frame;
-
-    /* Rotate frame history */
-    FFSWAP(AVFrame *, enc->current_frame, enc->last_frame);
-    FFSWAP(motion_vect *, enc->last_motion4, enc->this_motion4);
-    FFSWAP(motion_vect *, enc->last_motion8, enc->this_motion8);
-
-    av_free(tempData->cel_evals);
-    av_free(tempData->closest_cb2);
-
-    enc->framesSinceKeyframe++;
-}
-
-static int roq_encode_init(AVCodecContext *avctx)
-{
-    RoqContext *enc = avctx->priv_data;
-
-    av_lfg_init(&enc->randctx, 1);
-
-    enc->framesSinceKeyframe = 0;
-    if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
-        av_log(avctx, AV_LOG_ERROR, "Dimensions must be divisible by 16\n");
-        return -1;
-    }
-
-    if (((avctx->width)&(avctx->width-1))||((avctx->height)&(avctx->height-1)))
-        av_log(avctx, AV_LOG_ERROR, "Warning: dimensions not power of two\n");
-
-    enc->width = avctx->width;
-    enc->height = avctx->height;
-
-    enc->framesSinceKeyframe = 0;
-    enc->first_frame = 1;
-
-    enc->last_frame    = &enc->frames[0];
-    enc->current_frame = &enc->frames[1];
-
-    enc->tmpData      = av_malloc(sizeof(RoqTempdata));
-
-    enc->this_motion4 =
-        av_mallocz((enc->width*enc->height/16)*sizeof(motion_vect));
-
-    enc->last_motion4 =
-        av_malloc ((enc->width*enc->height/16)*sizeof(motion_vect));
-
-    enc->this_motion8 =
-        av_mallocz((enc->width*enc->height/64)*sizeof(motion_vect));
-
-    enc->last_motion8 =
-        av_malloc ((enc->width*enc->height/64)*sizeof(motion_vect));
-
-    return 0;
-}
-
-static void roq_write_video_info_chunk(RoqContext *enc)
-{
-    /* ROQ info chunk */
-    bytestream_put_le16(&enc->out_buf, RoQ_INFO);
-
-    /* Size: 8 bytes */
-    bytestream_put_le32(&enc->out_buf, 8);
-
-    /* Unused argument */
-    bytestream_put_byte(&enc->out_buf, 0x00);
-    bytestream_put_byte(&enc->out_buf, 0x00);
-
-    /* Width */
-    bytestream_put_le16(&enc->out_buf, enc->width);
-
-    /* Height */
-    bytestream_put_le16(&enc->out_buf, enc->height);
-
-    /* Unused in Quake 3, mimics the output of the real encoder */
-    bytestream_put_byte(&enc->out_buf, 0x08);
-    bytestream_put_byte(&enc->out_buf, 0x00);
-    bytestream_put_byte(&enc->out_buf, 0x04);
-    bytestream_put_byte(&enc->out_buf, 0x00);
-}
-
-static int roq_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data)
-{
-    RoqContext *enc = avctx->priv_data;
-    AVFrame *frame= data;
-    uint8_t *buf_start = buf;
-
-    enc->out_buf = buf;
-    enc->avctx = avctx;
-
-    enc->frame_to_enc = frame;
-
-    if (frame->quality)
-        enc->lambda = frame->quality - 1;
-    else
-        enc->lambda = 2*ROQ_LAMBDA_SCALE;
-
-    /* 138 bits max per 8x8 block +
-     *     256 codebooks*(6 bytes 2x2 + 4 bytes 4x4) + 8 bytes frame header */
-    if (((enc->width*enc->height/64)*138+7)/8 + 256*(6+4) + 8 > buf_size) {
-        av_log(avctx, AV_LOG_ERROR, "  RoQ: Output buffer too small!\n");
-        return -1;
-    }
-
-    /* Check for I frame */
-    if (enc->framesSinceKeyframe == avctx->gop_size)
-        enc->framesSinceKeyframe = 0;
-
-    if (enc->first_frame) {
-        /* Alloc memory for the reconstruction data (we must know the stride
-         for that) */
-        if (avctx->get_buffer(avctx, enc->current_frame) ||
-            avctx->get_buffer(avctx, enc->last_frame)) {
-            av_log(avctx, AV_LOG_ERROR, "  RoQ: get_buffer() failed\n");
-            return -1;
-        }
-
-        /* Before the first video frame, write a "video info" chunk */
-        roq_write_video_info_chunk(enc);
-
-        enc->first_frame = 0;
-    }
-
-    /* Encode the actual frame */
-    roq_encode_video(enc);
-
-    return enc->out_buf - buf_start;
-}
-
-static int roq_encode_end(AVCodecContext *avctx)
-{
-    RoqContext *enc = avctx->priv_data;
-
-    avctx->release_buffer(avctx, enc->last_frame);
-    avctx->release_buffer(avctx, enc->current_frame);
-
-    av_free(enc->tmpData);
-    av_free(enc->this_motion4);
-    av_free(enc->last_motion4);
-    av_free(enc->this_motion8);
-    av_free(enc->last_motion8);
-
-    return 0;
-}
-
-AVCodec roq_encoder =
-{
-    "roqvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ROQ,
-    sizeof(RoqContext),
-    roq_encode_init,
-    roq_encode_frame,
-    roq_encode_end,
-    .supported_framerates = (const AVRational[]){{30,1}, {0,0}},
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
-};
diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c
deleted file mode 100644
index e103f52..0000000
--- a/libavcodec/rpza.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Quicktime Video (RPZA) Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QT RPZA Video Decoder by Roberto Togni
- * For more information about the RPZA format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *
- * The RPZA decoder outputs RGB555 colorspace data.
- *
- * Note that this decoder reads big endian RGB555 pixel values from the
- * bytestream, arranges them in the host's endian order, and outputs
- * them to the final rendered map in the same host endian order. This is
- * intended behavior as the ffmpeg documentation states that RGB555 pixels
- * shall be stored in native CPU endianness.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct RpzaContext {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *buf;
-    int size;
-
-} RpzaContext;
-
-#define ADVANCE_BLOCK() \
-{ \
-    pixel_ptr += 4; \
-    if (pixel_ptr >= width) \
-    { \
-        pixel_ptr = 0; \
-        row_ptr += stride * 4; \
-    } \
-    total_blocks--; \
-    if (total_blocks < 0) \
-    { \
-        av_log(s->avctx, AV_LOG_ERROR, "warning: block counter just went negative (this should not happen)\n"); \
-        return; \
-    } \
-}
-
-static void rpza_decode_stream(RpzaContext *s)
-{
-    int width = s->avctx->width;
-    int stride = s->frame.linesize[0] / 2;
-    int row_inc = stride - 4;
-    int stream_ptr = 0;
-    int chunk_size;
-    unsigned char opcode;
-    int n_blocks;
-    unsigned short colorA = 0, colorB;
-    unsigned short color4[4];
-    unsigned char index, idx;
-    unsigned short ta, tb;
-    unsigned short *pixels = (unsigned short *)s->frame.data[0];
-
-    int row_ptr = 0;
-    int pixel_ptr = 0;
-    int block_ptr;
-    int pixel_x, pixel_y;
-    int total_blocks;
-
-    /* First byte is always 0xe1. Warn if it's different */
-    if (s->buf[stream_ptr] != 0xe1)
-        av_log(s->avctx, AV_LOG_ERROR, "First chunk byte is 0x%02x instead of 0xe1\n",
-            s->buf[stream_ptr]);
-
-    /* Get chunk size, ingnoring first byte */
-    chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
-    stream_ptr += 4;
-
-    /* If length mismatch use size from MOV file and try to decode anyway */
-    if (chunk_size != s->size)
-        av_log(s->avctx, AV_LOG_ERROR, "MOV chunk size != encoded chunk size; using MOV chunk size\n");
-
-    chunk_size = s->size;
-
-    /* Number of 4x4 blocks in frame. */
-    total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
-
-    /* Process chunk data */
-    while (stream_ptr < chunk_size) {
-        opcode = s->buf[stream_ptr++]; /* Get opcode */
-
-        n_blocks = (opcode & 0x1f) + 1; /* Extract block counter from opcode */
-
-        /* If opcode MSbit is 0, we need more data to decide what to do */
-        if ((opcode & 0x80) == 0) {
-            colorA = (opcode << 8) | (s->buf[stream_ptr++]);
-            opcode = 0;
-            if ((s->buf[stream_ptr] & 0x80) != 0) {
-                /* Must behave as opcode 110xxxxx, using colorA computed
-                 * above. Use fake opcode 0x20 to enter switch block at
-                 * the right place */
-                opcode = 0x20;
-                n_blocks = 1;
-            }
-        }
-
-        switch (opcode & 0xe0) {
-
-        /* Skip blocks */
-        case 0x80:
-            while (n_blocks--) {
-              ADVANCE_BLOCK();
-            }
-            break;
-
-        /* Fill blocks with one color */
-        case 0xa0:
-            colorA = AV_RB16 (&s->buf[stream_ptr]);
-            stream_ptr += 2;
-            while (n_blocks--) {
-                block_ptr = row_ptr + pixel_ptr;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++){
-                        pixels[block_ptr] = colorA;
-                        block_ptr++;
-                    }
-                    block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* Fill blocks with 4 colors */
-        case 0xc0:
-            colorA = AV_RB16 (&s->buf[stream_ptr]);
-            stream_ptr += 2;
-        case 0x20:
-            colorB = AV_RB16 (&s->buf[stream_ptr]);
-            stream_ptr += 2;
-
-            /* sort out the colors */
-            color4[0] = colorB;
-            color4[1] = 0;
-            color4[2] = 0;
-            color4[3] = colorA;
-
-            /* red components */
-            ta = (colorA >> 10) & 0x1F;
-            tb = (colorB >> 10) & 0x1F;
-            color4[1] |= ((11 * ta + 21 * tb) >> 5) << 10;
-            color4[2] |= ((21 * ta + 11 * tb) >> 5) << 10;
-
-            /* green components */
-            ta = (colorA >> 5) & 0x1F;
-            tb = (colorB >> 5) & 0x1F;
-            color4[1] |= ((11 * ta + 21 * tb) >> 5) << 5;
-            color4[2] |= ((21 * ta + 11 * tb) >> 5) << 5;
-
-            /* blue components */
-            ta = colorA & 0x1F;
-            tb = colorB & 0x1F;
-            color4[1] |= ((11 * ta + 21 * tb) >> 5);
-            color4[2] |= ((21 * ta + 11 * tb) >> 5);
-
-            while (n_blocks--) {
-                block_ptr = row_ptr + pixel_ptr;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    index = s->buf[stream_ptr++];
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++){
-                        idx = (index >> (2 * (3 - pixel_x))) & 0x03;
-                        pixels[block_ptr] = color4[idx];
-                        block_ptr++;
-                    }
-                    block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* Fill block with 16 colors */
-        case 0x00:
-            block_ptr = row_ptr + pixel_ptr;
-            for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                for (pixel_x = 0; pixel_x < 4; pixel_x++){
-                    /* We already have color of upper left pixel */
-                    if ((pixel_y != 0) || (pixel_x !=0)) {
-                        colorA = AV_RB16 (&s->buf[stream_ptr]);
-                        stream_ptr += 2;
-                    }
-                    pixels[block_ptr] = colorA;
-                    block_ptr++;
-                }
-                block_ptr += row_inc;
-            }
-            ADVANCE_BLOCK();
-            break;
-
-        /* Unknown opcode */
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "Unknown opcode %d in rpza chunk."
-                 " Skip remaining %d bytes of chunk data.\n", opcode,
-                 chunk_size - stream_ptr);
-            return;
-        } /* Opcode switch */
-    }
-}
-
-static av_cold int rpza_decode_init(AVCodecContext *avctx)
-{
-    RpzaContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_RGB555;
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int rpza_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    RpzaContext *s = avctx->priv_data;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    rpza_decode_stream(s);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int rpza_decode_end(AVCodecContext *avctx)
-{
-    RpzaContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec rpza_decoder = {
-    "rpza",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RPZA,
-    sizeof(RpzaContext),
-    rpza_decode_init,
-    NULL,
-    rpza_decode_end,
-    rpza_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("QuickTime video (RPZA)"),
-};
diff --git a/libavcodec/rtjpeg.c b/libavcodec/rtjpeg.c
deleted file mode 100644
index 4c48f25..0000000
--- a/libavcodec/rtjpeg.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * RTJpeg decoding functions
- * Copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "libavutil/common.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "rtjpeg.h"
-
-#define PUT_COEFF(c) \
-    i = scan[coeff--]; \
-    block[i] = (c) * quant[i];
-
-//! aligns the bitstream to the give power of two
-#define ALIGN(a) \
-    n = (-get_bits_count(gb)) & (a - 1); \
-    if (n) {skip_bits(gb, n);}
-
-/**
- * \brief read one block from stream
- * \param gb contains stream data
- * \param block where data is written to
- * \param scan array containing the mapping stream address -> block position
- * \param quant quantization factors
- * \return 0 means the block is not coded, < 0 means an error occurred.
- *
- * Note: GetBitContext is used to make the code simpler, since all data is
- * aligned this could be done faster in a different way, e.g. as it is done
- * in MPlayer libmpcodecs/native/rtjpegn.c.
- */
-static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *scan,
-                            const uint32_t *quant) {
-    int coeff, i, n;
-    int8_t ac;
-    uint8_t dc = get_bits(gb, 8);
-
-    // block not coded
-    if (dc == 255)
-       return 0;
-
-    // number of non-zero coefficients
-    coeff = get_bits(gb, 6);
-    if (get_bits_count(gb) + (coeff << 1) >= gb->size_in_bits)
-        return -1;
-
-    // normally we would only need to clear the (63 - coeff) last values,
-    // but since we do not know where they are we just clear the whole block
-    memset(block, 0, 64 * sizeof(DCTELEM));
-
-    // 2 bits per coefficient
-    while (coeff) {
-        ac = get_sbits(gb, 2);
-        if (ac == -2)
-            break; // continue with more bits
-        PUT_COEFF(ac);
-    }
-
-    // 4 bits per coefficient
-    ALIGN(4);
-    if (get_bits_count(gb) + (coeff << 2) >= gb->size_in_bits)
-        return -1;
-    while (coeff) {
-        ac = get_sbits(gb, 4);
-        if (ac == -8)
-            break; // continue with more bits
-        PUT_COEFF(ac);
-    }
-
-    // 8 bits per coefficient
-    ALIGN(8);
-    if (get_bits_count(gb) + (coeff << 3) >= gb->size_in_bits)
-        return -1;
-    while (coeff) {
-        ac = get_sbits(gb, 8);
-        PUT_COEFF(ac);
-    }
-
-    PUT_COEFF(dc);
-    return 1;
-}
-
-/**
- * \brief decode one rtjpeg YUV420 frame
- * \param c context, must be initialized via rtjpeg_decode_init
- * \param f AVFrame to place decoded frame into. If parts of the frame
- *          are not coded they are left unchanged, so consider initializing it
- * \param buf buffer containing input data
- * \param buf_size length of input data in bytes
- * \return number of bytes consumed from the input buffer
- */
-int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
-                               const uint8_t *buf, int buf_size) {
-    GetBitContext gb;
-    int w = c->w / 16, h = c->h / 16;
-    int x, y;
-    uint8_t *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0];
-    uint8_t *u = f->data[1], *v = f->data[2];
-    init_get_bits(&gb, buf, buf_size * 8);
-    for (y = 0; y < h; y++) {
-        for (x = 0; x < w; x++) {
-            DCTELEM *block = c->block;
-            if (get_block(&gb, block, c->scan, c->lquant) > 0)
-                c->dsp->idct_put(y1, f->linesize[0], block);
-            y1 += 8;
-            if (get_block(&gb, block, c->scan, c->lquant) > 0)
-                c->dsp->idct_put(y1, f->linesize[0], block);
-            y1 += 8;
-            if (get_block(&gb, block, c->scan, c->lquant) > 0)
-                c->dsp->idct_put(y2, f->linesize[0], block);
-            y2 += 8;
-            if (get_block(&gb, block, c->scan, c->lquant) > 0)
-                c->dsp->idct_put(y2, f->linesize[0], block);
-            y2 += 8;
-            if (get_block(&gb, block, c->scan, c->cquant) > 0)
-                c->dsp->idct_put(u, f->linesize[1], block);
-            u += 8;
-            if (get_block(&gb, block, c->scan, c->cquant) > 0)
-                c->dsp->idct_put(v, f->linesize[2], block);
-            v += 8;
-        }
-        y1 += 2 * 8 * (f->linesize[0] - w);
-        y2 += 2 * 8 * (f->linesize[0] - w);
-        u += 8 * (f->linesize[1] - w);
-        v += 8 * (f->linesize[2] - w);
-    }
-    return get_bits_count(&gb) / 8;
-}
-
-/**
- * \brief initialize an RTJpegContext, may be called multiple times
- * \param c context to initialize
- * \param dsp specifies the idct to use for decoding
- * \param width width of image, will be rounded down to the nearest multiple
- *              of 16 for decoding
- * \param height height of image, will be rounded down to the nearest multiple
- *              of 16 for decoding
- * \param lquant luma quantization table to use
- * \param cquant chroma quantization table to use
- */
-void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
-                        int width, int height,
-                        const uint32_t *lquant, const uint32_t *cquant) {
-    int i;
-    c->dsp = dsp;
-    for (i = 0; i < 64; i++) {
-        int z = ff_zigzag_direct[i];
-        int p = c->dsp->idct_permutation[i];
-        z = ((z << 3) | (z >> 3)) & 63; // rtjpeg uses a transposed variant
-
-        // permute the scan and quantization tables for the chosen idct
-        c->scan[i] = c->dsp->idct_permutation[z];
-        c->lquant[p] = lquant[i];
-        c->cquant[p] = cquant[i];
-    }
-    c->w = width;
-    c->h = height;
-}
diff --git a/libavcodec/rtjpeg.h b/libavcodec/rtjpeg.h
deleted file mode 100644
index 4bcb9f7..0000000
--- a/libavcodec/rtjpeg.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * RTJpeg decoding functions
- * copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_RTJPEG_H
-#define AVCODEC_RTJPEG_H
-
-#include <stdint.h>
-#include "dsputil.h"
-
-typedef struct {
-    int w, h;
-    DSPContext *dsp;
-    uint8_t scan[64];
-    uint32_t lquant[64];
-    uint32_t cquant[64];
-    DECLARE_ALIGNED(16, DCTELEM, block)[64];
-} RTJpegContext;
-
-void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp,
-                        int width, int height,
-                        const uint32_t *lquant, const uint32_t *cquant);
-
-int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
-                               const uint8_t *buf, int buf_size);
-#endif /* AVCODEC_RTJPEG_H */
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
deleted file mode 100644
index b6ca031..0000000
--- a/libavcodec/rv10.c
+++ /dev/null
@@ -1,736 +0,0 @@
-/*
- * RV10/RV20 decoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV10/RV20 decoder
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mpeg4video.h"
-#include "h263.h"
-
-//#define DEBUG
-
-#define DC_VLC_BITS 14 //FIXME find a better solution
-
-static const uint16_t rv_lum_code[256] =
-{
- 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06,
- 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e,
- 0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16,
- 0x0f17, 0x0f18, 0x0f19, 0x0f1a, 0x0f1b, 0x0f1c, 0x0f1d, 0x0f1e,
- 0x0f1f, 0x0f20, 0x0f21, 0x0f22, 0x0f23, 0x0f24, 0x0f25, 0x0f26,
- 0x0f27, 0x0f28, 0x0f29, 0x0f2a, 0x0f2b, 0x0f2c, 0x0f2d, 0x0f2e,
- 0x0f2f, 0x0f30, 0x0f31, 0x0f32, 0x0f33, 0x0f34, 0x0f35, 0x0f36,
- 0x0f37, 0x0f38, 0x0f39, 0x0f3a, 0x0f3b, 0x0f3c, 0x0f3d, 0x0f3e,
- 0x0f3f, 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0386,
- 0x0387, 0x0388, 0x0389, 0x038a, 0x038b, 0x038c, 0x038d, 0x038e,
- 0x038f, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396,
- 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e,
- 0x039f, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6,
- 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce,
- 0x00cf, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056,
- 0x0057, 0x0020, 0x0021, 0x0022, 0x0023, 0x000c, 0x000d, 0x0004,
- 0x0000, 0x0005, 0x000e, 0x000f, 0x0024, 0x0025, 0x0026, 0x0027,
- 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
- 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
- 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
- 0x03a0, 0x03a1, 0x03a2, 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,
- 0x0f40, 0x0f41, 0x0f42, 0x0f43, 0x0f44, 0x0f45, 0x0f46, 0x0f47,
- 0x0f48, 0x0f49, 0x0f4a, 0x0f4b, 0x0f4c, 0x0f4d, 0x0f4e, 0x0f4f,
- 0x0f50, 0x0f51, 0x0f52, 0x0f53, 0x0f54, 0x0f55, 0x0f56, 0x0f57,
- 0x0f58, 0x0f59, 0x0f5a, 0x0f5b, 0x0f5c, 0x0f5d, 0x0f5e, 0x0f5f,
- 0x0f60, 0x0f61, 0x0f62, 0x0f63, 0x0f64, 0x0f65, 0x0f66, 0x0f67,
- 0x0f68, 0x0f69, 0x0f6a, 0x0f6b, 0x0f6c, 0x0f6d, 0x0f6e, 0x0f6f,
- 0x0f70, 0x0f71, 0x0f72, 0x0f73, 0x0f74, 0x0f75, 0x0f76, 0x0f77,
- 0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f,
-};
-
-static const uint8_t rv_lum_bits[256] =
-{
- 14, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  7,  7,  7,  7,  7,  7,  7,
-  7,  6,  6,  6,  6,  5,  5,  4,
-  2,  4,  5,  5,  6,  6,  6,  6,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
-};
-
-static const uint16_t rv_chrom_code[256] =
-{
- 0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06,
- 0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e,
- 0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16,
- 0x3f17, 0x3f18, 0x3f19, 0x3f1a, 0x3f1b, 0x3f1c, 0x3f1d, 0x3f1e,
- 0x3f1f, 0x3f20, 0x3f21, 0x3f22, 0x3f23, 0x3f24, 0x3f25, 0x3f26,
- 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, 0x3f2d, 0x3f2e,
- 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, 0x3f35, 0x3f36,
- 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, 0x3f3d, 0x3f3e,
- 0x3f3f, 0x0f80, 0x0f81, 0x0f82, 0x0f83, 0x0f84, 0x0f85, 0x0f86,
- 0x0f87, 0x0f88, 0x0f89, 0x0f8a, 0x0f8b, 0x0f8c, 0x0f8d, 0x0f8e,
- 0x0f8f, 0x0f90, 0x0f91, 0x0f92, 0x0f93, 0x0f94, 0x0f95, 0x0f96,
- 0x0f97, 0x0f98, 0x0f99, 0x0f9a, 0x0f9b, 0x0f9c, 0x0f9d, 0x0f9e,
- 0x0f9f, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6,
- 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce,
- 0x03cf, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6,
- 0x00e7, 0x0030, 0x0031, 0x0032, 0x0033, 0x0008, 0x0009, 0x0002,
- 0x0000, 0x0003, 0x000a, 0x000b, 0x0034, 0x0035, 0x0036, 0x0037,
- 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
- 0x03d0, 0x03d1, 0x03d2, 0x03d3, 0x03d4, 0x03d5, 0x03d6, 0x03d7,
- 0x03d8, 0x03d9, 0x03da, 0x03db, 0x03dc, 0x03dd, 0x03de, 0x03df,
- 0x0fa0, 0x0fa1, 0x0fa2, 0x0fa3, 0x0fa4, 0x0fa5, 0x0fa6, 0x0fa7,
- 0x0fa8, 0x0fa9, 0x0faa, 0x0fab, 0x0fac, 0x0fad, 0x0fae, 0x0faf,
- 0x0fb0, 0x0fb1, 0x0fb2, 0x0fb3, 0x0fb4, 0x0fb5, 0x0fb6, 0x0fb7,
- 0x0fb8, 0x0fb9, 0x0fba, 0x0fbb, 0x0fbc, 0x0fbd, 0x0fbe, 0x0fbf,
- 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, 0x3f45, 0x3f46, 0x3f47,
- 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, 0x3f4d, 0x3f4e, 0x3f4f,
- 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, 0x3f55, 0x3f56, 0x3f57,
- 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, 0x3f5d, 0x3f5e, 0x3f5f,
- 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, 0x3f65, 0x3f66, 0x3f67,
- 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f,
- 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77,
- 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f,
-};
-
-static const uint8_t rv_chrom_bits[256] =
-{
- 16, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10,  8,  8,  8,  8,  8,  8,  8,
-  8,  6,  6,  6,  6,  4,  4,  3,
-  2,  3,  4,  4,  6,  6,  6,  6,
-  8,  8,  8,  8,  8,  8,  8,  8,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
-};
-
-static VLC rv_dc_lum, rv_dc_chrom;
-
-int rv_decode_dc(MpegEncContext *s, int n)
-{
-    int code;
-
-    if (n < 4) {
-        code = get_vlc2(&s->gb, rv_dc_lum.table, DC_VLC_BITS, 2);
-        if (code < 0) {
-            /* XXX: I don't understand why they use LONGER codes than
-               necessary. The following code would be completely useless
-               if they had thought about it !!! */
-            code = get_bits(&s->gb, 7);
-            if (code == 0x7c) {
-                code = (int8_t)(get_bits(&s->gb, 7) + 1);
-            } else if (code == 0x7d) {
-                code = -128 + get_bits(&s->gb, 7);
-            } else if (code == 0x7e) {
-                if (get_bits1(&s->gb) == 0)
-                    code = (int8_t)(get_bits(&s->gb, 8) + 1);
-                else
-                    code = (int8_t)(get_bits(&s->gb, 8));
-            } else if (code == 0x7f) {
-                skip_bits(&s->gb, 11);
-                code = 1;
-            }
-        } else {
-            code -= 128;
-        }
-    } else {
-        code = get_vlc2(&s->gb, rv_dc_chrom.table, DC_VLC_BITS, 2);
-        /* same remark */
-        if (code < 0) {
-            code = get_bits(&s->gb, 9);
-            if (code == 0x1fc) {
-                code = (int8_t)(get_bits(&s->gb, 7) + 1);
-            } else if (code == 0x1fd) {
-                code = -128 + get_bits(&s->gb, 7);
-            } else if (code == 0x1fe) {
-                skip_bits(&s->gb, 9);
-                code = 1;
-            } else {
-                av_log(s->avctx, AV_LOG_ERROR, "chroma dc error\n");
-                return 0xffff;
-            }
-        } else {
-            code -= 128;
-        }
-    }
-    return -code;
-}
-
-/* read RV 1.0 compatible frame header */
-static int rv10_decode_picture_header(MpegEncContext *s)
-{
-    int mb_count, pb_frame, marker, unk, mb_xy;
-
-    marker = get_bits1(&s->gb);
-
-    if (get_bits1(&s->gb))
-        s->pict_type = FF_P_TYPE;
-    else
-        s->pict_type = FF_I_TYPE;
-    if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
-    pb_frame = get_bits1(&s->gb);
-
-    dprintf(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
-
-    if (pb_frame){
-        av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n");
-        return -1;
-    }
-
-    s->qscale = get_bits(&s->gb, 5);
-    if(s->qscale==0){
-        av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n");
-        return -1;
-    }
-
-    if (s->pict_type == FF_I_TYPE) {
-        if (s->rv10_version == 3) {
-            /* specific MPEG like DC coding not used */
-            s->last_dc[0] = get_bits(&s->gb, 8);
-            s->last_dc[1] = get_bits(&s->gb, 8);
-            s->last_dc[2] = get_bits(&s->gb, 8);
-            dprintf(s->avctx, "DC:%d %d %d\n", s->last_dc[0],
-                    s->last_dc[1], s->last_dc[2]);
-        }
-    }
-    /* if multiple packets per frame are sent, the position at which
-       to display the macroblocks is coded here */
-
-    mb_xy= s->mb_x + s->mb_y*s->mb_width;
-    if(show_bits(&s->gb, 12)==0 || (mb_xy && mb_xy < s->mb_num)){
-        s->mb_x = get_bits(&s->gb, 6); /* mb_x */
-        s->mb_y = get_bits(&s->gb, 6); /* mb_y */
-        mb_count = get_bits(&s->gb, 12);
-    } else {
-        s->mb_x = 0;
-        s->mb_y = 0;
-        mb_count = s->mb_width * s->mb_height;
-    }
-    unk= get_bits(&s->gb, 3);   /* ignored */
-    s->f_code = 1;
-    s->unrestricted_mv = 1;
-
-    return mb_count;
-}
-
-static int rv20_decode_picture_header(MpegEncContext *s)
-{
-    int seq, mb_pos, i;
-
-#if 0
-    GetBitContext gb= s->gb;
-    for(i=0; i<64; i++){
-        av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb));
-        if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
-    }
-    av_log(s->avctx, AV_LOG_DEBUG, "\n");
-#endif
-#if 0
-    av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4);
-    for(i=0; i<s->avctx->extradata_size; i++){
-        av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]);
-        if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " ");
-    }
-    av_log(s->avctx, AV_LOG_DEBUG, "\n");
-#endif
-
-    if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){
-        if (get_bits(&s->gb, 3)){
-            av_log(s->avctx, AV_LOG_ERROR, "unknown triplet set\n");
-            return -1;
-        }
-    }
-
-    i= get_bits(&s->gb, 2);
-    switch(i){
-    case 0: s->pict_type= FF_I_TYPE; break;
-    case 1: s->pict_type= FF_I_TYPE; break; //hmm ...
-    case 2: s->pict_type= FF_P_TYPE; break;
-    case 3: s->pict_type= FF_B_TYPE; break;
-    default:
-        av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n");
-        return -1;
-    }
-
-    if(s->last_picture_ptr==NULL && s->pict_type==FF_B_TYPE){
-        av_log(s->avctx, AV_LOG_ERROR, "early B pix\n");
-        return -1;
-    }
-
-    if (get_bits1(&s->gb)){
-        av_log(s->avctx, AV_LOG_ERROR, "unknown bit set\n");
-        return -1;
-    }
-
-    s->qscale = get_bits(&s->gb, 5);
-    if(s->qscale==0){
-        av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n");
-        return -1;
-    }
-    if(s->avctx->sub_id == 0x30203002){
-        if (get_bits1(&s->gb)){
-            av_log(s->avctx, AV_LOG_ERROR, "unknown bit2 set\n");
-            return -1;
-        }
-    }
-
-    if(s->avctx->has_b_frames){
-        int f, new_w, new_h;
-        int v= s->avctx->extradata_size >= 4 ? 7&((uint8_t*)s->avctx->extradata)[1] : 0;
-
-        if (get_bits1(&s->gb)){
-            av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n");
-        }
-        seq= get_bits(&s->gb, 13)<<2;
-
-        f= get_bits(&s->gb, av_log2(v)+1);
-
-        if(f){
-            new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f];
-            new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f];
-        }else{
-            new_w= s->orig_width ;
-            new_h= s->orig_height;
-        }
-        if(new_w != s->width || new_h != s->height){
-            av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h);
-            if (avcodec_check_dimensions(s->avctx, new_w, new_h) < 0)
-                return -1;
-            MPV_common_end(s);
-            avcodec_set_dimensions(s->avctx, new_w, new_h);
-            s->width  = new_w;
-            s->height = new_h;
-            if (MPV_common_init(s) < 0)
-                return -1;
-        }
-
-        if(s->avctx->debug & FF_DEBUG_PICT_INFO){
-            av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", f, v);
-        }
-    }else{
-        seq= get_bits(&s->gb, 8)*128;
-    }
-
-//     if(s->avctx->sub_id <= 0x20201002){ //0x20201002 definitely needs this
-    mb_pos= ff_h263_decode_mba(s);
-/*    }else{
-        mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1);
-        s->mb_x= mb_pos % s->mb_width;
-        s->mb_y= mb_pos / s->mb_width;
-    }*/
-//av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq);
-    seq |= s->time &~0x7FFF;
-    if(seq - s->time >  0x4000) seq -= 0x8000;
-    if(seq - s->time < -0x4000) seq += 0x8000;
-    if(seq != s->time){
-        if(s->pict_type!=FF_B_TYPE){
-            s->time= seq;
-            s->pp_time= s->time - s->last_non_b_time;
-            s->last_non_b_time= s->time;
-        }else{
-            s->time= seq;
-            s->pb_time= s->pp_time - (s->last_non_b_time - s->time);
-            if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){
-                av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n");
-                return FRAME_SKIPPED;
-            }
-            ff_mpeg4_init_direct_mv(s);
-        }
-    }
-//    printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time);
-/*for(i=0; i<32; i++){
-    av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb));
-}
-av_log(s->avctx, AV_LOG_DEBUG, "\n");*/
-    s->no_rounding= get_bits1(&s->gb);
-
-    s->f_code = 1;
-    s->unrestricted_mv = 1;
-    s->h263_aic= s->pict_type == FF_I_TYPE;
-//    s->alt_inter_vlc=1;
-//    s->obmc=1;
-//    s->umvplus=1;
-    s->modified_quant=1;
-    if(!s->avctx->lowres)
-        s->loop_filter=1;
-
-    if(s->avctx->debug & FF_DEBUG_PICT_INFO){
-            av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n",
-                   seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding);
-    }
-
-    assert(s->pict_type != FF_B_TYPE || !s->low_delay);
-
-    return s->mb_width*s->mb_height - mb_pos;
-}
-
-static av_cold int rv10_decode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    static int done=0;
-
-    if (avctx->extradata_size < 8) {
-        av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
-        return -1;
-    }
-
-    MPV_decode_defaults(s);
-
-    s->avctx= avctx;
-    s->out_format = FMT_H263;
-    s->codec_id= avctx->codec_id;
-
-    s->orig_width = s->width  = avctx->coded_width;
-    s->orig_height= s->height = avctx->coded_height;
-
-    s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1;
-    avctx->sub_id= AV_RB32((uint8_t*)avctx->extradata + 4);
-
-    if (avctx->sub_id == 0x10000000) {
-        s->rv10_version= 0;
-        s->low_delay=1;
-    } else if (avctx->sub_id == 0x10001000) {
-        s->rv10_version= 3;
-        s->low_delay=1;
-    } else if (avctx->sub_id == 0x10002000) {
-        s->rv10_version= 3;
-        s->low_delay=1;
-        s->obmc=1;
-    } else if (avctx->sub_id == 0x10003000) {
-        s->rv10_version= 3;
-        s->low_delay=1;
-    } else if (avctx->sub_id == 0x10003001) {
-        s->rv10_version= 3;
-        s->low_delay=1;
-    } else if (    avctx->sub_id == 0x20001000
-               || (avctx->sub_id >= 0x20100000 && avctx->sub_id < 0x201a0000)) {
-        s->low_delay=1;
-    } else if (    avctx->sub_id == 0x30202002
-               ||  avctx->sub_id == 0x30203002
-               || (avctx->sub_id >= 0x20200002 && avctx->sub_id < 0x20300000)) {
-        s->low_delay=0;
-        s->avctx->has_b_frames=1;
-    } else
-        av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id);
-
-    if(avctx->debug & FF_DEBUG_PICT_INFO){
-        av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", avctx->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1);
-    }
-
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-
-    if (MPV_common_init(s) < 0)
-        return -1;
-
-    h263_decode_init_vlc(s);
-
-    /* init rv vlc */
-    if (!done) {
-        INIT_VLC_STATIC(&rv_dc_lum, DC_VLC_BITS, 256,
-                 rv_lum_bits, 1, 1,
-                 rv_lum_code, 2, 2, 16384);
-        INIT_VLC_STATIC(&rv_dc_chrom, DC_VLC_BITS, 256,
-                 rv_chrom_bits, 1, 1,
-                 rv_chrom_code, 2, 2, 16388);
-        done = 1;
-    }
-
-    return 0;
-}
-
-static av_cold int rv10_decode_end(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    MPV_common_end(s);
-    return 0;
-}
-
-static int rv10_decode_packet(AVCodecContext *avctx,
-                             const uint8_t *buf, int buf_size, int buf_size2)
-{
-    MpegEncContext *s = avctx->priv_data;
-    int mb_count, mb_pos, left, start_mb_x;
-
-    init_get_bits(&s->gb, buf, buf_size*8);
-    if(s->codec_id ==CODEC_ID_RV10)
-        mb_count = rv10_decode_picture_header(s);
-    else
-        mb_count = rv20_decode_picture_header(s);
-    if (mb_count < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n");
-        return -1;
-    }
-
-    if (s->mb_x >= s->mb_width ||
-        s->mb_y >= s->mb_height) {
-        av_log(s->avctx, AV_LOG_ERROR, "POS ERROR %d %d\n", s->mb_x, s->mb_y);
-        return -1;
-    }
-    mb_pos = s->mb_y * s->mb_width + s->mb_x;
-    left = s->mb_width * s->mb_height - mb_pos;
-    if (mb_count > left) {
-        av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n");
-        return -1;
-    }
-
-    if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
-        if(s->current_picture_ptr){ //FIXME write parser so we always have complete frames?
-            ff_er_frame_end(s);
-            MPV_frame_end(s);
-            s->mb_x= s->mb_y = s->resync_mb_x = s->resync_mb_y= 0;
-        }
-        if(MPV_frame_start(s, avctx) < 0)
-            return -1;
-        ff_er_frame_start(s);
-    }
-
-    dprintf(avctx, "qscale=%d\n", s->qscale);
-
-    /* default quantization values */
-    if(s->codec_id== CODEC_ID_RV10){
-        if(s->mb_y==0) s->first_slice_line=1;
-    }else{
-        s->first_slice_line=1;
-        s->resync_mb_x= s->mb_x;
-    }
-    start_mb_x= s->mb_x;
-    s->resync_mb_y= s->mb_y;
-    if(s->h263_aic){
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_aic_dc_scale_table;
-    }else{
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-    }
-
-    if(s->modified_quant)
-        s->chroma_qscale_table= ff_h263_chroma_qscale_table;
-
-    ff_set_qscale(s, s->qscale);
-
-    s->rv10_first_dc_coded[0] = 0;
-    s->rv10_first_dc_coded[1] = 0;
-    s->rv10_first_dc_coded[2] = 0;
-    s->block_wrap[0]=
-    s->block_wrap[1]=
-    s->block_wrap[2]=
-    s->block_wrap[3]= s->b8_stride;
-    s->block_wrap[4]=
-    s->block_wrap[5]= s->mb_stride;
-    ff_init_block_index(s);
-    /* decode each macroblock */
-
-    for(s->mb_num_left= mb_count; s->mb_num_left>0; s->mb_num_left--) {
-        int ret;
-        ff_update_block_index(s);
-        dprintf(avctx, "**mb x=%d y=%d\n", s->mb_x, s->mb_y);
-
-        s->mv_dir = MV_DIR_FORWARD;
-        s->mv_type = MV_TYPE_16X16;
-        ret=ff_h263_decode_mb(s, s->block);
-
-        if (ret != SLICE_ERROR && s->gb.size_in_bits < get_bits_count(&s->gb) && 8*buf_size2 >= get_bits_count(&s->gb)){
-            av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", s->gb.size_in_bits, 8*buf_size2);
-            s->gb.size_in_bits= 8*buf_size2;
-            ret= SLICE_OK;
-        }
-
-        if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) {
-            av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        if(s->pict_type != FF_B_TYPE)
-            ff_h263_update_motion_val(s);
-        MPV_decode_mb(s, s->block);
-        if(s->loop_filter)
-            ff_h263_loop_filter(s);
-
-        if (++s->mb_x == s->mb_width) {
-            s->mb_x = 0;
-            s->mb_y++;
-            ff_init_block_index(s);
-        }
-        if(s->mb_x == s->resync_mb_x)
-            s->first_slice_line=0;
-        if(ret == SLICE_END) break;
-    }
-
-    ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
-
-    return s->gb.size_in_bits;
-}
-
-static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
-{
-    if(avctx->slice_count) return avctx->slice_offset[n];
-    else                   return AV_RL32(buf + n*8);
-}
-
-static int rv10_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MpegEncContext *s = avctx->priv_data;
-    int i;
-    AVFrame *pict = data;
-    int slice_count;
-    const uint8_t *slices_hdr = NULL;
-
-    dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);
-
-    /* no supplementary picture */
-    if (buf_size == 0) {
-        return 0;
-    }
-
-    if(!avctx->slice_count){
-        slice_count = (*buf++) + 1;
-        slices_hdr = buf + 4;
-        buf += 8 * slice_count;
-    }else
-        slice_count = avctx->slice_count;
-
-    for(i=0; i<slice_count; i++){
-        int offset= get_slice_offset(avctx, slices_hdr, i);
-        int size, size2;
-
-        if(i+1 == slice_count)
-            size= buf_size - offset;
-        else
-            size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
-
-        if(i+2 >= slice_count)
-            size2= buf_size - offset;
-        else
-            size2= get_slice_offset(avctx, slices_hdr, i+2) - offset;
-
-        if(rv10_decode_packet(avctx, buf+offset, size, size2) > 8*size)
-            i++;
-    }
-
-    if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){
-        ff_er_frame_end(s);
-        MPV_frame_end(s);
-
-        if (s->pict_type == FF_B_TYPE || s->low_delay) {
-            *pict= *(AVFrame*)s->current_picture_ptr;
-        } else if (s->last_picture_ptr != NULL) {
-            *pict= *(AVFrame*)s->last_picture_ptr;
-        }
-
-        if(s->last_picture_ptr || s->low_delay){
-            *data_size = sizeof(AVFrame);
-            ff_print_debug_info(s, pict);
-        }
-        s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...)
-    }
-
-    return buf_size;
-}
-
-AVCodec rv10_decoder = {
-    "rv10",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RV10,
-    sizeof(MpegEncContext),
-    rv10_decode_init,
-    NULL,
-    rv10_decode_end,
-    rv10_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
-
-AVCodec rv20_decoder = {
-    "rv20",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RV20,
-    sizeof(MpegEncContext),
-    rv10_decode_init,
-    NULL,
-    rv10_decode_end,
-    rv10_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    .flush= ff_mpeg_flush,
-    .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c
deleted file mode 100644
index 51ca691..0000000
--- a/libavcodec/rv10enc.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * RV10 encoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV10 encoder
- */
-
-#include "mpegvideo.h"
-#include "put_bits.h"
-
-void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
-{
-    int full_frame= 0;
-
-    align_put_bits(&s->pb);
-
-    put_bits(&s->pb, 1, 1);     /* marker */
-
-    put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE));
-
-    put_bits(&s->pb, 1, 0);     /* not PB frame */
-
-    put_bits(&s->pb, 5, s->qscale);
-
-    if (s->pict_type == FF_I_TYPE) {
-        /* specific MPEG like DC coding not used */
-    }
-    /* if multiple packets per frame are sent, the position at which
-       to display the macroblocks is coded here */
-    if(!full_frame){
-        put_bits(&s->pb, 6, 0); /* mb_x */
-        put_bits(&s->pb, 6, 0); /* mb_y */
-        put_bits(&s->pb, 12, s->mb_width * s->mb_height);
-    }
-
-    put_bits(&s->pb, 3, 0);     /* ignored */
-}
-
-AVCodec rv10_encoder = {
-    "rv10",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RV10,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
-};
diff --git a/libavcodec/rv20enc.c b/libavcodec/rv20enc.c
deleted file mode 100644
index 5ab0b9a..0000000
--- a/libavcodec/rv20enc.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * RV20 encoder
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV20 encoder
- */
-
-#include "mpegvideo.h"
-#include "h263.h"
-#include "put_bits.h"
-
-void rv20_encode_picture_header(MpegEncContext *s, int picture_number){
-    put_bits(&s->pb, 2, s->pict_type); //I 0 vs. 1 ?
-    put_bits(&s->pb, 1, 0);     /* unknown bit */
-    put_bits(&s->pb, 5, s->qscale);
-
-    put_sbits(&s->pb, 8, picture_number); //FIXME wrong, but correct is not known
-    s->mb_x= s->mb_y= 0;
-    ff_h263_encode_mba(s);
-
-    put_bits(&s->pb, 1, s->no_rounding);
-
-    assert(s->f_code == 1);
-    assert(s->unrestricted_mv == 1);
-    assert(s->alt_inter_vlc == 0);
-    assert(s->umvplus == 0);
-    assert(s->modified_quant==1);
-    assert(s->loop_filter==1);
-
-    s->h263_aic= s->pict_type == FF_I_TYPE;
-    if(s->h263_aic){
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_aic_dc_scale_table;
-    }else{
-        s->y_dc_scale_table=
-        s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-    }
-}
-
-AVCodec rv20_encoder = {
-    "rv20",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RV20,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
-};
diff --git a/libavcodec/rv30.c b/libavcodec/rv30.c
deleted file mode 100644
index 22a5dd5..0000000
--- a/libavcodec/rv30.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * RV30 decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV30 decoder
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "golomb.h"
-
-#include "rv34.h"
-#include "rv30data.h"
-
-
-static int rv30_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceInfo *si)
-{
-    int mb_bits;
-    int w = r->s.width, h = r->s.height;
-    int mb_size;
-    int rpr;
-
-    memset(si, 0, sizeof(SliceInfo));
-    if(get_bits(gb, 3))
-        return -1;
-    si->type = get_bits(gb, 2);
-    if(si->type == 1) si->type = 0;
-    if(get_bits1(gb))
-        return -1;
-    si->quant = get_bits(gb, 5);
-    skip_bits1(gb);
-    si->pts = get_bits(gb, 13);
-    rpr = get_bits(gb, r->rpr);
-    if(rpr){
-        w = r->s.avctx->extradata[6 + rpr*2] << 2;
-        h = r->s.avctx->extradata[7 + rpr*2] << 2;
-    }
-    si->width  = w;
-    si->height = h;
-    mb_size = ((w + 15) >> 4) * ((h + 15) >> 4);
-    mb_bits = ff_rv34_get_start_offset(gb, mb_size);
-    si->start = get_bits(gb, mb_bits);
-    skip_bits1(gb);
-    return 0;
-}
-
-/**
- * Decode 4x4 intra types array.
- */
-static int rv30_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)
-{
-    int i, j, k;
-
-    for(i = 0; i < 4; i++, dst += r->intra_types_stride - 4){
-        for(j = 0; j < 4; j+= 2){
-            int code = svq3_get_ue_golomb(gb) << 1;
-            if(code >= 81*2){
-                av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction code\n");
-                return -1;
-            }
-            for(k = 0; k < 2; k++){
-                int A = dst[-r->intra_types_stride] + 1;
-                int B = dst[-1] + 1;
-                *dst++ = rv30_itype_from_context[A * 90 + B * 9 + rv30_itype_code[code + k]];
-                if(dst[-1] == 9){
-                    av_log(r->s.avctx, AV_LOG_ERROR, "Incorrect intra prediction mode\n");
-                    return -1;
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-/**
- * Decode macroblock information.
- */
-static int rv30_decode_mb_info(RV34DecContext *r)
-{
-    static const int rv30_p_types[6] = { RV34_MB_SKIP, RV34_MB_P_16x16, RV34_MB_P_8x8, -1, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
-    static const int rv30_b_types[6] = { RV34_MB_SKIP, RV34_MB_B_DIRECT, RV34_MB_B_FORWARD, RV34_MB_B_BACKWARD, RV34_MB_TYPE_INTRA, RV34_MB_TYPE_INTRA16x16 };
-    MpegEncContext *s = &r->s;
-    GetBitContext *gb = &s->gb;
-    int code = svq3_get_ue_golomb(gb);
-
-    if(code > 11){
-        av_log(s->avctx, AV_LOG_ERROR, "Incorrect MB type code\n");
-        return -1;
-    }
-    if(code > 5){
-        av_log(s->avctx, AV_LOG_ERROR, "dquant needed\n");
-        code -= 6;
-    }
-    if(s->pict_type != FF_B_TYPE)
-        return rv30_p_types[code];
-    else
-        return rv30_b_types[code];
-}
-
-static inline void rv30_weak_loop_filter(uint8_t *src, const int step,
-                                         const int stride, const int lim)
-{
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int i, diff;
-
-    for(i = 0; i < 4; i++){
-        diff = ((src[-2*step] - src[1*step]) - (src[-1*step] - src[0*step])*4) >> 3;
-        diff = av_clip(diff, -lim, lim);
-        src[-1*step] = cm[src[-1*step] + diff];
-        src[ 0*step] = cm[src[ 0*step] - diff];
-        src += stride;
-    }
-}
-
-static void rv30_loop_filter(RV34DecContext *r, int row)
-{
-    MpegEncContext *s = &r->s;
-    int mb_pos, mb_x;
-    int i, j, k;
-    uint8_t *Y, *C;
-    int loc_lim, cur_lim, left_lim = 0, top_lim = 0;
-
-    mb_pos = row * s->mb_stride;
-    for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
-        int mbtype = s->current_picture_ptr->mb_type[mb_pos];
-        if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
-            r->deblock_coefs[mb_pos] = 0xFFFF;
-        if(IS_INTRA(mbtype))
-            r->cbp_chroma[mb_pos] = 0xFF;
-    }
-
-    /* all vertical edges are filtered first
-     * and horizontal edges are filtered on the next iteration
-     */
-    mb_pos = row * s->mb_stride;
-    for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
-        cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]];
-        if(mb_x)
-            left_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - 1]];
-        for(j = 0; j < 16; j += 4){
-            Y = s->current_picture_ptr->data[0] + mb_x*16 + (row*16 + j) * s->linesize + 4 * !mb_x;
-            for(i = !mb_x; i < 4; i++, Y += 4){
-                int ij = i + j;
-                loc_lim = 0;
-                if(r->deblock_coefs[mb_pos] & (1 << ij))
-                    loc_lim = cur_lim;
-                else if(!i && r->deblock_coefs[mb_pos - 1] & (1 << (ij + 3)))
-                    loc_lim = left_lim;
-                else if( i && r->deblock_coefs[mb_pos]     & (1 << (ij - 1)))
-                    loc_lim = cur_lim;
-                if(loc_lim)
-                    rv30_weak_loop_filter(Y, 1, s->linesize, loc_lim);
-            }
-        }
-        for(k = 0; k < 2; k++){
-            int cur_cbp, left_cbp = 0;
-            cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF;
-            if(mb_x)
-                left_cbp = (r->cbp_chroma[mb_pos - 1] >> (k*4)) & 0xF;
-            for(j = 0; j < 8; j += 4){
-                C = s->current_picture_ptr->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize + 4 * !mb_x;
-                for(i = !mb_x; i < 2; i++, C += 4){
-                    int ij = i + (j >> 1);
-                    loc_lim = 0;
-                    if(cur_cbp && (1 << ij))
-                        loc_lim = cur_lim;
-                    else if(!i && left_cbp & (1 << (ij + 1)))
-                        loc_lim = left_lim;
-                    else if( i && cur_cbp  & (1 << (ij - 1)))
-                        loc_lim = cur_lim;
-                    if(loc_lim)
-                        rv30_weak_loop_filter(C, 1, s->uvlinesize, loc_lim);
-                }
-            }
-        }
-    }
-    mb_pos = row * s->mb_stride;
-    for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
-        cur_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos]];
-        if(row)
-            top_lim = rv30_loop_filt_lim[s->current_picture_ptr->qscale_table[mb_pos - s->mb_stride]];
-        for(j = 4*!row; j < 16; j += 4){
-            Y = s->current_picture_ptr->data[0] + mb_x*16 + (row*16 + j) * s->linesize;
-            for(i = 0; i < 4; i++, Y += 4){
-                int ij = i + j;
-                loc_lim = 0;
-                if(r->deblock_coefs[mb_pos] & (1 << ij))
-                    loc_lim = cur_lim;
-                else if(!j && r->deblock_coefs[mb_pos - s->mb_stride] & (1 << (ij + 12)))
-                    loc_lim = top_lim;
-                else if( j && r->deblock_coefs[mb_pos]                & (1 << (ij - 4)))
-                    loc_lim = cur_lim;
-                if(loc_lim)
-                    rv30_weak_loop_filter(Y, s->linesize, 1, loc_lim);
-            }
-        }
-        for(k = 0; k < 2; k++){
-            int cur_cbp, top_cbp = 0;
-            cur_cbp = (r->cbp_chroma[mb_pos] >> (k*4)) & 0xF;
-            if(row)
-                top_cbp = (r->cbp_chroma[mb_pos - s->mb_stride] >> (k*4)) & 0xF;
-            for(j = 4*!row; j < 8; j += 4){
-                C = s->current_picture_ptr->data[k+1] + mb_x*8 + (row*8 + j) * s->uvlinesize;
-                for(i = 0; i < 2; i++, C += 4){
-                    int ij = i + (j >> 1);
-                    loc_lim = 0;
-                    if(r->cbp_chroma[mb_pos] && (1 << ij))
-                        loc_lim = cur_lim;
-                    else if(!j && top_cbp & (1 << (ij + 2)))
-                        loc_lim = top_lim;
-                    else if( j && cur_cbp & (1 << (ij - 2)))
-                        loc_lim = cur_lim;
-                    if(loc_lim)
-                        rv30_weak_loop_filter(C, s->uvlinesize, 1, loc_lim);
-                }
-            }
-        }
-    }
-}
-
-/**
- * Initialize decoder.
- */
-static av_cold int rv30_decode_init(AVCodecContext *avctx)
-{
-    RV34DecContext *r = avctx->priv_data;
-
-    r->rv30 = 1;
-    ff_rv34_decode_init(avctx);
-    if(avctx->extradata_size < 2){
-        av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n");
-        return -1;
-    }
-    r->rpr = (avctx->extradata[1] & 7) >> 1;
-    r->rpr = FFMIN(r->rpr + 1, 3);
-    if(avctx->extradata_size - 8 < (r->rpr - 1) * 2){
-        av_log(avctx, AV_LOG_ERROR, "Insufficient extradata - need at least %d bytes, got %d\n",
-               6 + r->rpr * 2, avctx->extradata_size);
-    }
-    r->parse_slice_header = rv30_parse_slice_header;
-    r->decode_intra_types = rv30_decode_intra_types;
-    r->decode_mb_info     = rv30_decode_mb_info;
-    r->loop_filter        = rv30_loop_filter;
-    r->luma_dc_quant_i = rv30_luma_dc_quant;
-    r->luma_dc_quant_p = rv30_luma_dc_quant;
-    return 0;
-}
-
-AVCodec rv30_decoder = {
-    "rv30",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RV30,
-    sizeof(RV34DecContext),
-    rv30_decode_init,
-    NULL,
-    ff_rv34_decode_end,
-    ff_rv34_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    .flush = ff_mpeg_flush,
-    .long_name = NULL_IF_CONFIG_SMALL("RealVideo 3.0"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
diff --git a/libavcodec/rv30data.h b/libavcodec/rv30data.h
deleted file mode 100644
index 9cc48a6..0000000
--- a/libavcodec/rv30data.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * RealVideo 3 decoder
- * copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * miscellaneous RV30 tables
- */
-
-#ifndef AVCODEC_RV30DATA_H
-#define AVCODEC_RV30DATA_H
-
-#include <stdint.h>
-
-/** DC quantizer mapping for RV30 */
-static const uint8_t rv30_luma_dc_quant[32] = {
-     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-    16, 17, 18, 19, 20, 21, 22, 22, 22, 23, 23, 23, 24, 24, 25, 25
-};
-
-/**
- * This table is used for storing the differences
- * between the predicted and the real intra type.
- */
-static const uint8_t rv30_itype_code[9*9*2] = {
-    0, 0, 0, 1, 1, 0, 1, 1, 0, 2, 2, 0, 0, 3, 3, 0, 1, 2,
-    2, 1, 0, 4, 4, 0, 3, 1, 1, 3, 0, 5, 5, 0, 2, 2, 1, 4,
-    4, 1, 0, 6, 3, 2, 1, 5, 2, 3, 5, 1, 6, 0, 0, 7, 4, 2,
-    2, 4, 3, 3, 6, 1, 1, 6, 7, 0, 0, 8, 5, 2, 4, 3, 2, 5,
-    3, 4, 1, 7, 4, 4, 7, 1, 8, 0, 6, 2, 3, 5, 5, 3, 2, 6,
-    1, 8, 2, 7, 7, 2, 8, 1, 5, 4, 4, 5, 3, 6, 6, 3, 8, 2,
-    4, 6, 5, 5, 6, 4, 2, 8, 7, 3, 3, 7, 6, 5, 5, 6, 7, 4,
-    4, 7, 8, 3, 3, 8, 7, 5, 8, 4, 5, 7, 4, 8, 6, 6, 7, 6,
-    5, 8, 8, 5, 6, 7, 8, 6, 7, 7, 6, 8, 8, 7, 7, 8, 8, 8,
-};
-
-/**
- * This table is used for retrieving the current intra type
- * based on its neighbors and adjustment provided by
- * code read and decoded before.
- *
- * This is really a three-dimensional matrix with dimensions
- * [-1..9][-1..9][0..9]. The first and second coordinates are
- * detemined by the top and left neighbors (-1 if unavailable).
- */
-static const uint8_t rv30_itype_from_context[900] = {
-    0, 9, 9, 9, 9, 9, 9, 9, 9,
-    0, 2, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    2, 0, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-
-    0, 1, 9, 9, 9, 9, 9, 9, 9,
-    0, 2, 1, 6, 4, 8, 5, 7, 3,
-    1, 0, 2, 6, 5, 4, 3, 8, 7,
-    2, 8, 0, 1, 7, 4, 3, 6, 5,
-    2, 0, 1, 3, 8, 5, 4, 7, 6,
-    2, 0, 1, 4, 6, 7, 8, 3, 5,
-    0, 1, 5, 2, 6, 3, 8, 4, 7,
-    0, 1, 6, 2, 4, 7, 5, 8, 3,
-    2, 7, 0, 1, 4, 8, 6, 3, 5,
-    2, 8, 0, 1, 7, 3, 4, 5, 6,
-
-    1, 0, 9, 9, 9, 9, 9, 9, 9,
-    1, 2, 5, 6, 3, 0, 4, 8, 7,
-    1, 6, 2, 5, 3, 0, 4, 8, 7,
-    2, 1, 7, 6, 8, 3, 5, 0, 4,
-    1, 2, 5, 3, 6, 8, 4, 7, 0,
-    1, 6, 2, 0, 4, 5, 8, 7, 3,
-    1, 5, 2, 6, 3, 8, 4, 0, 7,
-    1, 6, 0, 2, 4, 5, 7, 3, 8,
-    2, 1, 7, 6, 0, 8, 5, 4, 3,
-    1, 2, 7, 8, 3, 4, 5, 6, 0,
-
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    0, 2, 1, 8, 7, 6, 5, 4, 3,
-    1, 2, 0, 6, 5, 7, 4, 8, 3,
-    2, 8, 7, 1, 0, 6, 4, 3, 5,
-    2, 0, 8, 1, 3, 7, 5, 4, 6,
-    2, 0, 4, 1, 7, 8, 6, 3, 5,
-    2, 0, 1, 5, 8, 4, 6, 7, 3,
-    2, 0, 6, 1, 4, 7, 8, 5, 3,
-    2, 7, 8, 1, 0, 5, 4, 6, 3,
-    2, 8, 7, 1, 0, 4, 3, 6, 5,
-
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    0, 2, 1, 3, 5, 8, 6, 4, 7,
-    1, 0, 2, 5, 3, 6, 4, 8, 7,
-    2, 8, 1, 0, 3, 5, 7, 6, 4,
-    3, 2, 5, 8, 1, 4, 6, 7, 0,
-    4, 2, 0, 6, 1, 5, 8, 3, 7,
-    5, 3, 1, 2, 8, 6, 4, 0, 7,
-    1, 6, 0, 2, 4, 5, 8, 3, 7,
-    2, 7, 0, 1, 5, 4, 8, 6, 3,
-    2, 8, 3, 5, 1, 0, 7, 6, 4,
-
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    2, 0, 6, 1, 4, 7, 5, 8, 3,
-    1, 6, 2, 0, 4, 5, 3, 7, 8,
-    2, 8, 7, 6, 4, 0, 1, 5, 3,
-    4, 2, 1, 0, 6, 8, 3, 5, 7,
-    4, 2, 6, 0, 1, 5, 7, 8, 3,
-    1, 2, 5, 0, 6, 3, 4, 7, 8,
-    6, 4, 0, 1, 2, 7, 5, 3, 8,
-    2, 7, 4, 6, 0, 1, 8, 5, 3,
-    2, 8, 7, 4, 6, 1, 3, 5, 0,
-
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    5, 1, 2, 3, 6, 8, 0, 4, 7,
-    1, 5, 6, 3, 2, 0, 4, 8, 7,
-    2, 1, 5, 3, 6, 8, 7, 4, 0,
-    5, 3, 1, 2, 6, 8, 4, 7, 0,
-    1, 6, 2, 4, 5, 8, 0, 3, 7,
-    5, 1, 3, 6, 2, 0, 8, 4, 7,
-    1, 6, 5, 2, 0, 4, 3, 7, 8,
-    2, 7, 1, 6, 5, 0, 8, 3, 4,
-    2, 5, 1, 3, 6, 8, 4, 0, 7,
-
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    1, 6, 2, 0, 5, 4, 3, 7, 8,
-    1, 6, 5, 4, 2, 3, 0, 7, 8,
-    2, 1, 6, 7, 4, 8, 5, 3, 0,
-    2, 1, 6, 5, 8, 4, 3, 0, 7,
-    6, 4, 1, 2, 0, 5, 7, 8, 3,
-    1, 6, 5, 2, 3, 0, 4, 8, 7,
-    6, 1, 4, 0, 2, 7, 5, 3, 8,
-    2, 7, 4, 6, 1, 5, 0, 8, 3,
-    2, 1, 6, 8, 4, 7, 3, 5, 0,
-
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    2, 0, 4, 7, 6, 1, 8, 5, 3,
-    6, 1, 2, 0, 4, 7, 5, 8, 3,
-    2, 7, 8, 0, 1, 6, 4, 3, 5,
-    2, 4, 0, 8, 3, 1, 7, 6, 5,
-    4, 2, 7, 0, 6, 1, 8, 5, 3,
-    2, 1, 0, 8, 5, 6, 7, 4, 3,
-    2, 6, 4, 1, 7, 0, 5, 8, 3,
-    2, 7, 4, 0, 8, 6, 1, 5, 3,
-    2, 8, 7, 4, 1, 0, 3, 6, 5,
-
-    9, 9, 9, 9, 9, 9, 9, 9, 9,
-    2, 0, 8, 1, 3, 4, 6, 5, 7,
-    1, 2, 0, 6, 8, 5, 7, 3, 4,
-    2, 8, 7, 1, 0, 3, 6, 5, 4,
-    8, 3, 2, 5, 1, 0, 4, 7, 6,
-    2, 0, 4, 8, 5, 1, 7, 6, 3,
-    2, 1, 0, 8, 5, 3, 6, 4, 7,
-    2, 1, 6, 0, 8, 4, 5, 7, 3,
-    2, 7, 8, 4, 0, 6, 1, 5, 3,
-    2, 8, 3, 0, 7, 4, 1, 6, 5,
-};
-
-/**
- * Loop filter limits are taken from this table.
- */
-static const uint8_t rv30_loop_filt_lim[32] = {
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5
-};
-#endif /* AVCODEC_RV30DATA_H */
diff --git a/libavcodec/rv30dsp.c b/libavcodec/rv30dsp.c
deleted file mode 100644
index 4700e78..0000000
--- a/libavcodec/rv30dsp.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * RV30 decoder motion compensation functions
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV30 decoder motion compensation functions
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-#define RV30_LOWPASS(OPNAME, OP) \
-static av_unused void OPNAME ## rv30_tpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
-    const int h=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[0], (-(src[-1]+src[2]) + src[0]*C1 + src[1]*C2 + 8)>>4);\
-        OP(dst[1], (-(src[ 0]+src[3]) + src[1]*C1 + src[2]*C2 + 8)>>4);\
-        OP(dst[2], (-(src[ 1]+src[4]) + src[2]*C1 + src[3]*C2 + 8)>>4);\
-        OP(dst[3], (-(src[ 2]+src[5]) + src[3]*C1 + src[4]*C2 + 8)>>4);\
-        OP(dst[4], (-(src[ 3]+src[6]) + src[4]*C1 + src[5]*C2 + 8)>>4);\
-        OP(dst[5], (-(src[ 4]+src[7]) + src[5]*C1 + src[6]*C2 + 8)>>4);\
-        OP(dst[6], (-(src[ 5]+src[8]) + src[6]*C1 + src[7]*C2 + 8)>>4);\
-        OP(dst[7], (-(src[ 6]+src[9]) + src[7]*C1 + src[8]*C2 + 8)>>4);\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## rv30_tpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
-    const int w=8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<w; i++)\
-    {\
-        const int srcA= src[-1*srcStride];\
-        const int src0= src[0 *srcStride];\
-        const int src1= src[1 *srcStride];\
-        const int src2= src[2 *srcStride];\
-        const int src3= src[3 *srcStride];\
-        const int src4= src[4 *srcStride];\
-        const int src5= src[5 *srcStride];\
-        const int src6= src[6 *srcStride];\
-        const int src7= src[7 *srcStride];\
-        const int src8= src[8 *srcStride];\
-        const int src9= src[9 *srcStride];\
-        OP(dst[0*dstStride], (-(srcA+src2) + src0*C1 + src1*C2 + 8)>>4);\
-        OP(dst[1*dstStride], (-(src0+src3) + src1*C1 + src2*C2 + 8)>>4);\
-        OP(dst[2*dstStride], (-(src1+src4) + src2*C1 + src3*C2 + 8)>>4);\
-        OP(dst[3*dstStride], (-(src2+src5) + src3*C1 + src4*C2 + 8)>>4);\
-        OP(dst[4*dstStride], (-(src3+src6) + src4*C1 + src5*C2 + 8)>>4);\
-        OP(dst[5*dstStride], (-(src4+src7) + src5*C1 + src6*C2 + 8)>>4);\
-        OP(dst[6*dstStride], (-(src5+src8) + src6*C1 + src7*C2 + 8)>>4);\
-        OP(dst[7*dstStride], (-(src6+src9) + src7*C1 + src8*C2 + 8)>>4);\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static void OPNAME ## rv30_tpel8_hv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w = 8;\
-    const int h = 8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i, j;\
-    for(j = 0; j < h; j++){\
-        for(i = 0; i < w; i++){\
-            OP(dst[i], (\
-                  src[srcStride*-1+i-1]  -12*src[srcStride*-1+i]  -6*src[srcStride*-1+i+1]    +src[srcStride*-1+i+2]+\
-              -12*src[srcStride* 0+i-1] +144*src[srcStride* 0+i] +72*src[srcStride* 0+i+1] -12*src[srcStride* 0+i+2] +\
-               -6*src[srcStride* 1+i-1]  +72*src[srcStride* 1+i] +36*src[srcStride* 1+i+1]  -6*src[srcStride* 1+i+2] +\
-                  src[srcStride* 2+i-1]  -12*src[srcStride* 2+i]  -6*src[srcStride* 2+i+1]    +src[srcStride* 2+i+2] +\
-                  128)>>8);\
-        }\
-        src += srcStride;\
-        dst += dstStride;\
-    }\
-}\
-\
-static void OPNAME ## rv30_tpel8_hhv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w = 8;\
-    const int h = 8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i, j;\
-    for(j = 0; j < h; j++){\
-        for(i = 0; i < w; i++){\
-            OP(dst[i], (\
-                  src[srcStride*-1+i-1]  -12*src[srcStride*-1+i+1]  -6*src[srcStride*-1+i]    +src[srcStride*-1+i+2]+\
-              -12*src[srcStride* 0+i-1] +144*src[srcStride* 0+i+1] +72*src[srcStride* 0+i] -12*src[srcStride* 0+i+2]+\
-               -6*src[srcStride* 1+i-1]  +72*src[srcStride* 1+i+1] +36*src[srcStride* 1+i]  -6*src[srcStride* 1+i+2]+\
-                  src[srcStride* 2+i-1]  -12*src[srcStride* 2+i+1]  -6*src[srcStride* 2+i]    +src[srcStride* 2+i+2]+\
-                  128)>>8);\
-        }\
-        src += srcStride;\
-        dst += dstStride;\
-    }\
-}\
-\
-static void OPNAME ## rv30_tpel8_hvv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w = 8;\
-    const int h = 8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i, j;\
-    for(j = 0; j < h; j++){\
-        for(i = 0; i < w; i++){\
-            OP(dst[i], (\
-                  src[srcStride*-1+i-1]  -12*src[srcStride*-1+i]  -6*src[srcStride*-1+i+1]    +src[srcStride*-1+i+2]+\
-               -6*src[srcStride* 0+i-1]  +72*src[srcStride* 0+i] +36*src[srcStride* 0+i+1]  -6*src[srcStride* 0+i+2]+\
-              -12*src[srcStride* 1+i-1] +144*src[srcStride* 1+i] +72*src[srcStride* 1+i+1] -12*src[srcStride* 1+i+2]+\
-                  src[srcStride* 2+i-1]  -12*src[srcStride* 2+i]  -6*src[srcStride* 2+i+1]    +src[srcStride* 2+i+2]+\
-                  128)>>8);\
-        }\
-        src += srcStride;\
-        dst += dstStride;\
-    }\
-}\
-\
-static void OPNAME ## rv30_tpel8_hhvv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    const int w = 8;\
-    const int h = 8;\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i, j;\
-    for(j = 0; j < h; j++){\
-        for(i = 0; i < w; i++){\
-            OP(dst[i], (\
-               36*src[i+srcStride*0] +54*src[i+1+srcStride*0] +6*src[i+2+srcStride*0]+\
-               54*src[i+srcStride*1] +81*src[i+1+srcStride*1] +9*src[i+2+srcStride*1]+\
-                6*src[i+srcStride*2] + 9*src[i+1+srcStride*2] +  src[i+2+srcStride*2]+\
-               128)>>8);\
-        }\
-        src += srcStride;\
-        dst += dstStride;\
-    }\
-}\
-\
-static void OPNAME ## rv30_tpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
-    OPNAME ## rv30_tpel8_v_lowpass(dst  , src  , dstStride, srcStride, C1, C2);\
-    OPNAME ## rv30_tpel8_v_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv30_tpel8_v_lowpass(dst  , src  , dstStride, srcStride, C1, C2);\
-    OPNAME ## rv30_tpel8_v_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
-}\
-\
-static void OPNAME ## rv30_tpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
-    OPNAME ## rv30_tpel8_h_lowpass(dst  , src  , dstStride, srcStride, C1, C2);\
-    OPNAME ## rv30_tpel8_h_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv30_tpel8_h_lowpass(dst  , src  , dstStride, srcStride, C1, C2);\
-    OPNAME ## rv30_tpel8_h_lowpass(dst+8, src+8, dstStride, srcStride, C1, C2);\
-}\
-\
-static void OPNAME ## rv30_tpel16_hv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## rv30_tpel8_hv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hv_lowpass(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv30_tpel8_hv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hv_lowpass(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static void OPNAME ## rv30_tpel16_hhv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## rv30_tpel8_hhv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hhv_lowpass(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv30_tpel8_hhv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hhv_lowpass(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static void OPNAME ## rv30_tpel16_hvv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## rv30_tpel8_hvv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hvv_lowpass(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv30_tpel8_hvv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hvv_lowpass(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static void OPNAME ## rv30_tpel16_hhvv_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## rv30_tpel8_hhvv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hhvv_lowpass(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv30_tpel8_hhvv_lowpass(dst  , src  , dstStride, srcStride);\
-    OPNAME ## rv30_tpel8_hhvv_lowpass(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-
-#define RV30_MC(OPNAME, SIZE) \
-static void OPNAME ## rv30_tpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _h_lowpass(dst, src, stride, stride, 12, 6);\
-}\
-\
-static void OPNAME ## rv30_tpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _h_lowpass(dst, src, stride, stride, 6, 12);\
-}\
-\
-static void OPNAME ## rv30_tpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _v_lowpass(dst, src, stride, stride, 12, 6);\
-}\
-\
-static void OPNAME ## rv30_tpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _v_lowpass(dst, src, stride, stride, 6, 12);\
-}\
-\
-static void OPNAME ## rv30_tpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _hv_lowpass(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## rv30_tpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _hvv_lowpass(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## rv30_tpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _hhv_lowpass(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## rv30_tpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv30_tpel ## SIZE ## _hhvv_lowpass(dst, src, stride, stride);\
-}\
-\
-
-#define op_avg(a, b)  a = (((a)+cm[b]+1)>>1)
-#define op_put(a, b)  a = cm[b]
-
-RV30_LOWPASS(put_       , op_put)
-RV30_LOWPASS(avg_       , op_avg)
-RV30_MC(put_, 8)
-RV30_MC(put_, 16)
-RV30_MC(avg_, 8)
-RV30_MC(avg_, 16)
-
-av_cold void ff_rv30dsp_init(DSPContext* c, AVCodecContext *avctx) {
-    c->put_rv30_tpel_pixels_tab[0][ 0] = c->put_h264_qpel_pixels_tab[0][0];
-    c->put_rv30_tpel_pixels_tab[0][ 1] = put_rv30_tpel16_mc10_c;
-    c->put_rv30_tpel_pixels_tab[0][ 2] = put_rv30_tpel16_mc20_c;
-    c->put_rv30_tpel_pixels_tab[0][ 4] = put_rv30_tpel16_mc01_c;
-    c->put_rv30_tpel_pixels_tab[0][ 5] = put_rv30_tpel16_mc11_c;
-    c->put_rv30_tpel_pixels_tab[0][ 6] = put_rv30_tpel16_mc21_c;
-    c->put_rv30_tpel_pixels_tab[0][ 8] = put_rv30_tpel16_mc02_c;
-    c->put_rv30_tpel_pixels_tab[0][ 9] = put_rv30_tpel16_mc12_c;
-    c->put_rv30_tpel_pixels_tab[0][10] = put_rv30_tpel16_mc22_c;
-    c->avg_rv30_tpel_pixels_tab[0][ 0] = c->avg_h264_qpel_pixels_tab[0][0];
-    c->avg_rv30_tpel_pixels_tab[0][ 1] = avg_rv30_tpel16_mc10_c;
-    c->avg_rv30_tpel_pixels_tab[0][ 2] = avg_rv30_tpel16_mc20_c;
-    c->avg_rv30_tpel_pixels_tab[0][ 4] = avg_rv30_tpel16_mc01_c;
-    c->avg_rv30_tpel_pixels_tab[0][ 5] = avg_rv30_tpel16_mc11_c;
-    c->avg_rv30_tpel_pixels_tab[0][ 6] = avg_rv30_tpel16_mc21_c;
-    c->avg_rv30_tpel_pixels_tab[0][ 8] = avg_rv30_tpel16_mc02_c;
-    c->avg_rv30_tpel_pixels_tab[0][ 9] = avg_rv30_tpel16_mc12_c;
-    c->avg_rv30_tpel_pixels_tab[0][10] = avg_rv30_tpel16_mc22_c;
-    c->put_rv30_tpel_pixels_tab[1][ 0] = c->put_h264_qpel_pixels_tab[1][0];
-    c->put_rv30_tpel_pixels_tab[1][ 1] = put_rv30_tpel8_mc10_c;
-    c->put_rv30_tpel_pixels_tab[1][ 2] = put_rv30_tpel8_mc20_c;
-    c->put_rv30_tpel_pixels_tab[1][ 4] = put_rv30_tpel8_mc01_c;
-    c->put_rv30_tpel_pixels_tab[1][ 5] = put_rv30_tpel8_mc11_c;
-    c->put_rv30_tpel_pixels_tab[1][ 6] = put_rv30_tpel8_mc21_c;
-    c->put_rv30_tpel_pixels_tab[1][ 8] = put_rv30_tpel8_mc02_c;
-    c->put_rv30_tpel_pixels_tab[1][ 9] = put_rv30_tpel8_mc12_c;
-    c->put_rv30_tpel_pixels_tab[1][10] = put_rv30_tpel8_mc22_c;
-    c->avg_rv30_tpel_pixels_tab[1][ 0] = c->avg_h264_qpel_pixels_tab[1][0];
-    c->avg_rv30_tpel_pixels_tab[1][ 1] = avg_rv30_tpel8_mc10_c;
-    c->avg_rv30_tpel_pixels_tab[1][ 2] = avg_rv30_tpel8_mc20_c;
-    c->avg_rv30_tpel_pixels_tab[1][ 4] = avg_rv30_tpel8_mc01_c;
-    c->avg_rv30_tpel_pixels_tab[1][ 5] = avg_rv30_tpel8_mc11_c;
-    c->avg_rv30_tpel_pixels_tab[1][ 6] = avg_rv30_tpel8_mc21_c;
-    c->avg_rv30_tpel_pixels_tab[1][ 8] = avg_rv30_tpel8_mc02_c;
-    c->avg_rv30_tpel_pixels_tab[1][ 9] = avg_rv30_tpel8_mc12_c;
-    c->avg_rv30_tpel_pixels_tab[1][10] = avg_rv30_tpel8_mc22_c;
-}
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
deleted file mode 100644
index 88652f9..0000000
--- a/libavcodec/rv34.c
+++ /dev/null
@@ -1,1531 +0,0 @@
-/*
- * RV30/40 decoder common data
- * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV30/40 decoder common data
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "golomb.h"
-#include "mathops.h"
-#include "rectangle.h"
-
-#include "rv34vlc.h"
-#include "rv34data.h"
-#include "rv34.h"
-
-//#define DEBUG
-
-static inline void ZERO8x2(void* dst, int stride)
-{
-    fill_rectangle(dst,                 1, 2, stride, 0, 4);
-    fill_rectangle(((uint8_t*)(dst))+4, 1, 2, stride, 0, 4);
-}
-
-/** translation of RV30/40 macroblock types to lavc ones */
-static const int rv34_mb_type_to_lavc[12] = {
-    MB_TYPE_INTRA,
-    MB_TYPE_INTRA16x16              | MB_TYPE_SEPARATE_DC,
-    MB_TYPE_16x16   | MB_TYPE_L0,
-    MB_TYPE_8x8     | MB_TYPE_L0,
-    MB_TYPE_16x16   | MB_TYPE_L0,
-    MB_TYPE_16x16   | MB_TYPE_L1,
-    MB_TYPE_SKIP,
-    MB_TYPE_DIRECT2 | MB_TYPE_16x16,
-    MB_TYPE_16x8    | MB_TYPE_L0,
-    MB_TYPE_8x16    | MB_TYPE_L0,
-    MB_TYPE_16x16   | MB_TYPE_L0L1,
-    MB_TYPE_16x16   | MB_TYPE_L0    | MB_TYPE_SEPARATE_DC
-};
-
-
-static RV34VLC intra_vlcs[NUM_INTRA_TABLES], inter_vlcs[NUM_INTER_TABLES];
-
-/**
- * @defgroup vlc RV30/40 VLC generating functions
- * @{
- */
-
-static const int table_offs[] = {
-      0,   1818,   3622,   4144,   4698,   5234,   5804,   5868,   5900,   5932,
-   5996,   6252,   6316,   6348,   6380,   7674,   8944,  10274,  11668,  12250,
-  14060,  15846,  16372,  16962,  17512,  18148,  18180,  18212,  18244,  18308,
-  18564,  18628,  18660,  18692,  20036,  21314,  22648,  23968,  24614,  26384,
-  28190,  28736,  29366,  29938,  30608,  30640,  30672,  30704,  30768,  31024,
-  31088,  31120,  31184,  32570,  33898,  35236,  36644,  37286,  39020,  40802,
-  41368,  42052,  42692,  43348,  43380,  43412,  43444,  43476,  43604,  43668,
-  43700,  43732,  45100,  46430,  47778,  49160,  49802,  51550,  53340,  53972,
-  54648,  55348,  55994,  56122,  56154,  56186,  56218,  56346,  56410,  56442,
-  56474,  57878,  59290,  60636,  62036,  62682,  64460,  64524,  64588,  64716,
-  64844,  66076,  67466,  67978,  68542,  69064,  69648,  70296,  72010,  72074,
-  72138,  72202,  72330,  73572,  74936,  75454,  76030,  76566,  77176,  77822,
-  79582,  79646,  79678,  79742,  79870,  81180,  82536,  83064,  83672,  84242,
-  84934,  85576,  87384,  87448,  87480,  87544,  87672,  88982,  90340,  90902,
-  91598,  92182,  92846,  93488,  95246,  95278,  95310,  95374,  95502,  96878,
-  98266,  98848,  99542, 100234, 100884, 101524, 103320, 103352, 103384, 103416,
- 103480, 104874, 106222, 106910, 107584, 108258, 108902, 109544, 111366, 111398,
- 111430, 111462, 111494, 112878, 114320, 114988, 115660, 116310, 116950, 117592
-};
-
-static VLC_TYPE table_data[117592][2];
-
-/**
- * Generate VLC from codeword lengths.
- * @param bits   codeword lengths (zeroes are accepted)
- * @param size   length of input data
- * @param vlc    output VLC
- * @param insyms symbols for input codes (NULL for default ones)
- * @param num    VLC table number (for static initialization)
- */
-static void rv34_gen_vlc(const uint8_t *bits, int size, VLC *vlc, const uint8_t *insyms,
-                         const int num)
-{
-    int i;
-    int counts[17] = {0}, codes[17];
-    uint16_t cw[size], syms[size];
-    uint8_t bits2[size];
-    int maxbits = 0, realsize = 0;
-
-    for(i = 0; i < size; i++){
-        if(bits[i]){
-            bits2[realsize] = bits[i];
-            syms[realsize] = insyms ? insyms[i] : i;
-            realsize++;
-            maxbits = FFMAX(maxbits, bits[i]);
-            counts[bits[i]]++;
-        }
-    }
-
-    codes[0] = 0;
-    for(i = 0; i < 16; i++)
-        codes[i+1] = (codes[i] + counts[i]) << 1;
-    for(i = 0; i < realsize; i++)
-        cw[i] = codes[bits2[i]]++;
-
-    vlc->table = &table_data[table_offs[num]];
-    vlc->table_allocated = table_offs[num + 1] - table_offs[num];
-    init_vlc_sparse(vlc, FFMIN(maxbits, 9), realsize,
-                    bits2, 1, 1,
-                    cw,    2, 2,
-                    syms,  2, 2, INIT_VLC_USE_NEW_STATIC);
-}
-
-/**
- * Initialize all tables.
- */
-static av_cold void rv34_init_tables(void)
-{
-    int i, j, k;
-
-    for(i = 0; i < NUM_INTRA_TABLES; i++){
-        for(j = 0; j < 2; j++){
-            rv34_gen_vlc(rv34_table_intra_cbppat   [i][j], CBPPAT_VLC_SIZE,   &intra_vlcs[i].cbppattern[j],     NULL, 19*i + 0 + j);
-            rv34_gen_vlc(rv34_table_intra_secondpat[i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].second_pattern[j], NULL, 19*i + 2 + j);
-            rv34_gen_vlc(rv34_table_intra_thirdpat [i][j], OTHERBLK_VLC_SIZE, &intra_vlcs[i].third_pattern[j],  NULL, 19*i + 4 + j);
-            for(k = 0; k < 4; k++){
-                rv34_gen_vlc(rv34_table_intra_cbp[i][j+k*2],  CBP_VLC_SIZE,   &intra_vlcs[i].cbp[j][k],         rv34_cbp_code, 19*i + 6 + j*4 + k);
-            }
-        }
-        for(j = 0; j < 4; j++){
-            rv34_gen_vlc(rv34_table_intra_firstpat[i][j], FIRSTBLK_VLC_SIZE, &intra_vlcs[i].first_pattern[j], NULL, 19*i + 14 + j);
-        }
-        rv34_gen_vlc(rv34_intra_coeff[i], COEFF_VLC_SIZE, &intra_vlcs[i].coefficient, NULL, 19*i + 18);
-    }
-
-    for(i = 0; i < NUM_INTER_TABLES; i++){
-        rv34_gen_vlc(rv34_inter_cbppat[i], CBPPAT_VLC_SIZE, &inter_vlcs[i].cbppattern[0], NULL, i*12 + 95);
-        for(j = 0; j < 4; j++){
-            rv34_gen_vlc(rv34_inter_cbp[i][j], CBP_VLC_SIZE, &inter_vlcs[i].cbp[0][j], rv34_cbp_code, i*12 + 96 + j);
-        }
-        for(j = 0; j < 2; j++){
-            rv34_gen_vlc(rv34_table_inter_firstpat [i][j], FIRSTBLK_VLC_SIZE, &inter_vlcs[i].first_pattern[j],  NULL, i*12 + 100 + j);
-            rv34_gen_vlc(rv34_table_inter_secondpat[i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].second_pattern[j], NULL, i*12 + 102 + j);
-            rv34_gen_vlc(rv34_table_inter_thirdpat [i][j], OTHERBLK_VLC_SIZE, &inter_vlcs[i].third_pattern[j],  NULL, i*12 + 104 + j);
-        }
-        rv34_gen_vlc(rv34_inter_coeff[i], COEFF_VLC_SIZE, &inter_vlcs[i].coefficient, NULL, i*12 + 106);
-    }
-}
-
-/** @} */ // vlc group
-
-
-/**
- * @defgroup transform RV30/40 inverse transform functions
- * @{
- */
-
-static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
-{
-    int i;
-
-    for(i=0; i<4; i++){
-        const int z0= 13*(block[i+8*0] +    block[i+8*2]);
-        const int z1= 13*(block[i+8*0] -    block[i+8*2]);
-        const int z2=  7* block[i+8*1] - 17*block[i+8*3];
-        const int z3= 17* block[i+8*1] +  7*block[i+8*3];
-
-        temp[4*i+0]= z0+z3;
-        temp[4*i+1]= z1+z2;
-        temp[4*i+2]= z1-z2;
-        temp[4*i+3]= z0-z3;
-    }
-}
-
-/**
- * Real Video 3.0/4.0 inverse transform
- * Code is almost the same as in SVQ3, only scaling is different.
- */
-static void rv34_inv_transform(DCTELEM *block){
-    int temp[16];
-    int i;
-
-    rv34_row_transform(temp, block);
-
-    for(i=0; i<4; i++){
-        const int z0= 13*(temp[4*0+i] +    temp[4*2+i]) + 0x200;
-        const int z1= 13*(temp[4*0+i] -    temp[4*2+i]) + 0x200;
-        const int z2=  7* temp[4*1+i] - 17*temp[4*3+i];
-        const int z3= 17* temp[4*1+i] +  7*temp[4*3+i];
-
-        block[i*8+0]= (z0 + z3)>>10;
-        block[i*8+1]= (z1 + z2)>>10;
-        block[i*8+2]= (z1 - z2)>>10;
-        block[i*8+3]= (z0 - z3)>>10;
-    }
-
-}
-
-/**
- * RealVideo 3.0/4.0 inverse transform for DC block
- *
- * Code is almost the same as rv34_inv_transform()
- * but final coefficients are multiplied by 1.5 and have no rounding.
- */
-static void rv34_inv_transform_noround(DCTELEM *block){
-    int temp[16];
-    int i;
-
-    rv34_row_transform(temp, block);
-
-    for(i=0; i<4; i++){
-        const int z0= 13*(temp[4*0+i] +    temp[4*2+i]);
-        const int z1= 13*(temp[4*0+i] -    temp[4*2+i]);
-        const int z2=  7* temp[4*1+i] - 17*temp[4*3+i];
-        const int z3= 17* temp[4*1+i] +  7*temp[4*3+i];
-
-        block[i*8+0]= ((z0 + z3)*3)>>11;
-        block[i*8+1]= ((z1 + z2)*3)>>11;
-        block[i*8+2]= ((z1 - z2)*3)>>11;
-        block[i*8+3]= ((z0 - z3)*3)>>11;
-    }
-
-}
-
-/** @} */ // transform
-
-
-/**
- * @defgroup block RV30/40 4x4 block decoding functions
- * @{
- */
-
-/**
- * Decode coded block pattern.
- */
-static int rv34_decode_cbp(GetBitContext *gb, RV34VLC *vlc, int table)
-{
-    int pattern, code, cbp=0;
-    int ones;
-    static const int cbp_masks[3] = {0x100000, 0x010000, 0x110000};
-    static const int shifts[4] = { 0, 2, 8, 10 };
-    const int *curshift = shifts;
-    int i, t, mask;
-
-    code = get_vlc2(gb, vlc->cbppattern[table].table, 9, 2);
-    pattern = code & 0xF;
-    code >>= 4;
-
-    ones = rv34_count_ones[pattern];
-
-    for(mask = 8; mask; mask >>= 1, curshift++){
-        if(pattern & mask)
-            cbp |= get_vlc2(gb, vlc->cbp[table][ones].table, vlc->cbp[table][ones].bits, 1) << curshift[0];
-    }
-
-    for(i = 0; i < 4; i++){
-        t = modulo_three_table[code][i];
-        if(t == 1)
-            cbp |= cbp_masks[get_bits1(gb)] << i;
-        if(t == 2)
-            cbp |= cbp_masks[2] << i;
-    }
-    return cbp;
-}
-
-/**
- * Get one coefficient value from the bistream and store it.
- */
-static inline void decode_coeff(DCTELEM *dst, int coef, int esc, GetBitContext *gb, VLC* vlc)
-{
-    if(coef){
-        if(coef == esc){
-            coef = get_vlc2(gb, vlc->table, 9, 2);
-            if(coef > 23){
-                coef -= 23;
-                coef = 22 + ((1 << coef) | get_bits(gb, coef));
-            }
-            coef += esc;
-        }
-        if(get_bits1(gb))
-            coef = -coef;
-        *dst = coef;
-    }
-}
-
-/**
- * Decode 2x2 subblock of coefficients.
- */
-static inline void decode_subblock(DCTELEM *dst, int code, const int is_block2, GetBitContext *gb, VLC *vlc)
-{
-    int coeffs[4];
-
-    coeffs[0] = modulo_three_table[code][0];
-    coeffs[1] = modulo_three_table[code][1];
-    coeffs[2] = modulo_three_table[code][2];
-    coeffs[3] = modulo_three_table[code][3];
-    decode_coeff(dst  , coeffs[0], 3, gb, vlc);
-    if(is_block2){
-        decode_coeff(dst+8, coeffs[1], 2, gb, vlc);
-        decode_coeff(dst+1, coeffs[2], 2, gb, vlc);
-    }else{
-        decode_coeff(dst+1, coeffs[1], 2, gb, vlc);
-        decode_coeff(dst+8, coeffs[2], 2, gb, vlc);
-    }
-    decode_coeff(dst+9, coeffs[3], 2, gb, vlc);
-}
-
-/**
- * Decode coefficients for 4x4 block.
- *
- * This is done by filling 2x2 subblocks with decoded coefficients
- * in this order (the same for subblocks and subblock coefficients):
- *  o--o
- *    /
- *   /
- *  o--o
- */
-
-static inline void rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc)
-{
-    int code, pattern;
-
-    code = get_vlc2(gb, rvlc->first_pattern[fc].table, 9, 2);
-
-    pattern = code & 0x7;
-
-    code >>= 3;
-    decode_subblock(dst, code, 0, gb, &rvlc->coefficient);
-
-    if(pattern & 4){
-        code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
-        decode_subblock(dst + 2, code, 0, gb, &rvlc->coefficient);
-    }
-    if(pattern & 2){ // Looks like coefficients 1 and 2 are swapped for this block
-        code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
-        decode_subblock(dst + 8*2, code, 1, gb, &rvlc->coefficient);
-    }
-    if(pattern & 1){
-        code = get_vlc2(gb, rvlc->third_pattern[sc].table, 9, 2);
-        decode_subblock(dst + 8*2+2, code, 0, gb, &rvlc->coefficient);
-    }
-
-}
-
-/**
- * Dequantize ordinary 4x4 block.
- * @todo optimize
- */
-static inline void rv34_dequant4x4(DCTELEM *block, int Qdc, int Q)
-{
-    int i, j;
-
-    block[0] = (block[0] * Qdc + 8) >> 4;
-    for(i = 0; i < 4; i++)
-        for(j = !i; j < 4; j++)
-            block[j + i*8] = (block[j + i*8] * Q + 8) >> 4;
-}
-
-/**
- * Dequantize 4x4 block of DC values for 16x16 macroblock.
- * @todo optimize
- */
-static inline void rv34_dequant4x4_16x16(DCTELEM *block, int Qdc, int Q)
-{
-    int i;
-
-    for(i = 0; i < 3; i++)
-         block[rv34_dezigzag[i]] = (block[rv34_dezigzag[i]] * Qdc + 8) >> 4;
-    for(; i < 16; i++)
-         block[rv34_dezigzag[i]] = (block[rv34_dezigzag[i]] * Q + 8) >> 4;
-}
-/** @} */ //block functions
-
-
-/**
- * @defgroup bitstream RV30/40 bitstream parsing
- * @{
- */
-
-/**
- * Decode starting slice position.
- * @todo Maybe replace with ff_h263_decode_mba() ?
- */
-int ff_rv34_get_start_offset(GetBitContext *gb, int mb_size)
-{
-    int i;
-    for(i = 0; i < 5; i++)
-        if(rv34_mb_max_sizes[i] >= mb_size - 1)
-            break;
-    return rv34_mb_bits_sizes[i];
-}
-
-/**
- * Select VLC set for decoding from current quantizer, modifier and frame type.
- */
-static inline RV34VLC* choose_vlc_set(int quant, int mod, int type)
-{
-    if(mod == 2 && quant < 19) quant += 10;
-    else if(mod && quant < 26) quant += 5;
-    return type ? &inter_vlcs[rv34_quant_to_vlc_set[1][av_clip(quant, 0, 30)]]
-                : &intra_vlcs[rv34_quant_to_vlc_set[0][av_clip(quant, 0, 30)]];
-}
-
-/**
- * Decode quantizer difference and return modified quantizer.
- */
-static inline int rv34_decode_dquant(GetBitContext *gb, int quant)
-{
-    if(get_bits1(gb))
-        return rv34_dquant_tab[get_bits1(gb)][quant];
-    else
-        return get_bits(gb, 5);
-}
-
-/** @} */ //bitstream functions
-
-/**
- * @defgroup mv motion vector related code (prediction, reconstruction, motion compensation)
- * @{
- */
-
-/** macroblock partition width in 8x8 blocks */
-static const uint8_t part_sizes_w[RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2 };
-
-/** macroblock partition height in 8x8 blocks */
-static const uint8_t part_sizes_h[RV34_MB_TYPES] = { 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2 };
-
-/** availability index for subblocks */
-static const uint8_t avail_indexes[4] = { 6, 7, 10, 11 };
-
-/**
- * motion vector prediction
- *
- * Motion prediction performed for the block by using median prediction of
- * motion vectors from the left, top and right top blocks but in corner cases
- * some other vectors may be used instead.
- */
-static void rv34_pred_mv(RV34DecContext *r, int block_type, int subblock_no, int dmv_no)
-{
-    MpegEncContext *s = &r->s;
-    int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
-    int A[2] = {0}, B[2], C[2];
-    int i, j;
-    int mx, my;
-    int avail_index = avail_indexes[subblock_no];
-    int c_off = part_sizes_w[block_type];
-
-    mv_pos += (subblock_no & 1) + (subblock_no >> 1)*s->b8_stride;
-    if(subblock_no == 3)
-        c_off = -1;
-
-    if(r->avail_cache[avail_index - 1]){
-        A[0] = s->current_picture_ptr->motion_val[0][mv_pos-1][0];
-        A[1] = s->current_picture_ptr->motion_val[0][mv_pos-1][1];
-    }
-    if(r->avail_cache[avail_index - 4]){
-        B[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][0];
-        B[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][1];
-    }else{
-        B[0] = A[0];
-        B[1] = A[1];
-    }
-    if(!r->avail_cache[avail_index - 4 + c_off]){
-        if(r->avail_cache[avail_index - 4] && (r->avail_cache[avail_index - 1] || r->rv30)){
-            C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][0];
-            C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][1];
-        }else{
-            C[0] = A[0];
-            C[1] = A[1];
-        }
-    }else{
-        C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][0];
-        C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+c_off][1];
-    }
-    mx = mid_pred(A[0], B[0], C[0]);
-    my = mid_pred(A[1], B[1], C[1]);
-    mx += r->dmv[dmv_no][0];
-    my += r->dmv[dmv_no][1];
-    for(j = 0; j < part_sizes_h[block_type]; j++){
-        for(i = 0; i < part_sizes_w[block_type]; i++){
-            s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][0] = mx;
-            s->current_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][1] = my;
-        }
-    }
-}
-
-#define GET_PTS_DIFF(a, b) ((a - b + 8192) & 0x1FFF)
-
-/**
- * Calculate motion vector component that should be added for direct blocks.
- */
-static int calc_add_mv(RV34DecContext *r, int dir, int val)
-{
-    int refdist = GET_PTS_DIFF(r->next_pts, r->last_pts);
-    int dist = dir ? -GET_PTS_DIFF(r->next_pts, r->cur_pts) : GET_PTS_DIFF(r->cur_pts, r->last_pts);
-    int mul;
-
-    if(!refdist) return 0;
-    mul = (dist << 14) / refdist;
-    return (val * mul + 0x2000) >> 14;
-}
-
-/**
- * Predict motion vector for B-frame macroblock.
- */
-static inline void rv34_pred_b_vector(int A[2], int B[2], int C[2],
-                                      int A_avail, int B_avail, int C_avail,
-                                      int *mx, int *my)
-{
-    if(A_avail + B_avail + C_avail != 3){
-        *mx = A[0] + B[0] + C[0];
-        *my = A[1] + B[1] + C[1];
-        if(A_avail + B_avail + C_avail == 2){
-            *mx /= 2;
-            *my /= 2;
-        }
-    }else{
-        *mx = mid_pred(A[0], B[0], C[0]);
-        *my = mid_pred(A[1], B[1], C[1]);
-    }
-}
-
-/**
- * motion vector prediction for B-frames
- */
-static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir)
-{
-    MpegEncContext *s = &r->s;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-    int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
-    int A[2], B[2], C[2];
-    int has_A = 0, has_B = 0, has_C = 0;
-    int mx, my;
-    int i, j;
-    Picture *cur_pic = s->current_picture_ptr;
-    const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0;
-    int type = cur_pic->mb_type[mb_pos];
-
-    memset(A, 0, sizeof(A));
-    memset(B, 0, sizeof(B));
-    memset(C, 0, sizeof(C));
-    if((r->avail_cache[6-1] & type) & mask){
-        A[0] = cur_pic->motion_val[dir][mv_pos - 1][0];
-        A[1] = cur_pic->motion_val[dir][mv_pos - 1][1];
-        has_A = 1;
-    }
-    if((r->avail_cache[6-4] & type) & mask){
-        B[0] = cur_pic->motion_val[dir][mv_pos - s->b8_stride][0];
-        B[1] = cur_pic->motion_val[dir][mv_pos - s->b8_stride][1];
-        has_B = 1;
-    }
-    if(r->avail_cache[6-4] && (r->avail_cache[6-2] & type) & mask){
-        C[0] = cur_pic->motion_val[dir][mv_pos - s->b8_stride + 2][0];
-        C[1] = cur_pic->motion_val[dir][mv_pos - s->b8_stride + 2][1];
-        has_C = 1;
-    }else if((s->mb_x+1) == s->mb_width && (r->avail_cache[6-5] & type) & mask){
-        C[0] = cur_pic->motion_val[dir][mv_pos - s->b8_stride - 1][0];
-        C[1] = cur_pic->motion_val[dir][mv_pos - s->b8_stride - 1][1];
-        has_C = 1;
-    }
-
-    rv34_pred_b_vector(A, B, C, has_A, has_B, has_C, &mx, &my);
-
-    mx += r->dmv[dir][0];
-    my += r->dmv[dir][1];
-
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            cur_pic->motion_val[dir][mv_pos + i + j*s->b8_stride][0] = mx;
-            cur_pic->motion_val[dir][mv_pos + i + j*s->b8_stride][1] = my;
-        }
-    }
-    if(block_type == RV34_MB_B_BACKWARD || block_type == RV34_MB_B_FORWARD){
-        ZERO8x2(cur_pic->motion_val[!dir][mv_pos], s->b8_stride);
-    }
-}
-
-/**
- * motion vector prediction - RV3 version
- */
-static void rv34_pred_mv_rv3(RV34DecContext *r, int block_type, int dir)
-{
-    MpegEncContext *s = &r->s;
-    int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
-    int A[2] = {0}, B[2], C[2];
-    int i, j, k;
-    int mx, my;
-    int avail_index = avail_indexes[0];
-
-    if(r->avail_cache[avail_index - 1]){
-        A[0] = s->current_picture_ptr->motion_val[0][mv_pos-1][0];
-        A[1] = s->current_picture_ptr->motion_val[0][mv_pos-1][1];
-    }
-    if(r->avail_cache[avail_index - 4]){
-        B[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][0];
-        B[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride][1];
-    }else{
-        B[0] = A[0];
-        B[1] = A[1];
-    }
-    if(!r->avail_cache[avail_index - 4 + 2]){
-        if(r->avail_cache[avail_index - 4] && (r->avail_cache[avail_index - 1])){
-            C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][0];
-            C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride-1][1];
-        }else{
-            C[0] = A[0];
-            C[1] = A[1];
-        }
-    }else{
-        C[0] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+2][0];
-        C[1] = s->current_picture_ptr->motion_val[0][mv_pos-s->b8_stride+2][1];
-    }
-    mx = mid_pred(A[0], B[0], C[0]);
-    my = mid_pred(A[1], B[1], C[1]);
-    mx += r->dmv[0][0];
-    my += r->dmv[0][1];
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            for(k = 0; k < 2; k++){
-                s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][0] = mx;
-                s->current_picture_ptr->motion_val[k][mv_pos + i + j*s->b8_stride][1] = my;
-            }
-        }
-    }
-}
-
-static const int chroma_coeffs[3] = { 0, 3, 5 };
-
-/**
- * generic motion compensation function
- *
- * @param r decoder context
- * @param block_type type of the current block
- * @param xoff horizontal offset from the start of the current block
- * @param yoff vertical offset from the start of the current block
- * @param mv_off offset to the motion vector information
- * @param width width of the current partition in 8x8 blocks
- * @param height height of the current partition in 8x8 blocks
- * @param dir motion compensation direction (i.e. from the last or the next reference frame)
- * @param thirdpel motion vectors are specified in 1/3 of pixel
- * @param qpel_mc a set of functions used to perform luma motion compensation
- * @param chroma_mc a set of functions used to perform chroma motion compensation
- */
-static inline void rv34_mc(RV34DecContext *r, const int block_type,
-                          const int xoff, const int yoff, int mv_off,
-                          const int width, const int height, int dir,
-                          const int thirdpel,
-                          qpel_mc_func (*qpel_mc)[16],
-                          h264_chroma_mc_func (*chroma_mc))
-{
-    MpegEncContext *s = &r->s;
-    uint8_t *Y, *U, *V, *srcY, *srcU, *srcV;
-    int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
-    int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off;
-    int is16x16 = 1;
-
-    if(thirdpel){
-        int chroma_mx, chroma_my;
-        mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24);
-        my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24);
-        lx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3;
-        ly = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3;
-        chroma_mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + 1) >> 1;
-        chroma_my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + 1) >> 1;
-        umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24);
-        umy = (chroma_my + (3 << 24)) / 3 - (1 << 24);
-        uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3];
-        uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3];
-    }else{
-        int cx, cy;
-        mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2;
-        my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2;
-        lx = s->current_picture_ptr->motion_val[dir][mv_pos][0] & 3;
-        ly = s->current_picture_ptr->motion_val[dir][mv_pos][1] & 3;
-        cx = s->current_picture_ptr->motion_val[dir][mv_pos][0] / 2;
-        cy = s->current_picture_ptr->motion_val[dir][mv_pos][1] / 2;
-        umx = cx >> 2;
-        umy = cy >> 2;
-        uvmx = (cx & 3) << 1;
-        uvmy = (cy & 3) << 1;
-        //due to some flaw RV40 uses the same MC compensation routine for H2V2 and H3V3
-        if(uvmx == 6 && uvmy == 6)
-            uvmx = uvmy = 4;
-    }
-    dxy = ly*4 + lx;
-    srcY = dir ? s->next_picture_ptr->data[0] : s->last_picture_ptr->data[0];
-    srcU = dir ? s->next_picture_ptr->data[1] : s->last_picture_ptr->data[1];
-    srcV = dir ? s->next_picture_ptr->data[2] : s->last_picture_ptr->data[2];
-    src_x = s->mb_x * 16 + xoff + mx;
-    src_y = s->mb_y * 16 + yoff + my;
-    uvsrc_x = s->mb_x * 8 + (xoff >> 1) + umx;
-    uvsrc_y = s->mb_y * 8 + (yoff >> 1) + umy;
-    srcY += src_y * s->linesize + src_x;
-    srcU += uvsrc_y * s->uvlinesize + uvsrc_x;
-    srcV += uvsrc_y * s->uvlinesize + uvsrc_x;
-    if(   (unsigned)(src_x - !!lx*2) > s->h_edge_pos - !!lx*2 - (width <<3) - 4
-       || (unsigned)(src_y - !!ly*2) > s->v_edge_pos - !!ly*2 - (height<<3) - 4){
-        uint8_t *uvbuf= s->edge_emu_buffer + 22 * s->linesize;
-
-        srcY -= 2 + 2*s->linesize;
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6,
-                            src_x - 2, src_y - 2, s->h_edge_pos, s->v_edge_pos);
-        srcY = s->edge_emu_buffer + 2 + 2*s->linesize;
-        ff_emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        srcU = uvbuf;
-        srcV = uvbuf + 16;
-    }
-    Y = s->dest[0] + xoff      + yoff     *s->linesize;
-    U = s->dest[1] + (xoff>>1) + (yoff>>1)*s->uvlinesize;
-    V = s->dest[2] + (xoff>>1) + (yoff>>1)*s->uvlinesize;
-
-    if(block_type == RV34_MB_P_16x8){
-        qpel_mc[1][dxy](Y, srcY, s->linesize);
-        Y    += 8;
-        srcY += 8;
-    }else if(block_type == RV34_MB_P_8x16){
-        qpel_mc[1][dxy](Y, srcY, s->linesize);
-        Y    += 8 * s->linesize;
-        srcY += 8 * s->linesize;
-    }
-    is16x16 = (block_type != RV34_MB_P_8x8) && (block_type != RV34_MB_P_16x8) && (block_type != RV34_MB_P_8x16);
-    qpel_mc[!is16x16][dxy](Y, srcY, s->linesize);
-    chroma_mc[2-width]   (U, srcU, s->uvlinesize, height*4, uvmx, uvmy);
-    chroma_mc[2-width]   (V, srcV, s->uvlinesize, height*4, uvmx, uvmy);
-}
-
-static void rv34_mc_1mv(RV34DecContext *r, const int block_type,
-                        const int xoff, const int yoff, int mv_off,
-                        const int width, const int height, int dir)
-{
-    rv34_mc(r, block_type, xoff, yoff, mv_off, width, height, dir, r->rv30,
-            r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab
-                    : r->s.dsp.put_rv40_qpel_pixels_tab,
-            r->rv30 ? r->s.dsp.put_h264_chroma_pixels_tab
-                    : r->s.dsp.put_rv40_chroma_pixels_tab);
-}
-
-static void rv34_mc_2mv(RV34DecContext *r, const int block_type)
-{
-    rv34_mc(r, block_type, 0, 0, 0, 2, 2, 0, r->rv30,
-            r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab
-                    : r->s.dsp.put_rv40_qpel_pixels_tab,
-            r->rv30 ? r->s.dsp.put_h264_chroma_pixels_tab
-                    : r->s.dsp.put_rv40_chroma_pixels_tab);
-    rv34_mc(r, block_type, 0, 0, 0, 2, 2, 1, r->rv30,
-            r->rv30 ? r->s.dsp.avg_rv30_tpel_pixels_tab
-                    : r->s.dsp.avg_rv40_qpel_pixels_tab,
-            r->rv30 ? r->s.dsp.avg_h264_chroma_pixels_tab
-                    : r->s.dsp.avg_rv40_chroma_pixels_tab);
-}
-
-static void rv34_mc_2mv_skip(RV34DecContext *r)
-{
-    int i, j;
-    for(j = 0; j < 2; j++)
-        for(i = 0; i < 2; i++){
-             rv34_mc(r, RV34_MB_P_8x8, i*8, j*8, i+j*r->s.b8_stride, 1, 1, 0, r->rv30,
-                    r->rv30 ? r->s.dsp.put_rv30_tpel_pixels_tab
-                            : r->s.dsp.put_rv40_qpel_pixels_tab,
-                    r->rv30 ? r->s.dsp.put_h264_chroma_pixels_tab
-                            : r->s.dsp.put_rv40_chroma_pixels_tab);
-             rv34_mc(r, RV34_MB_P_8x8, i*8, j*8, i+j*r->s.b8_stride, 1, 1, 1, r->rv30,
-                    r->rv30 ? r->s.dsp.avg_rv30_tpel_pixels_tab
-                            : r->s.dsp.avg_rv40_qpel_pixels_tab,
-                    r->rv30 ? r->s.dsp.avg_h264_chroma_pixels_tab
-                            : r->s.dsp.avg_rv40_chroma_pixels_tab);
-        }
-}
-
-/** number of motion vectors in each macroblock type */
-static const int num_mvs[RV34_MB_TYPES] = { 0, 0, 1, 4, 1, 1, 0, 0, 2, 2, 2, 1 };
-
-/**
- * Decode motion vector differences
- * and perform motion vector reconstruction and motion compensation.
- */
-static int rv34_decode_mv(RV34DecContext *r, int block_type)
-{
-    MpegEncContext *s = &r->s;
-    GetBitContext *gb = &s->gb;
-    int i, j, k, l;
-    int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
-    int next_bt;
-
-    memset(r->dmv, 0, sizeof(r->dmv));
-    for(i = 0; i < num_mvs[block_type]; i++){
-        r->dmv[i][0] = svq3_get_se_golomb(gb);
-        r->dmv[i][1] = svq3_get_se_golomb(gb);
-    }
-    switch(block_type){
-    case RV34_MB_TYPE_INTRA:
-    case RV34_MB_TYPE_INTRA16x16:
-        ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
-        return 0;
-    case RV34_MB_SKIP:
-        if(s->pict_type == FF_P_TYPE){
-            ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
-            rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0);
-            break;
-        }
-    case RV34_MB_B_DIRECT:
-        //surprisingly, it uses motion scheme from next reference frame
-        next_bt = s->next_picture_ptr->mb_type[s->mb_x + s->mb_y * s->mb_stride];
-        if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){
-            ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
-            ZERO8x2(s->current_picture_ptr->motion_val[1][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
-        }else
-            for(j = 0; j < 2; j++)
-                for(i = 0; i < 2; i++)
-                    for(k = 0; k < 2; k++)
-                        for(l = 0; l < 2; l++)
-                            s->current_picture_ptr->motion_val[l][mv_pos + i + j*s->b8_stride][k] = calc_add_mv(r, l, s->next_picture_ptr->motion_val[0][mv_pos + i + j*s->b8_stride][k]);
-        if(!(IS_16X8(next_bt) || IS_8X16(next_bt) || IS_8X8(next_bt))) //we can use whole macroblock MC
-            rv34_mc_2mv(r, block_type);
-        else
-            rv34_mc_2mv_skip(r);
-        ZERO8x2(s->current_picture_ptr->motion_val[0][s->mb_x * 2 + s->mb_y * 2 * s->b8_stride], s->b8_stride);
-        break;
-    case RV34_MB_P_16x16:
-    case RV34_MB_P_MIX16x16:
-        rv34_pred_mv(r, block_type, 0, 0);
-        rv34_mc_1mv (r, block_type, 0, 0, 0, 2, 2, 0);
-        break;
-    case RV34_MB_B_FORWARD:
-    case RV34_MB_B_BACKWARD:
-        r->dmv[1][0] = r->dmv[0][0];
-        r->dmv[1][1] = r->dmv[0][1];
-        if(r->rv30)
-            rv34_pred_mv_rv3(r, block_type, block_type == RV34_MB_B_BACKWARD);
-        else
-            rv34_pred_mv_b  (r, block_type, block_type == RV34_MB_B_BACKWARD);
-        rv34_mc_1mv     (r, block_type, 0, 0, 0, 2, 2, block_type == RV34_MB_B_BACKWARD);
-        break;
-    case RV34_MB_P_16x8:
-    case RV34_MB_P_8x16:
-        rv34_pred_mv(r, block_type, 0, 0);
-        rv34_pred_mv(r, block_type, 1 + (block_type == RV34_MB_P_16x8), 1);
-        if(block_type == RV34_MB_P_16x8){
-            rv34_mc_1mv(r, block_type, 0, 0, 0,            2, 1, 0);
-            rv34_mc_1mv(r, block_type, 0, 8, s->b8_stride, 2, 1, 0);
-        }
-        if(block_type == RV34_MB_P_8x16){
-            rv34_mc_1mv(r, block_type, 0, 0, 0, 1, 2, 0);
-            rv34_mc_1mv(r, block_type, 8, 0, 1, 1, 2, 0);
-        }
-        break;
-    case RV34_MB_B_BIDIR:
-        rv34_pred_mv_b  (r, block_type, 0);
-        rv34_pred_mv_b  (r, block_type, 1);
-        rv34_mc_2mv     (r, block_type);
-        break;
-    case RV34_MB_P_8x8:
-        for(i=0;i< 4;i++){
-            rv34_pred_mv(r, block_type, i, i);
-            rv34_mc_1mv (r, block_type, (i&1)<<3, (i&2)<<2, (i&1)+(i>>1)*s->b8_stride, 1, 1, 0);
-        }
-        break;
-    }
-
-    return 0;
-}
-/** @} */ // mv group
-
-/**
- * @defgroup recons Macroblock reconstruction functions
- * @{
- */
-/** mapping of RV30/40 intra prediction types to standard H.264 types */
-static const int ittrans[9] = {
- DC_PRED, VERT_PRED, HOR_PRED, DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_LEFT_PRED,
- VERT_RIGHT_PRED, VERT_LEFT_PRED, HOR_UP_PRED, HOR_DOWN_PRED,
-};
-
-/** mapping of RV30/40 intra 16x16 prediction types to standard H.264 types */
-static const int ittrans16[4] = {
- DC_PRED8x8, VERT_PRED8x8, HOR_PRED8x8, PLANE_PRED8x8,
-};
-
-/**
- * Perform 4x4 intra prediction.
- */
-static void rv34_pred_4x4_block(RV34DecContext *r, uint8_t *dst, int stride, int itype, int up, int left, int down, int right)
-{
-    uint8_t *prev = dst - stride + 4;
-    uint32_t topleft;
-
-    if(!up && !left)
-        itype = DC_128_PRED;
-    else if(!up){
-        if(itype == VERT_PRED) itype = HOR_PRED;
-        if(itype == DC_PRED)   itype = LEFT_DC_PRED;
-    }else if(!left){
-        if(itype == HOR_PRED)  itype = VERT_PRED;
-        if(itype == DC_PRED)   itype = TOP_DC_PRED;
-        if(itype == DIAG_DOWN_LEFT_PRED) itype = DIAG_DOWN_LEFT_PRED_RV40_NODOWN;
-    }
-    if(!down){
-        if(itype == DIAG_DOWN_LEFT_PRED) itype = DIAG_DOWN_LEFT_PRED_RV40_NODOWN;
-        if(itype == HOR_UP_PRED) itype = HOR_UP_PRED_RV40_NODOWN;
-        if(itype == VERT_LEFT_PRED) itype = VERT_LEFT_PRED_RV40_NODOWN;
-    }
-    if(!right && up){
-        topleft = dst[-stride + 3] * 0x01010101;
-        prev = (uint8_t*)&topleft;
-    }
-    r->h.pred4x4[itype](dst, prev, stride);
-}
-
-/** add_pixels_clamped for 4x4 block */
-static void rv34_add_4x4_block(uint8_t *dst, int stride, DCTELEM block[64], int off)
-{
-    int x, y;
-    for(y = 0; y < 4; y++)
-        for(x = 0; x < 4; x++)
-            dst[x + y*stride] = av_clip_uint8(dst[x + y*stride] + block[off + x+y*8]);
-}
-
-static inline int adjust_pred16(int itype, int up, int left)
-{
-    if(!up && !left)
-        itype = DC_128_PRED8x8;
-    else if(!up){
-        if(itype == PLANE_PRED8x8)itype = HOR_PRED8x8;
-        if(itype == VERT_PRED8x8) itype = HOR_PRED8x8;
-        if(itype == DC_PRED8x8)   itype = LEFT_DC_PRED8x8;
-    }else if(!left){
-        if(itype == PLANE_PRED8x8)itype = VERT_PRED8x8;
-        if(itype == HOR_PRED8x8)  itype = VERT_PRED8x8;
-        if(itype == DC_PRED8x8)   itype = TOP_DC_PRED8x8;
-    }
-    return itype;
-}
-
-static void rv34_output_macroblock(RV34DecContext *r, int8_t *intra_types, int cbp, int is16)
-{
-    MpegEncContext *s = &r->s;
-    DSPContext *dsp = &s->dsp;
-    int i, j;
-    uint8_t *Y, *U, *V;
-    int itype;
-    int avail[6*8] = {0};
-    int idx;
-
-    // Set neighbour information.
-    if(r->avail_cache[1])
-        avail[0] = 1;
-    if(r->avail_cache[2])
-        avail[1] = avail[2] = 1;
-    if(r->avail_cache[3])
-        avail[3] = avail[4] = 1;
-    if(r->avail_cache[4])
-        avail[5] = 1;
-    if(r->avail_cache[5])
-        avail[8] = avail[16] = 1;
-    if(r->avail_cache[9])
-        avail[24] = avail[32] = 1;
-
-    Y = s->dest[0];
-    U = s->dest[1];
-    V = s->dest[2];
-    if(!is16){
-        for(j = 0; j < 4; j++){
-            idx = 9 + j*8;
-            for(i = 0; i < 4; i++, cbp >>= 1, Y += 4, idx++){
-                rv34_pred_4x4_block(r, Y, s->linesize, ittrans[intra_types[i]], avail[idx-8], avail[idx-1], avail[idx+7], avail[idx-7]);
-                avail[idx] = 1;
-                if(cbp & 1)
-                    rv34_add_4x4_block(Y, s->linesize, s->block[(i>>1)+(j&2)], (i&1)*4+(j&1)*32);
-            }
-            Y += s->linesize * 4 - 4*4;
-            intra_types += r->intra_types_stride;
-        }
-        intra_types -= r->intra_types_stride * 4;
-        fill_rectangle(r->avail_cache + 6, 2, 2, 4, 0, 4);
-        for(j = 0; j < 2; j++){
-            idx = 6 + j*4;
-            for(i = 0; i < 2; i++, cbp >>= 1, idx++){
-                rv34_pred_4x4_block(r, U + i*4 + j*4*s->uvlinesize, s->uvlinesize, ittrans[intra_types[i*2+j*2*r->intra_types_stride]], r->avail_cache[idx-4], r->avail_cache[idx-1], !i && !j, r->avail_cache[idx-3]);
-                rv34_pred_4x4_block(r, V + i*4 + j*4*s->uvlinesize, s->uvlinesize, ittrans[intra_types[i*2+j*2*r->intra_types_stride]], r->avail_cache[idx-4], r->avail_cache[idx-1], !i && !j, r->avail_cache[idx-3]);
-                r->avail_cache[idx] = 1;
-                if(cbp & 0x01)
-                    rv34_add_4x4_block(U + i*4 + j*4*s->uvlinesize, s->uvlinesize, s->block[4], i*4+j*32);
-                if(cbp & 0x10)
-                    rv34_add_4x4_block(V + i*4 + j*4*s->uvlinesize, s->uvlinesize, s->block[5], i*4+j*32);
-            }
-        }
-    }else{
-        itype = ittrans16[intra_types[0]];
-        itype = adjust_pred16(itype, r->avail_cache[6-4], r->avail_cache[6-1]);
-        r->h.pred16x16[itype](Y, s->linesize);
-        dsp->add_pixels_clamped(s->block[0], Y,     s->linesize);
-        dsp->add_pixels_clamped(s->block[1], Y + 8, s->linesize);
-        Y += s->linesize * 8;
-        dsp->add_pixels_clamped(s->block[2], Y,     s->linesize);
-        dsp->add_pixels_clamped(s->block[3], Y + 8, s->linesize);
-
-        itype = ittrans16[intra_types[0]];
-        if(itype == PLANE_PRED8x8) itype = DC_PRED8x8;
-        itype = adjust_pred16(itype, r->avail_cache[6-4], r->avail_cache[6-1]);
-        r->h.pred8x8[itype](U, s->uvlinesize);
-        dsp->add_pixels_clamped(s->block[4], U, s->uvlinesize);
-        r->h.pred8x8[itype](V, s->uvlinesize);
-        dsp->add_pixels_clamped(s->block[5], V, s->uvlinesize);
-    }
-}
-
-/** @} */ // recons group
-
-/**
- * @addtogroup bitstream
- * Decode macroblock header and return CBP in case of success, -1 otherwise.
- */
-static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types)
-{
-    MpegEncContext *s = &r->s;
-    GetBitContext *gb = &s->gb;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-    int i, t;
-
-    if(!r->si.type){
-        r->is16 = get_bits1(gb);
-        if(!r->is16 && !r->rv30){
-            if(!get_bits1(gb))
-                av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n");
-        }
-        s->current_picture_ptr->mb_type[mb_pos] = r->is16 ? MB_TYPE_INTRA16x16 : MB_TYPE_INTRA;
-        r->block_type = r->is16 ? RV34_MB_TYPE_INTRA16x16 : RV34_MB_TYPE_INTRA;
-    }else{
-        r->block_type = r->decode_mb_info(r);
-        if(r->block_type == -1)
-            return -1;
-        s->current_picture_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type];
-        r->mb_type[mb_pos] = r->block_type;
-        if(r->block_type == RV34_MB_SKIP){
-            if(s->pict_type == FF_P_TYPE)
-                r->mb_type[mb_pos] = RV34_MB_P_16x16;
-            if(s->pict_type == FF_B_TYPE)
-                r->mb_type[mb_pos] = RV34_MB_B_DIRECT;
-        }
-        r->is16 = !!IS_INTRA16x16(s->current_picture_ptr->mb_type[mb_pos]);
-        rv34_decode_mv(r, r->block_type);
-        if(r->block_type == RV34_MB_SKIP){
-            fill_rectangle(intra_types, 4, 4, r->intra_types_stride, 0, sizeof(intra_types[0]));
-            return 0;
-        }
-        r->chroma_vlc = 1;
-        r->luma_vlc   = 0;
-    }
-    if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){
-        if(r->is16){
-            t = get_bits(gb, 2);
-            fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));
-            r->luma_vlc   = 2;
-        }else{
-            if(r->decode_intra_types(r, gb, intra_types) < 0)
-                return -1;
-            r->luma_vlc   = 1;
-        }
-        r->chroma_vlc = 0;
-        r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0);
-    }else{
-        for(i = 0; i < 16; i++)
-            intra_types[(i & 3) + (i>>2) * r->intra_types_stride] = 0;
-        r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1);
-        if(r->mb_type[mb_pos] == RV34_MB_P_MIX16x16){
-            r->is16 = 1;
-            r->chroma_vlc = 1;
-            r->luma_vlc   = 2;
-            r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0);
-        }
-    }
-
-    return rv34_decode_cbp(gb, r->cur_vlcs, r->is16);
-}
-
-/**
- * @addtogroup recons
- * @{
- */
-/**
- * mask for retrieving all bits in coded block pattern
- * corresponding to one 8x8 block
- */
-#define LUMA_CBP_BLOCK_MASK 0x33
-
-#define U_CBP_MASK 0x0F0000
-#define V_CBP_MASK 0xF00000
-
-
-static void rv34_apply_differences(RV34DecContext *r, int cbp)
-{
-    static const int shifts[4] = { 0, 2, 8, 10 };
-    MpegEncContext *s = &r->s;
-    int i;
-
-    for(i = 0; i < 4; i++)
-        if((cbp & (LUMA_CBP_BLOCK_MASK << shifts[i])) || r->block_type == RV34_MB_P_MIX16x16)
-            s->dsp.add_pixels_clamped(s->block[i], s->dest[0] + (i & 1)*8 + (i&2)*4*s->linesize, s->linesize);
-    if(cbp & U_CBP_MASK)
-        s->dsp.add_pixels_clamped(s->block[4], s->dest[1], s->uvlinesize);
-    if(cbp & V_CBP_MASK)
-        s->dsp.add_pixels_clamped(s->block[5], s->dest[2], s->uvlinesize);
-}
-
-static int is_mv_diff_gt_3(int16_t (*motion_val)[2], int step)
-{
-    int d;
-    d = motion_val[0][0] - motion_val[-step][0];
-    if(d < -3 || d > 3)
-        return 1;
-    d = motion_val[0][1] - motion_val[-step][1];
-    if(d < -3 || d > 3)
-        return 1;
-    return 0;
-}
-
-static int rv34_set_deblock_coef(RV34DecContext *r)
-{
-    MpegEncContext *s = &r->s;
-    int hmvmask = 0, vmvmask = 0, i, j;
-    int midx = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride;
-    int16_t (*motion_val)[2] = s->current_picture_ptr->motion_val[0][midx];
-    for(j = 0; j < 16; j += 8){
-        for(i = 0; i < 2; i++){
-            if(is_mv_diff_gt_3(motion_val + i, 1))
-                vmvmask |= 0x11 << (j + i*2);
-            if((j || s->mb_y) && is_mv_diff_gt_3(motion_val + i, s->b8_stride))
-                hmvmask |= 0x03 << (j + i*2);
-        }
-        motion_val += s->b8_stride;
-    }
-    if(s->first_slice_line)
-        hmvmask &= ~0x000F;
-    if(!s->mb_x)
-        vmvmask &= ~0x1111;
-    if(r->rv30){ //RV30 marks both subblocks on the edge for filtering
-        vmvmask |= (vmvmask & 0x4444) >> 1;
-        hmvmask |= (hmvmask & 0x0F00) >> 4;
-        if(s->mb_x)
-            r->deblock_coefs[s->mb_x - 1 + s->mb_y*s->mb_stride] |= (vmvmask & 0x1111) << 3;
-        if(!s->first_slice_line)
-            r->deblock_coefs[s->mb_x + (s->mb_y - 1)*s->mb_stride] |= (hmvmask & 0xF) << 12;
-    }
-    return hmvmask | vmvmask;
-}
-
-static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
-{
-    MpegEncContext *s = &r->s;
-    GetBitContext *gb = &s->gb;
-    int cbp, cbp2;
-    int i, blknum, blkoff;
-    DCTELEM block16[64];
-    int luma_dc_quant;
-    int dist;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-
-    // Calculate which neighbours are available. Maybe it's worth optimizing too.
-    memset(r->avail_cache, 0, sizeof(r->avail_cache));
-    fill_rectangle(r->avail_cache + 6, 2, 2, 4, 1, 4);
-    dist = (s->mb_x - s->resync_mb_x) + (s->mb_y - s->resync_mb_y) * s->mb_width;
-    if(s->mb_x && dist)
-        r->avail_cache[5] =
-        r->avail_cache[9] = s->current_picture_ptr->mb_type[mb_pos - 1];
-    if(dist >= s->mb_width)
-        r->avail_cache[2] =
-        r->avail_cache[3] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride];
-    if(((s->mb_x+1) < s->mb_width) && dist >= s->mb_width - 1)
-        r->avail_cache[4] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride + 1];
-    if(s->mb_x && dist > s->mb_width)
-        r->avail_cache[1] = s->current_picture_ptr->mb_type[mb_pos - s->mb_stride - 1];
-
-    s->qscale = r->si.quant;
-    cbp = cbp2 = rv34_decode_mb_header(r, intra_types);
-    r->cbp_luma  [mb_pos] = cbp;
-    r->cbp_chroma[mb_pos] = cbp >> 16;
-    if(s->pict_type == FF_I_TYPE)
-        r->deblock_coefs[mb_pos] = 0xFFFF;
-    else
-        r->deblock_coefs[mb_pos] = rv34_set_deblock_coef(r) | r->cbp_luma[mb_pos];
-    s->current_picture_ptr->qscale_table[mb_pos] = s->qscale;
-
-    if(cbp == -1)
-        return -1;
-
-    luma_dc_quant = r->block_type == RV34_MB_P_MIX16x16 ? r->luma_dc_quant_p[s->qscale] : r->luma_dc_quant_i[s->qscale];
-    if(r->is16){
-        memset(block16, 0, sizeof(block16));
-        rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0);
-        rv34_dequant4x4_16x16(block16, rv34_qscale_tab[luma_dc_quant],rv34_qscale_tab[s->qscale]);
-        rv34_inv_transform_noround(block16);
-    }
-
-    for(i = 0; i < 16; i++, cbp >>= 1){
-        if(!r->is16 && !(cbp & 1)) continue;
-        blknum = ((i & 2) >> 1) + ((i & 8) >> 2);
-        blkoff = ((i & 1) << 2) + ((i & 4) << 3);
-        if(cbp & 1)
-            rv34_decode_block(s->block[blknum] + blkoff, gb, r->cur_vlcs, r->luma_vlc, 0);
-        rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[s->qscale],rv34_qscale_tab[s->qscale]);
-        if(r->is16) //FIXME: optimize
-            s->block[blknum][blkoff] = block16[(i & 3) | ((i & 0xC) << 1)];
-        rv34_inv_transform(s->block[blknum] + blkoff);
-    }
-    if(r->block_type == RV34_MB_P_MIX16x16)
-        r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1);
-    for(; i < 24; i++, cbp >>= 1){
-        if(!(cbp & 1)) continue;
-        blknum = ((i & 4) >> 2) + 4;
-        blkoff = ((i & 1) << 2) + ((i & 2) << 4);
-        rv34_decode_block(s->block[blknum] + blkoff, gb, r->cur_vlcs, r->chroma_vlc, 1);
-        rv34_dequant4x4(s->block[blknum] + blkoff, rv34_qscale_tab[rv34_chroma_quant[1][s->qscale]],rv34_qscale_tab[rv34_chroma_quant[0][s->qscale]]);
-        rv34_inv_transform(s->block[blknum] + blkoff);
-    }
-    if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos]))
-        rv34_output_macroblock(r, intra_types, cbp2, r->is16);
-    else
-        rv34_apply_differences(r, cbp2);
-
-    return 0;
-}
-
-static int check_slice_end(RV34DecContext *r, MpegEncContext *s)
-{
-    int bits;
-    if(s->mb_y >= s->mb_height)
-        return 1;
-    if(!s->mb_num_left)
-        return 1;
-    if(r->s.mb_skip_run > 1)
-        return 0;
-    bits = r->bits - get_bits_count(&s->gb);
-    if(bits < 0 || (bits < 8 && !show_bits(&s->gb, bits)))
-        return 1;
-    return 0;
-}
-
-static inline int slice_compare(SliceInfo *si1, SliceInfo *si2)
-{
-    return si1->type   != si2->type  ||
-           si1->start  >= si2->start ||
-           si1->width  != si2->width ||
-           si1->height != si2->height||
-           si1->pts    != si2->pts;
-}
-
-static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int buf_size)
-{
-    MpegEncContext *s = &r->s;
-    GetBitContext *gb = &s->gb;
-    int mb_pos;
-    int res;
-
-    init_get_bits(&r->s.gb, buf, buf_size*8);
-    res = r->parse_slice_header(r, gb, &r->si);
-    if(res < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "Incorrect or unknown slice header\n");
-        return -1;
-    }
-
-    if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) {
-        if(s->width != r->si.width || s->height != r->si.height){
-            av_log(s->avctx, AV_LOG_DEBUG, "Changing dimensions to %dx%d\n", r->si.width,r->si.height);
-            MPV_common_end(s);
-            s->width  = r->si.width;
-            s->height = r->si.height;
-            avcodec_set_dimensions(s->avctx, s->width, s->height);
-            if(MPV_common_init(s) < 0)
-                return -1;
-            r->intra_types_stride = s->mb_width*4 + 4;
-            r->intra_types_hist = av_realloc(r->intra_types_hist, r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist));
-            r->intra_types = r->intra_types_hist + r->intra_types_stride * 4;
-            r->mb_type = av_realloc(r->mb_type, r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type));
-            r->cbp_luma   = av_realloc(r->cbp_luma,   r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma));
-            r->cbp_chroma = av_realloc(r->cbp_chroma, r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma));
-            r->deblock_coefs = av_realloc(r->deblock_coefs, r->s.mb_stride * r->s.mb_height * sizeof(*r->deblock_coefs));
-        }
-        s->pict_type = r->si.type ? r->si.type : FF_I_TYPE;
-        if(MPV_frame_start(s, s->avctx) < 0)
-            return -1;
-        ff_er_frame_start(s);
-        r->cur_pts = r->si.pts;
-        if(s->pict_type != FF_B_TYPE){
-            r->last_pts = r->next_pts;
-            r->next_pts = r->cur_pts;
-        }
-        s->mb_x = s->mb_y = 0;
-    }
-
-    r->si.end = end;
-    s->qscale = r->si.quant;
-    r->bits = buf_size*8;
-    s->mb_num_left = r->si.end - r->si.start;
-    r->s.mb_skip_run = 0;
-
-    mb_pos = s->mb_x + s->mb_y * s->mb_width;
-    if(r->si.start != mb_pos){
-        av_log(s->avctx, AV_LOG_ERROR, "Slice indicates MB offset %d, got %d\n", r->si.start, mb_pos);
-        s->mb_x = r->si.start % s->mb_width;
-        s->mb_y = r->si.start / s->mb_width;
-    }
-    memset(r->intra_types_hist, -1, r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist));
-    s->first_slice_line = 1;
-    s->resync_mb_x= s->mb_x;
-    s->resync_mb_y= s->mb_y;
-
-    ff_init_block_index(s);
-    while(!check_slice_end(r, s)) {
-        ff_update_block_index(s);
-        s->dsp.clear_blocks(s->block[0]);
-
-        if(rv34_decode_macroblock(r, r->intra_types + s->mb_x * 4 + 4) < 0){
-            ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_ERROR|DC_ERROR|MV_ERROR);
-            return -1;
-        }
-        if (++s->mb_x == s->mb_width) {
-            s->mb_x = 0;
-            s->mb_y++;
-            ff_init_block_index(s);
-
-            memmove(r->intra_types_hist, r->intra_types, r->intra_types_stride * 4 * sizeof(*r->intra_types_hist));
-            memset(r->intra_types, -1, r->intra_types_stride * 4 * sizeof(*r->intra_types_hist));
-
-            if(r->loop_filter && s->mb_y >= 2)
-                r->loop_filter(r, s->mb_y - 2);
-        }
-        if(s->mb_x == s->resync_mb_x)
-            s->first_slice_line=0;
-        s->mb_num_left--;
-    }
-    ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END);
-
-    return s->mb_y == s->mb_height;
-}
-
-/** @} */ // recons group end
-
-/**
- * Initialize decoder.
- */
-av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
-{
-    RV34DecContext *r = avctx->priv_data;
-    MpegEncContext *s = &r->s;
-
-    MPV_decode_defaults(s);
-    s->avctx= avctx;
-    s->out_format = FMT_H263;
-    s->codec_id= avctx->codec_id;
-
-    s->width = avctx->width;
-    s->height = avctx->height;
-
-    r->s.avctx = avctx;
-    avctx->flags |= CODEC_FLAG_EMU_EDGE;
-    r->s.flags |= CODEC_FLAG_EMU_EDGE;
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-    avctx->has_b_frames = 1;
-    s->low_delay = 0;
-
-    if (MPV_common_init(s) < 0)
-        return -1;
-
-    ff_h264_pred_init(&r->h, CODEC_ID_RV40);
-
-    r->intra_types_stride = 4*s->mb_stride + 4;
-    r->intra_types_hist = av_malloc(r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist));
-    r->intra_types = r->intra_types_hist + r->intra_types_stride * 4;
-
-    r->mb_type = av_mallocz(r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type));
-
-    r->cbp_luma   = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma));
-    r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma));
-    r->deblock_coefs = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->deblock_coefs));
-
-    if(!intra_vlcs[0].cbppattern[0].bits)
-        rv34_init_tables();
-
-    return 0;
-}
-
-static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
-{
-    if(avctx->slice_count) return avctx->slice_offset[n];
-    else                   return AV_RL32(buf + n*8 - 4) == 1 ? AV_RL32(buf + n*8) :  AV_RB32(buf + n*8);
-}
-
-int ff_rv34_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    RV34DecContext *r = avctx->priv_data;
-    MpegEncContext *s = &r->s;
-    AVFrame *pict = data;
-    SliceInfo si;
-    int i;
-    int slice_count;
-    const uint8_t *slices_hdr = NULL;
-    int last = 0;
-
-    /* no supplementary picture */
-    if (buf_size == 0) {
-        /* special case for last picture */
-        if (s->low_delay==0 && s->next_picture_ptr) {
-            *pict= *(AVFrame*)s->next_picture_ptr;
-            s->next_picture_ptr= NULL;
-
-            *data_size = sizeof(AVFrame);
-        }
-        return 0;
-    }
-
-    if(!avctx->slice_count){
-        slice_count = (*buf++) + 1;
-        slices_hdr = buf + 4;
-        buf += 8 * slice_count;
-    }else
-        slice_count = avctx->slice_count;
-
-    //parse first slice header to check whether this frame can be decoded
-    if(get_slice_offset(avctx, slices_hdr, 0) > buf_size){
-        av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
-        return -1;
-    }
-    init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), buf_size-get_slice_offset(avctx, slices_hdr, 0));
-    if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){
-        av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n");
-        return -1;
-    }
-    if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
-        return -1;
-    /* skip b frames if we are in a hurry */
-    if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
-    if(   (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)
-       || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE)
-       ||  avctx->skip_frame >= AVDISCARD_ALL)
-        return buf_size;
-    /* skip everything if we are in a hurry>=5 */
-    if(avctx->hurry_up>=5)
-        return buf_size;
-
-    for(i=0; i<slice_count; i++){
-        int offset= get_slice_offset(avctx, slices_hdr, i);
-        int size;
-        if(i+1 == slice_count)
-            size= buf_size - offset;
-        else
-            size= get_slice_offset(avctx, slices_hdr, i+1) - offset;
-
-        if(offset > buf_size){
-            av_log(avctx, AV_LOG_ERROR, "Slice offset is greater than frame size\n");
-            break;
-        }
-
-        r->si.end = s->mb_width * s->mb_height;
-        if(i+1 < slice_count){
-            init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, i+1), (buf_size-get_slice_offset(avctx, slices_hdr, i+1))*8);
-            if(r->parse_slice_header(r, &r->s.gb, &si) < 0){
-                if(i+2 < slice_count)
-                    size = get_slice_offset(avctx, slices_hdr, i+2) - offset;
-                else
-                    size = buf_size - offset;
-            }else
-                r->si.end = si.start;
-        }
-        last = rv34_decode_slice(r, r->si.end, buf + offset, size);
-        s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start;
-        if(last)
-            break;
-    }
-
-    if(last){
-        if(r->loop_filter)
-            r->loop_filter(r, s->mb_height - 1);
-        ff_er_frame_end(s);
-        MPV_frame_end(s);
-        if (s->pict_type == FF_B_TYPE || s->low_delay) {
-            *pict= *(AVFrame*)s->current_picture_ptr;
-        } else if (s->last_picture_ptr != NULL) {
-            *pict= *(AVFrame*)s->last_picture_ptr;
-        }
-
-        if(s->last_picture_ptr || s->low_delay){
-            *data_size = sizeof(AVFrame);
-            ff_print_debug_info(s, pict);
-        }
-        s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...)
-    }
-    return buf_size;
-}
-
-av_cold int ff_rv34_decode_end(AVCodecContext *avctx)
-{
-    RV34DecContext *r = avctx->priv_data;
-
-    MPV_common_end(&r->s);
-
-    av_freep(&r->intra_types_hist);
-    r->intra_types = NULL;
-    av_freep(&r->mb_type);
-    av_freep(&r->cbp_luma);
-    av_freep(&r->cbp_chroma);
-    av_freep(&r->deblock_coefs);
-
-    return 0;
-}
diff --git a/libavcodec/rv34.h b/libavcodec/rv34.h
deleted file mode 100644
index 24a27ce..0000000
--- a/libavcodec/rv34.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * RV30/40 decoder common data declarations
- * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV30 and RV40 decoder common data declarations
- */
-
-#ifndef AVCODEC_RV34_H
-#define AVCODEC_RV34_H
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-
-#include "h264pred.h"
-
-#define MB_TYPE_SEPARATE_DC 0x01000000
-#define IS_SEPARATE_DC(a)   ((a) & MB_TYPE_SEPARATE_DC)
-
-/**
- * RV30 and RV40 Macroblock types
- */
-enum RV40BlockTypes{
-    RV34_MB_TYPE_INTRA,      ///< Intra macroblock
-    RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block
-    RV34_MB_P_16x16,         ///< P-frame macroblock, one motion frame
-    RV34_MB_P_8x8,           ///< P-frame macroblock, 8x8 motion compensation partitions
-    RV34_MB_B_FORWARD,       ///< B-frame macroblock, forward prediction
-    RV34_MB_B_BACKWARD,      ///< B-frame macroblock, backward prediction
-    RV34_MB_SKIP,            ///< Skipped block
-    RV34_MB_B_DIRECT,        ///< Bidirectionally predicted B-frame macroblock, no motion vectors
-    RV34_MB_P_16x8,          ///< P-frame macroblock, 16x8 motion compensation partitions
-    RV34_MB_P_8x16,          ///< P-frame macroblock, 8x16 motion compensation partitions
-    RV34_MB_B_BIDIR,         ///< Bidirectionally predicted B-frame macroblock, two motion vectors
-    RV34_MB_P_MIX16x16,      ///< P-frame macroblock with DCs in a separate 4x4 block, one motion vector
-    RV34_MB_TYPES
-};
-
-/**
- * VLC tables used by the decoder
- *
- * Intra frame VLC sets do not contain some of those tables.
- */
-typedef struct RV34VLC{
-    VLC cbppattern[2];     ///< VLCs used for pattern of coded block patterns decoding
-    VLC cbp[2][4];         ///< VLCs used for coded block patterns decoding
-    VLC first_pattern[4];  ///< VLCs used for decoding coefficients in the first subblock
-    VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3
-    VLC third_pattern[2];  ///< VLCs used for decoding coefficients in the last subblock
-    VLC coefficient;       ///< VLCs used for decoding big coefficients
-}RV34VLC;
-
-/** essential slice information */
-typedef struct SliceInfo{
-    int type;              ///< slice type (intra, inter)
-    int quant;             ///< quantizer used for this slice
-    int vlc_set;           ///< VLCs used for this slice
-    int start, end;        ///< start and end macroblocks of the slice
-    int width;             ///< coded width
-    int height;            ///< coded height
-    int pts;               ///< frame timestamp
-}SliceInfo;
-
-/** decoder context */
-typedef struct RV34DecContext{
-    MpegEncContext s;
-    int8_t *intra_types_hist;///< old block types, used for prediction
-    int8_t *intra_types;     ///< block types
-    int    intra_types_stride;///< block types array stride
-    const uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes
-    const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes
-
-    RV34VLC *cur_vlcs;       ///< VLC set used for current frame decoding
-    int bits;                ///< slice size in bits
-    H264PredContext h;       ///< functions for 4x4 and 16x16 intra block prediction
-    SliceInfo si;            ///< current slice information
-
-    int *mb_type;            ///< internal macroblock types
-    int block_type;          ///< current block type
-    int luma_vlc;            ///< which VLC set will be used for decoding of luma blocks
-    int chroma_vlc;          ///< which VLC set will be used for decoding of chroma blocks
-    int is16;                ///< current block has additional 16x16 specific features or not
-    int dmv[4][2];           ///< differential motion vectors for the current macroblock
-
-    int rv30;                ///< indicates which RV variasnt is currently decoded
-    int rpr;                 ///< one field size in RV30 slice header
-
-    int cur_pts, last_pts, next_pts;
-
-    uint16_t *cbp_luma;      ///< CBP values for luma subblocks
-    uint8_t  *cbp_chroma;    ///< CBP values for chroma subblocks
-    int      *deblock_coefs; ///< deblock coefficients for each macroblock
-
-    /** 8x8 block available flags (for MV prediction) */
-    DECLARE_ALIGNED(8, uint32_t, avail_cache)[3*4];
-
-    int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si);
-    int (*decode_mb_info)(struct RV34DecContext *r);
-    int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst);
-    void (*loop_filter)(struct RV34DecContext *r, int row);
-}RV34DecContext;
-
-/**
- * common decoding functions
- */
-int ff_rv34_get_start_offset(GetBitContext *gb, int blocks);
-int ff_rv34_decode_init(AVCodecContext *avctx);
-int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt);
-int ff_rv34_decode_end(AVCodecContext *avctx);
-
-#endif /* AVCODEC_RV34_H */
diff --git a/libavcodec/rv34data.h b/libavcodec/rv34data.h
deleted file mode 100644
index 2155084..0000000
--- a/libavcodec/rv34data.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * RealVideo 4 decoder
- * copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * miscellaneous RV30/40 tables
- */
-
-#ifndef AVCODEC_RV34DATA_H
-#define AVCODEC_RV34DATA_H
-
-#include <stdint.h>
-
-/**
- * number of ones in nibble minus one
- */
-static const uint8_t rv34_count_ones[16] = {
-    0, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 2, 1, 2, 2, 3
-};
-
-/**
- * values used to reconstruct coded block pattern
- */
-static const uint8_t rv34_cbp_code[16] = {
-    0x00, 0x20, 0x10, 0x30, 0x02, 0x22, 0x12, 0x32,
-    0x01, 0x21, 0x11, 0x31, 0x03, 0x23, 0x13, 0x33
-};
-
-/**
- * precalculated results of division by three and modulo three for values 0-107
- *
- * A lot of four-tuples in RV40 are represented as c0*27+c1*9+c2*3+c3.
- * This table allows conversion from a value back to a vector.
- */
-static const uint8_t modulo_three_table[108][4] = {
- { 0, 0, 0, 0 }, { 0, 0, 0, 1 }, { 0, 0, 0, 2 }, { 0, 0, 1, 0 },
- { 0, 0, 1, 1 }, { 0, 0, 1, 2 }, { 0, 0, 2, 0 }, { 0, 0, 2, 1 },
- { 0, 0, 2, 2 }, { 0, 1, 0, 0 }, { 0, 1, 0, 1 }, { 0, 1, 0, 2 },
- { 0, 1, 1, 0 }, { 0, 1, 1, 1 }, { 0, 1, 1, 2 }, { 0, 1, 2, 0 },
- { 0, 1, 2, 1 }, { 0, 1, 2, 2 }, { 0, 2, 0, 0 }, { 0, 2, 0, 1 },
- { 0, 2, 0, 2 }, { 0, 2, 1, 0 }, { 0, 2, 1, 1 }, { 0, 2, 1, 2 },
- { 0, 2, 2, 0 }, { 0, 2, 2, 1 }, { 0, 2, 2, 2 }, { 1, 0, 0, 0 },
- { 1, 0, 0, 1 }, { 1, 0, 0, 2 }, { 1, 0, 1, 0 }, { 1, 0, 1, 1 },
- { 1, 0, 1, 2 }, { 1, 0, 2, 0 }, { 1, 0, 2, 1 }, { 1, 0, 2, 2 },
- { 1, 1, 0, 0 }, { 1, 1, 0, 1 }, { 1, 1, 0, 2 }, { 1, 1, 1, 0 },
- { 1, 1, 1, 1 }, { 1, 1, 1, 2 }, { 1, 1, 2, 0 }, { 1, 1, 2, 1 },
- { 1, 1, 2, 2 }, { 1, 2, 0, 0 }, { 1, 2, 0, 1 }, { 1, 2, 0, 2 },
- { 1, 2, 1, 0 }, { 1, 2, 1, 1 }, { 1, 2, 1, 2 }, { 1, 2, 2, 0 },
- { 1, 2, 2, 1 }, { 1, 2, 2, 2 }, { 2, 0, 0, 0 }, { 2, 0, 0, 1 },
- { 2, 0, 0, 2 }, { 2, 0, 1, 0 }, { 2, 0, 1, 1 }, { 2, 0, 1, 2 },
- { 2, 0, 2, 0 }, { 2, 0, 2, 1 }, { 2, 0, 2, 2 }, { 2, 1, 0, 0 },
- { 2, 1, 0, 1 }, { 2, 1, 0, 2 }, { 2, 1, 1, 0 }, { 2, 1, 1, 1 },
- { 2, 1, 1, 2 }, { 2, 1, 2, 0 }, { 2, 1, 2, 1 }, { 2, 1, 2, 2 },
- { 2, 2, 0, 0 }, { 2, 2, 0, 1 }, { 2, 2, 0, 2 }, { 2, 2, 1, 0 },
- { 2, 2, 1, 1 }, { 2, 2, 1, 2 }, { 2, 2, 2, 0 }, { 2, 2, 2, 1 },
- { 2, 2, 2, 2 }, { 3, 0, 0, 0 }, { 3, 0, 0, 1 }, { 3, 0, 0, 2 },
- { 3, 0, 1, 0 }, { 3, 0, 1, 1 }, { 3, 0, 1, 2 }, { 3, 0, 2, 0 },
- { 3, 0, 2, 1 }, { 3, 0, 2, 2 }, { 3, 1, 0, 0 }, { 3, 1, 0, 1 },
- { 3, 1, 0, 2 }, { 3, 1, 1, 0 }, { 3, 1, 1, 1 }, { 3, 1, 1, 2 },
- { 3, 1, 2, 0 }, { 3, 1, 2, 1 }, { 3, 1, 2, 2 }, { 3, 2, 0, 0 },
- { 3, 2, 0, 1 }, { 3, 2, 0, 2 }, { 3, 2, 1, 0 }, { 3, 2, 1, 1 },
- { 3, 2, 1, 2 }, { 3, 2, 2, 0 }, { 3, 2, 2, 1 }, { 3, 2, 2, 2 },
-};
-
-/**
- * quantizer values used for AC and DC coefficients in chroma blocks
- */
-static const uint8_t rv34_chroma_quant[2][32] = {
- {  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-   16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 25 },
- {  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13,
-   14, 15, 15, 16, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23 }
-};
-
-/**
- * This table is used for dequantizing.
- */
-static const uint16_t rv34_qscale_tab[32] = {
-  60,   67,   76,   85,   96,  108,  121,  136,
- 152,  171,  192,  216,  242,  272,  305,  341,
- 383,  432,  481,  544,  606,  683,  767,  854,
- 963, 1074, 1212, 1392, 1566, 1708, 1978, 2211
-};
-
-/**
- * 4x4 dezigzag pattern
- */
-static const uint8_t rv34_dezigzag[16] = {
-  0,  1,  8, 16,
-  9,  2,  3, 10,
- 17, 24, 25, 18,
- 11, 19, 26, 27
-};
-
-/**
- * tables used to translate a quantizer value into a VLC set for decoding
- * The first table is used for intraframes.
- */
-static const uint8_t rv34_quant_to_vlc_set[2][31] = {
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
-   2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3,
-   3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6 },
-};
-
-/**
- * table for obtaining the quantizer difference
- * @todo Use with modified_quant_tab from h263data.h.
- */
-static const uint8_t rv34_dquant_tab[2][32]={
-//  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
-{
-    0, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,10,11,12,13,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28
-},{
-    0, 2, 3, 4, 5, 6, 7, 8, 9,10,11,13,14,15,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,31,31,26
-}
-};
-
-/**
- * maximum number of macroblocks for each of the possible slice offset sizes
- * @todo This is the same as ff_mba_max, maybe use it instead.
- */
-static const uint16_t rv34_mb_max_sizes[6] = { 0x2F, 0x62, 0x18B, 0x62F, 0x18BF, 0x23FF };
-/**
- * bits needed to code the slice offset for the given size
- * @todo This is the same as ff_mba_length, maybe use it instead.
- */
-static const uint8_t rv34_mb_bits_sizes[6] = { 6, 7, 9, 11, 13, 14 };
-
-#endif /* AVCODEC_RV34DATA_H */
diff --git a/libavcodec/rv34vlc.h b/libavcodec/rv34vlc.h
deleted file mode 100644
index 2b89e4c..0000000
--- a/libavcodec/rv34vlc.h
+++ /dev/null
@@ -1,4054 +0,0 @@
-/*
- * RealVideo 3/4 decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV30/40 VLC tables
- */
-
-#ifndef AVCODEC_RV34VLC_H
-#define AVCODEC_RV34VLC_H
-
-#include <stdint.h>
-
-#define NUM_INTRA_TABLES 5
-#define NUM_INTER_TABLES 7
-
-#define CBPPAT_VLC_SIZE   1296
-#define CBP_VLC_SIZE        16
-#define FIRSTBLK_VLC_SIZE  864
-#define OTHERBLK_VLC_SIZE  108
-#define COEFF_VLC_SIZE      32
-
-static const uint8_t rv34_table_intra_cbppat[NUM_INTRA_TABLES][2][CBPPAT_VLC_SIZE] = {
-  {
-    {
-       8, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10,  6,
-      12, 12, 13, 12, 13, 12, 13, 11, 13, 13, 13, 12, 13, 12, 12,  8,
-      14, 13, 16, 13, 15, 13, 16, 12, 16, 16, 16, 14, 16, 13, 14, 10,
-      12, 13, 12, 12, 13, 13, 13, 12, 13, 13, 12, 12, 13, 12, 12,  8,
-      13, 14, 14, 12, 14, 14, 14, 12, 14, 15, 14, 12, 14, 13, 13,  8,
-      16, 16, 16, 12, 16, 16, 16, 13, 16, 16, 16, 13, 16, 14, 14,  9,
-      14, 16, 13, 13, 16, 16, 16, 14, 15, 16, 14, 13, 15, 15, 14, 10,
-      16, 16, 14, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 15, 14, 10,
-      16, 16, 16, 11, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 15,  9,
-      12, 13, 13, 13, 12, 12, 14, 12, 12, 14, 13, 12, 12, 12, 12,  8,
-      14, 14, 16, 14, 13, 12, 14, 12, 14, 15, 14, 13, 13, 12, 13,  8,
-      16, 16, 16, 15, 16, 13, 16, 13, 16, 16, 16, 15, 16, 13, 15, 10,
-      14, 16, 14, 14, 14, 14, 15, 13, 14, 16, 14, 13, 13, 13, 13,  9,
-      16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 14, 13, 14, 13, 13,  8,
-      16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 14, 16, 14, 14,  9,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 14, 10,
-      16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 14, 16, 15, 14,  9,
-      16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 16, 13, 16, 15, 15,  8,
-      14, 16, 16, 16, 14, 14, 16, 14, 16, 16, 16, 15, 13, 13, 14, 10,
-      16, 16, 16, 16, 15, 13, 16, 13, 16, 16, 16, 16, 16, 13, 14, 10,
-      16, 16, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16, 12, 16,  9,
-      16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 14, 14, 10,
-      16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 15, 16, 13, 14,  9,
-      16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16, 13, 14,  8,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 11,
-      16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,  9,
-      16, 16, 16, 14, 16, 15, 16, 11, 16, 16, 16, 14, 16, 14, 14,  8,
-      12, 13, 13, 13, 13, 13, 14, 12, 12, 13, 12, 12, 12, 12, 12,  8,
-      14, 14, 16, 14, 15, 14, 16, 13, 14, 15, 14, 13, 14, 13, 13,  9,
-      16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 14, 16, 14, 16, 10,
-      14, 15, 14, 14, 15, 14, 15, 13, 14, 14, 13, 12, 13, 13, 13,  9,
-      15, 16, 15, 14, 16, 16, 16, 13, 15, 16, 14, 12, 14, 13, 13,  8,
-      16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 13, 16, 14, 14,  9,
-      16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 13, 13, 16, 16, 14, 10,
-      16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 13, 16, 14, 14,  9,
-      16, 16, 16, 12, 16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 15,  8,
-      13, 14, 14, 14, 14, 14, 16, 13, 13, 14, 14, 13, 12, 12, 12,  8,
-      16, 16, 16, 14, 15, 14, 16, 13, 15, 16, 14, 13, 13, 12, 13,  8,
-      16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 14, 16, 13, 14,  9,
-      15, 16, 16, 15, 16, 15, 16, 13, 14, 16, 14, 13, 13, 13, 12,  8,
-      16, 16, 16, 14, 16, 14, 15, 12, 15, 15, 14, 12, 13, 12, 12,  7,
-      16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 13, 16, 13, 13,  7,
-      16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 14, 14, 16, 14, 13,  9,
-      16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 14, 12, 16, 13, 12,  7,
-      16, 16, 16, 12, 16, 16, 16, 11, 16, 16, 15, 12, 16, 13, 13,  6,
-      16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 13, 13, 14, 10,
-      16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 14, 13, 14,  9,
-      16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 16, 16, 12, 14,  8,
-      16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14, 13, 13,  9,
-      16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 13, 14, 12, 12,  7,
-      16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13,  6,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 14,  9,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 15, 13, 12,  7,
-      16, 16, 16, 13, 16, 14, 16, 11, 16, 16, 16, 12, 16, 12, 12,  5,
-      14, 16, 15, 16, 16, 16, 16, 15, 14, 15, 14, 14, 13, 14, 13, 10,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 16, 10,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 14, 15, 14, 13, 10,
-      16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14, 13, 16, 14, 14,  9,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15,  9,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 13, 16, 16, 13, 10,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 16, 13,  9,
-      16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 12, 16, 16, 14,  8,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 15, 14, 13, 13, 13,  9,
-      16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14, 13, 13,  9,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 15,  9,
-      16, 16, 16, 16, 16, 16, 16, 15, 15, 16, 14, 14, 14, 13, 13,  9,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 12, 13, 12, 12,  7,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 16, 13, 13,  7,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 14, 13,  9,
-      16, 16, 16, 15, 16, 16, 16, 13, 16, 16, 13, 12, 14, 13, 12,  6,
-      16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 14, 10, 15, 12, 12,  5,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 13, 13,  9,
-      16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 13, 12, 13,  8,
-      16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 15, 12, 14,  8,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 13, 13, 13,  8,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 15, 13, 12, 11, 12,  6,
-      16, 16, 16, 15, 16, 14, 16, 12, 16, 16, 16, 12, 13, 10, 12,  5,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 13, 14, 12,  8,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 13, 12, 13, 12, 10,  5,
-      16, 16, 16, 13, 16, 13, 16, 10, 16, 16, 13, 10, 13, 10, 10,  1,
-    },
-    {
-       2,  7,  7,  8,  7,  8,  9,  8,  7,  9,  8,  8,  8,  8,  9,  7,
-       6,  9, 10, 10, 10, 10, 11, 10, 10, 11, 11, 11, 10, 11, 11,  9,
-       9, 11, 12, 12, 12, 13, 14, 13, 13, 14, 14, 13, 13, 13, 14, 11,
-       6, 10,  9, 10, 10, 11, 11, 11, 10, 11, 10, 11, 11, 11, 11,  9,
-       6,  9, 10, 10, 10, 11, 12, 11, 10, 12, 11, 11, 11, 11, 11,  8,
-       9, 11, 12, 12, 12, 13, 13, 13, 12, 14, 14, 13, 13, 13, 13, 10,
-       9, 13, 11, 13, 13, 14, 14, 13, 13, 14, 13, 13, 14, 14, 14, 12,
-       9, 12, 12, 12, 12, 14, 14, 13, 13, 14, 13, 13, 13, 14, 13, 11,
-       8, 12, 12, 11, 12, 14, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
-       6, 10, 10, 11,  9, 10, 12, 11, 10, 12, 11, 11, 10, 11, 11,  9,
-       7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 11,  9,
-       9, 12, 13, 13, 12, 12, 14, 13, 13, 14, 14, 13, 14, 13, 14, 11,
-       8, 11, 11, 12, 11, 12, 12, 12, 11, 13, 12, 12, 12, 12, 12, 10,
-       7, 10, 10, 11, 10, 11, 12, 11, 10, 12, 11, 11, 11, 11, 11,  8,
-       9, 11, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 13, 12, 13, 10,
-      10, 13, 13, 14, 14, 14, 15, 14, 14, 15, 14, 15, 14, 14, 14, 12,
-       9, 12, 12, 13, 12, 13, 14, 13, 12, 13, 13, 12, 13, 13, 13, 10,
-       9, 12, 12, 12, 12, 13, 14, 12, 12, 14, 13, 12, 13, 13, 13, 10,
-       9, 12, 13, 13, 11, 13, 14, 13, 13, 14, 14, 14, 12, 13, 13, 11,
-      10, 12, 13, 13, 12, 12, 14, 13, 13, 14, 14, 14, 13, 13, 14, 11,
-      10, 13, 14, 14, 13, 12, 15, 13, 14, 14, 14, 14, 15, 13, 14, 11,
-      11, 14, 14, 14, 13, 14, 15, 14, 14, 15, 15, 14, 13, 14, 14, 12,
-      10, 13, 12, 13, 12, 12, 14, 13, 13, 14, 13, 13, 13, 13, 13, 10,
-      10, 12, 13, 13, 13, 12, 14, 12, 13, 14, 14, 13, 13, 13, 13, 10,
-      13, 15, 16, 16, 15, 15, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
-      11, 14, 14, 14, 14, 14, 15, 14, 14, 15, 15, 14, 14, 14, 15, 11,
-      10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 14, 13, 13, 13, 13, 10,
-       6, 10, 10, 11, 10, 11, 12, 11, 10, 12, 10, 11, 10, 11, 11,  9,
-       8, 11, 11, 12, 11, 12, 13, 12, 11, 12, 12, 12, 12, 12, 12, 10,
-      11, 13, 14, 14, 13, 14, 15, 14, 13, 15, 15, 14, 14, 14, 15, 12,
-       7, 11, 10, 12, 11, 12, 12, 12, 11, 12, 11, 12, 11, 12, 12, 10,
-       7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 11,  9,
-      10, 12, 13, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13, 13, 13, 10,
-      10, 13, 12, 14, 13, 14, 14, 14, 13, 14, 12, 14, 15, 14, 14, 11,
-      10, 12, 12, 12, 12, 13, 14, 13, 13, 14, 13, 12, 13, 13, 13, 10,
-       9, 12, 13, 13, 13, 14, 14, 13, 13, 14, 14, 13, 13, 13, 13, 10,
-       7, 10, 10, 11, 10, 11, 12, 11, 10, 12, 12, 11,  9, 11, 11,  9,
-       7, 10, 11, 11, 10, 11, 12, 11, 10, 12, 12, 11, 11, 11, 11,  9,
-      10, 12, 13, 13, 13, 13, 15, 13, 13, 14, 13, 13, 13, 13, 13, 10,
-       8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 12, 11,  9,
-       6,  9,  9, 10,  9, 10, 10, 10,  9, 11, 10, 10,  9, 10, 10,  7,
-       8, 10, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 11, 11,  8,
-      10, 13, 13, 13, 13, 14, 14, 13, 13, 14, 13, 13, 13, 13, 13, 11,
-       8, 11, 11, 11, 11, 12, 12, 11, 11, 12, 11, 11, 11, 11, 11,  8,
-       8, 11, 11, 11, 11, 12, 12, 10, 11, 12, 12, 11, 11, 11, 11,  8,
-      10, 13, 13, 13, 12, 13, 14, 13, 12, 14, 14, 14, 10, 13, 13, 11,
-      10, 12, 12, 13, 12, 13, 14, 12, 12, 13, 13, 13, 12, 12, 13, 10,
-      11, 13, 14, 14, 13, 13, 14, 13, 13, 15, 14, 13, 13, 13, 13, 10,
-      10, 12, 13, 13, 12, 13, 14, 13, 13, 14, 14, 13, 12, 13, 13, 11,
-       8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 11, 11, 11,  8,
-       9, 11, 12, 12, 11, 11, 12, 11, 12, 12, 12, 11, 12, 11, 11,  8,
-      12, 15, 14, 14, 14, 15, 15, 14, 14, 15, 15, 14, 14, 14, 15, 12,
-      10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 12, 12, 12,  9,
-       9, 11, 11, 11, 11, 11, 12, 10, 11, 12, 12, 11, 11, 11, 11,  7,
-      10, 13, 13, 13, 13, 14, 15, 14, 13, 14, 14, 14, 12, 14, 15, 12,
-      11, 14, 14, 14, 14, 15, 15, 14, 14, 15, 15, 15, 14, 15, 15, 12,
-      13, 16, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 14,
-      10, 13, 13, 14, 13, 15, 14, 14, 13, 15, 13, 14, 14, 14, 14, 12,
-      10, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 13, 13, 13, 14, 11,
-      12, 14, 14, 14, 14, 15, 15, 14, 14, 15, 15, 14, 15, 14, 14, 12,
-      11, 14, 14, 15, 14, 15, 15, 14, 14, 15, 12, 14, 15, 16, 15, 12,
-      11, 13, 13, 14, 13, 14, 14, 14, 14, 14, 13, 13, 14, 14, 14, 11,
-      11, 14, 14, 14, 14, 15, 15, 14, 14, 16, 14, 13, 14, 14, 14, 11,
-      10, 13, 13, 13, 12, 14, 14, 14, 12, 15, 14, 14, 11, 13, 13, 12,
-      10, 12, 13, 14, 12, 13, 14, 13, 13, 14, 14, 13, 12, 13, 13, 11,
-      12, 14, 14, 15, 14, 15, 16, 15, 15, 15, 15, 15, 14, 14, 15, 12,
-      10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 13, 13, 12, 13, 13, 11,
-       9, 11, 11, 12, 11, 12, 12, 11, 11, 12, 12, 11, 11, 11, 11,  9,
-      10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 13, 12, 13, 12, 12,  9,
-      11, 13, 13, 15, 14, 14, 15, 14, 14, 15, 14, 14, 14, 14, 14, 11,
-      10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 11, 11, 12, 12, 12,  8,
-       9, 12, 12, 11, 12, 12, 13, 11, 12, 12, 12, 11, 12, 11, 11,  8,
-      10, 13, 13, 14, 12, 14, 15, 14, 13, 15, 15, 14, 10, 13, 13, 11,
-      11, 13, 14, 13, 13, 14, 14, 13, 13, 14, 14, 14, 11, 13, 13, 11,
-      12, 14, 14, 14, 14, 14, 15, 14, 15, 16, 15, 14, 13, 13, 14, 11,
-      11, 14, 13, 14, 13, 14, 15, 14, 13, 15, 14, 14, 11, 13, 13, 11,
-       9, 12, 12, 12, 11, 12, 13, 11, 12, 13, 12, 11, 10, 11, 11,  8,
-      10, 12, 12, 12, 12, 12, 13, 11, 12, 12, 12, 11, 11, 11, 11,  8,
-      12, 15, 14, 15, 14, 15, 16, 15, 15, 15, 15, 14, 14, 14, 14, 12,
-      10, 12, 12, 12, 12, 12, 13, 11, 12, 13, 12, 11, 11, 11, 11,  8,
-       8, 10, 10, 10, 10, 10, 11,  9, 10, 11, 10,  9, 10,  9,  9,  5,
-    },
-  },
-  {
-    {
-      12, 12, 11,  9, 11, 10, 11,  9, 11, 11, 10,  9,  9,  8,  9,  5,
-      14, 13, 14, 11, 14, 11, 13, 10, 14, 13, 12, 10, 12, 10, 11,  6,
-      16, 13, 16, 12, 16, 12, 16, 11, 16, 14, 16, 12, 15, 12, 13,  8,
-      14, 14, 12, 11, 14, 12, 13, 10, 13, 13, 11, 10, 12, 11, 10,  6,
-      16, 15, 14, 11, 16, 13, 14, 10, 15, 14, 13, 10, 13, 11, 11,  7,
-      16, 16, 16, 11, 16, 14, 16, 11, 16, 16, 15, 12, 15, 13, 13,  8,
-      16, 16, 13, 12, 16, 16, 15, 12, 16, 16, 12, 11, 15, 13, 12,  8,
-      16, 16, 14, 11, 16, 16, 16, 11, 16, 16, 14, 11, 15, 14, 13,  8,
-      16, 16, 15, 10, 16, 16, 16, 10, 16, 16, 15, 11, 16, 14, 14,  8,
-      14, 14, 14, 12, 13, 11, 13, 10, 13, 13, 12, 11, 11, 10, 10,  6,
-      16, 15, 16, 13, 13, 11, 14, 11, 15, 14, 13, 11, 12, 10, 11,  7,
-      16, 15, 16, 14, 16, 11, 16, 11, 16, 16, 16, 13, 16, 12, 13,  8,
-      16, 16, 14, 13, 15, 13, 14, 11, 14, 15, 13, 11, 13, 11, 11,  7,
-      16, 16, 15, 13, 15, 13, 14, 11, 16, 15, 14, 11, 13, 11, 11,  7,
-      16, 16, 16, 13, 16, 13, 16, 11, 16, 16, 16, 12, 16, 12, 13,  8,
-      16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 14, 13, 15, 14, 13,  9,
-      16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 14, 12, 15, 13, 13,  8,
-      16, 16, 16, 12, 16, 16, 16, 11, 16, 16, 15, 12, 16, 13, 13,  7,
-      16, 16, 16, 16, 13, 12, 16, 12, 16, 16, 14, 13, 12, 11, 12,  8,
-      16, 16, 16, 15, 14, 11, 16, 11, 16, 16, 16, 13, 14, 11, 13,  8,
-      16, 16, 16, 16, 15, 10, 16, 11, 16, 16, 16, 14, 15, 11, 13,  8,
-      16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 14, 14, 14, 12, 13,  9,
-      16, 16, 16, 15, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13,  8,
-      16, 16, 16, 14, 16, 12, 16, 11, 16, 16, 16, 13, 15, 12, 13,  7,
-      16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 14, 13,  9,
-      16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 14, 16, 13, 13,  8,
-      16, 16, 16, 14, 16, 14, 16, 10, 16, 16, 16, 13, 16, 13, 13,  7,
-      14, 14, 13, 12, 13, 12, 13, 11, 12, 13, 11, 10, 11, 10, 10,  6,
-      16, 16, 15, 13, 16, 13, 15, 11, 14, 14, 13, 11, 13, 11, 11,  7,
-      16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 13, 16, 13, 14,  9,
-      16, 16, 13, 13, 15, 14, 14, 11, 13, 14, 11, 11, 12, 11, 11,  7,
-      16, 16, 15, 12, 16, 14, 15, 11, 14, 14, 12, 11, 13, 11, 11,  7,
-      16, 16, 16, 13, 16, 14, 16, 12, 16, 16, 14, 12, 16, 13, 13,  8,
-      16, 16, 14, 14, 16, 16, 16, 13, 16, 16, 12, 11, 15, 13, 12,  8,
-      16, 16, 15, 13, 16, 16, 16, 12, 16, 16, 13, 11, 16, 13, 12,  8,
-      16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 14, 11, 16, 14, 13,  7,
-      16, 16, 15, 13, 14, 13, 14, 11, 14, 14, 12, 11, 11, 10, 11,  7,
-      16, 16, 16, 13, 14, 12, 15, 11, 15, 14, 13, 11, 12, 11, 11,  7,
-      16, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 13, 14, 12, 13,  8,
-      16, 16, 15, 13, 15, 14, 14, 12, 14, 14, 12, 11, 12, 11, 11,  7,
-      16, 16, 14, 12, 15, 13, 14, 11, 15, 14, 13, 11, 12, 11, 11,  6,
-      16, 16, 16, 13, 16, 13, 16, 11, 16, 15, 14, 11, 14, 11, 12,  6,
-      16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13, 12, 14, 13, 12,  8,
-      16, 16, 15, 13, 16, 14, 15, 11, 16, 16, 13, 11, 14, 12, 11,  6,
-      16, 16, 16, 12, 16, 14, 15, 11, 16, 16, 13, 10, 14, 12, 12,  6,
-      16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 14, 13, 12, 11, 12,  8,
-      16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 15, 13, 13, 11, 12,  8,
-      16, 16, 16, 15, 16, 12, 16, 12, 16, 16, 16, 14, 14, 11, 13,  7,
-      16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 14, 13, 13, 12, 12,  8,
-      16, 16, 16, 14, 15, 13, 15, 11, 16, 15, 14, 12, 13, 11, 11,  6,
-      16, 16, 16, 14, 16, 12, 15, 11, 16, 16, 15, 12, 14, 11, 12,  6,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 15, 13, 14, 13, 12,  8,
-      16, 16, 16, 14, 16, 14, 16, 12, 16, 16, 14, 12, 13, 12, 11,  6,
-      16, 16, 16, 13, 16, 13, 15, 10, 16, 16, 14, 11, 14, 11, 11,  5,
-      16, 16, 15, 14, 16, 16, 16, 13, 14, 14, 12, 12, 12, 12, 12,  8,
-      16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 13, 14, 13, 13,  9,
-      16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 16, 13, 15,  9,
-      16, 16, 14, 15, 16, 16, 16, 14, 14, 16, 12, 12, 13, 13, 12,  8,
-      16, 16, 16, 14, 16, 16, 16, 13, 16, 15, 13, 12, 14, 12, 12,  8,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 12, 16, 13, 13,  8,
-      16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 11, 11, 15, 14, 12,  8,
-      16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 12, 11, 15, 13, 12,  8,
-      16, 16, 16, 13, 16, 16, 16, 12, 16, 16, 13, 10, 16, 13, 12,  7,
-      16, 16, 16, 16, 16, 15, 16, 13, 14, 16, 13, 13, 12, 12, 12,  8,
-      16, 16, 16, 15, 16, 14, 16, 13, 16, 16, 14, 13, 13, 12, 12,  8,
-      16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 13, 15, 12, 14,  8,
-      16, 16, 16, 15, 16, 16, 16, 13, 14, 16, 13, 12, 12, 12, 11,  8,
-      16, 16, 16, 14, 16, 14, 16, 12, 14, 14, 13, 11, 13, 11, 11,  6,
-      16, 16, 16, 14, 16, 14, 16, 12, 16, 15, 14, 11, 14, 11, 12,  6,
-      16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 12, 12, 14, 13, 11,  8,
-      16, 16, 15, 14, 16, 16, 16, 12, 16, 15, 12, 11, 13, 12, 11,  6,
-      16, 16, 16, 13, 16, 14, 16, 11, 16, 14, 13, 10, 14, 11, 11,  5,
-      16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 15, 13, 11, 11, 11,  8,
-      16, 16, 16, 16, 16, 15, 16, 13, 16, 16, 16, 13, 12, 11, 12,  7,
-      16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 13, 13, 11, 13,  7,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 14, 13, 12, 12, 11,  7,
-      16, 16, 16, 15, 16, 14, 15, 12, 16, 14, 13, 12, 12, 11, 11,  6,
-      16, 16, 16, 14, 16, 13, 15, 11, 16, 14, 14, 11, 13, 10, 11,  5,
-      16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 13, 12, 12, 12, 11,  7,
-      16, 16, 16, 14, 16, 14, 15, 12, 16, 15, 12, 11, 12, 11, 10,  5,
-      16, 16, 16, 13, 16, 13, 14, 10, 16, 14, 12,  9, 12, 10,  9,  3,
-    },
-    {
-       2,  6,  6,  7,  6,  7,  8,  7,  7,  8,  7,  8,  7,  8,  8,  5,
-       5,  8,  9,  9,  9,  9, 12, 10, 10, 11, 10, 10, 10, 11, 11,  8,
-       9, 10, 13, 12, 13, 12, 15, 13, 13, 14, 13, 14, 13, 13, 14, 11,
-       5, 10,  9, 10, 10, 10, 12, 10, 10, 12, 10, 11, 11, 11, 11,  8,
-       6,  9, 10,  9, 10, 11, 12, 10, 10, 12, 11, 11, 10, 11, 11,  8,
-       9, 11, 12, 11, 12, 13, 14, 12, 13, 14, 14, 12, 13, 13, 13, 11,
-      10, 13, 11, 12, 14, 14, 15, 13, 13, 15, 12, 13, 14, 14, 14, 12,
-       9, 12, 12, 12, 13, 13, 15, 13, 13, 14, 13, 13, 14, 13, 15, 11,
-       8, 11, 12, 10, 12, 13, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
-       5,  9, 10, 10,  9, 10, 12, 11, 10, 12, 11, 11,  9, 11, 11,  9,
-       6, 10, 10, 11, 10, 10, 12, 11, 11, 12, 11, 11, 11, 11, 11,  9,
-       9, 11, 13, 13, 12, 11, 14, 12, 13, 15, 13, 13, 14, 13, 14, 11,
-       8, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 13, 12, 12, 12, 10,
-       7, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11, 11, 11, 12,  9,
-       9, 12, 12, 12, 12, 12, 14, 12, 13, 14, 13, 13, 13, 13, 13, 11,
-      11, 14, 13, 15, 15, 16, 16, 15, 15, 16, 15, 15, 16, 16, 15, 13,
-      10, 12, 13, 13, 13, 14, 15, 13, 13, 14, 13, 13, 14, 14, 14, 11,
-       9, 12, 12, 12, 13, 13, 14, 12, 13, 14, 14, 13, 13, 13, 14, 11,
-       9, 13, 13, 13, 11, 12, 15, 13, 13, 15, 14, 14, 11, 13, 14, 11,
-      10, 13, 13, 13, 12, 12, 15, 13, 13, 15, 14, 14, 13, 13, 14, 11,
-      10, 12, 13, 13, 12, 11, 14, 12, 13, 15, 13, 13, 13, 13, 14, 11,
-      11, 14, 15, 15, 13, 14, 16, 14, 14, 16, 16, 14, 14, 15, 15, 13,
-      10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 14, 14, 13, 13, 14, 11,
-      10, 12, 13, 13, 13, 12, 14, 13, 13, 14, 14, 13, 13, 13, 13, 11,
-      13, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
-      12, 15, 15, 15, 14, 15, 16, 14, 15, 16, 16, 15, 16, 15, 15, 13,
-      10, 12, 12, 12, 13, 13, 14, 12, 13, 14, 13, 13, 13, 13, 13, 11,
-       6, 10, 10, 11, 10, 11, 12, 11, 10, 12, 11, 11, 10, 11, 11,  9,
-       8, 11, 12, 12, 12, 12, 13, 12, 12, 13, 12, 13, 12, 13, 13, 10,
-      11, 13, 15, 14, 15, 14, 16, 14, 15, 16, 16, 14, 15, 15, 15, 13,
-       7, 11, 10, 12, 11, 11, 13, 11, 11, 13, 10, 11, 12, 12, 12, 10,
-       7, 11, 11, 11, 11, 11, 13, 11, 11, 13, 11, 12, 12, 12, 12,  9,
-      10, 12, 13, 13, 13, 13, 15, 13, 14, 15, 14, 14, 14, 14, 15, 11,
-      10, 13, 12, 14, 14, 14, 15, 13, 13, 15, 12, 13, 15, 15, 14, 12,
-      10, 13, 12, 12, 13, 13, 15, 14, 13, 15, 13, 13, 14, 14, 14, 11,
-      10, 13, 13, 12, 13, 14, 15, 13, 13, 15, 13, 13, 14, 14, 14, 11,
-       7, 10, 11, 11, 10, 11, 12, 11, 10, 12, 12, 12,  9, 11, 12,  9,
-       7, 11, 11, 11, 11, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12,  9,
-      10, 12, 14, 13, 13, 13, 16, 13, 14, 16, 14, 14, 13, 13, 14, 11,
-       8, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
-       6,  9,  9, 10,  9, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10,  8,
-       8, 11, 11, 11, 12, 11, 13, 11, 12, 13, 12, 12, 12, 12, 12, 10,
-      11, 14, 13, 14, 14, 14, 16, 14, 14, 16, 14, 14, 15, 15, 14, 12,
-       9, 12, 11, 12, 12, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
-       8, 11, 11, 11, 11, 11, 13, 11, 12, 12, 12, 12, 12, 12, 12,  9,
-      10, 13, 14, 13, 11, 13, 14, 14, 13, 15, 15, 14, 10, 13, 14, 11,
-      10, 13, 13, 13, 12, 13, 14, 13, 13, 14, 14, 14, 13, 13, 13, 11,
-      10, 13, 14, 13, 13, 12, 15, 13, 14, 15, 14, 14, 14, 13, 14, 12,
-      11, 14, 14, 14, 13, 13, 15, 14, 14, 15, 14, 15, 13, 14, 14, 12,
-       9, 11, 12, 12, 11, 11, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
-       9, 11, 12, 12, 12, 11, 13, 11, 12, 13, 12, 12, 12, 12, 12, 10,
-      13, 15, 15, 16, 15, 16, 16, 15, 16, 16, 16, 15, 15, 15, 16, 14,
-      10, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 13, 13, 13, 13, 11,
-       8, 11, 11, 11, 11, 11, 12, 11, 11, 12, 12, 11, 12, 11, 12,  9,
-      11, 14, 14, 15, 14, 15, 15, 14, 13, 15, 14, 15, 12, 14, 15, 13,
-      12, 15, 15, 15, 15, 15, 16, 15, 15, 16, 16, 16, 15, 16, 15, 13,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
-      11, 14, 13, 15, 14, 14, 16, 14, 14, 16, 13, 14, 15, 14, 15, 12,
-      11, 14, 13, 14, 14, 14, 16, 15, 14, 16, 14, 14, 15, 15, 15, 12,
-      13, 15, 15, 15, 15, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 13,
-      11, 14, 13, 14, 14, 14, 15, 14, 14, 16, 12, 14, 16, 16, 14, 12,
-      11, 14, 14, 14, 14, 15, 16, 15, 14, 16, 13, 14, 16, 15, 14, 12,
-      12, 14, 14, 14, 14, 14, 16, 14, 15, 16, 14, 14, 14, 15, 15, 12,
-      11, 14, 14, 14, 13, 14, 16, 15, 13, 16, 15, 15, 11, 14, 14, 12,
-      11, 14, 14, 15, 14, 14, 16, 14, 14, 15, 14, 14, 13, 15, 15, 12,
-      13, 15, 16, 15, 15, 15, 16, 15, 16, 16, 16, 16, 15, 15, 16, 13,
-      11, 14, 14, 14, 14, 14, 15, 14, 14, 16, 14, 14, 14, 15, 14, 12,
-       9, 12, 12, 12, 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 12, 10,
-      11, 13, 13, 13, 13, 13, 14, 13, 13, 14, 13, 14, 13, 13, 14, 11,
-      12, 15, 14, 15, 15, 15, 16, 15, 14, 16, 14, 14, 16, 16, 14, 13,
-      10, 12, 12, 12, 12, 12, 14, 12, 13, 13, 12, 12, 13, 13, 13, 10,
-      10, 12, 12, 12, 12, 12, 14, 12, 12, 13, 12, 12, 12, 12, 12, 10,
-      10, 14, 14, 14, 12, 14, 16, 14, 13, 16, 16, 16, 10, 13, 14, 12,
-      11, 14, 14, 14, 13, 14, 16, 14, 14, 16, 15, 14, 12, 13, 14, 12,
-      12, 14, 14, 14, 14, 14, 16, 14, 14, 16, 15, 15, 14, 14, 15, 12,
-      12, 14, 15, 15, 14, 15, 16, 14, 15, 15, 15, 15, 13, 15, 14, 12,
-       9, 12, 12, 12, 12, 13, 13, 12, 12, 13, 13, 12, 11, 12, 12, 10,
-      10, 12, 12, 12, 12, 12, 13, 12, 12, 13, 12, 12, 12, 12, 12, 10,
-      13, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 15, 13,
-      10, 12, 12, 13, 12, 13, 13, 12, 13, 14, 13, 13, 12, 13, 13, 10,
-       7, 10, 10, 10, 10, 10, 11, 10, 10, 11, 10, 10, 10, 10, 10,  7,
-    },
-  },
-  {
-    {
-      10, 10,  9,  8,  9,  8,  9,  7,  9,  9,  8,  7,  8,  7,  7,  4,
-      13, 11, 12,  9, 12,  9, 12,  9, 12, 11, 11,  9, 10,  9,  9,  6,
-      15, 12, 15, 11, 14, 10, 14, 10, 14, 13, 13, 11, 13, 11, 12,  7,
-      13, 12, 11,  9, 12, 11, 12,  9, 12, 12, 10,  9, 10, 10,  9,  6,
-      14, 13, 12, 10, 13, 12, 13,  9, 13, 12, 11, 10, 12, 11, 10,  6,
-      16, 14, 14, 10, 15, 13, 14, 10, 15, 15, 14, 11, 14, 12, 12,  8,
-      15, 14, 12, 11, 15, 14, 13, 11, 14, 14, 11, 10, 13, 12, 11,  8,
-      15, 16, 13, 11, 16, 14, 14, 11, 15, 15, 12, 10, 14, 13, 12,  8,
-      16, 15, 14, 10, 16, 14, 14, 10, 16, 15, 14, 10, 14, 13, 12,  7,
-      13, 12, 12, 11, 11,  9, 12,  9, 12, 12, 11, 10, 10,  9,  9,  6,
-      13, 13, 14, 12, 12, 10, 12, 10, 14, 13, 12, 11, 11, 10, 10,  7,
-      16, 14, 16, 13, 14, 11, 15, 10, 16, 15, 14, 12, 14, 11, 12,  8,
-      14, 14, 13, 12, 13, 12, 13, 10, 13, 13, 12, 11, 11, 10, 10,  7,
-      15, 14, 14, 12, 14, 12, 13, 10, 14, 13, 12, 11, 12, 11, 11,  7,
-      16, 15, 16, 13, 15, 13, 15, 10, 16, 15, 14, 12, 14, 12, 12,  7,
-      15, 16, 14, 13, 16, 14, 14, 12, 15, 15, 12, 12, 13, 12, 12,  8,
-      16, 16, 14, 13, 16, 14, 14, 11, 15, 15, 14, 11, 14, 12, 12,  8,
-      16, 16, 15, 12, 16, 14, 15, 10, 16, 16, 13, 12, 14, 13, 12,  7,
-      14, 14, 14, 13, 13, 11, 13, 11, 14, 14, 13, 12, 11, 10, 11,  8,
-      16, 15, 16, 13, 13, 11, 14, 11, 15, 14, 14, 13, 12, 11, 12,  8,
-      15, 15, 16, 14, 14, 10, 14, 10, 16, 15, 15, 13, 14, 10, 12,  8,
-      16, 16, 16, 14, 15, 13, 14, 12, 15, 15, 13, 13, 13, 12, 12,  8,
-      16, 16, 16, 14, 15, 13, 14, 11, 16, 16, 14, 13, 13, 12, 12,  8,
-      16, 16, 16, 14, 16, 12, 15, 11, 16, 15, 15, 13, 14, 12, 12,  8,
-      16, 16, 16, 16, 16, 15, 15, 13, 16, 16, 14, 13, 14, 13, 12,  9,
-      16, 16, 16, 14, 16, 15, 15, 11, 16, 16, 14, 13, 15, 13, 12,  8,
-      16, 16, 16, 14, 16, 14, 14, 10, 16, 16, 15, 13, 14, 12, 12,  7,
-      12, 12, 12, 11, 12, 11, 12, 10, 11, 11, 10,  9,  9,  9,  9,  6,
-      14, 13, 14, 12, 13, 12, 13, 10, 13, 13, 12, 10, 12, 10, 11,  7,
-      16, 14, 16, 13, 15, 13, 16, 12, 15, 14, 14, 12, 14, 12, 13,  8,
-      14, 14, 13, 11, 14, 12, 13, 11, 12, 12, 10, 10, 11, 10, 10,  7,
-      14, 14, 13, 12, 14, 12, 13, 11, 13, 13, 12, 10, 12, 11, 10,  7,
-      16, 15, 15, 12, 16, 14, 15, 11, 16, 14, 13, 11, 14, 12, 12,  8,
-      16, 16, 13, 13, 16, 15, 14, 12, 14, 14, 11, 11, 13, 12, 11,  8,
-      16, 16, 14, 12, 16, 14, 14, 12, 15, 14, 12, 11, 14, 12, 12,  8,
-      16, 15, 14, 11, 16, 15, 15, 11, 16, 15, 13, 11, 14, 13, 12,  8,
-      14, 13, 13, 12, 13, 11, 13, 10, 12, 13, 11, 10, 10, 10, 10,  7,
-      15, 14, 14, 13, 13, 12, 13, 11, 14, 13, 12, 11, 12, 10, 11,  7,
-      16, 15, 16, 14, 15, 12, 15, 11, 16, 14, 14, 12, 14, 11, 12,  8,
-      14, 15, 13, 12, 14, 13, 13, 11, 13, 13, 11, 11, 11, 10, 10,  7,
-      14, 14, 14, 12, 14, 13, 13, 10, 14, 13, 12, 10, 12, 10, 10,  6,
-      16, 15, 15, 13, 16, 13, 15, 11, 15, 14, 13, 11, 13, 11, 11,  7,
-      16, 16, 14, 13, 16, 15, 14, 12, 15, 15, 12, 11, 13, 12, 11,  8,
-      16, 16, 14, 13, 16, 14, 14, 11, 15, 14, 12, 11, 13, 12, 11,  7,
-      16, 16, 15, 12, 16, 14, 14, 11, 15, 15, 13, 11, 14, 12, 11,  6,
-      16, 15, 15, 14, 14, 12, 14, 12, 13, 14, 13, 12, 11, 11, 11,  8,
-      16, 16, 16, 14, 14, 12, 15, 12, 15, 14, 14, 12, 12, 11, 12,  8,
-      16, 16, 16, 15, 14, 12, 15, 12, 16, 15, 14, 13, 13, 11, 12,  8,
-      16, 16, 16, 15, 15, 14, 15, 12, 14, 14, 13, 12, 12, 11, 11,  8,
-      16, 16, 15, 14, 14, 12, 14, 11, 14, 14, 13, 12, 12, 11, 11,  7,
-      16, 16, 16, 14, 15, 12, 14, 11, 15, 15, 14, 12, 13, 11, 12,  7,
-      16, 16, 16, 16, 16, 15, 16, 13, 15, 15, 14, 12, 13, 12, 11,  8,
-      16, 16, 16, 14, 15, 14, 14, 12, 16, 15, 13, 12, 13, 12, 11,  7,
-      16, 16, 16, 13, 16, 13, 14, 10, 16, 15, 14, 11, 13, 11, 11,  6,
-      14, 15, 13, 13, 14, 13, 14, 12, 12, 13, 11, 11, 11, 11, 10,  8,
-      16, 16, 15, 13, 16, 14, 16, 13, 14, 14, 13, 12, 13, 12, 12,  8,
-      16, 16, 16, 14, 16, 14, 16, 13, 16, 14, 15, 13, 15, 13, 13,  9,
-      15, 15, 14, 14, 15, 14, 14, 12, 13, 14, 11, 11, 12, 12, 11,  8,
-      15, 16, 15, 13, 15, 14, 14, 12, 14, 14, 12, 11, 13, 12, 12,  8,
-      16, 16, 16, 13, 16, 15, 15, 13, 16, 15, 14, 11, 15, 12, 13,  8,
-      16, 16, 14, 13, 16, 15, 15, 13, 14, 14, 10, 11, 14, 12, 11,  8,
-      16, 16, 15, 13, 16, 16, 15, 13, 15, 14, 12, 11, 14, 13, 12,  8,
-      16, 16, 15, 13, 16, 15, 16, 12, 16, 14, 13, 10, 15, 13, 12,  7,
-      15, 15, 15, 14, 14, 14, 15, 12, 13, 14, 12, 12, 11, 11, 11,  8,
-      16, 15, 16, 14, 15, 13, 15, 12, 14, 14, 13, 12, 12, 11, 12,  8,
-      16, 16, 16, 15, 16, 14, 16, 13, 16, 15, 14, 12, 14, 11, 13,  8,
-      16, 16, 15, 14, 16, 14, 15, 13, 14, 14, 12, 11, 12, 11, 11,  8,
-      15, 16, 15, 14, 15, 14, 14, 12, 14, 13, 12, 11, 12, 11, 11,  7,
-      16, 16, 16, 14, 16, 13, 16, 12, 15, 14, 13, 11, 13, 11, 12,  7,
-      16, 16, 15, 14, 16, 15, 15, 13, 14, 15, 11, 11, 13, 12, 11,  8,
-      16, 16, 15, 13, 16, 14, 15, 12, 15, 14, 12, 11, 13, 11, 11,  7,
-      16, 16, 15, 13, 16, 14, 16, 12, 15, 14, 13, 10, 13, 11, 11,  6,
-      16, 16, 16, 14, 14, 14, 15, 13, 14, 14, 14, 12, 11, 11, 11,  8,
-      16, 16, 16, 14, 15, 14, 16, 13, 15, 14, 14, 13, 12, 11, 11,  7,
-      16, 16, 16, 16, 15, 13, 16, 12, 15, 15, 14, 12, 13, 10, 12,  7,
-      16, 16, 16, 14, 15, 15, 14, 13, 14, 14, 13, 12, 12, 11, 11,  8,
-      16, 15, 16, 14, 16, 13, 15, 12, 14, 14, 13, 12, 12, 10, 10,  6,
-      16, 15, 16, 14, 16, 13, 16, 11, 16, 14, 13, 11, 13, 10, 11,  6,
-      16, 16, 16, 15, 16, 16, 15, 13, 14, 16, 12, 12, 12, 12, 10,  7,
-      16, 16, 16, 14, 16, 14, 14, 12, 15, 15, 12, 11, 12, 11, 10,  6,
-      16, 16, 16, 13, 16, 13, 15, 10, 15, 14, 13, 10, 13, 10, 10,  4,
-    },
-    {
-       1,  6,  6,  7,  6,  7,  9,  8,  7,  9,  7,  8,  7,  8,  8,  6,
-       6,  9, 10, 10, 10, 10, 12, 11, 10, 12, 11, 11, 11, 11, 12,  9,
-       9, 10, 13, 11, 13, 12, 14, 13, 14, 14, 14, 14, 14, 14, 14, 12,
-       6, 10,  9, 10, 10, 11, 13, 11, 11, 13, 10, 12, 11, 12, 12,  9,
-       6, 10, 10, 10, 10, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12,  9,
-       9, 11, 13, 12, 13, 14, 15, 13, 14, 16, 14, 14, 14, 14, 15, 12,
-      10, 13, 11, 13, 14, 14, 16, 14, 14, 15, 13, 14, 15, 15, 16, 12,
-       9, 13, 12, 12, 14, 14, 16, 14, 14, 15, 14, 14, 15, 15, 15, 12,
-       8, 11, 12, 11, 13, 14, 15, 13, 13, 15, 14, 14, 13, 15, 15, 11,
-       6, 10, 10, 11,  9, 10, 13, 11, 10, 13, 11, 12, 10, 12, 12,  9,
-       6, 10, 10, 11, 11, 10, 13, 11, 11, 13, 11, 12, 12, 12, 13, 10,
-       9, 12, 13, 13, 13, 12, 16, 13, 14, 15, 14, 14, 15, 14, 15, 12,
-       8, 12, 12, 13, 12, 13, 15, 14, 13, 15, 13, 14, 13, 13, 14, 11,
-       7, 11, 11, 12, 11, 12, 13, 12, 12, 13, 12, 13, 12, 13, 13, 10,
-       9, 12, 13, 13, 13, 13, 16, 13, 13, 15, 14, 14, 14, 15, 15, 12,
-      11, 15, 14, 15, 15, 16, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
-      10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 15, 15, 15, 15, 16, 13,
-       9, 12, 13, 13, 13, 14, 16, 14, 13, 15, 14, 14, 14, 16, 15, 12,
-      10, 13, 14, 14, 11, 13, 16, 14, 14, 16, 15, 15, 12, 14, 15, 12,
-      10, 13, 14, 14, 12, 12, 16, 15, 14, 16, 15, 15, 14, 14, 16, 12,
-       9, 12, 13, 14, 13, 11, 16, 13, 14, 15, 13, 14, 14, 14, 15, 12,
-      11, 15, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 13, 14, 14, 13, 14, 16, 15, 14, 16, 16, 16, 14, 15, 16, 13,
-      10, 13, 13, 14, 13, 13, 16, 13, 13, 14, 14, 15, 15, 14, 15, 13,
-      13, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
-      12, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 12, 13, 14, 13, 13, 14, 13, 13, 14, 13, 14, 14, 14, 15, 12,
-       6, 10, 11, 11, 10, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 10,
-       8, 12, 13, 13, 12, 13, 14, 14, 13, 15, 14, 14, 14, 14, 15, 12,
-      12, 14, 16, 15, 15, 15, 16, 15, 16, 16, 16, 16, 16, 16, 16, 14,
-       7, 11, 11, 12, 12, 12, 14, 13, 12, 14, 11, 12, 13, 13, 13, 11,
-       8, 11, 12, 12, 12, 12, 14, 13, 12, 14, 12, 13, 13, 14, 14, 11,
-      11, 13, 14, 14, 14, 14, 16, 15, 15, 16, 15, 15, 16, 16, 16, 13,
-      10, 14, 12, 14, 14, 15, 16, 15, 13, 16, 12, 14, 16, 16, 15, 13,
-      10, 13, 13, 14, 14, 15, 16, 15, 14, 16, 14, 15, 15, 16, 16, 12,
-      10, 13, 14, 13, 14, 14, 16, 15, 14, 16, 15, 15, 14, 16, 16, 13,
-       7, 11, 11, 11, 10, 12, 14, 13, 11, 14, 13, 13, 10, 12, 13, 10,
-       8, 11, 12, 12, 11, 12, 14, 13, 12, 15, 13, 13, 12, 13, 14, 11,
-      11, 13, 14, 14, 14, 14, 16, 15, 14, 16, 15, 16, 16, 16, 16, 14,
-       8, 12, 12, 13, 12, 13, 15, 14, 12, 15, 13, 13, 13, 14, 14, 11,
-       6, 10, 10, 11, 10, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12,  9,
-       9, 12, 13, 13, 13, 13, 14, 13, 13, 15, 14, 14, 14, 14, 14, 12,
-      11, 15, 14, 15, 14, 15, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
-       9, 13, 12, 13, 13, 13, 15, 14, 13, 14, 13, 14, 14, 15, 14, 12,
-       9, 12, 12, 12, 12, 13, 14, 13, 13, 14, 13, 13, 13, 13, 14, 11,
-      10, 13, 15, 14, 12, 14, 16, 14, 14, 16, 15, 15, 12, 14, 16, 12,
-      10, 14, 14, 14, 13, 14, 16, 15, 14, 16, 16, 16, 13, 14, 16, 13,
-      11, 13, 14, 14, 14, 13, 16, 14, 14, 16, 15, 15, 15, 15, 16, 13,
-      11, 15, 15, 15, 14, 15, 16, 16, 15, 16, 16, 16, 14, 16, 16, 13,
-       9, 13, 13, 13, 12, 13, 15, 14, 13, 15, 14, 14, 13, 14, 15, 11,
-       9, 12, 12, 13, 12, 12, 14, 13, 13, 14, 13, 14, 14, 14, 14, 11,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
-      11, 14, 14, 15, 15, 14, 16, 16, 14, 16, 14, 15, 15, 16, 16, 12,
-       9, 12, 12, 13, 12, 12, 14, 12, 12, 14, 13, 13, 13, 13, 14, 11,
-      11, 14, 14, 16, 14, 16, 16, 16, 13, 16, 14, 16, 14, 16, 16, 13,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 15, 14, 16, 14, 15, 16, 16, 15, 16, 14, 15, 16, 16, 16, 13,
-      11, 15, 14, 16, 15, 16, 16, 16, 15, 16, 15, 16, 16, 16, 16, 14,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      11, 14, 13, 14, 15, 14, 16, 15, 14, 16, 12, 14, 16, 16, 15, 13,
-      11, 14, 14, 16, 14, 15, 16, 16, 15, 16, 14, 15, 16, 16, 16, 14,
-      12, 14, 14, 15, 14, 16, 16, 15, 14, 16, 15, 15, 15, 16, 16, 13,
-      11, 14, 15, 15, 13, 15, 16, 16, 14, 16, 16, 16, 12, 15, 15, 13,
-      11, 15, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
-      11, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-      10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 14, 15, 14, 14, 15, 12,
-      12, 15, 14, 16, 14, 15, 16, 15, 15, 16, 15, 15, 16, 15, 16, 13,
-      12, 16, 14, 16, 15, 16, 16, 16, 16, 16, 14, 15, 16, 16, 16, 14,
-      10, 13, 13, 14, 14, 13, 16, 14, 13, 16, 13, 14, 15, 15, 15, 12,
-      10, 13, 13, 14, 13, 13, 16, 14, 14, 15, 14, 14, 14, 14, 15, 12,
-      10, 14, 15, 14, 13, 15, 16, 15, 14, 16, 16, 16, 11, 14, 16, 12,
-      11, 14, 14, 16, 14, 15, 16, 15, 15, 16, 16, 16, 13, 15, 16, 13,
-      12, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13,
-      12, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
-      10, 13, 14, 14, 13, 14, 16, 14, 13, 16, 15, 14, 12, 14, 16, 11,
-      10, 13, 13, 14, 13, 14, 16, 14, 14, 15, 14, 14, 13, 14, 14, 11,
-      13, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      11, 13, 14, 15, 14, 14, 16, 15, 14, 16, 14, 15, 14, 15, 16, 12,
-       8, 11, 11, 11, 11, 12, 13, 12, 11, 13, 11, 12, 11, 12, 12,  9,
-    },
-  },
-  {
-    {
-       8,  8,  8,  7,  8,  7,  8,  6,  8,  8,  7,  6,  7,  6,  6,  4,
-      11, 10, 11,  9, 11,  9, 11,  8, 11, 10, 10,  9, 10,  8,  9,  6,
-      13, 11, 13, 10, 12, 10, 13,  9, 13, 12, 13, 10, 12, 10, 11,  7,
-      11, 11, 10,  9, 11, 10, 11,  9, 10, 11,  9,  8, 10,  9,  9,  6,
-      12, 12, 11,  9, 12, 11, 12,  9, 12, 12, 11,  9, 11, 10, 10,  7,
-      14, 13, 13, 10, 15, 12, 13, 10, 15, 13, 13, 10, 13, 12, 12,  8,
-      13, 13, 11, 10, 14, 13, 12, 10, 13, 13, 10, 10, 12, 11, 10,  8,
-      15, 14, 13, 10, 14, 13, 13, 10, 14, 13, 12, 10, 13, 12, 11,  8,
-      14, 14, 13, 10, 16, 13, 13, 10, 15, 14, 13, 10, 13, 12, 12,  8,
-      11, 11, 11, 10, 10,  9, 10,  9, 10, 10, 10,  9,  9,  8,  9,  6,
-      12, 12, 12, 11, 11,  9, 12,  9, 12, 12, 11, 10, 11,  9, 10,  7,
-      14, 13, 14, 12, 13, 10, 13, 10, 15, 13, 14, 12, 12, 10, 12,  8,
-      13, 13, 12, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10,  7,
-      14, 13, 13, 11, 13, 12, 12, 10, 13, 13, 12, 11, 12, 10, 10,  7,
-      16, 15, 15, 12, 14, 12, 13, 10, 15, 14, 13, 12, 13, 12, 12,  8,
-      15, 15, 13, 13, 14, 14, 14, 12, 14, 14, 12, 11, 13, 12, 11,  8,
-      15, 16, 14, 12, 15, 14, 13, 11, 15, 15, 13, 12, 13, 12, 11,  8,
-      16, 15, 15, 12, 16, 14, 14, 10, 15, 15, 14, 12, 14, 12, 12,  8,
-      13, 13, 13, 13, 11, 10, 12, 10, 12, 13, 12, 11, 10, 10, 10,  8,
-      14, 13, 14, 13, 12, 10, 13, 10, 14, 14, 13, 12, 12, 10, 11,  8,
-      15, 14, 16, 14, 13, 10, 14, 10, 16, 14, 14, 13, 13, 10, 12,  8,
-      15, 15, 14, 14, 14, 13, 13, 12, 14, 14, 13, 12, 12, 11, 11,  9,
-      15, 15, 15, 14, 14, 12, 14, 11, 15, 14, 13, 13, 13, 11, 11,  8,
-      16, 15, 16, 14, 15, 12, 14, 11, 16, 16, 15, 13, 14, 12, 12,  8,
-      16, 16, 16, 14, 15, 14, 14, 12, 15, 15, 14, 13, 13, 12, 11,  9,
-      16, 16, 15, 15, 16, 14, 14, 11, 16, 16, 14, 13, 14, 12, 12,  8,
-      16, 16, 16, 13, 15, 13, 14, 10, 16, 16, 15, 13, 14, 12, 12,  8,
-      11, 11, 11, 10, 11, 10, 11,  9, 10, 10,  9,  8,  9,  9,  9,  6,
-      12, 12, 13, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10,  7,
-      15, 13, 15, 12, 14, 13, 14, 11, 14, 13, 13, 11, 13, 11, 12,  8,
-      12, 13, 12, 11, 13, 11, 12, 10, 11, 12, 10,  9, 11, 10, 10,  7,
-      14, 13, 13, 11, 14, 12, 13, 11, 12, 12, 11, 10, 12, 11, 10,  7,
-      15, 14, 15, 12, 15, 13, 15, 11, 15, 14, 13, 11, 13, 12, 12,  8,
-      14, 14, 13, 12, 15, 14, 13, 12, 13, 13, 11, 10, 13, 12, 11,  8,
-      16, 15, 13, 12, 15, 14, 14, 12, 14, 14, 12, 11, 14, 12, 11,  8,
-      16, 15, 14, 12, 16, 15, 15, 11, 15, 14, 13, 11, 14, 13, 12,  8,
-      12, 12, 12, 11, 12, 11, 12, 10, 11, 11, 11, 10, 10,  9,  9,  7,
-      13, 13, 14, 12, 13, 11, 13, 11, 13, 12, 12, 11, 11, 10, 10,  7,
-      15, 14, 16, 13, 14, 12, 14, 11, 14, 14, 14, 12, 13, 11, 12,  8,
-      13, 13, 13, 12, 13, 12, 13, 11, 12, 12, 11, 10, 11, 10, 10,  7,
-      14, 14, 13, 12, 13, 12, 13, 10, 13, 13, 11, 10, 12, 10, 10,  7,
-      16, 15, 15, 13, 15, 12, 14, 11, 15, 14, 13, 11, 13, 11, 11,  7,
-      15, 16, 14, 13, 15, 14, 14, 12, 14, 14, 12, 11, 13, 12, 11,  8,
-      16, 15, 14, 13, 15, 14, 14, 11, 14, 14, 12, 11, 13, 12, 11,  7,
-      16, 15, 15, 12, 16, 14, 14, 11, 15, 14, 13, 11, 14, 12, 11,  7,
-      14, 15, 14, 14, 13, 12, 13, 12, 13, 13, 12, 12, 11, 10, 11,  8,
-      15, 15, 15, 14, 13, 12, 14, 12, 14, 14, 13, 12, 12, 11, 11,  8,
-      16, 15, 16, 14, 14, 12, 15, 12, 16, 14, 14, 13, 13, 11, 12,  8,
-      15, 15, 15, 14, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11,  8,
-      15, 15, 15, 14, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11,  7,
-      16, 15, 16, 14, 15, 12, 15, 11, 15, 14, 14, 12, 13, 11, 12,  7,
-      16, 16, 16, 15, 16, 15, 14, 13, 15, 15, 13, 12, 13, 12, 11,  9,
-      16, 16, 16, 14, 15, 14, 14, 12, 15, 15, 13, 12, 14, 12, 11,  8,
-      16, 16, 16, 14, 16, 14, 14, 11, 15, 15, 14, 12, 14, 12, 11,  7,
-      13, 13, 13, 12, 13, 12, 13, 11, 11, 12, 11, 10, 10, 10, 10,  8,
-      15, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 13, 11, 11,  8,
-      16, 15, 16, 14, 16, 14, 16, 13, 15, 14, 14, 12, 14, 12, 13,  9,
-      14, 15, 13, 13, 14, 13, 14, 12, 12, 13, 11, 11, 12, 11, 11,  8,
-      15, 15, 14, 13, 15, 14, 14, 12, 13, 13, 12, 11, 13, 12, 11,  8,
-      16, 16, 16, 13, 16, 15, 16, 13, 15, 14, 14, 12, 14, 13, 13,  9,
-      14, 15, 13, 13, 16, 15, 15, 13, 13, 14, 11, 11, 13, 12, 11,  9,
-      16, 16, 14, 13, 16, 15, 16, 13, 14, 14, 12, 11, 14, 13, 12,  8,
-      16, 16, 15, 12, 16, 15, 15, 12, 15, 14, 13, 11, 14, 13, 12,  8,
-      14, 14, 14, 13, 14, 13, 14, 12, 12, 13, 12, 11, 11, 11, 11,  8,
-      15, 15, 15, 14, 14, 13, 15, 12, 14, 13, 13, 12, 12, 11, 11,  8,
-      16, 16, 16, 15, 15, 14, 16, 13, 15, 14, 14, 12, 14, 12, 12,  9,
-      15, 15, 14, 14, 14, 14, 14, 13, 13, 14, 12, 11, 12, 11, 11,  8,
-      15, 15, 15, 13, 15, 14, 14, 12, 13, 13, 12, 11, 12, 11, 11,  7,
-      16, 15, 16, 14, 16, 14, 15, 12, 15, 14, 14, 12, 13, 12, 12,  8,
-      16, 16, 15, 14, 16, 15, 15, 13, 14, 14, 12, 11, 13, 12, 11,  8,
-      16, 16, 15, 13, 16, 14, 14, 12, 14, 15, 12, 11, 13, 12, 11,  7,
-      16, 16, 16, 13, 16, 15, 15, 12, 15, 14, 13, 11, 14, 12, 11,  7,
-      15, 15, 15, 14, 13, 13, 14, 13, 13, 14, 13, 12, 11, 11, 11,  8,
-      16, 16, 16, 14, 15, 13, 15, 12, 14, 14, 14, 13, 12, 11, 12,  8,
-      16, 16, 16, 14, 15, 13, 15, 12, 15, 14, 14, 12, 13, 11, 12,  8,
-      15, 16, 16, 14, 15, 14, 15, 13, 14, 14, 12, 12, 11, 11, 11,  8,
-      16, 15, 15, 14, 15, 14, 14, 12, 14, 14, 13, 12, 12, 11, 11,  7,
-      16, 16, 16, 13, 15, 13, 15, 12, 15, 14, 14, 12, 13, 11, 11,  7,
-      16, 16, 16, 15, 15, 16, 15, 13, 14, 14, 12, 12, 12, 12, 11,  8,
-      16, 16, 16, 14, 16, 14, 14, 12, 15, 15, 13, 11, 12, 11, 10,  7,
-      16, 16, 15, 13, 16, 14, 14, 11, 15, 14, 13, 10, 13, 11, 10,  5,
-    },
-    {
-       1,  6,  6,  7,  6,  7,  9,  7,  6,  9,  7,  8,  7,  8,  8,  5,
-       5,  8, 10, 10, 10, 10, 12, 11, 11, 12, 11, 11, 11, 12, 12,  9,
-       9, 10, 12, 11, 13, 12, 15, 13, 14, 15, 15, 14, 14, 15, 15, 12,
-       6, 10,  9, 10, 10, 11, 13, 12, 11, 13, 11, 12, 12, 12, 12, 10,
-       6, 10, 10, 10, 11, 11, 13, 11, 11, 13, 12, 12, 11, 12, 12, 10,
-       9, 12, 13, 12, 13, 13, 16, 13, 14, 16, 15, 14, 14, 15, 16, 12,
-       9, 13, 11, 13, 14, 14, 16, 15, 14, 16, 13, 15, 15, 15, 15, 12,
-       9, 13, 12, 13, 14, 15, 16, 15, 14, 16, 15, 15, 15, 15, 16, 12,
-       8, 12, 12, 11, 13, 14, 15, 13, 13, 15, 14, 14, 14, 14, 14, 12,
-       6, 10, 10, 11,  9, 10, 13, 11, 11, 13, 12, 12, 10, 12, 12,  9,
-       6, 10, 11, 11, 11, 10, 13, 12, 11, 13, 12, 12, 12, 12, 13, 10,
-       9, 12, 13, 13, 13, 12, 16, 13, 14, 16, 14, 15, 16, 14, 15, 12,
-       8, 12, 13, 13, 13, 13, 16, 14, 13, 16, 13, 14, 14, 14, 14, 12,
-       7, 11, 11, 12, 11, 12, 14, 13, 12, 14, 13, 13, 12, 13, 13, 11,
-       9, 12, 13, 13, 13, 13, 15, 14, 14, 16, 16, 15, 15, 15, 16, 12,
-      11, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 14, 14, 15, 15, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
-       9, 13, 13, 13, 14, 14, 16, 14, 14, 16, 15, 14, 14, 16, 16, 13,
-       9, 13, 14, 14, 11, 13, 16, 14, 13, 16, 15, 16, 13, 14, 15, 12,
-      10, 13, 14, 15, 13, 12, 16, 14, 14, 16, 15, 15, 14, 14, 16, 13,
-       9, 12, 13, 14, 12, 11, 15, 13, 13, 15, 13, 14, 15, 14, 16, 12,
-      11, 15, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13,
-      11, 14, 14, 15, 13, 14, 16, 15, 15, 16, 16, 16, 16, 16, 16, 13,
-      10, 12, 13, 14, 13, 13, 16, 14, 14, 14, 14, 16, 15, 14, 16, 13,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-       9, 12, 13, 14, 13, 13, 16, 13, 13, 15, 15, 16, 15, 15, 16, 12,
-       6, 11, 11, 12, 10, 12, 13, 12, 11, 13, 11, 12, 11, 12, 13, 10,
-       9, 12, 13, 13, 13, 13, 16, 14, 14, 15, 14, 14, 14, 14, 14, 12,
-      12, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-       7, 11, 11, 12, 12, 12, 14, 13, 12, 14, 11, 13, 13, 13, 13, 11,
-       8, 12, 12, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13, 14, 14, 11,
-      11, 14, 14, 15, 16, 15, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13,
-      10, 14, 12, 14, 15, 15, 16, 16, 14, 16, 12, 15, 16, 16, 16, 13,
-      11, 14, 13, 15, 15, 15, 16, 16, 14, 16, 14, 14, 16, 16, 16, 13,
-      11, 14, 14, 14, 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 13,
-       7, 11, 12, 11, 10, 12, 14, 13, 12, 14, 13, 13, 10, 12, 13, 10,
-       8, 12, 12, 13, 12, 12, 15, 13, 13, 14, 13, 13, 13, 13, 14, 11,
-      11, 13, 15, 16, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-       9, 12, 13, 13, 13, 13, 15, 14, 13, 15, 13, 14, 13, 14, 14, 12,
-       7, 11, 11, 11, 11, 11, 13, 12, 11, 13, 11, 12, 11, 12, 12, 10,
-       9, 12, 13, 13, 13, 13, 16, 13, 14, 16, 15, 14, 14, 14, 16, 12,
-      12, 14, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
-      10, 13, 13, 14, 14, 14, 16, 15, 14, 16, 14, 14, 16, 15, 15, 12,
-       9, 12, 13, 13, 13, 15, 16, 14, 13, 16, 14, 13, 13, 14, 14, 11,
-      10, 14, 15, 14, 12, 14, 16, 15, 13, 16, 16, 16, 12, 14, 16, 12,
-      11, 14, 14, 14, 14, 14, 16, 15, 15, 16, 16, 16, 14, 15, 16, 13,
-      11, 14, 14, 16, 14, 13, 16, 15, 14, 16, 15, 16, 15, 15, 16, 13,
-      12, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14,
-      10, 13, 14, 14, 13, 14, 16, 14, 13, 16, 15, 15, 13, 14, 14, 12,
-       9, 12, 13, 14, 13, 12, 16, 14, 13, 16, 14, 14, 14, 14, 15, 12,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-       9, 12, 13, 13, 13, 13, 14, 13, 12, 15, 14, 14, 14, 14, 14, 11,
-      11, 14, 14, 16, 14, 16, 16, 16, 13, 16, 14, 16, 14, 16, 16, 13,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 14, 14, 16, 16, 15, 16, 16, 15, 16, 14, 16, 16, 16, 16, 14,
-      12, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 14, 12, 15, 15, 15, 16, 16, 14, 16, 12, 14, 16, 16, 15, 14,
-      12, 15, 14, 16, 16, 16, 16, 16, 15, 16, 14, 16, 16, 16, 16, 14,
-      12, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14,
-      11, 15, 15, 16, 14, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      11, 15, 14, 16, 14, 14, 16, 15, 14, 16, 15, 16, 15, 16, 16, 12,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-      12, 16, 15, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 14,
-      10, 14, 13, 14, 15, 14, 16, 15, 14, 16, 13, 16, 16, 16, 15, 13,
-      10, 14, 14, 14, 13, 14, 16, 15, 15, 16, 14, 14, 14, 16, 16, 12,
-      10, 14, 15, 14, 13, 16, 16, 15, 13, 16, 16, 16, 12, 14, 16, 12,
-      11, 16, 16, 16, 14, 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
-      12, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14,
-      11, 14, 14, 14, 14, 15, 16, 14, 14, 16, 16, 16, 13, 15, 15, 12,
-      10, 14, 13, 14, 14, 14, 16, 15, 14, 16, 15, 15, 14, 14, 16, 12,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      12, 14, 14, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 13,
-       8, 11, 11, 12, 12, 12, 13, 12, 11, 13, 12, 12, 12, 13, 12, 10,
-    },
-  },
-  {
-    {
-       5,  6,  6,  6,  6,  6,  7,  6,  6,  7,  6,  6,  6,  6,  6,  4,
-       9,  9,  9,  8,  9,  8, 10,  8, 10, 10,  9,  9,  9,  8,  9,  6,
-      11, 10, 12, 10, 11, 10, 12,  9, 12, 11, 11, 10, 11, 10, 11,  8,
-       9, 10,  9,  8, 10, 10, 10,  9,  9, 10,  8,  8,  9,  9,  8,  7,
-      10, 11, 10,  9, 11, 11, 11,  9, 11, 11, 10,  9, 10, 10, 10,  7,
-      13, 12, 12, 10, 13, 12, 13, 10, 13, 12, 12, 11, 13, 12, 11,  9,
-      11, 12, 10, 10, 12, 12, 11, 10, 11, 12, 10, 10, 11, 11, 10,  8,
-      12, 12, 11, 10, 13, 13, 13, 10, 13, 13, 12, 11, 13, 12, 11,  9,
-      12, 12, 12, 10, 13, 13, 13, 10, 13, 13, 12, 10, 13, 12, 12,  9,
-       9,  9, 10, 10,  9,  8, 10,  9,  9, 10,  9,  9,  8,  8,  9,  6,
-      10, 11, 11, 11, 10,  9, 11,  9, 11, 11, 11, 10, 10,  9, 10,  7,
-      12, 12, 13, 12, 12, 10, 13, 10, 13, 13, 13, 12, 12, 11, 11,  9,
-      11, 12, 11, 11, 11, 11, 11, 10, 11, 12, 10, 10, 10, 10, 10,  8,
-      12, 12, 12, 11, 12, 11, 11, 10, 12, 12, 11, 11, 11, 11, 10,  8,
-      14, 13, 13, 12, 13, 12, 13, 10, 14, 14, 13, 12, 13, 12, 12,  9,
-      13, 14, 13, 12, 13, 13, 13, 12, 13, 13, 12, 12, 12, 12, 11,  9,
-      14, 14, 13, 12, 13, 13, 13, 11, 14, 14, 13, 12, 13, 12, 12,  9,
-      14, 15, 14, 12, 15, 13, 13, 11, 15, 14, 14, 12, 14, 13, 12,  9,
-      11, 11, 12, 12, 10, 10, 12, 11, 11, 12, 11, 11, 10, 10, 10,  8,
-      12, 12, 14, 13, 11, 10, 12, 11, 13, 13, 13, 12, 12, 10, 11,  9,
-      13, 13, 14, 14, 12, 10, 13, 11, 14, 14, 14, 13, 12, 11, 12,  9,
-      13, 13, 13, 13, 12, 13, 13, 12, 13, 14, 12, 12, 12, 12, 11,  9,
-      13, 14, 14, 13, 13, 12, 13, 11, 14, 14, 13, 12, 13, 12, 12,  9,
-      14, 14, 14, 14, 14, 12, 13, 11, 15, 15, 15, 13, 14, 12, 12,  9,
-      14, 15, 15, 13, 14, 14, 13, 12, 13, 14, 13, 13, 12, 12, 11, 10,
-      16, 16, 15, 14, 15, 14, 13, 11, 15, 15, 14, 13, 13, 13, 12,  9,
-      15, 15, 15, 13, 14, 13, 13, 11, 15, 15, 15, 13, 14, 13, 12,  9,
-       8,  9,  9,  9,  9,  9, 10,  9,  8, 10,  9,  9,  8,  8,  9,  7,
-      11, 11, 11, 11, 11, 11, 12, 10, 11, 11, 11, 10, 10, 10, 10,  8,
-      13, 13, 14, 12, 13, 12, 14, 11, 13, 13, 13, 12, 13, 11, 12,  9,
-      10, 11, 10, 11, 11, 11, 12, 10, 10, 11, 10, 10, 10, 10, 10,  8,
-      12, 12, 12, 11, 12, 12, 12, 11, 11, 12, 11, 10, 11, 11, 10,  8,
-      14, 13, 14, 12, 14, 13, 14, 12, 14, 13, 13, 11, 13, 12, 12,  9,
-      12, 13, 12, 12, 13, 13, 13, 12, 12, 13, 11, 11, 12, 12, 11,  9,
-      13, 14, 13, 12, 14, 14, 14, 12, 14, 13, 12, 11, 13, 12, 12,  9,
-      14, 14, 13, 12, 15, 14, 15, 12, 14, 14, 13, 11, 13, 13, 12,  9,
-      10, 11, 11, 11, 10, 10, 12, 10, 10, 11, 10, 10,  9,  9, 10,  7,
-      12, 12, 13, 12, 12, 11, 12, 11, 12, 12, 12, 11, 11, 10, 10,  8,
-      14, 13, 14, 13, 14, 12, 13, 12, 14, 13, 14, 12, 13, 11, 12,  9,
-      12, 13, 12, 12, 12, 12, 12, 11, 11, 12, 11, 10, 10, 10, 10,  8,
-      12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 11, 10, 11, 10, 10,  7,
-      14, 14, 14, 12, 14, 12, 14, 11, 14, 13, 13, 11, 13, 11, 11,  8,
-      13, 15, 13, 13, 14, 14, 14, 12, 13, 14, 12, 12, 12, 12, 11,  9,
-      14, 15, 13, 12, 14, 13, 13, 11, 13, 13, 12, 11, 13, 12, 11,  8,
-      15, 15, 15, 12, 15, 14, 14, 11, 14, 14, 13, 11, 13, 12, 12,  8,
-      12, 13, 13, 13, 12, 12, 13, 12, 12, 13, 12, 12, 11, 11, 11,  9,
-      13, 14, 15, 14, 13, 12, 14, 12, 13, 13, 14, 12, 12, 11, 12,  9,
-      14, 14, 15, 14, 14, 12, 14, 12, 14, 14, 14, 13, 13, 11, 12,  9,
-      13, 14, 14, 14, 13, 13, 14, 13, 13, 13, 12, 12, 12, 12, 11,  9,
-      14, 14, 14, 13, 13, 13, 13, 12, 13, 14, 13, 12, 12, 11, 11,  8,
-      15, 14, 15, 14, 14, 13, 14, 11, 15, 14, 14, 12, 13, 11, 12,  8,
-      14, 15, 14, 14, 15, 14, 14, 13, 14, 15, 13, 13, 12, 12, 11, 10,
-      16, 15, 14, 14, 14, 14, 13, 12, 14, 14, 13, 12, 13, 12, 11,  9,
-      15, 15, 15, 14, 16, 14, 14, 11, 15, 15, 14, 12, 13, 12, 11,  8,
-      11, 12, 11, 12, 12, 12, 12, 11, 10, 11, 10, 10, 10, 10, 10,  8,
-      13, 13, 13, 13, 13, 13, 14, 12, 12, 12, 12, 12, 12, 11, 12,  9,
-      14, 14, 14, 13, 15, 13, 15, 13, 14, 14, 14, 12, 14, 12, 13, 10,
-      12, 13, 12, 13, 13, 13, 13, 12, 11, 12, 11, 11, 12, 11, 11,  9,
-      14, 14, 13, 13, 14, 14, 14, 12, 12, 13, 12, 11, 13, 12, 12,  9,
-      14, 14, 15, 13, 15, 15, 15, 13, 15, 13, 13, 12, 14, 12, 13, 10,
-      13, 15, 12, 13, 14, 14, 14, 13, 12, 13, 11, 11, 13, 12, 11, 10,
-      14, 15, 14, 13, 15, 14, 15, 13, 14, 14, 12, 11, 13, 13, 12,  9,
-      14, 15, 14, 13, 15, 14, 15, 13, 14, 14, 13, 11, 14, 13, 12,  9,
-      12, 13, 13, 13, 12, 13, 13, 12, 11, 12, 12, 11, 11, 11, 11,  9,
-      13, 14, 14, 13, 14, 13, 14, 12, 13, 13, 13, 12, 12, 11, 11,  9,
-      15, 15, 16, 14, 15, 14, 14, 13, 15, 14, 14, 13, 13, 12, 13, 10,
-      13, 14, 14, 13, 13, 14, 14, 13, 12, 13, 12, 12, 11, 11, 11,  9,
-      14, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 12, 11, 11,  8,
-      15, 15, 15, 13, 15, 14, 14, 12, 14, 13, 13, 12, 13, 12, 12,  9,
-      14, 15, 14, 14, 15, 15, 14, 13, 13, 14, 12, 12, 13, 12, 12,  9,
-      15, 15, 14, 13, 15, 14, 14, 13, 14, 14, 12, 11, 13, 12, 11,  8,
-      15, 16, 14, 13, 15, 15, 15, 12, 14, 14, 13, 11, 14, 12, 12,  8,
-      12, 14, 13, 13, 13, 13, 14, 12, 12, 13, 12, 12, 10, 11, 11,  9,
-      14, 15, 15, 14, 13, 13, 15, 13, 13, 14, 14, 12, 12, 11, 12,  9,
-      15, 15, 16, 14, 14, 13, 15, 13, 14, 14, 14, 13, 13, 11, 12,  9,
-      14, 15, 14, 14, 14, 14, 14, 13, 13, 14, 13, 12, 12, 12, 11,  9,
-      14, 15, 15, 14, 14, 14, 14, 12, 13, 14, 13, 12, 12, 11, 11,  8,
-      15, 15, 15, 14, 14, 13, 15, 12, 15, 14, 14, 12, 13, 11, 11,  8,
-      14, 16, 14, 14, 14, 15, 14, 13, 13, 14, 12, 12, 12, 12, 11,  9,
-      15, 15, 15, 14, 15, 14, 14, 12, 14, 14, 13, 12, 12, 11, 11,  8,
-      15, 15, 14, 13, 15, 13, 14, 12, 14, 14, 13, 11, 13, 11, 11,  7,
-    },
-    {
-       1,  5,  6,  7,  6,  7,  9,  8,  6,  9,  8,  8,  7,  8,  8,  6,
-       5,  8, 10, 10, 10, 11, 13, 12, 11, 13, 12, 12, 12, 12, 13, 10,
-       8, 10, 13, 12, 13, 13, 16, 14, 14, 16, 16, 14, 16, 16, 16, 12,
-       5, 10,  9, 11, 11, 12, 13, 12, 11, 13, 11, 12, 12, 12, 13, 10,
-       6, 10, 11, 11, 11, 12, 14, 12, 11, 13, 13, 13, 12, 13, 13, 11,
-       8, 12, 13, 12, 14, 14, 16, 14, 14, 16, 16, 16, 16, 16, 16, 13,
-       9, 13, 11, 14, 14, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
-       9, 13, 13, 13, 14, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 14,
-       8, 12, 13, 12, 13, 14, 16, 14, 14, 16, 16, 16, 14, 16, 16, 13,
-       5, 10, 11, 12,  9, 11, 13, 12, 11, 13, 13, 13, 11, 12, 13, 10,
-       6, 10, 11, 12, 11, 11, 14, 13, 12, 14, 12, 13, 13, 13, 13, 11,
-       9, 12, 14, 15, 13, 13, 16, 16, 14, 16, 16, 16, 16, 16, 16, 13,
-       8, 13, 13, 14, 13, 14, 16, 16, 14, 16, 14, 16, 14, 16, 14, 13,
-       7, 11, 12, 13, 12, 12, 14, 13, 12, 14, 13, 14, 13, 14, 14, 12,
-       9, 13, 14, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-      11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 15, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-       9, 13, 14, 14, 14, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
-       9, 13, 14, 15, 11, 13, 16, 14, 14, 16, 16, 16, 13, 14, 16, 13,
-       9, 13, 14, 16, 13, 13, 16, 16, 14, 16, 16, 16, 16, 15, 16, 14,
-       8, 12, 13, 16, 13, 12, 16, 14, 13, 16, 14, 16, 16, 16, 16, 13,
-      11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 14, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-       9, 13, 16, 16, 14, 14, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 13, 14, 15, 14, 14, 16, 14, 13, 16, 16, 16, 14, 16, 16, 14,
-       6, 11, 11, 12, 11, 12, 14, 13, 11, 14, 12, 13, 12, 13, 13, 11,
-       9, 13, 13, 14, 13, 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 13,
-      11, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       7, 11, 11, 13, 12, 13, 16, 14, 12, 16, 12, 14, 14, 14, 14, 12,
-       8, 12, 12, 13, 12, 14, 16, 14, 13, 16, 14, 14, 14, 14, 14, 12,
-      11, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 14, 13, 16, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16,
-      10, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-       7, 11, 12, 12, 11, 13, 16, 14, 12, 15, 14, 14, 11, 13, 13, 12,
-       8, 12, 12, 13, 13, 13, 16, 14, 13, 16, 13, 15, 13, 14, 14, 12,
-      11, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-       8, 12, 13, 14, 13, 14, 16, 16, 14, 16, 14, 16, 14, 16, 15, 13,
-       6, 11, 11, 12, 11, 12, 13, 13, 11, 13, 12, 13, 12, 13, 13, 11,
-       9, 13, 14, 14, 14, 14, 16, 14, 14, 16, 16, 16, 16, 16, 14, 13,
-      11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 14, 13, 14, 14, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
-       9, 13, 14, 13, 13, 16, 16, 14, 13, 16, 16, 16, 13, 16, 14, 13,
-      10, 14, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 13, 14, 16, 14,
-      11, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 14, 16, 16, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 14, 14, 14, 14, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 13,
-       9, 13, 13, 16, 14, 14, 16, 16, 14, 16, 14, 16, 16, 16, 16, 13,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 13, 14, 14, 13, 16, 16, 14, 13, 16, 14, 16, 14, 14, 16, 12,
-      10, 14, 14, 16, 16, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 14,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 14, 13, 16, 16, 16, 16, 16, 14, 16, 12, 16, 16, 16, 16, 14,
-      11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16,
-      11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 14,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15,
-      11, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 13,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 15, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 14,
-      10, 14, 14, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-      10, 14, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 14,
-      11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16,
-      11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 15, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 13,
-      10, 15, 14, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-       8, 12, 12, 13, 12, 14, 14, 14, 12, 16, 13, 14, 12, 14, 14, 11,
-    },
-  },
-};
-
-
-static const uint8_t rv34_table_intra_cbp[NUM_INTRA_TABLES][8][CBP_VLC_SIZE] = {
-  {
-    { 0,  3,  3,  4,  3,  5,  5,  5,  2,  5,  4,  6,  4,  6,  6,  6, },
-    { 0,  2,  3,  4,  2,  5,  6,  7,  3,  6,  5,  7,  4,  7,  8,  8, },
-    { 0,  3,  4,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  3, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  6,  3,  5,  6,  5, },
-    { 0,  4,  4,  4,  4,  5,  5,  4,  4,  5,  4,  5,  4,  4,  4,  2, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  6,  6,  5,  6,  5,  6,  4,  6,  6,  5,  4,  4,  4,  4,  1, },
-    { 0,  4,  4,  4,  4,  5,  5,  4,  4,  5,  5,  4,  4,  4,  4,  2, },
-  },
-  {
-    { 0,  4,  3,  4,  3,  4,  5,  4,  3,  5,  4,  5,  3,  5,  5,  5, },
-    { 0,  2,  3,  4,  2,  5,  6,  7,  3,  6,  5,  7,  4,  7,  8,  8, },
-    { 0,  4,  4,  4,  4,  4,  5,  4,  4,  5,  4,  4,  3,  4,  4,  3, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  6,  3,  5,  6,  5, },
-    { 0,  4,  4,  4,  4,  4,  5,  4,  4,  5,  5,  5,  4,  4,  4,  2, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  5,  6,  5,  5,  5,  6,  4,  6,  6,  5,  4,  5,  4,  4,  1, },
-    { 0,  4,  4,  4,  4,  4,  5,  4,  4,  5,  5,  4,  4,  4,  5,  2, },
-  },
-  {
-    { 0,  3,  3,  4,  3,  4,  4,  5,  3,  5,  4,  5,  4,  5,  5,  5, },
-    { 0,  2,  3,  4,  2,  4,  6,  7,  3,  6,  5,  7,  5,  7,  8,  8, },
-    { 0,  4,  4,  4,  4,  4,  5,  4,  3,  5,  4,  4,  4,  4,  4,  3, },
-    { 0,  3,  3,  4,  3,  3,  6,  6,  3,  6,  4,  6,  3,  6,  6,  5, },
-    { 0,  4,  4,  4,  3,  4,  5,  4,  4,  5,  4,  4,  4,  4,  4,  3, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  5,  5,  5,  5,  5,  6,  4,  5,  6,  5,  5,  5,  4,  4,  1, },
-    { 0,  4,  4,  4,  4,  4,  6,  4,  4,  6,  5,  4,  4,  4,  4,  2, },
-  },
-  {
-    { 0,  3,  3,  4,  3,  4,  4,  5,  3,  5,  4,  5,  4,  5,  5,  5, },
-    { 0,  2,  3,  4,  2,  4,  7,  6,  3,  7,  5,  7,  5,  7,  7,  7, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  3,  3,  3,  3,  4,  6,  6,  3,  6,  4,  6,  3,  6,  6,  5, },
-    { 0,  3,  4,  4,  3,  4,  5,  4,  4,  5,  4,  5,  4,  5,  4,  3, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  4,  5,  4,  4,  4,  5,  4,  4,  5,  5,  4,  4,  4,  4,  2, },
-    { 0,  4,  4,  4,  4,  5,  5,  4,  4,  5,  5,  4,  4,  4,  4,  2, },
-  },
-  {
-    { 0,  3,  3,  4,  3,  4,  5,  6,  2,  5,  4,  7,  4,  6,  6,  7, },
-    { 0,  2,  3,  4,  2,  4,  6,  7,  3,  7,  5,  7,  5,  7,  7,  7, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  2,  3,  4,  3,  4,  6,  5,  3,  6,  4,  6,  4,  6,  6,  6, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4, },
-    { 0,  4,  4,  4,  4,  5,  5,  4,  4,  5,  5,  4,  4,  4,  4,  2, },
-    { 0,  3,  4,  4,  4,  4,  5,  4,  4,  5,  4,  4,  4,  4,  4,  3, },
-  },
-};
-
-
-static const uint8_t rv34_table_intra_firstpat[NUM_INTRA_TABLES][4][FIRSTBLK_VLC_SIZE] = {
-  {
-    {
-       0, 10,  5, 10,  7, 12,  9, 11,  8, 13,  9, 12, 10, 13, 11, 12,
-      16, 16, 14, 15, 15, 16, 13, 14,  5, 12,  6, 11,  9, 13, 10, 11,
-       9, 14,  9, 12, 11, 14, 11, 12, 16, 16, 14, 15, 15, 16, 13, 13,
-      10, 15,  9, 12, 12, 16, 11, 12, 12, 16, 10, 13, 13, 16, 11, 12,
-      16, 16, 13, 14, 15, 16, 13, 12,  6, 12,  8, 11,  8, 12, 10, 11,
-       9, 14, 10, 12, 10, 13, 11, 12, 15, 16, 14, 15, 14, 16, 13, 13,
-       8, 13,  9, 12, 10, 13, 10, 12, 10, 14,  9, 12, 11, 14, 10, 12,
-      15, 16, 13, 15, 14, 16, 13, 13, 11, 16, 10, 13, 13, 16, 11, 12,
-      12, 16, 11, 13, 13, 16, 11, 12, 16, 16, 13, 14, 15, 16, 12, 12,
-      10, 16, 12, 14, 10, 14, 11, 12, 12, 16, 13, 14, 11, 14, 12, 12,
-      16, 16, 15, 16, 14, 15, 13, 13, 11, 16, 12, 14, 11, 14, 11, 12,
-      12, 16, 12, 14, 11, 14, 11, 12, 16, 16, 14, 15, 13, 15, 13, 12,
-      14, 16, 13, 14, 13, 16, 12, 12, 14, 16, 13, 14, 13, 16, 12, 12,
-      16, 16, 14, 14, 14, 15, 12, 11,  2, 10,  6, 10,  7, 12,  9, 11,
-       8, 12,  9, 11, 10, 13, 10, 11, 15, 16, 14, 15, 14, 16, 13, 13,
-       5, 12,  6, 11,  9, 13, 10, 11,  9, 13,  9, 11, 10, 13, 10, 11,
-      15, 16, 13, 14, 14, 16, 13, 13,  9, 15,  8, 12, 12, 15, 11, 11,
-      11, 16, 10, 12, 13, 15, 11, 11, 15, 16, 13, 14, 15, 16, 12, 12,
-       6, 12,  8, 11,  8, 12,  9, 11,  9, 14,  9, 12, 10, 13, 10, 11,
-      15, 16, 14, 15, 14, 16, 13, 13,  7, 13,  8, 11,  9, 13, 10, 11,
-       9, 14,  9, 12, 10, 13, 10, 11, 14, 16, 13, 14, 13, 16, 12, 12,
-      11, 16, 10, 12, 12, 15, 11, 11, 11, 16, 10, 12, 12, 15, 11, 11,
-      15, 16, 12, 13, 14, 16, 12, 11,  9, 15, 11, 13,  9, 13, 11, 12,
-      11, 16, 12, 14, 10, 14, 11, 12, 16, 16, 14, 15, 13, 15, 12, 12,
-      11, 16, 11, 14, 10, 14, 11, 12, 11, 16, 12, 13, 11, 14, 11, 11,
-      15, 16, 14, 15, 13, 14, 12, 12, 13, 16, 12, 14, 13, 15, 11, 11,
-      13, 16, 12, 14, 13, 15, 11, 11, 16, 16, 13, 14, 13, 15, 11, 10,
-       5, 12,  7, 11,  8, 13, 10, 11,  9, 13,  9, 12, 10, 14, 11, 12,
-      16, 16, 14, 15, 14, 16, 13, 13,  7, 13,  7, 11,  9, 13, 10, 11,
-       9, 14,  9, 12, 11, 14, 11, 12, 16, 16, 14, 14, 14, 16, 13, 13,
-       9, 15,  8, 12, 12, 15, 11, 12, 11, 16, 10, 12, 13, 16, 11, 12,
-      16, 16, 13, 14, 15, 16, 12, 12,  7, 13,  8, 12,  9, 13, 10, 11,
-      10, 14, 10, 12, 10, 14, 11, 12, 16, 16, 14, 15, 14, 16, 13, 13,
-       8, 14,  9, 12, 10, 13, 10, 11,  9, 14,  9, 12, 10, 14, 10, 11,
-      15, 16, 13, 14, 14, 16, 12, 12, 11, 16, 10, 12, 12, 15, 11, 12,
-      11, 16, 10, 12, 12, 15, 11, 11, 15, 16, 12, 14, 14, 16, 12, 11,
-      10, 16, 11, 13,  9, 14, 11, 12, 12, 16, 12, 14, 11, 14, 11, 12,
-      16, 16, 14, 16, 14, 15, 13, 12, 11, 16, 11, 14, 10, 14, 11, 12,
-      11, 16, 12, 14, 11, 14, 11, 11, 15, 16, 14, 15, 13, 15, 12, 12,
-      13, 16, 12, 14, 13, 15, 11, 11, 13, 16, 12, 14, 12, 14, 11, 11,
-      15, 16, 12, 13, 13, 14, 11, 10,  6, 13,  8, 11,  9, 13, 10, 11,
-      10, 14, 10, 12, 10, 13, 10, 11, 15, 16, 13, 13, 13, 14, 12, 11,
-       7, 13,  8, 11,  9, 13,  9, 11, 10, 14,  9, 11, 10, 13, 10, 11,
-      15, 16, 13, 13, 13, 14, 11, 11,  9, 14,  8, 11, 10, 13,  9, 10,
-      11, 15,  9, 11, 11, 13,  9, 10, 15, 16, 12, 13, 13, 14, 10,  9,
-       7, 13,  8, 11,  9, 13,  9, 11, 10, 14, 10, 12, 10, 13, 10, 11,
-      15, 16, 13, 13, 13, 14, 11, 11,  8, 13,  8, 11,  9, 13,  9, 10,
-       9, 14,  9, 11, 10, 13,  9, 10, 14, 16, 12, 13, 13, 14, 11, 10,
-       9, 14,  8, 11, 10, 13,  9,  9, 10, 14,  8, 11, 10, 13,  9,  9,
-      14, 16, 11, 12, 12, 14, 10,  9,  9, 14,  9, 12,  8, 12,  9, 10,
-      11, 15, 10, 12, 10, 13,  9, 10, 15, 16, 13, 13, 12, 13, 11, 10,
-       9, 14,  9, 12,  9, 12,  9, 10, 10, 14, 10, 12,  9, 12,  9,  9,
-      14, 16, 12, 13, 11, 13, 10,  9, 10, 14,  9, 11, 10, 12,  8,  8,
-      10, 14,  9, 11, 10, 12,  8,  8, 12, 14,  9, 10, 10, 11,  8,  7,
-    },
-    {
-       0,  9,  6,  9,  6, 10,  8,  9,  7, 11,  8, 11,  9, 11,  9, 10,
-      14, 16, 13, 14, 13, 14, 12, 11,  5, 11,  7, 10,  8, 10,  8,  9,
-       8, 12,  8, 11,  9, 12,  9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
-      10, 14,  9, 11, 11, 13, 10, 10, 11, 15,  9, 11, 12, 13, 10, 10,
-      15, 16, 12, 12, 13, 14, 11,  9,  6, 11,  7, 10,  7, 10,  8,  9,
-       8, 12,  9, 11,  9, 11,  9, 10, 14, 16, 13, 13, 13, 14, 11, 11,
-       7, 12,  8, 11,  8, 11,  9,  9,  9, 13,  9, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 12, 14, 11, 10, 11, 14, 10, 12, 11, 13, 10, 10,
-      12, 15, 10, 12, 12, 13, 10, 10, 15, 16, 12, 12, 13, 14, 10,  9,
-      10, 14, 11, 13,  9, 12, 10, 10, 11, 15, 12, 13, 10, 12, 10, 10,
-      14, 16, 13, 14, 12, 13, 11, 10, 11, 14, 11, 13, 10, 12, 10, 10,
-      12, 15, 11, 13, 10, 12, 10, 10, 15, 16, 13, 13, 12, 13, 11,  9,
-      13, 16, 12, 13, 12, 13, 10,  9, 14, 16, 12, 13, 12, 13, 10,  9,
-      16, 16, 12, 12, 13, 13, 10,  7,  4, 10,  6,  9,  7, 10,  8,  9,
-       8, 12,  9, 11,  9, 11,  9,  9, 14, 16, 13, 13, 13, 14, 11, 11,
-       6, 11,  7, 10,  8, 11,  8,  9,  9, 12,  9, 11,  9, 12,  9,  9,
-      14, 16, 12, 13, 13, 14, 11, 10, 10, 14,  9, 11, 11, 13,  9,  9,
-      11, 14,  9, 11, 11, 13, 10,  9, 14, 16, 11, 12, 13, 14, 10,  9,
-       6, 11,  8, 10,  7, 10,  8,  9,  9, 12,  9, 11,  9, 11,  9,  9,
-      14, 16, 13, 13, 12, 13, 11, 10,  8, 12,  8, 10,  8, 11,  9,  9,
-       9, 12,  9, 11,  9, 11,  9,  9, 14, 16, 12, 13, 12, 13, 11, 10,
-      11, 14, 10, 11, 11, 13,  9,  9, 11, 14, 10, 11, 11, 13,  9,  9,
-      14, 16, 11, 12, 13, 14, 10,  8, 10, 14, 11, 12,  9, 12, 10, 10,
-      11, 14, 11, 13, 10, 12, 10, 10, 14, 16, 13, 14, 12, 13, 11,  9,
-      11, 14, 11, 12, 10, 12, 10, 10, 11, 14, 11, 12, 10, 12, 10,  9,
-      14, 16, 13, 13, 11, 12, 10,  9, 13, 16, 12, 13, 12, 13, 10,  9,
-      13, 16, 11, 12, 11, 13, 10,  8, 15, 16, 12, 12, 12, 12,  9,  7,
-       8, 12,  8, 11,  9, 12,  9, 10, 10, 14, 10, 12, 11, 13, 10, 10,
-      16, 16, 14, 14, 14, 14, 12, 11,  8, 13,  8, 11,  9, 12, 10, 10,
-      11, 14, 10, 12, 11, 13, 10, 10, 16, 16, 13, 14, 14, 14, 12, 11,
-      11, 14,  9, 12, 11, 13, 10, 10, 12, 15, 10, 12, 12, 14, 10, 10,
-      15, 16, 12, 12, 14, 14, 11,  9,  9, 13,  9, 11,  9, 12, 10, 10,
-      11, 14, 10, 12, 10, 12, 10, 10, 15, 16, 14, 14, 13, 14, 12, 11,
-       9, 13,  9, 11, 10, 12, 10, 10, 10, 14, 10, 12, 10, 12, 10, 10,
-      15, 16, 13, 13, 13, 14, 11, 10, 11, 15, 10, 12, 11, 13, 10, 10,
-      11, 15, 10, 12, 12, 13, 10,  9, 15, 16, 11, 12, 13, 14, 10,  9,
-      11, 15, 11, 13, 10, 12, 10, 10, 12, 16, 12, 13, 11, 13, 10, 10,
-      16, 16, 14, 14, 12, 13, 11,  9, 11, 15, 11, 13, 10, 13, 10, 10,
-      12, 15, 12, 13, 10, 12, 10, 10, 14, 16, 13, 13, 12, 13, 10,  9,
-      13, 16, 12, 13, 12, 13, 10,  9, 13, 16, 11, 12, 11, 13, 10,  9,
-      14, 16, 11, 12, 12, 12,  9,  7, 10, 15, 10, 12, 11, 13, 10, 10,
-      12, 16, 12, 13, 12, 13, 11, 10, 16, 16, 14, 14, 14, 15, 12, 10,
-      10, 14, 10, 12, 10, 13, 10, 10, 12, 15, 11, 12, 11, 13, 10, 10,
-      16, 16, 14, 13, 14, 14, 11,  9, 11, 14, 10, 11, 11, 12,  9,  9,
-      12, 15, 10, 11, 11, 13,  9,  8, 16, 16, 12, 12, 13, 13, 10,  7,
-      10, 15, 10, 12, 10, 13, 10, 10, 12, 15, 11, 12, 11, 13, 10, 10,
-      16, 16, 14, 13, 14, 14, 11,  9, 10, 14, 10, 12, 10, 12, 10, 10,
-      12, 15, 11, 12, 11, 13, 10, 10, 16, 16, 13, 13, 13, 14, 11,  9,
-      11, 14, 10, 11, 10, 12,  9,  8, 11, 14,  9, 11, 11, 12,  9,  8,
-      14, 16, 10, 11, 12, 13,  9,  7, 11, 15, 11, 12, 10, 12, 10,  9,
-      13, 16, 11, 12, 11, 12, 10,  9, 16, 16, 13, 13, 12, 13, 10,  7,
-      11, 15, 10, 12, 10, 12,  9,  8, 12, 15, 11, 12, 10, 12,  9,  8,
-      14, 16, 12, 12, 11, 12,  9,  7, 11, 14, 10, 11, 10, 12,  8,  7,
-      11, 14,  9, 10, 10, 11,  8,  6, 12, 15,  9,  9,  9, 10,  7,  4,
-    },
-    {
-       0,  6,  3,  7,  3,  7,  6,  7,  5,  9,  6,  9,  7,  9,  8,  8,
-      16, 16, 16, 16, 16, 16, 16, 11,  3,  8,  5,  8,  6,  8,  7,  7,
-       7, 11,  7, 10,  8, 10,  8,  9, 16, 16, 16, 16, 16, 16, 14, 10,
-       8, 16,  7, 11, 10, 16,  9,  9, 11, 16,  9, 14, 16, 16, 10,  9,
-      16, 16, 16, 16, 16, 16, 16, 10,  3,  8,  5,  8,  5,  8,  7,  7,
-       7, 11,  8, 10,  8, 10,  8,  9, 16, 16, 16, 16, 16, 16, 16, 11,
-       6, 10,  7,  9,  7, 10,  8,  8,  8, 11,  8, 10,  8, 11,  8,  8,
-      16, 16, 16, 16, 16, 16, 11, 10, 10, 16,  9, 13, 11, 16, 10,  9,
-      11, 16,  9, 11, 16, 16, 10,  9, 16, 16, 11, 16, 16, 16, 11,  9,
-       9, 16, 10, 11,  8, 11,  9,  9, 11, 16, 12, 16, 10, 16, 10, 10,
-      16, 16, 16, 16, 16, 16, 16, 10, 10, 16, 11, 16, 10, 16, 10, 10,
-      11, 16, 11, 16, 10, 16, 10,  9, 16, 16, 16, 16, 16, 16, 11,  9,
-      16, 16, 16, 16, 16, 16, 11,  9, 16, 16, 16, 16, 16, 16, 11,  9,
-      16, 16, 11, 16, 16, 16,  9,  7, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       2,  8,  5,  9,  6,  9,  8,  8,  8, 12,  9, 11,  9, 11, 10, 10,
-      16, 16, 14, 16, 14, 16, 14, 12,  5, 10,  6,  9,  8, 10,  8,  9,
-       9, 12,  9, 11, 10, 12, 10, 10, 16, 16, 14, 15, 15, 16, 13, 12,
-      10, 13,  9, 12, 11, 12, 10, 10, 12, 15, 11, 12, 12, 13, 11, 10,
-      16, 16, 15, 14, 15, 16, 13, 12,  6, 10,  8, 10,  7, 10,  8,  9,
-       9, 13, 10, 11, 10, 12, 10, 10, 16, 16, 14, 16, 14, 16, 13, 12,
-       7, 11,  8, 11,  9, 11,  9,  9, 10, 13, 10, 11, 10, 12, 10,  9,
-      16, 16, 14, 14, 14, 15, 12, 11, 11, 14, 11, 12, 11, 13, 10, 10,
-      12, 15, 11, 13, 12, 13, 11, 10, 16, 16, 14, 16, 15, 15, 13, 11,
-      10, 13, 11, 12, 10, 12, 10, 10, 12, 15, 12, 13, 11, 13, 11, 11,
-      16, 16, 15, 16, 14, 15, 13, 11, 11, 14, 11, 13, 11, 12, 11, 10,
-      12, 16, 12, 13, 12, 13, 11, 10, 16, 16, 15, 16, 13, 15, 12, 11,
-      13, 15, 12, 13, 13, 14, 11, 11, 14, 16, 13, 13, 13, 14, 11, 11,
-      16, 16, 15, 14, 15, 15, 12, 10,  3,  8,  6,  9,  7,  9,  8,  8,
-       8, 12,  9, 11,  9, 11,  9,  9, 16, 16, 15, 15, 15, 16, 13, 12,
-       6, 10,  7,  9,  8, 10,  8,  8,  9, 12,  9, 11, 10, 12, 10,  9,
-      16, 16, 14, 14, 14, 15, 13, 11, 10, 13,  9, 11, 11, 12, 10, 10,
-      12, 14, 11, 12, 12, 13, 11, 10, 16, 16, 14, 14, 15, 15, 13, 11,
-       6, 10,  8, 10,  7, 10,  8,  9, 10, 12, 10, 11, 10, 11, 10,  9,
-      16, 16, 14, 15, 14, 15, 13, 11,  8, 11,  8, 10,  9, 11,  9,  9,
-       9, 13,  9, 11, 10, 11,  9,  9, 16, 16, 13, 14, 14, 14, 12, 10,
-      11, 14, 10, 12, 11, 12, 10, 10, 12, 14, 11, 12, 12, 13, 10, 10,
-      16, 16, 13, 14, 15, 15, 12, 10, 10, 13, 11, 12, 10, 12, 10, 10,
-      12, 14, 12, 13, 11, 13, 11, 10, 16, 16, 15, 14, 14, 14, 12, 11,
-      11, 14, 11, 12, 10, 12, 10, 10, 12, 15, 12, 12, 11, 13, 10, 10,
-      16, 16, 14, 15, 13, 14, 12, 10, 13, 15, 12, 13, 12, 13, 11, 10,
-      13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 15, 11,  9,
-       6, 10,  8, 10,  8, 11,  9, 10, 11, 13, 11, 12, 11, 13, 11, 10,
-      16, 16, 16, 16, 16, 16, 13, 12,  8, 11,  9, 11,  9, 11, 10, 10,
-      11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 15, 15, 16, 16, 13, 12,
-      11, 14, 10, 12, 12, 13, 11, 10, 13, 16, 12, 13, 13, 14, 11, 11,
-      16, 16, 15, 16, 16, 16, 13, 12,  8, 12,  9, 11,  9, 11, 10, 10,
-      11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 16, 16, 16, 16, 13, 12,
-       9, 12, 10, 11, 10, 12, 10, 10, 11, 14, 11, 12, 11, 13, 10, 10,
-      16, 16, 15, 14, 15, 15, 13, 11, 12, 14, 11, 13, 12, 13, 11, 10,
-      12, 15, 11, 12, 13, 13, 11, 10, 16, 16, 14, 15, 16, 15, 13, 11,
-      11, 15, 12, 13, 11, 13, 11, 10, 13, 16, 13, 14, 12, 14, 11, 11,
-      16, 16, 16, 16, 15, 15, 13, 12, 12, 14, 12, 13, 11, 13, 11, 10,
-      13, 15, 12, 13, 11, 13, 11, 10, 16, 16, 15, 15, 13, 15, 13, 11,
-      13, 16, 13, 13, 13, 13, 12, 11, 13, 16, 13, 13, 13, 13, 11, 10,
-      16, 16, 13, 15, 14, 14, 12,  9,  9, 13, 10, 12, 11, 13, 11, 11,
-      13, 16, 13, 14, 13, 14, 12, 11, 16, 16, 16, 16, 16, 16, 14, 12,
-      10, 14, 11, 13, 11, 13, 11, 10, 13, 16, 13, 13, 13, 14, 12, 11,
-      16, 16, 16, 16, 16, 16, 14, 12, 11, 15, 11, 13, 12, 13, 11, 10,
-      14, 16, 12, 13, 13, 14, 12, 10, 16, 16, 15, 16, 16, 16, 13, 11,
-      10, 14, 11, 12, 11, 13, 11, 10, 13, 16, 12, 13, 12, 14, 12, 11,
-      16, 16, 16, 16, 16, 16, 14, 12, 11, 14, 11, 12, 11, 13, 11, 10,
-      13, 15, 12, 13, 12, 13, 11, 10, 16, 16, 15, 15, 16, 16, 13, 11,
-      12, 15, 12, 13, 12, 13, 11, 10, 13, 16, 12, 13, 13, 13, 11, 10,
-      16, 16, 14, 14, 16, 15, 13, 10, 12, 15, 12, 13, 12, 13, 11, 10,
-      14, 16, 13, 14, 13, 14, 12, 11, 16, 16, 16, 16, 15, 16, 13, 11,
-      12, 16, 12, 13, 12, 13, 11, 10, 13, 16, 13, 13, 12, 14, 11, 10,
-      16, 16, 15, 16, 14, 15, 13, 10, 12, 15, 12, 14, 12, 13, 11, 10,
-      13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 14, 11,  8,
-    },
-  },
-  {
-    {
-       0, 11,  5, 11,  7, 13, 10, 12,  7, 13,  9, 13, 10, 14, 12, 13,
-      16, 16, 15, 16, 16, 16, 15, 15,  4, 13,  6, 12, 10, 14, 11, 12,
-       8, 14,  9, 13, 11, 15, 12, 13, 16, 16, 15, 16, 15, 16, 15, 14,
-       9, 16,  9, 13, 13, 16, 12, 13, 12, 16, 10, 14, 14, 16, 13, 13,
-      16, 16, 14, 16, 16, 16, 14, 14,  5, 13,  8, 13,  8, 13, 11, 12,
-       9, 14, 10, 13, 10, 14, 12, 13, 16, 16, 15, 16, 15, 16, 14, 15,
-       7, 14,  9, 13, 10, 14, 11, 13,  9, 15, 10, 13, 11, 14, 12, 13,
-      16, 16, 14, 16, 15, 16, 14, 14, 11, 16, 11, 14, 13, 16, 12, 13,
-      12, 16, 11, 14, 14, 16, 12, 13, 16, 16, 14, 15, 16, 16, 14, 13,
-      10, 16, 12, 15, 10, 15, 12, 14, 12, 16, 13, 16, 11, 15, 13, 14,
-      16, 16, 16, 16, 14, 16, 14, 14, 11, 16, 12, 15, 11, 16, 12, 13,
-      12, 16, 13, 15, 12, 16, 12, 13, 16, 16, 16, 16, 14, 16, 14, 14,
-      14, 16, 13, 15, 14, 16, 13, 13, 14, 16, 14, 15, 14, 16, 13, 13,
-      16, 16, 15, 16, 15, 16, 13, 13,  2, 12,  6, 11,  7, 13, 10, 12,
-       7, 13,  9, 12, 10, 14, 11, 12, 16, 16, 15, 16, 15, 16, 14, 15,
-       5, 13,  6, 12,  9, 13, 10, 12,  8, 14,  9, 13, 11, 14, 11, 13,
-      16, 16, 14, 16, 15, 16, 14, 14,  9, 16,  8, 13, 12, 16, 11, 13,
-      11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 15, 16, 16, 13, 13,
-       5, 13,  8, 12,  7, 13, 10, 12,  8, 14, 10, 13, 10, 14, 11, 13,
-      16, 16, 14, 16, 15, 16, 14, 14,  7, 14,  8, 12,  9, 14, 11, 12,
-       8, 14,  9, 13, 10, 14, 11, 12, 15, 16, 14, 15, 14, 16, 13, 14,
-      11, 16, 10, 13, 13, 16, 12, 13, 11, 16, 10, 13, 13, 16, 12, 13,
-      16, 16, 13, 15, 15, 16, 13, 13,  9, 16, 12, 15,  9, 14, 11, 13,
-      11, 16, 13, 15, 11, 14, 12, 13, 16, 16, 15, 16, 14, 16, 14, 14,
-      11, 16, 12, 14, 11, 15, 12, 13, 11, 16, 12, 14, 11, 15, 12, 13,
-      16, 16, 15, 16, 14, 16, 13, 13, 13, 16, 13, 15, 13, 16, 12, 13,
-      14, 16, 13, 15, 13, 16, 12, 12, 16, 16, 14, 15, 14, 16, 12, 12,
-       4, 13,  7, 12,  8, 14, 11, 12,  9, 14, 10, 13, 11, 14, 12, 13,
-      16, 16, 15, 16, 16, 16, 15, 15,  6, 14,  7, 12, 10, 14, 11, 12,
-       9, 15, 10, 13, 11, 15, 12, 13, 16, 16, 15, 16, 16, 16, 14, 14,
-       9, 16,  8, 13, 12, 16, 11, 13, 12, 16, 10, 14, 13, 16, 12, 13,
-      16, 16, 14, 16, 16, 16, 14, 14,  6, 14,  8, 13,  8, 14, 11, 13,
-       9, 15, 10, 13, 11, 14, 12, 13, 16, 16, 15, 16, 16, 16, 14, 14,
-       7, 15,  9, 13, 10, 14, 11, 13,  9, 15, 10, 13, 11, 14, 11, 13,
-      16, 16, 14, 16, 15, 16, 14, 14, 10, 16, 10, 13, 12, 16, 12, 13,
-      11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 14, 15, 16, 13, 13,
-       9, 16, 12, 14,  9, 14, 11, 13, 12, 16, 12, 15, 11, 15, 12, 13,
-      16, 16, 16, 16, 15, 16, 14, 14, 10, 16, 12, 15, 11, 15, 12, 13,
-      11, 16, 12, 14, 11, 15, 12, 13, 16, 16, 14, 16, 13, 16, 13, 13,
-      13, 16, 13, 15, 13, 16, 12, 13, 13, 16, 12, 14, 13, 16, 12, 12,
-      15, 16, 13, 14, 13, 16, 12, 12,  6, 14,  8, 13,  9, 14, 10, 12,
-      10, 15, 10, 12, 11, 14, 11, 12, 16, 16, 14, 14, 14, 16, 13, 13,
-       7, 15,  8, 13,  9, 14, 10, 12, 10, 15, 10, 13, 11, 14, 11, 12,
-      16, 16, 14, 14, 14, 16, 13, 12,  9, 16,  8, 12, 11, 14, 10, 11,
-      11, 16, 10, 13, 11, 14, 10, 11, 16, 16, 13, 14, 14, 16, 12, 11,
-       7, 14,  9, 13,  9, 14, 10, 12, 10, 16, 10, 13, 11, 14, 11, 12,
-      16, 16, 14, 14, 14, 15, 13, 12,  7, 14,  9, 13,  9, 14, 10, 12,
-       9, 14, 10, 12, 10, 14, 11, 12, 15, 16, 13, 14, 14, 15, 12, 12,
-       9, 15,  9, 12, 11, 14, 10, 11, 10, 15,  9, 12, 11, 14, 10, 11,
-      14, 16, 11, 13, 13, 15, 11, 11,  9, 16, 10, 13,  9, 14, 10, 11,
-      11, 16, 11, 13, 10, 14, 10, 11, 16, 16, 14, 15, 13, 15, 12, 12,
-       9, 16, 10, 13,  9, 13, 10, 11, 10, 15, 10, 13, 10, 13, 10, 11,
-      14, 16, 13, 14, 12, 14, 11, 11, 11, 16, 10, 13, 11, 13,  9, 10,
-      11, 14, 10, 12, 10, 13,  9,  9, 13, 15, 10, 11, 11, 12,  9,  8,
-    },
-    {
-       0, 10,  5, 10,  6, 11,  8, 10,  7, 12,  8, 11,  9, 12,  9, 10,
-      14, 16, 13, 13, 13, 14, 12, 11,  5, 12,  6, 10,  8, 12,  9, 10,
-       8, 13,  8, 11,  9, 12,  9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
-       9, 15,  8, 12, 11, 14, 10, 10, 11, 16,  9, 12, 12, 14, 10, 10,
-      14, 16, 11, 12, 13, 14, 11, 10,  5, 12,  8, 11,  7, 11,  9, 10,
-       8, 13,  9, 11,  9, 12,  9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
-       7, 13,  8, 11,  9, 12,  9, 10,  9, 13,  9, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 12, 13, 11, 10, 11, 15, 10, 12, 12, 14, 10, 10,
-      12, 16, 10, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 10,  9,
-      10, 15, 11, 13,  9, 13, 10, 10, 11, 15, 12, 13, 10, 12, 10, 10,
-      14, 16, 13, 14, 12, 13, 11, 10, 11, 16, 11, 13, 10, 13, 10, 10,
-      11, 16, 11, 13, 10, 13, 10, 10, 14, 16, 13, 14, 12, 13, 11,  9,
-      13, 16, 12, 13, 12, 14, 11, 10, 14, 16, 12, 13, 12, 14, 10,  9,
-      16, 16, 12, 13, 13, 13, 10,  8,  3, 11,  6, 10,  7, 11,  9, 10,
-       8, 12,  8, 11,  9, 12,  9, 10, 14, 16, 13, 13, 13, 14, 11, 11,
-       5, 12,  6, 10,  8, 12,  9, 10,  8, 13,  8, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 13, 14, 11, 10,  9, 14,  8, 11, 11, 14, 10, 10,
-      11, 15,  9, 11, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11,  9,
-       6, 12,  8, 11,  7, 11,  9, 10,  8, 13,  9, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 13, 13, 11, 10,  7, 13,  8, 11,  8, 12,  9, 10,
-       9, 13,  9, 11,  9, 12,  9,  9, 14, 16, 12, 13, 12, 13, 11, 10,
-      10, 15,  9, 12, 11, 14, 10, 10, 11, 15,  9, 11, 11, 13, 10,  9,
-      14, 16, 11, 12, 13, 14, 10,  9,  9, 15, 11, 13,  9, 12, 10, 10,
-      11, 15, 11, 13,  9, 12, 10, 10, 14, 16, 13, 14, 12, 13, 11, 10,
-      10, 15, 11, 13, 10, 13, 10, 10, 11, 15, 11, 13, 10, 12, 10, 10,
-      14, 16, 12, 13, 11, 12, 10,  9, 13, 16, 12, 13, 12, 14, 10,  9,
-      13, 16, 11, 12, 12, 13, 10,  9, 14, 16, 11, 12, 12, 13,  9,  8,
-       7, 13,  8, 12,  9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 11,
-      16, 16, 13, 14, 14, 14, 12, 11,  8, 14,  8, 12,  9, 13, 10, 10,
-      10, 14, 10, 12, 11, 13, 10, 10, 16, 16, 13, 13, 14, 14, 12, 11,
-      10, 15,  9, 12, 11, 14, 10, 10, 12, 16, 10, 12, 12, 14, 10, 10,
-      16, 16, 12, 13, 14, 15, 11, 10,  8, 14,  9, 12,  9, 13, 10, 11,
-      10, 15, 10, 12, 10, 13, 10, 11, 16, 16, 13, 14, 14, 14, 12, 11,
-       8, 14,  9, 12,  9, 13, 10, 10, 10, 14, 10, 12, 10, 13, 10, 10,
-      15, 16, 13, 13, 13, 14, 11, 10, 10, 15, 10, 12, 12, 14, 10, 10,
-      11, 16,  9, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 10,  9,
-      11, 16, 11, 13, 10, 13, 10, 10, 12, 16, 12, 13, 10, 13, 11, 10,
-      15, 16, 14, 14, 12, 13, 11, 10, 11, 16, 11, 13, 10, 13, 10, 10,
-      11, 16, 12, 13, 10, 12, 10, 10, 14, 16, 13, 14, 11, 13, 11,  9,
-      13, 16, 12, 13, 12, 14, 10, 10, 12, 16, 11, 12, 12, 13, 10,  9,
-      14, 16, 11, 12, 11, 12,  9,  8, 10, 16, 10, 13, 11, 14, 11, 11,
-      12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 13, 14, 14, 12, 10,
-      10, 15, 10, 13, 10, 13, 10, 11, 12, 16, 11, 13, 11, 13, 11, 10,
-      16, 16, 14, 13, 14, 14, 12, 10, 11, 15,  9, 12, 11, 13, 10,  9,
-      12, 16, 10, 12, 12, 13, 10,  9, 16, 16, 12, 12, 13, 14, 10,  8,
-      10, 16, 10, 13, 10, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 10,
-      16, 16, 14, 13, 14, 14, 12, 10,  9, 15,  9, 12, 10, 13, 10, 10,
-      11, 16, 10, 12, 11, 13, 10, 10, 16, 16, 13, 13, 13, 14, 11,  9,
-      10, 15,  9, 11, 11, 13,  9,  9, 11, 15,  9, 11, 11, 13,  9,  8,
-      14, 16, 10, 11, 13, 13, 10,  8, 11, 16, 11, 13, 10, 13, 10,  9,
-      13, 16, 11, 13, 11, 13, 10,  9, 16, 16, 13, 13, 13, 13, 10,  8,
-      11, 16, 10, 12, 10, 13, 10,  9, 11, 16, 11, 12, 10, 12,  9,  9,
-      15, 16, 12, 13, 11, 12, 10,  8, 11, 16, 10, 12, 11, 12,  9,  8,
-      11, 15,  9, 11, 10, 12,  9,  7, 13, 15,  9,  9, 10, 10,  7,  5,
-    },
-    {
-       0,  7,  3,  8,  4,  9,  7,  8,  5, 10,  7, 10,  8, 11,  8,  9,
-      16, 16, 16, 16, 16, 16, 11, 10,  2, 10,  4,  9,  7, 10,  7,  8,
-       7, 16,  7, 10,  9, 16,  8,  9, 16, 16, 16, 16, 16, 16, 11, 10,
-       8, 16,  7, 10, 10, 16,  9,  8, 10, 16,  9, 11, 16, 16,  9,  9,
-      16, 16, 16, 16, 16, 16, 11,  9,  3, 10,  6,  9,  6, 11,  8,  8,
-       7, 16,  8, 10,  9, 16,  9,  9, 16, 16, 16, 16, 16, 16, 11, 10,
-       5, 16,  7, 10,  8, 11,  8,  8,  8, 16,  8, 10,  9, 16,  8,  8,
-      16, 16, 11, 16, 16, 16, 10,  9,  9, 16,  9, 11, 11, 16,  9,  9,
-      11, 16,  9, 11, 11, 16,  9,  8, 16, 16, 10, 16, 16, 16, 10,  9,
-       8, 16, 10, 16,  8, 16, 10,  9, 12, 16, 11, 16, 10, 16, 10,  9,
-      16, 16, 16, 16, 16, 16, 12, 10, 10, 16, 11, 16, 10, 16, 10,  9,
-      11, 16, 11, 16, 10, 16, 10,  9, 16, 16, 16, 16, 16, 16, 11,  9,
-      16, 16, 16, 16, 16, 16, 10,  9, 16, 16, 11, 16, 16, 16, 10,  9,
-      16, 16, 10, 11, 11, 16,  9,  7, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       2,  9,  6,  9,  6, 10,  8,  9,  8, 12,  9, 11,  9, 12, 10, 10,
-      16, 16, 14, 14, 15, 15, 13, 12,  5, 11,  7, 10,  8, 11,  9,  9,
-       9, 13,  9, 11, 10, 12, 10, 10, 15, 16, 14, 14, 14, 16, 12, 11,
-      10, 14,  9, 11, 11, 13, 10, 10, 12, 15, 10, 12, 12, 13, 11, 10,
-      16, 16, 14, 15, 14, 15, 12, 11,  5, 11,  8, 10,  7, 11,  9,  9,
-       9, 13,  9, 12,  9, 12, 10, 10, 15, 16, 13, 14, 13, 16, 12, 11,
-       7, 12,  8, 11,  9, 11,  9, 10,  9, 13,  9, 11, 10, 12,  9,  9,
-      16, 16, 13, 14, 13, 14, 11, 11, 10, 14, 10, 12, 11, 13, 10, 10,
-      11, 16, 11, 12, 12, 13, 10, 10, 16, 16, 13, 14, 13, 14, 12, 11,
-      10, 14, 11, 13, 10, 13, 10, 11, 12, 16, 12, 13, 10, 12, 11, 11,
-      16, 16, 14, 15, 13, 14, 12, 11, 11, 15, 11, 13, 11, 13, 10, 10,
-      12, 15, 12, 13, 11, 13, 11, 10, 15, 16, 14, 15, 13, 15, 12, 11,
-      12, 16, 12, 13, 12, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 10,
-      16, 16, 13, 14, 13, 14, 11, 10,  3, 10,  6,  9,  7, 10,  8,  9,
-       9, 12,  9, 11, 10, 12,  9, 10, 15, 16, 14, 14, 14, 14, 12, 11,
-       6, 11,  7, 10,  8, 10,  9,  9,  9, 13,  9, 11, 10, 12,  9,  9,
-      15, 16, 13, 14, 14, 15, 12, 11, 10, 14,  9, 11, 11, 12, 10, 10,
-      12, 14, 10, 12, 11, 13, 10, 10, 15, 16, 13, 14, 14, 16, 12, 11,
-       6, 11,  8, 10,  7, 11,  9,  9,  9, 13,  9, 11,  9, 12,  9,  9,
-      15, 16, 14, 14, 13, 14, 12, 11,  7, 11,  8, 11,  8, 11,  9,  9,
-       9, 12,  9, 11,  9, 12,  9,  9, 15, 16, 13, 13, 13, 14, 11, 10,
-      10, 13, 10, 12, 11, 13, 10, 10, 11, 15, 10, 12, 11, 13, 10, 10,
-      14, 16, 12, 13, 13, 14, 11, 10, 10, 14, 11, 12,  9, 12, 10, 10,
-      11, 15, 11, 13, 10, 13, 10, 10, 15, 16, 14, 14, 13, 14, 12, 11,
-      10, 14, 10, 12, 10, 12, 10, 10, 11, 15, 11, 12, 10, 12, 10, 10,
-      15, 16, 13, 14, 12, 14, 11, 10, 12, 16, 11, 13, 12, 14, 11, 10,
-      12, 16, 12, 13, 11, 13, 10, 10, 15, 16, 12, 14, 12, 14, 11,  9,
-       7, 12,  9, 11,  9, 12, 10, 10, 11, 14, 11, 12, 11, 13, 11, 11,
-      16, 16, 15, 16, 15, 16, 13, 12,  8, 12,  9, 11,  9, 12, 10, 10,
-      11, 14, 11, 12, 11, 13, 10, 10, 16, 16, 14, 15, 15, 16, 13, 12,
-      11, 14, 10, 12, 11, 13, 10, 10, 12, 16, 11, 13, 12, 14, 11, 10,
-      16, 16, 14, 15, 14, 16, 12, 11,  8, 13,  9, 11,  9, 12, 10, 10,
-      11, 14, 11, 12, 11, 13, 10, 10, 16, 16, 15, 15, 14, 15, 13, 12,
-       9, 13,  9, 12,  9, 12, 10, 10, 11, 14, 10, 12, 10, 12, 10, 10,
-      16, 16, 14, 15, 14, 14, 12, 11, 11, 15, 11, 12, 11, 13, 11, 10,
-      12, 16, 11, 12, 12, 13, 11, 10, 16, 16, 13, 15, 14, 15, 11, 11,
-      11, 16, 11, 13, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
-      16, 16, 14, 15, 14, 15, 13, 11, 11, 16, 11, 13, 11, 13, 11, 10,
-      12, 16, 12, 13, 10, 13, 11, 10, 16, 16, 14, 14, 12, 14, 12, 10,
-      12, 16, 12, 14, 12, 14, 11, 11, 13, 16, 12, 14, 12, 14, 11, 10,
-      15, 16, 12, 14, 12, 14, 11,  9,  9, 14, 11, 13, 11, 13, 11, 11,
-      13, 16, 12, 14, 13, 14, 12, 11, 16, 16, 16, 16, 16, 16, 14, 12,
-       9, 14, 10, 12, 10, 13, 11, 11, 12, 16, 12, 13, 13, 14, 11, 11,
-      16, 16, 16, 16, 16, 14, 13, 12, 10, 15, 11, 13, 11, 14, 11, 10,
-      13, 16, 12, 13, 12, 15, 11, 10, 16, 16, 14, 16, 15, 16, 13, 11,
-      10, 14, 10, 13, 11, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 11,
-      16, 16, 16, 16, 15, 16, 13, 12, 10, 14, 10, 12, 10, 13, 10, 11,
-      12, 15, 12, 13, 12, 13, 11, 10, 16, 16, 14, 14, 15, 15, 13, 11,
-      11, 16, 11, 13, 11, 14, 11, 10, 12, 16, 11, 13, 12, 14, 11, 10,
-      16, 16, 13, 14, 14, 15, 12, 10, 11, 16, 12, 13, 11, 14, 11, 10,
-      13, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 15, 15, 12, 11,
-      11, 16, 12, 13, 11, 14, 11, 10, 13, 16, 12, 13, 11, 14, 11, 10,
-      16, 16, 14, 15, 13, 14, 12, 10, 12, 16, 12, 14, 12, 14, 10, 10,
-      12, 16, 11, 13, 11, 14, 10, 10, 14, 16, 11, 13, 12, 13, 10,  8,
-    },
-  },
-  {
-    {
-       0, 12,  6, 13,  7, 14, 11, 14,  8, 14, 10, 14, 11, 15, 13, 15,
-      16, 16, 16, 16, 16, 16, 16, 16,  5, 14,  7, 13, 10, 16, 12, 14,
-       9, 16, 10, 14, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16,  9, 14, 14, 16, 13, 16, 12, 16, 11, 16, 16, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  5, 14,  9, 14,  8, 14, 12, 14,
-       9, 16, 11, 14, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 14, 11, 16, 12, 14, 10, 16, 11, 15, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 14, 16,
-      13, 16, 12, 16, 15, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 13, 16, 11, 16, 14, 16, 13, 16, 14, 16, 13, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 14, 16, 13, 16, 14, 16,
-      13, 16, 14, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  1, 12,  6, 12,  8, 14, 11, 13,
-       8, 14, 10, 13, 11, 14, 13, 14, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 14,  7, 13, 10, 14, 11, 14,  9, 16, 10, 14, 12, 16, 13, 15,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16,  9, 14, 13, 16, 13, 14,
-      12, 16, 11, 15, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 14,  9, 13,  8, 14, 12, 14,  9, 16, 11, 14, 11, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 16, 16,  7, 15,  9, 14, 10, 16, 12, 14,
-       9, 16, 10, 14, 11, 16, 12, 14, 16, 16, 16, 16, 16, 16, 15, 16,
-      11, 16, 11, 15, 14, 16, 13, 15, 12, 16, 11, 15, 14, 16, 13, 14,
-      16, 16, 14, 16, 16, 16, 14, 16, 10, 16, 13, 16, 10, 16, 13, 16,
-      12, 16, 14, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 15, 16, 14, 16, 14, 16, 16, 16, 14, 16,
-      15, 16, 14, 16, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 14,
-       4, 14,  8, 13,  9, 16, 12, 14,  9, 16, 11, 14, 11, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 15,  8, 13, 10, 16, 12, 14,
-      10, 16, 11, 14, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16,  9, 14, 13, 16, 13, 15, 12, 16, 11, 16, 14, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16,  9, 14,  9, 16, 12, 14,
-      10, 16, 11, 15, 12, 16, 13, 15, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 14, 11, 16, 12, 14, 10, 16, 11, 14, 12, 16, 13, 15,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 15, 14, 16, 13, 15,
-      12, 16, 11, 15, 14, 16, 13, 14, 16, 16, 14, 16, 16, 16, 14, 16,
-      10, 16, 13, 16, 10, 16, 13, 15, 13, 16, 14, 16, 12, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 12, 16, 13, 16,
-      12, 16, 13, 16, 11, 16, 13, 16, 16, 16, 16, 16, 15, 16, 15, 16,
-      14, 16, 14, 16, 15, 16, 14, 16, 14, 16, 14, 16, 14, 16, 14, 14,
-      16, 16, 14, 16, 15, 16, 14, 14,  6, 16,  9, 14, 10, 16, 12, 14,
-      10, 16, 11, 13, 12, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
-       7, 16,  9, 14, 10, 16, 12, 13, 11, 16, 11, 14, 12, 16, 12, 14,
-      16, 16, 16, 16, 16, 16, 14, 14,  9, 16,  9, 14, 12, 16, 11, 13,
-      12, 16, 11, 14, 12, 16, 12, 13, 16, 16, 14, 16, 16, 16, 13, 14,
-       7, 16, 10, 14, 10, 16, 12, 14, 11, 16, 11, 14, 11, 16, 12, 14,
-      16, 16, 16, 16, 16, 16, 14, 14,  8, 16, 10, 14, 10, 16, 11, 13,
-      10, 16, 11, 13, 11, 16, 12, 13, 16, 16, 14, 16, 16, 16, 14, 14,
-      10, 16,  9, 13, 12, 16, 11, 13, 11, 16, 10, 13, 12, 16, 11, 12,
-      16, 16, 13, 15, 15, 16, 13, 13,  9, 16, 11, 14,  9, 16, 11, 13,
-      12, 16, 12, 16, 12, 16, 12, 13, 16, 16, 16, 16, 15, 16, 14, 14,
-      10, 16, 11, 14, 10, 16, 11, 13, 11, 16, 12, 14, 10, 15, 11, 13,
-      16, 16, 15, 16, 13, 16, 13, 13, 12, 16, 11, 13, 12, 16, 11, 12,
-      12, 16, 11, 13, 11, 14, 11, 11, 13, 16, 12, 13, 12, 14, 11, 11,
-    },
-    {
-       0, 10,  5, 10,  6, 11,  8, 10,  7, 12,  8, 11,  8, 12,  9, 10,
-      14, 16, 13, 13, 13, 14, 12, 11,  4, 12,  6, 10,  8, 12,  9, 10,
-       8, 13,  8, 11,  9, 12,  9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
-       9, 15,  8, 12, 12, 14, 10, 11, 11, 16,  9, 12, 12, 14, 10, 10,
-      14, 16, 11, 13, 13, 15, 11, 11,  4, 12,  8, 11,  6, 11,  9, 10,
-       8, 13,  9, 11,  8, 12,  9, 10, 14, 16, 12, 13, 13, 14, 11, 11,
-       7, 13,  8, 11,  9, 12,  9, 10,  8, 13,  9, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 12, 13, 11, 10, 11, 16, 10, 12, 12, 14, 10, 11,
-      11, 16, 10, 12, 12, 14, 10, 10, 15, 16, 11, 13, 13, 14, 11, 10,
-      10, 16, 11, 13,  9, 13, 10, 11, 11, 15, 12, 13, 10, 12, 10, 11,
-      15, 16, 13, 14, 12, 13, 11, 11, 11, 16, 11, 13, 10, 13, 10, 11,
-      12, 16, 11, 13, 10, 13, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
-      13, 16, 12, 13, 13, 14, 11, 11, 14, 16, 12, 13, 12, 14, 11, 10,
-      16, 16, 13, 13, 13, 14, 11,  9,  3, 11,  6, 10,  6, 11,  9, 10,
-       8, 12,  8, 11,  9, 12,  9, 10, 14, 16, 13, 13, 13, 13, 12, 11,
-       5, 12,  6, 10,  8, 12,  9, 10,  8, 13,  8, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 13, 14, 11, 11,  9, 15,  8, 11, 11, 14, 10, 10,
-      11, 15,  9, 11, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 10,
-       5, 12,  8, 11,  7, 11,  9, 10,  8, 13,  9, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 13, 13, 11, 11,  7, 13,  8, 11,  8, 12,  9, 10,
-       8, 13,  8, 11,  9, 12,  9,  9, 13, 16, 11, 13, 12, 13, 11, 10,
-      10, 15,  9, 12, 11, 14, 10, 10, 11, 15,  9, 11, 11, 13, 10, 10,
-      14, 16, 11, 12, 13, 14, 10, 10,  9, 16, 11, 13,  9, 12, 10, 10,
-      11, 16, 11, 13,  9, 12, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
-      11, 16, 11, 13, 10, 13, 10, 10, 11, 15, 11, 13,  9, 12, 10, 10,
-      14, 16, 12, 13, 11, 13, 10, 10, 13, 16, 12, 13, 12, 14, 11, 10,
-      13, 16, 11, 13, 12, 13, 10, 10, 14, 16, 11, 12, 12, 13, 10,  9,
-       7, 14,  8, 12,  9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 11,
-      16, 16, 14, 14, 14, 14, 12, 12,  7, 14,  8, 12,  9, 13, 10, 11,
-      10, 14, 10, 12, 11, 13, 10, 11, 16, 16, 13, 13, 14, 14, 12, 11,
-      10, 15,  9, 12, 12, 14, 10, 10, 12, 16,  9, 12, 12, 14, 10, 10,
-      16, 16, 12, 13, 14, 15, 12, 11,  8, 14,  9, 12,  9, 13, 10, 11,
-      10, 15, 10, 12, 10, 13, 10, 11, 16, 16, 14, 14, 14, 14, 12, 11,
-       8, 14,  9, 12,  9, 13, 10, 11, 10, 14, 10, 12, 10, 13, 10, 10,
-      15, 16, 13, 13, 13, 14, 12, 11, 10, 15, 10, 12, 12, 14, 10, 10,
-      11, 16,  9, 12, 12, 14, 10, 10, 14, 16, 11, 12, 13, 14, 11, 10,
-      11, 16, 11, 14,  9, 13, 10, 11, 12, 16, 12, 14, 10, 13, 11, 11,
-      16, 16, 14, 15, 13, 14, 12, 11, 11, 16, 12, 14, 10, 13, 11, 11,
-      11, 16, 11, 13, 10, 13, 10, 10, 15, 16, 13, 14, 12, 13, 11, 10,
-      13, 16, 12, 14, 13, 14, 11, 10, 12, 16, 11, 13, 12, 13, 10, 10,
-      14, 16, 11, 12, 11, 13, 10,  9, 10, 16, 10, 13, 11, 14, 11, 11,
-      12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 13, 14, 15, 12, 11,
-      10, 16, 10, 13, 10, 14, 11, 11, 12, 16, 11, 13, 11, 14, 11, 11,
-      16, 16, 14, 13, 14, 14, 12, 11, 11, 15,  9, 12, 11, 14, 10, 10,
-      13, 16, 10, 12, 12, 14, 10, 10, 16, 16, 13, 13, 14, 14, 11, 10,
-      10, 16, 10, 13, 11, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
-      16, 16, 14, 14, 14, 14, 12, 11,  9, 16, 10, 13, 10, 14, 11, 11,
-      11, 15, 11, 12, 11, 13, 11, 11, 16, 16, 13, 13, 14, 14, 12, 10,
-      10, 15,  9, 12, 11, 14, 10, 10, 11, 16,  9, 11, 11, 13, 10,  9,
-      15, 16, 11, 12, 13, 14, 10,  9, 11, 16, 11, 13, 10, 13, 10, 10,
-      13, 16, 12, 13, 11, 13, 10, 10, 16, 16, 14, 14, 13, 13, 11, 10,
-      11, 16, 11, 13, 10, 13, 10, 10, 12, 16, 11, 13, 10, 13, 10, 10,
-      15, 16, 13, 13, 12, 13, 11,  9, 11, 16, 11, 12, 11, 13, 10,  9,
-      11, 15, 10, 11, 11, 12,  9,  8, 13, 15, 10, 10, 10, 11,  8,  7,
-    },
-    {
-       0,  9,  3,  8,  5,  9,  7,  8,  5, 11,  6,  9,  8, 11,  8,  9,
-      16, 16, 16, 16, 16, 16, 11, 10,  2, 10,  4,  9,  7, 10,  7,  8,
-       7, 16,  7, 10,  9, 11,  8,  9, 16, 16, 11, 16, 16, 16, 11, 10,
-       7, 16,  7, 10, 10, 16,  8,  9, 10, 16,  8, 10, 11, 16,  9,  9,
-      16, 16, 16, 16, 16, 16, 11, 10,  3, 11,  6,  9,  6, 11,  8,  8,
-       7, 16,  8, 10,  8, 11,  8,  9, 16, 16, 15, 16, 16, 16, 11, 10,
-       5, 11,  7,  9,  8, 11,  8,  8,  7, 16,  7, 10,  8, 11,  8,  8,
-      16, 16, 11, 16, 16, 16, 10,  9,  9, 16,  8, 11, 11, 16,  9,  9,
-      10, 16,  8, 11, 11, 16,  9,  9, 16, 16, 10, 16, 16, 16, 10,  9,
-       8, 16, 10, 11,  8, 16,  9,  9, 11, 16, 11, 16, 10, 16, 10,  9,
-      16, 16, 16, 16, 16, 16, 11, 10,  9, 16, 10, 16, 10, 16,  9,  9,
-      10, 16, 10, 16,  9, 16,  9,  9, 16, 16, 16, 16, 15, 16, 10,  9,
-      16, 16, 11, 16, 16, 16, 10, 10, 13, 16, 11, 16, 11, 16, 10,  9,
-      16, 16, 10, 11, 11, 16,  9,  8, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       1, 10,  6, 10,  7, 11,  9, 10,  8, 12,  9, 12,  9, 12, 10, 10,
-      16, 16, 14, 16, 14, 15, 13, 12,  5, 12,  7, 10,  9, 11,  9, 10,
-       9, 13,  9, 12, 10, 13, 10, 10, 16, 16, 14, 15, 14, 14, 13, 12,
-      10, 15, 10, 12, 12, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
-      16, 16, 14, 16, 15, 16, 13, 12,  6, 12,  8, 11,  8, 11, 10, 10,
-       9, 13, 10, 12, 10, 12, 10, 10, 15, 16, 13, 15, 13, 14, 12, 12,
-       7, 13,  9, 11,  9, 12, 10, 10,  9, 14, 10, 12, 10, 13, 10, 10,
-      15, 16, 13, 15, 13, 14, 12, 11, 11, 15, 11, 13, 12, 14, 11, 11,
-      12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 11,
-      10, 16, 12, 14, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
-      16, 16, 15, 16, 14, 16, 13, 12, 11, 16, 12, 14, 11, 14, 11, 11,
-      12, 16, 12, 14, 11, 14, 11, 11, 16, 16, 14, 15, 13, 15, 12, 12,
-      13, 16, 13, 15, 13, 15, 12, 12, 13, 16, 12, 15, 12, 15, 11, 11,
-      16, 16, 13, 16, 13, 15, 12, 11,  4, 11,  7, 10,  7, 11,  9, 10,
-       9, 13,  9, 12, 10, 12, 10, 10, 15, 16, 14, 15, 14, 15, 13, 12,
-       6, 12,  7, 11,  9, 11,  9, 10,  9, 13,  9, 12, 10, 12, 10, 10,
-      15, 16, 14, 15, 14, 15, 12, 12, 10, 15,  9, 12, 12, 13, 11, 11,
-      12, 15, 11, 13, 12, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 12,
-       6, 12,  8, 11,  8, 11,  9, 10,  9, 14, 10, 12, 10, 12, 10, 10,
-      14, 16, 13, 14, 13, 14, 12, 12,  8, 13,  9, 11,  9, 12, 10, 10,
-       9, 13,  9, 12,  9, 12,  9, 10, 14, 16, 13, 14, 13, 14, 12, 11,
-      11, 15, 11, 13, 11, 14, 11, 11, 12, 16, 10, 13, 12, 13, 11, 10,
-      15, 16, 12, 15, 13, 16, 12, 11, 10, 15, 11, 13, 10, 13, 11, 11,
-      12, 16, 12, 14, 11, 13, 11, 11, 16, 16, 14, 15, 13, 16, 13, 12,
-      11, 16, 11, 14, 11, 13, 11, 11, 12, 16, 12, 14, 10, 13, 11, 11,
-      15, 16, 13, 16, 12, 14, 12, 11, 12, 16, 12, 14, 12, 15, 11, 11,
-      13, 16, 12, 14, 12, 14, 11, 11, 15, 16, 13, 15, 13, 15, 11, 10,
-       7, 13,  9, 12, 10, 13, 11, 11, 11, 15, 12, 13, 12, 13, 11, 11,
-      16, 16, 15, 16, 16, 16, 14, 13,  8, 13,  9, 12, 10, 13, 11, 11,
-      12, 15, 11, 13, 12, 13, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
-      11, 16, 11, 13, 12, 14, 11, 11, 13, 16, 12, 14, 13, 15, 12, 11,
-      16, 16, 14, 16, 15, 16, 13, 12,  9, 15, 10, 13, 10, 13, 11, 11,
-      12, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 16, 16, 16, 13, 12,
-       9, 14, 10, 13, 10, 13, 11, 11, 11, 14, 11, 13, 11, 13, 11, 11,
-      16, 16, 14, 16, 14, 16, 12, 12, 11, 16, 11, 14, 12, 14, 12, 11,
-      12, 16, 11, 13, 13, 14, 11, 11, 16, 16, 13, 15, 14, 16, 12, 11,
-      12, 16, 12, 14, 11, 14, 11, 11, 13, 16, 13, 14, 12, 15, 12, 11,
-      16, 16, 16, 16, 14, 16, 13, 12, 12, 16, 12, 14, 11, 14, 12, 11,
-      12, 16, 12, 15, 11, 14, 11, 11, 16, 16, 14, 16, 13, 15, 12, 12,
-      13, 16, 13, 16, 13, 16, 12, 12, 13, 16, 12, 15, 12, 16, 11, 11,
-      14, 16, 12, 15, 12, 15, 11, 10,  9, 16, 11, 14, 12, 14, 12, 12,
-      13, 16, 13, 15, 14, 16, 12, 12, 16, 16, 16, 16, 16, 16, 14, 13,
-      10, 16, 11, 14, 12, 14, 12, 12, 13, 16, 13, 14, 13, 16, 12, 12,
-      16, 16, 15, 16, 16, 16, 13, 12, 11, 16, 11, 14, 12, 15, 12, 11,
-      13, 16, 12, 14, 13, 16, 12, 11, 16, 16, 14, 16, 16, 16, 13, 12,
-      11, 16, 11, 14, 12, 14, 12, 12, 13, 16, 12, 15, 13, 16, 12, 12,
-      16, 16, 16, 16, 16, 16, 14, 13, 10, 16, 11, 14, 11, 15, 11, 11,
-      13, 16, 12, 14, 12, 14, 12, 11, 16, 16, 14, 16, 16, 16, 13, 12,
-      11, 16, 11, 15, 12, 15, 12, 11, 13, 16, 11, 14, 13, 15, 12, 11,
-      16, 16, 13, 16, 14, 16, 12, 11, 12, 16, 12, 15, 11, 15, 12, 11,
-      14, 16, 13, 15, 12, 16, 12, 11, 16, 16, 15, 16, 14, 16, 13, 12,
-      11, 16, 12, 15, 11, 15, 11, 11, 13, 16, 13, 16, 11, 15, 11, 11,
-      16, 16, 14, 16, 13, 15, 12, 11, 12, 16, 12, 15, 12, 16, 11, 11,
-      12, 16, 11, 15, 12, 14, 11, 11, 13, 16, 12, 13, 11, 13, 10,  9,
-    },
-  },
-  {
-    {
-       0, 13,  6, 13,  8, 14, 12, 16,  8, 16, 11, 16, 12, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 16,  7, 14, 11, 16, 13, 16,
-       9, 16, 11, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 10, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  5, 16, 10, 16,  8, 16, 13, 16,
-      10, 16, 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 16, 11, 16, 13, 16, 10, 16, 12, 16, 12, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 16, 16, 16, 16,
-      14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 16, 16, 11, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
-      14, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  1, 13,  7, 13,  8, 16, 12, 16,
-       8, 16, 10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       4, 16,  7, 14, 10, 16, 12, 16,  9, 16, 10, 16, 12, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 10, 16,  9, 16, 14, 16, 14, 16,
-      13, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 16,  9, 16,  8, 16, 12, 16,  9, 16, 11, 16, 11, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  7, 16, 10, 16, 11, 16, 13, 16,
-       9, 16, 11, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 12, 16, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 13, 16, 11, 16, 14, 16,
-      13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 14, 16, 13, 16, 14, 16, 13, 16, 14, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       4, 16,  8, 16,  9, 16, 13, 16, 10, 16, 11, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16,  8, 16, 11, 16, 13, 16,
-      10, 16, 11, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16,  9, 16, 13, 16, 13, 16, 13, 16, 12, 16, 16, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16, 10, 16, 10, 16, 13, 16,
-      10, 16, 12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 16, 11, 16, 13, 16, 10, 16, 11, 16, 12, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 14, 16,
-      12, 16, 11, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 13, 16, 10, 16, 13, 16, 13, 16, 16, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 12, 16, 14, 16,
-      12, 16, 15, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16, 10, 16, 10, 16, 13, 16,
-      11, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16,  9, 16, 11, 16, 12, 16, 11, 16, 11, 16, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16,  9, 16, 12, 16, 12, 16,
-      13, 16, 11, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 16, 10, 16, 12, 16, 11, 16, 12, 16, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16, 10, 16, 11, 16, 12, 16,
-      10, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 10, 14, 12, 16, 12, 16, 11, 16, 10, 14, 13, 16, 12, 14,
-      16, 16, 14, 16, 16, 16, 14, 16,  9, 16, 12, 16, 10, 16, 12, 16,
-      13, 16, 13, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 11, 16, 12, 16, 11, 16, 12, 16, 11, 16, 12, 15,
-      16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 12, 16, 13, 16, 12, 13,
-      12, 16, 12, 16, 12, 16, 12, 13, 16, 16, 13, 14, 13, 16, 13, 13,
-    },
-    {
-       0, 10,  5, 10,  5, 10,  8, 10,  6, 11,  8, 11,  8, 11,  9, 10,
-      14, 16, 13, 14, 13, 14, 12, 12,  4, 12,  5, 10,  8, 12,  9, 10,
-       7, 12,  8, 11,  9, 12,  9, 10, 14, 16, 12, 13, 13, 14, 12, 12,
-       9, 16,  8, 12, 12, 14, 10, 11, 11, 16,  9, 12, 12, 14, 11, 11,
-      14, 16, 12, 13, 14, 15, 12, 12,  4, 12,  7, 11,  6, 11,  9, 10,
-       8, 12,  9, 11,  8, 11,  9, 10, 14, 16, 12, 14, 13, 14, 12, 12,
-       7, 13,  8, 11,  8, 12,  9, 10,  8, 13,  8, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 12, 13, 11, 11, 11, 16, 10, 12, 12, 14, 11, 11,
-      12, 16, 10, 12, 12, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 11,
-      10, 16, 11, 14,  9, 13, 10, 11, 11, 16, 12, 14, 10, 13, 11, 11,
-      15, 16, 13, 14, 13, 14, 12, 12, 11, 16, 12, 14, 10, 13, 11, 11,
-      12, 16, 12, 14, 11, 13, 11, 11, 15, 16, 13, 14, 13, 14, 12, 11,
-      14, 16, 13, 14, 13, 15, 12, 12, 14, 16, 12, 14, 13, 15, 11, 11,
-      16, 16, 13, 14, 14, 15, 12, 11,  3, 11,  5, 10,  6, 11,  9, 10,
-       7, 12,  8, 11,  9, 11,  9, 10, 14, 16, 13, 13, 13, 14, 12, 12,
-       5, 12,  6, 10,  8, 12,  9, 10,  8, 13,  8, 11,  9, 12,  9, 10,
-      14, 16, 12, 13, 13, 14, 12, 12,  9, 16,  8, 11, 11, 14, 10, 11,
-      11, 16,  9, 12, 12, 14, 10, 11, 15, 16, 12, 13, 14, 15, 12, 11,
-       5, 12,  7, 11,  6, 11,  9, 10,  8, 13,  9, 11,  8, 11,  9, 10,
-      14, 16, 12, 14, 13, 13, 12, 12,  7, 13,  8, 11,  8, 12,  9, 10,
-       8, 12,  8, 11,  9, 12,  9, 10, 13, 16, 12, 13, 12, 13, 11, 11,
-      10, 16,  9, 12, 12, 14, 10, 11, 11, 15,  9, 12, 12, 14, 10, 11,
-      14, 16, 11, 13, 13, 14, 11, 11,  9, 16, 11, 14,  8, 13, 10, 11,
-      11, 16, 12, 13, 10, 13, 10, 11, 16, 16, 13, 15, 13, 14, 12, 12,
-      11, 16, 11, 14, 10, 13, 10, 11, 11, 16, 11, 13, 10, 13, 10, 11,
-      14, 16, 13, 14, 12, 13, 11, 11, 14, 16, 12, 14, 13, 15, 11, 11,
-      13, 16, 12, 13, 12, 14, 11, 11, 14, 16, 12, 13, 12, 13, 11, 10,
-       6, 14,  8, 12,  9, 13, 10, 11, 10, 14, 10, 12, 11, 13, 11, 12,
-      16, 16, 14, 14, 14, 14, 13, 12,  7, 14,  8, 12,  9, 13, 10, 11,
-      10, 14, 10, 12, 11, 13, 11, 11, 16, 16, 13, 14, 14, 15, 13, 12,
-      10, 16,  8, 12, 12, 14, 10, 11, 12, 16, 10, 12, 13, 15, 11, 11,
-      16, 16, 13, 14, 15, 16, 12, 12,  8, 15,  9, 13,  9, 13, 10, 11,
-      10, 15, 10, 13, 10, 13, 11, 11, 16, 16, 14, 14, 14, 14, 13, 12,
-       8, 15,  9, 12, 10, 13, 10, 11, 10, 14, 10, 12, 10, 13, 10, 11,
-      16, 16, 13, 14, 13, 14, 12, 12, 10, 16, 10, 13, 12, 15, 11, 11,
-      11, 16,  9, 12, 12, 14, 11, 11, 14, 16, 11, 13, 14, 16, 12, 11,
-      10, 16, 12, 14,  9, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
-      16, 16, 15, 16, 14, 14, 13, 12, 11, 16, 12, 14, 11, 14, 11, 11,
-      11, 16, 12, 14, 10, 13, 11, 11, 15, 16, 13, 15, 12, 14, 12, 11,
-      14, 16, 13, 14, 13, 16, 12, 12, 12, 16, 12, 13, 12, 14, 11, 11,
-      14, 16, 11, 12, 12, 13, 10, 10,  9, 16, 10, 14, 11, 15, 12, 12,
-      12, 16, 11, 13, 12, 15, 12, 12, 16, 16, 14, 13, 15, 15, 13, 12,
-      10, 16, 10, 14, 11, 15, 11, 12, 12, 16, 11, 13, 12, 14, 12, 12,
-      16, 16, 14, 13, 15, 14, 13, 12, 11, 16,  9, 12, 12, 14, 11, 11,
-      13, 16, 11, 13, 13, 15, 11, 11, 16, 16, 14, 14, 16, 16, 12, 12,
-      10, 16, 10, 14, 11, 14, 11, 12, 12, 16, 11, 13, 12, 14, 12, 12,
-      16, 16, 14, 14, 15, 15, 13, 12, 10, 16, 10, 13, 11, 14, 11, 12,
-      11, 16, 11, 13, 11, 14, 11, 12, 16, 16, 14, 14, 14, 14, 13, 12,
-      11, 16, 10, 12, 12, 15, 11, 11, 12, 16,  9, 12, 12, 14, 10, 11,
-      16, 16, 12, 13, 14, 15, 11, 11, 11, 16, 12, 14, 10, 14, 11, 11,
-      13, 16, 12, 14, 12, 14, 11, 11, 16, 16, 15, 15, 14, 15, 12, 12,
-      11, 16, 12, 14, 11, 14, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
-      16, 16, 14, 14, 13, 14, 12, 11, 12, 16, 11, 13, 12, 14, 10, 10,
-      12, 15, 11, 12, 12, 13, 10, 10, 14, 15, 11, 11, 12, 12, 10,  9,
-    },
-    {
-       0,  8,  3,  8,  5,  9,  7,  8,  5, 10,  6, 10,  8, 11,  8,  9,
-      16, 16, 15, 16, 16, 16, 11, 11,  2, 10,  4,  9,  7, 10,  7,  8,
-       7, 16,  7, 10,  9, 11,  8,  9, 16, 16, 15, 16, 16, 16, 11, 11,
-       7, 16,  6, 11, 10, 16,  9, 10, 10, 16,  9, 11, 11, 16,  9, 10,
-      16, 16, 16, 16, 16, 16, 16, 11,  3, 10,  6,  9,  5, 10,  7,  9,
-       7, 16,  8, 10,  8, 11,  8,  9, 16, 16, 16, 16, 16, 16, 11, 11,
-       5, 11,  7, 10,  8, 11,  8,  9,  7, 14,  7, 10,  8, 11,  8,  9,
-      16, 16, 11, 16, 16, 16, 10, 11,  9, 16,  9, 11, 11, 16,  9, 10,
-      10, 16,  8, 11, 11, 16,  9, 10, 16, 16, 11, 16, 16, 16, 11, 10,
-       8, 16,  9, 16,  7, 16,  9, 10, 11, 16, 11, 16, 10, 16, 10, 10,
-      16, 16, 16, 16, 16, 16, 16, 11,  9, 16, 10, 16,  9, 16,  9, 10,
-      10, 16, 10, 16,  9, 16,  9, 10, 16, 16, 16, 16, 11, 16, 11, 11,
-      16, 16, 16, 16, 16, 16, 10, 10, 11, 16, 11, 16, 11, 16, 10, 10,
-      16, 16, 11, 16, 11, 16, 10,  9, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       1, 10,  6, 10,  7, 11,  9, 10,  8, 12,  9, 12,  9, 12, 10, 10,
-      15, 16, 14, 15, 14, 16, 13, 12,  5, 12,  7, 11,  8, 11,  9, 10,
-       9, 13,  9, 12, 10, 12, 10, 10, 16, 16, 14, 15, 13, 16, 13, 12,
-      10, 15, 10, 13, 12, 14, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
-      16, 16, 14, 16, 14, 16, 13, 12,  5, 12,  8, 11,  7, 11,  9, 10,
-       9, 13, 10, 12,  9, 12, 10, 10, 14, 16, 14, 15, 13, 14, 13, 12,
-       7, 13,  9, 12,  9, 12, 10, 10,  9, 13,  9, 12,  9, 12, 10, 10,
-      14, 16, 13, 14, 13, 15, 12, 12, 11, 16, 11, 13, 12, 14, 11, 11,
-      12, 16, 11, 14, 12, 14, 11, 11, 16, 16, 14, 16, 14, 16, 13, 12,
-      10, 16, 11, 14, 10, 13, 11, 11, 12, 16, 12, 14, 11, 13, 11, 11,
-      15, 16, 15, 16, 14, 16, 13, 12, 11, 16, 12, 14, 11, 14, 11, 12,
-      12, 16, 12, 14, 11, 14, 11, 11, 15, 16, 14, 16, 13, 16, 13, 12,
-      13, 16, 13, 16, 13, 16, 12, 12, 13, 16, 13, 16, 13, 16, 12, 12,
-      16, 16, 14, 15, 14, 16, 13, 12,  4, 11,  7, 10,  7, 11,  9, 10,
-       9, 13,  9, 11,  9, 12, 10, 10, 15, 16, 14, 15, 14, 15, 13, 12,
-       6, 12,  7, 11,  8, 11,  9, 10,  9, 13,  9, 12, 10, 12, 10, 10,
-      15, 16, 13, 14, 14, 15, 12, 12, 10, 14, 10, 12, 12, 13, 11, 11,
-      12, 16, 11, 13, 12, 14, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
-       6, 12,  8, 11,  8, 11,  9, 10,  9, 13, 10, 12,  9, 12, 10, 10,
-      16, 16, 14, 15, 13, 14, 12, 12,  8, 13,  9, 11,  9, 12,  9, 10,
-       9, 13,  9, 12,  9, 12,  9, 10, 14, 16, 13, 14, 13, 14, 12, 11,
-      11, 15, 11, 13, 12, 14, 11, 11, 11, 16, 10, 13, 12, 14, 11, 11,
-      15, 16, 13, 15, 14, 16, 12, 11, 10, 16, 12, 13, 10, 13, 11, 11,
-      11, 16, 12, 14, 10, 13, 11, 11, 16, 16, 14, 16, 13, 16, 13, 12,
-      11, 16, 12, 14, 10, 14, 11, 11, 11, 16, 12, 14, 10, 13, 11, 11,
-      16, 16, 14, 16, 12, 15, 12, 11, 13, 16, 13, 15, 13, 15, 12, 12,
-      13, 16, 12, 15, 12, 15, 12, 11, 15, 16, 13, 16, 13, 16, 12, 11,
-       8, 14,  9, 12, 10, 13, 11, 11, 11, 16, 11, 13, 11, 13, 11, 11,
-      16, 16, 16, 16, 16, 16, 14, 13,  9, 14, 10, 12, 10, 13, 11, 11,
-      11, 16, 11, 13, 12, 13, 11, 11, 16, 16, 15, 16, 15, 16, 14, 12,
-      11, 16, 11, 13, 12, 14, 12, 11, 13, 16, 12, 14, 13, 14, 12, 11,
-      16, 16, 15, 16, 16, 16, 14, 13,  9, 14, 10, 13, 10, 13, 11, 11,
-      11, 16, 11, 13, 11, 13, 11, 11, 16, 16, 15, 16, 14, 15, 14, 13,
-       9, 14, 10, 13, 10, 13, 11, 11, 11, 15, 11, 13, 11, 13, 11, 11,
-      16, 16, 14, 16, 14, 16, 13, 12, 12, 16, 12, 14, 13, 14, 12, 11,
-      12, 16, 11, 14, 12, 15, 12, 11, 16, 16, 13, 16, 15, 16, 13, 11,
-      11, 16, 12, 14, 11, 14, 12, 11, 13, 16, 13, 15, 12, 14, 12, 12,
-      16, 16, 16, 16, 14, 16, 14, 13, 12, 16, 13, 15, 11, 14, 12, 12,
-      12, 16, 13, 14, 11, 15, 12, 11, 16, 16, 15, 16, 13, 15, 13, 12,
-      13, 16, 13, 15, 13, 16, 12, 12, 13, 16, 13, 15, 13, 15, 12, 12,
-      15, 16, 13, 16, 13, 15, 11, 10, 10, 16, 12, 14, 12, 15, 12, 12,
-      14, 16, 13, 15, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 15, 13,
-      10, 16, 12, 14, 12, 15, 12, 12, 13, 16, 13, 15, 13, 15, 13, 12,
-      16, 16, 16, 16, 16, 16, 14, 13, 11, 16, 12, 15, 13, 16, 12, 12,
-      14, 16, 13, 16, 13, 16, 12, 12, 16, 16, 15, 16, 15, 16, 14, 12,
-      11, 16, 12, 14, 12, 16, 12, 12, 14, 16, 13, 15, 13, 15, 13, 12,
-      16, 16, 16, 16, 16, 16, 15, 13, 11, 16, 12, 14, 12, 15, 12, 12,
-      13, 16, 12, 14, 12, 15, 12, 12, 16, 16, 16, 16, 16, 16, 14, 12,
-      12, 16, 12, 15, 13, 16, 12, 12, 13, 16, 12, 15, 13, 15, 12, 11,
-      16, 16, 14, 16, 15, 16, 13, 12, 12, 16, 13, 16, 12, 16, 12, 12,
-      15, 16, 14, 16, 13, 16, 12, 12, 16, 16, 16, 16, 16, 16, 14, 13,
-      12, 16, 13, 15, 12, 16, 12, 12, 13, 16, 13, 15, 12, 15, 12, 12,
-      16, 16, 15, 16, 14, 16, 13, 12, 13, 16, 13, 16, 12, 16, 12, 12,
-      13, 16, 12, 16, 12, 15, 12, 12, 14, 16, 12, 14, 12, 14, 11, 10,
-    },
-  },
-  {
-    {
-       0, 16,  6, 16,  8, 16, 16, 16,  9, 16, 11, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 16,  7, 16, 11, 16, 16, 16,
-      10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 10, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  5, 16, 10, 16,  9, 16, 16, 16,
-      10, 16, 13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 11, 16, 12, 16, 16, 16, 10, 16, 12, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  1, 16,  7, 16,  8, 16, 13, 16,
-       9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       4, 16,  7, 16, 11, 16, 13, 16,  9, 16, 11, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16,  9, 16, 16, 16, 16, 16,
-      13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       4, 16, 10, 16,  8, 16, 16, 16, 10, 16, 12, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  7, 16, 10, 16, 11, 16, 16, 16,
-       9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 12, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 16, 16, 11, 16, 16, 16,
-      16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       4, 16,  8, 16, 10, 16, 16, 16, 10, 16, 11, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16,  8, 16, 11, 16, 16, 16,
-      10, 16, 12, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16,  9, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16, 10, 16, 10, 16, 16, 16,
-      11, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 11, 16, 11, 16, 16, 16, 10, 16, 12, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16,
-      12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 16, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 12, 16, 16, 16,
-      12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16, 10, 16, 11, 16, 16, 16,
-      11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16,  9, 16, 11, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16,  9, 16, 13, 16, 12, 16,
-      13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 16, 10, 16, 14, 16, 12, 16, 12, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 11, 16, 11, 16, 13, 16,
-      10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 10, 16, 13, 16, 12, 16, 12, 16, 11, 16, 16, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 12, 16, 10, 16, 13, 16,
-      16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 13, 16, 11, 16, 13, 16, 12, 16, 13, 16, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 12, 16,
-      13, 16, 12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       0, 10,  4, 10,  5, 11,  9, 11,  6, 11,  8, 11,  8, 12, 10, 12,
-      15, 16, 13, 15, 14, 15, 13, 14,  4, 12,  5, 11,  8, 12,  9, 11,
-       7, 13,  8, 12,  9, 13, 10, 12, 15, 16, 13, 15, 14, 16, 13, 14,
-      10, 16,  9, 13, 12, 16, 11, 13, 11, 16, 10, 14, 13, 16, 12, 13,
-      16, 16, 14, 16, 15, 16, 14, 15,  4, 12,  7, 12,  6, 12,  9, 11,
-       8, 13,  9, 12,  9, 12, 10, 12, 15, 16, 13, 15, 14, 15, 13, 14,
-       7, 13,  8, 12,  9, 13, 10, 12,  8, 13,  9, 12,  9, 13, 10, 12,
-      14, 16, 13, 15, 13, 15, 13, 14, 12, 16, 11, 14, 13, 16, 12, 13,
-      12, 16, 11, 14, 13, 16, 12, 13, 16, 16, 14, 16, 15, 16, 14, 15,
-      10, 16, 12, 16, 10, 14, 12, 13, 12, 16, 13, 16, 11, 14, 12, 13,
-      16, 16, 16, 16, 15, 16, 14, 15, 12, 16, 13, 16, 11, 15, 12, 13,
-      13, 16, 13, 16, 12, 15, 12, 14, 16, 16, 16, 16, 14, 16, 13, 14,
-      16, 16, 14, 16, 14, 16, 13, 15, 16, 16, 14, 16, 14, 16, 13, 15,
-      16, 16, 16, 16, 16, 16, 14, 16,  2, 11,  5, 11,  6, 11,  9, 11,
-       7, 12,  8, 11,  9, 12, 10, 12, 15, 16, 14, 14, 14, 14, 13, 14,
-       4, 13,  6, 11,  8, 12,  9, 11,  8, 13,  8, 12, 10, 13, 10, 12,
-      15, 16, 13, 15, 14, 15, 13, 14,  9, 16,  8, 13, 12, 15, 11, 12,
-      11, 16, 10, 14, 13, 16, 12, 13, 16, 16, 14, 16, 16, 16, 14, 15,
-       5, 13,  8, 12,  7, 12,  9, 11,  8, 13,  9, 12,  9, 12, 10, 12,
-      16, 16, 14, 15, 14, 15, 13, 13,  7, 13,  8, 12,  9, 13, 10, 12,
-       8, 13,  8, 12,  9, 13, 10, 12, 14, 16, 13, 14, 13, 15, 12, 13,
-      11, 16, 10, 14, 13, 16, 12, 13, 11, 16, 10, 13, 12, 15, 11, 13,
-      14, 16, 12, 14, 14, 16, 13, 14, 10, 16, 12, 15,  9, 14, 11, 13,
-      12, 16, 12, 16, 11, 14, 12, 13, 16, 16, 15, 16, 16, 16, 14, 15,
-      11, 16, 12, 15, 11, 15, 12, 13, 12, 16, 12, 15, 11, 14, 12, 13,
-      16, 16, 14, 16, 13, 15, 13, 14, 15, 16, 14, 16, 14, 16, 13, 14,
-      14, 16, 13, 16, 14, 16, 13, 14, 16, 16, 14, 16, 14, 16, 13, 14,
-       7, 15,  8, 13,  9, 14, 11, 13, 10, 14, 10, 13, 11, 14, 12, 13,
-      16, 16, 15, 16, 15, 16, 15, 14,  7, 16,  8, 13, 10, 14, 11, 13,
-      11, 15, 10, 13, 12, 14, 12, 13, 16, 16, 16, 16, 16, 16, 15, 15,
-      10, 16,  9, 13, 13, 16, 12, 13, 13, 16, 11, 14, 14, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 15, 16,  8, 16, 10, 14,  9, 14, 11, 13,
-      11, 16, 11, 14, 11, 14, 12, 13, 16, 16, 16, 16, 16, 16, 14, 15,
-       8, 16, 10, 14, 10, 14, 11, 13, 10, 15, 10, 14, 11, 14, 12, 13,
-      16, 16, 14, 16, 15, 16, 14, 14, 11, 16, 10, 14, 13, 16, 12, 13,
-      11, 16, 10, 13, 13, 16, 12, 13, 16, 16, 13, 16, 16, 16, 14, 14,
-      11, 16, 12, 16, 10, 15, 12, 13, 14, 16, 14, 16, 12, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 11, 16, 12, 14,
-      12, 16, 13, 16, 11, 14, 12, 13, 16, 16, 16, 16, 14, 16, 14, 14,
-      15, 16, 14, 16, 16, 16, 13, 14, 13, 16, 13, 15, 14, 16, 13, 14,
-      14, 16, 13, 14, 14, 15, 13, 14,  9, 16, 11, 16, 12, 16, 13, 14,
-      12, 16, 12, 15, 13, 16, 13, 14, 16, 16, 16, 15, 16, 16, 15, 15,
-      10, 16, 10, 16, 12, 16, 12, 14, 12, 16, 12, 14, 13, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 15, 15, 11, 16, 10, 14, 14, 16, 12, 13,
-      14, 16, 12, 16, 14, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 15,
-      10, 16, 12, 16, 11, 16, 12, 14, 13, 16, 12, 15, 13, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 16, 15, 10, 16, 11, 16, 12, 16, 12, 14,
-      12, 16, 12, 15, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
-      11, 16, 10, 14, 14, 16, 12, 13, 13, 16, 11, 14, 14, 16, 12, 13,
-      16, 16, 15, 16, 16, 16, 14, 14, 12, 16, 13, 16, 11, 16, 12, 14,
-      15, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 16,
-      12, 16, 13, 16, 12, 16, 12, 14, 13, 16, 13, 16, 12, 16, 12, 13,
-      16, 16, 16, 16, 16, 16, 14, 15, 13, 16, 13, 16, 14, 16, 12, 13,
-      13, 16, 13, 14, 14, 16, 12, 13, 16, 16, 14, 14, 14, 15, 13, 13,
-    },
-    {
-       0,  9,  3,  9,  5,  9,  7,  9,  5, 10,  7, 11,  8, 11,  9, 10,
-      16, 16, 16, 16, 16, 16, 16, 16,  2, 11,  4, 10,  7, 11,  8, 10,
-       7, 16,  7, 11,  9, 16,  9, 11, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16,  7, 16, 11, 16, 10, 11, 11, 16, 10, 16, 16, 16, 11, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  2, 11,  6, 10,  6, 10,  8, 10,
-       7, 16,  8, 16,  8, 11,  9, 11, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 13,  7, 11,  8, 11,  9, 11,  6, 12,  8, 12,  8, 12,  9, 11,
-      16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 10, 16, 12, 16, 10, 13,
-      10, 16,  9, 16, 11, 16, 11, 12, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 16,  8, 16, 10, 12, 11, 16, 12, 16, 10, 16, 11, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 10, 16, 11, 16, 10, 16, 11, 16,
-      11, 16, 12, 16, 10, 16, 11, 12, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       1, 10,  5, 10,  6, 10,  9, 10,  7, 12,  9, 12,  9, 12, 10, 10,
-      16, 16, 15, 16, 14, 16, 13, 13,  5, 12,  7, 11,  8, 11,  9, 10,
-       8, 13,  9, 12, 10, 12, 10, 11, 16, 16, 16, 16, 14, 16, 13, 12,
-      10, 16, 10, 13, 12, 14, 12, 12, 12, 16, 11, 14, 13, 15, 12, 12,
-      16, 16, 16, 15, 16, 16, 14, 13,  5, 12,  8, 11,  7, 11,  9, 10,
-       8, 13, 10, 12,  9, 12, 10, 10, 15, 16, 14, 15, 14, 14, 13, 13,
-       7, 13,  9, 12,  9, 12, 10, 10,  9, 13, 10, 13, 10, 13, 10, 10,
-      14, 16, 14, 15, 14, 16, 13, 12, 11, 16, 12, 14, 12, 15, 12, 12,
-      12, 16, 12, 15, 13, 16, 12, 12, 16, 16, 15, 16, 16, 16, 14, 13,
-      10, 16, 12, 14, 10, 14, 12, 12, 12, 16, 13, 14, 11, 14, 12, 12,
-      16, 16, 16, 16, 14, 16, 14, 13, 11, 16, 12, 14, 11, 14, 12, 12,
-      12, 16, 13, 16, 11, 15, 12, 12, 16, 16, 16, 16, 14, 16, 14, 13,
-      13, 16, 14, 16, 14, 16, 13, 13, 13, 16, 13, 16, 13, 16, 13, 12,
-      16, 16, 16, 16, 16, 16, 13, 13,  4, 11,  7, 10,  7, 11,  9, 10,
-       8, 12,  9, 12,  9, 12, 10, 11, 15, 16, 14, 15, 14, 16, 13, 13,
-       6, 12,  7, 11,  8, 11,  9, 10,  9, 13,  9, 12, 10, 12, 10, 10,
-      16, 16, 15, 16, 15, 16, 13, 12, 10, 16, 10, 13, 12, 14, 12, 11,
-      12, 16, 11, 14, 13, 14, 12, 12, 16, 16, 16, 14, 16, 16, 14, 13,
-       6, 12,  8, 11,  7, 11,  9, 10,  9, 14, 10, 12,  9, 12, 10, 10,
-      15, 16, 14, 16, 14, 16, 14, 13,  7, 13,  9, 12,  9, 12, 10, 10,
-       9, 13,  9, 12,  9, 12, 10, 10, 14, 16, 13, 14, 14, 16, 12, 11,
-      11, 16, 11, 14, 12, 14, 12, 12, 12, 16, 11, 14, 12, 14, 12, 11,
-      16, 16, 13, 16, 14, 16, 13, 12, 10, 16, 12, 14, 10, 14, 11, 11,
-      12, 16, 13, 14, 11, 14, 12, 12, 16, 16, 16, 16, 14, 16, 13, 13,
-      11, 16, 12, 16, 11, 14, 12, 12, 12, 16, 12, 14, 11, 14, 12, 11,
-      16, 16, 15, 16, 13, 15, 13, 12, 13, 16, 14, 16, 13, 16, 13, 12,
-      13, 16, 13, 16, 13, 16, 13, 12, 16, 16, 14, 16, 14, 16, 12, 11,
-       8, 13, 10, 12, 10, 13, 11, 11, 11, 14, 12, 14, 12, 14, 12, 12,
-      16, 16, 16, 16, 16, 16, 14, 13,  9, 14, 10, 13, 10, 13, 11, 11,
-      12, 16, 12, 13, 12, 13, 12, 11, 16, 16, 16, 16, 16, 16, 15, 14,
-      12, 16, 11, 14, 13, 15, 12, 12, 13, 16, 12, 15, 14, 15, 13, 12,
-      16, 16, 16, 16, 16, 16, 15, 13,  9, 14, 11, 13, 10, 13, 11, 11,
-      11, 16, 12, 14, 12, 14, 12, 12, 16, 16, 16, 16, 16, 16, 16, 13,
-      10, 15, 11, 13, 11, 14, 12, 11, 11, 16, 12, 14, 11, 14, 12, 11,
-      16, 16, 16, 16, 16, 16, 14, 12, 12, 16, 12, 14, 13, 15, 13, 12,
-      12, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 16, 16, 16, 14, 12,
-      12, 16, 13, 16, 11, 14, 12, 12, 14, 16, 14, 16, 12, 16, 13, 12,
-      16, 16, 16, 16, 16, 16, 16, 13, 12, 16, 13, 16, 12, 16, 13, 12,
-      12, 16, 13, 16, 12, 16, 12, 12, 16, 16, 16, 16, 14, 16, 14, 12,
-      14, 16, 14, 16, 14, 16, 14, 13, 13, 16, 13, 16, 13, 16, 13, 12,
-      16, 16, 13, 16, 13, 16, 12, 11,  9, 16, 12, 15, 13, 16, 13, 12,
-      13, 16, 14, 16, 14, 16, 14, 13, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 16, 12, 15, 12, 15, 13, 12, 13, 16, 14, 16, 13, 16, 13, 12,
-      16, 16, 16, 16, 16, 16, 16, 13, 12, 16, 12, 16, 13, 16, 13, 12,
-      14, 16, 13, 16, 14, 16, 13, 12, 16, 16, 16, 16, 16, 16, 16, 13,
-      11, 16, 12, 15, 12, 16, 13, 12, 14, 16, 14, 16, 13, 16, 13, 13,
-      16, 16, 16, 16, 16, 16, 15, 13, 11, 16, 12, 16, 12, 16, 13, 12,
-      13, 16, 13, 15, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 15, 13,
-      12, 16, 12, 16, 13, 16, 13, 12, 13, 16, 12, 16, 13, 16, 13, 12,
-      16, 16, 14, 16, 16, 16, 14, 12, 12, 16, 14, 16, 11, 16, 13, 12,
-      14, 16, 14, 16, 13, 16, 13, 12, 16, 16, 16, 16, 16, 16, 16, 13,
-      12, 16, 13, 16, 12, 16, 13, 12, 13, 16, 13, 16, 12, 16, 13, 12,
-      16, 16, 16, 16, 14, 16, 14, 12, 13, 16, 13, 16, 13, 16, 13, 13,
-      13, 16, 12, 16, 12, 16, 12, 12, 14, 16, 13, 15, 13, 16, 12, 11,
-    },
-  },
-};
-
-
-static const uint8_t rv34_table_intra_secondpat[NUM_INTRA_TABLES][2][OTHERBLK_VLC_SIZE] = {
-  {
-    {
-       0,  5, 10,  3,  6, 10,  7,  8,  9,  4,  6, 10,  6,  7,  9,  8,
-       8,  9,  8,  8,  9,  8,  9,  9,  9,  9,  8,  3,  6, 10,  4,  6,
-      10,  7,  7,  9,  5,  7, 10,  6,  7,  9,  7,  7,  8,  7,  8,  9,
-       8,  8,  9,  8,  8,  7,  6,  8, 10,  6,  8, 10,  7,  8,  9,  7,
-       8, 10,  7,  8, 10,  8,  8,  8,  8,  9,  9,  8,  8,  9,  9,  8,
-       7,  7,  8,  9,  7,  8,  9,  7,  7,  7,  8,  8,  9,  7,  8,  9,
-       7,  7,  7,  8,  8,  8,  7,  7,  7,  7,  6,  5,
-    },
-    {
-       0,  5, 11,  3,  6, 11,  8,  9, 11,  3,  6, 10,  6,  7, 11,  9,
-       9, 11,  7,  9, 11,  9,  9, 11, 10, 10, 11,  2,  6, 10,  4,  7,
-      10,  7,  9, 11,  4,  7, 11,  6,  7, 10,  9,  9, 11,  7,  9, 11,
-       8,  9, 10, 10, 10, 10,  5,  8, 11,  6,  8, 11,  8,  9, 11,  6,
-       8, 11,  7,  8, 11,  9,  9, 11,  8, 10, 11,  9,  9, 11, 10, 10,
-      10,  8,  9, 11,  8,  9, 11,  9,  9, 10,  8,  9, 11,  8,  9, 11,
-       9,  9, 10,  8,  9, 10,  9,  9, 10,  9,  9,  8,
-    },
-  },
-  {
-    {
-       0,  5, 10,  4,  6, 10,  7,  8, 10,  4,  6, 10,  6,  7,  9,  8,
-       8,  9,  8,  8,  9,  8,  9,  9,  9,  9,  9,  2,  6, 10,  4,  6,
-      10,  7,  7,  9,  5,  7, 10,  6,  7,  9,  7,  7,  9,  7,  8,  9,
-       8,  8,  9,  9,  8,  8,  6,  8, 10,  6,  8, 10,  7,  8,  9,  6,
-       8, 10,  7,  8, 10,  8,  8,  9,  8,  9, 10,  8,  8,  9,  9,  9,
-       8,  8,  8, 10,  7,  8,  9,  7,  8,  8,  7,  8, 10,  7,  8,  9,
-       7,  7,  8,  8,  8,  9,  8,  8,  8,  7,  7,  6,
-    },
-    {
-       0,  5, 12,  4,  7, 12,  8, 10, 13,  4,  7, 12,  6,  8, 12, 10,
-      10, 12,  8,  9, 12, 10, 10, 12, 12, 12, 12,  1,  6, 12,  4,  7,
-      12,  8,  9, 12,  4,  7, 12,  6,  8, 11,  9, 10, 12,  8,  9, 12,
-       9, 10, 11, 11, 11, 12,  6,  8, 12,  7,  9, 12,  9, 10, 13,  6,
-       9, 12,  8,  9, 12, 10, 10, 12,  9, 10, 12, 10, 10, 12, 12, 12,
-      12,  8, 10, 12,  9, 10, 12, 10, 10, 12,  8, 10, 12,  9, 10, 12,
-      10, 10, 11,  9, 10, 12, 10, 10, 11, 11, 10, 10,
-    },
-  },
-  {
-    {
-       0,  5, 10,  3,  6, 10,  7,  8, 11,  4,  6, 10,  6,  7, 10,  8,
-       9, 10,  8,  8, 10,  9,  9, 10, 10, 10, 10,  2,  6, 10,  4,  6,
-      10,  7,  8, 10,  4,  7, 10,  6,  7, 10,  8,  8, 10,  7,  8, 10,
-       8,  8,  9, 10,  9,  9,  5,  8, 11,  6,  8, 10,  7,  9, 10,  6,
-       8, 11,  7,  8, 10,  8,  8, 10,  8,  9, 11,  9,  9, 10, 10,  9,
-       9,  8,  9, 10,  8,  9, 10,  8,  9, 10,  8,  9, 10,  8,  8, 10,
-       8,  8,  9,  8,  9, 10,  8,  8,  9,  9,  8,  8,
-    },
-    {
-       0,  6, 13,  4,  7, 14,  9, 11, 14,  3,  7, 13,  7,  8, 13, 11,
-      11, 14,  8, 10, 13, 10, 11, 13, 13, 13, 14,  1,  6, 12,  4,  8,
-      13,  9, 10, 15,  4,  8, 13,  7,  8, 12, 11, 11, 14,  8, 10, 13,
-      10, 10, 13, 13, 13, 14,  5,  9, 13,  7,  9, 13, 10, 11, 14,  6,
-      10, 14,  8, 10, 14, 11, 11, 14,  9, 11, 14, 11, 11, 13, 13, 13,
-      14,  9, 10, 14,  9, 11, 13, 11, 12, 14,  9, 11, 13,  9, 11, 14,
-      11, 12, 13, 10, 12, 15, 11, 11, 13, 13, 12, 13,
-    },
-  },
-  {
-    {
-       0,  5, 11,  3,  6, 11,  7,  9, 12,  3,  6, 11,  6,  7, 11,  9,
-       9, 11,  8,  9, 11,  9,  9, 11, 11, 11, 12,  2,  6, 11,  4,  6,
-      11,  7,  9, 11,  4,  7, 11,  5,  7, 10,  9,  9, 11,  7,  8, 11,
-       9,  9, 10, 11, 11, 11,  5,  8, 11,  6,  8, 11,  8,  9, 12,  6,
-       8, 11,  7,  8, 11,  9,  9, 11,  8,  9, 12,  9,  9, 11, 11, 11,
-      11,  8, 10, 12,  8, 10, 11,  9, 10, 12,  8, 10, 12,  8,  9, 12,
-      10, 10, 12,  9, 10, 12,  9,  9, 11, 11, 10, 11,
-    },
-    {
-       0,  6, 13,  3,  8, 14, 10, 12, 16,  3,  8, 15,  7,  9, 15, 12,
-      13, 15,  9, 11, 15, 11, 12, 16, 14, 16, 16,  1,  7, 13,  4,  8,
-      14,  9, 11, 15,  4,  8, 14,  7,  9, 14, 12, 13, 15,  8, 10, 14,
-      11, 11, 14, 16, 14, 16,  6,  9, 14,  7, 10, 14, 11, 13, 15,  7,
-      10, 14,  9, 10, 13, 12, 12, 15, 10, 11, 14, 11, 11, 14, 14, 14,
-      16,  9, 11, 14, 10, 11, 14, 13, 14, 15,  9, 12, 14, 10, 12, 16,
-      13, 14, 16, 10, 13, 16, 12, 12, 14, 15, 14, 15,
-    },
-  },
-  {
-    {
-       0,  6, 12,  3,  7, 12,  9, 11, 13,  4,  7, 12,  6,  8, 12, 10,
-      11, 13,  8, 10, 13, 10, 11, 13, 13, 13, 14,  1,  6, 12,  4,  7,
-      12,  9, 10, 14,  4,  7, 12,  6,  7, 12, 10, 11, 13,  8,  9, 13,
-      10, 10, 12, 13, 13, 14,  6,  9, 13,  7,  9, 13, 10, 12, 14,  7,
-       9, 13,  8, 10, 13, 11, 11, 14,  9, 11, 13, 11, 11, 14, 13, 13,
-      14, 10, 12, 14, 10, 12, 14, 12, 13, 15, 10, 12, 14, 10, 12, 14,
-      12, 13, 15, 11, 13, 15, 12, 12, 15, 14, 14, 14,
-    },
-    {
-       0,  6, 16,  3,  8, 16, 10, 13, 16,  3,  8, 16,  7,  9, 16, 13,
-      16, 16,  8, 10, 16, 11, 13, 16, 16, 16, 16,  1,  7, 14,  4,  8,
-      16, 10, 12, 16,  4,  8, 13,  7,  9, 16, 13, 14, 16,  8, 10, 16,
-      11, 11, 14, 16, 16, 16,  6,  9, 14,  8, 10, 14, 12, 16, 16,  6,
-      10, 13,  9, 11, 16, 13, 14, 16,  9, 12, 16, 12, 11, 16, 16, 16,
-      16, 10, 12, 16, 11, 12, 16, 16, 14, 16,  9, 12, 16, 11, 12, 16,
-      16, 15, 16, 10, 13, 16, 12, 13, 16, 16, 16, 16,
-    },
-  },
-};
-
-static const uint8_t rv34_table_intra_thirdpat[NUM_INTRA_TABLES][2][OTHERBLK_VLC_SIZE] = {
-  {
-    {
-       0,  5, 10,  3,  6, 10,  7,  8, 10,  4,  7, 10,  6,  7, 10,  8,
-       8, 10,  8,  9, 10,  9,  9, 10,  9,  9,  9,  2,  6, 10,  4,  7,
-      10,  7,  8,  9,  5,  7, 10,  6,  7, 10,  8,  8,  9,  8,  9, 10,
-       8,  8,  9,  9,  9,  8,  6,  8, 11,  6,  8, 10,  7,  8, 10,  6,
-       8, 11,  7,  8, 10,  8,  8,  9,  8,  9, 10,  9,  9, 10,  9,  9,
-       9,  7,  8, 10,  7,  8, 10,  7,  8,  8,  7,  8, 10,  7,  8,  9,
-       7,  8,  8,  8,  8,  9,  8,  8,  8,  7,  7,  7,
-    },
-    {
-       0,  4, 10,  3,  6, 10,  7,  8, 11,  3,  6, 10,  5,  7, 10,  9,
-       9, 11,  9, 10, 11,  9, 10, 11, 11, 11, 11,  2,  6, 10,  4,  6,
-      10,  7,  8, 10,  4,  7, 10,  6,  7, 10,  8,  9, 10,  8,  9, 11,
-       9,  9, 11, 10, 10, 11,  6,  8, 11,  6,  8, 11,  8,  9, 11,  7,
-       9, 11,  7,  8, 11,  9,  9, 11,  9, 10, 12, 10, 10, 12, 11, 11,
-      11,  8,  9, 11,  8,  9, 11,  9,  9, 11,  9, 10, 11,  9, 10, 11,
-       9, 10, 11, 10, 11, 12, 10, 10, 12, 10, 10, 10,
-    },
-  },
-  {
-    {
-       0,  5, 10,  3,  6, 10,  7,  8, 10,  4,  7, 10,  6,  7, 10,  8,
-       9, 10,  8,  9, 11,  8,  9, 10, 10, 10, 10,  2,  6, 10,  4,  6,
-      10,  7,  8, 10,  4,  7, 10,  5,  7, 10,  8,  8, 10,  8,  9, 10,
-       8,  9, 10,  9,  9,  9,  5,  7, 11,  6,  8, 11,  7,  8, 11,  6,
-       8, 11,  7,  8, 10,  8,  9, 10,  8,  9, 11,  9,  9, 10, 10,  9,
-      10,  7,  8, 10,  7,  8, 10,  8,  9, 10,  8,  9, 10,  8,  9, 10,
-       8,  8, 10,  9,  9, 10,  9,  9, 10,  9,  9,  9,
-    },
-    {
-       0,  5, 11,  3,  6, 11,  8,  9, 12,  4,  7, 12,  6,  7, 12,  9,
-      10, 13, 10, 11, 13, 10, 11, 14, 12, 13, 14,  1,  6, 11,  4,  7,
-      11,  8,  9, 12,  5,  7, 11,  6,  8, 12,  9, 10, 13, 10, 11, 14,
-      10, 11, 13, 12, 12, 14,  6,  8, 12,  7,  9, 13,  9, 10, 14,  7,
-      10, 13,  8, 10, 12, 11, 11, 13, 11, 13, 14, 11, 12, 14, 13, 13,
-      15,  9, 10, 12,  9, 11, 14, 10, 11, 14, 11, 11, 13, 10, 11, 13,
-      11, 12, 14, 12, 14, 15, 13, 13, 14, 13, 13, 14,
-    },
-  },
-  {
-    {
-       0,  5, 11,  3,  6, 11,  7,  9, 11,  4,  6, 11,  5,  7, 10,  9,
-       9, 11,  8,  9, 11,  9, 10, 11, 11, 11, 11,  2,  6, 10,  3,  6,
-      10,  7,  9, 11,  4,  7, 10,  5,  7, 10,  8,  9, 11,  8,  9, 11,
-       9,  9, 11, 11, 11, 11,  5,  8, 11,  6,  8, 11,  8, 10, 12,  6,
-       8, 11,  7,  8, 11,  9, 10, 11,  9, 10, 12,  9, 10, 11, 11, 11,
-      11,  8,  9, 11,  8, 10, 12,  9, 11, 12,  8, 10, 12,  9, 10, 12,
-      10, 11, 12, 10, 11, 12, 10, 10, 11, 11, 11, 11,
-    },
-    {
-       0,  5, 13,  2,  7, 16,  9, 11, 16,  4,  8, 16,  7,  9, 16, 12,
-      12, 16, 12, 16, 16, 12, 16, 16, 16, 16, 16,  1,  6, 13,  4,  8,
-      16,  9, 11, 16,  6,  9, 16,  7, 10, 16, 13, 13, 16, 13, 15, 16,
-      12, 16, 16, 16, 16, 16,  7,  9, 16,  8, 11, 15, 11, 13, 16, 10,
-      12, 16, 10, 12, 16, 16, 13, 16, 16, 16, 16, 14, 16, 16, 16, 16,
-      16, 12, 12, 16, 12, 16, 16, 16, 16, 16, 13, 14, 16, 12, 13, 16,
-      16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  6, 11,  3,  7, 11,  8, 10, 12,  4,  7, 11,  6,  8, 11, 10,
-      11, 12,  9, 10, 12, 10, 10, 12, 12, 12, 13,  1,  6, 11,  4,  7,
-      11,  8, 10, 12,  4,  7, 11,  6,  8, 11, 10, 10, 12,  9, 10, 12,
-      10, 10, 12, 13, 13, 13,  6,  8, 12,  7, 10, 12, 10, 12, 13,  7,
-       9, 12,  8, 10, 12, 11, 11, 13, 11, 12, 14, 11, 11, 13, 13, 13,
-      13,  9, 11, 13, 10, 12, 14, 12, 13, 15, 10, 12, 14, 11, 12, 14,
-      13, 13, 14, 12, 13, 15, 13, 13, 14, 14, 14, 14,
-    },
-    {
-       0,  5, 16,  2,  6, 16, 10, 14, 16,  4,  8, 16,  7,  9, 16, 11,
-      16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16,  1,  6, 12,  4,  8,
-      12, 12, 12, 16,  6,  8, 16,  8, 10, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 12, 16, 16,  7, 10, 16,  8, 11, 14, 16, 16, 16, 10,
-      12, 16, 10, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  5, 11,  3,  6, 11, 10, 10, 12,  3,  7, 11,  6,  8, 11, 11,
-      11, 12, 10, 10, 12, 11, 11, 13, 14, 13, 14,  1,  6, 11,  4,  7,
-      11, 10, 11, 13,  5,  7, 11,  7,  8, 11, 11, 11, 13, 10, 11, 13,
-      11, 11, 12, 13, 13, 14,  7, 10, 12,  9, 11, 13, 12, 13, 14,  9,
-      10, 13,  9, 10, 13, 12, 11, 13, 12, 13, 16, 12, 13, 13, 14, 14,
-      14, 11, 14, 16, 12, 14, 15, 14, 13, 16, 13, 13, 15, 13, 14, 16,
-      14, 13, 16, 13, 13, 16, 13, 14, 15, 15, 14, 15,
-    },
-    {
-       0,  4, 16,  2,  7, 16, 10, 16, 16,  4, 10, 16,  7, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,  1,  6, 13,  4, 11,
-      16, 16, 16, 16,  6, 10, 16,  8, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16,  8, 16, 16, 10, 16, 16, 16, 16, 16, 10,
-      16, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-};
-
-
-static const uint8_t rv34_intra_coeff[NUM_INTRA_TABLES][COEFF_VLC_SIZE] = {
-{
-  1,  3,  3,  4,  4,  5,  6,  6,  6,  7,  7,  7,  8,  8,  9,  9,
-  9,  9, 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 13, 14, 15, 15,
-},
-{
-  1,  2,  3,  5,  5,  6,  6,  7,  7,  8,  8,  9, 10, 10, 10, 11,
- 11, 11, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 16, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  5,  6,  8,  8,  9,  9, 10, 10, 11, 12, 12, 12,
- 13, 13, 14, 14, 14, 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  5,  6,  8,  8,  9,  9, 10, 10, 11, 12, 12, 12,
- 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 14, 12, 16, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  5,  7,  7,  8,  8,  9, 10, 10, 12, 11, 13, 12,
- 15, 13, 14, 13, 12, 15, 14, 13, 12, 12, 10, 11, 16, 16, 16, 16,
-}
-};
-
-
-static const uint8_t rv34_inter_cbppat[NUM_INTER_TABLES][CBPPAT_VLC_SIZE] = {
-{
-  7,  9,  9,  8,  9,  8,  9,  8,  9,  9,  8,  8,  8,  8,  8,  4,
-  7, 10, 11, 10, 11, 10, 12, 10, 12, 11, 11, 10, 11, 10, 10,  7,
- 10, 11, 15, 12, 15, 12, 15, 12, 15, 14, 14, 12, 14, 12, 14,  9,
-  7, 11, 10, 10, 12, 11, 11, 10, 11, 12, 10, 10, 11, 10, 10,  7,
-  8, 12, 12, 11, 13, 12, 12, 10, 13, 13, 12, 10, 12, 11, 11,  7,
- 11, 13, 15, 11, 15, 13, 15, 12, 16, 14, 14, 12, 15, 13, 13,  9,
- 10, 15, 11, 12, 15, 14, 14, 12, 15, 15, 12, 12, 14, 14, 12,  9,
- 11, 15, 13, 12, 16, 15, 14, 12, 15, 15, 13, 12, 15, 14, 13,  9,
- 13, 15, 14, 10, 16, 15, 16, 11, 16, 16, 15, 12, 16, 15, 15,  9,
-  7, 11, 11, 11, 11, 10, 11, 10, 11, 12, 11, 10, 10, 10, 10,  7,
-  9, 12, 13, 12, 12, 11, 13, 10, 13, 13, 12, 11, 12, 10, 11,  7,
- 12, 13, 16, 14, 15, 12, 16, 12, 16, 15, 15, 13, 15, 12, 14,  9,
-  9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11,  7,
-  9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 13, 11, 12, 11, 11,  7,
- 12, 14, 15, 13, 16, 13, 15, 11, 16, 14, 15, 12, 15, 12, 13,  8,
- 12, 16, 14, 14, 16, 15, 15, 13, 16, 15, 14, 13, 15, 14, 13,  9,
- 12, 15, 14, 13, 15, 14, 15, 12, 16, 15, 14, 12, 14, 13, 13,  8,
- 13, 16, 16, 12, 16, 14, 16, 11, 16, 16, 15, 12, 16, 14, 14,  8,
- 10, 15, 15, 15, 12, 12, 14, 12, 14, 15, 15, 14, 12, 12, 13,  9,
- 11, 15, 16, 14, 13, 12, 15, 12, 16, 15, 15, 14, 14, 12, 13,  9,
- 14, 15, 16, 16, 15, 11, 16, 12, 16, 16, 16, 15, 16, 12, 15,  9,
- 12, 16, 16, 15, 14, 14, 14, 13, 16, 16, 15, 14, 14, 13, 13,  9,
- 12, 15, 15, 14, 14, 13, 15, 12, 16, 15, 14, 13, 14, 13, 13,  8,
- 13, 16, 16, 15, 16, 12, 16, 11, 16, 16, 16, 14, 16, 13, 14,  8,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 15, 16, 15, 14, 11,
- 13, 16, 16, 15, 16, 15, 15, 12, 16, 16, 16, 14, 15, 14, 14,  9,
- 14, 16, 16, 13, 16, 14, 16, 10, 16, 16, 16, 13, 16, 14, 14,  8,
-  7, 12, 11, 11, 11, 11, 12, 10, 11, 11, 10, 10, 10, 10, 10,  7,
-  9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11,  8,
- 12, 14, 16, 14, 16, 14, 16, 13, 16, 14, 15, 13, 15, 13, 14,  9,
-  9, 13, 12, 12, 13, 12, 13, 11, 12, 13, 11, 10, 12, 11, 11,  7,
-  9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11,  7,
- 12, 14, 16, 13, 16, 14, 15, 12, 15, 15, 14, 12, 15, 13, 13,  8,
- 11, 15, 13, 14, 15, 15, 14, 13, 15, 15, 12, 12, 14, 14, 12,  9,
- 11, 15, 14, 13, 15, 14, 14, 12, 15, 14, 13, 11, 14, 13, 12,  8,
- 13, 16, 15, 12, 16, 15, 16, 12, 16, 16, 14, 11, 15, 14, 14,  8,
-  8, 13, 13, 12, 12, 12, 13, 11, 12, 13, 12, 11, 11, 10, 10,  7,
-  9, 13, 14, 12, 13, 12, 13, 11, 13, 13, 13, 11, 12, 11, 11,  7,
- 12, 14, 16, 14, 15, 13, 15, 12, 15, 15, 15, 13, 14, 12, 13,  8,
-  9, 13, 13, 12, 13, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11,  7,
-  9, 13, 12, 12, 13, 12, 12, 10, 13, 13, 12, 10, 12, 10, 10,  6,
- 11, 14, 14, 12, 14, 12, 14, 11, 14, 14, 13, 11, 13, 11, 12,  7,
- 12, 16, 14, 14, 15, 15, 14, 13, 15, 15, 13, 12, 14, 13, 12,  8,
- 11, 14, 13, 12, 14, 13, 13, 11, 14, 14, 13, 11, 13, 12, 11,  7,
- 11, 14, 14, 12, 15, 13, 14, 11, 15, 14, 13, 11, 14, 12, 12,  6,
- 11, 16, 15, 15, 13, 14, 15, 13, 14, 15, 15, 13, 12, 12, 12,  9,
- 12, 15, 15, 14, 14, 13, 15, 12, 15, 15, 14, 13, 13, 11, 12,  8,
- 13, 16, 16, 15, 16, 13, 16, 13, 16, 16, 15, 14, 14, 12, 14,  8,
- 11, 16, 15, 14, 14, 14, 14, 13, 15, 15, 14, 13, 13, 12, 12,  8,
- 11, 14, 14, 13, 13, 12, 14, 11, 14, 14, 13, 12, 12, 11, 11,  7,
- 12, 14, 15, 13, 14, 12, 14, 11, 15, 14, 14, 12, 13, 11, 12,  7,
- 13, 16, 16, 16, 16, 15, 16, 14, 16, 16, 15, 14, 15, 14, 13,  9,
- 12, 15, 14, 13, 15, 13, 14, 12, 15, 15, 13, 12, 13, 12, 12,  7,
- 11, 15, 14, 12, 14, 13, 14, 10, 15, 14, 13, 11, 13, 11, 11,  5,
- 10, 15, 15, 15, 15, 14, 15, 13, 12, 14, 12, 12, 12, 13, 12,  9,
- 12, 16, 16, 15, 16, 15, 16, 14, 14, 15, 14, 13, 14, 13, 13,  9,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 11,
- 11, 15, 15, 14, 15, 15, 15, 14, 14, 15, 12, 12, 13, 13, 12,  9,
- 12, 15, 15, 14, 16, 14, 15, 13, 14, 14, 13, 12, 14, 13, 12,  8,
- 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 15, 12, 16, 14, 14,  9,
- 13, 16, 14, 16, 16, 16, 16, 15, 15, 16, 11, 12, 16, 15, 12,  9,
- 13, 16, 15, 14, 16, 15, 16, 14, 15, 16, 12, 11, 15, 14, 13,  8,
- 13, 16, 16, 13, 16, 16, 16, 13, 16, 16, 13, 11, 16, 14, 14,  8,
- 11, 15, 15, 15, 14, 14, 15, 13, 13, 15, 14, 13, 12, 12, 12,  9,
- 11, 15, 16, 14, 15, 14, 15, 13, 14, 14, 14, 13, 13, 12, 13,  8,
- 13, 16, 16, 16, 16, 15, 16, 14, 16, 16, 16, 13, 15, 12, 14,  9,
- 11, 16, 15, 14, 14, 14, 15, 13, 14, 14, 13, 12, 13, 12, 11,  8,
- 11, 14, 14, 13, 14, 13, 14, 12, 13, 13, 12, 11, 12, 11, 11,  7,
- 12, 15, 15, 13, 15, 14, 15, 12, 15, 14, 14, 11, 13, 12, 12,  7,
- 13, 16, 15, 15, 16, 16, 16, 14, 15, 16, 12, 12, 14, 14, 12,  8,
- 11, 15, 14, 13, 15, 13, 14, 12, 14, 14, 12, 11, 13, 12, 11,  6,
- 11, 14, 14, 12, 15, 13, 14, 11, 15, 14, 12, 10, 13, 11, 11,  5,
- 12, 16, 16, 16, 15, 15, 16, 15, 14, 16, 15, 15, 10, 12, 12,  9,
- 13, 16, 16, 16, 15, 14, 16, 13, 15, 15, 15, 14, 12, 11, 13,  8,
- 14, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 14, 14, 11, 14,  8,
- 13, 16, 16, 15, 15, 15, 15, 14, 15, 16, 14, 13, 12, 12, 11,  8,
- 11, 15, 15, 13, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11,  6,
- 11, 15, 15, 13, 15, 12, 14, 11, 14, 14, 13, 11, 12, 10, 11,  5,
- 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 14, 14, 13, 11,  8,
- 11, 14, 14, 13, 14, 13, 14, 11, 14, 14, 12, 11, 12, 11, 10,  5,
- 10, 13, 13, 11, 13, 12, 13,  9, 13, 13, 12,  9, 12, 10, 10,  3,
-},
-{
-  5,  7,  7,  7,  7,  7,  8,  7,  7,  8,  7,  7,  7,  7,  7,  4,
-  7,  9, 11,  9, 11,  9, 11,  9, 11, 10, 10,  9, 10,  9, 10,  6,
- 11, 11, 14, 11, 14, 11, 14, 11, 15, 13, 14, 12, 14, 12, 13,  9,
-  6, 11, 10,  9, 11, 10, 11,  9, 11, 11,  9,  9, 10, 10,  9,  6,
-  8, 11, 11, 10, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11,  7,
- 11, 13, 14, 11, 15, 13, 15, 11, 15, 14, 14, 12, 14, 13, 13,  9,
- 10, 14, 11, 11, 15, 14, 13, 12, 14, 14, 11, 11, 14, 13, 12,  9,
- 11, 14, 13, 11, 15, 14, 14, 11, 15, 15, 13, 11, 14, 14, 13,  9,
- 12, 14, 14, 10, 16, 15, 16, 11, 16, 16, 15, 11, 16, 15, 14,  9,
-  6, 10, 11, 10, 10,  9, 11,  9, 10, 11, 10, 10,  9,  9,  9,  6,
-  9, 12, 12, 11, 12, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11,  7,
- 12, 13, 15, 13, 14, 11, 15, 11, 15, 15, 14, 13, 14, 12, 14,  9,
-  9, 12, 12, 11, 12, 11, 12, 11, 12, 13, 11, 11, 12, 11, 11,  7,
-  9, 12, 12, 11, 13, 11, 12, 10, 13, 13, 12, 11, 12, 11, 11,  7,
- 12, 14, 15, 12, 15, 12, 14, 11, 15, 15, 14, 12, 14, 13, 13,  8,
- 12, 15, 14, 13, 15, 14, 14, 13, 16, 16, 14, 13, 15, 14, 13,  9,
- 12, 15, 14, 13, 15, 14, 14, 12, 15, 15, 13, 12, 14, 13, 13,  9,
- 13, 15, 15, 12, 16, 14, 15, 11, 16, 16, 15, 12, 15, 14, 14,  9,
- 10, 14, 14, 14, 12, 11, 13, 12, 14, 15, 14, 13, 12, 11, 12,  9,
- 12, 14, 15, 14, 13, 11, 14, 12, 15, 15, 15, 14, 13, 11, 13,  9,
- 13, 15, 16, 15, 14, 11, 16, 11, 16, 16, 16, 14, 15, 12, 15,  9,
- 12, 15, 15, 14, 14, 14, 14, 13, 15, 15, 14, 14, 14, 13, 13,  9,
- 12, 15, 15, 14, 14, 13, 14, 12, 15, 15, 14, 13, 14, 13, 13,  9,
- 13, 15, 16, 14, 15, 13, 16, 11, 16, 16, 15, 14, 15, 13, 14,  9,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 16, 16, 16, 14, 11,
- 14, 16, 16, 14, 16, 15, 15, 12, 16, 16, 16, 14, 15, 14, 14,  9,
- 14, 16, 16, 14, 16, 14, 16, 11, 16, 16, 16, 14, 16, 14, 14,  9,
-  6, 11, 10, 10, 10, 10, 11, 10, 10, 11,  9,  9,  9,  9,  9,  6,
-  9, 12, 12, 11, 13, 11, 13, 11, 12, 12, 11, 11, 12, 11, 11,  7,
- 12, 14, 16, 13, 16, 14, 16, 13, 15, 14, 15, 12, 15, 13, 14,  9,
-  8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10,  7,
-  9, 12, 12, 11, 13, 12, 13, 11, 13, 12, 11, 10, 12, 11, 11,  7,
- 12, 14, 15, 12, 15, 14, 15, 12, 15, 14, 14, 12, 14, 13, 13,  9,
- 11, 15, 13, 13, 15, 14, 14, 13, 14, 15, 11, 11, 14, 14, 12,  9,
- 11, 14, 13, 12, 15, 14, 14, 12, 14, 14, 12, 11, 14, 13, 12,  8,
- 13, 15, 15, 12, 16, 15, 15, 12, 15, 15, 14, 11, 15, 14, 14,  8,
-  8, 12, 12, 11, 11, 11, 12, 11, 11, 12, 11, 11, 10, 10, 10,  7,
-  9, 13, 13, 12, 13, 11, 13, 11, 12, 13, 12, 11, 11, 10, 11,  7,
- 12, 14, 15, 14, 15, 13, 15, 12, 15, 14, 14, 13, 14, 12, 13,  9,
-  9, 13, 12, 12, 12, 12, 12, 11, 12, 13, 11, 11, 11, 11, 10,  7,
-  9, 12, 12, 11, 12, 11, 12, 10, 12, 12, 11, 10, 11, 10, 10,  7,
- 11, 13, 14, 12, 14, 12, 14, 11, 14, 13, 13, 11, 13, 11, 12,  7,
- 12, 15, 14, 13, 15, 14, 14, 13, 15, 15, 13, 12, 13, 13, 12,  9,
- 11, 14, 13, 12, 14, 13, 13, 11, 14, 14, 12, 11, 13, 12, 11,  7,
- 11, 14, 14, 12, 14, 13, 14, 11, 14, 14, 13, 11, 13, 12, 12,  7,
- 11, 15, 15, 14, 13, 13, 14, 13, 14, 15, 14, 13, 11, 11, 12,  9,
- 12, 15, 15, 14, 14, 12, 14, 12, 14, 14, 14, 13, 12, 11, 12,  8,
- 13, 16, 16, 15, 15, 12, 16, 13, 16, 15, 15, 14, 14, 12, 14,  9,
- 12, 15, 15, 14, 14, 14, 14, 13, 15, 15, 14, 13, 12, 12, 12,  9,
- 11, 14, 14, 13, 13, 12, 13, 11, 14, 13, 13, 12, 12, 11, 11,  7,
- 12, 14, 15, 13, 14, 12, 14, 11, 15, 14, 13, 12, 13, 11, 12,  7,
- 13, 16, 16, 15, 16, 15, 15, 14, 16, 16, 15, 14, 14, 14, 12,  9,
- 12, 15, 14, 13, 14, 13, 14, 12, 15, 14, 13, 12, 13, 12, 12,  8,
- 12, 14, 14, 13, 15, 13, 14, 11, 14, 14, 13, 12, 13, 12, 12,  6,
- 10, 14, 14, 13, 14, 14, 14, 13, 12, 13, 12, 12, 12, 12, 11,  9,
- 12, 15, 15, 14, 15, 14, 16, 14, 14, 14, 13, 12, 14, 13, 13,  9,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 16, 11,
- 11, 15, 14, 14, 15, 14, 14, 14, 13, 14, 11, 12, 13, 13, 12,  9,
- 12, 15, 14, 14, 15, 14, 15, 13, 14, 14, 13, 12, 14, 13, 13,  9,
- 13, 16, 16, 14, 16, 15, 16, 14, 16, 15, 15, 12, 16, 14, 14,  9,
- 13, 16, 14, 15, 16, 16, 16, 14, 14, 16, 11, 12, 15, 14, 12,  9,
- 13, 16, 15, 14, 16, 15, 16, 14, 15, 15, 12, 11, 15, 14, 13,  9,
- 14, 16, 16, 13, 16, 16, 16, 14, 16, 15, 13, 11, 16, 14, 14,  9,
- 11, 15, 15, 14, 14, 14, 14, 13, 13, 14, 13, 13, 11, 11, 11,  9,
- 12, 15, 15, 14, 15, 14, 15, 13, 14, 14, 13, 13, 13, 12, 12,  9,
- 13, 16, 16, 16, 16, 14, 16, 14, 16, 15, 16, 14, 15, 12, 14,  9,
- 11, 15, 14, 14, 15, 14, 14, 13, 14, 14, 12, 12, 12, 12, 11,  8,
- 11, 14, 14, 13, 14, 13, 13, 12, 13, 13, 12, 11, 12, 11, 11,  7,
- 12, 14, 15, 13, 15, 13, 14, 13, 14, 14, 13, 12, 13, 12, 12,  8,
- 13, 16, 15, 15, 16, 15, 15, 14, 15, 16, 12, 12, 14, 14, 11,  9,
- 12, 15, 14, 13, 15, 13, 14, 12, 14, 14, 12, 11, 13, 12, 11,  7,
- 12, 14, 14, 13, 15, 13, 14, 12, 15, 14, 13, 10, 13, 12, 12,  6,
- 12, 16, 16, 15, 14, 14, 15, 14, 13, 15, 14, 14, 10, 11, 11,  9,
- 13, 16, 16, 15, 15, 14, 15, 14, 15, 15, 15, 14, 12, 11, 12,  8,
- 14, 16, 16, 16, 16, 14, 16, 14, 16, 15, 15, 14, 14, 11, 14,  8,
- 12, 16, 16, 15, 15, 14, 15, 14, 14, 16, 14, 14, 12, 12, 11,  8,
- 11, 14, 14, 13, 14, 13, 14, 12, 14, 14, 13, 12, 12, 11, 11,  7,
- 12, 14, 15, 13, 14, 13, 14, 12, 14, 14, 13, 12, 13, 11, 12,  6,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 14, 13, 13, 13, 11,  8,
- 12, 15, 15, 13, 15, 13, 14, 12, 14, 14, 13, 12, 13, 12, 10,  6,
- 11, 14, 13, 12, 14, 12, 13, 10, 14, 13, 12, 10, 12, 10, 10,  4,
-},
-{
-  4,  6,  6,  6,  6,  6,  7,  6,  6,  7,  6,  6,  6,  6,  6,  3,
-  6,  9, 10,  9, 10,  9, 11,  9, 10, 10, 10,  9, 10,  9, 10,  6,
- 10, 11, 14, 11, 14, 11, 14, 11, 14, 13, 14, 11, 14, 11, 13,  9,
-  6, 10,  9,  9, 10, 10, 10,  9, 10, 11,  9,  9, 10, 10,  9,  6,
-  8, 11, 11,  9, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11,  7,
- 11, 13, 14, 11, 15, 13, 15, 11, 15, 14, 14, 11, 15, 13, 14,  9,
- 10, 13, 11, 11, 14, 14, 13, 11, 14, 14, 11, 11, 13, 13, 11,  9,
- 11, 14, 12, 11, 15, 14, 14, 11, 15, 15, 13, 11, 14, 14, 13,  9,
- 12, 14, 13, 10, 16, 15, 16, 11, 16, 16, 14, 11, 16, 14, 14,  9,
-  6, 10, 10, 10,  9,  9, 10,  9, 10, 11, 10, 10,  9,  9,  9,  6,
-  8, 11, 12, 11, 11, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11,  7,
- 11, 13, 15, 13, 14, 11, 15, 11, 15, 14, 14, 13, 14, 12, 14,  9,
-  8, 12, 12, 12, 12, 12, 12, 11, 12, 13, 11, 11, 11, 11, 11,  8,
-  9, 12, 12, 11, 12, 12, 13, 11, 13, 13, 12, 11, 12, 11, 11,  8,
- 11, 14, 15, 13, 14, 13, 15, 11, 15, 15, 14, 13, 15, 13, 14,  9,
- 12, 16, 14, 14, 15, 15, 14, 12, 15, 16, 14, 13, 14, 14, 13, 10,
- 11, 15, 14, 13, 15, 14, 15, 12, 15, 16, 14, 13, 15, 14, 13,  9,
- 13, 15, 15, 12, 16, 15, 16, 12, 16, 16, 15, 13, 15, 14, 14,  9,
- 10, 14, 14, 14, 11, 11, 13, 11, 14, 14, 14, 13, 11, 11, 11,  9,
- 11, 14, 15, 14, 13, 11, 14, 12, 15, 15, 15, 14, 13, 11, 13,  9,
- 13, 14, 16, 15, 14, 11, 16, 12, 16, 16, 16, 14, 15, 12, 15, 10,
- 12, 16, 15, 15, 14, 14, 14, 12, 16, 16, 14, 14, 14, 13, 13, 10,
- 12, 15, 15, 14, 14, 13, 14, 12, 15, 16, 14, 14, 14, 13, 13,  9,
- 13, 16, 16, 14, 16, 13, 16, 12, 16, 16, 16, 14, 16, 13, 15, 10,
- 14, 16, 16, 16, 16, 16, 15, 14, 16, 16, 16, 16, 16, 16, 14, 11,
- 13, 16, 16, 15, 16, 16, 16, 13, 16, 16, 16, 15, 16, 15, 14, 10,
- 14, 16, 16, 14, 16, 14, 16, 12, 16, 16, 16, 15, 16, 15, 15, 10,
-  6, 10, 10, 10, 10, 10, 11, 10,  9, 10,  9,  9,  9,  9,  9,  6,
-  9, 12, 12, 11, 12, 11, 13, 11, 12, 12, 11, 10, 12, 11, 11,  8,
- 12, 14, 15, 14, 15, 14, 16, 13, 15, 14, 14, 12, 15, 13, 14, 10,
-  8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10,  7,
-  9, 12, 12, 11, 13, 12, 13, 11, 12, 13, 11, 10, 12, 12, 11,  8,
- 11, 14, 14, 13, 15, 14, 15, 13, 15, 14, 14, 12, 15, 13, 14,  9,
- 11, 15, 12, 13, 15, 15, 14, 13, 14, 15, 11, 11, 14, 14, 12,  9,
- 11, 14, 13, 13, 15, 14, 15, 13, 15, 15, 13, 11, 15, 14, 13,  9,
- 13, 15, 15, 12, 16, 15, 16, 13, 16, 15, 14, 11, 16, 15, 14,  9,
-  8, 12, 12, 11, 11, 11, 12, 11, 11, 12, 11, 11,  9, 10, 10,  7,
-  9, 12, 13, 12, 12, 11, 13, 11, 12, 13, 12, 12, 11, 11, 11,  8,
- 12, 14, 15, 14, 15, 13, 16, 13, 15, 14, 15, 13, 14, 12, 14,  9,
-  9, 13, 12, 12, 12, 12, 13, 12, 12, 13, 11, 11, 11, 11, 10,  8,
-  9, 12, 12, 12, 12, 12, 13, 11, 12, 13, 11, 11, 12, 11, 11,  7,
- 11, 13, 14, 13, 14, 13, 15, 12, 14, 14, 14, 12, 14, 12, 13,  8,
- 12, 15, 14, 14, 15, 15, 14, 13, 15, 16, 13, 13, 14, 14, 12,  9,
- 11, 14, 13, 13, 14, 14, 14, 12, 14, 15, 13, 12, 14, 13, 12,  8,
- 11, 14, 14, 13, 15, 14, 15, 12, 15, 15, 14, 12, 14, 13, 13,  8,
- 11, 14, 14, 14, 13, 13, 14, 13, 13, 14, 14, 13, 11, 11, 11,  9,
- 11, 15, 15, 14, 14, 13, 15, 13, 14, 15, 14, 14, 13, 11, 13,  9,
- 13, 16, 16, 16, 15, 13, 16, 13, 16, 16, 16, 15, 15, 12, 15, 10,
- 11, 15, 15, 15, 14, 14, 14, 13, 15, 15, 14, 14, 13, 13, 12,  9,
- 11, 14, 14, 13, 13, 13, 14, 12, 14, 14, 13, 13, 13, 12, 12,  8,
- 12, 15, 15, 14, 15, 13, 15, 12, 15, 15, 14, 13, 14, 12, 13,  8,
- 13, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 15, 15, 15, 13, 10,
- 12, 15, 15, 14, 15, 14, 15, 13, 15, 16, 14, 13, 14, 14, 13,  9,
- 12, 15, 15, 14, 15, 14, 15, 12, 15, 15, 14, 13, 14, 13, 13,  8,
- 10, 14, 13, 13, 14, 13, 14, 13, 11, 13, 11, 11, 11, 11, 11,  9,
- 12, 15, 16, 14, 15, 14, 16, 14, 14, 14, 14, 13, 14, 13, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13, 16, 14, 16, 11,
- 11, 15, 14, 14, 15, 14, 15, 14, 13, 14, 11, 12, 13, 13, 11,  9,
- 12, 15, 15, 14, 15, 15, 16, 14, 14, 14, 13, 12, 14, 13, 13,  9,
- 13, 16, 16, 15, 16, 16, 16, 15, 16, 15, 15, 12, 16, 14, 15, 10,
- 12, 16, 14, 15, 16, 16, 16, 14, 14, 16, 11, 12, 14, 15, 12,  9,
- 13, 16, 15, 14, 16, 16, 16, 14, 15, 16, 13, 12, 15, 15, 13,  9,
- 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 14, 12, 16, 15, 15, 10,
- 11, 14, 14, 14, 14, 14, 14, 13, 12, 14, 13, 13, 11, 11, 11,  9,
- 11, 15, 15, 14, 14, 14, 16, 14, 14, 14, 14, 13, 13, 12, 13,  9,
- 13, 16, 16, 16, 16, 15, 16, 15, 16, 15, 16, 14, 15, 13, 15, 10,
- 11, 15, 15, 14, 14, 14, 15, 14, 14, 15, 13, 13, 12, 13, 11,  9,
- 11, 14, 14, 13, 14, 14, 14, 13, 13, 14, 13, 12, 13, 12, 12,  8,
- 12, 15, 15, 14, 16, 14, 16, 14, 15, 15, 15, 13, 14, 13, 14,  9,
- 13, 16, 15, 16, 16, 16, 16, 15, 15, 16, 13, 13, 14, 14, 12,  9,
- 12, 15, 14, 14, 15, 15, 15, 13, 14, 15, 13, 12, 14, 13, 12,  8,
- 12, 15, 14, 14, 15, 15, 15, 13, 15, 15, 14, 12, 14, 13, 13,  8,
- 12, 16, 15, 15, 13, 14, 15, 14, 13, 15, 14, 14, 10, 11, 11,  9,
- 12, 16, 16, 15, 15, 14, 16, 14, 15, 15, 15, 14, 13, 12, 13,  9,
- 14, 16, 16, 16, 16, 14, 16, 15, 16, 15, 16, 15, 14, 12, 15, 10,
- 12, 16, 15, 15, 15, 15, 15, 14, 15, 16, 14, 14, 12, 13, 11,  9,
- 11, 15, 15, 14, 14, 14, 15, 13, 14, 15, 14, 13, 13, 12, 12,  8,
- 12, 15, 15, 14, 15, 14, 15, 13, 15, 15, 14, 13, 14, 12, 13,  8,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 14, 14, 14, 14, 11,  9,
- 12, 15, 15, 14, 15, 15, 15, 13, 15, 15, 14, 13, 14, 13, 12,  8,
- 11, 14, 14, 13, 14, 13, 14, 12, 13, 14, 13, 12, 13, 12, 12,  7,
-},
-{
-  2,  6,  6,  5,  6,  6,  7,  6,  6,  7,  6,  6,  6,  6,  6,  3,
-  6,  9, 10,  9, 10,  9, 11,  9, 10, 10, 10,  9, 10,  9, 10,  7,
- 10, 11, 14, 11, 14, 11, 14, 11, 14, 13, 14, 12, 14, 12, 13,  9,
-  6, 10,  9,  9, 10, 10, 10,  9, 10, 11,  9,  9, 10, 10,  9,  7,
-  8, 11, 11,  9, 12, 11, 12, 10, 12, 12, 11, 10, 12, 11, 11,  8,
- 11, 13, 14, 11, 16, 13, 15, 12, 16, 14, 14, 12, 15, 13, 14, 10,
- 10, 13, 11, 11, 14, 14, 13, 11, 13, 14, 11, 11, 13, 13, 11,  9,
- 11, 13, 13, 11, 15, 14, 14, 12, 15, 15, 13, 12, 15, 14, 13, 10,
- 12, 14, 14, 11, 16, 15, 16, 12, 16, 16, 15, 12, 16, 15, 15, 10,
-  6, 10, 10, 10,  9,  9, 10,  9, 10, 11, 10, 10,  9,  9,  9,  7,
-  8, 11, 12, 11, 11, 10, 12, 10, 12, 12, 12, 11, 11, 10, 11,  8,
- 12, 13, 16, 13, 14, 11, 16, 12, 16, 15, 15, 13, 14, 12, 14, 10,
-  9, 13, 12, 12, 12, 12, 12, 11, 13, 13, 12, 12, 12, 12, 11,  8,
- 10, 13, 13, 12, 13, 12, 13, 11, 14, 14, 13, 12, 13, 12, 12,  9,
- 12, 14, 16, 13, 15, 13, 15, 12, 16, 16, 16, 13, 16, 14, 14, 10,
- 12, 16, 14, 14, 16, 15, 14, 13, 16, 16, 14, 14, 15, 15, 13, 11,
- 12, 16, 15, 14, 16, 15, 15, 12, 16, 16, 15, 14, 16, 15, 14, 10,
- 14, 16, 16, 14, 16, 15, 16, 13, 16, 16, 16, 14, 16, 16, 15, 11,
- 10, 14, 14, 13, 11, 11, 13, 12, 14, 14, 13, 13, 11, 11, 12,  9,
- 12, 14, 16, 14, 13, 11, 14, 12, 16, 15, 15, 14, 14, 12, 13, 10,
- 13, 14, 16, 15, 14, 11, 16, 12, 16, 16, 16, 15, 16, 13, 15, 11,
- 12, 16, 15, 15, 14, 14, 14, 13, 16, 16, 15, 15, 14, 14, 13, 11,
- 13, 16, 16, 15, 14, 14, 15, 13, 16, 16, 16, 15, 15, 14, 14, 11,
- 14, 16, 16, 15, 16, 14, 16, 13, 16, 16, 16, 15, 16, 14, 15, 11,
- 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14, 12,
- 15, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 15, 12,
- 15, 16, 16, 15, 16, 15, 16, 13, 16, 16, 16, 16, 16, 16, 16, 11,
-  6, 10, 10, 10, 10, 10, 11, 10,  9, 10,  9,  9,  9,  9,  9,  7,
-  9, 12, 13, 12, 13, 12, 14, 12, 12, 12, 12, 11, 12, 11, 11,  8,
- 12, 14, 16, 14, 16, 14, 16, 14, 15, 14, 15, 13, 16, 13, 14, 11,
-  8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 11, 10,  8,
- 10, 13, 13, 12, 14, 13, 14, 12, 13, 13, 12, 11, 13, 12, 12,  9,
- 12, 15, 15, 13, 16, 15, 16, 14, 16, 15, 15, 12, 16, 14, 15, 10,
- 11, 15, 13, 13, 16, 15, 14, 13, 14, 15, 11, 12, 14, 14, 12, 10,
- 12, 16, 14, 13, 16, 16, 16, 14, 16, 15, 13, 12, 15, 15, 14, 10,
- 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 15, 13, 16, 16, 15, 11,
-  8, 12, 12, 12, 11, 11, 12, 11, 11, 12, 11, 11,  9, 10, 10,  8,
- 10, 13, 14, 13, 13, 12, 14, 12, 13, 13, 13, 12, 12, 11, 12,  9,
- 13, 15, 16, 15, 16, 14, 16, 14, 16, 15, 16, 14, 15, 13, 15, 11,
- 10, 13, 13, 13, 13, 13, 13, 12, 13, 14, 12, 12, 12, 12, 11,  9,
- 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 13, 12, 12, 12, 12,  9,
- 12, 15, 15, 14, 16, 14, 16, 13, 16, 15, 15, 13, 15, 13, 14, 10,
- 13, 16, 15, 15, 16, 16, 15, 14, 16, 16, 13, 14, 15, 15, 12, 10,
- 12, 16, 14, 14, 16, 16, 15, 13, 16, 16, 14, 13, 15, 14, 13, 10,
- 13, 16, 16, 14, 16, 15, 16, 13, 16, 16, 16, 13, 16, 15, 15, 10,
- 11, 15, 15, 14, 13, 13, 14, 13, 13, 15, 14, 14, 11, 12, 12, 10,
- 12, 15, 16, 15, 14, 13, 16, 14, 16, 15, 16, 14, 13, 12, 13, 10,
- 14, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16, 13, 16, 11,
- 12, 16, 16, 16, 15, 15, 15, 14, 15, 16, 14, 14, 13, 14, 12, 10,
- 12, 16, 16, 15, 15, 14, 16, 13, 16, 16, 15, 14, 14, 13, 13, 10,
- 13, 16, 16, 15, 16, 14, 16, 13, 16, 16, 16, 15, 16, 14, 15, 10,
- 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 15, 16, 15, 14, 11,
- 14, 16, 16, 15, 16, 16, 16, 13, 16, 16, 16, 15, 16, 15, 14, 10,
- 10, 14, 13, 13, 13, 13, 14, 13, 11, 13, 11, 11, 11, 11, 11,  9,
- 12, 15, 16, 15, 16, 15, 16, 14, 14, 14, 14, 13, 14, 13, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 14, 16, 12,
- 11, 15, 14, 14, 15, 15, 15, 14, 13, 14, 11, 12, 13, 13, 12, 10,
- 13, 16, 15, 15, 16, 16, 16, 15, 15, 15, 13, 12, 15, 14, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 12,
- 13, 16, 14, 15, 16, 16, 16, 15, 14, 16, 11, 12, 15, 15, 12, 10,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 13, 16, 16, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 11,
- 11, 15, 15, 14, 13, 14, 14, 14, 13, 14, 13, 13, 11, 12, 11, 10,
- 12, 16, 16, 16, 16, 15, 16, 15, 15, 15, 15, 14, 13, 12, 14, 10,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 16, 12,
- 12, 16, 15, 15, 16, 16, 16, 14, 14, 15, 13, 13, 13, 13, 12, 10,
- 12, 16, 16, 15, 15, 15, 16, 14, 14, 15, 14, 13, 14, 13, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 11,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 15, 15, 12, 11,
- 13, 16, 16, 15, 16, 16, 16, 14, 16, 16, 14, 13, 16, 14, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 16, 14, 15, 10,
- 12, 16, 16, 15, 14, 15, 16, 14, 13, 15, 14, 14, 11, 12, 12, 10,
- 13, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 13, 12, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 11,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 15, 15, 13, 14, 12, 11,
- 13, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14, 14, 13, 13, 10,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 15, 14, 14, 10,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 15, 16, 13, 11,
- 14, 16, 16, 16, 16, 16, 16, 14, 16, 16, 15, 14, 15, 14, 13, 10,
- 12, 15, 15, 14, 15, 14, 16, 14, 14, 16, 15, 13, 14, 13, 13,  9,
-},
-{
-  2,  5,  5,  5,  5,  5,  6,  6,  5,  6,  5,  6,  5,  6,  6,  4,
-  6,  8, 10,  8, 10,  9, 11,  9, 10, 10, 10,  9, 10,  9, 10,  8,
- 10, 11, 13, 11, 13, 11, 14, 11, 14, 13, 13, 12, 13, 12, 13, 10,
-  6, 10,  8,  9, 10, 10, 10,  9, 10, 11,  9,  9, 10, 10,  9,  7,
-  8, 11, 11, 10, 12, 11, 12, 10, 12, 12, 11, 10, 12, 12, 11,  9,
- 11, 13, 14, 11, 15, 14, 15, 12, 16, 14, 14, 12, 15, 14, 14, 11,
- 10, 13, 11, 11, 14, 13, 13, 12, 13, 14, 11, 11, 13, 13, 12, 10,
- 11, 14, 13, 11, 16, 14, 14, 12, 15, 15, 14, 12, 15, 14, 14, 11,
- 12, 14, 14, 11, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 15, 12,
-  6, 10, 10, 10,  8,  9, 10,  9, 10, 11, 10, 10,  9,  9,  9,  8,
-  8, 11, 12, 12, 11, 10, 12, 11, 12, 12, 12, 12, 12, 11, 12,  9,
- 11, 13, 16, 14, 14, 12, 15, 12, 16, 15, 16, 14, 14, 13, 14, 11,
-  9, 13, 12, 12, 12, 12, 12, 11, 13, 13, 12, 12, 12, 12, 11, 10,
- 10, 13, 13, 12, 13, 12, 13, 11, 14, 14, 13, 13, 13, 13, 12, 10,
- 13, 14, 16, 14, 15, 14, 16, 13, 16, 16, 16, 14, 16, 14, 15, 12,
- 12, 16, 14, 14, 16, 15, 14, 13, 16, 16, 14, 14, 15, 15, 13, 12,
- 13, 16, 15, 14, 16, 16, 15, 13, 16, 16, 15, 14, 16, 16, 14, 12,
- 14, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 12,
- 10, 13, 14, 13, 11, 11, 13, 12, 13, 14, 13, 13, 11, 12, 12, 10,
- 11, 14, 15, 15, 13, 12, 14, 13, 16, 16, 16, 15, 14, 13, 14, 11,
- 12, 14, 16, 16, 14, 12, 16, 13, 16, 16, 16, 16, 15, 13, 16, 12,
- 12, 16, 15, 16, 14, 15, 14, 14, 16, 16, 15, 16, 14, 14, 13, 12,
- 13, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16, 14, 15, 12,
- 14, 16, 16, 16, 16, 14, 16, 14, 16, 16, 16, 16, 16, 15, 16, 13,
- 15, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 15, 13,
- 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 13,
- 15, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 13,
-  6, 10, 10, 10, 10, 10, 10, 10,  8, 10,  9,  9,  8,  9,  9,  7,
-  9, 12, 13, 12, 13, 12, 13, 12, 12, 12, 12, 11, 12, 11, 12, 10,
- 12, 14, 16, 14, 16, 14, 16, 14, 16, 15, 15, 14, 16, 14, 15, 12,
-  8, 12, 11, 11, 12, 12, 12, 11, 11, 12, 10, 10, 11, 12, 10,  9,
- 10, 13, 13, 12, 14, 13, 14, 12, 13, 13, 12, 11, 13, 13, 12, 10,
- 13, 15, 16, 14, 16, 16, 16, 14, 16, 15, 15, 13, 16, 15, 15, 12,
- 11, 15, 13, 13, 15, 15, 15, 14, 14, 14, 11, 12, 14, 14, 12, 11,
- 13, 16, 14, 14, 16, 16, 16, 14, 16, 15, 13, 13, 16, 14, 14, 11,
- 14, 16, 16, 14, 16, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 12,
-  8, 12, 12, 12, 11, 11, 12, 12, 11, 12, 11, 11,  9, 10, 10,  9,
- 10, 13, 14, 13, 13, 12, 14, 13, 13, 13, 13, 13, 12, 11, 12, 10,
- 13, 15, 16, 15, 16, 14, 16, 14, 16, 16, 16, 15, 16, 13, 15, 12,
- 10, 14, 13, 13, 13, 13, 13, 13, 13, 14, 12, 12, 12, 12, 11, 10,
- 10, 13, 13, 13, 13, 13, 14, 12, 13, 14, 13, 12, 13, 12, 12, 10,
- 13, 16, 16, 14, 16, 15, 16, 14, 16, 16, 15, 14, 16, 14, 15, 11,
- 13, 16, 15, 16, 16, 16, 15, 14, 16, 16, 14, 14, 15, 15, 13, 12,
- 13, 16, 15, 14, 16, 16, 16, 14, 16, 16, 14, 14, 15, 15, 14, 11,
- 14, 16, 16, 15, 16, 16, 16, 14, 16, 16, 16, 15, 16, 16, 15, 12,
- 11, 14, 15, 14, 13, 13, 14, 14, 13, 15, 14, 14, 11, 12, 12, 11,
- 13, 16, 16, 16, 14, 14, 16, 14, 16, 16, 16, 15, 14, 13, 14, 12,
- 14, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13,
- 13, 16, 16, 16, 15, 16, 15, 15, 16, 16, 15, 16, 14, 14, 13, 12,
- 13, 16, 16, 15, 15, 14, 16, 14, 16, 16, 16, 15, 14, 14, 14, 11,
- 14, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 15, 16, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 13,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
-  9, 13, 13, 13, 13, 13, 14, 13, 10, 12, 11, 12, 11, 12, 11, 10,
- 12, 15, 16, 15, 16, 16, 16, 16, 14, 14, 14, 13, 14, 13, 14, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 14,
- 11, 15, 14, 14, 15, 14, 15, 14, 13, 14, 11, 12, 13, 13, 12, 11,
- 13, 16, 16, 15, 16, 16, 16, 15, 15, 15, 14, 13, 16, 15, 14, 12,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 13,
- 12, 16, 14, 15, 16, 16, 16, 16, 14, 16, 11, 13, 15, 16, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 16, 15, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 13,
- 11, 15, 14, 14, 13, 14, 15, 14, 12, 14, 13, 13, 11, 12, 12, 11,
- 13, 16, 16, 16, 16, 15, 16, 16, 15, 15, 15, 15, 14, 13, 14, 12,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 15, 14, 16, 13, 14, 13, 14, 13, 11,
- 13, 16, 16, 16, 16, 16, 16, 15, 15, 16, 15, 14, 14, 14, 14, 11,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 15, 16, 16, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 16, 16, 15, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12,
- 11, 16, 16, 15, 13, 15, 16, 15, 13, 15, 15, 15, 11, 12, 12, 11,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 15, 12,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 14, 13, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 12,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 14, 13,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 12,
- 12, 14, 14, 14, 14, 15, 16, 14, 14, 16, 15, 14, 14, 15, 14, 11,
-},
-{
-  1,  5,  5,  6,  5,  6,  7,  7,  5,  7,  6,  7,  5,  6,  6,  6,
-  6,  9, 10,  9, 10,  9, 11, 10, 11, 11, 11, 10, 11, 10, 11,  9,
- 10, 11, 14, 12, 14, 12, 16, 12, 16, 13, 16, 13, 14, 13, 16, 12,
-  6, 10,  9,  9, 10, 11, 11, 10, 10, 11,  9, 10, 10, 11, 10,  9,
-  8, 11, 11, 10, 13, 12, 13, 12, 13, 13, 12, 12, 13, 13, 13, 11,
- 11, 13, 16, 12, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 13,
- 10, 14, 11, 12, 14, 14, 13, 13, 13, 16, 12, 13, 14, 16, 13, 12,
- 11, 14, 13, 12, 16, 16, 16, 14, 16, 16, 14, 14, 16, 16, 16, 13,
- 12, 14, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-  6, 10, 10, 11,  9,  9, 11, 10, 10, 11, 11, 11,  9, 10, 10,  9,
-  9, 12, 13, 12, 12, 11, 13, 12, 13, 13, 13, 13, 12, 12, 13, 11,
- 12, 13, 16, 16, 16, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 13,
-  9, 13, 13, 13, 13, 13, 13, 13, 13, 14, 13, 13, 13, 13, 12, 11,
- 10, 14, 14, 13, 14, 13, 14, 13, 16, 16, 14, 15, 14, 14, 14, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 14, 14, 16, 11, 12, 14, 13, 14, 16, 16, 16, 12, 13, 13, 12,
- 12, 16, 16, 16, 13, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 13,
- 13, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  6, 10, 10, 10, 10, 11, 11, 11,  9, 11,  9, 10,  9, 10, 10,  9,
-  9, 13, 13, 13, 13, 13, 14, 13, 12, 13, 13, 12, 13, 12, 13, 11,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
-  8, 13, 12, 12, 13, 13, 13, 13, 11, 13, 10, 12, 12, 13, 12, 11,
- 10, 14, 13, 13, 16, 16, 16, 14, 14, 14, 13, 13, 14, 14, 14, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 11, 16, 13, 16, 16, 16, 16, 16, 14, 16, 12, 13, 16, 16, 14, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  8, 13, 13, 13, 11, 12, 13, 13, 11, 13, 12, 13, 10, 12, 12, 11,
- 10, 14, 16, 16, 14, 13, 16, 14, 14, 16, 16, 14, 13, 13, 14, 12,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 10, 16, 14, 16, 14, 14, 14, 14, 13, 16, 13, 14, 13, 14, 12, 12,
- 10, 14, 14, 14, 14, 16, 16, 14, 14, 16, 14, 14, 14, 14, 14, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 14, 14, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  9, 14, 13, 14, 13, 14, 16, 16, 11, 13, 12, 13, 11, 13, 12, 12,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 14, 16, 16, 16, 16, 16, 13, 16, 12, 13, 14, 16, 13, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 14, 16, 12, 16, 16, 16, 14, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 14, 16, 16, 16, 13, 16, 14, 16, 12, 13, 13, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 12, 16, 14, 14,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 13,
-},
-{
-  1,  5,  5,  6,  5,  6,  7,  8,  5,  7,  6,  8,  6,  7,  7,  7,
-  5,  9, 10, 10, 10, 10, 12, 11, 10, 11, 11, 11, 10, 11, 12, 10,
-  9, 11, 13, 12, 13, 12, 16, 14, 16, 14, 16, 16, 16, 13, 16, 13,
-  5, 10,  9, 10, 10, 11, 11, 11, 10, 11,  9, 11, 10, 11, 11, 10,
-  8, 11, 11, 11, 12, 13, 13, 13, 12, 13, 12, 12, 13, 13, 13, 12,
- 11, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  9, 14, 11, 12, 14, 16, 13, 14, 13, 16, 12, 14, 16, 16, 13, 13,
- 11, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 14, 14, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  5, 10, 11, 11,  9, 10, 11, 11, 10, 12, 11, 12,  9, 11, 11, 11,
-  8, 12, 13, 13, 11, 11, 14, 13, 13, 14, 13, 16, 12, 12, 13, 12,
- 11, 13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  9, 13, 12, 13, 12, 13, 13, 14, 13, 16, 13, 16, 13, 16, 13, 13,
- 10, 14, 13, 14, 13, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  9, 14, 16, 16, 11, 12, 14, 16, 13, 16, 16, 16, 12, 14, 13, 13,
- 11, 16, 16, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 14, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  5, 10, 10, 11, 10, 11, 12, 12,  8, 11, 10, 11,  9, 11, 11, 11,
-  9, 12, 13, 13, 13, 13, 16, 16, 12, 13, 13, 13, 13, 13, 16, 13,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  8, 13, 11, 13, 12, 13, 13, 14, 11, 13, 10, 13, 12, 14, 12, 12,
- 10, 14, 13, 14, 16, 16, 16, 16, 13, 16, 13, 14, 16, 16, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 13, 16, 16, 16, 16, 16, 13, 16, 12, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  8, 13, 13, 13, 11, 13, 14, 16, 11, 13, 13, 14, 10, 12, 12, 12,
- 10, 14, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 13, 16, 14,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 14, 16, 13, 16, 16, 16, 13, 16, 13, 16, 13, 16, 13, 14,
- 10, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 13,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-  9, 14, 13, 16, 13, 16, 16, 16, 10, 14, 12, 14, 11, 13, 13, 13,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 16, 16, 16, 16, 13, 16, 13, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 11, 16, 16, 16, 14, 16, 16, 16, 14, 16, 16, 16, 12, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
- 10, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 14,
-}
-};
-
-
-static const uint8_t rv34_inter_cbp[NUM_INTER_TABLES][4][CBP_VLC_SIZE] = {
-{
- { 0,  6,  6,  3,  6,  4,  5,  3,  6,  5,  4,  3,  3,  4,  4,  3 },
- { 0,  6,  6,  4,  6,  4,  5,  3,  6,  5,  4,  3,  4,  4,  4,  2 },
- { 0,  7,  7,  4,  7,  5,  5,  4,  7,  5,  5,  4,  5,  4,  4,  1 },
- { 0,  7,  7,  5,  7,  5,  6,  4,  7,  6,  5,  3,  5,  4,  4,  1 }
-},
-{
- { 0,  6,  6,  3,  6,  3,  5,  4,  6,  5,  3,  4,  3,  4,  4,  3 },
- { 0,  6,  6,  4,  6,  4,  4,  4,  6,  4,  4,  3,  4,  4,  4,  2 },
- { 0,  6,  6,  4,  6,  4,  5,  4,  6,  5,  4,  3,  4,  4,  3,  2 },
- { 0,  7,  7,  5,  7,  5,  6,  4,  7,  6,  5,  3,  5,  4,  4,  1 }
-},
-{
- { 0,  6,  6,  3,  6,  3,  5,  4,  6,  5,  3,  4,  3,  4,  4,  3 },
- { 0,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4,  4,  4,  4,  4,  2 },
- { 0,  6,  6,  4,  6,  4,  5,  3,  6,  5,  4,  3,  4,  4,  4,  2 },
- { 0,  7,  7,  5,  7,  5,  6,  4,  7,  6,  5,  3,  5,  4,  4,  1 }
-},
-{
- { 0,  6,  6,  3,  6,  3,  5,  4,  6,  5,  3,  4,  3,  4,  4,  3 },
- { 0,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4,  4,  4,  4,  4,  2 },
- { 0,  6,  6,  4,  6,  4,  5,  3,  6,  5,  4,  3,  4,  4,  4,  2 },
- { 0,  7,  7,  4,  7,  5,  6,  4,  7,  6,  5,  4,  4,  4,  4,  1 }
-},
-{
- { 0,  5,  5,  3,  5,  3,  5,  4,  5,  5,  3,  4,  3,  4,  4,  4 },
- { 0,  5,  5,  3,  5,  4,  5,  4,  5,  5,  3,  4,  3,  4,  4,  3 },
- { 0,  6,  6,  4,  6,  4,  5,  4,  6,  5,  4,  3,  4,  4,  3,  2 },
- { 0,  7,  7,  4,  7,  5,  6,  4,  7,  6,  5,  4,  4,  4,  4,  1 }
-},
-{
- { 0,  5,  5,  3,  5,  3,  5,  4,  5,  5,  3,  4,  3,  4,  4,  4 },
- { 0,  5,  5,  3,  5,  4,  5,  4,  5,  5,  3,  4,  3,  4,  4,  3 },
- { 0,  5,  5,  3,  5,  4,  4,  4,  5,  4,  4,  4,  3,  4,  4,  3 },
- { 0,  6,  6,  4,  6,  4,  5,  4,  6,  5,  4,  3,  4,  4,  3,  2 }
-},
-{
- { 0,  4,  4,  3,  4,  3,  5,  5,  4,  5,  3,  5,  3,  5,  4,  5 },
- { 0,  4,  4,  3,  4,  4,  5,  4,  4,  5,  3,  5,  3,  5,  4,  4 },
- { 0,  4,  4,  3,  4,  4,  5,  4,  4,  5,  4,  4,  3,  4,  4,  4 },
- { 0,  4,  4,  3,  5,  4,  5,  4,  5,  5,  4,  4,  3,  4,  4,  3 }
-}
-};
-
-
-static const uint8_t rv34_table_inter_firstpat[NUM_INTER_TABLES][2][FIRSTBLK_VLC_SIZE] = {
-  {
-    {
-       0,  7,  5,  7,  5,  7,  6,  6,  7, 10,  7,  9,  8,  9,  8,  7,
-      12, 14, 11, 12, 12, 12, 11,  9,  6,  9,  6,  8,  7,  9,  7,  7,
-       8, 11,  8,  9,  9, 10,  9,  8, 13, 15, 12, 12, 12, 13, 11,  9,
-      10, 13,  9, 10, 11, 12,  9,  8, 12, 14, 10, 11, 12, 13, 10,  9,
-      16, 16, 12, 12, 14, 13, 11,  9,  6,  9,  7,  9,  7,  9,  8,  7,
-       9, 11,  9, 10,  9, 10,  9,  8, 14, 16, 12, 12, 13, 13, 11,  9,
-       8, 11,  8, 10,  9, 10,  9,  8, 10, 13, 10, 11, 10, 11,  9,  8,
-      14, 16, 12, 12, 13, 13, 11,  9, 12, 14, 10, 11, 12, 13, 10,  9,
-      13, 16, 11, 12, 13, 13, 10,  9, 16, 16, 13, 12, 14, 14, 11,  9,
-      11, 13, 11, 12, 10, 11, 10,  9, 13, 14, 12, 12, 11, 12, 10,  9,
-      16, 16, 13, 13, 13, 13, 11,  9, 12, 15, 12, 12, 11, 12, 10,  9,
-      13, 16, 13, 13, 12, 12, 11,  9, 16, 16, 14, 13, 13, 13, 11,  9,
-      14, 16, 13, 13, 13, 14, 11,  9, 16, 16, 13, 13, 14, 14, 11,  9,
-      16, 16, 13, 13, 14, 13, 11,  8,  4,  9,  6,  8,  6,  9,  7,  7,
-       8, 11,  8,  9,  9, 10,  8,  8, 13, 15, 12, 12, 13, 13, 11,  9,
-       7, 10,  7,  9,  8, 10,  8,  8,  9, 12,  9, 10, 10, 11,  9,  8,
-      14, 16, 12, 12, 13, 13, 11,  9, 11, 13,  9, 10, 11, 12,  9,  8,
-      12, 14, 10, 11, 12, 13, 10,  9, 16, 16, 13, 12, 14, 14, 11,  9,
-       7, 10,  8,  9,  8, 10,  8,  8, 10, 12, 10, 11, 10, 11,  9,  8,
-      14, 16, 13, 13, 13, 13, 11,  9,  9, 12,  9, 10,  9, 11,  9,  8,
-      11, 13, 10, 11, 10, 11, 10,  9, 15, 16, 13, 13, 13, 13, 11,  9,
-      12, 14, 11, 11, 12, 13, 10,  9, 13, 16, 11, 12, 13, 13, 10,  9,
-      16, 16, 12, 12, 14, 13, 11,  8, 11, 14, 11, 12, 10, 11, 10,  9,
-      13, 15, 12, 13, 11, 12, 10,  9, 16, 16, 14, 13, 13, 13, 11,  9,
-      12, 15, 12, 13, 11, 12, 10,  9, 13, 16, 13, 13, 12, 12, 11,  9,
-      16, 16, 14, 13, 13, 13, 11,  9, 15, 16, 13, 13, 13, 13, 11,  9,
-      16, 16, 13, 13, 13, 13, 11,  9, 16, 16, 13, 12, 13, 13, 10,  7,
-       8, 11,  8, 10,  9, 11,  9,  9, 10, 13, 10, 11, 11, 12, 10,  9,
-      15, 16, 13, 13, 14, 14, 12, 10,  9, 12,  9, 11, 10, 11,  9,  9,
-      12, 14, 11, 11, 11, 12, 10,  9, 16, 16, 13, 13, 14, 14, 12, 10,
-      12, 14, 10, 11, 12, 13, 10,  9, 14, 16, 11, 12, 13, 14, 10,  9,
-      16, 16, 13, 13, 15, 14, 11,  9,  9, 12, 10, 11,  9, 11, 10,  9,
-      12, 14, 11, 12, 11, 12, 10,  9, 16, 16, 14, 13, 14, 14, 12, 10,
-      11, 14, 10, 12, 11, 12, 10,  9, 12, 15, 11, 12, 12, 13, 11, 10,
-      16, 16, 14, 13, 14, 14, 12, 10, 13, 16, 11, 12, 13, 14, 11,  9,
-      14, 16, 12, 12, 13, 14, 11,  9, 16, 16, 13, 13, 14, 14, 11,  9,
-      12, 15, 12, 13, 10, 12, 10,  9, 14, 16, 13, 13, 11, 12, 11, 10,
-      16, 16, 14, 14, 14, 13, 12,  9, 13, 16, 13, 13, 12, 13, 11, 10,
-      14, 16, 13, 13, 12, 13, 11, 10, 16, 16, 14, 14, 13, 13, 12,  9,
-      15, 16, 13, 13, 13, 14, 11,  9, 16, 16, 13, 13, 13, 14, 11,  9,
-      16, 16, 13, 12, 13, 13, 10,  8, 10, 13, 10, 11, 10, 12, 10,  9,
-      12, 14, 11, 12, 12, 13, 11, 10, 16, 16, 13, 13, 14, 14, 12,  9,
-      11, 14, 10, 11, 11, 12, 10,  9, 13, 16, 11, 12, 12, 13, 11, 10,
-      16, 16, 14, 13, 14, 14, 12,  9, 12, 15, 10, 11, 12, 13,  9,  8,
-      14, 16, 11, 11, 13, 14, 10,  8, 16, 16, 12, 12, 14, 14, 10,  8,
-      11, 14, 11, 12, 11, 12, 10,  9, 13, 16, 12, 13, 12, 13, 11, 10,
-      16, 16, 14, 13, 14, 14, 12,  9, 12, 15, 11, 12, 11, 13, 10, 10,
-      13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 14, 13, 14, 14, 12,  9,
-      13, 16, 11, 11, 13, 13, 10,  8, 14, 16, 11, 12, 13, 14, 10,  8,
-      16, 16, 12, 12, 14, 14, 10,  8, 12, 15, 12, 13, 10, 11, 10,  9,
-      14, 16, 13, 13, 11, 12, 10,  9, 16, 16, 14, 13, 13, 13, 11,  8,
-      13, 16, 12, 13, 11, 12, 10,  9, 14, 16, 13, 13, 12, 12, 10,  9,
-      16, 16, 14, 13, 13, 12, 10,  8, 14, 16, 12, 12, 12, 13, 10,  8,
-      14, 16, 12, 12, 12, 13, 10,  7, 16, 16, 11, 11, 12, 11,  8,  5,
-    },
-    {
-       0,  7,  4,  8,  5,  8,  7,  8,  6, 10,  7, 10,  8, 10,  9,  9,
-      13, 16, 12, 13, 13, 14, 12, 12,  4, 10,  6,  9,  8, 11,  8,  9,
-       8, 12,  8, 11, 10, 12, 10, 10, 14, 16, 12, 13, 14, 15, 12, 12,
-       9, 14,  9, 11, 12, 14, 11, 11, 11, 15, 10, 12, 13, 14, 11, 11,
-      15, 16, 13, 14, 15, 16, 13, 12,  5, 10,  7, 10,  7, 10,  9,  9,
-       8, 12,  9, 11, 10, 11, 10, 10, 14, 16, 13, 14, 14, 14, 12, 12,
-       8, 12,  8, 11, 10, 12, 10, 10, 10, 14, 10, 12, 11, 13, 10, 11,
-      15, 16, 13, 14, 14, 15, 13, 12, 11, 16, 10, 12, 13, 15, 11, 11,
-      13, 16, 11, 13, 14, 15, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
-      11, 15, 11, 13, 11, 13, 11, 11, 13, 16, 12, 14, 12, 13, 12, 12,
-      16, 16, 14, 15, 15, 15, 13, 12, 12, 16, 12, 14, 12, 14, 12, 12,
-      14, 16, 13, 14, 13, 14, 12, 12, 16, 16, 14, 16, 16, 16, 13, 12,
-      14, 16, 13, 14, 15, 16, 13, 12, 16, 16, 14, 15, 16, 16, 13, 12,
-      16, 16, 15, 16, 16, 16, 13, 12,  2,  9,  5,  8,  6,  9,  8,  9,
-       7, 11,  8, 10,  9, 11,  9, 10, 13, 16, 12, 13, 14, 14, 12, 12,
-       5, 11,  6, 10,  9, 11,  9,  9,  9, 13,  9, 11, 10, 12, 10, 10,
-      14, 16, 12, 14, 14, 15, 12, 12,  9, 14,  9, 11, 12, 14, 10, 11,
-      11, 16, 10, 12, 13, 14, 11, 11, 16, 16, 13, 14, 15, 16, 13, 12,
-       6, 11,  7, 10,  8, 11,  9,  9,  9, 13,  9, 11, 10, 12, 10, 10,
-      14, 16, 13, 14, 14, 14, 12, 12,  8, 13,  8, 11, 10, 12, 10, 10,
-      10, 13, 10, 12, 11, 13, 10, 11, 14, 16, 13, 14, 14, 15, 12, 12,
-      11, 15, 10, 12, 13, 15, 11, 11, 12, 16, 11, 13, 13, 15, 12, 11,
-      16, 16, 13, 14, 15, 16, 13, 12, 11, 15, 11, 13, 10, 13, 11, 11,
-      13, 16, 12, 14, 12, 13, 12, 11, 16, 16, 14, 15, 15, 15, 13, 12,
-      12, 16, 12, 13, 12, 14, 12, 12, 13, 16, 12, 14, 13, 14, 12, 12,
-      16, 16, 14, 15, 15, 15, 13, 12, 14, 16, 13, 14, 15, 16, 12, 12,
-      16, 16, 13, 14, 15, 16, 12, 12, 16, 16, 14, 15, 16, 16, 13, 12,
-       6, 12,  7, 10,  9, 12,  9, 10,  9, 13,  9, 12, 11, 13, 11, 11,
-      14, 16, 13, 14, 15, 15, 13, 12,  8, 13,  8, 11, 10, 13, 10, 10,
-      10, 14, 10, 12, 12, 14, 11, 11, 15, 16, 13, 14, 16, 16, 13, 12,
-      10, 15,  9, 12, 12, 15, 11, 11, 12, 16, 11, 13, 14, 16, 12, 12,
-      16, 16, 14, 14, 16, 16, 13, 12,  8, 13,  9, 11, 10, 12, 10, 11,
-      11, 14, 11, 12, 11, 13, 11, 11, 16, 16, 14, 15, 15, 16, 13, 12,
-      10, 14, 10, 12, 11, 13, 11, 11, 11, 15, 11, 13, 12, 14, 11, 11,
-      15, 16, 13, 14, 15, 16, 13, 12, 12, 16, 11, 13, 13, 16, 12, 12,
-      13, 16, 11, 13, 14, 16, 12, 12, 16, 16, 13, 14, 16, 16, 13, 12,
-      12, 16, 12, 14, 11, 13, 11, 11, 13, 16, 13, 14, 12, 14, 12, 12,
-      16, 16, 15, 16, 16, 16, 14, 13, 13, 16, 12, 14, 12, 14, 12, 12,
-      14, 16, 13, 14, 13, 14, 12, 12, 16, 16, 14, 16, 14, 16, 13, 12,
-      15, 16, 13, 15, 15, 16, 13, 12, 15, 16, 13, 15, 14, 16, 13, 12,
-      16, 16, 14, 15, 15, 16, 13, 11,  8, 13,  8, 11, 10, 13, 10, 11,
-      11, 15, 10, 12, 12, 14, 11, 11, 15, 16, 13, 14, 15, 15, 13, 12,
-       9, 14,  9, 12, 11, 14, 10, 11, 11, 16, 10, 12, 13, 14, 11, 11,
-      16, 16, 13, 14, 15, 16, 13, 12, 11, 15,  9, 12, 12, 14, 10, 10,
-      12, 16, 11, 12, 14, 15, 11, 11, 16, 16, 13, 14, 16, 16, 12, 11,
-       9, 14, 10, 12, 11, 13, 11, 11, 12, 16, 11, 13, 12, 14, 11, 11,
-      16, 16, 14, 14, 15, 15, 13, 12, 10, 15, 10, 12, 12, 14, 11, 11,
-      12, 16, 11, 13, 13, 14, 11, 11, 16, 16, 14, 14, 15, 16, 13, 12,
-      12, 16, 10, 12, 13, 15, 11, 11, 13, 16, 11, 13, 14, 15, 11, 11,
-      16, 16, 13, 13, 15, 16, 12, 11, 12, 16, 11, 13, 10, 13, 11, 11,
-      14, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 14, 15, 13, 11,
-      13, 16, 12, 14, 12, 14, 11, 11, 13, 16, 12, 14, 12, 14, 11, 11,
-      16, 16, 14, 15, 14, 14, 12, 11, 14, 16, 12, 13, 13, 15, 11, 11,
-      14, 16, 12, 13, 13, 14, 11, 11, 15, 16, 12, 13, 13, 13, 10,  9,
-    },
-  },
-  {
-    {
-       0,  7,  4,  7,  5,  7,  6,  6,  6, 10,  7,  8,  8,  9,  8,  7,
-      13, 14, 11, 12, 12, 12, 11,  9,  5,  9,  6,  8,  7,  9,  7,  7,
-       8, 11,  8,  9,  9, 10,  9,  8, 13, 16, 12, 12, 12, 13, 11,  9,
-      10, 13,  8, 10, 11, 12,  9,  9, 12, 14, 10, 11, 12, 13, 10,  9,
-      15, 16, 12, 12, 14, 14, 11,  9,  6, 10,  7,  9,  7,  9,  8,  7,
-       8, 11,  9, 10,  9, 10,  9,  8, 14, 16, 12, 12, 13, 12, 11,  9,
-       8, 11,  8, 10,  9, 10,  9,  8, 10, 13, 10, 11, 10, 11,  9,  9,
-      14, 16, 12, 12, 13, 13, 11,  9, 12, 15, 10, 11, 12, 13, 10,  9,
-      13, 16, 11, 12, 13, 13, 10,  9, 16, 16, 12, 13, 14, 14, 11,  9,
-      10, 14, 11, 12,  9, 11, 10,  9, 12, 15, 12, 13, 11, 12, 11,  9,
-      16, 16, 13, 13, 13, 13, 11,  9, 12, 15, 12, 13, 11, 12, 11,  9,
-      13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 13, 13, 13, 11,  9,
-      14, 16, 13, 13, 13, 14, 11, 10, 16, 16, 13, 13, 13, 14, 11, 10,
-      16, 16, 13, 13, 14, 14, 11,  9,  4,  9,  6,  8,  6,  9,  7,  7,
-       8, 11,  8,  9,  9, 10,  9,  8, 13, 15, 12, 12, 13, 13, 11,  9,
-       6, 10,  7,  9,  8, 10,  8,  8,  9, 12,  9, 10, 10, 11,  9,  8,
-      14, 16, 12, 12, 13, 13, 11, 10, 10, 13,  8, 10, 11, 12,  9,  9,
-      12, 15, 10, 11, 12, 13, 10,  9, 16, 16, 12, 12, 14, 14, 11,  9,
-       7, 11,  8,  9,  7, 10,  8,  8,  9, 12, 10, 11,  9, 11,  9,  9,
-      14, 16, 12, 13, 13, 13, 11, 10,  9, 12,  9, 10,  9, 11,  9,  9,
-      10, 13, 10, 11, 10, 11, 10,  9, 14, 16, 12, 13, 13, 13, 11,  9,
-      12, 15, 10, 11, 12, 13, 10,  9, 13, 16, 11, 12, 13, 13, 10,  9,
-      16, 16, 12, 12, 14, 14, 11,  9, 10, 14, 11, 12,  9, 11, 10,  9,
-      12, 16, 12, 13, 11, 12, 11,  9, 16, 16, 14, 14, 13, 13, 11,  9,
-      12, 16, 12, 13, 11, 12, 10, 10, 13, 16, 12, 13, 11, 12, 11, 10,
-      16, 16, 13, 13, 13, 13, 11,  9, 14, 16, 13, 13, 13, 14, 11,  9,
-      15, 16, 13, 13, 13, 14, 11,  9, 16, 16, 13, 13, 13, 13, 10,  8,
-       7, 11,  8, 10,  9, 11,  9,  9, 10, 13, 10, 11, 11, 12, 10, 10,
-      15, 16, 13, 13, 14, 14, 12, 10,  9, 13,  9, 11, 10, 12, 10,  9,
-      11, 14, 10, 12, 12, 13, 10, 10, 16, 16, 13, 13, 14, 14, 12, 10,
-      11, 15,  9, 11, 12, 13, 10,  9, 13, 16, 11, 12, 13, 14, 11, 10,
-      16, 16, 13, 13, 15, 15, 11, 10,  9, 13, 10, 11,  9, 11, 10,  9,
-      11, 14, 11, 12, 11, 12, 11, 10, 16, 16, 14, 14, 14, 14, 12, 10,
-      10, 14, 10, 12, 11, 12, 10, 10, 12, 15, 11, 12, 12, 13, 11, 10,
-      16, 16, 13, 13, 14, 14, 12, 10, 13, 16, 11, 12, 13, 14, 11, 10,
-      13, 16, 11, 12, 13, 14, 11, 10, 16, 16, 12, 13, 14, 14, 11,  9,
-      11, 15, 12, 13, 10, 12, 10, 10, 13, 16, 13, 14, 11, 13, 11, 10,
-      16, 16, 14, 14, 14, 14, 12, 10, 13, 16, 13, 13, 11, 13, 11, 10,
-      14, 16, 13, 14, 12, 13, 11, 10, 16, 16, 14, 14, 13, 13, 12, 10,
-      15, 16, 13, 14, 14, 14, 11, 10, 15, 16, 13, 13, 13, 14, 11, 10,
-      16, 16, 12, 13, 13, 13, 10,  8,  9, 13, 10, 11, 10, 12, 10, 10,
-      12, 15, 11, 12, 12, 13, 11, 10, 16, 16, 14, 13, 14, 14, 12, 10,
-      10, 14, 10, 12, 11, 13, 10, 10, 13, 16, 11, 12, 12, 14, 11, 10,
-      16, 16, 13, 13, 14, 14, 12, 10, 12, 16,  9, 11, 12, 14, 10,  9,
-      13, 16, 10, 12, 13, 14, 10,  9, 16, 16, 12, 12, 14, 14, 11,  9,
-      10, 14, 11, 12, 10, 12, 10, 10, 13, 16, 12, 13, 12, 13, 11, 10,
-      16, 16, 14, 14, 14, 14, 12, 10, 11, 16, 11, 12, 11, 13, 11, 10,
-      13, 16, 12, 13, 12, 14, 11, 10, 16, 16, 14, 14, 14, 14, 12, 10,
-      13, 16, 11, 12, 13, 14, 10,  9, 14, 16, 11, 12, 13, 14, 10,  9,
-      16, 16, 12, 12, 14, 14, 10,  8, 12, 16, 12, 13, 10, 12, 10,  9,
-      14, 16, 13, 13, 11, 12, 11,  9, 16, 16, 14, 14, 13, 13, 11,  9,
-      13, 16, 12, 13, 11, 12, 10,  9, 14, 16, 13, 13, 11, 13, 11,  9,
-      16, 16, 14, 14, 13, 13, 11,  9, 14, 16, 12, 13, 12, 13, 10,  8,
-      14, 16, 12, 12, 12, 13, 10,  8, 15, 16, 11, 11, 11, 12,  9,  6,
-    },
-    {
-       0,  7,  4,  7,  5,  8,  7,  8,  5, 10,  7, 10,  8, 10,  9, 10,
-      13, 16, 12, 14, 14, 14, 13, 12,  4, 10,  6,  9,  8, 11,  9,  9,
-       8, 12,  8, 11, 10, 12, 10, 10, 14, 16, 13, 14, 14, 15, 13, 12,
-       9, 14,  9, 12, 12, 14, 11, 11, 12, 16, 11, 13, 13, 15, 12, 12,
-      15, 16, 14, 15, 15, 16, 13, 13,  5, 10,  7, 10,  7, 10,  9,  9,
-       8, 12,  9, 11,  9, 11, 10, 10, 14, 16, 13, 14, 14, 15, 13, 12,
-       7, 12,  8, 11, 10, 12, 10, 10, 10, 13, 10, 12, 11, 13, 11, 11,
-      15, 16, 13, 15, 14, 16, 13, 13, 11, 16, 11, 13, 13, 16, 12, 12,
-      13, 16, 12, 14, 14, 16, 12, 12, 16, 16, 14, 16, 16, 16, 14, 13,
-      11, 15, 12, 14, 11, 13, 11, 12, 13, 16, 12, 14, 12, 14, 12, 12,
-      16, 16, 14, 16, 14, 16, 13, 13, 13, 16, 12, 14, 12, 14, 12, 12,
-      14, 16, 13, 15, 13, 15, 13, 13, 16, 16, 15, 16, 16, 16, 14, 13,
-      15, 16, 13, 16, 15, 16, 13, 13, 16, 16, 14, 16, 16, 16, 14, 13,
-      16, 16, 16, 16, 16, 16, 14, 13,  2,  9,  5,  8,  6,  9,  8,  9,
-       7, 11,  8, 10,  9, 11,  9, 10, 14, 16, 13, 14, 14, 15, 13, 12,
-       5, 11,  6, 10,  9, 11,  9, 10,  8, 13,  9, 11, 11, 12, 10, 11,
-      14, 16, 13, 14, 14, 16, 13, 13,  9, 15,  9, 12, 12, 14, 11, 11,
-      12, 16, 11, 13, 13, 15, 12, 12, 16, 16, 14, 15, 16, 16, 14, 13,
-       6, 11,  7, 10,  8, 11,  9, 10,  9, 13,  9, 12, 10, 12, 10, 11,
-      14, 16, 13, 14, 14, 15, 13, 13,  8, 12,  8, 11, 10, 12, 10, 11,
-       9, 13, 10, 12, 11, 13, 11, 11, 14, 16, 13, 14, 14, 16, 13, 13,
-      12, 16, 11, 13, 13, 15, 12, 12, 13, 16, 11, 13, 14, 16, 12, 12,
-      16, 16, 14, 15, 16, 16, 13, 13, 11, 15, 11, 14, 10, 13, 11, 12,
-      13, 16, 13, 15, 12, 14, 12, 12, 16, 16, 15, 16, 15, 16, 14, 13,
-      12, 16, 12, 14, 12, 14, 12, 12, 13, 16, 13, 15, 13, 14, 12, 13,
-      16, 16, 15, 16, 15, 16, 13, 13, 15, 16, 13, 16, 15, 16, 13, 13,
-      16, 16, 14, 16, 16, 16, 13, 13, 16, 16, 15, 16, 16, 16, 14, 13,
-       5, 12,  7, 10,  9, 12, 10, 10,  9, 13,  9, 12, 11, 13, 11, 11,
-      15, 16, 13, 14, 15, 15, 13, 13,  7, 13,  8, 11, 10, 13, 10, 11,
-      10, 14, 10, 12, 12, 14, 11, 12, 16, 16, 14, 15, 16, 16, 14, 13,
-      10, 16,  9, 12, 13, 15, 11, 12, 13, 16, 11, 13, 14, 16, 12, 12,
-      16, 16, 14, 16, 16, 16, 14, 13,  8, 13,  9, 12,  9, 12, 10, 11,
-      11, 15, 11, 13, 11, 13, 11, 12, 16, 16, 14, 16, 16, 16, 14, 13,
-       9, 14, 10, 12, 11, 13, 11, 12, 11, 15, 11, 13, 12, 14, 12, 12,
-      16, 16, 14, 16, 15, 16, 14, 13, 12, 16, 11, 14, 14, 16, 12, 12,
-      13, 16, 12, 14, 14, 16, 13, 13, 16, 16, 13, 15, 16, 16, 14, 13,
-      11, 16, 12, 14, 10, 13, 12, 12, 13, 16, 13, 15, 12, 14, 12, 13,
-      16, 16, 16, 16, 16, 16, 14, 14, 13, 16, 13, 15, 12, 15, 12, 13,
-      13, 16, 13, 15, 12, 15, 13, 13, 16, 16, 15, 16, 14, 16, 14, 13,
-      16, 16, 14, 16, 16, 16, 14, 13, 15, 16, 14, 16, 15, 16, 14, 13,
-      16, 16, 14, 16, 15, 16, 13, 12,  8, 14,  9, 12, 10, 14, 11, 12,
-      11, 16, 10, 13, 12, 14, 12, 12, 16, 16, 14, 15, 15, 16, 14, 13,
-       9, 15,  9, 12, 12, 14, 11, 12, 12, 16, 11, 13, 13, 15, 12, 12,
-      16, 16, 14, 15, 16, 16, 14, 13, 11, 16,  9, 12, 13, 15, 11, 11,
-      13, 16, 11, 13, 14, 16, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
-       9, 15, 10, 13, 11, 14, 11, 12, 12, 16, 11, 14, 12, 14, 12, 12,
-      16, 16, 14, 16, 16, 16, 14, 13, 10, 16, 10, 13, 12, 15, 12, 12,
-      12, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 16, 16, 16, 14, 13,
-      12, 16, 11, 13, 13, 16, 12, 12, 13, 16, 11, 13, 14, 16, 12, 12,
-      16, 16, 13, 14, 16, 16, 13, 12, 11, 16, 12, 14, 10, 13, 11, 12,
-      13, 16, 13, 15, 12, 14, 12, 12, 16, 16, 16, 16, 15, 16, 13, 12,
-      12, 16, 12, 15, 12, 14, 12, 12, 13, 16, 13, 15, 12, 14, 12, 12,
-      16, 16, 15, 16, 14, 15, 13, 12, 14, 16, 13, 14, 13, 16, 12, 12,
-      13, 16, 12, 14, 13, 15, 12, 12, 14, 16, 12, 13, 13, 14, 11, 10,
-    },
-  },
-  {
-    {
-       0,  7,  4,  7,  5,  7,  6,  6,  6, 10,  7,  8,  8,  9,  8,  8,
-      13, 14, 11, 12, 12, 12, 11, 10,  5,  9,  6,  8,  7,  9,  7,  7,
-       8, 11,  8,  9,  9, 10,  9,  8, 13, 16, 12, 12, 13, 13, 11, 10,
-      10, 14,  8, 10, 11, 13,  9,  9, 12, 15, 10, 11, 12, 13, 10, 10,
-      16, 16, 12, 13, 14, 14, 11, 10,  5, 10,  7,  9,  6,  9,  8,  8,
-       8, 11,  9, 10,  9, 10,  9,  8, 14, 16, 12, 12, 13, 13, 11, 10,
-       8, 12,  8, 10,  9, 10,  9,  9, 10, 13,  9, 11, 10, 11,  9,  9,
-      14, 16, 12, 13, 13, 13, 11, 10, 12, 16, 10, 12, 12, 13, 10, 10,
-      13, 16, 11, 12, 13, 14, 11, 10, 16, 16, 12, 13, 14, 14, 11, 10,
-      10, 14, 11, 13,  9, 11, 10, 10, 12, 16, 12, 13, 11, 12, 11, 10,
-      16, 16, 13, 14, 13, 13, 12, 10, 12, 16, 12, 13, 11, 13, 11, 10,
-      13, 16, 12, 13, 12, 13, 11, 10, 16, 16, 13, 14, 13, 14, 12, 10,
-      14, 16, 13, 14, 13, 14, 12, 11, 16, 16, 13, 14, 14, 15, 12, 11,
-      16, 16, 13, 14, 14, 14, 11, 10,  3,  9,  5,  8,  6,  9,  7,  7,
-       8, 11,  8, 10,  9, 10,  9,  8, 14, 15, 12, 12, 13, 13, 11, 10,
-       6, 11,  6,  9,  8, 10,  8,  8,  9, 12,  9, 10, 10, 11,  9,  9,
-      14, 16, 12, 13, 13, 13, 11, 10, 10, 14,  8, 11, 12, 13,  9,  9,
-      12, 16, 10, 11, 12, 13, 10, 10, 16, 16, 12, 13, 14, 14, 11, 10,
-       6, 11,  8, 10,  7, 10,  8,  8,  9, 12, 10, 11,  9, 11,  9,  9,
-      14, 16, 12, 13, 13, 13, 12, 10,  9, 12,  9, 11,  9, 11,  9,  9,
-      10, 13, 10, 11, 10, 12, 10,  9, 14, 16, 12, 13, 13, 13, 11, 10,
-      12, 16, 10, 12, 12, 14, 10, 10, 13, 16, 10, 12, 13, 14, 11, 10,
-      16, 16, 12, 13, 14, 14, 11, 10, 10, 15, 11, 13,  9, 11, 10, 10,
-      12, 16, 12, 13, 11, 12, 11, 10, 16, 16, 14, 14, 13, 14, 12, 10,
-      12, 16, 12, 13, 11, 13, 11, 10, 13, 16, 12, 13, 11, 13, 11, 10,
-      16, 16, 13, 14, 13, 13, 12, 10, 14, 16, 13, 14, 14, 14, 11, 11,
-      15, 16, 13, 14, 13, 14, 11, 10, 16, 16, 13, 13, 13, 14, 11,  9,
-       7, 12,  8, 11,  9, 11,  9, 10, 10, 14, 10, 12, 11, 12, 11, 10,
-      16, 16, 13, 13, 14, 14, 12, 11,  9, 13,  9, 11, 10, 12, 10, 10,
-      11, 15, 10, 12, 12, 13, 11, 10, 16, 16, 13, 14, 14, 14, 12, 11,
-      11, 16,  9, 11, 12, 14, 10, 10, 13, 16, 10, 12, 13, 14, 11, 10,
-      16, 16, 13, 14, 16, 16, 12, 11,  9, 13, 10, 12,  9, 12, 10, 10,
-      11, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 14, 14, 14, 13, 11,
-      10, 14, 10, 12, 11, 13, 11, 10, 12, 16, 11, 13, 12, 13, 11, 11,
-      16, 16, 13, 14, 14, 14, 12, 11, 13, 16, 11, 13, 13, 14, 11, 11,
-      13, 16, 11, 13, 13, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 10,
-      11, 16, 12, 14, 10, 12, 11, 10, 13, 16, 13, 14, 11, 13, 11, 11,
-      16, 16, 15, 16, 14, 14, 13, 11, 13, 16, 13, 14, 12, 13, 11, 11,
-      13, 16, 13, 14, 12, 13, 11, 11, 16, 16, 14, 14, 13, 14, 12, 11,
-      15, 16, 13, 14, 14, 16, 12, 11, 14, 16, 13, 14, 13, 14, 12, 11,
-      16, 16, 12, 13, 13, 14, 11,  9,  9, 14, 10, 12, 10, 13, 11, 11,
-      12, 16, 12, 13, 12, 14, 12, 11, 16, 16, 14, 14, 14, 14, 13, 11,
-      10, 16, 10, 13, 12, 14, 11, 11, 13, 16, 12, 13, 13, 14, 12, 11,
-      16, 16, 14, 14, 15, 15, 13, 11, 12, 16,  9, 12, 13, 14, 10, 10,
-      14, 16, 11, 12, 13, 15, 11, 10, 16, 16, 13, 13, 15, 16, 11, 10,
-      10, 16, 11, 13, 11, 13, 11, 11, 13, 16, 12, 14, 12, 14, 12, 11,
-      16, 16, 14, 14, 14, 14, 13, 11, 11, 16, 11, 13, 12, 14, 11, 11,
-      13, 16, 12, 14, 13, 14, 12, 11, 16, 16, 14, 14, 14, 15, 13, 11,
-      13, 16, 11, 13, 13, 14, 11, 10, 14, 16, 11, 13, 13, 14, 11, 10,
-      16, 16, 12, 13, 14, 15, 11,  9, 12, 16, 12, 14, 10, 13, 11, 10,
-      14, 16, 13, 14, 11, 13, 11, 10, 16, 16, 14, 15, 13, 14, 12, 10,
-      13, 16, 13, 14, 11, 13, 11, 10, 14, 16, 13, 14, 12, 13, 11, 10,
-      16, 16, 14, 14, 13, 13, 11, 10, 14, 16, 12, 13, 13, 14, 11,  9,
-      14, 16, 12, 13, 12, 13, 10,  9, 14, 16, 11, 11, 12, 12,  9,  7,
-    },
-    {
-       0,  7,  3,  8,  5,  8,  7,  9,  5, 10,  7, 10,  8, 11, 10, 10,
-      14, 16, 14, 15, 14, 16, 14, 14,  4, 10,  6, 10,  8, 11,  9, 10,
-       8, 12,  9, 11, 10, 12, 11, 11, 15, 16, 14, 16, 15, 16, 14, 14,
-      10, 16, 10, 13, 13, 16, 12, 13, 13, 16, 12, 14, 14, 16, 13, 13,
-      16, 16, 16, 16, 16, 16, 14, 15,  4, 10,  7, 10,  7, 10,  9, 10,
-       8, 12,  9, 12, 10, 12, 11, 12, 14, 16, 14, 16, 15, 16, 14, 14,
-       8, 12,  9, 12, 10, 13, 11, 12, 10, 14, 11, 13, 11, 14, 12, 13,
-      16, 16, 14, 16, 16, 16, 14, 15, 12, 16, 12, 14, 14, 16, 13, 14,
-      14, 16, 13, 16, 16, 16, 14, 14, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 12, 16, 11, 14, 13, 13, 13, 16, 13, 16, 13, 15, 13, 14,
-      16, 16, 16, 16, 16, 16, 15, 16, 13, 16, 13, 16, 13, 16, 13, 14,
-      14, 16, 14, 16, 14, 16, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  2,  9,  5,  9,  6, 10,  8, 10,
-       7, 11,  8, 11,  9, 12, 10, 11, 14, 16, 14, 16, 15, 16, 14, 14,
-       5, 11,  6, 10,  9, 12, 10, 11,  9, 13,  9, 12, 11, 13, 11, 12,
-      16, 16, 14, 16, 16, 16, 14, 14, 10, 16,  9, 13, 13, 16, 12, 13,
-      13, 16, 12, 14, 14, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 14,
-       5, 11,  8, 11,  7, 11, 10, 11,  9, 13, 10, 13, 10, 13, 11, 12,
-      16, 16, 14, 16, 16, 16, 14, 14,  8, 13,  9, 12, 10, 13, 11, 12,
-      10, 14, 10, 13, 11, 14, 12, 12, 16, 16, 14, 16, 15, 16, 14, 14,
-      12, 16, 12, 14, 14, 16, 13, 14, 14, 16, 12, 16, 15, 16, 13, 14,
-      16, 16, 15, 16, 16, 16, 15, 15, 11, 16, 12, 16, 10, 14, 12, 13,
-      13, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 15, 16,
-      13, 16, 13, 16, 13, 16, 13, 14, 14, 16, 14, 16, 13, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16, 15, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16,
-       5, 13,  7, 12,  9, 13, 11, 12, 10, 14, 10, 13, 11, 13, 12, 13,
-      16, 16, 16, 16, 16, 16, 16, 15,  7, 14,  8, 12, 11, 14, 11, 12,
-      11, 16, 11, 13, 13, 16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 10, 14, 14, 16, 12, 13, 13, 16, 12, 15, 16, 16, 14, 14,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 14, 10, 13,  9, 13, 11, 12,
-      11, 16, 12, 14, 12, 14, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 11, 14, 12, 14, 12, 13, 11, 16, 12, 14, 12, 15, 13, 13,
-      16, 16, 15, 16, 16, 16, 15, 16, 13, 16, 12, 16, 15, 16, 14, 14,
-      13, 16, 12, 16, 16, 16, 14, 14, 16, 16, 14, 16, 16, 16, 14, 16,
-      11, 16, 13, 16, 10, 14, 12, 13, 14, 16, 14, 16, 13, 16, 14, 14,
-      16, 16, 16, 16, 16, 16, 16, 16, 13, 16, 14, 16, 13, 16, 14, 15,
-      13, 16, 14, 16, 13, 16, 14, 15, 16, 16, 16, 16, 15, 16, 15, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 15, 16,
-      16, 16, 15, 16, 16, 16, 14, 14,  8, 16, 10, 14, 11, 16, 12, 13,
-      12, 16, 12, 14, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 14,
-      10, 16, 10, 14, 12, 16, 12, 13, 13, 16, 12, 15, 14, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 16, 15, 11, 16, 10, 13, 13, 16, 12, 13,
-      14, 16, 12, 14, 15, 16, 13, 13, 16, 16, 16, 16, 16, 16, 15, 14,
-      10, 16, 11, 14, 11, 16, 12, 13, 13, 16, 13, 16, 13, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 16, 15, 11, 16, 12, 14, 13, 16, 13, 14,
-      13, 16, 13, 16, 14, 16, 13, 14, 16, 16, 16, 16, 16, 16, 16, 15,
-      13, 16, 12, 14, 14, 16, 13, 13, 13, 16, 12, 15, 14, 16, 13, 13,
-      16, 16, 14, 16, 16, 16, 14, 13, 11, 16, 12, 16, 11, 15, 12, 13,
-      14, 16, 14, 16, 13, 16, 13, 14, 16, 16, 16, 16, 16, 16, 14, 14,
-      12, 16, 13, 16, 12, 16, 13, 14, 13, 16, 14, 16, 13, 16, 13, 14,
-      16, 16, 16, 16, 14, 16, 14, 14, 14, 16, 13, 16, 14, 16, 13, 13,
-      13, 16, 13, 16, 14, 16, 13, 13, 15, 16, 13, 14, 13, 15, 12, 12,
-    },
-  },
-  {
-    {
-       0,  7,  4,  6,  4,  7,  6,  7,  6,  9,  7,  8,  7,  9,  8,  8,
-      13, 14, 12, 12, 12, 13, 11, 11,  5,  9,  5,  8,  7,  9,  7,  8,
-       8, 11,  8, 10,  9, 10,  9,  9, 13, 15, 12, 13, 12, 13, 11, 11,
-       9, 14,  8, 11, 11, 13, 10, 10, 11, 15, 10, 12, 12, 13, 10, 11,
-      14, 16, 12, 13, 14, 14, 12, 11,  5,  9,  7,  9,  6,  9,  8,  8,
-       8, 11,  8, 10,  8, 10,  9,  9, 13, 16, 12, 13, 13, 13, 11, 11,
-       7, 11,  8, 10,  9, 11,  9,  9,  9, 13,  9, 11, 10, 11, 10, 10,
-      14, 16, 12, 13, 13, 13, 12, 11, 11, 16, 10, 12, 12, 14, 11, 11,
-      13, 16, 11, 13, 13, 14, 11, 11, 16, 16, 13, 14, 14, 15, 12, 11,
-      10, 15, 11, 13,  9, 12, 10, 10, 12, 16, 12, 13, 11, 12, 11, 11,
-      15, 16, 13, 14, 13, 14, 12, 11, 12, 16, 12, 14, 11, 13, 11, 11,
-      13, 16, 12, 14, 12, 13, 12, 11, 16, 16, 13, 14, 14, 14, 12, 11,
-      14, 16, 13, 14, 14, 15, 12, 12, 16, 16, 13, 14, 14, 16, 12, 12,
-      16, 16, 14, 14, 14, 15, 12, 11,  3,  9,  5,  8,  6,  9,  7,  8,
-       7, 11,  8, 10,  9, 10,  9,  9, 13, 14, 12, 13, 13, 13, 12, 11,
-       6, 11,  6,  9,  8, 10,  8,  9,  9, 12,  8, 10, 10, 11,  9, 10,
-      14, 16, 12, 13, 13, 14, 12, 11,  9, 14,  8, 11, 11, 13, 10, 10,
-      12, 16, 10, 12, 12, 14, 11, 11, 16, 16, 12, 13, 14, 15, 12, 11,
-       6, 11,  8, 10,  7, 10,  8,  9,  9, 12,  9, 11,  9, 11, 10, 10,
-      14, 16, 13, 13, 13, 14, 12, 11,  8, 12,  9, 11,  9, 11,  9, 10,
-      10, 13,  9, 11, 10, 12, 10, 10, 14, 16, 12, 13, 13, 14, 12, 11,
-      12, 16, 10, 12, 12, 14, 11, 11, 12, 16, 10, 12, 13, 14, 11, 11,
-      15, 16, 12, 13, 14, 14, 11, 11, 10, 15, 11, 13,  9, 12, 10, 10,
-      12, 16, 12, 14, 11, 13, 11, 11, 16, 16, 14, 14, 14, 14, 12, 11,
-      12, 16, 12, 14, 11, 13, 11, 11, 13, 16, 12, 14, 11, 13, 11, 11,
-      16, 16, 13, 14, 13, 14, 12, 11, 14, 16, 13, 14, 14, 15, 12, 11,
-      14, 16, 13, 14, 13, 15, 12, 11, 16, 16, 13, 14, 13, 14, 11, 10,
-       6, 13,  8, 11,  9, 12, 10, 10, 10, 14, 10, 12, 11, 13, 11, 11,
-      16, 16, 13, 14, 14, 14, 13, 12,  8, 14,  8, 12, 10, 13, 10, 11,
-      11, 15, 10, 12, 12, 13, 11, 11, 16, 16, 14, 14, 15, 16, 13, 12,
-      11, 16,  9, 12, 12, 14, 11, 11, 13, 16, 11, 13, 13, 16, 11, 11,
-      16, 16, 13, 14, 16, 16, 13, 12,  8, 14, 10, 12,  9, 12, 10, 11,
-      11, 15, 11, 13, 11, 13, 11, 11, 16, 16, 14, 15, 14, 15, 13, 12,
-      10, 15, 10, 13, 11, 13, 11, 11, 11, 15, 11, 13, 12, 13, 11, 11,
-      16, 16, 13, 15, 14, 15, 13, 12, 12, 16, 11, 13, 13, 15, 11, 11,
-      13, 16, 11, 13, 13, 15, 11, 11, 16, 16, 12, 14, 14, 16, 12, 11,
-      11, 16, 12, 14, 10, 13, 11, 11, 13, 16, 13, 15, 12, 14, 12, 12,
-      16, 16, 15, 16, 14, 15, 13, 12, 12, 16, 13, 14, 12, 14, 12, 12,
-      13, 16, 13, 14, 12, 14, 12, 12, 16, 16, 14, 15, 13, 14, 12, 12,
-      15, 16, 13, 15, 14, 16, 12, 12, 14, 16, 13, 14, 13, 15, 12, 12,
-      15, 16, 12, 13, 13, 14, 11, 10,  9, 15, 10, 13, 11, 14, 11, 12,
-      12, 16, 12, 14, 12, 14, 12, 12, 16, 16, 14, 14, 14, 15, 13, 12,
-      10, 16, 10, 13, 12, 14, 12, 12, 13, 16, 12, 14, 13, 15, 12, 12,
-      16, 16, 14, 14, 15, 16, 13, 12, 11, 16,  9, 12, 13, 15, 11, 11,
-      14, 16, 11, 13, 14, 16, 11, 11, 16, 16, 13, 14, 16, 16, 12, 11,
-      10, 16, 11, 14, 11, 14, 12, 12, 13, 16, 13, 14, 12, 14, 12, 12,
-      16, 16, 14, 15, 15, 15, 13, 12, 11, 16, 12, 14, 12, 15, 12, 12,
-      13, 16, 12, 14, 13, 15, 12, 12, 16, 16, 14, 15, 15, 16, 13, 12,
-      12, 16, 11, 13, 13, 15, 11, 11, 13, 16, 11, 13, 13, 15, 11, 11,
-      16, 16, 12, 13, 14, 16, 12, 10, 11, 16, 12, 14, 10, 13, 11, 11,
-      14, 16, 13, 14, 12, 14, 11, 11, 16, 16, 15, 16, 14, 14, 12, 11,
-      12, 16, 13, 14, 11, 14, 11, 11, 13, 16, 13, 14, 12, 14, 11, 11,
-      16, 16, 14, 15, 13, 14, 12, 11, 14, 16, 12, 14, 13, 14, 11, 10,
-      13, 16, 12, 13, 12, 14, 11, 10, 14, 16, 11, 12, 12, 12, 10,  8,
-    },
-    {
-       0,  8,  4,  9,  5,  9,  8, 10,  6, 11,  8, 11,  9, 12, 11, 12,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 11,  6, 11,  9, 12, 10, 12,
-       9, 13, 10, 13, 11, 16, 12, 13, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 11, 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 11,  8, 12,  7, 12, 10, 12,
-       8, 13, 10, 13, 10, 13, 12, 14, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 13, 10, 14, 11, 16, 12, 14, 11, 16, 12, 16, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 14, 16, 12, 16, 16, 16, 13, 16, 16, 16, 14, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  1, 10,  5, 10,  7, 11,  9, 11,
-       8, 12,  9, 12, 10, 13, 12, 13, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 12,  7, 12, 10, 13, 11, 12,  9, 16, 10, 13, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 14, 16,
-      14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       6, 12,  9, 13,  8, 12, 11, 13, 10, 16, 11, 16, 11, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 10, 14, 11, 16, 12, 16,
-      10, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 14, 16, 11, 16, 14, 16,
-      16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       6, 16,  9, 13, 10, 16, 12, 14, 11, 16, 12, 16, 12, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16,  9, 14, 12, 16, 13, 16,
-      12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 10, 16, 16, 16, 14, 16, 16, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16, 11, 16, 10, 16, 12, 16,
-      12, 16, 13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 13, 16, 14, 16, 11, 16, 13, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 13, 16, 16, 16, 16, 16,
-      14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 11, 16, 14, 16, 16, 16, 16, 16, 14, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16, 11, 16, 12, 16, 13, 16,
-      13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 11, 16, 13, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 13, 16,
-      16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 12, 16, 13, 16, 13, 16, 16, 16, 14, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 14, 16, 16, 16,
-      13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      13, 16, 12, 16, 16, 16, 14, 16, 14, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 11, 16, 13, 16,
-      16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 14, 15,
-    },
-  },
-  {
-    {
-       0,  7,  3,  7,  4,  7,  6,  7,  6,  9,  7,  9,  7,  9,  8,  9,
-      13, 14, 12, 13, 13, 13, 12, 12,  4,  9,  5,  9,  7,  9,  8,  9,
-       7, 11,  8, 10,  9, 11,  9, 10, 13, 16, 12, 14, 13, 14, 12, 12,
-       9, 14,  8, 12, 12, 14, 10, 11, 11, 16, 10, 13, 13, 14, 11, 12,
-      15, 16, 13, 14, 14, 16, 12, 12,  5, 10,  7,  9,  6,  9,  8,  9,
-       8, 11,  8, 11,  8, 10,  9, 10, 14, 16, 12, 14, 13, 14, 12, 12,
-       7, 12,  8, 11,  9, 11,  9, 10,  9, 13,  9, 12, 10, 12, 10, 11,
-      14, 16, 12, 14, 13, 14, 12, 12, 12, 16, 11, 13, 13, 15, 11, 12,
-      13, 16, 11, 14, 13, 15, 12, 12, 15, 16, 13, 15, 14, 16, 13, 13,
-      10, 15, 12, 14,  9, 13, 11, 12, 12, 16, 12, 14, 11, 13, 12, 12,
-      15, 16, 13, 15, 14, 15, 13, 13, 12, 16, 12, 14, 12, 14, 12, 12,
-      13, 16, 13, 14, 12, 14, 12, 12, 16, 16, 14, 15, 14, 16, 13, 13,
-      15, 16, 13, 15, 14, 16, 12, 13, 16, 16, 14, 16, 14, 16, 13, 13,
-      16, 16, 14, 16, 15, 16, 13, 13,  3,  9,  5,  9,  6,  9,  8,  9,
-       7, 11,  8, 10,  9, 11,  9, 10, 14, 15, 13, 14, 13, 14, 12, 12,
-       5, 11,  6, 10,  8, 11,  9, 10,  9, 12,  9, 11, 10, 12, 10, 11,
-      14, 16, 13, 14, 14, 15, 13, 13,  9, 15,  8, 12, 12, 14, 10, 11,
-      12, 16, 10, 13, 13, 15, 11, 12, 15, 16, 13, 14, 14, 16, 13, 13,
-       6, 11,  8, 11,  7, 10,  9, 10,  9, 13, 10, 12,  9, 12, 10, 11,
-      14, 16, 13, 14, 14, 14, 13, 13,  8, 13,  9, 12,  9, 12, 10, 11,
-       9, 13,  9, 12, 10, 12, 10, 11, 14, 16, 12, 14, 13, 14, 12, 12,
-      12, 16, 11, 13, 13, 15, 11, 12, 12, 16, 11, 13, 13, 15, 11, 12,
-      14, 16, 12, 14, 14, 15, 12, 12, 10, 15, 11, 14,  9, 13, 11, 12,
-      12, 16, 12, 14, 11, 14, 12, 12, 16, 16, 14, 16, 14, 15, 13, 13,
-      12, 16, 12, 14, 11, 14, 12, 12, 12, 16, 13, 14, 11, 14, 12, 12,
-      15, 16, 14, 15, 13, 15, 12, 13, 14, 16, 13, 15, 14, 16, 13, 13,
-      14, 16, 13, 15, 14, 16, 12, 13, 15, 16, 13, 15, 13, 15, 12, 12,
-       6, 13,  8, 12,  9, 12, 10, 11, 10, 14, 11, 13, 11, 13, 12, 12,
-      15, 16, 14, 15, 15, 15, 14, 13,  8, 14,  9, 12, 11, 13, 11, 12,
-      11, 15, 11, 13, 12, 14, 12, 12, 16, 16, 14, 15, 15, 16, 14, 14,
-      10, 16,  9, 13, 12, 15, 11, 12, 13, 16, 11, 14, 13, 16, 12, 12,
-      16, 16, 14, 15, 16, 16, 13, 13,  8, 14, 10, 13,  9, 13, 11, 12,
-      11, 15, 12, 14, 11, 14, 12, 12, 16, 16, 15, 16, 15, 16, 14, 14,
-      10, 15, 10, 13, 11, 14, 11, 12, 11, 15, 11, 14, 12, 14, 12, 12,
-      15, 16, 14, 15, 14, 16, 13, 13, 12, 16, 11, 14, 13, 16, 12, 12,
-      12, 16, 11, 14, 13, 15, 12, 12, 15, 16, 12, 14, 15, 16, 13, 13,
-      11, 16, 12, 14, 10, 14, 11, 12, 13, 16, 13, 16, 12, 14, 12, 13,
-      16, 16, 16, 16, 15, 16, 14, 13, 12, 16, 13, 15, 12, 14, 12, 13,
-      13, 16, 13, 15, 12, 14, 12, 13, 16, 16, 14, 16, 13, 15, 13, 13,
-      15, 16, 14, 16, 14, 16, 13, 13, 14, 16, 13, 15, 13, 16, 13, 13,
-      14, 16, 12, 14, 13, 14, 12, 12,  9, 16, 11, 14, 11, 15, 12, 13,
-      13, 16, 12, 14, 12, 15, 13, 13, 16, 16, 14, 15, 15, 15, 14, 13,
-      11, 16, 11, 14, 12, 16, 12, 13, 13, 16, 12, 14, 13, 16, 13, 13,
-      16, 16, 14, 15, 16, 16, 14, 13, 11, 16, 10, 13, 13, 16, 11, 12,
-      14, 16, 11, 14, 14, 16, 12, 12, 16, 16, 14, 14, 16, 16, 13, 12,
-      11, 16, 12, 14, 11, 15, 12, 13, 13, 16, 13, 15, 13, 16, 13, 13,
-      16, 16, 15, 16, 15, 16, 14, 13, 11, 16, 12, 15, 12, 16, 12, 13,
-      13, 16, 13, 15, 13, 16, 13, 13, 16, 16, 15, 16, 15, 16, 14, 13,
-      12, 16, 11, 14, 13, 16, 12, 12, 13, 16, 11, 14, 13, 16, 12, 12,
-      16, 16, 13, 14, 15, 16, 12, 12, 11, 16, 12, 14, 10, 14, 11, 12,
-      14, 16, 13, 15, 12, 15, 12, 12, 16, 16, 16, 16, 14, 15, 13, 12,
-      12, 16, 13, 15, 12, 14, 12, 12, 13, 16, 13, 15, 12, 14, 12, 12,
-      16, 16, 14, 16, 14, 15, 12, 12, 14, 16, 13, 15, 13, 16, 11, 12,
-      13, 16, 12, 14, 13, 15, 11, 11, 14, 16, 12, 13, 12, 13, 11, 10,
-    },
-    {
-       0,  8,  4,  9,  5, 10,  9, 11,  5, 11,  9, 12,  9, 13, 12, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 11,  6, 12,  9, 13, 11, 13,
-       9, 16, 10, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 12,  8, 13,  7, 12, 11, 16,
-       8, 16, 11, 16, 11, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 10, 16, 11, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  1, 10,  6, 11,  7, 12, 10, 13,
-       7, 12, 10, 13, 10, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 13,  7, 12, 10, 16, 12, 16, 10, 16, 11, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 16, 16,
-      16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 13,  9, 16,  8, 16, 12, 16,  9, 16, 12, 16, 11, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 11, 16, 12, 16, 13, 16,
-      10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       6, 16,  9, 16, 10, 16, 13, 16, 11, 16, 12, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16,  9, 16, 12, 16, 13, 16,
-      12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 10, 16, 16, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16, 11, 16, 11, 16, 13, 16,
-      12, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 13, 16, 16, 16, 11, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  7, 16, 11, 16, 12, 16, 16, 16,
-      13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 11, 16, 13, 16, 16, 16, 16, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 10, 16, 16, 16, 16, 16,
-      16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      13, 16, 16, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  7,  4,  8,  4,  8,  7,  8,  6, 10,  7, 10,  8, 10,  9, 10,
-      13, 16, 13, 15, 13, 15, 13, 14,  4, 10,  5, 10,  7, 10,  9, 10,
-       7, 12,  8, 11,  9, 12, 10, 11, 13, 16, 13, 15, 13, 16, 13, 14,
-       9, 16,  9, 13, 12, 16, 11, 13, 11, 16, 11, 14, 13, 16, 12, 14,
-      15, 16, 14, 16, 15, 16, 14, 14,  4, 10,  7, 10,  6, 10,  9, 10,
-       8, 12,  9, 12,  9, 11, 10, 12, 13, 16, 13, 16, 14, 16, 13, 14,
-       7, 12,  8, 12,  9, 12, 10, 12,  9, 13, 10, 13, 10, 13, 11, 12,
-      14, 16, 13, 16, 14, 16, 13, 14, 12, 16, 11, 14, 13, 16, 12, 14,
-      13, 16, 12, 16, 14, 16, 13, 14, 16, 16, 14, 16, 15, 16, 14, 14,
-      10, 16, 12, 15, 10, 14, 12, 13, 12, 16, 13, 16, 12, 14, 13, 14,
-      15, 16, 14, 16, 14, 16, 14, 14, 12, 16, 13, 16, 12, 16, 13, 14,
-      13, 16, 13, 16, 13, 16, 13, 14, 16, 16, 14, 16, 15, 16, 14, 15,
-      15, 16, 14, 16, 15, 16, 13, 15, 16, 16, 14, 16, 15, 16, 14, 15,
-      16, 16, 16, 16, 16, 16, 15, 15,  2,  9,  5, 10,  6, 10,  8, 10,
-       7, 11,  8, 11,  9, 11, 10, 11, 14, 16, 13, 15, 14, 15, 14, 14,
-       5, 11,  6, 11,  8, 12,  9, 11,  8, 13,  9, 12, 10, 13, 11, 12,
-      14, 16, 13, 15, 14, 16, 14, 14,  9, 16,  8, 13, 12, 16, 11, 13,
-      12, 16, 11, 14, 13, 16, 12, 13, 16, 16, 14, 16, 15, 16, 14, 15,
-       5, 12,  8, 11,  7, 11,  9, 11,  9, 13, 10, 13, 10, 13, 11, 12,
-      14, 16, 14, 16, 14, 16, 14, 15,  8, 13,  9, 13, 10, 13, 11, 12,
-       9, 13, 10, 13, 10, 13, 11, 13, 13, 16, 13, 15, 13, 16, 13, 14,
-      12, 16, 11, 14, 13, 16, 12, 14, 12, 16, 11, 14, 13, 16, 12, 14,
-      14, 16, 13, 16, 14, 16, 13, 14, 10, 16, 12, 15,  9, 14, 11, 13,
-      12, 16, 13, 16, 12, 15, 12, 14, 16, 16, 15, 16, 15, 16, 14, 14,
-      12, 16, 13, 16, 12, 16, 12, 14, 12, 16, 13, 16, 12, 15, 13, 14,
-      15, 16, 14, 16, 14, 16, 14, 14, 15, 16, 14, 16, 14, 16, 14, 15,
-      14, 16, 13, 16, 14, 16, 13, 14, 16, 16, 14, 16, 14, 16, 13, 14,
-       6, 14,  9, 13,  9, 14, 11, 12, 10, 14, 11, 13, 11, 14, 12, 13,
-      16, 16, 15, 16, 15, 16, 14, 15,  8, 15,  9, 13, 11, 14, 11, 13,
-      11, 16, 11, 14, 12, 15, 12, 14, 16, 16, 15, 16, 16, 16, 15, 16,
-      10, 16,  9, 14, 12, 16, 12, 13, 13, 16, 11, 15, 14, 16, 13, 14,
-      16, 16, 15, 16, 16, 16, 15, 16,  8, 15, 10, 13, 10, 14, 11, 13,
-      11, 16, 12, 14, 12, 14, 12, 14, 16, 16, 16, 16, 16, 16, 15, 16,
-      10, 16, 11, 14, 11, 15, 12, 13, 11, 16, 11, 14, 12, 15, 12, 14,
-      16, 16, 14, 16, 15, 16, 14, 15, 12, 16, 11, 15, 13, 16, 13, 14,
-      12, 16, 11, 14, 13, 16, 13, 14, 15, 16, 13, 16, 16, 16, 14, 15,
-      10, 16, 12, 15, 10, 15, 12, 13, 13, 16, 13, 16, 12, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 15, 15, 12, 16, 13, 16, 12, 16, 13, 14,
-      12, 16, 13, 16, 12, 16, 13, 14, 16, 16, 15, 16, 14, 16, 14, 15,
-      15, 16, 14, 16, 15, 16, 14, 15, 14, 16, 13, 16, 14, 16, 13, 14,
-      14, 16, 13, 15, 14, 16, 13, 14,  9, 16, 11, 16, 11, 16, 12, 14,
-      13, 16, 12, 16, 13, 16, 13, 14, 16, 16, 15, 16, 16, 16, 15, 15,
-      11, 16, 11, 16, 12, 16, 13, 14, 13, 16, 12, 16, 13, 16, 13, 14,
-      16, 16, 15, 16, 16, 16, 15, 15, 11, 16, 10, 15, 13, 16, 12, 13,
-      14, 16, 12, 16, 14, 16, 13, 14, 16, 16, 15, 16, 16, 16, 14, 14,
-      11, 16, 12, 16, 11, 16, 13, 14, 13, 16, 13, 16, 13, 16, 13, 14,
-      16, 16, 16, 16, 16, 16, 15, 15, 11, 16, 12, 16, 12, 16, 13, 14,
-      13, 16, 13, 16, 13, 16, 13, 14, 16, 16, 15, 16, 16, 16, 15, 14,
-      12, 16, 12, 15, 13, 16, 12, 14, 13, 16, 12, 16, 14, 16, 13, 14,
-      16, 16, 14, 16, 16, 16, 14, 14, 11, 16, 12, 16, 11, 16, 12, 14,
-      14, 16, 14, 16, 12, 16, 13, 14, 16, 16, 16, 16, 16, 16, 15, 14,
-      12, 16, 13, 16, 12, 16, 12, 14, 13, 16, 13, 16, 12, 16, 13, 14,
-      16, 16, 16, 16, 15, 16, 14, 14, 14, 16, 13, 16, 14, 16, 12, 14,
-      13, 16, 13, 16, 13, 16, 12, 13, 15, 16, 13, 14, 14, 15, 13, 13,
-    },
-    {
-       0,  8,  4, 10,  5, 11, 10, 16,  5, 12,  9, 16, 10, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 12,  7, 12,  9, 16, 12, 16,
-       9, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 12,  9, 16,  8, 16, 12, 16,
-       8, 16, 11, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       8, 16, 11, 16, 12, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  1, 11,  6, 12,  7, 16, 11, 16,
-       7, 16, 10, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 16,  7, 16, 10, 16, 12, 16,  9, 16, 11, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 16, 10, 16,  8, 16, 12, 16,  9, 16, 12, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 11, 16, 12, 16, 16, 16,
-      10, 16, 12, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 16,  9, 16, 10, 16, 16, 16, 11, 16, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16,  9, 16, 12, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16, 11, 16, 11, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      11, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16, 10, 16, 12, 16, 16, 16,
-      12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16,  9, 16, 16, 16, 16, 16,
-      16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      13, 16, 12, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 11, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  8,  4, 10,  5,  9,  8, 10,  6, 11,  8, 12,  8, 11, 10, 13,
-      14, 16, 14, 16, 14, 16, 16, 16,  3, 11,  5, 11,  8, 12, 10, 12,
-       7, 12,  9, 13, 10, 13, 11, 13, 14, 16, 14, 16, 16, 16, 16, 16,
-       9, 16,  9, 16, 12, 16, 12, 16, 11, 16, 11, 16, 14, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 11,  7, 12,  6, 11, 10, 12,
-       8, 13,  9, 13,  9, 13, 11, 14, 13, 16, 14, 16, 14, 16, 16, 16,
-       7, 13,  9, 13,  9, 13, 11, 13,  9, 14, 10, 16, 11, 16, 12, 16,
-      15, 16, 14, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 13, 16,
-      13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 10, 16, 13, 16, 12, 16, 13, 16, 12, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 13, 16, 14, 16,
-      13, 16, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  2, 10,  5, 11,  6, 11,  9, 11,
-       7, 12,  9, 13,  9, 13, 11, 13, 14, 16, 16, 16, 16, 16, 16, 16,
-       4, 12,  6, 12,  8, 13, 10, 13,  8, 13,  9, 13, 11, 16, 12, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16,  8, 16, 12, 16, 12, 16,
-      12, 16, 11, 16, 13, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 12,  8, 13,  7, 13, 10, 13,  8, 14, 10, 14, 10, 14, 12, 14,
-      16, 16, 16, 16, 16, 16, 16, 16,  7, 14,  9, 16, 10, 16, 11, 14,
-       8, 14, 10, 16, 11, 16, 12, 16, 13, 16, 14, 16, 16, 16, 16, 16,
-      11, 16, 11, 16, 13, 16, 13, 16, 12, 16, 12, 16, 14, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 12, 16, 10, 16, 12, 16,
-      12, 16, 13, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 13, 16, 12, 16, 14, 16, 12, 16, 13, 16, 12, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       6, 16,  8, 16,  9, 16, 11, 13, 10, 16, 11, 16, 11, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  7, 16,  9, 16, 10, 16, 12, 16,
-      11, 16, 11, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16,  9, 16, 12, 16, 13, 16, 13, 16, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  7, 16, 10, 16,  9, 16, 12, 16,
-      11, 16, 12, 16, 12, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16, 11, 16, 11, 16, 12, 16, 11, 16, 12, 16, 13, 16, 13, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 12, 16, 14, 16, 14, 16,
-      12, 16, 12, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 10, 16, 13, 16, 13, 16, 14, 16, 13, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 13, 16, 12, 16, 14, 16,
-      12, 16, 14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 11, 16, 11, 16, 13, 16,
-      12, 16, 13, 16, 13, 16, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 11, 16, 13, 16, 13, 16, 13, 16, 13, 16, 14, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 11, 16, 14, 16, 13, 16,
-      14, 16, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 12, 16, 12, 16, 13, 16, 13, 16, 13, 16, 13, 16, 14, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 12, 16, 13, 16, 14, 16,
-      13, 16, 13, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 12, 16, 14, 16, 14, 16, 14, 16, 14, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 13, 16, 11, 16, 14, 16,
-      16, 16, 16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 14, 16, 13, 16, 14, 16, 16, 16, 16, 16, 14, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       0, 10,  4, 12,  5, 16, 11, 16,  6, 16, 10, 16, 11, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  3, 16,  7, 16, 10, 16, 16, 16,
-       9, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  4, 16, 10, 16,  9, 16, 16, 16,
-       9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16, 12, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  1, 16,  6, 16,  8, 16, 16, 16,
-       8, 16, 11, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 16,  8, 16, 11, 16, 16, 16, 10, 16, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 11, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 16, 11, 16,  9, 16, 16, 16, 10, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  9, 16, 12, 16, 16, 16, 16, 16,
-      10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       5, 16,  9, 16, 11, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16, 10, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  8, 16, 16, 16, 11, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      12, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16,  6, 16, 11, 16, 15, 16, 16, 16,
-      15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-       9, 16, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16,  9, 16, 16, 16, 16, 16,
-      16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      10, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-};
-
-static const uint8_t rv34_table_inter_secondpat[NUM_INTER_TABLES][2][OTHERBLK_VLC_SIZE] = {
-  {
-    {
-       0,  4,  8,  3,  6,  8,  6,  7,  8,  4,  6,  8,  6,  7,  8,  7,
-       8,  8,  7,  8,  8,  8,  8,  8,  8,  8,  8,  3,  6,  8,  4,  6,
-       9,  7,  7,  8,  5,  7,  9,  6,  7,  9,  8,  8,  8,  7,  8,  8,
-       8,  8,  8,  8,  8,  7,  6,  8,  9,  7,  8,  9,  7,  8,  9,  7,
-       8,  9,  7,  8,  9,  8,  8,  9,  8,  8,  9,  8,  9,  9,  8,  8,
-       8,  8,  9,  9,  8,  9,  9,  7,  8,  8,  8,  9,  9,  8,  9,  9,
-       8,  8,  8,  7,  8,  8,  8,  8,  8,  7,  7,  6,
-    },
-    {
-       0,  4,  9,  3,  6,  9,  7,  8, 10,  3,  6,  9,  5,  7, 10,  9,
-       9, 10,  7,  8, 10,  8,  9, 10, 10, 10, 10,  2,  6,  9,  4,  7,
-      10,  8,  9, 10,  4,  7, 10,  6,  7, 10,  9,  9, 10,  7,  8, 10,
-       8,  9, 10, 10, 10, 10,  6,  8, 10,  7,  9, 11,  9, 10, 11,  7,
-       9, 11,  8,  9, 11, 10, 10, 11,  8,  9, 11,  9, 10, 11, 11, 11,
-      10,  8, 10, 11,  9, 10, 11,  9, 10, 11,  8, 10, 11,  9, 10, 11,
-      10, 10, 11,  8, 10, 11,  9, 10, 10, 10, 10,  9,
-    },
-  },
-  {
-    {
-       0,  4,  8,  3,  6,  8,  6,  7,  9,  4,  6,  8,  5,  7,  8,  8,
-       8,  9,  7,  7,  8,  8,  8,  8,  8,  9,  8,  3,  6,  8,  4,  6,
-       9,  7,  7,  9,  5,  6,  9,  6,  7,  9,  8,  8,  9,  7,  8,  8,
-       8,  8,  8,  8,  8,  8,  6,  8,  9,  7,  8, 10,  7,  8,  9,  7,
-       8, 10,  7,  8, 10,  8,  8,  9,  7,  8,  9,  8,  9,  9,  9,  9,
-       8,  7,  9, 10,  8,  9, 10,  8,  8,  8,  8,  9, 10,  8,  9,  9,
-       8,  8,  8,  7,  8,  8,  8,  8,  8,  8,  7,  6,
-    },
-    {
-       0,  4,  9,  3,  6, 10,  8,  9, 11,  3,  5,  9,  5,  7, 10,  9,
-      10, 11,  7,  8, 10,  9,  9, 11, 11, 11, 12,  2,  5, 10,  4,  7,
-      10,  8,  9, 11,  4,  6, 10,  6,  7, 10,  9, 10, 11,  7,  9, 10,
-       9,  9, 11, 11, 11, 11,  6,  8, 11,  7,  9, 11,  9, 10, 12,  7,
-       9, 11,  8,  9, 12, 10, 10, 12,  8, 10, 11, 10, 10, 11, 12, 11,
-      11,  8, 10, 12,  9, 11, 12, 10, 11, 12,  9, 10, 12, 10, 11, 12,
-      11, 11, 12,  9, 10, 12, 10, 10, 11, 11, 11, 10,
-    },
-  },
-  {
-    {
-       0,  4,  8,  3,  6,  9,  7,  8,  9,  4,  6,  8,  5,  7,  9,  8,
-       9,  9,  7,  8,  9,  8,  8,  9,  9,  9,  9,  2,  6,  9,  4,  6,
-       9,  7,  8, 10,  5,  7,  9,  6,  7,  9,  8,  8,  9,  7,  8,  9,
-       8,  8,  9,  9,  9,  9,  6,  8, 10,  7,  8, 10,  8,  9, 10,  6,
-       8, 10,  8,  8, 10,  9,  9, 10,  8,  9, 10,  9,  9, 10, 10, 10,
-       9,  8,  9, 10,  8,  9, 10,  8,  9, 10,  8,  9, 10,  9,  9, 10,
-       9,  9,  9,  8,  9,  9,  8,  9,  9,  9,  9,  8,
-    },
-    {
-       0,  4, 10,  3,  6, 10,  8, 10, 12,  2,  6, 10,  6,  8, 11, 10,
-      11, 12,  7,  9, 11,  9, 10, 12, 12, 13, 13,  2,  6, 10,  4,  7,
-      11,  9, 10, 13,  4,  7, 11,  7,  8, 11, 10, 11, 12,  8,  9, 12,
-      10, 10, 12, 12, 12, 13,  6,  9, 12,  8, 10, 13, 10, 12, 14,  7,
-      10, 13,  9, 10, 13, 11, 11, 13,  9, 11, 13, 11, 11, 13, 13, 13,
-      13,  9, 11, 13, 10, 12, 14, 11, 12, 14,  9, 11, 14, 11, 12, 14,
-      12, 12, 14,  9, 12, 13, 11, 12, 13, 13, 12, 12,
-    },
-  },
-  {
-    {
-       0,  4,  9,  3,  6,  9,  7,  8, 10,  3,  6,  9,  6,  7,  9,  9,
-       9, 10,  7,  8,  9,  8,  9, 10, 10, 10, 11,  2,  6,  9,  4,  7,
-      10,  7,  9, 10,  4,  7, 10,  6,  7, 10,  9,  9, 10,  7,  8, 10,
-       8,  9, 10, 10, 10, 10,  6,  8, 11,  7,  9, 11,  8, 10, 11,  6,
-       9, 11,  8,  9, 11,  9,  9, 11,  8,  9, 11,  9, 10, 11, 11, 10,
-      10,  8, 10, 11,  9, 10, 11,  9, 10, 11,  8, 10, 11,  9, 10, 11,
-      10, 10, 11,  8, 10, 11,  9, 10, 11, 10, 10, 10,
-    },
-    {
-       0,  4, 12,  3,  7, 12, 10, 11, 14,  3,  6, 12,  7,  9, 13, 12,
-      13, 14,  8, 11, 13, 11, 12, 14, 14, 14, 14,  1,  7, 12,  5,  8,
-      13, 10, 12, 14,  4,  8, 13,  8,  9, 13, 12, 13, 14,  9, 11, 14,
-      11, 12, 14, 14, 14, 14,  7, 10, 14,  9, 11, 14, 11, 13, 16,  8,
-      11, 14, 10, 12, 14, 13, 13, 16, 10, 12, 15, 12, 13, 15, 15, 15,
-      15, 10, 13, 15, 12, 13, 14, 13, 15, 15, 10, 13, 15, 12, 13, 15,
-      13, 14, 15, 10, 13, 14, 12, 13, 14, 14, 14, 14,
-    },
-  },
-  {
-    {
-       0,  4,  9,  3,  6, 10,  7,  9, 11,  3,  5,  9,  5,  7, 10,  9,
-      10, 12,  7,  8, 10,  9, 10, 11, 11, 12, 12,  2,  6, 10,  4,  7,
-      10,  7,  9, 12,  4,  7, 10,  6,  7, 11,  9, 10, 12,  7,  9, 11,
-       9,  9, 11, 11, 11, 12,  5,  8, 11,  7,  9, 12,  9, 10, 13,  6,
-       9, 12,  8,  9, 12, 10, 10, 12,  8, 10, 12, 10, 10, 12, 12, 12,
-      12,  8, 10, 12,  9, 11, 13, 10, 11, 13,  9, 11, 13, 10, 11, 13,
-      11, 11, 13,  9, 11, 12, 10, 11, 12, 11, 11, 12,
-    },
-    {
-       0,  4, 12,  3,  7, 13, 10, 12, 15,  3,  7, 13,  7,  9, 14, 12,
-      12, 13,  8, 11, 14, 11, 13, 15, 15, 14, 14,  1,  6, 13,  5,  8,
-      13, 10, 13, 15,  4,  8, 13,  8,  9, 14, 13, 13, 15,  8, 11, 14,
-      12, 12, 15, 15, 14, 14,  7, 10, 13,  9, 11, 13, 12, 14, 16,  8,
-      11, 14, 10, 12, 15, 13, 13, 16, 10, 12, 15, 12, 13, 15, 15, 14,
-      15, 11, 12, 14, 12, 14, 14, 13, 15, 15, 10, 12, 14, 12, 13, 15,
-      14, 15, 15, 10, 13, 13, 12, 13, 15, 14, 14, 15,
-    },
-  },
-  {
-    {
-       0,  5, 10,  3,  7, 11,  9, 11, 14,  3,  7, 11,  7,  8, 12, 11,
-      12, 14,  7,  9, 12, 10, 11, 14, 13, 14, 16,  1,  7, 11,  5,  8,
-      12,  9, 11, 15,  4,  8, 12,  7,  9, 13, 11, 12, 15,  8, 10, 13,
-      10, 11, 14, 14, 14, 16,  6,  9, 13,  8, 11, 14, 10, 13, 16,  7,
-      10, 14,  9, 11, 15, 12, 13, 16,  9, 11, 15, 12, 12, 15, 14, 14,
-      16, 10, 12, 14, 11, 13, 15, 12, 14, 16, 10, 12, 15, 11, 13, 16,
-      13, 14, 16, 10, 13, 16, 12, 13, 15, 14, 15, 16,
-    },
-    {
-       0,  5, 16,  3,  8, 14, 11, 13, 14,  2,  8, 14,  8, 10, 16, 13,
-      13, 14,  9, 13, 16, 12, 13, 16, 16, 14, 16,  1,  7, 14,  6, 10,
-      14, 12, 16, 16,  5,  9, 14,  9, 11, 16, 15, 16, 16, 10, 12, 16,
-      13, 13, 16, 16, 14, 16,  8, 11, 14, 11, 13, 14, 14, 14, 16,  8,
-      12, 14, 11, 13, 16, 16, 16, 16, 10, 12, 15, 13, 14, 16, 16, 16,
-      16, 11, 14, 14, 14, 15, 16, 16, 15, 16, 10, 13, 16, 13, 14, 14,
-      16, 16, 16, 10, 13, 16, 13, 14, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  5, 11,  3,  7, 13,  9, 12, 16,  3,  7, 12,  6,  9, 14, 11,
-      13, 16,  7, 10, 16, 11, 12, 16, 16, 16, 16,  1,  6, 12,  5,  9,
-      16,  9, 13, 16,  4,  8, 16,  7, 10, 16, 12, 15, 16,  7, 11, 16,
-      11, 12, 16, 16, 16, 16,  6, 10, 15,  8, 11, 16, 11, 14, 16,  7,
-      11, 16, 10, 12, 16, 13, 16, 16,  9, 13, 16, 13, 14, 16, 16, 16,
-      16, 10, 12, 16, 12, 16, 16, 16, 16, 16, 11, 13, 16, 13, 16, 16,
-      16, 16, 16, 12, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       0,  5, 16,  3,  8, 16, 12, 12, 16,  2,  8, 16,  8, 10, 16, 13,
-      13, 16,  9, 13, 16, 12, 13, 16, 16, 16, 16,  1,  8, 16,  6, 10,
-      16, 12, 16, 16,  5,  9, 16,  9, 11, 16, 13, 16, 16,  9, 12, 14,
-      12, 12, 16, 16, 16, 16,  8, 11, 13, 11, 12, 16, 14, 16, 16,  8,
-      12, 16, 11, 13, 16, 16, 15, 16,  9, 13, 14, 12, 13, 16, 16, 16,
-      16, 10, 12, 13, 14, 13, 16, 16, 16, 16,  9, 13, 16, 13, 12, 16,
-      16, 16, 16, 10, 12, 16, 14, 15, 16, 16, 16, 16,
-    },
-  },
-};
-
-static const uint8_t rv34_table_inter_thirdpat[NUM_INTER_TABLES][2][OTHERBLK_VLC_SIZE] = {
-  {
-    {
-       0,  5,  8,  3,  6,  9,  6,  7,  9,  4,  6,  9,  6,  7,  9,  8,
-       8,  9,  7,  8,  9,  8,  9,  9,  9,  9,  9,  2,  6,  9,  4,  7,
-       9,  7,  8,  9,  5,  7,  9,  6,  7,  9,  8,  8,  9,  7,  8,  9,
-       8,  9,  9,  9,  9,  8,  5,  8, 10,  6,  8, 10,  8,  9,  9,  7,
-       8, 10,  7,  9, 10,  8,  9,  9,  8,  9, 10,  9,  9, 10,  9,  9,
-       9,  7,  9, 10,  8,  9, 10,  8,  8,  9,  8,  9, 10,  8,  9, 10,
-       8,  8,  9,  8,  9,  9,  8,  9,  9,  8,  8,  7,
-    },
-    {
-       0,  4,  9,  2,  6, 10,  7,  8, 10,  3,  6, 10,  6,  7, 10,  9,
-       9, 10,  8,  9, 11,  9, 10, 11, 10, 11, 11,  2,  6, 10,  4,  7,
-      10,  8,  9, 10,  5,  7, 10,  7,  8, 10,  9,  9, 10,  9, 10, 11,
-      10, 10, 11, 11, 11, 11,  6,  9, 11,  7,  9, 11,  9, 10, 12,  8,
-       9, 11,  8, 10, 11, 10, 10, 11, 10, 11, 12, 11, 11, 12, 11, 11,
-      11,  9, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12, 10, 11, 12,
-      11, 11, 12, 11, 12, 12, 11, 12, 12, 12, 11, 11,
-    },
-  },
-  {
-    {
-       0,  4,  9,  3,  6,  9,  6,  8,  9,  4,  6,  9,  5,  7,  9,  8,
-       8,  9,  7,  8, 10,  8,  9, 10,  9,  9,  9,  2,  6,  9,  4,  7,
-       9,  7,  8,  9,  5,  7,  9,  6,  7, 10,  8,  9,  9,  7,  9, 10,
-       8,  9, 10,  9,  9,  9,  5,  8, 10,  6,  8, 10,  8,  9, 10,  7,
-       8, 10,  7,  9, 11,  9,  9, 10,  8,  9, 10,  9, 10, 10, 10, 10,
-       9,  7,  9, 10,  8,  9, 11,  8,  9, 10,  8,  9, 11,  8,  9, 11,
-       9,  9, 10,  9,  9, 10,  9,  9, 10,  9,  9,  8,
-    },
-    {
-       0,  4,  9,  2,  5, 10,  7,  8, 11,  3,  6, 10,  6,  7, 10,  9,
-      10, 11,  8,  9, 11,  9, 10, 11, 11, 11, 12,  2,  6, 10,  4,  7,
-      10,  8,  9, 11,  5,  7, 10,  6,  8, 10,  9, 10, 11,  9, 10, 12,
-      10, 10, 12, 11, 12, 12,  6,  9, 11,  8,  9, 12,  9, 11, 13,  8,
-      10, 12,  9, 10, 12, 11, 11, 12, 10, 12, 13, 11, 12, 13, 13, 12,
-      13, 10, 11, 13, 10, 12, 13, 11, 12, 13, 11, 12, 13, 11, 12, 13,
-      12, 12, 13, 12, 13, 14, 13, 13, 14, 13, 13, 13,
-    },
-  },
-  {
-    {
-       0,  4,  9,  3,  6,  9,  7,  8, 10,  3,  6,  9,  5,  7, 10,  8,
-       9, 10,  7,  9, 10,  8,  9, 10, 10, 10, 10,  2,  6,  9,  4,  7,
-      10,  7,  9, 10,  4,  7, 10,  6,  8, 10,  8,  9, 10,  8,  9, 10,
-       9,  9, 10, 10, 10, 10,  5,  8, 11,  7,  9, 11,  8, 10, 11,  7,
-       9, 11,  8,  9, 11,  9, 10, 11,  9, 10, 11, 10, 10, 11, 11, 11,
-      11,  8, 10, 11,  9, 10, 11,  9, 10, 11,  9, 10, 12,  9, 10, 12,
-      10, 11, 11,  9, 10, 11, 10, 11, 11, 10, 10, 10,
-    },
-    {
-       0,  4, 10,  3,  6, 11,  8, 10, 12,  3,  6, 11,  6,  8, 11, 10,
-      11, 13,  9, 10, 13, 11, 12, 14, 13, 13, 14,  1,  6, 10,  5,  8,
-      12,  9, 10, 13,  5,  8, 11,  7,  9, 12, 11, 11, 13, 10, 12, 13,
-      11, 12, 14, 14, 13, 15,  7, 10, 12,  9, 11, 14, 11, 12, 15,  9,
-      11, 13, 10, 11, 14, 12, 12, 14, 12, 14, 16, 13, 13, 16, 14, 14,
-      16, 12, 13, 15, 12, 14, 15, 13, 14, 16, 13, 14, 16, 14, 14, 16,
-      14, 15, 16, 14, 16, 16, 15, 16, 16, 15, 15, 16,
-    },
-  },
-  {
-    {
-       0,  4,  9,  2,  6,  9,  7,  9, 11,  3,  6, 10,  6,  7, 10,  9,
-      10, 11,  7,  9, 10,  9, 10, 11, 11, 11, 12,  2,  6, 10,  4,  7,
-      10,  8,  9, 11,  5,  7, 10,  7,  8, 10,  9, 10, 11,  8,  9, 11,
-       9, 10, 11, 11, 12, 11,  6,  9, 11,  7, 10, 12,  9, 11, 12,  7,
-      10, 12,  9, 10, 12, 11, 11, 12,  9, 11, 12, 10, 11, 12, 12, 12,
-      12,  9, 11, 12,  9, 11, 13, 11, 12, 13,  9, 11, 13, 10, 12, 13,
-      11, 12, 13, 11, 12, 13, 11, 12, 13, 12, 13, 12,
-    },
-    {
-       0,  4, 11,  2,  6, 12,  9, 11, 16,  4,  7, 12,  7,  9, 15, 11,
-      12, 16, 10, 11, 16, 11, 13, 16, 16, 16, 16,  1,  6, 11,  5,  8,
-      16,  9, 12, 16,  6,  9, 15,  8, 10, 16, 12, 13, 16, 12, 14, 16,
-      12, 16, 16, 16, 16, 16,  8, 11, 14, 10, 12, 16, 12, 16, 16, 10,
-      13, 16, 12, 16, 16, 13, 14, 16, 14, 16, 16, 16, 16, 16, 16, 16,
-      16, 13, 13, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  5,  9,  3,  6, 10,  8, 10, 12,  3,  6, 10,  6,  8, 10, 10,
-      11, 12,  8,  9, 11, 10, 10, 12, 13, 13, 13,  1,  6, 10,  5,  8,
-      11,  9, 11, 13,  5,  8, 11,  7,  9, 11, 11, 11, 13,  8,  9, 11,
-      10, 10, 12, 13, 13, 14,  6,  9, 12,  8, 11, 13, 11, 13, 15,  8,
-      10, 13, 10, 11, 13, 12, 13, 15, 10, 12, 13, 12, 12, 13, 14, 14,
-      14,  9, 12, 14, 11, 13, 15, 13, 15, 16, 11, 13, 15, 12, 14, 15,
-      14, 15, 16, 13, 14, 15, 14, 14, 15, 15, 16, 16,
-    },
-    {
-       0,  4, 16,  2,  7, 16, 10, 13, 16,  3,  8, 16,  7, 10, 16, 16,
-      16, 16, 12, 16, 16, 15, 16, 16, 16, 16, 16,  1,  7, 16,  6,  9,
-      16, 10, 16, 16,  7, 12, 16,  9, 13, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16,  9, 16, 16, 11, 13, 16, 16, 16, 16, 12,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  4,  9,  3,  6, 11,  9, 12, 16,  3,  6, 10,  6,  8, 11, 12,
-      13, 16,  8,  9, 12, 10, 11, 13, 16, 16, 16,  1,  6, 10,  5,  8,
-      12, 10, 13, 16,  5,  8, 11,  8,  9, 13, 13, 14, 16,  9, 10, 14,
-      11, 12, 15, 16, 16, 16,  6, 10, 13,  9, 12, 16, 14, 16, 16,  9,
-      12, 14, 11, 13, 16, 16, 16, 16, 12, 14, 16, 14, 16, 16, 16, 16,
-      16, 11, 16, 16, 13, 16, 16, 16, 16, 16, 12, 16, 16, 13, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       0,  4, 16,  2,  8, 16, 10, 16, 16,  3,  9, 16,  8, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,  1,  7, 16,  5, 10,
-      16, 16, 16, 16,  7, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 10, 15, 16, 10, 16, 16, 16, 16, 16, 14,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-  {
-    {
-       0,  3,  9,  3,  7, 11, 11, 15, 16,  3,  6, 11,  7,  9, 12, 16,
-      16, 16,  8, 10, 16, 11, 16, 16, 16, 16, 16,  1,  6, 11,  6,  9,
-      15, 16, 16, 16,  5,  8, 16,  9, 11, 16, 16, 16, 16, 10, 16, 16,
-      16, 16, 16, 16, 16, 16,  7, 11, 16, 11, 16, 16, 16, 16, 16, 11,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-    {
-       0,  4, 16,  2,  8, 16, 16, 16, 16,  3, 12, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,  1,  7, 16,  5, 12,
-      16, 16, 16, 16,  6, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16,  9, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-      16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    },
-  },
-};
-
-
-static const uint8_t rv34_inter_coeff[NUM_INTER_TABLES][COEFF_VLC_SIZE] = {
-{
-  1,  2,  4,  4,  5,  5,  6,  7,  7,  7,  8,  8,  8,  9,  9, 10,
- 10, 10, 10, 11, 11, 11, 11, 12, 11, 11, 11, 13, 14, 15, 16, 16,
-},
-{
-  1,  2,  3,  5,  5,  6,  6,  7,  7,  8,  9,  9,  9, 10, 10, 10,
- 11, 11, 12, 12, 12, 12, 13, 13, 12, 12, 13, 14, 16, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  6,  6,  7,  7,  8,  8,  9,  9, 10, 10, 11, 12,
- 12, 12, 13, 13, 13, 14, 14, 15, 14, 14, 16, 16, 16, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  5,  6,  8,  8,  9,  9, 10, 10, 11, 11, 12, 12,
- 13, 13, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 13, 14, 15, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  5,  6,  7,  8, 10, 10, 11, 11, 13, 12, 12, 13,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-},
-{
-  1,  2,  3,  4,  5,  6,  7,  8, 10, 10, 10, 11, 14, 13, 15, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16,
-}
-};
-
-#endif /* AVCODEC_RV34VLC_H */
diff --git a/libavcodec/rv40.c b/libavcodec/rv40.c
deleted file mode 100644
index abdeeff..0000000
--- a/libavcodec/rv40.c
+++ /dev/null
@@ -1,682 +0,0 @@
-/*
- * RV40 decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV40 decoder
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "golomb.h"
-
-#include "rv34.h"
-#include "rv40vlc2.h"
-#include "rv40data.h"
-
-static VLC aic_top_vlc;
-static VLC aic_mode1_vlc[AIC_MODE1_NUM], aic_mode2_vlc[AIC_MODE2_NUM];
-static VLC ptype_vlc[NUM_PTYPE_VLCS], btype_vlc[NUM_BTYPE_VLCS];
-
-static const int16_t mode2_offs[] = {
-       0,  614, 1222, 1794, 2410,  3014,  3586,  4202,  4792, 5382, 5966, 6542,
-    7138, 7716, 8292, 8864, 9444, 10030, 10642, 11212, 11814
-};
-
-/**
- * Initialize all tables.
- */
-static av_cold void rv40_init_tables(void)
-{
-    int i;
-    static VLC_TYPE aic_table[1 << AIC_TOP_BITS][2];
-    static VLC_TYPE aic_mode1_table[AIC_MODE1_NUM << AIC_MODE1_BITS][2];
-    static VLC_TYPE aic_mode2_table[11814][2];
-    static VLC_TYPE ptype_table[NUM_PTYPE_VLCS << PTYPE_VLC_BITS][2];
-    static VLC_TYPE btype_table[NUM_BTYPE_VLCS << BTYPE_VLC_BITS][2];
-
-    aic_top_vlc.table = aic_table;
-    aic_top_vlc.table_allocated = 1 << AIC_TOP_BITS;
-    init_vlc(&aic_top_vlc, AIC_TOP_BITS, AIC_TOP_SIZE,
-             rv40_aic_top_vlc_bits,  1, 1,
-             rv40_aic_top_vlc_codes, 1, 1, INIT_VLC_USE_NEW_STATIC);
-    for(i = 0; i < AIC_MODE1_NUM; i++){
-        // Every tenth VLC table is empty
-        if((i % 10) == 9) continue;
-        aic_mode1_vlc[i].table = &aic_mode1_table[i << AIC_MODE1_BITS];
-        aic_mode1_vlc[i].table_allocated = 1 << AIC_MODE1_BITS;
-        init_vlc(&aic_mode1_vlc[i], AIC_MODE1_BITS, AIC_MODE1_SIZE,
-                 aic_mode1_vlc_bits[i],  1, 1,
-                 aic_mode1_vlc_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-    }
-    for(i = 0; i < AIC_MODE2_NUM; i++){
-        aic_mode2_vlc[i].table = &aic_mode2_table[mode2_offs[i]];
-        aic_mode2_vlc[i].table_allocated = mode2_offs[i + 1] - mode2_offs[i];
-        init_vlc(&aic_mode2_vlc[i], AIC_MODE2_BITS, AIC_MODE2_SIZE,
-                 aic_mode2_vlc_bits[i],  1, 1,
-                 aic_mode2_vlc_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
-    }
-    for(i = 0; i < NUM_PTYPE_VLCS; i++){
-        ptype_vlc[i].table = &ptype_table[i << PTYPE_VLC_BITS];
-        ptype_vlc[i].table_allocated = 1 << PTYPE_VLC_BITS;
-        init_vlc_sparse(&ptype_vlc[i], PTYPE_VLC_BITS, PTYPE_VLC_SIZE,
-                         ptype_vlc_bits[i],  1, 1,
-                         ptype_vlc_codes[i], 1, 1,
-                         ptype_vlc_syms,     1, 1, INIT_VLC_USE_NEW_STATIC);
-    }
-    for(i = 0; i < NUM_BTYPE_VLCS; i++){
-        btype_vlc[i].table = &btype_table[i << BTYPE_VLC_BITS];
-        btype_vlc[i].table_allocated = 1 << BTYPE_VLC_BITS;
-        init_vlc_sparse(&btype_vlc[i], BTYPE_VLC_BITS, BTYPE_VLC_SIZE,
-                         btype_vlc_bits[i],  1, 1,
-                         btype_vlc_codes[i], 1, 1,
-                         btype_vlc_syms,     1, 1, INIT_VLC_USE_NEW_STATIC);
-    }
-}
-
-/**
- * Get stored dimension from bitstream.
- *
- * If the width/height is the standard one then it's coded as a 3-bit index.
- * Otherwise it is coded as escaped 8-bit portions.
- */
-static int get_dimension(GetBitContext *gb, const int *dim)
-{
-    int t   = get_bits(gb, 3);
-    int val = dim[t];
-    if(val < 0)
-        val = dim[get_bits1(gb) - val];
-    if(!val){
-        do{
-            t = get_bits(gb, 8);
-            val += t << 2;
-        }while(t == 0xFF);
-    }
-    return val;
-}
-
-/**
- * Get encoded picture size - usually this is called from rv40_parse_slice_header.
- */
-static void rv40_parse_picture_size(GetBitContext *gb, int *w, int *h)
-{
-    *w = get_dimension(gb, rv40_standard_widths);
-    *h = get_dimension(gb, rv40_standard_heights);
-}
-
-static int rv40_parse_slice_header(RV34DecContext *r, GetBitContext *gb, SliceInfo *si)
-{
-    int mb_bits;
-    int w = r->s.width, h = r->s.height;
-    int mb_size;
-
-    memset(si, 0, sizeof(SliceInfo));
-    if(get_bits1(gb))
-        return -1;
-    si->type = get_bits(gb, 2);
-    if(si->type == 1) si->type = 0;
-    si->quant = get_bits(gb, 5);
-    if(get_bits(gb, 2))
-        return -1;
-    si->vlc_set = get_bits(gb, 2);
-    skip_bits1(gb);
-    si->pts = get_bits(gb, 13);
-    if(!si->type || !get_bits1(gb))
-        rv40_parse_picture_size(gb, &w, &h);
-    if(avcodec_check_dimensions(r->s.avctx, w, h) < 0)
-        return -1;
-    si->width  = w;
-    si->height = h;
-    mb_size = ((w + 15) >> 4) * ((h + 15) >> 4);
-    mb_bits = ff_rv34_get_start_offset(gb, mb_size);
-    si->start = get_bits(gb, mb_bits);
-
-    return 0;
-}
-
-/**
- * Decode 4x4 intra types array.
- */
-static int rv40_decode_intra_types(RV34DecContext *r, GetBitContext *gb, int8_t *dst)
-{
-    MpegEncContext *s = &r->s;
-    int i, j, k, v;
-    int A, B, C;
-    int pattern;
-    int8_t *ptr;
-
-    for(i = 0; i < 4; i++, dst += r->intra_types_stride){
-        if(!i && s->first_slice_line){
-            pattern = get_vlc2(gb, aic_top_vlc.table, AIC_TOP_BITS, 1);
-            dst[0] = (pattern >> 2) & 2;
-            dst[1] = (pattern >> 1) & 2;
-            dst[2] =  pattern       & 2;
-            dst[3] = (pattern << 1) & 2;
-            continue;
-        }
-        ptr = dst;
-        for(j = 0; j < 4; j++){
-            /* Coefficients are read using VLC chosen by the prediction pattern
-             * The first one (used for retrieving a pair of coefficients) is
-             * constructed from the top, top right and left coefficients
-             * The second one (used for retrieving only one coefficient) is
-             * top + 10 * left.
-             */
-            A = ptr[-r->intra_types_stride + 1]; // it won't be used for the last coefficient in a row
-            B = ptr[-r->intra_types_stride];
-            C = ptr[-1];
-            pattern = A + (B << 4) + (C << 8);
-            for(k = 0; k < MODE2_PATTERNS_NUM; k++)
-                if(pattern == rv40_aic_table_index[k])
-                    break;
-            if(j < 3 && k < MODE2_PATTERNS_NUM){ //pattern is found, decoding 2 coefficients
-                v = get_vlc2(gb, aic_mode2_vlc[k].table, AIC_MODE2_BITS, 2);
-                *ptr++ = v/9;
-                *ptr++ = v%9;
-                j++;
-            }else{
-                if(B != -1 && C != -1)
-                    v = get_vlc2(gb, aic_mode1_vlc[B + C*10].table, AIC_MODE1_BITS, 1);
-                else{ // tricky decoding
-                    v = 0;
-                    switch(C){
-                    case -1: // code 0 -> 1, 1 -> 0
-                        if(B < 2)
-                            v = get_bits1(gb) ^ 1;
-                        break;
-                    case  0:
-                    case  2: // code 0 -> 2, 1 -> 0
-                        v = (get_bits1(gb) ^ 1) << 1;
-                        break;
-                    }
-                }
-                *ptr++ = v;
-            }
-        }
-    }
-    return 0;
-}
-
-/**
- * Decode macroblock information.
- */
-static int rv40_decode_mb_info(RV34DecContext *r)
-{
-    MpegEncContext *s = &r->s;
-    GetBitContext *gb = &s->gb;
-    int q, i;
-    int prev_type = 0;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-    int blocks[RV34_MB_TYPES] = {0};
-    int count = 0;
-
-    if(!r->s.mb_skip_run)
-        r->s.mb_skip_run = svq3_get_ue_golomb(gb) + 1;
-
-    if(--r->s.mb_skip_run)
-         return RV34_MB_SKIP;
-
-    if(r->avail_cache[6-1])
-        blocks[r->mb_type[mb_pos - 1]]++;
-    if(r->avail_cache[6-4]){
-        blocks[r->mb_type[mb_pos - s->mb_stride]]++;
-        if(r->avail_cache[6-2])
-            blocks[r->mb_type[mb_pos - s->mb_stride + 1]]++;
-        if(r->avail_cache[6-5])
-            blocks[r->mb_type[mb_pos - s->mb_stride - 1]]++;
-    }
-
-    for(i = 0; i < RV34_MB_TYPES; i++){
-        if(blocks[i] > count){
-            count = blocks[i];
-            prev_type = i;
-        }
-    }
-    if(s->pict_type == FF_P_TYPE){
-        prev_type = block_num_to_ptype_vlc_num[prev_type];
-        q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
-        if(q < PBTYPE_ESCAPE)
-            return q;
-        q = get_vlc2(gb, ptype_vlc[prev_type].table, PTYPE_VLC_BITS, 1);
-        av_log(s->avctx, AV_LOG_ERROR, "Dquant for P-frame\n");
-    }else{
-        prev_type = block_num_to_btype_vlc_num[prev_type];
-        q = get_vlc2(gb, btype_vlc[prev_type].table, BTYPE_VLC_BITS, 1);
-        if(q < PBTYPE_ESCAPE)
-            return q;
-        q = get_vlc2(gb, btype_vlc[prev_type].table, BTYPE_VLC_BITS, 1);
-        av_log(s->avctx, AV_LOG_ERROR, "Dquant for B-frame\n");
-    }
-    return 0;
-}
-
-#define CLIP_SYMM(a, b) av_clip(a, -(b), b)
-/**
- * weaker deblocking very similar to the one described in 4.4.2 of JVT-A003r1
- */
-static inline void rv40_weak_loop_filter(uint8_t *src, const int step,
-                                         const int filter_p1, const int filter_q1,
-                                         const int alpha, const int beta,
-                                         const int lim_p0q0,
-                                         const int lim_q1, const int lim_p1,
-                                         const int diff_p1p0, const int diff_q1q0,
-                                         const int diff_p1p2, const int diff_q1q2)
-{
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int t, u, diff;
-
-    t = src[0*step] - src[-1*step];
-    if(!t)
-        return;
-    u = (alpha * FFABS(t)) >> 7;
-    if(u > 3 - (filter_p1 && filter_q1))
-        return;
-
-    t <<= 2;
-    if(filter_p1 && filter_q1)
-        t += src[-2*step] - src[1*step];
-    diff = CLIP_SYMM((t + 4) >> 3, lim_p0q0);
-    src[-1*step] = cm[src[-1*step] + diff];
-    src[ 0*step] = cm[src[ 0*step] - diff];
-    if(FFABS(diff_p1p2) <= beta && filter_p1){
-        t = (diff_p1p0 + diff_p1p2 - diff) >> 1;
-        src[-2*step] = cm[src[-2*step] - CLIP_SYMM(t, lim_p1)];
-    }
-    if(FFABS(diff_q1q2) <= beta && filter_q1){
-        t = (diff_q1q0 + diff_q1q2 + diff) >> 1;
-        src[ 1*step] = cm[src[ 1*step] - CLIP_SYMM(t, lim_q1)];
-    }
-}
-
-static inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
-                                             const int stride, const int dmode,
-                                             const int lim_q1, const int lim_p1,
-                                             const int alpha,
-                                             const int beta, const int beta2,
-                                             const int chroma, const int edge)
-{
-    int diff_p1p0[4], diff_q1q0[4], diff_p1p2[4], diff_q1q2[4];
-    int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0;
-    uint8_t *ptr;
-    int flag_strong0 = 1, flag_strong1 = 1;
-    int filter_p1, filter_q1;
-    int i;
-    int lims;
-
-    for(i = 0, ptr = src; i < 4; i++, ptr += stride){
-        diff_p1p0[i] = ptr[-2*step] - ptr[-1*step];
-        diff_q1q0[i] = ptr[ 1*step] - ptr[ 0*step];
-        sum_p1p0 += diff_p1p0[i];
-        sum_q1q0 += diff_q1q0[i];
-    }
-    filter_p1 = FFABS(sum_p1p0) < (beta<<2);
-    filter_q1 = FFABS(sum_q1q0) < (beta<<2);
-    if(!filter_p1 && !filter_q1)
-        return;
-
-    for(i = 0, ptr = src; i < 4; i++, ptr += stride){
-        diff_p1p2[i] = ptr[-2*step] - ptr[-3*step];
-        diff_q1q2[i] = ptr[ 1*step] - ptr[ 2*step];
-        sum_p1p2 += diff_p1p2[i];
-        sum_q1q2 += diff_q1q2[i];
-    }
-
-    if(edge){
-        flag_strong0 = filter_p1 && (FFABS(sum_p1p2) < beta2);
-        flag_strong1 = filter_q1 && (FFABS(sum_q1q2) < beta2);
-    }else{
-        flag_strong0 = flag_strong1 = 0;
-    }
-
-    lims = filter_p1 + filter_q1 + ((lim_q1 + lim_p1) >> 1) + 1;
-    if(flag_strong0 && flag_strong1){ /* strong filtering */
-        for(i = 0; i < 4; i++, src += stride){
-            int sflag, p0, q0, p1, q1;
-            int t = src[0*step] - src[-1*step];
-
-            if(!t) continue;
-            sflag = (alpha * FFABS(t)) >> 7;
-            if(sflag > 1) continue;
-
-            p0 = (25*src[-3*step] + 26*src[-2*step]
-                + 26*src[-1*step]
-                + 26*src[ 0*step] + 25*src[ 1*step] + rv40_dither_l[dmode + i]) >> 7;
-            q0 = (25*src[-2*step] + 26*src[-1*step]
-                + 26*src[ 0*step]
-                + 26*src[ 1*step] + 25*src[ 2*step] + rv40_dither_r[dmode + i]) >> 7;
-            if(sflag){
-                p0 = av_clip(p0, src[-1*step] - lims, src[-1*step] + lims);
-                q0 = av_clip(q0, src[ 0*step] - lims, src[ 0*step] + lims);
-            }
-            p1 = (25*src[-4*step] + 26*src[-3*step]
-                + 26*src[-2*step]
-                + 26*p0           + 25*src[ 0*step] + rv40_dither_l[dmode + i]) >> 7;
-            q1 = (25*src[-1*step] + 26*q0
-                + 26*src[ 1*step]
-                + 26*src[ 2*step] + 25*src[ 3*step] + rv40_dither_r[dmode + i]) >> 7;
-            if(sflag){
-                p1 = av_clip(p1, src[-2*step] - lims, src[-2*step] + lims);
-                q1 = av_clip(q1, src[ 1*step] - lims, src[ 1*step] + lims);
-            }
-            src[-2*step] = p1;
-            src[-1*step] = p0;
-            src[ 0*step] = q0;
-            src[ 1*step] = q1;
-            if(!chroma){
-                src[-3*step] = (25*src[-1*step] + 26*src[-2*step] + 51*src[-3*step] + 26*src[-4*step] + 64) >> 7;
-                src[ 2*step] = (25*src[ 0*step] + 26*src[ 1*step] + 51*src[ 2*step] + 26*src[ 3*step] + 64) >> 7;
-            }
-        }
-    }else if(filter_p1 && filter_q1){
-        for(i = 0; i < 4; i++, src += stride)
-            rv40_weak_loop_filter(src, step, 1, 1, alpha, beta, lims, lim_q1, lim_p1,
-                                  diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
-    }else{
-        for(i = 0; i < 4; i++, src += stride)
-            rv40_weak_loop_filter(src, step, filter_p1, filter_q1,
-                                  alpha, beta, lims>>1, lim_q1>>1, lim_p1>>1,
-                                  diff_p1p0[i], diff_q1q0[i], diff_p1p2[i], diff_q1q2[i]);
-    }
-}
-
-static void rv40_v_loop_filter(uint8_t *src, int stride, int dmode,
-                               int lim_q1, int lim_p1,
-                               int alpha, int beta, int beta2, int chroma, int edge){
-    rv40_adaptive_loop_filter(src, 1, stride, dmode, lim_q1, lim_p1,
-                              alpha, beta, beta2, chroma, edge);
-}
-static void rv40_h_loop_filter(uint8_t *src, int stride, int dmode,
-                               int lim_q1, int lim_p1,
-                               int alpha, int beta, int beta2, int chroma, int edge){
-    rv40_adaptive_loop_filter(src, stride, 1, dmode, lim_q1, lim_p1,
-                              alpha, beta, beta2, chroma, edge);
-}
-
-enum RV40BlockPos{
-    POS_CUR,
-    POS_TOP,
-    POS_LEFT,
-    POS_BOTTOM,
-};
-
-#define MASK_CUR          0x0001
-#define MASK_RIGHT        0x0008
-#define MASK_BOTTOM       0x0010
-#define MASK_TOP          0x1000
-#define MASK_Y_TOP_ROW    0x000F
-#define MASK_Y_LAST_ROW   0xF000
-#define MASK_Y_LEFT_COL   0x1111
-#define MASK_Y_RIGHT_COL  0x8888
-#define MASK_C_TOP_ROW    0x0003
-#define MASK_C_LAST_ROW   0x000C
-#define MASK_C_LEFT_COL   0x0005
-#define MASK_C_RIGHT_COL  0x000A
-
-static const int neighbour_offs_x[4] = { 0,  0, -1, 0 };
-static const int neighbour_offs_y[4] = { 0, -1,  0, 1 };
-
-/**
- * RV40 loop filtering function
- */
-static void rv40_loop_filter(RV34DecContext *r, int row)
-{
-    MpegEncContext *s = &r->s;
-    int mb_pos, mb_x;
-    int i, j, k;
-    uint8_t *Y, *C;
-    int alpha, beta, betaY, betaC;
-    int q;
-    int mbtype[4];   ///< current macroblock and its neighbours types
-    /**
-     * flags indicating that macroblock can be filtered with strong filter
-     * it is set only for intra coded MB and MB with DCs coded separately
-     */
-    int mb_strong[4];
-    int clip[4];     ///< MB filter clipping value calculated from filtering strength
-    /**
-     * coded block patterns for luma part of current macroblock and its neighbours
-     * Format:
-     * LSB corresponds to the top left block,
-     * each nibble represents one row of subblocks.
-     */
-    int cbp[4];
-    /**
-     * coded block patterns for chroma part of current macroblock and its neighbours
-     * Format is the same as for luma with two subblocks in a row.
-     */
-    int uvcbp[4][2];
-    /**
-     * This mask represents the pattern of luma subblocks that should be filtered
-     * in addition to the coded ones because because they lie at the edge of
-     * 8x8 block with different enough motion vectors
-     */
-    int mvmasks[4];
-
-    mb_pos = row * s->mb_stride;
-    for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
-        int mbtype = s->current_picture_ptr->mb_type[mb_pos];
-        if(IS_INTRA(mbtype) || IS_SEPARATE_DC(mbtype))
-            r->cbp_luma  [mb_pos] = r->deblock_coefs[mb_pos] = 0xFFFF;
-        if(IS_INTRA(mbtype))
-            r->cbp_chroma[mb_pos] = 0xFF;
-    }
-    mb_pos = row * s->mb_stride;
-    for(mb_x = 0; mb_x < s->mb_width; mb_x++, mb_pos++){
-        int y_h_deblock, y_v_deblock;
-        int c_v_deblock[2], c_h_deblock[2];
-        int clip_left;
-        int avail[4];
-        int y_to_deblock, c_to_deblock[2];
-
-        q = s->current_picture_ptr->qscale_table[mb_pos];
-        alpha = rv40_alpha_tab[q];
-        beta  = rv40_beta_tab [q];
-        betaY = betaC = beta * 3;
-        if(s->width * s->height <= 176*144)
-            betaY += beta;
-
-        avail[0] = 1;
-        avail[1] = row;
-        avail[2] = mb_x;
-        avail[3] = row < s->mb_height - 1;
-        for(i = 0; i < 4; i++){
-            if(avail[i]){
-                int pos = mb_pos + neighbour_offs_x[i] + neighbour_offs_y[i]*s->mb_stride;
-                mvmasks[i] = r->deblock_coefs[pos];
-                mbtype [i] = s->current_picture_ptr->mb_type[pos];
-                cbp    [i] = r->cbp_luma[pos];
-                uvcbp[i][0] = r->cbp_chroma[pos] & 0xF;
-                uvcbp[i][1] = r->cbp_chroma[pos] >> 4;
-            }else{
-                mvmasks[i] = 0;
-                mbtype [i] = mbtype[0];
-                cbp    [i] = 0;
-                uvcbp[i][0] = uvcbp[i][1] = 0;
-            }
-            mb_strong[i] = IS_INTRA(mbtype[i]) || IS_SEPARATE_DC(mbtype[i]);
-            clip[i] = rv40_filter_clip_tbl[mb_strong[i] + 1][q];
-        }
-        y_to_deblock =  mvmasks[POS_CUR]
-                     | (mvmasks[POS_BOTTOM] << 16);
-        /* This pattern contains bits signalling that horizontal edges of
-         * the current block can be filtered.
-         * That happens when either of adjacent subblocks is coded or lies on
-         * the edge of 8x8 blocks with motion vectors differing by more than
-         * 3/4 pel in any component (any edge orientation for some reason).
-         */
-        y_h_deblock =   y_to_deblock
-                    | ((cbp[POS_CUR]                           <<  4) & ~MASK_Y_TOP_ROW)
-                    | ((cbp[POS_TOP]        & MASK_Y_LAST_ROW) >> 12);
-        /* This pattern contains bits signalling that vertical edges of
-         * the current block can be filtered.
-         * That happens when either of adjacent subblocks is coded or lies on
-         * the edge of 8x8 blocks with motion vectors differing by more than
-         * 3/4 pel in any component (any edge orientation for some reason).
-         */
-        y_v_deblock =   y_to_deblock
-                    | ((cbp[POS_CUR]                      << 1) & ~MASK_Y_LEFT_COL)
-                    | ((cbp[POS_LEFT] & MASK_Y_RIGHT_COL) >> 3);
-        if(!mb_x)
-            y_v_deblock &= ~MASK_Y_LEFT_COL;
-        if(!row)
-            y_h_deblock &= ~MASK_Y_TOP_ROW;
-        if(row == s->mb_height - 1 || (mb_strong[POS_CUR] || mb_strong[POS_BOTTOM]))
-            y_h_deblock &= ~(MASK_Y_TOP_ROW << 16);
-        /* Calculating chroma patterns is similar and easier since there is
-         * no motion vector pattern for them.
-         */
-        for(i = 0; i < 2; i++){
-            c_to_deblock[i] = (uvcbp[POS_BOTTOM][i] << 4) | uvcbp[POS_CUR][i];
-            c_v_deblock[i] =   c_to_deblock[i]
-                           | ((uvcbp[POS_CUR] [i]                       << 1) & ~MASK_C_LEFT_COL)
-                           | ((uvcbp[POS_LEFT][i]   & MASK_C_RIGHT_COL) >> 1);
-            c_h_deblock[i] =   c_to_deblock[i]
-                           | ((uvcbp[POS_TOP][i]    & MASK_C_LAST_ROW)  >> 2)
-                           |  (uvcbp[POS_CUR][i]                        << 2);
-            if(!mb_x)
-                c_v_deblock[i] &= ~MASK_C_LEFT_COL;
-            if(!row)
-                c_h_deblock[i] &= ~MASK_C_TOP_ROW;
-            if(row == s->mb_height - 1 || mb_strong[POS_CUR] || mb_strong[POS_BOTTOM])
-                c_h_deblock[i] &= ~(MASK_C_TOP_ROW << 4);
-        }
-
-        for(j = 0; j < 16; j += 4){
-            Y = s->current_picture_ptr->data[0] + mb_x*16 + (row*16 + j) * s->linesize;
-            for(i = 0; i < 4; i++, Y += 4){
-                int ij = i + j;
-                int clip_cur = y_to_deblock & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
-                int dither = j ? ij : i*4;
-
-                // if bottom block is coded then we can filter its top edge
-                // (or bottom edge of this block, which is the same)
-                if(y_h_deblock & (MASK_BOTTOM << ij)){
-                    rv40_h_loop_filter(Y+4*s->linesize, s->linesize, dither,
-                                       y_to_deblock & (MASK_BOTTOM << ij) ? clip[POS_CUR] : 0,
-                                       clip_cur,
-                                       alpha, beta, betaY, 0, 0);
-                }
-                // filter left block edge in ordinary mode (with low filtering strength)
-                if(y_v_deblock & (MASK_CUR << ij) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
-                    if(!i)
-                        clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
-                    else
-                        clip_left = y_to_deblock & (MASK_CUR << (ij-1)) ? clip[POS_CUR] : 0;
-                    rv40_v_loop_filter(Y, s->linesize, dither,
-                                       clip_cur,
-                                       clip_left,
-                                       alpha, beta, betaY, 0, 0);
-                }
-                // filter top edge of the current macroblock when filtering strength is high
-                if(!j && y_h_deblock & (MASK_CUR << i) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
-                    rv40_h_loop_filter(Y, s->linesize, dither,
-                                       clip_cur,
-                                       mvmasks[POS_TOP] & (MASK_TOP << i) ? clip[POS_TOP] : 0,
-                                       alpha, beta, betaY, 0, 1);
-                }
-                // filter left block edge in edge mode (with high filtering strength)
-                if(y_v_deblock & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
-                    clip_left = mvmasks[POS_LEFT] & (MASK_RIGHT << j) ? clip[POS_LEFT] : 0;
-                    rv40_v_loop_filter(Y, s->linesize, dither,
-                                       clip_cur,
-                                       clip_left,
-                                       alpha, beta, betaY, 0, 1);
-                }
-            }
-        }
-        for(k = 0; k < 2; k++){
-            for(j = 0; j < 2; j++){
-                C = s->current_picture_ptr->data[k+1] + mb_x*8 + (row*8 + j*4) * s->uvlinesize;
-                for(i = 0; i < 2; i++, C += 4){
-                    int ij = i + j*2;
-                    int clip_cur = c_to_deblock[k] & (MASK_CUR << ij) ? clip[POS_CUR] : 0;
-                    if(c_h_deblock[k] & (MASK_CUR << (ij+2))){
-                        int clip_bot = c_to_deblock[k] & (MASK_CUR << (ij+2)) ? clip[POS_CUR] : 0;
-                        rv40_h_loop_filter(C+4*s->uvlinesize, s->uvlinesize, i*8,
-                                           clip_bot,
-                                           clip_cur,
-                                           alpha, beta, betaC, 1, 0);
-                    }
-                    if((c_v_deblock[k] & (MASK_CUR << ij)) && (i || !(mb_strong[POS_CUR] || mb_strong[POS_LEFT]))){
-                        if(!i)
-                            clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
-                        else
-                            clip_left = c_to_deblock[k]    & (MASK_CUR << (ij-1))  ? clip[POS_CUR]  : 0;
-                        rv40_v_loop_filter(C, s->uvlinesize, j*8,
-                                           clip_cur,
-                                           clip_left,
-                                           alpha, beta, betaC, 1, 0);
-                    }
-                    if(!j && c_h_deblock[k] & (MASK_CUR << ij) && (mb_strong[POS_CUR] || mb_strong[POS_TOP])){
-                        int clip_top = uvcbp[POS_TOP][k] & (MASK_CUR << (ij+2)) ? clip[POS_TOP] : 0;
-                        rv40_h_loop_filter(C, s->uvlinesize, i*8,
-                                           clip_cur,
-                                           clip_top,
-                                           alpha, beta, betaC, 1, 1);
-                    }
-                    if(c_v_deblock[k] & (MASK_CUR << ij) && !i && (mb_strong[POS_CUR] || mb_strong[POS_LEFT])){
-                        clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
-                        rv40_v_loop_filter(C, s->uvlinesize, j*8,
-                                           clip_cur,
-                                           clip_left,
-                                           alpha, beta, betaC, 1, 1);
-                    }
-                }
-            }
-        }
-    }
-}
-
-/**
- * Initialize decoder.
- */
-static av_cold int rv40_decode_init(AVCodecContext *avctx)
-{
-    RV34DecContext *r = avctx->priv_data;
-
-    r->rv30 = 0;
-    ff_rv34_decode_init(avctx);
-    if(!aic_top_vlc.bits)
-        rv40_init_tables();
-    r->parse_slice_header = rv40_parse_slice_header;
-    r->decode_intra_types = rv40_decode_intra_types;
-    r->decode_mb_info     = rv40_decode_mb_info;
-    r->loop_filter        = rv40_loop_filter;
-    r->luma_dc_quant_i = rv40_luma_dc_quant[0];
-    r->luma_dc_quant_p = rv40_luma_dc_quant[1];
-    return 0;
-}
-
-AVCodec rv40_decoder = {
-    "rv40",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_RV40,
-    sizeof(RV34DecContext),
-    rv40_decode_init,
-    NULL,
-    ff_rv34_decode_end,
-    ff_rv34_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    .flush = ff_mpeg_flush,
-    .long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
diff --git a/libavcodec/rv40data.h b/libavcodec/rv40data.h
deleted file mode 100644
index 5566569..0000000
--- a/libavcodec/rv40data.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * RealVideo 4 decoder
- * copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * miscellaneous RV40 tables
- */
-
-#ifndef AVCODEC_RV40DATA_H
-#define AVCODEC_RV40DATA_H
-
-#include <stdint.h>
-
-/**
- * standard widths and heights coded in RV40
- */
-//@{
-static const int rv40_standard_widths[]   = { 160, 172, 240, 320, 352, 640, 704, 0};
-static const int rv40_standard_heights[]  = { 120, 132, 144, 240, 288, 480, -8, -10, 180, 360, 576, 0};
-//@}
-
-#define MODE2_PATTERNS_NUM 20
-/**
- * intra types table
- *
- * These values are actually coded 3-tuples
- * used for detecting standard block configurations.
- */
-static const uint16_t rv40_aic_table_index[MODE2_PATTERNS_NUM] = {
- 0x000, 0x100, 0x200,
- 0x011, 0x111, 0x211, 0x511, 0x611,
- 0x022, 0x122, 0x222, 0x722,
- 0x272, 0x227,
- 0x822, 0x282, 0x228,
- 0x112, 0x116, 0x221
-};
-
-/**
- * luma quantizer values
- * The second table is used for inter blocks.
- */
-static const uint8_t rv40_luma_dc_quant[2][32] = {
- {  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-   16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 22, 22, 22, 22 },
- {  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-   16, 17, 18, 19, 20, 20, 21, 21, 22, 23, 23, 23, 24, 24, 24, 24 }
-};
-
-/**
- * @begingroup loopfilter coefficients used by the RV40 loop filter
- * @{
- */
-/**
- * dither values for deblocking filter - left/top values
- */
-static const uint8_t rv40_dither_l[16] = {
-    0x40, 0x50, 0x20, 0x60, 0x30, 0x50, 0x40, 0x30,
-    0x50, 0x40, 0x50, 0x30, 0x60, 0x20, 0x50, 0x40
-};
-/**
- * dither values for deblocking filter - right/bottom values
- */
-static const uint8_t rv40_dither_r[16] = {
-    0x40, 0x30, 0x60, 0x20, 0x50, 0x30, 0x30, 0x40,
-    0x40, 0x40, 0x50, 0x30, 0x20, 0x60, 0x30, 0x40
-};
-
-/** alpha parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
-static const uint8_t rv40_alpha_tab[32] = {
-    128, 128, 128, 128, 128, 128, 128, 128,
-    128, 128, 122,  96,  75,  59,  47,  37,
-     29,  23,  18,  15,  13,  11,  10,   9,
-      8,   7,   6,   5,   4,   3,   2,   1
-};
-/** beta parameter for RV40 loop filter - almost the same as in JVT-A003r1 */
-static const uint8_t rv40_beta_tab[32] = {
-     0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  3,  4,  4,  4,  6,  6,
-     6,  7,  8,  8,  9,  9, 10, 10, 11, 11, 12, 13, 14, 15, 16, 17
-};
-/** clip table for RV40 loop filter - the same as in JVT-A003r1 */
-static const uint8_t rv40_filter_clip_tbl[3][32] = {
-    {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    },
-    {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 5, 5
-    },
-    {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
-        1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 7, 8, 9
-    }
-};
-/** @} */ // end loopfilter group
-
-#endif /* AVCODEC_RV40DATA_H */
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
deleted file mode 100644
index 27bc79e..0000000
--- a/libavcodec/rv40dsp.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * RV40 decoder motion compensation functions
- * Copyright (c) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV40 decoder motion compensation functions
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-#define RV40_LOWPASS(OPNAME, OP) \
-static av_unused void OPNAME ## rv40_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,\
-                                                     const int h, const int C1, const int C2, const int SHIFT){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<h; i++)\
-    {\
-        OP(dst[0], (src[-2] + src[ 3] - 5*(src[-1]+src[2]) + src[0]*C1 + src[1]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[1], (src[-1] + src[ 4] - 5*(src[ 0]+src[3]) + src[1]*C1 + src[2]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[2], (src[ 0] + src[ 5] - 5*(src[ 1]+src[4]) + src[2]*C1 + src[3]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[3], (src[ 1] + src[ 6] - 5*(src[ 2]+src[5]) + src[3]*C1 + src[4]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[4], (src[ 2] + src[ 7] - 5*(src[ 3]+src[6]) + src[4]*C1 + src[5]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[5], (src[ 3] + src[ 8] - 5*(src[ 4]+src[7]) + src[5]*C1 + src[6]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[6], (src[ 4] + src[ 9] - 5*(src[ 5]+src[8]) + src[6]*C1 + src[7]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[7], (src[ 5] + src[10] - 5*(src[ 6]+src[9]) + src[7]*C1 + src[8]*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## rv40_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,\
-                                           const int w, const int C1, const int C2, const int SHIFT){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    for(i=0; i<w; i++)\
-    {\
-        const int srcB = src[-2*srcStride];\
-        const int srcA = src[-1*srcStride];\
-        const int src0 = src[0 *srcStride];\
-        const int src1 = src[1 *srcStride];\
-        const int src2 = src[2 *srcStride];\
-        const int src3 = src[3 *srcStride];\
-        const int src4 = src[4 *srcStride];\
-        const int src5 = src[5 *srcStride];\
-        const int src6 = src[6 *srcStride];\
-        const int src7 = src[7 *srcStride];\
-        const int src8 = src[8 *srcStride];\
-        const int src9 = src[9 *srcStride];\
-        const int src10= src[10*srcStride];\
-        OP(dst[0*dstStride], (srcB + src3  - 5*(srcA+src2) + src0*C1 + src1*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[1*dstStride], (srcA + src4  - 5*(src0+src3) + src1*C1 + src2*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[2*dstStride], (src0 + src5  - 5*(src1+src4) + src2*C1 + src3*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[3*dstStride], (src1 + src6  - 5*(src2+src5) + src3*C1 + src4*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[4*dstStride], (src2 + src7  - 5*(src3+src6) + src4*C1 + src5*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[5*dstStride], (src3 + src8  - 5*(src4+src7) + src5*C1 + src6*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[6*dstStride], (src4 + src9  - 5*(src5+src8) + src6*C1 + src7*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        OP(dst[7*dstStride], (src5 + src10 - 5*(src6+src9) + src7*C1 + src8*C2 + (1<<(SHIFT-1))) >> SHIFT);\
-        dst++;\
-        src++;\
-    }\
-}\
-\
-static void OPNAME ## rv40_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,\
-                                            const int w, const int C1, const int C2, const int SHIFT){\
-    OPNAME ## rv40_qpel8_v_lowpass(dst  , src  , dstStride, srcStride, 8, C1, C2, SHIFT);\
-    OPNAME ## rv40_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride, 8, C1, C2, SHIFT);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv40_qpel8_v_lowpass(dst  , src  , dstStride, srcStride, w-8, C1, C2, SHIFT);\
-    OPNAME ## rv40_qpel8_v_lowpass(dst+8, src+8, dstStride, srcStride, w-8, C1, C2, SHIFT);\
-}\
-\
-static void OPNAME ## rv40_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,\
-                                            const int h, const int C1, const int C2, const int SHIFT){\
-    OPNAME ## rv40_qpel8_h_lowpass(dst  , src  , dstStride, srcStride, 8, C1, C2, SHIFT);\
-    OPNAME ## rv40_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride, 8, C1, C2, SHIFT);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## rv40_qpel8_h_lowpass(dst  , src  , dstStride, srcStride, h-8, C1, C2, SHIFT);\
-    OPNAME ## rv40_qpel8_h_lowpass(dst+8, src+8, dstStride, srcStride, h-8, C1, C2, SHIFT);\
-}\
-\
-
-#define RV40_MC(OPNAME, SIZE) \
-static void OPNAME ## rv40_qpel ## SIZE ## _mc10_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv40_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride, SIZE, 52, 20, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc20_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv40_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride, SIZE, 20, 20, 5);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc30_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv40_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride, SIZE, 20, 52, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc01_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, src, stride, stride, SIZE, 52, 20, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc11_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 52, 20, 6);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 52, 20, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc21_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 20, 20, 5);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 52, 20, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc31_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 20, 52, 6);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 52, 20, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc02_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, src, stride, stride, SIZE, 20, 20, 5);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc12_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 52, 20, 6);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 20, 20, 5);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc22_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 20, 20, 5);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 20, 20, 5);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc32_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 20, 52, 6);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 20, 20, 5);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc03_c(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, src, stride, stride, SIZE, 20, 52, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc13_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 52, 20, 6);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 20, 52, 6);\
-}\
-\
-static void OPNAME ## rv40_qpel ## SIZE ## _mc23_c(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    put_rv40_qpel ## SIZE ## _h_lowpass(full, src - 2*stride, SIZE, stride, SIZE+5, 20, 20, 5);\
-    OPNAME ## rv40_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE, SIZE, 20, 52, 6);\
-}\
-\
-
-#define op_avg(a, b)  a = (((a)+cm[b]+1)>>1)
-#define op_put(a, b)  a = cm[b]
-
-RV40_LOWPASS(put_       , op_put)
-RV40_LOWPASS(avg_       , op_avg)
-
-#undef op_avg
-#undef op_put
-
-RV40_MC(put_, 8)
-RV40_MC(put_, 16)
-RV40_MC(avg_, 8)
-RV40_MC(avg_, 16)
-
-static const int rv40_bias[4][4] = {
-    {  0, 16, 32, 16 },
-    { 32, 28, 32, 28 },
-    {  0, 32, 16, 32 },
-    { 32, 28, 32, 28 }
-};
-
-#define RV40_CHROMA_MC(OPNAME, OP)\
-static void OPNAME ## rv40_chroma_mc4_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    int i;\
-    int bias = rv40_bias[y>>1][x>>1];\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    if(D){\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + bias));\
-            OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + bias));\
-            OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + bias));\
-            OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + bias));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }else{\
-        const int E= B+C;\
-        const int step= C ? stride : 1;\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + E*src[step+0] + bias));\
-            OP(dst[1], (A*src[1] + E*src[step+1] + bias));\
-            OP(dst[2], (A*src[2] + E*src[step+2] + bias));\
-            OP(dst[3], (A*src[3] + E*src[step+3] + bias));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }\
-}\
-\
-static void OPNAME ## rv40_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    int i;\
-    int bias = rv40_bias[y>>1][x>>1];\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    if(D){\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1] + bias));\
-            OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + bias));\
-            OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + bias));\
-            OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + bias));\
-            OP(dst[4], (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + bias));\
-            OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + bias));\
-            OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + bias));\
-            OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + bias));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }else{\
-        const int E= B+C;\
-        const int step= C ? stride : 1;\
-        for(i=0; i<h; i++){\
-            OP(dst[0], (A*src[0] + E*src[step+0] + bias));\
-            OP(dst[1], (A*src[1] + E*src[step+1] + bias));\
-            OP(dst[2], (A*src[2] + E*src[step+2] + bias));\
-            OP(dst[3], (A*src[3] + E*src[step+3] + bias));\
-            OP(dst[4], (A*src[4] + E*src[step+4] + bias));\
-            OP(dst[5], (A*src[5] + E*src[step+5] + bias));\
-            OP(dst[6], (A*src[6] + E*src[step+6] + bias));\
-            OP(dst[7], (A*src[7] + E*src[step+7] + bias));\
-            dst+= stride;\
-            src+= stride;\
-        }\
-    }\
-}
-
-#define op_avg(a, b) a = (((a)+((b)>>6)+1)>>1)
-#define op_put(a, b) a = ((b)>>6)
-
-RV40_CHROMA_MC(put_, op_put)
-RV40_CHROMA_MC(avg_, op_avg)
-
-void ff_rv40dsp_init(DSPContext* c, AVCodecContext *avctx) {
-    c->put_rv40_qpel_pixels_tab[0][ 0] = c->put_h264_qpel_pixels_tab[0][0];
-    c->put_rv40_qpel_pixels_tab[0][ 1] = put_rv40_qpel16_mc10_c;
-    c->put_rv40_qpel_pixels_tab[0][ 2] = put_rv40_qpel16_mc20_c;
-    c->put_rv40_qpel_pixels_tab[0][ 3] = put_rv40_qpel16_mc30_c;
-    c->put_rv40_qpel_pixels_tab[0][ 4] = put_rv40_qpel16_mc01_c;
-    c->put_rv40_qpel_pixels_tab[0][ 5] = put_rv40_qpel16_mc11_c;
-    c->put_rv40_qpel_pixels_tab[0][ 6] = put_rv40_qpel16_mc21_c;
-    c->put_rv40_qpel_pixels_tab[0][ 7] = put_rv40_qpel16_mc31_c;
-    c->put_rv40_qpel_pixels_tab[0][ 8] = put_rv40_qpel16_mc02_c;
-    c->put_rv40_qpel_pixels_tab[0][ 9] = put_rv40_qpel16_mc12_c;
-    c->put_rv40_qpel_pixels_tab[0][10] = put_rv40_qpel16_mc22_c;
-    c->put_rv40_qpel_pixels_tab[0][11] = put_rv40_qpel16_mc32_c;
-    c->put_rv40_qpel_pixels_tab[0][12] = put_rv40_qpel16_mc03_c;
-    c->put_rv40_qpel_pixels_tab[0][13] = put_rv40_qpel16_mc13_c;
-    c->put_rv40_qpel_pixels_tab[0][14] = put_rv40_qpel16_mc23_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 0] = c->avg_h264_qpel_pixels_tab[0][0];
-    c->avg_rv40_qpel_pixels_tab[0][ 1] = avg_rv40_qpel16_mc10_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 2] = avg_rv40_qpel16_mc20_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 3] = avg_rv40_qpel16_mc30_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 4] = avg_rv40_qpel16_mc01_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 5] = avg_rv40_qpel16_mc11_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 6] = avg_rv40_qpel16_mc21_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 7] = avg_rv40_qpel16_mc31_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 8] = avg_rv40_qpel16_mc02_c;
-    c->avg_rv40_qpel_pixels_tab[0][ 9] = avg_rv40_qpel16_mc12_c;
-    c->avg_rv40_qpel_pixels_tab[0][10] = avg_rv40_qpel16_mc22_c;
-    c->avg_rv40_qpel_pixels_tab[0][11] = avg_rv40_qpel16_mc32_c;
-    c->avg_rv40_qpel_pixels_tab[0][12] = avg_rv40_qpel16_mc03_c;
-    c->avg_rv40_qpel_pixels_tab[0][13] = avg_rv40_qpel16_mc13_c;
-    c->avg_rv40_qpel_pixels_tab[0][14] = avg_rv40_qpel16_mc23_c;
-    c->put_rv40_qpel_pixels_tab[1][ 0] = c->put_h264_qpel_pixels_tab[1][0];
-    c->put_rv40_qpel_pixels_tab[1][ 1] = put_rv40_qpel8_mc10_c;
-    c->put_rv40_qpel_pixels_tab[1][ 2] = put_rv40_qpel8_mc20_c;
-    c->put_rv40_qpel_pixels_tab[1][ 3] = put_rv40_qpel8_mc30_c;
-    c->put_rv40_qpel_pixels_tab[1][ 4] = put_rv40_qpel8_mc01_c;
-    c->put_rv40_qpel_pixels_tab[1][ 5] = put_rv40_qpel8_mc11_c;
-    c->put_rv40_qpel_pixels_tab[1][ 6] = put_rv40_qpel8_mc21_c;
-    c->put_rv40_qpel_pixels_tab[1][ 7] = put_rv40_qpel8_mc31_c;
-    c->put_rv40_qpel_pixels_tab[1][ 8] = put_rv40_qpel8_mc02_c;
-    c->put_rv40_qpel_pixels_tab[1][ 9] = put_rv40_qpel8_mc12_c;
-    c->put_rv40_qpel_pixels_tab[1][10] = put_rv40_qpel8_mc22_c;
-    c->put_rv40_qpel_pixels_tab[1][11] = put_rv40_qpel8_mc32_c;
-    c->put_rv40_qpel_pixels_tab[1][12] = put_rv40_qpel8_mc03_c;
-    c->put_rv40_qpel_pixels_tab[1][13] = put_rv40_qpel8_mc13_c;
-    c->put_rv40_qpel_pixels_tab[1][14] = put_rv40_qpel8_mc23_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 0] = c->avg_h264_qpel_pixels_tab[1][0];
-    c->avg_rv40_qpel_pixels_tab[1][ 1] = avg_rv40_qpel8_mc10_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 2] = avg_rv40_qpel8_mc20_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 3] = avg_rv40_qpel8_mc30_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 4] = avg_rv40_qpel8_mc01_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 5] = avg_rv40_qpel8_mc11_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 6] = avg_rv40_qpel8_mc21_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 7] = avg_rv40_qpel8_mc31_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 8] = avg_rv40_qpel8_mc02_c;
-    c->avg_rv40_qpel_pixels_tab[1][ 9] = avg_rv40_qpel8_mc12_c;
-    c->avg_rv40_qpel_pixels_tab[1][10] = avg_rv40_qpel8_mc22_c;
-    c->avg_rv40_qpel_pixels_tab[1][11] = avg_rv40_qpel8_mc32_c;
-    c->avg_rv40_qpel_pixels_tab[1][12] = avg_rv40_qpel8_mc03_c;
-    c->avg_rv40_qpel_pixels_tab[1][13] = avg_rv40_qpel8_mc13_c;
-    c->avg_rv40_qpel_pixels_tab[1][14] = avg_rv40_qpel8_mc23_c;
-
-    c->put_rv40_chroma_pixels_tab[0]= put_rv40_chroma_mc8_c;
-    c->put_rv40_chroma_pixels_tab[1]= put_rv40_chroma_mc4_c;
-    c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_c;
-    c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_c;
-}
diff --git a/libavcodec/rv40vlc2.h b/libavcodec/rv40vlc2.h
deleted file mode 100644
index 15119a1..0000000
--- a/libavcodec/rv40vlc2.h
+++ /dev/null
@@ -1,706 +0,0 @@
-/*
- * RealVideo 4 decoder
- * copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RV40 VLC tables used for macroblock information decoding
- */
-
-#ifndef AVCODEC_RV40VLC2_H
-#define AVCODEC_RV40VLC2_H
-
-#include <stdint.h>
-
-/**
- * codes used for the first four block types
- */
-//@{
-#define AIC_TOP_BITS  8
-#define AIC_TOP_SIZE 16
-static const uint8_t rv40_aic_top_vlc_codes[AIC_TOP_SIZE] = {
- 0x01, 0x05, 0x01, 0x00, 0x03, 0x3D, 0x1D, 0x02,
- 0x04, 0x3C, 0x3F, 0x1C, 0x0D, 0x3E, 0x0C, 0x01
-};
-
-static const uint8_t rv40_aic_top_vlc_bits[AIC_TOP_SIZE] = {
- 1, 4, 5, 5, 5, 7, 6, 5, 4, 7, 7, 6, 5, 7, 5, 3
-};
-//@}
-
-/**
- * codes used for determining a pair of block types
- */
-//@{
-#define AIC_MODE2_NUM  20
-#define AIC_MODE2_SIZE 81
-#define AIC_MODE2_BITS  9
-
-static const uint16_t aic_mode2_vlc_codes[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
-{ 0x0001, 0x0001, 0x0005, 0x01F5, 0x0011, 0x0049, 0x0000, 0x0048, 0x004B,
-  0x0035, 0x0003, 0x0034, 0x03C9, 0x01F4, 0x00C9, 0x004A, 0x0FD9, 0x03C8,
-  0x0010, 0x0037, 0x0001, 0x00C8, 0x0075, 0x01F7, 0x00CB, 0x0074, 0x0002,
-  0x01F6, 0x00CA, 0x01F1, 0x01F0, 0x1F81, 0x07F9, 0x1F80, 0x1F83, 0x07F8,
-  0x0077, 0x00F5, 0x0036, 0x07FB, 0x0076, 0x1F82, 0x00F4, 0x00F7, 0x07FA,
-  0x0071, 0x00F6, 0x03CB, 0x03CA, 0x0FD8, 0x00F1, 0x03F5, 0x1F8D, 0x07E5,
-  0x0013, 0x0031, 0x00F0, 0x0FDB, 0x00F3, 0x07E4, 0x0030, 0x01F3, 0x07E7,
-  0x03F4, 0x07E6, 0x0070, 0x3F19, 0x01F2, 0x3F18, 0x0FDA, 0x0033, 0x07E1,
-  0x01FD, 0x01FC, 0x0073, 0x01FF, 0x0FC5, 0x0FC4, 0x0FC7, 0x03F7, 0x0072, },
-{ 0x0005, 0x0005, 0x0005, 0x0079, 0x0005, 0x000D, 0x001D, 0x0078, 0x0069,
-  0x0004, 0x0001, 0x0007, 0x0068, 0x001C, 0x001F, 0x0004, 0x006B, 0x000C,
-  0x0004, 0x001E, 0x0006, 0x006A, 0x0015, 0x000F, 0x0014, 0x0017, 0x0007,
-  0x0016, 0x000E, 0x0011, 0x0009, 0x00D1, 0x00D0, 0x0181, 0x00D3, 0x007B,
-  0x0010, 0x0013, 0x0004, 0x00D2, 0x0007, 0x0319, 0x0008, 0x007A, 0x00DD,
-  0x0019, 0x0006, 0x000B, 0x0065, 0x00DC, 0x0012, 0x0064, 0x0180, 0x00DF,
-  0x0006, 0x0018, 0x0001, 0x00DE, 0x001D, 0x00D9, 0x001B, 0x0067, 0x000A,
-  0x00D8, 0x00DB, 0x001C, 0x0318, 0x00DA, 0x0635, 0x0183, 0x0000, 0x00C5,
-  0x0066, 0x0061, 0x0035, 0x00C4, 0x0182, 0x0634, 0x031B, 0x00C7, 0x001F, },
-{ 0x0005, 0x0001, 0x001D, 0x01C1, 0x0035, 0x00F1, 0x006D, 0x00F0, 0x0049,
-  0x0000, 0x0004, 0x0003, 0x00F3, 0x0048, 0x0034, 0x006C, 0x01C0, 0x01C3,
-  0x0007, 0x0006, 0x0001, 0x006F, 0x0002, 0x004B, 0x006E, 0x001C, 0x0005,
-  0x0069, 0x0068, 0x006B, 0x0037, 0x01C2, 0x00F2, 0x0395, 0x01CD, 0x00FD,
-  0x006A, 0x0036, 0x0015, 0x01CC, 0x0014, 0x0394, 0x004A, 0x00FC, 0x00FF,
-  0x0017, 0x0031, 0x00FE, 0x01CF, 0x0397, 0x00F9, 0x01CE, 0x0725, 0x0396,
-  0x0016, 0x0030, 0x0075, 0x0724, 0x00F8, 0x0727, 0x0033, 0x0391, 0x0390,
-  0x0011, 0x0032, 0x001F, 0x00FB, 0x0074, 0x0726, 0x00FA, 0x001E, 0x0077,
-  0x0019, 0x0018, 0x0004, 0x0010, 0x003D, 0x0076, 0x0071, 0x0013, 0x0001, },
-{ 0x000D, 0x0019, 0x0011, 0x0015, 0x0061, 0x0019, 0x0014, 0x01AD, 0x0060,
-  0x0018, 0x0001, 0x0005, 0x001B, 0x0010, 0x0019, 0x0005, 0x0017, 0x0018,
-  0x0016, 0x0004, 0x0004, 0x0013, 0x000C, 0x0012, 0x001A, 0x0018, 0x0005,
-  0x000F, 0x001B, 0x0004, 0x001D, 0x0011, 0x001C, 0x0010, 0x000E, 0x001B,
-  0x0013, 0x001F, 0x001A, 0x0029, 0x0005, 0x0063, 0x001E, 0x0009, 0x0062,
-  0x0008, 0x0007, 0x0007, 0x0019, 0x0004, 0x001A, 0x0018, 0x006D, 0x0007,
-  0x001B, 0x0007, 0x001A, 0x006C, 0x0006, 0x0012, 0x0005, 0x006F, 0x000B,
-  0x006E, 0x0069, 0x001D, 0x0359, 0x0028, 0x002B, 0x002A, 0x001C, 0x00D5,
-  0x0358, 0x001F, 0x0001, 0x001E, 0x0068, 0x00D4, 0x00D7, 0x0019, 0x0000, },
-{ 0x00B9, 0x0061, 0x0060, 0x00B8, 0x02B5, 0x01AD, 0x00BB, 0x0AF5, 0x0151,
-  0x0001, 0x0001, 0x0005, 0x0000, 0x0003, 0x0005, 0x0004, 0x0063, 0x0025,
-  0x00BA, 0x0004, 0x0007, 0x0062, 0x00A5, 0x0024, 0x006D, 0x0002, 0x006C,
-  0x02B4, 0x000D, 0x006F, 0x0027, 0x00A4, 0x0026, 0x01AC, 0x0150, 0x01AF,
-  0x01AE, 0x0021, 0x006E, 0x02B7, 0x0020, 0x0153, 0x0023, 0x00A7, 0x0152,
-  0x00A6, 0x0006, 0x000C, 0x0022, 0x01A9, 0x0019, 0x002D, 0x02B6, 0x01A8,
-  0x000F, 0x0007, 0x000E, 0x00A1, 0x0069, 0x002C, 0x0001, 0x01AB, 0x00A0,
-  0x02B1, 0x00A3, 0x002F, 0x0AF4, 0x02B0, 0x0AF7, 0x02B3, 0x0068, 0x015D,
-  0x0AF6, 0x01AA, 0x0055, 0x015C, 0x02B2, 0x0579, 0x0578, 0x015F, 0x00A2, },
-{ 0x0905, 0x013D, 0x013C, 0x0904, 0x121D, 0x049D, 0x049C, 0x243D, 0x0907,
-  0x00ED, 0x0001, 0x0015, 0x0041, 0x013F, 0x0031, 0x0014, 0x025D, 0x025C,
-  0x013E, 0x000D, 0x0000, 0x0040, 0x0139, 0x0043, 0x0030, 0x0017, 0x0033,
-  0x0906, 0x0032, 0x0042, 0x00EC, 0x025F, 0x00EF, 0x025E, 0x049F, 0x0138,
-  0x0901, 0x013B, 0x0259, 0x121C, 0x049E, 0x0900, 0x0258, 0x243C, 0x121F,
-  0x0903, 0x003D, 0x00EE, 0x025B, 0x025A, 0x004D, 0x013A, 0x0902, 0x0245,
-  0x00E9, 0x0016, 0x00E8, 0x0499, 0x0125, 0x0244, 0x004C, 0x0498, 0x090D,
-  0x00EB, 0x003C, 0x0011, 0x049B, 0x049A, 0x0485, 0x00EA, 0x003F, 0x0124,
-  0x090C, 0x003E, 0x0039, 0x0095, 0x0247, 0x0246, 0x0484, 0x0094, 0x0038, },
-{ 0x0F09, 0x00CD, 0x01FD, 0x0791, 0x1E6D, 0x0790, 0x03D9, 0x3CD1, 0x3CD0,
-  0x0075, 0x0001, 0x0001, 0x0035, 0x00CC, 0x0011, 0x0000, 0x03D8, 0x01FC,
-  0x03DB, 0x0010, 0x0003, 0x00CF, 0x03DA, 0x00CE, 0x0074, 0x0034, 0x0077,
-  0x0793, 0x0013, 0x0076, 0x0071, 0x03C5, 0x0070, 0x01FF, 0x0792, 0x01FE,
-  0x01F9, 0x0037, 0x00C9, 0x0F08, 0x01F8, 0x03C4, 0x00C8, 0x0F0B, 0x079D,
-  0x03C7, 0x0001, 0x0012, 0x0073, 0x00CB, 0x0005, 0x0036, 0x03C6, 0x0072,
-  0x007D, 0x0002, 0x00CA, 0x079C, 0x01FB, 0x00F5, 0x0031, 0x079F, 0x0F0A,
-  0x0F35, 0x079E, 0x01FA, 0x1E6C, 0x1E6F, 0x3CD3, 0x0799, 0x03C1, 0x1E6E,
-  0x3CD2, 0x0030, 0x00F4, 0x007C, 0x03C0, 0x03C3, 0x0798, 0x01E5, 0x00F7, },
-{ 0x01A5, 0x0001, 0x001D, 0x0021, 0x00A1, 0x000D, 0x0061, 0x06B9, 0x00A0,
-  0x0060, 0x0001, 0x0005, 0x000C, 0x0020, 0x001C, 0x0004, 0x01A4, 0x01A7,
-  0x00A3, 0x001F, 0x001E, 0x0023, 0x0022, 0x002D, 0x002C, 0x0063, 0x0062,
-  0x1A81, 0x01A6, 0x01A1, 0x06B8, 0x06BB, 0x00A2, 0x06BA, 0x0D59, 0x06A5,
-  0x01A0, 0x000F, 0x006D, 0x06A4, 0x002F, 0x00AD, 0x006C, 0x06A7, 0x00AC,
-  0x0D58, 0x000E, 0x01A3, 0x00AF, 0x00AE, 0x006F, 0x01A2, 0x0D5B, 0x00A9,
-  0x0019, 0x0001, 0x0009, 0x00A8, 0x006E, 0x002E, 0x0000, 0x01AD, 0x00AB,
-  0x00AA, 0x0355, 0x0029, 0x1A80, 0x1A83, 0x1A82, 0x0354, 0x01AC, 0x0D5A,
-  0x1A8D, 0x01AF, 0x0357, 0x0D45, 0x0D44, 0x0D47, 0x1A8C, 0x06A6, 0x06A1, },
-{ 0x0001, 0x0011, 0x0005, 0x0775, 0x00F9, 0x00F8, 0x0031, 0x0030, 0x0049,
-  0x00FB, 0x0010, 0x0033, 0x0EC9, 0x038D, 0x038C, 0x00FA, 0x038F, 0x0774,
-  0x0048, 0x0032, 0x0000, 0x01D5, 0x00E5, 0x038E, 0x00E4, 0x0013, 0x000D,
-  0x0389, 0x0777, 0x0388, 0x038B, 0x1DF9, 0x0EC8, 0x3BC9, 0x1DF8, 0x038A,
-  0x03B5, 0x0776, 0x00E7, 0x3BC8, 0x01D4, 0x3BCB, 0x0ECB, 0x0771, 0x0ECA,
-  0x01D7, 0x03B4, 0x01D6, 0x1DFB, 0x0EF5, 0x0770, 0x0EF4, 0x3BCA, 0x0773,
-  0x00E6, 0x03B7, 0x004B, 0x1DFA, 0x03B6, 0x0EF7, 0x00E1, 0x0EF6, 0x0EF1,
-  0x03B1, 0x01D1, 0x003D, 0x0EF0, 0x0772, 0x077D, 0x077C, 0x003C, 0x01D0,
-  0x03B0, 0x01D3, 0x003F, 0x03B3, 0x01D2, 0x0EF3, 0x077F, 0x00E0, 0x004A, },
-{ 0x0015, 0x0049, 0x0014, 0x07D1, 0x03FD, 0x03FC, 0x01C1, 0x01C0, 0x00F1,
-  0x0017, 0x0001, 0x0001, 0x01C3, 0x0048, 0x004B, 0x0016, 0x0031, 0x01C2,
-  0x004A, 0x0011, 0x0000, 0x01CD, 0x00F0, 0x01CC, 0x0075, 0x0010, 0x000D,
-  0x03FF, 0x01CF, 0x01CE, 0x07D0, 0x0F81, 0x07D3, 0x1F1D, 0x0F80, 0x07D2,
-  0x01C9, 0x03FE, 0x0074, 0x07DD, 0x00F3, 0x1F1C, 0x07DC, 0x03F9, 0x07DF,
-  0x00F2, 0x00FD, 0x0077, 0x07DE, 0x07D9, 0x01C8, 0x07D8, 0x0F83, 0x03F8,
-  0x0030, 0x0076, 0x0013, 0x0F82, 0x00FC, 0x03FB, 0x0033, 0x03FA, 0x03E5,
-  0x03E4, 0x01CB, 0x0032, 0x1F1F, 0x03E7, 0x07DB, 0x07DA, 0x003D, 0x01CA,
-  0x07C5, 0x03E6, 0x0071, 0x0F8D, 0x07C4, 0x1F1E, 0x0F8C, 0x03E1, 0x01F5, },
-{ 0x0019, 0x0065, 0x0018, 0x0351, 0x0350, 0x0353, 0x0021, 0x0020, 0x0064,
-  0x001D, 0x0005, 0x0005, 0x01A5, 0x0023, 0x0067, 0x0005, 0x0066, 0x0022,
-  0x001B, 0x0004, 0x0001, 0x0004, 0x001C, 0x0061, 0x001A, 0x0005, 0x0004,
-  0x0007, 0x002D, 0x0006, 0x002C, 0x01A4, 0x002F, 0x0352, 0x035D, 0x0060,
-  0x0001, 0x002E, 0x001F, 0x035C, 0x0000, 0x06B1, 0x01A7, 0x0029, 0x01A6,
-  0x0028, 0x0063, 0x0062, 0x035F, 0x01A1, 0x002B, 0x06B0, 0x06B3, 0x01A0,
-  0x0003, 0x006D, 0x001E, 0x035E, 0x006C, 0x06B2, 0x0002, 0x01A3, 0x01A2,
-  0x000D, 0x0005, 0x0007, 0x01AD, 0x006F, 0x002A, 0x006E, 0x0004, 0x0004,
-  0x000C, 0x0007, 0x0006, 0x000F, 0x000E, 0x00D5, 0x0009, 0x0006, 0x0007, },
-{ 0x0065, 0x0181, 0x0064, 0x36C9, 0x06D5, 0x0DB5, 0x0379, 0x0180, 0x0183,
-  0x00D5, 0x001D, 0x001C, 0x0DB4, 0x0182, 0x0378, 0x00D4, 0x00D7, 0x06D4,
-  0x0067, 0x001F, 0x0001, 0x00D6, 0x00D1, 0x018D, 0x0066, 0x0001, 0x0000,
-  0x037B, 0x06D7, 0x037A, 0x0DB7, 0x36C8, 0x06D6, 0x0DB6, 0x1B79, 0x0DB1,
-  0x018C, 0x0365, 0x00D0, 0x1B78, 0x00D3, 0x1B7B, 0x0364, 0x06D1, 0x06D0,
-  0x018F, 0x018E, 0x00D2, 0x36CB, 0x0367, 0x0366, 0x06D3, 0x0DB0, 0x06D2,
-  0x0361, 0x06DD, 0x0189, 0x36CA, 0x0360, 0x36F5, 0x0188, 0x0DB3, 0x36F4,
-  0x0009, 0x0008, 0x0005, 0x06DC, 0x00DD, 0x018B, 0x00DC, 0x0004, 0x000B,
-  0x018A, 0x0061, 0x0003, 0x0363, 0x00DF, 0x06DF, 0x0362, 0x000A, 0x001E, },
-{ 0x001D, 0x0061, 0x000D, 0x0D55, 0x06B9, 0x06B8, 0x01A5, 0x0021, 0x0020,
-  0x0023, 0x000C, 0x0060, 0x0D54, 0x00AD, 0x00AC, 0x0022, 0x00AF, 0x06BB,
-  0x000F, 0x001C, 0x0001, 0x002D, 0x0063, 0x01A4, 0x000E, 0x0001, 0x0005,
-  0x01A7, 0x06BA, 0x01A6, 0x06A5, 0x0D57, 0x0D56, 0x1ABD, 0x0D51, 0x00AE,
-  0x002C, 0x00A9, 0x002F, 0x0D50, 0x01A1, 0x1ABC, 0x06A4, 0x06A7, 0x06A6,
-  0x00A8, 0x06A1, 0x01A0, 0x1ABF, 0x0D53, 0x06A0, 0x0D52, 0x1ABE, 0x06A3,
-  0x0062, 0x002E, 0x0009, 0x0D5D, 0x01A3, 0x0D5C, 0x006D, 0x00AB, 0x06A2,
-  0x006C, 0x001F, 0x0001, 0x06AD, 0x0029, 0x01A2, 0x0028, 0x0004, 0x001E,
-  0x01AD, 0x006F, 0x0000, 0x01AC, 0x01AF, 0x06AC, 0x00AA, 0x006E, 0x0019, },
-{ 0x0019, 0x007D, 0x0018, 0x01B5, 0x000D, 0x01B4, 0x007C, 0x007F, 0x01B7,
-  0x000C, 0x001B, 0x001A, 0x01B6, 0x000F, 0x00D5, 0x0019, 0x007E, 0x00D4,
-  0x0018, 0x001B, 0x0001, 0x000E, 0x0011, 0x0009, 0x0005, 0x0005, 0x0005,
-  0x00D7, 0x01B1, 0x0008, 0x01B0, 0x0079, 0x06FD, 0x0371, 0x0370, 0x00D6,
-  0x0078, 0x01B3, 0x0010, 0x0373, 0x0013, 0x06FC, 0x007B, 0x007A, 0x00D1,
-  0x00D0, 0x00D3, 0x0065, 0x0372, 0x06FF, 0x0064, 0x06FE, 0x037D, 0x00D2,
-  0x00DD, 0x0067, 0x0004, 0x037C, 0x0012, 0x01B2, 0x0007, 0x0066, 0x01BD,
-  0x0006, 0x0061, 0x0004, 0x01BC, 0x001A, 0x0060, 0x001D, 0x0004, 0x001C,
-  0x0063, 0x0001, 0x0007, 0x000B, 0x0000, 0x0062, 0x000A, 0x0005, 0x0007, },
-{ 0x0069, 0x0045, 0x0068, 0x04BD, 0x0255, 0x04BC, 0x00E5, 0x00E4, 0x0031,
-  0x0030, 0x0019, 0x0001, 0x0121, 0x00E7, 0x00E6, 0x0033, 0x00E1, 0x00E0,
-  0x006B, 0x0018, 0x0001, 0x0044, 0x0032, 0x0047, 0x006A, 0x001B, 0x0005,
-  0x003D, 0x0046, 0x0015, 0x0041, 0x0120, 0x0123, 0x04BF, 0x0122, 0x0040,
-  0x003C, 0x00E3, 0x0014, 0x0254, 0x0043, 0x0975, 0x012D, 0x00E2, 0x00ED,
-  0x0042, 0x00EC, 0x004D, 0x0257, 0x0256, 0x0251, 0x04BE, 0x0974, 0x0250,
-  0x00EF, 0x00EE, 0x004C, 0x04B9, 0x012C, 0x04B8, 0x004F, 0x04BB, 0x0253,
-  0x003F, 0x0017, 0x0001, 0x0252, 0x00E9, 0x00E8, 0x00EB, 0x0000, 0x0003,
-  0x0016, 0x0002, 0x0004, 0x004E, 0x003E, 0x00EA, 0x0049, 0x000D, 0x0007, },
-{ 0x000D, 0x01BD, 0x000C, 0x0D31, 0x0D30, 0x0D33, 0x0359, 0x0358, 0x002D,
-  0x0065, 0x001D, 0x001C, 0x0D32, 0x035B, 0x035A, 0x002C, 0x01BC, 0x0345,
-  0x000F, 0x001F, 0x0001, 0x002F, 0x0064, 0x01BF, 0x0067, 0x0001, 0x0005,
-  0x0066, 0x002E, 0x0061, 0x0029, 0x0695, 0x0694, 0x0697, 0x0696, 0x0060,
-  0x01BE, 0x0D3D, 0x0028, 0x1A49, 0x0344, 0x1A48, 0x1A4B, 0x0D3C, 0x0691,
-  0x002B, 0x01B9, 0x002A, 0x0D3F, 0x0690, 0x0347, 0x0D3E, 0x1A4A, 0x0346,
-  0x00D5, 0x0341, 0x0063, 0x0D39, 0x0340, 0x0D38, 0x01B8, 0x0D3B, 0x0D3A,
-  0x00D4, 0x0062, 0x0000, 0x0693, 0x01BB, 0x0343, 0x0342, 0x001E, 0x000E,
-  0x006D, 0x0009, 0x0001, 0x006C, 0x00D7, 0x034D, 0x01BA, 0x0008, 0x0004, },
-{ 0x0075, 0x00CD, 0x0035, 0x03C1, 0x03C0, 0x07F9, 0x03C3, 0x1F8D, 0x00CC,
-  0x0074, 0x0011, 0x0010, 0x03C2, 0x0FD9, 0x01F1, 0x00CF, 0x03CD, 0x00CE,
-  0x0034, 0x0001, 0x0001, 0x0037, 0x00C9, 0x00C8, 0x0036, 0x0000, 0x0001,
-  0x0FD8, 0x03CC, 0x00CB, 0x01F0, 0x07F8, 0x03CF, 0x07FB, 0x07FA, 0x00CA,
-  0x01F3, 0x03CE, 0x00F5, 0x0FDB, 0x00F4, 0x07E5, 0x07E4, 0x07E7, 0x01F2,
-  0x07E6, 0x03C9, 0x01FD, 0x0FDA, 0x1F8C, 0x07E1, 0x1F8F, 0x1F8E, 0x03C8,
-  0x03CB, 0x0077, 0x0076, 0x0FC5, 0x03CA, 0x07E0, 0x00F7, 0x0FC4, 0x03F5,
-  0x00F6, 0x01FC, 0x0003, 0x03F4, 0x0071, 0x03F7, 0x00F1, 0x0013, 0x0031,
-  0x0030, 0x0070, 0x0005, 0x0012, 0x0073, 0x01FF, 0x0072, 0x007D, 0x0002, },
-{ 0x0061, 0x0055, 0x0060, 0x02C9, 0x02C8, 0x02CB, 0x0171, 0x00B5, 0x0054,
-  0x0001, 0x0001, 0x0001, 0x0057, 0x0001, 0x0063, 0x001D, 0x0062, 0x0039,
-  0x006D, 0x0000, 0x0005, 0x0038, 0x0056, 0x00B4, 0x006C, 0x0003, 0x001C,
-  0x006F, 0x003B, 0x0002, 0x003A, 0x0170, 0x00B7, 0x0173, 0x0051, 0x006E,
-  0x0025, 0x0050, 0x0069, 0x02CA, 0x0024, 0x0027, 0x0172, 0x00B6, 0x00B1,
-  0x000D, 0x000C, 0x001F, 0x017D, 0x0026, 0x0068, 0x0053, 0x017C, 0x006B,
-  0x001E, 0x000F, 0x0004, 0x017F, 0x006A, 0x02F5, 0x0019, 0x0021, 0x0052,
-  0x02F4, 0x02F7, 0x0020, 0x0BCD, 0x05E5, 0x05E4, 0x0BCC, 0x0023, 0x00B0,
-  0x02F6, 0x00B3, 0x0022, 0x02F1, 0x02F0, 0x0BCF, 0x0BCE, 0x017E, 0x005D, },
-{ 0x00BD, 0x0025, 0x01A1, 0x0159, 0x0299, 0x00BC, 0x0024, 0x0505, 0x0504,
-  0x01A0, 0x0001, 0x001D, 0x006D, 0x001C, 0x0001, 0x0005, 0x0027, 0x01A3,
-  0x0158, 0x001F, 0x001E, 0x01A2, 0x0026, 0x0021, 0x000D, 0x0020, 0x0023,
-  0x0298, 0x006C, 0x0022, 0x00BF, 0x00BE, 0x01AD, 0x002D, 0x029B, 0x00B9,
-  0x01AC, 0x00B8, 0x01AF, 0x029A, 0x006F, 0x015B, 0x006E, 0x0285, 0x0284,
-  0x01AE, 0x0019, 0x002C, 0x01A9, 0x01A8, 0x000C, 0x000F, 0x015A, 0x00BB,
-  0x000E, 0x0000, 0x0069, 0x01AB, 0x0018, 0x01AA, 0x0004, 0x0055, 0x00BA,
-  0x0507, 0x0145, 0x0054, 0x0506, 0x00A5, 0x0501, 0x00A4, 0x0057, 0x0500,
-  0x0A05, 0x0144, 0x00A7, 0x0287, 0x0286, 0x0503, 0x0147, 0x0A04, 0x0146, },
-{ 0x0759, 0x0041, 0x00E5, 0x03BD, 0x0E9D, 0x012D, 0x012C, 0x3A1D, 0x03BC,
-  0x012F, 0x000D, 0x0040, 0x00E4, 0x03BF, 0x0043, 0x0042, 0x0758, 0x03BE,
-  0x00E7, 0x0001, 0x0000, 0x003D, 0x00E6, 0x0015, 0x0014, 0x0017, 0x003C,
-  0x743D, 0x012E, 0x03B9, 0x03B8, 0x0E9C, 0x03BB, 0x075B, 0x3A1C, 0x0E9F,
-  0x0129, 0x00E1, 0x0128, 0x0E9E, 0x012B, 0x075A, 0x00E0, 0x0E99, 0x0745,
-  0x3A1F, 0x03BA, 0x0744, 0x0E98, 0x1D0D, 0x03A5, 0x0E9B, 0x743C, 0x0E9A,
-  0x012A, 0x004D, 0x00E3, 0x0E85, 0x01D5, 0x0E84, 0x004C, 0x0747, 0x1D0C,
-  0x01D4, 0x003F, 0x0016, 0x0746, 0x03A4, 0x0741, 0x004F, 0x003E, 0x01D7,
-  0x0740, 0x000C, 0x0011, 0x004E, 0x00E2, 0x00ED, 0x00EC, 0x0049, 0x0048, },
-};
-
-static const uint8_t aic_mode2_vlc_bits[AIC_MODE2_NUM][AIC_MODE2_SIZE] = {
-{  1,  5,  4, 10,  6,  8,  5,  8,  8,
-   7,  5,  7, 11, 10,  9,  8, 13, 11,
-   6,  7,  3,  9,  8, 10,  9,  8,  5,
-  10,  9, 10, 10, 14, 12, 14, 14, 12,
-   8,  9,  7, 12,  8, 14,  9,  9, 12,
-   8,  9, 11, 11, 13,  9, 11, 14, 12,
-   6,  7,  9, 13,  9, 12,  7, 10, 12,
-  11, 12,  8, 15, 10, 15, 13,  7, 12,
-  10, 10,  8, 10, 13, 13, 13, 11,  8, },
-{  4,  6,  5, 11,  8, 10,  7, 11,  9,
-   4,  1,  4,  9,  7,  7,  5,  9, 10,
-   6,  7,  4,  9,  9, 10,  9,  9,  6,
-   9, 10,  9, 10, 12, 12, 13, 12, 11,
-   9,  9,  8, 12,  8, 14, 10, 11, 12,
-   7,  8, 10, 11, 12,  9, 11, 13, 12,
-   6,  7,  8, 12,  9, 12,  7, 11, 10,
-  12, 12,  9, 14, 12, 15, 13,  8, 12,
-  11, 11, 10, 12, 13, 15, 14, 12,  9, },
-{  5,  7,  6, 12,  9, 11,  8, 11, 10,
-   7,  5,  7, 11, 10,  9,  8, 12, 12,
-   5,  5,  1,  8,  7, 10,  8,  6,  4,
-   8,  8,  8,  9, 12, 11, 13, 12, 11,
-   8,  9,  8, 12,  8, 13, 10, 11, 11,
-   8,  9, 11, 12, 13, 11, 12, 14, 13,
-   8,  9, 10, 14, 11, 14,  9, 13, 13,
-   8,  9,  6, 11, 10, 14, 11,  6, 10,
-   6,  6,  4,  8,  9, 10, 10,  8,  5, },
-{ 11,  7,  8, 10, 12,  9, 10, 14, 12,
-   7,  1,  5,  7,  8,  6,  4, 10,  9,
-  10,  5,  4,  8, 11,  8,  7,  6,  7,
-  11,  6,  7,  8, 10,  8, 10, 11,  9,
-  10,  8,  9, 13,  9, 12,  8, 11, 12,
-  11,  4,  7,  8,  9,  6,  8, 12,  9,
-   8,  5,  8, 12,  9, 10,  6, 12, 11,
-  12, 12, 10, 15, 13, 13, 13, 10, 13,
-  15, 10,  9, 10, 12, 13, 13, 10,  9, },
-{ 11,  8,  8, 11, 13, 10, 11, 15, 12,
-   7,  1,  4,  7,  7,  5,  4,  8,  9,
-  11,  5,  5,  8, 11,  9,  8,  7,  8,
-  13,  7,  8,  9, 11,  9, 10, 12, 10,
-  10,  9,  8, 13,  9, 12,  9, 11, 12,
-  11,  5,  7,  9, 10,  6,  9, 13, 10,
-   7,  4,  7, 11,  8,  9,  5, 10, 11,
-  13, 11,  9, 15, 13, 15, 13,  8, 12,
-  15, 10, 10, 12, 13, 14, 14, 12, 11, },
-{ 12,  9,  9, 12, 13, 11, 11, 14, 12,
-   8,  2,  5,  7,  9,  6,  5, 10, 10,
-   9,  4,  2,  7,  9,  7,  6,  5,  6,
-  12,  6,  7,  8, 10,  8, 10, 11,  9,
-  12,  9, 10, 13, 11, 12, 10, 14, 13,
-  12,  6,  8, 10, 10,  7,  9, 12, 10,
-   8,  5,  8, 11,  9, 10,  7, 11, 12,
-   8,  6,  5, 11, 11, 11,  8,  6,  9,
-  12,  6,  6,  8, 10, 10, 11,  8,  6, },
-{ 13,  9, 10, 12, 14, 12, 11, 15, 15,
-   8,  1,  5,  7,  9,  6,  5, 11, 10,
-  11,  6,  5,  9, 11,  9,  8,  7,  8,
-  12,  6,  8,  8, 11,  8, 10, 12, 10,
-  10,  7,  9, 13, 10, 11,  9, 13, 12,
-  11,  3,  6,  8,  9,  4,  7, 11,  8,
-   8,  5,  9, 12, 10,  9,  7, 12, 13,
-  13, 12, 10, 14, 14, 15, 12, 11, 14,
-  15,  7,  9,  8, 11, 11, 12, 10,  9, },
-{ 10,  5,  6,  9, 11,  7,  8, 12, 11,
-   8,  1,  4,  7,  9,  6,  4, 10, 10,
-  11,  6,  6,  9,  9,  9,  9,  8,  8,
-  14, 10, 10, 12, 12, 11, 12, 13, 12,
-  10,  7,  8, 12,  9, 11,  8, 12, 11,
-  13,  7, 10, 11, 11,  8, 10, 13, 11,
-   6,  3,  7, 11,  8,  9,  5, 10, 11,
-  11, 11,  9, 14, 14, 14, 11, 10, 13,
-  14, 10, 11, 13, 13, 13, 14, 12, 12, },
-{  2,  5,  3, 11,  8,  8,  6,  6,  7,
-   8,  5,  6, 12, 10, 10,  8, 10, 11,
-   7,  6,  2,  9,  8, 10,  8,  5,  4,
-  10, 11, 10, 10, 13, 12, 14, 13, 10,
-  10, 11,  8, 14,  9, 14, 12, 11, 12,
-   9, 10,  9, 13, 12, 11, 12, 14, 11,
-   8, 10,  7, 13, 10, 12,  8, 12, 12,
-  10,  9,  6, 12, 11, 11, 11,  6,  9,
-  10,  9,  6, 10,  9, 12, 11,  8,  7, },
-{  6,  8,  6, 12, 11, 11, 10, 10,  9,
-   6,  1,  3, 10,  8,  8,  6,  7, 10,
-   8,  6,  3, 10,  9, 10,  8,  6,  5,
-  11, 10, 10, 12, 13, 12, 14, 13, 12,
-  10, 11,  8, 12,  9, 14, 12, 11, 12,
-   9,  9,  8, 12, 12, 10, 12, 13, 11,
-   7,  8,  6, 13,  9, 11,  7, 11, 11,
-  11, 10,  7, 14, 11, 12, 12,  7, 10,
-  12, 11,  8, 13, 12, 14, 13, 11, 10, },
-{  7, 10,  7, 13, 13, 13, 11, 11, 10,
-   8,  5,  6, 12, 11, 10,  9, 10, 11,
-   7,  5,  1,  9,  8, 10,  7,  4,  4,
-   9, 11,  9, 11, 12, 11, 13, 13, 10,
-   9, 11,  8, 13,  9, 14, 12, 11, 12,
-  11, 10, 10, 13, 12, 11, 14, 14, 12,
-   9, 10,  8, 13, 10, 14,  9, 12, 12,
-   9,  7,  4, 12, 10, 11, 10,  6,  7,
-   9,  7,  4,  9,  9, 11,  9,  7,  5, },
-{  7,  9,  7, 14, 11, 12, 10,  9,  9,
-   8,  5,  5, 12,  9, 10,  8,  8, 11,
-   7,  5,  2,  8,  8,  9,  7,  4,  4,
-  10, 11, 10, 12, 14, 11, 12, 13, 12,
-   9, 10,  8, 13,  8, 13, 10, 11, 11,
-   9,  9,  8, 14, 10, 10, 11, 12, 11,
-  10, 11,  9, 14, 10, 14,  9, 12, 14,
-   6,  6,  3, 11,  8,  9,  8,  3,  6,
-   9,  7,  4, 10,  8, 11, 10,  6,  5, },
-{  6,  8,  7, 13, 12, 12, 10,  9,  9,
-   9,  7,  8, 13, 11, 11,  9, 11, 12,
-   7,  6,  1,  9,  8, 10,  7,  5,  4,
-  10, 12, 10, 12, 13, 13, 14, 13, 11,
-   9, 11,  9, 13, 10, 14, 12, 12, 12,
-  11, 12, 10, 14, 13, 12, 13, 14, 12,
-   8,  9,  7, 13, 10, 13,  8, 11, 12,
-   8,  6,  3, 12,  9, 10,  9,  4,  6,
-  10,  8,  5, 10, 10, 12, 11,  8,  6, },
-{  7, 10,  7, 12,  9, 12, 10, 10, 12,
-   9,  7,  7, 12,  9, 11,  6, 10, 11,
-   6,  6,  1,  9,  8,  9,  7,  4,  5,
-  11, 12,  9, 12, 10, 14, 13, 13, 11,
-  10, 12,  8, 13,  8, 14, 10, 10, 11,
-  11, 11, 10, 13, 14, 10, 14, 13, 11,
-  11, 10,  7, 13,  8, 12,  7, 10, 12,
-   7, 10,  4, 12,  6, 10,  8,  5,  8,
-  10,  7,  4,  9,  7, 10,  9,  6,  5, },
-{  7,  9,  7, 13, 12, 13, 10, 10,  8,
-   8,  5,  6, 11, 10, 10,  8, 10, 10,
-   7,  5,  2,  9,  8,  9,  7,  5,  3,
-   8,  9,  7,  9, 11, 11, 13, 11,  9,
-   8, 10,  7, 12,  9, 14, 11, 10, 10,
-   9, 10,  9, 12, 12, 12, 13, 14, 12,
-  10, 10,  9, 13, 11, 13,  9, 13, 12,
-   8,  7,  4, 12, 10, 10, 10,  6,  6,
-   7,  6,  3,  9,  8, 10,  9,  6,  3, },
-{  7, 10,  7, 13, 13, 13, 11, 11,  9,
-   8,  6,  6, 13, 11, 11,  9, 10, 11,
-   7,  6,  1,  9,  8, 10,  8,  5,  4,
-   8,  9,  8,  9, 12, 12, 12, 12,  8,
-  10, 13,  9, 14, 11, 14, 14, 13, 12,
-   9, 10,  9, 13, 12, 11, 13, 14, 11,
-   9, 11,  8, 13, 11, 13, 10, 13, 13,
-   9,  8,  5, 12, 10, 11, 11,  6,  7,
-   8,  7,  3,  8,  9, 11, 10,  7,  4, },
-{  8,  9,  7, 11, 11, 12, 11, 14,  9,
-   8,  6,  6, 11, 13, 10,  9, 11,  9,
-   7,  5,  1,  7,  9,  9,  7,  5,  3,
-  13, 11,  9, 10, 12, 11, 12, 12,  9,
-  10, 11,  9, 13,  9, 12, 12, 12, 10,
-  12, 11, 10, 13, 14, 12, 14, 14, 11,
-  11,  8,  8, 13, 11, 12,  9, 13, 11,
-   9, 10,  5, 11,  8, 11,  9,  6,  7,
-   7,  8,  4,  6,  8, 10,  8,  8,  5, },
-{  8, 10,  8, 13, 13, 13, 12, 11, 10,
-   5,  1,  3, 10,  7,  8,  6,  8,  9,
-   8,  7,  4,  9, 10, 11,  8,  7,  6,
-   8,  9,  7,  9, 12, 11, 12, 10,  8,
-   9, 10,  8, 13,  9,  9, 12, 11, 11,
-   7,  7,  6, 12,  9,  8, 10, 12,  8,
-   6,  7,  4, 12,  8, 13,  6,  9, 10,
-  13, 13,  9, 15, 14, 14, 15,  9, 11,
-  13, 11,  9, 13, 13, 15, 15, 12, 10, },
-{ 10,  8,  9, 11, 12, 10,  8, 13, 13,
-   9,  2,  5,  7,  5,  4,  3,  8,  9,
-  11,  5,  5,  9,  8,  8,  6,  8,  8,
-  12,  7,  8, 10, 10,  9,  8, 12, 10,
-   9, 10,  9, 12,  7, 11,  7, 12, 12,
-   9,  5,  8,  9,  9,  6,  6, 11, 10,
-   6,  4,  7,  9,  5,  9,  3,  9, 10,
-  13, 11,  9, 13, 10, 13, 10,  9, 13,
-  14, 11, 10, 12, 12, 13, 11, 14, 11, },
-{ 11,  7,  8, 10, 12,  9,  9, 14, 10,
-   9,  4,  7,  8, 10,  7,  7, 11, 10,
-   8,  2,  2,  6,  8,  5,  5,  5,  6,
-  15,  9, 10, 10, 12, 10, 11, 14, 12,
-   9,  8,  9, 12,  9, 11,  8, 12, 11,
-  14, 10, 11, 12, 13, 10, 12, 15, 12,
-   9,  7,  8, 12,  9, 12,  7, 11, 13,
-   9,  6,  5, 11, 10, 11,  7,  6,  9,
-  11,  4,  5,  7,  8,  8,  8,  7,  7, },
-};
-//@}
-
-/**
- * Codes used for determining block type
- */
-//@{
-#define AIC_MODE1_NUM  90
-#define AIC_MODE1_SIZE  9
-#define AIC_MODE1_BITS  7
-
-static const uint8_t aic_mode1_vlc_codes[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
- { 0x01, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x10, 0x05,},
- { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x11, 0x09, 0x10, 0x05, 0x00, 0x03,},
- { 0x01, 0x01, 0x00, 0x03, 0x21, 0x05, 0x09, 0x20, 0x11,},
- { 0x01, 0x09, 0x00, 0x29, 0x08, 0x15, 0x03, 0x0B, 0x28,},
- { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x01, 0x09, 0x08,},
- { 0x01, 0x01, 0x01, 0x09, 0x01, 0x08, 0x00, 0x03, 0x05,},
- { 0x01, 0x01, 0x01, 0x00, 0x05, 0x11, 0x09, 0x10, 0x03,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x00, 0x03, 0x09, 0x08,},
- { 0x09, 0x01, 0x01, 0x05, 0x11, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x0D, 0x05, 0x04, 0x00, 0x07, 0x0C,},
- { 0x01, 0x01, 0x00, 0x05, 0x11, 0x03, 0x09, 0x21, 0x20,},
- { 0x05, 0x01, 0x01, 0x11, 0x00, 0x09, 0x03, 0x21, 0x20,},
- { 0x09, 0x01, 0x01, 0x00, 0x05, 0x01, 0x03, 0x11, 0x10,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x09, 0x00, 0x05, 0x01, 0x03, 0x08,},
- { 0x01, 0x01, 0x01, 0x09, 0x11, 0x05, 0x00, 0x10, 0x03,},
- { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x01, 0x09, 0x08, 0x15, 0x14, 0x0B, 0x03,},
- { 0x0D, 0x01, 0x01, 0x05, 0x0C, 0x04, 0x01, 0x00, 0x07,},
- { 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x03, 0x01, 0x01,},
- { 0x05, 0x01, 0x01, 0x04, 0x19, 0x07, 0x18, 0x0D, 0x00,},
- { 0x11, 0x09, 0x01, 0x21, 0x05, 0x20, 0x01, 0x00, 0x03,},
- { 0x41, 0x01, 0x00, 0x05, 0x40, 0x03, 0x09, 0x21, 0x11,},
- { 0x29, 0x01, 0x00, 0x28, 0x09, 0x15, 0x03, 0x08, 0x0B,},
- { 0x01, 0x00, 0x01, 0x11, 0x09, 0x10, 0x05, 0x01, 0x03,},
- { 0x05, 0x01, 0x01, 0x04, 0x0D, 0x0C, 0x07, 0x00, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x03, 0x05, 0x11, 0x10, 0x25, 0x24, 0x13,},
- { 0x21, 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x20, 0x09,},
- { 0x01, 0x01, 0x01, 0x00, 0x09, 0x11, 0x10, 0x05, 0x03,},
- { 0x21, 0x05, 0x01, 0x01, 0x09, 0x00, 0x11, 0x20, 0x03,},
- { 0x05, 0x01, 0x00, 0x04, 0x01, 0x19, 0x07, 0x18, 0x0D,},
- { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x03, 0x10, 0x05,},
- { 0x1D, 0x01, 0x05, 0x0D, 0x0C, 0x04, 0x00, 0x1C, 0x0F,},
- { 0x05, 0x19, 0x01, 0x04, 0x00, 0x18, 0x1B, 0x1A, 0x07,},
- { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x11, 0x10, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x00, 0x03, 0x41, 0x05, 0x40, 0x09, 0x11, 0x21,},
- { 0x05, 0x01, 0x01, 0x19, 0x04, 0x07, 0x00, 0x18, 0x0D,},
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x01, 0x00, 0x03,},
- { 0x01, 0x05, 0x00, 0x0D, 0x01, 0x04, 0x07, 0x19, 0x18,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x31, 0x01, 0x05, 0x19, 0x04, 0x07, 0x00, 0x30, 0x0D,},
- { 0x01, 0x00, 0x03, 0x11, 0x01, 0x05, 0x01, 0x09, 0x10,},
- { 0x01, 0x05, 0x01, 0x11, 0x01, 0x10, 0x00, 0x03, 0x09,},
- { 0x01, 0x09, 0x00, 0x29, 0x03, 0x08, 0x28, 0x15, 0x0B,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x00, 0x09, 0x15, 0x03, 0x08, 0x14, 0x0B,},
- { 0x11, 0x01, 0x01, 0x00, 0x09, 0x01, 0x03, 0x10, 0x05,},
- { 0x01, 0x00, 0x03, 0x25, 0x11, 0x05, 0x10, 0x24, 0x13,},
- { 0x11, 0x01, 0x00, 0x01, 0x09, 0x01, 0x05, 0x10, 0x03,},
- { 0x05, 0x01, 0x00, 0x0D, 0x0C, 0x04, 0x0F, 0x1D, 0x1C,},
- { 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x03, 0x02,},
- { 0x21, 0x01, 0x05, 0x09, 0x11, 0x00, 0x03, 0x41, 0x40,},
- { 0x05, 0x01, 0x00, 0x1D, 0x1C, 0x0D, 0x0C, 0x0F, 0x04,},
- { 0x05, 0x01, 0x00, 0x0D, 0x31, 0x04, 0x19, 0x30, 0x07,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x00, 0x21, 0x05, 0x11, 0x03, 0x09, 0x20,},
- { 0x01, 0x01, 0x00, 0x11, 0x03, 0x05, 0x01, 0x09, 0x10,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x05, 0x01, 0x04, 0x19, 0x07, 0x0D, 0x00, 0x31, 0x30,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x05, 0x01, 0x01, 0x11, 0x09, 0x00, 0x03, 0x21, 0x20,},
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x01, 0x01, 0x02,},
- { 0x09, 0x01, 0x00, 0x29, 0x08, 0x15, 0x03, 0x28, 0x0B,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
- { 0x09, 0x01, 0x00, 0x29, 0x28, 0x15, 0x08, 0x03, 0x0B,},
- { 0x01, 0x00, 0x01, 0x11, 0x05, 0x10, 0x09, 0x01, 0x03,},
- { 0x05, 0x04, 0x01, 0x1D, 0x0D, 0x0C, 0x1C, 0x00, 0x0F,},
- { 0x09, 0x11, 0x01, 0x41, 0x00, 0x40, 0x05, 0x03, 0x21,},
- { 0x0D, 0x05, 0x01, 0x1D, 0x1C, 0x0C, 0x04, 0x00, 0x0F,},
- { 0x41, 0x09, 0x01, 0x40, 0x00, 0x11, 0x05, 0x03, 0x21,},
- { 0x01, 0x01, 0x01, 0x05, 0x01, 0x04, 0x00, 0x01, 0x03,},
- { 0x05, 0x04, 0x01, 0x0D, 0x01, 0x0C, 0x07, 0x01, 0x00,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-
- { 0x05, 0x04, 0x01, 0x07, 0x19, 0x31, 0x30, 0x0D, 0x00,},
- { 0x21, 0x01, 0x01, 0x00, 0x11, 0x09, 0x20, 0x05, 0x03,},
- { 0x05, 0x01, 0x01, 0x04, 0x07, 0x0D, 0x0C, 0x00, 0x01,},
- { 0x21, 0x09, 0x01, 0x00, 0x20, 0x05, 0x23, 0x22, 0x03,},
- { 0x31, 0x0D, 0x01, 0x19, 0x05, 0x30, 0x04, 0x07, 0x00,},
- { 0x31, 0x05, 0x01, 0x04, 0x19, 0x00, 0x0D, 0x30, 0x07,},
- { 0x31, 0x01, 0x00, 0x0D, 0x05, 0x19, 0x04, 0x30, 0x07,},
- { 0x01, 0x01, 0x01, 0x00, 0x01, 0x03, 0x02, 0x01, 0x01,},
- { 0x01, 0x00, 0x01, 0x01, 0x05, 0x09, 0x08, 0x03, 0x01,},
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
-};
-
-static const uint8_t aic_mode1_vlc_bits[AIC_MODE1_NUM][AIC_MODE1_SIZE] = {
- {  1,  4,  2,  7,  4,  6,  4,  7,  5,},
- {  5,  1,  3,  4,  6,  3,  3,  7,  7,},
- {  1,  4,  2,  7,  6,  7,  5,  4,  4,},
- {  1,  3,  3,  3,  7,  4,  5,  7,  6,},
- {  2,  4,  2,  6,  4,  5,  2,  4,  6,},
- {  7,  2,  3,  4,  7,  1,  5,  7,  7,},
- {  5,  1,  3,  6,  5,  5,  2,  7,  7,},
- {  2,  5,  1,  7,  3,  7,  5,  5,  6,},
- {  2,  4,  1,  4,  5,  7,  6,  7,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  2,  1,  3,  6,  5,  5,  5,  7,  7,},
- {  5,  1,  3,  4,  6,  3,  3,  7,  7,},
- {  4,  1,  2,  6,  5,  5,  4,  5,  6,},
- {  3,  1,  3,  4,  6,  3,  5,  7,  7,},
- {  4,  1,  3,  6,  3,  5,  3,  7,  7,},
- {  6,  1,  4,  4,  5,  2,  4,  7,  7,},
- {  7,  1,  5,  7,  4,  3,  2,  7,  7,},
- {  5,  3,  2,  7,  5,  6,  1,  5,  7,},
- {  4,  1,  2,  6,  7,  5,  4,  7,  4,},
- {  1,  0,  1,  0,  0,  0,  0,  0,  0,},
-
- {  3,  3,  1,  5,  5,  6,  6,  5,  3,},
- {  6,  2,  1,  5,  6,  5,  4,  4,  5,},
- {  6,  4,  1,  7,  6,  7,  6,  3,  2,},
- {  4,  3,  1,  4,  6,  4,  6,  5,  3,},
- {  6,  5,  1,  7,  4,  7,  3,  3,  3,},
- {  7,  2,  2,  3,  7,  2,  4,  6,  5,},
- {  6,  2,  2,  6,  4,  5,  2,  4,  4,},
- {  4,  4,  1,  7,  6,  7,  5,  2,  4,},
- {  5,  4,  1,  5,  6,  6,  5,  4,  2,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  2,  2,  2,  3,  5,  5,  6,  6,  5,},
- {  7,  1,  3,  3,  6,  3,  4,  7,  5,},
- {  2,  4,  1,  4,  6,  7,  7,  5,  4,},
- {  7,  4,  3,  1,  5,  3,  6,  7,  3,},
- {  4,  3,  3,  4,  1,  6,  4,  6,  5,},
- {  7,  4,  4,  2,  6,  1,  4,  7,  5,},
- {  5,  2,  3,  4,  4,  3,  2,  5,  4,},
- {  3,  5,  2,  3,  2,  5,  5,  5,  3,},
- {  6,  4,  4,  2,  5,  4,  7,  7,  1,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  2,  2,  2,  7,  3,  7,  4,  5,  6,},
- {  4,  1,  3,  6,  4,  4,  3,  6,  5,},
- {  2,  4,  1,  7,  3,  7,  6,  6,  6,},
- {  3,  4,  3,  5,  1,  4,  4,  6,  6,},
- {  4,  5,  2,  7,  1,  7,  3,  7,  7,},
- {  6,  2,  3,  5,  3,  3,  2,  6,  4,},
- {  4,  4,  4,  7,  2,  5,  1,  6,  7,},
- {  4,  5,  2,  7,  1,  7,  4,  4,  6,},
- {  2,  4,  2,  6,  2,  4,  6,  5,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  1,  3,  3,  5,  6,  3,  5,  6,  5,},
- {  7,  1,  4,  4,  6,  2,  4,  7,  5,},
- {  2,  2,  2,  6,  5,  3,  5,  6,  5,},
- {  7,  4,  4,  2,  6,  1,  5,  7,  4,},
- {  3,  2,  2,  4,  4,  3,  4,  5,  5,},
- {  7,  2,  5,  3,  7,  1,  4,  7,  7,},
- {  6,  2,  3,  4,  5,  2,  2,  7,  7,},
- {  3,  2,  2,  5,  5,  4,  4,  4,  3,},
- {  3,  2,  2,  4,  6,  3,  5,  6,  3,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  1,  3,  3,  7,  4,  6,  3,  5,  7,},
- {  4,  1,  4,  7,  4,  5,  2,  6,  7,},
- {  2,  4,  1,  7,  5,  7,  3,  7,  7,},
- {  3,  2,  3,  5,  3,  4,  2,  6,  6,},
- {  3,  5,  4,  7,  2,  7,  1,  7,  7,},
- {  4,  1,  3,  6,  5,  3,  3,  7,  7,},
- {  4,  2,  5,  7,  3,  7,  1,  7,  7,},
- {  7,  4,  1,  7,  3,  7,  2,  5,  7,},
- {  4,  2,  2,  6,  4,  5,  2,  6,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  3,  4,  1,  7,  6,  7,  6,  2,  6,},
- {  4,  2,  2,  6,  6,  5,  4,  2,  4,},
- {  4,  4,  1,  7,  5,  7,  6,  2,  4,},
- {  3,  3,  2,  5,  4,  4,  5,  2,  4,},
- {  4,  5,  2,  7,  2,  7,  3,  2,  6,},
- {  4,  3,  2,  5,  5,  4,  3,  2,  4,},
- {  7,  4,  2,  7,  2,  5,  3,  2,  6,},
- {  4,  6,  2,  7,  3,  7,  6,  1,  6,},
- {  5,  5,  1,  6,  4,  6,  5,  2,  4,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-
- {  3,  3,  2,  3,  5,  6,  6,  4,  2,},
- {  7,  1,  3,  3,  6,  5,  7,  4,  3,},
- {  5,  4,  1,  5,  5,  6,  6,  4,  2,},
- {  6,  4,  2,  2,  6,  3,  6,  6,  2,},
- {  6,  4,  2,  5,  3,  6,  3,  3,  2,},
- {  6,  3,  2,  3,  5,  2,  4,  6,  3,},
- {  6,  2,  2,  4,  3,  5,  3,  6,  3,},
- {  7,  5,  1,  7,  4,  7,  7,  3,  2,},
- {  5,  5,  2,  3,  6,  7,  7,  5,  1,},
- {  0,  0,  0,  0,  0,  0,  0,  0,  0,},
-};
-
-//@}
-
-#define PBTYPE_ESCAPE 0xFF
-
-/** tables used for P-frame macroblock type decoding */
-//@{
-#define NUM_PTYPE_VLCS 7
-#define PTYPE_VLC_SIZE 8
-#define PTYPE_VLC_BITS 7
-
-static const uint8_t ptype_vlc_codes[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x0D, 0x05, 0x01, 0x04, 0x01, 0x00, 0x07, 0x0C },
- { 0x09, 0x11, 0x01, 0x00, 0x05, 0x03, 0x21, 0x20 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
-};
-
-static const uint8_t ptype_vlc_bits[NUM_PTYPE_VLCS][PTYPE_VLC_SIZE] = {
- { 1, 2, 3, 6, 5, 4, 7, 7 },
- { 3, 1, 2, 7, 6, 5, 4, 7 },
- { 5, 4, 1, 4, 3, 3, 4, 5 },
- { 4, 5, 2, 2, 3, 2, 6, 6 },
- { 5, 6, 1, 4, 2, 3, 7, 7 },
- { 5, 6, 1, 4, 3, 2, 7, 7 },
- { 6, 3, 2, 7, 5, 4, 1, 7 }
-};
-
-static const uint8_t ptype_vlc_syms[PTYPE_VLC_SIZE] = {
- 0, 1, 2, 3, 8, 9, 11, PBTYPE_ESCAPE
-};
-
-/** reverse of ptype_vlc_syms */
-static const uint8_t block_num_to_ptype_vlc_num[12] = {
- 0, 1, 2, 3, 0, 0, 2, 0, 4, 5, 0, 6
-};
-//@}
-
-/** tables used for P-frame macroblock type decoding */
-//@{
-#define NUM_BTYPE_VLCS 6
-#define BTYPE_VLC_SIZE 7
-#define BTYPE_VLC_BITS 6
-
-static const uint8_t btype_vlc_codes[NUM_BTYPE_VLCS][BTYPE_VLC_SIZE] = {
- { 0x01, 0x05, 0x00, 0x03, 0x11, 0x09, 0x10 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x09, 0x01, 0x00, 0x01, 0x05, 0x03, 0x08 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 },
- { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00 }
-};
-
-static const uint8_t btype_vlc_bits[NUM_BTYPE_VLCS][PTYPE_VLC_SIZE] = {
- { 2, 3, 2, 2, 5, 4, 5 },
- { 4, 1, 3, 2, 6, 5, 6 },
- { 6, 4, 1, 2, 5, 3, 6 },
- { 5, 3, 3, 1, 4, 3, 5 },
- { 6, 5, 3, 2, 4, 1, 6 },
- { 6, 5, 3, 1, 4, 2, 6 }
-};
-
-static const uint8_t btype_vlc_syms[BTYPE_VLC_SIZE] = {
- 0, 1, 4, 5, 10, 7, PBTYPE_ESCAPE
-};
-
-/** reverse of btype_vlc_syms */
-static const uint8_t block_num_to_btype_vlc_num[12] = {
- 0, 1, 0, 0, 2, 3, 0, 5, 0, 0, 4, 0
-};
-//@}
-#endif /* AVCODEC_RV40VLC2_H */
diff --git a/libavcodec/s3tc.c b/libavcodec/s3tc.c
deleted file mode 100644
index 546ee21..0000000
--- a/libavcodec/s3tc.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * S3 Texture Compression (S3TC) decoding functions
- * Copyright (c) 2007 by Ivo van Poorten
- *
- * see also: http://wiki.multimedia.cx/index.php?title=S3TC
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "s3tc.h"
-
-static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d,
-                                      unsigned int qstride, unsigned int flag,
-                                      uint64_t alpha) {
-    unsigned int x, y, c0, c1, a = (!flag * 255) << 24;
-    unsigned int rb0, rb1, rb2, rb3, g0, g1, g2, g3;
-    uint32_t colors[4], pixels;
-
-    c0 = AV_RL16(s);
-    c1 = AV_RL16(s+2);
-
-    rb0  = (c0<<3 | c0<<8) & 0xf800f8;
-    rb1  = (c1<<3 | c1<<8) & 0xf800f8;
-    rb0 +=        (rb0>>5) & 0x070007;
-    rb1 +=        (rb1>>5) & 0x070007;
-    g0   =        (c0 <<5) & 0x00fc00;
-    g1   =        (c1 <<5) & 0x00fc00;
-    g0  +=        (g0 >>6) & 0x000300;
-    g1  +=        (g1 >>6) & 0x000300;
-
-    colors[0] = rb0 + g0 + a;
-    colors[1] = rb1 + g1 + a;
-
-    if (c0 > c1 || flag) {
-        rb2 = (((2*rb0+rb1) * 21) >> 6) & 0xff00ff;
-        rb3 = (((2*rb1+rb0) * 21) >> 6) & 0xff00ff;
-        g2  = (((2*g0 +g1 ) * 21) >> 6) & 0x00ff00;
-        g3  = (((2*g1 +g0 ) * 21) >> 6) & 0x00ff00;
-        colors[3] = rb3 + g3 + a;
-    } else {
-        rb2 = ((rb0+rb1) >> 1) & 0xff00ff;
-        g2  = ((g0 +g1 ) >> 1) & 0x00ff00;
-        colors[3] = 0;
-    }
-
-    colors[2] = rb2 + g2 + a;
-
-    pixels = AV_RL32(s+4);
-    for (y=0; y<4; y++) {
-        for (x=0; x<4; x++) {
-            a        = (alpha & 0x0f) << 28;
-            a       += a >> 4;
-            d[x]     = a + colors[pixels&3];
-            pixels >>= 2;
-            alpha  >>= 4;
-        }
-        d += qstride;
-    }
-}
-
-void ff_decode_dxt1(const uint8_t *s, uint8_t *dst,
-                    const unsigned int w, const unsigned int h,
-                    const unsigned int stride) {
-    unsigned int bx, by, qstride = stride/4;
-    uint32_t *d = (uint32_t *) dst;
-
-    for (by=0; by < h/4; by++, d += stride-w)
-        for (bx=0; bx < w/4; bx++, s+=8, d+=4)
-            dxt1_decode_pixels(s, d, qstride, 0, 0LL);
-}
-
-void ff_decode_dxt3(const uint8_t *s, uint8_t *dst,
-                    const unsigned int w, const unsigned int h,
-                    const unsigned int stride) {
-    unsigned int bx, by, qstride = stride/4;
-    uint32_t *d = (uint32_t *) dst;
-
-    for (by=0; by < h/4; by++, d += stride-w)
-        for (bx=0; bx < w/4; bx++, s+=16, d+=4)
-            dxt1_decode_pixels(s+8, d, qstride, 1, AV_RL64(s));
-}
diff --git a/libavcodec/s3tc.h b/libavcodec/s3tc.h
deleted file mode 100644
index 4919c07..0000000
--- a/libavcodec/s3tc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * S3 Texture Compression (S3TC) decoding functions
- * Copyright (c) 2007 by Ivo van Poorten
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_S3TC_H
-#define AVCODEC_S3TC_H
-
-#include <stdint.h>
-
-#define FF_S3TC_DXT1    0x31545844
-#define FF_S3TC_DXT3    0x33545844
-
-/**
- * Decode DXT1 encoded data to RGB32
- * @param *src source buffer, has to be aligned on a 4-byte boundary
- * @param *dst destination buffer
- * @param w width of output image
- * @param h height of output image
- * @param stride line size of output image
- */
-void ff_decode_dxt1(const uint8_t *src, uint8_t *dst,
-                    const unsigned int w, const unsigned int h,
-                    const unsigned int stride);
-/**
- * Decode DXT3 encoded data to RGB32
- * @param *src source buffer, has to be aligned on a 4-byte boundary
- * @param *dst destination buffer
- * @param w width of output image
- * @param h height of output image
- * @param stride line size of output image
- */
-void ff_decode_dxt3(const uint8_t *src, uint8_t *dst,
-                    const unsigned int w, const unsigned int h,
-                    const unsigned int stride);
-
-#endif /* AVCODEC_S3TC_H */
diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h
deleted file mode 100644
index 1c87a2e..0000000
--- a/libavcodec/sbr.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Spectral Band Replication definitions and structures
- * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
- * Copyright (c) 2010      Alex Converse <alex.converse at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Spectral Band Replication definitions and structures
- * @author Robert Swain ( rob opendot cl )
- */
-
-#ifndef AVCODEC_SBR_H
-#define AVCODEC_SBR_H
-
-#include <stdint.h>
-#include "fft.h"
-#include "aacps.h"
-
-/**
- * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header.
- */
-typedef struct {
-    uint8_t bs_start_freq;
-    uint8_t bs_stop_freq;
-    uint8_t bs_xover_band;
-
-    /**
-     * @defgroup bs_header_extra_1     Variables associated with bs_header_extra_1
-     * @{
-     */
-    uint8_t bs_freq_scale;
-    uint8_t bs_alter_scale;
-    uint8_t bs_noise_bands;
-    /** @} */
-} SpectrumParameters;
-
-#define SBR_SYNTHESIS_BUF_SIZE ((1280-128)*2)
-
-/**
- * Spectral Band Replication per channel data
- */
-typedef struct {
-    /**
-     * @defgroup bitstream     Main bitstream data variables
-     * @{
-     */
-    unsigned           bs_frame_class;
-    unsigned           bs_add_harmonic_flag;
-    unsigned           bs_num_env;
-    uint8_t            bs_freq_res[7];
-    unsigned           bs_num_noise;
-    uint8_t            bs_df_env[5];
-    uint8_t            bs_df_noise[2];
-    uint8_t            bs_invf_mode[2][5];
-    uint8_t            bs_add_harmonic[48];
-    unsigned           bs_amp_res;
-    /** @} */
-
-    /**
-     * @defgroup state         State variables
-     * @{
-     */
-    DECLARE_ALIGNED(16, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE];
-    DECLARE_ALIGNED(16, float, analysis_filterbank_samples) [1312];
-    int                synthesis_filterbank_samples_offset;
-    ///l_APrev and l_A
-    int                e_a[2];
-    ///Chirp factors
-    float              bw_array[5];
-    ///QMF values of the original signal
-    float              W[2][32][32][2];
-    ///QMF output of the HF adjustor
-    float              Y[2][38][64][2];
-    float              g_temp[42][48];
-    float              q_temp[42][48];
-    uint8_t            s_indexmapped[8][48];
-    ///Envelope scalefactors
-    float              env_facs[6][48];
-    ///Noise scalefactors
-    float              noise_facs[3][5];
-    ///Envelope time borders
-    uint8_t            t_env[8];
-    ///Envelope time border of the last envelope of the previous frame
-    uint8_t            t_env_num_env_old;
-    ///Noise time borders
-    uint8_t            t_q[3];
-    unsigned           f_indexnoise;
-    unsigned           f_indexsine;
-    /** @} */
-} SBRData;
-
-/**
- * Spectral Band Replication
- */
-typedef struct {
-    int                sample_rate;
-    int                start;
-    int                reset;
-    SpectrumParameters spectrum_params;
-    int                bs_amp_res_header;
-    /**
-     * @defgroup bs_header_extra_2     variables associated with bs_header_extra_2
-     * @{
-     */
-    unsigned           bs_limiter_bands;
-    unsigned           bs_limiter_gains;
-    unsigned           bs_interpol_freq;
-    unsigned           bs_smoothing_mode;
-    /** @} */
-    unsigned           bs_coupling;
-    unsigned           k[5]; ///< k0, k1, k2
-    ///kx', and kx respectively, kx is the first QMF subband where SBR is used.
-    ///kx' is its value from the previous frame
-    unsigned           kx[2];
-    ///M' and M respectively, M is the number of QMF subbands that use SBR.
-    unsigned           m[2];
-    ///The number of frequency bands in f_master
-    unsigned           n_master;
-    SBRData            data[2];
-    PSContext          ps;
-    ///N_Low and N_High respectively, the number of frequency bands for low and high resolution
-    unsigned           n[2];
-    ///Number of noise floor bands
-    unsigned           n_q;
-    ///Number of limiter bands
-    unsigned           n_lim;
-    ///The master QMF frequency grouping
-    uint16_t           f_master[49];
-    ///Frequency borders for low resolution SBR
-    uint16_t           f_tablelow[25];
-    ///Frequency borders for high resolution SBR
-    uint16_t           f_tablehigh[49];
-    ///Frequency borders for noise floors
-    uint16_t           f_tablenoise[6];
-    ///Frequency borders for the limiter
-    uint16_t           f_tablelim[29];
-    unsigned           num_patches;
-    uint8_t            patch_num_subbands[6];
-    uint8_t            patch_start_subband[6];
-    ///QMF low frequency input to the HF generator
-    float              X_low[32][40][2];
-    ///QMF output of the HF generator
-    float              X_high[64][40][2];
-    ///QMF values of the reconstructed signal
-    DECLARE_ALIGNED(16, float, X)[2][2][38][64];
-    ///Zeroth coefficient used to filter the subband signals
-    float              alpha0[64][2];
-    ///First coefficient used to filter the subband signals
-    float              alpha1[64][2];
-    ///Dequantized envelope scalefactors, remapped
-    float              e_origmapped[7][48];
-    ///Dequantized noise scalefactors, remapped
-    float              q_mapped[7][48];
-    ///Sinusoidal presence, remapped
-    uint8_t            s_mapped[7][48];
-    ///Estimated envelope
-    float              e_curr[7][48];
-    ///Amplitude adjusted noise scalefactors
-    float              q_m[7][48];
-    ///Sinusoidal levels
-    float              s_m[7][48];
-    float              gain[7][48];
-    DECLARE_ALIGNED(16, float, qmf_filter_scratch)[5][64];
-    FFTContext         mdct_ana;
-    FFTContext         mdct;
-} SpectralBandReplication;
-
-#endif /* AVCODEC_SBR_H */
diff --git a/libavcodec/sgi.h b/libavcodec/sgi.h
deleted file mode 100644
index be17f2e..0000000
--- a/libavcodec/sgi.h
+++ /dev/null
@@ -1,36 +0,0 @@
- /*
- * SGI image encoder
- * Xiaohui Sun <tjnksxh at hotmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SGI_H
-#define AVCODEC_SGI_H
-
-/**
- * SGI image file signature
- */
-#define SGI_MAGIC 474
-
-#define SGI_HEADER_SIZE 512
-
-#define SGI_GRAYSCALE 1
-#define SGI_RGB 3
-#define SGI_RGBA 4
-
-#endif /* AVCODEC_SGI_H */
diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
deleted file mode 100644
index bbfd94b..0000000
--- a/libavcodec/sgidec.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * SGI image decoder
- * Todd Kirby <doubleshot at pacbell.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "sgi.h"
-
-typedef struct SgiState {
-    AVFrame picture;
-    unsigned int width;
-    unsigned int height;
-    unsigned int depth;
-    unsigned int bytes_per_channel;
-    int linesize;
-} SgiState;
-
-/**
- * Expand an RLE row into a channel.
- * @param in_buf input buffer
- * @param in_end end of input buffer
- * @param out_buf Points to one line after the output buffer.
- * @param out_end end of line in output buffer
- * @param pixelstride pixel stride of input buffer
- * @return size of output in bytes, -1 if buffer overflows
- */
-static int expand_rle_row(const uint8_t *in_buf, const uint8_t* in_end,
-            unsigned char *out_buf, uint8_t* out_end, int pixelstride)
-{
-    unsigned char pixel, count;
-    unsigned char *orig = out_buf;
-
-    while (1) {
-        if(in_buf + 1 > in_end) return -1;
-        pixel = bytestream_get_byte(&in_buf);
-        if (!(count = (pixel & 0x7f))) {
-            return (out_buf - orig) / pixelstride;
-        }
-
-        /* Check for buffer overflow. */
-        if(out_buf + pixelstride * count >= out_end) return -1;
-
-        if (pixel & 0x80) {
-            while (count--) {
-                *out_buf = bytestream_get_byte(&in_buf);
-                out_buf += pixelstride;
-            }
-        } else {
-            pixel = bytestream_get_byte(&in_buf);
-
-            while (count--) {
-                *out_buf = pixel;
-                out_buf += pixelstride;
-            }
-        }
-    }
-}
-
-/**
- * Read a run length encoded SGI image.
- * @param out_buf output buffer
- * @param in_buf input buffer
- * @param in_end end of input buffer
- * @param s the current image state
- * @return 0 if no error, else return error number.
- */
-static int read_rle_sgi(unsigned char* out_buf, const uint8_t *in_buf,
-                        const uint8_t *in_end, SgiState* s)
-{
-    uint8_t *dest_row;
-    unsigned int len = s->height * s->depth * 4;
-    const uint8_t *start_table = in_buf;
-    unsigned int y, z;
-    unsigned int start_offset;
-
-    /* size of  RLE offset and length tables */
-    if(len * 2  > in_end - in_buf) {
-        return AVERROR_INVALIDDATA;
-    }
-
-    in_buf -= SGI_HEADER_SIZE;
-    for (z = 0; z < s->depth; z++) {
-        dest_row = out_buf;
-        for (y = 0; y < s->height; y++) {
-            dest_row -= s->linesize;
-            start_offset = bytestream_get_be32(&start_table);
-            if(start_offset > in_end - in_buf) {
-                return AVERROR_INVALIDDATA;
-            }
-            if (expand_rle_row(in_buf + start_offset, in_end, dest_row + z,
-                dest_row + FFABS(s->linesize), s->depth) != s->width)
-                return AVERROR_INVALIDDATA;
-        }
-    }
-    return 0;
-}
-
-/**
- * Read an uncompressed SGI image.
- * @param out_buf output buffer
- * @param out_end end ofoutput buffer
- * @param in_buf input buffer
- * @param in_end end of input buffer
- * @param s the current image state
- * @return 0 if read success, otherwise return -1.
- */
-static int read_uncompressed_sgi(unsigned char* out_buf, uint8_t* out_end,
-                const uint8_t *in_buf, const uint8_t *in_end, SgiState* s)
-{
-    int x, y, z;
-    const uint8_t *ptr;
-    unsigned int offset = s->height * s->width * s->bytes_per_channel;
-
-    /* Test buffer size. */
-    if (offset * s->depth > in_end - in_buf) {
-       return -1;
-    }
-
-    for (y = s->height - 1; y >= 0; y--) {
-        out_end = out_buf + (y * s->linesize);
-        for (x = s->width; x > 0; x--) {
-            ptr = in_buf += s->bytes_per_channel;
-            for(z = 0; z < s->depth; z ++) {
-                memcpy(out_end, ptr, s->bytes_per_channel);
-                out_end += s->bytes_per_channel;
-                ptr += offset;
-            }
-        }
-    }
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *in_buf = avpkt->data;
-    int buf_size = avpkt->size;
-    SgiState *s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame *p = &s->picture;
-    const uint8_t *in_end = in_buf + buf_size;
-    unsigned int dimension, rle;
-    int ret = 0;
-    uint8_t *out_buf, *out_end;
-
-    if (buf_size < SGI_HEADER_SIZE){
-        av_log(avctx, AV_LOG_ERROR, "buf_size too small (%d)\n", buf_size);
-        return -1;
-    }
-
-    /* Test for SGI magic. */
-    if (bytestream_get_be16(&in_buf) != SGI_MAGIC) {
-        av_log(avctx, AV_LOG_ERROR, "bad magic number\n");
-        return -1;
-    }
-
-    rle = bytestream_get_byte(&in_buf);
-    s->bytes_per_channel = bytestream_get_byte(&in_buf);
-    dimension = bytestream_get_be16(&in_buf);
-    s->width  = bytestream_get_be16(&in_buf);
-    s->height = bytestream_get_be16(&in_buf);
-    s->depth  = bytestream_get_be16(&in_buf);
-
-    if (s->bytes_per_channel != 1 && (s->bytes_per_channel != 2 || rle)) {
-        av_log(avctx, AV_LOG_ERROR, "wrong channel number\n");
-        return -1;
-    }
-
-    /* Check for supported image dimensions. */
-    if (dimension != 2 && dimension != 3) {
-        av_log(avctx, AV_LOG_ERROR, "wrong dimension number\n");
-        return -1;
-    }
-
-    if (s->depth == SGI_GRAYSCALE) {
-        avctx->pix_fmt = s->bytes_per_channel == 2 ? PIX_FMT_GRAY16BE : PIX_FMT_GRAY8;
-    } else if (s->depth == SGI_RGB) {
-        avctx->pix_fmt = s->bytes_per_channel == 2 ? PIX_FMT_RGB48BE : PIX_FMT_RGB24;
-    } else if (s->depth == SGI_RGBA && s->bytes_per_channel == 1) {
-        avctx->pix_fmt = PIX_FMT_RGBA;
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "wrong picture format\n");
-        return -1;
-    }
-
-    if (avcodec_check_dimensions(avctx, s->width, s->height))
-        return -1;
-    avcodec_set_dimensions(avctx, s->width, s->height);
-
-    if (p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 0;
-    if (avctx->get_buffer(avctx, p) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed.\n");
-        return -1;
-    }
-
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-    out_buf = p->data[0];
-
-    out_end = out_buf + p->linesize[0] * s->height;
-
-    s->linesize = p->linesize[0];
-
-    /* Skip header. */
-    in_buf += SGI_HEADER_SIZE - 12;
-    if (rle) {
-        ret = read_rle_sgi(out_end, in_buf, in_end, s);
-    } else {
-        ret = read_uncompressed_sgi(out_buf, out_end, in_buf, in_end, s);
-    }
-
-    if (ret == 0) {
-        *picture   = s->picture;
-        *data_size = sizeof(AVPicture);
-        return buf_size;
-    } else {
-        return -1;
-    }
-}
-
-static av_cold int sgi_init(AVCodecContext *avctx){
-    SgiState *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame = &s->picture;
-
-    return 0;
-}
-
-static av_cold int sgi_end(AVCodecContext *avctx)
-{
-    SgiState * const s = avctx->priv_data;
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-AVCodec sgi_decoder = {
-    "sgi",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SGI,
-    sizeof(SgiState),
-    sgi_init,
-    NULL,
-    sgi_end,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("SGI image"),
-};
-
diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c
deleted file mode 100644
index f9f3709..0000000
--- a/libavcodec/sgienc.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * SGI image encoder
- * Todd Kirby <doubleshot at pacbell.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "sgi.h"
-#include "rle.h"
-
-#define SGI_SINGLE_CHAN 2
-#define SGI_MULTI_CHAN 3
-
-typedef struct SgiContext {
-    AVFrame picture;
-} SgiContext;
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    SgiContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame = &s->picture;
-
-    return 0;
-}
-
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
-                        int buf_size, void *data)
-{
-    SgiContext *s = avctx->priv_data;
-    AVFrame * const p = &s->picture;
-    uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf;
-    int x, y, z, length, tablesize;
-    unsigned int width, height, depth, dimension;
-    unsigned char *orig_buf = buf, *end_buf = buf + buf_size;
-
-    *p = *(AVFrame*)data;
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-
-    width  = avctx->width;
-    height = avctx->height;
-
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_GRAY8:
-        dimension = SGI_SINGLE_CHAN;
-        depth     = SGI_GRAYSCALE;
-        break;
-    case PIX_FMT_RGB24:
-        dimension = SGI_MULTI_CHAN;
-        depth     = SGI_RGB;
-        break;
-    case PIX_FMT_RGBA:
-        dimension = SGI_MULTI_CHAN;
-        depth     = SGI_RGBA;
-        break;
-    default:
-        return AVERROR_INVALIDDATA;
-    }
-
-    tablesize = depth * height * 4;
-    length = tablesize * 2 + SGI_HEADER_SIZE;
-
-    if (buf_size < length) {
-        av_log(avctx, AV_LOG_ERROR, "buf_size too small(need %d, got %d)\n", length, buf_size);
-        return -1;
-    }
-
-    /* Encode header. */
-    bytestream_put_be16(&buf, SGI_MAGIC);
-    bytestream_put_byte(&buf, avctx->coder_type != FF_CODER_TYPE_RAW); /* RLE 1 - VERBATIM 0*/
-    bytestream_put_byte(&buf, 1); /* bytes_per_channel */
-    bytestream_put_be16(&buf, dimension);
-    bytestream_put_be16(&buf, width);
-    bytestream_put_be16(&buf, height);
-    bytestream_put_be16(&buf, depth);
-
-    /* The rest are constant in this implementation. */
-    bytestream_put_be32(&buf, 0L); /* pixmin */
-    bytestream_put_be32(&buf, 255L); /* pixmax */
-    bytestream_put_be32(&buf, 0L); /* dummy */
-
-    /* name */
-    memset(buf, 0, SGI_HEADER_SIZE);
-    buf += 80;
-
-     /* colormap */
-    bytestream_put_be32(&buf, 0L);
-
-    /* The rest of the 512 byte header is unused. */
-    buf += 404;
-    offsettab = buf;
-
-    if (avctx->coder_type  != FF_CODER_TYPE_RAW) {
-        /* Skip RLE offset table. */
-        buf += tablesize;
-        lengthtab = buf;
-
-        /* Skip RLE length table. */
-        buf += tablesize;
-
-        /* Make an intermediate consecutive buffer. */
-        if (!(encode_buf = av_malloc(width)))
-            return -1;
-
-        for (z = 0; z < depth; z++) {
-            in_buf = p->data[0] + p->linesize[0] * (height - 1) + z;
-
-            for (y = 0; y < height; y++) {
-                bytestream_put_be32(&offsettab, buf - orig_buf);
-
-                for (x = 0; x < width; x++)
-                    encode_buf[x] = in_buf[depth * x];
-
-                if ((length = ff_rle_encode(buf, end_buf - buf - 1, encode_buf, 1, width, 0, 0, 0x80, 0)) < 1) {
-                    av_free(encode_buf);
-                    return -1;
-                }
-
-                buf += length;
-                bytestream_put_byte(&buf, 0);
-                bytestream_put_be32(&lengthtab, length + 1);
-                in_buf -= p->linesize[0];
-            }
-        }
-
-        av_free(encode_buf);
-    } else {
-        for (z = 0; z < depth; z++) {
-            in_buf = p->data[0] + p->linesize[0] * (height - 1) + z;
-
-            for (y = 0; y < height; y++) {
-                for (x = 0; x < width * depth; x += depth)
-                    bytestream_put_byte(&buf, in_buf[x]);
-
-                in_buf -= p->linesize[0];
-            }
-        }
-    }
-
-    /* total length */
-    return buf - orig_buf;
-}
-
-AVCodec sgi_encoder = {
-    "sgi",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SGI,
-    sizeof(SgiContext),
-    encode_init,
-    encode_frame,
-    NULL,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGBA, PIX_FMT_GRAY8, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("SGI image"),
-};
diff --git a/libavcodec/sh4/Makefile b/libavcodec/sh4/Makefile
deleted file mode 100644
index 142cba4..0000000
--- a/libavcodec/sh4/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-OBJS                                   += sh4/dsputil_align.o           \
-                                          sh4/dsputil_sh4.o             \
-                                          sh4/idct_sh4.o                \
diff --git a/libavcodec/sh4/dsputil_align.c b/libavcodec/sh4/dsputil_align.c
deleted file mode 100644
index 9e7efde..0000000
--- a/libavcodec/sh4/dsputil_align.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * aligned/packed access motion
- *
- * Copyright (c) 2001-2003 BERO <bero at geocities.co.jp>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_sh4.h"
-
-
-#define         LP(p)           *(uint32_t*)(p)
-#define         LPC(p)          *(const uint32_t*)(p)
-
-
-#define         UNPACK(ph,pl,tt0,tt1) do { \
-        uint32_t t0,t1; t0=tt0;t1=tt1; \
-        ph = ( (t0 & ~BYTE_VEC32(0x03))>>2) + ( (t1 & ~BYTE_VEC32(0x03))>>2); \
-        pl = (t0 & BYTE_VEC32(0x03)) + (t1 & BYTE_VEC32(0x03)); } while(0)
-
-#define         rnd_PACK(ph,pl,nph,npl) ph + nph + (((pl + npl + BYTE_VEC32(0x02))>>2) & BYTE_VEC32(0x03))
-#define         no_rnd_PACK(ph,pl,nph,npl)      ph + nph + (((pl + npl + BYTE_VEC32(0x01))>>2) & BYTE_VEC32(0x03))
-
-/* little endian */
-#define         MERGE1(a,b,ofs) (ofs==0)?a:( ((a)>>(8*ofs))|((b)<<(32-8*ofs)) )
-#define         MERGE2(a,b,ofs) (ofs==3)?b:( ((a)>>(8*(ofs+1)))|((b)<<(32-8*(ofs+1))) )
-/* big
-#define         MERGE1(a,b,ofs) (ofs==0)?a:( ((a)<<(8*ofs))|((b)>>(32-8*ofs)) )
-#define         MERGE2(a,b,ofs) (ofs==3)?b:( ((a)<<(8+8*ofs))|((b)>>(32-8-8*ofs)) )
-*/
-
-
-#define         put(d,s)        d = s
-#define         avg(d,s)        d = rnd_avg32(s,d)
-
-#define         OP_C4(ofs) \
-        ref-=ofs; \
-        do { \
-                OP(LP(dest),MERGE1(LPC(ref),LPC(ref+4),ofs)); \
-                ref+=stride; \
-                dest+=stride; \
-        } while(--height)
-
-#define        OP_C40() \
-        do { \
-                OP(LP(dest),LPC(ref)); \
-                ref+=stride; \
-                dest+=stride; \
-        } while(--height)
-
-
-#define         OP      put
-
-static void put_pixels4_c(uint8_t *dest,const uint8_t *ref, const int stride,int height)
-{
-        switch((int)ref&3){
-        case 0: OP_C40(); return;
-        case 1: OP_C4(1); return;
-        case 2: OP_C4(2); return;
-        case 3: OP_C4(3); return;
-        }
-}
-
-#undef          OP
-#define         OP      avg
-
-static void avg_pixels4_c(uint8_t *dest,const uint8_t *ref, const int stride,int height)
-{
-        switch((int)ref&3){
-        case 0: OP_C40(); return;
-        case 1: OP_C4(1); return;
-        case 2: OP_C4(2); return;
-        case 3: OP_C4(3); return;
-        }
-}
-
-#undef          OP
-
-#define         OP_C(ofs,sz,avg2) \
-{ \
-        ref-=ofs; \
-        do { \
-                uint32_t        t0,t1; \
-                t0 = LPC(ref+0); \
-                t1 = LPC(ref+4); \
-                OP(LP(dest+0), MERGE1(t0,t1,ofs)); \
-                t0 = LPC(ref+8); \
-                OP(LP(dest+4), MERGE1(t1,t0,ofs)); \
-if (sz==16) { \
-                t1 = LPC(ref+12); \
-                OP(LP(dest+8), MERGE1(t0,t1,ofs)); \
-                t0 = LPC(ref+16); \
-                OP(LP(dest+12), MERGE1(t1,t0,ofs)); \
-} \
-                ref+=stride; \
-                dest+= stride; \
-        } while(--height); \
-}
-
-/* aligned */
-#define         OP_C0(sz,avg2) \
-{ \
-        do { \
-                OP(LP(dest+0), LPC(ref+0)); \
-                OP(LP(dest+4), LPC(ref+4)); \
-if (sz==16) { \
-                OP(LP(dest+8), LPC(ref+8)); \
-                OP(LP(dest+12), LPC(ref+12)); \
-} \
-                ref+=stride; \
-                dest+= stride; \
-        } while(--height); \
-}
-
-#define         OP_X(ofs,sz,avg2) \
-{ \
-        ref-=ofs; \
-        do { \
-                uint32_t        t0,t1; \
-                t0 = LPC(ref+0); \
-                t1 = LPC(ref+4); \
-                OP(LP(dest+0), avg2(MERGE1(t0,t1,ofs),MERGE2(t0,t1,ofs))); \
-                t0 = LPC(ref+8); \
-                OP(LP(dest+4), avg2(MERGE1(t1,t0,ofs),MERGE2(t1,t0,ofs))); \
-if (sz==16) { \
-                t1 = LPC(ref+12); \
-                OP(LP(dest+8), avg2(MERGE1(t0,t1,ofs),MERGE2(t0,t1,ofs))); \
-                t0 = LPC(ref+16); \
-                OP(LP(dest+12), avg2(MERGE1(t1,t0,ofs),MERGE2(t1,t0,ofs))); \
-} \
-                ref+=stride; \
-                dest+= stride; \
-        } while(--height); \
-}
-
-/* aligned */
-#define         OP_Y0(sz,avg2) \
-{ \
-        uint32_t t0,t1,t2,t3,t; \
-\
-        t0 = LPC(ref+0); \
-        t1 = LPC(ref+4); \
-if (sz==16) { \
-        t2 = LPC(ref+8); \
-        t3 = LPC(ref+12); \
-} \
-        do { \
-                ref += stride; \
-\
-                t = LPC(ref+0); \
-                OP(LP(dest+0), avg2(t0,t)); t0 = t; \
-                t = LPC(ref+4); \
-                OP(LP(dest+4), avg2(t1,t)); t1 = t; \
-if (sz==16) { \
-                t = LPC(ref+8); \
-                OP(LP(dest+8), avg2(t2,t)); t2 = t; \
-                t = LPC(ref+12); \
-                OP(LP(dest+12), avg2(t3,t)); t3 = t; \
-} \
-                dest+= stride; \
-        } while(--height); \
-}
-
-#define         OP_Y(ofs,sz,avg2) \
-{ \
-        uint32_t t0,t1,t2,t3,t,w0,w1; \
-\
-        ref-=ofs; \
-        w0 = LPC(ref+0); \
-        w1 = LPC(ref+4); \
-        t0 = MERGE1(w0,w1,ofs); \
-        w0 = LPC(ref+8); \
-        t1 = MERGE1(w1,w0,ofs); \
-if (sz==16) { \
-        w1 = LPC(ref+12); \
-        t2 = MERGE1(w0,w1,ofs); \
-        w0 = LPC(ref+16); \
-        t3 = MERGE1(w1,w0,ofs); \
-} \
-        do { \
-                ref += stride; \
-\
-                w0 = LPC(ref+0); \
-                w1 = LPC(ref+4); \
-                t = MERGE1(w0,w1,ofs); \
-                OP(LP(dest+0), avg2(t0,t)); t0 = t; \
-                w0 = LPC(ref+8); \
-                t = MERGE1(w1,w0,ofs); \
-                OP(LP(dest+4), avg2(t1,t)); t1 = t; \
-if (sz==16) { \
-                w1 = LPC(ref+12); \
-                t = MERGE1(w0,w1,ofs); \
-                OP(LP(dest+8), avg2(t2,t)); t2 = t; \
-                w0 = LPC(ref+16); \
-                t = MERGE1(w1,w0,ofs); \
-                OP(LP(dest+12), avg2(t3,t)); t3 = t; \
-} \
-                dest+=stride; \
-        } while(--height); \
-}
-
-#define OP_X0(sz,avg2) OP_X(0,sz,avg2)
-#define OP_XY0(sz,PACK) OP_XY(0,sz,PACK)
-#define         OP_XY(ofs,sz,PACK) \
-{ \
-        uint32_t        t2,t3,w0,w1; \
-        uint32_t        a0,a1,a2,a3,a4,a5,a6,a7; \
-\
-        ref -= ofs; \
-        w0 = LPC(ref+0); \
-        w1 = LPC(ref+4); \
-        UNPACK(a0,a1,MERGE1(w0,w1,ofs),MERGE2(w0,w1,ofs)); \
-        w0 = LPC(ref+8); \
-        UNPACK(a2,a3,MERGE1(w1,w0,ofs),MERGE2(w1,w0,ofs)); \
-if (sz==16) { \
-        w1 = LPC(ref+12); \
-        UNPACK(a4,a5,MERGE1(w0,w1,ofs),MERGE2(w0,w1,ofs)); \
-        w0 = LPC(ref+16); \
-        UNPACK(a6,a7,MERGE1(w1,w0,ofs),MERGE2(w1,w0,ofs)); \
-} \
-        do { \
-                ref+=stride; \
-                w0 = LPC(ref+0); \
-                w1 = LPC(ref+4); \
-                UNPACK(t2,t3,MERGE1(w0,w1,ofs),MERGE2(w0,w1,ofs)); \
-                OP(LP(dest+0),PACK(a0,a1,t2,t3)); \
-                a0 = t2; a1 = t3; \
-                w0 = LPC(ref+8); \
-                UNPACK(t2,t3,MERGE1(w1,w0,ofs),MERGE2(w1,w0,ofs)); \
-                OP(LP(dest+4),PACK(a2,a3,t2,t3)); \
-                a2 = t2; a3 = t3; \
-if (sz==16) { \
-                w1 = LPC(ref+12); \
-                UNPACK(t2,t3,MERGE1(w0,w1,ofs),MERGE2(w0,w1,ofs)); \
-                OP(LP(dest+8),PACK(a4,a5,t2,t3)); \
-                a4 = t2; a5 = t3; \
-                w0 = LPC(ref+16); \
-                UNPACK(t2,t3,MERGE1(w1,w0,ofs),MERGE2(w1,w0,ofs)); \
-                OP(LP(dest+12),PACK(a6,a7,t2,t3)); \
-                a6 = t2; a7 = t3; \
-} \
-                dest+=stride; \
-        } while(--height); \
-}
-
-#define         DEFFUNC(op,rnd,xy,sz,OP_N,avgfunc) \
-static void op##_##rnd##_pixels##sz##_##xy (uint8_t * dest, const uint8_t * ref, \
-                                const int stride, int height) \
-{ \
-        switch((int)ref&3) { \
-        case 0:OP_N##0(sz,rnd##_##avgfunc); return; \
-        case 1:OP_N(1,sz,rnd##_##avgfunc); return; \
-        case 2:OP_N(2,sz,rnd##_##avgfunc); return; \
-        case 3:OP_N(3,sz,rnd##_##avgfunc); return; \
-        } \
-}
-
-#define OP put
-
-DEFFUNC(put,   rnd,o,8,OP_C,avg32)
-DEFFUNC(put,   rnd,x,8,OP_X,avg32)
-DEFFUNC(put,no_rnd,x,8,OP_X,avg32)
-DEFFUNC(put,   rnd,y,8,OP_Y,avg32)
-DEFFUNC(put,no_rnd,y,8,OP_Y,avg32)
-DEFFUNC(put,   rnd,xy,8,OP_XY,PACK)
-DEFFUNC(put,no_rnd,xy,8,OP_XY,PACK)
-DEFFUNC(put,   rnd,o,16,OP_C,avg32)
-DEFFUNC(put,   rnd,x,16,OP_X,avg32)
-DEFFUNC(put,no_rnd,x,16,OP_X,avg32)
-DEFFUNC(put,   rnd,y,16,OP_Y,avg32)
-DEFFUNC(put,no_rnd,y,16,OP_Y,avg32)
-DEFFUNC(put,   rnd,xy,16,OP_XY,PACK)
-DEFFUNC(put,no_rnd,xy,16,OP_XY,PACK)
-
-#undef OP
-#define OP avg
-
-DEFFUNC(avg,   rnd,o,8,OP_C,avg32)
-DEFFUNC(avg,   rnd,x,8,OP_X,avg32)
-DEFFUNC(avg,no_rnd,x,8,OP_X,avg32)
-DEFFUNC(avg,   rnd,y,8,OP_Y,avg32)
-DEFFUNC(avg,no_rnd,y,8,OP_Y,avg32)
-DEFFUNC(avg,   rnd,xy,8,OP_XY,PACK)
-DEFFUNC(avg,no_rnd,xy,8,OP_XY,PACK)
-DEFFUNC(avg,   rnd,o,16,OP_C,avg32)
-DEFFUNC(avg,   rnd,x,16,OP_X,avg32)
-DEFFUNC(avg,no_rnd,x,16,OP_X,avg32)
-DEFFUNC(avg,   rnd,y,16,OP_Y,avg32)
-DEFFUNC(avg,no_rnd,y,16,OP_Y,avg32)
-DEFFUNC(avg,   rnd,xy,16,OP_XY,PACK)
-DEFFUNC(avg,no_rnd,xy,16,OP_XY,PACK)
-
-#undef OP
-
-#define         put_no_rnd_pixels8_o     put_rnd_pixels8_o
-#define         put_no_rnd_pixels16_o    put_rnd_pixels16_o
-#define         avg_no_rnd_pixels8_o     avg_rnd_pixels8_o
-#define         avg_no_rnd_pixels16_o    avg_rnd_pixels16_o
-
-#define         put_pixels8_c            put_rnd_pixels8_o
-#define         put_pixels16_c           put_rnd_pixels16_o
-#define         avg_pixels8_c            avg_rnd_pixels8_o
-#define         avg_pixels16_c           avg_rnd_pixels16_o
-#define         put_no_rnd_pixels8_c     put_rnd_pixels8_o
-#define         put_no_rnd_pixels16_c    put_rnd_pixels16_o
-#define         avg_no_rnd_pixels8_c     avg_rnd_pixels8_o
-#define         avg_no_rnd_pixels16_c    avg_rnd_pixels16_o
-
-#define         QPEL
-
-#ifdef QPEL
-
-#include "qpel.c"
-
-#endif
-
-void dsputil_init_align(DSPContext* c, AVCodecContext *avctx)
-{
-        c->put_pixels_tab[0][0] = put_rnd_pixels16_o;
-        c->put_pixels_tab[0][1] = put_rnd_pixels16_x;
-        c->put_pixels_tab[0][2] = put_rnd_pixels16_y;
-        c->put_pixels_tab[0][3] = put_rnd_pixels16_xy;
-        c->put_pixels_tab[1][0] = put_rnd_pixels8_o;
-        c->put_pixels_tab[1][1] = put_rnd_pixels8_x;
-        c->put_pixels_tab[1][2] = put_rnd_pixels8_y;
-        c->put_pixels_tab[1][3] = put_rnd_pixels8_xy;
-
-        c->put_no_rnd_pixels_tab[0][0] = put_no_rnd_pixels16_o;
-        c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x;
-        c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y;
-        c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy;
-        c->put_no_rnd_pixels_tab[1][0] = put_no_rnd_pixels8_o;
-        c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x;
-        c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y;
-        c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy;
-
-        c->avg_pixels_tab[0][0] = avg_rnd_pixels16_o;
-        c->avg_pixels_tab[0][1] = avg_rnd_pixels16_x;
-        c->avg_pixels_tab[0][2] = avg_rnd_pixels16_y;
-        c->avg_pixels_tab[0][3] = avg_rnd_pixels16_xy;
-        c->avg_pixels_tab[1][0] = avg_rnd_pixels8_o;
-        c->avg_pixels_tab[1][1] = avg_rnd_pixels8_x;
-        c->avg_pixels_tab[1][2] = avg_rnd_pixels8_y;
-        c->avg_pixels_tab[1][3] = avg_rnd_pixels8_xy;
-
-        c->avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_o;
-        c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x;
-        c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y;
-        c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy;
-        c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_o;
-        c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x;
-        c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y;
-        c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy;
-
-#ifdef QPEL
-
-#define dspfunc(PFX, IDX, NUM) \
-    c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_sh4; \
-    c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_sh4; \
-    c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_sh4; \
-    c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_sh4; \
-    c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_sh4; \
-    c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_sh4; \
-    c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_sh4; \
-    c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_sh4
-
-    dspfunc(put_qpel, 0, 16);
-    dspfunc(put_no_rnd_qpel, 0, 16);
-
-    dspfunc(avg_qpel, 0, 16);
-    /* dspfunc(avg_no_rnd_qpel, 0, 16); */
-
-    dspfunc(put_qpel, 1, 8);
-    dspfunc(put_no_rnd_qpel, 1, 8);
-
-    dspfunc(avg_qpel, 1, 8);
-    /* dspfunc(avg_no_rnd_qpel, 1, 8); */
-
-    dspfunc(put_h264_qpel, 0, 16);
-    dspfunc(put_h264_qpel, 1, 8);
-    dspfunc(put_h264_qpel, 2, 4);
-    dspfunc(avg_h264_qpel, 0, 16);
-    dspfunc(avg_h264_qpel, 1, 8);
-    dspfunc(avg_h264_qpel, 2, 4);
-
-#undef dspfunc
-    c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_sh4;
-    c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_sh4;
-    c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_sh4;
-    c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_sh4;
-    c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_sh4;
-    c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_sh4;
-
-    c->put_mspel_pixels_tab[0]= put_mspel8_mc00_sh4;
-    c->put_mspel_pixels_tab[1]= put_mspel8_mc10_sh4;
-    c->put_mspel_pixels_tab[2]= put_mspel8_mc20_sh4;
-    c->put_mspel_pixels_tab[3]= put_mspel8_mc30_sh4;
-    c->put_mspel_pixels_tab[4]= put_mspel8_mc02_sh4;
-    c->put_mspel_pixels_tab[5]= put_mspel8_mc12_sh4;
-    c->put_mspel_pixels_tab[6]= put_mspel8_mc22_sh4;
-    c->put_mspel_pixels_tab[7]= put_mspel8_mc32_sh4;
-
-    c->gmc1 = gmc1_c;
-    c->gmc = gmc_c;
-
-#endif
-}
diff --git a/libavcodec/sh4/dsputil_sh4.c b/libavcodec/sh4/dsputil_sh4.c
deleted file mode 100644
index ec06e24..0000000
--- a/libavcodec/sh4/dsputil_sh4.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- *  sh4 dsputil
- *
- * Copyright (c) 2003 BERO <bero at geocities.co.jp>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_sh4.h"
-#include "sh4.h"
-
-static void memzero_align8(void *dst,size_t size)
-{
-        int fpscr;
-        fp_single_enter(fpscr);
-        dst = (char *)dst + size;
-        size /= 32;
-        __asm__ volatile (
-        " fldi0 fr0\n"
-        " fldi0 fr1\n"
-        " fschg\n"  // double
-        "1: \n" \
-        " dt %1\n"
-        " fmov  dr0, at -%0\n"
-        " fmov  dr0, at -%0\n"
-        " fmov  dr0, at -%0\n"
-        " bf.s 1b\n"
-        " fmov  dr0, at -%0\n"
-        " fschg" //back to single
-        : "+r"(dst),"+r"(size) :: "memory" );
-        fp_single_leave(fpscr);
-}
-
-static void clear_blocks_sh4(DCTELEM *blocks)
-{
-        memzero_align8(blocks,sizeof(DCTELEM)*6*64);
-}
-
-static void idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-        int i;
-        uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-        idct_sh4(block);
-        for(i=0;i<8;i++) {
-                dest[0] = cm[block[0]];
-                dest[1] = cm[block[1]];
-                dest[2] = cm[block[2]];
-                dest[3] = cm[block[3]];
-                dest[4] = cm[block[4]];
-                dest[5] = cm[block[5]];
-                dest[6] = cm[block[6]];
-                dest[7] = cm[block[7]];
-                dest+=line_size;
-                block+=8;
-        }
-}
-static void idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-        int i;
-        uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-        idct_sh4(block);
-        for(i=0;i<8;i++) {
-                dest[0] = cm[dest[0]+block[0]];
-                dest[1] = cm[dest[1]+block[1]];
-                dest[2] = cm[dest[2]+block[2]];
-                dest[3] = cm[dest[3]+block[3]];
-                dest[4] = cm[dest[4]+block[4]];
-                dest[5] = cm[dest[5]+block[5]];
-                dest[6] = cm[dest[6]+block[6]];
-                dest[7] = cm[dest[7]+block[7]];
-                dest+=line_size;
-                block+=8;
-        }
-}
-
-void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx)
-{
-        const int idct_algo= avctx->idct_algo;
-        dsputil_init_align(c,avctx);
-
-        c->clear_blocks = clear_blocks_sh4;
-        if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4){
-                c->idct_put = idct_put;
-                c->idct_add = idct_add;
-               c->idct     = idct_sh4;
-                c->idct_permutation_type= FF_NO_IDCT_PERM;
-        }
-}
diff --git a/libavcodec/sh4/dsputil_sh4.h b/libavcodec/sh4/dsputil_sh4.h
deleted file mode 100644
index 2c1f77c..0000000
--- a/libavcodec/sh4/dsputil_sh4.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SH4_DSPUTIL_SH4_H
-#define AVCODEC_SH4_DSPUTIL_SH4_H
-
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-
-void idct_sh4(DCTELEM *block);
-void dsputil_init_align(DSPContext* c, AVCodecContext *avctx);
-
-#endif
diff --git a/libavcodec/sh4/idct_sh4.c b/libavcodec/sh4/idct_sh4.c
deleted file mode 100644
index 8d1a316..0000000
--- a/libavcodec/sh4/idct_sh4.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * idct for sh4
- *
- * Copyright (c) 2001-2003 BERO <bero at geocities.co.jp>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_sh4.h"
-#include "sh4.h"
-
-#define c1      1.38703984532214752434  /* sqrt(2)*cos(1*pi/16) */
-#define c2      1.30656296487637657577  /* sqrt(2)*cos(2*pi/16) */
-#define c3      1.17587560241935884520  /* sqrt(2)*cos(3*pi/16) */
-#define c4      1.00000000000000000000  /* sqrt(2)*cos(4*pi/16) */
-#define c5      0.78569495838710234903  /* sqrt(2)*cos(5*pi/16) */
-#define c6      0.54119610014619712324  /* sqrt(2)*cos(6*pi/16) */
-#define c7      0.27589937928294311353  /* sqrt(2)*cos(7*pi/16) */
-
-static const float even_table[] __attribute__ ((aligned(8))) = {
-        c4, c4, c4, c4,
-        c2, c6,-c6,-c2,
-        c4,-c4,-c4, c4,
-        c6,-c2, c2,-c6
-};
-
-static const float odd_table[] __attribute__ ((aligned(8))) = {
-        c1, c3, c5, c7,
-        c3,-c7,-c1,-c5,
-        c5,-c1, c7, c3,
-        c7,-c5, c3,-c1
-};
-
-#undef  c1
-#undef  c2
-#undef  c3
-#undef  c4
-#undef  c5
-#undef  c6
-#undef  c7
-
-#if 1
-
-#define         load_matrix(table) \
-    do { \
-        const float *t = table; \
-        __asm__ volatile( \
-        "       fschg\n" \
-        "       fmov   @%0+,xd0\n" \
-        "       fmov   @%0+,xd2\n" \
-        "       fmov   @%0+,xd4\n" \
-        "       fmov   @%0+,xd6\n" \
-        "       fmov   @%0+,xd8\n" \
-        "       fmov   @%0+,xd10\n" \
-        "       fmov   @%0+,xd12\n" \
-        "       fmov   @%0+,xd14\n" \
-        "       fschg\n" \
-        : "+r"(t) \
-        ); \
-    } while (0)
-
-#define         ftrv() \
-                __asm__ volatile("ftrv xmtrx,fv0" \
-                : "+f"(fr0),"+f"(fr1),"+f"(fr2),"+f"(fr3));
-
-#define         DEFREG        \
-        register float fr0 __asm__("fr0"); \
-        register float fr1 __asm__("fr1"); \
-        register float fr2 __asm__("fr2"); \
-        register float fr3 __asm__("fr3")
-
-#else
-
-/* generic C code for check */
-
-static void ftrv_(const float xf[],float fv[])
-{
-        float f0,f1,f2,f3;
-        f0 = fv[0];
-        f1 = fv[1];
-        f2 = fv[2];
-        f3 = fv[3];
-        fv[0] = xf[0]*f0 + xf[4]*f1 + xf[ 8]*f2 + xf[12]*f3;
-        fv[1] = xf[1]*f0 + xf[5]*f1 + xf[ 9]*f2 + xf[13]*f3;
-        fv[2] = xf[2]*f0 + xf[6]*f1 + xf[10]*f2 + xf[14]*f3;
-        fv[3] = xf[3]*f0 + xf[7]*f1 + xf[11]*f2 + xf[15]*f3;
-}
-
-static void load_matrix_(float xf[],const float table[])
-{
-        int i;
-        for(i=0;i<16;i++) xf[i]=table[i];
-}
-
-#define         ftrv()                  ftrv_(xf,fv)
-#define         load_matrix(table)      load_matrix_(xf,table)
-
-#define         DEFREG \
-        float fv[4],xf[16]
-
-#define         fr0     fv[0]
-#define         fr1     fv[1]
-#define         fr2     fv[2]
-#define         fr3     fv[3]
-
-#endif
-
-#if 1
-#define         DESCALE(x,n)    (x)*(1.0f/(1<<(n)))
-#else
-#define         DESCALE(x,n)    (((int)(x)+(1<<(n-1)))>>(n))
-#endif
-
-/* this code work worse on gcc cvs. 3.2.3 work fine */
-
-
-#if 1
-//optimized
-
-void idct_sh4(DCTELEM *block)
-{
-        DEFREG;
-
-        int i;
-        float        tblock[8*8],*fblock;
-        int ofs1,ofs2,ofs3;
-        int fpscr;
-
-        fp_single_enter(fpscr);
-
-        /* row */
-
-        /* even part */
-        load_matrix(even_table);
-
-        fblock = tblock+4;
-        i = 8;
-        do {
-                fr0 = block[0];
-                fr1 = block[2];
-                fr2 = block[4];
-                fr3 = block[6];
-                block+=8;
-                ftrv();
-                *--fblock = fr3;
-                *--fblock = fr2;
-                *--fblock = fr1;
-                *--fblock = fr0;
-                fblock+=8+4;
-        } while(--i);
-        block-=8*8;
-        fblock-=8*8+4;
-
-        load_matrix(odd_table);
-
-        i = 8;
-
-        do {
-                float t0,t1,t2,t3;
-                fr0 = block[1];
-                fr1 = block[3];
-                fr2 = block[5];
-                fr3 = block[7];
-                block+=8;
-                ftrv();
-                t0 = *fblock++;
-                t1 = *fblock++;
-                t2 = *fblock++;
-                t3 = *fblock++;
-                fblock+=4;
-                *--fblock = t0 - fr0;
-                *--fblock = t1 - fr1;
-                *--fblock = t2 - fr2;
-                *--fblock = t3 - fr3;
-                *--fblock = t3 + fr3;
-                *--fblock = t2 + fr2;
-                *--fblock = t1 + fr1;
-                *--fblock = t0 + fr0;
-                fblock+=8;
-        } while(--i);
-        block-=8*8;
-        fblock-=8*8;
-
-        /* col */
-
-        /* even part */
-        load_matrix(even_table);
-
-        ofs1 = sizeof(float)*2*8;
-        ofs2 = sizeof(float)*4*8;
-        ofs3 = sizeof(float)*6*8;
-
-        i = 8;
-
-#define        OA(fblock,ofs)   *(float*)((char*)fblock + ofs)
-
-        do {
-                fr0 = OA(fblock,   0);
-                fr1 = OA(fblock,ofs1);
-                fr2 = OA(fblock,ofs2);
-                fr3 = OA(fblock,ofs3);
-                ftrv();
-                OA(fblock,0   ) = fr0;
-                OA(fblock,ofs1) = fr1;
-                OA(fblock,ofs2) = fr2;
-                OA(fblock,ofs3) = fr3;
-                fblock++;
-        } while(--i);
-        fblock-=8;
-
-        load_matrix(odd_table);
-
-        i=8;
-        do {
-                float t0,t1,t2,t3;
-                t0 = OA(fblock,   0); /* [8*0] */
-                t1 = OA(fblock,ofs1); /* [8*2] */
-                t2 = OA(fblock,ofs2); /* [8*4] */
-                t3 = OA(fblock,ofs3); /* [8*6] */
-                fblock+=8;
-                fr0 = OA(fblock,   0); /* [8*1] */
-                fr1 = OA(fblock,ofs1); /* [8*3] */
-                fr2 = OA(fblock,ofs2); /* [8*5] */
-                fr3 = OA(fblock,ofs3); /* [8*7] */
-                fblock+=-8+1;
-                ftrv();
-                block[8*0] = DESCALE(t0 + fr0,3);
-                block[8*7] = DESCALE(t0 - fr0,3);
-                block[8*1] = DESCALE(t1 + fr1,3);
-                block[8*6] = DESCALE(t1 - fr1,3);
-                block[8*2] = DESCALE(t2 + fr2,3);
-                block[8*5] = DESCALE(t2 - fr2,3);
-                block[8*3] = DESCALE(t3 + fr3,3);
-                block[8*4] = DESCALE(t3 - fr3,3);
-                block++;
-        } while(--i);
-
-        fp_single_leave(fpscr);
-}
-#else
-void idct_sh4(DCTELEM *block)
-{
-        DEFREG;
-
-        int i;
-        float   tblock[8*8],*fblock;
-
-        /* row */
-
-        /* even part */
-        load_matrix(even_table);
-
-        fblock = tblock;
-        i = 8;
-        do {
-                fr0 = block[0];
-                fr1 = block[2];
-                fr2 = block[4];
-                fr3 = block[6];
-                block+=8;
-                ftrv();
-                fblock[0] = fr0;
-                fblock[2] = fr1;
-                fblock[4] = fr2;
-                fblock[6] = fr3;
-                fblock+=8;
-        } while(--i);
-        block-=8*8;
-        fblock-=8*8;
-
-        load_matrix(odd_table);
-
-        i = 8;
-
-        do {
-                float t0,t1,t2,t3;
-                fr0 = block[1];
-                fr1 = block[3];
-                fr2 = block[5];
-                fr3 = block[7];
-                block+=8;
-                ftrv();
-                t0 = fblock[0];
-                t1 = fblock[2];
-                t2 = fblock[4];
-                t3 = fblock[6];
-                fblock[0] = t0 + fr0;
-                fblock[7] = t0 - fr0;
-                fblock[1] = t1 + fr1;
-                fblock[6] = t1 - fr1;
-                fblock[2] = t2 + fr2;
-                fblock[5] = t2 - fr2;
-                fblock[3] = t3 + fr3;
-                fblock[4] = t3 - fr3;
-                fblock+=8;
-        } while(--i);
-        block-=8*8;
-        fblock-=8*8;
-
-        /* col */
-
-        /* even part */
-        load_matrix(even_table);
-
-        i = 8;
-
-        do {
-                fr0 = fblock[8*0];
-                fr1 = fblock[8*2];
-                fr2 = fblock[8*4];
-                fr3 = fblock[8*6];
-                ftrv();
-                fblock[8*0] = fr0;
-                fblock[8*2] = fr1;
-                fblock[8*4] = fr2;
-                fblock[8*6] = fr3;
-                fblock++;
-        } while(--i);
-        fblock-=8;
-
-        load_matrix(odd_table);
-
-        i=8;
-        do {
-                float t0,t1,t2,t3;
-                fr0 = fblock[8*1];
-                fr1 = fblock[8*3];
-                fr2 = fblock[8*5];
-                fr3 = fblock[8*7];
-                ftrv();
-                t0 = fblock[8*0];
-                t1 = fblock[8*2];
-                t2 = fblock[8*4];
-                t3 = fblock[8*6];
-                fblock++;
-                block[8*0] = DESCALE(t0 + fr0,3);
-                block[8*7] = DESCALE(t0 - fr0,3);
-                block[8*1] = DESCALE(t1 + fr1,3);
-                block[8*6] = DESCALE(t1 - fr1,3);
-                block[8*2] = DESCALE(t2 + fr2,3);
-                block[8*5] = DESCALE(t2 - fr2,3);
-                block[8*3] = DESCALE(t3 + fr3,3);
-                block[8*4] = DESCALE(t3 - fr3,3);
-                block++;
-        } while(--i);
-}
-#endif
diff --git a/libavcodec/sh4/qpel.c b/libavcodec/sh4/qpel.c
deleted file mode 100644
index 917068d..0000000
--- a/libavcodec/sh4/qpel.c
+++ /dev/null
@@ -1,1409 +0,0 @@
-/*
- * This is optimized for sh, which have post increment addressing (*p++).
- * Some CPU may be index (p[n]) faster than post increment (*p++).
- *
- * copyright (c) 2001-2003 BERO <bero at geocities.co.jp>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define PIXOP2(OPNAME, OP) \
-\
-static inline void OPNAME ## _pixels4_l2_aligned(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),rnd_avg32(LPC(src1  ),LPC(src2  )) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _pixels4_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),LPC(src2  )) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels16_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),no_rnd_avg32(AV_RN32(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(AV_RN32(src1+4),LPC(src2+4)) ); \
-                OP(LP(dst+8),no_rnd_avg32(AV_RN32(src1+8),LPC(src2+8)) ); \
-                OP(LP(dst+12),no_rnd_avg32(AV_RN32(src1+12),LPC(src2+12)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _pixels16_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(AV_RN32(src1+4),LPC(src2+4)) ); \
-                OP(LP(dst+8),rnd_avg32(AV_RN32(src1+8),LPC(src2+8)) ); \
-                OP(LP(dst+12),rnd_avg32(AV_RN32(src1+12),LPC(src2+12)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels8_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do { /* onlye src2 aligned */\
-                OP(LP(dst  ),no_rnd_avg32(AV_RN32(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(AV_RN32(src1+4),LPC(src2+4)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _pixels8_l2_aligned2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),rnd_avg32(AV_RN32(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(AV_RN32(src1+4),LPC(src2+4)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels8_l2_aligned(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),no_rnd_avg32(LPC(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(LPC(src1+4),LPC(src2+4)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _pixels8_l2_aligned(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),rnd_avg32(LPC(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(LPC(src1+4),LPC(src2+4)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels16_l2_aligned(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),no_rnd_avg32(LPC(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),no_rnd_avg32(LPC(src1+4),LPC(src2+4)) ); \
-                OP(LP(dst+8),no_rnd_avg32(LPC(src1+8),LPC(src2+8)) ); \
-                OP(LP(dst+12),no_rnd_avg32(LPC(src1+12),LPC(src2+12)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _pixels16_l2_aligned(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{\
-        do {\
-                OP(LP(dst  ),rnd_avg32(LPC(src1  ),LPC(src2  )) ); \
-                OP(LP(dst+4),rnd_avg32(LPC(src1+4),LPC(src2+4)) ); \
-                OP(LP(dst+8),rnd_avg32(LPC(src1+8),LPC(src2+8)) ); \
-                OP(LP(dst+12),rnd_avg32(LPC(src1+12),LPC(src2+12)) ); \
-                src1+=src_stride1; \
-                src2+=src_stride2; \
-                dst+=dst_stride; \
-        } while(--h); \
-}\
-\
-static inline void OPNAME ## _no_rnd_pixels16_l2_aligned1(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{ OPNAME ## _no_rnd_pixels16_l2_aligned2(dst,src2,src1,dst_stride,src_stride2,src_stride1,h); } \
-\
-static inline void OPNAME ## _pixels16_l2_aligned1(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{ OPNAME ## _pixels16_l2_aligned2(dst,src2,src1,dst_stride,src_stride2,src_stride1,h); } \
-\
-static inline void OPNAME ## _no_rnd_pixels8_l2_aligned1(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{ OPNAME ## _no_rnd_pixels8_l2_aligned2(dst,src2,src1,dst_stride,src_stride2,src_stride1,h); } \
-\
-static inline void OPNAME ## _pixels8_l2_aligned1(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h) \
-{ OPNAME ## _pixels8_l2_aligned2(dst,src2,src1,dst_stride,src_stride2,src_stride1,h); } \
-\
-static inline void OPNAME ## _pixels8_l4_aligned(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { \
-                uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,LPC(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+4),rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-static inline void OPNAME ## _no_rnd_pixels8_l4_aligned(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { \
-                uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,LPC(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+4),no_rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-static inline void OPNAME ## _pixels8_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { \
-                uint32_t a0,a1,a2,a3; /* src1 only not aligned */\
-                UNPACK(a0,a1,AV_RN32(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+4),rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-static inline void OPNAME ## _no_rnd_pixels8_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { \
-                uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,AV_RN32(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+4),no_rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-static inline void OPNAME ## _pixels16_l4_aligned(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { \
-                uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,LPC(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+8),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+8),LPC(src2+8)); \
-                UNPACK(a2,a3,LPC(src3+8),LPC(src4+8)); \
-                OP(LP(dst+8),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+12),LPC(src2+12)); \
-                UNPACK(a2,a3,LPC(src3+12),LPC(src4+12)); \
-                OP(LP(dst+12),rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-static inline void OPNAME ## _no_rnd_pixels16_l4_aligned(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { \
-                uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,LPC(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+4),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+8),LPC(src2+8)); \
-                UNPACK(a2,a3,LPC(src3+8),LPC(src4+8)); \
-                OP(LP(dst+8),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,LPC(src1+12),LPC(src2+12)); \
-                UNPACK(a2,a3,LPC(src3+12),LPC(src4+12)); \
-                OP(LP(dst+12),no_rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-static inline void OPNAME ## _pixels16_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { /* src1 is unaligned */\
-                uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,AV_RN32(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+8),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+8),LPC(src2+8)); \
-                UNPACK(a2,a3,LPC(src3+8),LPC(src4+8)); \
-                OP(LP(dst+8),rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+12),LPC(src2+12)); \
-                UNPACK(a2,a3,LPC(src3+12),LPC(src4+12)); \
-                OP(LP(dst+12),rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-static inline void OPNAME ## _no_rnd_pixels16_l4_aligned0(uint8_t *dst, const uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4,int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\
-        do { \
-                uint32_t a0,a1,a2,a3; \
-                UNPACK(a0,a1,AV_RN32(src1),LPC(src2)); \
-                UNPACK(a2,a3,LPC(src3),LPC(src4)); \
-                OP(LP(dst),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+4),LPC(src2+4)); \
-                UNPACK(a2,a3,LPC(src3+4),LPC(src4+4)); \
-                OP(LP(dst+4),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+8),LPC(src2+8)); \
-                UNPACK(a2,a3,LPC(src3+8),LPC(src4+8)); \
-                OP(LP(dst+8),no_rnd_PACK(a0,a1,a2,a3)); \
-                UNPACK(a0,a1,AV_RN32(src1+12),LPC(src2+12)); \
-                UNPACK(a2,a3,LPC(src3+12),LPC(src4+12)); \
-                OP(LP(dst+12),no_rnd_PACK(a0,a1,a2,a3)); \
-                src1+=src_stride1;\
-                src2+=src_stride2;\
-                src3+=src_stride3;\
-                src4+=src_stride4;\
-                dst+=dst_stride;\
-        } while(--h); \
-} \
-\
-
-#define op_avg(a, b) a = rnd_avg32(a,b)
-#define op_put(a, b) a = b
-
-PIXOP2(avg, op_avg)
-PIXOP2(put, op_put)
-#undef op_avg
-#undef op_put
-
-#define avg2(a,b) ((a+b+1)>>1)
-#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
-
-
-static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder)
-{
-    const int A=(16-x16)*(16-y16);
-    const int B=(   x16)*(16-y16);
-    const int C=(16-x16)*(   y16);
-    const int D=(   x16)*(   y16);
-
-    do {
-        int t0,t1,t2,t3;
-        uint8_t *s0 = src;
-        uint8_t *s1 = src+stride;
-        t0 = *s0++; t2 = *s1++;
-        t1 = *s0++; t3 = *s1++;
-        dst[0]= (A*t0 + B*t1 + C*t2 + D*t3 + rounder)>>8;
-        t0 = *s0++; t2 = *s1++;
-        dst[1]= (A*t1 + B*t0 + C*t3 + D*t2 + rounder)>>8;
-        t1 = *s0++; t3 = *s1++;
-        dst[2]= (A*t0 + B*t1 + C*t2 + D*t3 + rounder)>>8;
-        t0 = *s0++; t2 = *s1++;
-        dst[3]= (A*t1 + B*t0 + C*t3 + D*t2 + rounder)>>8;
-        t1 = *s0++; t3 = *s1++;
-        dst[4]= (A*t0 + B*t1 + C*t2 + D*t3 + rounder)>>8;
-        t0 = *s0++; t2 = *s1++;
-        dst[5]= (A*t1 + B*t0 + C*t3 + D*t2 + rounder)>>8;
-        t1 = *s0++; t3 = *s1++;
-        dst[6]= (A*t0 + B*t1 + C*t2 + D*t3 + rounder)>>8;
-        t0 = *s0++; t2 = *s1++;
-        dst[7]= (A*t1 + B*t0 + C*t3 + D*t2 + rounder)>>8;
-        dst+= stride;
-        src+= stride;
-    }while(--h);
-}
-
-static void gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
-                  int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height)
-{
-    int y, vx, vy;
-    const int s= 1<<shift;
-
-    width--;
-    height--;
-
-    for(y=0; y<h; y++){
-        int x;
-
-        vx= ox;
-        vy= oy;
-        for(x=0; x<8; x++){ //XXX FIXME optimize
-            int src_x, src_y, frac_x, frac_y, index;
-
-            src_x= vx>>16;
-            src_y= vy>>16;
-            frac_x= src_x&(s-1);
-            frac_y= src_y&(s-1);
-            src_x>>=shift;
-            src_y>>=shift;
-
-            if((unsigned)src_x < width){
-                if((unsigned)src_y < height){
-                    index= src_x + src_y*stride;
-                    dst[y*stride + x]= (  (  src[index         ]*(s-frac_x)
-                                           + src[index       +1]*   frac_x )*(s-frac_y)
-                                        + (  src[index+stride  ]*(s-frac_x)
-                                           + src[index+stride+1]*   frac_x )*   frac_y
-                                        + r)>>(shift*2);
-                }else{
-                    index= src_x + av_clip(src_y, 0, height)*stride;
-                    dst[y*stride + x]= ( (  src[index         ]*(s-frac_x)
-                                          + src[index       +1]*   frac_x )*s
-                                        + r)>>(shift*2);
-                }
-            }else{
-                if((unsigned)src_y < height){
-                    index= av_clip(src_x, 0, width) + src_y*stride;
-                    dst[y*stride + x]= (  (  src[index         ]*(s-frac_y)
-                                           + src[index+stride  ]*   frac_y )*s
-                                        + r)>>(shift*2);
-                }else{
-                    index= av_clip(src_x, 0, width) + av_clip(src_y, 0, height)*stride;
-                    dst[y*stride + x]=    src[index         ];
-                }
-            }
-
-            vx+= dxx;
-            vy+= dyx;
-        }
-        ox += dxy;
-        oy += dyy;
-    }
-}
-#define H264_CHROMA_MC(OPNAME, OP)\
-static void OPNAME ## h264_chroma_mc2_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    do {\
-        int t0,t1,t2,t3; \
-        uint8_t *s0 = src; \
-        uint8_t *s1 = src+stride; \
-        t0 = *s0++; t2 = *s1++; \
-        t1 = *s0++; t3 = *s1++; \
-        OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
-        t0 = *s0++; t2 = *s1++; \
-        OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
-        dst+= stride;\
-        src+= stride;\
-    }while(--h);\
-}\
-\
-static void OPNAME ## h264_chroma_mc4_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    do {\
-        int t0,t1,t2,t3; \
-        uint8_t *s0 = src; \
-        uint8_t *s1 = src+stride; \
-        t0 = *s0++; t2 = *s1++; \
-        t1 = *s0++; t3 = *s1++; \
-        OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
-        t0 = *s0++; t2 = *s1++; \
-        OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
-        t1 = *s0++; t3 = *s1++; \
-        OP(dst[2], (A*t0 + B*t1 + C*t2 + D*t3));\
-        t0 = *s0++; t2 = *s1++; \
-        OP(dst[3], (A*t1 + B*t0 + C*t3 + D*t2));\
-        dst+= stride;\
-        src+= stride;\
-    }while(--h);\
-}\
-\
-static void OPNAME ## h264_chroma_mc8_sh4(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){\
-    const int A=(8-x)*(8-y);\
-    const int B=(  x)*(8-y);\
-    const int C=(8-x)*(  y);\
-    const int D=(  x)*(  y);\
-    \
-    assert(x<8 && y<8 && x>=0 && y>=0);\
-\
-    do {\
-        int t0,t1,t2,t3; \
-        uint8_t *s0 = src; \
-        uint8_t *s1 = src+stride; \
-        t0 = *s0++; t2 = *s1++; \
-        t1 = *s0++; t3 = *s1++; \
-        OP(dst[0], (A*t0 + B*t1 + C*t2 + D*t3));\
-        t0 = *s0++; t2 = *s1++; \
-        OP(dst[1], (A*t1 + B*t0 + C*t3 + D*t2));\
-        t1 = *s0++; t3 = *s1++; \
-        OP(dst[2], (A*t0 + B*t1 + C*t2 + D*t3));\
-        t0 = *s0++; t2 = *s1++; \
-        OP(dst[3], (A*t1 + B*t0 + C*t3 + D*t2));\
-        t1 = *s0++; t3 = *s1++; \
-        OP(dst[4], (A*t0 + B*t1 + C*t2 + D*t3));\
-        t0 = *s0++; t2 = *s1++; \
-        OP(dst[5], (A*t1 + B*t0 + C*t3 + D*t2));\
-        t1 = *s0++; t3 = *s1++; \
-        OP(dst[6], (A*t0 + B*t1 + C*t2 + D*t3));\
-        t0 = *s0++; t2 = *s1++; \
-        OP(dst[7], (A*t1 + B*t0 + C*t3 + D*t2));\
-        dst+= stride;\
-        src+= stride;\
-    }while(--h);\
-}
-
-#define op_avg(a, b) a = (((a)+(((b) + 32)>>6)+1)>>1)
-#define op_put(a, b) a = (((b) + 32)>>6)
-
-H264_CHROMA_MC(put_       , op_put)
-H264_CHROMA_MC(avg_       , op_avg)
-#undef op_avg
-#undef op_put
-
-#define QPEL_MC(r, OPNAME, RND, OP) \
-static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    do {\
-        uint8_t *s = src; \
-        int src0,src1,src2,src3,src4,src5,src6,src7,src8;\
-        src0= *s++;\
-        src1= *s++;\
-        src2= *s++;\
-        src3= *s++;\
-        src4= *s++;\
-        OP(dst[0], (src0+src1)*20 - (src0+src2)*6 + (src1+src3)*3 - (src2+src4));\
-        src5= *s++;\
-        OP(dst[1], (src1+src2)*20 - (src0+src3)*6 + (src0+src4)*3 - (src1+src5));\
-        src6= *s++;\
-        OP(dst[2], (src2+src3)*20 - (src1+src4)*6 + (src0+src5)*3 - (src0+src6));\
-        src7= *s++;\
-        OP(dst[3], (src3+src4)*20 - (src2+src5)*6 + (src1+src6)*3 - (src0+src7));\
-        src8= *s++;\
-        OP(dst[4], (src4+src5)*20 - (src3+src6)*6 + (src2+src7)*3 - (src1+src8));\
-        OP(dst[5], (src5+src6)*20 - (src4+src7)*6 + (src3+src8)*3 - (src2+src8));\
-        OP(dst[6], (src6+src7)*20 - (src5+src8)*6 + (src4+src8)*3 - (src3+src7));\
-        OP(dst[7], (src7+src8)*20 - (src6+src8)*6 + (src5+src7)*3 - (src4+src6));\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }while(--h);\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int w=8;\
-    do{\
-        uint8_t *s = src, *d=dst;\
-        int src0,src1,src2,src3,src4,src5,src6,src7,src8;\
-        src0 = *s; s+=srcStride; \
-        src1 = *s; s+=srcStride; \
-        src2 = *s; s+=srcStride; \
-        src3 = *s; s+=srcStride; \
-        src4 = *s; s+=srcStride; \
-        OP(*d, (src0+src1)*20 - (src0+src2)*6 + (src1+src3)*3 - (src2+src4));d+=dstStride;\
-        src5 = *s; s+=srcStride; \
-        OP(*d, (src1+src2)*20 - (src0+src3)*6 + (src0+src4)*3 - (src1+src5));d+=dstStride;\
-        src6 = *s; s+=srcStride; \
-        OP(*d, (src2+src3)*20 - (src1+src4)*6 + (src0+src5)*3 - (src0+src6));d+=dstStride;\
-        src7 = *s; s+=srcStride; \
-        OP(*d, (src3+src4)*20 - (src2+src5)*6 + (src1+src6)*3 - (src0+src7));d+=dstStride;\
-        src8 = *s; \
-        OP(*d, (src4+src5)*20 - (src3+src6)*6 + (src2+src7)*3 - (src1+src8));d+=dstStride;\
-        OP(*d, (src5+src6)*20 - (src4+src7)*6 + (src3+src8)*3 - (src2+src8));d+=dstStride;\
-        OP(*d, (src6+src7)*20 - (src5+src8)*6 + (src4+src8)*3 - (src3+src7));d+=dstStride;\
-        OP(*d, (src7+src8)*20 - (src6+src8)*6 + (src5+src7)*3 - (src4+src6));\
-        dst++;\
-        src++;\
-    }while(--w);\
-}\
-\
-static void OPNAME ## mpeg4_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    do {\
-        uint8_t *s = src;\
-        int src0,src1,src2,src3,src4,src5,src6,src7,src8;\
-        int src9,src10,src11,src12,src13,src14,src15,src16;\
-        src0= *s++;\
-        src1= *s++;\
-        src2= *s++;\
-        src3= *s++;\
-        src4= *s++;\
-        OP(dst[ 0], (src0 +src1 )*20 - (src0 +src2 )*6 + (src1 +src3 )*3 - (src2 +src4 ));\
-        src5= *s++;\
-        OP(dst[ 1], (src1 +src2 )*20 - (src0 +src3 )*6 + (src0 +src4 )*3 - (src1 +src5 ));\
-        src6= *s++;\
-        OP(dst[ 2], (src2 +src3 )*20 - (src1 +src4 )*6 + (src0 +src5 )*3 - (src0 +src6 ));\
-        src7= *s++;\
-        OP(dst[ 3], (src3 +src4 )*20 - (src2 +src5 )*6 + (src1 +src6 )*3 - (src0 +src7 ));\
-        src8= *s++;\
-        OP(dst[ 4], (src4 +src5 )*20 - (src3 +src6 )*6 + (src2 +src7 )*3 - (src1 +src8 ));\
-        src9= *s++;\
-        OP(dst[ 5], (src5 +src6 )*20 - (src4 +src7 )*6 + (src3 +src8 )*3 - (src2 +src9 ));\
-        src10= *s++;\
-        OP(dst[ 6], (src6 +src7 )*20 - (src5 +src8 )*6 + (src4 +src9 )*3 - (src3 +src10));\
-        src11= *s++;\
-        OP(dst[ 7], (src7 +src8 )*20 - (src6 +src9 )*6 + (src5 +src10)*3 - (src4 +src11));\
-        src12= *s++;\
-        OP(dst[ 8], (src8 +src9 )*20 - (src7 +src10)*6 + (src6 +src11)*3 - (src5 +src12));\
-        src13= *s++;\
-        OP(dst[ 9], (src9 +src10)*20 - (src8 +src11)*6 + (src7 +src12)*3 - (src6 +src13));\
-        src14= *s++;\
-        OP(dst[10], (src10+src11)*20 - (src9 +src12)*6 + (src8 +src13)*3 - (src7 +src14));\
-        src15= *s++;\
-        OP(dst[11], (src11+src12)*20 - (src10+src13)*6 + (src9 +src14)*3 - (src8 +src15));\
-        src16= *s++;\
-        OP(dst[12], (src12+src13)*20 - (src11+src14)*6 + (src10+src15)*3 - (src9 +src16));\
-        OP(dst[13], (src13+src14)*20 - (src12+src15)*6 + (src11+src16)*3 - (src10+src16));\
-        OP(dst[14], (src14+src15)*20 - (src13+src16)*6 + (src12+src16)*3 - (src11+src15));\
-        OP(dst[15], (src15+src16)*20 - (src14+src16)*6 + (src13+src15)*3 - (src12+src14));\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }while(--h);\
-}\
-\
-static void OPNAME ## mpeg4_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int w=16;\
-    do {\
-        uint8_t *s = src, *d=dst;\
-        int src0,src1,src2,src3,src4,src5,src6,src7,src8;\
-        int src9,src10,src11,src12,src13,src14,src15,src16;\
-        src0 = *s; s+=srcStride; \
-        src1 = *s; s+=srcStride; \
-        src2 = *s; s+=srcStride; \
-        src3 = *s; s+=srcStride; \
-        src4 = *s; s+=srcStride; \
-        OP(*d, (src0 +src1 )*20 - (src0 +src2 )*6 + (src1 +src3 )*3 - (src2 +src4 ));d+=dstStride;\
-        src5 = *s; s+=srcStride; \
-        OP(*d, (src1 +src2 )*20 - (src0 +src3 )*6 + (src0 +src4 )*3 - (src1 +src5 ));d+=dstStride;\
-        src6 = *s; s+=srcStride; \
-        OP(*d, (src2 +src3 )*20 - (src1 +src4 )*6 + (src0 +src5 )*3 - (src0 +src6 ));d+=dstStride;\
-        src7 = *s; s+=srcStride; \
-        OP(*d, (src3 +src4 )*20 - (src2 +src5 )*6 + (src1 +src6 )*3 - (src0 +src7 ));d+=dstStride;\
-        src8 = *s; s+=srcStride; \
-        OP(*d, (src4 +src5 )*20 - (src3 +src6 )*6 + (src2 +src7 )*3 - (src1 +src8 ));d+=dstStride;\
-        src9 = *s; s+=srcStride; \
-        OP(*d, (src5 +src6 )*20 - (src4 +src7 )*6 + (src3 +src8 )*3 - (src2 +src9 ));d+=dstStride;\
-        src10 = *s; s+=srcStride; \
-        OP(*d, (src6 +src7 )*20 - (src5 +src8 )*6 + (src4 +src9 )*3 - (src3 +src10));d+=dstStride;\
-        src11 = *s; s+=srcStride; \
-        OP(*d, (src7 +src8 )*20 - (src6 +src9 )*6 + (src5 +src10)*3 - (src4 +src11));d+=dstStride;\
-        src12 = *s; s+=srcStride; \
-        OP(*d, (src8 +src9 )*20 - (src7 +src10)*6 + (src6 +src11)*3 - (src5 +src12));d+=dstStride;\
-        src13 = *s; s+=srcStride; \
-        OP(*d, (src9 +src10)*20 - (src8 +src11)*6 + (src7 +src12)*3 - (src6 +src13));d+=dstStride;\
-        src14 = *s; s+=srcStride; \
-        OP(*d, (src10+src11)*20 - (src9 +src12)*6 + (src8 +src13)*3 - (src7 +src14));d+=dstStride;\
-        src15 = *s; s+=srcStride; \
-        OP(*d, (src11+src12)*20 - (src10+src13)*6 + (src9 +src14)*3 - (src8 +src15));d+=dstStride;\
-        src16 = *s; \
-        OP(*d, (src12+src13)*20 - (src11+src14)*6 + (src10+src15)*3 - (src9 +src16));d+=dstStride;\
-        OP(*d, (src13+src14)*20 - (src12+src15)*6 + (src11+src16)*3 - (src10+src16));d+=dstStride;\
-        OP(*d, (src14+src15)*20 - (src13+src16)*6 + (src12+src16)*3 - (src11+src15));d+=dstStride;\
-        OP(*d, (src15+src16)*20 - (src14+src16)*6 + (src13+src15)*3 - (src12+src14));\
-        dst++;\
-        src++;\
-    }while(--w);\
-}\
-\
-static void OPNAME ## qpel8_mc00_sh4 (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels8_c(dst, src, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc10_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
-    OPNAME ## pixels8_l2_aligned2(dst, src, half, stride, stride, 8, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc20_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel8_h_lowpass(dst, src, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc30_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(half, src, 8, stride, 8);\
-    OPNAME ## pixels8_l2_aligned2(dst, src+1, half, stride, stride, 8, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc01_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t half[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
-    OPNAME ## pixels8_l2_aligned(dst, full, half, stride, 16, 8, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc02_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    copy_block9(full, src, 16, stride, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);\
-}\
-\
-static void OPNAME ## qpel8_mc03_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t half[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);\
-    OPNAME ## pixels8_l2_aligned(dst, full+16, half, stride, 16, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc11_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2_aligned(halfH, halfH, full, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_aligned(dst, halfH, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc31_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2_aligned1(halfH, halfH, full+1, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_aligned(dst, halfH, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc13_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2_aligned(halfH, halfH, full, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_aligned(dst, halfH+8, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc33_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2_aligned1(halfH, halfH, full+1, 8, 8, 16, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_aligned(dst, halfH+8, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc21_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_aligned(dst, halfH, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc23_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[72];\
-    uint8_t halfHV[64];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_aligned(dst, halfH+8, halfHV, stride, 8, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc12_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2_aligned(halfH, halfH, full, 8, 8, 16, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc32_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[16*9];\
-    uint8_t halfH[72];\
-    copy_block9(full, src, 16, stride, 9);\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, full, 8, 16, 9);\
-    put ## RND ## pixels8_l2_aligned1(halfH, halfH, full+1, 8, 8, 16, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc22_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[72];\
-    put ## RND ## mpeg4_qpel8_h_lowpass(halfH, src, 8, stride, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel16_mc00_sh4 (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels16_c(dst, src, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc10_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
-    OPNAME ## pixels16_l2_aligned2(dst, src, half, stride, stride, 16, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc20_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel16_h_lowpass(dst, src, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc30_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(half, src, 16, stride, 16);\
-    OPNAME ## pixels16_l2_aligned2(dst, src+1, half, stride, stride, 16, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc01_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t half[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
-    OPNAME ## pixels16_l2_aligned(dst, full, half, stride, 24, 16, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc02_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    copy_block17(full, src, 24, stride, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);\
-}\
-\
-static void OPNAME ## qpel16_mc03_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t half[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);\
-    OPNAME ## pixels16_l2_aligned(dst, full+24, half, stride, 24, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc11_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2_aligned(halfH, halfH, full, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_aligned(dst, halfH, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc31_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2_aligned1(halfH, halfH, full+1, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_aligned(dst, halfH, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc13_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2_aligned(halfH, halfH, full, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_aligned(dst, halfH+16, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc33_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2_aligned1(halfH, halfH, full+1, 16, 16, 24, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_aligned(dst, halfH+16, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc21_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_aligned(dst, halfH, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc23_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[272];\
-    uint8_t halfHV[256];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_aligned(dst, halfH+16, halfHV, stride, 16, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc12_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2_aligned(halfH, halfH, full, 16, 16, 24, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc32_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[24*17];\
-    uint8_t halfH[272];\
-    copy_block17(full, src, 24, stride, 17);\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, full, 16, 24, 17);\
-    put ## RND ## pixels16_l2_aligned1(halfH, halfH, full+1, 16, 16, 24, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc22_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t halfH[272];\
-    put ## RND ## mpeg4_qpel16_h_lowpass(halfH, src, 16, stride, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);\
-}
-
-#define op_avg(a, b) a = (((a)+cm[((b) + 16)>>5]+1)>>1)
-#define op_avg_no_rnd(a, b) a = (((a)+cm[((b) + 15)>>5])>>1)
-#define op_put(a, b) a = cm[((b) + 16)>>5]
-#define op_put_no_rnd(a, b) a = cm[((b) + 15)>>5]
-
-QPEL_MC(0, put_       , _       , op_put)
-QPEL_MC(1, put_no_rnd_, _no_rnd_, op_put_no_rnd)
-QPEL_MC(0, avg_       , _       , op_avg)
-//QPEL_MC(1, avg_no_rnd , _       , op_avg)
-#undef op_avg
-#undef op_avg_no_rnd
-#undef op_put
-#undef op_put_no_rnd
-
-#if 1
-#define H264_LOWPASS(OPNAME, OP, OP2) \
-static inline void OPNAME ## h264_qpel_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,int w,int h){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    do {\
-        int srcB,srcA,src0,src1,src2,src3,src4,src5,src6;\
-        uint8_t *s = src-2;\
-        srcB = *s++;\
-        srcA = *s++;\
-        src0 = *s++;\
-        src1 = *s++;\
-        src2 = *s++;\
-        src3 = *s++;\
-        OP(dst[0], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
-        src4 = *s++;\
-        OP(dst[1], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
-        src5 = *s++;\
-        OP(dst[2], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
-        src6 = *s++;\
-        OP(dst[3], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
-      if (w>4) { /* it optimized */ \
-        int src7,src8,src9,src10; \
-        src7 = *s++;\
-        OP(dst[4], (src4+src5)*20 - (src3+src6)*5 + (src2+src7));\
-        src8 = *s++;\
-        OP(dst[5], (src5+src6)*20 - (src4+src7)*5 + (src3+src8));\
-        src9 = *s++;\
-        OP(dst[6], (src6+src7)*20 - (src5+src8)*5 + (src4+src9));\
-        src10 = *s++;\
-        OP(dst[7], (src7+src8)*20 - (src6+src9)*5 + (src5+src10));\
-       if (w>8) { \
-        int src11,src12,src13,src14,src15,src16,src17,src18; \
-        src11 = *s++;\
-        OP(dst[8] , (src8 +src9 )*20 - (src7 +src10)*5 + (src6 +src11));\
-        src12 = *s++;\
-        OP(dst[9] , (src9 +src10)*20 - (src8 +src11)*5 + (src7 +src12));\
-        src13 = *s++;\
-        OP(dst[10], (src10+src11)*20 - (src9 +src12)*5 + (src8 +src13));\
-        src14 = *s++;\
-        OP(dst[11], (src11+src12)*20 - (src10+src13)*5 + (src9 +src14));\
-        src15 = *s++;\
-        OP(dst[12], (src12+src13)*20 - (src11+src14)*5 + (src10+src15));\
-        src16 = *s++;\
-        OP(dst[13], (src13+src14)*20 - (src12+src15)*5 + (src11+src16));\
-        src17 = *s++;\
-        OP(dst[14], (src14+src15)*20 - (src13+src16)*5 + (src12+src17));\
-        src18 = *s++;\
-        OP(dst[15], (src15+src16)*20 - (src14+src17)*5 + (src13+src18));\
-       } \
-      } \
-        dst+=dstStride;\
-        src+=srcStride;\
-    }while(--h);\
-}\
-\
-static inline void OPNAME ## h264_qpel_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride,int w,int h){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    do{\
-        int srcB,srcA,src0,src1,src2,src3,src4,src5,src6;\
-        uint8_t *s = src-2*srcStride,*d=dst;\
-        srcB = *s; s+=srcStride;\
-        srcA = *s; s+=srcStride;\
-        src0 = *s; s+=srcStride;\
-        src1 = *s; s+=srcStride;\
-        src2 = *s; s+=srcStride;\
-        src3 = *s; s+=srcStride;\
-        OP(*d, (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));d+=dstStride;\
-        src4 = *s; s+=srcStride;\
-        OP(*d, (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));d+=dstStride;\
-        src5 = *s; s+=srcStride;\
-        OP(*d, (src2+src3)*20 - (src1+src4)*5 + (src0+src5));d+=dstStride;\
-        src6 = *s; s+=srcStride;\
-        OP(*d, (src3+src4)*20 - (src2+src5)*5 + (src1+src6));d+=dstStride;\
-      if (h>4) { \
-        int src7,src8,src9,src10; \
-        src7 = *s; s+=srcStride;\
-        OP(*d, (src4+src5)*20 - (src3+src6)*5 + (src2+src7));d+=dstStride;\
-        src8 = *s; s+=srcStride;\
-        OP(*d, (src5+src6)*20 - (src4+src7)*5 + (src3+src8));d+=dstStride;\
-        src9 = *s; s+=srcStride;\
-        OP(*d, (src6+src7)*20 - (src5+src8)*5 + (src4+src9));d+=dstStride;\
-        src10 = *s; s+=srcStride;\
-        OP(*d, (src7+src8)*20 - (src6+src9)*5 + (src5+src10));d+=dstStride;\
-       if (h>8) { \
-        int src11,src12,src13,src14,src15,src16,src17,src18; \
-        src11 = *s; s+=srcStride;\
-        OP(*d , (src8 +src9 )*20 - (src7 +src10)*5 + (src6 +src11));d+=dstStride;\
-        src12 = *s; s+=srcStride;\
-        OP(*d , (src9 +src10)*20 - (src8 +src11)*5 + (src7 +src12));d+=dstStride;\
-        src13 = *s; s+=srcStride;\
-        OP(*d, (src10+src11)*20 - (src9 +src12)*5 + (src8 +src13));d+=dstStride;\
-        src14 = *s; s+=srcStride;\
-        OP(*d, (src11+src12)*20 - (src10+src13)*5 + (src9 +src14));d+=dstStride;\
-        src15 = *s; s+=srcStride;\
-        OP(*d, (src12+src13)*20 - (src11+src14)*5 + (src10+src15));d+=dstStride;\
-        src16 = *s; s+=srcStride;\
-        OP(*d, (src13+src14)*20 - (src12+src15)*5 + (src11+src16));d+=dstStride;\
-        src17 = *s; s+=srcStride;\
-        OP(*d, (src14+src15)*20 - (src13+src16)*5 + (src12+src17));d+=dstStride;\
-        src18 = *s; s+=srcStride;\
-        OP(*d, (src15+src16)*20 - (src14+src17)*5 + (src13+src18));d+=dstStride;\
-       } \
-      } \
-        dst++;\
-        src++;\
-    }while(--w);\
-}\
-\
-static inline void OPNAME ## h264_qpel_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride,int w,int h){\
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\
-    int i;\
-    src -= 2*srcStride;\
-    i= h+5; \
-    do {\
-        int srcB,srcA,src0,src1,src2,src3,src4,src5,src6;\
-        uint8_t *s = src-2;\
-        srcB = *s++;\
-        srcA = *s++;\
-        src0 = *s++;\
-        src1 = *s++;\
-        src2 = *s++;\
-        src3 = *s++;\
-        tmp[0] = ((src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
-        src4 = *s++;\
-        tmp[1] = ((src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
-        src5 = *s++;\
-        tmp[2] = ((src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
-        src6 = *s++;\
-        tmp[3] = ((src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
-      if (w>4) { /* it optimized */ \
-        int src7,src8,src9,src10; \
-        src7 = *s++;\
-        tmp[4] = ((src4+src5)*20 - (src3+src6)*5 + (src2+src7));\
-        src8 = *s++;\
-        tmp[5] = ((src5+src6)*20 - (src4+src7)*5 + (src3+src8));\
-        src9 = *s++;\
-        tmp[6] = ((src6+src7)*20 - (src5+src8)*5 + (src4+src9));\
-        src10 = *s++;\
-        tmp[7] = ((src7+src8)*20 - (src6+src9)*5 + (src5+src10));\
-       if (w>8) { \
-        int src11,src12,src13,src14,src15,src16,src17,src18; \
-        src11 = *s++;\
-        tmp[8] = ((src8 +src9 )*20 - (src7 +src10)*5 + (src6 +src11));\
-        src12 = *s++;\
-        tmp[9] = ((src9 +src10)*20 - (src8 +src11)*5 + (src7 +src12));\
-        src13 = *s++;\
-        tmp[10] = ((src10+src11)*20 - (src9 +src12)*5 + (src8 +src13));\
-        src14 = *s++;\
-        tmp[11] = ((src11+src12)*20 - (src10+src13)*5 + (src9 +src14));\
-        src15 = *s++;\
-        tmp[12] = ((src12+src13)*20 - (src11+src14)*5 + (src10+src15));\
-        src16 = *s++;\
-        tmp[13] = ((src13+src14)*20 - (src12+src15)*5 + (src11+src16));\
-        src17 = *s++;\
-        tmp[14] = ((src14+src15)*20 - (src13+src16)*5 + (src12+src17));\
-        src18 = *s++;\
-        tmp[15] = ((src15+src16)*20 - (src14+src17)*5 + (src13+src18));\
-       } \
-      } \
-        tmp+=tmpStride;\
-        src+=srcStride;\
-    }while(--i);\
-    tmp -= tmpStride*(h+5-2);\
-    i = w; \
-    do {\
-        int tmpB,tmpA,tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6;\
-        int16_t *s = tmp-2*tmpStride; \
-        uint8_t *d=dst;\
-        tmpB = *s; s+=tmpStride;\
-        tmpA = *s; s+=tmpStride;\
-        tmp0 = *s; s+=tmpStride;\
-        tmp1 = *s; s+=tmpStride;\
-        tmp2 = *s; s+=tmpStride;\
-        tmp3 = *s; s+=tmpStride;\
-        OP2(*d, (tmp0+tmp1)*20 - (tmpA+tmp2)*5 + (tmpB+tmp3));d+=dstStride;\
-        tmp4 = *s; s+=tmpStride;\
-        OP2(*d, (tmp1+tmp2)*20 - (tmp0+tmp3)*5 + (tmpA+tmp4));d+=dstStride;\
-        tmp5 = *s; s+=tmpStride;\
-        OP2(*d, (tmp2+tmp3)*20 - (tmp1+tmp4)*5 + (tmp0+tmp5));d+=dstStride;\
-        tmp6 = *s; s+=tmpStride;\
-        OP2(*d, (tmp3+tmp4)*20 - (tmp2+tmp5)*5 + (tmp1+tmp6));d+=dstStride;\
-      if (h>4) { \
-        int tmp7,tmp8,tmp9,tmp10; \
-        tmp7 = *s; s+=tmpStride;\
-        OP2(*d, (tmp4+tmp5)*20 - (tmp3+tmp6)*5 + (tmp2+tmp7));d+=dstStride;\
-        tmp8 = *s; s+=tmpStride;\
-        OP2(*d, (tmp5+tmp6)*20 - (tmp4+tmp7)*5 + (tmp3+tmp8));d+=dstStride;\
-        tmp9 = *s; s+=tmpStride;\
-        OP2(*d, (tmp6+tmp7)*20 - (tmp5+tmp8)*5 + (tmp4+tmp9));d+=dstStride;\
-        tmp10 = *s; s+=tmpStride;\
-        OP2(*d, (tmp7+tmp8)*20 - (tmp6+tmp9)*5 + (tmp5+tmp10));d+=dstStride;\
-       if (h>8) { \
-        int tmp11,tmp12,tmp13,tmp14,tmp15,tmp16,tmp17,tmp18; \
-        tmp11 = *s; s+=tmpStride;\
-        OP2(*d , (tmp8 +tmp9 )*20 - (tmp7 +tmp10)*5 + (tmp6 +tmp11));d+=dstStride;\
-        tmp12 = *s; s+=tmpStride;\
-        OP2(*d , (tmp9 +tmp10)*20 - (tmp8 +tmp11)*5 + (tmp7 +tmp12));d+=dstStride;\
-        tmp13 = *s; s+=tmpStride;\
-        OP2(*d, (tmp10+tmp11)*20 - (tmp9 +tmp12)*5 + (tmp8 +tmp13));d+=dstStride;\
-        tmp14 = *s; s+=tmpStride;\
-        OP2(*d, (tmp11+tmp12)*20 - (tmp10+tmp13)*5 + (tmp9 +tmp14));d+=dstStride;\
-        tmp15 = *s; s+=tmpStride;\
-        OP2(*d, (tmp12+tmp13)*20 - (tmp11+tmp14)*5 + (tmp10+tmp15));d+=dstStride;\
-        tmp16 = *s; s+=tmpStride;\
-        OP2(*d, (tmp13+tmp14)*20 - (tmp12+tmp15)*5 + (tmp11+tmp16));d+=dstStride;\
-        tmp17 = *s; s+=tmpStride;\
-        OP2(*d, (tmp14+tmp15)*20 - (tmp13+tmp16)*5 + (tmp12+tmp17));d+=dstStride;\
-        tmp18 = *s; s+=tmpStride;\
-        OP2(*d, (tmp15+tmp16)*20 - (tmp14+tmp17)*5 + (tmp13+tmp18));d+=dstStride;\
-       } \
-      } \
-        dst++;\
-        tmp++;\
-    }while(--i);\
-}\
-\
-static void OPNAME ## h264_qpel4_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel_h_lowpass(dst,src,dstStride,srcStride,4,4); \
-}\
-static void OPNAME ## h264_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-   OPNAME ## h264_qpel_h_lowpass(dst,src,dstStride,srcStride,8,8); \
-}\
-static void OPNAME ## h264_qpel16_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-   OPNAME ## h264_qpel_h_lowpass(dst,src,dstStride,srcStride,16,16); \
-}\
-\
-static void OPNAME ## h264_qpel4_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-   OPNAME ## h264_qpel_v_lowpass(dst,src,dstStride,srcStride,4,4); \
-}\
-static void OPNAME ## h264_qpel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-   OPNAME ## h264_qpel_v_lowpass(dst,src,dstStride,srcStride,8,8); \
-}\
-static void OPNAME ## h264_qpel16_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-   OPNAME ## h264_qpel_v_lowpass(dst,src,dstStride,srcStride,16,16); \
-}\
-static void OPNAME ## h264_qpel4_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-   OPNAME ## h264_qpel_hv_lowpass(dst,tmp,src,dstStride,tmpStride,srcStride,4,4); \
-}\
-static void OPNAME ## h264_qpel8_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-   OPNAME ## h264_qpel_hv_lowpass(dst,tmp,src,dstStride,tmpStride,srcStride,8,8); \
-}\
-static void OPNAME ## h264_qpel16_hv_lowpass(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-   OPNAME ## h264_qpel_hv_lowpass(dst,tmp,src,dstStride,tmpStride,srcStride,16,16); \
-}\
-
-#define H264_MC(OPNAME, SIZE) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc00_sh4 (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc10_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned2(dst, src, half, stride, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc20_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc30_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t half[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(half, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned2(dst, src+1, half, stride, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc01_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t half[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, full_mid, half, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc02_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    OPNAME ## h264_qpel ## SIZE ## _v_lowpass(dst, full_mid, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc03_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t half[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(half, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, full_mid+SIZE, half, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc11_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc31_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2 + 1, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc13_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc33_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
-    copy_block ## SIZE (full, src - stride*2 + 1, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc22_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    OPNAME ## h264_qpel ## SIZE ## _hv_lowpass(dst, tmp, src, stride, SIZE, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc21_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc23_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfH[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _h_lowpass(halfH, src + stride, SIZE, stride);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc12_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfV[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc32_sh4(uint8_t *dst, uint8_t *src, int stride){\
-    uint8_t full[SIZE*(SIZE+5)];\
-    uint8_t * const full_mid= full + SIZE*2;\
-    int16_t tmp[SIZE*(SIZE+5)];\
-    uint8_t halfV[SIZE*SIZE];\
-    uint8_t halfHV[SIZE*SIZE];\
-    copy_block ## SIZE (full, src - stride*2 + 1, SIZE,  stride, SIZE + 5);\
-    put_h264_qpel ## SIZE ## _v_lowpass(halfV, full_mid, SIZE, SIZE);\
-    put_h264_qpel ## SIZE ## _hv_lowpass(halfHV, tmp, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_aligned(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
-}\
-
-#define op_avg(a, b)  a = (((a)+cm[((b) + 16)>>5]+1)>>1)
-//#define op_avg2(a, b) a = (((a)*w1+cm[((b) + 16)>>5]*w2 + o + 64)>>7)
-#define op_put(a, b)  a = cm[((b) + 16)>>5]
-#define op2_avg(a, b)  a = (((a)+cm[((b) + 512)>>10]+1)>>1)
-#define op2_put(a, b)  a = cm[((b) + 512)>>10]
-
-H264_LOWPASS(put_       , op_put, op2_put)
-H264_LOWPASS(avg_       , op_avg, op2_avg)
-H264_MC(put_, 4)
-H264_MC(put_, 8)
-H264_MC(put_, 16)
-H264_MC(avg_, 4)
-H264_MC(avg_, 8)
-H264_MC(avg_, 16)
-
-#undef op_avg
-#undef op_put
-#undef op2_avg
-#undef op2_put
-#endif
-
-static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    do{
-        int src_1,src0,src1,src2,src3,src4,src5,src6,src7,src8,src9;
-        uint8_t *s = src;
-        src_1 = s[-1];
-        src0 = *s++;
-        src1 = *s++;
-        src2 = *s++;
-        dst[0]= cm[(9*(src0 + src1) - (src_1 + src2) + 8)>>4];
-        src3 = *s++;
-        dst[1]= cm[(9*(src1 + src2) - (src0 + src3) + 8)>>4];
-        src4 = *s++;
-        dst[2]= cm[(9*(src2 + src3) - (src1 + src4) + 8)>>4];
-        src5 = *s++;
-        dst[3]= cm[(9*(src3 + src4) - (src2 + src5) + 8)>>4];
-        src6 = *s++;
-        dst[4]= cm[(9*(src4 + src5) - (src3 + src6) + 8)>>4];
-        src7 = *s++;
-        dst[5]= cm[(9*(src5 + src6) - (src4 + src7) + 8)>>4];
-        src8 = *s++;
-        dst[6]= cm[(9*(src6 + src7) - (src5 + src8) + 8)>>4];
-        src9 = *s++;
-        dst[7]= cm[(9*(src7 + src8) - (src6 + src9) + 8)>>4];
-        dst+=dstStride;
-        src+=srcStride;
-    }while(--h);
-}
-
-static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    do{
-        int src_1,src0,src1,src2,src3,src4,src5,src6,src7,src8,src9;
-        uint8_t *s = src,*d = dst;
-        src_1 = *(s-srcStride);
-        src0 = *s; s+=srcStride;
-        src1 = *s; s+=srcStride;
-        src2 = *s; s+=srcStride;
-        *d= cm[(9*(src0 + src1) - (src_1 + src2) + 8)>>4]; d+=dstStride;
-        src3 = *s; s+=srcStride;
-        *d= cm[(9*(src1 + src2) - (src0  + src3) + 8)>>4]; d+=dstStride;
-        src4 = *s; s+=srcStride;
-        *d= cm[(9*(src2 + src3) - (src1  + src4) + 8)>>4]; d+=dstStride;
-        src5 = *s; s+=srcStride;
-        *d= cm[(9*(src3 + src4) - (src2  + src5) + 8)>>4]; d+=dstStride;
-        src6 = *s; s+=srcStride;
-        *d= cm[(9*(src4 + src5) - (src3  + src6) + 8)>>4]; d+=dstStride;
-        src7 = *s; s+=srcStride;
-        *d= cm[(9*(src5 + src6) - (src4  + src7) + 8)>>4]; d+=dstStride;
-        src8 = *s; s+=srcStride;
-        *d= cm[(9*(src6 + src7) - (src5  + src8) + 8)>>4]; d+=dstStride;
-        src9 = *s;
-        *d= cm[(9*(src7 + src8) - (src6  + src9) + 8)>>4]; d+=dstStride;
-        src++;
-        dst++;
-    }while(--w);
-}
-
-static void put_mspel8_mc00_sh4 (uint8_t *dst, uint8_t *src, int stride){
-    put_pixels8_c(dst, src, stride, 8);
-}
-
-static void put_mspel8_mc10_sh4(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t half[64];
-    wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
-    put_pixels8_l2_aligned2(dst, src, half, stride, stride, 8, 8);
-}
-
-static void put_mspel8_mc20_sh4(uint8_t *dst, uint8_t *src, int stride){
-    wmv2_mspel8_h_lowpass(dst, src, stride, stride, 8);
-}
-
-static void put_mspel8_mc30_sh4(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t half[64];
-    wmv2_mspel8_h_lowpass(half, src, 8, stride, 8);
-    put_pixels8_l2_aligned2(dst, src+1, half, stride, stride, 8, 8);
-}
-
-static void put_mspel8_mc02_sh4(uint8_t *dst, uint8_t *src, int stride){
-    wmv2_mspel8_v_lowpass(dst, src, stride, stride, 8);
-}
-
-static void put_mspel8_mc12_sh4(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t halfH[88];
-    uint8_t halfV[64];
-    uint8_t halfHV[64];
-    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
-    wmv2_mspel8_v_lowpass(halfV, src, 8, stride, 8);
-    wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
-    put_pixels8_l2_aligned(dst, halfV, halfHV, stride, 8, 8, 8);
-}
-static void put_mspel8_mc32_sh4(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t halfH[88];
-    uint8_t halfV[64];
-    uint8_t halfHV[64];
-    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
-    wmv2_mspel8_v_lowpass(halfV, src+1, 8, stride, 8);
-    wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8);
-    put_pixels8_l2_aligned(dst, halfV, halfHV, stride, 8, 8, 8);
-}
-static void put_mspel8_mc22_sh4(uint8_t *dst, uint8_t *src, int stride){
-    uint8_t halfH[88];
-    wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11);
-    wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8);
-}
diff --git a/libavcodec/sh4/sh4.h b/libavcodec/sh4/sh4.h
deleted file mode 100644
index 5d46540..0000000
--- a/libavcodec/sh4/sh4.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SH4_SH4_H
-#define AVCODEC_SH4_SH4_H
-
-#ifdef __SH4__
-#   define fp_single_enter(fpscr)                               \
-    do {                                                        \
-        __asm__ volatile ("sts   fpscr, %0     \n\t"            \
-                          "and   %1,    %0     \n\t"            \
-                          "lds   %0,    fpscr  \n\t"            \
-                          : "=&r"(fpscr) : "r"(~(1<<19)));      \
-    } while (0)
-
-#   define fp_single_leave(fpscr)                       \
-    do {                                                \
-        __asm__ volatile ("or    %1,    %0     \n\t"    \
-                          "lds   %0,    fpscr  \n\t"    \
-                          : "+r"(fpscr) : "r"(1<<19));  \
-    } while (0)
-#else
-#   define fp_single_enter(fpscr) ((void)fpscr)
-#   define fp_single_leave(fpscr)
-#endif
-
-#endif /* AVCODEC_SH4_SH4_H */
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
deleted file mode 100644
index 7e17f18..0000000
--- a/libavcodec/shorten.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Shorten decoder
- * Copyright (c) 2005 Jeff Muizelaar
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Shorten decoder
- * @author Jeff Muizelaar
- *
- */
-
-#define DEBUG
-#include <limits.h>
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-
-#define MAX_CHANNELS 8
-#define MAX_BLOCKSIZE 65535
-
-#define OUT_BUFFER_SIZE 16384
-
-#define ULONGSIZE 2
-
-#define WAVE_FORMAT_PCM 0x0001
-
-#define DEFAULT_BLOCK_SIZE 256
-
-#define TYPESIZE 4
-#define CHANSIZE 0
-#define LPCQSIZE 2
-#define ENERGYSIZE 3
-#define BITSHIFTSIZE 2
-
-#define TYPE_S16HL 3
-#define TYPE_S16LH 5
-
-#define NWRAP 3
-#define NSKIPSIZE 1
-
-#define LPCQUANT 5
-#define V2LPCQOFFSET (1 << LPCQUANT)
-
-#define FNSIZE 2
-#define FN_DIFF0        0
-#define FN_DIFF1        1
-#define FN_DIFF2        2
-#define FN_DIFF3        3
-#define FN_QUIT         4
-#define FN_BLOCKSIZE    5
-#define FN_BITSHIFT     6
-#define FN_QLPC         7
-#define FN_ZERO         8
-#define FN_VERBATIM     9
-
-#define VERBATIM_CKSIZE_SIZE 5
-#define VERBATIM_BYTE_SIZE 8
-#define CANONICAL_HEADER_SIZE 44
-
-typedef struct ShortenContext {
-    AVCodecContext *avctx;
-    GetBitContext gb;
-
-    int min_framesize, max_framesize;
-    int channels;
-
-    int32_t *decoded[MAX_CHANNELS];
-    int32_t *offset[MAX_CHANNELS];
-    uint8_t *bitstream;
-    int bitstream_size;
-    int bitstream_index;
-    unsigned int allocated_bitstream_size;
-    int header_size;
-    uint8_t header[OUT_BUFFER_SIZE];
-    int version;
-    int cur_chan;
-    int bitshift;
-    int nmean;
-    int internal_ftype;
-    int nwrap;
-    int blocksize;
-    int bitindex;
-    int32_t lpcqoffset;
-} ShortenContext;
-
-static av_cold int shorten_decode_init(AVCodecContext * avctx)
-{
-    ShortenContext *s = avctx->priv_data;
-    s->avctx = avctx;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    return 0;
-}
-
-static int allocate_buffers(ShortenContext *s)
-{
-    int i, chan;
-    for (chan=0; chan<s->channels; chan++) {
-        if(FFMAX(1, s->nmean) >= UINT_MAX/sizeof(int32_t)){
-            av_log(s->avctx, AV_LOG_ERROR, "nmean too large\n");
-            return -1;
-        }
-        if(s->blocksize + s->nwrap >= UINT_MAX/sizeof(int32_t) || s->blocksize + s->nwrap <= (unsigned)s->nwrap){
-            av_log(s->avctx, AV_LOG_ERROR, "s->blocksize + s->nwrap too large\n");
-            return -1;
-        }
-
-        s->offset[chan] = av_realloc(s->offset[chan], sizeof(int32_t)*FFMAX(1, s->nmean));
-
-        s->decoded[chan] = av_realloc(s->decoded[chan], sizeof(int32_t)*(s->blocksize + s->nwrap));
-        for (i=0; i<s->nwrap; i++)
-            s->decoded[chan][i] = 0;
-        s->decoded[chan] += s->nwrap;
-    }
-    return 0;
-}
-
-
-static inline unsigned int get_uint(ShortenContext *s, int k)
-{
-    if (s->version != 0)
-        k = get_ur_golomb_shorten(&s->gb, ULONGSIZE);
-    return get_ur_golomb_shorten(&s->gb, k);
-}
-
-
-static void fix_bitshift(ShortenContext *s, int32_t *buffer)
-{
-    int i;
-
-    if (s->bitshift != 0)
-        for (i = 0; i < s->blocksize; i++)
-            buffer[s->nwrap + i] <<= s->bitshift;
-}
-
-
-static void init_offset(ShortenContext *s)
-{
-    int32_t mean = 0;
-    int  chan, i;
-    int nblock = FFMAX(1, s->nmean);
-    /* initialise offset */
-    switch (s->internal_ftype)
-    {
-        case TYPE_S16HL:
-        case TYPE_S16LH:
-            mean = 0;
-            break;
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "unknown audio type");
-            abort();
-    }
-
-    for (chan = 0; chan < s->channels; chan++)
-        for (i = 0; i < nblock; i++)
-            s->offset[chan][i] = mean;
-}
-
-static inline int get_le32(GetBitContext *gb)
-{
-    return bswap_32(get_bits_long(gb, 32));
-}
-
-static inline short get_le16(GetBitContext *gb)
-{
-    return bswap_16(get_bits_long(gb, 16));
-}
-
-static int decode_wave_header(AVCodecContext *avctx, uint8_t *header, int header_size)
-{
-    GetBitContext hb;
-    int len;
-    int chunk_size;
-    short wave_format;
-
-    init_get_bits(&hb, header, header_size*8);
-    if (get_le32(&hb) != MKTAG('R','I','F','F')) {
-        av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");
-        return -1;
-    }
-
-    chunk_size = get_le32(&hb);
-
-    if (get_le32(&hb) != MKTAG('W','A','V','E')) {
-        av_log(avctx, AV_LOG_ERROR, "missing WAVE tag\n");
-        return -1;
-    }
-
-    while (get_le32(&hb) != MKTAG('f','m','t',' ')) {
-        len = get_le32(&hb);
-        skip_bits(&hb, 8*len);
-    }
-    len = get_le32(&hb);
-
-    if (len < 16) {
-        av_log(avctx, AV_LOG_ERROR, "fmt chunk was too short\n");
-        return -1;
-    }
-
-    wave_format = get_le16(&hb);
-
-    switch (wave_format) {
-        case WAVE_FORMAT_PCM:
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "unsupported wave format\n");
-            return -1;
-    }
-
-    avctx->channels = get_le16(&hb);
-    avctx->sample_rate = get_le32(&hb);
-    avctx->bit_rate = get_le32(&hb) * 8;
-    avctx->block_align = get_le16(&hb);
-    avctx->bits_per_coded_sample = get_le16(&hb);
-
-    if (avctx->bits_per_coded_sample != 16) {
-        av_log(avctx, AV_LOG_ERROR, "unsupported number of bits per sample\n");
-        return -1;
-    }
-
-    len -= 16;
-    if (len > 0)
-        av_log(avctx, AV_LOG_INFO, "%d header bytes unparsed\n", len);
-
-    return 0;
-}
-
-static int16_t * interleave_buffer(int16_t *samples, int nchan, int blocksize, int32_t **buffer) {
-    int i, chan;
-    for (i=0; i<blocksize; i++)
-        for (chan=0; chan < nchan; chan++)
-            *samples++ = FFMIN(buffer[chan][i], 32768);
-    return samples;
-}
-
-static void decode_subframe_lpc(ShortenContext *s, int channel, int residual_size, int pred_order)
-{
-    int sum, i, j;
-    int coeffs[pred_order];
-
-    for (i=0; i<pred_order; i++)
-        coeffs[i] = get_sr_golomb_shorten(&s->gb, LPCQUANT);
-
-    for (i=0; i < s->blocksize; i++) {
-        sum = s->lpcqoffset;
-        for (j=0; j<pred_order; j++)
-            sum += coeffs[j] * s->decoded[channel][i-j-1];
-        s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + (sum >> LPCQUANT);
-    }
-}
-
-
-static int shorten_decode_frame(AVCodecContext *avctx,
-        void *data, int *data_size,
-        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    ShortenContext *s = avctx->priv_data;
-    int i, input_buf_size = 0;
-    int16_t *samples = data;
-    if(s->max_framesize == 0){
-        s->max_framesize= 1024; // should hopefully be enough for the first header
-        s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
-    }
-
-    if(1 && s->max_framesize){//FIXME truncated
-        buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
-        input_buf_size= buf_size;
-
-        if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
-            //                printf("memmove\n");
-            memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
-            s->bitstream_index=0;
-        }
-        memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size);
-        buf= &s->bitstream[s->bitstream_index];
-        buf_size += s->bitstream_size;
-        s->bitstream_size= buf_size;
-
-        if(buf_size < s->max_framesize){
-            //dprintf(avctx, "wanna more data ... %d\n", buf_size);
-            *data_size = 0;
-            return input_buf_size;
-        }
-    }
-    init_get_bits(&s->gb, buf, buf_size*8);
-    skip_bits(&s->gb, s->bitindex);
-    if (!s->blocksize)
-    {
-        int maxnlpc = 0;
-        /* shorten signature */
-        if (get_bits_long(&s->gb, 32) != AV_RB32("ajkg")) {
-            av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n");
-            return -1;
-        }
-
-        s->lpcqoffset = 0;
-        s->blocksize = DEFAULT_BLOCK_SIZE;
-        s->channels = 1;
-        s->nmean = -1;
-        s->version = get_bits(&s->gb, 8);
-        s->internal_ftype = get_uint(s, TYPESIZE);
-
-        s->channels = get_uint(s, CHANSIZE);
-        if (s->channels > MAX_CHANNELS) {
-            av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels);
-            return -1;
-        }
-
-        /* get blocksize if version > 0 */
-        if (s->version > 0) {
-            int skip_bytes;
-            s->blocksize = get_uint(s, av_log2(DEFAULT_BLOCK_SIZE));
-            maxnlpc = get_uint(s, LPCQSIZE);
-            s->nmean = get_uint(s, 0);
-
-            skip_bytes = get_uint(s, NSKIPSIZE);
-            for (i=0; i<skip_bytes; i++) {
-                skip_bits(&s->gb, 8);
-            }
-        }
-        s->nwrap = FFMAX(NWRAP, maxnlpc);
-
-        if (allocate_buffers(s))
-            return -1;
-
-        init_offset(s);
-
-        if (s->version > 1)
-            s->lpcqoffset = V2LPCQOFFSET;
-
-        if (get_ur_golomb_shorten(&s->gb, FNSIZE) != FN_VERBATIM) {
-            av_log(s->avctx, AV_LOG_ERROR, "missing verbatim section at beginning of stream\n");
-            return -1;
-        }
-
-        s->header_size = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
-        if (s->header_size >= OUT_BUFFER_SIZE || s->header_size < CANONICAL_HEADER_SIZE) {
-            av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n", s->header_size);
-            return -1;
-        }
-
-        for (i=0; i<s->header_size; i++)
-            s->header[i] = (char)get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
-
-        if (decode_wave_header(avctx, s->header, s->header_size) < 0)
-            return -1;
-
-        s->cur_chan = 0;
-        s->bitshift = 0;
-    }
-    else
-    {
-        int cmd;
-        int len;
-        cmd = get_ur_golomb_shorten(&s->gb, FNSIZE);
-        switch (cmd) {
-            case FN_ZERO:
-            case FN_DIFF0:
-            case FN_DIFF1:
-            case FN_DIFF2:
-            case FN_DIFF3:
-            case FN_QLPC:
-                {
-                    int residual_size = 0;
-                    int channel = s->cur_chan;
-                    int32_t coffset;
-                    if (cmd != FN_ZERO) {
-                        residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE);
-                        /* this is a hack as version 0 differed in defintion of get_sr_golomb_shorten */
-                        if (s->version == 0)
-                            residual_size--;
-                    }
-
-                    if (s->nmean == 0)
-                        coffset = s->offset[channel][0];
-                    else {
-                        int32_t sum = (s->version < 2) ? 0 : s->nmean / 2;
-                        for (i=0; i<s->nmean; i++)
-                            sum += s->offset[channel][i];
-                        coffset = sum / s->nmean;
-                        if (s->version >= 2)
-                            coffset >>= FFMIN(1, s->bitshift);
-                    }
-                    switch (cmd) {
-                        case FN_ZERO:
-                            for (i=0; i<s->blocksize; i++)
-                                s->decoded[channel][i] = 0;
-                            break;
-                        case FN_DIFF0:
-                            for (i=0; i<s->blocksize; i++)
-                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + coffset;
-                            break;
-                        case FN_DIFF1:
-                            for (i=0; i<s->blocksize; i++)
-                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + s->decoded[channel][i - 1];
-                            break;
-                        case FN_DIFF2:
-                            for (i=0; i<s->blocksize; i++)
-                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 2*s->decoded[channel][i-1]
-                                                                                                      -   s->decoded[channel][i-2];
-                            break;
-                        case FN_DIFF3:
-                            for (i=0; i<s->blocksize; i++)
-                                s->decoded[channel][i] = get_sr_golomb_shorten(&s->gb, residual_size) + 3*s->decoded[channel][i-1]
-                                                                                                      - 3*s->decoded[channel][i-2]
-                                                                                                      +   s->decoded[channel][i-3];
-                            break;
-                        case FN_QLPC:
-                            {
-                                int pred_order = get_ur_golomb_shorten(&s->gb, LPCQSIZE);
-                                for (i=0; i<pred_order; i++)
-                                    s->decoded[channel][i - pred_order] -= coffset;
-                                decode_subframe_lpc(s, channel, residual_size, pred_order);
-                                if (coffset != 0)
-                                    for (i=0; i < s->blocksize; i++)
-                                        s->decoded[channel][i] += coffset;
-                            }
-                    }
-                    if (s->nmean > 0) {
-                        int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2;
-                        for (i=0; i<s->blocksize; i++)
-                            sum += s->decoded[channel][i];
-
-                        for (i=1; i<s->nmean; i++)
-                            s->offset[channel][i-1] = s->offset[channel][i];
-
-                        if (s->version < 2)
-                            s->offset[channel][s->nmean - 1] = sum / s->blocksize;
-                        else
-                            s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift;
-                    }
-                    for (i=-s->nwrap; i<0; i++)
-                        s->decoded[channel][i] = s->decoded[channel][i + s->blocksize];
-
-                    fix_bitshift(s, s->decoded[channel]);
-
-                    s->cur_chan++;
-                    if (s->cur_chan == s->channels) {
-                        samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded);
-                        s->cur_chan = 0;
-                        goto frame_done;
-                    }
-                    break;
-                }
-                break;
-            case FN_VERBATIM:
-                len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE);
-                while (len--) {
-                    get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE);
-                }
-                break;
-            case FN_BITSHIFT:
-                s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE);
-                break;
-            case FN_BLOCKSIZE:
-                s->blocksize = get_uint(s, av_log2(s->blocksize));
-                break;
-            case FN_QUIT:
-                *data_size = 0;
-                return buf_size;
-                break;
-            default:
-                av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd);
-                return -1;
-                break;
-        }
-    }
-frame_done:
-    *data_size = (int8_t *)samples - (int8_t *)data;
-
-    //    s->last_blocksize = s->blocksize;
-    s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8);
-    i= (get_bits_count(&s->gb))/8;
-    if (i > buf_size) {
-        av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size);
-        s->bitstream_size=0;
-        s->bitstream_index=0;
-        return -1;
-    }
-    if (s->bitstream_size) {
-        s->bitstream_index += i;
-        s->bitstream_size  -= i;
-        return input_buf_size;
-    } else
-        return i;
-}
-
-static av_cold int shorten_decode_close(AVCodecContext *avctx)
-{
-    ShortenContext *s = avctx->priv_data;
-    int i;
-
-    for (i = 0; i < s->channels; i++) {
-        s->decoded[i] -= s->nwrap;
-        av_freep(&s->decoded[i]);
-        av_freep(&s->offset[i]);
-    }
-    av_freep(&s->bitstream);
-    return 0;
-}
-
-static void shorten_flush(AVCodecContext *avctx){
-    ShortenContext *s = avctx->priv_data;
-
-    s->bitstream_size=
-        s->bitstream_index= 0;
-}
-
-AVCodec shorten_decoder = {
-    "shorten",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SHORTEN,
-    sizeof(ShortenContext),
-    shorten_decode_init,
-    NULL,
-    shorten_decode_close,
-    shorten_decode_frame,
-    .flush= shorten_flush,
-    .long_name= NULL_IF_CONFIG_SMALL("Shorten"),
-};
diff --git a/libavcodec/simple_idct.c b/libavcodec/simple_idct.c
deleted file mode 100644
index 475be6d..0000000
--- a/libavcodec/simple_idct.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Simple IDCT
- *
- * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * simpleidct in C.
- */
-
-/*
-  based upon some outcommented c code from mpeg2dec (idct_mmx.c
-  written by Aaron Holtzman <aholtzma at ess.engr.uvic.ca>)
- */
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mathops.h"
-#include "simple_idct.h"
-
-#if 0
-#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
-#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
-#define W3 2408 /* 2048*sqrt (2)*cos (3*pi/16) */
-#define W4 2048 /* 2048*sqrt (2)*cos (4*pi/16) */
-#define W5 1609 /* 2048*sqrt (2)*cos (5*pi/16) */
-#define W6 1108 /* 2048*sqrt (2)*cos (6*pi/16) */
-#define W7 565  /* 2048*sqrt (2)*cos (7*pi/16) */
-#define ROW_SHIFT 8
-#define COL_SHIFT 17
-#else
-#define W1  22725  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W2  21407  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W3  19266  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W4  16383  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W5  12873  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W6  8867   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define W7  4520   //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define ROW_SHIFT 11
-#define COL_SHIFT 20 // 6
-#endif
-
-static inline void idctRowCondDC (DCTELEM * row)
-{
-        int a0, a1, a2, a3, b0, b1, b2, b3;
-#if HAVE_FAST_64BIT
-        uint64_t temp;
-#else
-        uint32_t temp;
-#endif
-
-#if HAVE_FAST_64BIT
-#if HAVE_BIGENDIAN
-#define ROW0_MASK 0xffff000000000000LL
-#else
-#define ROW0_MASK 0xffffLL
-#endif
-        if(sizeof(DCTELEM)==2){
-            if ( ((((uint64_t *)row)[0] & ~ROW0_MASK) |
-                  ((uint64_t *)row)[1]) == 0) {
-                temp = (row[0] << 3) & 0xffff;
-                temp += temp << 16;
-                temp += temp << 32;
-                ((uint64_t *)row)[0] = temp;
-                ((uint64_t *)row)[1] = temp;
-                return;
-            }
-        }else{
-            if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
-                row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
-                return;
-            }
-        }
-#else
-        if(sizeof(DCTELEM)==2){
-            if (!(((uint32_t*)row)[1] |
-                  ((uint32_t*)row)[2] |
-                  ((uint32_t*)row)[3] |
-                  row[1])) {
-                temp = (row[0] << 3) & 0xffff;
-                temp += temp << 16;
-                ((uint32_t*)row)[0]=((uint32_t*)row)[1] =
-                ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
-                return;
-            }
-        }else{
-            if (!(row[1]|row[2]|row[3]|row[4]|row[5]|row[6]|row[7])) {
-                row[0]=row[1]=row[2]=row[3]=row[4]=row[5]=row[6]=row[7]= row[0] << 3;
-                return;
-            }
-        }
-#endif
-
-        a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
-        a1 = a0;
-        a2 = a0;
-        a3 = a0;
-
-        /* no need to optimize : gcc does it */
-        a0 += W2 * row[2];
-        a1 += W6 * row[2];
-        a2 -= W6 * row[2];
-        a3 -= W2 * row[2];
-
-        b0 = MUL16(W1, row[1]);
-        MAC16(b0, W3, row[3]);
-        b1 = MUL16(W3, row[1]);
-        MAC16(b1, -W7, row[3]);
-        b2 = MUL16(W5, row[1]);
-        MAC16(b2, -W1, row[3]);
-        b3 = MUL16(W7, row[1]);
-        MAC16(b3, -W5, row[3]);
-
-#if HAVE_FAST_64BIT
-        temp = ((uint64_t*)row)[1];
-#else
-        temp = ((uint32_t*)row)[2] | ((uint32_t*)row)[3];
-#endif
-        if (temp != 0) {
-            a0 += W4*row[4] + W6*row[6];
-            a1 += - W4*row[4] - W2*row[6];
-            a2 += - W4*row[4] + W2*row[6];
-            a3 += W4*row[4] - W6*row[6];
-
-            MAC16(b0, W5, row[5]);
-            MAC16(b0, W7, row[7]);
-
-            MAC16(b1, -W1, row[5]);
-            MAC16(b1, -W5, row[7]);
-
-            MAC16(b2, W7, row[5]);
-            MAC16(b2, W3, row[7]);
-
-            MAC16(b3, W3, row[5]);
-            MAC16(b3, -W1, row[7]);
-        }
-
-        row[0] = (a0 + b0) >> ROW_SHIFT;
-        row[7] = (a0 - b0) >> ROW_SHIFT;
-        row[1] = (a1 + b1) >> ROW_SHIFT;
-        row[6] = (a1 - b1) >> ROW_SHIFT;
-        row[2] = (a2 + b2) >> ROW_SHIFT;
-        row[5] = (a2 - b2) >> ROW_SHIFT;
-        row[3] = (a3 + b3) >> ROW_SHIFT;
-        row[4] = (a3 - b3) >> ROW_SHIFT;
-}
-
-static inline void idctSparseColPut (uint8_t *dest, int line_size,
-                                     DCTELEM * col)
-{
-        int a0, a1, a2, a3, b0, b1, b2, b3;
-        uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-        /* XXX: I did that only to give same values as previous code */
-        a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
-        a1 = a0;
-        a2 = a0;
-        a3 = a0;
-
-        a0 +=  + W2*col[8*2];
-        a1 +=  + W6*col[8*2];
-        a2 +=  - W6*col[8*2];
-        a3 +=  - W2*col[8*2];
-
-        b0 = MUL16(W1, col[8*1]);
-        b1 = MUL16(W3, col[8*1]);
-        b2 = MUL16(W5, col[8*1]);
-        b3 = MUL16(W7, col[8*1]);
-
-        MAC16(b0, + W3, col[8*3]);
-        MAC16(b1, - W7, col[8*3]);
-        MAC16(b2, - W1, col[8*3]);
-        MAC16(b3, - W5, col[8*3]);
-
-        if(col[8*4]){
-            a0 += + W4*col[8*4];
-            a1 += - W4*col[8*4];
-            a2 += - W4*col[8*4];
-            a3 += + W4*col[8*4];
-        }
-
-        if (col[8*5]) {
-            MAC16(b0, + W5, col[8*5]);
-            MAC16(b1, - W1, col[8*5]);
-            MAC16(b2, + W7, col[8*5]);
-            MAC16(b3, + W3, col[8*5]);
-        }
-
-        if(col[8*6]){
-            a0 += + W6*col[8*6];
-            a1 += - W2*col[8*6];
-            a2 += + W2*col[8*6];
-            a3 += - W6*col[8*6];
-        }
-
-        if (col[8*7]) {
-            MAC16(b0, + W7, col[8*7]);
-            MAC16(b1, - W5, col[8*7]);
-            MAC16(b2, + W3, col[8*7]);
-            MAC16(b3, - W1, col[8*7]);
-        }
-
-        dest[0] = cm[(a0 + b0) >> COL_SHIFT];
-        dest += line_size;
-        dest[0] = cm[(a1 + b1) >> COL_SHIFT];
-        dest += line_size;
-        dest[0] = cm[(a2 + b2) >> COL_SHIFT];
-        dest += line_size;
-        dest[0] = cm[(a3 + b3) >> COL_SHIFT];
-        dest += line_size;
-        dest[0] = cm[(a3 - b3) >> COL_SHIFT];
-        dest += line_size;
-        dest[0] = cm[(a2 - b2) >> COL_SHIFT];
-        dest += line_size;
-        dest[0] = cm[(a1 - b1) >> COL_SHIFT];
-        dest += line_size;
-        dest[0] = cm[(a0 - b0) >> COL_SHIFT];
-}
-
-static inline void idctSparseColAdd (uint8_t *dest, int line_size,
-                                     DCTELEM * col)
-{
-        int a0, a1, a2, a3, b0, b1, b2, b3;
-        uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-        /* XXX: I did that only to give same values as previous code */
-        a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
-        a1 = a0;
-        a2 = a0;
-        a3 = a0;
-
-        a0 +=  + W2*col[8*2];
-        a1 +=  + W6*col[8*2];
-        a2 +=  - W6*col[8*2];
-        a3 +=  - W2*col[8*2];
-
-        b0 = MUL16(W1, col[8*1]);
-        b1 = MUL16(W3, col[8*1]);
-        b2 = MUL16(W5, col[8*1]);
-        b3 = MUL16(W7, col[8*1]);
-
-        MAC16(b0, + W3, col[8*3]);
-        MAC16(b1, - W7, col[8*3]);
-        MAC16(b2, - W1, col[8*3]);
-        MAC16(b3, - W5, col[8*3]);
-
-        if(col[8*4]){
-            a0 += + W4*col[8*4];
-            a1 += - W4*col[8*4];
-            a2 += - W4*col[8*4];
-            a3 += + W4*col[8*4];
-        }
-
-        if (col[8*5]) {
-            MAC16(b0, + W5, col[8*5]);
-            MAC16(b1, - W1, col[8*5]);
-            MAC16(b2, + W7, col[8*5]);
-            MAC16(b3, + W3, col[8*5]);
-        }
-
-        if(col[8*6]){
-            a0 += + W6*col[8*6];
-            a1 += - W2*col[8*6];
-            a2 += + W2*col[8*6];
-            a3 += - W6*col[8*6];
-        }
-
-        if (col[8*7]) {
-            MAC16(b0, + W7, col[8*7]);
-            MAC16(b1, - W5, col[8*7]);
-            MAC16(b2, + W3, col[8*7]);
-            MAC16(b3, - W1, col[8*7]);
-        }
-
-        dest[0] = cm[dest[0] + ((a0 + b0) >> COL_SHIFT)];
-        dest += line_size;
-        dest[0] = cm[dest[0] + ((a1 + b1) >> COL_SHIFT)];
-        dest += line_size;
-        dest[0] = cm[dest[0] + ((a2 + b2) >> COL_SHIFT)];
-        dest += line_size;
-        dest[0] = cm[dest[0] + ((a3 + b3) >> COL_SHIFT)];
-        dest += line_size;
-        dest[0] = cm[dest[0] + ((a3 - b3) >> COL_SHIFT)];
-        dest += line_size;
-        dest[0] = cm[dest[0] + ((a2 - b2) >> COL_SHIFT)];
-        dest += line_size;
-        dest[0] = cm[dest[0] + ((a1 - b1) >> COL_SHIFT)];
-        dest += line_size;
-        dest[0] = cm[dest[0] + ((a0 - b0) >> COL_SHIFT)];
-}
-
-static inline void idctSparseCol (DCTELEM * col)
-{
-        int a0, a1, a2, a3, b0, b1, b2, b3;
-
-        /* XXX: I did that only to give same values as previous code */
-        a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4));
-        a1 = a0;
-        a2 = a0;
-        a3 = a0;
-
-        a0 +=  + W2*col[8*2];
-        a1 +=  + W6*col[8*2];
-        a2 +=  - W6*col[8*2];
-        a3 +=  - W2*col[8*2];
-
-        b0 = MUL16(W1, col[8*1]);
-        b1 = MUL16(W3, col[8*1]);
-        b2 = MUL16(W5, col[8*1]);
-        b3 = MUL16(W7, col[8*1]);
-
-        MAC16(b0, + W3, col[8*3]);
-        MAC16(b1, - W7, col[8*3]);
-        MAC16(b2, - W1, col[8*3]);
-        MAC16(b3, - W5, col[8*3]);
-
-        if(col[8*4]){
-            a0 += + W4*col[8*4];
-            a1 += - W4*col[8*4];
-            a2 += - W4*col[8*4];
-            a3 += + W4*col[8*4];
-        }
-
-        if (col[8*5]) {
-            MAC16(b0, + W5, col[8*5]);
-            MAC16(b1, - W1, col[8*5]);
-            MAC16(b2, + W7, col[8*5]);
-            MAC16(b3, + W3, col[8*5]);
-        }
-
-        if(col[8*6]){
-            a0 += + W6*col[8*6];
-            a1 += - W2*col[8*6];
-            a2 += + W2*col[8*6];
-            a3 += - W6*col[8*6];
-        }
-
-        if (col[8*7]) {
-            MAC16(b0, + W7, col[8*7]);
-            MAC16(b1, - W5, col[8*7]);
-            MAC16(b2, + W3, col[8*7]);
-            MAC16(b3, - W1, col[8*7]);
-        }
-
-        col[0 ] = ((a0 + b0) >> COL_SHIFT);
-        col[8 ] = ((a1 + b1) >> COL_SHIFT);
-        col[16] = ((a2 + b2) >> COL_SHIFT);
-        col[24] = ((a3 + b3) >> COL_SHIFT);
-        col[32] = ((a3 - b3) >> COL_SHIFT);
-        col[40] = ((a2 - b2) >> COL_SHIFT);
-        col[48] = ((a1 - b1) >> COL_SHIFT);
-        col[56] = ((a0 - b0) >> COL_SHIFT);
-}
-
-void ff_simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    int i;
-    for(i=0; i<8; i++)
-        idctRowCondDC(block + i*8);
-
-    for(i=0; i<8; i++)
-        idctSparseColPut(dest + i, line_size, block + i);
-}
-
-void ff_simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    int i;
-    for(i=0; i<8; i++)
-        idctRowCondDC(block + i*8);
-
-    for(i=0; i<8; i++)
-        idctSparseColAdd(dest + i, line_size, block + i);
-}
-
-void ff_simple_idct(DCTELEM *block)
-{
-    int i;
-    for(i=0; i<8; i++)
-        idctRowCondDC(block + i*8);
-
-    for(i=0; i<8; i++)
-        idctSparseCol(block + i);
-}
-
-/* 2x4x8 idct */
-
-#define CN_SHIFT 12
-#define C_FIX(x) ((int)((x) * (1 << CN_SHIFT) + 0.5))
-#define C1 C_FIX(0.6532814824)
-#define C2 C_FIX(0.2705980501)
-
-/* row idct is multiple by 16 * sqrt(2.0), col idct4 is normalized,
-   and the butterfly must be multiplied by 0.5 * sqrt(2.0) */
-#define C_SHIFT (4+1+12)
-
-static inline void idct4col_put(uint8_t *dest, int line_size, const DCTELEM *col)
-{
-    int c0, c1, c2, c3, a0, a1, a2, a3;
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    a0 = col[8*0];
-    a1 = col[8*2];
-    a2 = col[8*4];
-    a3 = col[8*6];
-    c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
-    c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
-    c1 = a1 * C1 + a3 * C2;
-    c3 = a1 * C2 - a3 * C1;
-    dest[0] = cm[(c0 + c1) >> C_SHIFT];
-    dest += line_size;
-    dest[0] = cm[(c2 + c3) >> C_SHIFT];
-    dest += line_size;
-    dest[0] = cm[(c2 - c3) >> C_SHIFT];
-    dest += line_size;
-    dest[0] = cm[(c0 - c1) >> C_SHIFT];
-}
-
-#define BF(k) \
-{\
-    int a0, a1;\
-    a0 = ptr[k];\
-    a1 = ptr[8 + k];\
-    ptr[k] = a0 + a1;\
-    ptr[8 + k] = a0 - a1;\
-}
-
-/* only used by DV codec. The input must be interlaced. 128 is added
-   to the pixels before clamping to avoid systematic error
-   (1024*sqrt(2)) offset would be needed otherwise. */
-/* XXX: I think a 1.0/sqrt(2) normalization should be needed to
-   compensate the extra butterfly stage - I don't have the full DV
-   specification */
-void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    int i;
-    DCTELEM *ptr;
-
-    /* butterfly */
-    ptr = block;
-    for(i=0;i<4;i++) {
-        BF(0);
-        BF(1);
-        BF(2);
-        BF(3);
-        BF(4);
-        BF(5);
-        BF(6);
-        BF(7);
-        ptr += 2 * 8;
-    }
-
-    /* IDCT8 on each line */
-    for(i=0; i<8; i++) {
-        idctRowCondDC(block + i*8);
-    }
-
-    /* IDCT4 and store */
-    for(i=0;i<8;i++) {
-        idct4col_put(dest + i, 2 * line_size, block + i);
-        idct4col_put(dest + line_size + i, 2 * line_size, block + 8 + i);
-    }
-}
-
-/* 8x4 & 4x8 WMV2 IDCT */
-#undef CN_SHIFT
-#undef C_SHIFT
-#undef C_FIX
-#undef C1
-#undef C2
-#define CN_SHIFT 12
-#define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5))
-#define C1 C_FIX(0.6532814824)
-#define C2 C_FIX(0.2705980501)
-#define C3 C_FIX(0.5)
-#define C_SHIFT (4+1+12)
-static inline void idct4col_add(uint8_t *dest, int line_size, const DCTELEM *col)
-{
-    int c0, c1, c2, c3, a0, a1, a2, a3;
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    a0 = col[8*0];
-    a1 = col[8*1];
-    a2 = col[8*2];
-    a3 = col[8*3];
-    c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1));
-    c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1));
-    c1 = a1 * C1 + a3 * C2;
-    c3 = a1 * C2 - a3 * C1;
-    dest[0] = cm[dest[0] + ((c0 + c1) >> C_SHIFT)];
-    dest += line_size;
-    dest[0] = cm[dest[0] + ((c2 + c3) >> C_SHIFT)];
-    dest += line_size;
-    dest[0] = cm[dest[0] + ((c2 - c3) >> C_SHIFT)];
-    dest += line_size;
-    dest[0] = cm[dest[0] + ((c0 - c1) >> C_SHIFT)];
-}
-
-#define RN_SHIFT 15
-#define R_FIX(x) ((int)((x) * 1.414213562 * (1 << RN_SHIFT) + 0.5))
-#define R1 R_FIX(0.6532814824)
-#define R2 R_FIX(0.2705980501)
-#define R3 R_FIX(0.5)
-#define R_SHIFT 11
-static inline void idct4row(DCTELEM *row)
-{
-    int c0, c1, c2, c3, a0, a1, a2, a3;
-    //const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    a0 = row[0];
-    a1 = row[1];
-    a2 = row[2];
-    a3 = row[3];
-    c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1));
-    c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1));
-    c1 = a1 * R1 + a3 * R2;
-    c3 = a1 * R2 - a3 * R1;
-    row[0]= (c0 + c1) >> R_SHIFT;
-    row[1]= (c2 + c3) >> R_SHIFT;
-    row[2]= (c2 - c3) >> R_SHIFT;
-    row[3]= (c0 - c1) >> R_SHIFT;
-}
-
-void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    int i;
-
-    /* IDCT8 on each line */
-    for(i=0; i<4; i++) {
-        idctRowCondDC(block + i*8);
-    }
-
-    /* IDCT4 and store */
-    for(i=0;i<8;i++) {
-        idct4col_add(dest + i, line_size, block + i);
-    }
-}
-
-void ff_simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    int i;
-
-    /* IDCT4 on each line */
-    for(i=0; i<8; i++) {
-        idct4row(block + i*8);
-    }
-
-    /* IDCT8 and store */
-    for(i=0; i<4; i++){
-        idctSparseColAdd(dest + i, line_size, block + i);
-    }
-}
-
-void ff_simple_idct44_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    int i;
-
-    /* IDCT4 on each line */
-    for(i=0; i<4; i++) {
-        idct4row(block + i*8);
-    }
-
-    /* IDCT4 and store */
-    for(i=0; i<4; i++){
-        idct4col_add(dest + i, line_size, block + i);
-    }
-}
diff --git a/libavcodec/simple_idct.h b/libavcodec/simple_idct.h
deleted file mode 100644
index 24f6a6d..0000000
--- a/libavcodec/simple_idct.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Simple IDCT
- *
- * Copyright (c) 2001 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * simple idct header.
- */
-
-#ifndef AVCODEC_SIMPLE_IDCT_H
-#define AVCODEC_SIMPLE_IDCT_H
-
-#include <stdint.h>
-#include "dsputil.h"
-
-void ff_simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_simple_idct_mmx(int16_t *block);
-void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, int16_t *block);
-void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, int16_t *block);
-void ff_simple_idct(DCTELEM *block);
-
-void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block);
-
-void ff_simple_idct84_add(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_simple_idct48_add(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_simple_idct44_add(uint8_t *dest, int line_size, DCTELEM *block);
-
-#endif /* AVCODEC_SIMPLE_IDCT_H */
diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
deleted file mode 100644
index b76e891..0000000
--- a/libavcodec/sipr.c
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * SIPR / ACELP.NET decoder
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <math.h>
-#include <stdint.h>
-
-#include "libavutil/mathematics.h"
-#include "avcodec.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-#include "dsputil.h"
-
-#include "lsp.h"
-#include "celp_math.h"
-#include "acelp_vectors.h"
-#include "acelp_pitch_delay.h"
-#include "acelp_filters.h"
-#include "celp_filters.h"
-
-#define MAX_SUBFRAME_COUNT   5
-
-#include "sipr.h"
-#include "siprdata.h"
-
-typedef struct {
-    const char *mode_name;
-    uint16_t bits_per_frame;
-    uint8_t subframe_count;
-    uint8_t frames_per_packet;
-    float pitch_sharp_factor;
-
-    /* bitstream parameters */
-    uint8_t number_of_fc_indexes;
-    uint8_t ma_predictor_bits;  ///< size in bits of the switched MA predictor
-
-    /** size in bits of the i-th stage vector of quantizer */
-    uint8_t vq_indexes_bits[5];
-
-    /** size in bits of the adaptive-codebook index for every subframe */
-    uint8_t pitch_delay_bits[5];
-
-    uint8_t gp_index_bits;
-    uint8_t fc_index_bits[10]; ///< size in bits of the fixed codebook indexes
-    uint8_t gc_index_bits;     ///< size in bits of the gain  codebook indexes
-} SiprModeParam;
-
-static const SiprModeParam modes[MODE_COUNT] = {
-    [MODE_16k] = {
-        .mode_name          = "16k",
-        .bits_per_frame     = 160,
-        .subframe_count     = SUBFRAME_COUNT_16k,
-        .frames_per_packet  = 1,
-        .pitch_sharp_factor = 0.00,
-
-        .number_of_fc_indexes = 10,
-        .ma_predictor_bits    = 1,
-        .vq_indexes_bits      = {7, 8, 7, 7, 7},
-        .pitch_delay_bits     = {9, 6},
-        .gp_index_bits        = 4,
-        .fc_index_bits        = {4, 5, 4, 5, 4, 5, 4, 5, 4, 5},
-        .gc_index_bits        = 5
-    },
-
-    [MODE_8k5] = {
-        .mode_name          = "8k5",
-        .bits_per_frame     = 152,
-        .subframe_count     = 3,
-        .frames_per_packet  = 1,
-        .pitch_sharp_factor = 0.8,
-
-        .number_of_fc_indexes = 3,
-        .ma_predictor_bits    = 0,
-        .vq_indexes_bits      = {6, 7, 7, 7, 5},
-        .pitch_delay_bits     = {8, 5, 5},
-        .gp_index_bits        = 0,
-        .fc_index_bits        = {9, 9, 9},
-        .gc_index_bits        = 7
-    },
-
-    [MODE_6k5] = {
-        .mode_name          = "6k5",
-        .bits_per_frame     = 232,
-        .subframe_count     = 3,
-        .frames_per_packet  = 2,
-        .pitch_sharp_factor = 0.8,
-
-        .number_of_fc_indexes = 3,
-        .ma_predictor_bits    = 0,
-        .vq_indexes_bits      = {6, 7, 7, 7, 5},
-        .pitch_delay_bits     = {8, 5, 5},
-        .gp_index_bits        = 0,
-        .fc_index_bits        = {5, 5, 5},
-        .gc_index_bits        = 7
-    },
-
-    [MODE_5k0] = {
-        .mode_name          = "5k0",
-        .bits_per_frame     = 296,
-        .subframe_count     = 5,
-        .frames_per_packet  = 2,
-        .pitch_sharp_factor = 0.85,
-
-        .number_of_fc_indexes = 1,
-        .ma_predictor_bits    = 0,
-        .vq_indexes_bits      = {6, 7, 7, 7, 5},
-        .pitch_delay_bits     = {8, 5, 8, 5, 5},
-        .gp_index_bits        = 0,
-        .fc_index_bits        = {10},
-        .gc_index_bits        = 7
-    }
-};
-
-const float ff_pow_0_5[] = {
-    1.0/(1 <<  1), 1.0/(1 <<  2), 1.0/(1 <<  3), 1.0/(1 <<  4),
-    1.0/(1 <<  5), 1.0/(1 <<  6), 1.0/(1 <<  7), 1.0/(1 <<  8),
-    1.0/(1 <<  9), 1.0/(1 << 10), 1.0/(1 << 11), 1.0/(1 << 12),
-    1.0/(1 << 13), 1.0/(1 << 14), 1.0/(1 << 15), 1.0/(1 << 16)
-};
-
-static void dequant(float *out, const int *idx, const float *cbs[])
-{
-    int i;
-    int stride  = 2;
-    int num_vec = 5;
-
-    for (i = 0; i < num_vec; i++)
-        memcpy(out + stride*i, cbs[i] + stride*idx[i], stride*sizeof(float));
-
-}
-
-static void lsf_decode_fp(float *lsfnew, float *lsf_history,
-                          const SiprParameters *parm)
-{
-    int i;
-    float lsf_tmp[LP_FILTER_ORDER];
-
-    dequant(lsf_tmp, parm->vq_indexes, lsf_codebooks);
-
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        lsfnew[i] = lsf_history[i] * 0.33 + lsf_tmp[i] + mean_lsf[i];
-
-    ff_sort_nearly_sorted_floats(lsfnew, LP_FILTER_ORDER - 1);
-
-    /* Note that a minimum distance is not enforced between the last value and
-       the previous one, contrary to what is done in ff_acelp_reorder_lsf() */
-    ff_set_min_dist_lsf(lsfnew, LSFQ_DIFF_MIN, LP_FILTER_ORDER - 1);
-    lsfnew[9] = FFMIN(lsfnew[LP_FILTER_ORDER - 1], 1.3 * M_PI);
-
-    memcpy(lsf_history, lsf_tmp, LP_FILTER_ORDER * sizeof(*lsf_history));
-
-    for (i = 0; i < LP_FILTER_ORDER - 1; i++)
-        lsfnew[i] = cos(lsfnew[i]);
-    lsfnew[LP_FILTER_ORDER - 1] *= 6.153848 / M_PI;
-}
-
-/** Apply pitch lag to the fixed vector (AMR section 6.1.2). */
-static void pitch_sharpening(int pitch_lag_int, float beta,
-                             float *fixed_vector)
-{
-    int i;
-
-    for (i = pitch_lag_int; i < SUBFR_SIZE; i++)
-        fixed_vector[i] += beta * fixed_vector[i - pitch_lag_int];
-}
-
-/**
- * Extracts decoding parameters from the input bitstream.
- * @param parms          parameters structure
- * @param pgb            pointer to initialized GetBitContext structure
- */
-static void decode_parameters(SiprParameters* parms, GetBitContext *pgb,
-                              const SiprModeParam *p)
-{
-    int i, j;
-
-    parms->ma_pred_switch           = get_bits(pgb, p->ma_predictor_bits);
-
-    for (i = 0; i < 5; i++)
-        parms->vq_indexes[i]        = get_bits(pgb, p->vq_indexes_bits[i]);
-
-    for (i = 0; i < p->subframe_count; i++) {
-        parms->pitch_delay[i]       = get_bits(pgb, p->pitch_delay_bits[i]);
-        parms->gp_index[i]          = get_bits(pgb, p->gp_index_bits);
-
-        for (j = 0; j < p->number_of_fc_indexes; j++)
-            parms->fc_indexes[i][j] = get_bits(pgb, p->fc_index_bits[j]);
-
-        parms->gc_index[i]          = get_bits(pgb, p->gc_index_bits);
-    }
-}
-
-static void lsp2lpc_sipr(const double *lsp, float *Az)
-{
-    int lp_half_order = LP_FILTER_ORDER >> 1;
-    double buf[(LP_FILTER_ORDER >> 1) + 1];
-    double pa[(LP_FILTER_ORDER >> 1) + 1];
-    double *qa = buf + 1;
-    int i,j;
-
-    qa[-1] = 0.0;
-
-    ff_lsp2polyf(lsp    , pa, lp_half_order    );
-    ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1);
-
-    for (i = 1, j = LP_FILTER_ORDER - 1; i < lp_half_order; i++, j--) {
-        double paf =  pa[i]            * (1 + lsp[LP_FILTER_ORDER - 1]);
-        double qaf = (qa[i] - qa[i-2]) * (1 - lsp[LP_FILTER_ORDER - 1]);
-        Az[i-1]  = (paf + qaf) * 0.5;
-        Az[j-1]  = (paf - qaf) * 0.5;
-    }
-
-    Az[lp_half_order - 1] = (1.0 + lsp[LP_FILTER_ORDER - 1]) *
-        pa[lp_half_order] * 0.5;
-
-    Az[LP_FILTER_ORDER - 1] = lsp[LP_FILTER_ORDER - 1];
-}
-
-static void sipr_decode_lp(float *lsfnew, const float *lsfold, float *Az,
-                           int num_subfr)
-{
-    double lsfint[LP_FILTER_ORDER];
-    int i,j;
-    float t, t0 = 1.0 / num_subfr;
-
-    t = t0 * 0.5;
-    for (i = 0; i < num_subfr; i++) {
-        for (j = 0; j < LP_FILTER_ORDER; j++)
-            lsfint[j] = lsfold[j] * (1 - t) + t * lsfnew[j];
-
-        lsp2lpc_sipr(lsfint, Az);
-        Az += LP_FILTER_ORDER;
-        t += t0;
-    }
-}
-
-/**
- * Evaluates the adaptive impulse response.
- */
-static void eval_ir(const float *Az, int pitch_lag, float *freq,
-                    float pitch_sharp_factor)
-{
-    float tmp1[SUBFR_SIZE+1], tmp2[LP_FILTER_ORDER+1];
-    int i;
-
-    tmp1[0] = 1.;
-    for (i = 0; i < LP_FILTER_ORDER; i++) {
-        tmp1[i+1] = Az[i] * ff_pow_0_55[i];
-        tmp2[i  ] = Az[i] * ff_pow_0_7 [i];
-    }
-    memset(tmp1 + 11, 0, 37 * sizeof(float));
-
-    ff_celp_lp_synthesis_filterf(freq, tmp2, tmp1, SUBFR_SIZE,
-                                 LP_FILTER_ORDER);
-
-    pitch_sharpening(pitch_lag, pitch_sharp_factor, freq);
-}
-
-/**
- * Evaluates the convolution of a vector with a sparse vector.
- */
-static void convolute_with_sparse(float *out, const AMRFixed *pulses,
-                                  const float *shape, int length)
-{
-    int i, j;
-
-    memset(out, 0, length*sizeof(float));
-    for (i = 0; i < pulses->n; i++)
-        for (j = pulses->x[i]; j < length; j++)
-            out[j] += pulses->y[i] * shape[j - pulses->x[i]];
-}
-
-/**
- * Apply postfilter, very similar to AMR one.
- */
-static void postfilter_5k0(SiprContext *ctx, const float *lpc, float *samples)
-{
-    float buf[SUBFR_SIZE + LP_FILTER_ORDER];
-    float *pole_out = buf + LP_FILTER_ORDER;
-    float lpc_n[LP_FILTER_ORDER];
-    float lpc_d[LP_FILTER_ORDER];
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER; i++) {
-        lpc_d[i] = lpc[i] * ff_pow_0_75[i];
-        lpc_n[i] = lpc[i] * ff_pow_0_5 [i];
-    };
-
-    memcpy(pole_out - LP_FILTER_ORDER, ctx->postfilter_mem,
-           LP_FILTER_ORDER*sizeof(float));
-
-    ff_celp_lp_synthesis_filterf(pole_out, lpc_d, samples, SUBFR_SIZE,
-                                 LP_FILTER_ORDER);
-
-    memcpy(ctx->postfilter_mem, pole_out + SUBFR_SIZE - LP_FILTER_ORDER,
-           LP_FILTER_ORDER*sizeof(float));
-
-    ff_tilt_compensation(&ctx->tilt_mem, 0.4, pole_out, SUBFR_SIZE);
-
-    memcpy(pole_out - LP_FILTER_ORDER, ctx->postfilter_mem5k0,
-           LP_FILTER_ORDER*sizeof(*pole_out));
-
-    memcpy(ctx->postfilter_mem5k0, pole_out + SUBFR_SIZE - LP_FILTER_ORDER,
-           LP_FILTER_ORDER*sizeof(*pole_out));
-
-    ff_celp_lp_zero_synthesis_filterf(samples, lpc_n, pole_out, SUBFR_SIZE,
-                                      LP_FILTER_ORDER);
-
-}
-
-static void decode_fixed_sparse(AMRFixed *fixed_sparse, const int16_t *pulses,
-                                SiprMode mode, int low_gain)
-{
-    int i;
-
-    switch (mode) {
-    case MODE_6k5:
-        for (i = 0; i < 3; i++) {
-            fixed_sparse->x[i] = 3 * (pulses[i] & 0xf) + i;
-            fixed_sparse->y[i] = pulses[i] & 0x10 ? -1 : 1;
-        }
-        fixed_sparse->n = 3;
-        break;
-    case MODE_8k5:
-        for (i = 0; i < 3; i++) {
-            fixed_sparse->x[2*i    ] = 3 * ((pulses[i] >> 4) & 0xf) + i;
-            fixed_sparse->x[2*i + 1] = 3 * ( pulses[i]       & 0xf) + i;
-
-            fixed_sparse->y[2*i    ] = (pulses[i] & 0x100) ? -1.0: 1.0;
-
-            fixed_sparse->y[2*i + 1] =
-                (fixed_sparse->x[2*i + 1] < fixed_sparse->x[2*i]) ?
-                -fixed_sparse->y[2*i    ] : fixed_sparse->y[2*i];
-        }
-
-        fixed_sparse->n = 6;
-        break;
-    case MODE_5k0:
-    default:
-        if (low_gain) {
-            int offset = (pulses[0] & 0x200) ? 2 : 0;
-            int val = pulses[0];
-
-            for (i = 0; i < 3; i++) {
-                int index = (val & 0x7) * 6 + 4 - i*2;
-
-                fixed_sparse->y[i] = (offset + index) & 0x3 ? -1 : 1;
-                fixed_sparse->x[i] = index;
-
-                val >>= 3;
-            }
-            fixed_sparse->n = 3;
-        } else {
-            int pulse_subset = (pulses[0] >> 8) & 1;
-
-            fixed_sparse->x[0] = ((pulses[0] >> 4) & 15) * 3 + pulse_subset;
-            fixed_sparse->x[1] = ( pulses[0]       & 15) * 3 + pulse_subset + 1;
-
-            fixed_sparse->y[0] = pulses[0] & 0x200 ? -1 : 1;
-            fixed_sparse->y[1] = -fixed_sparse->y[0];
-            fixed_sparse->n = 2;
-        }
-        break;
-    }
-}
-
-static void decode_frame(SiprContext *ctx, SiprParameters *params,
-                         float *out_data)
-{
-    int i, j;
-    int subframe_count = modes[ctx->mode].subframe_count;
-    int frame_size = subframe_count * SUBFR_SIZE;
-    float Az[LP_FILTER_ORDER * MAX_SUBFRAME_COUNT];
-    float *excitation;
-    float ir_buf[SUBFR_SIZE + LP_FILTER_ORDER];
-    float lsf_new[LP_FILTER_ORDER];
-    float *impulse_response = ir_buf + LP_FILTER_ORDER;
-    float *synth = ctx->synth_buf + 16; // 16 instead of LP_FILTER_ORDER for
-                                        // memory alignment
-    int t0_first = 0;
-    AMRFixed fixed_cb;
-
-    memset(ir_buf, 0, LP_FILTER_ORDER * sizeof(float));
-    lsf_decode_fp(lsf_new, ctx->lsf_history, params);
-
-    sipr_decode_lp(lsf_new, ctx->lsp_history, Az, subframe_count);
-
-    memcpy(ctx->lsp_history, lsf_new, LP_FILTER_ORDER * sizeof(float));
-
-    excitation = ctx->excitation + PITCH_DELAY_MAX + L_INTERPOL;
-
-    for (i = 0; i < subframe_count; i++) {
-        float *pAz = Az + i*LP_FILTER_ORDER;
-        float fixed_vector[SUBFR_SIZE];
-        int T0,T0_frac;
-        float pitch_gain, gain_code, avg_energy;
-
-        ff_decode_pitch_lag(&T0, &T0_frac, params->pitch_delay[i], t0_first, i,
-                            ctx->mode == MODE_5k0, 6);
-
-        if (i == 0 || (i == 2 && ctx->mode == MODE_5k0))
-            t0_first = T0;
-
-        ff_acelp_interpolatef(excitation, excitation - T0 + (T0_frac <= 0),
-                              ff_b60_sinc, 6,
-                              2 * ((2 + T0_frac)%3 + 1), LP_FILTER_ORDER,
-                              SUBFR_SIZE);
-
-        decode_fixed_sparse(&fixed_cb, params->fc_indexes[i], ctx->mode,
-                            ctx->past_pitch_gain < 0.8);
-
-        eval_ir(pAz, T0, impulse_response, modes[ctx->mode].pitch_sharp_factor);
-
-        convolute_with_sparse(fixed_vector, &fixed_cb, impulse_response,
-                              SUBFR_SIZE);
-
-        avg_energy =
-            (0.01 + ff_dot_productf(fixed_vector, fixed_vector, SUBFR_SIZE))/
-                SUBFR_SIZE;
-
-        ctx->past_pitch_gain = pitch_gain = gain_cb[params->gc_index[i]][0];
-
-        gain_code = ff_amr_set_fixed_gain(gain_cb[params->gc_index[i]][1],
-                                          avg_energy, ctx->energy_history,
-                                          34 - 15.0/(0.05*M_LN10/M_LN2),
-                                          pred);
-
-        ff_weighted_vector_sumf(excitation, excitation, fixed_vector,
-                                pitch_gain, gain_code, SUBFR_SIZE);
-
-        pitch_gain *= 0.5 * pitch_gain;
-        pitch_gain = FFMIN(pitch_gain, 0.4);
-
-        ctx->gain_mem = 0.7 * ctx->gain_mem + 0.3 * pitch_gain;
-        ctx->gain_mem = FFMIN(ctx->gain_mem, pitch_gain);
-        gain_code *= ctx->gain_mem;
-
-        for (j = 0; j < SUBFR_SIZE; j++)
-            fixed_vector[j] = excitation[j] - gain_code * fixed_vector[j];
-
-        if (ctx->mode == MODE_5k0) {
-            postfilter_5k0(ctx, pAz, fixed_vector);
-
-            ff_celp_lp_synthesis_filterf(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
-                                         pAz, excitation, SUBFR_SIZE,
-                                         LP_FILTER_ORDER);
-        }
-
-        ff_celp_lp_synthesis_filterf(synth + i*SUBFR_SIZE, pAz, fixed_vector,
-                                     SUBFR_SIZE, LP_FILTER_ORDER);
-
-        excitation += SUBFR_SIZE;
-    }
-
-    memcpy(synth - LP_FILTER_ORDER, synth + frame_size - LP_FILTER_ORDER,
-           LP_FILTER_ORDER * sizeof(float));
-
-    if (ctx->mode == MODE_5k0) {
-        for (i = 0; i < subframe_count; i++) {
-            float energy = ff_dot_productf(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
-                                           ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE,
-                                           SUBFR_SIZE);
-            ff_adaptive_gain_control(&synth[i * SUBFR_SIZE],
-                                     &synth[i * SUBFR_SIZE], energy,
-                                     SUBFR_SIZE, 0.9, &ctx->postfilter_agc);
-        }
-
-        memcpy(ctx->postfilter_syn5k0, ctx->postfilter_syn5k0 + frame_size,
-               LP_FILTER_ORDER*sizeof(float));
-    }
-    memcpy(ctx->excitation, excitation - PITCH_DELAY_MAX - L_INTERPOL,
-           (PITCH_DELAY_MAX + L_INTERPOL) * sizeof(float));
-
-    ff_acelp_apply_order_2_transfer_function(out_data, synth,
-                                             (const float[2]) {-1.99997   , 1.000000000},
-                                             (const float[2]) {-1.93307352, 0.935891986},
-                                             0.939805806,
-                                             ctx->highpass_filt_mem,
-                                             frame_size);
-}
-
-static av_cold int sipr_decoder_init(AVCodecContext * avctx)
-{
-    SiprContext *ctx = avctx->priv_data;
-    int i;
-
-    if      (avctx->bit_rate > 12200) ctx->mode = MODE_16k;
-    else if (avctx->bit_rate > 7500 ) ctx->mode = MODE_8k5;
-    else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5;
-    else                              ctx->mode = MODE_5k0;
-
-    av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name);
-
-    if (ctx->mode == MODE_16k)
-        ff_sipr_init_16k(ctx);
-
-    for (i = 0; i < LP_FILTER_ORDER; i++)
-        ctx->lsp_history[i] = cos((i+1) * M_PI / (LP_FILTER_ORDER + 1));
-
-    for (i = 0; i < 4; i++)
-        ctx->energy_history[i] = -14;
-
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
-
-    dsputil_init(&ctx->dsp, avctx);
-
-    return 0;
-}
-
-static int sipr_decode_frame(AVCodecContext *avctx, void *datap,
-                             int *data_size, AVPacket *avpkt)
-{
-    SiprContext *ctx = avctx->priv_data;
-    const uint8_t *buf=avpkt->data;
-    SiprParameters parm;
-    const SiprModeParam *mode_par = &modes[ctx->mode];
-    GetBitContext gb;
-    float *data = datap;
-    int subframe_size = ctx->mode == MODE_16k ? L_SUBFR_16k : SUBFR_SIZE;
-    int i;
-
-    ctx->avctx = avctx;
-    if (avpkt->size < (mode_par->bits_per_frame >> 3)) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Error processing packet: packet size (%d) too small\n",
-               avpkt->size);
-
-        *data_size = 0;
-        return -1;
-    }
-    if (*data_size < subframe_size * mode_par->subframe_count * sizeof(float)) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Error processing packet: output buffer (%d) too small\n",
-               *data_size);
-
-        *data_size = 0;
-        return -1;
-    }
-
-    init_get_bits(&gb, buf, mode_par->bits_per_frame);
-
-    for (i = 0; i < mode_par->frames_per_packet; i++) {
-        decode_parameters(&parm, &gb, mode_par);
-
-        if (ctx->mode == MODE_16k)
-            ff_sipr_decode_frame_16k(ctx, &parm, data);
-        else
-            decode_frame(ctx, &parm, data);
-
-        data += subframe_size * mode_par->subframe_count;
-    }
-
-    *data_size = mode_par->frames_per_packet * subframe_size *
-        mode_par->subframe_count * sizeof(float);
-
-    return mode_par->bits_per_frame >> 3;
-};
-
-AVCodec sipr_decoder = {
-    "sipr",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SIPR,
-    sizeof(SiprContext),
-    sipr_decoder_init,
-    NULL,
-    NULL,
-    sipr_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"),
-};
diff --git a/libavcodec/sipr.h b/libavcodec/sipr.h
deleted file mode 100644
index 66e7696..0000000
--- a/libavcodec/sipr.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * SIPR / ACELP.NET decoder
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SIPR_H
-#define AVCODEC_SIPR_H
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "acelp_pitch_delay.h"
-
-#define LP_FILTER_ORDER_16k  16
-#define L_SUBFR_16k          80
-#define PITCH_MIN            30
-#define PITCH_MAX            281
-
-#define LSFQ_DIFF_MIN        (0.0125 * M_PI)
-
-#define LP_FILTER_ORDER      10
-
-/** Number of past samples needed for excitation interpolation */
-#define L_INTERPOL           (LP_FILTER_ORDER + 1)
-
-/**  Subframe size for all modes except 16k */
-#define SUBFR_SIZE           48
-
-#define SUBFRAME_COUNT_16k   2
-
-typedef enum {
-    MODE_16k,
-    MODE_8k5,
-    MODE_6k5,
-    MODE_5k0,
-    MODE_COUNT
-} SiprMode;
-
-typedef struct {
-    AVCodecContext *avctx;
-    DSPContext dsp;
-
-    SiprMode mode;
-
-    float past_pitch_gain;
-    float lsf_history[LP_FILTER_ORDER_16k];
-
-    float excitation[L_INTERPOL + PITCH_MAX + 2 * L_SUBFR_16k];
-
-    DECLARE_ALIGNED(16, float, synth_buf)[LP_FILTER_ORDER + 5*SUBFR_SIZE + 6];
-
-    float lsp_history[LP_FILTER_ORDER];
-    float gain_mem;
-    float energy_history[4];
-    float highpass_filt_mem[2];
-    float postfilter_mem[PITCH_DELAY_MAX + LP_FILTER_ORDER];
-
-    /* 5k0 */
-    float tilt_mem;
-    float postfilter_agc;
-    float postfilter_mem5k0[PITCH_DELAY_MAX + LP_FILTER_ORDER];
-    float postfilter_syn5k0[LP_FILTER_ORDER + SUBFR_SIZE*5];
-
-    /* 16k */
-    int pitch_lag_prev;
-    float iir_mem[LP_FILTER_ORDER_16k+1];
-    float filt_buf[2][LP_FILTER_ORDER_16k+1];
-    float *filt_mem[2];
-    float mem_preemph[LP_FILTER_ORDER_16k];
-    float synth[LP_FILTER_ORDER_16k];
-    double lsp_history_16k[16];
-} SiprContext;
-
-typedef struct {
-    int ma_pred_switch;        ///< switched moving average predictor
-    int vq_indexes[5];
-    int pitch_delay[5];        ///< pitch delay
-    int gp_index[5];           ///< adaptive-codebook gain indexes
-    int16_t fc_indexes[5][10]; ///< fixed-codebook indexes
-    int gc_index[5];           ///< fixed-codebook gain indexes
-} SiprParameters;
-
-extern const float ff_pow_0_5[16];
-
-void ff_sipr_init_16k(SiprContext *ctx);
-
-void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
-                              float *out_data);
-
-#endif /* AVCODEC_SIPR_H */
diff --git a/libavcodec/sipr16k.c b/libavcodec/sipr16k.c
deleted file mode 100644
index 7fb9252..0000000
--- a/libavcodec/sipr16k.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * SIPR decoder for the 16k mode
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <math.h>
-
-#include "sipr.h"
-#include "libavutil/mathematics.h"
-#include "lsp.h"
-#include "celp_math.h"
-#include "acelp_vectors.h"
-#include "acelp_pitch_delay.h"
-#include "acelp_filters.h"
-#include "celp_filters.h"
-
-#include "sipr16kdata.h"
-
-/**
- * Convert an lsf vector into an lsp vector.
- *
- * @param lsf               input lsf vector
- * @param lsp               output lsp vector
- */
-static void lsf2lsp(const float *lsf, double *lsp)
-{
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER_16k; i++)
-        lsp[i] = cosf(lsf[i]);
-}
-
-static void dequant(float *out, const int *idx, const float *cbs[])
-{
-    int i;
-
-    for (i = 0; i < 4; i++)
-        memcpy(out + 3*i, cbs[i] + 3*idx[i], 3*sizeof(float));
-
-    memcpy(out + 12, cbs[4] + 4*idx[4], 4*sizeof(float));
-}
-
-static void lsf_decode_fp_16k(float* lsf_history, float* isp_new,
-                              const int* parm, int ma_pred)
-{
-    int i;
-    float isp_q[LP_FILTER_ORDER_16k];
-
-    dequant(isp_q, parm, lsf_codebooks_16k);
-
-    for (i = 0; i < LP_FILTER_ORDER_16k; i++) {
-        isp_new[i] = (1 - qu[ma_pred]) * isp_q[i]
-                    +     qu[ma_pred]  * lsf_history[i]
-                    + mean_lsf_16k[i];
-    }
-
-    memcpy(lsf_history, isp_q, LP_FILTER_ORDER_16k * sizeof(float));
-}
-
-static int dec_delay3_1st(int index)
-{
-    if (index < 390) {
-        return index + 88;
-    } else
-        return 3 * index - 690;
-}
-
-static int dec_delay3_2nd(int index, int pit_min, int pit_max,
-                          int pitch_lag_prev)
-{
-    if (index < 62) {
-        int pitch_delay_min = av_clip(pitch_lag_prev - 10,
-                                      pit_min, pit_max - 19);
-        return 3 * pitch_delay_min + index - 2;
-    } else
-        return 3 * pitch_lag_prev;
-}
-
-static void postfilter(float *out_data, float* synth, float* iir_mem,
-                       float* filt_mem[2], float* mem_preemph)
-{
-    float buf[30 + LP_FILTER_ORDER_16k];
-    float *tmpbuf = buf + LP_FILTER_ORDER_16k;
-    float s;
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER_16k; i++)
-        filt_mem[0][i] = iir_mem[i] * ff_pow_0_5[i];
-
-    memcpy(tmpbuf - LP_FILTER_ORDER_16k, mem_preemph,
-           LP_FILTER_ORDER_16k*sizeof(*buf));
-
-    ff_celp_lp_synthesis_filterf(tmpbuf, filt_mem[1], synth, 30,
-                                 LP_FILTER_ORDER_16k);
-
-    memcpy(synth - LP_FILTER_ORDER_16k, mem_preemph,
-           LP_FILTER_ORDER_16k * sizeof(*synth));
-
-    ff_celp_lp_synthesis_filterf(synth, filt_mem[0], synth, 30,
-                                 LP_FILTER_ORDER_16k);
-
-    memcpy(out_data + 30 - LP_FILTER_ORDER_16k,
-           synth    + 30 - LP_FILTER_ORDER_16k,
-           LP_FILTER_ORDER_16k * sizeof(*synth));
-
-    ff_celp_lp_synthesis_filterf(out_data + 30, filt_mem[0],
-                                 synth + 30, 2 * L_SUBFR_16k - 30,
-                                 LP_FILTER_ORDER_16k);
-
-
-    memcpy(mem_preemph, out_data + 2*L_SUBFR_16k - LP_FILTER_ORDER_16k,
-           LP_FILTER_ORDER_16k * sizeof(*synth));
-
-    FFSWAP(float *, filt_mem[0], filt_mem[1]);
-    for (i = 0, s = 0; i < 30; i++, s += 1.0/30)
-        out_data[i] = tmpbuf[i] + s * (synth[i] - tmpbuf[i]);
-}
-
-/**
- * Floating point version of ff_acelp_lp_decode().
- */
-static void acelp_lp_decodef(float *lp_1st, float *lp_2nd,
-                             const double *lsp_2nd, const double *lsp_prev)
-{
-    double lsp_1st[LP_FILTER_ORDER_16k];
-    int i;
-
-    /* LSP values for first subframe (3.2.5 of G.729, Equation 24) */
-    for (i = 0; i < LP_FILTER_ORDER_16k; i++)
-        lsp_1st[i] = (lsp_2nd[i] + lsp_prev[i]) * 0.5;
-
-    ff_acelp_lspd2lpc(lsp_1st, lp_1st, LP_FILTER_ORDER_16k >> 1);
-
-    /* LSP values for second subframe (3.2.5 of G.729) */
-    ff_acelp_lspd2lpc(lsp_2nd, lp_2nd, LP_FILTER_ORDER_16k >> 1);
-}
-
-/**
- * Floating point version of ff_acelp_decode_gain_code().
- */
-static float acelp_decode_gain_codef(float gain_corr_factor, const float *fc_v,
-                                     float mr_energy, const float *quant_energy,
-                                     const float *ma_prediction_coeff,
-                                     int subframe_size, int ma_pred_order)
-{
-    mr_energy +=
-        ff_dot_productf(quant_energy, ma_prediction_coeff, ma_pred_order);
-
-    mr_energy = gain_corr_factor * exp(M_LN10 / 20. * mr_energy) /
-        sqrt((0.01 + ff_dot_productf(fc_v, fc_v, subframe_size)));
-    return mr_energy;
-}
-
-#define DIVIDE_BY_3(x) ((x) * 10923 >> 15)
-
-void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
-                              float *out_data)
-{
-    int frame_size = SUBFRAME_COUNT_16k * L_SUBFR_16k;
-    float *synth = ctx->synth_buf + LP_FILTER_ORDER_16k;
-    float lsf_new[LP_FILTER_ORDER_16k];
-    double lsp_new[LP_FILTER_ORDER_16k];
-    float Az[2][LP_FILTER_ORDER_16k];
-    float fixed_vector[L_SUBFR_16k];
-    float pitch_fac, gain_code;
-
-    int i;
-    int pitch_delay_3x;
-
-    float *excitation = ctx->excitation + 292;
-
-    lsf_decode_fp_16k(ctx->lsf_history, lsf_new, params->vq_indexes,
-                      params->ma_pred_switch);
-
-    ff_set_min_dist_lsf(lsf_new, LSFQ_DIFF_MIN / 2, LP_FILTER_ORDER_16k);
-
-    lsf2lsp(lsf_new, lsp_new);
-
-    acelp_lp_decodef(Az[0], Az[1], lsp_new, ctx->lsp_history_16k);
-
-    memcpy(ctx->lsp_history_16k, lsp_new, LP_FILTER_ORDER_16k * sizeof(double));
-
-    memcpy(synth - LP_FILTER_ORDER_16k, ctx->synth,
-           LP_FILTER_ORDER_16k * sizeof(*synth));
-
-    for (i = 0; i < SUBFRAME_COUNT_16k; i++) {
-        int i_subfr = i * L_SUBFR_16k;
-        AMRFixed f;
-        float gain_corr_factor;
-        int pitch_delay_int;
-        int pitch_delay_frac;
-
-        if (!i) {
-            pitch_delay_3x = dec_delay3_1st(params->pitch_delay[i]);
-        } else
-            pitch_delay_3x = dec_delay3_2nd(params->pitch_delay[i],
-                                            PITCH_MIN, PITCH_MAX,
-                                            ctx->pitch_lag_prev);
-
-        pitch_fac = gain_pitch_cb_16k[params->gp_index[i]];
-        f.pitch_fac = FFMIN(pitch_fac, 1.0);
-        f.pitch_lag = DIVIDE_BY_3(pitch_delay_3x+1);
-        ctx->pitch_lag_prev = f.pitch_lag;
-
-        pitch_delay_int  = DIVIDE_BY_3(pitch_delay_3x + 2);
-        pitch_delay_frac = pitch_delay_3x + 2 - 3*pitch_delay_int;
-
-        ff_acelp_interpolatef(&excitation[i_subfr],
-                              &excitation[i_subfr] - pitch_delay_int + 1,
-                              sinc_win, 3, pitch_delay_frac + 1,
-                              LP_FILTER_ORDER, L_SUBFR_16k);
-
-
-        memset(fixed_vector, 0, sizeof(fixed_vector));
-
-        ff_decode_10_pulses_35bits(params->fc_indexes[i], &f,
-                                   ff_fc_4pulses_8bits_tracks_13, 5, 4);
-
-        ff_set_fixed_vector(fixed_vector, &f, 1.0, L_SUBFR_16k);
-
-        gain_corr_factor = gain_cb_16k[params->gc_index[i]];
-        gain_code = gain_corr_factor *
-            acelp_decode_gain_codef(sqrt(L_SUBFR_16k), fixed_vector,
-                                    19.0 - 15.0/(0.05*M_LN10/M_LN2),
-                                    pred_16k, ctx->energy_history,
-                                    L_SUBFR_16k, 2);
-
-        ctx->energy_history[1] = ctx->energy_history[0];
-        ctx->energy_history[0] = 20.0 * log10f(gain_corr_factor);
-
-        ff_weighted_vector_sumf(&excitation[i_subfr], &excitation[i_subfr],
-                                fixed_vector, pitch_fac,
-                                gain_code, L_SUBFR_16k);
-
-        ff_celp_lp_synthesis_filterf(synth + i_subfr, Az[i],
-                                     &excitation[i_subfr], L_SUBFR_16k,
-                                     LP_FILTER_ORDER_16k);
-
-    }
-    memcpy(ctx->synth, synth + frame_size - LP_FILTER_ORDER_16k,
-           LP_FILTER_ORDER_16k * sizeof(*synth));
-
-    memmove(ctx->excitation, ctx->excitation + 2 * L_SUBFR_16k,
-            (L_INTERPOL+PITCH_MAX) * sizeof(float));
-
-    postfilter(out_data, synth, ctx->iir_mem, ctx->filt_mem, ctx->mem_preemph);
-
-    memcpy(ctx->iir_mem, Az[1], LP_FILTER_ORDER_16k * sizeof(float));
-}
-
-void ff_sipr_init_16k(SiprContext *ctx)
-{
-    int i;
-
-    for (i = 0; i < LP_FILTER_ORDER_16k; i++)
-        ctx->lsp_history_16k[i] = cos((i + 1) * M_PI/(LP_FILTER_ORDER_16k + 1));
-
-    ctx->filt_mem[0] = ctx->filt_buf[0];
-    ctx->filt_mem[1] = ctx->filt_buf[1];
-
-    ctx->pitch_lag_prev = 180;
-}
diff --git a/libavcodec/sipr16kdata.h b/libavcodec/sipr16kdata.h
deleted file mode 100644
index 96bf0e9..0000000
--- a/libavcodec/sipr16kdata.h
+++ /dev/null
@@ -1,533 +0,0 @@
-/*
- * SIPR decoder for the 16k mode
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SIPR16KDATA_H
-#define AVCODEC_SIPR16KDATA_H
-
-static const float pred_16k[2] = {0.8, 0.6};
-static const float qu[2] = { 0.12, 0.5};
-
-static const float gain_cb_16k[32] = {
-    0.07499,  0.10593,  0.14125,  0.18836,
-    0.23714,  0.28184,  0.32734,  0.37584,
-    0.42170,  0.47315,  0.53088,  0.59566,
-    0.66834,  0.74989,  0.84140,  0.94406,
-    1.05925,  1.18850,  1.33352,  1.49624,
-    1.67880,  1.88365,  2.11349,  2.37137,
-    2.66073,  3.05492,  3.54813,  4.21697,
-    5.30884,  7.07946,  9.44061, 13.33521,
-};
-
-static const float gain_pitch_cb_16k[16] = {
-    0.00, 0.2, 0.40, 0.5, 0.60, 0.7, 0.75, 0.8,
-    0.85, 0.9, 0.95, 1.0, 1.05, 1.1, 1.15, 1.2,
-};
-
-
-static const float mean_lsf_16k[16] = {
-    0.131554,  0.246615,  0.435896,  0.644419,
-    0.827810,  1.017876,  1.198910,  1.379159,
-    1.562157,  1.736908,  1.940719,  2.131963,
-    2.347162,  2.521521,  2.717870,  2.847068
-};
-
-/**
- * Hamming windowed sinc function, like in AMR
- */
-static const float sinc_win[40] = {
-     0.874475,  0.755101,  0.455962,  0.118807, -0.114223, -0.176778,
-    -0.101923,  0.015553,  0.086555,  0.078193,  0.018660, -0.037513,
-    -0.052733, -0.027459,  0.009967,  0.030278,  0.024050,  0.003055,
-    -0.013862, -0.016162, -0.006725,  0.004212,  0.008634,  0.005721,
-    -0.000000, -0.003710, -0.003690, -0.001228,  0.001409,  0.002610,
-};
-
-static const float lsf_cb1_16k[128][3] = {
-    {-0.089990, -0.172485, -0.203391}, {-0.094710, -0.178687, -0.134483},
-    {-0.056398, -0.131952, -0.154500}, {-0.051362, -0.128138, -0.198549},
-    {-0.061700, -0.142830, -0.251623}, {-0.041512, -0.115637, -0.229420},
-    {-0.036544, -0.107512, -0.173125}, {-0.024158, -0.088450, -0.204144},
-    {-0.038690, -0.103368, -0.132674}, {-0.056954, -0.128472, -0.104669},
-    {-0.020963, -0.076785, -0.163199}, {-0.012952, -0.077249, -0.128385},
-    {-0.032787, -0.097044, -0.093967}, {-0.035214, -0.053838, -0.111940},
-    {-0.013850, -0.036926, -0.139328}, {-0.004956, -0.065092, -0.087709},
-    {-0.065354, -0.065595, -0.079064}, {-0.023627, -0.081457, -0.054195},
-    {-0.027335, -0.035244, -0.068034}, { 0.016555, -0.047075, -0.128286},
-    { 0.021066, -0.037252, -0.092041}, { 0.014681, -0.043044, -0.057739},
-    {-0.008493, -0.008143, -0.102486}, {-0.002303, -0.061540, -0.022952},
-    {-0.006061, -0.014278, -0.033652}, {-0.005276,  0.011246, -0.062762},
-    { 0.043411, -0.006303, -0.063730}, { 0.035885, -0.010052, -0.115290},
-    { 0.030628, -0.031538, -0.017807}, { 0.022345,  0.028210, -0.032335},
-    { 0.026535,  0.027536, -0.091150}, {-0.003365, -0.008077,  0.015687},
-    {-0.026013,  0.017493, -0.010355}, { 0.059069,  0.010634, -0.007530},
-    { 0.044038, -0.019424,  0.030453}, {-0.036065, -0.034215, -0.007758},
-    { 0.022486,  0.042543,  0.027870}, {-0.049985, -0.016085,  0.021768},
-    {-0.021715,  0.021168,  0.052076}, {-0.004243, -0.061228,  0.027640},
-    {-0.033950, -0.017287,  0.064656}, { 0.016151,  0.000727,  0.062757},
-    {-0.063456, -0.043152,  0.056707}, {-0.067715,  0.006126,  0.058178},
-    {-0.038931,  0.051673,  0.030636}, {-0.073017, -0.074716,  0.026387},
-    {-0.039893, -0.104629,  0.039616}, {-0.073179, -0.074601,  0.082069},
-    {-0.066154, -0.027180,  0.099439}, {-0.075167, -0.121149,  0.071938},
-    {-0.030382, -0.092582,  0.091067}, {-0.084519, -0.137542,  0.023626},
-    {-0.060956, -0.121259, -0.015264}, {-0.030069, -0.093823, -0.008692},
-    {-0.063564, -0.065225, -0.025820}, {-0.052074, -0.117595, -0.059689},
-    {-0.091652, -0.165173, -0.045573}, {-0.070167, -0.121342,  0.131707},
-    {-0.061024, -0.005833, -0.051035}, { 0.007837, -0.051816,  0.074575},
-    {-0.070643, -0.053927,  0.149498}, {-0.014358, -0.066681,  0.139708},
-    {-0.058186,  0.029576,  0.092923}, {-0.023371,  0.007058,  0.112484},
-    {-0.057969,  0.022786,  0.148420}, { 0.029439, -0.017673,  0.121423},
-    {-0.015811,  0.056785,  0.091594}, { 0.004347,  0.056680,  0.137848},
-    {-0.004464,  0.002342,  0.184013}, { 0.029660,  0.046870,  0.082654},
-    { 0.059408,  0.001016,  0.086063}, { 0.055263,  0.027574,  0.155037},
-    { 0.062166,  0.064323,  0.117371}, { 0.022967,  0.100050,  0.077227},
-    { 0.041795,  0.096343,  0.170421}, { 0.053189,  0.122931,  0.118549},
-    { 0.094247,  0.094448,  0.078395}, { 0.082407,  0.033408,  0.041085},
-    { 0.096820,  0.115960,  0.149433}, { 0.067804,  0.121849,  0.025336},
-    {-0.008421,  0.104316,  0.032314}, { 0.031013,  0.073218, -0.004899},
-    { 0.085079,  0.060323, -0.009687}, { 0.028174,  0.092766, -0.055590},
-    { 0.070133,  0.039160, -0.061035}, {-0.039211,  0.072517, -0.028756},
-    { 0.129686,  0.100233, -0.046998}, { 0.154189,  0.107616,  0.022791},
-    {-0.049331,  0.094184,  0.087984}, {-0.013179,  0.126552,  0.125099},
-    {-0.058716,  0.098524,  0.150886}, {-0.022753,  0.080011,  0.191127},
-    { 0.013451,  0.164593,  0.153768}, { 0.074818,  0.181214,  0.108211},
-    { 0.091323,  0.169249,  0.168460}, { 0.033885,  0.155516,  0.213745},
-    {-0.032128,  0.227238,  0.135815}, {-0.059176,  0.168980,  0.229110},
-    { 0.033917,  0.229753,  0.222264}, { 0.082702,  0.116370,  0.224697},
-    { 0.127737,  0.186658,  0.212783}, { 0.047528,  0.063920,  0.216856},
-    {-0.002446,  0.114174,  0.263289}, {-0.077783,  0.082523,  0.249697},
-    { 0.010023,  0.024267,  0.256874}, { 0.053190,  0.111422,  0.310407},
-    {-0.078804,  0.004444,  0.224078}, {-0.055253, -0.059180,  0.217892},
-    {-0.065371,  0.008124,  0.333405}, {-0.076188, -0.098767,  0.286983},
-    {-0.071911, -0.115804,  0.198031}, {-0.062473,  0.183639,  0.370162},
-    {-0.042666,  0.255210,  0.262720}, { 0.011999,  0.217530,  0.318291},
-    {-0.042144,  0.322087,  0.326387}, { 0.090663,  0.205835,  0.294784},
-    { 0.058218,  0.293649,  0.277927}, { 0.157506,  0.282870,  0.294610},
-    { 0.118248,  0.261007,  0.148614}, { 0.065261,  0.332362,  0.411912},
-    { 0.141269,  0.451850,  0.315726}, { 0.001706,  0.456301,  0.357590},
-    {-0.052947,  0.356559,  0.456944}, { 0.247707,  0.263837,  0.152591},
-    { 0.306847,  0.417373,  0.258553}, { 0.166347,  0.149222,  0.118973},
-    { 0.379709,  0.292172,  0.139875}, { 0.010171, -0.055170, -0.174523}
-};
-
-static const float lsf_cb2_16k[256][3] = {
-    {-0.213011, -0.293385, -0.330597}, {-0.212582, -0.240992, -0.338239},
-    {-0.223373, -0.306214, -0.277192}, {-0.231138, -0.287729, -0.229412},
-    {-0.238466, -0.228571, -0.260954}, {-0.140931, -0.247018, -0.258566},
-    {-0.136239, -0.249669, -0.350143}, {-0.149738, -0.192970, -0.281475},
-    {-0.167058, -0.261052, -0.196301}, {-0.177049, -0.201324, -0.207897},
-    {-0.116915, -0.200629, -0.212526}, {-0.162247, -0.143805, -0.245093},
-    {-0.082042, -0.191842, -0.266338}, {-0.098846, -0.208511, -0.320481},
-    {-0.113510, -0.152470, -0.222474}, {-0.066197, -0.179112, -0.207813},
-    {-0.129490, -0.169320, -0.155238}, {-0.078843, -0.190292, -0.155172},
-    {-0.087790, -0.147729, -0.169351}, {-0.141037, -0.127207, -0.177910},
-    {-0.126525, -0.223961, -0.153639}, {-0.101464, -0.189953, -0.114559},
-    {-0.102450, -0.106303, -0.151171}, {-0.103208, -0.144457, -0.105378},
-    {-0.170794, -0.140525, -0.136428}, {-0.168641, -0.203064, -0.135368},
-    {-0.138193, -0.116042, -0.111905}, {-0.145085, -0.168581, -0.092613},
-    {-0.126379, -0.220431, -0.091327}, {-0.212934, -0.184797, -0.101632},
-    {-0.193711, -0.140556, -0.078304}, {-0.173674, -0.197276, -0.060140},
-    {-0.197897, -0.241907, -0.091997}, {-0.156037, -0.258519, -0.111628},
-    {-0.241964, -0.191124, -0.063140}, {-0.261340, -0.240847, -0.103132},
-    {-0.221621, -0.242972, -0.041255}, {-0.224166, -0.232742, -0.161568},
-    {-0.203591, -0.294470, -0.126035}, {-0.209540, -0.303149, -0.053170},
-    {-0.253859, -0.295066, -0.156050}, {-0.278143, -0.331105, -0.085237},
-    {-0.300273, -0.198750, -0.094834}, {-0.260477, -0.169713, -0.132476},
-    {-0.211889, -0.172454, -0.164281}, {-0.228370, -0.122149, -0.124178},
-    {-0.254629, -0.135668, -0.081692}, {-0.263813, -0.154928, -0.213596},
-    {-0.308224, -0.106877, -0.084404}, {-0.242644, -0.082862, -0.085835},
-    {-0.252084, -0.064888, -0.146498}, {-0.198162, -0.105721, -0.188887},
-    {-0.189238, -0.088028, -0.109736}, {-0.197598, -0.099831, -0.044030},
-    {-0.269017, -0.105991, -0.021513}, {-0.231349, -0.058825, -0.041407},
-    {-0.225589, -0.027501, -0.087160}, {-0.160347, -0.058341, -0.079789},
-    {-0.158729, -0.108951, -0.067262}, {-0.170483, -0.053023, -0.017561},
-    {-0.175207, -0.013649, -0.049513}, {-0.156004, -0.108378, -0.004052},
-    {-0.219958, -0.082362,  0.014950}, {-0.217785, -0.012981, -0.009410},
-    {-0.123290, -0.040849, -0.040910}, {-0.119861, -0.095078, -0.060246},
-    {-0.117537, -0.065479,  0.002968}, {-0.103231, -0.113298, -0.023282},
-    {-0.136365, -0.149524, -0.051387}, {-0.119332, -0.164400, -0.009103},
-    {-0.104522, -0.060948, -0.083056}, {-0.071461, -0.070787, -0.037347},
-    {-0.081116, -0.149015, -0.056740}, {-0.069561, -0.108099, -0.069167},
-    {-0.055624, -0.117369, -0.025091}, {-0.091941, -0.190091, -0.060020},
-    {-0.072003, -0.168433, -0.006540}, {-0.033305, -0.154427, -0.054608},
-    {-0.062988, -0.127093, -0.108307}, {-0.056690, -0.170813, -0.102834},
-    {-0.018273, -0.127863, -0.094998}, {-0.056239, -0.123678, -0.146262},
-    {-0.023442, -0.154617, -0.137417}, {-0.051903, -0.078379, -0.093395},
-    {-0.014599, -0.104412, -0.135959}, {-0.051582, -0.081280, -0.140643},
-    {-0.092727, -0.091930, -0.107816}, {-0.024814, -0.140993, -0.183243},
-    {-0.064307, -0.113024, -0.194788}, {-0.000118, -0.098858, -0.195336},
-    {-0.028090, -0.048258, -0.164101}, {-0.093414, -0.055969, -0.172743},
-    {-0.114445, -0.104336, -0.215204}, {-0.048518, -0.132063, -0.242991},
-    {-0.159620, -0.060240, -0.178592}, {-0.135728, -0.067473, -0.131876},
-    {-0.078464, -0.038040, -0.125105}, {-0.011061, -0.064011, -0.102496},
-    {-0.033887, -0.026485, -0.109493}, {-0.129128, -0.014216, -0.111329},
-    {-0.190687, -0.030660, -0.135825}, {-0.082037,  0.010997, -0.100167},
-    {-0.183403,  0.001651, -0.098962}, {-0.074775, -0.030335, -0.062217},
-    {-0.031759, -0.050551, -0.059420}, {-0.051439,  0.010827, -0.052148},
-    {-0.126744,  0.008689, -0.047785}, {-0.145916,  0.042019, -0.077431},
-    {-0.093552,  0.054143, -0.060473}, {-0.090660,  0.012868, -0.018195},
-    {-0.079783, -0.033071,  0.001482}, {-0.033010, -0.022331, -0.014506},
-    {-0.004798, -0.017339, -0.060120}, {-0.025021,  0.026390, -0.003263},
-    {-0.001437,  0.025994, -0.040892}, {-0.074821,  0.019005,  0.027549},
-    {-0.030811, -0.012114,  0.034284}, { 0.006785,  0.004618,  0.018717},
-    { 0.013392, -0.032597, -0.023731}, { 0.035994,  0.005963, -0.011757},
-    { 0.008071, -0.045750,  0.024889}, { 0.013055,  0.017040,  0.054121},
-    {-0.012989,  0.044864,  0.036327}, { 0.025054,  0.047137,  0.009974},
-    { 0.053801,  0.024178,  0.031774}, { 0.056442, -0.030647,  0.021291},
-    { 0.032247,  0.052680,  0.049886}, { 0.035369,  0.090207,  0.031394},
-    { 0.064720,  0.070390,  0.040938}, { 0.022112,  0.054834,  0.091059},
-    { 0.041765,  0.086248,  0.070196}, { 0.070645,  0.060852,  0.078825},
-    { 0.058506,  0.016920,  0.081612}, { 0.000009,  0.086500,  0.059849},
-    { 0.071253,  0.107392,  0.059046}, { 0.094702,  0.096160,  0.090982},
-    { 0.047639,  0.110877,  0.111227}, { 0.122444,  0.090909,  0.057396},
-    { 0.101916,  0.052299,  0.029909}, { 0.076560,  0.086094, -0.007252},
-    { 0.123411,  0.030769,  0.082749}, { 0.135579,  0.103022,  0.009540},
-    { 0.120576,  0.065284, -0.024095}, { 0.077483,  0.028526, -0.012369},
-    { 0.128747,  0.017901, -0.003874}, { 0.158254,  0.046962,  0.029577},
-    { 0.102287, -0.002211,  0.037329}, { 0.089654, -0.021372, -0.006857},
-    { 0.137917,  0.027228, -0.053223}, { 0.098728, -0.012192, -0.048518},
-    { 0.083974,  0.036153, -0.062266}, { 0.048230, -0.010241, -0.052293},
-    { 0.110135,  0.007715, -0.095233}, { 0.068294, -0.014317, -0.104029},
-    { 0.063909, -0.056416, -0.063023}, { 0.059133, -0.044675, -0.023780},
-    { 0.030748,  0.021845, -0.086332}, { 0.023994, -0.045574, -0.076232},
-    { 0.052147, -0.059825, -0.109667}, { 0.013087, -0.020420, -0.121945},
-    { 0.018163, -0.096765, -0.088758}, { 0.020196, -0.076470, -0.048112},
-    { 0.020282, -0.084204, -0.135535}, { 0.040076, -0.053464, -0.161949},
-    {-0.017796, -0.103070, -0.059559}, {-0.016484, -0.070138, -0.016866},
-    { 0.004849, -0.112481, -0.017731}, { 0.040160, -0.073873, -0.005327},
-    { 0.002202, -0.094723,  0.045366}, {-0.056918, -0.081578,  0.017875},
-    {-0.031099, -0.141708,  0.009186}, {-0.102802, -0.122675,  0.030060},
-    {-0.061717, -0.145116,  0.076680}, {-0.073607, -0.050464,  0.072853},
-    {-0.117403, -0.194921,  0.040101}, {-0.185236, -0.133620,  0.045939},
-    {-0.160174, -0.057226,  0.056641}, {-0.178489, -0.173435, -0.007806},
-    {-0.199916, -0.204866,  0.047342}, {-0.152337, -0.249651,  0.034656},
-    {-0.185637, -0.230942, -0.002072}, {-0.122548, -0.215209, -0.024552},
-    {-0.249578, -0.209714,  0.009470}, {-0.160108, -0.257702, -0.040992},
-    {-0.216694, -0.289353,  0.027182}, {-0.226390, -0.147844, -0.022742},
-    {-0.288737, -0.272150, -0.013948}, {-0.262554, -0.237035,  0.072473},
-    {-0.306267, -0.188335, -0.032894}, {-0.259666, -0.345816,  0.024138},
-    {-0.271093, -0.137143,  0.040404}, {-0.201317, -0.286782,  0.107615},
-    {-0.235725, -0.163396,  0.113844}, {-0.159988, -0.209788,  0.112140},
-    {-0.262985, -0.056741,  0.093506}, {-0.277226, -0.037306,  0.016008},
-    {-0.293486, -0.040422, -0.062018}, {-0.214921,  0.022900,  0.055295},
-    {-0.253889,  0.058575, -0.000151}, {-0.246689,  0.024242, -0.058488},
-    {-0.143790,  0.006767,  0.014061}, {-0.187077,  0.048882, -0.035625},
-    {-0.196369,  0.112085,  0.031546}, {-0.124264,  0.086197, -0.020800},
-    {-0.126249,  0.016960,  0.095741}, {-0.079816,  0.080398,  0.051038},
-    {-0.056269,  0.075380, -0.028262}, {-0.120493,  0.148495,  0.028430},
-    {-0.161750,  0.101290,  0.117806}, {-0.003247,  0.083393, -0.017061},
-    {-0.034007,  0.142542,  0.007402}, {-0.037618,  0.025871,  0.089496},
-    {-0.082819,  0.184435,  0.073224}, { 0.006448,  0.167015,  0.080548},
-    { 0.035315,  0.144022,  0.003218}, {-0.023459,  0.088147,  0.152604},
-    { 0.006247, -0.024099,  0.077792}, { 0.039894,  0.057586, -0.042455},
-    {-0.020417,  0.035400, -0.093971}, { 0.075465,  0.052063,  0.145582},
-    { 0.078027,  0.184720,  0.092096}, { 0.107295,  0.148380,  0.022264},
-    { 0.066928, -0.052831,  0.065108}, { 0.093295,  0.118157,  0.149815},
-    { 0.119373,  0.137114,  0.099536}, { 0.138653,  0.075509,  0.121545},
-    { 0.174025,  0.077531,  0.077169}, { 0.165839,  0.150080,  0.133423},
-    { 0.173276,  0.155887,  0.048150}, { 0.162910,  0.095898,  0.171896},
-    { 0.214577,  0.112888,  0.115579}, { 0.204755,  0.106392,  0.032337},
-    { 0.178853,  0.205034,  0.114760}, { 0.177401,  0.070504, -0.013778},
-    { 0.241624,  0.166921,  0.066087}, { 0.219595,  0.183553,  0.172332},
-    { 0.123671,  0.170842,  0.167216}, { 0.177104,  0.240197,  0.186359},
-    { 0.272003,  0.220214,  0.126073}, { 0.093748,  0.235843,  0.160998},
-    { 0.141510,  0.190012,  0.240416}, { 0.046878,  0.168984,  0.190412},
-    { 0.094898,  0.107038,  0.235003}, { 0.108592,  0.269536,  0.262528},
-    {-0.027754,  0.234355,  0.134544}, { 0.265127,  0.267540,  0.199041},
-    { 0.199523,  0.291507,  0.265171}, { 0.266177,  0.209339,  0.350369},
-    { 0.322159,  0.344794,  0.270823}, { 0.399957,  0.264065,  0.110387},
-    { 0.277817,  0.127407, -0.035625}, {-0.177038,  0.208155,  0.119077},
-    { 0.049075, -0.076294,  0.145711}, { 0.187246,  0.042865, -0.127097},
-    { 0.117885, -0.023489, -0.138658}, {-0.284256,  0.068153,  0.124259}
-};
-
-static const float lsf_cb3_16k[128][3] = {
-    {-0.223412, -0.236300, -0.188067}, {-0.202286, -0.218711, -0.102947},
-    {-0.251652, -0.161020, -0.125280}, {-0.169223, -0.138155, -0.140430},
-    {-0.176427, -0.146628, -0.222632}, {-0.120584, -0.187276, -0.180164},
-    {-0.195559, -0.074225, -0.169109}, {-0.144551, -0.142774, -0.073340},
-    {-0.111001, -0.111310, -0.130696}, {-0.095221, -0.174684, -0.111841},
-    {-0.112158, -0.103049, -0.195130}, {-0.059989, -0.142170, -0.157850},
-    {-0.127598, -0.051759, -0.153109}, {-0.063753, -0.067898, -0.164117},
-    {-0.141753, -0.068274, -0.091999}, {-0.060482, -0.101054, -0.099475},
-    {-0.104699, -0.104456, -0.066496}, {-0.073649, -0.052614, -0.091612},
-    {-0.088268, -0.019072, -0.129956}, {-0.018837, -0.104115, -0.127837},
-    {-0.021630, -0.033055, -0.129868}, {-0.083768, -0.047549, -0.041407},
-    {-0.055892, -0.108526, -0.043200}, {-0.027816, -0.062499, -0.048190},
-    {-0.002248, -0.110428, -0.062868}, { 0.001270, -0.033245, -0.072404},
-    {-0.042747, -0.013835, -0.033829}, {-0.037615, -0.147833, -0.083912},
-    {-0.045023,  0.006011, -0.092182}, {-0.050411, -0.081832,  0.005787},
-    { 0.000357, -0.104282, -0.009428}, {-0.003893, -0.047892, -0.001506},
-    {-0.040077, -0.147110, -0.009065}, {-0.060858, -0.030972,  0.012999},
-    {-0.014674,  0.001370,  0.005554}, {-0.101362, -0.126061, -0.001898},
-    {-0.102519, -0.000390, -0.015721}, {-0.132687, -0.069608, -0.019928},
-    {-0.102227, -0.076131,  0.043306}, {-0.055193,  0.027001,  0.011857},
-    {-0.156427, -0.016629,  0.017480}, {-0.078736,  0.002809,  0.057979},
-    {-0.157789, -0.016693, -0.055073}, {-0.179397, -0.095520,  0.022065},
-    {-0.110219,  0.010408, -0.081927}, {-0.125392,  0.049111,  0.044595},
-    {-0.112528,  0.063173, -0.024954}, {-0.185525,  0.053093, -0.032102},
-    {-0.176887, -0.019379, -0.115125}, {-0.249706, -0.017664, -0.059188},
-    {-0.200243, -0.103311, -0.066846}, {-0.055404,  0.045106, -0.046991},
-    {-0.000544,  0.022690, -0.044831}, { 0.022298, -0.016367, -0.022509},
-    { 0.028278,  0.017585, -0.100612}, { 0.061781, -0.020826, -0.068190},
-    { 0.029157, -0.074477, -0.098898}, { 0.043073, -0.067234, -0.032293},
-    { 0.060157,  0.034636, -0.034885}, { 0.071153, -0.013881, -0.009036},
-    { 0.054196, -0.029989, -0.131139}, { 0.030193,  0.024976,  0.009861},
-    { 0.055943, -0.045304,  0.031927}, { 0.033217, -0.002418,  0.038165},
-    { 0.063814,  0.045625,  0.025309}, { 0.033689,  0.038819,  0.049700},
-    { 0.073582,  0.028527,  0.060200}, {-0.007957,  0.022531,  0.043687},
-    {-0.000984,  0.054518,  0.018742}, { 0.057004,  0.060916,  0.060573},
-    { 0.009883,  0.015238,  0.080211}, { 0.022742,  0.070832,  0.068855},
-    { 0.053001,  0.029790,  0.091446}, {-0.042447,  0.060379,  0.061462},
-    { 0.076826,  0.062468,  0.089653}, { 0.039065,  0.069768,  0.119128},
-    { 0.064145,  0.095353,  0.071621}, { 0.094411,  0.069527,  0.054197},
-    { 0.042812,  0.093060,  0.027980}, { 0.094791,  0.099189,  0.101112},
-    { 0.117611,  0.048601,  0.093111}, { 0.119951,  0.122758,  0.051546},
-    { 0.103558,  0.085245, -0.010700}, { 0.150126,  0.059766,  0.020280},
-    { 0.108066,  0.017170,  0.008606}, { 0.108422,  0.023253, -0.063942},
-    { 0.019652,  0.072284, -0.030331}, { 0.192719,  0.075624,  0.071156},
-    { 0.221140,  0.069191, -0.035085}, { 0.188367,  0.126200,  0.035225},
-    { 0.185760,  0.043537, -0.101714}, {-0.042518,  0.099646,  0.003244},
-    {-0.015308, -0.027521,  0.046006}, { 0.034086, -0.045777,  0.095989},
-    { 0.007174, -0.093358,  0.046459}, {-0.051248, -0.062095,  0.083161},
-    {-0.045626, -0.133301,  0.052997}, {-0.037840,  0.024042,  0.131097},
-    {-0.020217, -0.115942,  0.126170}, {-0.134550, -0.036291,  0.111322},
-    {-0.110576, -0.160024,  0.091841}, {-0.093308, -0.184958,  0.013939},
-    {-0.082735, -0.167417, -0.051725}, {-0.169934, -0.173003, -0.007155},
-    {-0.128244, -0.213123, -0.053337}, {-0.079852, -0.154116, -0.246546},
-    {-0.032242, -0.108756, -0.204133}, {-0.140117, -0.199495, -0.284505},
-    { 0.010842, -0.074979, -0.166333}, {-0.093313,  0.145006,  0.034110},
-    {-0.039236,  0.113213,  0.111053}, { 0.040613, -0.031783,  0.174058},
-    {-0.164232,  0.131421,  0.149842}, { 0.026893,  0.107281,  0.179297},
-    { 0.047086,  0.158606,  0.103267}, {-0.070567,  0.210459,  0.134734},
-    { 0.094392,  0.137050,  0.166892}, { 0.086039,  0.063657,  0.168825},
-    { 0.159371,  0.120897,  0.154357}, { 0.147101,  0.160684,  0.114882},
-    { 0.120158,  0.199650,  0.180948}, { 0.191417,  0.174500,  0.170734},
-    { 0.159153,  0.142165,  0.233347}, { 0.232002,  0.150181,  0.102736},
-    { 0.188299,  0.221738,  0.228748}, { 0.256786,  0.209685,  0.161534},
-    { 0.257861,  0.247793,  0.250516}, {-0.164461, -0.000143,  0.232461}
-};
-
-static const float lsf_cb4_16k[128][3] = {
-    {-0.193369, -0.304643, -0.253777}, {-0.164125, -0.277786, -0.153116},
-    {-0.135681, -0.209120, -0.211724}, {-0.121822, -0.215734, -0.292207},
-    {-0.198781, -0.161674, -0.242538}, {-0.164147, -0.180570, -0.138070},
-    {-0.095915, -0.198695, -0.154309}, {-0.248386, -0.234462, -0.136984},
-    {-0.164968, -0.108318, -0.175635}, {-0.124171, -0.111809, -0.224402},
-    {-0.067398, -0.157017, -0.195759}, {-0.090132, -0.119174, -0.165253},
-    {-0.099460, -0.146895, -0.106799}, {-0.141493, -0.108103, -0.108880},
-    {-0.085088, -0.098340, -0.109953}, {-0.105526, -0.054463, -0.154315},
-    {-0.040480, -0.144285, -0.124042}, {-0.040969, -0.084039, -0.142880},
-    {-0.049082, -0.118553, -0.066686}, {-0.096336, -0.087515, -0.055741},
-    {-0.058605, -0.059327, -0.089275}, {-0.121842, -0.058681, -0.086949},
-    {-0.053792, -0.022025, -0.124451}, {-0.036744, -0.068891, -0.045865},
-    { 0.003900, -0.098237, -0.091158}, {-0.001664, -0.045089, -0.081353},
-    {-0.072829, -0.034087, -0.038416}, {-0.100822, -0.007330, -0.088715},
-    {-0.035911, -0.005864, -0.062577}, {-0.020205, -0.026547, -0.019634},
-    { 0.004291, -0.041290, -0.138181}, { 0.023404, -0.010932, -0.044904},
-    { 0.013557,  0.014823, -0.092943}, { 0.059673, -0.031024, -0.095739},
-    { 0.021130, -0.080607, -0.034594}, { 0.024655, -0.035564,  0.003243},
-    { 0.017106,  0.006952, -0.000308}, { 0.075208, -0.030910, -0.031181},
-    { 0.024965,  0.048632, -0.039448}, { 0.057028,  0.021547, -0.009418},
-    {-0.018577,  0.023697, -0.009759}, { 0.024077,  0.033053,  0.024324},
-    { 0.037052, -0.003436,  0.044530}, {-0.012871, -0.007179,  0.031795},
-    { 0.077877,  0.021547,  0.023131}, { 0.053365,  0.052078,  0.029433},
-    { 0.011429,  0.070426,  0.028734}, {-0.001827,  0.033115,  0.061505},
-    {-0.044870,  0.038568,  0.026239}, { 0.061633,  0.034799,  0.059784},
-    { 0.034261,  0.060342,  0.065185}, { 0.058981,  0.082481,  0.047252},
-    { 0.090008,  0.065942,  0.044470}, { 0.066961,  0.073728, -0.000428},
-    { 0.074763,  0.060293,  0.085632}, { 0.066366,  0.103375,  0.079642},
-    { 0.122297,  0.036558,  0.058745}, { 0.111042,  0.092093,  0.085412},
-    { 0.099243,  0.115476,  0.039254}, { 0.019973,  0.122844,  0.050255},
-    { 0.159571,  0.098965,  0.051740}, { 0.137624,  0.072405, -0.006922},
-    { 0.130240,  0.146091,  0.089698}, { 0.138335,  0.092968,  0.136193},
-    { 0.066031,  0.149304,  0.125476}, { 0.202749,  0.145751,  0.077122},
-    { 0.002224,  0.082811,  0.131200}, { 0.124476,  0.178073,  0.162336},
-    { 0.174722,  0.190298,  0.127106}, { 0.202193,  0.153569,  0.163840},
-    { 0.242604,  0.197796,  0.136929}, { 0.185809,  0.229348,  0.193353},
-    {-0.058814,  0.195178,  0.141821}, { 0.253646,  0.247175,  0.205766},
-    { 0.061433, -0.025542,  0.119311}, {-0.057816,  0.082445,  0.073243},
-    {-0.069239,  0.148678,  0.031146}, {-0.030217, -0.008503,  0.106194},
-    {-0.026708,  0.087469, -0.009589}, {-0.090418,  0.000265,  0.056807},
-    {-0.050607, -0.019383,  0.010494}, {-0.079397,  0.008233, -0.011469},
-    {-0.072634, -0.061165,  0.046917}, {-0.075741, -0.072343, -0.007557},
-    {-0.025162, -0.073363,  0.005173}, {-0.123371, -0.041257, -0.008375},
-    {-0.139904,  0.018285,  0.009920}, {-0.143421, -0.104238,  0.033457},
-    {-0.100923, -0.134400, -0.023257}, {-0.157791, -0.095042, -0.036959},
-    {-0.219890, -0.078637,  0.001815}, {-0.183607, -0.023053, -0.043678},
-    {-0.145303, -0.158923, -0.059045}, {-0.197615, -0.165199,  0.028099},
-    {-0.225131, -0.167756, -0.056401}, {-0.216572, -0.104751, -0.102964},
-    {-0.171336, -0.241967, -0.063404}, {-0.134035, -0.205614,  0.011831},
-    {-0.297116, -0.211173, -0.015352}, {-0.086464, -0.200592, -0.070454},
-    {-0.217777, -0.278403,  0.030398}, {-0.236248, -0.323694, -0.087588},
-    {-0.222074, -0.210785,  0.106210}, {-0.283400, -0.097077,  0.041303},
-    {-0.078417, -0.154464,  0.062956}, {-0.214417, -0.100695,  0.121909},
-    {-0.178576, -0.028847,  0.061042}, {-0.037999, -0.144233, -0.010546},
-    {-0.086695, -0.070996,  0.125282}, { 0.010788, -0.085006,  0.058527},
-    {-0.154015,  0.066560,  0.071038}, {-0.143503,  0.033260,  0.154393},
-    {-0.134069,  0.032420, -0.056293}, {-0.110851,  0.086908,  0.003920},
-    {-0.057254,  0.047674, -0.055571}, {-0.214206,  0.068784, -0.004735},
-    {-0.257264,  0.050468,  0.081702}, {-0.291834,  0.004120, -0.022366},
-    {-0.173309, -0.029081, -0.115901}, {-0.207622,  0.168664,  0.136030},
-    { 0.090541,  0.032754, -0.057330}, { 0.140219, -0.000735, -0.015633},
-    { 0.136697, -0.017163, -0.100909}, { 0.029838, -0.089515, -0.147130},
-    {-0.055367, -0.072683, -0.214015}, { 0.048680, -0.057633, -0.212429},
-    {-0.013134, -0.113898, -0.196403}, {-0.071702, -0.159408, -0.254895}
-};
-
-static const float lsf_cb5_16k[128][4] = {
-    {-0.201277, -0.278679, -0.173262, -0.198580},
-    {-0.214667, -0.151922, -0.117551, -0.192713},
-    {-0.160962, -0.207728, -0.124750, -0.129749},
-    {-0.131043, -0.137818, -0.155281, -0.166308},
-    {-0.179134, -0.169602, -0.165223, -0.066293},
-    {-0.136474, -0.177035, -0.250127, -0.134370},
-    {-0.066970, -0.146274, -0.170638, -0.134436},
-    {-0.083288, -0.165860, -0.103437, -0.140361},
-    {-0.130474, -0.119317, -0.124393, -0.086408},
-    {-0.127609, -0.134415, -0.073592, -0.116103},
-    {-0.113027, -0.091756, -0.107786, -0.131935},
-    {-0.125530, -0.182152, -0.093796, -0.045088},
-    {-0.077122, -0.138052, -0.166271, -0.038886},
-    {-0.073027, -0.106845, -0.067073, -0.113910},
-    {-0.049146, -0.107019, -0.112531, -0.063388},
-    {-0.101539, -0.119586, -0.050297, -0.040670},
-    {-0.107784, -0.066913, -0.080993, -0.052352},
-    {-0.152155, -0.103010, -0.090461, -0.015526},
-    {-0.153087, -0.087656, -0.029889, -0.037367},
-    {-0.215281, -0.138062, -0.089162, -0.050839},
-    {-0.053350, -0.060169, -0.063459, -0.024499},
-    {-0.051674, -0.076355, -0.033733, -0.077211},
-    {-0.045047, -0.107006, -0.020880, -0.024525},
-    {-0.083003, -0.063672, -0.013243, -0.028324},
-    {-0.104104, -0.075450, -0.032746,  0.024480},
-    {-0.085695, -0.019502, -0.045121, -0.025016},
-    {-0.123120, -0.030844, -0.003533, -0.016224},
-    {-0.025568, -0.049172, -0.003911, -0.027522},
-    {-0.039029, -0.019857, -0.043211, -0.058087},
-    {-0.040122, -0.023067, -0.001356,  0.008607},
-    {-0.063351, -0.001776,  0.016015, -0.027088},
-    {-0.068110, -0.038838,  0.042525,  0.001076},
-    {-0.043623, -0.020736, -0.047862,  0.037710},
-    {-0.041052,  0.021954, -0.025660,  0.000758},
-    {-0.013035,  0.002583, -0.008233, -0.037300},
-    {-0.005523, -0.014670,  0.019651, -0.012667},
-    {-0.004409, -0.014437, -0.059412, -0.019701},
-    { 0.024946, -0.011663, -0.014351, -0.028762},
-    { 0.012660,  0.018489, -0.010205,  0.012695},
-    {-0.004423,  0.017827,  0.040544,  0.003629},
-    { 0.020684,  0.026743,  0.007752, -0.025595},
-    { 0.032071,  0.000043,  0.026188, -0.006444},
-    { 0.058793,  0.015820, -0.001119, -0.017415},
-    { 0.020156, -0.047590,  0.004227,  0.008670},
-    { 0.054770,  0.032135,  0.029770, -0.009767},
-    { 0.030884,  0.047757,  0.033068,  0.006866},
-    { 0.062039,  0.011646,  0.056037,  0.016859},
-    { 0.013798, -0.028196,  0.060710,  0.014299},
-    { 0.100043,  0.041445,  0.023379, -0.014889},
-    { 0.062728, -0.042821,  0.002180, -0.055380},
-    { 0.061663,  0.018767, -0.015571, -0.074095},
-    { 0.062980,  0.080497,  0.011808, -0.031787},
-    { 0.084964,  0.043100, -0.025877,  0.020309},
-    { 0.014707,  0.035421, -0.041440, -0.053373},
-    { 0.081268,  0.005791, -0.066290, -0.039825},
-    { 0.017691, -0.020401, -0.040513, -0.083960},
-    { 0.120874,  0.055753, -0.025988, -0.059552},
-    { 0.079912,  0.007894, -0.085380, -0.114587},
-    { 0.036856, -0.039331, -0.104237, -0.069116},
-    { 0.008526, -0.064273, -0.048312, -0.038595},
-    { 0.033461, -0.028956, -0.066505,  0.038722},
-    {-0.042064, -0.043989, -0.100653, -0.071550},
-    {-0.015342, -0.064850, -0.065675, -0.122769},
-    {-0.006581, -0.004919, -0.113564, -0.145753},
-    { 0.008273, -0.070702, -0.164998, -0.095541},
-    {-0.001698, -0.063744, -0.129971, -0.011162},
-    {-0.048471, -0.087500, -0.111006, -0.161823},
-    {-0.032193, -0.091955, -0.080642,  0.012288},
-    {-0.095873, -0.015986, -0.072722, -0.101745},
-    {-0.079477, -0.082060, -0.203008, -0.100297},
-    {-0.023883, -0.064022, -0.168341, -0.211739},
-    {-0.070530, -0.103547, -0.123858,  0.055049},
-    {-0.033503, -0.076812, -0.016287,  0.044159},
-    {-0.088427, -0.161682, -0.058579,  0.013873},
-    {-0.083068, -0.168222, -0.016773, -0.080209},
-    {-0.080548, -0.139090,  0.030544,  0.007171},
-    {-0.117482, -0.083718,  0.027074, -0.003674},
-    {-0.163085, -0.156856, -0.012618, -0.022329},
-    {-0.176540, -0.113042, -0.020148,  0.051770},
-    {-0.153891, -0.199293, -0.043244,  0.028331},
-    {-0.107822, -0.150615,  0.016430,  0.092919},
-    {-0.137676, -0.183224,  0.066026,  0.029343},
-    {-0.191106, -0.099250,  0.045370,  0.004084},
-    {-0.237042, -0.130815, -0.022543, -0.029428},
-    {-0.201014, -0.053591, -0.007305, -0.033547},
-    {-0.249286, -0.228408,  0.005002,  0.007146},
-    {-0.206509, -0.211998, -0.061352, -0.047233},
-    {-0.255702, -0.135114,  0.076375,  0.036630},
-    {-0.296271, -0.073946, -0.007273, -0.019601},
-    {-0.302917, -0.175111, -0.070024, -0.043905},
-    {-0.239275, -0.043962, -0.084982, -0.067446},
-    {-0.254583, -0.294720, -0.088762, -0.070451},
-    {-0.205583, -0.238996, -0.124753,  0.033076},
-    {-0.205583, -0.215882, -0.028472,  0.118679},
-    {-0.153640, -0.204464, -0.039654, -0.134441},
-    {-0.145929, -0.191970, -0.175308,  0.021366},
-    {-0.149348, -0.212569, -0.118324,  0.103812},
-    {-0.166397, -0.220581, -0.265260, -0.029113},
-    {-0.164171, -0.231262, -0.258828,  0.061427},
-    {-0.200198, -0.263453, -0.212016,  0.115359},
-    {-0.130088, -0.212168, -0.202368,  0.118563},
-    {-0.206387, -0.078075, -0.227856, -0.111165},
-    {-0.129605, -0.176848, -0.241584, -0.259900},
-    {-0.176826, -0.045901, -0.141712, -0.209345},
-    {-0.351173, -0.031097, -0.133935, -0.182412},
-    {-0.164232,  0.027006, -0.014039, -0.053567},
-    {-0.171037, -0.025924,  0.030972,  0.017329},
-    {-0.080862, -0.021577,  0.007652,  0.063968},
-    {-0.061788,  0.042024, -0.018783, -0.057979},
-    {-0.110311,  0.054760,  0.031446, -0.006710},
-    {-0.136637,  0.022171,  0.084991,  0.028039},
-    {-0.254471, -0.004376,  0.078034,  0.033649},
-    {-0.234464,  0.088157,  0.040999,  0.002639},
-    {-0.037095,  0.059443,  0.072180,  0.015027},
-    {-0.046841, -0.004813,  0.088266,  0.038786},
-    {-0.086782,  0.120100,  0.082655,  0.020271},
-    {-0.118361, -0.069242,  0.094867,  0.039200},
-    {-0.023342, -0.084303,  0.052684,  0.017093},
-    {-0.014194,  0.001012,  0.011946,  0.074125},
-    {-0.015342,  0.076396,  0.022365, -0.028001},
-    { 0.027706,  0.037047,  0.107573,  0.060815},
-    { 0.030615,  0.040664,  0.010467,  0.074289},
-    { 0.038646,  0.115584,  0.069627,  0.007642},
-    { 0.096463,  0.069818,  0.062494,  0.015413},
-    { 0.054834,  0.065232,  0.054286,  0.110088},
-    { 0.152312,  0.092371,  0.026420, -0.013184},
-    { 0.144264,  0.123438,  0.080131,  0.023233},
-    { 0.124405,  0.009943, -0.148477, -0.205184}
-};
-
-static const float *lsf_codebooks_16k[] = {
-    lsf_cb1_16k[0], lsf_cb2_16k[0], lsf_cb3_16k[0], lsf_cb4_16k[0],
-    lsf_cb5_16k[0]
-};
-
-#endif /* AVCODEC_SIPR16KDATA_H */
diff --git a/libavcodec/siprdata.h b/libavcodec/siprdata.h
deleted file mode 100644
index ed804ee..0000000
--- a/libavcodec/siprdata.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * SIPR / ACELP.NET decoder
- *
- * Copyright (c) 2008 Vladimir Voroshilov
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SIPRDATA_H
-#define AVCODEC_SIPRDATA_H
-
-static const float mean_lsf[10] = {
-    0.297151,  0.452308,  0.765443,  1.134803,  1.421125,
-    1.773822,  2.049173,  2.375914,  2.585097,  0.075756
-};
-
-static const float lsf_cb1[64][2] = {
-    { 0.007587, -0.005843}, { 0.042163, -0.028048}, {-0.017147, -0.060705},
-    { 0.013773, -0.038108}, {-0.041563, -0.078571}, {-0.076928, -0.119343},
-    { 0.012654,  0.176005}, { 0.059737,  0.156869}, { 0.171767,  0.231837},
-    { 0.114030,  0.242047}, { 0.168977,  0.283101}, { 0.146210,  0.397961},
-    { 0.249446,  0.268421}, { 0.137074,  0.186724}, {-0.057736, -0.135638},
-    {-0.109664, -0.124611}, {-0.021234, -0.031174}, {-0.013990, -0.091819},
-    {-0.040046, -0.111426}, {-0.016830,  0.055361}, { 0.057815,  0.071606},
-    { 0.060670,  0.114436}, { 0.106695,  0.140838}, { 0.093601,  0.092793},
-    { 0.039593,  0.006142}, {-0.066589, -0.092463}, {-0.102589, -0.171380},
-    {-0.059621, -0.050671}, { 0.166131,  0.139773}, { 0.213069,  0.190761},
-    { 0.061820,  0.037661}, { 0.136471,  0.090823}, {-0.019789,  0.013515},
-    { 0.022280,  0.079473}, { 0.215281,  0.461959}, { 0.206497,  0.340077},
-    { 0.012249, -0.065596}, { 0.091345,  0.190871}, { 0.019506,  0.037266},
-    {-0.050702, -0.013223}, {-0.057334,  0.028943}, { 0.291512,  0.371415},
-    {-0.053467,  0.084160}, { 0.025372,  0.375310}, { 0.269995,  0.566520},
-    {-0.095259, -0.012353}, { 0.050479,  0.212893}, { 0.101219,  0.049320},
-    { 0.072426,  0.283362}, {-0.084116, -0.150542}, {-0.031485,  0.144922},
-    { 0.012714,  0.256910}, {-0.009528,  0.102768}, {-0.039572,  0.204967},
-    {-0.098800,  0.055038}, { 0.020719,  0.128387}, {-0.045559, -0.178373},
-    {-0.082338,  0.136933}, {-0.058270,  0.292806}, { 0.084242,  0.505112},
-    { 0.121825,  0.326386}, {-0.102658, -0.069341}, { 0.071675,  0.004744},
-    {-0.117763, -0.202608}
-};
-
-static const float lsf_cb2[128][2] = {
-    { 0.025412,  0.006095}, {-0.069803,  0.010650}, {-0.175957, -0.185800},
-    {-0.139298, -0.048013}, {-0.156150, -0.129688}, {-0.160523,  0.068022},
-    { 0.199683,  0.259982}, { 0.258038,  0.236147}, { 0.367089,  0.304716},
-    { 0.251764,  0.305853}, { 0.394314,  0.382153}, { 0.448579,  0.337438},
-    { 0.323286,  0.425563}, { 0.015369,  0.123820}, {-0.026770,  0.083881},
-    {-0.112161, -0.097993}, {-0.221847, -0.161311}, {-0.050014, -0.092862},
-    {-0.214960, -0.398498}, {-0.114062, -0.241381}, { 0.137950,  0.138852},
-    { 0.031529,  0.065719}, { 0.208734,  0.084760}, { 0.157862,  0.057535},
-    { 0.124750,  0.011922}, {-0.035227, -0.154397}, {-0.105523, -0.291427},
-    {-0.073488, -0.201948}, {-0.224184, -0.273290}, {-0.168019, -0.240297},
-    {-0.271591, -0.384682}, {-0.124784,  0.014253}, { 0.004210, -0.110418},
-    { 0.074270, -0.014272}, { 0.053058, -0.068672}, {-0.090098, -0.145019},
-    { 0.303214,  0.210323}, { 0.413443,  0.272002}, { 0.356904,  0.230646},
-    {-0.035186, -0.028579}, {-0.117558,  0.115105}, {-0.159225,  0.218385},
-    {-0.230178,  0.172901}, {-0.216148, -0.110195}, { 0.309444,  0.101508},
-    { 0.250489,  0.118338}, { 0.293324,  0.151205}, {-0.023634,  0.033084},
-    { 0.076708,  0.114024}, { 0.123119,  0.087704}, {-0.060265,  0.126543},
-    {-0.223766, -0.021903}, {-0.241987, -0.328089}, { 0.205598,  0.147925},
-    {-0.087010,  0.064601}, {-0.287892, -0.286099}, {-0.179451, -0.350781},
-    {-0.219572,  0.043816}, {-0.217263,  0.245550}, {-0.286743, -0.180981},
-    { 0.172659,  0.112620}, {-0.105422,  0.176856}, { 0.006176, -0.051491},
-    { 0.099802,  0.176322}, {-0.186620, -0.068980}, { 0.164689,  0.185018},
-    { 0.519877,  0.376111}, { 0.521941,  0.533731}, { 0.473375,  0.439534},
-    { 0.214235,  0.202476}, { 0.579215,  0.466969}, { 0.310414,  0.271057},
-    { 0.257450,  0.058939}, { 0.023936, -0.169464}, {-0.268817, -0.064531},
-    {-0.174182, -0.000198}, {-0.268405, -0.234529}, {-0.296522,  0.247140},
-    { 0.115950, -0.072194}, {-0.303666,  0.149084}, {-0.347762, -0.011002},
-    {-0.223829, -0.214137}, {-0.278958, -0.457975}, { 0.135500,  0.238466},
-    { 0.312730,  0.342760}, { 0.071754, -0.125912}, { 0.485938,  0.260429},
-    { 0.037536,  0.179771}, { 0.391493,  0.156938}, { 0.397320,  0.484446},
-    {-0.308630, -0.342418}, {-0.269599, -0.128453}, {-0.086683, -0.043863},
-    { 0.421115,  0.213521}, { 0.082417,  0.049006}, {-0.087873,  0.238126},
-    { 0.338899,  0.166131}, {-0.166988,  0.147105}, {-0.167214, -0.294075},
-    { 0.588706,  0.328303}, { 0.207270,  0.017671}, {-0.141658,  0.291147},
-    {-0.140850,  0.374321}, { 0.028180,  0.322510}, {-0.229858,  0.328036},
-    {-0.060743, -0.260916}, {-0.011131,  0.246442}, {-0.058151,  0.310760},
-    {-0.127536, -0.186432}, {-0.128523, -0.334884}, {-0.283899,  0.077729},
-    {-0.031595,  0.181015}, {-0.329330, -0.108630}, {-0.215739,  0.107458},
-    { 0.175734,  0.327134}, { 0.255801,  0.176077}, { 0.228265,  0.396859},
-    {-0.370909, -0.185081}, {-0.355138, -0.300405}, { 0.061669,  0.242616},
-    { 0.104489,  0.307995}, {-0.320021, -0.234002}, { 0.077349,  0.416286},
-    {-0.339471, -0.407609}, {-0.019384, -0.215111}, { 0.168229, -0.032453},
-    {-0.040140,  0.399658}, {-0.275141,  0.008218}
-};
-
-static const float lsf_cb3[128][2] = {
-    { 0.024608,  0.006198}, {-0.216616, -0.398169}, {-0.089601, -0.201370},
-    {-0.121878, -0.305281}, { 0.037913,  0.059320}, { 0.245126,  0.244089},
-    { 0.266853,  0.182476}, { 0.319362,  0.203481}, { 0.349945,  0.252644},
-    { 0.393849,  0.279272}, { 0.445707,  0.258063}, { 0.387321,  0.200855},
-    {-0.038818,  0.129603}, {-0.009510,  0.076441}, {-0.023892, -0.028199},
-    {-0.117134, -0.145990}, {-0.186585, -0.052886}, {-0.034250, -0.084547},
-    {-0.087443, -0.095426}, {-0.453322, -0.174493}, {-0.363975, -0.148186},
-    {-0.334413, -0.202479}, {-0.221313, -0.181320}, {-0.131146, -0.050611},
-    {-0.104706,  0.115139}, { 0.192765,  0.275417}, { 0.014184,  0.194251},
-    { 0.154215,  0.226949}, { 0.084031,  0.221759}, { 0.189438,  0.164566},
-    { 0.130737,  0.170962}, {-0.066815,  0.062954}, {-0.177176, -0.145167},
-    {-0.247608, -0.129767}, {-0.187886, -0.293720}, {-0.244036, -0.344655},
-    {-0.203063, -0.234947}, {-0.292715, -0.158421}, { 0.064990, -0.028164},
-    { 0.147664,  0.085995}, { 0.107977,  0.002253}, { 0.071286,  0.027533},
-    { 0.021017, -0.049807}, {-0.272056, -0.217857}, {-0.065596,  0.008375},
-    {-0.150818, -0.195514}, {-0.012767, -0.150787}, { 0.238541,  0.136606},
-    { 0.291741,  0.114024}, { 0.202677,  0.103701}, { 0.140985,  0.037759},
-    {-0.257347, -0.442383}, {-0.320666, -0.319742}, {-0.488725, -0.603660},
-    {-0.319170, -0.469806}, { 0.014970, -0.101074}, { 0.102209,  0.066790},
-    {-0.076202, -0.044884}, { 0.073868,  0.152565}, { 0.070755, -0.091358},
-    {-0.016751,  0.027216}, { 0.071201,  0.096981}, {-0.060975, -0.145638},
-    { 0.114156,  0.117587}, {-0.284757, -0.029101}, {-0.253005, -0.073645},
-    {-0.204028, -0.098492}, {-0.114508,  0.001219}, {-0.225284, -0.011998},
-    {-0.235670,  0.084330}, { 0.161921,  0.128334}, { 0.025717,  0.119456},
-    {-0.255292, -0.281471}, {-0.392803, -0.095809}, { 0.039229, -0.152110},
-    {-0.310905, -0.099233}, {-0.268773,  0.032308}, {-0.340150,  0.013129},
-    {-0.344890, -0.045157}, {-0.188423,  0.265603}, {-0.168235, -0.000936},
-    { 0.000462,  0.297000}, { 0.263674,  0.371214}, {-0.146797, -0.098225},
-    {-0.386557, -0.282426}, {-0.070940, -0.255550}, { 0.293258,  0.252785},
-    { 0.408332,  0.387751}, {-0.381914, -0.358918}, {-0.463621, -0.315560},
-    {-0.323681, -0.258465}, { 0.250055,  0.071195}, {-0.405256, -0.429754},
-    {-0.135748, -0.251274}, { 0.186827,  0.060177}, { 0.116742, -0.053526},
-    {-0.403321, -0.220339}, {-0.414144, -0.021108}, {-0.416877,  0.050184},
-    {-0.470083, -0.079564}, {-0.315554,  0.219217}, {-0.273183,  0.138437},
-    { 0.253231,  0.306374}, { 0.177802,  0.346298}, { 0.210358,  0.207697},
-    {-0.323480,  0.077519}, {-0.193136,  0.048170}, { 0.114492,  0.292778},
-    {-0.130766,  0.056677}, {-0.171572, -0.349267}, {-0.370076, -0.536392},
-    {-0.311109, -0.389953}, { 0.334928,  0.367664}, { 0.351246,  0.438664},
-    { 0.518803,  0.331253}, { 0.437061,  0.327257}, { 0.318906,  0.307389},
-    {-0.025972, -0.206758}, { 0.373278,  0.325438}, { 0.473488,  0.389441},
-    { 0.478553,  0.477990}, { 0.332783,  0.153825}, { 0.212098,  0.452336},
-    { 0.161522, -0.011212}, { 0.209368,  0.020687}, {-0.086262,  0.204493},
-    {-0.388643,  0.133640}, {-0.177016,  0.134404}
-};
-
-static const float lsf_cb4[128][2] = {
-    {-0.003594, -0.022447}, { 0.070651,  0.028334}, {-0.290374, -0.018347},
-    {-0.224495, -0.370312}, {-0.269555, -0.131227}, {-0.122714, -0.267733},
-    { 0.173325,  0.138698}, { 0.161946,  0.020687}, { 0.111706,  0.022510},
-    { 0.097638,  0.056049}, { 0.139754,  0.059920}, { 0.056549, -0.050586},
-    { 0.036301,  0.021501}, {-0.066347,  0.012324}, {-0.066972,  0.096136},
-    {-0.120062, -0.084201}, { 0.011225,  0.047425}, {-0.012846, -0.067390},
-    {-0.116201,  0.122874}, {-0.027819,  0.035453}, {-0.024743,  0.072835},
-    {-0.034061, -0.001310}, { 0.077469,  0.081609}, { 0.128347,  0.139584},
-    { 0.183416,  0.086563}, {-0.155839, -0.053775}, {-0.190403, -0.018639},
-    {-0.202548, -0.062841}, {-0.373733, -0.275094}, {-0.394260, -0.186513},
-    {-0.465700, -0.220031}, { 0.064400, -0.095825}, {-0.262053, -0.199837},
-    {-0.167233, -0.094402}, { 0.048600,  0.057567}, {-0.007122,  0.168506},
-    { 0.050938,  0.156451}, {-0.060828,  0.147083}, {-0.171889,  0.195822},
-    {-0.218934,  0.138431}, {-0.270532,  0.195775}, {-0.405818,  0.075643},
-    {-0.440187,  0.193387}, {-0.484968,  0.157607}, {-0.480560,  0.067230},
-    {-0.436757, -0.111847}, {-0.040731, -0.040363}, {-0.202319, -0.170457},
-    {-0.158515, -0.134551}, {-0.356709, -0.378549}, {-0.268820, -0.289831},
-    {-0.188486, -0.289306}, {-0.148139, -0.177616}, {-0.071591, -0.191128},
-    {-0.052270, -0.150589}, {-0.020543, -0.116220}, { 0.039584, -0.012592},
-    {-0.268226,  0.042704}, {-0.209755,  0.069423}, {-0.168964,  0.124504},
-    {-0.363240,  0.188266}, {-0.524935, -0.025010}, {-0.105894, -0.002699},
-    {-0.251830, -0.062018}, {-0.310480, -0.082325}, { 0.014652,  0.083127},
-    {-0.136512,  0.033116}, {-0.073755, -0.025236}, { 0.110766,  0.095954},
-    { 0.002878,  0.011838}, {-0.074977, -0.244586}, {-0.047023, -0.081339},
-    {-0.183249,  0.029525}, { 0.263435,  0.206934}, {-0.156721, -0.229993},
-    {-0.112224, -0.208941}, {-0.116534, -0.123191}, {-0.073988, -0.111668},
-    { 0.029484, -0.137573}, {-0.009802, -0.161685}, {-0.023273,  0.114043},
-    {-0.332651,  0.049072}, {-0.394009,  0.018608}, {-0.433543, -0.035318},
-    {-0.368459, -0.108024}, {-0.350215, -0.037617}, {-0.321140, -0.178537},
-    { 0.020307, -0.048487}, {-0.210512, -0.232274}, {-0.082140, -0.065443},
-    { 0.081961, -0.009340}, { 0.146794,  0.101973}, { 0.213999,  0.124687},
-    { 0.100217, -0.054095}, {-0.114411, -0.041403}, {-0.097631,  0.037061},
-    {-0.099651, -0.157978}, {-0.215790, -0.116550}, {-0.107100,  0.076300},
-    { 0.084653,  0.126088}, { 0.246439,  0.091442}, { 0.160077,  0.188536},
-    { 0.273900,  0.279190}, { 0.320417,  0.232550}, { 0.132710, -0.018988},
-    { 0.018950, -0.091681}, {-0.032073, -0.202906}, { 0.212789,  0.178188},
-    { 0.208580,  0.239726}, { 0.049420,  0.099840}, {-0.145695, -0.010619},
-    {-0.132525, -0.322660}, { 0.019666,  0.126603}, { 0.260809,  0.147727},
-    {-0.232795, -0.001090}, {-0.049826,  0.225987}, {-0.154774,  0.076614},
-    { 0.045032,  0.221397}, { 0.321014,  0.161632}, {-0.062379,  0.053586},
-    { 0.132252,  0.246675}, { 0.392627,  0.271905}, {-0.264585,  0.102344},
-    {-0.327200,  0.121624}, {-0.399642,  0.124445}, {-0.108335,  0.179171},
-    { 0.100374,  0.182731}, { 0.203852,  0.049505}
-};
-
-static const float lsf_cb5[32][2] = {
-    {-0.047705,  0.008002}, { 0.011332,  0.065028}, {-0.021796, -0.034777},
-    {-0.147394, -0.001241}, {-0.001577,  0.020599}, {-0.083827, -0.028975},
-    {-0.177707,  0.066046}, {-0.043241, -0.165144}, { 0.053322,  0.096519},
-    {-0.097688,  0.106484}, {-0.023392,  0.111234}, {-0.146747, -0.159360},
-    { 0.027241, -0.011806}, {-0.043156,  0.057667}, { 0.019516, -0.062116},
-    { 0.025990,  0.162533}, { 0.091888,  0.009720}, {-0.098511,  0.036414},
-    { 0.013722, -0.116512}, { 0.054833, -0.180975}, { 0.119497,  0.128774},
-    { 0.118378, -0.125997}, { 0.065882, -0.030932}, { 0.120581, -0.039964},
-    {-0.050561, -0.088577}, { 0.050134,  0.033194}, {-0.129654, -0.075112},
-    {-0.225334, -0.040234}, { 0.070629, -0.084455}, { 0.095508,  0.063548},
-    { 0.150514,  0.034366}, { 0.186092, -0.069272}
-};
-
-static const float *lsf_codebooks[] = {
-    lsf_cb1[0], lsf_cb2[0], lsf_cb3[0], lsf_cb4[0], lsf_cb5[0]
-};
-
-static const float gain_cb[128][2] = {
-    {0.035230, 0.161540}, {0.049223, 0.448359}, {0.057443, 0.809043},
-    {0.072434, 1.760306}, {0.111491, 0.566418}, {0.112820, 1.098524},
-    {0.143493, 0.726856}, {0.144840, 0.347800}, {0.180341, 1.050010},
-    {0.188171, 2.197256}, {0.189771, 0.256947}, {0.198260, 0.484678},
-    {0.210622, 0.755825}, {0.220694, 0.590788}, {0.237062, 1.322214},
-    {0.255175, 0.338710}, {0.298980, 0.919051}, {0.314627, 0.520961},
-    {0.337106, 1.469863}, {0.341422, 2.804546}, {0.363257, 0.736222},
-    {0.363881, 0.367640}, {0.369850, 1.937934}, {0.370136, 1.075201},
-    {0.397152, 0.549410}, {0.426557, 0.876015}, {0.450686, 0.215588},
-    {0.468116, 0.671848}, {0.470495, 1.242034}, {0.474180, 1.739845},
-    {0.484875, 0.490564}, {0.498917, 0.971238}, {0.530996, 0.785765},
-    {0.539768, 2.130689}, {0.546021, 0.589544}, {0.546632, 3.050846},
-    {0.552336, 0.389775}, {0.556302, 1.400103}, {0.559688, 1.105421},
-    {0.574140, 0.667513}, {0.595547, 0.828943}, {0.597771, 0.496929},
-    {0.617079, 1.863075}, {0.619657, 1.221713}, {0.621172, 0.950275},
-    {0.628426, 0.630766}, {0.628689, 4.242164}, {0.640899, 1.529846},
-    {0.645813, 0.331127}, {0.653056, 0.748168}, {0.662909, 1.077438},
-    {0.669505, 2.631114}, {0.681570, 1.839298}, {0.687844, 0.903400},
-    {0.688660, 1.270830}, {0.695070, 0.578227}, {0.697926, 0.428440},
-    {0.715454, 0.812355}, {0.729981, 1.539357}, {0.737434, 1.106765},
-    {0.740241, 2.033374}, {0.740871, 0.568460}, {0.752689, 0.698461},
-    {0.756587, 0.893078}, {0.767797, 0.499246}, {0.768516, 3.712434},
-    {0.773153, 1.332360}, {0.786125, 1.042996}, {0.788792, 0.238388},
-    {0.790861, 2.273229}, {0.795338, 1.582767}, {0.809621, 0.595501},
-    {0.821032, 0.756460}, {0.824590, 0.922925}, {0.826019, 1.186793},
-    {0.827426, 1.885076}, {0.830080, 6.088666}, {0.837028, 2.819993},
-    {0.845561, 1.490623}, {0.848323, 0.410436}, {0.856522, 0.729725},
-    {0.862636, 0.966880}, {0.874561, 1.681660}, {0.874751, 1.177630},
-    {0.879289, 2.301300}, {0.886671, 0.613068}, {0.896729, 0.781097},
-    {0.904777, 3.484111}, {0.906098, 1.330892}, {0.919182, 1.877203},
-    {0.919901, 0.569511}, {0.921772, 1.034126}, {0.922439, 0.376000},
-    {0.934221, 1.485214}, {0.938842, 0.869135}, {0.939166, 2.378294},
-    {0.958933, 1.122722}, {0.959042, 0.694098}, {0.960995, 1.743430},
-    {0.970763, 2.884897}, {0.982881, 0.814506}, {0.990141, 1.330022},
-    {0.996447, 1.823381}, {1.000013, 0.967498}, {1.000743, 0.480597},
-    {1.008020, 5.095226}, {1.013883, 2.105435}, {1.026438, 0.691312},
-    {1.027361, 1.558169}, {1.030123, 3.586526}, {1.033916, 1.118036},
-    {1.039315, 2.543360}, {1.068596, 0.836380}, {1.081023, 1.318768},
-    {1.093150, 2.267843}, {1.095607, 1.712383}, {1.102816, 1.037334},
-    {1.103231, 3.536292}, {1.107320, 0.508615}, {1.150000, 7.999000},
-    {1.156731, 1.236772}, {1.168428, 2.268084}, {1.184130, 0.775839},
-    {1.210609, 1.511840}, {1.220663, 4.365683}, {1.224016, 0.983179},
-    {1.252236, 2.778535}, {1.301176, 1.923126}
-};
-
-static const float pred[4] = {
-    0.200, 0.334, 0.504, 0.691
-};
-
-#endif /* AVCODEC_SIPRDATA_H */
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
deleted file mode 100644
index 1d85f68..0000000
--- a/libavcodec/smacker.c
+++ /dev/null
@@ -1,716 +0,0 @@
-/*
- * Smacker decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Smacker decoder
- */
-
-/*
- * Based on http://wiki.multimedia.cx/index.php?title=Smacker
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-#include "bytestream.h"
-
-#define SMKTREE_BITS 9
-#define SMK_NODE 0x80000000
-
-/*
- * Decoder context
- */
-typedef struct SmackVContext {
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    int *mmap_tbl, *mclr_tbl, *full_tbl, *type_tbl;
-    int mmap_last[3], mclr_last[3], full_last[3], type_last[3];
-} SmackVContext;
-
-/**
- * Context used for code reconstructing
- */
-typedef struct HuffContext {
-    int length;
-    int maxlength;
-    int current;
-    uint32_t *bits;
-    int *lengths;
-    int *values;
-} HuffContext;
-
-/* common parameters used for decode_bigtree */
-typedef struct DBCtx {
-    VLC *v1, *v2;
-    int *recode1, *recode2;
-    int escapes[3];
-    int *last;
-    int lcur;
-} DBCtx;
-
-/* possible runs of blocks */
-static const int block_runs[64] = {
-      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,
-     57,   58,   59,  128,  256,  512, 1024, 2048 };
-
-enum SmkBlockTypes {
-    SMK_BLK_MONO = 0,
-    SMK_BLK_FULL = 1,
-    SMK_BLK_SKIP = 2,
-    SMK_BLK_FILL = 3 };
-
-/**
- * Decode local frame tree
- */
-static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length)
-{
-    if(!get_bits1(gb)){ //Leaf
-        if(hc->current >= 256){
-            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
-            return -1;
-        }
-        if(length){
-            hc->bits[hc->current] = prefix;
-            hc->lengths[hc->current] = length;
-        } else {
-            hc->bits[hc->current] = 0;
-            hc->lengths[hc->current] = 0;
-        }
-        hc->values[hc->current] = get_bits(gb, 8);
-        hc->current++;
-        if(hc->maxlength < length)
-            hc->maxlength = length;
-        return 0;
-    } else { //Node
-        int r;
-        length++;
-        r = smacker_decode_tree(gb, hc, prefix, length);
-        if(r)
-            return r;
-        return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length);
-    }
-}
-
-/**
- * Decode header tree
- */
-static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx)
-{
-    if(!get_bits1(gb)){ //Leaf
-        int val, i1, i2, b1, b2;
-        if(hc->current >= hc->length){
-            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
-            return -1;
-        }
-        b1 = get_bits_count(gb);
-        i1 = get_vlc2(gb, ctx->v1->table, SMKTREE_BITS, 3);
-        b1 = get_bits_count(gb) - b1;
-        b2 = get_bits_count(gb);
-        i2 = get_vlc2(gb, ctx->v2->table, SMKTREE_BITS, 3);
-        b2 = get_bits_count(gb) - b2;
-        val = ctx->recode1[i1] | (ctx->recode2[i2] << 8);
-        if(val == ctx->escapes[0]) {
-            ctx->last[0] = hc->current;
-            val = 0;
-        } else if(val == ctx->escapes[1]) {
-            ctx->last[1] = hc->current;
-            val = 0;
-        } else if(val == ctx->escapes[2]) {
-            ctx->last[2] = hc->current;
-            val = 0;
-        }
-
-        hc->values[hc->current++] = val;
-        return 1;
-    } else { //Node
-        int r = 0, t;
-
-        t = hc->current++;
-        r = smacker_decode_bigtree(gb, hc, ctx);
-        if(r < 0)
-            return r;
-        hc->values[t] = SMK_NODE | r;
-        r++;
-        r += smacker_decode_bigtree(gb, hc, ctx);
-        return r;
-    }
-}
-
-/**
- * Store large tree as FFmpeg's vlc codes
- */
-static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int **recodes, int *last, int size)
-{
-    int res;
-    HuffContext huff;
-    HuffContext tmp1, tmp2;
-    VLC vlc[2];
-    int escapes[3];
-    DBCtx ctx;
-
-    if(size >= UINT_MAX>>4){ // (((size + 3) >> 2) + 3) << 2 must not overflow
-        av_log(smk->avctx, AV_LOG_ERROR, "size too large\n");
-        return -1;
-    }
-
-    tmp1.length = 256;
-    tmp1.maxlength = 0;
-    tmp1.current = 0;
-    tmp1.bits = av_mallocz(256 * 4);
-    tmp1.lengths = av_mallocz(256 * sizeof(int));
-    tmp1.values = av_mallocz(256 * sizeof(int));
-
-    tmp2.length = 256;
-    tmp2.maxlength = 0;
-    tmp2.current = 0;
-    tmp2.bits = av_mallocz(256 * 4);
-    tmp2.lengths = av_mallocz(256 * sizeof(int));
-    tmp2.values = av_mallocz(256 * sizeof(int));
-
-    memset(&vlc[0], 0, sizeof(VLC));
-    memset(&vlc[1], 0, sizeof(VLC));
-
-    if(get_bits1(gb)) {
-        smacker_decode_tree(gb, &tmp1, 0, 0);
-        skip_bits1(gb);
-        res = init_vlc(&vlc[0], SMKTREE_BITS, tmp1.length,
-                    tmp1.lengths, sizeof(int), sizeof(int),
-                    tmp1.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
-        if(res < 0) {
-            av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
-            return -1;
-        }
-    } else {
-        av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n");
-    }
-    if(get_bits1(gb)){
-        smacker_decode_tree(gb, &tmp2, 0, 0);
-        skip_bits1(gb);
-        res = init_vlc(&vlc[1], SMKTREE_BITS, tmp2.length,
-                    tmp2.lengths, sizeof(int), sizeof(int),
-                    tmp2.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
-        if(res < 0) {
-            av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
-            return -1;
-        }
-    } else {
-        av_log(smk->avctx, AV_LOG_ERROR, "Skipping high bytes tree\n");
-    }
-
-    escapes[0]  = get_bits(gb, 8);
-    escapes[0] |= get_bits(gb, 8) << 8;
-    escapes[1]  = get_bits(gb, 8);
-    escapes[1] |= get_bits(gb, 8) << 8;
-    escapes[2]  = get_bits(gb, 8);
-    escapes[2] |= get_bits(gb, 8) << 8;
-
-    last[0] = last[1] = last[2] = -1;
-
-    ctx.escapes[0] = escapes[0];
-    ctx.escapes[1] = escapes[1];
-    ctx.escapes[2] = escapes[2];
-    ctx.v1 = &vlc[0];
-    ctx.v2 = &vlc[1];
-    ctx.recode1 = tmp1.values;
-    ctx.recode2 = tmp2.values;
-    ctx.last = last;
-
-    huff.length = ((size + 3) >> 2) + 3;
-    huff.maxlength = 0;
-    huff.current = 0;
-    huff.values = av_mallocz(huff.length * sizeof(int));
-
-    smacker_decode_bigtree(gb, &huff, &ctx);
-    skip_bits1(gb);
-    if(ctx.last[0] == -1) ctx.last[0] = huff.current++;
-    if(ctx.last[1] == -1) ctx.last[1] = huff.current++;
-    if(ctx.last[2] == -1) ctx.last[2] = huff.current++;
-
-    *recodes = huff.values;
-
-    if(vlc[0].table)
-        free_vlc(&vlc[0]);
-    if(vlc[1].table)
-        free_vlc(&vlc[1]);
-    av_free(tmp1.bits);
-    av_free(tmp1.lengths);
-    av_free(tmp1.values);
-    av_free(tmp2.bits);
-    av_free(tmp2.lengths);
-    av_free(tmp2.values);
-
-    return 0;
-}
-
-static int decode_header_trees(SmackVContext *smk) {
-    GetBitContext gb;
-    int mmap_size, mclr_size, full_size, type_size;
-
-    mmap_size = AV_RL32(smk->avctx->extradata);
-    mclr_size = AV_RL32(smk->avctx->extradata + 4);
-    full_size = AV_RL32(smk->avctx->extradata + 8);
-    type_size = AV_RL32(smk->avctx->extradata + 12);
-
-    init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
-
-    if(!get_bits1(&gb)) {
-        av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
-        smk->mmap_tbl = av_malloc(sizeof(int) * 2);
-        smk->mmap_tbl[0] = 0;
-        smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
-    } else {
-        smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size);
-    }
-    if(!get_bits1(&gb)) {
-        av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
-        smk->mclr_tbl = av_malloc(sizeof(int) * 2);
-        smk->mclr_tbl[0] = 0;
-        smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
-    } else {
-        smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size);
-    }
-    if(!get_bits1(&gb)) {
-        av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
-        smk->full_tbl = av_malloc(sizeof(int) * 2);
-        smk->full_tbl[0] = 0;
-        smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
-    } else {
-        smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size);
-    }
-    if(!get_bits1(&gb)) {
-        av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
-        smk->type_tbl = av_malloc(sizeof(int) * 2);
-        smk->type_tbl[0] = 0;
-        smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;
-    } else {
-        smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size);
-    }
-
-    return 0;
-}
-
-static av_always_inline void last_reset(int *recode, int *last) {
-    recode[last[0]] = recode[last[1]] = recode[last[2]] = 0;
-}
-
-/* get code and update history */
-static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *last) {
-    register int *table = recode;
-    int v, b;
-
-    b = get_bits_count(gb);
-    while(*table & SMK_NODE) {
-        if(get_bits1(gb))
-            table += (*table) & (~SMK_NODE);
-        table++;
-    }
-    v = *table;
-    b = get_bits_count(gb) - b;
-
-    if(v != recode[last[0]]) {
-        recode[last[2]] = recode[last[1]];
-        recode[last[1]] = recode[last[0]];
-        recode[last[0]] = v;
-    }
-    return v;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    SmackVContext * const smk = avctx->priv_data;
-    uint8_t *out;
-    uint32_t *pal;
-    GetBitContext gb;
-    int blocks, blk, bw, bh;
-    int i;
-    int stride;
-
-    if(buf_size <= 769)
-        return 0;
-    if(smk->pic.data[0])
-            avctx->release_buffer(avctx, &smk->pic);
-
-    smk->pic.reference = 1;
-    smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if(avctx->reget_buffer(avctx, &smk->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    /* make the palette available on the way out */
-    pal = (uint32_t*)smk->pic.data[1];
-    smk->pic.palette_has_changed = buf[0] & 1;
-    smk->pic.key_frame = !!(buf[0] & 2);
-    if(smk->pic.key_frame)
-        smk->pic.pict_type = FF_I_TYPE;
-    else
-        smk->pic.pict_type = FF_P_TYPE;
-
-    buf++;
-    for(i = 0; i < 256; i++)
-        *pal++ = bytestream_get_be24(&buf);
-    buf_size -= 769;
-
-    last_reset(smk->mmap_tbl, smk->mmap_last);
-    last_reset(smk->mclr_tbl, smk->mclr_last);
-    last_reset(smk->full_tbl, smk->full_last);
-    last_reset(smk->type_tbl, smk->type_last);
-    init_get_bits(&gb, buf, buf_size * 8);
-
-    blk = 0;
-    bw = avctx->width >> 2;
-    bh = avctx->height >> 2;
-    blocks = bw * bh;
-    out = smk->pic.data[0];
-    stride = smk->pic.linesize[0];
-    while(blk < blocks) {
-        int type, run, mode;
-        uint16_t pix;
-
-        type = smk_get_code(&gb, smk->type_tbl, smk->type_last);
-        run = block_runs[(type >> 2) & 0x3F];
-        switch(type & 3){
-        case SMK_BLK_MONO:
-            while(run-- && blk < blocks){
-                int clr, map;
-                int hi, lo;
-                clr = smk_get_code(&gb, smk->mclr_tbl, smk->mclr_last);
-                map = smk_get_code(&gb, smk->mmap_tbl, smk->mmap_last);
-                out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
-                hi = clr >> 8;
-                lo = clr & 0xFF;
-                for(i = 0; i < 4; i++) {
-                    if(map & 1) out[0] = hi; else out[0] = lo;
-                    if(map & 2) out[1] = hi; else out[1] = lo;
-                    if(map & 4) out[2] = hi; else out[2] = lo;
-                    if(map & 8) out[3] = hi; else out[3] = lo;
-                    map >>= 4;
-                    out += stride;
-                }
-                blk++;
-            }
-            break;
-        case SMK_BLK_FULL:
-            mode = 0;
-            if(avctx->codec_tag == MKTAG('S', 'M', 'K', '4')) { // In case of Smacker v4 we have three modes
-                if(get_bits1(&gb)) mode = 1;
-                else if(get_bits1(&gb)) mode = 2;
-            }
-            while(run-- && blk < blocks){
-                out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
-                switch(mode){
-                case 0:
-                    for(i = 0; i < 4; i++) {
-                        pix = smk_get_code(&gb, smk->full_tbl, smk->full_last);
-                        AV_WL16(out+2,pix);
-                        pix = smk_get_code(&gb, smk->full_tbl, smk->full_last);
-                        AV_WL16(out,pix);
-                        out += stride;
-                    }
-                    break;
-                case 1:
-                    pix = smk_get_code(&gb, smk->full_tbl, smk->full_last);
-                    out[0] = out[1] = pix & 0xFF;
-                    out[2] = out[3] = pix >> 8;
-                    out += stride;
-                    out[0] = out[1] = pix & 0xFF;
-                    out[2] = out[3] = pix >> 8;
-                    out += stride;
-                    pix = smk_get_code(&gb, smk->full_tbl, smk->full_last);
-                    out[0] = out[1] = pix & 0xFF;
-                    out[2] = out[3] = pix >> 8;
-                    out += stride;
-                    out[0] = out[1] = pix & 0xFF;
-                    out[2] = out[3] = pix >> 8;
-                    out += stride;
-                    break;
-                case 2:
-                    for(i = 0; i < 2; i++) {
-                        uint16_t pix1, pix2;
-                        pix2 = smk_get_code(&gb, smk->full_tbl, smk->full_last);
-                        pix1 = smk_get_code(&gb, smk->full_tbl, smk->full_last);
-                        AV_WL16(out,pix1);
-                        AV_WL16(out+2,pix2);
-                        out += stride;
-                        AV_WL16(out,pix1);
-                        AV_WL16(out+2,pix2);
-                        out += stride;
-                    }
-                    break;
-                }
-                blk++;
-            }
-            break;
-        case SMK_BLK_SKIP:
-            while(run-- && blk < blocks)
-                blk++;
-            break;
-        case SMK_BLK_FILL:
-            mode = type >> 8;
-            while(run-- && blk < blocks){
-                uint32_t col;
-                out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4;
-                col = mode * 0x01010101;
-                for(i = 0; i < 4; i++) {
-                    *((uint32_t*)out) = col;
-                    out += stride;
-                }
-                blk++;
-            }
-            break;
-        }
-
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = smk->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-
-/*
- *
- * Init smacker decoder
- *
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    SmackVContext * const c = avctx->priv_data;
-
-    c->avctx = avctx;
-
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-
-    /* decode huffman trees from extradata */
-    if(avctx->extradata_size < 16){
-        av_log(avctx, AV_LOG_ERROR, "Extradata missing!\n");
-        return -1;
-    }
-
-    decode_header_trees(c);
-
-
-    return 0;
-}
-
-
-
-/*
- *
- * Uninit smacker decoder
- *
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    SmackVContext * const smk = avctx->priv_data;
-
-    av_freep(&smk->mmap_tbl);
-    av_freep(&smk->mclr_tbl);
-    av_freep(&smk->full_tbl);
-    av_freep(&smk->type_tbl);
-
-    if (smk->pic.data[0])
-        avctx->release_buffer(avctx, &smk->pic);
-
-    return 0;
-}
-
-
-static av_cold int smka_decode_init(AVCodecContext *avctx)
-{
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
-    avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? SAMPLE_FMT_U8 : SAMPLE_FMT_S16;
-    return 0;
-}
-
-/**
- * Decode Smacker audio data
- */
-static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    GetBitContext gb;
-    HuffContext h[4];
-    VLC vlc[4];
-    int16_t *samples = data;
-    int8_t *samples8 = data;
-    int val;
-    int i, res;
-    int unp_size;
-    int bits, stereo;
-    int pred[2] = {0, 0};
-
-    unp_size = AV_RL32(buf);
-
-    init_get_bits(&gb, buf + 4, (buf_size - 4) * 8);
-
-    if(!get_bits1(&gb)){
-        av_log(avctx, AV_LOG_INFO, "Sound: no data\n");
-        *data_size = 0;
-        return 1;
-    }
-    stereo = get_bits1(&gb);
-    bits = get_bits1(&gb);
-    if (unp_size & 0xC0000000 || unp_size > *data_size) {
-        av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
-        return -1;
-    }
-
-    memset(vlc, 0, sizeof(VLC) * 4);
-    memset(h, 0, sizeof(HuffContext) * 4);
-    // Initialize
-    for(i = 0; i < (1 << (bits + stereo)); i++) {
-        h[i].length = 256;
-        h[i].maxlength = 0;
-        h[i].current = 0;
-        h[i].bits = av_mallocz(256 * 4);
-        h[i].lengths = av_mallocz(256 * sizeof(int));
-        h[i].values = av_mallocz(256 * sizeof(int));
-        skip_bits1(&gb);
-        smacker_decode_tree(&gb, &h[i], 0, 0);
-        skip_bits1(&gb);
-        if(h[i].current > 1) {
-            res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length,
-                    h[i].lengths, sizeof(int), sizeof(int),
-                    h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
-            if(res < 0) {
-                av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
-                return -1;
-            }
-        }
-    }
-    if(bits) { //decode 16-bit data
-        for(i = stereo; i >= 0; i--)
-            pred[i] = bswap_16(get_bits(&gb, 16));
-        for(i = 0; i < stereo; i++)
-            *samples++ = pred[i];
-        for(i = 0; i < unp_size / 2; i++) {
-            if(i & stereo) {
-                if(vlc[2].table)
-                    res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3);
-                else
-                    res = 0;
-                val  = h[2].values[res];
-                if(vlc[3].table)
-                    res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3);
-                else
-                    res = 0;
-                val |= h[3].values[res] << 8;
-                pred[1] += (int16_t)val;
-                *samples++ = pred[1];
-            } else {
-                if(vlc[0].table)
-                    res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);
-                else
-                    res = 0;
-                val  = h[0].values[res];
-                if(vlc[1].table)
-                    res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);
-                else
-                    res = 0;
-                val |= h[1].values[res] << 8;
-                pred[0] += val;
-                *samples++ = pred[0];
-            }
-        }
-    } else { //8-bit data
-        for(i = stereo; i >= 0; i--)
-            pred[i] = get_bits(&gb, 8);
-        for(i = 0; i < stereo; i++)
-            *samples8++ = pred[i];
-        for(i = 0; i < unp_size; i++) {
-            if(i & stereo){
-                if(vlc[1].table)
-                    res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);
-                else
-                    res = 0;
-                pred[1] += (int8_t)h[1].values[res];
-                *samples8++ = pred[1];
-            } else {
-                if(vlc[0].table)
-                    res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);
-                else
-                    res = 0;
-                pred[0] += (int8_t)h[0].values[res];
-                *samples8++ = pred[0];
-            }
-        }
-    }
-
-    for(i = 0; i < 4; i++) {
-        if(vlc[i].table)
-            free_vlc(&vlc[i]);
-        if(h[i].bits)
-            av_free(h[i].bits);
-        if(h[i].lengths)
-            av_free(h[i].lengths);
-        if(h[i].values)
-            av_free(h[i].values);
-    }
-
-    *data_size = unp_size;
-    return buf_size;
-}
-
-AVCodec smacker_decoder = {
-    "smackvid",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SMACKVIDEO,
-    sizeof(SmackVContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Smacker video"),
-};
-
-AVCodec smackaud_decoder = {
-    "smackaud",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SMACKAUDIO,
-    0,
-    smka_decode_init,
-    NULL,
-    NULL,
-    smka_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"),
-};
-
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
deleted file mode 100644
index 2e2dffd..0000000
--- a/libavcodec/smc.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * Quicktime Graphics (SMC) Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QT SMC Video Decoder by Mike Melanson (melanson at pcisys.net)
- * For more information about the SMC format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *
- * The SMC decoder outputs PAL8 colorspace data.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#define CPAIR 2
-#define CQUAD 4
-#define COCTET 8
-
-#define COLORS_PER_TABLE 256
-
-typedef struct SmcContext {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *buf;
-    int size;
-
-    /* SMC color tables */
-    unsigned char color_pairs[COLORS_PER_TABLE * CPAIR];
-    unsigned char color_quads[COLORS_PER_TABLE * CQUAD];
-    unsigned char color_octets[COLORS_PER_TABLE * COCTET];
-
-} SmcContext;
-
-#define GET_BLOCK_COUNT() \
-  (opcode & 0x10) ? (1 + s->buf[stream_ptr++]) : 1 + (opcode & 0x0F);
-
-#define ADVANCE_BLOCK() \
-{ \
-    pixel_ptr += 4; \
-    if (pixel_ptr >= width) \
-    { \
-        pixel_ptr = 0; \
-        row_ptr += stride * 4; \
-    } \
-    total_blocks--; \
-    if (total_blocks < 0) \
-    { \
-        av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
-        return; \
-    } \
-}
-
-static void smc_decode_stream(SmcContext *s)
-{
-    int width = s->avctx->width;
-    int height = s->avctx->height;
-    int stride = s->frame.linesize[0];
-    int i;
-    int stream_ptr = 0;
-    int chunk_size;
-    unsigned char opcode;
-    int n_blocks;
-    unsigned int color_flags;
-    unsigned int color_flags_a;
-    unsigned int color_flags_b;
-    unsigned int flag_mask;
-
-    unsigned char *pixels = s->frame.data[0];
-
-    int image_size = height * s->frame.linesize[0];
-    int row_ptr = 0;
-    int pixel_ptr = 0;
-    int pixel_x, pixel_y;
-    int row_inc = stride - 4;
-    int block_ptr;
-    int prev_block_ptr;
-    int prev_block_ptr1, prev_block_ptr2;
-    int prev_block_flag;
-    int total_blocks;
-    int color_table_index;  /* indexes to color pair, quad, or octet tables */
-    int pixel;
-
-    int color_pair_index = 0;
-    int color_quad_index = 0;
-    int color_octet_index = 0;
-
-    /* make the palette available */
-    memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE);
-    if (s->avctx->palctrl->palette_changed) {
-        s->frame.palette_has_changed = 1;
-        s->avctx->palctrl->palette_changed = 0;
-    }
-
-    chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF;
-    stream_ptr += 4;
-    if (chunk_size != s->size)
-        av_log(s->avctx, AV_LOG_INFO, "warning: MOV chunk size != encoded chunk size (%d != %d); using MOV chunk size\n",
-            chunk_size, s->size);
-
-    chunk_size = s->size;
-    total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
-
-    /* traverse through the blocks */
-    while (total_blocks) {
-        /* sanity checks */
-        /* make sure stream ptr hasn't gone out of bounds */
-        if (stream_ptr > chunk_size) {
-            av_log(s->avctx, AV_LOG_INFO, "SMC decoder just went out of bounds (stream ptr = %d, chunk size = %d)\n",
-                stream_ptr, chunk_size);
-            return;
-        }
-        /* make sure the row pointer hasn't gone wild */
-        if (row_ptr >= image_size) {
-            av_log(s->avctx, AV_LOG_INFO, "SMC decoder just went out of bounds (row ptr = %d, height = %d)\n",
-                row_ptr, image_size);
-            return;
-        }
-
-        opcode = s->buf[stream_ptr++];
-        switch (opcode & 0xF0) {
-        /* skip n blocks */
-        case 0x00:
-        case 0x10:
-            n_blocks = GET_BLOCK_COUNT();
-            while (n_blocks--) {
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* repeat last block n times */
-        case 0x20:
-        case 0x30:
-            n_blocks = GET_BLOCK_COUNT();
-
-            /* sanity check */
-            if ((row_ptr == 0) && (pixel_ptr == 0)) {
-                av_log(s->avctx, AV_LOG_INFO, "encountered repeat block opcode (%02X) but no blocks rendered yet\n",
-                    opcode & 0xF0);
-                break;
-            }
-
-            /* figure out where the previous block started */
-            if (pixel_ptr == 0)
-                prev_block_ptr1 =
-                    (row_ptr - s->avctx->width * 4) + s->avctx->width - 4;
-            else
-                prev_block_ptr1 = row_ptr + pixel_ptr - 4;
-
-            while (n_blocks--) {
-                block_ptr = row_ptr + pixel_ptr;
-                prev_block_ptr = prev_block_ptr1;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++) {
-                        pixels[block_ptr++] = pixels[prev_block_ptr++];
-                    }
-                    block_ptr += row_inc;
-                    prev_block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* repeat previous pair of blocks n times */
-        case 0x40:
-        case 0x50:
-            n_blocks = GET_BLOCK_COUNT();
-            n_blocks *= 2;
-
-            /* sanity check */
-            if ((row_ptr == 0) && (pixel_ptr < 2 * 4)) {
-                av_log(s->avctx, AV_LOG_INFO, "encountered repeat block opcode (%02X) but not enough blocks rendered yet\n",
-                    opcode & 0xF0);
-                break;
-            }
-
-            /* figure out where the previous 2 blocks started */
-            if (pixel_ptr == 0)
-                prev_block_ptr1 = (row_ptr - s->avctx->width * 4) +
-                    s->avctx->width - 4 * 2;
-            else if (pixel_ptr == 4)
-                prev_block_ptr1 = (row_ptr - s->avctx->width * 4) + row_inc;
-            else
-                prev_block_ptr1 = row_ptr + pixel_ptr - 4 * 2;
-
-            if (pixel_ptr == 0)
-                prev_block_ptr2 = (row_ptr - s->avctx->width * 4) + row_inc;
-            else
-                prev_block_ptr2 = row_ptr + pixel_ptr - 4;
-
-            prev_block_flag = 0;
-            while (n_blocks--) {
-                block_ptr = row_ptr + pixel_ptr;
-                if (prev_block_flag)
-                    prev_block_ptr = prev_block_ptr2;
-                else
-                    prev_block_ptr = prev_block_ptr1;
-                prev_block_flag = !prev_block_flag;
-
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++) {
-                        pixels[block_ptr++] = pixels[prev_block_ptr++];
-                    }
-                    block_ptr += row_inc;
-                    prev_block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* 1-color block encoding */
-        case 0x60:
-        case 0x70:
-            n_blocks = GET_BLOCK_COUNT();
-            pixel = s->buf[stream_ptr++];
-
-            while (n_blocks--) {
-                block_ptr = row_ptr + pixel_ptr;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++) {
-                        pixels[block_ptr++] = pixel;
-                    }
-                    block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* 2-color block encoding */
-        case 0x80:
-        case 0x90:
-            n_blocks = (opcode & 0x0F) + 1;
-
-            /* figure out which color pair to use to paint the 2-color block */
-            if ((opcode & 0xF0) == 0x80) {
-                /* fetch the next 2 colors from bytestream and store in next
-                 * available entry in the color pair table */
-                for (i = 0; i < CPAIR; i++) {
-                    pixel = s->buf[stream_ptr++];
-                    color_table_index = CPAIR * color_pair_index + i;
-                    s->color_pairs[color_table_index] = pixel;
-                }
-                /* this is the base index to use for this block */
-                color_table_index = CPAIR * color_pair_index;
-                color_pair_index++;
-                /* wraparound */
-                if (color_pair_index == COLORS_PER_TABLE)
-                    color_pair_index = 0;
-            } else
-                color_table_index = CPAIR * s->buf[stream_ptr++];
-
-            while (n_blocks--) {
-                color_flags = AV_RB16(&s->buf[stream_ptr]);
-                stream_ptr += 2;
-                flag_mask = 0x8000;
-                block_ptr = row_ptr + pixel_ptr;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++) {
-                        if (color_flags & flag_mask)
-                            pixel = color_table_index + 1;
-                        else
-                            pixel = color_table_index;
-                        flag_mask >>= 1;
-                        pixels[block_ptr++] = s->color_pairs[pixel];
-                    }
-                    block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* 4-color block encoding */
-        case 0xA0:
-        case 0xB0:
-            n_blocks = (opcode & 0x0F) + 1;
-
-            /* figure out which color quad to use to paint the 4-color block */
-            if ((opcode & 0xF0) == 0xA0) {
-                /* fetch the next 4 colors from bytestream and store in next
-                 * available entry in the color quad table */
-                for (i = 0; i < CQUAD; i++) {
-                    pixel = s->buf[stream_ptr++];
-                    color_table_index = CQUAD * color_quad_index + i;
-                    s->color_quads[color_table_index] = pixel;
-                }
-                /* this is the base index to use for this block */
-                color_table_index = CQUAD * color_quad_index;
-                color_quad_index++;
-                /* wraparound */
-                if (color_quad_index == COLORS_PER_TABLE)
-                    color_quad_index = 0;
-            } else
-                color_table_index = CQUAD * s->buf[stream_ptr++];
-
-            while (n_blocks--) {
-                color_flags = AV_RB32(&s->buf[stream_ptr]);
-                stream_ptr += 4;
-                /* flag mask actually acts as a bit shift count here */
-                flag_mask = 30;
-                block_ptr = row_ptr + pixel_ptr;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++) {
-                        pixel = color_table_index +
-                            ((color_flags >> flag_mask) & 0x03);
-                        flag_mask -= 2;
-                        pixels[block_ptr++] = s->color_quads[pixel];
-                    }
-                    block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* 8-color block encoding */
-        case 0xC0:
-        case 0xD0:
-            n_blocks = (opcode & 0x0F) + 1;
-
-            /* figure out which color octet to use to paint the 8-color block */
-            if ((opcode & 0xF0) == 0xC0) {
-                /* fetch the next 8 colors from bytestream and store in next
-                 * available entry in the color octet table */
-                for (i = 0; i < COCTET; i++) {
-                    pixel = s->buf[stream_ptr++];
-                    color_table_index = COCTET * color_octet_index + i;
-                    s->color_octets[color_table_index] = pixel;
-                }
-                /* this is the base index to use for this block */
-                color_table_index = COCTET * color_octet_index;
-                color_octet_index++;
-                /* wraparound */
-                if (color_octet_index == COLORS_PER_TABLE)
-                    color_octet_index = 0;
-            } else
-                color_table_index = COCTET * s->buf[stream_ptr++];
-
-            while (n_blocks--) {
-                /*
-                  For this input of 6 hex bytes:
-                    01 23 45 67 89 AB
-                  Mangle it to this output:
-                    flags_a = xx012456, flags_b = xx89A37B
-                */
-                /* build the color flags */
-                color_flags_a =
-                    ((AV_RB16(s->buf + stream_ptr    ) & 0xFFF0) << 8) |
-                     (AV_RB16(s->buf + stream_ptr + 2) >> 4);
-                color_flags_b =
-                    ((AV_RB16(s->buf + stream_ptr + 4) & 0xFFF0) << 8) |
-                    ((s->buf[stream_ptr + 1] & 0x0F) << 8) |
-                    ((s->buf[stream_ptr + 3] & 0x0F) << 4) |
-                    (s->buf[stream_ptr + 5] & 0x0F);
-                stream_ptr += 6;
-
-                color_flags = color_flags_a;
-                /* flag mask actually acts as a bit shift count here */
-                flag_mask = 21;
-                block_ptr = row_ptr + pixel_ptr;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    /* reload flags at third row (iteration pixel_y == 2) */
-                    if (pixel_y == 2) {
-                        color_flags = color_flags_b;
-                        flag_mask = 21;
-                    }
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++) {
-                        pixel = color_table_index +
-                            ((color_flags >> flag_mask) & 0x07);
-                        flag_mask -= 3;
-                        pixels[block_ptr++] = s->color_octets[pixel];
-                    }
-                    block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        /* 16-color block encoding (every pixel is a different color) */
-        case 0xE0:
-            n_blocks = (opcode & 0x0F) + 1;
-
-            while (n_blocks--) {
-                block_ptr = row_ptr + pixel_ptr;
-                for (pixel_y = 0; pixel_y < 4; pixel_y++) {
-                    for (pixel_x = 0; pixel_x < 4; pixel_x++) {
-                        pixels[block_ptr++] = s->buf[stream_ptr++];
-                    }
-                    block_ptr += row_inc;
-                }
-                ADVANCE_BLOCK();
-            }
-            break;
-
-        case 0xF0:
-            av_log(s->avctx, AV_LOG_INFO, "0xF0 opcode seen in SMC chunk (contact the developers)\n");
-            break;
-        }
-    }
-}
-
-static av_cold int smc_decode_init(AVCodecContext *avctx)
-{
-    SmcContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int smc_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    SmcContext *s = avctx->priv_data;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
-                            FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
-    if (avctx->reget_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    smc_decode_stream(s);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int smc_decode_end(AVCodecContext *avctx)
-{
-    SmcContext *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec smc_decoder = {
-    "smc",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SMC,
-    sizeof(SmcContext),
-    smc_decode_init,
-    NULL,
-    smc_decode_end,
-    smc_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"),
-};
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
deleted file mode 100644
index 5ef9e5e..0000000
--- a/libavcodec/snow.c
+++ /dev/null
@@ -1,4150 +0,0 @@
-/*
- * Copyright (C) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intmath.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "dwt.h"
-#include "snow.h"
-
-#include "rangecoder.h"
-#include "mathops.h"
-
-#include "mpegvideo.h"
-#include "h263.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-static const int8_t quant3[256]={
- 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,
-};
-static const int8_t quant3b[256]={
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-};
-static const int8_t quant3bA[256]={
- 0, 0, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
- 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
-};
-static const int8_t quant5[256]={
- 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,-1,
-};
-static const int8_t quant7[256]={
- 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,
-};
-static const int8_t quant9[256]={
- 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-1,-1,
-};
-static const int8_t quant11[256]={
- 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-1,
-};
-static const int8_t quant13[256]={
- 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-2,-2,-1,
-};
-
-#if 0 //64*cubic
-static const uint8_t obmc32[1024]={
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  4,  4,  8,  8,  8,  8,  8,  8,  4,  4,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,  0,
-  0,  0,  0,  4,  4,  4,  4,  8,  8, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16, 16, 12, 12, 12,  8,  8,  4,  4,  4,  4,  0,  0,  0,
-  0,  0,  4,  4,  8,  8, 12, 16, 16, 20, 24, 24, 28, 28, 32, 32, 32, 32, 28, 28, 24, 24, 20, 16, 16, 12,  8,  8,  4,  4,  0,  0,
-  0,  0,  4,  8,  8, 12, 16, 24, 28, 32, 36, 40, 44, 48, 48, 48, 48, 48, 48, 44, 40, 36, 32, 28, 24, 16, 12,  8,  8,  4,  0,  0,
-  0,  4,  4,  8, 12, 20, 24, 32, 40, 44, 52, 56, 60, 64, 68, 72, 72, 68, 64, 60, 56, 52, 44, 40, 32, 24, 20, 12,  8,  4,  4,  0,
-  0,  4,  4, 12, 16, 24, 32, 40, 52, 60, 68, 76, 80, 88, 88, 92, 92, 88, 88, 80, 76, 68, 60, 52, 40, 32, 24, 16, 12,  4,  4,  0,
-  0,  4,  8, 16, 24, 32, 40, 52, 64, 76, 84, 92,100,108,112,116,116,112,108,100, 92, 84, 76, 64, 52, 40, 32, 24, 16,  8,  4,  0,
-  0,  4,  8, 16, 28, 40, 52, 64, 76, 88,100,112,124,132,136,140,140,136,132,124,112,100, 88, 76, 64, 52, 40, 28, 16,  8,  4,  0,
-  0,  4, 12, 20, 32, 44, 60, 76, 88,104,120,132,144,152,160,164,164,160,152,144,132,120,104, 88, 76, 60, 44, 32, 20, 12,  4,  0,
-  0,  4, 12, 24, 36, 48, 68, 84,100,120,136,152,164,176,180,184,184,180,176,164,152,136,120,100, 84, 68, 48, 36, 24, 12,  4,  0,
-  0,  4, 12, 24, 40, 56, 76, 92,112,132,152,168,180,192,204,208,208,204,192,180,168,152,132,112, 92, 76, 56, 40, 24, 12,  4,  0,
-  0,  4, 16, 28, 44, 60, 80,100,124,144,164,180,196,208,220,224,224,220,208,196,180,164,144,124,100, 80, 60, 44, 28, 16,  4,  0,
-  0,  8, 16, 28, 48, 64, 88,108,132,152,176,192,208,224,232,240,240,232,224,208,192,176,152,132,108, 88, 64, 48, 28, 16,  8,  0,
-  0,  4, 16, 32, 48, 68, 88,112,136,160,180,204,220,232,244,248,248,244,232,220,204,180,160,136,112, 88, 68, 48, 32, 16,  4,  0,
-  1,  8, 16, 32, 48, 72, 92,116,140,164,184,208,224,240,248,255,255,248,240,224,208,184,164,140,116, 92, 72, 48, 32, 16,  8,  1,
-  1,  8, 16, 32, 48, 72, 92,116,140,164,184,208,224,240,248,255,255,248,240,224,208,184,164,140,116, 92, 72, 48, 32, 16,  8,  1,
-  0,  4, 16, 32, 48, 68, 88,112,136,160,180,204,220,232,244,248,248,244,232,220,204,180,160,136,112, 88, 68, 48, 32, 16,  4,  0,
-  0,  8, 16, 28, 48, 64, 88,108,132,152,176,192,208,224,232,240,240,232,224,208,192,176,152,132,108, 88, 64, 48, 28, 16,  8,  0,
-  0,  4, 16, 28, 44, 60, 80,100,124,144,164,180,196,208,220,224,224,220,208,196,180,164,144,124,100, 80, 60, 44, 28, 16,  4,  0,
-  0,  4, 12, 24, 40, 56, 76, 92,112,132,152,168,180,192,204,208,208,204,192,180,168,152,132,112, 92, 76, 56, 40, 24, 12,  4,  0,
-  0,  4, 12, 24, 36, 48, 68, 84,100,120,136,152,164,176,180,184,184,180,176,164,152,136,120,100, 84, 68, 48, 36, 24, 12,  4,  0,
-  0,  4, 12, 20, 32, 44, 60, 76, 88,104,120,132,144,152,160,164,164,160,152,144,132,120,104, 88, 76, 60, 44, 32, 20, 12,  4,  0,
-  0,  4,  8, 16, 28, 40, 52, 64, 76, 88,100,112,124,132,136,140,140,136,132,124,112,100, 88, 76, 64, 52, 40, 28, 16,  8,  4,  0,
-  0,  4,  8, 16, 24, 32, 40, 52, 64, 76, 84, 92,100,108,112,116,116,112,108,100, 92, 84, 76, 64, 52, 40, 32, 24, 16,  8,  4,  0,
-  0,  4,  4, 12, 16, 24, 32, 40, 52, 60, 68, 76, 80, 88, 88, 92, 92, 88, 88, 80, 76, 68, 60, 52, 40, 32, 24, 16, 12,  4,  4,  0,
-  0,  4,  4,  8, 12, 20, 24, 32, 40, 44, 52, 56, 60, 64, 68, 72, 72, 68, 64, 60, 56, 52, 44, 40, 32, 24, 20, 12,  8,  4,  4,  0,
-  0,  0,  4,  8,  8, 12, 16, 24, 28, 32, 36, 40, 44, 48, 48, 48, 48, 48, 48, 44, 40, 36, 32, 28, 24, 16, 12,  8,  8,  4,  0,  0,
-  0,  0,  4,  4,  8,  8, 12, 16, 16, 20, 24, 24, 28, 28, 32, 32, 32, 32, 28, 28, 24, 24, 20, 16, 16, 12,  8,  8,  4,  4,  0,  0,
-  0,  0,  0,  4,  4,  4,  4,  8,  8, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16, 16, 12, 12, 12,  8,  8,  4,  4,  4,  4,  0,  0,  0,
-  0,  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  4,  4,  8,  8,  8,  8,  8,  8,  4,  4,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-//error:0.000022
-};
-static const uint8_t obmc16[256]={
-  0,  0,  0,  0,  0,  0,  4,  4,  4,  4,  0,  0,  0,  0,  0,  0,
-  0,  4,  4,  8, 16, 20, 20, 24, 24, 20, 20, 16,  8,  4,  4,  0,
-  0,  4, 16, 24, 36, 44, 52, 60, 60, 52, 44, 36, 24, 16,  4,  0,
-  0,  8, 24, 44, 60, 80, 96,104,104, 96, 80, 60, 44, 24,  8,  0,
-  0, 16, 36, 60, 92,116,136,152,152,136,116, 92, 60, 36, 16,  0,
-  0, 20, 44, 80,116,152,180,196,196,180,152,116, 80, 44, 20,  0,
-  4, 20, 52, 96,136,180,212,228,228,212,180,136, 96, 52, 20,  4,
-  4, 24, 60,104,152,196,228,248,248,228,196,152,104, 60, 24,  4,
-  4, 24, 60,104,152,196,228,248,248,228,196,152,104, 60, 24,  4,
-  4, 20, 52, 96,136,180,212,228,228,212,180,136, 96, 52, 20,  4,
-  0, 20, 44, 80,116,152,180,196,196,180,152,116, 80, 44, 20,  0,
-  0, 16, 36, 60, 92,116,136,152,152,136,116, 92, 60, 36, 16,  0,
-  0,  8, 24, 44, 60, 80, 96,104,104, 96, 80, 60, 44, 24,  8,  0,
-  0,  4, 16, 24, 36, 44, 52, 60, 60, 52, 44, 36, 24, 16,  4,  0,
-  0,  4,  4,  8, 16, 20, 20, 24, 24, 20, 20, 16,  8,  4,  4,  0,
-  0,  0,  0,  0,  0,  0,  4,  4,  4,  4,  0,  0,  0,  0,  0,  0,
-//error:0.000033
-};
-#elif 1 // 64*linear
-static const uint8_t obmc32[1024]={
-  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  4,  4,  8,  8,  8,  8,  8,  8,  8,  8,  4,  4,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,
-  0,  4,  4,  4,  8,  8,  8, 12, 12, 16, 16, 16, 20, 20, 20, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12,  8,  8,  8,  4,  4,  4,  0,
-  0,  4,  8,  8, 12, 12, 16, 20, 20, 24, 28, 28, 32, 32, 36, 40, 40, 36, 32, 32, 28, 28, 24, 20, 20, 16, 12, 12,  8,  8,  4,  0,
-  0,  4,  8, 12, 16, 20, 24, 28, 28, 32, 36, 40, 44, 48, 52, 56, 56, 52, 48, 44, 40, 36, 32, 28, 28, 24, 20, 16, 12,  8,  4,  0,
-  4,  8, 12, 16, 20, 24, 28, 32, 40, 44, 48, 52, 56, 60, 64, 68, 68, 64, 60, 56, 52, 48, 44, 40, 32, 28, 24, 20, 16, 12,  8,  4,
-  4,  8, 12, 20, 24, 32, 36, 40, 48, 52, 56, 64, 68, 76, 80, 84, 84, 80, 76, 68, 64, 56, 52, 48, 40, 36, 32, 24, 20, 12,  8,  4,
-  4,  8, 16, 24, 28, 36, 44, 48, 56, 60, 68, 76, 80, 88, 96,100,100, 96, 88, 80, 76, 68, 60, 56, 48, 44, 36, 28, 24, 16,  8,  4,
-  4, 12, 20, 28, 32, 40, 48, 56, 64, 72, 80, 88, 92,100,108,116,116,108,100, 92, 88, 80, 72, 64, 56, 48, 40, 32, 28, 20, 12,  4,
-  4, 12, 20, 28, 40, 48, 56, 64, 72, 80, 88, 96,108,116,124,132,132,124,116,108, 96, 88, 80, 72, 64, 56, 48, 40, 28, 20, 12,  4,
-  4, 16, 24, 32, 44, 52, 60, 72, 80, 92,100,108,120,128,136,148,148,136,128,120,108,100, 92, 80, 72, 60, 52, 44, 32, 24, 16,  4,
-  4, 16, 28, 36, 48, 56, 68, 80, 88,100,112,120,132,140,152,164,164,152,140,132,120,112,100, 88, 80, 68, 56, 48, 36, 28, 16,  4,
-  4, 16, 28, 40, 52, 64, 76, 88, 96,108,120,132,144,156,168,180,180,168,156,144,132,120,108, 96, 88, 76, 64, 52, 40, 28, 16,  4,
-  8, 20, 32, 44, 56, 68, 80, 92,108,120,132,144,156,168,180,192,192,180,168,156,144,132,120,108, 92, 80, 68, 56, 44, 32, 20,  8,
-  8, 20, 32, 48, 60, 76, 88,100,116,128,140,156,168,184,196,208,208,196,184,168,156,140,128,116,100, 88, 76, 60, 48, 32, 20,  8,
-  8, 20, 36, 52, 64, 80, 96,108,124,136,152,168,180,196,212,224,224,212,196,180,168,152,136,124,108, 96, 80, 64, 52, 36, 20,  8,
-  8, 24, 40, 56, 68, 84,100,116,132,148,164,180,192,208,224,240,240,224,208,192,180,164,148,132,116,100, 84, 68, 56, 40, 24,  8,
-  8, 24, 40, 56, 68, 84,100,116,132,148,164,180,192,208,224,240,240,224,208,192,180,164,148,132,116,100, 84, 68, 56, 40, 24,  8,
-  8, 20, 36, 52, 64, 80, 96,108,124,136,152,168,180,196,212,224,224,212,196,180,168,152,136,124,108, 96, 80, 64, 52, 36, 20,  8,
-  8, 20, 32, 48, 60, 76, 88,100,116,128,140,156,168,184,196,208,208,196,184,168,156,140,128,116,100, 88, 76, 60, 48, 32, 20,  8,
-  8, 20, 32, 44, 56, 68, 80, 92,108,120,132,144,156,168,180,192,192,180,168,156,144,132,120,108, 92, 80, 68, 56, 44, 32, 20,  8,
-  4, 16, 28, 40, 52, 64, 76, 88, 96,108,120,132,144,156,168,180,180,168,156,144,132,120,108, 96, 88, 76, 64, 52, 40, 28, 16,  4,
-  4, 16, 28, 36, 48, 56, 68, 80, 88,100,112,120,132,140,152,164,164,152,140,132,120,112,100, 88, 80, 68, 56, 48, 36, 28, 16,  4,
-  4, 16, 24, 32, 44, 52, 60, 72, 80, 92,100,108,120,128,136,148,148,136,128,120,108,100, 92, 80, 72, 60, 52, 44, 32, 24, 16,  4,
-  4, 12, 20, 28, 40, 48, 56, 64, 72, 80, 88, 96,108,116,124,132,132,124,116,108, 96, 88, 80, 72, 64, 56, 48, 40, 28, 20, 12,  4,
-  4, 12, 20, 28, 32, 40, 48, 56, 64, 72, 80, 88, 92,100,108,116,116,108,100, 92, 88, 80, 72, 64, 56, 48, 40, 32, 28, 20, 12,  4,
-  4,  8, 16, 24, 28, 36, 44, 48, 56, 60, 68, 76, 80, 88, 96,100,100, 96, 88, 80, 76, 68, 60, 56, 48, 44, 36, 28, 24, 16,  8,  4,
-  4,  8, 12, 20, 24, 32, 36, 40, 48, 52, 56, 64, 68, 76, 80, 84, 84, 80, 76, 68, 64, 56, 52, 48, 40, 36, 32, 24, 20, 12,  8,  4,
-  4,  8, 12, 16, 20, 24, 28, 32, 40, 44, 48, 52, 56, 60, 64, 68, 68, 64, 60, 56, 52, 48, 44, 40, 32, 28, 24, 20, 16, 12,  8,  4,
-  0,  4,  8, 12, 16, 20, 24, 28, 28, 32, 36, 40, 44, 48, 52, 56, 56, 52, 48, 44, 40, 36, 32, 28, 28, 24, 20, 16, 12,  8,  4,  0,
-  0,  4,  8,  8, 12, 12, 16, 20, 20, 24, 28, 28, 32, 32, 36, 40, 40, 36, 32, 32, 28, 28, 24, 20, 20, 16, 12, 12,  8,  8,  4,  0,
-  0,  4,  4,  4,  8,  8,  8, 12, 12, 16, 16, 16, 20, 20, 20, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12,  8,  8,  8,  4,  4,  4,  0,
-  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  4,  4,  8,  8,  8,  8,  8,  8,  8,  8,  4,  4,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,
- //error:0.000020
-};
-static const uint8_t obmc16[256]={
-  0,  4,  4,  8,  8, 12, 12, 16, 16, 12, 12,  8,  8,  4,  4,  0,
-  4,  8, 16, 20, 28, 32, 40, 44, 44, 40, 32, 28, 20, 16,  8,  4,
-  4, 16, 24, 36, 44, 56, 64, 76, 76, 64, 56, 44, 36, 24, 16,  4,
-  8, 20, 36, 48, 64, 76, 92,104,104, 92, 76, 64, 48, 36, 20,  8,
-  8, 28, 44, 64, 80,100,116,136,136,116,100, 80, 64, 44, 28,  8,
- 12, 32, 56, 76,100,120,144,164,164,144,120,100, 76, 56, 32, 12,
- 12, 40, 64, 92,116,144,168,196,196,168,144,116, 92, 64, 40, 12,
- 16, 44, 76,104,136,164,196,224,224,196,164,136,104, 76, 44, 16,
- 16, 44, 76,104,136,164,196,224,224,196,164,136,104, 76, 44, 16,
- 12, 40, 64, 92,116,144,168,196,196,168,144,116, 92, 64, 40, 12,
- 12, 32, 56, 76,100,120,144,164,164,144,120,100, 76, 56, 32, 12,
-  8, 28, 44, 64, 80,100,116,136,136,116,100, 80, 64, 44, 28,  8,
-  8, 20, 36, 48, 64, 76, 92,104,104, 92, 76, 64, 48, 36, 20,  8,
-  4, 16, 24, 36, 44, 56, 64, 76, 76, 64, 56, 44, 36, 24, 16,  4,
-  4,  8, 16, 20, 28, 32, 40, 44, 44, 40, 32, 28, 20, 16,  8,  4,
-  0,  4,  4,  8,  8, 12, 12, 16, 16, 12, 12,  8,  8,  4,  4,  0,
-//error:0.000015
-};
-#else //64*cos
-static const uint8_t obmc32[1024]={
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  4,  4,  8,  4,  4,  8,  4,  4,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  4,  4,  4,  4,  8,  8, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 12, 12, 12, 12,  8,  8,  4,  4,  4,  4,  0,  0,  0,
-  0,  0,  4,  4,  4,  8,  8, 12, 16, 20, 20, 24, 28, 28, 28, 28, 28, 28, 28, 28, 24, 20, 20, 16, 12,  8,  8,  4,  4,  4,  0,  0,
-  0,  0,  4,  4,  8, 12, 16, 20, 24, 28, 36, 40, 44, 44, 48, 48, 48, 48, 44, 44, 40, 36, 28, 24, 20, 16, 12,  8,  4,  4,  0,  0,
-  0,  0,  4,  8, 12, 20, 24, 32, 36, 44, 48, 56, 60, 64, 68, 68, 68, 68, 64, 60, 56, 48, 44, 36, 32, 24, 20, 12,  8,  4,  0,  0,
-  0,  4,  4,  8, 16, 24, 32, 40, 48, 60, 68, 76, 80, 84, 88, 92, 92, 88, 84, 80, 76, 68, 60, 48, 40, 32, 24, 16,  8,  4,  4,  0,
-  0,  4,  8, 12, 20, 32, 40, 52, 64, 76, 84, 96,104,108,112,116,116,112,108,104, 96, 84, 76, 64, 52, 40, 32, 20, 12,  8,  4,  0,
-  0,  4,  8, 16, 24, 36, 48, 64, 76, 92,104,116,124,132,136,140,140,136,132,124,116,104, 92, 76, 64, 48, 36, 24, 16,  8,  4,  0,
-  0,  4, 12, 20, 28, 44, 60, 76, 92,104,120,136,148,156,160,164,164,160,156,148,136,120,104, 92, 76, 60, 44, 28, 20, 12,  4,  0,
-  0,  4, 12, 20, 36, 48, 68, 84,104,120,140,152,168,176,184,188,188,184,176,168,152,140,120,104, 84, 68, 48, 36, 20, 12,  4,  0,
-  0,  4, 12, 24, 36, 56, 76, 96,116,136,152,172,184,196,204,208,208,204,196,184,172,152,136,116, 96, 76, 56, 36, 24, 12,  4,  0,
-  0,  4, 12, 24, 44, 60, 80,104,124,148,168,184,200,212,224,228,228,224,212,200,184,168,148,124,104, 80, 60, 44, 24, 12,  4,  0,
-  0,  4, 12, 28, 44, 64, 84,108,132,156,176,196,212,228,236,240,240,236,228,212,196,176,156,132,108, 84, 64, 44, 28, 12,  4,  0,
-  0,  4, 16, 28, 48, 68, 88,112,136,160,184,204,224,236,244,252,252,244,236,224,204,184,160,136,112, 88, 68, 48, 28, 16,  4,  0,
-  1,  4, 16, 28, 48, 68, 92,116,140,164,188,208,228,240,252,255,255,252,240,228,208,188,164,140,116, 92, 68, 48, 28, 16,  4,  1,
-  1,  4, 16, 28, 48, 68, 92,116,140,164,188,208,228,240,252,255,255,252,240,228,208,188,164,140,116, 92, 68, 48, 28, 16,  4,  1,
-  0,  4, 16, 28, 48, 68, 88,112,136,160,184,204,224,236,244,252,252,244,236,224,204,184,160,136,112, 88, 68, 48, 28, 16,  4,  0,
-  0,  4, 12, 28, 44, 64, 84,108,132,156,176,196,212,228,236,240,240,236,228,212,196,176,156,132,108, 84, 64, 44, 28, 12,  4,  0,
-  0,  4, 12, 24, 44, 60, 80,104,124,148,168,184,200,212,224,228,228,224,212,200,184,168,148,124,104, 80, 60, 44, 24, 12,  4,  0,
-  0,  4, 12, 24, 36, 56, 76, 96,116,136,152,172,184,196,204,208,208,204,196,184,172,152,136,116, 96, 76, 56, 36, 24, 12,  4,  0,
-  0,  4, 12, 20, 36, 48, 68, 84,104,120,140,152,168,176,184,188,188,184,176,168,152,140,120,104, 84, 68, 48, 36, 20, 12,  4,  0,
-  0,  4, 12, 20, 28, 44, 60, 76, 92,104,120,136,148,156,160,164,164,160,156,148,136,120,104, 92, 76, 60, 44, 28, 20, 12,  4,  0,
-  0,  4,  8, 16, 24, 36, 48, 64, 76, 92,104,116,124,132,136,140,140,136,132,124,116,104, 92, 76, 64, 48, 36, 24, 16,  8,  4,  0,
-  0,  4,  8, 12, 20, 32, 40, 52, 64, 76, 84, 96,104,108,112,116,116,112,108,104, 96, 84, 76, 64, 52, 40, 32, 20, 12,  8,  4,  0,
-  0,  4,  4,  8, 16, 24, 32, 40, 48, 60, 68, 76, 80, 84, 88, 92, 92, 88, 84, 80, 76, 68, 60, 48, 40, 32, 24, 16,  8,  4,  4,  0,
-  0,  0,  4,  8, 12, 20, 24, 32, 36, 44, 48, 56, 60, 64, 68, 68, 68, 68, 64, 60, 56, 48, 44, 36, 32, 24, 20, 12,  8,  4,  0,  0,
-  0,  0,  4,  4,  8, 12, 16, 20, 24, 28, 36, 40, 44, 44, 48, 48, 48, 48, 44, 44, 40, 36, 28, 24, 20, 16, 12,  8,  4,  4,  0,  0,
-  0,  0,  4,  4,  4,  8,  8, 12, 16, 20, 20, 24, 28, 28, 28, 28, 28, 28, 28, 28, 24, 20, 20, 16, 12,  8,  8,  4,  4,  4,  0,  0,
-  0,  0,  0,  4,  4,  4,  4,  8,  8, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 12, 12, 12, 12,  8,  8,  4,  4,  4,  4,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  4,  4,  8,  4,  4,  8,  4,  4,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-//error:0.000022
-};
-static const uint8_t obmc16[256]={
-  0,  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,  0,
-  0,  0,  4,  8, 12, 16, 20, 20, 20, 20, 16, 12,  8,  4,  0,  0,
-  0,  4, 12, 24, 32, 44, 52, 56, 56, 52, 44, 32, 24, 12,  4,  0,
-  0,  8, 24, 40, 60, 80, 96,104,104, 96, 80, 60, 40, 24,  8,  0,
-  0, 12, 32, 64, 92,120,140,152,152,140,120, 92, 64, 32, 12,  0,
-  4, 16, 44, 80,120,156,184,196,196,184,156,120, 80, 44, 16,  4,
-  4, 20, 52, 96,140,184,216,232,232,216,184,140, 96, 52, 20,  4,
-  0, 20, 56,104,152,196,232,252,252,232,196,152,104, 56, 20,  0,
-  0, 20, 56,104,152,196,232,252,252,232,196,152,104, 56, 20,  0,
-  4, 20, 52, 96,140,184,216,232,232,216,184,140, 96, 52, 20,  4,
-  4, 16, 44, 80,120,156,184,196,196,184,156,120, 80, 44, 16,  4,
-  0, 12, 32, 64, 92,120,140,152,152,140,120, 92, 64, 32, 12,  0,
-  0,  8, 24, 40, 60, 80, 96,104,104, 96, 80, 60, 40, 24,  8,  0,
-  0,  4, 12, 24, 32, 44, 52, 56, 56, 52, 44, 32, 24, 12,  4,  0,
-  0,  0,  4,  8, 12, 16, 20, 20, 20, 20, 16, 12,  8,  4,  0,  0,
-  0,  0,  0,  0,  0,  4,  4,  4,  4,  4,  4,  0,  0,  0,  0,  0,
-//error:0.000022
-};
-#endif /* 0 */
-
-//linear *64
-static const uint8_t obmc8[64]={
-  4, 12, 20, 28, 28, 20, 12,  4,
- 12, 36, 60, 84, 84, 60, 36, 12,
- 20, 60,100,140,140,100, 60, 20,
- 28, 84,140,196,196,140, 84, 28,
- 28, 84,140,196,196,140, 84, 28,
- 20, 60,100,140,140,100, 60, 20,
- 12, 36, 60, 84, 84, 60, 36, 12,
-  4, 12, 20, 28, 28, 20, 12,  4,
-//error:0.000000
-};
-
-//linear *64
-static const uint8_t obmc4[16]={
- 16, 48, 48, 16,
- 48,144,144, 48,
- 48,144,144, 48,
- 16, 48, 48, 16,
-//error:0.000000
-};
-
-static const uint8_t * const obmc_tab[4]={
-    obmc32, obmc16, obmc8, obmc4
-};
-
-static int scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
-
-typedef struct BlockNode{
-    int16_t mx;
-    int16_t my;
-    uint8_t ref;
-    uint8_t color[3];
-    uint8_t type;
-//#define TYPE_SPLIT    1
-#define BLOCK_INTRA   1
-#define BLOCK_OPT     2
-//#define TYPE_NOCOLOR  4
-    uint8_t level; //FIXME merge into type?
-}BlockNode;
-
-static const BlockNode null_block= { //FIXME add border maybe
-    .color= {128,128,128},
-    .mx= 0,
-    .my= 0,
-    .ref= 0,
-    .type= 0,
-    .level= 0,
-};
-
-#define LOG2_MB_SIZE 4
-#define MB_SIZE (1<<LOG2_MB_SIZE)
-#define ENCODER_EXTRA_BITS 4
-#define HTAPS_MAX 8
-
-typedef struct x_and_coeff{
-    int16_t x;
-    uint16_t coeff;
-} x_and_coeff;
-
-typedef struct SubBand{
-    int level;
-    int stride;
-    int width;
-    int height;
-    int qlog;        ///< log(qscale)/log[2^(1/6)]
-    DWTELEM *buf;
-    IDWTELEM *ibuf;
-    int buf_x_offset;
-    int buf_y_offset;
-    int stride_line; ///< Stride measured in lines, not pixels.
-    x_and_coeff * x_coeff;
-    struct SubBand *parent;
-    uint8_t state[/*7*2*/ 7 + 512][32];
-}SubBand;
-
-typedef struct Plane{
-    int width;
-    int height;
-    SubBand band[MAX_DECOMPOSITIONS][4];
-
-    int htaps;
-    int8_t hcoeff[HTAPS_MAX/2];
-    int diag_mc;
-    int fast_mc;
-
-    int last_htaps;
-    int8_t last_hcoeff[HTAPS_MAX/2];
-    int last_diag_mc;
-}Plane;
-
-typedef struct SnowContext{
-
-    AVCodecContext *avctx;
-    RangeCoder c;
-    DSPContext dsp;
-    DWTContext dwt;
-    AVFrame new_picture;
-    AVFrame input_picture;              ///< new_picture with the internal linesizes
-    AVFrame current_picture;
-    AVFrame last_picture[MAX_REF_FRAMES];
-    uint8_t *halfpel_plane[MAX_REF_FRAMES][4][4];
-    AVFrame mconly_picture;
-//     uint8_t q_context[16];
-    uint8_t header_state[32];
-    uint8_t block_state[128 + 32*128];
-    int keyframe;
-    int always_reset;
-    int version;
-    int spatial_decomposition_type;
-    int last_spatial_decomposition_type;
-    int temporal_decomposition_type;
-    int spatial_decomposition_count;
-    int last_spatial_decomposition_count;
-    int temporal_decomposition_count;
-    int max_ref_frames;
-    int ref_frames;
-    int16_t (*ref_mvs[MAX_REF_FRAMES])[2];
-    uint32_t *ref_scores[MAX_REF_FRAMES];
-    DWTELEM *spatial_dwt_buffer;
-    IDWTELEM *spatial_idwt_buffer;
-    int colorspace_type;
-    int chroma_h_shift;
-    int chroma_v_shift;
-    int spatial_scalability;
-    int qlog;
-    int last_qlog;
-    int lambda;
-    int lambda2;
-    int pass1_rc;
-    int mv_scale;
-    int last_mv_scale;
-    int qbias;
-    int last_qbias;
-#define QBIAS_SHIFT 3
-    int b_width;
-    int b_height;
-    int block_max_depth;
-    int last_block_max_depth;
-    Plane plane[MAX_PLANES];
-    BlockNode *block;
-#define ME_CACHE_SIZE 1024
-    int me_cache[ME_CACHE_SIZE];
-    int me_cache_generation;
-    slice_buffer sb;
-
-    MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX)
-
-    uint8_t *scratchbuf;
-}SnowContext;
-
-#ifdef __sgi
-// Avoid a name clash on SGI IRIX
-#undef qexp
-#endif
-#define QEXPSHIFT (7-FRAC_BITS+8) //FIXME try to change this to 0
-static uint8_t qexp[QROOT];
-
-static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){
-    int i;
-
-    if(v){
-        const int a= FFABS(v);
-        const int e= av_log2(a);
-#if 1
-        const int el= FFMIN(e, 10);
-        put_rac(c, state+0, 0);
-
-        for(i=0; i<el; i++){
-            put_rac(c, state+1+i, 1);  //1..10
-        }
-        for(; i<e; i++){
-            put_rac(c, state+1+9, 1);  //1..10
-        }
-        put_rac(c, state+1+FFMIN(i,9), 0);
-
-        for(i=e-1; i>=el; i--){
-            put_rac(c, state+22+9, (a>>i)&1); //22..31
-        }
-        for(; i>=0; i--){
-            put_rac(c, state+22+i, (a>>i)&1); //22..31
-        }
-
-        if(is_signed)
-            put_rac(c, state+11 + el, v < 0); //11..21
-#else
-
-        put_rac(c, state+0, 0);
-        if(e<=9){
-            for(i=0; i<e; i++){
-                put_rac(c, state+1+i, 1);  //1..10
-            }
-            put_rac(c, state+1+i, 0);
-
-            for(i=e-1; i>=0; i--){
-                put_rac(c, state+22+i, (a>>i)&1); //22..31
-            }
-
-            if(is_signed)
-                put_rac(c, state+11 + e, v < 0); //11..21
-        }else{
-            for(i=0; i<e; i++){
-                put_rac(c, state+1+FFMIN(i,9), 1);  //1..10
-            }
-            put_rac(c, state+1+9, 0);
-
-            for(i=e-1; i>=0; i--){
-                put_rac(c, state+22+FFMIN(i,9), (a>>i)&1); //22..31
-            }
-
-            if(is_signed)
-                put_rac(c, state+11 + 10, v < 0); //11..21
-        }
-#endif /* 1 */
-    }else{
-        put_rac(c, state+0, 1);
-    }
-}
-
-static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
-    if(get_rac(c, state+0))
-        return 0;
-    else{
-        int i, e, a;
-        e= 0;
-        while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
-            e++;
-        }
-
-        a= 1;
-        for(i=e-1; i>=0; i--){
-            a += a + get_rac(c, state+22 + FFMIN(i,9)); //22..31
-        }
-
-        e= -(is_signed && get_rac(c, state+11 + FFMIN(e,10))); //11..21
-        return (a^e)-e;
-    }
-}
-
-static inline void put_symbol2(RangeCoder *c, uint8_t *state, int v, int log2){
-    int i;
-    int r= log2>=0 ? 1<<log2 : 1;
-
-    assert(v>=0);
-    assert(log2>=-4);
-
-    while(v >= r){
-        put_rac(c, state+4+log2, 1);
-        v -= r;
-        log2++;
-        if(log2>0) r+=r;
-    }
-    put_rac(c, state+4+log2, 0);
-
-    for(i=log2-1; i>=0; i--){
-        put_rac(c, state+31-i, (v>>i)&1);
-    }
-}
-
-static inline int get_symbol2(RangeCoder *c, uint8_t *state, int log2){
-    int i;
-    int r= log2>=0 ? 1<<log2 : 1;
-    int v=0;
-
-    assert(log2>=-4);
-
-    while(get_rac(c, state+4+log2)){
-        v+= r;
-        log2++;
-        if(log2>0) r+=r;
-    }
-
-    for(i=log2-1; i>=0; i--){
-        v+= get_rac(c, state+31-i)<<i;
-    }
-
-    return v;
-}
-
-static inline void unpack_coeffs(SnowContext *s, SubBand *b, SubBand * parent, int orientation){
-    const int w= b->width;
-    const int h= b->height;
-    int x,y;
-
-    int run, runs;
-    x_and_coeff *xc= b->x_coeff;
-    x_and_coeff *prev_xc= NULL;
-    x_and_coeff *prev2_xc= xc;
-    x_and_coeff *parent_xc= parent ? parent->x_coeff : NULL;
-    x_and_coeff *prev_parent_xc= parent_xc;
-
-    runs= get_symbol2(&s->c, b->state[30], 0);
-    if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3);
-    else           run= INT_MAX;
-
-    for(y=0; y<h; y++){
-        int v=0;
-        int lt=0, t=0, rt=0;
-
-        if(y && prev_xc->x == 0){
-            rt= prev_xc->coeff;
-        }
-        for(x=0; x<w; x++){
-            int p=0;
-            const int l= v;
-
-            lt= t; t= rt;
-
-            if(y){
-                if(prev_xc->x <= x)
-                    prev_xc++;
-                if(prev_xc->x == x + 1)
-                    rt= prev_xc->coeff;
-                else
-                    rt=0;
-            }
-            if(parent_xc){
-                if(x>>1 > parent_xc->x){
-                    parent_xc++;
-                }
-                if(x>>1 == parent_xc->x){
-                    p= parent_xc->coeff;
-                }
-            }
-            if(/*ll|*/l|lt|t|rt|p){
-                int context= av_log2(/*FFABS(ll) + */3*(l>>1) + (lt>>1) + (t&~1) + (rt>>1) + (p>>1));
-
-                v=get_rac(&s->c, &b->state[0][context]);
-                if(v){
-                    v= 2*(get_symbol2(&s->c, b->state[context + 2], context-4) + 1);
-                    v+=get_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l&0xFF] + 3*quant3bA[t&0xFF]]);
-
-                    xc->x=x;
-                    (xc++)->coeff= v;
-                }
-            }else{
-                if(!run){
-                    if(runs-- > 0) run= get_symbol2(&s->c, b->state[1], 3);
-                    else           run= INT_MAX;
-                    v= 2*(get_symbol2(&s->c, b->state[0 + 2], 0-4) + 1);
-                    v+=get_rac(&s->c, &b->state[0][16 + 1 + 3]);
-
-                    xc->x=x;
-                    (xc++)->coeff= v;
-                }else{
-                    int max_run;
-                    run--;
-                    v=0;
-
-                    if(y) max_run= FFMIN(run, prev_xc->x - x - 2);
-                    else  max_run= FFMIN(run, w-x-1);
-                    if(parent_xc)
-                        max_run= FFMIN(max_run, 2*parent_xc->x - x - 1);
-                    x+= max_run;
-                    run-= max_run;
-                }
-            }
-        }
-        (xc++)->x= w+1; //end marker
-        prev_xc= prev2_xc;
-        prev2_xc= xc;
-
-        if(parent_xc){
-            if(y&1){
-                while(parent_xc->x != parent->width+1)
-                    parent_xc++;
-                parent_xc++;
-                prev_parent_xc= parent_xc;
-            }else{
-                parent_xc= prev_parent_xc;
-            }
-        }
-    }
-
-    (xc++)->x= w+1; //end marker
-}
-
-static inline void decode_subband_slice_buffered(SnowContext *s, SubBand *b, slice_buffer * sb, int start_y, int h, int save_state[1]){
-    const int w= b->width;
-    int y;
-    const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
-    int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
-    int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
-    int new_index = 0;
-
-    if(b->ibuf == s->spatial_idwt_buffer || s->qlog == LOSSLESS_QLOG){
-        qadd= 0;
-        qmul= 1<<QEXPSHIFT;
-    }
-
-    /* If we are on the second or later slice, restore our index. */
-    if (start_y != 0)
-        new_index = save_state[0];
-
-
-    for(y=start_y; y<h; y++){
-        int x = 0;
-        int v;
-        IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset;
-        memset(line, 0, b->width*sizeof(IDWTELEM));
-        v = b->x_coeff[new_index].coeff;
-        x = b->x_coeff[new_index++].x;
-        while(x < w){
-            register int t= ( (v>>1)*qmul + qadd)>>QEXPSHIFT;
-            register int u= -(v&1);
-            line[x] = (t^u) - u;
-
-            v = b->x_coeff[new_index].coeff;
-            x = b->x_coeff[new_index++].x;
-        }
-    }
-
-    /* Save our variables for the next slice. */
-    save_state[0] = new_index;
-
-    return;
-}
-
-static void reset_contexts(SnowContext *s){ //FIXME better initial contexts
-    int plane_index, level, orientation;
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        for(level=0; level<MAX_DECOMPOSITIONS; level++){
-            for(orientation=level ? 1:0; orientation<4; orientation++){
-                memset(s->plane[plane_index].band[level][orientation].state, MID_STATE, sizeof(s->plane[plane_index].band[level][orientation].state));
-            }
-        }
-    }
-    memset(s->header_state, MID_STATE, sizeof(s->header_state));
-    memset(s->block_state, MID_STATE, sizeof(s->block_state));
-}
-
-static int alloc_blocks(SnowContext *s){
-    int w= -((-s->avctx->width )>>LOG2_MB_SIZE);
-    int h= -((-s->avctx->height)>>LOG2_MB_SIZE);
-
-    s->b_width = w;
-    s->b_height= h;
-
-    av_free(s->block);
-    s->block= av_mallocz(w * h * sizeof(BlockNode) << (s->block_max_depth*2));
-    return 0;
-}
-
-static inline void copy_rac_state(RangeCoder *d, RangeCoder *s){
-    uint8_t *bytestream= d->bytestream;
-    uint8_t *bytestream_start= d->bytestream_start;
-    *d= *s;
-    d->bytestream= bytestream;
-    d->bytestream_start= bytestream_start;
-}
-
-static inline void set_blocks(SnowContext *s, int level, int x, int y, int l, int cb, int cr, int mx, int my, int ref, int type){
-    const int w= s->b_width << s->block_max_depth;
-    const int rem_depth= s->block_max_depth - level;
-    const int index= (x + y*w) << rem_depth;
-    const int block_w= 1<<rem_depth;
-    BlockNode block;
-    int i,j;
-
-    block.color[0]= l;
-    block.color[1]= cb;
-    block.color[2]= cr;
-    block.mx= mx;
-    block.my= my;
-    block.ref= ref;
-    block.type= type;
-    block.level= level;
-
-    for(j=0; j<block_w; j++){
-        for(i=0; i<block_w; i++){
-            s->block[index + i + j*w]= block;
-        }
-    }
-}
-
-static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){
-    const int offset[3]= {
-          y*c->  stride + x,
-        ((y*c->uvstride + x)>>1),
-        ((y*c->uvstride + x)>>1),
-    };
-    int i;
-    for(i=0; i<3; i++){
-        c->src[0][i]= src [i];
-        c->ref[0][i]= ref [i] + offset[i];
-    }
-    assert(!ref_index);
-}
-
-static inline void pred_mv(SnowContext *s, int *mx, int *my, int ref,
-                           const BlockNode *left, const BlockNode *top, const BlockNode *tr){
-    if(s->ref_frames == 1){
-        *mx = mid_pred(left->mx, top->mx, tr->mx);
-        *my = mid_pred(left->my, top->my, tr->my);
-    }else{
-        const int *scale = scale_mv_ref[ref];
-        *mx = mid_pred((left->mx * scale[left->ref] + 128) >>8,
-                       (top ->mx * scale[top ->ref] + 128) >>8,
-                       (tr  ->mx * scale[tr  ->ref] + 128) >>8);
-        *my = mid_pred((left->my * scale[left->ref] + 128) >>8,
-                       (top ->my * scale[top ->ref] + 128) >>8,
-                       (tr  ->my * scale[tr  ->ref] + 128) >>8);
-    }
-}
-
-static av_always_inline int same_block(BlockNode *a, BlockNode *b){
-    if((a->type&BLOCK_INTRA) && (b->type&BLOCK_INTRA)){
-        return !((a->color[0] - b->color[0]) | (a->color[1] - b->color[1]) | (a->color[2] - b->color[2]));
-    }else{
-        return !((a->mx - b->mx) | (a->my - b->my) | (a->ref - b->ref) | ((a->type ^ b->type)&BLOCK_INTRA));
-    }
-}
-
-static void decode_q_branch(SnowContext *s, int level, int x, int y){
-    const int w= s->b_width << s->block_max_depth;
-    const int rem_depth= s->block_max_depth - level;
-    const int index= (x + y*w) << rem_depth;
-    int trx= (x+1)<<rem_depth;
-    const BlockNode *left  = x ? &s->block[index-1] : &null_block;
-    const BlockNode *top   = y ? &s->block[index-w] : &null_block;
-    const BlockNode *tl    = y && x ? &s->block[index-w-1] : left;
-    const BlockNode *tr    = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt
-    int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
-
-    if(s->keyframe){
-        set_blocks(s, level, x, y, null_block.color[0], null_block.color[1], null_block.color[2], null_block.mx, null_block.my, null_block.ref, BLOCK_INTRA);
-        return;
-    }
-
-    if(level==s->block_max_depth || get_rac(&s->c, &s->block_state[4 + s_context])){
-        int type, mx, my;
-        int l = left->color[0];
-        int cb= left->color[1];
-        int cr= left->color[2];
-        int ref = 0;
-        int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
-        int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx));
-        int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my));
-
-        type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0;
-
-        if(type){
-            pred_mv(s, &mx, &my, 0, left, top, tr);
-            l += get_symbol(&s->c, &s->block_state[32], 1);
-            cb+= get_symbol(&s->c, &s->block_state[64], 1);
-            cr+= get_symbol(&s->c, &s->block_state[96], 1);
-        }else{
-            if(s->ref_frames > 1)
-                ref= get_symbol(&s->c, &s->block_state[128 + 1024 + 32*ref_context], 0);
-            pred_mv(s, &mx, &my, ref, left, top, tr);
-            mx+= get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1);
-            my+= get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1);
-        }
-        set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type);
-    }else{
-        decode_q_branch(s, level+1, 2*x+0, 2*y+0);
-        decode_q_branch(s, level+1, 2*x+1, 2*y+0);
-        decode_q_branch(s, level+1, 2*x+0, 2*y+1);
-        decode_q_branch(s, level+1, 2*x+1, 2*y+1);
-    }
-}
-
-static void decode_blocks(SnowContext *s){
-    int x, y;
-    int w= s->b_width;
-    int h= s->b_height;
-
-    for(y=0; y<h; y++){
-        for(x=0; x<w; x++){
-            decode_q_branch(s, 0, x, y);
-        }
-    }
-}
-
-static void mc_block(Plane *p, uint8_t *dst, const uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){
-    static const uint8_t weight[64]={
-    8,7,6,5,4,3,2,1,
-    7,7,0,0,0,0,0,1,
-    6,0,6,0,0,0,2,0,
-    5,0,0,5,0,3,0,0,
-    4,0,0,0,4,0,0,0,
-    3,0,0,5,0,3,0,0,
-    2,0,6,0,0,0,2,0,
-    1,7,0,0,0,0,0,1,
-    };
-
-    static const uint8_t brane[256]={
-    0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
-    0x04,0x05,0xcc,0xcc,0xcc,0xcc,0xcc,0x41,0x15,0x16,0xcc,0xcc,0xcc,0xcc,0xcc,0x52,
-    0x04,0xcc,0x05,0xcc,0xcc,0xcc,0x41,0xcc,0x15,0xcc,0x16,0xcc,0xcc,0xcc,0x52,0xcc,
-    0x04,0xcc,0xcc,0x05,0xcc,0x41,0xcc,0xcc,0x15,0xcc,0xcc,0x16,0xcc,0x52,0xcc,0xcc,
-    0x04,0xcc,0xcc,0xcc,0x41,0xcc,0xcc,0xcc,0x15,0xcc,0xcc,0xcc,0x16,0xcc,0xcc,0xcc,
-    0x04,0xcc,0xcc,0x41,0xcc,0x05,0xcc,0xcc,0x15,0xcc,0xcc,0x52,0xcc,0x16,0xcc,0xcc,
-    0x04,0xcc,0x41,0xcc,0xcc,0xcc,0x05,0xcc,0x15,0xcc,0x52,0xcc,0xcc,0xcc,0x16,0xcc,
-    0x04,0x41,0xcc,0xcc,0xcc,0xcc,0xcc,0x05,0x15,0x52,0xcc,0xcc,0xcc,0xcc,0xcc,0x16,
-    0x44,0x45,0x45,0x45,0x45,0x45,0x45,0x45,0x55,0x56,0x56,0x56,0x56,0x56,0x56,0x56,
-    0x48,0x49,0xcc,0xcc,0xcc,0xcc,0xcc,0x85,0x59,0x5A,0xcc,0xcc,0xcc,0xcc,0xcc,0x96,
-    0x48,0xcc,0x49,0xcc,0xcc,0xcc,0x85,0xcc,0x59,0xcc,0x5A,0xcc,0xcc,0xcc,0x96,0xcc,
-    0x48,0xcc,0xcc,0x49,0xcc,0x85,0xcc,0xcc,0x59,0xcc,0xcc,0x5A,0xcc,0x96,0xcc,0xcc,
-    0x48,0xcc,0xcc,0xcc,0x49,0xcc,0xcc,0xcc,0x59,0xcc,0xcc,0xcc,0x96,0xcc,0xcc,0xcc,
-    0x48,0xcc,0xcc,0x85,0xcc,0x49,0xcc,0xcc,0x59,0xcc,0xcc,0x96,0xcc,0x5A,0xcc,0xcc,
-    0x48,0xcc,0x85,0xcc,0xcc,0xcc,0x49,0xcc,0x59,0xcc,0x96,0xcc,0xcc,0xcc,0x5A,0xcc,
-    0x48,0x85,0xcc,0xcc,0xcc,0xcc,0xcc,0x49,0x59,0x96,0xcc,0xcc,0xcc,0xcc,0xcc,0x5A,
-    };
-
-    static const uint8_t needs[16]={
-    0,1,0,0,
-    2,4,2,0,
-    0,1,0,0,
-    15
-    };
-
-    int x, y, b, r, l;
-    int16_t tmpIt   [64*(32+HTAPS_MAX)];
-    uint8_t tmp2t[3][stride*(32+HTAPS_MAX)];
-    int16_t *tmpI= tmpIt;
-    uint8_t *tmp2= tmp2t[0];
-    const uint8_t *hpel[11];
-    assert(dx<16 && dy<16);
-    r= brane[dx + 16*dy]&15;
-    l= brane[dx + 16*dy]>>4;
-
-    b= needs[l] | needs[r];
-    if(p && !p->diag_mc)
-        b= 15;
-
-    if(b&5){
-        for(y=0; y < b_h+HTAPS_MAX-1; y++){
-            for(x=0; x < b_w; x++){
-                int a_1=src[x + HTAPS_MAX/2-4];
-                int a0= src[x + HTAPS_MAX/2-3];
-                int a1= src[x + HTAPS_MAX/2-2];
-                int a2= src[x + HTAPS_MAX/2-1];
-                int a3= src[x + HTAPS_MAX/2+0];
-                int a4= src[x + HTAPS_MAX/2+1];
-                int a5= src[x + HTAPS_MAX/2+2];
-                int a6= src[x + HTAPS_MAX/2+3];
-                int am=0;
-                if(!p || p->fast_mc){
-                    am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5);
-                    tmpI[x]= am;
-                    am= (am+16)>>5;
-                }else{
-                    am= p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6);
-                    tmpI[x]= am;
-                    am= (am+32)>>6;
-                }
-
-                if(am&(~255)) am= ~(am>>31);
-                tmp2[x]= am;
-            }
-            tmpI+= 64;
-            tmp2+= stride;
-            src += stride;
-        }
-        src -= stride*y;
-    }
-    src += HTAPS_MAX/2 - 1;
-    tmp2= tmp2t[1];
-
-    if(b&2){
-        for(y=0; y < b_h; y++){
-            for(x=0; x < b_w+1; x++){
-                int a_1=src[x + (HTAPS_MAX/2-4)*stride];
-                int a0= src[x + (HTAPS_MAX/2-3)*stride];
-                int a1= src[x + (HTAPS_MAX/2-2)*stride];
-                int a2= src[x + (HTAPS_MAX/2-1)*stride];
-                int a3= src[x + (HTAPS_MAX/2+0)*stride];
-                int a4= src[x + (HTAPS_MAX/2+1)*stride];
-                int a5= src[x + (HTAPS_MAX/2+2)*stride];
-                int a6= src[x + (HTAPS_MAX/2+3)*stride];
-                int am=0;
-                if(!p || p->fast_mc)
-                    am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 16)>>5;
-                else
-                    am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 32)>>6;
-
-                if(am&(~255)) am= ~(am>>31);
-                tmp2[x]= am;
-            }
-            src += stride;
-            tmp2+= stride;
-        }
-        src -= stride*y;
-    }
-    src += stride*(HTAPS_MAX/2 - 1);
-    tmp2= tmp2t[2];
-    tmpI= tmpIt;
-    if(b&4){
-        for(y=0; y < b_h; y++){
-            for(x=0; x < b_w; x++){
-                int a_1=tmpI[x + (HTAPS_MAX/2-4)*64];
-                int a0= tmpI[x + (HTAPS_MAX/2-3)*64];
-                int a1= tmpI[x + (HTAPS_MAX/2-2)*64];
-                int a2= tmpI[x + (HTAPS_MAX/2-1)*64];
-                int a3= tmpI[x + (HTAPS_MAX/2+0)*64];
-                int a4= tmpI[x + (HTAPS_MAX/2+1)*64];
-                int a5= tmpI[x + (HTAPS_MAX/2+2)*64];
-                int a6= tmpI[x + (HTAPS_MAX/2+3)*64];
-                int am=0;
-                if(!p || p->fast_mc)
-                    am= (20*(a2+a3) - 5*(a1+a4) + (a0+a5) + 512)>>10;
-                else
-                    am= (p->hcoeff[0]*(a2+a3) + p->hcoeff[1]*(a1+a4) + p->hcoeff[2]*(a0+a5) + p->hcoeff[3]*(a_1+a6) + 2048)>>12;
-                if(am&(~255)) am= ~(am>>31);
-                tmp2[x]= am;
-            }
-            tmpI+= 64;
-            tmp2+= stride;
-        }
-    }
-
-    hpel[ 0]= src;
-    hpel[ 1]= tmp2t[0] + stride*(HTAPS_MAX/2-1);
-    hpel[ 2]= src + 1;
-
-    hpel[ 4]= tmp2t[1];
-    hpel[ 5]= tmp2t[2];
-    hpel[ 6]= tmp2t[1] + 1;
-
-    hpel[ 8]= src + stride;
-    hpel[ 9]= hpel[1] + stride;
-    hpel[10]= hpel[8] + 1;
-
-    if(b==15){
-        const uint8_t *src1= hpel[dx/8 + dy/8*4  ];
-        const uint8_t *src2= hpel[dx/8 + dy/8*4+1];
-        const uint8_t *src3= hpel[dx/8 + dy/8*4+4];
-        const uint8_t *src4= hpel[dx/8 + dy/8*4+5];
-        dx&=7;
-        dy&=7;
-        for(y=0; y < b_h; y++){
-            for(x=0; x < b_w; x++){
-                dst[x]= ((8-dx)*(8-dy)*src1[x] + dx*(8-dy)*src2[x]+
-                         (8-dx)*   dy *src3[x] + dx*   dy *src4[x]+32)>>6;
-            }
-            src1+=stride;
-            src2+=stride;
-            src3+=stride;
-            src4+=stride;
-            dst +=stride;
-        }
-    }else{
-        const uint8_t *src1= hpel[l];
-        const uint8_t *src2= hpel[r];
-        int a= weight[((dx&7) + (8*(dy&7)))];
-        int b= 8-a;
-        for(y=0; y < b_h; y++){
-            for(x=0; x < b_w; x++){
-                dst[x]= (a*src1[x] + b*src2[x] + 4)>>3;
-            }
-            src1+=stride;
-            src2+=stride;
-            dst +=stride;
-        }
-    }
-}
-
-#define mca(dx,dy,b_w)\
-static void mc_block_hpel ## dx ## dy ## b_w(uint8_t *dst, const uint8_t *src, int stride, int h){\
-    uint8_t tmp[stride*(b_w+HTAPS_MAX-1)];\
-    assert(h==b_w);\
-    mc_block(NULL, dst, src-(HTAPS_MAX/2-1)-(HTAPS_MAX/2-1)*stride, tmp, stride, b_w, b_w, dx, dy);\
-}
-
-mca( 0, 0,16)
-mca( 8, 0,16)
-mca( 0, 8,16)
-mca( 8, 8,16)
-mca( 0, 0,8)
-mca( 8, 0,8)
-mca( 0, 8,8)
-mca( 8, 8,8)
-
-static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){
-    if(block->type & BLOCK_INTRA){
-        int x, y;
-        const int color = block->color[plane_index];
-        const int color4= color*0x01010101;
-        if(b_w==32){
-            for(y=0; y < b_h; y++){
-                *(uint32_t*)&dst[0 + y*stride]= color4;
-                *(uint32_t*)&dst[4 + y*stride]= color4;
-                *(uint32_t*)&dst[8 + y*stride]= color4;
-                *(uint32_t*)&dst[12+ y*stride]= color4;
-                *(uint32_t*)&dst[16+ y*stride]= color4;
-                *(uint32_t*)&dst[20+ y*stride]= color4;
-                *(uint32_t*)&dst[24+ y*stride]= color4;
-                *(uint32_t*)&dst[28+ y*stride]= color4;
-            }
-        }else if(b_w==16){
-            for(y=0; y < b_h; y++){
-                *(uint32_t*)&dst[0 + y*stride]= color4;
-                *(uint32_t*)&dst[4 + y*stride]= color4;
-                *(uint32_t*)&dst[8 + y*stride]= color4;
-                *(uint32_t*)&dst[12+ y*stride]= color4;
-            }
-        }else if(b_w==8){
-            for(y=0; y < b_h; y++){
-                *(uint32_t*)&dst[0 + y*stride]= color4;
-                *(uint32_t*)&dst[4 + y*stride]= color4;
-            }
-        }else if(b_w==4){
-            for(y=0; y < b_h; y++){
-                *(uint32_t*)&dst[0 + y*stride]= color4;
-            }
-        }else{
-            for(y=0; y < b_h; y++){
-                for(x=0; x < b_w; x++){
-                    dst[x + y*stride]= color;
-                }
-            }
-        }
-    }else{
-        uint8_t *src= s->last_picture[block->ref].data[plane_index];
-        const int scale= plane_index ?  s->mv_scale : 2*s->mv_scale;
-        int mx= block->mx*scale;
-        int my= block->my*scale;
-        const int dx= mx&15;
-        const int dy= my&15;
-        const int tab_index= 3 - (b_w>>2) + (b_w>>4);
-        sx += (mx>>4) - (HTAPS_MAX/2-1);
-        sy += (my>>4) - (HTAPS_MAX/2-1);
-        src += sx + sy*stride;
-        if(   (unsigned)sx >= w - b_w - (HTAPS_MAX-2)
-           || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){
-            ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h);
-            src= tmp + MB_SIZE;
-        }
-//        assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h);
-//        assert(!(b_w&(b_w-1)));
-        assert(b_w>1 && b_h>1);
-        assert((tab_index>=0 && tab_index<4) || b_w==32);
-        if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h) || (b_w&(b_w-1)) || !s->plane[plane_index].fast_mc )
-            mc_block(&s->plane[plane_index], dst, src, tmp, stride, b_w, b_h, dx, dy);
-        else if(b_w==32){
-            int y;
-            for(y=0; y<b_h; y+=16){
-                s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride, src + 3 + (y+3)*stride,stride);
-                s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 + y*stride, src + 19 + (y+3)*stride,stride);
-            }
-        }else if(b_w==b_h)
-            s->dsp.put_h264_qpel_pixels_tab[tab_index  ][dy+(dx>>2)](dst,src + 3 + 3*stride,stride);
-        else if(b_w==2*b_h){
-            s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst    ,src + 3       + 3*stride,stride);
-            s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 3 + b_h + 3*stride,stride);
-        }else{
-            assert(2*b_w==b_h);
-            s->dsp.put_h264_qpel_pixels_tab[tab_index  ][dy+(dx>>2)](dst           ,src + 3 + 3*stride           ,stride);
-            s->dsp.put_h264_qpel_pixels_tab[tab_index  ][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride);
-        }
-    }
-}
-
-void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
-                              int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-    int y, x;
-    IDWTELEM * dst;
-    for(y=0; y<b_h; y++){
-        //FIXME ugly misuse of obmc_stride
-        const uint8_t *obmc1= obmc + y*obmc_stride;
-        const uint8_t *obmc2= obmc1+ (obmc_stride>>1);
-        const uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1);
-        const uint8_t *obmc4= obmc3+ (obmc_stride>>1);
-        dst = slice_buffer_get_line(sb, src_y + y);
-        for(x=0; x<b_w; x++){
-            int v=   obmc1[x] * block[3][x + y*src_stride]
-                    +obmc2[x] * block[2][x + y*src_stride]
-                    +obmc3[x] * block[1][x + y*src_stride]
-                    +obmc4[x] * block[0][x + y*src_stride];
-
-            v <<= 8 - LOG2_OBMC_MAX;
-            if(FRAC_BITS != 8){
-                v >>= 8 - FRAC_BITS;
-            }
-            if(add){
-                v += dst[x + src_x];
-                v = (v + (1<<(FRAC_BITS-1))) >> FRAC_BITS;
-                if(v&(~255)) v= ~(v>>31);
-                dst8[x + y*src_stride] = v;
-            }else{
-                dst[x + src_x] -= v;
-            }
-        }
-    }
-}
-
-//FIXME name cleanup (b_w, block_w, b_width stuff)
-static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, IDWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){
-    const int b_width = s->b_width  << s->block_max_depth;
-    const int b_height= s->b_height << s->block_max_depth;
-    const int b_stride= b_width;
-    BlockNode *lt= &s->block[b_x + b_y*b_stride];
-    BlockNode *rt= lt+1;
-    BlockNode *lb= lt+b_stride;
-    BlockNode *rb= lb+1;
-    uint8_t *block[4];
-    int tmp_step= src_stride >= 7*MB_SIZE ? MB_SIZE : MB_SIZE*src_stride;
-    uint8_t *tmp = s->scratchbuf;
-    uint8_t *ptmp;
-    int x,y;
-
-    if(b_x<0){
-        lt= rt;
-        lb= rb;
-    }else if(b_x + 1 >= b_width){
-        rt= lt;
-        rb= lb;
-    }
-    if(b_y<0){
-        lt= lb;
-        rt= rb;
-    }else if(b_y + 1 >= b_height){
-        lb= lt;
-        rb= rt;
-    }
-
-    if(src_x<0){ //FIXME merge with prev & always round internal width up to *16
-        obmc -= src_x;
-        b_w += src_x;
-        if(!sliced && !offset_dst)
-            dst -= src_x;
-        src_x=0;
-    }else if(src_x + b_w > w){
-        b_w = w - src_x;
-    }
-    if(src_y<0){
-        obmc -= src_y*obmc_stride;
-        b_h += src_y;
-        if(!sliced && !offset_dst)
-            dst -= src_y*dst_stride;
-        src_y=0;
-    }else if(src_y + b_h> h){
-        b_h = h - src_y;
-    }
-
-    if(b_w<=0 || b_h<=0) return;
-
-    assert(src_stride > 2*MB_SIZE + 5);
-
-    if(!sliced && offset_dst)
-        dst += src_x + src_y*dst_stride;
-    dst8+= src_x + src_y*src_stride;
-//    src += src_x + src_y*src_stride;
-
-    ptmp= tmp + 3*tmp_step;
-    block[0]= ptmp;
-    ptmp+=tmp_step;
-    pred_block(s, block[0], tmp, src_stride, src_x, src_y, b_w, b_h, lt, plane_index, w, h);
-
-    if(same_block(lt, rt)){
-        block[1]= block[0];
-    }else{
-        block[1]= ptmp;
-        ptmp+=tmp_step;
-        pred_block(s, block[1], tmp, src_stride, src_x, src_y, b_w, b_h, rt, plane_index, w, h);
-    }
-
-    if(same_block(lt, lb)){
-        block[2]= block[0];
-    }else if(same_block(rt, lb)){
-        block[2]= block[1];
-    }else{
-        block[2]= ptmp;
-        ptmp+=tmp_step;
-        pred_block(s, block[2], tmp, src_stride, src_x, src_y, b_w, b_h, lb, plane_index, w, h);
-    }
-
-    if(same_block(lt, rb) ){
-        block[3]= block[0];
-    }else if(same_block(rt, rb)){
-        block[3]= block[1];
-    }else if(same_block(lb, rb)){
-        block[3]= block[2];
-    }else{
-        block[3]= ptmp;
-        pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h, rb, plane_index, w, h);
-    }
-#if 0
-    for(y=0; y<b_h; y++){
-        for(x=0; x<b_w; x++){
-            int v=   obmc [x + y*obmc_stride] * block[3][x + y*src_stride] * (256/OBMC_MAX);
-            if(add) dst[x + y*dst_stride] += v;
-            else    dst[x + y*dst_stride] -= v;
-        }
-    }
-    for(y=0; y<b_h; y++){
-        uint8_t *obmc2= obmc + (obmc_stride>>1);
-        for(x=0; x<b_w; x++){
-            int v=   obmc2[x + y*obmc_stride] * block[2][x + y*src_stride] * (256/OBMC_MAX);
-            if(add) dst[x + y*dst_stride] += v;
-            else    dst[x + y*dst_stride] -= v;
-        }
-    }
-    for(y=0; y<b_h; y++){
-        uint8_t *obmc3= obmc + obmc_stride*(obmc_stride>>1);
-        for(x=0; x<b_w; x++){
-            int v=   obmc3[x + y*obmc_stride] * block[1][x + y*src_stride] * (256/OBMC_MAX);
-            if(add) dst[x + y*dst_stride] += v;
-            else    dst[x + y*dst_stride] -= v;
-        }
-    }
-    for(y=0; y<b_h; y++){
-        uint8_t *obmc3= obmc + obmc_stride*(obmc_stride>>1);
-        uint8_t *obmc4= obmc3+ (obmc_stride>>1);
-        for(x=0; x<b_w; x++){
-            int v=   obmc4[x + y*obmc_stride] * block[0][x + y*src_stride] * (256/OBMC_MAX);
-            if(add) dst[x + y*dst_stride] += v;
-            else    dst[x + y*dst_stride] -= v;
-        }
-    }
-#else
-    if(sliced){
-        s->dwt.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-    }else{
-        for(y=0; y<b_h; y++){
-            //FIXME ugly misuse of obmc_stride
-            const uint8_t *obmc1= obmc + y*obmc_stride;
-            const uint8_t *obmc2= obmc1+ (obmc_stride>>1);
-            const uint8_t *obmc3= obmc1+ obmc_stride*(obmc_stride>>1);
-            const uint8_t *obmc4= obmc3+ (obmc_stride>>1);
-            for(x=0; x<b_w; x++){
-                int v=   obmc1[x] * block[3][x + y*src_stride]
-                        +obmc2[x] * block[2][x + y*src_stride]
-                        +obmc3[x] * block[1][x + y*src_stride]
-                        +obmc4[x] * block[0][x + y*src_stride];
-
-                v <<= 8 - LOG2_OBMC_MAX;
-                if(FRAC_BITS != 8){
-                    v >>= 8 - FRAC_BITS;
-                }
-                if(add){
-                    v += dst[x + y*dst_stride];
-                    v = (v + (1<<(FRAC_BITS-1))) >> FRAC_BITS;
-                    if(v&(~255)) v= ~(v>>31);
-                    dst8[x + y*src_stride] = v;
-                }else{
-                    dst[x + y*dst_stride] -= v;
-                }
-            }
-        }
-    }
-#endif /* 0 */
-}
-
-static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){
-    Plane *p= &s->plane[plane_index];
-    const int mb_w= s->b_width  << s->block_max_depth;
-    const int mb_h= s->b_height << s->block_max_depth;
-    int x, y, mb_x;
-    int block_size = MB_SIZE >> s->block_max_depth;
-    int block_w    = plane_index ? block_size/2 : block_size;
-    const uint8_t *obmc  = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
-    int obmc_stride= plane_index ? block_size : 2*block_size;
-    int ref_stride= s->current_picture.linesize[plane_index];
-    uint8_t *dst8= s->current_picture.data[plane_index];
-    int w= p->width;
-    int h= p->height;
-
-    if(s->keyframe || (s->avctx->debug&512)){
-        if(mb_y==mb_h)
-            return;
-
-        if(add){
-            for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){
-//                DWTELEM * line = slice_buffer_get_line(sb, y);
-                IDWTELEM * line = sb->line[y];
-                for(x=0; x<w; x++){
-//                    int v= buf[x + y*w] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));
-                    int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));
-                    v >>= FRAC_BITS;
-                    if(v&(~255)) v= ~(v>>31);
-                    dst8[x + y*ref_stride]= v;
-                }
-            }
-        }else{
-            for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){
-//                DWTELEM * line = slice_buffer_get_line(sb, y);
-                IDWTELEM * line = sb->line[y];
-                for(x=0; x<w; x++){
-                    line[x] -= 128 << FRAC_BITS;
-//                    buf[x + y*w]-= 128<<FRAC_BITS;
-                }
-            }
-        }
-
-        return;
-    }
-
-    for(mb_x=0; mb_x<=mb_w; mb_x++){
-        add_yblock(s, 1, sb, old_buffer, dst8, obmc,
-                   block_w*mb_x - block_w/2,
-                   block_w*mb_y - block_w/2,
-                   block_w, block_w,
-                   w, h,
-                   w, ref_stride, obmc_stride,
-                   mb_x - 1, mb_y - 1,
-                   add, 0, plane_index);
-    }
-}
-
-static av_always_inline void predict_slice(SnowContext *s, IDWTELEM *buf, int plane_index, int add, int mb_y){
-    Plane *p= &s->plane[plane_index];
-    const int mb_w= s->b_width  << s->block_max_depth;
-    const int mb_h= s->b_height << s->block_max_depth;
-    int x, y, mb_x;
-    int block_size = MB_SIZE >> s->block_max_depth;
-    int block_w    = plane_index ? block_size/2 : block_size;
-    const uint8_t *obmc  = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
-    const int obmc_stride= plane_index ? block_size : 2*block_size;
-    int ref_stride= s->current_picture.linesize[plane_index];
-    uint8_t *dst8= s->current_picture.data[plane_index];
-    int w= p->width;
-    int h= p->height;
-
-    if(s->keyframe || (s->avctx->debug&512)){
-        if(mb_y==mb_h)
-            return;
-
-        if(add){
-            for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){
-                for(x=0; x<w; x++){
-                    int v= buf[x + y*w] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));
-                    v >>= FRAC_BITS;
-                    if(v&(~255)) v= ~(v>>31);
-                    dst8[x + y*ref_stride]= v;
-                }
-            }
-        }else{
-            for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){
-                for(x=0; x<w; x++){
-                    buf[x + y*w]-= 128<<FRAC_BITS;
-                }
-            }
-        }
-
-        return;
-    }
-
-    for(mb_x=0; mb_x<=mb_w; mb_x++){
-        add_yblock(s, 0, NULL, buf, dst8, obmc,
-                   block_w*mb_x - block_w/2,
-                   block_w*mb_y - block_w/2,
-                   block_w, block_w,
-                   w, h,
-                   w, ref_stride, obmc_stride,
-                   mb_x - 1, mb_y - 1,
-                   add, 1, plane_index);
-    }
-}
-
-static av_always_inline void predict_plane(SnowContext *s, IDWTELEM *buf, int plane_index, int add){
-    const int mb_h= s->b_height << s->block_max_depth;
-    int mb_y;
-    for(mb_y=0; mb_y<=mb_h; mb_y++)
-        predict_slice(s, buf, plane_index, add, mb_y);
-}
-
-static void dequantize_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int start_y, int end_y){
-    const int w= b->width;
-    const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
-    const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
-    const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
-    int x,y;
-
-    if(s->qlog == LOSSLESS_QLOG) return;
-
-    for(y=start_y; y<end_y; y++){
-//        DWTELEM * line = slice_buffer_get_line_from_address(sb, src + (y * stride));
-        IDWTELEM * line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
-        for(x=0; x<w; x++){
-            int i= line[x];
-            if(i<0){
-                line[x]= -((-i*qmul + qadd)>>(QEXPSHIFT)); //FIXME try different bias
-            }else if(i>0){
-                line[x]=  (( i*qmul + qadd)>>(QEXPSHIFT));
-            }
-        }
-    }
-}
-
-static void correlate_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, IDWTELEM *src, int stride, int inverse, int use_median, int start_y, int end_y){
-    const int w= b->width;
-    int x,y;
-
-    IDWTELEM * line=0; // silence silly "could be used without having been initialized" warning
-    IDWTELEM * prev;
-
-    if (start_y != 0)
-        line = slice_buffer_get_line(sb, ((start_y - 1) * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
-
-    for(y=start_y; y<end_y; y++){
-        prev = line;
-//        line = slice_buffer_get_line_from_address(sb, src + (y * stride));
-        line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
-        for(x=0; x<w; x++){
-            if(x){
-                if(use_median){
-                    if(y && x+1<w) line[x] += mid_pred(line[x - 1], prev[x], prev[x + 1]);
-                    else  line[x] += line[x - 1];
-                }else{
-                    if(y) line[x] += mid_pred(line[x - 1], prev[x], line[x - 1] + prev[x] - prev[x - 1]);
-                    else  line[x] += line[x - 1];
-                }
-            }else{
-                if(y) line[x] += prev[x];
-            }
-        }
-    }
-}
-
-static void decode_qlogs(SnowContext *s){
-    int plane_index, level, orientation;
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        for(level=0; level<s->spatial_decomposition_count; level++){
-            for(orientation=level ? 1:0; orientation<4; orientation++){
-                int q;
-                if     (plane_index==2) q= s->plane[1].band[level][orientation].qlog;
-                else if(orientation==2) q= s->plane[plane_index].band[level][1].qlog;
-                else                    q= get_symbol(&s->c, s->header_state, 1);
-                s->plane[plane_index].band[level][orientation].qlog= q;
-            }
-        }
-    }
-}
-
-#define GET_S(dst, check) \
-    tmp= get_symbol(&s->c, s->header_state, 0);\
-    if(!(check)){\
-        av_log(s->avctx, AV_LOG_ERROR, "Error " #dst " is %d\n", tmp);\
-        return -1;\
-    }\
-    dst= tmp;
-
-static int decode_header(SnowContext *s){
-    int plane_index, tmp;
-    uint8_t kstate[32];
-
-    memset(kstate, MID_STATE, sizeof(kstate));
-
-    s->keyframe= get_rac(&s->c, kstate);
-    if(s->keyframe || s->always_reset){
-        reset_contexts(s);
-        s->spatial_decomposition_type=
-        s->qlog=
-        s->qbias=
-        s->mv_scale=
-        s->block_max_depth= 0;
-    }
-    if(s->keyframe){
-        GET_S(s->version, tmp <= 0U)
-        s->always_reset= get_rac(&s->c, s->header_state);
-        s->temporal_decomposition_type= get_symbol(&s->c, s->header_state, 0);
-        s->temporal_decomposition_count= get_symbol(&s->c, s->header_state, 0);
-        GET_S(s->spatial_decomposition_count, 0 < tmp && tmp <= MAX_DECOMPOSITIONS)
-        s->colorspace_type= get_symbol(&s->c, s->header_state, 0);
-        s->chroma_h_shift= get_symbol(&s->c, s->header_state, 0);
-        s->chroma_v_shift= get_symbol(&s->c, s->header_state, 0);
-        s->spatial_scalability= get_rac(&s->c, s->header_state);
-//        s->rate_scalability= get_rac(&s->c, s->header_state);
-        GET_S(s->max_ref_frames, tmp < (unsigned)MAX_REF_FRAMES)
-        s->max_ref_frames++;
-
-        decode_qlogs(s);
-    }
-
-    if(!s->keyframe){
-        if(get_rac(&s->c, s->header_state)){
-            for(plane_index=0; plane_index<2; plane_index++){
-                int htaps, i, sum=0;
-                Plane *p= &s->plane[plane_index];
-                p->diag_mc= get_rac(&s->c, s->header_state);
-                htaps= get_symbol(&s->c, s->header_state, 0)*2 + 2;
-                if((unsigned)htaps > HTAPS_MAX || htaps==0)
-                    return -1;
-                p->htaps= htaps;
-                for(i= htaps/2; i; i--){
-                    p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1));
-                    sum += p->hcoeff[i];
-                }
-                p->hcoeff[0]= 32-sum;
-            }
-            s->plane[2].diag_mc= s->plane[1].diag_mc;
-            s->plane[2].htaps  = s->plane[1].htaps;
-            memcpy(s->plane[2].hcoeff, s->plane[1].hcoeff, sizeof(s->plane[1].hcoeff));
-        }
-        if(get_rac(&s->c, s->header_state)){
-            GET_S(s->spatial_decomposition_count, 0 < tmp && tmp <= MAX_DECOMPOSITIONS)
-            decode_qlogs(s);
-        }
-    }
-
-    s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1);
-    if(s->spatial_decomposition_type > 1U){
-        av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_type %d not supported", s->spatial_decomposition_type);
-        return -1;
-    }
-    if(FFMIN(s->avctx-> width>>s->chroma_h_shift,
-             s->avctx->height>>s->chroma_v_shift) >> (s->spatial_decomposition_count-1) <= 0){
-        av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_count %d too large for size", s->spatial_decomposition_count);
-        return -1;
-    }
-
-    s->qlog           += get_symbol(&s->c, s->header_state, 1);
-    s->mv_scale       += get_symbol(&s->c, s->header_state, 1);
-    s->qbias          += get_symbol(&s->c, s->header_state, 1);
-    s->block_max_depth+= get_symbol(&s->c, s->header_state, 1);
-    if(s->block_max_depth > 1 || s->block_max_depth < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "block_max_depth= %d is too large", s->block_max_depth);
-        s->block_max_depth= 0;
-        return -1;
-    }
-
-    return 0;
-}
-
-static void init_qexp(void){
-    int i;
-    double v=128;
-
-    for(i=0; i<QROOT; i++){
-        qexp[i]= lrintf(v);
-        v *= pow(2, 1.0 / QROOT);
-    }
-}
-
-static av_cold int common_init(AVCodecContext *avctx){
-    SnowContext *s = avctx->priv_data;
-    int width, height;
-    int i, j;
-
-    s->avctx= avctx;
-    s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe
-
-    dsputil_init(&s->dsp, avctx);
-    ff_dwt_init(&s->dwt);
-
-#define mcf(dx,dy)\
-    s->dsp.put_qpel_pixels_tab       [0][dy+dx/4]=\
-    s->dsp.put_no_rnd_qpel_pixels_tab[0][dy+dx/4]=\
-        s->dsp.put_h264_qpel_pixels_tab[0][dy+dx/4];\
-    s->dsp.put_qpel_pixels_tab       [1][dy+dx/4]=\
-    s->dsp.put_no_rnd_qpel_pixels_tab[1][dy+dx/4]=\
-        s->dsp.put_h264_qpel_pixels_tab[1][dy+dx/4];
-
-    mcf( 0, 0)
-    mcf( 4, 0)
-    mcf( 8, 0)
-    mcf(12, 0)
-    mcf( 0, 4)
-    mcf( 4, 4)
-    mcf( 8, 4)
-    mcf(12, 4)
-    mcf( 0, 8)
-    mcf( 4, 8)
-    mcf( 8, 8)
-    mcf(12, 8)
-    mcf( 0,12)
-    mcf( 4,12)
-    mcf( 8,12)
-    mcf(12,12)
-
-#define mcfh(dx,dy)\
-    s->dsp.put_pixels_tab       [0][dy/4+dx/8]=\
-    s->dsp.put_no_rnd_pixels_tab[0][dy/4+dx/8]=\
-        mc_block_hpel ## dx ## dy ## 16;\
-    s->dsp.put_pixels_tab       [1][dy/4+dx/8]=\
-    s->dsp.put_no_rnd_pixels_tab[1][dy/4+dx/8]=\
-        mc_block_hpel ## dx ## dy ## 8;
-
-    mcfh(0, 0)
-    mcfh(8, 0)
-    mcfh(0, 8)
-    mcfh(8, 8)
-
-    if(!qexp[0])
-        init_qexp();
-
-//    dec += FFMAX(s->chroma_h_shift, s->chroma_v_shift);
-
-    width= s->avctx->width;
-    height= s->avctx->height;
-
-    s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
-    s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here
-
-    for(i=0; i<MAX_REF_FRAMES; i++)
-        for(j=0; j<MAX_REF_FRAMES; j++)
-            scale_mv_ref[i][j] = 256*(i+1)/(j+1);
-
-    s->avctx->get_buffer(s->avctx, &s->mconly_picture);
-    s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE);
-
-    return 0;
-}
-
-static int common_init_after_header(AVCodecContext *avctx){
-    SnowContext *s = avctx->priv_data;
-    int plane_index, level, orientation;
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        int w= s->avctx->width;
-        int h= s->avctx->height;
-
-        if(plane_index){
-            w>>= s->chroma_h_shift;
-            h>>= s->chroma_v_shift;
-        }
-        s->plane[plane_index].width = w;
-        s->plane[plane_index].height= h;
-
-        for(level=s->spatial_decomposition_count-1; level>=0; level--){
-            for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                SubBand *b= &s->plane[plane_index].band[level][orientation];
-
-                b->buf= s->spatial_dwt_buffer;
-                b->level= level;
-                b->stride= s->plane[plane_index].width << (s->spatial_decomposition_count - level);
-                b->width = (w + !(orientation&1))>>1;
-                b->height= (h + !(orientation>1))>>1;
-
-                b->stride_line = 1 << (s->spatial_decomposition_count - level);
-                b->buf_x_offset = 0;
-                b->buf_y_offset = 0;
-
-                if(orientation&1){
-                    b->buf += (w+1)>>1;
-                    b->buf_x_offset = (w+1)>>1;
-                }
-                if(orientation>1){
-                    b->buf += b->stride>>1;
-                    b->buf_y_offset = b->stride_line >> 1;
-                }
-                b->ibuf= s->spatial_idwt_buffer + (b->buf - s->spatial_dwt_buffer);
-
-                if(level)
-                    b->parent= &s->plane[plane_index].band[level-1][orientation];
-                //FIXME avoid this realloc
-                av_freep(&b->x_coeff);
-                b->x_coeff=av_mallocz(((b->width+1) * b->height+1)*sizeof(x_and_coeff));
-            }
-            w= (w+1)>>1;
-            h= (h+1)>>1;
-        }
-    }
-
-    return 0;
-}
-
-#define QUANTIZE2 0
-
-#if QUANTIZE2==1
-#define Q2_STEP 8
-
-static void find_sse(SnowContext *s, Plane *p, int *score, int score_stride, IDWTELEM *r0, IDWTELEM *r1, int level, int orientation){
-    SubBand *b= &p->band[level][orientation];
-    int x, y;
-    int xo=0;
-    int yo=0;
-    int step= 1 << (s->spatial_decomposition_count - level);
-
-    if(orientation&1)
-        xo= step>>1;
-    if(orientation&2)
-        yo= step>>1;
-
-    //FIXME bias for nonzero ?
-    //FIXME optimize
-    memset(score, 0, sizeof(*score)*score_stride*((p->height + Q2_STEP-1)/Q2_STEP));
-    for(y=0; y<p->height; y++){
-        for(x=0; x<p->width; x++){
-            int sx= (x-xo + step/2) / step / Q2_STEP;
-            int sy= (y-yo + step/2) / step / Q2_STEP;
-            int v= r0[x + y*p->width] - r1[x + y*p->width];
-            assert(sx>=0 && sy>=0 && sx < score_stride);
-            v= ((v+8)>>4)<<4;
-            score[sx + sy*score_stride] += v*v;
-            assert(score[sx + sy*score_stride] >= 0);
-        }
-    }
-}
-
-static void dequantize_all(SnowContext *s, Plane *p, IDWTELEM *buffer, int width, int height){
-    int level, orientation;
-
-    for(level=0; level<s->spatial_decomposition_count; level++){
-        for(orientation=level ? 1 : 0; orientation<4; orientation++){
-            SubBand *b= &p->band[level][orientation];
-            IDWTELEM *dst= buffer + (b->ibuf - s->spatial_idwt_buffer);
-
-            dequantize(s, b, dst, b->stride);
-        }
-    }
-}
-
-static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, int height, int stride, int type){
-    int level, orientation, ys, xs, x, y, pass;
-    IDWTELEM best_dequant[height * stride];
-    IDWTELEM idwt2_buffer[height * stride];
-    const int score_stride= (width + 10)/Q2_STEP;
-    int best_score[(width + 10)/Q2_STEP * (height + 10)/Q2_STEP]; //FIXME size
-    int score[(width + 10)/Q2_STEP * (height + 10)/Q2_STEP]; //FIXME size
-    int threshold= (s->m.lambda * s->m.lambda) >> 6;
-
-    //FIXME pass the copy cleanly ?
-
-//    memcpy(dwt_buffer, buffer, height * stride * sizeof(DWTELEM));
-    ff_spatial_dwt(buffer, width, height, stride, type, s->spatial_decomposition_count);
-
-    for(level=0; level<s->spatial_decomposition_count; level++){
-        for(orientation=level ? 1 : 0; orientation<4; orientation++){
-            SubBand *b= &p->band[level][orientation];
-            IDWTELEM *dst= best_dequant + (b->ibuf - s->spatial_idwt_buffer);
-             DWTELEM *src=       buffer + (b-> buf - s->spatial_dwt_buffer);
-            assert(src == b->buf); // code does not depend on this but it is true currently
-
-            quantize(s, b, dst, src, b->stride, s->qbias);
-        }
-    }
-    for(pass=0; pass<1; pass++){
-        if(s->qbias == 0) //keyframe
-            continue;
-        for(level=0; level<s->spatial_decomposition_count; level++){
-            for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                SubBand *b= &p->band[level][orientation];
-                IDWTELEM *dst= idwt2_buffer + (b->ibuf - s->spatial_idwt_buffer);
-                IDWTELEM *best_dst= best_dequant + (b->ibuf - s->spatial_idwt_buffer);
-
-                for(ys= 0; ys<Q2_STEP; ys++){
-                    for(xs= 0; xs<Q2_STEP; xs++){
-                        memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
-                        dequantize_all(s, p, idwt2_buffer, width, height);
-                        ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
-                        find_sse(s, p, best_score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
-                        memcpy(idwt2_buffer, best_dequant, height * stride * sizeof(IDWTELEM));
-                        for(y=ys; y<b->height; y+= Q2_STEP){
-                            for(x=xs; x<b->width; x+= Q2_STEP){
-                                if(dst[x + y*b->stride]<0) dst[x + y*b->stride]++;
-                                if(dst[x + y*b->stride]>0) dst[x + y*b->stride]--;
-                                //FIXME try more than just --
-                            }
-                        }
-                        dequantize_all(s, p, idwt2_buffer, width, height);
-                        ff_spatial_idwt(idwt2_buffer, width, height, stride, type, s->spatial_decomposition_count);
-                        find_sse(s, p, score, score_stride, idwt2_buffer, s->spatial_idwt_buffer, level, orientation);
-                        for(y=ys; y<b->height; y+= Q2_STEP){
-                            for(x=xs; x<b->width; x+= Q2_STEP){
-                                int score_idx= x/Q2_STEP + (y/Q2_STEP)*score_stride;
-                                if(score[score_idx] <= best_score[score_idx] + threshold){
-                                    best_score[score_idx]= score[score_idx];
-                                    if(best_dst[x + y*b->stride]<0) best_dst[x + y*b->stride]++;
-                                    if(best_dst[x + y*b->stride]>0) best_dst[x + y*b->stride]--;
-                                    //FIXME copy instead
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-    memcpy(s->spatial_idwt_buffer, best_dequant, height * stride * sizeof(IDWTELEM)); //FIXME work with that directly instead of copy at the end
-}
-
-#endif /* QUANTIZE2==1 */
-
-#define USE_HALFPEL_PLANE 0
-
-static void halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *frame){
-    int p,x,y;
-
-    assert(!(s->avctx->flags & CODEC_FLAG_EMU_EDGE));
-
-    for(p=0; p<3; p++){
-        int is_chroma= !!p;
-        int w= s->avctx->width  >>is_chroma;
-        int h= s->avctx->height >>is_chroma;
-        int ls= frame->linesize[p];
-        uint8_t *src= frame->data[p];
-
-        halfpel[1][p]= (uint8_t*)av_malloc(ls * (h+2*EDGE_WIDTH)) + EDGE_WIDTH*(1+ls);
-        halfpel[2][p]= (uint8_t*)av_malloc(ls * (h+2*EDGE_WIDTH)) + EDGE_WIDTH*(1+ls);
-        halfpel[3][p]= (uint8_t*)av_malloc(ls * (h+2*EDGE_WIDTH)) + EDGE_WIDTH*(1+ls);
-
-        halfpel[0][p]= src;
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int i= y*ls + x;
-
-                halfpel[1][p][i]= (20*(src[i] + src[i+1]) - 5*(src[i-1] + src[i+2]) + (src[i-2] + src[i+3]) + 16 )>>5;
-            }
-        }
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int i= y*ls + x;
-
-                halfpel[2][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5;
-            }
-        }
-        src= halfpel[1][p];
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int i= y*ls + x;
-
-                halfpel[3][p][i]= (20*(src[i] + src[i+ls]) - 5*(src[i-ls] + src[i+2*ls]) + (src[i-2*ls] + src[i+3*ls]) + 16 )>>5;
-            }
-        }
-
-//FIXME border!
-    }
-}
-
-static void release_buffer(AVCodecContext *avctx){
-    SnowContext *s = avctx->priv_data;
-    int i;
-
-    if(s->last_picture[s->max_ref_frames-1].data[0]){
-        avctx->release_buffer(avctx, &s->last_picture[s->max_ref_frames-1]);
-        for(i=0; i<9; i++)
-            if(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3])
-                av_free(s->halfpel_plane[s->max_ref_frames-1][1+i/3][i%3] - EDGE_WIDTH*(1+s->current_picture.linesize[i%3]));
-    }
-}
-
-static int frame_start(SnowContext *s){
-   AVFrame tmp;
-   int w= s->avctx->width; //FIXME round up to x16 ?
-   int h= s->avctx->height;
-
-    if(s->current_picture.data[0]){
-        s->dsp.draw_edges(s->current_picture.data[0], s->current_picture.linesize[0], w   , h   , EDGE_WIDTH  );
-        s->dsp.draw_edges(s->current_picture.data[1], s->current_picture.linesize[1], w>>1, h>>1, EDGE_WIDTH/2);
-        s->dsp.draw_edges(s->current_picture.data[2], s->current_picture.linesize[2], w>>1, h>>1, EDGE_WIDTH/2);
-    }
-
-    release_buffer(s->avctx);
-
-    tmp= s->last_picture[s->max_ref_frames-1];
-    memmove(s->last_picture+1, s->last_picture, (s->max_ref_frames-1)*sizeof(AVFrame));
-    memmove(s->halfpel_plane+1, s->halfpel_plane, (s->max_ref_frames-1)*sizeof(void*)*4*4);
-    if(USE_HALFPEL_PLANE && s->current_picture.data[0])
-        halfpel_interpol(s, s->halfpel_plane[0], &s->current_picture);
-    s->last_picture[0]= s->current_picture;
-    s->current_picture= tmp;
-
-    if(s->keyframe){
-        s->ref_frames= 0;
-    }else{
-        int i;
-        for(i=0; i<s->max_ref_frames && s->last_picture[i].data[0]; i++)
-            if(i && s->last_picture[i-1].key_frame)
-                break;
-        s->ref_frames= i;
-        if(s->ref_frames==0){
-            av_log(s->avctx,AV_LOG_ERROR, "No reference frames\n");
-            return -1;
-        }
-    }
-
-    s->current_picture.reference= 1;
-    if(s->avctx->get_buffer(s->avctx, &s->current_picture) < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    s->current_picture.key_frame= s->keyframe;
-
-    return 0;
-}
-
-static av_cold void common_end(SnowContext *s){
-    int plane_index, level, orientation, i;
-
-    av_freep(&s->spatial_dwt_buffer);
-    av_freep(&s->spatial_idwt_buffer);
-
-    s->m.me.temp= NULL;
-    av_freep(&s->m.me.scratchpad);
-    av_freep(&s->m.me.map);
-    av_freep(&s->m.me.score_map);
-    av_freep(&s->m.obmc_scratchpad);
-
-    av_freep(&s->block);
-    av_freep(&s->scratchbuf);
-
-    for(i=0; i<MAX_REF_FRAMES; i++){
-        av_freep(&s->ref_mvs[i]);
-        av_freep(&s->ref_scores[i]);
-        if(s->last_picture[i].data[0])
-            s->avctx->release_buffer(s->avctx, &s->last_picture[i]);
-    }
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        for(level=s->spatial_decomposition_count-1; level>=0; level--){
-            for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                SubBand *b= &s->plane[plane_index].band[level][orientation];
-
-                av_freep(&b->x_coeff);
-            }
-        }
-    }
-    if (s->mconly_picture.data[0])
-        s->avctx->release_buffer(s->avctx, &s->mconly_picture);
-    if (s->current_picture.data[0])
-        s->avctx->release_buffer(s->avctx, &s->current_picture);
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    avctx->pix_fmt= PIX_FMT_YUV420P;
-
-    common_init(avctx);
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt){
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    SnowContext *s = avctx->priv_data;
-    RangeCoder * const c= &s->c;
-    int bytes_read;
-    AVFrame *picture = data;
-    int level, orientation, plane_index;
-
-    ff_init_range_decoder(c, buf, buf_size);
-    ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
-    s->current_picture.pict_type= FF_I_TYPE; //FIXME I vs. P
-    if(decode_header(s)<0)
-        return -1;
-    common_init_after_header(avctx);
-
-    // realloc slice buffer for the case that spatial_decomposition_count changed
-    ff_slice_buffer_destroy(&s->sb);
-    ff_slice_buffer_init(&s->sb, s->plane[0].height, (MB_SIZE >> s->block_max_depth) + s->spatial_decomposition_count * 8 + 1, s->plane[0].width, s->spatial_idwt_buffer);
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        Plane *p= &s->plane[plane_index];
-        p->fast_mc= p->diag_mc && p->htaps==6 && p->hcoeff[0]==40
-                                              && p->hcoeff[1]==-10
-                                              && p->hcoeff[2]==2;
-    }
-
-    alloc_blocks(s);
-
-    if(frame_start(s) < 0)
-        return -1;
-    //keyframe flag duplication mess FIXME
-    if(avctx->debug&FF_DEBUG_PICT_INFO)
-        av_log(avctx, AV_LOG_ERROR, "keyframe:%d qlog:%d\n", s->keyframe, s->qlog);
-
-    decode_blocks(s);
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        Plane *p= &s->plane[plane_index];
-        int w= p->width;
-        int h= p->height;
-        int x, y;
-        int decode_state[MAX_DECOMPOSITIONS][4][1]; /* Stored state info for unpack_coeffs. 1 variable per instance. */
-
-        if(s->avctx->debug&2048){
-            memset(s->spatial_dwt_buffer, 0, sizeof(DWTELEM)*w*h);
-            predict_plane(s, s->spatial_idwt_buffer, plane_index, 1);
-
-            for(y=0; y<h; y++){
-                for(x=0; x<w; x++){
-                    int v= s->current_picture.data[plane_index][y*s->current_picture.linesize[plane_index] + x];
-                    s->mconly_picture.data[plane_index][y*s->mconly_picture.linesize[plane_index] + x]= v;
-                }
-            }
-        }
-
-        {
-        for(level=0; level<s->spatial_decomposition_count; level++){
-            for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                SubBand *b= &p->band[level][orientation];
-                unpack_coeffs(s, b, b->parent, orientation);
-            }
-        }
-        }
-
-        {
-        const int mb_h= s->b_height << s->block_max_depth;
-        const int block_size = MB_SIZE >> s->block_max_depth;
-        const int block_w    = plane_index ? block_size/2 : block_size;
-        int mb_y;
-        DWTCompose cs[MAX_DECOMPOSITIONS];
-        int yd=0, yq=0;
-        int y;
-        int end_y;
-
-        ff_spatial_idwt_buffered_init(cs, &s->sb, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count);
-        for(mb_y=0; mb_y<=mb_h; mb_y++){
-
-            int slice_starty = block_w*mb_y;
-            int slice_h = block_w*(mb_y+1);
-            if (!(s->keyframe || s->avctx->debug&512)){
-                slice_starty = FFMAX(0, slice_starty - (block_w >> 1));
-                slice_h -= (block_w >> 1);
-            }
-
-            for(level=0; level<s->spatial_decomposition_count; level++){
-                for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                    SubBand *b= &p->band[level][orientation];
-                    int start_y;
-                    int end_y;
-                    int our_mb_start = mb_y;
-                    int our_mb_end = (mb_y + 1);
-                    const int extra= 3;
-                    start_y = (mb_y ? ((block_w * our_mb_start) >> (s->spatial_decomposition_count - level)) + s->spatial_decomposition_count - level + extra: 0);
-                    end_y = (((block_w * our_mb_end) >> (s->spatial_decomposition_count - level)) + s->spatial_decomposition_count - level + extra);
-                    if (!(s->keyframe || s->avctx->debug&512)){
-                        start_y = FFMAX(0, start_y - (block_w >> (1+s->spatial_decomposition_count - level)));
-                        end_y = FFMAX(0, end_y - (block_w >> (1+s->spatial_decomposition_count - level)));
-                    }
-                    start_y = FFMIN(b->height, start_y);
-                    end_y = FFMIN(b->height, end_y);
-
-                    if (start_y != end_y){
-                        if (orientation == 0){
-                            SubBand * correlate_band = &p->band[0][0];
-                            int correlate_end_y = FFMIN(b->height, end_y + 1);
-                            int correlate_start_y = FFMIN(b->height, (start_y ? start_y + 1 : 0));
-                            decode_subband_slice_buffered(s, correlate_band, &s->sb, correlate_start_y, correlate_end_y, decode_state[0][0]);
-                            correlate_slice_buffered(s, &s->sb, correlate_band, correlate_band->ibuf, correlate_band->stride, 1, 0, correlate_start_y, correlate_end_y);
-                            dequantize_slice_buffered(s, &s->sb, correlate_band, correlate_band->ibuf, correlate_band->stride, start_y, end_y);
-                        }
-                        else
-                            decode_subband_slice_buffered(s, b, &s->sb, start_y, end_y, decode_state[level][orientation]);
-                    }
-                }
-            }
-
-            for(; yd<slice_h; yd+=4){
-                ff_spatial_idwt_buffered_slice(&s->dwt, cs, &s->sb, w, h, 1, s->spatial_decomposition_type, s->spatial_decomposition_count, yd);
-            }
-
-            if(s->qlog == LOSSLESS_QLOG){
-                for(; yq<slice_h && yq<h; yq++){
-                    IDWTELEM * line = slice_buffer_get_line(&s->sb, yq);
-                    for(x=0; x<w; x++){
-                        line[x] <<= FRAC_BITS;
-                    }
-                }
-            }
-
-            predict_slice_buffered(s, &s->sb, s->spatial_idwt_buffer, plane_index, 1, mb_y);
-
-            y = FFMIN(p->height, slice_starty);
-            end_y = FFMIN(p->height, slice_h);
-            while(y < end_y)
-                ff_slice_buffer_release(&s->sb, y++);
-        }
-
-        ff_slice_buffer_flush(&s->sb);
-        }
-
-    }
-
-    emms_c();
-
-    release_buffer(avctx);
-
-    if(!(s->avctx->debug&2048))
-        *picture= s->current_picture;
-    else
-        *picture= s->mconly_picture;
-
-    *data_size = sizeof(AVFrame);
-
-    bytes_read= c->bytestream - c->bytestream_start;
-    if(bytes_read ==0) av_log(s->avctx, AV_LOG_ERROR, "error at end of frame\n"); //FIXME
-
-    return bytes_read;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    SnowContext *s = avctx->priv_data;
-
-    ff_slice_buffer_destroy(&s->sb);
-
-    common_end(s);
-
-    return 0;
-}
-
-AVCodec snow_decoder = {
-    "snow",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SNOW,
-    sizeof(SnowContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Snow"),
-};
-
-#if CONFIG_SNOW_ENCODER
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    SnowContext *s = avctx->priv_data;
-    int plane_index;
-
-    if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
-        av_log(avctx, AV_LOG_ERROR, "This codec is under development, files encoded with it may not be decodable with future versions!!!\n"
-               "Use vstrict=-2 / -strict -2 to use it anyway.\n");
-        return -1;
-    }
-
-    if(avctx->prediction_method == DWT_97
-       && (avctx->flags & CODEC_FLAG_QSCALE)
-       && avctx->global_quality == 0){
-        av_log(avctx, AV_LOG_ERROR, "The 9/7 wavelet is incompatible with lossless mode.\n");
-        return -1;
-    }
-
-    s->spatial_decomposition_type= avctx->prediction_method; //FIXME add decorrelator type r transform_type
-
-    s->mv_scale       = (avctx->flags & CODEC_FLAG_QPEL) ? 2 : 4;
-    s->block_max_depth= (avctx->flags & CODEC_FLAG_4MV ) ? 1 : 0;
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        s->plane[plane_index].diag_mc= 1;
-        s->plane[plane_index].htaps= 6;
-        s->plane[plane_index].hcoeff[0]=  40;
-        s->plane[plane_index].hcoeff[1]= -10;
-        s->plane[plane_index].hcoeff[2]=   2;
-        s->plane[plane_index].fast_mc= 1;
-    }
-
-    common_init(avctx);
-    alloc_blocks(s);
-
-    s->version=0;
-
-    s->m.avctx   = avctx;
-    s->m.flags   = avctx->flags;
-    s->m.bit_rate= avctx->bit_rate;
-
-    s->m.me.temp      =
-    s->m.me.scratchpad= av_mallocz((avctx->width+64)*2*16*2*sizeof(uint8_t));
-    s->m.me.map       = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
-    s->m.me.score_map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
-    s->m.obmc_scratchpad= av_mallocz(MB_SIZE*MB_SIZE*12*sizeof(uint32_t));
-    h263_encode_init(&s->m); //mv_penalty
-
-    s->max_ref_frames = FFMAX(FFMIN(avctx->refs, MAX_REF_FRAMES), 1);
-
-    if(avctx->flags&CODEC_FLAG_PASS1){
-        if(!avctx->stats_out)
-            avctx->stats_out = av_mallocz(256);
-    }
-    if((avctx->flags&CODEC_FLAG_PASS2) || !(avctx->flags&CODEC_FLAG_QSCALE)){
-        if(ff_rate_control_init(&s->m) < 0)
-            return -1;
-    }
-    s->pass1_rc= !(avctx->flags & (CODEC_FLAG_QSCALE|CODEC_FLAG_PASS2));
-
-    avctx->coded_frame= &s->current_picture;
-    switch(avctx->pix_fmt){
-//    case PIX_FMT_YUV444P:
-//    case PIX_FMT_YUV422P:
-    case PIX_FMT_YUV420P:
-    case PIX_FMT_GRAY8:
-//    case PIX_FMT_YUV411P:
-//    case PIX_FMT_YUV410P:
-        s->colorspace_type= 0;
-        break;
-/*    case PIX_FMT_RGB32:
-        s->colorspace= 1;
-        break;*/
-    default:
-        av_log(avctx, AV_LOG_ERROR, "pixel format not supported\n");
-        return -1;
-    }
-//    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);
-    s->chroma_h_shift= 1;
-    s->chroma_v_shift= 1;
-
-    ff_set_cmp(&s->dsp, s->dsp.me_cmp, s->avctx->me_cmp);
-    ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, s->avctx->me_sub_cmp);
-
-    s->avctx->get_buffer(s->avctx, &s->input_picture);
-
-    if(s->avctx->me_method == ME_ITER){
-        int i;
-        int size= s->b_width * s->b_height << 2*s->block_max_depth;
-        for(i=0; i<s->max_ref_frames; i++){
-            s->ref_mvs[i]= av_mallocz(size*sizeof(int16_t[2]));
-            s->ref_scores[i]= av_mallocz(size*sizeof(uint32_t));
-        }
-    }
-
-    return 0;
-}
-
-//near copy & paste from dsputil, FIXME
-static int pix_sum(uint8_t * pix, int line_size, int w)
-{
-    int s, i, j;
-
-    s = 0;
-    for (i = 0; i < w; i++) {
-        for (j = 0; j < w; j++) {
-            s += pix[0];
-            pix ++;
-        }
-        pix += line_size - w;
-    }
-    return s;
-}
-
-//near copy & paste from dsputil, FIXME
-static int pix_norm1(uint8_t * pix, int line_size, int w)
-{
-    int s, i, j;
-    uint32_t *sq = ff_squareTbl + 256;
-
-    s = 0;
-    for (i = 0; i < w; i++) {
-        for (j = 0; j < w; j ++) {
-            s += sq[pix[0]];
-            pix ++;
-        }
-        pix += line_size - w;
-    }
-    return s;
-}
-
-//FIXME copy&paste
-#define P_LEFT P[1]
-#define P_TOP P[2]
-#define P_TOPRIGHT P[3]
-#define P_MEDIAN P[4]
-#define P_MV1 P[9]
-#define FLAG_QPEL   1 //must be 1
-
-static int encode_q_branch(SnowContext *s, int level, int x, int y){
-    uint8_t p_buffer[1024];
-    uint8_t i_buffer[1024];
-    uint8_t p_state[sizeof(s->block_state)];
-    uint8_t i_state[sizeof(s->block_state)];
-    RangeCoder pc, ic;
-    uint8_t *pbbak= s->c.bytestream;
-    uint8_t *pbbak_start= s->c.bytestream_start;
-    int score, score2, iscore, i_len, p_len, block_s, sum, base_bits;
-    const int w= s->b_width  << s->block_max_depth;
-    const int h= s->b_height << s->block_max_depth;
-    const int rem_depth= s->block_max_depth - level;
-    const int index= (x + y*w) << rem_depth;
-    const int block_w= 1<<(LOG2_MB_SIZE - level);
-    int trx= (x+1)<<rem_depth;
-    int try= (y+1)<<rem_depth;
-    const BlockNode *left  = x ? &s->block[index-1] : &null_block;
-    const BlockNode *top   = y ? &s->block[index-w] : &null_block;
-    const BlockNode *right = trx<w ? &s->block[index+1] : &null_block;
-    const BlockNode *bottom= try<h ? &s->block[index+w] : &null_block;
-    const BlockNode *tl    = y && x ? &s->block[index-w-1] : left;
-    const BlockNode *tr    = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt
-    int pl = left->color[0];
-    int pcb= left->color[1];
-    int pcr= left->color[2];
-    int pmx, pmy;
-    int mx=0, my=0;
-    int l,cr,cb;
-    const int stride= s->current_picture.linesize[0];
-    const int uvstride= s->current_picture.linesize[1];
-    uint8_t *current_data[3]= { s->input_picture.data[0] + (x + y*  stride)*block_w,
-                                s->input_picture.data[1] + (x + y*uvstride)*block_w/2,
-                                s->input_picture.data[2] + (x + y*uvstride)*block_w/2};
-    int P[10][2];
-    int16_t last_mv[3][2];
-    int qpel= !!(s->avctx->flags & CODEC_FLAG_QPEL); //unused
-    const int shift= 1+qpel;
-    MotionEstContext *c= &s->m.me;
-    int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
-    int mx_context= av_log2(2*FFABS(left->mx - top->mx));
-    int my_context= av_log2(2*FFABS(left->my - top->my));
-    int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
-    int ref, best_ref, ref_score, ref_mx, ref_my;
-
-    assert(sizeof(s->block_state) >= 256);
-    if(s->keyframe){
-        set_blocks(s, level, x, y, pl, pcb, pcr, 0, 0, 0, BLOCK_INTRA);
-        return 0;
-    }
-
-//    clip predictors / edge ?
-
-    P_LEFT[0]= left->mx;
-    P_LEFT[1]= left->my;
-    P_TOP [0]= top->mx;
-    P_TOP [1]= top->my;
-    P_TOPRIGHT[0]= tr->mx;
-    P_TOPRIGHT[1]= tr->my;
-
-    last_mv[0][0]= s->block[index].mx;
-    last_mv[0][1]= s->block[index].my;
-    last_mv[1][0]= right->mx;
-    last_mv[1][1]= right->my;
-    last_mv[2][0]= bottom->mx;
-    last_mv[2][1]= bottom->my;
-
-    s->m.mb_stride=2;
-    s->m.mb_x=
-    s->m.mb_y= 0;
-    c->skip= 0;
-
-    assert(c->  stride ==   stride);
-    assert(c->uvstride == uvstride);
-
-    c->penalty_factor    = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
-    c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
-    c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
-    c->current_mv_penalty= c->mv_penalty[s->m.f_code=1] + MAX_MV;
-
-    c->xmin = - x*block_w - 16+3;
-    c->ymin = - y*block_w - 16+3;
-    c->xmax = - (x+1)*block_w + (w<<(LOG2_MB_SIZE - s->block_max_depth)) + 16-3;
-    c->ymax = - (y+1)*block_w + (h<<(LOG2_MB_SIZE - s->block_max_depth)) + 16-3;
-
-    if(P_LEFT[0]     > (c->xmax<<shift)) P_LEFT[0]    = (c->xmax<<shift);
-    if(P_LEFT[1]     > (c->ymax<<shift)) P_LEFT[1]    = (c->ymax<<shift);
-    if(P_TOP[0]      > (c->xmax<<shift)) P_TOP[0]     = (c->xmax<<shift);
-    if(P_TOP[1]      > (c->ymax<<shift)) P_TOP[1]     = (c->ymax<<shift);
-    if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
-    if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift); //due to pmx no clip
-    if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
-
-    P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
-    P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
-
-    if (!y) {
-        c->pred_x= P_LEFT[0];
-        c->pred_y= P_LEFT[1];
-    } else {
-        c->pred_x = P_MEDIAN[0];
-        c->pred_y = P_MEDIAN[1];
-    }
-
-    score= INT_MAX;
-    best_ref= 0;
-    for(ref=0; ref<s->ref_frames; ref++){
-        init_ref(c, current_data, s->last_picture[ref].data, NULL, block_w*x, block_w*y, 0);
-
-        ref_score= ff_epzs_motion_search(&s->m, &ref_mx, &ref_my, P, 0, /*ref_index*/ 0, last_mv,
-                                         (1<<16)>>shift, level-LOG2_MB_SIZE+4, block_w);
-
-        assert(ref_mx >= c->xmin);
-        assert(ref_mx <= c->xmax);
-        assert(ref_my >= c->ymin);
-        assert(ref_my <= c->ymax);
-
-        ref_score= c->sub_motion_search(&s->m, &ref_mx, &ref_my, ref_score, 0, 0, level-LOG2_MB_SIZE+4, block_w);
-        ref_score= ff_get_mb_score(&s->m, ref_mx, ref_my, 0, 0, level-LOG2_MB_SIZE+4, block_w, 0);
-        ref_score+= 2*av_log2(2*ref)*c->penalty_factor;
-        if(s->ref_mvs[ref]){
-            s->ref_mvs[ref][index][0]= ref_mx;
-            s->ref_mvs[ref][index][1]= ref_my;
-            s->ref_scores[ref][index]= ref_score;
-        }
-        if(score > ref_score){
-            score= ref_score;
-            best_ref= ref;
-            mx= ref_mx;
-            my= ref_my;
-        }
-    }
-    //FIXME if mb_cmp != SSE then intra cannot be compared currently and mb_penalty vs. lambda2
-
-  //  subpel search
-    base_bits= get_rac_count(&s->c) - 8*(s->c.bytestream - s->c.bytestream_start);
-    pc= s->c;
-    pc.bytestream_start=
-    pc.bytestream= p_buffer; //FIXME end/start? and at the other stoo
-    memcpy(p_state, s->block_state, sizeof(s->block_state));
-
-    if(level!=s->block_max_depth)
-        put_rac(&pc, &p_state[4 + s_context], 1);
-    put_rac(&pc, &p_state[1 + left->type + top->type], 0);
-    if(s->ref_frames > 1)
-        put_symbol(&pc, &p_state[128 + 1024 + 32*ref_context], best_ref, 0);
-    pred_mv(s, &pmx, &pmy, best_ref, left, top, tr);
-    put_symbol(&pc, &p_state[128 + 32*(mx_context + 16*!!best_ref)], mx - pmx, 1);
-    put_symbol(&pc, &p_state[128 + 32*(my_context + 16*!!best_ref)], my - pmy, 1);
-    p_len= pc.bytestream - pc.bytestream_start;
-    score += (s->lambda2*(get_rac_count(&pc)-base_bits))>>FF_LAMBDA_SHIFT;
-
-    block_s= block_w*block_w;
-    sum = pix_sum(current_data[0], stride, block_w);
-    l= (sum + block_s/2)/block_s;
-    iscore = pix_norm1(current_data[0], stride, block_w) - 2*l*sum + l*l*block_s;
-
-    block_s= block_w*block_w>>2;
-    sum = pix_sum(current_data[1], uvstride, block_w>>1);
-    cb= (sum + block_s/2)/block_s;
-//    iscore += pix_norm1(&current_mb[1][0], uvstride, block_w>>1) - 2*cb*sum + cb*cb*block_s;
-    sum = pix_sum(current_data[2], uvstride, block_w>>1);
-    cr= (sum + block_s/2)/block_s;
-//    iscore += pix_norm1(&current_mb[2][0], uvstride, block_w>>1) - 2*cr*sum + cr*cr*block_s;
-
-    ic= s->c;
-    ic.bytestream_start=
-    ic.bytestream= i_buffer; //FIXME end/start? and at the other stoo
-    memcpy(i_state, s->block_state, sizeof(s->block_state));
-    if(level!=s->block_max_depth)
-        put_rac(&ic, &i_state[4 + s_context], 1);
-    put_rac(&ic, &i_state[1 + left->type + top->type], 1);
-    put_symbol(&ic, &i_state[32],  l-pl , 1);
-    put_symbol(&ic, &i_state[64], cb-pcb, 1);
-    put_symbol(&ic, &i_state[96], cr-pcr, 1);
-    i_len= ic.bytestream - ic.bytestream_start;
-    iscore += (s->lambda2*(get_rac_count(&ic)-base_bits))>>FF_LAMBDA_SHIFT;
-
-//    assert(score==256*256*256*64-1);
-    assert(iscore < 255*255*256 + s->lambda2*10);
-    assert(iscore >= 0);
-    assert(l>=0 && l<=255);
-    assert(pl>=0 && pl<=255);
-
-    if(level==0){
-        int varc= iscore >> 8;
-        int vard= score >> 8;
-        if (vard <= 64 || vard < varc)
-            c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
-        else
-            c->scene_change_score+= s->m.qscale;
-    }
-
-    if(level!=s->block_max_depth){
-        put_rac(&s->c, &s->block_state[4 + s_context], 0);
-        score2 = encode_q_branch(s, level+1, 2*x+0, 2*y+0);
-        score2+= encode_q_branch(s, level+1, 2*x+1, 2*y+0);
-        score2+= encode_q_branch(s, level+1, 2*x+0, 2*y+1);
-        score2+= encode_q_branch(s, level+1, 2*x+1, 2*y+1);
-        score2+= s->lambda2>>FF_LAMBDA_SHIFT; //FIXME exact split overhead
-
-        if(score2 < score && score2 < iscore)
-            return score2;
-    }
-
-    if(iscore < score){
-        pred_mv(s, &pmx, &pmy, 0, left, top, tr);
-        memcpy(pbbak, i_buffer, i_len);
-        s->c= ic;
-        s->c.bytestream_start= pbbak_start;
-        s->c.bytestream= pbbak + i_len;
-        set_blocks(s, level, x, y, l, cb, cr, pmx, pmy, 0, BLOCK_INTRA);
-        memcpy(s->block_state, i_state, sizeof(s->block_state));
-        return iscore;
-    }else{
-        memcpy(pbbak, p_buffer, p_len);
-        s->c= pc;
-        s->c.bytestream_start= pbbak_start;
-        s->c.bytestream= pbbak + p_len;
-        set_blocks(s, level, x, y, pl, pcb, pcr, mx, my, best_ref, 0);
-        memcpy(s->block_state, p_state, sizeof(s->block_state));
-        return score;
-    }
-}
-
-static void encode_q_branch2(SnowContext *s, int level, int x, int y){
-    const int w= s->b_width  << s->block_max_depth;
-    const int rem_depth= s->block_max_depth - level;
-    const int index= (x + y*w) << rem_depth;
-    int trx= (x+1)<<rem_depth;
-    BlockNode *b= &s->block[index];
-    const BlockNode *left  = x ? &s->block[index-1] : &null_block;
-    const BlockNode *top   = y ? &s->block[index-w] : &null_block;
-    const BlockNode *tl    = y && x ? &s->block[index-w-1] : left;
-    const BlockNode *tr    = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; //FIXME use lt
-    int pl = left->color[0];
-    int pcb= left->color[1];
-    int pcr= left->color[2];
-    int pmx, pmy;
-    int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref);
-    int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 16*!!b->ref;
-    int my_context= av_log2(2*FFABS(left->my - top->my)) + 16*!!b->ref;
-    int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
-
-    if(s->keyframe){
-        set_blocks(s, level, x, y, pl, pcb, pcr, 0, 0, 0, BLOCK_INTRA);
-        return;
-    }
-
-    if(level!=s->block_max_depth){
-        if(same_block(b,b+1) && same_block(b,b+w) && same_block(b,b+w+1)){
-            put_rac(&s->c, &s->block_state[4 + s_context], 1);
-        }else{
-            put_rac(&s->c, &s->block_state[4 + s_context], 0);
-            encode_q_branch2(s, level+1, 2*x+0, 2*y+0);
-            encode_q_branch2(s, level+1, 2*x+1, 2*y+0);
-            encode_q_branch2(s, level+1, 2*x+0, 2*y+1);
-            encode_q_branch2(s, level+1, 2*x+1, 2*y+1);
-            return;
-        }
-    }
-    if(b->type & BLOCK_INTRA){
-        pred_mv(s, &pmx, &pmy, 0, left, top, tr);
-        put_rac(&s->c, &s->block_state[1 + (left->type&1) + (top->type&1)], 1);
-        put_symbol(&s->c, &s->block_state[32], b->color[0]-pl , 1);
-        put_symbol(&s->c, &s->block_state[64], b->color[1]-pcb, 1);
-        put_symbol(&s->c, &s->block_state[96], b->color[2]-pcr, 1);
-        set_blocks(s, level, x, y, b->color[0], b->color[1], b->color[2], pmx, pmy, 0, BLOCK_INTRA);
-    }else{
-        pred_mv(s, &pmx, &pmy, b->ref, left, top, tr);
-        put_rac(&s->c, &s->block_state[1 + (left->type&1) + (top->type&1)], 0);
-        if(s->ref_frames > 1)
-            put_symbol(&s->c, &s->block_state[128 + 1024 + 32*ref_context], b->ref, 0);
-        put_symbol(&s->c, &s->block_state[128 + 32*mx_context], b->mx - pmx, 1);
-        put_symbol(&s->c, &s->block_state[128 + 32*my_context], b->my - pmy, 1);
-        set_blocks(s, level, x, y, pl, pcb, pcr, b->mx, b->my, b->ref, 0);
-    }
-}
-
-static int get_dc(SnowContext *s, int mb_x, int mb_y, int plane_index){
-    int i, x2, y2;
-    Plane *p= &s->plane[plane_index];
-    const int block_size = MB_SIZE >> s->block_max_depth;
-    const int block_w    = plane_index ? block_size/2 : block_size;
-    const uint8_t *obmc  = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
-    const int obmc_stride= plane_index ? block_size : 2*block_size;
-    const int ref_stride= s->current_picture.linesize[plane_index];
-    uint8_t *src= s-> input_picture.data[plane_index];
-    IDWTELEM *dst= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4; //FIXME change to unsigned
-    const int b_stride = s->b_width << s->block_max_depth;
-    const int w= p->width;
-    const int h= p->height;
-    int index= mb_x + mb_y*b_stride;
-    BlockNode *b= &s->block[index];
-    BlockNode backup= *b;
-    int ab=0;
-    int aa=0;
-
-    b->type|= BLOCK_INTRA;
-    b->color[plane_index]= 0;
-    memset(dst, 0, obmc_stride*obmc_stride*sizeof(IDWTELEM));
-
-    for(i=0; i<4; i++){
-        int mb_x2= mb_x + (i &1) - 1;
-        int mb_y2= mb_y + (i>>1) - 1;
-        int x= block_w*mb_x2 + block_w/2;
-        int y= block_w*mb_y2 + block_w/2;
-
-        add_yblock(s, 0, NULL, dst + ((i&1)+(i>>1)*obmc_stride)*block_w, NULL, obmc,
-                    x, y, block_w, block_w, w, h, obmc_stride, ref_stride, obmc_stride, mb_x2, mb_y2, 0, 0, plane_index);
-
-        for(y2= FFMAX(y, 0); y2<FFMIN(h, y+block_w); y2++){
-            for(x2= FFMAX(x, 0); x2<FFMIN(w, x+block_w); x2++){
-                int index= x2-(block_w*mb_x - block_w/2) + (y2-(block_w*mb_y - block_w/2))*obmc_stride;
-                int obmc_v= obmc[index];
-                int d;
-                if(y<0) obmc_v += obmc[index + block_w*obmc_stride];
-                if(x<0) obmc_v += obmc[index + block_w];
-                if(y+block_w>h) obmc_v += obmc[index - block_w*obmc_stride];
-                if(x+block_w>w) obmc_v += obmc[index - block_w];
-                //FIXME precalculate this or simplify it somehow else
-
-                d = -dst[index] + (1<<(FRAC_BITS-1));
-                dst[index] = d;
-                ab += (src[x2 + y2*ref_stride] - (d>>FRAC_BITS)) * obmc_v;
-                aa += obmc_v * obmc_v; //FIXME precalculate this
-            }
-        }
-    }
-    *b= backup;
-
-    return av_clip(((ab<<LOG2_OBMC_MAX) + aa/2)/aa, 0, 255); //FIXME we should not need clipping
-}
-
-static inline int get_block_bits(SnowContext *s, int x, int y, int w){
-    const int b_stride = s->b_width << s->block_max_depth;
-    const int b_height = s->b_height<< s->block_max_depth;
-    int index= x + y*b_stride;
-    const BlockNode *b     = &s->block[index];
-    const BlockNode *left  = x ? &s->block[index-1] : &null_block;
-    const BlockNode *top   = y ? &s->block[index-b_stride] : &null_block;
-    const BlockNode *tl    = y && x ? &s->block[index-b_stride-1] : left;
-    const BlockNode *tr    = y && x+w<b_stride ? &s->block[index-b_stride+w] : tl;
-    int dmx, dmy;
-//  int mx_context= av_log2(2*FFABS(left->mx - top->mx));
-//  int my_context= av_log2(2*FFABS(left->my - top->my));
-
-    if(x<0 || x>=b_stride || y>=b_height)
-        return 0;
-/*
-1            0      0
-01X          1-2    1
-001XX        3-6    2-3
-0001XXX      7-14   4-7
-00001XXXX   15-30   8-15
-*/
-//FIXME try accurate rate
-//FIXME intra and inter predictors if surrounding blocks are not the same type
-    if(b->type & BLOCK_INTRA){
-        return 3+2*( av_log2(2*FFABS(left->color[0] - b->color[0]))
-                   + av_log2(2*FFABS(left->color[1] - b->color[1]))
-                   + av_log2(2*FFABS(left->color[2] - b->color[2])));
-    }else{
-        pred_mv(s, &dmx, &dmy, b->ref, left, top, tr);
-        dmx-= b->mx;
-        dmy-= b->my;
-        return 2*(1 + av_log2(2*FFABS(dmx)) //FIXME kill the 2* can be merged in lambda
-                    + av_log2(2*FFABS(dmy))
-                    + av_log2(2*b->ref));
-    }
-}
-
-static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, const uint8_t *obmc_edged){
-    Plane *p= &s->plane[plane_index];
-    const int block_size = MB_SIZE >> s->block_max_depth;
-    const int block_w    = plane_index ? block_size/2 : block_size;
-    const int obmc_stride= plane_index ? block_size : 2*block_size;
-    const int ref_stride= s->current_picture.linesize[plane_index];
-    uint8_t *dst= s->current_picture.data[plane_index];
-    uint8_t *src= s->  input_picture.data[plane_index];
-    IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4;
-    uint8_t *cur = s->scratchbuf;
-    uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)];
-    const int b_stride = s->b_width << s->block_max_depth;
-    const int b_height = s->b_height<< s->block_max_depth;
-    const int w= p->width;
-    const int h= p->height;
-    int distortion;
-    int rate= 0;
-    const int penalty_factor= get_penalty_factor(s->lambda, s->lambda2, s->avctx->me_cmp);
-    int sx= block_w*mb_x - block_w/2;
-    int sy= block_w*mb_y - block_w/2;
-    int x0= FFMAX(0,-sx);
-    int y0= FFMAX(0,-sy);
-    int x1= FFMIN(block_w*2, w-sx);
-    int y1= FFMIN(block_w*2, h-sy);
-    int i,x,y;
-
-    pred_block(s, cur, tmp, ref_stride, sx, sy, block_w*2, block_w*2, &s->block[mb_x + mb_y*b_stride], plane_index, w, h);
-
-    for(y=y0; y<y1; y++){
-        const uint8_t *obmc1= obmc_edged + y*obmc_stride;
-        const IDWTELEM *pred1 = pred + y*obmc_stride;
-        uint8_t *cur1 = cur + y*ref_stride;
-        uint8_t *dst1 = dst + sx + (sy+y)*ref_stride;
-        for(x=x0; x<x1; x++){
-#if FRAC_BITS >= LOG2_OBMC_MAX
-            int v = (cur1[x] * obmc1[x]) << (FRAC_BITS - LOG2_OBMC_MAX);
-#else
-            int v = (cur1[x] * obmc1[x] + (1<<(LOG2_OBMC_MAX - FRAC_BITS-1))) >> (LOG2_OBMC_MAX - FRAC_BITS);
-#endif
-            v = (v + pred1[x]) >> FRAC_BITS;
-            if(v&(~255)) v= ~(v>>31);
-            dst1[x] = v;
-        }
-    }
-
-    /* copy the regions where obmc[] = (uint8_t)256 */
-    if(LOG2_OBMC_MAX == 8
-        && (mb_x == 0 || mb_x == b_stride-1)
-        && (mb_y == 0 || mb_y == b_height-1)){
-        if(mb_x == 0)
-            x1 = block_w;
-        else
-            x0 = block_w;
-        if(mb_y == 0)
-            y1 = block_w;
-        else
-            y0 = block_w;
-        for(y=y0; y<y1; y++)
-            memcpy(dst + sx+x0 + (sy+y)*ref_stride, cur + x0 + y*ref_stride, x1-x0);
-    }
-
-    if(block_w==16){
-        /* FIXME rearrange dsputil to fit 32x32 cmp functions */
-        /* FIXME check alignment of the cmp wavelet vs the encoding wavelet */
-        /* FIXME cmps overlap but do not cover the wavelet's whole support.
-         * So improving the score of one block is not strictly guaranteed
-         * to improve the score of the whole frame, thus iterative motion
-         * estimation does not always converge. */
-        if(s->avctx->me_cmp == FF_CMP_W97)
-            distortion = ff_w97_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32);
-        else if(s->avctx->me_cmp == FF_CMP_W53)
-            distortion = ff_w53_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32);
-        else{
-            distortion = 0;
-            for(i=0; i<4; i++){
-                int off = sx+16*(i&1) + (sy+16*(i>>1))*ref_stride;
-                distortion += s->dsp.me_cmp[0](&s->m, src + off, dst + off, ref_stride, 16);
-            }
-        }
-    }else{
-        assert(block_w==8);
-        distortion = s->dsp.me_cmp[0](&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, block_w*2);
-    }
-
-    if(plane_index==0){
-        for(i=0; i<4; i++){
-/* ..RRr
- * .RXx.
- * rxx..
- */
-            rate += get_block_bits(s, mb_x + (i&1) - (i>>1), mb_y + (i>>1), 1);
-        }
-        if(mb_x == b_stride-2)
-            rate += get_block_bits(s, mb_x + 1, mb_y + 1, 1);
-    }
-    return distortion + rate*penalty_factor;
-}
-
-static int get_4block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index){
-    int i, y2;
-    Plane *p= &s->plane[plane_index];
-    const int block_size = MB_SIZE >> s->block_max_depth;
-    const int block_w    = plane_index ? block_size/2 : block_size;
-    const uint8_t *obmc  = plane_index ? obmc_tab[s->block_max_depth+1] : obmc_tab[s->block_max_depth];
-    const int obmc_stride= plane_index ? block_size : 2*block_size;
-    const int ref_stride= s->current_picture.linesize[plane_index];
-    uint8_t *dst= s->current_picture.data[plane_index];
-    uint8_t *src= s-> input_picture.data[plane_index];
-    //FIXME zero_dst is const but add_yblock changes dst if add is 0 (this is never the case for dst=zero_dst
-    // const has only been removed from zero_dst to suppress a warning
-    static IDWTELEM zero_dst[4096]; //FIXME
-    const int b_stride = s->b_width << s->block_max_depth;
-    const int w= p->width;
-    const int h= p->height;
-    int distortion= 0;
-    int rate= 0;
-    const int penalty_factor= get_penalty_factor(s->lambda, s->lambda2, s->avctx->me_cmp);
-
-    for(i=0; i<9; i++){
-        int mb_x2= mb_x + (i%3) - 1;
-        int mb_y2= mb_y + (i/3) - 1;
-        int x= block_w*mb_x2 + block_w/2;
-        int y= block_w*mb_y2 + block_w/2;
-
-        add_yblock(s, 0, NULL, zero_dst, dst, obmc,
-                   x, y, block_w, block_w, w, h, /*dst_stride*/0, ref_stride, obmc_stride, mb_x2, mb_y2, 1, 1, plane_index);
-
-        //FIXME find a cleaner/simpler way to skip the outside stuff
-        for(y2= y; y2<0; y2++)
-            memcpy(dst + x + y2*ref_stride, src + x + y2*ref_stride, block_w);
-        for(y2= h; y2<y+block_w; y2++)
-            memcpy(dst + x + y2*ref_stride, src + x + y2*ref_stride, block_w);
-        if(x<0){
-            for(y2= y; y2<y+block_w; y2++)
-                memcpy(dst + x + y2*ref_stride, src + x + y2*ref_stride, -x);
-        }
-        if(x+block_w > w){
-            for(y2= y; y2<y+block_w; y2++)
-                memcpy(dst + w + y2*ref_stride, src + w + y2*ref_stride, x+block_w - w);
-        }
-
-        assert(block_w== 8 || block_w==16);
-        distortion += s->dsp.me_cmp[block_w==8](&s->m, src + x + y*ref_stride, dst + x + y*ref_stride, ref_stride, block_w);
-    }
-
-    if(plane_index==0){
-        BlockNode *b= &s->block[mb_x+mb_y*b_stride];
-        int merged= same_block(b,b+1) && same_block(b,b+b_stride) && same_block(b,b+b_stride+1);
-
-/* ..RRRr
- * .RXXx.
- * .RXXx.
- * rxxx.
- */
-        if(merged)
-            rate = get_block_bits(s, mb_x, mb_y, 2);
-        for(i=merged?4:0; i<9; i++){
-            static const int dxy[9][2] = {{0,0},{1,0},{0,1},{1,1},{2,0},{2,1},{-1,2},{0,2},{1,2}};
-            rate += get_block_bits(s, mb_x + dxy[i][0], mb_y + dxy[i][1], 1);
-        }
-    }
-    return distortion + rate*penalty_factor;
-}
-
-static int encode_subband_c0run(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTELEM *parent, int stride, int orientation){
-    const int w= b->width;
-    const int h= b->height;
-    int x, y;
-
-    if(1){
-        int run=0;
-        int runs[w*h];
-        int run_index=0;
-        int max_index;
-
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int v, p=0;
-                int /*ll=0, */l=0, lt=0, t=0, rt=0;
-                v= src[x + y*stride];
-
-                if(y){
-                    t= src[x + (y-1)*stride];
-                    if(x){
-                        lt= src[x - 1 + (y-1)*stride];
-                    }
-                    if(x + 1 < w){
-                        rt= src[x + 1 + (y-1)*stride];
-                    }
-                }
-                if(x){
-                    l= src[x - 1 + y*stride];
-                    /*if(x > 1){
-                        if(orientation==1) ll= src[y + (x-2)*stride];
-                        else               ll= src[x - 2 + y*stride];
-                    }*/
-                }
-                if(parent){
-                    int px= x>>1;
-                    int py= y>>1;
-                    if(px<b->parent->width && py<b->parent->height)
-                        p= parent[px + py*2*stride];
-                }
-                if(!(/*ll|*/l|lt|t|rt|p)){
-                    if(v){
-                        runs[run_index++]= run;
-                        run=0;
-                    }else{
-                        run++;
-                    }
-                }
-            }
-        }
-        max_index= run_index;
-        runs[run_index++]= run;
-        run_index=0;
-        run= runs[run_index++];
-
-        put_symbol2(&s->c, b->state[30], max_index, 0);
-        if(run_index <= max_index)
-            put_symbol2(&s->c, b->state[1], run, 3);
-
-        for(y=0; y<h; y++){
-            if(s->c.bytestream_end - s->c.bytestream < w*40){
-                av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                return -1;
-            }
-            for(x=0; x<w; x++){
-                int v, p=0;
-                int /*ll=0, */l=0, lt=0, t=0, rt=0;
-                v= src[x + y*stride];
-
-                if(y){
-                    t= src[x + (y-1)*stride];
-                    if(x){
-                        lt= src[x - 1 + (y-1)*stride];
-                    }
-                    if(x + 1 < w){
-                        rt= src[x + 1 + (y-1)*stride];
-                    }
-                }
-                if(x){
-                    l= src[x - 1 + y*stride];
-                    /*if(x > 1){
-                        if(orientation==1) ll= src[y + (x-2)*stride];
-                        else               ll= src[x - 2 + y*stride];
-                    }*/
-                }
-                if(parent){
-                    int px= x>>1;
-                    int py= y>>1;
-                    if(px<b->parent->width && py<b->parent->height)
-                        p= parent[px + py*2*stride];
-                }
-                if(/*ll|*/l|lt|t|rt|p){
-                    int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p));
-
-                    put_rac(&s->c, &b->state[0][context], !!v);
-                }else{
-                    if(!run){
-                        run= runs[run_index++];
-
-                        if(run_index <= max_index)
-                            put_symbol2(&s->c, b->state[1], run, 3);
-                        assert(v);
-                    }else{
-                        run--;
-                        assert(!v);
-                    }
-                }
-                if(v){
-                    int context= av_log2(/*FFABS(ll) + */3*FFABS(l) + FFABS(lt) + 2*FFABS(t) + FFABS(rt) + FFABS(p));
-                    int l2= 2*FFABS(l) + (l<0);
-                    int t2= 2*FFABS(t) + (t<0);
-
-                    put_symbol2(&s->c, b->state[context + 2], FFABS(v)-1, context-4);
-                    put_rac(&s->c, &b->state[0][16 + 1 + 3 + quant3bA[l2&0xFF] + 3*quant3bA[t2&0xFF]], v<0);
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-static int encode_subband(SnowContext *s, SubBand *b, IDWTELEM *src, IDWTELEM *parent, int stride, int orientation){
-//    encode_subband_qtree(s, b, src, parent, stride, orientation);
-//    encode_subband_z0run(s, b, src, parent, stride, orientation);
-    return encode_subband_c0run(s, b, src, parent, stride, orientation);
-//    encode_subband_dzr(s, b, src, parent, stride, orientation);
-}
-
-static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){
-    const int b_stride= s->b_width << s->block_max_depth;
-    BlockNode *block= &s->block[mb_x + mb_y * b_stride];
-    BlockNode backup= *block;
-    int rd, index, value;
-
-    assert(mb_x>=0 && mb_y>=0);
-    assert(mb_x<b_stride);
-
-    if(intra){
-        block->color[0] = p[0];
-        block->color[1] = p[1];
-        block->color[2] = p[2];
-        block->type |= BLOCK_INTRA;
-    }else{
-        index= (p[0] + 31*p[1]) & (ME_CACHE_SIZE-1);
-        value= s->me_cache_generation + (p[0]>>10) + (p[1]<<6) + (block->ref<<12);
-        if(s->me_cache[index] == value)
-            return 0;
-        s->me_cache[index]= value;
-
-        block->mx= p[0];
-        block->my= p[1];
-        block->type &= ~BLOCK_INTRA;
-    }
-
-    rd= get_block_rd(s, mb_x, mb_y, 0, obmc_edged);
-
-//FIXME chroma
-    if(rd < *best_rd){
-        *best_rd= rd;
-        return 1;
-    }else{
-        *block= backup;
-        return 0;
-    }
-}
-
-/* special case for int[2] args we discard afterwards,
- * fixes compilation problem with gcc 2.95 */
-static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){
-    int p[2] = {p0, p1};
-    return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd);
-}
-
-static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, int ref, int *best_rd){
-    const int b_stride= s->b_width << s->block_max_depth;
-    BlockNode *block= &s->block[mb_x + mb_y * b_stride];
-    BlockNode backup[4]= {block[0], block[1], block[b_stride], block[b_stride+1]};
-    int rd, index, value;
-
-    assert(mb_x>=0 && mb_y>=0);
-    assert(mb_x<b_stride);
-    assert(((mb_x|mb_y)&1) == 0);
-
-    index= (p0 + 31*p1) & (ME_CACHE_SIZE-1);
-    value= s->me_cache_generation + (p0>>10) + (p1<<6) + (block->ref<<12);
-    if(s->me_cache[index] == value)
-        return 0;
-    s->me_cache[index]= value;
-
-    block->mx= p0;
-    block->my= p1;
-    block->ref= ref;
-    block->type &= ~BLOCK_INTRA;
-    block[1]= block[b_stride]= block[b_stride+1]= *block;
-
-    rd= get_4block_rd(s, mb_x, mb_y, 0);
-
-//FIXME chroma
-    if(rd < *best_rd){
-        *best_rd= rd;
-        return 1;
-    }else{
-        block[0]= backup[0];
-        block[1]= backup[1];
-        block[b_stride]= backup[2];
-        block[b_stride+1]= backup[3];
-        return 0;
-    }
-}
-
-static void iterative_me(SnowContext *s){
-    int pass, mb_x, mb_y;
-    const int b_width = s->b_width  << s->block_max_depth;
-    const int b_height= s->b_height << s->block_max_depth;
-    const int b_stride= b_width;
-    int color[3];
-
-    {
-        RangeCoder r = s->c;
-        uint8_t state[sizeof(s->block_state)];
-        memcpy(state, s->block_state, sizeof(s->block_state));
-        for(mb_y= 0; mb_y<s->b_height; mb_y++)
-            for(mb_x= 0; mb_x<s->b_width; mb_x++)
-                encode_q_branch(s, 0, mb_x, mb_y);
-        s->c = r;
-        memcpy(s->block_state, state, sizeof(s->block_state));
-    }
-
-    for(pass=0; pass<25; pass++){
-        int change= 0;
-
-        for(mb_y= 0; mb_y<b_height; mb_y++){
-            for(mb_x= 0; mb_x<b_width; mb_x++){
-                int dia_change, i, j, ref;
-                int best_rd= INT_MAX, ref_rd;
-                BlockNode backup, ref_b;
-                const int index= mb_x + mb_y * b_stride;
-                BlockNode *block= &s->block[index];
-                BlockNode *tb =                   mb_y            ? &s->block[index-b_stride  ] : NULL;
-                BlockNode *lb = mb_x                              ? &s->block[index         -1] : NULL;
-                BlockNode *rb = mb_x+1<b_width                    ? &s->block[index         +1] : NULL;
-                BlockNode *bb =                   mb_y+1<b_height ? &s->block[index+b_stride  ] : NULL;
-                BlockNode *tlb= mb_x           && mb_y            ? &s->block[index-b_stride-1] : NULL;
-                BlockNode *trb= mb_x+1<b_width && mb_y            ? &s->block[index-b_stride+1] : NULL;
-                BlockNode *blb= mb_x           && mb_y+1<b_height ? &s->block[index+b_stride-1] : NULL;
-                BlockNode *brb= mb_x+1<b_width && mb_y+1<b_height ? &s->block[index+b_stride+1] : NULL;
-                const int b_w= (MB_SIZE >> s->block_max_depth);
-                uint8_t obmc_edged[b_w*2][b_w*2];
-
-                if(pass && (block->type & BLOCK_OPT))
-                    continue;
-                block->type |= BLOCK_OPT;
-
-                backup= *block;
-
-                if(!s->me_cache_generation)
-                    memset(s->me_cache, 0, sizeof(s->me_cache));
-                s->me_cache_generation += 1<<22;
-
-                //FIXME precalculate
-                {
-                    int x, y;
-                    memcpy(obmc_edged, obmc_tab[s->block_max_depth], b_w*b_w*4);
-                    if(mb_x==0)
-                        for(y=0; y<b_w*2; y++)
-                            memset(obmc_edged[y], obmc_edged[y][0] + obmc_edged[y][b_w-1], b_w);
-                    if(mb_x==b_stride-1)
-                        for(y=0; y<b_w*2; y++)
-                            memset(obmc_edged[y]+b_w, obmc_edged[y][b_w] + obmc_edged[y][b_w*2-1], b_w);
-                    if(mb_y==0){
-                        for(x=0; x<b_w*2; x++)
-                            obmc_edged[0][x] += obmc_edged[b_w-1][x];
-                        for(y=1; y<b_w; y++)
-                            memcpy(obmc_edged[y], obmc_edged[0], b_w*2);
-                    }
-                    if(mb_y==b_height-1){
-                        for(x=0; x<b_w*2; x++)
-                            obmc_edged[b_w*2-1][x] += obmc_edged[b_w][x];
-                        for(y=b_w; y<b_w*2-1; y++)
-                            memcpy(obmc_edged[y], obmc_edged[b_w*2-1], b_w*2);
-                    }
-                }
-
-                //skip stuff outside the picture
-                if(mb_x==0 || mb_y==0 || mb_x==b_width-1 || mb_y==b_height-1){
-                    uint8_t *src= s->  input_picture.data[0];
-                    uint8_t *dst= s->current_picture.data[0];
-                    const int stride= s->current_picture.linesize[0];
-                    const int block_w= MB_SIZE >> s->block_max_depth;
-                    const int sx= block_w*mb_x - block_w/2;
-                    const int sy= block_w*mb_y - block_w/2;
-                    const int w= s->plane[0].width;
-                    const int h= s->plane[0].height;
-                    int y;
-
-                    for(y=sy; y<0; y++)
-                        memcpy(dst + sx + y*stride, src + sx + y*stride, block_w*2);
-                    for(y=h; y<sy+block_w*2; y++)
-                        memcpy(dst + sx + y*stride, src + sx + y*stride, block_w*2);
-                    if(sx<0){
-                        for(y=sy; y<sy+block_w*2; y++)
-                            memcpy(dst + sx + y*stride, src + sx + y*stride, -sx);
-                    }
-                    if(sx+block_w*2 > w){
-                        for(y=sy; y<sy+block_w*2; y++)
-                            memcpy(dst + w + y*stride, src + w + y*stride, sx+block_w*2 - w);
-                    }
-                }
-
-                // intra(black) = neighbors' contribution to the current block
-                for(i=0; i<3; i++)
-                    color[i]= get_dc(s, mb_x, mb_y, i);
-
-                // get previous score (cannot be cached due to OBMC)
-                if(pass > 0 && (block->type&BLOCK_INTRA)){
-                    int color0[3]= {block->color[0], block->color[1], block->color[2]};
-                    check_block(s, mb_x, mb_y, color0, 1, *obmc_edged, &best_rd);
-                }else
-                    check_block_inter(s, mb_x, mb_y, block->mx, block->my, *obmc_edged, &best_rd);
-
-                ref_b= *block;
-                ref_rd= best_rd;
-                for(ref=0; ref < s->ref_frames; ref++){
-                    int16_t (*mvr)[2]= &s->ref_mvs[ref][index];
-                    if(s->ref_scores[ref][index] > s->ref_scores[ref_b.ref][index]*3/2) //FIXME tune threshold
-                        continue;
-                    block->ref= ref;
-                    best_rd= INT_MAX;
-
-                    check_block_inter(s, mb_x, mb_y, mvr[0][0], mvr[0][1], *obmc_edged, &best_rd);
-                    check_block_inter(s, mb_x, mb_y, 0, 0, *obmc_edged, &best_rd);
-                    if(tb)
-                        check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], *obmc_edged, &best_rd);
-                    if(lb)
-                        check_block_inter(s, mb_x, mb_y, mvr[-1][0], mvr[-1][1], *obmc_edged, &best_rd);
-                    if(rb)
-                        check_block_inter(s, mb_x, mb_y, mvr[1][0], mvr[1][1], *obmc_edged, &best_rd);
-                    if(bb)
-                        check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], *obmc_edged, &best_rd);
-
-                    /* fullpel ME */
-                    //FIXME avoid subpel interpolation / round to nearest integer
-                    do{
-                        dia_change=0;
-                        for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){
-                            for(j=0; j<i; j++){
-                                dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my+(4*j), *obmc_edged, &best_rd);
-                                dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my-(4*j), *obmc_edged, &best_rd);
-                                dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+4*(i-j), block->my-(4*j), *obmc_edged, &best_rd);
-                                dia_change |= check_block_inter(s, mb_x, mb_y, block->mx-4*(i-j), block->my+(4*j), *obmc_edged, &best_rd);
-                            }
-                        }
-                    }while(dia_change);
-                    /* subpel ME */
-                    do{
-                        static const int square[8][2]= {{+1, 0},{-1, 0},{ 0,+1},{ 0,-1},{+1,+1},{-1,-1},{+1,-1},{-1,+1},};
-                        dia_change=0;
-                        for(i=0; i<8; i++)
-                            dia_change |= check_block_inter(s, mb_x, mb_y, block->mx+square[i][0], block->my+square[i][1], *obmc_edged, &best_rd);
-                    }while(dia_change);
-                    //FIXME or try the standard 2 pass qpel or similar
-
-                    mvr[0][0]= block->mx;
-                    mvr[0][1]= block->my;
-                    if(ref_rd > best_rd){
-                        ref_rd= best_rd;
-                        ref_b= *block;
-                    }
-                }
-                best_rd= ref_rd;
-                *block= ref_b;
-#if 1
-                check_block(s, mb_x, mb_y, color, 1, *obmc_edged, &best_rd);
-                //FIXME RD style color selection
-#endif
-                if(!same_block(block, &backup)){
-                    if(tb ) tb ->type &= ~BLOCK_OPT;
-                    if(lb ) lb ->type &= ~BLOCK_OPT;
-                    if(rb ) rb ->type &= ~BLOCK_OPT;
-                    if(bb ) bb ->type &= ~BLOCK_OPT;
-                    if(tlb) tlb->type &= ~BLOCK_OPT;
-                    if(trb) trb->type &= ~BLOCK_OPT;
-                    if(blb) blb->type &= ~BLOCK_OPT;
-                    if(brb) brb->type &= ~BLOCK_OPT;
-                    change ++;
-                }
-            }
-        }
-        av_log(s->avctx, AV_LOG_ERROR, "pass:%d changed:%d\n", pass, change);
-        if(!change)
-            break;
-    }
-
-    if(s->block_max_depth == 1){
-        int change= 0;
-        for(mb_y= 0; mb_y<b_height; mb_y+=2){
-            for(mb_x= 0; mb_x<b_width; mb_x+=2){
-                int i;
-                int best_rd, init_rd;
-                const int index= mb_x + mb_y * b_stride;
-                BlockNode *b[4];
-
-                b[0]= &s->block[index];
-                b[1]= b[0]+1;
-                b[2]= b[0]+b_stride;
-                b[3]= b[2]+1;
-                if(same_block(b[0], b[1]) &&
-                   same_block(b[0], b[2]) &&
-                   same_block(b[0], b[3]))
-                    continue;
-
-                if(!s->me_cache_generation)
-                    memset(s->me_cache, 0, sizeof(s->me_cache));
-                s->me_cache_generation += 1<<22;
-
-                init_rd= best_rd= get_4block_rd(s, mb_x, mb_y, 0);
-
-                //FIXME more multiref search?
-                check_4block_inter(s, mb_x, mb_y,
-                                   (b[0]->mx + b[1]->mx + b[2]->mx + b[3]->mx + 2) >> 2,
-                                   (b[0]->my + b[1]->my + b[2]->my + b[3]->my + 2) >> 2, 0, &best_rd);
-
-                for(i=0; i<4; i++)
-                    if(!(b[i]->type&BLOCK_INTRA))
-                        check_4block_inter(s, mb_x, mb_y, b[i]->mx, b[i]->my, b[i]->ref, &best_rd);
-
-                if(init_rd != best_rd)
-                    change++;
-            }
-        }
-        av_log(s->avctx, AV_LOG_ERROR, "pass:4mv changed:%d\n", change*4);
-    }
-}
-
-static void encode_blocks(SnowContext *s, int search){
-    int x, y;
-    int w= s->b_width;
-    int h= s->b_height;
-
-    if(s->avctx->me_method == ME_ITER && !s->keyframe && search)
-        iterative_me(s);
-
-    for(y=0; y<h; y++){
-        if(s->c.bytestream_end - s->c.bytestream < w*MB_SIZE*MB_SIZE*3){ //FIXME nicer limit
-            av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-            return;
-        }
-        for(x=0; x<w; x++){
-            if(s->avctx->me_method == ME_ITER || !search)
-                encode_q_branch2(s, 0, x, y);
-            else
-                encode_q_branch (s, 0, x, y);
-        }
-    }
-}
-
-static void quantize(SnowContext *s, SubBand *b, IDWTELEM *dst, DWTELEM *src, int stride, int bias){
-    const int w= b->width;
-    const int h= b->height;
-    const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
-    const int qmul= qexp[qlog&(QROOT-1)]<<((qlog>>QSHIFT) + ENCODER_EXTRA_BITS);
-    int x,y, thres1, thres2;
-
-    if(s->qlog == LOSSLESS_QLOG){
-        for(y=0; y<h; y++)
-            for(x=0; x<w; x++)
-                dst[x + y*stride]= src[x + y*stride];
-        return;
-    }
-
-    bias= bias ? 0 : (3*qmul)>>3;
-    thres1= ((qmul - bias)>>QEXPSHIFT) - 1;
-    thres2= 2*thres1;
-
-    if(!bias){
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int i= src[x + y*stride];
-
-                if((unsigned)(i+thres1) > thres2){
-                    if(i>=0){
-                        i<<= QEXPSHIFT;
-                        i/= qmul; //FIXME optimize
-                        dst[x + y*stride]=  i;
-                    }else{
-                        i= -i;
-                        i<<= QEXPSHIFT;
-                        i/= qmul; //FIXME optimize
-                        dst[x + y*stride]= -i;
-                    }
-                }else
-                    dst[x + y*stride]= 0;
-            }
-        }
-    }else{
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int i= src[x + y*stride];
-
-                if((unsigned)(i+thres1) > thres2){
-                    if(i>=0){
-                        i<<= QEXPSHIFT;
-                        i= (i + bias) / qmul; //FIXME optimize
-                        dst[x + y*stride]=  i;
-                    }else{
-                        i= -i;
-                        i<<= QEXPSHIFT;
-                        i= (i + bias) / qmul; //FIXME optimize
-                        dst[x + y*stride]= -i;
-                    }
-                }else
-                    dst[x + y*stride]= 0;
-            }
-        }
-    }
-}
-
-static void dequantize(SnowContext *s, SubBand *b, IDWTELEM *src, int stride){
-    const int w= b->width;
-    const int h= b->height;
-    const int qlog= av_clip(s->qlog + b->qlog, 0, QROOT*16);
-    const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
-    const int qadd= (s->qbias*qmul)>>QBIAS_SHIFT;
-    int x,y;
-
-    if(s->qlog == LOSSLESS_QLOG) return;
-
-    for(y=0; y<h; y++){
-        for(x=0; x<w; x++){
-            int i= src[x + y*stride];
-            if(i<0){
-                src[x + y*stride]= -((-i*qmul + qadd)>>(QEXPSHIFT)); //FIXME try different bias
-            }else if(i>0){
-                src[x + y*stride]=  (( i*qmul + qadd)>>(QEXPSHIFT));
-            }
-        }
-    }
-}
-
-static void decorrelate(SnowContext *s, SubBand *b, IDWTELEM *src, int stride, int inverse, int use_median){
-    const int w= b->width;
-    const int h= b->height;
-    int x,y;
-
-    for(y=h-1; y>=0; y--){
-        for(x=w-1; x>=0; x--){
-            int i= x + y*stride;
-
-            if(x){
-                if(use_median){
-                    if(y && x+1<w) src[i] -= mid_pred(src[i - 1], src[i - stride], src[i - stride + 1]);
-                    else  src[i] -= src[i - 1];
-                }else{
-                    if(y) src[i] -= mid_pred(src[i - 1], src[i - stride], src[i - 1] + src[i - stride] - src[i - 1 - stride]);
-                    else  src[i] -= src[i - 1];
-                }
-            }else{
-                if(y) src[i] -= src[i - stride];
-            }
-        }
-    }
-}
-
-static void correlate(SnowContext *s, SubBand *b, IDWTELEM *src, int stride, int inverse, int use_median){
-    const int w= b->width;
-    const int h= b->height;
-    int x,y;
-
-    for(y=0; y<h; y++){
-        for(x=0; x<w; x++){
-            int i= x + y*stride;
-
-            if(x){
-                if(use_median){
-                    if(y && x+1<w) src[i] += mid_pred(src[i - 1], src[i - stride], src[i - stride + 1]);
-                    else  src[i] += src[i - 1];
-                }else{
-                    if(y) src[i] += mid_pred(src[i - 1], src[i - stride], src[i - 1] + src[i - stride] - src[i - 1 - stride]);
-                    else  src[i] += src[i - 1];
-                }
-            }else{
-                if(y) src[i] += src[i - stride];
-            }
-        }
-    }
-}
-
-static void encode_qlogs(SnowContext *s){
-    int plane_index, level, orientation;
-
-    for(plane_index=0; plane_index<2; plane_index++){
-        for(level=0; level<s->spatial_decomposition_count; level++){
-            for(orientation=level ? 1:0; orientation<4; orientation++){
-                if(orientation==2) continue;
-                put_symbol(&s->c, s->header_state, s->plane[plane_index].band[level][orientation].qlog, 1);
-            }
-        }
-    }
-}
-
-static void encode_header(SnowContext *s){
-    int plane_index, i;
-    uint8_t kstate[32];
-
-    memset(kstate, MID_STATE, sizeof(kstate));
-
-    put_rac(&s->c, kstate, s->keyframe);
-    if(s->keyframe || s->always_reset){
-        reset_contexts(s);
-        s->last_spatial_decomposition_type=
-        s->last_qlog=
-        s->last_qbias=
-        s->last_mv_scale=
-        s->last_block_max_depth= 0;
-        for(plane_index=0; plane_index<2; plane_index++){
-            Plane *p= &s->plane[plane_index];
-            p->last_htaps=0;
-            p->last_diag_mc=0;
-            memset(p->last_hcoeff, 0, sizeof(p->last_hcoeff));
-        }
-    }
-    if(s->keyframe){
-        put_symbol(&s->c, s->header_state, s->version, 0);
-        put_rac(&s->c, s->header_state, s->always_reset);
-        put_symbol(&s->c, s->header_state, s->temporal_decomposition_type, 0);
-        put_symbol(&s->c, s->header_state, s->temporal_decomposition_count, 0);
-        put_symbol(&s->c, s->header_state, s->spatial_decomposition_count, 0);
-        put_symbol(&s->c, s->header_state, s->colorspace_type, 0);
-        put_symbol(&s->c, s->header_state, s->chroma_h_shift, 0);
-        put_symbol(&s->c, s->header_state, s->chroma_v_shift, 0);
-        put_rac(&s->c, s->header_state, s->spatial_scalability);
-//        put_rac(&s->c, s->header_state, s->rate_scalability);
-        put_symbol(&s->c, s->header_state, s->max_ref_frames-1, 0);
-
-        encode_qlogs(s);
-    }
-
-    if(!s->keyframe){
-        int update_mc=0;
-        for(plane_index=0; plane_index<2; plane_index++){
-            Plane *p= &s->plane[plane_index];
-            update_mc |= p->last_htaps   != p->htaps;
-            update_mc |= p->last_diag_mc != p->diag_mc;
-            update_mc |= !!memcmp(p->last_hcoeff, p->hcoeff, sizeof(p->hcoeff));
-        }
-        put_rac(&s->c, s->header_state, update_mc);
-        if(update_mc){
-            for(plane_index=0; plane_index<2; plane_index++){
-                Plane *p= &s->plane[plane_index];
-                put_rac(&s->c, s->header_state, p->diag_mc);
-                put_symbol(&s->c, s->header_state, p->htaps/2-1, 0);
-                for(i= p->htaps/2; i; i--)
-                    put_symbol(&s->c, s->header_state, FFABS(p->hcoeff[i]), 0);
-            }
-        }
-        if(s->last_spatial_decomposition_count != s->spatial_decomposition_count){
-            put_rac(&s->c, s->header_state, 1);
-            put_symbol(&s->c, s->header_state, s->spatial_decomposition_count, 0);
-            encode_qlogs(s);
-        }else
-            put_rac(&s->c, s->header_state, 0);
-    }
-
-    put_symbol(&s->c, s->header_state, s->spatial_decomposition_type - s->last_spatial_decomposition_type, 1);
-    put_symbol(&s->c, s->header_state, s->qlog            - s->last_qlog    , 1);
-    put_symbol(&s->c, s->header_state, s->mv_scale        - s->last_mv_scale, 1);
-    put_symbol(&s->c, s->header_state, s->qbias           - s->last_qbias   , 1);
-    put_symbol(&s->c, s->header_state, s->block_max_depth - s->last_block_max_depth, 1);
-
-}
-
-static void update_last_header_values(SnowContext *s){
-    int plane_index;
-
-    if(!s->keyframe){
-        for(plane_index=0; plane_index<2; plane_index++){
-            Plane *p= &s->plane[plane_index];
-            p->last_diag_mc= p->diag_mc;
-            p->last_htaps  = p->htaps;
-            memcpy(p->last_hcoeff, p->hcoeff, sizeof(p->hcoeff));
-        }
-    }
-
-    s->last_spatial_decomposition_type  = s->spatial_decomposition_type;
-    s->last_qlog                        = s->qlog;
-    s->last_qbias                       = s->qbias;
-    s->last_mv_scale                    = s->mv_scale;
-    s->last_block_max_depth             = s->block_max_depth;
-    s->last_spatial_decomposition_count = s->spatial_decomposition_count;
-}
-
-static int qscale2qlog(int qscale){
-    return rint(QROOT*log(qscale / (float)FF_QP2LAMBDA)/log(2))
-           + 61*QROOT/8; //<64 >60
-}
-
-static int ratecontrol_1pass(SnowContext *s, AVFrame *pict)
-{
-    /* Estimate the frame's complexity as a sum of weighted dwt coefficients.
-     * FIXME we know exact mv bits at this point,
-     * but ratecontrol isn't set up to include them. */
-    uint32_t coef_sum= 0;
-    int level, orientation, delta_qlog;
-
-    for(level=0; level<s->spatial_decomposition_count; level++){
-        for(orientation=level ? 1 : 0; orientation<4; orientation++){
-            SubBand *b= &s->plane[0].band[level][orientation];
-            IDWTELEM *buf= b->ibuf;
-            const int w= b->width;
-            const int h= b->height;
-            const int stride= b->stride;
-            const int qlog= av_clip(2*QROOT + b->qlog, 0, QROOT*16);
-            const int qmul= qexp[qlog&(QROOT-1)]<<(qlog>>QSHIFT);
-            const int qdiv= (1<<16)/qmul;
-            int x, y;
-            //FIXME this is ugly
-            for(y=0; y<h; y++)
-                for(x=0; x<w; x++)
-                    buf[x+y*stride]= b->buf[x+y*stride];
-            if(orientation==0)
-                decorrelate(s, b, buf, stride, 1, 0);
-            for(y=0; y<h; y++)
-                for(x=0; x<w; x++)
-                    coef_sum+= abs(buf[x+y*stride]) * qdiv >> 16;
-        }
-    }
-
-    /* ugly, ratecontrol just takes a sqrt again */
-    coef_sum = (uint64_t)coef_sum * coef_sum >> 16;
-    assert(coef_sum < INT_MAX);
-
-    if(pict->pict_type == FF_I_TYPE){
-        s->m.current_picture.mb_var_sum= coef_sum;
-        s->m.current_picture.mc_mb_var_sum= 0;
-    }else{
-        s->m.current_picture.mc_mb_var_sum= coef_sum;
-        s->m.current_picture.mb_var_sum= 0;
-    }
-
-    pict->quality= ff_rate_estimate_qscale(&s->m, 1);
-    if (pict->quality < 0)
-        return INT_MIN;
-    s->lambda= pict->quality * 3/2;
-    delta_qlog= qscale2qlog(pict->quality) - s->qlog;
-    s->qlog+= delta_qlog;
-    return delta_qlog;
-}
-
-static void calculate_visual_weight(SnowContext *s, Plane *p){
-    int width = p->width;
-    int height= p->height;
-    int level, orientation, x, y;
-
-    for(level=0; level<s->spatial_decomposition_count; level++){
-        for(orientation=level ? 1 : 0; orientation<4; orientation++){
-            SubBand *b= &p->band[level][orientation];
-            IDWTELEM *ibuf= b->ibuf;
-            int64_t error=0;
-
-            memset(s->spatial_idwt_buffer, 0, sizeof(*s->spatial_idwt_buffer)*width*height);
-            ibuf[b->width/2 + b->height/2*b->stride]= 256*16;
-            ff_spatial_idwt(s->spatial_idwt_buffer, width, height, width, s->spatial_decomposition_type, s->spatial_decomposition_count);
-            for(y=0; y<height; y++){
-                for(x=0; x<width; x++){
-                    int64_t d= s->spatial_idwt_buffer[x + y*width]*16;
-                    error += d*d;
-                }
-            }
-
-            b->qlog= (int)(log(352256.0/sqrt(error)) / log(pow(2.0, 1.0/QROOT))+0.5);
-        }
-    }
-}
-
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    SnowContext *s = avctx->priv_data;
-    RangeCoder * const c= &s->c;
-    AVFrame *pict = data;
-    const int width= s->avctx->width;
-    const int height= s->avctx->height;
-    int level, orientation, plane_index, i, y;
-    uint8_t rc_header_bak[sizeof(s->header_state)];
-    uint8_t rc_block_bak[sizeof(s->block_state)];
-
-    ff_init_range_encoder(c, buf, buf_size);
-    ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
-    for(i=0; i<3; i++){
-        int shift= !!i;
-        for(y=0; y<(height>>shift); y++)
-            memcpy(&s->input_picture.data[i][y * s->input_picture.linesize[i]],
-                   &pict->data[i][y * pict->linesize[i]],
-                   width>>shift);
-    }
-    s->new_picture = *pict;
-
-    s->m.picture_number= avctx->frame_number;
-    if(avctx->flags&CODEC_FLAG_PASS2){
-        s->m.pict_type =
-        pict->pict_type= s->m.rc_context.entry[avctx->frame_number].new_pict_type;
-        s->keyframe= pict->pict_type==FF_I_TYPE;
-        if(!(avctx->flags&CODEC_FLAG_QSCALE)) {
-            pict->quality= ff_rate_estimate_qscale(&s->m, 0);
-            if (pict->quality < 0)
-                return -1;
-        }
-    }else{
-        s->keyframe= avctx->gop_size==0 || avctx->frame_number % avctx->gop_size == 0;
-        s->m.pict_type=
-        pict->pict_type= s->keyframe ? FF_I_TYPE : FF_P_TYPE;
-    }
-
-    if(s->pass1_rc && avctx->frame_number == 0)
-        pict->quality= 2*FF_QP2LAMBDA;
-    if(pict->quality){
-        s->qlog= qscale2qlog(pict->quality);
-        s->lambda = pict->quality * 3/2;
-    }
-    if(s->qlog < 0 || (!pict->quality && (avctx->flags & CODEC_FLAG_QSCALE))){
-        s->qlog= LOSSLESS_QLOG;
-        s->lambda = 0;
-    }//else keep previous frame's qlog until after motion estimation
-
-    frame_start(s);
-
-    s->m.current_picture_ptr= &s->m.current_picture;
-    s->m.last_picture.pts= s->m.current_picture.pts;
-    s->m.current_picture.pts= pict->pts;
-    if(pict->pict_type == FF_P_TYPE){
-        int block_width = (width +15)>>4;
-        int block_height= (height+15)>>4;
-        int stride= s->current_picture.linesize[0];
-
-        assert(s->current_picture.data[0]);
-        assert(s->last_picture[0].data[0]);
-
-        s->m.avctx= s->avctx;
-        s->m.current_picture.data[0]= s->current_picture.data[0];
-        s->m.   last_picture.data[0]= s->last_picture[0].data[0];
-        s->m.    new_picture.data[0]= s->  input_picture.data[0];
-        s->m.   last_picture_ptr= &s->m.   last_picture;
-        s->m.linesize=
-        s->m.   last_picture.linesize[0]=
-        s->m.    new_picture.linesize[0]=
-        s->m.current_picture.linesize[0]= stride;
-        s->m.uvlinesize= s->current_picture.linesize[1];
-        s->m.width = width;
-        s->m.height= height;
-        s->m.mb_width = block_width;
-        s->m.mb_height= block_height;
-        s->m.mb_stride=   s->m.mb_width+1;
-        s->m.b8_stride= 2*s->m.mb_width+1;
-        s->m.f_code=1;
-        s->m.pict_type= pict->pict_type;
-        s->m.me_method= s->avctx->me_method;
-        s->m.me.scene_change_score=0;
-        s->m.flags= s->avctx->flags;
-        s->m.quarter_sample= (s->avctx->flags & CODEC_FLAG_QPEL)!=0;
-        s->m.out_format= FMT_H263;
-        s->m.unrestricted_mv= 1;
-
-        s->m.lambda = s->lambda;
-        s->m.qscale= (s->m.lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
-        s->lambda2= s->m.lambda2= (s->m.lambda*s->m.lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
-
-        s->m.dsp= s->dsp; //move
-        ff_init_me(&s->m);
-        s->dsp= s->m.dsp;
-    }
-
-    if(s->pass1_rc){
-        memcpy(rc_header_bak, s->header_state, sizeof(s->header_state));
-        memcpy(rc_block_bak, s->block_state, sizeof(s->block_state));
-    }
-
-redo_frame:
-
-    if(pict->pict_type == FF_I_TYPE)
-        s->spatial_decomposition_count= 5;
-    else
-        s->spatial_decomposition_count= 5;
-
-    s->m.pict_type = pict->pict_type;
-    s->qbias= pict->pict_type == FF_P_TYPE ? 2 : 0;
-
-    common_init_after_header(avctx);
-
-    if(s->last_spatial_decomposition_count != s->spatial_decomposition_count){
-        for(plane_index=0; plane_index<3; plane_index++){
-            calculate_visual_weight(s, &s->plane[plane_index]);
-        }
-    }
-
-    encode_header(s);
-    s->m.misc_bits = 8*(s->c.bytestream - s->c.bytestream_start);
-    encode_blocks(s, 1);
-    s->m.mv_bits = 8*(s->c.bytestream - s->c.bytestream_start) - s->m.misc_bits;
-
-    for(plane_index=0; plane_index<3; plane_index++){
-        Plane *p= &s->plane[plane_index];
-        int w= p->width;
-        int h= p->height;
-        int x, y;
-//        int bits= put_bits_count(&s->c.pb);
-
-        if(!(avctx->flags2 & CODEC_FLAG2_MEMC_ONLY)){
-            //FIXME optimize
-            if(pict->data[plane_index]) //FIXME gray hack
-                for(y=0; y<h; y++){
-                    for(x=0; x<w; x++){
-                        s->spatial_idwt_buffer[y*w + x]= pict->data[plane_index][y*pict->linesize[plane_index] + x]<<FRAC_BITS;
-                    }
-                }
-            predict_plane(s, s->spatial_idwt_buffer, plane_index, 0);
-
-            if(   plane_index==0
-               && pict->pict_type == FF_P_TYPE
-               && !(avctx->flags&CODEC_FLAG_PASS2)
-               && s->m.me.scene_change_score > s->avctx->scenechange_threshold){
-                ff_init_range_encoder(c, buf, buf_size);
-                ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-                pict->pict_type= FF_I_TYPE;
-                s->keyframe=1;
-                s->current_picture.key_frame=1;
-                goto redo_frame;
-            }
-
-            if(s->qlog == LOSSLESS_QLOG){
-                for(y=0; y<h; y++){
-                    for(x=0; x<w; x++){
-                        s->spatial_dwt_buffer[y*w + x]= (s->spatial_idwt_buffer[y*w + x] + (1<<(FRAC_BITS-1))-1)>>FRAC_BITS;
-                    }
-                }
-            }else{
-                for(y=0; y<h; y++){
-                    for(x=0; x<w; x++){
-                        s->spatial_dwt_buffer[y*w + x]=s->spatial_idwt_buffer[y*w + x]<<ENCODER_EXTRA_BITS;
-                    }
-                }
-            }
-
-            /*  if(QUANTIZE2)
-                dwt_quantize(s, p, s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type);
-            else*/
-                ff_spatial_dwt(s->spatial_dwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
-
-            if(s->pass1_rc && plane_index==0){
-                int delta_qlog = ratecontrol_1pass(s, pict);
-                if (delta_qlog <= INT_MIN)
-                    return -1;
-                if(delta_qlog){
-                    //reordering qlog in the bitstream would eliminate this reset
-                    ff_init_range_encoder(c, buf, buf_size);
-                    memcpy(s->header_state, rc_header_bak, sizeof(s->header_state));
-                    memcpy(s->block_state, rc_block_bak, sizeof(s->block_state));
-                    encode_header(s);
-                    encode_blocks(s, 0);
-                }
-            }
-
-            for(level=0; level<s->spatial_decomposition_count; level++){
-                for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                    SubBand *b= &p->band[level][orientation];
-
-                    if(!QUANTIZE2)
-                        quantize(s, b, b->ibuf, b->buf, b->stride, s->qbias);
-                    if(orientation==0)
-                        decorrelate(s, b, b->ibuf, b->stride, pict->pict_type == FF_P_TYPE, 0);
-                    encode_subband(s, b, b->ibuf, b->parent ? b->parent->ibuf : NULL, b->stride, orientation);
-                    assert(b->parent==NULL || b->parent->stride == b->stride*2);
-                    if(orientation==0)
-                        correlate(s, b, b->ibuf, b->stride, 1, 0);
-                }
-            }
-
-            for(level=0; level<s->spatial_decomposition_count; level++){
-                for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                    SubBand *b= &p->band[level][orientation];
-
-                    dequantize(s, b, b->ibuf, b->stride);
-                }
-            }
-
-            ff_spatial_idwt(s->spatial_idwt_buffer, w, h, w, s->spatial_decomposition_type, s->spatial_decomposition_count);
-            if(s->qlog == LOSSLESS_QLOG){
-                for(y=0; y<h; y++){
-                    for(x=0; x<w; x++){
-                        s->spatial_idwt_buffer[y*w + x]<<=FRAC_BITS;
-                    }
-                }
-            }
-            predict_plane(s, s->spatial_idwt_buffer, plane_index, 1);
-        }else{
-            //ME/MC only
-            if(pict->pict_type == FF_I_TYPE){
-                for(y=0; y<h; y++){
-                    for(x=0; x<w; x++){
-                        s->current_picture.data[plane_index][y*s->current_picture.linesize[plane_index] + x]=
-                            pict->data[plane_index][y*pict->linesize[plane_index] + x];
-                    }
-                }
-            }else{
-                memset(s->spatial_idwt_buffer, 0, sizeof(IDWTELEM)*w*h);
-                predict_plane(s, s->spatial_idwt_buffer, plane_index, 1);
-            }
-        }
-        if(s->avctx->flags&CODEC_FLAG_PSNR){
-            int64_t error= 0;
-
-            if(pict->data[plane_index]) //FIXME gray hack
-                for(y=0; y<h; y++){
-                    for(x=0; x<w; x++){
-                        int d= s->current_picture.data[plane_index][y*s->current_picture.linesize[plane_index] + x] - pict->data[plane_index][y*pict->linesize[plane_index] + x];
-                        error += d*d;
-                    }
-                }
-            s->avctx->error[plane_index] += error;
-            s->current_picture.error[plane_index] = error;
-        }
-
-    }
-
-    update_last_header_values(s);
-
-    release_buffer(avctx);
-
-    s->current_picture.coded_picture_number = avctx->frame_number;
-    s->current_picture.pict_type = pict->pict_type;
-    s->current_picture.quality = pict->quality;
-    s->m.frame_bits = 8*(s->c.bytestream - s->c.bytestream_start);
-    s->m.p_tex_bits = s->m.frame_bits - s->m.misc_bits - s->m.mv_bits;
-    s->m.current_picture.display_picture_number =
-    s->m.current_picture.coded_picture_number = avctx->frame_number;
-    s->m.current_picture.quality = pict->quality;
-    s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start);
-    if(s->pass1_rc)
-        if (ff_rate_estimate_qscale(&s->m, 0) < 0)
-            return -1;
-    if(avctx->flags&CODEC_FLAG_PASS1)
-        ff_write_pass1_stats(&s->m);
-    s->m.last_pict_type = s->m.pict_type;
-    avctx->frame_bits = s->m.frame_bits;
-    avctx->mv_bits = s->m.mv_bits;
-    avctx->misc_bits = s->m.misc_bits;
-    avctx->p_tex_bits = s->m.p_tex_bits;
-
-    emms_c();
-
-    return ff_rac_terminate(c);
-}
-
-static av_cold int encode_end(AVCodecContext *avctx)
-{
-    SnowContext *s = avctx->priv_data;
-
-    common_end(s);
-    if (s->input_picture.data[0])
-        avctx->release_buffer(avctx, &s->input_picture);
-    av_free(avctx->stats_out);
-
-    return 0;
-}
-
-AVCodec snow_encoder = {
-    "snow",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SNOW,
-    sizeof(SnowContext),
-    encode_init,
-    encode_frame,
-    encode_end,
-    .long_name = NULL_IF_CONFIG_SMALL("Snow"),
-};
-#endif
-
-
-#ifdef TEST
-#undef malloc
-#undef free
-#undef printf
-
-#include "libavutil/lfg.h"
-
-int main(void){
-    int width=256;
-    int height=256;
-    int buffer[2][width*height];
-    SnowContext s;
-    int i;
-    AVLFG prng;
-    s.spatial_decomposition_count=6;
-    s.spatial_decomposition_type=1;
-
-    av_lfg_init(&prng, 1);
-
-    printf("testing 5/3 DWT\n");
-    for(i=0; i<width*height; i++)
-        buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
-
-    ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-    ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-
-    for(i=0; i<width*height; i++)
-        if(buffer[0][i]!= buffer[1][i]) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
-
-    printf("testing 9/7 DWT\n");
-    s.spatial_decomposition_type=0;
-    for(i=0; i<width*height; i++)
-        buffer[0][i] = buffer[1][i] = av_lfg_get(&prng) % 54321 - 12345;
-
-    ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-    ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-
-    for(i=0; i<width*height; i++)
-        if(FFABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
-
-#if 0
-    printf("testing AC coder\n");
-    memset(s.header_state, 0, sizeof(s.header_state));
-    ff_init_range_encoder(&s.c, buffer[0], 256*256);
-    ff_init_cabac_states(&s.c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64);
-
-    for(i=-256; i<256; i++){
-        put_symbol(&s.c, s.header_state, i*i*i/3*FFABS(i), 1);
-    }
-    ff_rac_terminate(&s.c);
-
-    memset(s.header_state, 0, sizeof(s.header_state));
-    ff_init_range_decoder(&s.c, buffer[0], 256*256);
-    ff_init_cabac_states(&s.c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64);
-
-    for(i=-256; i<256; i++){
-        int j;
-        j= get_symbol(&s.c, s.header_state, 1);
-        if(j!=i*i*i/3*FFABS(i)) printf("fsck: %d != %d\n", i, j);
-    }
-#endif
-    {
-    int level, orientation, x, y;
-    int64_t errors[8][4];
-    int64_t g=0;
-
-        memset(errors, 0, sizeof(errors));
-        s.spatial_decomposition_count=3;
-        s.spatial_decomposition_type=0;
-        for(level=0; level<s.spatial_decomposition_count; level++){
-            for(orientation=level ? 1 : 0; orientation<4; orientation++){
-                int w= width  >> (s.spatial_decomposition_count-level);
-                int h= height >> (s.spatial_decomposition_count-level);
-                int stride= width  << (s.spatial_decomposition_count-level);
-                DWTELEM *buf= buffer[0];
-                int64_t error=0;
-
-                if(orientation&1) buf+=w;
-                if(orientation>1) buf+=stride>>1;
-
-                memset(buffer[0], 0, sizeof(int)*width*height);
-                buf[w/2 + h/2*stride]= 256*256;
-                ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-                for(y=0; y<height; y++){
-                    for(x=0; x<width; x++){
-                        int64_t d= buffer[0][x + y*width];
-                        error += d*d;
-                        if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9 && level==2) printf("%8"PRId64" ", d);
-                    }
-                    if(FFABS(height/2-y)<9 && level==2) printf("\n");
-                }
-                error= (int)(sqrt(error)+0.5);
-                errors[level][orientation]= error;
-                if(g) g=av_gcd(g, error);
-                else g= error;
-            }
-        }
-        printf("static int const visual_weight[][4]={\n");
-        for(level=0; level<s.spatial_decomposition_count; level++){
-            printf("  {");
-            for(orientation=0; orientation<4; orientation++){
-                printf("%8"PRId64",", errors[level][orientation]/g);
-            }
-            printf("},\n");
-        }
-        printf("};\n");
-        {
-            int level=2;
-            int w= width  >> (s.spatial_decomposition_count-level);
-            //int h= height >> (s.spatial_decomposition_count-level);
-            int stride= width  << (s.spatial_decomposition_count-level);
-            DWTELEM *buf= buffer[0];
-            int64_t error=0;
-
-            buf+=w;
-            buf+=stride>>1;
-
-            memset(buffer[0], 0, sizeof(int)*width*height);
-#if 1
-            for(y=0; y<height; y++){
-                for(x=0; x<width; x++){
-                    int tab[4]={0,2,3,1};
-                    buffer[0][x+width*y]= 256*256*tab[(x&1) + 2*(y&1)];
-                }
-            }
-            ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-#else
-            for(y=0; y<h; y++){
-                for(x=0; x<w; x++){
-                    buf[x + y*stride  ]=169;
-                    buf[x + y*stride-w]=64;
-                }
-            }
-            ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-#endif
-            for(y=0; y<height; y++){
-                for(x=0; x<width; x++){
-                    int64_t d= buffer[0][x + y*width];
-                    error += d*d;
-                    if(FFABS(width/2-x)<9 && FFABS(height/2-y)<9) printf("%8"PRId64" ", d);
-                }
-                if(FFABS(height/2-y)<9) printf("\n");
-            }
-        }
-
-    }
-    return 0;
-}
-#endif /* TEST */
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
deleted file mode 100644
index 7d847e4..0000000
--- a/libavcodec/snow.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2004 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (C) 2006 Robert Edele <yartrebo at earthlink.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SNOW_H
-#define AVCODEC_SNOW_H
-
-#include "dsputil.h"
-#include "dwt.h"
-
-#define MID_STATE 128
-
-#define MAX_PLANES 4
-#define QSHIFT 5
-#define QROOT (1<<QSHIFT)
-#define LOSSLESS_QLOG -128
-#define FRAC_BITS 4
-#define MAX_REF_FRAMES 8
-
-#define LOG2_OBMC_MAX 8
-#define OBMC_MAX (1<<(LOG2_OBMC_MAX))
-
-/* C bits used by mmx/sse2/altivec */
-
-static av_always_inline void snow_interleave_line_header(int * i, int width, IDWTELEM * low, IDWTELEM * high){
-    (*i) = (width) - 2;
-
-    if (width & 1){
-        low[(*i)+1] = low[((*i)+1)>>1];
-        (*i)--;
-    }
-}
-
-static av_always_inline void snow_interleave_line_footer(int * i, IDWTELEM * low, IDWTELEM * high){
-    for (; (*i)>=0; (*i)-=2){
-        low[(*i)+1] = high[(*i)>>1];
-        low[*i] = low[(*i)>>1];
-    }
-}
-
-static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){
-    for(; i<w; i++){
-        dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
-    }
-
-    if((width^lift_high)&1){
-        dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
-    }
-}
-
-static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w){
-        for(; i<w; i++){
-            dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS);
-        }
-
-        if(width&1){
-            dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS);
-        }
-}
-
-#endif /* AVCODEC_SNOW_H */
diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
deleted file mode 100644
index d24931f..0000000
--- a/libavcodec/sonic.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * Simple free lossless/lossy audio codec
- * Copyright (c) 2004 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "get_bits.h"
-#include "golomb.h"
-
-/**
- * @file
- * Simple free lossless/lossy audio codec
- * Based on Paul Francis Harrison's Bonk (http://www.logarithmic.net/pfh/bonk)
- * Written and designed by Alex Beregszaszi
- *
- * TODO:
- *  - CABAC put/get_symbol
- *  - independent quantizer for channels
- *  - >2 channels support
- *  - more decorrelation types
- *  - more tap_quant tests
- *  - selectable intlist writers/readers (bonk-style, golomb, cabac)
- */
-
-#define MAX_CHANNELS 2
-
-#define MID_SIDE 0
-#define LEFT_SIDE 1
-#define RIGHT_SIDE 2
-
-typedef struct SonicContext {
-    int lossless, decorrelation;
-
-    int num_taps, downsampling;
-    double quantization;
-
-    int channels, samplerate, block_align, frame_size;
-
-    int *tap_quant;
-    int *int_samples;
-    int *coded_samples[MAX_CHANNELS];
-
-    // for encoding
-    int *tail;
-    int tail_size;
-    int *window;
-    int window_size;
-
-    // for decoding
-    int *predictor_k;
-    int *predictor_state[MAX_CHANNELS];
-} SonicContext;
-
-#define LATTICE_SHIFT   10
-#define SAMPLE_SHIFT    4
-#define LATTICE_FACTOR  (1 << LATTICE_SHIFT)
-#define SAMPLE_FACTOR   (1 << SAMPLE_SHIFT)
-
-#define BASE_QUANT      0.6
-#define RATE_VARIATION  3.0
-
-static inline int divide(int a, int b)
-{
-    if (a < 0)
-        return -( (-a + b/2)/b );
-    else
-        return (a + b/2)/b;
-}
-
-static inline int shift(int a,int b)
-{
-    return (a+(1<<(b-1))) >> b;
-}
-
-static inline int shift_down(int a,int b)
-{
-    return (a>>b)+((a<0)?1:0);
-}
-
-#if 1
-static inline int intlist_write(PutBitContext *pb, int *buf, int entries, int base_2_part)
-{
-    int i;
-
-    for (i = 0; i < entries; i++)
-        set_se_golomb(pb, buf[i]);
-
-    return 1;
-}
-
-static inline int intlist_read(GetBitContext *gb, int *buf, int entries, int base_2_part)
-{
-    int i;
-
-    for (i = 0; i < entries; i++)
-        buf[i] = get_se_golomb(gb);
-
-    return 1;
-}
-
-#else
-
-#define ADAPT_LEVEL 8
-
-static int bits_to_store(uint64_t x)
-{
-    int res = 0;
-
-    while(x)
-    {
-        res++;
-        x >>= 1;
-    }
-    return res;
-}
-
-static void write_uint_max(PutBitContext *pb, unsigned int value, unsigned int max)
-{
-    int i, bits;
-
-    if (!max)
-        return;
-
-    bits = bits_to_store(max);
-
-    for (i = 0; i < bits-1; i++)
-        put_bits(pb, 1, value & (1 << i));
-
-    if ( (value | (1 << (bits-1))) <= max)
-        put_bits(pb, 1, value & (1 << (bits-1)));
-}
-
-static unsigned int read_uint_max(GetBitContext *gb, int max)
-{
-    int i, bits, value = 0;
-
-    if (!max)
-        return 0;
-
-    bits = bits_to_store(max);
-
-    for (i = 0; i < bits-1; i++)
-        if (get_bits1(gb))
-            value += 1 << i;
-
-    if ( (value | (1<<(bits-1))) <= max)
-        if (get_bits1(gb))
-            value += 1 << (bits-1);
-
-    return value;
-}
-
-static int intlist_write(PutBitContext *pb, int *buf, int entries, int base_2_part)
-{
-    int i, j, x = 0, low_bits = 0, max = 0;
-    int step = 256, pos = 0, dominant = 0, any = 0;
-    int *copy, *bits;
-
-    copy = av_mallocz(4* entries);
-    if (!copy)
-        return -1;
-
-    if (base_2_part)
-    {
-        int energy = 0;
-
-        for (i = 0; i < entries; i++)
-            energy += abs(buf[i]);
-
-        low_bits = bits_to_store(energy / (entries * 2));
-        if (low_bits > 15)
-            low_bits = 15;
-
-        put_bits(pb, 4, low_bits);
-    }
-
-    for (i = 0; i < entries; i++)
-    {
-        put_bits(pb, low_bits, abs(buf[i]));
-        copy[i] = abs(buf[i]) >> low_bits;
-        if (copy[i] > max)
-            max = abs(copy[i]);
-    }
-
-    bits = av_mallocz(4* entries*max);
-    if (!bits)
-    {
-//        av_free(copy);
-        return -1;
-    }
-
-    for (i = 0; i <= max; i++)
-    {
-        for (j = 0; j < entries; j++)
-            if (copy[j] >= i)
-                bits[x++] = copy[j] > i;
-    }
-
-    // store bitstream
-    while (pos < x)
-    {
-        int steplet = step >> 8;
-
-        if (pos + steplet > x)
-            steplet = x - pos;
-
-        for (i = 0; i < steplet; i++)
-            if (bits[i+pos] != dominant)
-                any = 1;
-
-        put_bits(pb, 1, any);
-
-        if (!any)
-        {
-            pos += steplet;
-            step += step / ADAPT_LEVEL;
-        }
-        else
-        {
-            int interloper = 0;
-
-            while (((pos + interloper) < x) && (bits[pos + interloper] == dominant))
-                interloper++;
-
-            // note change
-            write_uint_max(pb, interloper, (step >> 8) - 1);
-
-            pos += interloper + 1;
-            step -= step / ADAPT_LEVEL;
-        }
-
-        if (step < 256)
-        {
-            step = 65536 / step;
-            dominant = !dominant;
-        }
-    }
-
-    // store signs
-    for (i = 0; i < entries; i++)
-        if (buf[i])
-            put_bits(pb, 1, buf[i] < 0);
-
-//    av_free(bits);
-//    av_free(copy);
-
-    return 0;
-}
-
-static int intlist_read(GetBitContext *gb, int *buf, int entries, int base_2_part)
-{
-    int i, low_bits = 0, x = 0;
-    int n_zeros = 0, step = 256, dominant = 0;
-    int pos = 0, level = 0;
-    int *bits = av_mallocz(4* entries);
-
-    if (!bits)
-        return -1;
-
-    if (base_2_part)
-    {
-        low_bits = get_bits(gb, 4);
-
-        if (low_bits)
-            for (i = 0; i < entries; i++)
-                buf[i] = get_bits(gb, low_bits);
-    }
-
-//    av_log(NULL, AV_LOG_INFO, "entries: %d, low bits: %d\n", entries, low_bits);
-
-    while (n_zeros < entries)
-    {
-        int steplet = step >> 8;
-
-        if (!get_bits1(gb))
-        {
-            for (i = 0; i < steplet; i++)
-                bits[x++] = dominant;
-
-            if (!dominant)
-                n_zeros += steplet;
-
-            step += step / ADAPT_LEVEL;
-        }
-        else
-        {
-            int actual_run = read_uint_max(gb, steplet-1);
-
-//            av_log(NULL, AV_LOG_INFO, "actual run: %d\n", actual_run);
-
-            for (i = 0; i < actual_run; i++)
-                bits[x++] = dominant;
-
-            bits[x++] = !dominant;
-
-            if (!dominant)
-                n_zeros += actual_run;
-            else
-                n_zeros++;
-
-            step -= step / ADAPT_LEVEL;
-        }
-
-        if (step < 256)
-        {
-            step = 65536 / step;
-            dominant = !dominant;
-        }
-    }
-
-    // reconstruct unsigned values
-    n_zeros = 0;
-    for (i = 0; n_zeros < entries; i++)
-    {
-        while(1)
-        {
-            if (pos >= entries)
-            {
-                pos = 0;
-                level += 1 << low_bits;
-            }
-
-            if (buf[pos] >= level)
-                break;
-
-            pos++;
-        }
-
-        if (bits[i])
-            buf[pos] += 1 << low_bits;
-        else
-            n_zeros++;
-
-        pos++;
-    }
-//    av_free(bits);
-
-    // read signs
-    for (i = 0; i < entries; i++)
-        if (buf[i] && get_bits1(gb))
-            buf[i] = -buf[i];
-
-//    av_log(NULL, AV_LOG_INFO, "zeros: %d pos: %d\n", n_zeros, pos);
-
-    return 0;
-}
-#endif
-
-static void predictor_init_state(int *k, int *state, int order)
-{
-    int i;
-
-    for (i = order-2; i >= 0; i--)
-    {
-        int j, p, x = state[i];
-
-        for (j = 0, p = i+1; p < order; j++,p++)
-            {
-            int tmp = x + shift_down(k[j] * state[p], LATTICE_SHIFT);
-            state[p] += shift_down(k[j]*x, LATTICE_SHIFT);
-            x = tmp;
-        }
-    }
-}
-
-static int predictor_calc_error(int *k, int *state, int order, int error)
-{
-    int i, x = error - shift_down(k[order-1] * state[order-1], LATTICE_SHIFT);
-
-#if 1
-    int *k_ptr = &(k[order-2]),
-        *state_ptr = &(state[order-2]);
-    for (i = order-2; i >= 0; i--, k_ptr--, state_ptr--)
-    {
-        int k_value = *k_ptr, state_value = *state_ptr;
-        x -= shift_down(k_value * state_value, LATTICE_SHIFT);
-        state_ptr[1] = state_value + shift_down(k_value * x, LATTICE_SHIFT);
-    }
-#else
-    for (i = order-2; i >= 0; i--)
-    {
-        x -= shift_down(k[i] * state[i], LATTICE_SHIFT);
-        state[i+1] = state[i] + shift_down(k[i] * x, LATTICE_SHIFT);
-    }
-#endif
-
-    // don't drift too far, to avoid overflows
-    if (x >  (SAMPLE_FACTOR<<16)) x =  (SAMPLE_FACTOR<<16);
-    if (x < -(SAMPLE_FACTOR<<16)) x = -(SAMPLE_FACTOR<<16);
-
-    state[0] = x;
-
-    return x;
-}
-
-#if CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER
-// Heavily modified Levinson-Durbin algorithm which
-// copes better with quantization, and calculates the
-// actual whitened result as it goes.
-
-static void modified_levinson_durbin(int *window, int window_entries,
-        int *out, int out_entries, int channels, int *tap_quant)
-{
-    int i;
-    int *state = av_mallocz(4* window_entries);
-
-    memcpy(state, window, 4* window_entries);
-
-    for (i = 0; i < out_entries; i++)
-    {
-        int step = (i+1)*channels, k, j;
-        double xx = 0.0, xy = 0.0;
-#if 1
-        int *x_ptr = &(window[step]), *state_ptr = &(state[0]);
-        j = window_entries - step;
-        for (;j>=0;j--,x_ptr++,state_ptr++)
-        {
-            double x_value = *x_ptr, state_value = *state_ptr;
-            xx += state_value*state_value;
-            xy += x_value*state_value;
-        }
-#else
-        for (j = 0; j <= (window_entries - step); j++);
-        {
-            double stepval = window[step+j], stateval = window[j];
-//            xx += (double)window[j]*(double)window[j];
-//            xy += (double)window[step+j]*(double)window[j];
-            xx += stateval*stateval;
-            xy += stepval*stateval;
-        }
-#endif
-        if (xx == 0.0)
-            k = 0;
-        else
-            k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5));
-
-        if (k > (LATTICE_FACTOR/tap_quant[i]))
-            k = LATTICE_FACTOR/tap_quant[i];
-        if (-k > (LATTICE_FACTOR/tap_quant[i]))
-            k = -(LATTICE_FACTOR/tap_quant[i]);
-
-        out[i] = k;
-        k *= tap_quant[i];
-
-#if 1
-        x_ptr = &(window[step]);
-        state_ptr = &(state[0]);
-        j = window_entries - step;
-        for (;j>=0;j--,x_ptr++,state_ptr++)
-        {
-            int x_value = *x_ptr, state_value = *state_ptr;
-            *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT);
-            *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT);
-        }
-#else
-        for (j=0; j <= (window_entries - step); j++)
-        {
-            int stepval = window[step+j], stateval=state[j];
-            window[step+j] += shift_down(k * stateval, LATTICE_SHIFT);
-            state[j] += shift_down(k * stepval, LATTICE_SHIFT);
-        }
-#endif
-    }
-
-    av_free(state);
-}
-
-static inline int code_samplerate(int samplerate)
-{
-    switch (samplerate)
-    {
-        case 44100: return 0;
-        case 22050: return 1;
-        case 11025: return 2;
-        case 96000: return 3;
-        case 48000: return 4;
-        case 32000: return 5;
-        case 24000: return 6;
-        case 16000: return 7;
-        case 8000: return 8;
-    }
-    return -1;
-}
-
-static av_cold int sonic_encode_init(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    PutBitContext pb;
-    int i, version = 0;
-
-    if (avctx->channels > MAX_CHANNELS)
-    {
-        av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
-        return -1; /* only stereo or mono for now */
-    }
-
-    if (avctx->channels == 2)
-        s->decorrelation = MID_SIDE;
-
-    if (avctx->codec->id == CODEC_ID_SONIC_LS)
-    {
-        s->lossless = 1;
-        s->num_taps = 32;
-        s->downsampling = 1;
-        s->quantization = 0.0;
-    }
-    else
-    {
-        s->num_taps = 128;
-        s->downsampling = 2;
-        s->quantization = 1.0;
-    }
-
-    // max tap 2048
-    if ((s->num_taps < 32) || (s->num_taps > 1024) ||
-        ((s->num_taps>>5)<<5 != s->num_taps))
-    {
-        av_log(avctx, AV_LOG_ERROR, "Invalid number of taps\n");
-        return -1;
-    }
-
-    // generate taps
-    s->tap_quant = av_mallocz(4* s->num_taps);
-    for (i = 0; i < s->num_taps; i++)
-        s->tap_quant[i] = (int)(sqrt(i+1));
-
-    s->channels = avctx->channels;
-    s->samplerate = avctx->sample_rate;
-
-    s->block_align = (int)(2048.0*s->samplerate/44100)/s->downsampling;
-    s->frame_size = s->channels*s->block_align*s->downsampling;
-
-    s->tail = av_mallocz(4* s->num_taps*s->channels);
-    if (!s->tail)
-        return -1;
-    s->tail_size = s->num_taps*s->channels;
-
-    s->predictor_k = av_mallocz(4 * s->num_taps);
-    if (!s->predictor_k)
-        return -1;
-
-    for (i = 0; i < s->channels; i++)
-    {
-        s->coded_samples[i] = av_mallocz(4* s->block_align);
-        if (!s->coded_samples[i])
-            return -1;
-    }
-
-    s->int_samples = av_mallocz(4* s->frame_size);
-
-    s->window_size = ((2*s->tail_size)+s->frame_size);
-    s->window = av_mallocz(4* s->window_size);
-    if (!s->window)
-        return -1;
-
-    avctx->extradata = av_mallocz(16);
-    if (!avctx->extradata)
-        return -1;
-    init_put_bits(&pb, avctx->extradata, 16*8);
-
-    put_bits(&pb, 2, version); // version
-    if (version == 1)
-    {
-        put_bits(&pb, 2, s->channels);
-        put_bits(&pb, 4, code_samplerate(s->samplerate));
-    }
-    put_bits(&pb, 1, s->lossless);
-    if (!s->lossless)
-        put_bits(&pb, 3, SAMPLE_SHIFT); // XXX FIXME: sample precision
-    put_bits(&pb, 2, s->decorrelation);
-    put_bits(&pb, 2, s->downsampling);
-    put_bits(&pb, 5, (s->num_taps >> 5)-1); // 32..1024
-    put_bits(&pb, 1, 0); // XXX FIXME: no custom tap quant table
-
-    flush_put_bits(&pb);
-    avctx->extradata_size = put_bits_count(&pb)/8;
-
-    av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
-        version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
-
-    avctx->coded_frame = avcodec_alloc_frame();
-    if (!avctx->coded_frame)
-        return AVERROR(ENOMEM);
-    avctx->coded_frame->key_frame = 1;
-    avctx->frame_size = s->block_align*s->downsampling;
-
-    return 0;
-}
-
-static av_cold int sonic_encode_close(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    int i;
-
-    av_freep(&avctx->coded_frame);
-
-    for (i = 0; i < s->channels; i++)
-        av_free(s->coded_samples[i]);
-
-    av_free(s->predictor_k);
-    av_free(s->tail);
-    av_free(s->tap_quant);
-    av_free(s->window);
-    av_free(s->int_samples);
-
-    return 0;
-}
-
-static int sonic_encode_frame(AVCodecContext *avctx,
-                            uint8_t *buf, int buf_size, void *data)
-{
-    SonicContext *s = avctx->priv_data;
-    PutBitContext pb;
-    int i, j, ch, quant = 0, x = 0;
-    short *samples = data;
-
-    init_put_bits(&pb, buf, buf_size*8);
-
-    // short -> internal
-    for (i = 0; i < s->frame_size; i++)
-        s->int_samples[i] = samples[i];
-
-    if (!s->lossless)
-        for (i = 0; i < s->frame_size; i++)
-            s->int_samples[i] = s->int_samples[i] << SAMPLE_SHIFT;
-
-    switch(s->decorrelation)
-    {
-        case MID_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-            {
-                s->int_samples[i] += s->int_samples[i+1];
-                s->int_samples[i+1] -= shift(s->int_samples[i], 1);
-            }
-            break;
-        case LEFT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i+1] -= s->int_samples[i];
-            break;
-        case RIGHT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i] -= s->int_samples[i+1];
-            break;
-    }
-
-    memset(s->window, 0, 4* s->window_size);
-
-    for (i = 0; i < s->tail_size; i++)
-        s->window[x++] = s->tail[i];
-
-    for (i = 0; i < s->frame_size; i++)
-        s->window[x++] = s->int_samples[i];
-
-    for (i = 0; i < s->tail_size; i++)
-        s->window[x++] = 0;
-
-    for (i = 0; i < s->tail_size; i++)
-        s->tail[i] = s->int_samples[s->frame_size - s->tail_size + i];
-
-    // generate taps
-    modified_levinson_durbin(s->window, s->window_size,
-                s->predictor_k, s->num_taps, s->channels, s->tap_quant);
-    if (intlist_write(&pb, s->predictor_k, s->num_taps, 0) < 0)
-        return -1;
-
-    for (ch = 0; ch < s->channels; ch++)
-    {
-        x = s->tail_size+ch;
-        for (i = 0; i < s->block_align; i++)
-        {
-            int sum = 0;
-            for (j = 0; j < s->downsampling; j++, x += s->channels)
-                sum += s->window[x];
-            s->coded_samples[ch][i] = sum;
-        }
-    }
-
-    // simple rate control code
-    if (!s->lossless)
-    {
-        double energy1 = 0.0, energy2 = 0.0;
-        for (ch = 0; ch < s->channels; ch++)
-        {
-            for (i = 0; i < s->block_align; i++)
-            {
-                double sample = s->coded_samples[ch][i];
-                energy2 += sample*sample;
-                energy1 += fabs(sample);
-            }
-        }
-
-        energy2 = sqrt(energy2/(s->channels*s->block_align));
-        energy1 = sqrt(2.0)*energy1/(s->channels*s->block_align);
-
-        // increase bitrate when samples are like a gaussian distribution
-        // reduce bitrate when samples are like a two-tailed exponential distribution
-
-        if (energy2 > energy1)
-            energy2 += (energy2-energy1)*RATE_VARIATION;
-
-        quant = (int)(BASE_QUANT*s->quantization*energy2/SAMPLE_FACTOR);
-//        av_log(avctx, AV_LOG_DEBUG, "quant: %d energy: %f / %f\n", quant, energy1, energy2);
-
-        if (quant < 1)
-            quant = 1;
-        if (quant > 65535)
-            quant = 65535;
-
-        set_ue_golomb(&pb, quant);
-
-        quant *= SAMPLE_FACTOR;
-    }
-
-    // write out coded samples
-    for (ch = 0; ch < s->channels; ch++)
-    {
-        if (!s->lossless)
-            for (i = 0; i < s->block_align; i++)
-                s->coded_samples[ch][i] = divide(s->coded_samples[ch][i], quant);
-
-        if (intlist_write(&pb, s->coded_samples[ch], s->block_align, 1) < 0)
-            return -1;
-    }
-
-//    av_log(avctx, AV_LOG_DEBUG, "used bytes: %d\n", (put_bits_count(&pb)+7)/8);
-
-    flush_put_bits(&pb);
-    return (put_bits_count(&pb)+7)/8;
-}
-#endif /* CONFIG_SONIC_ENCODER || CONFIG_SONIC_LS_ENCODER */
-
-#if CONFIG_SONIC_DECODER
-static const int samplerate_table[] =
-    { 44100, 22050, 11025, 96000, 48000, 32000, 24000, 16000, 8000 };
-
-static av_cold int sonic_decode_init(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    GetBitContext gb;
-    int i, version;
-
-    s->channels = avctx->channels;
-    s->samplerate = avctx->sample_rate;
-
-    if (!avctx->extradata)
-    {
-        av_log(avctx, AV_LOG_ERROR, "No mandatory headers present\n");
-        return -1;
-    }
-
-    init_get_bits(&gb, avctx->extradata, avctx->extradata_size);
-
-    version = get_bits(&gb, 2);
-    if (version > 1)
-    {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported Sonic version, please report\n");
-        return -1;
-    }
-
-    if (version == 1)
-    {
-        s->channels = get_bits(&gb, 2);
-        s->samplerate = samplerate_table[get_bits(&gb, 4)];
-        av_log(avctx, AV_LOG_INFO, "Sonicv2 chans: %d samprate: %d\n",
-            s->channels, s->samplerate);
-    }
-
-    if (s->channels > MAX_CHANNELS)
-    {
-        av_log(avctx, AV_LOG_ERROR, "Only mono and stereo streams are supported by now\n");
-        return -1;
-    }
-
-    s->lossless = get_bits1(&gb);
-    if (!s->lossless)
-        skip_bits(&gb, 3); // XXX FIXME
-    s->decorrelation = get_bits(&gb, 2);
-
-    s->downsampling = get_bits(&gb, 2);
-    s->num_taps = (get_bits(&gb, 5)+1)<<5;
-    if (get_bits1(&gb)) // XXX FIXME
-        av_log(avctx, AV_LOG_INFO, "Custom quant table\n");
-
-    s->block_align = (int)(2048.0*(s->samplerate/44100))/s->downsampling;
-    s->frame_size = s->channels*s->block_align*s->downsampling;
-//    avctx->frame_size = s->block_align;
-
-    av_log(avctx, AV_LOG_INFO, "Sonic: ver: %d ls: %d dr: %d taps: %d block: %d frame: %d downsamp: %d\n",
-        version, s->lossless, s->decorrelation, s->num_taps, s->block_align, s->frame_size, s->downsampling);
-
-    // generate taps
-    s->tap_quant = av_mallocz(4* s->num_taps);
-    for (i = 0; i < s->num_taps; i++)
-        s->tap_quant[i] = (int)(sqrt(i+1));
-
-    s->predictor_k = av_mallocz(4* s->num_taps);
-
-    for (i = 0; i < s->channels; i++)
-    {
-        s->predictor_state[i] = av_mallocz(4* s->num_taps);
-        if (!s->predictor_state[i])
-            return -1;
-    }
-
-    for (i = 0; i < s->channels; i++)
-    {
-        s->coded_samples[i] = av_mallocz(4* s->block_align);
-        if (!s->coded_samples[i])
-            return -1;
-    }
-    s->int_samples = av_mallocz(4* s->frame_size);
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-static av_cold int sonic_decode_close(AVCodecContext *avctx)
-{
-    SonicContext *s = avctx->priv_data;
-    int i;
-
-    av_free(s->int_samples);
-    av_free(s->tap_quant);
-    av_free(s->predictor_k);
-
-    for (i = 0; i < s->channels; i++)
-    {
-        av_free(s->predictor_state[i]);
-        av_free(s->coded_samples[i]);
-    }
-
-    return 0;
-}
-
-static int sonic_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    SonicContext *s = avctx->priv_data;
-    GetBitContext gb;
-    int i, quant, ch, j;
-    short *samples = data;
-
-    if (buf_size == 0) return 0;
-
-//    av_log(NULL, AV_LOG_INFO, "buf_size: %d\n", buf_size);
-
-    init_get_bits(&gb, buf, buf_size*8);
-
-    intlist_read(&gb, s->predictor_k, s->num_taps, 0);
-
-    // dequantize
-    for (i = 0; i < s->num_taps; i++)
-        s->predictor_k[i] *= s->tap_quant[i];
-
-    if (s->lossless)
-        quant = 1;
-    else
-        quant = get_ue_golomb(&gb) * SAMPLE_FACTOR;
-
-//    av_log(NULL, AV_LOG_INFO, "quant: %d\n", quant);
-
-    for (ch = 0; ch < s->channels; ch++)
-    {
-        int x = ch;
-
-        predictor_init_state(s->predictor_k, s->predictor_state[ch], s->num_taps);
-
-        intlist_read(&gb, s->coded_samples[ch], s->block_align, 1);
-
-        for (i = 0; i < s->block_align; i++)
-        {
-            for (j = 0; j < s->downsampling - 1; j++)
-            {
-                s->int_samples[x] = predictor_calc_error(s->predictor_k, s->predictor_state[ch], s->num_taps, 0);
-                x += s->channels;
-            }
-
-            s->int_samples[x] = predictor_calc_error(s->predictor_k, s->predictor_state[ch], s->num_taps, s->coded_samples[ch][i] * quant);
-            x += s->channels;
-        }
-
-        for (i = 0; i < s->num_taps; i++)
-            s->predictor_state[ch][i] = s->int_samples[s->frame_size - s->channels + ch - i*s->channels];
-    }
-
-    switch(s->decorrelation)
-    {
-        case MID_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-            {
-                s->int_samples[i+1] += shift(s->int_samples[i], 1);
-                s->int_samples[i] -= s->int_samples[i+1];
-            }
-            break;
-        case LEFT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i+1] += s->int_samples[i];
-            break;
-        case RIGHT_SIDE:
-            for (i = 0; i < s->frame_size; i += s->channels)
-                s->int_samples[i] += s->int_samples[i+1];
-            break;
-    }
-
-    if (!s->lossless)
-        for (i = 0; i < s->frame_size; i++)
-            s->int_samples[i] = shift(s->int_samples[i], SAMPLE_SHIFT);
-
-    // internal -> short
-    for (i = 0; i < s->frame_size; i++)
-        samples[i] = av_clip_int16(s->int_samples[i]);
-
-    align_get_bits(&gb);
-
-    *data_size = s->frame_size * 2;
-
-    return (get_bits_count(&gb)+7)/8;
-}
-
-AVCodec sonic_decoder = {
-    "sonic",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SONIC,
-    sizeof(SonicContext),
-    sonic_decode_init,
-    NULL,
-    sonic_decode_close,
-    sonic_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
-};
-#endif /* CONFIG_SONIC_DECODER */
-
-#if CONFIG_SONIC_ENCODER
-AVCodec sonic_encoder = {
-    "sonic",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SONIC,
-    sizeof(SonicContext),
-    sonic_encode_init,
-    sonic_encode_frame,
-    sonic_encode_close,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Sonic"),
-};
-#endif
-
-#if CONFIG_SONIC_LS_ENCODER
-AVCodec sonic_ls_encoder = {
-    "sonicls",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_SONIC_LS,
-    sizeof(SonicContext),
-    sonic_encode_init,
-    sonic_encode_frame,
-    sonic_encode_close,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"),
-};
-#endif
diff --git a/libavcodec/sp5x.h b/libavcodec/sp5x.h
deleted file mode 100644
index b2c53cc..0000000
--- a/libavcodec/sp5x.h
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Sunplus JPEG tables
- * Copyright (c) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SP5X_H
-#define AVCODEC_SP5X_H
-
-#include <stdint.h>
-
-static const uint8_t sp5x_data_sof[] =
-{
-    0xFF, 0xC0,       /* SOF */
-    0x00, 0x11,       /* len */
-    0x08,             /* bits */
-    0x00, 0xf0,       /* height (default: 240) */
-    0x01, 0x40,       /* width (default: 240) */
-    0x03,             /* nb components */
-    0x01, 0x22, 0x00, /* 21 vs 22 ? */
-    0x02, 0x11, 0x01,
-    0x03, 0x11, 0x01
-};
-
-static const uint8_t sp5x_data_sos[] =
-{
-    0xFF, 0xDA,       /* SOS */
-    0x00, 0x0C,       /* len */
-    0x03,             /* nb components */
-    0x01, 0x00,
-    0x02, 0x11,
-    0x03, 0x11,
-    0x00,             /* Ss */
-    0x3F,             /* Se */
-    0x00              /* Ah/Al */
-};
-
-static const uint8_t sp5x_data_dqt[] =
-{
-    0xFF, 0xDB, /* DQT */
-    0x00, 0x84, /* len */
-    0x00,
-    0x05, 0x03, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04,
-    0x04, 0x04, 0x06, 0x05, 0x05, 0x06, 0x08, 0x0D,
-    0x08, 0x08, 0x07, 0x07, 0x08, 0x10, 0x0C, 0x0C,
-    0x0A, 0x0D, 0x14, 0x11, 0x15, 0x14, 0x13, 0x11,
-    0x13, 0x13, 0x16, 0x18, 0x1F, 0x1A, 0x16, 0x17,
-    0x1E, 0x17, 0x13, 0x13, 0x1B, 0x25, 0x1C, 0x1E,
-    0x20, 0x21, 0x23, 0x23, 0x23, 0x15, 0x1A, 0x27,
-    0x29, 0x26, 0x22, 0x29, 0x1F, 0x22, 0x23, 0x22,
-    0x01,
-    0x05, 0x06, 0x06, 0x08, 0x07, 0x08, 0x10, 0x08,
-    0x08, 0x10, 0x22, 0x16, 0x13, 0x16, 0x22, 0x22,
-    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
-    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
-    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
-    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
-    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
-    0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22
-};
-
-static const uint8_t sp5x_data_dht[] = {
-    0xFF, 0xC4, /* DHT */
-    0x01, 0xA2, /* len */
-    0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01,
-    0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-    0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
-    0x07, 0x08, 0x09, 0x0A, 0x0B, 0x01, 0x00, 0x03,
-    0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-    0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
-    0x0A, 0x0B, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03,
-    0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x04, 0x00,
-    0x00, 0x01, 0x7D, 0x01, 0x02, 0x03, 0x00, 0x04,
-    0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13,
-    0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81,
-    0x91, 0xA1, 0x08, 0x23, 0x42, 0xB1, 0xC1, 0x15,
-    0x52, 0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82,
-    0x09, 0x0A, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25,
-    0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36,
-    0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46,
-    0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56,
-    0x57, 0x58, 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66,
-    0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76,
-    0x77, 0x78, 0x79, 0x7A, 0x83, 0x84, 0x85, 0x86,
-    0x87, 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95,
-    0x96, 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4,
-    0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3,
-    0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2,
-    0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA,
-    0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9,
-    0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
-    0xE8, 0xE9, 0xEA, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5,
-    0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0x11, 0x00, 0x02,
-    0x01, 0x02, 0x04, 0x04, 0x03, 0x04, 0x07, 0x05,
-    0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, 0x01,
-    0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06,
-    0x12, 0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22,
-    0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1,
-    0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0, 0x15, 0x62,
-    0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25,
-    0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26, 0x27, 0x28,
-    0x29, 0x2A, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A,
-    0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A,
-    0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A,
-    0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A,
-    0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A,
-    0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
-    0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
-    0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
-    0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6,
-    0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5,
-    0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4,
-    0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3,
-    0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xF2,
-    0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA
-};
-
-
-static const uint8_t sp5x_quant_table[20][64]=
-{
-    /* index 0, Q50 */
-    {  16, 11, 12, 14, 12, 10, 16, 14, 13, 14, 18, 17, 16, 19, 24, 40,
-       26, 24, 22, 22, 24, 49, 35, 37, 29, 40, 58, 51, 61, 60, 57, 51,
-       56, 55, 64, 72, 92, 78, 64, 68, 87, 69, 55, 56, 80,109, 81, 87,
-       95, 98,103,104,103, 62, 77,113,121,112,100,120, 92,101,103, 99 },
-    {  17, 18, 18, 24, 21, 24, 47, 26, 26, 47, 99, 66, 56, 66, 99, 99,
-       99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
-       99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
-       99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 },
-
-    /* index 1, Q70 */
-    {  10,  7,  7,  8,  7,  6, 10,  8,  8,  8, 11, 10, 10, 11, 14, 24,
-       16, 14, 13, 13, 14, 29, 21, 22, 17, 24, 35, 31, 37, 36, 34, 31,
-       34, 33, 38, 43, 55, 47, 38, 41, 52, 41, 33, 34, 48, 65, 49, 52,
-       57, 59, 62, 62, 62, 37, 46, 68, 73, 67, 60, 72, 55, 61, 62, 59 },
-    {  10, 11, 11, 14, 13, 14, 28, 16, 16, 28, 59, 40, 34, 40, 59, 59,
-       59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
-       59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
-       59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
-
-    /* index 2, Q80 */
-    {   6,  4,  5,  6,  5,  4,  6,  6,  5,  6,  7,  7,  6,  8, 10, 16,
-       10, 10,  9,  9, 10, 20, 14, 15, 12, 16, 23, 20, 24, 24, 23, 20,
-       22, 22, 26, 29, 37, 31, 26, 27, 35, 28, 22, 22, 32, 44, 32, 35,
-       38, 39, 41, 42, 41, 25, 31, 45, 48, 45, 40, 48, 37, 40, 41, 40 },
-    {   7,  7,  7, 10,  8, 10, 19, 10, 10, 19, 40, 26, 22, 26, 40, 40,
-       40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
-       40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
-       40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },
-
-    /* index 3, Q85 */
-    {   5,  3,  4,  4,  4,  3,  5,  4,  4,  4,  5,  5,  5,  6,  7, 12,
-        8,  7,  7,  7,  7, 15, 11, 11,  9, 12, 17, 15, 18, 18, 17, 15,
-       17, 17, 19, 22, 28, 23, 19, 20, 26, 21, 17, 17, 24, 33, 24, 26,
-       29, 29, 31, 31, 31, 19, 23, 34, 36, 34, 30, 36, 28, 30, 31, 30 },
-    {   5,  5,  5,  7,  6,  7, 14,  8,  8, 14, 30, 20, 17, 20, 30, 30,
-       30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
-       30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
-       30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 },
-
-    /* index 4, Q90 */
-    {   3,  2,  2,  3,  2,  2,  3,  3,  3,  3,  4,  3,  3,  4,  5,  8,
-        5,  5,  4,  4,  5, 10,  7,  7,  6,  8, 12, 10, 12, 12, 11, 10,
-       11, 11, 13, 14, 18, 16, 13, 14, 17, 14, 11, 11, 16, 22, 16, 17,
-       19, 20, 21, 21, 21, 12, 15, 23, 24, 22, 20, 24, 18, 20, 21, 20 },
-    {   3,  4,  4,  5,  4,  5,  9,  5,  5,  9, 20, 13, 11, 13, 20, 20,
-       20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-       20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-       20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 },
-
-    /* index 5, Q60 */
-    {  13,  9, 10, 11, 10,  8, 13, 11, 10, 11, 14, 14, 13, 15, 19, 32,
-       21, 19, 18, 18, 19, 39, 28, 30, 23, 32, 46, 41, 49, 48, 46, 41,
-       45, 44, 51, 58, 74, 62, 51, 54, 70, 55, 44, 45, 64, 87, 65, 70,
-       76, 78, 82, 83, 82, 50, 62, 90, 97, 90, 80, 96, 74, 81, 82, 79 },
-    {  14, 14, 14, 19, 17, 19, 38, 21, 21, 38, 79, 53, 45, 53, 79, 79,
-       79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
-       79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
-       79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 },
-
-    /* index 6, Q25 */
-    {  32, 22, 24, 28, 24, 20, 32, 28, 26, 28, 36, 34, 32, 38, 48, 80,
-       52, 48, 44, 44, 48, 98, 70, 74, 58, 80,116,102,122,120,114,102,
-      112,110,128,144,184,156,128,136,174,138,110,112,160,218,162,174,
-      190,196,206,208,206,124,154,226,242,224,200,240,184,202,206,198 },
-    {  34, 36, 36, 48, 42, 48, 94, 52, 52, 94,198,132,112,132,198,198,
-      198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
-      198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
-      198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 },
-
-    /* index 7, Q95 */
-    {   2,  1,  1,  1,  1,  1,  2,  1,  1,  1,  2,  2,  2,  2,  2,  4,
-        3,  2,  2,  2,  2,  5,  4,  4,  3,  4,  6,  5,  6,  6,  6,  5,
-        6,  6,  6,  7,  9,  8,  6,  7,  9,  7,  6,  6,  8, 11,  8,  9,
-       10, 10, 10, 10, 10,  6,  8, 11, 12, 11, 10, 12,  9, 10, 10, 10 },
-    {   2,  2,  2,  2,  2,  2,  5,  3,  3,  5, 10,  7,  6,  7, 10, 10,
-       10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-       10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-       10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
-
-    /* index 8, Q93 */
-    {   2,  2,  2,  2,  2,  1,  2,  2,  2,  2,  3,  2,  2,  3,  3,  6,
-        4,  3,  3,  3,  3,  7,  5,  5,  4,  6,  8,  7,  9,  8,  8,  7,
-        8,  8,  9, 10, 13, 11,  9, 10, 12, 10,  8,  8, 11, 15, 11, 12,
-       13, 14, 14, 15, 14,  9, 11, 16, 17, 16, 14, 17, 13, 14, 14, 14 },
-    {   2,  3,  3,  3,  3,  3,  7,  4,  4,  7, 14,  9,  8,  9, 14, 14,
-       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 },
-
-    /* index 9, Q40 */
-    {  20, 14, 15, 18, 15, 13, 20, 18, 16, 18, 23, 21, 20, 24, 30, 50,
-       33, 30, 28, 28, 30, 61, 44, 46, 36, 50, 73, 64, 76, 75, 71, 64,
-       70, 69, 80, 90,115, 98, 80, 85,109, 86, 69, 70,100,136,101,109,
-      119,123,129,130,129, 78, 96,141,151,140,125,150,115,126,129,124 },
-    {  21, 23, 23, 30, 26, 30, 59, 33, 33, 59,124, 83, 70, 83,124,124,
-      124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
-      124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,
-      124,124,124,124,124,124,124,124,124,124,124,124,124,124,124,124 }
-};
-
-#if 0
-/* 4NF-M, not ZigZag */
-static const uint8_t sp5x_quant_table_orig[18][64] =
-{
-    /* index 0, Q50 */
-    {  16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55,
-       14, 13, 16, 24, 40, 57, 69, 56, 14, 17, 22, 29, 51, 87, 80, 62,
-       18, 22, 37, 56, 68,109,103, 77, 24, 35, 55, 64, 81,104,113, 92,
-       49, 64, 78, 87,103,121,120,101, 72, 92, 95, 98,112,100,103, 99 },
-    {  17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99,
-       24, 26, 56, 99, 99, 99, 99, 99, 47, 66, 99, 99, 99, 99, 99, 99,
-       99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
-       99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 },
-
-    /* index 1, Q70 */
-    {  10,  7,  6, 10, 14, 24, 31, 37,  7,  7,  8, 11, 16, 35, 36, 33,
-        8,  8, 10, 14, 24, 34, 41, 34,  8, 10, 13, 17, 31, 52, 48, 37,
-       11, 13, 22, 34, 41, 65, 62, 46, 14, 21, 33, 38, 49, 62, 68, 55,
-       29, 38, 47, 52, 62, 73, 72, 61, 43, 55, 57, 59, 67, 60, 62, 59 },
-    {  10, 11, 14, 28, 59, 59, 59, 59, 11, 13, 16, 40, 59, 59, 59, 59,
-       14, 16, 34, 59, 59, 59, 59, 59, 28, 40, 59, 59, 59, 59, 59, 59,
-       59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
-       59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59 },
-
-    /* index 2, Q80 */
-    {   6,  4,  4,  6, 10, 16, 20, 24,  5,  5,  6,  8, 10, 23, 24, 22,
-        6,  5,  6, 10, 16, 23, 28, 22,  6,  7,  9, 12, 20, 35, 32, 25,
-        7,  9, 15, 22, 27, 44, 41, 31, 10, 14, 22, 26, 32, 42, 45, 37,
-       20, 26, 31, 35, 41, 48, 48, 40, 29, 37, 38, 39, 45, 40, 41, 40 },
-    {   7,  7, 10, 19, 40, 40, 40, 40,  7,  8, 10, 26, 40, 40, 40, 40,
-       10, 10, 22, 40, 40, 40, 40, 40, 19, 26, 40, 40, 40, 40, 40, 40,
-       40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
-       40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 },
-
-    /* index 3, Q85 */
-    {   5,  3,  3,  5,  7, 12, 15, 18,  4,  4,  4,  6,  8, 17, 18, 17,
-        4,  4,  5,  7, 12, 17, 21, 17,  4,  5,  7,  9, 15, 26, 24, 19,
-        5,  7, 11, 17, 20, 33, 31, 23,  7, 11, 17, 19, 24, 31, 34, 28,
-       15, 19, 23, 26, 31, 36, 36, 30, 22, 28, 29, 29, 34, 30, 31, 30 },
-    {   5,  5,  7, 14, 30, 30, 30, 30,  5,  6,  8, 20, 30, 30, 30, 30,
-        7,  8, 17, 30, 30, 30, 30, 30, 14, 20, 30, 30, 30, 30, 30, 30,
-       30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
-       30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 },
-
-    /* index 4, Q90 */
-    {   3,  2,  2,  3,  5,  8, 10, 12,  2,  2,  3,  4,  5, 12, 12, 11,
-        3,  3,  3,  5,  8, 11, 14, 11,  3,  3,  4,  6, 10, 17, 16, 12,
-        4,  4,  7, 11, 14, 22, 21, 15,  5,  7, 11, 13, 16, 21, 23, 18,
-       10, 13, 16, 17, 21, 24, 24, 20, 14, 18, 19, 20, 22, 20, 21, 20 },
-    {   3,  4,  5,  9, 20, 20, 20, 20,  4,  4,  5, 13, 20, 20, 20, 20,
-        5,  5, 11, 20, 20, 20, 20, 20,  9, 13, 20, 20, 20, 20, 20, 20,
-       20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-       20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 },
-
-    /* index 5, Q60 */
-    {  13,  9,  8, 13, 19, 32, 41, 49, 10, 10, 11, 15, 21, 46, 48, 44,
-       11, 10, 13, 19, 32, 46, 55, 45, 11, 14, 18, 23, 41, 70, 64, 50,
-       14, 18, 30, 45, 54, 87, 82, 62, 19, 28, 44, 51, 65, 83, 90, 74,
-       39, 51, 62, 70, 82, 97, 96, 81, 58, 74, 76, 78, 90, 80, 82, 79 },
-    {  14, 14, 19, 38, 79, 79, 79, 79, 14, 17, 21, 53, 79, 79, 79, 79,
-       19, 21, 45, 79, 79, 79, 79, 79, 38, 53, 79, 79, 79, 79, 79, 79,
-       79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
-       79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79 },
-
-    /* index 6, Q25 */
-    {  32, 22, 20, 32, 48, 80,102,122, 24, 24, 28, 38, 52,116,120,110,
-       28, 26, 32, 48, 80,114,138,112, 28, 34, 44, 58,102,174,160,124,
-       36, 44, 74,112,136,218,206,154, 48, 70,110,128,162,208,226,184,
-       98,128,156,174,206,242,240,202,144,184,190,196,224,200,206,198 },
-    {  34, 36, 48, 94,198,198,198,198, 36, 42, 52,132,198,198,198,198,
-       48, 52,112,198,198,198,198,198, 94,132,198,198,198,198,198,198,
-      198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,
-      198,198,198,198,198,198,198,198,198,198,198,198,198,198,198,198 },
-
-    /* index 7, Q95 */
-    {   2,  1,  1,  2,  2,  4,  5,  6,  1,  1,  1,  2,  3,  6,  6,  6,
-        1,  1,  2,  2,  4,  6,  7,  6,  1,  2,  2,  3,  5,  9,  8,  6,
-        2,  2,  4,  6,  7, 11, 10,  8,  2,  4,  6,  6,  8, 10, 11,  9,
-        5,  6,  8,  9, 10, 12, 12, 10,  7,  9, 10, 10, 11, 10, 10, 10 },
-    {   2,  2,  2,  5, 10, 10, 10, 10,  2,  2,  3,  7, 10, 10, 10, 10,
-        2,  3,  6, 10, 10, 10, 10, 10,  5,  7, 10, 10, 10, 10, 10, 10,
-       10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
-       10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
-
-    /* index 8, Q93 */
-    {   2,  2,  1,  2,  3,  6,  7,  9,  2,  2,  2,  3,  4,  8,  8,  8,
-        2,  2,  2,  3,  6,  8, 10,  8,  2,  2,  3,  4,  7, 12, 11,  9,
-        3,  3,  5,  8, 10, 15, 14, 11,  3,  5,  8,  9, 11, 15, 16, 13,
-        7,  9, 11, 12, 14, 17, 17, 14, 10, 13, 13, 14, 16, 14, 14, 14 },
-    {   2,  3,  3,  7, 14, 14, 14, 14,  3,  3,  4,  9, 14, 14, 14, 14,
-        3,  4,  8, 14, 14, 14, 14, 14,  7,  9, 14, 14, 14, 14, 14, 14,
-       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-       14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }
-};
-#endif
-
-#endif /* AVCODEC_SP5X_H */
diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
deleted file mode 100644
index 754926a..0000000
--- a/libavcodec/sp5xdec.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Sunplus JPEG decoder (SP5X)
- * Copyright (c) 2003 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sunplus JPEG decoder (SP5X).
- */
-
-#include "avcodec.h"
-#include "mjpeg.h"
-#include "mjpegdec.h"
-#include "sp5x.h"
-
-
-static int sp5x_decode_frame(AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AVPacket avpkt_recoded;
-#if 0
-    MJpegDecodeContext *s = avctx->priv_data;
-#endif
-    const int qscale = 5;
-    const uint8_t *buf_ptr;
-    uint8_t *recoded;
-    int i = 0, j = 0;
-
-    if (!avctx->width || !avctx->height)
-        return -1;
-
-    buf_ptr = buf;
-
-#if 1
-    recoded = av_mallocz(buf_size + 1024);
-    if (!recoded)
-        return -1;
-
-    /* SOI */
-    recoded[j++] = 0xFF;
-    recoded[j++] = 0xD8;
-
-    memcpy(recoded+j, &sp5x_data_dqt[0], sizeof(sp5x_data_dqt));
-    memcpy(recoded+j+5, &sp5x_quant_table[qscale * 2], 64);
-    memcpy(recoded+j+70, &sp5x_quant_table[(qscale * 2) + 1], 64);
-    j += sizeof(sp5x_data_dqt);
-
-    memcpy(recoded+j, &sp5x_data_dht[0], sizeof(sp5x_data_dht));
-    j += sizeof(sp5x_data_dht);
-
-    memcpy(recoded+j, &sp5x_data_sof[0], sizeof(sp5x_data_sof));
-    AV_WB16(recoded+j+5, avctx->coded_height);
-    AV_WB16(recoded+j+7, avctx->coded_width);
-    j += sizeof(sp5x_data_sof);
-
-    memcpy(recoded+j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
-    j += sizeof(sp5x_data_sos);
-
-    if(avctx->codec_id==CODEC_ID_AMV)
-        for (i = 2; i < buf_size-2 && j < buf_size+1024-2; i++)
-            recoded[j++] = buf[i];
-    else
-    for (i = 14; i < buf_size && j < buf_size+1024-2; i++)
-    {
-        recoded[j++] = buf[i];
-        if (buf[i] == 0xff)
-            recoded[j++] = 0;
-    }
-
-    /* EOI */
-    recoded[j++] = 0xFF;
-    recoded[j++] = 0xD9;
-
-    avctx->flags &= ~CODEC_FLAG_EMU_EDGE;
-    av_init_packet(&avpkt_recoded);
-    avpkt_recoded.data = recoded;
-    avpkt_recoded.size = j;
-    i = ff_mjpeg_decode_frame(avctx, data, data_size, &avpkt_recoded);
-
-    av_free(recoded);
-
-#else
-    /* SOF */
-    s->bits = 8;
-    s->width  = avctx->coded_width;
-    s->height = avctx->coded_height;
-    s->nb_components = 3;
-    s->component_id[0] = 0;
-    s->h_count[0] = 2;
-    s->v_count[0] = 2;
-    s->quant_index[0] = 0;
-    s->component_id[1] = 1;
-    s->h_count[1] = 1;
-    s->v_count[1] = 1;
-    s->quant_index[1] = 1;
-    s->component_id[2] = 2;
-    s->h_count[2] = 1;
-    s->v_count[2] = 1;
-    s->quant_index[2] = 1;
-    s->h_max = 2;
-    s->v_max = 2;
-
-    s->qscale_table = av_mallocz((s->width+15)/16);
-    avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420;
-    s->interlaced = 0;
-
-    s->picture.reference = 0;
-    if (avctx->get_buffer(avctx, &s->picture) < 0)
-    {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    s->picture.pict_type = FF_I_TYPE;
-    s->picture.key_frame = 1;
-
-    for (i = 0; i < 3; i++)
-        s->linesize[i] = s->picture.linesize[i] << s->interlaced;
-
-    /* DQT */
-    for (i = 0; i < 64; i++)
-    {
-        j = s->scantable.permutated[i];
-        s->quant_matrixes[0][j] = sp5x_quant_table[(qscale * 2) + i];
-    }
-    s->qscale[0] = FFMAX(
-        s->quant_matrixes[0][s->scantable.permutated[1]],
-        s->quant_matrixes[0][s->scantable.permutated[8]]) >> 1;
-
-    for (i = 0; i < 64; i++)
-    {
-        j = s->scantable.permutated[i];
-        s->quant_matrixes[1][j] = sp5x_quant_table[(qscale * 2) + 1 + i];
-    }
-    s->qscale[1] = FFMAX(
-        s->quant_matrixes[1][s->scantable.permutated[1]],
-        s->quant_matrixes[1][s->scantable.permutated[8]]) >> 1;
-
-    /* DHT */
-
-    /* SOS */
-    s->comp_index[0] = 0;
-    s->nb_blocks[0] = s->h_count[0] * s->v_count[0];
-    s->h_scount[0] = s->h_count[0];
-    s->v_scount[0] = s->v_count[0];
-    s->dc_index[0] = 0;
-    s->ac_index[0] = 0;
-
-    s->comp_index[1] = 1;
-    s->nb_blocks[1] = s->h_count[1] * s->v_count[1];
-    s->h_scount[1] = s->h_count[1];
-    s->v_scount[1] = s->v_count[1];
-    s->dc_index[1] = 1;
-    s->ac_index[1] = 1;
-
-    s->comp_index[2] = 2;
-    s->nb_blocks[2] = s->h_count[2] * s->v_count[2];
-    s->h_scount[2] = s->h_count[2];
-    s->v_scount[2] = s->v_count[2];
-    s->dc_index[2] = 1;
-    s->ac_index[2] = 1;
-
-    for (i = 0; i < 3; i++)
-        s->last_dc[i] = 1024;
-
-    s->mb_width = (s->width * s->h_max * 8 -1) / (s->h_max * 8);
-    s->mb_height = (s->height * s->v_max * 8 -1) / (s->v_max * 8);
-
-    init_get_bits(&s->gb, buf+14, (buf_size-14)*8);
-
-    return mjpeg_decode_scan(s);
-#endif
-
-    return i;
-}
-
-AVCodec sp5x_decoder = {
-    "sp5x",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SP5X,
-    sizeof(MJpegDecodeContext),
-    ff_mjpeg_decode_init,
-    NULL,
-    ff_mjpeg_decode_end,
-    sp5x_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
-};
-
-AVCodec amv_decoder = {
-    "amv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_AMV,
-    sizeof(MJpegDecodeContext),
-    ff_mjpeg_decode_init,
-    NULL,
-    ff_mjpeg_decode_end,
-    sp5x_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("AMV Video"),
-};
diff --git a/libavcodec/sparc/Makefile b/libavcodec/sparc/Makefile
deleted file mode 100644
index 4b38746..0000000
--- a/libavcodec/sparc/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-OBJS-$(HAVE_VIS)                       += sparc/dsputil_vis.o           \
-                                          sparc/simple_idct_vis.o       \
diff --git a/libavcodec/sparc/dsputil_vis.c b/libavcodec/sparc/dsputil_vis.c
deleted file mode 100644
index a39096c..0000000
--- a/libavcodec/sparc/dsputil_vis.c
+++ /dev/null
@@ -1,4005 +0,0 @@
-/*
- * Copyright (C) 2003 David S. Miller <davem at redhat.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* The *no_round* functions have been added by James A. Morrison, 2003,2004.
-   The vis code from libmpeg2 was adapted for ffmpeg by James A. Morrison.
- */
-
-#include "config.h"
-
-#include <inttypes.h>
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_vis.h"
-
-#include "vis.h"
-
-/* The trick used in some of this file is the formula from the MMX
- * motion comp code, which is:
- *
- * (x+y+1)>>1 == (x|y)-((x^y)>>1)
- *
- * This allows us to average 8 bytes at a time in a 64-bit FPU reg.
- * We avoid overflows by masking before we do the shift, and we
- * implement the shift by multiplying by 1/2 using mul8x16.  So in
- * VIS this is (assume 'x' is in f0, 'y' is in f2, a repeating mask
- * of '0xfe' is in f4, a repeating mask of '0x7f' is in f6, and
- * the value 0x80808080 is in f8):
- *
- *      fxor            f0,   f2, f10
- *      fand            f10,  f4, f10
- *      fmul8x16        f8,  f10, f10
- *      fand            f10,  f6, f10
- *      for             f0,   f2, f12
- *      fpsub16         f12, f10, f10
- */
-
-#define DUP4(x) {x, x, x, x}
-#define DUP8(x) {x, x, x, x, x, x, x, x}
-DECLARE_ALIGNED(8, static const int16_t, constants1)[] = DUP4 (1);
-DECLARE_ALIGNED(8, static const int16_t, constants2)[] = DUP4 (2);
-DECLARE_ALIGNED(8, static const int16_t, constants3)[] = DUP4 (3);
-DECLARE_ALIGNED(8, static const int16_t, constants6)[] = DUP4 (6);
-DECLARE_ALIGNED(8, static const int8_t, constants_fe)[] = DUP8 (0xfe);
-DECLARE_ALIGNED(8, static const int8_t, constants_7f)[] = DUP8 (0x7f);
-DECLARE_ALIGNED(8, static const int8_t, constants128)[] = DUP8 (128);
-DECLARE_ALIGNED(8, static const int16_t, constants256_512)[] =
-        {256, 512, 256, 512};
-DECLARE_ALIGNED(8, static const int16_t, constants256_1024)[] =
-        {256, 1024, 256, 1024};
-
-#define REF_0           0
-#define REF_0_1         1
-#define REF_2           2
-#define REF_2_1         3
-#define REF_4           4
-#define REF_4_1         5
-#define REF_6           6
-#define REF_6_1         7
-#define REF_S0          8
-#define REF_S0_1        9
-#define REF_S2          10
-#define REF_S2_1        11
-#define REF_S4          12
-#define REF_S4_1        13
-#define REF_S6          14
-#define REF_S6_1        15
-#define DST_0           16
-#define DST_1           17
-#define DST_2           18
-#define DST_3           19
-#define CONST_1         20
-#define CONST_2         20
-#define CONST_3         20
-#define CONST_6         20
-#define MASK_fe         20
-#define CONST_128       22
-#define CONST_256       22
-#define CONST_512       22
-#define CONST_1024      22
-#define TMP0            24
-#define TMP1            25
-#define TMP2            26
-#define TMP3            27
-#define TMP4            28
-#define TMP5            29
-#define ZERO            30
-#define MASK_7f         30
-
-#define TMP6            32
-#define TMP8            34
-#define TMP10           36
-#define TMP12           38
-#define TMP14           40
-#define TMP16           42
-#define TMP18           44
-#define TMP20           46
-#define TMP22           48
-#define TMP24           50
-#define TMP26           52
-#define TMP28           54
-#define TMP30           56
-#define TMP32           58
-
-static void MC_put_o_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        do {    /* 5 cycles */
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64_2(ref, 8, TMP2);
-
-                vis_ld64_2(ref, 16, TMP4);
-                ref += stride;
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-                vis_st64(REF_0, dest[0]);
-
-                vis_faligndata(TMP2, TMP4, REF_2);
-                vis_st64_2(REF_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_o_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        do {    /* 4 cycles */
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64(ref[8], TMP2);
-                ref += stride;
-
-                /* stall */
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-                vis_st64(REF_0, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-
-static void MC_avg_o_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        int stride_8 = stride + 8;
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64(ref[8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(dest[0], DST_0);
-
-        vis_ld64(dest[8], DST_2);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP2, TMP4, REF_2);
-
-        vis_ld64(constants128[0], CONST_128);
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 24 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(DST_0, REF_0, TMP6);
-
-                vis_ld64_2(ref, 8, TMP2);
-                vis_and(TMP6, MASK_fe, TMP6);
-
-                vis_ld64_2(ref, 16, TMP4);
-                ref += stride;
-                vis_mul8x16(CONST_128, TMP6, TMP6);
-                vis_xor(DST_2, REF_2, TMP8);
-
-                vis_and(TMP8, MASK_fe, TMP8);
-
-                vis_or(DST_0, REF_0, TMP10);
-                vis_ld64_2(dest, stride, DST_0);
-                vis_mul8x16(CONST_128, TMP8, TMP8);
-
-                vis_or(DST_2, REF_2, TMP12);
-                vis_ld64_2(dest, stride_8, DST_2);
-
-                vis_ld64(ref[0], TMP14);
-                vis_and(TMP6, MASK_7f, TMP6);
-
-                vis_and(TMP8, MASK_7f, TMP8);
-
-                vis_psub16(TMP10, TMP6, TMP6);
-                vis_st64(TMP6, dest[0]);
-
-                vis_psub16(TMP12, TMP8, TMP8);
-                vis_st64_2(TMP8, dest, 8);
-
-                dest += stride;
-                vis_ld64_2(ref, 8, TMP16);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, 16, TMP18);
-                vis_faligndata(TMP2, TMP4, REF_2);
-                ref += stride;
-
-                vis_xor(DST_0, REF_0, TMP20);
-
-                vis_and(TMP20, MASK_fe, TMP20);
-
-                vis_xor(DST_2, REF_2, TMP22);
-                vis_mul8x16(CONST_128, TMP20, TMP20);
-
-                vis_and(TMP22, MASK_fe, TMP22);
-
-                vis_or(DST_0, REF_0, TMP24);
-                vis_mul8x16(CONST_128, TMP22, TMP22);
-
-                vis_or(DST_2, REF_2, TMP26);
-
-                vis_ld64_2(dest, stride, DST_0);
-                vis_faligndata(TMP14, TMP16, REF_0);
-
-                vis_ld64_2(dest, stride_8, DST_2);
-                vis_faligndata(TMP16, TMP18, REF_2);
-
-                vis_and(TMP20, MASK_7f, TMP20);
-
-                vis_and(TMP22, MASK_7f, TMP22);
-
-                vis_psub16(TMP24, TMP20, TMP20);
-                vis_st64(TMP20, dest[0]);
-
-                vis_psub16(TMP26, TMP22, TMP22);
-                vis_st64_2(TMP22, dest, 8);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(DST_0, REF_0, TMP6);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_and(TMP6, MASK_fe, TMP6);
-
-        vis_ld64_2(ref, 16, TMP4);
-        vis_mul8x16(CONST_128, TMP6, TMP6);
-        vis_xor(DST_2, REF_2, TMP8);
-
-        vis_and(TMP8, MASK_fe, TMP8);
-
-        vis_or(DST_0, REF_0, TMP10);
-        vis_ld64_2(dest, stride, DST_0);
-        vis_mul8x16(CONST_128, TMP8, TMP8);
-
-        vis_or(DST_2, REF_2, TMP12);
-        vis_ld64_2(dest, stride_8, DST_2);
-
-        vis_ld64(ref[0], TMP14);
-        vis_and(TMP6, MASK_7f, TMP6);
-
-        vis_and(TMP8, MASK_7f, TMP8);
-
-        vis_psub16(TMP10, TMP6, TMP6);
-        vis_st64(TMP6, dest[0]);
-
-        vis_psub16(TMP12, TMP8, TMP8);
-        vis_st64_2(TMP8, dest, 8);
-
-        dest += stride;
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_faligndata(TMP2, TMP4, REF_2);
-
-        vis_xor(DST_0, REF_0, TMP20);
-
-        vis_and(TMP20, MASK_fe, TMP20);
-
-        vis_xor(DST_2, REF_2, TMP22);
-        vis_mul8x16(CONST_128, TMP20, TMP20);
-
-        vis_and(TMP22, MASK_fe, TMP22);
-
-        vis_or(DST_0, REF_0, TMP24);
-        vis_mul8x16(CONST_128, TMP22, TMP22);
-
-        vis_or(DST_2, REF_2, TMP26);
-
-        vis_and(TMP20, MASK_7f, TMP20);
-
-        vis_and(TMP22, MASK_7f, TMP22);
-
-        vis_psub16(TMP24, TMP20, TMP20);
-        vis_st64(TMP20, dest[0]);
-
-        vis_psub16(TMP26, TMP22, TMP22);
-        vis_st64_2(TMP22, dest, 8);
-}
-
-static void MC_avg_o_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64(ref[8], TMP2);
-
-        vis_ld64(dest[0], DST_0);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants128[0], CONST_128);
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 12 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(DST_0, REF_0, TMP4);
-
-                vis_ld64(ref[8], TMP2);
-                vis_and(TMP4, MASK_fe, TMP4);
-
-                vis_or(DST_0, REF_0, TMP6);
-                vis_ld64_2(dest, stride, DST_0);
-                ref += stride;
-                vis_mul8x16(CONST_128, TMP4, TMP4);
-
-                vis_ld64(ref[0], TMP12);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64(ref[8], TMP2);
-                vis_xor(DST_0, REF_0, TMP0);
-                ref += stride;
-
-                vis_and(TMP0, MASK_fe, TMP0);
-
-                vis_and(TMP4, MASK_7f, TMP4);
-
-                vis_psub16(TMP6, TMP4, TMP4);
-                vis_st64(TMP4, dest[0]);
-                dest += stride;
-                vis_mul8x16(CONST_128, TMP0, TMP0);
-
-                vis_or(DST_0, REF_0, TMP6);
-                vis_ld64_2(dest, stride, DST_0);
-
-                vis_faligndata(TMP12, TMP2, REF_0);
-
-                vis_and(TMP0, MASK_7f, TMP0);
-
-                vis_psub16(TMP6, TMP0, TMP4);
-                vis_st64(TMP4, dest[0]);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(DST_0, REF_0, TMP4);
-
-        vis_ld64(ref[8], TMP2);
-        vis_and(TMP4, MASK_fe, TMP4);
-
-        vis_or(DST_0, REF_0, TMP6);
-        vis_ld64_2(dest, stride, DST_0);
-        vis_mul8x16(CONST_128, TMP4, TMP4);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_xor(DST_0, REF_0, TMP0);
-
-        vis_and(TMP0, MASK_fe, TMP0);
-
-        vis_and(TMP4, MASK_7f, TMP4);
-
-        vis_psub16(TMP6, TMP4, TMP4);
-        vis_st64(TMP4, dest[0]);
-        dest += stride;
-        vis_mul8x16(CONST_128, TMP0, TMP0);
-
-        vis_or(DST_0, REF_0, TMP6);
-
-        vis_and(TMP0, MASK_7f, TMP0);
-
-        vis_psub16(TMP6, TMP0, TMP4);
-        vis_st64(TMP4, dest[0]);
-}
-
-static void MC_put_x_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0],    TMP0);
-
-        vis_ld64_2(ref, 8,  TMP2);
-
-        vis_ld64_2(ref, 16, TMP4);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants128[0], CONST_128);
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-                vis_faligndata(TMP2, TMP4, REF_6);
-        } else {
-                vis_src1(TMP2, REF_2);
-                vis_src1(TMP4, REF_6);
-        }
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 34 cycles */
-                vis_ld64(ref[0],    TMP0);
-                vis_xor(REF_0, REF_2, TMP6);
-
-                vis_ld64_2(ref, 8,  TMP2);
-                vis_xor(REF_4, REF_6, TMP8);
-
-                vis_ld64_2(ref, 16, TMP4);
-                vis_and(TMP6, MASK_fe, TMP6);
-                ref += stride;
-
-                vis_ld64(ref[0],    TMP14);
-                vis_mul8x16(CONST_128, TMP6, TMP6);
-                vis_and(TMP8, MASK_fe, TMP8);
-
-                vis_ld64_2(ref, 8,  TMP16);
-                vis_mul8x16(CONST_128, TMP8, TMP8);
-                vis_or(REF_0, REF_2, TMP10);
-
-                vis_ld64_2(ref, 16, TMP18);
-                ref += stride;
-                vis_or(REF_4, REF_6, TMP12);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                }
-
-                vis_and(TMP6, MASK_7f, TMP6);
-
-                vis_and(TMP8, MASK_7f, TMP8);
-
-                vis_psub16(TMP10, TMP6, TMP6);
-                vis_st64(TMP6, dest[0]);
-
-                vis_psub16(TMP12, TMP8, TMP8);
-                vis_st64_2(TMP8, dest, 8);
-                dest += stride;
-
-                vis_xor(REF_0, REF_2, TMP6);
-
-                vis_xor(REF_4, REF_6, TMP8);
-
-                vis_and(TMP6, MASK_fe, TMP6);
-
-                vis_mul8x16(CONST_128, TMP6, TMP6);
-                vis_and(TMP8, MASK_fe, TMP8);
-
-                vis_mul8x16(CONST_128, TMP8, TMP8);
-                vis_or(REF_0, REF_2, TMP10);
-
-                vis_or(REF_4, REF_6, TMP12);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_faligndata(TMP14, TMP16, REF_0);
-
-                vis_faligndata(TMP16, TMP18, REF_4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP14, TMP16, REF_2);
-                        vis_faligndata(TMP16, TMP18, REF_6);
-                } else {
-                        vis_src1(TMP16, REF_2);
-                        vis_src1(TMP18, REF_6);
-                }
-
-                vis_and(TMP6, MASK_7f, TMP6);
-
-                vis_and(TMP8, MASK_7f, TMP8);
-
-                vis_psub16(TMP10, TMP6, TMP6);
-                vis_st64(TMP6, dest[0]);
-
-                vis_psub16(TMP12, TMP8, TMP8);
-                vis_st64_2(TMP8, dest, 8);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0],    TMP0);
-        vis_xor(REF_0, REF_2, TMP6);
-
-        vis_ld64_2(ref, 8,  TMP2);
-        vis_xor(REF_4, REF_6, TMP8);
-
-        vis_ld64_2(ref, 16, TMP4);
-        vis_and(TMP6, MASK_fe, TMP6);
-
-        vis_mul8x16(CONST_128, TMP6, TMP6);
-        vis_and(TMP8, MASK_fe, TMP8);
-
-        vis_mul8x16(CONST_128, TMP8, TMP8);
-        vis_or(REF_0, REF_2, TMP10);
-
-        vis_or(REF_4, REF_6, TMP12);
-
-        vis_alignaddr_g0((void *)off);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-                vis_faligndata(TMP2, TMP4, REF_6);
-        } else {
-                vis_src1(TMP2, REF_2);
-                vis_src1(TMP4, REF_6);
-        }
-
-        vis_and(TMP6, MASK_7f, TMP6);
-
-        vis_and(TMP8, MASK_7f, TMP8);
-
-        vis_psub16(TMP10, TMP6, TMP6);
-        vis_st64(TMP6, dest[0]);
-
-        vis_psub16(TMP12, TMP8, TMP8);
-        vis_st64_2(TMP8, dest, 8);
-        dest += stride;
-
-        vis_xor(REF_0, REF_2, TMP6);
-
-        vis_xor(REF_4, REF_6, TMP8);
-
-        vis_and(TMP6, MASK_fe, TMP6);
-
-        vis_mul8x16(CONST_128, TMP6, TMP6);
-        vis_and(TMP8, MASK_fe, TMP8);
-
-        vis_mul8x16(CONST_128, TMP8, TMP8);
-        vis_or(REF_0, REF_2, TMP10);
-
-        vis_or(REF_4, REF_6, TMP12);
-
-        vis_and(TMP6, MASK_7f, TMP6);
-
-        vis_and(TMP8, MASK_7f, TMP8);
-
-        vis_psub16(TMP10, TMP6, TMP6);
-        vis_st64(TMP6, dest[0]);
-
-        vis_psub16(TMP12, TMP8, TMP8);
-        vis_st64_2(TMP8, dest, 8);
-}
-
-static void MC_put_x_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64(ref[8], TMP2);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-
-        vis_ld64(constants128[0], CONST_128);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-        } else {
-                vis_src1(TMP2, REF_2);
-        }
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 20 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(REF_0, REF_2, TMP4);
-
-                vis_ld64_2(ref, 8, TMP2);
-                vis_and(TMP4, MASK_fe, TMP4);
-                ref += stride;
-
-                vis_ld64(ref[0], TMP8);
-                vis_or(REF_0, REF_2, TMP6);
-                vis_mul8x16(CONST_128, TMP4, TMP4);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, 8, TMP10);
-                ref += stride;
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                }
-
-                vis_and(TMP4, MASK_7f, TMP4);
-
-                vis_psub16(TMP6, TMP4, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_xor(REF_0, REF_2, TMP12);
-
-                vis_and(TMP12, MASK_fe, TMP12);
-
-                vis_or(REF_0, REF_2, TMP14);
-                vis_mul8x16(CONST_128, TMP12, TMP12);
-
-                vis_alignaddr_g0((void *)off);
-                vis_faligndata(TMP8, TMP10, REF_0);
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP8, TMP10, REF_2);
-                } else {
-                        vis_src1(TMP10, REF_2);
-                }
-
-                vis_and(TMP12, MASK_7f, TMP12);
-
-                vis_psub16(TMP14, TMP12, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(REF_0, REF_2, TMP4);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_and(TMP4, MASK_fe, TMP4);
-
-        vis_or(REF_0, REF_2, TMP6);
-        vis_mul8x16(CONST_128, TMP4, TMP4);
-
-        vis_alignaddr_g0((void *)off);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-        } else {
-                vis_src1(TMP2, REF_2);
-        }
-
-        vis_and(TMP4, MASK_7f, TMP4);
-
-        vis_psub16(TMP6, TMP4, DST_0);
-        vis_st64(DST_0, dest[0]);
-        dest += stride;
-
-        vis_xor(REF_0, REF_2, TMP12);
-
-        vis_and(TMP12, MASK_fe, TMP12);
-
-        vis_or(REF_0, REF_2, TMP14);
-        vis_mul8x16(CONST_128, TMP12, TMP12);
-
-        vis_and(TMP12, MASK_7f, TMP12);
-
-        vis_psub16(TMP14, TMP12, DST_0);
-        vis_st64(DST_0, dest[0]);
-        dest += stride;
-}
-
-static void MC_avg_x_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_fzero(ZERO);
-        vis_ld64(constants256_512[0], CONST_256);
-
-        ref = vis_alignaddr(ref);
-        do {    /* 26 cycles */
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64(ref[8], TMP2);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64(ref[16], TMP4);
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64(dest[8], DST_2);
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                }
-
-                vis_mul8x16au(REF_0,   CONST_256, TMP0);
-
-                vis_pmerge(ZERO,     REF_2,     TMP4);
-                vis_mul8x16au(REF_0_1, CONST_256, TMP2);
-
-                vis_pmerge(ZERO, REF_2_1, TMP6);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-
-                vis_mul8x16al(DST_0,   CONST_512, TMP4);
-                vis_padd16(TMP2, TMP6, TMP2);
-
-                vis_mul8x16al(DST_1,   CONST_512, TMP6);
-
-                vis_mul8x16au(REF_6,   CONST_256, TMP12);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP14);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_4,   CONST_256, TMP16);
-
-                vis_padd16(TMP0, CONST_3, TMP8);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP18);
-
-                vis_padd16(TMP2, CONST_3, TMP10);
-                vis_pack16(TMP8, DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_padd16(TMP16, TMP12, TMP0);
-
-                vis_st64(DST_0, dest[0]);
-                vis_mul8x16al(DST_2,   CONST_512, TMP4);
-                vis_padd16(TMP18, TMP14, TMP2);
-
-                vis_mul8x16al(DST_3,   CONST_512, TMP6);
-                vis_padd16(TMP0, CONST_3, TMP0);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_pack16(TMP0, DST_2);
-
-                vis_pack16(TMP2, DST_3);
-                vis_st64(DST_2, dest[8]);
-
-                ref += stride;
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_x_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_times_2 = stride << 1;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_fzero(ZERO);
-        vis_ld64(constants256_512[0], CONST_256);
-
-        ref = vis_alignaddr(ref);
-        height >>= 2;
-        do {    /* 47 cycles */
-                vis_ld64(ref[0],   TMP0);
-
-                vis_ld64_2(ref, 8, TMP2);
-                ref += stride;
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64(ref[0],   TMP4);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, 8, TMP6);
-                ref += stride;
-
-                vis_ld64(ref[0],   TMP8);
-
-                vis_ld64_2(ref, 8, TMP10);
-                ref += stride;
-                vis_faligndata(TMP4, TMP6, REF_4);
-
-                vis_ld64(ref[0],   TMP12);
-
-                vis_ld64_2(ref, 8, TMP14);
-                ref += stride;
-                vis_faligndata(TMP8, TMP10, REF_S0);
-
-                vis_faligndata(TMP12, TMP14, REF_S4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-
-                        vis_ld64(dest[0], DST_0);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-
-                        vis_ld64_2(dest, stride, DST_2);
-                        vis_faligndata(TMP4, TMP6, REF_6);
-
-                        vis_faligndata(TMP8, TMP10, REF_S2);
-
-                        vis_faligndata(TMP12, TMP14, REF_S6);
-                } else {
-                        vis_ld64(dest[0], DST_0);
-                        vis_src1(TMP2, REF_2);
-
-                        vis_ld64_2(dest, stride, DST_2);
-                        vis_src1(TMP6, REF_6);
-
-                        vis_src1(TMP10, REF_S2);
-
-                        vis_src1(TMP14, REF_S6);
-                }
-
-                vis_pmerge(ZERO,     REF_0,     TMP0);
-                vis_mul8x16au(REF_0_1, CONST_256, TMP2);
-
-                vis_pmerge(ZERO,     REF_2,     TMP4);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP6);
-
-                vis_padd16(TMP0, CONST_3, TMP0);
-                vis_mul8x16al(DST_0,   CONST_512, TMP16);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-                vis_mul8x16al(DST_1,   CONST_512, TMP18);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-                vis_mul8x16au(REF_4, CONST_256, TMP8);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP10);
-
-                vis_padd16(TMP0, TMP16, TMP0);
-                vis_mul8x16au(REF_6, CONST_256, TMP12);
-
-                vis_padd16(TMP2, TMP18, TMP2);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP14);
-
-                vis_padd16(TMP8, CONST_3, TMP8);
-                vis_mul8x16al(DST_2, CONST_512, TMP16);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-                vis_mul8x16al(DST_3, CONST_512, TMP18);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_pack16(TMP0, DST_0);
-
-                vis_pack16(TMP2, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-                vis_padd16(TMP10, CONST_3, TMP10);
-
-                vis_ld64_2(dest, stride, DST_0);
-                vis_padd16(TMP8, TMP16, TMP8);
-
-                vis_ld64_2(dest, stride_times_2, TMP4/*DST_2*/);
-                vis_padd16(TMP10, TMP18, TMP10);
-                vis_pack16(TMP8, DST_2);
-
-                vis_pack16(TMP10, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-
-                vis_mul8x16au(REF_S0_1, CONST_256, TMP2);
-                vis_pmerge(ZERO,     REF_S0,     TMP0);
-
-                vis_pmerge(ZERO,     REF_S2,     TMP24);
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP6);
-
-                vis_padd16(TMP0, CONST_3, TMP0);
-                vis_mul8x16au(REF_S4, CONST_256, TMP8);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-                vis_mul8x16au(REF_S4_1, CONST_256, TMP10);
-
-                vis_padd16(TMP0, TMP24, TMP0);
-                vis_mul8x16au(REF_S6, CONST_256, TMP12);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_S6_1, CONST_256, TMP14);
-
-                vis_padd16(TMP8, CONST_3, TMP8);
-                vis_mul8x16al(DST_0,   CONST_512, TMP16);
-
-                vis_padd16(TMP10, CONST_3, TMP10);
-                vis_mul8x16al(DST_1,   CONST_512, TMP18);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-                vis_mul8x16al(TMP4/*DST_2*/, CONST_512, TMP20);
-
-                vis_mul8x16al(TMP5/*DST_3*/, CONST_512, TMP22);
-                vis_padd16(TMP0, TMP16, TMP0);
-
-                vis_padd16(TMP2, TMP18, TMP2);
-                vis_pack16(TMP0, DST_0);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_pack16(TMP2, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_padd16(TMP8, TMP20, TMP8);
-
-                vis_padd16(TMP10, TMP22, TMP10);
-                vis_pack16(TMP8, DST_2);
-
-                vis_pack16(TMP10, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_y_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64_2(ref, 8, TMP2);
-
-        vis_ld64_2(ref, 16, TMP4);
-        ref += stride;
-
-        vis_ld64(ref[0], TMP6);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64_2(ref, 8, TMP8);
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        vis_ld64_2(ref, 16, TMP10);
-        ref += stride;
-
-        vis_ld64(constants_fe[0], MASK_fe);
-        vis_faligndata(TMP6, TMP8, REF_2);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP8, TMP10, REF_6);
-
-        vis_ld64(constants128[0], CONST_128);
-        height = (height >> 1) - 1;
-        do {    /* 24 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(REF_0, REF_2, TMP12);
-
-                vis_ld64_2(ref, 8, TMP2);
-                vis_xor(REF_4, REF_6, TMP16);
-
-                vis_ld64_2(ref, 16, TMP4);
-                ref += stride;
-                vis_or(REF_0, REF_2, TMP14);
-
-                vis_ld64(ref[0], TMP6);
-                vis_or(REF_4, REF_6, TMP18);
-
-                vis_ld64_2(ref, 8, TMP8);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, 16, TMP10);
-                ref += stride;
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_and(TMP12, MASK_fe, TMP12);
-
-                vis_and(TMP16, MASK_fe, TMP16);
-                vis_mul8x16(CONST_128, TMP12, TMP12);
-
-                vis_mul8x16(CONST_128, TMP16, TMP16);
-                vis_xor(REF_0, REF_2, TMP0);
-
-                vis_xor(REF_4, REF_6, TMP2);
-
-                vis_or(REF_0, REF_2, TMP20);
-
-                vis_and(TMP12, MASK_7f, TMP12);
-
-                vis_and(TMP16, MASK_7f, TMP16);
-
-                vis_psub16(TMP14, TMP12, TMP12);
-                vis_st64(TMP12, dest[0]);
-
-                vis_psub16(TMP18, TMP16, TMP16);
-                vis_st64_2(TMP16, dest, 8);
-                dest += stride;
-
-                vis_or(REF_4, REF_6, TMP18);
-
-                vis_and(TMP0, MASK_fe, TMP0);
-
-                vis_and(TMP2, MASK_fe, TMP2);
-                vis_mul8x16(CONST_128, TMP0, TMP0);
-
-                vis_faligndata(TMP6, TMP8, REF_2);
-                vis_mul8x16(CONST_128, TMP2, TMP2);
-
-                vis_faligndata(TMP8, TMP10, REF_6);
-
-                vis_and(TMP0, MASK_7f, TMP0);
-
-                vis_and(TMP2, MASK_7f, TMP2);
-
-                vis_psub16(TMP20, TMP0, TMP0);
-                vis_st64(TMP0, dest[0]);
-
-                vis_psub16(TMP18, TMP2, TMP2);
-                vis_st64_2(TMP2, dest, 8);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(REF_0, REF_2, TMP12);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_xor(REF_4, REF_6, TMP16);
-
-        vis_ld64_2(ref, 16, TMP4);
-        vis_or(REF_0, REF_2, TMP14);
-
-        vis_or(REF_4, REF_6, TMP18);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        vis_and(TMP12, MASK_fe, TMP12);
-
-        vis_and(TMP16, MASK_fe, TMP16);
-        vis_mul8x16(CONST_128, TMP12, TMP12);
-
-        vis_mul8x16(CONST_128, TMP16, TMP16);
-        vis_xor(REF_0, REF_2, TMP0);
-
-        vis_xor(REF_4, REF_6, TMP2);
-
-        vis_or(REF_0, REF_2, TMP20);
-
-        vis_and(TMP12, MASK_7f, TMP12);
-
-        vis_and(TMP16, MASK_7f, TMP16);
-
-        vis_psub16(TMP14, TMP12, TMP12);
-        vis_st64(TMP12, dest[0]);
-
-        vis_psub16(TMP18, TMP16, TMP16);
-        vis_st64_2(TMP16, dest, 8);
-        dest += stride;
-
-        vis_or(REF_4, REF_6, TMP18);
-
-        vis_and(TMP0, MASK_fe, TMP0);
-
-        vis_and(TMP2, MASK_fe, TMP2);
-        vis_mul8x16(CONST_128, TMP0, TMP0);
-
-        vis_mul8x16(CONST_128, TMP2, TMP2);
-
-        vis_and(TMP0, MASK_7f, TMP0);
-
-        vis_and(TMP2, MASK_7f, TMP2);
-
-        vis_psub16(TMP20, TMP0, TMP0);
-        vis_st64(TMP0, dest[0]);
-
-        vis_psub16(TMP18, TMP2, TMP2);
-        vis_st64_2(TMP2, dest, 8);
-}
-
-static void MC_put_y_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64_2(ref, 8, TMP2);
-        ref += stride;
-
-        vis_ld64(ref[0], TMP4);
-
-        vis_ld64_2(ref, 8, TMP6);
-        ref += stride;
-
-        vis_ld64(constants_fe[0], MASK_fe);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP4, TMP6, REF_2);
-
-        vis_ld64(constants128[0], CONST_128);
-        height = (height >> 1) - 1;
-        do {    /* 12 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(REF_0, REF_2, TMP4);
-
-                vis_ld64_2(ref, 8, TMP2);
-                ref += stride;
-                vis_and(TMP4, MASK_fe, TMP4);
-
-                vis_or(REF_0, REF_2, TMP6);
-                vis_mul8x16(CONST_128, TMP4, TMP4);
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64_2(ref, 8, TMP2);
-                ref += stride;
-                vis_xor(REF_0, REF_2, TMP12);
-
-                vis_and(TMP4, MASK_7f, TMP4);
-
-                vis_and(TMP12, MASK_fe, TMP12);
-
-                vis_mul8x16(CONST_128, TMP12, TMP12);
-                vis_or(REF_0, REF_2, TMP14);
-
-                vis_psub16(TMP6, TMP4, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_faligndata(TMP0, TMP2, REF_2);
-
-                vis_and(TMP12, MASK_7f, TMP12);
-
-                vis_psub16(TMP14, TMP12, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(REF_0, REF_2, TMP4);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_and(TMP4, MASK_fe, TMP4);
-
-        vis_or(REF_0, REF_2, TMP6);
-        vis_mul8x16(CONST_128, TMP4, TMP4);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_xor(REF_0, REF_2, TMP12);
-
-        vis_and(TMP4, MASK_7f, TMP4);
-
-        vis_and(TMP12, MASK_fe, TMP12);
-
-        vis_mul8x16(CONST_128, TMP12, TMP12);
-        vis_or(REF_0, REF_2, TMP14);
-
-        vis_psub16(TMP6, TMP4, DST_0);
-        vis_st64(DST_0, dest[0]);
-        dest += stride;
-
-        vis_and(TMP12, MASK_7f, TMP12);
-
-        vis_psub16(TMP14, TMP12, DST_0);
-        vis_st64(DST_0, dest[0]);
-}
-
-static void MC_avg_y_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        int stride_8 = stride + 8;
-        int stride_16 = stride + 16;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_faligndata(TMP0, TMP2, REF_2);
-
-        vis_ld64(constants256_512[0], CONST_256);
-        vis_faligndata(TMP2, TMP4, REF_6);
-        height >>= 1;
-
-        do {    /* 31 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_pmerge(ZERO,       REF_2,     TMP12);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP14);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                vis_pmerge(ZERO,       REF_6,     TMP16);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP18);
-
-                vis_ld64_2(ref, stride_16, TMP4);
-                ref += stride;
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(dest, 8, DST_2);
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_ld64_2(ref, stride, TMP6);
-                vis_pmerge(ZERO,     REF_0,     TMP0);
-                vis_mul8x16au(REF_0_1, CONST_256, TMP2);
-
-                vis_ld64_2(ref, stride_8, TMP8);
-                vis_pmerge(ZERO,     REF_4,     TMP4);
-
-                vis_ld64_2(ref, stride_16, TMP10);
-                ref += stride;
-
-                vis_ld64_2(dest, stride, REF_S0/*DST_4*/);
-                vis_faligndata(TMP6, TMP8, REF_2);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP6);
-
-                vis_ld64_2(dest, stride_8, REF_S2/*DST_6*/);
-                vis_faligndata(TMP8, TMP10, REF_6);
-                vis_mul8x16al(DST_0,   CONST_512, TMP20);
-
-                vis_padd16(TMP0, CONST_3, TMP0);
-                vis_mul8x16al(DST_1,   CONST_512, TMP22);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-                vis_mul8x16al(DST_2,   CONST_512, TMP24);
-
-                vis_padd16(TMP4, CONST_3, TMP4);
-                vis_mul8x16al(DST_3,   CONST_512, TMP26);
-
-                vis_padd16(TMP6, CONST_3, TMP6);
-
-                vis_padd16(TMP12, TMP20, TMP12);
-                vis_mul8x16al(REF_S0,   CONST_512, TMP20);
-
-                vis_padd16(TMP14, TMP22, TMP14);
-                vis_mul8x16al(REF_S0_1, CONST_512, TMP22);
-
-                vis_padd16(TMP16, TMP24, TMP16);
-                vis_mul8x16al(REF_S2,   CONST_512, TMP24);
-
-                vis_padd16(TMP18, TMP26, TMP18);
-                vis_mul8x16al(REF_S2_1, CONST_512, TMP26);
-
-                vis_padd16(TMP12, TMP0, TMP12);
-                vis_mul8x16au(REF_2,   CONST_256, TMP28);
-
-                vis_padd16(TMP14, TMP2, TMP14);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP30);
-
-                vis_padd16(TMP16, TMP4, TMP16);
-                vis_mul8x16au(REF_6,   CONST_256, REF_S4);
-
-                vis_padd16(TMP18, TMP6, TMP18);
-                vis_mul8x16au(REF_6_1, CONST_256, REF_S6);
-
-                vis_pack16(TMP12, DST_0);
-                vis_padd16(TMP28, TMP0, TMP12);
-
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_padd16(TMP30, TMP2, TMP14);
-
-                vis_pack16(TMP16, DST_2);
-                vis_padd16(REF_S4, TMP4, TMP16);
-
-                vis_pack16(TMP18, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-                vis_padd16(REF_S6, TMP6, TMP18);
-
-                vis_padd16(TMP12, TMP20, TMP12);
-
-                vis_padd16(TMP14, TMP22, TMP14);
-                vis_pack16(TMP12, DST_0);
-
-                vis_padd16(TMP16, TMP24, TMP16);
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-
-                vis_padd16(TMP18, TMP26, TMP18);
-                vis_pack16(TMP16, DST_2);
-
-                vis_pack16(TMP18, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_y_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        int stride_8 = stride + 8;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_faligndata(TMP0, TMP2, REF_2);
-
-        vis_ld64(constants256_512[0], CONST_256);
-
-        height >>= 1;
-        do {    /* 20 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_pmerge(ZERO,       REF_2,     TMP8);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP10);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                ref += stride;
-
-                vis_ld64(dest[0], DST_0);
-
-                vis_ld64_2(dest, stride, DST_2);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, stride, TMP4);
-                vis_mul8x16al(DST_0,   CONST_512, TMP16);
-                vis_pmerge(ZERO,       REF_0,     TMP12);
-
-                vis_ld64_2(ref, stride_8, TMP6);
-                ref += stride;
-                vis_mul8x16al(DST_1,   CONST_512, TMP18);
-                vis_pmerge(ZERO,       REF_0_1,   TMP14);
-
-                vis_padd16(TMP12, CONST_3, TMP12);
-                vis_mul8x16al(DST_2,   CONST_512, TMP24);
-
-                vis_padd16(TMP14, CONST_3, TMP14);
-                vis_mul8x16al(DST_3,   CONST_512, TMP26);
-
-                vis_faligndata(TMP4, TMP6, REF_2);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_mul8x16au(REF_2,   CONST_256, TMP20);
-
-                vis_padd16(TMP8, TMP16, TMP0);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP22);
-
-                vis_padd16(TMP10, TMP18, TMP2);
-                vis_pack16(TMP0, DST_0);
-
-                vis_pack16(TMP2, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-                vis_padd16(TMP12, TMP20, TMP12);
-
-                vis_padd16(TMP14, TMP22, TMP14);
-
-                vis_padd16(TMP12, TMP24, TMP0);
-
-                vis_padd16(TMP14, TMP26, TMP2);
-                vis_pack16(TMP0, DST_2);
-
-                vis_pack16(TMP2, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_xy_16_vis (uint8_t * dest, const uint8_t * ref,
-                              const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-        int stride_16 = stride + 16;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(constants2[0], CONST_2);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        vis_ld64(constants256_512[0], CONST_256);
-        vis_faligndata(TMP2, TMP4, REF_S4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-                vis_faligndata(TMP2, TMP4, REF_S6);
-        } else {
-                vis_src1(TMP2, REF_S2);
-                vis_src1(TMP4, REF_S6);
-        }
-
-        height >>= 1;
-        do {
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0, CONST_256, TMP12);
-                vis_pmerge(ZERO,      REF_S0_1,  TMP14);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                vis_mul8x16au(REF_S2, CONST_256, TMP16);
-                vis_pmerge(ZERO,      REF_S2_1,  TMP18);
-
-                vis_ld64_2(ref, stride_16, TMP4);
-                ref += stride;
-                vis_mul8x16au(REF_S4, CONST_256, TMP20);
-                vis_pmerge(ZERO,      REF_S4_1,  TMP22);
-
-                vis_ld64_2(ref, stride, TMP6);
-                vis_mul8x16au(REF_S6, CONST_256, TMP24);
-                vis_pmerge(ZERO,      REF_S6_1,  TMP26);
-
-                vis_ld64_2(ref, stride_8, TMP8);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, stride_16, TMP10);
-                ref += stride;
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_faligndata(TMP6, TMP8, REF_S0);
-
-                vis_faligndata(TMP8, TMP10, REF_S4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                        vis_faligndata(TMP6, TMP8, REF_S2);
-                        vis_faligndata(TMP8, TMP10, REF_S6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                        vis_src1(TMP8, REF_S2);
-                        vis_src1(TMP10, REF_S6);
-                }
-
-                vis_mul8x16au(REF_0, CONST_256, TMP0);
-                vis_pmerge(ZERO,      REF_0_1,  TMP2);
-
-                vis_mul8x16au(REF_2, CONST_256, TMP4);
-                vis_pmerge(ZERO,      REF_2_1,  TMP6);
-
-                vis_padd16(TMP0, CONST_2, TMP8);
-                vis_mul8x16au(REF_4, CONST_256, TMP0);
-
-                vis_padd16(TMP2, CONST_2, TMP10);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP2);
-
-                vis_padd16(TMP8, TMP4, TMP8);
-                vis_mul8x16au(REF_6, CONST_256, TMP4);
-
-                vis_padd16(TMP10, TMP6, TMP10);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP6);
-
-                vis_padd16(TMP12, TMP8, TMP12);
-
-                vis_padd16(TMP14, TMP10, TMP14);
-
-                vis_padd16(TMP12, TMP16, TMP12);
-
-                vis_padd16(TMP14, TMP18, TMP14);
-                vis_pack16(TMP12, DST_0);
-
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_padd16(TMP0, CONST_2, TMP12);
-
-                vis_mul8x16au(REF_S0, CONST_256, TMP0);
-                vis_padd16(TMP2, CONST_2, TMP14);
-
-                vis_mul8x16au(REF_S0_1, CONST_256, TMP2);
-                vis_padd16(TMP12, TMP4, TMP12);
-
-                vis_mul8x16au(REF_S2, CONST_256, TMP4);
-                vis_padd16(TMP14, TMP6, TMP14);
-
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP6);
-                vis_padd16(TMP20, TMP12, TMP20);
-
-                vis_padd16(TMP22, TMP14, TMP22);
-
-                vis_padd16(TMP20, TMP24, TMP20);
-
-                vis_padd16(TMP22, TMP26, TMP22);
-                vis_pack16(TMP20, DST_2);
-
-                vis_pack16(TMP22, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-                vis_padd16(TMP0, TMP4, TMP24);
-
-                vis_mul8x16au(REF_S4, CONST_256, TMP0);
-                vis_padd16(TMP2, TMP6, TMP26);
-
-                vis_mul8x16au(REF_S4_1, CONST_256, TMP2);
-                vis_padd16(TMP24, TMP8, TMP24);
-
-                vis_padd16(TMP26, TMP10, TMP26);
-                vis_pack16(TMP24, DST_0);
-
-                vis_pack16(TMP26, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_pmerge(ZERO, REF_S6, TMP4);
-
-                vis_pmerge(ZERO,      REF_S6_1,  TMP6);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-
-                vis_padd16(TMP0, TMP12, TMP0);
-
-                vis_padd16(TMP2, TMP14, TMP2);
-                vis_pack16(TMP0, DST_2);
-
-                vis_pack16(TMP2, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_xy_8_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(constants2[0], CONST_2);
-
-        vis_ld64(constants256_512[0], CONST_256);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-        } else {
-                vis_src1(TMP2, REF_S2);
-        }
-
-        height >>= 1;
-        do {    /* 26 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0,   CONST_256, TMP8);
-                vis_pmerge(ZERO,        REF_S2,    TMP12);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                ref += stride;
-                vis_mul8x16au(REF_S0_1, CONST_256, TMP10);
-                vis_pmerge(ZERO,        REF_S2_1,  TMP14);
-
-                vis_ld64_2(ref, stride, TMP4);
-
-                vis_ld64_2(ref, stride_8, TMP6);
-                ref += stride;
-                vis_faligndata(TMP0, TMP2, REF_S4);
-
-                vis_pmerge(ZERO, REF_S4, TMP18);
-
-                vis_pmerge(ZERO, REF_S4_1, TMP20);
-
-                vis_faligndata(TMP4, TMP6, REF_S0);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_S6);
-                        vis_faligndata(TMP4, TMP6, REF_S2);
-                } else {
-                        vis_src1(TMP2, REF_S6);
-                        vis_src1(TMP6, REF_S2);
-                }
-
-                vis_padd16(TMP18, CONST_2, TMP18);
-                vis_mul8x16au(REF_S6,   CONST_256, TMP22);
-
-                vis_padd16(TMP20, CONST_2, TMP20);
-                vis_mul8x16au(REF_S6_1, CONST_256, TMP24);
-
-                vis_mul8x16au(REF_S0,   CONST_256, TMP26);
-                vis_pmerge(ZERO, REF_S0_1, TMP28);
-
-                vis_mul8x16au(REF_S2,   CONST_256, TMP30);
-                vis_padd16(TMP18, TMP22, TMP18);
-
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP32);
-                vis_padd16(TMP20, TMP24, TMP20);
-
-                vis_padd16(TMP8,  TMP18, TMP8);
-
-                vis_padd16(TMP10, TMP20, TMP10);
-
-                vis_padd16(TMP8,  TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_pack16(TMP8,  DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-                vis_padd16(TMP18, TMP26, TMP18);
-
-                vis_padd16(TMP20, TMP28, TMP20);
-
-                vis_padd16(TMP18, TMP30, TMP18);
-
-                vis_padd16(TMP20, TMP32, TMP20);
-                vis_pack16(TMP18, DST_2);
-
-                vis_pack16(TMP20, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_xy_16_vis (uint8_t * dest, const uint8_t * ref,
-                              const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-        int stride_16 = stride + 16;
-
-        vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(constants6[0], CONST_6);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        vis_ld64(constants256_1024[0], CONST_256);
-        vis_faligndata(TMP2, TMP4, REF_S4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-                vis_faligndata(TMP2, TMP4, REF_S6);
-        } else {
-                vis_src1(TMP2, REF_S2);
-                vis_src1(TMP4, REF_S6);
-        }
-
-        height >>= 1;
-        do {    /* 55 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0, CONST_256, TMP12);
-                vis_pmerge(ZERO,      REF_S0_1,  TMP14);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                vis_mul8x16au(REF_S2, CONST_256, TMP16);
-                vis_pmerge(ZERO,      REF_S2_1,  TMP18);
-
-                vis_ld64_2(ref, stride_16, TMP4);
-                ref += stride;
-                vis_mul8x16au(REF_S4, CONST_256, TMP20);
-                vis_pmerge(ZERO,      REF_S4_1,  TMP22);
-
-                vis_ld64_2(ref, stride, TMP6);
-                vis_mul8x16au(REF_S6, CONST_256, TMP24);
-                vis_pmerge(ZERO,      REF_S6_1,  TMP26);
-
-                vis_ld64_2(ref, stride_8, TMP8);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, stride_16, TMP10);
-                ref += stride;
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP6, TMP8, REF_S0);
-
-                vis_ld64_2(dest, 8, DST_2);
-                vis_faligndata(TMP8, TMP10, REF_S4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                        vis_faligndata(TMP6, TMP8, REF_S2);
-                        vis_faligndata(TMP8, TMP10, REF_S6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                        vis_src1(TMP8, REF_S2);
-                        vis_src1(TMP10, REF_S6);
-                }
-
-                vis_mul8x16al(DST_0,   CONST_1024, TMP30);
-                vis_pmerge(ZERO, REF_0, TMP0);
-
-                vis_mul8x16al(DST_1,   CONST_1024, TMP32);
-                vis_pmerge(ZERO,      REF_0_1,  TMP2);
-
-                vis_mul8x16au(REF_2, CONST_256, TMP4);
-                vis_pmerge(ZERO,      REF_2_1,  TMP6);
-
-                vis_mul8x16al(DST_2,   CONST_1024, REF_0);
-                vis_padd16(TMP0, CONST_6, TMP0);
-
-                vis_mul8x16al(DST_3,   CONST_1024, REF_2);
-                vis_padd16(TMP2, CONST_6, TMP2);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-                vis_mul8x16au(REF_4, CONST_256, TMP4);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP6);
-
-                vis_padd16(TMP12, TMP0, TMP12);
-                vis_mul8x16au(REF_6, CONST_256, TMP8);
-
-                vis_padd16(TMP14, TMP2, TMP14);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP10);
-
-                vis_padd16(TMP12, TMP16, TMP12);
-                vis_mul8x16au(REF_S0, CONST_256, REF_4);
-
-                vis_padd16(TMP14, TMP18, TMP14);
-                vis_mul8x16au(REF_S0_1, CONST_256, REF_6);
-
-                vis_padd16(TMP12, TMP30, TMP12);
-
-                vis_padd16(TMP14, TMP32, TMP14);
-                vis_pack16(TMP12, DST_0);
-
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_padd16(TMP4, CONST_6, TMP4);
-
-                vis_ld64_2(dest, stride, DST_0);
-                vis_padd16(TMP6, CONST_6, TMP6);
-                vis_mul8x16au(REF_S2, CONST_256, TMP12);
-
-                vis_padd16(TMP4, TMP8, TMP4);
-                vis_mul8x16au(REF_S2_1, CONST_256,  TMP14);
-
-                vis_padd16(TMP6, TMP10, TMP6);
-
-                vis_padd16(TMP20, TMP4, TMP20);
-
-                vis_padd16(TMP22, TMP6, TMP22);
-
-                vis_padd16(TMP20, TMP24, TMP20);
-
-                vis_padd16(TMP22, TMP26, TMP22);
-
-                vis_padd16(TMP20, REF_0, TMP20);
-                vis_mul8x16au(REF_S4, CONST_256, REF_0);
-
-                vis_padd16(TMP22, REF_2, TMP22);
-                vis_pack16(TMP20, DST_2);
-
-                vis_pack16(TMP22, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-
-                vis_ld64_2(dest, 8, DST_2);
-                vis_mul8x16al(DST_0,   CONST_1024, TMP30);
-                vis_pmerge(ZERO,      REF_S4_1,  REF_2);
-
-                vis_mul8x16al(DST_1,   CONST_1024, TMP32);
-                vis_padd16(REF_4, TMP0, TMP8);
-
-                vis_mul8x16au(REF_S6, CONST_256, REF_4);
-                vis_padd16(REF_6, TMP2, TMP10);
-
-                vis_mul8x16au(REF_S6_1, CONST_256, REF_6);
-                vis_padd16(TMP8, TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-
-                vis_padd16(TMP8, TMP30, TMP8);
-
-                vis_padd16(TMP10, TMP32, TMP10);
-                vis_pack16(TMP8, DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_st64(DST_0, dest[0]);
-
-                vis_padd16(REF_0, TMP4, REF_0);
-
-                vis_mul8x16al(DST_2,   CONST_1024, TMP30);
-                vis_padd16(REF_2, TMP6, REF_2);
-
-                vis_mul8x16al(DST_3,   CONST_1024, TMP32);
-                vis_padd16(REF_0, REF_4, REF_0);
-
-                vis_padd16(REF_2, REF_6, REF_2);
-
-                vis_padd16(REF_0, TMP30, REF_0);
-
-                /* stall */
-
-                vis_padd16(REF_2, TMP32, REF_2);
-                vis_pack16(REF_0, DST_2);
-
-                vis_pack16(REF_2, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_xy_8_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-
-        vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64_2(ref, 8, TMP2);
-
-        vis_ld64(constants6[0], CONST_6);
-
-        vis_ld64(constants256_1024[0], CONST_256);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-        } else {
-                vis_src1(TMP2, REF_S2);
-        }
-
-        height >>= 1;
-        do {    /* 31 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0, CONST_256, TMP8);
-                vis_pmerge(ZERO,      REF_S0_1,  TMP10);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                ref += stride;
-                vis_mul8x16au(REF_S2, CONST_256, TMP12);
-                vis_pmerge(ZERO,      REF_S2_1,  TMP14);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride, TMP4);
-                vis_faligndata(TMP0, TMP2, REF_S4);
-
-                vis_ld64_2(ref, stride_8, TMP6);
-                ref += stride;
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP4, TMP6, REF_S0);
-
-                vis_ld64_2(dest, stride, DST_2);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_S6);
-                        vis_faligndata(TMP4, TMP6, REF_S2);
-                } else {
-                        vis_src1(TMP2, REF_S6);
-                        vis_src1(TMP6, REF_S2);
-                }
-
-                vis_mul8x16al(DST_0,   CONST_1024, TMP30);
-                vis_pmerge(ZERO, REF_S4, TMP22);
-
-                vis_mul8x16al(DST_1,   CONST_1024, TMP32);
-                vis_pmerge(ZERO,      REF_S4_1,  TMP24);
-
-                vis_mul8x16au(REF_S6, CONST_256, TMP26);
-                vis_pmerge(ZERO,      REF_S6_1,  TMP28);
-
-                vis_mul8x16au(REF_S0, CONST_256, REF_S4);
-                vis_padd16(TMP22, CONST_6, TMP22);
-
-                vis_mul8x16au(REF_S0_1, CONST_256, REF_S6);
-                vis_padd16(TMP24, CONST_6, TMP24);
-
-                vis_mul8x16al(DST_2,   CONST_1024, REF_0);
-                vis_padd16(TMP22, TMP26, TMP22);
-
-                vis_mul8x16al(DST_3,   CONST_1024, REF_2);
-                vis_padd16(TMP24, TMP28, TMP24);
-
-                vis_mul8x16au(REF_S2, CONST_256, TMP26);
-                vis_padd16(TMP8, TMP22, TMP8);
-
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP28);
-                vis_padd16(TMP10, TMP24, TMP10);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-
-                vis_padd16(TMP8, TMP30, TMP8);
-
-                vis_padd16(TMP10, TMP32, TMP10);
-                vis_pack16(TMP8, DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_padd16(REF_S4, TMP22, TMP12);
-
-                vis_padd16(REF_S6, TMP24, TMP14);
-
-                vis_padd16(TMP12, TMP26, TMP12);
-
-                vis_padd16(TMP14, TMP28, TMP14);
-
-                vis_padd16(TMP12, REF_0, TMP12);
-
-                vis_padd16(TMP14, REF_2, TMP14);
-                vis_pack16(TMP12, DST_2);
-
-                vis_pack16(TMP14, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-/* End of rounding code */
-
-/* Start of no rounding code */
-/* The trick used in some of this file is the formula from the MMX
- * motion comp code, which is:
- *
- * (x+y)>>1 == (x&y)+((x^y)>>1)
- *
- * This allows us to average 8 bytes at a time in a 64-bit FPU reg.
- * We avoid overflows by masking before we do the shift, and we
- * implement the shift by multiplying by 1/2 using mul8x16.  So in
- * VIS this is (assume 'x' is in f0, 'y' is in f2, a repeating mask
- * of '0xfe' is in f4, a repeating mask of '0x7f' is in f6, and
- * the value 0x80808080 is in f8):
- *
- *      fxor            f0,   f2, f10
- *      fand            f10,  f4, f10
- *      fmul8x16        f8,  f10, f10
- *      fand            f10,  f6, f10
- *      fand            f0,   f2, f12
- *      fpadd16         f12, f10, f10
- */
-
-static void MC_put_no_round_o_16_vis (uint8_t * dest, const uint8_t * ref,
-                                      const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        do {    /* 5 cycles */
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64_2(ref, 8, TMP2);
-
-                vis_ld64_2(ref, 16, TMP4);
-                ref += stride;
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-                vis_st64(REF_0, dest[0]);
-
-                vis_faligndata(TMP2, TMP4, REF_2);
-                vis_st64_2(REF_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_no_round_o_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        do {    /* 4 cycles */
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64(ref[8], TMP2);
-                ref += stride;
-
-                /* stall */
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-                vis_st64(REF_0, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-
-static void MC_avg_no_round_o_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        int stride_8 = stride + 8;
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64(ref[8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(dest[0], DST_0);
-
-        vis_ld64(dest[8], DST_2);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP2, TMP4, REF_2);
-
-        vis_ld64(constants128[0], CONST_128);
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 24 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(DST_0, REF_0, TMP6);
-
-                vis_ld64_2(ref, 8, TMP2);
-                vis_and(TMP6, MASK_fe, TMP6);
-
-                vis_ld64_2(ref, 16, TMP4);
-                ref += stride;
-                vis_mul8x16(CONST_128, TMP6, TMP6);
-                vis_xor(DST_2, REF_2, TMP8);
-
-                vis_and(TMP8, MASK_fe, TMP8);
-
-                vis_and(DST_0, REF_0, TMP10);
-                vis_ld64_2(dest, stride, DST_0);
-                vis_mul8x16(CONST_128, TMP8, TMP8);
-
-                vis_and(DST_2, REF_2, TMP12);
-                vis_ld64_2(dest, stride_8, DST_2);
-
-                vis_ld64(ref[0], TMP14);
-                vis_and(TMP6, MASK_7f, TMP6);
-
-                vis_and(TMP8, MASK_7f, TMP8);
-
-                vis_padd16(TMP10, TMP6, TMP6);
-                vis_st64(TMP6, dest[0]);
-
-                vis_padd16(TMP12, TMP8, TMP8);
-                vis_st64_2(TMP8, dest, 8);
-
-                dest += stride;
-                vis_ld64_2(ref, 8, TMP16);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, 16, TMP18);
-                vis_faligndata(TMP2, TMP4, REF_2);
-                ref += stride;
-
-                vis_xor(DST_0, REF_0, TMP20);
-
-                vis_and(TMP20, MASK_fe, TMP20);
-
-                vis_xor(DST_2, REF_2, TMP22);
-                vis_mul8x16(CONST_128, TMP20, TMP20);
-
-                vis_and(TMP22, MASK_fe, TMP22);
-
-                vis_and(DST_0, REF_0, TMP24);
-                vis_mul8x16(CONST_128, TMP22, TMP22);
-
-                vis_and(DST_2, REF_2, TMP26);
-
-                vis_ld64_2(dest, stride, DST_0);
-                vis_faligndata(TMP14, TMP16, REF_0);
-
-                vis_ld64_2(dest, stride_8, DST_2);
-                vis_faligndata(TMP16, TMP18, REF_2);
-
-                vis_and(TMP20, MASK_7f, TMP20);
-
-                vis_and(TMP22, MASK_7f, TMP22);
-
-                vis_padd16(TMP24, TMP20, TMP20);
-                vis_st64(TMP20, dest[0]);
-
-                vis_padd16(TMP26, TMP22, TMP22);
-                vis_st64_2(TMP22, dest, 8);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(DST_0, REF_0, TMP6);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_and(TMP6, MASK_fe, TMP6);
-
-        vis_ld64_2(ref, 16, TMP4);
-        vis_mul8x16(CONST_128, TMP6, TMP6);
-        vis_xor(DST_2, REF_2, TMP8);
-
-        vis_and(TMP8, MASK_fe, TMP8);
-
-        vis_and(DST_0, REF_0, TMP10);
-        vis_ld64_2(dest, stride, DST_0);
-        vis_mul8x16(CONST_128, TMP8, TMP8);
-
-        vis_and(DST_2, REF_2, TMP12);
-        vis_ld64_2(dest, stride_8, DST_2);
-
-        vis_ld64(ref[0], TMP14);
-        vis_and(TMP6, MASK_7f, TMP6);
-
-        vis_and(TMP8, MASK_7f, TMP8);
-
-        vis_padd16(TMP10, TMP6, TMP6);
-        vis_st64(TMP6, dest[0]);
-
-        vis_padd16(TMP12, TMP8, TMP8);
-        vis_st64_2(TMP8, dest, 8);
-
-        dest += stride;
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_faligndata(TMP2, TMP4, REF_2);
-
-        vis_xor(DST_0, REF_0, TMP20);
-
-        vis_and(TMP20, MASK_fe, TMP20);
-
-        vis_xor(DST_2, REF_2, TMP22);
-        vis_mul8x16(CONST_128, TMP20, TMP20);
-
-        vis_and(TMP22, MASK_fe, TMP22);
-
-        vis_and(DST_0, REF_0, TMP24);
-        vis_mul8x16(CONST_128, TMP22, TMP22);
-
-        vis_and(DST_2, REF_2, TMP26);
-
-        vis_and(TMP20, MASK_7f, TMP20);
-
-        vis_and(TMP22, MASK_7f, TMP22);
-
-        vis_padd16(TMP24, TMP20, TMP20);
-        vis_st64(TMP20, dest[0]);
-
-        vis_padd16(TMP26, TMP22, TMP22);
-        vis_st64_2(TMP22, dest, 8);
-}
-
-static void MC_avg_no_round_o_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64(ref[8], TMP2);
-
-        vis_ld64(dest[0], DST_0);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants128[0], CONST_128);
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 12 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(DST_0, REF_0, TMP4);
-
-                vis_ld64(ref[8], TMP2);
-                vis_and(TMP4, MASK_fe, TMP4);
-
-                vis_and(DST_0, REF_0, TMP6);
-                vis_ld64_2(dest, stride, DST_0);
-                ref += stride;
-                vis_mul8x16(CONST_128, TMP4, TMP4);
-
-                vis_ld64(ref[0], TMP12);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64(ref[8], TMP2);
-                vis_xor(DST_0, REF_0, TMP0);
-                ref += stride;
-
-                vis_and(TMP0, MASK_fe, TMP0);
-
-                vis_and(TMP4, MASK_7f, TMP4);
-
-                vis_padd16(TMP6, TMP4, TMP4);
-                vis_st64(TMP4, dest[0]);
-                dest += stride;
-                vis_mul8x16(CONST_128, TMP0, TMP0);
-
-                vis_and(DST_0, REF_0, TMP6);
-                vis_ld64_2(dest, stride, DST_0);
-
-                vis_faligndata(TMP12, TMP2, REF_0);
-
-                vis_and(TMP0, MASK_7f, TMP0);
-
-                vis_padd16(TMP6, TMP0, TMP4);
-                vis_st64(TMP4, dest[0]);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(DST_0, REF_0, TMP4);
-
-        vis_ld64(ref[8], TMP2);
-        vis_and(TMP4, MASK_fe, TMP4);
-
-        vis_and(DST_0, REF_0, TMP6);
-        vis_ld64_2(dest, stride, DST_0);
-        vis_mul8x16(CONST_128, TMP4, TMP4);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_xor(DST_0, REF_0, TMP0);
-
-        vis_and(TMP0, MASK_fe, TMP0);
-
-        vis_and(TMP4, MASK_7f, TMP4);
-
-        vis_padd16(TMP6, TMP4, TMP4);
-        vis_st64(TMP4, dest[0]);
-        dest += stride;
-        vis_mul8x16(CONST_128, TMP0, TMP0);
-
-        vis_and(DST_0, REF_0, TMP6);
-
-        vis_and(TMP0, MASK_7f, TMP0);
-
-        vis_padd16(TMP6, TMP0, TMP4);
-        vis_st64(TMP4, dest[0]);
-}
-
-static void MC_put_no_round_x_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0],    TMP0);
-
-        vis_ld64_2(ref, 8,  TMP2);
-
-        vis_ld64_2(ref, 16, TMP4);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants128[0], CONST_128);
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-                vis_faligndata(TMP2, TMP4, REF_6);
-        } else {
-                vis_src1(TMP2, REF_2);
-                vis_src1(TMP4, REF_6);
-        }
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 34 cycles */
-                vis_ld64(ref[0],    TMP0);
-                vis_xor(REF_0, REF_2, TMP6);
-
-                vis_ld64_2(ref, 8,  TMP2);
-                vis_xor(REF_4, REF_6, TMP8);
-
-                vis_ld64_2(ref, 16, TMP4);
-                vis_and(TMP6, MASK_fe, TMP6);
-                ref += stride;
-
-                vis_ld64(ref[0],    TMP14);
-                vis_mul8x16(CONST_128, TMP6, TMP6);
-                vis_and(TMP8, MASK_fe, TMP8);
-
-                vis_ld64_2(ref, 8,  TMP16);
-                vis_mul8x16(CONST_128, TMP8, TMP8);
-                vis_and(REF_0, REF_2, TMP10);
-
-                vis_ld64_2(ref, 16, TMP18);
-                ref += stride;
-                vis_and(REF_4, REF_6, TMP12);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                }
-
-                vis_and(TMP6, MASK_7f, TMP6);
-
-                vis_and(TMP8, MASK_7f, TMP8);
-
-                vis_padd16(TMP10, TMP6, TMP6);
-                vis_st64(TMP6, dest[0]);
-
-                vis_padd16(TMP12, TMP8, TMP8);
-                vis_st64_2(TMP8, dest, 8);
-                dest += stride;
-
-                vis_xor(REF_0, REF_2, TMP6);
-
-                vis_xor(REF_4, REF_6, TMP8);
-
-                vis_and(TMP6, MASK_fe, TMP6);
-
-                vis_mul8x16(CONST_128, TMP6, TMP6);
-                vis_and(TMP8, MASK_fe, TMP8);
-
-                vis_mul8x16(CONST_128, TMP8, TMP8);
-                vis_and(REF_0, REF_2, TMP10);
-
-                vis_and(REF_4, REF_6, TMP12);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_faligndata(TMP14, TMP16, REF_0);
-
-                vis_faligndata(TMP16, TMP18, REF_4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP14, TMP16, REF_2);
-                        vis_faligndata(TMP16, TMP18, REF_6);
-                } else {
-                        vis_src1(TMP16, REF_2);
-                        vis_src1(TMP18, REF_6);
-                }
-
-                vis_and(TMP6, MASK_7f, TMP6);
-
-                vis_and(TMP8, MASK_7f, TMP8);
-
-                vis_padd16(TMP10, TMP6, TMP6);
-                vis_st64(TMP6, dest[0]);
-
-                vis_padd16(TMP12, TMP8, TMP8);
-                vis_st64_2(TMP8, dest, 8);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0],    TMP0);
-        vis_xor(REF_0, REF_2, TMP6);
-
-        vis_ld64_2(ref, 8,  TMP2);
-        vis_xor(REF_4, REF_6, TMP8);
-
-        vis_ld64_2(ref, 16, TMP4);
-        vis_and(TMP6, MASK_fe, TMP6);
-
-        vis_mul8x16(CONST_128, TMP6, TMP6);
-        vis_and(TMP8, MASK_fe, TMP8);
-
-        vis_mul8x16(CONST_128, TMP8, TMP8);
-        vis_and(REF_0, REF_2, TMP10);
-
-        vis_and(REF_4, REF_6, TMP12);
-
-        vis_alignaddr_g0((void *)off);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-                vis_faligndata(TMP2, TMP4, REF_6);
-        } else {
-                vis_src1(TMP2, REF_2);
-                vis_src1(TMP4, REF_6);
-        }
-
-        vis_and(TMP6, MASK_7f, TMP6);
-
-        vis_and(TMP8, MASK_7f, TMP8);
-
-        vis_padd16(TMP10, TMP6, TMP6);
-        vis_st64(TMP6, dest[0]);
-
-        vis_padd16(TMP12, TMP8, TMP8);
-        vis_st64_2(TMP8, dest, 8);
-        dest += stride;
-
-        vis_xor(REF_0, REF_2, TMP6);
-
-        vis_xor(REF_4, REF_6, TMP8);
-
-        vis_and(TMP6, MASK_fe, TMP6);
-
-        vis_mul8x16(CONST_128, TMP6, TMP6);
-        vis_and(TMP8, MASK_fe, TMP8);
-
-        vis_mul8x16(CONST_128, TMP8, TMP8);
-        vis_and(REF_0, REF_2, TMP10);
-
-        vis_and(REF_4, REF_6, TMP12);
-
-        vis_and(TMP6, MASK_7f, TMP6);
-
-        vis_and(TMP8, MASK_7f, TMP8);
-
-        vis_padd16(TMP10, TMP6, TMP6);
-        vis_st64(TMP6, dest[0]);
-
-        vis_padd16(TMP12, TMP8, TMP8);
-        vis_st64_2(TMP8, dest, 8);
-}
-
-static void MC_put_no_round_x_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64(ref[8], TMP2);
-
-        vis_ld64(constants_fe[0], MASK_fe);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-
-        vis_ld64(constants128[0], CONST_128);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-        } else {
-                vis_src1(TMP2, REF_2);
-        }
-
-        ref += stride;
-        height = (height >> 1) - 1;
-
-        do {    /* 20 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(REF_0, REF_2, TMP4);
-
-                vis_ld64_2(ref, 8, TMP2);
-                vis_and(TMP4, MASK_fe, TMP4);
-                ref += stride;
-
-                vis_ld64(ref[0], TMP8);
-                vis_and(REF_0, REF_2, TMP6);
-                vis_mul8x16(CONST_128, TMP4, TMP4);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, 8, TMP10);
-                ref += stride;
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                }
-
-                vis_and(TMP4, MASK_7f, TMP4);
-
-                vis_padd16(TMP6, TMP4, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_xor(REF_0, REF_2, TMP12);
-
-                vis_and(TMP12, MASK_fe, TMP12);
-
-                vis_and(REF_0, REF_2, TMP14);
-                vis_mul8x16(CONST_128, TMP12, TMP12);
-
-                vis_alignaddr_g0((void *)off);
-                vis_faligndata(TMP8, TMP10, REF_0);
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP8, TMP10, REF_2);
-                } else {
-                        vis_src1(TMP10, REF_2);
-                }
-
-                vis_and(TMP12, MASK_7f, TMP12);
-
-                vis_padd16(TMP14, TMP12, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(REF_0, REF_2, TMP4);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_and(TMP4, MASK_fe, TMP4);
-
-        vis_and(REF_0, REF_2, TMP6);
-        vis_mul8x16(CONST_128, TMP4, TMP4);
-
-        vis_alignaddr_g0((void *)off);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_2);
-        } else {
-                vis_src1(TMP2, REF_2);
-        }
-
-        vis_and(TMP4, MASK_7f, TMP4);
-
-        vis_padd16(TMP6, TMP4, DST_0);
-        vis_st64(DST_0, dest[0]);
-        dest += stride;
-
-        vis_xor(REF_0, REF_2, TMP12);
-
-        vis_and(TMP12, MASK_fe, TMP12);
-
-        vis_and(REF_0, REF_2, TMP14);
-        vis_mul8x16(CONST_128, TMP12, TMP12);
-
-        vis_and(TMP12, MASK_7f, TMP12);
-
-        vis_padd16(TMP14, TMP12, DST_0);
-        vis_st64(DST_0, dest[0]);
-        dest += stride;
-}
-
-static void MC_avg_no_round_x_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_fzero(ZERO);
-        vis_ld64(constants256_512[0], CONST_256);
-
-        ref = vis_alignaddr(ref);
-        do {    /* 26 cycles */
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64(ref[8], TMP2);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64(ref[16], TMP4);
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64(dest[8], DST_2);
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                }
-
-                vis_mul8x16au(REF_0,   CONST_256, TMP0);
-
-                vis_pmerge(ZERO,     REF_2,     TMP4);
-                vis_mul8x16au(REF_0_1, CONST_256, TMP2);
-
-                vis_pmerge(ZERO, REF_2_1, TMP6);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-
-                vis_mul8x16al(DST_0,   CONST_512, TMP4);
-                vis_padd16(TMP2, TMP6, TMP2);
-
-                vis_mul8x16al(DST_1,   CONST_512, TMP6);
-
-                vis_mul8x16au(REF_6,   CONST_256, TMP12);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP14);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_4,   CONST_256, TMP16);
-
-                vis_padd16(TMP0, CONST_3, TMP8);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP18);
-
-                vis_padd16(TMP2, CONST_3, TMP10);
-                vis_pack16(TMP8, DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_padd16(TMP16, TMP12, TMP0);
-
-                vis_st64(DST_0, dest[0]);
-                vis_mul8x16al(DST_2,   CONST_512, TMP4);
-                vis_padd16(TMP18, TMP14, TMP2);
-
-                vis_mul8x16al(DST_3,   CONST_512, TMP6);
-                vis_padd16(TMP0, CONST_3, TMP0);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_pack16(TMP0, DST_2);
-
-                vis_pack16(TMP2, DST_3);
-                vis_st64(DST_2, dest[8]);
-
-                ref += stride;
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_no_round_x_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_times_2 = stride << 1;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_fzero(ZERO);
-        vis_ld64(constants256_512[0], CONST_256);
-
-        ref = vis_alignaddr(ref);
-        height >>= 2;
-        do {    /* 47 cycles */
-                vis_ld64(ref[0],   TMP0);
-
-                vis_ld64_2(ref, 8, TMP2);
-                ref += stride;
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64(ref[0],   TMP4);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, 8, TMP6);
-                ref += stride;
-
-                vis_ld64(ref[0],   TMP8);
-
-                vis_ld64_2(ref, 8, TMP10);
-                ref += stride;
-                vis_faligndata(TMP4, TMP6, REF_4);
-
-                vis_ld64(ref[0],   TMP12);
-
-                vis_ld64_2(ref, 8, TMP14);
-                ref += stride;
-                vis_faligndata(TMP8, TMP10, REF_S0);
-
-                vis_faligndata(TMP12, TMP14, REF_S4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-
-                        vis_ld64(dest[0], DST_0);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-
-                        vis_ld64_2(dest, stride, DST_2);
-                        vis_faligndata(TMP4, TMP6, REF_6);
-
-                        vis_faligndata(TMP8, TMP10, REF_S2);
-
-                        vis_faligndata(TMP12, TMP14, REF_S6);
-                } else {
-                        vis_ld64(dest[0], DST_0);
-                        vis_src1(TMP2, REF_2);
-
-                        vis_ld64_2(dest, stride, DST_2);
-                        vis_src1(TMP6, REF_6);
-
-                        vis_src1(TMP10, REF_S2);
-
-                        vis_src1(TMP14, REF_S6);
-                }
-
-                vis_pmerge(ZERO,     REF_0,     TMP0);
-                vis_mul8x16au(REF_0_1, CONST_256, TMP2);
-
-                vis_pmerge(ZERO,     REF_2,     TMP4);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP6);
-
-                vis_padd16(TMP0, CONST_3, TMP0);
-                vis_mul8x16al(DST_0,   CONST_512, TMP16);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-                vis_mul8x16al(DST_1,   CONST_512, TMP18);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-                vis_mul8x16au(REF_4, CONST_256, TMP8);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP10);
-
-                vis_padd16(TMP0, TMP16, TMP0);
-                vis_mul8x16au(REF_6, CONST_256, TMP12);
-
-                vis_padd16(TMP2, TMP18, TMP2);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP14);
-
-                vis_padd16(TMP8, CONST_3, TMP8);
-                vis_mul8x16al(DST_2, CONST_512, TMP16);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-                vis_mul8x16al(DST_3, CONST_512, TMP18);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_pack16(TMP0, DST_0);
-
-                vis_pack16(TMP2, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-                vis_padd16(TMP10, CONST_3, TMP10);
-
-                vis_ld64_2(dest, stride, DST_0);
-                vis_padd16(TMP8, TMP16, TMP8);
-
-                vis_ld64_2(dest, stride_times_2, TMP4/*DST_2*/);
-                vis_padd16(TMP10, TMP18, TMP10);
-                vis_pack16(TMP8, DST_2);
-
-                vis_pack16(TMP10, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-
-                vis_mul8x16au(REF_S0_1, CONST_256, TMP2);
-                vis_pmerge(ZERO,     REF_S0,     TMP0);
-
-                vis_pmerge(ZERO,     REF_S2,     TMP24);
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP6);
-
-                vis_padd16(TMP0, CONST_3, TMP0);
-                vis_mul8x16au(REF_S4, CONST_256, TMP8);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-                vis_mul8x16au(REF_S4_1, CONST_256, TMP10);
-
-                vis_padd16(TMP0, TMP24, TMP0);
-                vis_mul8x16au(REF_S6, CONST_256, TMP12);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_S6_1, CONST_256, TMP14);
-
-                vis_padd16(TMP8, CONST_3, TMP8);
-                vis_mul8x16al(DST_0,   CONST_512, TMP16);
-
-                vis_padd16(TMP10, CONST_3, TMP10);
-                vis_mul8x16al(DST_1,   CONST_512, TMP18);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-                vis_mul8x16al(TMP4/*DST_2*/, CONST_512, TMP20);
-
-                vis_mul8x16al(TMP5/*DST_3*/, CONST_512, TMP22);
-                vis_padd16(TMP0, TMP16, TMP0);
-
-                vis_padd16(TMP2, TMP18, TMP2);
-                vis_pack16(TMP0, DST_0);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_pack16(TMP2, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_padd16(TMP8, TMP20, TMP8);
-
-                vis_padd16(TMP10, TMP22, TMP10);
-                vis_pack16(TMP8, DST_2);
-
-                vis_pack16(TMP10, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_no_round_y_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64_2(ref, 8, TMP2);
-
-        vis_ld64_2(ref, 16, TMP4);
-        ref += stride;
-
-        vis_ld64(ref[0], TMP6);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64_2(ref, 8, TMP8);
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        vis_ld64_2(ref, 16, TMP10);
-        ref += stride;
-
-        vis_ld64(constants_fe[0], MASK_fe);
-        vis_faligndata(TMP6, TMP8, REF_2);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP8, TMP10, REF_6);
-
-        vis_ld64(constants128[0], CONST_128);
-        height = (height >> 1) - 1;
-        do {    /* 24 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(REF_0, REF_2, TMP12);
-
-                vis_ld64_2(ref, 8, TMP2);
-                vis_xor(REF_4, REF_6, TMP16);
-
-                vis_ld64_2(ref, 16, TMP4);
-                ref += stride;
-                vis_and(REF_0, REF_2, TMP14);
-
-                vis_ld64(ref[0], TMP6);
-                vis_and(REF_4, REF_6, TMP18);
-
-                vis_ld64_2(ref, 8, TMP8);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, 16, TMP10);
-                ref += stride;
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_and(TMP12, MASK_fe, TMP12);
-
-                vis_and(TMP16, MASK_fe, TMP16);
-                vis_mul8x16(CONST_128, TMP12, TMP12);
-
-                vis_mul8x16(CONST_128, TMP16, TMP16);
-                vis_xor(REF_0, REF_2, TMP0);
-
-                vis_xor(REF_4, REF_6, TMP2);
-
-                vis_and(REF_0, REF_2, TMP20);
-
-                vis_and(TMP12, MASK_7f, TMP12);
-
-                vis_and(TMP16, MASK_7f, TMP16);
-
-                vis_padd16(TMP14, TMP12, TMP12);
-                vis_st64(TMP12, dest[0]);
-
-                vis_padd16(TMP18, TMP16, TMP16);
-                vis_st64_2(TMP16, dest, 8);
-                dest += stride;
-
-                vis_and(REF_4, REF_6, TMP18);
-
-                vis_and(TMP0, MASK_fe, TMP0);
-
-                vis_and(TMP2, MASK_fe, TMP2);
-                vis_mul8x16(CONST_128, TMP0, TMP0);
-
-                vis_faligndata(TMP6, TMP8, REF_2);
-                vis_mul8x16(CONST_128, TMP2, TMP2);
-
-                vis_faligndata(TMP8, TMP10, REF_6);
-
-                vis_and(TMP0, MASK_7f, TMP0);
-
-                vis_and(TMP2, MASK_7f, TMP2);
-
-                vis_padd16(TMP20, TMP0, TMP0);
-                vis_st64(TMP0, dest[0]);
-
-                vis_padd16(TMP18, TMP2, TMP2);
-                vis_st64_2(TMP2, dest, 8);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(REF_0, REF_2, TMP12);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_xor(REF_4, REF_6, TMP16);
-
-        vis_ld64_2(ref, 16, TMP4);
-        vis_and(REF_0, REF_2, TMP14);
-
-        vis_and(REF_4, REF_6, TMP18);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_faligndata(TMP2, TMP4, REF_4);
-
-        vis_and(TMP12, MASK_fe, TMP12);
-
-        vis_and(TMP16, MASK_fe, TMP16);
-        vis_mul8x16(CONST_128, TMP12, TMP12);
-
-        vis_mul8x16(CONST_128, TMP16, TMP16);
-        vis_xor(REF_0, REF_2, TMP0);
-
-        vis_xor(REF_4, REF_6, TMP2);
-
-        vis_and(REF_0, REF_2, TMP20);
-
-        vis_and(TMP12, MASK_7f, TMP12);
-
-        vis_and(TMP16, MASK_7f, TMP16);
-
-        vis_padd16(TMP14, TMP12, TMP12);
-        vis_st64(TMP12, dest[0]);
-
-        vis_padd16(TMP18, TMP16, TMP16);
-        vis_st64_2(TMP16, dest, 8);
-        dest += stride;
-
-        vis_and(REF_4, REF_6, TMP18);
-
-        vis_and(TMP0, MASK_fe, TMP0);
-
-        vis_and(TMP2, MASK_fe, TMP2);
-        vis_mul8x16(CONST_128, TMP0, TMP0);
-
-        vis_mul8x16(CONST_128, TMP2, TMP2);
-
-        vis_and(TMP0, MASK_7f, TMP0);
-
-        vis_and(TMP2, MASK_7f, TMP2);
-
-        vis_padd16(TMP20, TMP0, TMP0);
-        vis_st64(TMP0, dest[0]);
-
-        vis_padd16(TMP18, TMP2, TMP2);
-        vis_st64_2(TMP2, dest, 8);
-}
-
-static void MC_put_no_round_y_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        ref = vis_alignaddr(ref);
-        vis_ld64(ref[0], TMP0);
-
-        vis_ld64_2(ref, 8, TMP2);
-        ref += stride;
-
-        vis_ld64(ref[0], TMP4);
-
-        vis_ld64_2(ref, 8, TMP6);
-        ref += stride;
-
-        vis_ld64(constants_fe[0], MASK_fe);
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_ld64(constants_7f[0], MASK_7f);
-        vis_faligndata(TMP4, TMP6, REF_2);
-
-        vis_ld64(constants128[0], CONST_128);
-        height = (height >> 1) - 1;
-        do {    /* 12 cycles */
-                vis_ld64(ref[0], TMP0);
-                vis_xor(REF_0, REF_2, TMP4);
-
-                vis_ld64_2(ref, 8, TMP2);
-                ref += stride;
-                vis_and(TMP4, MASK_fe, TMP4);
-
-                vis_and(REF_0, REF_2, TMP6);
-                vis_mul8x16(CONST_128, TMP4, TMP4);
-
-                vis_faligndata(TMP0, TMP2, REF_0);
-                vis_ld64(ref[0], TMP0);
-
-                vis_ld64_2(ref, 8, TMP2);
-                ref += stride;
-                vis_xor(REF_0, REF_2, TMP12);
-
-                vis_and(TMP4, MASK_7f, TMP4);
-
-                vis_and(TMP12, MASK_fe, TMP12);
-
-                vis_mul8x16(CONST_128, TMP12, TMP12);
-                vis_and(REF_0, REF_2, TMP14);
-
-                vis_padd16(TMP6, TMP4, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_faligndata(TMP0, TMP2, REF_2);
-
-                vis_and(TMP12, MASK_7f, TMP12);
-
-                vis_padd16(TMP14, TMP12, DST_0);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-        } while (--height);
-
-        vis_ld64(ref[0], TMP0);
-        vis_xor(REF_0, REF_2, TMP4);
-
-        vis_ld64_2(ref, 8, TMP2);
-        vis_and(TMP4, MASK_fe, TMP4);
-
-        vis_and(REF_0, REF_2, TMP6);
-        vis_mul8x16(CONST_128, TMP4, TMP4);
-
-        vis_faligndata(TMP0, TMP2, REF_0);
-
-        vis_xor(REF_0, REF_2, TMP12);
-
-        vis_and(TMP4, MASK_7f, TMP4);
-
-        vis_and(TMP12, MASK_fe, TMP12);
-
-        vis_mul8x16(CONST_128, TMP12, TMP12);
-        vis_and(REF_0, REF_2, TMP14);
-
-        vis_padd16(TMP6, TMP4, DST_0);
-        vis_st64(DST_0, dest[0]);
-        dest += stride;
-
-        vis_and(TMP12, MASK_7f, TMP12);
-
-        vis_padd16(TMP14, TMP12, DST_0);
-        vis_st64(DST_0, dest[0]);
-}
-
-static void MC_avg_no_round_y_16_vis (uint8_t * dest, const uint8_t * ref,
-                             const int stride, int height)
-{
-        int stride_8 = stride + 8;
-        int stride_16 = stride + 16;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_faligndata(TMP0, TMP2, REF_2);
-
-        vis_ld64(constants256_512[0], CONST_256);
-        vis_faligndata(TMP2, TMP4, REF_6);
-        height >>= 1;
-
-        do {    /* 31 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_pmerge(ZERO,       REF_2,     TMP12);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP14);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                vis_pmerge(ZERO,       REF_6,     TMP16);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP18);
-
-                vis_ld64_2(ref, stride_16, TMP4);
-                ref += stride;
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(dest, 8, DST_2);
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_ld64_2(ref, stride, TMP6);
-                vis_pmerge(ZERO,     REF_0,     TMP0);
-                vis_mul8x16au(REF_0_1, CONST_256, TMP2);
-
-                vis_ld64_2(ref, stride_8, TMP8);
-                vis_pmerge(ZERO,     REF_4,     TMP4);
-
-                vis_ld64_2(ref, stride_16, TMP10);
-                ref += stride;
-
-                vis_ld64_2(dest, stride, REF_S0/*DST_4*/);
-                vis_faligndata(TMP6, TMP8, REF_2);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP6);
-
-                vis_ld64_2(dest, stride_8, REF_S2/*DST_6*/);
-                vis_faligndata(TMP8, TMP10, REF_6);
-                vis_mul8x16al(DST_0,   CONST_512, TMP20);
-
-                vis_padd16(TMP0, CONST_3, TMP0);
-                vis_mul8x16al(DST_1,   CONST_512, TMP22);
-
-                vis_padd16(TMP2, CONST_3, TMP2);
-                vis_mul8x16al(DST_2,   CONST_512, TMP24);
-
-                vis_padd16(TMP4, CONST_3, TMP4);
-                vis_mul8x16al(DST_3,   CONST_512, TMP26);
-
-                vis_padd16(TMP6, CONST_3, TMP6);
-
-                vis_padd16(TMP12, TMP20, TMP12);
-                vis_mul8x16al(REF_S0,   CONST_512, TMP20);
-
-                vis_padd16(TMP14, TMP22, TMP14);
-                vis_mul8x16al(REF_S0_1, CONST_512, TMP22);
-
-                vis_padd16(TMP16, TMP24, TMP16);
-                vis_mul8x16al(REF_S2,   CONST_512, TMP24);
-
-                vis_padd16(TMP18, TMP26, TMP18);
-                vis_mul8x16al(REF_S2_1, CONST_512, TMP26);
-
-                vis_padd16(TMP12, TMP0, TMP12);
-                vis_mul8x16au(REF_2,   CONST_256, TMP28);
-
-                vis_padd16(TMP14, TMP2, TMP14);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP30);
-
-                vis_padd16(TMP16, TMP4, TMP16);
-                vis_mul8x16au(REF_6,   CONST_256, REF_S4);
-
-                vis_padd16(TMP18, TMP6, TMP18);
-                vis_mul8x16au(REF_6_1, CONST_256, REF_S6);
-
-                vis_pack16(TMP12, DST_0);
-                vis_padd16(TMP28, TMP0, TMP12);
-
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_padd16(TMP30, TMP2, TMP14);
-
-                vis_pack16(TMP16, DST_2);
-                vis_padd16(REF_S4, TMP4, TMP16);
-
-                vis_pack16(TMP18, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-                vis_padd16(REF_S6, TMP6, TMP18);
-
-                vis_padd16(TMP12, TMP20, TMP12);
-
-                vis_padd16(TMP14, TMP22, TMP14);
-                vis_pack16(TMP12, DST_0);
-
-                vis_padd16(TMP16, TMP24, TMP16);
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-
-                vis_padd16(TMP18, TMP26, TMP18);
-                vis_pack16(TMP16, DST_2);
-
-                vis_pack16(TMP18, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_no_round_y_8_vis (uint8_t * dest, const uint8_t * ref,
-                            const int stride, int height)
-{
-        int stride_8 = stride + 8;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(constants3[0], CONST_3);
-        vis_faligndata(TMP0, TMP2, REF_2);
-
-        vis_ld64(constants256_512[0], CONST_256);
-
-        height >>= 1;
-        do {    /* 20 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_pmerge(ZERO,       REF_2,     TMP8);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP10);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                ref += stride;
-
-                vis_ld64(dest[0], DST_0);
-
-                vis_ld64_2(dest, stride, DST_2);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, stride, TMP4);
-                vis_mul8x16al(DST_0,   CONST_512, TMP16);
-                vis_pmerge(ZERO,       REF_0,     TMP12);
-
-                vis_ld64_2(ref, stride_8, TMP6);
-                ref += stride;
-                vis_mul8x16al(DST_1,   CONST_512, TMP18);
-                vis_pmerge(ZERO,       REF_0_1,   TMP14);
-
-                vis_padd16(TMP12, CONST_3, TMP12);
-                vis_mul8x16al(DST_2,   CONST_512, TMP24);
-
-                vis_padd16(TMP14, CONST_3, TMP14);
-                vis_mul8x16al(DST_3,   CONST_512, TMP26);
-
-                vis_faligndata(TMP4, TMP6, REF_2);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_mul8x16au(REF_2,   CONST_256, TMP20);
-
-                vis_padd16(TMP8, TMP16, TMP0);
-                vis_mul8x16au(REF_2_1, CONST_256, TMP22);
-
-                vis_padd16(TMP10, TMP18, TMP2);
-                vis_pack16(TMP0, DST_0);
-
-                vis_pack16(TMP2, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-                vis_padd16(TMP12, TMP20, TMP12);
-
-                vis_padd16(TMP14, TMP22, TMP14);
-
-                vis_padd16(TMP12, TMP24, TMP0);
-
-                vis_padd16(TMP14, TMP26, TMP2);
-                vis_pack16(TMP0, DST_2);
-
-                vis_pack16(TMP2, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_no_round_xy_16_vis (uint8_t * dest, const uint8_t * ref,
-                                       const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-        int stride_16 = stride + 16;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(constants1[0], CONST_1);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        vis_ld64(constants256_512[0], CONST_256);
-        vis_faligndata(TMP2, TMP4, REF_S4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-                vis_faligndata(TMP2, TMP4, REF_S6);
-        } else {
-                vis_src1(TMP2, REF_S2);
-                vis_src1(TMP4, REF_S6);
-        }
-
-        height >>= 1;
-        do {
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0, CONST_256, TMP12);
-                vis_pmerge(ZERO,      REF_S0_1,  TMP14);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                vis_mul8x16au(REF_S2, CONST_256, TMP16);
-                vis_pmerge(ZERO,      REF_S2_1,  TMP18);
-
-                vis_ld64_2(ref, stride_16, TMP4);
-                ref += stride;
-                vis_mul8x16au(REF_S4, CONST_256, TMP20);
-                vis_pmerge(ZERO,      REF_S4_1,  TMP22);
-
-                vis_ld64_2(ref, stride, TMP6);
-                vis_mul8x16au(REF_S6, CONST_256, TMP24);
-                vis_pmerge(ZERO,      REF_S6_1,  TMP26);
-
-                vis_ld64_2(ref, stride_8, TMP8);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, stride_16, TMP10);
-                ref += stride;
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_faligndata(TMP6, TMP8, REF_S0);
-
-                vis_faligndata(TMP8, TMP10, REF_S4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                        vis_faligndata(TMP6, TMP8, REF_S2);
-                        vis_faligndata(TMP8, TMP10, REF_S6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                        vis_src1(TMP8, REF_S2);
-                        vis_src1(TMP10, REF_S6);
-                }
-
-                vis_mul8x16au(REF_0, CONST_256, TMP0);
-                vis_pmerge(ZERO,      REF_0_1,  TMP2);
-
-                vis_mul8x16au(REF_2, CONST_256, TMP4);
-                vis_pmerge(ZERO,      REF_2_1,  TMP6);
-
-                vis_padd16(TMP0, CONST_2, TMP8);
-                vis_mul8x16au(REF_4, CONST_256, TMP0);
-
-                vis_padd16(TMP2, CONST_1, TMP10);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP2);
-
-                vis_padd16(TMP8, TMP4, TMP8);
-                vis_mul8x16au(REF_6, CONST_256, TMP4);
-
-                vis_padd16(TMP10, TMP6, TMP10);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP6);
-
-                vis_padd16(TMP12, TMP8, TMP12);
-
-                vis_padd16(TMP14, TMP10, TMP14);
-
-                vis_padd16(TMP12, TMP16, TMP12);
-
-                vis_padd16(TMP14, TMP18, TMP14);
-                vis_pack16(TMP12, DST_0);
-
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_padd16(TMP0, CONST_1, TMP12);
-
-                vis_mul8x16au(REF_S0, CONST_256, TMP0);
-                vis_padd16(TMP2, CONST_1, TMP14);
-
-                vis_mul8x16au(REF_S0_1, CONST_256, TMP2);
-                vis_padd16(TMP12, TMP4, TMP12);
-
-                vis_mul8x16au(REF_S2, CONST_256, TMP4);
-                vis_padd16(TMP14, TMP6, TMP14);
-
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP6);
-                vis_padd16(TMP20, TMP12, TMP20);
-
-                vis_padd16(TMP22, TMP14, TMP22);
-
-                vis_padd16(TMP20, TMP24, TMP20);
-
-                vis_padd16(TMP22, TMP26, TMP22);
-                vis_pack16(TMP20, DST_2);
-
-                vis_pack16(TMP22, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-                vis_padd16(TMP0, TMP4, TMP24);
-
-                vis_mul8x16au(REF_S4, CONST_256, TMP0);
-                vis_padd16(TMP2, TMP6, TMP26);
-
-                vis_mul8x16au(REF_S4_1, CONST_256, TMP2);
-                vis_padd16(TMP24, TMP8, TMP24);
-
-                vis_padd16(TMP26, TMP10, TMP26);
-                vis_pack16(TMP24, DST_0);
-
-                vis_pack16(TMP26, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_pmerge(ZERO, REF_S6, TMP4);
-
-                vis_pmerge(ZERO,      REF_S6_1,  TMP6);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-
-                vis_padd16(TMP0, TMP12, TMP0);
-
-                vis_padd16(TMP2, TMP14, TMP2);
-                vis_pack16(TMP0, DST_2);
-
-                vis_pack16(TMP2, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_put_no_round_xy_8_vis (uint8_t * dest, const uint8_t * ref,
-                                      const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-
-        vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(constants1[0], CONST_1);
-
-        vis_ld64(constants256_512[0], CONST_256);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-        } else {
-                vis_src1(TMP2, REF_S2);
-        }
-
-        height >>= 1;
-        do {    /* 26 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0,   CONST_256, TMP8);
-                vis_pmerge(ZERO,        REF_S2,    TMP12);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                ref += stride;
-                vis_mul8x16au(REF_S0_1, CONST_256, TMP10);
-                vis_pmerge(ZERO,        REF_S2_1,  TMP14);
-
-                vis_ld64_2(ref, stride, TMP4);
-
-                vis_ld64_2(ref, stride_8, TMP6);
-                ref += stride;
-                vis_faligndata(TMP0, TMP2, REF_S4);
-
-                vis_pmerge(ZERO, REF_S4, TMP18);
-
-                vis_pmerge(ZERO, REF_S4_1, TMP20);
-
-                vis_faligndata(TMP4, TMP6, REF_S0);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_S6);
-                        vis_faligndata(TMP4, TMP6, REF_S2);
-                } else {
-                        vis_src1(TMP2, REF_S6);
-                        vis_src1(TMP6, REF_S2);
-                }
-
-                vis_padd16(TMP18, CONST_1, TMP18);
-                vis_mul8x16au(REF_S6,   CONST_256, TMP22);
-
-                vis_padd16(TMP20, CONST_1, TMP20);
-                vis_mul8x16au(REF_S6_1, CONST_256, TMP24);
-
-                vis_mul8x16au(REF_S0,   CONST_256, TMP26);
-                vis_pmerge(ZERO, REF_S0_1, TMP28);
-
-                vis_mul8x16au(REF_S2,   CONST_256, TMP30);
-                vis_padd16(TMP18, TMP22, TMP18);
-
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP32);
-                vis_padd16(TMP20, TMP24, TMP20);
-
-                vis_padd16(TMP8,  TMP18, TMP8);
-
-                vis_padd16(TMP10, TMP20, TMP10);
-
-                vis_padd16(TMP8,  TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-                vis_pack16(TMP8,  DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-                vis_padd16(TMP18, TMP26, TMP18);
-
-                vis_padd16(TMP20, TMP28, TMP20);
-
-                vis_padd16(TMP18, TMP30, TMP18);
-
-                vis_padd16(TMP20, TMP32, TMP20);
-                vis_pack16(TMP18, DST_2);
-
-                vis_pack16(TMP20, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_no_round_xy_16_vis (uint8_t * dest, const uint8_t * ref,
-                                       const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-        int stride_16 = stride + 16;
-
-        vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[ 0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64(ref[ 8], TMP2);
-
-        vis_ld64(ref[16], TMP4);
-
-        vis_ld64(constants6[0], CONST_6);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        vis_ld64(constants256_1024[0], CONST_256);
-        vis_faligndata(TMP2, TMP4, REF_S4);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-                vis_faligndata(TMP2, TMP4, REF_S6);
-        } else {
-                vis_src1(TMP2, REF_S2);
-                vis_src1(TMP4, REF_S6);
-        }
-
-        height >>= 1;
-        do {    /* 55 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0, CONST_256, TMP12);
-                vis_pmerge(ZERO,      REF_S0_1,  TMP14);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                vis_mul8x16au(REF_S2, CONST_256, TMP16);
-                vis_pmerge(ZERO,      REF_S2_1,  TMP18);
-
-                vis_ld64_2(ref, stride_16, TMP4);
-                ref += stride;
-                vis_mul8x16au(REF_S4, CONST_256, TMP20);
-                vis_pmerge(ZERO,      REF_S4_1,  TMP22);
-
-                vis_ld64_2(ref, stride, TMP6);
-                vis_mul8x16au(REF_S6, CONST_256, TMP24);
-                vis_pmerge(ZERO,      REF_S6_1,  TMP26);
-
-                vis_ld64_2(ref, stride_8, TMP8);
-                vis_faligndata(TMP0, TMP2, REF_0);
-
-                vis_ld64_2(ref, stride_16, TMP10);
-                ref += stride;
-                vis_faligndata(TMP2, TMP4, REF_4);
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP6, TMP8, REF_S0);
-
-                vis_ld64_2(dest, 8, DST_2);
-                vis_faligndata(TMP8, TMP10, REF_S4);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_2);
-                        vis_faligndata(TMP2, TMP4, REF_6);
-                        vis_faligndata(TMP6, TMP8, REF_S2);
-                        vis_faligndata(TMP8, TMP10, REF_S6);
-                } else {
-                        vis_src1(TMP2, REF_2);
-                        vis_src1(TMP4, REF_6);
-                        vis_src1(TMP8, REF_S2);
-                        vis_src1(TMP10, REF_S6);
-                }
-
-                vis_mul8x16al(DST_0,   CONST_1024, TMP30);
-                vis_pmerge(ZERO, REF_0, TMP0);
-
-                vis_mul8x16al(DST_1,   CONST_1024, TMP32);
-                vis_pmerge(ZERO,      REF_0_1,  TMP2);
-
-                vis_mul8x16au(REF_2, CONST_256, TMP4);
-                vis_pmerge(ZERO,      REF_2_1,  TMP6);
-
-                vis_mul8x16al(DST_2,   CONST_1024, REF_0);
-                vis_padd16(TMP0, CONST_6, TMP0);
-
-                vis_mul8x16al(DST_3,   CONST_1024, REF_2);
-                vis_padd16(TMP2, CONST_6, TMP2);
-
-                vis_padd16(TMP0, TMP4, TMP0);
-                vis_mul8x16au(REF_4, CONST_256, TMP4);
-
-                vis_padd16(TMP2, TMP6, TMP2);
-                vis_mul8x16au(REF_4_1, CONST_256, TMP6);
-
-                vis_padd16(TMP12, TMP0, TMP12);
-                vis_mul8x16au(REF_6, CONST_256, TMP8);
-
-                vis_padd16(TMP14, TMP2, TMP14);
-                vis_mul8x16au(REF_6_1, CONST_256, TMP10);
-
-                vis_padd16(TMP12, TMP16, TMP12);
-                vis_mul8x16au(REF_S0, CONST_256, REF_4);
-
-                vis_padd16(TMP14, TMP18, TMP14);
-                vis_mul8x16au(REF_S0_1, CONST_256, REF_6);
-
-                vis_padd16(TMP12, TMP30, TMP12);
-
-                vis_padd16(TMP14, TMP32, TMP14);
-                vis_pack16(TMP12, DST_0);
-
-                vis_pack16(TMP14, DST_1);
-                vis_st64(DST_0, dest[0]);
-                vis_padd16(TMP4, CONST_6, TMP4);
-
-                vis_ld64_2(dest, stride, DST_0);
-                vis_padd16(TMP6, CONST_6, TMP6);
-                vis_mul8x16au(REF_S2, CONST_256, TMP12);
-
-                vis_padd16(TMP4, TMP8, TMP4);
-                vis_mul8x16au(REF_S2_1, CONST_256,  TMP14);
-
-                vis_padd16(TMP6, TMP10, TMP6);
-
-                vis_padd16(TMP20, TMP4, TMP20);
-
-                vis_padd16(TMP22, TMP6, TMP22);
-
-                vis_padd16(TMP20, TMP24, TMP20);
-
-                vis_padd16(TMP22, TMP26, TMP22);
-
-                vis_padd16(TMP20, REF_0, TMP20);
-                vis_mul8x16au(REF_S4, CONST_256, REF_0);
-
-                vis_padd16(TMP22, REF_2, TMP22);
-                vis_pack16(TMP20, DST_2);
-
-                vis_pack16(TMP22, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-
-                vis_ld64_2(dest, 8, DST_2);
-                vis_mul8x16al(DST_0,   CONST_1024, TMP30);
-                vis_pmerge(ZERO,      REF_S4_1,  REF_2);
-
-                vis_mul8x16al(DST_1,   CONST_1024, TMP32);
-                vis_padd16(REF_4, TMP0, TMP8);
-
-                vis_mul8x16au(REF_S6, CONST_256, REF_4);
-                vis_padd16(REF_6, TMP2, TMP10);
-
-                vis_mul8x16au(REF_S6_1, CONST_256, REF_6);
-                vis_padd16(TMP8, TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-
-                vis_padd16(TMP8, TMP30, TMP8);
-
-                vis_padd16(TMP10, TMP32, TMP10);
-                vis_pack16(TMP8, DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_st64(DST_0, dest[0]);
-
-                vis_padd16(REF_0, TMP4, REF_0);
-
-                vis_mul8x16al(DST_2,   CONST_1024, TMP30);
-                vis_padd16(REF_2, TMP6, REF_2);
-
-                vis_mul8x16al(DST_3,   CONST_1024, TMP32);
-                vis_padd16(REF_0, REF_4, REF_0);
-
-                vis_padd16(REF_2, REF_6, REF_2);
-
-                vis_padd16(REF_0, TMP30, REF_0);
-
-                /* stall */
-
-                vis_padd16(REF_2, TMP32, REF_2);
-                vis_pack16(REF_0, DST_2);
-
-                vis_pack16(REF_2, DST_3);
-                vis_st64_2(DST_2, dest, 8);
-                dest += stride;
-        } while (--height);
-}
-
-static void MC_avg_no_round_xy_8_vis (uint8_t * dest, const uint8_t * ref,
-                                      const int stride, int height)
-{
-        unsigned long off = (unsigned long) ref & 0x7;
-        unsigned long off_plus_1 = off + 1;
-        int stride_8 = stride + 8;
-
-        vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT);
-
-        ref = vis_alignaddr(ref);
-
-        vis_ld64(ref[0], TMP0);
-        vis_fzero(ZERO);
-
-        vis_ld64_2(ref, 8, TMP2);
-
-        vis_ld64(constants6[0], CONST_6);
-
-        vis_ld64(constants256_1024[0], CONST_256);
-        vis_faligndata(TMP0, TMP2, REF_S0);
-
-        if (off != 0x7) {
-                vis_alignaddr_g0((void *)off_plus_1);
-                vis_faligndata(TMP0, TMP2, REF_S2);
-        } else {
-                vis_src1(TMP2, REF_S2);
-        }
-
-        height >>= 1;
-        do {    /* 31 cycles */
-                vis_ld64_2(ref, stride, TMP0);
-                vis_mul8x16au(REF_S0, CONST_256, TMP8);
-                vis_pmerge(ZERO,      REF_S0_1,  TMP10);
-
-                vis_ld64_2(ref, stride_8, TMP2);
-                ref += stride;
-                vis_mul8x16au(REF_S2, CONST_256, TMP12);
-                vis_pmerge(ZERO,      REF_S2_1,  TMP14);
-
-                vis_alignaddr_g0((void *)off);
-
-                vis_ld64_2(ref, stride, TMP4);
-                vis_faligndata(TMP0, TMP2, REF_S4);
-
-                vis_ld64_2(ref, stride_8, TMP6);
-                ref += stride;
-
-                vis_ld64(dest[0], DST_0);
-                vis_faligndata(TMP4, TMP6, REF_S0);
-
-                vis_ld64_2(dest, stride, DST_2);
-
-                if (off != 0x7) {
-                        vis_alignaddr_g0((void *)off_plus_1);
-                        vis_faligndata(TMP0, TMP2, REF_S6);
-                        vis_faligndata(TMP4, TMP6, REF_S2);
-                } else {
-                        vis_src1(TMP2, REF_S6);
-                        vis_src1(TMP6, REF_S2);
-                }
-
-                vis_mul8x16al(DST_0,   CONST_1024, TMP30);
-                vis_pmerge(ZERO, REF_S4, TMP22);
-
-                vis_mul8x16al(DST_1,   CONST_1024, TMP32);
-                vis_pmerge(ZERO,      REF_S4_1,  TMP24);
-
-                vis_mul8x16au(REF_S6, CONST_256, TMP26);
-                vis_pmerge(ZERO,      REF_S6_1,  TMP28);
-
-                vis_mul8x16au(REF_S0, CONST_256, REF_S4);
-                vis_padd16(TMP22, CONST_6, TMP22);
-
-                vis_mul8x16au(REF_S0_1, CONST_256, REF_S6);
-                vis_padd16(TMP24, CONST_6, TMP24);
-
-                vis_mul8x16al(DST_2,   CONST_1024, REF_0);
-                vis_padd16(TMP22, TMP26, TMP22);
-
-                vis_mul8x16al(DST_3,   CONST_1024, REF_2);
-                vis_padd16(TMP24, TMP28, TMP24);
-
-                vis_mul8x16au(REF_S2, CONST_256, TMP26);
-                vis_padd16(TMP8, TMP22, TMP8);
-
-                vis_mul8x16au(REF_S2_1, CONST_256, TMP28);
-                vis_padd16(TMP10, TMP24, TMP10);
-
-                vis_padd16(TMP8, TMP12, TMP8);
-
-                vis_padd16(TMP10, TMP14, TMP10);
-
-                vis_padd16(TMP8, TMP30, TMP8);
-
-                vis_padd16(TMP10, TMP32, TMP10);
-                vis_pack16(TMP8, DST_0);
-
-                vis_pack16(TMP10, DST_1);
-                vis_st64(DST_0, dest[0]);
-                dest += stride;
-
-                vis_padd16(REF_S4, TMP22, TMP12);
-
-                vis_padd16(REF_S6, TMP24, TMP14);
-
-                vis_padd16(TMP12, TMP26, TMP12);
-
-                vis_padd16(TMP14, TMP28, TMP14);
-
-                vis_padd16(TMP12, REF_0, TMP12);
-
-                vis_padd16(TMP14, REF_2, TMP14);
-                vis_pack16(TMP12, DST_2);
-
-                vis_pack16(TMP14, DST_3);
-                vis_st64(DST_2, dest[0]);
-                dest += stride;
-        } while (--height);
-}
-
-/* End of no rounding code */
-
-#define ACCEL_SPARC_VIS 1
-#define ACCEL_SPARC_VIS2 2
-
-static int vis_level(void)
-{
-    int accel = 0;
-    accel |= ACCEL_SPARC_VIS;
-    accel |= ACCEL_SPARC_VIS2;
-    return accel;
-}
-
-/* libavcodec initialization code */
-void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx)
-{
-  /* VIS-specific optimizations */
-  int accel = vis_level ();
-
-  if (accel & ACCEL_SPARC_VIS) {
-      if(avctx->idct_algo==FF_IDCT_SIMPLEVIS){
-          c->idct_put = ff_simple_idct_put_vis;
-          c->idct_add = ff_simple_idct_add_vis;
-          c->idct     = ff_simple_idct_vis;
-          c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
-      }
-
-      c->put_pixels_tab[0][0] = MC_put_o_16_vis;
-      c->put_pixels_tab[0][1] = MC_put_x_16_vis;
-      c->put_pixels_tab[0][2] = MC_put_y_16_vis;
-      c->put_pixels_tab[0][3] = MC_put_xy_16_vis;
-
-      c->put_pixels_tab[1][0] = MC_put_o_8_vis;
-      c->put_pixels_tab[1][1] = MC_put_x_8_vis;
-      c->put_pixels_tab[1][2] = MC_put_y_8_vis;
-      c->put_pixels_tab[1][3] = MC_put_xy_8_vis;
-
-      c->avg_pixels_tab[0][0] = MC_avg_o_16_vis;
-      c->avg_pixels_tab[0][1] = MC_avg_x_16_vis;
-      c->avg_pixels_tab[0][2] = MC_avg_y_16_vis;
-      c->avg_pixels_tab[0][3] = MC_avg_xy_16_vis;
-
-      c->avg_pixels_tab[1][0] = MC_avg_o_8_vis;
-      c->avg_pixels_tab[1][1] = MC_avg_x_8_vis;
-      c->avg_pixels_tab[1][2] = MC_avg_y_8_vis;
-      c->avg_pixels_tab[1][3] = MC_avg_xy_8_vis;
-
-      c->put_no_rnd_pixels_tab[0][0] = MC_put_no_round_o_16_vis;
-      c->put_no_rnd_pixels_tab[0][1] = MC_put_no_round_x_16_vis;
-      c->put_no_rnd_pixels_tab[0][2] = MC_put_no_round_y_16_vis;
-      c->put_no_rnd_pixels_tab[0][3] = MC_put_no_round_xy_16_vis;
-
-      c->put_no_rnd_pixels_tab[1][0] = MC_put_no_round_o_8_vis;
-      c->put_no_rnd_pixels_tab[1][1] = MC_put_no_round_x_8_vis;
-      c->put_no_rnd_pixels_tab[1][2] = MC_put_no_round_y_8_vis;
-      c->put_no_rnd_pixels_tab[1][3] = MC_put_no_round_xy_8_vis;
-
-      c->avg_no_rnd_pixels_tab[0][0] = MC_avg_no_round_o_16_vis;
-      c->avg_no_rnd_pixels_tab[0][1] = MC_avg_no_round_x_16_vis;
-      c->avg_no_rnd_pixels_tab[0][2] = MC_avg_no_round_y_16_vis;
-      c->avg_no_rnd_pixels_tab[0][3] = MC_avg_no_round_xy_16_vis;
-
-      c->avg_no_rnd_pixels_tab[1][0] = MC_avg_no_round_o_8_vis;
-      c->avg_no_rnd_pixels_tab[1][1] = MC_avg_no_round_x_8_vis;
-      c->avg_no_rnd_pixels_tab[1][2] = MC_avg_no_round_y_8_vis;
-      c->avg_no_rnd_pixels_tab[1][3] = MC_avg_no_round_xy_8_vis;
-  }
-}
diff --git a/libavcodec/sparc/dsputil_vis.h b/libavcodec/sparc/dsputil_vis.h
deleted file mode 100644
index 97ff965..0000000
--- a/libavcodec/sparc/dsputil_vis.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SPARC_DSPUTIL_VIS_H
-#define AVCODEC_SPARC_DSPUTIL_VIS_H
-
-#include <stdint.h>
-#include "libavcodec/dsputil.h"
-
-void ff_simple_idct_put_vis(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_simple_idct_add_vis(uint8_t *dest, int line_size, DCTELEM *data);
-void ff_simple_idct_vis(DCTELEM *data);
-
-#endif
diff --git a/libavcodec/sparc/simple_idct_vis.c b/libavcodec/sparc/simple_idct_vis.c
deleted file mode 100644
index d98bf37..0000000
--- a/libavcodec/sparc/simple_idct_vis.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * SPARC VIS optimized inverse DCT
- * Copyright (c) 2007 Denes Balatoni < dbalatoni XatX interware XdotX hu >
- *
- * I did consult the following fine web page about dct
- * http://www.geocities.com/ssavekar/dct.htm
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_vis.h"
-
-static const DECLARE_ALIGNED(8, int16_t, coeffs)[28] = {
-    - 1259,- 1259,- 1259,- 1259,
-    - 4989,- 4989,- 4989,- 4989,
-    -11045,-11045,-11045,-11045,
-    -19195,-19195,-19195,-19195,
-    -29126,-29126,-29126,-29126,
-     25080, 25080, 25080, 25080,
-     12785, 12785, 12785, 12785
-};
-static const DECLARE_ALIGNED(8, uint16_t, scale)[4] = {
-    65536>>6, 65536>>6, 65536>>6, 65536>>6
-};
-static const DECLARE_ALIGNED(8, uint16_t, rounder)[4] = {
-    1<<5, 1<<5, 1<<5, 1<<5
-};
-static const DECLARE_ALIGNED(8, uint16_t, expand)[4] = {
-    1<<14, 1<<14, 1<<14, 1<<14
-};
-
-#define INIT_IDCT \
-        "ldd [%1], %%f32         \n\t"\
-        "ldd [%1+8], %%f34       \n\t"\
-        "ldd [%1+16], %%f36      \n\t"\
-        "ldd [%1+24], %%f38      \n\t"\
-        "ldd [%1+32], %%f40      \n\t"\
-        "ldd [%1+40], %%f42      \n\t"\
-        "ldd [%1+48], %%f44      \n\t"\
-        "ldd [%0], %%f46         \n\t"\
-        "fzero %%f62             \n\t"\
-
-#define LOADSCALE(in) \
-        "ldd [" in "], %%f0          \n\t"\
-        "ldd [" in "+16], %%f2       \n\t"\
-        "ldd [" in "+32], %%f4       \n\t"\
-        "ldd [" in "+48], %%f6       \n\t"\
-        "ldd [" in "+64], %%f8       \n\t"\
-        "ldd [" in "+80], %%f10      \n\t"\
-        "ldd [" in "+96], %%f12      \n\t"\
-        "ldd [" in "+112], %%f14     \n\t"\
-        "fpadd16 %%f0, %%f0, %%f0    \n\t"\
-        "fpadd16 %%f2, %%f2, %%f2    \n\t"\
-        "fpadd16 %%f4, %%f4, %%f4    \n\t"\
-        "fpadd16 %%f6, %%f6, %%f6    \n\t"\
-        "fpadd16 %%f8, %%f8, %%f8    \n\t"\
-        "fpadd16 %%f10, %%f10, %%f10 \n\t"\
-        "fpadd16 %%f12, %%f12, %%f12 \n\t"\
-        "fpadd16 %%f14, %%f14, %%f14 \n\t"\
-\
-        "fpadd16 %%f0, %%f0, %%f0    \n\t"\
-        "fpadd16 %%f2, %%f2, %%f2    \n\t"\
-        "fpadd16 %%f4, %%f4, %%f4    \n\t"\
-        "fpadd16 %%f6, %%f6, %%f6    \n\t"\
-        "fpadd16 %%f8, %%f8, %%f8    \n\t"\
-        "fpadd16 %%f10, %%f10, %%f10 \n\t"\
-        "fpadd16 %%f12, %%f12, %%f12 \n\t"\
-        "fpadd16 %%f14, %%f14, %%f14 \n\t"\
-\
-        "fpadd16 %%f0, %%f0, %%f0    \n\t"\
-        "fpadd16 %%f2, %%f2, %%f2    \n\t"\
-        "fpadd16 %%f4, %%f4, %%f4    \n\t"\
-        "fpadd16 %%f6, %%f6, %%f6    \n\t"\
-        "fpadd16 %%f8, %%f8, %%f8    \n\t"\
-        "fpadd16 %%f10, %%f10, %%f10 \n\t"\
-        "fpadd16 %%f12, %%f12, %%f12 \n\t"\
-        "fpadd16 %%f14, %%f14, %%f14 \n\t"\
-\
-        "fpadd16 %%f0, %%f0, %%f0    \n\t"\
-        "fpadd16 %%f2, %%f2, %%f2    \n\t"\
-        "fpadd16 %%f4, %%f4, %%f4    \n\t"\
-        "fpadd16 %%f6, %%f6, %%f6    \n\t"\
-        "fpadd16 %%f8, %%f8, %%f8    \n\t"\
-        "fpadd16 %%f10, %%f10, %%f10 \n\t"\
-        "fpadd16 %%f12, %%f12, %%f12 \n\t"\
-        "fpadd16 %%f14, %%f14, %%f14 \n\t"\
-
-#define LOAD(in) \
-        "ldd [" in "], %%f16         \n\t"\
-        "ldd [" in "+8], %%f18       \n\t"\
-        "ldd [" in "+16], %%f20      \n\t"\
-        "ldd [" in "+24], %%f22      \n\t"\
-        "ldd [" in "+32], %%f24      \n\t"\
-        "ldd [" in "+40], %%f26      \n\t"\
-        "ldd [" in "+48], %%f28      \n\t"\
-        "ldd [" in "+56], %%f30      \n\t"\
-
-#define TRANSPOSE \
-        "fpmerge %%f16, %%f24, %%f0  \n\t"\
-        "fpmerge %%f20, %%f28, %%f2  \n\t"\
-        "fpmerge %%f17, %%f25, %%f4  \n\t"\
-        "fpmerge %%f21, %%f29, %%f6  \n\t"\
-        "fpmerge %%f18, %%f26, %%f8  \n\t"\
-        "fpmerge %%f22, %%f30, %%f10 \n\t"\
-        "fpmerge %%f19, %%f27, %%f12 \n\t"\
-        "fpmerge %%f23, %%f31, %%f14 \n\t"\
-\
-        "fpmerge %%f0, %%f2, %%f16   \n\t"\
-        "fpmerge %%f1, %%f3, %%f18   \n\t"\
-        "fpmerge %%f4, %%f6, %%f20   \n\t"\
-        "fpmerge %%f5, %%f7, %%f22   \n\t"\
-        "fpmerge %%f8, %%f10, %%f24  \n\t"\
-        "fpmerge %%f9, %%f11, %%f26  \n\t"\
-        "fpmerge %%f12, %%f14, %%f28 \n\t"\
-        "fpmerge %%f13, %%f15, %%f30 \n\t"\
-\
-        "fpmerge %%f16, %%f17, %%f0  \n\t"\
-        "fpmerge %%f18, %%f19, %%f2  \n\t"\
-        "fpmerge %%f20, %%f21, %%f4  \n\t"\
-        "fpmerge %%f22, %%f23, %%f6  \n\t"\
-        "fpmerge %%f24, %%f25, %%f8  \n\t"\
-        "fpmerge %%f26, %%f27, %%f10 \n\t"\
-        "fpmerge %%f28, %%f29, %%f12 \n\t"\
-        "fpmerge %%f30, %%f31, %%f14 \n\t"\
-
-#define IDCT4ROWS \
-    /* 1. column */\
-        "fmul8ulx16 %%f0, %%f38, %%f28 \n\t"\
-        "for %%f4, %%f6, %%f60         \n\t"\
-        "fmul8ulx16 %%f2, %%f32, %%f18 \n\t"\
-        "fmul8ulx16 %%f2, %%f36, %%f22 \n\t"\
-        "fmul8ulx16 %%f2, %%f40, %%f26 \n\t"\
-        "fmul8ulx16 %%f2, %%f44, %%f30 \n\t"\
-\
-        ADDROUNDER\
-\
-        "fmul8sux16 %%f0, %%f38, %%f48 \n\t"\
-        "fcmpd %%fcc0, %%f62, %%f60    \n\t"\
-        "for %%f8, %%f10, %%f60        \n\t"\
-        "fmul8sux16 %%f2, %%f32, %%f50 \n\t"\
-        "fmul8sux16 %%f2, %%f36, %%f52 \n\t"\
-        "fmul8sux16 %%f2, %%f40, %%f54 \n\t"\
-        "fmul8sux16 %%f2, %%f44, %%f56 \n\t"\
-\
-        "fpadd16 %%f48, %%f28, %%f28 \n\t"\
-        "fcmpd %%fcc1, %%f62, %%f60  \n\t"\
-        "for %%f12, %%f14, %%f60     \n\t"\
-        "fpadd16 %%f50, %%f18, %%f18 \n\t"\
-        "fpadd16 %%f52, %%f22, %%f22 \n\t"\
-        "fpadd16 %%f54, %%f26, %%f26 \n\t"\
-        "fpadd16 %%f56, %%f30, %%f30 \n\t"\
-\
-        "fpadd16 %%f28, %%f0, %%f16  \n\t"\
-        "fcmpd %%fcc2, %%f62, %%f60  \n\t"\
-        "fpadd16 %%f28, %%f0, %%f20  \n\t"\
-        "fpadd16 %%f28, %%f0, %%f24  \n\t"\
-        "fpadd16 %%f28, %%f0, %%f28  \n\t"\
-        "fpadd16 %%f18, %%f2, %%f18  \n\t"\
-        "fpadd16 %%f22, %%f2, %%f22  \n\t"\
-    /* 2. column */\
-        "fbe %%fcc0, 3f                \n\t"\
-        "fpadd16 %%f26, %%f2, %%f26    \n\t"\
-        "fmul8ulx16 %%f4, %%f34, %%f48 \n\t"\
-        "fmul8ulx16 %%f4, %%f42, %%f50 \n\t"\
-        "fmul8ulx16 %%f6, %%f36, %%f52 \n\t"\
-        "fmul8ulx16 %%f6, %%f44, %%f54 \n\t"\
-        "fmul8ulx16 %%f6, %%f32, %%f56 \n\t"\
-        "fmul8ulx16 %%f6, %%f40, %%f58 \n\t"\
-\
-        "fpadd16 %%f16, %%f48, %%f16 \n\t"\
-        "fpadd16 %%f20, %%f50, %%f20 \n\t"\
-        "fpsub16 %%f24, %%f50, %%f24 \n\t"\
-        "fpsub16 %%f28, %%f48, %%f28 \n\t"\
-        "fpadd16 %%f18, %%f52, %%f18 \n\t"\
-        "fpsub16 %%f22, %%f54, %%f22 \n\t"\
-        "fpsub16 %%f26, %%f56, %%f26 \n\t"\
-        "fpsub16 %%f30, %%f58, %%f30 \n\t"\
-\
-        "fmul8sux16 %%f4, %%f34, %%f48 \n\t"\
-        "fmul8sux16 %%f4, %%f42, %%f50 \n\t"\
-        "fmul8sux16 %%f6, %%f36, %%f52 \n\t"\
-        "fmul8sux16 %%f6, %%f44, %%f54 \n\t"\
-        "fmul8sux16 %%f6, %%f32, %%f56 \n\t"\
-        "fmul8sux16 %%f6, %%f40, %%f58 \n\t"\
-\
-        "fpadd16 %%f16, %%f48, %%f16 \n\t"\
-        "fpadd16 %%f20, %%f50, %%f20 \n\t"\
-        "fpsub16 %%f24, %%f50, %%f24 \n\t"\
-        "fpsub16 %%f28, %%f48, %%f28 \n\t"\
-        "fpadd16 %%f18, %%f52, %%f18 \n\t"\
-        "fpsub16 %%f22, %%f54, %%f22 \n\t"\
-        "fpsub16 %%f26, %%f56, %%f26 \n\t"\
-        "fpsub16 %%f30, %%f58, %%f30 \n\t"\
-\
-        "fpadd16 %%f16, %%f4, %%f16  \n\t"\
-        "fpsub16 %%f28, %%f4, %%f28  \n\t"\
-        "fpadd16 %%f18, %%f6, %%f18  \n\t"\
-        "fpsub16 %%f26, %%f6, %%f26  \n\t"\
-    /* 3. column */\
-        "3:                             \n\t"\
-        "fbe %%fcc1, 4f                 \n\t"\
-        "fpsub16 %%f30, %%f6, %%f30     \n\t"\
-        "fmul8ulx16 %%f8, %%f38, %%f48  \n\t"\
-        "fmul8ulx16 %%f10, %%f40, %%f50 \n\t"\
-        "fmul8ulx16 %%f10, %%f32, %%f52 \n\t"\
-        "fmul8ulx16 %%f10, %%f44, %%f54 \n\t"\
-        "fmul8ulx16 %%f10, %%f36, %%f56 \n\t"\
-\
-        "fpadd16 %%f16, %%f48, %%f16 \n\t"\
-        "fpsub16 %%f20, %%f48, %%f20 \n\t"\
-        "fpsub16 %%f24, %%f48, %%f24 \n\t"\
-        "fpadd16 %%f28, %%f48, %%f28 \n\t"\
-        "fpadd16 %%f18, %%f50, %%f18 \n\t"\
-        "fpsub16 %%f22, %%f52, %%f22 \n\t"\
-        "fpadd16 %%f26, %%f54, %%f26 \n\t"\
-        "fpadd16 %%f30, %%f56, %%f30 \n\t"\
-\
-        "fmul8sux16 %%f8, %%f38, %%f48 \n\t"\
-        "fmul8sux16 %%f10, %%f40, %%f50 \n\t"\
-        "fmul8sux16 %%f10, %%f32, %%f52 \n\t"\
-        "fmul8sux16 %%f10, %%f44, %%f54 \n\t"\
-        "fmul8sux16 %%f10, %%f36, %%f56 \n\t"\
-\
-        "fpadd16 %%f16, %%f48, %%f16 \n\t"\
-        "fpsub16 %%f20, %%f48, %%f20 \n\t"\
-        "fpsub16 %%f24, %%f48, %%f24 \n\t"\
-        "fpadd16 %%f28, %%f48, %%f28 \n\t"\
-        "fpadd16 %%f18, %%f50, %%f18 \n\t"\
-        "fpsub16 %%f22, %%f52, %%f22 \n\t"\
-        "fpadd16 %%f26, %%f54, %%f26 \n\t"\
-        "fpadd16 %%f30, %%f56, %%f30 \n\t"\
-\
-        "fpadd16 %%f16, %%f8, %%f16  \n\t"\
-        "fpsub16 %%f20, %%f8, %%f20  \n\t"\
-        "fpsub16 %%f24, %%f8, %%f24  \n\t"\
-        "fpadd16 %%f28, %%f8, %%f28  \n\t"\
-        "fpadd16 %%f18, %%f10, %%f18 \n\t"\
-        "fpsub16 %%f22, %%f10, %%f22 \n\t"\
-    /* 4. column */\
-        "4:                             \n\t"\
-        "fbe %%fcc2, 5f                 \n\t"\
-        "fpadd16 %%f30, %%f10, %%f30    \n\t"\
-        "fmul8ulx16 %%f12, %%f42, %%f48 \n\t"\
-        "fmul8ulx16 %%f12, %%f34, %%f50 \n\t"\
-        "fmul8ulx16 %%f14, %%f44, %%f52 \n\t"\
-        "fmul8ulx16 %%f14, %%f40, %%f54 \n\t"\
-        "fmul8ulx16 %%f14, %%f36, %%f56 \n\t"\
-        "fmul8ulx16 %%f14, %%f32, %%f58 \n\t"\
-\
-        "fpadd16 %%f16, %%f48, %%f16 \n\t"\
-        "fpsub16 %%f20, %%f50, %%f20 \n\t"\
-        "fpadd16 %%f24, %%f50, %%f24 \n\t"\
-        "fpsub16 %%f28, %%f48, %%f28 \n\t"\
-        "fpadd16 %%f18, %%f52, %%f18 \n\t"\
-        "fpsub16 %%f22, %%f54, %%f22 \n\t"\
-        "fpadd16 %%f26, %%f56, %%f26 \n\t"\
-        "fpsub16 %%f30, %%f58, %%f30 \n\t"\
-\
-        "fmul8sux16 %%f12, %%f42, %%f48 \n\t"\
-        "fmul8sux16 %%f12, %%f34, %%f50 \n\t"\
-        "fmul8sux16 %%f14, %%f44, %%f52 \n\t"\
-        "fmul8sux16 %%f14, %%f40, %%f54 \n\t"\
-        "fmul8sux16 %%f14, %%f36, %%f56 \n\t"\
-        "fmul8sux16 %%f14, %%f32, %%f58 \n\t"\
-\
-        "fpadd16 %%f16, %%f48, %%f16 \n\t"\
-        "fpsub16 %%f20, %%f50, %%f20 \n\t"\
-        "fpadd16 %%f24, %%f50, %%f24 \n\t"\
-        "fpsub16 %%f28, %%f48, %%f28 \n\t"\
-        "fpadd16 %%f18, %%f52, %%f18 \n\t"\
-        "fpsub16 %%f22, %%f54, %%f22 \n\t"\
-        "fpadd16 %%f26, %%f56, %%f26 \n\t"\
-        "fpsub16 %%f30, %%f58, %%f30 \n\t"\
-\
-        "fpsub16 %%f20, %%f12, %%f20 \n\t"\
-        "fpadd16 %%f24, %%f12, %%f24 \n\t"\
-        "fpsub16 %%f22, %%f14, %%f22 \n\t"\
-        "fpadd16 %%f26, %%f14, %%f26 \n\t"\
-        "fpsub16 %%f30, %%f14, %%f30 \n\t"\
-    /* final butterfly */\
-        "5:                          \n\t"\
-        "fpsub16 %%f16, %%f18, %%f48 \n\t"\
-        "fpsub16 %%f20, %%f22, %%f50 \n\t"\
-        "fpsub16 %%f24, %%f26, %%f52 \n\t"\
-        "fpsub16 %%f28, %%f30, %%f54 \n\t"\
-        "fpadd16 %%f16, %%f18, %%f16 \n\t"\
-        "fpadd16 %%f20, %%f22, %%f20 \n\t"\
-        "fpadd16 %%f24, %%f26, %%f24 \n\t"\
-        "fpadd16 %%f28, %%f30, %%f28 \n\t"\
-
-#define STOREROWS(out) \
-        "std %%f48, [" out "+112]          \n\t"\
-        "std %%f50, [" out "+96]           \n\t"\
-        "std %%f52, [" out "+80]           \n\t"\
-        "std %%f54, [" out "+64]           \n\t"\
-        "std %%f16, [" out "]              \n\t"\
-        "std %%f20, [" out "+16]           \n\t"\
-        "std %%f24, [" out "+32]           \n\t"\
-        "std %%f28, [" out "+48]           \n\t"\
-
-#define SCALEROWS \
-        "fmul8sux16 %%f46, %%f48, %%f48 \n\t"\
-        "fmul8sux16 %%f46, %%f50, %%f50 \n\t"\
-        "fmul8sux16 %%f46, %%f52, %%f52 \n\t"\
-        "fmul8sux16 %%f46, %%f54, %%f54 \n\t"\
-        "fmul8sux16 %%f46, %%f16, %%f16 \n\t"\
-        "fmul8sux16 %%f46, %%f20, %%f20 \n\t"\
-        "fmul8sux16 %%f46, %%f24, %%f24 \n\t"\
-        "fmul8sux16 %%f46, %%f28, %%f28 \n\t"\
-
-#define PUTPIXELSCLAMPED(dest) \
-        "fpack16 %%f48, %%f14 \n\t"\
-        "fpack16 %%f50, %%f12 \n\t"\
-        "fpack16 %%f16, %%f0  \n\t"\
-        "fpack16 %%f20, %%f2  \n\t"\
-        "fpack16 %%f24, %%f4  \n\t"\
-        "fpack16 %%f28, %%f6  \n\t"\
-        "fpack16 %%f54, %%f8  \n\t"\
-        "fpack16 %%f52, %%f10 \n\t"\
-        "st %%f0, [%3+" dest "]   \n\t"\
-        "st %%f2, [%5+" dest "]   \n\t"\
-        "st %%f4, [%6+" dest "]   \n\t"\
-        "st %%f6, [%7+" dest "]   \n\t"\
-        "st %%f8, [%8+" dest "]   \n\t"\
-        "st %%f10, [%9+" dest "]  \n\t"\
-        "st %%f12, [%10+" dest "] \n\t"\
-        "st %%f14, [%11+" dest "] \n\t"\
-
-#define ADDPIXELSCLAMPED(dest) \
-        "ldd [%5], %%f18         \n\t"\
-        "ld [%3+" dest"], %%f0   \n\t"\
-        "ld [%6+" dest"], %%f2   \n\t"\
-        "ld [%7+" dest"], %%f4   \n\t"\
-        "ld [%8+" dest"], %%f6   \n\t"\
-        "ld [%9+" dest"], %%f8   \n\t"\
-        "ld [%10+" dest"], %%f10 \n\t"\
-        "ld [%11+" dest"], %%f12 \n\t"\
-        "ld [%12+" dest"], %%f14 \n\t"\
-        "fmul8x16 %%f0, %%f18, %%f0   \n\t"\
-        "fmul8x16 %%f2, %%f18, %%f2   \n\t"\
-        "fmul8x16 %%f4, %%f18, %%f4   \n\t"\
-        "fmul8x16 %%f6, %%f18, %%f6   \n\t"\
-        "fmul8x16 %%f8, %%f18, %%f8   \n\t"\
-        "fmul8x16 %%f10, %%f18, %%f10 \n\t"\
-        "fmul8x16 %%f12, %%f18, %%f12 \n\t"\
-        "fmul8x16 %%f14, %%f18, %%f14 \n\t"\
-        "fpadd16 %%f0, %%f16, %%f0    \n\t"\
-        "fpadd16 %%f2, %%f20, %%f2    \n\t"\
-        "fpadd16 %%f4, %%f24, %%f4    \n\t"\
-        "fpadd16 %%f6, %%f28, %%f6    \n\t"\
-        "fpadd16 %%f8, %%f54, %%f8    \n\t"\
-        "fpadd16 %%f10, %%f52, %%f10  \n\t"\
-        "fpadd16 %%f12, %%f50, %%f12  \n\t"\
-        "fpadd16 %%f14, %%f48, %%f14  \n\t"\
-        "fpack16 %%f0, %%f0   \n\t"\
-        "fpack16 %%f2, %%f2   \n\t"\
-        "fpack16 %%f4, %%f4   \n\t"\
-        "fpack16 %%f6, %%f6   \n\t"\
-        "fpack16 %%f8, %%f8   \n\t"\
-        "fpack16 %%f10, %%f10 \n\t"\
-        "fpack16 %%f12, %%f12 \n\t"\
-        "fpack16 %%f14, %%f14 \n\t"\
-        "st %%f0, [%3+" dest "]   \n\t"\
-        "st %%f2, [%6+" dest "]   \n\t"\
-        "st %%f4, [%7+" dest "]   \n\t"\
-        "st %%f6, [%8+" dest "]   \n\t"\
-        "st %%f8, [%9+" dest "]   \n\t"\
-        "st %%f10, [%10+" dest "] \n\t"\
-        "st %%f12, [%11+" dest "] \n\t"\
-        "st %%f14, [%12+" dest "] \n\t"\
-
-
-void ff_simple_idct_vis(DCTELEM *data) {
-    int out1, out2, out3, out4;
-    DECLARE_ALIGNED(8, int16_t, temp)[8*8];
-
-    __asm__ volatile(
-        INIT_IDCT
-
-#define ADDROUNDER
-
-        // shift right 16-4=12
-        LOADSCALE("%2+8")
-        IDCT4ROWS
-        STOREROWS("%3+8")
-        LOADSCALE("%2+0")
-        IDCT4ROWS
-        "std %%f48, [%3+112] \n\t"
-        "std %%f50, [%3+96]  \n\t"
-        "std %%f52, [%3+80]  \n\t"
-        "std %%f54, [%3+64]  \n\t"
-
-        // shift right 16+4
-        "ldd [%3+8], %%f18  \n\t"
-        "ldd [%3+24], %%f22 \n\t"
-        "ldd [%3+40], %%f26 \n\t"
-        "ldd [%3+56], %%f30 \n\t"
-        TRANSPOSE
-        IDCT4ROWS
-        SCALEROWS
-        STOREROWS("%2+0")
-        LOAD("%3+64")
-        TRANSPOSE
-        IDCT4ROWS
-        SCALEROWS
-        STOREROWS("%2+8")
-
-        : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4)
-        : "0" (scale), "1" (coeffs), "2" (data), "3" (temp)
-    );
-}
-
-void ff_simple_idct_put_vis(uint8_t *dest, int line_size, DCTELEM *data) {
-    int out1, out2, out3, out4, out5;
-    int r1, r2, r3, r4, r5, r6, r7;
-
-    __asm__ volatile(
-        "wr %%g0, 0x8, %%gsr \n\t"
-
-        INIT_IDCT
-
-        "add %3, %4, %5   \n\t"
-        "add %5, %4, %6   \n\t"
-        "add %6, %4, %7   \n\t"
-        "add %7, %4, %8   \n\t"
-        "add %8, %4, %9   \n\t"
-        "add %9, %4, %10  \n\t"
-        "add %10, %4, %11 \n\t"
-
-        // shift right 16-4=12
-        LOADSCALE("%2+8")
-        IDCT4ROWS
-        STOREROWS("%2+8")
-        LOADSCALE("%2+0")
-        IDCT4ROWS
-        "std %%f48, [%2+112] \n\t"
-        "std %%f50, [%2+96]  \n\t"
-        "std %%f52, [%2+80]  \n\t"
-        "std %%f54, [%2+64]  \n\t"
-
-#undef ADDROUNDER
-#define ADDROUNDER "fpadd16 %%f28, %%f46, %%f28 \n\t"
-
-        // shift right 16+4
-        "ldd [%2+8], %%f18  \n\t"
-        "ldd [%2+24], %%f22 \n\t"
-        "ldd [%2+40], %%f26 \n\t"
-        "ldd [%2+56], %%f30 \n\t"
-        TRANSPOSE
-        IDCT4ROWS
-        PUTPIXELSCLAMPED("0")
-        LOAD("%2+64")
-        TRANSPOSE
-        IDCT4ROWS
-        PUTPIXELSCLAMPED("4")
-
-        : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5),
-          "=r" (r1), "=r" (r2), "=r" (r3), "=r" (r4), "=r" (r5), "=r" (r6), "=r" (r7)
-        : "0" (rounder), "1" (coeffs), "2" (data), "3" (dest), "4" (line_size)
-    );
-}
-
-void ff_simple_idct_add_vis(uint8_t *dest, int line_size, DCTELEM *data) {
-    int out1, out2, out3, out4, out5, out6;
-    int r1, r2, r3, r4, r5, r6, r7;
-
-    __asm__ volatile(
-        "wr %%g0, 0x8, %%gsr \n\t"
-
-        INIT_IDCT
-
-        "add %3, %4, %6   \n\t"
-        "add %6, %4, %7   \n\t"
-        "add %7, %4, %8   \n\t"
-        "add %8, %4, %9   \n\t"
-        "add %9, %4, %10  \n\t"
-        "add %10, %4, %11 \n\t"
-        "add %11, %4, %12 \n\t"
-
-#undef ADDROUNDER
-#define ADDROUNDER
-
-        // shift right 16-4=12
-        LOADSCALE("%2+8")
-        IDCT4ROWS
-        STOREROWS("%2+8")
-        LOADSCALE("%2+0")
-        IDCT4ROWS
-        "std %%f48, [%2+112] \n\t"
-        "std %%f50, [%2+96]  \n\t"
-        "std %%f52, [%2+80]  \n\t"
-        "std %%f54, [%2+64]  \n\t"
-
-#undef ADDROUNDER
-#define ADDROUNDER "fpadd16 %%f28, %%f46, %%f28 \n\t"
-
-        // shift right 16+4
-        "ldd [%2+8], %%f18  \n\t"
-        "ldd [%2+24], %%f22 \n\t"
-        "ldd [%2+40], %%f26 \n\t"
-        "ldd [%2+56], %%f30 \n\t"
-        TRANSPOSE
-        IDCT4ROWS
-        ADDPIXELSCLAMPED("0")
-        LOAD("%2+64")
-        TRANSPOSE
-        IDCT4ROWS
-        ADDPIXELSCLAMPED("4")
-
-        : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6),
-          "=r" (r1), "=r" (r2), "=r" (r3), "=r" (r4), "=r" (r5), "=r" (r6), "=r" (r7)
-        : "0" (rounder), "1" (coeffs), "2" (data), "3" (dest), "4" (line_size), "5" (expand)
-    );
-}
diff --git a/libavcodec/sparc/vis.h b/libavcodec/sparc/vis.h
deleted file mode 100644
index adee91b..0000000
--- a/libavcodec/sparc/vis.h
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Copyright (C) 2003 David S. Miller <davem at redhat.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* You may be asking why I hard-code the instruction opcodes and don't
- * use the normal VIS assembler mnenomics for the VIS instructions.
- *
- * The reason is that Sun, in their infinite wisdom, decided that a binary
- * using a VIS instruction will cause it to be marked (in the ELF headers)
- * as doing so, and this prevents the OS from loading such binaries if the
- * current cpu doesn't have VIS.  There is no way to easily override this
- * behavior of the assembler that I am aware of.
- *
- * This totally defeats what libmpeg2 is trying to do which is allow a
- * single binary to be created, and then detect the availability of VIS
- * at runtime.
- *
- * I'm not saying that tainting the binary by default is bad, rather I'm
- * saying that not providing a way to override this easily unnecessarily
- * ties people's hands.
- *
- * Thus, we do the opcode encoding by hand and output 32-bit words in
- * the assembler to keep the binary from becoming tainted.
- */
-
-#ifndef AVCODEC_SPARC_VIS_H
-#define AVCODEC_SPARC_VIS_H
-
-#define vis_opc_base    ((0x1 << 31) | (0x36 << 19))
-#define vis_opf(X)      ((X) << 5)
-#define vis_sreg(X)     (X)
-#define vis_dreg(X)     (((X)&0x1f)|((X)>>5))
-#define vis_rs1_s(X)    (vis_sreg(X) << 14)
-#define vis_rs1_d(X)    (vis_dreg(X) << 14)
-#define vis_rs2_s(X)    (vis_sreg(X) << 0)
-#define vis_rs2_d(X)    (vis_dreg(X) << 0)
-#define vis_rd_s(X)     (vis_sreg(X) << 25)
-#define vis_rd_d(X)     (vis_dreg(X) << 25)
-
-#define vis_ss2s(opf,rs1,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs1_s(rs1) | \
-                                       vis_rs2_s(rs2) | \
-                                       vis_rd_s(rd)))
-
-#define vis_dd2d(opf,rs1,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs1_d(rs1) | \
-                                       vis_rs2_d(rs2) | \
-                                       vis_rd_d(rd)))
-
-#define vis_ss2d(opf,rs1,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs1_s(rs1) | \
-                                       vis_rs2_s(rs2) | \
-                                       vis_rd_d(rd)))
-
-#define vis_sd2d(opf,rs1,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs1_s(rs1) | \
-                                       vis_rs2_d(rs2) | \
-                                       vis_rd_d(rd)))
-
-#define vis_d2s(opf,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs2_d(rs2) | \
-                                       vis_rd_s(rd)))
-
-#define vis_s2d(opf,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs2_s(rs2) | \
-                                       vis_rd_d(rd)))
-
-#define vis_d12d(opf,rs1,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs1_d(rs1) | \
-                                       vis_rd_d(rd)))
-
-#define vis_d22d(opf,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs2_d(rs2) | \
-                                       vis_rd_d(rd)))
-
-#define vis_s12s(opf,rs1,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs1_s(rs1) | \
-                                       vis_rd_s(rd)))
-
-#define vis_s22s(opf,rs2,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rs2_s(rs2) | \
-                                       vis_rd_s(rd)))
-
-#define vis_s(opf,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rd_s(rd)))
-
-#define vis_d(opf,rd) \
-        __asm__ volatile (".word %0" \
-                              : : "i" (vis_opc_base | vis_opf(opf) | \
-                                       vis_rd_d(rd)))
-
-#define vis_r2m(op,rd,mem) \
-        __asm__ volatile (#op "\t%%f" #rd ", [%0]" : : "r" (&(mem)) )
-
-#define vis_r2m_2(op,rd,mem1,mem2) \
-        __asm__ volatile (#op "\t%%f" #rd ", [%0 + %1]" : : "r" (mem1), "r" (mem2) )
-
-#define vis_m2r(op,mem,rd) \
-        __asm__ volatile (#op "\t[%0], %%f" #rd : : "r" (&(mem)) )
-
-#define vis_m2r_2(op,mem1,mem2,rd) \
-        __asm__ volatile (#op "\t[%0 + %1], %%f" #rd : : "r" (mem1), "r" (mem2) )
-
-static inline void vis_set_gsr(unsigned int _val)
-{
-        register unsigned int val __asm__("g1");
-
-        val = _val;
-        __asm__ volatile(".word 0xa7804000"
-                             : : "r" (val));
-}
-
-#define VIS_GSR_ALIGNADDR_MASK          0x0000007
-#define VIS_GSR_ALIGNADDR_SHIFT         0
-#define VIS_GSR_SCALEFACT_MASK          0x0000078
-#define VIS_GSR_SCALEFACT_SHIFT         3
-
-#define vis_ld32(mem,rs1)               vis_m2r(ld, mem, rs1)
-#define vis_ld32_2(mem1,mem2,rs1)       vis_m2r_2(ld, mem1, mem2, rs1)
-#define vis_st32(rs1,mem)               vis_r2m(st, rs1, mem)
-#define vis_st32_2(rs1,mem1,mem2)       vis_r2m_2(st, rs1, mem1, mem2)
-#define vis_ld64(mem,rs1)               vis_m2r(ldd, mem, rs1)
-#define vis_ld64_2(mem1,mem2,rs1)       vis_m2r_2(ldd, mem1, mem2, rs1)
-#define vis_st64(rs1,mem)               vis_r2m(std, rs1, mem)
-#define vis_st64_2(rs1,mem1,mem2)       vis_r2m_2(std, rs1, mem1, mem2)
-
-#define vis_ldblk(mem, rd) \
-do {        register void *__mem __asm__("g1"); \
-        __mem = &(mem); \
-        __asm__ volatile(".word 0xc1985e00 | %1" \
-                             : \
-                             : "r" (__mem), \
-                               "i" (vis_rd_d(rd)) \
-                             : "memory"); \
-} while (0)
-
-#define vis_stblk(rd, mem) \
-do {        register void *__mem __asm__("g1"); \
-        __mem = &(mem); \
-        __asm__ volatile(".word 0xc1b85e00 | %1" \
-                             : \
-                             : "r" (__mem), \
-                               "i" (vis_rd_d(rd)) \
-                             : "memory"); \
-} while (0)
-
-#define vis_membar_storestore()        \
-        __asm__ volatile(".word 0x8143e008" : : : "memory")
-
-#define vis_membar_sync()        \
-        __asm__ volatile(".word 0x8143e040" : : : "memory")
-
-/* 16 and 32 bit partitioned addition and subtraction.  The normal
- * versions perform 4 16-bit or 2 32-bit additions or subtractions.
- * The 's' versions perform 2 16-bit or 1 32-bit additions or
- * subtractions.
- */
-
-#define vis_padd16(rs1,rs2,rd)          vis_dd2d(0x50, rs1, rs2, rd)
-#define vis_padd16s(rs1,rs2,rd)         vis_ss2s(0x51, rs1, rs2, rd)
-#define vis_padd32(rs1,rs2,rd)          vis_dd2d(0x52, rs1, rs2, rd)
-#define vis_padd32s(rs1,rs2,rd)         vis_ss2s(0x53, rs1, rs2, rd)
-#define vis_psub16(rs1,rs2,rd)          vis_dd2d(0x54, rs1, rs2, rd)
-#define vis_psub16s(rs1,rs2,rd)         vis_ss2s(0x55, rs1, rs2, rd)
-#define vis_psub32(rs1,rs2,rd)          vis_dd2d(0x56, rs1, rs2, rd)
-#define vis_psub32s(rs1,rs2,rd)         vis_ss2s(0x57, rs1, rs2, rd)
-
-/* Pixel formatting instructions.  */
-
-#define vis_pack16(rs2,rd)              vis_d2s( 0x3b,      rs2, rd)
-#define vis_pack32(rs1,rs2,rd)          vis_dd2d(0x3a, rs1, rs2, rd)
-#define vis_packfix(rs2,rd)             vis_d2s( 0x3d,      rs2, rd)
-#define vis_expand(rs2,rd)              vis_s2d( 0x4d,      rs2, rd)
-#define vis_pmerge(rs1,rs2,rd)          vis_ss2d(0x4b, rs1, rs2, rd)
-
-/* Partitioned multiply instructions.  */
-
-#define vis_mul8x16(rs1,rs2,rd)         vis_sd2d(0x31, rs1, rs2, rd)
-#define vis_mul8x16au(rs1,rs2,rd)       vis_ss2d(0x33, rs1, rs2, rd)
-#define vis_mul8x16al(rs1,rs2,rd)       vis_ss2d(0x35, rs1, rs2, rd)
-#define vis_mul8sux16(rs1,rs2,rd)       vis_dd2d(0x36, rs1, rs2, rd)
-#define vis_mul8ulx16(rs1,rs2,rd)       vis_dd2d(0x37, rs1, rs2, rd)
-#define vis_muld8sux16(rs1,rs2,rd)      vis_ss2d(0x38, rs1, rs2, rd)
-#define vis_muld8ulx16(rs1,rs2,rd)      vis_ss2d(0x39, rs1, rs2, rd)
-
-/* Alignment instructions.  */
-
-static inline const void *vis_alignaddr(const void *_ptr)
-{
-        register const void *ptr __asm__("g1");
-
-        ptr = _ptr;
-
-        __asm__ volatile(".word %2"
-                             : "=&r" (ptr)
-                             : "0" (ptr),
-                               "i" (vis_opc_base | vis_opf(0x18) |
-                                    vis_rs1_s(1) |
-                                    vis_rs2_s(0) |
-                                    vis_rd_s(1)));
-
-        return ptr;
-}
-
-static inline void vis_alignaddr_g0(void *_ptr)
-{
-        register void *ptr __asm__("g1");
-
-        ptr = _ptr;
-
-        __asm__ volatile(".word %2"
-                             : "=&r" (ptr)
-                             : "0" (ptr),
-                               "i" (vis_opc_base | vis_opf(0x18) |
-                                    vis_rs1_s(1) |
-                                    vis_rs2_s(0) |
-                                    vis_rd_s(0)));
-}
-
-static inline void *vis_alignaddrl(void *_ptr)
-{
-        register void *ptr __asm__("g1");
-
-        ptr = _ptr;
-
-        __asm__ volatile(".word %2"
-                             : "=&r" (ptr)
-                             : "0" (ptr),
-                               "i" (vis_opc_base | vis_opf(0x19) |
-                                    vis_rs1_s(1) |
-                                    vis_rs2_s(0) |
-                                    vis_rd_s(1)));
-
-        return ptr;
-}
-
-static inline void vis_alignaddrl_g0(void *_ptr)
-{
-        register void *ptr __asm__("g1");
-
-        ptr = _ptr;
-
-        __asm__ volatile(".word %2"
-                             : "=&r" (ptr)
-                             : "0" (ptr),
-                               "i" (vis_opc_base | vis_opf(0x19) |
-                                    vis_rs1_s(1) |
-                                    vis_rs2_s(0) |
-                                    vis_rd_s(0)));
-}
-
-#define vis_faligndata(rs1,rs2,rd)        vis_dd2d(0x48, rs1, rs2, rd)
-
-/* Logical operate instructions.  */
-
-#define vis_fzero(rd)                   vis_d(   0x60,           rd)
-#define vis_fzeros(rd)                  vis_s(   0x61,           rd)
-#define vis_fone(rd)                    vis_d(   0x7e,           rd)
-#define vis_fones(rd)                   vis_s(   0x7f,           rd)
-#define vis_src1(rs1,rd)                vis_d12d(0x74, rs1,      rd)
-#define vis_src1s(rs1,rd)               vis_s12s(0x75, rs1,      rd)
-#define vis_src2(rs2,rd)                vis_d22d(0x78,      rs2, rd)
-#define vis_src2s(rs2,rd)               vis_s22s(0x79,      rs2, rd)
-#define vis_not1(rs1,rd)                vis_d12d(0x6a, rs1,      rd)
-#define vis_not1s(rs1,rd)               vis_s12s(0x6b, rs1,      rd)
-#define vis_not2(rs2,rd)                vis_d22d(0x66,      rs2, rd)
-#define vis_not2s(rs2,rd)               vis_s22s(0x67,      rs2, rd)
-#define vis_or(rs1,rs2,rd)              vis_dd2d(0x7c, rs1, rs2, rd)
-#define vis_ors(rs1,rs2,rd)             vis_ss2s(0x7d, rs1, rs2, rd)
-#define vis_nor(rs1,rs2,rd)             vis_dd2d(0x62, rs1, rs2, rd)
-#define vis_nors(rs1,rs2,rd)            vis_ss2s(0x63, rs1, rs2, rd)
-#define vis_and(rs1,rs2,rd)             vis_dd2d(0x70, rs1, rs2, rd)
-#define vis_ands(rs1,rs2,rd)            vis_ss2s(0x71, rs1, rs2, rd)
-#define vis_nand(rs1,rs2,rd)            vis_dd2d(0x6e, rs1, rs2, rd)
-#define vis_nands(rs1,rs2,rd)           vis_ss2s(0x6f, rs1, rs2, rd)
-#define vis_xor(rs1,rs2,rd)             vis_dd2d(0x6c, rs1, rs2, rd)
-#define vis_xors(rs1,rs2,rd)            vis_ss2s(0x6d, rs1, rs2, rd)
-#define vis_xnor(rs1,rs2,rd)            vis_dd2d(0x72, rs1, rs2, rd)
-#define vis_xnors(rs1,rs2,rd)           vis_ss2s(0x73, rs1, rs2, rd)
-#define vis_ornot1(rs1,rs2,rd)          vis_dd2d(0x7a, rs1, rs2, rd)
-#define vis_ornot1s(rs1,rs2,rd)         vis_ss2s(0x7b, rs1, rs2, rd)
-#define vis_ornot2(rs1,rs2,rd)          vis_dd2d(0x76, rs1, rs2, rd)
-#define vis_ornot2s(rs1,rs2,rd)         vis_ss2s(0x77, rs1, rs2, rd)
-#define vis_andnot1(rs1,rs2,rd)         vis_dd2d(0x68, rs1, rs2, rd)
-#define vis_andnot1s(rs1,rs2,rd)        vis_ss2s(0x69, rs1, rs2, rd)
-#define vis_andnot2(rs1,rs2,rd)         vis_dd2d(0x64, rs1, rs2, rd)
-#define vis_andnot2s(rs1,rs2,rd)        vis_ss2s(0x65, rs1, rs2, rd)
-
-/* Pixel component distance.  */
-
-#define vis_pdist(rs1,rs2,rd)           vis_dd2d(0x3e, rs1, rs2, rd)
-
-#endif /* AVCODEC_SPARC_VIS_H */
diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
deleted file mode 100644
index 456ab85..0000000
--- a/libavcodec/sunrast.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Sun Rasterfile (.sun/.ras/im{1,8,24}/.sunras) image decoder
- * Copyright (c) 2007, 2008 Ivo van Poorten
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#define RT_OLD          0
-#define RT_STANDARD     1
-#define RT_BYTE_ENCODED 2
-#define RT_FORMAT_RGB   3
-#define RT_FORMAT_TIFF  4
-#define RT_FORMAT_IFF   5
-
-typedef struct SUNRASTContext {
-    AVFrame picture;
-} SUNRASTContext;
-
-static av_cold int sunrast_init(AVCodecContext *avctx) {
-    SUNRASTContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame= &s->picture;
-
-    return 0;
-}
-
-static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
-                                int *data_size, AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    SUNRASTContext * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p = &s->picture;
-    unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen;
-    uint8_t *ptr;
-    const uint8_t *bufstart = buf;
-
-    if (AV_RB32(buf) != 0x59a66a95) {
-        av_log(avctx, AV_LOG_ERROR, "this is not sunras encoded data\n");
-        return -1;
-    }
-
-    w         = AV_RB32(buf+4);
-    h         = AV_RB32(buf+8);
-    depth     = AV_RB32(buf+12);
-    type      = AV_RB32(buf+20);
-    maptype   = AV_RB32(buf+24);
-    maplength = AV_RB32(buf+28);
-
-    if (type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF) {
-        av_log(avctx, AV_LOG_ERROR, "unsupported (compression) type\n");
-        return -1;
-    }
-    if (type > RT_FORMAT_IFF) {
-        av_log(avctx, AV_LOG_ERROR, "invalid (compression) type\n");
-        return -1;
-    }
-    if (maptype & ~1) {
-        av_log(avctx, AV_LOG_ERROR, "invalid colormap type\n");
-        return -1;
-    }
-
-    buf += 32;
-
-    switch (depth) {
-        case 1:
-            avctx->pix_fmt = PIX_FMT_MONOWHITE;
-            break;
-        case 8:
-            avctx->pix_fmt = PIX_FMT_PAL8;
-            break;
-        case 24:
-            avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "invalid depth\n");
-            return -1;
-    }
-
-    if (p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    if (avcodec_check_dimensions(avctx, w, h))
-        return -1;
-    if (w != avctx->width || h != avctx->height)
-        avcodec_set_dimensions(avctx, w, h);
-    if (avctx->get_buffer(avctx, p) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    p->pict_type = FF_I_TYPE;
-
-    if (depth != 8 && maplength) {
-        av_log(avctx, AV_LOG_WARNING, "useless colormap found or file is corrupted, trying to recover\n");
-
-    } else if (depth == 8) {
-        unsigned int len = maplength / 3;
-
-        if (!maplength) {
-            av_log(avctx, AV_LOG_ERROR, "colormap expected\n");
-            return -1;
-        }
-        if (maplength % 3 || maplength > 768) {
-            av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
-            return -1;
-        }
-
-        ptr = p->data[1];
-        for (x=0; x<len; x++, ptr+=4)
-            *(uint32_t *)ptr = (buf[x]<<16) + (buf[len+x]<<8) + buf[len+len+x];
-    }
-
-    buf += maplength;
-
-    ptr    = p->data[0];
-    stride = p->linesize[0];
-
-    /* scanlines are aligned on 16 bit boundaries */
-    len  = (depth * w + 7) >> 3;
-    alen = len + (len&1);
-
-    if (type == RT_BYTE_ENCODED) {
-        int value, run;
-        uint8_t *end = ptr + h*stride;
-
-        x = 0;
-        while (ptr != end) {
-            run = 1;
-            if ((value = *buf++) == 0x80) {
-                run = *buf++ + 1;
-                if (run != 1)
-                    value = *buf++;
-            }
-            while (run--) {
-                if (x < len)
-                    ptr[x] = value;
-                if (++x >= alen) {
-                    x = 0;
-                    ptr += stride;
-                    if (ptr == end)
-                        break;
-                }
-            }
-        }
-    } else {
-        for (y=0; y<h; y++) {
-            memcpy(ptr, buf, len);
-            ptr += stride;
-            buf += alen;
-        }
-    }
-
-    *picture = s->picture;
-    *data_size = sizeof(AVFrame);
-
-    return buf - bufstart;
-}
-
-static av_cold int sunrast_end(AVCodecContext *avctx) {
-    SUNRASTContext *s = avctx->priv_data;
-
-    if(s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-AVCodec sunrast_decoder = {
-    "sunrast",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SUNRAST,
-    sizeof(SUNRASTContext),
-    sunrast_init,
-    NULL,
-    sunrast_end,
-    sunrast_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
-};
diff --git a/libavcodec/svq1.c b/libavcodec/svq1.c
deleted file mode 100644
index d0e1132..0000000
--- a/libavcodec/svq1.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SVQ1 decoder
- * ported to MPlayer by Arpi <arpi at thot.banki.hu>
- * ported to libavcodec by Nick Kurshev <nickols_k at mail.ru>
- *
- * Copyright (C) 2002 the xine project
- * Copyright (C) 2002 the ffmpeg project
- *
- * SVQ1 Encoder (c) 2004 Mike Melanson <melanson at pcisys.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sorenson Vector Quantizer #1 (SVQ1) video codec.
- * For more information of the SVQ1 algorithm, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-#include "svq1.h"
-#include "svq1_cb.h"
-#include "svq1_vlc.h"
-
-/* standard video sizes */
-const struct svq1_frame_size ff_svq1_frame_size_table[7] = {
-  { 160, 120 }, { 128,  96 }, { 176, 144 }, { 352, 288 },
-  { 704, 576 }, { 240, 180 }, { 320, 240 }
-};
diff --git a/libavcodec/svq1.h b/libavcodec/svq1.h
deleted file mode 100644
index 3ade05d..0000000
--- a/libavcodec/svq1.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * SVQ1 decoder
- * ported to MPlayer by Arpi <arpi at thot.banki.hu>
- * ported to libavcodec by Nick Kurshev <nickols_k at mail.ru>
- *
- * Copyright (C) 2002 the xine project
- * Copyright (C) 2002 the ffmpeg project
- *
- * SVQ1 Encoder (c) 2004 Mike Melanson <melanson at pcisys.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sorenson Vector Quantizer #1 (SVQ1) video codec.
- * For more information of the SVQ1 algorithm, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-#ifndef AVCODEC_SVQ1_H
-#define AVCODEC_SVQ1_H
-
-#include <stdint.h>
-
-#define SVQ1_BLOCK_SKIP         0
-#define SVQ1_BLOCK_INTER        1
-#define SVQ1_BLOCK_INTER_4V     2
-#define SVQ1_BLOCK_INTRA        3
-
-struct svq1_frame_size {
-    uint16_t width;
-    uint16_t height;
-};
-
-uint16_t ff_svq1_packet_checksum (const uint8_t *data, const int length,
-                                  int value);
-
-extern const int8_t* const ff_svq1_inter_codebooks[6];
-extern const int8_t* const ff_svq1_intra_codebooks[6];
-
-extern const uint8_t ff_svq1_block_type_vlc[4][2];
-extern const uint8_t ff_svq1_intra_multistage_vlc[6][8][2];
-extern const uint8_t ff_svq1_inter_multistage_vlc[6][8][2];
-extern const uint16_t ff_svq1_intra_mean_vlc[256][2];
-extern const uint16_t ff_svq1_inter_mean_vlc[512][2];
-
-extern const struct svq1_frame_size ff_svq1_frame_size_table[7];
-
-#endif /* AVCODEC_SVQ1_H */
diff --git a/libavcodec/svq1_cb.h b/libavcodec/svq1_cb.h
deleted file mode 100644
index 7926ce1..0000000
--- a/libavcodec/svq1_cb.h
+++ /dev/null
@@ -1,1525 +0,0 @@
-/*
- * SVQ1 decoder
- * ported to MPlayer by Arpi <arpi at thot.banki.hu>
- * ported to libavcodec by Nick Kurshev <nickols_k at mail.ru>
- *
- * Copyright (C) 2002 the xine project
- * Copyright (C) 2002 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * svq1 code books.
- */
-
-#ifndef AVCODEC_SVQ1_CB_H
-#define AVCODEC_SVQ1_CB_H
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "libavutil/mem.h"
-
-/* 6x16-entry codebook for inter-coded 4x2 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x2)[768] = {
-    7,  2, -6, -7,  7,  3, -3, -4, -7, -2,  7,  8, -8, -4,  3,  4,
-   19, 17,  9,  3,-14,-16,-12, -8,-18,-16, -8, -3, 11, 14, 12,  8,
-    7,-16,-10, 20,  7,-17,-10, 20, -6, 18,  8,-21, -7, 18,  9,-20,
-   25,  3,-20,-14, 29,  7,-18,-13,-29, -4, 21, 14,-31, -6, 20, 14,
-  -19,-26,-28,-24, 31, 32, 22, 10, 15, 24, 31, 28,-32,-32,-22,-13,
-    2, -8,-23,-26, -9,  3, 27, 35,  3, 11, 21, 21,  8, -4,-27,-34,
-  -30,-31, 12, 47,-29,-30, 13, 47, 38, 30,-17,-46, 34, 26,-19,-46,
-  -42,-50,-51,-43, 34, 48, 55, 48, 48, 54, 51, 42,-44,-52,-53,-47,
-    4,  5,  0, -6, -2, -2,  0,  1,-11, -6, -1, -2,  1,  8,  9,  1,
-    0,  1, -6,  5,  8,  1,-12,  2,  7,-14, -7,  8,  5, -8,  0,  8,
-    1,  4, 11,  8,-12, -8,  0, -5, -1,  1,  0,  4,-15, -8,  3, 16,
-   17,  8, -4, -6,  9, -4,-13, -8,  2,  6,  1,-18, -1, 11, 11,-12,
-    6,  0,  2,  0, 14,  6, -7,-21,  1, -1,-13,-20,  1,  1, 10, 21,
-  -22, -5,  7, 13,-11, -1,  4, 12, -7,  0, 14, 19, -4,  3, -5,-19,
-  -26,-14, 10, 15, 18,  4, -6, -2, 25, 19, -5,-18,-20, -7,  4,  2,
-  -13, -6, -1, -4, 25, 37, -2,-35,  5,  4,  1,  1,-21,-36,  2, 43,
-    2, -2, -1,  3,  8, -2, -6, -1, -2, -3,  2, 12, -5, -2, -2, -1,
-   -3, -1, -1, -5, -1,  7,  8, -2,  2,  7,  5, -3,  1,  1, -3, -8,
-   -3, -1, -3, -2, -2, -3,  2, 13, 15,  0,-11, -6,  3,  0,  0,  0,
-   -6, -9, -5, -4, 18,  4,  1,  3, 12,  3,  0,  4,-16, -3,  3, -3,
-  -17,  3, 18,  2, -1, -3, -1, -1, -6, 16, -8,  0, -9, 14, -7,  0,
-    3,-13, 14, -5,  3,-13, 14, -4, -7, 20, 14,-23,  8, -7, -8,  4,
-    8,-15,-19, 16,-10, 13, 11, -3,  9, -1,  1, 26,  5,-15,-27,  2,
-  -20,  7, 16, -4,-40,  9, 31,  1, 26,-12,-30, -7, 40, -2,-19,  4,
-    6,  0,  0,  0, -6, -2,  1,  2,  0, -1,  0, -6,  9,  0, -2, -1,
-   -7,  8,  2, -3, -1,  2, -3,  2,  7, -4, -2,  4,  2,  0,  0, -6,
-   -3, -2,  9,  2, -2, -1,  0, -4, -3, -3,  0, -3, -6,  2, 10,  4,
-    3,  0,-10,  8,  0,  0, -4,  4, -1,  1,  4,  2,  3, -7, -9,  7,
-    2,  1, -9, -4, -1, 12,  0,  0,  3, -1,  7, -4,  3,-14,  4,  2,
-  -12, -9,  1, 11,  2,  5,  1,  0,  3,  1,  0,  2,  0,  8,  6,-19,
-   -6,-10, -7, -4,  9,  7,  5,  7,  6, 21,  3, -3,-11, -9, -5, -2,
-   -4, -9,-16, -1, -2, -5,  1, 36,  8, 11, 19,  0,  2,  5, -4,-41,
-   -1, -1, -2, -1, -2, -2,  1,  6,  0,  4,  1, -8,  1,  1,  1,  0,
-   -2, -3,  4,  0,  2, -1,  3, -3,  1,  3, -4,  1, -1,  3,  0, -5,
-    3,  4,  2,  3, -2, -3, -6, -1, -2, -3, -2,  2, -4,  8,  1,  0,
-   -7,  4,  2,  6, -7, -1,  1,  0, -2,  2, -4,  1,  8, -6,  2, -1,
-   -6,  2,  0,  2,  5,  4, -8, -1, -1,-11,  0,  9,  0, -2,  2,  2,
-   17, -5, -4, -1, -1, -4, -2, -2,  0,-13,  9, -3, -1, 12, -7,  2,
-    0, -2, -5,  2, -7, -5, 20, -3,  7,  7, -1,-30,  3,  5,  8,  1,
-   -6,  3, -1, -4,  2, -2,-11, 18,  0, -7,  3, 14, 20, -3,-18, -9,
-    7, -2,  0, -1, -2,  0,  0, -1, -4, -1,  1,  0, -2,  2,  0,  4,
-    1, -3,  2,  1,  3,  1, -5,  1, -3,  0, -1, -2,  7,  1,  0, -3,
-    2,  5,  0, -2,  2, -5, -1,  1, -1, -2,  4, -1,  0, -3,  5,  0,
-    0,  3, -1, -2, -4,  1,  5, -1, -1,  0, -1,  9, -1, -2, -1, -1,
-   -2,  5,  5, -1, -2,  2, -3, -2,  1,  2,-11,  1,  2,  1,  3,  2,
-    2,-10, -1, -2,  4,  2,  4,  1,  4,  5, -5,  1,  0,  6,-11,  1,
-    1,  0,  6,  6,  0,  2,  1,-15,  7,  3,  5,  9,-30,  2,  2,  2,
-  -34,  1,  9,  2,  5,  8,  8,  2,  7,  2,  6,  6,  2,-27,  1,  4
-};
-
-/* 6x16-entry codebook for inter-coded 4x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_4x4)[1536] = {
-    4,  0, -6, -7, -4, -8,-13, -9, -8, -8, -1,  6, -2,  5, 22, 27,
-  -16, -7, 11, 10,-18, -7, 13, 10,-15, -4, 12,  8, -9, -1,  9,  5,
-   -2,  2, 15,-16, -3,  2, 19,-19, -3,  2, 19,-19, -2,  3, 15,-14,
-   17, 22, 22, 16, -6, -7, -5, -2,-12,-16,-16,-12,  1,  1, -1, -3,
-   11,-17,  0,  8, 14,-21, -1,  9, 14,-21, -2,  8, 11,-16, -2,  6,
-    7, -2,-16, 11,  9, -2,-21, 14, 10, -1,-22, 14,  8, -1,-18, 10,
-  -10, 16,  3, -9,-13, 20,  4,-11,-14, 21,  4,-10,-11, 16,  3, -8,
-   11,  4, -9, -9, 15,  6,-12,-14, 17,  8,-12,-14, 16, 10, -7,-11,
-    4, 10, 14, 13, -1,  7, 15, 16,-12, -7,  3,  8,-20,-23,-18,-10,
-  -10,-18,-26,-25,  4,  1, -6,-11, 13, 15, 11,  3, 12, 15, 13,  8,
-  -16,-19,-16,-11,  7, 12, 15, 11, 11, 16, 16, 11, -6, -9,-11,-10,
-   18, 19, 12,  5, 18, 16,  5, -4,  6,  0,-10,-15, -9,-17,-23,-22,
-  -10,-14, -1, 21,-11,-17,  0, 29,-11,-16,  1, 30,-10,-14,  0, 23,
-  -16,-17,-12, -6,-19,-19,-14, -7, -3, -1,  1,  2, 27, 35, 29, 19,
-  -37, -8, 23, 23,-42, -9, 28, 29,-43,-10, 26, 28,-38,-11, 19, 22,
-   32, 16,-16,-33, 39, 20,-18,-37, 38, 19,-19,-38, 32, 15,-17,-34,
-   24,  9, -6, -4, -1,-10, -6,  3, -8, -9, -1,  3,  3,  7,  2, -6,
-   -1, -3, -1,  0, -1,  4,  2, -7, -3, 11,  3,-16,  1, 20,  9,-18,
-   -3, -8,  6, 12, -5,-10,  7, 13, -6, -9,  5,  7, -5, -5,  2, -1,
-   -8, 12, -3, -1,-10, 15, -3,  1,-11, 13, -4,  1,-11,  8, -3,  2,
-    9,  6, -5,-12,  3,  0, -8,-13, -4, -4, -1, -1, -4,  1, 15, 18,
-    9, 13, 14, 12,  4,  3, -1, -2, -2, -5, -8, -5, -7,-11, -9, -4,
-    7, -5, -7, -4, 14, -2, -7, -4, 17,  0, -8, -5, 15,  1, -7, -5,
-  -10, -1,  6,  4,-15, -9,  2,  4,  2, -1, -3,  0, 25, 13, -8,-10,
-    7, 11, -3,-16,  7, 11, -3,-15,  6,  7, -2, -9,  4,  2, -3, -5,
-   -7, -1, -1,  0, -9, -2,  2,  6,-12, -4,  6, 14,-13, -6,  8, 19,
-  -18,-18,-11, -5, -3,  0,  3,  4,  6,  8,  6,  6,  6,  6,  6,  6,
-   -5,  3, 13,-10, -6,  1, 15, -9, -6, -3, 15, -6, -6, -6, 10, -3,
-    9,  1, -9, -9, 11,  9,  6,  5,  0,  3,  8,  7,-15,-14, -6, -5,
-  -11, -6, 11, 19, -2, -5, -9, -8,  6,  2, -9,-10,  6,  5,  4,  5,
-   -7, -3,  8, 15, -1,  3, 10, 15,  5,  5, -1, -2,  4, -2,-21,-25,
-    6, -6, -6,  5,  8, -9, -7,  9,  8,-12, -7, 13,  4,-14, -7, 14,
-   -4, -3,  1,  1, -3, -5, -2, -3,  7,  0, -2, -4, 20,  7, -4, -4,
-   -3,-20, -6, 10,  6,  0,  0,  1,  5,  8,  5, -1, -3,  0,  0, -2,
-   13,  6, -1,  2,  5,  3,  2,  3, -3,  0,  3,  0,-16, -8, -2, -5,
-   -2, -7, -6,  0, -3, -6, -3,  1, -5, -1,  2, -1, -1, 12, 16,  5,
-   -7,  1,  9,  8,-10, -2,  5,  3, -6,  2,  7,  3, -4,  0, -1, -7,
-    3,  4, -9,-24,  0,  2,  6,  3, -1, -1,  4,  7,  5,  3, -1, -2,
-    3,  6, -9,  2,  1,  6,-13,  1,  1,  8,-10,  2,  1,  8, -7,  1,
-   -3, -3,  2, 22, -2, -3, -5, 12, -2, -3,-10,  2, -3, -1, -4,  2,
-   11, 12,  8,  2, -5, -5, -5, -8, -6, -4,  0, -3, -2, -1,  3,  3,
-   12, -6, -2, -1, 12, -8, -2, -2,  9, -7,  0, -3,  4, -6,  2, -2,
-  -19,  1, 12, -3, -4,  4,  5, -4,  6,  1, -2, -1,  4, -4, -2,  7,
-   -3, -4, -7, -8, -4, -4, -2,  0, -1,  2, 14, 16, -4, -2,  4,  4,
-   -1,  7,  2, -5, -2,  0, -1,  1,  4, -3, -1, 13,  6,-12,-14,  8,
-   -1,  5,  4, -5, -2,  5,  3, -9, -2,  7,  4,-12, -1,  7,  4, -9,
-   -6, -3,  1,  1, 11, 11,  0, -6,  6,  4, -2, -7,-12,-10,  3, 10,
-   -2, -3, -3, -2,  6, 11, 14, 10, -9,-11,-10,-10,  2,  2,  3,  2,
-   -7, -5, -7, -1, -1,  2,  0,  7, -1,  1,  0,  9,  3,  4, -5, -1,
-   10, -1,-15, -1,  4,  1, -5,  2, -3,  1, -1,  1, -3,  1,  4,  4,
-    2, -1,  4, 10,  6,  2, -1,  0,  2,  2, -7,-12, -4,  2,  0, -3,
-   -1, -4, -1, -8,  3, -1,  2, -9,  4,  0,  5, -5,  2,  0,  8,  3,
-    3,  2,  1,  1,  4, -2,  0,  3,  2, -1,  4,  1,  0,  6, -1,-25,
-   -1, -2, -2, -4, -3,  0, -1, -4, -1, -1, -4,  2,  0, -6,  2, 25,
-  -11, -1,  5,  0,  7,  0, -2,  2, 10, -1, -3,  4, -5, -5, -2, -1,
-    0,  6,  3, -1, -2, -1, -1,  1, -1, -7,-12, -5,  8,  6,  2,  4,
-    2,  6, -1, -6,  9, 10, -1, -4,  1,  0, -4,  0,  3, -2, -9, -5,
-   -4,  3,  4,  0, -4,  3,  3,  0,-11,  0,  3,  2,-11,  3,  7,  2,
-    2, -4,  7,  3,  1, -8,  7,  1, -1,-12,  4,  1,  3, -9,  2,  2,
-    2, -2, -2,  9,-17, -3,  3,  1, -4,  7,  1, -6,  5,  4, -1,  3,
-   -1,  2,  0, -4, -7,  8, 12, -1, -2,  5,  4, -5,  3, -5, -8, -2,
-    0,  0, -5, -2, -2, -8,  3, 27, -1, -4, -3,  6, -3,  1, -2, -7,
-    4,  4,  1, -1, -7,-10, -7, -3, 10, 10,  5,  3, -2, -2, -4, -3,
-    0,  1,  5,  7,  4, -2,-16,-20,  0,  4,  7,  8,  2,  0, -2, -1,
-   -2,  1,  3, 17, -3,  1, -2, -1, -1, -2, -1, -2, -1, -5, -1,  0,
-    5, -3,  1,  0,  6, -2,  0,  0, -1, -2,  0, -3,-11,  1,  8, -1,
-    3,  0,  0,  0,  0,  2,  4,  1,  2,  0,  6,  1, -2,-18, -3,  2,
-  -14,  0,  6,  1, -5, -2, -1,  1, -1,  1,  0,  1,  1,  7,  4,  0,
-   -1,  0,  1, -4,  1,  8,  3, -4, -3,  4,  1,  3, -6,  1, -4,  1,
-    1,-12,  3,  3, -1,-10,  0, -1,  2,  0,  2,  1,  3,  2,  2,  4,
-    3,  0,  0,  3,  2,  0, -2,  1,  5,  2, -5,  0,  6, -1,-14, -1,
-   -2, -6, -3, -3,  2, -1,  4,  5,  6, -1, -2,  0,  4,  4, -1, -5,
-   -4,  1,-11,  0, -1,  2, -4,  1,  2, -3,  3, -1,  1, -2, 15,  0,
-    1, -1,  0, -2,  1, -4, -7,  1, -2, -6, -1, 21, -2,  2, -1,  1,
-   21, -1, -2,  0, -1, -3,  1, -2, -9, -2,  2, -1,  2,  1, -4, -1,
-    1,  8,  2, -6,-10, -1,  4,  0, -4, -3,  3,  3,  5,  0, -1, -1,
-    3,  2,  1, -2, -2, -2,  4,  3,  5,  2, -4,-17,  0, -2,  4,  3,
-   -7, -4,  0,  3,  9,  9,  2, -1,-11, -6,  0, -1,  5,  1,  0,  1,
-    0, 17,  5,-11,  3, -2, -6,  0,  2, -2, -4,  1, -4,  1,  2, -1,
-   -5, -1, -5, -3, -3,  5, -3, -2,  4, 16,  2, -5, -2,  5, -1, -1,
-    0,  0, -4,  1, -1,  2,  5, 11, -1, -1, -2,  1, -4, -2, -3, -1,
-   -5, -1, 10,  0,  6,  1,  0, -3,  0, -4,  1,  0, -2, -4,  3, -1,
-    6,  9,  3,  0, -2,  1, -2,  0, -2, -3, -2, -2,  1,  0,  1, -6,
-    1,  0,  2,  1, -1,  3, -2,  1,  0, -1,-15,  0, -1,  5,  2,  6,
-    2,  0,  2,  2,  0,-12, -4,  6,  0,  1,  4, -1,  1,  2,  1, -4,
-    1, -2, -7,  0,  0,  0,  0, -1, -5,  2, 11,  3,  1,  3,  0, -6,
-    0, -3, -9, -4,  1,  3, -1,  0,  4,  1, -2,  0,  7, -3, -1,  6,
-    1, -2,  6,  2,  0, -1,  3, -2, -2,  4,  0,  2, -1,  2,-14,  2,
-    2,  2,  0, -1, -2,  3, -3,-14,  0,  2,  3, -3,  5,  1,  3,  2,
-    1, -3,  4,-14,  1, -2, 11, -1,  0, -1,  3,  0, -1,  1,  0,  2,
-   -2,  3, -3,  2, -4, -1, -4,  3, -1,  2,  1,  3, -6, -2,  2,  7,
-   -2,  1,  2,  0, -2,  0,  0, -1, 12,  5, -1,  2, -8, -1,  1, -7,
-    2, -2, -4,  2, 11,  0,-11, -2,  3,  1, -3, -1,  0,  3,  1, -1,
-    0,  3,  0, -2,  0, -6, -1, -3, 12, -7, -2,  0,  7, -2,  1,  1,
-    1,  2,  2,  2, -1,  2,  0,  2,-23,  0,  4,  0,  3,  2,  1,  3,
-   -4, -5, -1,  5, -3,  5, 10, -1,  0,  0,  3, -4,  1, -1,  2, -5
-};
-
-/* 6x16-entry codebook for inter-coded 8x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x4)[3072] = {
-    9,  8,  4,  0, -3, -4, -4, -3,  9,  8,  4, -1, -4, -5, -5, -3,
-    8,  7,  3, -2, -5, -5, -5, -4,  6,  4,  1, -2, -4, -5, -4, -3,
-  -12,-14,-11, -4,  1,  5,  6,  6, -8,-10, -7, -5, -2,  1,  1,  1,
-    5,  4,  3,  1,  0,  0, -1, -1, 13, 13,  9,  6,  3,  0, -1, -2,
-   -4, -4, -3, -1,  1,  4,  8, 11, -5, -6, -4, -2,  0,  3,  8, 12,
-   -7, -7, -6, -4, -2,  2,  7, 10, -7, -7, -5, -4, -2,  1,  5,  8,
-   -3, -2, -1,  1,  3,  6,  7,  6,  2,  3,  5,  7,  8,  8,  6,  4,
-    4,  5,  4,  3,  1, -2, -6, -7,  1,  0, -2, -7,-10,-14,-17,-16,
-   -5, -4,  1,  8,  9,  3, -3, -7, -7, -6,  1, 11, 12,  5, -3, -8,
-   -8, -7,  0,  9, 11,  5, -3, -7, -8, -6, -1,  5,  8,  4, -2, -6,
-   -4, -5, -7, -8, -9, -9, -8, -6, -4, -5, -6, -7, -7, -6, -4, -2,
-    0,  1,  2,  3,  5,  8, 10,  9,  1,  2,  3,  6,  9, 12, 14, 13,
-    5,  6,  6,  5,  4,  3,  2,  1,  5,  6,  7,  7,  6,  6,  6,  4,
-   -1,  0,  1,  1,  3,  5,  5,  5,-13,-16,-17,-17,-14,-10, -6, -4,
-    9, 11, 13, 16, 15, 13, 12, 10, -4, -5, -6, -7, -7, -7, -6, -5,
-   -6, -6, -7, -7, -7, -7, -6, -5, -2, -1,  0,  0,  0,  0,  0, -1,
-  -11,-13,-15,-16,-16,-14,-12,-10,  2,  3,  4,  5,  4,  3,  3,  3,
-    6,  7,  8,  8,  8,  7,  6,  5,  3,  4,  3,  3,  3,  3,  3,  3,
-    3,  4,  4,  1, -2, -7,-13,-17,  5,  7,  7,  5,  1, -5,-13,-19,
-    6,  8,  9,  8,  5, -1, -9,-16,  6,  8, 10, 10,  7,  2, -4,-11,
-   18,  9, -1,-10,-13, -9, -4,  0, 22, 12, -1,-12,-15,-10, -4,  2,
-   23, 13,  0,-10,-13, -9, -3,  2, 20, 12,  2, -6, -9, -6, -2,  2,
-   -6, -6, -6, -7, -7, -7, -7, -6, -6, -7, -8, -8, -9, -9, -9, -8,
-   -3, -3, -3, -3, -3, -3, -3, -3, 12, 15, 18, 21, 21, 19, 17, 14,
-   14, 16, 18, 18, 18, 16, 15, 13,  5,  6,  6,  5,  5,  4,  4,  3,
-   -6, -7, -9,-10,-10,-10, -9, -7,-10,-11,-13,-14,-14,-13,-12,-10,
-  -27,-17, -4,  5,  9, 10, 10,  7,-32,-19, -3,  7, 11, 12, 11,  8,
-  -30,-16, -2,  8, 12, 12, 10,  7,-23,-12,  0,  7, 10, 11,  9,  6,
-   16, 17, 16, 12,  6, -1, -8,-12, 17, 18, 15, 10,  1, -8,-15,-18,
-   15, 14, 10,  4, -5,-14,-20,-23, 10,  8,  4, -1, -9,-16,-21,-22,
-  -10,-12,-12,-11, -5,  4, 14, 20,-11,-13,-15,-12, -4,  7, 19, 27,
-  -11,-13,-14,-11, -3,  8, 21, 28,-10,-11,-12, -9, -2,  8, 18, 25,
-   -1, -1, -1,  1,  4,  6,  6,  5,  0,  0,  0,  2,  4,  3,  1, -2,
-    0,  0,  2,  4,  4, -1, -7,-10,  0,  0,  3,  5,  3, -3,-11,-15,
-  -14,-13, -8, -1,  3,  3, -1, -4, -5, -4, -1,  4,  8,  8,  3,  0,
-    3,  2,  2,  3,  4,  5,  3,  1,  5,  3,  0, -2, -2, -1, -1, -1,
-    9,  1, -6, -6, -5, -3, -2, -1, 12,  1, -6, -6, -4, -2, -1,  0,
-   14,  4, -4, -4, -2, -2, -1, -1, 14,  6, -1, -1, -1, -1, -1, -1,
-    4,  6,  8, 10, 11,  9,  7,  5, -1, -1, -1,  0,  0, -1, -1, -2,
-   -2, -4, -4, -5, -5, -5, -5, -4, -2, -3, -3, -4, -4, -3, -2, -1,
-    2,  3,  4,  4,  3,  1,  0,  0, -1,  1,  4,  5,  6,  5,  4,  3,
-   -8, -6, -2,  2,  3,  4,  4,  3,-14,-13, -9, -5, -2, -1,  0,  0,
-   -3, -4, -5, -4,  0,  7, 12, 13, -3, -4, -5, -5, -2,  4,  9, 10,
-   -2, -3, -4, -5, -4, -1,  3,  4, -1, -1, -2, -3, -3, -2,  0,  1,
-    9,  5, -2, -8,-11,-10, -7, -4, 12, 10,  6,  2,  0, -1,  0,  0,
-    2,  2,  3,  4,  3,  1,  1,  1, -9, -8, -4,  0,  1,  2,  1,  0,
-    6,  8,  8,  5,  1, -5,-11,-13,  0,  1,  2,  2, -1, -4, -8,-11,
-   -3, -2,  1,  3,  3,  1, -1, -4, -2, -1,  2,  5,  6,  6,  4,  1,
-    3,  4,  5,  5,  4,  1, -3, -6,  5,  6,  4,  2,  2,  2,  0, -3,
-    6,  5,  0, -5, -5, -2, -1, -2,  7,  4, -3,-11,-12, -7, -3, -2,
-    1,  0, -1, -1, -1,  0,  0,  0,  2,  3,  4,  4,  5,  5,  4,  3,
-   -7, -9, -9,-10,-10, -9, -7, -6,  3,  4,  5,  6,  5,  5,  5,  5,
-   -7, -7, -7, -7, -6, -6, -5, -4, -5, -4, -3, -1, -1, -1,  0,  0,
-   -3, -2,  1,  4,  5,  5,  5,  5, -2, -1,  3,  6,  9, 10, 10,  9,
-  -14,  1, 10,  3, -2,  0,  1,  1,-16,  2, 13,  3, -3, -1,  1,  0,
-  -15,  2, 12,  3, -4, -2,  1,  1,-10,  3, 10,  2, -3, -1,  1,  1,
-    0,  1,  4,  2, -5,-10, -3, 11, -1,  1,  4,  2, -6,-13, -2, 15,
-   -1,  0,  3,  1, -6,-12, -1, 15, -1,  1,  2,  1, -4, -8,  0, 11,
-   10,  5, -2, -2,  2,  5,  1, -4,  7,  0, -8, -6,  1,  5,  2, -4,
-    2, -5,-12, -7,  2,  7,  4, -1, -1, -7,-10, -4,  4,  9,  7,  2,
-   -5, -5, -4, -6, -6, -5, -5, -3, -1, -2, -2, -4, -5, -6, -5, -4,
-    6,  7,  7,  4,  0, -2, -3, -3, 13, 14, 13, 10,  5,  1, -1, -2,
-    1,  1,  2,  2,  2,  2,  2,  2, -5, -6, -8, -9, -9, -8, -7, -6,
-    7,  9, 10, 11, 11,  9,  7,  5, -1, -2, -3, -3, -4, -4, -4, -3,
-   -1, -1,  0,  0,  0,  0, -1, -1, -3, -3, -4, -5, -4, -3, -3, -2,
-    2,  1, -1, -3, -3, -2, -1,  0, 12, 12,  8,  3,  1,  0,  0,  1,
-   -6, -8, -8, -6, -2,  2,  6,  8,  1,  1, -1, -2,  0,  3,  5,  7,
-    3,  3,  1, -1, -1,  0,  0,  2,  0,  1,  0, -1, -1, -1, -2, -1,
-    1,  0,  0,  0,  0,  0,  2,  4,  2,  1,  3,  4,  3,  1,  0,  2,
-    2,  1,  0,  0, -1, -1,  0,  3,  5,  1, -6,-12,-13, -8, -1,  4,
-   -2,  0, -1, -2, -1,  0,  2,  3, -6, -3, -2,  0,  1,  1,  1,  1,
-   -9, -5,  0,  4,  5,  3,  1,  0, -8, -3,  3,  7,  8,  4,  1,  0,
-    1,  2,  2,  3,  3,  1, -1, -3,  4,  5,  5,  6,  6,  5,  2,  0,
-    0,  0,  0,  0,  1,  0, -2, -4, -3, -3, -4, -3, -3, -4, -7, -8,
-   14, 12,  6, -1, -3, -3,  0,  0,  7,  5,  1, -3, -5, -4, -2, -1,
-   -2, -2, -2, -2, -2, -2, -1, -1, -6, -4, -1,  1,  1,  1,  0, -1,
-    2,  2,  1, -3, -6, -7, -6, -3,  1,  0, -1, -3, -2,  1,  4,  6,
-    0,  0,  1,  2,  4,  7,  8,  7,  0,  0,  0,  0, -1, -4, -7, -8,
-    0,  2,  1, -2, -3, -3, -2, -1, -1,  1,  0, -3, -5, -2,  0,  2,
-   -2, -1, -2, -5, -4,  1,  6,  9, -3, -2, -3, -4, -2,  5, 11, 13,
-   -4, -2,  2,  6,  4, -3,-10,-14, -2, -1,  1,  4,  4,  1, -1, -2,
-    0,  0, -1, -2, -2,  0,  4,  6,  2,  2,  0, -3, -3,  0,  5,  9,
-   -4, -4, -2,  1,  6,  9,  3, -7, -2, -2, -2, -1,  4,  8,  0,-11,
-    1,  1,  0,  0,  2,  6, -1,-10,  2,  2,  1,  0,  2,  4,  0, -7,
-   -1, -2, -3, -6, -7, -8, -8, -8,  2,  3,  3,  1, -1, -2, -3, -4,
-    5,  5,  5,  4,  3,  2,  0, -1,  3,  3,  3,  3,  2,  2,  1,  1,
-    3,  3,  2, -2, -3,  0,  7, 10,  1,  2,  2, -2, -5, -4,  0,  3,
-    0,  3,  4,  2, -3, -5, -6, -4,  0,  2,  4,  4,  1, -4, -7, -7,
-    2,  4,  5,  5,  5,  5,  6,  6, -4, -4, -3, -5, -5, -3, -3, -2,
-   -3, -4, -4, -5, -4, -2, -2, -2,  1,  1,  0,  0,  2,  4,  5,  4,
-   -2,  0,  3,  4,  4,  3,  2,  2, -9, -7, -4,  0,  3,  6,  6,  6,
-   -5, -5, -3, -2,  0,  1,  3,  4,  5,  5,  2, -2, -4, -6, -5, -3,
-    1, -6, -4,  7,  5, -2, -2,  1,  5, -5, -4,  6,  4, -5, -4,  1,
-    5, -5, -4,  6,  4, -5, -3,  1,  1, -7, -3,  8,  7, -1, -3,  1,
-   -8, -7, -4,  0,  2,  4,  5,  5,  5,  6,  5,  2, -1, -5, -7, -7,
-    5,  6,  4,  1, -3, -5, -6, -5, -7, -7, -5, -2,  1,  6,  9, 10,
-    6,  3,  0,  1,  3,  0, -8,-14,  3,  0, -1,  1,  4,  3,  0, -4,
-    1,  0,  0,  1,  2,  1,  1,  1, -1, -1,  1,  2,  1, -1, -1,  0,
-    1,  1,  1,  1,  0, -2, -3,  0,  1,  2,  1,  0, -2, -8, -9, -4,
-    1,  3,  3,  2,  1, -3, -3,  1,  0,  1,  1,  1,  1,  1,  4,  8,
-    2,  5,  9,  7,  2, -1, -1,  1, -4, -1,  1,  0, -3, -4, -1,  2,
-   -3,  0,  3,  3,  0, -1,  0,  2, -4, -1,  1,  1, -2, -4, -5, -4,
-    1, -1, -2, -2, -1,  2,  4,  5,  2,  1,  1,  0, -1, -1,  0,  0,
-    2,  3,  4,  5,  4,  2,  1,  0, -9, -9, -6, -3, -1, -1, -1, -1,
-   -6, -6,  4,  7,  0, -2, -1, -2, -1, -2,  5,  6, -1, -2,  0, -1,
-    4, -1,  1,  0, -4, -2,  0, -2,  7,  1, -1, -2, -3,  1,  3,  1,
-    4,  2,  1,  3,  3,  1,  1,  2,  2, -2, -4,  0,  3,  1,  0,  0,
-    1, -4, -8, -4,  1,  2,  1,  0,  2, -3, -9, -6,  0,  3,  3,  2,
-   -1, -1,  0, -1, -1,  0,  1,  2,  3,  1, -4, -8, -7, -3,  1,  2,
-    2, -1, -3, -2, -1,  0,  1,  0, -1,  0,  5, 11,  9,  3, -1, -3,
-   -1, -2, -2, -1,  1,  1,  1,  1,  0, -1,  0,  3,  6,  6,  5,  5,
-    2,  1, -1, -1, -2, -5, -6, -4,  2,  2,  2,  1, -1, -4, -5, -5,
-   -1, -3, -6, -7, -6, -4, -1,  1,  5,  5,  3,  4,  4,  3,  4,  5,
-   -1, -2, -3, -2, -2, -2,  0,  1,  0,  0,  0,  0,  0,  1,  2,  3,
-   -6, -6, -4, -1,  2,  2,  2,  2, -6, -7, -5, -2,  0, -1, -1,  0,
-    2,  2,  2,  4,  4,  3,  3,  4,  2,  1,  0, -1,  0,  0,  2,  4,
-   12,  5, -5, -8, -5,  0,  2,  2,  2, -3, -6, -3,  0,  0, -1, -2,
-   -2, -3, -1,  3,  4,  1, -2, -3,  2,  2,  3,  4,  3,  1, -1, -1,
-    3,  2,  1,  0,  1,  4,  3,  0,  4,  3,  0, -5, -6,  0,  3,  3,
-    2,  3,  1, -7,-12, -6,  1,  3,  1,  3,  4, -1, -6, -4,  0,  1,
-   -9, -4,  2,  6,  7,  4,  1,  0, -7, -1,  4,  6,  4,  0, -3, -3,
-   -6,  0,  4,  4,  1, -2, -3, -2, -4,  1,  3,  2,  0, -2, -1,  0,
-    0,  5,  2, -5, -3,  3,  1, -4, -2,  4,  2, -6, -3,  6,  4, -3,
-   -1,  5,  3, -5, -1,  7,  3, -4, -1,  2,  0, -6, -3,  5,  3, -3,
-   -8, -3,  3,  5,  3,  1, -2, -2,  2,  4,  4, -2, -4, -3,  1,  3,
-    2,  1, -3, -5, -3,  3,  4,  3, -5, -6, -5,  3, 10,  8, -1, -5,
-    0,  3,  2, -4, -9, -7,  0,  6, -5, -1,  5,  7,  4, -1, -3, -3,
-   -5, -5, -2,  3,  6,  5, -1, -4,  9,  6,  0, -4, -2,  1,  1, -1,
-   -1, -1, -1,  1,  1,  0, -1,  0, -1,  0,  0,  0,  0, -1, -1,  0,
-    2,  1, -2, -1,  1,  1,  0,  0, 12,  8,  2, -1, -1, -4, -7, -7,
-    2,  1,  3,  6,  7,  4,  2,  0,  1,  0, -1,  0, -1, -4, -7, -8,
-    0,  0, -1,  0,  0,  0, -1, -3,  0,  0,  0,  0,  1,  1,  0, -2,
-   -1,  0,  1,  1,  0,  0, -1, -2,  0,  0, -1, -3, -4, -3, -1,  1,
-   -1,  0,  0,  0,  1,  4, 10, 12, -1,  0, -2, -2, -3, -3, -1,  1,
-   -3, -1, -2, -4,  2,  9,  9,  7, -3,  0, -1, -3,  0,  2, -1,  1,
-   -1,  1, -2, -3,  0, -1, -3,  0,  0,  0, -3, -2,  0, -1, -1,  1,
-   -1, -2, -1, -1, -2, -1, -1, -2,  2, -1, -2, -1,  0,  1,  0, -2,
-    3, -1, -2,  2,  5,  3, -1, -3,  1, -5, -5,  1,  6,  6,  2,  0,
-    1,  2,  0, -1,  0,  1,  0, -2, -5, -3, -1,  0,  1,  2,  1, -2,
-   -7, -5, -2, -2, -2, -2,  0,  1, -1,  0,  1,  1,  0,  3,  9, 12,
-    0,  6,  5,  1, -2, -3,  0,  3,  0,  6,  5,  1,  1,  1,  2,  3,
-   -5, -2, -2, -3,  0,  0,  0,  0, -6, -3, -3, -2,  0,  0, -1, -2,
-    4,  4,  2,  1,  0, -1, -1,  0, -2, -2,  0,  1,  2,  1,  1,  0,
-    2,  2,  1, -1, -3, -5, -9,-10,  2,  1, -1, -1,  1,  4,  4,  1,
-    4,  0, -2, -2, -2, -2, -1,  0,  7,  1, -4, -3, -2,  0,  1,  1,
-   10,  5, -1, -2,  0,  1,  1,  0,  5,  1, -3, -4, -3, -1, -1, -2,
-    2,  1, -1, -3, -3,  1,  1, -1, -2, -1,  3,  0, -1,  1,  1,  0,
-   -3,  1,  7,  2, -3, -2, -1,  0, -2,  4,  8, -1, -8, -5,  0,  2,
-   -4, -1,  1,  2,  1, -3, -4, -2, -5, -3, -2,  1,  4,  4,  4,  6,
-   -3, -2, -4, -3,  0,  1,  1,  2,  2,  2,  2,  1,  2,  1, -1, -1,
-   -4, -1,  0, -1, -3, -3, -1, -1,  1,  4,  4,  2,  0, -1, -2, -3,
-    4,  6,  5,  3,  2,  1, -2, -4,  0,  1,  1,  1,  1, -1, -4, -6,
-    1,  2,  2, -1, -6, -5, -1,  2, -3, -2,  1,  1, -4, -3,  2,  5,
-   -2, -1,  2,  2, -3, -4,  0,  3, -2, -2,  2,  6,  5,  2,  1,  2,
-    2, -3, -3,  0,  0,  2,  3,  1,  3, -1,  1,  3,  1,  2, -1, -5,
-   -5, -7, -4, -2,  1,  8,  8,  1, -1,  0,  2,  0, -3,  0,  1, -3,
-   -2, -5, -5, -2, -3, -1,  0, -2, -1, -4,  0,  4,  0,  2,  4,  0,
-    0,  0,  8, 10,  2,  1,  3, -1, -4, -3,  2,  3, -3, -3,  1, -1,
-    1, -2, -4,  2,  7,  3, -2, -1,  6,  4, -2, -1,  2,  0, -1,  3,
-    1,  1, -2, -2, -2, -5, -3,  4, -6, -2,  1,  1, -1, -4, -2,  4,
-   -2, -1, -2, -2,  0,  1,  0, -2, -1,  1,  0, -1,  0,  0, -1, -3,
-    0,  1, -2, -4, -3, -1,  0,  0,  6,  8,  5,  0,  0,  1,  2,  3,
-   -2, -2,  2,  5,  2,  0,  0,  1,  2, -2, -2, -1, -1,  1,  2,  4,
-    2, -1,  0,  1,  0,  0,  0,  1, -8, -7, -1,  1, -1, -1,  1,  3,
-    0,  3,  6,  2, -2,  1,  2,  0,-10, -7, -1,  0, -3, -1,  2,  1,
-    0,  0,  2,  2,  1,  1,  1, -1,  3,  0, -2, -2,  0,  2,  1,  0,
-    8,  1,  0,  0, -2, -3, -1,  0,  2, -2,  2,  5,  1, -2, -1,  1,
-   -3, -6, -3, -1, -3, -3, -1,  2,  2,  0,  1,  2,  2,  1,  0,  0,
-    1, -1, -1, -2, -1,  0,  1,  0, 15,  9,  2, -1, -2, -3, -3, -3,
-    0, -3, -2,  0,  0, -1, -1, -1,  1,  0,  1,  0,  0, -1, -1, -1,
-    0,  2,  2, -2, -3, -3, -7, -8,  0,  2,  2,  0,  1,  2,  1,  1,
-    1,  2,  2,  2,  3,  1,  0,  3,  1,  0, -1, -2, -1, -2,  0,  5,
-  -11, -6, -1,  1,  2,  3,  1, -3,  1,  4,  3, -1, -2,  1,  2, -1,
-    2,  2,  1, -1, -2,  0,  1, -1,  0,  0, -1, -1,  0,  2,  3,  2,
-    1,  1,  2,  1, -1,  1,  0, -4,  0,  0,  0, -2, -2,  2,  4, -2,
-   -2, -3,  0,  0, -1,  2,  1, -6,  0,  2,  5,  5,  3,  2, -1, -7,
-    4,  2,  0,  0,  3,  3,  1, -1,  0, -1, -1,  3,  6,  4,  1, -1,
-   -2, -2,  0,  2,  2,  0, -2, -2, -1,  0, -1, -5, -7, -5, -1,  1,
-    5, -1, -2,  0,  2,  4,  2, -5,  0, -5, -2,  2,  1,  2,  0, -6,
-    6,  1,  0,  1, -2, -1,  4,  2,  2, -3, -3,  0, -1, -2,  0,  0,
-    1, -1,  0,  2,  0,  0,  6, 11,  2, -1, -1,  0, -3, -2,  3,  5,
-    0, -2, -1,  0, -1,  0,  0, -3,  1, -1, -1, -1, -2, -1, -3, -7,
-    1,  1, -2, -2,  1,  3,  1, -2, -1,  2,  0, -1, -1,  1,  0,  0,
-   -4,  2,  3, -1, -2, -2,  0,  1,-11, -2,  4,  5,  6,  2, -1, -2,
-   -6, -2,  1, -1, -3, -4,  1,  9, -3,  0,  3,  3,  2, -3, -3,  3,
-    1,  1,  0,  0,  1, -1, -2,  3,  2,  0, -3, -3,  0, -1, -1,  3,
-    1, -1, -3,  1,  2, -6, -4,  6,  0, -2, -5, -2,  0, -3, -2,  3,
-    2,  2,  1, -2, -2,  1,  2, -1, -1,  1,  1, -2, -1,  6,  7, -1,
-    1,  0, -4, -2,  1, -2, -3,  1, -4,  0, -3, -2,  2,  0, -3,  0,
-   -3,  4,  3,  1,  8,  7,  0, -1, -3,  4,  1, -4,  2,  3, -2, -3,
-   -3,  6,  1, -4,  1,  1, -1, -1, -2,  4, -3, -3,  3,  0, -1, -1,
-    1,  2, -4,  2,  4, -3, -1,  2,  3, -1, -4,  5,  4, -6, -3,  2
-};
-
-/* 6x16-entry codebook for inter-coded 8x8 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_inter_codebook_8x8)[6144] = {
-   -4, -3,  4,  5,  2,  1,  1,  0, -5, -3,  5,  5,  2,  1,  0,  0,
-   -6, -4,  5,  5,  2,  1,  0,  0, -7, -4,  4,  5,  2,  1,  0,  0,
-   -8, -5,  3,  4,  2,  1,  0,  0, -8, -6,  3,  4,  1,  1,  1,  0,
-   -8, -6,  2,  4,  2,  1,  1,  0, -8, -6,  2,  4,  1,  1,  1,  1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2,
-   -2, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, -3, -3, -4, -3,
-   -2, -2, -2, -2, -2, -3, -3, -2,  1,  1,  1,  1,  1,  0, -1, -1,
-    4,  5,  5,  5,  4,  3,  3,  2,  7,  7,  8,  8,  8,  7,  6,  5,
-    2,  1,  2,  4,  4,  0, -4, -6,  1,  1,  2,  5,  5,  1, -5, -7,
-    1,  2,  1,  4,  5,  1, -5, -8,  1,  1,  1,  5,  5,  0, -6, -8,
-    0,  1,  1,  5,  6,  1, -6, -9,  0,  0,  1,  4,  5,  0, -5, -8,
-    0,  0,  1,  4,  5,  0, -5, -7,  0,  0,  1,  4,  4,  1, -4, -7,
-    1,  2,  3,  0, -3, -4, -3, -1,  1,  3,  4,  0, -3, -4, -3, -1,
-    2,  4,  5,  1, -3, -4, -3, -2,  2,  5,  6,  1, -3, -5, -4, -2,
-    3,  6,  6,  1, -3, -5, -4, -2,  3,  6,  6,  1, -3, -5, -4, -2,
-    3,  6,  6,  1, -3, -5, -4, -2,  3,  5,  5,  1, -3, -4, -4, -2,
-    2,  2,  2,  2,  1,  0,  0, -1,  4,  4,  4,  3,  2,  1,  1,  0,
-    4,  5,  4,  4,  3,  3,  2,  1,  4,  4,  4,  4,  4,  3,  2,  2,
-    2,  3,  3,  3,  3,  3,  2,  1, -1, -1, -1, -1,  0,  0,  0,  0,
-   -5, -6, -6, -5, -5, -4, -3, -3, -7, -9, -9, -8, -7, -6, -6, -5,
-    6,  6,  6,  6,  6,  5,  5,  4,  4,  4,  4,  3,  3,  3,  3,  2,
-    0, -1, -1, -1, -2, -2, -1, -1, -3, -5, -6, -6, -6, -6, -5, -4,
-   -3, -5, -6, -7, -6, -6, -5, -4, -1, -2, -2, -2, -2, -2, -1, -1,
-    0,  1,  1,  1,  1,  1,  1,  1,  3,  3,  3,  3,  3,  3,  3,  3,
-    2,  1, -2, -5, -4,  0,  2,  5,  2,  1, -2, -6, -5,  0,  3,  5,
-    2,  1, -2, -6, -6, -1,  3,  6,  3,  2, -2, -7, -6,  0,  4,  7,
-    2,  1, -2, -7, -5,  0,  5,  7,  2,  1, -2, -6, -5,  0,  4,  7,
-    2,  1, -2, -6, -4,  0,  4,  6,  1,  1, -2, -5, -4,  0,  3,  6,
-  -10, -9, -6, -4, -1,  2,  3,  2,-10, -9, -5, -3,  0,  4,  4,  3,
-   -9, -7, -3, -1,  2,  5,  5,  3, -7, -5, -2,  0,  3,  5,  5,  3,
-   -6, -3,  0,  1,  4,  6,  5,  3, -4, -2,  1,  2,  3,  5,  4,  2,
-   -2,  0,  1,  2,  2,  4,  3,  1, -1,  1,  2,  2,  2,  3,  3,  1,
-   -4, -5, -5, -6, -6, -6, -6, -5, -3, -3, -4, -4, -4, -4, -4, -4,
-    0,  0,  0,  0, -1, -1, -1, -1,  5,  5,  6,  5,  5,  4,  3,  2,
-    5,  6,  7,  7,  7,  6,  5,  4,  3,  3,  4,  4,  4,  4,  3,  2,
-    0, -1,  0,  0, -1, -1,  0, -1, -3, -3, -4, -4, -4, -4, -3, -3,
-    1, -2, -5,  1,  5,  4,  2,  0,  1, -3, -6,  1,  6,  5,  2,  0,
-    0, -4, -7,  0,  6,  6,  2,  1, -1, -5, -9, -1,  6,  6,  3,  1,
-   -1, -6,-10, -2,  6,  6,  3,  1, -1, -6, -9, -2,  5,  6,  3,  1,
-   -2, -6, -9, -2,  5,  5,  3,  1, -2, -6, -7, -2,  4,  4,  2,  1,
-   -5, -7, -8, -9, -9, -8, -7, -6, -5, -6, -6, -7, -7, -6, -6, -5,
-   -3, -3, -3, -4, -5, -5, -4, -4, -1,  0,  0, -1, -1, -1, -1, -1,
-    0,  1,  2,  2,  2,  2,  2,  1,  2,  3,  4,  5,  5,  5,  5,  4,
-    3,  4,  5,  6,  8,  8,  8,  7,  3,  4,  5,  6,  7,  7,  7,  6,
-    5,  6,  7,  8,  9, 10, 10,  9,  3,  4,  6,  7,  8,  9,  9,  8,
-    0,  1,  2,  3,  4,  5,  5,  5, -1, -2, -1, -1,  0,  1,  2,  2,
-   -2, -3, -3, -3, -3, -2, -1,  0, -3, -4, -5, -5, -5, -5, -5, -4,
-   -4, -5, -5, -6, -7, -7, -6, -5, -3, -4, -5, -6, -7, -7, -6, -6,
-   13,  7,  0, -3, -3, -4, -4, -5, 14,  7,  0, -3, -3, -4, -4, -4,
-   15,  8, -1, -4, -4, -4, -5, -4, 15,  8, -1, -4, -4, -5, -4, -3,
-   15,  7, -1, -4, -5, -5, -5, -4, 14,  7, -1, -4, -4, -4, -4, -3,
-   12,  6, -1, -4, -4, -4, -4, -3, 11,  5, -1, -4, -4, -4, -4, -3,
-  -17, -4,  5,  4,  4,  4,  3,  3,-18, -5,  5,  4,  4,  4,  3,  3,
-  -19, -5,  6,  4,  4,  4,  3,  2,-20, -5,  6,  4,  4,  4,  3,  3,
-  -20, -4,  6,  4,  4,  5,  3,  3,-19, -5,  6,  4,  4,  5,  3,  3,
-  -18, -4,  5,  4,  4,  4,  3,  2,-17, -5,  4,  3,  4,  4,  3,  3,
-   -6, -6, -6, -4, -2,  1,  6, 11, -6, -7, -7, -4, -2,  2,  8, 13,
-   -8, -8, -7, -4, -2,  3,  9, 14, -8, -8, -7, -5, -1,  4, 10, 16,
-   -8, -8, -7, -5, -1,  4, 10, 17, -8, -8, -7, -4,  0,  5, 10, 16,
-   -8, -8, -6, -3,  0,  4,  9, 15, -7, -7, -5, -3,  0,  4,  8, 12,
-    8,  7,  7,  5,  2, -2, -8,-14,  8,  8,  7,  5,  2, -2, -8,-15,
-    8,  8,  7,  5,  1, -3, -9,-16,  8,  8,  7,  5,  1, -3,-10,-17,
-    8,  9,  8,  5,  1, -3,-10,-17,  8,  8,  7,  4,  1, -4,-10,-16,
-    7,  7,  7,  4,  1, -3, -9,-14,  6,  7,  6,  3,  0, -3, -9,-13,
-    5,  1, -4, -4, -3, -1,  0,  0,  7,  2, -3, -3, -2, -1,  1,  0,
-    7,  1, -3, -3, -1,  0,  1,  1,  6,  1, -3, -2, -1,  1,  1,  0,
-    6,  0, -4, -2, -1,  0,  1,  0,  5,  0, -4, -3, -1,  0,  0, -1,
-    5,  0, -3, -1,  0,  0,  0, -2,  4,  1, -2, -1,  0,  1,  0, -1,
-    2,  2,  1,  1, -2, -6, -8, -8,  1,  1,  1,  1, -2, -5, -8, -8,
-    1,  1,  1,  0, -1, -3, -5, -5,  0,  0,  0,  0, -1, -1, -1, -2,
-    0, -1,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  1,  2,  3,  2,
-    2,  1,  1,  1,  2,  3,  4,  3,  3,  3,  3,  3,  4,  4,  5,  4,
-   -4, -4, -3, -2,  0,  0,  1,  1, -4, -4, -3, -2, -1,  0,  0,  1,
-   -2, -2, -2, -1, -1, -1,  0,  0,  0,  1,  0,  0,  0,  0,  0, -1,
-    2,  2,  2,  2,  2,  2,  1,  1,  3,  4,  4,  4,  4,  4,  4,  3,
-    1,  1,  1,  3,  3,  4,  3,  3, -5, -6, -5, -4, -3, -3, -2, -2,
-   -4, -2, -1, -1, -1, -1,  0,  1, -4, -2, -1, -1, -1, -1,  0,  1,
-   -3, -2, -1, -1, -1,  0,  1,  2, -4, -3, -2, -1, -1,  1,  3,  3,
-   -4, -3, -3, -1, -1,  1,  4,  5, -4, -3, -2, -2, -1,  1,  4,  7,
-   -2, -2, -1, -1,  0,  2,  6,  8, -1,  0,  0,  1,  1,  4,  7,  8,
-   -3, -3, -3, -2, -2, -1, -1,  0, -1, -1,  0,  1,  2,  2,  3,  3,
-    0,  1,  2,  4,  5,  6,  6,  5, -1,  0,  2,  3,  5,  6,  5,  3,
-   -1, -1,  0,  2,  3,  3,  2,  1, -2, -2, -1,  0, -1, -3, -4, -4,
-    0,  0, -1, -1, -2, -4, -8, -7,  1,  2,  1,  0, -1, -4, -6, -7,
-   -2,  4,  1, -6,  0,  3,  0,  0, -2,  5,  1, -7,  0,  3,  0,  0,
-   -3,  5,  1, -8,  0,  3, -1, -1, -2,  6,  1, -9,  0,  3,  0, -1,
-   -2,  6,  2, -8,  0,  4,  0, -1, -3,  5,  1, -7,  1,  4,  0,  0,
-   -2,  4,  1, -7,  0,  4,  1,  0, -1,  4,  1, -6,  0,  3,  1,  0,
-    0,  0,  0,  3,  4,  5,  4,  1,  1,  1,  1,  2,  3,  3,  2,  0,
-    2,  2,  1,  2,  2,  1, -1, -2,  4,  3,  1,  1,  0, -1, -3, -5,
-    5,  3,  1, -1, -2, -3, -4, -6,  5,  3,  0, -2, -3, -5, -6, -7,
-    4,  3,  0, -2, -3, -4, -5, -5,  4,  3,  0, -1, -2, -2, -3, -3,
-    0,  0,  0,  0, -1, -5, -2,  6,  0,  0,  0,  1, -1, -6, -2,  8,
-    0,  0,  0,  2,  0, -6, -3,  9,  0, -1,  0,  2,  0, -7, -2, 10,
-    0, -1,  0,  2, -1, -8, -3, 10,  0, -1, -1,  2, -1, -7, -3,  9,
-    0, -1,  0,  1, -1, -6, -3,  8,  0,  0,  0,  1,  0, -5, -2,  7,
-    2,  3,  3,  2,  1,  0, -1, -1,  3,  4,  3,  2,  1,  0, -1, -2,
-    3,  4,  4,  2,  1, -1, -2, -3,  2,  3,  3,  2,  0, -1, -2, -3,
-   -1,  0,  1,  1,  0, -1, -2, -2, -5, -4, -3, -1,  0,  1,  1,  1,
-   -8, -8, -5, -1,  1,  3,  4,  3,-10, -9, -5,  0,  3,  5,  6,  5,
-   -5, -1,  4,  5,  3,  1,  0,  0, -6, -1,  4,  5,  2,  0, -1, -2,
-   -6, -1,  5,  4,  2, -1, -2, -2, -7, -1,  4,  4,  1, -2, -3, -3,
-   -6, -1,  5,  4,  1, -2, -3, -3, -5,  0,  4,  4,  1, -1, -2, -2,
-   -4,  0,  5,  4,  1, -1, -1, -2, -3,  1,  4,  3,  1, -1, -1, -2,
-   -2, -3, -2,  1,  4,  6,  5,  3, -3, -4, -4,  0,  3,  5,  4,  2,
-   -3, -5, -5, -1,  2,  4,  3,  1, -4, -6, -4, -1,  2,  4,  2, -1,
-   -2, -4, -3,  1,  2,  4,  2, -1, -2, -4, -2,  1,  3,  3,  1, -2,
-   -2, -3, -2,  1,  3,  3,  1, -2, -2, -2, -1,  1,  3,  3,  0, -2,
-   -4, -4, -3, -2, -1,  2,  5,  7, -4, -4, -3, -3, -2,  1,  5,  7,
-   -2, -3, -2, -3, -3, -1,  3,  5, -1, -1,  0, -2, -3, -2,  2,  4,
-    1,  1,  1, -1, -4, -3,  1,  3,  4,  3,  2, -1, -4, -3, -1,  1,
-    6,  4,  3,  0, -3, -3, -2,  0,  6,  5,  3,  1, -2, -3, -2, -1,
-   12, 11,  8,  4,  0, -2, -2, -1, 10,  9,  6,  2, -1, -2, -1,  0,
-    4,  3,  2,  0, -1, -1,  0,  1, -1, -1, -1, -1, -2,  0,  1,  2,
-   -3, -5, -4, -2, -2,  0,  2,  3, -5, -5, -4, -2, -1,  0,  1,  2,
-   -5, -5, -4, -2, -1,  0,  1,  1, -4, -4, -3, -2, -2, -1,  0,  0,
-    3,  3,  2, -1, -3, -4, -3, -2,  3,  2,  0, -2, -4, -4, -3, -2,
-    2,  2,  1, -1, -3, -5, -4, -3,  3,  3,  3,  1, -2, -3, -3, -3,
-    4,  4,  4,  3,  0, -2, -2, -2,  5,  5,  5,  3,  0, -1, -2, -2,
-    5,  5,  4,  2, -1, -2, -3, -2,  3,  3,  3,  0, -2, -4, -4, -4,
-   -1, -1,  4, -2, -2,  6,  2, -5, -1,  0,  4, -2, -3,  6,  2, -6,
-   -1,  0,  4, -2, -3,  7,  3, -7, -1, -1,  4, -3, -4,  8,  3, -7,
-    0, -1,  4, -3, -4,  7,  3, -6, -1, -1,  4, -3, -4,  7,  3, -6,
-   -1, -1,  3, -3, -4,  6,  3, -6, -1,  0,  3, -2, -3,  6,  3, -5,
-    1, -2, -7,  2,  5, -2, -1,  1,  1, -2, -8,  3,  6, -3, -1,  2,
-    2, -2, -9,  4,  7, -4, -2,  2,  3, -1, -9,  5,  7, -4, -1,  3,
-    3, -1, -9,  4,  7, -4, -2,  2,  3, -1, -7,  4,  6, -4, -2,  1,
-    2,  0, -6,  4,  6, -4, -1,  1,  2,  0, -5,  3,  4, -3, -1,  1,
-   -2,  2,  2,  0,  0, -1, -3, -4, -2,  2,  2,  1,  1,  0, -2, -4,
-   -2,  2,  2,  2,  2,  1, -1, -2, -3,  2,  3,  3,  4,  2,  0, -2,
-   -3,  2,  3,  2,  4,  2,  0, -3, -4,  1,  2,  1,  2,  1, -1, -3,
-   -5,  0,  1,  0,  1,  1, -2, -3, -4,  0,  0,  0,  1,  0, -2, -3,
-    0,  0, -1, -2, -2,  2,  7,  8,  0,  0, -1, -3, -2,  1,  6,  7,
-    0,  1, -1, -3, -3,  0,  4,  5,  0,  1,  0, -1, -1,  0,  1,  3,
-    0,  2,  1,  1,  0, -1,  0,  1, -2,  0,  1,  2,  1,  0, -1, -1,
-   -5, -2,  0,  1,  1,  0, -3, -3, -6, -4, -1,  1,  1, -1, -3, -4,
-   -4, -2,  2,  5,  6,  4,  3,  2, -5, -3,  1,  4,  4,  2,  0,  0,
-   -4, -2,  0,  2,  1, -1, -2, -2, -2, -1,  0,  1,  0, -2, -3, -2,
-   -2,  0,  0,  0, -1, -1, -2, -1, -2, -1, -1,  0,  0,  0,  1,  2,
-   -2, -2, -1, -1,  0,  1,  3,  4, -2, -3, -2, -1,  0,  2,  4,  5,
-    2,  1, -2, -2, -1,  0,  1,  0,  1,  0, -3, -3, -1,  0,  1,  0,
-    0, -1, -3, -3, -1,  1,  1,  1,  0,  0, -3, -1,  1,  2,  3,  3,
-    0, -1, -3, -1,  1,  3,  3,  3, -2, -2, -4, -2,  1,  3,  4,  4,
-   -3, -3, -4, -2,  1,  3,  3,  4, -2, -3, -5, -2,  1,  2,  3,  3,
-    4,  5,  3,  4,  4,  4,  4,  5,  3,  3,  1,  0,  0,  0,  0,  1,
-    1,  1, -1, -2, -3, -4, -3, -2,  2,  2,  0, -2, -2, -4, -3, -2,
-    2,  3,  1, -1, -1, -3, -3, -2,  1,  2,  0,  0, -1, -2, -2, -1,
-    0,  1,  0, -1, -1, -3, -2, -1,  1,  1,  0, -1, -1, -2, -2, -2,
-   -2, -1, -1,  0,  1,  2,  1,  0,  1,  2,  3,  5,  6,  5,  5,  3,
-    1,  2,  3,  4,  5,  5,  4,  3, -2, -2, -3, -3, -2, -1,  0,  0,
-   -3, -3, -4, -5, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1,  0,  0,
-    0,  1,  0, -1, -1,  0,  0,  1, -1,  0, -1, -2, -3, -2, -2, -1,
-    7,  7,  6,  5,  4,  2, -1, -2,  3,  3,  2,  2,  1,  0, -2, -3,
-    0, -1, -1, -1,  0, -1, -2, -2, -1, -3, -2, -1,  0,  0,  0,  1,
-    0, -2, -2, -1, -1,  1,  2,  2,  3,  1, -1, -1, -1,  1,  2,  2,
-    3,  1, -2, -3, -2, -1,  1,  2,  1, -2, -5, -6, -5, -3, -2,  0,
-    0, -1, -2, -3, -1,  0, -2, -2,  0,  0, -1, -1,  0,  1, -1, -2,
-    0,  0, -2, -1,  0,  0,  0, -2, -1, -2, -3, -3, -2, -1, -3, -3,
-   -1, -2, -3, -3, -2, -2, -3, -4,  2,  2,  0,  0,  0,  0, -1, -2,
-    5,  5,  3,  2,  2,  2,  0, -1,  8,  8,  6,  5,  4,  4,  2,  1,
-   -7, -8, -6, -3, -1, -1, -2, -1, -5, -5, -3,  0,  2,  1,  0,  0,
-   -1, -1,  0,  3,  4,  3,  1,  1,  2,  1,  1,  3,  4,  3,  2,  2,
-    3,  2,  0,  2,  3,  2,  1,  2,  4,  2, -1, -1,  0,  1,  1,  1,
-    3,  2, -2, -3, -2, -1,  0,  1,  3,  1, -3, -4, -3, -2,  0,  1,
-   -4, -2, -1,  2,  3,  3,  1,  0, -7, -5, -4, -2,  0,  0, -1, -2,
-   -6, -5, -5, -4, -2, -2, -2, -3, -1,  0, -1, -1,  0,  0,  0, -1,
-    2,  3,  2,  2,  2,  2,  1,  0,  3,  5,  4,  3,  1,  0,  1,  0,
-    3,  4,  3,  2,  0, -1, -1, -1,  5,  5,  3,  1,  0, -1, -1, -1,
-    1,  1,  0, -1, -3, -5, -6, -4,  1,  1,  0,  0,  0, -3, -3, -1,
-    0, -1, -1,  0,  1,  0,  1,  3, -2, -2, -3, -1,  2,  2,  4,  7,
-   -2, -2, -2,  0,  2,  2,  3,  6, -1,  0,  0,  1,  1,  0,  0,  3,
-    0,  3,  3,  3,  1, -2, -3, -1,  1,  3,  4,  3,  0, -3, -5, -4,
-    0,  2,  0, -1, -3, -4, -2, -2,  1,  4,  2,  0, -2, -3, -2, -1,
-    3,  6,  3,  1, -2, -2,  0, -1,  4,  7,  4,  1, -2, -3, -1,  0,
-    3,  6,  3,  0, -3, -3, -1,  0,  1,  3,  0, -1, -3, -2,  1,  1,
-    0,  1, -1, -2, -3, -1,  2,  2, -2, -1, -3, -3, -3, -1,  1,  2,
-    3,  1, -1,  0,  1,  0,  0,  0,  2, -1, -2, -1,  1,  0, -1, -1,
-    1, -1, -2,  0,  1,  0, -2, -3,  0, -2, -1,  1,  3,  1, -3, -5,
-    0, -2, -1,  2,  5,  2, -3, -5,  0, -2, -1,  4,  6,  3, -2, -5,
-    0, -2,  0,  4,  7,  4, -2, -4,  0, -2,  0,  4,  6,  4, -2, -4,
-   -2, -2, -3, -4, -3, -2, -1,  0,  1,  1,  0, -1, -1, -1,  0,  1,
-    3,  3,  2,  2,  1,  1,  1,  1,  2,  2,  2,  2,  1,  0,  0,  1,
-    0,  0,  0,  0, -1, -1, -1, -1, -4, -4, -4, -4, -4, -4, -4, -3,
-   -3, -3, -2, -3, -2, -1, -1,  0,  3,  4,  4,  5,  5,  6,  6,  7,
-   -1, -2,  7, -2, -4, -1, -1,  0, -1, -2,  9, -1, -4, -1, -1,  0,
-   -1, -3, 10, -1, -4, -1, -1,  1, -1, -3, 10, -2, -3, -1, -1,  2,
-   -1, -2, 10, -2, -4, -1, -1,  2, -1, -2,  9, -2, -4, -1, -1,  2,
-   -1, -2,  8, -2, -4,  0, -1,  1,  0, -2,  7, -2, -3, -1,  0,  2,
-    3, -4,  1,  3, -3, -2,  1,  0,  3, -5,  1,  4, -3, -2,  1,  0,
-    3, -6,  2,  5, -3, -1,  3,  0,  3, -6,  2,  5, -3, -1,  2,  0,
-    3, -6,  1,  5, -4, -2,  3,  0,  3, -6,  1,  5, -3, -2,  2,  0,
-    2, -6,  1,  4, -3, -1,  1,  0,  2, -6,  1,  4, -2, -1,  1,  0,
-    0,  0,  1,  1,  1,  0,  0,  2,  0, -1,  1,  1,  1,  0,  0,  2,
-    0, -1,  0,  0,  0,  0,  0,  2,  0, -1,  0,  0,  0,  0, -1,  0,
-    1,  0,  1,  0,  0, -1, -2, -1,  3,  1,  1,  0,  0, -2, -4, -3,
-    5,  3,  2,  1,  0, -3, -5, -4,  5,  4,  2,  0, -1, -4, -5, -5,
-    1,  0, -1, -2, -2, -3, -6, -9,  2,  0, -1, -1,  0,  0, -3, -6,
-    1,  0,  0, -1,  0,  0, -2, -5,  2,  1,  1,  1,  1,  2, -1, -3,
-    1,  1,  2,  1,  2,  2,  1, -1,  1,  1,  2,  1,  1,  1,  1,  1,
-    0,  0,  2,  1,  0,  0,  2,  2,  0,  1,  2,  2,  0,  0,  2,  2,
-   -4, -3,  0,  1,  4,  6,  4,  3, -3, -2,  0,  0,  2,  4,  1,  0,
-   -1, -1,  0,  0,  1,  1, -2, -3,  1,  1,  1,  0,  1,  1, -3, -5,
-    1,  1,  1,  0,  1,  1, -3, -5, -1,  0,  0, -1,  1,  1, -2, -4,
-   -1,  0,  0, -1,  1,  2,  0, -2, -1,  0,  0,  0,  2,  3,  1,  0,
-   -1,  0,  3,  4,  0, -4, -5, -5,  0,  0,  4,  5,  2, -2, -3, -2,
-    0, -1,  2,  4,  2, -1, -1,  0,  0, -2, -1,  1,  0, -2,  0,  1,
-    1, -2, -2,  0,  0, -1, -1,  1,  1, -2, -3,  0,  1,  0, -1,  0,
-    1, -2, -2,  1,  3,  1,  0,  0,  1, -2, -1,  2,  4,  2,  0,  0,
-    1,  2,  3,  2,  0,  2,  2,  1, -1,  0,  1,  0, -3,  1,  1,  1,
-   -1,  0,  0, -2, -4,  0,  2,  1, -1,  2,  2, -1, -5,  0,  2,  1,
-   -1,  3,  4, -1, -5,  0,  2,  1, -2,  2,  4,  0, -4, -1,  0,  0,
-   -4,  0,  2,  0, -4, -2,  0,  0, -5, -1,  2,  1, -2,  1,  3,  2,
-    1,  0,  1,  0,  1,  2, -1, -2,  2,  0, -1, -2,  1,  3,  0, -1,
-    3,  0, -2, -4,  0,  3,  1,  0,  5,  1, -3, -5, -2,  2,  1,  1,
-    6,  1, -2, -5, -2,  1,  0,  1,  5,  1, -1, -5, -2,  0, -1,  0,
-    3,  0, -2, -4, -2,  0, -1,  0,  1, -1,  0, -2,  0,  1,  0,  1,
-    1,  1,  2,  3,  2,  1,  1,  2, -1, -1,  0,  1,  1,  0,  1,  1,
-   -4, -3,  0,  0,  1,  1,  1,  2, -4, -3,  0,  2,  2,  2,  3,  2,
-   -5, -4,  0,  1,  1,  1,  1,  2, -5, -4, -1, -1, -2, -2, -1,  0,
-   -3, -2,  0,  0, -2, -3, -2, -1,  2,  3,  4,  4,  2,  0,  0,  0,
-   -4, -2,  0,  1,  0,  0,  0,  0, -3, -1,  1,  1,  0,  0,  0,  0,
-   -2,  0,  2,  2,  0,  0,  0,  2, -1,  1,  2,  1, -1,  0,  3,  5,
-    0,  2,  1, -1, -2,  0,  5,  6,  0,  1,  0, -3, -3,  0,  4,  6,
-    1,  1, -2, -4, -4, -3,  1,  2,  1,  0, -2, -4, -5, -4, -2,  0,
-   -1, -3, -3, -3, -3, -2, -1, -1,  3,  2,  1,  0,  0,  1,  1,  1,
-    5,  4,  3,  2,  1,  1,  2,  2,  2,  1,  0, -2, -2, -2, -1, -1,
-    0,  0,  0, -1, -2, -2, -2, -2,  0,  1,  3,  3,  2,  1, -1, -1,
-    0,  1,  3,  4,  3,  2,  1, -1, -4, -3, -1,  1,  0, -2, -3, -3,
-   -3, -4, -7, -8, -7, -4, -1,  2,  0, -1, -3, -4, -4, -2,  0,  2,
-    1,  0,  0, -1, -3, -2,  0,  2,  2,  1,  1,  0, -1, -1,  0,  2,
-    1,  1,  1,  1,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-    0,  0,  1,  2,  3,  3,  2,  2,  0,  0,  1,  3,  4,  4,  3,  2,
-    3,  3,  3,  0, -1,  0,  1,  2,  1,  1,  1, -1, -2, -1, -1,  1,
-   -2, -2, -1, -3, -3, -2, -2,  0, -4, -4, -2, -2, -2, -2, -3,  0,
-   -4, -4, -1,  1,  1,  0, -1,  2, -3, -1,  2,  3,  4,  3,  3,  5,
-   -2,  0,  2,  3,  3,  3,  3,  3, -2, -2,  0,  0,  0,  0,  0,  1,
-    0,  2,  1, -1, -3, -1,  3, -2, -1,  0, -1, -1, -3,  0,  4, -2,
-   -2, -2, -2, -2, -2,  1,  5, -2, -3, -2, -3, -1, -2,  1,  4, -3,
-   -2,  0, -1,  0, -1,  0,  3, -5,  1,  2,  1,  2,  0,  0,  2, -5,
-    2,  4,  2,  3,  1,  1,  3, -3,  1,  2,  1,  1,  0,  1,  4, -2,
-    4, -3, -4, -1,  3,  3,  1,  3,  4, -4, -4, -1,  3,  2,  0,  2,
-    4, -3, -4,  0,  2,  2, -1,  1,  4, -3, -2,  1,  2,  1, -2,  0,
-    2, -4, -2,  1,  2,  0, -3,  0,  2, -3, -2,  0,  1,  0, -2,  2,
-    3, -1, -1,  0,  0,  0,  0,  3,  2, -2, -2, -2, -1, -1, -1,  2,
-    2,  2,  3,  4,  3,  1,  0, -1,  1,  0,  1,  2,  1, -1, -2, -2,
-    2,  1,  2,  1,  1,  0, -1, -1,  4,  3,  4,  3,  2,  1,  1,  1,
-    3,  2,  2,  2,  1,  1,  1,  1, -1, -2, -1,  0, -1, -1, -1, -1,
-   -3, -3, -2, -1, -2, -2, -2, -2, -4, -4, -3, -3, -4, -4, -3, -3,
-    2,  1, -1, -3, -4, -2,  3,  4,  2,  2,  1, -1, -3, -2,  1,  2,
-    1,  2,  3,  3,  0, -2, -1, -2, -1,  0,  2,  4,  2,  0, -1, -3,
-   -2, -2,  0,  3,  3,  2,  0, -3,  0, -2, -3, -1,  1,  2,  2, -1,
-    3, -1, -4, -5, -3,  0,  2,  0,  6,  3, -2, -6, -5,  0,  3,  1,
-   -2,  3, -2,  0,  3, -2, -2,  1, -3,  4, -3,  0,  3, -2, -1,  2,
-   -3,  5, -3,  0,  4, -2, -1,  2, -2,  4, -4, -1,  3, -3, -2,  2,
-   -3,  4, -3,  0,  3, -3, -1,  2, -2,  5, -2,  0,  3, -3, -1,  2,
-   -2,  4, -3,  1,  3, -2, -1,  2, -2,  3, -2,  1,  3, -2,  0,  2,
-    1,  0,  0, -1,  1,  2, -4, -1,  2,  0,  0, -1,  1,  2, -4, -2,
-    1,  1,  1, -1,  2,  4, -2,  0,  0, -1,  1, -1,  2,  5, -1,  1,
-    0, -1,  0, -2,  1,  5, -1,  1,  0, -1, -1, -2,  0,  3, -3, -1,
-    1,  1,  0, -2,  0,  3, -3, -1,  1,  1,  0, -3,  0,  3, -2,  0,
-    1,  0, -1,  1,  1,  2,  4,  5,  1,  0, -1,  1,  1,  1,  5,  7,
-    0,  0, -2, -1, -1,  0,  3,  5,  0, -1, -2, -1, -1, -1,  2,  3,
-    0, -1, -3, -1, -1, -1,  1,  2, -1, -2, -4, -2, -2, -2,  0,  0,
-   -1, -2, -2, -1, -2, -2,  0,  0,  0, -1, -1,  0, -1, -1,  0,  0,
-    3,  3,  0, -1, -1,  1,  4,  4,  2,  3,  0, -2, -2,  0,  1,  1,
-    2,  3,  1, -1, -1,  0,  1,  0,  1,  2,  0, -1, -1, -1,  0, -2,
-    0,  1,  0, -1, -2, -1,  0, -2,  0,  1,  0, -1, -2, -1,  1,  0,
-    1,  1, -1, -3, -4, -3,  1,  3,  1,  2, -1, -3, -5, -4,  1,  3,
-   -3, -2,  0,  1,  1,  1,  0, -2,  0,  1,  1,  1,  0,  0, -1, -3,
-    1,  2,  1,  1,  0, -1, -1, -2,  0, -1, -3, -1, -1, -1,  0, -1,
-    0, -3, -6, -3, -2, -1,  1,  1,  2, -1, -4, -3, -2,  0,  2,  2,
-    5,  4,  1,  1,  0,  1,  3,  2,  5,  4,  2,  1,  0, -1,  0,  1,
-   -2,  0, -2, -5, -6, -3,  0,  0, -2,  0,  1,  0, -1,  1,  2,  2,
-   -2,  0,  1,  3,  2,  2,  2,  1, -2,  0,  2,  4,  3,  2,  1,  1,
-   -2,  0,  2,  3,  2,  0, -1,  0, -3, -1,  1,  1,  0, -1, -1,  1,
-   -4, -1,  1,  0, -1, -2,  0,  2, -4, -1,  0, -1, -1, -2,  1,  4,
-   -3,  0,  0, -1,  1,  1,  1,  0, -3,  1,  0, -1,  0,  0, -1, -1,
-   -1,  3,  3,  0,  1,  0,  0,  1, -3,  2,  2, -2, -1,  0,  0,  1,
-   -5,  0,  0, -2, -1,  1,  0,  2, -7, -2,  1,  0,  1,  2,  2,  2,
-   -5,  0,  3,  2,  3,  3,  2,  2, -3,  2,  4,  1,  0,  0, -2, -3,
-    5,  2, -2, -2,  0, -1, -1, -1,  2, -1, -4, -3, -1, -2, -1, -1,
-    0, -2, -2,  1,  2, -1,  0,  1, -1, -2, -1,  3,  3, -1,  0,  2,
-    1,  0,  0,  3,  3, -2, -1,  2,  2,  1,  1,  3,  2, -2, -2,  0,
-    1,  0, -1,  1,  1, -3, -3, -2,  1,  0,  1,  2,  3,  0,  0,  0,
-   -4, -5, -3,  0,  1, -1, -2, -1, -2, -3, -1,  1,  2,  0,  0,  0,
-    1,  1,  2,  1,  2,  1,  1,  1,  3,  4,  3,  1,  0, -2, -1, -1,
-    3,  3,  2,  0, -2, -3, -3, -2,  1,  1,  0, -1, -2, -4, -2, -2,
-    2,  1,  0,  0,  0, -1,  0,  1,  2,  1,  1,  1,  1,  1,  1,  3,
-    0,  0,  0, -1, -2, -1,  1,  0, -2, -1, -1, -2, -3, -2,  0,  0,
-   -1,  0,  0, -1, -2,  0,  1,  1,  1,  1,  0, -1, -1,  1,  3,  1,
-    2,  2,  0, -2, -1,  2,  3,  0,  3,  1, -1, -1,  1,  4,  2, -2,
-    2,  0, -3, -1,  3,  5,  0, -5,  1, -1, -2,  0,  3,  3, -1, -6,
-   -1,  0,  3,  4,  2,  0,  1,  2, -2, -1,  0,  1, -1, -2,  0,  1,
-   -2, -3, -2, -3, -6, -7, -6, -3,  2,  2,  3,  1, -1, -2, -3, -2,
-    2,  2,  3,  1,  0,  0,  0,  0,  2,  1,  1,  0,  1,  1,  0,  1,
-    1,  0,  0,  0,  0,  1,  1,  2,  1,  0, -1,  0,  0,  2,  2,  1,
-    1,  1,  3,  1, -1, -1, -1,  1, -2, -1,  0,  0, -2, -2, -1,  2,
-   -2, -2,  1,  1,  1,  0,  1,  3, -2, -2,  0, -1,  0, -1,  0,  2,
-    0,  0,  1,  0, -1, -1, -2,  1,  3,  2,  2,  1,  0, -2, -2,  1,
-    5,  3,  3,  2,  1,  1,  1,  4,  0, -3, -4, -5, -4, -3, -1,  1,
-   -6, -4, -1,  2,  2,  0,  0, -1, -4, -2,  1,  3,  3,  2,  2,  0,
-   -3, -2, -1,  2,  3,  3,  2,  0, -3, -2, -2,  1,  2,  1,  1, -1,
-   -2, -2, -2,  0,  2,  2,  1, -1, -1, -1, -1,  1,  2,  3,  2,  0,
-   -1, -1, -2,  1,  2,  2,  2, -1,  0, -1, -2,  0,  2,  1,  0, -1,
-    6,  4,  2,  1,  0,  0,  0,  1,  4,  2, -1, -2, -2, -2, -1, -1,
-    2,  1, -1, -2, -2, -2, -2, -1,  2,  2,  0, -2, -2, -2, -1,  0,
-    0,  0, -1, -2, -2, -1,  0,  1, -3, -3, -2, -1, -1, -2, -1,  0,
-   -3, -2,  2,  3,  2,  0, -1, -2, -2,  0,  4,  5,  5,  2,  0, -1,
-    5,  4,  2,  0, -1, -2, -1, -1,  4,  3,  2,  1,  0, -1,  0, -1,
-    1,  1,  0,  1,  1,  0,  1, -1, -2, -1, -1,  0,  0, -2, -2, -3,
-   -1,  0,  0,  0, -1, -3, -3, -5,  0,  1,  1, -1, -1, -2, -2, -3,
-   -1, -1, -1, -2, -1,  1,  3,  1, -1, -2, -2, -1,  2,  5,  6,  5,
-   -3, -3, -2,  1,  1, -2, -1, -1,  1,  2,  3,  4,  1, -3, -1, -3,
-    3,  2,  0,  1, -1, -3, -1, -3,  1,  0, -1,  0, -1, -1,  1,  0,
-    1,  1,  0,  1,  2,  2,  5,  3,  1,  1,  1,  2,  2,  2,  3,  0,
-   -3, -1, -2, -2, -3, -3, -1, -3, -1,  1,  1,  0, -1, -1,  0, -2,
-    2,  0, -2, -2,  2,  4,  1, -2,  1,  0, -2, -1,  3,  5,  2, -1,
-   -1, -2, -3, -2,  1,  3,  1, -2, -1, -2, -1, -1,  0,  2,  1, -1,
-    0,  0,  1,  1,  1,  2,  2,  0,  0,  1,  4,  4,  2,  2,  3,  1,
-   -2, -1,  2,  1, -2, -3, -2, -3, -1,  0,  1,  0, -3, -4, -4, -5,
-    4,  0, -3, -4, -4, -4, -2, -1,  5,  0, -1,  0, -1, -3, -2, -1,
-    4,  0,  0,  1,  1,  0,  0,  0,  0, -3, -2, -1,  0,  0,  1,  0,
-    0, -2,  0,  0,  1,  1,  2,  1,  2,  0,  0,  0,  1,  1,  1,  0,
-    2,  0, -1, -1,  1,  1,  1,  0,  1, -1, -2, -2,  0,  2,  2,  2,
-   -3, -5, -2,  0, -1, -3, -3,  0,  0, -2,  0,  2,  2,  0,  0,  3,
-    2, -1, -2,  0,  0, -1, -1,  2,  5,  2, -1, -1, -1, -1, -1,  2,
-    5,  2,  0, -1, -1,  0, -1,  2,  2,  1,  0,  0,  0,  1,  0,  2,
-   -1, -1,  1,  1,  2,  2,  1,  2, -3, -2,  0,  0,  0,  0, -2, -1,
-    0,  3,  2,  0, -2, -3, -3, -3,  0,  3,  3,  1,  0,  0,  1,  2,
-   -1,  0, -1, -2, -1, -1,  1,  3, -1,  0, -1, -2, -1, -1,  0,  2,
-   -1,  0, -1, -2,  0,  0, -1,  2, -1,  0, -1, -2, -1, -1, -2,  1,
-    0,  1,  0, -3, -1, -1, -1,  2,  5,  5,  2, -1, -1, -1,  1,  3,
-    0,  0,  1, -1, -3, -2,  0,  2,  1,  1,  3,  0, -2, -2,  0,  1,
-    1,  1,  3,  1,  0,  0, -1, -1,  0, -1,  2,  1,  1,  0, -1, -3,
-   -1, -2,  1,  1,  1,  0, -2, -4, -1,  0,  2,  1,  1,  0, -1, -3,
-    1,  1,  3,  2,  1,  0, -2, -3,  2,  2,  4,  2,  1, -1, -2, -4,
-    1,  2,  2,  2,  0, -2,  0,  2, -1, -1, -2, -3, -4, -5, -3,  1,
-    0,  1,  1,  0, -1, -1, -1,  1,  0,  1,  1,  1,  0,  0,  0,  2,
-    0,  1,  1,  2,  1,  1,  1,  2, -1, -1,  0,  2,  2,  2,  2,  3,
-   -2, -4, -4, -1, -2, -2, -2,  0,  1,  0,  0,  1,  0,  0,  0,  1,
-    0, -1, -3, -2,  0,  2,  2,  1,  0, -1, -2, -3,  0,  1,  1,  2,
-    1,  0, -2, -3, -1,  0,  0,  1, -1,  0, -1, -2,  0,  0, -1,  0,
-   -1,  1,  1,  0,  2,  2,  0,  0,  0,  2,  3,  1,  3,  5,  3,  2,
-   -1,  1,  1, -2,  0,  3,  1,  1, -1,  0,  0, -4, -4, -1, -1, -1,
-   -1,  1,  1,  0,  1,  2,  1,  2, -3,  0,  1,  0,  1,  1,  0,  2,
-   -5, -3, -1, -1,  0,  1,  0,  1, -4, -3, -2, -3, -2, -1, -1,  0,
-    0,  0, -1, -2, -2, -2, -2,  0,  3,  4,  2,  0,  0,  0,  0,  1,
-    2,  1,  0,  0,  0,  0, -1,  0,  0,  1,  2,  3,  4,  4,  3,  2,
-   -1,  4,  7,  4,  0,  0,  0,  0, -1,  4,  6,  3,  0,  1,  1,  1,
-    0,  3,  4,  0, -1,  0,  0,  1,  0,  1,  1, -2, -1,  0, -1, -1,
-   -1,  0, -1, -1, -1,  0,  0,  0, -1, -1, -1,  0,  0,  0,  0,  0,
-   -1, -3, -3,  0,  1, -1, -2, -1, -3, -4, -4, -2, -1, -2, -2, -1,
-    2,  2,  1,  0,  1,  1,  0, -3, -2, -1,  0,  0,  1,  1,  0, -3,
-   -2, -1,  0,  1,  2,  1,  1, -2,  1,  2,  2,  2,  3,  3,  2, -1,
-    1,  2,  1,  0,  1,  1,  2, -1,  0,  1, -2, -4, -2,  0,  1, -1,
-    1,  1, -1, -3, -2,  0, -1, -3,  1,  2,  0, -1,  0,  1, -1, -4,
-   -1, -1, -2, -2,  0,  3,  4,  3,  1,  1, -1, -3, -2,  0,  0,  0,
-    2,  2,  2,  2,  2,  1, -1, -1,  1,  1,  1,  3,  3,  0, -2, -2,
-    0, -1, -1, -1,  0, -2, -1, -1, -1, -3, -4, -3, -2, -2,  0,  2,
-   -1, -1,  0,  1,  2,  2,  3,  5, -2, -1, -1,  0,  0,  0,  0,  1,
-   -2, -3,  2,  0,  0,  1,  1, -1, -1, -4,  1, -2, -1,  2,  2,  0,
-    1, -4,  0, -2, -2,  1,  1, -1,  2, -3,  1, -1, -1,  1,  1, -1,
-    3, -2,  3,  1,  0,  1,  1, -1,  1, -3,  2,  1,  0,  1,  0, -1,
-   -1, -5,  1,  0, -1,  0,  1,  1,  0, -3,  3,  3,  1,  2,  3,  3,
-    0, -1, -2,  1,  5,  5,  2, -1,  1, -1, -2, -1,  1,  1, -2, -5,
-    1,  1, -1, -2, -1, -1, -1, -3,  1,  1, -1, -1, -1,  2,  4,  3,
-   -1, -1, -1, -1, -1,  0,  4,  3, -1, -1,  0,  1, -1, -3, -1, -1,
-    0,  0,  0,  2,  2,  0,  0, -1,  0, -2, -3,  0,  1,  1,  3,  2,
-    2,  3,  2,  1,  0,  0, -2, -2,  2,  3,  0,  1,  1,  3,  3,  2,
-    0,  0, -3, -1, -1,  2,  2,  3, -2, -2, -3,  1,  1,  2,  1,  1,
-   -2, -1, -2,  2,  1,  1, -1, -2,  0,  1,  0,  2,  0,  0, -2, -2,
-    0,  1,  0,  2,  0,  0, -2, -2, -3, -2, -2,  0, -1, -2, -2, -3,
-    0,  1, -1,  3, -1,  1,  3, -1,  0,  1, -1,  3, -1, -1,  2, -3,
-    1,  1, -2,  3, -1, -3,  0, -3,  2,  2, -2,  3,  0, -2,  1, -2,
-    1,  1, -3,  3, -1, -2,  1, -3,  1,  1, -3,  3,  0, -1,  1, -2,
-    1,  2, -1,  4,  0, -1,  1, -2,  0,  1, -1,  3, -1, -3,  0, -3,
-   -3, -3, -1,  1,  2,  1, -1, -2, -2, -2,  0,  2,  1,  0, -2, -2,
-   -3, -2,  1,  2,  1, -1, -2, -1, -3, -2,  2,  4,  0, -2, -2,  1,
-   -3, -1,  2,  4,  0, -2, -2,  2, -1,  1,  4,  3, -1, -3, -2,  2,
-    0,  2,  4,  2, -1, -2, -1,  2,  0,  1,  2,  0, -1,  0,  1,  3,
-    3,  0, -5,  1,  4,  0,  0,  1,  1, -2, -5,  2,  5, -1, -2,  1,
-   -1,  0,  0,  3,  3,  1,  0, -1, -2,  3,  4, -2, -3, -1,  0, -2,
-   -3,  3,  5, -3, -3,  0,  0, -2, -1,  3,  2, -2, -2,  2,  2, -1,
-    2,  0,  0, -1,  0,  0,  0,  0,  0, -3, -2,  1,  3,  0, -2, -2
-};
-
-/* list of codebooks for inter-coded vectors */
-const int8_t* const ff_svq1_inter_codebooks[6] = {
-    svq1_inter_codebook_4x2, svq1_inter_codebook_4x4,
-    svq1_inter_codebook_8x4, svq1_inter_codebook_8x8,
-    NULL, NULL,
-};
-
-/* 6x16-entry codebook for intra-coded 4x2 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x2)[768] = {
-   12, 13, 13, 11, -7,-10,-15,-17,-16,-15,-12,-10, 11, 15, 15, 12,
-    2, 17, 20, 15,-45,-24,  2, 13, 21, 20, -6,-36, 12, 16, -1,-27,
-  -18,-21, 10, 45,-11,-20, -7, 21, 43, -8,-28,  0, 33,-16,-28,  3,
-  -12,-18,-18, -6,-20,-10, 28, 55, -5,-18,-21,-18, 56, 30, -6,-20,
-  -34, 27, 29,-22,-30, 29, 26,-25, 30, 34, 33, 26,-25,-31,-35,-33,
-  -31,-35,-36,-32, 29, 36, 37, 31,-71,-12, 38, 34,-63, -1, 42, 33,
-   58, 37,-31,-60, 55, 34,-33,-61,-57,-57, 22, 93,-57,-58, 21, 93,
-   59, 69, 70, 62,-63,-68,-68,-60,-64,-71,-71,-64, 63, 73, 72, 62,
-   -2,  0,  7, 15,-11,-10, -3,  5, -5, -8,-10,-10,  1,  9, 14,  9,
-   15,  8, -4,-11, 12,  2,-11,-12, -8,  0, 19, 28,  4, -1,-15,-26,
-  -15, 27,  2,-14,-14, 22,  1, -9, -4, -6,-13,-10, -6,-14,  6, 47,
-  -35,-20,  6, 23,  6,  9,  6,  4, -6,  2, 23,-22, -7,  4, 28,-21,
-   20,-22, -2,  6, 22,-28, -5,  8,-10,-18,-16,-12, 36, 19,  2, -1,
-   -3,  0,  4,  8,-45,-10, 23, 23, 40, 15,-20,-35, -4, -1,  4,  1,
-    9, -5,-33, 24,  8,  3,-26, 19, -1,  4,  6, -3, 32, 25,-13,-49,
-   24, 24, 15,  7,-17,-27,-19, -7,-47,  0, 39, 24,-21, -6,  7,  4,
-   -1,  0,-10,-13,  1,  1,  5, 16, 20,  5, -3, -9, -1, -4, -2, -6,
-  -17, -7,  1,  4, 12,  7,  0,  0,  3,  0, 12, 11, -3,  1,  0,-23,
-    4, 17, -6,  0,  6,  3,-25,  0,-17, 10,  8,  5,-14,  4,  1,  4,
-   13, 10,  4,  2,-23, -9,  1,  2,  3, -3,  1,  7,  1,-23, -7, 20,
-   -7,-18,  2, 12, -5, -4, 10,  9,  4, 10,  7,-24,  6,  3,  4,-10,
-   22,-14,-22,  6,  0,  5,  5, -1, -4,  3,-11, -4, -7, 31,  7,-14,
-   -5,-16, -1, 42, -4, -2, -9, -5,  5, -8, -6, -3, 42, -4,-21, -5,
-  -18, 12, 20,-12, 13,-13,-10,  7, -8, -9, -2,-18,-16,  6, 40,  8,
-   10, -1,  0,  4, -3,  4, -1,-13, -2,  6,  1,-15,  5,  3,  1,  2,
-   -4, -2,  1,  3, 15,  0, -9, -4, -3, -4, -4, -4, -3,  5, 16, -3,
-    2, 13,  3,  4, -3, -8,-10,  0, -6, -2, -4, -1, -2, -3, -6, 23,
-    6, -6,  7,  1,  4,-18,  5,  1, -1,  1,-15, 14, -5,  6, -4,  4,
-    2,  2,  2,  6,-24,  2,  7,  3,-26,  0,  3,  3,  5,  7,  1,  6,
-   14, -2,-18, -3,  7,  5, -4,  2, -6,  3, 32,  1, -6, -6, -6,-12,
-    5,-36,  7,  6,  9, -1, 11,  0,  4,  4,  5,  3,  4, 15,  3,-38,
-   10, 23, -5,-42,  0,  4,  4,  4, 23, 17, -6,-13,-13,-37,  1, 29,
-    5,-14, -1,  1,  5,  0,  3,  1,  0,  4, -5,  2,  8,  0,  0,-10,
-    4,  7, -2, -3,-10,  3,  1,  1,-12, -1, 13,  3,  0, -1,  1, -3,
-    0, -1,  3,  1, -6, -9,  3,  9, -6,  1, -4, -6,  8, -1,  0,  8,
-   -3, -3,  0, 18, -5, -1, -4, -1, -8, -2,  3, -4,  0, 17, -1, -5,
-    5, -2,  9,-10,  1, -5,  6, -5,  4,  2,  2,  3, 10,-14, -8,  1,
-   -1, -2,-18, -1, -1, 20,  1,  2, -1,  1, -9,  1, -1, -9, 22, -4,
-    6, -4,  8, -3, -1,  7,-19,  5, -7, 31, -4, -4, -6,  0, -5, -5,
-   -7, -8,-19, -4,  1,  1,  4, 32, 38, -1, -8,  4, -7, -8, -6,-12,
-   -1,  0, -7,  1, -1,  9, -1,  0,  9, -1, -1,  0,  2, -6,  1, -3,
-  -12,  0,  2,  1,  1,  1,  8,  0,  9,  1,  0,  2, -2,  1,-11,  0,
-    0,  8,  2,-10, -1,  2, -1,  0, -2, -4,  0, -5, -2, -1, -1, 14,
-   -3,  7, -1,  5,  0,-10,  1,  1, -1, -5, 14, -1, -2,  1, -3, -2,
-   -6,  0,  0,  6,  2,  3, -9,  4,  4, -5, -1, -1, -7,  3,  8, -1,
-    2, -4, -1,-11, 11,  2,  1,  0, -1,  2,  3,  9,  0,  2,  0,-15,
-    3,  5,-20,  3,  3, -1,  3,  3,  1, -1, 16,  1,  2,-29,  9,  2,
-  -13, -6, -1, -3, 36, -1, -8, -3,  2,  5,  4,  2,-37,  9, 11,  3
-};
-
-/* 6x16-entry codebook for intra-coded 4x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_4x4)[1536] = {
-  -11, -3,  3,  6,-10, -1,  5,  7, -9, -1,  6,  7, -9, -1,  4,  6,
-    5,  7,  0,-14,  6,  9,  2,-15,  6,  9,  2,-15,  4,  6,  0,-14,
-   16,  3, -5, -6, 16,  1, -8, -8, 14, -1, -9, -9, 12,  0, -8, -8,
-    8, 12, 16, 17, -2,  2,  6,  9,-10, -8, -4,  0,-15,-14,-11, -7,
-   -7,-10, -2, 16, -7,-11, -3, 18, -7,-11, -1, 20, -6, -8,  1, 19,
-   -9,-13,-16,-17,  2, -2, -7, -9, 11,  8,  4, -1, 16, 15, 11,  7,
-  -22, -2, 13, 15,-24, -2, 14, 16,-25, -4, 13, 15,-25, -6, 10, 13,
-   26, 26, 22, 16, 17, 15,  9,  3, -2, -6,-11,-14,-20,-25,-28,-28,
-  -27,-27,-25,-21,-16,-15,-11, -7,  3,  8, 12, 13, 23, 28, 31, 30,
-   20, 16, -7,-33, 22, 19, -6,-35, 22, 19, -6,-34, 20, 17, -6,-32,
-  -20,-20,  2, 38,-21,-22,  2, 40,-21,-22,  2, 40,-20,-20,  3, 38,
-  -47, -4, 24, 26,-50, -3, 26, 27,-50, -3, 26, 27,-47, -4, 24, 26,
-   45,  6,-23,-27, 48,  5,-25,-28, 48,  5,-26,-28, 44,  6,-24,-27,
-  -30,-36,-10, 76,-31,-37,-11, 78,-31,-37,-11, 78,-31,-36,-10, 77,
-  -53,-32, 35, 52,-54,-34, 36, 52,-54,-34, 36, 52,-53,-33, 34, 51,
-  -93,-34, 62, 65,-93,-34, 62, 66,-93,-34, 62, 65,-93,-34, 60, 64,
-   -7,  0,  2,  2, -8, -1,  3,  3, -8,  0,  4,  5, -6,  1,  5,  5,
-    3,  7, 11, 11,  2,  2,  3,  3,  1, -2, -6, -7,  1, -5,-11,-13,
-    3, -2, -4, -3,  7,  0, -5, -5, 12,  4, -5, -7, 14,  6, -4, -7,
-   18, 14,  3, -2,  6,  4,  0, -3, -8, -5, -2,  0,-16,-11, -2,  2,
-   -8, -6,  7, 18, -7, -8,  2, 13, -4, -6, -2,  6,  0, -4, -3,  1,
-    1, -3,-13,-18,  0, -1, -5, -7, -1,  1,  6,  7, -2,  4, 15, 17,
-  -15,-14, -7, -2, -6, -5, -1,  0,  6,  6,  3,  1, 15, 13,  6,  1,
-    2, -2,-11, 10,  2, -1,-12, 11,  3, -1,-12, 11,  2, -2,-11, 11,
-   -9, 14, -1, -5, -9, 15, -2, -5, -8, 16, -2, -5, -7, 15, -1, -4,
-    2,  6,  8,  8, -2,  3,  9, 12,-11, -5,  4, 10,-19,-16, -8,  0,
-   14,  8, -7,-15, 12,  7, -7,-14,  8,  5, -4, -9,  5,  3, -1, -4,
-   12,-14, -2,  2, 13,-15, -1,  3, 14,-15, -1,  3, 13,-14, -1,  3,
-    0,  6, 10,-13,  0,  6, 10,-15,  0,  7,  9,-17,  1,  6,  8,-16,
-   -8, -5, 15, -2, -8, -6, 17, -2, -8, -6, 16, -3, -8, -5, 15, -2,
-   -9,-11,-11,-10,  9, 10,  9,  8,  8, 10, 10,  9, -8, -9, -8, -7,
-    9, 10,  9,  7, -8,-10,-10,-10, -7,-10,-11,-11, 11, 12, 11,  8,
-    0, 10,  7,  0,  0,  7,  0, -6,  0,  2, -5, -6, -2, -1, -4, -1,
-    5,  0, -6, -9,  2,  2,  2,  1, -2,  0,  5,  7, -6, -5,  1,  4,
-    3, -8,  2, -1,  4, -9,  3,  0,  5, -7,  3,  0,  7, -5,  3,  0,
-   -5, -3,  2,  9, -6, -3,  1,  8, -6, -3,  1,  7, -5, -2,  0,  4,
-   13,  8,  3,  1, -3, -5, -4, -1, -8, -7, -3,  0, -1,  1,  3,  2,
-    3,  2, -5,-12,  4,  3, -2, -9,  3,  4,  1, -4,  3,  5,  4, -1,
-   -9, -8, -4,  0,  8,  6,  2,  0, 10,  8,  3,  0, -6, -5, -3, -1,
-   -3, -9,-12, -5,  0, -3, -5,  0,  2,  3,  2,  4,  5,  8,  7,  6,
-   -1, -2,  5, 12, -1, -1,  5,  9,  2,  1, -1, -2,  2, -1,-11,-17,
-   -7,  3,  3, -1, -9,  3,  4, -1,-10,  4,  6, -1, -9,  5,  7,  0,
-  -18, -7,  2,  2, -8,  1,  5,  3,  3,  4,  1,  0,  9,  5, -2, -3,
-   -2,  0,  6,  8, -4, -5, -5, -3,  1, -2, -6, -8, 10,  9,  3, -1,
-    0, -2, -2,  0,  0, -4, -5,  0, -2, -8, -4,  8, -5, -7,  6, 24,
-    9,  1, -7,  1,  9,  1, -8,  1,  8,  0,-10,  1,  8, -1,-11, -1,
-    8,  8,  6,  3,  5,  4,  3,  2, -2, -3, -1,  0,-10,-13, -8, -4,
-    0,  4,  2, -3,  0,  6,  3, -5,  3, 10,  2,-12,  5, 10, -4,-22,
-    0, -4, -1,  3,  1, -4, -1,  5,  1, -5,  0,  8, -1, -6, -2,  7,
-   -1, -1, -2, -4, -1, -2, -4, -6, -1, -1, -1, -2,  1,  5, 10,  9,
-   10,  3,  0, -2,  6, -1, -2, -5,  3, -1, -2, -6,  2,  0,  0, -5,
-    6,  3,  0,  0,  6,  3,  1,  1,  4, -2, -2,  1,  0, -9, -9, -2,
-  -11, -3,  1,  2, -6,  2,  4,  5, -3,  2,  3,  4, -2,  1,  1,  2,
-   -6, -4, -1, -2,  2, -1, -1, -2, 10,  2, -2, -2, 11,  2, -4, -1,
-    6,  0, -2,  2,  3,  3,  0,  0, -6,  3,  3,  0,-17, -1,  5,  0,
-   -1,  4, 10, 11, -3, -2,  0,  1, -3, -4, -5, -3, -1, -2, -2, -1,
-    2, -3, -9,-12,  3,  3,  3,  2,  2,  2,  4,  4,  2,  1, -1, -2,
-   -2,  9,  5,-10, -3,  5,  5, -5, -2,  1,  2,  0, -1, -2, -2,  1,
-   -2, -3,  7, -2, -1, -3,  7, -3, -1, -2,  8, -4, -2, -2,  7, -3,
-    1, -8, -3, 12,  2, -2, -2,  4,  1,  3,  0, -5, -1,  5,  2, -7,
-   -1,  3,  1, -5, -7, -2,  3,  1, -2, -7, -2,  2, 20,  3, -5, -1,
-    5,  0, -3, -2, -7, -7,  0,  6, -6,  0,  7,  6,  2,  6,  0, -7,
-   -2,  6, -7,  1, -2,  7, -8,  3, -2,  7, -7,  3, -1,  7, -6,  2,
-   -5, -2,  5,  7,  4,  1, -4, -8,  6,  3, -2, -5, -7, -5,  3,  7,
-   -1, -1,  6,  5,  0, -1,  1, -4,  2,  1,  0, -7,  1,  0,  0, -4,
-   -8,  0,  3,  1, -2,  1, -1, -1,  1, -1, -3,  1,  1, -2,  1,  9,
-    5,  2, -3, -4, -1,  0, -1, -3, -3,  1,  3,  1, -4,  0,  4,  2,
-    2, -2, -2, 12,  0, -2, -5,  3, -1,  0, -3,  1, -3, -1, -2,  1,
-    1,  5,  3,  0, -6, -4, -2,  1,  0, -2, -2,  2,  6,  1, -4, -1,
-   -3, -5, -5, -1,  3,  5,  5,  4,  0,  3,  1, -1, -2,  1, -2, -3,
-    2, -4, -5, -3,  4, -2, -3, -2,  6,  0, -1, -1,  7,  1,  0,  0,
-   -3, -2, -2,  0, -2, -3, -5, -1, -2,  2,  0, -1, -1, 11,  9, -1,
-    0,  1, -1,-10, -1,  1,  0, -6,  1,  0,  1,  4,  2, -5, -1, 13,
-   -2,  4,  5,  0, -5,  1,  6,  3, -6, -2,  3,  2, -5, -2,  0, -2,
-   -1,  1,  1, -2, -1, -2,  0,  2,  5,  5,  5,  7,  0, -4, -8, -7,
-    0,  2, -1, -5, -1,  2,  2, -3,  0,  5,  3, -5,  3,  8,  2,-12,
-    8,  4,  0, -2, 10, -1, -4, -1,  3, -6, -3,  0, -4, -5,  0,  0,
-    0,-10, -4,  2, -1, -6,  3,  5, -1, -3,  6,  4,  0, -2,  4,  2,
-    0,  8,  1, -1,  0, 11,  1, -3, -1,  6, -2, -4, -3, -2, -7, -4,
-    0, -1, -1, -1,  4,  5,  6,  5, -5, -9, -8, -5,  2,  2,  3,  2,
-    0,  2,  6,  1,  2,  0,  3,  0,  1, -2, -1, -2,  0, -1, -3, -6,
-    0,  0,  2,  0,  4,  0,  2,  1,  5, -2,  0,  0, -2, -9, -1,  2,
-    0,  1,  0,-10, -1,  1,  8,  0, -1, -2,  4,  0,  1, -1,  2, -1,
-   -3, -2,  2, -1, -3, -1,  2, -3,  0, -1,  1,  0,  8,  1, -1,  3,
-    0,  1,  1,  2,  0, -4, -2,  0, -1, -5,  1, -1, -2, -1, 11,  2,
-    1,  5, -2, -2,  0,  2, -4,  0, -2,  1, -5,  1,  0,  5,  0,  1,
-   -5, -3,  0,  6, -4,  2,  0,  0, -3,  5,  1,  0, -3,  3,  0,  0,
-    3, -2, -3,  1,  1, -4,  0,  8, -2, -3, -2,  3,  1,  2, -1, -1,
-    1,  1,  0,  2,  2,  0,  1,  6,  1, -1,  2,  1,  0,  3,  0,-19,
-    1, -3, -2,  2,  6,  5, -2, -7, -3,  1,  3,  1, -1, -1,  0,  2,
-   -8, -1, -1, -4,  1,  1, -1,  2,  4,  3,  2,  3, -5,  1,  3,  0,
-    0,  2, -1,  1, -3,  0,  0,  5, -5, -2,  0,  8, -4, -4, -4,  6,
-    1,  2,  1,  2,  2,  2, -3,  2,  4,  0, -9,  0,  7,  0,-11,  1,
-    0,  0,  0, -2,  3,  3, -1, -6,  4,  3, -3,-10, -1,  2,  6,  2,
-    7, -2, -3,  5, -4,  0,  3, -1, -4,  2,  1, -7,  2, -1, -1,  3,
-    3,  2,  2,  2, -5, -7, -7, -5,  5,  6,  4,  2, -2, -1,  0,  1
-};
-
-/* 6x16-entry codebook for intra-coded 8x4 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x4)[3072] = {
-    5,  6,  6,  6,  7,  7,  8,  8,  0,  0,  0,  0,  0,  1,  2,  3,
-   -3, -4, -4, -5, -5, -4, -3, -2, -4, -4, -4, -5, -4, -4, -3, -3,
-    1,  2,  2,  2,  2,  3,  3,  3,  2,  3,  3,  4,  4,  5,  5,  5,
-   -1,  0,  1,  1,  2,  3,  4,  4, -9,-10, -9, -9, -8, -7, -6, -5,
-   -4, -4, -5, -6, -6, -7, -7, -7,  0, -1, -2, -2, -3, -3, -4, -4,
-    4,  4,  3,  3,  2,  1,  1,  0,  7,  7,  7,  6,  6,  5,  4,  4,
-    2,  4,  5,  6,  4,  1, -3, -6,  3,  4,  5,  5,  4,  0, -5, -8,
-    2,  3,  4,  4,  2, -2, -7,-10,  2,  2,  2,  1,  0, -4, -9,-12,
-   -9, -7, -3,  1,  4,  4,  3,  3,-10, -7, -2,  3,  5,  5,  3,  3,
-   -9, -6, -2,  3,  6,  5,  4,  3, -8, -6, -1,  3,  4,  4,  3,  2,
-   -5, -5, -5, -5, -3,  1,  4,  7, -5, -5, -5, -4, -2,  1,  6,  8,
-   -4, -5, -4, -3, -1,  3,  8, 10, -3, -4, -3, -2,  1,  5,  9, 11,
-   -2, -2, -2, -2, -2, -2, -2, -2, -4, -5, -5, -5, -5, -5, -5, -4,
-   -3, -4, -4, -4, -4, -4, -4, -3,  9, 10, 10, 11, 11, 11, 10, 10,
-    7,  4,  1, -2, -4, -6, -9,-10,  9,  7,  3,  0, -2, -4, -8, -9,
-   11,  8,  4,  2,  0, -3, -6, -8, 11,  9,  5,  3,  1, -2, -5, -7,
-  -13,-13,-13,-12,-11,-10, -8, -8,  0,  1,  2,  3,  4,  4,  4,  3,
-    3,  4,  5,  6,  6,  6,  5,  4,  3,  4,  4,  4,  3,  3,  3,  2,
-   10, 10, 11, 10,  9,  9,  8,  7,  6,  6,  6,  6,  5,  4,  3,  2,
-    0,  0,  0, -1, -2, -3, -4, -4,-10,-10,-11,-12,-13,-14,-14,-14,
-   16, 16, 17, 16, 15, 13, 12, 11, -1, -2, -3, -4, -4, -4, -4, -3,
-   -4, -5, -6, -6, -6, -6, -6, -6, -5, -6, -6, -6, -6, -6, -5, -5,
-  -13,-13,-13,-12,-11,-10, -8, -6, -9, -8, -7, -6, -4, -2,  0,  1,
-   -2, -1,  1,  3,  5,  7,  8,  9,  5,  7,  9, 11, 13, 14, 15, 15,
-   16, 14, 11,  7,  2, -3, -7, -9, 14, 12,  8,  3, -1, -6, -9,-11,
-   11,  9,  4,  0, -4, -8,-11,-13,  8,  5,  1, -3, -6,-10,-12,-14,
-  -18,-15, -9, -3,  1,  6,  9, 11,-17,-13, -7, -1,  3,  7, 11, 12,
-  -15,-11, -5,  1,  5,  9, 12, 13,-13, -9, -3,  2,  5,  9, 11, 13,
-   22, 21, 19, 15, 10,  3, -4, -9, 20, 18, 15,  9,  2, -5,-12,-17,
-   16, 13,  8,  1, -7,-14,-20,-24, 10,  6, -1, -8,-15,-21,-25,-27,
-  -25,-23,-20,-14, -7,  1,  9, 14,-23,-21,-16, -9,  0,  9, 16, 21,
-  -20,-16,-10, -1,  8, 16, 22, 25,-15,-11, -3,  6, 14, 20, 25, 27,
-   -4, -2,  0,  1,  2,  2,  2,  2, -5, -2,  0,  2,  3,  3,  3,  3,
-   -6, -4, -1,  1,  2,  3,  3,  3, -7, -5, -2,  0,  1,  1,  2,  2,
-    2,  1,  1,  1,  1,  0, -2, -3,  3,  3,  2,  1,  0, -1, -3, -4,
-    4,  3,  2,  1,  0, -2, -4, -6,  5,  4,  3,  1, -1, -3, -5, -6,
-    5,  6,  6,  4,  2,  0, -2, -3,  3,  4,  4,  4,  3,  1,  0, -1,
-   -2, -2, -1, -1, -1, -1, -2, -2, -5, -4, -3, -2, -2, -2, -3, -3,
-   -1, -1, -1, -1, -1, -1, -1, -1, -3, -4, -4, -4, -3, -3, -3, -3,
-   -1, -1, -1, -1, -1, -1, -1, -2,  5,  6,  6,  6,  6,  5,  4,  3,
-    4,  4,  4,  4,  4,  5,  6,  7,  0, -1, -1, -1, -1,  0,  1,  2,
-   -2, -3, -3, -3, -3, -2, -1,  0, -3, -3, -4, -4, -4, -3, -2, -1,
-    0, -2, -4, -4, -2,  0,  2,  3,  0, -2, -3, -3, -1,  2,  4,  5,
-   -1, -2, -4, -3,  0,  3,  5,  6, -2, -3, -4, -3, -1,  2,  4,  5,
-    9,  4,  0, -3, -3, -1,  0,  1,  8,  4, -1, -4, -3, -1,  1,  2,
-    6,  2, -3, -5, -4, -2,  0,  1,  5,  1, -3, -4, -4, -2,  0,  1,
-    5,  3,  1, -1, -4, -8,-10,-10,  3,  3,  2,  1,  0, -2, -3, -4,
-    1,  1,  1,  2,  3,  2,  1,  0, -1,  0,  1,  2,  3,  4,  3,  2,
-    0,  1,  2,  2,  1, -1, -3, -3,  0,  1,  1,  1, -1, -2, -4, -3,
-   -3, -3, -3, -3, -3, -3, -1,  2, -4, -4, -3,  0,  3,  7, 12, 14,
-   -5, -5, -6, -6, -6, -6, -6, -5,  2,  2,  2,  1,  0,  0,  0,  0,
-    4,  4,  3,  2,  1,  0,  0,  0,  6,  6,  5,  4,  2,  2,  1,  1,
-   -7, -7, -6, -3,  0,  4,  7,  8, -1, -2, -3, -3, -2, -1,  1,  2,
-    3,  3,  1, -1, -2, -2, -2, -1,  6,  6,  4,  2,  0, -2, -2, -2,
-   -6, -5, -2,  2,  5,  9, 11, 12, -4, -4, -2,  0,  2,  4,  5,  6,
-   -3, -2, -2, -2, -2, -1,  0,  1, -2, -2, -2, -3, -3, -3, -3, -2,
-   -7, -3,  1,  3,  3,  0, -3, -5, -6, -2,  3,  5,  4,  1, -3, -5,
-   -5, -1,  4,  6,  5,  2, -3, -4, -4,  0,  5,  7,  6,  3, -1, -3,
-    0,  0,  0,  0,  0,  0,  0,  0, -2, -2, -3, -3, -3, -3, -2, -1,
-    6,  7,  8,  9,  9,  8,  7,  6, -4, -4, -5, -5, -6, -6, -5, -4,
-   -9, -8, -6, -4,  0,  3,  6,  6, -5, -4, -1,  3,  5,  6,  5,  3,
-    1,  3,  6,  6,  4,  1, -2, -5,  6,  7,  5,  1, -3, -7,-10,-11,
-   10,  9,  5,  1, -3, -6, -6, -4,  5,  3, -1, -5, -6, -5, -2,  2,
-   -2, -4, -6, -6, -4,  1,  6, 10, -6, -7, -7, -4,  1,  7, 11, 12,
-    6,  5,  3,  2,  0,  0,  0,  0,  2,  1, -1, -2, -3, -2, -1, -1,
-    0, -1, -2, -4, -4, -2, -1,  1,  0,  0, -1, -2, -1,  0,  2,  3,
-    0, -1, -2, -2, -2, -2, -1, -1,  5,  4,  2,  1,  0,  0,  0,  0,
-    6,  5,  3,  1,  0,  0,  0,  0,  2,  0, -2, -4, -4, -3, -2, -2,
-   -7, -4,  0,  2,  2,  2,  2,  1, -7, -3,  0,  0,  0,  0,  0,  0,
-   -4, -1,  1,  1,  0,  0,  0,  1, -1,  1,  2,  2,  2,  2,  3,  3,
-   -2,  0,  2,  2,  1,  1,  1,  1, -1,  1,  2,  2,  1,  0,  0, -1,
-    0,  2,  4,  2,  0, -1, -2, -3,  1,  2,  3,  1, -2, -4, -6, -6,
-    1,  2,  2,  4,  5,  6,  4,  1,  0, -1, -1, -1,  0,  0, -2, -4,
-    0,  0, -1, -2, -2, -2, -4, -6,  2,  1,  0,  0,  1,  1, -1, -3,
-    1,  1,  1,  1,  1,  2,  3,  3,  0,  0,  1,  0,  1,  2,  4,  4,
-   -1, -1, -1, -1,  0,  1,  2,  3, -4, -4, -5, -5, -5, -3, -1,  0,
-   -6, -5, -5, -4, -3, -2, -1, -1, -1,  0,  0,  1,  1,  2,  3,  3,
-    0,  1,  1,  1,  2,  2,  3,  4,  0,  0, -1, -1,  0,  1,  2,  3,
-    0,  1,  1,  1,  0,  0, -1, -1,  1,  3,  3,  2,  1, -1, -2, -2,
-   -2,  0,  2,  2,  2,  2,  1,  1, -9, -8, -4, -2,  1,  3,  3,  3,
-   -1, -1, -1, -2, -3, -3, -3, -4,  0,  0,  0, -1, -2, -2, -3, -3,
-    2,  2,  2,  0, -1, -1, -1, -1,  5,  5,  4,  3,  2,  2,  2,  2,
-    6,  3, -1, -4, -3, -1,  1,  1,  2, -1, -3, -4, -1,  2,  2,  0,
-   -1, -2, -2,  1,  4,  4,  1, -3, -2, -1,  1,  4,  6,  3, -3, -8,
-    3,  3,  2,  1, -1, -2, -2, -2, -4, -4, -2, -1,  1,  3,  4,  4,
-   -4, -5, -5, -4, -2,  0,  2,  2,  7,  7,  4,  1, -1, -2, -3, -2,
-   -1,  1,  3,  0, -4, -6,  0,  6, -2,  1,  4,  1, -4, -6, -1,  7,
-   -3,  1,  4,  2, -3, -6, -1,  6, -2,  0,  3,  2, -2, -5, -1,  4,
-    1, -1, -2,  1,  4,  4, -1, -7,  1, -1, -4, -1,  5,  6,  0, -6,
-    3,  0, -4, -3,  3,  6,  2, -4,  3,  0, -5, -4,  1,  4,  1, -3,
-    2,  2,  3,  3,  3,  3,  2,  2, -4, -5, -6, -7, -7, -7, -7, -6,
-    1,  2,  3,  3,  3,  3,  2,  2,  0,  0,  1,  1,  1,  2,  2,  1,
-    3, -3, -3,  3,  4, -2, -2,  2,  3, -4, -4,  4,  4, -4, -4,  2,
-    4, -4, -4,  4,  4, -4, -3,  3,  3, -3, -4,  3,  3, -3, -3,  3,
-   -2, -2, -2, -2, -2, -2, -1, -1,  6,  7,  8,  8,  8,  7,  6,  5,
-   -5, -6, -7, -7, -8, -7, -6, -5,  1,  1,  2,  2,  2,  2,  1,  1,
-    0,  0,  0,  0,  0, -1,  0,  0, -1,  0,  0,  0,  0, -1,  0,  0,
-   -2, -3, -2, -2, -2, -3, -3, -3,  2,  3,  5,  6,  4,  2,  1,  0,
-    8,  6,  2,  0,  0,  0,  0,  0,  4,  1,  0,  0,  0, -1, -1, -1,
-    1, -1,  0,  0,  0, -1, -2, -3, -2, -2, -1,  0,  0, -2, -4, -5,
-    3,  1, -1, -2, -3, -4, -5, -5,  2,  1,  0,  0,  1,  1,  0,  0,
-    0, -1, -1,  0,  2,  2,  2,  2, -1, -2, -1,  1,  2,  2,  2,  2,
-    0, -1, -2, -1, -1, -1, -1,  0, -1, -2, -2, -1, -1,  0,  0,  1,
-    2,  1,  1,  2,  2,  1,  1,  0,  6,  5,  3,  1,  0, -2, -4, -4,
-   -3, -2, -1,  0,  1,  1,  0, -1,  0,  1,  3,  4,  5,  5,  3,  1,
-   -1, -1, -1,  0,  1,  0, -1, -2, -2, -2, -2, -1,  0, -1, -2, -3,
-    0, -1, -2, -2, -1, -1,  0,  2,  1, -1, -2, -1, -1, -1,  0,  2,
-    1,  0, -2, -2, -2, -2,  1,  5,  1, -1, -2, -2, -2,  0,  5, 10,
-    0,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1,  0,  0,  0,  1,  2,
-    1,  2,  2,  3,  4,  4,  6,  5, -3, -3, -3, -2, -2, -3, -3, -3,
-    1, -1, -2, -2,  0,  3,  5,  7,  2,  0, -2, -3, -2,  0,  2,  3,
-    3,  1, -2, -3, -3, -2, -1, -1,  3,  1,  0, -1, -1, -1, -1, -1,
-    1,  3,  5,  4,  2, -1, -3, -4, -3, -2,  1,  2,  1,  0, -1, -2,
-   -5, -3,  0,  2,  2,  1,  0,  0, -3, -1,  1,  2,  2,  1,  0,  0,
-    0, -1, -1, -1,  1,  2,  3,  4, -3, -4, -4, -3, -1,  0,  0,  1,
-   -2, -3, -2, -1,  1,  1,  1,  1, -2, -2,  0,  3,  4,  4,  3,  2,
-   -4, -4, -3, -2, -1,  1,  2,  3,  0,  1,  1,  1, -1, -2, -3, -3,
-    3,  4,  5,  4,  2, -1, -3, -3, -2, -2,  0,  2,  2,  2,  1,  0,
-   -4,  0,  5,  7,  4, -1, -4, -4, -1,  2,  4,  3,  0, -3, -3, -2,
-    2,  1,  0, -1, -2, -2,  0,  1,  0,  0, -1, -2, -2, -1,  1,  2,
-   -4, -3, -2, -1,  0,  1,  2,  2, 10,  9,  5,  0, -3, -4, -3, -2,
-    1, -1, -2, -2, -1,  0,  0,  0, -2, -2, -1,  1,  1,  1,  0, -1,
-   -5, -3,  0,  3,  4,  2,  0, -2, -2, -1,  0,  1,  1,  0, -1, -1,
-    3,  2, -1, -2, -2, -1,  1,  1,  7,  5, -1, -5, -6, -2,  2,  4,
-   -2,  3,  3, -3, -4,  1,  2, -2, -3,  3,  4, -3, -4,  2,  3, -2,
-   -3,  3,  4, -3, -4,  2,  3, -2, -4,  2,  4, -2, -3,  1,  2, -1,
-    4,  3, -1, -3, -3, -1,  1,  2, -4, -6, -4,  0,  4,  5,  4,  1,
-    0,  2,  5,  6,  2, -3, -5, -4,  1,  1, -1, -3, -5, -2,  2,  4,
-   -1,  0,  1,  2,  2,  3,  3,  4, -1,  0,  1,  1,  0, -1, -1, -1,
-   -1,  0,  1,  2,  2,  1, -1, -2, -3, -2, -1,  0,  0, -1, -2, -3,
-    1,  1,  1,  1,  0,  0,  1,  2,  1,  0, -1,  0,  0,  1,  1,  0,
-    1, -2, -4, -1,  1,  2,  1,  0,  1, -4, -7, -3,  1,  3,  2,  1,
-    1,  1,  1,  1,  1,  1,  0, -1,  1,  1,  1,  0,  1,  2,  2,  0,
-    1,  1,  0,  0,  0,  2,  0, -3,  3,  2,  0, -1, -1, -2, -6, -9,
-    0,  0,  0,  1,  0,  0,  1,  2,  1,  0,  0,  0, -1, -1,  0,  2,
-    0,  1,  1,  1, -1, -3, -2,  0, -7, -5,  1,  6,  6,  2, -1, -1,
-    3,  1, -1, -3, -4, -2,  1,  4,  2,  0, -2, -3, -4, -3, -1,  2,
-    2,  2,  1,  1,  1,  0,  0,  1,  1,  1,  0,  0,  0,  0,  0,  1,
-   -1,  1,  1, -2, -5, -6, -4, -1, -1,  1,  4,  3,  2,  0,  1,  2,
-   -1,  0,  2,  3,  1,  0,  0,  1, -1,  0,  1,  0,  0, -1, -1,  0,
-    0,  1,  2,  2,  0, -2, -1,  1, -2, -1, -1, -2, -1,  2,  6,  8,
-   -1, -1, -2, -3, -2,  0,  1,  2, -1,  0,  0, -1, -1,  0, -1, -1,
-    2,  1,  1,  1,  1,  0,  0,  0,  0,  0,  1,  1,  1, -1, -1,  1,
-   -1,  0,  2,  2, -1, -3, -2,  3,  0,  2,  3,  0, -5, -7, -2,  4,
-   -1,  0,  0,  0, -1, -2, -3, -3, -1,  0, -1, -2, -2, -2, -2, -2,
-    1,  1,  0,  0,  1,  2,  0, -1,  1,  2,  1,  2,  5,  6,  2,  0,
-   -2, -4, -3,  0,  2,  2,  0, -3,  3,  1,  0,  1,  2,  1, -2, -3,
-    3,  1,  0,  0,  0,  0,  0, -1,  1, -1, -2, -2, -1,  1,  3,  3,
-    3,  2,  1,  2,  4,  3,  1, -2, -2, -4, -4, -3, -1,  0, -2, -3,
-    1,  0, -1, -1,  0,  1,  0, -1,  3,  2,  0,  0,  0,  1,  1,  0,
-    1,  1,  0,  0,  0,  0,  0,  0,  2,  3,  3,  2,  2,  2,  1,  1,
-    0, -1, -2, -3, -5, -5, -5, -4,  1,  1,  0, -1,  0,  1,  3,  3,
-   -9, -6, -2,  0,  1,  1,  2,  2, -6, -2,  1,  2,  1,  1,  0,  1,
-   -2,  1,  2,  2,  1,  1,  1,  1,  0,  2,  2,  1,  0,  1,  1,  1,
-    1,  0,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0, -1, -3, -2,  0,
-   -3, -3, -3, -2, -1,  3,  7,  9,  1,  2,  2,  2,  0, -2, -4, -3,
-    2,  0, -2, -1,  3,  4, -1, -6,  1,  0, -2, -3, -1,  3,  3,  0,
-    0,  3,  3,  0, -2, -1,  1,  1, -6, -1,  3,  2, -1, -2,  0,  1,
-    5,  3,  0, -2, -3,  0,  2,  1,  1,  1,  2,  2,  0, -2, -4, -7,
-   -3, -2,  1,  2,  2,  1, -1, -4,  2,  2,  0, -2, -2,  0,  2,  2,
-    0,  0, -2, -3, -2, -1,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,
-   -2, -1,  0,  1,  0,  1,  2,  3, -4, -2,  0,  0, -1,  0,  2,  3,
-   -2, -2, -2, -1, -1,  0,  2,  4,  0,  0,  0,  0, -1, -1,  0,  1,
-    0, -1, -1, -1, -1, -1,  0,  0,  6,  4,  2,  0, -1, -2, -1, -1,
-    0,  1,  1,  1,  1, -1, -5,-10,  1,  1,  1,  1,  1,  1,  0, -4,
-    1,  0,  1,  1,  1,  1,  1, -1,  2,  1,  1,  1,  0,  0,  0,  0,
-   -3,  1,  4,  3,  3,  1, -1,  0, -4,  0,  1,  0, -1,  0,  0,  0,
-   -5,  0,  2,  1,  1,  1,  0, -1, -1,  2,  1, -2, -2, -1,  0, -1,
-    2,  4,  5,  3,  0, -1,  1,  2,  0,  0,  1,  0, -2, -2, -1, -1,
-   -2, -2, -2, -2, -3, -2, -1,  0,  0,  0,  1,  0,  0,  0,  1,  2,
-    0, -2, -2, -3, -1,  2,  2, -1,  1,  0,  0,  0,  1,  5,  3, -2,
-   -1, -1,  0, -1,  0,  2,  0, -5, -1,  0,  1,  0,  0,  2,  2, -2,
-    3,  1, -1, -1,  0,  1,  1,  2,  1,  0,  0,  1,  1,  1,  1,  1,
-  -10, -8, -2,  1,  2,  1,  1,  1, -1,  1,  2,  1,  0,  0,  0,  0,
-   -1, -1,  0,  1,  2,  2,  2,  1, -1, -1, -1,  0, -1, -3, -5, -4,
-    1,  1,  2,  1,  1,  0,  0,  2, -1, -2, -1, -1, -1,  0,  2,  4,
-   -3, -7, -5,  0,  2,  0,  0,  0,  3, -1, -2,  1,  2,  1,  1,  2,
-    1, -2, -1,  1,  2,  1,  0,  1,  0, -1,  0,  3,  2, -1, -1, -1,
-    2,  1,  1,  0,  0,  0,  0,  0, -9, -7, -2,  3,  3,  2,  1,  1,
-    3,  2,  0, -2, -2, -1,  1,  1,  0, -1,  0,  0,  1,  1,  0,  0,
-   -2, -1,  1,  1,  1,  0,  0,  0,  1,  2,  1, -2, -4, -3,  1,  2,
-    1,  2,  1, -2, -3,  0,  3,  1, -1, -1,  0,  0,  1,  3,  0, -4,
-    2,  0, -1,  1,  2, -2, -2,  3,  2,  0, -1,  2,  3, -2, -4,  1,
-    0,  1,  1,  1,  2, -2, -6, -2, -1,  0,  0,  0,  2,  0, -2, -1,
-   -1, -1,  1,  2,  1, -2, -3, -2,  3, -1, -2, -1, -1,  0,  1,  2,
-   10,  4,  0,  0, -1, -2, -2, -1,  3, -1, -2, -1,  0, -1, -1,  0,
-   -5,  2,  7,  1, -4, -2,  1,  0, -2,  2,  3, -1, -3,  0,  2,  0,
-    2,  1,  0,  0,  1,  1, -1, -2,  1, -2, -2, -1, -1, -2,  0,  0,
-    0,  3, -2, -7, -1,  3,  0,  0,  1,  3, -3, -5,  2,  3, -1,  0,
-    0,  2, -2, -2,  4,  2, -2,  0, -1,  1, -1,  0,  2, -1, -2,  1,
-    4,  0, -3, -4, -2,  1,  2,  1,  0,  0,  3,  5,  3,  1, -1, -2,
-    1,  1,  1, -1, -3, -1,  1,  1,  1, -1, -2, -2,  0,  0, -1, -2
-};
-
-/* 6x16-entry codebook for intra-coded 8x8 vectors */
-DECLARE_ALIGNED(4, static const int8_t, svq1_intra_codebook_8x8)[6144] = {
-    4,  4,  3,  2,  2,  1,  0, -1,  4,  3,  3,  2,  1,  0, -1, -1,
-    3,  3,  2,  2,  1,  0, -1, -2,  3,  2,  2,  1,  0, -1, -2, -3,
-    2,  2,  1,  0, -1, -1, -2, -3,  2,  1,  0,  0, -1, -2, -3, -4,
-    1,  0,  0, -1, -2, -3, -4, -4,  0,  0, -1, -2, -2, -3, -4, -4,
-    2,  3,  3,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  3,  3,
-    1,  2,  2,  2,  2,  2,  2,  2,  0,  1,  1,  1,  1,  1,  1,  1,
-   -1,  0,  0,  0,  0,  0,  1,  1, -2, -2, -1, -1, -1, -1, -1, -1,
-   -3, -3, -3, -3, -3, -3, -2, -2, -5, -4, -4, -4, -4, -4, -4, -3,
-   -4, -2, -1,  0,  1,  2,  2,  3, -4, -2, -1,  0,  1,  2,  3,  3,
-   -4, -3, -1,  0,  1,  2,  3,  3, -4, -3, -1,  0,  1,  2,  3,  3,
-   -5, -3, -1,  0,  1,  2,  3,  3, -5, -3, -1,  0,  1,  2,  3,  3,
-   -5, -3, -1,  0,  1,  1,  2,  3, -5, -3, -2, -1,  0,  1,  2,  3,
-    4,  4,  5,  5,  6,  6,  7,  7,  2,  2,  2,  3,  3,  4,  4,  4,
-    0,  0,  0,  0,  1,  1,  1,  2, -2, -2, -2, -2, -1, -1, -1,  0,
-   -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-   -1, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -2, -2, -2, -2,
-    5,  3,  1, -1, -2, -3, -3, -3,  5,  3,  1, -1, -2, -3, -3, -3,
-    5,  3,  1, -1, -2, -3, -3, -3,  5,  3,  1, -1, -2, -3, -3, -3,
-    5,  4,  1,  0, -2, -3, -3, -3,  6,  4,  2,  0, -2, -2, -3, -3,
-    6,  4,  2,  0, -1, -2, -2, -3,  6,  4,  2,  1, -1, -2, -2, -2,
-   -1,  1,  3,  3,  2,  0, -3, -6, -1,  1,  3,  4,  3,  0, -3, -6,
-   -1,  1,  4,  4,  3,  1, -3, -6, -1,  1,  3,  4,  3,  1, -3, -6,
-   -2,  1,  3,  4,  3,  1, -3, -6, -2,  1,  3,  4,  3,  1, -3, -7,
-   -2,  1,  3,  3,  2,  0, -3, -7, -2,  0,  2,  3,  2,  0, -3, -6,
-   10,  9,  8,  6,  6,  5,  4,  4,  6,  5,  4,  3,  2,  2,  2,  1,
-    2,  1,  0, -1, -2, -2, -2, -1, -1, -2, -3, -4, -4, -4, -4, -3,
-   -2, -3, -4, -4, -5, -4, -4, -3, -2, -2, -3, -3, -3, -3, -2, -2,
-   -1, -1, -1, -1, -1, -1, -1,  0,  1,  1,  1,  1,  1,  1,  1,  2,
-   -2, -1,  1,  2,  4,  5,  7,  8, -3, -2,  0,  1,  3,  5,  7,  8,
-   -4, -3, -1,  0,  2,  4,  6,  7, -5, -4, -2, -1,  1,  3,  5,  7,
-   -6, -5, -3, -2,  0,  2,  4,  6, -6, -5, -4, -2, -1,  1,  3,  5,
-   -7, -6, -5, -3, -2,  0,  2,  3, -8, -7, -5, -4, -3, -1,  1,  2,
-   11,  9,  7,  5,  3,  1, -1, -1, 10,  8,  6,  3,  1,  0, -2, -2,
-    9,  7,  5,  2,  0, -2, -3, -4,  8,  6,  3,  1, -1, -3, -4, -4,
-    6,  4,  2, -1, -3, -4, -5, -5,  5,  3,  0, -2, -4, -5, -6, -6,
-    3,  1, -1, -3, -5, -6, -7, -7,  2,  0, -2, -4, -6, -6, -7, -7,
-    5,  6,  7,  7,  7,  8,  8,  8,  3,  4,  5,  5,  6,  6,  6,  6,
-    0,  2,  2,  3,  4,  4,  4,  5, -2, -1,  0,  1,  2,  2,  3,  3,
-   -4, -3, -2, -1,  0,  1,  1,  2, -6, -5, -4, -3, -2, -2, -1,  0,
-   -8, -7, -6, -6, -5, -4, -3, -3,-10, -9, -8, -8, -7, -6, -6, -5,
-    6,  5,  3,  1, -1, -3, -6, -8,  6,  5,  4,  2, -1, -3, -6, -8,
-    6,  5,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2,  0, -3, -6, -8,
-    6,  6,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2,  0, -3, -6, -8,
-    6,  5,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2, -1, -3, -5, -8,
-   11, 10,  9,  8,  7,  6,  5,  4,  8,  8,  7,  6,  5,  4,  3,  2,
-    6,  5,  4,  4,  2,  2,  1,  0,  3,  3,  2,  1,  0,  0, -1, -2,
-    1,  1,  0, -1, -2, -2, -3, -3, -1, -1, -2, -3, -4, -4, -5, -5,
-   -3, -4, -4, -5, -6, -6, -7, -7, -5, -5, -6, -7, -8, -8, -8, -8,
-  -14,-13,-12,-11, -9, -7, -6, -4,-12,-11,-10, -9, -7, -5, -3, -1,
-  -10, -9, -7, -6, -3, -2,  0,  2, -8, -6, -4, -2,  0,  2,  4,  5,
-   -5, -3,  0,  2,  4,  5,  7,  8, -2,  0,  2,  4,  6,  8,  9, 10,
-    0,  3,  5,  7,  8, 10, 11, 12,  3,  5,  7,  8, 10, 11, 12, 12,
-  -19,-19,-18,-18,-17,-16,-15,-14,-15,-15,-14,-13,-12,-11,-10, -9,
-  -11,-10, -9, -8, -6, -5, -4, -3, -6, -5, -3, -2, -1,  0,  1,  2,
-   -1,  0,  2,  3,  4,  5,  6,  6,  4,  6,  7,  8,  9, 10, 10, 10,
-    9, 10, 11, 12, 13, 14, 14, 14, 12, 14, 14, 15, 16, 16, 16, 16,
-   22, 21, 19, 17, 14, 11,  9,  5, 20, 19, 17, 14, 11,  8,  4,  1,
-   17, 15, 13, 10,  6,  3,  0, -4, 13, 11,  8,  5,  1, -2, -5, -9,
-    9,  6,  3, -1, -4, -7,-11,-13,  4,  0, -3, -6, -9,-12,-15,-17,
-   -2, -5, -8,-11,-14,-16,-18,-20, -8,-10,-13,-16,-17,-19,-21,-22,
-   17, 18, 18, 18, 17, 16, 16, 14, 16, 16, 15, 15, 14, 13, 12, 11,
-   12, 12, 11, 10,  9,  8,  7,  5,  7,  6,  6,  4,  3,  2,  1, -1,
-    1,  0, -1, -2, -3, -4, -5, -6, -5, -6, -7, -8, -9,-10,-11,-12,
-  -11,-12,-13,-14,-15,-16,-16,-17,-16,-17,-17,-18,-19,-20,-20,-20,
-    0,  0,  0,  0, -1, -1, -2, -3,  1,  0,  0,  0,  0, -1, -2, -3,
-    1,  1,  0,  0, -1, -1, -2, -2,  1,  1,  1,  0,  0, -1, -1, -2,
-    2,  1,  1,  1,  0, -1, -1, -2,  2,  2,  1,  1,  0,  0, -1, -2,
-    2,  2,  1,  1,  1,  0, -1, -1,  2,  2,  1,  1,  1,  0,  0, -2,
-    0, -1, -1,  0,  0,  1,  2,  3,  0, -1, -1,  0,  1,  1,  2,  2,
-   -1, -1, -1, -1,  0,  1,  2,  2, -1, -1, -2, -1,  0,  1,  1,  2,
-   -1, -2, -2, -1,  0,  0,  1,  2, -1, -2, -2, -2, -1,  0,  1,  2,
-   -1, -1, -2, -1,  0,  0,  1,  2, -1, -1, -1, -1,  0,  1,  1,  2,
-    3,  2,  2,  2,  1,  1,  0,  0,  3,  2,  2,  2,  2,  1,  0,  0,
-    2,  2,  2,  1,  1,  1,  0,  0,  2,  2,  1,  1,  1,  0,  0, -1,
-    1,  1,  1,  0,  0,  0, -1, -1,  0,  0, -1, -1, -1, -1, -1, -1,
-   -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -2, -2, -2, -2,
-    5,  2,  0,  0, -1,  0,  0,  0,  4,  2,  0, -1, -1, -1,  0, -1,
-    4,  1, -1, -1, -2, -1, -1, -1,  4,  1, -1, -1, -2, -1, -1, -1,
-    4,  1, -1, -2, -2, -1, -1, -1,  4,  1, -1, -2, -2, -1, -1, -1,
-    4,  1, -1, -1, -1, -1, -1, -1,  4,  2,  0, -1,  0,  0,  0, -1,
-   -2, -1,  0,  1,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  1,  1,
-   -3, -1,  0,  1,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  1,  1,
-   -3, -2,  0,  1,  2,  2,  1,  1, -4, -2,  0,  1,  2,  2,  2,  2,
-   -5, -3, -1,  1,  1,  2,  1,  2, -5, -3, -2,  0,  1,  1,  1,  1,
-    3,  3,  1,  0, -2, -4, -4, -5,  3,  3,  2,  0, -1, -2, -3, -4,
-    2,  2,  1,  1,  0, -1, -2, -2,  1,  1,  1,  1,  1,  0,  0,  0,
-    0,  0,  0,  1,  1,  1,  1,  1, -2, -1, -1,  0,  0,  1,  2,  2,
-   -3, -2, -2, -1,  0,  1,  2,  3, -3, -3, -2, -1,  0,  1,  2,  3,
-   -3, -3, -3, -3, -3, -2, -2, -2, -3, -3, -2, -2, -2, -1, -1, -1,
-   -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  1,  1,  1,  1,  0,  0,  1,  1,  2,  2,  2,  2,
-    1,  1,  1,  2,  2,  3,  3,  3,  2,  2,  2,  2,  3,  3,  3,  3,
-   -8, -7, -5, -3, -2, -1,  0, -1, -4, -3, -1,  0,  1,  2,  1,  1,
-   -1,  1,  2,  3,  3,  2,  2,  1,  1,  2,  3,  3,  2,  2,  1,  0,
-    2,  3,  3,  2,  1,  0,  0, -1,  1,  2,  1,  0, -1, -1, -1, -1,
-    1,  1,  0, -1, -1, -2, -2, -1,  1,  1,  0,  0, -1, -1,  0, -1,
-   -4, -3, -2,  0,  1,  2,  3,  3, -4, -3, -2,  0,  1,  2,  2,  2,
-   -3, -3, -2, -1,  0,  1,  1,  1, -2, -2, -2, -1, -1,  0,  0,  0,
-    0, -1, -1, -1, -1, -1, -1, -1,  2,  1,  1,  0,  0, -1, -1, -2,
-    3,  3,  3,  1,  0, -1, -2, -2,  5,  4,  4,  2,  1,  0, -1, -2,
-    0,  0,  0,  0,  1,  2,  3,  3,  0, -1,  0,  0,  1,  2,  3,  3,
-    0, -1,  0,  0,  1,  2,  3,  2,  0,  0,  0,  1,  1,  2,  2,  2,
-    2,  1,  1,  1,  1,  1,  1,  0,  2,  2,  2,  1,  0,  0, -1, -2,
-    2,  1,  0,  0, -2, -3, -5, -6,  0, -1, -1, -3, -5, -6, -8, -9,
-   -2,  0,  1,  2,  2,  1, -1, -4, -2,  0,  2,  2,  2,  1, -1, -4,
-   -2,  0,  2,  2,  2,  1, -1, -3, -2,  0,  2,  2,  2,  1, -1, -3,
-   -2, -1,  2,  2,  2,  1, -1, -3, -2, -1,  1,  2,  2,  1, -1, -3,
-   -3, -1,  1,  2,  2,  1, -1, -3, -2, -1,  1,  2,  2,  1, -1, -3,
-   -1,  1,  1, -1, -3, -3,  0,  4, -1,  1,  1, -1, -3, -3,  0,  4,
-   -1,  1,  1,  0, -3, -3,  0,  4, -1,  1,  2,  0, -3, -3,  0,  5,
-    0,  1,  2,  0, -3, -4,  0,  4,  0,  1,  2,  0, -3, -4,  0,  5,
-    0,  1,  2,  0, -3, -3,  0,  4,  0,  1,  2, -1, -2, -2,  0,  4,
-    6,  6,  5,  6,  5,  5,  5,  5,  2,  2,  2,  2,  2,  2,  2,  2,
-    0,  0,  0,  0,  0,  0,  0,  0, -1, -1, -1, -1, -2, -2, -2, -2,
-   -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-   -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    2,  2,  2,  2,  2,  2,  2,  2,  0,  1,  1,  0,  0,  0,  0,  0,
-   -1, -2, -2, -2, -2, -2, -2, -1, -3, -3, -3, -3, -3, -3, -3, -2,
-   -3, -4, -4, -3, -3, -3, -2, -2, -2, -2, -2, -2, -1, -1,  0,  0,
-    0,  1,  1,  1,  2,  2,  3,  3,  3,  4,  4,  5,  5,  6,  6,  6,
-    4,  1, -2, -3, -3, -1,  1,  3,  4,  1, -2, -4, -3, -1,  1,  3,
-    5,  1, -2, -4, -3, -1,  1,  4,  5,  1, -2, -3, -3, -1,  2,  4,
-    5,  1, -2, -3, -3, -1,  2,  4,  4,  0, -3, -4, -3, -1,  2,  4,
-    4,  0, -3, -3, -3, -1,  1,  3,  3,  0, -2, -3, -2, -1,  1,  3,
-   -3, -4, -4, -4, -4, -4, -4, -4, -1, -1, -1, -1, -1, -1, -2, -2,
-    2,  1,  1,  2,  2,  1,  1,  1,  3,  3,  3,  4,  4,  3,  3,  3,
-    3,  3,  3,  4,  4,  4,  3,  3,  1,  2,  1,  2,  2,  2,  2,  2,
-   -2, -2, -2, -1, -1, -1,  0,  0, -4, -4, -4, -4, -3, -3, -3, -3,
-   -1, -2, -3, -3, -2, -2, -1,  0,  0, -1, -2, -2, -2, -1,  0,  1,
-    2,  1, -1, -1, -1, -1,  0,  1,  3,  1,  0, -1, -1,  0,  0,  1,
-    3,  2,  0, -1,  0,  0,  0,  1,  3,  1,  0, -1,  0,  0,  0,  1,
-    3,  1,  0, -1,  0,  0,  0,  1,  2,  1,  0,  0,  0,  0,  0,  1,
-    0,  0,  0,  1,  1,  2,  3,  4,  0,  0, -1,  0,  0,  0,  2,  3,
-    0, -1, -1, -1, -1, -1,  0,  1,  0, -1, -1, -1, -1, -1, -1,  0,
-    0,  0, -1, -1, -1, -2, -2, -1,  1,  0,  0, -1, -1, -2, -2, -1,
-    2,  2,  1,  0, -1, -1, -1, -1,  3,  3,  2,  1,  0, -1, -1,  0,
-    1,  0,  1,  0,  0, -1, -2, -1,  0,  0,  0,  0, -1, -1, -2, -1,
-    0, -1,  0,  0, -1, -1, -1, -1, -1, -1, -1,  0,  0,  0,  0,  0,
-   -1, -1, -1,  0,  0,  0,  1,  1, -1, -1, -1,  0,  1,  1,  2,  3,
-   -2, -2, -1,  0,  1,  2,  3,  4, -2, -2, -1,  0,  1,  2,  4,  5,
-   -3, -1,  1,  0,  0, -1,  0,  1, -3,  0,  1,  0, -1, -1,  0,  2,
-   -3,  0,  1,  0, -1, -1,  0,  2, -2,  1,  2,  0, -1, -1,  0,  2,
-   -2,  1,  2,  0, -1, -1,  0,  2, -2,  1,  2,  0, -1, -1,  0,  2,
-   -1,  2,  2,  0, -1, -1,  0,  2, -1,  1,  1,  0, -1, -1, -1,  1,
-   -2, -2, -1,  1,  3,  4,  3,  1, -2, -2, -1,  0,  2,  3,  2,  0,
-   -2, -2, -1,  0,  1,  2,  1, -1, -1, -1, -1,  0,  1,  2,  1, -1,
-   -1, -1, -1,  0,  1,  1,  0, -2,  0, -1, -1,  0,  1,  1,  0, -1,
-    0, -1, -1,  0,  1,  1,  1, -1,  0, -1, -1,  0,  0,  1,  0, -1,
-   -2, -1,  0,  1,  1,  1,  1,  1, -2, -1,  0,  0,  0,  0,  0,  0,
-   -2, -1, -1,  0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -2, -2, -3,
-   -1,  0,  1,  1,  0, -1, -2, -2,  1,  2,  3,  3,  2,  1,  0,  0,
-    1,  2,  3,  3,  3,  2,  1,  0,  0,  0,  1,  1,  1,  1,  0,  0,
-    0, -1, -1, -1,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  1,
-    1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2,  1,  1,  1,  1,
-    1,  1,  1,  1,  1,  1,  1,  1, -1,  0,  0,  1,  1,  0,  0,  0,
-   -3, -2, -1, -1, -1, -1,  0, -1, -5, -5, -4, -3, -2, -2, -2, -1,
-    1,  1,  1,  1,  2,  1,  0, -1,  1,  1,  1,  2,  1,  1,  0, -1,
-    1,  1,  1,  1,  1,  1,  0, -2,  2,  1,  1,  1,  1,  1,  0, -2,
-    1,  1,  0,  0,  0,  0, -1, -3,  1,  1,  0,  0,  0, -1, -2, -3,
-    1,  1,  0,  0, -1, -1, -2, -4,  1,  0,  0, -1, -2, -2, -3, -4,
-    8,  7,  5,  3,  2,  1,  1,  1,  2,  1,  0,  0, -1, -1, -2, -1,
-   -1, -1, -1, -2, -2, -2, -2, -1, -1, -1, -1, -1,  0, -1, -1,  0,
-    0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0,
-   -1,  0,  0,  0,  0,  0, -1, -1, -2, -2, -1, -1, -1, -2, -2, -1,
-    9,  4,  0, -2, -2, -2, -1, -1,  7,  2, -1, -2, -2, -1,  0,  0,
-    4,  0, -2, -2, -1,  0,  1,  1,  1, -2, -2, -2, -1,  0,  1,  1,
-   -1, -2, -2, -1,  0,  1,  1,  1, -1, -2, -1,  0,  1,  1,  1,  0,
-   -1, -1,  0,  1,  1,  1,  0, -1,  0, -1,  0,  1,  0,  0, -1, -1,
-    0,  1,  1,  1,  1,  1,  0,  0,  1,  2,  2,  2,  1,  0,  0,  0,
-    2,  2,  2,  2,  1,  0, -1, -1,  1,  1,  1,  0, -1, -2, -2, -2,
-    0,  0,  0, -1, -2, -3, -2, -2, -1, -1, -1, -2, -2, -2, -1,  0,
-   -1, -1, -1, -1,  0,  0,  1,  2, -1, -1, -1,  0,  1,  2,  3,  4,
-   -1, -1,  0,  0, -1, -2, -3, -3, -1, -1,  0,  0,  0, -1, -1, -1,
-   -2, -2, -1,  0,  1,  1,  1,  1, -2, -2, -2,  0,  1,  2,  3,  3,
-   -1, -1, -1,  0,  1,  3,  3,  3,  1,  0,  0,  0,  1,  1,  2,  2,
-    2,  2,  1,  0,  0, -1, -1, -1,  3,  2,  1,  0, -1, -2, -3, -3,
-   -1, -1, -1, -2, -2, -3, -4, -5,  0,  0,  0, -1, -1, -3, -3, -4,
-    1,  1,  1,  0,  0, -1, -2, -3,  2,  2,  2,  1,  1,  0, -1, -1,
-    2,  2,  2,  2,  1,  1,  0, -1,  2,  2,  2,  2,  2,  1,  0,  0,
-    1,  1,  2,  1,  1,  1,  0,  0,  0,  0,  1,  1,  0,  0,  0, -1,
-   -2,  2,  3,  1, -1,  1,  1, -1, -3,  2,  3,  0, -1,  1,  1, -1,
-   -3,  2,  3,  0, -1,  1,  1, -1, -4,  2,  3,  0, -1,  1,  1, -2,
-   -4,  1,  3,  0, -1,  1,  1, -2, -4,  1,  3, -1, -2,  1,  1, -2,
-   -3,  1,  2,  0, -1,  1,  1, -2, -3,  1,  2,  0, -1,  1,  1, -1,
-   -1, -1, -1, -2, -2, -2, -2, -2,  1,  1,  1,  1,  0,  0,  0,  0,
-    1,  2,  2,  2,  2,  2,  2,  2,  0,  0,  1,  1,  1,  2,  2,  2,
-   -2, -2, -1, -1, -1,  0,  0,  0, -3, -3, -3, -3, -3, -3, -3, -2,
-   -1, -1, -1, -1, -2, -2, -2, -2,  4,  4,  4,  4,  4,  3,  3,  2,
-   -3, -3, -2, -1,  0,  1,  2,  5, -3, -3, -3, -2, -1,  1,  3,  6,
-   -3, -3, -2, -2,  0,  2,  3,  5, -3, -2, -2, -2,  0,  1,  3,  5,
-   -2, -2, -2, -1, -1,  1,  3,  5, -2, -2, -1, -1,  0,  1,  2,  4,
-   -1, -1, -1, -1,  0,  1,  1,  4, -1, -1, -1, -1,  0,  1,  2,  3,
-    0, -1,  0,  1,  1,  0, -1, -1,  0,  0,  0,  1,  2,  0, -1, -1,
-    1,  0, -1,  0,  1,  0,  0,  0,  1, -1, -2, -1,  0,  0,  0,  0,
-    1, -2, -3, -1,  0,  0,  0,  1,  1, -1, -3, -2,  0,  1,  1,  2,
-    1, -1, -2, -1,  0,  1,  1,  2,  2,  0, -1,  0,  1,  1,  2,  2,
-    1,  1,  1,  1,  0,  0,  1,  2, -1,  0,  0, -1,  0,  0,  0,  1,
-   -3, -2, -1, -1, -1,  0,  1,  1, -4, -2, -1,  0,  0,  1,  1,  1,
-   -3, -2,  0,  0,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  0,  0,
-   -1,  0,  1,  1,  1,  0,  0, -1,  0,  1,  2,  2,  1,  0,  0, -1,
-   -4, -4, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1,  0,  0,  0,  0,
-   -1,  0,  0,  0,  1,  1,  1,  1,  0,  0,  1,  1,  1,  1,  1,  1,
-    0,  0,  1,  1,  2,  2,  1,  0,  0,  0,  1,  1,  1,  1,  1,  0,
-    0,  0,  0,  1,  1,  1,  1,  0, -1,  0,  0,  1,  1,  1,  0,  0,
-    1,  2,  2,  2,  1, -1, -2, -4,  1,  1,  2,  2,  1,  0, -2, -4,
-    0,  1,  1,  1,  1,  0, -1, -3, -1,  0,  1,  1,  0,  0, -1, -2,
-   -1,  0,  1,  1,  1,  0,  0, -1, -2, -1,  0,  0,  0,  0,  0, -1,
-   -1, -1,  0,  1,  1,  0,  0,  0, -1,  0,  1,  1,  1,  1,  1,  0,
-    2,  2,  0, -1, -2, -1, -1, -2,  1,  1, -1, -2, -2, -1, -1, -2,
-    1,  1, -1, -2, -2,  0,  0, -1,  1,  1,  0, -2, -1,  1,  1,  0,
-    1,  1,  0, -1, -1,  1,  2,  1,  1,  1,  0, -1, -1,  1,  2,  1,
-    1,  1,  0, -1, -1,  1,  1,  1,  1,  1,  0, -1,  0,  1,  1,  1,
-    0,  0, -1, -2, -4, -4, -4, -4,  3,  3,  3,  2,  1,  0,  0,  0,
-    3,  3,  3,  3,  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  1,
-   -1, -1, -1, -1, -1, -1, -1,  0,  0, -1,  0,  0, -1,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,  0,
-   -1, -1,  0, -1, -1,  1,  2, -1,  1,  1,  0,  0,  0,  2,  3, -1,
-    1,  1,  0, -1, -1,  1,  3, -1,  1,  1,  0, -2, -2,  0,  1, -2,
-    1,  0,  0, -2, -2,  0,  1, -3,  0,  0,  0,  0, -1,  1,  1, -3,
-    0,  1,  1,  0,  1,  2,  1, -3, -1,  0,  1,  1,  1,  2,  1, -4,
-   -4, -3,  0,  1,  1,  1,  0,  0, -4, -2,  0,  1,  1,  1,  0, -1,
-   -3, -1,  1,  1,  1,  0, -1, -1, -1,  1,  1,  1,  1,  0, -1,  0,
-    1,  2,  2,  1,  0, -1,  0,  0,  2,  2,  1,  0, -1, -1,  0,  1,
-    2,  1,  0, -1, -2, -1,  0,  1,  2,  2,  0, -1, -2, -1,  1,  1,
-    1,  1,  0,  0, -1, -1, -1, -1,  0, -1, -1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1,  0,  0, -1, -1, -1, -1, -1, -1,
-    1,  0,  0, -1, -1, -1, -1, -1,  2,  1,  0,  0, -1, -1, -1, -1,
-    5,  3,  2,  1,  0,  0,  0,  0,  6,  5,  3,  2,  1,  0,  0,  0,
-    4,  4,  3,  1,  0,  0,  0,  1,  3,  3,  2,  1,  0,  0,  0,  1,
-    2,  2,  1,  0, -1, -1,  0,  1,  0,  0,  0, -1, -1, -1,  0,  1,
-    0,  0, -1, -1, -2, -1,  0,  2,  0, -1, -1, -2, -2, -2,  0,  1,
-    0, -1, -1, -2, -2, -2, -1,  0,  0,  0, -1, -2, -2, -2, -1,  0,
-    0,  0, -1, -1, -1,  0,  2,  3,  0, -1, -2, -2, -1, -1,  1,  2,
-    1,  0, -1, -1, -1,  0,  0,  0,  1,  1,  1,  0,  0,  0, -1, -1,
-    1,  2,  1,  0,  0, -1, -1, -1, -1,  0,  0,  0, -1, -1, -1, -1,
-   -3, -2, -1, -1,  0,  1,  1,  2, -4, -3, -1,  1,  2,  3,  5,  5,
-    0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,
-    0,  0,  0, -1,  0,  0,  0,  1, -1, -1, -2, -2, -2, -1, -1,  0,
-    0,  0,  0,  0,  0,  1,  1,  1,  2,  2,  2,  2,  2,  3,  3,  3,
-    1,  1,  1,  1,  2,  2,  1,  1, -4, -3, -4, -4, -4, -4, -3, -3,
-   -1,  0,  1,  2,  2,  3,  3,  3, -1, -1, -1, -1,  0,  0,  0,  0,
-    0,  0, -1, -2, -2, -3, -3, -2,  3,  2,  1,  0, -1, -2, -2, -2,
-    4,  3,  2,  1,  1,  0,  0,  0,  2,  2,  1,  1,  0,  1,  1,  1,
-    0, -1, -1, -1, -1,  0,  0,  1, -2, -2, -2, -2, -2, -1,  0,  0,
-    1, -1,  0,  2,  1, -2, -1,  1,  1, -1,  0,  2,  1, -2, -2,  1,
-    1, -1,  0,  3,  2, -2, -1,  1,  0, -2,  0,  3,  2, -2, -2,  1,
-    0, -2,  0,  3,  2, -2, -2,  1,  0, -2,  0,  3,  1, -2, -1,  1,
-    0, -2,  0,  2,  1, -2, -2,  1,  0, -1,  0,  2,  1, -2, -1,  1,
-    0,  1,  2,  2,  3,  3,  2,  2,  0,  1,  1,  2,  3,  3,  2,  1,
-    0,  0,  1,  2,  2,  2,  2,  1, -1,  0,  0,  1,  1,  1,  1,  1,
-   -1, -1,  0,  0,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1, -1, -1,
-   -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -1,
-    0,  0, -1, -2, -1,  0,  3,  5,  0,  0, -1, -1, -1,  0,  2,  4,
-    1,  1,  0,  0, -1, -1,  1,  2,  1,  2,  1,  1,  0, -1, -1,  0,
-    0,  1,  2,  1,  0, -1, -2, -2, -1,  0,  1,  2,  1,  0, -3, -3,
-   -2, -1,  1,  2,  2,  0, -2, -4, -2, -1,  0,  2,  2,  1, -1, -3,
-    0,  0,  0,  0,  0,  0, -1, -1,  0,  0, -1,  0,  0,  0,  0,  0,
-   -1, -1, -1, -1,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1, -1,  0,
-   -1, -1, -1, -1, -1, -1, -1,  0, -1,  0,  0,  0,  0, -1, -1,  0,
-    0,  0,  1,  1,  0,  0,  0,  1,  3,  3,  3,  4,  3,  3,  3,  3,
-    5,  1, -2, -2,  0,  0,  0, -1,  4, -1, -3, -1,  0,  0,  0, -1,
-    3, -1, -1,  0,  1,  1,  0, -1,  2,  0,  0,  1,  1,  1,  0, -2,
-    1,  0,  0,  1,  1,  1,  0, -2,  0, -1, -1, -1,  0,  0,  0, -1,
-    0, -1, -1, -1, -1,  0,  0, -1,  2,  1,  0,  0,  0,  1,  0,  0,
-    1,  0,  1,  1,  1,  1,  0,  0,  1,  0,  0,  1,  1,  0,  0,  0,
-    1, -1, -1,  0,  0,  0,  0,  0,  2,  0, -1, -1, -1, -1, -1,  0,
-    3,  1, -1, -1, -2, -2, -2, -1,  4,  2,  1,  0, -1, -2, -2, -1,
-    2,  1,  0,  0, -1, -1,  0,  0,  0, -1, -1, -1, -1,  0,  1,  1,
-    0,  1,  2,  2,  2,  1, -1, -3,  0,  0,  1,  1,  1,  0, -1, -2,
-    0,  0,  0,  0,  0,  0, -1, -1,  0,  0, -1,  0,  0,  1,  1,  0,
-    0,  0, -1,  0,  1,  1,  1,  1,  0,  0,  0,  0,  1,  1,  1,  0,
-    0,  0,  1,  1,  2,  1, -1, -3,  0,  0,  0,  1,  1, -1, -4, -5,
-   -2, -2, -2, -1,  0,  2,  2,  2,  0,  0,  0,  0,  1,  1,  1,  0,
-    1,  1,  1,  1,  1,  0, -2, -3,  0,  0,  1,  1,  0, -1, -3, -4,
-   -1, -1,  0,  1,  0,  0, -2, -3, -1, -1,  0,  1,  1,  1,  0, -1,
-    0,  0,  0,  1,  1,  1,  1,  0,  1,  1,  1,  1,  0,  0,  0,  0,
-    0,  1,  0,  0,  1,  1,  1,  2,  1,  2,  0,  0,  0,  0, -1,  1,
-    0,  2,  0, -1,  1,  0, -1,  0,  0,  1,  0,  0,  2,  1,  0,  1,
-    0,  1, -1,  0,  2,  2,  0,  1, -1,  0, -1, -1,  2,  1,  1,  2,
-   -2, -2, -3, -2,  0,  1,  1,  1, -2, -2, -3, -3, -1, -1, -1,  0,
-   -3, -1,  0,  1,  2,  1,  1,  0, -3, -1,  0,  1,  2,  1,  1,  1,
-   -2,  0,  0,  1,  1,  1,  1,  1, -1,  0,  0,  0,  0,  0,  0,  0,
-   -2,  0,  0,  0,  0, -1, -1,  0, -2,  0,  0,  0,  0,  0, -1, -1,
-   -3,  0,  1,  1,  1,  1,  0,  1, -5, -2,  0,  1,  2,  2,  1,  2,
-   -2, -1, -1,  0,  0,  1,  2,  3,  0,  0,  1,  1,  0,  0,  1,  2,
-    0,  0,  1,  0, -1, -1,  0,  1, -1, -1, -1, -1, -2, -2, -1,  0,
-   -2, -2, -2, -2, -2, -1,  0,  1,  0,  0,  0, -1,  0,  1,  2,  2,
-    2,  1,  0,  0,  0,  1,  2,  2,  2,  1,  0, -1, -1, -1,  0,  0,
-    0,  1,  1,  1,  1,  1, -1, -4, -1, -1,  0,  1,  1,  1,  0, -3,
-   -2, -1,  0,  0,  1,  2,  2, -2, -1,  0,  0,  0,  0,  2,  3, -1,
-   -1,  0,  0,  0,  0,  1,  2,  0,  0,  0, -1, -2, -1,  1,  1,  0,
-    0,  0, -1, -2, -2,  0,  2,  1,  0,  0, -1, -2, -1,  1,  2,  2,
-    1,  0,  0,  0, -2, -3, -2, -3,  0,  0,  1,  0, -2, -2, -1, -1,
-    0, -1,  1,  1, -1, -1,  0,  0,  0, -1,  1,  1, -1, -1,  0,  0,
-    0,  1,  2,  1, -1, -1,  0,  1,  1,  2,  3,  2,  0,  0,  1,  2,
-   -1,  0,  2,  1,  0,  0,  2,  3, -2, -1,  0,  0, -1,  0,  1,  2,
-    1,  1,  0, -1, -2, -2, -1,  1,  1,  1,  1, -1, -2, -2,  0,  2,
-    1,  1,  1, -1, -1, -1,  0,  2,  0,  0,  0,  0,  0,  0,  1,  2,
-   -1, -1, -1,  0,  0,  0,  1,  2, -1, -2, -1,  1,  1,  1,  0,  0,
-   -1, -2, -1,  1,  2,  2,  0, -1, -1, -2, -1,  2,  2,  2,  0, -1,
-   -1, -1, -1, -2, -1, -1,  0,  1,  0,  0, -1, -1, -1,  0,  1,  2,
-    1,  0,  0,  0,  0,  1,  1,  2,  1,  1,  0,  0,  1,  1,  1,  1,
-    1,  1,  0,  1,  1,  0,  1,  1,  1,  1,  1,  1,  0, -1, -1, -1,
-    1,  2,  1,  0, -1, -2, -2, -3,  2,  2,  1,  0, -2, -3, -4, -4,
-   -4, -2,  1,  1,  1,  1,  0,  0, -2,  0,  1,  0,  0,  0,  0,  0,
-    0,  1,  1, -2, -2, -1,  0,  1,  2,  2,  1, -2, -2, -1,  1,  2,
-    1,  2,  1, -2, -2, -1,  1,  2, -1,  1,  1, -1, -1, -1,  0,  1,
-   -2,  0,  1,  1,  0, -1, -1,  0, -2,  0,  2,  2,  1, -1, -1,  0,
-    1,  1,  0,  0,  0,  1,  0,  0, -2, -3, -3, -2, -2, -1,  0,  0,
-   -3, -4, -3, -2, -1,  0,  0,  0, -1, -1,  0,  1,  2,  3,  2,  1,
-    0,  1,  2,  3,  3,  3,  2,  1,  1,  1,  1,  2,  1,  0,  0, -1,
-    0,  0,  0,  0, -1, -1, -1, -1,  0, -1, -1,  0,  0,  0,  0,  0,
-    1,  1,  0,  0, -1, -1,  0,  2,  0,  0,  1,  0, -1, -1,  1,  1,
-   -2, -1,  0,  1,  1,  1,  1,  1, -3, -3,  0,  2,  2,  1,  1,  0,
-   -2, -2,  0,  1,  1,  1,  0,  0,  1,  0,  0,  0,  0,  0, -1, -1,
-    3,  1, -1, -3, -2, -1,  0,  1,  4,  2, -1, -3, -3, -1,  1,  2,
-    0,  0,  0, -1, -1, -1, -1, -1,  1,  2,  1,  0,  0,  0, -1, -1,
-    2,  3,  3,  2,  1,  0, -1, -1,  3,  4,  4,  2,  1,  0, -1, -2,
-    3,  3,  2,  1,  0, -1, -2, -2,  1,  1,  0, -1, -1, -2, -2, -3,
-    0,  0,  0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -1, -2, -2, -1,
-    1,  2,  2,  2,  2,  1,  2,  2,  0,  1,  1,  1,  1,  0,  0,  0,
-    0,  0,  0,  1,  1,  0, -1, -2,  0,  0,  0,  0,  1,  0, -1, -4,
-    1,  0,  0,  0,  0,  0, -2, -5,  1,  0,  0,  0,  0,  0, -1, -4,
-    1,  0, -1,  0,  0,  0, -1, -3,  0, -1, -1,  0,  1,  1,  1, -1,
-   -2, -1,  0,  0, -1, -1, -1, -2, -1,  0,  0,  0, -1, -1, -2, -2,
-    0,  1,  1,  0, -1, -1, -1, -2,  0,  1,  1,  0,  0,  0, -1, -1,
-    0,  1,  0,  0,  1,  1,  1,  0,  1,  1,  0,  0,  1,  2,  2,  1,
-    1,  1,  0,  0,  1,  2,  2,  1,  1,  1,  0, -1,  0,  1,  1,  0,
-    4,  2,  1,  0,  0,  1,  1,  1,  4,  2,  1,  0,  0,  0,  0,  1,
-    3,  1,  0,  0, -1, -1, -1,  0,  1,  0,  0, -1, -1, -2, -1,  0,
-    0,  0,  0,  0, -1, -1, -1,  0, -1, -1,  0,  0, -1, -1,  0,  1,
-   -2, -1,  0, -1, -1,  0,  0,  1, -2, -2, -1, -2, -1,  0,  0,  1,
-    0,  1,  1,  1,  2,  1,  0, -1, -1, -1, -1,  0,  0, -1, -2, -2,
-   -1,  0, -1,  0,  0, -1, -2, -1,  0,  0,  0,  0,  0,  0,  1,  2,
-    0,  0,  0,  0,  0,  0,  2,  3, -1,  0, -1, -1, -1, -1,  0,  3,
-   -1,  0,  0, -1, -1, -2,  0,  3,  0,  0,  0,  0, -1, -1,  1,  4,
-    2,  2,  0,  0,  0,  0,  0,  1,  1,  1, -1, -2, -1, -2, -1,  1,
-   -1, -1, -2, -2, -2, -3, -2,  0, -1,  0, -1, -1, -1, -2, -1,  1,
-    1,  1,  0,  0,  1,  0,  0,  1,  2,  2,  0,  0,  1,  0,  0,  1,
-    2,  2,  0,  0,  0,  0, -1, -1,  2,  2,  0,  0,  1,  0, -1, -1,
-   -1,  0,  1,  1,  0, -1, -1, -1,  1,  2,  3,  2,  1,  0,  0,  0,
-    0,  1,  1,  1,  0, -1,  0,  0, -2, -2, -1,  0,  1,  0,  0,  0,
-   -2, -2, -1,  2,  2,  2,  1,  0, -2, -1,  0,  1,  1,  0,  0, -1,
-   -1, -1,  0,  0, -1, -2, -1, -2,  0,  1,  1,  1,  0,  0,  1,  1,
-   -3, -3, -3, -2, -1, -1, -2, -2, -1, -1,  0,  1,  2,  1,  0,  0,
-    1,  1,  1,  2,  2,  1,  0,  0,  1,  1,  1,  1,  1,  0, -1,  1,
-    1,  0, -1, -1,  0,  0, -1,  1,  0, -1, -1, -1,  0, -1, -1,  1,
-    1,  0, -1,  0,  0, -1,  0,  2,  2,  0, -1,  0,  0,  0,  0,  2,
-    1,  0, -2, -1,  0,  1,  1,  0,  2,  0, -1, -1,  0,  1,  1,  0,
-    1,  0, -2, -1,  0,  1,  0, -1,  1,  0, -1, -1,  0,  1,  0, -1,
-    0,  1,  1,  0,  1,  1,  0,  0, -2,  1,  2,  1,  0,  0,  0,  1,
-   -5,  0,  2,  1,  0, -1,  0,  1, -6, -1,  2,  1,  0, -1,  0,  0,
-    5,  3,  0, -1, -2, -1, -1, -1,  1,  1,  0, -1, -1,  0, -1, -1,
-   -1,  0,  1,  1,  2,  2,  1,  0, -2, -1,  0,  1,  2,  1,  1,  1,
-   -2, -1, -1, -1,  0, -1,  0,  1,  0,  1,  0,  0, -1, -1,  0,  0,
-    0,  1,  1,  1,  1,  0,  0,  0, -3, -2,  0,  1,  1,  0,  0, -1,
-   -1,  0,  1,  0, -1,  0,  2,  3, -1,  0,  0, -2, -4, -2, -1,  0,
-    0,  1,  1,  0, -2, -1,  0, -1,  1,  2,  3,  1,  0,  1,  1,  0,
-   -1,  0,  1,  1,  1,  1,  1,  0, -2, -3, -2,  0,  0,  0,  1,  0,
-   -1, -2, -2,  0,  1,  0,  0, -1,  3,  1,  0,  0,  1,  0, -1, -1,
-   -2, -1,  0,  0, -1, -1,  0,  0, -1,  0,  0,  0,  0,  1,  1,  1,
-   -1, -1, -1,  0,  1,  1,  1,  1,  0, -2, -3, -1,  1,  0,  0,  0,
-    1, -1, -3, -1,  1,  1,  0, -1,  3,  1, -1,  1,  2,  2,  0, -1,
-    3,  1,  0,  1,  2,  1,  1,  0,  0, -2, -2, -1, -1,  0,  0,  0,
-    1,  0, -1, -1,  1,  2,  1,  0,  0, -1, -2, -1,  1,  2,  2,  1,
-   -1, -1, -1,  0,  0,  1,  2,  0, -2,  0,  0,  0,  0,  0,  1, -1,
-   -1,  0,  1,  0, -1, -1, -1, -1,  0,  1,  1,  2,  0, -2, -1,  0,
-    1,  2,  2,  2,  1, -1, -1,  0,  0,  1,  1,  1,  0, -2, -2, -1,
-    0,  0, -1, -1, -1, -1, -2, -2,  0,  0, -1,  0,  1,  2,  2,  1,
-    0,  0, -1, -1,  0,  1,  2,  2,  1,  1, -1, -2, -1, -1, -1, -1,
-    2,  2,  1,  0,  0, -1, -2, -2,  1,  2,  2,  1,  0,  0, -2, -2,
-    0,  0,  0,  0,  1,  1,  0, -1,  0, -1, -1, -1,  2,  3,  2,  1,
-    0, -2,  1,  2, -1,  0,  0,  1, -1, -2,  2,  3, -1,  0,  0,  0,
-    0, -2,  2,  3, -1, -1,  0,  0,  0, -1,  3,  2, -2,  0,  1,  0,
-    0, -1,  3,  1, -2,  0,  1,  0,  0, -1,  2,  1, -1,  1,  0, -1,
-    0,  0,  1, -1, -2,  0,  0, -1,  1,  0,  0, -2, -2, -1, -1, -1,
-    1,  1,  1,  1,  1, -1, -1, -2,  0,  0,  0,  1,  1,  1,  1,  1,
-    0,  0,  0,  1,  1,  1,  2,  3,  1,  0,  0, -1,  0,  0,  1,  2,
-    0, -1, -1, -2, -1,  0,  1,  2, -2, -2, -2, -2, -1,  0,  1,  1,
-   -1, -1, -1, -1,  0,  0,  0, -1,  2,  2,  2,  0, -1, -1, -2, -4,
-   -1, -2, -1, -1,  0,  1,  2,  3, -1, -1, -1, -1,  0,  1,  2,  3,
-    1,  0, -1,  0, -1,  0,  1,  2,  1,  0,  0,  0, -1,  0,  2,  2,
-    1,  0, -1, -1, -2,  0,  1,  2,  0, -2, -2, -2, -3, -1,  0,  1,
-    0, -2, -2, -2, -2, -1,  1,  1,  0,  0,  0,  0,  0,  1,  2,  2
-};
-
-/* list of codebooks for intra-coded vectors */
-const int8_t* const ff_svq1_intra_codebooks[6] = {
-    svq1_intra_codebook_4x2, svq1_intra_codebook_4x4,
-    svq1_intra_codebook_8x4, svq1_intra_codebook_8x8,
-    NULL, NULL,
-};
-
-#endif /* AVCODEC_SVQ1_CB_H */
diff --git a/libavcodec/svq1_vlc.h b/libavcodec/svq1_vlc.h
deleted file mode 100644
index 272597e..0000000
--- a/libavcodec/svq1_vlc.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SVQ1_VLC_H
-#define AVCODEC_SVQ1_VLC_H
-
-#include <stdint.h>
-
-/* values in this table range from 0..3; adjust retrieved value by +0 */
-const uint8_t ff_svq1_block_type_vlc[4][2] = {
- /* { code, length } */
-    { 0x1, 1 },  { 0x1, 2 },  { 0x1, 3 },  { 0x0, 3 }
-
-};
-
-/* values in this table range from -1..6; adjust retrieved value by -1 */
-const uint8_t ff_svq1_intra_multistage_vlc[6][8][2] = {
- /* { code, length } */
-{
-    { 0x1, 5 },  { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },
-    { 0x3, 4 },  { 0x2, 4 },  { 0x0, 5 },  { 0x1, 4 }
-},{
-    { 0x1, 4 },  { 0x3, 2 },  { 0x5, 3 },  { 0x4, 3 },
-    { 0x3, 3 },  { 0x2, 3 },  { 0x0, 4 },  { 0x1, 3 }
-},{
-    { 0x1, 5 },  { 0x1, 1 },  { 0x3, 3 },  { 0x0, 5 },
-    { 0x3, 4 },  { 0x2, 3 },  { 0x2, 4 },  { 0x1, 4 }
-},{
-    { 0x1, 6 },  { 0x1, 1 },  { 0x1, 2 },  { 0x0, 6 },
-    { 0x3, 4 },  { 0x2, 4 },  { 0x1, 5 },  { 0x1, 4 }
-},{
-    { 0x1, 6 },  { 0x1, 1 },  { 0x1, 2 },  { 0x3, 5 },
-    { 0x2, 5 },  { 0x0, 6 },  { 0x1, 5 },  { 0x1, 3 }
-},{
-    { 0x1, 7 },  { 0x1, 1 },  { 0x1, 2 },  { 0x1, 3 },
-    { 0x1, 4 },  { 0x1, 6 },  { 0x0, 7 },  { 0x1, 5 }
-}
-};
-
-/* values in this table range from -1..6; adjust retrieved value by -1 */
-const uint8_t ff_svq1_inter_multistage_vlc[6][8][2] = {
- /* { code, length } */
-{
-    { 0x3, 2 },  { 0x5, 3 },  { 0x4, 3 },  { 0x3, 3 },
-    { 0x2, 3 },  { 0x1, 3 },  { 0x1, 4 },  { 0x0, 4 }
-},{
-    { 0x3, 2 },  { 0x5, 3 },  { 0x4, 3 },  { 0x3, 3 },
-    { 0x2, 3 },  { 0x1, 3 },  { 0x1, 4 },  { 0x0, 4 }
-},{
-    { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },  { 0x3, 4 },
-    { 0x2, 4 },  { 0x1, 4 },  { 0x1, 5 },  { 0x0, 5 }
-},{
-    { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },  { 0x3, 4 },
-    { 0x2, 4 },  { 0x1, 4 },  { 0x1, 5 },  { 0x0, 5 }
-},{
-    { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },  { 0x3, 4 },
-    { 0x2, 4 },  { 0x1, 4 },  { 0x1, 5 },  { 0x0, 5 }
-},{
-    { 0x1, 1 },  { 0x1, 2 },  { 0x1, 3 },  { 0x3, 5 },
-    { 0x2, 5 },  { 0x1, 5 },  { 0x1, 6 },  { 0x0, 6 }
-}
-};
-
-/* values in this table range from 0..255; adjust retrieved value by +0 */
-const uint16_t ff_svq1_intra_mean_vlc[256][2] = {
- /* { code, length } */
-    { 0x37, 6 },  { 0x56, 7 },  { 0x1, 17 },  { 0x1, 20 },
-    { 0x2, 20 },  { 0x3, 20 },  { 0x0, 20 },  { 0x4, 20 },
-    { 0x5, 20 },  { 0x3, 19 },  { 0x15, 11 },  { 0x42, 9 },
-    { 0x14, 11 },  { 0x3, 14 },  { 0x2, 14 },  { 0x1, 15 },
-    { 0x1, 16 },  { 0x1, 12 },  { 0x2B, 10 },  { 0x18, 11 },
-    { 0xC, 11 },  { 0x41, 9 },  { 0x78, 8 },  { 0x6C, 8 },
-    { 0x55, 7 },  { 0xF, 4 },  { 0xE, 4 },  { 0x34, 6 },
-    { 0x51, 7 },  { 0x72, 8 },  { 0x6E, 8 },  { 0x40, 9 },
-    { 0x3F, 9 },  { 0x3E, 9 },  { 0x3D, 9 },  { 0x3C, 9 },
-    { 0x3B, 9 },  { 0x3A, 9 },  { 0x39, 9 },  { 0x38, 9 },
-    { 0x37, 9 },  { 0x43, 9 },  { 0x46, 9 },  { 0x47, 9 },
-    { 0x45, 9 },  { 0x44, 9 },  { 0x49, 9 },  { 0x48, 9 },
-    { 0x4A, 8 },  { 0x79, 8 },  { 0x76, 8 },  { 0x77, 8 },
-    { 0x71, 8 },  { 0x75, 8 },  { 0x74, 8 },  { 0x73, 8 },
-    { 0x6A, 8 },  { 0x55, 8 },  { 0x70, 8 },  { 0x6F, 8 },
-    { 0x52, 8 },  { 0x6D, 8 },  { 0x4C, 8 },  { 0x6B, 8 },
-    { 0x40, 7 },  { 0x69, 8 },  { 0x68, 8 },  { 0x67, 8 },
-    { 0x66, 8 },  { 0x65, 8 },  { 0x64, 8 },  { 0x63, 8 },
-    { 0x62, 8 },  { 0x61, 8 },  { 0x60, 8 },  { 0x5F, 8 },
-    { 0x5E, 8 },  { 0x5D, 8 },  { 0x5C, 8 },  { 0x5B, 8 },
-    { 0x5A, 8 },  { 0x59, 8 },  { 0x58, 8 },  { 0x57, 8 },
-    { 0x56, 8 },  { 0x3D, 7 },  { 0x54, 8 },  { 0x53, 8 },
-    { 0x3F, 7 },  { 0x51, 8 },  { 0x50, 8 },  { 0x4F, 8 },
-    { 0x4E, 8 },  { 0x4D, 8 },  { 0x41, 7 },  { 0x4B, 8 },
-    { 0x53, 7 },  { 0x3E, 7 },  { 0x48, 8 },  { 0x4F, 7 },
-    { 0x52, 7 },  { 0x45, 8 },  { 0x50, 7 },  { 0x43, 8 },
-    { 0x42, 8 },  { 0x41, 8 },  { 0x42, 7 },  { 0x43, 7 },
-    { 0x3E, 8 },  { 0x44, 7 },  { 0x3C, 8 },  { 0x45, 7 },
-    { 0x46, 7 },  { 0x47, 7 },  { 0x48, 7 },  { 0x49, 7 },
-    { 0x4A, 7 },  { 0x4B, 7 },  { 0x4C, 7 },  { 0x4D, 7 },
-    { 0x4E, 7 },  { 0x58, 7 },  { 0x59, 7 },  { 0x5A, 7 },
-    { 0x5B, 7 },  { 0x5C, 7 },  { 0x5D, 7 },  { 0x44, 8 },
-    { 0x49, 8 },  { 0x29, 8 },  { 0x3F, 8 },  { 0x3D, 8 },
-    { 0x3B, 8 },  { 0x2C, 8 },  { 0x28, 8 },  { 0x25, 8 },
-    { 0x26, 8 },  { 0x5E, 7 },  { 0x57, 7 },  { 0x54, 7 },
-    { 0x5F, 7 },  { 0x62, 7 },  { 0x63, 7 },  { 0x64, 7 },
-    { 0x61, 7 },  { 0x65, 7 },  { 0x67, 7 },  { 0x66, 7 },
-    { 0x35, 6 },  { 0x36, 6 },  { 0x60, 7 },  { 0x39, 8 },
-    { 0x3A, 8 },  { 0x38, 8 },  { 0x37, 8 },  { 0x36, 8 },
-    { 0x35, 8 },  { 0x34, 8 },  { 0x33, 8 },  { 0x32, 8 },
-    { 0x31, 8 },  { 0x30, 8 },  { 0x2D, 8 },  { 0x2B, 8 },
-    { 0x2A, 8 },  { 0x27, 8 },  { 0x40, 8 },  { 0x46, 8 },
-    { 0x47, 8 },  { 0x26, 9 },  { 0x25, 9 },  { 0x24, 9 },
-    { 0x23, 9 },  { 0x22, 9 },  { 0x2E, 8 },  { 0x2F, 8 },
-    { 0x1F, 9 },  { 0x36, 9 },  { 0x1D, 9 },  { 0x21, 9 },
-    { 0x1B, 9 },  { 0x1C, 9 },  { 0x19, 9 },  { 0x1A, 9 },
-    { 0x18, 9 },  { 0x17, 9 },  { 0x16, 9 },  { 0x1E, 9 },
-    { 0x20, 9 },  { 0x27, 9 },  { 0x28, 9 },  { 0x29, 9 },
-    { 0x2A, 9 },  { 0x2B, 9 },  { 0x2C, 9 },  { 0x2D, 9 },
-    { 0x2E, 9 },  { 0x2F, 9 },  { 0x30, 9 },  { 0x35, 9 },
-    { 0x31, 9 },  { 0x32, 9 },  { 0x33, 9 },  { 0x34, 9 },
-    { 0x19, 10 },  { 0x2A, 10 },  { 0x17, 10 },  { 0x16, 10 },
-    { 0x15, 10 },  { 0x28, 10 },  { 0x26, 10 },  { 0x25, 10 },
-    { 0x22, 10 },  { 0x21, 10 },  { 0x18, 10 },  { 0x14, 10 },
-    { 0x29, 10 },  { 0x12, 10 },  { 0xD, 10 },  { 0xE, 10 },
-    { 0xF, 10 },  { 0x10, 10 },  { 0x11, 10 },  { 0x1A, 10 },
-    { 0x1B, 10 },  { 0x1C, 10 },  { 0x1D, 10 },  { 0x1E, 10 },
-    { 0x1F, 10 },  { 0x20, 10 },  { 0x13, 10 },  { 0x23, 10 },
-    { 0x24, 10 },  { 0x9, 11 },  { 0x8, 11 },  { 0x7, 11 },
-    { 0x27, 10 },  { 0x5, 11 },  { 0xB, 11 },  { 0x6, 11 },
-    { 0x4, 11 },  { 0x3, 11 },  { 0x2, 11 },  { 0x1, 11 },
-    { 0xA, 11 },  { 0x16, 11 },  { 0x19, 11 },  { 0x17, 11 },
-    { 0xD, 11 },  { 0xE, 11 },  { 0xF, 11 },  { 0x10, 11 },
-    { 0x11, 11 },  { 0x12, 11 },  { 0x13, 11 },  { 0x1, 14 }
-};
-
-/* values in this table range from -256..255; adjust retrieved value by -256 */
-const uint16_t ff_svq1_inter_mean_vlc[512][2] = {
- /* { code, length } */
-    { 0x5A, 22 },  { 0xD4, 22 },  { 0xD5, 22 },  { 0xD6, 22 },
-    { 0xD7, 22 },  { 0xD8, 22 },  { 0xD9, 22 },  { 0xDA, 22 },
-    { 0xDB, 22 },  { 0xDC, 22 },  { 0xDD, 22 },  { 0xDE, 22 },
-    { 0xDF, 22 },  { 0xE0, 22 },  { 0xE1, 22 },  { 0xE2, 22 },
-    { 0xE3, 22 },  { 0xE4, 22 },  { 0xE5, 22 },  { 0xE6, 22 },
-    { 0xE8, 22 },  { 0xCB, 22 },  { 0xE9, 22 },  { 0xEA, 22 },
-    { 0xE7, 22 },  { 0xEC, 22 },  { 0xED, 22 },  { 0xEE, 22 },
-    { 0xEF, 22 },  { 0xF0, 22 },  { 0xF1, 22 },  { 0xF2, 22 },
-    { 0xF3, 22 },  { 0xF4, 22 },  { 0xF5, 22 },  { 0xF6, 22 },
-    { 0xF7, 22 },  { 0xF8, 22 },  { 0x102, 22 },  { 0xEB, 22 },
-    { 0xF9, 22 },  { 0xFC, 22 },  { 0xFD, 22 },  { 0xFE, 22 },
-    { 0x100, 22 },  { 0x5C, 22 },  { 0x60, 22 },  { 0x101, 22 },
-    { 0x71, 22 },  { 0x104, 22 },  { 0x105, 22 },  { 0xFB, 22 },
-    { 0xFF, 22 },  { 0x86, 21 },  { 0xFA, 22 },  { 0x7C, 22 },
-    { 0x75, 22 },  { 0x103, 22 },  { 0x78, 22 },  { 0xD3, 22 },
-    { 0x7B, 22 },  { 0x82, 22 },  { 0xD2, 22 },  { 0xD1, 22 },
-    { 0xD0, 22 },  { 0xCF, 22 },  { 0xCE, 22 },  { 0xCD, 22 },
-    { 0xCC, 22 },  { 0xC3, 22 },  { 0xCA, 22 },  { 0xC9, 22 },
-    { 0xC8, 22 },  { 0xC7, 22 },  { 0xC6, 22 },  { 0xC5, 22 },
-    { 0x8B, 22 },  { 0xC4, 22 },  { 0xC2, 22 },  { 0xC1, 22 },
-    { 0xC0, 22 },  { 0xBF, 22 },  { 0xBE, 22 },  { 0xBD, 22 },
-    { 0xBC, 22 },  { 0xBB, 22 },  { 0xBA, 22 },  { 0xB9, 22 },
-    { 0x61, 22 },  { 0x84, 22 },  { 0x85, 22 },  { 0x86, 22 },
-    { 0x87, 22 },  { 0x88, 22 },  { 0x89, 22 },  { 0x8A, 22 },
-    { 0x8C, 22 },  { 0x8D, 22 },  { 0x8E, 22 },  { 0x8F, 22 },
-    { 0x90, 22 },  { 0x91, 22 },  { 0x92, 22 },  { 0x93, 22 },
-    { 0x94, 22 },  { 0x95, 22 },  { 0x96, 22 },  { 0x97, 22 },
-    { 0x98, 22 },  { 0x99, 22 },  { 0x9A, 22 },  { 0x9B, 22 },
-    { 0x9C, 22 },  { 0x9D, 22 },  { 0x9E, 22 },  { 0x9F, 22 },
-    { 0xA0, 22 },  { 0xA1, 22 },  { 0xA2, 22 },  { 0xA3, 22 },
-    { 0xA4, 22 },  { 0xA5, 22 },  { 0xA6, 22 },  { 0xA7, 22 },
-    { 0xA8, 22 },  { 0xA9, 22 },  { 0xAA, 22 },  { 0xAB, 22 },
-    { 0x7F, 22 },  { 0x8F, 21 },  { 0xAC, 22 },  { 0xAD, 22 },
-    { 0xAE, 22 },  { 0xAF, 22 },  { 0xB0, 22 },  { 0xB1, 22 },
-    { 0x53, 20 },  { 0x90, 21 },  { 0xB2, 22 },  { 0x91, 21 },
-    { 0xB3, 22 },  { 0xB4, 22 },  { 0x54, 20 },  { 0xB5, 22 },
-    { 0xB6, 22 },  { 0x8C, 21 },  { 0x34, 19 },  { 0x3D, 18 },
-    { 0x55, 20 },  { 0xB7, 22 },  { 0xB8, 22 },  { 0x8B, 21 },
-    { 0x56, 20 },  { 0x3D, 19 },  { 0x57, 20 },  { 0x58, 20 },
-    { 0x40, 19 },  { 0x43, 19 },  { 0x47, 19 },  { 0x2A, 18 },
-    { 0x2E, 19 },  { 0x2C, 18 },  { 0x46, 19 },  { 0x59, 20 },
-    { 0x49, 19 },  { 0x2D, 19 },  { 0x38, 18 },  { 0x36, 18 },
-    { 0x39, 18 },  { 0x45, 19 },  { 0x28, 18 },  { 0x30, 18 },
-    { 0x35, 18 },  { 0x20, 17 },  { 0x44, 19 },  { 0x32, 18 },
-    { 0x31, 18 },  { 0x1F, 17 },  { 0x2F, 18 },  { 0x2E, 18 },
-    { 0x2D, 18 },  { 0x21, 17 },  { 0x22, 17 },  { 0x23, 17 },
-    { 0x24, 17 },  { 0x27, 16 },  { 0x23, 16 },  { 0x20, 16 },
-    { 0x1D, 16 },  { 0x25, 16 },  { 0x1E, 16 },  { 0x24, 16 },
-    { 0x2A, 16 },  { 0x26, 16 },  { 0x21, 15 },  { 0x29, 16 },
-    { 0x22, 15 },  { 0x23, 15 },  { 0x24, 15 },  { 0x1B, 15 },
-    { 0x1A, 15 },  { 0x1D, 15 },  { 0x1F, 15 },  { 0x27, 15 },
-    { 0x17, 14 },  { 0x18, 14 },  { 0x19, 14 },  { 0x1B, 14 },
-    { 0x1C, 14 },  { 0x1E, 14 },  { 0x25, 14 },  { 0x20, 14 },
-    { 0x21, 14 },  { 0x13, 13 },  { 0x14, 13 },  { 0x15, 13 },
-    { 0x16, 13 },  { 0x17, 13 },  { 0x18, 13 },  { 0x19, 13 },
-    { 0x1A, 13 },  { 0x18, 12 },  { 0x17, 12 },  { 0x15, 12 },
-    { 0x14, 12 },  { 0x13, 12 },  { 0x12, 12 },  { 0xF, 11 },
-    { 0x10, 11 },  { 0x12, 11 },  { 0x13, 11 },  { 0x1B, 11 },
-    { 0x1A, 11 },  { 0xE, 10 },  { 0x13, 10 },  { 0xF, 10 },
-    { 0x10, 10 },  { 0x11, 10 },  { 0x12, 10 },  { 0xD, 9 },
-    { 0x14, 9 },  { 0x15, 9 },  { 0xC, 9 },  { 0x13, 9 },
-    { 0xF, 8 },  { 0xE, 8 },  { 0x10, 8 },  { 0x11, 8 },
-    { 0xC, 7 },  { 0x9, 7 },  { 0xA, 7 },  { 0x8, 6 },
-    { 0x9, 6 },  { 0x9, 5 },  { 0x8, 5 },  { 0x5, 4 },
-    { 0x1, 1 },  { 0x3, 3 },  { 0x7, 5 },  { 0x6, 5 },
-    { 0xB, 6 },  { 0xA, 6 },  { 0xE, 7 },  { 0xF, 7 },
-    { 0xB, 7 },  { 0xD, 7 },  { 0xB, 8 },  { 0xD, 8 },
-    { 0xC, 8 },  { 0xF, 9 },  { 0x10, 9 },  { 0x11, 9 },
-    { 0xE, 9 },  { 0x12, 9 },  { 0x17, 10 },  { 0x14, 10 },
-    { 0x16, 10 },  { 0x15, 10 },  { 0x19, 11 },  { 0x18, 11 },
-    { 0x17, 11 },  { 0x16, 11 },  { 0x15, 11 },  { 0x14, 11 },
-    { 0x11, 11 },  { 0x19, 12 },  { 0x1A, 12 },  { 0x16, 12 },
-    { 0x1D, 12 },  { 0x1B, 12 },  { 0x1C, 12 },  { 0x20, 13 },
-    { 0x1C, 13 },  { 0x23, 13 },  { 0x22, 13 },  { 0x21, 13 },
-    { 0x1F, 13 },  { 0x1E, 13 },  { 0x1B, 13 },  { 0x1D, 13 },
-    { 0x24, 14 },  { 0x16, 14 },  { 0x1A, 14 },  { 0x22, 14 },
-    { 0x1D, 14 },  { 0x1F, 14 },  { 0x15, 14 },  { 0x23, 14 },
-    { 0x18, 15 },  { 0x20, 15 },  { 0x29, 15 },  { 0x28, 15 },
-    { 0x26, 15 },  { 0x25, 15 },  { 0x19, 15 },  { 0x1C, 15 },
-    { 0x1E, 15 },  { 0x17, 15 },  { 0x2C, 16 },  { 0x2B, 16 },
-    { 0x1C, 16 },  { 0x21, 16 },  { 0x2D, 16 },  { 0x28, 16 },
-    { 0x1F, 16 },  { 0x1B, 16 },  { 0x1A, 16 },  { 0x22, 16 },
-    { 0x2D, 17 },  { 0x32, 17 },  { 0x2C, 17 },  { 0x27, 17 },
-    { 0x31, 17 },  { 0x33, 17 },  { 0x2F, 17 },  { 0x2B, 17 },
-    { 0x37, 18 },  { 0x2A, 17 },  { 0x2E, 17 },  { 0x30, 17 },
-    { 0x29, 17 },  { 0x28, 17 },  { 0x26, 17 },  { 0x25, 17 },
-    { 0x2F, 19 },  { 0x33, 18 },  { 0x34, 18 },  { 0x30, 19 },
-    { 0x3A, 18 },  { 0x3B, 18 },  { 0x31, 19 },  { 0x3C, 18 },
-    { 0x2B, 18 },  { 0x29, 18 },  { 0x48, 19 },  { 0x27, 18 },
-    { 0x42, 19 },  { 0x41, 19 },  { 0x26, 18 },  { 0x52, 20 },
-    { 0x51, 20 },  { 0x3F, 19 },  { 0x3E, 19 },  { 0x39, 19 },
-    { 0x3C, 19 },  { 0x3B, 19 },  { 0x3A, 19 },  { 0x25, 18 },
-    { 0x38, 19 },  { 0x50, 20 },  { 0x37, 19 },  { 0x36, 19 },
-    { 0x87, 21 },  { 0x4F, 20 },  { 0x35, 19 },  { 0x4E, 20 },
-    { 0x33, 19 },  { 0x32, 19 },  { 0x4D, 20 },  { 0x4C, 20 },
-    { 0x83, 22 },  { 0x4B, 20 },  { 0x81, 22 },  { 0x80, 22 },
-    { 0x8E, 21 },  { 0x7E, 22 },  { 0x7D, 22 },  { 0x84, 21 },
-    { 0x8D, 21 },  { 0x7A, 22 },  { 0x79, 22 },  { 0x4A, 20 },
-    { 0x77, 22 },  { 0x76, 22 },  { 0x89, 21 },  { 0x74, 22 },
-    { 0x73, 22 },  { 0x72, 22 },  { 0x49, 20 },  { 0x70, 22 },
-    { 0x6F, 22 },  { 0x6E, 22 },  { 0x6D, 22 },  { 0x6C, 22 },
-    { 0x6B, 22 },  { 0x6A, 22 },  { 0x69, 22 },  { 0x68, 22 },
-    { 0x67, 22 },  { 0x66, 22 },  { 0x65, 22 },  { 0x64, 22 },
-    { 0x63, 22 },  { 0x62, 22 },  { 0x8A, 21 },  { 0x88, 21 },
-    { 0x5F, 22 },  { 0x5E, 22 },  { 0x5D, 22 },  { 0x85, 21 },
-    { 0x5B, 22 },  { 0x83, 21 },  { 0x59, 22 },  { 0x58, 22 },
-    { 0x57, 22 },  { 0x56, 22 },  { 0x55, 22 },  { 0x54, 22 },
-    { 0x53, 22 },  { 0x52, 22 },  { 0x51, 22 },  { 0x50, 22 },
-    { 0x4F, 22 },  { 0x4E, 22 },  { 0x4D, 22 },  { 0x4C, 22 },
-    { 0x4B, 22 },  { 0x4A, 22 },  { 0x49, 22 },  { 0x48, 22 },
-    { 0x47, 22 },  { 0x46, 22 },  { 0x45, 22 },  { 0x44, 22 },
-    { 0x43, 22 },  { 0x42, 22 },  { 0x41, 22 },  { 0x40, 22 },
-    { 0x3F, 22 },  { 0x3E, 22 },  { 0x3D, 22 },  { 0x3C, 22 },
-    { 0x3B, 22 },  { 0x3A, 22 },  { 0x39, 22 },  { 0x38, 22 },
-    { 0x37, 22 },  { 0x36, 22 },  { 0x35, 22 },  { 0x34, 22 },
-    { 0x33, 22 },  { 0x32, 22 },  { 0x31, 22 },  { 0x30, 22 },
-    { 0x2F, 22 },  { 0x2E, 22 },  { 0x2D, 22 },  { 0x2C, 22 },
-    { 0x2B, 22 },  { 0x2A, 22 },  { 0x29, 22 },  { 0x28, 22 },
-    { 0x27, 22 },  { 0x26, 22 },  { 0x25, 22 },  { 0x24, 22 },
-    { 0x23, 22 },  { 0x22, 22 },  { 0x21, 22 },  { 0x20, 22 },
-    { 0x1F, 22 },  { 0x1E, 22 },  { 0x1D, 22 },  { 0x1C, 22 },
-    { 0x1B, 22 },  { 0x1A, 22 },  { 0x19, 22 },  { 0x18, 22 },
-    { 0x17, 22 },  { 0x16, 22 },  { 0x15, 22 },  { 0x14, 22 },
-    { 0x13, 22 },  { 0x12, 22 },  { 0x11, 22 },  { 0x10, 22 },
-    { 0xF, 22 },  { 0xE, 22 },  { 0xD, 22 },  { 0xC, 22 },
-    { 0xB, 22 },  { 0xA, 22 },  { 0x9, 22 },  { 0x8, 22 },
-    { 0x7, 22 },  { 0x6, 22 },  { 0x5, 22 },  { 0x4, 22 },
-    { 0x3, 22 },  { 0x2, 22 },  { 0x1, 22 },  { 0x0, 22 }
-};
-
-#endif /* AVCODEC_SVQ1_VLC_H */
diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
deleted file mode 100644
index 2aa28ab..0000000
--- a/libavcodec/svq1dec.c
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * SVQ1 decoder
- * ported to MPlayer by Arpi <arpi at thot.banki.hu>
- * ported to libavcodec by Nick Kurshev <nickols_k at mail.ru>
- *
- * Copyright (C) 2002 the xine project
- * Copyright (C) 2002 the ffmpeg project
- *
- * SVQ1 Encoder (c) 2004 Mike Melanson <melanson at pcisys.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sorenson Vector Quantizer #1 (SVQ1) video codec.
- * For more information of the SVQ1 algorithm, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-
-//#define DEBUG_SVQ1
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "mathops.h"
-
-#include "svq1.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-extern const uint8_t mvtab[33][2];
-
-static VLC svq1_block_type;
-static VLC svq1_motion_component;
-static VLC svq1_intra_multistage[6];
-static VLC svq1_inter_multistage[6];
-static VLC svq1_intra_mean;
-static VLC svq1_inter_mean;
-
-/* motion vector (prediction) */
-typedef struct svq1_pmv_s {
-  int           x;
-  int           y;
-} svq1_pmv;
-
-static const uint16_t checksum_table[256] = {
-  0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
-  0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
-  0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
-  0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
-  0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
-  0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
-  0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
-  0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
-  0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
-  0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
-  0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
-  0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
-  0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
-  0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
-  0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
-  0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
-  0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
-  0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
-  0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
-  0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
-  0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
-  0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
-  0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
-  0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
-  0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
-  0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
-  0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
-  0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
-  0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
-  0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
-  0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
-  0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
-};
-
-static const uint8_t string_table[256] = {
-  0x00, 0xD5, 0x7F, 0xAA, 0xFE, 0x2B, 0x81, 0x54,
-  0x29, 0xFC, 0x56, 0x83, 0xD7, 0x02, 0xA8, 0x7D,
-  0x52, 0x87, 0x2D, 0xF8, 0xAC, 0x79, 0xD3, 0x06,
-  0x7B, 0xAE, 0x04, 0xD1, 0x85, 0x50, 0xFA, 0x2F,
-  0xA4, 0x71, 0xDB, 0x0E, 0x5A, 0x8F, 0x25, 0xF0,
-  0x8D, 0x58, 0xF2, 0x27, 0x73, 0xA6, 0x0C, 0xD9,
-  0xF6, 0x23, 0x89, 0x5C, 0x08, 0xDD, 0x77, 0xA2,
-  0xDF, 0x0A, 0xA0, 0x75, 0x21, 0xF4, 0x5E, 0x8B,
-  0x9D, 0x48, 0xE2, 0x37, 0x63, 0xB6, 0x1C, 0xC9,
-  0xB4, 0x61, 0xCB, 0x1E, 0x4A, 0x9F, 0x35, 0xE0,
-  0xCF, 0x1A, 0xB0, 0x65, 0x31, 0xE4, 0x4E, 0x9B,
-  0xE6, 0x33, 0x99, 0x4C, 0x18, 0xCD, 0x67, 0xB2,
-  0x39, 0xEC, 0x46, 0x93, 0xC7, 0x12, 0xB8, 0x6D,
-  0x10, 0xC5, 0x6F, 0xBA, 0xEE, 0x3B, 0x91, 0x44,
-  0x6B, 0xBE, 0x14, 0xC1, 0x95, 0x40, 0xEA, 0x3F,
-  0x42, 0x97, 0x3D, 0xE8, 0xBC, 0x69, 0xC3, 0x16,
-  0xEF, 0x3A, 0x90, 0x45, 0x11, 0xC4, 0x6E, 0xBB,
-  0xC6, 0x13, 0xB9, 0x6C, 0x38, 0xED, 0x47, 0x92,
-  0xBD, 0x68, 0xC2, 0x17, 0x43, 0x96, 0x3C, 0xE9,
-  0x94, 0x41, 0xEB, 0x3E, 0x6A, 0xBF, 0x15, 0xC0,
-  0x4B, 0x9E, 0x34, 0xE1, 0xB5, 0x60, 0xCA, 0x1F,
-  0x62, 0xB7, 0x1D, 0xC8, 0x9C, 0x49, 0xE3, 0x36,
-  0x19, 0xCC, 0x66, 0xB3, 0xE7, 0x32, 0x98, 0x4D,
-  0x30, 0xE5, 0x4F, 0x9A, 0xCE, 0x1B, 0xB1, 0x64,
-  0x72, 0xA7, 0x0D, 0xD8, 0x8C, 0x59, 0xF3, 0x26,
-  0x5B, 0x8E, 0x24, 0xF1, 0xA5, 0x70, 0xDA, 0x0F,
-  0x20, 0xF5, 0x5F, 0x8A, 0xDE, 0x0B, 0xA1, 0x74,
-  0x09, 0xDC, 0x76, 0xA3, 0xF7, 0x22, 0x88, 0x5D,
-  0xD6, 0x03, 0xA9, 0x7C, 0x28, 0xFD, 0x57, 0x82,
-  0xFF, 0x2A, 0x80, 0x55, 0x01, 0xD4, 0x7E, 0xAB,
-  0x84, 0x51, 0xFB, 0x2E, 0x7A, 0xAF, 0x05, 0xD0,
-  0xAD, 0x78, 0xD2, 0x07, 0x53, 0x86, 0x2C, 0xF9
-};
-
-#define SVQ1_PROCESS_VECTOR()\
-    for (; level > 0; i++) {\
-      /* process next depth */\
-      if (i == m) {\
-        m = n;\
-        if (--level == 0)\
-          break;\
-      }\
-      /* divide block if next bit set */\
-      if (get_bits1 (bitbuf) == 0)\
-        break;\
-      /* add child nodes */\
-      list[n++] = list[i];\
-      list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level / 2) + 1));\
-    }
-
-#define SVQ1_ADD_CODEBOOK()\
-          /* add codebook entries to vector */\
-          for (j=0; j < stages; j++) {\
-            n3  = codebook[entries[j]] ^ 0x80808080;\
-            n1 += ((n3 & 0xFF00FF00) >> 8);\
-            n2 +=  (n3 & 0x00FF00FF);\
-          }\
-\
-          /* clip to [0..255] */\
-          if (n1 & 0xFF00FF00) {\
-            n3  = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n1 += 0x7F007F00;\
-            n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n1 &= (n3 & 0x00FF00FF);\
-          }\
-\
-          if (n2 & 0xFF00FF00) {\
-            n3  = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n2 += 0x7F007F00;\
-            n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n2 &= (n3 & 0x00FF00FF);\
-          }
-
-#define SVQ1_DO_CODEBOOK_INTRA()\
-      for (y=0; y < height; y++) {\
-        for (x=0; x < (width / 4); x++, codebook++) {\
-        n1 = n4;\
-        n2 = n4;\
-        SVQ1_ADD_CODEBOOK()\
-        /* store result */\
-        dst[x] = (n1 << 8) | n2;\
-        }\
-        dst += (pitch / 4);\
-      }
-
-#define SVQ1_DO_CODEBOOK_NONINTRA()\
-      for (y=0; y < height; y++) {\
-        for (x=0; x < (width / 4); x++, codebook++) {\
-        n3 = dst[x];\
-        /* add mean value to vector */\
-        n1 = ((n3 & 0xFF00FF00) >> 8) + n4;\
-        n2 =  (n3 & 0x00FF00FF)          + n4;\
-        SVQ1_ADD_CODEBOOK()\
-        /* store result */\
-        dst[x] = (n1 << 8) | n2;\
-        }\
-        dst += (pitch / 4);\
-      }
-
-#define SVQ1_CALC_CODEBOOK_ENTRIES(cbook)\
-      codebook = (const uint32_t *) cbook[level];\
-      bit_cache = get_bits (bitbuf, 4*stages);\
-      /* calculate codebook entries for this vector */\
-      for (j=0; j < stages; j++) {\
-        entries[j] = (((bit_cache >> (4*(stages - j - 1))) & 0xF) + 16*j) << (level + 1);\
-      }\
-      mean -= (stages * 128);\
-      n4    = ((mean + (mean >> 31)) << 16) | (mean & 0xFFFF);
-
-static int svq1_decode_block_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch ) {
-  uint32_t    bit_cache;
-  uint8_t    *list[63];
-  uint32_t   *dst;
-  const uint32_t *codebook;
-  int         entries[6];
-  int         i, j, m, n;
-  int         mean, stages;
-  unsigned    x, y, width, height, level;
-  uint32_t    n1, n2, n3, n4;
-
-  /* initialize list for breadth first processing of vectors */
-  list[0] = pixels;
-
-  /* recursively process vector */
-  for (i=0, m=1, n=1, level=5; i < n; i++) {
-    SVQ1_PROCESS_VECTOR();
-
-    /* destination address and vector size */
-    dst = (uint32_t *) list[i];
-    width = 1 << ((4 + level) /2);
-    height = 1 << ((3 + level) /2);
-
-    /* get number of stages (-1 skips vector, 0 for mean only) */
-    stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 1;
-
-    if (stages == -1) {
-        for (y=0; y < height; y++) {
-          memset (&dst[y*(pitch / 4)], 0, width);
-        }
-      continue;                 /* skip vector */
-    }
-
-    if ((stages > 0) && (level >= 4)) {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",stages,level);
-#endif
-      return -1;        /* invalid vector */
-    }
-
-    mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
-
-    if (stages == 0) {
-      for (y=0; y < height; y++) {
-        memset (&dst[y*(pitch / 4)], mean, width);
-      }
-    } else {
-      SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_intra_codebooks);
-      SVQ1_DO_CODEBOOK_INTRA()
-    }
-  }
-
-  return 0;
-}
-
-static int svq1_decode_block_non_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch ) {
-  uint32_t    bit_cache;
-  uint8_t    *list[63];
-  uint32_t   *dst;
-  const uint32_t *codebook;
-  int         entries[6];
-  int         i, j, m, n;
-  int         mean, stages;
-  int         x, y, width, height, level;
-  uint32_t    n1, n2, n3, n4;
-
-  /* initialize list for breadth first processing of vectors */
-  list[0] = pixels;
-
-  /* recursively process vector */
-  for (i=0, m=1, n=1, level=5; i < n; i++) {
-    SVQ1_PROCESS_VECTOR();
-
-    /* destination address and vector size */
-    dst = (uint32_t *) list[i];
-    width = 1 << ((4 + level) /2);
-    height = 1 << ((3 + level) /2);
-
-    /* get number of stages (-1 skips vector, 0 for mean only) */
-    stages = get_vlc2(bitbuf, svq1_inter_multistage[level].table, 3, 2) - 1;
-
-    if (stages == -1) continue; /* skip vector */
-
-    if ((stages > 0) && (level >= 4)) {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",stages,level);
-#endif
-      return -1;        /* invalid vector */
-    }
-
-    mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
-
-    SVQ1_CALC_CODEBOOK_ENTRIES(ff_svq1_inter_codebooks);
-    SVQ1_DO_CODEBOOK_NONINTRA()
-  }
-  return 0;
-}
-
-static int svq1_decode_motion_vector (GetBitContext *bitbuf, svq1_pmv *mv, svq1_pmv **pmv) {
-  int        diff;
-  int        i;
-
-  for (i=0; i < 2; i++) {
-
-    /* get motion code */
-    diff = get_vlc2(bitbuf, svq1_motion_component.table, 7, 2);
-    if(diff<0)
-        return -1;
-    else if(diff){
-        if(get_bits1(bitbuf)) diff= -diff;
-    }
-
-    /* add median of motion vector predictors and clip result */
-    if (i == 1)
-      mv->y = ((diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y)) << 26) >> 26;
-    else
-      mv->x = ((diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x)) << 26) >> 26;
-  }
-
-  return 0;
-}
-
-static void svq1_skip_block (uint8_t *current, uint8_t *previous, int pitch, int x, int y) {
-  uint8_t *src;
-  uint8_t *dst;
-  int      i;
-
-  src = &previous[x + y*pitch];
-  dst = current;
-
-  for (i=0; i < 16; i++) {
-    memcpy (dst, src, 16);
-    src += pitch;
-    dst += pitch;
-  }
-}
-
-static int svq1_motion_inter_block (MpegEncContext *s, GetBitContext *bitbuf,
-                               uint8_t *current, uint8_t *previous, int pitch,
-                               svq1_pmv *motion, int x, int y) {
-  uint8_t    *src;
-  uint8_t    *dst;
-  svq1_pmv    mv;
-  svq1_pmv   *pmv[3];
-  int         result;
-
-  /* predict and decode motion vector */
-  pmv[0] = &motion[0];
-  if (y == 0) {
-    pmv[1] =
-    pmv[2] = pmv[0];
-  }
-  else {
-    pmv[1] = &motion[(x / 8) + 2];
-    pmv[2] = &motion[(x / 8) + 4];
-  }
-
-  result = svq1_decode_motion_vector (bitbuf, &mv, pmv);
-
-  if (result != 0)
-    return result;
-
-  motion[0].x                =
-  motion[(x / 8) + 2].x      =
-  motion[(x / 8) + 3].x      = mv.x;
-  motion[0].y                =
-  motion[(x / 8) + 2].y      =
-  motion[(x / 8) + 3].y      = mv.y;
-
-  if(y + (mv.y >> 1)<0)
-     mv.y= 0;
-  if(x + (mv.x >> 1)<0)
-     mv.x= 0;
-
-#if 0
-  int w= (s->width+15)&~15;
-  int h= (s->height+15)&~15;
-  if(x + (mv.x >> 1)<0 || y + (mv.y >> 1)<0 || x + (mv.x >> 1) + 16 > w || y + (mv.y >> 1) + 16> h)
-      av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mv.x >> 1), y + (mv.y >> 1));
-#endif
-
-  src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch];
-  dst = current;
-
-  s->dsp.put_pixels_tab[0][((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16);
-
-  return 0;
-}
-
-static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf,
-                                  uint8_t *current, uint8_t *previous, int pitch,
-                                  svq1_pmv *motion,int x, int y) {
-  uint8_t    *src;
-  uint8_t    *dst;
-  svq1_pmv    mv;
-  svq1_pmv   *pmv[4];
-  int         i, result;
-
-  /* predict and decode motion vector (0) */
-  pmv[0] = &motion[0];
-  if (y == 0) {
-    pmv[1] =
-    pmv[2] = pmv[0];
-  }
-  else {
-    pmv[1] = &motion[(x / 8) + 2];
-    pmv[2] = &motion[(x / 8) + 4];
-  }
-
-  result = svq1_decode_motion_vector (bitbuf, &mv, pmv);
-
-  if (result != 0)
-    return result;
-
-  /* predict and decode motion vector (1) */
-  pmv[0] = &mv;
-  if (y == 0) {
-    pmv[1] =
-    pmv[2] = pmv[0];
-  }
-  else {
-    pmv[1] = &motion[(x / 8) + 3];
-  }
-  result = svq1_decode_motion_vector (bitbuf, &motion[0], pmv);
-
-  if (result != 0)
-    return result;
-
-  /* predict and decode motion vector (2) */
-  pmv[1] = &motion[0];
-  pmv[2] = &motion[(x / 8) + 1];
-
-  result = svq1_decode_motion_vector (bitbuf, &motion[(x / 8) + 2], pmv);
-
-  if (result != 0)
-    return result;
-
-  /* predict and decode motion vector (3) */
-  pmv[2] = &motion[(x / 8) + 2];
-  pmv[3] = &motion[(x / 8) + 3];
-
-  result = svq1_decode_motion_vector (bitbuf, pmv[3], pmv);
-
-  if (result != 0)
-    return result;
-
-  /* form predictions */
-  for (i=0; i < 4; i++) {
-    int mvx= pmv[i]->x + (i&1)*16;
-    int mvy= pmv[i]->y + (i>>1)*16;
-
-    ///XXX /FIXME clipping or padding?
-    if(y + (mvy >> 1)<0)
-       mvy= 0;
-    if(x + (mvx >> 1)<0)
-       mvx= 0;
-
-#if 0
-  int w= (s->width+15)&~15;
-  int h= (s->height+15)&~15;
-  if(x + (mvx >> 1)<0 || y + (mvy >> 1)<0 || x + (mvx >> 1) + 8 > w || y + (mvy >> 1) + 8> h)
-      av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mvx >> 1), y + (mvy >> 1));
-#endif
-    src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch];
-    dst = current;
-
-    s->dsp.put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst,src,pitch,8);
-
-    /* select next block */
-    if (i & 1) {
-      current  += 8*(pitch - 1);
-    } else {
-      current  += 8;
-    }
-  }
-
-  return 0;
-}
-
-static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf,
-                        uint8_t *current, uint8_t *previous, int pitch,
-                        svq1_pmv *motion, int x, int y) {
-  uint32_t block_type;
-  int      result = 0;
-
-  /* get block type */
-  block_type = get_vlc2(bitbuf, svq1_block_type.table, 2, 2);
-
-  /* reset motion vectors */
-  if (block_type == SVQ1_BLOCK_SKIP || block_type == SVQ1_BLOCK_INTRA) {
-    motion[0].x                 =
-    motion[0].y                 =
-    motion[(x / 8) + 2].x =
-    motion[(x / 8) + 2].y =
-    motion[(x / 8) + 3].x =
-    motion[(x / 8) + 3].y = 0;
-  }
-
-  switch (block_type) {
-  case SVQ1_BLOCK_SKIP:
-    svq1_skip_block (current, previous, pitch, x, y);
-    break;
-
-  case SVQ1_BLOCK_INTER:
-    result = svq1_motion_inter_block (s, bitbuf, current, previous, pitch, motion, x, y);
-
-    if (result != 0)
-    {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_block %i\n",result);
-#endif
-      break;
-    }
-    result = svq1_decode_block_non_intra (bitbuf, current, pitch);
-    break;
-
-  case SVQ1_BLOCK_INTER_4V:
-    result = svq1_motion_inter_4v_block (s, bitbuf, current, previous, pitch, motion, x, y);
-
-    if (result != 0)
-    {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_4v_block %i\n",result);
-#endif
-      break;
-    }
-    result = svq1_decode_block_non_intra (bitbuf, current, pitch);
-    break;
-
-  case SVQ1_BLOCK_INTRA:
-    result = svq1_decode_block_intra (bitbuf, current, pitch);
-    break;
-  }
-
-  return result;
-}
-
-uint16_t ff_svq1_packet_checksum (const uint8_t *data, const int length, int value) {
-  int i;
-
-  for (i=0; i < length; i++) {
-    value = checksum_table[data[i] ^ (value >> 8)] ^ ((value & 0xFF) << 8);
-  }
-
-  return value;
-}
-
-static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out) {
-  uint8_t seed;
-  int     i;
-
-  out[0] = get_bits (bitbuf, 8);
-
-  seed = string_table[out[0]];
-
-  for (i=1; i <= out[0]; i++) {
-    out[i] = get_bits (bitbuf, 8) ^ seed;
-    seed   = string_table[out[i] ^ seed];
-  }
-}
-
-static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
-  int frame_size_code;
-  int temporal_reference;
-
-  temporal_reference = get_bits (bitbuf, 8);
-
-  /* frame type */
-  s->pict_type= get_bits (bitbuf, 2)+1;
-  if(s->pict_type==4)
-      return -1;
-
-  if (s->pict_type == FF_I_TYPE) {
-
-    /* unknown fields */
-    if (s->f_code == 0x50 || s->f_code == 0x60) {
-      int csum = get_bits (bitbuf, 16);
-
-      csum = ff_svq1_packet_checksum (bitbuf->buffer, bitbuf->size_in_bits>>3, csum);
-
-//      av_log(s->avctx, AV_LOG_INFO, "%s checksum (%02x) for packet data\n",
-//              (csum == 0) ? "correct" : "incorrect", csum);
-    }
-
-    if ((s->f_code ^ 0x10) >= 0x50) {
-      uint8_t msg[256];
-
-      svq1_parse_string (bitbuf, msg);
-
-      av_log(s->avctx, AV_LOG_INFO, "embedded message: \"%s\"\n", (char *) msg);
-    }
-
-    skip_bits (bitbuf, 2);
-    skip_bits (bitbuf, 2);
-    skip_bits1 (bitbuf);
-
-    /* load frame size */
-    frame_size_code = get_bits (bitbuf, 3);
-
-    if (frame_size_code == 7) {
-      /* load width, height (12 bits each) */
-      s->width = get_bits (bitbuf, 12);
-      s->height = get_bits (bitbuf, 12);
-
-      if (!s->width || !s->height)
-        return -1;
-    } else {
-      /* get width, height from table */
-      s->width = ff_svq1_frame_size_table[frame_size_code].width;
-      s->height = ff_svq1_frame_size_table[frame_size_code].height;
-    }
-  }
-
-  /* unknown fields */
-  if (get_bits1 (bitbuf) == 1) {
-    skip_bits1 (bitbuf);       /* use packet checksum if (1) */
-    skip_bits1 (bitbuf);       /* component checksums after image data if (1) */
-
-    if (get_bits (bitbuf, 2) != 0)
-      return -1;
-  }
-
-  if (get_bits1 (bitbuf) == 1) {
-    skip_bits1 (bitbuf);
-    skip_bits (bitbuf, 4);
-    skip_bits1 (bitbuf);
-    skip_bits (bitbuf, 2);
-
-    while (get_bits1 (bitbuf) == 1) {
-      skip_bits (bitbuf, 8);
-    }
-  }
-
-  return 0;
-}
-
-static int svq1_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-  const uint8_t *buf = avpkt->data;
-  int buf_size = avpkt->size;
-  MpegEncContext *s=avctx->priv_data;
-  uint8_t        *current, *previous;
-  int             result, i, x, y, width, height;
-  AVFrame *pict = data;
-
-  /* initialize bit buffer */
-  init_get_bits(&s->gb,buf,buf_size*8);
-
-  /* decode frame header */
-  s->f_code = get_bits (&s->gb, 22);
-
-  if ((s->f_code & ~0x70) || !(s->f_code & 0x60))
-    return -1;
-
-  /* swap some header bytes (why?) */
-  if (s->f_code != 0x20) {
-    uint32_t *src = (uint32_t *) (buf + 4);
-
-    for (i=0; i < 4; i++) {
-      src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
-    }
-  }
-
-  result = svq1_decode_frame_header (&s->gb, s);
-
-  if (result != 0)
-  {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_frame_header %i\n",result);
-#endif
-    return result;
-  }
-
-  //FIXME this avoids some confusion for "B frames" without 2 references
-  //this should be removed after libavcodec can handle more flexible picture types & ordering
-  if(s->pict_type==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size;
-
-  if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
-  if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
-     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
-     || avctx->skip_frame >= AVDISCARD_ALL)
-      return buf_size;
-
-  if(MPV_frame_start(s, avctx) < 0)
-      return -1;
-
-  /* decode y, u and v components */
-  for (i=0; i < 3; i++) {
-    int linesize;
-    if (i == 0) {
-      width  = FFALIGN(s->width, 16);
-      height = FFALIGN(s->height, 16);
-      linesize= s->linesize;
-    } else {
-      if(s->flags&CODEC_FLAG_GRAY) break;
-      width  = FFALIGN(s->width/4, 16);
-      height = FFALIGN(s->height/4, 16);
-      linesize= s->uvlinesize;
-    }
-
-    current  = s->current_picture.data[i];
-
-    if(s->pict_type==FF_B_TYPE){
-        previous = s->next_picture.data[i];
-    }else{
-        previous = s->last_picture.data[i];
-    }
-
-    if (s->pict_type == FF_I_TYPE) {
-      /* keyframe */
-      for (y=0; y < height; y+=16) {
-        for (x=0; x < width; x+=16) {
-          result = svq1_decode_block_intra (&s->gb, &current[x], linesize);
-          if (result != 0)
-          {
-//#ifdef DEBUG_SVQ1
-            av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n",result);
-//#endif
-            return result;
-          }
-        }
-        current += 16*linesize;
-      }
-    } else {
-      svq1_pmv pmv[width/8+3];
-      /* delta frame */
-      memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv));
-
-      for (y=0; y < height; y+=16) {
-        for (x=0; x < width; x+=16) {
-          result = svq1_decode_delta_block (s, &s->gb, &current[x], previous,
-                                            linesize, pmv, x, y);
-          if (result != 0)
-          {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_delta_block %i\n",result);
-#endif
-            return result;
-          }
-        }
-
-        pmv[0].x =
-        pmv[0].y = 0;
-
-        current += 16*linesize;
-      }
-    }
-  }
-
-  *pict = *(AVFrame*)&s->current_picture;
-
-
-  MPV_frame_end(s);
-
-  *data_size=sizeof(AVFrame);
-  return buf_size;
-}
-
-static av_cold int svq1_decode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    int i;
-    int offset = 0;
-
-    MPV_decode_defaults(s);
-
-    s->avctx = avctx;
-    s->width = (avctx->width+3)&~3;
-    s->height = (avctx->height+3)&~3;
-    s->codec_id= avctx->codec->id;
-    avctx->pix_fmt = PIX_FMT_YUV410P;
-    avctx->has_b_frames= 1; // not true, but DP frames and these behave like unidirectional b frames
-    s->flags= avctx->flags;
-    if (MPV_common_init(s) < 0) return -1;
-
-    INIT_VLC_STATIC(&svq1_block_type, 2, 4,
-        &ff_svq1_block_type_vlc[0][1], 2, 1,
-        &ff_svq1_block_type_vlc[0][0], 2, 1, 6);
-
-    INIT_VLC_STATIC(&svq1_motion_component, 7, 33,
-        &mvtab[0][1], 2, 1,
-        &mvtab[0][0], 2, 1, 176);
-
-    for (i = 0; i < 6; i++) {
-        static const uint8_t sizes[2][6] = {{14, 10, 14, 18, 16, 18}, {10, 10, 14, 14, 14, 16}};
-        static VLC_TYPE table[168][2];
-        svq1_intra_multistage[i].table = &table[offset];
-        svq1_intra_multistage[i].table_allocated = sizes[0][i];
-        offset += sizes[0][i];
-        init_vlc(&svq1_intra_multistage[i], 3, 8,
-            &ff_svq1_intra_multistage_vlc[i][0][1], 2, 1,
-            &ff_svq1_intra_multistage_vlc[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
-        svq1_inter_multistage[i].table = &table[offset];
-        svq1_inter_multistage[i].table_allocated = sizes[1][i];
-        offset += sizes[1][i];
-        init_vlc(&svq1_inter_multistage[i], 3, 8,
-            &ff_svq1_inter_multistage_vlc[i][0][1], 2, 1,
-            &ff_svq1_inter_multistage_vlc[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
-    }
-
-    INIT_VLC_STATIC(&svq1_intra_mean, 8, 256,
-        &ff_svq1_intra_mean_vlc[0][1], 4, 2,
-        &ff_svq1_intra_mean_vlc[0][0], 4, 2, 632);
-
-    INIT_VLC_STATIC(&svq1_inter_mean, 9, 512,
-        &ff_svq1_inter_mean_vlc[0][1], 4, 2,
-        &ff_svq1_inter_mean_vlc[0][0], 4, 2, 1434);
-
-    return 0;
-}
-
-static av_cold int svq1_decode_end(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    MPV_common_end(s);
-    return 0;
-}
-
-
-AVCodec svq1_decoder = {
-    "svq1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SVQ1,
-    sizeof(MpegEncContext),
-    svq1_decode_init,
-    NULL,
-    svq1_decode_end,
-    svq1_decode_frame,
-    CODEC_CAP_DR1,
-    .flush= ff_mpeg_flush,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
-};
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
deleted file mode 100644
index c89be25..0000000
--- a/libavcodec/svq1enc.c
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- * SVQ1 Encoder
- * Copyright (C) 2004 Mike Melanson <melanson at pcisys.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sorenson Vector Quantizer #1 (SVQ1) video codec.
- * For more information of the SVQ1 algorithm, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "internal.h"
-
-#include "svq1.h"
-#include "svq1enc_cb.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-typedef struct SVQ1Context {
-    MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to make the motion estimation eventually independent of MpegEncContext, so this will be removed then (FIXME/XXX)
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame picture;
-    AVFrame current_picture;
-    AVFrame last_picture;
-    PutBitContext pb;
-    GetBitContext gb;
-
-    PutBitContext reorder_pb[6]; //why ooh why this sick breadth first order, everything is slower and more complex
-
-    int frame_width;
-    int frame_height;
-
-    /* Y plane block dimensions */
-    int y_block_width;
-    int y_block_height;
-
-    /* U & V plane (C planes) block dimensions */
-    int c_block_width;
-    int c_block_height;
-
-    uint16_t *mb_type;
-    uint32_t *dummy;
-    int16_t (*motion_val8[3])[2];
-    int16_t (*motion_val16[3])[2];
-
-    int64_t rd_total;
-
-    uint8_t *scratchbuf;
-} SVQ1Context;
-
-static void svq1_write_header(SVQ1Context *s, int frame_type)
-{
-    int i;
-
-    /* frame code */
-    put_bits(&s->pb, 22, 0x20);
-
-    /* temporal reference (sure hope this is a "don't care") */
-    put_bits(&s->pb, 8, 0x00);
-
-    /* frame type */
-    put_bits(&s->pb, 2, frame_type - 1);
-
-    if (frame_type == FF_I_TYPE) {
-
-        /* no checksum since frame code is 0x20 */
-
-        /* no embedded string either */
-
-        /* output 5 unknown bits (2 + 2 + 1) */
-        put_bits(&s->pb, 5, 2); /* 2 needed by quicktime decoder */
-
-        i= ff_match_2uint16(ff_svq1_frame_size_table, FF_ARRAY_ELEMS(ff_svq1_frame_size_table), s->frame_width, s->frame_height);
-        put_bits(&s->pb, 3, i);
-
-        if (i == 7)
-        {
-                put_bits(&s->pb, 12, s->frame_width);
-                put_bits(&s->pb, 12, s->frame_height);
-        }
-    }
-
-    /* no checksum or extra data (next 2 bits get 0) */
-    put_bits(&s->pb, 2, 0);
-}
-
-
-#define QUALITY_THRESHOLD 100
-#define THRESHOLD_MULTIPLIER 0.6
-
-#if HAVE_ALTIVEC
-#undef vector
-#endif
-
-static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){
-    int count, y, x, i, j, split, best_mean, best_score, best_count;
-    int best_vector[6];
-    int block_sum[7]= {0, 0, 0, 0, 0, 0};
-    int w= 2<<((level+2)>>1);
-    int h= 2<<((level+1)>>1);
-    int size=w*h;
-    int16_t block[7][256];
-    const int8_t *codebook_sum, *codebook;
-    const uint16_t (*mean_vlc)[2];
-    const uint8_t (*multistage_vlc)[2];
-
-    best_score=0;
-    //FIXME optimize, this doenst need to be done multiple times
-    if(intra){
-        codebook_sum= svq1_intra_codebook_sum[level];
-        codebook= ff_svq1_intra_codebooks[level];
-        mean_vlc= ff_svq1_intra_mean_vlc;
-        multistage_vlc= ff_svq1_intra_multistage_vlc[level];
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int v= src[x + y*stride];
-                block[0][x + w*y]= v;
-                best_score += v*v;
-                block_sum[0] += v;
-            }
-        }
-    }else{
-        codebook_sum= svq1_inter_codebook_sum[level];
-        codebook= ff_svq1_inter_codebooks[level];
-        mean_vlc= ff_svq1_inter_mean_vlc + 256;
-        multistage_vlc= ff_svq1_inter_multistage_vlc[level];
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int v= src[x + y*stride] - ref[x + y*stride];
-                block[0][x + w*y]= v;
-                best_score += v*v;
-                block_sum[0] += v;
-            }
-        }
-    }
-
-    best_count=0;
-    best_score -= ((block_sum[0]*block_sum[0])>>(level+3));
-    best_mean= (block_sum[0] + (size>>1)) >> (level+3);
-
-    if(level<4){
-        for(count=1; count<7; count++){
-            int best_vector_score= INT_MAX;
-            int best_vector_sum=-999, best_vector_mean=-999;
-            const int stage= count-1;
-            const int8_t *vector;
-
-            for(i=0; i<16; i++){
-                int sum= codebook_sum[stage*16 + i];
-                int sqr, diff, score;
-
-                vector = codebook + stage*size*16 + i*size;
-                sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size);
-                diff= block_sum[stage] - sum;
-                score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow
-                if(score < best_vector_score){
-                    int mean= (diff + (size>>1)) >> (level+3);
-                    assert(mean >-300 && mean<300);
-                    mean= av_clip(mean, intra?0:-256, 255);
-                    best_vector_score= score;
-                    best_vector[stage]= i;
-                    best_vector_sum= sum;
-                    best_vector_mean= mean;
-                }
-            }
-            assert(best_vector_mean != -999);
-            vector= codebook + stage*size*16 + best_vector[stage]*size;
-            for(j=0; j<size; j++){
-                block[stage+1][j] = block[stage][j] - vector[j];
-            }
-            block_sum[stage+1]= block_sum[stage] - best_vector_sum;
-            best_vector_score +=
-                lambda*(+ 1 + 4*count
-                        + multistage_vlc[1+count][1]
-                        + mean_vlc[best_vector_mean][1]);
-
-            if(best_vector_score < best_score){
-                best_score= best_vector_score;
-                best_count= count;
-                best_mean= best_vector_mean;
-            }
-        }
-    }
-
-    split=0;
-    if(best_score > threshold && level){
-        int score=0;
-        int offset= (level&1) ? stride*h/2 : w/2;
-        PutBitContext backup[6];
-
-        for(i=level-1; i>=0; i--){
-            backup[i]= s->reorder_pb[i];
-        }
-        score += encode_block(s, src         , ref         , decoded         , stride, level-1, threshold>>1, lambda, intra);
-        score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra);
-        score += lambda;
-
-        if(score < best_score){
-            best_score= score;
-            split=1;
-        }else{
-            for(i=level-1; i>=0; i--){
-                s->reorder_pb[i]= backup[i];
-            }
-        }
-    }
-    if (level > 0)
-        put_bits(&s->reorder_pb[level], 1, split);
-
-    if(!split){
-        assert((best_mean >= 0 && best_mean<256) || !intra);
-        assert(best_mean >= -256 && best_mean<256);
-        assert(best_count >=0 && best_count<7);
-        assert(level<4 || best_count==0);
-
-        /* output the encoding */
-        put_bits(&s->reorder_pb[level],
-            multistage_vlc[1 + best_count][1],
-            multistage_vlc[1 + best_count][0]);
-        put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1],
-            mean_vlc[best_mean][0]);
-
-        for (i = 0; i < best_count; i++){
-            assert(best_vector[i]>=0 && best_vector[i]<16);
-            put_bits(&s->reorder_pb[level], 4, best_vector[i]);
-        }
-
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean;
-            }
-        }
-    }
-
-    return best_score;
-}
-
-
-static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane, unsigned char *ref_plane, unsigned char *decoded_plane,
-    int width, int height, int src_stride, int stride)
-{
-    int x, y;
-    int i;
-    int block_width, block_height;
-    int level;
-    int threshold[6];
-    uint8_t *src = s->scratchbuf + stride * 16;
-    const int lambda= (s->picture.quality*s->picture.quality) >> (2*FF_LAMBDA_SHIFT);
-
-    /* figure out the acceptable level thresholds in advance */
-    threshold[5] = QUALITY_THRESHOLD;
-    for (level = 4; level >= 0; level--)
-        threshold[level] = threshold[level + 1] * THRESHOLD_MULTIPLIER;
-
-    block_width = (width + 15) / 16;
-    block_height = (height + 15) / 16;
-
-    if(s->picture.pict_type == FF_P_TYPE){
-        s->m.avctx= s->avctx;
-        s->m.current_picture_ptr= &s->m.current_picture;
-        s->m.last_picture_ptr   = &s->m.last_picture;
-        s->m.last_picture.data[0]= ref_plane;
-        s->m.linesize=
-        s->m.last_picture.linesize[0]=
-        s->m.new_picture.linesize[0]=
-        s->m.current_picture.linesize[0]= stride;
-        s->m.width= width;
-        s->m.height= height;
-        s->m.mb_width= block_width;
-        s->m.mb_height= block_height;
-        s->m.mb_stride= s->m.mb_width+1;
-        s->m.b8_stride= 2*s->m.mb_width+1;
-        s->m.f_code=1;
-        s->m.pict_type= s->picture.pict_type;
-        s->m.me_method= s->avctx->me_method;
-        s->m.me.scene_change_score=0;
-        s->m.flags= s->avctx->flags;
-//        s->m.out_format = FMT_H263;
-//        s->m.unrestricted_mv= 1;
-
-        s->m.lambda= s->picture.quality;
-        s->m.qscale= (s->m.lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
-        s->m.lambda2= (s->m.lambda*s->m.lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
-
-        if(!s->motion_val8[plane]){
-            s->motion_val8 [plane]= av_mallocz((s->m.b8_stride*block_height*2 + 2)*2*sizeof(int16_t));
-            s->motion_val16[plane]= av_mallocz((s->m.mb_stride*(block_height + 2) + 1)*2*sizeof(int16_t));
-        }
-
-        s->m.mb_type= s->mb_type;
-
-        //dummies, to avoid segfaults
-        s->m.current_picture.mb_mean=   (uint8_t *)s->dummy;
-        s->m.current_picture.mb_var=    (uint16_t*)s->dummy;
-        s->m.current_picture.mc_mb_var= (uint16_t*)s->dummy;
-        s->m.current_picture.mb_type= s->dummy;
-
-        s->m.current_picture.motion_val[0]= s->motion_val8[plane] + 2;
-        s->m.p_mv_table= s->motion_val16[plane] + s->m.mb_stride + 1;
-        s->m.dsp= s->dsp; //move
-        ff_init_me(&s->m);
-
-        s->m.me.dia_size= s->avctx->dia_size;
-        s->m.first_slice_line=1;
-        for (y = 0; y < block_height; y++) {
-            s->m.new_picture.data[0]= src - y*16*stride; //ugly
-            s->m.mb_y= y;
-
-            for(i=0; i<16 && i + 16*y<height; i++){
-                memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width);
-                for(x=width; x<16*block_width; x++)
-                    src[i*stride+x]= src[i*stride+x-1];
-            }
-            for(; i<16 && i + 16*y<16*block_height; i++)
-                memcpy(&src[i*stride], &src[(i-1)*stride], 16*block_width);
-
-            for (x = 0; x < block_width; x++) {
-                s->m.mb_x= x;
-                ff_init_block_index(&s->m);
-                ff_update_block_index(&s->m);
-
-                ff_estimate_p_frame_motion(&s->m, x, y);
-            }
-            s->m.first_slice_line=0;
-        }
-
-        ff_fix_long_p_mvs(&s->m);
-        ff_fix_long_mvs(&s->m, NULL, 0, s->m.p_mv_table, s->m.f_code, CANDIDATE_MB_TYPE_INTER, 0);
-    }
-
-    s->m.first_slice_line=1;
-    for (y = 0; y < block_height; y++) {
-        for(i=0; i<16 && i + 16*y<height; i++){
-            memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width);
-            for(x=width; x<16*block_width; x++)
-                src[i*stride+x]= src[i*stride+x-1];
-        }
-        for(; i<16 && i + 16*y<16*block_height; i++)
-            memcpy(&src[i*stride], &src[(i-1)*stride], 16*block_width);
-
-        s->m.mb_y= y;
-        for (x = 0; x < block_width; x++) {
-            uint8_t reorder_buffer[3][6][7*32];
-            int count[3][6];
-            int offset = y * 16 * stride + x * 16;
-            uint8_t *decoded= decoded_plane + offset;
-            uint8_t *ref= ref_plane + offset;
-            int score[4]={0,0,0,0}, best;
-            uint8_t *temp = s->scratchbuf;
-
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 3000){ //FIXME check size
-                av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                return -1;
-            }
-
-            s->m.mb_x= x;
-            ff_init_block_index(&s->m);
-            ff_update_block_index(&s->m);
-
-            if(s->picture.pict_type == FF_I_TYPE || (s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTRA)){
-                for(i=0; i<6; i++){
-                    init_put_bits(&s->reorder_pb[i], reorder_buffer[0][i], 7*32);
-                }
-                if(s->picture.pict_type == FF_P_TYPE){
-                    const uint8_t *vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_INTRA];
-                    put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
-                    score[0]= vlc[1]*lambda;
-                }
-                score[0]+= encode_block(s, src+16*x, NULL, temp, stride, 5, 64, lambda, 1);
-                for(i=0; i<6; i++){
-                    count[0][i]= put_bits_count(&s->reorder_pb[i]);
-                    flush_put_bits(&s->reorder_pb[i]);
-                }
-            }else
-                score[0]= INT_MAX;
-
-            best=0;
-
-            if(s->picture.pict_type == FF_P_TYPE){
-                const uint8_t *vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_INTER];
-                int mx, my, pred_x, pred_y, dxy;
-                int16_t *motion_ptr;
-
-                motion_ptr= h263_pred_motion(&s->m, 0, 0, &pred_x, &pred_y);
-                if(s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTER){
-                    for(i=0; i<6; i++)
-                        init_put_bits(&s->reorder_pb[i], reorder_buffer[1][i], 7*32);
-
-                    put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
-
-                    s->m.pb= s->reorder_pb[5];
-                    mx= motion_ptr[0];
-                    my= motion_ptr[1];
-                    assert(mx>=-32 && mx<=31);
-                    assert(my>=-32 && my<=31);
-                    assert(pred_x>=-32 && pred_x<=31);
-                    assert(pred_y>=-32 && pred_y<=31);
-                    ff_h263_encode_motion(&s->m, mx - pred_x, 1);
-                    ff_h263_encode_motion(&s->m, my - pred_y, 1);
-                    s->reorder_pb[5]= s->m.pb;
-                    score[1] += lambda*put_bits_count(&s->reorder_pb[5]);
-
-                    dxy= (mx&1) + 2*(my&1);
-
-                    s->dsp.put_pixels_tab[0][dxy](temp+16, ref + (mx>>1) + stride*(my>>1), stride, 16);
-
-                    score[1]+= encode_block(s, src+16*x, temp+16, decoded, stride, 5, 64, lambda, 0);
-                    best= score[1] <= score[0];
-
-                    vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_SKIP];
-                    score[2]= s->dsp.sse[0](NULL, src+16*x, ref, stride, 16);
-                    score[2]+= vlc[1]*lambda;
-                    if(score[2] < score[best] && mx==0 && my==0){
-                        best=2;
-                        s->dsp.put_pixels_tab[0][0](decoded, ref, stride, 16);
-                        for(i=0; i<6; i++){
-                            count[2][i]=0;
-                        }
-                        put_bits(&s->pb, vlc[1], vlc[0]);
-                    }
-                }
-
-                if(best==1){
-                    for(i=0; i<6; i++){
-                        count[1][i]= put_bits_count(&s->reorder_pb[i]);
-                        flush_put_bits(&s->reorder_pb[i]);
-                    }
-                }else{
-                    motion_ptr[0                 ] = motion_ptr[1                 ]=
-                    motion_ptr[2                 ] = motion_ptr[3                 ]=
-                    motion_ptr[0+2*s->m.b8_stride] = motion_ptr[1+2*s->m.b8_stride]=
-                    motion_ptr[2+2*s->m.b8_stride] = motion_ptr[3+2*s->m.b8_stride]=0;
-                }
-            }
-
-            s->rd_total += score[best];
-
-            for(i=5; i>=0; i--){
-                ff_copy_bits(&s->pb, reorder_buffer[best][i], count[best][i]);
-            }
-            if(best==0){
-                s->dsp.put_pixels_tab[0][0](decoded, temp, stride, 16);
-            }
-        }
-        s->m.first_slice_line=0;
-    }
-    return 0;
-}
-
-static av_cold int svq1_encode_init(AVCodecContext *avctx)
-{
-    SVQ1Context * const s = avctx->priv_data;
-
-    dsputil_init(&s->dsp, avctx);
-    avctx->coded_frame= (AVFrame*)&s->picture;
-
-    s->frame_width = avctx->width;
-    s->frame_height = avctx->height;
-
-    s->y_block_width = (s->frame_width + 15) / 16;
-    s->y_block_height = (s->frame_height + 15) / 16;
-
-    s->c_block_width = (s->frame_width / 4 + 15) / 16;
-    s->c_block_height = (s->frame_height / 4 + 15) / 16;
-
-    s->avctx= avctx;
-    s->m.avctx= avctx;
-    s->m.me.temp      =
-    s->m.me.scratchpad= av_mallocz((avctx->width+64)*2*16*2*sizeof(uint8_t));
-    s->m.me.map       = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
-    s->m.me.score_map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
-    s->mb_type        = av_mallocz((s->y_block_width+1)*s->y_block_height*sizeof(int16_t));
-    s->dummy          = av_mallocz((s->y_block_width+1)*s->y_block_height*sizeof(int32_t));
-    h263_encode_init(&s->m); //mv_penalty
-
-    return 0;
-}
-
-static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf,
-    int buf_size, void *data)
-{
-    SVQ1Context * const s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= (AVFrame*)&s->picture;
-    AVFrame temp;
-    int i;
-
-    if(avctx->pix_fmt != PIX_FMT_YUV410P){
-        av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");
-        return -1;
-    }
-
-    if(!s->current_picture.data[0]){
-        avctx->get_buffer(avctx, &s->current_picture);
-        avctx->get_buffer(avctx, &s->last_picture);
-        s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16 * 2);
-    }
-
-    temp= s->current_picture;
-    s->current_picture= s->last_picture;
-    s->last_picture= temp;
-
-    init_put_bits(&s->pb, buf, buf_size);
-
-    *p = *pict;
-    p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? FF_P_TYPE : FF_I_TYPE;
-    p->key_frame = p->pict_type == FF_I_TYPE;
-
-    svq1_write_header(s, p->pict_type);
-    for(i=0; i<3; i++){
-        if(svq1_encode_plane(s, i,
-            s->picture.data[i], s->last_picture.data[i], s->current_picture.data[i],
-            s->frame_width / (i?4:1), s->frame_height / (i?4:1),
-            s->picture.linesize[i], s->current_picture.linesize[i]) < 0)
-                return -1;
-    }
-
-//    align_put_bits(&s->pb);
-    while(put_bits_count(&s->pb) & 31)
-        put_bits(&s->pb, 1, 0);
-
-    flush_put_bits(&s->pb);
-
-    return put_bits_count(&s->pb) / 8;
-}
-
-static av_cold int svq1_encode_end(AVCodecContext *avctx)
-{
-    SVQ1Context * const s = avctx->priv_data;
-    int i;
-
-    av_log(avctx, AV_LOG_DEBUG, "RD: %f\n", s->rd_total/(double)(avctx->width*avctx->height*avctx->frame_number));
-
-    av_freep(&s->m.me.scratchpad);
-    av_freep(&s->m.me.map);
-    av_freep(&s->m.me.score_map);
-    av_freep(&s->mb_type);
-    av_freep(&s->dummy);
-    av_freep(&s->scratchbuf);
-
-    for(i=0; i<3; i++){
-        av_freep(&s->motion_val8[i]);
-        av_freep(&s->motion_val16[i]);
-    }
-
-    return 0;
-}
-
-
-AVCodec svq1_encoder = {
-    "svq1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SVQ1,
-    sizeof(SVQ1Context),
-    svq1_encode_init,
-    svq1_encode_frame,
-    svq1_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
-};
diff --git a/libavcodec/svq1enc_cb.h b/libavcodec/svq1enc_cb.h
deleted file mode 100644
index 7eff82e..0000000
--- a/libavcodec/svq1enc_cb.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * SVQ1 Encoder
- * Copyright (C) 2004 Mike Melanson <melanson at pcisys.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * svq1 code books.
- */
-
-#ifndef AVCODEC_SVQ1ENC_CB_H
-#define AVCODEC_SVQ1ENC_CB_H
-
-#include <stdint.h>
-
-static const int8_t svq1_inter_codebook_sum[4][16*6] = {
- {
- -1,  1, -2,  0,  1, -1, -1, -1, -2, -1,  1, -1, -1,  0, -1, -1,
-  0, -1, -1, -1, -1,  0, -1,  0,  0,  0, -3,  1, -1,  0,  1, -1,
-  1, -1,  2,  2,  1,  1,  2,  0,  0,  0, -1,  1,  1,  0,  0,  0,
-  1, -1,  0,  1, -1,  1,  1,  0,  1,  0, -1,  1,  1,  0,  0,  0,
- -2,  0,  0, -2,  0,  0, -2,  0, -2, -1, -2, -1,  0,  0, -1,  0,
-  1,  0,  1, -1,  2,  2,  1,  2,  2,  1,  0,  1,  1,  0,  1,  1,
- },{
- -2,  1, -1, -1,  1,  0,  1, -1, -1, -1,  1, -1,  0, -1,  0, -1,
-  0,  0,  0, -2,  0,  1,  0, -1, -1,  0,  2, -3,  1, -2,  3, -1,
-  2,  0,  2,  1,  1, -1,  1,  1,  0,  0,  1,  1,  2, -2,  1,  0,
- -2, -1,  2, -2, -2,  0, -3,  0, -1,  0, -1,  0, -1,  0, -2, -3,
-  1, -2, -2, -1,  1, -1, -1,  1, -1,  1,  1,  0, -2,  0,  1,  1,
-  1,  1,  2,  1,  0,  0, -1,  0,  0,  1,  0,  1, -1,  1,  0,  2,
- },{
-  0,  0,  0, -3,  1,  1,  1, -3,  0, -1,  0, -3,  1, -3,  0, -2,
-  1,  2, -1, -3,  0, -3,  1, -1,  0, -1,  0,  0,  1,  2,  1,  1,
- -1,  2, -3,  3,  1,  0, -5,  1,  0, -1, -3,  1,  0,  2,  0, -3,
-  4,  2,  0, -2,  1, -2,  3, -2,  1,  1,  0, -1,  2,  5,  3,  1,
- -1,  0,  2, -3, -2,  0,  0, -2,  2, -3, -1, -1,  2,  1,  0, -2,
-  3, -1,  1, -1,  2,  4,  0,  1,  0,  1,  0, -1, -3, -2, -1,  0,
- },{
-  0,  2, -1, -1,  2, -4, -2,  3,  0, -1, -5,  1,  0,  1,  0,  6,
- -2,  2,  0,  1,  1, -1, -1, -2,  1, -2, -1,  0,  2, -2, -2, -1,
- -4,  2, -1, -3, -1, -2,  2, -1,  2, -1,  2,  0,  3, -3, -3,  0,
- -3,  0,  0, -2,  4, -4,  0, -1,  4,  0, -2, -2,  3, -2,  0,  4,
-  5,  0,  1,  0, -3,  3,  3,  2,  0,  0,  1,  2, -5, -2, -3,  0,
- -3,  2, -2,  2, -2,  4,  7, -3,  4,  2,  3,  2, -1,  0, -3,  1,
- }
-};
-
-static const int8_t svq1_intra_codebook_sum[4][16*6] = {
- {
-  0,  0,  0, -1, -1, -1, -1, -2,  0, -1, -1,  0, -1,  0,  1,  0,
-  1,  0, -1,  1,  0,  0, -1,  1, -1,  0,  0,  0, -1,  1,  0,  0,
- -1,  0,  0,  1, -1,  1,  0, -1, -1,  0,  1,  1,  0,  0, -1,  1,
-  0,  1,  0,  0,  1, -1,  0,  0,  0, -1,  1,  0,  1,  0, -2,  1,
-  0, -1,  1,  0,  0,  0,  1,  0, -1,  0,  0,  0, -1,  0,  0,  0,
-  0,  1,  1,  0,  0, -1,  0,  1,  0,  0,  0,  0, -1,  1,  1, -1,
- },{
- -1, -2,  0, -1,  1,  0, -1,  0, -1, -4, -1, -2, -1, -2,  1, -2,
-  0,  0,  4, -2, -1,  1,  1,  0,  2,  1,  1,  0,  2,  0,  0,  0,
-  1,  1,  0, -1, -1, -1,  1,  0, -1, -3, -3,  1, -1,  1, -2, -1,
-  1, -1,  0,  1,  2,  1, -1, -1,  1,  1,  1,  2,  1,  0,  1, -2,
- -2,  0, -1, -2, -2,  0, -1, -1, -1,  0,  1,  0, -1, -1,  0, -1,
-  0,  2,  1,  2,  2,  1, -1,  1,  0,  2,  0, -1,  1,  0,  0,  0,
- },{
- -2,  0, -1, -1,  1,  1, -2,  0, -2,  0,  1, -2, -2,  1, -1, -1,
-  3, -2,  0, -3, -4, -3,  2,  1,  0,  3, -2,  2,  3,  2,  2, -1,
- -3,  1,  0,  1,  0,  0,  0,  1, -2,  1, -2, -2, -1, -2, -2,  2,
-  0, -4,  0,  2, -1,  0,  2,  2,  2,  1,  0, -1, -1,  1, -3,  2,
-  2,  1,  0,  3,  1, -1,  1,  3,  1,  0,  1,  1,  2, -1,  1, -1,
- -2, -1,  0, -1,  1, -1,  1, -2, -2, -1, -1, -3,  1, -4, -3,  1,
- },{
- -2,  0, -2,  3, -1, -1,  0,  2,  2, -1, -3,  2,  1,  0, -2, -1,
- -3, -2, -2,  1,  2, -3,  0,  1, -5, -2, -3,  0, -2, -1,  2,  0,
- -1, -1,  0, -2,  1,  3, -7, -2, -2, -1,  2, -1,  0,  3,  1,  3,
-  1,  0,  0,  1,  2,  3,  1,  2,  0, -2, -2,  1,  1,  2,  2,  3,
-  4,  1, -1,  2, -2,  4,  0,  0,  0,  4,  2,  0, -2, -2,  2, -4,
- -1,  5, -2, -2, -3,  2, -3, -1,  3, -3,  0,  4,  3,  0,  1, -2,
- }
-};
-
-#endif /* AVCODEC_SVQ1ENC_CB_H */
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
deleted file mode 100644
index bf7659a..0000000
--- a/libavcodec/svq3.c
+++ /dev/null
@@ -1,1084 +0,0 @@
-/*
- * Copyright (c) 2003 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * How to use this decoder:
- * SVQ3 data is transported within Apple Quicktime files. Quicktime files
- * have stsd atoms to describe media trak properties. A stsd atom for a
- * video trak contains 1 or more ImageDescription atoms. These atoms begin
- * with the 4-byte length of the atom followed by the codec fourcc. Some
- * decoders need information in this atom to operate correctly. Such
- * is the case with SVQ3. In order to get the best use out of this decoder,
- * the calling app must make the SVQ3 ImageDescription atom available
- * via the AVCodecContext's extradata[_size] field:
- *
- * AVCodecContext.extradata = pointer to ImageDescription, first characters
- * are expected to be 'S', 'V', 'Q', and '3', NOT the 4-byte atom length
- * AVCodecContext.extradata_size = size of ImageDescription atom memory
- * buffer (which will be the same as the ImageDescription atom size field
- * from the QT file, minus 4 bytes since the length is missing)
- *
- * You will know you have these parameters passed correctly when the decoder
- * correctly decodes this file:
- *  http://samples.mplayerhq.hu/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov
- */
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h264.h"
-
-#include "h264data.h" //FIXME FIXME FIXME
-
-#include "h264_mvpred.h"
-#include "golomb.h"
-#include "rectangle.h"
-#include "vdpau_internal.h"
-
-#if CONFIG_ZLIB
-#include <zlib.h>
-#endif
-
-#include "svq1.h"
-
-/**
- * @file
- * svq3 decoder.
- */
-
-#define FULLPEL_MODE  1
-#define HALFPEL_MODE  2
-#define THIRDPEL_MODE 3
-#define PREDICT_MODE  4
-
-/* dual scan (from some older h264 draft)
- o-->o-->o   o
-         |  /|
- o   o   o / o
- | / |   |/  |
- o   o   o   o
-   /
- o-->o-->o-->o
-*/
-static const uint8_t svq3_scan[16] = {
-    0+0*4, 1+0*4, 2+0*4, 2+1*4,
-    2+2*4, 3+0*4, 3+1*4, 3+2*4,
-    0+1*4, 0+2*4, 1+1*4, 1+2*4,
-    0+3*4, 1+3*4, 2+3*4, 3+3*4,
-};
-
-static const uint8_t svq3_pred_0[25][2] = {
-    { 0, 0 },
-    { 1, 0 }, { 0, 1 },
-    { 0, 2 }, { 1, 1 }, { 2, 0 },
-    { 3, 0 }, { 2, 1 }, { 1, 2 }, { 0, 3 },
-    { 0, 4 }, { 1, 3 }, { 2, 2 }, { 3, 1 }, { 4, 0 },
-    { 4, 1 }, { 3, 2 }, { 2, 3 }, { 1, 4 },
-    { 2, 4 }, { 3, 3 }, { 4, 2 },
-    { 4, 3 }, { 3, 4 },
-    { 4, 4 }
-};
-
-static const int8_t svq3_pred_1[6][6][5] = {
-    { { 2,-1,-1,-1,-1 }, { 2, 1,-1,-1,-1 }, { 1, 2,-1,-1,-1 },
-      { 2, 1,-1,-1,-1 }, { 1, 2,-1,-1,-1 }, { 1, 2,-1,-1,-1 } },
-    { { 0, 2,-1,-1,-1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
-      { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
-    { { 2, 0,-1,-1,-1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
-      { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
-    { { 2, 0,-1,-1,-1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
-      { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
-    { { 0, 2,-1,-1,-1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
-      { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
-    { { 0, 2,-1,-1,-1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
-      { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
-};
-
-static const struct { uint8_t run; uint8_t level; } svq3_dct_tables[2][16] = {
-    { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 2, 1 }, { 0, 2 }, { 3, 1 }, { 4, 1 }, { 5, 1 },
-      { 0, 3 }, { 1, 2 }, { 2, 2 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 9, 1 }, { 0, 4 } },
-    { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, 2 }, { 2, 1 }, { 0, 3 }, { 0, 4 }, { 0, 5 },
-      { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 } }
-};
-
-static const uint32_t svq3_dequant_coeff[32] = {
-     3881,  4351,  4890,  5481,  6154,  6914,  7761,  8718,
-     9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
-    24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
-    61694, 68745, 77615, 89113,100253,109366,126635,141533
-};
-
-
-void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp)
-{
-    const int qmul = svq3_dequant_coeff[qp];
-#define stride 16
-    int i;
-    int temp[16];
-    static const int x_offset[4] = {0, 1*stride, 4* stride,  5*stride};
-    static const int y_offset[4] = {0, 2*stride, 8* stride, 10*stride};
-
-    for (i = 0; i < 4; i++){
-        const int offset = y_offset[i];
-        const int z0 = 13*(block[offset+stride*0] +    block[offset+stride*4]);
-        const int z1 = 13*(block[offset+stride*0] -    block[offset+stride*4]);
-        const int z2 =  7* block[offset+stride*1] - 17*block[offset+stride*5];
-        const int z3 = 17* block[offset+stride*1] +  7*block[offset+stride*5];
-
-        temp[4*i+0] = z0+z3;
-        temp[4*i+1] = z1+z2;
-        temp[4*i+2] = z1-z2;
-        temp[4*i+3] = z0-z3;
-    }
-
-    for (i = 0; i < 4; i++){
-        const int offset = x_offset[i];
-        const int z0 = 13*(temp[4*0+i] +    temp[4*2+i]);
-        const int z1 = 13*(temp[4*0+i] -    temp[4*2+i]);
-        const int z2 =  7* temp[4*1+i] - 17*temp[4*3+i];
-        const int z3 = 17* temp[4*1+i] +  7*temp[4*3+i];
-
-        block[stride*0 +offset] = ((z0 + z3)*qmul + 0x80000) >> 20;
-        block[stride*2 +offset] = ((z1 + z2)*qmul + 0x80000) >> 20;
-        block[stride*8 +offset] = ((z1 - z2)*qmul + 0x80000) >> 20;
-        block[stride*10+offset] = ((z0 - z3)*qmul + 0x80000) >> 20;
-    }
-}
-#undef stride
-
-void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp,
-                            int dc)
-{
-    const int qmul = svq3_dequant_coeff[qp];
-    int i;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    if (dc) {
-        dc = 13*13*((dc == 1) ? 1538*block[0] : ((qmul*(block[0] >> 3)) / 2));
-        block[0] = 0;
-    }
-
-    for (i = 0; i < 4; i++) {
-        const int z0 = 13*(block[0 + 4*i] +    block[2 + 4*i]);
-        const int z1 = 13*(block[0 + 4*i] -    block[2 + 4*i]);
-        const int z2 =  7* block[1 + 4*i] - 17*block[3 + 4*i];
-        const int z3 = 17* block[1 + 4*i] +  7*block[3 + 4*i];
-
-        block[0 + 4*i] = z0 + z3;
-        block[1 + 4*i] = z1 + z2;
-        block[2 + 4*i] = z1 - z2;
-        block[3 + 4*i] = z0 - z3;
-    }
-
-    for (i = 0; i < 4; i++) {
-        const int z0 = 13*(block[i + 4*0] +    block[i + 4*2]);
-        const int z1 = 13*(block[i + 4*0] -    block[i + 4*2]);
-        const int z2 =  7* block[i + 4*1] - 17*block[i + 4*3];
-        const int z3 = 17* block[i + 4*1] +  7*block[i + 4*3];
-        const int rr = (dc + 0x80000);
-
-        dst[i + stride*0] = cm[ dst[i + stride*0] + (((z0 + z3)*qmul + rr) >> 20) ];
-        dst[i + stride*1] = cm[ dst[i + stride*1] + (((z1 + z2)*qmul + rr) >> 20) ];
-        dst[i + stride*2] = cm[ dst[i + stride*2] + (((z1 - z2)*qmul + rr) >> 20) ];
-        dst[i + stride*3] = cm[ dst[i + stride*3] + (((z0 - z3)*qmul + rr) >> 20) ];
-    }
-}
-
-static inline int svq3_decode_block(GetBitContext *gb, DCTELEM *block,
-                                    int index, const int type)
-{
-    static const uint8_t *const scan_patterns[4] =
-    { luma_dc_zigzag_scan, zigzag_scan, svq3_scan, chroma_dc_scan };
-
-    int run, level, sign, vlc, limit;
-    const int intra = (3 * type) >> 2;
-    const uint8_t *const scan = scan_patterns[type];
-
-    for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
-        for (; (vlc = svq3_get_ue_golomb(gb)) != 0; index++) {
-
-          if (vlc == INVALID_VLC)
-              return -1;
-
-          sign = (vlc & 0x1) - 1;
-          vlc  = (vlc + 1) >> 1;
-
-          if (type == 3) {
-              if (vlc < 3) {
-                  run   = 0;
-                  level = vlc;
-              } else if (vlc < 4) {
-                  run   = 1;
-                  level = 1;
-              } else {
-                  run   = (vlc & 0x3);
-                  level = ((vlc + 9) >> 2) - run;
-              }
-          } else {
-              if (vlc < 16) {
-                  run   = svq3_dct_tables[intra][vlc].run;
-                  level = svq3_dct_tables[intra][vlc].level;
-              } else if (intra) {
-                  run   = (vlc & 0x7);
-                  level = (vlc >> 3) + ((run == 0) ? 8 : ((run < 2) ? 2 : ((run < 5) ? 0 : -1)));
-              } else {
-                  run   = (vlc & 0xF);
-                  level = (vlc >> 4) + ((run == 0) ? 4 : ((run < 3) ? 2 : ((run < 10) ? 1 : 0)));
-              }
-          }
-
-          if ((index += run) >= limit)
-              return -1;
-
-          block[scan[index]] = (level ^ sign) - sign;
-        }
-
-        if (type != 2) {
-            break;
-        }
-    }
-
-    return 0;
-}
-
-static inline void svq3_mc_dir_part(MpegEncContext *s,
-                                    int x, int y, int width, int height,
-                                    int mx, int my, int dxy,
-                                    int thirdpel, int dir, int avg)
-{
-    const Picture *pic = (dir == 0) ? &s->last_picture : &s->next_picture;
-    uint8_t *src, *dest;
-    int i, emu = 0;
-    int blocksize = 2 - (width>>3); //16->0, 8->1, 4->2
-
-    mx += x;
-    my += y;
-
-    if (mx < 0 || mx >= (s->h_edge_pos - width  - 1) ||
-        my < 0 || my >= (s->v_edge_pos - height - 1)) {
-
-        if ((s->flags & CODEC_FLAG_EMU_EDGE)) {
-            emu = 1;
-        }
-
-        mx = av_clip (mx, -16, (s->h_edge_pos - width  + 15));
-        my = av_clip (my, -16, (s->v_edge_pos - height + 15));
-    }
-
-    /* form component predictions */
-    dest = s->current_picture.data[0] + x + y*s->linesize;
-    src  = pic->data[0] + mx + my*s->linesize;
-
-    if (emu) {
-        ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
-                            mx, my, s->h_edge_pos, s->v_edge_pos);
-        src = s->edge_emu_buffer;
-    }
-    if (thirdpel)
-        (avg ? s->dsp.avg_tpel_pixels_tab : s->dsp.put_tpel_pixels_tab)[dxy](dest, src, s->linesize, width, height);
-    else
-        (avg ? s->dsp.avg_pixels_tab : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src, s->linesize, height);
-
-    if (!(s->flags & CODEC_FLAG_GRAY)) {
-        mx     = (mx + (mx < (int) x)) >> 1;
-        my     = (my + (my < (int) y)) >> 1;
-        width  = (width  >> 1);
-        height = (height >> 1);
-        blocksize++;
-
-        for (i = 1; i < 3; i++) {
-            dest = s->current_picture.data[i] + (x >> 1) + (y >> 1)*s->uvlinesize;
-            src  = pic->data[i] + mx + my*s->uvlinesize;
-
-            if (emu) {
-                ff_emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1),
-                                    mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1));
-                src = s->edge_emu_buffer;
-            }
-            if (thirdpel)
-                (avg ? s->dsp.avg_tpel_pixels_tab : s->dsp.put_tpel_pixels_tab)[dxy](dest, src, s->uvlinesize, width, height);
-            else
-                (avg ? s->dsp.avg_pixels_tab : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src, s->uvlinesize, height);
-        }
-    }
-}
-
-static inline int svq3_mc_dir(H264Context *h, int size, int mode, int dir,
-                              int avg)
-{
-    int i, j, k, mx, my, dx, dy, x, y;
-    MpegEncContext *const s = (MpegEncContext *) h;
-    const int part_width  = ((size & 5) == 4) ? 4 : 16 >> (size & 1);
-    const int part_height = 16 >> ((unsigned) (size + 1) / 3);
-    const int extra_width = (mode == PREDICT_MODE) ? -16*6 : 0;
-    const int h_edge_pos  = 6*(s->h_edge_pos - part_width ) - extra_width;
-    const int v_edge_pos  = 6*(s->v_edge_pos - part_height) - extra_width;
-
-    for (i = 0; i < 16; i += part_height) {
-        for (j = 0; j < 16; j += part_width) {
-            const int b_xy = (4*s->mb_x + (j >> 2)) + (4*s->mb_y + (i >> 2))*h->b_stride;
-            int dxy;
-            x = 16*s->mb_x + j;
-            y = 16*s->mb_y + i;
-            k = ((j >> 2) & 1) + ((i >> 1) & 2) + ((j >> 1) & 4) + (i & 8);
-
-            if (mode != PREDICT_MODE) {
-                pred_motion(h, k, (part_width >> 2), dir, 1, &mx, &my);
-            } else {
-                mx = s->next_picture.motion_val[0][b_xy][0]<<1;
-                my = s->next_picture.motion_val[0][b_xy][1]<<1;
-
-                if (dir == 0) {
-                    mx = ((mx * h->frame_num_offset) / h->prev_frame_num_offset + 1) >> 1;
-                    my = ((my * h->frame_num_offset) / h->prev_frame_num_offset + 1) >> 1;
-                } else {
-                    mx = ((mx * (h->frame_num_offset - h->prev_frame_num_offset)) / h->prev_frame_num_offset + 1) >> 1;
-                    my = ((my * (h->frame_num_offset - h->prev_frame_num_offset)) / h->prev_frame_num_offset + 1) >> 1;
-                }
-            }
-
-            /* clip motion vector prediction to frame border */
-            mx = av_clip(mx, extra_width - 6*x, h_edge_pos - 6*x);
-            my = av_clip(my, extra_width - 6*y, v_edge_pos - 6*y);
-
-            /* get (optional) motion vector differential */
-            if (mode == PREDICT_MODE) {
-                dx = dy = 0;
-            } else {
-                dy = svq3_get_se_golomb(&s->gb);
-                dx = svq3_get_se_golomb(&s->gb);
-
-                if (dx == INVALID_VLC || dy == INVALID_VLC) {
-                    av_log(h->s.avctx, AV_LOG_ERROR, "invalid MV vlc\n");
-                    return -1;
-                }
-            }
-
-            /* compute motion vector */
-            if (mode == THIRDPEL_MODE) {
-                int fx, fy;
-                mx  = ((mx + 1)>>1) + dx;
-                my  = ((my + 1)>>1) + dy;
-                fx  = ((unsigned)(mx + 0x3000))/3 - 0x1000;
-                fy  = ((unsigned)(my + 0x3000))/3 - 0x1000;
-                dxy = (mx - 3*fx) + 4*(my - 3*fy);
-
-                svq3_mc_dir_part(s, x, y, part_width, part_height, fx, fy, dxy, 1, dir, avg);
-                mx += mx;
-                my += my;
-            } else if (mode == HALFPEL_MODE || mode == PREDICT_MODE) {
-                mx  = ((unsigned)(mx + 1 + 0x3000))/3 + dx - 0x1000;
-                my  = ((unsigned)(my + 1 + 0x3000))/3 + dy - 0x1000;
-                dxy = (mx&1) + 2*(my&1);
-
-                svq3_mc_dir_part(s, x, y, part_width, part_height, mx>>1, my>>1, dxy, 0, dir, avg);
-                mx *= 3;
-                my *= 3;
-            } else {
-                mx = ((unsigned)(mx + 3 + 0x6000))/6 + dx - 0x1000;
-                my = ((unsigned)(my + 3 + 0x6000))/6 + dy - 0x1000;
-
-                svq3_mc_dir_part(s, x, y, part_width, part_height, mx, my, 0, 0, dir, avg);
-                mx *= 6;
-                my *= 6;
-            }
-
-            /* update mv_cache */
-            if (mode != PREDICT_MODE) {
-                int32_t mv = pack16to32(mx,my);
-
-                if (part_height == 8 && i < 8) {
-                    *(int32_t *) h->mv_cache[dir][scan8[k] + 1*8] = mv;
-
-                    if (part_width == 8 && j < 8) {
-                        *(int32_t *) h->mv_cache[dir][scan8[k] + 1 + 1*8] = mv;
-                    }
-                }
-                if (part_width == 8 && j < 8) {
-                    *(int32_t *) h->mv_cache[dir][scan8[k] + 1] = mv;
-                }
-                if (part_width == 4 || part_height == 4) {
-                    *(int32_t *) h->mv_cache[dir][scan8[k]] = mv;
-                }
-            }
-
-            /* write back motion vectors */
-            fill_rectangle(s->current_picture.motion_val[dir][b_xy], part_width>>2, part_height>>2, h->b_stride, pack16to32(mx,my), 4);
-        }
-    }
-
-    return 0;
-}
-
-static int svq3_decode_mb(H264Context *h, unsigned int mb_type)
-{
-    int i, j, k, m, dir, mode;
-    int cbp = 0;
-    uint32_t vlc;
-    int8_t *top, *left;
-    MpegEncContext *const s = (MpegEncContext *) h;
-    const int mb_xy = h->mb_xy;
-    const int b_xy  = 4*s->mb_x + 4*s->mb_y*h->b_stride;
-
-    h->top_samples_available      = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
-    h->left_samples_available     = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
-    h->topright_samples_available = 0xFFFF;
-
-    if (mb_type == 0) {           /* SKIP */
-        if (s->pict_type == FF_P_TYPE || s->next_picture.mb_type[mb_xy] == -1) {
-            svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0);
-
-            if (s->pict_type == FF_B_TYPE) {
-                svq3_mc_dir_part(s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1);
-            }
-
-            mb_type = MB_TYPE_SKIP;
-        } else {
-            mb_type = FFMIN(s->next_picture.mb_type[mb_xy], 6);
-            if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 0, 0) < 0)
-                return -1;
-            if (svq3_mc_dir(h, mb_type, PREDICT_MODE, 1, 1) < 0)
-                return -1;
-
-            mb_type = MB_TYPE_16x16;
-        }
-    } else if (mb_type < 8) {     /* INTER */
-        if (h->thirdpel_flag && h->halfpel_flag == !get_bits1 (&s->gb)) {
-            mode = THIRDPEL_MODE;
-        } else if (h->halfpel_flag && h->thirdpel_flag == !get_bits1 (&s->gb)) {
-            mode = HALFPEL_MODE;
-        } else {
-            mode = FULLPEL_MODE;
-        }
-
-        /* fill caches */
-        /* note ref_cache should contain here:
-            ????????
-            ???11111
-            N??11111
-            N??11111
-            N??11111
-        */
-
-        for (m = 0; m < 2; m++) {
-            if (s->mb_x > 0 && h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6] != -1) {
-                for (i = 0; i < 4; i++) {
-                    *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - 1 + i*h->b_stride];
-                }
-            } else {
-                for (i = 0; i < 4; i++) {
-                    *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0;
-                }
-            }
-            if (s->mb_y > 0) {
-                memcpy(h->mv_cache[m][scan8[0] - 1*8], s->current_picture.motion_val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t));
-                memset(&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]] == -1) ? PART_NOT_AVAILABLE : 1, 4);
-
-                if (s->mb_x < (s->mb_width - 1)) {
-                    *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride + 4];
-                    h->ref_cache[m][scan8[0] + 4 - 1*8] =
-                        (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride + 1]+6] == -1 ||
-                         h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride    ]  ] == -1) ? PART_NOT_AVAILABLE : 1;
-                }else
-                    h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE;
-                if (s->mb_x > 0) {
-                    *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride - 1];
-                    h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] == -1) ? PART_NOT_AVAILABLE : 1;
-                }else
-                    h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE;
-            }else
-                memset(&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8);
-
-            if (s->pict_type != FF_B_TYPE)
-                break;
-        }
-
-        /* decode motion vector(s) and form prediction(s) */
-        if (s->pict_type == FF_P_TYPE) {
-            if (svq3_mc_dir(h, (mb_type - 1), mode, 0, 0) < 0)
-                return -1;
-        } else {        /* FF_B_TYPE */
-            if (mb_type != 2) {
-                if (svq3_mc_dir(h, 0, mode, 0, 0) < 0)
-                    return -1;
-            } else {
-                for (i = 0; i < 4; i++) {
-                    memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-                }
-            }
-            if (mb_type != 1) {
-                if (svq3_mc_dir(h, 0, mode, 1, (mb_type == 3)) < 0)
-                    return -1;
-            } else {
-                for (i = 0; i < 4; i++) {
-                    memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-                }
-            }
-        }
-
-        mb_type = MB_TYPE_16x16;
-    } else if (mb_type == 8 || mb_type == 33) {   /* INTRA4x4 */
-        memset(h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t));
-
-        if (mb_type == 8) {
-            if (s->mb_x > 0) {
-                for (i = 0; i < 4; i++) {
-                    h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - 1]+6-i];
-                }
-                if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) {
-                    h->left_samples_available = 0x5F5F;
-                }
-            }
-            if (s->mb_y > 0) {
-                h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+0];
-                h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+1];
-                h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+2];
-                h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride]+3];
-
-                if (h->intra4x4_pred_mode_cache[4+8*0] == -1) {
-                    h->top_samples_available = 0x33FF;
-                }
-            }
-
-            /* decode prediction codes for luma blocks */
-            for (i = 0; i < 16; i+=2) {
-                vlc = svq3_get_ue_golomb(&s->gb);
-
-                if (vlc >= 25){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc);
-                    return -1;
-                }
-
-                left    = &h->intra4x4_pred_mode_cache[scan8[i] - 1];
-                top     = &h->intra4x4_pred_mode_cache[scan8[i] - 8];
-
-                left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]];
-                left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]];
-
-                if (left[1] == -1 || left[2] == -1){
-                    av_log(h->s.avctx, AV_LOG_ERROR, "weird prediction\n");
-                    return -1;
-                }
-            }
-        } else {    /* mb_type == 33, DC_128_PRED block type */
-            for (i = 0; i < 4; i++) {
-                memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_PRED, 4);
-            }
-        }
-
-        ff_h264_write_back_intra_pred_mode(h);
-
-        if (mb_type == 8) {
-            ff_h264_check_intra4x4_pred_mode(h);
-
-            h->top_samples_available  = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
-            h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
-        } else {
-            for (i = 0; i < 4; i++) {
-                memset(&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_128_PRED, 4);
-            }
-
-            h->top_samples_available  = 0x33FF;
-            h->left_samples_available = 0x5F5F;
-        }
-
-        mb_type = MB_TYPE_INTRA4x4;
-    } else {                      /* INTRA16x16 */
-        dir = i_mb_type_info[mb_type - 8].pred_mode;
-        dir = (dir >> 1) ^ 3*(dir & 1) ^ 1;
-
-        if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir)) == -1){
-            av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n");
-            return -1;
-        }
-
-        cbp = i_mb_type_info[mb_type - 8].cbp;
-        mb_type = MB_TYPE_INTRA16x16;
-    }
-
-    if (!IS_INTER(mb_type) && s->pict_type != FF_I_TYPE) {
-        for (i = 0; i < 4; i++) {
-            memset(s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-        }
-        if (s->pict_type == FF_B_TYPE) {
-            for (i = 0; i < 4; i++) {
-                memset(s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-            }
-        }
-    }
-    if (!IS_INTRA4x4(mb_type)) {
-        memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy], DC_PRED, 8);
-    }
-    if (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE) {
-        memset(h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t));
-        s->dsp.clear_blocks(h->mb);
-    }
-
-    if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == FF_B_TYPE)) {
-        if ((vlc = svq3_get_ue_golomb(&s->gb)) >= 48){
-            av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc);
-            return -1;
-        }
-
-        cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc];
-    }
-    if (IS_INTRA16x16(mb_type) || (s->pict_type != FF_I_TYPE && s->adaptive_quant && cbp)) {
-        s->qscale += svq3_get_se_golomb(&s->gb);
-
-        if (s->qscale > 31){
-            av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
-            return -1;
-        }
-    }
-    if (IS_INTRA16x16(mb_type)) {
-        if (svq3_decode_block(&s->gb, h->mb, 0, 0)){
-            av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
-            return -1;
-        }
-    }
-
-    if (cbp) {
-        const int index = IS_INTRA16x16(mb_type) ? 1 : 0;
-        const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1);
-
-        for (i = 0; i < 4; i++) {
-            if ((cbp & (1 << i))) {
-                for (j = 0; j < 4; j++) {
-                    k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j);
-                    h->non_zero_count_cache[ scan8[k] ] = 1;
-
-                    if (svq3_decode_block(&s->gb, &h->mb[16*k], index, type)){
-                        av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding block\n");
-                        return -1;
-                    }
-                }
-            }
-        }
-
-        if ((cbp & 0x30)) {
-            for (i = 0; i < 2; ++i) {
-              if (svq3_decode_block(&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)){
-                av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
-                return -1;
-              }
-            }
-
-            if ((cbp & 0x20)) {
-                for (i = 0; i < 8; i++) {
-                    h->non_zero_count_cache[ scan8[16+i] ] = 1;
-
-                    if (svq3_decode_block(&s->gb, &h->mb[16*(16 + i)], 1, 1)){
-                        av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n");
-                        return -1;
-                    }
-                }
-            }
-        }
-    }
-
-    h->cbp= cbp;
-    s->current_picture.mb_type[mb_xy] = mb_type;
-
-    if (IS_INTRA(mb_type)) {
-        h->chroma_pred_mode = ff_h264_check_intra_pred_mode(h, DC_PRED8x8);
-    }
-
-    return 0;
-}
-
-static int svq3_decode_slice_header(H264Context *h)
-{
-    MpegEncContext *const s = (MpegEncContext *) h;
-    const int mb_xy = h->mb_xy;
-    int i, header;
-
-    header = get_bits(&s->gb, 8);
-
-    if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
-        /* TODO: what? */
-        av_log(h->s.avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);
-        return -1;
-    } else {
-        int length = (header >> 5) & 3;
-
-        h->next_slice_index = get_bits_count(&s->gb) + 8*show_bits(&s->gb, 8*length) + 8*length;
-
-        if (h->next_slice_index > s->gb.size_in_bits) {
-            av_log(h->s.avctx, AV_LOG_ERROR, "slice after bitstream end\n");
-            return -1;
-    }
-
-        s->gb.size_in_bits = h->next_slice_index - 8*(length - 1);
-        skip_bits(&s->gb, 8);
-
-        if (h->svq3_watermark_key) {
-            uint32_t header = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1]);
-            AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1], header ^ h->svq3_watermark_key);
-        }
-        if (length > 0) {
-            memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3],
-                   &s->gb.buffer[s->gb.size_in_bits >> 3], (length - 1));
-        }
-        skip_bits_long(&s->gb, 0);
-    }
-
-    if ((i = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || i >= 3){
-        av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i);
-        return -1;
-    }
-
-    h->slice_type = golomb_to_pict_type[i];
-
-    if ((header & 0x9F) == 2) {
-        i = (s->mb_num < 64) ? 6 : (1 + av_log2 (s->mb_num - 1));
-        s->mb_skip_run = get_bits(&s->gb, i) - (s->mb_x + (s->mb_y * s->mb_width));
-    } else {
-        skip_bits1(&s->gb);
-        s->mb_skip_run = 0;
-    }
-
-    h->slice_num = get_bits(&s->gb, 8);
-    s->qscale = get_bits(&s->gb, 5);
-    s->adaptive_quant = get_bits1(&s->gb);
-
-    /* unknown fields */
-    skip_bits1(&s->gb);
-
-    if (h->unknown_svq3_flag) {
-        skip_bits1(&s->gb);
-    }
-
-    skip_bits1(&s->gb);
-    skip_bits(&s->gb, 2);
-
-    while (get_bits1(&s->gb)) {
-        skip_bits(&s->gb, 8);
-    }
-
-    /* reset intra predictors and invalidate motion vector references */
-    if (s->mb_x > 0) {
-        memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - 1      ]+3, -1, 4*sizeof(int8_t));
-        memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_x]  , -1, 8*sizeof(int8_t)*s->mb_x);
-    }
-    if (s->mb_y > 0) {
-        memset(h->intra4x4_pred_mode+h->mb2br_xy[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t)*(s->mb_width - s->mb_x));
-
-        if (s->mb_x > 0) {
-            h->intra4x4_pred_mode[h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] = -1;
-        }
-    }
-
-    return 0;
-}
-
-static av_cold int svq3_decode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *const s = avctx->priv_data;
-    H264Context *const h = avctx->priv_data;
-    int m;
-    unsigned char *extradata;
-    unsigned int size;
-
-    if(avctx->thread_count > 1){
-        av_log(avctx, AV_LOG_ERROR, "SVQ3 does not support multithreaded decoding, patch welcome! (check latest SVN too)\n");
-        return -1;
-    }
-
-    if (ff_h264_decode_init(avctx) < 0)
-        return -1;
-
-    s->flags  = avctx->flags;
-    s->flags2 = avctx->flags2;
-    s->unrestricted_mv = 1;
-    h->is_complex=1;
-    avctx->pix_fmt = avctx->codec->pix_fmts[0];
-
-    if (!s->context_initialized) {
-        s->width  = avctx->width;
-        s->height = avctx->height;
-        h->halfpel_flag      = 1;
-        h->thirdpel_flag     = 1;
-        h->unknown_svq3_flag = 0;
-        h->chroma_qp[0]      = h->chroma_qp[1] = 4;
-
-        if (MPV_common_init(s) < 0)
-            return -1;
-
-        h->b_stride = 4*s->mb_width;
-
-        ff_h264_alloc_tables(h);
-
-        /* prowl for the "SEQH" marker in the extradata */
-        extradata = (unsigned char *)avctx->extradata;
-        for (m = 0; m < avctx->extradata_size; m++) {
-            if (!memcmp(extradata, "SEQH", 4))
-                break;
-            extradata++;
-        }
-
-        /* if a match was found, parse the extra data */
-        if (extradata && !memcmp(extradata, "SEQH", 4)) {
-
-            GetBitContext gb;
-            int frame_size_code;
-
-            size = AV_RB32(&extradata[4]);
-            init_get_bits(&gb, extradata + 8, size*8);
-
-            /* 'frame size code' and optional 'width, height' */
-            frame_size_code = get_bits(&gb, 3);
-            switch (frame_size_code) {
-                case 0: avctx->width = 160; avctx->height = 120; break;
-                case 1: avctx->width = 128; avctx->height =  96; break;
-                case 2: avctx->width = 176; avctx->height = 144; break;
-                case 3: avctx->width = 352; avctx->height = 288; break;
-                case 4: avctx->width = 704; avctx->height = 576; break;
-                case 5: avctx->width = 240; avctx->height = 180; break;
-                case 6: avctx->width = 320; avctx->height = 240; break;
-                case 7:
-                    avctx->width  = get_bits(&gb, 12);
-                    avctx->height = get_bits(&gb, 12);
-                    break;
-            }
-
-            h->halfpel_flag  = get_bits1(&gb);
-            h->thirdpel_flag = get_bits1(&gb);
-
-            /* unknown fields */
-            skip_bits1(&gb);
-            skip_bits1(&gb);
-            skip_bits1(&gb);
-            skip_bits1(&gb);
-
-            s->low_delay = get_bits1(&gb);
-
-            /* unknown field */
-            skip_bits1(&gb);
-
-            while (get_bits1(&gb)) {
-                skip_bits(&gb, 8);
-            }
-
-            h->unknown_svq3_flag = get_bits1(&gb);
-            avctx->has_b_frames = !s->low_delay;
-            if (h->unknown_svq3_flag) {
-#if CONFIG_ZLIB
-                unsigned watermark_width  = svq3_get_ue_golomb(&gb);
-                unsigned watermark_height = svq3_get_ue_golomb(&gb);
-                int u1 = svq3_get_ue_golomb(&gb);
-                int u2 = get_bits(&gb, 8);
-                int u3 = get_bits(&gb, 2);
-                int u4 = svq3_get_ue_golomb(&gb);
-                unsigned buf_len = watermark_width*watermark_height*4;
-                int offset = (get_bits_count(&gb)+7)>>3;
-                uint8_t *buf;
-
-                if ((uint64_t)watermark_width*4 > UINT_MAX/watermark_height)
-                    return -1;
-
-                buf = av_malloc(buf_len);
-                av_log(avctx, AV_LOG_DEBUG, "watermark size: %dx%d\n", watermark_width, watermark_height);
-                av_log(avctx, AV_LOG_DEBUG, "u1: %x u2: %x u3: %x compressed data size: %d offset: %d\n", u1, u2, u3, u4, offset);
-                if (uncompress(buf, (uLong*)&buf_len, extradata + 8 + offset, size - offset) != Z_OK) {
-                    av_log(avctx, AV_LOG_ERROR, "could not uncompress watermark logo\n");
-                    av_free(buf);
-                    return -1;
-                }
-                h->svq3_watermark_key = ff_svq1_packet_checksum(buf, buf_len, 0);
-                h->svq3_watermark_key = h->svq3_watermark_key << 16 | h->svq3_watermark_key;
-                av_log(avctx, AV_LOG_DEBUG, "watermark key %#x\n", h->svq3_watermark_key);
-                av_free(buf);
-#else
-                av_log(avctx, AV_LOG_ERROR, "this svq3 file contains watermark which need zlib support compiled in\n");
-                return -1;
-#endif
-            }
-        }
-    }
-
-    return 0;
-}
-
-static int svq3_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    MpegEncContext *const s = avctx->priv_data;
-    H264Context *const h = avctx->priv_data;
-    int m, mb_type;
-
-    /* special case for last picture */
-    if (buf_size == 0) {
-        if (s->next_picture_ptr && !s->low_delay) {
-            *(AVFrame *) data = *(AVFrame *) &s->next_picture;
-            s->next_picture_ptr = NULL;
-            *data_size = sizeof(AVFrame);
-        }
-        return 0;
-    }
-
-    init_get_bits (&s->gb, buf, 8*buf_size);
-
-    s->mb_x = s->mb_y = h->mb_xy = 0;
-
-    if (svq3_decode_slice_header(h))
-        return -1;
-
-    s->pict_type = h->slice_type;
-    s->picture_number = h->slice_num;
-
-    if (avctx->debug&FF_DEBUG_PICT_INFO){
-        av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
-               av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
-               s->adaptive_quant, s->qscale, h->slice_num);
-    }
-
-    /* for hurry_up == 5 */
-    s->current_picture.pict_type = s->pict_type;
-    s->current_picture.key_frame = (s->pict_type == FF_I_TYPE);
-
-    /* Skip B-frames if we do not have reference frames. */
-    if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
-        return 0;
-    /* Skip B-frames if we are in a hurry. */
-    if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
-        return 0;
-    /* Skip everything if we are in a hurry >= 5. */
-    if (avctx->hurry_up >= 5)
-        return 0;
-    if (  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
-        ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
-        || avctx->skip_frame >= AVDISCARD_ALL)
-        return 0;
-
-    if (s->next_p_frame_damaged) {
-        if (s->pict_type == FF_B_TYPE)
-            return 0;
-        else
-            s->next_p_frame_damaged = 0;
-    }
-
-    if (ff_h264_frame_start(h) < 0)
-        return -1;
-
-    if (s->pict_type == FF_B_TYPE) {
-        h->frame_num_offset = (h->slice_num - h->prev_frame_num);
-
-        if (h->frame_num_offset < 0) {
-            h->frame_num_offset += 256;
-        }
-        if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
-            av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
-            return -1;
-        }
-    } else {
-        h->prev_frame_num = h->frame_num;
-        h->frame_num = h->slice_num;
-        h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
-
-        if (h->prev_frame_num_offset < 0) {
-            h->prev_frame_num_offset += 256;
-        }
-    }
-
-    for (m = 0; m < 2; m++){
-        int i;
-        for (i = 0; i < 4; i++){
-            int j;
-            for (j = -1; j < 4; j++)
-                h->ref_cache[m][scan8[0] + 8*i + j]= 1;
-            if (i < 3)
-                h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;
-        }
-    }
-
-    for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
-        for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
-            h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
-
-            if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
-                ((get_bits_count(&s->gb) & 7) == 0 || show_bits(&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
-
-                skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));
-                s->gb.size_in_bits = 8*buf_size;
-
-                if (svq3_decode_slice_header(h))
-                    return -1;
-
-                /* TODO: support s->mb_skip_run */
-            }
-
-            mb_type = svq3_get_ue_golomb(&s->gb);
-
-            if (s->pict_type == FF_I_TYPE) {
-                mb_type += 8;
-            } else if (s->pict_type == FF_B_TYPE && mb_type >= 4) {
-                mb_type += 4;
-            }
-            if (mb_type > 33 || svq3_decode_mb(h, mb_type)) {
-                av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
-                return -1;
-            }
-
-            if (mb_type != 0) {
-                ff_h264_hl_decode_mb (h);
-            }
-
-            if (s->pict_type != FF_B_TYPE && !s->low_delay) {
-                s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
-                    (s->pict_type == FF_P_TYPE && mb_type < 8) ? (mb_type - 1) : -1;
-            }
-        }
-
-        ff_draw_horiz_band(s, 16*s->mb_y, 16);
-    }
-
-    MPV_frame_end(s);
-
-    if (s->pict_type == FF_B_TYPE || s->low_delay) {
-        *(AVFrame *) data = *(AVFrame *) &s->current_picture;
-    } else {
-        *(AVFrame *) data = *(AVFrame *) &s->last_picture;
-    }
-
-    /* Do not output the last pic after seeking. */
-    if (s->last_picture_ptr || s->low_delay) {
-        *data_size = sizeof(AVFrame);
-    }
-
-    return buf_size;
-}
-
-
-AVCodec svq3_decoder = {
-    "svq3",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SVQ3,
-    sizeof(H264Context),
-    svq3_decode_init,
-    NULL,
-    ff_h264_decode_end,
-    svq3_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3"),
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_NONE},
-};
diff --git a/libavcodec/synth_filter.c b/libavcodec/synth_filter.c
deleted file mode 100644
index a0ae364..0000000
--- a/libavcodec/synth_filter.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "fft.h"
-#include "synth_filter.h"
-
-static void synth_filter_float(FFTContext *imdct,
-                           float *synth_buf_ptr, int *synth_buf_offset,
-                           float synth_buf2[32], const float window[512],
-                           float out[32], const float in[32], float scale, float bias)
-{
-    float *synth_buf= synth_buf_ptr + *synth_buf_offset;
-    int i, j;
-
-    ff_imdct_half(imdct, synth_buf, in);
-
-    for (i = 0; i < 16; i++){
-        float a= synth_buf2[i     ];
-        float b= synth_buf2[i + 16];
-        float c= 0;
-        float d= 0;
-        for (j = 0; j < 512 - *synth_buf_offset; j += 64){
-            a += window[i + j     ]*(-synth_buf[15 - i + j      ]);
-            b += window[i + j + 16]*( synth_buf[     i + j      ]);
-            c += window[i + j + 32]*( synth_buf[16 + i + j      ]);
-            d += window[i + j + 48]*( synth_buf[31 - i + j      ]);
-        }
-        for (     ; j < 512; j += 64){
-            a += window[i + j     ]*(-synth_buf[15 - i + j - 512]);
-            b += window[i + j + 16]*( synth_buf[     i + j - 512]);
-            c += window[i + j + 32]*( synth_buf[16 + i + j - 512]);
-            d += window[i + j + 48]*( synth_buf[31 - i + j - 512]);
-        }
-        out[i     ] = a*scale + bias;
-        out[i + 16] = b*scale + bias;
-        synth_buf2[i     ] = c;
-        synth_buf2[i + 16] = d;
-    }
-    *synth_buf_offset= (*synth_buf_offset - 32)&511;
-}
-
-av_cold void ff_synth_filter_init(SynthFilterContext *c)
-{
-    c->synth_filter_float = synth_filter_float;
-
-    if (ARCH_ARM) ff_synth_filter_init_arm(c);
-}
diff --git a/libavcodec/synth_filter.h b/libavcodec/synth_filter.h
deleted file mode 100644
index d6209d5..0000000
--- a/libavcodec/synth_filter.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_SYNTH_FILTER_H
-#define AVCODEC_SYNTH_FILTER_H
-
-#include "fft.h"
-
-typedef struct SynthFilterContext {
-    void (*synth_filter_float)(FFTContext *imdct,
-                               float *synth_buf_ptr, int *synth_buf_offset,
-                               float synth_buf2[32], const float window[512],
-                               float out[32], const float in[32],
-                               float scale, float bias);
-} SynthFilterContext;
-
-void ff_synth_filter_init(SynthFilterContext *c);
-void ff_synth_filter_init_arm(SynthFilterContext *c);
-
-#endif /* AVCODEC_SYNTH_FILTER_H */
diff --git a/libavcodec/tableprint.c b/libavcodec/tableprint.c
deleted file mode 100644
index e39606b..0000000
--- a/libavcodec/tableprint.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Generate a file for hardcoded tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <inttypes.h>
-#include "tableprint.h"
-
-WRITE_1D_FUNC(int8,   int8_t,   "%3"PRIi8, 15)
-WRITE_1D_FUNC(uint8,  uint8_t,  "0x%02"PRIx8, 15)
-WRITE_1D_FUNC(uint16, uint16_t, "0x%08"PRIx16, 7)
-WRITE_1D_FUNC(uint32, uint32_t, "0x%08"PRIx32, 7)
-WRITE_1D_FUNC(float,  float,    "%.18e", 3)
-
-WRITE_2D_FUNC(int8,   int8_t)
-WRITE_2D_FUNC(uint8,  uint8_t)
-WRITE_2D_FUNC(uint32, uint32_t)
-
-void write_fileheader(void) {
-    printf("/* This file was generated by libavcodec/tableprint */\n");
-    printf("#include <stdint.h>\n");
-}
diff --git a/libavcodec/tableprint.h b/libavcodec/tableprint.h
deleted file mode 100644
index d81af97..0000000
--- a/libavcodec/tableprint.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Generate a file for hardcoded tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_TABLEPRINT_H
-#define AVCODEC_TABLEPRINT_H
-
-#include <stdint.h>
-#include <stdio.h>
-
-#define WRITE_1D_FUNC_ARGV(name, type, linebrk, fmtstr, ...)\
-void write_##name##_array(const type *data, int len)\
-{\
-    int i;\
-    printf("   ");\
-    for (i = 0; i < len - 1; i++) {\
-       printf(" "fmtstr",", __VA_ARGS__);\
-       if ((i & linebrk) == linebrk) printf("\n   ");\
-    }\
-    printf(" "fmtstr"\n", __VA_ARGS__);\
-}
-
-#define WRITE_1D_FUNC(name, type, fmtstr, linebrk)\
-    WRITE_1D_FUNC_ARGV(name, type, linebrk, fmtstr, data[i])
-
-#define WRITE_2D_FUNC(name, type)\
-void write_##name##_2d_array(const void *arg, int len, int len2)\
-{\
-    const type *data = arg;\
-    int i;\
-    printf("    {\n");\
-    for (i = 0; i < len; i++) {\
-        write_##name##_array(data + i * len2, len2);\
-        printf(i == len - 1 ? "    }\n" : "    }, {\n");\
-    }\
-}
-
-/**
- * \defgroup printfuncs Predefined functions for printing tables
- *
- * \{
- */
-void write_int8_array     (const int8_t   *, int);
-void write_uint8_array    (const uint8_t  *, int);
-void write_uint16_array   (const uint16_t *, int);
-void write_uint32_array   (const uint32_t *, int);
-void write_float_array    (const float    *, int);
-void write_int8_2d_array  (const void *, int, int);
-void write_uint8_2d_array (const void *, int, int);
-void write_uint32_2d_array(const void *, int, int);
-/** \} */ // end of printfuncs group
-
-/** Write a standard file header */
-void write_fileheader(void);
-
-#endif /* AVCODEC_TABLEPRINT_H */
diff --git a/libavcodec/targa.c b/libavcodec/targa.c
deleted file mode 100644
index 50fe107..0000000
--- a/libavcodec/targa.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Targa (.tga) image decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-enum TargaCompr{
-    TGA_NODATA = 0, // no image data
-    TGA_PAL    = 1, // palettized
-    TGA_RGB    = 2, // true-color
-    TGA_BW     = 3, // black & white or grayscale
-    TGA_RLE    = 8, // flag pointing that data is RLE-coded
-};
-
-typedef struct TargaContext {
-    AVFrame picture;
-
-    int width, height;
-    int bpp;
-    int color_type;
-    int compression_type;
-} TargaContext;
-
-static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp)
-{
-    int i, x, y;
-    int depth = (bpp + 1) >> 3;
-    int type, count;
-    int diff;
-
-    diff = stride - w * depth;
-    x = y = 0;
-    while(y < h){
-        type = *src++;
-        count = (type & 0x7F) + 1;
-        type &= 0x80;
-        if((x + count > w) && (x + count + 1 > (h - y) * w)){
-            av_log(avctx, AV_LOG_ERROR, "Packet went out of bounds: position (%i,%i) size %i\n", x, y, count);
-            return;
-        }
-        for(i = 0; i < count; i++){
-            switch(depth){
-            case 1:
-                *dst = *src;
-                break;
-            case 2:
-                *((uint16_t*)dst) = AV_RL16(src);
-                break;
-            case 3:
-                dst[0] = src[0];
-                dst[1] = src[1];
-                dst[2] = src[2];
-                break;
-            case 4:
-                *((uint32_t*)dst) = AV_RL32(src);
-                break;
-            }
-            dst += depth;
-            if(!type)
-                src += depth;
-
-            x++;
-            if(x == w){
-                x = 0;
-                y++;
-                dst += diff;
-            }
-        }
-        if(type)
-            src += depth;
-    }
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TargaContext * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p= (AVFrame*)&s->picture;
-    uint8_t *dst;
-    int stride;
-    int idlen, pal, compr, x, y, w, h, bpp, flags;
-    int first_clr, colors, csize;
-
-    /* parse image header */
-    idlen = *buf++;
-    pal = *buf++;
-    compr = *buf++;
-    first_clr = AV_RL16(buf); buf += 2;
-    colors = AV_RL16(buf); buf += 2;
-    csize = *buf++;
-    x = AV_RL16(buf); buf += 2;
-    y = AV_RL16(buf); buf += 2;
-    w = AV_RL16(buf); buf += 2;
-    h = AV_RL16(buf); buf += 2;
-    bpp = *buf++;
-    flags = *buf++;
-    //skip identifier if any
-    buf += idlen;
-    s->bpp = bpp;
-    s->width = w;
-    s->height = h;
-    switch(s->bpp){
-    case 8:
-        avctx->pix_fmt = ((compr & (~TGA_RLE)) == TGA_BW) ? PIX_FMT_GRAY8 : PIX_FMT_PAL8;
-        break;
-    case 15:
-        avctx->pix_fmt = PIX_FMT_RGB555;
-        break;
-    case 16:
-        avctx->pix_fmt = PIX_FMT_RGB555;
-        break;
-    case 24:
-        avctx->pix_fmt = PIX_FMT_BGR24;
-        break;
-    case 32:
-        avctx->pix_fmt = PIX_FMT_RGB32;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Bit depth %i is not supported\n", s->bpp);
-        return -1;
-    }
-
-    if(s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    if(avcodec_check_dimensions(avctx, w, h))
-        return -1;
-    if(w != avctx->width || h != avctx->height)
-        avcodec_set_dimensions(avctx, w, h);
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    if(flags & 0x20){
-        dst = p->data[0];
-        stride = p->linesize[0];
-    }else{ //image is upside-down
-        dst = p->data[0] + p->linesize[0] * (h - 1);
-        stride = -p->linesize[0];
-    }
-
-    if(avctx->pix_fmt == PIX_FMT_PAL8 && avctx->palctrl){
-        memcpy(p->data[1], avctx->palctrl->palette, AVPALETTE_SIZE);
-        if(avctx->palctrl->palette_changed){
-            p->palette_has_changed = 1;
-            avctx->palctrl->palette_changed = 0;
-        }
-    }
-    if(colors){
-        if((colors + first_clr) > 256){
-            av_log(avctx, AV_LOG_ERROR, "Incorrect palette: %i colors with offset %i\n", colors, first_clr);
-            return -1;
-        }
-        if(csize != 24){
-            av_log(avctx, AV_LOG_ERROR, "Palette entry size %i bits is not supported\n", csize);
-            return -1;
-        }
-        if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway
-            buf += colors * ((csize + 1) >> 3);
-        else{
-            int r, g, b, t;
-            int32_t *pal = ((int32_t*)p->data[1]) + first_clr;
-            for(t = 0; t < colors; t++){
-                r = *buf++;
-                g = *buf++;
-                b = *buf++;
-                *pal++ = (b << 16) | (g << 8) | r;
-            }
-            p->palette_has_changed = 1;
-        }
-    }
-    if((compr & (~TGA_RLE)) == TGA_NODATA)
-        memset(p->data[0], 0, p->linesize[0] * s->height);
-    else{
-        if(compr & TGA_RLE)
-            targa_decode_rle(avctx, s, buf, dst, avctx->width, avctx->height, stride, bpp);
-        else{
-            for(y = 0; y < s->height; y++){
-#if HAVE_BIGENDIAN
-                if((s->bpp + 1) >> 3 == 2){
-                    uint16_t *dst16 = (uint16_t*)dst;
-                    for(x = 0; x < s->width; x++)
-                        dst16[x] = AV_RL16(buf + x * 2);
-                }else if((s->bpp + 1) >> 3 == 4){
-                    uint32_t *dst32 = (uint32_t*)dst;
-                    for(x = 0; x < s->width; x++)
-                        dst32[x] = AV_RL32(buf + x * 4);
-                }else
-#endif
-                    memcpy(dst, buf, s->width * ((s->bpp + 1) >> 3));
-
-                dst += stride;
-                buf += s->width * ((s->bpp + 1) >> 3);
-            }
-        }
-    }
-
-    *picture= *(AVFrame*)&s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return buf_size;
-}
-
-static av_cold int targa_init(AVCodecContext *avctx){
-    TargaContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults((AVFrame*)&s->picture);
-    avctx->coded_frame= (AVFrame*)&s->picture;
-
-    return 0;
-}
-
-static av_cold int targa_end(AVCodecContext *avctx){
-    TargaContext *s = avctx->priv_data;
-
-    if(s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-AVCodec targa_decoder = {
-    "targa",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TARGA,
-    sizeof(TargaContext),
-    targa_init,
-    NULL,
-    targa_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"),
-};
diff --git a/libavcodec/targaenc.c b/libavcodec/targaenc.c
deleted file mode 100644
index e5d0042..0000000
--- a/libavcodec/targaenc.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Targa (.tga) image encoder
- * Copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "rle.h"
-
-typedef struct TargaContext {
-    AVFrame picture;
-} TargaContext;
-
-/**
- * RLE compress the image, with maximum size of out_size
- * @param outbuf Output buffer
- * @param out_size Maximum output size
- * @param pic Image to compress
- * @param bpp Bytes per pixel
- * @param w Image width
- * @param h Image height
- * @return Size of output in bytes, or -1 if larger than out_size
- */
-static int targa_encode_rle(uint8_t *outbuf, int out_size, AVFrame *pic,
-                            int bpp, int w, int h)
-{
-    int y,ret;
-    uint8_t *out;
-
-    out = outbuf;
-
-    for(y = 0; y < h; y ++) {
-        ret = ff_rle_encode(out, out_size, pic->data[0] + pic->linesize[0] * y, bpp, w, 0x7f, 0, -1, 0);
-        if(ret == -1){
-            return -1;
-        }
-        out+= ret;
-        out_size -= ret;
-    }
-
-    return out - outbuf;
-}
-
-static int targa_encode_normal(uint8_t *outbuf, AVFrame *pic, int bpp, int w, int h)
-{
-    int i, n = bpp * w;
-    uint8_t *out = outbuf;
-    uint8_t *ptr = pic->data[0];
-
-    for(i=0; i < h; i++) {
-        memcpy(out, ptr, n);
-        out += n;
-        ptr += pic->linesize[0];
-    }
-
-    return out - outbuf;
-}
-
-static int targa_encode_frame(AVCodecContext *avctx,
-                              unsigned char *outbuf,
-                              int buf_size, void *data){
-    AVFrame *p = data;
-    int bpp, picsize, datasize = -1;
-    uint8_t *out;
-
-    if(avctx->width > 0xffff || avctx->height > 0xffff) {
-        av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n");
-        return -1;
-    }
-    picsize = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
-    if(buf_size < picsize + 45) {
-        av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n");
-        return -1;
-    }
-
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    /* zero out the header and only set applicable fields */
-    memset(outbuf, 0, 12);
-    AV_WL16(outbuf+12, avctx->width);
-    AV_WL16(outbuf+14, avctx->height);
-    outbuf[17] = 0x20;           /* origin is top-left. no alpha */
-
-    /* TODO: support alpha channel */
-    switch(avctx->pix_fmt) {
-    case PIX_FMT_GRAY8:
-        outbuf[2] = 3;           /* uncompressed grayscale image */
-        outbuf[16] = 8;          /* bpp */
-        break;
-    case PIX_FMT_RGB555LE:
-        outbuf[2] = 2;           /* uncompresses true-color image */
-        outbuf[16] = 16;         /* bpp */
-        break;
-    case PIX_FMT_BGR24:
-        outbuf[2] = 2;           /* uncompressed true-color image */
-        outbuf[16] = 24;         /* bpp */
-        break;
-    default:
-        return -1;
-    }
-    bpp = outbuf[16] >> 3;
-
-    out = outbuf + 18;  /* skip past the header we just output */
-
-    /* try RLE compression */
-    if (avctx->coder_type != FF_CODER_TYPE_RAW)
-        datasize = targa_encode_rle(out, picsize, p, bpp, avctx->width, avctx->height);
-
-    /* if that worked well, mark the picture as RLE compressed */
-    if(datasize >= 0)
-        outbuf[2] |= 8;
-
-    /* if RLE didn't make it smaller, go back to no compression */
-    else datasize = targa_encode_normal(out, p, bpp, avctx->width, avctx->height);
-
-    out += datasize;
-
-    /* The standard recommends including this section, even if we don't use
-     * any of the features it affords. TODO: take advantage of the pixel
-     * aspect ratio and encoder ID fields available? */
-    memcpy(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26);
-
-    return out + 26 - outbuf;
-}
-
-static av_cold int targa_encode_init(AVCodecContext *avctx)
-{
-    TargaContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    s->picture.key_frame= 1;
-    avctx->coded_frame= &s->picture;
-
-    return 0;
-}
-
-AVCodec targa_encoder = {
-    .name = "targa",
-    .type = AVMEDIA_TYPE_VIDEO,
-    .id = CODEC_ID_TARGA,
-    .priv_data_size = sizeof(TargaContext),
-    .init = targa_encode_init,
-    .encode = targa_encode_frame,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB555LE, PIX_FMT_GRAY8, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("Truevision Targa image"),
-};
diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c
deleted file mode 100644
index c5f632e..0000000
--- a/libavcodec/tiertexseqv.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Tiertex Limited SEQ Video Decoder
- * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Tiertex Limited SEQ video decoder
- */
-
-#include "avcodec.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-
-
-typedef struct SeqVideoContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-} SeqVideoContext;
-
-
-static const unsigned char *seq_unpack_rle_block(const unsigned char *src, unsigned char *dst, int dst_size)
-{
-    int i, len, sz;
-    GetBitContext gb;
-    int code_table[64];
-
-    /* get the rle codes (at most 64 bytes) */
-    init_get_bits(&gb, src, 64 * 8);
-    for (i = 0, sz = 0; i < 64 && sz < dst_size; i++) {
-        code_table[i] = get_sbits(&gb, 4);
-        sz += FFABS(code_table[i]);
-    }
-    src += (get_bits_count(&gb) + 7) / 8;
-
-    /* do the rle unpacking */
-    for (i = 0; i < 64 && dst_size > 0; i++) {
-        len = code_table[i];
-        if (len < 0) {
-            len = -len;
-            memset(dst, *src++, FFMIN(len, dst_size));
-        } else {
-            memcpy(dst, src, FFMIN(len, dst_size));
-            src += len;
-        }
-        dst += len;
-        dst_size -= len;
-    }
-    return src;
-}
-
-static const unsigned char *seq_decode_op1(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)
-{
-    const unsigned char *color_table;
-    int b, i, len, bits;
-    GetBitContext gb;
-    unsigned char block[8 * 8];
-
-    len = *src++;
-    if (len & 0x80) {
-        switch (len & 3) {
-        case 1:
-            src = seq_unpack_rle_block(src, block, sizeof(block));
-            for (b = 0; b < 8; b++) {
-                memcpy(dst, &block[b * 8], 8);
-                dst += seq->frame.linesize[0];
-            }
-            break;
-        case 2:
-            src = seq_unpack_rle_block(src, block, sizeof(block));
-            for (i = 0; i < 8; i++) {
-                for (b = 0; b < 8; b++)
-                    dst[b * seq->frame.linesize[0]] = block[i * 8 + b];
-                ++dst;
-            }
-            break;
-        }
-    } else {
-        color_table = src;
-        src += len;
-        bits = ff_log2_tab[len - 1] + 1;
-        init_get_bits(&gb, src, bits * 8 * 8); src += bits * 8;
-        for (b = 0; b < 8; b++) {
-            for (i = 0; i < 8; i++)
-                dst[i] = color_table[get_bits(&gb, bits)];
-            dst += seq->frame.linesize[0];
-        }
-    }
-
-    return src;
-}
-
-static const unsigned char *seq_decode_op2(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)
-{
-    int i;
-
-    for (i = 0; i < 8; i++) {
-        memcpy(dst, src, 8);
-        src += 8;
-        dst += seq->frame.linesize[0];
-    }
-
-    return src;
-}
-
-static const unsigned char *seq_decode_op3(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)
-{
-    int pos, offset;
-
-    do {
-        pos = *src++;
-        offset = ((pos >> 3) & 7) * seq->frame.linesize[0] + (pos & 7);
-        dst[offset] = *src++;
-    } while (!(pos & 0x80));
-
-    return src;
-}
-
-static void seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int data_size)
-{
-    GetBitContext gb;
-    int flags, i, j, x, y, op;
-    unsigned char c[3];
-    unsigned char *dst;
-    uint32_t *palette;
-
-    flags = *data++;
-
-    if (flags & 1) {
-        palette = (uint32_t *)seq->frame.data[1];
-        for (i = 0; i < 256; i++) {
-            for (j = 0; j < 3; j++, data++)
-                c[j] = (*data << 2) | (*data >> 4);
-            palette[i] = AV_RB24(c);
-        }
-        seq->frame.palette_has_changed = 1;
-    }
-
-    if (flags & 2) {
-        init_get_bits(&gb, data, 128 * 8); data += 128;
-        for (y = 0; y < 128; y += 8)
-            for (x = 0; x < 256; x += 8) {
-                dst = &seq->frame.data[0][y * seq->frame.linesize[0] + x];
-                op = get_bits(&gb, 2);
-                switch (op) {
-                case 1:
-                    data = seq_decode_op1(seq, data, dst);
-                    break;
-                case 2:
-                    data = seq_decode_op2(seq, data, dst);
-                    break;
-                case 3:
-                    data = seq_decode_op3(seq, data, dst);
-                    break;
-                }
-            }
-    }
-}
-
-static av_cold int seqvideo_decode_init(AVCodecContext *avctx)
-{
-    SeqVideoContext *seq = avctx->priv_data;
-
-    seq->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    seq->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int seqvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-
-    SeqVideoContext *seq = avctx->priv_data;
-
-    seq->frame.reference = 1;
-    seq->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &seq->frame)) {
-        av_log(seq->avctx, AV_LOG_ERROR, "tiertexseqvideo: reget_buffer() failed\n");
-        return -1;
-    }
-
-    seqvideo_decode(seq, buf, buf_size);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame *)data = seq->frame;
-
-    return buf_size;
-}
-
-static av_cold int seqvideo_decode_end(AVCodecContext *avctx)
-{
-    SeqVideoContext *seq = avctx->priv_data;
-
-    if (seq->frame.data[0])
-        avctx->release_buffer(avctx, &seq->frame);
-
-    return 0;
-}
-
-AVCodec tiertexseqvideo_decoder = {
-    "tiertexseqvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TIERTEXSEQVIDEO,
-    sizeof(SeqVideoContext),
-    seqvideo_decode_init,
-    NULL,
-    seqvideo_decode_end,
-    seqvideo_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ video"),
-};
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
deleted file mode 100644
index 2f3cef2..0000000
--- a/libavcodec/tiff.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- * TIFF image decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * TIFF image decoder
- * @file
- * @author Konstantin Shishkov
- */
-#include "avcodec.h"
-#if CONFIG_ZLIB
-#include <zlib.h>
-#endif
-#include "lzw.h"
-#include "tiff.h"
-#include "faxcompr.h"
-#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-
-typedef struct TiffContext {
-    AVCodecContext *avctx;
-    AVFrame picture;
-
-    int width, height;
-    unsigned int bpp;
-    int le;
-    int compr;
-    int invert;
-    int fax_opts;
-    int predictor;
-    int fill_order;
-
-    int strips, rps, sstype;
-    int sot;
-    const uint8_t* stripdata;
-    const uint8_t* stripsizes;
-    int stripsize, stripoff;
-    LZWState *lzw;
-} TiffContext;
-
-static int tget_short(const uint8_t **p, int le){
-    int v = le ? AV_RL16(*p) : AV_RB16(*p);
-    *p += 2;
-    return v;
-}
-
-static int tget_long(const uint8_t **p, int le){
-    int v = le ? AV_RL32(*p) : AV_RB32(*p);
-    *p += 4;
-    return v;
-}
-
-static int tget(const uint8_t **p, int type, int le){
-    switch(type){
-    case TIFF_BYTE : return *(*p)++;
-    case TIFF_SHORT: return tget_short(p, le);
-    case TIFF_LONG : return tget_long (p, le);
-    default        : return -1;
-    }
-}
-
-#if CONFIG_ZLIB
-static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, int size)
-{
-    z_stream zstream;
-    int zret;
-
-    memset(&zstream, 0, sizeof(zstream));
-    zstream.next_in = src;
-    zstream.avail_in = size;
-    zstream.next_out = dst;
-    zstream.avail_out = *len;
-    zret = inflateInit(&zstream);
-    if (zret != Z_OK) {
-        av_log(NULL, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
-        return zret;
-    }
-    zret = inflate(&zstream, Z_SYNC_FLUSH);
-    inflateEnd(&zstream);
-    *len = zstream.total_out;
-    return zret == Z_STREAM_END ? Z_OK : zret;
-}
-#endif
-
-static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){
-    int c, line, pixels, code;
-    const uint8_t *ssrc = src;
-    int width = s->width * s->bpp >> 3;
-#if CONFIG_ZLIB
-    uint8_t *zbuf; unsigned long outlen;
-
-    if(s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE){
-        int ret;
-        outlen = width * lines;
-        zbuf = av_malloc(outlen);
-        ret = tiff_uncompress(zbuf, &outlen, src, size);
-        if(ret != Z_OK){
-            av_log(s->avctx, AV_LOG_ERROR, "Uncompressing failed (%lu of %lu) with error %d\n", outlen, (unsigned long)width * lines, ret);
-            av_free(zbuf);
-            return -1;
-        }
-        src = zbuf;
-        for(line = 0; line < lines; line++){
-            memcpy(dst, src, width);
-            dst += stride;
-            src += width;
-        }
-        av_free(zbuf);
-        return 0;
-    }
-#endif
-    if(s->compr == TIFF_LZW){
-        if(ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF) < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "Error initializing LZW decoder\n");
-            return -1;
-        }
-    }
-    if(s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3 || s->compr == TIFF_G4){
-        int i, ret = 0;
-        uint8_t *src2 = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-        if(!src2 || (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE < (unsigned)size){
-            av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
-            return -1;
-        }
-        if(s->fax_opts & 2){
-            av_log(s->avctx, AV_LOG_ERROR, "Uncompressed fax mode is not supported (yet)\n");
-            av_free(src2);
-            return -1;
-        }
-        if(!s->fill_order){
-            memcpy(src2, src, size);
-        }else{
-            for(i = 0; i < size; i++)
-                src2[i] = av_reverse[src[i]];
-        }
-        memset(src2+size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-        switch(s->compr){
-        case TIFF_CCITT_RLE:
-        case TIFF_G3:
-        case TIFF_G4:
-            ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts);
-            break;
-        }
-        av_free(src2);
-        return ret;
-    }
-    for(line = 0; line < lines; line++){
-        if(src - ssrc > size){
-            av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n");
-            return -1;
-        }
-        switch(s->compr){
-        case TIFF_RAW:
-            memcpy(dst, src, width);
-            src += width;
-            break;
-        case TIFF_PACKBITS:
-            for(pixels = 0; pixels < width;){
-                code = (int8_t)*src++;
-                if(code >= 0){
-                    code++;
-                    if(pixels + code > width){
-                        av_log(s->avctx, AV_LOG_ERROR, "Copy went out of bounds\n");
-                        return -1;
-                    }
-                    memcpy(dst + pixels, src, code);
-                    src += code;
-                    pixels += code;
-                }else if(code != -128){ // -127..-1
-                    code = (-code) + 1;
-                    if(pixels + code > width){
-                        av_log(s->avctx, AV_LOG_ERROR, "Run went out of bounds\n");
-                        return -1;
-                    }
-                    c = *src++;
-                    memset(dst + pixels, c, code);
-                    pixels += code;
-                }
-            }
-            break;
-        case TIFF_LZW:
-            pixels = ff_lzw_decode(s->lzw, dst, width);
-            if(pixels < width){
-                av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width);
-                return -1;
-            }
-            break;
-        }
-        dst += stride;
-    }
-    return 0;
-}
-
-
-static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf)
-{
-    int tag, type, count, off, value = 0;
-    int i, j;
-    uint32_t *pal;
-    const uint8_t *rp, *gp, *bp;
-
-    tag = tget_short(&buf, s->le);
-    type = tget_short(&buf, s->le);
-    count = tget_long(&buf, s->le);
-    off = tget_long(&buf, s->le);
-
-    if(count == 1){
-        switch(type){
-        case TIFF_BYTE:
-        case TIFF_SHORT:
-            buf -= 4;
-            value = tget(&buf, type, s->le);
-            buf = NULL;
-            break;
-        case TIFF_LONG:
-            value = off;
-            buf = NULL;
-            break;
-        case TIFF_STRING:
-            if(count <= 4){
-                buf -= 4;
-                break;
-            }
-        default:
-            value = -1;
-            buf = start + off;
-        }
-    }else if(type_sizes[type] * count <= 4){
-        buf -= 4;
-    }else{
-        buf = start + off;
-    }
-
-    if(buf && (buf < start || buf > end_buf)){
-        av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
-        return -1;
-    }
-
-    switch(tag){
-    case TIFF_WIDTH:
-        s->width = value;
-        break;
-    case TIFF_HEIGHT:
-        s->height = value;
-        break;
-    case TIFF_BPP:
-        if(count == 1) s->bpp = value;
-        else{
-            switch(type){
-            case TIFF_BYTE:
-                s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) + ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF);
-                break;
-            case TIFF_SHORT:
-            case TIFF_LONG:
-                s->bpp = 0;
-                for(i = 0; i < count; i++) s->bpp += tget(&buf, type, s->le);
-                break;
-            default:
-                s->bpp = -1;
-            }
-        }
-        if(count > 4){
-            av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
-            return -1;
-        }
-        switch(s->bpp*10 + count){
-        case 11:
-            s->avctx->pix_fmt = PIX_FMT_MONOBLACK;
-            break;
-        case 81:
-            s->avctx->pix_fmt = PIX_FMT_PAL8;
-            break;
-        case 243:
-            s->avctx->pix_fmt = PIX_FMT_RGB24;
-            break;
-        case 161:
-            s->avctx->pix_fmt = PIX_FMT_GRAY16BE;
-            break;
-        case 324:
-            s->avctx->pix_fmt = PIX_FMT_RGBA;
-            break;
-        case 483:
-            s->avctx->pix_fmt = s->le ? PIX_FMT_RGB48LE : PIX_FMT_RGB48BE;
-            break;
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
-            return -1;
-        }
-        if(s->width != s->avctx->width || s->height != s->avctx->height){
-            if(avcodec_check_dimensions(s->avctx, s->width, s->height))
-                return -1;
-            avcodec_set_dimensions(s->avctx, s->width, s->height);
-        }
-        if(s->picture.data[0])
-            s->avctx->release_buffer(s->avctx, &s->picture);
-        if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-            return -1;
-        }
-        if(s->bpp == 8){
-            /* make default grayscale pal */
-            pal = (uint32_t *) s->picture.data[1];
-            for(i = 0; i < 256; i++)
-                pal[i] = i * 0x010101;
-        }
-        break;
-    case TIFF_COMPR:
-        s->compr = value;
-        s->predictor = 0;
-        switch(s->compr){
-        case TIFF_RAW:
-        case TIFF_PACKBITS:
-        case TIFF_LZW:
-        case TIFF_CCITT_RLE:
-            break;
-        case TIFF_G3:
-        case TIFF_G4:
-            s->fax_opts = 0;
-            break;
-        case TIFF_DEFLATE:
-        case TIFF_ADOBE_DEFLATE:
-#if CONFIG_ZLIB
-            break;
-#else
-            av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n");
-            return -1;
-#endif
-        case TIFF_JPEG:
-        case TIFF_NEWJPEG:
-            av_log(s->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n");
-            return -1;
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n", s->compr);
-            return -1;
-        }
-        break;
-    case TIFF_ROWSPERSTRIP:
-        if(type == TIFF_LONG && value == -1)
-            value = s->avctx->height;
-        if(value < 1){
-            av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n");
-            return -1;
-        }
-        s->rps = value;
-        break;
-    case TIFF_STRIP_OFFS:
-        if(count == 1){
-            s->stripdata = NULL;
-            s->stripoff = value;
-        }else
-            s->stripdata = start + off;
-        s->strips = count;
-        if(s->strips == 1) s->rps = s->height;
-        s->sot = type;
-        if(s->stripdata > end_buf){
-            av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
-            return -1;
-        }
-        break;
-    case TIFF_STRIP_SIZE:
-        if(count == 1){
-            s->stripsizes = NULL;
-            s->stripsize = value;
-            s->strips = 1;
-        }else{
-            s->stripsizes = start + off;
-        }
-        s->strips = count;
-        s->sstype = type;
-        if(s->stripsizes > end_buf){
-            av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
-            return -1;
-        }
-        break;
-    case TIFF_PREDICTOR:
-        s->predictor = value;
-        break;
-    case TIFF_INVERT:
-        switch(value){
-        case 0:
-            s->invert = 1;
-            break;
-        case 1:
-            s->invert = 0;
-            break;
-        case 2:
-        case 3:
-            break;
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", value);
-            return -1;
-        }
-        break;
-    case TIFF_FILL_ORDER:
-        if(value < 1 || value > 2){
-            av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value);
-            value = 1;
-        }
-        s->fill_order = value - 1;
-        break;
-    case TIFF_PAL:
-        if(s->avctx->pix_fmt != PIX_FMT_PAL8){
-            av_log(s->avctx, AV_LOG_ERROR, "Palette met but this is not palettized format\n");
-            return -1;
-        }
-        pal = (uint32_t *) s->picture.data[1];
-        off = type_sizes[type];
-        rp = buf;
-        gp = buf + count / 3 * off;
-        bp = buf + count / 3 * off * 2;
-        off = (type_sizes[type] - 1) << 3;
-        for(i = 0; i < count / 3; i++){
-            j = (tget(&rp, type, s->le) >> off) << 16;
-            j |= (tget(&gp, type, s->le) >> off) << 8;
-            j |= tget(&bp, type, s->le) >> off;
-            pal[i] = j;
-        }
-        break;
-    case TIFF_PLANAR:
-        if(value == 2){
-            av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n");
-            return -1;
-        }
-        break;
-    case TIFF_T4OPTIONS:
-        if(s->compr == TIFF_G3)
-            s->fax_opts = value;
-        break;
-    case TIFF_T6OPTIONS:
-        if(s->compr == TIFF_G4)
-            s->fax_opts = value;
-        break;
-    }
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TiffContext * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p= (AVFrame*)&s->picture;
-    const uint8_t *orig_buf = buf, *end_buf = buf + buf_size;
-    int id, le, off;
-    int i, j, entries;
-    int stride, soff, ssize;
-    uint8_t *dst;
-
-    //parse image header
-    id = AV_RL16(buf); buf += 2;
-    if(id == 0x4949) le = 1;
-    else if(id == 0x4D4D) le = 0;
-    else{
-        av_log(avctx, AV_LOG_ERROR, "TIFF header not found\n");
-        return -1;
-    }
-    s->le = le;
-    s->invert = 0;
-    s->compr = TIFF_RAW;
-    s->fill_order = 0;
-    // As TIFF 6.0 specification puts it "An arbitrary but carefully chosen number
-    // that further identifies the file as a TIFF file"
-    if(tget_short(&buf, le) != 42){
-        av_log(avctx, AV_LOG_ERROR, "The answer to life, universe and everything is not correct!\n");
-        return -1;
-    }
-    /* parse image file directory */
-    off = tget_long(&buf, le);
-    if(orig_buf + off + 14 >= end_buf){
-        av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n");
-        return -1;
-    }
-    buf = orig_buf + off;
-    entries = tget_short(&buf, le);
-    for(i = 0; i < entries; i++){
-        if(tiff_decode_tag(s, orig_buf, buf, end_buf) < 0)
-            return -1;
-        buf += 12;
-    }
-    if(!s->stripdata && !s->stripoff){
-        av_log(avctx, AV_LOG_ERROR, "Image data is missing\n");
-        return -1;
-    }
-    /* now we have the data and may start decoding */
-    if(!p->data[0]){
-        s->bpp = 1;
-        avctx->pix_fmt = PIX_FMT_MONOBLACK;
-        if(s->width != s->avctx->width || s->height != s->avctx->height){
-            if(avcodec_check_dimensions(s->avctx, s->width, s->height))
-                return -1;
-            avcodec_set_dimensions(s->avctx, s->width, s->height);
-        }
-        if(s->picture.data[0])
-            s->avctx->release_buffer(s->avctx, &s->picture);
-        if(s->avctx->get_buffer(s->avctx, &s->picture) < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-            return -1;
-        }
-    }
-    if(s->strips == 1 && !s->stripsize){
-        av_log(avctx, AV_LOG_WARNING, "Image data size missing\n");
-        s->stripsize = buf_size - s->stripoff;
-    }
-    stride = p->linesize[0];
-    dst = p->data[0];
-    for(i = 0; i < s->height; i += s->rps){
-        if(s->stripsizes)
-            ssize = tget(&s->stripsizes, s->sstype, s->le);
-        else
-            ssize = s->stripsize;
-
-        if(s->stripdata){
-            soff = tget(&s->stripdata, s->sot, s->le);
-        }else
-            soff = s->stripoff;
-        if(tiff_unpack_strip(s, dst, stride, orig_buf + soff, ssize, FFMIN(s->rps, s->height - i)) < 0)
-            break;
-        dst += s->rps * stride;
-    }
-    if(s->predictor == 2){
-        dst = p->data[0];
-        soff = s->bpp >> 3;
-        ssize = s->width * soff;
-        for(i = 0; i < s->height; i++) {
-            for(j = soff; j < ssize; j++)
-                dst[j] += dst[j - soff];
-            dst += stride;
-        }
-    }
-
-    if(s->invert){
-        uint8_t *src;
-        int j;
-
-        src = s->picture.data[0];
-        for(j = 0; j < s->height; j++){
-            for(i = 0; i < s->picture.linesize[0]; i++)
-                src[i] = 255 - src[i];
-            src += s->picture.linesize[0];
-        }
-    }
-    *picture= *(AVFrame*)&s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return buf_size;
-}
-
-static av_cold int tiff_init(AVCodecContext *avctx){
-    TiffContext *s = avctx->priv_data;
-
-    s->width = 0;
-    s->height = 0;
-    s->avctx = avctx;
-    avcodec_get_frame_defaults((AVFrame*)&s->picture);
-    avctx->coded_frame= (AVFrame*)&s->picture;
-    ff_lzw_decode_open(&s->lzw);
-    ff_ccitt_unpack_init();
-
-    return 0;
-}
-
-static av_cold int tiff_end(AVCodecContext *avctx)
-{
-    TiffContext * const s = avctx->priv_data;
-
-    ff_lzw_decode_close(&s->lzw);
-    if(s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-    return 0;
-}
-
-AVCodec tiff_decoder = {
-    "tiff",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TIFF,
-    sizeof(TiffContext),
-    tiff_init,
-    NULL,
-    tiff_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
-};
diff --git a/libavcodec/tiff.h b/libavcodec/tiff.h
deleted file mode 100644
index 235a998..0000000
--- a/libavcodec/tiff.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * TIFF tables
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * TIFF tables
- * @file
- * @author Konstantin Shishkov
- */
-#ifndef AVCODEC_TIFF_H
-#define AVCODEC_TIFF_H
-
-#include <stdint.h>
-
-/** abridged list of TIFF tags */
-enum TiffTags{
-    TIFF_SUBFILE = 0xfe,
-    TIFF_WIDTH = 0x100,
-    TIFF_HEIGHT,
-    TIFF_BPP,
-    TIFF_COMPR,
-    TIFF_INVERT = 0x106,
-    TIFF_FILL_ORDER = 0x10A,
-    TIFF_STRIP_OFFS = 0x111,
-    TIFF_SAMPLES_PER_PIXEL = 0x115,
-    TIFF_ROWSPERSTRIP = 0x116,
-    TIFF_STRIP_SIZE,
-    TIFF_XRES = 0x11A,
-    TIFF_YRES = 0x11B,
-    TIFF_PLANAR = 0x11C,
-    TIFF_XPOS = 0x11E,
-    TIFF_YPOS = 0x11F,
-    TIFF_T4OPTIONS = 0x124,
-    TIFF_T6OPTIONS,
-    TIFF_RES_UNIT = 0x128,
-    TIFF_SOFTWARE_NAME = 0x131,
-    TIFF_PREDICTOR = 0x13D,
-    TIFF_PAL = 0x140,
-    TIFF_YCBCR_COEFFICIENTS = 0x211,
-    TIFF_YCBCR_SUBSAMPLING = 0x212,
-    TIFF_YCBCR_POSITIONING = 0x213,
-    TIFF_REFERENCE_BW = 0x214,
-};
-
-/** list of TIFF compression types */
-enum TiffCompr{
-    TIFF_RAW = 1,
-    TIFF_CCITT_RLE,
-    TIFF_G3,
-    TIFF_G4,
-    TIFF_LZW,
-    TIFF_JPEG,
-    TIFF_NEWJPEG,
-    TIFF_ADOBE_DEFLATE,
-    TIFF_PACKBITS = 0x8005,
-    TIFF_DEFLATE = 0x80B2
-};
-
-enum TiffTypes{
-    TIFF_BYTE = 1,
-    TIFF_STRING,
-    TIFF_SHORT,
-    TIFF_LONG,
-    TIFF_RATIONAL,
-};
-
-/** sizes of various TIFF field types (string size = 100)*/
-static const uint8_t type_sizes[6] = {
-    0, 1, 100, 2, 4, 8
-};
-
-#endif /* AVCODEC_TIFF_H */
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
deleted file mode 100644
index 0905cea..0000000
--- a/libavcodec/tiffenc.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * TIFF image encoder
- * Copyright (c) 2007 Bartlomiej Wolowiec
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * TIFF image encoder
- * @file
- * @author Bartlomiej Wolowiec
- */
-#include "avcodec.h"
-#if CONFIG_ZLIB
-#include <zlib.h>
-#endif
-#include "bytestream.h"
-#include "tiff.h"
-#include "rle.h"
-#include "lzw.h"
-#include "put_bits.h"
-
-#define TIFF_MAX_ENTRY 32
-
-/** sizes of various TIFF field types (string size = 1)*/
-static const uint8_t type_sizes2[6] = {
-    0, 1, 1, 2, 4, 8
-};
-
-typedef struct TiffEncoderContext {
-    AVCodecContext *avctx;
-    AVFrame picture;
-
-    int width;                          ///< picture width
-    int height;                         ///< picture height
-    unsigned int bpp;                   ///< bits per pixel
-    int compr;                          ///< compression level
-    int bpp_tab_size;                   ///< bpp_tab size
-    int photometric_interpretation;     ///< photometric interpretation
-    int strips;                         ///< number of strips
-    int rps;                            ///< row per strip
-    uint8_t entries[TIFF_MAX_ENTRY*12]; ///< entires in header
-    int num_entries;                    ///< number of entires
-    uint8_t **buf;                      ///< actual position in buffer
-    uint8_t *buf_start;                 ///< pointer to first byte in buffer
-    int buf_size;                       ///< buffer size
-    uint16_t subsampling[2];            ///< YUV subsampling factors
-    struct LZWEncodeState *lzws;        ///< LZW Encode state
-} TiffEncoderContext;
-
-
-/**
- * Check free space in buffer
- * @param s Tiff context
- * @param need Needed bytes
- * @return 0 - ok, 1 - no free space
- */
-inline static int check_size(TiffEncoderContext * s, uint64_t need)
-{
-    if (s->buf_size < *s->buf - s->buf_start + need) {
-        *s->buf = s->buf_start + s->buf_size + 1;
-        av_log(s->avctx, AV_LOG_ERROR, "Buffer is too small\n");
-        return 1;
-    }
-    return 0;
-}
-
-/**
- * Put n values to buffer
- *
- * @param p Pointer to pointer to output buffer
- * @param n Number of values
- * @param val Pointer to values
- * @param type Type of values
- * @param flip =0 - normal copy, >0 - flip
- */
-static void tnput(uint8_t ** p, int n, const uint8_t * val, enum TiffTypes type,
-                  int flip)
-{
-    int i;
-#if HAVE_BIGENDIAN
-    flip ^= ((int[]) {0, 0, 0, 1, 3, 3})[type];
-#endif
-    for (i = 0; i < n * type_sizes2[type]; i++)
-        *(*p)++ = val[i ^ flip];
-}
-
-/**
- * Add entry to directory in tiff header.
- * @param s Tiff context
- * @param tag Tag that identifies the entry
- * @param type Entry type
- * @param count The number of values
- * @param ptr_val Pointer to values
- */
-static void add_entry(TiffEncoderContext * s,
-                      enum TiffTags tag, enum TiffTypes type, int count,
-                      const void *ptr_val)
-{
-    uint8_t *entries_ptr = s->entries + 12 * s->num_entries;
-
-    assert(s->num_entries < TIFF_MAX_ENTRY);
-
-    bytestream_put_le16(&entries_ptr, tag);
-    bytestream_put_le16(&entries_ptr, type);
-    bytestream_put_le32(&entries_ptr, count);
-
-    if (type_sizes[type] * count <= 4) {
-        tnput(&entries_ptr, count, ptr_val, type, 0);
-    } else {
-        bytestream_put_le32(&entries_ptr, *s->buf - s->buf_start);
-        check_size(s, count * type_sizes2[type]);
-        tnput(s->buf, count, ptr_val, type, 0);
-    }
-
-    s->num_entries++;
-}
-
-static void add_entry1(TiffEncoderContext * s,
-                       enum TiffTags tag, enum TiffTypes type, int val){
-    uint16_t w = val;
-    uint32_t dw= val;
-    add_entry(s, tag, type, 1, type == TIFF_SHORT ? (void *)&w : (void *)&dw);
-}
-
-/**
- * Encode one strip in tiff file
- *
- * @param s Tiff context
- * @param src Input buffer
- * @param dst Output buffer
- * @param n Size of input buffer
- * @param compr Compression method
- * @return Number of output bytes. If an output error is encountered, -1 returned
- */
-static int encode_strip(TiffEncoderContext * s, const int8_t * src,
-                        uint8_t * dst, int n, int compr)
-{
-
-    switch (compr) {
-#if CONFIG_ZLIB
-    case TIFF_DEFLATE:
-    case TIFF_ADOBE_DEFLATE:
-        {
-            unsigned long zlen = s->buf_size - (*s->buf - s->buf_start);
-            if (compress(dst, &zlen, src, n) != Z_OK) {
-                av_log(s->avctx, AV_LOG_ERROR, "Compressing failed\n");
-                return -1;
-            }
-            return zlen;
-        }
-#endif
-    case TIFF_RAW:
-        if (check_size(s, n))
-            return -1;
-        memcpy(dst, src, n);
-        return n;
-    case TIFF_PACKBITS:
-        return ff_rle_encode(dst, s->buf_size - (*s->buf - s->buf_start), src, 1, n, 2, 0xff, -1, 0);
-    case TIFF_LZW:
-        return ff_lzw_encode(s->lzws, src, n);
-    default:
-        return -1;
-    }
-}
-
-static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum)
-{
-    AVFrame *p = &s->picture;
-    int i, j, k;
-    int w = (s->width - 1) / s->subsampling[0] + 1;
-    uint8_t *pu = &p->data[1][lnum / s->subsampling[1] * p->linesize[1]];
-    uint8_t *pv = &p->data[2][lnum / s->subsampling[1] * p->linesize[2]];
-    for (i = 0; i < w; i++){
-        for (j = 0; j < s->subsampling[1]; j++)
-            for (k = 0; k < s->subsampling[0]; k++)
-                *dst++ = p->data[0][(lnum + j) * p->linesize[0] +
-                                    i * s->subsampling[0] + k];
-        *dst++ = *pu++;
-        *dst++ = *pv++;
-    }
-}
-
-static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
-                        int buf_size, void *data)
-{
-    TiffEncoderContext *s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame *const p = (AVFrame *) & s->picture;
-    int i;
-    int n;
-    uint8_t *ptr = buf;
-    uint8_t *offset;
-    uint32_t strips;
-    uint32_t *strip_sizes = NULL;
-    uint32_t *strip_offsets = NULL;
-    int bytes_per_row;
-    uint32_t res[2] = { 72, 1 };        // image resolution (72/1)
-    static const uint16_t bpp_tab[] = { 8, 8, 8, 8 };
-    int ret = -1;
-    int is_yuv = 0;
-    uint8_t *yuv_line = NULL;
-    int shift_h, shift_v;
-
-    s->buf_start = buf;
-    s->buf = &ptr;
-    s->buf_size = buf_size;
-
-    *p = *pict;
-    p->pict_type = FF_I_TYPE;
-    p->key_frame = 1;
-    avctx->coded_frame= &s->picture;
-
-    s->compr = TIFF_PACKBITS;
-    if (avctx->compression_level == 0) {
-        s->compr = TIFF_RAW;
-    } else if(avctx->compression_level == 2) {
-        s->compr = TIFF_LZW;
-#if CONFIG_ZLIB
-    } else if ((avctx->compression_level >= 3)) {
-        s->compr = TIFF_DEFLATE;
-#endif
-    }
-
-    s->width = avctx->width;
-    s->height = avctx->height;
-    s->subsampling[0] = 1;
-    s->subsampling[1] = 1;
-
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_RGB24:
-        s->bpp = 24;
-        s->photometric_interpretation = 2;
-        break;
-    case PIX_FMT_GRAY8:
-        s->bpp = 8;
-        s->photometric_interpretation = 1;
-        break;
-    case PIX_FMT_PAL8:
-        s->bpp = 8;
-        s->photometric_interpretation = 3;
-        break;
-    case PIX_FMT_MONOBLACK:
-        s->bpp = 1;
-        s->photometric_interpretation = 1;
-        break;
-    case PIX_FMT_MONOWHITE:
-        s->bpp = 1;
-        s->photometric_interpretation = 0;
-        break;
-    case PIX_FMT_YUV420P:
-    case PIX_FMT_YUV422P:
-    case PIX_FMT_YUV444P:
-    case PIX_FMT_YUV410P:
-    case PIX_FMT_YUV411P:
-        s->photometric_interpretation = 6;
-        avcodec_get_chroma_sub_sample(avctx->pix_fmt,
-                &shift_h, &shift_v);
-        s->bpp = 8 + (16 >> (shift_h + shift_v));
-        s->subsampling[0] = 1 << shift_h;
-        s->subsampling[1] = 1 << shift_v;
-        s->bpp_tab_size = 3;
-        is_yuv = 1;
-        break;
-    default:
-        av_log(s->avctx, AV_LOG_ERROR,
-               "This colors format is not supported\n");
-        return -1;
-    }
-    if (!is_yuv)
-        s->bpp_tab_size = (s->bpp >> 3);
-
-    if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE || s->compr == TIFF_LZW)
-        //best choose for DEFLATE
-        s->rps = s->height;
-    else
-        s->rps = FFMAX(8192 / (((s->width * s->bpp) >> 3) + 1), 1);     // suggest size of strip
-    s->rps = ((s->rps - 1) / s->subsampling[1] + 1) * s->subsampling[1]; // round rps up
-
-    strips = (s->height - 1) / s->rps + 1;
-
-    if (check_size(s, 8))
-        goto fail;
-
-    // write header
-    bytestream_put_le16(&ptr, 0x4949);
-    bytestream_put_le16(&ptr, 42);
-
-    offset = ptr;
-    bytestream_put_le32(&ptr, 0);
-
-    strip_sizes = av_mallocz(sizeof(*strip_sizes) * strips);
-    strip_offsets = av_mallocz(sizeof(*strip_offsets) * strips);
-
-    bytes_per_row = (((s->width - 1)/s->subsampling[0] + 1) * s->bpp
-                    * s->subsampling[0] * s->subsampling[1] + 7) >> 3;
-    if (is_yuv){
-        yuv_line = av_malloc(bytes_per_row);
-        if (yuv_line == NULL){
-            av_log(s->avctx, AV_LOG_ERROR, "Not enough memory\n");
-            goto fail;
-        }
-    }
-
-#if CONFIG_ZLIB
-    if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) {
-        uint8_t *zbuf;
-        int zlen, zn;
-        int j;
-
-        zlen = bytes_per_row * s->rps;
-        zbuf = av_malloc(zlen);
-        strip_offsets[0] = ptr - buf;
-        zn = 0;
-        for (j = 0; j < s->rps; j++) {
-            if (is_yuv){
-                pack_yuv(s, yuv_line, j);
-                memcpy(zbuf + zn, yuv_line, bytes_per_row);
-                j += s->subsampling[1] - 1;
-            }
-            else
-                memcpy(zbuf + j * bytes_per_row,
-                       p->data[0] + j * p->linesize[0], bytes_per_row);
-            zn += bytes_per_row;
-        }
-        n = encode_strip(s, zbuf, ptr, zn, s->compr);
-        av_free(zbuf);
-        if (n<0) {
-            av_log(s->avctx, AV_LOG_ERROR, "Encode strip failed\n");
-            goto fail;
-        }
-        ptr += n;
-        strip_sizes[0] = ptr - buf - strip_offsets[0];
-    } else
-#endif
-    {
-        if(s->compr == TIFF_LZW)
-            s->lzws = av_malloc(ff_lzw_encode_state_size);
-        for (i = 0; i < s->height; i++) {
-            if (strip_sizes[i / s->rps] == 0) {
-                if(s->compr == TIFF_LZW){
-                    ff_lzw_encode_init(s->lzws, ptr, s->buf_size - (*s->buf - s->buf_start),
-                                       12, FF_LZW_TIFF, put_bits);
-                }
-                strip_offsets[i / s->rps] = ptr - buf;
-            }
-            if (is_yuv){
-                 pack_yuv(s, yuv_line, i);
-                 n = encode_strip(s, yuv_line, ptr, bytes_per_row, s->compr);
-                 i += s->subsampling[1] - 1;
-            }
-            else
-                n = encode_strip(s, p->data[0] + i * p->linesize[0],
-                        ptr, bytes_per_row, s->compr);
-            if (n < 0) {
-                av_log(s->avctx, AV_LOG_ERROR, "Encode strip failed\n");
-                goto fail;
-            }
-            strip_sizes[i / s->rps] += n;
-            ptr += n;
-            if(s->compr == TIFF_LZW && (i==s->height-1 || i%s->rps == s->rps-1)){
-                int ret;
-                ret = ff_lzw_encode_flush(s->lzws, flush_put_bits);
-                strip_sizes[(i / s->rps )] += ret ;
-                ptr += ret;
-            }
-        }
-        if(s->compr == TIFF_LZW)
-            av_free(s->lzws);
-    }
-
-    s->num_entries = 0;
-
-    add_entry1(s,TIFF_SUBFILE,           TIFF_LONG,             0);
-    add_entry1(s,TIFF_WIDTH,             TIFF_LONG,             s->width);
-    add_entry1(s,TIFF_HEIGHT,            TIFF_LONG,             s->height);
-
-    if (s->bpp_tab_size)
-    add_entry(s, TIFF_BPP,               TIFF_SHORT,    s->bpp_tab_size, bpp_tab);
-
-    add_entry1(s,TIFF_COMPR,             TIFF_SHORT,            s->compr);
-    add_entry1(s,TIFF_INVERT,            TIFF_SHORT,            s->photometric_interpretation);
-    add_entry(s, TIFF_STRIP_OFFS,        TIFF_LONG,     strips, strip_offsets);
-
-    if (s->bpp_tab_size)
-    add_entry1(s,TIFF_SAMPLES_PER_PIXEL, TIFF_SHORT,            s->bpp_tab_size);
-
-    add_entry1(s,TIFF_ROWSPERSTRIP,      TIFF_LONG,             s->rps);
-    add_entry(s, TIFF_STRIP_SIZE,        TIFF_LONG,     strips, strip_sizes);
-    add_entry(s, TIFF_XRES,              TIFF_RATIONAL, 1,      res);
-    add_entry(s, TIFF_YRES,              TIFF_RATIONAL, 1,      res);
-    add_entry1(s,TIFF_RES_UNIT,          TIFF_SHORT,            2);
-
-    if(!(avctx->flags & CODEC_FLAG_BITEXACT))
-    add_entry(s, TIFF_SOFTWARE_NAME,     TIFF_STRING,
-              strlen(LIBAVCODEC_IDENT) + 1, LIBAVCODEC_IDENT);
-
-    if (avctx->pix_fmt == PIX_FMT_PAL8) {
-        uint16_t pal[256 * 3];
-        for (i = 0; i < 256; i++) {
-            uint32_t rgb = *(uint32_t *) (p->data[1] + i * 4);
-            pal[i]       = ((rgb >> 16) & 0xff) * 257;
-            pal[i + 256] = ((rgb >> 8 ) & 0xff) * 257;
-            pal[i + 512] = ( rgb        & 0xff) * 257;
-        }
-        add_entry(s, TIFF_PAL, TIFF_SHORT, 256 * 3, pal);
-    }
-    if (is_yuv){
-        /** according to CCIR Recommendation 601.1 */
-        uint32_t refbw[12] = {15, 1, 235, 1, 128, 1, 240, 1, 128, 1, 240, 1};
-        add_entry(s, TIFF_YCBCR_SUBSAMPLING, TIFF_SHORT,    2, s->subsampling);
-        add_entry(s, TIFF_REFERENCE_BW,      TIFF_RATIONAL, 6, refbw);
-    }
-    bytestream_put_le32(&offset, ptr - buf);    // write offset to dir
-
-    if (check_size(s, 6 + s->num_entries * 12))
-        goto fail;
-    bytestream_put_le16(&ptr, s->num_entries);  // write tag count
-    bytestream_put_buffer(&ptr, s->entries, s->num_entries * 12);
-    bytestream_put_le32(&ptr, 0);
-
-    ret = ptr - buf;
-
-fail:
-    av_free(strip_sizes);
-    av_free(strip_offsets);
-    av_free(yuv_line);
-    return ret;
-}
-
-AVCodec tiff_encoder = {
-    "tiff",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TIFF,
-    sizeof(TiffEncoderContext),
-    NULL,
-    encode_frame,
-    NULL,
-    NULL,
-    0,
-    NULL,
-    .pix_fmts =
-        (const enum PixelFormat[]) {PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8,
-                              PIX_FMT_MONOBLACK, PIX_FMT_MONOWHITE,
-                              PIX_FMT_YUV420P, PIX_FMT_YUV422P,
-                              PIX_FMT_YUV444P, PIX_FMT_YUV410P,
-                              PIX_FMT_YUV411P,
-                              PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
-};
diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c
deleted file mode 100644
index 5117cd0..0000000
--- a/libavcodec/tmv.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 8088flex TMV video decoder
- * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * 8088flex TMV video decoder
- * @file
- * @author Daniel Verkamp
- * @sa http://www.oldskool.org/pc/8088_Corruption
- */
-
-#include "avcodec.h"
-
-#include "cga_data.h"
-
-typedef struct TMVContext {
-    AVFrame pic;
-} TMVContext;
-
-static int tmv_decode_frame(AVCodecContext *avctx, void *data,
-                            int *data_size, AVPacket *avpkt)
-{
-    TMVContext *tmv    = avctx->priv_data;
-    const uint8_t *src = avpkt->data;
-    uint8_t *dst, *dst_char;
-    unsigned char_cols = avctx->width >> 3;
-    unsigned char_rows = avctx->height >> 3;
-    unsigned x, y, mask, char_y, fg, bg, c;
-
-    if (tmv->pic.data[0])
-        avctx->release_buffer(avctx, &tmv->pic);
-
-    if (avctx->get_buffer(avctx, &tmv->pic) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if (avpkt->size < 2*char_rows*char_cols) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Input buffer too small, truncated sample?\n");
-        *data_size = 0;
-        return -1;
-    }
-
-    tmv->pic.pict_type = FF_I_TYPE;
-    tmv->pic.key_frame = 1;
-    dst                = tmv->pic.data[0];
-
-    tmv->pic.palette_has_changed = 1;
-    memcpy(tmv->pic.data[1], ff_cga_palette, 16 * 4);
-
-    for (y = 0; y < char_rows; y++) {
-        for (x = 0; x < char_cols; x++) {
-            c  = *src++ * 8;
-            bg = *src  >> 4;
-            fg = *src++ & 0xF;
-
-            dst_char = dst + x * 8;
-            for (char_y = 0; char_y < 8; char_y++) {
-                for (mask = 0x80; mask; mask >>= 1) {
-                    *dst_char++ = ff_cga_font[c + char_y] & mask ? fg : bg;
-                }
-                dst_char += tmv->pic.linesize[0] - 8;
-            }
-        }
-        dst += tmv->pic.linesize[0] * 8;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame *)data = tmv->pic;
-    return avpkt->size;
-}
-
-static av_cold int tmv_decode_close(AVCodecContext *avctx)
-{
-    TMVContext *tmv = avctx->priv_data;
-
-    if (tmv->pic.data[0])
-        avctx->release_buffer(avctx, &tmv->pic);
-
-    return 0;
-}
-
-AVCodec tmv_decoder = {
-    .name           = "tmv",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_TMV,
-    .priv_data_size = sizeof(TMVContext),
-    .close          = tmv_decode_close,
-    .decode         = tmv_decode_frame,
-    .capabilities   = CODEC_CAP_DR1,
-    .long_name      = NULL_IF_CONFIG_SMALL("8088flex TMV"),
-};
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
deleted file mode 100644
index 4306917..0000000
--- a/libavcodec/truemotion1.c
+++ /dev/null
@@ -1,904 +0,0 @@
-/*
- * Duck TrueMotion 1.0 Decoder
- * Copyright (C) 2003 Alex Beregszaszi & Mike Melanson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Duck TrueMotion v1 Video Decoder by
- * Alex Beregszaszi and
- * Mike Melanson (melanson at pcisys.net)
- *
- * The TrueMotion v1 decoder presently only decodes 16-bit TM1 data and
- * outputs RGB555 (or RGB565) data. 24-bit TM1 data is not supported yet.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-#include "truemotion1data.h"
-
-typedef struct TrueMotion1Context {
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const uint8_t *buf;
-    int size;
-
-    const uint8_t *mb_change_bits;
-    int mb_change_bits_row_size;
-    const uint8_t *index_stream;
-    int index_stream_size;
-
-    int flags;
-    int x, y, w, h;
-
-    uint32_t y_predictor_table[1024];
-    uint32_t c_predictor_table[1024];
-    uint32_t fat_y_predictor_table[1024];
-    uint32_t fat_c_predictor_table[1024];
-
-    int compression;
-    int block_type;
-    int block_width;
-    int block_height;
-
-    int16_t ydt[8];
-    int16_t cdt[8];
-    int16_t fat_ydt[8];
-    int16_t fat_cdt[8];
-
-    int last_deltaset, last_vectable;
-
-    unsigned int *vert_pred;
-
-} TrueMotion1Context;
-
-#define FLAG_SPRITE         32
-#define FLAG_KEYFRAME       16
-#define FLAG_INTERFRAME      8
-#define FLAG_INTERPOLATED    4
-
-struct frame_header {
-    uint8_t header_size;
-    uint8_t compression;
-    uint8_t deltaset;
-    uint8_t vectable;
-    uint16_t ysize;
-    uint16_t xsize;
-    uint16_t checksum;
-    uint8_t version;
-    uint8_t header_type;
-    uint8_t flags;
-    uint8_t control;
-    uint16_t xoffset;
-    uint16_t yoffset;
-    uint16_t width;
-    uint16_t height;
-};
-
-#define ALGO_NOP        0
-#define ALGO_RGB16V     1
-#define ALGO_RGB16H     2
-#define ALGO_RGB24H     3
-
-/* these are the various block sizes that can occupy a 4x4 block */
-#define BLOCK_2x2  0
-#define BLOCK_2x4  1
-#define BLOCK_4x2  2
-#define BLOCK_4x4  3
-
-typedef struct comp_types {
-    int algorithm;
-    int block_width; // vres
-    int block_height; // hres
-    int block_type;
-} comp_types;
-
-/* { valid for metatype }, algorithm, num of deltas, vert res, horiz res */
-static const comp_types compression_types[17] = {
-    { ALGO_NOP,    0, 0, 0 },
-
-    { ALGO_RGB16V, 4, 4, BLOCK_4x4 },
-    { ALGO_RGB16H, 4, 4, BLOCK_4x4 },
-    { ALGO_RGB16V, 4, 2, BLOCK_4x2 },
-    { ALGO_RGB16H, 4, 2, BLOCK_4x2 },
-
-    { ALGO_RGB16V, 2, 4, BLOCK_2x4 },
-    { ALGO_RGB16H, 2, 4, BLOCK_2x4 },
-    { ALGO_RGB16V, 2, 2, BLOCK_2x2 },
-    { ALGO_RGB16H, 2, 2, BLOCK_2x2 },
-
-    { ALGO_NOP,    4, 4, BLOCK_4x4 },
-    { ALGO_RGB24H, 4, 4, BLOCK_4x4 },
-    { ALGO_NOP,    4, 2, BLOCK_4x2 },
-    { ALGO_RGB24H, 4, 2, BLOCK_4x2 },
-
-    { ALGO_NOP,    2, 4, BLOCK_2x4 },
-    { ALGO_RGB24H, 2, 4, BLOCK_2x4 },
-    { ALGO_NOP,    2, 2, BLOCK_2x2 },
-    { ALGO_RGB24H, 2, 2, BLOCK_2x2 }
-};
-
-static void select_delta_tables(TrueMotion1Context *s, int delta_table_index)
-{
-    int i;
-
-    if (delta_table_index > 3)
-        return;
-
-    memcpy(s->ydt, ydts[delta_table_index], 8 * sizeof(int16_t));
-    memcpy(s->cdt, cdts[delta_table_index], 8 * sizeof(int16_t));
-    memcpy(s->fat_ydt, fat_ydts[delta_table_index], 8 * sizeof(int16_t));
-    memcpy(s->fat_cdt, fat_cdts[delta_table_index], 8 * sizeof(int16_t));
-
-    /* Y skinny deltas need to be halved for some reason; maybe the
-     * skinny Y deltas should be modified */
-    for (i = 0; i < 8; i++)
-    {
-        /* drop the lsb before dividing by 2-- net effect: round down
-         * when dividing a negative number (e.g., -3/2 = -2, not -1) */
-        s->ydt[i] &= 0xFFFE;
-        s->ydt[i] /= 2;
-    }
-}
-
-#if HAVE_BIGENDIAN
-static int make_ydt15_entry(int p2, int p1, int16_t *ydt)
-#else
-static int make_ydt15_entry(int p1, int p2, int16_t *ydt)
-#endif
-{
-    int lo, hi;
-
-    lo = ydt[p1];
-    lo += (lo << 5) + (lo << 10);
-    hi = ydt[p2];
-    hi += (hi << 5) + (hi << 10);
-    return (lo + (hi << 16)) << 1;
-}
-
-#if HAVE_BIGENDIAN
-static int make_cdt15_entry(int p2, int p1, int16_t *cdt)
-#else
-static int make_cdt15_entry(int p1, int p2, int16_t *cdt)
-#endif
-{
-    int r, b, lo;
-
-    b = cdt[p2];
-    r = cdt[p1] << 10;
-    lo = b + r;
-    return (lo + (lo << 16)) << 1;
-}
-
-#if HAVE_BIGENDIAN
-static int make_ydt16_entry(int p2, int p1, int16_t *ydt)
-#else
-static int make_ydt16_entry(int p1, int p2, int16_t *ydt)
-#endif
-{
-    int lo, hi;
-
-    lo = ydt[p1];
-    lo += (lo << 6) + (lo << 11);
-    hi = ydt[p2];
-    hi += (hi << 6) + (hi << 11);
-    return (lo + (hi << 16)) << 1;
-}
-
-#if HAVE_BIGENDIAN
-static int make_cdt16_entry(int p2, int p1, int16_t *cdt)
-#else
-static int make_cdt16_entry(int p1, int p2, int16_t *cdt)
-#endif
-{
-    int r, b, lo;
-
-    b = cdt[p2];
-    r = cdt[p1] << 11;
-    lo = b + r;
-    return (lo + (lo << 16)) << 1;
-}
-
-#if HAVE_BIGENDIAN
-static int make_ydt24_entry(int p2, int p1, int16_t *ydt)
-#else
-static int make_ydt24_entry(int p1, int p2, int16_t *ydt)
-#endif
-{
-    int lo, hi;
-
-    lo = ydt[p1];
-    hi = ydt[p2];
-    return (lo + (hi << 8) + (hi << 16)) << 1;
-}
-
-#if HAVE_BIGENDIAN
-static int make_cdt24_entry(int p2, int p1, int16_t *cdt)
-#else
-static int make_cdt24_entry(int p1, int p2, int16_t *cdt)
-#endif
-{
-    int r, b;
-
-    b = cdt[p2];
-    r = cdt[p1]<<16;
-    return (b+r) << 1;
-}
-
-static void gen_vector_table15(TrueMotion1Context *s, const uint8_t *sel_vector_table)
-{
-    int len, i, j;
-    unsigned char delta_pair;
-
-    for (i = 0; i < 1024; i += 4)
-    {
-        len = *sel_vector_table++ / 2;
-        for (j = 0; j < len; j++)
-        {
-            delta_pair = *sel_vector_table++;
-            s->y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt15_entry(delta_pair >> 4, delta_pair & 0xf, s->ydt);
-            s->c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt15_entry(delta_pair >> 4, delta_pair & 0xf, s->cdt);
-        }
-        s->y_predictor_table[i+(j-1)] |= 1;
-        s->c_predictor_table[i+(j-1)] |= 1;
-    }
-}
-
-static void gen_vector_table16(TrueMotion1Context *s, const uint8_t *sel_vector_table)
-{
-    int len, i, j;
-    unsigned char delta_pair;
-
-    for (i = 0; i < 1024; i += 4)
-    {
-        len = *sel_vector_table++ / 2;
-        for (j = 0; j < len; j++)
-        {
-            delta_pair = *sel_vector_table++;
-            s->y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt16_entry(delta_pair >> 4, delta_pair & 0xf, s->ydt);
-            s->c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt16_entry(delta_pair >> 4, delta_pair & 0xf, s->cdt);
-        }
-        s->y_predictor_table[i+(j-1)] |= 1;
-        s->c_predictor_table[i+(j-1)] |= 1;
-    }
-}
-
-static void gen_vector_table24(TrueMotion1Context *s, const uint8_t *sel_vector_table)
-{
-    int len, i, j;
-    unsigned char delta_pair;
-
-    for (i = 0; i < 1024; i += 4)
-    {
-        len = *sel_vector_table++ / 2;
-        for (j = 0; j < len; j++)
-        {
-            delta_pair = *sel_vector_table++;
-            s->y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt24_entry(delta_pair >> 4, delta_pair & 0xf, s->ydt);
-            s->c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt24_entry(delta_pair >> 4, delta_pair & 0xf, s->cdt);
-            s->fat_y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt24_entry(delta_pair >> 4, delta_pair & 0xf, s->fat_ydt);
-            s->fat_c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt24_entry(delta_pair >> 4, delta_pair & 0xf, s->fat_cdt);
-        }
-        s->y_predictor_table[i+(j-1)] |= 1;
-        s->c_predictor_table[i+(j-1)] |= 1;
-        s->fat_y_predictor_table[i+(j-1)] |= 1;
-        s->fat_c_predictor_table[i+(j-1)] |= 1;
-    }
-}
-
-/* Returns the number of bytes consumed from the bytestream. Returns -1 if
- * there was an error while decoding the header */
-static int truemotion1_decode_header(TrueMotion1Context *s)
-{
-    int i;
-    struct frame_header header;
-    uint8_t header_buffer[128];  /* logical maximum size of the header */
-    const uint8_t *sel_vector_table;
-
-    /* There is 1 change bit per 4 pixels, so each change byte represents
-     * 32 pixels; divide width by 4 to obtain the number of change bits and
-     * then round up to the nearest byte. */
-    s->mb_change_bits_row_size = ((s->avctx->width >> 2) + 7) >> 3;
-
-    header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
-    if (s->buf[0] < 0x10)
-    {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]);
-        return -1;
-    }
-
-    /* unscramble the header bytes with a XOR operation */
-    memset(header_buffer, 0, 128);
-    for (i = 1; i < header.header_size; i++)
-        header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];
-
-    header.compression = header_buffer[0];
-    header.deltaset = header_buffer[1];
-    header.vectable = header_buffer[2];
-    header.ysize = AV_RL16(&header_buffer[3]);
-    header.xsize = AV_RL16(&header_buffer[5]);
-    header.checksum = AV_RL16(&header_buffer[7]);
-    header.version = header_buffer[9];
-    header.header_type = header_buffer[10];
-    header.flags = header_buffer[11];
-    header.control = header_buffer[12];
-
-    /* Version 2 */
-    if (header.version >= 2)
-    {
-        if (header.header_type > 3)
-        {
-            av_log(s->avctx, AV_LOG_ERROR, "invalid header type (%d)\n", header.header_type);
-            return -1;
-        } else if ((header.header_type == 2) || (header.header_type == 3)) {
-            s->flags = header.flags;
-            if (!(s->flags & FLAG_INTERFRAME))
-                s->flags |= FLAG_KEYFRAME;
-        } else
-            s->flags = FLAG_KEYFRAME;
-    } else /* Version 1 */
-        s->flags = FLAG_KEYFRAME;
-
-    if (s->flags & FLAG_SPRITE) {
-        av_log(s->avctx, AV_LOG_INFO, "SPRITE frame found, please report the sample to the developers\n");
-        /* FIXME header.width, height, xoffset and yoffset aren't initialized */
-#if 0
-        s->w = header.width;
-        s->h = header.height;
-        s->x = header.xoffset;
-        s->y = header.yoffset;
-#else
-        return -1;
-#endif
-    } else {
-        s->w = header.xsize;
-        s->h = header.ysize;
-        if (header.header_type < 2) {
-            if ((s->w < 213) && (s->h >= 176))
-            {
-                s->flags |= FLAG_INTERPOLATED;
-                av_log(s->avctx, AV_LOG_INFO, "INTERPOLATION selected, please report the sample to the developers\n");
-            }
-        }
-    }
-
-    if (header.compression >= 17) {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression);
-        return -1;
-    }
-
-    if ((header.deltaset != s->last_deltaset) ||
-        (header.vectable != s->last_vectable))
-        select_delta_tables(s, header.deltaset);
-
-    if ((header.compression & 1) && header.header_type)
-        sel_vector_table = pc_tbl2;
-    else {
-        if (header.vectable < 4)
-            sel_vector_table = tables[header.vectable - 1];
-        else {
-            av_log(s->avctx, AV_LOG_ERROR, "invalid vector table id (%d)\n", header.vectable);
-            return -1;
-        }
-    }
-
-    // FIXME: where to place this ?!?!
-    if (compression_types[header.compression].algorithm == ALGO_RGB24H)
-        s->avctx->pix_fmt = PIX_FMT_RGB32;
-    else
-        s->avctx->pix_fmt = PIX_FMT_RGB555; // RGB565 is supported as well
-
-    if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable))
-    {
-        if (compression_types[header.compression].algorithm == ALGO_RGB24H)
-            gen_vector_table24(s, sel_vector_table);
-        else
-        if (s->avctx->pix_fmt == PIX_FMT_RGB555)
-            gen_vector_table15(s, sel_vector_table);
-        else
-            gen_vector_table16(s, sel_vector_table);
-    }
-
-    /* set up pointers to the other key data chunks */
-    s->mb_change_bits = s->buf + header.header_size;
-    if (s->flags & FLAG_KEYFRAME) {
-        /* no change bits specified for a keyframe; only index bytes */
-        s->index_stream = s->mb_change_bits;
-    } else {
-        /* one change bit per 4x4 block */
-        s->index_stream = s->mb_change_bits +
-            (s->mb_change_bits_row_size * (s->avctx->height >> 2));
-    }
-    s->index_stream_size = s->size - (s->index_stream - s->buf);
-
-    s->last_deltaset = header.deltaset;
-    s->last_vectable = header.vectable;
-    s->compression = header.compression;
-    s->block_width = compression_types[header.compression].block_width;
-    s->block_height = compression_types[header.compression].block_height;
-    s->block_type = compression_types[header.compression].block_type;
-
-    if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n",
-            s->last_deltaset, s->last_vectable, s->compression, s->block_width,
-            s->block_height, s->block_type,
-            s->flags & FLAG_KEYFRAME ? " KEY" : "",
-            s->flags & FLAG_INTERFRAME ? " INTER" : "",
-            s->flags & FLAG_SPRITE ? " SPRITE" : "",
-            s->flags & FLAG_INTERPOLATED ? " INTERPOL" : "");
-
-    return header.header_size;
-}
-
-static av_cold int truemotion1_decode_init(AVCodecContext *avctx)
-{
-    TrueMotion1Context *s = avctx->priv_data;
-
-    s->avctx = avctx;
-
-    // FIXME: it may change ?
-//    if (avctx->bits_per_sample == 24)
-//        avctx->pix_fmt = PIX_FMT_RGB24;
-//    else
-//        avctx->pix_fmt = PIX_FMT_RGB555;
-
-    s->frame.data[0] = NULL;
-
-    /* there is a vertical predictor for each pixel in a line; each vertical
-     * predictor is 0 to start with */
-    s->vert_pred =
-        (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned int));
-
-    return 0;
-}
-
-/*
-Block decoding order:
-
-dxi: Y-Y
-dxic: Y-C-Y
-dxic2: Y-C-Y-C
-
-hres,vres,i,i%vres (0 < i < 4)
-2x2 0: 0 dxic2
-2x2 1: 1 dxi
-2x2 2: 0 dxic2
-2x2 3: 1 dxi
-2x4 0: 0 dxic2
-2x4 1: 1 dxi
-2x4 2: 2 dxi
-2x4 3: 3 dxi
-4x2 0: 0 dxic
-4x2 1: 1 dxi
-4x2 2: 0 dxic
-4x2 3: 1 dxi
-4x4 0: 0 dxic
-4x4 1: 1 dxi
-4x4 2: 2 dxi
-4x4 3: 3 dxi
-*/
-
-#define GET_NEXT_INDEX() \
-{\
-    if (index_stream_index >= s->index_stream_size) { \
-        av_log(s->avctx, AV_LOG_INFO, " help! truemotion1 decoder went out of bounds\n"); \
-        return; \
-    } \
-    index = s->index_stream[index_stream_index++] * 4; \
-}
-
-#define APPLY_C_PREDICTOR() \
-    predictor_pair = s->c_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->c_predictor_table[index]; \
-            horiz_pred += ((predictor_pair >> 1) * 5); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-#define APPLY_C_PREDICTOR_24() \
-    predictor_pair = s->c_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->fat_c_predictor_table[index]; \
-            horiz_pred += (predictor_pair >> 1); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-
-#define APPLY_Y_PREDICTOR() \
-    predictor_pair = s->y_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->y_predictor_table[index]; \
-            horiz_pred += ((predictor_pair >> 1) * 5); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-#define APPLY_Y_PREDICTOR_24() \
-    predictor_pair = s->y_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->fat_y_predictor_table[index]; \
-            horiz_pred += (predictor_pair >> 1); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-#define OUTPUT_PIXEL_PAIR() \
-    *current_pixel_pair = *vert_pred + horiz_pred; \
-    *vert_pred++ = *current_pixel_pair++;
-
-static void truemotion1_decode_16bit(TrueMotion1Context *s)
-{
-    int y;
-    int pixels_left;  /* remaining pixels on this line */
-    unsigned int predictor_pair;
-    unsigned int horiz_pred;
-    unsigned int *vert_pred;
-    unsigned int *current_pixel_pair;
-    unsigned char *current_line = s->frame.data[0];
-    int keyframe = s->flags & FLAG_KEYFRAME;
-
-    /* these variables are for managing the stream of macroblock change bits */
-    const unsigned char *mb_change_bits = s->mb_change_bits;
-    unsigned char mb_change_byte;
-    unsigned char mb_change_byte_mask;
-    int mb_change_index;
-
-    /* these variables are for managing the main index stream */
-    int index_stream_index = 0;  /* yes, the index into the index stream */
-    int index;
-
-    /* clean out the line buffer */
-    memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
-
-    GET_NEXT_INDEX();
-
-    for (y = 0; y < s->avctx->height; y++) {
-
-        /* re-init variables for the next line iteration */
-        horiz_pred = 0;
-        current_pixel_pair = (unsigned int *)current_line;
-        vert_pred = s->vert_pred;
-        mb_change_index = 0;
-        mb_change_byte = mb_change_bits[mb_change_index++];
-        mb_change_byte_mask = 0x01;
-        pixels_left = s->avctx->width;
-
-        while (pixels_left > 0) {
-
-            if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
-
-                switch (y & 3) {
-                case 0:
-                    /* if macroblock width is 2, apply C-Y-C-Y; else
-                     * apply C-Y-Y */
-                    if (s->block_width == 2) {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-
-                case 1:
-                case 3:
-                    /* always apply 2 Y predictors on these iterations */
-                    APPLY_Y_PREDICTOR();
-                    OUTPUT_PIXEL_PAIR();
-                    APPLY_Y_PREDICTOR();
-                    OUTPUT_PIXEL_PAIR();
-                    break;
-
-                case 2:
-                    /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
-                     * depending on the macroblock type */
-                    if (s->block_type == BLOCK_2x2) {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    } else if (s->block_type == BLOCK_4x2) {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-                }
-
-            } else {
-
-                /* skip (copy) four pixels, but reassign the horizontal
-                 * predictor */
-                *vert_pred++ = *current_pixel_pair++;
-                horiz_pred = *current_pixel_pair - *vert_pred;
-                *vert_pred++ = *current_pixel_pair++;
-
-            }
-
-            if (!keyframe) {
-                mb_change_byte_mask <<= 1;
-
-                /* next byte */
-                if (!mb_change_byte_mask) {
-                    mb_change_byte = mb_change_bits[mb_change_index++];
-                    mb_change_byte_mask = 0x01;
-                }
-            }
-
-            pixels_left -= 4;
-        }
-
-        /* next change row */
-        if (((y + 1) & 3) == 0)
-            mb_change_bits += s->mb_change_bits_row_size;
-
-        current_line += s->frame.linesize[0];
-    }
-}
-
-static void truemotion1_decode_24bit(TrueMotion1Context *s)
-{
-    int y;
-    int pixels_left;  /* remaining pixels on this line */
-    unsigned int predictor_pair;
-    unsigned int horiz_pred;
-    unsigned int *vert_pred;
-    unsigned int *current_pixel_pair;
-    unsigned char *current_line = s->frame.data[0];
-    int keyframe = s->flags & FLAG_KEYFRAME;
-
-    /* these variables are for managing the stream of macroblock change bits */
-    const unsigned char *mb_change_bits = s->mb_change_bits;
-    unsigned char mb_change_byte;
-    unsigned char mb_change_byte_mask;
-    int mb_change_index;
-
-    /* these variables are for managing the main index stream */
-    int index_stream_index = 0;  /* yes, the index into the index stream */
-    int index;
-
-    /* clean out the line buffer */
-    memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
-
-    GET_NEXT_INDEX();
-
-    for (y = 0; y < s->avctx->height; y++) {
-
-        /* re-init variables for the next line iteration */
-        horiz_pred = 0;
-        current_pixel_pair = (unsigned int *)current_line;
-        vert_pred = s->vert_pred;
-        mb_change_index = 0;
-        mb_change_byte = mb_change_bits[mb_change_index++];
-        mb_change_byte_mask = 0x01;
-        pixels_left = s->avctx->width;
-
-        while (pixels_left > 0) {
-
-            if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
-
-                switch (y & 3) {
-                case 0:
-                    /* if macroblock width is 2, apply C-Y-C-Y; else
-                     * apply C-Y-Y */
-                    if (s->block_width == 2) {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-
-                case 1:
-                case 3:
-                    /* always apply 2 Y predictors on these iterations */
-                    APPLY_Y_PREDICTOR_24();
-                    OUTPUT_PIXEL_PAIR();
-                    APPLY_Y_PREDICTOR_24();
-                    OUTPUT_PIXEL_PAIR();
-                    break;
-
-                case 2:
-                    /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
-                     * depending on the macroblock type */
-                    if (s->block_type == BLOCK_2x2) {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    } else if (s->block_type == BLOCK_4x2) {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-                }
-
-            } else {
-
-                /* skip (copy) four pixels, but reassign the horizontal
-                 * predictor */
-                *vert_pred++ = *current_pixel_pair++;
-                horiz_pred = *current_pixel_pair - *vert_pred;
-                *vert_pred++ = *current_pixel_pair++;
-
-            }
-
-            if (!keyframe) {
-                mb_change_byte_mask <<= 1;
-
-                /* next byte */
-                if (!mb_change_byte_mask) {
-                    mb_change_byte = mb_change_bits[mb_change_index++];
-                    mb_change_byte_mask = 0x01;
-                }
-            }
-
-            pixels_left -= 4;
-        }
-
-        /* next change row */
-        if (((y + 1) & 3) == 0)
-            mb_change_bits += s->mb_change_bits_row_size;
-
-        current_line += s->frame.linesize[0];
-    }
-}
-
-
-static int truemotion1_decode_frame(AVCodecContext *avctx,
-                                    void *data, int *data_size,
-                                    AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TrueMotion1Context *s = avctx->priv_data;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    if (truemotion1_decode_header(s) == -1)
-        return -1;
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
-        FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &s->frame) < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
-        truemotion1_decode_24bit(s);
-    } else if (compression_types[s->compression].algorithm != ALGO_NOP) {
-        truemotion1_decode_16bit(s);
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int truemotion1_decode_end(AVCodecContext *avctx)
-{
-    TrueMotion1Context *s = avctx->priv_data;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    av_free(s->vert_pred);
-
-    return 0;
-}
-
-AVCodec truemotion1_decoder = {
-    "truemotion1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TRUEMOTION1,
-    sizeof(TrueMotion1Context),
-    truemotion1_decode_init,
-    NULL,
-    truemotion1_decode_end,
-    truemotion1_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 1.0"),
-};
diff --git a/libavcodec/truemotion1data.h b/libavcodec/truemotion1data.h
deleted file mode 100644
index 6a9822a..0000000
--- a/libavcodec/truemotion1data.h
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * Duck Truemotion v1 Decoding Tables
- *
- * Data in this file was originally part of VpVision from On2 which is
- * distributed under the GNU GPL. It is redistributed with ffmpeg under the
- * GNU LGPL using the common understanding that data tables necessary for
- * decoding algorithms are not necessarily licensable.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVCODEC_TRUEMOTION1DATA_H
-#define AVCODEC_TRUEMOTION1DATA_H
-
-#include <stdint.h>
-#include <stdlib.h>
-
-/* Y delta tables, skinny and fat */
-static const int16_t ydt1[8] = { 0, -2, 2, -6, 6, -12, 12, -12 };
-static const int16_t ydt2[8] = { 0, -2, 4, -6, 8, -12, 12, -12 };
-static const int16_t ydt3[8] = { 4, -6, 20, -20, 46, -46, 94, -94 };
-static const int16_t fat_ydt3[8] = { 0, -15, 50, -50, 115, -115, 235, -235 };
-static const int16_t ydt4[8] = { 0, -4, 4, -16, 16, -36, 36, -80 };
-/* NOTE: This table breaks the [+,-] pattern that the rest of the
- * tables maintain. Is this intentional? */
-static const int16_t fat_ydt4[8] = { 0, 40, 80, -76, 160, -154, 236, -236 };
-
-/* C delta tables, skinny and fat */
-static const int16_t cdt1[8] = { 0, -1, 1, -2, 3, -4, 5, -4 };
-static const int16_t cdt2[8] = { 0, -4, 3, -16, 20, -32, 36, -32 };
-static const int16_t fat_cdt2[8] = { 0, -20, 15, -80, 100, -160, 180, -160 };
-static const int16_t cdt3[8] = { 0, -2, 2, -8, 8, -18, 18, -40 };
-
-/* all the delta tables to choose from, at all 4 delta levels */
-static const int16_t * const ydts[] = { ydt1, ydt2, ydt3, ydt4, NULL };
-static const int16_t * const fat_ydts[] = { fat_ydt3, fat_ydt3, fat_ydt3, fat_ydt4, NULL };
-static const int16_t * const cdts[] = { cdt1, cdt1, cdt2, cdt3, NULL };
-static const int16_t * const fat_cdts[] = { fat_cdt2, fat_cdt2, fat_cdt2, fat_ydt4, NULL };
-
-static const uint8_t pc_tbl2[] = {
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x10,0x00,0x00,0x00,
-0x8,0x01,0x00,0x00,0x00,
-0x8,0x00,0x10,0x00,0x00,
-0x8,0x00,0x01,0x00,0x00,
-0x8,0x00,0x00,0x10,0x00,
-0x8,0x00,0x00,0x01,0x00,
-0x8,0x00,0x00,0x00,0x10,
-0x8,0x00,0x00,0x00,0x01,
-0x6,0x00,0x00,0x00,
-0x6,0x10,0x00,0x00,
-0x6,0x01,0x00,0x00,
-0x6,0x00,0x10,0x00,
-0x6,0x00,0x01,0x00,
-0x6,0x00,0x00,0x01,
-0x6,0x00,0x00,0x10,
-0x6,0x00,0x00,0x02,
-0x6,0x00,0x00,0x20,
-0x6,0x20,0x10,0x00,
-0x6,0x00,0x02,0x01,
-0x6,0x00,0x20,0x10,
-0x6,0x02,0x01,0x00,
-0x6,0x11,0x00,0x00,
-0x6,0x00,0x20,0x00,
-0x6,0x00,0x02,0x00,
-0x6,0x20,0x00,0x00,
-0x6,0x01,0x10,0x00,
-0x6,0x02,0x00,0x00,
-0x6,0x01,0x00,0x02,
-0x6,0x10,0x00,0x20,
-0x6,0x00,0x01,0x02,
-0x6,0x10,0x01,0x00,
-0x6,0x00,0x10,0x20,
-0x6,0x10,0x10,0x00,
-0x6,0x10,0x00,0x01,
-0x6,0x20,0x00,0x10,
-0x6,0x02,0x00,0x01,
-0x6,0x01,0x01,0x00,
-0x6,0x01,0x00,0x10,
-0x6,0x00,0x11,0x00,
-0x6,0x10,0x00,0x02,
-0x6,0x00,0x01,0x10,
-0x6,0x00,0x00,0x11,
-0x6,0x10,0x00,0x10,
-0x6,0x01,0x00,0x01,
-0x6,0x00,0x00,0x22,
-0x6,0x02,0x01,0x01,
-0x6,0x10,0x20,0x10,
-0x6,0x01,0x02,0x01,
-0x6,0x20,0x10,0x10,
-0x6,0x01,0x00,0x20,
-0x6,0x00,0x10,0x01,
-0x6,0x21,0x10,0x00,
-0x6,0x10,0x02,0x01,
-0x6,0x12,0x01,0x00,
-0x6,0x01,0x20,0x10,
-0x6,0x01,0x02,0x00,
-0x6,0x10,0x20,0x00,
-0x6,0x00,0x10,0x02,
-0x6,0x00,0x01,0x20,
-0x6,0x00,0x02,0x21,
-0x6,0x00,0x02,0x20,
-0x6,0x00,0x00,0x12,
-0x6,0x00,0x00,0x21,
-0x6,0x20,0x11,0x00,
-0x6,0x00,0x01,0x01,
-0x6,0x11,0x10,0x00,
-0x6,0x00,0x20,0x12,
-0x6,0x00,0x20,0x11,
-0x6,0x20,0x10,0x02,
-0x6,0x02,0x01,0x20,
-0x6,0x00,0x22,0x11,
-0x6,0x00,0x10,0x10,
-0x6,0x02,0x11,0x00,
-0x6,0x00,0x21,0x10,
-0x6,0x00,0x02,0x03,
-0x6,0x20,0x10,0x01,
-0x6,0x00,0x12,0x01,
-0x4,0x11,0x00,
-0x4,0x00,0x22,
-0x4,0x20,0x00,
-0x4,0x01,0x10,
-0x4,0x02,0x20,
-0x4,0x00,0x20,
-0x4,0x02,0x00,
-0x4,0x10,0x01,
-0x4,0x00,0x11,
-0x4,0x02,0x01,
-0x4,0x02,0x21,
-0x4,0x00,0x02,
-0x4,0x20,0x02,
-0x4,0x01,0x01,
-0x4,0x10,0x10,
-0x4,0x10,0x02,
-0x4,0x22,0x00,
-0x4,0x10,0x00,
-0x4,0x01,0x00,
-0x4,0x21,0x00,
-0x4,0x12,0x00,
-0x4,0x00,0x10,
-0x4,0x20,0x12,
-0x4,0x01,0x11,
-0x4,0x00,0x01,
-0x4,0x01,0x02,
-0x4,0x11,0x02,
-0x4,0x11,0x01,
-0x4,0x10,0x20,
-0x4,0x20,0x01,
-0x4,0x22,0x11,
-0x4,0x00,0x12,
-0x4,0x20,0x10,
-0x4,0x22,0x01,
-0x4,0x01,0x20,
-0x4,0x00,0x21,
-0x4,0x10,0x11,
-0x4,0x21,0x10,
-0x4,0x10,0x22,
-0x4,0x02,0x03,
-0x4,0x12,0x01,
-0x4,0x20,0x11,
-0x4,0x11,0x10,
-0x4,0x20,0x30,
-0x4,0x11,0x20,
-0x4,0x02,0x10,
-0x4,0x22,0x10,
-0x4,0x11,0x11,
-0x4,0x30,0x20,
-0x4,0x30,0x00,
-0x4,0x01,0x22,
-0x4,0x01,0x12,
-0x4,0x02,0x11,
-0x4,0x03,0x02,
-0x4,0x03,0x00,
-0x4,0x10,0x21,
-0x4,0x12,0x20,
-0x4,0x00,0x00,
-0x4,0x12,0x21,
-0x4,0x21,0x11,
-0x4,0x02,0x22,
-0x4,0x10,0x12,
-0x4,0x31,0x00,
-0x4,0x20,0x20,
-0x4,0x00,0x03,
-0x4,0x02,0x02,
-0x4,0x22,0x20,
-0x4,0x01,0x21,
-0x4,0x21,0x02,
-0x4,0x21,0x12,
-0x4,0x11,0x22,
-0x4,0x00,0x30,
-0x4,0x12,0x11,
-0x4,0x20,0x22,
-0x4,0x31,0x20,
-0x4,0x21,0x30,
-0x4,0x22,0x02,
-0x4,0x22,0x22,
-0x4,0x20,0x31,
-0x4,0x13,0x02,
-0x4,0x03,0x10,
-0x4,0x11,0x12,
-0x4,0x00,0x13,
-0x4,0x21,0x01,
-0x4,0x12,0x03,
-0x4,0x13,0x00,
-0x4,0x13,0x10,
-0x4,0x02,0x13,
-0x4,0x30,0x01,
-0x4,0x12,0x10,
-0x4,0x22,0x13,
-0x4,0x03,0x12,
-0x4,0x31,0x01,
-0x4,0x30,0x22,
-0x4,0x00,0x31,
-0x4,0x01,0x31,
-0x4,0x02,0x23,
-0x4,0x01,0x30,
-0x4,0x11,0x21,
-0x4,0x22,0x21,
-0x4,0x01,0x13,
-0x4,0x10,0x03,
-0x4,0x22,0x03,
-0x4,0x30,0x21,
-0x4,0x21,0x31,
-0x4,0x33,0x00,
-0x4,0x13,0x12,
-0x4,0x11,0x31,
-0x4,0x30,0x02,
-0x4,0x12,0x02,
-0x4,0x11,0x13,
-0x4,0x12,0x22,
-0x4,0x20,0x32,
-0x4,0x10,0x13,
-0x4,0x22,0x31,
-0x4,0x21,0x20,
-0x4,0x01,0x33,
-0x4,0x33,0x10,
-0x4,0x20,0x13,
-0x4,0x31,0x22,
-0x4,0x13,0x30,
-0x4,0x01,0x03,
-0x4,0x11,0x33,
-0x4,0x20,0x21,
-0x4,0x13,0x31,
-0x4,0x03,0x22,
-0x4,0x31,0x02,
-0x4,0x00,0x24,
-0x2,0x00,
-0x2,0x10,
-0x2,0x20,
-0x2,0x30,
-0x2,0x40,
-0x2,0x50,
-0x2,0x60,
-0x2,0x01,
-0x2,0x11,
-0x2,0x21,
-0x2,0x31,
-0x2,0x41,
-0x2,0x51,
-0x2,0x61,
-0x2,0x02,
-0x2,0x12,
-0x2,0x22,
-0x2,0x32,
-0x2,0x42,
-0x2,0x52,
-0x2,0x62,
-0x2,0x03,
-0x2,0x13,
-0x2,0x23,
-0x2,0x33,
-0x2,0x43,
-0x2,0x53,
-0x2,0x63,
-0x2,0x04,
-0x2,0x14,
-0x2,0x24,
-0x2,0x34,
-0x2,0x44,
-0x2,0x54,
-0x2,0x64,
-0x2,0x05,
-0x2,0x15,
-0x2,0x25,
-0x2,0x35,
-0x2,0x45,
-0x2,0x55,
-0x2,0x65,
-0x2,0x06,
-0x2,0x16,
-0x2,0x26,
-0x2,0x36,
-0x2,0x46,
-0x2,0x56,
-0x2,0x66
-};
-
-static const uint8_t pc_tbl3[] = {
-0x6,0x00,0x00,0x00,
-0x6,0x00,0x00,0x00,
-0x6,0x00,0x00,0x01,
-0x6,0x00,0x00,0x10,
-0x6,0x00,0x00,0x11,
-0x6,0x00,0x01,0x00,
-0x6,0x00,0x01,0x01,
-0x6,0x00,0x01,0x10,
-0x6,0x00,0x01,0x11,
-0x6,0x00,0x10,0x00,
-0x6,0x00,0x10,0x01,
-0x6,0x00,0x10,0x10,
-0x6,0x00,0x10,0x11,
-0x6,0x00,0x11,0x00,
-0x6,0x00,0x11,0x01,
-0x6,0x00,0x11,0x10,
-0x6,0x00,0x11,0x11,
-0x6,0x01,0x00,0x00,
-0x6,0x01,0x00,0x01,
-0x6,0x01,0x00,0x10,
-0x6,0x01,0x00,0x11,
-0x6,0x01,0x01,0x00,
-0x6,0x01,0x01,0x01,
-0x6,0x01,0x01,0x10,
-0x6,0x01,0x01,0x11,
-0x6,0x01,0x10,0x00,
-0x6,0x01,0x10,0x01,
-0x6,0x01,0x10,0x10,
-0x6,0x01,0x10,0x11,
-0x6,0x01,0x11,0x00,
-0x6,0x01,0x11,0x01,
-0x6,0x01,0x11,0x10,
-0x6,0x01,0x11,0x11,
-0x6,0x10,0x00,0x00,
-0x6,0x10,0x00,0x01,
-0x6,0x10,0x00,0x10,
-0x6,0x10,0x00,0x11,
-0x6,0x10,0x01,0x00,
-0x6,0x10,0x01,0x01,
-0x6,0x10,0x01,0x10,
-0x6,0x10,0x01,0x11,
-0x6,0x10,0x10,0x00,
-0x6,0x10,0x10,0x01,
-0x6,0x10,0x10,0x10,
-0x6,0x10,0x10,0x11,
-0x6,0x10,0x11,0x00,
-0x6,0x10,0x11,0x01,
-0x6,0x10,0x11,0x10,
-0x6,0x10,0x11,0x11,
-0x6,0x11,0x00,0x00,
-0x6,0x11,0x00,0x01,
-0x6,0x11,0x00,0x10,
-0x6,0x11,0x00,0x11,
-0x6,0x11,0x01,0x00,
-0x6,0x11,0x01,0x01,
-0x6,0x11,0x01,0x10,
-0x6,0x11,0x01,0x11,
-0x6,0x11,0x10,0x00,
-0x6,0x11,0x10,0x01,
-0x6,0x11,0x10,0x10,
-0x6,0x11,0x10,0x11,
-0x6,0x11,0x11,0x00,
-0x6,0x11,0x11,0x01,
-0x6,0x11,0x11,0x10,
-0x4,0x00,0x00,
-0x4,0x00,0x01,
-0x4,0x00,0x02,
-0x4,0x00,0x03,
-0x4,0x00,0x10,
-0x4,0x00,0x11,
-0x4,0x00,0x12,
-0x4,0x00,0x13,
-0x4,0x00,0x20,
-0x4,0x00,0x21,
-0x4,0x00,0x22,
-0x4,0x00,0x23,
-0x4,0x00,0x30,
-0x4,0x00,0x31,
-0x4,0x00,0x32,
-0x4,0x00,0x33,
-0x4,0x01,0x00,
-0x4,0x01,0x01,
-0x4,0x01,0x02,
-0x4,0x01,0x03,
-0x4,0x01,0x10,
-0x4,0x01,0x11,
-0x4,0x01,0x12,
-0x4,0x01,0x13,
-0x4,0x01,0x20,
-0x4,0x01,0x21,
-0x4,0x01,0x22,
-0x4,0x01,0x23,
-0x4,0x01,0x30,
-0x4,0x01,0x31,
-0x4,0x01,0x32,
-0x4,0x01,0x33,
-0x4,0x02,0x00,
-0x4,0x02,0x01,
-0x4,0x02,0x02,
-0x4,0x02,0x03,
-0x4,0x02,0x10,
-0x4,0x02,0x11,
-0x4,0x02,0x12,
-0x4,0x02,0x13,
-0x4,0x02,0x20,
-0x4,0x02,0x21,
-0x4,0x02,0x22,
-0x4,0x02,0x23,
-0x4,0x02,0x30,
-0x4,0x02,0x31,
-0x4,0x02,0x32,
-0x4,0x02,0x33,
-0x4,0x03,0x00,
-0x4,0x03,0x01,
-0x4,0x03,0x02,
-0x4,0x03,0x03,
-0x4,0x03,0x10,
-0x4,0x03,0x11,
-0x4,0x03,0x12,
-0x4,0x03,0x13,
-0x4,0x03,0x20,
-0x4,0x03,0x21,
-0x4,0x03,0x22,
-0x4,0x03,0x23,
-0x4,0x03,0x30,
-0x4,0x03,0x31,
-0x4,0x03,0x32,
-0x4,0x03,0x33,
-0x4,0x10,0x00,
-0x4,0x10,0x01,
-0x4,0x10,0x02,
-0x4,0x10,0x03,
-0x4,0x10,0x10,
-0x4,0x10,0x11,
-0x4,0x10,0x12,
-0x4,0x10,0x13,
-0x4,0x10,0x20,
-0x4,0x10,0x21,
-0x4,0x10,0x22,
-0x4,0x10,0x23,
-0x4,0x10,0x30,
-0x4,0x10,0x31,
-0x4,0x10,0x32,
-0x4,0x10,0x33,
-0x4,0x11,0x00,
-0x4,0x11,0x01,
-0x4,0x11,0x02,
-0x4,0x11,0x03,
-0x4,0x11,0x10,
-0x4,0x11,0x11,
-0x4,0x11,0x12,
-0x4,0x11,0x13,
-0x4,0x11,0x20,
-0x4,0x11,0x21,
-0x4,0x11,0x22,
-0x4,0x11,0x23,
-0x4,0x11,0x30,
-0x4,0x11,0x31,
-0x4,0x11,0x32,
-0x4,0x11,0x33,
-0x4,0x12,0x00,
-0x4,0x12,0x01,
-0x4,0x12,0x02,
-0x4,0x12,0x03,
-0x4,0x12,0x10,
-0x4,0x12,0x11,
-0x4,0x12,0x12,
-0x4,0x12,0x13,
-0x4,0x12,0x20,
-0x4,0x12,0x21,
-0x4,0x12,0x22,
-0x4,0x12,0x23,
-0x4,0x12,0x30,
-0x4,0x12,0x31,
-0x4,0x12,0x32,
-0x4,0x12,0x33,
-0x4,0x13,0x00,
-0x4,0x13,0x01,
-0x4,0x13,0x02,
-0x4,0x13,0x03,
-0x4,0x13,0x10,
-0x4,0x13,0x11,
-0x4,0x13,0x12,
-0x4,0x13,0x13,
-0x4,0x13,0x20,
-0x4,0x13,0x21,
-0x4,0x13,0x22,
-0x4,0x13,0x23,
-0x4,0x13,0x30,
-0x4,0x13,0x31,
-0x4,0x13,0x32,
-0x4,0x13,0x33,
-0x2,0x00,
-0x2,0x10,
-0x2,0x20,
-0x2,0x30,
-0x2,0x40,
-0x2,0x50,
-0x2,0x60,
-0x2,0x70,
-0x2,0x01,
-0x2,0x11,
-0x2,0x21,
-0x2,0x31,
-0x2,0x41,
-0x2,0x51,
-0x2,0x61,
-0x2,0x71,
-0x2,0x02,
-0x2,0x12,
-0x2,0x22,
-0x2,0x32,
-0x2,0x42,
-0x2,0x52,
-0x2,0x62,
-0x2,0x72,
-0x2,0x03,
-0x2,0x13,
-0x2,0x23,
-0x2,0x33,
-0x2,0x43,
-0x2,0x53,
-0x2,0x63,
-0x2,0x73,
-0x2,0x04,
-0x2,0x14,
-0x2,0x24,
-0x2,0x34,
-0x2,0x44,
-0x2,0x54,
-0x2,0x64,
-0x2,0x74,
-0x2,0x05,
-0x2,0x15,
-0x2,0x25,
-0x2,0x35,
-0x2,0x45,
-0x2,0x55,
-0x2,0x65,
-0x2,0x75,
-0x2,0x06,
-0x2,0x16,
-0x2,0x26,
-0x2,0x36,
-0x2,0x46,
-0x2,0x56,
-0x2,0x66,
-0x2,0x76,
-0x2,0x07,
-0x2,0x17,
-0x2,0x27,
-0x2,0x37,
-0x2,0x47,
-0x2,0x57,
-0x2,0x67,
-0x2,0x77
-};
-
-static const uint8_t pc_tbl4[] = {
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x20,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x01,
-0x8,0x10,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x02,
-0x8,0x01,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x10,
-0x8,0x02,0x00,0x00,0x00,
-0x6,0x00,0x00,0x00,
-0x6,0x20,0x00,0x00,
-0x6,0x00,0x00,0x01,
-0x6,0x10,0x00,0x00,
-0x6,0x00,0x00,0x02,
-0x6,0x00,0x10,0x00,
-0x6,0x00,0x20,0x00,
-0x6,0x00,0x02,0x00,
-0x6,0x00,0x01,0x00,
-0x6,0x01,0x00,0x00,
-0x6,0x00,0x00,0x20,
-0x6,0x02,0x00,0x00,
-0x6,0x00,0x00,0x10,
-0x6,0x10,0x00,0x20,
-0x6,0x01,0x00,0x02,
-0x6,0x20,0x00,0x10,
-0x6,0x02,0x00,0x01,
-0x6,0x20,0x10,0x00,
-0x6,0x00,0x12,0x00,
-0x6,0x00,0x02,0x01,
-0x6,0x02,0x01,0x00,
-0x6,0x00,0x21,0x00,
-0x6,0x00,0x01,0x02,
-0x6,0x00,0x20,0x10,
-0x6,0x00,0x00,0x21,
-0x6,0x00,0x00,0x12,
-0x6,0x00,0x01,0x20,
-0x6,0x12,0x00,0x00,
-0x6,0x00,0x10,0x20,
-0x6,0x01,0x20,0x00,
-0x6,0x02,0x10,0x00,
-0x6,0x10,0x20,0x00,
-0x6,0x01,0x02,0x00,
-0x6,0x21,0x00,0x00,
-0x6,0x00,0x02,0x10,
-0x6,0x20,0x01,0x00,
-0x6,0x00,0x22,0x00,
-0x6,0x10,0x02,0x00,
-0x6,0x00,0x10,0x02,
-0x6,0x11,0x00,0x00,
-0x6,0x00,0x11,0x00,
-0x6,0x22,0x00,0x00,
-0x6,0x20,0x00,0x02,
-0x6,0x10,0x00,0x01,
-0x6,0x00,0x20,0x01,
-0x6,0x02,0x20,0x00,
-0x6,0x01,0x10,0x00,
-0x6,0x01,0x00,0x20,
-0x6,0x00,0x20,0x02,
-0x6,0x01,0x20,0x02,
-0x6,0x10,0x01,0x00,
-0x6,0x02,0x00,0x10,
-0x6,0x00,0x10,0x01,
-0x6,0x10,0x01,0x20,
-0x6,0x20,0x02,0x10,
-0x6,0x00,0x00,0x22,
-0x6,0x10,0x00,0x02,
-0x6,0x00,0x02,0x20,
-0x6,0x20,0x02,0x00,
-0x6,0x00,0x00,0x11,
-0x6,0x02,0x10,0x01,
-0x6,0x00,0x01,0x10,
-0x6,0x00,0x02,0x11,
-0x4,0x01,0x02,
-0x4,0x02,0x01,
-0x4,0x01,0x00,
-0x4,0x10,0x20,
-0x4,0x20,0x10,
-0x4,0x20,0x00,
-0x4,0x11,0x00,
-0x4,0x02,0x00,
-0x4,0x12,0x00,
-0x4,0x00,0x21,
-0x4,0x22,0x00,
-0x4,0x00,0x12,
-0x4,0x21,0x00,
-0x4,0x02,0x11,
-0x4,0x00,0x01,
-0x4,0x10,0x02,
-0x4,0x02,0x20,
-0x4,0x20,0x11,
-0x4,0x01,0x10,
-0x4,0x21,0x10,
-0x4,0x10,0x00,
-0x4,0x10,0x22,
-0x4,0x20,0x20,
-0x4,0x00,0x22,
-0x4,0x01,0x22,
-0x4,0x20,0x01,
-0x4,0x02,0x02,
-0x4,0x00,0x20,
-0x4,0x00,0x10,
-0x4,0x00,0x11,
-0x4,0x22,0x01,
-0x4,0x11,0x20,
-0x4,0x12,0x01,
-0x4,0x12,0x20,
-0x4,0x11,0x02,
-0x4,0x10,0x10,
-0x4,0x01,0x01,
-0x4,0x02,0x21,
-0x4,0x20,0x12,
-0x4,0x01,0x12,
-0x4,0x22,0x11,
-0x4,0x21,0x12,
-0x4,0x22,0x10,
-0x4,0x21,0x02,
-0x4,0x20,0x02,
-0x4,0x10,0x01,
-0x4,0x00,0x02,
-0x4,0x10,0x21,
-0x4,0x01,0x20,
-0x4,0x11,0x22,
-0x4,0x12,0x21,
-0x4,0x22,0x20,
-0x4,0x02,0x10,
-0x4,0x02,0x22,
-0x4,0x11,0x10,
-0x4,0x22,0x02,
-0x4,0x20,0x21,
-0x4,0x01,0x11,
-0x4,0x11,0x01,
-0x4,0x10,0x12,
-0x4,0x02,0x12,
-0x4,0x20,0x22,
-0x4,0x21,0x20,
-0x4,0x01,0x21,
-0x4,0x12,0x02,
-0x4,0x21,0x11,
-0x4,0x12,0x22,
-0x4,0x12,0x10,
-0x4,0x22,0x21,
-0x4,0x10,0x11,
-0x4,0x21,0x01,
-0x4,0x11,0x12,
-0x4,0x12,0x11,
-0x4,0x66,0x66,
-0x4,0x22,0x22,
-0x4,0x11,0x21,
-0x4,0x11,0x11,
-0x4,0x21,0x22,
-0x4,0x00,0x00,
-0x4,0x22,0x12,
-0x4,0x12,0x12,
-0x4,0x21,0x21,
-0x4,0x42,0x00,
-0x4,0x00,0x04,
-0x4,0x40,0x00,
-0x4,0x30,0x00,
-0x4,0x31,0x00,
-0x4,0x00,0x03,
-0x4,0x00,0x14,
-0x4,0x00,0x13,
-0x4,0x01,0x24,
-0x4,0x20,0x13,
-0x4,0x01,0x42,
-0x4,0x14,0x20,
-0x4,0x42,0x02,
-0x4,0x13,0x00,
-0x4,0x00,0x24,
-0x4,0x31,0x20,
-0x4,0x22,0x13,
-0x4,0x11,0x24,
-0x4,0x12,0x66,
-0x4,0x30,0x01,
-0x4,0x02,0x13,
-0x4,0x12,0x42,
-0x4,0x40,0x10,
-0x4,0x40,0x02,
-0x4,0x01,0x04,
-0x4,0x24,0x00,
-0x4,0x42,0x10,
-0x4,0x21,0x13,
-0x4,0x13,0x12,
-0x4,0x31,0x21,
-0x4,0x21,0x24,
-0x4,0x00,0x40,
-0x4,0x10,0x24,
-0x4,0x10,0x42,
-0x4,0x32,0x01,
-0x4,0x11,0x42,
-0x4,0x20,0x31,
-0x4,0x12,0x40,
-0x2,0x00,
-0x2,0x10,
-0x2,0x20,
-0x2,0x30,
-0x2,0x40,
-0x2,0x50,
-0x2,0x60,
-0x2,0x70,
-0x2,0x01,
-0x2,0x11,
-0x2,0x21,
-0x2,0x31,
-0x2,0x41,
-0x2,0x51,
-0x2,0x61,
-0x2,0x71,
-0x2,0x02,
-0x2,0x12,
-0x2,0x22,
-0x2,0x32,
-0x2,0x42,
-0x2,0x52,
-0x2,0x62,
-0x2,0x72,
-0x2,0x03,
-0x2,0x13,
-0x2,0x23,
-0x2,0x33,
-0x2,0x43,
-0x2,0x53,
-0x2,0x63,
-0x2,0x73,
-0x2,0x04,
-0x2,0x14,
-0x2,0x24,
-0x2,0x34,
-0x2,0x44,
-0x2,0x54,
-0x2,0x64,
-0x2,0x74,
-0x2,0x05,
-0x2,0x15,
-0x2,0x25,
-0x2,0x35,
-0x2,0x45,
-0x2,0x55,
-0x2,0x65,
-0x2,0x75,
-0x2,0x06,
-0x2,0x16,
-0x2,0x26,
-0x2,0x36,
-0x2,0x46,
-0x2,0x56,
-0x2,0x66,
-0x2,0x76,
-0x2,0x07,
-0x2,0x17,
-0x2,0x27,
-0x2,0x37,
-0x2,0x47,
-0x2,0x57,
-0x2,0x67,
-0x2,0x77
-};
-
-static const uint8_t * const tables[] = { pc_tbl2, pc_tbl3, pc_tbl4 };
-
-#endif /* AVCODEC_TRUEMOTION1DATA_H */
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
deleted file mode 100644
index 5013a9e..0000000
--- a/libavcodec/truemotion2.c
+++ /dev/null
@@ -1,884 +0,0 @@
-/*
- * Duck/ON2 TrueMotion 2 Decoder
- * Copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Duck TrueMotion2 decoder.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-
-#define TM2_ESCAPE 0x80000000
-#define TM2_DELTAS 64
-/* Huffman-coded streams of different types of blocks */
-enum TM2_STREAMS{ TM2_C_HI = 0, TM2_C_LO, TM2_L_HI, TM2_L_LO,
-     TM2_UPD, TM2_MOT, TM2_TYPE, TM2_NUM_STREAMS};
-/* Block types */
-enum TM2_BLOCKS{ TM2_HI_RES = 0, TM2_MED_RES, TM2_LOW_RES, TM2_NULL_RES,
-                 TM2_UPDATE, TM2_STILL, TM2_MOTION};
-
-typedef struct TM2Context{
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    GetBitContext gb;
-    DSPContext dsp;
-
-    /* TM2 streams */
-    int *tokens[TM2_NUM_STREAMS];
-    int tok_lens[TM2_NUM_STREAMS];
-    int tok_ptrs[TM2_NUM_STREAMS];
-    int deltas[TM2_NUM_STREAMS][TM2_DELTAS];
-    /* for blocks decoding */
-    int D[4];
-    int CD[4];
-    int *last;
-    int *clast;
-
-    /* data for current and previous frame */
-    int *Y1, *U1, *V1, *Y2, *U2, *V2;
-    int cur;
-} TM2Context;
-
-/**
-* Huffman codes for each of streams
-*/
-typedef struct TM2Codes{
-    VLC vlc; ///< table for FFmpeg bitstream reader
-    int bits;
-    int *recode; ///< table for converting from code indexes to values
-    int length;
-} TM2Codes;
-
-/**
-* structure for gathering Huffman codes information
-*/
-typedef struct TM2Huff{
-    int val_bits; ///< length of literal
-    int max_bits; ///< maximum length of code
-    int min_bits; ///< minimum length of code
-    int nodes; ///< total number of nodes in tree
-    int num; ///< current number filled
-    int max_num; ///< total number of codes
-    int *nums; ///< literals
-    uint32_t *bits; ///< codes
-    int *lens; ///< codelengths
-} TM2Huff;
-
-static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, int length, TM2Huff *huff)
-{
-    if(length > huff->max_bits) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Tree exceeded its given depth (%i)\n", huff->max_bits);
-        return -1;
-    }
-
-    if(!get_bits1(&ctx->gb)) { /* literal */
-        if (length == 0) {
-            length = 1;
-        }
-        if(huff->num >= huff->max_num) {
-            av_log(ctx->avctx, AV_LOG_DEBUG, "Too many literals\n");
-            return -1;
-        }
-        huff->nums[huff->num] = get_bits_long(&ctx->gb, huff->val_bits);
-        huff->bits[huff->num] = prefix;
-        huff->lens[huff->num] = length;
-        huff->num++;
-        return 0;
-    } else { /* non-terminal node */
-        if(tm2_read_tree(ctx, prefix << 1, length + 1, huff) == -1)
-            return -1;
-        if(tm2_read_tree(ctx, (prefix << 1) | 1, length + 1, huff) == -1)
-            return -1;
-    }
-    return 0;
-}
-
-static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
-{
-    TM2Huff huff;
-    int res = 0;
-
-    huff.val_bits = get_bits(&ctx->gb, 5);
-    huff.max_bits = get_bits(&ctx->gb, 5);
-    huff.min_bits = get_bits(&ctx->gb, 5);
-    huff.nodes = get_bits_long(&ctx->gb, 17);
-    huff.num = 0;
-
-    /* check for correct codes parameters */
-    if((huff.val_bits < 1) || (huff.val_bits > 32) ||
-       (huff.max_bits < 0) || (huff.max_bits > 32)) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",
-               huff.val_bits, huff.max_bits);
-        return -1;
-    }
-    if((huff.nodes < 0) || (huff.nodes > 0x10000)) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes);
-        return -1;
-    }
-    /* one-node tree */
-    if(huff.max_bits == 0)
-        huff.max_bits = 1;
-
-    /* allocate space for codes - it is exactly ceil(nodes / 2) entries */
-    huff.max_num = (huff.nodes + 1) >> 1;
-    huff.nums = av_mallocz(huff.max_num * sizeof(int));
-    huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));
-    huff.lens = av_mallocz(huff.max_num * sizeof(int));
-
-    if(tm2_read_tree(ctx, 0, 0, &huff) == -1)
-        res = -1;
-
-    if(huff.num != huff.max_num) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\n",
-               huff.num, huff.max_num);
-        res = -1;
-    }
-
-    /* convert codes to vlc_table */
-    if(res != -1) {
-        int i;
-
-        res = init_vlc(&code->vlc, huff.max_bits, huff.max_num,
-                    huff.lens, sizeof(int), sizeof(int),
-                    huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0);
-        if(res < 0) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
-            res = -1;
-        } else
-            res = 0;
-        if(res != -1) {
-            code->bits = huff.max_bits;
-            code->length = huff.max_num;
-            code->recode = av_malloc(code->length * sizeof(int));
-            for(i = 0; i < code->length; i++)
-                code->recode[i] = huff.nums[i];
-        }
-    }
-    /* free allocated memory */
-    av_free(huff.nums);
-    av_free(huff.bits);
-    av_free(huff.lens);
-
-    return res;
-}
-
-static void tm2_free_codes(TM2Codes *code)
-{
-    if(code->recode)
-        av_free(code->recode);
-    if(code->vlc.table)
-        free_vlc(&code->vlc);
-}
-
-static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code)
-{
-    int val;
-    val = get_vlc2(gb, code->vlc.table, code->bits, 1);
-    return code->recode[val];
-}
-
-static inline int tm2_read_header(TM2Context *ctx, const uint8_t *buf)
-{
-    uint32_t magic;
-    const uint8_t *obuf;
-    int length;
-
-    obuf = buf;
-
-    magic = AV_RL32(buf);
-    buf += 4;
-
-    if(magic == 0x00000100) { /* old header */
-/*      av_log (ctx->avctx, AV_LOG_ERROR, "TM2 old header: not implemented (yet)\n"); */
-        return 40;
-    } else if(magic == 0x00000101) { /* new header */
-        int w, h, size, flags, xr, yr;
-
-        length = AV_RL32(buf);
-        buf += 4;
-
-        init_get_bits(&ctx->gb, buf, 32 * 8);
-        size = get_bits_long(&ctx->gb, 31);
-        h = get_bits(&ctx->gb, 15);
-        w = get_bits(&ctx->gb, 15);
-        flags = get_bits_long(&ctx->gb, 31);
-        yr = get_bits(&ctx->gb, 9);
-        xr = get_bits(&ctx->gb, 9);
-
-        return 40;
-    } else {
-        av_log (ctx->avctx, AV_LOG_ERROR, "Not a TM2 header: 0x%08X\n", magic);
-        return -1;
-    }
-
-    return buf - obuf;
-}
-
-static int tm2_read_deltas(TM2Context *ctx, int stream_id) {
-    int d, mb;
-    int i, v;
-
-    d = get_bits(&ctx->gb, 9);
-    mb = get_bits(&ctx->gb, 5);
-
-    if((d < 1) || (d > TM2_DELTAS) || (mb < 1) || (mb > 32)) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect delta table: %i deltas x %i bits\n", d, mb);
-        return -1;
-    }
-
-    for(i = 0; i < d; i++) {
-        v = get_bits_long(&ctx->gb, mb);
-        if(v & (1 << (mb - 1)))
-            ctx->deltas[stream_id][i] = v - (1 << mb);
-        else
-            ctx->deltas[stream_id][i] = v;
-    }
-    for(; i < TM2_DELTAS; i++)
-        ctx->deltas[stream_id][i] = 0;
-
-    return 0;
-}
-
-static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id) {
-    int i;
-    int cur = 0;
-    int skip = 0;
-    int len, toks;
-    TM2Codes codes;
-
-    /* get stream length in dwords */
-    len = AV_RB32(buf); buf += 4; cur += 4;
-    skip = len * 4 + 4;
-
-    if(len == 0)
-        return 4;
-
-    toks = AV_RB32(buf); buf += 4; cur += 4;
-    if(toks & 1) {
-        len = AV_RB32(buf); buf += 4; cur += 4;
-        if(len == TM2_ESCAPE) {
-            len = AV_RB32(buf); buf += 4; cur += 4;
-        }
-        if(len > 0) {
-            init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
-            if(tm2_read_deltas(ctx, stream_id) == -1)
-                return -1;
-            buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-            cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-        }
-    }
-    /* skip unused fields */
-    if(AV_RB32(buf) == TM2_ESCAPE) {
-        buf += 4; cur += 4; /* some unknown length - could be escaped too */
-    }
-    buf += 4; cur += 4;
-    buf += 4; cur += 4; /* unused by decoder */
-
-    init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
-    if(tm2_build_huff_table(ctx, &codes) == -1)
-        return -1;
-    buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-    cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-
-    toks >>= 1;
-    /* check if we have sane number of tokens */
-    if((toks < 0) || (toks > 0xFFFFFF)){
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks);
-        tm2_free_codes(&codes);
-        return -1;
-    }
-    ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int));
-    ctx->tok_lens[stream_id] = toks;
-    len = AV_RB32(buf); buf += 4; cur += 4;
-    if(len > 0) {
-        init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
-        for(i = 0; i < toks; i++)
-            ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes);
-    } else {
-        for(i = 0; i < toks; i++)
-            ctx->tokens[stream_id][i] = codes.recode[0];
-    }
-    tm2_free_codes(&codes);
-
-    return skip;
-}
-
-static inline int GET_TOK(TM2Context *ctx,int type) {
-    if(ctx->tok_ptrs[type] >= ctx->tok_lens[type]) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Read token from stream %i out of bounds (%i>=%i)\n", type, ctx->tok_ptrs[type], ctx->tok_lens[type]);
-        return 0;
-    }
-    if(type <= TM2_MOT)
-        return ctx->deltas[type][ctx->tokens[type][ctx->tok_ptrs[type]++]];
-    return ctx->tokens[type][ctx->tok_ptrs[type]++];
-}
-
-/* blocks decoding routines */
-
-/* common Y, U, V pointers initialisation */
-#define TM2_INIT_POINTERS() \
-    int *last, *clast; \
-    int *Y, *U, *V;\
-    int Ystride, Ustride, Vstride;\
-\
-    Ystride = ctx->avctx->width;\
-    Vstride = (ctx->avctx->width + 1) >> 1;\
-    Ustride = (ctx->avctx->width + 1) >> 1;\
-    Y = (ctx->cur?ctx->Y2:ctx->Y1) + by * 4 * Ystride + bx * 4;\
-    V = (ctx->cur?ctx->V2:ctx->V1) + by * 2 * Vstride + bx * 2;\
-    U = (ctx->cur?ctx->U2:ctx->U1) + by * 2 * Ustride + bx * 2;\
-    last = ctx->last + bx * 4;\
-    clast = ctx->clast + bx * 4;
-
-#define TM2_INIT_POINTERS_2() \
-    int *Yo, *Uo, *Vo;\
-    int oYstride, oUstride, oVstride;\
-\
-    TM2_INIT_POINTERS();\
-    oYstride = Ystride;\
-    oVstride = Vstride;\
-    oUstride = Ustride;\
-    Yo = (ctx->cur?ctx->Y1:ctx->Y2) + by * 4 * oYstride + bx * 4;\
-    Vo = (ctx->cur?ctx->V1:ctx->V2) + by * 2 * oVstride + bx * 2;\
-    Uo = (ctx->cur?ctx->U1:ctx->U2) + by * 2 * oUstride + bx * 2;
-
-/* recalculate last and delta values for next blocks */
-#define TM2_RECALC_BLOCK(CHR, stride, last, CD) {\
-    CD[0] = CHR[1] - last[1];\
-    CD[1] = (int)CHR[stride + 1] - (int)CHR[1];\
-    last[0] = (int)CHR[stride + 0];\
-    last[1] = (int)CHR[stride + 1];}
-
-/* common operations - add deltas to 4x4 block of luma or 2x2 blocks of chroma */
-static inline void tm2_apply_deltas(TM2Context *ctx, int* Y, int stride, int *deltas, int *last)
-{
-    int ct, d;
-    int i, j;
-
-    for(j = 0; j < 4; j++){
-        ct = ctx->D[j];
-        for(i = 0; i < 4; i++){
-            d = deltas[i + j * 4];
-            ct += d;
-            last[i] += ct;
-            Y[i] = av_clip_uint8(last[i]);
-        }
-        Y += stride;
-        ctx->D[j] = ct;
-    }
-}
-
-static inline void tm2_high_chroma(int *data, int stride, int *last, int *CD, int *deltas)
-{
-    int i, j;
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            CD[j] += deltas[i + j * 2];
-            last[i] += CD[j];
-            data[i] = last[i];
-        }
-        data += stride;
-    }
-}
-
-static inline void tm2_low_chroma(int *data, int stride, int *clast, int *CD, int *deltas, int bx)
-{
-    int t;
-    int l;
-    int prev;
-
-    if(bx > 0)
-        prev = clast[-3];
-    else
-        prev = 0;
-    t = (CD[0] + CD[1]) >> 1;
-    l = (prev - CD[0] - CD[1] + clast[1]) >> 1;
-    CD[1] = CD[0] + CD[1] - t;
-    CD[0] = t;
-    clast[0] = l;
-
-    tm2_high_chroma(data, stride, clast, CD, deltas);
-}
-
-static inline void tm2_hi_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* hi-res chroma */
-    for(i = 0; i < 4; i++) {
-        deltas[i] = GET_TOK(ctx, TM2_C_HI);
-        deltas[i + 4] = GET_TOK(ctx, TM2_C_HI);
-    }
-    tm2_high_chroma(U, Ustride, clast, ctx->CD, deltas);
-    tm2_high_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas + 4);
-
-    /* hi-res luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = GET_TOK(ctx, TM2_L_HI);
-
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_med_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* low-res chroma */
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(U, Ustride, clast, ctx->CD, deltas, bx);
-
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas, bx);
-
-    /* hi-res luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = GET_TOK(ctx, TM2_L_HI);
-
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_low_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int t1, t2;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* low-res chroma */
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(U, Ustride, clast, ctx->CD, deltas, bx);
-
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas, bx);
-
-    /* low-res luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = 0;
-
-    deltas[ 0] = GET_TOK(ctx, TM2_L_LO);
-    deltas[ 2] = GET_TOK(ctx, TM2_L_LO);
-    deltas[ 8] = GET_TOK(ctx, TM2_L_LO);
-    deltas[10] = GET_TOK(ctx, TM2_L_LO);
-
-    if(bx > 0)
-        last[0] = (last[-1] - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3] + last[1]) >> 1;
-    else
-        last[0] = (last[1]  - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3])>> 1;
-    last[2] = (last[1] + last[3]) >> 1;
-
-    t1 = ctx->D[0] + ctx->D[1];
-    ctx->D[0] = t1 >> 1;
-    ctx->D[1] = t1 - (t1 >> 1);
-    t2 = ctx->D[2] + ctx->D[3];
-    ctx->D[2] = t2 >> 1;
-    ctx->D[3] = t2 - (t2 >> 1);
-
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int ct;
-    int left, right, diff;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* null chroma */
-    deltas[0] = deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(U, Ustride, clast, ctx->CD, deltas, bx);
-
-    deltas[0] = deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas, bx);
-
-    /* null luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = 0;
-
-    ct = ctx->D[0] + ctx->D[1] + ctx->D[2] + ctx->D[3];
-
-    if(bx > 0)
-        left = last[-1] - ct;
-    else
-        left = 0;
-
-    right = last[3];
-    diff = right - left;
-    last[0] = left + (diff >> 2);
-    last[1] = left + (diff >> 1);
-    last[2] = right - (diff >> 2);
-    last[3] = right;
-    {
-        int tp = left;
-
-        ctx->D[0] = (tp + (ct >> 2)) - left;
-        left += ctx->D[0];
-        ctx->D[1] = (tp + (ct >> 1)) - left;
-        left += ctx->D[1];
-        ctx->D[2] = ((tp + ct) - (ct >> 2)) - left;
-        left += ctx->D[2];
-        ctx->D[3] = (tp + ct) - left;
-    }
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_still_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i, j;
-    TM2_INIT_POINTERS_2();
-
-    /* update chroma */
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            U[i] = Uo[i];
-            V[i] = Vo[i];
-        }
-        U += Ustride; V += Vstride;
-        Uo += oUstride; Vo += oVstride;
-    }
-    U -= Ustride * 2;
-    V -= Vstride * 2;
-    TM2_RECALC_BLOCK(U, Ustride, clast, ctx->CD);
-    TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2));
-
-    /* update deltas */
-    ctx->D[0] = Yo[3] - last[3];
-    ctx->D[1] = Yo[3 + oYstride] - Yo[3];
-    ctx->D[2] = Yo[3 + oYstride * 2] - Yo[3 + oYstride];
-    ctx->D[3] = Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2];
-
-    for(j = 0; j < 4; j++){
-        for(i = 0; i < 4; i++){
-            Y[i] = Yo[i];
-            last[i] = Yo[i];
-        }
-        Y += Ystride;
-        Yo += oYstride;
-    }
-}
-
-static inline void tm2_update_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i, j;
-    int d;
-    TM2_INIT_POINTERS_2();
-
-    /* update chroma */
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            U[i] = Uo[i] + GET_TOK(ctx, TM2_UPD);
-            V[i] = Vo[i] + GET_TOK(ctx, TM2_UPD);
-        }
-        U += Ustride; V += Vstride;
-        Uo += oUstride; Vo += oVstride;
-    }
-    U -= Ustride * 2;
-    V -= Vstride * 2;
-    TM2_RECALC_BLOCK(U, Ustride, clast, ctx->CD);
-    TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2));
-
-    /* update deltas */
-    ctx->D[0] = Yo[3] - last[3];
-    ctx->D[1] = Yo[3 + oYstride] - Yo[3];
-    ctx->D[2] = Yo[3 + oYstride * 2] - Yo[3 + oYstride];
-    ctx->D[3] = Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2];
-
-    for(j = 0; j < 4; j++){
-        d = last[3];
-        for(i = 0; i < 4; i++){
-            Y[i] = Yo[i] + GET_TOK(ctx, TM2_UPD);
-            last[i] = Y[i];
-        }
-        ctx->D[j] = last[3] - d;
-        Y += Ystride;
-        Yo += oYstride;
-    }
-}
-
-static inline void tm2_motion_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i, j;
-    int mx, my;
-    TM2_INIT_POINTERS_2();
-
-    mx = GET_TOK(ctx, TM2_MOT);
-    my = GET_TOK(ctx, TM2_MOT);
-
-    Yo += my * oYstride + mx;
-    Uo += (my >> 1) * oUstride + (mx >> 1);
-    Vo += (my >> 1) * oVstride + (mx >> 1);
-
-    /* copy chroma */
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            U[i] = Uo[i];
-            V[i] = Vo[i];
-        }
-        U += Ustride; V += Vstride;
-        Uo += oUstride; Vo += oVstride;
-    }
-    U -= Ustride * 2;
-    V -= Vstride * 2;
-    TM2_RECALC_BLOCK(U, Ustride, clast, ctx->CD);
-    TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2));
-
-    /* copy luma */
-    for(j = 0; j < 4; j++){
-        for(i = 0; i < 4; i++){
-            Y[i] = Yo[i];
-        }
-        Y += Ystride;
-        Yo += oYstride;
-    }
-    /* calculate deltas */
-    Y -= Ystride * 4;
-    ctx->D[0] = Y[3] - last[3];
-    ctx->D[1] = Y[3 + Ystride] - Y[3];
-    ctx->D[2] = Y[3 + Ystride * 2] - Y[3 + Ystride];
-    ctx->D[3] = Y[3 + Ystride * 3] - Y[3 + Ystride * 2];
-    for(i = 0; i < 4; i++)
-        last[i] = Y[i + Ystride * 3];
-}
-
-static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
-{
-    int i, j;
-    int bw, bh;
-    int type;
-    int keyframe = 1;
-    int *Y, *U, *V;
-    uint8_t *dst;
-
-    bw = ctx->avctx->width >> 2;
-    bh = ctx->avctx->height >> 2;
-
-    for(i = 0; i < TM2_NUM_STREAMS; i++)
-        ctx->tok_ptrs[i] = 0;
-
-    if (ctx->tok_lens[TM2_TYPE]<bw*bh){
-        av_log(ctx->avctx,AV_LOG_ERROR,"Got %i tokens for %i blocks\n",ctx->tok_lens[TM2_TYPE],bw*bh);
-        return -1;
-    }
-
-    memset(ctx->last, 0, 4 * bw * sizeof(int));
-    memset(ctx->clast, 0, 4 * bw * sizeof(int));
-
-    for(j = 0; j < bh; j++) {
-        memset(ctx->D, 0, 4 * sizeof(int));
-        memset(ctx->CD, 0, 4 * sizeof(int));
-        for(i = 0; i < bw; i++) {
-            type = GET_TOK(ctx, TM2_TYPE);
-            switch(type) {
-            case TM2_HI_RES:
-                tm2_hi_res_block(ctx, p, i, j);
-                break;
-            case TM2_MED_RES:
-                tm2_med_res_block(ctx, p, i, j);
-                break;
-            case TM2_LOW_RES:
-                tm2_low_res_block(ctx, p, i, j);
-                break;
-            case TM2_NULL_RES:
-                tm2_null_res_block(ctx, p, i, j);
-                break;
-            case TM2_UPDATE:
-                tm2_update_block(ctx, p, i, j);
-                keyframe = 0;
-                break;
-            case TM2_STILL:
-                tm2_still_block(ctx, p, i, j);
-                keyframe = 0;
-                break;
-            case TM2_MOTION:
-                tm2_motion_block(ctx, p, i, j);
-                keyframe = 0;
-                break;
-            default:
-                av_log(ctx->avctx, AV_LOG_ERROR, "Skipping unknown block type %i\n", type);
-            }
-        }
-    }
-
-    /* copy data from our buffer to AVFrame */
-    Y = (ctx->cur?ctx->Y2:ctx->Y1);
-    U = (ctx->cur?ctx->U2:ctx->U1);
-    V = (ctx->cur?ctx->V2:ctx->V1);
-    dst = p->data[0];
-    for(j = 0; j < ctx->avctx->height; j++){
-        for(i = 0; i < ctx->avctx->width; i++){
-            int y = Y[i], u = U[i >> 1], v = V[i >> 1];
-            dst[3*i+0] = av_clip_uint8(y + v);
-            dst[3*i+1] = av_clip_uint8(y);
-            dst[3*i+2] = av_clip_uint8(y + u);
-        }
-        Y += ctx->avctx->width;
-        if (j & 1) {
-            U += ctx->avctx->width >> 1;
-            V += ctx->avctx->width >> 1;
-        }
-        dst += p->linesize[0];
-    }
-
-    return keyframe;
-}
-
-static const int tm2_stream_order[TM2_NUM_STREAMS] = {
-    TM2_C_HI, TM2_C_LO, TM2_L_HI, TM2_L_LO, TM2_UPD, TM2_MOT, TM2_TYPE
-};
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TM2Context * const l = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&l->pic;
-    int i, skip, t;
-    uint8_t *swbuf;
-
-    swbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if(!swbuf){
-        av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
-        return -1;
-    }
-    p->reference = 1;
-    p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if(avctx->reget_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        av_free(swbuf);
-        return -1;
-    }
-
-    l->dsp.bswap_buf((uint32_t*)swbuf, (const uint32_t*)buf, buf_size >> 2);
-    skip = tm2_read_header(l, swbuf);
-
-    if(skip == -1){
-        av_free(swbuf);
-        return -1;
-    }
-
-    for(i = 0; i < TM2_NUM_STREAMS; i++){
-        t = tm2_read_stream(l, swbuf + skip, tm2_stream_order[i]);
-        if(t == -1){
-            av_free(swbuf);
-            return -1;
-        }
-        skip += t;
-    }
-    p->key_frame = tm2_decode_blocks(l, p);
-    if(p->key_frame)
-        p->pict_type = FF_I_TYPE;
-    else
-        p->pict_type = FF_P_TYPE;
-
-    l->cur = !l->cur;
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = l->pic;
-    av_free(swbuf);
-
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-    TM2Context * const l = avctx->priv_data;
-    int i;
-
-    if((avctx->width & 3) || (avctx->height & 3)){
-        av_log(avctx, AV_LOG_ERROR, "Width and height must be multiple of 4\n");
-        return -1;
-    }
-
-    l->avctx = avctx;
-    l->pic.data[0]=NULL;
-    avctx->pix_fmt = PIX_FMT_BGR24;
-
-    dsputil_init(&l->dsp, avctx);
-
-    l->last = av_malloc(4 * sizeof(int) * (avctx->width >> 2));
-    l->clast = av_malloc(4 * sizeof(int) * (avctx->width >> 2));
-
-    for(i = 0; i < TM2_NUM_STREAMS; i++) {
-        l->tokens[i] = NULL;
-        l->tok_lens[i] = 0;
-    }
-
-    l->Y1 = av_malloc(sizeof(int) * avctx->width * avctx->height);
-    l->U1 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->V1 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->Y2 = av_malloc(sizeof(int) * avctx->width * avctx->height);
-    l->U2 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->V2 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->cur = 0;
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    TM2Context * const l = avctx->priv_data;
-    AVFrame *pic = &l->pic;
-    int i;
-
-    if(l->last)
-        av_free(l->last);
-    if(l->clast)
-        av_free(l->clast);
-    for(i = 0; i < TM2_NUM_STREAMS; i++)
-        if(l->tokens[i])
-            av_free(l->tokens[i]);
-    if(l->Y1){
-        av_free(l->Y1);
-        av_free(l->U1);
-        av_free(l->V1);
-        av_free(l->Y2);
-        av_free(l->U2);
-        av_free(l->V2);
-    }
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    return 0;
-}
-
-AVCodec truemotion2_decoder = {
-    "truemotion2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TRUEMOTION2,
-    sizeof(TM2Context),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0"),
-};
diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
deleted file mode 100644
index 37fbef9..0000000
--- a/libavcodec/truespeech.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * DSP Group TrueSpeech compatible decoder
- * Copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#include "truespeech_data.h"
-/**
- * @file
- * TrueSpeech decoder.
- */
-
-/**
- * TrueSpeech decoder context
- */
-typedef struct {
-    /* input data */
-    int16_t vector[8];  //< input vector: 5/5/4/4/4/3/3/3
-    int offset1[2];     //< 8-bit value, used in one copying offset
-    int offset2[4];     //< 7-bit value, encodes offsets for copying and for two-point filter
-    int pulseoff[4];    //< 4-bit offset of pulse values block
-    int pulsepos[4];    //< 27-bit variable, encodes 7 pulse positions
-    int pulseval[4];    //< 7x2-bit pulse values
-    int flag;           //< 1-bit flag, shows how to choose filters
-    /* temporary data */
-    int filtbuf[146];   // some big vector used for storing filters
-    int prevfilt[8];    // filter from previous frame
-    int16_t tmp1[8];    // coefficients for adding to out
-    int16_t tmp2[8];    // coefficients for adding to out
-    int16_t tmp3[8];    // coefficients for adding to out
-    int16_t cvector[8]; // correlated input vector
-    int filtval;        // gain value for one function
-    int16_t newvec[60]; // tmp vector
-    int16_t filters[32]; // filters for every subframe
-} TSContext;
-
-static av_cold int truespeech_decode_init(AVCodecContext * avctx)
-{
-//    TSContext *c = avctx->priv_data;
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-static void truespeech_read_frame(TSContext *dec, const uint8_t *input)
-{
-    uint32_t t;
-
-    /* first dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->flag = t & 1;
-
-    dec->vector[0] = ts_codebook[0][(t >>  1) & 0x1F];
-    dec->vector[1] = ts_codebook[1][(t >>  6) & 0x1F];
-    dec->vector[2] = ts_codebook[2][(t >> 11) &  0xF];
-    dec->vector[3] = ts_codebook[3][(t >> 15) &  0xF];
-    dec->vector[4] = ts_codebook[4][(t >> 19) &  0xF];
-    dec->vector[5] = ts_codebook[5][(t >> 23) &  0x7];
-    dec->vector[6] = ts_codebook[6][(t >> 26) &  0x7];
-    dec->vector[7] = ts_codebook[7][(t >> 29) &  0x7];
-
-    /* second dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->offset2[0] = (t >>  0) & 0x7F;
-    dec->offset2[1] = (t >>  7) & 0x7F;
-    dec->offset2[2] = (t >> 14) & 0x7F;
-    dec->offset2[3] = (t >> 21) & 0x7F;
-
-    dec->offset1[0] = ((t >> 28) & 0xF) << 4;
-
-    /* third dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->pulseval[0] = (t >>  0) & 0x3FFF;
-    dec->pulseval[1] = (t >> 14) & 0x3FFF;
-
-    dec->offset1[1] = (t >> 28) & 0x0F;
-
-    /* fourth dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->pulseval[2] = (t >>  0) & 0x3FFF;
-    dec->pulseval[3] = (t >> 14) & 0x3FFF;
-
-    dec->offset1[1] |= ((t >> 28) & 0x0F) << 4;
-
-    /* fifth dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->pulsepos[0] = (t >> 4) & 0x7FFFFFF;
-
-    dec->pulseoff[0] = (t >> 0) & 0xF;
-
-    dec->offset1[0] |= (t >> 31) & 1;
-
-    /* sixth dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->pulsepos[1] = (t >> 4) & 0x7FFFFFF;
-
-    dec->pulseoff[1] = (t >> 0) & 0xF;
-
-    dec->offset1[0] |= ((t >> 31) & 1) << 1;
-
-    /* seventh dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->pulsepos[2] = (t >> 4) & 0x7FFFFFF;
-
-    dec->pulseoff[2] = (t >> 0) & 0xF;
-
-    dec->offset1[0] |= ((t >> 31) & 1) << 2;
-
-    /* eighth dword */
-    t = AV_RL32(input);
-    input += 4;
-
-    dec->pulsepos[3] = (t >> 4) & 0x7FFFFFF;
-
-    dec->pulseoff[3] = (t >> 0) & 0xF;
-
-    dec->offset1[0] |= ((t >> 31) & 1) << 3;
-
-}
-
-static void truespeech_correlate_filter(TSContext *dec)
-{
-    int16_t tmp[8];
-    int i, j;
-
-    for(i = 0; i < 8; i++){
-        if(i > 0){
-            memcpy(tmp, dec->cvector, i * 2);
-            for(j = 0; j < i; j++)
-                dec->cvector[j] = ((tmp[i - j - 1] * dec->vector[i]) +
-                                   (dec->cvector[j] << 15) + 0x4000) >> 15;
-        }
-        dec->cvector[i] = (8 - dec->vector[i]) >> 3;
-    }
-    for(i = 0; i < 8; i++)
-        dec->cvector[i] = (dec->cvector[i] * ts_230[i]) >> 15;
-
-    dec->filtval = dec->vector[0];
-}
-
-static void truespeech_filters_merge(TSContext *dec)
-{
-    int i;
-
-    if(!dec->flag){
-        for(i = 0; i < 8; i++){
-            dec->filters[i + 0] = dec->prevfilt[i];
-            dec->filters[i + 8] = dec->prevfilt[i];
-        }
-    }else{
-        for(i = 0; i < 8; i++){
-            dec->filters[i + 0]=(dec->cvector[i] * 21846 + dec->prevfilt[i] * 10923 + 16384) >> 15;
-            dec->filters[i + 8]=(dec->cvector[i] * 10923 + dec->prevfilt[i] * 21846 + 16384) >> 15;
-        }
-    }
-    for(i = 0; i < 8; i++){
-        dec->filters[i + 16] = dec->cvector[i];
-        dec->filters[i + 24] = dec->cvector[i];
-    }
-}
-
-static void truespeech_apply_twopoint_filter(TSContext *dec, int quart)
-{
-    int16_t tmp[146 + 60], *ptr0, *ptr1;
-    const int16_t *filter;
-    int i, t, off;
-
-    t = dec->offset2[quart];
-    if(t == 127){
-        memset(dec->newvec, 0, 60 * 2);
-        return;
-    }
-    for(i = 0; i < 146; i++)
-        tmp[i] = dec->filtbuf[i];
-    off = (t / 25) + dec->offset1[quart >> 1] + 18;
-    ptr0 = tmp + 145 - off;
-    ptr1 = tmp + 146;
-    filter = (const int16_t*)ts_240 + (t % 25) * 2;
-    for(i = 0; i < 60; i++){
-        t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14;
-        ptr0++;
-        dec->newvec[i] = t;
-        ptr1[i] = t;
-    }
-}
-
-static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart)
-{
-    int16_t tmp[7];
-    int i, j, t;
-    const int16_t *ptr1;
-    int16_t *ptr2;
-    int coef;
-
-    memset(out, 0, 60 * 2);
-    for(i = 0; i < 7; i++) {
-        t = dec->pulseval[quart] & 3;
-        dec->pulseval[quart] >>= 2;
-        tmp[6 - i] = ts_562[dec->pulseoff[quart] * 4 + t];
-    }
-
-    coef = dec->pulsepos[quart] >> 15;
-    ptr1 = (const int16_t*)ts_140 + 30;
-    ptr2 = tmp;
-    for(i = 0, j = 3; (i < 30) && (j > 0); i++){
-        t = *ptr1++;
-        if(coef >= t)
-            coef -= t;
-        else{
-            out[i] = *ptr2++;
-            ptr1 += 30;
-            j--;
-        }
-    }
-    coef = dec->pulsepos[quart] & 0x7FFF;
-    ptr1 = (const int16_t*)ts_140;
-    for(i = 30, j = 4; (i < 60) && (j > 0); i++){
-        t = *ptr1++;
-        if(coef >= t)
-            coef -= t;
-        else{
-            out[i] = *ptr2++;
-            ptr1 += 30;
-            j--;
-        }
-    }
-
-}
-
-static void truespeech_update_filters(TSContext *dec, int16_t *out, int quart)
-{
-    int i;
-
-    for(i = 0; i < 86; i++)
-        dec->filtbuf[i] = dec->filtbuf[i + 60];
-    for(i = 0; i < 60; i++){
-        dec->filtbuf[i + 86] = out[i] + dec->newvec[i] - (dec->newvec[i] >> 3);
-        out[i] += dec->newvec[i];
-    }
-}
-
-static void truespeech_synth(TSContext *dec, int16_t *out, int quart)
-{
-    int i,k;
-    int t[8];
-    int16_t *ptr0, *ptr1;
-
-    ptr0 = dec->tmp1;
-    ptr1 = dec->filters + quart * 8;
-    for(i = 0; i < 60; i++){
-        int sum = 0;
-        for(k = 0; k < 8; k++)
-            sum += ptr0[k] * ptr1[k];
-        sum = (sum + (out[i] << 12) + 0x800) >> 12;
-        out[i] = av_clip(sum, -0x7FFE, 0x7FFE);
-        for(k = 7; k > 0; k--)
-            ptr0[k] = ptr0[k - 1];
-        ptr0[0] = out[i];
-    }
-
-    for(i = 0; i < 8; i++)
-        t[i] = (ts_5E2[i] * ptr1[i]) >> 15;
-
-    ptr0 = dec->tmp2;
-    for(i = 0; i < 60; i++){
-        int sum = 0;
-        for(k = 0; k < 8; k++)
-            sum += ptr0[k] * t[k];
-        for(k = 7; k > 0; k--)
-            ptr0[k] = ptr0[k - 1];
-        ptr0[0] = out[i];
-        out[i] = ((out[i] << 12) - sum) >> 12;
-    }
-
-    for(i = 0; i < 8; i++)
-        t[i] = (ts_5F2[i] * ptr1[i]) >> 15;
-
-    ptr0 = dec->tmp3;
-    for(i = 0; i < 60; i++){
-        int sum = out[i] << 12;
-        for(k = 0; k < 8; k++)
-            sum += ptr0[k] * t[k];
-        for(k = 7; k > 0; k--)
-            ptr0[k] = ptr0[k - 1];
-        ptr0[0] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
-
-        sum = ((ptr0[1] * (dec->filtval - (dec->filtval >> 2))) >> 4) + sum;
-        sum = sum - (sum >> 3);
-        out[i] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE);
-    }
-}
-
-static void truespeech_save_prevvec(TSContext *c)
-{
-    int i;
-
-    for(i = 0; i < 8; i++)
-        c->prevfilt[i] = c->cvector[i];
-}
-
-static int truespeech_decode_frame(AVCodecContext *avctx,
-                void *data, int *data_size,
-                AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TSContext *c = avctx->priv_data;
-
-    int i, j;
-    short *samples = data;
-    int consumed = 0;
-    int16_t out_buf[240];
-    int iterations;
-
-    if (!buf_size)
-        return 0;
-
-    iterations = FFMIN(buf_size / 32, *data_size / 480);
-    for(j = 0; j < iterations; j++) {
-        truespeech_read_frame(c, buf + consumed);
-        consumed += 32;
-
-        truespeech_correlate_filter(c);
-        truespeech_filters_merge(c);
-
-        memset(out_buf, 0, 240 * 2);
-        for(i = 0; i < 4; i++) {
-            truespeech_apply_twopoint_filter(c, i);
-            truespeech_place_pulses(c, out_buf + i * 60, i);
-            truespeech_update_filters(c, out_buf + i * 60, i);
-            truespeech_synth(c, out_buf + i * 60, i);
-        }
-
-        truespeech_save_prevvec(c);
-
-        /* finally output decoded frame */
-        for(i = 0; i < 240; i++)
-            *samples++ = out_buf[i];
-
-    }
-
-    *data_size = consumed * 15;
-
-    return consumed;
-}
-
-AVCodec truespeech_decoder = {
-    "truespeech",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_TRUESPEECH,
-    sizeof(TSContext),
-    truespeech_decode_init,
-    NULL,
-    NULL,
-    truespeech_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("DSP Group TrueSpeech"),
-};
diff --git a/libavcodec/truespeech_data.h b/libavcodec/truespeech_data.h
deleted file mode 100644
index eef7da8..0000000
--- a/libavcodec/truespeech_data.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * DSP Group TrueSpeech compatible decoder
- * copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_TRUESPEECH_DATA_H
-#define AVCODEC_TRUESPEECH_DATA_H
-
-#include <stdint.h>
-
-/* codebooks fo expanding input filter */
-static const int16_t ts_cb_0[32] = {
-    0x8240, 0x8364, 0x84CE, 0x865D, 0x8805, 0x89DE, 0x8BD7, 0x8DF4,
-    0x9051, 0x92E2, 0x95DE, 0x990F, 0x9C81, 0xA079, 0xA54C, 0xAAD2,
-    0xB18A, 0xB90A, 0xC124, 0xC9CC, 0xD339, 0xDDD3, 0xE9D6, 0xF893,
-    0x096F, 0x1ACA, 0x29EC, 0x381F, 0x45F9, 0x546A, 0x63C3, 0x73B5,
-};
-
-static const int16_t ts_cb_1[32] = {
-    0x9F65, 0xB56B, 0xC583, 0xD371, 0xE018, 0xEBB4, 0xF61C, 0xFF59,
-    0x085B, 0x1106, 0x1952, 0x214A, 0x28C9, 0x2FF8, 0x36E6, 0x3D92,
-    0x43DF, 0x49BB, 0x4F46, 0x5467, 0x5930, 0x5DA3, 0x61EC, 0x65F9,
-    0x69D4, 0x6D5A, 0x709E, 0x73AD, 0x766B, 0x78F0, 0x7B5A, 0x7DA5,
-};
-
-static const int16_t ts_cb_2[16] = {
-    0x96F8, 0xA3B4, 0xAF45, 0xBA53, 0xC4B1, 0xCECC, 0xD86F, 0xE21E,
-    0xEBF3, 0xF640, 0x00F7, 0x0C20, 0x1881, 0x269A, 0x376B, 0x4D60,
-};
-
-static const int16_t ts_cb_3[16] = {
-    0xC654, 0xDEF2, 0xEFAA, 0xFD94, 0x096A, 0x143F, 0x1E7B, 0x282C,
-    0x3176, 0x3A89, 0x439F, 0x4CA2, 0x557F, 0x5E50, 0x6718, 0x6F8D,
-};
-
-static const int16_t ts_cb_4[16] = {
-    0xABE7, 0xBBA8, 0xC81C, 0xD326, 0xDD0E, 0xE5D4, 0xEE22, 0xF618,
-    0xFE28, 0x064F, 0x0EB7, 0x17B8, 0x21AA, 0x2D8B, 0x3BA2, 0x4DF9,
-};
-
-static const int16_t ts_cb_5[8] = {
-    0xD51B, 0xF12E, 0x042E, 0x13C7, 0x2260, 0x311B, 0x40DE, 0x5385,
-};
-
-static const int16_t ts_cb_6[8] = {
-    0xB550, 0xC825, 0xD980, 0xE997, 0xF883, 0x0752, 0x1811, 0x2E18,
-};
-
-static const int16_t ts_cb_7[8] = {
-    0xCEF0, 0xE4F9, 0xF6BB, 0x0646, 0x14F5, 0x23FF, 0x356F, 0x4A8D,
-};
-
-static const int16_t * const ts_codebook[8] = {
-    ts_cb_0, ts_cb_1, ts_cb_2, ts_cb_3, ts_cb_4, ts_cb_5, ts_cb_6, ts_cb_7
-};
-
-/* table used for decoding pulse positions */
-static const int16_t ts_140[120] = {
-    0x0E46, 0x0CCC, 0x0B6D, 0x0A28, 0x08FC, 0x07E8, 0x06EB, 0x0604,
-    0x0532, 0x0474, 0x03C9, 0x0330, 0x02A8, 0x0230, 0x01C7, 0x016C,
-    0x011E, 0x00DC, 0x00A5, 0x0078, 0x0054, 0x0038, 0x0023, 0x0014,
-    0x000A, 0x0004, 0x0001, 0x0000, 0x0000, 0x0000,
-
-    0x0196, 0x017A, 0x015F, 0x0145, 0x012C, 0x0114, 0x00FD, 0x00E7,
-    0x00D2, 0x00BE, 0x00AB, 0x0099, 0x0088, 0x0078, 0x0069, 0x005B,
-    0x004E, 0x0042, 0x0037, 0x002D, 0x0024, 0x001C, 0x0015, 0x000F,
-    0x000A, 0x0006, 0x0003, 0x0001, 0x0000, 0x0000,
-
-    0x001D, 0x001C, 0x001B, 0x001A, 0x0019, 0x0018, 0x0017, 0x0016,
-    0x0015, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E,
-    0x000D, 0x000C, 0x000B, 0x000A, 0x0009, 0x0008, 0x0007, 0x0006,
-    0x0005, 0x0004, 0x0003, 0x0002, 0x0001, 0x0000,
-
-    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
-    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
-    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
-    0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001
-};
-
-/* filter for correlated input filter */
-static const int16_t ts_230[8] =
-    { 0x7F3B, 0x7E78, 0x7DB6, 0x7CF5, 0x7C35, 0x7B76, 0x7AB8, 0x79FC };
-
-/* two-point filters table */
-static const int16_t ts_240[25 * 2] = {
-    0xED2F, 0x5239,
-    0x54F1, 0xE4A9,
-    0x2620, 0xEE3E,
-    0x09D6, 0x2C40,
-    0xEFB5, 0x2BE0,
-
-    0x3FE1, 0x3339,
-    0x442F, 0xE6FE,
-    0x4458, 0xF9DF,
-    0xF231, 0x43DB,
-    0x3DB0, 0xF705,
-
-    0x4F7B, 0xFEFB,
-    0x26AD, 0x0CDC,
-    0x33C2, 0x0739,
-    0x12BE, 0x43A2,
-    0x1BDF, 0x1F3E,
-
-    0x0211, 0x0796,
-    0x2AEB, 0x163F,
-    0x050D, 0x3A38,
-    0x0D1E, 0x0D78,
-    0x150F, 0x3346,
-
-    0x38A4, 0x0B7D,
-    0x2D5D, 0x1FDF,
-    0x19B7, 0x2822,
-    0x0D99, 0x1F12,
-    0x194C, 0x0CE6
-};
-
-/* possible pulse values */
-static const int16_t ts_562[64] = {
-    0x0002, 0x0006, 0xFFFE, 0xFFFA,
-    0x0004, 0x000C, 0xFFFC, 0xFFF4,
-    0x0006, 0x0012, 0xFFFA, 0xFFEE,
-    0x000A, 0x001E, 0xFFF6, 0xFFE2,
-    0x0010, 0x0030, 0xFFF0, 0xFFD0,
-    0x0019, 0x004B, 0xFFE7, 0xFFB5,
-    0x0028, 0x0078, 0xFFD8, 0xFF88,
-    0x0040, 0x00C0, 0xFFC0, 0xFF40,
-    0x0065, 0x012F, 0xFF9B, 0xFED1,
-    0x00A1, 0x01E3, 0xFF5F, 0xFE1D,
-    0x0100, 0x0300, 0xFF00, 0xFD00,
-    0x0196, 0x04C2, 0xFE6A, 0xFB3E,
-    0x0285, 0x078F, 0xFD7B, 0xF871,
-    0x0400, 0x0C00, 0xFC00, 0xF400,
-    0x0659, 0x130B, 0xF9A7, 0xECF5,
-    0x0A14, 0x1E3C, 0xF5EC, 0xE1C4
-};
-
-/* filters used in final output calculations */
-static const int16_t ts_5E2[8] =
-    { 0x4666, 0x26B8, 0x154C, 0x0BB6, 0x0671, 0x038B, 0x01F3, 0x0112 };
-static const int16_t ts_5F2[8] =
-    { 0x6000, 0x4800, 0x3600, 0x2880, 0x1E60, 0x16C8, 0x1116, 0x0CD1 };
-
-#endif /* AVCODEC_TRUESPEECH_DATA_H */
diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c
deleted file mode 100644
index 2b717c1..0000000
--- a/libavcodec/tscc.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * TechSmith Camtasia decoder
- * Copyright (c) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * TechSmith Camtasia decoder
- *
- * Fourcc: TSCC
- *
- * Codec is very simple:
- *  it codes picture (picture difference, really)
- *  with algorithm almost identical to Windows RLE8,
- *  only without padding and with greater pixel sizes,
- *  then this coded picture is packed with ZLib
- *
- * Supports: BGR8,BGR555,BGR24 - only BGR8 and BGR555 tested
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-#include "msrledec.h"
-
-#include <zlib.h>
-
-
-/*
- * Decoder context
- */
-typedef struct TsccContext {
-
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    // Bits per pixel
-    int bpp;
-    // Decompressed data size
-    unsigned int decomp_size;
-    // Decompression buffer
-    unsigned char* decomp_buf;
-    int height;
-    z_stream zstream;
-} CamtasiaContext;
-
-/*
- *
- * Decode a frame
- *
- */
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    CamtasiaContext * const c = avctx->priv_data;
-    const unsigned char *encoded = buf;
-    unsigned char *outptr;
-    int zret; // Zlib return code
-    int len = buf_size;
-
-    if(c->pic.data[0])
-            avctx->release_buffer(avctx, &c->pic);
-
-    c->pic.reference = 1;
-    c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    outptr = c->pic.data[0]; // Output image pointer
-
-    zret = inflateReset(&(c->zstream));
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
-        return -1;
-    }
-    c->zstream.next_in = encoded;
-    c->zstream.avail_in = len;
-    c->zstream.next_out = c->decomp_buf;
-    c->zstream.avail_out = c->decomp_size;
-    zret = inflate(&(c->zstream), Z_FINISH);
-    // Z_DATA_ERROR means empty picture
-    if ((zret != Z_OK) && (zret != Z_STREAM_END) && (zret != Z_DATA_ERROR)) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
-        return -1;
-    }
-
-
-    if(zret != Z_DATA_ERROR)
-        ff_msrle_decode(avctx, (AVPicture*)&c->pic, c->bpp, c->decomp_buf, c->decomp_size - c->zstream.avail_out);
-
-    /* make the palette available on the way out */
-    if (c->avctx->pix_fmt == PIX_FMT_PAL8) {
-        memcpy(c->pic.data[1], c->avctx->palctrl->palette, AVPALETTE_SIZE);
-        if (c->avctx->palctrl->palette_changed) {
-            c->pic.palette_has_changed = 1;
-            c->avctx->palctrl->palette_changed = 0;
-        }
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-
-/*
- *
- * Init tscc decoder
- *
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    CamtasiaContext * const c = avctx->priv_data;
-    int zret; // Zlib return code
-
-    c->avctx = avctx;
-
-    c->height = avctx->height;
-
-    // Needed if zlib unused or init aborted before inflateInit
-    memset(&(c->zstream), 0, sizeof(z_stream));
-    switch(avctx->bits_per_coded_sample){
-    case  8: avctx->pix_fmt = PIX_FMT_PAL8; break;
-    case 16: avctx->pix_fmt = PIX_FMT_RGB555; break;
-    case 24:
-             avctx->pix_fmt = PIX_FMT_BGR24;
-             break;
-    case 32: avctx->pix_fmt = PIX_FMT_RGB32; break;
-    default: av_log(avctx, AV_LOG_ERROR, "Camtasia error: unknown depth %i bpp\n", avctx->bits_per_coded_sample);
-             return -1;
-    }
-    c->bpp = avctx->bits_per_coded_sample;
-    // buffer size for RLE 'best' case when 2-byte code preceeds each pixel and there may be padding after it too
-    c->decomp_size = (((avctx->width * c->bpp + 7) >> 3) + 3 * avctx->width + 2) * avctx->height + 2;
-
-    /* Allocate decompression buffer */
-    if (c->decomp_size) {
-        if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-            return 1;
-        }
-    }
-
-    c->zstream.zalloc = Z_NULL;
-    c->zstream.zfree = Z_NULL;
-    c->zstream.opaque = Z_NULL;
-    zret = inflateInit(&(c->zstream));
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
-        return 1;
-    }
-
-    return 0;
-}
-
-
-
-/*
- *
- * Uninit tscc decoder
- *
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    CamtasiaContext * const c = avctx->priv_data;
-
-    av_freep(&c->decomp_buf);
-
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    inflateEnd(&(c->zstream));
-
-    return 0;
-}
-
-AVCodec tscc_decoder = {
-        "camtasia",
-        AVMEDIA_TYPE_VIDEO,
-        CODEC_ID_TSCC,
-        sizeof(CamtasiaContext),
-        decode_init,
-        NULL,
-        decode_end,
-        decode_frame,
-        CODEC_CAP_DR1,
-        .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"),
-};
-
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
deleted file mode 100644
index 4bdfd73..0000000
--- a/libavcodec/tta.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * TTA (The Lossless True Audio) decoder
- * Copyright (c) 2006 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * TTA (The Lossless True Audio) decoder
- * (www.true-audio.com or tta.corecodec.org)
- * @author Alex Beregszaszi
- *
- */
-
-#define ALT_BITSTREAM_READER_LE
-//#define DEBUG
-#include <limits.h>
-#include "avcodec.h"
-#include "get_bits.h"
-
-#define FORMAT_INT 1
-#define FORMAT_FLOAT 3
-
-typedef struct TTAContext {
-    AVCodecContext *avctx;
-    GetBitContext gb;
-
-    int flags, channels, bps, is_float, data_length;
-    int frame_length, last_frame_length, total_frames;
-
-    int32_t *decode_buffer;
-} TTAContext;
-
-#if 0
-static inline int shift_1(int i)
-{
-    if (i < 32)
-        return 1 << i;
-    else
-        return 0x80000000; // 16 << 31
-}
-
-static inline int shift_16(int i)
-{
-    if (i < 28)
-        return 16 << i;
-    else
-        return 0x80000000; // 16 << 27
-}
-#else
-static const uint32_t shift_1[] = {
-    0x00000001, 0x00000002, 0x00000004, 0x00000008,
-    0x00000010, 0x00000020, 0x00000040, 0x00000080,
-    0x00000100, 0x00000200, 0x00000400, 0x00000800,
-    0x00001000, 0x00002000, 0x00004000, 0x00008000,
-    0x00010000, 0x00020000, 0x00040000, 0x00080000,
-    0x00100000, 0x00200000, 0x00400000, 0x00800000,
-    0x01000000, 0x02000000, 0x04000000, 0x08000000,
-    0x10000000, 0x20000000, 0x40000000, 0x80000000,
-    0x80000000, 0x80000000, 0x80000000, 0x80000000,
-    0x80000000, 0x80000000, 0x80000000, 0x80000000
-};
-
-static const uint32_t * const shift_16 = shift_1 + 4;
-#endif
-
-#define MAX_ORDER 16
-typedef struct TTAFilter {
-    int32_t shift, round, error, mode;
-    int32_t qm[MAX_ORDER];
-    int32_t dx[MAX_ORDER];
-    int32_t dl[MAX_ORDER];
-} TTAFilter;
-
-static const int32_t ttafilter_configs[4][2] = {
-    {10, 1},
-    {9, 1},
-    {10, 1},
-    {12, 0}
-};
-
-static void ttafilter_init(TTAFilter *c, int32_t shift, int32_t mode) {
-    memset(c, 0, sizeof(TTAFilter));
-    c->shift = shift;
-   c->round = shift_1[shift-1];
-//    c->round = 1 << (shift - 1);
-    c->mode = mode;
-}
-
-// FIXME: copy paste from original
-static inline void memshl(register int32_t *a, register int32_t *b) {
-    *a++ = *b++;
-    *a++ = *b++;
-    *a++ = *b++;
-    *a++ = *b++;
-    *a++ = *b++;
-    *a++ = *b++;
-    *a++ = *b++;
-    *a = *b;
-}
-
-// FIXME: copy paste from original
-// mode=1 encoder, mode=0 decoder
-static inline void ttafilter_process(TTAFilter *c, int32_t *in, int32_t mode) {
-    register int32_t *dl = c->dl, *qm = c->qm, *dx = c->dx, sum = c->round;
-
-    if (!c->error) {
-        sum += *dl++ * *qm, qm++;
-        sum += *dl++ * *qm, qm++;
-        sum += *dl++ * *qm, qm++;
-        sum += *dl++ * *qm, qm++;
-        sum += *dl++ * *qm, qm++;
-        sum += *dl++ * *qm, qm++;
-        sum += *dl++ * *qm, qm++;
-        sum += *dl++ * *qm, qm++;
-        dx += 8;
-    } else if(c->error < 0) {
-        sum += *dl++ * (*qm -= *dx++), qm++;
-        sum += *dl++ * (*qm -= *dx++), qm++;
-        sum += *dl++ * (*qm -= *dx++), qm++;
-        sum += *dl++ * (*qm -= *dx++), qm++;
-        sum += *dl++ * (*qm -= *dx++), qm++;
-        sum += *dl++ * (*qm -= *dx++), qm++;
-        sum += *dl++ * (*qm -= *dx++), qm++;
-        sum += *dl++ * (*qm -= *dx++), qm++;
-    } else {
-        sum += *dl++ * (*qm += *dx++), qm++;
-        sum += *dl++ * (*qm += *dx++), qm++;
-        sum += *dl++ * (*qm += *dx++), qm++;
-        sum += *dl++ * (*qm += *dx++), qm++;
-        sum += *dl++ * (*qm += *dx++), qm++;
-        sum += *dl++ * (*qm += *dx++), qm++;
-        sum += *dl++ * (*qm += *dx++), qm++;
-        sum += *dl++ * (*qm += *dx++), qm++;
-    }
-
-    *(dx-0) = ((*(dl-1) >> 30) | 1) << 2;
-    *(dx-1) = ((*(dl-2) >> 30) | 1) << 1;
-    *(dx-2) = ((*(dl-3) >> 30) | 1) << 1;
-    *(dx-3) = ((*(dl-4) >> 30) | 1);
-
-    // compress
-    if (mode) {
-        *dl = *in;
-        *in -= (sum >> c->shift);
-        c->error = *in;
-    } else {
-        c->error = *in;
-        *in += (sum >> c->shift);
-        *dl = *in;
-    }
-
-    if (c->mode) {
-        *(dl-1) = *dl - *(dl-1);
-        *(dl-2) = *(dl-1) - *(dl-2);
-        *(dl-3) = *(dl-2) - *(dl-3);
-    }
-
-    memshl(c->dl, c->dl + 1);
-    memshl(c->dx, c->dx + 1);
-}
-
-typedef struct TTARice {
-    uint32_t k0, k1, sum0, sum1;
-} TTARice;
-
-static void rice_init(TTARice *c, uint32_t k0, uint32_t k1)
-{
-    c->k0 = k0;
-    c->k1 = k1;
-    c->sum0 = shift_16[k0];
-    c->sum1 = shift_16[k1];
-}
-
-static int tta_get_unary(GetBitContext *gb)
-{
-    int ret = 0;
-
-    // count ones
-    while(get_bits1(gb))
-        ret++;
-    return ret;
-}
-
-static av_cold int tta_decode_init(AVCodecContext * avctx)
-{
-    TTAContext *s = avctx->priv_data;
-    int i;
-
-    s->avctx = avctx;
-
-    // 30bytes includes a seektable with one frame
-    if (avctx->extradata_size < 30)
-        return -1;
-
-    init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size);
-    if (show_bits_long(&s->gb, 32) == AV_RL32("TTA1"))
-    {
-        /* signature */
-        skip_bits(&s->gb, 32);
-//        if (get_bits_long(&s->gb, 32) != bswap_32(AV_RL32("TTA1"))) {
-//            av_log(s->avctx, AV_LOG_ERROR, "Missing magic\n");
-//            return -1;
-//        }
-
-        s->flags = get_bits(&s->gb, 16);
-        if (s->flags != 1 && s->flags != 3)
-        {
-            av_log(s->avctx, AV_LOG_ERROR, "Invalid flags\n");
-            return -1;
-        }
-        s->is_float = (s->flags == FORMAT_FLOAT);
-        avctx->channels = s->channels = get_bits(&s->gb, 16);
-        avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
-        s->bps = (avctx->bits_per_coded_sample + 7) / 8;
-        avctx->sample_rate = get_bits_long(&s->gb, 32);
-        if(avctx->sample_rate > 1000000){ //prevent FRAME_TIME * avctx->sample_rate from overflowing and sanity check
-            av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n");
-            return -1;
-        }
-        s->data_length = get_bits_long(&s->gb, 32);
-        skip_bits(&s->gb, 32); // CRC32 of header
-
-        if (s->is_float)
-        {
-            avctx->sample_fmt = SAMPLE_FMT_FLT;
-            av_log(s->avctx, AV_LOG_ERROR, "Unsupported sample format. Please contact the developers.\n");
-            return -1;
-        }
-        else switch(s->bps) {
-//            case 1: avctx->sample_fmt = SAMPLE_FMT_U8; break;
-            case 2: avctx->sample_fmt = SAMPLE_FMT_S16; break;
-//            case 3: avctx->sample_fmt = SAMPLE_FMT_S24; break;
-            case 4: avctx->sample_fmt = SAMPLE_FMT_S32; break;
-            default:
-                av_log(s->avctx, AV_LOG_ERROR, "Invalid/unsupported sample format. Please contact the developers.\n");
-                return -1;
-        }
-
-        // FIXME: horribly broken, but directly from reference source
-#define FRAME_TIME 1.04489795918367346939
-        s->frame_length = (int)(FRAME_TIME * avctx->sample_rate);
-
-        s->last_frame_length = s->data_length % s->frame_length;
-        s->total_frames = s->data_length / s->frame_length +
-                        (s->last_frame_length ? 1 : 0);
-
-        av_log(s->avctx, AV_LOG_DEBUG, "flags: %x chans: %d bps: %d rate: %d block: %d\n",
-            s->flags, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate,
-            avctx->block_align);
-        av_log(s->avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n",
-            s->data_length, s->frame_length, s->last_frame_length, s->total_frames);
-
-        // FIXME: seek table
-        for (i = 0; i < s->total_frames; i++)
-            skip_bits(&s->gb, 32);
-        skip_bits(&s->gb, 32); // CRC32 of seektable
-
-        if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){
-            av_log(avctx, AV_LOG_ERROR, "frame_length too large\n");
-            return -1;
-        }
-
-        s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels);
-    } else {
-        av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static int tta_decode_frame(AVCodecContext *avctx,
-        void *data, int *data_size,
-        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TTAContext *s = avctx->priv_data;
-    int i;
-
-    init_get_bits(&s->gb, buf, buf_size*8);
-    {
-        int32_t predictors[s->channels];
-        TTAFilter filters[s->channels];
-        TTARice rices[s->channels];
-        int cur_chan = 0, framelen = s->frame_length;
-        int32_t *p;
-
-        if (*data_size < (framelen * s->channels * 2)) {
-            av_log(avctx, AV_LOG_ERROR, "Output buffer size is too small.\n");
-            return -1;
-        }
-        // FIXME: seeking
-        s->total_frames--;
-        if (!s->total_frames && s->last_frame_length)
-            framelen = s->last_frame_length;
-
-        // init per channel states
-        for (i = 0; i < s->channels; i++) {
-            predictors[i] = 0;
-            ttafilter_init(&(filters[i]), ttafilter_configs[s->bps-1][0], ttafilter_configs[s->bps-1][1]);
-            rice_init(&(rices[i]), 10, 10);
-        }
-
-        for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) {
-            int32_t *predictor = &(predictors[cur_chan]);
-            TTAFilter *filter = &(filters[cur_chan]);
-            TTARice *rice = &(rices[cur_chan]);
-            uint32_t unary, depth, k;
-            int32_t value;
-
-            unary = tta_get_unary(&s->gb);
-
-            if (unary == 0) {
-                depth = 0;
-                k = rice->k0;
-            } else {
-                depth = 1;
-                k = rice->k1;
-                unary--;
-            }
-
-            if (get_bits_left(&s->gb) < k)
-                return -1;
-
-            if (k) {
-                if (k > MIN_CACHE_BITS)
-                    return -1;
-                value = (unary << k) + get_bits(&s->gb, k);
-            } else
-                value = unary;
-
-            // FIXME: copy paste from original
-            switch (depth) {
-            case 1:
-                rice->sum1 += value - (rice->sum1 >> 4);
-                if (rice->k1 > 0 && rice->sum1 < shift_16[rice->k1])
-                    rice->k1--;
-                else if(rice->sum1 > shift_16[rice->k1 + 1])
-                    rice->k1++;
-                value += shift_1[rice->k0];
-            default:
-                rice->sum0 += value - (rice->sum0 >> 4);
-                if (rice->k0 > 0 && rice->sum0 < shift_16[rice->k0])
-                    rice->k0--;
-                else if(rice->sum0 > shift_16[rice->k0 + 1])
-                    rice->k0++;
-            }
-
-            // extract coded value
-#define UNFOLD(x) (((x)&1) ? (++(x)>>1) : (-(x)>>1))
-            *p = UNFOLD(value);
-
-            // run hybrid filter
-            ttafilter_process(filter, p, 0);
-
-            // fixed order prediction
-#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k)
-            switch (s->bps) {
-                case 1: *p += PRED(*predictor, 4); break;
-                case 2:
-                case 3: *p += PRED(*predictor, 5); break;
-                case 4: *p += *predictor; break;
-            }
-            *predictor = *p;
-
-#if 0
-            // extract 32bit float from last two int samples
-            if (s->is_float && ((p - data) & 1)) {
-                uint32_t neg = *p & 0x80000000;
-                uint32_t hi = *(p - 1);
-                uint32_t lo = abs(*p) - 1;
-
-                hi += (hi || lo) ? 0x3f80 : 0;
-                // SWAP16: swap all the 16 bits
-                *(p - 1) = (hi << 16) | SWAP16(lo) | neg;
-            }
-#endif
-
-            /*if ((get_bits_count(&s->gb)+7)/8 > buf_size)
-            {
-                av_log(NULL, AV_LOG_INFO, "overread!!\n");
-                break;
-            }*/
-
-            // flip channels
-            if (cur_chan < (s->channels-1))
-                cur_chan++;
-            else {
-                // decorrelate in case of stereo integer
-                if (!s->is_float && (s->channels > 1)) {
-                    int32_t *r = p - 1;
-                    for (*p += *r / 2; r > p - s->channels; r--)
-                        *r = *(r + 1) - *r;
-                }
-                cur_chan = 0;
-            }
-        }
-
-        if (get_bits_left(&s->gb) < 32)
-            return -1;
-        skip_bits(&s->gb, 32); // frame crc
-
-        // convert to output buffer
-        switch(s->bps) {
-            case 2: {
-                uint16_t *samples = data;
-                for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) {
-//                    *samples++ = (unsigned char)*p;
-//                    *samples++ = (unsigned char)(*p >> 8);
-                    *samples++ = *p;
-                }
-                *data_size = (uint8_t *)samples - (uint8_t *)data;
-                break;
-            }
-            default:
-                av_log(s->avctx, AV_LOG_ERROR, "Error, only 16bit samples supported!\n");
-        }
-    }
-
-//    return get_bits_count(&s->gb)+7)/8;
-    return buf_size;
-}
-
-static av_cold int tta_decode_close(AVCodecContext *avctx) {
-    TTAContext *s = avctx->priv_data;
-
-    if (s->decode_buffer)
-        av_free(s->decode_buffer);
-
-    return 0;
-}
-
-AVCodec tta_decoder = {
-    "tta",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_TTA,
-    sizeof(TTAContext),
-    tta_decode_init,
-    NULL,
-    tta_decode_close,
-    tta_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("True Audio (TTA)"),
-};
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
deleted file mode 100644
index 6ab3a46..0000000
--- a/libavcodec/twinvq.c
+++ /dev/null
@@ -1,1127 +0,0 @@
-/*
- * TwinVQ decoder
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-#include "lsp.h"
-
-#include <math.h>
-#include <stdint.h>
-
-#include "twinvq_data.h"
-
-enum FrameType {
-    FT_SHORT = 0,  ///< Short frame  (divided in n   sub-blocks)
-    FT_MEDIUM,     ///< Medium frame (divided in m<n sub-blocks)
-    FT_LONG,       ///< Long frame   (single sub-block + PPC)
-    FT_PPC,        ///< Periodic Peak Component (part of the long frame)
-};
-
-/**
- * Parameters and tables that are different for each frame type
- */
-struct FrameMode {
-    uint8_t         sub;      ///< Number subblocks in each frame
-    const uint16_t *bark_tab;
-
-    /** number of distinct bark scale envelope values */
-    uint8_t         bark_env_size;
-
-    const int16_t  *bark_cb;    ///< codebook for the bark scale envelope (BSE)
-    uint8_t         bark_n_coef;///< number of BSE CB coefficients to read
-    uint8_t         bark_n_bit; ///< number of bits of the BSE coefs
-
-    //@{
-    /** main codebooks for spectrum data */
-    const int16_t    *cb0;
-    const int16_t    *cb1;
-    //@}
-
-    uint8_t         cb_len_read; ///< number of spectrum coefficients to read
-};
-
-/**
- * Parameters and tables that are different for every combination of
- * bitrate/sample rate
- */
-typedef struct {
-    struct FrameMode fmode[3]; ///< frame type-dependant parameters
-
-    uint16_t     size;        ///< frame size in samples
-    uint8_t      n_lsp;       ///< number of lsp coefficients
-    const float *lspcodebook;
-
-    /* number of bits of the different LSP CB coefficients */
-    uint8_t      lsp_bit0;
-    uint8_t      lsp_bit1;
-    uint8_t      lsp_bit2;
-
-    uint8_t      lsp_split;      ///< number of CB entries for the LSP decoding
-    const int16_t *ppc_shape_cb; ///< PPC shape CB
-
-    /** number of the bits for the PPC period value */
-    uint8_t      ppc_period_bit;
-
-    uint8_t      ppc_shape_bit;  ///< number of bits of the PPC shape CB coeffs
-    uint8_t      ppc_shape_len;  ///< size of PPC shape CB
-    uint8_t      pgain_bit;      ///< bits for PPC gain
-
-    /** constant for peak period to peak width conversion */
-    uint16_t     peak_per2wid;
-} ModeTab;
-
-static const ModeTab mode_08_08 = {
-    {
-        { 8, bark_tab_s08_64,  10, tab.fcb08s  , 1, 5, tab.cb0808s0, tab.cb0808s1, 18},
-        { 2, bark_tab_m08_256, 20, tab.fcb08m  , 2, 5, tab.cb0808m0, tab.cb0808m1, 16},
-        { 1, bark_tab_l08_512, 30, tab.fcb08l  , 3, 6, tab.cb0808l0, tab.cb0808l1, 17}
-    },
-    512 , 12, tab.lsp08,   1, 5, 3, 3, tab.shape08  , 8, 28, 20, 6, 40
-};
-
-static const ModeTab mode_11_08 = {
-    {
-        { 8, bark_tab_s11_64,  10, tab.fcb11s  , 1, 5, tab.cb1108s0, tab.cb1108s1, 29},
-        { 2, bark_tab_m11_256, 20, tab.fcb11m  , 2, 5, tab.cb1108m0, tab.cb1108m1, 24},
-        { 1, bark_tab_l11_512, 30, tab.fcb11l  , 3, 6, tab.cb1108l0, tab.cb1108l1, 27}
-    },
-    512 , 16, tab.lsp11,   1, 6, 4, 3, tab.shape11  , 9, 36, 30, 7, 90
-};
-
-static const ModeTab mode_11_10 = {
-    {
-        { 8, bark_tab_s11_64,  10, tab.fcb11s  , 1, 5, tab.cb1110s0, tab.cb1110s1, 21},
-        { 2, bark_tab_m11_256, 20, tab.fcb11m  , 2, 5, tab.cb1110m0, tab.cb1110m1, 18},
-        { 1, bark_tab_l11_512, 30, tab.fcb11l  , 3, 6, tab.cb1110l0, tab.cb1110l1, 20}
-    },
-    512 , 16, tab.lsp11,   1, 6, 4, 3, tab.shape11  , 9, 36, 30, 7, 90
-};
-
-static const ModeTab mode_16_16 = {
-    {
-        { 8, bark_tab_s16_128, 10, tab.fcb16s  , 1, 5, tab.cb1616s0, tab.cb1616s1, 16},
-        { 2, bark_tab_m16_512, 20, tab.fcb16m  , 2, 5, tab.cb1616m0, tab.cb1616m1, 15},
-        { 1, bark_tab_l16_1024,30, tab.fcb16l  , 3, 6, tab.cb1616l0, tab.cb1616l1, 16}
-    },
-    1024, 16, tab.lsp16,   1, 6, 4, 3, tab.shape16  , 9, 56, 60, 7, 180
-};
-
-static const ModeTab mode_22_20 = {
-    {
-        { 8, bark_tab_s22_128, 10, tab.fcb22s_1, 1, 6, tab.cb2220s0, tab.cb2220s1, 18},
-        { 2, bark_tab_m22_512, 20, tab.fcb22m_1, 2, 6, tab.cb2220m0, tab.cb2220m1, 17},
-        { 1, bark_tab_l22_1024,32, tab.fcb22l_1, 4, 6, tab.cb2220l0, tab.cb2220l1, 18}
-    },
-    1024, 16, tab.lsp22_1, 1, 6, 4, 3, tab.shape22_1, 9, 56, 36, 7, 144
-};
-
-static const ModeTab mode_22_24 = {
-    {
-        { 8, bark_tab_s22_128, 10, tab.fcb22s_1, 1, 6, tab.cb2224s0, tab.cb2224s1, 15},
-        { 2, bark_tab_m22_512, 20, tab.fcb22m_1, 2, 6, tab.cb2224m0, tab.cb2224m1, 14},
-        { 1, bark_tab_l22_1024,32, tab.fcb22l_1, 4, 6, tab.cb2224l0, tab.cb2224l1, 15}
-    },
-    1024, 16, tab.lsp22_1, 1, 6, 4, 3, tab.shape22_1, 9, 56, 36, 7, 144
-};
-
-static const ModeTab mode_22_32 = {
-    {
-        { 4, bark_tab_s22_128, 10, tab.fcb22s_2, 1, 6, tab.cb2232s0, tab.cb2232s1, 11},
-        { 2, bark_tab_m22_256, 20, tab.fcb22m_2, 2, 6, tab.cb2232m0, tab.cb2232m1, 11},
-        { 1, bark_tab_l22_512, 32, tab.fcb22l_2, 4, 6, tab.cb2232l0, tab.cb2232l1, 12}
-    },
-    512 , 16, tab.lsp22_2, 1, 6, 4, 4, tab.shape22_2, 9, 56, 36, 7, 72
-};
-
-static const ModeTab mode_44_40 = {
-    {
-        {16, bark_tab_s44_128, 10, tab.fcb44s  , 1, 6, tab.cb4440s0, tab.cb4440s1, 18},
-        { 4, bark_tab_m44_512, 20, tab.fcb44m  , 2, 6, tab.cb4440m0, tab.cb4440m1, 17},
-        { 1, bark_tab_l44_2048,40, tab.fcb44l  , 4, 6, tab.cb4440l0, tab.cb4440l1, 17}
-    },
-    2048, 20, tab.lsp44,   1, 6, 4, 4, tab.shape44  , 9, 84, 54, 7, 432
-};
-
-static const ModeTab mode_44_48 = {
-    {
-        {16, bark_tab_s44_128, 10, tab.fcb44s  , 1, 6, tab.cb4448s0, tab.cb4448s1, 15},
-        { 4, bark_tab_m44_512, 20, tab.fcb44m  , 2, 6, tab.cb4448m0, tab.cb4448m1, 14},
-        { 1, bark_tab_l44_2048,40, tab.fcb44l  , 4, 6, tab.cb4448l0, tab.cb4448l1, 14}
-    },
-    2048, 20, tab.lsp44,   1, 6, 4, 4, tab.shape44  , 9, 84, 54, 7, 432
-};
-
-typedef struct TwinContext {
-    AVCodecContext *avctx;
-    DSPContext      dsp;
-    FFTContext mdct_ctx[3];
-
-    const ModeTab *mtab;
-
-    // history
-    float lsp_hist[2][20];           ///< LSP coefficients of the last frame
-    float bark_hist[3][2][40];       ///< BSE coefficients of last frame
-
-    // bitstream parameters
-    int16_t permut[4][4096];
-    uint8_t length[4][2];            ///< main codebook stride
-    uint8_t length_change[4];
-    uint8_t bits_main_spec[2][4][2]; ///< bits for the main codebook
-    int bits_main_spec_change[4];
-    int n_div[4];
-
-    float *spectrum;
-    float *curr_frame;               ///< non-interleaved output
-    float *prev_frame;               ///< non-interleaved previous frame
-    int last_block_pos[2];
-
-    float *cos_tabs[3];
-
-    // scratch buffers
-    float *tmp_buf;
-} TwinContext;
-
-#define PPC_SHAPE_CB_SIZE 64
-#define SUB_AMP_MAX       4500.0
-#define MULAW_MU          100.0
-#define GAIN_BITS         8
-#define AMP_MAX           13000.0
-#define SUB_GAIN_BITS     5
-#define WINDOW_TYPE_BITS  4
-#define PGAIN_MU          200
-
-/** @note not speed critical, hence not optimized */
-static void memset_float(float *buf, float val, int size)
-{
-    while (size--)
-        *buf++ = val;
-}
-
-/**
- * Evaluate a single LPC amplitude spectrum envelope coefficient from the line
- * spectrum pairs.
- *
- * @param lsp a vector of the cosinus of the LSP values
- * @param cos_val cos(PI*i/N) where i is the index of the LPC amplitude
- * @param order the order of the LSP (and the size of the *lsp buffer). Must
- *        be a multiple of four.
- * @return the LPC value
- *
- * @todo reuse code from vorbis_dec.c: vorbis_floor0_decode
- */
-static float eval_lpc_spectrum(const float *lsp, float cos_val, int order)
-{
-    int j;
-    float p = 0.5f;
-    float q = 0.5f;
-    float two_cos_w = 2.0f*cos_val;
-
-    for (j = 0; j + 1 < order; j += 2*2) {
-        // Unroll the loop once since order is a multiple of four
-        q *= lsp[j  ] - two_cos_w;
-        p *= lsp[j+1] - two_cos_w;
-
-        q *= lsp[j+2] - two_cos_w;
-        p *= lsp[j+3] - two_cos_w;
-    }
-
-    p *= p * (2.0f - two_cos_w);
-    q *= q * (2.0f + two_cos_w);
-
-    return 0.5 / (p + q);
-}
-
-/**
- * Evaluates the LPC amplitude spectrum envelope from the line spectrum pairs.
- */
-static void eval_lpcenv(TwinContext *tctx, const float *cos_vals, float *lpc)
-{
-    int i;
-    const ModeTab *mtab = tctx->mtab;
-    int size_s = mtab->size / mtab->fmode[FT_SHORT].sub;
-
-    for (i = 0; i < size_s/2; i++) {
-        float cos_i = tctx->cos_tabs[0][i];
-        lpc[i]          = eval_lpc_spectrum(cos_vals,  cos_i, mtab->n_lsp);
-        lpc[size_s-i-1] = eval_lpc_spectrum(cos_vals, -cos_i, mtab->n_lsp);
-    }
-}
-
-static void interpolate(float *out, float v1, float v2, int size)
-{
-    int i;
-    float step = (v1 - v2)/(size + 1);
-
-    for (i = 0; i < size; i++) {
-        v2 += step;
-        out[i] = v2;
-    }
-}
-
-static inline float get_cos(int idx, int part, const float *cos_tab, int size)
-{
-    return part ? -cos_tab[size - idx - 1] :
-                   cos_tab[       idx    ];
-}
-
-/**
- * Evaluates the LPC amplitude spectrum envelope from the line spectrum pairs.
- * Probably for speed reasons, the coefficients are evaluated as
- * siiiibiiiisiiiibiiiisiiiibiiiisiiiibiiiis ...
- * where s is an evaluated value, i is a value interpolated from the others
- * and b might be either calculated or interpolated, depending on an
- * unexplained condition.
- *
- * @param step the size of a block "siiiibiiii"
- * @param in the cosinus of the LSP data
- * @param part is 0 for 0...PI (positive cossinus values) and 1 for PI...2PI
-          (negative cossinus values)
- * @param size the size of the whole output
- */
-static inline void eval_lpcenv_or_interp(TwinContext *tctx,
-                                         enum FrameType ftype,
-                                         float *out, const float *in,
-                                         int size, int step, int part)
-{
-    int i;
-    const ModeTab *mtab = tctx->mtab;
-    const float *cos_tab = tctx->cos_tabs[ftype];
-
-    // Fill the 's'
-    for (i = 0; i < size; i += step)
-        out[i] =
-            eval_lpc_spectrum(in,
-                              get_cos(i, part, cos_tab, size),
-                              mtab->n_lsp);
-
-    // Fill the 'iiiibiiii'
-    for (i = step; i <= size - 2*step; i += step) {
-        if (out[i + step] + out[i - step] >  1.95*out[i] ||
-            out[i + step]                 >=  out[i - step]) {
-            interpolate(out + i - step + 1, out[i], out[i-step], step - 1);
-        } else {
-            out[i - step/2] =
-                eval_lpc_spectrum(in,
-                                  get_cos(i-step/2, part, cos_tab, size),
-                                  mtab->n_lsp);
-            interpolate(out + i - step   + 1, out[i-step/2], out[i-step  ], step/2 - 1);
-            interpolate(out + i - step/2 + 1, out[i       ], out[i-step/2], step/2 - 1);
-        }
-    }
-
-    interpolate(out + size - 2*step + 1, out[size-step], out[size - 2*step], step - 1);
-}
-
-static void eval_lpcenv_2parts(TwinContext *tctx, enum FrameType ftype,
-                               const float *buf, float *lpc,
-                               int size, int step)
-{
-    eval_lpcenv_or_interp(tctx, ftype, lpc         , buf, size/2,   step, 0);
-    eval_lpcenv_or_interp(tctx, ftype, lpc + size/2, buf, size/2, 2*step, 1);
-
-    interpolate(lpc+size/2-step+1, lpc[size/2], lpc[size/2-step], step);
-
-    memset_float(lpc + size - 2*step + 1, lpc[size - 2*step], 2*step - 1);
-}
-
-/**
- * Inverse quantization. Read CB coefficients for cb1 and cb2 from the
- * bitstream, sum the corresponding vectors and write the result to *out
- * after permutation.
- */
-static void dequant(TwinContext *tctx, GetBitContext *gb, float *out,
-                    enum FrameType ftype,
-                    const int16_t *cb0, const int16_t *cb1, int cb_len)
-{
-    int pos = 0;
-    int i, j;
-
-    for (i = 0; i < tctx->n_div[ftype]; i++) {
-        int tmp0, tmp1;
-        int sign0 = 1;
-        int sign1 = 1;
-        const int16_t *tab0, *tab1;
-        int length = tctx->length[ftype][i >= tctx->length_change[ftype]];
-        int bitstream_second_part = (i >= tctx->bits_main_spec_change[ftype]);
-
-        int bits = tctx->bits_main_spec[0][ftype][bitstream_second_part];
-        if (bits == 7) {
-            if (get_bits1(gb))
-                sign0 = -1;
-            bits = 6;
-        }
-        tmp0 = get_bits(gb, bits);
-
-        bits = tctx->bits_main_spec[1][ftype][bitstream_second_part];
-
-        if (bits == 7) {
-            if (get_bits1(gb))
-                sign1 = -1;
-
-            bits = 6;
-        }
-        tmp1 = get_bits(gb, bits);
-
-        tab0 = cb0 + tmp0*cb_len;
-        tab1 = cb1 + tmp1*cb_len;
-
-        for (j = 0; j < length; j++)
-            out[tctx->permut[ftype][pos+j]] = sign0*tab0[j] + sign1*tab1[j];
-
-        pos += length;
-    }
-
-}
-
-static inline float mulawinv(float y, float clip, float mu)
-{
-    y = av_clipf(y/clip, -1, 1);
-    return clip * FFSIGN(y) * (exp(log(1+mu) * fabs(y)) - 1) / mu;
-}
-
-/**
- * Evaluate a*b/400 rounded to the nearest integer. When, for example,
- * a*b == 200 and the nearest integer is ill-defined, use a table to emulate
- * the following broken float-based implementation used by the binary decoder:
- *
- * \code
- * static int very_broken_op(int a, int b)
- * {
- *    static float test; // Ugh, force gcc to do the division first...
- *
- *    test = a/400.;
- *    return b * test +  0.5;
- * }
- * \endcode
- *
- * @note if this function is replaced by just ROUNDED_DIV(a*b,400.), the stddev
- * between the original file (before encoding with Yamaha encoder) and the
- * decoded output increases, which leads one to believe that the encoder expects
- * exactly this broken calculation.
- */
-static int very_broken_op(int a, int b)
-{
-    int x = a*b + 200;
-    int size;
-    const uint8_t *rtab;
-
-    if (x%400 || b%5)
-        return x/400;
-
-    x /= 400;
-
-    size = tabs[b/5].size;
-    rtab = tabs[b/5].tab;
-    return x - rtab[size*av_log2(2*(x - 1)/size)+(x - 1)%size];
-}
-
-/**
- * Sum to data a periodic peak of a given period, width and shape.
- *
- * @param period the period of the peak divised by 400.0
- */
-static void add_peak(int period, int width, const float *shape,
-                     float ppc_gain, float *speech, int len)
-{
-    int i, j;
-
-    const float *shape_end = shape + len;
-    int center;
-
-    // First peak centered around zero
-    for (i = 0; i < width/2; i++)
-        speech[i] += ppc_gain * *shape++;
-
-    for (i = 1; i < ROUNDED_DIV(len,width) ; i++) {
-        center = very_broken_op(period, i);
-        for (j = -width/2; j < (width+1)/2; j++)
-            speech[j+center] += ppc_gain * *shape++;
-    }
-
-    // For the last block, be careful not to go beyond the end of the buffer
-    center = very_broken_op(period, i);
-    for (j = -width/2; j < (width + 1)/2 && shape < shape_end; j++)
-        speech[j+center] += ppc_gain * *shape++;
-}
-
-static void decode_ppc(TwinContext *tctx, int period_coef, const float *shape,
-                       float ppc_gain, float *speech)
-{
-    const ModeTab *mtab = tctx->mtab;
-    int isampf = tctx->avctx->sample_rate/1000;
-    int ibps = tctx->avctx->bit_rate/(1000 * tctx->avctx->channels);
-    int min_period = ROUNDED_DIV(  40*2*mtab->size, isampf);
-    int max_period = ROUNDED_DIV(6*40*2*mtab->size, isampf);
-    int period_range = max_period - min_period;
-
-    // This is actually the period multiplied by 400. It is just linearly coded
-    // between its maximum and minimum value.
-    int period = min_period +
-        ROUNDED_DIV(period_coef*period_range, (1 << mtab->ppc_period_bit) - 1);
-    int width;
-
-    if (isampf == 22 && ibps == 32) {
-        // For some unknown reason, NTT decided to code this case differently...
-        width = ROUNDED_DIV((period + 800)* mtab->peak_per2wid, 400*mtab->size);
-    } else
-        width =             (period      )* mtab->peak_per2wid/(400*mtab->size);
-
-    add_peak(period, width, shape, ppc_gain, speech, mtab->ppc_shape_len);
-}
-
-static void dec_gain(TwinContext *tctx, GetBitContext *gb, enum FrameType ftype,
-                     float *out)
-{
-    const ModeTab *mtab = tctx->mtab;
-    int i, j;
-    int sub = mtab->fmode[ftype].sub;
-    float step     = AMP_MAX     / ((1 <<     GAIN_BITS) - 1);
-    float sub_step = SUB_AMP_MAX / ((1 << SUB_GAIN_BITS) - 1);
-
-    if (ftype == FT_LONG) {
-        for (i = 0; i < tctx->avctx->channels; i++)
-            out[i] = (1./(1<<13)) *
-                mulawinv(step * 0.5 + step * get_bits(gb, GAIN_BITS),
-                         AMP_MAX, MULAW_MU);
-    } else {
-        for (i = 0; i < tctx->avctx->channels; i++) {
-            float val = (1./(1<<23)) *
-                mulawinv(step * 0.5 + step * get_bits(gb, GAIN_BITS),
-                         AMP_MAX, MULAW_MU);
-
-            for (j = 0; j < sub; j++) {
-                out[i*sub + j] =
-                    val*mulawinv(sub_step* 0.5 +
-                                 sub_step* get_bits(gb, SUB_GAIN_BITS),
-                                 SUB_AMP_MAX, MULAW_MU);
-            }
-        }
-    }
-}
-
-/**
- * Rearrange the LSP coefficients so that they have a minimum distance of
- * min_dist. This function does it exactly as described in section of 3.2.4
- * of the G.729 specification (but interestingly is different from what the
- * reference decoder actually does).
- */
-static void rearrange_lsp(int order, float *lsp, float min_dist)
-{
-    int i;
-    float min_dist2 = min_dist * 0.5;
-    for (i = 1; i < order; i++)
-        if (lsp[i] - lsp[i-1] < min_dist) {
-            float avg = (lsp[i] + lsp[i-1]) * 0.5;
-
-            lsp[i-1] = avg - min_dist2;
-            lsp[i  ] = avg + min_dist2;
-        }
-}
-
-static void decode_lsp(TwinContext *tctx, int lpc_idx1, uint8_t *lpc_idx2,
-                       int lpc_hist_idx, float *lsp, float *hist)
-{
-    const ModeTab *mtab = tctx->mtab;
-    int i, j;
-
-    const float *cb  =  mtab->lspcodebook;
-    const float *cb2 =  cb  + (1 << mtab->lsp_bit1)*mtab->n_lsp;
-    const float *cb3 =  cb2 + (1 << mtab->lsp_bit2)*mtab->n_lsp;
-
-    const int8_t funny_rounding[4] = {
-        -2,
-        mtab->lsp_split == 4 ? -2 : 1,
-        mtab->lsp_split == 4 ? -2 : 1,
-        0
-    };
-
-    j = 0;
-    for (i = 0; i < mtab->lsp_split; i++) {
-        int chunk_end = ((i + 1)*mtab->n_lsp + funny_rounding[i])/mtab->lsp_split;
-        for (; j < chunk_end; j++)
-            lsp[j] = cb [lpc_idx1    * mtab->n_lsp + j] +
-                     cb2[lpc_idx2[i] * mtab->n_lsp + j];
-    }
-
-    rearrange_lsp(mtab->n_lsp, lsp, 0.0001);
-
-    for (i = 0; i < mtab->n_lsp; i++) {
-        float tmp1 = 1. -          cb3[lpc_hist_idx*mtab->n_lsp + i];
-        float tmp2 =     hist[i] * cb3[lpc_hist_idx*mtab->n_lsp + i];
-        hist[i] = lsp[i];
-        lsp[i]  = lsp[i] * tmp1 + tmp2;
-    }
-
-    rearrange_lsp(mtab->n_lsp, lsp, 0.0001);
-    rearrange_lsp(mtab->n_lsp, lsp, 0.000095);
-    ff_sort_nearly_sorted_floats(lsp, mtab->n_lsp);
-}
-
-static void dec_lpc_spectrum_inv(TwinContext *tctx, float *lsp,
-                                 enum FrameType ftype, float *lpc)
-{
-    int i;
-    int size = tctx->mtab->size / tctx->mtab->fmode[ftype].sub;
-
-    for (i = 0; i < tctx->mtab->n_lsp; i++)
-        lsp[i] =  2*cos(lsp[i]);
-
-    switch (ftype) {
-    case FT_LONG:
-        eval_lpcenv_2parts(tctx, ftype, lsp, lpc, size, 8);
-        break;
-    case FT_MEDIUM:
-        eval_lpcenv_2parts(tctx, ftype, lsp, lpc, size, 2);
-        break;
-    case FT_SHORT:
-        eval_lpcenv(tctx, lsp, lpc);
-        break;
-    }
-}
-
-static void imdct_and_window(TwinContext *tctx, enum FrameType ftype, int wtype,
-                            float *in, float *prev, int ch)
-{
-    const ModeTab *mtab = tctx->mtab;
-    int bsize = mtab->size / mtab->fmode[ftype].sub;
-    int size  = mtab->size;
-    float *buf1 = tctx->tmp_buf;
-    int j;
-    int wsize; // Window size
-    float *out = tctx->curr_frame + 2*ch*mtab->size;
-    float *out2 = out;
-    float *prev_buf;
-    int first_wsize;
-
-    static const uint8_t wtype_to_wsize[]      = {0, 0, 2, 2, 2, 1, 0, 1, 1};
-    int types_sizes[] = {
-        mtab->size /    mtab->fmode[FT_LONG  ].sub,
-        mtab->size /    mtab->fmode[FT_MEDIUM].sub,
-        mtab->size / (2*mtab->fmode[FT_SHORT ].sub),
-    };
-
-    wsize = types_sizes[wtype_to_wsize[wtype]];
-    first_wsize = wsize;
-    prev_buf = prev + (size - bsize)/2;
-
-    for (j = 0; j < mtab->fmode[ftype].sub; j++) {
-        int sub_wtype = ftype == FT_MEDIUM ? 8 : wtype;
-
-        if (!j && wtype == 4)
-            sub_wtype = 4;
-        else if (j == mtab->fmode[ftype].sub-1 && wtype == 7)
-            sub_wtype = 7;
-
-        wsize = types_sizes[wtype_to_wsize[sub_wtype]];
-
-        ff_imdct_half(&tctx->mdct_ctx[ftype], buf1 + bsize*j, in + bsize*j);
-
-        tctx->dsp.vector_fmul_window(out2,
-                                     prev_buf + (bsize-wsize)/2,
-                                     buf1 + bsize*j,
-                                     ff_sine_windows[av_log2(wsize)],
-                                     0.0,
-                                     wsize/2);
-        out2 += wsize;
-
-        memcpy(out2, buf1 + bsize*j + wsize/2, (bsize - wsize/2)*sizeof(float));
-
-        out2 += ftype == FT_MEDIUM ? (bsize-wsize)/2 : bsize - wsize;
-
-        prev_buf = buf1 + bsize*j + bsize/2;
-    }
-
-    tctx->last_block_pos[ch] = (size + first_wsize)/2;
-}
-
-static void imdct_output(TwinContext *tctx, enum FrameType ftype, int wtype,
-                         float *out)
-{
-    const ModeTab *mtab = tctx->mtab;
-    float *prev_buf = tctx->prev_frame + tctx->last_block_pos[0];
-    int i, j;
-
-    for (i = 0; i < tctx->avctx->channels; i++) {
-        imdct_and_window(tctx, ftype, wtype,
-                         tctx->spectrum + i*mtab->size,
-                         prev_buf + 2*i*mtab->size,
-                         i);
-    }
-
-    if (tctx->avctx->channels == 2) {
-        for (i = 0; i < mtab->size - tctx->last_block_pos[0]; i++) {
-            float f1 = prev_buf[               i];
-            float f2 = prev_buf[2*mtab->size + i];
-            out[2*i    ] = f1 + f2;
-            out[2*i + 1] = f1 - f2;
-        }
-        for (j = 0; i < mtab->size; j++,i++) {
-            float f1 = tctx->curr_frame[               j];
-            float f2 = tctx->curr_frame[2*mtab->size + j];
-            out[2*i    ] = f1 + f2;
-            out[2*i + 1] = f1 - f2;
-        }
-    } else {
-        memcpy(out, prev_buf,
-               (mtab->size - tctx->last_block_pos[0]) * sizeof(*out));
-
-        out +=  mtab->size - tctx->last_block_pos[0];
-
-        memcpy(out, tctx->curr_frame,
-               (tctx->last_block_pos[0]) * sizeof(*out));
-    }
-
-}
-
-static void dec_bark_env(TwinContext *tctx, const uint8_t *in, int use_hist,
-                         int ch, float *out, float gain, enum FrameType ftype)
-{
-    const ModeTab *mtab = tctx->mtab;
-    int i,j;
-    float *hist = tctx->bark_hist[ftype][ch];
-    float val = ((const float []) {0.4, 0.35, 0.28})[ftype];
-    int bark_n_coef  = mtab->fmode[ftype].bark_n_coef;
-    int fw_cb_len = mtab->fmode[ftype].bark_env_size / bark_n_coef;
-    int idx = 0;
-
-    for (i = 0; i < fw_cb_len; i++)
-        for (j = 0; j < bark_n_coef; j++, idx++) {
-            float tmp2 =
-                mtab->fmode[ftype].bark_cb[fw_cb_len*in[j] + i] * (1./4096);
-            float st = use_hist ?
-                (1. - val) * tmp2 + val*hist[idx] + 1. : tmp2 + 1.;
-
-            hist[idx] = tmp2;
-            if (st < -1.) st = 1.;
-
-            memset_float(out, st * gain, mtab->fmode[ftype].bark_tab[idx]);
-            out += mtab->fmode[ftype].bark_tab[idx];
-        }
-
-}
-
-static void read_and_decode_spectrum(TwinContext *tctx, GetBitContext *gb,
-                                     float *out, enum FrameType ftype)
-{
-    const ModeTab *mtab = tctx->mtab;
-    int channels = tctx->avctx->channels;
-    int sub = mtab->fmode[ftype].sub;
-    int block_size = mtab->size / sub;
-    float gain[channels*sub];
-    float ppc_shape[mtab->ppc_shape_len * channels * 4];
-    uint8_t bark1[channels][sub][mtab->fmode[ftype].bark_n_coef];
-    uint8_t bark_use_hist[channels][sub];
-
-    uint8_t lpc_idx1[channels];
-    uint8_t lpc_idx2[channels][tctx->mtab->lsp_split];
-    uint8_t lpc_hist_idx[channels];
-
-    int i, j, k;
-
-    dequant(tctx, gb, out, ftype,
-            mtab->fmode[ftype].cb0, mtab->fmode[ftype].cb1,
-            mtab->fmode[ftype].cb_len_read);
-
-    for (i = 0; i < channels; i++)
-        for (j = 0; j < sub; j++)
-            for (k = 0; k < mtab->fmode[ftype].bark_n_coef; k++)
-                bark1[i][j][k] =
-                    get_bits(gb, mtab->fmode[ftype].bark_n_bit);
-
-    for (i = 0; i < channels; i++)
-        for (j = 0; j < sub; j++)
-            bark_use_hist[i][j] = get_bits1(gb);
-
-    dec_gain(tctx, gb, ftype, gain);
-
-    for (i = 0; i < channels; i++) {
-        lpc_hist_idx[i] = get_bits(gb, tctx->mtab->lsp_bit0);
-        lpc_idx1    [i] = get_bits(gb, tctx->mtab->lsp_bit1);
-
-        for (j = 0; j < tctx->mtab->lsp_split; j++)
-            lpc_idx2[i][j] = get_bits(gb, tctx->mtab->lsp_bit2);
-    }
-
-    if (ftype == FT_LONG) {
-        int cb_len_p = (tctx->n_div[3] + mtab->ppc_shape_len*channels - 1)/
-            tctx->n_div[3];
-        dequant(tctx, gb, ppc_shape, FT_PPC, mtab->ppc_shape_cb,
-                mtab->ppc_shape_cb + cb_len_p*PPC_SHAPE_CB_SIZE, cb_len_p);
-    }
-
-    for (i = 0; i < channels; i++) {
-        float *chunk = out + mtab->size * i;
-        float lsp[tctx->mtab->n_lsp];
-
-        for (j = 0; j < sub; j++) {
-            dec_bark_env(tctx, bark1[i][j], bark_use_hist[i][j], i,
-                         tctx->tmp_buf, gain[sub*i+j], ftype);
-
-            tctx->dsp.vector_fmul(chunk + block_size*j, tctx->tmp_buf,
-                                  block_size);
-
-        }
-
-        if (ftype == FT_LONG) {
-            float pgain_step = 25000. / ((1 << mtab->pgain_bit) - 1);
-            int p_coef = get_bits(gb, tctx->mtab->ppc_period_bit);
-            int g_coef = get_bits(gb, tctx->mtab->pgain_bit);
-            float v = 1./8192*
-                mulawinv(pgain_step*g_coef+ pgain_step/2, 25000., PGAIN_MU);
-
-            decode_ppc(tctx, p_coef, ppc_shape + i*mtab->ppc_shape_len, v,
-                       chunk);
-        }
-
-        decode_lsp(tctx, lpc_idx1[i], lpc_idx2[i], lpc_hist_idx[i], lsp,
-                   tctx->lsp_hist[i]);
-
-        dec_lpc_spectrum_inv(tctx, lsp, ftype, tctx->tmp_buf);
-
-        for (j = 0; j < mtab->fmode[ftype].sub; j++) {
-            tctx->dsp.vector_fmul(chunk, tctx->tmp_buf, block_size);
-            chunk += block_size;
-        }
-    }
-}
-
-static int twin_decode_frame(AVCodecContext * avctx, void *data,
-                             int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    TwinContext *tctx = avctx->priv_data;
-    GetBitContext gb;
-    const ModeTab *mtab = tctx->mtab;
-    float *out = data;
-    enum FrameType ftype;
-    int window_type;
-    static const enum FrameType wtype_to_ftype_table[] = {
-        FT_LONG,   FT_LONG, FT_SHORT, FT_LONG,
-        FT_MEDIUM, FT_LONG, FT_LONG,  FT_MEDIUM, FT_MEDIUM
-    };
-
-    if (buf_size*8 < avctx->bit_rate*mtab->size/avctx->sample_rate + 8) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Frame too small (%d bytes). Truncated file?\n", buf_size);
-        *data_size = 0;
-        return buf_size;
-    }
-
-    init_get_bits(&gb, buf, buf_size * 8);
-    skip_bits(&gb, get_bits(&gb, 8));
-    window_type = get_bits(&gb, WINDOW_TYPE_BITS);
-
-    if (window_type > 8) {
-        av_log(avctx, AV_LOG_ERROR, "Invalid window type, broken sample?\n");
-        return -1;
-    }
-
-    ftype = wtype_to_ftype_table[window_type];
-
-    read_and_decode_spectrum(tctx, &gb, tctx->spectrum, ftype);
-
-    imdct_output(tctx, ftype, window_type, out);
-
-    FFSWAP(float*, tctx->curr_frame, tctx->prev_frame);
-
-    if (tctx->avctx->frame_number < 2) {
-        *data_size=0;
-        return buf_size;
-    }
-
-    *data_size = mtab->size*avctx->channels*4;
-
-    return buf_size;
-}
-
-/**
- * Init IMDCT and windowing tables
- */
-static av_cold void init_mdct_win(TwinContext *tctx)
-{
-    int i,j;
-    const ModeTab *mtab = tctx->mtab;
-    int size_s = mtab->size / mtab->fmode[FT_SHORT].sub;
-    int size_m = mtab->size / mtab->fmode[FT_MEDIUM].sub;
-    int channels = tctx->avctx->channels;
-    float norm = channels == 1 ? 2. : 1.;
-
-    for (i = 0; i < 3; i++) {
-        int bsize = tctx->mtab->size/tctx->mtab->fmode[i].sub;
-        ff_mdct_init(&tctx->mdct_ctx[i], av_log2(bsize) + 1, 1,
-                     -sqrt(norm/bsize) / (1<<15));
-    }
-
-    tctx->tmp_buf  = av_malloc(mtab->size            * sizeof(*tctx->tmp_buf));
-
-    tctx->spectrum  = av_malloc(2*mtab->size*channels*sizeof(float));
-    tctx->curr_frame = av_malloc(2*mtab->size*channels*sizeof(float));
-    tctx->prev_frame  = av_malloc(2*mtab->size*channels*sizeof(float));
-
-    for (i = 0; i < 3; i++) {
-        int m = 4*mtab->size/mtab->fmode[i].sub;
-        double freq = 2*M_PI/m;
-        tctx->cos_tabs[i] = av_malloc((m/4)*sizeof(*tctx->cos_tabs));
-
-        for (j = 0; j <= m/8; j++)
-            tctx->cos_tabs[i][j] = cos((2*j + 1)*freq);
-        for (j = 1; j <  m/8; j++)
-            tctx->cos_tabs[i][m/4-j] = tctx->cos_tabs[i][j];
-    }
-
-
-    ff_init_ff_sine_windows(av_log2(size_m));
-    ff_init_ff_sine_windows(av_log2(size_s/2));
-    ff_init_ff_sine_windows(av_log2(mtab->size));
-}
-
-/**
- * Interpret the data as if it were a num_blocks x line_len[0] matrix and for
- * each line do a cyclic permutation, i.e.
- * abcdefghijklm -> defghijklmabc
- * where the amount to be shifted is evaluated depending on the column.
- */
-static void permutate_in_line(int16_t *tab, int num_vect, int num_blocks,
-                              int block_size,
-                              const uint8_t line_len[2], int length_div,
-                              enum FrameType ftype)
-
-{
-    int i,j;
-
-    for (i = 0; i < line_len[0]; i++) {
-        int shift;
-
-        if (num_blocks == 1 ||
-            (ftype == FT_LONG && num_vect % num_blocks) ||
-            (ftype != FT_LONG && num_vect & 1         ) ||
-            i == line_len[1]) {
-            shift = 0;
-        } else if (ftype == FT_LONG) {
-            shift = i;
-        } else
-            shift = i*i;
-
-        for (j = 0; j < num_vect && (j+num_vect*i < block_size*num_blocks); j++)
-            tab[i*num_vect+j] = i*num_vect + (j + shift) % num_vect;
-    }
-}
-
-/**
- * Interpret the input data as in the following table:
- *
- * \verbatim
- *
- * abcdefgh
- * ijklmnop
- * qrstuvw
- * x123456
- *
- * \endverbatim
- *
- * and transpose it, giving the output
- * aiqxbjr1cks2dlt3emu4fvn5gow6hp
- */
-static void transpose_perm(int16_t *out, int16_t *in, int num_vect,
-                           const uint8_t line_len[2], int length_div)
-{
-    int i,j;
-    int cont= 0;
-    for (i = 0; i < num_vect; i++)
-        for (j = 0; j < line_len[i >= length_div]; j++)
-            out[cont++] = in[j*num_vect + i];
-}
-
-static void linear_perm(int16_t *out, int16_t *in, int n_blocks, int size)
-{
-    int block_size = size/n_blocks;
-    int i;
-
-    for (i = 0; i < size; i++)
-        out[i] = block_size * (in[i] % n_blocks) + in[i] / n_blocks;
-}
-
-static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)
-{
-    int block_size;
-    const ModeTab *mtab = tctx->mtab;
-    int size = tctx->avctx->channels*mtab->fmode[ftype].sub;
-    int16_t *tmp_perm = (int16_t *) tctx->tmp_buf;
-
-    if (ftype == FT_PPC) {
-        size  = tctx->avctx->channels;
-        block_size = mtab->ppc_shape_len;
-    } else
-        block_size = mtab->size / mtab->fmode[ftype].sub;
-
-    permutate_in_line(tmp_perm, tctx->n_div[ftype], size,
-                      block_size, tctx->length[ftype],
-                      tctx->length_change[ftype], ftype);
-
-    transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype],
-                   tctx->length[ftype], tctx->length_change[ftype]);
-
-    linear_perm(tctx->permut[ftype], tctx->permut[ftype], size,
-                size*block_size);
-}
-
-static av_cold void init_bitstream_params(TwinContext *tctx)
-{
-    const ModeTab *mtab = tctx->mtab;
-    int n_ch = tctx->avctx->channels;
-    int total_fr_bits = tctx->avctx->bit_rate*mtab->size/
-                             tctx->avctx->sample_rate;
-
-    int lsp_bits_per_block = n_ch*(mtab->lsp_bit0 + mtab->lsp_bit1 +
-                                   mtab->lsp_split*mtab->lsp_bit2);
-
-    int ppc_bits = n_ch*(mtab->pgain_bit + mtab->ppc_shape_bit +
-                         mtab->ppc_period_bit);
-
-    int bsize_no_main_cb[3];
-    int bse_bits[3];
-    int i;
-    enum FrameType frametype;
-
-    for (i = 0; i < 3; i++)
-        // +1 for history usage switch
-        bse_bits[i] = n_ch *
-            (mtab->fmode[i].bark_n_coef * mtab->fmode[i].bark_n_bit + 1);
-
-    bsize_no_main_cb[2] = bse_bits[2] + lsp_bits_per_block + ppc_bits +
-                          WINDOW_TYPE_BITS + n_ch*GAIN_BITS;
-
-    for (i = 0; i < 2; i++)
-        bsize_no_main_cb[i] =
-            lsp_bits_per_block + n_ch*GAIN_BITS + WINDOW_TYPE_BITS +
-            mtab->fmode[i].sub*(bse_bits[i] + n_ch*SUB_GAIN_BITS);
-
-    // The remaining bits are all used for the main spectrum coefficients
-    for (i = 0; i < 4; i++) {
-        int bit_size;
-        int vect_size;
-        int rounded_up, rounded_down, num_rounded_down, num_rounded_up;
-        if (i == 3) {
-            bit_size  = n_ch * mtab->ppc_shape_bit;
-            vect_size = n_ch * mtab->ppc_shape_len;
-        } else {
-            bit_size = total_fr_bits - bsize_no_main_cb[i];
-            vect_size = n_ch * mtab->size;
-        }
-
-        tctx->n_div[i] = (bit_size + 13) / 14;
-
-        rounded_up   = (bit_size + tctx->n_div[i] - 1)/tctx->n_div[i];
-        rounded_down = (bit_size           )/tctx->n_div[i];
-        num_rounded_down = rounded_up * tctx->n_div[i] - bit_size;
-        num_rounded_up = tctx->n_div[i] - num_rounded_down;
-        tctx->bits_main_spec[0][i][0] = (rounded_up   + 1)/2;
-        tctx->bits_main_spec[1][i][0] = (rounded_up      )/2;
-        tctx->bits_main_spec[0][i][1] = (rounded_down + 1)/2;
-        tctx->bits_main_spec[1][i][1] = (rounded_down    )/2;
-        tctx->bits_main_spec_change[i] = num_rounded_up;
-
-        rounded_up   = (vect_size + tctx->n_div[i] - 1)/tctx->n_div[i];
-        rounded_down = (vect_size                     )/tctx->n_div[i];
-        num_rounded_down = rounded_up * tctx->n_div[i] - vect_size;
-        num_rounded_up = tctx->n_div[i] - num_rounded_down;
-        tctx->length[i][0] = rounded_up;
-        tctx->length[i][1] = rounded_down;
-        tctx->length_change[i] = num_rounded_up;
-    }
-
-    for (frametype = FT_SHORT; frametype <= FT_PPC; frametype++)
-        construct_perm_table(tctx, frametype);
-}
-
-static av_cold int twin_decode_init(AVCodecContext *avctx)
-{
-    TwinContext *tctx = avctx->priv_data;
-    int isampf = avctx->sample_rate/1000;
-    int ibps = avctx->bit_rate/(1000 * avctx->channels);
-
-    tctx->avctx       = avctx;
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
-
-    if (avctx->channels > 2) {
-        av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n",
-               avctx->channels);
-        return -1;
-    }
-
-    switch ((isampf << 8) +  ibps) {
-    case (8 <<8) +  8: tctx->mtab = &mode_08_08; break;
-    case (11<<8) +  8: tctx->mtab = &mode_11_08; break;
-    case (11<<8) + 10: tctx->mtab = &mode_11_10; break;
-    case (16<<8) + 16: tctx->mtab = &mode_16_16; break;
-    case (22<<8) + 20: tctx->mtab = &mode_22_20; break;
-    case (22<<8) + 24: tctx->mtab = &mode_22_24; break;
-    case (22<<8) + 32: tctx->mtab = &mode_22_32; break;
-    case (44<<8) + 40: tctx->mtab = &mode_44_40; break;
-    case (44<<8) + 48: tctx->mtab = &mode_44_48; break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "This version does not support %d kHz - %d kbit/s/ch mode.\n", isampf, isampf);
-        return -1;
-    }
-
-    dsputil_init(&tctx->dsp, avctx);
-    init_mdct_win(tctx);
-    init_bitstream_params(tctx);
-
-    memset_float(tctx->bark_hist[0][0], 0.1, FF_ARRAY_ELEMS(tctx->bark_hist));
-
-    return 0;
-}
-
-static av_cold int twin_decode_close(AVCodecContext *avctx)
-{
-    TwinContext *tctx = avctx->priv_data;
-    int i;
-
-    for (i = 0; i < 3; i++) {
-        ff_mdct_end(&tctx->mdct_ctx[i]);
-        av_free(tctx->cos_tabs[i]);
-    }
-
-
-    av_free(tctx->curr_frame);
-    av_free(tctx->spectrum);
-    av_free(tctx->prev_frame);
-    av_free(tctx->tmp_buf);
-
-    return 0;
-}
-
-AVCodec twinvq_decoder =
-{
-    "twinvq",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_TWINVQ,
-    sizeof(TwinContext),
-    twin_decode_init,
-    NULL,
-    twin_decode_close,
-    twin_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
-};
diff --git a/libavcodec/twinvq_data.h b/libavcodec/twinvq_data.h
deleted file mode 100644
index 3042cd1..0000000
--- a/libavcodec/twinvq_data.h
+++ /dev/null
@@ -1,11137 +0,0 @@
-/*
- * TwinVQ decoder
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_TWINVQ_DATA_H
-#define AVCODEC_TWINVQ_DATA_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-/*
- * The bark_tab_* tables are constructed so that
- *
- *       /i-1              \
- *       |--               |
- *  bark |\   bark_tab[j]  | == i
- *       |/                |
- *       |--               |
- *       \j=0              /
- *
- *
- * for some slightly nonconventional bark-scale function
- */
-static const uint16_t bark_tab_l08_512[] = {
-    7,     8,     7,     8,     8,     8,     8,     8,     8,     9,
-    9,    10,    10,    11,    11,    12,    12,    14,    15,    16,
-   18,    19,    21,    24,    27,    30,    35,    40,    46,    53
-};
-
-static const uint16_t bark_tab_l11_512[] = {
-    6,     6,     6,     6,     6,     6,     7,     6,     7,     7,
-    8,     8,     8,     9,    10,    10,    11,    13,    13,    15,
-   17,    18,    21,    25,    27,    33,    38,    45,    54,    66
-};
-
-static const uint16_t bark_tab_l16_1024[] = {
-    9,     9,     8,     9,    10,     9,    10,    10,    10,    12,
-   11,    13,    13,    14,    16,    17,    19,    20,    24,    26,
-   30,    35,    40,    48,    56,    68,    83,   102,   128,   165
-};
-
-static const uint16_t bark_tab_l22_1024[] = {
-    6,     7,     6,     6,     7,     7,     7,     7,     7,     8,
-    9,     8,    10,    10,    11,    12,    13,    15,    16,    18,
-   21,    24,    27,    33,    38,    46,    55,    68,    84,   107,
-  140,   191
-};
-
-static const uint16_t bark_tab_l22_512[] = {
-    3,     3,     3,     4,     3,     3,     4,     3,     4,     4,
-    4,     5,     4,     5,     6,     6,     7,     7,     8,     9,
-   10,    12,    14,    16,    20,    22,    28,    34,    42,    53,
-   71,    95
-};
-
-static const uint16_t bark_tab_l44_2048[] = {
-    5,     6,     5,     6,     5,     6,     6,     6,     6,     6,
-    7,     7,     7,     8,     8,     9,     9,    10,    11,    11,
-   13,    14,    16,    17,    19,    22,    25,    29,    33,    39,
-   46,    54,    64,    79,    98,   123,   161,   220,   320,   512
-};
-
-static const uint16_t bark_tab_m08_256[] = {
-    6,     5,     6,     6,     6,     6,     7,     7,     8,     8,
-    9,    10,    11,    13,    15,    18,    20,    25,    31,    39
-};
-
-static const uint16_t bark_tab_m11_256[] = {
-    4,     5,     4,     5,     5,     5,     6,     5,     7,     7,
-    8,     9,    10,    12,    15,    17,    22,    28,    35,    47
-};
-
-static const uint16_t bark_tab_m16_512[] = {
-    7,     6,     7,     7,     7,     8,     9,     9,    10,    11,
-   14,    15,    18,    22,    27,    34,    44,    59,    81,   117
-};
-
-static const uint16_t bark_tab_m22_256[] = {
-    3,     2,     3,     2,     3,     3,     4,     3,     4,     5,
-    5,     7,     8,     9,    13,    16,    22,    30,    44,    70
-};
-
-static const uint16_t bark_tab_m22_512[] = {
-    5,     5,     5,     6,     5,     7,     6,     7,     9,     9,
-   11,    13,    15,    20,    24,    33,    43,    61,    88,   140
-};
-
-static const uint16_t bark_tab_m44_512[] = {
-    3,     2,     3,     3,     3,     4,     3,     5,     4,     6,
-    7,     8,    10,    14,    18,    25,    36,    55,    95,   208
-};
-
-static const uint16_t bark_tab_s08_64[] = {
-    3,     3,     3,     3,     4,     5,     6,     8,    12,    17
-};
-
-static const uint16_t bark_tab_s11_64[] = {
-    2,     3,     2,     3,     3,     4,     6,     8,    12,    21
-};
-
-static const uint16_t bark_tab_s16_128[] = {
-    3,     4,     4,     4,     5,     7,    10,    16,    26,    49
-};
-
-static const uint16_t bark_tab_s22_128[] = {
-    3,     2,     3,     4,     4,     6,     9,    14,    26,    57
-};
-
-static const uint16_t bark_tab_s44_128[] = {
-    1,     2,     1,     2,     3,     4,     6,    10,    23,    76
-};
-
-
-/**
- * TwinVQ codebooks. They are coded in a struct so we can use code such as
- *
- * float val = tab.fcb0808l[get_bits(gb, 12)];
- *
- * without risking a segfault on malformed files.
- */
-static const struct {
-    float lsp08[504];
-    int16_t fcb08l[640];
-    int16_t fcb08m[320];
-    int16_t fcb08s[320];
-    int16_t shape08[1280];
-
-    int16_t cb0808l0[1088];
-    int16_t cb0808l1[1088];
-    int16_t cb0808s0[1152];
-    int16_t cb0808s1[1152];
-    int16_t cb0808m0[1024];
-    int16_t cb0808m1[1024];
-
-    int16_t cb1108l0[1728];
-    int16_t cb1108l1[1728];
-    int16_t cb1108m0[1536];
-    int16_t cb1108m1[1536];
-    int16_t cb1108s0[1856];
-    int16_t cb1108s1[1856];
-
-    int16_t fcb11l[640];
-    int16_t fcb11m[320];
-    int16_t fcb11s[320];
-    int16_t shape11[1280];
-    float lsp11[1312];
-
-    int16_t cb1110l0[1280];
-    int16_t cb1110l1[1280];
-    int16_t cb1110m0[1152];
-    int16_t cb1110m1[1152];
-    int16_t cb1110s0[1344];
-    int16_t cb1110s1[1344];
-
-    int16_t fcb16l[640];
-    int16_t fcb16m[320];
-    int16_t fcb16s[320];
-    int16_t shape16[1920];
-    float lsp16[1400];
-
-    int16_t cb1616l0[1024];
-    int16_t cb1616l1[1024];
-    int16_t cb1616m0[960];
-    int16_t cb1616m1[960];
-    int16_t cb1616s0[1024];
-    int16_t cb1616s1[1024];
-
-    int16_t cb2220l0[1152];
-    int16_t cb2220l1[1152];
-    int16_t cb2220m0[1088];
-    int16_t cb2220m1[1088];
-    int16_t cb2220s0[1152];
-    int16_t cb2220s1[1152];
-
-    int16_t fcb22l_1[512];
-    int16_t fcb22m_1[640];
-    int16_t fcb22s_1[640];
-    int16_t shape22_1[1152];
-    float lsp22_1[1312];
-
-    int16_t cb2224l0[960];
-    int16_t cb2224l1[960];
-    int16_t cb2224m0[896];
-    int16_t cb2224m1[896];
-    int16_t cb2224s0[960];
-    int16_t cb2224s1[960];
-
-    int16_t fcb22l_2[512];
-    int16_t fcb22m_2[640];
-    int16_t fcb22s_2[640];
-    int16_t shape22_2[1152];
-    float lsp22_2[1312];
-
-    int16_t cb2232l0[768];
-    int16_t cb2232l1[768];
-    int16_t cb2232m0[704];
-    int16_t cb2232m1[704];
-    int16_t cb2232s0[704];
-    int16_t cb2232s1[704];
-
-    int16_t cb4440l0[1088];
-    int16_t cb4440l1[1088];
-    int16_t cb4440m0[1088];
-    int16_t cb4440m1[1088];
-    int16_t cb4440s0[1152];
-    int16_t cb4440s1[1152];
-
-    int16_t fcb44l[640];
-    int16_t fcb44m[640];
-    int16_t fcb44s[640];
-    int16_t shape44[1152];
-    float lsp44[1640];
-
-    int16_t cb4448l0[896];
-    int16_t cb4448l1[896];
-    int16_t cb4448m0[896];
-    int16_t cb4448m1[896];
-    int16_t cb4448s0[960];
-    int16_t cb4448s1[960];
-} tab = {
-.cb0808l0 = {
-    96, -12592, -12443,    425,    182,   -456,   -341,   -843,
-   615,    689,    982,   1470,   -518,    231,   -538,    282,
-   409,   -600,   -303,    -29,     51,     -4,   -115,     79,
-   -27,    450,   -937,   -461,   -554,   -159,    426,    710,
--29106,  -2148,     99,   3426,   1838,  12427,    585,  -2080,
- -2524,   -474,   1572,    718,    578,   -344,    188,    328,
- 12125,    112,    654,  -1232,  -1644,    288,    553,   1513,
-   966,   1012,     49,    631,   -111,   -238,   -116,   -182,
-   -21,    -46,    334,  11013,   -454,   -261,     12,     21,
-    52, -20440,   -295,   -502,   -516,   -329,   -230,    465,
-    59,    270,    971,   -127,    505,   -194,     43,    -30,
-   300,     38,    665,   -613,     33,   -172,   -153,    323,
-  -166,     54,    399,    109,    186,  -1765,   -222,    138,
-    16,    204,  30111,    208,   -564,   -612,    156,   -146,
-  -345,    321,   -138,    202,   -184,     93,    710, -15945,
--13401,    234,  -1113,    146,     -9,     56,   -628,   -834,
- -1268,    872,     61,  -1184,   -126,   -205,    145,   -109,
- -8248,    113,   -146,   1288,   9142,    857,   -782,   -686,
-  -256,   -650,   1061,   -202,     12,   -709,    -88,    273,
-   497,    150,    -59,  -8807,    240,    532,     16,   1482,
- 11012,   -444,   1918,  -1786,   1934,    172,    598,  -1324,
-  5638,  -3166,    492,   -545,   -770,   1067,      0,   -356,
-  -421,   1684,    273,   -502,    316,   1116,    807,   -529,
-  -831, -13379,   -420,    236,    470,  -2590,   -193,    -47,
-   580,  -1613,    798,     27,    -16, -12768,   -893,    256,
-     0,   1659,   1463,    544,    196, -30444,    314,   -421,
-   508,   -276,   -173,    414,   -380,   -371,    -40,   -121,
-   375,    432,   -438,      1,   -350,   -280,   1198,   -373,
-   452,    100,    -68,   9053,    165,    770,     73,    291,
-   717,    515,    596,   -323,     -4,     -2,    803,    738,
-  2605,     30,     73,    455,  11280,   1534,   -283,   1502,
- -9126,  -4760,   -570,    483,   -179,  -8628,  -1639,    322,
-   -56,   6149,  -3330,    114,   4598,  -1976,    -34,    -56,
-   840,    753,  12292,  -7100,   -492,    320,   -412,    908,
-  1186,    444,   6546,   -788,   5394,    697,  13105,    194,
-  -394,    294,   2639,     12,  -1009,  -1426,    -36,   2106,
-  -252, -31979,    -66,    341,    996,    298,    105,      6,
-    10,    106,   -498,   -244,   -105,   -574,     16,   -206,
-    24,  -2067,   -381,  10265,   -103,   -762,   -785,  -2036,
--11927,     16,   -710,    -35,   -270,    -99,      4,    772,
-  -272,   -186,   -328, -14936,    -57,  -1357,   -175,   -606,
-   220,    918,    -11,    398,   -189,   -278,    138,    429,
-   509,   -701,    -43,    -42,   -630,   -560,  11736,   -528,
- 10286,   -633,   -870,    423,    550,   -888,    297,   -170,
-   258,   2234,    486,    292,   -446, -11858,  10008,     52,
-  1203,   -164,    810,  -1527,   -604,   -883,   -588,    -96,
-   332,    148,   -180,    223,    356,    285,    434,    -57,
-  -172,   -520,   -432,    -72,    294,    -93,   -134,    316,
- 30647,   -351,    278,     84,   -439,    589,    105,   1001,
-   297,    660,    196,    171,    178,    -90,    -55,   1172,
- 21100,    227,   -288,    372,    162,    458,   -555,  -1329,
-   380,    366,   -104,    105,    674,   -378,   1328,    283,
- -1928,    549,    762,    454,     55,    606,  12499,     24,
-   435,     23,     29,   6170,   1129,    -95,     97,    569,
-   132,    491,    164,   -288,  -1011,   -134,   1234,   -427,
-  -254,   -524,    226, -14114,    328,    -70,   1666,   -189,
- -2352,   1097,    619,    632,   -981,    745,    587,    -27,
-  -200,   -871,     50,    470,   -246,   2610,    581,    254,
-  9893,   -586,    880, -11894,    386,   1135,    117,   1072,
-   116,   -830,   -160,  -1002,   -699,    -66,   -230,   -260,
-   112,    106,    221,    297,    -47,   7642,    170,   -330,
-  -599,    -51,   -476,     33,    475,    624,   6199,   -350,
-  -406,    184,    906,   -528,    382,    401,    348,     26,
-  -186,     33,   -130,    -62,    -50,   1268,   -132,   -109,
-  1164,   -354,    675,      3,   -402,   -244,    644,    648,
-  -132,     -4,     45,  20386,   -136,    568,    126,    376,
- 14476,   -376,    267,  13518,   -260,    111,   1014,    758,
-   439,    551,   -164,    207,    128,   -416,    616,    690,
- -9460,  -1856,   1123,    826,   -265,   -762,   1596,   -632,
-    52,   -622,   -894,    367,   -433,   -100,   1873,    756,
--17436,    168,   -541,    550,    145,  -5612,  -1057,  -1344,
-  -656,   -194,    216,   -500,   -245,    246,     64,    688,
-   727,  12538,  -5492,    252,   -908,   -424,   -532,   -659,
-  -277,   -230,   -736,   -183,     35,   -228,    200,    -12,
-  -248,    -60,   -493,    433,    446,    366,   -644,     92,
-  -324,     29,    833, -21542,   -977,     94,    379,     49,
- -1058,    248,   -178,     85,   -961,  -1198,    -48,    467,
-  -242, -10202,   1556,  11263,   -716,    814,  -1686,   3594,
-   -27,    694,   -802,    390,   4144,   -663,     44,   -546,
-   312,    -28,   -484,    981,   -307,    496,    408,    203,
- 12543,    296,  -1240,    159,    846,   -957,  -1493,   -618,
-  1593,  11868,   2616,   1954,    412,   -922,  -1320,   3325,
-  -254,  -1892,    607,  -2223,  -8745,  -1486,     17,    343,
-   -50,   -562,  22011,   -350,   -491,    -70,    -60,    617,
-   768,   -346,    387,    660,   1409,    222,    616,    173,
- -1323,   4017,   -207,   -525, -13243,     11,    440,   -614,
-  -280,    549,   -670,    -79,    459,    560,   -102,   -214,
-   -54,  -1201,    230,   -526,    857,   1044,   -369,   2470,
--11010, -12586,    243,   -205,    838,   -920,    348,   -738,
-  1319,     86,    -78,   -428,  -1909,   -155,      2,    508,
-   711,   -292,   1699,    225,   -101,   -163,    540,   9692,
-   235,   -183,    -38,    198,   -466,   -204,  -8957,   -914,
-  -299,    193,     10,    723,    643,   -533,  -1418,    323,
-    20,    334,   -886,   -331,    368,    130, -30233,   -152,
-   -14,    637,    132,   -232,   -149,   -430,     64,   -243,
-  -376,    370,    388,    196,  -1098,    117,   -794,    -16,
-  -274,    348,    464, -28156,    184,    322,   -101,      2,
-   -27,   -183,    610,    256,   -160,   -573,   -226,    588,
-  1613,   1028,   9518,  -2151,  -1602,   -528,   -356,   -116,
--11511,   1828,  -2206,    -47,   -757,  -1479,  -1429, -14717,
-  1686,    253,    802,    462,    -37,   -916,   -289,   -401,
- 13383,    353,    -74,    114,   -189,    636,    434,   -639,
-  1013,    234,  11752,    219,   1464,   -132, -12838,    125,
-  -592,    -40,   -162,  -1772,    506,    479,    422,     36,
-    15,   -960,    799,    517,   1311,   -409,    748,    729,
-   446,  11029, -13039,   1257,   -651,    -13,   -742,   1416,
-  -388,   -274,   -795,    163,   -572,     74,    430,    -90,
-  -126,    -74,   -598,    140,    125,    -20, -20332,    208,
-    37,     19,   -174,   -209,    305,     28,   -402,     28,
-  -315,     -1,   -134,    440,   -832,     79,   -635,   -304,
-     8, -32768,    625,    470,  -1224,   -351,    546,  -1171,
-  -706,    652,     31,   7484,   -448,    916,   1244,   -379,
-  -300,     68,    868,    607,    247,     70,   -984,  14314,
-    21,   -350,    -82,    368,    456,   -742,    472,     34,
-   782,   -498,   -879,    700,    417,    216,    415,   -161,
-  -181,   -608,   1570,    862,    -96,   -114,   8095,    -26,
-   168,   -363,   -804,    -36,   -770,    139,   -171,   6645,
- -1425,   4826,  -5288,   1358, -11747,    -64,    650,  -3206,
- -1692,    789,  -2047,   -279,    916,  -1648,   1164,   2044,
-  -144,   -717,   -392,   -216,    372,    348,   1052,   -175,
-   668,    308,    -15,  29112,   -406,   -774,    365,  -1006,
-  -526,   1076,     59,   -672,    -87,   -106,    174,     96,
-   615,    462,    -43,   -496,    112,    149,    -56,   -182,
-  -268, -32768,   -205,   -676,    165,  -1210,   -325,   7964,
-   -44,    546,   -699,    285,   -418,    355,    238,    550,
-    67,    425,    384,   -950,   -330,   -208,   -452,    212,
- 11610,   -190,     37,   -907, -11137,   -982,    585,   -783,
-  -864,    164,    -24,   -514,   -211,      2,   -510,   -580,
-   595,    128,    100,   -229,    -55,    290,   -539,     40,
- -7786,   -270,    295,   -508,    562,  -1196,    218,     33,
-  3788,  -8954,  -1082,    297,   -906,   -322,    123,   1162,
-  -343, -11655,     88,    -28,   1173,      9,    -99,     36,
--11987,    356,  12630,    767,   -183,   -983,   -559,    186,
-  1148,    530,   -440,   1230,   -456,   -133,   -424,     35,
-  -357,    418,   1457,   -687,    740,   -242,  17855,   -368,
- -1057,   -262,   -646,    406,   -712,  -1058,    -84,    454
-},
-
-.cb0808l1 = {
-   982,    -26,   -721,    359,    509,  13290,   2391,    727,
-   325,    328,    269,   -156,    346,   -242,    -31,   -356,
-   741,    396,    -98,    108,     35,   -237, -29684,    196,
-   -69,    462,   -339,     24,  -1221,    352,   -658,    396,
-   243,  -1658,   -458,  -1153,      5,   -662,    -47,     18,
-  -572,   -567,  -2084,   -980,   -210,    150,   -396,  14836,
-  -210,      0,   -162,   -539,    588,   -868,    248,  -8576,
-  1020,    526,   1056,    262,   -149,    818,  -1353,  -1120,
-   767,   -738,   -634, -14742,   -105,    811,   1718,   -116,
-   -64,    307,    920,  -1244,   2388,  10213,  -4505,   -250,
-   617,  -1725,   -645,   1258,   1146,   -590,    707,    -12,
-   372,   1794,   1012,   -149,    404,   -978,   -306,    168,
- -1536,     89,    142,    938, -19891,    973,   -481,   -419,
-  -904,   -455,  -1821,  -1617,    654,  -2022,   1906,   -497,
--11346,   -330, -11679,    -14,      1,    535,   -377,   1057,
-  -214,   -213,    430,    -13,  -3379, -11250,    911,   -716,
-  -240,    -10,    260,    132,   -611,    -64,   -594,  -8540,
-   837,  -3717,  -1154,    906,  10623,   -502,   -167,     67,
-   119,  13501,  -1469,    213,  -1048,  -1403,    432,  -1079,
-    45,   -230,   -730,   -203,   -595,  -1150,   -460,    -97,
-   395,   -304,  27816,   -300,    -16,    153,   -671,    551,
-   436,   -956,   -182,    194,    113,  -5504,    194,    263,
-  -332,   -517,   -244,   -396,    540,     56,   -371,    446,
-   147,    -66,      7,   -306,   1440,   -308,    327,    645,
-   597,  -6642,     72,    392,   -138,    -50,   -144,   -262,
-   504,   -230,    114,   2076,   8175,   1188,    290,   -872,
-   202,     69,     82,   -281,   -126,   -291,   -158,   -152,
-   -45,    239,    153,   -516,   -422,   -691,    801,     28,
-   496,   -298, -11118,  10430,   -227,   -851,    214,   -801,
-   538,    834,   -137,    942,    573,    405,   1308,   2234,
-   300,   1269,  12361,   -752,   2177,   -743,     60,    464,
-   946,    302,   -422,    116,  -1200,   -110,   -843,    284,
-  -578,    732,   -308,    153,    -64,    156,    225, -29232,
-  -452,   -466,   -130,    888,    240,    305,    -83,    236,
-   208,    417,   1530,    294,    594,    351,    508,    137,
- -7274,   -184,    201,     44,   -635,   -891,   -652,   -596,
-   380,   -652,  -8670,    -76,  -3746,   -732,    262,  -1860,
- -1030,   1366,   -279,    444,    911,    209,    330,    251,
-  -208,   -747,     65, -10154,   -204,  12960,   -325,    347,
-  -465,   -730,   -727,    385,    -89,   -763,   -427,    868,
-   -39,   -859,     34,    -29,   -388,  -1324,   -218,   2051,
- -1593,   5511,  10507,  -8516,   2254,   5847,  -1474,   1994,
-  4704,  -1876,    880,  -3810,   -489,   -946,  -1225,  -1104,
-   125,    139,   -668,   2232,   -537,    179,   -215,     63,
-   144,     72,   1198,   9750,    248,   -709,    308,  10552,
-  -434,   -462,  13569,   1096,   -491,   -262,    804,  -1599,
-   679,    569,    604,   1326,    213,  -2026,    324,  -2612,
-  -373, -12818,    -20,     38,   -171,    316,  15516,    306,
-   763,     97,     91,   -832,     23,   -437,   -390,    505,
- -1226,   2518,    106,  -2065,    315,     86,    523,    172,
- -1012, -13851,   3358,   2610,   -381,   -194,   1200,  -4106,
- -1298,  -3637,  -1534,    780,   1367,   -544,   -770,   1690,
-  1047,    -54,   2136,  12502,     32,   6689,    706,  -1172,
-   846,  -4853,   2146,   2548,    -39,   -465,   -596,    177,
-   213,    421,     28,   -388,     11,     69,     31,    -83,
-   -28,   -166,   -150, -19836,   -323,      3,    659,    783,
-   390,    139,   -138,     31,   -111,    453,    -80,    432,
-  -519,   -259,    686,  11431,    163, -13179,    554,     40,
-  -379,   -120,   -692,    340,    169,    120,   -476,    643,
-   778,    501,   -128,    543,   1275,   -134,  20568,    201,
-   401,    512,   -362,   -210,   -269,   -812,    112,     75,
-   149,   -547,   -494,   -418,   -100, -13621,  -1002,   1176,
-  1634,   -395,  -4289,  -1531,    -47,    850,  -1102,  13558,
-  -403,    683,   -164,  -2215,  -1180,  -1750,    344,    630,
-  -968,    669,    540,     26,   -594,    192,    -17,   -336,
- 19645,   1133,     18,    -56,    418,   -426,  -1535,    409,
-   732,    186,    268, -20422,    -22,     62,   -621,    722,
-   440,     96,   -307,   -128,    480,      5,     87,    668,
-  -361,   -599,    -22,    652,   -176,   -114,    214, -12233,
-  -698,    232,    608,   -126,   -714,   -488,   -228,    929,
- -1582, -19845,    245,   -460,    124,     57,    328,   -436,
-  -158,    236,   -196,   -534,    209,     69,    229,    210,
-  -251,   1100,    583,    415,    210,    189,   -219,   1242,
- 19482,   -105,    190,   -374,    -43,   -232,    253,    561,
-  -297,   -376,  -1077,   -308,  13486, -12462,     64,   -190,
-  -298,   -643,    460,    232,   -987,   -478,   1596,    168,
-  -722,    616,   -873,    -98,   -948,    231,  -1102,  11915,
-   746,   -495,   1248,   1203,  11067,    -32,    160,    -94,
-   -24,   -153,   -209,  -1453,  -1059,   -313,   -922,   1143,
-  -538,  -1348,   -323,    679,    -54,   -232,   -470,   2075,
--19135,    628,   -774,     35,    247,    -86,    721,    512,
-  1305,    850,   9760,    248,  -2404,   -220,      6,    -73,
- -1370,    567,   1432,  -2529,  -1508,  14358,   -992,  -1111,
-  -940,   -111,    968,   -530,    576,    102,  -1045,    453,
-   180,    -94,  -7936,   -310,    512,    996,    -32,  -1062,
-  -150,    -26,  -6687,   -181,   -336,  -1510,    616,     70,
-  -332,   -175,    624,   -546,    171,    364,   1011,     68,
-  -284,   -368,    711,     46,     73,    -34,   -419,    404,
- 28270,    283,   -324,    335,   -131,    316,    212,    -27,
-  -342,  -1062,    470,   1269,    454,    286,  -1928,  -1674,
-  -739,   -389,   1073,  -6172,   -317,   -586,   -194,   -182,
--13034,   -848,   4596,   -659,    709,   -630,   -310,    400,
-   344,   -276,    430,    876,  -2047,  -1012,  -1672,   -180,
-    64,  22005,   -736,    829,    266,    182,    436,   -112,
-   -36,    131,    252,    -63,    154,    368,    107,     93,
-   -42, -32768,      0,    200,   -230,    271,  -1776,   4329,
-   986,   -553,    481,   1888,  -2770,    848,  -6305,    264,
- 12244,   1610,   -640,   1348,  -2742,  -2078,    907,  -1115,
-   370, -16539,  -1571,   -176,     24,   -515,    234,    954,
-   605,    613,   -154,    463,    535,   -160,    684,    470,
-   827,  10458,    150,   -669,  -6684,    339,   -542,   -730,
-  -351,    984,    212,    116,     -7,     62,    926,   2175,
-  -185,   -552,    489,   -209,   5247,     38,    366,     53,
-    16,    263,   -142,   -535,   -224,    338,   -174,   -125,
-   113, -12750,    400,   -410,    281,    -12,    744,   -173,
-   486, -12159,   -107,   -183,   -484,      2,    150,      1,
-  -239,      7,   -399,   -608,   -873,    698,  -1623,    701,
-  -773,    272,   -832,    -94,   -921,    885,  13588,    178,
-   192,    148,   1346,     44,     59,   -275,    -14,   -328,
-   212,    133,   -223,    300,   -394,   -275,    -43,    -76,
-   -47,    322,   -208,  21713,    484,    329,   1860,     40,
-  -916,    502,    130,    477,   1754,    503,   7984,   -338,
-  -323,   -230,    354,    928,    430,    -89,    -94,    108,
-  -543,    365,   -130,     70,    902,   -131,     58,    469,
-   580, -30949,     36,    232,   -410,   -451,    104,  -8698,
-   113,  -1682,    -42,   -279,    -92,   -280,   -477,   -386,
-  -531,    832,     80, -15002,    -56,     93,    164,   -721,
-  8388,   -412,  -2396,    584,   1004,   -310,  -2229,   -304,
-  -383,    275,   1062,   1266,    297,    -70,   -909,    891,
-   131,  -1046,    539,  32502,   1000,    -21,   -229,    138,
-  1528,   -175,    546,    326,    168,   -320,    716,   -291,
-  -298,   -227,   1094,    -59, -12561,  12943,    786,    600,
-  -206,    889,   -761,     54,    332,  -1253,   -597,    357,
- -1124,    -50,   -168,   1172,   2266,     75,   -174,    583,
-   408,   -157,  14666,    378,    302,     -5,     48,    109,
-    28,    -21,   1044,    529,   -859,  -1182,   -202,   1984,
-   308,    402,     66,  -1139,   2595,   -380,   1119,    309,
-   482, -10705,    100,  -4591,  11646,  -1364,   -365,   9521,
-  -318,    -23,   1076,   -135,  -2742,   -833,     78,    910,
-    96,    -20,   -599,     46,    855,  -1265,   4748,   2394,
-  -250,  -9096,   -962,    191,   -346,    348,    342,   1909,
- 15330,    266,    540,    271,   2986,   1356,   1542,  -1019,
-  -895,    737,    281,    684,   -538,  10414,   -922,    287,
-   679,    204, -11142,  -2321,   -346,  -1572,   -250,   -315,
-  -604,   1336,    311,   1317,  -1111,    409,   -104,   -221,
--14125,  -1511,   -990,    705,   -808,    587,    676,    348
-},
-
-.cb0808s0 = {
- -7488,  -1327,  -5244,  -2049,  -3736,    -45,    446,   1558,
-  -755,  -6052,   6034,  -4326,    740,   -348,  12369,   2115,
-  -662,   -685,  -6592,  10176,   8575,  -1035,  -2752,  -4453,
-  -283,   1547,   4776,  -2932,    700,   3425,  -3905,   1073,
-  2356,  -7094,  -1705,   -435,   4840,  -1944,   1188,    780,
- -3963,  -6170,  -1726,   4759,  -4356,  -2124,  -1686,    321,
-  -901,   1414,   -923,  -2678,  -1198, -14777,  -2038,  -3528,
-   123,  11216,   1904,  -1914,   7588,   2744,  -4265,  -4886,
- -3530,  -1495,  -1709,  -5857,   3829,   2196,  -4842,   -817,
-  -874,  -5649,  -2181,  -3871,   3774,  -1368,    322,  -1126,
-  -996,  -3873,  13698,  -9369,   -848,   3797,   -667,  -1083,
-  2429,  -3351,  -1672,  -3562,  -1590,  -3507,    552,   6610,
- -4137, -10061,  -5452,  -6142,  -1454,   1726,  -1298,  -4479,
-  6126,   1626,  -2791,   1584,   1300,   5726,   2584,  11109,
-   696,  -3344,  -2418,   9029,   4346,  -3554,   1393,    144,
-  2051,   8916,   6174,   5170,    376,   9778,  -2298,  -4119,
-  3733,    -35,  -2673,   2222,   1383,   2046,   2859, -16131,
-  1637,  -1195,   -662,   2800,  -2241,   3801,  -5062,   -978,
-  5670,  -5449,    -79,   3479,    606,   3766,  -1325,   -265,
-   907,   -745,   1005, -14528,  -4227,  -3955,  -7194,   3690,
-  2166,  -2520,  11555,   -511,   5900,   -388,  -3854,  -3440,
-  2136,   -868,  -2986,    722,   1286,  -4027,  10382,  -1646,
-  5193,   2539,   1239,   7819,    -67,   3382,  -3297,    -46,
- -3808,    830,   1313,  -2188,  -4346,   5922,  -1057,  -6294,
- 14317,   2001,    968,   4150,  -4121,   1412,   -302,  -8401,
- -1388,  10649,  -9513,   1042,    840,  -4606,   2098,   1166,
-  1472,   -802,  -2810,    420,   -561,   -325,   2652,  -2866,
-  1334,   4878,    958,     83,    456,   1203,  -7594,  14590,
- -1210,   2202,  -1954,  -1938,  -3413,  -1096,   6036,  -1675,
- -1320,  -4485, -10665,  10026,  -2484,  -3273,   4753,   -275,
- -3542,    924,   1262,   7348,  -2959,   -749,   -408,   4594,
-  4876,   -491,   3409,   4616,    110,    557,  -1378,  -1616,
- -4532,   1699,   1412,    579,   -494,    716,    197, -23346,
- -2284,    156,   1096,   -151,  -1827,    688,   -322,   2371,
- -7909,  -1324,  -1683,   7861,   7074,   -451,    258,   9088,
-  1900,   8660,    840,   3491,  -3275,   3029,   -475,  -2122,
- -5725,  -8668,  -6069,  -3458,   4240,  -3007,  -5463,   9395,
- -2686,   4718,   -717,     42,  -1802,   3122,  -3197,  -5212,
- -1572,   -243,   -451,   8213,  -2199,  -3372,   4110,  -8176,
--10525,  -5551,   4312,    682,   2069,   1985,  -3713,  -6780,
-  1193,   2831,  -2228,    486,  -3667,   -789,  -1691,   4567,
-   464,  -2114,  -2340,  -1881,   1921,   1602,  18418,   1535,
-  -567,    228,  -9359,  -6027,   -267,   3628,  32767,   1423,
-   -74,  -2817,   2112,   -128,  -1516,  -2446,   1673,   2812,
- -1582,   2125,    618,   2569,   2714,  -1710,    340,   3255,
-   848,   3379,  -2317,  -2361,  -1823,    412,  -2496, -18164,
- -1224,   2552,  -3040,    144,   -597,   7716,   4916,  -2867,
- -2172,   2120,  -2776,    675, -11985,   1692,  -1384,  -3588,
-  4310,   1020,  -4215,   -251,  -7090,  -1916,   1914,  -2804,
-  6189,  -6732,  -1370,  -3704,    450,  -2652,   6553,    -38,
- 10348,   1244,  -2246,  -3729,  -2158,  -1340,   2357,   3118,
-  9378,  -1727,   3150,  -3867,   1277,    -15,    769,  -2352,
-  -411,   1428, -14032,  -1029,   2828,  -1894,   6084,    -36,
-   518,  13159,   1095,  -1185,  -3207,   -555,  -3256,    -76,
-  3884,   3394,   1010,   1946,    160,  -4863,   4714,  -7087,
- -3985,   5602,   3350,   7822,  -5729,  -7701,   9296,   3067,
-  3582,   5256,  13629,  -4012,  -2206,  -3867,   -664,   -104,
-  4397,  -7862,     36,    955,    -38,   -973,   3458,   5004,
-   364,  -9116,  -2764,  -2168,  -1892,  -7632,  -4834,  -5788,
- -3565,  -1245,  -4544,   6552,   4601,   2342,   6625,   1040,
-  2154,  -6985,   5838,  -1912,  -3439,   1189,  -2422,   -555,
-  3286, -14872,   -776,   1228,   2434,    120,  13673,    904,
- -1354,    645,  -1550,  -1377,  -1888,   1416,   -679,  -1685,
-  1731,   2404,  -5786,   3285,   -193,   -123,   1973,   3663,
- -1388, -14961,  -3597,   5555,  -1420,    284,   1527,  -2575,
-  1941,    871,   3900,  -2168, -12763,   2970,   -408,  -3131,
- -6426,   1892,    782,   6768,   -284,   1034,   9785,   6029,
- -3873,  -4102,  -4349,   2548,  -3686,  -5622,   4769,   -351,
-  8178,  -7253,   3687,    624,  -4386,   4028,  -2780,  -1938,
- -4061,  -1872,  -1264,   7300,    760,   8530,   -821,   -874,
--14225,  -1143,  -5400,   -850,  -2537,    478,   1668,  -1244,
-  -362,    877,   3481,  -1338,  -5218,   2091,   3996,   -577,
-   390,   8626,    820,    181,   -988,   5604,   9694,   1112,
- -3064,   -266,   1234,   -486,   1264,  -2173, -13671,   3729,
- -3212,   2548,   1745,  -9363,   8065,   3713,  -3343,  -4847,
-  2808,  -4716,  -2175,     25,  -5718,   4056,   1855,   4663,
-  2324,  -1166,    543,      2,   3931,  -3196,   2771,   -920,
- -2907,   -746,  -1241,   -306,   2793,    -22,  -2642,   3048,
-  3256,   1804,  -1310,  17876,  -1816,     56,  -1694,   -465,
-  -534,  -2274,   6139,  -2247,  -2515,  -1077,   3305,   1519,
-   273,   1128,  -1637,   2561,  -1534,    874, -22808,  -1119,
- -2551, -10344,  -2229,  -3510,    194,   2594,   1737,   4713,
- 13767,   3532,   -311,   8097,  -1012,   -841,  -4360,    793,
-  -267,   -206,  12905,  -2683,  -6424,    196,   7098,  -1690,
-  -690,   1236,  -2882,  -2668,  -2020,   8291,  -2714,  -4607,
-  -923,  -2077,  -2878,   1687, -10457,  -1575,   2172,  -3974,
-  5795,   1748,  -1852,  -5143,   4763,  -5097,  -2840,  -1851,
-  2634,   5970,    180,  -3326,  -1655,   1226,    375,   5137,
- -2678,  -5246,   4327,  -3670,   9956,  -1976,   2189,   2952,
- -6785,   -697,   1129,  -5768,  -5819,   6532,   3650,  -1711,
-  3857,     47,  -9618,  -1941,   2524,  -1244,   7242,  11646,
-   -64,   2304,    201,  -3707,   -700,    149,   2692,   -805,
-  3978,   2738,   -977,  -1004,  -5776,  12779,   7454,   -353,
- -4731,  -3866,   7076,    146,  -3302,   3065,   1955,   -343,
- -1459,   -426,  -5906,  -1318,    500,  -1014,  -1002,  -2090,
- -2924, -20521,   2610,   1581,    397,  -3380,  -2885,    510,
- -1147,   3398,   1914,     99,   -119,    144,  -3128,   2445,
-  1791,    397,   3734,    -80,  -3410,  -3798,  -1142,  -1515,
- -2615,  -1540,   5193,   2187,    940,   4969,  -2334, -16589,
-   325,  -2186,  -4567,   5121,   -894,  -6848,  -6002,   1832,
-  -568,   8259,    833,   3420,  -4459,   -748,   3442,   4358,
- -3041, -10203,   9303,  -1511,  -4821,   1950,   -966,   3573,
-   453,    705,  16238,   -901,   -163,  -2866,   -104,  -1767,
- -1779,  -1249,   3251,   1975,   1254,   -838,   -390,  -3150,
-  1020,   2526,  -2025,    662,  -2817,  -1338,   -855,  -3442,
--21123,    241,   -134,   -952,   -588,   2572,   2080,   8153,
-   114,   9732,  -6774,  -5266,  -2462,   2286,   -599,   -426,
-  1396,  -7051,  -1228,    312,  -4495,  -2525,   4649,  -1305,
- -1106,  -2366,   2232,   4065, -18674,  -1295,  -3259,  -1004,
- -5136,    206,   1177,  -5130,   2394,   2518,  -1381,   2564,
-  -138,   4341,  16988,   2546,   6782,  -3433,    850,   -970,
-  -255,   1308,   2228,   1704,  -1283,   1452,  -2608,   1487,
-  3106,  -2267,  -2998,  -6814,   1654,  21195,   1555,    968,
-   154,    124,  -1258,    714,   -407,     44,    247,    992,
-  2228,   2824,   1435,   -341,   1212,  -1612,   6126,   1636,
- -8368,    578,  -5418,    217,   -191,    204,  -7147,   5110,
-  3766,   5055,  -5979,   6683,    368,  -3597,  -4595,   7630,
- -3611,  -2384,   1369,   6995,  -3299,    -53,   2036,  -4654,
-  4259,   9618,  -1012,  -2964,   4397,  -2112,  11885,  -1648,
-  -942,  -3474,   -544,  -1410,  -1958,  -1535,   2981,  -1591,
--16787,    335,   4609,  -1990,   3821,   -645,   1842,    -64,
- -3485,   3202,   -374,    -58,  -1410,   7304,  -1958,  -2142,
--11412,  -2533,    513,  -6149,  -6679,   2152,   3153,   5102,
-  2216,  -1361,   2260,   4863,  -7031,   1538,  -5250,  -2511,
-    96,   3339,  -3447,  -3708,   7168,  -4168,    838,  -3134,
-  3228,  -1531,  -5598,  14125,    208,  -2150,    819,  -1085,
- 12282,   6714,  -2778,  -9252,  -5117,  -6623,  -1711,  -4253,
- -6306,  -1292,  -1370,  -1027,   -908,  -2863,  -1832,   4645,
-  -722,   -284,   -161,  -5106,   7110, -12494,  -1514,  -5453,
- -3308,   3520,   1101,  -1096,  -2325,   -746,    -33,   2645,
- -4458,   -797,   -684,   1514,   1716,  -6204,   6580,  -3427,
-  -650, -10493,   4868,   5833,  -2385,   -274,   1530,   3892,
- -1940,  -1415,  -2389, -11499,  -2064,    937,   -333,   1361,
- -1583,   5458,  -2296,  -3263,  -8344,  -4236,  -6357,  -2372,
- -3115,   1336,  -2184,    194,  -4262,  -7838,   6946,   4535,
-   749,   7332,     67,   -327,    273,   3211,  -1825,   -357,
-  7039,   3346,   6282,    488,  -3940,  10196,   6463,    327,
-  4407,    909,    889,  -4943,   -622,  -4049,   2532,   1870,
-   652,   1778,    663,   3063,  -1012,  -1390,   4162,  20486,
-   -86,   3166,    325,  -1912,    511,   -634,   1262,  -4719,
- -1490,   6767,  -3314,   -125,   4490, -10334,   5386,   9932,
-   781,    290,   2198,   1695,   3790,  -1878,   7760,   -300,
-  2021,   5508,   2200,    232,   7138,   1370,  -3268,   3496,
- 13934,  -1230,  -2303,    958,    141,   3348,  -2867,   -987
-},
-
-.cb0808s1 = {
-  9313,    734,   6610,  -3629, -12020,   5317,   -244,  -1858,
-     2,  -1812,  -6486,    892,    926,   -236,   1016,  -1249,
-  -469,   -238,  -1908, -10594,  -4704,   -907,  -7746,   3847,
-   564,  -5956,   3395,    371,  -5136,   4001,   1180,    769,
-  -555,  -1872,  -2943,  -1744,   8620,   1485,   9901,  -1392,
-  3425,  -7940,    151,    376,   1984,   3031,   3815,   -974,
-   537,  -7038,   1964,  -5625,   4457, -10214,  -1787,  -2768,
- -8514,    176,  -3692,   6441,   3148,    602,  -2000,  13769,
- -2792,   1104,  -2067,  -6219,   1515,   -288,   3240,  -5490,
- 11589,   3742,  -2343,  -1752,   3701,   7525,  -1676,    845,
-  6895,   2884,   3540,   2454,   1010,   2454,  -5761,   2035,
-  3369,  -9628,   -862,  -7060,   1802,   5676,   2396,   2757,
-  5891,   -701, -11896,  -4061,   7932,   -272,   2562,     83,
-   560,  -5180,  -2223,   -356,  -3343,   2874,  -1370,  -7612,
-  1773,   2006,  -4258,   5312,    342,   8196,   4939,    519,
-  3568,   4420,   2768, -11872,  -3021,   1893,   1690,  -5483,
- -8129,   7540,   -116,  -2064,  -4473,   1141,   1930,    656,
- -7728,  -2742,  -3276,   2782,   2860,  -6082,   5198,  -4751,
-  -486,   -789, -16932,   -566,   5116,   1196,    832,   4282,
-    78,   3088,   2768,   2125,   1027,   1712,    310,    808,
- -1595,   -106,   3174,   4598,  -2945,   1551,  -7688,    620,
- -1640,    339,   4538,   3339,    532,   -351,    260,    249,
- -2135,   -543, -18362,   -648,  -3871,   5514,  -1782, -11301,
-  -374,  -2078,   1610,     50,  -4439,  -2546,  -3058,    839,
- -9221,   2618,   1790,    103,  -1061,   -363,    285,  -3542,
-   503,   -437,     30,   1382,     75,  -2852,  -1028,   3095,
-  4318,  -2316,    739,    801, -22765,   2162,    913,   1698,
-   149,   2049,   -313,   -803,   3393,  -1476,   4396,  -4003,
-   854,  -1344,   1062,  10009,   6332,  -8522,  -2616,  -9904,
-  -390,  -3146,  -2951,   4222,   5538,    495,   3776, -13684,
-  4687,  -2187,   -905,   4997,   6209,   4775,  -1234,   1956,
- -4607,   3006,   -370,   -670, -12448,  -5802,   8151,    140,
-  1485,  -6340,   2139,   1231,     22,   -212,   2090,   -676,
-  2366,   -701,  -4113,    365,   2970,   -577,    918,   7324,
-  -709,   2035,   5162,   7232, -13287,  -3259,   -908,  -1900,
- -4255,  -2590,    318,   4891,    696,    -40,  -1647,   1572,
- -1221,   4896,   5241,     49,  -2083,  -5068,   7645,   8978,
-  1628,   2895,  -4930,  -8068,   2266,   2025,  -1868,   3250,
-  2642,   -785, -14571,   9979,   3481,  -2246,   1154,   2646,
-  2616,  -2033,  -2936,  -1300,   2490,    879,  -1237,  -1228,
-  -724,  -1780,    524,  -6619,  -3339,  -2526,   3533,    844,
-  2946,   2208,  -3522, -12411,  -3062,   2380,    448,    604,
- -4708,   2403,   1914,    -58,    149,  -3704,  -2019,   4246,
- -7020,  -3197,   -712,  -2219,  10036,  -2776,  -3166,   2648,
-  2947,   3386,   6445,   1587,   -268,   -536,   1895,  -9005,
- 10791,   -982,   8215,   6414,   5166,   4751,    160,   3050,
-  -865,   6216,  -1187,  -7077,   1640,   5078,   4354,   1762,
- -3869,   1174,   -149,   1078,   1884,   5149,  15091,   -432,
- -2441,  -1102,  -1194,   1078,  -1535,   8289,  -2702,   4007,
-   694,     72,    685,   2816,  13244,   -422,  -7094,    432,
-  2044, -12004,   -276,   2174,   -908,  -4784,   5725,   -250,
-    22,   5116,     -2,   2686,    955,  -8509,  -7697,  -3735,
-   672,  -1202,   4299,   4284,  12352,  -2362,   5757,   1317,
-  4293,    508,   3050,   -524,   1097,   3346,   -537,  -2440,
- -1596,  -5659,   4188,   -625,   1659,   3061,   2791,   1712,
- -2991,    966, -16903,    610,  -3314,   4160,  -3750,    580,
- -3407,   -340, -11829,   -520,  -1625,   2905,    674,   -147,
- -5284,  -4278,  -5021,   4635,   6299,   2207,   2595,  -7811,
-   -68,   4107,   4314,  -1540, -11044,  -2214,   -803,    232,
- -7602,    -95,   1130,   4991,   -361,   1675,   4487,   3607,
- -6192,   -130,    137,  -1440,   2826,    178, -13834,   -984,
-  1149,   1230,   1587,   1571,   3286,   5293,  -2259,   2021,
- -6211,  -7608,  -2710,   2502,   4315,   -539,  -8530,   -746,
-  -654,  -4003,  -5917,  -3728,   4522, -10350,  -1266,    210,
-  5078,  -2988,  -3866,   3919,    969,  -1063,  -6300,  -4584,
- -2420,  -2094,   -884,   2338,  -3150,   5461,  -1145,   -734,
-  1644,   2183,  19114,  -1144,  -2313,   -404,   1236,   3583,
-   134,   1802,  -4088,  -2795,    681,   3738,   1831,  16571,
-   917,  -2290,  -3648,  -1588,   -158,   -528,   -792,    394,
- -7432,   2446,    402,   -391,    -73,  -1398,   1286,  -6503,
-  5216,   1094,   -939,   1673,  -2038,  15842,  -1971,   4160,
- -1664,   7231,    642,   5770,   4209,  -1839,    220,   -266,
-   165,   2055,   5222,  -3344,  -6544,   5412,   1514,    586,
-  1591, -15256,  -2715,    941,   1308,  -9170,  -2863,   4935,
- -2913,  -1291,   2791,   7967,     14,  -1101,   3774,   3580,
-   848,   1337,   1138,  -2839,  -3564,  -5300,  12429,     14,
-  1466,  -7114,   1198,  -3474,   -237,  -2577,  -1305,    445,
-  1069,   -174,   1684,   3902,    229,   5842,   -690,    978,
-  -754,   1182,   -859,  21078,   -185,    710,    797,  -2155,
-   367,  -2168,   1002,   3805,   -924,    468,  -2322,  -3590,
-  1608,   3387,     18,   1536,   -858,    642,  -7964,  17689,
-  9843,  -4878,  -3003,   7373,   5934,   4286,  10484,    -63,
- -4629,    974,  -2227,   2602,   3810,   1905,  -1668,  -2130,
-  2020,  -2360,   2853,    612,   5070,  -1248,   -868,   -497,
-  3478,  -1937,  -3006,   -645,   3589,   3019,  -3293,  16469,
- -5243,  -2918,   1788,  -2569,   3717,  -9630,  -1352,  -3870,
-  -416,  -4190,  -8863,  -6888,   -498,   -814,   -783,  -4625,
-  5841,   1562,  -2173,    481,    280,    816,   4742,  -9962,
- 11799,  -2029,  -2460,   4972,   -600,  -1452,  -1901,  -2122,
-  3130,   2686,   -819,  -2366,    866,  -2093,   1052,    -58,
-   284,   3830,  -4738,  -4114,  -1321,   1307,  -2820,   4915,
--11701,    522,  -1982,   7024,   8403,   1762,    -46,    532,
-  5097,   5013,   -615,   3086,   2089,   6899,  -1107,  -4047,
- -2903,   5356,  -4802,   -965,   6706,   3895,   9022,   1388,
- 10971,   5927,  -2954,   -965,  -3473,  -5177,  -2654,   3418,
- -5315, -16695,  -6587,   -416,    404,   1230,  -2586,  -3292,
-  1390,     14,   -481,  -4446,   1335,    109,   1060,   3958,
-  1275,  -5655,   1253,  -2411,    207, -12550,   6208,  -2447,
- -3415,   2503,    848,   3094,   9336,   2647,   2455,   2238,
-  2356,  -2132,   5347,    915,   2227,   -103,   5832,  -2504,
-  7562,   9568,  -6100,   4091,   2668,  -1722,    287,   6763,
-  4058,   -387,  -2060,   5522,   3184,   4766,   -158,    650,
--11284,  11841,   6230,  -4232,   5308,   3174,   4926,  -2970,
- -4761,   -980,    117,   1944,  -1974,  -5484,   6534,   -266,
- -7222,    924,  -2654,   -588,   9609,  -2337,   1892,  -2110,
-  5088,   1856,   7964,  -4029,   -940,   1429,    805,  -4705,
- -1362,    892,   -189,  -8354,   3259,    194,    767,  -2877,
- -4165,   -990,  12185,   -160,  -2002,  -1384,  -5388,  -1604,
-   226,  -6353,  -4157,   1773,   2360,  -4356,   -730,  -5462,
- -4054, -15669,  -1528,   -394,   4101,   -203,   2792,   -787,
-  3391,   -299,   6384,  -1630,  -7186, -12765,   4618,    934,
-  -401,   2790,   2284,  -4932,  -1260,  -6009,  -2590,  -2285,
- -1289,   3366,  -4192,  -4462,  32767,  -3135,  -1888,     67,
- -2874,    150,   4760,  -1571,    584,  -2187,    358,  -1733,
- -1286,  -4573,  -2003,   1872,    940,  -1942,   -255,  -8856,
- -1320,  -3348,   4854,   -509,   2836,    -14,   2490,  -1537,
-   882,   1188,  -3132, -15209,  -1633,    -44,  -2827,    368,
- -1099,  -1073,   -467,   6318,   5863,   2840,  -5200,    569,
- -2984,   6587,   9596,  -4924,    457,   4879,  -4449,   3528,
-  1868,  -3894,  -3905,  15420,  -2590,   -599,  -4975,   3892,
- -1454,   -616,   1890,  -2700,  -3268,  -1386,  -1065,  -3078,
- -2454,  -1902,   4726,    -34,  -4218,   1619,  -3074,   5540,
- -6392,  -3570,   2687,  -8742,    333,   -106,   2326,  -1737,
- -3775,    397,  -3553,  -6632,  -6066,   9567,   2904,   -889,
-  1136,   1295,  19390,   -268,  -3127,   -180,   1696,   -814,
-  -775,  -4914,   -456,   -758,   -866,   1102,  -3740,   -374,
-   469,  -6902,   1440, -10243,  -6221,  -4797,  -3074,  -1142,
-   297,   5069,  -1547,   5474,    716,   -454,   3806,   4100,
-  2901,  -2169,   -744,   5032,  -5586,  -2986,   2286,   2414,
-  7860,  -2672,    -46, -10046,   5348,  -1018,   1016,   9142,
-  4543,   5587,   2228,  -2684,  -4594,  -2457,  -1850,  -3651,
- -1806,   4826, -11686,   1940,  -3529,   1078,  -5234,  -2420,
-   -83,  -2322,  -5134,   -775,    677,  -9257,   -864,   -915,
-  4494,    411,  -4820,   5999,   4472,   5823,  -4597,   3121,
- -1868,  -1539,   2338,  -4249,   1154, -13422,    791,  -1235,
- -1240,    364,    177,  -1508,  -2527,  -2949,  -2062,    118,
- -3115,    293,  -1927,  18644,  -1100,    152,  -2528,   1914,
- -1380,  -1624,    302,   -831,   -920,    320,   -879,  -1252,
-   813,    -11,   6960,   -522,   3092,   -119,   1486,   3068,
-  6690,  -3079,  13305,   6342,    937,   1632,  -1026,   1896,
- -2335,  -3961,   5510,   2782,    187,  -2448,  -1251,    756,
--15856,   3179,  -1155,    808,  -1748,  -6593,   1494,  -3122,
-   -98,  -3808,    491,   1752,   3188,   2158,  -1924,    763,
-  1165,    148,  -3161,  -1284,  18082,   -195,  -1125,    845
-},
-
-.cb0808m0 = {
--18656,   -461,    236,  -1122,   -796,   -101,    851,  -3748,
-  1374,  -8549,  -3366,  -1482,   1026,   2046,   4394,   -521,
-   232,   -486,  -1656,  32767,   1954,  -1183,   -130,    392,
-   194,   -868,   2883,   -168,  -1674,   -910,    -34,    819,
- -1105,   1628,  -4871,   -585,  -1170,   -572,    451,   3911,
- 10770,    -35,  -4126,   7124,   7110,   -860,  -3914,  -3294,
-   272,   -647,    220,  11965,  -3378,   2726,   1990,   1624,
- -3689,   9884,   2394,   3096,   -518,   5169,  -4018,   3108,
-   168,   1256,   -410,  -3851, -11176, -10479,   2042,   1421,
-  1488,   -992,  -1562,   -653,  -1191,   2246,    467,   4732,
-   154,    729,   7244,    -18,   1313,    -51,  -1824,   1218,
-  1473,  -6763, -11270,  -4295,   4118,   1043,  -5782,   1370,
-    46, -11027,   4086,  -1501,    -11,   -621,    464,    781,
- 13680,    257,    554,   3119,    750,  -1857,   1046,  -1252,
-  -512,    739,  14811,  12642,   3841,   2824,    163,   1620,
-    39,   4766,   1411,  -2197,    525,    658,    419,      5,
-    92,   1544,    290,  -2038,  10603,  -5764,  -3335,  -6629,
- -2579,   4020,  -3107,   2779,    849,   5678,    260,   2804,
-    99,   1339,    544,   1438,   -450,   -598,    764,   1568,
- -1034,  -4560,   2604, -18205,   1644,   1003,   -675,   3217,
-  -334,   -832,  -1452,    322,    608,    300,  -4776,   -812,
-   -36,    627,   1654,   -248,   -838,  21571,    -89,  -1626,
-   530,  -1151,   9440,    522,  -6138,   2213, -10095,   -562,
-  1000,   5037,   -122,     -3,   7064,    397,  -2118,    362,
- 15791,  -1047, -15010,  -1527,  -1356,  -2805,   -560,  -3148,
-   266,    -45,   1324,  -3312,  -1772,   2382,    189,   6537,
-   124,  -1272,    156,    588,  -2678,  -3106,   2828,  -3684,
-   689,   3884,   4650,    192,   -323,  -5426,   -722,  11486,
-  -607,   3591,   4299,   2117,    362,  -9114,  11700,  -3391,
-  2357,   7639,   2197,   4350,   2970,  -2525,    169,  -6112,
-    91,   1520,    -19,   1558,  -4588,   -837,  -8163,    897,
- -7992,   2080,  -3102,    774, -10592,   -314,   -137,   -524,
-    87,   -799,   -111,     74,   1312,    862,    266,    243,
-   199,   -288,   1205,   -829,   1650,   2880, -24776,   3867,
--13101,    597,  -9778,  -2084,  -3089,  -1112,    548,   -638,
-  3727,   -446,   4877,   2099,     68,  -2736,  -4914,  -7103,
-   263,  -9228,   -782,  -2109,   1088,  -1881,  -1424,    -30,
- -1353,    586,   4085,  -3573, -11921,   2366,    516,  -1028,
-   834,   -234,   2150, -15893,   2305,  -3619,  -2567,  -8366,
-   610,   2946,  -2383,   2293,    946,  -3550,  -6770,  -1481,
-  -758,   -864,   -232,   2855,     40,  -2330,   2069,   -345,
-  1801,   -589,  -1241,    647,   6988,  -2625,  14308,   2801,
-   759,  -2740,   -680,    964,    365,   -506,  22268,   1766,
-  -202,  -2751,   -293,   3754,   1280,   -521,  -3355,   4615,
-   594,  -1783,    -39,    -46,     48,  -2638,   -551,   2548,
- -1880,   3730,  -1726,    939,   -345,     -7,  -1630, -23405,
- -1002,   5655,   2100,    440,   1682,   1020,   -594,    344,
-  1511,  -1286,   5518,    473, -11398,  -4552,    720,   4701,
-  7726,    126,  -1953,   -484,  -1648,  -1766,   1589,    996,
-  -688,   -381,   1678,   1498,   -528,   -860,   -667,   -823,
- 32767,   -463,   -243,  -1242,   1074,   2460,  -1411,   -459,
- -1533,   1462,  -2603,   -784,   -391,    338,   3444,   2170,
-  -924,    949,   1972,   1520,  -3062,   -671,  12908,   2636,
-  2805,    722, -12016,    -26,    616,   1192,   1193,  -1028,
-  -128, -22850,    191,    408,  -3105,   -592,   -440,   1264,
- -2580,    847,    850,   2300,   -278,    126,   2214,  -2693,
-   -21,   -194,   -594,   -533,     45,    570,     38,    636,
-  1276,    171,  29846,    648,    911,   -358,    300,    602,
-   413, -10167,    -54,  -1353,     42,  -1770,    491, -12154,
- -1808,     26,    425,   2009,    910,  -8134,    362,   2001,
-  -114,  -2586,  -1049,   -249,   -312,    160,   1677,  27043,
-   -44,    160,    834,    243,   -606,   -272,   -979,  -1605,
-   105,   -491,    754,   -230,   2442,     24,  -5139,   -395,
- -3562,  14436,  -1208,  -3232,   2555, -12980,   -906,    429,
-   217,   -432,  -1263,   -244,   -225,    912,    -64,    780,
-  1101,    854,   -240,    308, -28630,    518,     32,    976,
- -8642,  -3041,   1801,   -742,  -1513,    128,  -3189,    857,
--14277,  -1802,   1229,    -68,   -565,     65,   4094,   1614,
- -8254,  -1153,   -640,  16225,   3508,  -1383,  -3882,   -347,
-  1346,   3845,   2665,   2340,  -1862,  -5318,   1402,  -1352,
--21682,   -694,  -1182,    286,   -806,   2133,   1848,   -532,
- -3750,   7564,   1054,    284,  -3742,   2559,   2748,   3408,
- -1544,   -342, -22578,   1225,    958,   2559,    267,    378,
- -3608,  -1404,  -1669,    -13,   1135,    153,   -625,   1436,
-   211,    556,    739,   1094,  10452,    850,   5128,  11469,
-   121,   4937,  -3643,   1371,   -373,  -6686,    229,  -3256,
-   -75,   1304,  -1023,   -452,    288,  12709,  13572,   -501,
-  1840,  -1044,  -2014,  -4077,  -2726,  -1010,  -3826,   -629,
-  -466,   -923,   -847,   5784,    898, -12036,   1253,  -1741,
-  1546,  -3710,   2782,  -3430,  -1810,    263,  -8254,   3126,
-    55,   -376,    202,    968,  -1686,    944, -15300,  -2664,
-  1393,    783, -11080,   1714,  -1666,  -1064,  -4859,  -2344,
-   334,   1313,  -1209,    877,  -1828,  -2130,  -3057,    340,
-  8030,  -3222,  11622,  -5620,   1469,   3340,   2862,  -3945,
-  -868,    351,  -1314,   2277,  -2346,  12384,    996,  -2460,
-  1810,    703,  -2158,   3168,  -9887,   8754,   3503,  -1414,
-   445,    850,    -30,   2389,   -617,   3271,  -1606,  -5633,
-  2993,  10009,   5704, -11589,   4278,   1304,  -2418,    479,
--16596, -12349,   2915,    327,    895,   1278,   1412,   -310,
-  -653,  -1287,    880,  -4294,     38,   2179,  -2074,  -1810,
-   198,  -1544,  -8008,   2456,  -2821,  -3223,  -3713,  11763,
- -2081,   -141,   4833,   1652,   3598,    551,  -1655,  -1154,
-   -60,   -302,    739,  -1494,   2595,  -1006,   2665,  10834,
--11270,  -2996,   -636,   -446,   1816,  -1539,   4149,   -184,
-  -100,    -55,    265,   2207,    639,   -162,  -2210,   -626,
-   605, -21149,   2163,   -970,   -330,  -4655,   3396,  -3092,
-  -544,   -650,   -304,     93,  -1484,   -888,  -8982,   1871,
-  1701,  -1423,   1671,    -11,  -1287, -14292,    592,   1040,
-  -622,  13202,   -660, -12745,  -2836,  -1832,   3481,   1546,
-   235,   -646,   2132,   -602,   2391,   1534,   3599,  -4932,
-  -296,  -1855,  -2075,  -2646,   -219, -10248,   1161,   5955,
-  6954,   9109,   3498,  -5932,  -1787,    373,   1234,   1244,
-  -813,    -76,   9083,  -5120,   -499,  -1774,  -2150,  10601,
-  -170,   1160,    982,   -597,     95,    151,   -534,   6554,
-   840,   -958,   -720,   2066,    -50,  -2877,    -74,  -2068,
--24760,   -725,   -357,   1273,   1941,   2525,     46,   -819,
-  -230,   1030,   2291,   -287,   1092,  -2315,    427,    -19,
-   448,   1698,   9797,  10962,   3034,   2622,  -2652,  -1128,
-  -194,   -180,  -1176,  -1794, -22248,    244,     -3,  -1856,
- -1054,  -2751,   -459,    -62,   -433,  -2274,  -1790,   -192,
-  -720,   -421,     55,   -721,   1960,   1094,   2500,  -2353,
-  -480,   -784,  -1221,   -505,   1738,  -9960, -10772, -13657,
-   122,    387,   -667,   -454,    988,  30780,   -757,  -2319,
-   878,    962,    753,   1306,    716,   -771,    539,   -705,
-   508,   1915,   2114,    937,    447,    935,  -1432,  -1143,
-  4435,  11759,  -2442,    -53, -10601,   1979,   5419,  -2296,
-  -172,  -5987,  -1168,  -2012,   2257,  -1451,     97,  -1253,
-  5548,    884, -14448,   3134,   2549,    172,   5404,    869,
-   -83,    597, -12416,    762,  -1035,   -805,  -1369,   -804,
-   664,   9644,  -4329,   1130,  -1526,  -2900,    628,    620,
- -6436,  -2370,   2107, -11836,     37,    864,   2105,    314,
-   216,   -529,    810,   3141,   3716,   7019,  -2653,   1466,
--14940,  13128,   1218,   2287,   -145,   -443,   -923,    476,
-  2411,   5428,   -611,   2212,   1450,  -3042,  -4750,   3562,
-   587, -15378, -15151,    600,   1029,  -2353,   -934,   1986,
-  1444,  -2171,   1020,   -700,  -1508,    195,  -2466,   -798,
- 16460,  -2164,    520,   2711, -13832,  -2024,   -871,  -5268,
-  3556,    117,   -416,     -8,   2128,  -1570,   2052,  -3169
-},
-
-.cb0808m1 = {
- 16492,   -295,   2556,   1303,   -440,   7584,   3305,  -3422,
- -1196,  -1809,   2142,  -1292,   1048,    314,   1945,    578,
-  1080,   -255,   1109,    617,   1597,    198, -29081,   -243,
-    54,    -33,     76,   -418,   1332,    475,   1495,   1554,
-  -782,    308,  -1286,   1044,    300,   1544,    646,   9441,
-  2577, -11140,   1421,   1107,   -483,   -590,    625,   8544,
-   446,  -1814,   1714,    685,   9620,  -4981,  -3100,   -724,
-  8439,  -2333,    506,   3557,  -1160,  -2199,   -659,   4107,
-  8620,  -1406,  -3745,   1729,  10756,    868,    -82,   2584,
- -3140,   3632,   2617,   3880,  -1175,   -163,   1864,   -980,
-   551,    201,   -433,  -1464,    708,   1926,  -8471,   3870,
- -2376,  15567,   2112,    753,  -2450,     72,   1131,   2932,
-  -139,   6392,   1547,      3,    625,   -823,  -1750,    811,
-  -977,  -1389,   1300,   1184,    399,   4684,    196,   3679,
- -1672,   -218, -11023,     98,    492,   4072,   1213,  -2004,
-  3602,  -1787,   1288,  -9442,   4157,  -4267,   3509,   5317,
-  -574, -11094,   1078,   6240,   1593, -12773,    408,   3960,
-  1116,   1517,   -816,   -577,   -696,    554,   1645,   -936,
-    83, -20255,   -754,   1460,   1110,   1412,   -757,    377,
-  2373,  -1608,  -1414,  -1028,  -3152,   1534,  -4145,   2274,
-  -286,  -7058,   2286,   4013,   2515,   2681,  -5602,      0,
- -1740,    257,    756,  11496,    954,   4513,   3968,   4851,
-   278,   -511,    829,   2853,  -9743,  -3723,  -1550,   -444,
-  4256,   -679, -11411,  -4290,  -1470,  -4191,   -952,   -239,
-  -198,   1361,   9527,   1481,   -981,   1403,    991,   -255,
-  9326,   1832,  -1936,   -135,   1123,   2756,   1932,   2543,
-   795,  12612,   2429,   -498, -13185,   3812,  -1628,    196,
-  1822,   4333,   2760,   -676,  -2902,   1244,  -1974,  -7046,
--12216,   1503,  -2176,   1916,    365,    636, -11348,  -5030,
- -3319,  -3794,  -1016,   1157,  -4158,   3424,    344,   4494,
-   812,  -3074,   4356,    293,  -3463,   1232,   1746,   2696,
- -8269,   -961,  -4316,    130,  -4278, -14007,   3025,  -2703,
-   179, -10176,   1511,  -1460,  -1100,  -1171,  -1575,  -2596,
- -2026, -11400,   2689,   1480,    743,  -1669,   2728,    742,
-   -60,  11452,     84,   -662,   1424, -15103,   -410,   2141,
- -1664,  -1378,   -122,     97,   -358,   -820,    382,  -3865,
-   374,   1698,    -21,   -752,    595,  -8771,   -731,   9368,
-  1698,  -2586,  -6790,  -2507,  -1776,   4993,  -3867,  -2807,
-  -190,  14465, -13938,   3095,  -1198,    374,   1682,   1888,
-   286,   -576,  -2094,    454,   -690,   1396,  -1139,   -422,
-   405,    238,   1718,   2048,  13448,   -151,   -247,    202,
-  -900,  -5630,   3121, -10988,  -1615,   1955,  -3901,   3360,
-  1429,   3928,   1951,  -1099,   -435,   1572,   1500,  19176,
-   731,   -439,   3686,  -3039,    244,  -4270,    -34,   1289,
-   296,   -406,   2216,  -1400,  -1946,    264,   1536,   2992,
-    54,    892,   -181,  -1545,    278,  24923,    989,   1301,
- -1279,   -188,   -198,   -661,    612,  -1520,   2355, -12972,
-  -694,   -560,   1364,  -2988,  -6236,   2555,  -6630,   1423,
-   440,   -598,  -1092,    304,  -2529,  -1698,   -909,   2560,
-   844,    768,  -2988,   -661,  18432,   1158,   -639,   5070,
- 11015,    -14,   2313,    756,  -1941, -10986,   -490,  -5235,
-  2646,   2406,    170,   -546,    337,   6499,  -4450,   5598,
-   299,   -504,  14322,   -972,   9356,  -2056,   8812,  -1599,
- -1931,   2084,    119,   -983,   -305,   1437,    403,   2651,
-  -159,    229,    209,   1438,  -1789,  -1159,   1017,    416,
-   408,    454,    858,   -652,  -1554,   1198,  18278,    122,
-   433,   -165,    162, -10532,  11563,   4754,  -2022,   4246,
- -1396,  -2417,  -1796,  -1496,  -1279,   3877,  -1217,   -770,
-   983,   -609,   1766,   -184,  -5664,    546,   7948,   1978,
-  -250,   4350,   3498,   2797,    802,    846, -12628,  -1092,
-  -240,    781, -11252,   -955,   9944,   -222,   1177,   1262,
-  -534,   1790,  -7396,   1452,   4251,    303,  -3714,  -2295,
-  -290,   -227,    672,  22690,   -622,   -466,   1599,   -496,
-   326,    871,  -1948,    148,    449,    214,  -2175,    713,
-   394,   1921, -28716,   -786,   1083,   -641,   1232,   -246,
-  1572,   1575,   -879,  -2962,    -57,    369,   1633,  -1457,
-  1194,  -1222,    304,   -955,    104,  -1249,   -935,    135,
-  -758,   3483,  -1190,   1457,   1130,  -1284,  -3709,  18042,
-     6,     25,   1233,   -328,    347,   -512,   2071,    328,
--18037,   4582,   3841,   -434,   -745,    332,   -576,   3006,
-   336, -11505,   -646,   3509,   -996,   1270,   2041,   1353,
-  1193,   2976,  11569,  -3165,   1450,   4351,   2522, -10022,
-    -6,  12602,    874,    518,    475,   1251,  -3290,  -2674,
-  4802, -11794,   -946,   -426,  -2846,   1619,   1105,  -1022,
-    -1,   1759,    646,  10347,  -2937,  13505,   1104,    614,
-  1149,   -800,   2377,   -115,    792,   -948,  -2431,  -1779,
- -1142,    809,  -3130,    447, -15516,    313,  11235,  -1346,
- -2426,  -2737,  -1738,   2236,   1094,    802,   1323,   3612,
-  -213,   1383,   2800,  10394,   1210,  -2360, -10203,  -1991,
-  -102,  -2669,   2303,  -2184,   1830,  -1158,  -5633,  -4083,
-  -252,    311,    612,   -331,  -2786, -12421,   9994,  -6006,
- -4996,   -954,   1014,  -1147,    860,   1252,   1114,  -2069,
-   266,   -230,   -591,  -4442,    230,  20603,   1386,   1130,
- -1468,  -3600,   2168,    836,  -1754,   -511,   -542,    216,
-    26,   3476,   1165,  -4293,   3098,   -245,   -579,   1830,
-  2248,   5326, -18357,    397,   5466,    734,   3920,  -3678,
-   319,  -1062,   -610,  -7509,  -1064,   1456,  -5729,   1088,
-  9099,   2266,    241,    201, -10017,  -1545,  -2799,   1491,
- 27098,    -60,  -1736,   1387,    859,  -1474,    -79,  -1122,
-  -971,  -1302,    906,  -1133,  -2659,   -296,   1344,  -2698,
-  -448,  -1476,   -212,  -1585,   1310,  14353,  -2165,  -2229,
-  -656,   5219,  -3266,  -1850,   7942,   4997,  -2295,    519,
-   608,  -9498,  -1700,   1770, -15308,   1286,  -2914,   2252,
-  -717,   2136,   2478,  -3747,   2362,     -5,   -237,   2334,
-   701,   -774,   -672,    -20,   -599,    623,   -700,   -713,
-  -979, -29926,  -1090,    848,   -141,   1273,   -711,   1782,
-  -221,   -103,    170,   -185,  -1059,   3066,   1321,   1182,
-  3641,   -217,   1959,  11806,   2390, -10312,  -2575,   1612,
-   596,   -352,   2197,  -2041,   2385,   -898,  -9363,  -1144,
--10896,     20,  -7842,  -1047,   3687,   2147,   2584,   -249,
-   -72,  32767,   1936,    446,   -889,   -845,   -896,   1269,
-   448,    327,  -3411,      4,    702,  -1900,   -646,    799,
-  -770,    662,   -911,   -856,    287,   1667,   -108,    -64,
-    16,   1578,  -2059, -27327,    112,   -188,   2504,   -692,
-   250,    360,    564,    868,   4147,   1340,  18080,  -3584,
-   445,    364,  -2623,   -412,  -2918,   -116,   2611,  -2396,
-   -44,  10934,  -1512,  -1166,    239,    913,    190, -14681,
-  -767,   2610,   2931,  -2389,   3590,  -1680,   6287,   -531,
-  -616,   1317,  -1034,   -900,    871,   -329,    467,   1200,
- -1914,   1108,   3150,  -6878,    544, -14411,   2807,   5427,
- 13361,   1448,  -1753,    524,  -5851,   1467,  -1866,   6888,
- -8742,   1372,  -1515,   4883,  -2248,  -1042,   4628,  10768,
-   149,   -358,  -1287,  -1289,  32767,  -1137,    941,  -2112,
-   451,  -1436,    174,    294,    475,  -3667,   1610,   1641,
-  -599,    626,   2058,    671,   1626,   -985,   -123,   2040,
-   421,   1797,  18448,   2538,   -359,  -5042,   3096,  -1136,
-  -320,   1823,     30, -12002,  -1297,   -850,   -418,  -1497,
- -1761,   5073,  10944,    212,  -4713,  -1614,  -1752,  -2135,
-   483,   1043,  -1989,   -293,     39,  -1049,     67,  -7482,
-   712,  -5358,    896,  12460,  -1744,  -1793,   1538,   3577,
-    -6,    418,    -72,   1072,   1367,   1080,   3564,   1468,
-   482,  -1298,  -6442,   -299, -12934,   -757,  -4199,   3842,
--11331,  -1216,   -206,   1598,  -1135,  -3240,   3294,   -286,
-  -540,    777,   1188,  -1189,   4516,   2638,   2071,   9702,
-  -900,   1002,  18707,   -705,  -1856,   1185,  -4832,  -1694,
- -3502,  -2324,  -2826,  -4600,   1996,  -3110,    110,    117,
-   405, -16854,   -510, -14725,   1699,   1922,  -2117,  -2718,
-    45,   1064,    507,  -1781,   2106,  -2310,   1239,   5860
-},
-
-.cb1108l0 = {
-  2354,   8016,  12528,   -947,   -348,   1760,   2054,  -3960,
- -2125,  -3578,   3932,   1647,  -3316,   6053,    392,  -3128,
-  3209,  -2445,    463,  -2835,  -1555,   1259,    296,  -1465,
-  1839,  -4811,    420,   -215,    469,  -1013,   -272,    185,
--27061,  -1154,      8,    298,    259,   -953,   -555,    472,
-   617,  -1127,   -673,    982,   -398,  -1681,    328,    882,
-   614,    800,    431,     84,    880,   -240,  15758, -14324,
-  1301,   1578,    932,   -694,  -1456,   2435,  -1651,   1464,
-   227,   1527,    527,   -128,    698,   2405,   -726,   1489,
-  1016,   1938,  -1897,  -1478,   -238,    932,   2507,   -519,
- -1147,    557,   2334,    700, -12914,  14861,    158,    255,
-  1195,   -883,   3359,  -1045,   2095,    520,    249,    926,
-   789,   1392,   -185,  -1654,    902,      9,  -2166,  -1916,
-   543,  -2126,   2842,   -332,   1356,   -344,    436,   -404,
-  -174,   -489,    858,    258,    229,    -45,    327,   -316,
- -1176,   -454,    115,   -220,   -458,   -194,    271,   -530,
-  1572,   -574, -25068,    167,    601,  -1027,  -1705,  -3144,
- -4231,  -1636,  -1012,  -1002,   -519,   -825,   -458,    945,
-   546,    193, -17909,   -156,  -1067,    826,    338,   1152,
-   562,   -506,    848,    239,    188,    656,     97,   -174,
-   -59,    242,   1946,    -67,    745,   2043,    424,   -192,
-   574,   -524,   1553,    566,   1480,   -747,    487, -20623,
-   872,  -1089,   1034,   1357,    919,    153,    154,    498,
-    54,    555,   -989,    707,    -85,    -21,    700,  -1424,
-    90,    655,   -399,    123,   -709,    117,    438,    330,
-  -720,    190,    812,   -138,    460, -32768,   -162,   -410,
-  -327,   -122,  -1208,   -554,   -502,   -178,   -309,    373,
-  4295,   -945,  -5502,  -2752,  -6615,  -1241,   1278,  -1315,
- -7683,   -986,   -419,    -50,   2384,  -4640,  -6246, -11804,
-  -308,   -446,   3486,  -4824,   1736,   -590,    960,    195,
-   593,    164,   3355,   1655,   1233,     66,   -787,   -347,
--13751,     74,  -1209,   -812,  -4098,   -102,    910,  -1659,
- -2036,  -3147,  -2075,  -2605,  -1240,   4499,   1727,  -9484,
-   549,    728,   3411,   1958,  -4439,  -1064,   5690,  -1600,
- -1984,   1695,   -588,   4815,   -138,  -3380,   -512,   1553,
-  1978,   4310,   -730,   -402,    828,   2124,  14216,   -222,
-  2757,  -8686,    523,   2516,   1017,    790,   -136,   -470,
-  -252,   -717,    808,  -1113,  13766,   -114,  -1182,   3053,
- -5238,  -2231,   1720,   -511,   -987,   1592,  -1257,  -2578,
-  1777,   1075,   2367,   -227,   2330,   -672,  -2620,  -1449,
-  2122,    362,   1249,   1338,   -327, -21631,  -1540,     24,
- -2356,   -656,   1981,    -92,   -207,  -2188,     34,   -457,
- -1291,   1231,   -460,   -128,   -396,    593,   -671,  -1513,
-   136,   -335,    560,  -1121,    490,   1008,    948,   8629,
- -3344,    467,    881,  -5731,   1120,   -300,  -1432,   1227,
-  1558,    990,  -1078,    214,   -922,    -81,   1120, -15586,
- -1176,   1203,  -1911,    151,   1484,   1555,   -421,   -420,
-  -428,   -762,    292,    -59,   1075,   -649,   -841,    494,
-   194,     27,   -768,   -356,     54,    163,    -73,    293,
- -1717,   -392,    750,    234,    751,   -111,  26858,    911,
-  -389,    451,    442,    260,   -117,    270,     19,  -2429,
-   618,   -962,    378,     10,  -1954,  -1336,    525,   -258,
-  -693,  -4155,  10265,   2924,  -1361,   3197,  10199,   6870,
- -2608,  -5792,    619,  -1994,  -2035,   -701,   2598,    465,
-  -575,    311,    175,    162,  -1191,    162,   -157,   -147,
-   325,    551,    536,   -188,   -290,   -165,    343,     14,
-  -268, -27113,    278,    127,   -233,    -68,    606,    125,
-   665,    438,   -442,   2510,    800,  -1991,   -641,   -386,
- -1574,     78,    946,    189,    106,  -2249,   -268,  -1708,
- -1192,    986,   3076,   1807,     21,  -5884,   -964,    256,
--15916,  -1320,  -2867,  -3562,    491,   3502,   -337,  -1542,
-   496,  -3182,   1676,  -2371,  -4264,  -2053,  14342,  -5674,
-  1744,   1813,  -3731,  -3761,   1350,   1783,   -438,   -920,
-  2366,   1438,   -687,    512,  -1934,    323,  -3158,   1775,
-  1964,  -6742,  10162,   7763,   1469,   1967,    851,   2742,
-  7413,  -3338,    742,   1854,    310,   -192,   -936,  -1770,
-  -775,   -976,  -1532,  -1436,   -670,  -4032,   1194,  -1336,
- -4369,    332,    604,    962, -27563,   -972,    842,   -743,
-   275,    713,   -251,   -799,  -1190,    372,   -213,   -423,
-   202,   1189,    -31,   1084,   -974,    756,   -148,  -1669,
-   640,   -549,   -339,  -1506,   -112,   -598,   -870,    410,
--13307,  13141,  -1911,   2308,    -92,   -776,    221,   1503,
-  1578,    803,   -308,  -1672,   -404,    -83,  -3517,  -1327,
-  -606,  -2426,    -61,   -513,    318,  -1805,   2049,   1887,
-  -777,   1268,   -542,   -116,   3550, -18840,  -2986,   -979,
-  2653,  -2875,   -922, -10520,    804,    107,   3234,  -1270,
-  -608,   1042,   3599,    965,   -342,  -2096,   -267,   1704,
- -3939,    791,   2180,   -985,    816,   -716,  -2661,     99,
-  1523,  11902,  -1782,    775, -12517,   3244,  -3762,   2046,
-  -278,   1539,   2895,  -2425,    -10,    990,   1484,  -1377,
- -3399,   -984,   3171,   1513,    696,   -785,    155,  -1072,
-   414,   2016,  -1932,  -3124,  -1126,     68,   3855,   1360,
-  4074,  17596,   1714,   -596,   4000,   1656,    230,   -258,
-  2266,    843,  -1720,   4624,   -714,    854,    696,    636,
- -1357,    350,  -1256,   -523,    168,  -9933,   -766,    198,
-  2680,   8060,   2168,  -2789, -14255,   1444,   -520,    169,
-  1032,   1478,    294,   -644,   -320,    856,   1282,   -216,
- -1000,   -925,      2,   -890,    679,   -629,   1152,  -1329,
--13941, -16385,  -1050,  -1022,    106,  -1151,    -41,   -709,
-  1771,   -882,   -729,  -1420,   1544,   -120,    386,   -838,
- -2744,   1559,    904,    273,  -4221,  -1065,   -312,  -1046,
-   234,    830,    387,    172,   -956,   -332,    360,    408,
-   125,     90,    348,    915,   -264,    911,    263,    124,
-  -620,   -612,    220,    164,    202,    124, -30252,   -159,
-  1006,   -320,    283,  -1641,  -1312,  -9057,   5525,   7520,
- -2884, -12194,   2771,  -1164,   1842,   1261,   -582,    766,
-  2498,    393,    953,   -617,   -756,   -323,  -1862,   1195,
- -1326,   -436,   -965,    366,  -6727,  -1226,   9014,    400,
- -1258,   -812,   -279,   -404,   1621,     86,   1622,    -16,
-    96,   -515,   -257,    -39,   -134,   1843,   -294,   -491,
-  -908,   -120,   -720,  -1162,  -1555,    405,   -134,    528,
- 23596,    -77,    183,   -444,   2077,    955,    649,   2246,
-  3236,    735,  -1202,   7954,   9440,   6134,  -7267,     28,
- -3398,    500,   4965,  -1230,    306,    357,   2942,   -906,
- -4733,    903,  -3945,   4447,   1046,  -1125,    465,   1183,
--12710,  -1018, -11302,   5177,   -219,  -6232,   1552,   2061,
- -1372,  -1290,   -822,    295,    814,  -3003,   -527,   -614,
-  -856,    802,    167,   1178,   -494,  -1625,    754,  -1550,
-   682,  -1286,   -480,   -694,     86,    -67,  -1429,  -1235,
-  -559,   -311,    322,   -308,    -56,    296,   -158,    -24,
-  -748,   -197,  26954,   1054,    209,   -226,    165,    681,
-  -131,    341,    341,   1510,    615,    907,   -264,   1355,
-   388,    198,     -5,    418,   -783,  28539,     82,   -559,
-  -459,   -344,    279,   -114,    966,   -529,   -423,    286,
-  -418,   -766,     42,    186,    461,    418,   -688,   2937,
-  2793,    146,   1709,   -665,   2022,    293,  -1522,  -2740,
--15926,   -600,  -1503,  -1732,  -2827,  -1027,   1702,    252,
-  -643,    470,   -815,    858,  -1954,   1190,   1847,    -16,
-   266,     29,    486,  25985,    139,    220,    433,   -330,
-   168,   -362,   -562,    180,    906,    386,   -845,    664,
-  1064,   -616,  -1498,   -335,   -164,   -930,   -854,   -869,
-  -101,   -204,    835,    117, -16034,  -4478,   2634,   1629,
- -1873,  -1156,   -373,   -526,   2537,    967,  -2433,   -857,
-  1264,  -1670,    113,    845,   7654,  -1343,   5245,  -1605,
-  2236,  -1190,    -48,   3340,  -1981,  -1606,  -1369,   -227,
-  -727,   -570,   1136,   1868,    667,     92,   -144,    531,
-   949,  -1086,    530,   1764,    302,    190, -28036,    182,
-   825,    229,   -656,    585,    444,    200,  -1195,  -1855,
-  -387,   -781,   1156,    692,  -1164,   -517,   -464,   -275,
-  -328,    218,   -970,    174,   -384,   -561,    -38,   -720,
-  -140,   1021,   -271,    -57,    463, -25313,   -342,    -40,
-    26,    159,   -854,    916,  -1532,  -1033,    265,    105,
-  -719,   -588,     96,   -435,   -296,   -226,    224,    357,
-    30,    576,    -66, -30037,    -72,    374,     32,    256,
-   304,   -852,   -706,    248,   -741,   -379,    980,    629,
-  1344,   3858,  -2211,   -153,  -3914,  -3775,   1570,    718,
- -1042,  -1338,  -4409,   1338,   5118,   5186,   3619,   2142,
-  9081,  -2784,   4169,   3598,   6621,   4562,   -170,   -614,
-  1196,  -1174,   5024,    721,    -71,    267,      4,  25598,
-  -369,    356,    331,   1099,    377,   -356,   -938,   1161,
-  -863,   1107,   -132,    222,    148,   1410,    908,     60,
-   377,   1280,    468,    690,    454,    247,  -4552,   6122,
-  -267,   2973,  -5932,  -6424,  -4983,  -4193,  -3386,   1691,
-  1349,   1419,  -3730,    300,  12150,  -2927,   1588,    -34,
- -2435,   -271,   -961,  -1744,   1881,    -73,   -453,   -788,
-  -798,   9166,   2744,    858,    342,    991,   -287,    822,
-   -37,   1156,  -1493,    723, -14127,  -1755,   2029,   -933,
- -1276,    632,  -5249,    464,   -272,   1149,   -290,   4693,
-  -728,  -1475,    841,     10,   -283,     92,   -268,   -295,
-   358,    160,    405,      2,   -381,    679,    716,   -190,
-   128,    275,    255,    123,   -412,   -453,   -273,     26,
-  -174,   -340,    644,   -376,  27584,    -25,     66,   3107,
- -1707,    911,    500,  -1029,   1029,  -1557,   9020,   -398,
- -2512,   -582,   1131, -16696,   -429,  -1284,     -3,   2320,
-  -532,   -302,   -174,   -146,   -413,   2152,   1009,     42,
-   402,  -1471,    157,   5742,   -782,   -229,   2379,    646,
-  2842,  -1776,   -463,  -2749,  -3617,  -1710, -12281,   -566,
-   263,  -3174,  -2337,   9590,  -1150,   2465,   4577,   2064,
-  -648,  -2175,  -1877,   -674,   -634,   -338,    343,  -1492,
-   878,   -530,   1072,  13670,  -4542,    746,   9704,  -4188,
- -7076,   1179,   -740,   -589,   -876,    268,  -1080,   -986,
- -4584,   2692,   3032,  -2067,    230,  -3533,    944,  -4950,
- -1908,   1452,   -255,   -698,   1460,   -606,   -250,   -154,
--22303,   -945,   1626,   -588,   -482,  -1549,   -129,    978,
-  -631,   -722,   1094,   1771,   -311,    532,   -508,    696,
- -1128,   1270,    854,    -84,   4290,    414,   3351,   1061,
-   931,  -2936,  -9606,    -35,   2514,  -1095,    567,   -452,
- -8520,   4037,   -431,   2744,  -2276,   2647,  -1188,   -454,
-  -400,  -3698,   -315,  11558,   -667,    512,    162,   -395,
--13015,    -11,  -1944,   -890, -14358,  -3850,  -4296,   1310,
-  -580,   -248,   1305,    402,  -1049,    115,   2085,  -1797,
- -1172,   -321,   -919,   -313,   -512,   -131,   1619,    576,
-   499,  -2024,    130,     14,    -76,  -6324,    495,   2445,
--16757,  -2348,  -2706,  -1906,   2377,  -2252,   -619,  -2579,
-   643,   -661,  -1276,    935,    893,    992,  -2204,  -2451,
-  -395,   -508,   1163,   -216, -13034,   -718,  -1018,  -1675,
-  -698,    710,   -257,   2658,   1178,   2046,  -2270,  -2588,
--14442,  -1142,  -1026,   2247,   -536,    314,    123,  -1175,
-  -673,   1576,  -2600,      5,    964,    619,  -1714, -14811,
- -1502,  -1646,  -1151,    -93, -11652,   -222,    343,  -2203,
-  -351,   -928,   -289,   2679,   2101,    742,    747,  -2245,
-   146,  -1828,  -2728,   1058,   1048,   3046,    242,   4432,
-   246,    350, -13419,    768,   -805,   1819,  14332,   1316,
-  -370,    391,  -1421,  -1426,   -355,   -812,    -64,    196,
- -2917,   1097,  -1550,  -1246,    436,    -62,   -813,   1350,
-   555,  -2236,  -1589,    980,  -1483,  10122,  -2434,   7236,
--15225,   1513,   2090,  -1224,    -83,  -2821,    664,    658,
- -3242,  -1031,   1509,   2667,   -160,  -1315,   1060,    891,
-   432,  -1311,  -2503,   1304,   1295,   1745,   -722,  -2496,
- -4409,  -3360,  -2776,  -2793,  -4921,  12616,  -1031,   -443,
-  1495,  -2416,  -4640,   4508,  -2944,   2608,   1323,   -394,
-  -415,  -2111,  -2065,   1030,  -3636,  -1338,   2916,  -3007,
- -3680,  -3152,   -115,    577,   2742,    785,  -4429,  -1945,
-  -304,  -4883,   -133,  -3136,  -1927,   -576,    618,   1780,
-  2568,  -2102,   -158,  -3986,  -1187,    280,    655,    162,
- -1352,  -5730,  15372,  -1314,   1553,    274,  -2873,   4221,
-  4610,  -4143, -13699,   2760,  -1255,   -238,   1487,   1583,
-  1422,  -2272,   4734,  -6368,    795,   -406,   1498,   1588,
-  -500,  -2744,   -875,   2080,   1901,    960,    344,    979,
-  -258,    952,   2526, -11785,    893,    669,   1361,    518,
- -1368,   3854,   2539,    623,  -1835,  -4177,   2686,  -2956,
- -2804,   1121,  -8890,   1377,   1125,  -3990,    140,   3594,
-  1757,   2271,    366,   1723,   2150,  13557,  -1768,  -1433,
- -6632,   -578,   3266,   2509,   7142,    680,   1532,   1318,
- -1123,   5668,   1283,   -412,  -5404,   2893,  -2647,  -2695,
- -1412,    340,   -650,    863,   1895,   2867,    384,    626,
-   856,    508,   1365,   -295,    960, -26080,    234,     -4,
-   239,   -412,     -6,   -765,    736,    -30,    136,    912,
-   538,   -792,    413,    871,   -437,    305,     30,   -194,
-  1105,  -1113,   3550,  -4854,    449,   -549,  -7626,   3706,
- -3698,   1778,   1441,   2240,     73,    513,  -3383,  -2346,
- -1372,   3955,   2973,   1175,  -6087,   5071,  -2135,   8552,
-  4961,  -1201,  -1458,  -2627,   -730,    515,   -756,    476,
- -1104,   2115,  -1276,    498,    336,   -451,    809,  -1030,
-   556,   -211,    -70,    -93,     89,   -755,    296,    872,
-  -282,    380,   -298,   2774,    660,   1339,   -545,    429
-},
-
-.cb1108l1 = {
--13570,  -9232,   -673,    267,   -819,   1633,    -33,    623,
-  -850,  -4376,  -1135,    999,   -262,   1928,    695,  -1751,
- -2793,    772,   5064,  -1158,    280,  -2144,   1313,    888,
- -2482,    469,   2996,  -1406,  12525,  -1200,  -1202,    939,
-    -3,    847,    818,   -924,    135,  -1308, -12000,   -544,
-  -592,  -3914,    441,   3372,   3188,   1314,  -1836,   -706,
-  -844,  -1319,   1029,  -1754,    172,   2468,   -903,   -889,
--14602,  -2054,  11694,  -1980,   -730,  -1661,    214,   1243,
-  -337,   -646,    -95,   1432,   -854,   -236,     88,     -2,
-   514,  -1643,    -84,   3561,    302,    770,  -1248,    480,
-   664,    738,   1728,  -1783,  -2227,   -702,  -3582, -16641,
-  1713,   1506,    660,  -2471,   2061,    -48,  -3161,   1697,
-   900,  -1477,    558,    287,  -5515,   1023,  -1972,    999,
- -1856,  -3022,   -228,    711,   1270,   2644,   -648,   1064,
-  3899,  -1205,   -754,   1080,   1262,     18,    860,   2274,
-   655,    494,   -221, -15647,   1334,   -473,  -1648,   -341,
-  3541,   3109,  -1671,    639,  -2491,    185,    477,   -388,
-  5198,  -5680,    812,    700,   2180,   -536, -19468,  -2508,
-  2592,   2901,     32,  -1165,   1500,   -422,   -790,  -1914,
-   971,    111,   1226,  -1302,    541,  -3862,   -832,    642,
-   305,  -3870,   8921,    570,    180,   1734,  -1572,   -891,
- 17672,   -756,    702,   2740,   -647,   2122,    102,  -1371,
-   461,    454,    204,   -307,  -1248,  -2330,   1353,  -1783,
- -1939,   -601,    512,   2118,  -2178,    254,   1190,  -1252,
-   923,   1166,    360,    320,    320,   1210,   -142,   -416,
-  1260,   -205,   1403,  -1025,  19252,    328,     58,     21,
- -1044,   1786,   2153,    697,   -436,  -1617,   -869,   -493,
- -2419,  -3102,   1995,   1519,  -1799,   -153,   2689,   -665,
- -1371,   -915,  18486,    941,  -2612,  -1057,   1076,  -3351,
-   -48,  -1478,    575,    728,    130,   -168,     40,    898,
-  2141,   1518,   -965,  -1910,    896,    838,   1220,    416,
- -1494,   1404,   -126,  21472,    604,   1740,    102,   -812,
-  -796,   -734,   1082,   -507,   -468,  -1732,   1171,    252,
-   359,    436,   -765,    791,    726,   -810,   1838,  -1798,
-  5662,  -2362,   1275,  -2829,  -4041,   1398,   2681,    480,
- 13740,   -752,   2252,   1306,  -1026,   1834,     54,   9993,
-   559,   1370,    711,   1918,  -1757,    646,     16,  -3262,
-  2676,   1751,  -2595,   4782,  -1050,   2401, -15131,   1100,
-   386,    708,   -359,    455,    -25,   -950,    241,   -482,
-   268,   2327,  -2766,   -142,  -1992,   -566,    -36,    990,
- -6302,   3245,  -1394,  -1579,    760,   -757,  -2115,  -8542,
- -2945,   -800,  -4027,  -3102,  -1319,  -1989,  -1787,   -426,
-   590,   1031,    467,     31,   2674,   1686, -14352,   1174,
- -1446,   -813,  -1267,   2919,   2052,  -1574,   -753,   3369,
- -1090,   3830,   2042,  11376,   1140,    895,   1130,   -720,
- -1284,  -2277,     49,   -724,    397,  13201,   -985,   1599,
-  -365,   1517,   -496,    978,   2152,   1391,   1777,   3032,
-  -936,    280,   1719,  -4551,   4874,   -941,   -160,    956,
-  -676,   -229,   -548,    183, -16606,   -855,  -3433,   1248,
-  -578,   2254,   -532,   3081,  -1406,  -1859,   -605,   1809,
- -1001,   -114,  -1222,   3890,   -609,   3114,  -2430,  -2142,
-   440,   1780,   1606,  -4211,   1047,   -456,   8280,      9,
-  5866,  -1718,   -932, -13049,   -562,   3097,   -583,    -21,
- -1972,   1254,   -172,    527,   2282,   5064,  -5391,   1074,
-   357,   1845,     24,   -996,    100,    -50,   1098,   2905,
-  -417,   -937,   -439,    247,  18502,  -2380,  -2088,   -402,
-  -580,     83,   -282,    -70,    969,    540,   -219,  -1132,
- -1701,   -195,  -3030,  -2748,  -1974,  -1304,  -1909,   1080,
-  1042,   1124,   -128,   5816,   2303,   2840,  -2420,     35,
- 16550,    721,  -2079,  -1489,   1023,   -654,   2025,   1479,
-  -185,  -2449,    500,   3034,   2663,   3911,   1203,    998,
-   594,   -533,   -163,   -262,    739,     13,   -426,    182,
-   394,    350, -30055,   -371,    150,   -430,    147,  -1122,
-    43,   -390,    298,    831,   -194,    158,   -114,   -257,
- -1346,   -585,    206,   -456,    478,   -502,  -1710,  -1719,
-  -581,   -536,     45,   -861,    825,   1093,   -255,   -685,
-    38,    -20,    419,   -594,     10,  -1408,   -526, -19191,
-   196,  -1496,    255,   1844,  -8759,  -3565,  -1009,   -926,
-  -818,  -1195,    236,   2898,   -182,  14344,  -1384,   1064,
-  1181,  -1846,    543,   -583,    170,  -3305,  -1187,  -2406,
-   -40,  -1051,  -1071,    -28,   1482,  -1060,  -1057,   3028,
- -2023,    913,   1052,    980,  -5158,   4642, -14067,   3920,
-  1450,  -4497,  -1591,    842,  -2222,   -392,    -42,  -3546,
-  -258,  -3566,   2595,    225,  -2696,   4624,   2283,   1483,
- -1506,   2164,    151,    380,  -3207,  -1086, -10594,   2005,
-  2379,  -2567,   -925,   -363,  -1261,  13174,    -73,   1168,
-  2215,  -1721,    726,    525,   1048,    322,   -827,   2117,
-  3890,   1346,  -3512,   2243,    638,   2259,  -1371,  -2260,
- 10590,    851,  -1247,   -894,   1871,   -882,  -1955,   3822,
- -3654,  -1730,    906,   2074,   -548,    885,  -2501,  -1316,
- -3275, -10694,   2031,   1077,   3013,  -1105,   2951,   1907,
-  1218,    194,   1860,  -1662,    178,    915,   1092,    809,
-  -451,   -610,   -728,    799,   -129,   -101,   -905,     -2,
-  2470,   1292,   -137,    544, -18795,  -1081,   -300,    -59,
-   282,   -329,   -544,  -1324,   2155,   9326,    462,   -388,
-  -303,  -2940,   -608, -13652,    532,  -1350,  -1026,   1330,
-  5559,   -333,   4961,    707,  -1832,   1070,   2483,  -2016,
-  -315,   2197,    849,   -348,    379,  -2179, -15691,    903,
-  3192,   3888,    396,   4610,   3261,  -2589,  -4903,   -643,
-  3604,  -1380,   1524,  -2155,    469,  -3528,   -790,    429,
- -3862,   1797,   -104,   2364,  -1162,  -1559,   1011,   1849,
-  -235,  -1952,  -2088,   1436,   2502,  -3862,  -1704, -14859,
- -2863,    710,    624,   4373,  -6302,   -616,   -807,  -1577,
- -2492,   -620,   -917,    948,   4957,   -848,   -863,    514,
- -2210,   2162,   -753, -15168,  -2068,  12472,  -2611,   -723,
-  2797,  -8573,  -2270,    978,  -2597,   2215,   -684,   2535,
-  3114,   -261,   -178,   2385,  -4869,   1161,    -32,  -1469,
-  2074,  -1407,   3226,   -992,   4546,  -3158,   1044,    463,
- -5285,      4,  -1396,  -1395,   1770,  -1767,   -860,     -6,
- -2242,  -1548,   -667,    587,   -982,  -2246,  -1312,   1550,
-  -542,   5302,   -716,    135, -15895,   3382,   -478,   1279,
-   615,   3365,   1620, -12613,   -230,   3101,   3230,  -1307,
-  2860,    628,    647,  -3595,   -214,  -1631,   2783,    748,
-  1088,    -57,  -6014,   2496,    359,    719,   1476,   -750,
- -1644,  -2125,   3913,  -3788,    565,  -1118,  -1411,   1377,
- -1020,   -246,  18851,  -1438,  -1150,  -1492,   -681,   -798,
-  -776,    960,    911,  -1449,    336,  -1114,  -2111,   -877,
-  -532,    668,   1018,   1098,    408,   2032,   -607,   -656,
- -5997,   3089,   2462, -18368,  -1027,     78,  -4066,    439,
-  -845,   1476,    290,    490,   -452,   1638,  -3381,     80,
-  1699,    458,    260,   1215,   -516,   1883,    -62,     35,
- -2540,  -1703,  -1042,   1751,   -422,   1222,    207,   -104,
-  1112,    151,   -473,   -522,  26426,    562,    884,  -2201,
-  -281,    238,   -839,   1037,   -588,     81,   -109,     -2,
-   -32,     75,    654,    489,    524,   -388,  -1408,   -906,
- -1193,   -936,   -273,    -40,   -100,   -662,   -522,   -145,
-   119,    614,   -922, -25329,   -180,   -668,   -574,    161,
-  -448,    173,    750,   -609,   -812,   -125,    814,    572,
-  2602,  20372,    244,   1820,    724,    515,    932,  -1290,
-  -712,   -990,   -305,    -13,   -763,  -1157,    481,   -764,
-   320,    624,   -620,    642,  -1494,   -568,   -601,   -655,
-  -790,  -1348,    334,  -1302,    382,    782,  -1122,   -641,
--23549,    180,    463,   -634,   -666,    599,   -356,  -1071,
-   816,   -576,   1208,    912,   -377,    624,   1049,     42,
-   -95,    370,   1932,   -167,   -275,    142,   -159,   -410,
-   595,   -562,   -632,    748,   1192,    614,    -41,    -18,
-  -156,    -61,   1280,   -686,    363,    759,    756, -19362,
-  -614,   2151,  -1185,    169,    327,   1494,    782,  -1313,
-  -134,    841,    218,    -76,  -2980,    202,     80,    281,
-    89,    -61,  -1678,     59,   -125,    195,    320,  -1310,
-   -56,    806,     47,    -65,    249,  18432,   -666,   -506,
-  -204,   -194,   -560,   -416,  -3641,    330,   -268,    842,
- 10600,   -176,    424,  -1744,  -3609,  -1682,   -844,   -309,
-  -538,    435,  14251,  -1281,    373,   2748,   -702,  -1358,
-  -766,   3480,   -679,   4039,    529,  -5698,    -38,   -813,
-  1203,   4734,    318,  -1044,  -5109,   2187,  -3474,    415,
-  2436,  -3021,  -1628,   -456,  -1451,   3406,  -1798,   1001,
- -8648,    468,   1188,    497,   4628,   -948,  -4073, -11894,
- -2750,   -738,   1520,  -4070,   -810,  -5755,  -1370,   2978,
-  4460,    917,   1221,   -324,  -1166,   2339,  -1221,  -2048,
-   714,   6884,   3096,   6998,     13,   -275,  -3879,    790,
-   104,   1383,   2056,   1957,  -9216,   -430,   -199,    261,
-   764,   -109,   -210,    795,    884,   -334,   1546,   -272,
-   -35,    738,   -268,    -13,   -448,    645,     97,     76,
-  1284,   -343,   -654,    112,    643,  22846,    634,   -597,
-  -621,   -784,   -380,    951,   -452,   -685,    140,    688,
-  -770,    247,   -679,   -228, -26856,    311,   -546,   -444,
-   606,     69,   -195,     18,   -220,   -334,    -42,    543,
-   -28,    492,    766,    208,  -1206,   -554,    213,  -1112,
- -1675,   -608,    382,   2011,   5077, -17442,   1367,   -702,
-  -856,   -416,  -1728,  -1987,   2966,  -1952,     38,    152,
-   712,    210,   -589,   3029,  -1189,  -2016,  -8071,  10746,
- -2143,   -556,  -1964,    162,   -504,    995,    982,  -2565,
-  -634,   -985,  -1668,    444,  -2098,   -411,    488,   1397,
- -1134,   1888,   -920,   -279,  15057,   -757,  -1258,  -3040,
-  -890,   -105,   -670,   -490,   -238,  -2419,  -1302,    915,
-  -784,   -929,   1653,    -89,   1076,    445,   2538,  -1424,
- 19175,    -91,    437,    752,    254,    935,    854,  -1666,
-   -86,   -543,   1053,    664,   -155,   -485,  -3994,    -50,
-    50,    -58,  -2626,   1801,   -314, -16052,  -1831,   1009,
-  2344,  -3030,   -938,   1761,  -1283,   -150,   -425,  -6660,
-  -900,   1374,    803,    549,  -2683,    837,    483,   -655,
-  4610,   1259,    -45,    834,   1103,  -3250,  -3604,  -2882,
- -2463,  -5331,  11312,  -1653,  -3505,  -1855,  -4962,   8579,
-  2370,  -2474,    501,  -1282,    985,   -924,   3452,    456,
-  -242,   3878,  -2095,   2994,   7076,   -459,   2574,  16116,
-  8277,    -88,    572,    -38,      0,   1664,   -553,   1820,
- -2096,   1076,    415,   -420,   1900,  -1696,   -130,    298,
- -1555,    201,   -404,  -1831,   -932,    844,   9606,   -497,
--16304,   3278,    918,   -523,  -1573,   2488,   -813,    147,
-  1540,   3795,   1390,   1061,    -78,    -10,    574,   2620,
- -1143,   -512,   -582,  -1496,    736,  -4323,    786,  -2873,
- -1342,   3932,  14508,  12635,   -899,   1730,   -673,    386,
-  -676,   2787,  -2780,  -2960,    375,    475,  -2188,   2250,
-   851,    788,    268,   1264,   2973,    -94,   1062,   1006,
-  -697,    669,   -635,   -986,  -4848,  -1486,     -6,  -3914,
-  6267,  -1560,      8,   -503,   5273,  -3545,     69,  15146,
-  2263,  -1490,   -548,   1740,   1636,   -892,   -895,    769,
-  -471,    226,   6497,  -2466,  -2037,  -1068,   1075,   -902,
- 13668,  -1213,  12424,  -3523,   -124,  -1090,    972,  -1134,
-  -494,  -2568,    881,  -3081,    369,   -254,   -618,   -914,
-   443,  -1254,    658,   1322,    546,    -14,    778,   -116,
-  -378,   -802,   -268,     48,   1140,  25942,    503,   -637,
-  -871,   1050,    298,   -187,    387,   -406,    343,    212,
-   110,    723,    695,    -47,    -50,   -568,    -66,    347,
- -1588,     20,    701,   -485,    -98,   -787,   4502,   1046,
- -1628,  -2526,    185,   1016,   -256,   -700,   -403,   -154,
-   103,   -752,   -689,   2084,  -1463,   2294,    360,  17590,
-  -698,  -1262,    788,    116,    755,    751,   -440,   -610,
-  -469,   1235,  -2314,   1240,   -308,    553,   1065,  24442,
-  -733,    667,      4,   -484,     93,   -263,   -361,   -278,
- -1524,    176,   1311,   1561,    435,   -436,  -1079,    260,
-  -366,    472,  -1049,    647,    158,    302,   -931,    -36,
-  -990,    736,   -444,   1077,  -1560,   -251,    148,   1000,
-  1096,   -300,   -224,   -307, -17646,     39,    206,     74,
-   505,  -3051,  -1285,   -793,   -724,    718,    324,    803,
-   874,   6062,  -2235,  -3321,   -550,   9264,   3483,  -4172,
- -4024,   -471,    858,   2682,  -1078,  -1922,   2088,   1135,
-  -878,    545,   2205,    836,  -1088,    547,  12461,   2222,
-  -828,  -3841,   4797,  -2360,  -2510,  -4029,  -2213,  13736,
-  1032,   -958,   1895,    264,  -1499,  -2066,   -241,   1324,
-  -224,   -792,    776,   2130,   2600,  -2276,  -4239,   3260,
-  1610,  -1620,  -1220,  -2752,    979,  -2028,  19626,  -2146,
-   684,   -729,   -235,   -289,    588,   -600,    245,   -879,
-  -816,    413,    -87,  -1158,   -246,     69,    970,   -111,
-   500,   1097,   1087,   -138,  -1356,     30,   -434,   -452,
--22802,    177,    492,    206,   -257,   -854,   1445,     37,
-  1384,     97,   -258,    811,   -222,     53,    548,   1744,
-   124,  -1031,   1076,    186,    453,   -173,   1180,  -2235,
-   583,   -392,  -1542,   -726,   2937,  -3635,   -856,   1446,
-  7796,  -2779,   -962,  -2277,   1651,   1960,  -1460,  -1277,
- -9794,   -288,   2459,   2350,  -2521,     84,    578,   2286,
-   480,   1620,   6421,   -200,    170,   1513,    198,  -1001,
-  -491,  -1000,    161,   -482,    607,    214,    743,   -292,
-  -394,   -192,     92,     73,   -415,   -316,    593,    -42,
-  -346,    456,     44,    950,    129,   -189,    806,   -221
-},
-
-.cb1108s0 = {
--32768,   -828,   9569,    331,   6938,   3122,  -1008,   2847,
-   646,  -5690,   1712,   -795,  -4406,   1368,    307,   -526,
- -2206,     26,   -210,   1358,    746,   1920,    667,   3866,
-  -413,   -720,  -4328,  -2475,  -1189,   -863,  -3809,  -5052,
- -8567,   2859,   1915,   4895,  12440, -13002,   2757,  -5969,
-  4054,   1100,  -9430,   4930,  10266,  -1522,   7092,  -8778,
- -1968,   4325,   8440,   3888,  -1966,   -688,  -2455,   2966,
- -2380,   1682,   4956,  -2310,  -3706,    404,   6774,  17562,
--12437,  -2667,   4864,  -9411,  -6436,  -9316,   -903,  -5526,
-  3463,  -1690,  -5250, -12568,   2338,  -1310,  -3019,    776,
-  -641,   3483,     54, -10732,  -3878,   -691, -17615,   4530,
- 10267,   7830,   8488, -12624,  -4514, -17183,   7070,   3115,
-  4176,    383,  -4558,    410,   6379,   6242,   4702,   4853,
-  -217,    446,  -3811,  -2396,    244,  -2120,   3275,   5122,
-   180,   4523,   8680,  -1868,  -6164,   2636,  -5056,  -4039,
--11618,   4014,  11349,  -2616,   8240,  -5119,   1988,  -2552,
-  6060,   3206,   -662,   2686,   1116, -10447,  -3004,    650,
-  7811, -12148,   -327,    856,   -916,   -397,   -600,   4621,
-  3011,   5539,   5417,  -2374,   9667,  -4714,   7821,  -2819,
-   573,   4492,   1882, -26770,   1486,  -6963,   1103,   2515,
-  8196,   1849,  -7492,  -5243,   2106,  -5290, -11000,  -1410,
- -3448,  -8548,  -4536,  -7730,   3083,   6109, -14458,  -8624,
-  -381,   7840,   4694,  -3906,   8223,   3315,   5849,  13112,
--13132,   6081,  11801,  -7624,   -376,  -6372,  -6817,   6834,
-  1760,  -1435,   1072,   3505,  -1494,   -709,   5786,    454,
-  1807,   2650,   7728,   1357,  -1002,  -5366,  -2368,   2052,
-   333,   6312,   -336,   8274,  -1653,  -4309,  -6630,   2841,
-  2448,   8398,   5376,  -7248,  -1474,  -1842,  -4119,    838,
-   501,  -4206,   4052,  -1250, -20943,  -3338,   -592,  -2973,
-  7057,   -128,  -3235,  -4313,  -2510, -11313,  -4925,   3103,
-  1448,  -5186,  -1322, -16815,   1956,  -7950,   2641,  -2890,
-  4396,   2322,  -1381,  -1911,    448,   2543,   3535,    782,
-  3719,   -624,   1610,  -2843,   7583,   1794,    700,   3107,
-  4528,   5461,   2540,  -1074,   5976,    741,    576,   4426,
-  4400,  -4920,   5724,  -3734,  -1186,  10645,   1100,  10537,
-  2828,  11670,  -8391, -32572,  -9405,  -6807,   -875,   2277,
-   736,  -4546, -18693,   1204,  -1083,   3422,  -3328,   6013,
- -2992,   5812,   2744, -11668,  -2519,  -2384,  -3635,   6532,
-  6874,  -2820,  -5222, -12261, -14266,  -6663,  -1150,  -2032,
-  2099,   4642,   1638,  -4162,   -644,    249,  -3133,  11830,
--10712,  12370,   4818,  -1924,  -5639,  -6448,   2455,  -4898,
-  -613,   1760,   2393,   1414,   7039,  -7018,   5901,  -2900,
-  3786,  -3230,  -3718,   3514,  -4040,  -4676,   6367,  -1449,
- -2758,  -2888,   4066,  -7140,    408,  -7656,   3156,  19919,
- -1858,   6671,    352,  -3355,   3074,   5524,  -1429,   1954,
- -6664, -10082,   4405,  -1598,   -806,   1779,  -6913,   7062,
-  5064,   6518,  -1042,   3400,  -5530,  -1192,    590,  -3298,
-  -772,    571,  -6239,   9810, -12380,   1302,   1344,  -3430,
-  3830,   4106,   5792,  -6196,    224,  -2604,   3954, -12551,
- -5539,  -8306,   1801,  -4521,   3578,  -4349,  -5716,   4960,
-  3620,   1516,   5779,   5550,  -3710,   3329,  10542,   4198,
-  5148,  -3291,    196,   6232,   6943,  -1303, -10306,   1862,
-  6547,  -1544,  -2996,   2868,  -4389,  -6894,  28557, -13130,
-  1397,  -2331,  -4076,   2870,   3592,   6613,    265,  -4790,
- -3514,  -3152,   8710,    230,   3142,  -1264,   1822,   -769,
-  6168,  -1792,   2189,   2660,  -2664,   3402,   -533,  -3100,
-  -476,  -1164,   6092,  -2930,   3372,  -5895,   8507,   -918,
- -4716,  -1582,  23959,   1506,   2360,   -117,   2029,   -452,
- -6575,    964, -13132,  -2838,   3800,  -3355,   3168,   5230,
- 11116,    826,  -1711,  -3546,   7398,  -4092,  -2884,    743,
- -1784,  -3824,  -3437,   1050,  -3306,    928,  -5109,  -7999,
-  1581,   8609,  -4662,  -3594,  -1618,   9929,  -3982,  -5591,
- -8789,  -1444, -12011,   1304,  12668,  -5138,  10837,  -7951,
- -4089,   3921,  -5375,  -2486,  -2590,  11398,    -80,   7734,
- -4547, -11286,  -7098,  -7758,   5303,   7380, -11266, -11138,
- -8676,     30,   6328,    597,   7852,   3144,  -3933,  15142,
-  3954,  12197,   -507,  -1667,   5517,  -4187,    709,  -1330,
-  2094,   4739,   1341,   8276,   8544, -10107, -10151,   3641,
-   771,   4798,   4839,  -3254,  -9246,  -7304,  14850, -18155,
-  3068,   4993,  -4930,  10985,   6270,   8528,   5904, -13010,
- -7824,   1300,   -706,   -156,  -4228,    302,   9962,  -3087,
-  4472,   4541,  13179,  -6576,  -2541,   8284,    -51,   5366,
- -4369,    289,   3890,  -3671,   1894,  21820,  -3031,   5336,
- -8412,   2487,  -1211,  -6759,   1292,   3749,  -8904,    638,
-  6863,    154,   1145,   -684,   6648,  -3874,   2005,   4670,
-  4408,   4191,   3984,    632,   2957,  -1532,  -3974,  -2576,
- -1636,  -3714,   -136,  -4946,   3900,    367,  27072,   1864,
-  1426,  -3321,    860,  -1768,  -2009,  -3436,   2666,  -9899,
- -1328,  -2330,  -3078,  -3258,  -4600,   5604,  -5248,   1703,
-  4403,  -4781,  -8275,   6717,  -3860,  10980, -10634,  -8360,
- -2291,  20311,   7602,  -4028,    483,  -4886,   2677,  -4921,
-  6065,   5393,  -2145,   6201,   -472,   1796,   2869,  -3578,
-  3053,  -2342,  -3193,  -2589,  -3215,   1322,    536,   -164,
-  -314,   4800,  -1903,  -1338, -11833, -23399,   5562,   4440,
- -1864,   2520,  -4251,  -1464,   5053,  -8553,  -3852,  -5932,
-  -849,  -7113,  -3493,  -5338,  -1671,   1496,   4504,  -1830,
-  5716,   -210,   1397,  -2060,   2242,   -583,   2604,   5355,
- 13938,  13150,   1346,   2649,  -1527,  -4568,   8891,   7399,
- -6492, -10371,  -4885,  13056,  -8262,  -1267,  -2959,   -868,
-  5941,    299,   -601,   8834,   1436,   5404,   1914,  -3775,
-   980,   8848,  -2270,  -1952,   6902,   8642, -25725,   9556,
- 14540,   1998, -13157,    308, -13844, -10126,  -2147,   8296,
-  1772,   1094,  -9712,  -8560,  -7552,   5527,  -1446,  -1097,
- -5798, -17270,   2860,   -210,   2136,    175,    729,  11775,
- -5154,  -4202,  13342,   3977,  14494,  -5659,   9105, -11067,
- -3694,   4794,   -593,   6817,   1875,  -4975,   3663,   4141,
- -8317,  -8932,   2127,  -4176,   1136,   -148,   7640,   8127,
-  -744,   2354,    389,   1600,  -6475,  -4558,  10735,  11407,
-  3896,  13098,   1814,   5191,  -3850,   2629,  18430,   8343,
-  4630,  -4624,   -702,  -3834,  -2276,  -2894,  -1556,   1437,
-   424,   5652,  -6260,   2387,  -5845,   7496,  10657,  -2754,
-  4806,   1169,   1308,  -4114,  -5347,  15076,   5686,   7287,
-  3004,  -6254,   5186, -14096,  10323,  -1974,  -9355,  -5544,
-  -986,  -5998,    261,   4494,   2467,  -1911,   -603,  -4548,
- -1344,   1995,  -1603,  10464,   5222,   3714,  -5342,  -8039,
- 12530, -26465,  -1813,   4044,    746,   8123, -12078,  -4703,
-  2971,  -4487,   2556,   3904,  -2518,   1504,   5774,   5431,
-  1120,   -934,  -5202,  -6826,  -8774,   7156,  -2392,  10643,
- -2918,  -4298,   3361,  -3758,   -894,   5828,   -203,  -4905,
-  6480,  11771, -19830, -17545,  -4920, -17263,  10066,  10125,
- -8980, -19719,  23554,  27907,   2607,  -7014,   6128, -23759,
- -4802,  -7099,    874,  13103,  21667,  -8475, -12938, -13122,
- -3694, -18860,  -3518,  -3586,  12658,   -793,  10661,   6925,
-  -730, -11373,  -7845,     94,  -2627,  -6044,  -2213,  -4381,
--10198,  -5816,    -56,  -4349,   3722,   3911,  -1719,  -2513,
--13290,   3218,    105,   1876,    -76,  -1107,   2563,   4520,
- 10288,   5862,  -7738,   6180,   9863,   1380,   6756,   2632,
--18798,   9314,   7190,  -7454,    432, -15141,   8462,   2128,
- -2386,  -2710,    292,   -751,  -3125,   6147,   4941,   3146,
-  3046,    120,    321,  -5884,   5105,  -4300,   6264,   -317,
-  1667,   -694,   7950,   5639,  -3284,   1089,  -6456, -14694,
- -3527,  -1104,   4313, -20858,   7920, -10782, -13536,    933,
-  4523,   2640,   2118,     97,   -614,   9834,  -9515,    232,
-  5086,  -6720,  -1529,    568,   3139,  -3665,  -8567, -13771,
-  6274,  -4370,  -5653,  -8920,  -7667,  -9391,  -6653,  12489,
- -3666,  -5103, -12324,   4796,   -540,  10396,   3668,  -3467,
-  7124,  -4398,     87, -12139,   -204,   1213,  -2190,  11948,
- -2641,  -2434,  -5647,   2819,   3148,   3558,  -6455,   3705,
-  1644,  -3090,  -4225,  -5998,    112,  17789,  -7220,   2166,
-  4153,   4516,  -1100,  -1667,  -1402,  -8837,   6344,  -1586,
- -3451,   2357,    616,   -392,  -8163, -11579,   6160,  -2783,
-  7895,  11321, -11847,   8070,   5231,  -6496,  -3172,  -3470,
- -2960, -11437,    465,   -470,  -2568,  11197,  -9417,  -4117,
- -1162,  -1893,  -2361,    551,  14478,   3510,  -1372,   3117,
- -8236,  -2904,  14556,   3191,    200,   2166, -13974,   2718,
-  3946,   2444,   1982,   5320,   2087,  -2222,   1573,    742,
- -8828,  -3917, -11080,   -241,  -8472,   6119,    290,  -2364,
- -3163,   1923,  -1964,   -582,   2564,  -5566,  -6411,   2069,
-  7392,   9115,  25316,   1504,   2540,   -814,  -1746,    566,
- -1580,  -2290,    170,    698,    105,   9567,  -6714,   -584,
- -4934,   -379,   -491,   -978,   4580,   1180,  -3355,   1882,
- -4343,   4817,   1503,   9968,  -8878,  -4908,   3419,  -4818,
- -2254,   6694,  -4368, -10849,  -5093,   4510,  -3129,    152,
-  1926,  -4490,   1510, -17764,  -6699,    962,   3474,   4981,
-    25,  -7128,   1432,   5386,   3108,  -4545,   1092,   1663,
- -1363,   3076,  -8916,   6158,    244,  -1181,   -825,   -933,
- -5570,  17221,   -535,  -2892,  -5031,  -1297,  -3010,   5840,
-   678,    748,   3944,   1630,  -3648,  -5457,  -2618,    876,
-  6655,  -2834,   2597,  -6667,   1330,    -40,  -4423,   6257,
-   743,   6083,   -584,  -3742,  -1401,   1779,  -5166,   4559,
-  5558,   8588,  -6476,   7521,  -1561,   4950,   -778,   3564,
- 11403,  -1010,  -3151, -14151,  -1020,   2595,  -3278,  24555,
- -4859,   -909,   2314,   1301,   2098,  -5664,   3938,  -4050,
-  -203,   3368,  -2580,   3061,  -9266,  -6263,  -6748,   3890,
-  1950,   -329,   1050,  -1106,    588,  23705,   -661,   6913,
-   722,  -5820,   2147,   3789,  -1689,    661,   5389,  -8519,
-  1152,   3800,   7160,   5234,   1343,   3218,  -2900,   -391,
- -4258,   5084,  -4783,   7262, -10013,   -811,  -5252,   6474,
--17338,  -2388,  -2596,  -8715,   5836,   9523,    639,   4652,
-  3071,   3114,  -1648,   1563,   -931, -10143,   4394,  -2838,
--11900,  -1012,    841,  -5812,  -3048,  -2715,   -196,  -5794,
--20022,   1949,   3464,   -770,   2200,  -3564,   1975,  -6242,
- -1937,   3954,   5678,  -2744,   1888,  -3825,   5770,   3869,
-  8315,  -7386,   1318,   1302,  -5534,  -4554,    924,  -3804,
- -4292, -22757,  -7972,  -7469,  -3543,   7858, -10125,  -2637,
- -4765, -10644,  -5944,   1159,  -3293,   4363,  -1219, -12248,
-  5060,  -7232,   6947,  -1609,  -3037,  -5084,   6580,  15873,
-  5336,   7295,   2386,   2961,   4655,   9714,   5080,  11635,
-  1790,   2897,    687,   -914,   -692,  -6653,  -8562,  -1412,
-   244,   4478,   1650,   7175,   1046,  -6689,   3693,  -3520,
-  6046,  -1336,   1976,  16822,  -1176,    792,  -1733,   8286,
- -7359,  -2402,  -8536,   1392,  -3271,   6580,  -4939,   1562,
-   595,  -4237,   4872,   4266,  -1798,  -6589,   7457,   4207,
-  9978,  -3996,  -2236,  -3078,   1861,  10101,  -2394,  -3250,
- -7619,  -7082, -14305,   5664,  -1337, -11019,  -3839,  10190,
-  7249,   3086,  -1782,     24,  -3566,  10769,  -4102,  -6408,
-  -688,  -8987,   3018,  -5942,   7478,   -368,  -7931,  -3018,
-  6766,    -78,   5705,  -3264,  -1100,   4850,   4518,    -28,
- -6276,   4905,   7094,  -4394,  -2846,    -88,    434,   2039,
-   352,   9827,  12372,   1207,  -8561,  -4476,   1496,  -4927,
-  2087,  -6730,   1134,    -81,     57,  -8701,  -2918,   3953,
- -2844,  -1842,   4804,  -5315,   -401,   7060, -16397,  -4802,
- -9849,  17542, -11715, -12432,  -6676,   9323, -13189,  -5761,
-  8054,   -620,  -7431,   3726,  17790,   7880,    251,   2983,
-  3736,   7118,  17197,   8613,   1445, -15290, -16184,  11084,
- -4971,  -5922,  -1893,   9067,   9321,  -8139,    714,    182,
- -3138,   7258,  -1874,  -2781,  10800,   2915,   5316,  -5206,
- -2581,  10219,   -484,    862,    119,   6628,   1514,   3883,
-  -880,   7586,  -2573,   3279,   3801,   4492,  -3850,   9416,
-   -38,   7518,   -574,   4052,  -1136,   -668,   9672,  -9536,
-  2551,  -4223,  -1074,  -3616,   8446,    158,   3262,   7965,
-  1311,  -8634,  -6786,    700,   4973,    917,   -754,  -1156,
-  6054,   2067,  10757,    421,   1030,  11351,   2149,  -4286,
- 12075,   4593,   1193,  -5290,  -8566,  -2965,   6824,  -6238,
-  2392,  -3395,   5350,  -2789,   7529,  -1873,   3032,  -1494,
- -2703, -18535,   1583,   9539,   2556,  -4422,  -6079,  -2699,
- -7860,  -4573,  -8236,   4281,  -1079, -17578,  -2840,   7468,
-  4675,  -5002,  -1268,  -1529,  -8222,   8285,   -766,  -4314,
-  6048,  11507,   5046,  -2444,   3186,   1732,   7872,   6598,
-  2828,  -2920,   8278,  13263, -10204,   1334,  -5552,  10532,
-  5412,   2554, -10076,   1128,  -3959,  -3210,   4091,   1824,
-  4984,   5558,  -2204,   2080,  -3802,   6614,  -7380,   3612,
- -4624,   6366,  -1795,   4038,   6227,  -4312,  -4910,  -2127,
- 15077,   4144, -16885,   3757,   2303,   -670,   5625,  -2590,
- -2594,   2491,  -3174,   4199,   1152,  -1532,  -7308,  -8578,
-  6431,   2975,   6032,   3037,  -7451,  -2643,   5503,  -7856,
- -2451,   5309,  -3678,   8145,   1864,  -8341, -15575,   7716,
--10337,   8935,  12350, -10418,  -4092,    734,  10400,  10934,
-  5724,   1778,   5836,  -3203, -10700,   2766,   4178, -18135,
--16589,  -5465,  -5005,   7239,  25480,   7310,  -6408,   6142,
- -7748,  -1423,  -4318,   -321,  -2899,   3728,  -3184,  -3578,
--11598,  -1223,  -8554,    656,  -3945,  -4084,   -724,    301,
-  9539,   9695,  -1799,  -2602,  -1379,  -5282,  -4709,  11858,
-  9562,  -7508,   4886,    896,   5780,   -160, -12724,  -9598,
-  1220,  -5411,  -5072,  -6476, -11763,   -104,   9311,   5230,
-   591,   4342,    263,  13198, -17801,  -1892,   2619,  18194,
- -2080,  16536,  18497, -25926,  25541,     66,  -6648,   1627,
-  2794,  -3790,   9424,   1387,  20702,   5260,   5211,   1702,
-  1019, -11143,  -6501, -18711,  10869,  -4204,   4994,   1722,
-  8569,   3670,   4386, -16874,   8876,  -2297,  -2743,  -4562,
- -9207,   8033,   -346,  -3586,  -9451,   3242,   1552,   4278,
- -6787,   7118,   3630,   4602,  -7371, -12789, -10424, -14922,
- -3010,   1885,   4144,  -4490,   4074,   7796,  -1201,  -7244,
-  2675,   1221,  -7060, -12828,  -3520,   1983,  -4615,   8207,
-  1606,    517,   3646,  -7252,    816,  -3690,   -674,  13100,
--16254,   4727,  -8184,   -968,  -5366,  -2288, -20260,   1174,
--19384,  -4199,  -5292,    582, -13118,   1836,   1698,  -2034,
--14601,   6642, -10530,    482,   -851,   9968,   7050, -13366,
- -8354,   4740, -20050,   -193,  -1881,  -1205,  -4042,   7067,
- 12872,   5846,  -4792,  -1833,   2504,  -3222,  -1607,   2634,
-  4587,   6761,   1549,   1124,   9427,   3978,  -8305,   7524,
-  2507,  -5744,   3238,   5238,  -3664,    694, -28496,  -1674
-},
-
-.cb1108s1 = {
--10979,   8698,   -630,   4660,   3060,  -7292,  10140,  11942,
-  1448,  -5820,  -3144,   3100,  10575,   6888,   3505,   9996,
-  2787,   -484,   8057,   1503,   6329,   3074,   3954,   9419,
-  -736,   2333,  -1858,   3264,  -4026,  16130, -14501,  -5284,
-  -472,    850,  -7258,   1542,   1473,  -2348,  -7055,  -9574,
- -2275,  -4383,   7542,   -360,  -2945,  -3878,     28,    809,
-   600,   2246,    587,  -1779,  -3456,   -737,   3242,  -2523,
- -1862,   6127,    899,   1070, -15614,  10990,  -3084,   9546,
-  7339,   8899,  -1490, -10379,  -9193,  -3857,   8289,   7261,
- 12489,   7814,  -6458,   1223,  15486, -10960,  -1880,   4922,
- -7819,   -527,  -2370,   3687,   1358,  10367, -14266,  -1496,
-  1060,  -9325,  -5582,  -3947, -17536,   1470,   4878,  10793,
-  2904,  -2566,  -4995,   6549,   6141,  11048,   3177,   -494,
-  9087,    797,  -2575,  -5616,   1197,   2966, -11287,   4658,
-  -504,   4571,   1814,  18830,  26254,   2399,   8750,   2656,
-  8206, -12987,  -9119,  -1027,   -457,   1228,   6137,   2322,
-  1732,  -5694,   -892,   -249,   -178,  -7009,  -4368,    402,
- -5564,  -5183,   2470,  -4745,   2788,  -3255,  -5181,   -706,
-    40,  -4915,   8926,  -3633,  -2455,  15054,   5376,   -867,
- -7270,   -979,   7053,  -7433,  13749,   5039,  -2234,   8474,
-  7031,  -3917,   5127,  -7602,    580,  12067,   2252,    149,
-    86,   -582,  -5729,   2193,   4178,  -9195, -11824,   3897,
-  1298,  -1044,   6450,   1885, -19562,   6205,  -4610,  -2544,
-  5192,  -4885,   5021,  -2373,   -102,   7358,  -2434,  -3512,
- -4048,   3070,     45,  -1344,    202,  -2189,    448,   1172,
-  2939,   -547,   1003,  -6370,   3643,  -1157,   3932,  -6044,
--12882,   1959,  -1574,   2574,  14854, -16317,  -6627,    505,
-  1102,  -9361,  -8087,   7525,  -1466,    284,   3756,   -383,
-  5147,   5060,   -474,    531,  -6144,  -1872,  -1206,    527,
- -4861, -12410,   7508,  -7226,   5046, -12233,  -4153,   4628,
--14402,  -5265,    534,   1528, -13408,    -62, -18757,  -1280,
- -9301, -10254,  -8990,  -6335,  -7724,  -3394,   1951, -13271,
- -1389,  -5274,  -4616,  -9643, -10295,   1332,  -5618, -10737,
- -7536,  -9314,  -7006,   -760,   7694,   2955,   -404,  -2800,
- 15250,  -3828,   5994,   5408,   8411,  16568,  -7280,  -6901,
-  -222,  -1554,   -862,  -1871,    939,  -3678,  -4348,  -3200,
-  3220,   1614,   8598,   8162,   1749,  -7378,  -1658,    931,
-  3870,   9183,   1509,  -5068,    -17,   5733,  -8121,   2769,
- -3195,  -3296,   8940,   2828,  -2470,  -2448,   7413,  -2851,
- -1058,  -4505,  -9653,  -5074,     73,  -3286,  -4014,  -1760,
-  2562,  13690,  -3464,   5438,  -3394,  16997,  -2944,    291,
-  4224,   1175,  -2237,  -6894,  -5479,  -1291,   3390,   5455,
-   898,   3461,  -7914,  -4785,   1879,   1059,  -3721,  -5796,
-  5054,  -3931,   6315,  -2460,   1909,    573,  -3373,   3052,
-  -178,    986,    572,  -5976,   5781,  -4928, -10539,    580,
--18727,    757,   1759,  -4049,   2232,   1890,   4115,    699,
- -2934,   4926,   2391,  10848,   5103,   4340,  -1518,   2288,
-  2283,   8886,  -5131,  -4429,  -4384,  -3265,  11933,   3993,
- 11474,   3721,   1532,    976,   6112,   1954,  -2360,  -1783,
-  2080,  -6356,   2482,  -4646,  -1992,   1590,   1790,   3290,
- -2312,   -564,    508,  -1688,  -7522,  -9263,   3059,   1883,
- -3005,  -1303,  -9146,  10282,   1333,   4692,  -2083, -15792,
-  2208,   1128, -11574,  -7149,  -1126,  -4995,  18963,  -6262,
-  5045,   2179,   -822,  -1249,  10092,   -338,   5744,   1635,
-  2535,   6114,  -1339,  -8337,  -4370,   4288,   2468,   3051,
- 12491,  -9554,  -4034,    522,  -1085,   5852,  -2759,   4918,
--10717,   -194, -11376,   3059,  12075,   1037,   5260,    816,
-  5918,  -1987,   7924,  -6022, -10374,  11607,  25035, -11598,
- 16894,   2458,  -5461,  -2039,    385,   6002,   7574,   1229,
-  -834,  -1032,  -7453,   2694,  -1447,   3632,   4215,   3541,
-  2936,  -3294,   1001,  -6451,  -4595, -11682,   7880,   2261,
-  3786,  -2849,   2276,   -826,   3742,   7586,   -334,   2837,
- -2331, -12849,   1170,  -1150,  -5253,   -997,  -8996,   8124,
-  2234,    904,  -2294,   3144,   7352,  -5452,   1536,  -8800,
-  1886, -18282,  -9787,  -8066, -12066,   1536,   4460,  -1345,
-  1418,   7471,  13451,  -7299,   5507,   6795,   -184,   8905,
- -2040,  -4933,   4998,   7317,  -6667,  -5134,   9094,  -8561,
- -2534,   3422,   2278,   3118,    205,   5811,   2247,   5946,
-  1078,  -2105,  -6946,    170,  -1625,  -4734,  -1447,  -4329,
- -4553,  -2230,  -8738, -15289,   7311,   6665,   5047,   1984,
- 11896,  13922, -10490,  -9313,   1424,  -2991,   1408,    335,
-  8914,   3773,   8814,   7917,  -4560,   -114,   -624,   8984,
- -1598,   -580,   3233,    590,  -2172,  -3162,  -3985,   5394,
- 13842, -11625,     73,  12826,  -1204,   5119,  10304, -10006,
- -2695,   1318,    156,     84,   -760,  -4638,  -3804,   3041,
-  -782,  -2994,  -3113,    637,  -3256,  -5831,    452,  -1204,
-  1614, -11626,  -4769,  10612,  -8710, -20019,  10542,  -4279,
-  6912,  -1429,   3812,   2844,   3903, -11622,  -8954,    180,
-  3898,   3858,    119,   1385,   4038,  -5899,   -969,  -5454,
- 13305,  -6748,   5934,   8027,  -7348,  -3797, -29781,  -4956,
-  2037,  -2331,  -3292,   8254,   6597,   4446,  -7848,   6250,
-  1400,  -1182,  -4966,  -3490,  -1410,  -2286,   3334,    350,
-  9271,   2987,   -934,  -5702,  -3881,    -97,   -671,   5108,
-  -133,   1302,  11630,  -8858,  -3027,    -42,   3682,  -1507,
-  3992,   5641,   2778,  -8698,  -2509,  -1360,     77,   2116,
-    98,   2853,  -6334,   5915,  -1214,  -2721,   8921,   1380,
- -4158,  -4315,  -4740, -21049,   7044,    866,   2094,  -9442,
-  9003,  -5147,  -4897,   3407, -11558,   4280,   4508,   6697,
-  1612,   1508,   8547, -14257,   -151,  -9530,  -7250,  11321,
--14430,  -4944,  -2488,   1349,   -248,  -1490,   1749,   3970,
- -5830,  20767,   4642,   3236,     36, -17079, -11099,   5996,
--10759,    -39,   7822,  -7527,  -1431,    179,  -3841,   2298,
-  1407,   -241,  -2303,   9244,  -3626,   6609,   1959,   -518,
-   368,   1678,  -5334,  -5849,  -4986,  -2363,    607,   2809,
- -1006,  -7695,  10022,   2216,  -8992,   4282,    807,  14707,
-  9528, -11065,   3014,   3157,   5597,   1139,  -1298,  -3642,
-  7839,    860,  -4336,   2624,  -4171,   1791,  -2825,   5362,
-  -529,   1494,    337,  -4487,   -671,   5360,   3283,   4933,
--14692,   4033,  -4365,   2713,  -6903,  -1784, -10862,   6173,
-  5278,  14859,   -852,  10020,  12304,   8898,  -3089,   9183,
-  1841,   8276,   4929,   -261,  -1264,    615,   3615,  14535,
-  6557,    519,   4228,   7382,  -1805,  -4529,   4992,   4277,
-  -342,  -9610,  -5193,  -7022, -23264,   2402,   -740,   2875,
- -5052,   1983,   4987,   3336,  -3806,   1335,  -2868,    846,
-  7652,    936,   3510,  -4570,  -3010,  -8805,   6177,  -4413,
-  5879, -15204,  -1632,  13416,  -4543,   3838,  -9293,   1744,
-   920,  15544,   3820,  -5852,   3935,   2357,  -6486,   1932,
- 12044,  -6374,  -2545,  -2389,   2755,  -8073,  -8203,   4659,
-  4286,  16128,   -987,    434,  -4495,  -4428,  -4816, -10329,
- -4529, -13408, -13283,  -1136,   4002,  -1271,   3547,  -5274,
- -5577,    701,   -365,  -2764,    370,   -369,   2611,   -832,
-  3862,   4604,  -7786,  11170,  -1453,  -1568,  10758,    168,
-   402,  -1985,   1436,  -8858,  10080,  -8559,   3998,  -4310,
--13478,  -3104, -11458,    506, -18194,  -3724,  -6768,   7960,
- -4213,   1121,  -1658,  -1141,  -1874,   -383,  -5090,    748,
- -1032,  -1207,   1046,  -1865,  -2387,   2126,  -3672,   6733,
- -2794,   3797,  15562, -11989,    170,   6129,    658,    929,
-  4800,  -4296,   -955,  -2189,   -188,   3180,   -118,   -766,
- -2182,  -6928,  -2254,   6615,  -4422,   6324,    -31,   3742,
- -5832,  -5022,   4671,   1574,  -6309,    288,  -2768,  -2492,
- -4818,  -5192,   -248,  -3236,   -429,    120,   1182, -10486,
- -2964,  -3713,  -5978,  11817, -20052,  -6525,   2054,   -879,
-  -602,  -2843,   7244,  -1372,    417,   -172,   3322,  -6556,
- -7021,   5842,   7357,  -2799,   3660,   7579,   4682,  -2242,
-    73,  -9247,  21061,  -2060,  -3614,   2486,   4793,  -2959,
-  -510,    -74,  -5982,   2274,  -4147,   3260,   1994,  -1678,
- -7494, -13624,   2560,  -7375,   -896,  -4945,  -2838, -11096,
- -1969,   5879,    444,  -3220,  14630,   4915,  -2376,  -8475,
-  9854,  11380,  11060,   1534, -14413,   4366,  -9544, -10646,
- -7654, -17916,   3481,  -3240,   1776,  -2436,  -8403,   3679,
- -1914,  12537,  -5540,  -5294,   5995,   5968,  -2609, -16882,
-   789,  -9506, -10075, -12142,  -7580,  -7090,  -2046,  11065,
-  7617,  -3503,  -2013,   3516,   6347,   -195,  -3119,   2444,
-    14,  -4998,    767,   4976,  -3974,   9038,    579,   1804,
- -8206,  32767,  -5633,   1018,  13388,    996, -12737,  -3179,
- -2058,  13663,   1274,  -4475,   7386,  -1698,  17927,  -6118,
- 15942,  -2922,  -3434,   5903,   6333,  -9149,  14140,  -1488,
-  2999,   1151,   2361,  -1935, -10243, -11566,  -5319,    965,
-  5146,   3652,   -441,  -2173,  -3484,   3685, -13595,  -1703,
-   -78,  -1408,  18517,  -3788,  -3266,   3162,    996,  19950,
- -8560,   4989,   6593,  -5329,   2950, -13896,  -3524,   5590,
-  4055,   6084,   2493,  12659,  -5786,   4858,   7252,  -7111,
- -7318,   5411,   7393,  -8714,  -3454,  -1562,   1919,    -49,
-  -680,   7285,   -398,  -2956,   7100,   5563,   -538,   1719,
-   -16,  -3824,    437,  -6842,   1504,   5694,   1214,   3209,
--15562,  -4365,   9329, -25577,   1425,  -2598,  -8389,  -6891,
- -3275,   3304,  -3993,  -6391,   -934,   7862,   4844,   -134,
-  9890,  -4646,   2468,  -9901,  -4111,  -3080,  -5056,    476,
--13099,   1447,    205,  -2424,   7098, -12075,  -4646, -13725,
-  8367,  -2910,  -8461,   1387,   3553, -10228,  -2771,   4698,
- -6483,  12234,  -8086,   3329,   2374,    452,  -1805,   5083,
-  2014,    164,   7143,     81,   6062,   2838,   5318,  -4982,
-  1440,   2014,  -3273,  -6658,   -798,  -3204,   1398,   -599,
- -5834,   2070,   4644, -17238,    390,  -1684,  -4932,   8961,
--12217,  -3079,   6574,   1387,  -5991,  -7803,   1285,   7439,
-  -395,  -3048,   2038,   -847,   -690,  -5127,   2228,  -4180,
- -3499,    530,   -584,   9884,   -323,    446, -15644,  -9162,
- -1683,   3643,  -3578,   2634,    496,   8097,    109,   1056,
-  1422,   5452,   6517,   -449,  -2389,    302,   6827,   1507,
- -3106,  -7188,  -4909,   -441,  12955,  -3933,  -5322,   5155,
--23171,  -2780,  -2655,  -4048,  12844,  -3709,   6555,  -5700,
-  3780,  -6566,  -4415,  11091,  11291,   6443,   9146,   -796,
- -1420,   5600,  12098,  -5790,   6619, -10474, -12177,  -5890,
- 21700,  11148,   3427,   3130,  -5727,  14646,  13953,  -2721,
-  1404,  -3102,  -4693,   4762,   1757,   2533,   3998,   -530,
-  -758,   5301,  -1426,   8948,   -720,   6877,  -3863,   2396,
-  5266,   -685,    890,  -7188,   2742,   -270,   8125,   -804,
- 32292,   6964,   8599,  -3466,  -1080,  -8423,   2070,   -295,
-  -157,  -5432,    152,   2478,  -3738,   1104,   1500,  -5290,
- -2463,  -6386,  -2537,  -2331,  -3290,  -2398,    159,   6588,
- -2547,  -2424,  -2184,   8316,   5670,  -5608,  -2600,   2659,
-   166,  14828,   2622, -10490, -16378,     64,    434,   4576,
- -3010,   2479,  -6798,   3431,    360,  -1067,   3421,    664,
-  4029,  -4050,   -240,   3875,    672,   3587,    501,   2494,
-   -48,   9997,   3259,   8551,  -7624,  17342,  10765,   4328,
- -3721,   1729,  -2844,  -6330,   5114,  15589,   -261,  -7554,
-  2708,   7260,   5852,  -8736,    436,  -6160,   -588,  -5919,
-  5752,   3127,  -4558,    540,     74,  -4048,   3735,   7873,
- -2869,   -544,   -111,   5182,   1032,   2315,   -159,   5105,
-  4106,   -494,    678,  -4756,  -3865,  -7389,  -2492,   7193,
-  5146,  -7926,  12043,  11137,   1719,   2307,  -5476,  12679,
-  7996,    726,    933,   3222,   7515,    678,  -5858,  -2716,
-  1503,  -3014,  -2125,   4982,  -4984,    467,    986,   5450,
- -1472,   5314,  -1285,    218,  -3411,   4511,   8047,   4268,
- -8307, -10587,  17200,   3303,   7553,   5361,   1108,  -7982,
-  8240,  -5856,  -3376,  -3952,  -2884,   4401,  -7252,   4078,
-  7538,   3420, -13834,  -1139,  10742,  -2536,    636,   7758,
-  4282,  -3505,   1190,  -7382,  -8164,   5306,   -408,  -5005,
-  2776,   7806,   4781,  -7903,  -2370,  13884,    542,   5643,
-  6948,   6471,   2699,    815,   4454,   1882,   2290,  -3856,
- -3086,   8215,   3234,   4444,  -1580,   2835,  -3083,   6706,
-  7409,   4626,   2658,   2308,   7965,  -1034,  -2584,    344,
-   704,  12280,  10344,  -8032,  -4410,  -6168,   6860,   7977,
- -5630,  -6680,  -5001,  -6199, -10378,  -1764,  -3322,  -4284,
- -1048,   2721, -11738, -11800,  -7975,   2754,   3424,  -7641,
- -2245,  -4945,   -194,  -1948,  -2850,   4111, -21846,  -8750,
-  4306,  24494,  10428,  26998,   4976,  -2701,  -3283,   -723,
- -1539,   6758,  -9730,  -3517,   6401,  -4546,   -410,  -9900,
- -4947,   6996,  10983,   5110,  19948,    -78,  -1794,  11051,
-   -14,    316,   6447, -20430,   9363,   9062,  -2134,  13711,
-  6448,   6655,  -5232,   4610, -10352,  -3042,  -8713,   5777,
- -2438,  -2602,  -7293,   -755,   6736,   2960,  -3676,  -2882,
- -9806,   1342,   1242,   2122,   2749,    631,   6502,   2266,
--12996,  13620,  19762,   8096,    702,  -4394,  -8668,  -1460,
- -3228,   -173,  -6239,   4643,  -1916,   4098,  -2234,   1202,
-  1763,   6170,  -6320,  12984,  -5936,   8301,   6021,   2191,
-   466,  -4044,  -1913,  -3458,   8197,  -3249,  -5935,   2383,
- -4241,   4977,  -4415,    704,   3488,  -8356,  10229,    562,
-    14,  -4828,  -3890,  -7599,  -4208,  -3166,   1132, -16584,
-  -506,   1397,   6266,   3307,   5782,   2349,   3257,  -3017,
-  7814,   1216,   7440, -10096,  12698,    944,   1221,  -1683,
-   152,   6020,  -7910,   3897,  -6954,  -9439,  -9838,  -3860,
- -5383,  -4228,  -1980,  -4045,   7442,  -5504,   2145,    636,
-  2857,  -4538,   -820,   4275,  -2104,   5076,   5191,   -363,
--23254,   1962,    -66,   7550,     88,   8721,  -1361,   7733,
- -2661,   5282,  -5112,    -24,   -975,  -3200,  -2235,   5144,
-   213,  -6340,  -3974,   1266,  -2383,   2432,   -124,   -233,
- -3504,  10604,    806,   -918,  11601,  19332,    206,   7456,
- -8885,  -9692,   3087,   3685,  -2183,  -7538,  11970,  -5098,
- -7364,  -1173,  -3099,   6532,  -6850,   4622,   -828,    390,
-   467,  -5364,   4442,  -1878,   8949,  -4340,   -261,  -2720,
-  6659,  16184,  -6552,  -3736, -15416,  15774,   -306,  -4240,
- -1807, -10304,  11073,   2743,   3974,  -5557,  -3499,   5315,
--10742,   -378,  -4517,  -5949,  -7664,  -2830,  -6510,  -6096,
-  2052,   3425,   1971,  -3328,   5326,  -1362,   1806, -14286,
--12774,   6058,  -3365,   -735,  -2586, -18658,   6664,   9502,
- -1590,    323,   6445, -17766,  14694,  -9786,   3696,  -4547,
-  1601,   3645,   -584,    910,   2516,   8197,   3898,   4306,
-   631,  -2020,   4309,   -765,  -6591,   2083,   8969,  -1474,
-   -27,   9130,  -5808,   8492,   -135,   2230,   2296,  -4509,
-  4600,   4951,   1930,  -2564,  -5889,  -1338, -11737,   6387,
- -3649,  -5447,  -2462,  -4751,  -1012,   3523,  -3504,  -9510
-},
-
-.cb1108m0 = {
- -2417,   4623,   2916,  -4257,    120, -10323,   1198, -10252,
-  -117,   8767,   3160,   2323,   1162,   -650,   2237,  -4171,
-  2386,    432,   1627,  -7255,     38,    124,  -3658,  -1558,
--11711,     10,   8146,   1700,  -1975, -16731,   2397,   1056,
- -2502,  -2660,  -2731,  -2477,   1488,   1220,   4880,  -1156,
-  1805,     -3,  -3009,  -6233,  -2216,   3440,  -3082,   2124,
-    70,  -2461,   1125,   1919,  11949,  -2506,   -622,   2209,
-  -702,   2685,   9183,   -510,  -2806,  -1129,  -1823,  -1746,
- -3600,   2298,  -3360,  10793,  -1714,   1662,    -62,    395,
- 14142,   -261,   -144,  -9896,  11481,   -884,  -2197,    352,
-  -326,   -453,  -1984,   2027,  -1466,   3290,     94,   3481,
-  2533,   4401,   5492,   3803,    247,   -896,  -1688,  -3166,
-  1130,  -1125,  -1973,    322,    867,  -1936,    714,   -880,
-     8,   2313,  23418,  -1682,   -677,    384,  -2140,   -386,
-   920,  -2523,   -495,  -1494,   3027,   -707,   1172,  -1403,
-  2177,  -2137,   -885,  -1035,  -1637,    375,   2452,  -3709,
- -1171,   2069,   1095,  -1937,   -686,   -956,   2034,   3410,
- -3075,   -359,   -598,  -2084,  18550,   1781,    -45,   1400,
- -1580, -13180,   -609,  -1376,  -3145,   -248,   5661,   6886,
- -3915,   -194,   9876,   1065,   3879,  -1726,   -837,   -660,
- -7467,  -3055,   3516,    283,  -1604,   -625,   1165,   3023,
- -1531,  -1825,   1430,   -561,   -881,   1346,   -129,  -1817,
-   851, -32768,   -294,   -188,   -116,   -646,   1176,    630,
-   903,    417,  -2487,    352,   -789,    571,   -127,  -2054,
- -2112,    418,   1631,    266,   -270,    362,  -2765,  -1198,
-  -182,   3586,  -1272,   1470,    -66, -18384,  -1230,    823,
-  1171,   1350,   1101,   1410,  -3730,   1535,   -101,  -3234,
-  2315,    -34,   -458,   1361, -16497,   -990,   1438,   2542,
- -1193,    586,  -1708,   2689,   2741,   6010,   4209,  -5974,
-  -628,   1556,   2238,   6134,  -3040,  -2937,   2188,  -1660,
-  1137,   1316,  -2650,    905,   -502,    -93,  -1177, -31964,
- -1170,   1504,  -1284,   -104,    168,     55,   3478,   -161,
-  2818,   -484,    -32,  -1536,   1218,   -854,   -351,   4465,
- 16922,    681,   4198,    419,   -414,   6824,  -3906,  11598,
-    75,   4904,   1374,     64,  -2692,  -3759,   3065,  -1397,
-  -202,   -347,  -2466,     96,   1035,   -765,   -258,   3711,
-  1437, -18250,    566,    976,   2483,      4,  -1096,   1906,
-  3745,  -2621,  -2756,   1864,   -560,     98,    821,  -4094,
-  5349,   1369,  -5245,  -2170,   2932,  -1052,   3932,   -413,
-  -400,  31206,   1125,   1631,     43,   -764,   1666,    780,
-  2036,   -564,     64,   1311,   -202,    843,  -2030,    856,
-  1766,  -3163,  -1158,   -626,    316,    127,   1783,   1918,
-  3384,  -2887,  -5885,   1763,   4910,   -248,  17100,  -3022,
- -1880,  -2927,  -1287,  -3308,  -1767,  -2622,  -1460,   -250,
-  3597,  -4526,    946,  -1533,   1059,     -8,   -807,  -1283,
-  1436, -11184,    643,    398,  -1565,   1983,    -60,  -9862,
-  1219,    322,   3132,  -2043,   1138,   6258,  -3540,    790,
-  -923,  -4692,  -1401,   2733,  -8918,   4905,   6181,    192,
-    82,  -1094,      4,   -634,  -1323,  -2865,   1036,   1484,
- -2461,   -937,    414,    221,   2179,   -438,   1273,  -2690,
- 18442,   2781,   1788,   2264,  -1230,   4284,  -4708,   1190,
- -4810,   -975,    230,  -3728,   2504,   3602,   3488,     88,
-  1322,    487,   2965,  -3731,  -2341,   5937,   8545,   1716,
-  7308,   9017,   6426,    727,   3992,  -4584,    388,   3714,
-  1164,     18,    445,   1253,    398,  -1989,   -824,   -430,
-   745,  -5447,   2176,  -1986,  -3963,   2861,    194,  17739,
-  1891,  -5368,   4172,    125,    530,  -2766,   1179,    401,
-  1759,  -1609,  31234,    910,   1100,   1036,   -948,  -1101,
-  -614,   1768,   -344,    840,   -696,   -842,    320,  -1444,
- -2560,  -3199,     58,  -2172,   1375,  -3002,   -821,   -863,
--12096,  -2484,   -677,  -2130,   4450,   3568,  -3192,  -1114,
- -3218,   3121,   -503,   5570,   -561,   3896,  10566,  -3065,
- -2768,   1398,   1719,  -2708,   1952,   -142,   4777,   -978,
-  2238,  -5780,   -430,   1228,  -1298,  -2923,   4353,  -1621,
- -2368,  -2908,  -8012,   4398,   -502,    518,  -6964,    622,
-  -377,   3758,   6598,   4438,   6849,  -7696,    470,   3585,
-   466, -14664,   3438,  14706,  -1944,  -2544,   -785,   3653,
-  1274,    443,   -694,   1968,  -3499,   2855,  -3930,  -1210,
-  -528,   1931,   3849,   -772,  -2659,   4499,  -3624,   -540,
- -1645,   -949,   -382,    979,    595,    165,    429,    -80,
--20468,   1040,    544,   2545,  -5010,  -2122,  -2840,   -335,
-  -405,    404,    -50,  -2996,   1226,    519,  -1046,   3745,
- -2317,   6211, -14500,   9754,  -5802,   5230,  -3112,   1506,
-  3741,    664,   -902,    197,   2476,  -3618,   2040,  -1066,
-  2338,   -257,  -2580,   -293,   2740,   -576,   2050,   -865,
- -3666,  -2090,  -1831, -32056,    658,   1549,   1602,   1728,
-  -534,    390,  -1517,   -627,  -4025,   -797,  -2351,   2759,
-  -102,   2574,    -56,    796,   -232,   -886,   1639,  -2773,
-  1007,    830,   5880,  -2220,    762,  -3834,  -2865,   -415,
-   584,  -3498,  -4546, -16108,    344,  -4072,    551,  -5435,
-  2007,  -1418,   3838,  -1662,   1981,   3545,   1424,    769,
-  2135,   1705, -15076,   -636,    283,   3386,     97,  -1048,
- -3933,    204,  -8616,   -556,  -2936,   4241,   5100,   1777,
-    98,    719,   6202,  -1496,    708,   2160,  -2396,   4060,
-  1513,   2253,    -46,  -1823,   -132,    709,   -756,   -944,
-   575,   1070,  -1583,    587, -24575,  -1989,    874,   -568,
-  1040,   1116,  -4002,   3196,   2826,    117,   1590,   2456,
-   938,    112,   -938,  -1268,   5056,  -2851,   2995,   2559,
--13121,  -8374,   3593,  -6684,   3663,    766,    747,   1016,
-  -921,   2241,  -1942,   4269,  -3312,  -1012,   2340,   2781,
- -3881,   2532,  -1976,  -1436,  -3219,    420,  22088,   -742,
-  -640,   3270,   1446,   1935,   1279,   1913,   1377,  -3297,
-  -751,   4209,  -1052,   2381,   2938,  -1330,   2154,   2784,
- -2420,   1270,   2334,   -526,   1480,   -435,   2206,    252,
-  -510,  -1018,  -1469,  -1294,   -950,    424,   1058,  -2317,
-  -846, -20737,  -1877,     88,   -431,  -1268,    116,   -378,
- -2326,   3115,   -246,     30,  -4725,    648,   2084,  14286,
-  -817,   2496,  -1947,  -4869,  -9703,   1505,  -2476,  -2108,
-   747,   -449,   3002,  -5464,   -514,   1805,   2559,   2494,
- 12782,  -1232,  12091,   2118,   3996,   2592,   1058,    510,
- -1384,  -3050,   2533,   -408,   5219,   3044,   3242,   -185,
-  2654,  -3723,     16,  -1723,   1823,   6144,  -4806,    182,
-  1772,   4841,  16390,    -96,   2505,  -7713,  -5244,  -3316,
- -6776,   1448,  -1470,   4238,    294,    889,  -2372,  -6281,
- -2423,   5423,   2119,   2897,   1378,    817,   -993,  -1599,
--14662,   3014,  -3397,  -6182,   -245,   4897,   5116,   2285,
- -2863,   1174,    415,  -6777,   3863,  -6009,  -4722,   -119,
-   606,  -2247,   4447,   1064,  -1935,   2705,  -2629,  -1144,
--11980,   3805,    882,   1634,   5446,  -4300,    643,   3436,
-  7632,    592,    998,    674,  -2647,   4644,  -6854,   1368,
-  -146,  -3395,  10599,   1369,   3852,   1689,   2437,  -3937,
-  3405,   2517,   1895, -14092,  -1142,   2570,  10163,   1608,
- -2445,    850,  -1678,   3112,  -3465,   3138,   4413,  -1973,
- -4151,   1163,   1822,  -3819,  -1568,   -407,  -2642,    424,
-   365,  -3599,    164,  -1448,   1062,   1536,   1590,  -1982,
-   200,  18572,   -230,   -638,  -1253,   1650,   2280,   4945,
-  4527,  -2353,  -4216,   3752,  -3807,   3686,  -4816,   2382,
--14833,   1306,  17246,   -739,   2012,   3521,   1473,  -1436,
-  1514,   -142,   -461,   1038,   2462,    971,   1354,   1272,
-  1787,   2420,   -922,   3364,   2250,    497,   1349,   2795,
--32768,    425,   1874,    -72,   2461,    389,   -306,  -1180,
-  -646,    251,    299,  -2735,    577,   1055,   1826,   1620,
- -1214,   1422,   -901,  -1273,  -2367,  -1241,    366,    521,
-  -433,     55,   4000,   3035,  -1390,   2505,   1786, -15397,
-   413,  -5916,   -234,   3559,  -6776,  -5068,   2251,     36,
-  -180,    596,   5744,  -2450,  -1276,  -4786,  -1872,     24,
-   252,    464,   2833,   -136, -25600,    -33,    873,   2646,
-  1471,  -1336,  -1330,   -276,   1778,   -242,   -951,   1580,
-   -79,   -858,   -927,  -4310,   -604,   7568,  -1713,   -948,
-   192,   -260,  -1334,  -1116,   -705,    638,    132,   1186,
-  -952,   1157,    428,   2039,   1568,   1778,  22453,  -2190,
-  2176,   1674,  -3996,   1294,   1162,    274,    415,  -2877,
-   464,    505,  -1842,  -1066,  -2241,   -761,   -291,      8,
-  -987,   -104,    796, -32768,   1302,   -809,    571,   1214,
-   455,    686,    656,  -1752,    886,   -790,    644,  -1114,
-  2358,  11452,  -4398,   1334,  13095,   3230,  -1818,   4053,
- -1990,  -1093,    878,   3796,   2712,  -1523,  -1229,   1077,
-   960,   1250,    -75,  -3233,  -7734,   2783,   8430,   -327,
- -1428,  -1687,  -4092,    269,   3161,   -569,  -1267,   1774,
-  2772,  -2033,    171,   -520,   1551,   3719,  -3364,   -220,
-  1904,  -1282,  -2008,   -818,   4261,   -886, -19201,  -3454,
-  -478,  -2645,  -2601,  -2124,  -3977,   2960,   1563,   -432,
-  -989,   2682,   1734,  -9085,   4614,  -4454,   2535,  -7201,
-  -220, -10022,   -431,  -7907,    889,  -9658,   6653,    762,
- -1827,   5886,    862,  -1836,   -430, -16363,   5709,    851,
-  1814,    304,   5045,   1685,  -1004,   5108,  -5936,  -3143,
-   940,   1832,   -270,   -674,   1441,   -241,   3222,   -551,
-  -434,    -69,  -3584,    349,  -1354, -12080,   3639,   5219,
-  7583,  -1023,   2078,   3263,  -5807,   -873,   4085,  -5153,
- -3623,   -436,  -4717,  -1803,  -6274,  -2049,   -247,   2516,
-  1922,  10204,   2194,  -1574,   -535,    656,   1638,  -3091,
-  1156,   1377,  -1220,   4956,   -221,   4984,  -1154,   4603,
- -1618,  -5655,  -2583,  13494,  -2442,  -3968,   3086,   1098,
- -1625, -13781, -12826,   2659,   3604,   -702,  -1900,  -3508,
- -6283,   2320,   1979,  -2823,  -4890,  -1728,      2,  -4402,
-  -437,   1932,  -3272,   2853,  -3018,    840,   -632,  -6691,
-  -484,   9579,   1008,  11677,  -2814,  -2029,   8048,  -1170,
- -7366,  -2664,   3349,   1319,  -1160,  -1864,    606,   1568,
-  5428,  -4763,  -2470,   2145,   1798,   -502,  -1538,  -3736,
- -1376,   1330,  -3567,    -78,    478,   -743,    890,   -800,
-   -44,  -1832,  -1761,  -1022,   -996,   -846,   1188,  -1042,
- -3202,  -2439,   1602,   3601,    564,  18338,    -17,   1327,
-  -387,  -1998,  -1260,   3352,    849,  -4780,   1932,    -56,
-  2625,  10753,  -1676, -10536,   2980,   1542,   1177,  -3113,
-  -859,    522,   3092,   9588,   2882,  -4540,  -1406,  -5183,
-    50,  -4245,   3649,   -420,  -3612,  -5290,  -1919,  14559,
- -2605,   1169,  -2009,  10760,  -2372,    339,  -2538,   4476,
-  3001,  -4570,  -3158,  -3465,   2873,    650,  -2099,     76,
-  1166,  -1469,  -2769,   -391,   4215,   -630,  -1448,  -1796,
- -1573,   5914,    807,  -1580,   2072,     99,    580,  -2999,
-  1079,   -202,  17940,  -1233,  -4909,   1079,    390,   -891,
-  1834,  -2155,  -2642,  -1703,   1856, -14125,   2081,   3178,
- -2480,  -4342, -11991,  -2050,   1046,   2412,    436,   1046,
- -2291,  -1718,  -3087,   1710,   -963,  -1914,  -3423,   6190,
- -1238,  -4333,    115, -10550,  -2742,   -919,  -4849,   1502,
- -3054,  -3304,   2300,  -1850,   2337,  -6643,   1995,  -1279,
-  -238,    738,   -124,  13593,    252,  -1424,   -165,   2786,
- -1717,   -838, -11244, -10971,   -902,  -3330,  -2580,  -2735,
-  -171,   4041,  -2149,   2502,   6726,   -738,  -4235,    368,
-  6144,  -1718,  -8620,  -1888,    112,   -282,    -19,   4126,
- 10797,    610,  -3097,   7783,  -2974,  -2058,  -3558,    470,
- -5914,  10322,    -20,     85,  -1652,   6111,  -1398,   2613,
-  3733,  -3716,   1930,  -4325,  -1199,   -921,   -446,   1095,
-  1006,    910,  -2323,   -351,    808, -32768,    274,   1346,
-   105,   2360,  -1184,   2249,   -970,    153,   3180,   1307,
-  2207,   -962,   2209,   -921,   1504,   -117,  -2111,  -3734,
-  5738,   8014,     76,   1566,   3013,   -462,  -3600,   3939,
-  4862,   1038,   4312,   -790,   -426,  -1656,     20, -10568,
- -6389,  -6597,   4230,   2910,   2504,  -2962,    256,    814,
-  -488,    824,   -355,   3574,  -1890,  -2657,   -767,   2730,
- -1087,  -2538,  -3522,  -4067,   6249,  -3354,  13923,   4070,
--11004,   4703,    909,  -5968,  -5483,  -4242,   -780,  -2489
-},
-
-.cb1108m1 = {
-   752,  -4098,   7726,    592,  -9487,   2004,    318,  -4322,
-  6989,  -3350,   -478,  -4308,   2023,    753,  -7081,  -3934,
-  -866,   6267,  -5710,   2100,  -8467,    100,  -4654,  -6773,
-  4271,  10728,  11618,   1128,  12733,   1471,  -5518,  -1162,
- -2159,   -402,   -632,  -4720,    -28,  -1412,  -1037,    897,
- -1242,  -1735,  -2632,  -3460,   3389,   -582,    206,    325,
- -2547,     46,   1340,  -4424, -13408,  -4918,  -2832,   1454,
-  2127,   1276,   2292,  -3973,  -3230,  -7810,    542,   4227,
-  2673,  -8490,   -902,   1361,  -1398,  -1986,   -991,   -680,
-   602,  -2887,   -557,   2656,   3214,   1794,  31241,   1462,
- -1457,  -3750,  -1923,  -2381,   1313,   -128,   -172,   -647,
-  -574,   1045,   2438,   1662,    503,    288,   1535,  -1016,
-  2487,   -820,   4692,   2799, -31949,    166,  -1655,  -2192,
-  -636,   1357,  -2361,   -459,  -1752,   2782,   -293,   -144,
-  1900,    685,   1766,   1900,   -347,  -4488,    590,    915,
-   798,   1133,  -4494,  -1388,     75,    884,  13088,  -2392,
-   679,   -315,  -7520,   1086,   3873,   3297,   -812,   -626,
- -9443,   2548,  -6417,   1619,   7196,    -57,      5,   3594,
- -1922,    184,   2784,   -261,  -3310,   2779,    174,   2814,
-  -965,  -2912,  -1835,    425,  -4285,    896,   2001,   3717,
-   775,  -1192,  22365,   -175,   1522,   -711,  -1135,   5123,
-  -517,    870,   4323,    585,   -437,    260,  -1737,  -1984,
-  2522,  -2539,   -973,  -8812, -16173,   4678,  -4107,    130,
- -7832,   1140,   2792,   3394,   -692,  -4105,   -299,   1488,
-  1246,    604,   2796,  -3767,    579,    188,  -1544,     86,
-   424,   1204,   4441,  -1000,  15227,   3459,  -3444,  -1631,
- -2177,   3497,   1684,    925,   2872,  -3905,   5729,    647,
-   913,   -758,   -547,    566,   1787,    792,  -1509,  -1641,
-  -926,  -1515,   -116,   1266,    481,  -3944,  28526,  -2279,
-  5577,   1026,   4082,   -605,    696,   1094,   -478,   5732,
-  7247,   1461,   1521,   -234,    -42,   -878,    270,   -554,
-  3702,    -71,   1362,   7719,    305, -13654,  -4985,  -1072,
- -2044,   6851,    438,  -8435,    923,   -537,   1511,  -1003,
-  2056,  -2299, -15578,    503,   1944,   3188,   2318,   1761,
-  1290,  -2322,   -568,  -1591,  -2746,  -1966,  -9784,   1514,
- -5596,   4070,   -181,  -3006,  -1903,   -240,  -1143,    393,
- -1530,   -822,    520,    989,  -1600,  -3374,    946,    678,
-    86,  -1957,   1947,   1188,    356,    719,  -2874,  -2245,
--19010,    547,   9067,    439,  -2384,    847,  -3307,   -116,
- -1114,   -445,  -3505,   -967,  -1252,   4880,    625,   1478,
- -2970,  -2275,   1337,    422,   3870,  -1906,  -1033,   1724,
-  -532,   1734,   1011, -21848,   -477,   -251,   -615,    770,
-  7520,   1030,  -4372,   -446,  -3156,  -2314,    172,    901,
-    70,   1837,   1205,  -1344,   2933,   1080,  -1290,   1353,
- 10205,   1158,  11135,    560,  -3480,  -2376,   7539,  -5418,
--14092,   2138,   -253,  -9344,  -1907,   2177,    687,   2772,
- -2730,   -546,  -4180,   2021,   -577,   2530,  -3822,  -7080,
-   971,   2083,  -1220,    203,   3187,   3705,   -752,  -2591,
-  -704, -17469,  -1168,   -214,   2518,    308,   -585,   1117,
- -1893,   2488,   1856,    -23,   2418,  -2922,   1960,    235,
- -1629,  -8277,   1088,   2032,    874,   2763,  -1867,     60,
-  1684,    834,  -2676,   1574,  -3098,   3250,  -3723,   -126,
-    59,   -787,   2710,    930,   1384,    475,  -3915,  -1162,
-  1640, -16818,   2356,    -70,    761,   4151,   -778,    523,
-  -183,  19374,  -4223,  -1379,  -1667,  -1690,   -512,   8742,
-   -34,   3816,   -678,   2749,   2418,   -341,  -1216,   4280,
- -2208,   -264,  -2884,   4679,   -821,   1824,  -6724,  -1528,
--12042,  -9908,    935,   4338,   -116,    612,      6,   -161,
-  1935,   1600,   -442,   4059,   2510,   2186,  -7678,   3600,
- -2460,  -1072,   -122,  -1817,   -246,   2786,   9079,    525,
-  -226,   2628,  -2549,   1459,   4533,   1111, -17410,   4529,
- -2545,  -3272,    403,  -2758,  -1876,   2734,   2136,  -6171,
- -2055,   1163,  -2820,   2992,   2978,   1458,   1572,   2508,
- 13576,  -1545,  14861,   -796,  -6444,   4022,  -4358,   -529,
-  3439,  -2630,  -2457,   3030,  -2972,   -398,    471,   2547,
-  1127,   1344,    202,    420,  -1858,   -589,    594,   1478,
-  5590,   1682,  -1560,   -378,  -2198,    400,   2231,    566,
-   -80,  -2042,  -4557,  -2309,   8743,  -4258,   1291,  11770,
-   718,   2342,   2912,   5170,   2470,   6832,    833,   4990,
-  2009,  -1258,   -898,  -1414,   1214,    670,  -2104,  -5068,
-   788, -18997,   -743,   -864,   -356,   1592,  -5786,    652,
-  4952,  -2319,  -1097,   2177,  -1654,   2879,  -1645,   -172,
- -1581,  -3062,   -805,  -1065,  -2222,  20857,  -1146,    864,
-  1690,  -1794,    855,    307,   2320,   3618,   6184,  -4129,
-   187,  -2423,   4946,  -3072,   -213,  -2621,  -2026,  -5793,
-  -986,  -1597,   2125,   1474,   1766,    360,  -4652,  -1030,
-  1546,  -1085,   -253,   1016,    -96,  -1608,  -7017,  -4855,
-  1295,   -271,   3751,    341,  19804,  -2006,   2322,  -2298,
-   353,  -2077,   -764,    212,    150,  -1140,    564,   -614,
-   268,  -2023,   -332,   -699,   -937,   1684,  -1617, -22863,
-  1202,   -144,     62,    373,   -598,    184,    987,   3721,
-  -611,     86,   3676,    362,   -652,   -214,   -311,   -694,
- -1973,   2351,   -733,  -1601,  -1189,  28227,   -154,     10,
-  -347,   3400,   1333,  -1695,   -773,   1362,   -447,  -2999,
-  -626,  -1776,   2474,   2195,  -1041,   -797,   1828,     62,
-  3397,  -1779,  -2924,   1740,  -1694,   4083,  15100,   3871,
- -7821,   -108,    292,    998,   3141,   5813,   -918,  -1290,
-  -902,    895,  -1336,    -50,   2014,  -2066,   2383,     68,
- 31769,   -334,   1243,   1981,   -715,    125,   -380,  -1272,
-  1068,   -357,  -1734,  -1138,   -630,   1042,    688,   -438,
-  -558,  -2460,  -2894,   4196,  -1004,  -2177,  -2291,  -4701,
--13990,    747,  -5558,  -2754,   1950,  -2780,   8414,  -1286,
-  -946,    220,  -2507,   -192,   3726,  -1361,   1296,  -2215,
-   872,   8270,  -2797,  -6732,   1256,  -1957,  -2916,    107,
--14847,   1868,   4638,   1292,  -1006,   5285,   2947,  -5028,
-   942,    153,    420,  -1152,   -391,   3612,   4621,    172,
-   762,   -876,  -3561, -14406,   -552,  -2570,  -4448, -15704,
-  -806,   -928,   3380,   -686,  -2604,  -3895,   -714,   -626,
- -1763,   1144,    485,     34,  -1922,   1528,   -213,   5050,
-  -804,    185,     96,   3320,   -621,   -329,  -1444,    864,
- -1684,  16583,   1872,   3327,   2146,   1132,  -8216,     73,
-  6524,   1623,  -4147,  -4985,   1450,   -646,  -7189,   4524,
- -1596,   2120,   3913,    680,   2094,   1660,    752,  -1221,
-  2414,   3986, -10314,   2096,    129,  -5458,    634,  -5426,
-  -594,  -9731,   2083,  -2284,  -5085,  -4777,  -1323,  -1740,
-  6157,   -841,   -126,    247,  -1163,  -7005,   3863,   -764,
- -1552,   1356,  10788,   -745, -12481,    -73,   5234,  -3220,
-  2979,    635,   3372,   -540,    -36,   2887,   5221,    931,
- -1724,  -4824,    780,    -49,    120,   -739,    890,    714,
- -1438,   -458,  -1861, -16732,  -1858, -13282,   2182,  -6796,
- -3307,    556,  -2968,    542,  -2358,   1463,  -3536,   1866,
-  2833,  -1369,  -1576,  -2825,   3561,  -1625,   1858,  -1052,
- -1079,   1302,  -2049,  19052,  -1188,  -4137,   1592,  -4705,
-  1082,  -1168,   2355,    649,  -1900,  -2582,   1000,  -3065,
- -2399,   3625,   1062,    860,   2586,  -2645,  14755,   3147,
-  5002,  -6720,   1728,  -2114,   5090,  -2838,   3020,  -5048,
-  4182,   2237,    706,  -4945,    -86,  -1908,  -1207,    135,
-   675,   -200, -22134,   1492,   2490,  -1324,  -1135,   -842,
-  1457,    185,   1342,   3516,   -882,   1069,   1159,    -52,
-  1844,  -1186,    554,   3860,   1824,  -2136,   -881,  -1281,
--13259,   -705,    -90,   2150,    573,   2787,   1068,  -1968,
-   121,    805,   4382,  -1033,  -9220,   -744,  -1446,   7180,
-   257,  -5983,  -1643,  -6198,   1854,  -3524,   1060,   -118,
-    56,   -843,   2832,    -98,  -3493,    368,      6,  -1877,
- -3615,  -1954,  17971,    962,   1532,  -1754,   3776,    661,
- -2025,    -60,  -1013,  -1222,  -3062,    -69,  -4933,   3064,
- -1176,    213,    477,   1081,   1679,  -2328,   1984, -21759,
-  -881,    -54,  -1101,  -1092,    598,   1648,  -3384,   -213,
-   379,  -1318,  -1972,    630,   -536,  -1970,   -461,   -356,
--22416,  -1855,   -113,    876,  -2809,   -587,  -2323,    -56,
-  2177,   -797,   1649,  -4069,   1350,  -2075,    101,  -1384,
-  1703,   1085,    471,   8093,   1020,  -4112,    970,    866,
- -1456,   -341,   1418, -12938,    379,   9787,   1814,   2337,
- -1705,   9913,   1026,   1962,   -744,  -2900,  -1690,   1534,
-  -959,   -629,   2330,   3735,   4742,  -3139,  -2135,   2298,
- -2765,  -1389,  -3634,  27139,    671,   2208,    494,   1015,
- -1197,   -239,   -321,  -1145,   -679,   -637,  -3116,    544,
-  -952,    882,    396,   1087,  -3163,  -2684,    759,   -725,
- -2186,   -542,   2545,   3669,     24,   1689,  10473,   1836,
-  -419,    322,   2475,   1908,  -1346,     50,  -6401,  -3644,
-   552,   2348,   1327,  11853,   2467,   5493,   1544,    464,
-  1796,  -2801,   8217,   1014,  -2103,   3764,   8091,    170,
--12422,   1708,  -2438,  -1873,   1970,   2160,  -5027,   -647,
-  -118,   2830,   2379,  -1091,  -5723,    124,   3017,    417,
-    55,   1376,  -1079,   7122,   3086,  17847,   2468,   3273,
-  -599,   3302,   -922,  -2073,  -1696,    805,   2022,  -1899,
-  3188,   1425,  -4364,   -140,  -3760,    437,   1393,  -1298,
- 17166,  -1283,  -2904,   -692,    518,   -404,    944,  -1990,
-  -968,   1323,   2376, -11708,   2187,   3164,   -559,   2212,
-  1598,  -1741,    360,    633,   3075,   -660,  -1012,    778,
-   565,  -2020,   -123,      5,  -2217,  -2967,    374,    272,
-   336,  -1725,   -408,  -2270,  -2645,  -1044,   -517,   1911,
-  -386,  -4439,  -7603,  -1000,   7660,    589,  14931,   2901,
- 11998, -13102,  -1919,   3904,     86,   1617,   7324,   3078,
-  1714,   4636,  -2504,   -194,  -3274,   -710,     33,  -1965,
- -2298,   2513,    726,     75,     67,    884,   2104,   4110,
-  1936,  10387,   2722,  -1970, -12496,   4799,   3086,  -2938,
-  1719,  -2138,   -338,  -1124,    971,  -4200,    480,  -3361,
-  6220,   5954,   1830,   1001,   2996,   4166,  -2854,   -437,
- -1430,   1072,   -312, -12949,   3113,  -2479,  -2034,   6956,
-  2805,   2128,    856,  -8803,  -4709,  -1274,   -120,   1252,
-  3898,   6526,  -3914,  -2276,   2754,  -2604,  -3038,   4136,
-  2598,  -2172,   4861,  -2457,      2,  -2693,   -808,   3527,
- -1184,    392,  -2202,   2406,    960,  -1064,  -2589,   1161,
-  2418,    728,   -466,  -4865,    211,  14720,  -2093,  -1977,
-    85, -12618,  -2073,  -3028,  -1067,   1734,  -2491,   9506,
-  -422,  -2718,  -2966,   3883,  -2852,    336,   1306,  -2297,
-  2009,   2589,   3071,    192,  -1239, -10553,      2,  -1174,
- -3036,   9939,    -27,  -1278,   1448,  18655,    761,    931,
-   445,    -94,    206,    448,  -1865,    232,  -4353,   4596,
-  -260,   -976,    594,    648,    796,  -1376,  -1186,   3056,
-  3171,  -5675,   6179,  -1287,  16934,  -1478,   1090,    577,
-  8075,   1119,   2943,  -3208,   1852,   1986,   6003,    901,
-  -962,  -3196,  -1907,    392,  -2605,   2796,   4082,   -456,
- -3109,  -1219,    123,   2470,    174,  -1254,  -1350,  -4919,
-  1271,  12302,  -1154,  -6317,  -3346,  -1315,   -144,   1214,
-   -49,   3491,  -1029,  -2043,  -8373,   4197,   4971,   9808,
-  9732,    700,   2247,  -2755,  -2034,   3260,    839, -10554,
-  1661,  11484,  -3180,  -1909,   1089,   -813,   3116,  -2103,
- -3726,  -4514,    663,   1152,   3902,   4862,   2739,  -3828,
-   707,   2712,  -8009,   -832, -16492,  -1472,  -2422,  -5593,
-   322,  -1894,   2810,    109,  -1788,   2050,   3539,  -3112,
- -6178,   2487,   2102,   -135,   3163,   2096,   4123,   -310,
- -1090,     -2,  -2662, -17087,   1373,   1448,    162,    527,
-   655,  -2248,  -3530,    194,   1305,   7590,  -5515,   1225,
-  1607,  -3816,   2185,  -2679,  -4486,   -582,   4981,  -1675,
-   147,  14790,    119,  11771,  -1228,   1012,  -6133,  -2247,
- -3913,   1348,  -1846,   -513,  -6386,   -749,   6726,    745,
-  -809,   -799,   3224,     43,  -2230,   2598,   2994,  -1590,
--11198, -14476,   -256,    695,    877,  -3680,  -2734,  -1448,
-  1336,  -1633,   3327,   3497,   2956,   -782,   2958,  -1866,
-  2876,   2003,   -856,   1282,   5068,    391, -10539,   1703
-},
-
-.cb1110l0 = {
--14944, -14950,    -73,  -1141,   1532,   -575,   -620,   -816,
-  1185,  -1597,  -2651,   1426,  -1458,   1317,  -1320,    -19,
-  -209,   -352,   -163,    912,    -85,   -180,   -546,  -1121,
-  -435,   -345,    229,    364,   -850,    632,   -426,   -359,
--32768,    278,  -1021,    310,    -31,   -355,   -442,   -234,
-   415,   -202, -10393,   1645,   -378,  -2270,    837,  -1857,
-   556,   -935,  -1344,   3016,   3452,   1597,   1378,    466,
--13740,   -878,   1475,    237,  -1301,   9756,   -592,     23,
-  -192,    335,    -58,    285,    376,     40,     24,    292,
-   426,  -1962,   -798,    745,   1379,    -34,    397, -14748,
- -6285,   7343,  -6374,   4442, -14800,   1878,    -24,   1606,
-  -728,   -476,   1754,  -1052,    911,   3139,  -1444,   -222,
- -1968,   1858,   1330,    244,    213,    935,    -92,   -348,
-   155,    418,  29128,    236,   -190,   -226,   -309,   -178,
-  -690,     46,    716,   -534,    147,   -630,    -75,   -826,
-    37,   4745,  -1056,   2400,   1398,   1494,    460,   -221,
-  2908,   -656, -15611,  -2940,   2342,    -98,    581,  -3144,
-  -471,   3772,   2057,   1583,  13738,   -139,    330,   1175,
-   429,     63, -14544,   -374,   1439,  -1226,   -422,   -690,
-   816,   1279,   -592,   1642,    700,   1338,      0,   -714,
-    46,    377,   -188,   -366,   -197,   -637,   -622,   -262,
-   -69,   -637,  -1266,    257,    620,  -1040,    324, -19064,
-  -602,   -463,  -1329,    513,   2699,   -421,  -1918,   2250,
-  -404,    403,  -1514,    134,    147,      3,    426,    605,
-   276,    561,    -26,   -294,    630,   -500,   -480,   -133,
-  -712,  -1144,    238,   -633,    173, -29164,  -1182,   -274,
-  -138,   -271,   -232,     30,    706,   -168,   -848,    704,
- -2132,   -248,   -108,    669,   1165,    234,   1243, -12201,
-  2208,  -1971,   -829,  10305,  -3964,  -1502,   -409,  -3918,
-  4520,  -2259,   -797,   2235,  -5560,  -1710,  -2472,    280,
- -1747,   -980,  -4529,  -5208,  -1813,    330,    890,  -6220,
-  -710,  -5583,  -4704,   -913,   2920, -12484,  -4340,    334,
- -1303,    283,   -740,  -1261,   3556,   3210, -11640, -14438,
- -2557,   -795,    747,    546,  -2488,   1891,    485,    725,
-   338,   1579,   2092,   2354,    284,   2812,    490,   1442,
-   187,  -2699,   1196,  -1783,   1228,   2364,  13364,    258,
-  2102,  -6163,   -200,  -5475,   2804,   -576,   6878,  -2852,
-  2246,   1186,    584,   -136,   5258,   3825,   3045,  -1661,
- -5246,   2548,  -5054,  -4383,  -1542,  12912,  -1580,   1268,
- -1415,  -2012,   1021,  -2106,    979,   2390,   3411,  -1076,
-  -439,   5416,   1333,    440,   3422, -13384,   2540,   2544,
- -3668,  -2308,   1042,    589,   4166,   5090,   1539,  -3447,
-  7003,  -4396,    319,   -590,    481,   -471,  22260,  -1936,
-  -297,   1302,   1163,    937,   -164,    847,    768,    827,
-  -430,    792,    472,  -1557,    712,   -602,  -1007,   -278,
-  -974,  -3198,  10560,  -2124,    335,  -1206,    629, -13712,
-    12,  -1673,   -691,   -666,  -2890,    826,   1792,  -1547,
- -2016,    807,   1810,    841,   -814,   1214,    760,  -1056,
-   404,    -94,    144,    297,   -584,    106,    116,   -132,
-   236,   -507,     86,    853,   -670,    413,  32767,    730,
- 10835,   -502,   1297,  -3857,  -1035,  -1602,   -164,  -1721,
-  1468,    507,   1064,   1478,   4323,   -760,   -882,  -4331,
-  2564, -10933,   3000,   2101,  -2492,    -72,  12636,   2743,
- -1113,  -8334,   6720,   2348,    491,    -23,  -1065,   1506,
-  2090,  -1731,  -1997,    675,    425,   8165,    695,   2285,
-  -433,    515,   -465,   -347,  -1006,    357,    -55,     57,
-   481, -31494,   -816,     60,     76,   -439,   -328,   -217,
-   265,    123,    839,    218,   1355,    243,   -878, -12819,
-  5168,    318,   1376,  -2931,  12689,    -83,   -220,   2848,
-  -770,    150,   1631,   1955,   1552,  -1371,  -3053,   1752,
- -7250,    -24,   -514,  -5568,  -1529,   -112,    419,  -1136,
-  -672,  -1847,  -1136,     90,    453,   4810,  13012,  -2355,
- -2477,   1393,    451,   3390,     12,  -2228,   1840,  -2543,
- -2404,  -2969,    186,   -444,    204,   -265, -11467,   2204,
-  1821,   3591,     67,   8821,   4015,   -183,  -5902,  -1468,
- 11394,   3062,   -128,   -476,   2495,  -2888,  13482,    686,
- -1320,    371,   -884,   1829,  -1810,    337,  -1124,  -1442,
-   432,   1950,  -1203,    663, -10445,   2310,    766,    137,
-  4418,   2821,    135,    116, -12164,  -3592,    686,   2310,
-  1229,   1930,  -1756,  -1309,   1439,  -3741,   -305,   1547,
- -9940,   3198,   1333,   2403,  -2847,  -3892,   -259,  -1766,
-   881,  14310,  -1711,   -840,   2259,   3027,  -1527,   1156,
-  2904,    -75,   -728,   1536,   -127,    152,  -3240,   -726,
--11914,   1037,   -851,  -1893,   -748,  -3294,  -1114,   6072,
-   103,  -1539,   4573,  -1637,   5242,   2705,  -9890,    254,
- -1565,   -407,   1818, -23004,   1110,    119,    256,   -707,
-  -451,   -679,    374,   -935,   -669,    403,    -10,   -594,
-  -525,   1403,  -1016,   -553,    595,   -169,   2523,    -82,
-   947,  11572,  -1166,  11668,  -4962,    842,   -860,     89,
- -3308,   -640,    558,   -851,    622,  -1002,  -4933,   2762,
-  1991,   -121,   1401,   -111,    -49,    868,    135,  -1392,
-  -279,   -560,    412,   -241,   1414,   -802,  -1256,   -298,
-   447,  17738,   -320,  -1150,   1650,   -398,   5626,   6076,
- -8919,    455,  12716,  -2094,    157,   1361,  -1515,   1494,
- -6210,   -553,  -1785,   -424,  -3049,  -4066,  -1188,   -732,
-  1992,  -1926,   1495,   1085, -22434,   1187,    391,  -1512,
-   747,   -313,   -502,   1331,    456,   -323,    246,   -581,
-    56,   1448,   2071,    535,    782,    520,   -136,   -290,
--12350, -11858,   -456,   2340,   -310,     22,   2210,  -2531,
-  -392,   -898,   3919,   1354,   -332,  -4255,    169,    425,
-  -476,   2577,  -1172,   1984,    266,    514,   -516,   2481,
-    81,   2103,   -710,    273,   1405, -14811,   5858,   3621,
-  -982,    345,   2044,    158,  -2050,   -602,    954,    342,
-   239,    157,   -317,    -35,   -260,    307, -31972,    228,
-   -77,    225,   -154,    643,   -883,   -518,     32,    372,
-   208, -22488,   -458,    530,    104,    254,   -775,  -1264,
-  -571,    900,   -263,   -323,   -296,    962,    520,    548,
- -2196,     42,   1408,   -211, -16117,   2052,  12656,   -822,
-   507,    321,   -772,   -786,   -144,  -3539,    892,  -3430,
-    19,  -1831,   1161,   1836,    988,  -1134,   -704,  -2994,
-   692,    765,    457,   1624,    502,     13,    364,    337,
- 32108,   1517,   -225,    189,    141,    985,   -572,    262,
-  -146,     31,    236,    269,   -278,  -1686, -13968,   1247,
- -1009,   1046,  13467,   1276,   -268,    307,  -1383,   1544,
-   136,    949,     70,    446,   1391,  -2188,    745,   -374,
--14231,   -712, -15202,   -533,   -108,  -2244,  -1232,    450,
-  -895,   1086,   -782,  -1082,   -718,   -660,    796,  -2095,
-  2722,   -468,  -1717,    147, -23566,    377,   -220,  -1731,
- -1416,    486,   -241,    266,   -802,   -322,   1066,   -544,
-  -167,    520,  -1297,   -100,    622,    670,   -188,    711,
-    32,   1155,    628,    350,   -112,   -154,  -1048,    -44,
-    36,   -454,    304,  32767,    356,    462,  -1194,    549,
-   138,      0,   1044,   -119,    195,   1098,    521,   3294,
- -3776,   -224,   4297,  -1256,   -303,   2107,    300, -13283,
-  2933,  -3194,  -1408,  -4152,   4195,    287,   -932,   1247,
- 13453,    277,    418,   -598,     87,   1132,    -80,   -405,
--13400,    656,  -1310,  -1447,  -3974,   1719,    313,    500,
-  1078,   -114,   1449,   -293,   -120,  -4754,   5583,    235,
- -5140,   -865,   -484,  15572,    336,  -1854,   -154,   -454,
- -1475,   -726,  -3718,  -4048,   1575,    480,   1094,  -2209,
- -3202,    420,   -564,    -48,    964,  -2667,   2172,  -1666,
-   112,   -730,    203,   3618, -15857,  -4853,     48,  -1084,
-  1512,   -937,   3353,   -453,    223,   2267,    139,    190,
-  1959,   -720,   4389,    681,  10383,   -112,  12390,   -882,
-  1695,   3539,   -169,   3131,   -122,   3627,    252,    185,
-  -523,    112,   -219,    214,   -182,   -102,    118,    230,
-   -60,   -801,    -25,     42,   -279,    262, -32358,    344,
-  -542,    382,   -223,   -404,   1201,  -2646,   -163,   -803,
-  3041,  -1009,   3818,    756,   5834,  14249,  -1828,    139,
-  -218,   -658,  -1314,  -4980,  -3322,  -1461,  -1598,    -91,
-  2464,   -954,  -5203,   -791,   1339, -13598,    594,    702,
-  -388,  -1115,  -2377,   -370,  -3658,  -3322,   1871,   2513,
-  2910,   4095,  -2195,   4291,    886,   -567,   1182,   -302,
-  -672,    -21,   -268, -29244,   -199,  -1024,  -1284,    485,
-  1432,  -1086,    119,   1030,    418,   -643,  -1165,   1847,
-   -30,   -844,   -909,   -416,   -604,   -609,   -289,   -391,
-  -238,    -94,   -391,   -810,    413,    356,    954,  -1935,
- 30996,    441,    138,   1381,   1130,  -2313,    558,   -203,
-  -248,   -951,    408,   1815,    256,   -429,   -892,   -695,
-  1138,    439,   -760,    -63,   6498,    570,  15252,  -3397,
-   170,    935,    338,      1,   -528,    524,   -541,   -281,
-    -3,    499,   -333,    685,    436,  32176,    389,   -153,
-   572,    256,     53,     16,   -902,    724,   2849,   2503,
-    80,    667,  -1867,    742,  15205,  -8715,  -2588,   -476,
-  -450,   -733,   -891,   1178,  -1751,  -1630,   -114,    144,
-  -138,  10145,   -188,  -1608,   -131,   -247,   -544,   9774,
-  -610,  -2868,  -3472,    345,  -9294,   3724,   2634,  -5124,
-  -392,   2551,   -649,    782,    -18,   -160,   -351,  12074,
- 13865,  -1294,   1262,  -3135,  -2861,     18,    753,    167,
-   620,  -2432,   1998,    740,   1902,    400,   -206,   3518,
- -3563,   -632,     72,  -1810,   1520,   -827,   -572,   1604,
-  -613,   3704,   -736,  11100,  12702,  -3189,   -792,  -3552,
-  1621,   1841,   1236,   1215,   -457,   9542,   9278,   2633,
- -8801,    862,   1741,  -4840,  -2620,    616,    324,   2152,
-  3632,    880,   -472,   1927,  -3456,  -2105,   -965,   3426,
- -1893,   3095,  -1152,  -3542,    182,    998,   -386,   1202,
-   481,  -1951,   -510,   -931,   1688,    151, -13664,  -3894,
-  -973,   -906,   1524,   9576,   2607,  12497,   -819,  -5214,
-  5936,   -634,   -610,  -4148,   -421,   -486,  -1864,   -306,
-  2421,    724,   -219,  -1304,  -2106,   -504,   6762,   5266
-},
-
-.cb1110l1 = {
- -2972,  -1201,  -1388,  -1762,    340,  21127,   -999,    126,
-   111,  -1224,  -1738,    311,   -712,   -450,   -114,   -648,
-  -752,   -172,     67,    375,   -967,  -1032, -10763,  -1885,
- -2223,  -3258,    480,   -228,   -143,  -1299,  13128,  -3062,
-  1418,      6,   -649,  -1816,   -288,    767,    345,    876,
-  -491,    948,    540,   -167,   1969,  -1883,   -455,  20584,
-  -656,    114,    308,    279,   1105,   -594,   1332,    255,
-  -356,   -186,   -540,   1898,   -873,   -477,   1404,  30475,
-   370,   -322,   -337,   -206,   -440,   -894,    -54,   -466,
-  -640,   -408,   -256,   -560,  -1503,    626,   -573,  -1684,
-   419,    407,   2076,   5022,   3143,  -1135, -12118, -12082,
- -1462,  -2060,  -5432,  -1092,   1575,   1958,   -968,    122,
-   958,  -5312,    677,  -1952, -12276,  -1594,   1211,  -1094,
-  1992, -11032,  -2993,   -834,  -1297,  -1139,    312,  -1546,
- -4253,   1191,     21,   2771,    639,  -2514,   6623,    746,
-  1830,   2967,   1688, -14893,   7988,   4099,    -97,   1165,
- -2350,     65,  -1308,   1834,  -2084,   1683,   5118,  -1633,
-   -10,  -5282,    403,  -1489,   -264,    398,  -2420,  12854,
- -1498,  -2642,  -1486,    826,    699,  -2213,  -2296,  11849,
-   478,  -2202,   -561,   -250,    199,  -2433,   -948,   -402,
-   433,    403,  13031,   -124,   -180,   1499,   -643,    527,
- 11368,   5833,    938,   3202,   -452,   2875,  -1163,   -117,
- -2047,  -1068,    211,   3122,   -236,  13548,   -702,    352,
-  -312,  -1901,  -2145,   2334, -12100,    -76,   -419,    362,
-  3501,   -220,  -3086,    572,   1537,   3240,  -1489,  -1012,
-   640,   -513,    930,    390,  31019,    724,    -78,   -706,
-   183,   -157,   -122,   -847,  -1156,    301,    508,   -456,
-   321,    317,   1300,   -512,  -1743,  10190,   -294,   -116,
-  4183,   1374,  13360,  -1339,   1832,   2547,   -702,  -2782,
- -1464,   1176,  -1287,   2256,   2169,    836,   2096,   -248,
-  1777,  11306,   -211,    265,  -3834,    336,   1936,   -586,
-   633,   1037,  -1915,  12862,    930,   -273,   2333,  -3239,
-   429,    374,   2518,   -671,    570,  -2208,    385,   -284,
--15613,  -1752,   1341,   -531,   -744,  -1111,    290,  -2302,
- -1012,  -2933,   -366,    -30,  -4595,   1400,    560,     48,
- 15739,   -945,    411,   1876,   2441,  -2144,  -1222,  12448,
-    54,   -726,  -2743,   2548,   2100,   1307,    408,   -198,
- -1802,    -63,  -1919,    933,   -329,   -528, -15918,   1704,
-  3028,    217,    606,  -2804,   2052,   9320,    592,    969,
-  6836,    647,   -671,    584,     -1,   3564,  -2575,    436,
- -2195,    414,   -201,   1099,   -772,   -220,   -578,   -467,
-   125,   -934,    271, -21476,    288,    215,    216,    476,
-  -560,    768,   1142,   -169,  -1112, -14096, -14436,   2769,
- -1464,    -61,   1373,  -3539,  -1067,   1175,  -1549,   -861,
-  -332,  -1876,   3159,    340,   1711,  -2453,    457,   2536,
-  1114,  -2278,   2464,  -3253,   -466,  12291,  12484,  -2868,
-  -800,   1142,  -4244,   -178,   3781,   1542,   -663,   1976,
-  3105,    145,   -100,  -1774,  -1039,   1627,  15540,   4194,
-  5392,    741,   1816,   -544,  -9100,   4255,  -1083,  -1266,
-  2580,  -4200,   1934,   1721,    129,   2276,  -2704,  -1341,
- -1310, -11926,  -1478,    199,    755,    619,   4231,   -478,
- -1627,  -1242,   1842,  13170,  -2416,    778,    192,    273,
-   782,    774,   2188,   -838,   3139,  -1532,  -1639,  -1073,
-  -596,    770,   -353,    -53,     82,   -322, -20584,   -344,
-  -443,    158,   -144,   -554,     50,    954,   -145,   -336,
- -2050,    596,   -950,  -2690,  13908, -13783,   4792,    879,
-   584,  -2987,    967,    192,   -585,   -783,  -1341,  -3108,
- -1622,   2478,  -1362,  -1470,  -1556,   -430,   -110,   -736,
- -8097,   2073,    964,   -417,   1669,  -5425,  -7846,    536,
- 12883,  -1690,   1143,   -242,   -438,  -2274,     57,    302,
-  -574,    637,   2816,  -1642,   2166,   -172,    893,    421,
-  -614,   -565,   -338,   -526,  -1085,   -939,  -1138,   -991,
-  1919,   1720, -18845,  -1950,   -342,   1930,    321,    184,
-  -956,   -374,   -462,   -216,     -6,     26,    386,    -50,
-   603,   -720,    634,   -252,    261,   -860,    218,  22846,
- 11544,   -459,   -946,    452,   -102,  -1203,  -1802,  -1105,
-  -310,    787,   -220,  -1113,  -2043,    650,  13767,  -3638,
-  -296,   -902,   -413,    252,   -816,   -172,   -505,  -1335,
-   890,    768,   -523,    808,   -331,  20000,   -264,   1763,
-   133,     -1,   -464,    949,   -954,   -147,   1780,   -190,
-    30,  -7422,  -4615,  -1006,   -470,   -742,    500,   7509,
-  1500,   1550,  -3614,    810,   2595,   1506, -12926,   3588,
-   402,  -2547,   1505,     65,      4,   3382,  -2201,  -2441,
- -1521,  -5450,  -3820,    282,   5212,   1186,  -1056,  -2334,
-   988,  12987,    390,   4141,  -2680,   1663,  -8034,  -1792,
-  -225,   -674,  -7147,  13254,   1631,  10163,  -3332,     -7,
-  -675,   -735,    772,  -2299,   -326,   1641,  -1174,  -1911,
-    82,    776,    891,   -445,  18590,    238,   1417,  -2372,
- -9718,  -2682,    600,  -1401,    604,  -1791,    -22,   1546,
- -1764,    525,  -1355,    348,   3260,   1115,    204,    524,
-   225, -12776,   -679, -15595,  -1188,   1078,     82,   -859,
-    28,    819,  -1220,    563,   2309,    331,  -1158,  -2010,
-  -264,   -383,   1732,   -424,  -2742,   -775,   -329,    132,
-   391,   1261,   1033,  -9812, -11829,   2433,   2690,    606,
- -2724,   7216,   -296,  -1834,  -1694,    456,  -4732,   -400,
- -3192,   1428,   -316, -13674,  -2702,   2320,  -6548,  -2025,
-  1222,   1749,   4005,   2924,  -3539,  -5104,  -2333,  -1438,
-  2598,     62,   -757,    760,    343,    154, -31947,   -534,
-  1296,    697,     88,    345,   -577,   -500,   -174,   -326,
-  -198,    272,    157,   -815,   -636,  -1163,   -867,   -273,
-  1054,    774,   1624,    989,    107,  -1088,   -673,   2143,
--22962,   -566,    151,     72,    -27,   1034,   -444,    501,
-  1905,  -1455,     21,    289, -10670,   -789,  -2421,  -2686,
-  -327,    804,  -3009,    907,    960,   1379,    -43,   -552,
-  2203,  -1406,   -911, -11094,   -529,   4458,  -4152,    -70,
-  3162, -12546,    326,    874,   1426,   3019,   2315,    104,
--12516,  -1591,  -2877,    772,   1982,   1160,  -4491,   3417,
- -1524,  -2139,    130,    930,   9359, -18308,   -376,   4090,
-  -468,    156,   -216,     60,   -643,  -3440,    256,   -835,
- -2389,   1660,   -542,  -1628,   4270,   3574,  -3136,    433,
-  1069,  30024,    561,    268,    790,    294,    207,  -1552,
-  -736,    -97,   -215,    -98,    690,    686,   -202,   -736,
-  -453,    655,    511,   -156,   1006,    361,   1424,  -1254,
-  -361,  -1253,  -1419,   -290,     78,    555,    565,   -488,
-  -923, -18193,   -630,   -908,    188,    925,  -1684,    241,
-  -319, -14478,  17007,  -1415,    274,    592,   1344,   1784,
-  -731,    344,    992,    141,    290,    481,    628,    623,
- -1166,  -2092,    140,  -1056,  13736,    754,   1980,   -238,
-  2132,  -1372,  -2216, -12057,  -1662,     66,   1742,   2209,
-  -962,  -1574,  -3044,    173,  -3066,    183,  -4476,  -1016,
-  6160,    780,  -1193,  -3334,    179,   -371,    244,    160,
-  -686,    669,    330,    426,     65,    159,   -664,   -186,
-   479,   -742,     54,    605,  32603,   -941,    370,    -91,
-   856,    825,   1042,    374,    651,    313,    734,   -240,
-   -49,   -685,  -1994,   -604,   -875,     44,   -884,    886,
- 13012,  -1506,  -4317,  -1926,   3050,  -1027,   -482,    -40,
-   137,  -2560,   1366, -11812,   2112,   2266,  -2690,  -1339,
-  -700,   -243,   2322,  -1042,   4635,  -3210,   4281,     47,
-   670,   9218,   1165,    814,    -62,  -2276,  12987,   -714,
-  2481,   1355,    896,   2840,  -1664,   2048,   -345,   2285,
-  1754,   -669,   2284,   -288,   -575,    944,  -1528,     44,
-  1071,   -706,   -543,  -1347,    880,    257,   1364,   1444,
--17896,     99,   1539,   1813,   -611,    355,  -2290,    980,
-  -787,    132,    300,   2353,    204,   -798,   -296,   -594,
-   895,    842,  18755,   1129,     79,   -189,    515,    882,
-  -286,    109,    305,    374,   1323,    861,    -18,    -78,
-   294,   -320,    674,    504,   -159,   -549,    -95, -32403,
-   -90,    658,   1082,   1611,   -137,    -74,   1160,   -794,
-   -55,    822,   2627,   1203,  -3540,   9829,  -7860,  -9063,
- -4015,   -894,  -2218,    729,   -879,  -1869,  -2446,   4050,
-  -488,  13211,   -290,   -820,    371,  14196,    866,   -891,
-   218,  -1838,   2162,   1144,   -186,    512,   1416,    546,
-  3298,  -1253,    128,   1202,    557,  -1967,    680,    545,
-  -139,  -3008,  18453,  -3322,   -137,    163,   1377,   1116,
-  2572,  -1577,  -1846,    651,  -1319,    796,   -862,    331,
-  4383,   2453,  -1894,   3264,  14137,    842,  -3087,   3740,
- -1100,  -2400,  -1364,   2406,    417,  -2393,   -868,  -3158,
- -9712,   3480,  -1403,   1896,    201,   1285,   -593, -11718,
-    99,   -539,   -186,     45,  -2266, -12228,  -2658,   2802,
- -1198,   1022,  -3840,   1401,  -1918,   1655,   1725,     96,
-  -205,   -913,   1629,    568,  -1285,   1264,  -1160,    594,
-   223,   -336,  -1436,   -472, -19792,    553,   1494,   -195,
-   570,    282,   -653,    -54,  -1115,    153,   -484,    141,
-  -188,   -278,   -173,    464,     13,   -634,    -42,    390,
-  -464,   -246,    622,   1229,   -692,  29175,   -574,   1150,
-  -135,   2685,   2452,     63,   -962,   -918,  -1657,  -1978,
-  -172,   -677,  -3414,   1345,  -3964,   2875,  -1412,   -654,
- -3000,  10739,  11348,  -2232,    516,   8303,   -189,   2564,
-  -150,   -373,    903,   -275,   2394,  -1135,    508,    424,
- -1704,  -2222,  -3789,   1938,    216, -12702,   2488,  -1364,
- -2175,   1114,   -819,  -2756,   1564,    952,     36,    609,
-  -933,  -1568,    110,    143,  -1575,  -4236,    528,  15042,
- -1920,    348,  -2623,   5217,   1911,  -1088,    259,   -590,
-   364,   2081,  -3585,    662,    249,   -119,   -111,    778,
-  2167,     11,   2500,   7182,  14452,   4388,   4121,   3623,
-  1598,    532,   -507,    877,   3830,    372,  -2184,  -2810,
- 11748,  -2095,  -1079,  -3070,   -768,   2901,  -3587,  -2572,
- 10008,    563,  -4588,   1026,   1117,   1879, -12004,   -416,
-   317,   2032,   1800,   1058,    -84,   -296,  -1748,   2588,
--11019,  -1627,  -3264,   2480,     96,   2146,  -2672,   2418
-},
-
-.cb1110s0 = {
--32746,    360,  -2774,   -672,  -1808,    -14,  -1037,  -1327,
-  1409,  -2215,    172,   1557,    945,   2031,   -702,   1844,
- -1106,    472,   2603,   -978,   2782,  -5691,   1473,  -5668,
-  7129,   6600,  -2160,    108,  -1844,   2062,  -2395,   -740,
-  1690,    -45,   -725,     77,   7236, -12903,  -3356,   -764,
-  1870,    720,  -2201,    790,   9950,  -3694,  -5340,  -4031,
-  4115,   6863,   2352,   1484,   3606,  -4855,    714,   4104,
-  6240,   7261,  -6855,   4919,  -2847,   6701,   7469,   -616,
--11442,  -1935,   9157,  -4072,    133,  -5976,   2455,  -9360,
- -2898,  -4353,  -7721,  -3098,  -3505,   2568,  -5432,   -576,
--10072,    250,   2173,  -4196,  -4322,   2688,   5220,  -6026,
-  -346,  11678,   2071,  -7344,  -2182,   -530,   -180,  -2568,
-  1524,  -1617,  -8825,  -4845,   2794,  -2813,  -2669,  -2423,
- -2709,  -8985,   2105,  -4629,    708,   2040,  -5680,  -2470,
- -7277,   6841,   6523,   4196,  -6788,  -1982,   3844,  -5000,
-   156,   1930,   1780,  -3824,   -286,   3908,   1703,   7304,
-  1145,    144,   1180,   7145,   3175, -13823,   6580,  -3066,
- -6321,  -9739,   4432,  -1145,   2923,  -2636,   3838,  -7037,
- -3913,   1262,  -1398,    363,   -141,   -886,  -5667,   -212,
- -2118,  -2717,   2724, -18802,  -2098,   -155,  -1399,    782,
-   797,    766,   2613,   5374,  -3767,  -1711,    624,    693,
-  2544,  -6153,   7179,   6835,   -762,   5061,    655,   2600,
-  9208,  -7030,   7047,   1654,  -3404,    176,  -5486,   1374,
--15378,   -487,   7456,  -1954,   2404,  -2994,  -1608,   2362,
-  -498,  -7952,  -6143,  -3996,   1596,  -3013,   1181,  -1534,
- -5265,    220,  -2677,   1047,  -4629, -15066,   3966,   -446,
--11713,  -5694,   -393,   -250,  -1336,  -7394,   1508,   6239,
-  3788,   6273,   6215,    822,   2657,   8057,   8391,   -658,
- -2561, -11587,  -2589,  -6702,  -9227,  -1016,  -2220,  -9702,
-  5988,   1859,  -6100,  -4594,    221,   2529,   2217,   8273,
-  1804,  -6128,  -2859,  -8259,  -4707,  -2494,   1913,   -352,
- -4561,   -289,  -1801,   -994,  -4445,  -1001,   5422,  10868,
- -7366,   1679,  -5195,  -6859,   2982,   -406,   2400,   4520,
- -3611,  -1892,   4900,  -3504,    771,   2774,   -772,  -1929,
- -7354,    375,    628,   4522,   1069,   -969,   8083,   -155,
-  3178,  -1138,   1752, -17288,   4390,  -2483,  -2071,  -1353,
- -1155,   -456,  -2683,   6798,  -1908,   1797,  -6657,  -2770,
-  5610, -14518,   5922,  -3964,   -938,   -853,   1416,  -1077,
- -4562,   -160,   5820,  -3031,   5091,   1987,  -2746,  -3779,
-   238,   -264,  -3074, -11718,   9370,   9806,  -6302,   3979,
- -2938,   4034,    393,  -1399,  -4466,   2181,    756,    394,
-  2264,  -3664,     78,    470,  -3228,   3942,  -1714,    708,
-  4988,   1938,  -2722,   4555,  -5054,  -1026,  19312,    354,
-   107,  -5357,  -4364,    597,  -2566,  -2812,  -2278,   -446,
-  1384,   -371,  -2566,   -388,  -3964,  -8989,   9136,   3389,
-  8440,  -5570,  -1262,  -5874,   2056,  -5973,   -185,   4540,
- -4924,    154,  -3653,  -1113,  -3048,   7099,  -2734,   2940,
- -6704,   1543,  -8120,  10134,  -9485,  -6645,   4816,   -442,
-   -32,  -2430,   4932,  -6129,  -5050,   6120,  -2147,  -6910,
- -1342,   1075,  -2458,     50,  -4747,  -3080,   1886,   1490,
- 18972,     48,    787,   2441,   -405,   1668,  -1399,   2202,
-  2175,  -3592,   1548,  -2728,  -4864,    504,    383,    376,
- -1073,   2142,    504,  -3114,   6378,  -5516,  13462,    196,
-  1840,   7087,    792,  -3583,    302,   1012,  -5504,    270,
-  3354,  -4486,  -2312,  -2522,  -2872,  -3899,  -2261,   5211,
-  1417,  -3075,   -151,   -985,   -772,  -1630,    164,    659,
-  1496,   -349,   -621,    -32,  -2982,  -1720,  -3475,  -7370,
- -1541,   1122,  20474,   1726,   4474,  -3228,   7024,   3265,
-   522,  -2193,  -2113,   5388,   1912,   5929,  11768,  -1162,
-  2600,   4048,    652,   3360,  -3215,    376,  10028,   6054,
- -3814,  -1155,     93,   4512,  -3581,  -4037,   7484,  -1481,
-  2797,   2635, -12275,  -2780,  -6235,   5739,   2687,    376,
-  5984,  -2547,  -8834,   4332,   2752,   1942,   1002,  -3312,
-  5251,    -86,  -7794,    918,  -2413,   3131,  -3316,   2095,
- -4569, -15382,  -5534,   1290,   5179,   2928,   3034,   2365,
-   270,  -7476,  -3024,   6910,   1355,  -6262,  -2040,  10490,
-  1432,  12284,   1125,  -3160,   4518,    973,  -2351,  -1726,
-  1967,   1488,    382,   3559,  -3742,  -2908,   -944,  -1662,
-   682,    902,  -4360,   5026,  -4252,  -1212,  -3269,  -6024,
- -3788,   9128,  -2638,  -1625,    315,   3087,  -3265, -10441,
- -7207,  -4078,  -3266,  -7543,  -5223,   5460,   2496,  -9258,
-  -227,   4048,    860,   -520,  13616,  -3458,   3837,    809,
-  -104,  -4062,  -4846,   -136,  -1631,  13977,  -1136,   3380,
-  1099,  -4022,   1831,   3360,  -9034,    -52,   -516,  10144,
-  5074,   4866,   8282,   -972,   2496,   2336,   8766,   2881,
-  2417,  -5588,   3064,   3934,  -4202,    627,   -986,   1750,
-   958,  -2348,   5006,  -2597,    -90,    133,  23271,   2431,
- -3984,   1894,  -2094,  -1816,   5007,  -3164,   2526,  -1862,
-  2651,   1809,   7173,   3410,    154,  14930,   3032,  -5314,
-    44,   8868,   -543,  -2158,   5341,    258,  -8188,   3772,
-  2804,   7544,   8339,  -3560,    -63,   -735,   1300,  -4308,
- -1085,  -4986,   1564,  -6744,  -2605,   -310,   1275,   1166,
-  -640,   4814,   4373,   3103,  -1242,   6049,  -4786,    597,
-   182,   2371,   6950,  -2265,    389, -14669,  -1942,  -2733,
-  -485,   -865,   -597,  -1376,   1626,  -3956,  -1244,   1532,
-  3918,  -3311,   1574,    -88, -20573,  -5471,    -71,  -1731,
-  1436,   2428,   3982,  -4576,   -914,   5460,  -4973,   1650,
- -2364,  -2486,   3212,   5424,  -2501,   4595,   -937,    728,
- -5140,  -9948,   1437,  10560,  -5704,   -264,  -2752,    949,
-  5229,  -1445,    430,    827,   4103,  -1999,  -4625,  -4171,
- -8769,  -8927,   7161,   4539,   6968,   5975,  -4626,  -2793,
- 10080, -10386,  -2479,   1724,   2992,    354,   3650,   3328,
-  4490,  -1931,   7348,   7283,  -3304,   4446,  -1698,  -1224,
- -3002,   4340,   1041,    607,   -454,  -4261, -18071,  -1199,
- -3902,    570,   5808,   5582,   6710,    235,   -205,  -4288,
-  3472,   -686,   -103,  -3658,   -436,  -9680,   -190,    275,
-  -919,   2522,  -2087,   9096,   5060,  -6450,  10282,   3344,
- -8167,  -7688,  11881,   3101,  -1280,  -9942, -11741,   2213,
-   712,   3976,  -4218,  -5285,   2797,   2996,   4006,   2053,
-  2344,   6200,    141,   2616,  -3981,   6970,  -4194,  -1621,
--13724,   7772,   2800,   2220,    445,   -266,   4030,    444,
-  -228,   2642,   1617,  -2511,   1699,   8740,   3438,  -2063,
- -2093,   1806,    950,  -7112,  -1513,  -2886,  -8789,    870,
-  3456,  -4126,  -3330,    541, -10173,  -1789,   3156,   4466,
- -5965,    479,   5177,  -2806,   2506,  -1646,  -3609,   1617,
- -7373,  -3146,  -2389,   3601,   7850,     89,  -3373,   4670,
- -4180,  -3186,   3056,  -1691,   1314,   9234,  -7799,   1323,
- -4360,  -9866,  -1930,   8091, -13452,   8503,   1980,  11247,
-  7688,  -5953,  -4165,  -3192,    540,   1631,    131,   2250,
-  5330,   -146,  -8724,  -3148,   2834,   1148,  -3886,    374,
- -1836,  -3898,   9649,   1119,  10221,    128,   8868,  -7301,
-  2601,   1252,   2340,  -3789,   4682,    181,   4434,  -1740,
-  4368,    879,   -620,   2046,   1842,    844,   -925,  -2506,
- -3344,  -8820,   -722,   -451,    521,    903,  -1286,  -3059,
- -5308,  -4759,  -2706,  -1429,   2762,    927,  -1459,  -7274,
--12028,   8838,   3987,   2406,   8626,  -3128,   6505,  -4322,
-  -197,  -2464,   2738,    -46,    161,  13919,   2252,   2059,
-   981,    204,   1161,   4910,    683,  -4311,   2081,  -1932,
-  1119,  -6067,  -5325,   8528,  -4704,  -5522,  -6183,   5744,
- -3407,  -2021,   2688,  -3230,   2490,   -976,   -500,  -7834,
-  2064,   3191,   4740,   3686,   1762,   2604,  -2442,  -5720,
- -7550,    457,  -3478,  -8097,  -6510,  -9105,   8031,  -4895,
-   500,  -2436,   1483,  -4415,  -2023,  -3768,  -2497,  -1911,
-   789,    566,   -969,  -4204,   6128,  -5076,   2664,  -4222,
-  6755,   1774,   6881,     64,   1205,  -9243,   4782,   4432,
-  5193,  -2258,  -4787,  -7433,   1755,   -794,   1297,  -7535,
- 12773,   9124,    806,   2348,  -8112,   7874,  -4348,  -1410,
-  -350,  -2528,    576,    661,    272,   4598,    691,   1913,
- -3349,  -1881,  -1854,   -779,   -821,   8444,     60,   2570,
- -1813,  -1354,  -4512,  -5471,   4728,   3289,   2617,  -9326,
- -6670,   -859,  -2713,  -9839,   4676,  -2657,   3106,  -1393,
- 10278,  -3069,  -2253,   1015,   2246,  -2227,     16,   -388,
-  7962,   1493,  -3122,  -2707,   7982,  -6106,  -1462,  -1665,
- -1302,   2347,   3640, -15122,  -2211,    417,   6819,    959,
- -2876,  -6868,  11060,  -2329,   -302,   1595,  -4610,   9514,
- 12677,  -4614,  -2899,   -141,  -4857,   1447,   6400,  -2894,
-  1696,  -2888,   1889,   3489,   2775,   -504,  -6597,  -5258,
- -7256,   -379,  -1249,   -136,   3118,  -3537,   3295,  -3458,
-  2103,   -399,  15281,   -222,  -1809,    172,   2257,   1947,
-   707,   3562,  -5691,   3575,  -2210,   5750,    815,   4059,
-   -16,   1306, -13308,  -1733,  -1338,  -3477,   5247,  -1950,
- -5148,   -678,   8074,   1740,    290,   2033,   4639,  -4240,
-  -536,  -5214,  -1366,   2491,    501,    -59,  -4480,    430,
-  -285,  -5947,   -755, -14559,   5696,   6960,   4462,   2317,
-  6414, -13174,   4962,   -899,   5924,  11100,   5303,   -970,
- -2528,  -6239,   2253,   2236,    553,    458,  -2229,   8016,
- -7082,   2869,  -4209,  -4460,  -6536,   3557,  -1766,   7815,
-  -655,  -6029,  -5250,  -1627,   2646,  -3466,  -3584,    901,
- 10305,   -895,   -427,    949,  -2776,   3436,    769,  -4131,
-  9019,  -4898,  -3562,  -7978,   -359,   1358,  -1528,  -3095,
-  5840,  -6214,   2591,  -2086,   9480,    640,   2858,    216,
- -3625,   5740,  -7008,  -1097,  -2091,   -143,   4832,   6210,
- -1358,   3998,   -714,    835,  -4004,   3664,   1980,   1240,
-  2902,    510,  -1565,    427,  -2052,  -4208,  -1505,   1187,
- -1229,   3732,   -932,  -1014,   4784,  18474,  -5111,   3047,
-   -54,  -1547,  -3892,   8612,    274,   1446,  -3548,  -7689,
-  -423,   1192,  -4508, -10403,  -8735,   -446,    444,  -6353,
-  4008,  -1462,  -8906,  -1161,  -2395,   2442,   2204,  -5472,
--17376,   2471,   -689,   1394,  -3657,  -2119,   -769,   2872,
-  1393,  -2701,  -3536,   3650,   -378,    859,  -3338,   1412,
-  3010,  -3243,   -335,  -3619,   -511,  -1931,  -7126,  -5018,
- -9332,  -4440,   1906,  -2265,   1386,   8072,  -6576,  -1300,
-  5458,  -4894,    630,  -7146,   2263,    810,   2968,   1124,
- -2219,   2292,  -3914,  -1836,  -6683,   1511,  -2755,   1396,
-  2425, -23842,   2249,    -53,   -891,  -1678,  -1766,  -1788,
-   502,  -4210,    211,  10376,  -5507,    837,  -6196,   2132,
-  -472, -10153,   7234,  -1456,   -148,   4886,   2427,   2371,
-  1234,   -962,   6298,   1016,   1735,   -566,   -878,  -8071
-},
-
-.cb1110s1 = {
-  2525,  12164,   4861,   9505,  -7371,   -414,   3002,    576,
-  -347,   -998,   2861,   -804,   3034,    810,   -788,   -539,
- -2092,   4970,   1828,  -2869,  -2802,   6649,   3673,   -193,
- -4034,    722,   1642,   3792,   8770,  10428,  -3303,  -3849,
- -4520,   -234,  -4190,  -1219,  -1300,  -4128,   8384,  -1150,
-  1578,  -6174,  -1072,  -4871,  -8180,  -6698,   3806,  -7386,
- -2545,   1052,   -550,  -1148,  -1308,  -8834,  -2654,   1982,
-  8716,   6579,   1360,  -2404,   1893,   2680,   3801,  11097,
-  1455,   2453,  -7585,  -7503, -12710,   -420,   2023,   -656,
-  1124,   2872,   9676,  -4309,   -202,   1458,  -6526,   -534,
- -1535,    924,   3068,  -1142,   5073,   1284,  -5632,    869,
- -1637,  -2898,   4900, -10202, -10488,  -1097,   1890,  11006,
-   -44,   1368,  -1979,   6507,    316,    961,      8,  -4085,
-  2561,  -2034,  -1077,   2594,   -465,  -5134,   -868,     54,
- -6694,   9608,  -3516,   7165,  11011,   9542,   4780,  -2800,
- -1130,  -1714,  -2684,   -369,   4746,  -2688,   4146,  -7652,
-   984,  -3263,   -276,  -9134,  -2848,  -3983,   9994,   3608,
-  3234,   -596,    263,   3102,   -178,  -2264,   3820,  -4293,
- -5752,  -3577,  -3914,   1095,  -1562,  22110,   4610,     69,
- -2999,    254,   2178,  -2901,  -1203,  -1292,   2642,  -3254,
- -1389,   2955,   1340,    542,    810,   1369,   3208,   -795,
- -3272,  -2717,  -1129,   8781,  -6854,  -3028,   -616,    729,
-   529,  -6946,   1621,   9574, -14909,   5398,    854,   -774,
- -9978,  -5417,  -2516,  -4683,   5715,    -66,   3336,  -5040,
-   640,  -7566,   3494,   7016,  -2269,   1376, -13994,   6448,
- -3948,  -1697,  -3988,  -6559,   2376,   4231,  -3131,   2045,
- -2417,  -5919,  -7016,  -1695,   9046,  -7966,   5187,  -2553,
-  1402,  -2351,   -220,   5931,  -1823,  -2270,    584,  -3784,
-  2924,   6166,  -3035,   2370,   4923,  -1080,    682,  -7899,
--10827,  -1824,   -908,   1568,  -3565,   4033,  -4266,  -1948,
-   923,   5488,   -203,  -2396,   -907,   2783,  -3278,   1415,
-  7710,   -190,  -5208,  -2279,   1266,  -1132,  -3392,  10251,
- -1064,  11283,   2162,   2213,  -5088,   4479,  -4658,  -1803,
-  1534,  -4233,  -4073,   6938,   3966,  -4878,   -332,   5961,
-  9217,    488,   6520,   4430,   7988,   9383,  -2586,   1206,
- -6983,   -873,   1251,   1849,   5945,  -2144,  -2032,  -1852,
-   416,   3720,   2419,   8462,   3173,  11524,  -2894,  -5517,
-  -211,  17830,   3170,   1098,   -721,  -2066,  -1956,  -3097,
- -1061,   2815,    447,    701,    449,   -485,   2609,   1239,
-  2257,  -1760,   3091,   7538,   3710,  -2689,  -3092,   6903,
- -2457,   3271,   6355,  -1486,   -828,   1994,  -3575,   3949,
-  3185,   2606,  -4912, -16039,  -8833,   1831,   2580,   1993,
- -1117,  -3408,  -7590,  -7278,   -141,   2696,    805,   1896,
-   308,    378,   9308,   2894,  -4324,   1042,    837,   4716,
- -4702,   2493,  -5173,   8616,   -468, -14829,   3759,   3251,
- -4237,  -1340,   5224,   2099,   -764,  -8263,  -1699,     76,
- -1464,   2115,   -582,   3286,  -3653,   1017,   1696,  -1414,
-  -668,  -9748,  -5730,   2413,  -1270,  -6070,  17002,   2164,
- -5440,   1801,  -2123,    800,   2135,   4801,   -887,  -2141,
-  -647,  -4846,   -463,   -577,  -1846,   -555,  -1929,   2046,
-  8272,  -8399,   3886,  -5950,  -4202, -12600,  -2805,    477,
-    65,   6140,   1089,  -4737,   8967,   1952,  -1968,  -3660,
-  6641,    850,  -3304,  -1775,   4010,  10819,  14365,   -696,
- -1331,  -1724,   -237,  -3611,    244,   3005,   4349,   -182,
- -4124,   2466,   2746,    -61,   3391,  -1392,   3788,   1582,
-  3723,   7140,  -2207,  -3678,  -2675,   -252,  -7476,   9426,
- -6196,   3226,   3554,  -6326,  -4284,   6346,  -4432,   5199,
- -2633,  -2499,   1200,  -1140,  -3910,   6624,  16732,   5946,
-  -766,   2630,  -1200,   1988,   5510,  -1199,   4126,   1287,
-   454,  -1795,   2664,   5001,   1058,    500,   -437,   2992,
- -2012,   -160,    796,  -4846,  -6572, -10088,    603,    483,
- -4510, -12799,   3502,  -1784,   3510,  -3956,   6038,   9044,
- -6029,   7170,  -1608,    120,    914,   -200,   3939,  -6274,
-  3020,   6235,  -2754,   5368,  -1693,  -6028,    386,  -2006,
-  1898, -11704,  -9973,   -525,  -2624,   1799,   4140,   3248,
-   -57,  -3731,   3764,   5582,  -3830,  -2484,  -2066,   1517,
-  -900,  -8250,  -8191,   2676,   1147,   6752,   6908,   1196,
- -2634,   3408,   2980,  -1042,   3971,    632,  -4946,  -5690,
-   133,   2445,   -446,  -1294,   -777,   3356,  -5628,  -6020,
- -8042,   5069,  -1421,  -2701, -15117,   3074,   -912,  -2574,
-  2643,   5252,  -2118,   3849,  -3793,   -850,   4170,   6240,
-  -697,   6976,  -3752,   1155,   7769,  -8912,  -7728,   4224,
- -2362,  -3760,   3688,   2402,  -3411,  -3165,  -2550,     -8,
-  -209,   -334,   -837,   5688,   3425,  -4564,   9999,  -4780,
-  3093,   4346,  -5556,   1636,   1755, -14696,   1810,   6547,
-   -60,   4054,  10539,   6118,  -4414,   1760,   3581,   -841,
-  4471,    -23,    180,    259,  -4439, -13230,  -1326,   1913,
-  -621,  -1641,  -2882,  -4934,    516,  -3886,  -4468,   -110,
- -4526,  -5157,   7550,  -4449,    813,  -4364,   1768,  -8829,
-  2003,  -1372,   1873,   -209,   1539,   1076, -12408,  -1464,
- -1878,   1563,   2020,    704,   1425,   -275,  -3718,   4618,
- -1120,  -5057,  -3590,   4022,  -1977,    620,    143,  -2507,
-  3697,  -3263,    616,  -3002,  -3347,  21051,  -4398,    364,
- -1924,    284,  -2724,  -2297,   4916,   2702,   4866,   4293,
- -2781,   1094,  -1525,   -562,   5487,  -2098,   4658,   1362,
-  -597,  -3426,   3173,  -5174,   3922,  -3844,   1482,   4711,
-  5853,   1490,   5499, -17537,    956,    544,    268,  -4782,
-  -504,  -4003,   -911,    599,   1746,  -7322,   1907,   1990,
- 16985,   3171,  -2645,   1040,  -7239,   5618,    304,   3606,
- -3377,   3630,   7319,    108,   -496,   1026,   3062,   -392,
-  2366,   1948,   -530,    806,   2700,  -2676,  -2717,   5238,
--16008,   -823,   -264,  -1560,  -1014,   -760,  -3684,   -330,
-  5644,  -1668, -10239,  -2583,   7411,   -593,   2193,  -1479,
- -2892,   3834,  -3625, -12234,  -1103,   1868,  -5121,   3879,
-  2748,   1936,   2026,   4572,  -6037,   3310,  -8678,  11724,
-  5290,  -2316,   4131,    834,  -3915,    869,  -1734,  -5752,
-  1255,   9534,  -3625,   -115,  -5912,   -125,   2298,  -1494,
-  5910,   -496,  -2719,   1320,   3175,  -3012,  -3906,   4602,
- -4760,  -5918,  -2568,   6632,  -8802,  -5876,   6358,   2349,
-   207,   5191,   8369,  -5932,   2710,   7950,   3673,  -2592,
-  1311,   8384,  -4360,   8614,  -5662,   1180,   2147,   1044,
-  1591,  -5555,  -1597,   4418,     38,  -1579,   4675,  -1725,
- -1693,  -6470,   3066,  -7601, -12822,    524,  -2986,  -3406,
-  8860,  -1266,   -930,   4316,   1171,  -2908,    199,  -1785,
- -2851,  -3588,   3072,  -3585,  -2668,  -1123,   1508,    460,
-  6780, -19480,   2854,  -1574,   1004,   5074,   1907,  -1988,
-  1177,     74,  -1436,   2224,   1232,  -3008,  -3454,   -862,
-   604,   -653,   2778,   2349,   3242,   8426,   -430,   3684,
-  4814,  -1886,   5118,   1487,    442,  -2322,   -900,  -2854,
-  -234, -10350,  -7922,   -745,  -1490,  -5638,  -6014,  -4079,
- -2979,   -351,   9493,  -2274, -11362,  -8166,  -7364,   8261,
-  1554,  -1722,   4651,   -831,   2276,   1502,   2600,   1266,
-  4456,  -4145,  -3837,  -3584,   4242,   4058,  -2395,  -6971,
-  4486,   3233,   6226,   1306, -11506,  -6223,  -5132,   1537,
- -4407,   1510,   5732,   2808,   5817,  -4972,  -2900,    897,
- -2441,  -1819,   5651,  -6988, -10063,  -2288,  -5820,  -1250,
-   925,   3120,   6125,  -9901,   -137,   3684,  -6601,   1077,
-  3272,     21,   3341,   -838,  -3643,  -1727,  -4417,    660,
- -6551,   -184,  -8125,  -1780,   5232,   6077,  -7968,   6423,
-  3823,   3026,   4555,    464,   3318,  -5504,    837,  -3571,
-  3853,  -2277,  -1864,   -742,  -5380,   6096,   6856,   1076,
-   877,   -642,   1926,  -4712, -14482,  -3323,  -2672,   7485,
- -2116,  -3932,   2233,  -3270,    326,   2221,    132,  -1893,
-  -748,    453,   3597,  -2308,  -4371,   5632,   3609,  -1033,
-  -444,  -2591,  17359,  -3120,  -2604,   3157,   -370,   9242,
- -1606,   2675,   -853,   1475,   -416,  -3280,  -1159,    191,
- -3670,    282,   4282,   -957,  -2978,   3564,     91, -20520,
- -3046,   1248,   1277,   3368,   1118,    311,   -598,   1406,
- -2377,  -1444,   1417,  -3626,    167,  -6440,   3341,    629,
- -2523,   4398,  -1187,   4322,   -383,   1934,  -3298,  -8530,
-  2195,   5220,    510,  -1256,  -6932,  -1061,   5141, -16242,
- -1390,   -546,  -3760,  -2029,   -929,  -6044,  -3503,    312,
-  8478,    701,   8865,   4715,   1987,   1342,   1400,    -71,
- -5229,  -1547,  -8827,   2349,  12836,  -1479,   4621,   6003,
- -6749,  -3184,  -5667,  -2930,  -1074,   3204,    330,   4692,
-  2872, -10808,     75,  -1260,  18003,   4100,  -1462,   1391,
- -1667,  -2039,   -687,  -4806,   5913,   2682,   7730,   7034,
-  2703,   1666,    120,   1601,   2123,   1402,  -4702, -11229,
-  7875,  -5591,   4634,  -2274,   3015,   -597,  -7520,  -1095,
- -4814,   -173,   5562,   1533,   2807,   8466,   5195,   7806,
-  2585,  -2877,   6938,  -3942,    402,  -3825,   4162,   9149,
- -6423,   2447,   7041,   2932,  -9813,   2124,    -58,     -3,
--12856,  -7973,   1484,    907,    180,   8042,  -2124,   4356,
- -4117,   1126,  -9706,  -2101,   3957,  -1877,   1139,   7148,
-  3707,  -1341,   4509,  -1220,   4570,  -1650,  -6504,   7036,
--10268,   -328,   4678, -12205,   5062,   6089,   -496,  -7740,
-  2207,   4489,   -205,   1386,  -2695,  -1442,   4730,    892,
- 12061,   3818,  -3305,   4431,   9300,   3470,   4608,   4315,
-   892,    866,  -1714,   1529,   2569, -11398,  -3068,   -282,
-  1626,    587,  -1568,  -1630,   -220,  -2033,   7141,  -2732,
- -3541,   3404,  15514,   1883,  -2697,   -926,   5972,   6485,
- -6794,   2111,   2490,   1201,   5467,  -2352,   3264,    -97,
-  2400,   -728,  -3364,   3417,   1481,   2862,    462,   2855,
- -5233,   5740,   7208, -10508,  -3254,   1450,  -1270,   -293,
-  3400,  -6978,  10035,  -1213,   4308,   2641,   8579,   8518,
- -2919,   -351,   -459,  -2069,   -617,    638,  -1347,    107,
-  6009,   2035,   -280,   2009,   3280,  -1236, -14960,  -5177,
- -2440,    965,  -2646,  -2095,   5274,   1825,   3705,   3831,
-  -446,  -4018,   7178,  -2415,   4344,   1850,   -509,   -500,
-  1056,  -4374,   5709,   1336,   3352,   7915,  -2302,  12209,
--14362,   6429,   1423,   2912,   6474,  -1599,   1116,   2280,
- -1738,   3108,  -5792,  -3554,    623,  -1110,  -6114,   4488,
-  8941,  -3176,  13670,  -3320,   -327,  -2657,  -7349,   3782,
- -1481,   5737,   -200,   2968,  -9474,   5752,   5056,   4688,
- -5352,   -432,   -906,  -3832,  -8519,     -7,   3667,   3583,
-  6250,   8724,  10737,   9371,    950,  -1630, -10740,   5788,
-  4111,  -2910,    437,  -2482,   1910,    185,  -2168,  -3155,
- -3515,  -1754,   4978,   4298,  -6921,    476,  -2778,    546
-},
-
-.cb1110m0 = {
-  3666,  -1078,   -175,   1370,   2491, -10050,   -685,  -7617,
-  4002,  11104,    903,   5948,   2821,   3050,  -2465,   1151,
-  -848,  -2139,  12321,  -1408,  -1469,   2046,  -2693,   2479,
- -3498,   3077,  -3822,   1841,  -2404, -11172,   -407,  -3062,
- -1725,  -5475,    597,   1924,   -197,    434,  -1648,   2678,
- -2462,   1148,    599,   1284, -13171,   -949,  -6508,    754,
-  7466,   5924,   1411,   -536,  10825,    588,    297,   -310,
-  -593,   -896,    784,   -242,    716,    501,    -52,   4043,
-  -755,   -690,   2630,  17762,  -2159,   2126,    954,  -1316,
- 11129,   1570,    387,  -2639,  13953,   -311,   5231,  -2297,
- -3612,   -678,  -1117,    690,   -279,   2403,  -1541,    493,
- -1692,  -2048,   -771,   -933,    423,    700,    840,    739,
-  1956,   -944,    612,  -2678,    101,    245,   -786,    850,
-   269,   1355,  21773,    463,  -2589,    596,   -519,    788,
-   -43,   1220,  10674,   4847,   1192,    335,    875,   -106,
- 10644,   2600,   5391,   -262,   2296,  -5928,  -1072,   -122,
-  2504,   1313,   1117,   -981,    350,    375,   -810,      8,
-  1462,  -2020,  -2368,      8,  22663,   1537,     87,    908,
-   832,  -4884,    312,    620,   1042,  -4444,    660,   1582,
- -2710,  -2954,  10012,  -9580,   8102,   5696,  -1371,  -3035,
- -3347,    402,    218,   1096,  -1924,     88,  -2270,   4175,
- -1083,   -497,  -2437,  -3332,   -824,    212,  -2362,   4600,
- -7800, -11501,   7795,    236,  -1336, -12920,    705,   4532,
- -1488,  11746,  -3213,  -2650,   2524,  -2638,   -128,   -328,
-  3402,    453,   -242,  -2500,   2224,    708,    450,  -3014,
-  -132,   1251,   -131,   -831,   -710, -21985,    222,  -2132,
- -3261,    490,  -3020,   -860,   2550,    892,   -623,  -3666,
-  -664,   -131,   2018,   2817, -12005,    496,   -610,  -7238,
- -3909,  -2867,   6872,   1903,    848,   6644,   3812,  -5686,
- -4055,   -377,  -2096, -10247,  -1068,   1486,    415,   -253,
- -2186,   1050,    771,  -6856,   1044,   7466,   2953,  -7514,
-  1601,   7015,  -1778,  -1622,  -3364,  -1755,   2835,    176,
-  2700,    991,   2560,   -554,   4867,   1571,  -5610,   2610,
- 12438,  -3751,  -9964,  -2753,   4856,  -2595,  -5423,  10025,
-   812,    687,   2715,   4013,   3086, -12039,    328,  -3992,
-  4044,  -3920,   -111,   -553,  -1720,   2454,   1706,  -1365,
-   804, -32329,   -471,    897,  -4670,    780,  -3680,  -1409,
- -2630,     20,    184,   -157,   -290,   2794,   -546,   -160,
-  1564,   1146,    628,  -4787,   -239,  11233,   -492,   1955,
-   608,   9273,  -3220,   3830,    390,  -5982,  -3342,  -3384,
-  2356,   1820,  -3473,    979,    -40, -20190,     47,   -200,
-  5106,   -381,   1824,   -197,   2280,   2434,  -2633,  -1409,
- -1109,  -1072,    857,   1554,   7459,      6,  12130,  -1078,
-  1038,   -300, -13748,   3201,   -762,   2670,  -1051,   -445,
-   914,   -172,   -558,   2634,  -1158,   3129,    -74,  -3415,
-  1086,  -8892,    118,   -647,    285,    186,   3022,  -5077,
-  1342,   3453,  -7991,    -65,   4690,    944,   3717,  -1909,
- -9783,   -367,  -1699,   -772, -32768,   1286,   -408,    340,
-  -340,    430,   1274,    596,   -109,   -727,    276,   -946,
-   139,   1804,  -1050,  -3562,  -1392,  -1179,    257,   1639,
- 25708,   2278,   2415,   2174,    153,    126,    -60,    592,
-   994,   -334,   -268,   1826,   -306,  -2241,   2774,  -3188,
-   758,   -450,   8023,    542,   6819,  -1712,  14195,  -2198,
-   281,    -12,   -590,  -1153,   4568,  -3676,   1973,  -5221,
- -1839,   -603,   3324,   2492,  -3070,   -846,    123,  -1184,
-   667, -10886,    -65,  -2615,    971,  10219,  -1245,   7378,
- -2122,  -2306,    571,  -2298,   1958,  -4356,  -9210,   4321,
-  2805,   1888,  11129,   1282,  -5819,  -2528,   -873,   1123,
- -5968,  -2644,  -5515,  -2151,   -944,  -7712,  -2007,  -2260,
- -1920,   2100,   -325,    153,   1050,     10,   1462,    650,
--12559,   3530,    754,   4493,   1528,  -6991,  -4842,   1483,
- -2408,   2785,  -1651,   -830,   1433,  -2464,  18899,  -1891,
- -3137,    996,   2485,   3056,  -1061,  -4015,  -2282,   1356,
- -2572,   -490,   1209,   1137,      4,   -636,  -1282,   1001,
- -1190,   -172, -14049,  -4256,  -1972,   2225,  -4738,  -1054,
-  5254,   8113,   4294,     36,  11765,  -3993,  -1084,   3864,
- -3016, -10356,    353,   2963,  -1228,    536,    609,   -343,
-  1246,   3617,  -3667,   4794, -20360,    473,    725,  -1246,
- -1649,   1900,  -2589,  -2869,  -2550,   -886,  -1164,  -1876,
-   307,   3784,  -4782,   -476,   -700,   2118,  -1860,   1533,
- -5013,   2356,   3305,   3338, -14312,  -1278,   -322,   1950,
-  -954,  -1990,   1438,   3358,   7479,   3046,  -6677,  -3078,
-  1717,   3113, -12484,  -1302,   -221,   -510,  10423,  -3497,
-  4170,  -3606,   6983,  -2902,    458,    667,    566,   2415,
-  -403,  -2898,    -44,  -1832,   -110,   1799,   1172,      7,
- -1534,     90,    686, -26902,   1601,   -822,    658,    182,
-  -151,    345,   1488,   1416,   -272,   1560,   9774,   2084,
-    16, -14344,   1428,    514,   2658,  -1312,   2095,    454,
- -1783,  -2056,   4529,   1154,  -2239,    956,    668,  -1396,
- -2898,    405, -12659, -12556,   -650,   -587,   3461,  -2470,
-     0,  -3156,   3186,  -4104,   1729,   1438,  -1842,   -422,
-  4476,   1945,   -932,  -1439,   -702,  -1398,   3349,   1876,
-  -999,  -2086, -17879,   -432,   4036,  -2299,   1133,     88,
- -2221,  -2730,   -938,   -998,   -132,   -426,   2084,   2060,
- -1134,   -313,    402,   -538,  -2593,   2022,    725,   1566,
- -2070,  21622,   1767,   -424, -32672,    205,  -1239,  -3253,
-   198,  -1257,   2342,  -1918,   1505,    452,   1348,   -604,
-   978,   1079,     -4,   2476,  -1247,   -146,   -861,  -1928,
--12222, -13042,  -1384,  -1971,  -1428,   1224,   -639,    -83,
-  1034,   3488,  -2310,   -565,     74,   -335,   2774,    602,
-   872,  -2132,   -147,   2160,    244,    162,  12600,    628,
--10194,  -1296,   1068,  -1824,  -4945,   3194,   2066,   -895,
-  -784,   2347,  -1982,     73,   1030,  12589,    -62,  -2272,
-  3827,  -1776,   2546,  -1417,   3310,   4726,  -3078,   -548,
- -8522,   1632,  -6667,   1008,   1128,    805,    954,    616,
-   499, -31526,  -1327,    790,   -190,   1058,  -1157,   1432,
-   -16,    411,  -3180,    827,    327,    914,   1716,   1442,
-  1052,  -1635,  -1805,  -4145, -13678,   3597,  -2273,  -5920,
-  3592,   1136,   -211,    717,   3901,  -5132,   3036,   -601,
- 12976,   1633,  10316,  -1674,   -468,    905,   2331,    841,
-  -247,  -6053,   -593,  -3281,   4291,   5159,  -1053,  -1814,
-  2613,   2221,   1146,    871,   -421,   -542,    923,  -3567,
- -1138,  10051,  10860,  -6121,   -661,  -5677,   -890,   -266,
-  2100,   6223,    -70,  -2658,    -78,   3424,    714,   2138,
- -1355,   -981,   1990,    772,    938,   1311,  -1963,    924,
--22516,    260,   -341,   1251,  -1578,     23,   1375,   1068,
-  2688,  -3965,    713,  -5342,   -257,     37,  -6034,   -276,
-   228,  -1240,  -7171,  -3402, -14677,   1708,   -317,  -2880,
-   874,   1466,    524,   2091,    565,  -4220,   -265,     52,
- -3373,   -220,  -3175,   2646,    448,  -1628,  -1986,   2200,
-  3722, -15752,   7120,  -2036,  -2170,   -627,  -1079,  -4060,
-  2257,   -925,  -3418, -13488,  -1308,   3476,   -783,  -3924,
-  -820,   -860,   2418,   2982,  -8753,   9001,    294, -11915,
-  -969,   3329,   -761,   1459,  -5308,   1811,    379,    306,
-   632,  -2732,   2512,   1188,  -3470,  -2167,   -572,  -2274,
- -1657,  24074,   -159,   -138,  -1826,  -2527,  -3117,   -906,
- -1770,  -1182,   1240,  -3064,   2313,   -790,    336,  -3843,
--13384,   -423,  13066,    -14,  -1908,    -32,   2607,    487,
- -2426,    195,    135,   2742,   1540,  -1034,    856,  -2288,
-  -287,   -774,    497,   1760,    191,    178,    298,     38,
--30898,    801,  -1456,   2311,   1272,  -1845,    334,   -933,
-   183,  -1614,    739,   1881, -13548, -13589,   1496,  -2075,
- -1281,  -1510,    108,   3683,  -1120,    752,   -980,   -277,
- -1289,   2016,   -290,   1838,   -321,   -139,   -881, -12391,
--14713,   1906,    990,  -3202,   2320,    749,   1872,  -2545,
- -1457,  -1727,    734,   -327,   -316,   1062,  -3149,  -2959,
-  2210,    912,    952,   1926,  -8918,   1098,    594,  -1439,
- -1402,  11097,   3482,   -472,    219,  -3845,   -662,   9715,
-  3928,   1254,  -2009,  12375,  -1724,  13938,   1892,  -1390,
-   686,   2174,   1010,  -1297,   -199,   1855,    463,   2601,
-  4408,   1978,   1679,  -1614,     -3, -11965,  16220,    828,
-  1497,   -747,   -484,    519,  -1804,  -3814,   3287,   2104,
-  1149,    478,  -3918,   1504,   2376,   -316,   -520,  -1449,
- -3918,    664,   2772, -16434,    334,   -540,   -778,  -2812,
- -6026,  -4392,  -2446,   3479,   3742,   -624,   3895,   1145,
-  -344,    333,  11898,  -2725,  12873,  -1145,  -1807,   -279,
-  -452,  -1581,    548,  -5180,  -2012,   3411,   1188,  -1407,
- -4016,   -468,   1904,  -1724, -11390,    -30,  14402,   1610,
- -2138,   1249,    346,   6097,  -1433,   -655,   -174,   3652,
-  4010,    954,  -1458,   -354,  -1872,  -2689,    880,   -846,
- -1304,  -1725,   1750,  -1186,   1520,    499,   -583,  18201,
- -1083,  -3323,   3072,  -5440,   -182,   1065,  -1112,   -984,
-  2501,   -529,    613,   2054,    460,  -5245,   2827,  -1445,
- -2403, -12898,   1504,  -8428,  -1035,  -4620,   1704,  -2586
-},
-
-.cb1110m1 = {
-  1442,  12425,  -2072,    741,  -3624,  12979,   2031,   -364,
-  3750,  -5082,  -1968,    146,    670,  -3988,   -831,   3962,
-   397,   6213,  -1178,    816,    -88,   -432,  -9620,  11572,
-   194,    289,  -1958,  -2115,   -871,   5372,  -3145,   3612,
-  1644,    826,    525,  -2545,   -514,   -537,   2485,  -1014,
-  1276,    541,   -936,   -302,  -1172,    183,    827,  23939,
-  1120,   -346,   -313,   2759,   3934,  -3082,  -2260,   -906,
-  -967,   1496,    102,  -2782,    323,  -1109,    -37,   2554,
- -2920,    998,   -930,  -1952,  -1138,   1842,  -1593,  17345,
- -1214,  -1065,   2182,  -1169,  11745,    278,   8310,   1491,
-  -564,   1169,   8406,   1359,  -1249,  -2094,  -1365,   4069,
-  1828,    897,   1258,   1083,   4319,    610,    766,   2273,
-  4057,    621,    338,   1317, -20941,    548,  -2012,    563,
-  1102,    -27,   3007,   1129,  -1068,   1282,  -2939,   2983,
-  1958,   1800,   1912,   1728,   -606,   1804,  -4768,   5068,
- -1365,   4543,    399, -14152,  -6206,   6187,  -2205,   1174,
- -1892,  -3284,   -206,   2872,  -2622,    -43,  11268,   -104,
-   292,  -1836,  -6276,    725,   2066,   -604,  11382,   -448,
-   742,   2854,   -910,   -838,  -1802,   3678,   -397,   -530,
--10647,   2356,  12161,   1506,   2649,  -3335,   3128,   2169,
-  5942,   2152,  14124,    428,    187,    248,   1592,    -44,
-   -59,  -2934,   1883,   -923,   2673,   -847,    150,  -2142,
- -7620,  11078,   -595,   6490, -13673,    948,    219,  -1314,
- -3080,   1339,  11020,   1362,    247,  -1863,   1069,  -3786,
-  1706,   1064,    320,   4535,    136,   3795,   1465,  -1356,
-  -449,     13,   -421,   1769,  20470,   2181,   -371,   2444,
-  -744,   2263,   -155,   -688,   -236,  -4481,   1551,   2812,
-  2476,  -1436,   -470,   -272,   2276,    594,   -858,   -978,
-  1122,   2468,  -9350,   -353,  -1020,    494,  13167,   1770,
-  1734,    -70,  -4630,  12358,   -818,   -979,  -3931,   1000,
- -4343,   2570,   5567,   3322,   2930,   -236,  -4796,   6987,
- -1658,   4291,   1118,   1710,  -2050, -13566,     -2,    -23,
-  2104,   1101,   -316,   1906,   1643,    340,   5940,   3180,
-  -837,   1978, -10514,   1466,  -6936,   3600,   1205,    957,
-  -211,  -8272,   1611,   5330,  -5217,  -2264,  -5681,  -3085,
- -9201,    -62,   3366,   1370,  -9494,    244,  -5516,   1210,
-  2930,   -432,  -1265,    376,  -1910,  -1016,   -845,   3228,
-  1094,  -3168,    634,   -265,  -3426,   4367,  -4004,   -277,
--15081,   3998,   9671,   3418,    691,   9124,  -2723,   1939,
-  2311,    581,  -4980,   3381,  -1502,    878,  -1037,   1496,
-  3002,    904,  -5388,  -3300,    263,   1277,   -694,    766,
-  1781,   1134,    250, -32602,   -285,    210,   2550,   -383,
-   908,    302,    292,   -352,   2615,    -97,  -1863,   1908,
-  2685,   -502,  -3767,    416,    990,   -602,  -1533,     43,
-  1288,   1326,  16638,    433,  -1204,   1850,  -1609,   1407,
- -7196,   2319,   5770,   1584,   1150,   -634,  -1686,   1359,
- -1396,    438,    246,    186, -11262,  -1194,  -3790,  -3267,
-  2692,    755,    142,  16276,  -2338,  -1341,  10433,     38,
- -1510,  -2520,  -3205,    913,   3783,  -1622,  -4744,   1891,
-  2502,     -8,  -2962,   2091,  14986,   1270,   2931,    682,
-  1073, -10215,   1606,  -1010,   -822,   1168,  -1403,    254,
-  1156,   3206,   3958,   1739,   -402,   -654,  -4862,  -1869,
-  2643,  -2858,    658,   -910,  -2548,   5428,  -1992,   -208,
-  1950, -15526,    520,  -4212,   3182,   4160,   1524,  -2916,
-   586,   3213,    675,    185,   -629,    669,   -838,    502,
- -4065,    353,  -4072,  -1832,  -2108,   5034,   2484,  15386,
- -2102,   4988,     70,   1011,   2568,   1360,  -2821,   3352,
--11074,  -2686,    611,    460,   1811,   3093,     34,  -9140,
- -1163,     26,   -875,   2510,   1134,  -1322,   2274,   -960,
-  -823,   -510,   1092,   1490,   1466,  -1978,  32767,  -2379,
- -1019,   -633,  -1306,   -242,   2050,   1336,  -2668,  -2195,
-  -442,      8,   2292,   4344,  -2439,  -1472,   1035, -14443,
- -1820,   6309,  -2096,     45,   3617,   1561,   1252,   2828,
- 10682,   -894,  10841,   2373,   -101,    913,   2160,   2653,
-  2960,  -4433,   1193,   4892,  -2123,  -7911,    991,  -2643,
- -1364,  -3641,  -9736,    444,    869,   2990,    926,  -1220,
- -1676,   7492,   4376,  -3742,  -6964,   4531,   7522,  -2686,
-   164,   1070,  -7305,   1863,    542,    146,   -800,  18492,
- -4849,  -3876,   2162,   5111,   2606,   4243,  -3035,  -2990,
- -1710,   -426,  -5315,  -2332,  -1020,   -268,  -1242,    -39,
- -1684, -32768,   1288,   -726,  -1768,    304,    702,  -2969,
-  -700,    586,   1541,  -1099,   -348,  -2816,  -2181,  -1260,
- -1658,   2278,    323,  -1548,   2513,  11816,  -2416,  -5837,
-  -118,   6770,   3360,  -4097,   -264,  -1270,   1064,  -9862,
- -3669,    -56,    603,  -1475,   1464,  -9553,      6,  -3091,
-  5331,   -396,    892,  -2774,  -4674,   3667,  -9982,  -5160,
- -1146,  -4026,  -2032,   2936,   1805,  -1026,   1065,   -420,
-  -572,   1756,   -479,   -583,  30760,   -732,    750,    270,
- -1541,     28,  -1114,    -96,   -264,   1167,    548,    570,
-    84,  -1981,  -2110,  -1136,    358,  -6337,   -257, -14658,
-  1144,  -9032,    322,  -3730,  -3086,  -1351,  -3320,  -4116,
-  -396,   -129,  -3202,   1403,   -347,   2400,   -371,    532,
-  1555,  -2760,   1078,    804,  -1314,  21956,   2231,  -2808,
- -1947,    838,  12428, -14514,   -384,  -1554,   -675,   -885,
-  1358,   1612,  -3266,    -98,   1876,   -447,   2241,   3375,
- -1765,   2792,    674,  -1513,  -1132,  -3696,  11368,  -1916,
- -2778,   -466,   -377,   2090,   3897,   5422,  -2550,   2360,
-  3279,   8657,    990,  -2128,   2592,   -970,  -2397,   -269,
- 22742,    694,    310,  -2433,    920,   -690,   1478,   1370,
-  -450,    445,  -1379,  -1244,   2374,   1400,  -1040,  -5692,
- -1700,  -1630,  -4068,  -1193,   -719,  -2953,  -3562,    264,
--13247,  -4629,      5,   3245,  -5724,   2449,   3190,  -5375,
- -3560,  -3834,   1271,   1568,   -762,   2938,    782,  -1390,
-   243,   -466,   1376,    974,  -1646,  -1784,    249,   -514,
--13543,   1904,  10778,   -772,   -155,   7838,    -30,   3634,
-  -473,  -9100,   -112,  -3990,   -840,   1495,  -2346,   -326,
-  3655,   1292,   -292, -10972,   3431,   -262,    171,  -9775,
-  -985,    578,    312,  -2553,   3375,  -8316,   1410,  -1326,
-  2459,  -3116,   1079,   7194,   2720,   1998,   2742,   4672,
- -1589,  -8932,   -124,   -652,    -72,   2409,   -926,  -3661,
- -3762,  14832,  -1350,  -2234,   1258,  -1604,    169,    103,
-  1263,   -400,   -765,    144,    824,    855, -13344,  -1629,
-  1977,   2995,  -1964,   -650,   -219, -11607,  -6062,   -792,
- -1243,  -1438,   1757,   1436,  -3739,    812,   -856,  -9603,
- -2428, -11372,   3273,  -2318,  -8263,   1551,  -2054,  -3646,
-  3149,   2255,    594,   -412,  -3030,   1558,    694,  -1211,
-   618,   3256,   6526,  -1572,  -9054,   6655,  -3208,   3616,
-  2162,   3137,   4254,   4610, -10040,   1188,    335,   -615,
-   640,  -1990,   -314,   6014,  -2392,  -2174,    343,   6730,
- -1320,    183,    -97,  -3566,   2988, -13343,  -1573,  -9070,
-   428,   2839,   6728,  -1109,  -1113,  -1102,   5012,   1308,
- -3943,   3207,    764,  -2928,   1144,  -3044,   4033,   1846,
-  6460,  -4165,   8509,   9824,  15708,   -642,    748,    124,
-  -406,  13033,    807,   -299,   1319,   1499,  -1206,  -1102,
- -3129,   3795,     47,  -2483,  -2470,   2287,   4028,   1656,
-  -364,  -1712,  -1568,  -3940,  -2770, -13688,    796,   3380,
-   363,   1673,   1160,  -3934,   2884,  -5060,    832,   4799,
-   364,  -3030, -10596,  -1805,  -3256,  -2492,  -1831,   1088,
- 11108,   3236,   5128,   3052,   4486,     84,   2078,    200,
- -4071,   1713,   1539,  24597,  -1019,     32,    -48,     82,
-    81,   1171,  -1261,  -1783,  -1693,   2194,   1714,   -225,
- -1989,    402,   2611,   -708, -15901,    222,   -507,  12855,
-  1162,  -1536,  -2884,   1911,  -1256,   -926,  -1875,  -1448,
- -2730,   3059,  -1231,   1680,   1824,   1288,   -215,     -9,
-    40,   -957,  27662,  -1844,  -1927,   -846,  -1144,   -439,
- -3507,  -2844,  -1880,    637,   1042,    237,   1007,   -387,
--11913,  -2584,   -142,    624,   -494,   1439,   2225, -13017,
- -1901,  -1253,  -1071,  -7083,  -2154,    814,   3867,   1130,
- -2611,  -2260,   1548, -12389,  -1018,    102,   1178,   1058,
--14863,   2020,   4094,  -1259,   -861,   -886,  -3119,   2638,
-  1725,  -1364,  -2086,    183,    507,   -978,  -3086, -14966,
-   759,  -1341,    -70,   8538,   2974,   -140,   2509,  -4460,
-  2724,  -1372,    491,  -6138,   -345,  -2170,  -1187,   -330,
--11090,  15657,   -300,   2105,    496,  -2093,   -447,   2000,
-  3451,   1482,    758,   4142,    562,  -4042,   1491,   3183,
-  1685,  -2729,   1611,  11698,  14918,     25,    842,  -2766,
-  -667,  -1564,  -2619,    646,   1391,    862,   -909,  -2141,
-  -589,   1468,   -755,   1324,   -765,    634,    195, -19622,
- -1006,  -1161,   2434,  -1808,   4168,   4108,  -2580,   -635,
- -2533,  -2170,  -3701,  -1047,   -363,    769,   5064,     -8,
-  -654,   2346,    752,  13736,  -4056,      7,   5492,   7326,
- -4894,  -3860,   3325,  -3947,   4721,   5557,  -3699,    194,
--12957,   1052,  -1317,  -2642,  -2931,   1050,  -3951,   2392,
- -9683,   2519,   2880,  -3700,  -1820,    831,   4370,  -1177
-},
-
-.cb1616l0 = {
-  -185, -20290,    476,   -272,     31,   -638,    806,    -61,
-   220,    176,    178,   -788,   -441,   -333,   -360,   -263,
-  -116,   -512,   9794,   -727,   8904,   1192,   -277,    756,
-  -670,    795,   -311,    240,   -617,   -675,   -970,    756,
-   857,    529,   -166,    674,    890,   -522,    837,     79,
-  -618,  -1308, -13832,    744,   5422,   2688,    531,    398,
-  1500,  -1965,   -209,   -346,    613,   2147,  10053,  -1398,
-   189,   -108,    471,  -1202,    999,    178,    762,   -601,
-  1116,   9468,   -281,    763,  -1204,   -822,    -20,   -160,
-  -806,  14720,   -269,    143,  -1362,   -532,   -788,  -1532,
-  -405,     85,   -271,  -4959,    276,    -34,    -28,    -66,
-   112,   -188,   -582,   -678,    128,    680,    982,    596,
- 12154, -10468,   -167,   -380,    734,   -296,    282,   -223,
-   -86,   -342,   -812,    514,    387,   -418,   -364,  -1216,
-    14,    373,    357,  10897,  11235,   -714,    206,   -618,
-  -607,    596,    190,    726,    496,   -300,     95,   1022,
-  -153,    212,   -540,    252,    281,    238,   -234,     28,
-    24,    184,  32767,   -627,    569,    323,    486,    544,
-  -348,   -589,   -284,    238,    228,    475,     83,  -7753,
-   182,    745,    400,   -633,   -207,    137,    382,     90,
-    78,    715,    448,    463,    937,  10203, -12047,   -667,
-  -370,  -1516,   -360,     94,    832,   1027,   1013,     92,
- -5446,    834,    302,    764,    -94,   -462,   8095,   1057,
-   308,   -635,    308,   -877,   -946,   -616,     51,   1090,
--13351,    490,   -819,  15182,   -384,    411,   -546,   -242,
-   460,   -323,     76,    277,   1582,    900,  -1119,    345,
-  1316,   1138,   2020,   1612,   -148,    812,   1241, -10350,
- -9495,   -965,    -69,   1967,   -168,   -128,   1042,    447,
-   491,   -133,  -5083,   -450,   -164,     50,    326,    269,
-  -283,    226,    -40,   -334,   -110,     60,    -47,    169,
-  9166,   1188,   -942,    -14,   2112,   -230,    634,   -741,
-  -214,   -336,   -606,   3102,     59,    216,   1805,  -1176,
-   211,     -8,    564,    156,   -261,    300,    597, -21842,
-    66,   -232,   -506,  -1126,   1057,    603,   1448,   -391,
-   249,  -9445, -10240,    694,    167,  -1158,   -645,   -385,
-  -209,    330,    519,   -345,   -600,    192,     78,   -229,
-   208,  -9053,   -383,  10646,   -264,     84,    295,   -148,
-    87,   1292,    257,   1080,   -564,  -2395,  -1200,   -484,
-   -48,   -513,   -383,    -11,   -516, -17356,  -1172,   -218,
-   124,   -327,     31,    328,    -80,    231,     58,   -951,
-   560,   -501,   -392,  30528,    -56,    382,   -515,    -50,
-  -155,    338,      0,   -414,   -899,     95,     11,    378,
-  -350,    459,    673,     76,     86,    379,  32222,    143,
-   -48,    425,   -394,    -60,   -348,    450,   -489,    220,
-    56,   1129,   -125,    322,    168,    -16,    322,   -293,
-   294,    -38,    328,    141,    692,    -82,   -160, -32768,
-  -140,  -1543,   1079,   1052,   -924,   -569,    168,  -1782,
-   815,    706,  -1318,  -3436,   2860,  10922,    236,  10311,
-   882,  -1911,     11,   1638,   -189,    245,   -858,  11060,
-  -826,    696,    224,   1707,   1766,    472,  10832,   -265,
-  -161,    163,    478,   -258,   -284,    -86,    496,    425,
-   -71, -10344,   -141,    425,  -1457,   1145,    -63,   -713,
-  -583,   -327,    628,    368,    -18,  -1746,   -525,   -338,
-  -110,   -359,     92,   -233, -21328,    460,   -275,    -98,
-   -58,     51,    208,     56,  -1145,    -51,   -242,     65,
-    76,    214,    141,     28,    -86,     26,    925,    193,
-  9980,   -326,  11342,    176,   -534,   -303,    130,  -1575,
-   189,   -496,   -699,    381,    411,    644,    229,   -147,
-   694,  -1998,    523,  -1576,   8028, -10385,  -1924,   1174,
-   608,   2402,    575,  -1753,    437,   -816,   1267,    147,
-  1448,   -614,    865,   1076,   -156,   5000,   2020,   2021,
- 10283,   -460,  -2381,  -3226,  -3991,   4904,   -284,    105,
-  -268,   1049,    203,   -646,    732,   6490,   -128,    932,
-    10,   -866,     74,    -64,    834,    204,    159,   -162,
-  -170,   -110, -28908,     52,   -512,    -72,    327,    615,
-   534,   -484,    131,   -262,     31,   -407,    284,     33,
- 11118,   -170,    318,  12848,  -1126,   -659,    500,    310,
-  -403,   -234,    237,   -544,   1232,   -243,  -1178,   -965,
-  -117,    108,  -1304,  11728,  -2254,   1231,  -1077,   -136,
-  -632,   -103,   -256,  -1644,   -300,   1680,  -1175,   -956,
-   -43,   1718,    175,    144,    275,   -802,   -223,   1116,
-   321,   -871,  -1174,  -1175,   1008,    255,  31172,     28,
-  -621,   -222, -12473, -10995,   -712,    247,   1762,    418,
-  -181,     90,     92,   -406,   -435,   -105,   -596,   2262,
-  -116,  -1574,  -3402,   6796,   7944,    973,  -2661,   2260,
-   621,  -6984,    382,  -1375,  -2604,   1550,  -1453,   1133,
-   966,    403,    284,    -72,    -36,    174,    457,    -90,
-    38,   -437,   -476,   -370,    469,  32767,   -267,    350,
-   694,   -169,   -782,   2110,   -620,   -782,   -669,  -6478,
- 10550,  -3294,    485,    177,    553,  -3232,   1628,   2335,
-  -870,   -360,  -1112,   2197,   -474,  -5113,   3346,    878,
-   566,  -3823,  -1175,    357,  10509,   1077,   -514,   1012,
-    38,     59,    669,    654,    349,  -1046,    355,    192,
-    57,     95,  11869,   -702,  10201,    204,     45,   -608,
-  -444,    921,  -1070,   -316,   1286,  -2566,   2026,   -127,
-   -79,   -954,     93,  -1288, -10024,    693,   8820,   -366,
-   -84,  -6378,   1682,   -627,    386,    254,    503,   -152,
-  -336,     38,   -341,    373,    -85,   1088,  -1707,    119,
-  -242,    242,   -326,   -162,    109,     70,   -114,   -831,
-  -279, -32768,     62,     58,    214,    136,    194,   -103,
--10047,   -610,     91,   -310,  12059,    346,   -656,    986,
-   478,    364,   1777,   -173,   -663,   -103,   1011,   -373,
-   200,   1632, -13098,   3651,    418,    478,     68,   -217,
-   169,     78,  -1176,  -1191,  -1664,   -328,    152,  -1053,
-   547,    527, -10435,   -176,  11131,   -137,    -36,   1062,
-    33,     71,   -730,   2080,   2061,   -372,   -637,    -84,
-   744,    109,   -357,    550,    309,   -239,   -134,    135,
--20461,   -177,   -690,   -488,    -36,   -415,    275,     64,
-   378,  11250,   -802,   -569,   -200,   1499,  13103,  -1090,
-  -175,    189,   -162,   -751,   1052,   -949,    -98,   1249,
-   479,  -1304,   3293,    771,   1642,   -381,   1423,   2258,
-  1184,   4806, -10950,  -3873,    348,   -815,  -5315,  -3306,
- -3307,   2337,    776,   -125,    -48,   -435,   -155,    -30,
-   294,    116,     96,    -47,   1022,   -391,   -183,    252,
-   826,    -32,    293,  -1369,  18310,   -146,    239,   -266,
-    34,   -154,   -704,   -498,   -135,    228,   -563,   -210,
-  -158,   -514,   -201,   -571,   -341,   -428,     74,   -152,
-   297,   -162,   -644,   -216,   -252, -13810,    705,    464,
- 21097,     74,   -169,    792,     12,    131,    320,   -398,
-  -446,     44,   -362,    388,    -22,    -13,   -209,   1205,
-  9341,    590,   -683,   -351,    177,  -1618,    495,     14,
-  -319,    755,  11352,    249,   -989,   1574,   -922,   -364,
-   366, -10348,    337,   -558,   -124,  12056,    102,    802,
-  -548,   -254,   1532,      7,   -282,   -459,   -839,    171,
- -4445,  -1610,  -1515,    -37,    970,    306,   -881,   -238,
-  -154,    -58,     27,    435,    166,    571,    225,   -844,
- -9967,   -192,   -874,   -459,  -1283,  -1431,   1552,    -38,
-  -686,   -207,    709,  11982,   -383,   1922,    -92,    -60,
-   708,   -900,    867,     39,   1470,    517,   -182,   -456,
-    90,   1026,   -192,   9988,    942,     48,    789,    981,
-    74,   -692,  -1283,   1239,   1625,  -1121,   -286,  -1115,
-   294,  13228,    980,    312,   -745,  11711,   1055,   1052,
-  -907,    201,    688,    364,   1171,     96,   -591,   -981,
-  -246,    875,   -352,    677,    881,   -397,  12890,     10,
-     0,    412,     76,    464,    275,   -721,    -28,   -197,
-   104,   -238,   -372,   -272,    490,   1426,    963, -13232,
- -1190,    790,    161,   -321,   1138,    646,    359,   -183,
-  -659,   -129,    348, -22703,   1016,   -147,     26,    -80
-},
-
-.cb1616l1 = {
-   292,    310,   -255,    305,     69,  25001,    -16,   -668,
-   210,     17,    -12,     45,   -758,    -76,   -544,   -882,
-    61,     26,  -1682,  -8820,    154, -11775,     64,    472,
-  -464,    245,    478,  -1560,    869,   2192,     98,    645,
-   -95,  -9369,   -594,   -635, -11132,    900,   1606,   -904,
-   841,   2570,  -1464,    961,   1056,    669,    461,   3307,
-  -157,   -644,    121,   -694,    170,    116,    393,   1507,
-  -233,   -654,   -162,    108,     98,  17471,    347, -11344,
-  -701,   -284,   -246,   -337,  -1903,     14,   9865,    453,
--11318,  -3662,   2373,   1106,  -1424,  -1709,  -2743,   -860,
- 11008,   1579,    -38,  -1381,    467,   -487,  -1306,    369,
-   426,   -424,    128,   1078,   1085,    683,  12552,    792,
-  -184,   -278,    186,   2006,    363,    310,    -75,    862,
-   377,    490,   -256,  -1568,   -124, -10785,  -1456,   -524,
- -1259,    517,  -1844,    914,    769,    945,    739,  -1053,
-  -691,    177,     96,  -1070,   -162,   -707,   -594,  -9885,
-   103,    452,   -734,  -6774,   -753,    192,     88,   -292,
-   201,   -532,    231,   -281,   -691,  -1232,  -1768,   -753,
-   369,   1556,   -139,    668,    941,    264,  10372,   9740,
-   976,   2519,    -88,    941,    446,   -130,   2131,   -631,
-   325,    285,    176,   -236,   -634,    -91,    112,  32767,
-  -233,   -726,    156,    881,   -217,   -497,   -236,  -1106,
-   283,    164,   -328,   -629, -27442,    -17,    176,   -338,
-  -192,    538,   -773,    634,   -180,    872,   -190,   -530,
-   586,   6994,   3060,   -336,    736,  -1268,  -1142,    -69,
- -1359,  -1047,   -975,    -86,  12489,   1162,   -509,   -478,
-   717,   -514,   -502,  -1755,  11064,   7668,    340,    230,
-  -127,   1490,    -63,    680,   -297,    125,   1700,   2505,
-     3,  -2043,    255,   1547,    569,  -2483,    733,   -896,
-   881,   4780,   1544, -13442,   1328,   1937,  -4448,   -384,
-   749,    173,   7350,    156,   -144,     52,   -527,    -34,
-    -3,   -173,    118,   -528,    -75,     39,     42,   -874,
--14636,    474,   -413,   -106,   -115,   -431,     54,    722,
-   156,   -468,    369,    149,    -68,   -791,   1318,   2150,
-    69,    454,  19032,      3,    111,    -40,    349,     88,
-   385,    -54,   -395,   -224,   -519,      0,   -219,    179,
-  -253, -11379,  11005,   1857,   -126,   -248,    304,   -616,
-   351,    324,    500,   1494,  -1390,   2349,  -1257,  -1114,
-  -213,   8156,  -2066,   9746,    763,   -848,    349,     -7,
-   723,   -966,    469,     91,   -252,   1336,    579,   1816,
-  1372,   -941,    364,    276,    -33,      7,   -425,   -433,
-   -21,    546,   -671, -31271,   -926,    101,    147,    302,
-  -552,    224,    568,  -2386,    519,   -458,  13171,  -1464,
-  1161,    639,    -10,   -877,    331,   3372,    -72,   5158,
-  -706,    906,   2668,   1008,  -2732,   3264,    105,    630,
-   673,  -1948,   -196, -13130,   1726,    737,   4829,     93,
-   654,   2175,   3858,     -5,    245,   -471,    369,   5435,
-   356, -12934,     61,   1984,    975,    706,  -2454,   -642,
-   -93,   -780,   -443,  -1487,   -460,   1112,    385,    309,
--10268,    197,  -1692,  -1870,     50,  -1934,   5380,  -1193,
-   775,   -493,   -992,   -557,   2952,    408,   4616,  -1341,
- 10774,   5305,    854,   3031,     67,    617,   2436,  -2072,
- -1469,    804,   -578,    243,    264,   9150,    200,  10753,
-  -350,    182,    -52,   -406,    508,   -761,   -161,  -1142,
-    25,    484,    127,    126,    477,   -341,    110,    371,
- 32767,   1090,    678,    175,    146,   1020,   -897,    878,
-  -137,   -507,   -534,    658,    678,    505,   -753,   -207,
-   391,     60, -23279,   -772,  -1323,  -1578,     -3,    196,
-  -749,    220,   -482,   -785,    456,     38,   1034,   -579,
-   -58,  -1539,    421,   -746,    238,   1531,  21290,    586,
-  -441,   -276,   1512,    553,  -1407,   -276,     60,  -1068,
-   299,    650,    -25,  12590,   2058,    925,   -295,  -1744,
-  5152,   4935,   -419,    272,   -383,   -665,   -194,   -255,
-   574,   -267,    541,   1031,   -282,   -648,    622,  -1464,
-   -28,   -269,   -533,    -80,   -476,    282,   -336,    125,
-   104,    464,  -8948,    849,    171,   1518,   -296,     51,
-   -27,   3097,  -5103,   -412,   -494,   -194,   -713,  -1277,
-   102,   1740,   -445,   3432,   1180,   6404, -10908,   -970,
-    31,    142,   -242,    -79,    -78,    -76,    124,   1031,
-    83,    -55,   1522,   -613, -32768,   -394,   1306,    287,
-   701,  -4725,  -1085,    415,   -122,   -538,   -675,     82,
-   116,   -728,    -99,    500,    659,   -329,    292,   -106,
-  9243,   -340, -11933,   -498,    341,   -825,   -401,   -402,
-   142,    -13,   -309,   -722,    141,      0,   -681,    494,
-   671,  -1210,   1466,  -1335,  11743,   -280,   1616, -11481,
-    52,    317,    902,   -653,   -967,   -494,   -162,   -685,
-  -438,    756,     81,   -207,    577,  -7476,   -353,    918,
-   -31,   -107,    181,    523,    -46,   -752,    373,   -908,
- -1808,   -916,    632,   1508,    -35,  -6943,     64,  13072,
-  -655,    163,   1221,  -1655,  -2568,   -446,   -401,    470,
-  -622,   -944,   3744,   -458,    203,    125,    238,   5196,
-    21,  12193,   1095,   1091,   -787,  -1157,   -980,  -1154,
-  7707,    -29,    106,   1226,    696,   -974,   -379,   -537,
-    56,     95,   -477,   -528, -11245,  -1014,    140,    380,
-    89,    540,     84,   -619,   -322,   -572,   -240,    -26,
-   727,    310,     43,   -790,    -31, -24318,    110,    618,
-    44,   -108,     89,   -191,    -33,   -201,   -490,     43,
-  -136,   1366,     -2,    162,   -832,    469,   -140,   -278,
-   600, -15775,  -1699,    184,   1825,    728,  -1803,   -876,
-   152,     60,   -813,   3063,   -929,    972,   -282,    718,
-  8426,   -888,   1383,   -664,    571,    958,    982,    236,
-  -548,     66,   1898,   -274,  10715,  -1693,     79,  -1254,
-   296,    609,    682,  -1074,    272,    157, -18972,    377,
-   -12,    438,    536,   -672,    292,    719,   -464,   1106,
-  -296,   -812,      6,   -334,     67,    678,    382,    678,
-   301, -22165,    184,     80,   -671,    -86,    139,   -298,
-   416,   -610,   1057,     15,   -230,    376,   -768,    643,
-    58,     27,    178,   -742,     60,   -500,    485, -19923,
- -1016,    717,   1126,    287,   2171,   -388,   1453,    -21,
-  -268,  -1555,   -263,    713,   1709,  -1103, -10699,   1788,
-    -8,   -501,   -892,  11476,  -2006,    466,   8070,   -286,
-   163,     35,    494,     76,   1428,  -2249,    100,  -1542,
-   319,   -214,   -701,  10130,   -294, -11962,   -656,    227,
-  -512,  -1014,    213,   -600,   -720,     63,   -180,   1286,
-  1063,  -9671,  -1056,   1269,   1484,     20,    790,     29,
- -9906,   -373,    608,    361,   -659,     43,  -1034,    -96,
-  -219,    -65,    392, -19615,   -464,    212,    820,   -182,
-  -227,    463,    301,    642,   -219,    386,  -1170,    108,
- -5583,    422,   -507,    530,  -1058,   -131,     20, -14487,
-   101,    -14,   -415,     32,  -1133,   -917,    944,   -832,
-   580,   2509,   -959,    470,   1184,    432,  -1238,    193,
--13382,   2329,   1993,   1035,     80,   3139,   -553,   1683,
-   390,   1480,    642,    564, -11173,    422,   -984,   -559,
-  -686,    168,   -777,   -810,  -1278,   -427,    -96,   1691,
- 29172,   -435,    -50,   -968,    221,    685,     52,   -373,
-   525,   -563,    350,    528,    305,    705,    313,    612,
-  -254,   -220,  -1638,   -156,     24,    109,   -893,   -697,
-   245,   2579,    667,   -142,  12315,   -694,   3799,      5,
-  -438,   -473,   -426,     59,  -5381,    -56,    200,   -280,
-  -276,     96,    435,    729,    336,    123,   -714,   -372,
--12609, -12053,   -238,    223,   -242,    230,    663,   -645,
-    98,    515,      3,    724,    510,    -48,   1090,   -173,
- -5024,    536,    635,   -143,    702,    172,   -196,    164,
-   190,   -152,   -180,    238,   -142,   -329,    191,   -296,
-  -416,  11775,   -496,    -95,    392,    994,   -584,   -925,
-  -963,    286,   -458,   3104,  -1990,    968,  -1430,    998,
-  -407,  28485,    436,     42,    378,   -210,    148,   -149,
-  -532,     94,   -628,    186,   -186,   -274,    250,   -316
-},
-
-.cb1616s0 = {
-  5604,   1491,  -2064,   1321,  -2846,  -3007,  -1899,   -896,
-   556,   1969,  -2225,  18515,   4156,   1333,   3489,  -2168,
-  1897,  -1440,  -1514, -13837,   1017,   4797,    453,  -2101,
- -6822,    923,    185,    754,   -201,  -4151,    126,   -793,
-  -437,   2474,   4286,  -6405,   4007,  -1644,   -757, -13106,
-  2460,  -1874,  -1867,  -1099,  -5146,   2945,   2162,  -4427,
-  1692,    763,   1756,   -821,     66,   -348,   2001,    702,
-  1046,  -1365,   -570,   1073,  32655,     -9,    450,   -761,
-   908,   -200,   -572,  -1306,   2589,   2406,   1926,   1772,
- 11042,  -1989,   3914,  -1192,   1817, -11710,   2985,  -2942,
- 15684,   1919,   -667,  -1267,   5212,    444,    864,  -3844,
-   438,  -2382,    974,    983,   -887,   -822,    185,    245,
- -3192,   1030,   1441, -28152,  -2616,   -380,    300,   1990,
-   -94,   -999,    285,    553,   2107,    960,   -859,   1001,
- -1632,   2208,  -1302,   1331,  -3956,  10593,  -1931,  -4486,
-  9376,  -6587,   -463,  -3605,   2460,   1306,      2,   1987,
-  1643,   -552,   1327,   1124,   -581,   1347,    650, -29514,
-   278,   1062,   1459,    951,   2416,    396,   -594,    930,
-   434,   3308,  -2816,   5466,   4831,  -2869,    -68,   -894,
-    58, -13036,    210,  -1940,  -2524,   1139,   2044,    -32,
-   969,   2187,    516,    581,   8185,   2080,    176,   -708,
-  1529,   1132,   -675,  -1384, -10949,   1174,  -5245,    580,
-  7490,   3258,   4314,   2706, -13676,  -1735,   1937,    577,
-  -108,   2676,    612,   -966,   -966,   3255,   1401,   1443,
- -1850,   -252,   9270,   5037,  -1492,  -1957,  -2134,   1198,
-  3470,  10482,   -468,   -671,  -1655,   -955,   3248,   3360,
-   448,  -1854, -25145,  -2771,  -3318,    561,   -672,   1791,
-  2194,   -598,   1673,   -420,    547,    122,   -160,   -172,
-  1686,   -397,   1187,     11,   -879,    -58,    323,    180,
- -2588,  -2139,  -1794,  -2924,    999, -26969,  -1280,  -1401,
-  -770,   6159,  -4449,  -4174,   5270,  -4813,   4139,  -2023,
-  2694,   2884,   3418,  -5948,   3118,  -1176,   4691,   8566,
--32768,   -681,   -553,   -216,   -216,   -931,   -507,    579,
-  -932,   -740,    349,     81,   2120,  -1222,    564,  -1576,
-  1241,    159,   2579,   3236,  19205,   -744,  -1727,  -1803,
-  1247,   -575,   -261,    261,    540,   -255,    -60,  -1428,
--14184,  -5194,    863,    997,   1043,   -828,    466, -12553,
-  2106,     56,   -566,   1142,    401,   1360,   2322,    629,
-   937,   2954, -10086,    -12,   2554,  -5760,    523, -15184,
-   636,    156,    165,  -2638,   1134,    658,   4398,  -1385,
- -1924,   1179,   3222,   -908,  -1153,  18082,   1011,   1948,
- -1007,    352,   -172,  -6446,    -22,   -228,   -264,     73,
-    76,   2229,  -1349,   6103, -11588,    576,   3374,  -1616,
-  7904,   3146,    984,   1056,  -1626,   3113,  -3674,    203,
-  -452,   -938,   2074,   2409,  -1228,  -8186,  -2766,  11098,
-  1598,  -8658,   -735,    556,   1610,  -7419,  -5267,   1158,
-  2841,   4497,   7551,  -2066,   1105,    761,   2549,  -1764,
-  2870,   3889,  -1478,   1912,   2504,  -1417,    963, -14602,
-   579,     28,  -2953,   1589,   3962,  -1372,  -3304,    566,
-  2687,   9700,  -2464, -13110,   3005,   -772,  -3775,   -138,
- -4244,   5031,   2523,  -2883,    582,   -446,   -274,   3311,
-  -157,   -784,   -948,   -292,   3085,   -781,    954,  -2133,
- -6693,  13909,  -2236,    416,  -2589,  -3194,    668,  -1988,
- -2234,   2365,   1034,   1201,   -100,   1688,    372,    156,
-  -254,    931,    576,  -4680,    566,  -1823,    294,   1645,
- 27678,  -1353,  -1230,   1744,    570,   1679,    608,    -35,
- -7150,  -4383, -11992,  -2910,  -2096,    512,   1838,   3129,
-  -410,  -2306,   -551,  -3904,   4140, -12782,  -1743,   -106,
- -4190,  -5554,  12975,   -573,  -3532,  -4050,     15,   1307,
-    62,   1643,  -1988,   5774,   2064,   4734,   1009,   2038,
- -2794,  -2704,   2275,   -279,  -1588,   -910,  31315,   1249,
- -1642,     78,    164,   -260,   -878,    698,   1189,    159,
- -6137,  -1994,    775,   3484,   1635,   1121,   4391,  -5883,
--11300,   3722,   -422,  -2180,  -3206,  -3181,  -1490,    291,
-  1326,    399,   1952,  -8405,   2240,    175,   3541,   4258,
-  1518,   -781,   1105,    498,   -348,    771,  15918,    120,
-   379,  -2036,  -3723,  10948,  -1827,   3220,     40,    210,
-  -294,   -813,  -2349,   -707,    967,    953,   2625, -13614,
- -1519,   9454,  11606,   -903,    817,   6237,  -8878,   -160,
- -1768,    444,  -2812,  -1697,  -1010,   -964,   1846,   2997,
-  2633,  -1924,    501,  -1464,   2402,   -986,  -1143,    527,
-  1187,   -929,  20923,   -563,    785,   -486,   -940,   1625,
-  -796,   -697,    348,   -428,   1451,   1087,  -2252,  -2481,
-   939,    890,  -2508,  -1357,  -1868,   1395,  -6386, -21986,
-  2574,   -384,   -324,   7752,   2996,   -641,  -7903,  -5745,
- -4226,  -4178,  -4394,   9307,   3906,   -227,   -496,   4556,
-  1099,   -838,  -2546,   1190,   9937,  11057,   3846,   -156,
-   433,  -2873,  -1769,     36,   3188,   4490,   4369,   4714,
- -4681,  -2804,  -1525,   -947,  -5064,  -4180,  -1348,  -1404,
- -1097,  -3922,  -1088,   -444, -13636,  -1547,   1685,  -1625,
- -8494,   2492,    -72,   9893,   2470,    705,    105,   5609,
- -5403,    846,     90,   -688,   1184,   6286,   -253,  -1610,
-  3348,  -2082,   8838,  -2453,  -1315,  -1235,   -719,  -4607,
- -2138,  -5522, -10466,   1900,   1541,  -2688,    729,    368,
- -8845,   1282,    438,  -2532,  -2328,   4833,  -6145,   4037,
-  3584,   7965,  -1495,   6999,  -5037,  -1364,   7095,   4253,
-  2711,  -8336,   3946,  -1347,    192,   -820,   -328,  -1152,
-  1554,    869,   5053,   9707,  -5888,  -4294,  -3858,  -3344,
-  8344,   -644,   1750,  -1796,   -149,  -3706, -14823,    656,
- -1487,  -2466,    640,  -2286,  -2902,   2906,     44,    211,
-  -336,  29976,   -298,   2092,   -688,   1857,   1807,  -1705,
-  3211,    425,  -1046,    128,   1191,  -1966,   -726,  -3040,
- -3632,   1212,   2986,   5266,   1086,   3624,   3068,    422,
-   989,  24479,   3791,  -2229,  -3713,  -2379,  -1370,  -1799,
-  2742,  -3259,  -4973,   -626,   2287,   5655,    663,   -918,
- 13266,   7762,  -1131,   2490,  -3123,   2869,   -846,  -2828,
-   119,  14540,   4588,  -2784,  -3713,  -2547,   3698,   3189,
-  3372,  -5436,    856,   4382,   4124,   3406,   -336,   -911,
-  -137,   4268,  -4436,   1566,   1169,  -3020,  13980,   -162,
- -7226,  -2550,   -946,  -2408,  -1056,   -587,   -273,   -932,
-  -219,  -8021,  -1086,  -2587,   3852,   1235,    -22,    222,
- -1100,  -1594,    137,  -1985,  10225,   4998,   -348,   -450,
-  6651,  -2217,  -7705,   2508,  10061,  -4512,  -2262,   6156,
-  2962,    150,  -2456,   1089,   -927,   -609,  -3130,  -1682,
- -1215,  -9251,   -130,  -3776,   -309, -13872,   -276,  -6922,
-   -82,   2660,  -1255,  -6562,   2640,   2646,    422,    -84,
- -6020, -11551,  -1710,  -3462,  -2666,  12510,   3145,   -218,
-  2956,    447,     30,   2268,  -2410,  -1400,    660,    431,
-  3068,    258,  -2862,   3919,   2693,   -744,   3070,  -2179,
- -1192,   -932,  -2095,   -279,   2045,  -8205,  15263,  -4415,
-  2116,   4047,  10308,   3110,   1368,  -1547,  10919,    988,
-   -81,   -907,  -1728,  -1052,  -3539,  -4769,  -2576,  -1038,
-  9255,    152,    431,   2455,  -1544,   1880,   -312,   2724,
--13336,  -4197,  -1199,    709,   -695,  -1687,    442,  -2564,
- -1626,  -1888,   1870,   3539,  -2922,  -3506,  -7890,  -5486,
- -1640,   2178,   2173,  -3200,  -4626,   1116,  13161,  -5221,
-  -852,  -1047,  -3328,  -3975,  -4441,   2870,  -1458,   5664,
-   -28,   3853,   1809,   2721,    658, -15262,   3611,   3223,
-   595,     44,  -5327,  -2486,  -1806,    606,  -2474,  -1236,
-   983,   1741,  -8390,   1948,   1875,  -1806,  -6294,   -814,
-  -747,   2209,  -1332,   2058,  -1326,   5808,   1113, -10765,
-  -584,   4038,   1412,  -3356,     24, -12826,  -4322,  -2287,
--10793,   3008,  -6903,  -1273,   1590,   -608,   -514,   -309,
-  -144,  -2024,   1822,   4375,   1122,   -631,    -76,   -595,
-   192, -11323,   8168,  10180,   -646,   2478,   4516,   1095,
-    94,      6,   1251,   -658,   2620,    626,   3078,    727,
-  7769,    966,  -3593,  -6990,  -2358,   1022,   1288,   2733,
-  -259,   -291,   2482,    297,  -1268,  10338,    739,  -1862
-},
-
-.cb1616s1 = {
--12873,  -2429,   6659,   4401,  -2250,   1684,   1508,   1780,
- -1081,    -10,  -6012,    895,  -2373,  -1263,    125,   1448,
-  4744,   1556,  -7267,   2354, -11368,   1155,  -7699,  -1424,
-  -914,   -591,   2472,    538,   1431,    953,      5,  -3066,
- -1063,      3,    406,    979,    922,   -668,   1633,      2,
-   649,   -139,    964,    860, -18807,   1944,   2183,  -1358,
-  1395,  -1167,   5369,  -3525,    735,  -2698,  10556,  -1137,
- -3979,   1383,  -1997,   5995,   6465,   2310,   1781,   -311,
-  3376,   7199,  -2745,  -1656,  -5702,   3180,   3017,  -5673,
-  -712,  -8902,   2058,   -570,    170,   2276,   3869,  -9332,
- -7965,   1130,   2111,   5638,  -1507,   2944,   1574,   -919,
- -1459,   -970,  11093,    544,  -2952,   -146,  -4684,   -303,
-  -528,  -1199,   -890,  -2720,  -1665, -10952,    373,   1657,
-  1960,  -1386,    299,  -4356,  -4527,   8948,   7378,   1580,
-  1301,  -6057,   7650,  -7399,   4646,  -1768,   2756,   -263,
-  -286,   -334,   1369,   -786,  -3760,    824, -13524,  -5099,
- -1693,   -347,  -1821,   1992,   3462,   1421,   4900,   -462,
--13331,  -1617,  -2350,   4083,  -8721,  -5880,   4900,   2912,
-   235,  10369,  -1340,    776,  -2598,  14344,  -3805,   -568,
- -3788,   3591,   -394,  -1077,   3908,   6080,   1953,  -1454,
- -1013,    507,  10097,   3396,  -4662,   -763,   2506,   1486,
-  3088,    580,    -86,   1117,   1606,  -3454, -10782,   4870,
-  6170,   4020,  -5675,   6848,    439,  -8765,   3877,   6250,
-   734,   3245,   -874,  -4312,   -879,  -4368,  -1287,   3212,
- -2130,  -1435,   1619,   -280,  -3082,  -1070, -18921,    940,
- -2428,  -1548,  -1142,   -271,    193,   -240,   -890,    918,
- -4350,  -5042,  -8994,   5060,  -6495,   3455,   -259,    892,
- -1290,   1348,  -1049, -12681,    -49,  18286,     75,    791,
-  1830,  -4116,  10240,    -12,   -459,   2477,  -2582,  -3344,
- -1598,    982,   -324,    -48,  -4229,  -8476,  11120,    100,
- -6238,   1164,   2369,  -2052,    247,    626,   2213,   2279,
- -2627,    289,   -471,  -1136,  -1818,  15413,    579,   1034,
- -6835,  -8645, -12667,    758,   -932,  -4398,    565,    458,
- -2024,  -4050,  -3100,   1897,   1324,   3191,   1876,   7660,
-   385,  -1066,  -1539,  -1317,  -2632,    766,     63,    389,
-  -189,   1136,   -653,    802,    755,     70, -29812,    640,
--11953,  10901,   2078,   -529,  10373,   2509,  -2776,   -104,
- -2232,    174,   -837,    158,   1507,   1963,   -273,   1534,
-  1084,   8469,   2568,  12662,  -2276,   2808,   2052,  -7430,
-   434,   3777,    991,    664,   2724,   1631,  -3632,   2099,
-  -582,   4140,    757,  11248,    540,  -1425, -10204,   1604,
-   600,  -2034,  -1060,    977,   1843,   3831,   -933,   -816,
-  2975,  -6413,   1589,   -915,   -696,   2155,   -556, -17893,
-  3348,  -1239,   1014,  -2539,   1588,   -320,   2402,  -1485,
- -8062,  -1046,  -1458,    200,   1323,    357,  -3752,   2836,
-  5774, -11638,   -913,   -648,   1676,    246,  -1277,  -1065,
-  2334,  14911,    228,    880,  -2172,   3072,  -2520,   1445,
-  1442,   2568,  -1254,    730,  -1950,   -192,  12003,  -1587,
-  2558,    714,     33,   4324,  -4642,   -231,   -279,   -255,
- 17824,   1292,   3530,   -766,    -64,    245,   1677,   1716,
-  2507,  -3594,  -3532,   3000,   1996,  -5342,  -1868,  -5642,
-   -21,   1132,  -1202,   1104,  -6543,   1242,    457,  -1711,
--32768,     49,   -458,    295,    858,   2043,   1268,  -1257,
-  -346,    793,    554,   1260,  -1082,    985,  -1453,   1704,
-  2431,  -2858,   1466,  -5424,  -8870,   4714,  -1539,   5767,
-   110,  -2568,  -1482,   -348, -11580,  -2838,   1213,   -599,
- -1591,  -3472,  -6907,   6191,   3928,   4708,   1326,  -1510,
-  6322,   3849,  -4112,   7689,   5976,  -3298,    372,  -5450,
- -2208,   6564,  -6915,    911,   4216,   1682,   -739,  -2146,
-   203,    350,   -816,    351,  -3386,  -3016, -15045, -10824,
-  -553,  -4969,    138,    256,   1672,  -1840,   2851,  15838,
-  2934,   1871,   -600,  -3293,   -845,  -2696,   1463,  -1075,
-   720,  -1177,  -1538,   2415,   7315,   -484,   1082,    962,
-   766,   -845, -10687,  -5932,  -4410,   3840,    362,    194,
- -4576,  10209,  -3548,   -127,  -1202,    246,   -734,    770,
-   311,  -3126,    772,  -2422,  -1141, -12330,    960,   1567,
-  2816,     80,  -4414,   -778,    665,   2308,   -420,   -180,
- -1242,   -423,  12138,    113,  -1477,   2899,    214,    348,
-  -927,   -764,     26,  -1127,  -2288, -32768,   1302,    394,
-   646,   -453,   -946,   -838,   1649,  -2292,   1182,  -1558,
- -6413,   -265,  -1942,  -3467,   1863,  -3526,   3446,   -863,
-   886,    202,   -202,  15706,   2226,   1763,    894,    936,
- 16191,   -693,   1682,   6678,   1742,   1365,    700,  -1765,
-  -803,    299,  -2194,   1259,    689,   1670,   -635,     28,
- 11890,    -14,   -878,  -5439,    103,  11124,    528,   1179,
-   -62,    868,   -664,    749,  -1128,   1429,   -485,   1920,
-  -866,   1176,   1051,    379, -29470,   2354,   -252,  -1648,
-  -412,   -804,   1339,   -383,   -812,    959,    893,  -1741,
-  1462,  -1868,    470,   2112,  -1889,  -2236,  -1668,   -755,
- -2562,   1354,   6183, -10964,   5651,  -1062,   2550,  -6225,
-  -194,   1687,   -782,   1568,    -85,     10,     -8,   1128,
-  -521,  -1090,  -1933,  -3441,  -2698,   3049,  -5822,  20847,
-   710,    789,  -1872,   1082,  -1242,   4152,   1624,  10795,
- -2149,   -134,   1087,    900,  -7943,   5178,  -3429, -11622,
- -3617,  -7444,   -824,   3462,   -579,   -830,   1010,  -3301,
- 12202,  -5446,  -1763,    340,   -744,   -509,    554,   1140,
- 12266,  -1328,   4652,    992,  -1931,   -708,   1074,   2762,
-  2931,   -414,   -217,  10166,  -4167,   -903,    660,   1000,
-    27,  -1037,  -1532,   1308,   8655,   9087,  -2998,   9928,
- -3722,   -556,   4812,   3062,    600,   1281,   3879,    114,
- -5404,   1869,   2174,   2083, -11631,   -301,  -3609,   2443,
-  2300,   4863,   -838,    -29,   2166,   1319,   2110,   1387,
-  -741,  -1225,  -1729, -13536,  -7376,  -1520,    619,  -4919,
-  2517,  -4338,  -1650,    475,    456,   4372,    792,   3224,
-  1963,   -547,  -2071,   2142,   -254,   1549,  -6846,   2430,
-   -96,  19844,    595,   1197,  -1367,   2019,   2014,  -1547,
- -3775,  -1186,  -9690,   -394,  -4106,  -1728,  -1036,   2945,
-   509,  14242,  -1893,  -2494,  -3004,    458,  -1753,   2628,
-  9790,   3450,  -1652,   -322,   8263,   3952,  -2156,  -2110,
-  -442,   1256,   1561,  -4913,  -3452,     74,   3051,   8907,
- -3376,    -96,  16654,    557,    520,   -446,  -2520,  -1712,
-  2151,  -2423,   3761,  -3507,    487,   2103,    777,   -416,
-   509,    468,   3629,  -3155,  11460,   2106,  -2191,  -1014,
-  1154,   9317,    704,   -282,   3098,   2722,     84,    150,
- -5922,   3063,   8373, -11896,  -1157,  -2286,  -1781,   7331,
-  1331,   -334,   -974,  -1653,    752,  -1970,    -89,  -3470,
-  2418,  -1334,   3615,  12770,   -116,   1965,  -1643,   1480,
- -2225, -10686,  -1174,    530,   -972,   -933,    719,    722,
-  1530,   -317,    105, -14155,   2569,   4506,  -8502,   -681,
- -1544,   -542,  -2814,  -1161,   -629,  -1776,  -3540,  -1366,
- -3681,   1838,  -1630,   -703,  12613, -12335,  -2020,   2173,
-    27,    315,   4766,   4590,  -1603,    -68,   1154,  -2940,
-  1198,   7884,   2502,   -586,    440,  -5124,  -2454,  -2597,
-  -826,   7401,   2803,   4552,  -3212,   2966,  -5567,    588,
-  2216,   7444,  -2633,  -5922,    434,   3423,   4084,   2296,
- 13258,   2070,  -4624,  -1226,    166,   -367,   -527,   1110,
- -1407,   -150,    140,    584,   -373,  -2649,    862,    500,
-  3292,  -3506,   -679, -20109,   1775,   -726,   3378,    754,
- -1962,  -5764,  -1338,  -3628,   -691,   4554,  -1890,  -6021,
- -6566,   2590,    262,   2509,    257,  -4386,  -2480,   6352,
- -2026,   1234,   -399,  22808,  -2221,   -626,   -714,   -339,
- -1196,   -455,    -80,    713,   1662,    474,  -2324,   -527,
-  4101, -10526,  -4617,  10492,  -1143,    805,   1360,   3796,
-   942,    684,   2596,   1313,   1589,   -570,   5476,    -27,
-  9220,  -1493,   2631,  -6726,  -2976, -14295,    137,   -734,
- -2015,    658,    323,     83,   2539,  -1230,   1714,  -2080,
-   658, -18803,   2978,    996,  -3374,    -28,  -1335,    150,
-  2154,   1069,   -852,    293,    535,  -1004,   -993,  -3692
-},
-
-.cb1616m0 = {
--16476, -11442,   -305,   -196,   -767,  -2167,     -1,    378,
- -2200,     22,   2405,    944,  -1786,   -806,    669,    952,
- 10435,  -2752,  -1625,   1060, -12314,   1283,    234,  -2405,
-   627,    798,  -1058,    311,  -2794,  -2715,     73,   -214,
-   813,  -2749,  10732,   -445, -12147,  -2507,  -1972,   1652,
- -1920,    215,    298,   1106,    826,  -7445,     69,  -1679,
-  -675,   1249,   1444,  -1109,    -48,  -1452,  -2368,   3034,
-  -492,  13068,    311,  -3446,    326,  -1426,   2384,  -2146,
-  2916,   8957,   -196,   2212,    447,   1775,   2607, -11962,
-  -278,   4335,  -1743,    135,    212,    -41,    -92,    164,
-   -11,   -504,    828,   -519,   -834,    251,   1919,    762,
- 24917,   -180,   -132,   -330,    138,    225,   1038,      3,
- 32138,   -388,    208,   -638,  -1338,   -165,    200,   -230,
-   225,   -777,  -2270,   8198,    583,   3946,  -1534,   1666,
- -1032,  11384,    202,     30,   2758,   -505,  -2815,   1265,
-    64,    -17,   -360,    636,    134,    502,    259,    872,
--28148,  -1046,   -348,    -86,   -739,     55,    448,    168,
-  -656,   1094,  -1074,   4552,   -834,   2296,   2356,   -572,
- -1917,  10979,   3127,    -52,  -9969,   -527,   1994,  -1626,
-  1041,   3310,  -2319,   2232, -11444,  -2400,  -1788,  -1254,
-  5265,   3198,   7088,   4522,   1292,   -191, -15886,   2787,
-    22,  -1610,    184,    380,    521,    336,   -158,    877,
-   468,   6515,   -756,  -5484,    100,   -464,   9244,  -2726,
- -1644,  -2741,  -5362,  -1635,    894,  -1849,  10118,  -3264,
- -4472,   1255,  -3571,   -437,  -1050,   1505, -11178,   -193,
--11513,    -24,    719,    212,  -1999,   -725,    502,  -1164,
- -1060,   -618,    -91,   -738,    740,  -2254,  -4635,   2700,
-    95,   -853,   1093, -11620,   -968,   9492,    -25,   -664,
-   367,   1105,   5501,   -112,   7516,  10286,    821,   -484,
-   204,   1425,  -3491,  -1234,  -4240,   3807,   2877,   1824,
-   423,    466,   -428,   -845,    -86,  13276,   8436,   -690,
-  -688,    574,  -2874,   -552,   4540,    926,  -5443,    629,
-  -395,   2090, -17468,    335,   2419,   1275,  -3750,  -1589,
-   470,  -1735,    330,   2532,   1094,  -6218,   -884,   -236,
- -9678,  -9945,   -447,    542,   -728,  -1922,    108,  -2193,
-  -946,   3270,   2121,   2624,   1010, -10742,   -102,   2813,
--13070,   1523,  -1532,  -1291,    420,  -1999,    262,  -1194,
- -4226,  -1450,   -275,     83,   1168,   1590,  -1517,   -426,
- -1424,    152,    676,  11463,    824,  -2092,  -1106, -11502,
- -2327,   -278,   2597,    -11,    793,   -118,    393,    580,
-  -499,   -743,    -77,   -427,   -408,   -692, -29195,   -247,
- -2014,   -922,     97,    581,   5469,  -1419,   -698,   1490,
- -3814,  -2818, -13816,    680,   3595,   1544,   2366,  -3018,
-  2479,    323,    346,   -260,    337,   2730,  12214,  -1118,
--11301,  -3028,    212,    -41,   1764,   -580,    553,   5454,
-    -8,   -366,  -1202,    901,   -796,  -8350,   4380,  -1452,
-  -300,   1152,   3058,  -3476,    -27,  13046,     34, -11438,
- -1321,  -1528,  13237,    114,   2514,    976,   -571,  -1192,
- -2050,  -1635,   -964,    416,    -23,  -1083,     -9,  32767,
-  -548,    556,  -1217,    -56,    325,   1048,   -145,    202,
-  1520,     44,    402,    400,   -611,   8667,  -1083,   1068,
-  1224, -12031,   2318,  -1109,   1266,   1306,   4673,    285,
- -5603,   1555,   -100,  -1059,    403,   -213,   -680,   -904,
- 11443,    581,  12160,   -638,    309,    -65,    933,  -2280,
-  1958,   2642,   1808,   7945,  -2088,    850,   -428,    785,
-  -989,   1234,  -1413,    745, -10756,   1943,   -184,   3252,
-   -96,    932,   -664,  13222,  11326,  -1374,   -327,   1901,
-  1069,  -1540,    104,   -139,   -904,    106,   1664,    925,
-    46,    353,   -835,   -554,   1618,   -956,   -437,   -727,
- -3403,   1038,    968,    436,     46,  -4385,    340, -16903,
-  -498,     47,   -554,   -399,  -2418,   -347,    358,  23280,
-   234,   -172,   -338,   1058,  -2172,     -1,   1710,    -64,
-  -583,  -2224,   -780,   -637,   3500,    108,   1045,    828,
-  -728,   9466,  -2487, -12773,   1924,  -1158,    208,     49,
-   136,  12055,     42,  -1381,   -375, -11534,   -249,   1602,
-   996,    204,   -710,   4761,   -511, -15761,    166,  -1184,
-  -192,     50,   -105,    890,  -9566,   2062,  -1536,    133,
-  -185,   -643,   -172,   -894,   -355,    -16,  -1395,    542,
-  2160,   -481,  -1104,   -793,    517, -20454,    698,   -181,
-  -135,   -434,   1677,   -181,   -415,   -738,  -1574,   1664,
--14058,    597, -12354,   -460,   -313,   1724,   -686,     85,
- -1162,   -648,    865,    165,   -225,  -1947,   2818,   -778,
- -4010,    402,    686,  11170,   -332,  10336,   -757,   4794,
-  2204,   -477,   -292,   -366,   8412,  -2476,    494,    510,
- 10514,    769,    642,   -441,   1079,   6954,   4246,  -2272,
-  -290,   -224,   1312,    398,   1536,   -692,    330,    157,
-  -946,   -100,  -1830,    214, -25652,   1382,  -1836,   -440,
-   110,   -506,   -438,  -2370,    126,    562,  -3515,   1014,
-  8526,  -1641,  -2493,   4411,  -9210,   2110,    625,    114,
-   323,   2450,   2407,    682,   1999,  -9424,   2480,     69,
- -2091, -11845,  -3684,   -429,  -1622,   -919,   -518,     70,
-  1450,  -3523,   5126,   5706,  -1451,   2633,    820,   -204,
- 11338,  -8014,    753,   -103,    290,   -923,   1408,    298,
- -1962,   -887,   9691,  -1366, -11048,    -55,   -223,  -1040,
-  -163,    132,    676,   -760,   4990,   -310,  -9286,  -2427,
- 14442,   -418,   -802,   -359,   -323,   2877,   -210,  -1436,
-  1574,  -1206,    265,   -155,   -225, -32768,    347,    222,
- -1165,    200,    924,   1135,   -843,    -66,   -343,   -334,
-  -113,    209,     14,   -203,   1214,   -896,    910,  -1496,
-  1831,  -7833,   -841, -10453,   1605,  -8514,   -477,    -48,
-  -241,    -58, -32768,    213,    108,    450,   1155,    -30,
-    89,    240,   -768,   1332,    290,  -1377,    951,    586,
- -8939,   1298,    496,    705,  -1661,   1798,  -1906,  -2233,
- -1716,   -986,  -2204,  -1149,   2686,   8578,  32767,    645,
-  -661,   -135,    770,   -432,   -550,   -385,   -272,    625,
-  1234,   -729,     19,   1753,   -284,   -106,   -655,    750,
-  -442,  23143,   -328,   -520,   -506,    790,  -1048,   -730,
-  -471,   -438,    483,   -374,    939,   -226,   -397,   -849,
--12054,   -772,    -40, -11776,    232,   -540,  -2497,   -679,
-   337,   1357,    458,   -341,  -7542,   1001,    492,   -416,
- -1496,  -8966,   9814,  -1752,   -674,   2526,   -544,  -2900,
- -1318,  -1578,   -238,     75,  11181,   1750,  -3182,    564,
-  -570,    528,   1004,    146,   1144,   7430,    158,   9524,
-   -36,   -340,   -441,    596,  -1659,   1420,   -686,    -36,
-  -596,   2215,  -1295, -19722,  -2149,  -1046,  -2339,  -1166,
-  3057,   -370,   -556,    -33,   -322,    260,    -23,   -106,
-  -323,    147,    -57,    179,    458,    684,  -1283,   1251,
-  1231, -18548,   -513,   -480,   -695,    593,   3072,   1960,
-   322,   -702,  -1043,   -544,   6005,   1378,    100,   -225,
-  -848,  -1294,  -3346,    828,  -2610,  -3010,   9623,  -1329,
-  1956,  -1098,  -3730,   1137,  12413,  -1260,   2457, -10844,
-  6824,  -4289,   -653,   -302,  -4415,    650,  -1684,   6129,
-  -370,   -652,  -3245,   -473,   -150,  -3018,   1864,  -1258,
-   928,  -2379,  14451,   -119,   2282,   -248,   3139,   6502,
-  4318,   2214,  -1627,    126,   -422,    326,   -622,   -302,
- 32252,   -268,    456,   -260,   -260,   -968,    391,   -497,
-   152,   1764, -10580,   -369,    277,     70, -13137,  -1114,
- -1111,    464,   2266,  -2968,    728,  -1216,   1726,   1044,
-   344, -16436,   1558,   3178,   -551,    604,    442,   -891,
-  9570,   1596,   -541,  -2182,    730,   -906,    242,    935
-},
-
-.cb1616m1 = {
-  -116,    -53, -24868,   -544,   -783,     97,   -912,  -1202,
-  -622,   -147,   -215,   -362,    -16,   -522,  -1694,   -358,
-  -724,   2628,    439, -18106,  -1566,   3048,   4133,  -1238,
- -3233,  -1130,  -2884,  -2762,   1031,  -1037,     63,  -2219,
- 10701,  -1518, -10322,   1425,    792,  -1820,    380,   -777,
- -3017,   1531,  -1052,  -3491,   1085,   -428,   -765,   -113,
-    42,   -265,    365,     99,   -859,     35,    610,     44,
-  -495,    262,   1689,   2082,  21605,    412,   -717,  -1163,
- -3285,  -5062,  -1583,    599,   -277,    -62,    615,   6014,
- -1781,    465,   -544, -14114,  11277,    -20,    696,    663,
-  1156,   -240,    631,  -2802,    333,  -2544,  -1628,    775,
-  -960,   -553,    496,   -378,    526,   -421,   -426,    290,
-   555,    403,    390, -31714,     25,    449,    654,   -334,
- -1317,    165,    496,   1554,    -88,   -777,    626,  -1511,
- -9020,  -1725,  12705,   -798,  -1240,    195,   1932,   -833,
-  -939,     43,    182,   2547,   4879,   9234,    370,   2058,
- -7757,    544,   1106,   -660,    546,   9983,    225,    124,
-   952,  -2153,  -1732,   2760,  -1270,   -176,   3334,  -6735,
-  -526,  10475,   -627,   7835,  -2263,    475,    731,    908,
-  8264,   1605,   -192,   5026,   2414,   5223,    595,   1093,
-  2345,   -796,   8663,   1028,   8188,   -185,  -1506,  -3044,
-  -100,  -1818,  -6369,   -170,   1728,  -9249,    886,  -2111,
-  -349,  -1146,   2127,  11622,  -8043,   2880,   2215,   1693,
- -2303,   1698,   1121,  -3575,   -927,   -716,   1940,   2514,
--11672,   1619,    916,     -7,   -585,    508,  -1316,   -972,
-   778,   9774,  -2126,   2368,    -56,   6716,   1169,  -3656,
- -1330,   9530, -12158,   1188, -11426,   -353,    945,  -1941,
-  1750,    962,  -1133,   1793,   2318,  -2641,   1109,    933,
-   804,    505,     60,  -1642,  -2238,  -2328,  -1558,  -1568,
-   -27,    952,      4,   1376,   -862, -18404,  -1828,   4107,
-  -454,     52,  -1202,   1150,    686,  -1950,   -497, -10883,
-   400,   -422,   1734,    -54,  11165,  -3309,   6402,   -877,
--19967,   -400,   1642,   1305,  -2432,  -3115,    375,   3898,
-  1812,  -5305,   -946,   1717,   -757,   3322,    126,    747,
-  1836,   9957,   1904,    658,  13043,  -1779,    675,    716,
-  -453,    670,  -1572,    210,  -1533,   -133,    294,    546,
--24084,  -1036,   -485,   -117,   -184,   -624,    273,   -901,
-   866,    609,  -1119,     28,    250,     13,     70,   1178,
-   882,   -632, -21624,  -1339,    926,  -1814,  -1279,   1868,
-  -181,    383,   -679,  -1070,   5091,   1148,   1034,   2144,
- -2779,  -3810,   4536,   1713,   1003,  13322,   2866,  -3217,
-  2508,   4395,    480,     14,    167,    763,    -34,   1034,
- -1342,  -1349,   -100,   -225,    464,   -914,  -1403,  -1851,
- 23767,    770,   -457,   -257,  -1072,   1201,    583,    -59,
-  2627,   1469,     -7, -11642,   3352,  -1003,     -6,  11588,
-  -311,  -2435,  -2180,  -2352,   1952,   5532,   1945,   7281,
-   504,  11882,   -603,     45,     42,  -1396,  -1115,  -1041,
- -1061,    566,  -2733,   -765,    687,    118,  -1174, -20412,
-  -244,   -986,   -151,   2888,   1102,  -1303,   -135,    529,
-  1186,  13220,   -183,    906,  -4209,  -4455,   2247,    246,
- -6474,   2794,   1450,  -6495,  -1819,    598,   -438,    244,
- -1064,   -673,   -672,  -1563,    543,  -2278,  -3087,   -811,
-  1866,     80, -18987,   -682,    569,   -551,    514,   6876,
-  7582,    839,  -4031,    823,   2342,  -1300,   1180,    702,
--10168,  -1957,    485,   -374,   -151, -11066,   -461, -12824,
- -1221,   1281,   -718,   2012,    330,   -289,   -487,   -207,
-  -722,    394,    156,  -2023, -11006,   -373,     -4,   -238,
- 10581,    991,  -1236,   -814,    553,   1295,  -2269,   2783,
- -1973,    681,   9759,   3674,  -1680, -12118,  -1340,  -2372,
-  -288,   2143,   -328,    809,    312,   2038,    736,    -10,
-   908, -11319,     74,   6362,  -1122,   1546,   -184,   1630,
- -1851,  -2143,   1048,   8858,   -462,  -6458,  -1540,    811,
-   130,  -3542, -10424,   9353,    388,   1168,  -1797,   1796,
- -4151,  -2329,      1,   -272,    846,   -642,    248,  -1144,
- -9863,  -1684,   -190,   7611,  -4147,   -692,   5354,  -2363,
-   609,  -4926,   3166,   2094,    857,   -369,    118,    725,
-  -899,   -601,     -6,    556, -32540,    950,   -478,    757,
-   136,   -560,   -754,    562,   -448,    223,   -704,    616,
-   365,  22610,   1191,  -1264,    -94,    927,   -294,  -1270,
-   -16,  -2520,  -2026,    420,  -6621,   -504,   9666,    452,
-  -379,  -1888,    536,   1161,  -3021,    609,  -4890,   -231,
-  3926,   -943,  32767,   -615,    300,    870,   -742,    429,
-   -42,    155,   1060,   -900,   -347,     34,    491,  -3625,
- -1529,  10175,    178,  -7938,   -406,   1628,   -362,  -7340,
-  -433,    489,    568,    674,    536,  -2886,  -6118,    -16,
-  -531,    182,   1498,  -4194,   -306,     63,  -1429,   1109,
-   631, -10386,    -16,  -5938,    -52,  10638,   -793,     35,
-  -874,   1633,   -252,    709,   -286,   -780,  17172,    -32,
-   912,    137,  -1684,   2781,  -5637,    338,  10961,   1401,
-   176,   1890,    563,   -371,    578,   -235,   -882,   -616,
-  -591,   -672,   -821,  12194,    917,    778,   -427,    358,
- -1411,   2032,  -1372,   1891,  -1784,   1830,  -1808,   -464,
- 13973,   2016,   8606,   -914,  -7329,  -1853,  -2627,   2219,
-  2628,   2161,   2185,   2414,   8857,   -273,   1016,   2253,
-  1070,    907,    367,   -430,    574,   1039,     93,    170,
-   255,   -267,    550,   -668,    287,   1827,  19833,    244,
- -3731,      4,  21365,   -127,    356,    643,   2016,   3290,
-  1242,     46,   -734,  -2298,   -316,  -6618,   -296,  -1465,
-   657,  -1451,    469,    212,   2823,  -2803, -11862,    931,
-    44,    660,   1576,   1848, -10529,   2813,  -1163,   -260,
-  -195,  16320,  -3447,   -262,    -76,   -439,  -3487,   1292,
-  3330,   -616,   1477,   1900,   8843,     81,   -846,   6845,
-   -95,   -112,   -231,    129,   6982,    165,  -3115,   2456,
-  2032,  12201,   2747,   1691,   -728,  -1935,   -239,    968,
- 15578,  -2260,  -1813,    440,   2188,  -3845,   1278,   -136,
- -1388,  -7850,   -462,   2921,  -1740,   -136,    164,    103,
-  -206,  32767,   -459,   1249,    736,   -590,   -797,    628,
-   612,    327,    396,    552,   -128,    -76,   -258,   -557,
-   429,    170,    532,   -347,    169,   -593,  28319,   -633,
- -1339,   -997,   -258,    324,    628,   3254,  -1118,   8902,
-   -63,   4762,  -2820,   2429,    820,    -46,  -5366,  -2193,
- -9005,  -1304,   -597, -10143,    555,  -3000,    294,  -1577,
-  -871,   -140,    726,   3700,  -2226,    903,   -253,  10330,
- -2946,    656,    725,   -668,   -920,   1653,   1312,   1623,
- -1150, -11970,   2157,   4532,   -340,  -8648,   -616,  -1429,
-  -980,    -30,    647,   -474,    442,   5098,    188,  -1258,
- -8172, -10927,  -4207,   -112,   2501,  -3241,  -1949,    159,
-  -525,   1090,    420,  10418, -11897,   1072,    -78,  -1028,
-  3367,  -2647,   3421,   2021,   2358,   -973,    272,  27911,
-   472,   -402,   1397,   -927,  -1032,  -1274,    848,    221,
- -2745,   -710,   -692,   -409,   1922,    142,    594,   1053,
--11350,   -791,   3767,   1569,    541,  11921,    134,    368,
-  -948,  -2689,    896,  -1193,   1190,   8514,   1436,   1017,
-   599,  -3358,   4002,  12936,   -675,   1044,  -1210,    296,
- -1109,   1992,   1282,    774, -13102,   -608, -11145,    134,
-   278,    944,   -888,    350,  -1574,    189,  -2542,   3476,
- -3018,   3368,  -9304,  -1839,    533,     -2,   1057,    686,
--11819,  -1146,   -973,   1594,   3526,  -2890,  -1528,   3489,
-  -475,   -259,  -9610,   -475,   -984,  -3559,   -742,    408,
-  -130,  -2291,    899,  12177,  -1934,   -162,  -3238,   1610
-},
-
-.cb2220l0 = {
--12528,    350,   1782,   -474,   1439, -14269,     -8,  -1782,
-  -753,  -1720,    167,   -440,  -2706,    222,  -1629,   -288,
-   671,   -111,  10270,    878,    152,    330,  -1000,    639,
- -1280,   1111,  -2072,   1439,   -476,    553,  -2974,   -614,
-  1666,   -466,  11811,  -1393,    154,    624,   -697,    176,
-  1108,    504,    250,    572,     -6,    704,     16,    647,
- -1143,  -1407,   -411,  23745,    319,   -189,   -404,   -641,
-   -86,   -707,   -770,   -302,     13,   -398,     76,   -681,
-  -525,    354,  -1225,   -757, -23170,   -484,   -965,   -430,
- 13477,    898,    505,    -17,  13812,   -890,    357,    662,
-  1000,   -935,    -60,    944,    400,   -432,   -221,   1047,
-   307,   -180,   5260,  16509,    650,   -269,   1563,  -6002,
- -3082,    186,  -3334,  -5770,   1010,   -394,    128,   -699,
-   537,    -27,   1014,   -531,    -50,   -163,  -1664,  -1026,
-   732,  -1296,  21856,    574,    416,   -745,   -443,  -1382,
-   272,    791,   1308,   -308,  -1636,    168, -10922,    119,
- -1190,   1123,   1492,   1706,   1076,  -2016,   3270,   -994,
-   876,  -2316,  -2992,  12625,   -412,   -159,   5249,   1424,
-  -304,    557,   -431,   -360,   -340,   -561,   -292,   1748,
-  -224,   1789,   -352,    386,    136,     76,   1309,   -270,
--24204,   -515,   1142,   2119,   1144,   -173,   1008,   -693,
-  -430,  -1052,   1890, -12483, -11416,   2918,   1591,  -1202,
- -1782,  -1335,   1354,   1703,   -510,   4287,   -854,   1153,
-  2018,   -518,   -960,  11825,   1295,   -563,  11252,    190,
-  4078,    222,  -3115,   3306,    747,   2638,   1015,  -1674,
-  8032,  -2386,    573,   -349,   -832,     96,   9564,  11708,
-  -483,   1326,   1804,  -2903,  -2024,   -234,   1009,   3229,
-  -232,    803,    275,    444,   -629,   -192,    381,  -1289,
-  -109, -29019,    270,   -420,   -408,   -466,    113,   -537,
-  -266,    296,    180,    506,   1015,   -565,   -517,   1494,
--11053,   3968,  -1735,   3474,  -1991,  -8326,   8075,   1740,
- -3995,  -1287,  -2558,   1030,   3742,   -618,  -2600,  -1783,
-  2696,   1480,   1054,    341,   3762,   4225,  -1742, -11582,
-  4348,  -8756,    493,   -404,   3840,  -1049,   -683,   -962,
-   163,  10997,    -97,   -848,  -4632,   2794,   2684,   2540,
-   739,   8534,   3688,   -878,   3138,   2576,   6444,   3674,
- -2371,   -218,   2864,  12270,   2866,    189,   4549,   4894,
- -6378,  -1050,  -3166,  -5897,   2245,   2803,    -70,  -1909,
-  2783,   3951,    153,  11221,   -658,  12780,   -238,   3418,
- -2235,    754,    311,   -739,  -2414,    702,   1076,    303,
-  -320,     47,  -3288,   -234,  -1376,   3022,   -103,  -1780,
-   716,  11886,  10942,  -5402,  -5431,   1196,   -624,   -885,
-  -652,  -3248,     74,   -435,   -686,    154,   8675,   3325,
- -1779,   -341,    564,   -901,   1335,   -639,   3494,  -1820,
-   290,    -92,  -3088,   4775,  -2140,   2334,    710,  10536,
--15042,  14823,  -1082,  -1045,   1008,    734,    241,  -1048,
-  -933,    245,    913,    114,    322,  -1798,    246,   1067,
-   348,    408,   -183,   -728, -12915,    685,   1525,   1694,
-   183,   -168,  12703,  -1268,   1613,  -2072,   1546,    743,
-  2356,   2135,   -550,   -153,   1327,      2,  12487,  -3111,
-  2347,  -1722,   -300,   -193,   2222,  -1928,   -658,   -384,
- -5738,  -1141,   3634,  10312,    -69,  -1549,  10879,   1795,
-  -361,  -1838,    143,   1202,    327, -15549,  -1268,   -194,
-  3284,    -12,   -344,  -2042,   1663,    334,   -798,   -873,
-  1736,   -324,    195,   -417,   -382, -22936,    812,   -478,
-  -962,   -451,    730,    382,   -135,   1311,   -290,    122,
-   148,   -775,   -305, -32218,    -84,     98,    374,    369,
-   -44,    923,   -432,    156,  -1471,    236,    -39,    143,
-  -146,    835,    135,    229,   -297,   1690,   6786, -12169,
-   815,   -176,   1868,     -9,  -3052,    108,    114,    260,
- 11337,  -2689,   -132,    765,   -239,     54,    691,  -9737,
-  -627,   -474,  12212,   2222,  -7595,   -239,   1793,   2115,
-   563,  -2390,  -1991,   2906,    675,    923,    146,  -3605,
-   981,  -1725,     92,   -562, -21192,    304,   -450,   -323,
-  -889,   -726,    688,  -1186,   2590,    466,    326,   -734,
-   308,   -782,  -3219,    963,    454,   1348,   -513,    953,
- -1414,   -320,   1012,  -1148,   1185, -17356,    -15,   1546,
-  1346,   2182,  -2457,   1426,  -1690,    155,   8793,   1394,
-   510,   2608,   -203,   2697,    608,   2612, -13542,    177,
-  4642,   -824,   1877,  -1864,   1681,  -1033,   1487,   -749,
-   356,    -11,     -1,   -366,   -215,   1531,    -38,   -922,
-  -378,   -296,   1245,  19967,  -2389,   -459,  -3729,   -163,
-  6578,    354,  -1471,    195,    353,   1831,   -605,  -2291,
-  -359,    947,   8409,   3454,  12416,   2434,   3485,     40,
-   350,   1640,    738,  -9827,    935,   -171,   -944,   1407,
-  -399,    571,   2805, -13108,    784,    678,   2405,    328,
-  -417,   1188,  -1596,   -649,  -1358,  -1130,    341,    202,
- -2459,  11307,  -2250,  -3518,  -1812,   3338,   -924,  10027,
-  3004,    703,   -184,   -666,    223,  -1644,  -7221,   3507,
- 10108,   1324,   -412,   -371,    -92,   2496,   3182,     10,
- 10269,   -998,  -1010,    610,   3296,  -1842,    407,    406,
- -1609,   -181,   2202,   -662,  -1450,   1360,   1488,   -212,
-  1501,   -214,   -555,    168,    275,    301,   -950,   3272,
-  -323,  20632,    -21,  -1729,  11013,   2149,  -9278,   6735,
-  -593,  -7374,   -430,  -2776,   2343,  -1374,    519,  -4876,
-   827,  -2477,  -1971,   1249, -23380,  -1810,    199,   -761,
-  2182,   1654,    447,   -488,  -1219,    364,    -53,   -382,
-  -989,    154,   -545,   -872,    776,   -211,   7706,   -767,
-  8006,   -138,   1989,   -180,    306,    486,   1112,   -648,
-   -12,   1538,   -300,   2458,  -5833,  -1181,  -7680,  -6700,
-  -621,   -308, -29995,    602,    -24,     94,    752,    517,
-    86,   -249,   1058,    704,   -404,   -387,    106,   -632,
-  -159,   1275,   -197,  -1263,  -1210,  -1689, -10488,   1950,
- -2037,   5974,  -3960,     38,   1284,   2851,  -2813,  -1613,
- -1646,  10164,    138,  -2956,    196,   -118,   -484,    860,
-   124,   -262,     30,  -1448,    128,    287,    327,    590,
- 27272,    391,   -738,  -1631,   -481,  -1511,     82,   -574,
-  -737,   -614,   -447,    -80,    292,    -19,    252,     -2,
--28117,    332,    141,   1485,   -154,   1382,  -1755,   -422,
- -1692,  -2144,    910,   1004,   1894,  -1537,    897,   -458,
- 19483,  -1321,   2280,    622,    288,  -2253,  -1001,   -976,
-  -408,   -394,    132,   -250,   -428,    -22,    140,    287,
-  -141,  30981,   -293,    631,    729,     -2,   -231,   -127,
-   377,   -879,   -294,   -107,    253,   -964,   1258,    570,
-    71,   9421,   8358,   9295,   8354,   -546,   1153,  -1807,
-  1577,   2911,  -1808,   1808,  -1631,  -1348,  -6977,   -382,
-  1625,  -2793,  10633,   1977,  -1793, -12480,      1,   2010,
-    23,    423,   1102,  -1920,   -478,   1845,   1016,    465,
-   758,    800,  -1540,   5448, -10472,  -2749,   -989,  -6362,
-  9283,    373,  -2560,  -5478,  -1618,     20,   -564,  -1074,
-  4075,   -471,   -515,    409,  -2069,    359,   -788, -11618,
-  2524,    917,   2757,    243,  -3261,   6922,   6268,  -3148,
- -2804,  -3412,  -4262,  -1903,   1043, -12255,   -162,   1598,
-   496,    454,   1401,  -1635, -12711,   -673,   3392,   1255,
-  1602,  -1206,   -297,  -2066,   3009,   1149,   1285,  -1307,
-   412,  27971,    183,    569,   1304,   -706,    824,   -635,
-  -358,   -340,    -28,  -1344,    955,     14,    676,   -243,
-   -20, -11947,   1350,   8122,    196, -10161,   4925,  -3764,
-  1661,   -401,    145,    253,    680,    718,   -614,   -613,
-   498,   -293,  -4257,   -684, -14853, -10522,    698,   1537,
- -2016,   1162,  -2684,  -1578,      8,   -238,  -3214,  -2749,
- -1577,  -1187,    113,  -1457,   1068,    590,     25,   -644,
-  1000,   2430,  -1612,  13246,  -2684,  -1642,  -4648,    816,
- -1103,  -7556,   5753,  -3998,  -1338,   -776,  -1958,  -9652,
- -1288,   -290,  -4240,  -2788,  -8191,   1625,   2558,   1238,
- -1824,    -39,  -3129,  -8916,  -3302,  -5632,  -1768,    866,
-   708,    684,   3530,  -8772,   1485,    677, -10398,    686,
-  -852,  -6974,   5286,  -2658,    612,   1180,  -3367,   4285,
-  5708,   1416,    166,   2787,  -3697,   1431,   1648,   7942,
-  -544,  -1064,   -514,   -840,   -870,   1246,  -3582,  -9310,
- -3802,   4025,  -8251,   5978,    132,   -619,   2792,   9786,
-  1244,    242,  -1948,  -4701,  -5904,    951,   7486,  -3494,
-    48,  -4468,  -2403,   6090,  -2343,  -4175,   1336,  -2546,
-  -281,   -736,  -1758,  -1720,  11066,   -918,  -1354,   3885,
-   -33,  -4116,   1246,   -218,  -8082,   -766,   7796,   1505,
-  1559,   -964,   1741,   -454,  -1628,   -762,   3034,   -804,
-  -888,  -9682,   9603,  -2556,   2874,  -5456,   3066,  -7747,
-   956,   -660,  -1538,   -381,   -760,   1747,    547,   -517,
-  -697,  -1411,    410,   -514,  -3988,   -219,  13358,  -2393,
-  -280,  11230,   2640,    795,   2534,  -8094,  -1838,     71,
-    16,   -203,   4224,    -96,  -2829,   2010,   1961,  -1312,
- -1266,   3952,   6894,   6996,  -8062,   4708,   1193,  -3439,
-  1549,    935,    170,    614,   -868,     43,   -246,   -188,
-  -940,    130,    126,   -736,    697,   -510,    -56,   1596
-},
-
-.cb2220l1 = {
--13582,   1049,  15596,   -101,    707,   2677,    542,   -522,
-  -636,    194,  -2361,  -1252,    524,    -32,    227,   -419,
-  -652,   -601,     84, -10428,  -1417,  13117,   -573,   3774,
- -3632,   2025,  -1237,   -692,  -1486,    192,   1221,    452,
-   436,   -764,  -2636,   -153,   -685,    118,   -424,   -635,
-  -458,    209,   -577, -12042,   4240, -10861,     49,  -1534,
-  -991,  -2416,   -280,   2095,  -1841,   1278,    -94,   -423,
-  -572,   -949,    734,  -1087,  12449,   6514,  -4582,  -7845,
- -3722,   1446,   2531,  -1238,  -2070,   1515,  -1331,   2382,
-  1066,  -1298,  -1189,   6811,  -1868,  -1082,  -1732,    356,
- -2622,    493,  -3345,   1367,   1737,   4497, -14734,  -1350,
-  -354,  -1340,   8478,  -1152,   1832,   1793,    830,    974,
--13918,    522,  -1472,  -2502,  -2625,   -157,   -360,    -17,
-  -830,    673,     36,  -1339, -14860,    522, -13377,    851,
-   937,  -1103,    -44,    408,   -364,   -953,   -392,   1837,
-  2342,   1236,    111,   -218,   -919,    985,  10077,  -1065,
-  1840,   -124,   3780, -11015,    204,    437,   -830,   6712,
- -1720,    288,   -991,   1094,   5647,  -1296,  -2284,   1642,
-  1000,    -35,   -115,    208,   -244,  -1099,   -832,  -2092,
-   802,   -163,   3343,   -964,    314,    126,  -1204,    754,
--17838,   -826,   4414,   8331,   -770,   1246,  -3500,   1680,
-   833,   -108,    494,   -910,  -6314,  -2832,   2553,  -6230,
-  1165,   3631,  -1717,   2404, -32768,    520,    -38,   1228,
-  -708,     58,    260,    771,    588,   -448,    389,    156,
-   606,   -830,    400,   -488,   -188,    536,  -1428,  11982,
-  -156,  -1407,   1796,   1036,    905,   1371,  -1472,    325,
-  3098,  -1436,   6449,   2105, -11183,   1632,  -1848,   1019,
-  1247,   1308,  -1351,   -823,   1679,   -651,    978,    296,
-  1088,   3965,  -1414, -11838,    139,   8664,  -3452,  -1804,
-  3088,  -2044,   -221,  -1347,   1232,   -909,  -1323,  -1409,
-  1399,   2557,  14552,   1535,  -5088,   1699,   1012,   3333,
-  3940,   2294,   1189,  -2256,   -484,  -3307,  -1333,    464,
-  -305,   -744,    -24, -20464,    332,   2968,    308,   -649,
-   292,   -402,   1226,  -2575,  -1505,   -100,   1413,    733,
- -1024,    616,   -121,   -322,     67,   -161,   -708,    251,
-   462, -26697,  -1112,  -1381,   -324,   -286,   1091,    662,
- 15830,  13124,  -1049,  -1816,   -355,   1848,   -801,  -1710,
-  2513,    458,   -798,    386,   -726,   -356,  -1240,  -1133,
-  -388,    631,     91,   1867,   2511,   -306,   3097,  14399,
-  -571,   2191,  -2916,   2850,    761,  -2442,    698,  -2193,
- -2739,  -1914,  -4077,  -4631,  12702,    333,   1162,  -6248,
--12466,   -310,   -107,  -2465,   -163,   1970,   -998,  -1253,
-  2007,     79,   -426,   -276,    365,    568,   -520,  23642,
-   276,   1059,    184,   1081,    650,   2286,   -191,    883,
- -1946,    246,     64,   -225,    800,    910,   -136,   1187,
-   955, -15604,  12847,   -747,    874,    506,   -646,   1920,
-  -449,   -321,   1152,   1341,   1653,    341,    -32,    907,
-   673,   1045,   1245,   -499, -10331,   4683,  -1121,  -3164,
-  3382,   6397,  -1341,   -769,   1186,    229,  -1354,  -7370,
-   155,   1858,   5617,  -3487,   -247,   -783,    724,    508,
- 14029,   -528,   1853,   1572,    580,   -708,    528,  -1394,
-  8922,   2284,    550,   3084,  -1726,  -3235,   -700,   7132,
- -3540,   -200,   3288,   -815,  -2189,   1232,   2412,   2088,
- -1101,  12592,    806,   1508,   1741,     13,   1124,  -3883,
-  -687,  -8180,  -3094,  -3346,   1781,  11836,   -657,  -3469,
-  1429,  -1822,  -3433,     87,   3871,    651,   -965,  -1757,
-  6778,    109,    112,   -131,    710,  11943, -12107,  -3460,
-  -726,   1002,  -3803,    580,   2756,  -1293,    116,    457,
-   581,   3834,  -1678,   -977,   1242,  -2040,    232, -10034,
-  1644,  -2290,   1368,    172,  -3012,   1423,  -2620,   3608,
--10831,   -303,  -1610,   3246,    562,   5212,    448,   -877,
-   954,    688,  -8981,    579,    717,   1315,   -952,   6817,
-   662,   3218,   7213,  -2116,  10446,   1012,   2270,   -858,
-    10,  -1066,  10618,   6108,   -547,   3221,   -893,   3888,
- -1088, -10085,   -247,   1064,  -3500,   3123,  -2480,  -2128,
-  2788,  -2253,  -9756,   -472,   -166,   -680,    727,     74,
--14151,   -189,  -1734,    610,  -1169,    845,     94,   -786,
-   394,   -581,    500,   1981, -10940,    354,    500,    399,
- -1952,   -373,   2197,  -4712,  -2582,   2751,    654,    613,
- -1254,   1406,   2056, -12518,   1583,   -582,   4834,  -1541,
-   508, -20580,    270,   1214,    515,  -1082,      5,      7,
-  -533,    -28,   1270,  -1307,    497,    -57,   -331,    933,
-    92,   -856, -10458,  -4576,  -9991,   2426,   6552,  -3022,
-   279,   -562,   -192,   1878,  -2237,   4978,  -1753,    332,
- -1462,   -853,    238,    478,   9746,  -7385, -10290,  -8278,
-   457,   3121,    841,     48,  -3745,  -1298,   -637,  -1820,
-  -468,   -248,   1400,    394,   -125,   -950,  11524,  -1860,
-   426,   -773,  12669,  -1620,   -158,   1625,   1045,    768,
-   -66,    -12,   1625,   -770,    559,     54,    593,  14468,
- 14994,    490,    543,   -811,    700,   -277,    900,   -178,
- -2000,    475,    241,    950,    106,  -1260,    874,   -862,
- 18907,  -1947,   -844,    205,   1253,    -83,   1966,   2300,
- -2694,    852,   2450,    661,   -334,   -518,  -1136,  -2377,
-   325,   1152,    511,    881, -22205,    898,    574,   -582,
-  -265,  -1362,   -253,    -40,   -780,  -1967,    469,   1484,
-  -818,   -926,    958,   -415,  -7934,   -330,    330,   1439,
-  1643,     77,   1034,   -156, -12094,   3782,  -5725,   -520,
-  -598,   2345,   3506,   5333,   -322,     99,    -48,   1490,
-    20,  11393,   3468,  -1144,   7013,  -3728,   7145,   1432,
-  1810,     26,   -912,  -6530,  -1079,   1771,     95,   4007,
--11346,    -43,    249, -14616,   -249,      1,   -725,    244,
-  1053,   1815,   -626,    408,   -344,   1972,   2222,   2288,
- -2324,   -411,  -3993,    494,   -706,  -5078, -11695,  -3645,
- -2090,   2465,   5893,  -5096,   6815,   -537,   5003,   1258,
-   185,  -1555,   -875,  -2047,   -170,   -433,   -194,  -1020,
-   349,   -724, -31811,    197,    251,   -418,   -222,   -618,
-   278,    554,    363,    183,   -898,     14,    350,    745,
- -2054,  -1623,    806,   -770,  -1246,   1594,    -54, -18501,
-  1516,    840,    -86,    484,    514,   1209,    978,    564,
-  -537,     34,   -431,    128,    938,  -1807,    832,    -90,
--29509,   -642,   1397,    -52,    523,   -393,    216,    908,
-     9,    -63,    710,   -949,      3,   -184,    175,    613,
-  -687,   -408,     27,   -855,  18258,   1282,   -948,   -219,
-  2374,   1668,  -4567,   1063,  -2045,  12026,    461,   3074,
-  1050,  -1788,    169, -13442,    612,     19,  -2019,    685,
-   452,   -152,    299,    310,  -2327,    348,   -215,   1634,
-  -201,   2162, -10300,  12452,  -3733,   -420,   2388,    518,
- -2308,   -160,   1552,   3347,   1650,   3293,  -1108,   2065,
--12618,     20,    -42,   -643,    202,  -1298,    251,   2489,
-  1322,   2362,   3698,   -190,    592, -12484,   -937,   2072,
-  1531,    302,   -409,   -899,  -1016,   -388,   1103,  30006,
-   789,  -1609,   -548,  -1002,   1055,    605,   -955,   1557,
-   452,   -623,    810,    597,   -696,  10628,  -1174,    606,
-  2628,   -553,  -2297,   6668,  -2600,    787,   3504,  -3606,
-  4087,   1052,   6276,  -7619,    337,   2565,    -13,   1205,
-  -124,   1222, -28082,    -79,   -553,    628,    542,   1315,
-  -609,    322,   -895,   -377,   -694,    610,    239,   -152,
- -2901,   9890,    716,   1030,  -3306,    988,   -738,    562,
- -2209,  -1676,   4507,   1165, -12924,    866,   -154,   3664,
-  -367,  -2580,  -7286,   -572,   2167,    118,    508,  -4429,
-  -480,    842,   2489,  -1636,  -2042,   1125,   1847,   2586,
- -5639,   3361,   -760,  11189,    623,   -282,   1353,   -279,
-   515,   -816,    713,    322,    417,  -2820,  -1114,  -1563,
-   401, -21604,  -1300,   -972,  -2298,   -483,   2176,   -830,
-  2135,  -4084,   1095,   1950,  -1937,    539,   -374,   3197,
-   682,    472,  -1368,  -8095, -12026,   4833,   5586,    467,
-  2400,    148,    381,   -138,    954,   -459,   -724,    970,
-   156,  -1955,  -1363,    560,   -761,  -1708,  -1599, -17408,
- -1064,  -1372,   -500,   1160,    735,    441,   -773,   -228,
-   420,  -1128,    260,    930,  12879,   -926,   -231,   1355,
-  -850,    559,  11377,  -1729,   2478,    961,    336,   1056,
-  5081,   9788,   -555,   4067,   8664,  -2720,  -1462,   3012,
- -7280,    965,   1462,  -4703,   3649,   2084,   -699,   -262,
-   408,   -188,   2193,  -2216,  -4509,   -736,  -1039,  -4848,
- -8243,  -7958,   -172,  -1318,   9566,   4665,   3363,  -3672,
-  1581,   -551,  -2024,   1630,   1543,     90,  -1728,   -792,
- -1799,   2571,     80,   -412,   -301,  -2870,   1796,  -5327,
-   111,  17342,    592,  -2108,    477,   1541,   1266,  -1062,
-  -215,  -2210,    223,   1215,   -197,     87, -18340,    -67,
-   804,   -398,   -118,  -3457,   -741,  -1935,   -704,   -274,
-   566,   -872,  -1821,  12874,   5057,   2069,   1742,  -6205,
- -6115,  -1614,   -294,    187,  -5210,   1734,  -1466,  -2162,
- -2266,   -642,   -148,    440,      2,    233,   -319,   -637,
-  -734,   -230,    301,    508,   -433,    311,   -313,  -1206
-},
-
-.cb2220s0 = {
--15119,   7508,   1337,   4182,  -2914,  -3733,   2686,   -470,
-  2249,  -3901,   1444,   3805,     99,  -1771,   -354,   -903,
- -2755,   -709,  -4980,    214,  -2750,   -652,  -1042,   1434,
- -1090,   -612,  -2574,   1274,   1310,   -760,   1420,   -112,
-  2776,  -4843,  15060,  -4929,  -3942,  -5721,  -1628,  -1142,
-  3023,  -1435,   1402,   1010,    623,  -3527,   2624,    184,
-   988,     98,    340,  16676,  -1262,  -1162,   3183,  -4816,
-  -592,   1019,  -1406,  -2478,   2371,  -1004,   3944,    803,
-  5665,  -2261,  16427,    349,   3113,   -916,    442,  -1754,
- -3551,  -1351,   1563,  -1316,    532,    343,   -392,   1509,
-  -717,   -122,   2462,   -929,   -185,   -683, -18780,   2682,
-  -123,    518,   -379,  -5160,    245,   1940,  13964, -12311,
-   590,    -30,    159,  -1558,  -1940,     36,  -1528,   -515,
- -1178,    856,   -395,     29,  -5854, -12943,  13286,  -2572,
-  1049,    768,   3292,  -3921,    -52,   -462,   1968,   4933,
-   630,    930,   1026,   2606,    319,   -277,   6333,  -2119,
- -4700,   2164,   1583,    154,   2107,  -1467,    339,    634,
--17240,   -595,  -3525,  -2690,  -1788,   -476,    -41,    165,
- -1016,  -1456,   -348,  11289,  -2920,  -3804,   2357,  12012,
-  3848,   1796,   2164,  -5555,   4527,   -201,    965,  -4893,
-  3419,   6441,   1691,    -77,    348,   -769,  27319,   -345,
-  -336,   -541,   -320,    972,    926,  -1026,   1052,    702,
-   224,     76,    742,    220,   6292,   8625,  -3742,   4139,
- -5989,  -5615,   -641,   -231,   -837,   6156,   4141,   3792,
-  4746,   9972,   1800,   -397,  -2237,  -2218,  -7595,  -2761,
-  -496,  -1451,   1178,   -970,  -1226,   2527,  -2105,   1778,
-  1446,   1986,   9970, -13107,   -985,  -1142,  -1367,   -329,
- -4498,    590,     36,   2073,  -1069,    862,    133,   2516,
-   -27,   4494, -11602,  -1638,   2524,   1449,   5684,   -611,
- -9452,  -2618,   5006,   3481,   -639,    379,  -2333,   -498,
-  -713,    382,    784,    269,  -5692,   -350,    524, -18705,
- -1042,  -1349,   1210,   1770,   3964,   4908,  -1131,  17535,
-  -788,  -1896,     30,  -2682,   1044,   1604,  -3740,     18,
-  1771,    331,   4279,   2634,   -368,   -447,  -6995,  -1224,
-  -688,  -5368,   -236,  -8872,   2449, -12189,   4465,   1895,
-  2484,   1315,  -5446,   -457,   -575,    101,   2356,  -1585,
-  3204,   -104,  -7244,  -1678,   -801,  -2620,  -4603, -11876,
- -1787,   2962,  -1796,  -3385,   -411,   5796,   2900,   -562,
-   835,    293,   7127,   4939,    721,  -2972,   -482,    121,
- -2694,  -2277,    412,  12770,   -342,    718,   3306,    502,
- -7281,   -307,    552,   7158,   3289,  -5051,   5230,  -1185,
-  3024,   -942,  -1347,   -283, -13937,   -208,   2576,   -906,
-  1848,   5692,  -2434,    175,   7837,   1872,  -4536,  -3341,
-  -957,  14787,  -1598,   9058,   3776,    407,  -1734,   1259,
- -3011,   -131,  -3589,   -614,    272,  -2968,  -1611,   3645,
- -8126,   2120,   4868,  -5462, -13235,  -3452,  -6077,   5064,
- -1593,  -1395,  -2427,  -1139,   -958,   1585,  -1330,   2178,
-  -778,   3545,   2836,   7712,   5993,   -432,   3575,    929,
- -7951,    115,   2180,   3904,   -193,   1556,   -252,   -913,
-  2574,  11948,  -4525,   1391,  -8513,   4540, -12815,  -3379,
- -4676,   1838,  -5676,   1321,  -6168,   1397,   1020,    438,
-  -141,   3424,    392,   -512,  -1614,  -1396,   -318,  -2451,
-  1545,  -7132,  -1763,   -424,   3575,   -828,  19216,   1978,
-  1624,  -1969,  -1667,   -772,  -2031,   -781,   1732,    244,
-  -212,    416,    900,  -8960,   1002,  -1077,   4667,  -3527,
-  1586, -13109,  -2442,   3829,   4358,   1056,   2960,  -1087,
-  -662,   4775,  -6316,   6157,  -3736,  -2040,   -187,    904,
-  1254,   -636,   2032,   -734,  -1271,  -2691,   3376,    564,
- -7769,  -5482,    840,  14171,  -5828,   -966,   1685, -10192,
-  -388,   -434,   3706,    594,   2188,    365,    209,    298,
-  1825,   -236,  12762,   1644,   3199,   -468,  12876,    130,
- -2169,  -3406,  -3571,  -4655,   2339,  10757,   1292,   2920,
-   289,   -314,   -591,  -1631,  -1778,  -1296,   -254,    469,
- -9408,   1154,    334,     -4,  -1922,   2787,    317,    416,
- -1703,  14075,   1601,    638,  -2260,   -973,   -824,   2816,
- -2954,   3282,  -3716,   -882,  -3447,   3058,  -6701,   1233,
-   177,   3579,   3508,  -3539, -10511,   7507,   7608,  -1928,
-  2482,   -719,   2278,   5167,   9828,  10572,  -3635,  -2750,
-  3407,   -116,   3343,  -3432,  -3375,    982,    903,  -3239,
-  -444,  -1574,   -333,   9613,  -1914,   -532,   1879,    -78,
--17944,  -7029,   1586,  -3122,    360,   -401,   1219,  -2086,
-  3066,    878,   5780,   -948,    102,   1952,    418,   -416,
-  1002,   1380,   1297,    -92,   -640,   -555,  -1159, -28517,
- -1757,   -696,    124,   -618,   1590,    300,   -598,    924,
-  -190,  -1734,  -4196,  -5345, -14068,   5971,   8293,  -3878,
- -1448,  -1777,   -174,    921,  -1555,   -866,    560,    232,
- -1914,  -4002,   -772,   1960,  -4945,   3424,   6492,   3675,
-  -800,   5346,   4404,   -639,  10697,   1631,  -1446,  -4469,
- -7804,   3721,   4824,   -620,   1099,  -2956,   5175,  -2453,
- -4894,   2562,  -1842,   4940,   1391,   2818,   1095,  -4285,
-  6469,  -1966, -14564,  -2232,    592,   5570,  -2682,   2651,
-  4678,  -7444,  -2387,   6812, -12757,  -5664,    -42,    134,
- -2861,  -1780,   -158,   1410,  -4990,    673,   2083,  -2639,
-  3019,     -2,   8305,  -1981,  -2114,    -54,   2892,   1659,
--14913,    -74,  -1092,  -1187,   2465,  -2218,    791,   -608,
-  3077,     26,  -1096,  -1692,   3234,  -7116,  -1835,  -5244,
-   398,  10137,    698,   2298,    498,   7060,   6430,   1393,
-  2540,    487,  -1534,  -1926,  -5139,   3425,   4533,   5067,
-  -535,   -924,    938,  -1799,  16120,   2037,  -3727,   -821,
-  2986,   2314,   -223,   1358,      9,   2697,  -1806,   -940,
- -3630,  -1843,  -2776,  -2246,    580,  -1678,   2427,   2126,
- -1935,   2956,    849,  18234,    638,    342,   1036,    249,
-   -24,   2713,  -1973,   -134,  -4469,  -2014,  -6162, -19776,
-   703,    -50,   2295,  -2294,   1971,   1179,   1014,   2374,
- -1480,   1513,    630,   1542,  24716,   3534,   2926,    662,
- -2886,   -521,   -348,    402,   1112,   -371,   1587,   1822,
-  1880,   1284,    302,   1873,   1284,   -924,   6420,   4650,
-  7986,    427,    361,  -8276,    304, -11911,  -1305,  -2018,
-   189,    258,    839,   -942,    479,  -3162,  -1195,  -1138,
-  1560,  -1850,  -5304, -10132, -10533,  -1301,  -3147,   -680,
-    56,   4260,  -6867,  -1350,  -1094,  -1385,   1831,     -2,
-  -941,   3740,   7701,   -855,   3304,   3444,  -4467,    269,
- -4092,    588,  13957,  -1566,  -3561,   1936,   2816,   2982,
-  1804,   2710,    419,    685,   4468,    488,  -9520,  -2738,
-  3974,  -9978,  -1681,  -2418,   2340,   -717,   -899,  -2855,
--10470,   1030,  -2346,  -5555,   2559,   2180,  -5324,   1832,
- 10294,    342,  11318,  -2376,  -3904,  -1524,  -3806,   1078,
- -1896,   7199,  -3522,   1364,   2291,   -911,   -156,  -4327,
-  -778, -30451,   -577,   -158,    560,   2749,    799,   2689,
-   337,   -301,  -1218,   1243,    687,   -880,   -419,     40,
-  -280,      4,   1834,   9908,   1953,    408,   1080,   8777,
-  3861,    552,  -6906,  -3546,  -6666,     35,  -1903,   4788,
-  5080,   2865,   -233,   1031,  -4519, -13752,  -2417,  -1742,
- -7389,   3191,   -626,   -411,  -7351,   3063,  -1801,  -4377,
- -2974,   -124,   2778,   2733,    349,  -1191,  -6528,  -1699,
-  6907,    239,  -2765,  -5706,   3627,   2096,    -20,   2285,
-  7164,   3523, -11582,   3616,   -614,   6266,   -285,   3643,
-  1506,   3665,   1261,  -2338,    418,  -5062,   4893,   2945,
-  1923,  -2990,  -4531,  -8858,   2769,  -5029,   2202,   3337,
- 10703,    716,   5614, -14982,  -2366,  -5415,     25,  -1665,
-  4353,   3060,  -2159,   1005,  -1587,   -368,   -949,  -2788,
-  1063,   1307,    -59,    -46,  -6337,    500,  -1194,   2914,
-  2372,  -1393,  -1914,   3820,  -1160,   -135,   3777, -14151,
-  5208,  -2290,   5738,   1018,    385,   1883,  -2626,  -9289,
-  1082,   1558,  -1756,   2720,   -519, -13050,  -3672,   1759,
-   -13,   3471,   4071,  -5977,    167,  -4210,   2219,   1344,
- -2412,   4497,  -6946,    660,   8774,  -3141,   6080,  -4478,
-  2520,   -609,  -3080,   -741,   7864,   7428,   -333,   1154,
- -1849,   1478,    460,   -338,  -6651,  -2480,   1692,   2104,
-  1642,   2720,   1017,   2759,  -1822,  -2668,  -2265,  -1019,
- -8926,   1487,    733, -15128,   5543,  -4214,  -7044,    666,
-  7108,   2222,  -2454,   4995,   5108,   1481,   2242,   5743,
-  -487,   9669,    295,   3539,   4836,    487,  -1541,    824,
- -5946,   6692,   -368,  -1390,  -6103,   4545,   2671, -12272,
-  3160,    760,  -2080,   3523,  -2752,  -2940,   -718,   2202,
- -5523,   2346,  -5580,  -5007,   6212,  -5406, -11348,   1272,
-  5389,   2331,   3691,  -1184,  -3585,  -4500,   -603,    -38,
- -5285,   -531,   4844,  -3850,   3944,  -6525,  -5723,  -2313,
-  -985,    879,    578,  -3217,  -3600,  -2814,   1432,  11568,
- -1461,  -1761,  -4110,  -4104,   -103,  -1803,   5195,  -1477,
-  1348,    107,   3902,   1215,   3522,  -3404,   9098,   -237,
-    68,     34,  -2524, -12040,  -6183,   2122,    470,  -1257,
-   346,   -232,  -1725,   5913,  -1525,  -5873,   1846, -11368,
-  1043,  -1027,   4201,  -3864,  -4294,   7756,   1847,  -3688
-},
-
-.cb2220s1 = {
- 32767,  -2256,     16,   2156,    267,   1128,   1394,  -1936,
-  -488,   -405,   -345,   1068,    578,   1504,  -1192,   -405,
-   292,   1149,   4243,    152,   1036,   1782,   2655, -23349,
- -1100,  -1933,    354,    966,  -1554,   1173,  -1186,    495,
-   618,   1009,  -2715,    461,   5974,    939,   3552,   1325,
-  3385,   -956,   2177,   2101,   -145,  -1000,   2326,   2466,
-  2822,  15822,   -581,   -713,   4398,    828,  -3249,  -3942,
-  1990,   -862,   2272,    348,  -2972,    241,  -2678,  -1881,
--22307,    417,   -587,    312,    280,  -2524,   2380,    299,
-  3931,    178,   2910,  -2544,   -356,   -786,    546,    -73,
-  -862,    240,  -1653,   1286,  -3875,  -2072,  -1477,  16800,
- -1148,   2099,   3216,   5174,   2177,   3042,   -796,    414,
-  -506,    883,   1837,   1451,   2864,    850,   2395,   -414,
-  3254,  -1937, -16379,  -3976,   2178,  -1473,   4759,   -832,
-  8890,   3324,  -3053,   -407,  -1530,   -431,  -1220,    128,
- -3472,    980,     52, -14716,   1732,   1931,  -6518,  -1784,
--11113,   4466,    -24,  -8559,    105,   5478,  -4116,  -2213,
- -3006,   1738,  -4189,   3310,   -753,   1869,    580,   -885,
-  3089,   8146,  -4990,  -1825,   -524,   3620,  -6920,    621,
- -1064,   4633,  -1509,     80, -10949,  -2752,    476,  -3684,
-  3547,  -1967,   3364,   2887,   -729,   7921,  -4216,  -3681,
--14417,  -3978,    261,  -1146,  -1124,   -901,    777,    783,
-    -2,   -989,  -1582,   3988,   7785,  -6371,  -2258,   3344,
-   354,  13289,   3339,    316,  -3186,  -2088,  -1951,    310,
-  -545,   -704,    -40,   4416,   -392,  -1033,   5650,     99,
- -3008,  -3716,   2448,  -3758,   9463,  -1793,   -130,   1705,
-  6501,  -2214,   2970, -10476,    564,  -5952,   -541,   2077,
-   -90,   6588,  -2858,  -1733,  -9247,   -345,  -3170,   4986,
-  3353,  -4868,   8873,    113,  -5223,   1562,   -163,  -2446,
- -4459,  -8052,   1106, -10883,   1185,  -1756,   -152,   3109,
-   181,  -1427,   8291,  11419,  -6265,   2116,   -469,   5150,
-  1355,    182,   -740,    779,  -7754,   1868,    144,   3936,
-   -60,   -784,   -231,    879,  17032,  -2273,   1886,   -538,
-  1015,   1798,   -633,   1090,   1910,    128,  -6094,  -1946,
- -1570,   -727, -18457,    498,    784,  -4419,   1656,    -21,
-   154,   2430,   3815,    -41,  -2708,  -1594,    228,   -784,
-  7284,   -452,  -7634, -12868,   3564,   5473,  -1244,   2231,
-    28,   4321,  -1464,   1402,  -1358,   2241,    656,  -1128,
-  1160,  -2352,   3641,   -680,   1816,   6864,    -42,   1269,
-  -280,  -1265,  -2048,    238,   -653,  13571,   3874,   -269,
-  7977,   2238,  -1246,  -2066,   4741,   1706,   3498,    595,
-  2559,     55,    593,   1681,   1612,     43,  -2756,   2702,
-  2439,  -2471,   -809,   1890,  17032,   -787,  -4280,   1167,
- -1926,  -4973,  -1181,  -2764,  -4151,   2962,   3444,    844,
-  2446,  14013,   3326,  -1195,  -1829,   1588,   1765,  -3140,
-  8562, -14425,   4040,   2003,   -738,  -1032,  -3314,  -2236,
-   548,    768,  -2348,    436,   1755,     31,  -4616,   1259,
-   269,   1543,  -1393,   5338, -16463,   2900,  -2480,   1659,
-   217,  -5864,   3878,   5268,   1244,   -520,  -1202,   1238,
-   182,  -1049,   -695,   -320,  -6832,  -5904,   2914,  -2616,
-  2586, -10958,  -3258,  -1846,  -4633,   2371,   3251,  -3583,
-  2631,  -4162,   3035,   2718,    616,   2890,    206,  16128,
-   979,   3551,  -6864,  -3221,   5881,   3692,   1718,    234,
- -2844,   1668,    102,   2687,   -838,    988,   1116,    533,
-  4026,  -7235,   5972, -13781,  -3394,  -3518,   -294,  -6383,
-  1675,   4507,   5444,    385,  -1931,    930,    699,   1639,
-   415,   6720,   7854,   1514,   3192,  -2253, -14786,  -1307,
-   871,   1329,   1881,   6628,   2851,    -85,  -2284,  -4538,
-  -837,  -2232,    269,  -2227,  13930,  -2063,  -7540,   8978,
-  1195,   2717,  -1282,   -972,   1305,   3864,   2412,   2308,
- -4824,  -3282,   -864,   -489,  -1458,   2192,  15903,   2460,
-  2792,  -4137,   1034,   -359,      5,   2297,     -6,  -3859,
-   478,  -1535,   2080,   -741,   2030,   -603,  -2640,  -1902,
- -8208,   3818,  -1273,  -8138,   2015,   9169,  -3440,  -1779,
-  4076,   -576,    -93,  -1718,    744,   2563,   6744,  -3841,
-  1355,   1590,  -4196, -13924,    356,  13381,   2552,  -2862,
-  2790,   -578,   3562,   2711,   -686,  -3783,   -489,   1230,
-   896,   1208,  -1101,  -3482,  -2478,    772,   1254,    320,
- -1825,   -327,   1070,  -1712,    295, -18141,  -2618,   1537,
-  -603,   3782,  -1272,  -1901,    414,    169,  -6574,  -6966,
-  2711,  -3292,  13204,  -1324,   3620,   4962,   2835,   4177,
-  4861,  -2378,  -5534,   3701,  -4224,   -631,  -3199,   -653,
-  4785,  -1045,  -2097,    580,   2190,   -140,     48,   3075,
- -1346,   -810,   2016,    566,  -2543,    235,  -5930,   1956,
-   481,  19003,  -3938,   6489,   2697,   4796,   3435,   7102,
-  3062,   1460,  -5814,   2723,   4181,  -4979,  -2534,  -2058,
-  -136,   3554,  -2684,  15252,   4112,  -3146,   2812,   7182,
- -2642,   5443,  -1043,   -803,   2786,  -1622,   1988,   -780,
-  1482, -13015,  -1762,  -1377,  -4005,    161,  -9568,   8166,
-  1832,    330,  -6484,    945,  -4388,   1090,   -524,   1556,
-  -582,    320,    770,   -938,  -8757,    977,   1084,  -7062,
-  3552,    775,  -4708,  -2281,   -552, -10027,   4263,   1197,
-  -672,    -93,   5716,  -3825,  -4526,   1781,   9799,   4450,
-  1981,  -3149,  -9664,   3119,   3794,    -91,   6710,    840,
- -1098,  11310,  -2933,    785,  -2573,    748,   1803,  -1401,
- -1547,  -4118,    849,   -580,  -1404,   1536,  -9382,  -1610,
-  2335,    403,  -2939,  -3015,  -3753,  -7593,   1640,   3346,
- -2594,  -8028,   5485,   2189,  -3369,   2106,   5369,  -2573,
-  -515,   1459,   6996,   1344,   -389,  -7009,  10332,   -840,
- -3869,    901,  -6449,  -2348,  -2461,  -4103,   -810,  -2060,
-  1040,    117,  32241,   -231,    945,    999,  -1183,    180,
-  1443,    188,    855,  -1634,    774,   -202,     99,   1714,
-   286,   -849,   1968,  -9743, -15458,   -859,  -3726,   2257,
-   355,   -167,  -1674,   1808,   -488,   1118,  -1416,  -1685,
-  2928,   1471,  -1145,   -536,   2307,   -972,  -1191,   1625,
- -1436,    378,  20178,   -638,   1826,    472,   -300,   -845,
- -1045,   1074,  -1041,   -510,    -39,    516,   4548,   2741,
--10197,  -2336,   3828,   2093,  -4148,  -9138,   4239,   2520,
- -3536,  -3807,   2998,  -2226,  -6898,   4838,   2552,  -2024,
- -5579,   1370,  11706,  -7626,   1566,    989,  -4934,  -1345,
- -5962,   4259,   1158,  -3712,  -2710,  -1037,    105,  -2733,
-  1068,   3682,   3904,   2044,    184,    537,  -3438,  -1376,
-   332,  17812,  -3170,   2386,  -2090,   3481,  -1352,    431,
- -1016,  -1062,   -564,  -1752,  -2602,   1299,   6720,    789,
-  1275,  -9801,   5320,   2327,  -4048,   4443,  -7820,   1112,
-  1232,  -1139,   -920,   -744,   -845,  -3754,   5958,  -5388,
-  3336,  -3578,  -4027,    688,  -7043,   -136,   -163,  -1395,
- 13400,   1729,  -1862,   2612,    321,  -3874,    947,   -990,
- -3164,  11487,     46,  -1978,  -2139,   1222,   3897,  -9664,
-  3692,   5431,  -3364,  -3706,    180,  -4009,   2563,   -313,
-  3228,  -1631,  -9763,  -9184,  -6058,  -4594,   1040,  -3323,
-   321,  -3233,   5035,  -1919,  -5525,   1899,   1196,  -1834,
-  -391,    549,  -2114,  -1436,  -2624,   2441,    618, -27606,
-  -841,   -936,   1067,   1157,    230,    784,   -755,   1798,
-  -219,  -1026,  -1119,    320,  -2611,  -1382,   8776,   1151,
-  3739,   -607,   2997,  -7704,  -5870,   1800,   1357,   4973,
- -9674,  -5182,    -50,   -886,   2056,   -802,  -1909,    574,
- -1716,  -6388,  -2882,  -3526,  -3188,   -543,    244,   9648,
-  5129,  -5069,    598,  -9049,   1834,  -3375,   1369,   1461,
- -1295,   -380,   -274,   7258,  -9353,  -2401,  11915,  -5087,
-  1505,   4211,   -719,   -902,   1762,   -168,    642,    699,
- -2067,   -933,   1092,   -958,    715,  -1978,  -1968,  -1613,
- -1263,   -777,   1170,  -9652,  -9570,    612,  -3935,    237,
-   386,   4237,  -1468, -10172,  -4964,   2919,  -6428,  -7184,
-   119,   3610,     59,   3168,  -5474,   -853,  -5735,  -1765,
-  3063,  -1352,    944,  -1934,  -3500,   9282,   5920,    784,
-    90,    275,   3211,   2418,  -8570, -10498,  -2026,  -1020,
- -2989,   1511,    -41, -11462,  -1980,   5296,   2614,    -21,
-   770,   -156,  -2817,  -4748,  -8672,   3447,  -7231,   4598,
- -1347,   -689,  -3198,    434,     56,  -2065,   1798,  13761,
-  -533,  -1280,   -796,   2481,     56,   1377,  -5473,   9116,
- -1185,   -602,   2547,  -3693,  -8880,   2978,   9093,   1829,
-  4844,   -649,    316,   -162,   1520,  -5814,   4860,    199,
- -1330,  -5182,  -6269,   2642,   1220,   2816,  -4098,  -3981,
--13264,   -398,    361,   2768,  -4786,   1023,    -97,    655,
-  -397,   2403,  -1576,   -386,  -1112,    792,  -1195,   -759,
-   742,    729,  -2916,  -1020,  21350,    -26,  -3577,    659,
- -1263,   1378,  -4339,   1880,   4842,   -669,  -1203,   5936,
-   816,  -8356,   3660,   1673,   -677,  -2370,   1652,   8710,
- -1254,   6171,  -6868,   -891,  -6752,   -169,  -5678,  -7588,
- -3247,   2982,   5281,  -4941,   -359,  -3354,    851,  -1609,
--11194,    610,    261,  -1936,   2715,  -3540,  -2488,   2086,
-  6110,    914,  -3224,   1777,  -1558,    937,   3736,  -3109,
-  1903,   4250,  -4478,   2636,   2292,  -1451,  10231,   7600
-},
-
-.cb2220m0 = {
--26430,   -533,   1599,    208,   -293,   2303,    704,   1586,
- -1064,  -1630,    690,   1697,    623,   1786,    332,    682,
-   199,  12695,    475,   1288,  -2471,   -797,    -68,   9659,
-  -816,  -2465,    546,  -1421,   1596,   -926,   4471,   2360,
-  5551,   -900,    297,     96,    400,    936,   1548,  -1066,
- -1625,    652,   1416,   -118,   -525,    683,   1545,   1340,
- 20684,    936,  -1033,   -773,   8416,    954,  -4822,   4223,
--10815,   -312,   -896,    531,   3140,  -1649,    508,  10294,
-  -315,  -2078,    584,   1523,    118,    997, -11837,   -605,
-  -262,  -1732,   -613,  12220,  -2666,  -1802,   -507,  -4410,
-  -100,   2127,   -114,   -886,  -2806,    500,   1034,  -2811,
- 12642,   1015,  -9193,  -4201,    238,   1096,  -1159,   1619,
-  2534,   1644,  -3465,   4797,    639,   2583,  -1316,  -9884,
-   948,   1479,   1186,  -1760,   -343,  -1286,  -1653,    678,
- -7439,   4542,  -6295,  -1600,  -6978,     48,    448,    369,
-  1597,  -3696,  -2121,   1002,   2428, -11368,   5385,    827,
--10674,  -2252,   2240,   1230,  -3074,  -1894,    296,  -2216,
-   571,    114,   -497,  -1675,   1311,  -2297,   1843,   -350,
-  -856,   2067,   1198,   -588,    270,   -470,   2640,    274,
- 19586,   -762, -11471,   -623,   -506,   4236, -10981,   -214,
- -1856,    409,  -1276,   -935,  -1681,   5116,    774,   3008,
-  4388,   -112,  -9493,  -1108,   1454,   1385,   1065,    519,
-  -486,    308,  -1141,    289,   1424,  -3672, -15989,  -3738,
- -1592,   -258,   3304,     62,   1441,     45,   -686,  -1070,
- -1616,   -701,   2313,   1918,   4843,    654, -16902,    263,
-  1837,  -4062,   2727,   -709,   1524,  -1628,   2025,   -281,
-   264,   1238,  -1023, -11981,  -2990,  -1293,    801,  -9606,
-  -604,   -210,   1248,   4014,   3652, -11286,  -2094,   -470,
- -1330,  14523,  -2388,   1413,  -3968,    641,   2936,    161,
- -1687,  -1260,   1722,  -1968,    364,   -854, -14386,  10146,
-   792,    133,   1746,    261,   3345,   -408,   2036,    272,
-  1412,    720,  -3302,  -1495,  -4334,   2210,    799,  17546,
-  2600,   1314,    764,   1327,   3433,   -377,   4296,   2402,
- -1074,    470,   7220,  -2556,   3326,  -4338,  -2086,  -1945,
- 11865,   3525,   1513,   1520,  -1814, -13020,   -929,  -2001,
- -1496,    580,  -3293,  -3146,  -2185,   1442,    390,  -2026,
- -2141,   -192, -18700,  -2039,  -4330,   1691,   -250,   1451,
- -2913,   2832,  -3284,   2899,   1529,   -888,    486,  -2381,
- -1459,  -2663,    530,   -717,   -248,  -1714,  12662,   1820,
--11488,  -1044,   3035,   3872,  -2430,    679,   1075,    475,
-  -593,    930,  -1751,    405,  -2308,   2148,    510,  -2798,
-   445,   -240,  -6865,   2106, -11323,    670,   4342,    154,
- -7748,  -1805,   5381,   -842,   -697,   -709,    688,   -498,
-  5525,  15212,  -2006,  -4146,  -2452,   2392,  -3522,  -2023,
-  1306,   5522,    916,  -3616,   -287,   -653,    333,   -330,
-     4, -24886,    635,    119,  -1949,    899,    -36,    -37,
-  2658,   -133,   2064,   -534,   -549,  -1745,    -70,  32767,
-  1089,   -869,    150,   -599,  -1146,   -574,   -424,    377,
-  -648,   -303,    590,    453,   1910,   -351,    553,    304,
-  -752,   -752,   -502,    -42, -31211,   -634,    449,    638,
-  1086,  -1406,   1220,    802,   -924,  -1874,   -212,     86,
-  -200,  -1140,    618,   -621,   -605, -10976,   1699,   -603,
-  2056,  -4448,  -1519,   2564,   -743,  12304,   1482,    547,
- -1589,   -817,   -217,  -1633,  -1089,  -2270,    181,   -634,
-  3890,    734,  -1319,  -2035,   3304,  13144,  -9076,  -4067,
-    70,   1309,   1067,   -354,   1529,   1379,  -1002,  -3324,
-  -525,   -817,  -1438,  10834,   1036,  12441,   1242,   2461,
-  2858,   2257,    430,  -1177,   1142,   -870,    844,   1102,
-  1208,  -1482,    830,  17622,  -2753,      6,    174,   4385,
-  -339,   2157,   -155,    -68,   -190,  -1181,     29,  -2046,
- -2140,     27,    949,   1889,    446,    -54,  16696,    -49,
- -3304,  -1929,   1833,   3735,   -495,  -1225, -11743,  -2259,
-   891,  -1954,   2848,   -504,   1164,  -2489,    861,    579,
--11547,    976,    -42,   1477,  -2428,  -1561,    112,     74,
- -2721,  12046,    632,   1283,  -1900,   1990,  -1193,   1606,
- -1370,  -2812,  -1309,  -1419, -12526,   3391,  -4213,  -2710,
-   269,     90,  14575,   -345,    820,   6118,    892,   6302,
- -2825,    332,  -3071,   2279,   3756,    185,  -3029,   2402,
-   245,   1010,   -273, -32751,   -140,   -600,    482,   1516,
-  -462,   1931,   1941,    272,   -310,    544,   -422,   -815,
- -1116,    803,   -617,  -1640,  -4336, -11735,   3656,  -1176,
-  1170,  -6209,   2139,  -1571,   2067,   1011,   9842,    790,
-  1702,   -191,    911,   2771,   -253,    794,  -3862,  -1885,
-  -494,   2070,  -2682,    772,    763,   4304, -15657,  -2194,
- -1998,   -963,  -5222,   -175,    238,     32,  10067,   -692,
-  2824,   -474,   3016, -11994,    -51,    713,   2423,   2864,
-  -338,   4838,  -1095,    215, -13471,     -2,    704,    752,
--14654,   1396,    484,    564,   -886,   -775,  -1099,    775,
- -1035,   1661,  -1013,  -1118,    449,    822,  14253, -13238,
- -1084,  -1107,  -1672,    996,    472,   2237,   -440,   1186,
-  1200,  -2112,  -1388,  -1093,  -1902,    555,   -328,  -1493,
- -2034,    426,  -2144,   -388, -20028,   1285,   1122,    730,
-  1661,  -1576,  -2084,   2930,    337,    -66,   1591,   8685,
-  2361,    146,   1370,     22,   1371,   -105,  -4190,    371,
--13252,    328,   1301,   -995,   3689,   6422,    -79,  -1407,
-  -384,    828,    840,    854,    266,   1222,    796,   -550,
-  -729,  -1213,    -87,    524,   1070,  22334,  -2333,    574,
-   680,   -624,    463,   4047,   -236,    114,   1020,   -692,
-  1575,   -320,  -3229,    222,    520,    996,   2104,  -5404,
--18197,  -1105,   -184,  -1057,  10712,  -2509,  -7140,  -2307,
-  1333,   3041,    183,   1241,  -7861,  -3060,   1432,      9,
- -1431,  -2605,   2663,    273,    250,    770,   -740,   6699,
--10929,  -7227,    105,  -2983,  -1203,   1637,  -6072,  -6630,
-   933,  -1526,    658,   2612,   5377,    -91,    -66,   4944,
-  3025,   2723,   -869,    142,  10532,   9858,   -207,   3072,
- -2610,      0,     81,   1078,   2136,   -266,    223,    931,
-  -385,    983,   1029,    108,   2290,   -491,  26685,    565,
-  -140,   -662,    680,  -2206,   -803,   -777,   -250,   -467,
-    98,   2944, -12296,  -4190,  -2254,   -748,  -2076,   4780,
-  -510,   -221,   1428,  -6162,   2693,   6238,  -4030,    266,
-  6540,   2502,   5147,  -4649,   1804, -10514,  -3413,   2503,
-  2143,  -1924,  -3811,   3674,   4341,  -1054,  -3130,  -1260,
-  -576,    887,  25908,   -773,   1186,    548,   -606,   -744,
-  -995,   1320,   -507,    279,   1803,  -2451,    880,    -31,
-    -5,   1615,    770, -11818,   1062,  -1126,    472,   -297,
--12126,  -1197,   1912,   -962,   1241,   2348,   2332,  -3047,
-  1561,   3844,    720,   -387,    371,   2942,   1174,  -2347,
-  1244,  10148,  -1620, -11788,   1315,    -31,  -1867,   3450,
- -1589,   5180,   3184,  -2614,    -13,    130,    107,    297,
-   113,  -1407,  29190,   -544,   -173,    990,    913,  -1848,
-  -990,   1230,    264,   1896,  -6974,   -102,  -2232,   3826,
- -2269,  -5027,     94, -12612,    436,  -5979,   1757,   1757,
-  -724,   2378,   2584,    728,  -1022,  -7274,    668,    744,
-  -516,    420, -11866,    246,  -1357,   2406,   3674,  -2594,
-  1638,  -3037,  -2402,   1525,  -7304,  -1078,   1772,   9264,
- 12366,    202,      2,   -728,    684,   -437,   1446,  -3546,
-   828,  -2106,  -2736,    964,   -180,   6524,   2250,    514,
-  -782,    675,   1418, -11225,   2760,  -3970,   -545,   9128,
- -6601,   -556,  -1966,  -4625,   -149,   -198,  -3330,  -1575,
- -6198,    656,    674,    367,   1809,    155,  -5126,   6109,
-  -572,   4927,   1448,  -1855,   1636,   8648,   2010,   8973,
-  3087,  10172,     34,  -1183,    -12,  -1057,    192,  -2955,
-  1034,   -374,   2500,   9318,  -4090,  -5220,   -404,  -1022,
- -1458,  -1367,    765,  -1193,   1542,    302,  -1337,    -34,
-  1449,   1434,   2210,    404,  -3277,  -8024,   1363,  -7591,
-  9096,  -9179,   1176,  -7311,    544,  -8942,   -713,    -56,
-  2623,    -35,   1623,   2212,   1733,   -712,  -1327,   -320,
- -1966,  11352,  -1276,  -3804,   -550,    520,  -4848,    550,
-  1488,    944,  10756,   -782,   5643,  -2647,  -6513,  -3500,
- -2877,   1880,  -6634,   2349,    256,    440,    188,  -8428,
- -4580,   2479,   4763,  -1807,   -513,  -4292,  -1729,  -6878,
-   448,  -6706,  -1162,   4938,   -721,   5465,   1409,  -8759,
-  -898,  -4254,  -5230,  -3886,  -7969,   1730,   3656,   1198,
-  3537,     33,   4091,  -2088,  -7646,   1160,   2922,    855,
- -1254,  -2616,   -770,   -685,   -100,   -577,  -4927,   -792,
- -2107,   9613,   2563,   5096,   6143,  -3404,  -8630,   4164
-},
-
-.cb2220m1 = {
- 32524,   -324,    411,    -34,   -697,    818,    -71,   2326,
-  -142,   -989,  -1512,    358,   -260,   3791,   -575,     93,
-   224,    208,  -1101,  32767,   1147,   -203,   2015,    461,
-   668,   -296,  -3340,    -38,    720,   -993,   1765,  -1344,
-  1323,    648,   -997,    729,    581,    349,    861,  -2035,
-  1791,  -2142,   -822,  -1425,    820,  -6555,   -811, -15708,
-  -912,   4835,   1500,   -604,    527,   -937,   -640,  -1240,
-  4692,   1259,    174, -12040,    450,   8196,   2796,  -5123,
-  1595,    538,   -101,   -218,   5581,    367,  -2700,    277,
-  2111,   2718,   1458,    155,   -100,   3284,   -498,   9961,
- -1505, -10336,  -1170,   5337,   1032, -14947,   1154,   -578,
--11773,   -945,   -660,    669,   2340,  -1038,   1520,    713,
-  2663,    422,  -1242,   1918,   -234,  -1793,  -1580,   -271,
- -5628,  -2010, -12209,  -1784,  -4417,  -2804,  -3123,  -4316,
-   126,   6353,  -2391,  -2088,    836,  -2550,    521,  -1258,
-   918,   4471,   -528,   4243,   -615,   3453,  -6683,   1784,
-   790,  13200,    700,    322,   -815,   6049,   -290,    928,
- -1121,  -1531,   -878,  -1150,   1404,    325,   -530,   -435,
-  -254,   -804,  -2536,    589,   8439,  -1087, -16248,   -637,
- -1528,    305,  -1577,    642, -22699,   -139,   1319,    588,
- -3079,    800,   -597,  -1408,  -1150,   3145,   -868,   3244,
- -1004,   1004,  -1459, -11618,  -4557,  -3643,   -914,   4238,
-  -626,   4025,   3227,    537,  -4285,   2010,    747,   1595,
-  1599,   5994,   -797,   -911,   2854,  -3426,  -8488,  -1899,
-  -301,  -2146,   -111,   -522,  -1852,   3075,  -3864,  -1531,
-   654,    193, -11264,   5561,    304,    525,    346,  -2761,
- -1124,   1134,   8354, -12460,  -1023,  -7634,  -2750,  -1518,
-  5001,   1480,  -1039,   -502,   1455,    586,   1012,  -1270,
- 12435,    895,   1169,    466, -10696,  -3861,   4381,   1790,
-   767,  -1808,   -537,  -1057,  -2374,  -2058,   9992,   -858,
- -1568,   -678,  -3812,  -1520,   1521,    230,  -1716,  13418,
- -1930,   -979,   3272,   1116,  -4555,   -559,   -320,  12080,
- 13696,   -286,    652,   2420,   1725,   -277,    213,  -1046,
-  1642,   -576,  -1514,   -973,  -1501,     77,    537,   -606,
-  1144,   -680,   -568,   1104,   2176,   -969,   1657,   -784,
-  1107,  -1056,    -59,  -5607,     64,  11913,   -178,   8703,
-  3744,    276,    -50, -12807,   1122,  -6138,   1901,   -439,
-   733,   6829,   3001,    -61,  -1005,   3816,   3987,  -3588,
-  -778,   2257,  12101,    196,  13796,    355,   1407,    989,
-   101,   1041,    988,   1274,  -1478,  -1127,   1320,   -442,
-  3452,  -1717,   1244,   -466,   -868,   -323,    502,   1243,
-   -70,    897,    958,   2781,  -2492,    788,    744, -12324,
-  1111, -11704,   -452,   -734,  19574,    -45,   -584,  -2387,
-  -830,    603,    380,    787,  -2962,   2046,   2524,  -2403,
-   699,  -4144,   1587,    573,    588,    238,    -88,     31,
-  -278, -32768,  -1173,   -745,    667,   -188,   1221,   -369,
-  -261,    322,  -2054,    651,    100,  -2092,    315,   1558,
-   596,   -407,   -146,  -1234, -30970,    -71,    633,    536,
- -1345,   1819,    655,    680,  -1453,    492,  -1265,  -1292,
-  1780,    -68,   1008,    215, -19980,   -521,  -3148,   -256,
-   193,    916,    453,     86,    116,    108,   1518,  -1420,
- -1501,    688,    669,   1196,  -1579,   -942,    868,    804,
-   110,   1126,    202,   1086,  23516,   1070,  -1623,    747,
-   -38,   -116,   1176,    554,  -2361,   1008,   1085,   1972,
- -1794,    -96,    464, -20910,  -1208,  -3857,   -466,  -2173,
-  2461,   2364,   -931,   -684,   3056,   -719,   -936,    887,
- -3149,   1004,   7085,  -2985,  -9393,   5142,  -9621,    150,
-   174,    572,  -2232,   -390,   1356,    160, -10796,   2256,
-  2238,    242,   1663,    485,  12378,   1236,    688,  -2908,
-  1084,   1047,   4850,    -72,   -642,   1604,    152,   -850,
-   670,    968,  -3207,   1690,    105,  -2516,  11539,    390,
- -1117,   -588, -10771,   2879,   4742,  -8351,   1571,   -850,
-  -605,  -1959,    395,  12324,   1750,   2290,    -92,    774,
- -2897,   1025,  -1841,    546,   3904,   3908,  11494,      9,
-  1340, -11976,   -525,   1522,    -43,    -43,  -1860,  -6160,
-  -199,   2479,   4593,  -2876,  -2985,   1044,    -62,   -812,
- 10424,  -2489,  -1098,    796,  -1292,  -2070,   1096,  -1944,
- -2145,  -4374,   1041,  -1014,   9036,  -2142,    328,  -8232,
-   152, -13336,  -2225,  13716,   -367,   -558,  -1942,    161,
-  -472,   2224,   -748,   3550,   -809,   -493,   2121,   1234,
-   772,   5146,   2485,  -2282,   7546,  -1441,   1595,   9176,
-  6208,   1292,   1704,   3968,  -1500,  -1974,  -3519,  -2826,
-   149,   -903,    504,   -187,   -940,    121,   -215,   -615,
-  -257,  -1954,    958,   2057,   -191,  21258,   -726,   2081,
-  1278,   1670,   -854,   2730,  -8132,   -530,   1004,   2574,
-  1430,  -2536, -10851,   1389,    155,   -140,   2158,   2762,
-  3807,   3850,  -3728,   -954, -11366,    709,  14727,    514,
-   694,    -87,    857,   -249,   -419,    617,   -418,  -1144,
-   -32,  -2182,   -839,   1449,  -1072,   -785,   -246,  13634,
- 12488,    358,   -447,  -2262,    926,   1023,   -901,   -345,
-  2260,  -1530,  -1466,  -2973,  -2170,   2090,     44, -23476,
-   603,  -1740,   -345,   -438,  -3004,   1322,  -3088,   1274,
-   341,   -348,   -534,   1055,   3026,   -932,    514,   8958,
--15489,   -374,   1077,   1166,     48,   1016,   -918,    -27,
-  -410,   -266,  -1401,  -3888,  -2918,  -2146,   2815,   1834,
-  -875,    162,   -678,   1876,  -2033,   1999, -12854,  -1563,
-   192,    414,    782,  -3109,   1432,  -4197,   2358,   8517,
-   784,   1256,  -1362,   2938, -11355,  -5184, -10314,    -39,
- -2182,  -1686,    241,   -195,   -232,  -6169,    206,    181,
-  -470,   1008,   -599,   -284,    733,   -836,    648,   -138,
-  2078,    313,  24432,    548,   -441,   1446,  -1628,  -1218,
-   -64,   -716,  -2456,   1987,   -352,  -1025,  -1951,   1320,
-   350,    744,   2598,   -984, -18328,    622,     -4,  -1572,
-   893,  -3043,  -4365,    127,     -1,   -226,  -1696,   1332,
- -1360,   6756,   2596,  12059,    370,  -3690,    497,    585,
-  1619,   -778,   9174,  -2046,   2214,   2004,   1133,   1069,
-   132,   -250,  -1555,   -906,    561, -12904,  -1039,  -8006,
-  1876,   2300,  -1116,   1895,   1782,   3734,  -1108,   1338,
- -1409,   -248,  16117,  -1458,    156,  -2626,     64,  -1199,
- -3544,   4283,  -3390,   -404,   1426,   -907,  -2768,   -780,
-   -34, -18656,   2003,    515,   3171,   -653,    762,  -3352,
-  -154,  -1171,   -452,  -1590,  -5936,    519,   1210,    502,
-  -409,   2262,    695,   1028,   8652,   2532,  -2636,   3472,
- -1186,   1350,   -651,   -639,   8382,  -3234,    630, -10323,
- -2285,  -1916,    826,  -1449,   -738,   -344,   1022,  -3248,
--20921,   -200,    568,    -84,    777,  -1570,  -2756,   2834,
-    26,   3878,  -1709,    101,   1433,  -2238,    305,     61,
- -1041,   2399,    628,  -1509,   -388,    946,    733,  -1538,
-  -650,  19935,    478, -10696,    850,   -682,    447,   2311,
-    35,  -1258,   2332, -11417,   1743,   -834,    660,   3170,
-  2378,  -2734,   -762,  -1151,  -1802,  -9324,   4625,   2304,
- -1186,   1180,   4894,    662,  -7067,    869,    613,   1802,
-  4839,   3412,  -5460,   -862,  -4202,   7876,  -1057,   2872,
- -1336,   1731, -10788,   1088,   3433,     42,   -939,   2479,
-  6425,    991,  -1621,   3222,  -2464,   2988,    -29,    481,
- 11606,  -2800,  -8315,   7660,  -3385,   1217,   -728,  -3670,
-   684,  -2295,   -724,   -567,  -2150,   -106,  -1920,  -2143,
-  3465,   1968,  -1089, -11953,  -2704,   3049,  -1351,   7225,
-  5727,   -525,   2639,   1955,   2259,   6489,  -1867,   1544,
- -3199,  -4992,   2420,   4119,  -2860,  -9505,  -2152,  10204,
- -1133,  -1201,  -1468,  -2989,   4658,    578,   1115,    368,
-  1570,   -776,   -503,   1554,   1329,   -696,   -760,    575,
- -1527,  -3865,   8372,  -3378,  -8137,  -8392,  -3471,  -1854,
- -4852,   5270,   -634,    608,   1289,  -7660,   4983,  -1266,
- -2070,   -906,   3291,   2459,   4807,  -4241,   5773,  -2258,
- -4500,   2634, -13176,   6412,    282,  -5849,    294,   -626,
-   888,  -1088,    656,    192,   -630,  -3405, -12469,   2882,
-  2184,   3920,   2715,  -6852,  -1111,    869,   -161,    341,
-  1856,  -9450,   2719,   -579,  -3840,  -8763,   1153,  -3532,
-  -571,   -766,   8301,   2936, -10501,  -1073,  10068,  -2930,
-  6308,  -2747,   3093,  -1710,  -3865,  -1464,  -4447,    446,
-   898,   5386,  -1074,  -4651,   6205,    455,  -1773,  -1270,
-  6986,  -2493,   4076,  10605,  -2522,    977,   4098,   1153,
-  -434,   4071,  -2890,   2920,   9175,   2276,   4699,    642,
- -1067,   -968,    508,  -1752,    728,   3260,   -500,   1414,
-  5554,   2761,   1973,  -4704,   2127,   1397,  -1070, -14536
-},
-
-.cb2224l0 = {
--12451,    389,    917,   1238,   -626,   -904,  -1877,   2328,
--12808,  -1345,    406,     80,    383,  -3841,   1188,   -907,
-  2369, -13409,  11191,  -2547,   -532,    762,  -1627,    680,
- -2305,   -811,  -1118,   3232,   3413,  -2010,   -453,  -6816,
- -4100,   1643,  11209,    933,  -2272,   1440,  -2465,  -6862,
-   186,   1563,  -8468,  -1832,  -1166,   -596,   -326,    105,
-  -115,   -352,   -624,  31621,    129,   -301,   -615,   -313,
-  -176,    620,     -5,  -1354,  -3563,    678,   -301,    621,
-   904,   -769,  -1314,   -956,  -2294,   -362,    381,  -2398,
- 17085,    100,   3962,   -830,  18705,    237,  -1296,   3534,
-  1452,    259,   1690,  -3106,  -3624,   -316,    -16,   5900,
-  2195,  -1008,  14335,  14173,  -1637,   1130,   1110,    499,
- -1516,    500,   -720,   -494,  -1010,  -1264,   -773,   1389,
-   212,   8036,    780,    608,   -415,    931,   -301,  -2186,
-  2256,   -706,  12972,  -3461,  -3695,   2073,  -2768,  -1525,
- -7539,   -441,   -753,   4558,  -8171,  -1751,  -6885,   4077,
-  6714,     53,   1090,  -3006,   3688,  -1162,    -59,    302,
-   928,   -450,    238,  10809,    353,    698,   -476,    172,
- -2198,  -4377,  -7518,   1605,   6348,   5147,   -165,    165,
-  -463,    -93,   1251,    671,    587,   -402,   -227,   -462,
--27960,    215,    -56,   -958,   -657,    508,     98,  -2811,
- -1443,   3076,   6218,  -9760, -10465,   -770,    345,   3076,
-  -116,  -2884,   2215,  -2652,   1306,   2638,   -124,   -317,
-   366,   1461,   -295,   5073,    460,   1920,  12216,  -7032,
-  6816,   3037,  -2630,  -1087,  -1315,    123,   -582,  -2137,
-  5061,    291,   1740,   -214,   1920,  -3470,  10895,   9491,
-  3558,  -1256,   -448, -10304,  -2391,   1890,    484,  11057,
-  6636,    422,   2316,  -1663,   -348,    633,   1200,   1788,
- -1124, -24435,    140,    869,    738,    223,  -1429,    602,
-   433,   -196,  -1127,  -1937,   -879,   -310,   -564,   1022,
- -4380,   7247,  -3938,   4461,   2219,  -8465,   9266,  -4564,
- -3169,  -3463,   -477,    749,   2460,   -776,    294,   -171,
-  1072,   1748,   1000,   -208,   1908,   -998,  -1898, -10485,
-  2360, -11950,  -2412,  -2609,   3885,  -2738,   1348,   -559,
- -1342,   9366,   1560,   -816,   1178,    342,   -175,   1286,
-  3014,  10641,    246,   3128,   6618,   -305,  10906,   6359,
- -4395,   1415,    196,  11136,   1772,  -3047,   3313,  -1231,
- -1974,  -3021,  -1480,  -1345,   -830,   1551,   2521,   -506,
-  7821,   7715,   5078,   8215,   2102,   1552,   2247,   3766,
- -3158,  -1811,    631,   3980,   -397,   9030,  -1267,  -1974,
-  1539,   -360,   -315,    796,  -4749,   2076,  -1017,    717,
-  2290,  11212,   9365,   1626,    379,   2060,   1329,      4,
-   -25,  -1348,    566,  -1266,   1670,   2166,  13123,     42,
-  2416,  -2170,  -6380,    172,    316,     40,    300,   -487,
-   402,   -220,    846,   -894,  -1413,  -2227,   1962,  19478,
--14756,  14377,   -582,   -770,   -186,  -1008,  -1520,   -722,
-  -885,   2622,    311,   -753,    480,    539,  -1011,  -1748,
-  -832,   -603,  -2015,    869, -14860,   -600,   2110,    484,
- -5874,   1532,   3290,   -222,  -4670,    -33,   -794,  -2061,
- -1185,    -96,    337,    515,  -1887,     26,  20283,   -455,
-  -799,    -62,  -1083,    236,  -1721,   -569,  -1259,    361,
-  1090,   -226,   1480,  13367,   -638,    940,   3736,   6419,
- -5995,    830,  -6599,   4549,   1583,  -9001,   1104,  -1281,
- -1270,    -94,   1104,  -2076,    652,   2263,   1465,    -25,
-  9046,  -8139,  -2646, -13200,   -534, -15244,  -1448,  -1390,
-   452,    584,   -314,  -1192,    951,    885,    396,    776,
-  1303,   1298,   -448, -32641,   -234,    -62,     31,   -164,
- -1042,    -82,    -26,   -272,   -559,   -164,    669,   -500,
-   516,   1347,   9615,   1123,  -1346,  -1898,   8341, -10583,
-  2286,  -5233,   1503,    454,  -2024,   4248,  -2298,  -2117,
- 13390,   -849,   2078,   1096,   -651, -12232,   -374,   -812,
- -3729,   -829,   -144,   1213,   -469,   1112,   1146,    816,
-   818,   -912,   -967,    907,     12,   2443,   -759,  -1833,
-  -174,   -838,    488,  -1560, -18242,   -558,   5510,  -1316,
-  1758,   3957,  -7130,  -1394,   4962,   3870,  -1907,  -9247,
-  2217,  -3880,  -4413,   1893,  -3085,   -202,    599,   1307,
-  1574,  -1070,  -2593,  -2722,   9506, -10170,   1105,   4879,
-  2208,     38,   5596,  -5990,  -3205,     35,   9405,   -219,
-   618,   1308,    353,   3457,   1712,    717, -12937,     25,
-  2176,  -2590,  -1223,    528,   1318,   4588,   7678,   5743,
- -8430,  -4487,   1364,   8082,  -1727,   -387,    469,   3172,
-   401,  -2771,    694,  14554,  -2278,   3640, -11084,    924,
-  -593,  -3841,  -4338,    227,    750,   2974,  -2834,  -1765,
-  2133,  -1181,   5149,  11758,  11949,   3538,   2442,   2801,
-  1457,   -822,  -3419,  -2468,    191,   -646,   -975,  -1271,
-   832,   3088,   -495, -10022,   1817,   1319,   -880,   1342,
- -1448,  -3597,  -3310,   8753,   -161,  -6550,   1422,   -640,
-  -508,  11542,   -277,   -165,    837,   7389,   -942,  11009,
-   -97,   1548,   1418,   -445,   2105,   -946,  -8676,   5274,
-  8842,    576,  -1392,  -1737,  -1276,   5491,    312,   3624,
-  2806,   2157,   -537,   1656,   1982,  -1300,   -146,    463,
-   496,  16792,   -140,  -1755,   -832,  -2123,   -399,   5811,
-  -702,   2891,  -3630,  -1843,    346,    508,   -364,   -498,
-  -558,  32048,   -744,     90,   -372,    430,    704,    871,
-   139,    772,    696,   -108,    -18,    310,   -411,   -798,
-   465,   -165,   -321,    745, -27861,   -752,    499,   -215,
-   172,     35,   -196,   -770,    274,   -546,    -96,   -470,
- -8976,   9156,    581,    904,  -4644,  -7801,   3525,   -607,
-  6444,   4058,   -696,  -1107,   -632,   1475,    196,   -933,
-   883,   1101,    278,    433,    544,   -497,      4,  -1882,
-  1504,    594, -30386,    218,    211,    850,   -989,    319,
-  -867,    -42,    754,    498,    -70,   -562,    660, -11561,
-    54,    803,    425,    966,  -1017,  -1224, -12630,   1834,
-   -41,     98,  -1083,   3508,   1750,  -1751,     72,   -503,
-   -38,  22211,    252,     88,    221,    690,     82,  -1340,
-   508,    638,    832,    482,     51,   7954,   2702,  -1176,
-  8830,   -311,   2536,  -6072,  -4147,   5234,    494,   -157,
- -1289,  -5678,  -1617,   1508,   -140,    -55,    713,    440,
--32583,    105,   -394,   -613,   -972,    578,   1122,    -32,
-   114,   -228,    342,  -1237,   1123,   1126,   -188,   -106,
- 11308,  -3787,    563,   3423,  -9926,   1623,  -2551,  -1448,
- -4125,    918,  -1366,   -476,    -66,      4,    761,    164,
-   -61,  20445,    238,    296,    492,  -1126,    -98,  -1201,
-    14,  -1840,   -865,   1178,   -869,    105,    907,    248,
-  1538,   2990,  11691,   7783,   1566,  -6704,   2397,    594,
- -1825,   -383,   4264,   1911,    468,   1018,   -676,  -2676,
- -7756,  -2623,  10705,   2710,  -8078,  -5256,   1699,  -2100,
-  -355,  -2086,  10828,    611,     18,   -830,    978,  -4181,
-  1324,  -5262,   -327,   1796,  -9777,   1306,  -1934,  -8930,
-  9520,  -2364,  -3997, -10209,  -6326,   1394,  -1758,    868,
-  1192,  -2916,    -23,  -1586,   -296,    438,   -279, -14171,
- -1554,   -206,   2383,    506,   1181,   8298,   -491,  -2771,
- -4286,  -7116,  -1680,    506,   1729, -12965,   -925,   -985,
-   420,  -1746,   -267,   -478, -11763,  -1030,    187,  -3878,
-  1516,   2472,   -371,     29,    809,  -1700,   -152,    560,
-  1833,  14397,    968,    -96,  -3242,  -2497,    -76,   2096,
-  9593,  -1200,    446,   1505,   8058,   1722,    501,    923,
- -1171,  -9516,  -2536,   7368,     -2,  -5304,  -2440,   -352,
-   510,    320,    301,    120,    687,   -942,    137,    824,
-  -316,   1312,    510,  -1133, -27448,   -404,   1041,    272
-},
-
-.cb2224l1 = {
--14840,  -1361,  12733,    798,   -496,   1691,  -1668,  -1730,
-   928,  -3233,    338,   -578,    156,    784,   -787,   -242,
-  -618,   -853,  -1282, -11766,   3970,  12178,  -2034,    244,
- -3411,    300,    159,   3494,  -3060,  -1459,  -2484, -10680,
-   752,    227,  -1612,   -922,   -549,    158,   2260,  -7640,
- -4479,  -4075,  -2412,  -7707,    600, -12358,     93,  -1666,
-  -795, -13060,     61,    511,  -2102,  -2122,    364,   -157,
-  2310,  -1552,   1260,    158,   9503,   7050,      7,  -5902,
- -7098,    444,   3736,  -1836,   3109,  -2328,    457,   -871,
-  -327,   -780,    661,   8684,   2530,   -268,    954,   1380,
- -1029,    418,   -136,  -3515,   1953,  -1688,  -8623,  -3292,
-  7758,   2796,  11643,   -931,   -501,   -873,   -444,  -1342,
--13900,   -246,   -283,  -1779,    998,  -1318,    408,   1505,
-  -462,  10667,  -1813,     78, -16514,    360,  -2029,    942,
-  1674,    171,    317,    244,   1183,    724,    760,   1634,
-   863,    793,    126,   -326,    980,   -629,  22219,   -649,
-  1274,    717,   1355,  -1853,  -1792,  -1017,  -2104,   -768,
- -1708,   2302,   2353,  11167,  10734,  -3412,  -2266,     75,
-  -104,    425,   -880,   2072,   2934,   -930,    270,  -2414,
-  -925,   1023,   -746,   -236,  -1620,    825,   1324,   -101,
--19348,  -1291,    585,   2165,   2891,   3662,   -577,   1800,
-   408,  -1486,    107,    351,   -319,   1104,    956,    403,
-   628,   -277,    -57,    938, -32768,    -71,   -441,   -208,
-   -32,    191,    314,   -171,    613,    749,    844,   -472,
-  -444,    952,     42,  -8026,   2720,   1911,  -2780,  12311,
-  -122,   3569,    -91,   6048,   -776,   1694,    -63,  -1272,
-  3581,   1622,   2538,    190, -13108,   -820,  -3056,   1189,
- -1428,   -244,   -752,  -6187,  -3473,   -697,   1368,   1043,
-  7702,    352,   -140, -12999,    -80,  12672,  -1473,   3113,
-  1505,    667,   2392,   1767,    537,   1949,    657,   -130,
-   980,   1743,   8269,   2380,  -2311,    197,   -651,   2531,
-   553,  -1117,   -396,    472,   4565, -12672,   2322,   -360,
--12766,   2205,  -2651, -10690,   -218,    586,   5229,     34,
-    59,   1730,   1226,   2106,   4008,  -1878,  -9520,  -1366,
- -1174,   -290,  -1037,   1642,   1234,    305,  -1279,   -642,
-  1126, -13199,    -29,    642,   2928,   1936,   -260,    588,
- 11690,   9282,  -3362,   7732,   1073,   2738,   4688,  -1507,
- -1461,  -2271,  -1131,   1969,  -2152,   1637,   -774,     66,
- -1190,   -206,   -491,  -1080,    644,   -378,    367,  17980,
- -1583,   2162,    918,   -121,   -432,    115,      5,    791,
-  1968,  -2287,  -1574,  -9545,  11146,   3540,  -4700,   -515,
- -4548,    881,    591,   1044,   -259,   -978,      2,    232,
-   778,   -198,  -1161,   -378,    -83,    421,    282,  26564,
-  -801,  -1628,  -1983,   -301,    931,    886,   2196,   1453,
-   752,   2956,  -3478,    490,  -1420,  13303,   1293,  -9466,
-   462, -12829,  11130,   8061,    593,   3697,   -611,   -534,
-  -698,  -1148,   1598,    293,   -726,   -698,    289,    180,
-   876,   -369,    -43,    234, -21629,  -1448,   -753,   -480,
-   956,    994,    531,   -916,    630,    720,  -2300,  -9544,
- -1418,    993,   2130,  -2359,   2460,   -339,   -277,   1577,
- 12206,  -3507,  -1280,   1938,    871,  -1850,   -809,  -3364,
-  6918,   1134,   5010,   8772,   2103,  -9775,  -1404,   5148,
- -1494,   1549,   1761,   -812,    654,   -611,    822,   -229,
-  -384,  10466,   -337,   2207,    131,   2818,  -2925,  -3374,
- -8786,  -8552,  -2282,     88,  -1058,   8571,   2900,   -529,
- -1569,   1882,   -981,    204,   2955,  -4227,   4196,  -3041,
- 10804,   1822,     82,   1936,   2380,  12992,  -5659,  -3449,
-  1329,  -1668,   1291,  -1726,   8328,    314,   2737,   -677,
-  2384,   -910,   -878,    687,    640,   -721,   -912, -12772,
- -2079,   -398,  -1788,  -2516,  -8711,  -1038,   -985,  -7151,
- -9057,    890,    459,   -298,    918, -10061,    848,   -716,
-  1822,    836,  -9516,   -985,  -1379,   -409,  -2237,   1036,
- -1082,  -1704,   1333,  -1432,  11463,  -2355,  -5975,  -1674,
-  -640,   -554,   8352,   2732,  -5251,   4243,   -354,   3662,
-  -592,  -9317,  -1205,  -1084,   -995,  11288,  -2098,  -1620,
-  2367,  -1286,  -5312,    -64,    540,  -2327,  -2703,  -2013,
- -8649,  -1306,   -948,   1443,    664,   2400,   4706,   4061,
-   387,    -20,   1859,   9283, -18175,    806,  -1401,   1253,
-   596,   2176,  -1682,   2209,    733,   1404,  -6652,   2754,
-   950,   2346,   3629,  -6875,   5069,  -9302,   1472,    942,
-  1184, -10432,    960,   3987,   1985,    421,    300,   -716,
-   938,    500,   -160,    226,    -87,  -1648,  -1857,  -1977,
-  -323,   2305, -13843,  -4148,  -2978,   5430,  -3422,  -1138,
- -2146,   1548,  -1430,    734,   -339,   8598,  -4568,   -496,
-   477,   4969,   2593,   2842,   8645,  -2365,  -7455,  -2687,
-   249,   7516,    -53,    219,   1139,   -668,    566,   -522,
-  1289,     33,   -141,   -920,   2526,  -2797,  16456,  -2000,
-  -758,   -194,  10984,    187,   1686,  -4799,   9671,   1838,
- -1224,   1325,    656,  -5434,   3207,   1813,   1833,  14375,
- 12259,    -95,   -536,  -1746,  -3568,   -442,    964,  -1472,
-  1345,   2692,   -589,    520,    616,    357,    326,  -1363,
- 28603,    700,    473,   -908,  -1129,   1046,   1106,   -471,
-  -472,   -980,     29,    574,   -350,   -545,   -585,  -1936,
-   279,    882,   -880,    -52, -30552,    371,   -154,  -1275,
- -1914,    104,   -110,   1122,   -719,    729,   -743,    360,
-   766,    198, -11674,    612, -10602,   1157,    186,  -3132,
-  3070,   1535,    155,    774,  -9432,   4966,  -6717,    320,
-  5167,    112,   2727,  11228,   1368,   1864,   1197,  -1519,
-  1504,  17863,     49,   2212,    611,  -1788,   2932,    395,
-    32,   -566,   2425,  -9457,    673,    670,   -247,   1617,
--12578,   1408,    462, -14935,   1438,   -808,  -1850,   -784,
-  1856,  -1648,    767,  -1452,  -1652,  -1621,   1016,   1428,
--11203,   4217,  -6410,   2570,  -1016,  -1720,  -9036,   -390,
-    62,  -1245,   3027,   -255,   1646,   1358,   -907,   -864,
-  -118,    874,    268,    252,    104,   -926,   -552,  -1206,
-   965,   -208, -24472,    890,  -1516,   -630,   -885,   -804,
-  -374, -22520,  -1143,   -777,    532,    185,    603,   1775,
- -1887,    413,   -458,  -1036,   -211,   2693,   6976,  -9498,
-  1437,  10163,   2450,  -1574,   4941,    884,   -470,  -3366,
-  4664,    420,   -568,   5703,     10,  -1692,    143,   1592,
--10966,   2891,  -2961,   3938,   1990,   1726,  -5247,   3326,
- -6575,    584,   -277,   -441,   1679,   -520,   1339,   1077,
--11462,   -267,   -351,    201,  10939,   4150,   3890,   1484,
-  2615,   -676,   -448,   2316,  -1278,   9734,  -3039,   2841,
-   964,  -7557,    156,  -7228,   -120,   5533,  -4322,   1796,
-  2555,  -9912,  -3038,   2236,   1190,    222,  -1684,   3273,
- -1768,   6233,  -6442,   8545,    -49,    -45,   2366,    293,
-   308,   -689,    308,    368,   -452,   1125,   2326,  -2335,
--17793,   2027,   -779,    734,  -2032,   1246,  -2898,   4174,
-   -74,    -40,  -3105,  -2135,    996, -12714,   3614,   4936,
- -1928,   1528,  -4158,  -1791,  -2318,    907,   -326,  22513,
-  -660,   1022,    434,   -564,     28,   -112,    252,    372,
-  -842,     -2,    648,   2323,   -614,  23377,   -263,    486,
-  -408,   -362,   -821,   -724,    972,   1248,    444,  -1741,
-  -420,  -1371,   1088,   -565,     22,   -394,    -64,   -292,
-  -103,   -501, -30510,   -294,   -266,    433,   -700,    742,
-  -756,   -407,   -961,   -148,  -1416,  -1041,   -481,    121,
-   346,  10240,  12629,   1476,  -2647,   1350,  -2012,   -262,
- -5621,    714,   4398,  -2732, -10473,   9834,  -5165,   -991,
-  -557,  -2733,  -3460,   5779,    659,   1472,   2029,  -2339
-},
-
-.cb2224s0 = {
--27522,   2628,  -2486,    277,    874,  -2351,   2725,    915,
-   994,  -1209,   -439,   2936,     46,   1014,  -1816,  -3561,
--14386,   3113, -10400,  -1025,   2114,   1328,   -278,   1182,
- -1820,   3928,  -1062,   -282,  -1327,  -1468,   5975,   2342,
-  -630,  -4217,  10116,  -1254,  -2646,  -5210,  -9942,   1904,
-    21,    504,   2325,   1443,   6470,   2598,   8130,    810,
-   304,  -1059,   -645,  14634,  -3198,   4277,   -669,  -7170,
-  1554,  -2321,   2386,  -1072,   2483,  -4141,   2841,   3414,
-  8014,  -3141,  10857,   6634,   3138,   3199,   -320,     36,
- -1366,  -4129,   3157,   2602,   4273,  -2435,   2645,   2986,
- -3712,  -3995,  -5476,  -4693,  -1664,   6384, -11201,   1320,
-  2184,  -5102,  -2984,  -1569,  -2116,  -1513,  14284, -11182,
- -2925,   -731,  -1321,  -6363,   1483,   3463,   1292,  -2065,
-  -357,   9108,   6371,   3840,  -6905,  -8918,   2906,  -1658,
-   757,   1998,   -580,   -708,   2198,   1867,    960,   4522,
-  1896,  -1674,  -4943,   2695,  -2465,  -2078,   9755,  -4853,
- -2602,   3466,   3897,  -3633,   4918,  -2049,   3730,  -1982,
--10085,  -3458,  -1866,     32,  -1706,   3648,   -308,   -942,
- -1630,   1730,    512,  14612,   3415,    974,   3079,    765,
-   897,   -270,  -1813,  -1533,   1118,  -2805,  -2764,   1130,
- -1798,   4594,  -3134,    964, -20082,   2574,  32450,  -1379,
-    52,    358,   -226,   1902,    257,  -1071,   -650,   -399,
-  -381,   2073,   2310,   2164,   8221,   1433,   -629,   1440,
-  1120,  -3362,  -4642,   2000,    378,   1208,  -2648,   4534,
-  3307,  13200,   2780,   3100,  -3194, -10606, -11563,  -4491,
-  2218,  -4500,    622,   1313,   2682,   3003,  -1387,  -3886,
- -1567,  -4864,  10899, -20606,  -1606,    -60,    602,    125,
-  -730,  -1112,    979,    325,    -13,   -185,   1241,   -288,
-  -552,   6042,  -7049,  -7359,  -1456,    493,  11204,    -65,
- -2170,  -5248,   2248,  -1046,    591,   2085,  -2844,    244,
- -3454,    581,   1315,   3043,    304,   -620,    405, -19944,
-   769,   1076,  -1456,   -694,   2560,  -1046,   2514,  14552,
-  1586,  -7027,  -4710,   1366,   1552,   4354,   3296,    462,
-   600,    500,   3225,   5083,   -792,   3199,   -698,  -3589,
- -2596,  -3350,   2758,  -3019,   5664,  -9387,   4716,  -3125,
-  3306,   6268,   -592,   -622,  -4144,  -6290,   4990,   -748,
-  1854,  -1042,  -2996,  -4279,    338,  -1864,  -8639, -11208,
-   932,   -722,   1788,  -1927,    450,   2191,  11828,  -6400,
-  5364,  -2236,   3212,   8340,  -3229,  -2846,  -4676,  -1825,
-  2628,   -303,   -589,   7728,  -4216,  -3866,  -4400,   -194,
--11316,   5646,   3716,   4827,    232,   -583,    308,  -1833,
-  2153,  -2508,    -46,    857,  -9587,   2768,   5136,   1462,
-  5142,   7990,  -3424,   1067,   7462,   4944,     98,   1014,
- -4750,  13824,   1130,   2334,   9393,   2416,  -4519,     27,
-  2000,    929,   -204,    481,  -2780,  -3720,   1267,    269,
- -5383,  -1999,   1249,  -4238,  -9351,  -7440,  -5964,   6154,
- -6827,   3112,  -2613,   -164,   1604,   1245,    -50,   8619,
- -4044,   4652,   2846,   8359,   5345,  -2902,   2295,   4801,
- -5016,  -6270,   2893,   2732,  -3510,  -2613,   4548,  -6376,
-  4510,  10566,   1859,   1038,  -8381,   2782,  -1622,    159,
- -1035,  -3232,  -3766,   1580,   -720,  -4476,  -3863,   -920,
- -2135,   -458,    352,  -2645,   3029,    301,  -1145,   -478,
-  3696, -11700,   9930,   6649,   7290,   2362,  17226,   3238,
-  1786,    662,    971,   -736,   -647,   1745,   -506,   -777,
-  1458,   2406,  -1417,  -7933,   -846,  -2654,   1104,    618,
- -2783, -10168,  -3322,   9498,   -939,  -2342,  -1876,  -1914,
-    84,   3468,  -6533,   7796,  -3797,  -1318,  -2183,   1310,
-  -895,   4943,   1062,  -4468,    142,   -244,    884,    613,
--13963,  -5853,   -947,  18703,   -964,   1090,   1070,   1388,
- -1572,  -1110,    671,   1706,    620,   -262,  -2421,  -2277,
- -5665,  -5212,   4994,   2379,   -593,   2048,  14489,   1165,
- -1775,  -2093,   2466,    419,    404,   5429,   3089,  -1350,
-  1975,   2281,     60,    599,  -1600,   2286,   2358,   6698,
--16423,   3760,    666,  -1309,  -1346,   2786,   2364,   1448,
-  1114,  17956,  -5301,   2430,   1178,   -164,   2195,   3927,
-  -122,   -737,   1468,    307,  -1863,   1592,  -7714,  -2428,
-   958,    220,     59,   4124,  -1945,  11151,   8604,  -2077,
- -4787,  -4578,   1096,   2685,   6478,   8314,  -6221,  -3842,
-  2173,    -43,    104,  -2510,   3109,  -2324,  -4238,  -4709,
- -3233,   3228,  11454,   2428,    578,    780,  -1096,     72,
--22624,  -1421,  -4104,    226,    464,  -1726,  -1971,   2068,
-  1142,   1412,   1412,    798,  -2605,  -3451,  -1104,  -2224,
- -2250,  -3470,   -572,  -1420,  -1292,    -58,   -217, -21417,
-  -172,  -6368,     30,  -2170,     95,    378,  -2926,  -2180,
-  2820,   -683,   2018,  -4313, -13469,   5396,   1808,   -592,
-  4732,  -6602,  -5602,   -983,  -4130,   -477,  -1236,  -2263,
-  3992, -12962,  -1778,  -2631,  -2421,   -746,   1964,   1754,
-  -760,   2753,   -116,  -3860,  10246,   -448,  -1318,   -100,
--10372,   1420,   -210,   2768,     48,  -2373,   7721,  -3217,
-  -328,   1543,  -2527,   3709,   4024,   -916,  -4588,   -726,
- -4302,   -982, -14714,   3615,  -1190,   9051,    199,   2252,
-  1348,  -4204,    693,   1241, -14160,  -2460,  -2017,   2997,
-   766,   -360,   -450,  -2919,  -7976,   3210,   -179,   8935,
-   670,   1155,   6888,  -2249,   2729,   1810,   6283,    684,
- -9717,  -1763,   -921,  -4578,   3941,  -6408,   1431,  -2742,
-   -91,  -2094,  -2118,  -9752,   2801,  -2497,    147,  -5901,
- -5270,  13170,   2810,   1576,  -3191,  10253,   4226,  -1340,
-  2456,   1079,  12541,  -5124,  -8356,  -1000,   -558,    180,
- -2070,  -1880,  -5718,   -687,  10549,   1066,    220,  -4147,
-  -695,   3648,  -3460,  -3143,  -1623,   2150, -11222,  -2566,
- -6395,   3552,  -4176,   -698,   1248,    112,  -4628,   -960,
-  -724,   1191,   2084,  15207,   -346,    371,    190,   5345,
- -4283,  -7482,   1354,  -4424,  -3775,  -4143,   1444, -14876,
-  -589,   2498,   1305,   -486,   1628,   -867,   1584,   1094,
-   -10,  -1260,  -1046,   2528,  27472,    910,  -1069,    829,
-  -117,  -1097,    770,    252,  -1412,   2353,   2200,    -11,
-   624,   8459,   6320,  -9465,   1225,   2532,   5415,   9252,
- -1441,  -1378,   1081,  -1997,  -3904, -14740,  -5220,   3627,
-  5725,   6180,  -5336,     72,   4638,    915,   -496,    628,
-  1880,   -420,   2800,  -7143,  -7578,   3180,  -4210,  -1111,
-  2979,   -442,   -182,   2778,   2398, -13878,   2209,   -282,
-  -888,    180,   3584,  -1005,      2,    999,  -3074,   1205,
- -4605,   5250,  17255,   2839,   2718,   -678,  -2651,    160,
-  1596,   4685,   2324,   3100,   3744,  -1954, -11674,    621,
-  -678,  -6242,  -3449,  -1890,   3134,   -289,  -7162,   2268,
- -8437,   -624,   4999,  -5946,  13013,    244,   -200,  -1494,
- -1108,   3768,    445,   2429,  -1264,    786,  -2993,   3482,
-  2448,   -968,  -1184,    213,   -772,   4931,     42,  -3850,
-  2020, -17970,     84,   3016,   -602,   1805,    731,   3522,
- -2606,   -637,  25535,    680,   1083,   4138,   1602,    190,
- -1854,   -962,   -379,  -2499,   2453,   -362,  -4552,   4689,
-  2168,  -5930, -10552,  -5585,  -4694,   2447,   2047,   5420,
-  3908,  -1449,    -90,    -68,    496, -12713,  -2127,   1406,
--10766,   2438,   2278,   2962,  -6411,    -22,  -1966,   2814,
- -1746,   -383,  -2381,  -5981,  10920, -12354,   -656,   2260,
-  5200,  -1908,  -2275,   4276,   1174,   -932,   -532,   2832,
-   601,   1551,  -8434,  -4170,  -6411,   9099,  -6886,   2243,
-   561,   2026,  -3598,  -1125,    646,  -5188,   6017,   -632,
-   772,  -2919,  -3776,  -9938,   2461,   -122,    128,  -1416,
- -1533,    343,   1318, -13738,  -1528,  -6418,  -1196,    832
-},
-
-.cb2224s1 = {
- 32767,   -749,  -1885,   -806,    739,  -1858,   3902,   1029,
-   332,  -2122,   1240,   2705,   1362,    190,   1058,  -1404,
-  1224,   1122,   1208,    190,   1984,  -1355,   1694, -21000,
- -1012,   2418,  -1269,  -1154,   1113,   2291,  -2317,    315,
- 12872,  -2296,  -1510,   1104,  11324,  -1146,  -1018,   1326,
-  -902,    168,    647,  -1828,  -3838,  -5682,   2732,   -238,
-  -134,  13450,   1570,   2424,    996,  -3494,  -3720,   4897,
-  5875,    149,  -6367,   6659,  -2329,   6916,   1134,    425,
--19014,   -479,  -1900,   3470,  -1777,   -811,   1723,    -46,
- -2103,  -1298,   2929,  -4279,   -639,  -2443,   7231,  -1187,
- -2145,   -777,  -3287,   4895,   8878,  -9318,    289,   4015,
- -3148,   -598,   2226,  11700,    114,   3237,   9586,  -4570,
-  2592,   3614,  -2272,  -2829,  -3356,  -1095,  -5290,   4709,
- -1867,  -1930, -20722,    937,    892,   1415,   1544,   2950,
-  5090,    937,  -1411,    123,    -31,  -1568,    338,   -938,
-  5465,   5796,    480,  -2782,   3351,  -2489,   -383,   1529,
- -5686,   2446,   -693, -12796,   -599,   1894,  -1576,  -2244,
- -4686,  10165,  -1085,  10050,   2681,   1138,   2544,  -1809,
-  -806,   5278,  -8730,  -3740,  -2343,    971,  -3254,   -165,
-  -212,  -4164,    850,    233, -13694,    442,   1073,   3854,
--12926,  -2001,   3468,   -765,    829,   2174,   1531,  -6036,
--10848, -11009,    803,   1713,   2884,   1992,     75,  -2989,
-   268,    346,   1998,   4798,   8976,  -4632,   1863,  -4127,
-  -612,   4790,  10946,  -1296,   8009,  -1351,    356,  -1711,
-   313,   2301,   1318,   8050,    700,   1218,   2270,  -2156,
-    67,   1537,   1941,   3442,  13321,    691,   2344,   2594,
-  1551,   3853,   7279, -10441,   1006, -11862,   5532,   -611,
-  -582,   2257,  -2873,   3993,  -5133,  -2264,  -2478,   1576,
-  1834,  -4931,  10264,  -1429, -10404,    393,  -3715,  -1470,
- -2003,    384,   4869,  -6780,  -1297,   1572,   1043,   6980,
- -4382,  -3005,   3698,   4176,  -1348,  -4972,   1574,   9815,
- -5995,   -979,   3609,   3702,  -8503,    668,   3354,   2552,
-  9183,  -1175,   1224,  -2859,  11176,   6088,  -1355,     84,
-  1271,   -380,   5336,    299,   -690,   -365,  -8047,  -3679,
- -3204,   1334, -13451,  -1392,   2200,  -3646,  -1046,  -4292,
-   741,  -1701,   1722,   2061,  -1358,   7266,  -6356,    963,
-  2190,  -1349,  -1882, -14128,  -4662,   3552,    565,  -1109,
-  5413,   1239,  -2618,    794,  -2064,  11805,   9004,  -2134,
-  2804,    946,     80,  -2387,  -1205,     11,   1642,  -1825,
- -2324,  -5018,   4208,   5285,    661,  12430,   1907,    784,
- 10864,    340,     18,   -138,   2885,  -2247,     17,    334,
- -3172,   2977,    970,    536,  -1540,   -516,   -488,   -512,
- -1334,  -1930,  -2418,   1078,  24837,     12,   2060,   -252,
- -2536,  -2206,  -3179,  -6785,  -8842,   8736,   1393,    119,
-  1652,  10126,    856,    855,   -742,   -289,  -2208,   3831,
-  6909,  -6556,   2472,   -245,  -1729,   1460,  -3014,     59,
-   -58,    132,   3903,  -3762,  -1419,  13273,   2708,  -7752,
-    84,   3525,  -1305,   -334, -13421,   5931,  -4845,  -2697,
-   666,    558,  -1102,    632,  -2946,   4153,  -4018,   4516,
-  4875,   4460,  -1567,   2233,    386,   -754,   1256,   2145,
- -1692, -13046,   1581,   -518,   4397,   1215,   -723,   3413,
-  -640,  -5088,   1711,   -714,   2536,   2433,   -691,  10758,
- -8764,   5541,  -2071,  -1662,  12955,  12998,   1252,    -94,
-   802,   2573,  -2557,    -66,   -832,    106,   -728,   1050,
-  -811,  -2684,    629, -16524,   1531,  -1617,   1348,    204,
-  1722,    368,    554,  -1752,    114,   1349,   1952,  -1007,
-  2626,   2035,   8148,  -2539,  -4296,  -4460,  -8542,  -3089,
- -1543,   -857,  -2617,  -1765,   6642,   2167,  -1531,  -6881,
-    86,   -414,  -5896,  -5152,  17445,   1129,  -5006,   2936,
- -3432,  -2226,   1176,    972,   1170,    530,   3390,    260,
- -2909,  -3550,  -5255,   1771,   -382,  -1690,  17070,   2688,
-   566,   2430,  -1768,   3373,   1460,  -3464,   -629,   3119,
-   430,  -3554,   8357,   7075,    293,   2955,    -61,  -6919,
- -4939,   3678,  -6852,    652,   2206,   5918,  -2768,  -3022,
-  5721,   -770,  -1102,  -1057,  -2760,   3086,   5611,   -160,
-  2714,  -1042,   2569, -14248,   3846,   8212,   5392,    144,
--11896,    618,   1212,   3283,  -3777,   -715,  -3870,   2528,
- -2900,   1645,  -1786,  -1852,   2776,  -1348,   -586,    234,
-    -4,  -1666,     46,   2095,  -1987, -18728,  -2980,   2501,
-  4042,     79,  -1849,  -2013,   8047,  -1898,   -108,    340,
- -4760,   2134,   9000,    347,  10365,   4779,   6660,   1694,
- -3253,  -2282,  -1488,  10406,  -8054,  -3414,  -2934,  -1611,
-  3172,  -2195,   4973,   1249,   2888,  -4054,  -5738,  -2995,
- -2282,   1977,   -353,   -516,   5322,   3225,  -4907,   1303,
- -4656,   9947,   -236,   9382,   2332,   2076,   1470,   3173,
-  4712,   2645,    559,   4904,   1511,  -1715,  -4856,   5750,
- -1276,   -306,  -5980,  14393,   1443,     85,    156,   7718,
-   793,   4199,   2122,   1098,    128,  -1996,  -1397,    -20,
-  -534, -13296,  -1518,  -2970,  -1001,  -6474,  -6146,   8337,
-  5476,   3058,   -526,  -1295,   1623,  -8791,   1257,   2006,
- -5725,   3035,  -2917,   1280,  -8479,   5934,   9870, -13131,
-    14,   1088,     -9,   1969,    366,  -3214,    192,   2764,
-  1499,    346,  -2031,  -2900,  -2529,   1072,  11717,   5206,
-   -44,  -2514,  -8900,   2892,   2132,   3635,   3735,   2726,
-  1398,   6035,  -2830,  -4568,    424,  -8696,   1368,  -3860,
-  1823,  -2620,   4546,  -2210,   1660,  -1672, -10524,   -484,
-   950,     11,  -4494,  -6220,  -5653, -13332,   2868,    460,
- -4120,  -4030,  -3277,    522,  -3403,   1126,   -170,  -1892,
- -4366,   1304,   3477,  -1507,   1111,   -594,   1670,  -8416,
- -1690,   2492,  -7109,   2531,   4131,  -8123,  -4884,  16505,
-  -240,    -63,  32099,    974,  -1360,  -2395,  -2005,  -1156,
-  -877,   -416,   -922,   1857,    766,     71,   1380,   -259,
-  -272,  -1924,   2498,  -3290, -16045,  -2064,   2966,   2936,
- -1265,   2121,    488,   3781,   1484,  -1193,   4776,  -1001,
-  -669,   1569,   -379,   -604,     -5,  -1943,    757,    359,
-  -560,    118,  17941,   2323,    215,   7621,  -3582,  -8130,
-  -698,   9893,  -2752,   -417,  -1262,  -1504,   3319,   1186,
- -2192,   3014,    781,  -3602,  -6190,  -7725,   3169,   2038,
-  1175,    612,   2477,  -4136, -12152,   4538,    567,   -116,
- -3222,   -470,   -118,  -9257,   -635,   3078, -11596,     93,
- -4178,   4150,   5985,   4414,  -2110,    542,  -1125,  -1242,
-  -234,    807,  -1385,  -2448,    824,    109,  -1826,   3032,
-   269,  14188,   3468,    908,    -12,   2290,   5758,   1685,
-   680,   5963,  -2763,   -173,    -34,   3135,   1230,   2226,
-  2471,  -9546,   2266,  -1583,    729,   3506, -10664,   -652,
-  2212,   -620,   2762,   -751,  -6337,  -4339,   4131,  -1234,
-  5423,  -2279,  -2884,   -929, -12582,    416,   2046,  -3854,
- 11130,  -2738,   -670,   -202,   6216,  -7266,   9726,   1308,
- -1761,   4696,  -1061,   -144,    482,  -1586,   4377,  -5016,
- -3894,   2296,   4340,   -555,  -3003,  -2117,   -962,    100,
-  4548,  -1870, -13885,   1351,  -3226,  -8114,    377,   -391,
- -1344,  -2148,   4756,  -3518, -14429,   -670,   -238,    400,
-  1234,   4389,   1181,   1046,    425,    -32,    840, -29846,
-  1580,   -992,   1844,   1961,  -1305,   1055,    418,     52,
-  -641,   2430,  -1773,  -5323,   3341,  -5367,  14027,   3051,
-  3864,    404,   4186,  -1875,  -5822,  -4321,    112,    395,
-  -177,   1080,  -3008,    520,      8,    226,   1430,  -1635,
-     8,  -2632,  -3249,  -3595,    622,    564,   8404,  14463,
-   160,  -7828,  -4113, -16547,    848,   6320,   2311,   4074,
- -2050,    668,   1463,  -2322,   1790,    864,    317,   -594
-},
-
-.cb2224m0 = {
--17338,   5737,   -912,   5906,  -5315,    920,   2743,  -2232,
-  1943,   -753,   1696,  -1818,  -2272,   -564,  -1306,   -527,
-  -156,   9952,     36,   2524,   2053,   1841,  -1670,  10622,
-  2532,  -5616,   -324,  -1132,  -1148,   1920,  10232,    -75,
-  -630, -10796,   1618,   1104,  -2557,   -603,   2115,    966,
- -3763,  -3183,   -851,   4502,  -1565,  10062,    313,   -709,
- 10707,    867,   3820,  -2747,   3470,  -1942,   -486,   4092,
- -6289,  -2363,    556,   3190,   5046,  -1869,   2886,  10572,
-  -948,  -4191,   1544,  -1727,    721,  -3153,   -712,    934,
-  1610,   1070,   1248,  10645,   2340, -11102,  -2744,   -353,
-   -65,  -4973,  -1782,  -1037,   1210,   1192,   1138,   1106,
-  9422,    652,  -9595,  -1663,    460,   9107,  -2827,    775,
-  1131,   4732,     93,    476,    387,  32767,   -161,    266,
-  -406,    604,    675,     83,   -589,   -639,    220,   -830,
-  2200,   -142,  -2000,   -128,    902,    823,    287,    717,
-  1857,  -1626,    208,   2784,    -72, -19310,   6190,  -2063,
- -9101,   3419,   1721,  -2092,    332,  -6533,  -7594,   1138,
-   807,  -2582,   -668,    410,   -497,   1526,     96,    944,
-  3319,   1294,   -335,   1964,   -380,   -618,   3069,    101,
- 18964,  -2298, -10304,  -1190,   -998,  -1384, -11466,   -256,
- -4475,   4027,  -3532,   1828,  -1311,  -3417,  -3925,   -221,
- 27688,   2277,  -1227,   1043,   -399,  -3327,    515,   1665,
-  -616,   2724,   -546,   4608,   -576,   -103,  -9064,  -1281,
-  -563,  -3588,   2174,   -824,   3379,  -2360,    354,    844,
- -7044,  -2295,  -2613, -11152,   1006,  -1064, -17007,   1180,
-   387,  -8448,    836,   -578,   2621,   -356,  -1476,   2362,
-   822,   4547,    118, -11628,    352,    367,   -958, -12423,
-   -65,  -1591,  -2304,  -2880,   1684,   1708,  -1693,   -781,
-   -71,  10012,   -534,  -3672,    417,  -2048,  -1955,  10491,
- -1257,    861,   -414,  -4058,   3042,   1529,  -5823,   6877,
- -3918,    993,    221,   2576,  -7780,    170,   -648,   -139,
- -3410,   7974,   -756,   2657,   -596,  12527,   -199,  13752,
-  2198,   -938,  -2265,   1736,    257,   1517,   -676,  -1165,
- -2874,  -2433,    123,   -829,   2605, -10270,  -3158,   3624,
-  2072,   6960,   1490,   4634,    455,  -8175,   1139,  -4545,
- -1491,   3727,  -8738,  -1951,    593,     14,   2897,   2490,
- -2273,  -1436, -10992,   3005,  -4392,  -3434,  -4561,  -1014,
- -9506,  -1609,  -1248,  -1593,   -190, -10472,   3264,  -2274,
-  5097,   -633,    473,    427,    725,   1577,  11032,    318,
--12228,     78,  -1116,    441,   1930,   4041,   -648,  -4324,
-  -224,   2738,   8826,    -40,    327,   1761,   2371,    171,
-  4039,  -3411,  -2495,   1150, -12181,  -1704,     35,    528,
-   417,    626,   1866,   -472,    466,    905,   -854,   -875,
-  1194,  24371,    488,     26,    695,   1777,    798,   -169,
-   -16,  -1252,    395,    871,   1170,   -635,  -1637,   2094,
- -5427, -16393,   -384,   3872,     33,   -687,  -1777,  -4160,
-  3020,  -1906,   3868,    699,   -400,   6755,  -3253,  12699,
-  1474,   7312,    991,   -646,  26770,   2524,   2144,   -500,
-  1096,  -1869,   1036,  -1707,    521,  -2091,   1445,   2335,
-   107,    238,   -227,   -120, -32768,    591,   -257,    867,
- -1231,    650,   -465,    356,    431,    762,   -516,   -594,
-   512,    242,   2298,   1012,  -1538, -11748,   3551,  -5608,
- -2174,  -2428,  10557,    625,   1002,  27865,   -589,  -1527,
- -1552,    156,   1905,   1041,  -4190,   2300,   1603,   -980,
- -1764,    484,   1555,  -2664,    381,  11676,  -8848,  -3060,
-   675,   -646,    736,  -1279,  -1261,  -1988,    543,  -1880,
-  1917,  -2165,   2846,  11863,   2076,  10381,   -307,   4354,
-    73,  -2788,  -2464,    964,   -218,   1552,   1846,   1470,
-   577,   -594,    725,  30798,     43,     13,  -1474,    260,
-  1218,   1433,   -114,   1020,   -648,   -678,  -1879,    -65,
-   791,    366,   8547,    931,   1091,   1018,  16312,  -1116,
-  -777,  -1098,    404,    180,   -899,  -2865, -10089,   -751,
-    40,  -2358,  -2980,   3574,   7905,   -190,   9207,    -18,
--18766,   -270,  -5300,  -2023,   2422,  -1189,   1267,  -1085,
-  -704,   6823,   2164,      2,    125,  -2319,    411,    591,
-  -488,   -566,  -3394,    304, -12375,   -268,  11098,   -150,
- -2392,  -1255,   3172,    162,   1295,   5897,   7944,   6019,
-  3329,  -2014,   2957,  -4933,   4805,   2780,  -5453,   2680,
-  3220,   2784,   -549, -19908,  -1222,    550,  -3540,   1822,
-  4082,   2399,  -6844,   2145,    938,   -597,    122,    -20,
--14986,  -1620,   1575,    561,    408,  -6305,    760,   1634,
-  2652,  -8301,  -2988,   1864,   2524,   3228,   7466,  -2620,
-   410,   1364,   1740,   2204,   1999,   1704,  -2601,   -351,
-  -104,  10688,  -7166,    134,   -346,  11852, -13322,  -3171,
- -1230,   1109,  -2336,   -962,   -563,   1030,   2832,   -969,
- -1997,   3233,   -414,  -8246,  -2074,   2737,   3557,   1625,
-  1036,    845,   1848,   1710, -10388,  -4586,   6915,   2734,
- -8693,   -667,   1568,   1758,   2396,  -3262,  -2497,  -1472,
--11848,   -689,   3379,   1692,   1449,   2844,   8524, -15598,
-   337,    590,   3303,  -1594,  -2548,   4529,    433,  -1921,
-   920,   1061,  -1693,    191,     44,    957,  -2397,  -1126,
-    41,   2164,  -1587,    568, -17290,   4687,  -1028,   -403,
-  1169,  -1282,  -1602,    242,  -1234,   1870,   1067,   2444,
-  1752,  -2552,   8775,   1384,   5683,  -4770, -12436,   -680,
--13344,   -196,   -276,   -299,    734,  12378,   2364,    327,
- -1494,    560,    -90,   3394,    496,   2357,    629,    -17,
-  1040,   -706,    589,    294,  -1135,  25012,    444,   1206,
-  -298,   1424,   1524,  -2188,    -64,  -1101,  -1998,    374,
-  1377,  -1382, -11349,   1456,   -171,  -2369,   6966,  -2808,
- -8987,   3390,   -811,    671,   3032,  -3396,  -9815,   2246,
-  4418,   -678,   1851,  -1592, -11038,  -1194,  -3612,   2589,
-  -250,   -495,   1203,   1348,   -805,   1853,   -345,   -555,
- -8755,  -9695,  -3768,  -1506,  -8172,   -322,  -7163,  -6319,
-  2052,    116,  -4459,  -2328,   4857,  -2569,   1419,    959,
-  1138,   7034,   4836,   3449,   6826,  13411,   -893,    981,
- -2060,  -3710,   3177,   -761,  -1128,   4386,   -127,   6698,
-  3426,  -2922,    -61,    408,   1426,  -1238,  15468,     94,
-   373,   3597,  -2432,  -1989,   -859,  -8976,   2938,   -777,
-   409,   -206,  -7758,   3384,    295,   -466,     29,   7925,
-  2048,    930,   2296, -10030,    330,   7864,  -1004,   -385,
-  2130,    388,   3587,  -4480,   1560, -12768,  -2606,   8178,
-   771,  -3519,  -1590,   -592,   2192,  -1126,    -77,  -3947,
-  1868,  -1304,  11107,    781,   6240,   4134,  -3314,    407,
- -6125,   5168,   -503,   2155,   -990,    143,    219,  -9950,
- -1186,  -1446,   1930,  -8963,  -4084,  -6141,   -976,    153,
--13665,    564,  13631,    138,   -269,    379,   1333,  -1710,
-  -940,   -511,   1214,  -2190,   1347,  -1397,  -1321,     94,
- -1802,   6627,   1306, -12347,   2780,  -1091,  -4362,   5047,
-  -446,  -3472,   6064,   1075,    478,    769,     58,    802,
-   562,  -1581,  28580,    194,   1338,    573,   -555,    617,
-  -409,  -1249,     -8,   1133,    952,   -120,   2502,   5313,
-   969,  -1664,   1769, -12199,   5551,   -402,   4862,   3270
-},
-
-.cb2224m1 = {
- 32767,    -54,   1385,   -206,     19,    522,  -1176,   -667,
-  -260,  -1388,  -1751,  -2234,    228,   -343,   -893,   -898,
- -1004,   2517,   -232,  20996,    507,  -1857,   2574,    840,
-  -615,  -1922,    660,    844,     52,   1272,    609,   -692,
- 21805,    938,    678,   -399,    -22,  -1839,   -996,   1560,
-   218,   3973,  -6547,  -1151,  -3914,   -789,    938, -11509,
- -2282,   -606,   -327,   3088,    797,  -1540,  -7598,   1378,
-  -100,   2108,  -1907, -11671,   1538,  11136,    310,  -2096,
- -3037,   3181,   1731,   2043,   3424,  -1098,   2046,    545,
- -1778,    605,    932,    832,  -2356,  -1498,   1129,  11542,
-   119, -10994,  -3720,   4316,    346,  -9141,   3921,   -918,
- -5476,    372,   -318,   9254,   -681,   4896,   1587,   1620,
-  1850,   4057,  -1507,   -362,  -1074,   -328,  -1502,  -3092,
-  2735,   -378, -11572,  -1292,  -2575,  -3397,  -7566,  -8977,
-  1670,   8659,   -655,    884,   1815,  -9348,    570,    394,
-  1670,   1942,   -195,    386,    553,   8885,  -9206,   -624,
- -2312,  15852,    782,    562,  -1497,    720,   1804,   1415,
- -3809,   3783,  -1918,  -3496,   -637,    581,   1161,    961,
-  -960,   -930,  -1673,    904,  11510,  -2286,  -9964,   2964,
- -5752,   2229,    786,  -1479, -18882,   1517,    128,   3282,
-   157,  -2178,   -564,  -6029,    766,  -4599,   3620,  -4380,
--20114,   -677,   2134,    -93,   1486,    648,  -4790,   1862,
- -1476,    -56,  -3443,  -2622,  -2806,  -1185,    122,   1801,
- -1547,  12241,  -2785,   2386,     56,  -4075, -10964,   -832,
- -4744,  -1350,   2849,   -255,  -1375,    163,   1306,     37,
-  2304,  -1396, -11234,   9712,   1732,  -2262,   3632,   -431,
-  -579,  -4045,    806, -12168,  -1309,    840,  -1474,    918,
- -1240,  -1601,     48,  -4137,   6934,   3968,   7370,   4088,
-  8648,   2351,   1466,    615, -12314,  -2347,   4382,    862,
- -4288,  -3138,   1886,  -4357,    375,   1949,     73,    287,
-   135,    -60,  -1498,  -2427,   1263,   3322,   -582,  17508,
- -1202,   1558,   3351,    484,   -439,   -571,   -370,  11952,
- 11656,  -1407,  -1410,  -2976,   -459,    397,   1980,  -1374,
-  1237,   5044,  -2074,    405, -10650,   -174, -12556,  -1962,
-  4569,  -1293,   -200,   3106,    343,    748,   1918,   1084,
-  -670,      3,  -1070,   -397,   3965,   9966,   -609,   9691,
-  -900,    137,   2305,  -5944,   -944,  -1500,    638,   -703,
-  -582,  10098,   -523,    776,   1266,   4860,   6213,   1181,
- -5634,    518,   9116,  -4740,  10683,   -547,  -1295,    -91,
-   104,  -3115,  -1724,    -17,   1953,   -745,    694,   -474,
- 12248,   -596,   -674,    765,    674,   4494,   1205,   5883,
- -1638,  -3996,   -664,   8694,  -5620,   3968,   -717, -10425,
-  -285, -12605,    368,  -3904,  12363,  -1288,   1242,  -1497,
- -3117,   2396,   -220,   1700,  -2788,    250,    107,   -150,
-   345,    681,    -44,  -2466,   -389,   2098,    312,     54,
-  2734, -22225,  -1232,  -1778,   1063,  -1586,  -6658,    344,
- -2889,  -4348,  -3685,  -2100,     12,  -1755,  -6401,   -149,
-  8150, -10689,   -748,   1443, -32768,   1698,   1461,    216,
-  1373,  -2814,   1014,   1135,   -227,  -1309,   -616,   1566,
-   395,   -724,    852,   1579,  -9647,  -1214,    728,    329,
-  9244,    179,   7204,   -836,  -3954,    168,  -5722,    152,
- -2886,    472,   -651,   5114,   8734,    -71,  11406,   1098,
- -1452,   1190,    598,   -880,  14611,  12540,  -1523,   1340,
-  1015,   1510,   -208,    206,   1314,  -1532,   -246,  -3210,
- -1637,   -197,    197, -32768,   1448,   -191,  -1720,   -217,
-  1021,    973,  -2099,     56,    606,     39,  -1569,  -1205,
- -2375,  -2156,   4798,   2504, -11914,    933,  -6015,   2657,
- -2911,  -5173,  -1964,   1576,   5268,   1190,    675,    856,
- -1718,  -4332,    166,   1556,  19005,   2040,   1198,  -2170,
-  1824,  -3409,    121,    830,   -252,   -525,    289,  -1701,
-   292,    854,  -1150,  -1108,    171,    511,  22114,    662,
- -1263,   -540,  -2306,  -2332,    869,  -5191,    186,    536,
-   410,  -7576,    590,  13625,   3519,   3858,  -2787,   -376,
- -6506,    891,   5025,  -2054,   8316,  -2115,   7668,  -5808,
- -2464,  -2422,   1541,  -3851,   1578,    420,   -617,  -6507,
-  -858,    160,   3876,  -2830,  -5970,  -3295,   9829,   1099,
-  1617,   3502,  -3124,  -4116,    138,    287,    914,   -548,
-  1056,  -1546,   1218,   -227,  11632,   -574,   -996,  -9894,
-   808,  -5868,  -1457,   8374,  -2086,   -280,   1038,    528,
-  1862,    284,   3926,   -144,   7168,   1224,  11628,   -221,
-  1018,   1683,    922,    561,   6910,   1895,   3044,  12613,
-   -74,  -1424,   1654,   8872,   2255,   -990,  -2039,    269,
-  9558,  10122,    958,    466,  -1948,  -1242,   1042,    886,
- -1143,  -3444,  -8720,   1918,   -300,  19074,  -1629,    991,
-   908,   -896,   1207,   3602,  -4802,  -2912,   4100,   2936,
- -1344,    459,  -6904,   -714,    524,    171,  -1430,   1454,
- -2725,   1130,   -757,   2861, -11174,  -2768,   5466,   3662,
-   110,  -1999,  12376,  -2173,  -2508,  -2838,  -2025,  -4378,
-   134,  -9856,   1738,   1027,   1428,     38,  -1560,  12824,
- 13932,    549,    586,    720,    923,  -1040,  -2827,  -3272,
-  1902,  -2113,   2624,   3296,    -34,  12291,   1449, -12138,
-  -796,    186,   2777,  -1007,   3276,   -587,  -1917,   -130,
-  2120,   -564,   -364,   1005,   -615,   1504,  -2412,   9219,
--11412,  -2490,   1262,  -2720,   1608,  -3276,   1294,   1882,
-  -188,   7090,   6029,  -4207,  -2739,     72, -10035,  -1672,
-  1509,   -124,  -1649,    420,  -3623,  -1069, -11225,   -754,
-  -388,    790,  -3209,   -330,  -2632, -11920,   3178,  -1788,
-  2585,   4146,   1944,  -2757, -10616,    220, -14136,   2158,
-  -274,   2010,   -362,   1107,   -348,  -1990,     96,   -985,
-  1599,   1566,   1393,    304,  -1380,   -924,   -285,    620,
-   -30,   -902,  26210,   1485,   1042,  -1160,    352,   -177,
-  1245,   1879,    -18,    727,   -421,    223,  -1298,   1066,
-   962,   1306,   3866,    870, -18780,  -3873,    107,  -1408,
- -1261,    808,   -818,   1738,   1439,  -2156,  -1499,  -2108,
- -4626,   4039,   -964,  16682,  -1169,    266,   9373,   1238,
- -2728,   2381,  12159,   2155,   -472,  -2293,   -513,   3808,
-  -690,  -2190,  -1139,     -6,   1379, -22803,   1380,   -612,
-   308,   1394,   -902,  -1454,  -2620,  -1080,  -2864,  -3301,
-   108,    218,   8718,   -617,  -1098,   1436,  -2005,  -3966,
- -2658,   6152,   -874,  -4636,   8705,  -3382, -12072,    418,
- -1837, -12582,    270,   -788,  -1174,   2156,    461,   -297,
-   478,   -632,   -356,   5796, -12024,    416,   2602,   3544,
- -1240,   -970,   4874,   7221,    704,   8940,   2316,   1174,
-  2537,   5380,     -5,  -1818,   3020,  -4120,   7042,  -9618,
- -1622,   3576,   2455,   -298,    451,  -5298,   7371,  -1570,
--12956,   9758,   -216,    889,   5395,  -2779,  -4036,   1736,
- -1871,  -2036,  -1119,   1847,    912,   2292,    850,    220,
-  1300,   2228,    399,  -2885,  -2696,   2399,   3179,   6266,
-  1629,  13091,   -232,  -5322,   1397,   -724,   1666,  -2012,
-  3643,   1400,  -2724, -18007,   -506,   -103,   1318,   2473,
-   965,   -587,   1135,   -904,   -510, -10767,   1937,   -585,
-   -73,  -1662,   3021,    340, -12475,  -1618,     -1,  -1914
-},
-
-.cb2232l0 = {
- -9947,   -673,    522,    -36,    396,   -433,    949,   -442,
--12495,  -2186,   4280,   -997,  -1715,  -7385,   -379,   3498,
-  -572,  -9897,   6686,  -4736,    577,   1866,    659,   -123,
- -1682,    420,   -866,   4458,   5821,   3155,   7929,  -5562,
- -1798,   3086,   8556,    -65,  -8943,   2354,  -4187,  -3798,
-   627,  -1859,  -9760,  -1811,  -1724,    -45,  -1838,   1638,
-   499,    148,   -335,  20916,   -264,   -556,   -269,  -1014,
- -1531,    711,   -519,    462,  -5117,   3944,   -950,   8277,
-   878,  -4803,  -5003,  -4402,  -4722,   2988,   -144,  -6887,
- 10661,   -909,    700,  -2287,  12126,   -101,   -761,   1836,
-   827,   -609,    538,    442,  -4504,   1812,   3818,   7359,
-    96,   -555,   1598,  10040,   -554,    924,   3426,  -1786,
-  2620,  -2132,    867,   -519,  -2299,   -672,   -508,    201,
- -2457,  10872,  -5003,   5422,  -8890,   -104,   2579,    940,
-   401,    871,  11167,   1216,   1054,  -2876,  -1523,  -3950,
- -1229,  -3410,   -428,   3648,  -9389,  -3025,  -1752,   7583,
-  3953,   1938,   3899,   1435,   8170,   1019,  -2320,   1299,
- -1152,    226,    394,  11328,  -1471,    604,   -184,    567,
- -3704,  -5723,  -5938,    423,   9362,   4546,  -3318,  -3395,
-  5084,  -4341,  -1781,  -2619,   1078,   -365,    151,   -413,
--21591,   -968,   -202,   -183,    849,   -481,    407,    -11,
- -2708,   2472,   2689,  -9232,  -9482,  -1776,    645,  -1510,
- -1410,  -6115,   -114,  -2550,   1922,   1668,    288,  -1302,
-   948,   1967,     52,   2393,  -1975,    374,  17358,  -1332,
-  5303,   3195,  -2674,   4784,  -1418,  -1359,    -57,  -2126,
-  4618,   8890,   6455,   1181,     76,    374,   9585,   8762,
-   672,   -642,    666,  -6485,   1751,   3255,   -934,   6196,
-   892,    171,   -102,    -44,   -326,   1330,   -320,   -480,
-  -842, -22376,   -561,   -141,    635,  -6528,   5711,   2400,
-   838,   2846,  -3212,  -5341,  -5479,   4961,   2110,  -7480,
- -4215,   7964,  -1308,   1219,   1541,  -4418,   6293,  -4522,
- -4887,  -5760,   2790,   1441,   6135,  -1133,  -1627,   1235,
-   914,    572,  -1043,  -1473,   -519,  -4618,  -1228, -12212,
-  1101, -10794,  -4292,  -4355,   6431,   -588,   -992,    612,
- -1771,   6751,   4871,    581,    620,   -352,    277,    727,
-  2226,   8552,    -43,   2295,   9409,   1122,   7618,   1885,
-  1192,  -1432,  -1103,   8666,  -2078,   -403,  -1787,   1572,
- -2200,  -7705,  -6743,  -1277,  -1228,    955,   7613,  -1536,
-  8530,   5703,   5446,   4251,   -853,   4910,   1578,   2832,
-  1274,  -2610,    243,   2820,    951,   9240,   1617,    605,
- -6755,  -2728,  -5658,   3866,   -157,   1215,  -8470,  -2038,
-  -189,  10411,   7444,   -376,    407,  -1128,    770,   -410,
-   503,   1707,    786,   -529,     82,    -27,  21512,   -282,
-    81,  -1129,   -686,   -555,   2674,    -99,   1284,   2216,
-  1238,    404,  -3398,   1010,   3966,  -1134,  -2682,  14222,
- -1581,   9779,  -1114,    848,   1905,   2129,  -3937,  -4742,
-  1229,   8051,  -4344,   3914,   4273,   -659,    159,  -1188,
- -1844,    912,  -1256,   -478, -16158,  -2869,    959,  -2096,
- -2166,   2360,   7861,  -2718,  -6358,   7653,   6639,  -3239,
- -1690,  -1242,   3439,   1254,   -954,    604,  17512,   -288,
-  2412,    211,   -298,   2656,  -5217,  -1770,    892,   1979,
- -1482,   3498,    -40,  10424,  -1038,  -1862,   9905,    298,
-    77,   2179,  -4444,   2580,  -2069,  -6473,     61,     84,
-  1035,   -645,   -662,   -824,   -743,   -104,  -1962,   -124,
-  4976,  -5378,  -1254,  -7055,  -3474, -10695,  -1254,   2547,
-  -694,   3194,    -82,  -2634,    230,    358,    -12,   1594,
-   -90,    598,    -76, -21136,  -1278,    846,    -84,    259,
- -2536,  -4442,   2337,  -1606,  -3264,  -3126,   -591,  -1295,
- -2440,  -2592,  10888,   5821,   -862,  -5070,  10402, -10633,
-   159,  -2660,    894,  -2112,  -1774,   3732,  -1020,    422,
-  9487,   1608,   -992,   2046,    275, -10676,   2606,   -999,
-   477,  -1868,  -1690,   4764,  -6419,  -7550,   8159,    529,
-  2308,   -394,  -2394,   2826,   6680,    496,   3628,   -646,
-  3186,   -657,  -2260,  -1416,  -9202,    496,   6624,   2441,
-  1554,  -2195,  -8458,  -3459,    466,   6706,   1056,  -8777,
-  5436,  -4000,  -3130,   4794,  -6127,   2008,   1602,    195,
-   558,  -1362,   -880,  -2662,   9726,  -9793,   2989,  -3182,
- -2378,  -1338,   1086,  -4682,    372,   -399,  11129,   -601,
-  -666,   5206,  -1106,    362,   3155,    328,  -9862,    719,
-  1602,    998,  -2342,    857,   1510,    476,   7256,   4652,
- -5750,  -4991,   4611,   8718,  -4434,  -4119,   -351,  -1606,
- -1033,  -3717,   3585,   9381,  -1594,   5052,  -7414,   -205,
-  2356,  -5949,  -8738,   1526,  -1838,   4760,  -5444,    623,
-   112,  -2863,   5710,   4920,   9497,   3759,  10748,   -201,
-   716,    747,  -2559,  -4077,   -449,   -741,   -136,  -1303,
-  -572,   1886,   -986, -10529,    -51,   1360,   2418,    116,
- -1490,   1928,  -9977,   4720,    227, -11212,   3730,  -2996,
-  1300,   9935,    356,  -4618,   -384,    972,   3174,   3732,
-  -803,   2666,    790,   2067,   2343,  -1209, -10147,     21,
-  9066,  -4564,   2508,   -176,    264,   9834,   3360,   7278,
-  9386,  -1274,    522,    -50,   4150,   -884,    592,   -688,
-   309,  20750,    672,  -1326,   -346,    366,   2058,   -607,
-   633,    620,   -677,    330,     69,    432,    319,    436,
-  -300,  21845,   -318,   -676,    320,   -386,    889,   -724,
- -1394,  -2664,   -431,   2046,   -136,   5520,   6700,   1192,
-  5779,   9386,  -3541,  -5638, -16125,   -259,    545,   -267,
-  1972,  -2366,    -43,    615,    251,   1003,   -980,   2262,
--10519,  12166,   2007,   -884,  -1560,  -1250,   -491,   -438,
-   820,   1212,   3512,    354,  -1066,    -46,     98,    315,
-  8532,    944,  -1297,   8011,   1029,   -383,  -1606,  -8381,
- -1650,   2852,   -958,   1757,  -4270,   2160,  -9283,   2918,
- -3718,   -224,   6154,  -5671,   3764,   -554,   5214,  -2526,
-   -31,    547,      6,   1633,  -4562,   1424,   1177,   -866,
-  1648,    653,   6056,  -1845,  -1271,   -350,    596,  -2286,
-  9893,  -6594,   1099,    630,   -537,    230,    972,   -134,
-  -491,     79,    306,    -74,    253,    208,  -1804,     73
-},
-
-.cb2232l1 = {
--11397,    378,  12845,  -1813,    342,    329,   1165,    550,
-   556,   -115,    755,    117,   2511,    260,  -1189,  -1406,
- -1528,   1866,   3300,  -9678,   1025,  10413,    199,   2878,
- -3572,   8701,  -1895,  -1189,   -576,  -3384,   -162, -10866,
-  3253,  -1267,     91,   2277,    -86,  -3394,   6576,  -2475,
- -1136,  -4295,  -1610,  -8064,    297,  -8908,  -4433,  -2954,
-   -82, -11426,  -4610,   2063,   1522,  -7972,   -495,   1799,
-  2922,  -5179,   -865,   4739,  11072,   3927,   -483, -11111,
- -2375,  -1432,   1210,  -1342,   2418,   1688,    852,    -64,
-   133,  -4582,  -7136,  10558,  -3417,  -3162,   2033,   3149,
- -3050,   2532,    568,  -2444,   4082,  -2859, -10350,  -4983,
-  6633,    230,   5954,  -1140,   -657,   -998,   1156,    736,
- -8894,     64,    939,   -260,  -1704,   -526,  -1330,   -869,
- -2427,  12377,   1296,   -120, -10560,   1794,  -9090,   1487,
-  7162,    519,   -382,  -3234,    -66,   1294,   2363,   1482,
-   498,  -4053,   -752,   -154,   -587,   -293,  16533,     65,
- -1211,   1666,    291,   2820,   2222,      2,    865,    344,
- -1206,  -1214,  -2162,   8842,  11063,  -2093,   1896,   -857,
-  -144,    321,  -9548,   4464,   5038,   -282,   1160,   -194,
-   823,   3479,  -8234,   5834,   -320,   7114,   -184,  -2663,
--11670,    472,  -2013,  -1282,   4390,   4453,  -2126,  -2483,
-  -900,  -6262,  -2237,   -539,  -1134,    164,    426,  -8969,
- -1746,  -1960,   8172,  -2127, -19948,    657,   -712,    344,
-  -443,    458,   -564,     56,    756,   -157,    274,  -1324,
- -3372,   2981,    635,  -9454,  -4916,   2884,   2316,   8200,
- -1452,   2135,   1785,  -1054,     82,   5007,  -4164,    642,
-  9241,   5091,   1002,   2467,  -8409,   -854,   -861,  -2317,
-   405,  -1810,   -793,  -7907,    496,  -1005,   3373,  -1016,
-  9527,   -542,   1672,  -9105,    280,  11170,    273,    908,
-    89,   -233,  10850,    870,    436,   1630,   3328,   -499,
-  5091,   1224,   9135,   -480,  -1134,   2428,  -2904,   5077,
-  2014,   2859,   4277,   7763,   8719, -11474,   1619,   1167,
- -3188,  -1063,   -433,  -4291,   2646,   1024,   2008,    317,
-   746,    327,   6824,   1174,   8978,   5254,  -8948,   -136,
- -2602,  -1442,   -698,   -950,   1800,    296,  -1016,   1653,
-  3771,  -9326,   4536,   7033,   4729,   6630,   1042,    167,
- 11485,  12338,   -147,   2834,    611,   1844,   -313,    486,
-  -916,   -887,  -1423,    642,    242,     75,  -1875,   -645,
- -1239,  -2118,   1458,   -272,  -1703,    949,    778,  21826,
-   214,  -1320,    310,   2680,  -1542,  -2202,   1072,   -132,
- -2067,  -3593,  -8293, -10331,   9030,    402,  -2702,   2984,
--12068,   3170,  -1098,  -1175,  -1188,   2998,   1159,  -1712,
-  -904,    236,     42,    823,    548,   -546,  -1954,  15989,
- -2212,   1886,   2300,   2293,   2606,   2905,   2365,  -1214,
-  1592,   1362,  -2210,   1674,  -1892,  15049,  -1012,  -2824,
-  -792, -11447,  11144,   4853,   -357,  -1230,    748,   1212,
-  -294,   -424,  -2720,     78,  -2149,    966,   7794,   1645,
-   138,   -709,    464,   3614, -10308,    310,  -4726,  -3694,
-  1088,   -576,    690,     68,   -145,  -3282,  -9280,  -9537,
- -1274,   3202,    588,   1790,   1437,   3880,  -1803,  -1154,
- 15082,  -2388,  -1746,   -885,   2267,   1813,   1688,  -1039,
-  9775,    350,   3218,  10550,   1048,  -3731,  -3748,   3517,
-  -910,   -663,   -413,  -1045,  -1236,   -248,   -132,  -1196,
-    12,  15815,    653,   1429,   -371,   4094,  -3050,    567,
- -5524, -11128,  -4261,   1929,  -1719,   8236,    686,   1309,
- -1057,   -715,  -2586,   1327,    -38,  -6180,   3499,  -2080,
-  8980,  -1890,     62,  -1004,   3308,   5809,  -5778,  -3865,
-  -610,    180,   -519,   3129,   9000,   1607,   8484,  -4056,
-  4741,  -4491,   -355,  -1324,   1203,  -1864,   -811, -15995,
-  -121,   1325,   -817,  -2170,  -5753,    731,  -1875,  -2286,
- -9193,   -307,    247,   2469,  -1738, -12290,     31,   1028,
-   670,    -66,  -1856,    570,  -3542,  -3401,    144,   -320,
-  -524,    184,   -928,  -1606,  10978,  -3114,  -8861,   1467,
-  1156,    872,   8276,   5655,   -695,   2788,   3733,   2155,
- -2044, -10260,   1683,   1859,   -263,  17966,    -19,   1621,
-    50,   -261,  -4143,   1245,    -22,  -1564,    809,   2462,
- -8005,   1247,  -1471,   -763,  -1686,   -698,   2868,    796,
-  4036,  -3672,  11209,   1102,  -9369,  -1008,   1273,   -906,
- -4458,   1642,  -3254,   3563,    -94,  -6267,   -604,   8687,
-  2388,   2214,   1759,  -7788,   4296,  -7467,   3547,   3248,
-   845,  -7784,  -2195,    -42,   5327,  -1002,  -3915,  -4581,
- -1215,   -919,  -3444,   5142,  -1874,  -3020,  -2627,   1129,
- -4456,   1840, -11472,   -914,  -6366,   3495,  -2775,    484,
- -5859,    980,  -1967,   1350,    929,   6856,  -3952,  -3365,
-  1514,   7423,   -675,  -2260,   6027,  -3072,  -6388,  -3716,
- -2398,   5564,   1447,    -86,   1180,  -1239,  -1372,   -435,
- -1314,  -1978,    942,  -2018,   1027,    704,  20417,    -94,
- -1239,    252,   -171,  -1100,   1684,   1401,    623,   -354,
- -2674,  -5042,   -734,  -6631,   7587,   4901,  -1596,   6806,
-  4230,   -859,   -867,   1266,  -3869,  -3972,   1548,  -4889,
-  2811,   2263,   2468,    354,  -6197,  -1278,   1947,   5675,
- 10612,  -1730,   2056,    -70,   3034,   -583,    879,  -3719,
- -8623,  -1241,    822,   5832,    163,  -1075,   -784,    398,
-  1170,   -717,   -374,    856, -21602,     89,   -513,    260,
-   854,   1152,    762,   -601,    523,   -107,   1033,   1877,
- -1456,    226, -20758,    365,  -8943,   1305,    193,    948,
-   295,   2696,  -3165,  -1982,  -2439,   1067, -12266,  -1018,
-  3400,   -178,   1995,  11745,   1833,   9785,   1171,    582,
- -1844,    157,  -1242,  -4080,    864,  -1771,  -4257,    721,
- -4010,   7990,    142,    730,   1976,  -6623,   4637,  -7394,
- -1143,   -835,   3341,   1732,  -7266,   -448,   5379,    290,
-  1855,   6977,   6637,  -6561,  -1370,  -1767,  -2769,  -1189,
-  3872,  -4895,  -4679,   3906,  -1664,   1514,   7908,  -7960,
- -4147,  -1235,  -1706,   3314,    144,   1668,  -9505,   2268,
-  4147,   2515,  -1451,   6475,   1675,    106,    981,    201,
-   309,     60,   -133,   -472,    561,   -380,   1130,     91
-},
-
-.cb2232s0 = {
--26218,   1606,   -390,   -696,    266,   -947,    561,  -1526,
-    -8,   1080,   -187,   5671,   2249,    -30,  -4129,   -768,
--10908,   3826, -10422,   -144,  -1259,  -1372,  -3553,   1287,
- -5151,   6442,  -5101,   1386,    791,  -1593,  12942,   -764,
-   424,  -6212,   9733,    702,  -9721,    524,  -4818,  -1232,
-     6,   -484,   -818,    955,   6425,   3594,   5156,   -286,
-  1514,   4466,  -1756,  11321,   -679,  -1481,   -477,  -8015,
- -3059,   4476,    679,  -1143,   2877,   2581,   3230,    239,
- 12018,  -1597,  13431,  11852,    260,   3306,   -714,   1299,
- -4375,   -778,    170,   -565,  -3510,  -6632,   3354,   5901,
- -1070,  -5912,  -3430,  -4970,  -4712,   2648,  -9113,   1561,
-  1002,  -5659,  -3177,    638,   2289,  -1050,  12310, -10364,
-  2830,   -961,   -194,  -6442,   2206,   3454,  -2087,   4327,
-  1080,  10257,   8107,   4904,  -3141,  -2339,   7568,   -363,
-  3765,   7960,   7067,   1496,  -3842,   1805,   2415,    913,
- -1641,  -5411,  -7583,   4597,  -1324,   2882,  11310,  -2570,
- -2877,   3544,   4642,  -2249,   7110,   -307,  -3413,  -2871,
- -8974,  -6358,  -5703,   4046,     83,   1887,  -3476,  -4346,
- -2995,   -346,    -46,  22143,   -576,   2597,    696,   1520,
-   140,   2937,  -3356,   -988,   4090,  -1246,  -3347,   1387,
-  2264,   1282,   7040,   -806, -12810,  -1105,  32767,  -4266,
-   108,  -1998,   -680,  -1279,   -467,   -110,    462,    768,
-  1678,   1408,  -1888,  -1115,   9430,   5852,  -3578,   5367,
- -1096,  -4310,  -9588,   4350,   6048,   2516,   3214,   4468,
-  -276,  15175,   -848,  -2875,   -314,  -6002, -11743,    448,
-  9238,  -3026,  -3934,   2840,  -2070,   1850,    444,    511,
-  -542,  -7382,   6002, -14447,  -1498,    176,    812,  -2632,
- -2291,  -3312,   3953,    370,  -2154,   1678,  -1186,  -6382,
-  1544,   3534,  -3767,  -7459,   7265,  -3272,  10669,  -1677,
- -7046,  -1679,   -132,   2108,  -1948,  -2938,  -5393,  -6222,
--11293,   2066,    981,   -731,   1869,  -2211,   3558, -21513,
-  -678,   -493,  -2087,    245,    635,  -2011,  -3316,  13445,
-  2089, -10186,   1114,  -1241,   2121,  -2305,   3316,  -1282,
-  2733,    318,   3534,   4844,  -1439,   8932,  -7649,   -556,
- -7519,  -3442,   5068,  -3546,   8586,  -8425,   7146,   -683,
-   665,   3052,  -2581,    248,  -8320,   2270,   7045,   -800,
-  5890,   2187,   -251,  -2552,  -3867,   3665,  -1643, -11757,
- -5542,   1806,   3669,   -508,  -3436,    600,  10412,  -5426,
-  1680,  -4545,  11536,  -1859,  -5446,  -4594,  -4300,  -1173,
-   282,   2100,  -2556,   9486,  -7325,  -7252,  -3155,   -775,
--13674,   4272,   3066,   9352,   1647,   1136,    794,   -520,
-  -654,   1539,  -2244,   3155, -12039,    731,   3379,  -1904,
-  6866,   9669,  -2384,   2099,  -2426,   1633,  -3358,  -5662,
-  2164,  10679,  -5330,   7066,   5826,   -187,  -4840,  -1174,
- -3694,    976,  -2548,   2292,  -3517,  -1007,  -4041,    684,
--14986,  -4789,  -4135,  -4376, -10678,  -1482, -10466,   3575,
- -1960,   3185,   1198,   -196,   -892,  -5424,   4802,  13608,
- -7772,   3952,   4404,    -52,   1097,   3182,  -2699,    900,
- -1258,  -8055,  -3102,    784,  -2574,   1556,   1060,  -5417,
-   537,  11991,   -650,   -487, -10250,   6766,  -3716,   1062,
-  2525,   1039,  -3002,   5742,   -502,  -4583,   -144,   -144,
- -5896,   -978,   1786,  -1420,   1944,   -130,  -5202,  -1578,
-  7821, -11675,   9980,   5065,   5942,   -362,  16344,   -801,
-  1932,   1242,    -10,    791,   -170,  -2468,   -479,   3297,
-  4328,  11473,  -1549, -12316,    209,   1739,   1875,   1305,
- -4310, -13049,  -4913,   9208,   -966,   2570,   -138,    890,
-  1373,  -1324,   -965,   8563,  -7560,    490,  -1392,   5695,
- -5656,   5431,   3974,  -1131,  -1246,  -1334,  -3859,  -3150,
--12976,  -6929,    665,   9393,    490,   2212,     18,    542,
-   229,  -3925,   1836,   4223,   5268,   1200,    471,     20,
- -9914,  -5774,   8362,   5929,  -7087,   2005,  15624,   1626,
-  5419,  -1492,  -1536,   -417,   1957,   2585,   -404,  -1125,
-  2296,    596,    836,   -356,    745,  -2810,   2879,  -2354,
--21682,   -108,    726,   -862,    593,    -42,    266,  -1356,
- -2119,  19613,    814,   2462,  -2940,    222,   3595,   5634,
-  -807,   1219,   2446,   5666,  -1839,   7092, -10581,  -5136,
- -2408,   5726,  -1116,  -2348,  -6318,   8991,   6750,  -5321,
- -7344,  -2194,  -5544,   1705,  12500,   9069,  -1966,  -4914,
-  2225,   3537,  -1485,  -5141,    434,  -1620,  -5383,   -710,
- -5443,   3930,   7082,    667,  -3289,  -3202,  -2097,   1970,
--11647,  -2927,  -2098,  -1345,   3449,  -2075,    262,   -756,
-  1829,   -271,  -1292,   1079,  -5746,   -344,   3660,  -4456,
-  3593,  -7652,  -1367,   -828,  -2290,   1063,   4234, -17596,
-  -911,  -6068,   1040,  -2956,   2704,   1763,    974,   3132,
-   697,   1267,    240,  -5520, -12368,  10830,   -633,  -5939,
-  2307,   1868,  -2216,  -1261,    597,  -6302,  -5145,   3550,
-  7519,  -6963,   3752,    876,  -1912,     30,  -9192,   1075,
- -4632,   9108,   1139,    911,   9290,   1268,  -1006,  -1718,
- -6668,   3294,  -1510,   6527,    456,  -1400,  11424,  -4168,
- -3940,   4738,  -4863,   2990,   3202,   -441,  -4744,   4623,
- -4351,   3997, -11016,   -737,    136,   7978,  -3801,   4170,
-  3602,  -2217,    849,  -2552, -22232,    323,    193,     -4,
- -1030,    590,   1625,   3208, -10595,   2624,   -741,  13121,
- -1044,   1601,   5175,   2199,  -3833,   1804,  -2314,    793,
--11486,   -655,  -3320,  -2975,   4065,  -3124,   -706,  -7264,
- -1038,  -3082,  -5503,  -7147,   8367,   1205,  -1092,  -1694,
- -1078,  11584,      8,  -1237,  -2077,   9732,   4963,   2780,
-   674,    581,   8226,  -1231,  -9252,    644,  -3284,   -744
-},
-
-.cb2232s1 = {
- 32767,    -45,    422,  -1139,  -1052,  -2085,   -695,   -612,
-  1451,   -288,     58,   -878,     53,   2912,  -1891,  -7148,
-  1893,   3028,    165,    963,   2260,  -7904,   5857, -18824,
- -2617,  -1030,   -872,   1500,   1118,   -745,    143,   -436,
-  1239,  -3840,   1785,  -2506,  20237,  -1026,  -1556,  -1371,
-  -660,  -1185,    939,   1315,  -3658,  -5428,    587,  -4105,
-  1596,  12612,   5781,   1172,  -3490,  -1182,   -333,   6258,
- -2594,   2144,  -4830,   -190,   1972,   2687,   1327,   -987,
--15046,   4659,    -71,   6890,   1588,  -4787,   4318,  -3704,
-   496,  -5601,   1954,  -1250,  -3389,  -5156,   9238,   2298,
- -4945,    183,  -2036,    114,  12250,  -2330,     71,  -3395,
- -1402,   3668,    531,  10915,   1162,   7738,   9089,  -1250,
-  1500,   6357,   1155,  -5094,  -2641,   1657,    470,   2022,
-   535,   -306, -18031,   -903,   2913,  -5486,   1769,  -1419,
-  9082,   2149,   3516,   6960,    833,   1123,   1266,   1672,
-  -690,   9634,  -2986,  -4675,   1006,  -2205,  -2919,  -3205,
- -2759,    107,   -931,  -9694,   2340,   -862,  -2782,  -3636,
- -9414,   9564,   1057,   8664,   1326,   3928,   1452,  -4692,
- -3437,   8610, -10466,  -6638,  -2879,   3408,    861,  -3057,
-  -823,    164,   3153,  -3698, -15693,   -886,   1456,   3278,
- -6160,    -57,   1110,     22,  -2985,   7299,  -1082,  -7921,
--12212,    480,  -7645,   -211,   1586,   3874,   3242,   -883,
-  6730,  -1597,   -506,   3744,   7552,  -7607,    -65,  -1442,
-   266,  10012,   1594,  -2628,   6988,  -1049,   -516,   -691,
-   672,   4913,   1788,  14973,    342,    962,   7212,   1124,
-   500,   1135,   -311,   3886,  12548,   5432,   6219,   3341,
-  -122,   5636,   6871, -10831,   4010, -10084,   1456,   5216,
- -1013,   1102,   4164,  -1490,  -5186,   -242,  -4498,   3322,
-  3584,  -2176,   5704,    515, -11556,   1446,   4303,  -3928,
- -4227,  -7268,   6069, -11330,    822,  -2054,  -3035,  -2516,
- -1816,  -3796,   8408,   8849,  -3030,  -8201,   1149,   7388,
-  1036,   2586,   5618,  -2274,  -5037,  -1497,    384,   1454,
-  8154,   1672,  -2409,   3347,  13258,   -979,    513,   7826,
-  2662,   1818,   5537,  -1104,   2645, -10632,  -8767,  -5667,
- -1029,    806,  -9040,  -4684,    792,  -5008,  -5807,  -3924,
-   964,    313,  -2521,   1106,  -5728,  13534,  -8078,   4216,
- -1388,  -2588,    986, -14536,  -1410,   3461,   1360,  -1348,
-  -104,   1493,  -2858,  -2860,   2045,  18330,   4814,  -3628,
-  -705,  -3228,   -660,  -2664,   2616,   4548,   3753,   1574,
- -1319,  -1110,    556,   3304,  -2803,  13052,   4592,   2922,
- 13667,  -2322,  -3056,  -2717,    174,  -4222,  -4296,  -7695,
-  1366,   1786,   1041,   -110,  -1997,   4102,  -1855,   -900,
-   203,   1311,   3412,   4107,  22609,  -4112,    427,  -2488,
-   257,  -1267,  -1277,  -6430,  -7193,  10667,   4495,  -4317,
-  6846,  13213,   7335,   -972,  -3137,    335,   -609,   3131,
-  2406,  -3762,   2151,  -5188,  -7675,   2068,  -2027,   3722,
-  -773,  -3276,   1539,  -7886,   1005,  13693,   4601,  -8386,
-  -508,   5662,  -4889,     93, -10603,   4051,     -2,   1094,
- -4897,  -2274,  -2377,   2228,  -5507,   -464,  -3455,   -227,
-  9433,   8093,  -2245,   3701,  -1047,  -6827,   2037,   1926,
- -3610, -15420,   -581,  -6127,  -2075,   2501,  -2216,   5385,
- -2297,  -2660,   1563,   3244,   1418,  -2012,   2964,  12235,
- -8595,   2728,  -3541,  -6511,  11038,  11326,   -183,  -1102,
-  1038,   1224,     20,   1441,   -349,   1240,  -7737,   -930,
-  1411,   6945,   4130, -13544,  -2625,   3550,   3149,   -730,
-  7658,   3098,    673,  -2259,   2556,   1543,   1478,   -951,
- -8128,   4951,  11919,   4588,  -8448,    784, -11498,  -1908,
-  2578,   2936,  -7496,  -5834,   1987,   3407,  -4133,  -4924,
- -1348,  -1300,    916,    899,  20257,   2027,   1450,   4388,
- -3748,   3846,   2187,  -1158,   4720,  -3613,   5312,   4055,
-   448,  -6383,  -8794,  -2232,   1920,    834,  27087,   -754,
-    90,   1410,   -985,  -1381,    -61,    650,   1080,   7035,
- -2772,  -1233,  13410,   4494,   -472,  -2896,  -5083,  -2217,
- -5778,    437,  -6853,   4996,   3442,   6092,  -6497,  -3871,
-  4024,   -898,    -73,  -3067,  -2793,   5640,   6076,  -2454,
-  3598,   -277,   1672,  -6858,   2419,   9753,   6292,   8835,
- -9909,  -4724,   -618,   7266,   -416,   1965,  -4968,   2421,
-  1155,   3815,   -116,  -3725,   7872,  -4901,   2383,   1612,
- -2186,  -2302,   2791,  -2226,   1144, -13379,  -6602,   -806,
-  7099,  -2098,   4194,  -2128,   8663,  -4275,    452,   -135,
- -6053,   1280,  12815,   3278,   8452,   4479,  -1648,   1453,
-  1407,   -966,  -1016,   3173,  -7333,  -4552, -13176,  -1744,
-   577,  -1572,    611,   1202,   -146,  -5773,   3012,  -3016,
- -1581,   3162,   3818,  -1970,   6195,   1946,  -9656,   2861,
- -7875,   3133,  -7840,  10951,  -1684,   -306,   -227,   9776,
-   -82,   1736,   1180,   3457,  -2874,   5365,  -7428,   7604,
-  2623,  -2998,  -2270,  10410,   1252,  -2725,  -4433,   1758,
- -5225,   6522,   6698,    712,   4694,  -2392,    240,    423,
- -3030, -12708,  -3136,  -5176,    480,  -1624, -12900,   7537,
-  4371,   1186,  -1828,   -757,  -1850,   -974,  -3755,   1415,
- -6302,   2642,  -3823,  -1570,  -8090,   8251,   1945,  -9213,
-  1147,   4128,  -4301,    806,  -1745,    704,  -2496,   1375,
-  -802,      9,   -808,   -252,  -5453,   3857,  10353,   -536,
-  1875,  -2896, -10792,   3358,   1063,   -890,   7200,   3660,
-   406,   2840,  -6973,  -4469,   4638,  -8091,   2772,  -8035,
-  1728,  -5315,   7234,  -2718,   3707,  -1226, -11858,  -2397,
-   772,   3285,  -4089,  -1400,   1113, -16680,   1885,   -435,
-  -959,    242,   -817,    259,  -2010,  -1857,   -557,   -914
-},
-
-.cb2232m0 = {
--13394,  14382,   -488,  -1088,   -817,    100,    305,   2267,
-  2527,  -1584,    995,  -5781,  -3585,  -1826,    803,  -4108,
- -3137,  12111,   -211,    838,   4879,  -1964,  -1728,  13830,
-  2084, -11535,    664,  -2499,  -3421,   -703,   4528,    968,
-  1008, -12010,    984,   2658,    422,   1412,  10772,   2216,
- -4291,   1329,  -2324,   2392,  -2029,  12322,   1053,    169,
- 12635,   -902,    -62,   -670,  -3007,  -3322,  -2948,   1817,
--10688,  -1264,   1949,   2734,   1072,  -1429,   2085,  10312,
- -1685,  -4433,  -1287,  -9620,  -1132,     20,    614,   2470,
-  2821,   5934,   3526,  11292,     50, -12970, -11948,   1114,
-  1980,   -945,   -713,  -5357,   3766,   -447,    969,   2247,
- 11854,   2148, -12393,   1518,    610,   4527,   1164,   1347,
- -1422,    649,    653,    855,    -24,  30152,     20,   -564,
- -2825,    -11,  -1408,    -80,    239,    305,  -3163,   -854,
-   568,    -18,  -4212,   -403,    288,  -3009,    229,  -1152,
- 16390,   -877,   -458,    316,   -128, -12165,   1088,   -828,
--10886,   -269,    747,  -1026,   1716, -10920,  -9204,  -3123,
-   958,  -6128,   -260,   -851,  -1524,  -2386,  -6472,    228,
-  2667,   3158,   -140,   1719,   2330,  -2730,   3080,     44,
- 15743,  -2167, -11637,   -607,    476,    408, -12505,  -1862,
- -1892,   -440,  -3785,  -2348,   1229,   -338,   -438,   -797,
- 29933,   -715,    366,   -197,    576,   -188,    484,    240,
- -4844,   1168,  -1054,    863,    875,   -295, -16091,  -1972,
-  3976,   3833,   3056,   -770,   1011,  -3098,    165,   3973,
- -9367,    -18,   -299, -11254,   1005,   8644, -14788,  -2268,
-  2644,  -8410,    578,   2169,   -766,   2764,   2378,   3282,
- -2710,   7612,   -542, -12062,  -2437,   -414,   -506, -10332,
-  2732,    839,  -2593,    923,   1159,  -1057,  -7333,    -86,
-  2832,  11328,  -1616,   -302,   4399,   -547,   6107,   9983,
- -6901,    -85,   -544,  -4916,    366,   4878,  -8662,   7313,
- -3056,  -1027,   2381,   8906,  -7270,    509,  -1124,  -2512,
- -1636,   5830,  -5868,   2369,  -3236,  12557,  -2713,  12793,
- -2957,   1688,   -852,   4723,   -122,  -2336,  -4698,  -1306,
- -7399,  -2090,  -1953,  -1505,   3335, -10906,  -2598,   1322,
-  2556,   7210,  -1553,   1262,   1878, -10719,   1746,  -2736,
-  1448,   8734,  -9602,    828,   1752,  -1632,   8037,   2728,
-   562,  -1879, -10572,   -544,  -2254,  -1997,  -6384,    -87,
- -5878,   -473,    498,  -2960,  -5698, -11500,   1815,   2050,
-  7388,   5230,   2782,   5602,    514,   -306,  13022,    523,
--10776,   -846,    716,    270,   3350,  -6021,   1420,  -6175,
- -1978,   3967,  11612,   3320,  -4100,  -2468,   4595,  -5338,
-    65,   3478,     19,   3501, -15896,  -1335,  -1861,  -1944,
-  3935,   3630,   4627,  -5892,   -458,    383,   -211,   -594,
-  -165,  24865,   -656,   2300,   -404,    257,    214,   -643,
-  2298,   -180,     35,   4974,    834,   -998,  -1738,   5449,
- -9222, -10858,   4188,   9147,  -5639,  -1691,    990,  -1945,
-  3421,  -3527,   9005,  -2038,  -2369,   5098,    967,  15840,
-   196,  -3204,  -1079,   -776,  11806,  -1352,  -2053,   2011,
-   309,    642,   1541,  -1466,  -4465,   6679,   5756,   7474,
-   -58,  -1864,   5908,  -1576, -30374,   -904,   -571,  -1136,
-   425,    -22,    666,   1150,   -734,     82,   1254,   -226,
-  -437,   -890,   1464,  -3368,    987, -11885,   1127,  -7224,
-  1872,  -8198,   8775,  -2695,   1457,  15102,   -899,  -1384,
- -1975,   1891,   3128,   1465,  -1649,  -1363,   1483,    303,
-  -534,     -7,  -1710,  -1377,    769,  12698,  -8987,   -802,
-  4636,    572,   2004,  -3513,    442,  -9863,   3215,  -4550,
-  2138,  -4346,   5682,  11053,   7220,   9842,    797,  -1399,
- -2679,  -5857,  -2143,   3241,   2330,    248,   -630,   1044,
-   639,  -3432,    125,  22083,   1976,  -1003,    813,    552,
-  -571,   4358,  -6200,   3635,   5439,   -636,    233,  -4856,
- -3519,   -460,   6956,  -4215,   1537,   7895,  13910,  -7637,
-  1392,   1572,    648,   3690,  -1988,  -2463,  -3302,    677,
-  -924,   -535,  -6025,   4126,   7178,  -4145,   4960,  -1860,
--10926,  -1470,  -9506,   -226,   -258,     32,   -479,   2222,
-    94,  11358,   3984,  -2732,   2111,   -590,  -2444,   -344,
-  -425,    598,  -1382,  -1213, -17632,   1566,   1387,  -3521,
-   -57,  -1829,   4788,    574,   -206,   7962,   9157,   6459,
- -1594,  -1355,   4874,   1066,   2006,   1793,  -7569,   2369,
-  1108,   1305,  -3046, -14052,  -1736,  -4045,  -4328,   7497,
-  3304,   1518,  -5666,   -529,   4256,   4667,    932,  -1495,
--10414,   -414,  -2110,  -3150,  -1250,  -8799,   -419,   5162,
-  8497,  -8720,   -746,  -3015,   6403,   3855,   7350,    165,
-   -59,   -958,   5780,   6044,   1736,   3016,     31,   1012,
-  3422,   7598,  -6837,  -2092,   2262,   6171, -10362,  -2108,
- -1352,   1798,  -4872,  -6369,   2507,   2640,   6074,   1835,
-  2948,    388,    398,  -9295,  -5384,  -2088,   2096,    742,
-  3286,    441,   7135,  -2112,  -9958,  -5612,   2479,   5427,
--10114,   -674,    308,  -1037,    770,    514,   1868,   -252,
--11901,   -984,    670,   2506,   5396,  -1047,   9113, -10865,
-  4872,   1720,   2226,    947,  -2336,   2649,    173,  -1464,
- -2874,   4463,  -1270,   3429,   6242,  -5380,  -7772,  -4550,
- -8451,   2045,  -2855,   5336, -15066,   -418,  -4886,   -648,
-  3736,    945,   -956,  -4825,   -116,    130,   1889,   9642,
-  3790,  -4371,   7180,  -1556,   6562,  -2207,  -7910,    506,
--21594,    662,   -338,   -943,  -1022,   6453,    301,   -464,
-  -457,    840,   3313,  10946,   -294,   8156,    138,  -1425,
-  2397,   -792,   6468,   4615,   -511,  15938,    494,    274,
- -5976,   -660,   3894,  -2140,   1424,   2003,   4101,   2823
-},
-
-.cb2232m1 = {
- 20456,  -1952,  -1581,    869,    628,     76,   1404,   4060,
-   508,  -3177,   -946,  -2992,   2422,   1139,  -1931,   -240,
-  1011,    365,  -1106,  20973,  -1438,    372,    137,  -1058,
-  1171,  -1252,   2794,   1434,   1814,    482,   3948,  -2704,
- 20422,   -241,    441,  -1121,    499,   1036,   -918,   9708,
- -3166,   -488, -10379,  -3201,  -5254,  -1871,   5665, -12622,
- -7591,    127,   1469,  -2267,   1813,  -4197,   2065,   -602,
-  -395,   -652,    333, -19114,  -1092,   4310,   1590,   1688,
- -1453,    177,   4402,   1168,   5972,  -1295,  -3258,   1542,
- -4832,   3377,  -5545,  -3622,  -4944,   2064,  -2846,   8118,
-  -845,  -6778,  -3640,   5729,   -907, -11007,     -5,   2634,
--11118,   2108,    144,  13299,    251,    336,    563,    -75,
-  3004,    169,  -3892,   1477,   1066,  -1571,  -1113,  -1088,
-   517,    465, -21841,  -1541,  -1094,   1841,  -9213, -17478,
-  1662,      8,   1192,   1174,   1014,  -5659,   -695,    316,
- -5161,   1803,  -1056,  -2369,  -2919,   2941,  -9712,   1975,
-   426,  11214,   2288,   6186,  -7348,  -3062,   3341,   3252,
- -4102,   -346,   -876,  -7088,  -3330,   4507,    310,  -1632,
-   299,  -2636,  -2740,   -752,  10159,  -7201,  -9568,   3134,
- -4002,    -41,   2479,  -1816, -14099,   3575,   1161,   6427,
- -2466,    390,  -1883,  -6265,  -1266,   -263,   1474,   -592,
--21234,     94,   4187,      1,   3227,  -3273,   1950,    406,
-   543,   1661,  -2648,  -9252,  -2048,  -5987,   -722,   4932,
- -4410,  12504,  -1572,   2244,   5610,    307,  -9710,  -3642,
- -6436,   4368,   2956,  -2269,  -6196,   4069,   -766,  -3695,
-  3416,  -5786,  -9668,  11677,   1208,   -965,   1516,   1132,
-  1018,  -6168,   1970, -10357,   1379,   -725,  -8789,   3730,
-   -65,  -4758,  -1818,  -1050,   9641,   4519,   2886,   2667,
-  6348,   2436,   -438,   1978,  -9374,  -1286,   3893,  -2073,
--11199,  -2081,   3345,  -3444,  -9480,   2410,   1986,  -1869,
-  3252,   5949,  -2119,   -401,   -214,   3416,  -1067,  18510,
- -2986,   3510,    508,   -357,   -837,  -1205,   2884,  11587,
- 11565,   -555,  -2664,   -873,   3642,  -2068,   1734,  -4408,
-   330,   -181,  -1358,   1407,  -9739,    809, -10203,  -2066,
-  3440,  -2063,   3238,   3734,   1671,    750,   6890,   4068,
-  1238,    493,  -1330,     76,   8918,  10855,     85,  12236,
-  3570,  -1074,   3008,  -9424,  -3186,   1271,   -380,   -157,
- -4974,  10575,  -1378,   -219,   1354,  -1589,  10936,   2268,
- -3787,  -1040,   7567,    924,  10490,   -806,  -1318,  -1576,
-  -209,     93,  -3745,  -3820,    439,  -9828,  -6265,   -864,
- 31342,     35,   1332,    443,   -590,    846,    104,    868,
-  -863,   1526,  -1088,  11494,  -7055,   3564,    109,  -3072,
- -2234,  -4530,   1866,  -3425,   9940,   3158,  -1821,   -680,
- -1124,   2884,   1191,    -61,  -9698,   7596,   -558,  -9019,
- -1181,    208,  -1342,    -68,   -312,    294,  -1468,   1410,
-    39, -21081,    724,  -2137,    935,     -8, -10297,   3509,
- -6510,  -6558,  -6906,  -1905,   1915,   5920,  -8983,   3416,
-  7300,  -1372,  -1422,   1822, -10433,  -2530,   1669,    554,
- -3008,  -3351,   -922,   8279,  -5184,   5520,   4785,    683,
-  -506,  -4558,   1938,   8442, -12639,    -54,  -2907,   -820,
- 10004,   1780,    485,   1401,  -3786,    786,  -5937,   2632,
- -1540,    972,  -3342,   2294,   8076,  -1006,  11731,  -1825,
-  3036,   1085,   1160,  -9680,  11111,   7838,  -2504,  -2112,
-  2376,   2534,   3624,    555,   3610,   -520,   -831,    -15,
-  -498,    167,    711, -22685,   -999,  -1466,  -1643,   -394,
-  5404,  -4247,  -2307,   4052,  -1156,  -1240,   -490,  -1598,
- -4365,  -8382,  10493,    464, -16592,   3723,  -7709,   -821,
- -4218,   -922,    398,   5635,   2184,   5090,  -7144,   2420,
-   792,   -324,  -1278,   3172,  13101,   1608,  -3996,  -2219,
-  2995,  -6924,    816,  -2482,   -406,   3458,    503,  -8154,
-  3460,   2542,  -3703,   8524,    -61,   -430,  23212,   1203,
-  2335,   5556,   -476,    923,   -565,    593,  -1611,   1814,
- -1614,  -7067,  -1957,  10166,  -4306,   -421,  -4026,   1854,
- -9881,    667,   7720,  -2906,   7003,  -1823,   6344,  -8614,
- -2965,  -2720,    -62,   -802,   1945,   4574,  -4604,  -8341,
-   518,  -3543,     95,  -4262,  -5220,   -133,  10270,   1999,
-  3234,   8900,  -4866,  -3708,  -4465,   4542,   2545,   1770,
-  6995,   3559,   1133,  -1152,  14680,   1002,    634, -12913,
-  1686,  -1645,  -1796,    -50,    112,  -1108,   1070,    686,
-  1068,   1555,    896,   3498,  10458,    -32,  12017,   -737,
-   650,   -432,    404,    170,  10873,   1864,  -1718,  11061,
- -1556,  -3766,    225,   6999,   1730,  -6919,  -1895,  -2919,
-  8250,  10050,  -4631,  -1488,  -4801,  -1504,  -2736,   -110,
- -3630,  -2752, -11162,   1128,  -2580,  11692,   -678,   1338,
-  2175,  -6030,    616,   1651,  -7034,  -3057,   2420,   1998,
-  4383,  -1721, -10762,   -428,   2902,   -906,  -4298,   2141,
- -1242,   5464,   -607,   5389,  -8946,  -3890,  10884,   1544,
-   628,  -1969,  13902,  -1570,  -1080,   -689,  -4676,  -3642,
-   753, -11351,   -110,   -744,   4286,   1163,   3105,   9752,
- 11143,   4296,  -1698,   1012,   2284,   -989,   -958,  -9481,
-   738,     24,    426,   1638,   3898,   8885,   2938,  -8826,
-  2982,  -1679,   8466,   -651,   5144,   2736,    751,    -84,
-  7710,   3077,   2885,    146,  -1102,  -2569,  -2039,  11059,
- -9950,  -1048,  -1031,    -33,  -5118,  -1096,  -1986,   2306,
-  2400,   9320,   6188,    500,   2090,     61, -11357,    118,
-  1505,   1032,  -1920,   -164,  -9744,  -4670, -11029,   -102,
-  -960,  -1023,  -2570,   4102,  -3989, -11478,    772,  -1515,
- -1102,  -2194,   1722,  -1195,  -8144,    746,  -9534,   3250
-},
-
-.cb4440l0 = {
--14497,  -1982,    631,   -984,  -2115,  -3252,   2755,   2017,
- -2110,  -8864,   -792,  -1291,  -2761,  -2365,    698,   1047,
-   972, -14703,  10590,  -3945,    663,    972,   1204,  -2801,
-  1295,  -1296,     50,   1448,    888,  -1879,    122,     78,
-  -183,   -588,  16202,   -388,  -2240,   1136,   1266,  -6445,
-  2619,  -1664,  -6329,  -2700,   1557,   -497,    598,   -110,
-  1298,   -334,    191,  29897,    387,    419,     76,    152,
-   533,     78,    112,    101,    158,    136,   -236,     88,
-    43,    107,     84,     21,  -6385,  -1711,   1757,   1411,
-  9152,    -72,   1428,  -1098,  10328,   -506,   -360,    285,
-   -36,  -2816,    819,     88,    176,   -481,   -172,   2067,
-  3268,   5479,   8605,  11272,  -1880,    361,   1582,  -4973,
- -1379,   3835,     74,     -3,    493,   -431,   1390,    101,
-  -550,     59,    476,   -469,   -583,    568,    732,  -1015,
- -1104,   -698,  23922,   1130,  -1268,    280,    204,    -59,
- -9789,   -317,    935,   2944, -10402,  -2564,  -4648,   1506,
-  3834,  -1002,   2805,   -158,   -409,    814,   -150,    -97,
- -3573,  -1550,   1356,   5350,   -365,  -2622,  -3454,    310,
-  1194,    911, -10928,    937,   7980,  -5286,   -554,   1999,
- -1263,   -562,     10,   -321,    744,     44,     64,   -274,
--30136,    340,  -1051,    756,    -30,     -6,   -269,   -273,
-    12,     95,   1565, -13194, -11810,   -485,  -1574,    414,
-  -240,   -452,    564,    740,   -476,    959,   1079,  -1568,
-  -422,     37,   -154,  10117,    -68,   1412,  11862,  -3420,
-  4169,   5178,    527,  -1027,  -1030,  -1985,    448,   -716,
-  1696,   1942,   -254,    308,   1100,   -790,   8102,   6630,
-  3653,  -1018,   -587,  -6990,    -19,   1671,   1425,   8089,
-  3708,  -1182,    774,    659,    113,    437,     50,    835,
-  -532, -11209,   1682,  -7490,  -2592,   1234,  -4689,  -7301,
-  -143,   3361,   1121,    177,   -473,    513,    136,    965,
- -4020,   4639,  -1212,   1271,   2905,  -6865,  10499,  -3800,
- -3354,  -5029,  -3606,   -950,   4490,    526,   1006,      2,
-  1760,   5819,    -55,  -1098,  -1843,    348,  -2062,  -9196,
-  3712, -11466,  -3218,   -858,   2720,    589,    320,    861,
-    59,   5357,    564,   -380,    538,   -142,    490,    212,
-  1716,    670,   1904,   -181,   2979,    943,  16916,   1271,
-   988,   -802,  -1490,   9154,    643,   1725,   1347,  -2827,
- -4096,    485,  -7091,  -3180,  -4747,  -1604,   1576,  -5724,
-  6104,   -139,   1726,  11715,    360,   7519,   2513,   5192,
- -2208,  -1993,    829,   -387,  -5724,   4418,    116,  -2955,
-  -226,    249,    377,   2149,  -2929,   5021,  -3064,    800,
- -1459,  11384,   8556,   1740,    368,  -2839,  -2049,   1438,
- -1357,   4084,   1896,   -528,   1621,  -1760,  13741,    302,
- -1018,  -9774,  -3521,   1302,   1374,   1139,    918,  -1724,
-  -764,    858,    804,  -1772,    372,   -322,   -526,  11924,
--11944,   4012,   1749,   1737,  -1545,     68,    889,    280,
-   690,  -2200,   1068,   -484,   -171,    455,    -44,  -3178,
-  2243,   -590,    749,   -792, -19876,    198,    236,   2695,
- -3413,    652,    284,   -820,  -1134,   -199,   -112,  -5650,
-  -418,   1047,   1090,   2260,  -3297,  -2164,  13524,   1720,
-  -326,    910,  -1706,   3912,  -1175,   1687,  -2152,     50,
-    35,   1718,    721,   9316,  -2256,  -4330,   6961,   4432,
- -8043,     45,   1370,   3472,   2892,  -3224,   1368,   1355,
-  -562,   -694,    746,    198,   1188,   2819,   3131,  -2371,
-  6438,    847,   2111, -10187,  -3451,  -9826,  -3502,    655,
-   649,   1460,    270,    118,     45,    192,    188,  -1139,
-  -258,    663,    -84, -27519,   -765,   -905,    357,     -4,
-    89,   -372,    -24,    178,   1127,    209,   1177,  -2762,
-  -587,   1488,   8989,   3217,  -2550,    215,   9540,  -7196,
-  1259,  -3716,   2767,   -261,   -216,    872,  -3008,  -2076,
-  8682,    709,   3629,     87,  -3114, -10624,    246,  -1670,
- -1738,   1229,   7624,  -1120,    784,    305,    233,   -185,
-   280,  -1466,   -268,    198,    499,    308,  -2187,  -1149,
-  -388,    -38,   -338,  -1084, -19424,     40,   1958,  -2240,
-   -86,    264,  -9876,  -1287,   4086,   3742,   2502, -10078,
-  4574,  -1493,   1078,   3218,   2410,   -364,   1049,   2638,
-    35,  -1295,    200,  -2847,  10818, -12064,   2375,    348,
-  -353,   2788,   -821,  -3196,   -511,    146,   2015,    235,
- -1094,   2622,   2688,    -79,   5176,   -884, -11814,    794,
-  2696,  -6704,   3452,   1295,   3872,   2924,   4498,   -166,
-  -598,  -1213,    891,   5478,   -266,   -777,     -5,   -776,
-  1003,  -1837,   -156,  17910,    453,   -297,  -1545,    857,
-  -288,   -308,  -6373,   2045,  -1846,   3007,  -2236,  -1904,
-   815,  -2889,   4200,   8320,   9872,   -614,   -834,   3856,
-   414,   -234,   1559,  -7451,   3641,  -1230,    837,   -127,
-  2652,    411,   -532, -12548,  -1692,   1034,  -2418,   -968,
-   558,  -1564,  -1952,    307,  -1064,  -6776,   1588,  -2636,
-   949,   8272,    -12,  -3468,   3481,   6588,   2580,   7393,
-   272,   1528,   1818,  -2206,   -349,   -396, -11704,   1487,
-  9753,  -4665,    -24,   2084,   -780,   5036,   -647,   3668,
-   561,   1099,  -1094,    534,   1270,    -99,   1006,   -476,
-  -528,  12481,   1589,   1593,  -1682,   7022,   2664,   8702,
-  -563,   1082,   -206,     87,  -1978,   -144,    228,   1232,
-   889,  14340,     65,  -1061,  10510,    -95,    649,     53,
-  -962,   -383,   2479,   1322,  -1798,   2840,   -492,   -419,
-    90,   -680,     79,   1026, -20912,   1593,   -742,   1086,
-   516,    699,   2393,    -64,  -2010,     46,   -859,    111,
-  -440,  14281,    272,    797, -10141,  -3734,   3126,  -3050,
-  1300,     73,  -1754,  -1278,   1890,  -2710,    704,   1160,
-     1,    269,    -24,   -622,    124,    138,   -522,   -510,
-    95,   -402, -27306,   -470,   -214,   -159,    396,   -201,
-  -372,    122,    136,  -1005,    744,   1949,   -810,  -2648,
-  -726,   -384,    955,   1232,   1354,   -345, -19485,   1056,
-  -193,   1257,   -263,    398,   -752,    602,     98,    793,
-    17,  20186,   -189,  -2615,   -174,    166,    436,    411,
- -1046,    374,   -471,   -253,    233,   8352,   1342,  -1279,
-  9305,   2190,  -3239,  -5262,  -3454,   1844,    684,    303,
- -4434,  -6041,  -3495,  -2482,    389,    353,    159,    -14,
--29179,   -511,   -158,     92,   -401,    -36,   -297,    447,
-  -605,    269,     85,    212,      8,   -118,   -130,    207,
- 13150,  -8712,   2504,   1355,  -3268,   1396,  -4748,  -2200,
- -1560,    228,   -162,   1179,   3024,    742,   -860,     69,
-    10,  30006,   -538,   -489,   -125,   -214,    364,   -682,
-  -283,    532,   -134,    227,   -448,    -20,   -266,     70,
-     2,   9310,  14858,    856,   -493,  -3357,     36,   -248,
-   214,    281,    -73,   3268,    745,   -245,  -1007,    146,
-   392,     36,   8042,   2953,  -6603,  -7697,   4425,  -2498,
-   571,  -2194,   3388,   -794,   -561,  -2763,   1912,  -3030,
-   225,    214,    -27,    834, -10661,    437,   -506,   -535,
-  8397,   1332,  -2406,  -8868,  -2972,   1385,    296,    865,
-  2318,    890,    244,   -121,    226,    375,    896, -10381,
- -2266,  -3404,    983,   1255,    259,  11427,    455,  -3041,
-   307,  -2446,    476,    723,     18, -10224,    510,    552,
-  -654,   -876,   -465,    628, -12572,    786,   -393,  -4162,
-   938,  -1327,  -1695,   -608,  -1352,   -131,   -880,    830,
-  1016,  21875,   -408,  -1560,   -500,  -1682,    453,   -930,
-  1316,   -136,    434,   -683,    412,    202,    233,    382,
- -2002,  -9267,  -1034,   8710,    434,  -8121,   3035,  -3121,
-  1792,   2712,  -1537,  -1082,    854,   1337,  -1084,     91,
- -4485,   2545,  -4412,  -1930, -12234,  -4802,   4641,    437,
-  -928,   2163,  -3154,    521,   -665,  -1200,   2654,    931,
-  -388,   -118,  -1144,    133,   5089,  -1194,  -1528,   -967,
-  -795,    188,   1918,    897,  -7046,  -7617,   7118,   5755,
- -2724,  -7894,   -472,   -360,   -591,    990,  -3032,   7742,
-   726,   5490,   9383,    479,  -3032,  -1904,   7158,   4706,
-  2442,  -1576,    -58,   -156,  -3977,  -2696,   4195,   -166,
-  3342,  -1566,   3767,  -4159,  -5750,   5505,  -7663,   4516,
- -4073,  -2612,   5136,   -290,   -666,   1282,    776,   -566,
-  -602,   -310,   1003,   -648,   2928,  -3159,    427,  -1168,
- -2702, -16990,   -205,   -343,  -1196,  -1980,   1653,   -512,
- -1820,   -418,  -3368,   3522,  -1966,   4964,  -5728,  -5185,
-  -210,  -1721,  10131,  -7060,   3351,    334,    -96,  -3193,
- -1713,   -614,  -2633,    147,  -1552,  -2363,  -3724,  -1731,
- -7350,   5453,  -2732,  -2867,  12458,    416,      0,   4414,
-   833,    590,   1617,    405,     73,    868,    232,    195,
-    15,   -196,   -782,    749,   -955,    -84,   1176,   -553
-},
-
-.cb4440l1 = {
--12227,  -3413,  12848,  -1336,     20,    894,    254,  -1001,
- -1381,   -406,  -1157,   -458,    300,   -395,    825,    -34,
-    74,    382,  -1018, -10266,   1338,  11091,    544,    797,
- -4304,   1389,   -747,   1924,   -257,   2615,    -37,  -4375,
-   782,    158,   -378,     19,    652,   -539,   1012,  -4211,
-  1263,   -925,     96,  -9226,   5921,  -8209,    -71,  -1838,
- -2201,  -7441,    -60,    393,  -5626,   -264,  -1002,     85,
-  1989,  -1616,   -216,   -914,   9907,   8044,   -578,  -7830,
- -1705,  -3624,   2430,     59,   5813,    870,   -317,  -2545,
- -4020,  -1330,   1215,   9352,   5425,    324,  -4803,   -681,
-  -506,  -4710,  -6574,  -4184,     65,    729,  -1310,  -1387,
-  1385,   2364,   1672,   2493,   -438,  -1367,   -907,     38,
--20220,  -1644,    512,   -413,    348,   -112,   -532,    785,
-  1332,   7140,  -1916,  -1766, -11570,   1811,  -9167,    -76,
- -1531,   -175,  -1739,   -771,   2014,    519,     15,    576,
-  8736,   -979,    -28,   1830,    329,   -302,  12206,  -1501,
-  5195,   -305,   1456,   -581,   1488,    142,    235,   -157,
-   192,   1540,   -922,  11056,  11823,  -2964,  -1488,   1712,
- -2018,   -880,  -3282,   -190,   -198,   2436,   -248,    222,
-    22,    863,   1504,   2078,  -2047,    216,  -1270,   -732,
--18252,   1186,   3178,   -730,    432,    934,   1617,    873,
-  -491,    -70,   -768,    679,   1398,    537,   -364,    172,
-  -541,    -94,    -24,   -129, -26725,    201,   -554,   -357,
-   -71,     60,     96,  -1665,   1425,   1244,    332,  -1068,
-   326,    834,   -620,  -1473,   1585,   1432,    928,  18782,
- -1388,   2897,    448,     40,   1323,   1433,    787,    215,
-  3297,   2586,   -856,    451, -17700,    735,    -43,    405,
- -1252,    744,   1012,    677,    312,    206,   -279,   -432,
-  6677,    -87,    -72, -10400,   -106,  11224,   1152,   -422,
-  2024,    704,   2462,  -1197,    232,   -119,      4,   -879,
-  1600,   -708,   3496,    279,   -143,  -1096,   -555,   4594,
-  1486,    161,    942,   2018,   2474, -16010,   -380,   -193,
--11415,    457,   -276, -11220,  -1604,    -38,    813,  -4044,
-  1888,  -4265,   1647,   -882,    981,   -734,   -110,    140,
- -3050,   1248,   -549,  -1167,   -967,   3586,    688,  -1380,
-   424, -17959,   2022,   2274,    -44,  -1406,   -432,   1335,
-  -659,   9555,  -3581,  11045,   1870,    806,    599,  -2065,
-   156,  -4420,     16,   2349,   -609,  -3058,   -738,    -60,
-  -548,   -119,    -49,     26,   1528,  -1842,   6306,  14078,
-  -692,   5480,    321,   1996,   1376,  -3086,    490,    -54,
-  1151,    932,    445,  -9887,  15808,   3085,    866,  -2020,
- -1785,   2126,   -920,    414,   -290,    138,    244,    994,
-  -702,   1410,    330,    202,    675,   -389,   -241,  31306,
-   380,    300,    -53,    804,   -109,    413,    -44,      6,
-    14,    486,   -293,   -112,     26,  11632,   -836,  -3948,
-  -518,  -1364,  11360,   3558,   -588,  -2084,    490,    381,
-  -955,   2207,  -2953,   1115,   -265,      2,     65,    464,
-  -180,   -111,   -174,   -152, -30508,    121,   -207,   -835,
-  1126,   -185,     91,    -96,    222,    -99,    -93, -10138,
-  -430,   -184,   -372,   -194,    953,   -100,    382,  -1422,
- 13931,  -1835,  -1657,    821,    408,    808,   -601,   -463,
-  7142,   5596,   3171,   2174,   2740, -11350,   1019,   1449,
-  -386,   1642,   3703,   4271,   1664,   2232,   -674,    983,
-   551,   8543,    154,   -383,  -2419,   1117,   -520, -10966,
- -4406,  -3742,    -79,   -909,   1813,   5043,    412,   1099,
-  1434,    173,    788,    -92,  -1004,   1288,    -87,    931,
- 10241,   -855,      6,   -405,   2580,  11455,   1150,  -1916,
-  3614,   -262,    292,    897,   9673,   -381,   1711,  -2713,
- -1111,    282,  -2180,  -2282,  -2266,   -724,   -849, -11787,
-   888,   3120,  -1459,    495, -10812,   -792,   -274,   -984,
--12223,   -737,  -2394,   -299,   -578,  -2758,   1521,    774,
-  1938,    857,  -1935,    217,    654,   1452,  -3695,   6734,
-   804,    134,    946,  -2156,   9495,   -600,  -1962,  -5252,
-  -246,   1269,   8492,   1261,  -2205,   -106,  -1314,    828,
-  1013, -12059,    663,    436,  -2648,   9863,   -630,  -2961,
-  3004,   1015,  -3153,  -1475,    -25,    399,   -846,    430,
- -1237,   -156,   -187,   1115,   -502,   -363,    386,  -2820,
-   942,   -926,    727,   1130, -20388,   -274,   1140,    198,
-   199,   2548,    442,    157,  -1546,   3693,    892,    460,
-  6552,   4858,  -2560,  -8673,   1930,  -8913,   3427,    686,
-    61,  -8830,   -358,   1338,    -74,   1180,   2871,  -3822,
-   104,   2414,  -1742,  11425,  -4522,    393,  -3016,    972,
-    34,    117, -16113,  -6900,  -6964,   1726,   -843,   -242,
- -2141,    803,  -1093,    442,   1776,   2429,  -1000,    489,
-   393,    635,    389,   1126,  12285,  -1648, -11396,  -2885,
-   -56,   3840,   -174,   3177,  -1708,   1189,   1914,   1514,
-  -189,    -88,    276,   -240,   -120,  -2929,   9823,    678,
-   568,     26,  10080,  -2575,   -806,    -64,   6406,    -82,
- -1171,   2169,  -1804,   -667,    -37,     54,   4208,  10829,
- 11920,   -468,   1916,   -809,   -370,    144,   3616,   -263,
- -4352,   -124,    300,   -246,   -440,   -115,    447,   -407,
- 20869,   -340,     54,   -764,   -807,   -699,   -283,    727,
-  -922,   1098,    577,     -6,   -809,    -50,   -115,    -75,
-   280,    156,    182,    225, -30432,   -212,   -417,   -245,
-   177,     94,      4,   -627,    167,     47,    152,    148,
-  1325,  -2436, -10063,   -696,  -9966,   1032,  -1024,  -3702,
-  3933,    400,    333,    692,  -3858,   2599,  -1215,   -389,
-   393,   -666,   2135,  10280,  -2443,   1972,    410,   -392,
-   590,  12322,   -523,   1141,     52,  -1468,    819,   -213,
-   162,    116,   -614, -10630,   -204,  -1247,    535,    199,
- -6058,   2538,   1644, -11539,  -1562,   1462,  -1493,   -218,
-  -296,   -605,    321,    607,   -366,   -257,   -837,   4536,
--11683,   1266,  -3805,   4496,   2854,      8,  -8848,    124,
-   656,  -1041,    411,    144,    916,    445,    -91,   -260,
-  -149,   -882,   -433,   -121,    345,     68,    349,    821,
-   652,    251, -23053,   1015,    712,    -73,   7038,  -1520,
-  5810, -12604,   2841,    425,    265,   1546,    938,   1851,
- -1180,   2751,   -498,   1289,   -774,    327,   4047,  -8132,
- -2622,   5449,   3221,  -2990,  10107,   1880,    173,  -4006,
-   399,   -332,    642,    297,  -4513,  -1230,   -330,   -788,
--21881,    903,  -1308,    547,   -522,   1885,  -1730,    -63,
-   973,    897,    670,   -657,   -232,    498,     92,     -8,
--11010,   1072,   -368,  -1864,  11505,   3497,    730,   2158,
- -1629,  -1351,  -1583,   2247,  -1506,   2144,   -902,    639,
-   175,  -6006,   -986,  -4246,  -1510,   1785,  -9792,   -495,
-  1995,  -9189,  -1414,  -2550,   1578,   2390,  -2989,   1673,
- -1980,     21,  -4054,   8552,   1155,   -301,   1204,   3776,
-   262,  -1828,  -1837,  -1014,     -9,   2711,   1467,    463,
--11605,   1743,   -956,  -1213,  -3892,   1534, -10298,     22,
-  -902,   -658,  -1759,   2507,   1552, -12298,  -1050,    623,
- -3221,   1522,    -36,   -446,  -5925,   2144,  -2844,  15080,
- -1984,   3631,   1931,   1894,   1193,  -1694,  -3172,   -813,
- -1336,    534,   -365,    833,   -293,  21759,  -1266,  -1216,
-   996,     -2,   -393,   -858,    759,    969,   -230,   -151,
-   977,   -874,    119,   -896,    262,   -118,     89,     95,
-    94,   -437, -30375,   -462,    360,   -588,   -334,     86,
- -1027,   -208,    536,   -196,    367,   -467,    119,    -32,
- -2544,   6204,   8830,   -264,  -7847,    848,   2267,   3877,
- -6378,  -2249,   1420,  -1868,  -3443,   3747,   -590,     58,
-  -274,  -6065,  -8472,   5906,   3109,   5834,   3905,   2086,
-  1300,   3828,   -518,   -528,  -3672,   1794,   4353,    408,
-   566,  -2577,  -1137,   2749,  -2662,   -528,  -7479,   5550,
-  2932,   -336,   3681,  -2034,    212,  -8733,   1017,   2258,
-  8225,    387,    227,    877,   2752,  -1375,   2636,   8131,
-  3850,  -6870,  -1158,  -3736,  -8478,    228,  -5809,     97,
- -2555,  -2956,   -928,    678,    112,   1434,  -1250,   1240,
-  -412,  -4267,  -3811,   4322,  -3430,   7705,   5456,  -6876,
- -3452,   7329,   3142,    220,    662,   1531,  -5492,  -1388,
-  6842,  -3631,    362,   5029,   8052,  -2367,  -5346,   5724,
-  -358,   2469,   2196,  -1426,   -272,    534,   -192,   -531,
-  -705,    -70,   -259,     93,    335,    -94,   -145,    -17,
-   920,   1186,   -818,   -599,    343, -19859,   2968,    161,
-   128,  -4282,    598,    152,   1210,  -1317,  -1545,   -229,
-   181,  -6488,   5699,   7270,   6271,   8809,     27,  -4770,
-  -804,   -168,   -247,   -680,   -129,   -470,   -152,    915,
-   176,   -904,    622,    280,   2986,   1034,  -1046,   -482
-},
-
-.cb4440s0 = {
--12085,   8192,  -1802,   4587,   5947,  -3183,  -2629,   1837,
-  2434,    252,   -612,  -4697,   -576,    150,   -704,   -640,
-   174,   -126, -10309,    350,  -3187,   4714,  -2829,  12618,
- -2172,   3502,    465,   -159,   -601,   1306,   1174,   -448,
-  -292,   -136,    242,     31,  -9005,  -6203, -10027,     25,
-  -209,    -20,  -1292,  -1252,   4304,   3681,   4462,  -4401,
-  4412,   1240,   -576,   3618,    595,   -237,   2544,  -6032,
- -1511,   1523,  -3668,  -3472,   5552,  -4901,   -272,   5963,
-  2740,   -878,  13010,    191,  -2017,    768,    455,    -45,
- -6873,  -3664,   2639,   -961,   3068,  -4242,   1327,   2362,
- -1909,  -1114,    100,  -5940,    220,    865, -12952,    -76,
- -1279,   -591,   1092,  -3502,     88,  -2118,  13053, -10141,
- -3024,   -533,  -1923,  -4097,    135,   1672,  -1661,   1646,
-  -370,   -361,    644,   -197,  -6796, -10948,  11692,   -974,
-   488,    349,   3936,  -1506,   -149,    513,   1401,  -1776,
-  -391,   -210,     57,    -56,   -344,   1018,   7989,  -4957,
-   167,    987,    -60,     62,   1622,   1207,    -69,    338,
--16133,    -46,   1018,  -1460,   -821,   -646,   1316,    126,
- -4631,   -842,  -1505,  15833,  -6404,  -4514,   2946,   2923,
-  1198,  -3141,  -3109,  -1613,   1853,   -906,   -436,  -1110,
-  -282,   -214,  -3424,  -3141,  -3988,    284,  22262,   1269,
-  1787,  -1116,  -1429,   1017,    371,   -187,   -825,    534,
-   350,   1088,     26,    176,   8914,   6662,    935,   2074,
- -7986,  -4780,   2194,   1796,    697,  -4040,   2486,   1700,
-  9150,    -37,  -1560,   2449,   -162,    128,  -7469,  -2690,
-  -281,  -4698,    424,    535,   1416,    243,   -575,  -1160,
-   326,  -2417,    808, -15816,    994,   -302,     26,    894,
- -7376,    395,   -586,    823,  -1341,    972,    100,    241,
-   743,    470,    267,   -550,    474,    182,  18252,    178,
-  -182,     -7,   3496,   2132,    863,   -151,    741,  -2158,
-  -763,   -652,   -503,   -434,   -736,    770,   -156, -19071,
-   443,   -354,   -243,     66,   4258,   6714,   3577,  17338,
-   556,  -3570,   1269,  -1406,   1668,   -349,    -90,    781,
-    82,    558,    936,   -788,  -1072,    -21,  -6472,  -3022,
-  -475,  -6997,  -2816,  -3774,   1683, -13950,   3482,  -1872,
-  2624,   1064,   -318,   1300,  -1214,    179,    -11,   -124,
-  4560,  -2827,  -6314,  -5736,   1159,   1309,  -5462, -11652,
-  4192,    151,   -543,  -3484,  -2288,   -119,    745,   1373,
-  -121,   -629,   5204,   7650,  -2062,  -3370,  -2894,   -338,
- -1361,   1080,  -3674,  12852,  -6119,  -1578,   -736,   -241,
- -1564,   -109,   -441,    335,    416,   1678,   4802,  -3239,
-  6182,    154,  -3656,  -1337, -17027,   1707,   -381,  -1704,
-  -377,   1022,   -592,    983,   -321,     37,  -1846,  -4500,
-  2575,  14162,   -560,   9385,   4179,  -1340,  -3466,   3235,
-  1727,   1545,    -23,    636,    280,    -39,    871,    173,
- -8915,  -2427,   2146,  -3698, -12153,  -3773,  -3873,   5042,
-   112,    788,  -1139,    245,    546,    278,     -8,  -1005,
-   443,    -76,  -1256,   8255,   3841,   6116,   4226,   3705,
- -1278,  -6470,   5220,   5892,  -3468,   2736,   5427,  -3336,
-  -264,   1906,    294,    -60,  -7078,   7699,  -9792,  -7108,
- -2030,   1055,  -6962,    702,  -2074,   -232,    127,   -430,
-   658,   -272,    757,    138,    159,   -340,  -4606,   1021,
-   146,  -7690,   6001,   5660,   3363,   -367,  13222,   -441,
-    13,   -874,    668,   2293,    875,   1238,    110,    778,
-  1434,   -976,   2151,  -8169,   1421,   2622,    206,   -795,
-  -816, -14443,  -1583,   3356,   2971,   -964,   -321,   -841,
-  -404,    111,  -5595,   4248,  -3819,    214,  -2520,   -712,
- -1505,    849,    947,   -876,    188,   3221,    863,    105,
--17336,   1818,     14,     17,  -6349,    379,   4746, -12405,
-  -560,  -3448,   3664,   8251,    845,    383,   1348,   -739,
-  -780,   1695,   4828,   -123,   -647,    823,   9940,   -183,
- -1804,  -7112,   -161,    578,   -619,  11534,   3214,   1586,
-  4784,  -2540,   1188,   -304,   -485,   -648,   -824,   -595,
- -8817,   4138,    927,  -3259,   -198,   4022,   2213,  -1627,
-   645,  14602,  -1058,   1481,  -1670,   -113,    564,   -710,
-  -451,   -360,  -1261,   2504,    247,   5566,  -7262,   1344,
- -5106,  -1608,   1946,  -4240,  -7393,  10440,   3306,   1940,
-  -999,    155,    832,     55,  10218,  11475,  -3252,  -8295,
-  1347,   2405,   3421,  -2619,   2262,  -2829,    754,   -307,
-   548,  -2040,  -1130,    317,    170,    292,    248,   2601,
--18930,  -1942,   1417,   1678,   3310,  -2578,  -1969,   1550,
-  3010,     70,      8,   3064,   -848,    504,   -172,    180,
-  1787,  -1133,   2427,   1002,   -664,    -40,    192, -23400,
- -1004,    513,   -818,   -382,    360,    360,    268,     98,
-  -202,   -192,   -668, -12924, -11702,   7325,    797,   1937,
-   674,  -2458,   -541,  -1497,  -1673,   -955,   -356,   -486,
-   182,    299,    -46,     65,  -4232,   1418,   6532,   2356,
- -4894,   4870,   3369,  -4585,   8743,   1497,  -1451,    862,
- -8612,  -1718,   1716,  -2389,    371,    592,   7397,  -3188,
-  -649,    126,  -1300,   1374,  -1292,    645,  -1494,   2736,
- -1468,  -1808, -17223,   -352,    111,   -222,   -236,    171,
-  -198,  -7994,  -3822,   5324, -16856,   -517,    119,    314,
-  -360,   -515,    435,    520,   -638,   1635,    420,   1191,
-   830,    710,   6897,   2925,   3091,    510,   3268,  -1702,
--16186,    718,  -3127,   -463,    763,  -1035,    725,   -122,
-   646,    172,   -164,   -277,   5853,  -7074,    -10,  -1770,
- -2544,   5978,   -874,   -494,   -232,  14465,   1815,  -1902,
-   987,  -1533,   1216,    741,    620,    161,   4414,   4184,
-   -32,  -2944,  -4619,   -462,  15701,  -1026,   -140,  -2396,
- -1747,   -538,  -1024,    219,    854,   -351,    860,   -226,
- -4390,    732,  -2003,  -2430,   -540,    592,   1622,   1180,
-   385,  -2052,   4050,  17401,   -650,   -243,   1709,   1261,
-    95,   -307,  -5110,   -666,  -7094,   -533,  -1293, -17357,
-  2929,   2389,   -119,   -413,    317,   -962,    709,  -1552,
-    26,    175,    700,   -570,  20120,   1107,    232,    169,
-  -889,   -533,  -1276,     22,    959,    866,   -954,   -792,
-   873,   -172,   1757,    195,    148,    423,   4490,   8782,
-   631,    682,   1832,  -3728,  -1742, -11130,  -1201,   1776,
-  9268,   -586,  -1358,   -646,    626,   -866,      5,    263,
-  3950,   -760,  -2914, -12751, -12669,   1513,     -4,    631,
-  1835,    312,   -167,   1546,   -532,    619,   1176,   1436,
-  -116,    312,   7054,   3120,   4075,  -1320,    715,   -206,
- -1572,   1350,  17688,  -1182,  -1568,    680,      6,    207,
-  1010,    600,   -766,    554,  -1483,    644,  -8810,    624,
-   148,  -4015,  -1536,  -1863,     92,    730, -14806,    386,
- -5174,  -1420,   -331,   -254,   -104,    275,  -7268,   2563,
- 11983,    -65,   8043,  -1623,  -2589,  -2610,   1328,   3154,
-  1935,   3672,  -1761,   4984,    661,    209,  -1038,    122,
- -1019, -28948,     55,    358,   -539,    488,     55,    618,
-    20,   -314,    446,  -1016,    618,    -93,    -94,   -331,
-   -36,    194,  -1706,   6628,    396,   -146,   -765,  10500,
-  2619,    -82, -10894,  -3908,   -888,   -192,    620,    163,
-    78,    774,   -293,   -104,  -4826, -14066,  -1883,  -3258,
- -4577,  -1484,   5412,  -4274,  -4951,   3316,   -907,   1948,
- -1187,   -404,   3654,    400,    -70,    459,  -3224,  -3194,
-  2338,   4390,     -5,  -3167,   3273,    116,  -1026,  -1668,
-  3767,    272, -16662,    137,  -1634,  -1007,    220,   -310,
-   982,   8220,    -16,  -1251,  -2644,  -3344,   2236,  -1573,
-  8174,    612,   1142, -10799,    393,   -707,   4804,    397,
-  1232,   -292,   5762, -15608,   2921,  -6440,   3544,  -2395,
-  -504,   1890,    172,  -1010,    178,    380,  -1163,    404,
- -1230,   1034,   -596,    105,  -2038,   1991,   5613,   -312,
- -4156, -10205,   3092,  -4704,  -6101,  -1620,  -1037,  -1130,
-  1590,   8321,   -797,    247,    954,   -103,   3838,   2330,
- 10064,   3197,  -8508,   1300,  -1012,  -6607,  -3861,   5651,
-    31,   -475,   1582,  -1370,   1107,   2164,    743,   -567,
-  4842,  -2930,   3191,   -190,  -2230,    -47,    254,   2147,
-   591,   -512,   1312,   1159,    811,   1444,  -1312,   -257,
- 16016,    789,  -2562,   3983,   -373,  -9255,    302,  -3655,
-  5750,  -3856,  -6941,   3934,  -2314,   5556,  -4099,   -265,
-  -479,  -4843,   -130,     20,  -4859,   3083,   6482,  -3738,
- -3936,    590,  -6368,  -1784,     75,  -3903,  -6834,  -4452,
-  -871,    764,  -1118,   8731,     38,   -148,  -3368,  -6330,
-  -370,   2234,    907,  -2809,  -1458,  -2306,   -402,   2679,
- -1222,   1138,    192,  -1317,   1012,  15514,    624,    279,
- -4032,   2565,   6162,   -938,   5760,   1685,   4350,   2939,
-  -825,   -331,   1840,   -556,    427,  -4642,    -23,   8346,
-  7577,   -467,   3848,    454,  -3962,    373,   -116,   2314,
-  4868,   -208,  -1367,  -1803,   2681,    806,  -4279,   3348,
-  -528,  14027,   -238,   -457,  -2764,    832,  -4680,   4354,
-  1219,   -801,   2414,  -5204,  -3768,  -6524,   5163, -10909,
-  1656,    321,   3260,  -1773,    214,   -135,  -4563,   5206,
- -4794,   1486,    406,  -1026,    281,   1799,   -218,    320,
-  -908,    872,   1056,   2955,   -208,   -799,  15492,    334
-},
-
-.cb4440s1 = {
- 27498,   -414,   -266,    646,    229,     94,    -15,    302,
-  -489,   -401,    125,    752,   -476,   -200,   -976,    195,
-     4,   -402,   2220,   1012,   1731,   2530,   -652, -21380,
-  -679,   -867,   -195,   -114,   1326,   2531,   -348,   -185,
-  -114,    178,   -694,   -298,   8752,   1735,   2640,  -2374,
-  6191,   1516,   5771,   6705,   -253,  -8502,    986,   2134,
- -1854,   3490,   -678,    -48,    133,    844,  -1635,   1630,
-  6056,   -756,  -1109,   1563,  -1445,   -139,    580,  -1448,
--18675,    846,   -390,   -259,   1548,   -324,    281,    142,
-  1792,   1211,   1328,  -4308,  -1032,  -5412,   4742,   -201,
-   -47,   -297,  -8403,   9715,   7268,  -3756,   1573,    677,
-   -88,   -145,   4877,  12946,   3264,   1809,   7230,  -2583,
-  1627,  -1786,  -7113,  -1480,  -2111,   -508,    415,   1664,
-  -483,   -538,   -249,     80,   7005,  -2562,   -887,   3801,
-  6411,   2222,     36,    875,  -5089,  10897,   4014,   4948,
- -1580,   1425,  -1814,   -391,    -96,    322,  -6484,   1896,
- -7790,   -950,  -4235,  -8362,   3118,   4843,   3754,   1070,
- -1648,   7692,  -1675,   3405,    918,   2270,    573,    193,
-  6024,   8912,  -4905,  -1810,    985,   1877,   2158,  -2150,
-  -386,   3908,   2030,    419, -12599,   -570,   -150,   1580,
-    36,   -152,      2,   -538,  -1565,   6809,   -715,  -6266,
--12725,  -6718,    810,   -603,   1547,   1001,   2250,    810,
-  1773,   -672,    327,    246,   6414,  -7511,    916,   -327,
-   830,  11862,   4373,   1003,   6370,  -1730,  -2127,    613,
-  1627,    626,    763,   -864,    207,   -233,   3738,  -8644,
- -1634,  -2050,   3906,   -451,  12986,  -4828,  -2973,  -4714,
-   545,    822,    735,  -3539,   -256,     65,    -93,    -94,
-  2923,   7075,  -3763,   6172,  -9544,  -2675,  -3833,    930,
-   418,  -4496,   3790,    386,  -7797,    234,   -609,   -259,
-   454,    330,   1546,  -7634,  -1966,    515,  -2496,    374,
-  2633,  -3014,   4126,   9920,  -7103,   1441,   -150,   7695,
-   670,    -48,    -41,   -512,  -6849,  -1785,   3755,   1860,
-  2418,  -2346,  -1194,  -1574,  15510,    444,  -1515,    585,
-   742,   -199,  -1115,   -122,    -11,    140,  -7763,   1438,
-  -317,   -444, -17149,    -24,   2685,   -856,  -3166,   1109,
-   308,    233,     30,     63,    530,    645,     84,    133,
-  6139,  -1183, -10673, -12790,   -112,  -1544,   4623,    576,
-  -804,   1023,  -1646,   1192,    269,   2681,     44,   -909,
-   -14,   -414,     48,  -4002,   4768,   3440,   3252,   1441,
-   101,    372,   3166,  -1398,    325,  16184,   -711,    486,
-  1328,    114,   -450,    -31,   1152,   2154,    -69,   -252,
-    32,    922,    219,  -2055,    421,  -1377,   1006,   -614,
-   234,    -40,    -84,    204,  27171,    182,   1034,   1536,
-   834,  -8038,   1243,  -3074,  -7829,  11165,  -1854,  -1173,
-  -871,   4105,   3588,  -3191,    188,  -2102,    124,   -166,
-  8070, -11066,   6632,   2739,  -7787,    184,  -5872,   1360,
- -1089,   1273,     84,  -1683,  -1584,    975,   -206,   1160,
-   180,     12,  -6121,   5436, -14726,   5949,  -6756,    834,
-  1750,  -3142,   -878,      7,   -220,  -1933,   -141,    160,
-    26,    756,   -800,      6,  -8104,  -6989,   3353,  -3518,
-  4510, -12430,    736,  -2685,  -1042,     32,   1184,   -519,
-  -312,  -1073,   -402,     71,   -422,    -35,   1791,  12735,
- -2281,   2623,  -1502,  -3878,   6727,  10541,  -1110,   2308,
-   870,   1124,    874,  -1406,    123,    254,    405,    328,
-  3828,  -7541,   3096, -14145,   -672,  -1725,   -423,  -1918,
-  4164,   -411,   3094,   -568,   3575,  -2895,   -378,  -3065,
-  -232,    449,   8110,   2264,  -1383,   -557, -10683,  -7628,
-  4155,    754,   -134,   6759,   1051,  -2054,   -900,   -948,
-   579,  -1277,    151,    462,  11562,   -310,  -8260,  10238,
- -1309,  -3052,    345,   -689,  -1133,   -588,    548,    980,
- -1332,    881,    368,    776,   -704,    422,  12433,   1314,
- -1487,  -4753,   2679,   3092,   -939,    136,   -586,   3504,
- -1034,  -6318,   3506,    420,   2326,   1034,   -252,   -398,
- -6232,   4488,  -6166,  -1754,    908,   4884,  -5188,  -2985,
- 10793,   -116,   4674,   3980,     -9,    805,   1568,  -1620,
-   -88,   -146,   3027, -16154,   2899,   7839,   5912,   -427,
-   270,  -1467,   -387,   -351,    615,   -322,     -2,  -1061,
-  -654,     56,   -438,    132,   2388,    460,   2172,   1874,
- -3028,   3302,   2035,   -704,  -1222, -19835,   -472,  -1858,
- -1686,   -286,      5,   -748,    491,   -350,  -4344,    103,
-  1473,   2440,  13575,  -1350,   1456,  10377,   1962,   3036,
- -1238,   1580,    607,   1352,    997,   1212,   -489,    251,
-  4075,  -3457,   6186,    786,    300,  -2532,   -373,  -2522,
-  3108,   -294,   4938,  -2980,   1509,  12450,   -695,  -1128,
-   -96,    354,  -3678,   8494,   2480,   2264,   5162,  11907,
-  4721,   1111,    752,   2999,   3924,  -1429,    321,    276,
-   309,   -603,    601,    -62,   3337,  -3570,   3273,   6618,
- -2001,    950,    532,    972,   1619,    956,     65,   -609,
-  -281, -14769,   -438,    580,    230,   -228, -10108,  12289,
-  8904,    872,  -3296,   1535,   -384,    477,   -913,   -777,
-   546,    445,  -1004,   -435,   -716,   -138,    572,    435,
-  4626,   -864,  -5716,  -2810,   1291,  -4796,   -241,   2527,
- -2342,  -1360,   4161,   1886,   -128,  -1521,  13726,   1818,
-  -554,   -157,  -9665,   2607,  -1013,    579,   1122,   1571,
- -2684,  11364,  -6464,   -184,  -1542,  -5670,  -1091,   -670,
-  1273,  -1051,     -7,   -278,  -2551,   -548, -10673,  -1434,
-  -343,    317,  -3108,  -1615,  -2239, -14132,    490,   -454,
-  2467,   1990,    470,  -1072,    440,    290,   3006,  -4420,
- -2083,   3050,   2779,  -2349,   -590,  -4941,   7464,  -9000,
- -2686,  -2045,  -8712,  -3281,  -2476,    648,   -148,    408,
- -1367,  -1113,  27347,  -1113,    739,     39,   1443,   -208,
-  -686,    986,    735,   -702,     76,    665,   -194,   -165,
-   366,   -606,  -4908,  -3932, -15941,  -2810,   4572,    816,
- -2092,   4213,  -2492,   4006,    926,    210,  -1110,  -1635,
-  -270,   -226,   -362,   -187,   1790,   3016,   2216,   3890,
-  2018,  -1325,  19784,   -771,    356,   2118,    -98,   -688,
-  1016,    978,    559,    -39,    160,   -310,   6622,  -1754,
--11104,    204,  -2212,   2370, -11610,   1119,   3216,   3102,
-   524,    278,   -829,    524,     28,    838,    374,    -76,
- -4593,  -2933,  10697,  -6510,  -4970,  -2025,  -9383,  -3428,
- -4112,   2665,   1459,  -1411,    421,    481,    842,   -341,
-   147,   -158,   4108,     45,   4935,    -21,  -7905,   2058,
-  1158,  15260,   -567,   -752,   -992,  -1094,  -1059,   2370,
-   820,    655,   -261,    280,  -3969,   6342,   8521,   3114,
-   369, -12269,   1684,      4,   4686,   1985,  -3668,  -3040,
-   677,   -254,     57,   -161,   -989,   -379,   7075,   -580,
-  2846,  -3177,  -2285,    958,  -7096,   -154,   -515,  -3345,
- 13487,   3548,  -1804,    290,   -430,    726,    399,     54,
- -2814,  10235,   1958,  -3356,  -1330,    536,   3218, -14194,
-   200,   -796,   -862,  -1480,   1811,   -346,    604,   -391,
-  -231,    513, -10495,  -6029,  -6492,  -8746,   -357,   -221,
- -1890,  -2669,      8,  -1756,  -5812,  -1048,   2258,    223,
-  -474,   1154,   -226,    348,  -1590,   2915,    158, -24059,
-   875,   -846,   1150,  -1000,   -844,   -116,   -246,   -219,
-  -482,   -367,    120,    517,   -489,    442,   8148,   5040,
-  3770,  -1006,    -51,  -3175, -10278,  -4468,   1188,   1497,
- -6515,     -5,  -1628,  -2387,  -1297,   -717,   1630,    232,
- -3608,  -6688,   2444,   -792,   -246,    411,   1464,   3661,
-  3244,  -1121,  -1602, -15398,   -443,    882,   1412,    926,
-    16,    -73,   2693,   7168,  -9399,    528,   7916,  -9270,
- -1669,  -2756,   1304,   3074,  -1510,  -2089,   1491,  -1556,
-  -422,   -414,    132,   -192,   5988,   4500,   7572, -10978,
- -4875,   3685,   1888,   -660,  -1750,   -515,  -2728,  -3133,
- -2742,    666,  -2861,    626,    256,    243,   4587,  -3567,
-  -288,   2314,   4765, -11036,   7322,   7581,   2651,   3264,
-  -394,   -246,   -891,  -1464,  -1717,    123,   -517,   -486,
- -1019,   7215,    554,    722,  -4253,   2393,   3053,   2881,
-  1538,  -2104,    573,    321,    673,   3902,  -2855,    944,
--12816,    370,   3496,    952,  -1435,   6379,    766,   2273,
-  -729,     80,  -2432,  -1150,   2408,   -895,  15497,  -1231,
-  -282,  -3306,   -435,   -167,  -3528,  -5683,  -6413,   2501,
- -4825,    124,   3128,   -425,  -2800,   -986,  -2283,   -495,
- -3392,  -1560,  -2093, -11613,    -37,    157,   -438,   -794,
-  1988,    -45,   1508,     20,     98,   -458,   -245,   1130,
-   110,   -525,   -771,   1120,    710, -21758,    174,   -210,
- -4839,  -2468,   -648,  -4388,    -11,   2990,   -181,  -4790,
- -4232,   3634,   6427,   2772,    166,  -2996, -12005,   1630,
-  -249,    179,    856,  -1250,  -4216,   1993,   5164,   4757,
- -5071,   4331,  -3029,  -1276, -11184,  -2864,   1238,   6332,
- -2431,   1276,   -338,   -476,  -5659,  -2410,   2510,   1853,
- -4853,  -3175,  -1896,  10728,   3724,    960,   9963,    305,
-  -938,   -646,  -2760,   1436,    113,    -74,  -3098,  -4090,
-  2950,   2701,    992,    206,  -1393,  -2179, -10862,  -2396,
- -1008,   2639,  -1547,   -416,   9264,   1824,   -360,    401
-},
-
-.cb4440m0 = {
--25793,   -238,   1193,  -2635,   -238,   1315,  -2277,   1588,
-  -896,    512,   -864,    611,   -398,   1277,   -212,   -358,
-   202,  13250,     16,   -860,   1618,  -1024,    310,  11560,
-  -746,  -3876,    780,  -4087,   -475,    857,   1017,  -1439,
-  -890,    155,   8556,    362,  -1158,   2116,   -291,    -66,
- -1272,    510,  -1394,   2259,  -4761,    808,   -740,   -937,
- 13993,    191,    273,  -7670,   6776,    846,  -1907,    955,
--13206,  -1956,   1697,   1670,   -329,   -244,   2395,   6119,
-  -802,  -1007,    649,   -974,    170,  -2136, -10780,   1020,
-  1270,   1954,   1118,  13348,    983,  -1394,   -594,   -514,
-  -586,   1026,  -1821,    548,   -298,   3342,    837,  -1395,
- 13977,   1021,  -7792,  -2930,   1466,   5494,   -843,   2432,
-  1378,    -68,    174,    407,     76,   -877,    691,  -9445,
-   522,  -3448,   2549,   -412,  -2358,    875,  -5044,   -952,
--10113,   6574,  -6347,  -2760,   -662,     29,   -227,   4884,
-  1304,    411,  -3320,   2434,    785, -14822,   4412,   2272,
- -6407,   2172,   -613,  -1665,    296,    742,    624,    135,
-  5316,  -3191,   -855,  -2061,    485,  -3188,   2998,   1382,
-  2516,  -2438,  -3506,   -238,    737,   -629,   1001,    773,
- 17540,   1478,   -724,   -764,  -1231,  -1254,  -1582,   -692,
-  -351,  -1551,   -171,    183,     38,   -668,    756,   -770,
- 24344,   -905,  -7182,    502,  -3766,  -1690,   1588,   1522,
-  1844,   1276,   1458,   -777,   1731,   4856, -14860,  -1097,
-    36,  -1310,    846,  -1500,    521,  -3669,   -252,   4480,
- -2602,   -845,    597,  -4512,   1062,   -292, -18518,   1972,
-  -334,    -80,  -1256,   -366,   3640,   -436,    -12,  -1670,
-  -435,   1496,   1429, -11092,   1012,   -936,  -1224, -12240,
- -3048,    210,   1905,  -1197,   -357,  -9759,  -2632,   -332,
- -3417,  15078,   1496,   2206,   1800,    205,   1384,   3546,
- -1853,    755,   1016,    726,     58,   -150, -13053,  10375,
- -2589,   -330,   1616,   3081,   2763,  -2617,  -1204,    324,
-   -53,   2968,   1485,    214,    124,   -334,   -237,  16784,
-  2612,   1023,  -4298,  -2156,   4336,  -4307,   4952,   1036,
-    81,   -762,   3416,    714,   -187,  -4100,   -757,   1124,
- 10224,   7059,    424,   -316,   1281, -12262,    912,  -1999,
-     2,   -731,   -184,    879,   -934,   -202,   -391,  -1046,
-  -338,   -101, -17511,  -1712,  -5580,  -2327,  -2478,   1770,
- -5825,   1499,    578,   -130,   1424,  -1818,    110,    542,
-    22,    988,  -4227,   2836,  -1447,   1170,  12335,   2179,
--11216,  -2500,     64,   -912,   -954,    654,   -802,   -455,
-  -597,    234,   -296,    811,   1083,   1848,   4148,    637,
- -6608,  -2362,  -3382,   -664, -13088,   2839,   3090,   3294,
- -4554,   2518,    -55,    837,   1392,   5905,   1287,  -1484,
-   965,  16533,  -3507,  -1903,  -1562,   2408,   5037,  -4816,
-  1409,    361,  -1890,    170,   -610,  -1755,   -524,   -867,
- -6238, -20117,   -745,   -956,   -176,   2998,    130,   -668,
-  -843,   -267,   -364,   -573,    495,    127,    -66,  32767,
-   271,   -408,    654,   -123,   1831,    151,    996,     82,
-   628,   -251,    144,    198,    -88,    357,     37,    612,
-   184,    238,   -584,    -52, -30025,   -415,    404,   -566,
-   100,    659,   -336,    877,    211,   -730,   -377,    184,
- -5256,  -1484,  -1191,  -2108,     24,  -7821,    209,  -2856,
- -1844,    697,   5798,  -1191,    427,  11858,   1000,   -261,
-   184,   -686,   1182,  -3142,  -3138,    139,    144,    117,
-  3658,  -3566,  -1562,    672,   2036,  15051,  -5069,   -551,
-   529,   1696,   -214,  -2678,  -5966,  -3707,   2847,  -2554,
- -1760,  -1196,   2088,   6372,   1778,  12935,   2189,   1992,
-  1761,    578,   -542,   -753,  -1182,   4321,   1871,    309,
-   704,  -1259,    884,  19136,  -2665,   1096,   3048,   -167,
-   872,   -344,  -1092,    464,   3255,    -86,   1608,  -1062,
- -1569,  -1699,   4504,   -274,    568,   1428,  20571,   1452,
-  -894,   -791,    459,   -882,  -1048,  -2944, -11095,   -783,
-  -832,  -2450,    650,   2784,   3156,    529,    457,    483,
--12553,    655,    686,   -757,    929,    212,   1242,   -201,
- -1627,   4826,  -1895,    997,  -3225,     84,     80,    287,
- -2136,    405,   -188,   -890, -18272,   -511,   -118,  -3642,
- -1018,    420,  12650,   -474,   -540,   6978,   6977,   4418,
-  1162,  -1332,  -1112,  -1765,   2640,    562,  -1164,   1256,
-   595,    567,   -483, -31511,   -960,   -816,    756,   1505,
-    12,   -518,    234,    184,    679,    328,   -600,   -137,
-   267,   -440,   2540,    593,   1023, -11756,    626,  -2034,
-  5756,  -9882,   3175,  -1190,   1628,   3920,   3219,   1394,
-   834,   -140,   4036,   4722,   -455,   3105,  -1355,  -3106,
-  1000,   7806,  -2227,    687,  -1580,   3180, -12302,  -1394,
-  -425,    488,   -187,    -36,    219,    158,  12006,   1683,
-  2151,     -2,  -1110, -12250,    -59,    672,   1844,   2084,
- -2101,   1652,   -783,    634, -13257,   -339,   3932,   2260,
--12452,    152,    316,   -688,     79,   -912,  -2081,   1384,
-   188,   1942,   -706,    204,    700,   1776,  13901, -13666,
-  -324,    472,   1055,   -646,     82,   -769,   -877,   -443,
-  -227,   -900,    636,   -870,    470,   -112,   -598,  -4402,
- -2726,   1775,   -216,    -43, -18675,   -863,  -4604,   3433,
-   674,   -155,    208,   1546,    294,   -157,   -616,  11070,
-  1229,   -528,   2124,    699,   3624,     54,   -516,    194,
--13556,   1902,   -506,  -1317,   1916,    471,   -342,    836,
-    18,    906,    614,     -8,   -951,   1052,    -97,   2212,
-  -924,    310,      6,   -733,    122,  23731,    468,    345,
-  1545,   1434,    611,    403,  -3136,  -2214,    -54,   1023,
- -1390,  -5243,  -3744,   -258,   6871,  -1778,    673,  -2362,
--13007,   -776,   -974,  -1077,   8386,  -3978,  -4325,   1236,
-  4011,   1161,   -263,   1224, -12957,   -100,   2801,   1458,
- -3081,    578,     17,   1037,   -742,   5972,   -632,   2904,
--12721,  -6733,   -478,    182,  -1973,   -820,  -6911,  -4904,
-  -942,   -348,   -353,   -350,   7864,     34,    568,   1985,
-   956,   3310,    118,  -2067,  12600,   9063,   1609,  -1261,
-   296,  -1248,  -1656,    -65,   1832,   1525,   1503,   5149,
-  4370,  -1638,  -3868,    320,   1527,   -424,  17676,   1780,
-  1172,  -1132,   1128,   1294,   -322,   -101,    462,  -6668,
- -3024,   7573, -11088,   1581,     13,  -1398,    550,   4376,
-  1623,   1727,    857,  -5310,   2528,   -529,   -401,    539,
-  6508,   4246,   4105,  -5363,     96, -13407,   -694,   5061,
-  3445,  -3283,   -348,  -1470,   1114,    602,   -404,   -129,
-   642,   1547,  23110,  -2255,   1969,    333,   1297,    116,
- -1691,    364,   -528,    758,  -1239,  -1826,   -249,   -395,
-   684,   -856,   -638, -10000,  -2773,  -6151,  -1244,  -3138,
- -9688,  -1994,   7124,   1368,  -1870,   -312,   1863,  -1006,
-   963,    789,    743,  -4158,   -760,   1384,  -7525,   -959,
-  -262,   5752,   4005, -12037,   -210,    886,  -1961,   4895,
-  -251,   -158,    212,    677,    518,    342,   -226,   -360,
-   466,     17,  28392,    -20,    246,   -686,   -258,    640,
-  -378,   -120,   -443,   1078,  -2612,   2084,  -1706,   4334,
- -4675,  -4634,   2336,  -9998,   9975,  -1285,   2778,   3292,
- -1717,    138,   2114,  -1120,   -180,  -1146,  11988,    829,
- -2530,  -8827,   6833,  -1191,  -1653,   2691,  -4067,   1166,
-  1971,    303,   -544,  -1459,   -261,   1065,   3410,   2050,
-  3163,   -515,   5456,  -4261,   5483,   1531,  -2098,   2020,
-  3773,    588,    915,    158, -11876,    282,  -1180,    265,
- 11036,    -66,  -1741,  -1894,  -4234,   3048,    218,  -1030,
-  2240, -12666,  -2290,  -1673,  -1911,   1480,    287,    -81,
-  1182,    216, -10734,   2201,    -58,   -619,   8585,   -574,
- -4576,   1852,   -468,  -6759,  -7667,    167,    995,  -1114,
- -1276,  -2053,   2178,  -8133,  -1270,  -7822, -10582,   5380,
-  3037,   1071,    827,   4972,   1024,   -129,   -180,  -3002,
-  -846,   -736,   9587,   1890,  10287,  -1954,   1042,   1558,
-  -950,   2406,  -1852,   2275,   6694,   -703,   -910,   3854,
-   812,    521,  -1075,   -761,   5357,  -3911,   3892,   7944,
-  4580,   5031,   1088,   7116,  -1746,  -5223,   2607,   3227,
-  2296,   5603,    211,   -731,   6450,  -3312, -12378,   -326,
-  4245,   4168,   -799,  -3563,   -505,    725,  -5297,   2196,
-  2221,    -16,  -3472,    315,    626,  -6131,     71,    920,
- -4383,  -1340,  -2675,   -664,   7412,  -1240,  -1361,    997,
- -3817,  -2377, -11717,   1661,     22,    540,  -5261,   -950,
-  7472,   3148,   7647,  -4400,   4558,  -4412,   -869,  -1528,
- -2618,   8311,   2110,    534,   -460,   -223,   -162,   -828,
-   274,   1844,   1861,  -1583,   6899,   5222,  -1772,  -2880,
- -6400,   4703,   2606,  -3990,  -1224,  -4160,   9032,   -299
-},
-
-.cb4440m1 = {
- 32767,    383,    857,  -1579,   -423,   1164,  -1606,   1218,
-  -410,    777,   -292,    122,    282,    -74,  -1394,    259,
-  -734,    102,    -82,  32616,    427,   -545,   -146,   -141,
-   340,    506,   -808,    171,   -778,    900,   -204,   -277,
-  -228,   -426,    566,   -481,  -1138,   -907,    112,   2722,
-   871,    115,  -7202,   1953,   -826,  -1812,   -396, -14722,
-  -840,    155,   1114,   5624,   1112,   -147,  -6383,    926,
-  1505,    360,    937, -13391,    969,   7062,   2218,  -3531,
-   471,    458,    191,   -465,   8664,  -1168,    546,   2109,
-  -944,    -74,   1644,    -81,   -760,  -1920,   2659,  13330,
-  1511,  -1148,   1346,    796,    -20, -15616,   1246,  -1190,
--10882,   -774,    -70,   3643,   -896,   1830,   -192,   1018,
-  1085,    -95,   -309,    659,     91,    727,  -4486,    486,
- -2078,   1235, -14415,  -4053,  -1619,  -2589,   -582,  -4650,
-  4076,   -762,  -1111,    277,   1448,   -742,   -314,   -979,
-  1889,   2679,  -1972,   2480,    302,   2869,  -9183,   -445,
- -1817,  12894,    106,    187,  -1406,   -615,  -1174,    746,
-  -371,    382,    350,  -1811,   -527,     36,    500,   -835,
-  -106,   1134,  -2207,   1021,    348,    908, -21780,    448,
-   688,    -60,  -1790,   1901, -22990,   1467,    596,   -912,
- -3190,   1484,    269,   -409,   -474,  -1670,   1328,    152,
-  -402,    359,   -734, -13208,     62,  -4197,  -6242,   5195,
- -2841,   5030,   2794,   1264,  -1130,   3821,    961,    729,
-  1075,     49,   -148,   7267,   2596,  -5093,  -8284,  -6875,
- -3059,   3909,  -4635,   1402,  -6334,   -342,  -3083,   -861,
-   490,   1257,   -630,    128,   2240,    832,   1060,  -1802,
- -1652,    128,   7816, -14391,  -6722,  -3328,  -2586,   3044,
-  1088,   1577,    852,   -142,   -176,   1371,   1236,    976,
- 12165,  -1596,   -199,   -504, -11020,   -582,    972,  -1468,
- -2402,   -666,  -3327,  -2148,   1078,   -194,   9675,  -2102,
- -1236,    -70,   -942,    291,   1364,   1403,  -3362,  12963,
-  -375,  -1728,   1615,  -2354,    633,   -506,   -194,  13037,
- 14172,    534,  -1026,   -425,   2488,   -180,   -678,   -436,
-   272,   1507,   -334,    840,  -1000,  -1068,   1029,   -306,
-    24,  -4435,  -5994,  -1307,   4251,   3968,   2527,   -981,
- -2626,  -4400,   -242,  -1823,   -679,  12831,    -22,     51,
-  -381,   2422,  -2376,  -8156,  -1477,  -6974,   1102,   -373,
-   467,  11314,   -554,   -432,    824,   7277,    393,   -178,
-   179,   -653,  11848,  -1593,  14143,   -731,  -1036,  -2322,
-   261,  -1992,  -1152,  -1430,  -1354,    -51,   -285,  -1637,
-   144,    -59,  -2182,   5731,    538,   -880,    397,   3010,
-   707,  -1822,  -1006,   4686,  -5096,   4246,  -3096,  -3997,
-  -254, -11025,    394,   -345,  18780,   -686,   -517,  -3422,
-   104,  -2173,   2439,  -5400,    -10,   1084,   1821,   -602,
-  1431,    405,   2143,    499,    405,    351,    -62,    -47,
-  1954, -29915,    440,   1054,    559,  -1210,    442,    928,
-    -1,     59,    279,   -112,   -110,   -440,   -396,    805,
-   311,    858,   -431,  -1070, -30192,    135,   1246,   -345,
-   790,    498,    319,   -302,   -469,    -10,    512,   -829,
-  -526,  -2052,   2456,    134, -19375,  -1210,  -1292,    640,
-  3232,   2580,    973,  -2412,    271,   -282,    632,   -523,
-  -847,   -138,   -990,   2501,    536,   -166,   2100,   -357,
-   122,    466,     -4,   2034,  20083,   1578,    444,   -344,
-  -689,   5733,   -456,   -503,   -592,  -1350,  -1038,    932,
- -1916,   1098,   -990, -22687,   1544,   -442,   -396,   -570,
-  -683,   -616,  -1431,    118,   4113,   -312,   2300,   2093,
- -2344,  -2955,   6343,   4306, -10078,   6286,  -5794,   -806,
-   664,   -217,    548,   5072,   4626,  -1643, -11619,    779,
-  1956,  -2960,    614,   2087,   9104,  -2418,    775,  -4447,
-   768,   1599,  -1084,    999,   1652,   1090,    630,  -1197,
- -3495,   -912,  -9817,    648,   3278,   1828,  13605,   2757,
-  -831,  -1191,  -1846,  -1441,   -278,  -8530,   -455,   -495,
-   323,   -911,   2500,  14100,   3635,   1016,   -936,   5265,
- -3092,   2125,   -121,    -64,   -656,   -337,   9438,  -7600,
-  1403, -11917,   2180,   2612,   1664,   1091,   -318,  -3300,
-  -427,    282,   1979,    894,   -703,    514,    160,   1697,
-  6508,    828,    187,    -34,  -1094,  -2861,    240,  -5013,
-  6004,  -4796,   -991,    158,  11437,  -1730,    354,   1195,
-  3790, -10432,  -3584,  13872,    336,   2043,    221,    604,
-  2930,   1080,  -1417,   1878,   -878,   -459,   -419,    364,
- -1037,   7764,   3100,     48,  11057,   1936,   2229,   9150,
-  -472,   1178,   -129,   2876,   -249,   -258,  -1181,   -329,
-  -581,  -1140,  -1967,    347,   -539,   -394,    775,  -1151,
-   -31,   1052,  -1900,   -213,  -1552,  22484,    164,   -113,
-   135,  -1294,    550,   7738,  -7223,   -739,   1362,   5518,
-   193,  -2170, -11861,  -1357,    351,   2215,    165,     16,
-  -606,    727,   -158,   -772, -13420,  -1248,  12422,   -812,
-  1768,   -442,   1269,  -1076,    899,    124,   -249,  -1110,
-   653,  -3064,  -1632,    839,   -230,    512,    642,  13230,
- 13285,   -552,  -1113,   -595,    864,    537,  -1012,   -539,
-  -615,   -491,   1014,    800,    -10,    534,  -1227, -25011,
-  1239,    -26,   3834,    104,    762,   1259,   2112,   -300,
-  -920,   -812,    612,  -1061,   -378,   -246,     -7,  11042,
--18492,  -1411,    -77,    407,   -556,    218,   1751,   1069,
-  -294,   1789,    904,    285,    -76,    300,   -160,   -128,
- -3398,  -2001,   1689,   4946,  -2750,   1427, -12632,  -1873,
- -1802,  -1115,  -2777,  -4436,   2937,  -6408,   -467,    487,
-  1043,   3914,    -81,   1540, -11718,   1368, -12656,   -583,
-  1009,   -416,    249,   1874,   1157,    994,   -858,   -154,
-   294,    333,    -26,     73,  -1576,    -20,   -560,  -1068,
-  1325,   -588,  26161,   1580,   -411,   -587,  -1083,    -79,
-   762,    292,   -622,    788,    284,   2014,     78,    554,
-  -516,   1340,    835,    300, -24827,    558,   -705,    -22,
-   139,   -159,   -246,   -585,   4318,    234,   1308,   -198,
- -3370,   5724,   2381,  13843,      4,    569,   8002,   1188,
-   -63,  -1698,   4624,   -405,   -218,   4238,   -888,  -1180,
-  3750,  -4848,  -9497,    293,  -1087, -13274,    -33,  -2870,
-   457,   -618,    338,    -34,    286,    345,  -5321,    904,
- -5656,  -2082,  12644,  -7423,    532,    958,  -1997,  -1483,
- -2982,   3115,  -1851,  -2025,   1853,   -918,   -903,   1554,
-   540, -16549,   1441,   2939,  -1272,   3106,   2374,   3906,
-  -697,   1144,    750,   -379,  -6502,    980,    386,     36,
-  1109,   1195,   6272,   4264,   1501,   5369,  -1560,   3535,
-  1084,    739,  -1031,  -4400,   8452,   -430,  -1787,  -7669,
-  -231,   -115,   4324,  -1820,  -2098,   -786,   7478,  -2709,
--14255,   5771,    115,  -1700,   -111,  -1482,  -1369,   -112,
-   122,   -472,    233,   2427,   1816,    180,   -481,    928,
-    82,     84,   -700,   -448,   -946,   1968,   1644,    168,
-  -167,  16164,    155, -10316,    941,   -584,    488,     96,
-  5205,    491,  -1844, -13055,   1266,   -352,   -836,    558,
-  1546,  -1720,    313,   2033,    597, -14351,   4426,   3281,
-  -559,   2614,   3248,  -2265, -10312,  -1614,   -288,    480,
-  1419,   -546,   -485,    835,    960,    462,    923,   6518,
-   834,   -711, -12639,   8811,   -207,   1806,    337,  -1240,
- -4796,   2383,    277,   1141,    969,     59,    197,   1365,
-  -614,  -9144,   4824,   -436,   4191,  -2588,   4509,    391,
- -5055,  -3231,   6978,  -6388,     51,    105,   -863,   1050,
- 13103,  12769,   -420,  -1562,   -123,   2702,    292,   1061,
-   123,    405,   1917,   -275,    493,    -95,   -195,    130,
- -2613,   9010,    196,  -1382,   5903,   7281,   1585,   2557,
-  -876,   3166,   6910,    590,  -3060,   -559,   4722,    393,
-   613,   -392,  -3022,   9892,   1808,    923,   8123,   9873,
- -1665,   2349,   2894,    591,   2000,  -3734,   -917,    220,
-   408,    296,   -656,   2608,  -1700,    400, -10734,   5434,
-  6504,  -1399,   2175,  -1203,  -6358,  -1221,  -5062,     45,
-   970,   -500,  -1322,   1176,   5882, -11687,   6324,  -2183,
-  2327,    922,  -5628,  -3507,   2406,    874,   1399,   4518,
-  -343,    857,   -224,    802,   -725,  -8561,   4432,   1974,
-  1825,  -2168,   -451,  -3408,   6587,   7589,   3361,  -4711,
- -1474,   3151,   1950,   1022,   1466,   9192,   4666,   -822,
-  1024,   2342,  -2220,   1169,  10460,   2993,   -988,  -4407,
- -6727,    902,   1659,     80,    106,    400,     34,   1746,
- -6982,  10484,   6333,   -845,  -3333,   1764,    217,  -4730,
- -3306,  -3664,  -2830,   2254,   -927,    -55,    587,   1812,
-   281,   4375,  -3614,  -1349,   1802,  -6184,  -2648,  -4189,
- -9381,  -3243,  -4147,    384,   2241,   5524,   -478,  -1534
-},
-
-.cb4448l0 = {
--15402,  -5156,  -1798,   -144,  -4711,  -4700,   2819,   -389,
-   148,  -2600,   1706,  -1906,   -578,    495,     24,    829,
-  -383, -12581,  11667,  -1039,   1395,   2670,   -288,     23,
-   628,   -248,   -512,     79,   -326,  -5428,  -2830,  -2476,
- -1253,   -915,  12042,   -674,   -110,   2950,   3885,  -5799,
-   983,    616,   -652,    -60,   -372,     22,   -141,   -167,
-    98,    125,   -100,  27211,    133,   -127,   -271,   -272,
-  -176,   1268,    173,   -422,   2431,  -3998,  -2797,   2328,
-   182,   6526,   3318,  -6282, -10580,   3966,   8504,    527,
-  9507,   6203,    990,   -989,   6030,   -136,    647,  -1100,
-  -324,  -2618,  -2499,    500,   -132,   -842,   1237,   3599,
-  2285,   2906,  10766,  11284,  -2794,    242,    184,  -1934,
-    55,   -839,  -1181,    406,    855,    902,  10490,   -327,
- -1561,   5742,    428,   2218,   1523,   5229,   9130,   -760,
-   108,   -140,  22229,   1132,    411,    720,    414,   -356,
-  -745,  -1276,   -899,   -562,    369,      5,  -7770,   4101,
-  3626,    126,    -13,  -4356,    728,  -3197,   1930,  -1470,
- -6936,   -410,   6720,   1897,   -530,  -4267,  -2181,   -876,
-  -472,  -2540, -10234,   4008,  10217,  -2561,  -2021,    716,
- -1378,   -325,    427,   -245,    314,    -48,   -118,   -150,
--30295,   -368,    256,    369,   -656,    -78,   -246,   -140,
- -1250,   -635,   1332, -13604, -10383,  -1375,    353,   2417,
-  2140,   -349,   1460,    -51,   -309,    523,    509,   2352,
-  1208,   -377,  -2023,   9708,    397,   1216,  10610,  -4416,
-  5520,   3902,  -2119,   -480,   -420,   1170,     36,  -3304,
-  1550,   -266,   1682,   -808,   2420,   2700,  16239,   3910,
-   572,   -375,     85,  -9775,   -120,   2214,   2779,  11510,
-  2628,   -416,  -1740,  -1305,   1226,     78,     78,    635,
-   422, -13892,   1302,  -4117,  -1218,   2681,  -8436,  -1723,
-  2290,   2815,   1172,   -181,   -675,   -475,   -763,   2394,
- -3639,   7903,   -659,   2323,   4837,  -6758,   9460,  -1480,
- -2403,  -2783,   1496,    806,   -458,   -246,     12,   -254,
-   121,   1477,   -633,   -513,    791,    208,   -390,   -177,
- -1292, -20471,  -4401,  -2678,   9026,    128,   -265,    822,
-   260,  11202,   3132,  -1879,  -3891,   1884,   -842,   -107,
-  7516,   1208,  -1552,   -995,   1203,   2150,  11044,   1285,
-  2282,     80,   1348,   5342,   2089,    924,   1472,  -1454,
- -8259,   -226, -10259,  -2335,  -2442,    224,   3257,  -1528,
-  6685,   1630,   1969,     48,   4802,   6051,    987,   8662,
- -2368,  -4984,  -1974,  -4049,  -5320,   5003,    299,   -400,
-   727,    208,   -187,   2838,  -4547,   9682,  -2238,   1065,
- -3206,  10091,   4915,   2945,  -1635,   -198,   1074,   -698,
-  -716,    -96,   1390,  -2644,   1006,  -4154,  10587,   1132,
-  2912,  -7399,  -8350,    785,    156,   -290,   -142,   -374,
- -2161,   1066,   1358,  -1798,   3050,    -19,    452,  10470,
--10948,   4190,   -984,  -2089,   -728,   1503,   4273,    812,
-  4950,  -3750,    844,  -1231,  -1582,  -2517,   2385, -10537,
-  5807,  -4621,    332,   -357, -12484,   1676,    160,  10762,
- -1225,  -1374,     14,  -1389,  -2900,   -467,  -1260,    459,
-  -861,    102,   1715,   4295,  -7324,  -7400,  10435,    287,
-  1866,    765,   1730,   3430,   -744,     -2,  -1773,    -96,
-  2001,   2165,    118,   9296,  -4640,  -4612,   7134,   5128,
- -7967,    404,   -433,   -433,   2222,  -8050,   2023,   2766,
-  -260,  -2440,   1607,   2442,   7763,   -486,   3766,   2355,
-  7515,    230,   1248,  -8873,  -8224,  -9135,  -1402,  -1812,
-  1223,    152,  -2316,   -739,   -405,   -784,   -598,    625,
-   503,   -175,   -573, -31693,    502,   -478,   -554,   -934,
-   387,    -80,   -484,   -701,    -34,    -51,   -494,  -1461,
-  1005,   2920,  11532,   2667,  -1674,   -832,   8680,  -5767,
-   786,  -1558,  -2062,   1009,   -392,   2099,  -7277,  -2587,
-  6302,   3070,   4496,  -1713,  -4042,  -8109,   1642,  -1894,
-  3450,    840,   3632,    160,    578,    149,    767,    754,
-   208,   -870,   -672,    252,    -30,   -213,   -482,     50,
-  -578,     -2,   -148,    246, -31918,   -568,    130,    472,
-   761,    -27,    -51,    454,    144,    124,   5844,  -8354,
-  9562,  -3755,   -262,   3286,   1120,    983,   -628,   -734,
- -1732,  -1424,    353,   -403,  15877, -13552,   -335,    337,
-   519,    140,    297,    150,    725,   -780,    876,   -116,
-   -91,   -128,    275,   2499,   9313,   -768, -10469,   1148,
-  2172,  -6417,   3292,  -2187,  -1108,   3055,   1105,    625,
-   794,     68,    337,   1384,   -106,   -516,    574,    868,
-   849,   -997,     81,  25796,     28,    206,  -3556,   -351,
-  1058,   1126,  -7826,   5310,  -4102,   5352,  -6835,  -4032,
-  1487,    230,   5617,    937,  10484,    -71,   2653,   1203,
-    -1,    667,  -1489, -10136,   7782,   -763,    792,   1434,
-  -170,    367,     96, -21992,   -252,    756,    145,  -1476,
-  1408,   1523,   -819,   -576,   -476,  -1068,   -241,    -39,
-  1547,   9553,   -622,  -1799,   1861,   6115,   -864,  10690,
-  -586,    470,    200,   1162,    586,     44, -11650,   3453,
-  8734,  -2754,   -178,    236,  -2650,   2654,   2699,   1180,
-  5325,   -458,    -40,   -218,     -6,    126,   6794,    506,
-   860,  11863,    652,   1665,  -4213,   4863,   1424,   5712,
-  -663,   -688,    -10,  -1421,   -676,  -1325,   -378,   -311,
-  -490,  19501,   1242,    268,   4581,   1587,  -1153,    848,
- -1378,  -1159,    505,     63,    704,   1942,   2204,  -2106,
-    44,    479,  -1098,    333, -21595,   -617,  -6444,   3547,
-  1282,  -1784,   4664,  -1330,   2607,   1241,  -3579,    247,
-  -875,  11359,  -3013,   -136, -12813, -14400,   1857,   -998,
-  1342,   1187,   -338,   1263,    575,   1226,   -995,    596,
-   446,    293,    767,   -356,     70,    786,    466,    202,
-   149,    849, -28991,    652,    124,   -209,   -124,   -406,
- -5463,  -1413,  -1300,  -5339,  -1761,   4770,   2680, -10542,
-  3486,   5601,   2932,   1581,    489,    521, -16583,      1,
- -1529,   5942,   1234,   4714,  -1647,   1150,   2802,    642,
-   586,   3836,    240,    307,   -490,     67,    771,    816,
-  -906,   1554,   1090,  -2353,   -629,  11291,   2941,  -2982,
-  9473,   1434,  -4351,  -8017,  -5173,   8071,   1931,   1281,
- -4055,  -3224,  -1918,   -271,   -204,    670,   3491,    107,
--31624,    227,     75,    -91,    108,    171,    -53,   -201,
-   373,     63,    118,    126,   -104,    127,    -88,   1810,
- 11688, -10240,    550,   3692,  -4978,  -1619,     40,    911,
- -1080,    580,   -767,    333,    192,    403,    308,   -904,
-   142,  31169,    503,  -1101,   -146,   -144,     35,    181,
-  -355,     54,    590,    499,     95,  -1767,    444,    -49,
-  2160,   7176,  12032,   6478,   -741,  -5576,   -644,   -101,
- -1251,  -1268,   2365,  10029,    537,  -1476,    307,   2108,
- -2478,   -944,  10725,    349,  -4242,   -135,   7577,  -4492,
-  1492,  -2512,   7736,  -5118,  -6756,  -2436,  -1890,  -2390,
-  1620,    914,   1658,     47, -11692,   -134,  -1740,   -196,
-  9521,   -136,  -1376,  -8682,  -1136,   1096,    903,  -1148,
-  -334,   -228,     -4,   -675,   -199,   1914,   2827, -11098,
- -2129,  -2559,   -978,    175,   1832,  10075,  -2358,  -1888
-},
-
-.cb4448l1 = {
--11514,  -2858,  12392,   -305,   -206,    929,    473,  -3120,
- -2766,  -1068,  -1237,    420,   -718,    -21,   -336,    -45,
-  -478,  -1517,   1830, -12644,    259,  11978,    257,   1494,
- -1759,    247,   -733,    112,  -2242,    290,    234, -10260,
-  1781,  -1806,  -4104,   1747,     38,   -692,   4971,  -9113,
- -1925,  -1580,   -615,  -9608,   3779, -11158,    469,  -4736,
-   299,  -2815,   2108,   1910,  -2356,     66,    523,   -440,
-  2298,  -4219,  -2512,  -1110,  11192,   5932,  -2629,  -7985,
-  -992,    775,  -1134,   3287,    900,   -681,    -39,  -1206,
- -1708,  -6800,   -361,  11024,   8496,   -198,  -3855,   1486,
- -2547,   1773,     50,   -276,   -286,    785,  -7884,    438,
-  4590,   2794,   5333,   5476,   2108,    660,   3610,   2308,
- -8538,    224,   -132,    134,    731,    988,  -1368,   3894,
-  4318,   9911,   -104,    320,  -9506,   1721,  -5690,   1712,
- -8747,  -1876,  -5122,  -1304,   -162,    752,   3646,   1621,
- 11089,   1117,  -1971,   1058,   3070,    180,  23112,    175,
-   483,  -1028,   -538,    497,   1053,     61,    788,   -455,
-    22,    -55,    -32,   -326,  15956,  -2045,    788,   9784,
- -1170,   -819,  -3677,    647,   -484,    578,   -160,    286,
-  -421,    289,   8140,   3838,   -578,  -1866,  -2074,    667,
--11951,   1684,   3439,   1280,    158,  -1784,   1276,    638,
-   562,   2045,   -220,    852,   -594,  -2109,  -2665,   2748,
-    38,     91,   1377,   -624, -18586,   -498,   -882,     36,
-   536,    -99,     62,  -5275,   3051,    231,  -6343,  -1751,
-  1206,  -1646,  -1347, -13590,   1431,   -271,   -442,  21934,
-  -143,  -1824,   -378,   -463,    816,    379,    336,   -291,
-  -652,    275,   -758,    257, -14866,  -1304,   7260,  -3373,
-  1249,  -1992,   2734,  -2565,  -3064,   -416,   2424,    279,
- 10518,    206,   -681, -14338,    666,   1843,   -648,    526,
-  1982,    366,    684,   1019,    192,      8,   -482,  -4785,
-  2134,  -1722,  10674,  -1613,     33,   1148,  -1566,  10226,
-  3397,    667,  -1100,   -738,   2420, -14282,    451,     90,
--10346,   2673,   1175,  -3639,    266,   -566,      0,   1672,
-  1082,    298,    359,   -497,   1784,   -570,  -2538,   2522,
- -3825,   6265,     99,  -7927,   3160,  11079,    131,  -2080,
-    92, -29951,    268,   -293,    240,    254,   -182,   -145,
-   303,     12,     86,    596,    246,    136,   1020,  -1521,
- -1134, -10125,  -5691,   6028,  -3703,  -4295,  -3718,  -5719,
-  -564,    660,   -321,  -1073,     83,  -3068,   6167,  12788,
-  -762,   8057,  -1215,   2379,   2142,  -3625,   -503,  -1418,
-  -304,   -649,   -501, -12558,  12787,   3737,   1465,  -3692,
- -1321,   1106,  -1136,   -651,    -50,   1608,     59,   -583,
-    82,    331,    443,    782,     93,    285,    310,  29149,
-  -698,    -52,   -909,   -238,   -222,   -114,      4,    650,
-  -200,    235,   2541,    598,    378,  11000,   3101,  -8228,
-  1690,  -4313,   6996,    -11,  -2620,  -1458,  -1428,    579,
-  -304,     20,   -372,    897,    602,    432,   -138,    690,
-   593,  -1485,    136,    191, -32147,    260,    199,    412,
-  -168,    -41,   -384,   -362,    -14,    242,    366,   -318,
-  -304,   1544,    458,  -7790,   3332,  -5117,  -1937,    868,
- 12622,    906,   1941,   4763,   1698,    351,   -234,   -973,
-  9166,   6726,   2686,    248,   3597,  -9812,   -400,   4155,
-  2852,   -415,   2218,    876,   1423,   3852,   2965,   -410,
-  1820,   8268,  -1296,    686,    114,   3087,   3007,  -9402,
- -5751,  -3459,  -6674,    418,   4137,   4778,     56,  -1399,
- -1698,  -2590,   8343,  -2130,   2535,   6148,   -134,  -2393,
- 11551,   -338,    735,    630,   -658,  13358,    949,  -1136,
-  -217,   -985,    182,  -1014,   1459,    221,   7713,  -1386,
- -1427,   1326,    555,     66,   2694,  -1535,   -268, -13596,
-   658,    305,    858,    548, -12748,   -582,  -1055,   -659,
--12155,    940,  -2164,  -2518,   -126,   -132,   -842,    641,
-  -483,   -446,  -5184,   -186,   -511,   1169,  -6092,   6161,
-  3082,   -664,  -2037,    847,  11032,  -1306,  -1673,  -1219,
-   -36,   1862,  10053,    780,   -282,   -837,   -263,    509,
-  -588, -12646,   -769,  -2164,  -2219,    524,  -3433,  -6437,
-  3890,   -623,  -7509,    241,   4042,    264,  -1394,   3646,
- -6925,  -5184,   1218,  -1476,  -2240,   1882,    182,  -3450,
-  -497,   -148,    160,  -1579, -19545,    -80,    886,    913,
-   708,    728,    393,   -603,   -778,   3414,   -778,  -1495,
-  1205,   2342,    232,  -3634,    -76, -16792,   -684,   1322,
-   192, -13248,   -658,   7650,   4731,   -169,   5148,  -1413,
-  3026,   2480,  -2190,   1004,  -2082,    237,    171,   -717,
-  -766,   -525, -11802,  -3776,  -9914,   1374,  -3250,    415,
- -2787,   -175,  -1081,    792,    980,  11464,    834,    714,
-  -993,    150,     77,   2306,  11249,  -3058,  -3418,  -1758,
-  -239,   -119,  -1408,   6083,  -4276,   1827,   1660,   2287,
- -2997,   -576,    400,   2062,  -3174,  -6215,  10026,  -1082,
-    41,    249,  10026,  -6199,   -301,    280,  10120,   2249,
-   527,   -564,   1002,    622,   3341,    408,   2870,  12902,
- 13307,    689,    336,   -819,    -43,    832,  -1242,    657,
-  -106,     42,   1123,    149,  -2072,     78,   -303,    329,
- 21745,  -2172,  -1204,    448,   1437,   -560,   -376,    311,
-   -73,    153,   -785,   -368,     54,   -445,    -92,    120,
-   -59,   -377,    402,    567, -25820,   1284,   1288,    200,
-  -865,  -1286,    -41,  -1862,    402,    179,  -2338,  -3876,
-  4992,  -1824, -10092,  -3407,  -8516,  -3556,    130,  -5695,
-  5846,   2333,   2995,   2110,  -6946,   5049,  -2377,   1655,
-  -859,  -4737,   1648,   7031,  -7344,   4992,   1760,   -711,
-  3134,  14363,   -907,    171,  -1971,  -3062,  -1079,    600,
-   603,   -224,   -440, -11328,   -291,   -663,   1878,   -715,
- -2724,    284,   -456, -10970,  -3225,  -2240,    252,   -977,
-  -360,    729,   -572,   3981,   1615,    -52,  -5372,   6095,
- -9888,   6873,  -3830,   4916,   1834,  -1581, -11268,  -2316,
-  -398,   1361,   6151,   2736,  -1968,   4624,   -180,   -260,
- -1221,  -5633,  -1300,  -1081,  -1433,   -509,    366,   -388,
-  1660,    340, -18997,    694,  -1184,   -813,   1324,   1261,
-   735,   -186,   5258,   -583,   -221,   1707,    149,   1022,
-  -835,   1089,   2939,   2025,    421,    411,   3609, -13797,
-   464,   9214,   2462,  -6257,   6032,   1911,   1282,  -9673,
-   974,   -703,   -128,    950,    369,   1160,   -674,   -312,
--13858,   1078,  -7606,      8,   2786,    367,  -6441,   -824,
-  -195,    714,    484,    108,    475,    289,  -1012,  -1591,
--10880,   -324,   -647,  -2199,  10378,   5781,    995,   -416,
-   871,  -1240,   -380,     70,  -1893,   7632,   1727,   -908,
-  -672, -10901,   -962,  -7322,    794,   1748,  -5568,   1215,
-  5845,  -9575,  -2413,  -2159,   3077,   1359,   -416,   6277,
-   -85,   1352,  -3498,   6130,   1125,   -236,   1950,   8481,
-   716,   -560,  -1311,   -228,    250,   -440,  -5320,  -1941,
- -9710,   4637,   1420,   -102,  -8222,    616,  -2254,   -528,
-   196,  -1315,   -749,    -97,   -285, -15880,   1105,    630,
-   368,   -809,     29,  -1688,  -2314,    745,  -1627,  19840,
- -2380,   4108,   1670,   2763,    275,    530,    492,   -589
-},
-
-.cb4448s0 = {
--10720,   9997,  -1313,   8849,   5152,   -226,  -2908,    303,
-  -842,   -870,    165,  -1372,   -105,   -154,    170,   2424,
- -2476,  -2126,  -8329,    349,  -4509,   5128,    -92,   9086,
- -7263,    416,   -124,    341,    -88,    239,   5172,    553,
-  1526,   1728,   1955,  -1489,  -6595, -11237, -10224,   -394,
-  -927,   -932,    674,    743,    317,   4628,   8453,  -3768,
-  2545,   3506,  -2406,   9108,   5643,   4660,   4116,  -2452,
- -1391,   -154,    -74,    180,   5270,  -7922,     46,  11046,
-  6076,    735,   7922,   -196,  -1080,   1445,   -687,  -2403,
-  -784,    742,   -269,   -498,   6010,  -4045,   1053,    891,
- -1538,    613,    -84,  -4254,   -957,   4682, -14004,   2050,
-  -647,   -718,    557,  -2720,   2437,  -7675,  11874,  -9284,
-  -734,    775,  -2231,    105,    366,   1360,    -98,   -126,
-   508,   2647,    729,    762,  -8806, -10413,   9008,  -2093,
-  1107,    201,   1421,   1181,   -259,   1420,    828,    327,
- -1956,   -573,   -874,    354,   2662,  -1437,  10864,  -9240,
- -7648,   1670,   1598,    173,    438,   -373,   -566,    246,
--11999,   1817,   -611,      1,  -1652,   1876,   1354,   1270,
-  -789,    300,   -321,  11577,   -516,    329,   5723,   4732,
-  1717,  -6224,  -5356,  -6292,   -370,  -3644,   -922,    -50,
-   -14,   -581,  -1554,  -1675,    -20,   -965,  28479,    658,
-  -498,   -488,    504,   -601,    437,   -585,   -245,   -196,
-   186,    281,   -174,    159,   7469,   5890,  -5112,   4918,
- -9023,   -360,     40,  -2975,   4784,   -437,   1609,   1032,
-  2759,   -297,    106,   5176,  -4315,    568,  -9536,  -1297,
- -6783, -10965,   1285,    264,    330,   -508,   -522,    624,
-   662,    539,   7248, -13780,     40,   2140,  -2188,   1925,
- -8972,   1147,  -1340,    870,    779,     -4,   -101,   -374,
-   781,   5733,  -5712,  -5777,   2080,    875,  13450,  -1551,
- -3229,  -1818,   -114,   1265,    501,    636,   -576,   -623,
- -1269,   3006,   1023,    862,   1359,   1950,    588, -22648,
-   218,   -438,   1547,   -408,   -844,   -263,   -106,  14754,
-  -689,  -9466,   -978,    -21,   1412,     43,   2012,    352,
-   908,    277,   -960,   -747,   -230,  -1557,  -7132,  -5707,
-    79,  -2474,   2177,  -5349,   2510, -12720,   2833,  -2152,
- -1693,    458,    197,   -643,    735,  -2728,   -893,   2758,
-  5196,  -3566,  -4294,  -4914,  -1222,    188,  -8884,  -6234,
-  2391,  -1518,    663,    572,  -1465,   1147,   8486,   2037,
-  2516,    941,   6092,  11602,  -2559,  -1702,  -1848,   -924,
-  -210,   -108,  -1052,   8360,  -7567,  -4588,   -169,   3464,
- -9206,   1842,  -4329,  -2499,   -341,    592,    918,   -102,
-   340,    214,   1037,   -324, -16289,  10308,    -47,    -29,
-  1340,   -603,  -2763,   -548,    392,   1489,   -149,   -769,
-   -67,  13270,  -2233,   8257,   1582,   1034,  -4270,    916,
-  4486,   1191,   -102,    159,    109,   -536,   -664,   -987,
- -8041,  -1759,   4264,  -5600, -13815,  -1158,   1712,   2516,
-  -634,    504,    515,    732,    -46,   -685,   -481,   1685,
- -1782,    262,  -3600,  14721,   6334,   7941,    101,    914,
- -2141,     -2,    182,    829,   -215,   -122,   6325,  -3752,
- -2812,   1618,   3512,  -1591,  -4276,   6994, -10349,  -5675,
- -1501,  -1766,  -1949,    436,     82,  -5596,   2592,  -1086,
- -2804,   2540,    458,   -550,  -1834,  -2401,  -7563,   2340,
-  1678,  -7666,   4538,     27,   6337,   3642,  17068,   5310,
-  1115,   1579,   -142,   -397,   -670,   2010,    863,   -504,
-   845,    848,    770,  -8821,   1963,   2782,    162,   1130,
-  2597, -13699,  -3996,    800,   2499,  -1045,  -1512,   -186,
-   -59,   -119,  -5048,   6800,  -8766,    784,  -7091,  -1002,
-   335,   1993,  -1045,    601,   1804,    166,   1343,    110,
-  -224,   2247,   -344,     -5,  -4292,   5846,   8591, -11846,
- -1303,  -1027,   1759,   -168,   -194,  -1281,    489,    378,
- -5069,  -3321,  11238,   -375,   -806,   3962,   9660,  -2960,
-  -664,  -1067,   -627,    271,   1205,   1160,    261,   3725,
-  7877,   -679,     22,    598,  -1086,   -420,   2168,    -46,
--15552,    420,   1220,   1332,    -58,   -156,   7777,  -4657,
-   352,  15316,  -4760,  -2140,  -2577,  -1321,   2037,   -371,
- -1254,   -912,  -1177,  -1367,   -103,   4572,  -9482,  -1599,
-   294,    403,   -272,  -2331,  -4365,  13467,   4585,  -2554,
- -1743,    545,    162,   -369,   6074,  11273,  -8856,  -8175,
-  2543,     -7,    314,  -2033,   2704,  -1755,  -1431,   -791,
-  -276,   1085,    236,   6553,   1872,    387,   1056,    -31,
--20610,   -609,    608,   1007,   1604,  -1501,    -68,   -527,
-   204,    252,   2533,   -721,   1468,    444,    -72,     61,
-  -209,    512,   -216,     42,    385,   -490,   -104, -29030,
-  -166,  -4883,  -2754,    788,   -430,   -867,    565,  -1155,
-   562,   1076,   1757,  -2990, -14971,   8392,    902,    550,
-   102,  -6579,  -6939,   -319,    172,   -863,    979,   2178,
-   630,    160,    952,    946,  -3955,   1515,    352,   2557,
- -5339,   6166,   4588,  -2040,   4031,   -535,  -2504,   2782,
--12136,   1338,  -2758,    458,   -671,    155,   6998,  -2598,
-  -931,   -396,   -922,   2060,    447,    -42,   -649,   -532,
-  -552,  -1945, -16548,    815,   -408,   3469,  -4118,    875,
- -1017, -11150,   -511,   3846, -11349,  -1928,   -781,   2765,
-  -681,   -713,    655,   -218,  -8032,   -465,    295,   1591,
-  -383,  -1889,   1627,    108,   1149,   2513,    388,  -5702,
--15693,     24,    470,  -4322,   3721,   1584,   1808,    350,
- -1765,   -620,  -2953,   4354,   8512, -12533,    -86,  -2490,
-  -192,   -507,   2024,   3942,   -801,  13444,    738,  -2086,
-   162,   2013,    837,     56,   -384,   3164,   5052,   1158,
-  -403,  -6913,  -4290,  -2068,  16622,  -2738,    856,  -2884,
- -2432,   -410,  -1179,   -456,    504,  -1359,    436,    352,
- -6351,    327,  -2196,  -1502,    302,    338,   -839,    235,
-  -520,   1283,   2710,  18814,   2256,     -2,    400,   1300,
- -1185,   1024,  -3744,  -3542,  -4350,   -763,   1902, -14737,
-  5437,     48,  -1589,   -280,    -67,    232,   2276,   1413,
-  3284,   -308,   1013,    610,  22787,   -685,    724,     12,
-  -359,  -1651,  -1060,    569,    248,   3836,    605,   -413,
-  3380,  -1360,  -1120,  -2933,  -2368,   -977,  10135,  12356,
-  3739,  -1571,   -418,    580,  -2662, -11460,  -6128,   2867,
- 11468,    825,  -3201,   -501,   -138,   -755,   -554,    168,
-   757,   -564,    428, -12118, -15179,  -1978,    432,   -597,
-  1528,   3038,   -568,   1349,  -3377,    914,    498,    928,
-   -91,     -5,   9192,   3000,   2542,  -1411,    626,   2705,
-  -763,   3247,  13736,   3034,   2170,    -67,   -852,   -378,
-  1264,  -2771,  -2415,  -4236,    126,  -1984, -13336,  -1088,
-  -416,  -1979,   -520,   2506,  -1505,    294,  -2398,    218,
- -8740,  -3873,   2069,  -1374,     86,   -998,  -3851,   1070,
- 13357,    955,   3085,   -536,    166,    926,    299,   6532,
-  1324,   -502,  -1658,   1829,  -1263,    445,  -1902,   1452,
- -2747, -16422,   1875,   1773,    452,    288,   5992,   1626,
-  3659,   -917,   2255,  -1508,    356,    547,    158,      9,
-  -117,  -1665,   -595,  14392,  -1013,     49,  -4060,  12064,
-  3666,  -2903,  -9145,   -396,  -4341,   -953,   2758,   -178,
-  -204,   -462,     98,    222,  -3622, -12200,  -4484,    -94,
- -8642,  -5694,   4034,   -720,  -1695,    751,  -1668,   -266,
-  -343,    296,   -112,   -900,  -3750,   -360,   1002,  -7402,
-  7758,   7370,   3332,  -7517,   -769,  -1272,    412,  -1451,
-   -89,   -227, -11332,   -472,  -1108,   -394,   -339,  -1981,
- -3494,  12110,   -564,  -5958,   -690,  -1066,   -130,    762,
-   -50,  -1456,  -1521,  -8428,    994,   -867,   2650,  -2335,
-   354,  -2253,   4612, -12364,  -2626,   1853,    577,   -103
-},
-
-.cb4448s1 = {
- 25901,   -239,    648,    167,   -284,    198,   -340,  -1112,
-   -55,   -242,   -214,    528,    112,   -259,   -284,   -250,
-    23,    475,    780,   -558,    111,    148,  -2411, -19826,
- -1158,   2799,   -964,     44,  -1204,   1187,  -4036,   1872,
-  3541,    768,    159,   1979,   3382,   -113,    804,  -1021,
-  3708,  -2577,   9697,  11527,   -326,  -7058,   4306,   1260,
-  3782,   3370,   1595,    705,   2268,   2182,   1509,   1131,
-  9877,  -7260,   -258,     49,   1686,  -1472,  -2556,  -1973,
--22425,    338,    486,    963,   1069,    -34,  -1027,    -90,
-  -881,   -473,    554,  -6326,   -873,  -9744,  10157,  -1079,
-   584,  -1047,  -1954,   6204,   2416,   -899,   1452,    938,
-  -439,   -664,   4231,   9370,   7800,    170,   9448,  -4756,
-  1967,    686,  -1186,    636,  -1719,  -1244,   -540,   -728,
-   306,  -1778,  -7980,  -3418,   8318,  -1828,   1556,   3487,
- 10195,   3741,   -510,   2077,  -1496,   1241,    384,    477,
- -1051,   7922,  -4077,  -2513,    849,   -693,  -9170,   4264,
- -7940,  -1703,    460,  -2986,    586,     13,    377,    781,
- -7047,   6852,  -1350,   7537,   -493,  -1919,    379,   3108,
-  4293,   8467,  -3875,     63,     44,    493,   1496,  -1577,
- -5676,   3318,   6628,   5177, -11082,   1146,   3251,  -1159,
-  -461,    442,   1250,    212,    176,   3586,    137,  -9153,
--13772,  -8211,    393,   1170,   1717,   -671,    298,   -233,
-   883,  -1533,    401,    254,   7700,  -4827,    794,    377,
-  -376,  12240,   7298,   2445,   1168,   -562,   1528,    563,
-   421,   -606,      0,   5792,  -1069,    824,   3728,  -2729,
-  1005,   -730,   4318,    644,  17336,  -1588,   2100,   -365,
-   509,   -415,   3684,  -9128,  -1096,  -4278,   1549,  -1247,
-  5519,  11075,  -2216,   6004,  -3683,    409,   -730,   -414,
-  -263,  -6623,   8194,    489,  -9085,    334,  -1104,   -814,
-  1412,   1522,  -1657,  -7029,  -4142,  -1274,   -520,    -40,
-   650,  -1886,   9701,  11456,  -7567,   1176,   3268,   3016,
-  1109,   -117,   -858,   -155,  -1249,   -230,   -216,   3945,
-  9142,  -2297,    134,  -2563,  15131,    857,  -1597,   -618,
-   150,   -590,   -166,   -357,    388,    -69,  -8767,   2914,
-  1087,   4673, -14373,    600,    382,  -1893,    844,   -242,
-   544,   -106,    568,  -1141,    371,   2663,  -1860,   -725,
-  8066,  -1353,  -8743, -10433,  -1796,    427,    -73,    178,
-    96,    980,   -478,    978,   1767,   6034,    633,    966,
-   677,    -65,   -884,    417,    461,     62,   -868,     93,
-  -100,    519,  16304,   2646,  -1260,  12271,   -140,    142,
- 11138,   -892,  -2114,   -629,    172,    744,  -2056,   -960,
-    61,   -980,   2082,   -439,  -3126,  -2564,   1174,    -78,
-   254,   -178,   1599,   -436,  19023,   5335,  -1686,   -782,
-   520,  -8727,    256,  -3588,  -5694,  12323,  -2091,   1511,
-  -656,   3872,   2370,   -770,    282,    455,   -573,    -39,
-  7845, -12566,  12690,   -156,   -442,   -227,    575,   -274,
- -1717,    120,    -40,   1866,    635,    161,    270,   1039,
-  3256,   -673,  -3343,   4292, -14247,   7142,  -4821,   -591,
-  -418,    376,     21,    572,    551,     70,  -5536,     79,
-  2540,   -505,   -283,   -350,  -1279,  -1630,   2234,   -604,
-  5246, -17580,  -3022,  -1052,   -307,   6626,   2794,   1702,
-  1875,  -1876,   1011,   -320,   1268,   -282,   1072,  14370,
- -8206,   1218,    630,    173,   7486,  15176,  -6146,   4903,
-  -636,  -1341,   1360,  -1541,  -1012,   -778,     84,    426,
-  -124,   -746,   -252, -11085,   1783,  -2833,    809,   -744,
-  2194,   3328,   7029,  -5097,   4934,  -3025,   -641,    303,
-  -328,    258,   8674,     53,  -3395,    975,  -9944,  -8550,
-  3376,   -714,   1078,   1186,    598,    808,   -166,   -752,
-   484,  -5088,   1484,  -1278,  11394,  -1876,  -8236,   5159,
- -1830,  -1520,   2761,    592,   -204,  -1360,    454,    230,
- -5038,  -1582,  -5617,   1346,  -2045,   2306,  17764,    494,
-   572,  -1930,    339,    550,    784,    151,   -753,   4708,
- -3058,  -8267,   3281,  -1054,    870,  -1201,  -2005,   -920,
--10115,   5395,  -6423,   -798,    367,   -221,  -5296,  -2808,
-  8313,  -5077,   1655,   -200,    114,     46,    350,  -2374,
-   868,   -327,    377,  -9570,   1231,   9258,   8752,   3074,
- -4411,   -308,   2315,   6824,  -3303,   -896,  -1186,    579,
- -2561,   2280,    586,   -798,   4747,  -3487,   1306,  -1241,
-  -487,    -90,    -52,   3231,   -555, -17702,  -2681,   1649,
-   -17,   -278,   -647,  -4225,   2740,  -1248,  -3826,   1356,
-  3572,  -1010,  16160,   -422,    304,   3970,   1124,   -317,
-  -554,    673,  -1191,   3180,  -4429,   1581,   1543,  -2097,
-  4208,  -9363,  10146,   1896,   2904,  -4112,  -1428,   -207,
-   459,    -35,   5395,  -8960,   3141,  11004,    308,   3687,
-  1540,  -2156,   -592,   1640,   1003,   -280,    797,    204,
-  6910,   -824,   4724,   4729,   5553,  -3165,    483,    -12,
-    33,   -588,   -379,    402,   3543,  -9646,     74,   9603,
-  -465,   2872,  -2367,   -885,   2894,   -133,   2758,   -721,
-  3473, -13322,   1506,  -1344,    512,   1066,  -8300,  11391,
- 11976,  -1201,     13,   -612,    165,  -1823,    154,   -123,
-  1234,   -423,   -367,    -58,    384,   2687,   2536,    826,
-  6223,   1750,  -8589,   1126,   9772,  -6646,   2043,   1826,
- -1037,  -2018,    692,   -818,  -3431,   -467,  11006,   3407,
-   880,  -2047, -10303,   6168,   1428,   -307,    -18,    661,
-  -252,    754,   1207,  -2797,  -3057,  -6235,     99,   -931,
-  1618,    692,   2790,   -294,  -1200,  -5768, -11691,  -5305,
-  -100,    390,   -783, -11660,  -4675, -13570,   2764,   1414,
-  -786,    385,    163,    718,    794,   1118,    827,   -634,
-   -75,   6224,   3965,  -2092,  -1120,  -6395,   5474, -12986,
- -3985,    635,   -544,  -1877,   -191,      0,    121,    379,
- -3059,    132,  26320,   -721,   1262,   -706,    421,    -85,
-   -38,    665,    590,   -208,   -196,    168,     10,   1271,
-  -218,   -365,  -5843,  -5897, -12346,  -3026,   5916,   -115,
- -2671,  -1022,   -203,    962,    995,   -850,    527,   -516,
- -1641,    452,     68,   1204,    740,    385,     38,    752,
-   150,  -3088,  20608,    -54,    -39,   6109,   3224,    -92,
-  -315,   4407,   -306,   1317,   -395,  -1617,   9104,  -3493,
--10724,  -3059,    283,     81,  -9791,  -3210,   7307,   4459,
-  -639,    -61,   1152,   -184,   2290,    398,  -2902,  -2776,
- -1624,   1153,    242,  -8865,  -3617,    309, -11933,  -3847,
- -5750,   3235,   -153,   -315,    382,    209,   -923,   2072,
-   458,    164,   3631,   3121,   3220,   -828,  -8644,   2215,
-  3873,  12445,    533,   -631,    -53,   -136,   -728,   -240,
-   420,   2870,  -4981,    906,  -3272,   4735,   3613,   2412,
- -3951, -10587,   7389,    564,   3266,  -1348,    524,   1570,
-  6611,   3354,  -1042,   1862,   1860,  -1187,   5761,  -1722,
-  8231,  -7428,  -5662,   1239,  -2887,   -218,    810,  -1063,
- 15078,    686,  -2374,   -293,  -2031,   -245,   4441,   5045,
-  1100,   6722,   1787,   -587,   -380,    132,   5124, -12478,
-    95,  -1230,   1464,  -1871,    929,   1430,   2666,  -3768,
-  2784,  -3697,  -8238,   -247,    603,  -8406,   1330,   1033,
-  -743,  -2546,   2739,    856, -12698,  -4970,   2290,  -1104,
-    34,  -1048,    -80,    634,   -695,    -84,   2374, -24793,
- -1064,  -1080,   -254,   -812,    252,  -1582,   -401,    765,
-   847,    340,    479,  -3163,    150,   -187,   8432,   2607,
-  2075,   1384,    423,  -7361, -10262,  -2254,     54,   1065,
-    40,    857,   2014,  -5076,    198,    657,    482,   -422,
- -2185,   -850,   -318,    164,   -684,   2698,  -1008,  17493,
-   -64,  -6788,  -5966, -14352,  -2349,   2492,    266,   1077,
-  1935,    -99,   4270,   2319,  -2391,    779,    187,    -70
-},
-
-.cb4448m0 = {
--20455,    663,  -3140,   2540,  -2110,   -406,   1078,   1968,
-  -741,  -2458,    490,   -496,    338,    581,   1079,   -616,
-   154,  10097,    231,   -228,    477,     20,   1372,  11492,
- -1112,  -3148,    547,    248,   -676,   8197,   5902,  -1299,
-   519,  -2808,  11529,    -76,   1239,  -1032,   -542,    353,
- -1071,    278,    274,   2781,  -7741,   3260,   2711,    175,
- 12340,   1110,  -2348,  -5303,   1440,    581,    -70,    262,
- -9902,  -2375,    530,   1433,   1624,  -1475,   -947,  13450,
-  1318,  -1696,    207,    198,   1162,   -944,  -9329,  -1046,
-   195,   -106,    682,  14624,   -854,  -2410,   1054,    242,
-  -348,    581,    463,    716,    760,   2714,   1356,  -1359,
- 13089,   2565, -10523,   1934,    637,   1218,   1160,    830,
-   905,    272,    408,   -581,  -1426,    613,   2586,  -8186,
-  3748,  -6663,   4372,   -114,  -4644,   2998,  -9440,    685,
- -8741,   3363,  -5623,  -4229,  -7058,  -1201,   -822,   1806,
-  8671,   -856,   -612,   1165,   -426,    317,   6867,    -80,
- -7084,   1143,  -1862,   2742,    669,    550,     22,    173,
-  4301, -10406,   1042,   -346,  -1334,  -2897,    647,    744,
-    14,  -1338,  -1648,  -1235,   3550,   -455,   2125,   1188,
- 17136,   1188,  -6782,   -849,    298,  -1054,  -9254,    409,
- -1736,   1410,  -7254,  -1889,    457,   -740,     22,    262,
- 32242,   1657,  -2308,   2688,   -607,    609,      4,    150,
-  -264,    192,   -140,    246,   -393,    -76, -15050,    390,
-   969,    457,   1436,   -649,    460, -12150,   1359,   1014,
- -2103,   -576,     55,   -590,    113,  -1410, -23431,    182,
- -2386,  -1568,    904,   -218,   -281,   -188,   -178,     63,
-   211,    549,    687, -12069,    -88,   -654,  -1070, -13155,
-  -124,   -697,    438,   3174,   1700,    270,    234,   -289,
-  -625,  15749,  -2340,   8466,    397,  -4460,  -1030,   3206,
-  1081,  -1317,  -1030,    -72,    487,  -1477,  -8782,   6984,
- -1221,   2395,   3198,   2995,   5862,  -1195,  -6075,  -1020,
-  -934,    868,   -470,  -1024,   1202,   -998,  -1306,  22118,
-   344,    540,  -3137,   -547,   2440,    -28,    222,    372,
-  -424,   -199,   1068,   -917,   -105,  -4278,     52,   -299,
-  6933,  11715,   -520,  -2853,     58,  -8575,    416,  -1272,
-  1128,    -32,  -1140,  -1873,   -495,    235,   2079,   -314,
- -1328,  -2615, -20194,    848,  -1553,    387,  -6091,    906,
--10180,   8634,   -506,   4078,    318,  -2657,   1612,   -126,
- -1424,     -4,  -1745,   -343,    302,   2439,  12190,    941,
--12534,  -4756,   -176,    -90,  -1295,   1041,   1875,   -450,
-    89,    212,   2098,   1708,   1876,   4065,   1682,   1972,
- -4916,   -951, -10683,   1443, -10978,    772,  -1013,   -235,
-    59,    213,   -230,    142,   -576,    506,    101,     44,
-  -137,  26238,    -47,   -322,   -289,    281,   2614,  -4538,
-   634,   1116,   1191,   2985,   -759,  -5527,    550,   2107,
- -6018, -11013,   -425,   -221,    901,    217,    546,    213,
-  2026,    695,   1074,  -2132,   -173,  -1664,   -783,  25065,
-  -326,     86,   -632,   1398,   4708,  -2911,   2376,    135,
- -1471,   -904,  -2338,    987,   3216,  -4564,    314,  15692,
-  -214,   1238,    230,   -181, -30537,   -294,    155,   -607,
-   218,   -309,   -180,   -246,   -102,   -988,   -644,    111,
--10517,  -1604,  -1180,  -2748,   1191, -12959,     -2,  -1004,
-    28,   -196,   1974,   -790,    809,   8802,  -1204,    332,
-   180,  -3857,   1025,  -5998,  -9578,     94,  -1069,  -2398,
-   185,    643,  -1479,    322,   2544,  12584,  -8308,  -3856,
-  1286,   1600,  -2539,  -2752,  -2520,   -367,   -942,    417,
-  -309,  -2162,   2044,  10886,   1764,  11028,   3810,   2955,
- -1028,  -1017,  -1752,   -487,   -605,     48,   2312,   -368,
- -1758,   -252,    371,  19882,  -1994,   1675,   5494,   -660,
- -1669,    256,    -54,   -941,   4318,   -306,   2143,    273,
- -3367,  -3088,   6509,  -1884,  -5400,   -576,  11394,    875,
-   455,    271,   -218,   1401,    -44,  -5336, -12170,   4664,
-  -589,  -3562,  -1934,   5842,   1357,   3232,   1449,   -402,
--11228,    -96,  -1509,   2073,  -1751,    776,   -439,    775,
- -3302,  13521,   -325,   -118,   -172,    411,   -396,   6154,
- -2455,    -52,  -4616,    783, -12488,  -2085,   5817,  -1278,
-   635,  -1713,   2888,   -830,    649,   7482,  10134,   9147,
-  3784,   1046,  -1934,  -2580,    102,   -679,   -124,     68,
-   657,    417,   -175, -32768,    -80,    375,   -941,    224,
-   271,   -232,   1519,    -99,   -680,     67,     66,   -618,
-   252,   1907,   5121,   2456,  -2117,  -9388,  -1441,    636,
-  7868,  -8340,   1939,   1340,   1511,    711,   6530,  -1748,
-  -183,     90,   2561,   5860,   -364,   5117,  -4101,  -4028,
-  -944,  10526,  -1028,   1047,    707,  12116, -12596,  -4006,
-   922,  -1047,    348,   -971,   -272,  -2388,    435,    246,
- -1055,    148,  -1852, -12418,  -2531,   3524,   4103,   -344,
-  1667,   2818,  -4576,   -273,  -8337,    183,    497,   -144,
- -9845,   -292,   -503,  -1212,   4316,  -1434, -11058,  -3043,
- -5817,   -981,    813,      0,   -718,   -467,  10285, -19005,
-   -82,    776,   1192,   1030,   1560,   1080,   -144,    729,
-   606,   -225,   -389,   -187,    552,   -930,   -444,  -5959,
- -1960,  -1315,   2650,  -1282, -18790,   1772,    263,   1410,
-   812,   -458,   -476,    744,   2595,   -426,    -19,   9119,
-  4529,  -1502,   4673,   3675,   7430,   1084,  -6966,   -518,
--13552,   1054,   2474,  -9499,   1041,   5114,    442,   2927,
-   511,  -1492,    217,   -726,    398,   -522,     35,    119,
-  -332,    106,    816,    437,  -1223,  27612,    521,    -29,
-  -462,    367,   -966,    476,  -2559,  -3485,   -160,   1487,
-  -272,   -586,  -6014,   -232,   3679,  -1864,   1244,    575,
--14591,   -483,  -1428,     20,   7874,  -2948,  -5965,   2383,
-  3270,    490,   2750,   -547,  -9658,  -1473,    943,    285,
- -2388,   -772,  -1582,   3181,   3419,   2628,   -197,   3376,
--13282,  -7684,   3383,     70,  -1174,    -70,  -6703,  -7305,
-  -553,   3588,   -826,    -12,   7350,  -3604,    345,   1098,
-  3856,    918,   2038,    -39,  11514,  15798,   1327,   1158,
-   436,   -918,     71,    953,    975,   1147,    174,    411,
-  1467,     83,  -4536,  -1511,   5350,  -3314,  13999,     18,
-  4107,   1901,    834,   2614,   2356,   -369,    943,   -341,
-  -460,   4380, -10014,   3308,  -3541,  -3225,   -621,   8449,
- -1383,   4481,  -1399,  -3646,   -936,    923,    221,    346,
-  7828,   2406,   3021,  -4993,   3012, -10903,  -1925,   8153,
-   382,  -1453,   1238,    601,   1195,  -2245,  -2792,  -4118,
-   473,   4898,  12961,  -6094,   5905,   1368,  -2754,   -303,
-   768,    -31,  -1275,   1400,    596,  -1326,    619,  -1744,
-  1145,  -3977,    639, -10785,  -1693, -11192,   -541,   -434,
--11384,  -1017,  14361,   1398,    521,  -3239,   1851,   -491,
-   237,  -1024,   1002,  -3002,   -303,    -33,  -6532,    601,
- -3726,   7832,   6090, -10107,    957,  -1149,    689,   1327,
-   -51,   1945,    990,   -106,    595,    234,    518,   1060,
-    77,    837,  28880,    -91,   -395,   -275,   -265,   -279,
-  -217,   -300,    240,  -1055,   -406,   4314,  -2139,   6349,
- -2227,  -5996,    963, -10386,   4629,   -560,   1080,    134
-},
-
-.cb4448m1 = {
- 31577,  -1322,   1533,  -2224,    253,  -1485,    -92,    294,
-   183,   -580,    420,    172,   -794,   -206,   -342,   -338,
-    53,    -85,   -920,  29517,   1073,   -972,  -1839,   1004,
-   290,     46,    460,    -71,   -988,   1731,   -362,  -2070,
-  3848,     -2,  -3842,    734,  -1221,  -8012,   1104,   6782,
-  9673,   1082,  -8561,   -860,  -2135,  -1557,  -1613, -13999,
-  1664,   2268,  -1570,   -732,   1010,   -402,  -1139,   -428,
-   400,   1123,  -2108, -11776,   -345,  10608,   1245,  -3142,
- -3244,  -1132,   1700,   -308,   1573,    543,    678,   5160,
- -3062,    433,   2703,   -852,  -4903,  -1880,   1706,  13995,
-  2465,  -4844,   -904,   -148,    350, -11168,   1406,    312,
--11900,    397,    769,   5558,  -1354,    187,    -30,    231,
- -1020,    202,    884,   -198,  -3151,   -830,  -8490,   -670,
- -2767,   1517, -12957,  -3861,  -2794,  -1854,   -180,    135,
-  7140,   4103,  -4427,    450,    494,  -1033,  -1110,  -2857,
- 11056,   -711,   -800,   3628,   -180,   -852, -10300,  -2120,
-  -450,  14464,   -511,    303,  -1464,   -542,    -89,   -204,
-   500,   -400,   -318,    569,    216,    428,    350,   1973,
-  -137,   -885,  -1794,   -974,   3977,   3382, -18624,   -420,
- -1947,    165,   -449,   1395, -17313,   -286,   2054,   -447,
- -2740,  -1881,   -550,  -2166,   1360,  -6021,    -94,    148,
-   676,  -1619,  -1737, -11977,   -169,  -1664,  -7709,   6202,
- -5954,   1681,    715,   -263,     56,    369,    589,    564,
-  1989,   1617,  -1648,   9205,   1343, -11508,  -7379,  -3791,
- -3136,   1049,   -844,     24,  -6714,  -1736,  -5734,  -2907,
-  5016,   2167,  -5722,  -1210,   6232,    428,   2467,  -3334,
- -1477,   -711,   6728, -10274,  -4930,  -6224,   -349,   -710,
-  1598,   -713,  -1708,   -497,   -254,    567,   -884,    131,
- 11520,   -908,  -1425,  -1862, -13449,  -1590,   -669,    657,
-   505,    236,     -4,     21,    846,    100,   8248,  -1847,
-  -131,   -186,    181,   -806,   3293,  -1072,  -1208,  14492,
-  1555,   1527,    544,   -120,   -258,      6,  -2401,  12455,
- 10880,   1091,  -2350,   -939,  -1252,   -564,    150,   -114,
-  1419,    737,  -1732,   -440,  -2303,   -226,    536,  -2492,
- -1085, -10117, -11013,   3786,   5275,    -10,   2479,    143,
- -1647,  -7945,    884,  -1618,   2056,  12890,   -424,   5986,
- -1471,   -666,   -570,  -1466,   -499,     64,    566,  -1738,
-  -639,  11380,   -612,   1879,   1550,  12469,   -299,  -1501,
-  2634,   1036,   3020,    -13,  14974,  -2066,  -5786,  -2667,
-  5487,  -6768,    468,   -385,    778,   -805,   -536,   -304,
-   718,    386,    285,   7546,    643,   1462,    913,   4707,
-   941,  -3338,   -194,   6669,  -4493,   8869,   -837,    400,
-  -877, -11113,    326,  -2318,  13683,  -1304,  -1966,   -933,
-   312,    128,    470,   -296,   -322,    340,  -1126,   1811,
-  1999,   2885,   3201,    331,  -2494,   3999,    660,    -80,
- -2063, -16771,  -1337,    426,   4884,  -6026,    -40,   2093,
-   342,   -176,     83,    134,    796,   -425,  -8934,   2100,
-  8550,    160,   -221,   -252, -32714,   1306,   1332,   -609,
-  -109,    547,    848,    518,    -40,    303,   -246,   -451,
- -2177,   -716,   -750,      1, -21232,   1287,  -1303,   2051,
-  1659,   1501,   -369,  -1415,    274,    308,    260,    371,
- -1409,   -662,  -7347,   7161,   3656,  -1104,   8862,  -5671,
-  1370,   1122,     16,   1132,  17593,   6778,   -993,    613,
-  -665,   3004,   3288,  -1625,  -1823,  -1003,    740,  -1002,
-  -888,   -677,  -1065, -25294,    997,   -160,   -180,   -811,
-   188,   -333,  -2483,   -696,   1309,    120,    456,   -116,
- -2020,   -896,   7216,   6328,  -9170,   8407,  -2986,  -1684,
-   680,   1752,   -684,    613,    337,   -629, -11750,   -493,
-  -324,   -907,   -391,   1053,  14125,    142,    420,  -1917,
-  -378,  -1428,    -90,   -497,   1116,   -464,   2170,    805,
- -1572,   -904,  -9020,   -534,   6450,   -490,  10750,    279,
-   765,    961,  -3985,  -2702,   2423,  -4981,  -1222,   1654,
- -1089,  -2157,   1940,  14331,   -895,   1726,   1555,    122,
- -3552,   1274,   -598,   -910,   3056,  -1704,   6430, -10626,
-  1014,  -8773,   1009,   1936,   -360,   -468,  -1029,  -8841,
-  -625,   2212,   2234,   2720,   1190,    -64,  -2078,   4688,
-  8690,   5150,   -450,    744,   -796,  -5661,   -332,  -7938,
-  2670,  -4054,   1377,  -1594,  11554,  -4702,  -3631,    745,
-   742,    -90,  -1311,  12528,  -4664,    834,   -853,   1542,
-  8560,   2209,   4091,   2876,   2117,   -678,   1684,    785,
-   304,   7980,   2126,   -302,   8239,  -2105,   1584,  11894,
- -1055,  -1391,    596,   2343,     86,    388,  -1348,  -1007,
-  1428,    413,  -9231, -10312,  -7346,  -1108,   1385,  -1255,
- -3954,    738,  -1258,    410,    226,  15115,  -1059,  -4117,
-   -50,   -504,  -1726,   1425,  -9974,   -346,    688,    464,
-   244,   -586,  -8880,    845,   -659,    932,  -1309,    290,
-   -29,   -417,  -2184,   1011,  -9622,   1443,   9009,   1945,
-  2698,   -708,  10572,   2410,   1200,   4492,  -2569,   1444,
-  2735,  -8604,   2274,  -4057,    478,   -199,   1285,  12695,
- 12321,  -2933,  -1708,   1198,    675,   -492,   -560,    -52,
- -1261,     85,   -480,    -96,    696,   -764,  -1402, -31368,
-  -580,   -675,  -1678,    -58,    600,   -522,   -292,    647,
-   -36,    154,  -1148,    437,   1561,    588,    603,   7629,
--16973,     29,   -828,   -589,   -919,  -1372,   -470,   -445,
-   428,    528,   5828,   -353,    -32,  -1781,   -702,   -690,
- -7196,  -3253,   1942,   4600, -12102,   -674, -10480,  -2336,
-   711,  -2174,  -7474,  -1436,   -451,  -7133,    856,  -2652,
-  1892,   3464,   -546,    676, -13296,   -516, -13618,   -997,
-   938,   1686,   1006,   1358,  -1371,    922,    534,   -170,
-   126,    255,   -835,     50,    945,  -1066,  -1676,      3,
-  1038,   -437,  26030,    418,     27,  -1092,   -493,   -428,
-  -606,  -1097,   -628,    298,    295,   -806,    183,    146,
-  1352,    -84,   -722,    833, -25667,   3176,   1001,   -322,
- -2339,     15,   -475,  -1257,   2116,    876,    637,   -529,
- -1108,    302,  -2452,  19734,     58,    851,   9845,   1142,
-  2168,    706,  11070,   1556,    544,   3002,   2238,  -3974,
-  2738,    -48,  -8324,  -2186,   -355, -14933,   2192,  -2481,
-  2700,    473,   -486,    761,   -208,     76,    -78,    102,
- -4896,   1378,  12377,  -8269,     28,   1092,  -5071,  -1500,
- -1190,   -804,   1085,   -766,    493,     22,  -1041,   9136,
- -1234, -12247,    967,   2672,   -883,   4582,   4871,   1891,
-  -532,    329,    226,    446,  -6710,    312,   -914,   1416,
- -1852,   3052,   6512,   8971,   5544,   6519,   -579,   1021,
-  -241,    911,    782,  -3456,  10158,  -1865,   3941, -12300,
-     8,    472,    882,  -1580,  -1799,  -1025,   -631,   -127,
--15316,   8047,   -200,  -1860,    582,  -4363,  -1274,   1085,
-   -48,   2383,    638,    480,    369,   -838,  -1341,    414,
-  -114,   2757,   1222,  -2194,  -3394,   6469,   2418,    738,
- -1656,  15594,  -1090,    202,    727,   -769,    484,   2462,
-  4875,   1656,  -3835, -16877,   5276,    239,    982,  -1872,
-  -130,    901,   1352,   -155,   4939,  -8317,   9000,   2503,
-   485,   1184,   -548,  -1356,  -7482,   -188,  -1587,    496
-},
-
-.fcb08l = {
- -2539,  -3275,  -2699,  -3345,  -2843,   5501,    426,   7127,
-  -149,   3111,  -2991,  -2297,  -2345,   2702,   -969,   -946,
-  2837,   1114,   1800,   1271,  12249,  -2282,  -2309,   1566,
- -2889,  -3020,  -2083,   3586,   8919,   2651,   4111,  -1842,
- -1588,  -1428,   3251,   -102,    156,   -320,    722,   1711,
- 20565,  -3068,  -2211,  -3164,  -3410,  -3396,  -2882,  -2002,
-  1730,   4077,  -2696,  -1694,  -2839,   2948,  -2739,  -2380,
- -2252,  -1311,   -269,   1900,  -2796,   -444,  -2996,  -2525,
-  5194,   1459,   5042,  -1089,    914,   4116,   7644,  -3137,
- -3156,   4028,  -3435,  -3240,  -2585,   5542,   5119,   9885,
- -2995,  -3153,  -3449,  -3101,  -3551,  -3469,  -2196,  -1271,
-  3869,   5413,  -2800,  -1990,   3371,  -2286,  -1022,   3190,
-  -550,   1723,    968,   1916,  -2749,  -1530,  -2211,  -2987,
- -3357,  -3262,  -1042,  10277,    107,   2662,   9819,  -2753,
-  4269,  -3277,   3125,  -3131,  -2974,  -3251,   6466,   9484,
- -2034,  -2707,  -2424,  -3170,  -2619,  -2278,   -143,  -1641,
- 11856,   5975,  -1282,  -2629,  -2396,  -2364,  -2012,  -1085,
- -2576,  -2422,  -2206,  13731,  -2261,   2751,  -1768,   2482,
- -1065,   -347,   -137,     31,    619,    385,  -2257,  -2215,
- -1698,  -2686,   4468,  -2563,  -1071,  -1359,   7757,   3732,
- -2856,   9018,  -2046,  -1494,  -2234,  -2209,    -67,   1340,
-  2433,   2965,  -2722,  -2151,  -2966,  -2780,  -2732,  -1509,
- -2085,  -1532,   6934,  -1248,  -1936,  -2203,   -787,  -1781,
-  -895,  -1990,   4693,  -1818,  -1569,   1954,  -2283,  -2403,
- 10514,  -3105,  -1074,  -2838,     -1,   1192,   1113,   3309,
- -2249,  -2451,  -1660,   2535,  -1439,   3582,  -1093,   -594,
-  1956,    758,   5349,  -2524,  -2320,  -1903,  -2055,   5075,
-  -941,   -721,   -536,   2197,  -2309,  -3027,  -1460,  -2911,
- 11344,  -2474,  -1601,  -1749,   3260,   2547,   3819,  -1247,
- -1449,   2835,  -1118,   -652,   -516,   -379,    531,    440,
-  -569,  -2606,  -2545,  -2447,  -1685,   8678,  -1868,  -2003,
-  -992,   5888,   8591,  -1848,  -2010,  -2196,  -2049,   -658,
-  3473,    214,    905,    317,  -2050,  -1083,  -2593,   8754,
- -2234,  -2449,  -1688,   2194,   2244,   2502,  -1659,  -2748,
-  4584,  -3011,   3702,  -2307,  -1887,  -1960,  -1068,   2889,
- -3022,  -2989,  -2295,  -2794,   3071,  -1588,    -43,   2627,
-  1278,   2031,  -2145,  -2551,  -2333,  -3205,  -3237,  -2760,
-  9082,   -454,   4339,   1776,  -2738,   4785,  -2176,  -1896,
-  2148,   1350,    768,    249,   1001,   1499,    797,  -2182,
- -1443,   -229,    -32,    827,    401,    270,    581,    380,
- -2370,  -2376,  -2679,  -3099,  -1742,  -1149,   4666,   -693,
-  1109,   7547,  -2496,  -3063,  -2818,  -2621,  -2016,   5722,
-  4932,   1217,   2161,   2449,  -2207,  -2954,   3769,  -2824,
- -1809,  -2946,  -1693,   -377,   1565,   4100,  -2947,   3063,
- -3062,  -2919,  -3093,  -2520,  -1712,   2383,   1305,   1867,
- 10145,  -2912,  -3307,   7519,  -3502,  -1063,  -2782,   8595,
-  -750,  -1503,  -3141,  -2486,   2923,  -2574,  -1826,  -1244,
-  3537,   2494,   2583,   1560,  -2722,   3284,   2245,  -1258,
-  -658,   -394,    483,    719,   1121,   1073,  -2949,  -1013,
- -3048,    597,  -3103,  -2510,  -1970,   7207,   8635,   1917,
- -1772,   -483,  -2318,  -1860,  -2500,   2981,  -1651,    550,
-   696,    615,  -2121,  -2055,  -1619,  -2126,   3108,   3417,
-  -485,    -47,    848,   1608,  -2636,  -1707,   3142,   3798,
-   479,  -1112,    597,   -323,   1555,   1531,  -2930,   2106,
- -2398,  -2314,  -1835,      0,   2920,    896,   2356,   1259,
- -2911,  -3184,    593,  -3570,  -3389,  -3263,   7340,   7640,
-  6874,   6549,  -1912,  -1334,  -1749,   -568,  -1718,   -405,
- -1375,   3456,  -1024,  -1903,   9384,  -2721,  -2485,  -2377,
- -3026,   -899,  -3133,  -3032,  -2452,   7715,   2492,  -2450,
- -1721,  -2138,  -1497,    -55,    760,   2382,   1183,   1105,
- -2782,    389,  -1528,   -927,    664,   -531,   1405,    363,
-   582,   -292,  -1678,  -2718,  -2763,  -3140,  -2799,  -2178,
- -2715,  -2592,   -972,  -1226,   3278,  -1173,   2916,  -1548,
-  -446,  -1241,   -209,    379,    689,    538,   3110,   2857,
- -1735,  -1244,   -589,   -413,     65,    471,    522,    323,
- -2043,   -212,   1309,   -471,   -564,    -16,    378,   -320,
-  -437,    228,  -2194,  -2637,  -2513,  -2670,  -1863,   -954,
- -2082,  -2398,  -2270,   5563,  -2959,  -2444,  -2794,  -1736,
- -1631,  -1324,   1482,   -481,   2317,   1470,  -2871,  -2007,
-   702,  -1980,   -491,   -146,   -695,   -145,   2817,   1268,
- -3395,  -3456,  -3069,  -3433,  -2874,   -205,    806,   3038,
-  3806,   2623,  -2954,  -1861,   -712,   1017,   -326,     44,
-   -93,    910,    775,    346,  -2625,  -2570,  -2974,  -2344,
- -2712,  -1930,  -2213,   3521,  -1341,   4327,   -141,    835,
- -1119,  -1336,  -1092,  -1891,   -860,   -727,    315,   2562,
-  4119,  -2638,  -2584,  -1951,  -2710,  -2499,  -1561,   -952,
-  2821,   2505,  -2388,  -1855,  -2926,   1742,  -2563,  -2655,
- -1802,   3082,   3063,   2456,  -3304,  -2670,  -2147,  -1504,
-  -309,   1421,   1661,   1546,    560,    615,  -2590,  -1593,
- -1523,   2025,   3167,   -841,   -356,   -648,    309,   1165
-},
-
-.fcb08m = {
- -2962,  -2140,  -2166,  -1454,  -1638,  -1100,   -835,    686,
-   978,    550,  -1630,  -1021,  -1424,  -1867,  -1118,   -474,
-    66,   6104,    904,    603,   -829,   -475,  -1368,  -1199,
-  7255,   -890,   -465,    114,    118,    224,  -2453,  -1279,
-  8192,  -1289,   -452,    -47,    180,    324,    627,    209,
- -2770,  11214,   -857,  -1720,   -895,   -531,   -291,   -264,
-   232,   -402,  -2699,  -2561,  -2433,  -2093,  -1315,     86,
-  2666,   1663,   1351,   2349,  -2788,   4576,   3680,  -1365,
-  -995,   -513,     46,     44,    522,    142,  -2739,  -1654,
- -1950,   4573,   -659,   -536,    285,     72,    875,    627,
-  3142,    105,   -941,   1245,   -489,   -495,   -229,     44,
-  -236,  -1083,  -2336,  -1193,  -1620,  -1859,  -1339,   -655,
-   205,   1032,   5581,   1195,  -2635,  -1740,   2656,   1976,
-   -52,    784,    -96,   -165,    419,   -486,   8850,   -624,
-  -792,  -1531,   -765,   -674,   -730,   -829,   -150,    -27,
-  2255,  -1177,   2727,  -1430,    737,   -902,   -780,   -729,
-   169,    278,   3729,   3763,    -32,  -1581,   -563,   -573,
-    77,   -372,    -64,   -477,  -2500,    526,  -1682,   1464,
-  -830,   -124,   -548,    561,    202,   1115,  -1682,  -1552,
- -2014,  -2127,  -1374,   -749,   -720,     64,   2097,   6944,
- -2771,   4929,  -1680,  -2212,  -1430,   -801,    114,    891,
-  1176,    855,   3571,  -2187,  -1566,  -1694,     84,    -46,
-   932,    786,    765,    856,  -1038,   -498,   -117,  -1582,
- -1379,  -1162,   6293,   -367,    594,    132,  -2487,   2119,
- -2153,  -1749,    833,   1089,    507,    133,    337,    423,
- -2777,   2507,    277,  -1455,  -1019,   1811,    639,   -595,
-   136,  -1050,  -2941,   4474,   -176,   1095,   1113,   -479,
-   182,   -295,   -229,   -605,  -2035,  -1649,  -1171,     51,
-     0,    125,   2844,   -310,    -82,   -640,  -2251,  -2138,
- -2270,  -1567,   2260,     92,    368,     95,   1433,   1346,
-   820,  -2339,  -1822,   -895,    -69,    158,    190,    911,
-  1008,    764,    684,  -1756,  -1013,  -1625,  -1610,   6062,
-  -499,  -1036,   -139,   1129,    488,    524,   -665,   -870,
-  -347,    -76,    123,     91,    -12,     14,  -2867,  -2019,
-  2858,  -1903,  -1165,    309,    287,   1250,    767,    776,
- -2784,  -2446,  -1157,    460,   2589,    437,   -285,    711,
-  -299,    402,  -2683,  -2271,  -1714,  -1535,   -547,   4118,
-   510,   1158,    700,    631,  -2084,  -1236,    509,  -1009,
-  -510,   -193,  -1075,   -793,    727,   2150,  -2722,    968,
-  1077,  -1579,  -1410,   -894,    401,   1043,    427,    182
-},
-
-.fcb08s = {
- -2368,  -2340,  -1735,  -1897,  -1493,    984,   3062,   2826,
-  1049,    164,   1181,  -1990,  -1833,  -1720,  -1360,     24,
-  1485,   1923,    460,    511,     69,     78,   -353,     -3,
-  3761,   -480,  -1538,  -1063,    540,    -64,  -1546,   -988,
-  1514,  -1167,  -1354,   -563,   1435,    880,   1123,    182,
- -2243,  -2109,  -2378,  -2201,  -1491,   -836,   -124,    605,
-  6159,   3636,  -2770,  -2959,  -2956,  -3019,  -2154,   -648,
-  1805,   4698,   2929,   2078,   -975,   -360,   -895,   -623,
-  -593,   -879,   -345,   4333,    492,    -56,  -2102,   -781,
-  -476,   1268,    606,   -670,   1686,   -105,    370,    461,
-  -221,   -868,  -1381,    297,    128,   -578,   -809,   -938,
-  3896,    490,   4032,   2675,   -684,  -1108,  -1235,   -915,
-  -874,   -919,   -802,  -1040,  -1324,    -16,   2156,   1943,
-  -652,   -666,    -47,  -1499,    168,   -210,   4213,  -1895,
- -1734,  -1767,  -1412,   -867,    -71,    329,    855,   1294,
- -1849,   4393,  -1312,  -1597,   -564,    434,   -454,    269,
-   892,    -31,  -1170,     67,    370,  -1144,   -320,   3706,
-  -811,   -190,   -123,   -166,   -659,  -1033,   -789,   -902,
-  -347,   -280,   -108,   -313,    452,   3701,  -1505,  -2610,
- -2758,  -2550,  -2034,  -1361,   -676,    713,   2263,   8286,
- -2241,  -2508,  -2540,  -1721,    182,   1947,    306,   1773,
-  1220,   2909,    -60,     73,   -235,  -1631,  -1302,   -692,
-  4171,   -830,     49,   -188,   -471,  -2208,  -2265,  -1518,
-  -196,   2995,   2571,   -579,    -68,    805,  -1294,   1274,
-  4294,  -1356,   -702,   -532,   -465,   -123,   -400,   -719,
-   336,   3093,   1634,   -906,    -71,   -502,   -938,   -982,
-  -742,  -1187,  -1757,   2890,  -1591,   1303,    216,   -311,
-  -404,    -29,    501,   -543,  -1466,   1587,    309,   -578,
-  -173,     34,   1116,   1286,  -1184,  -1174,   -175,   -732,
-  -619,   3508,    -80,    191,  -1059,   -174,   -429,   -470,
- 10000,   -933,  -1511,  -1601,  -1571,  -1445,  -1065,  -1407,
- -1053,   -932,   1183,   7875,   -460,  -1609,  -1618,  -1398,
- -1154,  -1227,  -1012,  -1450,     20,     28,   -235,   -110,
-   203,    105,    252,   -154,    -51,    -58,   2940,   -490,
-    17,    -51,    131,   -106,   -526,   -566,   -822,  -1177,
- -1335,   2749,    608,  -1575,  -1322,  -1351,    111,    641,
-  1441,     -9,    733,   -207,   -273,   -665,   -630,   -588,
-   -78,    254,    304,    762,  -2661,  -2677,  -1238,    -82,
-  2569,   3001,    932,  -1032,    211,   -324,     40,   1395,
-  -836,  -1119,   -635,  -1425,  -1514,  -1135,   1509,   2963
-},
-
-.fcb11l = {
- -3004,  -2927,  -2672,  -2356,   -735,    179,    950,   1734,
-  1101,   1641,  -1610,  -1161,  -1606,   -179,  -1634,   3383,
-  -610,    240,     73,   1128,    818,  -1052,  -1641,    724,
- -1938,  -1741,  -1211,   3967,   1988,   1445,   3010,   2203,
- -1685,  -1698,  -1838,   -759,   -144,    515,    999,   1215,
-  3239,  -1912,  -2048,  -1739,  -1488,   -148,   1590,   1370,
-  1066,   1270,  -2721,  -1637,     99,  -1964,    224,   -946,
- -1437,   -954,    755,   1420,  -2800,  -2211,  -2304,  -2048,
-  4853,   -714,   -383,   2159,   1823,   2328,  -1619,  -1584,
- -1839,   5462,  -1703,   -802,   -227,    485,   1017,   1695,
- -2459,   2399,  -1820,   2254,  -1373,   -767,     53,    705,
-  1074,   1293,  -1582,  -2486,  -2208,  -2341,  -2264,  -2132,
- -1578,  -1043,    322,   7685,  -2198,  -1768,  -2106,     16,
- -2207,  -1495,  -1106,   -961,   -482,   1642,   6785,  -1540,
- -1540,  -1449,  -1177,   -854,   -307,    853,   1279,   1449,
-  3253,  -1427,   2314,  -1473,   -985,  -1025,   -321,    923,
-  1140,   1166,  -2704,   2664,  -2444,  -2717,    481,   3083,
- -1449,   1225,   3168,   2389,  -2124,  -1981,  -1342,  -1939,
- -1904,   4736,   -885,   -826,   3866,   2046,   -290,   -567,
- -1986,  -1880,   1966,   -465,   1638,    683,   1005,   1099,
- -2842,  -2537,  -2559,  -2427,  -1243,   4039,   1371,   3897,
-  2529,   2400,  -2586,  -1328,    785,  -1697,   1733,   2382,
-  -442,    190,    901,   1281,  -2669,   2198,  -1502,  -1404,
-  2593,   -694,   -186,    466,   1065,   1199,  -1905,  -1389,
-  6171,  -1817,   -513,   -989,   -356,    246,   1619,   1883,
-    36,  -2178,  -1602,    608,  -1523,     23,   1265,    578,
-   953,   1038,   -483,  -2278,  -2138,  -1740,    584,    244,
-   -54,   -192,    915,   1097,   -213,  -1569,   1861,  -1401,
-  3686,  -1625,  -1234,   -614,    860,   1311,  -1397,   2315,
-  1896,  -1608,  -1326,  -1487,    -99,   2241,    697,   1156,
-  1711,  -2099,  -1507,   -135,   1422,   -695,    -57,   1390,
-   823,    937,   -122,    479,     47,  -2144,  -1514,    955,
- -1317,   -726,    480,   1153,  -2959,  -2558,  -2573,  -1355,
- -1879,  -1446,   6435,    677,   3124,   3134,   1850,   1834,
- -1396,  -1417,   1290,   -896,   -561,   1428,   1007,   1105,
- -2101,  -2044,   1779,  -1913,  -1868,   1410,    916,   1232,
-  1112,   1335,  -2663,   -104,   -513,    -96,   -470,    480,
-  1516,   -150,    298,    714,  -2558,   3076,    468,   -745,
-  -945,   -443,   -849,   -989,    341,   1102,    433,    588,
- -1772,    462,   -527,    670,   -128,   -108,    583,    701,
- -2281,  -2149,  -2398,  -2749,  -2557,  -1691,  -1095,   1336,
-  9088,   3844,  -1799,  -1861,  -1908,  -2242,  -2184,   2313,
-  3779,   -809,    519,   2229,  -1914,  -1673,   1764,   -634,
- -1955,  -1721,    405,   -499,    243,   1632,  -2377,   7289,
- -1659,  -1752,  -1341,   -948,   -323,    841,   1703,   1774,
- -2029,   2384,  -1877,  -1918,  -1729,   1483,    483,   1916,
-   576,   1258,  -2310,  -1796,   2208,  -1579,     57,  -1735,
- -1161,   5177,   1674,   2468,  -1907,  -1499,   1868,   2275,
-  -620,   -356,   -228,    489,   1064,    849,   -683,  -1204,
- -1761,  -2211,   -606,   -764,  -1056,   3888,    253,   1518,
- -2555,  -2075,    119,  -1567,    971,  -1178,   2683,   1476,
-   978,   1419,  -2947,  -2418,  -2164,   1178,   1582,   1470,
-   896,    645,   1671,   1462,  -2234,  -1363,  -1184,   1408,
-  1042,  -1091,   -208,    -49,    527,    917,   1266,  -1444,
- -2174,  -2447,  -2300,  -1732,   3076,   5631,    248,   2195,
- -2477,  -1724,  -2434,  -2477,  -2524,  -1828,   2331,    845,
-  1423,   1767,  -2393,  -1946,   -857,   -462,    344,     17,
-  -896,   2391,    892,    882,   -828,   -280,   -752,  -1136,
- -1563,  -1040,   1222,  -1173,   1763,   1179,  -1448,   1946,
- -1815,  -1588,  -1638,  -1282,   3302,    132,    509,   1408,
- -2760,  -2338,  -1935,   1353,  -1531,  -1074,   1156,   3086,
-  1374,   1667,   2302,  -1623,  -1897,  -1991,   -494,   2603,
-  -754,    524,   1265,   1304,   3062,  -1359,  -1365,   1987,
- -1334,   -916,   -146,    -40,    635,   1033,   1724,  -1057,
-    49,  -1159,   -774,    106,   1053,   -153,    134,    691,
-  -119,  -1226,    332,   -363,   -197,    -69,   -133,    573,
-   190,    216,  -2236,   -294,   1288,  -2110,  -1537,  -1005,
- -1175,     56,   4227,   1623,  -2440,  -1894,  -1623,  -2377,
-  2287,  -1220,  -1506,    177,   5689,   2849,  -2857,  -2166,
- -2546,   2174,  -2414,  -2343,    559,  -1020,   4650,   3514,
- -2875,   1309,  -2557,  -2534,  -2235,  -1901,   1559,   4412,
-  2301,   2204,  -2969,  -2018,  -2399,  -2834,  -2431,   1316,
- -1474,   1269,   2533,   3485,  -2892,  -2387,  -2716,  -2317,
- -2031,  -1992,  -1311,   8071,   3933,   3807,  -2139,   1909,
- -2200,  -2344,  -2060,  -1638,  -1154,   -210,   2781,   2139,
-  1119,  -1828,  -2069,  -2306,  -1975,  -1165,   -444,    789,
-  2409,   1551,  -2929,   -103,  -1920,  -2010,   -904,    694,
-  -188,      4,   1051,   1190,  -2649,  -2454,  -2205,  -1651,
- -1856,  -1552,  -1165,    352,   3351,   1266,  -1719,     57,
- -1828,   -420,   -938,  -1251,   -461,   1294,   1158,    893
-},
-
-.fcb11m = {
- -2704,  -2459,  -2349,  -1535,   2807,    365,   1064,    892,
-   830,   1222,  -2190,  -1542,  -2285,   6443,  -1607,  -1362,
-  -605,    637,    883,    877,  -2378,   2292,   3106,  -1057,
-  1776,  -1094,   -859,    249,    199,    256,  -1537,   2098,
- -1126,   2243,  -1186,   -193,   -211,    211,    502,    308,
-  3369,   3197,  -1271,  -1370,   -355,   -423,   -537,    468,
-  -237,    -99,  -1439,  -1748,  -2185,  -1972,  -1357,   -814,
-  -470,    815,   1306,   6390,   1983,  -1169,  -1749,    -29,
- -1368,   5929,  -1539,   -900,    576,    701,   1708,  -1608,
- -1148,   3522,   -822,   -120,   -461,   -158,    -43,     39,
- -2543,   8872,  -1347,  -1580,    222,   -488,   -162,    295,
-   382,    291,  11143,  -1223,  -1270,  -1399,   -392,   -563,
-  -500,   -604,   -544,   -135,  -1787,  -1313,  -1490,  -1395,
- -1100,  -1278,   -818,   6172,    768,   1597,   -623,   -681,
- -1128,  -1575,   7257,   -665,  -1021,   -439,    932,    703,
- -1496,  -2168,  -1945,  -1454,   -808,  -1261,   -354,    875,
-  6706,   1956,  -1773,  -1503,  -1536,  -1162,  -1386,  -1885,
- -1607,   -318,    -72,     -7,  -1932,  -1349,   6150,  -1852,
-  -345,    -18,    -81,    223,    339,    425,    362,  -1623,
- -1432,  -1973,  -1042,  -1373,   7830,     38,   -116,   1000,
-   421,  -2375,  -1808,  -1832,  -1046,   2077,    955,   1576,
-   581,    824,  -2021,  -1582,  -1402,  -1420,     69,   3549,
-  -513,    192,    262,    483,  -2503,   4173,    -11,  -1532,
-  -893,    282,    187,    320,    176,    259,  -2308,   2342,
- -2385,  -2147,   -784,   -375,    413,    833,    889,   1297,
-  1415,  -1085,  -1009,  -1501,  -1246,  -1298,   1553,   1384,
-   332,    662,   2226,  -2399,  -1752,   -857,   1899,    131,
-   501,    209,    217,    346,   4294,  -1811,  -1694,  -1080,
-  -752,   -263,   -228,    249,    628,    971,   2508,  -1031,
-  2871,  -1054,     42,   -202,   -738,   -170,   -239,   -290,
- -2751,  -2379,  -2379,  -1999,  -1448,   -380,   1594,   1279,
-  1399,   1633,  -2376,  -1839,   1367,   1685,    356,   -126,
-   -50,    143,     31,     33,    314,    160,   -663,   -687,
-    25,    388,   -267,   -188,   -188,   -129,  -2614,   1063,
- -1835,   -285,   2549,    205,    -30,    370,    319,    297,
-   -87,  -2208,  -1164,   -839,    894,   -266,   -410,    375,
-  1263,    924,  -2606,  -2325,  -1854,   1792,    407,    328,
-  -110,    575,   1090,    971,  -2517,  -1583,   1355,  -1892,
-  -490,   -203,    846,    724,    597,    779,  -1650,  -1281,
- -1294,    549,   -146,   -548,   2947,    -28,    265,    339
-},
-
-.fcb11s = {
- -1536,  -2360,  -2378,  -2138,  -1380,   -346,   1575,   2779,
-  3247,   1689,   -340,  -1788,  -1839,    103,     31,    853,
-  -653,   3159,    365,    154,    404,   -835,   -716,    -35,
-  4309,   -155,  -1214,  -1180,   -750,   -522,   -753,    350,
- -1660,  -1603,  -1159,   -582,   -489,   1067,   2615,   1747,
- -1755,  -2351,  -2314,  -1453,    922,   3458,    867,    439,
-   493,   1212,  -1584,  -1655,   1300,   1783,   1641,   1442,
-   816,  -1283,  -1456,  -1417,   4998,   1923,   -200,  -1086,
- -1060,  -1016,  -1074,  -1217,  -1285,  -1245,    633,    390,
- -1443,  -1099,   -507,   3041,    343,   -163,   -745,   -667,
-  2333,  -2144,  -2460,  -2247,  -2063,  -1736,   -742,    418,
-  3124,   3504,    227,   -735,    799,  -1326,    -20,   -543,
-  1900,    237,   -671,   -545,  -1727,    121,  -1750,   3700,
-  -485,   -553,    -77,   -212,    942,     62,   1647,   -688,
- -1506,  -1429,   -619,   -839,    172,   3209,   -500,   -371,
- -1680,  -1408,  -1122,   -563,   3627,   -115,    510,    534,
-   -65,    199,    800,   5040,    631,   -744,   -612,  -1023,
- -1099,  -1319,  -1520,  -1460,  -1120,   -274,  -1220,    349,
-  1848,   -620,  -1411,   -616,   1771,   1024,  -1223,  -2195,
- -2345,  -2144,  -1517,  -1055,   -385,    557,   1482,   6797,
- -2274,    818,   -460,   -707,   -274,    646,    654,    731,
-   268,    347,   4583,  -1289,  -1452,  -1193,  -1072,   -681,
-  -178,   -131,   -108,    547,  -1521,   -781,  -1298,    239,
-  -486,   -445,   3453,   -226,     90,    653,  -1237,    624,
-  4692,   -482,   -798,   -799,   -766,   -645,   -890,   -915,
-  3748,   -909,  -1012,     85,    963,    375,   -100,  -1010,
- -1269,  -1508,   2106,  -1194,   2632,    595,   -826,   -221,
-  -411,  -1104,  -1365,  -1050,  -2112,   -863,   1943,   -727,
- -1079,   -733,     78,   1990,    363,    953,   1325,    459,
-  -891,   3364,   -410,   -362,   -547,   -994,  -1371,  -1258,
- 12270,    -43,  -1668,  -1868,  -2004,  -2133,  -1863,  -1949,
- -1805,  -1288,  -1640,   3783,  -1414,   -578,   -505,   -464,
-  -158,    252,     71,     76,     22,    -20,    -72,    -13,
-   -19,    -95,    -14,      2,     23,     -5,   1289,    630,
-   291,   -707,   -794,   -857,   -715,   -122,    551,    219,
- -2358,  -1905,  -1397,    277,    572,    343,    789,    526,
-  1629,    991,   -980,    222,    740,   1199,     19,   1200,
-  -864,   -467,   -656,   -138,    820,  -2005,   -924,    154,
-   195,    393,    267,   -183,   1024,    100,   1243,   -872,
-  -705,   -781,   -422,   -377,   -910,   -637,     89,   2849
-},
-
-.fcb16l = {
- -2676,  -2246,  -3119,  -2904,  -2707,  -1946,   7718,   2292,
-  2451,   4206,  -1214,   -362,   1116,   -860,     30,   -993,
-  -888,  -1046,  -3732,  -2268,  -2541,   6060,  -2220,  -1597,
- -1650,  -1320,     88,   1229,   2118,   2348,   1430,  -1865,
- -2190,  -2122,  -1844,  -2069,  -1746,     15,  -1746,   1321,
- -2671,  -2993,  -3247,  -2811,  -2141,  -1360,   1886,    270,
-  -381,   5676,  -2070,   -444,   -674,  -1082,  -1144,   -346,
-  -823,   4630,   -224,   1940,  -2441,  -2072,  -2194,   -295,
-  2175,   1209,   -734,    168,    923,   1359,  -2667,    389,
- -2585,  -2279,  -2195,  -1141,  -1016,   -218,    109,   1926,
-  5184,  -2226,  -1888,  -1273,  -1044,     25,    461,    886,
-  1125,   1249,  -2215,  -2381,   3109,  -1963,   3015,  -2027,
-  -790,   1192,   1646,   2188,  -2906,  -2598,    484,  -2372,
- -1372,  -1082,   1718,    664,   1391,   2396,  -2518,   1937,
- -2362,  -2510,  -1504,   2947,    446,    684,   1947,   2059,
- -3263,  -3001,  -3240,  -3034,  -2598,   3367,   4407,   2327,
-  2450,   2994,  -2379,  -1875,  -1862,   6387,  -1956,  -1417,
-  -525,   1098,   1836,   2932,   1408,  -1130,  -1417,   1693,
-  -262,   -645,   -515,    443,    735,    619,  -2834,  -2246,
- -2646,  -2521,   -811,   6608,   -421,   1572,   2015,   3234,
- -2086,  -1435,     89,   1648,    838,   -986,  -1159,  -1208,
-   -32,   1354,  -2135,  -2159,   7796,  -2424,   -949,  -2040,
- -1179,    228,   1187,   3008,  -2963,  -2500,  -2074,  -2025,
- -1439,   1692,   -378,   -596,    -62,   2419,  -3522,  -3132,
- -2899,  -3290,  -2929,   2844,     49,   4307,   2754,   3897,
- -2960,   1305,  -1858,   -831,  -1379,   -773,   3257,    979,
-   975,   1513,  -2849,  -1610,   2483,    456,  -1395,   -634,
-   847,   1320,   1116,   1175,   2497,  -1554,   2176,  -1697,
-  -997,   -799,   -120,    339,    996,   1379,  11359,  -1557,
- -2219,  -2237,  -1792,  -2084,  -1009,    781,   3341,    939,
-  1954,  -1860,  -2347,  -2117,  -2000,  -1394,   3825,    106,
-  2595,   2162,  -2938,  -2488,  -2112,    772,  -1059,   1822,
-   159,   1017,   2452,   1506,   1313,  -2615,  -2479,  -2941,
- -2220,  -2510,   -726,   4703,   1778,   3375,  -3133,  -2664,
- -2821,  -2771,   1559,  -1000,   -434,   1874,   4130,   2987,
- -2998,  -2692,  -2326,   1580,  -2231,  -1347,   4166,   2021,
-  1177,   2531,  -2880,  -2337,  -2589,   1505,  -2843,  -2468,
-  -339,  -1059,   3212,   4264,  -3112,  -2885,  -2889,    975,
- -2522,  -2278,    721,   5057,   3989,   3373,  -3098,  -2947,
- -1128,  -2251,   1935,   2981,   3007,    975,   1983,   2048,
- -2861,  -2302,  -2431,  -1460,  -1492,  -1524,   -944,   1556,
-  1778,   1549,  -2658,  -2259,   2768,  -2460,  -1447,   2957,
-   759,    324,   2533,   2477,  -2935,  -1687,  -2554,  -2647,
- -1431,    118,   -365,  10280,   1526,   3447,  -2570,   2268,
- -2351,  -2115,   2588,     -9,   -834,   1115,   1878,   2365,
-    79,   1132,  -1619,  -1406,  -1568,  -1766,   -224,    825,
-  2113,   1382,   -548,  -2669,  -1797,  -2691,  -2139,  -2495,
-  -210,   1276,  13623,   2315,   1965,  -1713,  -1610,  -2187,
-  2534,  -1495,  -1301,    622,    563,   2154,   2743,   3230,
- -1784,  -1774,   -792,   -493,   -131,    156,    944,   1211,
- -1886,    357,  -1018,    225,   -285,   1025,   -134,    218,
-   290,    153,   5869,  -2407,  -2856,  -3051,  -2540,  -3238,
- -2260,   -370,   -451,   6314,   -500,  -2554,  -2110,   -879,
-  -323,   -537,    570,   1228,   1556,   1342,  -2486,   3366,
-  1838,   -937,   -959,   -683,     63,    937,    652,   1212,
- -2164,  -1448,    166,   -799,   -550,  -1317,    481,    299,
-  5494,   1360,  -3147,  -2574,   -989,   1550,   1952,  -1502,
-   -96,   3517,   1304,   2311,  -2931,  -2146,  -2174,  -2052,
-   579,    680,    896,   2697,    703,   1365,   4130,  -2367,
- -2627,  -3125,   -934,  -3093,  -2155,   -955,   6025,   5024,
- -3121,  -3064,  -2883,  -2458,   1723,   -842,   3032,   4391,
-  2327,   2837,  -2536,  -2208,  -1610,  -2189,   6509,  -1424,
- -1116,   1427,   2830,   3370,   1084,  -1562,  -1655,  -1628,
-  -491,   2260,   -321,    421,    774,   1237,  -3267,    977,
- -3170,  -3144,  -2698,  -1324,   1424,   3034,   3323,   3347,
- -3021,  -3061,   2027,  -2345,    852,  -2832,  -1714,   5926,
-  4517,   3839,  -1490,  -2416,  -1726,  -1268,  -1458,  -2137,
- -1715,   -580,   1403,  13408,  -3005,  -2706,  -3063,  -2745,
- -2777,  -2136,   2786,    202,   5141,   3407,  -3104,  -3001,
- -3176,  -3388,  -3507,  -2863,  -2097,   2325,   2618,   6146,
- -1997,  -3152,  -1036,  -2694,  -2587,  -2986,  -2750,  -2219,
- -1607,   5944,  -2893,  -2633,  -2229,  -2811,  -2482,  -2115,
- -2219,  -1180,   5246,   3252,  -3111,  -2052,  -2693,  -2934,
- -1805,   2583,    353,   1262,   8588,   3900,  -2468,  -2726,
- -1861,  -2352,  -2237,  -2750,  -2345,  -1936,   9793,   8392,
- -3490,  -3124,  -3596,  -3630,  -3154,  -2390,    743,   6652,
-  6366,   6143,  -2852,  -3547,  -3124,  -2718,  -1094,   -494,
-    49,  -1053,  -3005,  32767,  -1721,  -1229,  -1715,  -1590,
-  1587,  -1233,   3384,   -252,    312,   1120,  -3287,  -2926,
- -3048,  -2828,  -2502,  -1185,   2028,   3778,    487,   2083
-},
-
-.fcb16m = {
-   616,  -1065,  -1622,  -1949,  -1283,   -863,   6819,    517,
-  1135,   1282,   2631,  -1447,  -1477,  -1004,    286,   1358,
-  -135,   -340,    147,   -130,   5435,  -1609,  -1916,  -1758,
- -1066,  -1126,    478,    995,   1098,   1437,  -1737,  -1339,
- -1864,  -2009,  -1038,  -1004,   -573,    810,   5974,   2840,
-   349,  -1559,  -1496,  -1151,   -307,    -82,    681,    827,
-   550,    776,   1930,    166,  -1100,  -1489,  -1185,  -1182,
- -1210,   -326,    858,   1688,  -2561,   3514,   -736,   1555,
-   -59,   -906,   -123,     87,    102,    274,   1902,   -459,
-  3008,   -984,   -707,   -334,   -571,   -317,   -190,   -371,
- -2862,    607,   1346,  -1517,  -1220,   -617,   2494,    697,
-   190,     64,   3264,   3926,  -1249,  -1542,   -933,   -302,
-  -246,   -248,     69,   -283,  -1766,   -750,  -1898,  -1259,
-  6841,  -1546,   -785,    -64,   1208,   1294,  -1522,  -1742,
- -1873,  -1898,  -1455,   7128,   -752,   1718,   1398,   1123,
- -2742,   4733,  -1552,  -2483,  -2210,   -495,    355,    864,
-   830,    759,  -2721,  -2115,  -1891,  -1696,  -1137,  -1559,
- -1265,   -658,   -591,    850,   -699,   1262,   -551,  -1055,
-   877,     96,   -388,   -192,   -479,  -1091,  -2763,  -1379,
-  3290,   2331,   -874,   -307,   -386,    615,    366,    133,
- -2671,   5181,   4339,   -894,   -871,   -634,   -165,    409,
-    91,   -291,  -2649,   -411,   8039,  -1947,  -1156,     57,
-   351,   1014,    472,   -198,  -1816,   -590,   2887,  -1702,
- -1113,   3414,   -556,    117,    483,   -377,  -1707,  -1146,
- -1155,   2518,   2014,   -382,      3,     -6,    206,    -98,
- 10770,    274,  -1415,  -1670,  -1020,  -1036,   -786,   -782,
-  -463,   -552,  -2500,  10460,  -1624,  -1787,   -707,  -1327,
-   -59,    375,     91,     22,  -2776,  -2343,  -2104,    825,
-  -759,   -823,    482,   1149,   1265,    570,  -1676,  -1826,
- -1848,   6125,  -1391,   -820,   -449,    844,    586,    535,
- -2873,  -2475,  -2607,  -2611,  -1830,   -487,   1643,   1680,
-  2088,   2570,  -2357,   -993,   3189,  -1473,   3506,  -1203,
-  -793,    662,    464,     98,  -2507,   1617,  -1793,  -1935,
- -1307,   -169,      9,    885,    728,   1178,  -2010,  -1346,
- -1375,   -187,   -548,   2753,   -464,   -105,    799,    511,
- -2170,  -2428,  -2177,  -1497,   2072,    828,    441,   1020,
-   873,   1000,  -1297,  -1531,  -1863,  -1967,  -1516,  -1088,
-  -758,   -230,   1561,   6655,  -2173,  -1787,  -1548,  -1763,
- -1366,    -24,   -645,   6836,   1480,   1923,  -2728,  -1859,
-  1798,  -2010,  -1585,   -677,   -371,   1405,   1254,   1278
-},
-
-.fcb16s = {
- -2250,  -2771,  -2879,  -2775,  -2240,  -1363,   -272,   1233,
-  6172,   5074,  -2882,  -2419,  -2054,  -2420,  -1252,    347,
-  1325,   1799,   1723,   4361,    774,   2066,   1874,    280,
-  -707,   -605,   -581,   -662,  -1104,  -2038,   7111,   -137,
-  -883,  -1079,  -1001,    -54,   -847,  -1013,  -1045,   -832,
-  4696,   3781,   -624,  -1485,  -1360,  -1359,  -1307,  -1219,
-  -866,   -945,   5419,  -1512,  -2307,  -2134,  -2056,  -1724,
- -1653,   -630,    157,   3399,   -727,   -860,  -1381,   -380,
-  -716,  -1335,   3819,     78,     -2,    277,  -3185,  -3118,
- -2715,  -3110,  -1500,   1626,   3352,   3075,   1956,   -539,
- 16640,  -1204,  -2281,  -2307,  -2272,  -2349,  -2009,  -2184,
- -2777,  -2375,  -1015,   6208,   -402,  -1331,  -1182,   -763,
-  -730,    -81,   -591,  -1184,  -1927,    543,   4464,  -1095,
-  -131,   -542,   -129,    486,   -366,  -1097,  -1594,   -554,
-   -15,   -337,   3152,   -723,     71,    -40,    385,   -309,
-  -769,    290,   -853,  -1058,  -1196,  -1557,   -595,   3695,
-  1129,    438,   1729,  -1309,   -971,   -871,     90,   1418,
-  1261,    -23,  -1382,   -223,  -1551,   -713,  -1044,   4495,
-  -160,   -867,  -1242,   1188,    159,    120,  -1657,   -951,
-  1536,   -159,  -1310,   1101,   -404,    155,   1717,    -24,
- -1607,   2347,   2056,  -1943,  -1313,  -1297,    -81,     34,
-  1441,    354,  -2110,  -1873,   -516,   1102,   2174,   2131,
-     0,   -946,   -729,     61,    107,    -14,   -108,    -50,
-    42,   -164,   -177,    -92,    -29,    162,   1349,  -2380,
- -2099,  -1692,   -980,    -49,    -94,    331,   1317,   3819,
-  -482,   -782,   -775,   -909,   -640,  -1099,   -615,   -225,
-  1556,   2973,   -630,     70,   -186,  -1599,  -1076,   4440,
-  -890,     78,    -76,   -517,   -855,  -1886,  -1521,  -1206,
- -1152,   -900,    753,   1338,   1758,   2431,  -2433,  -1569,
- -1294,   -583,    552,   2040,   -154,    250,    513,   2333,
-  -820,  -1987,  -2291,  -2238,  -1880,  -1651,  -1120,   -262,
-  2013,   9756,  -2803,  -2574,  -2634,  -2789,    356,  -1838,
-   325,   4584,   3584,   2486,  -1524,   1874,   -337,  -1800,
- -1659,    406,   2450,   1252,   -245,  -1030,   1985,   -397,
- -1565,    -51,    148,   2039,  -1212,   -729,   -700,    -11,
-   904,    649,    531,  -2287,  -1640,    766,   -725,    171,
- -1596,   1387,   3189,   -672,   -459,   -794,   -422,   -714,
-  -195,   -231,    185,     99,   -952,  -2248,  -2170,  -1190,
-  -457,   1458,     34,   1179,   2427,   1683,  -1658,   3749,
- -1816,  -2000,   2823,  -1243,  -1415,    713,    875,     75
-},
-
-.fcb22l_1 = {
-  2198,  -2215,  -2251,  -1966,  -1540,   -467,    403,   1647,
- -2867,  -2589,    -34,  -2314,   -602,   2371,   2614,   2218,
- -2494,   3659,   2708,  -1076,   -914,    233,   1149,   1425,
-   319,   -979,   1023,   -682,    110,    239,    427,    703,
- -2979,  -2513,  -2649,  -2265,   7420,    526,   2174,   2932,
- -2868,  -2056,  -2232,   1651,  -1325,   -856,   -218,   2091,
-   458,   1508,  -1208,   -845,    244,   -441,    558,    752,
-  -700,  -1370,   -395,    980,   -321,   -232,   -241,    293,
- 10391,  -1792,  -1948,  -1518,  -1049,     43,   1524,   2033,
- -2434,    303,   1730,  -1205,  -1432,  -1183,   -694,   1185,
- -2531,  -2656,  -2751,  -1756,  -1321,  -1100,    287,   8605,
- -2868,  -2554,    721,  -2065,  -1671,   -771,    675,   2223,
- -2690,  -2501,  -2313,   1829,   3189,     45,   1825,   2024,
- -3153,  -2824,  -2729,  -2308,   1686,   -370,    482,   2606,
- -2972,  -2324,   2492,  -1762,  -1662,     28,   4976,   3214,
- -2769,   -316,  -1146,  -1954,     86,    -60,   -370,   1144,
-  5519,  -1785,  -1538,  -1044,   -580,    -89,    704,   1151,
- -2586,  -1094,   7473,  -1220,  -1076,    -50,   1029,   1850,
-  3546,   3279,  -1806,  -1191,   -528,    682,   1160,   1341,
- -2852,   1541,  -2358,  -1841,  -2317,  -1351,    993,   2417,
- -2675,   2482,  -2061,  -2089,   3681,    626,   1619,   1818,
- -2916,   2821,  -2482,  -2166,  -1084,   1137,   5537,   2864,
- -2499,  -1782,   2156,   2558,  -1117,    127,   1147,   1556,
- -2572,   3865,  -2008,  -1805,   -679,    119,     35,   1319,
- -2704,  -1872,  -1756,   6843,   -911,    322,   1641,   2461,
- -2652,  -1957,   1972,  -1582,   3082,     84,   1086,   1487,
- -2983,  -2325,  -2780,  -2532,  -1858,   -279,  10092,   4519,
- -2364,   2718,  -1907,   2678,  -1005,    246,   1499,   1679,
- -2570,   8779,  -2004,  -1627,   -844,     89,   1712,   2145,
-  3316,  -1763,  -1642,   2819,   -599,      9,    906,   1401,
- -2289,  -2224,   2462,  -1580,   -843,   2501,    -24,   1310,
-  3091,  -1745,   2398,  -1264,   -731,    113,    831,   1328,
- -2803,  -2380,  -2808,  -2379,  -2290,  -1376,   -234,   2242,
-  3537,  -2137,  -2050,  -1260,   2881,    177,   1158,   1424,
- -3303,  -3123,  -3130,  -2861,  -2075,   2528,    -43,   3890,
- -3106,  -2672,  -2554,   1833,   -826,     55,   4910,   3324,
-  3993,  -2176,  -2446,  -1848,   -786,   3346,   1590,   2034,
- -2725,   -265,    303,   1076,  -1985,   3661,   1556,   1983,
- -3182,  -2712,  -2988,  -2841,  -1332,   4816,   6422,   4184,
- -2230,  -1248,  -2176,  -1806,  -1617,   -878,   3764,   1309,
- -2280,    509,   -211,    426,    773,     99,    513,    628,
-   167,    196,  -2256,  -1802,  -1157,    724,   1405,   1383,
-  2384,   -409,   -672,   -453,   -205,    -89,    -12,    240,
-   114,  -2220,   -807,  -1302,  -1612,   -405,   1134,   1381,
-   699,  -1816,  -2151,  -1883,   2975,    928,   1527,   1565,
-   775,  -2141,  -1981,  -1532,   -591,   3338,    683,   1763,
-   466,  -2028,  -2086,   1448,   -622,    589,   1294,   1150,
-   145,  -2382,  -1093,   -367,    986,    323,    404,    931,
-  -371,  -2868,  -2737,  -2103,    129,    771,   1498,   1974,
- -1481,  -1060,  -2398,  -1125,    285,   2777,   2975,   1431,
- -2720,   1748,  -2375,  -1847,   -912,   3829,    808,   2034,
- -2492,  -2447,  -1248,   -991,   1449,   1304,    867,   1171,
- -2999,  -2556,  -2763,  -2298,   3359,   4277,   1991,   2850,
- -2692,  -2640,  -2593,   1813,   -458,   3068,   1012,   2049,
- -3258,  -2820,  -2845,  -2395,   2787,    -45,   5457,   3568,
- -2491,  -2114,  -1884,      6,   -332,   -232,   1680,   1139,
-  2032,  -2383,  -2183,  -1725,   -914,    192,   4175,   2059,
- -2922,  -2972,  -2920,  -2210,  -1143,   1850,   2468,   1871,
- -3138,    -99,  -2651,  -2510,   -129,    631,   1677,   1925,
- -3302,  -3124,  -3214,  -3143,  -2616,   -761,   3978,   4234,
- -1698,   -824,  -1975,   -742,   2449,   -610,     21,    998,
- -3047,  -2697,  -2747,  -1919,  -1545,   7534,   1243,   3548,
- -1863,  -1257,    339,  -1027,    122,   -613,   1989,    953,
- -2232,  -1759,  -1751,   -969,  -1591,   1917,   -325,    889
-},
-
-.fcb22m_1 = {
- 13531,  -1278,  -2217,  -1956,  -1360,   -892,   -650,   -866,
-  -255,    192,  -1139,  -1242,  -2101,  -1682,  -1601,   2950,
-  2340,    121,    662,    446,  -2636,   1711,    615,  -1864,
- -1297,  -1098,   -296,   1070,   1284,    891,   7332,  -2292,
- -2334,  -1889,  -1170,   1884,   -570,     52,   1146,    944,
- -2083,  -2192,  -2420,  -2165,  -1542,  -1474,   -278,   4147,
-  1506,   1666,   1014,  -1657,  -2225,  -2261,   8568,  -1445,
-  -523,   -115,    999,    602,  -2762,  -2261,    271,  -1797,
- -1633,   -790,    391,    907,   1302,   1076,  -1907,  -2219,
- -2443,  -1963,  -1495,  -1294,   4722,    935,   1691,   1370,
- -2355,  -1585,  -2510,  -2297,   2690,  -1491,   -647,    360,
-  1460,   1479,  -2041,    368,  10454,  -1277,   -716,   -172,
-  -538,   -287,    169,   -232,    960,  -1087,  -2459,  -2196,
- -1189,  -1967,  -1586,   -783,   5275,   2811,  -1523,  -1733,
- -2373,  -1946,  -1586,  -1280,   -442,   -205,   2330,   6319,
- -2483,  -2115,  -2645,  -2016,  -1464,     89,    529,   1338,
-  5291,   3186,   5770,  -2311,  -2696,  -2420,   -619,  -2322,
-  8434,   -129,   1661,   1232,  -1377,  -1277,  -1193,    406,
- -1332,  -1246,   -999,   -497,   1024,   1500,  -2791,  -1417,
- -2173,   2419,  -1492,   -734,   2795,    559,    750,    519,
- -2714,   -509,   4622,   3679,   -294,     73,   -805,    602,
-   -99,     94,  -2658,  -1984,   6907,  -1780,  -1244,    272,
-   874,    140,   1326,    693,  -2679,  -2274,  -2551,  13351,
- -2619,   4570,  -1739,   2309,   1280,   1235,  -1011,  -2084,
- -1968,  -1404,   2568,   3147,   -336,    270,    499,    506,
- -1567,  -2240,  -2685,  -1951,  -2254,   2783,  -1411,   8878,
-  2321,   1691,  -2567,  -2450,  -2572,  -2286,  -2038,  -1803,
- -1316,   -315,    464,   1223,  -1988,   -927,  -2035,   2165,
-  3663,   -919,   -328,    229,     -2,    217,  -2773,  -2160,
- -2637,  -2183,   5081,  -1434,   1526,   2830,   1698,   1153,
- -2810,  -1132,   5408,  -1992,   4267,  -1357,    809,    563,
-     9,    -64,  -2949,   7061,   4604,  -1424,  -1839,   -610,
-  -251,    370,    901,    147,  -2264,   3135,   3241,  -1102,
-  -397,  -1292,     39,     17,    380,    383,  -1483,  -1458,
-   820,   2135,   -646,   -479,    173,     23,   -274,   -442,
-  -978,  -1216,  -1928,   7260,  -1249,   -956,    -24,    250,
-   438,    128,   4080,    152,   2677,   -587,   -667,   -672,
-  -662,   -492,   -722,   -688,  -1907,   -787,   3101,  -1404,
- -1234,   -508,   3817,    424,    657,    -86,  -2179,   -599,
-  2141,  -1446,  -1847,   4341,   -801,    -26,    -57,    216,
- -1625,   -802,   1752,  -1301,   2617,  -1545,   -513,   -401,
-   234,    658,   1299,  -1279,    874,  -1408,  -1135,    -40,
-  -423,    394,    660,    684,   3341,   -937,  -1842,  -1177,
-  1945,   -621,     19,    -93,    141,    -59,  -2626,   3368,
- -1588,  -1959,  -1506,   3729,   -347,    218,    497,    585,
- -2495,  -2452,  -2118,    578,   -225,    378,     40,   1080,
-   908,    761,  -2070,  -1607,   2534,  -1535,   1493,   2664,
-   215,    634,    317,   -233,   4188,  -1446,  -2129,  -1812,
- -1428,  -1579,  -1038,     97,    989,   2038,   3671,  -2707,
- -2608,  -2198,  -1119,   1601,   1042,   1325,   1230,   1149,
- -2566,  -1054,   3659,  -2173,  -1772,   -713,  -1080,   -101,
-   987,    805,  -1555,   -749,  -1510,   3443,  -1402,   4172,
-  -696,    437,    276,    219,  -2735,  -2453,  -2082,   3898,
-  -867,   -582,   -726,   1134,   1227,   1121,   2333,   -963,
- -1474,   2386,   -959,   -327,   -138,      4,    268,    479,
- -2889,  -2896,  -2701,  -1975,   -593,   1212,   1511,   1087,
-  1482,   1612,  -1703,   4874,     46,  -1364,  -1342,   -544,
-  -879,   -455,   -488,   -396,  -2616,    849,  -2424,  -1976,
- -1491,   -739,    325,   1284,   1831,   1223,    -48,  -1457,
- -2123,  -1318,   1617,  -1064,   2484,   -467,    533,    707,
-   351,    422,   -525,   -657,    202,   -476,    133,   -679,
-  -945,   -832,   1906,  -2981,  -2605,  -1911,  -2541,  11553,
- -1585,   1555,   2196,   1616,  -2669,  -2345,  -2423,  -1848,
- -1756,   4918,   -711,   1186,   1873,   1399,   -672,  -1401,
- -1524,  -1138,   -674,   1285,    195,    884,   -377,  -1067,
- -2125,    377,  -1747,  -1604,    837,   -334,   -115,    -59,
-   160,    483,  -2220,  12861,  -1633,  -1616,   -926,  -1203,
-  -113,    -90,    378,    148,   5740,     88,  -2246,  -1598,
- -1546,  -1694,   2790,    -72,    590,     28,  -2608,   4312,
- -1068,   3091,   -632,   -651,    366,     63,    744,    375,
-  1746,   2753,  -2075,  -1621,  -1033,   -471,    972,    199,
-   575,    655,  -2148,   2407,  -2180,  -1764,  -1030,  -1089,
-  4083,    -80,    417,    384,   1196,  -2284,  -2549,  -1771,
-  -773,    213,   1188,    788,   1343,   1358,  -2584,   7723,
- -2171,  -2301,  -1497,   -438,   1001,    110,    671,    939,
-  6435,   5777,  -1765,  -1287,  -1181,  -1014,     87,   -919,
-  -422,   -444,  -1930,   4906,  -1660,  -1558,   3617,  -1177,
-   261,      9,    261,    -47,  -2539,   2749,  -2476,  -2298,
- -1047,  -1319,   -341,   -604,   2111,   2779,  -2935,   5011,
- -1860,  -2363,  -1686,  -1033,    800,   1774,   1700,   1478
-},
-
-.fcb22s_1 = {
- 11523,   -796,  -1488,  -1897,  -1888,  -1691,  -1767,  -1794,
- -1622,  -1210,  -2284,  -2777,  -2382,  -1371,   -238,   2997,
-  3182,    588,   1129,    704,    248,   1703,   -264,  -1306,
- -1147,   -560,  -1513,   -956,   1667,   1340,   5220,  -2276,
- -2215,  -2049,  -1479,  -1294,   -774,     66,   1270,   2075,
- -1435,  -1981,  -2322,  -1896,  -1321,   -462,    138,   5022,
-  2549,   1683,   -100,  -1744,  -1528,   -423,   6093,    -61,
-  -288,   -623,   -650,   -828,  -1521,    134,   1240,  -1399,
- -1450,    612,   -969,   2585,    945,   -312,  -1138,  -2488,
- -2513,  -1988,  -1607,   -773,   3384,   1192,   2651,   2580,
-  -984,  -2015,  -1465,  -1576,   2273,  -1221,     91,   2615,
-   840,   1299,  -1069,  -2151,  -1899,   -735,    440,    888,
-  -241,    502,    953,   3613,   1806,  -1855,  -2303,  -1758,
- -1318,  -1484,    -10,    597,   3723,   1992,   -488,  -2063,
- -2284,  -2172,  -1905,  -1547,   -937,    -18,   3276,   7184,
- -1942,  -2302,  -2399,  -1972,  -1378,   -635,    302,   1081,
-  5454,   3358,   -447,   -807,    205,  -1805,  -1546,   -446,
-  6364,   -916,    151,   -377,   -582,   -856,   -204,   -731,
-  -884,   -674,   -257,    -67,   1564,   2486,   1003,  -1508,
- -1692,   1515,   -889,   -622,   2366,      9,    -17,   -245,
-  3733,  -1057,   -284,   3197,    -31,   -440,  -1115,  -1609,
- -1834,  -1930,    230,    262,   7344,    -39,  -1746,   -562,
- -1554,  -1838,  -1648,  -1310,   2157,     80,   -102,    238,
-  -823,   -622,   -720,   -115,   -274,     16,  -1562,  -1785,
- -1535,   -334,   2604,   3388,   -410,   -103,   -348,   -142,
-  1676,   -441,  -2267,  -1988,  -1421,   -680,   1302,   2682,
-   383,    -10,   1487,  -1086,   -251,  -1134,    141,    -84,
- -1003,   -898,     95,   2304,    802,  -1549,  -1562,   2650,
-  2180,     64,   -512,   -832,   -705,   -429,   1826,  -2283,
- -1976,  -1277,   2699,    504,    249,     -9,    178,    -33,
- -1357,  -1138,   3005,    293,    229,   1633,   -197,   -540,
- -1245,  -1617,  -1269,   6639,   2437,   -647,  -1501,  -1097,
- -1051,  -1150,  -1183,  -1461,     71,   1529,   2847,   1149,
-  -705,  -1345,  -1605,   -629,   -617,    -60,  -2081,  -1435,
-   938,    844,  -1055,   -841,   1179,    392,   1112,    946,
- -1252,  -1728,   -266,   7063,  -1335,   -920,  -1048,    206,
-    48,   -619,   4764,    274,   2394,   -799,   -798,  -1003,
- -1278,  -1800,  -1626,  -1415,   -498,   1439,   1643,  -1978,
- -1258,  -1136,   1285,     -9,    596,    141,  -2211,    908,
-   802,   -470,  -1125,   3216,   -234,   -412,      3,   -980,
-    15,  -1047,   1530,    660,   1986,   -480,   -499,   -550,
-  -733,   -531,   1326,  -1607,    787,  -1136,  -1002,    -65,
-   358,    743,    253,   -294,   3498,  -1033,  -1270,   -790,
-   537,   1788,    309,    -72,  -1241,  -1999,    609,   2981,
- -1025,  -1642,   -958,   3845,  -1221,   -962,   -965,  -1612,
- -1993,    -33,  -1136,   1086,    -46,   1178,   -229,    139,
-   644,    718,  -1696,   2411,   1019,  -1056,     52,    224,
-  -487,   -395,    -40,    125,   3001,  -1955,  -1950,   -784,
- -1111,    897,   -514,    159,    785,   1095,   2944,  -2554,
- -2407,  -1975,   -632,   1030,   1712,    366,    463,    125,
- -2354,   -796,   5663,  -1055,  -1151,   -870,    348,   -676,
-  1447,    215,  -1005,  -1531,   -910,   2249,   -438,   2889,
-   107,   -404,   -271,   -534,  -1022,  -2117,  -1738,   2261,
-  -257,   -788,     32,   1747,   1196,    910,     33,      1,
-   -23,     28,    -25,     19,     13,    -29,    -23,    -48,
-  -907,  -2113,  -1978,  -1426,   -535,   1589,   1908,   2724,
-  1646,   -897,    758,   2326,    674,  -1449,    111,    220,
-   475,   -162,  -1465,  -2036,   -528,   1308,  -2087,  -2031,
- -1308,    183,     35,   1097,   1008,   1864,  -2116,  -2303,
- -1928,   -261,   2342,   -292,   1480,    268,   1582,   1079,
- -1183,  -1154,   -777,    309,   1218,    683,   1314,   1677,
-  -758,  -1745,   1422,  -1331,  -1638,  -1100,   -303,   5003,
-   -57,   -379,   -511,   -756,   -727,  -2315,  -1860,  -1775,
-  -676,   3854,    -67,    -52,   2018,   1532,   -160,   -197,
-   -75,  -1934,  -1134,   2025,   1810,   -491,     83,    646,
-   390,   -297,   -441,   -342,   -479,   -486,   -296,    -30,
-   443,   1151,   3508,   6119,   -493,  -1427,  -1393,  -1273,
- -1280,  -1687,  -1683,  -1511,   5109,  -1008,  -1137,   -638,
-  -649,   -342,   -590,   -478,   -577,   -349,   -579,   2548,
-  -463,   2107,   -568,   -678,   -788,   -454,   -608,   -452,
-  1934,   1485,  -1746,  -1007,  -1174,   -573,    239,   -119,
-   679,    -76,  -1687,   1956,   -898,   -477,    456,   -156,
-  1460,     13,     92,   -987,    554,  -2772,  -2578,  -1694,
-  -235,    753,   1527,   1106,   1539,   1342,  -1305,   6560,
- -1526,  -1765,   -793,   -600,    248,   -542,    -63,   -421,
-  4828,   1288,  -1580,  -1826,  -1163,  -1014,   -221,   -818,
-  -109,    -61,   1265,   1939,  -1265,   -414,   1912,   -190,
- -1157,   -675,   -756,   -935,   2529,    136,  -1709,  -1727,
- -1819,  -1504,  -1232,   -959,   1128,   4142,  -1945,   2958,
-  -900,  -1432,  -1720,  -1380,    381,   1473,   1235,   1062
-},
-
-.fcb22l_2 = {
-  2441,  -2086,  -2129,  -2146,  -1839,  -1035,    295,   2465,
- -2785,  -2597,    -81,  -2162,   -991,   3060,   3056,   2985,
- -2415,   4009,   3058,  -1165,  -1281,   -322,    629,   2232,
-   481,  -2255,   1165,  -1455,   -621,    -29,    923,   1371,
- -2822,  -2421,  -2596,  -1908,   6338,    279,   1845,   3532,
- -2955,  -2571,  -2554,    744,  -1785,   -909,    775,   3156,
-   738,   1760,   -458,   -590,    -73,     22,    -91,    326,
- -1098,  -1511,  -1000,   1741,  -1024,   -562,   -399,    736,
-  9669,  -2109,  -1872,  -1539,  -1208,   -265,    994,   2364,
- -2121,    -98,   1523,  -1427,  -1450,  -1157,   -294,   1375,
- -3007,  -2669,  -2847,  -1777,  -1196,  -1257,   1065,   9128,
- -2948,  -2509,    470,  -2521,  -1947,   -728,    503,   3810,
- -2538,  -2469,  -2217,   1957,   2580,   -229,   1212,   2263,
- -3174,  -2660,  -2792,  -2692,   1226,   -512,    555,   3960,
- -2979,  -2426,   1978,  -2182,  -1868,   -455,   4681,   4580,
- -2514,  -1642,  -1029,  -1712,    416,   -838,   -362,   1208,
-  5211,  -2128,  -1867,  -1337,   -549,    -70,    828,   1508,
- -2272,  -1611,   7307,  -1612,  -1244,   -461,    749,   2510,
-  3669,   3236,  -1845,  -1333,   -866,    268,    850,   1686,
- -2805,   1079,  -2258,  -2075,  -2017,  -1115,    214,   2735,
- -2719,   2676,  -2154,  -1976,   2884,    393,   1247,   2382,
- -3043,   2188,  -2703,  -2353,  -1861,   -208,   4419,   4511,
- -2187,  -1630,   2246,   2331,  -1105,   -198,    818,   1721,
- -2180,   3571,  -1841,  -1738,  -1020,     14,    407,   1028,
- -2536,  -2171,  -2115,   6630,   -968,   -306,   1438,   3574,
- -2411,  -1857,   1911,  -1546,   2709,     57,    910,   1727,
- -3159,  -2565,  -2675,  -2746,  -2017,   -534,   8461,   6103,
- -2299,   2912,  -1851,   2660,  -1479,    -97,   1148,   2204,
- -2510,   8781,  -2194,  -1790,  -1114,   -110,   1140,   2885,
-  3261,  -1921,  -1633,   2766,   -788,   -403,    610,   1651,
- -2515,  -2021,   2415,  -1606,  -1149,   2479,    297,   1693,
-  3823,  -1538,   2514,  -1261,   -904,   -236,    550,   1581,
- -2903,  -2440,  -2922,  -2749,  -2480,  -1849,   -423,   3613,
-  3420,  -1876,  -1929,  -1537,   2955,     58,   1014,   1950,
- -3295,  -3009,  -3161,  -2926,  -2353,   2355,    351,   5502,
- -3140,  -2745,  -2781,   1247,  -1037,    538,   4939,   4382,
-  3584,  -2284,  -2321,  -1844,   -743,   3156,   1546,   2358,
-  -562,   -101,   -497,  -1196,  -1023,   1972,   1255,   1374,
- -3146,  -2824,  -3057,  -2757,  -1736,   3746,   5609,   5118,
- -2155,  -1665,  -1701,  -1780,  -1975,  -1127,   3185,   2036,
- -2540,    324,   -481,    311,    624,    719,    543,   1030,
-   550,    513,  -2430,  -1817,  -1129,     62,   1526,   1809,
-  2172,  -1314,  -1035,   -586,   -292,    233,    209,    543,
-  -252,  -2372,  -1961,  -1629,  -1306,   -408,    451,   1339,
-   792,  -2619,  -2316,  -1624,   1941,    678,    977,   1710,
-   428,  -2499,  -2369,  -2101,  -1448,   2988,    874,   2497,
-   451,  -2263,  -2204,   1403,   -631,    694,   1424,   1658,
-  -243,  -2104,   -378,    355,   1446,    373,    377,    973,
-  -756,  -2802,  -2508,  -2081,    177,    352,   2428,   2359,
- -1533,  -2710,  -2544,  -1102,    419,   3132,   1222,   1942,
- -2756,   1844,  -2429,  -1854,  -1283,   3960,   1633,   2917,
- -2858,  -2784,  -2106,  -1025,   1588,    905,   1092,   1657,
- -3028,  -2715,  -2782,  -2218,   2852,   4006,   2534,   3726,
- -2783,  -2355,  -2146,   2113,  -1201,   3361,   1178,   2670,
- -3199,  -2796,  -2682,  -2489,   1905,   -471,   5097,   4436,
- -2197,  -1078,  -2327,    420,   -637,     10,   1647,   1362,
-  1815,  -2519,  -2363,  -2174,  -1454,    -31,   4125,   3446,
- -3054,  -2953,  -2738,  -2328,  -1636,   1086,   2238,   2132,
- -3089,   -432,  -2674,  -2515,   -168,    745,   2236,   2305,
- -3214,  -2953,  -3159,  -3086,  -2748,  -1200,   3346,   5127,
- -1150,   -501,  -2109,  -1662,   2301,   -401,    651,   1320,
- -3072,  -2608,  -2833,  -2249,  -1387,   7704,   1811,   4960,
- -2474,  -2589,     83,   -499,   -785,    194,   1312,   1442,
- -2716,  -1663,  -2088,  -1812,  -1396,   1862,   -369,   1397
-},
-
-.fcb22m_2 = {
-  8809,  -2291,  -2452,  -1982,  -1356,   -423,    419,    588,
-   897,   1086,     79,  -2155,  -1957,    367,   1080,    233,
-   718,    441,    515,    642,    730,   2454,    774,  -2299,
- -1526,   -784,   -359,     96,    385,    482,   4905,  -2501,
- -2431,  -2047,  -1139,    131,    743,    999,   1243,   1294,
- -2154,   -433,  -2461,  -2201,  -1552,   -163,   -200,   4009,
-  1731,   1652,  -2381,   5295,  -1457,   -895,   3480,  -1230,
-   -94,    471,    554,    669,  -2458,  -1271,    278,  -2238,
- -1852,   -813,    888,   1032,    801,   1008,   -258,   -538,
- -1744,  -2087,  -1651,  -1239,   2222,     -4,    783,    882,
-   478,    782,  -1335,  -1453,   1728,   -627,   -387,   -205,
-   221,    193,  -2282,   -518,   7464,  -1808,  -1134,   -199,
-   340,    321,    410,    617,   2278,   -436,  -2082,  -1958,
- -1493,   -885,    628,    794,    855,    989,    232,  -1115,
- -2617,  -2152,  -1290,  -1299,   -458,    222,   3936,   3349,
- -2240,  -2787,  -2689,  -2255,  -1241,    816,   2307,   1566,
-  1685,   1723,   2960,  -2134,  -2532,  -1798,  -1128,  -1073,
-  5380,   1013,   1525,   1415,  -1976,    456,   -538,  -1433,
- -1347,     22,   -496,    284,    387,    465,  -2214,  -1863,
- -2261,   1049,  -1487,  -1222,   1610,    621,   1000,   1116,
- -2393,   -731,   4075,   2375,  -1178,   -908,   -383,    327,
-   543,    572,  -2071,  -2039,   3310,  -1903,  -1502,    -72,
-   123,    693,    721,    918,  -1866,  -1251,  -1065,   5630,
- -1574,   -541,      1,   1014,    813,    887,  -2145,  -2421,
- -2176,  -1756,   1856,    408,     -1,    759,   1109,   1276,
-  3053,  -2705,  -2467,  -2068,  -1160,   1405,    459,   1167,
-  1219,   1318,  -2198,  -2037,  -2005,  -2204,  -2039,  -1473,
- -1529,    264,   1333,   1822,  -2121,  -1434,   -472,   1901,
-  2448,   -589,   -424,    248,    376,    602,  -1571,  -1032,
- -1243,  -1619,   5682,  -1162,    362,    570,    865,    852,
- -1875,   -805,   4258,  -1569,   2992,  -1175,     51,    164,
-   314,    648,  -2083,   5574,   2553,  -1866,  -1156,   -642,
-  -198,    330,    446,    602,  -2365,   1601,   2873,  -2043,
- -1510,  -1142,    -20,    588,    535,    676,  -2207,  -1637,
-   626,    745,  -1548,   -590,    745,    540,    505,    618,
-   749,  -1389,    857,   1387,   -398,   -606,    -75,    -86,
-    11,     78,   3322,  -1347,   1978,  -1431,   -745,   -280,
-   -42,    135,    350,    376,   -508,  -1349,   2961,  -1184,
-  -647,  -1257,   3009,   -374,    523,    616,  -1848,    -41,
-  2652,  -1609,  -1603,   3284,    -24,    502,    122,    448,
- -2337,  -1029,    734,  -1533,   1523,  -1312,   -754,    335,
-   510,    774,    769,   -117,    139,  -1254,  -1468,   -965,
-  -375,      2,    227,    518,   3187,  -1524,   -776,  -1253,
-  2977,   -530,    319,    -61,    244,    413,  -2290,   3085,
- -1763,  -1480,  -1374,   3272,    -87,    323,    421,    652,
- -2317,  -2182,  -1604,     -1,   -801,   1320,   -156,    907,
-   799,    918,  -1494,  -2205,   1137,     69,   1249,   3437,
-   925,     29,    419,    448,   3574,  -1564,  -1713,   2374,
-  -941,   -252,    123,    263,    366,    539,   1059,  -1856,
- -1753,    766,  -1704,    106,    262,    596,    684,    820,
- -2503,  -1878,   1835,   -594,  -1024,  -2105,  -1567,    488,
-   794,    883,  -1626,   -613,  -1410,   2846,  -1413,   3557,
-  -348,    460,    332,    577,   -907,    700,  -1680,   1130,
- -1637,   -793,   -160,    -38,    473,    630,   1487,   1872,
- -1526,   1379,   -806,    121,   -383,    149,    259,    413,
-   759,  -2817,  -2758,  -2290,  -1348,    460,   1782,   1536,
-  1513,   1503,  -2265,   3193,    117,  -1704,  -1367,   -487,
-   125,    365,    594,    651,  -2287,   1272,  -2537,  -2038,
- -1515,   -578,   2994,    582,    941,   1058,  -1556,  -1583,
-  -720,  -1584,    956,  -1032,   1861,    146,    402,    429,
- -2184,   1667,   1241,    289,     52,   -232,   -265,    210,
-   248,    331,   1133,  -1813,  -1869,  -1429,  -1484,   5620,
-  -400,   1316,   1146,   1150,  -1975,   -818,  -1921,  -2054,
- -1768,   2953,   -544,    426,    856,   1107,    493,  -2019,
-   176,  -1915,  -1040,    717,    -91,    728,    647,    776,
- -2360,    739,  -2136,     30,    636,   -447,   -116,    498,
-   531,    775,  -2250,   8607,  -2075,  -1928,  -1072,   -450,
-    38,    439,    558,    778,   4484,   1056,  -1830,  -1716,
-  -988,   -412,    260,     56,    425,    579,  -2243,   4094,
- -1267,   2172,   -990,   -562,     97,    304,    533,    609,
-   790,    780,  -2029,  -1947,  -1327,   1224,    255,    344,
-   516,    660,   -591,   1702,   -118,  -1402,    396,  -1387,
-  2268,   -247,    177,    355,   1393,  -2318,  -1975,  -1563,
-   863,   -939,   -365,    411,    800,   1019,  -2370,   4656,
- -2301,  -2111,  -1679,   -698,    458,    788,   1004,   1138,
-  2285,   4924,  -1940,  -1955,  -1159,   -436,    237,      5,
-   300,    364,  -2492,   2165,  -2021,  -2072,   1504,   -612,
-   -93,    249,    676,    799,  -2411,   1952,  -1752,  -2418,
- -2285,  -1323,   -621,    837,   1043,   1266,     76,   3160,
- -2176,  -2176,  -1717,  -1105,   1045,    410,    728,    940
-},
-
-.fcb22s_2 = {
-  6946,  -1850,  -1986,  -1590,  -1276,  -1063,  -1026,  -1017,
-  -805,   -346,      9,  -2911,  -2843,  -1899,   -198,   2193,
-  3325,   1315,     37,   -528,   -371,    599,   -751,  -2157,
- -1912,   -855,    988,   1222,   1085,    953,   3212,  -2793,
- -2564,  -1707,   -657,    683,   1109,    683,    647,    446,
- -1906,  -2315,  -2569,  -2428,  -1698,   -600,   1100,   3790,
-  3368,   2172,   2017,   -895,  -1354,   -734,   2552,   -403,
-   -68,   -402,   -752,   -932,  -1205,  -1937,    572,  -1434,
-  -500,   -579,    291,   1723,   1312,   1695,   -238,  -1715,
- -2029,  -1525,   -816,   -363,   2816,    167,   2196,   1793,
-   897,  -1081,   -262,  -1338,   1052,  -1231,    -94,   1296,
-   503,    184,    588,  -2057,   -911,  -1933,  -1769,    167,
-  1013,   1774,   1414,   1289,   2406,  -1906,  -2055,  -1952,
- -1726,  -1618,   -451,    575,   3021,   2569,   -776,  -1649,
- -2111,  -1930,  -1499,  -1349,   -595,    329,   3090,   5458,
- -1954,  -1309,  -1554,  -1159,  -1132,    329,    714,    760,
-  2529,   2417,   1046,  -1025,  -1114,  -1325,   -154,  -1501,
-  4160,   -696,    230,    398,  -2010,    385,  -1344,     36,
- -1269,   -987,   1009,   1453,   1163,   1591,    916,  -1534,
-  -508,    221,  -1596,  -1130,   1394,    539,    676,    676,
-  1263,   2029,    284,   1592,    161,   -124,   -572,  -1362,
- -1946,  -2148,  -1488,   -222,   4967,  -1202,   -939,   -375,
-   -80,   -593,   -445,   -418,   -781,  -1560,     31,   4757,
- -1417,   -954,   -402,    193,   -316,   -278,   -926,   -895,
- -1024,   -436,   2673,   1991,    254,     28,   -861,  -1291,
-  1475,  -2708,  -2689,  -2118,   -703,    290,   1841,   2048,
-  1213,    594,    132,  -2598,  -2427,   -988,  -1111,   -158,
-   478,   2118,   2571,    830,  -1430,   -678,   -773,   1340,
-  2473,   -798,   -751,    215,    274,    -65,    335,  -1947,
- -1796,  -1436,   3862,   -611,    105,    -31,    775,    669,
-  1439,  -1266,   1670,   -739,  -1259,   -572,    -17,   -107,
-   176,    130,   3899,   3478,   -548,  -1429,  -1176,  -1104,
- -1147,  -1503,  -1277,  -1068,   -258,   2645,   1753,   -333,
-  -827,  -1306,   -827,   -502,   -306,   -119,  -1602,  -1644,
-  1922,   1127,   -628,  -1073,    348,    195,    616,    685,
-  1750,   -898,  -1852,   1813,   -700,    254,    598,   -234,
-  -433,  -1035,   2502,     94,    467,  -1672,   -905,    776,
-   679,    -11,  -1071,  -1845,  -1083,   -320,    690,    110,
-  -708,  -1077,   2514,     70,   -412,   -300,   -371,   -717,
-  1700,  -1625,  -1346,   1954,     14,    -64,   -121,    181,
-  -673,   -909,   2274,  -1389,   2058,  -1503,    306,   -187,
-  -209,    -69,   1523,   -632,   -695,  -1283,   -988,   -569,
-  -798,   -521,    398,   2834,   1953,  -2215,  -1626,    106,
-     6,   -498,    -57,    173,    731,   1002,  -1706,   1701,
-  -328,  -1745,  -1398,   2176,    -19,    311,    492,    667,
- -1073,  -1803,  -1684,    703,  -1316,   1803,    659,    913,
-   906,   1033,  -1982,   -102,    945,  -1620,    718,    555,
-   613,     38,    394,    421,   2738,  -1159,  -2248,  -1852,
- -1568,     33,    363,   1490,    935,    561,   1464,  -2466,
- -1209,  -1204,   -692,   2009,    129,    354,    372,    380,
- -2053,   1122,   2272,   -824,  -1355,   -926,   -122,    567,
-   526,    923,  -1320,     59,   -226,   1674,  -1512,   1498,
-  -631,    221,     26,   -247,    -40,  -1615,  -1597,   2111,
-    34,   -813,    200,    219,    758,   1000,    306,    394,
-  -430,   -117,   -409,    -81,   -207,     16,     36,    176,
- -1737,  -2898,  -3005,  -2214,   -568,   2140,   4132,   2592,
-   504,   -521,  -1509,   3610,   1070,  -1890,  -1319,    -11,
-   174,   -148,   -212,   -347,   -464,  -1068,  -2568,  -2532,
- -1973,   -519,   2104,   3713,   1882,   -145,  -1319,  -2375,
- -1862,   -843,   2061,   -266,   1465,    866,    912,   1183,
- -1784,   2072,    205,   -375,   1112,   -374,   -534,   -430,
-  -162,   -204,    375,     82,   -823,  -1148,   -752,   4681,
-  -339,   -247,   -790,  -1088,   -494,  -2302,  -2310,  -1603,
-    46,   3367,    -50,    393,   1383,   1457,  -1377,  -2005,
-   643,    326,    312,   1189,   -225,    563,    261,    -70,
-  -667,  -1191,  -2255,   -470,   1000,    142,   -525,   2285,
-   756,   2061,   -953,   5888,  -1339,  -1534,  -1252,    -16,
-  -116,   -305,   -375,   -596,   3611,   -889,   -511,     43,
-  -809,   -659,   -737,   -510,   -258,   -108,  -1515,   2806,
- -1555,   1025,   -932,   -601,    146,    164,    207,     71,
-  1606,     93,  -2420,  -2311,  -1641,   -244,   1785,    804,
-  1040,    427,  -1510,     38,  -2490,  -1987,     44,    699,
-  1407,    988,   1061,    411,   1162,  -1382,  -2669,  -1635,
-  -905,   1503,    674,   1357,    869,    244,    411,   2612,
- -1792,  -2147,  -1693,   1434,    281,     38,    228,    424,
-  2291,   1354,  -2128,  -1377,  -1014,   -609,    131,   -151,
-   418,    602,    111,   2200,  -1547,  -1153,   1435,  -1282,
-     6,   -111,     -1,     92,    238,    613,  -2271,  -1181,
- -1455,   -919,   -182,   1066,   1932,   1679,  -1715,   2825,
- -1764,  -1759,   -741,   -829,    501,    746,   1056,   1416
-},
-
-.fcb44l = {
-  4868,  -1851,  -2031,  -2019,  -1751,   -552,    756,    929,
-  1389,   1590,  -2090,  -1202,  -1317,    516,  -1798,  -1020,
-  -694,   4322,   1388,   1904,  -2605,  -1239,   1005,   -757,
- -1248,   -358,    699,   -201,    409,   1093,  -2901,  -2254,
- -2605,  -2595,  -2104,  -1681,   6854,   2692,   3155,   3446,
- -2535,  -1421,  -1745,    898,  -2046,  -1457,  -1044,   -269,
-  1748,   1873,  -2268,  -1098,    407,  -1865,  -2103,   1510,
- -1217,   -399,   1718,   2017,   3638,  -1685,  -1547,  -1480,
-  1637,   -744,    580,    586,   1313,   1409,    617,  -2020,
- -1919,  -2179,    932,   -937,    559,   1795,   1528,   1596,
- -2867,  -2553,  -2507,  -2653,  -2365,  -1985,   -170,   8679,
-  4271,   4273,   2263,  -1835,  -1934,  -1719,  -1778,   2357,
-   125,   1319,   1543,   1765,   3689,  -1215,   2369,  -1533,
- -1611,   -771,   -123,   1005,   1297,   1465,  -2491,   2631,
- -1636,  -1655,   1244,  -1178,    386,    961,   1300,   1553,
- -2357,  -2404,  -2305,  -2177,  -1714,   -383,    -98,    258,
-  3902,   2475,  -2923,  -2580,  -2685,  -2803,  -2678,  -2428,
- -1247,    450,   8174,   5035,  -2302,  -1629,  -1495,   1832,
-  1616,   -577,    639,    872,   1122,   1437,    785,  -1947,
- -1976,    823,  -1909,  -1005,    430,   1244,   1713,   1664,
- -2537,   8025,  -1705,  -2005,  -2030,  -1155,     64,   1106,
-  1975,   2277,  -2410,  -2639,  -2292,  -1858,    162,    744,
-   555,   1559,   1719,   1806,  -2282,  -1982,  -1914,   1415,
- -1785,   2197,    254,    763,   1338,   1741,  -2509,  -1991,
- -2328,  -1853,  -2299,   5145,    -34,   1495,   2913,   3018,
- -2009,  -1736,   2411,  -1595,   1877,  -1316,    693,   1042,
-  1565,   1744,  -2657,  -2161,  -2222,  -2135,   4454,  -1784,
-  1331,   3208,   2852,   2955,   3738,  -1338,  -1425,   2090,
- -1601,   -279,     -2,    712,   1220,   1436,  -2385,  -1265,
-  7093,  -1561,  -1742,  -1003,    283,   1009,   1843,   2055,
- -2251,  -2175,   2310,  -1321,  -1976,   1874,    164,   2781,
-  2721,   2487,   2519,  -1101,  -1539,  -1575,  -1487,   -724,
-   -25,    355,    643,   1011,  -2296,  -1799,  -1895,  -1700,
-  2743,   -924,   -254,     32,   1504,   1910,  -2811,    898,
- -2363,  -2518,  -2408,  -1737,   -936,    221,   2588,   2527,
- -2535,  -2360,  -2477,  -1861,  -1882,   1833,   3587,   1307,
-  2141,   2274,   -433,  -1994,  -1692,  -1318,  -1398,   -350,
-  1518,   1923,    835,   1262,  -2246,   3383,   2458,  -1464,
- -1874,   -983,   -157,    531,   1490,   1729,   9543,  -1713,
- -2011,  -2015,  -1870,   -969,    -34,   1160,   1724,   1919,
- -2530,    140,  -1923,  -1730,  -1720,   -605,    629,   1577,
-   974,   1373,  -2268,  -1582,   -933,   1124,  -1624,   -514,
-  4156,   -118,   1515,   1907,  -2267,   -574,  -1311,   -954,
-   -47,  -1259,     15,    364,    854,   1009,  -2221,    629,
-   994,  -1646,  -1324,  -1509,   2359,   3453,   1393,   1912,
-  3586,  -2286,  -2537,  -2560,  -2415,  -1748,   -368,   3093,
-  2881,   2611,  -2556,   2792,  -1558,   1117,  -1681,    -65,
-   -36,    516,   1233,   1514,    531,  -1814,    998,  -1795,
- -1693,   -871,    725,    868,   1504,   1465,    907,    300,
- -2060,  -2366,  -2392,  -1881,   -596,   1754,   2169,   2104,
- -2755,   2709,  -2298,  -2627,  -2423,  -1875,   -733,   3886,
-  2648,   2821,    623,   -541,   -163,   -319,     85,     84,
-    15,    716,    511,    572,   3948,   2773,  -1504,  -1746,
- -1832,   -934,    -78,    988,   1277,   1518,  -2678,   2216,
- -2162,  -2331,  -2076,   -968,   3445,   1070,   2077,   2206,
- -2892,  -2425,  -2674,  -2905,  -2844,  -2584,  -1381,   3269,
-  2696,   3281,  -2090,   -369,  -1515,  -1367,   -200,   2089,
-   739,    700,    866,   1169,  -2276,  -1057,   2851,   2589,
- -1686,   -515,    -65,    579,   1278,   1593,  -2837,  -2458,
- -2565,  -2783,  -2843,  -2468,  -1704,  -1531,   1475,   4153,
- -2209,  -1857,  -1873,  -2177,    758,  -1531,   3207,   1163,
-  1506,   1851,  -2383,  -1683,  -1839,   5772,  -1815,   -465,
-   361,   1086,   1912,   2140,  -2629,  -1688,   1608,  -2190,
- -2419,  -2064,  -1253,   1397,   2099,   2306,    513,   1664,
- -1683,  -1629,  -1682,   -109,    269,    695,   1072,   1317,
-   208,  -1602,  -1918,  -1038,   -813,    312,     24,     26,
-   761,    990,  -2288,  -2225,  -1948,  -1932,  -1832,   -949,
-  -450,    920,    805,   1468,  -2897,  -2633,  -2557,    464,
- -2174,  -1157,   1170,   2230,   2550,   2522,  -2643,  -1928,
- -2255,  -2578,     82,  -2206,    -63,   2663,   2007,   2292,
-   226,  -2541,  -2687,  -2753,  -2229,  -1556,    785,   3837,
-  2331,   2492,  -2496,  -1740,  -2465,  -2295,  -2151,   1142,
-   363,   3967,   1943,   2432,  -2619,  -2400,    520,  -2274,
- -1900,  -1486,   2135,   1407,   2300,   2288,  -2811,  -3066,
- -3128,  -3098,  -2529,  -1475,   2172,   3413,   3613,   3571,
-   564,  -2347,  -2257,  -2377,  -1944,  -1771,   -582,    509,
-  1683,   1975,   -285,  -2136,  -2529,  -2464,  -2117,    278,
-  1094,   1042,   2192,   1976,   1781,  -1874,  -2042,  -2103,
- -1744,  -1044,   3373,   1252,   1861,   1873,  -2688,  -1849,
- -2462,  -2494,  -2105,  -1903,   2221,    250,   1653,   2233
-},
-
-.fcb44m = {
- 13151,  -1763,  -2583,  -2518,  -2181,  -1036,   -537,   -112,
-   214,    590,   -608,  -2270,  -2228,  -1301,  -1018,   3687,
-  -471,   -282,    909,   1665,  -2426,   1713,   -808,  -1240,
- -1366,   -976,   -140,   1730,    683,    191,   7253,  -2076,
- -2733,  -2698,  -2253,  -1116,    376,    687,   1314,   1532,
-  -820,  -1471,  -2092,  -2047,  -1796,  -1347,   -732,   6348,
-  2529,   1441,  -1460,  -1845,  -1046,  -1643,   8086,   -928,
-    90,    660,    428,   -188,    604,  -2022,    556,  -1680,
- -1641,   -902,    834,    941,   1480,   1906,  -2439,  -2573,
- -3091,  -2853,  -2419,  -1606,   2312,   2624,   2659,   2659,
- -1286,  -2273,  -2400,  -1826,   2443,  -1391,    685,   1822,
-  1810,   1625,  -1993,   -731,   9737,  -1476,  -1183,  -1244,
-    34,    -85,      0,    201,   4171,  -2430,  -2869,  -2866,
- -2488,  -1154,  -1253,    282,   2715,   3643,  -2130,  -2522,
- -3259,  -3051,  -2977,  -2204,  -1264,   1103,   7113,   7948,
- -1271,  -1694,  -2011,  -1294,  -1607,    247,   -303,    715,
-  4276,   1908,  -2337,  -2111,  -2232,  -2123,  -1648,  -1302,
-  7686,   1213,    982,    984,  -2594,  -2127,  -1981,  -2104,
- -2405,  -1966,   -936,    -95,    326,    672,  -2263,   -893,
- -1367,   1288,  -1321,  -1351,   2503,    747,    390,   -247,
- -2220,   -860,   3641,   3766,  -1724,  -1487,   -531,    239,
-   134,    -82,  -2563,  -1537,   3883,  -1911,  -2109,  -1713,
-  1056,    726,    977,   1091,  -1874,  -1366,  -1628,  11069,
- -1653,   -696,    118,    -78,    337,     29,   2449,  -1438,
-  -601,  -1533,   -816,   1262,    540,     79,   -460,  -1403,
-  3204,  -1918,  -1892,  -1911,  -1468,   -976,    -42,   2785,
-  1088,    564,   -236,  -2267,  -2324,  -2130,  -1880,   -427,
-  -258,   -543,    903,   5142,  -1791,  -1611,  -1073,   2911,
-  2993,  -1295,   -400,    229,    192,    -85,   4461,  -1711,
- -1431,  -1640,   3525,  -1398,   -101,   -219,    327,    415,
-  -669,  -1520,   6595,  -1291,   5123,    155,   -480,   -518,
-  -552,   -890,  -2609,   7074,   3220,  -1054,  -1852,  -1165,
-   -25,     89,   -361,   -140,  -1610,   2214,   2903,  -1737,
- -1704,  -1178,   -708,   -171,    177,    674,  -1075,   -890,
-    82,    463,  -1432,  -1048,   -703,   -759,   -247,    344,
-  2448,   -656,  -1135,   4366,   -583,   -705,     40,   -314,
-  -676,  -1271,   4389,   -952,   3249,  -1606,  -1524,  -1172,
-  -490,     97,    128,    -91,    -66,  -1293,   1696,  -1114,
- -1455,   -519,   2620,    479,   -257,  -1512,  -2037,  -1281,
-  1752,  -1285,  -1812,   2789,    -52,    676,    409,    296,
- -1977,  -1043,    270,  -1615,   2131,  -1051,   -161,   -498,
-   767,   1673,   1044,     27,  -1107,  -1730,  -1856,  -1264,
-  -275,   -167,    893,    443,   3850,     97,  -1244,  -1691,
- -1566,  -1088,  -1062,   -837,   -159,   1830,  -1424,   2494,
- -1878,  -1532,  -1991,   2919,     62,    399,    524,    381,
- -1340,  -2415,  -2028,    218,  -1342,    410,    815,    533,
-   948,   1998,  -1213,  -1847,   3691,  -2123,   1822,  -1548,
-   537,    987,    356,    123,   3876,  -2476,  -2021,  -2195,
- -1562,   -737,   2250,    709,    797,   1102,   2065,  -2258,
- -2394,  -1816,  -1536,   1059,   4653,   1457,    456,    -27,
- -2226,   -736,    765,  -1879,  -2188,  -1793,   -928,    892,
-  1793,   2257,  -1182,  -1646,  -1789,   6105,  -1936,   4316,
-  -307,   -143,    223,    236,  -2213,  -1862,  -1823,   3326,
- -1810,  -1384,   -453,   1007,   1331,   1405,   4135,  -2298,
- -1657,   1981,  -1702,   -853,   -318,    298,    760,   1025,
- -2537,  -2782,  -2985,  -2687,  -2839,   4493,   -448,   4249,
-  3048,   2678,   1045,   3227,   -690,  -1390,   -976,   -652,
-   587,    194,   -749,  -1358,   -730,    250,  -2404,  -2548,
- -2157,  -1027,     32,   2091,   1059,   1360,    262,  -2135,
- -2061,  -1777,  -1614,   -246,   2004,   2605,   1516,   -948,
- -1060,  -1076,  -1643,   -748,    144,   1595,   1730,    531,
- -1086,  -2182,   -483,  -2191,  -2411,  -1983,  -2345,  10051,
-  -841,   1456,    924,    207,   4652,  -1831,  -2026,  -1710,
- -2235,   4036,   -755,    -70,    533,    887,  -1899,  -2326,
- -2129,  -2115,  -1606,   1443,   2557,    941,    618,    527,
-   949,  -1547,  -2067,  -1785,    455,    -60,     79,    202,
-   912,    954,  -2527,  14551,  -1893,  -2315,  -2609,  -1844,
-   497,    287,   -197,    626,   6839,   -804,  -1299,  -1259,
- -1109,    -97,    976,    144,   -343,  -1375,  -2334,   3740,
- -1049,   2980,  -1739,   -474,    223,    137,    155,   -171,
-  2962,   1814,  -2378,  -2643,  -2249,  -1109,    858,    643,
-  1630,   1399,  -2098,    974,  -1718,  -2193,  -2146,  -1488,
-  3353,   -147,   1187,   1266,   1559,  -2532,  -2941,  -2759,
- -2101,  -1098,   1562,   1049,   2045,   2159,  -2298,   7439,
- -2129,  -2361,  -2318,  -1552,   -422,    482,    985,   1111,
-  6050,   5657,  -1698,  -2267,  -2127,  -1135,   -140,   -286,
-  -352,   -124,  -1230,   3492,  -1370,  -1221,   2958,  -1239,
-  -472,   -722,   -169,    -89,  -2310,   2988,  -2367,  -2421,
- -2589,  -2034,   -662,    421,   1863,   2736,  -2612,   5429,
- -2104,  -2257,  -2440,  -1817,   4819,    883,    622,    636
-},
-
-.fcb44s = {
- 11239,   -328,  -2011,  -1713,  -1662,  -1290,  -1225,  -1520,
- -1541,   -912,    400,  -1103,  -2698,   -162,    263,   -964,
-   668,    405,    732,   2493,  -2491,   1000,  -2910,   -793,
- -1351,   -515,   1051,   2002,   1757,   2150,  -2010,  -2021,
- -2254,  -1896,  -1953,    664,   7067,   2632,    531,  -1367,
- -2228,   2113,  -2019,   2309,  -1458,   -426,   1242,    338,
-   205,   -222,  -1317,  -1806,  -2477,  -2427,  -2477,  -1852,
- -1472,   -911,   2261,  10280,  -2369,    382,   3180,  -1210,
- -1601,   -748,   -732,    504,   1440,   1142,    -13,    610,
- -2457,   -739,  -1318,  -1013,    -52,   -470,    627,   4734,
-  1248,   2947,   -631,   1560,   2096,   -833,  -1173,  -1475,
- -2060,  -2189,    967,  -1451,  -1544,   -758,   -538,    -31,
-  1395,   3550,     -3,  -1999,  -1975,  -1734,  -2680,  -2512,
- -2037,  -1306,   -252,   1288,   6012,   4834,  -1087,   3259,
-  3115,  -1369,  -1136,   -948,   -264,   -582,   -677,   -643,
- -2500,   1284,   -317,  -1872,  -1150,  -1150,    310,    832,
-  1597,   2842,   6295,   3806,   -671,  -1536,  -1460,  -1256,
- -1223,  -1504,  -1672,  -1471,   1358,   1004,  -1893,   1114,
- -1643,   -103,   -513,    189,    303,    140,  -1618,   -648,
-  -720,   7274,    573,   -180,   -731,  -1226,  -1564,  -1742,
-   151,   2103,  -1562,   -974,     94,    546,   3536,   -205,
- -1657,  -2534,  -2187,   2840,  -1248,    451,   2615,    171,
-   479,   -305,  -1299,  -1708,  -2144,  -1593,  -1289,   2766,
-  2287,   -400,    188,    -51,    141,    105,  -2128,   4976,
- -1690,  -1216,  -1175,    297,   1454,    449,   -478,   -970,
- -1914,  -1459,   3036,   2668,   -950,   -634,   -507,   -374,
-     4,     34,  -1664,   2901,    847,   2817,  -1154,  -1651,
- -1262,  -1160,   -624,    629,   1578,    765,  -2002,  -2121,
- -1527,   1938,   -272,    113,    287,    955,  -1473,     60,
-  8047,    137,   -534,   -841,  -1077,  -1504,  -1788,  -1758,
- -1871,    119,    931,   1775,   -704,   2792,    354,   -501,
- -1370,  -2038,  -1031,  -1631,  -1914,   -879,    377,   7589,
-   173,   -196,   -491,  -1658,   3790,   -773,  -1731,   3028,
-    49,  -1013,   -563,  -1232,   -953,   -730,  -2568,  -1926,
-  -679,   -267,   -324,   -962,     51,    461,   2728,   3631,
-  3533,  -1690,  -2846,  -2370,  -1945,   -917,   -551,    276,
-  2634,   3558,  -2592,  -1750,  -2422,  -1586,  -1204,  -1001,
-  4603,   1802,   2673,   1685,   2710,   -853,  -2321,  -1919,
- -1603,   -868,   3706,    290,    570,    338,  -2245,  -1704,
- -1915,    545,   -787,   1635,   1725,    526,    666,   1604,
-   642,  -1154,   3231,  -1232,  -1772,   -623,    217,     27,
-     3,    641,  -2411,   1924,   -967,  -1583,  -1499,   2316,
-  1354,   -115,    333,    559,  -1721,   2475,  -1942,  -2114,
- -1196,   -571,   1769,   2350,   1315,   -607,   4510,  -1414,
- -2228,  -1312,   1439,    469,   -248,   -399,   -270,   -721,
- -1517,  -1247,   -771,    -36,   6488,    942,   -279,   -572,
- -1041,  -1908,  -2388,  -2281,  -2595,  -2275,  -1529,     51,
-   471,   4435,   3002,   2738,   4049,   1562,  -2706,  -1672,
- -1649,  -1204,   -518,   -280,    774,   1344,      6,  -1950,
- -1521,  -1768,   -972,   1420,   3011,   -191,    644,   1478,
-  3220,   -313,   3030,   -153,   -841,   -739,   -378,  -1013,
- -1410,  -1815,  -2104,  -1033,  -2097,  -1992,   -943,   2391,
-   424,    369,   1601,   3331,   1494,  -2060,  -2027,   1579,
- -1407,   1120,   -280,   -197,    761,   1048,   -710,   4094,
- -1533,  -1984,  -1620,  -1132,   -515,   -485,    971,   2644,
-  3979,   -661,  -1891,  -1120,   -897,   2484,   1623,     21,
- -1534,  -2438,   3201,  -1510,    858,  -1459,   -711,  -1332,
-  -833,   -240,    763,   1096,  -1435,    -29,   3174,  -1773,
-   -19,    708,   1680,    403,   -910,  -2224,  -2670,   -619,
-  1320,   -751,  -1323,  -1022,   2875,   1080,    985,      1,
-   191,   7823,   -475,   -604,  -1126,   -967,  -1139,  -1600,
- -1767,  -1161,  -1342,  -1960,  -2112,  -1793,  -1596,   3103,
-   535,   2001,   3235,    151,  -2266,   -807,  -1977,  -1661,
- -1255,   2328,   2632,   3189,    621,  -1130,  -2183,  -1127,
-  2391,   -884,   2173,   -690,   -354,   -516,    352,    954,
-  1847,    -74,  -1260,  -1839,   2557,  -1221,    228,   -630,
-  -162,    386,   1462,  -1889,  -2596,  -2216,  -1869,   -518,
-  1281,   2329,   2653,   1117,  -1535,  -1038,  -1752,  -1862,
- -1635,  -1067,    994,   5212,   2719,   -264,  -2021,   1824,
- -2110,   -619,   1538,   -397,   -332,   -153,    860,   1281,
-  6568,  -1790,  -2459,  -1707,  -1708,   -799,    294,     89,
-   475,    992,  -1668,  -1819,  -2010,  -1623,   2079,   3255,
-  -388,    591,   1477,    581,  -1544,    476,  -1825,   -959,
- -1296,  -1037,   -453,   1146,   4693,    839,   2027,   3021,
- -1731,  -1746,  -1964,  -1115,   1197,    102,    164,   -162,
- -2301,  -1281,  -2022,   3983,  -1122,   -281,     85,    352,
-  1042,   1599,   6463,    -93,  -2010,  -1988,  -2282,  -2189,
- -1915,  -1721,     17,   4694,    424,   -998,   -111,  -1995,
- -1246,  -1176,     78,   -116,   1951,   3059,  -1974,  -1783,
- -2243,  -1238,   3935,   -928,    -15,   1265,   1536,   1907
-},
-
-.shape08 = {
-  5279,   1101,  12974,   5624,   2029,   3853,   5918,   1516,
- -2905,   -224,    -92,   -819,    803,   1091,   3091,  -3355,
-   152,  -1214,  -7317,   -738,  -8973,    546,  12035,   -937,
-  2216,   2113,   1214,  -6577,   2006,  -1661,   -673,  -5880,
-   496,    454,   3400,    676,   -322,  11388,    634,  -1169,
- 12556,  -5804,  -7724,    588,  -6801,   1080,    354,  -1681,
-  -942,   1926,   -487,   -580,    156,     79,  15253,    667,
-  1155,    655,   -719,   1999,   -785,    214,   2822,   1020,
- -1967,     73,   -387,   -137, -15225,  -1552,   -357,   2830,
-  2140,   3070,  -2552,   2410,   1230,   4131,    999,    248,
-   531,   -909,   3948,  12858,  -8056,   2205,  -2837,   -171,
- -1633,   -129,    -93,   1852,  -1920,    157,   9647,    -84,
-  -150,  -1365,  -1522, -13197,   6168,  -3195,   5890,  -1724,
- -6407,  -1340,  -7435,   -621,  -5732,  -2895,    145,   3974,
-   728,   9840,   -494,   7357,   -394, -13614,   -256,  -1930,
-   468,   -266,   8001,   -153,   -365,   7652,    135,   1400,
- -3869,   1091,  -4935,  -2884,   1259,   6819,   1025,  -6667,
-  1079,  -9794,   6827,  -4166,   1108,   1149,  18861,    593,
-  -177,  -1067,   -644,  -2164,   4727,     85,   -101, -10805,
-  -247,   8918,   2261,   5475,    756,   3018,  -6535,   1941,
-   359,  -4229,   1206,    958,   -878,    554, -18780,   2289,
-  4906,  -7412,  -7685,   7932,    965,   2460,   4423,   -563,
- -3668,  -3482,   3307,  -1737,    971,  -7480,  10742,   1978,
-  2365,     20,  -3625,    466,   2056,  -6602,   9396,   3145,
-  3162,   1857,   -630,  -6905,   1660,  -3024,  -2159,   1109,
-  1282,   2767,    210,  -2203,   3099,  -7889,   1805, -13115,
-   988,  -6235,   1566,  -1399,  -9612,   1821,   -519,    -57,
-  3428, -14024,   1141,  -2542,  -9396,    -17,    440,  -8591,
-  2271,  -7811,   1891,   -935,  -4330,  -1303,    362,    426,
-   319,   1176,   3176,   2202, -14308,   -619,  -2942,  -2271,
-  -531,   -652,    345,  17681,   1453,  -1561,    341,  -2077,
-   933,    433,   1529,    463,  -1095,   4912,   -840,  16266,
-   973,   1732,   -718,   6702,  -3659,   4037,   -704,  -2707,
-  1423,   1291,   2300,    149,   -933,  -1338,   2019,   6173,
-   481,  14937,   -364,   3896,   -443,    992,   -896,    378,
-  -226,  -1505,    268,   -428,  -2622,   -289,  -2069,  10472,
- -3880,  -5330,    385,   3053,  -4642,   1525,  -1557,    716,
-  2504,    848,   -450,  -2018,   -458,   -705,  -7120,   -543,
- -2138,   2548,   -351,    737,  12906,  -1012,     63,  15357,
-   332,   -837,   -225,  -1299,   2843,   1334,   -669,   2083,
-  -707,   1171,   8219,   2190,  10567,   1370,  -1376,  -2919,
-  2108,  10098,   -388,   4442,    164,    490,   7580,     26,
- -1848,  -2919,    640,   4758,   -108,   8194,  -1325,  -2314,
-   447,   5178,  -1095,   9902,   -693,  -3624,   -223,    690,
- 10495,    776,   -919,  -1621,   2046,    469,   1454,   3681,
- -1090,  -1776,   1457,    212,   2054,   -994,    698,   -496,
- 22347,   -623,    254,    960,  -4073,    531,  -2572, -14393,
- -1022,    258,  -3667,    994,  15242,   5078,  -3618,   1925,
- -1229,  -1754,   1715,   4358,   1286,  -2360,  -4590,   1824,
-  7864,   1423,  -2146,  -2763, -10635,    474,   -829,   1159,
-  -157,    -54,   -158,    -29,    202,   -383,    285,     -2,
-   862,   -364,    415,   -123,   -145,  -9733,   1167,  10199,
- -1408,  -2992,   2131,   -412,   4743,   2992,   3555,   -617,
-  9606,  -2831,   2357,   5300,    625,   -678,   -500,   -128,
-   -56,  -6327,  -1122,  -2567,   1904,  -1804,    709,   3194,
-  -148,  -1371,  -6534,  -1748,  -1490,  14159,   1466,   1395,
-  1101,  -2725,    503,     68,  -1486,      0,    211,  -1218,
-    -3,  20920,   1709,   -208,   -839,   4574,  -6084,  -6557,
-  -103,   -984,   -375,   8409,   1715,  -2170,  -5003,  -3296,
- 13482,   1211,  -4159,   3496,   1040,   6925,    213,  -1398,
-   441,  -1231,   -814,    842,   1574,   1145,   1359,    437,
- -1777,  20566,    259,  -4573,  -1412,   -158,  10144,   1269,
-  1405, -12631,  -1104,   -615, -15892,    355,  -3795,  -1158,
-  3241,    252,    232,   -179,   -617,  -2038,    285,  -1014,
- -1248,   1835,  -1558,   1266, -10207,    629,   -312,  11376,
-   154,   -288,   5915,   -353,     60,   2695,   -853,   -103,
- 15659,   2403,  -1184,      3,   9236, -10953,   4434,    829,
-  2563,   -164,   -848,   -646,   7247,    895,   1726,   -752,
-  -979,   1053,   -971,    318,   2180,    927,    804,   -262,
-   446,   3261,  -4926,  -4523,   1247,   2039,  12770,  -1191,
- -1310,  -5574,   4763,    657,  -4139,  10821,   -805,  -1109,
- -3189,  -1721,    167, -10022,  -1877,   2123,    328,  -7048,
- -2130,   2431,   1522,   3209,  -8448,   1810,  -5412,   9815,
- -3677,   6575,  -6237,   -929,   -434,  -2375, -13586,   3497,
- -1140,   1227,  -6354,   -507,    329,  -1690,   1079,   -880,
- -3743,  -4021,  -4645,  -6053,    958,   4594,  -1122, -11628,
-  1537,  -3418,  -1242,    133,  -9335,   1611,   -432,  10733,
-  -885,   -468, -13466,    690,    214,   8968,   3441,   5451,
-  -219,   5492,   -377,    409,   3812,   2450,    508,   6542,
-  3824,  -3705,   -514,  -8262,   1537,   7969,    946,  -2869,
-  8762,    417,   5094,   2104,   6694,   -342,   1259,  -4779,
- -1445,  -1519,    333,   4385,    652,   -386,   -580,  -1892,
-  -873,   1862,   2704,  13837,  -5415,  -1975,   5881,   7150,
-  8272,  -6412,    704,   1854,    257,  -3746,  -9789,  -9634,
-  -924,   1393,  -3237,    259,    -56,   4390,   4902,   1172,
-  5114,  -2616,  -4409,  -1180,   4691,   7400,   -625,   8873,
-  6846,  -1224,   -213,  -5296,  -3504,   -147,  17828,  -1347,
-  3251,   1702,   1440,  -2364,   -491,   -227,   1765,   -446,
- -9746,  -2019,  11287,   -195,  -9559,   -312,    888,   5789,
- -1753, -11069,   2537,   -265,  -1762,   -779,  -8501,   -308,
-   -89,   1973,   3640,  17344,   1326,   -689,   -398,  -3820,
-  2167,    229,   -636,   2142,  -6587,   -751,  13243,    465,
- -5946,   -202,   -968,  -1060,   -240, -10626,   3405,   1302,
- -1263,    972,  11351,    100,   2266,   -930,  -2108,   5350,
- -3186,  11130,   2073,  -5616,    650,   2000,   1048,   5628,
-  -531,    674,   8453,   1030,   1152,  12095,    352,    409,
- -1029,  -1236,   -190,  -5724,   -589,   3550,   1958, -14081,
-  -339,   1672,  -1659,   4518,    -75,   -638,   5501,    277,
-  -578,  -2185,    157,   2066,   8634,  -2403,   1617, -12487,
- -1881,   8273,    179,  -2152,  -1294,   -512,   -415,    456,
-  -141,   -125,   -405,    132,     49,  -1978, -19085,   -451,
- -1480,    324,  -5397,    235,  -1217,    346,  -1258,   3540,
- 10075,  10291,   5060,  -2057,   6156,   -992,   9344,  -3718,
-  4296,    895,  -8464,    341,   1426,    648,   1494,   2895,
- -3760,  10139,  15531,   -984,  -1550,  -1319,  -1542,   -119,
-  -517,   -185,  -3368,  -9279,  -3455,  -4257,   1092, -10120,
-  5072,   3099,    986,  -2562, -12068,   1932,   6489,    950,
- -2417,   1362,   -567,    591,   -715,   -515,   3506,   -726,
-  6319,    214,   -364,   3611,   1895,  -2005,   -273,   1513,
-  2379,    475,  -4855,   -527, -11493,     27,   4343,  -2394,
-  -639,   -744,  -2601,  10917,   1910,   2449,   1238,  -2175,
-  5322,  -4054,    -40,   4274,    684,   8152,    966,  10882,
-   -13,   4253,   -287,  -3192,    548,   2020,    189,  -6894,
-   797,   2160,    579,   4084,   1767,  -4011,   -640,   7697,
-   791,    945,   1230,   6491,   1508,  -3762,   -433,  11340,
-  -129,  -1131,  -5121,   3148,   1544,  -7648,   1866,   9660,
-  2365,  -2110,    782,    -82,   3666,   -701,    303,    298,
- -1934,   -125,  -1427, -17589,  -1188,    175,  -7046,   -488,
-  1121,  -6594,    489,  -1551,  14349,   1499,   -544,  17132,
-   198,   2516,   2479,   -978,   -214,  -3399,  -1223,   2094,
-   130,  -1020,   1049,   -710,  12801,   -498,    297,  -1365,
-  -187,  -3169,   -123,   9019,    958,    221,  14234,   -590,
-   961,   3092,      8,    255,  -4586,   1789,   2522, -12577,
-   -91,   -822,   -805,   -714,   5298,   1299,   3306,  -1288,
- 13176,    235,   1754,    -67,   1912,   -604,   3240,  -2048,
-  -200,    772,   -173,   -996,   1368,   2380,    294,    763,
- 19665,   -196,    528,    182,  -2394,    923,    749, -13578,
-   855,    589,  -9553,      0,   5737,  10399,   9147,  -1655,
- -3735,   1246,  -2429,  -1147,  -2199,  -2953,    614,  -1404,
-  -449,  -8524,  -2271,   5001,  -9517,   2940,   -204,   3625,
-  -258,     32,   1521,   -299,  -1786,  -2836,   1523,   2427,
-  -835,   3139,   -197,   3351,   -279, -14766,  -1267,   5169,
- -1039, -10967,     58,    641,   -767,  -1193,   -591,   -716,
-  -834,   8109,   -915,   -711, -10427,  -1680,   -638,   2643,
-  -850,   -258,  10452,    362,  -5394,   -349, -14727,   -655,
-  1040,   1722, -10265,    551,   -283,   9888,    408,   -400,
-  5980,   1878,    781,   -923,   -667,   -789,   -348,    624,
-  -260,  14515,   -804,   1721,     -2,   5356,   1802,   1218,
-   498,   1871,   -988,  16295,   4163,  -2342,  -4290,   3121,
-  3269,    112,  -3492,   1124,  -1496,   1863,  -1426,  -1090,
-  1598,   -197,   1160,  -1660,  -1094,    477,  -4104,   -396,
-  1605,  26134,    746, -12876,   2320,  -1690,   8626,     39,
-  1341,  -1254,  -1890,   2555, -13996,  -1218,   3827,   1216,
-  -909,   -180,   1720,    -87,   -143,    989,    340,  -1426,
- -4029,   3141,  -9424,    466,  -8227,    422,  -7379,   2038,
-   401,     98,   3602,  -1223,   -946,   2469,   1159,    727,
-  -268,    467,    203, -11079,   3850,  -3469,  -1965,  -1857,
- -1415,  -2477,   3173,   7352,   9483,  -5541,   6212,   1886,
- -3868,   2728,    577,  -5057,    321,    972,    -77,     47,
-   227,    -38,  -1037,   -222,   -347,   -341,   1179,   -948,
-   592,  -7485,   2218,  -5955,   2698,  11798,    197,   6260,
-  1711,    998,      8,  -6223,  -1184,   1145,  -1781,   1376,
-  1394,    388,   -689,   2279,   6511,   2542,  -4903,   3917,
-  -790,    535,  -1903,  -4448,   4216,    -22,  -6715,   5204,
-  4807,   3193,  -1064,   5403,   4503,  -2434,  -4296,   1383,
- -1514,  -4103,    747,   3928,   2987,   9513,   2492,  -8691,
-  -993,  -2667,    -40,   -170,  -3116,    611,   2367,  16297,
- -1256,  -1404,  -3462,    466,   -524,   5464,    491,    706,
- -7491,   2027,    373,  -4086,   1620,  -7789,    704,   5002,
-  1706,   8325,   -851,  -9883,  -3072,   4475,   2696,  -8549
-},
-
-.shape11 = {
-    44, -10592,   -832,   -413,    612,    530,    379,    753,
-  1442,  -3006,   -858,  -1077, -12018,   -196,   -771,  -1142,
-  -628,  -2938,   -439,  -3323,     20,  12513,  -2462,  -1270,
-   -57,  -8417,   -690,    790,    276,   2349,   -341,  -1644,
-   230,  -2176,   -202, -14725,    170,   1725,   3030,    683,
-  -231,    641,   -242,  -3252,    110,  -1440,   2886,  -1467,
- -1155,  14395,    297,     52,    240,   3938,   9880,  -7555,
- -1214,   3351,    129,  -1269,   -168,    669,  13765,  -1289,
-  -465,  10017,   -632,   -328,   -276,    -33,     31,  18883,
-  -148,   -131,    525,   1669,   2288,   -203,    868,   -660,
-   248,   -409,    -91,    295,  -9174,  -1484,    929,   2824,
-  1097,  -3205,   -113,   2712,  -1544,    527,   1419,   -963,
-  -388,    691, -16791,    -84,     72,  -3802,   -357,   1633,
--15182,     62,  -6024,   -742,  -5396,   4470,   -198,      1,
-  1428,  -1691,  18715,   1402,  -2539,   -375,  -8455,   -901,
-  -147,  -3274,   9359,   -277,  -8941,    714,   2834,   2924,
- -6326,    907,   -123,  10487,   -484,  -4772,    877,   9840,
-  -505,  -7562,    301,    671,    116,   -371,   3740,    359,
-   385,  -5145,   -908,    156,   9639,   3782,  -9688,  -4214,
-  -945,  -7685,    334,   2185,  -1342,    388,  -1741,    278,
-  -231,   -912,    905,  -1039,    598,   2049,    662,   -198,
- 22378,    166,    116,  -1699,    335,  -8380,   1279,   1536,
- 14955,   1254,    190,  -2519,   -608,    364,   -561,   5748,
- -1178,   -923,   3183,    -59,  13880,  -2530,    241,   -564,
-  -319,  -7510,     -9,   -124, -20346,    305,    -25,   -400,
-   222, -16943,   -488,    802,  -1685,   3323,  -6198,   1000,
-  -903,   -846,   -387,    462,    847,    526,  10024,   2020,
-  2090,  -9563,   1416,    169, -12182,   -428,  10388,    869,
-  1068,   2201,  -1041,  -3180,    152,   -646,      4,   4017,
- -1069,    307,   5283,   3021, -13662,   -493,      9,    542,
-   152,  -2617,  -3870,   -514,  13497,   1180,   -603,   1255,
-  2396,   7418,   8902, -11165,  -2626,  -5719,   1764,    858,
-  1105,   1476,  -1764,   1969,    977,  -1738,   -928, -13940,
-  1444,  -4157,    836, -12243,   -369,   -256, -15681,   5320,
- -5170,   -509,    353,  -1581,  -1455,    965,    716,    209,
-  -883,   -317,  -1961,   9128,  -8197,   2173,  -2434,  -1126,
-  4066,   1025, -16663,  -7013,   -147,   1617,   -745,  -3205,
-  1496,   1822,  -1199,  -2999,    117,    619, -20002,   -232,
-   142,   3207,    561,   -292,  -1635,   1035,     37,   2712,
-  -243,  -8269,    305,  -2601,    495,  14516,    831,    260,
-   -54,   4217,    675,  -1632,   4962,    793,   1066,    133,
-  -344, -12428,     95,   6164,  -1298,  -1860,   3622,   -467,
-  -867,  -1178,  11053,    118,    -36,  -6997,   -763,  16019,
-    16,   2459,    306,   -820,  -1135,    847,   -709,    928,
-  -164,   -293,  -5736,    543, -11548,   5389,  -2012,    300,
-  -228,  -1043,   5107,   -558,   1187,   -140, -13034,  -1571,
-   740,  -4967,   -432,  -6289,  -1778,   3449,   -337, -12607,
-   344,  -3790,  -1598,   -274,   -346,  -1494,   -108,    325,
- -1215,    819,    404,   -568,   -286, -21364,  15495,  -2297,
-   606,    117,     10,   -193,   -972,   -292,   -573,  -1155,
- -1289,  -1025,    472,   1154,    843,    187,    586,  20569,
-    -5,   -236,  -1181,  -1092,    700,    891,   -603,   -601,
- 21648,   -449,   -193,  -1103,   -298,   2084,   -251,    449,
- -1414,  17168,   -391,    104,  -5465,    401,   8839,    781,
-  1741,    201,   -369,    466,  12358,   -636,   -945,   3928,
-  -605, -17445,   5020,  -1289,    977,  -6202,   1783,   -507,
-   -76,    267,    -31,  -2731,  -1560,  -1225,   1348,  11176,
-  1669,    754,   1671,  -4038,    151,   -371,   7283,    243,
-  1387,    126,   1007,   1292,    -15,    696,    282,  -2623,
-  1065,  -1026,    191,   -632,   -132, -12957,    -32,  -1697,
-  -422,   -240,   1352,  10252,   1067,   8296,  -1244,     -9,
-  -301,  -3014,   -249,   -372,  10731,    535,   2147,  -8959,
-   346,   -408,  -8329,  -1905,    -48,  -8176,   2782,    412,
-  1425,   -946,   -748,   1095,  -1370,   9086,    -99,   -143,
-    68,   -544,    264,    494,   -377,     13,   -618,    237,
-   193,   3549,    317,   -168,  -7148,   2351,   -244, -13240,
- -3355,  -2322,   -533,   9554,   6906,    124,   -694,   -901,
- -2762,    207,   -915,  -2520,   -143,   8544,   -678,  -2788,
- 12926,    791,   1296,   4861,  -1470,    889,   3675,    806,
-   290, -11146,    422,   9217,    -31,   1608,    140,   3939,
- -6903,   -276,   -704,   2353,   -344,  -1038,   -230,   -177,
-   670,   -617,   -129,   -857,  -8231,    638,   -411,   -252,
--15709,  -1218,    210,    288,    542,    533,  -9087, -10493,
-  -624,   1175,    611,   -230,    746,   1455,   -590,    830,
-  1756, -15800,    823,  -1077,    788,   1071,    468,  -1654,
-   660,    983,  -9697,  -1300,    662,   2053,   -281,  12949,
-   389,   -915,    197,  -1742,  -4587,   1746,    707,   1625,
-  9021,   2204,    759,   1303,   -428,   -220,     41,  -5499,
--16080,   -193,    443,    443,    -78,    889,   -561,   5629,
- -1073,   7019,    222,   1661,   1190,   1108,     94,   5624,
- -3796,    407,   -706,   -122,    744,    363,   1648, -10896,
-   595,    953,     85,   -267,    195,    851,  17173,   -636,
-   243,    907,   2029,   -700,    351,   1495,   -157,   -575,
--11664,   1252,   8341,   -616,   3708,   5693,     -6,  -1753,
-  1072,    863,   -823,  -4278, -12043,    750,    597,   3145,
-    38,  -8140,   3136,    290,      7,  11084,   -876,   1842,
-   175,   3458,    460,   1615,  11698,   -827,     16, -12482,
-   428,    411,   2625,  -1352,    142,    529,    229,    -48,
-  -965,   -145,   -592,    655,    499,  22095,  22141,     37,
- -1875,    701,     45,    724,   1111,   1631,    262,   -252,
- -9092,   5325,    408,   -637,   -612,    647,   1268,    834,
-  -510,    603,    199,    816,  -9904,   9533,  -1580,   2669,
-  1824,  -2092,   -701,   -271,   7489,     46,  -3295,   -844,
-  -304,   -226,   -260,   -692,     -5,   -527,     37,    -49,
- -1542,    -69,  -1087,  20519,    367,      1,   3487,   2535,
- -5110,    642,   1223,  -2130,  -2894,   1752,  -1618,   9732,
- -1633,   6904,    137,    654,   -358,    355,    -21,   -277,
-   -68,   -188,    132,    530,    372,   -315, -11498,    221,
-   815,   2480,  -1398,   -123,    353,   3114, -12025,  -1212,
- -1111,    916,   6452,  -1880,   1867,    307,    -66,   1857,
-   138,   -980,  -3088,   -174,    -41,   -393,   -656,    847,
- 15824,   -379,    358,    672,   -389,    920, -21145,   -393,
-   350,   -574,   1005,  -2083,     26,     79,   -203,  -7967,
- -3302,  -5805,    772,   -302,   2104,  -1240,  13710,   6816,
-  2282,  -3709,  -1512,    -81,  -2216,  -3005,    444,   -795,
-   751,   2163,  20751,    780,    542,   -480,    624,   -425,
-   769,   2474,  -5903,    399,  10564,   -112,     69,  -1409,
-  1885,   2339,     67,   -620,    196,  -2432,   6046,  -1673,
-  6512,    809,   7904,   -516,   4278,    223,    359,  16512,
-  1224,   -480,   -505,   -735,   -502,   -593,  -4565,   1914,
-   122,   -531,   1442,    464,     69,    292,    410,   -581,
--19848,   1059,    132,   1392,   5917,    705,  -7706,   2496,
- -1487,   -791,  11939,    185,   -265,  -2412,    630,  -8028,
-  1434,  10315,  -1541,  -3756,  -2403,  -1918,   1050,   8057,
-   234,  13546,    -92,  -2172,   -671,  11631,    103,    116,
-  -171,  -4604,   -267,   -602,     15,    454,   6859,  -2151,
- -8707,  -1664,     61,   2518,   -969,    903,   1209,  -1435,
- 13531,    590,    236,   -821,    598,   1186,  -7690,    134,
- -1005, -18177,   -148,    519,    900,    951,    406,  -3584,
-    47,   9439,   1418,   -797,  -3353,   -703,  -1798,  -1244,
-   291,  -2784,  14612,   2029,   -161,   1040,  -4130,   3064,
-  1721,  -2898,    269,   3367,   1379,  14359,   -690,   -655,
-  2010,  -4935,   -681,  -2606,  11651,    748,    101,  13593,
-   629,     28,   -540,   -854,   1405,    558,  -8785,  -1016,
--13043,    121,   -556,   4959,   1694,   -720,   -138,  -3897,
-   182,   1938,    844,    919,   -683,  12042,  -1101,   -155,
- -1375,  -1509,     11,    220,    821,  21721,   -367,   -634,
- -1468,   -174,   1002,  -1203,    318,  11672,  -2114,   2472,
- -1701,   5932,   -661,   1094,   2500,  -5609,    254,    437,
-  -911,  -1611,  -8005,    217,  -1139,   1321, -10713,  -2183,
-  1163,   -890,   -622,  12820,   1021, -13578,   1040,   3216,
-   592,    686,    737,  -2881,  -1693,   3995,   -455,   4666,
- -4124,  -9316,   2061,  10645,    271,    264,  -6829,    641,
-  2061,  -6683,   -512,   -747,  -9131,   2445,    343,  -9944,
- -2888,    607, -10855,    871,    418,    504,    936,   1079,
-   273,    400, -17752,   -391,  -1543,  -6193,   1482,    737,
-  2096,   -982,    167,    972,    336,   1063,  -1272,  -1602,
- -1907,      9,   -191, -15207,   -119,   4047,   1479,  -1405,
-   526, -18462,   -627,  -1996,  -1022,  -1544,    312,   7972,
-  -227,    797,  -5204,  -2160,    391,   -423,    257,   3836,
-   442,  -1931,     22,    143,   -203,    362,    -73,  15679,
-  -289,  -1445,    577,    858,  11408,  -1970,  -1022,   1550,
-   882,  -3699,  -2697,   3978,    600,     86,   3858,   8683,
- -7681,  -4856,   4051,  -1321,   -587,     46,   -499,   -354,
-  -655, -15717,     67,    490,  -2670,    474,  -1374,   5601,
-    60, -17615,   -808,     87,    367,    579,   1057,   1020,
-  -394,   1181,   -189, -10846,    763,   2635,    282,  -3279,
-  -866, -15257,   -449,    112, -15577,    227,    269,  13964,
- -1273,   1513,  -1487,    195,    319,   2527,   -286,  -5883,
- -5360,   -959,   2791,  -3335,   -945,  -1985,   -903, -11418,
-  8525,    669,   6106,    153,  -1169,  -1198,   -553,   7037,
-   528,  -4237,    717,   -214,   1824,  10108,    961,   9077,
-  1899,  10407,   -207,    -29,    355,  -6794,    111, -13627,
-  1361,  -3577,    291,   4534,   2209,  -1579,    109,    523,
-   456,  10990,     31,   -448,    385,   1481,      2,  15266,
-   798,   5759,    860, -16424,  -1315,   1631,   -456,   -977,
-  -180,  -2593,   1191,   5959,    -32,   8112,   -506,  -7766,
- -1871, -15310,    662,    196, -20401,    925,    446,  -2035,
-  -620,   -686,   -249,  -2517,    423,    703,    633,    828,
-  -182,    -37,   -406,   -149,    821, -22255,    652,    522
-},
-
-.shape16 = {
-  -786,    193, -15441,    200,   1050, -16545,    -41,    329,
-  -869,   -170,   -858,   2725,    217,    447,   2107,    -23,
-  -387, -10280,   -383,   -320,    387,  16012,    -79,   -967,
-  3528,  -2123,   -537,   -636,  -1761,    949,    100,    -17,
-  -446,    261,  22527,    331,     26,    -87,   -206,  -2292,
- -1178,   -164,    598,    147,    889, -14487,  -2823,  -1280,
- -1892,     33,  -1763,    993,   4807,   -953,   2181,   -588,
-    59,   -296,    218,    291,   -104,    495,  -1092,   2232,
--14904,   -983,  -2919,    795, -17207,  -2045,   2988,    597,
--10312,   -718,  -2196,  -5822,    847,   1304,   -757,  -4714,
-  -148,    831,   -734,    806,   4348,   -308,    244,    566,
-  2706,    604,   -748,   -864,   -568,   -219,   -128,   -688,
-  -218,    110, -29289,    482,     76,  -1447,   -142,   -417,
-  -253,   8124, -19775,    990,   4546,  -1012,  -8082,    133,
- -1612,  -2243,  -3788,   1568,  -2892,    852,  -1642,  -3479,
-   -23,   1300,   -564,  -1037,    249, -14533,    -43,    321,
-  -680,     10,   -417,  23426,    397,   -108,   1843,    180,
- 11976,  -9613,    353,   3768,    130,  -1035,   4340,    218,
-   596,   -224,   -779,  -1680,   1326,    152,   -971,  -9725,
-  -355,   5328,   -459,  16242,   -438,    926,   6210,   1912,
-   769,   2621,   -148,  -1008,    517,    341,  -3594,   -965,
- 11383,   -874, -16949,   1167,  -3371,  -1655,    586,   -132,
-  3990,   -770,    211,    246,    514,   -166,   -734,  30408,
-  -258,   -521,    -20,    339,    499,  -2572,   2110,    272,
-  1357,    123,   2841,   -320,    -31,   -444,   -501,    215,
-   -42,    595,    108,    484,   -223,    937,    475,    -72,
-  -319,     75,   -205,   -978,  -9155,    145,   2020,     -3,
-  2438,   4046,  -1281,   -875,   1532,   -598,  12288,    369,
- -2046,    343,   -778,   1769,  -2589,   -641,  17437,   1793,
-  -592,  -1954,  -1607,   6184,   3440,   -512,  -2710,  -1330,
-  -127,   8765,     83,   -243,   -315,    709,    256,   1176,
- -1198,   -463,    970,   -302,   -568,   -997,  -1022,    159,
- 11008,     27,  13074,   1523,  -3239,   2330,  -4808,   6115,
- -9933,   1449,   2153,  -3111,   1780,   -731,    121,   -881,
--14289,   -265,    566,   -611,   -253,  -2965,    250,   -105,
-   -66,   2570,  -1922,   2712,   1907,  -2025,   -454,    173,
-  1463,    -29, -31955,   -113,  -1751,  -3353,    254,   1001,
-  6781,    -29,   -639,  -1289,    288,    498, -21505,     48,
-   109,  -2151,   -223,   1360,  -3430,    658,  -4185,  -1706,
-  1244,   1899,    124,     12,    -35,    289,    382,    433,
-   261,   -131,     54,   -646,   -280,     86,    180,    153,
-  -169, -20242,    -95,    734,   -524,     77,    102,   8468,
-  -421,     29,     -3,     51,   1526,   -600,   -264,    355,
-  1949,   -985,   -291,    -86,  10212,   -789,   -393,   -182,
-   -51,    946, -16716,   -954,   1179,  -2745,   -509,  -4774,
-  -587,   -608,   7657,   -509,   -388,    987,    109,   -218,
--17579,   -524,   -467,  -1643,   -444,   1430,   2541,   -124,
-  1785,     27,   7905,    -73,  -3135,  -1241,   -254,  -2114,
-  1175,    780,    -50,   4055,    535,    438,     32,   -113,
-  -260,     81,   1102,    -59,  29188,    -48,    212,    -29,
-  -344,    559,    856,   -483,    608,    -40,  -1498,    112,
- 10374,   1198,   -434,   4053,   1286,    236,   1823,  16046,
-   592,   1583,     78,  -5243,   1311,    456,  -1342,   -546,
-  -353,  13289,   -333,   -529, -20859,    183,   -167,  -1368,
-  -338,   -690,   4248,   -205,   -666,   -634,  -1653,   1174,
-   234, -18622,    891,    284,  -2632,  -1516,    289,  11242,
-   727,    133,    284,   -323,  -1370,    908, -13169,   -412,
-  1155,    410,    610,  -3072,  -8220,   -637,    242,   -647,
- -2072,  16041,   2292,  -8009,    351,  -3137,  -3075,  -1051,
-  4569,    125,     23,   1281,   2487,    520,   -209,   -688,
-   205,  -1248,    246,   -601,    533, -12209,  -2298,    826,
- -2762,     45,  15123,    721,   1128,    798,   -676,    349,
-  -153,    263,     89,   -854,    -24,   -350,   -227,    157,
-   587,   -240,   -185,    663, -32328,   -148,   -204,  -2396,
-  -597,   -344,   8104,   -280,   -375,    264,    648,    741,
-  -290,   -321,    263,   -569,   -381,    167,   1757, -29636,
-    30,    393,    398,    590,   -242,     81,   1601,   3683,
-   787,   -336,    675,  -1080,   -713,    261,  18420,   1760,
-   609,  -4610,   -551,   2790,  19807,   1347,   -125,  -9412,
-  -261,    548,   1056,    179,   -917,   -181,  12637,   -267,
-   621, -11908,   1366,     76,   5875,   -742,    394,    155,
-  -370,   2481,     46, -15392,   -344,  -9750,  -1353,  -2242,
- -1685,  -1286,   2320,  -2176,  -1729,    705,  -1582,   1590,
-  1603,  21129,  -3555,   2192,   -883,   3438,    233,   1965,
-  -537,    399,  -4818,  -4085,    559,   -292,   1290,  -2700,
-    10,   -301,  -1865,    226,     52,  -1346,    306,    316,
--12281,   -525,    285,   9631,     -2,   -849,   1620,    128,
-   176,  -1021,   -473,   7929,   -133,   2459,    -33,  -1517,
--22047,  -2300,     98,  -3513,    334,   4617,   -193,  -1309,
- -1279,    738,   -443,     95,    406,    660,   -705,    -54,
-   -39,  26396,   -766,    249,  -2423,   7759,   -689,  -3909,
--17404,     65,   1849,    945,  15907,   1386,   -433,   -831,
- -6349,  -3919,   1870,   8096,    311,  15043,   1709,   -315,
-  1288,   7522,   -215,  -5072,   1246,  -1486,   3762,   4526,
-  1517,  -1936,   -543,   -263,    771, -10215,   -425,  -5098,
-    59,   -266,  -1012,   -380,  -2131,    630,    405,    665,
- -4550,   1403,      8,    -46,   -879,    398,   -532,   -185,
-  -286,    921,    -65,    378,    669,    174, -15280,     91,
-  -776,   8480,   2463,    184,   2065,   -666,   -561,   4122,
-   594,    732,   4007,   -852,    -71,    194,   -126,   1765,
- -1570,    968,   -257,   -288,    950,  27482,   -333,    370,
- -1429,    285,    558,  11245,   -135,    565,   1296,   -261,
-   -62,    600,   1455,   1457,    820,    357,  -1203,    169,
- 16611,   -893,    359,    231,    418,   -547,    -95,   3866,
-  -511,  -6344,   -205,    923,   -239, -16205,  -1619,    217,
- -3362,  -6342,  -1551,    649,   -492,    264,    -55,    170,
- 16992,    -91,    306,     43,  -2770,    582,  -1740,     77,
-  -882,    268,   -515,    -45,  -6093,     24,  -5596,   9034,
-   284,   3211,    846,   1158,  -1118,   -604,   -514,   1402,
-  -493,   -938,  -3892,    242,    643,   1421,   -434,   -406,
-  -102,    -88, -11733,    161,    518,    978,   1508,    248,
- -1036,   1407,   -396,    293,   1154,  -1435,    495,   8243,
-    20,   -845,  -5373,    659,   2366,  29148,    145,    603,
-  4088,   -251,  -2841,  -2526,  20682,  -1357,  -2454,    660,
-  -125,    347,  11772,   -113,   -357,  -2181,  -1234,   1908,
-  -432,  16555,   -248,    822,  15516,   -158,   -653,   1573,
-    93,  -2730,  -1111,    958,  -1550,  -1153,     17,    610,
-   781,   -372,  -1640,    144,   -135,  -1171,  22140,   -427,
-   -26,    690,   -800,  -1497,   -300,   5438,    390,  11304,
-  9253,   1098,   5564,     -9,   3856,    965,   2016, -12797,
-  1687,    915,   3687,    539,   2496,    702,  -1324,    -71,
--12955,   7456,   4626,   -848,  -1815,    831,   2151,   7921,
- -3000,    123,   1189,  -1489,    222,   4973,   1936,     54,
--10527,  -1238,  -1157,    628,  14112,  -2164,   1478,   -985,
- -4102,    635,    225,   -311,   -609,  -1015,    301,    507,
-   -85,    443,    186,   -552,   -711, -16988,  -1327,    220,
-   565,  -1673,   -543,  18633,    331,    127,   -342,     22,
-   -77,   -360,   -439,   -501,  -1848,  -1147,   -483,   1133,
-  -351,     41,    908,    502,   -658,    474,   -430, -11348,
-    -1,   -531,    451,    709,    227,   -978,    348,   -265,
-   269,   -376,   2511,   -188,   -111,   -387,    809,   1009,
-  1570,   -755, -11463,    667,   -895,    446,    276,    145,
-  -513,   -117,   -462,   -340,   1457,   -963,    191,   -788,
-  -150,   -979,   -507, -27540,    122,    368,    -73,  10051,
-  -465,    642,    507,  -6828,    241,  -5025,   1598,  -1174,
-  2373,  -2272,  -1910,   -108,     15,    166,      2,  10518,
-   933, -12716,    510,    778,   -424,    414,   4899,    759,
-   862,   -438,   -886,    457,    304,  23639,    136,   -203,
-   478,   -565,    244,   -541,   2419,   -773,   1107,   -217,
-  1579,  -1037,    476,    -97,    995,  17973,    161,  16466,
-  -178,   -718,  -1606,    947,   1991,   2266,   1249,   2708,
-  -611,   1424,   -142,    -53,     36,    509,  26159,   -144,
-   357,    -37,   -234,    587,    311,   -509,  -1639,   -332,
- -1618,   -382,    302,  -8657,    -68,    -30,    545, -12834,
-   158,    158,    135,    621,   -354,   -871,    451,   1220,
-   -31,      2, -13414,     60,      3,   -380,    541,    -44,
-   552,   -366,    155,   -462,     61,   -232, -15426,    317,
-   688,   1121,   2933,   7151,   -168,  -9167,  -2521,    745,
-  2792, -10448,    569,  -3823,    630,  -4626,    -95,   -416,
-   828,    259,     72,    171,    635,   -250,   -128,   -426,
-  -153,    260,   -771,    314,    235,     26,  32281,   -343,
-   751,  -1443,    324,   -684,   1900,  -1334,   2022,     30,
-  1073,  -2406,   2080,   -485,   -320,  15328,   -860,   -529,
--16444,   -219,   1736,   -149,   -160,   -828,   1089,    413,
-   241,   3720,    -90,    146,   1109,    243,   -321,   -256,
-   -68,     88,    -50,    571,   1179, -25030,    104,    929,
-    35,    529,    117, -13724,    734,  -1344,    456,   5586,
-  1566, -12573,   -840,  -1617,  -2494,   1791,   1901,   3066,
- -2159,   -414,  -3856,  -9894,  -1608,   -657,  15355,   -773,
- -9217,   -658,   -972,   4730,  -2986,  -3478,   -757,  -1416,
- -3702,  18089,    629,   7061,    124,   5843,    158,  19017,
- -2204,  -6976,   1629,  -5657,   1101,  -1859,  -1425,   -548,
- -1132,  -5043,   1074,   -592,   -196,   1902,  22705,  -1228,
-   214,   -685,  -2036,  -2368,   -315,   -914,    533,    218,
-  1091,   -627,   2031,  13922,    104,   -450,   4494,   -498,
-  -361,  24734,    623,   1029,   2437,  -1123,  -5092,  -6551,
-   438,  16562,    375, -13102,   -193,  -2004,   3556,    179,
-  1832,   2086,    798,   -534,   -195,  -7105,    796,   3969,
--12269,   1570,   4273,  -2692,   1240,  -2901,  -2045,  -2453,
-   372,    613,   -548,   -245,    687,    258,  -8964,  -1500,
- -1519,   -993,  17571,   -357,    916,  -1202,   1752,   2081,
-  -536,  -3185,  -1062,  19335,    721,  -9958,   1052,   -872,
-   248,  -3133,    456,   1641,    149,    -11,   2955,    310,
- -3178, -18823,    497,   -971,  -6587,  -1380,    351,    106,
-   -43,    607,  -4754,    213,   1030,   5377,   -804,  -2557,
-   850,   1081,   -706,   1325, -14922,   -794, -14060,  -1953,
-   891,  -3296,    329,   -510,  -1126,   1113,   1753,   -411,
-  1769,    429,   -185,  -1020,    194,   -106,  11470,   -591,
-  -272,    422,    337,    524,   -150,    822,     51,   -120,
-  7193,    802,    640,   -140,    -42,  28125,  -1020,    285,
-  -465,   3195,     69,    482,   -953,    262,  -7672,   -373,
-  5158,   5625,  -3003,    550,   5371,   5619,  -2200,   5392,
-  -804,    135,   1300,  -3610,    -23,   -433,  13503,    224,
-   911, -14421,   -502,  -2151,  -1667,  -1933,   2888,   -277,
-   547,   -989,   3115,    -32,   -680,   -164,    804,    412,
-    62,   -154,   -190,    156, -10938,   -360,    -88,    843,
-   328,   -773,   -267, -12668,    856,   1496,   -243,   -586,
-   736,  -2175,   -677,  -3069,   7480,  -1764,  -4024,  -2569,
-  1805,    194,  -6814,  -1135,   -237,   2682,   -156,   -890,
-  1285,    368,   1802,   -683,   -163,   1191, -13063,   -496,
-  -335,  17482,    746,    818,     48,  21419,   -598,  -1753,
- -1169,  -2135,     40,  -9114,    592,  -3912,   1980,   -264,
-  -304,   8138,   -185,    286,  -3024,     48,  -1630,    909,
-   661,   -662,  18085,    240,   -201,     69,    192,    305,
--22167,    692,  -1135,   -996,    398,    -74,  18553,   -958,
-  1223,  -5578,    508,   -352,   1234,   -450,    497,    780,
-    79,     51,   -221,    255,    -26,  13352,   -170,    231,
-   590,    169,   -733,   -812,    -65,   -219, -20939,    200,
-    35,   -177,   -454,    632,   -267,   -407,   -120,    623,
-  -176,   -664,    715,    -23,    318,    148,   1125,     16,
-   709, -21687,   -230,   -413,   1398,  -1235,   -283,   1615,
-   175,   -299,    349,    400,   -112,  21762,   -665,    364,
-  1089,   1303,    -54,    523,   -381,  -1312,     48,   -886,
- -1260,    408,    415,  -8349,   7115,    180,   -774,   3508,
-  -971,   -255,   -195,     81,  -2674,   -977,   -355,  -1500,
-   178,  -2081,  -4432,  -1014,    340,   5818,    138,   -106,
- 16917,   1203,    349,   3271,    961,    363,   6008,  -6043,
-  3736,   -730,  -4201,   -514,  -6131,    -68, -14935,  -1781,
- -3898,    -40, -18944,   -461,  -1694,  -1269,   -755,    -81,
-  2369,    484,    531,  14114,     85,     32, -10142,   -142,
-   600,  -2374,    375,    675,  -2663,    155,   -947,   6427,
- 11476,   1253,   5049,   1063,   2003,  -1608,   2463,  -2168,
- -1128,   1079,    383,   -996,    368,   1208,  -3554,   -959,
-  4596,  -1209,  -4154,   1270,   9365,  -2775,  -1751,    998,
--20023,   -347,   1505,    218,   -142,    342,   -128,   -523,
-  -159,     75,   -467,    257,   -133,   -142,    712,   -621,
-   428, -29584,     13,    402,   -455,    119,   -483,   1121,
-  -461,    960,    807,    -46,    297,  14856,    221,   -356,
-   221,  15037,  -4744,  -2555,    447,  -1418,   1464,   1391,
- -1404,  -5812,    512,  -2321,   9882,    242,  -2298,   -137,
-  -849,  -3182,   9394,   1412,   1052,   1369,   -904,   -494,
-  -231,   1113,   1087, -13317,    768,  -1178,  -3011,     24,
-   229,    164, -10170,    328,    308,   -591,    213,   -543,
-   -82,   -790,   -875,    794,   -558,  -7651,   -573,   1266,
- -2084,   2275,   -187,     97,    384, -11830,   -185,   -472,
-  1365,  11636,  -1405,    360,   -487,   -440,  -1820,   -349,
-  -293,    285,     25,   -139,   -415,   -540,   -108,   1136,
-  -673,    230,  19202,   -545,   -542,    919,   1221,   -518,
-   196, -21900,    795,    115,    -16,    459,   3339,   -347,
-  -346,   -186,   -695,   -267,   -714,    185,    266,  -1218,
-   120,   -249,    233,   -110, -30412,    285,    219,   2256,
-   536,   -442,    673,  -1487,   -477,    -60,  -1806,    183,
- -7195,   -577,   2230,  -7594,  -3230,     65,  22963,    111,
-   390,   7134,  -3716,  -5123,   -475,    -32,    -98,   -466,
-  -118,    -43,     74,  -1071,   -902,   1714,   4004,     26,
-    97,   1680,    423,    252,   9667,    550,    354,   -222,
-    19,   -224,   -807,    365,    593,    363,   -851,    -28,
-   553,    238,   -481,    769,    279,  18367,   -462,    286,
-  4825,   -141,    500,  20383,   1618,    -31,   -514,  -2484,
-  -327,  -8506,   -705,   -872,    530,  -9997,    -36,   -431,
-  2824,   3185,   1712,   -318,   9513, -10065,    614,   -503,
-   389,  12830,   -113,    -15,  -1007,   -523,  -1293,  -2102,
-  -543,  -1157,   -583,   1228,    262,   -674,  -1847,   -242,
-   299, -12025,    547,   -591,  -9173,    275,    412,   2493,
-   997,   1229,   1982,  27554,    245,    106,  -1320,   -153,
-  -423,   -955,   -449,    392,    824,    796,  -1181,   1640,
-  -884,    -70,   8789,  10021,  -1806,   1019,     90,   1494,
-  2071,   -911,  -1159,    212,   2207,   -994,  -2500,   -497,
-    92, -11544,   -398,   -774,   1474,     32,   -671,   -171,
- -1250,   -249,   1161,   -654,   -205,    -36,   1733,    763
-},
-
-.shape22_1 = {
-   987,     -6,   -621,   -220,  -2438,   -387,   -535,    -23,
-  -934,    -68,  -4985,    575,    483,   7243,  -1075,    917,
-  1739,  -1832,   -580,   1564,    131,   -180,  -1271,   3672,
-   161,   1040,   1737,   2719,   1101,   -185,  -1410,    221,
-  -422,  -8675,   -753,   -401,  -5388,     13,    762,   1378,
-  1113,   1768,   -177,   3397,   2162,    267,   2261,   -156,
-  1708,   -848,    -79,  -1819,  -3159,  -5548,   -745,   7208,
- -1039,   7555,   -134,   2661,  -2112,   2270,  -1991,    441,
- -6248,    246,    166,   2092,  -1402,   -242, -13600,   -539,
-   391,   2395,  11001,   -981,  10906,   -403,    823,   1647,
-  -294,     93,    504,  -5448,   1213,  -1849,  -3077,    790,
-  -841,  12812, -11266,  -1882,   -805,   -274,   1968,    -49,
-  1189,    -80,   -281,    -40,    409,   2423,    581,  -1362,
-   207,   -869,   -589,   3294,   -318,  -4592,   -476,   1014,
-  -135, -17999,   -194,    807,  -2946,   -222,     44,   -514,
- -4407,  -1201,   1155,   -235,     98,   4432,   -342,   2386,
-  1402,   -956,   3357,   1959,   4790,   -139,  -3494,  -4280,
-  -589,  -8422,    363,   -746,    640,   -360,  -1007,  -1100,
- -7989, -12630,   1006,  -1608,   -864,   -226,   -915,  -2032,
-  1274,    596,   1864,   1067,   1597,    460,  -2003,  -5560,
- -8020,   2354,    379,  -3151,     44,   7024,   -698,  -2901,
-  4976,    927,   1223,    -93,    172,    189,   6639,  -6082,
-  -726,   -524,  -3068,  -3802,     16,  -1039,   -105,   2333,
-  -350,   -306,   -379,   -832,   1282,     56,   3529,    562,
-  -603,   5954,    294,  -1265,   8045,  -3990,   -169,   -123,
- -3267,    572,   -879,   1562,  -1185,    799,  -9589,    407,
-  -590,     65,  -2848,    433,  -5547,    -19,   7180,  -7904,
-  -392,    323,   -448,  -4481,  -3773,  -5286,   1957,    226,
- -2040,   3292,   2987,  -1704,   2835,   -149,   1435,    823,
-  1775,  -2769,    146,    234,   -131,    -15,    268,     37,
-   139,     22,   -196,     91,  -3503,  -5421,     24,   -280,
-    58,    370,    655,   1412,    113,    306,  16404,   -234,
-   315,   -957,     72,  -1129,   1993, -18719,  -1415,   1349,
-  2340,    541,    313,  -1360,     31,   1441,    -78,  -9905,
-  -393,    367,   -712,  -2009,    372,   -297,   -123,    303,
-  -458,   -323,     46,   8701,  -1301,  -8768,    -43,   1818,
-   212,   -543,  -5077,  -8037,  -2536,    702,    792,   -381,
-  -272,   1941,   6320,  -1871, -13938,   -262,  -2063,    108,
-  -861,    485,   -440,    768,   5665,   -302,    305, -13784,
-  2889,   -127,    -94,    145,   1308,   7911,  -8376,   -643,
-  -596,   1357,   -943,   1329,    -84,    -62,   1651,    391,
- -2295,  -5456,   -357,  -4611,   1361,   3961,   -295,    642,
-  -698,   8614,   1613,   -526,   -120,   -205,     17, -20171,
-  1252,   -261,    535,  -1244,     92,   -315,    878,    380,
-   157,   3217,   -493,   -773,    513,   -510,  11304,   -899,
-   -27,    398,  -6386,    659,  -1001,  -2737, -13295,   1219,
- -1014,   -193,    445,  -2393,    344,    -25,   -599,  -2848,
-   884,     94,    -11,   -564,    -36,   9939,  -3530,    462,
-  -942,  10089,    824,   2994,   -293,     71,  10167,   -457,
-   711,   -964,  -2128,   2530,    160,  -2558,   2451,   1654,
- -3828,   1560,    879,  -1023,  -8354,    851,    -77,   -112,
- 19572,   2010,  -1077,  -1329,  -1282,   1277,    252,  -5622,
-  4617,     58,  -2315,   -459,  -1249,     92,    708,   -737,
- -3323,    182,   1557,   -657,    546,   -447,  19117,   1645,
-  -336,    -26,  -2041,   5926,   4746,  -1866,   3922,   2798,
-  5320,      7,    470,    842,    229,   -567,    742,  -3306,
-   659,   -871,   -226,  -2593,  -1003,  -1373,    595,   -768,
- 20658,    944,   1228,    279,  -1531,   -618,    361,  -4019,
-  -343,   -351,   7143,    293,     92,  -2713,   -269,    -30,
-  -332,   4093,    216,    239,   -563,   1943,   -944,  -2268,
-    70,   -209,    440,   1493,   -446,    491,   -362,     25,
-  -331,    433,  -1585,    173,   1126,  -3614,   -234,  -2649,
-  1181,   -641,   -160,   3727,   -841,  -2134,  -1396,  -5758,
-   -14,    364,  -4651,   1151,    194,  -5234,   5878,  -1348,
- -1388,   -233,   3810,   -860,   9479,    -24,  -6616,   1387,
-  -455,    447,   -224,  -2997,     12,   3502,    -73,    470,
- -9170,   1677,   -740,   -592,  -1638,    675,    -93, -17842,
-  1750,   -847,    993,  -2393,    -49,  -2029,   1940,    588,
-   475,  -3467,     55,   5087,   2989,    380,    915,  -2782,
-  2418,  11303,   1098,   1009,   1372,  -5780,   -303,   1451,
-   972,  -7433,   -571,   1661,     64,  10265,   1541,    -50,
-  -964,   -738,   -253,  -3105,   -695,   -546,   -775, -18971,
- -3094,  -2379,    738,   1625,    623,   1073,    782,    723,
- -3417,   -578,   -189,   4108,   1115,  -1222,  -9102,  -4736,
-   347,    946,    322,  -3699,    193, -15139,    367,    969,
-  -788,   -694,   -620,    -26,    -16,      4,   -478,  20792,
- -1175,   -231,   2566,  -1270,    162,    181,  -1451,  -5370,
- -2429,  -8910,  -3794,  -5807,  -1655,    248,   4432,   1393,
- -2451,  -2706,   -744,    687,    842,  -1281,   2960,  -2348,
-   153,  -1671,  -1433,  -1250,  -1096,   2501,  -5393,   4266,
- -1098,    880,  -1215,    817,   -443,  10053,    705,   -689,
- -2679,  -1205,  -3302,   -809,   -918,  -1005,    124,   -329,
-   108,    -52,  -5305,   -419,    128,  -8137,   1427,    387,
-  -235,  -2582,    190,   -173,  -1031,   2672,   -985,   3309,
- -5927,   7327,  -8463,     -2,   6035,    743,    552,    -14,
-  -580,    -68, -11886,    476,     61,   1172,   -529,   -988,
-   871,   -776,   -332,  20870,    384,   7795, -10830,    723,
-  1690,   -519,    962,    663,   1300,   -465,     47,  -3578,
-    56,  -8131,   2041,  -8524,  -1303,   6349,   1903,  -6726,
-  1156,   -224,   1286,  -2355,  -3415,    985,   -502,  -2474,
-    49,  -2789,  -3616,  -1707,   3363,   -140,   1702,  -1919,
--11518,   -404,     62,  -6933,  -1187,  10830,    132,    284,
-  -639,   1349,   2367,   -311,   -626,    745,   5660,   -152,
-  -121,  -5236,   -481,   5889,  -1263,  -8443,    -33,    936,
-   423,   -117,    111,  -1055,   -103,   -321,   1286,   -611,
-   777,    827,    422,   -162,  -6767,   -241,    289,   -441,
- -1344,   2706,  -1260,  -4649,   -847, -16107,   -263,  -1826,
-  -521,   -760,    942,    309,  -2692,  -4835,   -853,   -806,
-  -276,   -322,   5647,   1219,   -433,   -346,  -1171,  -1028,
-   191,   -406,    444,     33,    272,   3502,    475,  -2178,
-  1915,   -290,  -1037,    833,   -695,   -121,    415,    556,
-  1025,  -2268,    334,   2847,  -1768,   -389, -14034,  -3878,
-   836,   4605,  -1985,   -359,   1478,   -149,    823,   -926,
-  -828,    135,    469,   -645,   -328,    -94,   -178,   2820,
-   781,  -2361,  -5778,   1312,   3918,     -1,  -3654,   -942,
- -2495,    615,    210, -17006,   -396,   -445,    382,    563,
- -1738,     95,  -9107,   4869,    348,    527,   5688,   -145,
- -1195,  -2367,   -749,   -187,   6697,     27,    347,  12571,
-   -64,   -427,   3765,    824,  -1216,  -1126,   5997,    586,
-   110,   -294,   -240,   1646,   -186,   1360,    413,  -6459,
- -1535,  -3208,   -520,   -621,   8613,   1098,    -19,   -199,
--11446,   -657,   -353,    906,    678, -19375,   -126,   1688,
-   644,   1231,  -2151,   -742,    320,    -68, -12426,  -2750,
-  1483,  -1603,  -2639,   3028,   2662,   -140,   5405,   -917,
-  -407,    207,   9392,   -569,    931,   -124,    -82,   6370,
-   477, -12264,   1093,   3427,   -732,    -50,    232,    -67,
-   609,   1615,   -463,    583,   1808,   1499,   -509, -24431,
-   231,    -72,   -192,   -333,  -7554,   -342,  -9036,   -304,
-   136, -15450,   1333,  -1147,  -1488,  -1440,     75,     63,
-   747,    297,   -251,     30,   -301,  -1810,    -86,    544,
--10446,   1300,  10468,    218,  -2471,   1982,    423,   3046,
- -1112,   -657,   -104,  10671,    -46, -10953,  -6205,  -1275,
-  1972,    937,    -75,   -330,   -529,  -2581,   1510,  -1881,
- -1372,  -1725,  14541,   -560,   -884,    946,   -307,  -5031,
-  7798,   -190,    720,   1525,     29,    868,   1238,    372,
-  -462,   2467,  -2661,   2721,  -1514,    723,  -2782,   -494,
-   240,  -7147,    587,    751,   1613,  11054,   1074,    275,
-   972,   -970,     27,    -75,     24,     -9,    163,     88,
-    21,     87,    -78,   -743,   -128,  -2336,   -235,   -743,
- -3918,   -333,   1088,   -195,   -166,    782,   -119,  -3263,
-   604,   2155,   -258,  -1282,   -129,     43,  -5124,   -472,
-   685, -14243,  -1294,    -99,  -1922,   -284,   -422,  -1112,
- -3194,  -1977,   1448,   -419,  -7172,     20,    -70,   2102,
-     0,    278,   1882, -10005,   1612,   6020,     71,   -141,
-  1027,    -43,   -864,   -448, -21257,   -336,  -2090,   5207,
-   674,    722,   1030,   1367,   1963,   6057,    984,  -1087,
- -3690,     47,    -61,    104,    -81,    895,     22,    728,
-  -191,   3219,   5228,    -27,   -802,   1438,  -9026,  -1352,
-  -581,    912,   -664,    -23,   -522,   -912,    178,   -603,
-   571,    574,    406,    564,    175,   -405,  -2965,  -1072,
-  1749,   -957,   -402,   9431,   1649,   -409,    291,   5765,
-   808,   6754,    727,    -37,   -254,   1530,    213,   3253,
-   357,    371,     45,  -1276, -12432,   2799,  -1924,   -176,
- -1107,   -183,    198,   3662,     20,  -1166,   2507,  -3484
-},
-
-.shape22_2 = {
-  1688,   -307,   -590,    971,  -3616,  -1632,   -218,   1861,
- -1479,   -367,  -6584,    487,   -951,  10808,   -232,    444,
-    89,  -1216,  -1577,   1283,    249,     -3,  -3646,   2205,
- -1116,   2630,   2110,   3193,    270,   -189,     78,   -826,
-  1010, -10520,   -370,   1234,  -5604,   -262,   1277,   1440,
-  2225,   2466,    305,   2469,   -740,    120,   3184,   2125,
-  1185,  -3230,   1597,  -1670,  -8283,  -9857,   -129,   8932,
- -1355,   8755,    707,   -256,   -135,    423,   1543,   1782,
- -4875,    403,    373,   1570,   -183,    782,  -9617,  -2539,
-  1090,    523,   6929,  -1226,  10329,   -278,   -999,   -260,
- -1810,    666,   -463,  -6100,   2040,    256,    532,  -1475,
-   383,  13137, -10953,  -2226,  -1243,   1584,  -2348,   -809,
-  3602,   -816,    194,    480,     84,   2297,    344,  -5181,
- -6243,  -2616,   2093,   7112,  -2373,  -1346,    291,   -372,
-  -863, -16911,  -1878,    378,   -826,    579,    737,   -468,
- -2288,    264,    634,    108,   -254,   4717,  -1286,   2885,
-   986,  -4944,    -98,   2007,    991,  -2252,  -2887,  -6141,
-  -605, -10474,    896,      6,    235,   -407,    -70,    478,
- -8392, -10870,    575,   -672,    103,    320,   -179,   -229,
-   445,   -380,   1124,   3271,  -1327,   -275,   -239, -10381,
- -9102,   1361,     96,  -1255,   -277,   9316,   -415,  -2258,
-  8992,   -117,   1625,   -704,   -980,    752,   9133,  -8792,
-  -423,   -272,   -865,  -2285,    443,  -2014,  -2592,   3180,
-  1198,   2570,   3360,  -7090,   3311,    697,   2229,     46,
-  -472,   6984,   -140,   -780,  10391,  -1078,     48,   -564,
- -5073,   1576,   -826,   -483,    952,   1099, -11536,   -652,
-   375,    440,  -7319,   2646,  -2089,   2804,   3795,  -6704,
-   251,    811,  -1224,  -1976,  -4943,  -6671,    780,  -2856,
- -7907,   2447,   3755,   -135,   1127,    328,    553,   3450,
-   351,  -5054,     -5,   1077,    109,   -254,   -391,   -511,
-   404,    -61,    510,    395,  -6044,  -7454,    364,   -575,
-    65,   -410,  -1921,   -248,    128,    311,  17131,  -2135,
-  -563,   -884,   2356,  -3951,  -1176, -16695,  -1534,   1977,
-   626,   2478,   1554,  -1070,     38,   -551,    370, -11053,
-  -331,   1062,  -1385,  -1681,   1028,   3350,    239,    -76,
-  -156,     49,    397,   7060,  -2834,  -6527,     22,   1920,
-  -951,    356,  -7674,  -8903,   -120,    317,   -303,    160,
-   530,   4611,   1083,    514, -12207,   -283,   1413,   -848,
-  -645,   -432,      0,   -192,   4780,  -3485,  -1192, -10574,
-  1274,  -3057,    475,   -188,    183,   7865, -11214,   -268,
-   491,   1422,    -28,    149,    515,  -1651,    670,   -450,
-  -958,  -4288,    567,   -182,    668,   4069,   -213,  -1176,
-   148,   8854,   -151,    474,    599,   1297,    237, -19186,
-  2993,   -482,   -591,  -1322,     25,   -628,   -828,   -203,
- -1500,   5519,    -84,    723,  -1137,   1217,  13045,   -707,
-  -372,   -200,  -4142,   -790,    188,  -6760,  -8288,    766,
-   366,    444,   -517,  -2679,  -1470,    -61,    161,  -3734,
-  3053,   2012,    439,    627,    524,   5538,    549,   -473,
- -2244,   8399,  -6395,   5811,    851,     58,  11376,     -6,
-  -337,   -689,  -1510,   -690,   -388,  -3587,   2665,   3371,
- -1850,   -953,   -513,    581, -10296,    548,   1092,    565,
- 18045,    215,  -1486,  -1270,    450,   -880,    407,  -6547,
-  8393,    206,   -515,  -1565,   -219,  -1872,   1479,    382,
-  -569,  -5002,  -1247,    -45,   -740,  -1791,  17177,  -1210,
-   761,    132,  -1627,   4970,   5563,    722,   5614,    430,
-  5659,    139,   1193,   1513,   1144,  -1319,    561,  -5145,
-  1010,    199,    656,  -3958,   3544,  -1758,    810,  -1578,
- 15976,   -139,  -1035,   -416,   -543,   -418,   2824,  -6541,
-    94,   -673,  11741,    426,    -15,  -5280,    780,   1795,
- -4616,   8192,   -297,   -206,    883,   2369,   -395,  -4266,
- -3120,   -199,    985,   1240,    352,    232,   -170,    176,
-   413,   -495,  -1399,    754,    618,  -6103,   -179,  -2546,
-   965,  -1362,   -806,    838,  -3912,  -1346,  -3135,   -937,
-   219,    307,  -3509,   1210,   2381,  -7923,   6358,   -885,
-  2902,    284,   2560,   1789,   6878,      6,  -4418,  -2206,
- -1091,   1840,   -118,  -2659,   1008,   2192,   1651,   1363,
- -7772,   1252,  -1200,    133,   -757,    501,    -98, -17197,
-    98,   -543,   1743,    621,   -809,  -1950,   -793,   1168,
-  -743,  -7124,    166,   7875,  -4466,    356,  -1430,   -467,
-  8589,   9931,    520,   -866,   1945,   -599,   -434,    113,
-   589,  -3456,    597,   6076,   1114,   9660,   1532,   2073,
-  -138,   -721,  -1030,  -1309,    625,  -4040,   1211, -18836,
- -3963,  -4468,    197,    600,  -1004,   -816,   -560,   -476,
- -2160,     -2,     26,   8162,   1057,   -178, -11739,  -1882,
-  1000,   -227,    109,  -1852,  -1163, -17143,    140,   -718,
- -1150,     33,   1397,    -45,   -205,    153,  -1494,  20509,
-   -51,   -904,   -599,   1915,    884,    504,  -1819,  -4487,
-  1252,  -1259,  -2200,  -5601,   -448,   -686,   5778,    873,
- -4282,   -533,    295,   -450,   1422,   2393,   3267,  -3911,
-   249,  -3605,  -3190,  -1096,  -2422,    274,  -1918,   4070,
-  -206,   -432,   1919,   -645,   -275,  12954,    311,   1479,
- -2664,   -852,  -4809,   1102,   -375,     20,   1659,  -1179,
-  1199,     44,  -5590,  -1112,   -566, -11369,   -125,   -871,
-   158,   1208,    265,   -519,   -405,   2439,  -1129,   1827,
- -9461,   8548,  -1606,    380,   4924,    662,   1314,   -391,
- -2024,    827, -13381,   -198,   -142,   1600,   3329,    125,
-  -672,   -220,    557,  18642,     60,   7296, -10472,   -712,
-  1188,    808,     64,    479,    555,    264,    394,   -611,
-  -810,  -7943,   -235,  -6889,  -1575,   1320,   -381,  -7414,
-  1740,   -744,    369,   -626,  -6899,  -2144,   -593,    668,
-  -351,  -3756,  -5143,  -1814,    806,   -475,    588,   -507,
- -9088,   -629,    154,  -6945,  -1105,  10658,   -435,    384,
-  -757,   1183,   3806,   -747,   -378,    535,  10224,    626,
-  -866,  -1931,  -1484,   5818,   -750,  -9628,   -250,    589,
-  -653,   -198,    104,   -934,   1207,     46,    960,  -1032,
-  4236,   4471,  -2896,   1551,  -7714,  -1921,    746,   -671,
-  5114,   5482,   -522,  -3344,  -1905,  -9220,   -663,  -1355,
-  -611,     65,   1368,    628,  -1276,  -6780,  -2623,   -661,
-  -117,   -437,   5507,   3205,    928,    537,  -9487,     80,
-  -102,   -538,   -277,    863,  -1421,   6054,   1227,    696,
-  3582,   -508,  -1757,    145,  -1705,  -1201,   4157,  -3314,
-  2291,   -834,    821,    552,   -724,    513,  -9730,  -8944,
-  1913,    501,   -216,    716,   2766,   -823,   2535,    314,
-  1774,  -3372,    235,    244,  -1216,   -710,    689,   6736,
-   -52,    218,  -8382,   -444,    920,    569,  -4890,  -2050,
-  -612,   1708,   -481, -15500,  -2878,   -691,    538,   -125,
-   -81,   -862, -10094,  12050,  -1392,   -326,    133,     61,
-   -50,    715,  -6662,   -673,  10745,   -596,     44,   3906,
-   247,   -745,   4950,   -210,    497,  -1875,   8197,   2141,
-  1454,    -23,  -1480,   2184,   -804,   5515,  -1311,  -8893,
- -2880,  -3606,   -282,   -116,   8084,    618,   -403,   1106,
--14405,   1159,    229,    742,   -184, -19445,   -329,   -747,
- -1240,   1487,  -1670,   -839,    -77,   -882, -10986,  -2851,
-   -24,   -747,  -3615,   1939,   1389,    132,   5367,   1355,
-   408,  -1272,  11388,    153,   2708,  -1503,    169,   7357,
-    51, -13586,   -404,   -304,    626,    163,  -1814,   -515,
-   445,    589,  -1194,    770,    555,    246,   -165, -21192,
-   184,   -265,  -1116,   -485,  -8107,  -1992, -10805,   -880,
- -1455, -15154,   2312,  -1712,    -11,  -1899,   -400,     -2,
-   314,   -318,   -280,   -658,  -1066,  -2584,   1027,    801,
--11960,   1519,   8873,    465,  -3229,   1801,   -348,    749,
-     7,   1079,  -2051,  11521,   -831, -13425,  -6315,  -1135,
-  1088,   1056,    -46,  -1006,    374,  -5065,   1163,   -402,
-   -50,  -1459,   9586,    514,  -1439,   -638,   -155,  -5289,
-  8043,   -612,    739,   1084,    -60,    891,    786,     -6,
- -1078,   2097,  -5333,   3497,     23,   -913,   1303,    957,
-   -35,  -6418,   -146,   -971,   2738,   9695,  -1722,  -2002,
-   905,  -1749,   -917,    122,    379,   -325,   -455,    230,
-   825,   -137,   -335,    -96,   -160,    390,    731,  -2621,
- -5889,  -3949,   5138,    839,  -1190,    -66,    961,  -4600,
-  2345,   1607,  -2448,  -6653,   -592,   -106,  -7619,   -794,
- -1186, -12587,    -11,  -2224,   -225,  -2903,    534,   1355,
- -7002,    314,    494,   1950,  -8545,  -2531,  -2438,    -77,
-   886,  -1851,    944, -10156,   3003,   1846,   1919,   2019,
-   471,    451,   -436,  -1012, -20121,    275,     98,   1776,
-   578,     96,    -16,   1156,   3689,      7,   -207,    920,
-   105,    -58,   -175,    163,    697,   -407,    -61,   1261,
-  1297,   5061,   5326,  -1126,    516,   1208, -11108,    441,
-     7,   -899,    -19,   -368,    438,  -1911,    602,    716,
-   313,    853,   1448,   -817,  -1453,   1384,  -4371,   1043,
-  1884,   1619,   2196,  10075,  -1548,  -1201,   -796,   5228,
-  2657,   8244,   -605,    422,   -693,   3171,    657,   5438,
-  -171,    633,   1579,  -1718, -12265,   1083,   -976,   -293,
- -3802,   -306,   -668,   7818,  -1340,   -402,   2231,  -4472
-},
-
-.shape44 = {
-   -40,   -282,   1366,  -1173,  -3484,    355,  -1078,   3800,
-  4386,    -35,  -4192,    523,   1291,    678,    156,   2272,
- -1043,   1075,  -1849,   -314,   -522,    392,   2098,    -79,
-   473,   -275,      2,   6398,    451,     94,    173,   -431,
-  1115, -10788,     35,   1823,  -3380,    -97,    -98,   -350,
-   -23,  -1264,   -308,   8948,   -695,    -79,   3520,    308,
-   340,   -362,   -547,   1207,  -1182, -10392,   -148,   3580,
-   481,   -425,    862,   4894,    736,   -152,   -626,     23,
- -5853,     39,   -143,    418,   -103,  -1457, -12826,   -122,
-   283,   -225,  10561,   -153,   8872,   -806,    -51,     93,
-   420,   -209,    345,  -7661,   -732,    -48,    479,   -225,
-   276,  13385, -12578,  -1440,   -265,   -274,   1105,  -3376,
-  -691,   -579,   -972,    300,    349,    362,    722,   -472,
-   185,    814,     14,   4746,    761,   -336,   1691,    888,
- -1669, -18717,    827,  -2605,    921,    155,     68,    112,
- -3032,   -287,    414,    -86,    -62,   -213,   -106,    807,
-  -619,    598,   -178,   3104,   -481,  -1553,   1250,  -8363,
-  -686,  -9608,    116,    -47,    321,    -89,    939,    -35,
- -7995, -10159,   -526,    145,    363,   2170,   1077,  -1223,
-  -738,    120,   -408,   -390,    -80,   -404,  -1607, -10187,
- -6432,    961,     94,  -1459,    489,   6641,    372,   1007,
-  5958,   -834,    222,     51,    282,  -1005,   4473,  -8841,
-   -73,   -477,   -557,    121,   -165,  -1195,    438,    139,
-  -190,  -4205,  -4278,  -4617,  -7592,     40,   -422,   -459,
-   594,   7331,    164,    297,   2631,  -9075,    -78,    372,
- -6213,  -1053,    182,    -71,   -386,   -604, -11720,    552,
-  -617,    413,   1292,      4,   -485,   1162,   6051,  -5168,
-  -181,   1024,   -630,   -275,  -4067,  -8627,   1386,    970,
-  -423,   2973,   2360,    363,   -274,    410,     48,    768,
-  2958,   -427,     86,     64,   -128,   -273,   -182,   -292,
-   868,    463,     73,   -116,  -6509,  -5295,    -37,    691,
-   344,   -120,    168,    419,    494,  -1175,  18896,   -135,
-  -376,   -218,   -453,   -916,  -1040, -22179,   -846,  -1005,
-   264,    159,    597,   -952,   -825,    393,   -328, -14694,
-   371,   -263,    740,     38,  -1001,   1289,   -668,    187,
-  -155,    143,    683,   7133,   -563,  -8383,   -291,    176,
-    75,    613,  -6965, -11480,    324,   -490,    586,    416,
-   762,   5777,     64,    -47,  -4124,  -1196,   -113,    701,
-  -211,   2335,    130,    684,   7278,   -158,   -213,    297,
- 10845,  -1439,   -465,     17,   -792,   6499, -10187,   -444,
- -1416,    482,    636,   1472,    752,    157,   -334,  -3230,
-   -19,  -6747,    660,  -3082,   4057,   6801,    -19,    635,
-    19,   9807,    526,    126,    444,   -190,   -418, -26754,
-  -202,    243,    597,     10,    345,    814,   -330,    160,
-   344,   3986,    470,    459,   2387,   -549,  11889,  -1837,
-   -30,   2608,    615,   2301,   -771,  -1589,  -6935,   1321,
-  4287,    295,   -558,  -1503,   -611,   2104,    411,   -218,
-  1145,   -426,     58,   -102,     13,   7499,    476,  -4032,
- -2237,  -2658,  -1943,   5268,   1039,    389,   7091,    -22,
-   156,   -186,   2432,   -878,    305,  -1726,   3209,    361,
- -1030,    505,    618,   -262,  -1877,    268,    757,     24,
- 24306,    102,    973,    142,   -953,  -1199,    116,   -255,
-  5370,   -347,   -365,    937,  -6939,  -1189,   -760,    531,
- -1759,   -705,   -557,   -620,   1151,    250,  21629,  -1532,
-  -128,   1421,   -211,    592,   5126,    197,   -716,   1113,
-  5844,   -266,    -12,   -813,     85,    994,  -2106,  -3915,
-  1402,    533,    521,   -883,     87,   -386,     -2,  -4350,
- 19790,   -180,   -363,     60,    101,  -1717,    119,   -381,
-   100,   -565,   3264,   3052,    200,  -7319,     26,    347,
-  -482,  10609,   -766,    526,   -623,   3495,    339,  -4406,
-   -59,   -213,    686,   -603,    133,     99,     48,   1716,
- -1214,   1397,  -2396,   -384,   -901,  -3750,   -660,  -4314,
-   313,    192,    292,    259,   -644,    176,   2099,   7961,
-   -29,    642,  -2970,   1792,    -61,  -4348,    578,   1867,
- -1868,     32,   5262,    137,   6109,    443,   -176,    351,
-   400,   1874,   -175,  -4065,    697,    292,   -744,    121,
- -5134,   6996,   -198,    628,   1073,   -599,   -116, -17900,
-   647,  -1049,   -663,   1427,    -94,    721,    311,    337,
-  1376,  -2784,   3947,   1342,   1577,   -406,   -260, -10228,
-   109,   2358,   2437,    346,   1261,   -308,  -2094,   1682,
-   144,   -675,    183,    428,   -950,   1249,  -1546,     33,
-  -254,    681,  -1264,   -964,   -310,    838,    100, -21952,
- -1484,  -1564,    339,    298,     67,   -338,     89,    709,
-    53,    258,   -359,   2803,   1553,   -312,  -7993,  -1627,
-  1189,    476,   -123,    336,   -767, -18522,    589,    942,
-  -645,   -381,  -1913,   -582,     55,   -876,   -509,  25143,
-   690,   -787,  -1136,    114,    162,    342,   -231,  -8742,
-    99,   -646,   -474,  -1384,   -110,    -98,   8634,    -14,
- -9676,   -312,    358,    496,   -676,    -97,   1904,  -2124,
-   -66,  -1868,    502,   -513,  -3244,   2079,  -1476,   5440,
-   -40,   -381,    500,   -238,   -471,  12160,    248,  -1005,
- -2886,    173,  -3369,   -355,   -256,   -117,   -474,  -1282,
-  -355,    130,  -4833,     31,   -232, -12931,   -826,    322,
-   839,   1537,     73,    226,  -1888,   -483,  -2848,   -190,
-  1271,   3597,  -4514,    -38,   6093,    347,    -68,   -415,
-  -105,  -1664, -11461,   -110,   -399,    389,   -511,    935,
-  -424,  -1708,  -1026,  23239,    298,   7363,  -9206,   -566,
-   259,   -412,  -1213,    335,    614,    928,    972,  -1919,
-  -407,    509,    303, -13762,   -524,  10360,   1318,  -2758,
-  2350,   -106,   -119,    -68,  -6155,   -255,   -448,    -34,
-   -64,  -4382,     47,    635,   -339,    406,   -447,   -445,
--10592,    233,    160,  -5515,  -1333,   6755,   -952,    172,
- -1260,   -294,   3480,   -352,   -231,    415,    482,   -498,
-  -191,  -2034,   7934,   7997,   -688,  -9503,    376,   -228,
-  -500,    222,  -1021,   -407,    261,    179,    622,   1217,
-  -443,   -763,   -508,   -719,  -4509,     91,    449,   -283,
-    91,    -39,    961, -10148,   1596,  -9161,   -327,    221,
-  -470,    676,     12,   1416,    984, -10988,  -5500,   -189,
-  -727,    226,   4691,    688,    759,    930,  -6444,   -114,
-  -539,   -526,    -21,  -1218,    650,   6088,    419,   6185,
- -1200,     84,  -1232,    -34,   -107,     60,   2248,    450,
-  1187,   1264,   -181,    857,   2235,  -2859, -13483,   -192,
-  -586,   -207,  -5569,    503,   3376,   1243,   -700,   2119,
- -2186,   -296,    896,    299,    177,    184,   1375,   2498,
-   161,    579,  -3683,    443,    -21,   -186,  -3474,    238,
-   274,    277,   -325,  -8325,   -223,    125,    191,    333,
-  -345,  -1391,  -7372,  11389,  -1055,   4066,  -1098,     87,
-  -203,    443,    363,   -959,  15395,   4016,   -254,   1611,
-  -168,  -1070,   2709,   -768,    506,  -1245,   5821,   2499,
-  1564,     27,     85,   1989,  -1092,    150,   -972,    660,
-   -33,    687,    545,  -1564,    720,   -196,    -52,  -1751,
--25380,  -1246,   -615,    391,   -512, -23289,    460,    360,
-   -85,   -723,   -250,   -163,    -48,   -921,  -3988,    425,
- -1268,  -1695,   3233,  -1093,  -1166,    198,   7602,     21,
-   354,    733,  12213,   -347,    532,   -427,     22,   2218,
-  -578,  -3382,   -474,   -625,     78,  -4546,    863,    -53,
-  -357,  -1529,   1014,    710,   1356,   -430,  -1633, -24823,
-    95,     26,    590,   -591,  -7833,  -1355,  -9771,   -502,
-  -907, -15433,    957,    463,     35,   -496,    294,   2129,
-  1274,   -160,    -83,    531,   -767,    285,    232,   5983,
- -6122,   1620,   4112,   -239,  -1733,    -46,  -1321,    467,
-   613,  -3747,  -2284,  13991,    373, -17357,   -219,    -80,
-  -210,   1462,     37,  -1692,    548,  -5845,    420,     54,
-  -350,   -285,   1981,    262,   -874,   2844,   -435,  -6305,
-  6449,     72,    631,    -94,     96,   -442,   1137,     89,
-   364,   3392,  -3512,   -387,   1055,    318,  -1111,  -6971,
-   344,  -9105,    -96,  -9362,    190,   -225,    370,    161,
-   -73,  -1830,    174,     48,   -518,  -3486,    137,   -235,
-   810,     23,     80,   -642,    -35,   -316,   -269,   -373,
- -2413,   -933,   2525,    267,   -508,   -200,    422,  -3470,
- -1273,    640,  -1956,    139,    394,  -1043, -11008,   -158,
- -1089,  -2023,    202,   -979,   -744,   -159,   -392,    -37,
- -1679,   2183,   1365,  -2883,  -4752,  -2255,    109,   1660,
-  -613,   -511,   1284,  -7331,    947,   7009,  -2072,   -321,
-  -936,   -551,   -875,    160, -27027,    654,    265,    164,
-   376,    726,   -149,   2813,    -94,   5728,    702,  -1118,
- -2555,    217,   -186,   -107,    146,    -83,    -62,   -196,
-   708,    146,   3729,   -416,    212,   -163,  -7861,    347,
-    83,  -1079,   -994,    271,  -1054,  -1647,    139,    -20,
-   354,   1298,  -3420,   1130,    161,    475,  -3913,    468,
-    23,    285,  -1699,   8234,   -947,    222,    260,   4276,
-  -341,   6387,     21,    490,  -1908,  -1654,    -60,   2471,
-   733,   -135,    109,  -1136, -14756,   4922,   1165,    149,
- -3976,    -66,   -594,   6181,   -110,    292,   1129,   -591
-},
-
-.lsp08 = {
- 0.2702,  0.5096,  0.6437,  0.7672,  0.9639,  1.0696,  1.2625,  1.5789,
- 1.9285,  2.2383,  2.5129,  2.8470,  0.1740,  0.3677,  0.6082,  0.8387,
- 1.1084,  1.3721,  1.6362,  1.8733,  2.0640,  2.3442,  2.6087,  2.8548,
- 0.1536,  0.3279,  0.5143,  0.6859,  0.9763,  1.2744,  1.5605,  1.8566,
- 2.1007,  2.3450,  2.6075,  2.8850,  0.2075,  0.4533,  0.7709,  1.0377,
- 1.2953,  1.5132,  1.7826,  2.0351,  2.2590,  2.4996,  2.6795,  2.8748,
- 0.1393,  0.2453,  0.3754,  0.5453,  0.8148,  1.1289,  1.4389,  1.7592,
- 2.0353,  2.3215,  2.5934,  2.8588,  0.1250,  0.3627,  0.7613,  1.1380,
- 1.4163,  1.5565,  1.6920,  1.8130,  1.8678,  2.0427,  2.4318,  2.8544,
- 0.2256,  0.4223,  0.6452,  0.8599,  1.0673,  1.3118,  1.5486,  1.8366,
- 2.0759,  2.3026,  2.5284,  2.8030,  0.2304,  0.4404,  0.6891,  0.8964,
- 1.1510,  1.4202,  1.6483,  1.8580,  2.1181,  2.3686,  2.6078,  2.9128,
- 0.2230,  0.3816,  0.5520,  0.6062,  0.7909,  1.0988,  1.4330,  1.7846,
- 2.0713,  2.3457,  2.6048,  2.8708,  0.2447,  0.5800,  0.8249,  0.9905,
- 1.1721,  1.3990,  1.6694,  1.9064,  2.1307,  2.4255,  2.6815,  2.9117,
- 0.1974,  0.3812,  0.5802,  0.7759,  0.9280,  1.1547,  1.4170,  1.6369,
- 1.8890,  2.2587,  2.5626,  2.8239,  0.1209,  0.2510,  0.4841,  0.8048,
- 1.1197,  1.3563,  1.6073,  1.8926,  2.1350,  2.3669,  2.6291,  2.8985,
- 0.2352,  0.4347,  0.6582,  0.8178,  0.9548,  1.1654,  1.4942,  1.8812,
- 2.1703,  2.3779,  2.6412,  2.8871,  0.2091,  0.4084,  0.6730,  0.9151,
- 1.1259,  1.3262,  1.5937,  1.8129,  2.0237,  2.3317,  2.5778,  2.8620,
- 0.1167,  0.2406,  0.4520,  0.7298,  0.9848,  1.2448,  1.5137,  1.7874,
- 2.0280,  2.3020,  2.5914,  2.8794,  0.3003,  0.4966,  0.6520,  0.8505,
- 1.1600,  1.3981,  1.5805,  1.8346,  2.0757,  2.3102,  2.5760,  2.8499,
- 0.2451,  0.4163,  0.5960,  0.7805,  0.9507,  1.2438,  1.5587,  1.8581,
- 2.0735,  2.3198,  2.5704,  2.8220,  0.3112,  0.5517,  0.7032,  0.8528,
- 1.1489,  1.4257,  1.6848,  1.9388,  2.1577,  2.4265,  2.6678,  2.9051,
- 0.2249,  0.3897,  0.5559,  0.7473,  1.0158,  1.3581,  1.6914,  1.9930,
- 2.1843,  2.3534,  2.5512,  2.8065,  0.2600,  0.4574,  0.7349,  0.9691,
- 1.1696,  1.3848,  1.6335,  1.9021,  2.1174,  2.3481,  2.5902,  2.8390,
- 0.2246,  0.3372,  0.4560,  0.5249,  0.7056,  1.0273,  1.3810,  1.7132,
- 1.9819,  2.2574,  2.5410,  2.8491,  0.1419,  0.4834,  0.8835,  1.1453,
- 1.2839,  1.4224,  1.5593,  1.7877,  2.1285,  2.4070,  2.6043,  2.8511,
- 0.1886,  0.3677,  0.5617,  0.8099,  1.1277,  1.3841,  1.5804,  1.8136,
- 2.0307,  2.2805,  2.5399,  2.8322,  0.2351,  0.4151,  0.6675,  0.8713,
- 1.0464,  1.3292,  1.6586,  1.9281,  2.1355,  2.3495,  2.6222,  2.8782,
- 0.2700,  0.4489,  0.6206,  0.7121,  0.7737,  0.9848,  1.3658,  1.7433,
- 2.0139,  2.2243,  2.4806,  2.8175,  0.2479,  0.4425,  0.6490,  0.8745,
- 1.1161,  1.3849,  1.6773,  1.9566,  2.1491,  2.3624,  2.5685,  2.8114,
- 0.2035,  0.3701,  0.5567,  0.7953,  1.0082,  1.2758,  1.5373,  1.7822,
- 2.0175,  2.2601,  2.4759,  2.7771,  0.1856,  0.3461,  0.5998,  0.9041,
- 1.2383,  1.4612,  1.6667,  1.9305,  2.1617,  2.4107,  2.6477,  2.8656,
- 0.2107,  0.3715,  0.5289,  0.6651,  0.8420,  1.1168,  1.4401,  1.7230,
- 1.9901,  2.2687,  2.5452,  2.8655,  0.1218,  0.2999,  0.6348,  0.9482,
- 1.2745,  1.5876,  1.9129,  2.2348,  2.4020,  2.4922,  2.6351,  2.8357,
- 0.1617,  0.3483,  0.5869,  0.8163,  1.0366,  1.2344,  1.4609,  1.7029,
- 1.9476,  2.2337,  2.5258,  2.8442,  0.2505,  0.4894,  0.7510,  0.9152,
- 1.0845,  1.3657,  1.6528,  1.8346,  2.0160,  2.2811,  2.5338,  2.8136,
- 0.0947,  0.1158,  0.0578, -0.0337, -0.0066,  0.0104, -0.0447, -0.0505,
--0.0778, -0.0293,  0.0251, -0.0143,  0.0349, -0.0227, -0.0909,  0.0523,
- 0.0325, -0.0410, -0.1045, -0.0899, -0.0009,  0.0075, -0.0575, -0.0855,
--0.0129,  0.0575,  0.0597,  0.0391,  0.0371, -0.0184, -0.0083,  0.0287,
- 0.0143,  0.0167,  0.0120, -0.0168,  0.0452,  0.0223, -0.0352,  0.0119,
--0.0496, -0.0965, -0.0661, -0.0072,  0.1099,  0.0843, -0.0087, -0.0478,
--0.0128, -0.0120, -0.0004,  0.0731,  0.1047,  0.0630,  0.0196, -0.0103,
--0.0399, -0.0986, -0.0912, -0.0390, -0.0247, -0.0694, -0.0749, -0.0066,
- 0.0223,  0.0634,  0.0343, -0.0134,  0.0727,  0.0241,  0.0066,  0.0437,
- 0.0610,  0.0364,  0.0248, -0.0358, -0.0686, -0.0104,  0.0426,  0.0088,
--0.0137, -0.0165,  0.0671,  0.0815, -0.0863, -0.0644, -0.0088,  0.0023,
- 0.0482,  0.1174,  0.1270,  0.0594,  0.0165,  0.0949,  0.1098,  0.0137,
- 0.4951,  0.4999,  0.4958,  0.4907,  0.4984,  0.4965,  0.4958,  0.4996,
- 0.4987,  0.4958,  0.4986,  0.4977,  0.2841,  0.2186,  0.1474,  0.1687,
- 0.2217,  0.2632,  0.2706,  0.2624,  0.2162,  0.2453,  0.2460,  0.2531
-},
-
-.lsp11 = {
- 0.1103,  0.3862,  0.6863,  0.8447,  0.9231,  1.0261,  1.1248,  1.4057,
- 1.6621,  1.8010,  1.8692,  2.0704,  2.3490,  2.6060,  2.7539,  2.8977,
- 0.1273,  0.2407,  0.3812,  0.6004,  0.7767,  0.9383,  1.1344,  1.3351,
- 1.5233,  1.7262,  1.9466,  2.1739,  2.3495,  2.5162,  2.7164,  2.9202,
- 0.2010,  0.3330,  0.4488,  0.6465,  0.8046,  0.9889,  1.1479,  1.2964,
- 1.4770,  1.6606,  1.8789,  2.1155,  2.3287,  2.5199,  2.7101,  2.9119,
- 0.1168,  0.2197,  0.3279,  0.4691,  0.6268,  0.8251,  1.0533,  1.2714,
- 1.4712,  1.6762,  1.8831,  2.1114,  2.3230,  2.5297,  2.7365,  2.9270,
- 0.1405,  0.3109,  0.4986,  0.6891,  0.8634,  1.0583,  1.2594,  1.4349,
- 1.6232,  1.8116,  1.9905,  2.1935,  2.3799,  2.5656,  2.7661,  2.9486,
- 0.1703,  0.3057,  0.4403,  0.5225,  0.5969,  0.8110,  1.0729,  1.3215,
- 1.5407,  1.7381,  1.9477,  2.1680,  2.3586,  2.5612,  2.7630,  2.9410,
- 0.1128,  0.2628,  0.4523,  0.6495,  0.8176,  0.9816,  1.1746,  1.3710,
- 1.5568,  1.7518,  1.9497,  2.1452,  2.3346,  2.5389,  2.7362,  2.9264,
- 0.1809,  0.3287,  0.5205,  0.7264,  0.9298,  1.1217,  1.2970,  1.4894,
- 1.6874,  1.8493,  2.0576,  2.2382,  2.4097,  2.6041,  2.7796,  2.9389,
- 0.2502,  0.4709,  0.6892,  0.8346,  0.9209,  1.0455,  1.2399,  1.4616,
- 1.6463,  1.8380,  2.0475,  2.2397,  2.4665,  2.6550,  2.7701,  2.8895,
- 0.1040,  0.2340,  0.3964,  0.5740,  0.7764,  0.9941,  1.2000,  1.4014,
- 1.6024,  1.7974,  1.9939,  2.1959,  2.3783,  2.5663,  2.7613,  2.9484,
- 0.1912,  0.3393,  0.4743,  0.6313,  0.8014,  0.9879,  1.1855,  1.3922,
- 1.5678,  1.7289,  1.9271,  2.1165,  2.3089,  2.5414,  2.7448,  2.9269,
- 0.0965,  0.2025,  0.3398,  0.4990,  0.6934,  0.9386,  1.1730,  1.3766,
- 1.5783,  1.7783,  1.9790,  2.1831,  2.3670,  2.5578,  2.7641,  2.9516,
- 0.2126,  0.3652,  0.5545,  0.7170,  0.8674,  1.0640,  1.2558,  1.4061,
- 1.5904,  1.8095,  1.9760,  2.1505,  2.3549,  2.5575,  2.7023,  2.8877,
- 0.1827,  0.3426,  0.4894,  0.6488,  0.7960,  0.9535,  1.1217,  1.2798,
- 1.4566,  1.6453,  1.8044,  2.0042,  2.2379,  2.4611,  2.6697,  2.8966,
- 0.2034,  0.3822,  0.5231,  0.6960,  0.9200,  1.0394,  1.1616,  1.3772,
- 1.5493,  1.7330,  1.9646,  2.1233,  2.3334,  2.5361,  2.7087,  2.9470,
- 0.1050,  0.2060,  0.3705,  0.5998,  0.8337,  1.0577,  1.2559,  1.4327,
- 1.6334,  1.8165,  1.9853,  2.2058,  2.4063,  2.5818,  2.7625,  2.9458,
- 0.1419,  0.4053,  0.6660,  0.8911,  1.0405,  1.1547,  1.2506,  1.3926,
- 1.5669,  1.7527,  1.9694,  2.2054,  2.3889,  2.5743,  2.7586,  2.9174,
- 0.1514,  0.2825,  0.4309,  0.5772,  0.7470,  0.9703,  1.1462,  1.3316,
- 1.5321,  1.7259,  1.9282,  2.1266,  2.3106,  2.5064,  2.7067,  2.9094,
- 0.1693,  0.3156,  0.4878,  0.6635,  0.8206,  0.9569,  1.1154,  1.3064,
- 1.5109,  1.7184,  1.9179,  2.1036,  2.2763,  2.4820,  2.6949,  2.9105,
- 0.1432,  0.2718,  0.4241,  0.5564,  0.6939,  0.9011,  1.1582,  1.3948,
- 1.6181,  1.8024,  1.9814,  2.1740,  2.3459,  2.5456,  2.7491,  2.9307,
- 0.2294,  0.3857,  0.5590,  0.7434,  0.9189,  1.0941,  1.2740,  1.4456,
- 1.6178,  1.7994,  1.9689,  2.1644,  2.3525,  2.5385,  2.7468,  2.9405,
- 0.1667,  0.3109,  0.4612,  0.6032,  0.7375,  0.8866,  1.0840,  1.3053,
- 1.4982,  1.7044,  1.9146,  2.1117,  2.2942,  2.4983,  2.7084,  2.9132,
- 0.1810,  0.3205,  0.4696,  0.6231,  0.7641,  0.9959,  1.2427,  1.4361,
- 1.5889,  1.7544,  1.9083,  2.0733,  2.2457,  2.4461,  2.6793,  2.9098,
- 0.1164,  0.3753,  0.6068,  0.7503,  1.0100,  1.2131,  1.3793,  1.5302,
- 1.6300,  1.7950,  1.9057,  2.1031,  2.3830,  2.5745,  2.6949,  2.8779,
- 0.1571,  0.4378,  0.6735,  0.8312,  0.8944,  0.9818,  1.1622,  1.4094,
- 1.6423,  1.8066,  1.9258,  2.1838,  2.4363,  2.6279,  2.7358,  2.8790,
- 0.1398,  0.2686,  0.4248,  0.6156,  0.7870,  1.0035,  1.2012,  1.3689,
- 1.5363,  1.7398,  1.9604,  2.1619,  2.3345,  2.5097,  2.7271,  2.9368,
- 0.1913,  0.3338,  0.4987,  0.6446,  0.7852,  1.0163,  1.1886,  1.3610,
- 1.5379,  1.7230,  1.8880,  2.0862,  2.2960,  2.4928,  2.7122,  2.9151,
- 0.0908,  0.1752,  0.2899,  0.5365,  0.7761,  1.0100,  1.2124,  1.4060,
- 1.6019,  1.8010,  1.9774,  2.1905,  2.3733,  2.5623,  2.7660,  2.9565,
- 0.1773,  0.3179,  0.4925,  0.6864,  0.8452,  0.9897,  1.1860,  1.3722,
- 1.5515,  1.7658,  1.9802,  2.1819,  2.3620,  2.5442,  2.7250,  2.9220,
- 0.1286,  0.2341,  0.3689,  0.5364,  0.7176,  0.9350,  1.1083,  1.2943,
- 1.4974,  1.7059,  1.9047,  2.1145,  2.3242,  2.5361,  2.7453,  2.9329,
- 0.2273,  0.3834,  0.5565,  0.7192,  0.8431,  0.9962,  1.1763,  1.3571,
- 1.5774,  1.7419,  1.9202,  2.1131,  2.2919,  2.4898,  2.6895,  2.9180,
- 0.1775,  0.3058,  0.4274,  0.6023,  0.8151,  1.0734,  1.3211,  1.5178,
- 1.6706,  1.8154,  1.9686,  2.1537,  2.3461,  2.5276,  2.7181,  2.9121,
- 0.1653,  0.4304,  0.6361,  0.7824,  0.9183,  1.0452,  1.2071,  1.4077,
- 1.6206,  1.8299,  2.0089,  2.1948,  2.3900,  2.5982,  2.7844,  2.9487,
- 0.1492,  0.2609,  0.3820,  0.5485,  0.7243,  0.9319,  1.1538,  1.3579,
- 1.5266,  1.7002,  1.8873,  2.1016,  2.3175,  2.5221,  2.7241,  2.9243,
- 0.2074,  0.3781,  0.5209,  0.6869,  0.8577,  0.9875,  1.1849,  1.3568,
- 1.4907,  1.7335,  1.8902,  2.1224,  2.3099,  2.4918,  2.7023,  2.8765,
- 0.1359,  0.2254,  0.3286,  0.4432,  0.6586,  0.8964,  1.1125,  1.3523,
- 1.5626,  1.7579,  1.9846,  2.1905,  2.3548,  2.5542,  2.7663,  2.9346,
- 0.1430,  0.2966,  0.4685,  0.6493,  0.8315,  1.0304,  1.2220,  1.4082,
- 1.5995,  1.7888,  1.9774,  2.1737,  2.3607,  2.5577,  2.7558,  2.9405,
- 0.1477,  0.2694,  0.4056,  0.5626,  0.7051,  0.8647,  1.0491,  1.2488,
- 1.4814,  1.7072,  1.9150,  2.1147,  2.3038,  2.5144,  2.7184,  2.9202,
- 0.1690,  0.3033,  0.4580,  0.6686,  0.8536,  1.0293,  1.2124,  1.3998,
- 1.5718,  1.7607,  1.9580,  2.1245,  2.2971,  2.4762,  2.6896,  2.9177,
- 0.1092,  0.2779,  0.4853,  0.6880,  0.9011,  1.0953,  1.2752,  1.4618,
- 1.6623,  1.8484,  2.0264,  2.2152,  2.4017,  2.5835,  2.7671,  2.9436,
- 0.1497,  0.3637,  0.6014,  0.8032,  0.9963,  1.1835,  1.3741,  1.5698,
- 1.7382,  1.9094,  2.0710,  2.2392,  2.4082,  2.5926,  2.7762,  2.9536,
- 0.1434,  0.2492,  0.3966,  0.5934,  0.8033,  1.0657,  1.2796,  1.4276,
- 1.5745,  1.7833,  1.9288,  2.1247,  2.3543,  2.5412,  2.7049,  2.8872,
- 0.1612,  0.2926,  0.4574,  0.6387,  0.8265,  1.0180,  1.1808,  1.3526,
- 1.5564,  1.7536,  1.9187,  2.1192,  2.3149,  2.5006,  2.7101,  2.9217,
- 0.0828,  0.1863,  0.3235,  0.5050,  0.7250,  0.9867,  1.2093,  1.3941,
- 1.5980,  1.7932,  1.9809,  2.1894,  2.3918,  2.5773,  2.7540,  2.9329,
- 0.2001,  0.3655,  0.5290,  0.6761,  0.8027,  0.9972,  1.2090,  1.4255,
- 1.6085,  1.7825,  1.9804,  2.1681,  2.3457,  2.5325,  2.7319,  2.9196,
- 0.1505,  0.2767,  0.4254,  0.6054,  0.7821,  0.9567,  1.1294,  1.3080,
- 1.4984,  1.6954,  1.8666,  2.0736,  2.2875,  2.4969,  2.7072,  2.9163,
- 0.1589,  0.4151,  0.5749,  0.6651,  0.8061,  1.0470,  1.2616,  1.3690,
- 1.4985,  1.7808,  1.9825,  2.1068,  2.2751,  2.5448,  2.7133,  2.8689,
- 0.0916,  0.1846,  0.3788,  0.6329,  0.8774,  1.0687,  1.2653,  1.4561,
- 1.6573,  1.8449,  2.0402,  2.2254,  2.3968,  2.5861,  2.7792,  2.9508,
- 0.2282,  0.4159,  0.5834,  0.6899,  0.8108,  1.0321,  1.2795,  1.5262,
- 1.6936,  1.8469,  2.0922,  2.2607,  2.3795,  2.5301,  2.7386,  2.9530,
- 0.1651,  0.3004,  0.4555,  0.6179,  0.7891,  0.9584,  1.1372,  1.3707,
- 1.5951,  1.7880,  1.9434,  2.1465,  2.3311,  2.5081,  2.6977,  2.8970,
- 0.1279,  0.3828,  0.6330,  0.8323,  0.9652,  1.1175,  1.2319,  1.3511,
- 1.5115,  1.6392,  1.7835,  1.9558,  2.2008,  2.4635,  2.6910,  2.9058,
- 0.1193,  0.2185,  0.3521,  0.5311,  0.7378,  0.9239,  1.1105,  1.3217,
- 1.5362,  1.7504,  1.9536,  2.1627,  2.3560,  2.5506,  2.7548,  2.9453,
- 0.1806,  0.3432,  0.4981,  0.6948,  0.8928,  1.0527,  1.2467,  1.4140,
- 1.6326,  1.7950,  1.9935,  2.1969,  2.3512,  2.5682,  2.7445,  2.9277,
- 0.1846,  0.3112,  0.4568,  0.5891,  0.7317,  0.8493,  1.0204,  1.2022,
- 1.3688,  1.6020,  1.8428,  2.0710,  2.2725,  2.4879,  2.7057,  2.9160,
- 0.0880,  0.2514,  0.5332,  0.7272,  0.8906,  1.1354,  1.3199,  1.4941,
- 1.6010,  1.7151,  1.8712,  2.0643,  2.2755,  2.5375,  2.7054,  2.8891,
- 0.1382,  0.2833,  0.4658,  0.6897,  0.9071,  1.0716,  1.2469,  1.4143,
- 1.5910,  1.7947,  1.9805,  2.1581,  2.3338,  2.5215,  2.7292,  2.9211,
- 0.1061,  0.3494,  0.6327,  0.8570,  0.9748,  1.0560,  1.1529,  1.3250,
- 1.6032,  1.8340,  1.9711,  2.1157,  2.3011,  2.5464,  2.8078,  2.9803,
- 0.1603,  0.2839,  0.4307,  0.5980,  0.7980,  1.0399,  1.1971,  1.3524,
- 1.5715,  1.7838,  1.9468,  2.1498,  2.3627,  2.5514,  2.7327,  2.9148,
- 0.1691,  0.3117,  0.4796,  0.6895,  0.8732,  1.0164,  1.1916,  1.3707,
- 1.5384,  1.7202,  1.8857,  2.0672,  2.2487,  2.4593,  2.6789,  2.8940,
- 0.0965,  0.1702,  0.3191,  0.5721,  0.8100,  1.0241,  1.2272,  1.4196,
- 1.6093,  1.8057,  1.9884,  2.2037,  2.3925,  2.5805,  2.7578,  2.9366,
- 0.1950,  0.3519,  0.5272,  0.6973,  0.8732,  1.0656,  1.2112,  1.3959,
- 1.6116,  1.7821,  1.9445,  2.1592,  2.3348,  2.5142,  2.7440,  2.9297,
- 0.1388,  0.2557,  0.4120,  0.5727,  0.7354,  0.9196,  1.0985,  1.2805,
- 1.4643,  1.6535,  1.8340,  2.0546,  2.2758,  2.4778,  2.6921,  2.9122,
- 0.1823,  0.3336,  0.4957,  0.6771,  0.8563,  1.0137,  1.2299,  1.3849,
- 1.5718,  1.7667,  1.9193,  2.1326,  2.3135,  2.5268,  2.7133,  2.8998,
- 0.0790,  0.1901,  0.4083,  0.6456,  0.8463,  1.0285,  1.2297,  1.4181,
- 1.6159,  1.8056,  1.9971,  2.1912,  2.3816,  2.5746,  2.7692,  2.9497,
- 0.0049,  0.0116,  0.0045,  0.0039, -0.0010, -0.0122, -0.0205, -0.0034,
--0.0140, -0.0041,  0.0191, -0.0322,  0.0002, -0.0124, -0.0269,  0.0059,
- 0.0586,  0.0339, -0.0389, -0.0319, -0.0079, -0.0205, -0.0363, -0.0211,
- 0.0241,  0.0595,  0.0469,  0.0283,  0.0176, -0.0183, -0.0173, -0.0004,
- 0.0024,  0.0145,  0.0534,  0.0197, -0.0065, -0.0067,  0.0133,  0.0358,
--0.0104, -0.0386, -0.0109, -0.0078,  0.0275,  0.0565,  0.0251, -0.0027,
--0.0053,  0.0171,  0.0088,  0.0495,  0.0141,  0.0039, -0.0445, -0.0426,
--0.0184, -0.0280, -0.0223,  0.0039, -0.0171, -0.0606, -0.0786, -0.0430,
- 0.0544,  0.0595,  0.0320, -0.0012,  0.0108,  0.0185,  0.0066,  0.0408,
- 0.0552, -0.0073, -0.0247, -0.0480, -0.0288,  0.0186,  0.0212, -0.0013,
- 0.0403,  0.0598,  0.0690,  0.0516, -0.0298, -0.0177,  0.0278,  0.0168,
--0.0106,  0.0251,  0.0386,  0.0331, -0.0052,  0.0133,  0.0291, -0.0158,
--0.0329, -0.0367,  0.0287,  0.0462, -0.0176,  0.0049,  0.0242, -0.0034,
- 0.0135,  0.0086, -0.0149,  0.0241,  0.0504,  0.0246, -0.0273, -0.0369,
--0.0108, -0.0449, -0.0625, -0.0414, -0.0292, -0.0571, -0.0440, -0.0088,
- 0.0098,  0.0009, -0.0004,  0.0007, -0.0314, -0.0208, -0.0138, -0.0277,
--0.0044,  0.0522,  0.0315, -0.0270, -0.0277, -0.0256, -0.0103, -0.0201,
--0.0287, -0.0279, -0.0182,  0.0472,  0.0613,  0.0450,  0.0413,  0.0333,
- 0.0444,  0.0223,  0.0061,  0.0316,  0.0321,  0.0501,  0.0460,  0.0250,
- 0.0227,  0.0235,  0.0099,  0.0185, -0.0347, -0.0684, -0.0189,  0.0242,
--0.0190, -0.0273, -0.0012, -0.0253,  0.0293, -0.0231, -0.0219, -0.0010,
- 0.0153,  0.0128, -0.0166, -0.0435, -0.0417, -0.0121, -0.0351, -0.0390,
- 0.0077, -0.0278, -0.0355,  0.0092, -0.0063,  0.0005,  0.0216,  0.0461,
- 0.0538,  0.0451,  0.0298, -0.0130,  0.0058,  0.0206,  0.0471,  0.0499,
- 0.0280,  0.0086, -0.0007, -0.0317,  0.0259,  0.0176,  0.0043,  0.0212,
- 0.0138,  0.0106,  0.0220, -0.0025,  0.0050,  0.0122, -0.0051, -0.0086,
--0.0472, -0.0005,  0.0193,  0.0032,  0.0246,  0.0222,  0.0090, -0.0320,
--0.0713, -0.0526, -0.0151, -0.0440, -0.0648, -0.0466, -0.0092,  0.0115,
--0.0129,  0.0053, -0.0344, -0.0385,  0.0392,  0.0599,  0.0414,  0.0165,
--0.0098, -0.0320, -0.0261, -0.0055, -0.0139, -0.0110,  0.0084,  0.0172,
--0.0492, -0.0537, -0.0320, -0.0036,  0.0265,  0.0385,  0.0064, -0.0280,
--0.0230,  0.0134,  0.0241,  0.0106,  0.0387,  0.0105,  0.0068,  0.0260,
- 0.4940,  0.4911,  0.4849,  0.4820,  0.4837,  0.4839,  0.4824,  0.4799,
- 0.4812,  0.4782,  0.4788,  0.4711,  0.4706,  0.4671,  0.4601,  0.4578,
- 0.2954,  0.2121,  0.1859,  0.1958,  0.1474,  0.1086,  0.1351,  0.1362,
- 0.1486,  0.1342,  0.1215,  0.1423,  0.1634,  0.1588,  0.1539,  0.1857
-},
-
-.lsp16 = {
- 0.1813,  0.3911,  0.6301,  0.8012,  1.0057,  1.2041,  1.4271,  1.6943,
- 1.9402,  2.1733,  2.3521,  2.4989,  2.5839,  2.6846,  2.7634,  2.8950,
- 0.1311,  0.3183,  0.4659,  0.5601,  0.6658,  0.7828,  1.0065,  1.2717,
- 1.5185,  1.7339,  1.9530,  2.2189,  2.3739,  2.4991,  2.6984,  2.9256,
- 0.1627,  0.4519,  0.6323,  0.7012,  0.7848,  0.9801,  1.1810,  1.3222,
- 1.5413,  1.8129,  1.9338,  2.0809,  2.3180,  2.5189,  2.7066,  2.9514,
- 0.1475,  0.2447,  0.4240,  0.5669,  0.7872,  0.9838,  1.1823,  1.3814,
- 1.5358,  1.6820,  1.8794,  2.1419,  2.4132,  2.6112,  2.7911,  2.9511,
- 0.1224,  0.2876,  0.5013,  0.6985,  0.8902,  1.0901,  1.2835,  1.4768,
- 1.6596,  1.8538,  2.0467,  2.2304,  2.4124,  2.5942,  2.7729,  2.9531,
- 0.1741,  0.3034,  0.4677,  0.5879,  0.7258,  0.9648,  1.1417,  1.3220,
- 1.5081,  1.7151,  1.9212,  2.1286,  2.3208,  2.4938,  2.6765,  2.8891,
- 0.1657,  0.3174,  0.4907,  0.6559,  0.8295,  1.0254,  1.2071,  1.3880,
- 1.5737,  1.7845,  1.9027,  2.1139,  2.3323,  2.5157,  2.7323,  2.9015,
- 0.1592,  0.2758,  0.4417,  0.6315,  0.8257,  0.9873,  1.1277,  1.2830,
- 1.4337,  1.6315,  1.8899,  2.1356,  2.3572,  2.5632,  2.7468,  2.9420,
- 0.1524,  0.4325,  0.5931,  0.7036,  0.7696,  0.8923,  1.1739,  1.4773,
- 1.6609,  1.7911,  1.9666,  2.1972,  2.3754,  2.5045,  2.6613,  2.8882,
- 0.2130,  0.3013,  0.3721,  0.4257,  0.5079,  0.7015,  0.9815,  1.2554,
- 1.4648,  1.6966,  1.9138,  2.1075,  2.3318,  2.5292,  2.7453,  2.9347,
- 0.1142,  0.3748,  0.6205,  0.7642,  0.8121,  0.9022,  0.9843,  1.1558,
- 1.4467,  1.7422,  1.9574,  2.1302,  2.3812,  2.5898,  2.7720,  2.9583,
- 0.1255,  0.2339,  0.3570,  0.5323,  0.7458,  1.0003,  1.1729,  1.3567,
- 1.5217,  1.6977,  1.8924,  2.0942,  2.3145,  2.5408,  2.7553,  2.9337,
- 0.1316,  0.2289,  0.4327,  0.6663,  0.8509,  0.9994,  1.1697,  1.3804,
- 1.5609,  1.6903,  1.8572,  2.1019,  2.3687,  2.5789,  2.7715,  2.9472,
- 0.1502,  0.2546,  0.3883,  0.5333,  0.6976,  0.9163,  1.1071,  1.3364,
- 1.5420,  1.7525,  1.8948,  2.0839,  2.2819,  2.4651,  2.6875,  2.8987,
- 0.1593,  0.3014,  0.4573,  0.6354,  0.8157,  0.9805,  1.1783,  1.3747,
- 1.5678,  1.7326,  1.9286,  2.1340,  2.3253,  2.5280,  2.7180,  2.9298,
- 0.1811,  0.3167,  0.4655,  0.6507,  0.8198,  1.0075,  1.1892,  1.3743,
- 1.5227,  1.7090,  1.8849,  2.0743,  2.2750,  2.4830,  2.6896,  2.8953,
- 0.1846,  0.3577,  0.5315,  0.7290,  0.9176,  1.1016,  1.2654,  1.4525,
- 1.6315,  1.8268,  2.0238,  2.1934,  2.3868,  2.5753,  2.7682,  2.9469,
- 0.0876,  0.1439,  0.2048,  0.3654,  0.6281,  0.8853,  1.0907,  1.2992,
- 1.5227,  1.7373,  1.9395,  2.1419,  2.3488,  2.5486,  2.7466,  2.9348,
- 0.1391,  0.4170,  0.6561,  0.7953,  0.8734,  0.9986,  1.1870,  1.4520,
- 1.6042,  1.7910,  2.0135,  2.1870,  2.3358,  2.5066,  2.7409,  2.9955,
- 0.0804,  0.1355,  0.2599,  0.4998,  0.7408,  0.9474,  1.1276,  1.3428,
- 1.5556,  1.7712,  1.9699,  2.1535,  2.3605,  2.5548,  2.7489,  2.9325,
- 0.1304,  0.3087,  0.4979,  0.6584,  0.8414,  1.0329,  1.2244,  1.4189,
- 1.6118,  1.8200,  1.9985,  2.1893,  2.3915,  2.5794,  2.7647,  2.9344,
- 0.1895,  0.2849,  0.3705,  0.4126,  0.6265,  0.9207,  1.1774,  1.3762,
- 1.5757,  1.7728,  1.9568,  2.1662,  2.3615,  2.5575,  2.7561,  2.9416,
- 0.1800,  0.3078,  0.4805,  0.6796,  0.8503,  1.0046,  1.1703,  1.3269,
- 1.4862,  1.6502,  1.8454,  2.0873,  2.3175,  2.5356,  2.7516,  2.9469,
- 0.1950,  0.3233,  0.4568,  0.5940,  0.7589,  0.9978,  1.1701,  1.3383,
- 1.5017,  1.6565,  1.8243,  2.0605,  2.2938,  2.5147,  2.7419,  2.9396,
- 0.2531,  0.4391,  0.5790,  0.7170,  0.8998,  1.1430,  1.3577,  1.5326,
- 1.6328,  1.7627,  1.9726,  2.1762,  2.3563,  2.5478,  2.7385,  2.9067,
- 0.1805,  0.2788,  0.3591,  0.3881,  0.5441,  0.8055,  1.0766,  1.3165,
- 1.5316,  1.7508,  1.9477,  2.1374,  2.3438,  2.5484,  2.7501,  2.9410,
- 0.2044,  0.3671,  0.5396,  0.7042,  0.8582,  0.9831,  1.1261,  1.3194,
- 1.4769,  1.6979,  1.8717,  2.0463,  2.2620,  2.4739,  2.7054,  2.9208,
- 0.1048,  0.2175,  0.4206,  0.5923,  0.7483,  0.9400,  1.1356,  1.3799,
- 1.5958,  1.7320,  1.8984,  2.1296,  2.3594,  2.5492,  2.7387,  2.9305,
- 0.0842,  0.1729,  0.3951,  0.6447,  0.8688,  1.0605,  1.2472,  1.4330,
- 1.6232,  1.8144,  2.0216,  2.1915,  2.3878,  2.5763,  2.7685,  2.9464,
- 0.1461,  0.2593,  0.4105,  0.5677,  0.7328,  0.8919,  1.0484,  1.2302,
- 1.4386,  1.6635,  1.8873,  2.1024,  2.3116,  2.5268,  2.7273,  2.9269,
- 0.1503,  0.3108,  0.4756,  0.6731,  0.8600,  1.0233,  1.2115,  1.3971,
- 1.5915,  1.7892,  1.9517,  2.1603,  2.3487,  2.5460,  2.7308,  2.8998,
- 0.2163,  0.3669,  0.5125,  0.6709,  0.8143,  0.9930,  1.2095,  1.4205,
- 1.6176,  1.7112,  1.8398,  2.0896,  2.3513,  2.5290,  2.6667,  2.8960,
- 0.2133,  0.4382,  0.6287,  0.8702,  1.1088,  1.3749,  1.6062,  1.7446,
- 1.8333,  1.9122,  1.9614,  2.0669,  2.1789,  2.3449,  2.6038,  2.8849,
- 0.1598,  0.2719,  0.3877,  0.4815,  0.5926,  0.7795,  1.0449,  1.3045,
- 1.5210,  1.7391,  1.9462,  2.1397,  2.3553,  2.5458,  2.7540,  2.9392,
- 0.2918,  0.5607,  0.6801,  0.7404,  0.8285,  0.9431,  1.1579,  1.4080,
- 1.6332,  1.8472,  1.9738,  2.0771,  2.2890,  2.5178,  2.7445,  2.9830,
- 0.1664,  0.2842,  0.3965,  0.5463,  0.8162,  1.0346,  1.1849,  1.3446,
- 1.5122,  1.7563,  1.9960,  2.2002,  2.3796,  2.5689,  2.7712,  2.9550,
- 0.0911,  0.2397,  0.5052,  0.7868,  1.0299,  1.1311,  1.2244,  1.3333,
- 1.4395,  1.6790,  1.9369,  2.1717,  2.3689,  2.5538,  2.7340,  2.9326,
- 0.1647,  0.2931,  0.3836,  0.4978,  0.6255,  0.9243,  1.1339,  1.3001,
- 1.5269,  1.8010,  1.9715,  2.1419,  2.3784,  2.5503,  2.6719,  2.8745,
- 0.2440,  0.3802,  0.4756,  0.6613,  0.8627,  1.0292,  1.2291,  1.4060,
- 1.5198,  1.7354,  1.9044,  2.1010,  2.3147,  2.4996,  2.7171,  2.9041,
- 0.1590,  0.2876,  0.4572,  0.5996,  0.7713,  0.9490,  1.1205,  1.2815,
- 1.4516,  1.6385,  1.8179,  2.0457,  2.2759,  2.4785,  2.6861,  2.9080,
- 0.2297,  0.4309,  0.5712,  0.6717,  0.8138,  1.0463,  1.2492,  1.4560,
- 1.6796,  1.8458,  1.9642,  2.1452,  2.3636,  2.5395,  2.7456,  2.9495,
- 0.2975,  0.4678,  0.4996,  0.5809,  0.6279,  0.6884,  0.8606,  1.1386,
- 1.4412,  1.6876,  1.8760,  2.0932,  2.3178,  2.5166,  2.7345,  2.9280,
- 0.1278,  0.3737,  0.6004,  0.7069,  0.8147,  1.0180,  1.2581,  1.3812,
- 1.4855,  1.7268,  1.9970,  2.1258,  2.2936,  2.5702,  2.7563,  2.8983,
- 0.1314,  0.2508,  0.3999,  0.5680,  0.7424,  0.9367,  1.1286,  1.3175,
- 1.5336,  1.7404,  1.9317,  2.1404,  2.3514,  2.5562,  2.7510,  2.9402,
- 0.1043,  0.2367,  0.4293,  0.6376,  0.8160,  0.9836,  1.1779,  1.3850,
- 1.5835,  1.7875,  1.9765,  2.1593,  2.3654,  2.5577,  2.7465,  2.9398,
- 0.1529,  0.2515,  0.3454,  0.4374,  0.7011,  0.9015,  1.0744,  1.3532,
- 1.5699,  1.7545,  2.0021,  2.1259,  2.2278,  2.4546,  2.7264,  2.9425,
- 0.1429,  0.2808,  0.4395,  0.6334,  0.8069,  0.9705,  1.1520,  1.3250,
- 1.5109,  1.7285,  1.9356,  2.1469,  2.3479,  2.5554,  2.7512,  2.9348,
- 0.1625,  0.3022,  0.4756,  0.6315,  0.8032,  0.9924,  1.1596,  1.3204,
- 1.4994,  1.6929,  1.8955,  2.1090,  2.3025,  2.5018,  2.6908,  2.8980,
- 0.1692,  0.3427,  0.5228,  0.7756,  0.9688,  1.0950,  1.3056,  1.4360,
- 1.5675,  1.8049,  1.9376,  2.1151,  2.3407,  2.5012,  2.7192,  2.9258,
- 0.0474,  0.1251,  0.1939,  0.3841,  0.6501,  0.9231,  1.1153,  1.3240,
- 1.5478,  1.7599,  1.9651,  2.1510,  2.3645,  2.5552,  2.7542,  2.9393,
- 0.2196,  0.4656,  0.7492,  0.9922,  1.1678,  1.2489,  1.3112,  1.3657,
- 1.4223,  1.5302,  1.7212,  1.9996,  2.2523,  2.4844,  2.7036,  2.9145,
- 0.1128,  0.2368,  0.3704,  0.5476,  0.7723,  0.9968,  1.1930,  1.3992,
- 1.6013,  1.7957,  1.9888,  2.1857,  2.3825,  2.5705,  2.7616,  2.9434,
- 0.1341,  0.2768,  0.4510,  0.6359,  0.8332,  1.0335,  1.2004,  1.3952,
- 1.5762,  1.7681,  1.9815,  2.1735,  2.3657,  2.5552,  2.7514,  2.9498,
- 0.1247,  0.2559,  0.3516,  0.4726,  0.6861,  0.9483,  1.1852,  1.3858,
- 1.5851,  1.7815,  1.9778,  2.1737,  2.3729,  2.5664,  2.7620,  2.9429,
- 0.1988,  0.3320,  0.4777,  0.6737,  0.8425,  1.0265,  1.1694,  1.3655,
- 1.5463,  1.7135,  1.9385,  2.1650,  2.3529,  2.5367,  2.7545,  2.9585,
- 0.1376,  0.2620,  0.4273,  0.6169,  0.7755,  0.9441,  1.1169,  1.3157,
- 1.5179,  1.7020,  1.8931,  2.1059,  2.3112,  2.5136,  2.7169,  2.9198,
- 0.2112,  0.4385,  0.6091,  0.7618,  0.9553,  1.1543,  1.3445,  1.5396,
- 1.7153,  1.9192,  2.1263,  2.3593,  2.5958,  2.8171,  2.9394,  3.0409,
- 0.1347,  0.2099,  0.2646,  0.3453,  0.5266,  0.7869,  1.0513,  1.2795,
- 1.4880,  1.7181,  1.9294,  2.1332,  2.3362,  2.5442,  2.7433,  2.9362,
- 0.3141,  0.5935,  0.7517,  0.8313,  0.8568,  0.9570,  1.0250,  1.1275,
- 1.3422,  1.6303,  1.8577,  2.0705,  2.2957,  2.5095,  2.7244,  2.9262,
- 0.0962,  0.2116,  0.3961,  0.5641,  0.7122,  0.8883,  1.1023,  1.3481,
- 1.5623,  1.7554,  1.9618,  2.1675,  2.3706,  2.5556,  2.7430,  2.9337,
- 0.0898,  0.1510,  0.3060,  0.5820,  0.8221,  1.0388,  1.2261,  1.4289,
- 1.6054,  1.8103,  1.9941,  2.1844,  2.3742,  2.5711,  2.7632,  2.9474,
- 0.1326,  0.2316,  0.3761,  0.5177,  0.6782,  0.8761,  1.0952,  1.3175,
- 1.5078,  1.7034,  1.9051,  2.1245,  2.3424,  2.5484,  2.7444,  2.9389,
- 0.1740,  0.3293,  0.5174,  0.6824,  0.8394,  1.0372,  1.2046,  1.3723,
- 1.5656,  1.7444,  1.9442,  2.1386,  2.3139,  2.4960,  2.7071,  2.9297,
- 0.2304,  0.3775,  0.4865,  0.6182,  0.7842,  0.9208,  1.1151,  1.2843,
- 1.4641,  1.6988,  1.9209,  2.1260,  2.3099,  2.5229,  2.7414,  2.9276,
- 0.0094,  0.0261, -0.0037,  0.0041, -0.0092, -0.0044, -0.0232, -0.0073,
--0.0047, -0.0021,  0.0250, -0.0580, -0.0140, -0.0342, -0.0586,  0.0020,
- 0.0449,  0.0155, -0.0523, -0.0279,  0.0299, -0.0183, -0.0736, -0.0639,
--0.0017,  0.0336,  0.0209,  0.0046,  0.0077, -0.0148, -0.0114, -0.0120,
- 0.0115, -0.0050,  0.0445,  0.0048,  0.0188, -0.0137, -0.0080,  0.0239,
--0.0184, -0.0524, -0.0195, -0.0126,  0.0284,  0.0632,  0.0141, -0.0093,
--0.0096,  0.0196,  0.0230,  0.0379,  0.0308,  0.0237, -0.0224, -0.0600,
--0.0755, -0.1074, -0.0988, -0.0606, -0.1038, -0.1552, -0.1480, -0.0672,
- 0.0504,  0.0676,  0.0336, -0.0042,  0.0729,  0.1013,  0.0868,  0.0846,
- 0.0954,  0.0515, -0.0066, -0.0851, -0.0485,  0.0294,  0.0395,  0.0087,
- 0.0078,  0.0446,  0.0881,  0.0672, -0.0384, -0.0025,  0.0415,  0.0353,
- 0.0080,  0.0052,  0.0190,  0.0182,  0.0069,  0.0168,  0.0374,  0.0037,
--0.0292, -0.0429,  0.0302,  0.0681, -0.0233, -0.0238, -0.0003, -0.0043,
- 0.0054, -0.0029, -0.0149,  0.0642,  0.0622,  0.0341, -0.0232, -0.0461,
--0.0082, -0.0469, -0.0618, -0.0326, -0.0452, -0.0649, -0.0597, -0.0398,
--0.0318, -0.0116,  0.0011,  0.0009, -0.0384, -0.0384, -0.0156, -0.0260,
--0.0007,  0.0473,  0.0111, -0.0358, -0.0484, -0.0204, -0.0029, -0.0090,
--0.0285, -0.0495, -0.0376,  0.0917,  0.1192,  0.1026,  0.0745,  0.0397,
- 0.0463,  0.0253,  0.0025,  0.0465,  0.0100,  0.0488,  0.0416,  0.0223,
- 0.0263,  0.0072, -0.0053,  0.0595,  0.0060, -0.0518, -0.0316, -0.0043,
--0.0133, -0.0233, -0.0075, -0.0251,  0.0277, -0.0067, -0.0136, -0.0004,
- 0.0235,  0.0112, -0.0182, -0.0324, -0.0210, -0.0035, -0.0395, -0.0384,
- 0.0005, -0.0150, -0.0356,  0.0127, -0.0033, -0.0034,  0.0205,  0.0747,
- 0.1138,  0.1015,  0.0995, -0.0161, -0.0045,  0.0129,  0.0472,  0.0575,
- 0.0222,  0.0091,  0.0037, -0.0471,  0.0371,  0.0132,  0.0208,  0.0247,
- 0.0117,  0.0164,  0.0225,  0.0124, -0.0023,  0.0088, -0.0046,  0.0047,
--0.0393,  0.0018,  0.0148,  0.0020,  0.0044,  0.0165,  0.0229, -0.0208,
--0.0477, -0.0310, -0.0164, -0.0390, -0.0764, -0.0525, -0.0094,  0.0075,
--0.0102, -0.0045, -0.0504, -0.0709,  0.0822,  0.0710,  0.0426,  0.0014,
--0.0371, -0.0400, -0.0157, -0.0155, -0.0173, -0.0138, -0.0015,  0.0134,
--0.0418, -0.0682, -0.0256,  0.0050,  0.0360,  0.0354,  0.0074, -0.0396,
--0.0235,  0.0284,  0.0494,  0.0153,  0.0448,  0.0025, -0.0061,  0.0252,
- 0.1000,  0.2260,  0.2158,  0.2116,  0.2198,  0.2055,  0.2110,  0.1873,
- 0.1907,  0.2071,  0.2164,  0.2009,  0.2059,  0.2124,  0.2141,  0.2093,
- 0.0875,  0.0981,  0.1177,  0.1071,  0.1033,  0.1248,  0.1048,  0.1238,
- 0.1166,  0.1008,  0.1062,  0.0992,  0.0994,  0.1067,  0.0999,  0.1187,
- 0.0750,  0.0794,  0.0828,  0.0854,  0.0859,  0.0801,  0.0891,  0.0933,
- 0.0969,  0.0920,  0.0915,  0.0862,  0.0868,  0.0891,  0.0842,  0.0824,
- 0.0625,  0.0930,  0.0815,  0.0853,  0.0898,  0.0828,  0.0822,  0.0910,
- 0.0873,  0.0906,  0.0856,  0.0840,  0.0774,  0.0785,  0.0684,  0.0711,
- 0.3319,  0.4219,  0.4588,  0.4090,  0.4092,  0.4014,  0.3548,  0.3353,
- 0.3708,  0.3352,  0.3720,  0.3538,  0.4084,  0.4289,  0.4060,  0.4210,
- 0.0588,  0.0209, -0.0082, -0.0115, -0.0343, -0.0621, -0.0541, -0.0346,
--0.0346, -0.0366, -0.0220, -0.0265, -0.0102,  0.0374,  0.0306,  0.0404,
- 0.0306,  0.0090, -0.0054,  0.0333,  0.0047,  0.0238,  0.0141,  0.0165,
- 0.0306,  0.0420,  0.0159,  0.0124,  0.0414,  0.0158, -0.0237,  0.0141,
- 0.0765,  0.0057, -0.0260, -0.0426, -0.0395, -0.0126, -0.0579, -0.0417
-},
-
-.lsp22_1 = {
- 0.0664,  0.1875,  0.4300,  0.6730,  0.8793,  1.0640,  1.2563,  1.4433,
- 1.6394,  1.8176,  2.0029,  2.1921,  2.3796,  2.5671,  2.7595,  2.9536,
- 0.2128,  0.4052,  0.5311,  0.6404,  0.7875,  0.8775,  1.0974,  1.3261,
- 1.5563,  1.6790,  1.8339,  2.1195,  2.3226,  2.4609,  2.6440,  2.8947,
- 0.2024,  0.3362,  0.4834,  0.6784,  0.9088,  1.0850,  1.2188,  1.4054,
- 1.6102,  1.7767,  1.9679,  2.1436,  2.3445,  2.5467,  2.7429,  2.9320,
- 0.1181,  0.2279,  0.4413,  0.6114,  0.7710,  0.9427,  1.1142,  1.2707,
- 1.4892,  1.7416,  1.9526,  2.1466,  2.3629,  2.5445,  2.7293,  2.9205,
- 0.1155,  0.2720,  0.4886,  0.6812,  0.8594,  1.0422,  1.2315,  1.4116,
- 1.6137,  1.8020,  1.9758,  2.1743,  2.3602,  2.5568,  2.7472,  2.9374,
- 0.1110,  0.3312,  0.4735,  0.5612,  0.7129,  0.8146,  1.0233,  1.3155,
- 1.5765,  1.7746,  1.9574,  2.1416,  2.3220,  2.5384,  2.7334,  2.9318,
- 0.1656,  0.3350,  0.4215,  0.5609,  0.6759,  0.8503,  1.1405,  1.4094,
- 1.6057,  1.6860,  1.7639,  2.0031,  2.2680,  2.5076,  2.7263,  2.9368,
- 0.1466,  0.3638,  0.4587,  0.5674,  0.7381,  0.8669,  0.9619,  1.1658,
- 1.4667,  1.7440,  1.9335,  2.1018,  2.3022,  2.5281,  2.7359,  2.9261,
- 0.1061,  0.2566,  0.4739,  0.6751,  0.8711,  1.0704,  1.2720,  1.4655,
- 1.6605,  1.8494,  2.0290,  2.2197,  2.4008,  2.5912,  2.7772,  2.9513,
- 0.1116,  0.2364,  0.3971,  0.6316,  0.8583,  1.0335,  1.1686,  1.3302,
- 1.5612,  1.7877,  1.9829,  2.2052,  2.3596,  2.5460,  2.7341,  2.9290,
- 0.2661,  0.4186,  0.5126,  0.6477,  0.8818,  1.1045,  1.2852,  1.4128,
- 1.5851,  1.7593,  1.9399,  2.1757,  2.3684,  2.5136,  2.6927,  2.9064,
- 0.1495,  0.2749,  0.4391,  0.6304,  0.8239,  1.0181,  1.1995,  1.3759,
- 1.5669,  1.7722,  1.9671,  2.1635,  2.3586,  2.5528,  2.7445,  2.9311,
- 0.0912,  0.1759,  0.3066,  0.5660,  0.8005,  0.9568,  1.1832,  1.4504,
- 1.6259,  1.7948,  2.0113,  2.2002,  2.3654,  2.5583,  2.7929,  2.9735,
- 0.1353,  0.2747,  0.4078,  0.5977,  0.7658,  0.9124,  1.1081,  1.3630,
- 1.5875,  1.7847,  1.9323,  2.1181,  2.3321,  2.5046,  2.7183,  2.9225,
- 0.1938,  0.4063,  0.4982,  0.6002,  0.7702,  0.9071,  1.1631,  1.3885,
- 1.6043,  1.8118,  1.9306,  2.0893,  2.2724,  2.4609,  2.6283,  2.8802,
- 0.1857,  0.3351,  0.4381,  0.6101,  0.7561,  0.8555,  1.0384,  1.3171,
- 1.5667,  1.6904,  1.7552,  1.9689,  2.2597,  2.5260,  2.7272,  2.9337,
- 0.1037,  0.2159,  0.4188,  0.6174,  0.8035,  1.0285,  1.2256,  1.4230,
- 1.6400,  1.8322,  2.0144,  2.1988,  2.3810,  2.5682,  2.7613,  2.9438,
- 0.1625,  0.2776,  0.4225,  0.6001,  0.7879,  0.9087,  1.0801,  1.2759,
- 1.4899,  1.7448,  1.9911,  2.1770,  2.3723,  2.5777,  2.7971,  2.9444,
- 0.2111,  0.3640,  0.5839,  0.7290,  0.8051,  1.0023,  1.2315,  1.4143,
- 1.5878,  1.7755,  1.9804,  2.1498,  2.3312,  2.5350,  2.7613,  2.9472,
- 0.1423,  0.2646,  0.4136,  0.6350,  0.8070,  0.9514,  1.1168,  1.3213,
- 1.5776,  1.7721,  1.9404,  2.1545,  2.3385,  2.5137,  2.7396,  2.9553,
- 0.1132,  0.2386,  0.4103,  0.5931,  0.7808,  0.9881,  1.1840,  1.3860,
- 1.6021,  1.7990,  1.9922,  2.1885,  2.3852,  2.5717,  2.7640,  2.9510,
- 0.1267,  0.2602,  0.3913,  0.5944,  0.7598,  0.9198,  1.0781,  1.2715,
- 1.5299,  1.7573,  1.9308,  2.1346,  2.3267,  2.5419,  2.7466,  2.9320,
- 0.2023,  0.3417,  0.4392,  0.6141,  0.7439,  0.8593,  1.1096,  1.3543,
- 1.5185,  1.6553,  1.7862,  2.0341,  2.2718,  2.4834,  2.7103,  2.9466,
- 0.1113,  0.2470,  0.3677,  0.5686,  0.7700,  0.9356,  1.0806,  1.2452,
- 1.4830,  1.7344,  1.9268,  2.1404,  2.3371,  2.5169,  2.7329,  2.9012,
- 0.1664,  0.3554,  0.5573,  0.7471,  0.9245,  1.0998,  1.2787,  1.4655,
- 1.6654,  1.8346,  2.0179,  2.2159,  2.4096,  2.5946,  2.7790,  2.9530,
- 0.1313,  0.2625,  0.4731,  0.6444,  0.8110,  0.9878,  1.1493,  1.3212,
- 1.5719,  1.8138,  1.9861,  2.1943,  2.3714,  2.5578,  2.7346,  2.9296,
- 0.1186,  0.3035,  0.5049,  0.6860,  0.8670,  0.9975,  1.1364,  1.3471,
- 1.5695,  1.7412,  1.9346,  2.1506,  2.3413,  2.5531,  2.7794,  2.9627,
- 0.1108,  0.2697,  0.4787,  0.6344,  0.7909,  0.9586,  1.1440,  1.3511,
- 1.5686,  1.7601,  1.9246,  2.1241,  2.3293,  2.5390,  2.7315,  2.9333,
- 0.0985,  0.2302,  0.3544,  0.5759,  0.7620,  0.9651,  1.1497,  1.3080,
- 1.5500,  1.7845,  1.9518,  2.1734,  2.3565,  2.5665,  2.7605,  2.9102,
- 0.1208,  0.2727,  0.4381,  0.5736,  0.7382,  0.8390,  1.0102,  1.2648,
- 1.5100,  1.7440,  1.9619,  2.1430,  2.3307,  2.5159,  2.7264,  2.9211,
- 0.1582,  0.2777,  0.4475,  0.6551,  0.8591,  1.0084,  1.1414,  1.3291,
- 1.5902,  1.7826,  1.9543,  2.1659,  2.3233,  2.5044,  2.6935,  2.9199,
- 0.1360,  0.2873,  0.4585,  0.6295,  0.7592,  0.9089,  1.0492,  1.2733,
- 1.5391,  1.7768,  1.9372,  2.1329,  2.3168,  2.5015,  2.6857,  2.8837,
- 0.0886,  0.1829,  0.3696,  0.6126,  0.8334,  1.0135,  1.2303,  1.4674,
- 1.6743,  1.8564,  2.0530,  2.2370,  2.3960,  2.5787,  2.7756,  2.9377,
- 0.2005,  0.3537,  0.4700,  0.6249,  0.7385,  0.9097,  1.1759,  1.3811,
- 1.5314,  1.6705,  1.8546,  2.1229,  2.3292,  2.5251,  2.7951,  2.9646,
- 0.1999,  0.3112,  0.4722,  0.7146,  0.8908,  1.0028,  1.1831,  1.3903,
- 1.6125,  1.7514,  1.9083,  2.1248,  2.3271,  2.5339,  2.6945,  2.8918,
- 0.1243,  0.2606,  0.4382,  0.5850,  0.7705,  0.9727,  1.1214,  1.3059,
- 1.5218,  1.7406,  1.9137,  2.1353,  2.3354,  2.5299,  2.7287,  2.9068,
- 0.1039,  0.2426,  0.4265,  0.6284,  0.8152,  0.9941,  1.2004,  1.4038,
- 1.5912,  1.7763,  1.9650,  2.1598,  2.3474,  2.5488,  2.7419,  2.9322,
- 0.1364,  0.2420,  0.3886,  0.5864,  0.7663,  0.8844,  1.0860,  1.3242,
- 1.5518,  1.7893,  2.0004,  2.1562,  2.3619,  2.5516,  2.7687,  2.9181,
- 0.1483,  0.2851,  0.4479,  0.6312,  0.7924,  0.9821,  1.1705,  1.3386,
- 1.5375,  1.7226,  1.9053,  2.0991,  2.2898,  2.4953,  2.7000,  2.9146,
- 0.2332,  0.4561,  0.5407,  0.6212,  0.7524,  0.8215,  0.9522,  1.1685,
- 1.5216,  1.7132,  1.8291,  2.0647,  2.2811,  2.4857,  2.7071,  2.9281,
- 0.1348,  0.3126,  0.5179,  0.7192,  0.9227,  1.1363,  1.3223,  1.4756,
- 1.6509,  1.8191,  1.9991,  2.1976,  2.3877,  2.5768,  2.7590,  2.9386,
- 0.1093,  0.2211,  0.4763,  0.6703,  0.8282,  0.9536,  1.1202,  1.3796,
- 1.6043,  1.8031,  1.9832,  2.1604,  2.3578,  2.5856,  2.7650,  2.9291,
- 0.1865,  0.3027,  0.4580,  0.6719,  0.8400,  1.0082,  1.1901,  1.3782,
- 1.5448,  1.6885,  1.9477,  2.1381,  2.2797,  2.5113,  2.7465,  2.9414,
- 0.1575,  0.3124,  0.4649,  0.6262,  0.8095,  0.9858,  1.1676,  1.3602,
- 1.5646,  1.7582,  1.9550,  2.1671,  2.3628,  2.5734,  2.7670,  2.9519,
- 0.1174,  0.2777,  0.4663,  0.6333,  0.8169,  1.0096,  1.1885,  1.3847,
- 1.5803,  1.7571,  1.9380,  2.1398,  2.3414,  2.5407,  2.7360,  2.9375,
- 0.1073,  0.2264,  0.4083,  0.5973,  0.7474,  0.9514,  1.1349,  1.3337,
- 1.5433,  1.7348,  1.9380,  2.1436,  2.3441,  2.5438,  2.7457,  2.9383,
- 0.1472,  0.2880,  0.4793,  0.6268,  0.8015,  1.0063,  1.1715,  1.3644,
- 1.5525,  1.7410,  1.9258,  2.1227,  2.3214,  2.5149,  2.7148,  2.9196,
- 0.1414,  0.2565,  0.4349,  0.6111,  0.7695,  0.9496,  1.1212,  1.3265,
- 1.5218,  1.7209,  1.9015,  2.0887,  2.3158,  2.5077,  2.7233,  2.9421,
- 0.1252,  0.2667,  0.4454,  0.6431,  0.8371,  1.0124,  1.2110,  1.4160,
- 1.6240,  1.8242,  2.0047,  2.1974,  2.3902,  2.5778,  2.7637,  2.9481,
- 0.1321,  0.2565,  0.3846,  0.5847,  0.7578,  0.9259,  1.0637,  1.2239,
- 1.4690,  1.7346,  1.9750,  2.1882,  2.3712,  2.5509,  2.7280,  2.8885,
- 0.1437,  0.2930,  0.4428,  0.6156,  0.8045,  0.9638,  1.1450,  1.3138,
- 1.5144,  1.7355,  1.9469,  2.1534,  2.3414,  2.5452,  2.7353,  2.9334,
- 0.1692,  0.2770,  0.3831,  0.6100,  0.7825,  0.9302,  1.0690,  1.2481,
- 1.4615,  1.6799,  1.9165,  2.1739,  2.3435,  2.5349,  2.7520,  2.9163,
- 0.1235,  0.2489,  0.4354,  0.6343,  0.8236,  1.0066,  1.1908,  1.3474,
- 1.5656,  1.8275,  2.0620,  2.2548,  2.4135,  2.5913,  2.7639,  2.9334,
- 0.1090,  0.1961,  0.3854,  0.5701,  0.7024,  0.8843,  1.1393,  1.3785,
- 1.5940,  1.7797,  1.9442,  2.1740,  2.3853,  2.5773,  2.7727,  2.9406,
- 0.1560,  0.3477,  0.5011,  0.6287,  0.7612,  0.9896,  1.1510,  1.3420,
- 1.5435,  1.6816,  1.8731,  2.0651,  2.2613,  2.4999,  2.7027,  2.8971,
- 0.1459,  0.2416,  0.3833,  0.5450,  0.7916,  0.9223,  1.0662,  1.1953,
- 1.4029,  1.6616,  1.9320,  2.1459,  2.3386,  2.5081,  2.6799,  2.9195,
- 0.1546,  0.3854,  0.6184,  0.8460,  1.0599,  1.2428,  1.3906,  1.5550,
- 1.7388,  1.8945,  2.0757,  2.2386,  2.4014,  2.5705,  2.7574,  2.9400,
- 0.1080,  0.2307,  0.4112,  0.6067,  0.7725,  0.9467,  1.1285,  1.3205,
- 1.5348,  1.7609,  1.9937,  2.1878,  2.3583,  2.5515,  2.7199,  2.9049,
- 0.1482,  0.3178,  0.4983,  0.6342,  0.7783,  0.9880,  1.2019,  1.3404,
- 1.5223,  1.7296,  1.9211,  2.0943,  2.2928,  2.5008,  2.7136,  2.9224,
- 0.1145,  0.2910,  0.4891,  0.6492,  0.8126,  0.9530,  1.1180,  1.3155,
- 1.5054,  1.6893,  1.8899,  2.1188,  2.3389,  2.5512,  2.7313,  2.9224,
- 0.0939,  0.1689,  0.3250,  0.5792,  0.7698,  0.9245,  1.1574,  1.3865,
- 1.5959,  1.7977,  1.9821,  2.1528,  2.3326,  2.5540,  2.7553,  2.9179,
- 0.1243,  0.2474,  0.3923,  0.6199,  0.7908,  0.9379,  1.1497,  1.3734,
- 1.5582,  1.7420,  1.9539,  2.1385,  2.3240,  2.5277,  2.7311,  2.9178,
- 0.1961,  0.3748,  0.5176,  0.6387,  0.8169,  1.0477,  1.2124,  1.3869,
- 1.5604,  1.7225,  1.8770,  2.0837,  2.2960,  2.5103,  2.6945,  2.8862,
- 0.1295,  0.2403,  0.4149,  0.6189,  0.7913,  0.9130,  1.0832,  1.2787,
- 1.4860,  1.7112,  1.9502,  2.1348,  2.2776,  2.4982,  2.7431,  2.9522,
- 0.0160,  0.0362,  0.0097,  0.0057, -0.0014, -0.0073, -0.0046, -0.0064,
--0.0121,  0.0019,  0.0149, -0.0440, -0.0479, -0.0382, -0.0480, -0.0182,
- 0.0170,  0.0114, -0.0298, -0.0175, -0.0033, -0.0354, -0.0510, -0.0025,
- 0.0307,  0.0351,  0.0338,  0.0420,  0.0138, -0.0175, -0.0102,  0.0053,
- 0.0084, -0.0003,  0.0412, -0.0027,  0.0145, -0.0039,  0.0083,  0.0400,
- 0.0001, -0.0262,  0.0055, -0.0082,  0.0348,  0.0433,  0.0137, -0.0024,
--0.0055,  0.0262,  0.0521,  0.0349,  0.0185,  0.0076, -0.0319, -0.0561,
--0.0460, -0.0253, -0.0097,  0.0163,  0.0184, -0.0037, -0.0480, -0.0371,
- 0.0628,  0.0665,  0.0296, -0.0057,  0.0253,  0.0227,  0.0350,  0.0692,
- 0.0545,  0.0218,  0.0094, -0.0449, -0.0372,  0.0005,  0.0258,  0.0118,
- 0.0285,  0.0760,  0.0822,  0.0527, -0.0299, -0.0049,  0.0170,  0.0195,
- 0.0136,  0.0286,  0.0289,  0.0139,  0.0054,  0.0152,  0.0244,  0.0028,
--0.0056, -0.0260,  0.0307,  0.0572, -0.0087,  0.0088,  0.0062,  0.0000,
- 0.0125,  0.0000, -0.0292,  0.0820,  0.0872,  0.0646,  0.0346,  0.0076,
--0.0022, -0.0253, -0.0567, -0.0188, -0.0336, -0.0673, -0.0549, -0.0166,
--0.0259, -0.0140,  0.0040, -0.0029, -0.0430, -0.0531, -0.0253, -0.0019,
--0.0071,  0.0393,  0.0072, -0.0327, -0.0236, -0.0235, -0.0177, -0.0186,
--0.0280, -0.0201, -0.0077,  0.0383,  0.0418,  0.0321,  0.0294,  0.0169,
- 0.0468,  0.0301,  0.0133,  0.0363,  0.0516,  0.0937,  0.1240,  0.1404,
- 0.1325,  0.1178,  0.0999,  0.0251, -0.0037, -0.0495, -0.0703, -0.0219,
--0.0261, -0.0304, -0.0204, -0.0372,  0.0355,  0.0131, -0.0093, -0.0099,
--0.0069, -0.0034, -0.0065, -0.0208, -0.0231, -0.0117, -0.0211, -0.0243,
- 0.0046, -0.0107, -0.0070,  0.0123,  0.0230,  0.0152,  0.0164,  0.0412,
- 0.0619,  0.0858,  0.0862, -0.0056,  0.0125,  0.0182,  0.0347,  0.0388,
- 0.0456,  0.0407, -0.0249, -0.0460,  0.0206,  0.0299,  0.0253,  0.0207,
- 0.0177,  0.0238,  0.0253,  0.0030,  0.0042,  0.0020, -0.0081, -0.0136,
--0.0290, -0.0042,  0.0122,  0.0051,  0.0107,  0.0228,  0.0211, -0.0068,
--0.0436, -0.0299, -0.0078, -0.0779, -0.1157, -0.0679,  0.0172,  0.0150,
--0.0051,  0.0081, -0.0512, -0.0616,  0.0576,  0.0799,  0.0803,  0.0336,
- 0.0001, -0.0298, -0.0747, -0.0115, -0.0101, -0.0170, -0.0050,  0.0174,
--0.0290, -0.0601, -0.0150,  0.0121,  0.0165,  0.0230,  0.0028, -0.0317,
--0.0165,  0.0356,  0.0451,  0.0120,  0.0321,  0.0084, -0.0058,  0.0122,
- 0.1935,  0.1802,  0.2195,  0.2410,  0.2201,  0.1915,  0.1840,  0.1935,
- 0.2213,  0.2079,  0.1858,  0.1974,  0.2239,  0.2173,  0.1840,  0.2120,
- 0.4912,  0.4777,  0.4607,  0.4395,  0.4426,  0.4388,  0.4416,  0.4345,
- 0.4239,  0.4331,  0.4522,  0.4423,  0.4475,  0.4387,  0.4525,  0.4446
-},
-
-.lsp22_2 = {
- 0.0712,  0.1830,  0.4167,  0.6669,  0.8738,  1.0696,  1.2555,  1.4426,
- 1.6427,  1.8138,  1.9966,  2.1925,  2.3872,  2.5748,  2.7713,  2.9597,
- 0.1894,  0.3942,  0.5418,  0.6747,  0.7517,  0.8763,  1.1189,  1.3072,
- 1.5011,  1.6790,  1.8342,  2.0781,  2.2929,  2.4566,  2.6613,  2.9204,
- 0.1767,  0.3403,  0.5173,  0.7055,  0.8899,  1.0696,  1.2302,  1.4111,
- 1.5989,  1.7751,  1.9618,  2.1544,  2.3454,  2.5356,  2.7362,  2.9315,
- 0.1240,  0.2361,  0.4423,  0.6326,  0.7729,  0.9387,  1.1142,  1.2847,
- 1.4746,  1.7126,  1.9482,  2.1642,  2.3536,  2.5506,  2.7593,  2.9197,
- 0.1213,  0.2782,  0.5011,  0.6910,  0.8564,  1.0462,  1.2315,  1.4232,
- 1.6178,  1.8028,  1.9813,  2.1766,  2.3670,  2.5591,  2.7475,  2.9403,
- 0.1382,  0.2995,  0.4693,  0.5874,  0.6929,  0.8102,  1.0094,  1.2960,
- 1.5511,  1.7607,  1.9699,  2.1680,  2.3367,  2.5459,  2.7370,  2.9105,
- 0.1428,  0.2690,  0.3713,  0.4757,  0.6664,  0.9019,  1.1276,  1.3674,
- 1.5471,  1.6695,  1.8261,  2.0572,  2.2753,  2.4963,  2.7187,  2.9114,
- 0.1669,  0.3085,  0.4489,  0.5724,  0.6934,  0.8465,  0.9680,  1.1641,
- 1.4320,  1.6841,  1.8977,  2.1061,  2.3118,  2.5152,  2.7329,  2.9274,
- 0.1128,  0.2709,  0.4803,  0.6878,  0.8673,  1.0693,  1.2749,  1.4657,
- 1.6650,  1.8434,  2.0339,  2.2300,  2.4003,  2.5951,  2.7762,  2.9465,
- 0.1201,  0.2345,  0.4021,  0.6379,  0.8651,  1.0256,  1.1630,  1.3250,
- 1.5395,  1.7808,  2.0011,  2.1997,  2.3618,  2.5505,  2.7561,  2.9351,
- 0.2575,  0.4163,  0.5081,  0.6484,  0.8570,  1.0832,  1.2732,  1.3933,
- 1.5497,  1.7725,  1.9945,  2.2098,  2.3514,  2.5216,  2.7146,  2.8969,
- 0.1367,  0.2656,  0.4470,  0.6398,  0.8146,  1.0125,  1.2142,  1.3960,
- 1.5558,  1.7338,  1.9465,  2.1769,  2.4031,  2.5746,  2.7335,  2.9046,
- 0.0868,  0.1723,  0.2785,  0.5071,  0.7732,  1.0024,  1.1924,  1.4220,
- 1.6149,  1.8064,  1.9951,  2.1935,  2.3777,  2.5748,  2.7661,  2.9488,
- 0.1428,  0.2592,  0.3875,  0.5810,  0.7513,  0.9334,  1.1096,  1.3565,
- 1.5869,  1.7788,  1.9036,  2.0893,  2.3332,  2.5289,  2.7204,  2.9053,
- 0.2313,  0.4066,  0.4960,  0.5853,  0.7799,  0.9201,  1.1365,  1.3499,
- 1.5119,  1.7641,  1.9095,  2.0911,  2.2653,  2.4587,  2.7010,  2.8900,
- 0.1927,  0.3424,  0.4682,  0.6035,  0.7330,  0.8492,  1.0477,  1.3083,
- 1.5602,  1.6945,  1.7806,  2.0066,  2.2566,  2.4864,  2.7021,  2.9180,
- 0.0962,  0.1933,  0.3968,  0.6077,  0.8083,  1.0224,  1.2307,  1.4344,
- 1.6350,  1.8173,  2.0024,  2.1894,  2.3812,  2.5648,  2.7535,  2.9483,
- 0.1469,  0.2679,  0.4272,  0.6080,  0.7949,  0.9247,  1.0741,  1.2722,
- 1.5144,  1.7679,  2.0030,  2.1944,  2.3890,  2.5928,  2.8116,  2.9555,
- 0.1618,  0.3917,  0.6111,  0.7511,  0.8325,  1.0010,  1.2397,  1.4147,
- 1.5764,  1.7359,  1.9300,  2.1325,  2.3096,  2.5480,  2.7725,  2.9697,
- 0.1561,  0.2634,  0.4062,  0.6139,  0.8059,  0.9618,  1.0948,  1.3179,
- 1.5846,  1.7622,  1.9399,  2.1476,  2.3330,  2.5232,  2.7412,  2.9554,
- 0.1076,  0.2320,  0.3977,  0.5798,  0.7707,  0.9975,  1.1884,  1.3793,
- 1.6059,  1.8038,  1.9928,  2.1942,  2.3881,  2.5742,  2.7717,  2.9547,
- 0.1360,  0.2493,  0.3827,  0.5644,  0.7384,  0.9087,  1.0865,  1.2902,
- 1.5185,  1.7246,  1.9170,  2.1175,  2.3324,  2.5442,  2.7441,  2.9437,
- 0.1684,  0.2990,  0.4406,  0.5834,  0.7305,  0.9028,  1.0801,  1.2756,
- 1.4646,  1.6514,  1.8346,  2.0493,  2.2594,  2.4765,  2.6985,  2.9089,
- 0.1145,  0.2295,  0.3421,  0.5032,  0.7007,  0.9057,  1.0830,  1.2733,
- 1.4885,  1.6897,  1.8933,  2.1128,  2.3188,  2.5271,  2.7284,  2.9266,
- 0.1705,  0.3815,  0.6120,  0.7964,  0.9342,  1.0926,  1.2741,  1.4645,
- 1.6552,  1.8040,  1.9778,  2.1931,  2.3836,  2.5827,  2.7905,  2.9494,
- 0.1284,  0.2622,  0.4714,  0.6559,  0.8004,  1.0005,  1.1416,  1.3163,
- 1.5773,  1.8144,  1.9947,  2.2001,  2.3836,  2.5710,  2.7447,  2.9262,
- 0.1164,  0.2882,  0.5349,  0.7310,  0.8483,  0.9729,  1.1331,  1.3350,
- 1.5307,  1.7306,  1.9409,  2.1275,  2.3229,  2.5358,  2.7455,  2.9447,
- 0.1159,  0.2646,  0.4677,  0.6375,  0.7771,  0.9557,  1.1398,  1.3514,
- 1.5717,  1.7512,  1.9337,  2.1323,  2.3272,  2.5409,  2.7377,  2.9212,
- 0.1080,  0.2143,  0.3475,  0.5307,  0.7358,  0.9681,  1.1489,  1.3289,
- 1.5553,  1.7664,  1.9696,  2.1780,  2.3676,  2.5568,  2.7493,  2.9347,
- 0.1331,  0.2430,  0.3879,  0.5092,  0.6324,  0.8119,  1.0327,  1.2657,
- 1.4999,  1.7107,  1.9178,  2.1272,  2.3296,  2.5340,  2.7372,  2.9353,
- 0.1557,  0.2873,  0.4558,  0.6548,  0.8472,  1.0106,  1.1480,  1.3281,
- 1.5856,  1.7740,  1.9564,  2.1651,  2.3295,  2.5207,  2.7005,  2.9151,
- 0.1397,  0.2761,  0.4533,  0.6374,  0.7510,  0.8767,  1.0408,  1.2909,
- 1.5368,  1.7560,  1.9424,  2.1332,  2.3210,  2.5116,  2.6924,  2.8886,
- 0.0945,  0.1653,  0.3601,  0.6129,  0.8378,  1.0333,  1.2417,  1.4539,
- 1.6507,  1.8304,  2.0286,  2.2157,  2.3975,  2.5865,  2.7721,  2.9426,
- 0.1892,  0.3863,  0.4896,  0.5909,  0.7294,  0.9483,  1.1575,  1.3542,
- 1.4796,  1.6535,  1.9070,  2.1435,  2.3281,  2.4967,  2.7039,  2.9222,
- 0.1614,  0.3129,  0.5086,  0.7048,  0.8730,  1.0239,  1.1905,  1.3799,
- 1.5697,  1.7503,  1.9103,  2.1115,  2.3235,  2.5234,  2.6973,  2.8957,
- 0.1199,  0.2590,  0.4273,  0.5935,  0.7542,  0.9625,  1.1225,  1.2998,
- 1.5361,  1.7102,  1.9097,  2.1269,  2.3157,  2.5304,  2.7212,  2.9175,
- 0.1087,  0.2373,  0.4261,  0.6277,  0.8092,  0.9884,  1.1954,  1.4077,
- 1.6048,  1.7799,  1.9693,  2.1662,  2.3426,  2.5501,  2.7459,  2.9257,
- 0.1262,  0.2216,  0.3857,  0.5799,  0.7148,  0.8610,  1.0752,  1.3306,
- 1.5549,  1.7605,  1.9727,  2.1580,  2.3612,  2.5602,  2.7554,  2.9372,
- 0.1445,  0.2832,  0.4469,  0.6283,  0.7991,  0.9796,  1.1504,  1.3323,
- 1.5313,  1.7140,  1.8968,  2.0990,  2.2826,  2.4903,  2.7003,  2.9031,
- 0.1647,  0.4068,  0.5428,  0.6539,  0.7682,  0.8479,  0.9372,  1.1691,
- 1.4776,  1.7314,  1.9071,  2.0918,  2.2774,  2.5029,  2.7152,  2.9221,
- 0.1274,  0.3052,  0.5238,  0.7280,  0.9229,  1.1211,  1.3071,  1.4784,
- 1.6564,  1.8235,  2.0028,  2.1999,  2.3763,  2.5608,  2.7510,  2.9356,
- 0.1076,  0.2195,  0.4815,  0.6873,  0.8241,  0.9443,  1.1066,  1.3687,
- 1.6087,  1.8105,  1.9857,  2.1486,  2.3505,  2.5854,  2.7785,  2.9376,
- 0.1755,  0.3089,  0.4695,  0.6648,  0.8315,  1.0202,  1.1774,  1.3554,
- 1.5393,  1.7141,  1.9247,  2.1284,  2.2983,  2.4975,  2.7296,  2.9401,
- 0.1636,  0.3166,  0.4594,  0.6199,  0.8161,  0.9879,  1.1738,  1.3642,
- 1.5680,  1.7633,  1.9598,  2.1695,  2.3692,  2.5846,  2.7809,  2.9563,
- 0.1219,  0.2662,  0.4620,  0.6491,  0.8353,  1.0150,  1.2065,  1.3944,
- 1.5785,  1.7631,  1.9389,  2.1434,  2.3400,  2.5316,  2.7359,  2.9513,
- 0.1072,  0.2258,  0.3968,  0.5642,  0.7222,  0.9367,  1.1458,  1.3347,
- 1.5424,  1.7373,  1.9303,  2.1432,  2.3451,  2.5415,  2.7444,  2.9394,
- 0.1393,  0.2950,  0.4724,  0.6407,  0.8034,  1.0031,  1.1712,  1.3552,
- 1.5519,  1.7411,  1.9198,  2.1160,  2.3238,  2.5119,  2.7134,  2.9205,
- 0.1358,  0.2613,  0.4239,  0.5991,  0.7643,  0.9379,  1.1213,  1.3115,
- 1.5067,  1.7031,  1.8768,  2.0836,  2.3092,  2.5134,  2.7237,  2.9286,
- 0.1267,  0.2695,  0.4524,  0.6591,  0.8396,  1.0173,  1.2183,  1.4205,
- 1.6306,  1.8162,  2.0106,  2.2082,  2.3773,  2.5787,  2.7551,  2.9387,
- 0.1314,  0.2529,  0.3837,  0.5494,  0.7446,  0.9097,  1.0489,  1.2385,
- 1.4691,  1.7170,  1.9600,  2.1770,  2.3594,  2.5356,  2.7215,  2.9088,
- 0.1538,  0.2931,  0.4449,  0.6041,  0.7959,  0.9666,  1.1355,  1.3214,
- 1.5150,  1.7230,  1.9433,  2.1408,  2.3459,  2.5476,  2.7273,  2.9330,
- 0.1771,  0.2834,  0.4136,  0.5856,  0.7516,  0.9363,  1.0596,  1.2462,
- 1.4737,  1.6627,  1.8810,  2.1150,  2.3202,  2.5274,  2.7403,  2.9490,
- 0.1248,  0.2494,  0.4397,  0.6352,  0.8226,  1.0015,  1.1799,  1.3458,
- 1.5654,  1.8228,  2.0646,  2.2550,  2.4161,  2.5964,  2.7675,  2.9383,
- 0.0933,  0.1993,  0.3105,  0.4371,  0.6417,  0.8935,  1.1244,  1.3508,
- 1.5649,  1.7595,  1.9581,  2.1648,  2.3639,  2.5569,  2.7573,  2.9468,
- 0.1794,  0.3229,  0.4758,  0.6238,  0.7821,  0.9640,  1.1205,  1.3116,
- 1.5054,  1.6803,  1.8658,  2.0651,  2.2793,  2.4856,  2.6867,  2.9105,
- 0.1252,  0.2397,  0.3844,  0.5398,  0.7044,  0.8799,  1.0526,  1.2270,
- 1.4269,  1.6412,  1.8532,  2.0784,  2.2957,  2.5051,  2.7139,  2.9210,
- 0.1391,  0.3494,  0.5738,  0.8024,  1.0098,  1.2094,  1.3830,  1.5509,
- 1.7222,  1.8782,  2.0604,  2.2479,  2.4154,  2.5968,  2.7767,  2.9450,
- 0.1122,  0.2180,  0.4175,  0.6074,  0.7559,  0.9465,  1.1513,  1.3340,
- 1.5215,  1.7491,  1.9911,  2.1894,  2.3433,  2.5377,  2.7380,  2.9183,
- 0.1595,  0.3029,  0.4842,  0.6324,  0.7874,  0.9814,  1.1992,  1.3554,
- 1.5017,  1.7274,  1.9168,  2.0853,  2.2964,  2.5300,  2.7187,  2.9041,
- 0.1350,  0.2747,  0.4791,  0.6638,  0.8050,  0.9644,  1.1238,  1.2987,
- 1.4844,  1.6754,  1.8778,  2.0987,  2.3279,  2.5424,  2.7410,  2.9356,
- 0.0914,  0.1727,  0.3143,  0.5124,  0.7123,  0.9323,  1.1706,  1.3821,
- 1.5864,  1.7828,  1.9701,  2.1560,  2.3445,  2.5486,  2.7433,  2.9372,
- 0.1222,  0.2359,  0.3931,  0.5912,  0.7776,  0.9505,  1.1623,  1.3723,
- 1.5484,  1.7316,  1.9321,  2.1283,  2.3148,  2.5269,  2.7299,  2.9213,
- 0.2089,  0.3872,  0.5090,  0.6413,  0.7967,  1.0226,  1.1897,  1.3908,
- 1.5954,  1.7202,  1.8614,  2.1030,  2.2973,  2.5079,  2.7491,  2.8944,
- 0.1288,  0.2423,  0.4108,  0.6062,  0.7688,  0.9188,  1.0876,  1.2866,
- 1.4897,  1.6910,  1.9219,  2.1076,  2.2805,  2.5023,  2.7155,  2.9203,
- 0.0192,  0.0462,  0.0128,  0.0054, -0.0156, -0.0118, -0.0135,  0.0030,
--0.0120,  0.0031,  0.0240, -0.0451, -0.0439, -0.0432, -0.0527, -0.0207,
- 0.0253,  0.0084, -0.0305, -0.0144,  0.0046, -0.0378, -0.0467, -0.0102,
- 0.0280,  0.0540,  0.0151,  0.0437,  0.0141, -0.0257, -0.0058,  0.0073,
- 0.0107,  0.0054,  0.0371, -0.0105,  0.0165, -0.0143,  0.0148,  0.0382,
--0.0054, -0.0284,  0.0001, -0.0218,  0.0258,  0.0517,  0.0157, -0.0032,
--0.0190,  0.0343,  0.0576,  0.0346,  0.0392, -0.0158, -0.0323, -0.0578,
--0.0617, -0.0242, -0.0144,  0.0188,  0.0249,  0.0021, -0.0422, -0.0420,
- 0.0750,  0.0762,  0.0325, -0.0066,  0.0332,  0.0376,  0.0388,  0.0630,
- 0.0525,  0.0196,  0.0051, -0.0484, -0.0322,  0.0059,  0.0132,  0.0079,
- 0.0237,  0.0774,  0.0697,  0.0184, -0.0321, -0.0327,  0.0274,  0.0284,
- 0.0057,  0.0289,  0.0478,  0.0142, -0.0053,  0.0114,  0.0292, -0.0032,
--0.0111, -0.0389,  0.0282,  0.0613,  0.0200, -0.0006,  0.0111,  0.0048,
- 0.0273,  0.0017, -0.0369,  0.0655,  0.0758,  0.0555,  0.0238, -0.0024,
--0.0100, -0.0419, -0.0696, -0.0158, -0.0479, -0.0744, -0.0356, -0.0245,
--0.0400, -0.0112,  0.0134,  0.0001, -0.0422, -0.0514, -0.0081,  0.0083,
--0.0151,  0.0323, -0.0001, -0.0444, -0.0406, -0.0214, -0.0050, -0.0235,
--0.0205, -0.0264, -0.0324,  0.0334,  0.0392,  0.0265,  0.0289,  0.0180,
- 0.0493,  0.0227,  0.0194,  0.0365,  0.0544,  0.0674,  0.0559,  0.0732,
- 0.0911,  0.0942,  0.0735,  0.0174, -0.0113, -0.0553, -0.0665, -0.0227,
--0.0259, -0.0266, -0.0239, -0.0379,  0.0329,  0.0173, -0.0210, -0.0114,
--0.0063,  0.0060, -0.0089, -0.0198, -0.0282, -0.0080, -0.0179, -0.0290,
- 0.0046, -0.0126, -0.0066,  0.0350,  0.0532,  0.0235,  0.0198,  0.0212,
- 0.0449,  0.0681,  0.0677, -0.0049,  0.0086,  0.0120,  0.0356,  0.0454,
- 0.0592,  0.0449, -0.0271, -0.0510, -0.0110,  0.0234,  0.0203,  0.0243,
- 0.0242,  0.0133,  0.0098,  0.0040,  0.0024, -0.0005, -0.0075, -0.0126,
--0.0393, -0.0052,  0.0165,  0.0016, -0.0193,  0.0239,  0.0336,  0.0029,
--0.0586, -0.0539, -0.0094, -0.0664, -0.0898, -0.0540, -0.0066,  0.0134,
--0.0074,  0.0067, -0.0521, -0.0431,  0.0104,  0.0690,  0.0663,  0.0197,
--0.0017, -0.0518, -0.0597, -0.0171, -0.0054, -0.0140, -0.0080,  0.0172,
--0.0362, -0.0713, -0.0310,  0.0096,  0.0243,  0.0381, -0.0062, -0.0392,
--0.0281,  0.0386,  0.0461,  0.0069,  0.0384,  0.0080, -0.0141,  0.0171,
- 0.3368,  0.3128,  0.3304,  0.3392,  0.3185,  0.3037,  0.2789,  0.2692,
- 0.2779,  0.2796,  0.2891,  0.2643,  0.2647,  0.2593,  0.2927,  0.3283,
- 0.4978,  0.4988,  0.4969,  0.4997,  0.4957,  0.4985,  0.4970,  0.4978,
- 0.4938,  0.4951,  0.4994,  0.4971,  0.4981,  0.4983,  0.4967,  0.4789
-},
-
-.lsp44 = {
- 0.0927,  0.2291,  0.4059,  0.5779,  0.7288,  0.8821,  1.0377,  1.1915,
- 1.3433,  1.4931,  1.6475,  1.7989,  1.9381,  2.0858,  2.2321,  2.3765,
- 2.5187,  2.6530,  2.7895,  2.9354,  0.0944,  0.1974,  0.3046,  0.4714,
- 0.6116,  0.7829,  0.9027,  1.0375,  1.1869,  1.3488,  1.5036,  1.6781,
- 1.8276,  1.9983,  2.1449,  2.3089,  2.4534,  2.6113,  2.7553,  2.9062,
- 0.1168,  0.2843,  0.4907,  0.6706,  0.8100,  0.9417,  1.0753,  1.2014,
- 1.3151,  1.4496,  1.5832,  1.7379,  1.8642,  2.0230,  2.1681,  2.3250,
- 2.4676,  2.6242,  2.7602,  2.9066,  0.1353,  0.2335,  0.3370,  0.4380,
- 0.5819,  0.7353,  0.8671,  1.0160,  1.1435,  1.2977,  1.4860,  1.6739,
- 1.8412,  2.0028,  2.1537,  2.3124,  2.4741,  2.6272,  2.7862,  2.9536,
- 0.1003,  0.2226,  0.3584,  0.4971,  0.6291,  0.7710,  0.9157,  1.0669,
- 1.2143,  1.3624,  1.5104,  1.6681,  1.8164,  1.9823,  2.1394,  2.3082,
- 2.4677,  2.6306,  2.7909,  2.9382,  0.1056,  0.2027,  0.2956,  0.4005,
- 0.5215,  0.6708,  0.8545,  1.0557,  1.2344,  1.4023,  1.5676,  1.7278,
- 1.8808,  2.0381,  2.1846,  2.3376,  2.4887,  2.6377,  2.7878,  2.9504,
- 0.1015,  0.2462,  0.4122,  0.5783,  0.7233,  0.8833,  1.0377,  1.1903,
- 1.3341,  1.4727,  1.6138,  1.7582,  1.8912,  2.0370,  2.1701,  2.3125,
- 2.4500,  2.6006,  2.7507,  2.9166,  0.1787,  0.2418,  0.3265,  0.5379,
- 0.6584,  0.7681,  0.9545,  1.1050,  1.2125,  1.3528,  1.4763,  1.6705,
- 1.8136,  1.9594,  2.0936,  2.2724,  2.4394,  2.5919,  2.7037,  2.8747,
- 0.0859,  0.1600,  0.2980,  0.4933,  0.6696,  0.8285,  0.9958,  1.1545,
- 1.3107,  1.4591,  1.6127,  1.7652,  1.9143,  2.0680,  2.2171,  2.3643,
- 2.5141,  2.6611,  2.8143,  2.9691,  0.0910,  0.2110,  0.3364,  0.4718,
- 0.5856,  0.7298,  0.8910,  1.0514,  1.1988,  1.3572,  1.5178,  1.6861,
- 1.8399,  2.0099,  2.1639,  2.3225,  2.4774,  2.6321,  2.7863,  2.9412,
- 0.1904,  0.2874,  0.3681,  0.4981,  0.6248,  0.7880,  0.9121,  1.0750,
- 1.2185,  1.3809,  1.5296,  1.7007,  1.8592,  2.0470,  2.1913,  2.3250,
- 2.4519,  2.5984,  2.7408,  2.9023,  0.0917,  0.2067,  0.3246,  0.4961,
- 0.6310,  0.8024,  0.9438,  1.1008,  1.2362,  1.3892,  1.5407,  1.7033,
- 1.8427,  2.0061,  2.1498,  2.3117,  2.4550,  2.6053,  2.7462,  2.9029,
- 0.0989,  0.2193,  0.3756,  0.5410,  0.6929,  0.8368,  0.9801,  1.1250,
- 1.2677,  1.4184,  1.5677,  1.7292,  1.8770,  2.0311,  2.1803,  2.3306,
- 2.4836,  2.6339,  2.7943,  2.9549,  0.0861,  0.1943,  0.3057,  0.4867,
- 0.6194,  0.7592,  0.9184,  1.1052,  1.2486,  1.4064,  1.5609,  1.7273,
- 1.8703,  2.0291,  2.1686,  2.3225,  2.4628,  2.6115,  2.7471,  2.9005,
- 0.0932,  0.2110,  0.3737,  0.5479,  0.7120,  0.8570,  0.9975,  1.1364,
- 1.2772,  1.4220,  1.5612,  1.7089,  1.8410,  1.9827,  2.1263,  2.2859,
- 2.4459,  2.6172,  2.7788,  2.9395,  0.1193,  0.2341,  0.3523,  0.5029,
- 0.6437,  0.7803,  0.9367,  1.1007,  1.2392,  1.3869,  1.5425,  1.7168,
- 1.8709,  2.0248,  2.1584,  2.2949,  2.4308,  2.5823,  2.7235,  2.9034,
- 0.0834,  0.1988,  0.3557,  0.5261,  0.6767,  0.8427,  1.0029,  1.1683,
- 1.3138,  1.4527,  1.6046,  1.7583,  1.9011,  2.0517,  2.1928,  2.3397,
- 2.4839,  2.6291,  2.7771,  2.9329,  0.0938,  0.1967,  0.3213,  0.4675,
- 0.6068,  0.7664,  0.9418,  1.1120,  1.2535,  1.3932,  1.5243,  1.6801,
- 1.8346,  1.9931,  2.1376,  2.3035,  2.4636,  2.6244,  2.7829,  2.9371,
- 0.1017,  0.2552,  0.4327,  0.6017,  0.7467,  0.8797,  1.0097,  1.1442,
- 1.2628,  1.4049,  1.5541,  1.7090,  1.8461,  1.9982,  2.1486,  2.3029,
- 2.4513,  2.6075,  2.7594,  2.9209,  0.1031,  0.2295,  0.3747,  0.5122,
- 0.6596,  0.7935,  0.9345,  1.1050,  1.2384,  1.3543,  1.4739,  1.6136,
- 1.7447,  1.8914,  2.0434,  2.1916,  2.3557,  2.5396,  2.7419,  2.9401,
- 0.1007,  0.2374,  0.3715,  0.5173,  0.6465,  0.8069,  0.9553,  1.1145,
- 1.2594,  1.4143,  1.5617,  1.7166,  1.8457,  2.0012,  2.1462,  2.2864,
- 2.4258,  2.5910,  2.7372,  2.9018,  0.0808,  0.1726,  0.2849,  0.4592,
- 0.6118,  0.7853,  0.9588,  1.1256,  1.2751,  1.4392,  1.5898,  1.7514,
- 1.8977,  2.0554,  2.1937,  2.3430,  2.4831,  2.6249,  2.7601,  2.9155,
- 0.1669,  0.2574,  0.3694,  0.5569,  0.6773,  0.8061,  1.0160,  1.1667,
- 1.2791,  1.4041,  1.5452,  1.7207,  1.8524,  2.0038,  2.1414,  2.3338,
- 2.4747,  2.6157,  2.7303,  2.8848,  0.1598,  0.2521,  0.3416,  0.5149,
- 0.6703,  0.7941,  0.9408,  1.1164,  1.2017,  1.3293,  1.4908,  1.6783,
- 1.8438,  1.9927,  2.1149,  2.2698,  2.4420,  2.6193,  2.7583,  2.9103,
- 0.0902,  0.1978,  0.3265,  0.4578,  0.5878,  0.7439,  0.9110,  1.0906,
- 1.2556,  1.4125,  1.5688,  1.7295,  1.8829,  2.0472,  2.2058,  2.3537,
- 2.5075,  2.6548,  2.8058,  2.9538,  0.0818,  0.1695,  0.2794,  0.4470,
- 0.6069,  0.7641,  0.9313,  1.0946,  1.2411,  1.4072,  1.5640,  1.7186,
- 1.8651,  2.0254,  2.1726,  2.3286,  2.4784,  2.6287,  2.7750,  2.9339,
- 0.1980,  0.3134,  0.4099,  0.4975,  0.6491,  0.8376,  0.9441,  1.0298,
- 1.1795,  1.3866,  1.5784,  1.7209,  1.8137,  1.9271,  2.0863,  2.2930,
- 2.4696,  2.6184,  2.7587,  2.9251,  0.1338,  0.2341,  0.3566,  0.4797,
- 0.6129,  0.7580,  0.9093,  1.0491,  1.1911,  1.3313,  1.4841,  1.6503,
- 1.8035,  1.9685,  2.1128,  2.2694,  2.4093,  2.5728,  2.7206,  2.8994,
- 0.0937,  0.2034,  0.3447,  0.5032,  0.6370,  0.7993,  0.9674,  1.1323,
- 1.2830,  1.4199,  1.5492,  1.7010,  1.8513,  2.0087,  2.1550,  2.3115,
- 2.4643,  2.6237,  2.7812,  2.9392,  0.1085,  0.2152,  0.3126,  0.4569,
- 0.5718,  0.7213,  0.8837,  1.0604,  1.2053,  1.3755,  1.5397,  1.7001,
- 1.8409,  2.0039,  2.1498,  2.3080,  2.4535,  2.6063,  2.7505,  2.9110,
- 0.0562,  0.2066,  0.4034,  0.5490,  0.6682,  0.7924,  0.9495,  1.0800,
- 1.1869,  1.3156,  1.4834,  1.6619,  1.8404,  2.0199,  2.1509,  2.2755,
- 2.4072,  2.5580,  2.6993,  2.8913,  0.0939,  0.2303,  0.3742,  0.5260,
- 0.6662,  0.8294,  0.9769,  1.1315,  1.2792,  1.4153,  1.5436,  1.6701,
- 1.8215,  1.9920,  2.1310,  2.3005,  2.4534,  2.5786,  2.7204,  2.9068,
- 0.1005,  0.2442,  0.3898,  0.5398,  0.6958,  0.8474,  1.0008,  1.1556,
- 1.3020,  1.4456,  1.5954,  1.7470,  1.8922,  2.0500,  2.2019,  2.3492,
- 2.4963,  2.6412,  2.7890,  2.9423,  0.1022,  0.2031,  0.3213,  0.4402,
- 0.5637,  0.7117,  0.8673,  1.0242,  1.1727,  1.3206,  1.4846,  1.6465,
- 1.8015,  1.9655,  2.1233,  2.2873,  2.4464,  2.6074,  2.7685,  2.9409,
- 0.1985,  0.3497,  0.4622,  0.5982,  0.7489,  0.8752,  0.9925,  1.1679,
- 1.3288,  1.4606,  1.5820,  1.7492,  1.8922,  2.0511,  2.1780,  2.3373,
- 2.4760,  2.6233,  2.7466,  2.8978,  0.1284,  0.2433,  0.3630,  0.4852,
- 0.6117,  0.7460,  0.8904,  1.0360,  1.1738,  1.3142,  1.4696,  1.6185,
- 1.7719,  1.9318,  2.0961,  2.2697,  2.4408,  2.6046,  2.7681,  2.9451,
- 0.1042,  0.2286,  0.3598,  0.5064,  0.6438,  0.7899,  0.9350,  1.0891,
- 1.2323,  1.3807,  1.5225,  1.6747,  1.8153,  1.9669,  2.1145,  2.2832,
- 2.4430,  2.6085,  2.7748,  2.9346,  0.0780,  0.1724,  0.2440,  0.3489,
- 0.5280,  0.7426,  0.9272,  1.0914,  1.2562,  1.4188,  1.5804,  1.7376,
- 1.8909,  2.0473,  2.1946,  2.3457,  2.4950,  2.6424,  2.7926,  2.9549,
- 0.1103,  0.2608,  0.4087,  0.5538,  0.6923,  0.8418,  0.9940,  1.1507,
- 1.2919,  1.4406,  1.5802,  1.7262,  1.8638,  2.0085,  2.1572,  2.2975,
- 2.4329,  2.5866,  2.7380,  2.9107,  0.1297,  0.2532,  0.4003,  0.5329,
- 0.6733,  0.7950,  0.9557,  1.0859,  1.2235,  1.3538,  1.5037,  1.6389,
- 1.7964,  1.9285,  2.0898,  2.2541,  2.4231,  2.5711,  2.6875,  2.8947,
- 0.0871,  0.1968,  0.3425,  0.4949,  0.6424,  0.7959,  0.9534,  1.1132,
- 1.2656,  1.4229,  1.5785,  1.7271,  1.8729,  2.0355,  2.1998,  2.3562,
- 2.5151,  2.6663,  2.8145,  2.9534,  0.1038,  0.2204,  0.3248,  0.4566,
- 0.5947,  0.7443,  0.8811,  1.0379,  1.2031,  1.3772,  1.5430,  1.7092,
- 1.8625,  2.0322,  2.1904,  2.3417,  2.4960,  2.6458,  2.7979,  2.9485,
- 0.1329,  0.2763,  0.3943,  0.5147,  0.6512,  0.8071,  0.9410,  1.0879,
- 1.2298,  1.3850,  1.5282,  1.6674,  1.8137,  1.9993,  2.1344,  2.2749,
- 2.4257,  2.5863,  2.7410,  2.9184,  0.1052,  0.2142,  0.3584,  0.5033,
- 0.6387,  0.7804,  0.9320,  1.0780,  1.2172,  1.3764,  1.5421,  1.6887,
- 1.8246,  1.9833,  2.1245,  2.2797,  2.4237,  2.5779,  2.7257,  2.9097,
- 0.1092,  0.2676,  0.4071,  0.5355,  0.6661,  0.8142,  0.9621,  1.1173,
- 1.2628,  1.4185,  1.5696,  1.7220,  1.8595,  2.0178,  2.1720,  2.3221,
- 2.4718,  2.6259,  2.7775,  2.9334,  0.0929,  0.2017,  0.3073,  0.4570,
- 0.5775,  0.7635,  0.9299,  1.0832,  1.2334,  1.3935,  1.5420,  1.7112,
- 1.8601,  2.0309,  2.1735,  2.3230,  2.4543,  2.6034,  2.7418,  2.8988,
- 0.0775,  0.2005,  0.3490,  0.5200,  0.6747,  0.8383,  0.9885,  1.1738,
- 1.3141,  1.4236,  1.5892,  1.7402,  1.8474,  2.0210,  2.1593,  2.2730,
- 2.4235,  2.5604,  2.7128,  2.9005,  0.1104,  0.2292,  0.3353,  0.4732,
- 0.6152,  0.7675,  0.9164,  1.0907,  1.2594,  1.4064,  1.5218,  1.6426,
- 1.8018,  1.9937,  2.1362,  2.2961,  2.4523,  2.6083,  2.7613,  2.9202,
- 0.0826,  0.2000,  0.3384,  0.5144,  0.6694,  0.8377,  0.9870,  1.1461,
- 1.2950,  1.4495,  1.5872,  1.7387,  1.8793,  2.0329,  2.1723,  2.3114,
- 2.4415,  2.5908,  2.7354,  2.9028,  0.1063,  0.2268,  0.3442,  0.4735,
- 0.6116,  0.7507,  0.9028,  1.0768,  1.2426,  1.4052,  1.5566,  1.7015,
- 1.8243,  1.9742,  2.1276,  2.2824,  2.4262,  2.5953,  2.7627,  2.9290,
- 0.1150,  0.2814,  0.4543,  0.6095,  0.7373,  0.8592,  0.9908,  1.1108,
- 1.2339,  1.3590,  1.4864,  1.6168,  1.7392,  1.8752,  2.0212,  2.1688,
- 2.3128,  2.4869,  2.7019,  2.9239,  0.0948,  0.2074,  0.3433,  0.4943,
- 0.6346,  0.7645,  0.8809,  1.0610,  1.2307,  1.3487,  1.4655,  1.6186,
- 1.7534,  1.8859,  2.0486,  2.2200,  2.3835,  2.5581,  2.7565,  2.9502,
- 0.1062,  0.2239,  0.3683,  0.5197,  0.6704,  0.8184,  0.9642,  1.1127,
- 1.2556,  1.3976,  1.5405,  1.6940,  1.8375,  1.9888,  2.1377,  2.2980,
- 2.4555,  2.6184,  2.7849,  2.9452,  0.0888,  0.2005,  0.2847,  0.4322,
- 0.5763,  0.7577,  0.9262,  1.1095,  1.2719,  1.4331,  1.5843,  1.7452,
- 1.8845,  2.0385,  2.1805,  2.3345,  2.4750,  2.6217,  2.7555,  2.9013,
- 0.1713,  0.2617,  0.3868,  0.5859,  0.7073,  0.8535,  1.0593,  1.1778,
- 1.3109,  1.4508,  1.5910,  1.7463,  1.8911,  2.0651,  2.2035,  2.3355,
- 2.4947,  2.6440,  2.7424,  2.8943,  0.1346,  0.2549,  0.4089,  0.5488,
- 0.6949,  0.8394,  0.9810,  1.1145,  1.2528,  1.4044,  1.5423,  1.6872,
- 1.8274,  1.9726,  2.1403,  2.2809,  2.4128,  2.5564,  2.6887,  2.8895,
- 0.0776,  0.1621,  0.2553,  0.4191,  0.5988,  0.7921,  0.9651,  1.1350,
- 1.2930,  1.4475,  1.6011,  1.7585,  1.9068,  2.0638,  2.2102,  2.3594,
- 2.5096,  2.6581,  2.8099,  2.9654,  0.0864,  0.1778,  0.2854,  0.4235,
- 0.5568,  0.7220,  0.8963,  1.0609,  1.2217,  1.3830,  1.5422,  1.7018,
- 1.8551,  2.0206,  2.1783,  2.3328,  2.4869,  2.6366,  2.7923,  2.9539,
- 0.1144,  0.2576,  0.4186,  0.5594,  0.6875,  0.8221,  0.9598,  1.0944,
- 1.2273,  1.3713,  1.5152,  1.6628,  1.8070,  1.9525,  2.0965,  2.2535,
- 2.4132,  2.5725,  2.7250,  2.9150,  0.1079,  0.2221,  0.3334,  0.4845,
- 0.6083,  0.7516,  0.9018,  1.0594,  1.2060,  1.3673,  1.5212,  1.6880,
- 1.8208,  1.9831,  2.1269,  2.2909,  2.4366,  2.6027,  2.7339,  2.8924,
- 0.0994,  0.2233,  0.3634,  0.5145,  0.6568,  0.8131,  0.9746,  1.1296,
- 1.2666,  1.4116,  1.5748,  1.7264,  1.8649,  2.0217,  2.1716,  2.3293,
- 2.4900,  2.6455,  2.7818,  2.9362,  0.1120,  0.2079,  0.3128,  0.4124,
- 0.5291,  0.6816,  0.8478,  1.0150,  1.1772,  1.3456,  1.5208,  1.6882,
- 1.8458,  2.0078,  2.1627,  2.3198,  2.4733,  2.6251,  2.7796,  2.9489,
- 0.0853,  0.2030,  0.3669,  0.5326,  0.6678,  0.8086,  0.9526,  1.1142,
- 1.2551,  1.4158,  1.5694,  1.7073,  1.8431,  1.9686,  2.1153,  2.2376,
- 2.3686,  2.5591,  2.7320,  2.9104,  0.0905,  0.2166,  0.3539,  0.5201,
- 0.6700,  0.8346,  0.9883,  1.1457,  1.2714,  1.3845,  1.5172,  1.6688,
- 1.8008,  1.9535,  2.1019,  2.2708,  2.4135,  2.5974,  2.7486,  2.9033,
- 0.0084,  0.0374,  0.0164, -0.0153,  0.0288,  0.0107, -0.0255, -0.0242,
- 0.0000, -0.0055, -0.0081, -0.0075, -0.0022, -0.0052, -0.0069, -0.0017,
- 0.0003,  0.0091,  0.0028, -0.0027,  0.0085,  0.0043, -0.0235, -0.0411,
- 0.0202,  0.0359,  0.0376,  0.0321,  0.0306, -0.0358, -0.0276, -0.0090,
- 0.0032,  0.0048,  0.0309,  0.0332,  0.0284,  0.0237,  0.0051, -0.0101,
--0.0233, -0.0428, -0.0585, -0.0387,  0.0039,  0.0081,  0.0029, -0.0017,
--0.0006, -0.0068,  0.0044,  0.0182,  0.0376,  0.0387, -0.0334, -0.0269,
--0.0182, -0.0069, -0.0026,  0.0035, -0.0049, -0.0212, -0.0408, -0.0245,
- 0.0186,  0.0189,  0.0153,  0.0120,  0.0157,  0.0055, -0.0046,  0.0179,
- 0.0284, -0.0032, -0.0261, -0.0205, -0.0039,  0.0174,  0.0299,  0.0207,
- 0.0012, -0.0056,  0.0010,  0.0141, -0.0119,  0.0190,  0.0315,  0.0033,
--0.0128,  0.0300,  0.0328,  0.0308,  0.0353,  0.0266,  0.0066, -0.0328,
--0.0273,  0.0054,  0.0145,  0.0175,  0.0015, -0.0171,  0.0062, -0.0164,
- 0.0045, -0.0071,  0.0025,  0.0278,  0.0283,  0.0117, -0.0026, -0.0285,
--0.0408, -0.0366, -0.0059, -0.0208, -0.0354, -0.0334, -0.0263, -0.0064,
- 0.0072, -0.0006, -0.0235, -0.0037, -0.0307, -0.0294, -0.0163, -0.0197,
--0.0235,  0.0192,  0.0013, -0.0219, -0.0123, -0.0004, -0.0081, -0.0096,
--0.0123, -0.0101,  0.0021,  0.0151,  0.0106,  0.0151,  0.0292,  0.0033,
- 0.0283,  0.0124,  0.0058, -0.0017, -0.0038,  0.0152,  0.0141,  0.0132,
- 0.0178,  0.0157,  0.0073,  0.0176,  0.0141,  0.0097, -0.0092, -0.0163,
--0.0230, -0.0134, -0.0099, -0.0147,  0.0040, -0.0183, -0.0175, -0.0080,
--0.0083, -0.0290, -0.0417, -0.0398, -0.0269, -0.0199, -0.0143, -0.0053,
--0.0099, -0.0054, -0.0199, -0.0219, -0.0170,  0.0107,  0.0194,  0.0035,
- 0.0437,  0.0406,  0.0215,  0.0120,  0.0053, -0.0028,  0.0238,  0.0337,
- 0.0217,  0.0011,  0.0227,  0.0244,  0.0327,  0.0378,  0.0437,  0.0356,
--0.0033,  0.0113,  0.0407,  0.0334, -0.0125, -0.0003, -0.0141, -0.0273,
--0.0137, -0.0079, -0.0145, -0.0071,  0.0114,  0.0181,  0.0150,  0.0085,
--0.0077, -0.0038, -0.0219, -0.0263, -0.0187, -0.0233,  0.0133,  0.0265,
--0.0156, -0.0091, -0.0110, -0.0016,  0.0143,  0.0177,  0.0240,  0.0082,
--0.0143, -0.0257, -0.0014,  0.0002,  0.0082,  0.0180,  0.0325,  0.0340,
--0.0153, -0.0389, -0.0240,  0.0082,  0.0140,  0.0046, -0.0138, -0.0378,
--0.0366,  0.0297,  0.0252,  0.0078,  0.0063,  0.0006,  0.0044,  0.0074,
- 0.0094,  0.0113,  0.0105,  0.0137,  0.0438,  0.0262, -0.0078, -0.0185,
--0.0215, -0.0407, -0.0435, -0.0208, -0.0004, -0.0144, -0.0205, -0.0248,
--0.0159, -0.0069, -0.0153,  0.0132,  0.0355,  0.0298,  0.0120,  0.0072,
- 0.0236,  0.0526,  0.0479,  0.0233, -0.0133, -0.0283, -0.0468, -0.0549,
--0.0370,  0.0032,  0.0056,  0.0023,  0.0050,  0.0024,  0.0279,  0.0116,
--0.0045, -0.0012,  0.0107,  0.0190,  0.0253,  0.0191,  0.0043,  0.0193,
--0.0348, -0.0246,  0.0123,  0.0210,  0.0135, -0.0096, -0.0109, -0.0076,
--0.0156, -0.0290,  0.0160,  0.0194,  0.0219,  0.0259,  0.0250,  0.0195,
- 0.4948,  0.4961,  0.4940,  0.4878,  0.4849,  0.4727,  0.4571,  0.4551,
- 0.4534,  0.4468,  0.4412,  0.4354,  0.4298,  0.4272,  0.4498,  0.4506,
- 0.4560,  0.4592,  0.4758,  0.4941,  0.2476,  0.1771,  0.1974,  0.1881,
- 0.1667,  0.1826,  0.2067,  0.2031,  0.1734,  0.1534,  0.1415,  0.1761,
- 0.1897,  0.1772,  0.1651,  0.1247,  0.1041,  0.1231,  0.1809,  0.2234
-    },
-};
-
-
-static const uint8_t tab7[][35] = {
-    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0},
-    {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
-    {0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0},
-    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0},
-    {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0},
-    {0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0},
-    {0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1},
-    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
-    {0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0}
-};
-
-static const uint8_t tab8[][5] = {
-    {0, 0, 0, 1, 1},
-    {0, 1, 0, 0, 1},
-    {1, 1, 0, 0, 0},
-    {1, 0, 0, 1, 0},
-    {0, 0, 0, 1, 1},
-    {0, 1, 0, 0, 1},
-    {1, 1, 0, 0, 0},
-    {1, 0, 0, 1, 0},
-    {0, 0, 0, 1, 1},
-    {0, 1, 0, 0, 1},
-    {1, 1, 0, 0, 0},
-    {0, 0, 0, 0, 0},
-    {0, 1, 0, 1, 0}
-};
-
-static const uint8_t tab9[][45] = {
-    {
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-     0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    },{
-     0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,
-     1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0
-    },{
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
-     0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    }
-};
-
-static const uint8_t tab10[][25] =
-{
-    {1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0},
-    {1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0},
-    {1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0},
-    {1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
-    {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1},
-    {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1},
-    {1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},
-    {0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1}
-};
-
-static const uint8_t tab11[][55] = {
-    {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0
-    },{
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-    },{
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    },{
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    }, {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-    },{
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-    },{
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    },{
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    },{
-        0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
-    }
-};
-
-static const uint8_t tab12[][15] = {
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0},
-    {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
-    {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
-    {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0},
-    {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
-    {0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
-    {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0},
-    {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
-    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1},
-};
-
-static const struct {
-    int size;
-    const uint8_t *tab;
-} tabs[] = {
-    {0 , NULL},
-    {5 , &tab8 [0][0]},{5 , &tab8 [0][0]}, {15, &tab12[0][0]},
-    {5 , &tab8 [0][0]},{25, &tab10[0][0]}, {15, &tab12[0][0]},
-    {35, &tab7 [0][0]},{5 , &tab8 [0][0]}, {45, &tab9 [0][0]},
-    {25, &tab10[0][0]},{55, &tab11[0][0]}, {15, &tab12[0][0]}
-};
-
-#endif /* AVCODEC_TWINVQ_DATA_H */
diff --git a/libavcodec/txd.c b/libavcodec/txd.c
deleted file mode 100644
index ac8229f..0000000
--- a/libavcodec/txd.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Renderware TeXture Dictionary (.txd) image decoder
- * Copyright (c) 2007 Ivo van Poorten
- *
- * See also: http://wiki.multimedia.cx/index.php?title=TXD
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "s3tc.h"
-
-typedef struct TXDContext {
-    AVFrame picture;
-} TXDContext;
-
-static av_cold int txd_init(AVCodecContext *avctx) {
-    TXDContext *s = avctx->priv_data;
-
-    avcodec_get_frame_defaults(&s->picture);
-    avctx->coded_frame = &s->picture;
-
-    return 0;
-}
-
-static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                            AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    TXDContext * const s = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p = &s->picture;
-    unsigned int version, w, h, d3d_format, depth, stride, mipmap_count, flags;
-    unsigned int y, v;
-    uint8_t *ptr;
-    const uint8_t *cur = buf;
-    const uint32_t *palette = (const uint32_t *)(cur + 88);
-    uint32_t *pal;
-
-    version         = AV_RL32(cur);
-    d3d_format      = AV_RL32(cur+76);
-    w               = AV_RL16(cur+80);
-    h               = AV_RL16(cur+82);
-    depth           = AV_RL8 (cur+84);
-    mipmap_count    = AV_RL8 (cur+85);
-    flags           = AV_RL8 (cur+87);
-    cur            += 92;
-
-    if (version < 8 || version > 9) {
-        av_log(avctx, AV_LOG_ERROR, "texture data version %i is unsupported\n",
-                                                                    version);
-        return -1;
-    }
-
-    if (depth == 8) {
-        avctx->pix_fmt = PIX_FMT_PAL8;
-        cur += 1024;
-    } else if (depth == 16 || depth == 32)
-        avctx->pix_fmt = PIX_FMT_RGB32;
-    else {
-        av_log(avctx, AV_LOG_ERROR, "depth of %i is unsupported\n", depth);
-        return -1;
-    }
-
-    if (p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    if (avcodec_check_dimensions(avctx, w, h))
-        return -1;
-    if (w != avctx->width || h != avctx->height)
-        avcodec_set_dimensions(avctx, w, h);
-    if (avctx->get_buffer(avctx, p) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    p->pict_type = FF_I_TYPE;
-
-    ptr    = p->data[0];
-    stride = p->linesize[0];
-
-    if (depth == 8) {
-        pal = (uint32_t *) p->data[1];
-        for (y=0; y<256; y++) {
-            v = AV_RB32(palette+y);
-            pal[y] = (v>>8) + (v<<24);
-        }
-        for (y=0; y<h; y++) {
-            memcpy(ptr, cur, w);
-            ptr += stride;
-            cur += w;
-        }
-    } else if (depth == 16) {
-        switch (d3d_format) {
-        case 0:
-            if (!flags&1) goto unsupported;
-        case FF_S3TC_DXT1:
-            ff_decode_dxt1(cur, ptr, w, h, stride);
-            break;
-        case FF_S3TC_DXT3:
-            ff_decode_dxt3(cur, ptr, w, h, stride);
-            break;
-        default:
-            goto unsupported;
-        }
-    } else if (depth == 32) {
-        switch (d3d_format) {
-        case 0x15:
-        case 0x16:
-            for (y=0; y<h; y++) {
-                memcpy(ptr, cur, w*4);
-                ptr += stride;
-                cur += w*4;
-            }
-            break;
-        default:
-            goto unsupported;
-        }
-    }
-
-    for (; mipmap_count > 1; mipmap_count--)
-        cur += AV_RL32(cur) + 4;
-
-    *picture   = s->picture;
-    *data_size = sizeof(AVPicture);
-
-    return cur - buf;
-
-unsupported:
-    av_log(avctx, AV_LOG_ERROR, "unsupported d3d format (%08x)\n", d3d_format);
-    return -1;
-}
-
-static av_cold int txd_end(AVCodecContext *avctx) {
-    TXDContext *s = avctx->priv_data;
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-AVCodec txd_decoder = {
-    "txd",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_TXD,
-    sizeof(TXDContext),
-    txd_init,
-    NULL,
-    txd_end,
-    txd_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"),
-};
diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c
deleted file mode 100644
index 1d04c80..0000000
--- a/libavcodec/ulti.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * IBM Ultimotion Video Decoder
- * Copyright (C) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * IBM Ultimotion Video Decoder.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-#include "ulti_cb.h"
-
-typedef struct UltimotionDecodeContext {
-    AVCodecContext *avctx;
-    int width, height, blocks;
-    AVFrame frame;
-    const uint8_t *ulti_codebook;
-} UltimotionDecodeContext;
-
-static av_cold int ulti_decode_init(AVCodecContext *avctx)
-{
-    UltimotionDecodeContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->width = avctx->width;
-    s->height = avctx->height;
-    s->blocks = (s->width / 8) * (s->height / 8);
-    avctx->pix_fmt = PIX_FMT_YUV410P;
-    avctx->coded_frame = (AVFrame*) &s->frame;
-    s->ulti_codebook = ulti_codebook;
-
-    return 0;
-}
-
-static av_cold int ulti_decode_end(AVCodecContext *avctx){
-    UltimotionDecodeContext *s = avctx->priv_data;
-    AVFrame *pic = &s->frame;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    return 0;
-}
-
-static const int block_coords[8] = // 4x4 block coords in 8x8 superblock
-    { 0, 0, 0, 4, 4, 4, 4, 0};
-
-static const int angle_by_index[4] = { 0, 2, 6, 12};
-
-/* Lookup tables for luma and chroma - used by ulti_convert_yuv() */
-static const uint8_t ulti_lumas[64] =
-    { 0x10, 0x13, 0x17, 0x1A, 0x1E, 0x21, 0x25, 0x28,
-      0x2C, 0x2F, 0x33, 0x36, 0x3A, 0x3D, 0x41, 0x44,
-      0x48, 0x4B, 0x4F, 0x52, 0x56, 0x59, 0x5C, 0x60,
-      0x63, 0x67, 0x6A, 0x6E, 0x71, 0x75, 0x78, 0x7C,
-      0x7F, 0x83, 0x86, 0x8A, 0x8D, 0x91, 0x94, 0x98,
-      0x9B, 0x9F, 0xA2, 0xA5, 0xA9, 0xAC, 0xB0, 0xB3,
-      0xB7, 0xBA, 0xBE, 0xC1, 0xC5, 0xC8, 0xCC, 0xCF,
-      0xD3, 0xD6, 0xDA, 0xDD, 0xE1, 0xE4, 0xE8, 0xEB};
-
-static const uint8_t ulti_chromas[16] =
-    { 0x60, 0x67, 0x6D, 0x73, 0x7A, 0x80, 0x86, 0x8D,
-      0x93, 0x99, 0xA0, 0xA6, 0xAC, 0xB3, 0xB9, 0xC0};
-
-/* convert Ultimotion YUV block (sixteen 6-bit Y samples and
- two 4-bit chroma samples) into standard YUV and put it into frame */
-static void ulti_convert_yuv(AVFrame *frame, int x, int y,
-                             uint8_t *luma,int chroma)
-{
-    uint8_t *y_plane, *cr_plane, *cb_plane;
-    int i;
-
-    y_plane = frame->data[0] + x + y * frame->linesize[0];
-    cr_plane = frame->data[1] + (x / 4) + (y / 4) * frame->linesize[1];
-    cb_plane = frame->data[2] + (x / 4) + (y / 4) * frame->linesize[2];
-
-    cr_plane[0] = ulti_chromas[chroma >> 4];
-
-    cb_plane[0] = ulti_chromas[chroma & 0xF];
-
-
-    for(i = 0; i < 16; i++){
-        y_plane[i & 3] = ulti_lumas[luma[i]];
-        if((i & 3) == 3) { //next row
-            y_plane += frame->linesize[0];
-        }
-    }
-}
-
-/* generate block like in MS Video1 */
-static void ulti_pattern(AVFrame *frame, int x, int y,
-                         int f0, int f1, int Y0, int Y1, int chroma)
-{
-    uint8_t Luma[16];
-    int mask, i;
-    for(mask = 0x80, i = 0; mask; mask >>= 1, i++) {
-        if(f0 & mask)
-            Luma[i] = Y1;
-        else
-            Luma[i] = Y0;
-    }
-
-    for(mask = 0x80, i = 8; mask; mask >>= 1, i++) {
-        if(f1 & mask)
-            Luma[i] = Y1;
-        else
-            Luma[i] = Y0;
-    }
-
-    ulti_convert_yuv(frame, x, y, Luma, chroma);
-}
-
-/* fill block with some gradient */
-static void ulti_grad(AVFrame *frame, int x, int y, uint8_t *Y, int chroma, int angle)
-{
-    uint8_t Luma[16];
-    if(angle & 8) { //reverse order
-        int t;
-        angle &= 0x7;
-        t = Y[0];
-        Y[0] = Y[3];
-        Y[3] = t;
-        t = Y[1];
-        Y[1] = Y[2];
-        Y[2] = t;
-    }
-    switch(angle){
-    case 0:
-        Luma[0]  = Y[0]; Luma[1]  = Y[1]; Luma[2]  = Y[2]; Luma[3]  = Y[3];
-        Luma[4]  = Y[0]; Luma[5]  = Y[1]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[2]; Luma[11] = Y[3];
-        Luma[12] = Y[0]; Luma[13] = Y[1]; Luma[14] = Y[2]; Luma[15] = Y[3];
-        break;
-    case 1:
-        Luma[0]  = Y[1]; Luma[1]  = Y[2]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[0]; Luma[5]  = Y[1]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[2]; Luma[11] = Y[3];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[1]; Luma[15] = Y[2];
-        break;
-    case 2:
-        Luma[0]  = Y[1]; Luma[1]  = Y[2]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[1]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[2];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[1]; Luma[15] = Y[2];
-        break;
-    case 3:
-        Luma[0]  = Y[2]; Luma[1]  = Y[3]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[1]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[2];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[1];
-        break;
-    case 4:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[2]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[2];
-        Luma[8]  = Y[1]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[1];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    case 5:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[3]; Luma[3]  = Y[2];
-        Luma[4]  = Y[3]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[1];
-        Luma[8]  = Y[2]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[0];
-        Luma[12] = Y[1]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    case 6:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[2]; Luma[3]  = Y[2];
-        Luma[4]  = Y[3]; Luma[5]  = Y[2]; Luma[6]  = Y[1]; Luma[7]  = Y[1];
-        Luma[8]  = Y[2]; Luma[9]  = Y[2]; Luma[10] = Y[1]; Luma[11] = Y[0];
-        Luma[12] = Y[1]; Luma[13] = Y[1]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    case 7:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[2]; Luma[3]  = Y[1];
-        Luma[4]  = Y[3]; Luma[5]  = Y[2]; Luma[6]  = Y[1]; Luma[7]  = Y[0];
-        Luma[8]  = Y[3]; Luma[9]  = Y[2]; Luma[10] = Y[1]; Luma[11] = Y[0];
-        Luma[12] = Y[2]; Luma[13] = Y[1]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    default:
-        Luma[0]  = Y[0]; Luma[1]  = Y[0]; Luma[2]  = Y[1]; Luma[3]  = Y[1];
-        Luma[4]  = Y[0]; Luma[5]  = Y[0]; Luma[6]  = Y[1]; Luma[7]  = Y[1];
-        Luma[8]  = Y[2]; Luma[9]  = Y[2]; Luma[10] = Y[3]; Luma[11] = Y[3];
-        Luma[12] = Y[2]; Luma[13] = Y[2]; Luma[14] = Y[3]; Luma[15] = Y[3];
-        break;
-    }
-
-    ulti_convert_yuv(frame, x, y, Luma, chroma);
-}
-
-static int ulti_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    UltimotionDecodeContext *s=avctx->priv_data;
-    int modifier = 0;
-    int uniq = 0;
-    int mode = 0;
-    int blocks = 0;
-    int done = 0;
-    int x = 0, y = 0;
-    int i;
-    int skip;
-    int tmp;
-
-    if(s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if(avctx->get_buffer(avctx, &s->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    while(!done) {
-        int idx;
-        if(blocks >= s->blocks || y >= s->height)
-            break;//all blocks decoded
-
-        idx = *buf++;
-        if((idx & 0xF8) == 0x70) {
-            switch(idx) {
-            case 0x70: //change modifier
-                modifier = *buf++;
-                if(modifier>1)
-                    av_log(avctx, AV_LOG_INFO, "warning: modifier must be 0 or 1, got %i\n", modifier);
-                break;
-            case 0x71: // set uniq flag
-                uniq = 1;
-                break;
-            case 0x72: //toggle mode
-                mode = !mode;
-                break;
-            case 0x73: //end-of-frame
-                done = 1;
-                break;
-            case 0x74: //skip some blocks
-                skip = *buf++;
-                if ((blocks + skip) >= s->blocks)
-                    break;
-                blocks += skip;
-                x += skip * 8;
-                while(x >= s->width) {
-                    x -= s->width;
-                    y += 8;
-                }
-                break;
-            default:
-                av_log(avctx, AV_LOG_INFO, "warning: unknown escape 0x%02X\n", idx);
-            }
-        } else { //handle one block
-            int code;
-            int cf;
-            int angle = 0;
-            uint8_t Y[4]; // luma samples of block
-            int tx = 0, ty = 0; //coords of subblock
-            int chroma = 0;
-            if (mode || uniq) {
-                uniq = 0;
-                cf = 1;
-                chroma = 0;
-            } else {
-                cf = 0;
-                if (idx)
-                    chroma = *buf++;
-            }
-            for (i = 0; i < 4; i++) { // for every subblock
-                code = (idx >> (6 - i*2)) & 3; //extract 2 bits
-                if(!code) //skip subblock
-                    continue;
-                if(cf)
-                    chroma = *buf++;
-                tx = x + block_coords[i * 2];
-                ty = y + block_coords[(i * 2) + 1];
-                switch(code) {
-                case 1:
-                    tmp = *buf++;
-
-                    angle = angle_by_index[(tmp >> 6) & 0x3];
-
-                    Y[0] = tmp & 0x3F;
-                    Y[1] = Y[0];
-
-                    if (angle) {
-                        Y[2] = Y[0]+1;
-                        if (Y[2] > 0x3F)
-                            Y[2] = 0x3F;
-                        Y[3] = Y[2];
-                    } else {
-                        Y[2] = Y[0];
-                        Y[3] = Y[0];
-                    }
-                    break;
-
-                case 2:
-                    if (modifier) { // unpack four luma samples
-                        tmp = bytestream_get_be24(&buf);
-
-                        Y[0] = (tmp >> 18) & 0x3F;
-                        Y[1] = (tmp >> 12) & 0x3F;
-                        Y[2] = (tmp >> 6) & 0x3F;
-                        Y[3] = tmp & 0x3F;
-                        angle = 16;
-                    } else { // retrieve luma samples from codebook
-                        tmp = bytestream_get_be16(&buf);
-
-                        angle = (tmp >> 12) & 0xF;
-                        tmp &= 0xFFF;
-                        tmp <<= 2;
-                        Y[0] = s->ulti_codebook[tmp];
-                        Y[1] = s->ulti_codebook[tmp + 1];
-                        Y[2] = s->ulti_codebook[tmp + 2];
-                        Y[3] = s->ulti_codebook[tmp + 3];
-                    }
-                    break;
-
-                case 3:
-                    if (modifier) { // all 16 luma samples
-                        uint8_t Luma[16];
-
-                        tmp = bytestream_get_be24(&buf);
-                        Luma[0] = (tmp >> 18) & 0x3F;
-                        Luma[1] = (tmp >> 12) & 0x3F;
-                        Luma[2] = (tmp >> 6) & 0x3F;
-                        Luma[3] = tmp & 0x3F;
-
-                        tmp = bytestream_get_be24(&buf);
-                        Luma[4] = (tmp >> 18) & 0x3F;
-                        Luma[5] = (tmp >> 12) & 0x3F;
-                        Luma[6] = (tmp >> 6) & 0x3F;
-                        Luma[7] = tmp & 0x3F;
-
-                        tmp = bytestream_get_be24(&buf);
-                        Luma[8] = (tmp >> 18) & 0x3F;
-                        Luma[9] = (tmp >> 12) & 0x3F;
-                        Luma[10] = (tmp >> 6) & 0x3F;
-                        Luma[11] = tmp & 0x3F;
-
-                        tmp = bytestream_get_be24(&buf);
-                        Luma[12] = (tmp >> 18) & 0x3F;
-                        Luma[13] = (tmp >> 12) & 0x3F;
-                        Luma[14] = (tmp >> 6) & 0x3F;
-                        Luma[15] = tmp & 0x3F;
-
-                        ulti_convert_yuv(&s->frame, tx, ty, Luma, chroma);
-                    } else {
-                        tmp = *buf++;
-                        if(tmp & 0x80) {
-                            angle = (tmp >> 4) & 0x7;
-                            tmp = (tmp << 8) + *buf++;
-                            Y[0] = (tmp >> 6) & 0x3F;
-                            Y[1] = tmp & 0x3F;
-                            Y[2] = (*buf++) & 0x3F;
-                            Y[3] = (*buf++) & 0x3F;
-                            ulti_grad(&s->frame, tx, ty, Y, chroma, angle); //draw block
-                        } else { // some patterns
-                            int f0, f1;
-                            f0 = *buf++;
-                            f1 = tmp;
-                            Y[0] = (*buf++) & 0x3F;
-                            Y[1] = (*buf++) & 0x3F;
-                            ulti_pattern(&s->frame, tx, ty, f1, f0, Y[0], Y[1], chroma);
-                        }
-                    }
-                    break;
-                }
-                if(code != 3)
-                    ulti_grad(&s->frame, tx, ty, Y, chroma, angle); // draw block
-            }
-            blocks++;
-                x += 8;
-            if(x >= s->width) {
-                x = 0;
-                y += 8;
-            }
-        }
-    }
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data= s->frame;
-
-    return buf_size;
-}
-
-AVCodec ulti_decoder = {
-    "ultimotion",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ULTI,
-    sizeof(UltimotionDecodeContext),
-    ulti_decode_init,
-    NULL,
-    ulti_decode_end,
-    ulti_decode_frame,
-    CODEC_CAP_DR1,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"),
-};
-
diff --git a/libavcodec/ulti_cb.h b/libavcodec/ulti_cb.h
deleted file mode 100644
index 7061d83..0000000
--- a/libavcodec/ulti_cb.h
+++ /dev/null
@@ -1,4124 +0,0 @@
-/*
- * IBM Ultimotion Video Decoder
- * copyright (C) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_ULTI_CB_H
-#define AVCODEC_ULTI_CB_H
-
-static const unsigned char ulti_codebook[16384]={
-    0x00, 0x01, 0x01, 0x02,
-    0x00, 0x01, 0x02, 0x03,
-    0x00, 0x02, 0x03, 0x04,
-    0x00, 0x01, 0x03, 0x04,
-    0x00, 0x01, 0x02, 0x04,
-    0x00, 0x02, 0x03, 0x05,
-    0x00, 0x02, 0x04, 0x05,
-    0x00, 0x01, 0x04, 0x05,
-    0x00, 0x01, 0x03, 0x05,
-    0x00, 0x02, 0x04, 0x06,
-    0x00, 0x03, 0x05, 0x06,
-    0x00, 0x01, 0x05, 0x06,
-    0x00, 0x01, 0x03, 0x06,
-    0x00, 0x06, 0x06, 0x06,
-    0x00, 0x00, 0x06, 0x06,
-    0x00, 0x00, 0x00, 0x06,
-    0x00, 0x03, 0x04, 0x07,
-    0x00, 0x03, 0x06, 0x07,
-    0x00, 0x01, 0x06, 0x07,
-    0x00, 0x01, 0x04, 0x07,
-    0x00, 0x03, 0x05, 0x08,
-    0x00, 0x04, 0x06, 0x08,
-    0x00, 0x02, 0x06, 0x08,
-    0x00, 0x02, 0x04, 0x08,
-    0x00, 0x08, 0x08, 0x08,
-    0x00, 0x00, 0x08, 0x08,
-    0x00, 0x00, 0x00, 0x08,
-    0x00, 0x04, 0x07, 0x0B,
-    0x00, 0x05, 0x09, 0x0B,
-    0x00, 0x02, 0x09, 0x0B,
-    0x00, 0x02, 0x06, 0x0B,
-    0x00, 0x0B, 0x0B, 0x0B,
-    0x00, 0x00, 0x0B, 0x0B,
-    0x00, 0x00, 0x00, 0x0B,
-    0x00, 0x05, 0x09, 0x0E,
-    0x00, 0x07, 0x0B, 0x0E,
-    0x00, 0x03, 0x0B, 0x0E,
-    0x00, 0x03, 0x07, 0x0E,
-    0x00, 0x0E, 0x0E, 0x0E,
-    0x00, 0x00, 0x0E, 0x0E,
-    0x00, 0x00, 0x00, 0x0E,
-    0x00, 0x06, 0x0B, 0x11,
-    0x00, 0x08, 0x0D, 0x11,
-    0x00, 0x04, 0x0D, 0x11,
-    0x00, 0x04, 0x09, 0x11,
-    0x00, 0x11, 0x11, 0x11,
-    0x00, 0x00, 0x11, 0x11,
-    0x00, 0x00, 0x00, 0x11,
-    0x00, 0x07, 0x0D, 0x14,
-    0x00, 0x0A, 0x0F, 0x14,
-    0x00, 0x05, 0x0F, 0x14,
-    0x00, 0x05, 0x0A, 0x14,
-    0x00, 0x14, 0x14, 0x14,
-    0x00, 0x00, 0x14, 0x14,
-    0x00, 0x00, 0x00, 0x14,
-    0x00, 0x0B, 0x12, 0x17,
-    0x00, 0x05, 0x12, 0x17,
-    0x00, 0x05, 0x0C, 0x17,
-    0x00, 0x17, 0x17, 0x17,
-    0x00, 0x00, 0x17, 0x17,
-    0x00, 0x00, 0x00, 0x17,
-    0x00, 0x0D, 0x14, 0x1A,
-    0x00, 0x06, 0x14, 0x1A,
-    0x00, 0x06, 0x0D, 0x1A,
-    0x00, 0x1A, 0x1A, 0x1A,
-    0x00, 0x00, 0x1A, 0x1A,
-    0x00, 0x00, 0x00, 0x1A,
-    0x00, 0x0E, 0x16, 0x1D,
-    0x00, 0x07, 0x16, 0x1D,
-    0x00, 0x07, 0x0F, 0x1D,
-    0x00, 0x1D, 0x1D, 0x1D,
-    0x00, 0x00, 0x1D, 0x1D,
-    0x00, 0x00, 0x00, 0x1D,
-    0x00, 0x10, 0x18, 0x20,
-    0x00, 0x08, 0x18, 0x20,
-    0x00, 0x08, 0x10, 0x20,
-    0x00, 0x20, 0x20, 0x20,
-    0x00, 0x00, 0x20, 0x20,
-    0x00, 0x00, 0x00, 0x20,
-    0x00, 0x23, 0x23, 0x23,
-    0x00, 0x00, 0x23, 0x23,
-    0x00, 0x00, 0x00, 0x23,
-    0x00, 0x12, 0x1B, 0x24,
-    0x00, 0x09, 0x1B, 0x24,
-    0x00, 0x09, 0x12, 0x24,
-    0x00, 0x28, 0x28, 0x28,
-    0x00, 0x00, 0x28, 0x28,
-    0x00, 0x00, 0x00, 0x28,
-    0x00, 0x2E, 0x2E, 0x2E,
-    0x00, 0x00, 0x2E, 0x2E,
-    0x00, 0x00, 0x00, 0x2E,
-    0x01, 0x02, 0x02, 0x03,
-    0x01, 0x02, 0x03, 0x04,
-    0x01, 0x03, 0x04, 0x05,
-    0x01, 0x02, 0x04, 0x05,
-    0x01, 0x02, 0x03, 0x05,
-    0x01, 0x03, 0x04, 0x06,
-    0x01, 0x03, 0x05, 0x06,
-    0x01, 0x02, 0x05, 0x06,
-    0x01, 0x02, 0x04, 0x06,
-    0x01, 0x03, 0x05, 0x07,
-    0x01, 0x04, 0x06, 0x07,
-    0x01, 0x02, 0x06, 0x07,
-    0x01, 0x02, 0x04, 0x07,
-    0x01, 0x07, 0x07, 0x07,
-    0x01, 0x01, 0x07, 0x07,
-    0x01, 0x01, 0x01, 0x07,
-    0x01, 0x04, 0x05, 0x08,
-    0x01, 0x04, 0x07, 0x08,
-    0x01, 0x02, 0x07, 0x08,
-    0x01, 0x02, 0x05, 0x08,
-    0x01, 0x04, 0x06, 0x09,
-    0x01, 0x05, 0x07, 0x09,
-    0x01, 0x03, 0x07, 0x09,
-    0x01, 0x03, 0x05, 0x09,
-    0x01, 0x09, 0x09, 0x09,
-    0x01, 0x01, 0x09, 0x09,
-    0x01, 0x01, 0x01, 0x09,
-    0x01, 0x05, 0x08, 0x0C,
-    0x01, 0x06, 0x0A, 0x0C,
-    0x01, 0x03, 0x0A, 0x0C,
-    0x01, 0x03, 0x07, 0x0C,
-    0x01, 0x0C, 0x0C, 0x0C,
-    0x01, 0x01, 0x0C, 0x0C,
-    0x01, 0x01, 0x01, 0x0C,
-    0x01, 0x06, 0x0A, 0x0F,
-    0x01, 0x08, 0x0C, 0x0F,
-    0x01, 0x04, 0x0C, 0x0F,
-    0x01, 0x04, 0x08, 0x0F,
-    0x01, 0x0F, 0x0F, 0x0F,
-    0x01, 0x01, 0x0F, 0x0F,
-    0x01, 0x01, 0x01, 0x0F,
-    0x01, 0x07, 0x0C, 0x12,
-    0x01, 0x09, 0x0E, 0x12,
-    0x01, 0x05, 0x0E, 0x12,
-    0x01, 0x05, 0x0A, 0x12,
-    0x01, 0x12, 0x12, 0x12,
-    0x01, 0x01, 0x12, 0x12,
-    0x01, 0x01, 0x01, 0x12,
-    0x01, 0x08, 0x0E, 0x15,
-    0x01, 0x0B, 0x10, 0x15,
-    0x01, 0x06, 0x10, 0x15,
-    0x01, 0x06, 0x0B, 0x15,
-    0x01, 0x15, 0x15, 0x15,
-    0x01, 0x01, 0x15, 0x15,
-    0x01, 0x01, 0x01, 0x15,
-    0x01, 0x0C, 0x13, 0x18,
-    0x01, 0x06, 0x13, 0x18,
-    0x01, 0x06, 0x0D, 0x18,
-    0x01, 0x18, 0x18, 0x18,
-    0x01, 0x01, 0x18, 0x18,
-    0x01, 0x01, 0x01, 0x18,
-    0x01, 0x0E, 0x15, 0x1B,
-    0x01, 0x07, 0x15, 0x1B,
-    0x01, 0x07, 0x0E, 0x1B,
-    0x01, 0x1B, 0x1B, 0x1B,
-    0x01, 0x01, 0x1B, 0x1B,
-    0x01, 0x01, 0x01, 0x1B,
-    0x01, 0x0F, 0x17, 0x1E,
-    0x01, 0x08, 0x17, 0x1E,
-    0x01, 0x08, 0x10, 0x1E,
-    0x01, 0x1E, 0x1E, 0x1E,
-    0x01, 0x01, 0x1E, 0x1E,
-    0x01, 0x01, 0x01, 0x1E,
-    0x01, 0x11, 0x19, 0x21,
-    0x01, 0x09, 0x19, 0x21,
-    0x01, 0x09, 0x11, 0x21,
-    0x01, 0x21, 0x21, 0x21,
-    0x01, 0x01, 0x21, 0x21,
-    0x01, 0x01, 0x01, 0x21,
-    0x01, 0x24, 0x24, 0x24,
-    0x01, 0x01, 0x24, 0x24,
-    0x01, 0x01, 0x01, 0x24,
-    0x01, 0x13, 0x1C, 0x25,
-    0x01, 0x0A, 0x1C, 0x25,
-    0x01, 0x0A, 0x13, 0x25,
-    0x01, 0x29, 0x29, 0x29,
-    0x01, 0x01, 0x29, 0x29,
-    0x01, 0x01, 0x01, 0x29,
-    0x01, 0x2F, 0x2F, 0x2F,
-    0x01, 0x01, 0x2F, 0x2F,
-    0x01, 0x01, 0x01, 0x2F,
-    0x02, 0x03, 0x03, 0x04,
-    0x02, 0x03, 0x04, 0x05,
-    0x02, 0x04, 0x05, 0x06,
-    0x02, 0x03, 0x05, 0x06,
-    0x02, 0x03, 0x04, 0x06,
-    0x02, 0x04, 0x05, 0x07,
-    0x02, 0x04, 0x06, 0x07,
-    0x02, 0x03, 0x06, 0x07,
-    0x02, 0x03, 0x05, 0x07,
-    0x02, 0x04, 0x06, 0x08,
-    0x02, 0x05, 0x07, 0x08,
-    0x02, 0x03, 0x07, 0x08,
-    0x02, 0x03, 0x05, 0x08,
-    0x02, 0x08, 0x08, 0x08,
-    0x02, 0x02, 0x08, 0x08,
-    0x02, 0x02, 0x02, 0x08,
-    0x02, 0x05, 0x06, 0x09,
-    0x02, 0x05, 0x08, 0x09,
-    0x02, 0x03, 0x08, 0x09,
-    0x02, 0x03, 0x06, 0x09,
-    0x02, 0x05, 0x07, 0x0A,
-    0x02, 0x06, 0x08, 0x0A,
-    0x02, 0x04, 0x08, 0x0A,
-    0x02, 0x04, 0x06, 0x0A,
-    0x02, 0x0A, 0x0A, 0x0A,
-    0x02, 0x02, 0x0A, 0x0A,
-    0x02, 0x02, 0x02, 0x0A,
-    0x02, 0x06, 0x09, 0x0D,
-    0x02, 0x07, 0x0B, 0x0D,
-    0x02, 0x04, 0x0B, 0x0D,
-    0x02, 0x04, 0x08, 0x0D,
-    0x02, 0x0D, 0x0D, 0x0D,
-    0x02, 0x02, 0x0D, 0x0D,
-    0x02, 0x02, 0x02, 0x0D,
-    0x02, 0x07, 0x0B, 0x10,
-    0x02, 0x09, 0x0D, 0x10,
-    0x02, 0x05, 0x0D, 0x10,
-    0x02, 0x05, 0x09, 0x10,
-    0x02, 0x10, 0x10, 0x10,
-    0x02, 0x02, 0x10, 0x10,
-    0x02, 0x02, 0x02, 0x10,
-    0x02, 0x08, 0x0D, 0x13,
-    0x02, 0x0A, 0x0F, 0x13,
-    0x02, 0x06, 0x0F, 0x13,
-    0x02, 0x06, 0x0B, 0x13,
-    0x02, 0x13, 0x13, 0x13,
-    0x02, 0x02, 0x13, 0x13,
-    0x02, 0x02, 0x02, 0x13,
-    0x02, 0x09, 0x0F, 0x16,
-    0x02, 0x0C, 0x11, 0x16,
-    0x02, 0x07, 0x11, 0x16,
-    0x02, 0x07, 0x0C, 0x16,
-    0x02, 0x16, 0x16, 0x16,
-    0x02, 0x02, 0x16, 0x16,
-    0x02, 0x02, 0x02, 0x16,
-    0x02, 0x0D, 0x14, 0x19,
-    0x02, 0x07, 0x14, 0x19,
-    0x02, 0x07, 0x0E, 0x19,
-    0x02, 0x19, 0x19, 0x19,
-    0x02, 0x02, 0x19, 0x19,
-    0x02, 0x02, 0x02, 0x19,
-    0x02, 0x0F, 0x16, 0x1C,
-    0x02, 0x08, 0x16, 0x1C,
-    0x02, 0x08, 0x0F, 0x1C,
-    0x02, 0x1C, 0x1C, 0x1C,
-    0x02, 0x02, 0x1C, 0x1C,
-    0x02, 0x02, 0x02, 0x1C,
-    0x02, 0x10, 0x18, 0x1F,
-    0x02, 0x09, 0x18, 0x1F,
-    0x02, 0x09, 0x11, 0x1F,
-    0x02, 0x1F, 0x1F, 0x1F,
-    0x02, 0x02, 0x1F, 0x1F,
-    0x02, 0x02, 0x02, 0x1F,
-    0x02, 0x12, 0x1A, 0x22,
-    0x02, 0x0A, 0x1A, 0x22,
-    0x02, 0x0A, 0x12, 0x22,
-    0x02, 0x22, 0x22, 0x22,
-    0x02, 0x02, 0x22, 0x22,
-    0x02, 0x02, 0x02, 0x22,
-    0x02, 0x25, 0x25, 0x25,
-    0x02, 0x02, 0x25, 0x25,
-    0x02, 0x02, 0x02, 0x25,
-    0x02, 0x14, 0x1D, 0x26,
-    0x02, 0x0B, 0x1D, 0x26,
-    0x02, 0x0B, 0x14, 0x26,
-    0x02, 0x2A, 0x2A, 0x2A,
-    0x02, 0x02, 0x2A, 0x2A,
-    0x02, 0x02, 0x02, 0x2A,
-    0x02, 0x30, 0x30, 0x30,
-    0x02, 0x02, 0x30, 0x30,
-    0x02, 0x02, 0x02, 0x30,
-    0x03, 0x04, 0x04, 0x05,
-    0x03, 0x04, 0x05, 0x06,
-    0x03, 0x05, 0x06, 0x07,
-    0x03, 0x04, 0x06, 0x07,
-    0x03, 0x04, 0x05, 0x07,
-    0x03, 0x05, 0x06, 0x08,
-    0x03, 0x05, 0x07, 0x08,
-    0x03, 0x04, 0x07, 0x08,
-    0x03, 0x04, 0x06, 0x08,
-    0x03, 0x05, 0x07, 0x09,
-    0x03, 0x06, 0x08, 0x09,
-    0x03, 0x04, 0x08, 0x09,
-    0x03, 0x04, 0x06, 0x09,
-    0x03, 0x09, 0x09, 0x09,
-    0x03, 0x03, 0x09, 0x09,
-    0x03, 0x03, 0x03, 0x09,
-    0x03, 0x06, 0x07, 0x0A,
-    0x03, 0x06, 0x09, 0x0A,
-    0x03, 0x04, 0x09, 0x0A,
-    0x03, 0x04, 0x07, 0x0A,
-    0x03, 0x06, 0x08, 0x0B,
-    0x03, 0x07, 0x09, 0x0B,
-    0x03, 0x05, 0x09, 0x0B,
-    0x03, 0x05, 0x07, 0x0B,
-    0x03, 0x0B, 0x0B, 0x0B,
-    0x03, 0x03, 0x0B, 0x0B,
-    0x03, 0x03, 0x03, 0x0B,
-    0x03, 0x07, 0x0A, 0x0E,
-    0x03, 0x08, 0x0C, 0x0E,
-    0x03, 0x05, 0x0C, 0x0E,
-    0x03, 0x05, 0x09, 0x0E,
-    0x03, 0x0E, 0x0E, 0x0E,
-    0x03, 0x03, 0x0E, 0x0E,
-    0x03, 0x03, 0x03, 0x0E,
-    0x03, 0x08, 0x0C, 0x11,
-    0x03, 0x0A, 0x0E, 0x11,
-    0x03, 0x06, 0x0E, 0x11,
-    0x03, 0x06, 0x0A, 0x11,
-    0x03, 0x11, 0x11, 0x11,
-    0x03, 0x03, 0x11, 0x11,
-    0x03, 0x03, 0x03, 0x11,
-    0x03, 0x09, 0x0E, 0x14,
-    0x03, 0x0B, 0x10, 0x14,
-    0x03, 0x07, 0x10, 0x14,
-    0x03, 0x07, 0x0C, 0x14,
-    0x03, 0x14, 0x14, 0x14,
-    0x03, 0x03, 0x14, 0x14,
-    0x03, 0x03, 0x03, 0x14,
-    0x03, 0x0A, 0x10, 0x17,
-    0x03, 0x0D, 0x12, 0x17,
-    0x03, 0x08, 0x12, 0x17,
-    0x03, 0x08, 0x0D, 0x17,
-    0x03, 0x17, 0x17, 0x17,
-    0x03, 0x03, 0x17, 0x17,
-    0x03, 0x03, 0x03, 0x17,
-    0x03, 0x0E, 0x15, 0x1A,
-    0x03, 0x08, 0x15, 0x1A,
-    0x03, 0x08, 0x0F, 0x1A,
-    0x03, 0x1A, 0x1A, 0x1A,
-    0x03, 0x03, 0x1A, 0x1A,
-    0x03, 0x03, 0x03, 0x1A,
-    0x03, 0x10, 0x17, 0x1D,
-    0x03, 0x09, 0x17, 0x1D,
-    0x03, 0x09, 0x10, 0x1D,
-    0x03, 0x1D, 0x1D, 0x1D,
-    0x03, 0x03, 0x1D, 0x1D,
-    0x03, 0x03, 0x03, 0x1D,
-    0x03, 0x11, 0x19, 0x20,
-    0x03, 0x0A, 0x19, 0x20,
-    0x03, 0x0A, 0x12, 0x20,
-    0x03, 0x20, 0x20, 0x20,
-    0x03, 0x03, 0x20, 0x20,
-    0x03, 0x03, 0x03, 0x20,
-    0x03, 0x13, 0x1B, 0x23,
-    0x03, 0x0B, 0x1B, 0x23,
-    0x03, 0x0B, 0x13, 0x23,
-    0x03, 0x23, 0x23, 0x23,
-    0x03, 0x03, 0x23, 0x23,
-    0x03, 0x03, 0x03, 0x23,
-    0x03, 0x26, 0x26, 0x26,
-    0x03, 0x03, 0x26, 0x26,
-    0x03, 0x03, 0x03, 0x26,
-    0x03, 0x15, 0x1E, 0x27,
-    0x03, 0x0C, 0x1E, 0x27,
-    0x03, 0x0C, 0x15, 0x27,
-    0x03, 0x2B, 0x2B, 0x2B,
-    0x03, 0x03, 0x2B, 0x2B,
-    0x03, 0x03, 0x03, 0x2B,
-    0x03, 0x31, 0x31, 0x31,
-    0x03, 0x03, 0x31, 0x31,
-    0x03, 0x03, 0x03, 0x31,
-    0x04, 0x05, 0x05, 0x06,
-    0x04, 0x05, 0x06, 0x07,
-    0x04, 0x06, 0x07, 0x08,
-    0x04, 0x05, 0x07, 0x08,
-    0x04, 0x05, 0x06, 0x08,
-    0x04, 0x06, 0x07, 0x09,
-    0x04, 0x06, 0x08, 0x09,
-    0x04, 0x05, 0x08, 0x09,
-    0x04, 0x05, 0x07, 0x09,
-    0x04, 0x06, 0x08, 0x0A,
-    0x04, 0x07, 0x09, 0x0A,
-    0x04, 0x05, 0x09, 0x0A,
-    0x04, 0x05, 0x07, 0x0A,
-    0x04, 0x0A, 0x0A, 0x0A,
-    0x04, 0x04, 0x0A, 0x0A,
-    0x04, 0x04, 0x04, 0x0A,
-    0x04, 0x07, 0x08, 0x0B,
-    0x04, 0x07, 0x0A, 0x0B,
-    0x04, 0x05, 0x0A, 0x0B,
-    0x04, 0x05, 0x08, 0x0B,
-    0x04, 0x07, 0x09, 0x0C,
-    0x04, 0x08, 0x0A, 0x0C,
-    0x04, 0x06, 0x0A, 0x0C,
-    0x04, 0x06, 0x08, 0x0C,
-    0x04, 0x0C, 0x0C, 0x0C,
-    0x04, 0x04, 0x0C, 0x0C,
-    0x04, 0x04, 0x04, 0x0C,
-    0x04, 0x08, 0x0B, 0x0F,
-    0x04, 0x09, 0x0D, 0x0F,
-    0x04, 0x06, 0x0D, 0x0F,
-    0x04, 0x06, 0x0A, 0x0F,
-    0x04, 0x0F, 0x0F, 0x0F,
-    0x04, 0x04, 0x0F, 0x0F,
-    0x04, 0x04, 0x04, 0x0F,
-    0x04, 0x09, 0x0D, 0x12,
-    0x04, 0x0B, 0x0F, 0x12,
-    0x04, 0x07, 0x0F, 0x12,
-    0x04, 0x07, 0x0B, 0x12,
-    0x04, 0x12, 0x12, 0x12,
-    0x04, 0x04, 0x12, 0x12,
-    0x04, 0x04, 0x04, 0x12,
-    0x04, 0x0A, 0x0F, 0x15,
-    0x04, 0x0C, 0x11, 0x15,
-    0x04, 0x08, 0x11, 0x15,
-    0x04, 0x08, 0x0D, 0x15,
-    0x04, 0x15, 0x15, 0x15,
-    0x04, 0x04, 0x15, 0x15,
-    0x04, 0x04, 0x04, 0x15,
-    0x04, 0x0B, 0x11, 0x18,
-    0x04, 0x0E, 0x13, 0x18,
-    0x04, 0x09, 0x13, 0x18,
-    0x04, 0x09, 0x0E, 0x18,
-    0x04, 0x18, 0x18, 0x18,
-    0x04, 0x04, 0x18, 0x18,
-    0x04, 0x04, 0x04, 0x18,
-    0x04, 0x0F, 0x16, 0x1B,
-    0x04, 0x09, 0x16, 0x1B,
-    0x04, 0x09, 0x10, 0x1B,
-    0x04, 0x1B, 0x1B, 0x1B,
-    0x04, 0x04, 0x1B, 0x1B,
-    0x04, 0x04, 0x04, 0x1B,
-    0x04, 0x11, 0x18, 0x1E,
-    0x04, 0x0A, 0x18, 0x1E,
-    0x04, 0x0A, 0x11, 0x1E,
-    0x04, 0x1E, 0x1E, 0x1E,
-    0x04, 0x04, 0x1E, 0x1E,
-    0x04, 0x04, 0x04, 0x1E,
-    0x04, 0x12, 0x1A, 0x21,
-    0x04, 0x0B, 0x1A, 0x21,
-    0x04, 0x0B, 0x13, 0x21,
-    0x04, 0x21, 0x21, 0x21,
-    0x04, 0x04, 0x21, 0x21,
-    0x04, 0x04, 0x04, 0x21,
-    0x04, 0x14, 0x1C, 0x24,
-    0x04, 0x0C, 0x1C, 0x24,
-    0x04, 0x0C, 0x14, 0x24,
-    0x04, 0x24, 0x24, 0x24,
-    0x04, 0x04, 0x24, 0x24,
-    0x04, 0x04, 0x04, 0x24,
-    0x04, 0x27, 0x27, 0x27,
-    0x04, 0x04, 0x27, 0x27,
-    0x04, 0x04, 0x04, 0x27,
-    0x04, 0x16, 0x1F, 0x28,
-    0x04, 0x0D, 0x1F, 0x28,
-    0x04, 0x0D, 0x16, 0x28,
-    0x04, 0x2C, 0x2C, 0x2C,
-    0x04, 0x04, 0x2C, 0x2C,
-    0x04, 0x04, 0x04, 0x2C,
-    0x04, 0x32, 0x32, 0x32,
-    0x04, 0x04, 0x32, 0x32,
-    0x04, 0x04, 0x04, 0x32,
-    0x05, 0x06, 0x06, 0x07,
-    0x05, 0x06, 0x07, 0x08,
-    0x05, 0x07, 0x08, 0x09,
-    0x05, 0x06, 0x08, 0x09,
-    0x05, 0x06, 0x07, 0x09,
-    0x05, 0x07, 0x08, 0x0A,
-    0x05, 0x07, 0x09, 0x0A,
-    0x05, 0x06, 0x09, 0x0A,
-    0x05, 0x06, 0x08, 0x0A,
-    0x05, 0x07, 0x09, 0x0B,
-    0x05, 0x08, 0x0A, 0x0B,
-    0x05, 0x06, 0x0A, 0x0B,
-    0x05, 0x06, 0x08, 0x0B,
-    0x05, 0x0B, 0x0B, 0x0B,
-    0x05, 0x05, 0x0B, 0x0B,
-    0x05, 0x05, 0x05, 0x0B,
-    0x05, 0x08, 0x09, 0x0C,
-    0x05, 0x08, 0x0B, 0x0C,
-    0x05, 0x06, 0x0B, 0x0C,
-    0x05, 0x06, 0x09, 0x0C,
-    0x05, 0x08, 0x0A, 0x0D,
-    0x05, 0x09, 0x0B, 0x0D,
-    0x05, 0x07, 0x0B, 0x0D,
-    0x05, 0x07, 0x09, 0x0D,
-    0x05, 0x0D, 0x0D, 0x0D,
-    0x05, 0x05, 0x0D, 0x0D,
-    0x05, 0x05, 0x05, 0x0D,
-    0x05, 0x09, 0x0C, 0x10,
-    0x05, 0x0A, 0x0E, 0x10,
-    0x05, 0x07, 0x0E, 0x10,
-    0x05, 0x07, 0x0B, 0x10,
-    0x05, 0x10, 0x10, 0x10,
-    0x05, 0x05, 0x10, 0x10,
-    0x05, 0x05, 0x05, 0x10,
-    0x05, 0x0A, 0x0E, 0x13,
-    0x05, 0x0C, 0x10, 0x13,
-    0x05, 0x08, 0x10, 0x13,
-    0x05, 0x08, 0x0C, 0x13,
-    0x05, 0x13, 0x13, 0x13,
-    0x05, 0x05, 0x13, 0x13,
-    0x05, 0x05, 0x05, 0x13,
-    0x05, 0x0B, 0x10, 0x16,
-    0x05, 0x0D, 0x12, 0x16,
-    0x05, 0x09, 0x12, 0x16,
-    0x05, 0x09, 0x0E, 0x16,
-    0x05, 0x16, 0x16, 0x16,
-    0x05, 0x05, 0x16, 0x16,
-    0x05, 0x05, 0x05, 0x16,
-    0x05, 0x0C, 0x12, 0x19,
-    0x05, 0x0F, 0x14, 0x19,
-    0x05, 0x0A, 0x14, 0x19,
-    0x05, 0x0A, 0x0F, 0x19,
-    0x05, 0x19, 0x19, 0x19,
-    0x05, 0x05, 0x19, 0x19,
-    0x05, 0x05, 0x05, 0x19,
-    0x05, 0x10, 0x17, 0x1C,
-    0x05, 0x0A, 0x17, 0x1C,
-    0x05, 0x0A, 0x11, 0x1C,
-    0x05, 0x1C, 0x1C, 0x1C,
-    0x05, 0x05, 0x1C, 0x1C,
-    0x05, 0x05, 0x05, 0x1C,
-    0x05, 0x12, 0x19, 0x1F,
-    0x05, 0x0B, 0x19, 0x1F,
-    0x05, 0x0B, 0x12, 0x1F,
-    0x05, 0x1F, 0x1F, 0x1F,
-    0x05, 0x05, 0x1F, 0x1F,
-    0x05, 0x05, 0x05, 0x1F,
-    0x05, 0x13, 0x1B, 0x22,
-    0x05, 0x0C, 0x1B, 0x22,
-    0x05, 0x0C, 0x14, 0x22,
-    0x05, 0x22, 0x22, 0x22,
-    0x05, 0x05, 0x22, 0x22,
-    0x05, 0x05, 0x05, 0x22,
-    0x05, 0x15, 0x1D, 0x25,
-    0x05, 0x0D, 0x1D, 0x25,
-    0x05, 0x0D, 0x15, 0x25,
-    0x05, 0x25, 0x25, 0x25,
-    0x05, 0x05, 0x25, 0x25,
-    0x05, 0x05, 0x05, 0x25,
-    0x05, 0x28, 0x28, 0x28,
-    0x05, 0x05, 0x28, 0x28,
-    0x05, 0x05, 0x05, 0x28,
-    0x05, 0x17, 0x20, 0x29,
-    0x05, 0x0E, 0x20, 0x29,
-    0x05, 0x0E, 0x17, 0x29,
-    0x05, 0x2D, 0x2D, 0x2D,
-    0x05, 0x05, 0x2D, 0x2D,
-    0x05, 0x05, 0x05, 0x2D,
-    0x05, 0x33, 0x33, 0x33,
-    0x05, 0x05, 0x33, 0x33,
-    0x05, 0x05, 0x05, 0x33,
-    0x06, 0x07, 0x07, 0x08,
-    0x06, 0x07, 0x08, 0x09,
-    0x06, 0x08, 0x09, 0x0A,
-    0x06, 0x07, 0x09, 0x0A,
-    0x06, 0x07, 0x08, 0x0A,
-    0x06, 0x08, 0x09, 0x0B,
-    0x06, 0x08, 0x0A, 0x0B,
-    0x06, 0x07, 0x0A, 0x0B,
-    0x06, 0x07, 0x09, 0x0B,
-    0x06, 0x08, 0x0A, 0x0C,
-    0x06, 0x09, 0x0B, 0x0C,
-    0x06, 0x07, 0x0B, 0x0C,
-    0x06, 0x07, 0x09, 0x0C,
-    0x06, 0x0C, 0x0C, 0x0C,
-    0x06, 0x06, 0x0C, 0x0C,
-    0x06, 0x06, 0x06, 0x0C,
-    0x06, 0x09, 0x0A, 0x0D,
-    0x06, 0x09, 0x0C, 0x0D,
-    0x06, 0x07, 0x0C, 0x0D,
-    0x06, 0x07, 0x0A, 0x0D,
-    0x06, 0x09, 0x0B, 0x0E,
-    0x06, 0x0A, 0x0C, 0x0E,
-    0x06, 0x08, 0x0C, 0x0E,
-    0x06, 0x08, 0x0A, 0x0E,
-    0x06, 0x0E, 0x0E, 0x0E,
-    0x06, 0x06, 0x0E, 0x0E,
-    0x06, 0x06, 0x06, 0x0E,
-    0x06, 0x0A, 0x0D, 0x11,
-    0x06, 0x0B, 0x0F, 0x11,
-    0x06, 0x08, 0x0F, 0x11,
-    0x06, 0x08, 0x0C, 0x11,
-    0x06, 0x11, 0x11, 0x11,
-    0x06, 0x06, 0x11, 0x11,
-    0x06, 0x06, 0x06, 0x11,
-    0x06, 0x0B, 0x0F, 0x14,
-    0x06, 0x0D, 0x11, 0x14,
-    0x06, 0x09, 0x11, 0x14,
-    0x06, 0x09, 0x0D, 0x14,
-    0x06, 0x14, 0x14, 0x14,
-    0x06, 0x06, 0x14, 0x14,
-    0x06, 0x06, 0x06, 0x14,
-    0x06, 0x0C, 0x11, 0x17,
-    0x06, 0x0E, 0x13, 0x17,
-    0x06, 0x0A, 0x13, 0x17,
-    0x06, 0x0A, 0x0F, 0x17,
-    0x06, 0x17, 0x17, 0x17,
-    0x06, 0x06, 0x17, 0x17,
-    0x06, 0x06, 0x06, 0x17,
-    0x06, 0x0D, 0x13, 0x1A,
-    0x06, 0x10, 0x15, 0x1A,
-    0x06, 0x0B, 0x15, 0x1A,
-    0x06, 0x0B, 0x10, 0x1A,
-    0x06, 0x1A, 0x1A, 0x1A,
-    0x06, 0x06, 0x1A, 0x1A,
-    0x06, 0x06, 0x06, 0x1A,
-    0x06, 0x11, 0x18, 0x1D,
-    0x06, 0x0B, 0x18, 0x1D,
-    0x06, 0x0B, 0x12, 0x1D,
-    0x06, 0x1D, 0x1D, 0x1D,
-    0x06, 0x06, 0x1D, 0x1D,
-    0x06, 0x06, 0x06, 0x1D,
-    0x06, 0x13, 0x1A, 0x20,
-    0x06, 0x0C, 0x1A, 0x20,
-    0x06, 0x0C, 0x13, 0x20,
-    0x06, 0x20, 0x20, 0x20,
-    0x06, 0x06, 0x20, 0x20,
-    0x06, 0x06, 0x06, 0x20,
-    0x06, 0x14, 0x1C, 0x23,
-    0x06, 0x0D, 0x1C, 0x23,
-    0x06, 0x0D, 0x15, 0x23,
-    0x06, 0x23, 0x23, 0x23,
-    0x06, 0x06, 0x23, 0x23,
-    0x06, 0x06, 0x06, 0x23,
-    0x06, 0x16, 0x1E, 0x26,
-    0x06, 0x0E, 0x1E, 0x26,
-    0x06, 0x0E, 0x16, 0x26,
-    0x06, 0x26, 0x26, 0x26,
-    0x06, 0x06, 0x26, 0x26,
-    0x06, 0x06, 0x06, 0x26,
-    0x06, 0x29, 0x29, 0x29,
-    0x06, 0x06, 0x29, 0x29,
-    0x06, 0x06, 0x06, 0x29,
-    0x06, 0x18, 0x21, 0x2A,
-    0x06, 0x0F, 0x21, 0x2A,
-    0x06, 0x0F, 0x18, 0x2A,
-    0x06, 0x2E, 0x2E, 0x2E,
-    0x06, 0x06, 0x2E, 0x2E,
-    0x06, 0x06, 0x06, 0x2E,
-    0x06, 0x34, 0x34, 0x34,
-    0x06, 0x06, 0x34, 0x34,
-    0x06, 0x06, 0x06, 0x34,
-    0x07, 0x08, 0x08, 0x09,
-    0x07, 0x08, 0x09, 0x0A,
-    0x07, 0x09, 0x0A, 0x0B,
-    0x07, 0x08, 0x0A, 0x0B,
-    0x07, 0x08, 0x09, 0x0B,
-    0x07, 0x09, 0x0A, 0x0C,
-    0x07, 0x09, 0x0B, 0x0C,
-    0x07, 0x08, 0x0B, 0x0C,
-    0x07, 0x08, 0x0A, 0x0C,
-    0x07, 0x09, 0x0B, 0x0D,
-    0x07, 0x0A, 0x0C, 0x0D,
-    0x07, 0x08, 0x0C, 0x0D,
-    0x07, 0x08, 0x0A, 0x0D,
-    0x07, 0x0D, 0x0D, 0x0D,
-    0x07, 0x07, 0x0D, 0x0D,
-    0x07, 0x07, 0x07, 0x0D,
-    0x07, 0x0A, 0x0B, 0x0E,
-    0x07, 0x0A, 0x0D, 0x0E,
-    0x07, 0x08, 0x0D, 0x0E,
-    0x07, 0x08, 0x0B, 0x0E,
-    0x07, 0x0A, 0x0C, 0x0F,
-    0x07, 0x0B, 0x0D, 0x0F,
-    0x07, 0x09, 0x0D, 0x0F,
-    0x07, 0x09, 0x0B, 0x0F,
-    0x07, 0x0F, 0x0F, 0x0F,
-    0x07, 0x07, 0x0F, 0x0F,
-    0x07, 0x07, 0x07, 0x0F,
-    0x07, 0x0B, 0x0E, 0x12,
-    0x07, 0x0C, 0x10, 0x12,
-    0x07, 0x09, 0x10, 0x12,
-    0x07, 0x09, 0x0D, 0x12,
-    0x07, 0x12, 0x12, 0x12,
-    0x07, 0x07, 0x12, 0x12,
-    0x07, 0x07, 0x07, 0x12,
-    0x07, 0x0C, 0x10, 0x15,
-    0x07, 0x0E, 0x12, 0x15,
-    0x07, 0x0A, 0x12, 0x15,
-    0x07, 0x0A, 0x0E, 0x15,
-    0x07, 0x15, 0x15, 0x15,
-    0x07, 0x07, 0x15, 0x15,
-    0x07, 0x07, 0x07, 0x15,
-    0x07, 0x0D, 0x12, 0x18,
-    0x07, 0x0F, 0x14, 0x18,
-    0x07, 0x0B, 0x14, 0x18,
-    0x07, 0x0B, 0x10, 0x18,
-    0x07, 0x18, 0x18, 0x18,
-    0x07, 0x07, 0x18, 0x18,
-    0x07, 0x07, 0x07, 0x18,
-    0x07, 0x0E, 0x14, 0x1B,
-    0x07, 0x11, 0x16, 0x1B,
-    0x07, 0x0C, 0x16, 0x1B,
-    0x07, 0x0C, 0x11, 0x1B,
-    0x07, 0x1B, 0x1B, 0x1B,
-    0x07, 0x07, 0x1B, 0x1B,
-    0x07, 0x07, 0x07, 0x1B,
-    0x07, 0x12, 0x19, 0x1E,
-    0x07, 0x0C, 0x19, 0x1E,
-    0x07, 0x0C, 0x13, 0x1E,
-    0x07, 0x1E, 0x1E, 0x1E,
-    0x07, 0x07, 0x1E, 0x1E,
-    0x07, 0x07, 0x07, 0x1E,
-    0x07, 0x14, 0x1B, 0x21,
-    0x07, 0x0D, 0x1B, 0x21,
-    0x07, 0x0D, 0x14, 0x21,
-    0x07, 0x21, 0x21, 0x21,
-    0x07, 0x07, 0x21, 0x21,
-    0x07, 0x07, 0x07, 0x21,
-    0x07, 0x15, 0x1D, 0x24,
-    0x07, 0x0E, 0x1D, 0x24,
-    0x07, 0x0E, 0x16, 0x24,
-    0x07, 0x24, 0x24, 0x24,
-    0x07, 0x07, 0x24, 0x24,
-    0x07, 0x07, 0x07, 0x24,
-    0x07, 0x17, 0x1F, 0x27,
-    0x07, 0x0F, 0x1F, 0x27,
-    0x07, 0x0F, 0x17, 0x27,
-    0x07, 0x27, 0x27, 0x27,
-    0x07, 0x07, 0x27, 0x27,
-    0x07, 0x07, 0x07, 0x27,
-    0x07, 0x2A, 0x2A, 0x2A,
-    0x07, 0x07, 0x2A, 0x2A,
-    0x07, 0x07, 0x07, 0x2A,
-    0x07, 0x19, 0x22, 0x2B,
-    0x07, 0x10, 0x22, 0x2B,
-    0x07, 0x10, 0x19, 0x2B,
-    0x07, 0x2F, 0x2F, 0x2F,
-    0x07, 0x07, 0x2F, 0x2F,
-    0x07, 0x07, 0x07, 0x2F,
-    0x07, 0x35, 0x35, 0x35,
-    0x07, 0x07, 0x35, 0x35,
-    0x07, 0x07, 0x07, 0x35,
-    0x08, 0x09, 0x09, 0x0A,
-    0x08, 0x09, 0x0A, 0x0B,
-    0x08, 0x0A, 0x0B, 0x0C,
-    0x08, 0x09, 0x0B, 0x0C,
-    0x08, 0x09, 0x0A, 0x0C,
-    0x08, 0x0A, 0x0B, 0x0D,
-    0x08, 0x0A, 0x0C, 0x0D,
-    0x08, 0x09, 0x0C, 0x0D,
-    0x08, 0x09, 0x0B, 0x0D,
-    0x08, 0x0A, 0x0C, 0x0E,
-    0x08, 0x0B, 0x0D, 0x0E,
-    0x08, 0x09, 0x0D, 0x0E,
-    0x08, 0x09, 0x0B, 0x0E,
-    0x08, 0x0E, 0x0E, 0x0E,
-    0x08, 0x08, 0x0E, 0x0E,
-    0x08, 0x08, 0x08, 0x0E,
-    0x08, 0x0B, 0x0C, 0x0F,
-    0x08, 0x0B, 0x0E, 0x0F,
-    0x08, 0x09, 0x0E, 0x0F,
-    0x08, 0x09, 0x0C, 0x0F,
-    0x08, 0x0B, 0x0D, 0x10,
-    0x08, 0x0C, 0x0E, 0x10,
-    0x08, 0x0A, 0x0E, 0x10,
-    0x08, 0x0A, 0x0C, 0x10,
-    0x08, 0x10, 0x10, 0x10,
-    0x08, 0x08, 0x10, 0x10,
-    0x08, 0x08, 0x08, 0x10,
-    0x08, 0x0C, 0x0F, 0x13,
-    0x08, 0x0D, 0x11, 0x13,
-    0x08, 0x0A, 0x11, 0x13,
-    0x08, 0x0A, 0x0E, 0x13,
-    0x08, 0x13, 0x13, 0x13,
-    0x08, 0x08, 0x13, 0x13,
-    0x08, 0x08, 0x08, 0x13,
-    0x08, 0x0D, 0x11, 0x16,
-    0x08, 0x0F, 0x13, 0x16,
-    0x08, 0x0B, 0x13, 0x16,
-    0x08, 0x0B, 0x0F, 0x16,
-    0x08, 0x16, 0x16, 0x16,
-    0x08, 0x08, 0x16, 0x16,
-    0x08, 0x08, 0x08, 0x16,
-    0x08, 0x0E, 0x13, 0x19,
-    0x08, 0x10, 0x15, 0x19,
-    0x08, 0x0C, 0x15, 0x19,
-    0x08, 0x0C, 0x11, 0x19,
-    0x08, 0x19, 0x19, 0x19,
-    0x08, 0x08, 0x19, 0x19,
-    0x08, 0x08, 0x08, 0x19,
-    0x08, 0x0F, 0x15, 0x1C,
-    0x08, 0x12, 0x17, 0x1C,
-    0x08, 0x0D, 0x17, 0x1C,
-    0x08, 0x0D, 0x12, 0x1C,
-    0x08, 0x1C, 0x1C, 0x1C,
-    0x08, 0x08, 0x1C, 0x1C,
-    0x08, 0x08, 0x08, 0x1C,
-    0x08, 0x13, 0x1A, 0x1F,
-    0x08, 0x0D, 0x1A, 0x1F,
-    0x08, 0x0D, 0x14, 0x1F,
-    0x08, 0x1F, 0x1F, 0x1F,
-    0x08, 0x08, 0x1F, 0x1F,
-    0x08, 0x08, 0x08, 0x1F,
-    0x08, 0x15, 0x1C, 0x22,
-    0x08, 0x0E, 0x1C, 0x22,
-    0x08, 0x0E, 0x15, 0x22,
-    0x08, 0x22, 0x22, 0x22,
-    0x08, 0x08, 0x22, 0x22,
-    0x08, 0x08, 0x08, 0x22,
-    0x08, 0x16, 0x1E, 0x25,
-    0x08, 0x0F, 0x1E, 0x25,
-    0x08, 0x0F, 0x17, 0x25,
-    0x08, 0x25, 0x25, 0x25,
-    0x08, 0x08, 0x25, 0x25,
-    0x08, 0x08, 0x08, 0x25,
-    0x08, 0x18, 0x20, 0x28,
-    0x08, 0x10, 0x20, 0x28,
-    0x08, 0x10, 0x18, 0x28,
-    0x08, 0x28, 0x28, 0x28,
-    0x08, 0x08, 0x28, 0x28,
-    0x08, 0x08, 0x08, 0x28,
-    0x08, 0x2B, 0x2B, 0x2B,
-    0x08, 0x08, 0x2B, 0x2B,
-    0x08, 0x08, 0x08, 0x2B,
-    0x08, 0x1A, 0x23, 0x2C,
-    0x08, 0x11, 0x23, 0x2C,
-    0x08, 0x11, 0x1A, 0x2C,
-    0x08, 0x30, 0x30, 0x30,
-    0x08, 0x08, 0x30, 0x30,
-    0x08, 0x08, 0x08, 0x30,
-    0x08, 0x36, 0x36, 0x36,
-    0x08, 0x08, 0x36, 0x36,
-    0x08, 0x08, 0x08, 0x36,
-    0x09, 0x0A, 0x0A, 0x0B,
-    0x09, 0x0A, 0x0B, 0x0C,
-    0x09, 0x0B, 0x0C, 0x0D,
-    0x09, 0x0A, 0x0C, 0x0D,
-    0x09, 0x0A, 0x0B, 0x0D,
-    0x09, 0x0B, 0x0C, 0x0E,
-    0x09, 0x0B, 0x0D, 0x0E,
-    0x09, 0x0A, 0x0D, 0x0E,
-    0x09, 0x0A, 0x0C, 0x0E,
-    0x09, 0x0B, 0x0D, 0x0F,
-    0x09, 0x0C, 0x0E, 0x0F,
-    0x09, 0x0A, 0x0E, 0x0F,
-    0x09, 0x0A, 0x0C, 0x0F,
-    0x09, 0x0F, 0x0F, 0x0F,
-    0x09, 0x09, 0x0F, 0x0F,
-    0x09, 0x09, 0x09, 0x0F,
-    0x09, 0x0C, 0x0D, 0x10,
-    0x09, 0x0C, 0x0F, 0x10,
-    0x09, 0x0A, 0x0F, 0x10,
-    0x09, 0x0A, 0x0D, 0x10,
-    0x09, 0x0C, 0x0E, 0x11,
-    0x09, 0x0D, 0x0F, 0x11,
-    0x09, 0x0B, 0x0F, 0x11,
-    0x09, 0x0B, 0x0D, 0x11,
-    0x09, 0x11, 0x11, 0x11,
-    0x09, 0x09, 0x11, 0x11,
-    0x09, 0x09, 0x09, 0x11,
-    0x09, 0x0D, 0x10, 0x14,
-    0x09, 0x0E, 0x12, 0x14,
-    0x09, 0x0B, 0x12, 0x14,
-    0x09, 0x0B, 0x0F, 0x14,
-    0x09, 0x14, 0x14, 0x14,
-    0x09, 0x09, 0x14, 0x14,
-    0x09, 0x09, 0x09, 0x14,
-    0x09, 0x0E, 0x12, 0x17,
-    0x09, 0x10, 0x14, 0x17,
-    0x09, 0x0C, 0x14, 0x17,
-    0x09, 0x0C, 0x10, 0x17,
-    0x09, 0x17, 0x17, 0x17,
-    0x09, 0x09, 0x17, 0x17,
-    0x09, 0x09, 0x09, 0x17,
-    0x09, 0x0F, 0x14, 0x1A,
-    0x09, 0x11, 0x16, 0x1A,
-    0x09, 0x0D, 0x16, 0x1A,
-    0x09, 0x0D, 0x12, 0x1A,
-    0x09, 0x1A, 0x1A, 0x1A,
-    0x09, 0x09, 0x1A, 0x1A,
-    0x09, 0x09, 0x09, 0x1A,
-    0x09, 0x10, 0x16, 0x1D,
-    0x09, 0x13, 0x18, 0x1D,
-    0x09, 0x0E, 0x18, 0x1D,
-    0x09, 0x0E, 0x13, 0x1D,
-    0x09, 0x1D, 0x1D, 0x1D,
-    0x09, 0x09, 0x1D, 0x1D,
-    0x09, 0x09, 0x09, 0x1D,
-    0x09, 0x14, 0x1B, 0x20,
-    0x09, 0x0E, 0x1B, 0x20,
-    0x09, 0x0E, 0x15, 0x20,
-    0x09, 0x20, 0x20, 0x20,
-    0x09, 0x09, 0x20, 0x20,
-    0x09, 0x09, 0x09, 0x20,
-    0x09, 0x16, 0x1D, 0x23,
-    0x09, 0x0F, 0x1D, 0x23,
-    0x09, 0x0F, 0x16, 0x23,
-    0x09, 0x23, 0x23, 0x23,
-    0x09, 0x09, 0x23, 0x23,
-    0x09, 0x09, 0x09, 0x23,
-    0x09, 0x17, 0x1F, 0x26,
-    0x09, 0x10, 0x1F, 0x26,
-    0x09, 0x10, 0x18, 0x26,
-    0x09, 0x26, 0x26, 0x26,
-    0x09, 0x09, 0x26, 0x26,
-    0x09, 0x09, 0x09, 0x26,
-    0x09, 0x19, 0x21, 0x29,
-    0x09, 0x11, 0x21, 0x29,
-    0x09, 0x11, 0x19, 0x29,
-    0x09, 0x29, 0x29, 0x29,
-    0x09, 0x09, 0x29, 0x29,
-    0x09, 0x09, 0x09, 0x29,
-    0x09, 0x2C, 0x2C, 0x2C,
-    0x09, 0x09, 0x2C, 0x2C,
-    0x09, 0x09, 0x09, 0x2C,
-    0x09, 0x1B, 0x24, 0x2D,
-    0x09, 0x12, 0x24, 0x2D,
-    0x09, 0x12, 0x1B, 0x2D,
-    0x09, 0x31, 0x31, 0x31,
-    0x09, 0x09, 0x31, 0x31,
-    0x09, 0x09, 0x09, 0x31,
-    0x09, 0x37, 0x37, 0x37,
-    0x09, 0x09, 0x37, 0x37,
-    0x09, 0x09, 0x09, 0x37,
-    0x0A, 0x0B, 0x0B, 0x0C,
-    0x0A, 0x0B, 0x0C, 0x0D,
-    0x0A, 0x0C, 0x0D, 0x0E,
-    0x0A, 0x0B, 0x0D, 0x0E,
-    0x0A, 0x0B, 0x0C, 0x0E,
-    0x0A, 0x0C, 0x0D, 0x0F,
-    0x0A, 0x0C, 0x0E, 0x0F,
-    0x0A, 0x0B, 0x0E, 0x0F,
-    0x0A, 0x0B, 0x0D, 0x0F,
-    0x0A, 0x0C, 0x0E, 0x10,
-    0x0A, 0x0D, 0x0F, 0x10,
-    0x0A, 0x0B, 0x0F, 0x10,
-    0x0A, 0x0B, 0x0D, 0x10,
-    0x0A, 0x10, 0x10, 0x10,
-    0x0A, 0x0A, 0x10, 0x10,
-    0x0A, 0x0A, 0x0A, 0x10,
-    0x0A, 0x0D, 0x0E, 0x11,
-    0x0A, 0x0D, 0x10, 0x11,
-    0x0A, 0x0B, 0x10, 0x11,
-    0x0A, 0x0B, 0x0E, 0x11,
-    0x0A, 0x0D, 0x0F, 0x12,
-    0x0A, 0x0E, 0x10, 0x12,
-    0x0A, 0x0C, 0x10, 0x12,
-    0x0A, 0x0C, 0x0E, 0x12,
-    0x0A, 0x12, 0x12, 0x12,
-    0x0A, 0x0A, 0x12, 0x12,
-    0x0A, 0x0A, 0x0A, 0x12,
-    0x0A, 0x0E, 0x11, 0x15,
-    0x0A, 0x0F, 0x13, 0x15,
-    0x0A, 0x0C, 0x13, 0x15,
-    0x0A, 0x0C, 0x10, 0x15,
-    0x0A, 0x15, 0x15, 0x15,
-    0x0A, 0x0A, 0x15, 0x15,
-    0x0A, 0x0A, 0x0A, 0x15,
-    0x0A, 0x0F, 0x13, 0x18,
-    0x0A, 0x11, 0x15, 0x18,
-    0x0A, 0x0D, 0x15, 0x18,
-    0x0A, 0x0D, 0x11, 0x18,
-    0x0A, 0x18, 0x18, 0x18,
-    0x0A, 0x0A, 0x18, 0x18,
-    0x0A, 0x0A, 0x0A, 0x18,
-    0x0A, 0x10, 0x15, 0x1B,
-    0x0A, 0x12, 0x17, 0x1B,
-    0x0A, 0x0E, 0x17, 0x1B,
-    0x0A, 0x0E, 0x13, 0x1B,
-    0x0A, 0x1B, 0x1B, 0x1B,
-    0x0A, 0x0A, 0x1B, 0x1B,
-    0x0A, 0x0A, 0x0A, 0x1B,
-    0x0A, 0x11, 0x17, 0x1E,
-    0x0A, 0x14, 0x19, 0x1E,
-    0x0A, 0x0F, 0x19, 0x1E,
-    0x0A, 0x0F, 0x14, 0x1E,
-    0x0A, 0x1E, 0x1E, 0x1E,
-    0x0A, 0x0A, 0x1E, 0x1E,
-    0x0A, 0x0A, 0x0A, 0x1E,
-    0x0A, 0x15, 0x1C, 0x21,
-    0x0A, 0x0F, 0x1C, 0x21,
-    0x0A, 0x0F, 0x16, 0x21,
-    0x0A, 0x21, 0x21, 0x21,
-    0x0A, 0x0A, 0x21, 0x21,
-    0x0A, 0x0A, 0x0A, 0x21,
-    0x0A, 0x17, 0x1E, 0x24,
-    0x0A, 0x10, 0x1E, 0x24,
-    0x0A, 0x10, 0x17, 0x24,
-    0x0A, 0x24, 0x24, 0x24,
-    0x0A, 0x0A, 0x24, 0x24,
-    0x0A, 0x0A, 0x0A, 0x24,
-    0x0A, 0x18, 0x20, 0x27,
-    0x0A, 0x11, 0x20, 0x27,
-    0x0A, 0x11, 0x19, 0x27,
-    0x0A, 0x27, 0x27, 0x27,
-    0x0A, 0x0A, 0x27, 0x27,
-    0x0A, 0x0A, 0x0A, 0x27,
-    0x0A, 0x1A, 0x22, 0x2A,
-    0x0A, 0x12, 0x22, 0x2A,
-    0x0A, 0x12, 0x1A, 0x2A,
-    0x0A, 0x2A, 0x2A, 0x2A,
-    0x0A, 0x0A, 0x2A, 0x2A,
-    0x0A, 0x0A, 0x0A, 0x2A,
-    0x0A, 0x2D, 0x2D, 0x2D,
-    0x0A, 0x0A, 0x2D, 0x2D,
-    0x0A, 0x0A, 0x0A, 0x2D,
-    0x0A, 0x1C, 0x25, 0x2E,
-    0x0A, 0x13, 0x25, 0x2E,
-    0x0A, 0x13, 0x1C, 0x2E,
-    0x0A, 0x32, 0x32, 0x32,
-    0x0A, 0x0A, 0x32, 0x32,
-    0x0A, 0x0A, 0x0A, 0x32,
-    0x0A, 0x38, 0x38, 0x38,
-    0x0A, 0x0A, 0x38, 0x38,
-    0x0A, 0x0A, 0x0A, 0x38,
-    0x0B, 0x0C, 0x0C, 0x0D,
-    0x0B, 0x0C, 0x0D, 0x0E,
-    0x0B, 0x0D, 0x0E, 0x0F,
-    0x0B, 0x0C, 0x0E, 0x0F,
-    0x0B, 0x0C, 0x0D, 0x0F,
-    0x0B, 0x0D, 0x0E, 0x10,
-    0x0B, 0x0D, 0x0F, 0x10,
-    0x0B, 0x0C, 0x0F, 0x10,
-    0x0B, 0x0C, 0x0E, 0x10,
-    0x0B, 0x0D, 0x0F, 0x11,
-    0x0B, 0x0E, 0x10, 0x11,
-    0x0B, 0x0C, 0x10, 0x11,
-    0x0B, 0x0C, 0x0E, 0x11,
-    0x0B, 0x11, 0x11, 0x11,
-    0x0B, 0x0B, 0x11, 0x11,
-    0x0B, 0x0B, 0x0B, 0x11,
-    0x0B, 0x0E, 0x0F, 0x12,
-    0x0B, 0x0E, 0x11, 0x12,
-    0x0B, 0x0C, 0x11, 0x12,
-    0x0B, 0x0C, 0x0F, 0x12,
-    0x0B, 0x0E, 0x10, 0x13,
-    0x0B, 0x0F, 0x11, 0x13,
-    0x0B, 0x0D, 0x11, 0x13,
-    0x0B, 0x0D, 0x0F, 0x13,
-    0x0B, 0x13, 0x13, 0x13,
-    0x0B, 0x0B, 0x13, 0x13,
-    0x0B, 0x0B, 0x0B, 0x13,
-    0x0B, 0x0F, 0x12, 0x16,
-    0x0B, 0x10, 0x14, 0x16,
-    0x0B, 0x0D, 0x14, 0x16,
-    0x0B, 0x0D, 0x11, 0x16,
-    0x0B, 0x16, 0x16, 0x16,
-    0x0B, 0x0B, 0x16, 0x16,
-    0x0B, 0x0B, 0x0B, 0x16,
-    0x0B, 0x10, 0x14, 0x19,
-    0x0B, 0x12, 0x16, 0x19,
-    0x0B, 0x0E, 0x16, 0x19,
-    0x0B, 0x0E, 0x12, 0x19,
-    0x0B, 0x19, 0x19, 0x19,
-    0x0B, 0x0B, 0x19, 0x19,
-    0x0B, 0x0B, 0x0B, 0x19,
-    0x0B, 0x11, 0x16, 0x1C,
-    0x0B, 0x13, 0x18, 0x1C,
-    0x0B, 0x0F, 0x18, 0x1C,
-    0x0B, 0x0F, 0x14, 0x1C,
-    0x0B, 0x1C, 0x1C, 0x1C,
-    0x0B, 0x0B, 0x1C, 0x1C,
-    0x0B, 0x0B, 0x0B, 0x1C,
-    0x0B, 0x12, 0x18, 0x1F,
-    0x0B, 0x15, 0x1A, 0x1F,
-    0x0B, 0x10, 0x1A, 0x1F,
-    0x0B, 0x10, 0x15, 0x1F,
-    0x0B, 0x1F, 0x1F, 0x1F,
-    0x0B, 0x0B, 0x1F, 0x1F,
-    0x0B, 0x0B, 0x0B, 0x1F,
-    0x0B, 0x16, 0x1D, 0x22,
-    0x0B, 0x10, 0x1D, 0x22,
-    0x0B, 0x10, 0x17, 0x22,
-    0x0B, 0x22, 0x22, 0x22,
-    0x0B, 0x0B, 0x22, 0x22,
-    0x0B, 0x0B, 0x0B, 0x22,
-    0x0B, 0x18, 0x1F, 0x25,
-    0x0B, 0x11, 0x1F, 0x25,
-    0x0B, 0x11, 0x18, 0x25,
-    0x0B, 0x25, 0x25, 0x25,
-    0x0B, 0x0B, 0x25, 0x25,
-    0x0B, 0x0B, 0x0B, 0x25,
-    0x0B, 0x19, 0x21, 0x28,
-    0x0B, 0x12, 0x21, 0x28,
-    0x0B, 0x12, 0x1A, 0x28,
-    0x0B, 0x28, 0x28, 0x28,
-    0x0B, 0x0B, 0x28, 0x28,
-    0x0B, 0x0B, 0x0B, 0x28,
-    0x0B, 0x1B, 0x23, 0x2B,
-    0x0B, 0x13, 0x23, 0x2B,
-    0x0B, 0x13, 0x1B, 0x2B,
-    0x0B, 0x2B, 0x2B, 0x2B,
-    0x0B, 0x0B, 0x2B, 0x2B,
-    0x0B, 0x0B, 0x0B, 0x2B,
-    0x0B, 0x2E, 0x2E, 0x2E,
-    0x0B, 0x0B, 0x2E, 0x2E,
-    0x0B, 0x0B, 0x0B, 0x2E,
-    0x0B, 0x1D, 0x26, 0x2F,
-    0x0B, 0x14, 0x26, 0x2F,
-    0x0B, 0x14, 0x1D, 0x2F,
-    0x0B, 0x33, 0x33, 0x33,
-    0x0B, 0x0B, 0x33, 0x33,
-    0x0B, 0x0B, 0x0B, 0x33,
-    0x0B, 0x39, 0x39, 0x39,
-    0x0B, 0x0B, 0x39, 0x39,
-    0x0B, 0x0B, 0x0B, 0x39,
-    0x0C, 0x0D, 0x0D, 0x0E,
-    0x0C, 0x0D, 0x0E, 0x0F,
-    0x0C, 0x0E, 0x0F, 0x10,
-    0x0C, 0x0D, 0x0F, 0x10,
-    0x0C, 0x0D, 0x0E, 0x10,
-    0x0C, 0x0E, 0x0F, 0x11,
-    0x0C, 0x0E, 0x10, 0x11,
-    0x0C, 0x0D, 0x10, 0x11,
-    0x0C, 0x0D, 0x0F, 0x11,
-    0x0C, 0x0E, 0x10, 0x12,
-    0x0C, 0x0F, 0x11, 0x12,
-    0x0C, 0x0D, 0x11, 0x12,
-    0x0C, 0x0D, 0x0F, 0x12,
-    0x0C, 0x12, 0x12, 0x12,
-    0x0C, 0x0C, 0x12, 0x12,
-    0x0C, 0x0C, 0x0C, 0x12,
-    0x0C, 0x0F, 0x10, 0x13,
-    0x0C, 0x0F, 0x12, 0x13,
-    0x0C, 0x0D, 0x12, 0x13,
-    0x0C, 0x0D, 0x10, 0x13,
-    0x0C, 0x0F, 0x11, 0x14,
-    0x0C, 0x10, 0x12, 0x14,
-    0x0C, 0x0E, 0x12, 0x14,
-    0x0C, 0x0E, 0x10, 0x14,
-    0x0C, 0x14, 0x14, 0x14,
-    0x0C, 0x0C, 0x14, 0x14,
-    0x0C, 0x0C, 0x0C, 0x14,
-    0x0C, 0x10, 0x13, 0x17,
-    0x0C, 0x11, 0x15, 0x17,
-    0x0C, 0x0E, 0x15, 0x17,
-    0x0C, 0x0E, 0x12, 0x17,
-    0x0C, 0x17, 0x17, 0x17,
-    0x0C, 0x0C, 0x17, 0x17,
-    0x0C, 0x0C, 0x0C, 0x17,
-    0x0C, 0x11, 0x15, 0x1A,
-    0x0C, 0x13, 0x17, 0x1A,
-    0x0C, 0x0F, 0x17, 0x1A,
-    0x0C, 0x0F, 0x13, 0x1A,
-    0x0C, 0x1A, 0x1A, 0x1A,
-    0x0C, 0x0C, 0x1A, 0x1A,
-    0x0C, 0x0C, 0x0C, 0x1A,
-    0x0C, 0x12, 0x17, 0x1D,
-    0x0C, 0x14, 0x19, 0x1D,
-    0x0C, 0x10, 0x19, 0x1D,
-    0x0C, 0x10, 0x15, 0x1D,
-    0x0C, 0x1D, 0x1D, 0x1D,
-    0x0C, 0x0C, 0x1D, 0x1D,
-    0x0C, 0x0C, 0x0C, 0x1D,
-    0x0C, 0x13, 0x19, 0x20,
-    0x0C, 0x16, 0x1B, 0x20,
-    0x0C, 0x11, 0x1B, 0x20,
-    0x0C, 0x11, 0x16, 0x20,
-    0x0C, 0x20, 0x20, 0x20,
-    0x0C, 0x0C, 0x20, 0x20,
-    0x0C, 0x0C, 0x0C, 0x20,
-    0x0C, 0x17, 0x1E, 0x23,
-    0x0C, 0x11, 0x1E, 0x23,
-    0x0C, 0x11, 0x18, 0x23,
-    0x0C, 0x23, 0x23, 0x23,
-    0x0C, 0x0C, 0x23, 0x23,
-    0x0C, 0x0C, 0x0C, 0x23,
-    0x0C, 0x19, 0x20, 0x26,
-    0x0C, 0x12, 0x20, 0x26,
-    0x0C, 0x12, 0x19, 0x26,
-    0x0C, 0x26, 0x26, 0x26,
-    0x0C, 0x0C, 0x26, 0x26,
-    0x0C, 0x0C, 0x0C, 0x26,
-    0x0C, 0x1A, 0x22, 0x29,
-    0x0C, 0x13, 0x22, 0x29,
-    0x0C, 0x13, 0x1B, 0x29,
-    0x0C, 0x29, 0x29, 0x29,
-    0x0C, 0x0C, 0x29, 0x29,
-    0x0C, 0x0C, 0x0C, 0x29,
-    0x0C, 0x1C, 0x24, 0x2C,
-    0x0C, 0x14, 0x24, 0x2C,
-    0x0C, 0x14, 0x1C, 0x2C,
-    0x0C, 0x2C, 0x2C, 0x2C,
-    0x0C, 0x0C, 0x2C, 0x2C,
-    0x0C, 0x0C, 0x0C, 0x2C,
-    0x0C, 0x2F, 0x2F, 0x2F,
-    0x0C, 0x0C, 0x2F, 0x2F,
-    0x0C, 0x0C, 0x0C, 0x2F,
-    0x0C, 0x1E, 0x27, 0x30,
-    0x0C, 0x15, 0x27, 0x30,
-    0x0C, 0x15, 0x1E, 0x30,
-    0x0C, 0x34, 0x34, 0x34,
-    0x0C, 0x0C, 0x34, 0x34,
-    0x0C, 0x0C, 0x0C, 0x34,
-    0x0C, 0x3A, 0x3A, 0x3A,
-    0x0C, 0x0C, 0x3A, 0x3A,
-    0x0C, 0x0C, 0x0C, 0x3A,
-    0x0D, 0x0E, 0x0E, 0x0F,
-    0x0D, 0x0E, 0x0F, 0x10,
-    0x0D, 0x0F, 0x10, 0x11,
-    0x0D, 0x0E, 0x10, 0x11,
-    0x0D, 0x0E, 0x0F, 0x11,
-    0x0D, 0x0F, 0x10, 0x12,
-    0x0D, 0x0F, 0x11, 0x12,
-    0x0D, 0x0E, 0x11, 0x12,
-    0x0D, 0x0E, 0x10, 0x12,
-    0x0D, 0x0F, 0x11, 0x13,
-    0x0D, 0x10, 0x12, 0x13,
-    0x0D, 0x0E, 0x12, 0x13,
-    0x0D, 0x0E, 0x10, 0x13,
-    0x0D, 0x13, 0x13, 0x13,
-    0x0D, 0x0D, 0x13, 0x13,
-    0x0D, 0x0D, 0x0D, 0x13,
-    0x0D, 0x10, 0x11, 0x14,
-    0x0D, 0x10, 0x13, 0x14,
-    0x0D, 0x0E, 0x13, 0x14,
-    0x0D, 0x0E, 0x11, 0x14,
-    0x0D, 0x10, 0x12, 0x15,
-    0x0D, 0x11, 0x13, 0x15,
-    0x0D, 0x0F, 0x13, 0x15,
-    0x0D, 0x0F, 0x11, 0x15,
-    0x0D, 0x15, 0x15, 0x15,
-    0x0D, 0x0D, 0x15, 0x15,
-    0x0D, 0x0D, 0x0D, 0x15,
-    0x0D, 0x11, 0x14, 0x18,
-    0x0D, 0x12, 0x16, 0x18,
-    0x0D, 0x0F, 0x16, 0x18,
-    0x0D, 0x0F, 0x13, 0x18,
-    0x0D, 0x18, 0x18, 0x18,
-    0x0D, 0x0D, 0x18, 0x18,
-    0x0D, 0x0D, 0x0D, 0x18,
-    0x0D, 0x12, 0x16, 0x1B,
-    0x0D, 0x14, 0x18, 0x1B,
-    0x0D, 0x10, 0x18, 0x1B,
-    0x0D, 0x10, 0x14, 0x1B,
-    0x0D, 0x1B, 0x1B, 0x1B,
-    0x0D, 0x0D, 0x1B, 0x1B,
-    0x0D, 0x0D, 0x0D, 0x1B,
-    0x0D, 0x13, 0x18, 0x1E,
-    0x0D, 0x15, 0x1A, 0x1E,
-    0x0D, 0x11, 0x1A, 0x1E,
-    0x0D, 0x11, 0x16, 0x1E,
-    0x0D, 0x1E, 0x1E, 0x1E,
-    0x0D, 0x0D, 0x1E, 0x1E,
-    0x0D, 0x0D, 0x0D, 0x1E,
-    0x0D, 0x14, 0x1A, 0x21,
-    0x0D, 0x17, 0x1C, 0x21,
-    0x0D, 0x12, 0x1C, 0x21,
-    0x0D, 0x12, 0x17, 0x21,
-    0x0D, 0x21, 0x21, 0x21,
-    0x0D, 0x0D, 0x21, 0x21,
-    0x0D, 0x0D, 0x0D, 0x21,
-    0x0D, 0x18, 0x1F, 0x24,
-    0x0D, 0x12, 0x1F, 0x24,
-    0x0D, 0x12, 0x19, 0x24,
-    0x0D, 0x24, 0x24, 0x24,
-    0x0D, 0x0D, 0x24, 0x24,
-    0x0D, 0x0D, 0x0D, 0x24,
-    0x0D, 0x1A, 0x21, 0x27,
-    0x0D, 0x13, 0x21, 0x27,
-    0x0D, 0x13, 0x1A, 0x27,
-    0x0D, 0x27, 0x27, 0x27,
-    0x0D, 0x0D, 0x27, 0x27,
-    0x0D, 0x0D, 0x0D, 0x27,
-    0x0D, 0x1B, 0x23, 0x2A,
-    0x0D, 0x14, 0x23, 0x2A,
-    0x0D, 0x14, 0x1C, 0x2A,
-    0x0D, 0x2A, 0x2A, 0x2A,
-    0x0D, 0x0D, 0x2A, 0x2A,
-    0x0D, 0x0D, 0x0D, 0x2A,
-    0x0D, 0x1D, 0x25, 0x2D,
-    0x0D, 0x15, 0x25, 0x2D,
-    0x0D, 0x15, 0x1D, 0x2D,
-    0x0D, 0x2D, 0x2D, 0x2D,
-    0x0D, 0x0D, 0x2D, 0x2D,
-    0x0D, 0x0D, 0x0D, 0x2D,
-    0x0D, 0x30, 0x30, 0x30,
-    0x0D, 0x0D, 0x30, 0x30,
-    0x0D, 0x0D, 0x0D, 0x30,
-    0x0D, 0x1F, 0x28, 0x31,
-    0x0D, 0x16, 0x28, 0x31,
-    0x0D, 0x16, 0x1F, 0x31,
-    0x0D, 0x35, 0x35, 0x35,
-    0x0D, 0x0D, 0x35, 0x35,
-    0x0D, 0x0D, 0x0D, 0x35,
-    0x0D, 0x3B, 0x3B, 0x3B,
-    0x0D, 0x0D, 0x3B, 0x3B,
-    0x0D, 0x0D, 0x0D, 0x3B,
-    0x0E, 0x0F, 0x0F, 0x10,
-    0x0E, 0x0F, 0x10, 0x11,
-    0x0E, 0x10, 0x11, 0x12,
-    0x0E, 0x0F, 0x11, 0x12,
-    0x0E, 0x0F, 0x10, 0x12,
-    0x0E, 0x10, 0x11, 0x13,
-    0x0E, 0x10, 0x12, 0x13,
-    0x0E, 0x0F, 0x12, 0x13,
-    0x0E, 0x0F, 0x11, 0x13,
-    0x0E, 0x10, 0x12, 0x14,
-    0x0E, 0x11, 0x13, 0x14,
-    0x0E, 0x0F, 0x13, 0x14,
-    0x0E, 0x0F, 0x11, 0x14,
-    0x0E, 0x14, 0x14, 0x14,
-    0x0E, 0x0E, 0x14, 0x14,
-    0x0E, 0x0E, 0x0E, 0x14,
-    0x0E, 0x11, 0x12, 0x15,
-    0x0E, 0x11, 0x14, 0x15,
-    0x0E, 0x0F, 0x14, 0x15,
-    0x0E, 0x0F, 0x12, 0x15,
-    0x0E, 0x11, 0x13, 0x16,
-    0x0E, 0x12, 0x14, 0x16,
-    0x0E, 0x10, 0x14, 0x16,
-    0x0E, 0x10, 0x12, 0x16,
-    0x0E, 0x16, 0x16, 0x16,
-    0x0E, 0x0E, 0x16, 0x16,
-    0x0E, 0x0E, 0x0E, 0x16,
-    0x0E, 0x12, 0x15, 0x19,
-    0x0E, 0x13, 0x17, 0x19,
-    0x0E, 0x10, 0x17, 0x19,
-    0x0E, 0x10, 0x14, 0x19,
-    0x0E, 0x19, 0x19, 0x19,
-    0x0E, 0x0E, 0x19, 0x19,
-    0x0E, 0x0E, 0x0E, 0x19,
-    0x0E, 0x13, 0x17, 0x1C,
-    0x0E, 0x15, 0x19, 0x1C,
-    0x0E, 0x11, 0x19, 0x1C,
-    0x0E, 0x11, 0x15, 0x1C,
-    0x0E, 0x1C, 0x1C, 0x1C,
-    0x0E, 0x0E, 0x1C, 0x1C,
-    0x0E, 0x0E, 0x0E, 0x1C,
-    0x0E, 0x14, 0x19, 0x1F,
-    0x0E, 0x16, 0x1B, 0x1F,
-    0x0E, 0x12, 0x1B, 0x1F,
-    0x0E, 0x12, 0x17, 0x1F,
-    0x0E, 0x1F, 0x1F, 0x1F,
-    0x0E, 0x0E, 0x1F, 0x1F,
-    0x0E, 0x0E, 0x0E, 0x1F,
-    0x0E, 0x15, 0x1B, 0x22,
-    0x0E, 0x18, 0x1D, 0x22,
-    0x0E, 0x13, 0x1D, 0x22,
-    0x0E, 0x13, 0x18, 0x22,
-    0x0E, 0x22, 0x22, 0x22,
-    0x0E, 0x0E, 0x22, 0x22,
-    0x0E, 0x0E, 0x0E, 0x22,
-    0x0E, 0x19, 0x20, 0x25,
-    0x0E, 0x13, 0x20, 0x25,
-    0x0E, 0x13, 0x1A, 0x25,
-    0x0E, 0x25, 0x25, 0x25,
-    0x0E, 0x0E, 0x25, 0x25,
-    0x0E, 0x0E, 0x0E, 0x25,
-    0x0E, 0x1B, 0x22, 0x28,
-    0x0E, 0x14, 0x22, 0x28,
-    0x0E, 0x14, 0x1B, 0x28,
-    0x0E, 0x28, 0x28, 0x28,
-    0x0E, 0x0E, 0x28, 0x28,
-    0x0E, 0x0E, 0x0E, 0x28,
-    0x0E, 0x1C, 0x24, 0x2B,
-    0x0E, 0x15, 0x24, 0x2B,
-    0x0E, 0x15, 0x1D, 0x2B,
-    0x0E, 0x2B, 0x2B, 0x2B,
-    0x0E, 0x0E, 0x2B, 0x2B,
-    0x0E, 0x0E, 0x0E, 0x2B,
-    0x0E, 0x1E, 0x26, 0x2E,
-    0x0E, 0x16, 0x26, 0x2E,
-    0x0E, 0x16, 0x1E, 0x2E,
-    0x0E, 0x2E, 0x2E, 0x2E,
-    0x0E, 0x0E, 0x2E, 0x2E,
-    0x0E, 0x0E, 0x0E, 0x2E,
-    0x0E, 0x31, 0x31, 0x31,
-    0x0E, 0x0E, 0x31, 0x31,
-    0x0E, 0x0E, 0x0E, 0x31,
-    0x0E, 0x20, 0x29, 0x32,
-    0x0E, 0x17, 0x29, 0x32,
-    0x0E, 0x17, 0x20, 0x32,
-    0x0E, 0x36, 0x36, 0x36,
-    0x0E, 0x0E, 0x36, 0x36,
-    0x0E, 0x0E, 0x0E, 0x36,
-    0x0E, 0x3C, 0x3C, 0x3C,
-    0x0E, 0x0E, 0x3C, 0x3C,
-    0x0E, 0x0E, 0x0E, 0x3C,
-    0x0F, 0x10, 0x10, 0x11,
-    0x0F, 0x10, 0x11, 0x12,
-    0x0F, 0x11, 0x12, 0x13,
-    0x0F, 0x10, 0x12, 0x13,
-    0x0F, 0x10, 0x11, 0x13,
-    0x0F, 0x11, 0x12, 0x14,
-    0x0F, 0x11, 0x13, 0x14,
-    0x0F, 0x10, 0x13, 0x14,
-    0x0F, 0x10, 0x12, 0x14,
-    0x0F, 0x11, 0x13, 0x15,
-    0x0F, 0x12, 0x14, 0x15,
-    0x0F, 0x10, 0x14, 0x15,
-    0x0F, 0x10, 0x12, 0x15,
-    0x0F, 0x15, 0x15, 0x15,
-    0x0F, 0x0F, 0x15, 0x15,
-    0x0F, 0x0F, 0x0F, 0x15,
-    0x0F, 0x12, 0x13, 0x16,
-    0x0F, 0x12, 0x15, 0x16,
-    0x0F, 0x10, 0x15, 0x16,
-    0x0F, 0x10, 0x13, 0x16,
-    0x0F, 0x12, 0x14, 0x17,
-    0x0F, 0x13, 0x15, 0x17,
-    0x0F, 0x11, 0x15, 0x17,
-    0x0F, 0x11, 0x13, 0x17,
-    0x0F, 0x17, 0x17, 0x17,
-    0x0F, 0x0F, 0x17, 0x17,
-    0x0F, 0x0F, 0x0F, 0x17,
-    0x0F, 0x13, 0x16, 0x1A,
-    0x0F, 0x14, 0x18, 0x1A,
-    0x0F, 0x11, 0x18, 0x1A,
-    0x0F, 0x11, 0x15, 0x1A,
-    0x0F, 0x1A, 0x1A, 0x1A,
-    0x0F, 0x0F, 0x1A, 0x1A,
-    0x0F, 0x0F, 0x0F, 0x1A,
-    0x0F, 0x14, 0x18, 0x1D,
-    0x0F, 0x16, 0x1A, 0x1D,
-    0x0F, 0x12, 0x1A, 0x1D,
-    0x0F, 0x12, 0x16, 0x1D,
-    0x0F, 0x1D, 0x1D, 0x1D,
-    0x0F, 0x0F, 0x1D, 0x1D,
-    0x0F, 0x0F, 0x0F, 0x1D,
-    0x0F, 0x15, 0x1A, 0x20,
-    0x0F, 0x17, 0x1C, 0x20,
-    0x0F, 0x13, 0x1C, 0x20,
-    0x0F, 0x13, 0x18, 0x20,
-    0x0F, 0x20, 0x20, 0x20,
-    0x0F, 0x0F, 0x20, 0x20,
-    0x0F, 0x0F, 0x0F, 0x20,
-    0x0F, 0x16, 0x1C, 0x23,
-    0x0F, 0x19, 0x1E, 0x23,
-    0x0F, 0x14, 0x1E, 0x23,
-    0x0F, 0x14, 0x19, 0x23,
-    0x0F, 0x23, 0x23, 0x23,
-    0x0F, 0x0F, 0x23, 0x23,
-    0x0F, 0x0F, 0x0F, 0x23,
-    0x0F, 0x1A, 0x21, 0x26,
-    0x0F, 0x14, 0x21, 0x26,
-    0x0F, 0x14, 0x1B, 0x26,
-    0x0F, 0x26, 0x26, 0x26,
-    0x0F, 0x0F, 0x26, 0x26,
-    0x0F, 0x0F, 0x0F, 0x26,
-    0x0F, 0x1C, 0x23, 0x29,
-    0x0F, 0x15, 0x23, 0x29,
-    0x0F, 0x15, 0x1C, 0x29,
-    0x0F, 0x29, 0x29, 0x29,
-    0x0F, 0x0F, 0x29, 0x29,
-    0x0F, 0x0F, 0x0F, 0x29,
-    0x0F, 0x1D, 0x25, 0x2C,
-    0x0F, 0x16, 0x25, 0x2C,
-    0x0F, 0x16, 0x1E, 0x2C,
-    0x0F, 0x2C, 0x2C, 0x2C,
-    0x0F, 0x0F, 0x2C, 0x2C,
-    0x0F, 0x0F, 0x0F, 0x2C,
-    0x0F, 0x1F, 0x27, 0x2F,
-    0x0F, 0x17, 0x27, 0x2F,
-    0x0F, 0x17, 0x1F, 0x2F,
-    0x0F, 0x2F, 0x2F, 0x2F,
-    0x0F, 0x0F, 0x2F, 0x2F,
-    0x0F, 0x0F, 0x0F, 0x2F,
-    0x0F, 0x32, 0x32, 0x32,
-    0x0F, 0x0F, 0x32, 0x32,
-    0x0F, 0x0F, 0x0F, 0x32,
-    0x0F, 0x21, 0x2A, 0x33,
-    0x0F, 0x18, 0x2A, 0x33,
-    0x0F, 0x18, 0x21, 0x33,
-    0x0F, 0x37, 0x37, 0x37,
-    0x0F, 0x0F, 0x37, 0x37,
-    0x0F, 0x0F, 0x0F, 0x37,
-    0x0F, 0x3D, 0x3D, 0x3D,
-    0x0F, 0x0F, 0x3D, 0x3D,
-    0x0F, 0x0F, 0x0F, 0x3D,
-    0x10, 0x11, 0x11, 0x12,
-    0x10, 0x11, 0x12, 0x13,
-    0x10, 0x12, 0x13, 0x14,
-    0x10, 0x11, 0x13, 0x14,
-    0x10, 0x11, 0x12, 0x14,
-    0x10, 0x12, 0x13, 0x15,
-    0x10, 0x12, 0x14, 0x15,
-    0x10, 0x11, 0x14, 0x15,
-    0x10, 0x11, 0x13, 0x15,
-    0x10, 0x12, 0x14, 0x16,
-    0x10, 0x13, 0x15, 0x16,
-    0x10, 0x11, 0x15, 0x16,
-    0x10, 0x11, 0x13, 0x16,
-    0x10, 0x16, 0x16, 0x16,
-    0x10, 0x10, 0x16, 0x16,
-    0x10, 0x10, 0x10, 0x16,
-    0x10, 0x13, 0x14, 0x17,
-    0x10, 0x13, 0x16, 0x17,
-    0x10, 0x11, 0x16, 0x17,
-    0x10, 0x11, 0x14, 0x17,
-    0x10, 0x13, 0x15, 0x18,
-    0x10, 0x14, 0x16, 0x18,
-    0x10, 0x12, 0x16, 0x18,
-    0x10, 0x12, 0x14, 0x18,
-    0x10, 0x18, 0x18, 0x18,
-    0x10, 0x10, 0x18, 0x18,
-    0x10, 0x10, 0x10, 0x18,
-    0x10, 0x14, 0x17, 0x1B,
-    0x10, 0x15, 0x19, 0x1B,
-    0x10, 0x12, 0x19, 0x1B,
-    0x10, 0x12, 0x16, 0x1B,
-    0x10, 0x1B, 0x1B, 0x1B,
-    0x10, 0x10, 0x1B, 0x1B,
-    0x10, 0x10, 0x10, 0x1B,
-    0x10, 0x15, 0x19, 0x1E,
-    0x10, 0x17, 0x1B, 0x1E,
-    0x10, 0x13, 0x1B, 0x1E,
-    0x10, 0x13, 0x17, 0x1E,
-    0x10, 0x1E, 0x1E, 0x1E,
-    0x10, 0x10, 0x1E, 0x1E,
-    0x10, 0x10, 0x10, 0x1E,
-    0x10, 0x16, 0x1B, 0x21,
-    0x10, 0x18, 0x1D, 0x21,
-    0x10, 0x14, 0x1D, 0x21,
-    0x10, 0x14, 0x19, 0x21,
-    0x10, 0x21, 0x21, 0x21,
-    0x10, 0x10, 0x21, 0x21,
-    0x10, 0x10, 0x10, 0x21,
-    0x10, 0x17, 0x1D, 0x24,
-    0x10, 0x1A, 0x1F, 0x24,
-    0x10, 0x15, 0x1F, 0x24,
-    0x10, 0x15, 0x1A, 0x24,
-    0x10, 0x24, 0x24, 0x24,
-    0x10, 0x10, 0x24, 0x24,
-    0x10, 0x10, 0x10, 0x24,
-    0x10, 0x1B, 0x22, 0x27,
-    0x10, 0x15, 0x22, 0x27,
-    0x10, 0x15, 0x1C, 0x27,
-    0x10, 0x27, 0x27, 0x27,
-    0x10, 0x10, 0x27, 0x27,
-    0x10, 0x10, 0x10, 0x27,
-    0x10, 0x1D, 0x24, 0x2A,
-    0x10, 0x16, 0x24, 0x2A,
-    0x10, 0x16, 0x1D, 0x2A,
-    0x10, 0x2A, 0x2A, 0x2A,
-    0x10, 0x10, 0x2A, 0x2A,
-    0x10, 0x10, 0x10, 0x2A,
-    0x10, 0x1E, 0x26, 0x2D,
-    0x10, 0x17, 0x26, 0x2D,
-    0x10, 0x17, 0x1F, 0x2D,
-    0x10, 0x2D, 0x2D, 0x2D,
-    0x10, 0x10, 0x2D, 0x2D,
-    0x10, 0x10, 0x10, 0x2D,
-    0x10, 0x20, 0x28, 0x30,
-    0x10, 0x18, 0x28, 0x30,
-    0x10, 0x18, 0x20, 0x30,
-    0x10, 0x30, 0x30, 0x30,
-    0x10, 0x10, 0x30, 0x30,
-    0x10, 0x10, 0x10, 0x30,
-    0x10, 0x33, 0x33, 0x33,
-    0x10, 0x10, 0x33, 0x33,
-    0x10, 0x10, 0x10, 0x33,
-    0x10, 0x22, 0x2B, 0x34,
-    0x10, 0x19, 0x2B, 0x34,
-    0x10, 0x19, 0x22, 0x34,
-    0x10, 0x38, 0x38, 0x38,
-    0x10, 0x10, 0x38, 0x38,
-    0x10, 0x10, 0x10, 0x38,
-    0x10, 0x3E, 0x3E, 0x3E,
-    0x10, 0x10, 0x3E, 0x3E,
-    0x10, 0x10, 0x10, 0x3E,
-    0x11, 0x12, 0x12, 0x13,
-    0x11, 0x12, 0x13, 0x14,
-    0x11, 0x13, 0x14, 0x15,
-    0x11, 0x12, 0x14, 0x15,
-    0x11, 0x12, 0x13, 0x15,
-    0x11, 0x13, 0x14, 0x16,
-    0x11, 0x13, 0x15, 0x16,
-    0x11, 0x12, 0x15, 0x16,
-    0x11, 0x12, 0x14, 0x16,
-    0x11, 0x13, 0x15, 0x17,
-    0x11, 0x14, 0x16, 0x17,
-    0x11, 0x12, 0x16, 0x17,
-    0x11, 0x12, 0x14, 0x17,
-    0x11, 0x17, 0x17, 0x17,
-    0x11, 0x11, 0x17, 0x17,
-    0x11, 0x11, 0x11, 0x17,
-    0x11, 0x14, 0x15, 0x18,
-    0x11, 0x14, 0x17, 0x18,
-    0x11, 0x12, 0x17, 0x18,
-    0x11, 0x12, 0x15, 0x18,
-    0x11, 0x14, 0x16, 0x19,
-    0x11, 0x15, 0x17, 0x19,
-    0x11, 0x13, 0x17, 0x19,
-    0x11, 0x13, 0x15, 0x19,
-    0x11, 0x19, 0x19, 0x19,
-    0x11, 0x11, 0x19, 0x19,
-    0x11, 0x11, 0x11, 0x19,
-    0x11, 0x15, 0x18, 0x1C,
-    0x11, 0x16, 0x1A, 0x1C,
-    0x11, 0x13, 0x1A, 0x1C,
-    0x11, 0x13, 0x17, 0x1C,
-    0x11, 0x1C, 0x1C, 0x1C,
-    0x11, 0x11, 0x1C, 0x1C,
-    0x11, 0x11, 0x11, 0x1C,
-    0x11, 0x16, 0x1A, 0x1F,
-    0x11, 0x18, 0x1C, 0x1F,
-    0x11, 0x14, 0x1C, 0x1F,
-    0x11, 0x14, 0x18, 0x1F,
-    0x11, 0x1F, 0x1F, 0x1F,
-    0x11, 0x11, 0x1F, 0x1F,
-    0x11, 0x11, 0x11, 0x1F,
-    0x11, 0x17, 0x1C, 0x22,
-    0x11, 0x19, 0x1E, 0x22,
-    0x11, 0x15, 0x1E, 0x22,
-    0x11, 0x15, 0x1A, 0x22,
-    0x11, 0x22, 0x22, 0x22,
-    0x11, 0x11, 0x22, 0x22,
-    0x11, 0x11, 0x11, 0x22,
-    0x11, 0x18, 0x1E, 0x25,
-    0x11, 0x1B, 0x20, 0x25,
-    0x11, 0x16, 0x20, 0x25,
-    0x11, 0x16, 0x1B, 0x25,
-    0x11, 0x25, 0x25, 0x25,
-    0x11, 0x11, 0x25, 0x25,
-    0x11, 0x11, 0x11, 0x25,
-    0x11, 0x1C, 0x23, 0x28,
-    0x11, 0x16, 0x23, 0x28,
-    0x11, 0x16, 0x1D, 0x28,
-    0x11, 0x28, 0x28, 0x28,
-    0x11, 0x11, 0x28, 0x28,
-    0x11, 0x11, 0x11, 0x28,
-    0x11, 0x1E, 0x25, 0x2B,
-    0x11, 0x17, 0x25, 0x2B,
-    0x11, 0x17, 0x1E, 0x2B,
-    0x11, 0x2B, 0x2B, 0x2B,
-    0x11, 0x11, 0x2B, 0x2B,
-    0x11, 0x11, 0x11, 0x2B,
-    0x11, 0x1F, 0x27, 0x2E,
-    0x11, 0x18, 0x27, 0x2E,
-    0x11, 0x18, 0x20, 0x2E,
-    0x11, 0x2E, 0x2E, 0x2E,
-    0x11, 0x11, 0x2E, 0x2E,
-    0x11, 0x11, 0x11, 0x2E,
-    0x11, 0x21, 0x29, 0x31,
-    0x11, 0x19, 0x29, 0x31,
-    0x11, 0x19, 0x21, 0x31,
-    0x11, 0x31, 0x31, 0x31,
-    0x11, 0x11, 0x31, 0x31,
-    0x11, 0x11, 0x11, 0x31,
-    0x11, 0x34, 0x34, 0x34,
-    0x11, 0x11, 0x34, 0x34,
-    0x11, 0x11, 0x11, 0x34,
-    0x11, 0x23, 0x2C, 0x35,
-    0x11, 0x1A, 0x2C, 0x35,
-    0x11, 0x1A, 0x23, 0x35,
-    0x11, 0x39, 0x39, 0x39,
-    0x11, 0x11, 0x39, 0x39,
-    0x11, 0x11, 0x11, 0x39,
-    0x11, 0x3F, 0x3F, 0x3F,
-    0x11, 0x11, 0x3F, 0x3F,
-    0x11, 0x11, 0x11, 0x3F,
-    0x12, 0x13, 0x13, 0x14,
-    0x12, 0x13, 0x14, 0x15,
-    0x12, 0x14, 0x15, 0x16,
-    0x12, 0x13, 0x15, 0x16,
-    0x12, 0x13, 0x14, 0x16,
-    0x12, 0x14, 0x15, 0x17,
-    0x12, 0x14, 0x16, 0x17,
-    0x12, 0x13, 0x16, 0x17,
-    0x12, 0x13, 0x15, 0x17,
-    0x12, 0x14, 0x16, 0x18,
-    0x12, 0x15, 0x17, 0x18,
-    0x12, 0x13, 0x17, 0x18,
-    0x12, 0x13, 0x15, 0x18,
-    0x12, 0x18, 0x18, 0x18,
-    0x12, 0x12, 0x18, 0x18,
-    0x12, 0x12, 0x12, 0x18,
-    0x12, 0x15, 0x16, 0x19,
-    0x12, 0x15, 0x18, 0x19,
-    0x12, 0x13, 0x18, 0x19,
-    0x12, 0x13, 0x16, 0x19,
-    0x12, 0x15, 0x17, 0x1A,
-    0x12, 0x16, 0x18, 0x1A,
-    0x12, 0x14, 0x18, 0x1A,
-    0x12, 0x14, 0x16, 0x1A,
-    0x12, 0x1A, 0x1A, 0x1A,
-    0x12, 0x12, 0x1A, 0x1A,
-    0x12, 0x12, 0x12, 0x1A,
-    0x12, 0x16, 0x19, 0x1D,
-    0x12, 0x17, 0x1B, 0x1D,
-    0x12, 0x14, 0x1B, 0x1D,
-    0x12, 0x14, 0x18, 0x1D,
-    0x12, 0x1D, 0x1D, 0x1D,
-    0x12, 0x12, 0x1D, 0x1D,
-    0x12, 0x12, 0x12, 0x1D,
-    0x12, 0x17, 0x1B, 0x20,
-    0x12, 0x19, 0x1D, 0x20,
-    0x12, 0x15, 0x1D, 0x20,
-    0x12, 0x15, 0x19, 0x20,
-    0x12, 0x20, 0x20, 0x20,
-    0x12, 0x12, 0x20, 0x20,
-    0x12, 0x12, 0x12, 0x20,
-    0x12, 0x18, 0x1D, 0x23,
-    0x12, 0x1A, 0x1F, 0x23,
-    0x12, 0x16, 0x1F, 0x23,
-    0x12, 0x16, 0x1B, 0x23,
-    0x12, 0x23, 0x23, 0x23,
-    0x12, 0x12, 0x23, 0x23,
-    0x12, 0x12, 0x12, 0x23,
-    0x12, 0x19, 0x1F, 0x26,
-    0x12, 0x1C, 0x21, 0x26,
-    0x12, 0x17, 0x21, 0x26,
-    0x12, 0x17, 0x1C, 0x26,
-    0x12, 0x26, 0x26, 0x26,
-    0x12, 0x12, 0x26, 0x26,
-    0x12, 0x12, 0x12, 0x26,
-    0x12, 0x1D, 0x24, 0x29,
-    0x12, 0x17, 0x24, 0x29,
-    0x12, 0x17, 0x1E, 0x29,
-    0x12, 0x29, 0x29, 0x29,
-    0x12, 0x12, 0x29, 0x29,
-    0x12, 0x12, 0x12, 0x29,
-    0x12, 0x1F, 0x26, 0x2C,
-    0x12, 0x18, 0x26, 0x2C,
-    0x12, 0x18, 0x1F, 0x2C,
-    0x12, 0x2C, 0x2C, 0x2C,
-    0x12, 0x12, 0x2C, 0x2C,
-    0x12, 0x12, 0x12, 0x2C,
-    0x12, 0x20, 0x28, 0x2F,
-    0x12, 0x19, 0x28, 0x2F,
-    0x12, 0x19, 0x21, 0x2F,
-    0x12, 0x2F, 0x2F, 0x2F,
-    0x12, 0x12, 0x2F, 0x2F,
-    0x12, 0x12, 0x12, 0x2F,
-    0x12, 0x22, 0x2A, 0x32,
-    0x12, 0x1A, 0x2A, 0x32,
-    0x12, 0x1A, 0x22, 0x32,
-    0x12, 0x32, 0x32, 0x32,
-    0x12, 0x12, 0x32, 0x32,
-    0x12, 0x12, 0x12, 0x32,
-    0x12, 0x35, 0x35, 0x35,
-    0x12, 0x12, 0x35, 0x35,
-    0x12, 0x12, 0x12, 0x35,
-    0x12, 0x24, 0x2D, 0x36,
-    0x12, 0x1B, 0x2D, 0x36,
-    0x12, 0x1B, 0x24, 0x36,
-    0x12, 0x3A, 0x3A, 0x3A,
-    0x12, 0x12, 0x3A, 0x3A,
-    0x12, 0x12, 0x12, 0x3A,
-    0x13, 0x14, 0x14, 0x15,
-    0x13, 0x14, 0x15, 0x16,
-    0x13, 0x15, 0x16, 0x17,
-    0x13, 0x14, 0x16, 0x17,
-    0x13, 0x14, 0x15, 0x17,
-    0x13, 0x15, 0x16, 0x18,
-    0x13, 0x15, 0x17, 0x18,
-    0x13, 0x14, 0x17, 0x18,
-    0x13, 0x14, 0x16, 0x18,
-    0x13, 0x15, 0x17, 0x19,
-    0x13, 0x16, 0x18, 0x19,
-    0x13, 0x14, 0x18, 0x19,
-    0x13, 0x14, 0x16, 0x19,
-    0x13, 0x19, 0x19, 0x19,
-    0x13, 0x13, 0x19, 0x19,
-    0x13, 0x13, 0x13, 0x19,
-    0x13, 0x16, 0x17, 0x1A,
-    0x13, 0x16, 0x19, 0x1A,
-    0x13, 0x14, 0x19, 0x1A,
-    0x13, 0x14, 0x17, 0x1A,
-    0x13, 0x16, 0x18, 0x1B,
-    0x13, 0x17, 0x19, 0x1B,
-    0x13, 0x15, 0x19, 0x1B,
-    0x13, 0x15, 0x17, 0x1B,
-    0x13, 0x1B, 0x1B, 0x1B,
-    0x13, 0x13, 0x1B, 0x1B,
-    0x13, 0x13, 0x13, 0x1B,
-    0x13, 0x17, 0x1A, 0x1E,
-    0x13, 0x18, 0x1C, 0x1E,
-    0x13, 0x15, 0x1C, 0x1E,
-    0x13, 0x15, 0x19, 0x1E,
-    0x13, 0x1E, 0x1E, 0x1E,
-    0x13, 0x13, 0x1E, 0x1E,
-    0x13, 0x13, 0x13, 0x1E,
-    0x13, 0x18, 0x1C, 0x21,
-    0x13, 0x1A, 0x1E, 0x21,
-    0x13, 0x16, 0x1E, 0x21,
-    0x13, 0x16, 0x1A, 0x21,
-    0x13, 0x21, 0x21, 0x21,
-    0x13, 0x13, 0x21, 0x21,
-    0x13, 0x13, 0x13, 0x21,
-    0x13, 0x19, 0x1E, 0x24,
-    0x13, 0x1B, 0x20, 0x24,
-    0x13, 0x17, 0x20, 0x24,
-    0x13, 0x17, 0x1C, 0x24,
-    0x13, 0x24, 0x24, 0x24,
-    0x13, 0x13, 0x24, 0x24,
-    0x13, 0x13, 0x13, 0x24,
-    0x13, 0x1A, 0x20, 0x27,
-    0x13, 0x1D, 0x22, 0x27,
-    0x13, 0x18, 0x22, 0x27,
-    0x13, 0x18, 0x1D, 0x27,
-    0x13, 0x27, 0x27, 0x27,
-    0x13, 0x13, 0x27, 0x27,
-    0x13, 0x13, 0x13, 0x27,
-    0x13, 0x1E, 0x25, 0x2A,
-    0x13, 0x18, 0x25, 0x2A,
-    0x13, 0x18, 0x1F, 0x2A,
-    0x13, 0x2A, 0x2A, 0x2A,
-    0x13, 0x13, 0x2A, 0x2A,
-    0x13, 0x13, 0x13, 0x2A,
-    0x13, 0x20, 0x27, 0x2D,
-    0x13, 0x19, 0x27, 0x2D,
-    0x13, 0x19, 0x20, 0x2D,
-    0x13, 0x2D, 0x2D, 0x2D,
-    0x13, 0x13, 0x2D, 0x2D,
-    0x13, 0x13, 0x13, 0x2D,
-    0x13, 0x21, 0x29, 0x30,
-    0x13, 0x1A, 0x29, 0x30,
-    0x13, 0x1A, 0x22, 0x30,
-    0x13, 0x30, 0x30, 0x30,
-    0x13, 0x13, 0x30, 0x30,
-    0x13, 0x13, 0x13, 0x30,
-    0x13, 0x23, 0x2B, 0x33,
-    0x13, 0x1B, 0x2B, 0x33,
-    0x13, 0x1B, 0x23, 0x33,
-    0x13, 0x33, 0x33, 0x33,
-    0x13, 0x13, 0x33, 0x33,
-    0x13, 0x13, 0x13, 0x33,
-    0x13, 0x36, 0x36, 0x36,
-    0x13, 0x13, 0x36, 0x36,
-    0x13, 0x13, 0x13, 0x36,
-    0x13, 0x25, 0x2E, 0x37,
-    0x13, 0x1C, 0x2E, 0x37,
-    0x13, 0x1C, 0x25, 0x37,
-    0x13, 0x3B, 0x3B, 0x3B,
-    0x13, 0x13, 0x3B, 0x3B,
-    0x13, 0x13, 0x13, 0x3B,
-    0x14, 0x15, 0x15, 0x16,
-    0x14, 0x15, 0x16, 0x17,
-    0x14, 0x16, 0x17, 0x18,
-    0x14, 0x15, 0x17, 0x18,
-    0x14, 0x15, 0x16, 0x18,
-    0x14, 0x16, 0x17, 0x19,
-    0x14, 0x16, 0x18, 0x19,
-    0x14, 0x15, 0x18, 0x19,
-    0x14, 0x15, 0x17, 0x19,
-    0x14, 0x16, 0x18, 0x1A,
-    0x14, 0x17, 0x19, 0x1A,
-    0x14, 0x15, 0x19, 0x1A,
-    0x14, 0x15, 0x17, 0x1A,
-    0x14, 0x1A, 0x1A, 0x1A,
-    0x14, 0x14, 0x1A, 0x1A,
-    0x14, 0x14, 0x14, 0x1A,
-    0x14, 0x17, 0x18, 0x1B,
-    0x14, 0x17, 0x1A, 0x1B,
-    0x14, 0x15, 0x1A, 0x1B,
-    0x14, 0x15, 0x18, 0x1B,
-    0x14, 0x17, 0x19, 0x1C,
-    0x14, 0x18, 0x1A, 0x1C,
-    0x14, 0x16, 0x1A, 0x1C,
-    0x14, 0x16, 0x18, 0x1C,
-    0x14, 0x1C, 0x1C, 0x1C,
-    0x14, 0x14, 0x1C, 0x1C,
-    0x14, 0x14, 0x14, 0x1C,
-    0x14, 0x18, 0x1B, 0x1F,
-    0x14, 0x19, 0x1D, 0x1F,
-    0x14, 0x16, 0x1D, 0x1F,
-    0x14, 0x16, 0x1A, 0x1F,
-    0x14, 0x1F, 0x1F, 0x1F,
-    0x14, 0x14, 0x1F, 0x1F,
-    0x14, 0x14, 0x14, 0x1F,
-    0x14, 0x19, 0x1D, 0x22,
-    0x14, 0x1B, 0x1F, 0x22,
-    0x14, 0x17, 0x1F, 0x22,
-    0x14, 0x17, 0x1B, 0x22,
-    0x14, 0x22, 0x22, 0x22,
-    0x14, 0x14, 0x22, 0x22,
-    0x14, 0x14, 0x14, 0x22,
-    0x14, 0x1A, 0x1F, 0x25,
-    0x14, 0x1C, 0x21, 0x25,
-    0x14, 0x18, 0x21, 0x25,
-    0x14, 0x18, 0x1D, 0x25,
-    0x14, 0x25, 0x25, 0x25,
-    0x14, 0x14, 0x25, 0x25,
-    0x14, 0x14, 0x14, 0x25,
-    0x14, 0x1B, 0x21, 0x28,
-    0x14, 0x1E, 0x23, 0x28,
-    0x14, 0x19, 0x23, 0x28,
-    0x14, 0x19, 0x1E, 0x28,
-    0x14, 0x28, 0x28, 0x28,
-    0x14, 0x14, 0x28, 0x28,
-    0x14, 0x14, 0x14, 0x28,
-    0x14, 0x1F, 0x26, 0x2B,
-    0x14, 0x19, 0x26, 0x2B,
-    0x14, 0x19, 0x20, 0x2B,
-    0x14, 0x2B, 0x2B, 0x2B,
-    0x14, 0x14, 0x2B, 0x2B,
-    0x14, 0x14, 0x14, 0x2B,
-    0x14, 0x21, 0x28, 0x2E,
-    0x14, 0x1A, 0x28, 0x2E,
-    0x14, 0x1A, 0x21, 0x2E,
-    0x14, 0x2E, 0x2E, 0x2E,
-    0x14, 0x14, 0x2E, 0x2E,
-    0x14, 0x14, 0x14, 0x2E,
-    0x14, 0x22, 0x2A, 0x31,
-    0x14, 0x1B, 0x2A, 0x31,
-    0x14, 0x1B, 0x23, 0x31,
-    0x14, 0x31, 0x31, 0x31,
-    0x14, 0x14, 0x31, 0x31,
-    0x14, 0x14, 0x14, 0x31,
-    0x14, 0x24, 0x2C, 0x34,
-    0x14, 0x1C, 0x2C, 0x34,
-    0x14, 0x1C, 0x24, 0x34,
-    0x14, 0x34, 0x34, 0x34,
-    0x14, 0x14, 0x34, 0x34,
-    0x14, 0x14, 0x14, 0x34,
-    0x14, 0x37, 0x37, 0x37,
-    0x14, 0x14, 0x37, 0x37,
-    0x14, 0x14, 0x14, 0x37,
-    0x14, 0x26, 0x2F, 0x38,
-    0x14, 0x1D, 0x2F, 0x38,
-    0x14, 0x1D, 0x26, 0x38,
-    0x14, 0x3C, 0x3C, 0x3C,
-    0x14, 0x14, 0x3C, 0x3C,
-    0x14, 0x14, 0x14, 0x3C,
-    0x15, 0x16, 0x16, 0x17,
-    0x15, 0x16, 0x17, 0x18,
-    0x15, 0x17, 0x18, 0x19,
-    0x15, 0x16, 0x18, 0x19,
-    0x15, 0x16, 0x17, 0x19,
-    0x15, 0x17, 0x18, 0x1A,
-    0x15, 0x17, 0x19, 0x1A,
-    0x15, 0x16, 0x19, 0x1A,
-    0x15, 0x16, 0x18, 0x1A,
-    0x15, 0x17, 0x19, 0x1B,
-    0x15, 0x18, 0x1A, 0x1B,
-    0x15, 0x16, 0x1A, 0x1B,
-    0x15, 0x16, 0x18, 0x1B,
-    0x15, 0x1B, 0x1B, 0x1B,
-    0x15, 0x15, 0x1B, 0x1B,
-    0x15, 0x15, 0x15, 0x1B,
-    0x15, 0x18, 0x19, 0x1C,
-    0x15, 0x18, 0x1B, 0x1C,
-    0x15, 0x16, 0x1B, 0x1C,
-    0x15, 0x16, 0x19, 0x1C,
-    0x15, 0x18, 0x1A, 0x1D,
-    0x15, 0x19, 0x1B, 0x1D,
-    0x15, 0x17, 0x1B, 0x1D,
-    0x15, 0x17, 0x19, 0x1D,
-    0x15, 0x1D, 0x1D, 0x1D,
-    0x15, 0x15, 0x1D, 0x1D,
-    0x15, 0x15, 0x15, 0x1D,
-    0x15, 0x19, 0x1C, 0x20,
-    0x15, 0x1A, 0x1E, 0x20,
-    0x15, 0x17, 0x1E, 0x20,
-    0x15, 0x17, 0x1B, 0x20,
-    0x15, 0x20, 0x20, 0x20,
-    0x15, 0x15, 0x20, 0x20,
-    0x15, 0x15, 0x15, 0x20,
-    0x15, 0x1A, 0x1E, 0x23,
-    0x15, 0x1C, 0x20, 0x23,
-    0x15, 0x18, 0x20, 0x23,
-    0x15, 0x18, 0x1C, 0x23,
-    0x15, 0x23, 0x23, 0x23,
-    0x15, 0x15, 0x23, 0x23,
-    0x15, 0x15, 0x15, 0x23,
-    0x15, 0x1B, 0x20, 0x26,
-    0x15, 0x1D, 0x22, 0x26,
-    0x15, 0x19, 0x22, 0x26,
-    0x15, 0x19, 0x1E, 0x26,
-    0x15, 0x26, 0x26, 0x26,
-    0x15, 0x15, 0x26, 0x26,
-    0x15, 0x15, 0x15, 0x26,
-    0x15, 0x1C, 0x22, 0x29,
-    0x15, 0x1F, 0x24, 0x29,
-    0x15, 0x1A, 0x24, 0x29,
-    0x15, 0x1A, 0x1F, 0x29,
-    0x15, 0x29, 0x29, 0x29,
-    0x15, 0x15, 0x29, 0x29,
-    0x15, 0x15, 0x15, 0x29,
-    0x15, 0x20, 0x27, 0x2C,
-    0x15, 0x1A, 0x27, 0x2C,
-    0x15, 0x1A, 0x21, 0x2C,
-    0x15, 0x2C, 0x2C, 0x2C,
-    0x15, 0x15, 0x2C, 0x2C,
-    0x15, 0x15, 0x15, 0x2C,
-    0x15, 0x22, 0x29, 0x2F,
-    0x15, 0x1B, 0x29, 0x2F,
-    0x15, 0x1B, 0x22, 0x2F,
-    0x15, 0x2F, 0x2F, 0x2F,
-    0x15, 0x15, 0x2F, 0x2F,
-    0x15, 0x15, 0x15, 0x2F,
-    0x15, 0x23, 0x2B, 0x32,
-    0x15, 0x1C, 0x2B, 0x32,
-    0x15, 0x1C, 0x24, 0x32,
-    0x15, 0x32, 0x32, 0x32,
-    0x15, 0x15, 0x32, 0x32,
-    0x15, 0x15, 0x15, 0x32,
-    0x15, 0x25, 0x2D, 0x35,
-    0x15, 0x1D, 0x2D, 0x35,
-    0x15, 0x1D, 0x25, 0x35,
-    0x15, 0x35, 0x35, 0x35,
-    0x15, 0x15, 0x35, 0x35,
-    0x15, 0x15, 0x15, 0x35,
-    0x15, 0x38, 0x38, 0x38,
-    0x15, 0x15, 0x38, 0x38,
-    0x15, 0x15, 0x15, 0x38,
-    0x15, 0x27, 0x30, 0x39,
-    0x15, 0x1E, 0x30, 0x39,
-    0x15, 0x1E, 0x27, 0x39,
-    0x15, 0x3D, 0x3D, 0x3D,
-    0x15, 0x15, 0x3D, 0x3D,
-    0x15, 0x15, 0x15, 0x3D,
-    0x16, 0x17, 0x17, 0x18,
-    0x16, 0x17, 0x18, 0x19,
-    0x16, 0x18, 0x19, 0x1A,
-    0x16, 0x17, 0x19, 0x1A,
-    0x16, 0x17, 0x18, 0x1A,
-    0x16, 0x18, 0x19, 0x1B,
-    0x16, 0x18, 0x1A, 0x1B,
-    0x16, 0x17, 0x1A, 0x1B,
-    0x16, 0x17, 0x19, 0x1B,
-    0x16, 0x18, 0x1A, 0x1C,
-    0x16, 0x19, 0x1B, 0x1C,
-    0x16, 0x17, 0x1B, 0x1C,
-    0x16, 0x17, 0x19, 0x1C,
-    0x16, 0x1C, 0x1C, 0x1C,
-    0x16, 0x16, 0x1C, 0x1C,
-    0x16, 0x16, 0x16, 0x1C,
-    0x16, 0x19, 0x1A, 0x1D,
-    0x16, 0x19, 0x1C, 0x1D,
-    0x16, 0x17, 0x1C, 0x1D,
-    0x16, 0x17, 0x1A, 0x1D,
-    0x16, 0x19, 0x1B, 0x1E,
-    0x16, 0x1A, 0x1C, 0x1E,
-    0x16, 0x18, 0x1C, 0x1E,
-    0x16, 0x18, 0x1A, 0x1E,
-    0x16, 0x1E, 0x1E, 0x1E,
-    0x16, 0x16, 0x1E, 0x1E,
-    0x16, 0x16, 0x16, 0x1E,
-    0x16, 0x1A, 0x1D, 0x21,
-    0x16, 0x1B, 0x1F, 0x21,
-    0x16, 0x18, 0x1F, 0x21,
-    0x16, 0x18, 0x1C, 0x21,
-    0x16, 0x21, 0x21, 0x21,
-    0x16, 0x16, 0x21, 0x21,
-    0x16, 0x16, 0x16, 0x21,
-    0x16, 0x1B, 0x1F, 0x24,
-    0x16, 0x1D, 0x21, 0x24,
-    0x16, 0x19, 0x21, 0x24,
-    0x16, 0x19, 0x1D, 0x24,
-    0x16, 0x24, 0x24, 0x24,
-    0x16, 0x16, 0x24, 0x24,
-    0x16, 0x16, 0x16, 0x24,
-    0x16, 0x1C, 0x21, 0x27,
-    0x16, 0x1E, 0x23, 0x27,
-    0x16, 0x1A, 0x23, 0x27,
-    0x16, 0x1A, 0x1F, 0x27,
-    0x16, 0x27, 0x27, 0x27,
-    0x16, 0x16, 0x27, 0x27,
-    0x16, 0x16, 0x16, 0x27,
-    0x16, 0x1D, 0x23, 0x2A,
-    0x16, 0x20, 0x25, 0x2A,
-    0x16, 0x1B, 0x25, 0x2A,
-    0x16, 0x1B, 0x20, 0x2A,
-    0x16, 0x2A, 0x2A, 0x2A,
-    0x16, 0x16, 0x2A, 0x2A,
-    0x16, 0x16, 0x16, 0x2A,
-    0x16, 0x21, 0x28, 0x2D,
-    0x16, 0x1B, 0x28, 0x2D,
-    0x16, 0x1B, 0x22, 0x2D,
-    0x16, 0x2D, 0x2D, 0x2D,
-    0x16, 0x16, 0x2D, 0x2D,
-    0x16, 0x16, 0x16, 0x2D,
-    0x16, 0x23, 0x2A, 0x30,
-    0x16, 0x1C, 0x2A, 0x30,
-    0x16, 0x1C, 0x23, 0x30,
-    0x16, 0x30, 0x30, 0x30,
-    0x16, 0x16, 0x30, 0x30,
-    0x16, 0x16, 0x16, 0x30,
-    0x16, 0x24, 0x2C, 0x33,
-    0x16, 0x1D, 0x2C, 0x33,
-    0x16, 0x1D, 0x25, 0x33,
-    0x16, 0x33, 0x33, 0x33,
-    0x16, 0x16, 0x33, 0x33,
-    0x16, 0x16, 0x16, 0x33,
-    0x16, 0x26, 0x2E, 0x36,
-    0x16, 0x1E, 0x2E, 0x36,
-    0x16, 0x1E, 0x26, 0x36,
-    0x16, 0x36, 0x36, 0x36,
-    0x16, 0x16, 0x36, 0x36,
-    0x16, 0x16, 0x16, 0x36,
-    0x16, 0x39, 0x39, 0x39,
-    0x16, 0x16, 0x39, 0x39,
-    0x16, 0x16, 0x16, 0x39,
-    0x16, 0x28, 0x31, 0x3A,
-    0x16, 0x1F, 0x31, 0x3A,
-    0x16, 0x1F, 0x28, 0x3A,
-    0x16, 0x3E, 0x3E, 0x3E,
-    0x16, 0x16, 0x3E, 0x3E,
-    0x16, 0x16, 0x16, 0x3E,
-    0x17, 0x18, 0x18, 0x19,
-    0x17, 0x18, 0x19, 0x1A,
-    0x17, 0x19, 0x1A, 0x1B,
-    0x17, 0x18, 0x1A, 0x1B,
-    0x17, 0x18, 0x19, 0x1B,
-    0x17, 0x19, 0x1A, 0x1C,
-    0x17, 0x19, 0x1B, 0x1C,
-    0x17, 0x18, 0x1B, 0x1C,
-    0x17, 0x18, 0x1A, 0x1C,
-    0x17, 0x19, 0x1B, 0x1D,
-    0x17, 0x1A, 0x1C, 0x1D,
-    0x17, 0x18, 0x1C, 0x1D,
-    0x17, 0x18, 0x1A, 0x1D,
-    0x17, 0x1D, 0x1D, 0x1D,
-    0x17, 0x17, 0x1D, 0x1D,
-    0x17, 0x17, 0x17, 0x1D,
-    0x17, 0x1A, 0x1B, 0x1E,
-    0x17, 0x1A, 0x1D, 0x1E,
-    0x17, 0x18, 0x1D, 0x1E,
-    0x17, 0x18, 0x1B, 0x1E,
-    0x17, 0x1A, 0x1C, 0x1F,
-    0x17, 0x1B, 0x1D, 0x1F,
-    0x17, 0x19, 0x1D, 0x1F,
-    0x17, 0x19, 0x1B, 0x1F,
-    0x17, 0x1F, 0x1F, 0x1F,
-    0x17, 0x17, 0x1F, 0x1F,
-    0x17, 0x17, 0x17, 0x1F,
-    0x17, 0x1B, 0x1E, 0x22,
-    0x17, 0x1C, 0x20, 0x22,
-    0x17, 0x19, 0x20, 0x22,
-    0x17, 0x19, 0x1D, 0x22,
-    0x17, 0x22, 0x22, 0x22,
-    0x17, 0x17, 0x22, 0x22,
-    0x17, 0x17, 0x17, 0x22,
-    0x17, 0x1C, 0x20, 0x25,
-    0x17, 0x1E, 0x22, 0x25,
-    0x17, 0x1A, 0x22, 0x25,
-    0x17, 0x1A, 0x1E, 0x25,
-    0x17, 0x25, 0x25, 0x25,
-    0x17, 0x17, 0x25, 0x25,
-    0x17, 0x17, 0x17, 0x25,
-    0x17, 0x1D, 0x22, 0x28,
-    0x17, 0x1F, 0x24, 0x28,
-    0x17, 0x1B, 0x24, 0x28,
-    0x17, 0x1B, 0x20, 0x28,
-    0x17, 0x28, 0x28, 0x28,
-    0x17, 0x17, 0x28, 0x28,
-    0x17, 0x17, 0x17, 0x28,
-    0x17, 0x1E, 0x24, 0x2B,
-    0x17, 0x21, 0x26, 0x2B,
-    0x17, 0x1C, 0x26, 0x2B,
-    0x17, 0x1C, 0x21, 0x2B,
-    0x17, 0x2B, 0x2B, 0x2B,
-    0x17, 0x17, 0x2B, 0x2B,
-    0x17, 0x17, 0x17, 0x2B,
-    0x17, 0x22, 0x29, 0x2E,
-    0x17, 0x1C, 0x29, 0x2E,
-    0x17, 0x1C, 0x23, 0x2E,
-    0x17, 0x2E, 0x2E, 0x2E,
-    0x17, 0x17, 0x2E, 0x2E,
-    0x17, 0x17, 0x17, 0x2E,
-    0x17, 0x24, 0x2B, 0x31,
-    0x17, 0x1D, 0x2B, 0x31,
-    0x17, 0x1D, 0x24, 0x31,
-    0x17, 0x31, 0x31, 0x31,
-    0x17, 0x17, 0x31, 0x31,
-    0x17, 0x17, 0x17, 0x31,
-    0x17, 0x25, 0x2D, 0x34,
-    0x17, 0x1E, 0x2D, 0x34,
-    0x17, 0x1E, 0x26, 0x34,
-    0x17, 0x34, 0x34, 0x34,
-    0x17, 0x17, 0x34, 0x34,
-    0x17, 0x17, 0x17, 0x34,
-    0x17, 0x27, 0x2F, 0x37,
-    0x17, 0x1F, 0x2F, 0x37,
-    0x17, 0x1F, 0x27, 0x37,
-    0x17, 0x37, 0x37, 0x37,
-    0x17, 0x17, 0x37, 0x37,
-    0x17, 0x17, 0x17, 0x37,
-    0x17, 0x3A, 0x3A, 0x3A,
-    0x17, 0x17, 0x3A, 0x3A,
-    0x17, 0x17, 0x17, 0x3A,
-    0x17, 0x29, 0x32, 0x3B,
-    0x17, 0x20, 0x32, 0x3B,
-    0x17, 0x20, 0x29, 0x3B,
-    0x17, 0x3F, 0x3F, 0x3F,
-    0x17, 0x17, 0x3F, 0x3F,
-    0x17, 0x17, 0x17, 0x3F,
-    0x18, 0x19, 0x19, 0x1A,
-    0x18, 0x19, 0x1A, 0x1B,
-    0x18, 0x1A, 0x1B, 0x1C,
-    0x18, 0x19, 0x1B, 0x1C,
-    0x18, 0x19, 0x1A, 0x1C,
-    0x18, 0x1A, 0x1B, 0x1D,
-    0x18, 0x1A, 0x1C, 0x1D,
-    0x18, 0x19, 0x1C, 0x1D,
-    0x18, 0x19, 0x1B, 0x1D,
-    0x18, 0x1A, 0x1C, 0x1E,
-    0x18, 0x1B, 0x1D, 0x1E,
-    0x18, 0x19, 0x1D, 0x1E,
-    0x18, 0x19, 0x1B, 0x1E,
-    0x18, 0x1E, 0x1E, 0x1E,
-    0x18, 0x18, 0x1E, 0x1E,
-    0x18, 0x18, 0x18, 0x1E,
-    0x18, 0x1B, 0x1C, 0x1F,
-    0x18, 0x1B, 0x1E, 0x1F,
-    0x18, 0x19, 0x1E, 0x1F,
-    0x18, 0x19, 0x1C, 0x1F,
-    0x18, 0x1B, 0x1D, 0x20,
-    0x18, 0x1C, 0x1E, 0x20,
-    0x18, 0x1A, 0x1E, 0x20,
-    0x18, 0x1A, 0x1C, 0x20,
-    0x18, 0x20, 0x20, 0x20,
-    0x18, 0x18, 0x20, 0x20,
-    0x18, 0x18, 0x18, 0x20,
-    0x18, 0x1C, 0x1F, 0x23,
-    0x18, 0x1D, 0x21, 0x23,
-    0x18, 0x1A, 0x21, 0x23,
-    0x18, 0x1A, 0x1E, 0x23,
-    0x18, 0x23, 0x23, 0x23,
-    0x18, 0x18, 0x23, 0x23,
-    0x18, 0x18, 0x18, 0x23,
-    0x18, 0x1D, 0x21, 0x26,
-    0x18, 0x1F, 0x23, 0x26,
-    0x18, 0x1B, 0x23, 0x26,
-    0x18, 0x1B, 0x1F, 0x26,
-    0x18, 0x26, 0x26, 0x26,
-    0x18, 0x18, 0x26, 0x26,
-    0x18, 0x18, 0x18, 0x26,
-    0x18, 0x1E, 0x23, 0x29,
-    0x18, 0x20, 0x25, 0x29,
-    0x18, 0x1C, 0x25, 0x29,
-    0x18, 0x1C, 0x21, 0x29,
-    0x18, 0x29, 0x29, 0x29,
-    0x18, 0x18, 0x29, 0x29,
-    0x18, 0x18, 0x18, 0x29,
-    0x18, 0x1F, 0x25, 0x2C,
-    0x18, 0x22, 0x27, 0x2C,
-    0x18, 0x1D, 0x27, 0x2C,
-    0x18, 0x1D, 0x22, 0x2C,
-    0x18, 0x2C, 0x2C, 0x2C,
-    0x18, 0x18, 0x2C, 0x2C,
-    0x18, 0x18, 0x18, 0x2C,
-    0x18, 0x23, 0x2A, 0x2F,
-    0x18, 0x1D, 0x2A, 0x2F,
-    0x18, 0x1D, 0x24, 0x2F,
-    0x18, 0x2F, 0x2F, 0x2F,
-    0x18, 0x18, 0x2F, 0x2F,
-    0x18, 0x18, 0x18, 0x2F,
-    0x18, 0x25, 0x2C, 0x32,
-    0x18, 0x1E, 0x2C, 0x32,
-    0x18, 0x1E, 0x25, 0x32,
-    0x18, 0x32, 0x32, 0x32,
-    0x18, 0x18, 0x32, 0x32,
-    0x18, 0x18, 0x18, 0x32,
-    0x18, 0x26, 0x2E, 0x35,
-    0x18, 0x1F, 0x2E, 0x35,
-    0x18, 0x1F, 0x27, 0x35,
-    0x18, 0x35, 0x35, 0x35,
-    0x18, 0x18, 0x35, 0x35,
-    0x18, 0x18, 0x18, 0x35,
-    0x18, 0x28, 0x30, 0x38,
-    0x18, 0x20, 0x30, 0x38,
-    0x18, 0x20, 0x28, 0x38,
-    0x18, 0x38, 0x38, 0x38,
-    0x18, 0x18, 0x38, 0x38,
-    0x18, 0x18, 0x18, 0x38,
-    0x18, 0x3B, 0x3B, 0x3B,
-    0x18, 0x18, 0x3B, 0x3B,
-    0x18, 0x18, 0x18, 0x3B,
-    0x18, 0x2A, 0x33, 0x3C,
-    0x18, 0x21, 0x33, 0x3C,
-    0x18, 0x21, 0x2A, 0x3C,
-    0x19, 0x1A, 0x1A, 0x1B,
-    0x19, 0x1A, 0x1B, 0x1C,
-    0x19, 0x1B, 0x1C, 0x1D,
-    0x19, 0x1A, 0x1C, 0x1D,
-    0x19, 0x1A, 0x1B, 0x1D,
-    0x19, 0x1B, 0x1C, 0x1E,
-    0x19, 0x1B, 0x1D, 0x1E,
-    0x19, 0x1A, 0x1D, 0x1E,
-    0x19, 0x1A, 0x1C, 0x1E,
-    0x19, 0x1B, 0x1D, 0x1F,
-    0x19, 0x1C, 0x1E, 0x1F,
-    0x19, 0x1A, 0x1E, 0x1F,
-    0x19, 0x1A, 0x1C, 0x1F,
-    0x19, 0x1F, 0x1F, 0x1F,
-    0x19, 0x19, 0x1F, 0x1F,
-    0x19, 0x19, 0x19, 0x1F,
-    0x19, 0x1C, 0x1D, 0x20,
-    0x19, 0x1C, 0x1F, 0x20,
-    0x19, 0x1A, 0x1F, 0x20,
-    0x19, 0x1A, 0x1D, 0x20,
-    0x19, 0x1C, 0x1E, 0x21,
-    0x19, 0x1D, 0x1F, 0x21,
-    0x19, 0x1B, 0x1F, 0x21,
-    0x19, 0x1B, 0x1D, 0x21,
-    0x19, 0x21, 0x21, 0x21,
-    0x19, 0x19, 0x21, 0x21,
-    0x19, 0x19, 0x19, 0x21,
-    0x19, 0x1D, 0x20, 0x24,
-    0x19, 0x1E, 0x22, 0x24,
-    0x19, 0x1B, 0x22, 0x24,
-    0x19, 0x1B, 0x1F, 0x24,
-    0x19, 0x24, 0x24, 0x24,
-    0x19, 0x19, 0x24, 0x24,
-    0x19, 0x19, 0x19, 0x24,
-    0x19, 0x1E, 0x22, 0x27,
-    0x19, 0x20, 0x24, 0x27,
-    0x19, 0x1C, 0x24, 0x27,
-    0x19, 0x1C, 0x20, 0x27,
-    0x19, 0x27, 0x27, 0x27,
-    0x19, 0x19, 0x27, 0x27,
-    0x19, 0x19, 0x19, 0x27,
-    0x19, 0x1F, 0x24, 0x2A,
-    0x19, 0x21, 0x26, 0x2A,
-    0x19, 0x1D, 0x26, 0x2A,
-    0x19, 0x1D, 0x22, 0x2A,
-    0x19, 0x2A, 0x2A, 0x2A,
-    0x19, 0x19, 0x2A, 0x2A,
-    0x19, 0x19, 0x19, 0x2A,
-    0x19, 0x20, 0x26, 0x2D,
-    0x19, 0x23, 0x28, 0x2D,
-    0x19, 0x1E, 0x28, 0x2D,
-    0x19, 0x1E, 0x23, 0x2D,
-    0x19, 0x2D, 0x2D, 0x2D,
-    0x19, 0x19, 0x2D, 0x2D,
-    0x19, 0x19, 0x19, 0x2D,
-    0x19, 0x24, 0x2B, 0x30,
-    0x19, 0x1E, 0x2B, 0x30,
-    0x19, 0x1E, 0x25, 0x30,
-    0x19, 0x30, 0x30, 0x30,
-    0x19, 0x19, 0x30, 0x30,
-    0x19, 0x19, 0x19, 0x30,
-    0x19, 0x26, 0x2D, 0x33,
-    0x19, 0x1F, 0x2D, 0x33,
-    0x19, 0x1F, 0x26, 0x33,
-    0x19, 0x33, 0x33, 0x33,
-    0x19, 0x19, 0x33, 0x33,
-    0x19, 0x19, 0x19, 0x33,
-    0x19, 0x27, 0x2F, 0x36,
-    0x19, 0x20, 0x2F, 0x36,
-    0x19, 0x20, 0x28, 0x36,
-    0x19, 0x36, 0x36, 0x36,
-    0x19, 0x19, 0x36, 0x36,
-    0x19, 0x19, 0x19, 0x36,
-    0x19, 0x29, 0x31, 0x39,
-    0x19, 0x21, 0x31, 0x39,
-    0x19, 0x21, 0x29, 0x39,
-    0x19, 0x39, 0x39, 0x39,
-    0x19, 0x19, 0x39, 0x39,
-    0x19, 0x19, 0x19, 0x39,
-    0x19, 0x3C, 0x3C, 0x3C,
-    0x19, 0x19, 0x3C, 0x3C,
-    0x19, 0x19, 0x19, 0x3C,
-    0x19, 0x2B, 0x34, 0x3D,
-    0x19, 0x22, 0x34, 0x3D,
-    0x19, 0x22, 0x2B, 0x3D,
-    0x1A, 0x1B, 0x1B, 0x1C,
-    0x1A, 0x1B, 0x1C, 0x1D,
-    0x1A, 0x1C, 0x1D, 0x1E,
-    0x1A, 0x1B, 0x1D, 0x1E,
-    0x1A, 0x1B, 0x1C, 0x1E,
-    0x1A, 0x1C, 0x1D, 0x1F,
-    0x1A, 0x1C, 0x1E, 0x1F,
-    0x1A, 0x1B, 0x1E, 0x1F,
-    0x1A, 0x1B, 0x1D, 0x1F,
-    0x1A, 0x1C, 0x1E, 0x20,
-    0x1A, 0x1D, 0x1F, 0x20,
-    0x1A, 0x1B, 0x1F, 0x20,
-    0x1A, 0x1B, 0x1D, 0x20,
-    0x1A, 0x20, 0x20, 0x20,
-    0x1A, 0x1A, 0x20, 0x20,
-    0x1A, 0x1A, 0x1A, 0x20,
-    0x1A, 0x1D, 0x1E, 0x21,
-    0x1A, 0x1D, 0x20, 0x21,
-    0x1A, 0x1B, 0x20, 0x21,
-    0x1A, 0x1B, 0x1E, 0x21,
-    0x1A, 0x1D, 0x1F, 0x22,
-    0x1A, 0x1E, 0x20, 0x22,
-    0x1A, 0x1C, 0x20, 0x22,
-    0x1A, 0x1C, 0x1E, 0x22,
-    0x1A, 0x22, 0x22, 0x22,
-    0x1A, 0x1A, 0x22, 0x22,
-    0x1A, 0x1A, 0x1A, 0x22,
-    0x1A, 0x1E, 0x21, 0x25,
-    0x1A, 0x1F, 0x23, 0x25,
-    0x1A, 0x1C, 0x23, 0x25,
-    0x1A, 0x1C, 0x20, 0x25,
-    0x1A, 0x25, 0x25, 0x25,
-    0x1A, 0x1A, 0x25, 0x25,
-    0x1A, 0x1A, 0x1A, 0x25,
-    0x1A, 0x1F, 0x23, 0x28,
-    0x1A, 0x21, 0x25, 0x28,
-    0x1A, 0x1D, 0x25, 0x28,
-    0x1A, 0x1D, 0x21, 0x28,
-    0x1A, 0x28, 0x28, 0x28,
-    0x1A, 0x1A, 0x28, 0x28,
-    0x1A, 0x1A, 0x1A, 0x28,
-    0x1A, 0x20, 0x25, 0x2B,
-    0x1A, 0x22, 0x27, 0x2B,
-    0x1A, 0x1E, 0x27, 0x2B,
-    0x1A, 0x1E, 0x23, 0x2B,
-    0x1A, 0x2B, 0x2B, 0x2B,
-    0x1A, 0x1A, 0x2B, 0x2B,
-    0x1A, 0x1A, 0x1A, 0x2B,
-    0x1A, 0x21, 0x27, 0x2E,
-    0x1A, 0x24, 0x29, 0x2E,
-    0x1A, 0x1F, 0x29, 0x2E,
-    0x1A, 0x1F, 0x24, 0x2E,
-    0x1A, 0x2E, 0x2E, 0x2E,
-    0x1A, 0x1A, 0x2E, 0x2E,
-    0x1A, 0x1A, 0x1A, 0x2E,
-    0x1A, 0x25, 0x2C, 0x31,
-    0x1A, 0x1F, 0x2C, 0x31,
-    0x1A, 0x1F, 0x26, 0x31,
-    0x1A, 0x31, 0x31, 0x31,
-    0x1A, 0x1A, 0x31, 0x31,
-    0x1A, 0x1A, 0x1A, 0x31,
-    0x1A, 0x27, 0x2E, 0x34,
-    0x1A, 0x20, 0x2E, 0x34,
-    0x1A, 0x20, 0x27, 0x34,
-    0x1A, 0x34, 0x34, 0x34,
-    0x1A, 0x1A, 0x34, 0x34,
-    0x1A, 0x1A, 0x1A, 0x34,
-    0x1A, 0x28, 0x30, 0x37,
-    0x1A, 0x21, 0x30, 0x37,
-    0x1A, 0x21, 0x29, 0x37,
-    0x1A, 0x37, 0x37, 0x37,
-    0x1A, 0x1A, 0x37, 0x37,
-    0x1A, 0x1A, 0x1A, 0x37,
-    0x1A, 0x2A, 0x32, 0x3A,
-    0x1A, 0x22, 0x32, 0x3A,
-    0x1A, 0x22, 0x2A, 0x3A,
-    0x1A, 0x3A, 0x3A, 0x3A,
-    0x1A, 0x1A, 0x3A, 0x3A,
-    0x1A, 0x1A, 0x1A, 0x3A,
-    0x1A, 0x3D, 0x3D, 0x3D,
-    0x1A, 0x1A, 0x3D, 0x3D,
-    0x1A, 0x1A, 0x1A, 0x3D,
-    0x1A, 0x2C, 0x35, 0x3E,
-    0x1A, 0x23, 0x35, 0x3E,
-    0x1A, 0x23, 0x2C, 0x3E,
-    0x1B, 0x1C, 0x1C, 0x1D,
-    0x1B, 0x1C, 0x1D, 0x1E,
-    0x1B, 0x1D, 0x1E, 0x1F,
-    0x1B, 0x1C, 0x1E, 0x1F,
-    0x1B, 0x1C, 0x1D, 0x1F,
-    0x1B, 0x1D, 0x1E, 0x20,
-    0x1B, 0x1D, 0x1F, 0x20,
-    0x1B, 0x1C, 0x1F, 0x20,
-    0x1B, 0x1C, 0x1E, 0x20,
-    0x1B, 0x1D, 0x1F, 0x21,
-    0x1B, 0x1E, 0x20, 0x21,
-    0x1B, 0x1C, 0x20, 0x21,
-    0x1B, 0x1C, 0x1E, 0x21,
-    0x1B, 0x21, 0x21, 0x21,
-    0x1B, 0x1B, 0x21, 0x21,
-    0x1B, 0x1B, 0x1B, 0x21,
-    0x1B, 0x1E, 0x1F, 0x22,
-    0x1B, 0x1E, 0x21, 0x22,
-    0x1B, 0x1C, 0x21, 0x22,
-    0x1B, 0x1C, 0x1F, 0x22,
-    0x1B, 0x1E, 0x20, 0x23,
-    0x1B, 0x1F, 0x21, 0x23,
-    0x1B, 0x1D, 0x21, 0x23,
-    0x1B, 0x1D, 0x1F, 0x23,
-    0x1B, 0x23, 0x23, 0x23,
-    0x1B, 0x1B, 0x23, 0x23,
-    0x1B, 0x1B, 0x1B, 0x23,
-    0x1B, 0x1F, 0x22, 0x26,
-    0x1B, 0x20, 0x24, 0x26,
-    0x1B, 0x1D, 0x24, 0x26,
-    0x1B, 0x1D, 0x21, 0x26,
-    0x1B, 0x26, 0x26, 0x26,
-    0x1B, 0x1B, 0x26, 0x26,
-    0x1B, 0x1B, 0x1B, 0x26,
-    0x1B, 0x20, 0x24, 0x29,
-    0x1B, 0x22, 0x26, 0x29,
-    0x1B, 0x1E, 0x26, 0x29,
-    0x1B, 0x1E, 0x22, 0x29,
-    0x1B, 0x29, 0x29, 0x29,
-    0x1B, 0x1B, 0x29, 0x29,
-    0x1B, 0x1B, 0x1B, 0x29,
-    0x1B, 0x21, 0x26, 0x2C,
-    0x1B, 0x23, 0x28, 0x2C,
-    0x1B, 0x1F, 0x28, 0x2C,
-    0x1B, 0x1F, 0x24, 0x2C,
-    0x1B, 0x2C, 0x2C, 0x2C,
-    0x1B, 0x1B, 0x2C, 0x2C,
-    0x1B, 0x1B, 0x1B, 0x2C,
-    0x1B, 0x22, 0x28, 0x2F,
-    0x1B, 0x25, 0x2A, 0x2F,
-    0x1B, 0x20, 0x2A, 0x2F,
-    0x1B, 0x20, 0x25, 0x2F,
-    0x1B, 0x2F, 0x2F, 0x2F,
-    0x1B, 0x1B, 0x2F, 0x2F,
-    0x1B, 0x1B, 0x1B, 0x2F,
-    0x1B, 0x26, 0x2D, 0x32,
-    0x1B, 0x20, 0x2D, 0x32,
-    0x1B, 0x20, 0x27, 0x32,
-    0x1B, 0x32, 0x32, 0x32,
-    0x1B, 0x1B, 0x32, 0x32,
-    0x1B, 0x1B, 0x1B, 0x32,
-    0x1B, 0x28, 0x2F, 0x35,
-    0x1B, 0x21, 0x2F, 0x35,
-    0x1B, 0x21, 0x28, 0x35,
-    0x1B, 0x35, 0x35, 0x35,
-    0x1B, 0x1B, 0x35, 0x35,
-    0x1B, 0x1B, 0x1B, 0x35,
-    0x1B, 0x29, 0x31, 0x38,
-    0x1B, 0x22, 0x31, 0x38,
-    0x1B, 0x22, 0x2A, 0x38,
-    0x1B, 0x38, 0x38, 0x38,
-    0x1B, 0x1B, 0x38, 0x38,
-    0x1B, 0x1B, 0x1B, 0x38,
-    0x1B, 0x2B, 0x33, 0x3B,
-    0x1B, 0x23, 0x33, 0x3B,
-    0x1B, 0x23, 0x2B, 0x3B,
-    0x1B, 0x3B, 0x3B, 0x3B,
-    0x1B, 0x1B, 0x3B, 0x3B,
-    0x1B, 0x1B, 0x1B, 0x3B,
-    0x1B, 0x3E, 0x3E, 0x3E,
-    0x1B, 0x1B, 0x3E, 0x3E,
-    0x1B, 0x1B, 0x1B, 0x3E,
-    0x1B, 0x2D, 0x36, 0x3F,
-    0x1B, 0x24, 0x36, 0x3F,
-    0x1B, 0x24, 0x2D, 0x3F,
-    0x1C, 0x1D, 0x1D, 0x1E,
-    0x1C, 0x1D, 0x1E, 0x1F,
-    0x1C, 0x1E, 0x1F, 0x20,
-    0x1C, 0x1D, 0x1F, 0x20,
-    0x1C, 0x1D, 0x1E, 0x20,
-    0x1C, 0x1E, 0x1F, 0x21,
-    0x1C, 0x1E, 0x20, 0x21,
-    0x1C, 0x1D, 0x20, 0x21,
-    0x1C, 0x1D, 0x1F, 0x21,
-    0x1C, 0x1E, 0x20, 0x22,
-    0x1C, 0x1F, 0x21, 0x22,
-    0x1C, 0x1D, 0x21, 0x22,
-    0x1C, 0x1D, 0x1F, 0x22,
-    0x1C, 0x22, 0x22, 0x22,
-    0x1C, 0x1C, 0x22, 0x22,
-    0x1C, 0x1C, 0x1C, 0x22,
-    0x1C, 0x1F, 0x20, 0x23,
-    0x1C, 0x1F, 0x22, 0x23,
-    0x1C, 0x1D, 0x22, 0x23,
-    0x1C, 0x1D, 0x20, 0x23,
-    0x1C, 0x1F, 0x21, 0x24,
-    0x1C, 0x20, 0x22, 0x24,
-    0x1C, 0x1E, 0x22, 0x24,
-    0x1C, 0x1E, 0x20, 0x24,
-    0x1C, 0x24, 0x24, 0x24,
-    0x1C, 0x1C, 0x24, 0x24,
-    0x1C, 0x1C, 0x1C, 0x24,
-    0x1C, 0x20, 0x23, 0x27,
-    0x1C, 0x21, 0x25, 0x27,
-    0x1C, 0x1E, 0x25, 0x27,
-    0x1C, 0x1E, 0x22, 0x27,
-    0x1C, 0x27, 0x27, 0x27,
-    0x1C, 0x1C, 0x27, 0x27,
-    0x1C, 0x1C, 0x1C, 0x27,
-    0x1C, 0x21, 0x25, 0x2A,
-    0x1C, 0x23, 0x27, 0x2A,
-    0x1C, 0x1F, 0x27, 0x2A,
-    0x1C, 0x1F, 0x23, 0x2A,
-    0x1C, 0x2A, 0x2A, 0x2A,
-    0x1C, 0x1C, 0x2A, 0x2A,
-    0x1C, 0x1C, 0x1C, 0x2A,
-    0x1C, 0x22, 0x27, 0x2D,
-    0x1C, 0x24, 0x29, 0x2D,
-    0x1C, 0x20, 0x29, 0x2D,
-    0x1C, 0x20, 0x25, 0x2D,
-    0x1C, 0x2D, 0x2D, 0x2D,
-    0x1C, 0x1C, 0x2D, 0x2D,
-    0x1C, 0x1C, 0x1C, 0x2D,
-    0x1C, 0x23, 0x29, 0x30,
-    0x1C, 0x26, 0x2B, 0x30,
-    0x1C, 0x21, 0x2B, 0x30,
-    0x1C, 0x21, 0x26, 0x30,
-    0x1C, 0x30, 0x30, 0x30,
-    0x1C, 0x1C, 0x30, 0x30,
-    0x1C, 0x1C, 0x1C, 0x30,
-    0x1C, 0x27, 0x2E, 0x33,
-    0x1C, 0x21, 0x2E, 0x33,
-    0x1C, 0x21, 0x28, 0x33,
-    0x1C, 0x33, 0x33, 0x33,
-    0x1C, 0x1C, 0x33, 0x33,
-    0x1C, 0x1C, 0x1C, 0x33,
-    0x1C, 0x29, 0x30, 0x36,
-    0x1C, 0x22, 0x30, 0x36,
-    0x1C, 0x22, 0x29, 0x36,
-    0x1C, 0x36, 0x36, 0x36,
-    0x1C, 0x1C, 0x36, 0x36,
-    0x1C, 0x1C, 0x1C, 0x36,
-    0x1C, 0x2A, 0x32, 0x39,
-    0x1C, 0x23, 0x32, 0x39,
-    0x1C, 0x23, 0x2B, 0x39,
-    0x1C, 0x39, 0x39, 0x39,
-    0x1C, 0x1C, 0x39, 0x39,
-    0x1C, 0x1C, 0x1C, 0x39,
-    0x1C, 0x2C, 0x34, 0x3C,
-    0x1C, 0x24, 0x34, 0x3C,
-    0x1C, 0x24, 0x2C, 0x3C,
-    0x1C, 0x3C, 0x3C, 0x3C,
-    0x1C, 0x1C, 0x3C, 0x3C,
-    0x1C, 0x1C, 0x1C, 0x3C,
-    0x1C, 0x3F, 0x3F, 0x3F,
-    0x1C, 0x1C, 0x3F, 0x3F,
-    0x1C, 0x1C, 0x1C, 0x3F,
-    0x1D, 0x1E, 0x1E, 0x1F,
-    0x1D, 0x1E, 0x1F, 0x20,
-    0x1D, 0x1F, 0x20, 0x21,
-    0x1D, 0x1E, 0x20, 0x21,
-    0x1D, 0x1E, 0x1F, 0x21,
-    0x1D, 0x1F, 0x20, 0x22,
-    0x1D, 0x1F, 0x21, 0x22,
-    0x1D, 0x1E, 0x21, 0x22,
-    0x1D, 0x1E, 0x20, 0x22,
-    0x1D, 0x1F, 0x21, 0x23,
-    0x1D, 0x20, 0x22, 0x23,
-    0x1D, 0x1E, 0x22, 0x23,
-    0x1D, 0x1E, 0x20, 0x23,
-    0x1D, 0x23, 0x23, 0x23,
-    0x1D, 0x1D, 0x23, 0x23,
-    0x1D, 0x1D, 0x1D, 0x23,
-    0x1D, 0x20, 0x21, 0x24,
-    0x1D, 0x20, 0x23, 0x24,
-    0x1D, 0x1E, 0x23, 0x24,
-    0x1D, 0x1E, 0x21, 0x24,
-    0x1D, 0x20, 0x22, 0x25,
-    0x1D, 0x21, 0x23, 0x25,
-    0x1D, 0x1F, 0x23, 0x25,
-    0x1D, 0x1F, 0x21, 0x25,
-    0x1D, 0x25, 0x25, 0x25,
-    0x1D, 0x1D, 0x25, 0x25,
-    0x1D, 0x1D, 0x1D, 0x25,
-    0x1D, 0x21, 0x24, 0x28,
-    0x1D, 0x22, 0x26, 0x28,
-    0x1D, 0x1F, 0x26, 0x28,
-    0x1D, 0x1F, 0x23, 0x28,
-    0x1D, 0x28, 0x28, 0x28,
-    0x1D, 0x1D, 0x28, 0x28,
-    0x1D, 0x1D, 0x1D, 0x28,
-    0x1D, 0x22, 0x26, 0x2B,
-    0x1D, 0x24, 0x28, 0x2B,
-    0x1D, 0x20, 0x28, 0x2B,
-    0x1D, 0x20, 0x24, 0x2B,
-    0x1D, 0x2B, 0x2B, 0x2B,
-    0x1D, 0x1D, 0x2B, 0x2B,
-    0x1D, 0x1D, 0x1D, 0x2B,
-    0x1D, 0x23, 0x28, 0x2E,
-    0x1D, 0x25, 0x2A, 0x2E,
-    0x1D, 0x21, 0x2A, 0x2E,
-    0x1D, 0x21, 0x26, 0x2E,
-    0x1D, 0x2E, 0x2E, 0x2E,
-    0x1D, 0x1D, 0x2E, 0x2E,
-    0x1D, 0x1D, 0x1D, 0x2E,
-    0x1D, 0x24, 0x2A, 0x31,
-    0x1D, 0x27, 0x2C, 0x31,
-    0x1D, 0x22, 0x2C, 0x31,
-    0x1D, 0x22, 0x27, 0x31,
-    0x1D, 0x31, 0x31, 0x31,
-    0x1D, 0x1D, 0x31, 0x31,
-    0x1D, 0x1D, 0x1D, 0x31,
-    0x1D, 0x28, 0x2F, 0x34,
-    0x1D, 0x22, 0x2F, 0x34,
-    0x1D, 0x22, 0x29, 0x34,
-    0x1D, 0x34, 0x34, 0x34,
-    0x1D, 0x1D, 0x34, 0x34,
-    0x1D, 0x1D, 0x1D, 0x34,
-    0x1D, 0x2A, 0x31, 0x37,
-    0x1D, 0x23, 0x31, 0x37,
-    0x1D, 0x23, 0x2A, 0x37,
-    0x1D, 0x37, 0x37, 0x37,
-    0x1D, 0x1D, 0x37, 0x37,
-    0x1D, 0x1D, 0x1D, 0x37,
-    0x1D, 0x2B, 0x33, 0x3A,
-    0x1D, 0x24, 0x33, 0x3A,
-    0x1D, 0x24, 0x2C, 0x3A,
-    0x1D, 0x3A, 0x3A, 0x3A,
-    0x1D, 0x1D, 0x3A, 0x3A,
-    0x1D, 0x1D, 0x1D, 0x3A,
-    0x1D, 0x2D, 0x35, 0x3D,
-    0x1D, 0x25, 0x35, 0x3D,
-    0x1D, 0x25, 0x2D, 0x3D,
-    0x1D, 0x3D, 0x3D, 0x3D,
-    0x1D, 0x1D, 0x3D, 0x3D,
-    0x1D, 0x1D, 0x1D, 0x3D,
-    0x1E, 0x1F, 0x1F, 0x20,
-    0x1E, 0x1F, 0x20, 0x21,
-    0x1E, 0x20, 0x21, 0x22,
-    0x1E, 0x1F, 0x21, 0x22,
-    0x1E, 0x1F, 0x20, 0x22,
-    0x1E, 0x20, 0x21, 0x23,
-    0x1E, 0x20, 0x22, 0x23,
-    0x1E, 0x1F, 0x22, 0x23,
-    0x1E, 0x1F, 0x21, 0x23,
-    0x1E, 0x20, 0x22, 0x24,
-    0x1E, 0x21, 0x23, 0x24,
-    0x1E, 0x1F, 0x23, 0x24,
-    0x1E, 0x1F, 0x21, 0x24,
-    0x1E, 0x24, 0x24, 0x24,
-    0x1E, 0x1E, 0x24, 0x24,
-    0x1E, 0x1E, 0x1E, 0x24,
-    0x1E, 0x21, 0x22, 0x25,
-    0x1E, 0x21, 0x24, 0x25,
-    0x1E, 0x1F, 0x24, 0x25,
-    0x1E, 0x1F, 0x22, 0x25,
-    0x1E, 0x21, 0x23, 0x26,
-    0x1E, 0x22, 0x24, 0x26,
-    0x1E, 0x20, 0x24, 0x26,
-    0x1E, 0x20, 0x22, 0x26,
-    0x1E, 0x26, 0x26, 0x26,
-    0x1E, 0x1E, 0x26, 0x26,
-    0x1E, 0x1E, 0x1E, 0x26,
-    0x1E, 0x22, 0x25, 0x29,
-    0x1E, 0x23, 0x27, 0x29,
-    0x1E, 0x20, 0x27, 0x29,
-    0x1E, 0x20, 0x24, 0x29,
-    0x1E, 0x29, 0x29, 0x29,
-    0x1E, 0x1E, 0x29, 0x29,
-    0x1E, 0x1E, 0x1E, 0x29,
-    0x1E, 0x23, 0x27, 0x2C,
-    0x1E, 0x25, 0x29, 0x2C,
-    0x1E, 0x21, 0x29, 0x2C,
-    0x1E, 0x21, 0x25, 0x2C,
-    0x1E, 0x2C, 0x2C, 0x2C,
-    0x1E, 0x1E, 0x2C, 0x2C,
-    0x1E, 0x1E, 0x1E, 0x2C,
-    0x1E, 0x24, 0x29, 0x2F,
-    0x1E, 0x26, 0x2B, 0x2F,
-    0x1E, 0x22, 0x2B, 0x2F,
-    0x1E, 0x22, 0x27, 0x2F,
-    0x1E, 0x2F, 0x2F, 0x2F,
-    0x1E, 0x1E, 0x2F, 0x2F,
-    0x1E, 0x1E, 0x1E, 0x2F,
-    0x1E, 0x25, 0x2B, 0x32,
-    0x1E, 0x28, 0x2D, 0x32,
-    0x1E, 0x23, 0x2D, 0x32,
-    0x1E, 0x23, 0x28, 0x32,
-    0x1E, 0x32, 0x32, 0x32,
-    0x1E, 0x1E, 0x32, 0x32,
-    0x1E, 0x1E, 0x1E, 0x32,
-    0x1E, 0x29, 0x30, 0x35,
-    0x1E, 0x23, 0x30, 0x35,
-    0x1E, 0x23, 0x2A, 0x35,
-    0x1E, 0x35, 0x35, 0x35,
-    0x1E, 0x1E, 0x35, 0x35,
-    0x1E, 0x1E, 0x1E, 0x35,
-    0x1E, 0x2B, 0x32, 0x38,
-    0x1E, 0x24, 0x32, 0x38,
-    0x1E, 0x24, 0x2B, 0x38,
-    0x1E, 0x38, 0x38, 0x38,
-    0x1E, 0x1E, 0x38, 0x38,
-    0x1E, 0x1E, 0x1E, 0x38,
-    0x1E, 0x2C, 0x34, 0x3B,
-    0x1E, 0x25, 0x34, 0x3B,
-    0x1E, 0x25, 0x2D, 0x3B,
-    0x1E, 0x3B, 0x3B, 0x3B,
-    0x1E, 0x1E, 0x3B, 0x3B,
-    0x1E, 0x1E, 0x1E, 0x3B,
-    0x1E, 0x2E, 0x36, 0x3E,
-    0x1E, 0x26, 0x36, 0x3E,
-    0x1E, 0x26, 0x2E, 0x3E,
-    0x1E, 0x3E, 0x3E, 0x3E,
-    0x1E, 0x1E, 0x3E, 0x3E,
-    0x1E, 0x1E, 0x1E, 0x3E,
-    0x1F, 0x20, 0x20, 0x21,
-    0x1F, 0x20, 0x21, 0x22,
-    0x1F, 0x21, 0x22, 0x23,
-    0x1F, 0x20, 0x22, 0x23,
-    0x1F, 0x20, 0x21, 0x23,
-    0x1F, 0x21, 0x22, 0x24,
-    0x1F, 0x21, 0x23, 0x24,
-    0x1F, 0x20, 0x23, 0x24,
-    0x1F, 0x20, 0x22, 0x24,
-    0x1F, 0x21, 0x23, 0x25,
-    0x1F, 0x22, 0x24, 0x25,
-    0x1F, 0x20, 0x24, 0x25,
-    0x1F, 0x20, 0x22, 0x25,
-    0x1F, 0x25, 0x25, 0x25,
-    0x1F, 0x1F, 0x25, 0x25,
-    0x1F, 0x1F, 0x1F, 0x25,
-    0x1F, 0x22, 0x23, 0x26,
-    0x1F, 0x22, 0x25, 0x26,
-    0x1F, 0x20, 0x25, 0x26,
-    0x1F, 0x20, 0x23, 0x26,
-    0x1F, 0x22, 0x24, 0x27,
-    0x1F, 0x23, 0x25, 0x27,
-    0x1F, 0x21, 0x25, 0x27,
-    0x1F, 0x21, 0x23, 0x27,
-    0x1F, 0x27, 0x27, 0x27,
-    0x1F, 0x1F, 0x27, 0x27,
-    0x1F, 0x1F, 0x1F, 0x27,
-    0x1F, 0x23, 0x26, 0x2A,
-    0x1F, 0x24, 0x28, 0x2A,
-    0x1F, 0x21, 0x28, 0x2A,
-    0x1F, 0x21, 0x25, 0x2A,
-    0x1F, 0x2A, 0x2A, 0x2A,
-    0x1F, 0x1F, 0x2A, 0x2A,
-    0x1F, 0x1F, 0x1F, 0x2A,
-    0x1F, 0x24, 0x28, 0x2D,
-    0x1F, 0x26, 0x2A, 0x2D,
-    0x1F, 0x22, 0x2A, 0x2D,
-    0x1F, 0x22, 0x26, 0x2D,
-    0x1F, 0x2D, 0x2D, 0x2D,
-    0x1F, 0x1F, 0x2D, 0x2D,
-    0x1F, 0x1F, 0x1F, 0x2D,
-    0x1F, 0x25, 0x2A, 0x30,
-    0x1F, 0x27, 0x2C, 0x30,
-    0x1F, 0x23, 0x2C, 0x30,
-    0x1F, 0x23, 0x28, 0x30,
-    0x1F, 0x30, 0x30, 0x30,
-    0x1F, 0x1F, 0x30, 0x30,
-    0x1F, 0x1F, 0x1F, 0x30,
-    0x1F, 0x26, 0x2C, 0x33,
-    0x1F, 0x29, 0x2E, 0x33,
-    0x1F, 0x24, 0x2E, 0x33,
-    0x1F, 0x24, 0x29, 0x33,
-    0x1F, 0x33, 0x33, 0x33,
-    0x1F, 0x1F, 0x33, 0x33,
-    0x1F, 0x1F, 0x1F, 0x33,
-    0x1F, 0x2A, 0x31, 0x36,
-    0x1F, 0x24, 0x31, 0x36,
-    0x1F, 0x24, 0x2B, 0x36,
-    0x1F, 0x36, 0x36, 0x36,
-    0x1F, 0x1F, 0x36, 0x36,
-    0x1F, 0x1F, 0x1F, 0x36,
-    0x1F, 0x2C, 0x33, 0x39,
-    0x1F, 0x25, 0x33, 0x39,
-    0x1F, 0x25, 0x2C, 0x39,
-    0x1F, 0x39, 0x39, 0x39,
-    0x1F, 0x1F, 0x39, 0x39,
-    0x1F, 0x1F, 0x1F, 0x39,
-    0x1F, 0x2D, 0x35, 0x3C,
-    0x1F, 0x26, 0x35, 0x3C,
-    0x1F, 0x26, 0x2E, 0x3C,
-    0x1F, 0x3C, 0x3C, 0x3C,
-    0x1F, 0x1F, 0x3C, 0x3C,
-    0x1F, 0x1F, 0x1F, 0x3C,
-    0x1F, 0x2F, 0x37, 0x3F,
-    0x1F, 0x27, 0x37, 0x3F,
-    0x1F, 0x27, 0x2F, 0x3F,
-    0x1F, 0x3F, 0x3F, 0x3F,
-    0x1F, 0x1F, 0x3F, 0x3F,
-    0x1F, 0x1F, 0x1F, 0x3F,
-    0x20, 0x21, 0x21, 0x22,
-    0x20, 0x21, 0x22, 0x23,
-    0x20, 0x22, 0x23, 0x24,
-    0x20, 0x21, 0x23, 0x24,
-    0x20, 0x21, 0x22, 0x24,
-    0x20, 0x22, 0x23, 0x25,
-    0x20, 0x22, 0x24, 0x25,
-    0x20, 0x21, 0x24, 0x25,
-    0x20, 0x21, 0x23, 0x25,
-    0x20, 0x22, 0x24, 0x26,
-    0x20, 0x23, 0x25, 0x26,
-    0x20, 0x21, 0x25, 0x26,
-    0x20, 0x21, 0x23, 0x26,
-    0x20, 0x26, 0x26, 0x26,
-    0x20, 0x20, 0x26, 0x26,
-    0x20, 0x20, 0x20, 0x26,
-    0x20, 0x23, 0x24, 0x27,
-    0x20, 0x23, 0x26, 0x27,
-    0x20, 0x21, 0x26, 0x27,
-    0x20, 0x21, 0x24, 0x27,
-    0x20, 0x23, 0x25, 0x28,
-    0x20, 0x24, 0x26, 0x28,
-    0x20, 0x22, 0x26, 0x28,
-    0x20, 0x22, 0x24, 0x28,
-    0x20, 0x28, 0x28, 0x28,
-    0x20, 0x20, 0x28, 0x28,
-    0x20, 0x20, 0x20, 0x28,
-    0x20, 0x24, 0x27, 0x2B,
-    0x20, 0x25, 0x29, 0x2B,
-    0x20, 0x22, 0x29, 0x2B,
-    0x20, 0x22, 0x26, 0x2B,
-    0x20, 0x2B, 0x2B, 0x2B,
-    0x20, 0x20, 0x2B, 0x2B,
-    0x20, 0x20, 0x20, 0x2B,
-    0x20, 0x25, 0x29, 0x2E,
-    0x20, 0x27, 0x2B, 0x2E,
-    0x20, 0x23, 0x2B, 0x2E,
-    0x20, 0x23, 0x27, 0x2E,
-    0x20, 0x2E, 0x2E, 0x2E,
-    0x20, 0x20, 0x2E, 0x2E,
-    0x20, 0x20, 0x20, 0x2E,
-    0x20, 0x26, 0x2B, 0x31,
-    0x20, 0x28, 0x2D, 0x31,
-    0x20, 0x24, 0x2D, 0x31,
-    0x20, 0x24, 0x29, 0x31,
-    0x20, 0x31, 0x31, 0x31,
-    0x20, 0x20, 0x31, 0x31,
-    0x20, 0x20, 0x20, 0x31,
-    0x20, 0x27, 0x2D, 0x34,
-    0x20, 0x2A, 0x2F, 0x34,
-    0x20, 0x25, 0x2F, 0x34,
-    0x20, 0x25, 0x2A, 0x34,
-    0x20, 0x34, 0x34, 0x34,
-    0x20, 0x20, 0x34, 0x34,
-    0x20, 0x20, 0x20, 0x34,
-    0x20, 0x2B, 0x32, 0x37,
-    0x20, 0x25, 0x32, 0x37,
-    0x20, 0x25, 0x2C, 0x37,
-    0x20, 0x37, 0x37, 0x37,
-    0x20, 0x20, 0x37, 0x37,
-    0x20, 0x20, 0x20, 0x37,
-    0x20, 0x2D, 0x34, 0x3A,
-    0x20, 0x26, 0x34, 0x3A,
-    0x20, 0x26, 0x2D, 0x3A,
-    0x20, 0x3A, 0x3A, 0x3A,
-    0x20, 0x20, 0x3A, 0x3A,
-    0x20, 0x20, 0x20, 0x3A,
-    0x20, 0x2E, 0x36, 0x3D,
-    0x20, 0x27, 0x36, 0x3D,
-    0x20, 0x27, 0x2F, 0x3D,
-    0x20, 0x3D, 0x3D, 0x3D,
-    0x20, 0x20, 0x3D, 0x3D,
-    0x20, 0x20, 0x20, 0x3D,
-    0x21, 0x22, 0x22, 0x23,
-    0x21, 0x22, 0x23, 0x24,
-    0x21, 0x23, 0x24, 0x25,
-    0x21, 0x22, 0x24, 0x25,
-    0x21, 0x22, 0x23, 0x25,
-    0x21, 0x23, 0x24, 0x26,
-    0x21, 0x23, 0x25, 0x26,
-    0x21, 0x22, 0x25, 0x26,
-    0x21, 0x22, 0x24, 0x26,
-    0x21, 0x23, 0x25, 0x27,
-    0x21, 0x24, 0x26, 0x27,
-    0x21, 0x22, 0x26, 0x27,
-    0x21, 0x22, 0x24, 0x27,
-    0x21, 0x27, 0x27, 0x27,
-    0x21, 0x21, 0x27, 0x27,
-    0x21, 0x21, 0x21, 0x27,
-    0x21, 0x24, 0x25, 0x28,
-    0x21, 0x24, 0x27, 0x28,
-    0x21, 0x22, 0x27, 0x28,
-    0x21, 0x22, 0x25, 0x28,
-    0x21, 0x24, 0x26, 0x29,
-    0x21, 0x25, 0x27, 0x29,
-    0x21, 0x23, 0x27, 0x29,
-    0x21, 0x23, 0x25, 0x29,
-    0x21, 0x29, 0x29, 0x29,
-    0x21, 0x21, 0x29, 0x29,
-    0x21, 0x21, 0x21, 0x29,
-    0x21, 0x25, 0x28, 0x2C,
-    0x21, 0x26, 0x2A, 0x2C,
-    0x21, 0x23, 0x2A, 0x2C,
-    0x21, 0x23, 0x27, 0x2C,
-    0x21, 0x2C, 0x2C, 0x2C,
-    0x21, 0x21, 0x2C, 0x2C,
-    0x21, 0x21, 0x21, 0x2C,
-    0x21, 0x26, 0x2A, 0x2F,
-    0x21, 0x28, 0x2C, 0x2F,
-    0x21, 0x24, 0x2C, 0x2F,
-    0x21, 0x24, 0x28, 0x2F,
-    0x21, 0x2F, 0x2F, 0x2F,
-    0x21, 0x21, 0x2F, 0x2F,
-    0x21, 0x21, 0x21, 0x2F,
-    0x21, 0x27, 0x2C, 0x32,
-    0x21, 0x29, 0x2E, 0x32,
-    0x21, 0x25, 0x2E, 0x32,
-    0x21, 0x25, 0x2A, 0x32,
-    0x21, 0x32, 0x32, 0x32,
-    0x21, 0x21, 0x32, 0x32,
-    0x21, 0x21, 0x21, 0x32,
-    0x21, 0x28, 0x2E, 0x35,
-    0x21, 0x2B, 0x30, 0x35,
-    0x21, 0x26, 0x30, 0x35,
-    0x21, 0x26, 0x2B, 0x35,
-    0x21, 0x35, 0x35, 0x35,
-    0x21, 0x21, 0x35, 0x35,
-    0x21, 0x21, 0x21, 0x35,
-    0x21, 0x2C, 0x33, 0x38,
-    0x21, 0x26, 0x33, 0x38,
-    0x21, 0x26, 0x2D, 0x38,
-    0x21, 0x38, 0x38, 0x38,
-    0x21, 0x21, 0x38, 0x38,
-    0x21, 0x21, 0x21, 0x38,
-    0x21, 0x2E, 0x35, 0x3B,
-    0x21, 0x27, 0x35, 0x3B,
-    0x21, 0x27, 0x2E, 0x3B,
-    0x21, 0x3B, 0x3B, 0x3B,
-    0x21, 0x21, 0x3B, 0x3B,
-    0x21, 0x21, 0x21, 0x3B,
-    0x21, 0x2F, 0x37, 0x3E,
-    0x21, 0x28, 0x37, 0x3E,
-    0x21, 0x28, 0x30, 0x3E,
-    0x21, 0x3E, 0x3E, 0x3E,
-    0x21, 0x21, 0x3E, 0x3E,
-    0x21, 0x21, 0x21, 0x3E,
-    0x22, 0x23, 0x23, 0x24,
-    0x22, 0x23, 0x24, 0x25,
-    0x22, 0x24, 0x25, 0x26,
-    0x22, 0x23, 0x25, 0x26,
-    0x22, 0x23, 0x24, 0x26,
-    0x22, 0x24, 0x25, 0x27,
-    0x22, 0x24, 0x26, 0x27,
-    0x22, 0x23, 0x26, 0x27,
-    0x22, 0x23, 0x25, 0x27,
-    0x22, 0x24, 0x26, 0x28,
-    0x22, 0x25, 0x27, 0x28,
-    0x22, 0x23, 0x27, 0x28,
-    0x22, 0x23, 0x25, 0x28,
-    0x22, 0x28, 0x28, 0x28,
-    0x22, 0x22, 0x28, 0x28,
-    0x22, 0x22, 0x22, 0x28,
-    0x22, 0x25, 0x26, 0x29,
-    0x22, 0x25, 0x28, 0x29,
-    0x22, 0x23, 0x28, 0x29,
-    0x22, 0x23, 0x26, 0x29,
-    0x22, 0x25, 0x27, 0x2A,
-    0x22, 0x26, 0x28, 0x2A,
-    0x22, 0x24, 0x28, 0x2A,
-    0x22, 0x24, 0x26, 0x2A,
-    0x22, 0x2A, 0x2A, 0x2A,
-    0x22, 0x22, 0x2A, 0x2A,
-    0x22, 0x22, 0x22, 0x2A,
-    0x22, 0x26, 0x29, 0x2D,
-    0x22, 0x27, 0x2B, 0x2D,
-    0x22, 0x24, 0x2B, 0x2D,
-    0x22, 0x24, 0x28, 0x2D,
-    0x22, 0x2D, 0x2D, 0x2D,
-    0x22, 0x22, 0x2D, 0x2D,
-    0x22, 0x22, 0x22, 0x2D,
-    0x22, 0x27, 0x2B, 0x30,
-    0x22, 0x29, 0x2D, 0x30,
-    0x22, 0x25, 0x2D, 0x30,
-    0x22, 0x25, 0x29, 0x30,
-    0x22, 0x30, 0x30, 0x30,
-    0x22, 0x22, 0x30, 0x30,
-    0x22, 0x22, 0x22, 0x30,
-    0x22, 0x28, 0x2D, 0x33,
-    0x22, 0x2A, 0x2F, 0x33,
-    0x22, 0x26, 0x2F, 0x33,
-    0x22, 0x26, 0x2B, 0x33,
-    0x22, 0x33, 0x33, 0x33,
-    0x22, 0x22, 0x33, 0x33,
-    0x22, 0x22, 0x22, 0x33,
-    0x22, 0x29, 0x2F, 0x36,
-    0x22, 0x2C, 0x31, 0x36,
-    0x22, 0x27, 0x31, 0x36,
-    0x22, 0x27, 0x2C, 0x36,
-    0x22, 0x36, 0x36, 0x36,
-    0x22, 0x22, 0x36, 0x36,
-    0x22, 0x22, 0x22, 0x36,
-    0x22, 0x2D, 0x34, 0x39,
-    0x22, 0x27, 0x34, 0x39,
-    0x22, 0x27, 0x2E, 0x39,
-    0x22, 0x39, 0x39, 0x39,
-    0x22, 0x22, 0x39, 0x39,
-    0x22, 0x22, 0x22, 0x39,
-    0x22, 0x2F, 0x36, 0x3C,
-    0x22, 0x28, 0x36, 0x3C,
-    0x22, 0x28, 0x2F, 0x3C,
-    0x22, 0x3C, 0x3C, 0x3C,
-    0x22, 0x22, 0x3C, 0x3C,
-    0x22, 0x22, 0x22, 0x3C,
-    0x22, 0x30, 0x38, 0x3F,
-    0x22, 0x29, 0x38, 0x3F,
-    0x22, 0x29, 0x31, 0x3F,
-    0x22, 0x3F, 0x3F, 0x3F,
-    0x22, 0x22, 0x3F, 0x3F,
-    0x22, 0x22, 0x22, 0x3F,
-    0x23, 0x24, 0x24, 0x25,
-    0x23, 0x24, 0x25, 0x26,
-    0x23, 0x25, 0x26, 0x27,
-    0x23, 0x24, 0x26, 0x27,
-    0x23, 0x24, 0x25, 0x27,
-    0x23, 0x25, 0x26, 0x28,
-    0x23, 0x25, 0x27, 0x28,
-    0x23, 0x24, 0x27, 0x28,
-    0x23, 0x24, 0x26, 0x28,
-    0x23, 0x25, 0x27, 0x29,
-    0x23, 0x26, 0x28, 0x29,
-    0x23, 0x24, 0x28, 0x29,
-    0x23, 0x24, 0x26, 0x29,
-    0x23, 0x29, 0x29, 0x29,
-    0x23, 0x23, 0x29, 0x29,
-    0x23, 0x23, 0x23, 0x29,
-    0x23, 0x26, 0x27, 0x2A,
-    0x23, 0x26, 0x29, 0x2A,
-    0x23, 0x24, 0x29, 0x2A,
-    0x23, 0x24, 0x27, 0x2A,
-    0x23, 0x26, 0x28, 0x2B,
-    0x23, 0x27, 0x29, 0x2B,
-    0x23, 0x25, 0x29, 0x2B,
-    0x23, 0x25, 0x27, 0x2B,
-    0x23, 0x2B, 0x2B, 0x2B,
-    0x23, 0x23, 0x2B, 0x2B,
-    0x23, 0x23, 0x23, 0x2B,
-    0x23, 0x27, 0x2A, 0x2E,
-    0x23, 0x28, 0x2C, 0x2E,
-    0x23, 0x25, 0x2C, 0x2E,
-    0x23, 0x25, 0x29, 0x2E,
-    0x23, 0x2E, 0x2E, 0x2E,
-    0x23, 0x23, 0x2E, 0x2E,
-    0x23, 0x23, 0x23, 0x2E,
-    0x23, 0x28, 0x2C, 0x31,
-    0x23, 0x2A, 0x2E, 0x31,
-    0x23, 0x26, 0x2E, 0x31,
-    0x23, 0x26, 0x2A, 0x31,
-    0x23, 0x31, 0x31, 0x31,
-    0x23, 0x23, 0x31, 0x31,
-    0x23, 0x23, 0x23, 0x31,
-    0x23, 0x29, 0x2E, 0x34,
-    0x23, 0x2B, 0x30, 0x34,
-    0x23, 0x27, 0x30, 0x34,
-    0x23, 0x27, 0x2C, 0x34,
-    0x23, 0x34, 0x34, 0x34,
-    0x23, 0x23, 0x34, 0x34,
-    0x23, 0x23, 0x23, 0x34,
-    0x23, 0x2A, 0x30, 0x37,
-    0x23, 0x2D, 0x32, 0x37,
-    0x23, 0x28, 0x32, 0x37,
-    0x23, 0x28, 0x2D, 0x37,
-    0x23, 0x37, 0x37, 0x37,
-    0x23, 0x23, 0x37, 0x37,
-    0x23, 0x23, 0x23, 0x37,
-    0x23, 0x2E, 0x35, 0x3A,
-    0x23, 0x28, 0x35, 0x3A,
-    0x23, 0x28, 0x2F, 0x3A,
-    0x23, 0x3A, 0x3A, 0x3A,
-    0x23, 0x23, 0x3A, 0x3A,
-    0x23, 0x23, 0x23, 0x3A,
-    0x23, 0x30, 0x37, 0x3D,
-    0x23, 0x29, 0x37, 0x3D,
-    0x23, 0x29, 0x30, 0x3D,
-    0x23, 0x3D, 0x3D, 0x3D,
-    0x23, 0x23, 0x3D, 0x3D,
-    0x23, 0x23, 0x23, 0x3D,
-    0x24, 0x25, 0x25, 0x26,
-    0x24, 0x25, 0x26, 0x27,
-    0x24, 0x26, 0x27, 0x28,
-    0x24, 0x25, 0x27, 0x28,
-    0x24, 0x25, 0x26, 0x28,
-    0x24, 0x26, 0x27, 0x29,
-    0x24, 0x26, 0x28, 0x29,
-    0x24, 0x25, 0x28, 0x29,
-    0x24, 0x25, 0x27, 0x29,
-    0x24, 0x26, 0x28, 0x2A,
-    0x24, 0x27, 0x29, 0x2A,
-    0x24, 0x25, 0x29, 0x2A,
-    0x24, 0x25, 0x27, 0x2A,
-    0x24, 0x2A, 0x2A, 0x2A,
-    0x24, 0x24, 0x2A, 0x2A,
-    0x24, 0x24, 0x24, 0x2A,
-    0x24, 0x27, 0x28, 0x2B,
-    0x24, 0x27, 0x2A, 0x2B,
-    0x24, 0x25, 0x2A, 0x2B,
-    0x24, 0x25, 0x28, 0x2B,
-    0x24, 0x27, 0x29, 0x2C,
-    0x24, 0x28, 0x2A, 0x2C,
-    0x24, 0x26, 0x2A, 0x2C,
-    0x24, 0x26, 0x28, 0x2C,
-    0x24, 0x2C, 0x2C, 0x2C,
-    0x24, 0x24, 0x2C, 0x2C,
-    0x24, 0x24, 0x24, 0x2C,
-    0x24, 0x28, 0x2B, 0x2F,
-    0x24, 0x29, 0x2D, 0x2F,
-    0x24, 0x26, 0x2D, 0x2F,
-    0x24, 0x26, 0x2A, 0x2F,
-    0x24, 0x2F, 0x2F, 0x2F,
-    0x24, 0x24, 0x2F, 0x2F,
-    0x24, 0x24, 0x24, 0x2F,
-    0x24, 0x29, 0x2D, 0x32,
-    0x24, 0x2B, 0x2F, 0x32,
-    0x24, 0x27, 0x2F, 0x32,
-    0x24, 0x27, 0x2B, 0x32,
-    0x24, 0x32, 0x32, 0x32,
-    0x24, 0x24, 0x32, 0x32,
-    0x24, 0x24, 0x24, 0x32,
-    0x24, 0x2A, 0x2F, 0x35,
-    0x24, 0x2C, 0x31, 0x35,
-    0x24, 0x28, 0x31, 0x35,
-    0x24, 0x28, 0x2D, 0x35,
-    0x24, 0x35, 0x35, 0x35,
-    0x24, 0x24, 0x35, 0x35,
-    0x24, 0x24, 0x24, 0x35,
-    0x24, 0x2B, 0x31, 0x38,
-    0x24, 0x2E, 0x33, 0x38,
-    0x24, 0x29, 0x33, 0x38,
-    0x24, 0x29, 0x2E, 0x38,
-    0x24, 0x38, 0x38, 0x38,
-    0x24, 0x24, 0x38, 0x38,
-    0x24, 0x24, 0x24, 0x38,
-    0x24, 0x2F, 0x36, 0x3B,
-    0x24, 0x29, 0x36, 0x3B,
-    0x24, 0x29, 0x30, 0x3B,
-    0x24, 0x3B, 0x3B, 0x3B,
-    0x24, 0x24, 0x3B, 0x3B,
-    0x24, 0x24, 0x24, 0x3B,
-    0x24, 0x31, 0x38, 0x3E,
-    0x24, 0x2A, 0x38, 0x3E,
-    0x24, 0x2A, 0x31, 0x3E,
-    0x24, 0x3E, 0x3E, 0x3E,
-    0x24, 0x24, 0x3E, 0x3E,
-    0x24, 0x24, 0x24, 0x3E,
-    0x25, 0x26, 0x26, 0x27,
-    0x25, 0x26, 0x27, 0x28,
-    0x25, 0x27, 0x28, 0x29,
-    0x25, 0x26, 0x28, 0x29,
-    0x25, 0x26, 0x27, 0x29,
-    0x25, 0x27, 0x28, 0x2A,
-    0x25, 0x27, 0x29, 0x2A,
-    0x25, 0x26, 0x29, 0x2A,
-    0x25, 0x26, 0x28, 0x2A,
-    0x25, 0x27, 0x29, 0x2B,
-    0x25, 0x28, 0x2A, 0x2B,
-    0x25, 0x26, 0x2A, 0x2B,
-    0x25, 0x26, 0x28, 0x2B,
-    0x25, 0x2B, 0x2B, 0x2B,
-    0x25, 0x25, 0x2B, 0x2B,
-    0x25, 0x25, 0x25, 0x2B,
-    0x25, 0x28, 0x29, 0x2C,
-    0x25, 0x28, 0x2B, 0x2C,
-    0x25, 0x26, 0x2B, 0x2C,
-    0x25, 0x26, 0x29, 0x2C,
-    0x25, 0x28, 0x2A, 0x2D,
-    0x25, 0x29, 0x2B, 0x2D,
-    0x25, 0x27, 0x2B, 0x2D,
-    0x25, 0x27, 0x29, 0x2D,
-    0x25, 0x2D, 0x2D, 0x2D,
-    0x25, 0x25, 0x2D, 0x2D,
-    0x25, 0x25, 0x25, 0x2D,
-    0x25, 0x29, 0x2C, 0x30,
-    0x25, 0x2A, 0x2E, 0x30,
-    0x25, 0x27, 0x2E, 0x30,
-    0x25, 0x27, 0x2B, 0x30,
-    0x25, 0x30, 0x30, 0x30,
-    0x25, 0x25, 0x30, 0x30,
-    0x25, 0x25, 0x25, 0x30,
-    0x25, 0x2A, 0x2E, 0x33,
-    0x25, 0x2C, 0x30, 0x33,
-    0x25, 0x28, 0x30, 0x33,
-    0x25, 0x28, 0x2C, 0x33,
-    0x25, 0x33, 0x33, 0x33,
-    0x25, 0x25, 0x33, 0x33,
-    0x25, 0x25, 0x25, 0x33,
-    0x25, 0x2B, 0x30, 0x36,
-    0x25, 0x2D, 0x32, 0x36,
-    0x25, 0x29, 0x32, 0x36,
-    0x25, 0x29, 0x2E, 0x36,
-    0x25, 0x36, 0x36, 0x36,
-    0x25, 0x25, 0x36, 0x36,
-    0x25, 0x25, 0x25, 0x36,
-    0x25, 0x2C, 0x32, 0x39,
-    0x25, 0x2F, 0x34, 0x39,
-    0x25, 0x2A, 0x34, 0x39,
-    0x25, 0x2A, 0x2F, 0x39,
-    0x25, 0x39, 0x39, 0x39,
-    0x25, 0x25, 0x39, 0x39,
-    0x25, 0x25, 0x25, 0x39,
-    0x25, 0x30, 0x37, 0x3C,
-    0x25, 0x2A, 0x37, 0x3C,
-    0x25, 0x2A, 0x31, 0x3C,
-    0x25, 0x3C, 0x3C, 0x3C,
-    0x25, 0x25, 0x3C, 0x3C,
-    0x25, 0x25, 0x25, 0x3C,
-    0x25, 0x32, 0x39, 0x3F,
-    0x25, 0x2B, 0x39, 0x3F,
-    0x25, 0x2B, 0x32, 0x3F,
-    0x25, 0x3F, 0x3F, 0x3F,
-    0x25, 0x25, 0x3F, 0x3F,
-    0x25, 0x25, 0x25, 0x3F,
-    0x26, 0x27, 0x27, 0x28,
-    0x26, 0x27, 0x28, 0x29,
-    0x26, 0x28, 0x29, 0x2A,
-    0x26, 0x27, 0x29, 0x2A,
-    0x26, 0x27, 0x28, 0x2A,
-    0x26, 0x28, 0x29, 0x2B,
-    0x26, 0x28, 0x2A, 0x2B,
-    0x26, 0x27, 0x2A, 0x2B,
-    0x26, 0x27, 0x29, 0x2B,
-    0x26, 0x28, 0x2A, 0x2C,
-    0x26, 0x29, 0x2B, 0x2C,
-    0x26, 0x27, 0x2B, 0x2C,
-    0x26, 0x27, 0x29, 0x2C,
-    0x26, 0x2C, 0x2C, 0x2C,
-    0x26, 0x26, 0x2C, 0x2C,
-    0x26, 0x26, 0x26, 0x2C,
-    0x26, 0x29, 0x2A, 0x2D,
-    0x26, 0x29, 0x2C, 0x2D,
-    0x26, 0x27, 0x2C, 0x2D,
-    0x26, 0x27, 0x2A, 0x2D,
-    0x26, 0x29, 0x2B, 0x2E,
-    0x26, 0x2A, 0x2C, 0x2E,
-    0x26, 0x28, 0x2C, 0x2E,
-    0x26, 0x28, 0x2A, 0x2E,
-    0x26, 0x2E, 0x2E, 0x2E,
-    0x26, 0x26, 0x2E, 0x2E,
-    0x26, 0x26, 0x26, 0x2E,
-    0x26, 0x2A, 0x2D, 0x31,
-    0x26, 0x2B, 0x2F, 0x31,
-    0x26, 0x28, 0x2F, 0x31,
-    0x26, 0x28, 0x2C, 0x31,
-    0x26, 0x31, 0x31, 0x31,
-    0x26, 0x26, 0x31, 0x31,
-    0x26, 0x26, 0x26, 0x31,
-    0x26, 0x2B, 0x2F, 0x34,
-    0x26, 0x2D, 0x31, 0x34,
-    0x26, 0x29, 0x31, 0x34,
-    0x26, 0x29, 0x2D, 0x34,
-    0x26, 0x34, 0x34, 0x34,
-    0x26, 0x26, 0x34, 0x34,
-    0x26, 0x26, 0x26, 0x34,
-    0x26, 0x2C, 0x31, 0x37,
-    0x26, 0x2E, 0x33, 0x37,
-    0x26, 0x2A, 0x33, 0x37,
-    0x26, 0x2A, 0x2F, 0x37,
-    0x26, 0x37, 0x37, 0x37,
-    0x26, 0x26, 0x37, 0x37,
-    0x26, 0x26, 0x26, 0x37,
-    0x26, 0x2D, 0x33, 0x3A,
-    0x26, 0x30, 0x35, 0x3A,
-    0x26, 0x2B, 0x35, 0x3A,
-    0x26, 0x2B, 0x30, 0x3A,
-    0x26, 0x3A, 0x3A, 0x3A,
-    0x26, 0x26, 0x3A, 0x3A,
-    0x26, 0x26, 0x26, 0x3A,
-    0x26, 0x31, 0x38, 0x3D,
-    0x26, 0x2B, 0x38, 0x3D,
-    0x26, 0x2B, 0x32, 0x3D,
-    0x26, 0x3D, 0x3D, 0x3D,
-    0x26, 0x26, 0x3D, 0x3D,
-    0x26, 0x26, 0x26, 0x3D,
-    0x27, 0x28, 0x28, 0x29,
-    0x27, 0x28, 0x29, 0x2A,
-    0x27, 0x29, 0x2A, 0x2B,
-    0x27, 0x28, 0x2A, 0x2B,
-    0x27, 0x28, 0x29, 0x2B,
-    0x27, 0x29, 0x2A, 0x2C,
-    0x27, 0x29, 0x2B, 0x2C,
-    0x27, 0x28, 0x2B, 0x2C,
-    0x27, 0x28, 0x2A, 0x2C,
-    0x27, 0x29, 0x2B, 0x2D,
-    0x27, 0x2A, 0x2C, 0x2D,
-    0x27, 0x28, 0x2C, 0x2D,
-    0x27, 0x28, 0x2A, 0x2D,
-    0x27, 0x2D, 0x2D, 0x2D,
-    0x27, 0x27, 0x2D, 0x2D,
-    0x27, 0x27, 0x27, 0x2D,
-    0x27, 0x2A, 0x2B, 0x2E,
-    0x27, 0x2A, 0x2D, 0x2E,
-    0x27, 0x28, 0x2D, 0x2E,
-    0x27, 0x28, 0x2B, 0x2E,
-    0x27, 0x2A, 0x2C, 0x2F,
-    0x27, 0x2B, 0x2D, 0x2F,
-    0x27, 0x29, 0x2D, 0x2F,
-    0x27, 0x29, 0x2B, 0x2F,
-    0x27, 0x2F, 0x2F, 0x2F,
-    0x27, 0x27, 0x2F, 0x2F,
-    0x27, 0x27, 0x27, 0x2F,
-    0x27, 0x2B, 0x2E, 0x32,
-    0x27, 0x2C, 0x30, 0x32,
-    0x27, 0x29, 0x30, 0x32,
-    0x27, 0x29, 0x2D, 0x32,
-    0x27, 0x32, 0x32, 0x32,
-    0x27, 0x27, 0x32, 0x32,
-    0x27, 0x27, 0x27, 0x32,
-    0x27, 0x2C, 0x30, 0x35,
-    0x27, 0x2E, 0x32, 0x35,
-    0x27, 0x2A, 0x32, 0x35,
-    0x27, 0x2A, 0x2E, 0x35,
-    0x27, 0x35, 0x35, 0x35,
-    0x27, 0x27, 0x35, 0x35,
-    0x27, 0x27, 0x27, 0x35,
-    0x27, 0x2D, 0x32, 0x38,
-    0x27, 0x2F, 0x34, 0x38,
-    0x27, 0x2B, 0x34, 0x38,
-    0x27, 0x2B, 0x30, 0x38,
-    0x27, 0x38, 0x38, 0x38,
-    0x27, 0x27, 0x38, 0x38,
-    0x27, 0x27, 0x27, 0x38,
-    0x27, 0x2E, 0x34, 0x3B,
-    0x27, 0x31, 0x36, 0x3B,
-    0x27, 0x2C, 0x36, 0x3B,
-    0x27, 0x2C, 0x31, 0x3B,
-    0x27, 0x3B, 0x3B, 0x3B,
-    0x27, 0x27, 0x3B, 0x3B,
-    0x27, 0x27, 0x27, 0x3B,
-    0x27, 0x32, 0x39, 0x3E,
-    0x27, 0x2C, 0x39, 0x3E,
-    0x27, 0x2C, 0x33, 0x3E,
-    0x27, 0x3E, 0x3E, 0x3E,
-    0x27, 0x27, 0x3E, 0x3E,
-    0x27, 0x27, 0x27, 0x3E,
-    0x28, 0x29, 0x29, 0x2A,
-    0x28, 0x29, 0x2A, 0x2B,
-    0x28, 0x2A, 0x2B, 0x2C,
-    0x28, 0x29, 0x2B, 0x2C,
-    0x28, 0x29, 0x2A, 0x2C,
-    0x28, 0x2A, 0x2B, 0x2D,
-    0x28, 0x2A, 0x2C, 0x2D,
-    0x28, 0x29, 0x2C, 0x2D,
-    0x28, 0x29, 0x2B, 0x2D,
-    0x28, 0x2A, 0x2C, 0x2E,
-    0x28, 0x2B, 0x2D, 0x2E,
-    0x28, 0x29, 0x2D, 0x2E,
-    0x28, 0x29, 0x2B, 0x2E,
-    0x28, 0x2E, 0x2E, 0x2E,
-    0x28, 0x28, 0x2E, 0x2E,
-    0x28, 0x28, 0x28, 0x2E,
-    0x28, 0x2B, 0x2C, 0x2F,
-    0x28, 0x2B, 0x2E, 0x2F,
-    0x28, 0x29, 0x2E, 0x2F,
-    0x28, 0x29, 0x2C, 0x2F,
-    0x28, 0x2B, 0x2D, 0x30,
-    0x28, 0x2C, 0x2E, 0x30,
-    0x28, 0x2A, 0x2E, 0x30,
-    0x28, 0x2A, 0x2C, 0x30,
-    0x28, 0x30, 0x30, 0x30,
-    0x28, 0x28, 0x30, 0x30,
-    0x28, 0x28, 0x28, 0x30,
-    0x28, 0x2C, 0x2F, 0x33,
-    0x28, 0x2D, 0x31, 0x33,
-    0x28, 0x2A, 0x31, 0x33,
-    0x28, 0x2A, 0x2E, 0x33,
-    0x28, 0x33, 0x33, 0x33,
-    0x28, 0x28, 0x33, 0x33,
-    0x28, 0x28, 0x28, 0x33,
-    0x28, 0x2D, 0x31, 0x36,
-    0x28, 0x2F, 0x33, 0x36,
-    0x28, 0x2B, 0x33, 0x36,
-    0x28, 0x2B, 0x2F, 0x36,
-    0x28, 0x36, 0x36, 0x36,
-    0x28, 0x28, 0x36, 0x36,
-    0x28, 0x28, 0x28, 0x36,
-    0x28, 0x2E, 0x33, 0x39,
-    0x28, 0x30, 0x35, 0x39,
-    0x28, 0x2C, 0x35, 0x39,
-    0x28, 0x2C, 0x31, 0x39,
-    0x28, 0x39, 0x39, 0x39,
-    0x28, 0x28, 0x39, 0x39,
-    0x28, 0x28, 0x28, 0x39,
-    0x28, 0x2F, 0x35, 0x3C,
-    0x28, 0x32, 0x37, 0x3C,
-    0x28, 0x2D, 0x37, 0x3C,
-    0x28, 0x2D, 0x32, 0x3C,
-    0x28, 0x3C, 0x3C, 0x3C,
-    0x28, 0x28, 0x3C, 0x3C,
-    0x28, 0x28, 0x28, 0x3C,
-    0x28, 0x33, 0x3A, 0x3F,
-    0x28, 0x2D, 0x3A, 0x3F,
-    0x28, 0x2D, 0x34, 0x3F,
-    0x28, 0x3F, 0x3F, 0x3F,
-    0x28, 0x28, 0x3F, 0x3F,
-    0x28, 0x28, 0x28, 0x3F,
-    0x29, 0x2A, 0x2A, 0x2B,
-    0x29, 0x2A, 0x2B, 0x2C,
-    0x29, 0x2B, 0x2C, 0x2D,
-    0x29, 0x2A, 0x2C, 0x2D,
-    0x29, 0x2A, 0x2B, 0x2D,
-    0x29, 0x2B, 0x2C, 0x2E,
-    0x29, 0x2B, 0x2D, 0x2E,
-    0x29, 0x2A, 0x2D, 0x2E,
-    0x29, 0x2A, 0x2C, 0x2E,
-    0x29, 0x2B, 0x2D, 0x2F,
-    0x29, 0x2C, 0x2E, 0x2F,
-    0x29, 0x2A, 0x2E, 0x2F,
-    0x29, 0x2A, 0x2C, 0x2F,
-    0x29, 0x2F, 0x2F, 0x2F,
-    0x29, 0x29, 0x2F, 0x2F,
-    0x29, 0x29, 0x29, 0x2F,
-    0x29, 0x2C, 0x2D, 0x30,
-    0x29, 0x2C, 0x2F, 0x30,
-    0x29, 0x2A, 0x2F, 0x30,
-    0x29, 0x2A, 0x2D, 0x30,
-    0x29, 0x2C, 0x2E, 0x31,
-    0x29, 0x2D, 0x2F, 0x31,
-    0x29, 0x2B, 0x2F, 0x31,
-    0x29, 0x2B, 0x2D, 0x31,
-    0x29, 0x31, 0x31, 0x31,
-    0x29, 0x29, 0x31, 0x31,
-    0x29, 0x29, 0x29, 0x31,
-    0x29, 0x2D, 0x30, 0x34,
-    0x29, 0x2E, 0x32, 0x34,
-    0x29, 0x2B, 0x32, 0x34,
-    0x29, 0x2B, 0x2F, 0x34,
-    0x29, 0x34, 0x34, 0x34,
-    0x29, 0x29, 0x34, 0x34,
-    0x29, 0x29, 0x29, 0x34,
-    0x29, 0x2E, 0x32, 0x37,
-    0x29, 0x30, 0x34, 0x37,
-    0x29, 0x2C, 0x34, 0x37,
-    0x29, 0x2C, 0x30, 0x37,
-    0x29, 0x37, 0x37, 0x37,
-    0x29, 0x29, 0x37, 0x37,
-    0x29, 0x29, 0x29, 0x37,
-    0x29, 0x2F, 0x34, 0x3A,
-    0x29, 0x31, 0x36, 0x3A,
-    0x29, 0x2D, 0x36, 0x3A,
-    0x29, 0x2D, 0x32, 0x3A,
-    0x29, 0x3A, 0x3A, 0x3A,
-    0x29, 0x29, 0x3A, 0x3A,
-    0x29, 0x29, 0x29, 0x3A,
-    0x29, 0x30, 0x36, 0x3D,
-    0x29, 0x33, 0x38, 0x3D,
-    0x29, 0x2E, 0x38, 0x3D,
-    0x29, 0x2E, 0x33, 0x3D,
-    0x29, 0x3D, 0x3D, 0x3D,
-    0x29, 0x29, 0x3D, 0x3D,
-    0x29, 0x29, 0x29, 0x3D,
-    0x2A, 0x2B, 0x2B, 0x2C,
-    0x2A, 0x2B, 0x2C, 0x2D,
-    0x2A, 0x2C, 0x2D, 0x2E,
-    0x2A, 0x2B, 0x2D, 0x2E,
-    0x2A, 0x2B, 0x2C, 0x2E,
-    0x2A, 0x2C, 0x2D, 0x2F,
-    0x2A, 0x2C, 0x2E, 0x2F,
-    0x2A, 0x2B, 0x2E, 0x2F,
-    0x2A, 0x2B, 0x2D, 0x2F,
-    0x2A, 0x2C, 0x2E, 0x30,
-    0x2A, 0x2D, 0x2F, 0x30,
-    0x2A, 0x2B, 0x2F, 0x30,
-    0x2A, 0x2B, 0x2D, 0x30,
-    0x2A, 0x30, 0x30, 0x30,
-    0x2A, 0x2A, 0x30, 0x30,
-    0x2A, 0x2A, 0x2A, 0x30,
-    0x2A, 0x2D, 0x2E, 0x31,
-    0x2A, 0x2D, 0x30, 0x31,
-    0x2A, 0x2B, 0x30, 0x31,
-    0x2A, 0x2B, 0x2E, 0x31,
-    0x2A, 0x2D, 0x2F, 0x32,
-    0x2A, 0x2E, 0x30, 0x32,
-    0x2A, 0x2C, 0x30, 0x32,
-    0x2A, 0x2C, 0x2E, 0x32,
-    0x2A, 0x32, 0x32, 0x32,
-    0x2A, 0x2A, 0x32, 0x32,
-    0x2A, 0x2A, 0x2A, 0x32,
-    0x2A, 0x2E, 0x31, 0x35,
-    0x2A, 0x2F, 0x33, 0x35,
-    0x2A, 0x2C, 0x33, 0x35,
-    0x2A, 0x2C, 0x30, 0x35,
-    0x2A, 0x35, 0x35, 0x35,
-    0x2A, 0x2A, 0x35, 0x35,
-    0x2A, 0x2A, 0x2A, 0x35,
-    0x2A, 0x2F, 0x33, 0x38,
-    0x2A, 0x31, 0x35, 0x38,
-    0x2A, 0x2D, 0x35, 0x38,
-    0x2A, 0x2D, 0x31, 0x38,
-    0x2A, 0x38, 0x38, 0x38,
-    0x2A, 0x2A, 0x38, 0x38,
-    0x2A, 0x2A, 0x2A, 0x38,
-    0x2A, 0x30, 0x35, 0x3B,
-    0x2A, 0x32, 0x37, 0x3B,
-    0x2A, 0x2E, 0x37, 0x3B,
-    0x2A, 0x2E, 0x33, 0x3B,
-    0x2A, 0x3B, 0x3B, 0x3B,
-    0x2A, 0x2A, 0x3B, 0x3B,
-    0x2A, 0x2A, 0x2A, 0x3B,
-    0x2A, 0x31, 0x37, 0x3E,
-    0x2A, 0x34, 0x39, 0x3E,
-    0x2A, 0x2F, 0x39, 0x3E,
-    0x2A, 0x2F, 0x34, 0x3E,
-    0x2A, 0x3E, 0x3E, 0x3E,
-    0x2A, 0x2A, 0x3E, 0x3E,
-    0x2A, 0x2A, 0x2A, 0x3E,
-    0x2B, 0x2C, 0x2C, 0x2D,
-    0x2B, 0x2C, 0x2D, 0x2E,
-    0x2B, 0x2D, 0x2E, 0x2F,
-    0x2B, 0x2C, 0x2E, 0x2F,
-    0x2B, 0x2C, 0x2D, 0x2F,
-    0x2B, 0x2D, 0x2E, 0x30,
-    0x2B, 0x2D, 0x2F, 0x30,
-    0x2B, 0x2C, 0x2F, 0x30,
-    0x2B, 0x2C, 0x2E, 0x30,
-    0x2B, 0x2D, 0x2F, 0x31,
-    0x2B, 0x2E, 0x30, 0x31,
-    0x2B, 0x2C, 0x30, 0x31,
-    0x2B, 0x2C, 0x2E, 0x31,
-    0x2B, 0x31, 0x31, 0x31,
-    0x2B, 0x2B, 0x31, 0x31,
-    0x2B, 0x2B, 0x2B, 0x31,
-    0x2B, 0x2E, 0x2F, 0x32,
-    0x2B, 0x2E, 0x31, 0x32,
-    0x2B, 0x2C, 0x31, 0x32,
-    0x2B, 0x2C, 0x2F, 0x32,
-    0x2B, 0x2E, 0x30, 0x33,
-    0x2B, 0x2F, 0x31, 0x33,
-    0x2B, 0x2D, 0x31, 0x33,
-    0x2B, 0x2D, 0x2F, 0x33,
-    0x2B, 0x33, 0x33, 0x33,
-    0x2B, 0x2B, 0x33, 0x33,
-    0x2B, 0x2B, 0x2B, 0x33,
-    0x2B, 0x2F, 0x32, 0x36,
-    0x2B, 0x30, 0x34, 0x36,
-    0x2B, 0x2D, 0x34, 0x36,
-    0x2B, 0x2D, 0x31, 0x36,
-    0x2B, 0x36, 0x36, 0x36,
-    0x2B, 0x2B, 0x36, 0x36,
-    0x2B, 0x2B, 0x2B, 0x36,
-    0x2B, 0x30, 0x34, 0x39,
-    0x2B, 0x32, 0x36, 0x39,
-    0x2B, 0x2E, 0x36, 0x39,
-    0x2B, 0x2E, 0x32, 0x39,
-    0x2B, 0x39, 0x39, 0x39,
-    0x2B, 0x2B, 0x39, 0x39,
-    0x2B, 0x2B, 0x2B, 0x39,
-    0x2B, 0x31, 0x36, 0x3C,
-    0x2B, 0x33, 0x38, 0x3C,
-    0x2B, 0x2F, 0x38, 0x3C,
-    0x2B, 0x2F, 0x34, 0x3C,
-    0x2B, 0x3C, 0x3C, 0x3C,
-    0x2B, 0x2B, 0x3C, 0x3C,
-    0x2B, 0x2B, 0x2B, 0x3C,
-    0x2B, 0x32, 0x38, 0x3F,
-    0x2B, 0x35, 0x3A, 0x3F,
-    0x2B, 0x30, 0x3A, 0x3F,
-    0x2B, 0x30, 0x35, 0x3F,
-    0x2B, 0x3F, 0x3F, 0x3F,
-    0x2B, 0x2B, 0x3F, 0x3F,
-    0x2B, 0x2B, 0x2B, 0x3F,
-    0x2C, 0x2D, 0x2D, 0x2E,
-    0x2C, 0x2D, 0x2E, 0x2F,
-    0x2C, 0x2E, 0x2F, 0x30,
-    0x2C, 0x2D, 0x2F, 0x30,
-    0x2C, 0x2D, 0x2E, 0x30,
-    0x2C, 0x2E, 0x2F, 0x31,
-    0x2C, 0x2E, 0x30, 0x31,
-    0x2C, 0x2D, 0x30, 0x31,
-    0x2C, 0x2D, 0x2F, 0x31,
-    0x2C, 0x2E, 0x30, 0x32,
-    0x2C, 0x2F, 0x31, 0x32,
-    0x2C, 0x2D, 0x31, 0x32,
-    0x2C, 0x2D, 0x2F, 0x32,
-    0x2C, 0x32, 0x32, 0x32,
-    0x2C, 0x2C, 0x32, 0x32,
-    0x2C, 0x2C, 0x2C, 0x32,
-    0x2C, 0x2F, 0x30, 0x33,
-    0x2C, 0x2F, 0x32, 0x33,
-    0x2C, 0x2D, 0x32, 0x33,
-    0x2C, 0x2D, 0x30, 0x33,
-    0x2C, 0x2F, 0x31, 0x34,
-    0x2C, 0x30, 0x32, 0x34,
-    0x2C, 0x2E, 0x32, 0x34,
-    0x2C, 0x2E, 0x30, 0x34,
-    0x2C, 0x34, 0x34, 0x34,
-    0x2C, 0x2C, 0x34, 0x34,
-    0x2C, 0x2C, 0x2C, 0x34,
-    0x2C, 0x30, 0x33, 0x37,
-    0x2C, 0x31, 0x35, 0x37,
-    0x2C, 0x2E, 0x35, 0x37,
-    0x2C, 0x2E, 0x32, 0x37,
-    0x2C, 0x37, 0x37, 0x37,
-    0x2C, 0x2C, 0x37, 0x37,
-    0x2C, 0x2C, 0x2C, 0x37,
-    0x2C, 0x31, 0x35, 0x3A,
-    0x2C, 0x33, 0x37, 0x3A,
-    0x2C, 0x2F, 0x37, 0x3A,
-    0x2C, 0x2F, 0x33, 0x3A,
-    0x2C, 0x3A, 0x3A, 0x3A,
-    0x2C, 0x2C, 0x3A, 0x3A,
-    0x2C, 0x2C, 0x2C, 0x3A,
-    0x2C, 0x32, 0x37, 0x3D,
-    0x2C, 0x34, 0x39, 0x3D,
-    0x2C, 0x30, 0x39, 0x3D,
-    0x2C, 0x30, 0x35, 0x3D,
-    0x2C, 0x3D, 0x3D, 0x3D,
-    0x2C, 0x2C, 0x3D, 0x3D,
-    0x2C, 0x2C, 0x2C, 0x3D,
-    0x2D, 0x2E, 0x2E, 0x2F,
-    0x2D, 0x2E, 0x2F, 0x30,
-    0x2D, 0x2F, 0x30, 0x31,
-    0x2D, 0x2E, 0x30, 0x31,
-    0x2D, 0x2E, 0x2F, 0x31,
-    0x2D, 0x2F, 0x30, 0x32,
-    0x2D, 0x2F, 0x31, 0x32,
-    0x2D, 0x2E, 0x31, 0x32,
-    0x2D, 0x2E, 0x30, 0x32,
-    0x2D, 0x2F, 0x31, 0x33,
-    0x2D, 0x30, 0x32, 0x33,
-    0x2D, 0x2E, 0x32, 0x33,
-    0x2D, 0x2E, 0x30, 0x33,
-    0x2D, 0x33, 0x33, 0x33,
-    0x2D, 0x2D, 0x33, 0x33,
-    0x2D, 0x2D, 0x2D, 0x33,
-    0x2D, 0x30, 0x31, 0x34,
-    0x2D, 0x30, 0x33, 0x34,
-    0x2D, 0x2E, 0x33, 0x34,
-    0x2D, 0x2E, 0x31, 0x34,
-    0x2D, 0x30, 0x32, 0x35,
-    0x2D, 0x31, 0x33, 0x35,
-    0x2D, 0x2F, 0x33, 0x35,
-    0x2D, 0x2F, 0x31, 0x35,
-    0x2D, 0x35, 0x35, 0x35,
-    0x2D, 0x2D, 0x35, 0x35,
-    0x2D, 0x2D, 0x2D, 0x35,
-    0x2D, 0x31, 0x34, 0x38,
-    0x2D, 0x32, 0x36, 0x38,
-    0x2D, 0x2F, 0x36, 0x38,
-    0x2D, 0x2F, 0x33, 0x38,
-    0x2D, 0x38, 0x38, 0x38,
-    0x2D, 0x2D, 0x38, 0x38,
-    0x2D, 0x2D, 0x2D, 0x38,
-    0x2D, 0x32, 0x36, 0x3B,
-    0x2D, 0x34, 0x38, 0x3B,
-    0x2D, 0x30, 0x38, 0x3B,
-    0x2D, 0x30, 0x34, 0x3B,
-    0x2D, 0x3B, 0x3B, 0x3B,
-    0x2D, 0x2D, 0x3B, 0x3B,
-    0x2D, 0x2D, 0x2D, 0x3B,
-    0x2D, 0x33, 0x38, 0x3E,
-    0x2D, 0x35, 0x3A, 0x3E,
-    0x2D, 0x31, 0x3A, 0x3E,
-    0x2D, 0x31, 0x36, 0x3E,
-    0x2D, 0x3E, 0x3E, 0x3E,
-    0x2D, 0x2D, 0x3E, 0x3E,
-    0x2D, 0x2D, 0x2D, 0x3E,
-    0x2E, 0x2F, 0x2F, 0x30,
-    0x2E, 0x2F, 0x30, 0x31,
-    0x2E, 0x30, 0x31, 0x32,
-    0x2E, 0x2F, 0x31, 0x32,
-    0x2E, 0x2F, 0x30, 0x32,
-    0x2E, 0x30, 0x31, 0x33,
-    0x2E, 0x30, 0x32, 0x33,
-    0x2E, 0x2F, 0x32, 0x33,
-    0x2E, 0x2F, 0x31, 0x33,
-    0x2E, 0x30, 0x32, 0x34,
-    0x2E, 0x31, 0x33, 0x34,
-    0x2E, 0x2F, 0x33, 0x34,
-    0x2E, 0x2F, 0x31, 0x34,
-    0x2E, 0x34, 0x34, 0x34,
-    0x2E, 0x2E, 0x34, 0x34,
-    0x2E, 0x2E, 0x2E, 0x34,
-    0x2E, 0x31, 0x32, 0x35,
-    0x2E, 0x31, 0x34, 0x35,
-    0x2E, 0x2F, 0x34, 0x35,
-    0x2E, 0x2F, 0x32, 0x35,
-    0x2E, 0x31, 0x33, 0x36,
-    0x2E, 0x32, 0x34, 0x36,
-    0x2E, 0x30, 0x34, 0x36,
-    0x2E, 0x30, 0x32, 0x36,
-    0x2E, 0x36, 0x36, 0x36,
-    0x2E, 0x2E, 0x36, 0x36,
-    0x2E, 0x2E, 0x2E, 0x36,
-    0x2E, 0x32, 0x35, 0x39,
-    0x2E, 0x33, 0x37, 0x39,
-    0x2E, 0x30, 0x37, 0x39,
-    0x2E, 0x30, 0x34, 0x39,
-    0x2E, 0x39, 0x39, 0x39,
-    0x2E, 0x2E, 0x39, 0x39,
-    0x2E, 0x2E, 0x2E, 0x39,
-    0x2E, 0x33, 0x37, 0x3C,
-    0x2E, 0x35, 0x39, 0x3C,
-    0x2E, 0x31, 0x39, 0x3C,
-    0x2E, 0x31, 0x35, 0x3C,
-    0x2E, 0x3C, 0x3C, 0x3C,
-    0x2E, 0x2E, 0x3C, 0x3C,
-    0x2E, 0x2E, 0x2E, 0x3C,
-    0x2E, 0x34, 0x39, 0x3F,
-    0x2E, 0x36, 0x3B, 0x3F,
-    0x2E, 0x32, 0x3B, 0x3F,
-    0x2E, 0x32, 0x37, 0x3F,
-    0x2E, 0x3F, 0x3F, 0x3F,
-    0x2E, 0x2E, 0x3F, 0x3F,
-    0x2E, 0x2E, 0x2E, 0x3F,
-    0x2F, 0x30, 0x30, 0x31,
-    0x2F, 0x30, 0x31, 0x32,
-    0x2F, 0x31, 0x32, 0x33,
-    0x2F, 0x30, 0x32, 0x33,
-    0x2F, 0x30, 0x31, 0x33,
-    0x2F, 0x31, 0x32, 0x34,
-    0x2F, 0x31, 0x33, 0x34,
-    0x2F, 0x30, 0x33, 0x34,
-    0x2F, 0x30, 0x32, 0x34,
-    0x2F, 0x31, 0x33, 0x35,
-    0x2F, 0x32, 0x34, 0x35,
-    0x2F, 0x30, 0x34, 0x35,
-    0x2F, 0x30, 0x32, 0x35,
-    0x2F, 0x35, 0x35, 0x35,
-    0x2F, 0x2F, 0x35, 0x35,
-    0x2F, 0x2F, 0x2F, 0x35,
-    0x2F, 0x32, 0x33, 0x36,
-    0x2F, 0x32, 0x35, 0x36,
-    0x2F, 0x30, 0x35, 0x36,
-    0x2F, 0x30, 0x33, 0x36,
-    0x2F, 0x32, 0x34, 0x37,
-    0x2F, 0x33, 0x35, 0x37,
-    0x2F, 0x31, 0x35, 0x37,
-    0x2F, 0x31, 0x33, 0x37,
-    0x2F, 0x37, 0x37, 0x37,
-    0x2F, 0x2F, 0x37, 0x37,
-    0x2F, 0x2F, 0x2F, 0x37,
-    0x2F, 0x33, 0x36, 0x3A,
-    0x2F, 0x34, 0x38, 0x3A,
-    0x2F, 0x31, 0x38, 0x3A,
-    0x2F, 0x31, 0x35, 0x3A,
-    0x2F, 0x3A, 0x3A, 0x3A,
-    0x2F, 0x2F, 0x3A, 0x3A,
-    0x2F, 0x2F, 0x2F, 0x3A,
-    0x2F, 0x34, 0x38, 0x3D,
-    0x2F, 0x36, 0x3A, 0x3D,
-    0x2F, 0x32, 0x3A, 0x3D,
-    0x2F, 0x32, 0x36, 0x3D,
-    0x2F, 0x3D, 0x3D, 0x3D,
-    0x2F, 0x2F, 0x3D, 0x3D,
-    0x2F, 0x2F, 0x2F, 0x3D,
-    0x30, 0x31, 0x31, 0x32,
-    0x30, 0x31, 0x32, 0x33,
-    0x30, 0x32, 0x33, 0x34,
-    0x30, 0x31, 0x33, 0x34,
-    0x30, 0x31, 0x32, 0x34,
-    0x30, 0x32, 0x33, 0x35,
-    0x30, 0x32, 0x34, 0x35,
-    0x30, 0x31, 0x34, 0x35,
-    0x30, 0x31, 0x33, 0x35,
-    0x30, 0x32, 0x34, 0x36,
-    0x30, 0x33, 0x35, 0x36,
-    0x30, 0x31, 0x35, 0x36,
-    0x30, 0x31, 0x33, 0x36,
-    0x30, 0x36, 0x36, 0x36,
-    0x30, 0x30, 0x36, 0x36,
-    0x30, 0x30, 0x30, 0x36,
-    0x30, 0x33, 0x34, 0x37,
-    0x30, 0x33, 0x36, 0x37,
-    0x30, 0x31, 0x36, 0x37,
-    0x30, 0x31, 0x34, 0x37,
-    0x30, 0x33, 0x35, 0x38,
-    0x30, 0x34, 0x36, 0x38,
-    0x30, 0x32, 0x36, 0x38,
-    0x30, 0x32, 0x34, 0x38,
-    0x30, 0x38, 0x38, 0x38,
-    0x30, 0x30, 0x38, 0x38,
-    0x30, 0x30, 0x30, 0x38,
-    0x30, 0x34, 0x37, 0x3B,
-    0x30, 0x35, 0x39, 0x3B,
-    0x30, 0x32, 0x39, 0x3B,
-    0x30, 0x32, 0x36, 0x3B,
-    0x30, 0x3B, 0x3B, 0x3B,
-    0x30, 0x30, 0x3B, 0x3B,
-    0x30, 0x30, 0x30, 0x3B,
-    0x30, 0x35, 0x39, 0x3E,
-    0x30, 0x37, 0x3B, 0x3E,
-    0x30, 0x33, 0x3B, 0x3E,
-    0x30, 0x33, 0x37, 0x3E,
-    0x30, 0x3E, 0x3E, 0x3E,
-    0x30, 0x30, 0x3E, 0x3E,
-    0x30, 0x30, 0x30, 0x3E,
-    0x31, 0x32, 0x32, 0x33,
-    0x31, 0x32, 0x33, 0x34,
-    0x31, 0x33, 0x34, 0x35,
-    0x31, 0x32, 0x34, 0x35,
-    0x31, 0x32, 0x33, 0x35,
-    0x31, 0x33, 0x34, 0x36,
-    0x31, 0x33, 0x35, 0x36,
-    0x31, 0x32, 0x35, 0x36,
-    0x31, 0x32, 0x34, 0x36,
-    0x31, 0x33, 0x35, 0x37,
-    0x31, 0x34, 0x36, 0x37,
-    0x31, 0x32, 0x36, 0x37,
-    0x31, 0x32, 0x34, 0x37,
-    0x31, 0x37, 0x37, 0x37,
-    0x31, 0x31, 0x37, 0x37,
-    0x31, 0x31, 0x31, 0x37,
-    0x31, 0x34, 0x35, 0x38,
-    0x31, 0x34, 0x37, 0x38,
-    0x31, 0x32, 0x37, 0x38,
-    0x31, 0x32, 0x35, 0x38,
-    0x31, 0x34, 0x36, 0x39,
-    0x31, 0x35, 0x37, 0x39,
-    0x31, 0x33, 0x37, 0x39,
-    0x31, 0x33, 0x35, 0x39,
-    0x31, 0x39, 0x39, 0x39,
-    0x31, 0x31, 0x39, 0x39,
-    0x31, 0x31, 0x31, 0x39,
-    0x31, 0x35, 0x38, 0x3C,
-    0x31, 0x36, 0x3A, 0x3C,
-    0x31, 0x33, 0x3A, 0x3C,
-    0x31, 0x33, 0x37, 0x3C,
-    0x31, 0x3C, 0x3C, 0x3C,
-    0x31, 0x31, 0x3C, 0x3C,
-    0x31, 0x31, 0x31, 0x3C,
-    0x31, 0x36, 0x3A, 0x3F,
-    0x31, 0x38, 0x3C, 0x3F,
-    0x31, 0x34, 0x3C, 0x3F,
-    0x31, 0x34, 0x38, 0x3F,
-    0x31, 0x3F, 0x3F, 0x3F,
-    0x31, 0x31, 0x3F, 0x3F,
-    0x31, 0x31, 0x31, 0x3F,
-    0x32, 0x33, 0x33, 0x34,
-    0x32, 0x33, 0x34, 0x35,
-    0x32, 0x34, 0x35, 0x36,
-    0x32, 0x33, 0x35, 0x36,
-    0x32, 0x33, 0x34, 0x36,
-    0x32, 0x34, 0x35, 0x37,
-    0x32, 0x34, 0x36, 0x37,
-    0x32, 0x33, 0x36, 0x37,
-    0x32, 0x33, 0x35, 0x37,
-    0x32, 0x34, 0x36, 0x38,
-    0x32, 0x35, 0x37, 0x38,
-    0x32, 0x33, 0x37, 0x38,
-    0x32, 0x33, 0x35, 0x38,
-    0x32, 0x38, 0x38, 0x38,
-    0x32, 0x32, 0x38, 0x38,
-    0x32, 0x32, 0x32, 0x38,
-    0x32, 0x35, 0x36, 0x39,
-    0x32, 0x35, 0x38, 0x39,
-    0x32, 0x33, 0x38, 0x39,
-    0x32, 0x33, 0x36, 0x39,
-    0x32, 0x35, 0x37, 0x3A,
-    0x32, 0x36, 0x38, 0x3A,
-    0x32, 0x34, 0x38, 0x3A,
-    0x32, 0x34, 0x36, 0x3A,
-    0x32, 0x3A, 0x3A, 0x3A,
-    0x32, 0x32, 0x3A, 0x3A,
-    0x32, 0x32, 0x32, 0x3A,
-    0x32, 0x36, 0x39, 0x3D,
-    0x32, 0x37, 0x3B, 0x3D,
-    0x32, 0x34, 0x3B, 0x3D,
-    0x32, 0x34, 0x38, 0x3D,
-    0x32, 0x3D, 0x3D, 0x3D,
-    0x32, 0x32, 0x3D, 0x3D,
-    0x32, 0x32, 0x32, 0x3D,
-    0x33, 0x34, 0x34, 0x35,
-    0x33, 0x34, 0x35, 0x36,
-    0x33, 0x35, 0x36, 0x37,
-    0x33, 0x34, 0x36, 0x37,
-    0x33, 0x34, 0x35, 0x37,
-    0x33, 0x35, 0x36, 0x38,
-    0x33, 0x35, 0x37, 0x38,
-    0x33, 0x34, 0x37, 0x38,
-    0x33, 0x34, 0x36, 0x38,
-    0x33, 0x35, 0x37, 0x39,
-    0x33, 0x36, 0x38, 0x39,
-    0x33, 0x34, 0x38, 0x39,
-    0x33, 0x34, 0x36, 0x39,
-    0x33, 0x39, 0x39, 0x39,
-    0x33, 0x33, 0x39, 0x39,
-    0x33, 0x33, 0x33, 0x39,
-    0x33, 0x36, 0x37, 0x3A,
-    0x33, 0x36, 0x39, 0x3A,
-    0x33, 0x34, 0x39, 0x3A,
-    0x33, 0x34, 0x37, 0x3A,
-    0x33, 0x36, 0x38, 0x3B,
-    0x33, 0x37, 0x39, 0x3B,
-    0x33, 0x35, 0x39, 0x3B,
-    0x33, 0x35, 0x37, 0x3B,
-    0x33, 0x3B, 0x3B, 0x3B,
-    0x33, 0x33, 0x3B, 0x3B,
-    0x33, 0x33, 0x33, 0x3B,
-    0x33, 0x37, 0x3A, 0x3E,
-    0x33, 0x38, 0x3C, 0x3E,
-    0x33, 0x35, 0x3C, 0x3E,
-    0x33, 0x35, 0x39, 0x3E,
-    0x33, 0x3E, 0x3E, 0x3E,
-    0x33, 0x33, 0x3E, 0x3E,
-    0x33, 0x33, 0x33, 0x3E,
-    0x34, 0x35, 0x35, 0x36,
-    0x34, 0x35, 0x36, 0x37,
-    0x34, 0x36, 0x37, 0x38,
-    0x34, 0x35, 0x37, 0x38,
-    0x34, 0x35, 0x36, 0x38,
-    0x34, 0x36, 0x37, 0x39,
-    0x34, 0x36, 0x38, 0x39,
-    0x34, 0x35, 0x38, 0x39,
-    0x34, 0x35, 0x37, 0x39,
-    0x34, 0x36, 0x38, 0x3A,
-    0x34, 0x37, 0x39, 0x3A,
-    0x34, 0x35, 0x39, 0x3A,
-    0x34, 0x35, 0x37, 0x3A,
-    0x34, 0x3A, 0x3A, 0x3A,
-    0x34, 0x34, 0x3A, 0x3A,
-    0x34, 0x34, 0x34, 0x3A,
-    0x34, 0x37, 0x38, 0x3B,
-    0x34, 0x37, 0x3A, 0x3B,
-    0x34, 0x35, 0x3A, 0x3B,
-    0x34, 0x35, 0x38, 0x3B,
-    0x34, 0x37, 0x39, 0x3C,
-    0x34, 0x38, 0x3A, 0x3C,
-    0x34, 0x36, 0x3A, 0x3C,
-    0x34, 0x36, 0x38, 0x3C,
-    0x34, 0x3C, 0x3C, 0x3C,
-    0x34, 0x34, 0x3C, 0x3C,
-    0x34, 0x34, 0x34, 0x3C,
-    0x34, 0x38, 0x3B, 0x3F,
-    0x34, 0x39, 0x3D, 0x3F,
-    0x34, 0x36, 0x3D, 0x3F,
-    0x34, 0x36, 0x3A, 0x3F,
-    0x34, 0x3F, 0x3F, 0x3F,
-    0x34, 0x34, 0x3F, 0x3F,
-    0x34, 0x34, 0x34, 0x3F,
-    0x35, 0x36, 0x36, 0x37,
-    0x35, 0x36, 0x37, 0x38,
-    0x35, 0x37, 0x38, 0x39,
-    0x35, 0x36, 0x38, 0x39,
-    0x35, 0x36, 0x37, 0x39,
-    0x35, 0x37, 0x38, 0x3A,
-    0x35, 0x37, 0x39, 0x3A,
-    0x35, 0x36, 0x39, 0x3A,
-    0x35, 0x36, 0x38, 0x3A,
-    0x35, 0x37, 0x39, 0x3B,
-    0x35, 0x38, 0x3A, 0x3B,
-    0x35, 0x36, 0x3A, 0x3B,
-    0x35, 0x36, 0x38, 0x3B,
-    0x35, 0x3B, 0x3B, 0x3B,
-    0x35, 0x35, 0x3B, 0x3B,
-    0x35, 0x35, 0x35, 0x3B,
-    0x35, 0x38, 0x39, 0x3C,
-    0x35, 0x38, 0x3B, 0x3C,
-    0x35, 0x36, 0x3B, 0x3C,
-    0x35, 0x36, 0x39, 0x3C,
-    0x35, 0x38, 0x3A, 0x3D,
-    0x35, 0x39, 0x3B, 0x3D,
-    0x35, 0x37, 0x3B, 0x3D,
-    0x35, 0x37, 0x39, 0x3D,
-    0x35, 0x3D, 0x3D, 0x3D,
-    0x35, 0x35, 0x3D, 0x3D,
-    0x35, 0x35, 0x35, 0x3D,
-    0x36, 0x37, 0x37, 0x38,
-    0x36, 0x37, 0x38, 0x39,
-    0x36, 0x38, 0x39, 0x3A,
-    0x36, 0x37, 0x39, 0x3A,
-    0x36, 0x37, 0x38, 0x3A,
-    0x36, 0x38, 0x39, 0x3B,
-    0x36, 0x38, 0x3A, 0x3B,
-    0x36, 0x37, 0x3A, 0x3B,
-    0x36, 0x37, 0x39, 0x3B,
-    0x36, 0x38, 0x3A, 0x3C,
-    0x36, 0x39, 0x3B, 0x3C,
-    0x36, 0x37, 0x3B, 0x3C,
-    0x36, 0x37, 0x39, 0x3C,
-    0x36, 0x3C, 0x3C, 0x3C,
-    0x36, 0x36, 0x3C, 0x3C,
-    0x36, 0x36, 0x36, 0x3C,
-    0x36, 0x39, 0x3A, 0x3D,
-    0x36, 0x39, 0x3C, 0x3D,
-    0x36, 0x37, 0x3C, 0x3D,
-    0x36, 0x37, 0x3A, 0x3D,
-    0x36, 0x39, 0x3B, 0x3E,
-    0x36, 0x3A, 0x3C, 0x3E,
-    0x36, 0x38, 0x3C, 0x3E,
-    0x36, 0x38, 0x3A, 0x3E,
-    0x36, 0x3E, 0x3E, 0x3E,
-    0x36, 0x36, 0x3E, 0x3E,
-    0x36, 0x36, 0x36, 0x3E,
-    0x37, 0x38, 0x38, 0x39,
-    0x37, 0x38, 0x39, 0x3A,
-    0x37, 0x39, 0x3A, 0x3B,
-    0x37, 0x38, 0x3A, 0x3B,
-    0x37, 0x38, 0x39, 0x3B,
-    0x37, 0x39, 0x3A, 0x3C,
-    0x37, 0x39, 0x3B, 0x3C,
-    0x37, 0x38, 0x3B, 0x3C,
-    0x37, 0x38, 0x3A, 0x3C,
-    0x37, 0x39, 0x3B, 0x3D,
-    0x37, 0x3A, 0x3C, 0x3D,
-    0x37, 0x38, 0x3C, 0x3D,
-    0x37, 0x38, 0x3A, 0x3D,
-    0x37, 0x3D, 0x3D, 0x3D,
-    0x37, 0x37, 0x3D, 0x3D,
-    0x37, 0x37, 0x37, 0x3D,
-    0x37, 0x3A, 0x3B, 0x3E,
-    0x37, 0x3A, 0x3D, 0x3E,
-    0x37, 0x38, 0x3D, 0x3E,
-    0x37, 0x38, 0x3B, 0x3E,
-    0x37, 0x3A, 0x3C, 0x3F,
-    0x37, 0x3B, 0x3D, 0x3F,
-    0x37, 0x39, 0x3D, 0x3F,
-    0x37, 0x39, 0x3B, 0x3F,
-    0x37, 0x3F, 0x3F, 0x3F,
-    0x37, 0x37, 0x3F, 0x3F,
-    0x37, 0x37, 0x37, 0x3F,
-    0x38, 0x39, 0x39, 0x3A,
-    0x38, 0x39, 0x3A, 0x3B,
-    0x38, 0x3A, 0x3B, 0x3C,
-    0x38, 0x39, 0x3B, 0x3C,
-    0x38, 0x39, 0x3A, 0x3C,
-    0x38, 0x3A, 0x3B, 0x3D,
-    0x38, 0x3A, 0x3C, 0x3D,
-    0x38, 0x39, 0x3C, 0x3D,
-    0x38, 0x39, 0x3B, 0x3D,
-    0x38, 0x3A, 0x3C, 0x3E,
-    0x38, 0x3B, 0x3D, 0x3E,
-    0x38, 0x39, 0x3D, 0x3E,
-    0x38, 0x39, 0x3B, 0x3E,
-    0x38, 0x3E, 0x3E, 0x3E,
-    0x38, 0x38, 0x3E, 0x3E,
-    0x38, 0x38, 0x38, 0x3E,
-    0x38, 0x3B, 0x3C, 0x3F,
-    0x38, 0x3B, 0x3E, 0x3F,
-    0x38, 0x39, 0x3E, 0x3F,
-    0x38, 0x39, 0x3C, 0x3F,
-    0x39, 0x3A, 0x3A, 0x3B,
-    0x39, 0x3A, 0x3B, 0x3C,
-    0x39, 0x3B, 0x3C, 0x3D,
-    0x39, 0x3A, 0x3C, 0x3D,
-    0x39, 0x3A, 0x3B, 0x3D,
-    0x39, 0x3B, 0x3C, 0x3E,
-    0x39, 0x3B, 0x3D, 0x3E,
-    0x39, 0x3A, 0x3D, 0x3E,
-    0x39, 0x3A, 0x3C, 0x3E,
-    0x39, 0x3B, 0x3D, 0x3F,
-    0x39, 0x3C, 0x3E, 0x3F,
-    0x39, 0x3A, 0x3E, 0x3F,
-    0x39, 0x3A, 0x3C, 0x3F,
-    0x39, 0x3F, 0x3F, 0x3F,
-    0x39, 0x39, 0x3F, 0x3F,
-    0x39, 0x39, 0x39, 0x3F,
-    0x3A, 0x3B, 0x3B, 0x3C,
-    0x3A, 0x3B, 0x3C, 0x3D,
-    0x3A, 0x3C, 0x3D, 0x3E,
-    0x3A, 0x3B, 0x3D, 0x3E,
-    0x3A, 0x3B, 0x3C, 0x3E,
-    0x3A, 0x3C, 0x3D, 0x3F,
-    0x3A, 0x3C, 0x3E, 0x3F,
-    0x3A, 0x3B, 0x3E, 0x3F,
-    0x3A, 0x3B, 0x3D, 0x3F,
-    0x3B, 0x3C, 0x3C, 0x3D,
-    0x3B, 0x3C, 0x3D, 0x3E,
-    0x3B, 0x3D, 0x3E, 0x3F,
-    0x3B, 0x3C, 0x3E, 0x3F,
-    0x3B, 0x3C, 0x3D, 0x3F,
-    0x3C, 0x3D, 0x3D, 0x3E,
-    0x3C, 0x3D, 0x3E, 0x3F,
-    0x3D, 0x3E, 0x3E, 0x3F
-};
-
-#endif /* AVCODEC_ULTI_CB_H */
diff --git a/libavcodec/unary.h b/libavcodec/unary.h
deleted file mode 100644
index 908dc93..0000000
--- a/libavcodec/unary.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_UNARY_H
-#define AVCODEC_UNARY_H
-
-#include "get_bits.h"
-
-/**
- * Get unary code of limited length
- * @param gb GetBitContext
- * @param[in] stop The bitstop value (unary code of 1's or 0's)
- * @param[in] len Maximum length
- * @return Unary length/index
- */
-static inline int get_unary(GetBitContext *gb, int stop, int len)
-{
-    int i;
-
-    for(i = 0; i < len && get_bits1(gb) != stop; i++);
-    return i;
-}
-
-/**
- * Get unary code terminated by a 0 with a maximum length of 33
- * @param gb GetBitContext
- * @return Unary length/index
- */
-static inline int get_unary_0_33(GetBitContext *gb)
-{
-    return get_unary(gb, 0, 33);
-}
-
-static inline int get_unary_0_9(GetBitContext *gb)
-{
-    return get_unary(gb, 0, 9);
-}
-
-#endif /* AVCODEC_UNARY_H */
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
deleted file mode 100644
index 014427d..0000000
--- a/libavcodec/utils.c
+++ /dev/null
@@ -1,1299 +0,0 @@
-/*
- * utils for libavcodec
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * utils.
- */
-
-/* needed for mkstemp() */
-#define _XOPEN_SOURCE 600
-
-#include "libavutil/avstring.h"
-#include "libavutil/integer.h"
-#include "libavutil/crc.h"
-#include "libavutil/pixdesc.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "opt.h"
-#include "imgconvert.h"
-#include "audioconvert.h"
-#include "libxvid_internal.h"
-#include "internal.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <limits.h>
-#include <float.h>
-#if !HAVE_MKSTEMP
-#include <fcntl.h>
-#endif
-
-static int volatile entangled_thread_counter=0;
-int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
-static void *codec_mutex;
-
-void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
-{
-    if(min_size < *size)
-        return ptr;
-
-    *size= FFMAX(17*min_size/16 + 32, min_size);
-
-    ptr= av_realloc(ptr, *size);
-    if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now
-        *size= 0;
-
-    return ptr;
-}
-
-void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size)
-{
-    void **p = ptr;
-    if (min_size < *size)
-        return;
-    *size= FFMAX(17*min_size/16 + 32, min_size);
-    av_free(*p);
-    *p = av_malloc(*size);
-    if (!*p) *size = 0;
-}
-
-/* encoder management */
-static AVCodec *first_avcodec = NULL;
-
-AVCodec *av_codec_next(AVCodec *c){
-    if(c) return c->next;
-    else  return first_avcodec;
-}
-
-void avcodec_register(AVCodec *codec)
-{
-    AVCodec **p;
-    avcodec_init();
-    p = &first_avcodec;
-    while (*p != NULL) p = &(*p)->next;
-    *p = codec;
-    codec->next = NULL;
-}
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-void register_avcodec(AVCodec *codec)
-{
-    avcodec_register(codec);
-}
-#endif
-
-unsigned avcodec_get_edge_width(void)
-{
-    return EDGE_WIDTH;
-}
-
-void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
-    s->coded_width = width;
-    s->coded_height= height;
-    s->width = -((-width )>>s->lowres);
-    s->height= -((-height)>>s->lowres);
-}
-
-typedef struct InternalBuffer{
-    int last_pic_num;
-    uint8_t *base[4];
-    uint8_t *data[4];
-    int linesize[4];
-    int width, height;
-    enum PixelFormat pix_fmt;
-}InternalBuffer;
-
-#define INTERNAL_BUFFER_SIZE 32
-
-void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[4]){
-    int w_align= 1;
-    int h_align= 1;
-
-    switch(s->pix_fmt){
-    case PIX_FMT_YUV420P:
-    case PIX_FMT_YUYV422:
-    case PIX_FMT_UYVY422:
-    case PIX_FMT_YUV422P:
-    case PIX_FMT_YUV440P:
-    case PIX_FMT_YUV444P:
-    case PIX_FMT_GRAY8:
-    case PIX_FMT_GRAY16BE:
-    case PIX_FMT_GRAY16LE:
-    case PIX_FMT_YUVJ420P:
-    case PIX_FMT_YUVJ422P:
-    case PIX_FMT_YUVJ440P:
-    case PIX_FMT_YUVJ444P:
-    case PIX_FMT_YUVA420P:
-        w_align= 16; //FIXME check for non mpeg style codecs and use less alignment
-        h_align= 16;
-        if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV || s->codec_id == CODEC_ID_THP)
-            h_align= 32; // interlaced is rounded up to 2 MBs
-        break;
-    case PIX_FMT_YUV411P:
-    case PIX_FMT_UYYVYY411:
-        w_align=32;
-        h_align=8;
-        break;
-    case PIX_FMT_YUV410P:
-        if(s->codec_id == CODEC_ID_SVQ1){
-            w_align=64;
-            h_align=64;
-        }
-    case PIX_FMT_RGB555:
-        if(s->codec_id == CODEC_ID_RPZA){
-            w_align=4;
-            h_align=4;
-        }
-    case PIX_FMT_PAL8:
-    case PIX_FMT_BGR8:
-    case PIX_FMT_RGB8:
-        if(s->codec_id == CODEC_ID_SMC){
-            w_align=4;
-            h_align=4;
-        }
-        break;
-    case PIX_FMT_BGR24:
-        if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == CODEC_ID_ZLIB)){
-            w_align=4;
-            h_align=4;
-        }
-        break;
-    default:
-        w_align= 1;
-        h_align= 1;
-        break;
-    }
-
-    *width = FFALIGN(*width , w_align);
-    *height= FFALIGN(*height, h_align);
-    if(s->codec_id == CODEC_ID_H264)
-        *height+=2; // some of the optimized chroma MC reads one line too much
-
-    linesize_align[0] =
-    linesize_align[1] =
-    linesize_align[2] =
-    linesize_align[3] = STRIDE_ALIGN;
-//STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes
-//we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the
-//picture size unneccessarily in some cases. The solution here is not
-//pretty and better ideas are welcome!
-#if HAVE_MMX
-    if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 ||
-       s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F ||
-       s->codec_id == CODEC_ID_VP6A) {
-        linesize_align[0] =
-        linesize_align[1] =
-        linesize_align[2] = 16;
-    }
-#endif
-}
-
-void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
-    int chroma_shift = av_pix_fmt_descriptors[s->pix_fmt].log2_chroma_w;
-    int linesize_align[4];
-    int align;
-    avcodec_align_dimensions2(s, width, height, linesize_align);
-    align = FFMAX(linesize_align[0], linesize_align[3]);
-    linesize_align[1] <<= chroma_shift;
-    linesize_align[2] <<= chroma_shift;
-    align = FFMAX3(align, linesize_align[1], linesize_align[2]);
-    *width=FFALIGN(*width, align);
-}
-
-int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
-    if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
-        return 0;
-
-    av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
-    return AVERROR(EINVAL);
-}
-
-int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
-    int i;
-    int w= s->width;
-    int h= s->height;
-    InternalBuffer *buf;
-    int *picture_number;
-
-    if(pic->data[0]!=NULL) {
-        av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");
-        return -1;
-    }
-    if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) {
-        av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n");
-        return -1;
-    }
-
-    if(avcodec_check_dimensions(s,w,h))
-        return -1;
-
-    if(s->internal_buffer==NULL){
-        s->internal_buffer= av_mallocz((INTERNAL_BUFFER_SIZE+1)*sizeof(InternalBuffer));
-    }
-#if 0
-    s->internal_buffer= av_fast_realloc(
-        s->internal_buffer,
-        &s->internal_buffer_size,
-        sizeof(InternalBuffer)*FFMAX(99,  s->internal_buffer_count+1)/*FIXME*/
-        );
-#endif
-
-    buf= &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
-    picture_number= &(((InternalBuffer*)s->internal_buffer)[INTERNAL_BUFFER_SIZE]).last_pic_num; //FIXME ugly hack
-    (*picture_number)++;
-
-    if(buf->base[0] && (buf->width != w || buf->height != h || buf->pix_fmt != s->pix_fmt)){
-        for(i=0; i<4; i++){
-            av_freep(&buf->base[i]);
-            buf->data[i]= NULL;
-        }
-    }
-
-    if(buf->base[0]){
-        pic->age= *picture_number - buf->last_pic_num;
-        buf->last_pic_num= *picture_number;
-    }else{
-        int h_chroma_shift, v_chroma_shift;
-        int size[4] = {0};
-        int tmpsize;
-        int unaligned;
-        AVPicture picture;
-        int stride_align[4];
-
-        avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-
-        avcodec_align_dimensions2(s, &w, &h, stride_align);
-
-        if(!(s->flags&CODEC_FLAG_EMU_EDGE)){
-            w+= EDGE_WIDTH*2;
-            h+= EDGE_WIDTH*2;
-        }
-
-        do {
-            // NOTE: do not align linesizes individually, this breaks e.g. assumptions
-            // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
-            ff_fill_linesize(&picture, s->pix_fmt, w);
-            // increase alignment of w for next try (rhs gives the lowest bit set in w)
-            w += w & ~(w-1);
-
-            unaligned = 0;
-            for (i=0; i<4; i++){
-                unaligned |= picture.linesize[i] % stride_align[i];
-            }
-        } while (unaligned);
-
-        tmpsize = ff_fill_pointer(&picture, NULL, s->pix_fmt, h);
-        if (tmpsize < 0)
-            return -1;
-
-        for (i=0; i<3 && picture.data[i+1]; i++)
-            size[i] = picture.data[i+1] - picture.data[i];
-        size[i] = tmpsize - (picture.data[i] - picture.data[0]);
-
-        buf->last_pic_num= -256*256*256*64;
-        memset(buf->base, 0, sizeof(buf->base));
-        memset(buf->data, 0, sizeof(buf->data));
-
-        for(i=0; i<4 && size[i]; i++){
-            const int h_shift= i==0 ? 0 : h_chroma_shift;
-            const int v_shift= i==0 ? 0 : v_chroma_shift;
-
-            buf->linesize[i]= picture.linesize[i];
-
-            buf->base[i]= av_malloc(size[i]+16); //FIXME 16
-            if(buf->base[i]==NULL) return -1;
-            memset(buf->base[i], 128, size[i]);
-
-            // no edge if EDEG EMU or not planar YUV
-            if((s->flags&CODEC_FLAG_EMU_EDGE) || !size[2])
-                buf->data[i] = buf->base[i];
-            else
-                buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]);
-        }
-        if(size[1] && !size[2])
-            ff_set_systematic_pal((uint32_t*)buf->data[1], s->pix_fmt);
-        buf->width  = s->width;
-        buf->height = s->height;
-        buf->pix_fmt= s->pix_fmt;
-        pic->age= 256*256*256*64;
-    }
-    pic->type= FF_BUFFER_TYPE_INTERNAL;
-
-    for(i=0; i<4; i++){
-        pic->base[i]= buf->base[i];
-        pic->data[i]= buf->data[i];
-        pic->linesize[i]= buf->linesize[i];
-    }
-    s->internal_buffer_count++;
-
-    pic->reordered_opaque= s->reordered_opaque;
-
-    if(s->debug&FF_DEBUG_BUFFERS)
-        av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count);
-
-    return 0;
-}
-
-void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
-    int i;
-    InternalBuffer *buf, *last;
-
-    assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
-    assert(s->internal_buffer_count);
-
-    buf = NULL; /* avoids warning */
-    for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize
-        buf= &((InternalBuffer*)s->internal_buffer)[i];
-        if(buf->data[0] == pic->data[0])
-            break;
-    }
-    assert(i < s->internal_buffer_count);
-    s->internal_buffer_count--;
-    last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
-
-    FFSWAP(InternalBuffer, *buf, *last);
-
-    for(i=0; i<4; i++){
-        pic->data[i]=NULL;
-//        pic->base[i]=NULL;
-    }
-//printf("R%X\n", pic->opaque);
-
-    if(s->debug&FF_DEBUG_BUFFERS)
-        av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count);
-}
-
-int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic){
-    AVFrame temp_pic;
-    int i;
-
-    /* If no picture return a new buffer */
-    if(pic->data[0] == NULL) {
-        /* We will copy from buffer, so must be readable */
-        pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
-        return s->get_buffer(s, pic);
-    }
-
-    /* If internal buffer type return the same buffer */
-    if(pic->type == FF_BUFFER_TYPE_INTERNAL) {
-        pic->reordered_opaque= s->reordered_opaque;
-        return 0;
-    }
-
-    /*
-     * Not internal type and reget_buffer not overridden, emulate cr buffer
-     */
-    temp_pic = *pic;
-    for(i = 0; i < 4; i++)
-        pic->data[i] = pic->base[i] = NULL;
-    pic->opaque = NULL;
-    /* Allocate new frame */
-    if (s->get_buffer(s, pic))
-        return -1;
-    /* Copy image data from old buffer to new buffer */
-    av_picture_copy((AVPicture*)pic, (AVPicture*)&temp_pic, s->pix_fmt, s->width,
-             s->height);
-    s->release_buffer(s, &temp_pic); // Release old frame
-    return 0;
-}
-
-int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
-    int i;
-
-    for(i=0; i<count; i++){
-        int r= func(c, (char*)arg + i*size);
-        if(ret) ret[i]= r;
-    }
-    return 0;
-}
-
-int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr),void *arg, int *ret, int count){
-    int i;
-
-    for(i=0; i<count; i++){
-        int r= func(c, arg, i, 0);
-        if(ret) ret[i]= r;
-    }
-    return 0;
-}
-
-enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt){
-    while (*fmt != PIX_FMT_NONE && ff_is_hwaccel_pix_fmt(*fmt))
-        ++fmt;
-    return fmt[0];
-}
-
-void avcodec_get_frame_defaults(AVFrame *pic){
-    memset(pic, 0, sizeof(AVFrame));
-
-    pic->pts= AV_NOPTS_VALUE;
-    pic->key_frame= 1;
-}
-
-AVFrame *avcodec_alloc_frame(void){
-    AVFrame *pic= av_malloc(sizeof(AVFrame));
-
-    if(pic==NULL) return NULL;
-
-    avcodec_get_frame_defaults(pic);
-
-    return pic;
-}
-
-int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
-{
-    int ret= -1;
-
-    /* If there is a user-supplied mutex locking routine, call it. */
-    if (ff_lockmgr_cb) {
-        if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
-            return -1;
-    }
-
-    entangled_thread_counter++;
-    if(entangled_thread_counter != 1){
-        av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
-        goto end;
-    }
-
-    if(avctx->codec || !codec)
-        goto end;
-
-    if (codec->priv_data_size > 0) {
-        avctx->priv_data = av_mallocz(codec->priv_data_size);
-        if (!avctx->priv_data) {
-            ret = AVERROR(ENOMEM);
-            goto end;
-        }
-    } else {
-        avctx->priv_data = NULL;
-    }
-
-    if(avctx->coded_width && avctx->coded_height)
-        avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
-    else if(avctx->width && avctx->height)
-        avcodec_set_dimensions(avctx, avctx->width, avctx->height);
-
-#define SANE_NB_CHANNELS 128U
-    if (((avctx->coded_width || avctx->coded_height)
-        && avcodec_check_dimensions(avctx, avctx->coded_width, avctx->coded_height))
-        || avctx->channels > SANE_NB_CHANNELS) {
-        ret = AVERROR(EINVAL);
-        goto free_and_end;
-    }
-
-    avctx->codec = codec;
-    if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&
-        avctx->codec_id == CODEC_ID_NONE) {
-        avctx->codec_type = codec->type;
-        avctx->codec_id   = codec->id;
-    }
-    if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){
-        av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n");
-        goto free_and_end;
-    }
-    avctx->frame_number = 0;
-    if(avctx->codec->init){
-        ret = avctx->codec->init(avctx);
-        if (ret < 0) {
-            goto free_and_end;
-        }
-    }
-    ret=0;
-end:
-    entangled_thread_counter--;
-
-    /* Release any user-supplied mutex. */
-    if (ff_lockmgr_cb) {
-        (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
-    }
-    return ret;
-free_and_end:
-    av_freep(&avctx->priv_data);
-    avctx->codec= NULL;
-    goto end;
-}
-
-int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                         const short *samples)
-{
-    if(buf_size < FF_MIN_BUFFER_SIZE && 0){
-        av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
-        return -1;
-    }
-    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || samples){
-        int ret = avctx->codec->encode(avctx, buf, buf_size, samples);
-        avctx->frame_number++;
-        return ret;
-    }else
-        return 0;
-}
-
-int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                         const AVFrame *pict)
-{
-    if(buf_size < FF_MIN_BUFFER_SIZE){
-        av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
-        return -1;
-    }
-    if(avcodec_check_dimensions(avctx,avctx->width,avctx->height))
-        return -1;
-    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
-        int ret = avctx->codec->encode(avctx, buf, buf_size, pict);
-        avctx->frame_number++;
-        emms_c(); //needed to avoid an emms_c() call before every return;
-
-        return ret;
-    }else
-        return 0;
-}
-
-int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
-                            const AVSubtitle *sub)
-{
-    int ret;
-    if(sub->start_display_time) {
-        av_log(avctx, AV_LOG_ERROR, "start_display_time must be 0.\n");
-        return -1;
-    }
-    if(sub->num_rects == 0 || !sub->rects)
-        return -1;
-    ret = avctx->codec->encode(avctx, buf, buf_size, sub);
-    avctx->frame_number++;
-    return ret;
-}
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
-                         int *got_picture_ptr,
-                         const uint8_t *buf, int buf_size)
-{
-    AVPacket avpkt;
-    av_init_packet(&avpkt);
-    avpkt.data = buf;
-    avpkt.size = buf_size;
-    // HACK for CorePNG to decode as normal PNG by default
-    avpkt.flags = AV_PKT_FLAG_KEY;
-
-    return avcodec_decode_video2(avctx, picture, got_picture_ptr, &avpkt);
-}
-#endif
-
-int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
-                         int *got_picture_ptr,
-                         AVPacket *avpkt)
-{
-    int ret;
-
-    *got_picture_ptr= 0;
-    if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height))
-        return -1;
-    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
-        ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
-                                avpkt);
-
-        emms_c(); //needed to avoid an emms_c() call before every return;
-
-        if (*got_picture_ptr)
-            avctx->frame_number++;
-    }else
-        ret= 0;
-
-    return ret;
-}
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
-                         int *frame_size_ptr,
-                         const uint8_t *buf, int buf_size)
-{
-    AVPacket avpkt;
-    av_init_packet(&avpkt);
-    avpkt.data = buf;
-    avpkt.size = buf_size;
-
-    return avcodec_decode_audio3(avctx, samples, frame_size_ptr, &avpkt);
-}
-#endif
-
-int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
-                         int *frame_size_ptr,
-                         AVPacket *avpkt)
-{
-    int ret;
-
-    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size){
-        //FIXME remove the check below _after_ ensuring that all audio check that the available space is enough
-        if(*frame_size_ptr < AVCODEC_MAX_AUDIO_FRAME_SIZE){
-            av_log(avctx, AV_LOG_ERROR, "buffer smaller than AVCODEC_MAX_AUDIO_FRAME_SIZE\n");
-            return -1;
-        }
-        if(*frame_size_ptr < FF_MIN_BUFFER_SIZE ||
-        *frame_size_ptr < avctx->channels * avctx->frame_size * sizeof(int16_t)){
-            av_log(avctx, AV_LOG_ERROR, "buffer %d too small\n", *frame_size_ptr);
-            return -1;
-        }
-
-        ret = avctx->codec->decode(avctx, samples, frame_size_ptr, avpkt);
-        avctx->frame_number++;
-    }else{
-        ret= 0;
-        *frame_size_ptr=0;
-    }
-    return ret;
-}
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub,
-                            int *got_sub_ptr,
-                            const uint8_t *buf, int buf_size)
-{
-    AVPacket avpkt;
-    av_init_packet(&avpkt);
-    avpkt.data = buf;
-    avpkt.size = buf_size;
-
-    return avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, &avpkt);
-}
-#endif
-
-int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
-                            int *got_sub_ptr,
-                            AVPacket *avpkt)
-{
-    int ret;
-
-    *got_sub_ptr = 0;
-    ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
-    if (*got_sub_ptr)
-        avctx->frame_number++;
-    return ret;
-}
-
-av_cold int avcodec_close(AVCodecContext *avctx)
-{
-    /* If there is a user-supplied mutex locking routine, call it. */
-    if (ff_lockmgr_cb) {
-        if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
-            return -1;
-    }
-
-    entangled_thread_counter++;
-    if(entangled_thread_counter != 1){
-        av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n");
-        entangled_thread_counter--;
-        return -1;
-    }
-
-    if (HAVE_THREADS && avctx->thread_opaque)
-        avcodec_thread_free(avctx);
-    if (avctx->codec && avctx->codec->close)
-        avctx->codec->close(avctx);
-    avcodec_default_free_buffers(avctx);
-    av_freep(&avctx->priv_data);
-    if(avctx->codec && avctx->codec->encode)
-        av_freep(&avctx->extradata);
-    avctx->codec = NULL;
-    entangled_thread_counter--;
-
-    /* Release any user-supplied mutex. */
-    if (ff_lockmgr_cb) {
-        (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);
-    }
-    return 0;
-}
-
-AVCodec *avcodec_find_encoder(enum CodecID id)
-{
-    AVCodec *p, *experimental=NULL;
-    p = first_avcodec;
-    while (p) {
-        if (p->encode != NULL && p->id == id) {
-            if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
-                experimental = p;
-            } else
-                return p;
-        }
-        p = p->next;
-    }
-    return experimental;
-}
-
-AVCodec *avcodec_find_encoder_by_name(const char *name)
-{
-    AVCodec *p;
-    if (!name)
-        return NULL;
-    p = first_avcodec;
-    while (p) {
-        if (p->encode != NULL && strcmp(name,p->name) == 0)
-            return p;
-        p = p->next;
-    }
-    return NULL;
-}
-
-AVCodec *avcodec_find_decoder(enum CodecID id)
-{
-    AVCodec *p;
-    p = first_avcodec;
-    while (p) {
-        if (p->decode != NULL && p->id == id)
-            return p;
-        p = p->next;
-    }
-    return NULL;
-}
-
-AVCodec *avcodec_find_decoder_by_name(const char *name)
-{
-    AVCodec *p;
-    if (!name)
-        return NULL;
-    p = first_avcodec;
-    while (p) {
-        if (p->decode != NULL && strcmp(name,p->name) == 0)
-            return p;
-        p = p->next;
-    }
-    return NULL;
-}
-
-static int get_bit_rate(AVCodecContext *ctx)
-{
-    int bit_rate;
-    int bits_per_sample;
-
-    switch(ctx->codec_type) {
-    case AVMEDIA_TYPE_VIDEO:
-    case AVMEDIA_TYPE_DATA:
-    case AVMEDIA_TYPE_SUBTITLE:
-    case AVMEDIA_TYPE_ATTACHMENT:
-        bit_rate = ctx->bit_rate;
-        break;
-    case AVMEDIA_TYPE_AUDIO:
-        bits_per_sample = av_get_bits_per_sample(ctx->codec_id);
-        bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate;
-        break;
-    default:
-        bit_rate = 0;
-        break;
-    }
-    return bit_rate;
-}
-
-void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
-{
-    const char *codec_name;
-    AVCodec *p;
-    char buf1[32];
-    int bitrate;
-    AVRational display_aspect_ratio;
-
-    if (encode)
-        p = avcodec_find_encoder(enc->codec_id);
-    else
-        p = avcodec_find_decoder(enc->codec_id);
-
-    if (p) {
-        codec_name = p->name;
-    } else if (enc->codec_id == CODEC_ID_MPEG2TS) {
-        /* fake mpeg2 transport stream codec (currently not
-           registered) */
-        codec_name = "mpeg2ts";
-    } else if (enc->codec_name[0] != '\0') {
-        codec_name = enc->codec_name;
-    } else {
-        /* output avi tags */
-        if(   isprint(enc->codec_tag&0xFF) && isprint((enc->codec_tag>>8)&0xFF)
-           && isprint((enc->codec_tag>>16)&0xFF) && isprint((enc->codec_tag>>24)&0xFF)){
-            snprintf(buf1, sizeof(buf1), "%c%c%c%c / 0x%04X",
-                     enc->codec_tag & 0xff,
-                     (enc->codec_tag >> 8) & 0xff,
-                     (enc->codec_tag >> 16) & 0xff,
-                     (enc->codec_tag >> 24) & 0xff,
-                      enc->codec_tag);
-        } else {
-            snprintf(buf1, sizeof(buf1), "0x%04x", enc->codec_tag);
-        }
-        codec_name = buf1;
-    }
-
-    switch(enc->codec_type) {
-    case AVMEDIA_TYPE_VIDEO:
-        snprintf(buf, buf_size,
-                 "Video: %s%s",
-                 codec_name, enc->mb_decision ? " (hq)" : "");
-        if (enc->pix_fmt != PIX_FMT_NONE) {
-            snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", %s",
-                     avcodec_get_pix_fmt_name(enc->pix_fmt));
-        }
-        if (enc->width) {
-            snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", %dx%d",
-                     enc->width, enc->height);
-            if (enc->sample_aspect_ratio.num) {
-                av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
-                          enc->width*enc->sample_aspect_ratio.num,
-                          enc->height*enc->sample_aspect_ratio.den,
-                          1024*1024);
-                snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                         " [PAR %d:%d DAR %d:%d]",
-                         enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den,
-                         display_aspect_ratio.num, display_aspect_ratio.den);
-            }
-            if(av_log_get_level() >= AV_LOG_DEBUG){
-                int g= av_gcd(enc->time_base.num, enc->time_base.den);
-                snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", %d/%d",
-                     enc->time_base.num/g, enc->time_base.den/g);
-            }
-        }
-        if (encode) {
-            snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", q=%d-%d", enc->qmin, enc->qmax);
-        }
-        break;
-    case AVMEDIA_TYPE_AUDIO:
-        snprintf(buf, buf_size,
-                 "Audio: %s",
-                 codec_name);
-        if (enc->sample_rate) {
-            snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", %d Hz", enc->sample_rate);
-        }
-        av_strlcat(buf, ", ", buf_size);
-        avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout);
-        if (enc->sample_fmt != SAMPLE_FMT_NONE) {
-            snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", %s", avcodec_get_sample_fmt_name(enc->sample_fmt));
-        }
-        break;
-    case AVMEDIA_TYPE_DATA:
-        snprintf(buf, buf_size, "Data: %s", codec_name);
-        break;
-    case AVMEDIA_TYPE_SUBTITLE:
-        snprintf(buf, buf_size, "Subtitle: %s", codec_name);
-        break;
-    case AVMEDIA_TYPE_ATTACHMENT:
-        snprintf(buf, buf_size, "Attachment: %s", codec_name);
-        break;
-    default:
-        snprintf(buf, buf_size, "Invalid Codec type %d", enc->codec_type);
-        return;
-    }
-    if (encode) {
-        if (enc->flags & CODEC_FLAG_PASS1)
-            snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", pass 1");
-        if (enc->flags & CODEC_FLAG_PASS2)
-            snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                     ", pass 2");
-    }
-    bitrate = get_bit_rate(enc);
-    if (bitrate != 0) {
-        snprintf(buf + strlen(buf), buf_size - strlen(buf),
-                 ", %d kb/s", bitrate / 1000);
-    }
-}
-
-unsigned avcodec_version( void )
-{
-  return LIBAVCODEC_VERSION_INT;
-}
-
-const char *avcodec_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char *avcodec_license(void)
-{
-#define LICENSE_PREFIX "libavcodec license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
-
-void avcodec_init(void)
-{
-    static int initialized = 0;
-
-    if (initialized != 0)
-        return;
-    initialized = 1;
-
-    dsputil_static_init();
-}
-
-void avcodec_flush_buffers(AVCodecContext *avctx)
-{
-    if(avctx->codec->flush)
-        avctx->codec->flush(avctx);
-}
-
-void avcodec_default_free_buffers(AVCodecContext *s){
-    int i, j;
-
-    if(s->internal_buffer==NULL) return;
-
-    if (s->internal_buffer_count)
-        av_log(s, AV_LOG_WARNING, "Found %i unreleased buffers!\n", s->internal_buffer_count);
-    for(i=0; i<INTERNAL_BUFFER_SIZE; i++){
-        InternalBuffer *buf= &((InternalBuffer*)s->internal_buffer)[i];
-        for(j=0; j<4; j++){
-            av_freep(&buf->base[j]);
-            buf->data[j]= NULL;
-        }
-    }
-    av_freep(&s->internal_buffer);
-
-    s->internal_buffer_count=0;
-}
-
-char av_get_pict_type_char(int pict_type){
-    switch(pict_type){
-    case FF_I_TYPE: return 'I';
-    case FF_P_TYPE: return 'P';
-    case FF_B_TYPE: return 'B';
-    case FF_S_TYPE: return 'S';
-    case FF_SI_TYPE:return 'i';
-    case FF_SP_TYPE:return 'p';
-    case FF_BI_TYPE:return 'b';
-    default:        return '?';
-    }
-}
-
-int av_get_bits_per_sample(enum CodecID codec_id){
-    switch(codec_id){
-    case CODEC_ID_ADPCM_SBPRO_2:
-        return 2;
-    case CODEC_ID_ADPCM_SBPRO_3:
-        return 3;
-    case CODEC_ID_ADPCM_SBPRO_4:
-    case CODEC_ID_ADPCM_CT:
-    case CODEC_ID_ADPCM_IMA_WAV:
-    case CODEC_ID_ADPCM_MS:
-    case CODEC_ID_ADPCM_YAMAHA:
-        return 4;
-    case CODEC_ID_PCM_ALAW:
-    case CODEC_ID_PCM_MULAW:
-    case CODEC_ID_PCM_S8:
-    case CODEC_ID_PCM_U8:
-    case CODEC_ID_PCM_ZORK:
-        return 8;
-    case CODEC_ID_PCM_S16BE:
-    case CODEC_ID_PCM_S16LE:
-    case CODEC_ID_PCM_S16LE_PLANAR:
-    case CODEC_ID_PCM_U16BE:
-    case CODEC_ID_PCM_U16LE:
-        return 16;
-    case CODEC_ID_PCM_S24DAUD:
-    case CODEC_ID_PCM_S24BE:
-    case CODEC_ID_PCM_S24LE:
-    case CODEC_ID_PCM_U24BE:
-    case CODEC_ID_PCM_U24LE:
-        return 24;
-    case CODEC_ID_PCM_S32BE:
-    case CODEC_ID_PCM_S32LE:
-    case CODEC_ID_PCM_U32BE:
-    case CODEC_ID_PCM_U32LE:
-    case CODEC_ID_PCM_F32BE:
-    case CODEC_ID_PCM_F32LE:
-        return 32;
-    case CODEC_ID_PCM_F64BE:
-    case CODEC_ID_PCM_F64LE:
-        return 64;
-    default:
-        return 0;
-    }
-}
-
-int av_get_bits_per_sample_format(enum SampleFormat sample_fmt) {
-    switch (sample_fmt) {
-    case SAMPLE_FMT_U8:
-        return 8;
-    case SAMPLE_FMT_S16:
-        return 16;
-    case SAMPLE_FMT_S32:
-    case SAMPLE_FMT_FLT:
-        return 32;
-    case SAMPLE_FMT_DBL:
-        return 64;
-    default:
-        return 0;
-    }
-}
-
-#if !HAVE_THREADS
-int avcodec_thread_init(AVCodecContext *s, int thread_count){
-    s->thread_count = thread_count;
-    return -1;
-}
-#endif
-
-unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
-{
-    unsigned int n = 0;
-
-    while(v >= 0xff) {
-        *s++ = 0xff;
-        v -= 0xff;
-        n++;
-    }
-    *s = v;
-    n++;
-    return n;
-}
-
-/* Wrapper to work around the lack of mkstemp() on mingw/cygin.
- * Also, tries to create file in /tmp first, if possible.
- * *prefix can be a character constant; *filename will be allocated internally.
- * Returns file descriptor of opened file (or -1 on error)
- * and opened file name in **filename. */
-int av_tempfile(char *prefix, char **filename) {
-    int fd=-1;
-#if !HAVE_MKSTEMP
-    *filename = tempnam(".", prefix);
-#else
-    size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
-    *filename = av_malloc(len);
-#endif
-    /* -----common section-----*/
-    if (*filename == NULL) {
-        av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
-        return -1;
-    }
-#if !HAVE_MKSTEMP
-    fd = open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444);
-#else
-    snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
-    fd = mkstemp(*filename);
-    if (fd < 0) {
-        snprintf(*filename, len, "./%sXXXXXX", prefix);
-        fd = mkstemp(*filename);
-    }
-#endif
-    /* -----common section-----*/
-    if (fd < 0) {
-        av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
-        return -1;
-    }
-    return fd; /* success */
-}
-
-typedef struct {
-    const char *abbr;
-    int width, height;
-} VideoFrameSizeAbbr;
-
-typedef struct {
-    const char *abbr;
-    int rate_num, rate_den;
-} VideoFrameRateAbbr;
-
-static const VideoFrameSizeAbbr video_frame_size_abbrs[] = {
-    { "ntsc",      720, 480 },
-    { "pal",       720, 576 },
-    { "qntsc",     352, 240 }, /* VCD compliant NTSC */
-    { "qpal",      352, 288 }, /* VCD compliant PAL */
-    { "sntsc",     640, 480 }, /* square pixel NTSC */
-    { "spal",      768, 576 }, /* square pixel PAL */
-    { "film",      352, 240 },
-    { "ntsc-film", 352, 240 },
-    { "sqcif",     128,  96 },
-    { "qcif",      176, 144 },
-    { "cif",       352, 288 },
-    { "4cif",      704, 576 },
-    { "16cif",    1408,1152 },
-    { "qqvga",     160, 120 },
-    { "qvga",      320, 240 },
-    { "vga",       640, 480 },
-    { "svga",      800, 600 },
-    { "xga",      1024, 768 },
-    { "uxga",     1600,1200 },
-    { "qxga",     2048,1536 },
-    { "sxga",     1280,1024 },
-    { "qsxga",    2560,2048 },
-    { "hsxga",    5120,4096 },
-    { "wvga",      852, 480 },
-    { "wxga",     1366, 768 },
-    { "wsxga",    1600,1024 },
-    { "wuxga",    1920,1200 },
-    { "woxga",    2560,1600 },
-    { "wqsxga",   3200,2048 },
-    { "wquxga",   3840,2400 },
-    { "whsxga",   6400,4096 },
-    { "whuxga",   7680,4800 },
-    { "cga",       320, 200 },
-    { "ega",       640, 350 },
-    { "hd480",     852, 480 },
-    { "hd720",    1280, 720 },
-    { "hd1080",   1920,1080 },
-};
-
-static const VideoFrameRateAbbr video_frame_rate_abbrs[]= {
-    { "ntsc",      30000, 1001 },
-    { "pal",          25,    1 },
-    { "qntsc",     30000, 1001 }, /* VCD compliant NTSC */
-    { "qpal",         25,    1 }, /* VCD compliant PAL */
-    { "sntsc",     30000, 1001 }, /* square pixel NTSC */
-    { "spal",         25,    1 }, /* square pixel PAL */
-    { "film",         24,    1 },
-    { "ntsc-film", 24000, 1001 },
-};
-
-int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str)
-{
-    int i;
-    int n = FF_ARRAY_ELEMS(video_frame_size_abbrs);
-    char *p;
-    int frame_width = 0, frame_height = 0;
-
-    for(i=0;i<n;i++) {
-        if (!strcmp(video_frame_size_abbrs[i].abbr, str)) {
-            frame_width = video_frame_size_abbrs[i].width;
-            frame_height = video_frame_size_abbrs[i].height;
-            break;
-        }
-    }
-    if (i == n) {
-        p = str;
-        frame_width = strtol(p, &p, 10);
-        if (*p)
-            p++;
-        frame_height = strtol(p, &p, 10);
-    }
-    if (frame_width <= 0 || frame_height <= 0)
-        return -1;
-    *width_ptr = frame_width;
-    *height_ptr = frame_height;
-    return 0;
-}
-
-int av_parse_video_frame_rate(AVRational *frame_rate, const char *arg)
-{
-    int i;
-    int n = FF_ARRAY_ELEMS(video_frame_rate_abbrs);
-    char* cp;
-
-    /* First, we check our abbreviation table */
-    for (i = 0; i < n; ++i)
-         if (!strcmp(video_frame_rate_abbrs[i].abbr, arg)) {
-             frame_rate->num = video_frame_rate_abbrs[i].rate_num;
-             frame_rate->den = video_frame_rate_abbrs[i].rate_den;
-             return 0;
-         }
-
-    /* Then, we try to parse it as fraction */
-    cp = strchr(arg, '/');
-    if (!cp)
-        cp = strchr(arg, ':');
-    if (cp) {
-        char* cpp;
-        frame_rate->num = strtol(arg, &cpp, 10);
-        if (cpp != arg || cpp == cp)
-            frame_rate->den = strtol(cp+1, &cpp, 10);
-        else
-           frame_rate->num = 0;
-    }
-    else {
-        /* Finally we give up and parse it as double */
-        AVRational time_base = av_d2q(strtod(arg, 0), 1001000);
-        frame_rate->den = time_base.den;
-        frame_rate->num = time_base.num;
-    }
-    if (!frame_rate->num || !frame_rate->den)
-        return -1;
-    else
-        return 0;
-}
-
-int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){
-    int i;
-    for(i=0; i<size && !(tab[i][0]==a && tab[i][1]==b); i++);
-    return i;
-}
-
-void av_log_missing_feature(void *avc, const char *feature, int want_sample)
-{
-    av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your FFmpeg "
-            "version to the newest one from SVN. If the problem still "
-            "occurs, it means that your file has a feature which has not "
-            "been implemented.", feature);
-    if(want_sample)
-        av_log_ask_for_sample(avc, NULL);
-    else
-        av_log(avc, AV_LOG_WARNING, "\n");
-}
-
-void av_log_ask_for_sample(void *avc, const char *msg)
-{
-    if (msg)
-        av_log(avc, AV_LOG_WARNING, "%s ", msg);
-    av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample "
-            "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ "
-            "and contact the ffmpeg-devel mailing list.\n");
-}
-
-static AVHWAccel *first_hwaccel = NULL;
-
-void av_register_hwaccel(AVHWAccel *hwaccel)
-{
-    AVHWAccel **p = &first_hwaccel;
-    while (*p)
-        p = &(*p)->next;
-    *p = hwaccel;
-    hwaccel->next = NULL;
-}
-
-AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel)
-{
-    return hwaccel ? hwaccel->next : first_hwaccel;
-}
-
-AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt)
-{
-    AVHWAccel *hwaccel=NULL;
-
-    while((hwaccel= av_hwaccel_next(hwaccel))){
-        if (   hwaccel->id      == codec_id
-            && hwaccel->pix_fmt == pix_fmt)
-            return hwaccel;
-    }
-    return NULL;
-}
-
-int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
-{
-    if (ff_lockmgr_cb) {
-        if (ff_lockmgr_cb(&codec_mutex, AV_LOCK_DESTROY))
-            return -1;
-    }
-
-    ff_lockmgr_cb = cb;
-
-    if (ff_lockmgr_cb) {
-        if (ff_lockmgr_cb(&codec_mutex, AV_LOCK_CREATE))
-            return -1;
-    }
-    return 0;
-}
diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
deleted file mode 100644
index a1a0827..0000000
--- a/libavcodec/v210dec.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * V210 decoder
- *
- * Copyright (C) 2009 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "libavutil/bswap.h"
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    if (avctx->width & 1) {
-        av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
-        return -1;
-    }
-    avctx->pix_fmt             = PIX_FMT_YUV422P16;
-    avctx->bits_per_raw_sample = 10;
-
-    avctx->coded_frame         = avcodec_alloc_frame();
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    int h, w;
-    AVFrame *pic = avctx->coded_frame;
-    const uint8_t *psrc = avpkt->data;
-    uint16_t *y, *u, *v;
-    int aligned_width = ((avctx->width + 47) / 48) * 48;
-    int stride = aligned_width * 8 / 3;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    if (avpkt->size < stride * avctx->height) {
-        av_log(avctx, AV_LOG_ERROR, "packet too small\n");
-        return -1;
-    }
-
-    pic->reference = 0;
-    if (avctx->get_buffer(avctx, pic) < 0)
-        return -1;
-
-    y = (uint16_t*)pic->data[0];
-    u = (uint16_t*)pic->data[1];
-    v = (uint16_t*)pic->data[2];
-    pic->pict_type = FF_I_TYPE;
-    pic->key_frame = 1;
-
-#define READ_PIXELS(a, b, c)         \
-    do {                             \
-        val  = le2me_32(*src++);     \
-        *a++ =  val <<  6;           \
-        *b++ = (val >>  4) & 0xFFC0; \
-        *c++ = (val >> 14) & 0xFFC0; \
-    } while (0)
-
-    for (h = 0; h < avctx->height; h++) {
-        const uint32_t *src = (const uint32_t*)psrc;
-        uint32_t val;
-        for (w = 0; w < avctx->width - 5; w += 6) {
-            READ_PIXELS(u, y, v);
-            READ_PIXELS(y, u, y);
-            READ_PIXELS(v, y, u);
-            READ_PIXELS(y, v, y);
-        }
-        if (w < avctx->width - 1) {
-            READ_PIXELS(u, y, v);
-
-            val  = le2me_32(*src++);
-            *y++ =  val <<  6;
-        }
-        if (w < avctx->width - 3) {
-            *u++ = (val >>  4) & 0xFFC0;
-            *y++ = (val >> 14) & 0xFFC0;
-
-            val  = le2me_32(*src++);
-            *v++ =  val <<  6;
-            *y++ = (val >>  4) & 0xFFC0;
-        }
-
-        psrc += stride;
-        y += pic->linesize[0] / 2 - avctx->width;
-        u += pic->linesize[1] / 2 - avctx->width / 2;
-        v += pic->linesize[2] / 2 - avctx->width / 2;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = *avctx->coded_frame;
-
-    return avpkt->size;
-}
-
-static av_cold int decode_close(AVCodecContext *avctx)
-{
-    AVFrame *pic = avctx->coded_frame;
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-AVCodec v210_decoder = {
-    "v210",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_V210,
-    0,
-    decode_init,
-    NULL,
-    decode_close,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
-};
diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
deleted file mode 100644
index 11e0e0e..0000000
--- a/libavcodec/v210enc.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * V210 encoder
- *
- * Copyright (C) 2009 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "libavcodec/bytestream.h"
-
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    if (avctx->width & 1) {
-        av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
-        return -1;
-    }
-
-    if (avctx->pix_fmt != PIX_FMT_YUV422P16) {
-        av_log(avctx, AV_LOG_ERROR, "v210 needs YUV422P16\n");
-        return -1;
-    }
-
-    if (avctx->bits_per_raw_sample != 10)
-        av_log(avctx, AV_LOG_WARNING, "bits per raw sample: %d != 10-bit\n",
-               avctx->bits_per_raw_sample);
-
-    avctx->coded_frame = avcodec_alloc_frame();
-
-    avctx->coded_frame->key_frame = 1;
-    avctx->coded_frame->pict_type = FF_I_TYPE;
-
-    return 0;
-}
-
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf,
-                        int buf_size, void *data)
-{
-    const AVFrame *pic = data;
-    int aligned_width = ((avctx->width + 47) / 48) * 48;
-    int stride = aligned_width * 8 / 3;
-    int h, w;
-    const uint16_t *y = (const uint16_t*)pic->data[0];
-    const uint16_t *u = (const uint16_t*)pic->data[1];
-    const uint16_t *v = (const uint16_t*)pic->data[2];
-    uint8_t *p = buf;
-    uint8_t *pdst = buf;
-
-    if (buf_size < aligned_width * avctx->height * 8 / 3) {
-        av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
-        return -1;
-    }
-
-#define WRITE_PIXELS(a, b, c)           \
-    do {                                \
-        val =  (*a++           >>  6) | \
-              ((*b++ & 0xFFC0) <<  4);  \
-        val|=  (*c++ & 0xFFC0) << 14;   \
-        bytestream_put_le32(&p, val);   \
-    } while (0)
-
-    for (h = 0; h < avctx->height; h++) {
-        uint32_t val;
-        for (w = 0; w < avctx->width - 5; w += 6) {
-            WRITE_PIXELS(u, y, v);
-            WRITE_PIXELS(y, u, y);
-            WRITE_PIXELS(v, y, u);
-            WRITE_PIXELS(y, v, y);
-        }
-        if (w < avctx->width - 1) {
-            WRITE_PIXELS(u, y, v);
-
-            val =   *y++           >>  6;
-            if (w == avctx->width - 2)
-                bytestream_put_le32(&p, val);
-        }
-        if (w < avctx->width - 3) {
-            val |=((*u++ & 0xFFC0) <<  4) |
-                  ((*y++ & 0xFFC0) << 14);
-            bytestream_put_le32(&p, val);
-
-            val =  (*v++           >>  6) |
-                   (*y++ & 0xFFC0) <<  4;
-            bytestream_put_le32(&p, val);
-        }
-
-        pdst += stride;
-        memset(p, 0, pdst - p);
-        p = pdst;
-        y += pic->linesize[0] / 2 - avctx->width;
-        u += pic->linesize[1] / 2 - avctx->width / 2;
-        v += pic->linesize[2] / 2 - avctx->width / 2;
-    }
-
-    return p - buf;
-}
-
-static av_cold int encode_close(AVCodecContext *avctx)
-{
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-AVCodec v210_encoder = {
-    "v210",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_V210,
-    0,
-    encode_init,
-    encode_frame,
-    encode_close,
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV422P16, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
-};
diff --git a/libavcodec/v210x.c b/libavcodec/v210x.c
deleted file mode 100644
index d869d64..0000000
--- a/libavcodec/v210x.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2009 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "libavutil/bswap.h"
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    if(avctx->width & 1){
-        av_log(avctx, AV_LOG_ERROR, "v210x needs even width\n");
-        return -1;
-    }
-    avctx->pix_fmt = PIX_FMT_YUV422P16;
-    avctx->bits_per_raw_sample= 10;
-
-    avctx->coded_frame= avcodec_alloc_frame();
-
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    int y=0;
-    int width= avctx->width;
-    AVFrame *pic= avctx->coded_frame;
-    const uint32_t *src= (const uint32_t *)avpkt->data;
-    uint16_t *ydst, *udst, *vdst, *yend;
-
-    if(pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    if(avpkt->size < avctx->width * avctx->height * 8 / 3){
-        av_log(avctx, AV_LOG_ERROR, "Packet too small\n");
-        return -1;
-    }
-
-    if(avpkt->size > avctx->width * avctx->height * 8 / 3){
-        av_log(avctx, AV_LOG_ERROR, "Probably padded data, need sample!\n");
-    }
-
-    pic->reference= 0;
-    if(avctx->get_buffer(avctx, pic) < 0)
-        return -1;
-
-    ydst= (uint16_t *)pic->data[0];
-    udst= (uint16_t *)pic->data[1];
-    vdst= (uint16_t *)pic->data[2];
-    yend= ydst + width;
-    pic->pict_type= FF_I_TYPE;
-    pic->key_frame= 1;
-
-    for(;;){
-        uint32_t v= be2me_32(*src++);
-        *udst++= (v>>16) & 0xFFC0;
-        *ydst++= (v>>6 ) & 0xFFC0;
-        *vdst++= (v<<4 ) & 0xFFC0;
-
-        v= be2me_32(*src++);
-        *ydst++= (v>>16) & 0xFFC0;
-
-        if(ydst >= yend){
-            ydst+= pic->linesize[0]/2 - width;
-            udst+= pic->linesize[1]/2 - width/2;
-            vdst+= pic->linesize[2]/2 - width/2;
-            yend= ydst + width;
-            if(++y >= avctx->height)
-                break;
-        }
-
-        *udst++= (v>>6 ) & 0xFFC0;
-        *ydst++= (v<<4 ) & 0xFFC0;
-
-        v= be2me_32(*src++);
-        *vdst++= (v>>16) & 0xFFC0;
-        *ydst++= (v>>6 ) & 0xFFC0;
-
-        if(ydst >= yend){
-            ydst+= pic->linesize[0]/2 - width;
-            udst+= pic->linesize[1]/2 - width/2;
-            vdst+= pic->linesize[2]/2 - width/2;
-            yend= ydst + width;
-            if(++y >= avctx->height)
-                break;
-        }
-
-        *udst++= (v<<4 ) & 0xFFC0;
-
-        v= be2me_32(*src++);
-        *ydst++= (v>>16) & 0xFFC0;
-        *vdst++= (v>>6 ) & 0xFFC0;
-        *ydst++= (v<<4 ) & 0xFFC0;
-        if(ydst >= yend){
-            ydst+= pic->linesize[0]/2 - width;
-            udst+= pic->linesize[1]/2 - width/2;
-            vdst+= pic->linesize[2]/2 - width/2;
-            yend= ydst + width;
-            if(++y >= avctx->height)
-                break;
-        }
-    }
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data= *avctx->coded_frame;
-
-    return avpkt->size;
-}
-
-static av_cold int decode_close(AVCodecContext *avctx)
-{
-    AVFrame *pic = avctx->coded_frame;
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-    av_freep(&avctx->coded_frame);
-
-    return 0;
-}
-
-AVCodec v210x_decoder = {
-    "v210x",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_V210X,
-    0,
-    decode_init,
-    NULL,
-    decode_close,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
-};
diff --git a/libavcodec/vaapi.c b/libavcodec/vaapi.c
deleted file mode 100644
index 10f9054..0000000
--- a/libavcodec/vaapi.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Video Acceleration API (video decoding)
- * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "vaapi_internal.h"
-
-/**
- * \addtogroup VAAPI_Decoding
- *
- * @{
- */
-
-static void destroy_buffers(VADisplay display, VABufferID *buffers, unsigned int n_buffers)
-{
-    unsigned int i;
-    for (i = 0; i < n_buffers; i++) {
-        if (buffers[i]) {
-            vaDestroyBuffer(display, buffers[i]);
-            buffers[i] = 0;
-        }
-    }
-}
-
-static int render_picture(struct vaapi_context *vactx, VASurfaceID surface)
-{
-    VABufferID va_buffers[3];
-    unsigned int n_va_buffers = 0;
-
-    vaUnmapBuffer(vactx->display, vactx->pic_param_buf_id);
-    va_buffers[n_va_buffers++] = vactx->pic_param_buf_id;
-
-    if (vactx->iq_matrix_buf_id) {
-        vaUnmapBuffer(vactx->display, vactx->iq_matrix_buf_id);
-        va_buffers[n_va_buffers++] = vactx->iq_matrix_buf_id;
-    }
-
-    if (vactx->bitplane_buf_id) {
-        vaUnmapBuffer(vactx->display, vactx->bitplane_buf_id);
-        va_buffers[n_va_buffers++] = vactx->bitplane_buf_id;
-    }
-
-    if (vaBeginPicture(vactx->display, vactx->context_id,
-                       surface) != VA_STATUS_SUCCESS)
-        return -1;
-
-    if (vaRenderPicture(vactx->display, vactx->context_id,
-                        va_buffers, n_va_buffers) != VA_STATUS_SUCCESS)
-        return -1;
-
-    if (vaRenderPicture(vactx->display, vactx->context_id,
-                        vactx->slice_buf_ids,
-                        vactx->n_slice_buf_ids) != VA_STATUS_SUCCESS)
-        return -1;
-
-    if (vaEndPicture(vactx->display, vactx->context_id) != VA_STATUS_SUCCESS)
-        return -1;
-
-    return 0;
-}
-
-static int commit_slices(struct vaapi_context *vactx)
-{
-    VABufferID *slice_buf_ids;
-    VABufferID slice_param_buf_id, slice_data_buf_id;
-
-    if (vactx->slice_count == 0)
-        return 0;
-
-    slice_buf_ids =
-        av_fast_realloc(vactx->slice_buf_ids,
-                        &vactx->slice_buf_ids_alloc,
-                        (vactx->n_slice_buf_ids + 2) * sizeof(slice_buf_ids[0]));
-    if (!slice_buf_ids)
-        return -1;
-    vactx->slice_buf_ids = slice_buf_ids;
-
-    slice_param_buf_id = 0;
-    if (vaCreateBuffer(vactx->display, vactx->context_id,
-                       VASliceParameterBufferType,
-                       vactx->slice_param_size,
-                       vactx->slice_count, vactx->slice_params,
-                       &slice_param_buf_id) != VA_STATUS_SUCCESS)
-        return -1;
-    vactx->slice_count = 0;
-
-    slice_data_buf_id = 0;
-    if (vaCreateBuffer(vactx->display, vactx->context_id,
-                       VASliceDataBufferType,
-                       vactx->slice_data_size,
-                       1, (void *)vactx->slice_data,
-                       &slice_data_buf_id) != VA_STATUS_SUCCESS)
-        return -1;
-    vactx->slice_data = NULL;
-    vactx->slice_data_size = 0;
-
-    slice_buf_ids[vactx->n_slice_buf_ids++] = slice_param_buf_id;
-    slice_buf_ids[vactx->n_slice_buf_ids++] = slice_data_buf_id;
-    return 0;
-}
-
-static void *alloc_buffer(struct vaapi_context *vactx, int type, unsigned int size, uint32_t *buf_id)
-{
-    void *data = NULL;
-
-    *buf_id = 0;
-    if (vaCreateBuffer(vactx->display, vactx->context_id,
-                       type, size, 1, NULL, buf_id) == VA_STATUS_SUCCESS)
-        vaMapBuffer(vactx->display, *buf_id, &data);
-
-    return data;
-}
-
-void *ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size)
-{
-    return alloc_buffer(vactx, VAPictureParameterBufferType, size, &vactx->pic_param_buf_id);
-}
-
-void *ff_vaapi_alloc_iq_matrix(struct vaapi_context *vactx, unsigned int size)
-{
-    return alloc_buffer(vactx, VAIQMatrixBufferType, size, &vactx->iq_matrix_buf_id);
-}
-
-uint8_t *ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size)
-{
-    return alloc_buffer(vactx, VABitPlaneBufferType, size, &vactx->bitplane_buf_id);
-}
-
-VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct vaapi_context *vactx, const uint8_t *buffer, uint32_t size)
-{
-    uint8_t *slice_params;
-    VASliceParameterBufferBase *slice_param;
-
-    if (!vactx->slice_data)
-        vactx->slice_data = buffer;
-    if (vactx->slice_data + vactx->slice_data_size != buffer) {
-        if (commit_slices(vactx) < 0)
-            return NULL;
-        vactx->slice_data = buffer;
-    }
-
-    slice_params =
-        av_fast_realloc(vactx->slice_params,
-                        &vactx->slice_params_alloc,
-                        (vactx->slice_count + 1) * vactx->slice_param_size);
-    if (!slice_params)
-        return NULL;
-    vactx->slice_params = slice_params;
-
-    slice_param = (VASliceParameterBufferBase *)(slice_params + vactx->slice_count * vactx->slice_param_size);
-    slice_param->slice_data_size   = size;
-    slice_param->slice_data_offset = vactx->slice_data_size;
-    slice_param->slice_data_flag   = VA_SLICE_DATA_FLAG_ALL;
-
-    vactx->slice_count++;
-    vactx->slice_data_size += size;
-    return slice_param;
-}
-
-int ff_vaapi_common_end_frame(MpegEncContext *s)
-{
-    struct vaapi_context * const vactx = s->avctx->hwaccel_context;
-    int ret = -1;
-
-    dprintf(s->avctx, "ff_vaapi_common_end_frame()\n");
-
-    if (commit_slices(vactx) < 0)
-        goto done;
-    if (vactx->n_slice_buf_ids > 0) {
-        if (render_picture(vactx, ff_vaapi_get_surface_id(s->current_picture_ptr)) < 0)
-            goto done;
-        ff_draw_horiz_band(s, 0, s->avctx->height);
-    }
-    ret = 0;
-
-done:
-    destroy_buffers(vactx->display, &vactx->pic_param_buf_id, 1);
-    destroy_buffers(vactx->display, &vactx->iq_matrix_buf_id, 1);
-    destroy_buffers(vactx->display, &vactx->bitplane_buf_id, 1);
-    destroy_buffers(vactx->display, vactx->slice_buf_ids, vactx->n_slice_buf_ids);
-    av_freep(&vactx->slice_buf_ids);
-    av_freep(&vactx->slice_params);
-    vactx->n_slice_buf_ids     = 0;
-    vactx->slice_buf_ids_alloc = 0;
-    vactx->slice_count         = 0;
-    vactx->slice_params_alloc  = 0;
-    return ret;
-}
-
-/* @} */
diff --git a/libavcodec/vaapi.h b/libavcodec/vaapi.h
deleted file mode 100644
index 07568a4..0000000
--- a/libavcodec/vaapi.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Video Acceleration API (shared data between FFmpeg and the video player)
- * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VAAPI_H
-#define AVCODEC_VAAPI_H
-
-#include <stdint.h>
-
-/**
- * \defgroup VAAPI_Decoding VA API Decoding
- * \ingroup Decoder
- * @{
- */
-
-/**
- * This structure is used to share data between the FFmpeg library and
- * the client video application.
- * This shall be zero-allocated and available as
- * AVCodecContext.hwaccel_context. All user members can be set once
- * during initialization or through each AVCodecContext.get_buffer()
- * function call. In any case, they must be valid prior to calling
- * decoding functions.
- */
-struct vaapi_context {
-    /**
-     * Window system dependent data
-     *
-     * - encoding: unused
-     * - decoding: Set by user
-     */
-    void *display;
-
-    /**
-     * Configuration ID
-     *
-     * - encoding: unused
-     * - decoding: Set by user
-     */
-    uint32_t config_id;
-
-    /**
-     * Context ID (video decode pipeline)
-     *
-     * - encoding: unused
-     * - decoding: Set by user
-     */
-    uint32_t context_id;
-
-    /**
-     * VAPictureParameterBuffer ID
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    uint32_t pic_param_buf_id;
-
-    /**
-     * VAIQMatrixBuffer ID
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    uint32_t iq_matrix_buf_id;
-
-    /**
-     * VABitPlaneBuffer ID (for VC-1 decoding)
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    uint32_t bitplane_buf_id;
-
-    /**
-     * Slice parameter/data buffer IDs
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    uint32_t *slice_buf_ids;
-
-    /**
-     * Number of effective slice buffer IDs to send to the HW
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    unsigned int n_slice_buf_ids;
-
-    /**
-     * Size of pre-allocated slice_buf_ids
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    unsigned int slice_buf_ids_alloc;
-
-    /**
-     * Pointer to VASliceParameterBuffers
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    void *slice_params;
-
-    /**
-     * Size of a VASliceParameterBuffer element
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    unsigned int slice_param_size;
-
-    /**
-     * Size of pre-allocated slice_params
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    unsigned int slice_params_alloc;
-
-    /**
-     * Number of slices currently filled in
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    unsigned int slice_count;
-
-    /**
-     * Pointer to slice data buffer base
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    const uint8_t *slice_data;
-
-    /**
-     * Current size of slice data
-     *
-     * - encoding: unused
-     * - decoding: Set by libavcodec
-     */
-    uint32_t slice_data_size;
-};
-
-/* @} */
-
-#endif /* AVCODEC_VAAPI_H */
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
deleted file mode 100644
index 6d4251a..0000000
--- a/libavcodec/vaapi_h264.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * H.264 HW decode acceleration through VA API
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "vaapi_internal.h"
-#include "h264.h"
-
-/** @file
- *  This file implements the glue code between FFmpeg's and VA API's
- *  structures for H.264 decoding.
- */
-
-/**
- * Initializes an empty VA API picture.
- *
- * VA API requires a fixed-size reference picture array.
- */
-static void init_vaapi_pic(VAPictureH264 *va_pic)
-{
-    va_pic->picture_id          = VA_INVALID_ID;
-    va_pic->flags               = VA_PICTURE_H264_INVALID;
-    va_pic->TopFieldOrderCnt    = 0;
-    va_pic->BottomFieldOrderCnt = 0;
-}
-
-/**
- * Translates an FFmpeg Picture into its VA API form.
- *
- * @param[out] va_pic          A pointer to VA API's own picture struct
- * @param[in]  pic             A pointer to the FFmpeg picture struct to convert
- * @param[in]  pic_structure   The picture field type (as defined in mpegvideo.h),
- *                             supersedes pic's field type if nonzero.
- */
-static void fill_vaapi_pic(VAPictureH264 *va_pic,
-                           Picture       *pic,
-                           int            pic_structure)
-{
-    if (pic_structure == 0)
-        pic_structure = pic->reference;
-
-    va_pic->picture_id = ff_vaapi_get_surface_id(pic);
-    va_pic->frame_idx  = pic->long_ref ? pic->pic_id : pic->frame_num;
-
-    va_pic->flags      = 0;
-    if (pic_structure != PICT_FRAME)
-        va_pic->flags |= (pic_structure & PICT_TOP_FIELD) ? VA_PICTURE_H264_TOP_FIELD : VA_PICTURE_H264_BOTTOM_FIELD;
-    if (pic->reference)
-        va_pic->flags |= pic->long_ref ? VA_PICTURE_H264_LONG_TERM_REFERENCE : VA_PICTURE_H264_SHORT_TERM_REFERENCE;
-
-    va_pic->TopFieldOrderCnt = 0;
-    if (pic->field_poc[0] != INT_MAX)
-        va_pic->TopFieldOrderCnt = pic->field_poc[0];
-
-    va_pic->BottomFieldOrderCnt = 0;
-    if (pic->field_poc[1] != INT_MAX)
-        va_pic->BottomFieldOrderCnt = pic->field_poc[1];
-}
-
-/** Decoded Picture Buffer (DPB). */
-typedef struct DPB {
-    int            size;        ///< Current number of reference frames in the DPB
-    int            max_size;    ///< Max number of reference frames. This is FF_ARRAY_ELEMS(VAPictureParameterBufferH264.ReferenceFrames)
-    VAPictureH264 *va_pics;     ///< Pointer to VAPictureParameterBufferH264.ReferenceFrames array
-} DPB;
-
-/**
- * Appends picture to the decoded picture buffer, in a VA API form that
- * merges the second field picture attributes with the first, if
- * available.  The decoded picture buffer's size must be large enough
- * to receive the new VA API picture object.
- */
-static int dpb_add(DPB *dpb, Picture *pic)
-{
-    int i;
-
-    if (dpb->size >= dpb->max_size)
-        return -1;
-
-    for (i = 0; i < dpb->size; i++) {
-        VAPictureH264 * const va_pic = &dpb->va_pics[i];
-        if (va_pic->picture_id == ff_vaapi_get_surface_id(pic)) {
-            VAPictureH264 temp_va_pic;
-            fill_vaapi_pic(&temp_va_pic, pic, 0);
-
-            if ((temp_va_pic.flags ^ va_pic->flags) & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD)) {
-                va_pic->flags |= temp_va_pic.flags & (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD);
-                /* Merge second field */
-                if (temp_va_pic.flags & VA_PICTURE_H264_TOP_FIELD) {
-                    va_pic->TopFieldOrderCnt    = temp_va_pic.TopFieldOrderCnt;
-                } else {
-                    va_pic->BottomFieldOrderCnt = temp_va_pic.BottomFieldOrderCnt;
-                }
-            }
-            return 0;
-        }
-    }
-
-    fill_vaapi_pic(&dpb->va_pics[dpb->size++], pic, 0);
-    return 0;
-}
-
-/** Fills in VA API reference frames array. */
-static int fill_vaapi_ReferenceFrames(VAPictureParameterBufferH264 *pic_param,
-                                      H264Context                  *h)
-{
-    DPB dpb;
-    int i;
-
-    dpb.size     = 0;
-    dpb.max_size = FF_ARRAY_ELEMS(pic_param->ReferenceFrames);
-    dpb.va_pics  = pic_param->ReferenceFrames;
-    for (i = 0; i < dpb.max_size; i++)
-        init_vaapi_pic(&dpb.va_pics[i]);
-
-    for (i = 0; i < h->short_ref_count; i++) {
-        Picture * const pic = h->short_ref[i];
-        if (pic && pic->reference && dpb_add(&dpb, pic) < 0)
-            return -1;
-    }
-
-    for (i = 0; i < 16; i++) {
-        Picture * const pic = h->long_ref[i];
-        if (pic && pic->reference && dpb_add(&dpb, pic) < 0)
-            return -1;
-    }
-    return 0;
-}
-
-/**
- * Fills in VA API reference picture lists from the FFmpeg reference
- * picture list.
- *
- * @param[out] RefPicList  VA API internal reference picture list
- * @param[in]  ref_list    A pointer to the FFmpeg reference list
- * @param[in]  ref_count   The number of reference pictures in ref_list
- */
-static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32],
-                                  Picture      *ref_list,
-                                  unsigned int  ref_count)
-{
-    unsigned int i, n = 0;
-    for (i = 0; i < ref_count; i++)
-        if (ref_list[i].reference)
-            fill_vaapi_pic(&RefPicList[n++], &ref_list[i], 0);
-
-    for (; n < 32; n++)
-        init_vaapi_pic(&RefPicList[n]);
-}
-
-/**
- * Fills in prediction weight table.
- *
- * VA API requires a plain prediction weight table as it does not infer
- * any value.
- *
- * @param[in]  h                   A pointer to the current H.264 context
- * @param[in]  list                The reference frame list index to use
- * @param[out] luma_weight_flag    VA API plain luma weight flag
- * @param[out] luma_weight         VA API plain luma weight table
- * @param[out] luma_offset         VA API plain luma offset table
- * @param[out] chroma_weight_flag  VA API plain chroma weight flag
- * @param[out] chroma_weight       VA API plain chroma weight table
- * @param[out] chroma_offset       VA API plain chroma offset table
- */
-static void fill_vaapi_plain_pred_weight_table(H264Context   *h,
-                                               int            list,
-                                               unsigned char *luma_weight_flag,
-                                               short          luma_weight[32],
-                                               short          luma_offset[32],
-                                               unsigned char *chroma_weight_flag,
-                                               short          chroma_weight[32][2],
-                                               short          chroma_offset[32][2])
-{
-    unsigned int i, j;
-
-    *luma_weight_flag    = h->luma_weight_flag[list];
-    *chroma_weight_flag  = h->chroma_weight_flag[list];
-
-    for (i = 0; i < h->ref_count[list]; i++) {
-        /* VA API also wants the inferred (default) values, not
-           only what is available in the bitstream (7.4.3.2). */
-        if (h->luma_weight_flag[list]) {
-            luma_weight[i] = h->luma_weight[i][list][0];
-            luma_offset[i] = h->luma_weight[i][list][1];
-        } else {
-            luma_weight[i] = 1 << h->luma_log2_weight_denom;
-            luma_offset[i] = 0;
-        }
-        for (j = 0; j < 2; j++) {
-            if (h->chroma_weight_flag[list]) {
-                chroma_weight[i][j] = h->chroma_weight[i][list][j][0];
-                chroma_offset[i][j] = h->chroma_weight[i][list][j][1];
-            } else {
-                chroma_weight[i][j] = 1 << h->chroma_log2_weight_denom;
-                chroma_offset[i][j] = 0;
-            }
-        }
-    }
-}
-
-/** Initializes and starts decoding a frame with VA API. */
-static int start_frame(AVCodecContext          *avctx,
-                       av_unused const uint8_t *buffer,
-                       av_unused uint32_t       size)
-{
-    H264Context * const h = avctx->priv_data;
-    MpegEncContext * const s = &h->s;
-    struct vaapi_context * const vactx = avctx->hwaccel_context;
-    VAPictureParameterBufferH264 *pic_param;
-    VAIQMatrixBufferH264 *iq_matrix;
-
-    dprintf(avctx, "start_frame()\n");
-
-    vactx->slice_param_size = sizeof(VASliceParameterBufferH264);
-
-    /* Fill in VAPictureParameterBufferH264. */
-    pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferH264));
-    if (!pic_param)
-        return -1;
-    fill_vaapi_pic(&pic_param->CurrPic, s->current_picture_ptr, s->picture_structure);
-    if (fill_vaapi_ReferenceFrames(pic_param, h) < 0)
-        return -1;
-    pic_param->picture_width_in_mbs_minus1                      = s->mb_width - 1;
-    pic_param->picture_height_in_mbs_minus1                     = s->mb_height - 1;
-    pic_param->bit_depth_luma_minus8                            = h->sps.bit_depth_luma - 8;
-    pic_param->bit_depth_chroma_minus8                          = h->sps.bit_depth_chroma - 8;
-    pic_param->num_ref_frames                                   = h->sps.ref_frame_count;
-    pic_param->seq_fields.value                                 = 0; /* reset all bits */
-    pic_param->seq_fields.bits.chroma_format_idc                = h->sps.chroma_format_idc;
-    pic_param->seq_fields.bits.residual_colour_transform_flag   = h->sps.residual_color_transform_flag; /* XXX: only for 4:4:4 high profile? */
-    pic_param->seq_fields.bits.gaps_in_frame_num_value_allowed_flag = h->sps.gaps_in_frame_num_allowed_flag;
-    pic_param->seq_fields.bits.frame_mbs_only_flag              = h->sps.frame_mbs_only_flag;
-    pic_param->seq_fields.bits.mb_adaptive_frame_field_flag     = h->sps.mb_aff;
-    pic_param->seq_fields.bits.direct_8x8_inference_flag        = h->sps.direct_8x8_inference_flag;
-    pic_param->seq_fields.bits.MinLumaBiPredSize8x8             = h->sps.level_idc >= 31; /* A.3.3.2 */
-    pic_param->seq_fields.bits.log2_max_frame_num_minus4        = h->sps.log2_max_frame_num - 4;
-    pic_param->seq_fields.bits.pic_order_cnt_type               = h->sps.poc_type;
-    pic_param->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4;
-    pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag;
-    pic_param->num_slice_groups_minus1                          = h->pps.slice_group_count - 1;
-    pic_param->slice_group_map_type                             = h->pps.mb_slice_group_map_type;
-    pic_param->slice_group_change_rate_minus1                   = 0; /* XXX: unimplemented in FFmpeg */
-    pic_param->pic_init_qp_minus26                              = h->pps.init_qp - 26;
-    pic_param->pic_init_qs_minus26                              = h->pps.init_qs - 26;
-    pic_param->chroma_qp_index_offset                           = h->pps.chroma_qp_index_offset[0];
-    pic_param->second_chroma_qp_index_offset                    = h->pps.chroma_qp_index_offset[1];
-    pic_param->pic_fields.value                                 = 0; /* reset all bits */
-    pic_param->pic_fields.bits.entropy_coding_mode_flag         = h->pps.cabac;
-    pic_param->pic_fields.bits.weighted_pred_flag               = h->pps.weighted_pred;
-    pic_param->pic_fields.bits.weighted_bipred_idc              = h->pps.weighted_bipred_idc;
-    pic_param->pic_fields.bits.transform_8x8_mode_flag          = h->pps.transform_8x8_mode;
-    pic_param->pic_fields.bits.field_pic_flag                   = s->picture_structure != PICT_FRAME;
-    pic_param->pic_fields.bits.constrained_intra_pred_flag      = h->pps.constrained_intra_pred;
-    pic_param->pic_fields.bits.pic_order_present_flag           = h->pps.pic_order_present;
-    pic_param->pic_fields.bits.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
-    pic_param->pic_fields.bits.redundant_pic_cnt_present_flag   = h->pps.redundant_pic_cnt_present;
-    pic_param->pic_fields.bits.reference_pic_flag               = h->nal_ref_idc != 0;
-    pic_param->frame_num                                        = h->frame_num;
-
-    /* Fill in VAIQMatrixBufferH264. */
-    iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferH264));
-    if (!iq_matrix)
-        return -1;
-    memcpy(iq_matrix->ScalingList4x4, h->pps.scaling_matrix4, sizeof(iq_matrix->ScalingList4x4));
-    memcpy(iq_matrix->ScalingList8x8, h->pps.scaling_matrix8, sizeof(iq_matrix->ScalingList8x8));
-    return 0;
-}
-
-/** Ends a hardware decoding based frame. */
-static int end_frame(AVCodecContext *avctx)
-{
-    H264Context * const h = avctx->priv_data;
-
-    dprintf(avctx, "end_frame()\n");
-    return ff_vaapi_common_end_frame(&h->s);
-}
-
-/** Decodes the given H.264 slice with VA API. */
-static int decode_slice(AVCodecContext *avctx,
-                        const uint8_t  *buffer,
-                        uint32_t        size)
-{
-    H264Context * const h = avctx->priv_data;
-    MpegEncContext * const s = &h->s;
-    VASliceParameterBufferH264 *slice_param;
-
-    dprintf(avctx, "decode_slice(): buffer %p, size %d\n", buffer, size);
-
-    /* Fill in VASliceParameterBufferH264. */
-    slice_param = (VASliceParameterBufferH264 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
-    if (!slice_param)
-        return -1;
-    slice_param->slice_data_bit_offset          = get_bits_count(&h->s.gb) + 8; /* bit buffer started beyond nal_unit_type */
-    slice_param->first_mb_in_slice              = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x;
-    slice_param->slice_type                     = ff_h264_get_slice_type(h);
-    slice_param->direct_spatial_mv_pred_flag    = h->slice_type == FF_B_TYPE ? h->direct_spatial_mv_pred : 0;
-    slice_param->num_ref_idx_l0_active_minus1   = h->list_count > 0 ? h->ref_count[0] - 1 : 0;
-    slice_param->num_ref_idx_l1_active_minus1   = h->list_count > 1 ? h->ref_count[1] - 1 : 0;
-    slice_param->cabac_init_idc                 = h->cabac_init_idc;
-    slice_param->slice_qp_delta                 = s->qscale - h->pps.init_qp;
-    slice_param->disable_deblocking_filter_idc  = h->deblocking_filter < 2 ? !h->deblocking_filter : h->deblocking_filter;
-    slice_param->slice_alpha_c0_offset_div2     = h->slice_alpha_c0_offset / 2 - 26;
-    slice_param->slice_beta_offset_div2         = h->slice_beta_offset     / 2 - 26;
-    slice_param->luma_log2_weight_denom         = h->luma_log2_weight_denom;
-    slice_param->chroma_log2_weight_denom       = h->chroma_log2_weight_denom;
-
-    fill_vaapi_RefPicList(slice_param->RefPicList0, h->ref_list[0], h->list_count > 0 ? h->ref_count[0] : 0);
-    fill_vaapi_RefPicList(slice_param->RefPicList1, h->ref_list[1], h->list_count > 1 ? h->ref_count[1] : 0);
-
-    fill_vaapi_plain_pred_weight_table(h, 0,
-                                       &slice_param->luma_weight_l0_flag,   slice_param->luma_weight_l0,   slice_param->luma_offset_l0,
-                                       &slice_param->chroma_weight_l0_flag, slice_param->chroma_weight_l0, slice_param->chroma_offset_l0);
-    fill_vaapi_plain_pred_weight_table(h, 1,
-                                       &slice_param->luma_weight_l1_flag,   slice_param->luma_weight_l1,   slice_param->luma_offset_l1,
-                                       &slice_param->chroma_weight_l1_flag, slice_param->chroma_weight_l1, slice_param->chroma_offset_l1);
-    return 0;
-}
-
-AVHWAccel h264_vaapi_hwaccel = {
-    .name           = "h264_vaapi",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_H264,
-    .pix_fmt        = PIX_FMT_VAAPI_VLD,
-    .capabilities   = 0,
-    .start_frame    = start_frame,
-    .end_frame      = end_frame,
-    .decode_slice   = decode_slice,
-    .priv_data_size = 0,
-};
diff --git a/libavcodec/vaapi_internal.h b/libavcodec/vaapi_internal.h
deleted file mode 100644
index 2c0fdf9..0000000
--- a/libavcodec/vaapi_internal.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Video Acceleration API (video decoding)
- * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VAAPI_INTERNAL_H
-#define AVCODEC_VAAPI_INTERNAL_H
-
-#include <va/va.h>
-#include "vaapi.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-
-/**
- * \addtogroup VAAPI_Decoding
- *
- * @{
- */
-
-/** Extract VASurfaceID from a Picture */
-static inline VASurfaceID ff_vaapi_get_surface_id(Picture *pic)
-{
-    return (uintptr_t)pic->data[3];
-}
-
-/** Common AVHWAccel.end_frame() implementation */
-int ff_vaapi_common_end_frame(MpegEncContext *s);
-
-/** Allocate a new picture parameter buffer */
-void *ff_vaapi_alloc_pic_param(struct vaapi_context *vactx, unsigned int size);
-
-/** Allocate a new IQ matrix buffer */
-void *ff_vaapi_alloc_iq_matrix(struct vaapi_context *vactx, unsigned int size);
-
-/** Allocate a new bit-plane buffer */
-uint8_t *ff_vaapi_alloc_bitplane(struct vaapi_context *vactx, uint32_t size);
-
-/**
- * Allocate a new slice descriptor for the input slice.
- *
- * @param vactx the VA API context
- * @param buffer the slice data buffer base
- * @param size the size of the slice in bytes
- * @return the newly allocated slice parameter
- */
-VASliceParameterBufferBase *ff_vaapi_alloc_slice(struct vaapi_context *vactx, const uint8_t *buffer, uint32_t size);
-
-/* @} */
-
-#endif /* AVCODEC_VAAPI_INTERNAL_H */
diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
deleted file mode 100644
index 2e870dc..0000000
--- a/libavcodec/vaapi_mpeg2.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * MPEG-2 HW decode acceleration through VA API
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "vaapi_internal.h"
-#include "dsputil.h"
-
-/** Reconstruct bitstream f_code */
-static inline int mpeg2_get_f_code(MpegEncContext *s)
-{
-    return ((s->mpeg_f_code[0][0] << 12) | (s->mpeg_f_code[0][1] << 8) |
-            (s->mpeg_f_code[1][0] <<  4) |  s->mpeg_f_code[1][1]);
-}
-
-/** Determine frame start: first field for field picture or frame picture */
-static inline int mpeg2_get_is_frame_start(MpegEncContext *s)
-{
-    return s->first_field || s->picture_structure == PICT_FRAME;
-}
-
-static int vaapi_mpeg2_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
-{
-    struct MpegEncContext * const s = avctx->priv_data;
-    struct vaapi_context * const vactx = avctx->hwaccel_context;
-    VAPictureParameterBufferMPEG2 *pic_param;
-    VAIQMatrixBufferMPEG2 *iq_matrix;
-    int i;
-
-    dprintf(avctx, "vaapi_mpeg2_start_frame()\n");
-
-    vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG2);
-
-    /* Fill in VAPictureParameterBufferMPEG2 */
-    pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG2));
-    if (!pic_param)
-        return -1;
-    pic_param->horizontal_size                                  = s->width;
-    pic_param->vertical_size                                    = s->height;
-    pic_param->forward_reference_picture                        = VA_INVALID_ID;
-    pic_param->backward_reference_picture                       = VA_INVALID_ID;
-    pic_param->picture_coding_type                              = s->pict_type;
-    pic_param->f_code                                           = mpeg2_get_f_code(s);
-    pic_param->picture_coding_extension.value                   = 0; /* reset all bits */
-    pic_param->picture_coding_extension.bits.intra_dc_precision = s->intra_dc_precision;
-    pic_param->picture_coding_extension.bits.picture_structure  = s->picture_structure;
-    pic_param->picture_coding_extension.bits.top_field_first    = s->top_field_first;
-    pic_param->picture_coding_extension.bits.frame_pred_frame_dct = s->frame_pred_frame_dct;
-    pic_param->picture_coding_extension.bits.concealment_motion_vectors = s->concealment_motion_vectors;
-    pic_param->picture_coding_extension.bits.q_scale_type       = s->q_scale_type;
-    pic_param->picture_coding_extension.bits.intra_vlc_format   = s->intra_vlc_format;
-    pic_param->picture_coding_extension.bits.alternate_scan     = s->alternate_scan;
-    pic_param->picture_coding_extension.bits.repeat_first_field = s->repeat_first_field;
-    pic_param->picture_coding_extension.bits.progressive_frame  = s->progressive_frame;
-    pic_param->picture_coding_extension.bits.is_first_field     = mpeg2_get_is_frame_start(s);
-
-    switch (s->pict_type) {
-    case FF_B_TYPE:
-        pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
-        // fall-through
-    case FF_P_TYPE:
-        pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture);
-        break;
-    }
-
-    /* Fill in VAIQMatrixBufferMPEG2 */
-    iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferMPEG2));
-    if (!iq_matrix)
-        return -1;
-    iq_matrix->load_intra_quantiser_matrix              = 1;
-    iq_matrix->load_non_intra_quantiser_matrix          = 1;
-    iq_matrix->load_chroma_intra_quantiser_matrix       = 1;
-    iq_matrix->load_chroma_non_intra_quantiser_matrix   = 1;
-
-    for (i = 0; i < 64; i++) {
-        int n = s->dsp.idct_permutation[ff_zigzag_direct[i]];
-        iq_matrix->intra_quantiser_matrix[i]            = s->intra_matrix[n];
-        iq_matrix->non_intra_quantiser_matrix[i]        = s->inter_matrix[n];
-        iq_matrix->chroma_intra_quantiser_matrix[i]     = s->chroma_intra_matrix[n];
-        iq_matrix->chroma_non_intra_quantiser_matrix[i] = s->chroma_inter_matrix[n];
-    }
-    return 0;
-}
-
-static int vaapi_mpeg2_end_frame(AVCodecContext *avctx)
-{
-    return ff_vaapi_common_end_frame(avctx->priv_data);
-}
-
-static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
-{
-    MpegEncContext * const s = avctx->priv_data;
-    VASliceParameterBufferMPEG2 *slice_param;
-    GetBitContext gb;
-    uint32_t start_code, quantiser_scale_code, intra_slice_flag, macroblock_offset;
-
-    dprintf(avctx, "vaapi_mpeg2_decode_slice(): buffer %p, size %d\n", buffer, size);
-
-    /* Determine macroblock_offset */
-    init_get_bits(&gb, buffer, 8 * size);
-    start_code = get_bits(&gb, 32);
-    assert((start_code & 0xffffff00) == 0x00000100);
-    quantiser_scale_code = get_bits(&gb, 5);
-    intra_slice_flag = get_bits1(&gb);
-    if (intra_slice_flag) {
-        skip_bits(&gb, 8);
-        while (get_bits1(&gb) != 0)
-            skip_bits(&gb, 8);
-    }
-    macroblock_offset = get_bits_count(&gb);
-
-    /* Fill in VASliceParameterBufferMPEG2 */
-    slice_param = (VASliceParameterBufferMPEG2 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
-    if (!slice_param)
-        return -1;
-    slice_param->macroblock_offset              = macroblock_offset;
-    slice_param->slice_horizontal_position      = s->mb_x;
-    slice_param->slice_vertical_position        = s->mb_y;
-    slice_param->quantiser_scale_code           = quantiser_scale_code;
-    slice_param->intra_slice_flag               = intra_slice_flag;
-    return 0;
-}
-
-AVHWAccel mpeg2_vaapi_hwaccel = {
-    .name           = "mpeg2_vaapi",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_MPEG2VIDEO,
-    .pix_fmt        = PIX_FMT_VAAPI_VLD,
-    .capabilities   = 0,
-    .start_frame    = vaapi_mpeg2_start_frame,
-    .end_frame      = vaapi_mpeg2_end_frame,
-    .decode_slice   = vaapi_mpeg2_decode_slice,
-    .priv_data_size = 0,
-};
diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c
deleted file mode 100644
index 466ce2f..0000000
--- a/libavcodec/vaapi_mpeg4.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * MPEG-4 / H.263 HW decode acceleration through VA API
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "vaapi_internal.h"
-
-/** Reconstruct bitstream intra_dc_vlc_thr */
-static int mpeg4_get_intra_dc_vlc_thr(MpegEncContext *s)
-{
-    switch (s->intra_dc_threshold) {
-    case 99: return 0;
-    case 13: return 1;
-    case 15: return 2;
-    case 17: return 3;
-    case 19: return 4;
-    case 21: return 5;
-    case 23: return 6;
-    case 0:  return 7;
-    }
-    return 0;
-}
-
-static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
-{
-    MpegEncContext * const s = avctx->priv_data;
-    struct vaapi_context * const vactx = avctx->hwaccel_context;
-    VAPictureParameterBufferMPEG4 *pic_param;
-    VAIQMatrixBufferMPEG4 *iq_matrix;
-    int i;
-
-    dprintf(avctx, "vaapi_mpeg4_start_frame()\n");
-
-    vactx->slice_param_size = sizeof(VASliceParameterBufferMPEG4);
-
-    /* Fill in VAPictureParameterBufferMPEG4 */
-    pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferMPEG4));
-    if (!pic_param)
-        return -1;
-    pic_param->vop_width                                = s->width;
-    pic_param->vop_height                               = s->height;
-    pic_param->forward_reference_picture                = VA_INVALID_ID;
-    pic_param->backward_reference_picture               = VA_INVALID_ID;
-    pic_param->vol_fields.value                         = 0; /* reset all bits */
-    pic_param->vol_fields.bits.short_video_header       = avctx->codec->id == CODEC_ID_H263;
-    pic_param->vol_fields.bits.chroma_format            = CHROMA_420;
-    pic_param->vol_fields.bits.interlaced               = !s->progressive_sequence;
-    pic_param->vol_fields.bits.obmc_disable             = 1;
-    pic_param->vol_fields.bits.sprite_enable            = s->vol_sprite_usage;
-    pic_param->vol_fields.bits.sprite_warping_accuracy  = s->sprite_warping_accuracy;
-    pic_param->vol_fields.bits.quant_type               = s->mpeg_quant;
-    pic_param->vol_fields.bits.quarter_sample           = s->quarter_sample;
-    pic_param->vol_fields.bits.data_partitioned         = s->data_partitioning;
-    pic_param->vol_fields.bits.reversible_vlc           = s->rvlc;
-    pic_param->vol_fields.bits.resync_marker_disable    = !s->resync_marker;
-    pic_param->no_of_sprite_warping_points              = s->num_sprite_warping_points;
-    for (i = 0; i < s->num_sprite_warping_points && i < 3; i++) {
-        pic_param->sprite_trajectory_du[i]              = s->sprite_traj[i][0];
-        pic_param->sprite_trajectory_dv[i]              = s->sprite_traj[i][1];
-    }
-    pic_param->quant_precision                          = s->quant_precision;
-    pic_param->vop_fields.value                         = 0; /* reset all bits */
-    pic_param->vop_fields.bits.vop_coding_type          = s->pict_type - FF_I_TYPE;
-    pic_param->vop_fields.bits.backward_reference_vop_coding_type = s->pict_type == FF_B_TYPE ? s->next_picture.pict_type - FF_I_TYPE : 0;
-    pic_param->vop_fields.bits.vop_rounding_type        = s->no_rounding;
-    pic_param->vop_fields.bits.intra_dc_vlc_thr         = mpeg4_get_intra_dc_vlc_thr(s);
-    pic_param->vop_fields.bits.top_field_first          = s->top_field_first;
-    pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan;
-    pic_param->vop_fcode_forward                        = s->f_code;
-    pic_param->vop_fcode_backward                       = s->b_code;
-    pic_param->vop_time_increment_resolution            = avctx->time_base.den;
-    pic_param->num_macroblocks_in_gob                   = s->mb_width * ff_h263_get_gob_height(s);
-    pic_param->num_gobs_in_vop                          = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob;
-    pic_param->TRB                                      = s->pb_time;
-    pic_param->TRD                                      = s->pp_time;
-
-    if (s->pict_type == FF_B_TYPE)
-        pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
-    if (s->pict_type != FF_I_TYPE)
-        pic_param->forward_reference_picture  = ff_vaapi_get_surface_id(&s->last_picture);
-
-    /* Fill in VAIQMatrixBufferMPEG4 */
-    /* Only the first inverse quantisation method uses the weighthing matrices */
-    if (pic_param->vol_fields.bits.quant_type) {
-        iq_matrix = ff_vaapi_alloc_iq_matrix(vactx, sizeof(VAIQMatrixBufferMPEG4));
-        if (!iq_matrix)
-            return -1;
-        iq_matrix->load_intra_quant_mat         = 1;
-        iq_matrix->load_non_intra_quant_mat     = 1;
-
-        for (i = 0; i < 64; i++) {
-            int n = s->dsp.idct_permutation[ff_zigzag_direct[i]];
-            iq_matrix->intra_quant_mat[i]       = s->intra_matrix[n];
-            iq_matrix->non_intra_quant_mat[i]   = s->inter_matrix[n];
-        }
-    }
-    return 0;
-}
-
-static int vaapi_mpeg4_end_frame(AVCodecContext *avctx)
-{
-    return ff_vaapi_common_end_frame(avctx->priv_data);
-}
-
-static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
-{
-    MpegEncContext * const s = avctx->priv_data;
-    VASliceParameterBufferMPEG4 *slice_param;
-
-    dprintf(avctx, "vaapi_mpeg4_decode_slice(): buffer %p, size %d\n", buffer, size);
-
-    /* video_plane_with_short_video_header() contains all GOBs
-     * in-order, and this is what VA API (Intel backend) expects: only
-     * a single slice param. So fake macroblock_number for FFmpeg so
-     * that we don't call vaapi_mpeg4_decode_slice() again
-     */
-    if (avctx->codec->id == CODEC_ID_H263)
-        size = s->gb.buffer_end - buffer;
-
-    /* Fill in VASliceParameterBufferMPEG4 */
-    slice_param = (VASliceParameterBufferMPEG4 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
-    if (!slice_param)
-        return -1;
-    slice_param->macroblock_offset      = get_bits_count(&s->gb) % 8;
-    slice_param->macroblock_number      = s->mb_y * s->mb_width + s->mb_x;
-    slice_param->quant_scale            = s->qscale;
-
-    if (avctx->codec->id == CODEC_ID_H263)
-        s->mb_y = s->mb_height;
-
-    return 0;
-}
-
-#if CONFIG_MPEG4_VAAPI_HWACCEL
-AVHWAccel mpeg4_vaapi_hwaccel = {
-    .name           = "mpeg4_vaapi",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_MPEG4,
-    .pix_fmt        = PIX_FMT_VAAPI_VLD,
-    .capabilities   = 0,
-    .start_frame    = vaapi_mpeg4_start_frame,
-    .end_frame      = vaapi_mpeg4_end_frame,
-    .decode_slice   = vaapi_mpeg4_decode_slice,
-    .priv_data_size = 0,
-};
-#endif
-
-#if CONFIG_H263_VAAPI_HWACCEL
-AVHWAccel h263_vaapi_hwaccel = {
-    .name           = "h263_vaapi",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_H263,
-    .pix_fmt        = PIX_FMT_VAAPI_VLD,
-    .capabilities   = 0,
-    .start_frame    = vaapi_mpeg4_start_frame,
-    .end_frame      = vaapi_mpeg4_end_frame,
-    .decode_slice   = vaapi_mpeg4_decode_slice,
-    .priv_data_size = 0,
-};
-#endif
diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c
deleted file mode 100644
index 992e1da..0000000
--- a/libavcodec/vaapi_vc1.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * VC-1 HW decode acceleration through VA API
- *
- * Copyright (C) 2008-2009 Splitted-Desktop Systems
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "vaapi_internal.h"
-#include "vc1.h"
-#include "vc1data.h"
-
-/** Translates FFmpeg MV modes to VA API */
-static int get_VAMvModeVC1(enum MVModes mv_mode)
-{
-    switch (mv_mode) {
-    case MV_PMODE_1MV_HPEL_BILIN: return VAMvMode1MvHalfPelBilinear;
-    case MV_PMODE_1MV:            return VAMvMode1Mv;
-    case MV_PMODE_1MV_HPEL:       return VAMvMode1MvHalfPel;
-    case MV_PMODE_MIXED_MV:       return VAMvModeMixedMv;
-    case MV_PMODE_INTENSITY_COMP: return VAMvModeIntensityCompensation;
-    }
-    return 0;
-}
-
-/** Checks whether the MVTYPEMB bitplane is present */
-static inline int vc1_has_MVTYPEMB_bitplane(VC1Context *v)
-{
-    if (v->mv_type_is_raw)
-        return 0;
-    return (v->s.pict_type == FF_P_TYPE &&
-            (v->mv_mode == MV_PMODE_MIXED_MV ||
-             (v->mv_mode == MV_PMODE_INTENSITY_COMP &&
-              v->mv_mode2 == MV_PMODE_MIXED_MV)));
-}
-
-/** Checks whether the SKIPMB bitplane is present */
-static inline int vc1_has_SKIPMB_bitplane(VC1Context *v)
-{
-    if (v->skip_is_raw)
-        return 0;
-    return (v->s.pict_type == FF_P_TYPE ||
-            (v->s.pict_type == FF_B_TYPE && !v->bi_type));
-}
-
-/** Checks whether the DIRECTMB bitplane is present */
-static inline int vc1_has_DIRECTMB_bitplane(VC1Context *v)
-{
-    if (v->dmb_is_raw)
-        return 0;
-    return v->s.pict_type == FF_B_TYPE && !v->bi_type;
-}
-
-/** Checks whether the ACPRED bitplane is present */
-static inline int vc1_has_ACPRED_bitplane(VC1Context *v)
-{
-    if (v->acpred_is_raw)
-        return 0;
-    return (v->profile == PROFILE_ADVANCED &&
-            (v->s.pict_type == FF_I_TYPE ||
-             (v->s.pict_type == FF_B_TYPE && v->bi_type)));
-}
-
-/** Check whether the OVERFLAGS bitplane is present */
-static inline int vc1_has_OVERFLAGS_bitplane(VC1Context *v)
-{
-    if (v->overflg_is_raw)
-        return 0;
-    return (v->profile == PROFILE_ADVANCED &&
-            (v->s.pict_type == FF_I_TYPE ||
-             (v->s.pict_type == FF_B_TYPE && v->bi_type)) &&
-            (v->overlap && v->pq <= 8) &&
-            v->condover == CONDOVER_SELECT);
-}
-
-/** Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35) */
-static int vc1_get_PTYPE(VC1Context *v)
-{
-    MpegEncContext * const s = &v->s;
-    switch (s->pict_type) {
-    case FF_I_TYPE: return 0;
-    case FF_P_TYPE: return v->p_frame_skipped ? 4 : 1;
-    case FF_B_TYPE: return v->bi_type         ? 3 : 2;
-    }
-    return 0;
-}
-
-/** Reconstruct bitstream MVMODE (7.1.1.32) */
-static inline VAMvModeVC1 vc1_get_MVMODE(VC1Context *v)
-{
-    if (v->s.pict_type == FF_P_TYPE ||
-        (v->s.pict_type == FF_B_TYPE && !v->bi_type))
-        return get_VAMvModeVC1(v->mv_mode);
-    return 0;
-}
-
-/** Reconstruct bitstream MVMODE2 (7.1.1.33) */
-static inline VAMvModeVC1 vc1_get_MVMODE2(VC1Context *v)
-{
-    if (v->s.pict_type == FF_P_TYPE && v->mv_mode == MV_PMODE_INTENSITY_COMP)
-        return get_VAMvModeVC1(v->mv_mode2);
-    return 0;
-}
-
-/** Pack FFmpeg bitplanes into a VABitPlaneBuffer element */
-static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *ff_bp[3], int x, int y, int stride)
-{
-    const int bitplane_index = n / 2;
-    const int ff_bp_index = y * stride + x;
-    uint8_t v = 0;
-    if (ff_bp[0])
-        v = ff_bp[0][ff_bp_index];
-    if (ff_bp[1])
-        v |= ff_bp[1][ff_bp_index] << 1;
-    if (ff_bp[2])
-        v |= ff_bp[2][ff_bp_index] << 2;
-    bitplane[bitplane_index] = (bitplane[bitplane_index] << 4) | v;
-}
-
-static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
-{
-    VC1Context * const v = avctx->priv_data;
-    MpegEncContext * const s = &v->s;
-    struct vaapi_context * const vactx = avctx->hwaccel_context;
-    VAPictureParameterBufferVC1 *pic_param;
-
-    dprintf(avctx, "vaapi_vc1_start_frame()\n");
-
-    vactx->slice_param_size = sizeof(VASliceParameterBufferVC1);
-
-    /* Fill in VAPictureParameterBufferVC1 */
-    pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VAPictureParameterBufferVC1));
-    if (!pic_param)
-        return -1;
-    pic_param->forward_reference_picture                            = VA_INVALID_ID;
-    pic_param->backward_reference_picture                           = VA_INVALID_ID;
-    pic_param->inloop_decoded_picture                               = VA_INVALID_ID;
-    pic_param->sequence_fields.value                                = 0; /* reset all bits */
-    pic_param->sequence_fields.bits.pulldown                        = v->broadcast;
-    pic_param->sequence_fields.bits.interlace                       = v->interlace;
-    pic_param->sequence_fields.bits.tfcntrflag                      = v->tfcntrflag;
-    pic_param->sequence_fields.bits.finterpflag                     = v->finterpflag;
-    pic_param->sequence_fields.bits.psf                             = v->psf;
-    pic_param->sequence_fields.bits.multires                        = v->multires;
-    pic_param->sequence_fields.bits.overlap                         = v->overlap;
-    pic_param->sequence_fields.bits.syncmarker                      = s->resync_marker;
-    pic_param->sequence_fields.bits.rangered                        = v->rangered;
-    pic_param->sequence_fields.bits.max_b_frames                    = s->avctx->max_b_frames;
-    pic_param->coded_width                                          = s->avctx->coded_width;
-    pic_param->coded_height                                         = s->avctx->coded_height;
-    pic_param->entrypoint_fields.value                              = 0; /* reset all bits */
-    pic_param->entrypoint_fields.bits.broken_link                   = v->broken_link;
-    pic_param->entrypoint_fields.bits.closed_entry                  = v->closed_entry;
-    pic_param->entrypoint_fields.bits.panscan_flag                  = v->panscanflag;
-    pic_param->entrypoint_fields.bits.loopfilter                    = s->loop_filter;
-    pic_param->conditional_overlap_flag                             = v->condover;
-    pic_param->fast_uvmc_flag                                       = v->fastuvmc;
-    pic_param->range_mapping_fields.value                           = 0; /* reset all bits */
-    pic_param->range_mapping_fields.bits.luma_flag                  = v->range_mapy_flag;
-    pic_param->range_mapping_fields.bits.luma                       = v->range_mapy;
-    pic_param->range_mapping_fields.bits.chroma_flag                = v->range_mapuv_flag;
-    pic_param->range_mapping_fields.bits.chroma                     = v->range_mapuv;
-    pic_param->b_picture_fraction                                   = v->bfraction_lut_index;
-    pic_param->cbp_table                                            = v->cbpcy_vlc ? v->cbpcy_vlc - ff_vc1_cbpcy_p_vlc : 0;
-    pic_param->mb_mode_table                                        = 0; /* XXX: interlaced frame */
-    pic_param->range_reduction_frame                                = v->rangeredfrm;
-    pic_param->rounding_control                                     = v->rnd;
-    pic_param->post_processing                                      = v->postproc;
-    pic_param->picture_resolution_index                             = v->respic;
-    pic_param->luma_scale                                           = v->lumscale;
-    pic_param->luma_shift                                           = v->lumshift;
-    pic_param->picture_fields.value                                 = 0; /* reset all bits */
-    pic_param->picture_fields.bits.picture_type                     = vc1_get_PTYPE(v);
-    pic_param->picture_fields.bits.frame_coding_mode                = v->fcm;
-    pic_param->picture_fields.bits.top_field_first                  = v->tff;
-    pic_param->picture_fields.bits.is_first_field                   = v->fcm == 0; /* XXX: interlaced frame */
-    pic_param->picture_fields.bits.intensity_compensation           = v->mv_mode == MV_PMODE_INTENSITY_COMP;
-    pic_param->raw_coding.value                                     = 0; /* reset all bits */
-    pic_param->raw_coding.flags.mv_type_mb                          = v->mv_type_is_raw;
-    pic_param->raw_coding.flags.direct_mb                           = v->dmb_is_raw;
-    pic_param->raw_coding.flags.skip_mb                             = v->skip_is_raw;
-    pic_param->raw_coding.flags.field_tx                            = 0; /* XXX: interlaced frame */
-    pic_param->raw_coding.flags.forward_mb                          = 0; /* XXX: interlaced frame */
-    pic_param->raw_coding.flags.ac_pred                             = v->acpred_is_raw;
-    pic_param->raw_coding.flags.overflags                           = v->overflg_is_raw;
-    pic_param->bitplane_present.value                               = 0; /* reset all bits */
-    pic_param->bitplane_present.flags.bp_mv_type_mb                 = vc1_has_MVTYPEMB_bitplane(v);
-    pic_param->bitplane_present.flags.bp_direct_mb                  = vc1_has_DIRECTMB_bitplane(v);
-    pic_param->bitplane_present.flags.bp_skip_mb                    = vc1_has_SKIPMB_bitplane(v);
-    pic_param->bitplane_present.flags.bp_field_tx                   = 0; /* XXX: interlaced frame */
-    pic_param->bitplane_present.flags.bp_forward_mb                 = 0; /* XXX: interlaced frame */
-    pic_param->bitplane_present.flags.bp_ac_pred                    = vc1_has_ACPRED_bitplane(v);
-    pic_param->bitplane_present.flags.bp_overflags                  = vc1_has_OVERFLAGS_bitplane(v);
-    pic_param->reference_fields.value                               = 0; /* reset all bits */
-    pic_param->reference_fields.bits.reference_distance_flag        = v->refdist_flag;
-    pic_param->reference_fields.bits.reference_distance             = 0; /* XXX: interlaced frame */
-    pic_param->reference_fields.bits.num_reference_pictures         = 0; /* XXX: interlaced frame */
-    pic_param->reference_fields.bits.reference_field_pic_indicator  = 0; /* XXX: interlaced frame */
-    pic_param->mv_fields.value                                      = 0; /* reset all bits */
-    pic_param->mv_fields.bits.mv_mode                               = vc1_get_MVMODE(v);
-    pic_param->mv_fields.bits.mv_mode2                              = vc1_get_MVMODE2(v);
-    pic_param->mv_fields.bits.mv_table                              = s->mv_table_index;
-    pic_param->mv_fields.bits.two_mv_block_pattern_table            = 0; /* XXX: interlaced frame */
-    pic_param->mv_fields.bits.four_mv_switch                        = 0; /* XXX: interlaced frame */
-    pic_param->mv_fields.bits.four_mv_block_pattern_table           = 0; /* XXX: interlaced frame */
-    pic_param->mv_fields.bits.extended_mv_flag                      = v->extended_mv;
-    pic_param->mv_fields.bits.extended_mv_range                     = v->mvrange;
-    pic_param->mv_fields.bits.extended_dmv_flag                     = v->extended_dmv;
-    pic_param->mv_fields.bits.extended_dmv_range                    = 0; /* XXX: interlaced frame */
-    pic_param->pic_quantizer_fields.value                           = 0; /* reset all bits */
-    pic_param->pic_quantizer_fields.bits.dquant                     = v->dquant;
-    pic_param->pic_quantizer_fields.bits.quantizer                  = v->quantizer_mode;
-    pic_param->pic_quantizer_fields.bits.half_qp                    = v->halfpq;
-    pic_param->pic_quantizer_fields.bits.pic_quantizer_scale        = v->pq;
-    pic_param->pic_quantizer_fields.bits.pic_quantizer_type         = v->pquantizer;
-    pic_param->pic_quantizer_fields.bits.dq_frame                   = v->dquantfrm;
-    pic_param->pic_quantizer_fields.bits.dq_profile                 = v->dqprofile;
-    pic_param->pic_quantizer_fields.bits.dq_sb_edge                 = v->dqprofile == DQPROFILE_SINGLE_EDGE  ? v->dqsbedge : 0;
-    pic_param->pic_quantizer_fields.bits.dq_db_edge                 = v->dqprofile == DQPROFILE_DOUBLE_EDGES ? v->dqsbedge : 0;
-    pic_param->pic_quantizer_fields.bits.dq_binary_level            = v->dqbilevel;
-    pic_param->pic_quantizer_fields.bits.alt_pic_quantizer          = v->altpq;
-    pic_param->transform_fields.value                               = 0; /* reset all bits */
-    pic_param->transform_fields.bits.variable_sized_transform_flag  = v->vstransform;
-    pic_param->transform_fields.bits.mb_level_transform_type_flag   = v->ttmbf;
-    pic_param->transform_fields.bits.frame_level_transform_type     = v->ttfrm;
-    pic_param->transform_fields.bits.transform_ac_codingset_idx1    = v->c_ac_table_index;
-    pic_param->transform_fields.bits.transform_ac_codingset_idx2    = v->y_ac_table_index;
-    pic_param->transform_fields.bits.intra_transform_dc_table       = v->s.dc_table_index;
-
-    switch (s->pict_type) {
-    case FF_B_TYPE:
-        pic_param->backward_reference_picture = ff_vaapi_get_surface_id(&s->next_picture);
-        // fall-through
-    case FF_P_TYPE:
-        pic_param->forward_reference_picture = ff_vaapi_get_surface_id(&s->last_picture);
-        break;
-    }
-
-    if (pic_param->bitplane_present.value) {
-        uint8_t *bitplane;
-        const uint8_t *ff_bp[3];
-        int x, y, n;
-
-        switch (s->pict_type) {
-        case FF_P_TYPE:
-            ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb  ? v->direct_mb_plane    : NULL;
-            ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb    ? s->mbskip_table       : NULL;
-            ff_bp[2] = pic_param->bitplane_present.flags.bp_mv_type_mb ? v->mv_type_mb_plane   : NULL;
-            break;
-        case FF_B_TYPE:
-            if (!v->bi_type) {
-                ff_bp[0] = pic_param->bitplane_present.flags.bp_direct_mb ? v->direct_mb_plane : NULL;
-                ff_bp[1] = pic_param->bitplane_present.flags.bp_skip_mb   ? s->mbskip_table    : NULL;
-                ff_bp[2] = NULL; /* XXX: interlaced frame (FORWARD plane) */
-                break;
-            }
-            /* fall-through (BI-type) */
-        case FF_I_TYPE:
-            ff_bp[0] = NULL; /* XXX: interlaced frame (FIELDTX plane) */
-            ff_bp[1] = pic_param->bitplane_present.flags.bp_ac_pred    ? v->acpred_plane       : NULL;
-            ff_bp[2] = pic_param->bitplane_present.flags.bp_overflags  ? v->over_flags_plane   : NULL;
-            break;
-        default:
-            ff_bp[0] = NULL;
-            ff_bp[1] = NULL;
-            ff_bp[2] = NULL;
-            break;
-        }
-
-        bitplane = ff_vaapi_alloc_bitplane(vactx, (s->mb_width * s->mb_height + 1) / 2);
-        if (!bitplane)
-            return -1;
-
-        n = 0;
-        for (y = 0; y < s->mb_height; y++)
-            for (x = 0; x < s->mb_width; x++, n++)
-                vc1_pack_bitplanes(bitplane, n, ff_bp, x, y, s->mb_stride);
-        if (n & 1) /* move last nibble to the high order */
-            bitplane[n/2] <<= 4;
-    }
-    return 0;
-}
-
-static int vaapi_vc1_end_frame(AVCodecContext *avctx)
-{
-    VC1Context * const v = avctx->priv_data;
-
-    return ff_vaapi_common_end_frame(&v->s);
-}
-
-static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size)
-{
-    VC1Context * const v = avctx->priv_data;
-    MpegEncContext * const s = &v->s;
-    VASliceParameterBufferVC1 *slice_param;
-
-    dprintf(avctx, "vaapi_vc1_decode_slice(): buffer %p, size %d\n", buffer, size);
-
-    /* Current bit buffer is beyond any marker for VC-1, so skip it */
-    if (avctx->codec_id == CODEC_ID_VC1 && IS_MARKER(AV_RB32(buffer))) {
-        buffer += 4;
-        size -= 4;
-    }
-
-    /* Fill in VASliceParameterBufferVC1 */
-    slice_param = (VASliceParameterBufferVC1 *)ff_vaapi_alloc_slice(avctx->hwaccel_context, buffer, size);
-    if (!slice_param)
-        return -1;
-    slice_param->macroblock_offset       = get_bits_count(&s->gb);
-    slice_param->slice_vertical_position = s->mb_y;
-    return 0;
-}
-
-#if CONFIG_WMV3_VAAPI_HWACCEL
-AVHWAccel wmv3_vaapi_hwaccel = {
-    .name           = "wmv3_vaapi",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_WMV3,
-    .pix_fmt        = PIX_FMT_VAAPI_VLD,
-    .capabilities   = 0,
-    .start_frame    = vaapi_vc1_start_frame,
-    .end_frame      = vaapi_vc1_end_frame,
-    .decode_slice   = vaapi_vc1_decode_slice,
-    .priv_data_size = 0,
-};
-#endif
-
-AVHWAccel vc1_vaapi_hwaccel = {
-    .name           = "vc1_vaapi",
-    .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_VC1,
-    .pix_fmt        = PIX_FMT_VAAPI_VLD,
-    .capabilities   = 0,
-    .start_frame    = vaapi_vc1_start_frame,
-    .end_frame      = vaapi_vc1_end_frame,
-    .decode_slice   = vaapi_vc1_decode_slice,
-    .priv_data_size = 0,
-};
diff --git a/libavcodec/vb.c b/libavcodec/vb.c
deleted file mode 100644
index 13c4b0a..0000000
--- a/libavcodec/vb.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Beam Software VB decoder
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VB Video decoder
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-enum VBFlags{
-    VB_HAS_GMC     = 0x01,
-    VB_HAS_AUDIO   = 0x04,
-    VB_HAS_VIDEO   = 0x08,
-    VB_HAS_PALETTE = 0x10,
-    VB_HAS_LENGTH  = 0x20
-};
-
-typedef struct VBDecContext {
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    uint8_t *frame, *prev_frame;
-    uint32_t pal[AVPALETTE_COUNT];
-    const uint8_t *stream;
-} VBDecContext;
-
-static const uint16_t vb_patterns[64] = {
-    0x0660, 0xFF00, 0xCCCC, 0xF000, 0x8888, 0x000F, 0x1111, 0xFEC8,
-    0x8CEF, 0x137F, 0xF731, 0xC800, 0x008C, 0x0013, 0x3100, 0xCC00,
-    0x00CC, 0x0033, 0x3300, 0x0FF0, 0x6666, 0x00F0, 0x0F00, 0x2222,
-    0x4444, 0xF600, 0x8CC8, 0x006F, 0x1331, 0x318C, 0xC813, 0x33CC,
-    0x6600, 0x0CC0, 0x0066, 0x0330, 0xF900, 0xC88C, 0x009F, 0x3113,
-    0x6000, 0x0880, 0x0006, 0x0110, 0xCC88, 0xFC00, 0x00CF, 0x88CC,
-    0x003F, 0x1133, 0x3311, 0xF300, 0x6FF6, 0x0603, 0x08C6, 0x8C63,
-    0xC631, 0x6310, 0xC060, 0x0136, 0x136C, 0x36C8, 0x6C80, 0x324C
-};
-
-static void vb_decode_palette(VBDecContext *c, int data_size)
-{
-    int start, size, i;
-
-    start = bytestream_get_byte(&c->stream);
-    size = (bytestream_get_byte(&c->stream) - 1) & 0xFF;
-    if(start + size > 255){
-        av_log(c->avctx, AV_LOG_ERROR, "Palette change runs beyond entry 256\n");
-        return;
-    }
-    if(size*3+2 > data_size){
-        av_log(c->avctx, AV_LOG_ERROR, "Palette data runs beyond chunk size\n");
-        return;
-    }
-    for(i = start; i <= start + size; i++)
-        c->pal[i] = bytestream_get_be24(&c->stream);
-}
-
-static inline int check_pixel(uint8_t *buf, uint8_t *start, uint8_t *end)
-{
-    return buf >= start && buf < end;
-}
-
-static inline int check_line(uint8_t *buf, uint8_t *start, uint8_t *end)
-{
-    return buf >= start && (buf + 4) <= end;
-}
-
-static int vb_decode_framedata(VBDecContext *c, const uint8_t *buf, int data_size, int offset)
-{
-    uint8_t *prev, *cur;
-    const uint8_t* data_end = buf + data_size;
-    int blk, blocks, t, blk2;
-    int blocktypes = 0;
-    int x, y, a, b;
-    int pattype, pattern;
-    const int width = c->avctx->width;
-    uint8_t *pstart = c->prev_frame;
-    uint8_t *pend = c->prev_frame + width*c->avctx->height;
-
-    prev = c->prev_frame + offset;
-    cur = c->frame;
-
-    blocks = (c->avctx->width >> 2) * (c->avctx->height >> 2);
-    blk2 = 0;
-    for(blk = 0; blk < blocks; blk++){
-        if(!(blk & 3)) {
-            if(buf >= data_end){
-                av_log(c->avctx, AV_LOG_ERROR, "Data pointer out of bounds\n");
-                return -1;
-            }
-            blocktypes = bytestream_get_byte(&buf);
-        }
-        switch(blocktypes & 0xC0){
-        case 0x00: //skip
-            for(y = 0; y < 4; y++)
-                if(check_line(prev + y*width, pstart, pend))
-                    memcpy(cur + y*width, prev + y*width, 4);
-                else
-                    memset(cur + y*width, 0, 4);
-            break;
-        case 0x40:
-            t = bytestream_get_byte(&buf);
-            if(!t){ //raw block
-                if(buf + 16 > data_end){
-                    av_log(c->avctx, AV_LOG_ERROR, "Insufficient data\n");
-                    return -1;
-                }
-                for(y = 0; y < 4; y++)
-                    memcpy(cur + y*width, buf + y*4, 4);
-                buf += 16;
-            }else{ // motion compensation
-                x = ((t & 0xF)^8) - 8;
-                y = ((t >> 4) ^8) - 8;
-                t = x + y*width;
-                for(y = 0; y < 4; y++)
-                    if(check_line(prev + t + y*width, pstart, pend))
-                        memcpy(cur + y*width, prev + t + y*width, 4);
-                    else
-                        memset(cur + y*width, 0, 4);
-            }
-            break;
-        case 0x80: // fill
-            t = bytestream_get_byte(&buf);
-            for(y = 0; y < 4; y++)
-                memset(cur + y*width, t, 4);
-            break;
-        case 0xC0: // pattern fill
-            if(buf + 2 > data_end){
-                av_log(c->avctx, AV_LOG_ERROR, "Insufficient data\n");
-                return -1;
-            }
-            t = bytestream_get_byte(&buf);
-            pattype = t >> 6;
-            pattern = vb_patterns[t & 0x3F];
-            switch(pattype){
-            case 0:
-                a = bytestream_get_byte(&buf);
-                b = bytestream_get_byte(&buf);
-                for(y = 0; y < 4; y++)
-                    for(x = 0; x < 4; x++, pattern >>= 1)
-                        cur[x + y*width] = (pattern & 1) ? b : a;
-                break;
-            case 1:
-                pattern = ~pattern;
-            case 2:
-                a = bytestream_get_byte(&buf);
-                for(y = 0; y < 4; y++)
-                    for(x = 0; x < 4; x++, pattern >>= 1)
-                        if(pattern & 1 && check_pixel(prev + x + y*width, pstart, pend))
-                            cur[x + y*width] = prev[x + y*width];
-                        else
-                            cur[x + y*width] = a;
-                break;
-            case 3:
-                av_log(c->avctx, AV_LOG_ERROR, "Invalid opcode seen @%d\n",blk);
-                return -1;
-            }
-            break;
-        }
-        blocktypes <<= 2;
-        cur  += 4;
-        prev += 4;
-        blk2++;
-        if(blk2 == (width >> 2)){
-            blk2 = 0;
-            cur  += width * 3;
-            prev += width * 3;
-        }
-    }
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VBDecContext * const c = avctx->priv_data;
-    uint8_t *outptr, *srcptr;
-    int i, j;
-    int flags;
-    uint32_t size;
-    int rest = buf_size;
-    int offset = 0;
-
-    if(c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    c->pic.reference = 1;
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    c->stream = buf;
-    flags = bytestream_get_le16(&c->stream);
-    rest -= 2;
-
-    if(flags & VB_HAS_GMC){
-        i = (int16_t)bytestream_get_le16(&c->stream);
-        j = (int16_t)bytestream_get_le16(&c->stream);
-        offset = i + j * avctx->width;
-        rest -= 4;
-    }
-    if(flags & VB_HAS_VIDEO){
-        size = bytestream_get_le32(&c->stream);
-        if(size > rest){
-            av_log(avctx, AV_LOG_ERROR, "Frame size is too big\n");
-            return -1;
-        }
-        vb_decode_framedata(c, c->stream, size, offset);
-        c->stream += size - 4;
-        rest -= size;
-    }
-    if(flags & VB_HAS_PALETTE){
-        size = bytestream_get_le32(&c->stream);
-        if(size > rest){
-            av_log(avctx, AV_LOG_ERROR, "Palette size is too big\n");
-            return -1;
-        }
-        vb_decode_palette(c, size);
-        rest -= size;
-    }
-
-    memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE);
-    c->pic.palette_has_changed = flags & VB_HAS_PALETTE;
-
-    outptr = c->pic.data[0];
-    srcptr = c->frame;
-
-    for(i = 0; i < avctx->height; i++){
-        memcpy(outptr, srcptr, avctx->width);
-        srcptr += avctx->width;
-        outptr += c->pic.linesize[0];
-    }
-
-    FFSWAP(uint8_t*, c->frame, c->prev_frame);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    VBDecContext * const c = avctx->priv_data;
-
-    c->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    c->frame      = av_mallocz(avctx->width * avctx->height);
-    c->prev_frame = av_mallocz(avctx->width * avctx->height);
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    VBDecContext *c = avctx->priv_data;
-
-    av_freep(&c->frame);
-    av_freep(&c->prev_frame);
-    if(c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-
-    return 0;
-}
-
-AVCodec vb_decoder = {
-    "vb",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VB,
-    sizeof(VBDecContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"),
-};
-
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
deleted file mode 100644
index 7d00072..0000000
--- a/libavcodec/vc1.c
+++ /dev/null
@@ -1,1033 +0,0 @@
-/*
- * VC-1 and WMV3 decoder common code
- * Copyright (c) 2006-2007 Konstantin Shishkov
- * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VC-1 and WMV3 decoder common code
- *
- */
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "vc1.h"
-#include "vc1data.h"
-#include "msmpeg4data.h"
-#include "unary.h"
-#include "simple_idct.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-/***********************************************************************/
-/**
- * @defgroup vc1bitplane VC-1 Bitplane decoding
- * @see 8.7, p56
- * @{
- */
-
-/**
- * Imode types
- * @{
- */
-enum Imode {
-    IMODE_RAW,
-    IMODE_NORM2,
-    IMODE_DIFF2,
-    IMODE_NORM6,
-    IMODE_DIFF6,
-    IMODE_ROWSKIP,
-    IMODE_COLSKIP
-};
-/** @} */ //imode defines
-
-/** Decode rows by checking if they are skipped
- * @param plane Buffer to store decoded bits
- * @param[in] width Width of this buffer
- * @param[in] height Height of this buffer
- * @param[in] stride of this buffer
- */
-static void decode_rowskip(uint8_t* plane, int width, int height, int stride, GetBitContext *gb){
-    int x, y;
-
-    for (y=0; y<height; y++){
-        if (!get_bits1(gb)) //rowskip
-            memset(plane, 0, width);
-        else
-            for (x=0; x<width; x++)
-                plane[x] = get_bits1(gb);
-        plane += stride;
-    }
-}
-
-/** Decode columns by checking if they are skipped
- * @param plane Buffer to store decoded bits
- * @param[in] width Width of this buffer
- * @param[in] height Height of this buffer
- * @param[in] stride of this buffer
- * @todo FIXME: Optimize
- */
-static void decode_colskip(uint8_t* plane, int width, int height, int stride, GetBitContext *gb){
-    int x, y;
-
-    for (x=0; x<width; x++){
-        if (!get_bits1(gb)) //colskip
-            for (y=0; y<height; y++)
-                plane[y*stride] = 0;
-        else
-            for (y=0; y<height; y++)
-                plane[y*stride] = get_bits1(gb);
-        plane ++;
-    }
-}
-
-/** Decode a bitplane's bits
- * @param data bitplane where to store the decode bits
- * @param[out] raw_flag pointer to the flag indicating that this bitplane is not coded explicitly
- * @param v VC-1 context for bit reading and logging
- * @return Status
- * @todo FIXME: Optimize
- */
-static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
-{
-    GetBitContext *gb = &v->s.gb;
-
-    int imode, x, y, code, offset;
-    uint8_t invert, *planep = data;
-    int width, height, stride;
-
-    width = v->s.mb_width;
-    height = v->s.mb_height;
-    stride = v->s.mb_stride;
-    invert = get_bits1(gb);
-    imode = get_vlc2(gb, ff_vc1_imode_vlc.table, VC1_IMODE_VLC_BITS, 1);
-
-    *raw_flag = 0;
-    switch (imode)
-    {
-    case IMODE_RAW:
-        //Data is actually read in the MB layer (same for all tests == "raw")
-        *raw_flag = 1; //invert ignored
-        return invert;
-    case IMODE_DIFF2:
-    case IMODE_NORM2:
-        if ((height * width) & 1)
-        {
-            *planep++ = get_bits1(gb);
-            offset = 1;
-        }
-        else offset = 0;
-        // decode bitplane as one long line
-        for (y = offset; y < height * width; y += 2) {
-            code = get_vlc2(gb, ff_vc1_norm2_vlc.table, VC1_NORM2_VLC_BITS, 1);
-            *planep++ = code & 1;
-            offset++;
-            if(offset == width) {
-                offset = 0;
-                planep += stride - width;
-            }
-            *planep++ = code >> 1;
-            offset++;
-            if(offset == width) {
-                offset = 0;
-                planep += stride - width;
-            }
-        }
-        break;
-    case IMODE_DIFF6:
-    case IMODE_NORM6:
-        if(!(height % 3) && (width % 3)) { // use 2x3 decoding
-            for(y = 0; y < height; y+= 3) {
-                for(x = width & 1; x < width; x += 2) {
-                    code = get_vlc2(gb, ff_vc1_norm6_vlc.table, VC1_NORM6_VLC_BITS, 2);
-                    if(code < 0){
-                        av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
-                        return -1;
-                    }
-                    planep[x + 0] = (code >> 0) & 1;
-                    planep[x + 1] = (code >> 1) & 1;
-                    planep[x + 0 + stride] = (code >> 2) & 1;
-                    planep[x + 1 + stride] = (code >> 3) & 1;
-                    planep[x + 0 + stride * 2] = (code >> 4) & 1;
-                    planep[x + 1 + stride * 2] = (code >> 5) & 1;
-                }
-                planep += stride * 3;
-            }
-            if(width & 1) decode_colskip(data, 1, height, stride, &v->s.gb);
-        } else { // 3x2
-            planep += (height & 1) * stride;
-            for(y = height & 1; y < height; y += 2) {
-                for(x = width % 3; x < width; x += 3) {
-                    code = get_vlc2(gb, ff_vc1_norm6_vlc.table, VC1_NORM6_VLC_BITS, 2);
-                    if(code < 0){
-                        av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
-                        return -1;
-                    }
-                    planep[x + 0] = (code >> 0) & 1;
-                    planep[x + 1] = (code >> 1) & 1;
-                    planep[x + 2] = (code >> 2) & 1;
-                    planep[x + 0 + stride] = (code >> 3) & 1;
-                    planep[x + 1 + stride] = (code >> 4) & 1;
-                    planep[x + 2 + stride] = (code >> 5) & 1;
-                }
-                planep += stride * 2;
-            }
-            x = width % 3;
-            if(x) decode_colskip(data  ,             x, height    , stride, &v->s.gb);
-            if(height & 1) decode_rowskip(data+x, width - x, 1, stride, &v->s.gb);
-        }
-        break;
-    case IMODE_ROWSKIP:
-        decode_rowskip(data, width, height, stride, &v->s.gb);
-        break;
-    case IMODE_COLSKIP:
-        decode_colskip(data, width, height, stride, &v->s.gb);
-        break;
-    default: break;
-    }
-
-    /* Applying diff operator */
-    if (imode == IMODE_DIFF2 || imode == IMODE_DIFF6)
-    {
-        planep = data;
-        planep[0] ^= invert;
-        for (x=1; x<width; x++)
-            planep[x] ^= planep[x-1];
-        for (y=1; y<height; y++)
-        {
-            planep += stride;
-            planep[0] ^= planep[-stride];
-            for (x=1; x<width; x++)
-            {
-                if (planep[x-1] != planep[x-stride]) planep[x] ^= invert;
-                else                                 planep[x] ^= planep[x-1];
-            }
-        }
-    }
-    else if (invert)
-    {
-        planep = data;
-        for (x=0; x<stride*height; x++) planep[x] = !planep[x]; //FIXME stride
-    }
-    return (imode<<1) + invert;
-}
-
-/** @} */ //Bitplane group
-
-/***********************************************************************/
-/** VOP Dquant decoding
- * @param v VC-1 Context
- */
-static int vop_dquant_decoding(VC1Context *v)
-{
-    GetBitContext *gb = &v->s.gb;
-    int pqdiff;
-
-    //variable size
-    if (v->dquant == 2)
-    {
-        pqdiff = get_bits(gb, 3);
-        if (pqdiff == 7) v->altpq = get_bits(gb, 5);
-        else v->altpq = v->pq + pqdiff + 1;
-    }
-    else
-    {
-        v->dquantfrm = get_bits1(gb);
-        if ( v->dquantfrm )
-        {
-            v->dqprofile = get_bits(gb, 2);
-            switch (v->dqprofile)
-            {
-            case DQPROFILE_SINGLE_EDGE:
-            case DQPROFILE_DOUBLE_EDGES:
-                v->dqsbedge = get_bits(gb, 2);
-                break;
-            case DQPROFILE_ALL_MBS:
-                v->dqbilevel = get_bits1(gb);
-                if(!v->dqbilevel)
-                    v->halfpq = 0;
-            default: break; //Forbidden ?
-            }
-            if (v->dqbilevel || v->dqprofile != DQPROFILE_ALL_MBS)
-            {
-                pqdiff = get_bits(gb, 3);
-                if (pqdiff == 7) v->altpq = get_bits(gb, 5);
-                else v->altpq = v->pq + pqdiff + 1;
-            }
-        }
-    }
-    return 0;
-}
-
-static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb);
-
-/**
- * Decode Simple/Main Profiles sequence header
- * @see Figure 7-8, p16-17
- * @param avctx Codec context
- * @param gb GetBit context initialized from Codec context extra_data
- * @return Status
- */
-int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
-{
-    av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits(gb, 32));
-    v->profile = get_bits(gb, 2);
-    if (v->profile == PROFILE_COMPLEX)
-    {
-        av_log(avctx, AV_LOG_ERROR, "WMV3 Complex Profile is not fully supported\n");
-    }
-
-    if (v->profile == PROFILE_ADVANCED)
-    {
-        v->zz_8x4 = ff_vc1_adv_progressive_8x4_zz;
-        v->zz_4x8 = ff_vc1_adv_progressive_4x8_zz;
-        return decode_sequence_header_adv(v, gb);
-    }
-    else
-    {
-        v->zz_8x4 = wmv2_scantableA;
-        v->zz_4x8 = wmv2_scantableB;
-        v->res_sm = get_bits(gb, 2); //reserved
-        if (v->res_sm)
-        {
-            av_log(avctx, AV_LOG_ERROR,
-                   "Reserved RES_SM=%i is forbidden\n", v->res_sm);
-            return -1;
-        }
-    }
-
-    // (fps-2)/4 (->30)
-    v->frmrtq_postproc = get_bits(gb, 3); //common
-    // (bitrate-32kbps)/64kbps
-    v->bitrtq_postproc = get_bits(gb, 5); //common
-    v->s.loop_filter = get_bits1(gb); //common
-    if(v->s.loop_filter == 1 && v->profile == PROFILE_SIMPLE)
-    {
-        av_log(avctx, AV_LOG_ERROR,
-               "LOOPFILTER shall not be enabled in Simple Profile\n");
-    }
-    if(v->s.avctx->skip_loop_filter >= AVDISCARD_ALL)
-        v->s.loop_filter = 0;
-
-    v->res_x8 = get_bits1(gb); //reserved
-    v->multires = get_bits1(gb);
-    v->res_fasttx = get_bits1(gb);
-    if (!v->res_fasttx)
-    {
-        v->s.dsp.vc1_inv_trans_8x8 = ff_simple_idct;
-        v->s.dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
-        v->s.dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;
-        v->s.dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;
-        v->s.dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add;
-        v->s.dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add;
-        v->s.dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add;
-        v->s.dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add;
-    }
-
-    v->fastuvmc =  get_bits1(gb); //common
-    if (!v->profile && !v->fastuvmc)
-    {
-        av_log(avctx, AV_LOG_ERROR,
-               "FASTUVMC unavailable in Simple Profile\n");
-        return -1;
-    }
-    v->extended_mv =  get_bits1(gb); //common
-    if (!v->profile && v->extended_mv)
-    {
-        av_log(avctx, AV_LOG_ERROR,
-               "Extended MVs unavailable in Simple Profile\n");
-        return -1;
-    }
-    v->dquant =  get_bits(gb, 2); //common
-    v->vstransform =  get_bits1(gb); //common
-
-    v->res_transtab = get_bits1(gb);
-    if (v->res_transtab)
-    {
-        av_log(avctx, AV_LOG_ERROR,
-               "1 for reserved RES_TRANSTAB is forbidden\n");
-        return -1;
-    }
-
-    v->overlap = get_bits1(gb); //common
-
-    v->s.resync_marker = get_bits1(gb);
-    v->rangered = get_bits1(gb);
-    if (v->rangered && v->profile == PROFILE_SIMPLE)
-    {
-        av_log(avctx, AV_LOG_INFO,
-               "RANGERED should be set to 0 in Simple Profile\n");
-    }
-
-    v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common
-    v->quantizer_mode = get_bits(gb, 2); //common
-
-    v->finterpflag = get_bits1(gb); //common
-    v->res_rtm_flag = get_bits1(gb); //reserved
-    if (!v->res_rtm_flag)
-    {
-//            av_log(avctx, AV_LOG_ERROR,
-//                   "0 for reserved RES_RTM_FLAG is forbidden\n");
-        av_log(avctx, AV_LOG_ERROR,
-               "Old WMV3 version detected, only I-frames will be decoded\n");
-        //return -1;
-    }
-    //TODO: figure out what they mean (always 0x402F)
-    if(!v->res_fasttx) skip_bits(gb, 16);
-    av_log(avctx, AV_LOG_DEBUG,
-               "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
-               "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n"
-               "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
-               "DQuant=%i, Quantizer mode=%i, Max B frames=%i\n",
-               v->profile, v->frmrtq_postproc, v->bitrtq_postproc,
-               v->s.loop_filter, v->multires, v->fastuvmc, v->extended_mv,
-               v->rangered, v->vstransform, v->overlap, v->s.resync_marker,
-               v->dquant, v->quantizer_mode, avctx->max_b_frames
-               );
-    return 0;
-}
-
-static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
-{
-    v->res_rtm_flag = 1;
-    v->level = get_bits(gb, 3);
-    if(v->level >= 5)
-    {
-        av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level);
-    }
-    v->chromaformat = get_bits(gb, 2);
-    if (v->chromaformat != 1)
-    {
-        av_log(v->s.avctx, AV_LOG_ERROR,
-               "Only 4:2:0 chroma format supported\n");
-        return -1;
-    }
-
-    // (fps-2)/4 (->30)
-    v->frmrtq_postproc = get_bits(gb, 3); //common
-    // (bitrate-32kbps)/64kbps
-    v->bitrtq_postproc = get_bits(gb, 5); //common
-    v->postprocflag = get_bits1(gb); //common
-
-    v->s.avctx->coded_width = (get_bits(gb, 12) + 1) << 1;
-    v->s.avctx->coded_height = (get_bits(gb, 12) + 1) << 1;
-    v->s.avctx->width = v->s.avctx->coded_width;
-    v->s.avctx->height = v->s.avctx->coded_height;
-    v->broadcast = get_bits1(gb);
-    v->interlace = get_bits1(gb);
-    v->tfcntrflag = get_bits1(gb);
-    v->finterpflag = get_bits1(gb);
-    skip_bits1(gb); // reserved
-
-    v->s.h_edge_pos = v->s.avctx->coded_width;
-    v->s.v_edge_pos = v->s.avctx->coded_height;
-
-    av_log(v->s.avctx, AV_LOG_DEBUG,
-               "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
-               "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n"
-               "TFCTRflag=%i, FINTERPflag=%i\n",
-               v->level, v->frmrtq_postproc, v->bitrtq_postproc,
-               v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace,
-               v->tfcntrflag, v->finterpflag
-               );
-
-    v->psf = get_bits1(gb);
-    if(v->psf) { //PsF, 6.1.13
-        av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n");
-        return -1;
-    }
-    v->s.max_b_frames = v->s.avctx->max_b_frames = 7;
-    if(get_bits1(gb)) { //Display Info - decoding is not affected by it
-        int w, h, ar = 0;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n");
-        v->s.avctx->width  = w = get_bits(gb, 14) + 1;
-        v->s.avctx->height = h = get_bits(gb, 14) + 1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h);
-        if(get_bits1(gb))
-            ar = get_bits(gb, 4);
-        if(ar && ar < 14){
-            v->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[ar];
-        }else if(ar == 15){
-            w = get_bits(gb, 8);
-            h = get_bits(gb, 8);
-            v->s.avctx->sample_aspect_ratio = (AVRational){w, h};
-        }
-        av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n", v->s.avctx->sample_aspect_ratio.num, v->s.avctx->sample_aspect_ratio.den);
-
-        if(get_bits1(gb)){ //framerate stuff
-            if(get_bits1(gb)) {
-                v->s.avctx->time_base.num = 32;
-                v->s.avctx->time_base.den = get_bits(gb, 16) + 1;
-            } else {
-                int nr, dr;
-                nr = get_bits(gb, 8);
-                dr = get_bits(gb, 4);
-                if(nr && nr < 8 && dr && dr < 3){
-                    v->s.avctx->time_base.num = ff_vc1_fps_dr[dr - 1];
-                    v->s.avctx->time_base.den = ff_vc1_fps_nr[nr - 1] * 1000;
-                }
-            }
-        }
-
-        if(get_bits1(gb)){
-            v->color_prim = get_bits(gb, 8);
-            v->transfer_char = get_bits(gb, 8);
-            v->matrix_coef = get_bits(gb, 8);
-        }
-    }
-
-    v->hrd_param_flag = get_bits1(gb);
-    if(v->hrd_param_flag) {
-        int i;
-        v->hrd_num_leaky_buckets = get_bits(gb, 5);
-        skip_bits(gb, 4); //bitrate exponent
-        skip_bits(gb, 4); //buffer size exponent
-        for(i = 0; i < v->hrd_num_leaky_buckets; i++) {
-            skip_bits(gb, 16); //hrd_rate[n]
-            skip_bits(gb, 16); //hrd_buffer[n]
-        }
-    }
-    return 0;
-}
-
-int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
-{
-    int i;
-
-    av_log(avctx, AV_LOG_DEBUG, "Entry point: %08X\n", show_bits_long(gb, 32));
-    v->broken_link = get_bits1(gb);
-    v->closed_entry = get_bits1(gb);
-    v->panscanflag = get_bits1(gb);
-    v->refdist_flag = get_bits1(gb);
-    v->s.loop_filter = get_bits1(gb);
-    v->fastuvmc = get_bits1(gb);
-    v->extended_mv = get_bits1(gb);
-    v->dquant = get_bits(gb, 2);
-    v->vstransform = get_bits1(gb);
-    v->overlap = get_bits1(gb);
-    v->quantizer_mode = get_bits(gb, 2);
-
-    if(v->hrd_param_flag){
-        for(i = 0; i < v->hrd_num_leaky_buckets; i++) {
-            skip_bits(gb, 8); //hrd_full[n]
-        }
-    }
-
-    if(get_bits1(gb)){
-        avctx->coded_width = (get_bits(gb, 12)+1)<<1;
-        avctx->coded_height = (get_bits(gb, 12)+1)<<1;
-    }
-    if(v->extended_mv)
-        v->extended_dmv = get_bits1(gb);
-    if((v->range_mapy_flag = get_bits1(gb))) {
-        av_log(avctx, AV_LOG_ERROR, "Luma scaling is not supported, expect wrong picture\n");
-        v->range_mapy = get_bits(gb, 3);
-    }
-    if((v->range_mapuv_flag = get_bits1(gb))) {
-        av_log(avctx, AV_LOG_ERROR, "Chroma scaling is not supported, expect wrong picture\n");
-        v->range_mapuv = get_bits(gb, 3);
-    }
-
-    av_log(avctx, AV_LOG_DEBUG, "Entry point info:\n"
-        "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n"
-        "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n"
-        "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n",
-        v->broken_link, v->closed_entry, v->panscanflag, v->refdist_flag, v->s.loop_filter,
-        v->fastuvmc, v->extended_mv, v->dquant, v->vstransform, v->overlap, v->quantizer_mode);
-
-    return 0;
-}
-
-int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
-{
-    int pqindex, lowquant, status;
-
-    if(v->finterpflag) v->interpfrm = get_bits1(gb);
-    skip_bits(gb, 2); //framecnt unused
-    v->rangeredfrm = 0;
-    if (v->rangered) v->rangeredfrm = get_bits1(gb);
-    v->s.pict_type = get_bits1(gb);
-    if (v->s.avctx->max_b_frames) {
-        if (!v->s.pict_type) {
-            if (get_bits1(gb)) v->s.pict_type = FF_I_TYPE;
-            else v->s.pict_type = FF_B_TYPE;
-        } else v->s.pict_type = FF_P_TYPE;
-    } else v->s.pict_type = v->s.pict_type ? FF_P_TYPE : FF_I_TYPE;
-
-    v->bi_type = 0;
-    if(v->s.pict_type == FF_B_TYPE) {
-        v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
-        v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index];
-        if(v->bfraction == 0) {
-            v->s.pict_type = FF_BI_TYPE;
-        }
-    }
-    if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
-        skip_bits(gb, 7); // skip buffer fullness
-
-    if(v->parse_only)
-        return 0;
-
-    /* calculate RND */
-    if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
-        v->rnd = 1;
-    if(v->s.pict_type == FF_P_TYPE)
-        v->rnd ^= 1;
-
-    /* Quantizer stuff */
-    pqindex = get_bits(gb, 5);
-    if(!pqindex) return -1;
-    if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
-        v->pq = ff_vc1_pquant_table[0][pqindex];
-    else
-        v->pq = ff_vc1_pquant_table[1][pqindex];
-
-    v->pquantizer = 1;
-    if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
-        v->pquantizer = pqindex < 9;
-    if (v->quantizer_mode == QUANT_NON_UNIFORM)
-        v->pquantizer = 0;
-    v->pqindex = pqindex;
-    if (pqindex < 9) v->halfpq = get_bits1(gb);
-    else v->halfpq = 0;
-    if (v->quantizer_mode == QUANT_FRAME_EXPLICIT)
-        v->pquantizer = get_bits1(gb);
-    v->dquantfrm = 0;
-    if (v->extended_mv == 1) v->mvrange = get_unary(gb, 0, 3);
-    v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
-    v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
-    v->range_x = 1 << (v->k_x - 1);
-    v->range_y = 1 << (v->k_y - 1);
-    if (v->multires && v->s.pict_type != FF_B_TYPE) v->respic = get_bits(gb, 2);
-
-    if(v->res_x8 && (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)){
-        v->x8_type = get_bits1(gb);
-    }else v->x8_type = 0;
-//av_log(v->s.avctx, AV_LOG_INFO, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
-//        (v->s.pict_type == FF_P_TYPE) ? 'P' : ((v->s.pict_type == FF_I_TYPE) ? 'I' : 'B'), pqindex, v->pq, v->halfpq, v->rangeredfrm);
-
-    if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_P_TYPE) v->use_ic = 0;
-
-    switch(v->s.pict_type) {
-    case FF_P_TYPE:
-        if (v->pq < 5) v->tt_index = 0;
-        else if(v->pq < 13) v->tt_index = 1;
-        else v->tt_index = 2;
-
-        lowquant = (v->pq > 12) ? 0 : 1;
-        v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)];
-        if (v->mv_mode == MV_PMODE_INTENSITY_COMP)
-        {
-            int scale, shift, i;
-            v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)];
-            v->lumscale = get_bits(gb, 6);
-            v->lumshift = get_bits(gb, 6);
-            v->use_ic = 1;
-            /* fill lookup tables for intensity compensation */
-            if(!v->lumscale) {
-                scale = -64;
-                shift = (255 - v->lumshift * 2) << 6;
-                if(v->lumshift > 31)
-                    shift += 128 << 6;
-            } else {
-                scale = v->lumscale + 32;
-                if(v->lumshift > 31)
-                    shift = (v->lumshift - 64) << 6;
-                else
-                    shift = v->lumshift << 6;
-            }
-            for(i = 0; i < 256; i++) {
-                v->luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6);
-                v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6);
-            }
-        }
-        if(v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN)
-            v->s.quarter_sample = 0;
-        else if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
-            if(v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)
-                v->s.quarter_sample = 0;
-            else
-                v->s.quarter_sample = 1;
-        } else
-            v->s.quarter_sample = 1;
-        v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN));
-
-        if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
-                 v->mv_mode2 == MV_PMODE_MIXED_MV)
-                || v->mv_mode == MV_PMODE_MIXED_MV)
-        {
-            status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v);
-            if (status < 0) return -1;
-            av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
-                   "Imode: %i, Invert: %i\n", status>>1, status&1);
-        } else {
-            v->mv_type_is_raw = 0;
-            memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
-        }
-        status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
-        if (status < 0) return -1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
-               "Imode: %i, Invert: %i\n", status>>1, status&1);
-
-        /* Hopefully this is correct for P frames */
-        v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
-        v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
-
-        if (v->dquant)
-        {
-            av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
-            vop_dquant_decoding(v);
-        }
-
-        v->ttfrm = 0; //FIXME Is that so ?
-        if (v->vstransform)
-        {
-            v->ttmbf = get_bits1(gb);
-            if (v->ttmbf)
-            {
-                v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
-            }
-        } else {
-            v->ttmbf = 1;
-            v->ttfrm = TT_8X8;
-        }
-        break;
-    case FF_B_TYPE:
-        if (v->pq < 5) v->tt_index = 0;
-        else if(v->pq < 13) v->tt_index = 1;
-        else v->tt_index = 2;
-
-        v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN;
-        v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
-        v->s.mspel = v->s.quarter_sample;
-
-        status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v);
-        if (status < 0) return -1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
-               "Imode: %i, Invert: %i\n", status>>1, status&1);
-        status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
-        if (status < 0) return -1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
-               "Imode: %i, Invert: %i\n", status>>1, status&1);
-
-        v->s.mv_table_index = get_bits(gb, 2);
-        v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
-
-        if (v->dquant)
-        {
-            av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
-            vop_dquant_decoding(v);
-        }
-
-        v->ttfrm = 0;
-        if (v->vstransform)
-        {
-            v->ttmbf = get_bits1(gb);
-            if (v->ttmbf)
-            {
-                v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
-            }
-        } else {
-            v->ttmbf = 1;
-            v->ttfrm = TT_8X8;
-        }
-        break;
-    }
-
-    if(!v->x8_type)
-    {
-        /* AC Syntax */
-        v->c_ac_table_index = decode012(gb);
-        if (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
-        {
-            v->y_ac_table_index = decode012(gb);
-        }
-        /* DC Syntax */
-        v->s.dc_table_index = get_bits1(gb);
-    }
-
-    if(v->s.pict_type == FF_BI_TYPE) {
-        v->s.pict_type = FF_B_TYPE;
-        v->bi_type = 1;
-    }
-    return 0;
-}
-
-int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
-{
-    int pqindex, lowquant;
-    int status;
-
-    v->p_frame_skipped = 0;
-
-    if(v->interlace){
-        v->fcm = decode012(gb);
-        if(v->fcm){
-            if(!v->warn_interlaced++)
-                av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced frames/fields support is not implemented\n");
-            return -1;
-        }
-    }
-    switch(get_unary(gb, 0, 4)) {
-    case 0:
-        v->s.pict_type = FF_P_TYPE;
-        break;
-    case 1:
-        v->s.pict_type = FF_B_TYPE;
-        break;
-    case 2:
-        v->s.pict_type = FF_I_TYPE;
-        break;
-    case 3:
-        v->s.pict_type = FF_BI_TYPE;
-        break;
-    case 4:
-        v->s.pict_type = FF_P_TYPE; // skipped pic
-        v->p_frame_skipped = 1;
-        return 0;
-    }
-    if(v->tfcntrflag)
-        skip_bits(gb, 8);
-    if(v->broadcast) {
-        if(!v->interlace || v->psf) {
-            v->rptfrm = get_bits(gb, 2);
-        } else {
-            v->tff = get_bits1(gb);
-            v->rptfrm = get_bits1(gb);
-        }
-    }
-    if(v->panscanflag) {
-        //...
-    }
-    v->rnd = get_bits1(gb);
-    if(v->interlace)
-        v->uvsamp = get_bits1(gb);
-    if(v->finterpflag) v->interpfrm = get_bits1(gb);
-    if(v->s.pict_type == FF_B_TYPE) {
-        v->bfraction_lut_index = get_vlc2(gb, ff_vc1_bfraction_vlc.table, VC1_BFRACTION_VLC_BITS, 1);
-        v->bfraction = ff_vc1_bfraction_lut[v->bfraction_lut_index];
-        if(v->bfraction == 0) {
-            v->s.pict_type = FF_BI_TYPE; /* XXX: should not happen here */
-        }
-    }
-    pqindex = get_bits(gb, 5);
-    if(!pqindex) return -1;
-    v->pqindex = pqindex;
-    if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
-        v->pq = ff_vc1_pquant_table[0][pqindex];
-    else
-        v->pq = ff_vc1_pquant_table[1][pqindex];
-
-    v->pquantizer = 1;
-    if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
-        v->pquantizer = pqindex < 9;
-    if (v->quantizer_mode == QUANT_NON_UNIFORM)
-        v->pquantizer = 0;
-    v->pqindex = pqindex;
-    if (pqindex < 9) v->halfpq = get_bits1(gb);
-    else v->halfpq = 0;
-    if (v->quantizer_mode == QUANT_FRAME_EXPLICIT)
-        v->pquantizer = get_bits1(gb);
-    if(v->postprocflag)
-        v->postproc = get_bits(gb, 2);
-
-    if(v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_P_TYPE) v->use_ic = 0;
-
-    if(v->parse_only)
-        return 0;
-
-    switch(v->s.pict_type) {
-    case FF_I_TYPE:
-    case FF_BI_TYPE:
-        status = bitplane_decoding(v->acpred_plane, &v->acpred_is_raw, v);
-        if (status < 0) return -1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: "
-                "Imode: %i, Invert: %i\n", status>>1, status&1);
-        v->condover = CONDOVER_NONE;
-        if(v->overlap && v->pq <= 8) {
-            v->condover = decode012(gb);
-            if(v->condover == CONDOVER_SELECT) {
-                status = bitplane_decoding(v->over_flags_plane, &v->overflg_is_raw, v);
-                if (status < 0) return -1;
-                av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: "
-                        "Imode: %i, Invert: %i\n", status>>1, status&1);
-            }
-        }
-        break;
-    case FF_P_TYPE:
-        if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3);
-        else v->mvrange = 0;
-        v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
-        v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
-        v->range_x = 1 << (v->k_x - 1);
-        v->range_y = 1 << (v->k_y - 1);
-
-        if (v->pq < 5) v->tt_index = 0;
-        else if(v->pq < 13) v->tt_index = 1;
-        else v->tt_index = 2;
-
-        lowquant = (v->pq > 12) ? 0 : 1;
-        v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)];
-        if (v->mv_mode == MV_PMODE_INTENSITY_COMP)
-        {
-            int scale, shift, i;
-            v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)];
-            v->lumscale = get_bits(gb, 6);
-            v->lumshift = get_bits(gb, 6);
-            /* fill lookup tables for intensity compensation */
-            if(!v->lumscale) {
-                scale = -64;
-                shift = (255 - v->lumshift * 2) << 6;
-                if(v->lumshift > 31)
-                    shift += 128 << 6;
-            } else {
-                scale = v->lumscale + 32;
-                if(v->lumshift > 31)
-                    shift = (v->lumshift - 64) << 6;
-                else
-                    shift = v->lumshift << 6;
-            }
-            for(i = 0; i < 256; i++) {
-                v->luty[i] = av_clip_uint8((scale * i + shift + 32) >> 6);
-                v->lutuv[i] = av_clip_uint8((scale * (i - 128) + 128*64 + 32) >> 6);
-            }
-            v->use_ic = 1;
-        }
-        if(v->mv_mode == MV_PMODE_1MV_HPEL || v->mv_mode == MV_PMODE_1MV_HPEL_BILIN)
-            v->s.quarter_sample = 0;
-        else if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
-            if(v->mv_mode2 == MV_PMODE_1MV_HPEL || v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN)
-                v->s.quarter_sample = 0;
-            else
-                v->s.quarter_sample = 1;
-        } else
-            v->s.quarter_sample = 1;
-        v->s.mspel = !(v->mv_mode == MV_PMODE_1MV_HPEL_BILIN || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_1MV_HPEL_BILIN));
-
-        if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
-                 v->mv_mode2 == MV_PMODE_MIXED_MV)
-                || v->mv_mode == MV_PMODE_MIXED_MV)
-        {
-            status = bitplane_decoding(v->mv_type_mb_plane, &v->mv_type_is_raw, v);
-            if (status < 0) return -1;
-            av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
-                   "Imode: %i, Invert: %i\n", status>>1, status&1);
-        } else {
-            v->mv_type_is_raw = 0;
-            memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
-        }
-        status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
-        if (status < 0) return -1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
-               "Imode: %i, Invert: %i\n", status>>1, status&1);
-
-        /* Hopefully this is correct for P frames */
-        v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
-        v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
-        if (v->dquant)
-        {
-            av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
-            vop_dquant_decoding(v);
-        }
-
-        v->ttfrm = 0; //FIXME Is that so ?
-        if (v->vstransform)
-        {
-            v->ttmbf = get_bits1(gb);
-            if (v->ttmbf)
-            {
-                v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
-            }
-        } else {
-            v->ttmbf = 1;
-            v->ttfrm = TT_8X8;
-        }
-        break;
-    case FF_B_TYPE:
-        if (v->extended_mv) v->mvrange = get_unary(gb, 0, 3);
-        else v->mvrange = 0;
-        v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
-        v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
-        v->range_x = 1 << (v->k_x - 1);
-        v->range_y = 1 << (v->k_y - 1);
-
-        if (v->pq < 5) v->tt_index = 0;
-        else if(v->pq < 13) v->tt_index = 1;
-        else v->tt_index = 2;
-
-        v->mv_mode = get_bits1(gb) ? MV_PMODE_1MV : MV_PMODE_1MV_HPEL_BILIN;
-        v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
-        v->s.mspel = v->s.quarter_sample;
-
-        status = bitplane_decoding(v->direct_mb_plane, &v->dmb_is_raw, v);
-        if (status < 0) return -1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
-               "Imode: %i, Invert: %i\n", status>>1, status&1);
-        status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v);
-        if (status < 0) return -1;
-        av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
-               "Imode: %i, Invert: %i\n", status>>1, status&1);
-
-        v->s.mv_table_index = get_bits(gb, 2);
-        v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)];
-
-        if (v->dquant)
-        {
-            av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
-            vop_dquant_decoding(v);
-        }
-
-        v->ttfrm = 0;
-        if (v->vstransform)
-        {
-            v->ttmbf = get_bits1(gb);
-            if (v->ttmbf)
-            {
-                v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
-            }
-        } else {
-            v->ttmbf = 1;
-            v->ttfrm = TT_8X8;
-        }
-        break;
-    }
-
-    /* AC Syntax */
-    v->c_ac_table_index = decode012(gb);
-    if (v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE)
-    {
-        v->y_ac_table_index = decode012(gb);
-    }
-    /* DC Syntax */
-    v->s.dc_table_index = get_bits1(gb);
-    if ((v->s.pict_type == FF_I_TYPE || v->s.pict_type == FF_BI_TYPE) && v->dquant) {
-        av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
-        vop_dquant_decoding(v);
-    }
-
-    v->bi_type = 0;
-    if(v->s.pict_type == FF_BI_TYPE) {
-        v->s.pict_type = FF_B_TYPE;
-        v->bi_type = 1;
-    }
-    return 0;
-}
diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h
deleted file mode 100644
index d5f0e05..0000000
--- a/libavcodec/vc1.h
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * VC-1 and WMV3 decoder
- * Copyright (c) 2006-2007 Konstantin Shishkov
- * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VC1_H
-#define AVCODEC_VC1_H
-
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "intrax8.h"
-
-/** Markers used in VC-1 AP frame data */
-//@{
-enum VC1Code{
-    VC1_CODE_RES0       = 0x00000100,
-    VC1_CODE_ENDOFSEQ   = 0x0000010A,
-    VC1_CODE_SLICE,
-    VC1_CODE_FIELD,
-    VC1_CODE_FRAME,
-    VC1_CODE_ENTRYPOINT,
-    VC1_CODE_SEQHDR,
-};
-//@}
-
-#define IS_MARKER(x) (((x) & ~0xFF) == VC1_CODE_RES0)
-
-/** Available Profiles */
-//@{
-enum Profile {
-    PROFILE_SIMPLE,
-    PROFILE_MAIN,
-    PROFILE_COMPLEX, ///< TODO: WMV9 specific
-    PROFILE_ADVANCED
-};
-//@}
-
-/** Sequence quantizer mode */
-//@{
-enum QuantMode {
-    QUANT_FRAME_IMPLICIT,    ///< Implicitly specified at frame level
-    QUANT_FRAME_EXPLICIT,    ///< Explicitly specified at frame level
-    QUANT_NON_UNIFORM,       ///< Non-uniform quant used for all frames
-    QUANT_UNIFORM            ///< Uniform quant used for all frames
-};
-//@}
-
-/** Where quant can be changed */
-//@{
-enum DQProfile {
-    DQPROFILE_FOUR_EDGES,
-    DQPROFILE_DOUBLE_EDGES,
-    DQPROFILE_SINGLE_EDGE,
-    DQPROFILE_ALL_MBS
-};
-//@}
-
-/** @name Where quant can be changed
- */
-//@{
-enum DQSingleEdge {
-    DQSINGLE_BEDGE_LEFT,
-    DQSINGLE_BEDGE_TOP,
-    DQSINGLE_BEDGE_RIGHT,
-    DQSINGLE_BEDGE_BOTTOM
-};
-//@}
-
-/** Which pair of edges is quantized with ALTPQUANT */
-//@{
-enum DQDoubleEdge {
-    DQDOUBLE_BEDGE_TOPLEFT,
-    DQDOUBLE_BEDGE_TOPRIGHT,
-    DQDOUBLE_BEDGE_BOTTOMRIGHT,
-    DQDOUBLE_BEDGE_BOTTOMLEFT
-};
-//@}
-
-/** MV modes for P frames */
-//@{
-enum MVModes {
-    MV_PMODE_1MV_HPEL_BILIN,
-    MV_PMODE_1MV,
-    MV_PMODE_1MV_HPEL,
-    MV_PMODE_MIXED_MV,
-    MV_PMODE_INTENSITY_COMP
-};
-//@}
-
-/** @name MV types for B frames */
-//@{
-enum BMVTypes {
-    BMV_TYPE_BACKWARD,
-    BMV_TYPE_FORWARD,
-    BMV_TYPE_INTERPOLATED
-};
-//@}
-
-/** @name Block types for P/B frames */
-//@{
-enum TransformTypes {
-    TT_8X8,
-    TT_8X4_BOTTOM,
-    TT_8X4_TOP,
-    TT_8X4, //Both halves
-    TT_4X8_RIGHT,
-    TT_4X8_LEFT,
-    TT_4X8, //Both halves
-    TT_4X4
-};
-//@}
-
-enum CodingSet {
-    CS_HIGH_MOT_INTRA = 0,
-    CS_HIGH_MOT_INTER,
-    CS_LOW_MOT_INTRA,
-    CS_LOW_MOT_INTER,
-    CS_MID_RATE_INTRA,
-    CS_MID_RATE_INTER,
-    CS_HIGH_RATE_INTRA,
-    CS_HIGH_RATE_INTER
-};
-
-/** @name Overlap conditions for Advanced Profile */
-//@{
-enum COTypes {
-    CONDOVER_NONE = 0,
-    CONDOVER_ALL,
-    CONDOVER_SELECT
-};
-//@}
-
-
-/** The VC1 Context
- * @todo Change size wherever another size is more efficient
- * Many members are only used for Advanced Profile
- */
-typedef struct VC1Context{
-    MpegEncContext s;
-    IntraX8Context x8;
-
-    int bits;
-
-    /** Simple/Main Profile sequence header */
-    //@{
-    int res_sm;           ///< reserved, 2b
-    int res_x8;           ///< reserved
-    int multires;         ///< frame-level RESPIC syntax element present
-    int res_fasttx;       ///< reserved, always 1
-    int res_transtab;     ///< reserved, always 0
-    int rangered;         ///< RANGEREDFRM (range reduction) syntax element present
-                          ///< at frame level
-    int res_rtm_flag;     ///< reserved, set to 1
-    int reserved;         ///< reserved
-    //@}
-
-    /** Advanced Profile */
-    //@{
-    int level;            ///< 3bits, for Advanced/Simple Profile, provided by TS layer
-    int chromaformat;     ///< 2bits, 2=4:2:0, only defined
-    int postprocflag;     ///< Per-frame processing suggestion flag present
-    int broadcast;        ///< TFF/RFF present
-    int interlace;        ///< Progressive/interlaced (RPTFTM syntax element)
-    int tfcntrflag;       ///< TFCNTR present
-    int panscanflag;      ///< NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present
-    int refdist_flag;     ///< REFDIST syntax element present in II, IP, PI or PP field picture headers
-    int extended_dmv;     ///< Additional extended dmv range at P/B frame-level
-    int color_prim;       ///< 8bits, chroma coordinates of the color primaries
-    int transfer_char;    ///< 8bits, Opto-electronic transfer characteristics
-    int matrix_coef;      ///< 8bits, Color primaries->YCbCr transform matrix
-    int hrd_param_flag;   ///< Presence of Hypothetical Reference
-                          ///< Decoder parameters
-    int psf;              ///< Progressive Segmented Frame
-    //@}
-
-    /** Sequence header data for all Profiles
-     * TODO: choose between ints, uint8_ts and monobit flags
-     */
-    //@{
-    int profile;          ///< 2bits, Profile
-    int frmrtq_postproc;  ///< 3bits,
-    int bitrtq_postproc;  ///< 5bits, quantized framerate-based postprocessing strength
-    int fastuvmc;         ///< Rounding of qpel vector to hpel ? (not in Simple)
-    int extended_mv;      ///< Ext MV in P/B (not in Simple)
-    int dquant;           ///< How qscale varies with MBs, 2bits (not in Simple)
-    int vstransform;      ///< variable-size [48]x[48] transform type + info
-    int overlap;          ///< overlapped transforms in use
-    int quantizer_mode;   ///< 2bits, quantizer mode used for sequence, see QUANT_*
-    int finterpflag;      ///< INTERPFRM present
-    //@}
-
-    /** Frame decoding info for all profiles */
-    //@{
-    uint8_t mv_mode;      ///< MV coding monde
-    uint8_t mv_mode2;     ///< Secondary MV coding mode (B frames)
-    int k_x;              ///< Number of bits for MVs (depends on MV range)
-    int k_y;              ///< Number of bits for MVs (depends on MV range)
-    int range_x, range_y; ///< MV range
-    uint8_t pq, altpq;    ///< Current/alternate frame quantizer scale
-    const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode
-    const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode
-    /** pquant parameters */
-    //@{
-    uint8_t dquantfrm;
-    uint8_t dqprofile;
-    uint8_t dqsbedge;
-    uint8_t dqbilevel;
-    //@}
-    /** AC coding set indexes
-     * @see 8.1.1.10, p(1)10
-     */
-    //@{
-    int c_ac_table_index; ///< Chroma index from ACFRM element
-    int y_ac_table_index; ///< Luma index from AC2FRM element
-    //@}
-    int ttfrm;            ///< Transform type info present at frame level
-    uint8_t ttmbf;        ///< Transform type flag
-    uint8_t ttblk4x4;     ///< Value of ttblk which indicates a 4x4 transform
-    int codingset;        ///< index of current table set from 11.8 to use for luma block decoding
-    int codingset2;       ///< index of current table set from 11.8 to use for chroma block decoding
-    int pqindex;          ///< raw pqindex used in coding set selection
-    int a_avail, c_avail;
-    uint8_t *mb_type_base, *mb_type[3];
-
-
-    /** Luma compensation parameters */
-    //@{
-    uint8_t lumscale;
-    uint8_t lumshift;
-    //@}
-    int16_t bfraction;    ///< Relative position % anchors=> how to scale MVs
-    uint8_t halfpq;       ///< Uniform quant over image and qp+.5
-    uint8_t respic;       ///< Frame-level flag for resized images
-    int buffer_fullness;  ///< HRD info
-    /** Ranges:
-     * -# 0 -> [-64n 63.f] x [-32, 31.f]
-     * -# 1 -> [-128, 127.f] x [-64, 63.f]
-     * -# 2 -> [-512, 511.f] x [-128, 127.f]
-     * -# 3 -> [-1024, 1023.f] x [-256, 255.f]
-     */
-    uint8_t mvrange;
-    uint8_t pquantizer;           ///< Uniform (over sequence) quantizer in use
-    VLC *cbpcy_vlc;               ///< CBPCY VLC table
-    int tt_index;                 ///< Index for Transform Type tables
-    uint8_t* mv_type_mb_plane;    ///< bitplane for mv_type == (4MV)
-    uint8_t* direct_mb_plane;     ///< bitplane for "direct" MBs
-    int mv_type_is_raw;           ///< mv type mb plane is not coded
-    int dmb_is_raw;               ///< direct mb plane is raw
-    int skip_is_raw;              ///< skip mb plane is not coded
-    uint8_t luty[256], lutuv[256]; // lookup tables used for intensity compensation
-    int use_ic;                   ///< use intensity compensation in B-frames
-    int rnd;                      ///< rounding control
-
-    /** Frame decoding info for S/M profiles only */
-    //@{
-    uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128)
-    uint8_t interpfrm;
-    //@}
-
-    /** Frame decoding info for Advanced profile */
-    //@{
-    uint8_t fcm; ///< 0->Progressive, 2->Frame-Interlace, 3->Field-Interlace
-    uint8_t numpanscanwin;
-    uint8_t tfcntr;
-    uint8_t rptfrm, tff, rff;
-    uint16_t topleftx;
-    uint16_t toplefty;
-    uint16_t bottomrightx;
-    uint16_t bottomrighty;
-    uint8_t uvsamp;
-    uint8_t postproc;
-    int hrd_num_leaky_buckets;
-    uint8_t bit_rate_exponent;
-    uint8_t buffer_size_exponent;
-    uint8_t* acpred_plane;       ///< AC prediction flags bitplane
-    int acpred_is_raw;
-    uint8_t* over_flags_plane;   ///< Overflags bitplane
-    int overflg_is_raw;
-    uint8_t condover;
-    uint16_t *hrd_rate, *hrd_buffer;
-    uint8_t *hrd_fullness;
-    uint8_t range_mapy_flag;
-    uint8_t range_mapuv_flag;
-    uint8_t range_mapy;
-    uint8_t range_mapuv;
-    //@}
-
-    int p_frame_skipped;
-    int bi_type;
-    int x8_type;
-
-    uint32_t *cbp_base, *cbp;
-    uint8_t bfraction_lut_index;///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
-    uint8_t broken_link;        ///< Broken link flag (BROKEN_LINK syntax element)
-    uint8_t closed_entry;       ///< Closed entry point flag (CLOSED_ENTRY syntax element)
-
-    int parse_only;             ///< Context is used within parser
-
-    int warn_interlaced;
-} VC1Context;
-
-/** Find VC-1 marker in buffer
- * @return position where next marker starts or end of buffer if no marker found
- */
-static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end)
-{
-    uint32_t mrk = 0xFFFFFFFF;
-
-    if(end-src < 4) return end;
-    while(src < end){
-        mrk = (mrk << 8) | *src++;
-        if(IS_MARKER(mrk))
-            return src-4;
-    }
-    return end;
-}
-
-static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, uint8_t *dst)
-{
-    int dsize = 0, i;
-
-    if(size < 4){
-        for(dsize = 0; dsize < size; dsize++) *dst++ = *src++;
-        return size;
-    }
-    for(i = 0; i < size; i++, src++) {
-        if(src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) {
-            dst[dsize++] = src[1];
-            src++;
-            i++;
-        } else
-            dst[dsize++] = *src;
-    }
-    return dsize;
-}
-
-/**
- * Decode Simple/Main Profiles sequence header
- * @see Figure 7-8, p16-17
- * @param avctx Codec context
- * @param gb GetBit context initialized from Codec context extra_data
- * @return Status
- */
-int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb);
-
-int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb);
-
-int vc1_parse_frame_header    (VC1Context *v, GetBitContext *gb);
-int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb);
-
-#endif /* AVCODEC_VC1_H */
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
deleted file mode 100644
index 6e559de..0000000
--- a/libavcodec/vc1_parser.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * VC-1 and WMV3 parser
- * Copyright (c) 2006-2007 Konstantin Shishkov
- * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VC-1 and WMV3 parser
- */
-
-#include "parser.h"
-#include "vc1.h"
-#include "get_bits.h"
-
-typedef struct {
-    ParseContext pc;
-    VC1Context v;
-} VC1ParseContext;
-
-static void vc1_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx,
-                                const uint8_t *buf, int buf_size)
-{
-    VC1ParseContext *vpc = s->priv_data;
-    GetBitContext gb;
-    const uint8_t *start, *end, *next;
-    uint8_t *buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-    vpc->v.s.avctx = avctx;
-    vpc->v.parse_only = 1;
-    next = buf;
-
-    for(start = buf, end = buf + buf_size; next < end; start = next){
-        int buf2_size, size;
-
-        next = find_next_marker(start + 4, end);
-        size = next - start - 4;
-        buf2_size = vc1_unescape_buffer(start + 4, size, buf2);
-        init_get_bits(&gb, buf2, buf2_size * 8);
-        if(size <= 0) continue;
-        switch(AV_RB32(start)){
-        case VC1_CODE_SEQHDR:
-            vc1_decode_sequence_header(avctx, &vpc->v, &gb);
-            break;
-        case VC1_CODE_ENTRYPOINT:
-            vc1_decode_entry_point(avctx, &vpc->v, &gb);
-            break;
-        case VC1_CODE_FRAME:
-            if(vpc->v.profile < PROFILE_ADVANCED)
-                vc1_parse_frame_header    (&vpc->v, &gb);
-            else
-                vc1_parse_frame_header_adv(&vpc->v, &gb);
-
-            /* keep FF_BI_TYPE internal to VC1 */
-            if (vpc->v.s.pict_type == FF_BI_TYPE)
-                s->pict_type = FF_B_TYPE;
-            else
-                s->pict_type = vpc->v.s.pict_type;
-
-            break;
-        }
-    }
-
-    av_free(buf2);
-}
-
-/**
- * finds the end of the current frame in the bitstream.
- * @return the position of the first byte of the next frame, or -1
- */
-static int vc1_find_frame_end(ParseContext *pc, const uint8_t *buf,
-                               int buf_size) {
-    int pic_found, i;
-    uint32_t state;
-
-    pic_found= pc->frame_start_found;
-    state= pc->state;
-
-    i=0;
-    if(!pic_found){
-        for(i=0; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(state == VC1_CODE_FRAME || state == VC1_CODE_FIELD){
-                i++;
-                pic_found=1;
-                break;
-            }
-        }
-    }
-
-    if(pic_found){
-        /* EOF considered as end of frame */
-        if (buf_size == 0)
-            return 0;
-        for(; i<buf_size; i++){
-            state= (state<<8) | buf[i];
-            if(IS_MARKER(state) && state != VC1_CODE_FIELD && state != VC1_CODE_SLICE){
-                pc->frame_start_found=0;
-                pc->state=-1;
-                return i-3;
-            }
-        }
-    }
-    pc->frame_start_found= pic_found;
-    pc->state= state;
-    return END_NOT_FOUND;
-}
-
-static int vc1_parse(AVCodecParserContext *s,
-                           AVCodecContext *avctx,
-                           const uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size)
-{
-    VC1ParseContext *vpc = s->priv_data;
-    int next;
-
-    if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){
-        next= buf_size;
-    }else{
-        next= vc1_find_frame_end(&vpc->pc, buf, buf_size);
-
-        if (ff_combine_frame(&vpc->pc, next, &buf, &buf_size) < 0) {
-            *poutbuf = NULL;
-            *poutbuf_size = 0;
-            return buf_size;
-        }
-    }
-
-    vc1_extract_headers(s, avctx, buf, buf_size);
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return next;
-}
-
-static int vc1_split(AVCodecContext *avctx,
-                           const uint8_t *buf, int buf_size)
-{
-    int i;
-    uint32_t state= -1;
-    int charged=0;
-
-    for(i=0; i<buf_size; i++){
-        state= (state<<8) | buf[i];
-        if(IS_MARKER(state)){
-            if(state == VC1_CODE_SEQHDR || state == VC1_CODE_ENTRYPOINT){
-                charged=1;
-            }else if(charged){
-                return i-3;
-            }
-        }
-    }
-    return 0;
-}
-
-AVCodecParser vc1_parser = {
-    { CODEC_ID_VC1 },
-    sizeof(VC1ParseContext),
-    NULL,
-    vc1_parse,
-    ff_parse1_close,
-    vc1_split,
-};
diff --git a/libavcodec/vc1acdata.h b/libavcodec/vc1acdata.h
deleted file mode 100644
index 78de0f9..0000000
--- a/libavcodec/vc1acdata.h
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * VC-1 and WMV3 decoder
- * copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VC1ACDATA_H
-#define AVCODEC_VC1ACDATA_H
-
-#include <stdint.h>
-
-#define AC_MODES 8
-
-static const int vc1_ac_sizes[AC_MODES] = {
-    186, 169, 133, 149, 103, 103, 163, 175
-};
-
-static const uint32_t vc1_ac_tables[AC_MODES][186][2] = {
-{
-{ 0x0001,  2}, { 0x0005,  3}, { 0x000D,  4}, { 0x0012,  5}, { 0x000E,  6}, { 0x0015,  7},
-{ 0x0013,  8}, { 0x003F,  8}, { 0x004B,  9}, { 0x011F,  9}, { 0x00B8, 10}, { 0x03E3, 10},
-{ 0x0172, 11}, { 0x024D, 12}, { 0x03DA, 12}, { 0x02DD, 13}, { 0x1F55, 13}, { 0x05B9, 14},
-{ 0x3EAE, 14}, { 0x0000,  4}, { 0x0010,  5}, { 0x0008,  7}, { 0x0020,  8}, { 0x0029,  9},
-{ 0x01F4,  9}, { 0x0233, 10}, { 0x01E0, 11}, { 0x012A, 12}, { 0x03DD, 12}, { 0x050A, 13},
-{ 0x1F29, 13}, { 0x0A42, 14}, { 0x1272, 15}, { 0x1737, 15}, { 0x0003,  5}, { 0x0011,  7},
-{ 0x00C4,  8}, { 0x004B, 10}, { 0x00B4, 11}, { 0x07D4, 11}, { 0x0345, 12}, { 0x02D7, 13},
-{ 0x07BF, 13}, { 0x0938, 14}, { 0x0BBB, 14}, { 0x095E, 15}, { 0x0013,  5}, { 0x0078,  7},
-{ 0x0069,  9}, { 0x0232, 10}, { 0x0461, 11}, { 0x03EC, 12}, { 0x0520, 13}, { 0x1F2A, 13},
-{ 0x3E50, 14}, { 0x3E51, 14}, { 0x1486, 15}, { 0x000C,  6}, { 0x0024,  9}, { 0x0094, 11},
-{ 0x08C0, 12}, { 0x0F09, 14}, { 0x1EF0, 15}, { 0x003D,  6}, { 0x0053,  9}, { 0x01A0, 11},
-{ 0x02D6, 13}, { 0x0F08, 14}, { 0x0013,  7}, { 0x007C,  9}, { 0x07C1, 11}, { 0x04AC, 14},
-{ 0x001B,  7}, { 0x00A0, 10}, { 0x0344, 12}, { 0x0F79, 14}, { 0x0079,  7}, { 0x03E1, 10},
-{ 0x02D4, 13}, { 0x2306, 14}, { 0x0021,  8}, { 0x023C, 10}, { 0x0FAE, 12}, { 0x23DE, 14},
-{ 0x0035,  8}, { 0x0175, 11}, { 0x07B3, 13}, { 0x00C5,  8}, { 0x0174, 11}, { 0x0785, 13},
-{ 0x0048,  9}, { 0x01A3, 11}, { 0x049E, 13}, { 0x002C,  9}, { 0x00FA, 10}, { 0x07D6, 11},
-{ 0x0092, 10}, { 0x05CC, 13}, { 0x1EF1, 15}, { 0x00A3, 10}, { 0x03ED, 12}, { 0x093E, 14},
-{ 0x01E2, 11}, { 0x1273, 15}, { 0x07C4, 11}, { 0x1487, 15}, { 0x0291, 12}, { 0x0293, 12},
-{ 0x0F8A, 12}, { 0x0509, 13}, { 0x0508, 13}, { 0x078D, 13}, { 0x07BE, 13}, { 0x078C, 13},
-{ 0x04AE, 14}, { 0x0BBA, 14}, { 0x2307, 14}, { 0x0B9A, 14}, { 0x1736, 15}, { 0x000E,  4},
-{ 0x0045,  7}, { 0x01F3,  9}, { 0x047A, 11}, { 0x05DC, 13}, { 0x23DF, 14}, { 0x0019,  5},
-{ 0x0028,  9}, { 0x0176, 11}, { 0x049D, 13}, { 0x23DD, 14}, { 0x0030,  6}, { 0x00A2, 10},
-{ 0x02EF, 12}, { 0x05B8, 14}, { 0x003F,  6}, { 0x00A5, 10}, { 0x03DB, 12}, { 0x093F, 14},
-{ 0x0044,  7}, { 0x07CB, 11}, { 0x095F, 15}, { 0x0063,  7}, { 0x03C3, 12}, { 0x0015,  8},
-{ 0x08F6, 12}, { 0x0017,  8}, { 0x0498, 13}, { 0x002C,  8}, { 0x07B2, 13}, { 0x002F,  8},
-{ 0x1F54, 13}, { 0x008D,  8}, { 0x07BD, 13}, { 0x008E,  8}, { 0x1182, 13}, { 0x00FB,  8},
-{ 0x050B, 13}, { 0x002D,  8}, { 0x07C0, 11}, { 0x0079,  9}, { 0x1F5F, 13}, { 0x007A,  9},
-{ 0x1F56, 13}, { 0x0231, 10}, { 0x03E4, 10}, { 0x01A1, 11}, { 0x0143, 11}, { 0x01F7, 11},
-{ 0x016F, 12}, { 0x0292, 12}, { 0x02E7, 12}, { 0x016C, 12}, { 0x016D, 12}, { 0x03DC, 12},
-{ 0x0F8B, 12}, { 0x0499, 13}, { 0x03D8, 12}, { 0x078E, 13}, { 0x02D5, 13}, { 0x1F5E, 13},
-{ 0x1F2B, 13}, { 0x078F, 13}, { 0x04AD, 14}, { 0x3EAF, 14}, { 0x23DC, 14}, { 0x004A,  9}
-},
-{
-{ 0x0000,  3}, { 0x0003,  4}, { 0x000B,  5}, { 0x0014,  6}, { 0x003F,  6}, { 0x005D,  7},
-{ 0x00A2,  8}, { 0x00AC,  9}, { 0x016E,  9}, { 0x020A, 10}, { 0x02E2, 10}, { 0x0432, 11},
-{ 0x05C9, 11}, { 0x0827, 12}, { 0x0B54, 12}, { 0x04E6, 13}, { 0x105F, 13}, { 0x172A, 13},
-{ 0x20B2, 14}, { 0x2D4E, 14}, { 0x39F0, 14}, { 0x4175, 15}, { 0x5A9E, 15}, { 0x0004,  4},
-{ 0x001E,  5}, { 0x0042,  7}, { 0x00B6,  8}, { 0x0173,  9}, { 0x0395, 10}, { 0x072E, 11},
-{ 0x0B94, 12}, { 0x16A4, 13}, { 0x20B3, 14}, { 0x2E45, 14}, { 0x0005,  5}, { 0x0040,  7},
-{ 0x0049,  9}, { 0x028F, 10}, { 0x05CB, 11}, { 0x048A, 13}, { 0x09DD, 14}, { 0x73E2, 15},
-{ 0x0018,  5}, { 0x0025,  8}, { 0x008A, 10}, { 0x051B, 11}, { 0x0E5F, 12}, { 0x09C9, 14},
-{ 0x139C, 15}, { 0x0029,  6}, { 0x004F,  9}, { 0x0412, 11}, { 0x048D, 13}, { 0x2E41, 14},
-{ 0x0038,  6}, { 0x010E,  9}, { 0x05A8, 11}, { 0x105C, 13}, { 0x39F2, 14}, { 0x0058,  7},
-{ 0x021F, 10}, { 0x0E7E, 12}, { 0x39FF, 14}, { 0x0023,  8}, { 0x02E3, 10}, { 0x04E5, 13},
-{ 0x2E40, 14}, { 0x00A1,  8}, { 0x05BE, 11}, { 0x09C8, 14}, { 0x0083,  8}, { 0x013A, 11},
-{ 0x1721, 13}, { 0x0044,  9}, { 0x0276, 12}, { 0x39F6, 14}, { 0x008B, 10}, { 0x04EF, 13},
-{ 0x5A9B, 15}, { 0x0208, 10}, { 0x1CFE, 13}, { 0x0399, 10}, { 0x1CB4, 13}, { 0x039E, 10},
-{ 0x39F3, 14}, { 0x05AB, 11}, { 0x73E3, 15}, { 0x0737, 11}, { 0x5A9F, 15}, { 0x082D, 12},
-{ 0x0E69, 12}, { 0x0E68, 12}, { 0x0433, 11}, { 0x0B7B, 12}, { 0x2DF8, 14}, { 0x2E56, 14},
-{ 0x2E57, 14}, { 0x39F7, 14}, { 0x51A5, 15}, { 0x0003,  3}, { 0x002A,  6}, { 0x00E4,  8},
-{ 0x028E, 10}, { 0x0735, 11}, { 0x1058, 13}, { 0x1CFA, 13}, { 0x2DF9, 14}, { 0x4174, 15},
-{ 0x0009,  4}, { 0x0054,  8}, { 0x0398, 10}, { 0x048B, 13}, { 0x139D, 15}, { 0x000D,  4},
-{ 0x00AD,  9}, { 0x0826, 12}, { 0x2D4C, 14}, { 0x0011,  5}, { 0x016B,  9}, { 0x0B7F, 12},
-{ 0x51A4, 15}, { 0x0019,  5}, { 0x021B, 10}, { 0x16FD, 13}, { 0x001D,  5}, { 0x0394, 10},
-{ 0x28D3, 14}, { 0x002B,  6}, { 0x05BC, 11}, { 0x5A9A, 15}, { 0x002F,  6}, { 0x0247, 12},
-{ 0x0010,  7}, { 0x0A35, 12}, { 0x003E,  6}, { 0x0B7A, 12}, { 0x0059,  7}, { 0x105E, 13},
-{ 0x0026,  8}, { 0x09CF, 14}, { 0x0055,  8}, { 0x1CB5, 13}, { 0x0057,  8}, { 0x0E5B, 12},
-{ 0x00A0,  8}, { 0x1468, 13}, { 0x0170,  9}, { 0x0090, 10}, { 0x01CE,  9}, { 0x021A, 10},
-{ 0x0218, 10}, { 0x0168,  9}, { 0x021E, 10}, { 0x0244, 12}, { 0x0736, 11}, { 0x0138, 11},
-{ 0x0519, 11}, { 0x0E5E, 12}, { 0x072C, 11}, { 0x0B55, 12}, { 0x09DC, 14}, { 0x20BB, 14},
-{ 0x048C, 13}, { 0x1723, 13}, { 0x2E44, 14}, { 0x16A5, 13}, { 0x0518, 11}, { 0x39FE, 14},
-{ 0x0169,  9}
-},
-{
-{ 0x0001,  2}, { 0x0006,  3}, { 0x000F,  4}, { 0x0016,  5}, { 0x0020,  6}, { 0x0018,  7},
-{ 0x0008,  8}, { 0x009A,  8}, { 0x0056,  9}, { 0x013E,  9}, { 0x00F0, 10}, { 0x03A5, 10},
-{ 0x0077, 11}, { 0x01EF, 11}, { 0x009A, 12}, { 0x005D, 13}, { 0x0001,  4}, { 0x0011,  5},
-{ 0x0002,  7}, { 0x000B,  8}, { 0x0012,  9}, { 0x01D6,  9}, { 0x027E, 10}, { 0x0191, 11},
-{ 0x00EA, 12}, { 0x03DC, 12}, { 0x013B, 13}, { 0x0004,  5}, { 0x0014,  7}, { 0x009E,  8},
-{ 0x0009, 10}, { 0x01AC, 11}, { 0x01E2, 11}, { 0x03CA, 12}, { 0x005F, 13}, { 0x0017,  5},
-{ 0x004E,  7}, { 0x005E,  9}, { 0x00F3, 10}, { 0x01AD, 11}, { 0x00EC, 12}, { 0x05F0, 13},
-{ 0x000E,  6}, { 0x00E1,  8}, { 0x03A4, 10}, { 0x009C, 12}, { 0x013D, 13}, { 0x003B,  6},
-{ 0x001C,  9}, { 0x0014, 11}, { 0x09BE, 12}, { 0x0006,  7}, { 0x007A,  9}, { 0x0190, 11},
-{ 0x0137, 13}, { 0x001B,  7}, { 0x0008, 10}, { 0x075C, 11}, { 0x0071,  7}, { 0x00D7, 10},
-{ 0x09BF, 12}, { 0x0007,  8}, { 0x00AF, 10}, { 0x04CC, 11}, { 0x0034,  8}, { 0x0265, 10},
-{ 0x009F, 12}, { 0x00E0,  8}, { 0x0016, 11}, { 0x0327, 12}, { 0x0015,  9}, { 0x017D, 11},
-{ 0x0EBB, 12}, { 0x0014,  9}, { 0x00F6, 10}, { 0x01E4, 11}, { 0x00CB, 10}, { 0x099D, 12},
-{ 0x00CA, 10}, { 0x02FC, 12}, { 0x017F, 11}, { 0x04CD, 11}, { 0x02FD, 12}, { 0x04FE, 11},
-{ 0x013A, 13}, { 0x000A,  4}, { 0x0042,  7}, { 0x01D3,  9}, { 0x04DD, 11}, { 0x0012,  5},
-{ 0x00E8,  8}, { 0x004C, 11}, { 0x0136, 13}, { 0x0039,  6}, { 0x0264, 10}, { 0x0EBA, 12},
-{ 0x0000,  7}, { 0x00AE, 10}, { 0x099C, 12}, { 0x001F,  7}, { 0x04DE, 11}, { 0x0043,  7},
-{ 0x04DC, 11}, { 0x0003,  8}, { 0x03CB, 12}, { 0x0006,  8}, { 0x099E, 12}, { 0x002A,  8},
-{ 0x05F1, 13}, { 0x000F,  8}, { 0x09FE, 12}, { 0x0033,  8}, { 0x09FF, 12}, { 0x0098,  8},
-{ 0x099F, 12}, { 0x00EA,  8}, { 0x013C, 13}, { 0x002E,  8}, { 0x0192, 11}, { 0x0136,  9},
-{ 0x006A,  9}, { 0x0015, 11}, { 0x03AF, 10}, { 0x01E3, 11}, { 0x0074, 11}, { 0x00EB, 12},
-{ 0x02F9, 12}, { 0x005C, 13}, { 0x00ED, 12}, { 0x03DD, 12}, { 0x0326, 12}, { 0x005E, 13},
-{ 0x0016,  7}
-},
-{
-{ 0x0004,  3}, { 0x0014,  5}, { 0x0017,  7}, { 0x007F,  8}, { 0x0154,  9}, { 0x01F2, 10},
-{ 0x00BF, 11}, { 0x0065, 12}, { 0x0AAA, 12}, { 0x0630, 13}, { 0x1597, 13}, { 0x03B7, 14},
-{ 0x2B22, 14}, { 0x0BE6, 15}, { 0x000B,  4}, { 0x0037,  7}, { 0x0062,  9}, { 0x0007, 11},
-{ 0x0166, 12}, { 0x00CE, 13}, { 0x1590, 13}, { 0x05F6, 14}, { 0x0BE7, 15}, { 0x0007,  5},
-{ 0x006D,  8}, { 0x0003, 11}, { 0x031F, 12}, { 0x05F2, 14}, { 0x0002,  6}, { 0x0061,  9},
-{ 0x0055, 12}, { 0x01DF, 14}, { 0x001A,  6}, { 0x001E, 10}, { 0x0AC9, 12}, { 0x2B23, 14},
-{ 0x001E,  6}, { 0x001F, 10}, { 0x0AC3, 12}, { 0x2B2B, 14}, { 0x0006,  7}, { 0x0004, 11},
-{ 0x02F8, 13}, { 0x0019,  7}, { 0x0006, 11}, { 0x063D, 13}, { 0x0057,  7}, { 0x0182, 11},
-{ 0x2AA2, 14}, { 0x0004,  8}, { 0x0180, 11}, { 0x059C, 14}, { 0x007D,  8}, { 0x0164, 12},
-{ 0x076D, 15}, { 0x0002,  9}, { 0x018D, 11}, { 0x1581, 13}, { 0x00AD,  8}, { 0x0060, 12},
-{ 0x0C67, 14}, { 0x001C,  9}, { 0x00EE, 13}, { 0x0003,  9}, { 0x02CF, 13}, { 0x00D9,  9},
-{ 0x1580, 13}, { 0x0002, 11}, { 0x0183, 11}, { 0x0057, 12}, { 0x0061, 12}, { 0x0031, 11},
-{ 0x0066, 12}, { 0x0631, 13}, { 0x0632, 13}, { 0x00AC, 13}, { 0x031D, 12}, { 0x0076, 12},
-{ 0x003A, 11}, { 0x0165, 12}, { 0x0C66, 14}, { 0x0003,  2}, { 0x0054,  7}, { 0x02AB, 10},
-{ 0x0016, 13}, { 0x05F7, 14}, { 0x0005,  4}, { 0x00F8,  9}, { 0x0AA9, 12}, { 0x005F, 15},
-{ 0x0004,  4}, { 0x001C, 10}, { 0x1550, 13}, { 0x0004,  5}, { 0x0077, 11}, { 0x076C, 15},
-{ 0x000E,  5}, { 0x000A, 12}, { 0x000C,  5}, { 0x0562, 11}, { 0x0004,  6}, { 0x031C, 12},
-{ 0x0006,  6}, { 0x00C8, 13}, { 0x000D,  6}, { 0x01DA, 13}, { 0x0007,  6}, { 0x00C9, 13},
-{ 0x0001,  7}, { 0x002E, 14}, { 0x0014,  7}, { 0x1596, 13}, { 0x000A,  7}, { 0x0AC2, 12},
-{ 0x0016,  7}, { 0x015B, 14}, { 0x0015,  7}, { 0x015A, 14}, { 0x000F,  8}, { 0x005E, 15},
-{ 0x007E,  8}, { 0x00AB,  8}, { 0x002D,  9}, { 0x00D8,  9}, { 0x000B,  9}, { 0x0014, 10},
-{ 0x02B3, 10}, { 0x01F3, 10}, { 0x003A, 10}, { 0x0000, 10}, { 0x0058, 10}, { 0x002E,  9},
-{ 0x005E, 10}, { 0x0563, 11}, { 0x00EC, 12}, { 0x0054, 12}, { 0x0AC1, 12}, { 0x1556, 13},
-{ 0x02FA, 13}, { 0x0181, 11}, { 0x1557, 13}, { 0x059D, 14}, { 0x2AA3, 14}, { 0x2B2A, 14},
-{ 0x01DE, 14}, { 0x063C, 13}, { 0x00CF, 13}, { 0x1594, 13}, { 0x000D,  9}
-},
-{
-{ 0x0002,  2}, { 0x0006,  3}, { 0x000F,  4}, { 0x000D,  5}, { 0x000C,  5}, { 0x0015,  6},
-{ 0x0013,  6}, { 0x0012,  6}, { 0x0017,  7}, { 0x001F,  8}, { 0x001E,  8}, { 0x001D,  8},
-{ 0x0025,  9}, { 0x0024,  9}, { 0x0023,  9}, { 0x0021,  9}, { 0x0021, 10}, { 0x0020, 10},
-{ 0x000F, 10}, { 0x000E, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11}, { 0x0021, 11},
-{ 0x0050, 12}, { 0x0051, 12}, { 0x0052, 12}, { 0x000E,  4}, { 0x0014,  6}, { 0x0016,  7},
-{ 0x001C,  8}, { 0x0020,  9}, { 0x001F,  9}, { 0x000D, 10}, { 0x0022, 11}, { 0x0053, 12},
-{ 0x0055, 12}, { 0x000B,  5}, { 0x0015,  7}, { 0x001E,  9}, { 0x000C, 10}, { 0x0056, 12},
-{ 0x0011,  6}, { 0x001B,  8}, { 0x001D,  9}, { 0x000B, 10}, { 0x0010,  6}, { 0x0022,  9},
-{ 0x000A, 10}, { 0x000D,  6}, { 0x001C,  9}, { 0x0008, 10}, { 0x0012,  7}, { 0x001B,  9},
-{ 0x0054, 12}, { 0x0014,  7}, { 0x001A,  9}, { 0x0057, 12}, { 0x0019,  8}, { 0x0009, 10},
-{ 0x0018,  8}, { 0x0023, 11}, { 0x0017,  8}, { 0x0019,  9}, { 0x0018,  9}, { 0x0007, 10},
-{ 0x0058, 12}, { 0x0007,  4}, { 0x000C,  6}, { 0x0016,  8}, { 0x0017,  9}, { 0x0006, 10},
-{ 0x0005, 11}, { 0x0004, 11}, { 0x0059, 12}, { 0x000F,  6}, { 0x0016,  9}, { 0x0005, 10},
-{ 0x000E,  6}, { 0x0004, 10}, { 0x0011,  7}, { 0x0024, 11}, { 0x0010,  7}, { 0x0025, 11},
-{ 0x0013,  7}, { 0x005A, 12}, { 0x0015,  8}, { 0x005B, 12}, { 0x0014,  8}, { 0x0013,  8},
-{ 0x001A,  8}, { 0x0015,  9}, { 0x0014,  9}, { 0x0013,  9}, { 0x0012,  9}, { 0x0011,  9},
-{ 0x0026, 11}, { 0x0027, 11}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12},
-{ 0x0003,  7}
-},
-{
-{ 0x0002,  2}, { 0x000F,  4}, { 0x0015,  6}, { 0x0017,  7}, { 0x001F,  8}, { 0x0025,  9},
-{ 0x0024,  9}, { 0x0021, 10}, { 0x0020, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11},
-{ 0x0006,  3}, { 0x0014,  6}, { 0x001E,  8}, { 0x000F, 10}, { 0x0021, 11}, { 0x0050, 12},
-{ 0x000E,  4}, { 0x001D,  8}, { 0x000E, 10}, { 0x0051, 12}, { 0x000D,  5}, { 0x0023,  9},
-{ 0x000D, 10}, { 0x000C,  5}, { 0x0022,  9}, { 0x0052, 12}, { 0x000B,  5}, { 0x000C, 10},
-{ 0x0053, 12}, { 0x0013,  6}, { 0x000B, 10}, { 0x0054, 12}, { 0x0012,  6}, { 0x000A, 10},
-{ 0x0011,  6}, { 0x0009, 10}, { 0x0010,  6}, { 0x0008, 10}, { 0x0016,  7}, { 0x0055, 12},
-{ 0x0015,  7}, { 0x0014,  7}, { 0x001C,  8}, { 0x001B,  8}, { 0x0021,  9}, { 0x0020,  9},
-{ 0x001F,  9}, { 0x001E,  9}, { 0x001D,  9}, { 0x001C,  9}, { 0x001B,  9}, { 0x001A,  9},
-{ 0x0022, 11}, { 0x0023, 11}, { 0x0056, 12}, { 0x0057, 12}, { 0x0007,  4}, { 0x0019,  9},
-{ 0x0005, 11}, { 0x000F,  6}, { 0x0004, 11}, { 0x000E,  6}, { 0x000D,  6}, { 0x000C,  6},
-{ 0x0013,  7}, { 0x0012,  7}, { 0x0011,  7}, { 0x0010,  7}, { 0x001A,  8}, { 0x0019,  8},
-{ 0x0018,  8}, { 0x0017,  8}, { 0x0016,  8}, { 0x0015,  8}, { 0x0014,  8}, { 0x0013,  8},
-{ 0x0018,  9}, { 0x0017,  9}, { 0x0016,  9}, { 0x0015,  9}, { 0x0014,  9}, { 0x0013,  9},
-{ 0x0012,  9}, { 0x0011,  9}, { 0x0007, 10}, { 0x0006, 10}, { 0x0005, 10}, { 0x0004, 10},
-{ 0x0024, 11}, { 0x0025, 11}, { 0x0026, 11}, { 0x0027, 11}, { 0x0058, 12}, { 0x0059, 12},
-{ 0x005A, 12}, { 0x005B, 12}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12},
-{ 0x0003,  7}
-},
-{
-{ 0x0000,  2}, { 0x0003,  3}, { 0x000D,  4}, { 0x0005,  4}, { 0x001C,  5}, { 0x0016,  5},
-{ 0x003F,  6}, { 0x003A,  6}, { 0x002E,  6}, { 0x0022,  6}, { 0x007B,  7}, { 0x0067,  7},
-{ 0x005F,  7}, { 0x0047,  7}, { 0x0026,  7}, { 0x00EF,  8}, { 0x00CD,  8}, { 0x00C1,  8},
-{ 0x00A9,  8}, { 0x004F,  8}, { 0x01F2,  9}, { 0x01DD,  9}, { 0x0199,  9}, { 0x0185,  9},
-{ 0x015D,  9}, { 0x011B,  9}, { 0x03EF, 10}, { 0x03E1, 10}, { 0x03C8, 10}, { 0x0331, 10},
-{ 0x0303, 10}, { 0x02F1, 10}, { 0x02A0, 10}, { 0x0233, 10}, { 0x0126, 10}, { 0x07C0, 11},
-{ 0x076F, 11}, { 0x076C, 11}, { 0x0661, 11}, { 0x0604, 11}, { 0x0572, 11}, { 0x0551, 11},
-{ 0x046A, 11}, { 0x0274, 11}, { 0x0F27, 12}, { 0x0F24, 12}, { 0x0EDB, 12}, { 0x0C8E, 12},
-{ 0x0C0B, 12}, { 0x0C0A, 12}, { 0x0AE3, 12}, { 0x08D6, 12}, { 0x0490, 12}, { 0x0495, 12},
-{ 0x1F19, 13}, { 0x1DB5, 13}, { 0x0009,  4}, { 0x0010,  5}, { 0x0029,  6}, { 0x0062,  7},
-{ 0x00F3,  8}, { 0x00AD,  8}, { 0x01E5,  9}, { 0x0179,  9}, { 0x009C,  9}, { 0x03B1, 10},
-{ 0x02AE, 10}, { 0x0127, 10}, { 0x076E, 11}, { 0x0570, 11}, { 0x0275, 11}, { 0x0F25, 12},
-{ 0x0EC0, 12}, { 0x0AA0, 12}, { 0x08D7, 12}, { 0x1E4C, 13}, { 0x0008,  5}, { 0x0063,  7},
-{ 0x00AF,  8}, { 0x017B,  9}, { 0x03B3, 10}, { 0x07DD, 11}, { 0x0640, 11}, { 0x0F8D, 12},
-{ 0x0BC1, 12}, { 0x0491, 12}, { 0x0028,  6}, { 0x00C3,  8}, { 0x0151,  9}, { 0x02A1, 10},
-{ 0x0573, 11}, { 0x0EC3, 12}, { 0x1F35, 13}, { 0x0065,  7}, { 0x01DA,  9}, { 0x02AF, 10},
-{ 0x0277, 11}, { 0x08C9, 12}, { 0x1781, 13}, { 0x0025,  7}, { 0x0118,  9}, { 0x0646, 11},
-{ 0x0AA6, 12}, { 0x1780, 13}, { 0x00C9,  8}, { 0x0321, 10}, { 0x0F9B, 12}, { 0x191E, 13},
-{ 0x0048,  8}, { 0x07CC, 11}, { 0x0AA1, 12}, { 0x0180,  9}, { 0x0465, 11}, { 0x1905, 13},
-{ 0x03E2, 10}, { 0x0EC1, 12}, { 0x3C9B, 14}, { 0x02F4, 10}, { 0x08C8, 12}, { 0x07C1, 11},
-{ 0x0928, 13}, { 0x05E1, 11}, { 0x320D, 14}, { 0x0EC2, 12}, { 0x6418, 15}, { 0x1F34, 13},
-{ 0x0078,  7}, { 0x0155,  9}, { 0x0552, 11}, { 0x191F, 13}, { 0x00FA,  8}, { 0x07DC, 11},
-{ 0x1907, 13}, { 0x00AC,  8}, { 0x0249, 11}, { 0x13B1, 14}, { 0x01F6,  9}, { 0x0AE2, 12},
-{ 0x01DC,  9}, { 0x04ED, 12}, { 0x0184,  9}, { 0x1904, 13}, { 0x0156,  9}, { 0x09D9, 13},
-{ 0x03E7, 10}, { 0x0929, 13}, { 0x03B2, 10}, { 0x3B68, 14}, { 0x02F5, 10}, { 0x13B0, 14},
-{ 0x0322, 10}, { 0x3B69, 14}, { 0x0234, 10}, { 0x7935, 15}, { 0x07C7, 11}, { 0xC833, 16},
-{ 0x0660, 11}, { 0x7934, 15}, { 0x024B, 11}, { 0xC832, 16}, { 0x0AA7, 12}, { 0x1F18, 13},
-{ 0x007A,  7}
-},
-{
-{ 0x0002,  2}, { 0x0000,  3}, { 0x001E,  5}, { 0x0004,  5}, { 0x0012,  6}, { 0x0070,  7},
-{ 0x001A,  7}, { 0x005F,  8}, { 0x0047,  8}, { 0x01D3,  9}, { 0x00B5,  9}, { 0x0057,  9},
-{ 0x03B5, 10}, { 0x016D, 10}, { 0x0162, 10}, { 0x07CE, 11}, { 0x0719, 11}, { 0x0691, 11},
-{ 0x02C6, 11}, { 0x0156, 11}, { 0x0F92, 12}, { 0x0D2E, 12}, { 0x0D20, 12}, { 0x059E, 12},
-{ 0x0468, 12}, { 0x02A6, 12}, { 0x1DA2, 13}, { 0x1C60, 13}, { 0x1A43, 13}, { 0x0B1D, 13},
-{ 0x08C0, 13}, { 0x055D, 13}, { 0x0003,  3}, { 0x000A,  5}, { 0x0077,  7}, { 0x00E5,  8},
-{ 0x01D9,  9}, { 0x03E5, 10}, { 0x0166, 10}, { 0x0694, 11}, { 0x0152, 11}, { 0x059F, 12},
-{ 0x1F3C, 13}, { 0x1A4B, 13}, { 0x055E, 13}, { 0x000C,  4}, { 0x007D,  7}, { 0x0044,  8},
-{ 0x03E0, 10}, { 0x0769, 11}, { 0x0E31, 12}, { 0x1F26, 13}, { 0x055C, 13}, { 0x001B,  5},
-{ 0x00E2,  8}, { 0x03A5, 10}, { 0x02C9, 11}, { 0x1F23, 13}, { 0x3B47, 14}, { 0x0007,  5},
-{ 0x01D8,  9}, { 0x02D8, 11}, { 0x1F27, 13}, { 0x3494, 14}, { 0x0035,  6}, { 0x03E1, 10},
-{ 0x059C, 12}, { 0x38C3, 14}, { 0x000C,  6}, { 0x0165, 10}, { 0x1D23, 13}, { 0x1638, 14},
-{ 0x0068,  7}, { 0x0693, 11}, { 0x3A45, 14}, { 0x0020,  7}, { 0x0F90, 12}, { 0x7CF6, 15},
-{ 0x00E8,  8}, { 0x058F, 12}, { 0x2CEF, 15}, { 0x0045,  8}, { 0x0B3A, 13}, { 0x01F1,  9},
-{ 0x3B46, 14}, { 0x01A7,  9}, { 0x1676, 14}, { 0x0056,  9}, { 0x692A, 15}, { 0x038D, 10},
-{ 0xE309, 16}, { 0x00AA, 10}, { 0x1C611, 17}, { 0x02DF, 11}, { 0xB3B9, 17}, { 0x02C8, 11},
-{ 0x38C20, 18}, { 0x01B0, 11}, { 0x16390, 18}, { 0x0F9F, 12}, { 0x16771, 18}, { 0x0ED0, 12},
-{ 0x71843, 19}, { 0x0D2A, 12}, { 0xF9E8C, 20}, { 0x0461, 12}, { 0xF9E8E, 20}, { 0x0B67, 13},
-{ 0x055F, 13}, { 0x003F,  6}, { 0x006D,  9}, { 0x0E90, 12}, { 0x054E, 13}, { 0x0013,  6},
-{ 0x0119, 10}, { 0x0B66, 13}, { 0x000B,  6}, { 0x0235, 11}, { 0x7CF5, 15}, { 0x0075,  7},
-{ 0x0D24, 12}, { 0xF9E9, 16}, { 0x002E,  7}, { 0x1F22, 13}, { 0x0021,  7}, { 0x054F, 13},
-{ 0x0014,  7}, { 0x3A44, 14}, { 0x00E4,  8}, { 0x7CF7, 15}, { 0x005E,  8}, { 0x7185, 15},
-{ 0x0037,  8}, { 0x2C73, 15}, { 0x01DB,  9}, { 0x59DD, 16}, { 0x01C7,  9}, { 0x692B, 15},
-{ 0x01A6,  9}, { 0x58E5, 16}, { 0x00B4,  9}, { 0x1F3D0, 17}, { 0x00B0,  9}, { 0xB1C9, 17},
-{ 0x03E6, 10}, { 0x16770, 18}, { 0x016E, 10}, { 0x3E7A2, 18}, { 0x011B, 10}, { 0xF9E8D, 20},
-{ 0x00D9, 10}, { 0xF9E8F, 20}, { 0x00A8, 10}, { 0x2C723, 19}, { 0x0749, 11}, { 0xE3084, 20},
-{ 0x0696, 11}, { 0x58E45, 20}, { 0x02DE, 11}, { 0xB1C88, 21}, { 0x0231, 11}, { 0x1C610A, 21},
-{ 0x01B1, 11}, { 0x71842D, 23}, { 0x0D2B, 12}, { 0x38C217, 22}, { 0x0D2F, 12}, { 0x163913, 22},
-{ 0x05B2, 12}, { 0x163912, 22}, { 0x0469, 12}, { 0x71842C, 23}, { 0x1A42, 13}, { 0x08C1, 13},
-{ 0x0073,  7}
-}
-};
-
-/* which indexes point to last=1 entries in tables */
-static const int vc1_last_decode_table[AC_MODES] = {
-    119, 99, 85, 81, 67, 58, 126, 109
-};
-
-static const uint8_t vc1_index_decode_table[AC_MODES][185][2] = {
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  0, 13}, {  0, 14}, {  0, 15}, {  0, 16},
-{  0, 17}, {  0, 18}, {  0, 19}, {  1,  1}, {  1,  2}, {  1,  3}, {  1,  4}, {  1,  5},
-{  1,  6}, {  1,  7}, {  1,  8}, {  1,  9}, {  1, 10}, {  1, 11}, {  1, 12}, {  1, 13},
-{  1, 14}, {  1, 15}, {  2,  1}, {  2,  2}, {  2,  3}, {  2,  4}, {  2,  5}, {  2,  6},
-{  2,  7}, {  2,  8}, {  2,  9}, {  2, 10}, {  2, 11}, {  2, 12}, {  3,  1}, {  3,  2},
-{  3,  3}, {  3,  4}, {  3,  5}, {  3,  6}, {  3,  7}, {  3,  8}, {  3,  9}, {  3, 10},
-{  3, 11}, {  4,  1}, {  4,  2}, {  4,  3}, {  4,  4}, {  4,  5}, {  4,  6}, {  5,  1},
-{  5,  2}, {  5,  3}, {  5,  4}, {  5,  5}, {  6,  1}, {  6,  2}, {  6,  3}, {  6,  4},
-{  7,  1}, {  7,  2}, {  7,  3}, {  7,  4}, {  8,  1}, {  8,  2}, {  8,  3}, {  8,  4},
-{  9,  1}, {  9,  2}, {  9,  3}, {  9,  4}, { 10,  1}, { 10,  2}, { 10,  3}, { 11,  1},
-{ 11,  2}, { 11,  3}, { 12,  1}, { 12,  2}, { 12,  3}, { 13,  1}, { 13,  2}, { 13,  3},
-{ 14,  1}, { 14,  2}, { 14,  3}, { 15,  1}, { 15,  2}, { 15,  3}, { 16,  1}, { 16,  2},
-{ 17,  1}, { 17,  2}, { 18,  1}, { 19,  1}, { 20,  1}, { 21,  1}, { 22,  1}, { 23,  1},
-{ 24,  1}, { 25,  1}, { 26,  1}, { 27,  1}, { 28,  1}, { 29,  1}, { 30,  1}, {  0,  1},
-{  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  1,  1}, {  1,  2}, {  1,  3},
-{  1,  4}, {  1,  5}, {  2,  1}, {  2,  2}, {  2,  3}, {  2,  4}, {  3,  1}, {  3,  2},
-{  3,  3}, {  3,  4}, {  4,  1}, {  4,  2}, {  4,  3}, {  5,  1}, {  5,  2}, {  6,  1},
-{  6,  2}, {  7,  1}, {  7,  2}, {  8,  1}, {  8,  2}, {  9,  1}, {  9,  2}, { 10,  1},
-{ 10,  2}, { 11,  1}, { 11,  2}, { 12,  1}, { 12,  2}, { 13,  1}, { 13,  2}, { 14,  1},
-{ 14,  2}, { 15,  1}, { 15,  2}, { 16,  1}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1},
-{ 21,  1}, { 22,  1}, { 23,  1}, { 24,  1}, { 25,  1}, { 26,  1}, { 27,  1}, { 28,  1},
-{ 29,  1}, { 30,  1}, { 31,  1}, { 32,  1}, { 33,  1}, { 34,  1}, { 35,  1}, { 36,  1},
-{ 37,  1}
-},
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  0, 13}, {  0, 14}, {  0, 15}, {  0, 16},
-{  0, 17}, {  0, 18}, {  0, 19}, {  0, 20}, {  0, 21}, {  0, 22}, {  0, 23}, {  1,  1},
-{  1,  2}, {  1,  3}, {  1,  4}, {  1,  5}, {  1,  6}, {  1,  7}, {  1,  8}, {  1,  9},
-{  1, 10}, {  1, 11}, {  2,  1}, {  2,  2}, {  2,  3}, {  2,  4}, {  2,  5}, {  2,  6},
-{  2,  7}, {  2,  8}, {  3,  1}, {  3,  2}, {  3,  3}, {  3,  4}, {  3,  5}, {  3,  6},
-{  3,  7}, {  4,  1}, {  4,  2}, {  4,  3}, {  4,  4}, {  4,  5}, {  5,  1}, {  5,  2},
-{  5,  3}, {  5,  4}, {  5,  5}, {  6,  1}, {  6,  2}, {  6,  3}, {  6,  4}, {  7,  1},
-{  7,  2}, {  7,  3}, {  7,  4}, {  8,  1}, {  8,  2}, {  8,  3}, {  9,  1}, {  9,  2},
-{  9,  3}, { 10,  1}, { 10,  2}, { 10,  3}, { 11,  1}, { 11,  2}, { 11,  3}, { 12,  1},
-{ 12,  2}, { 13,  1}, { 13,  2}, { 14,  1}, { 14,  2}, { 15,  1}, { 15,  2}, { 16,  1},
-{ 16,  2}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1}, { 21,  1}, { 22,  1}, { 23,  1},
-{ 24,  1}, { 25,  1}, { 26,  1}, {  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5},
-{  0,  6}, {  0,  7}, {  0,  8}, {  0,  9}, {  1,  1}, {  1,  2}, {  1,  3}, {  1,  4},
-{  1,  5}, {  2,  1}, {  2,  2}, {  2,  3}, {  2,  4}, {  3,  1}, {  3,  2}, {  3,  3},
-{  3,  4}, {  4,  1}, {  4,  2}, {  4,  3}, {  5,  1}, {  5,  2}, {  5,  3}, {  6,  1},
-{  6,  2}, {  6,  3}, {  7,  1}, {  7,  2}, {  8,  1}, {  8,  2}, {  9,  1}, {  9,  2},
-{ 10,  1}, { 10,  2}, { 11,  1}, { 11,  2}, { 12,  1}, { 12,  2}, { 13,  1}, { 13,  2},
-{ 14,  1}, { 14,  2}, { 15,  1}, { 16,  1}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1},
-{ 21,  1}, { 22,  1}, { 23,  1}, { 24,  1}, { 25,  1}, { 26,  1}, { 27,  1}, { 28,  1},
-{ 29,  1}, { 30,  1}, { 31,  1}, { 32,  1}, { 33,  1}, { 34,  1}, { 35,  1}, { 36,  1}
-},
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  0, 13}, {  0, 14}, {  0, 15}, {  0, 16},
-{  1,  1}, {  1,  2}, {  1,  3}, {  1,  4}, {  1,  5}, {  1,  6}, {  1,  7}, {  1,  8},
-{  1,  9}, {  1, 10}, {  1, 11}, {  2,  1}, {  2,  2}, {  2,  3}, {  2,  4}, {  2,  5},
-{  2,  6}, {  2,  7}, {  2,  8}, {  3,  1}, {  3,  2}, {  3,  3}, {  3,  4}, {  3,  5},
-{  3,  6}, {  3,  7}, {  4,  1}, {  4,  2}, {  4,  3}, {  4,  4}, {  4,  5}, {  5,  1},
-{  5,  2}, {  5,  3}, {  5,  4}, {  6,  1}, {  6,  2}, {  6,  3}, {  6,  4}, {  7,  1},
-{  7,  2}, {  7,  3}, {  8,  1}, {  8,  2}, {  8,  3}, {  9,  1}, {  9,  2}, {  9,  3},
-{ 10,  1}, { 10,  2}, { 10,  3}, { 11,  1}, { 11,  2}, { 11,  3}, { 12,  1}, { 12,  2},
-{ 12,  3}, { 13,  1}, { 13,  2}, { 13,  3}, { 14,  1}, { 14,  2}, { 15,  1}, { 15,  2},
-{ 16,  1}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1}, {  0,  1}, {  0,  2}, {  0,  3},
-{  0,  4}, {  1,  1}, {  1,  2}, {  1,  3}, {  1,  4}, {  2,  1}, {  2,  2}, {  2,  3},
-{  3,  1}, {  3,  2}, {  3,  3}, {  4,  1}, {  4,  2}, {  5,  1}, {  5,  2}, {  6,  1},
-{  6,  2}, {  7,  1}, {  7,  2}, {  8,  1}, {  8,  2}, {  9,  1}, {  9,  2}, { 10,  1},
-{ 10,  2}, { 11,  1}, { 11,  2}, { 12,  1}, { 12,  2}, { 13,  1}, { 13,  2}, { 14,  1},
-{ 15,  1}, { 16,  1}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1}, { 21,  1}, { 22,  1},
-{ 23,  1}, { 24,  1}, { 25,  1}, { 26,  1}
-},
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  0, 13}, {  0, 14}, {  1,  1}, {  1,  2},
-{  1,  3}, {  1,  4}, {  1,  5}, {  1,  6}, {  1,  7}, {  1,  8}, {  1,  9}, {  2,  1},
-{  2,  2}, {  2,  3}, {  2,  4}, {  2,  5}, {  3,  1}, {  3,  2}, {  3,  3}, {  3,  4},
-{  4,  1}, {  4,  2}, {  4,  3}, {  4,  4}, {  5,  1}, {  5,  2}, {  5,  3}, {  5,  4},
-{  6,  1}, {  6,  2}, {  6,  3}, {  7,  1}, {  7,  2}, {  7,  3}, {  8,  1}, {  8,  2},
-{  8,  3}, {  9,  1}, {  9,  2}, {  9,  3}, { 10,  1}, { 10,  2}, { 10,  3}, { 11,  1},
-{ 11,  2}, { 11,  3}, { 12,  1}, { 12,  2}, { 12,  3}, { 13,  1}, { 13,  2}, { 14,  1},
-{ 14,  2}, { 15,  1}, { 15,  2}, { 16,  1}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1},
-{ 21,  1}, { 22,  1}, { 23,  1}, { 24,  1}, { 25,  1}, { 26,  1}, { 27,  1}, { 28,  1},
-{ 29,  1}, {  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  1,  1}, {  1,  2},
-{  1,  3}, {  1,  4}, {  2,  1}, {  2,  2}, {  2,  3}, {  3,  1}, {  3,  2}, {  3,  3},
-{  4,  1}, {  4,  2}, {  5,  1}, {  5,  2}, {  6,  1}, {  6,  2}, {  7,  1}, {  7,  2},
-{  8,  1}, {  8,  2}, {  9,  1}, {  9,  2}, { 10,  1}, { 10,  2}, { 11,  1}, { 11,  2},
-{ 12,  1}, { 12,  2}, { 13,  1}, { 13,  2}, { 14,  1}, { 14,  2}, { 15,  1}, { 15,  2},
-{ 16,  1}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1}, { 21,  1}, { 22,  1}, { 23,  1},
-{ 24,  1}, { 25,  1}, { 26,  1}, { 27,  1}, { 28,  1}, { 29,  1}, { 30,  1}, { 31,  1},
-{ 32,  1}, { 33,  1}, { 34,  1}, { 35,  1}, { 36,  1}, { 37,  1}, { 38,  1}, { 39,  1},
-{ 40,  1}, { 41,  1}, { 42,  1}, { 43,  1}
-},
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  0, 13}, {  0, 14}, {  0, 15}, {  0, 16},
-{  0, 17}, {  0, 18}, {  0, 19}, {  0, 20}, {  0, 21}, {  0, 22}, {  0, 23}, {  0, 24},
-{  0, 25}, {  0, 26}, {  0, 27}, {  1,  1}, {  1,  2}, {  1,  3}, {  1,  4}, {  1,  5},
-{  1,  6}, {  1,  7}, {  1,  8}, {  1,  9}, {  1, 10}, {  2,  1}, {  2,  2}, {  2,  3},
-{  2,  4}, {  2,  5}, {  3,  1}, {  3,  2}, {  3,  3}, {  3,  4}, {  4,  1}, {  4,  2},
-{  4,  3}, {  5,  1}, {  5,  2}, {  5,  3}, {  6,  1}, {  6,  2}, {  6,  3}, {  7,  1},
-{  7,  2}, {  7,  3}, {  8,  1}, {  8,  2}, {  9,  1}, {  9,  2}, { 10,  1}, { 11,  1},
-{ 12,  1}, { 13,  1}, { 14,  1}, {  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5},
-{  0,  6}, {  0,  7}, {  0,  8}, {  1,  1}, {  1,  2}, {  1,  3}, {  2,  1}, {  2,  2},
-{  3,  1}, {  3,  2}, {  4,  1}, {  4,  2}, {  5,  1}, {  5,  2}, {  6,  1}, {  6,  2},
-{  7,  1}, {  8,  1}, {  9,  1}, { 10,  1}, { 11,  1}, { 12,  1}, { 13,  1}, { 14,  1},
-{ 15,  1}, { 16,  1}, { 17,  1}, { 18,  1}, { 19,  1}, { 20,  1}
-},
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  1,  1}, {  1,  2}, {  1,  3}, {  1,  4},
-{  1,  5}, {  1,  6}, {  2,  1}, {  2,  2}, {  2,  3}, {  2,  4}, {  3,  1}, {  3,  2},
-{  3,  3}, {  4,  1}, {  4,  2}, {  4,  3}, {  5,  1}, {  5,  2}, {  5,  3}, {  6,  1},
-{  6,  2}, {  6,  3}, {  7,  1}, {  7,  2}, {  8,  1}, {  8,  2}, {  9,  1}, {  9,  2},
-{ 10,  1}, { 10,  2}, { 11,  1}, { 12,  1}, { 13,  1}, { 14,  1}, { 15,  1}, { 16,  1},
-{ 17,  1}, { 18,  1}, { 19,  1}, { 20,  1}, { 21,  1}, { 22,  1}, { 23,  1}, { 24,  1},
-{ 25,  1}, { 26,  1}, {  0,  1}, {  0,  2}, {  0,  3}, {  1,  1}, {  1,  2}, {  2,  1},
-{  3,  1}, {  4,  1}, {  5,  1}, {  6,  1}, {  7,  1}, {  8,  1}, {  9,  1}, { 10,  1},
-{ 11,  1}, { 12,  1}, { 13,  1}, { 14,  1}, { 15,  1}, { 16,  1}, { 17,  1}, { 18,  1},
-{ 19,  1}, { 20,  1}, { 21,  1}, { 22,  1}, { 23,  1}, { 24,  1}, { 25,  1}, { 26,  1},
-{ 27,  1}, { 28,  1}, { 29,  1}, { 30,  1}, { 31,  1}, { 32,  1}, { 33,  1}, { 34,  1},
-{ 35,  1}, { 36,  1}, { 37,  1}, { 38,  1}, { 39,  1}, { 40,  1}
-},
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  0, 13}, {  0, 14}, {  0, 15}, {  0, 16},
-{  0, 17}, {  0, 18}, {  0, 19}, {  0, 20}, {  0, 21}, {  0, 22}, {  0, 23}, {  0, 24},
-{  0, 25}, {  0, 26}, {  0, 27}, {  0, 28}, {  0, 29}, {  0, 30}, {  0, 31}, {  0, 32},
-{  0, 33}, {  0, 34}, {  0, 35}, {  0, 36}, {  0, 37}, {  0, 38}, {  0, 39}, {  0, 40},
-{  0, 41}, {  0, 42}, {  0, 43}, {  0, 44}, {  0, 45}, {  0, 46}, {  0, 47}, {  0, 48},
-{  0, 49}, {  0, 50}, {  0, 51}, {  0, 52}, {  0, 53}, {  0, 54}, {  0, 55}, {  0, 56},
-{  1,  1}, {  1,  2}, {  1,  3}, {  1,  4}, {  1,  5}, {  1,  6}, {  1,  7}, {  1,  8},
-{  1,  9}, {  1, 10}, {  1, 11}, {  1, 12}, {  1, 13}, {  1, 14}, {  1, 15}, {  1, 16},
-{  1, 17}, {  1, 18}, {  1, 19}, {  1, 20}, {  2,  1}, {  2,  2}, {  2,  3}, {  2,  4},
-{  2,  5}, {  2,  6}, {  2,  7}, {  2,  8}, {  2,  9}, {  2, 10}, {  3,  1}, {  3,  2},
-{  3,  3}, {  3,  4}, {  3,  5}, {  3,  6}, {  3,  7}, {  4,  1}, {  4,  2}, {  4,  3},
-{  4,  4}, {  4,  5}, {  4,  6}, {  5,  1}, {  5,  2}, {  5,  3}, {  5,  4}, {  5,  5},
-{  6,  1}, {  6,  2}, {  6,  3}, {  6,  4}, {  7,  1}, {  7,  2}, {  7,  3}, {  8,  1},
-{  8,  2}, {  8,  3}, {  9,  1}, {  9,  2}, {  9,  3}, { 10,  1}, { 10,  2}, { 11,  1},
-{ 11,  2}, { 12,  1}, { 12,  2}, { 13,  1}, { 13,  2}, { 14,  1}, {  0,  1}, {  0,  2},
-{  0,  3}, {  0,  4}, {  1,  1}, {  1,  2}, {  1,  3}, {  2,  1}, {  2,  2}, {  2,  3},
-{  3,  1}, {  3,  2}, {  4,  1}, {  4,  2}, {  5,  1}, {  5,  2}, {  6,  1}, {  6,  2},
-{  7,  1}, {  7,  2}, {  8,  1}, {  8,  2}, {  9,  1}, {  9,  2}, { 10,  1}, { 10,  2},
-{ 11,  1}, { 11,  2}, { 12,  1}, { 12,  2}, { 13,  1}, { 13,  2}, { 14,  1}, { 14,  2},
-{ 15,  1}, { 16,  1}
-},
-{
-{  0,  1}, {  0,  2}, {  0,  3}, {  0,  4}, {  0,  5}, {  0,  6}, {  0,  7}, {  0,  8},
-{  0,  9}, {  0, 10}, {  0, 11}, {  0, 12}, {  0, 13}, {  0, 14}, {  0, 15}, {  0, 16},
-{  0, 17}, {  0, 18}, {  0, 19}, {  0, 20}, {  0, 21}, {  0, 22}, {  0, 23}, {  0, 24},
-{  0, 25}, {  0, 26}, {  0, 27}, {  0, 28}, {  0, 29}, {  0, 30}, {  0, 31}, {  0, 32},
-{  1,  1}, {  1,  2}, {  1,  3}, {  1,  4}, {  1,  5}, {  1,  6}, {  1,  7}, {  1,  8},
-{  1,  9}, {  1, 10}, {  1, 11}, {  1, 12}, {  1, 13}, {  2,  1}, {  2,  2}, {  2,  3},
-{  2,  4}, {  2,  5}, {  2,  6}, {  2,  7}, {  2,  8}, {  3,  1}, {  3,  2}, {  3,  3},
-{  3,  4}, {  3,  5}, {  3,  6}, {  4,  1}, {  4,  2}, {  4,  3}, {  4,  4}, {  4,  5},
-{  5,  1}, {  5,  2}, {  5,  3}, {  5,  4}, {  6,  1}, {  6,  2}, {  6,  3}, {  6,  4},
-{  7,  1}, {  7,  2}, {  7,  3}, {  8,  1}, {  8,  2}, {  8,  3}, {  9,  1}, {  9,  2},
-{  9,  3}, { 10,  1}, { 10,  2}, { 11,  1}, { 11,  2}, { 12,  1}, { 12,  2}, { 13,  1},
-{ 13,  2}, { 14,  1}, { 14,  2}, { 15,  1}, { 15,  2}, { 16,  1}, { 16,  2}, { 17,  1},
-{ 17,  2}, { 18,  1}, { 18,  2}, { 19,  1}, { 19,  2}, { 20,  1}, { 20,  2}, { 21,  1},
-{ 21,  2}, { 22,  1}, { 22,  2}, { 23,  1}, { 24,  1}, {  0,  1}, {  0,  2}, {  0,  3},
-{  0,  4}, {  1,  1}, {  1,  2}, {  1,  3}, {  2,  1}, {  2,  2}, {  2,  3}, {  3,  1},
-{  3,  2}, {  3,  3}, {  4,  1}, {  4,  2}, {  5,  1}, {  5,  2}, {  6,  1}, {  6,  2},
-{  7,  1}, {  7,  2}, {  8,  1}, {  8,  2}, {  9,  1}, {  9,  2}, { 10,  1}, { 10,  2},
-{ 11,  1}, { 11,  2}, { 12,  1}, { 12,  2}, { 13,  1}, { 13,  2}, { 14,  1}, { 14,  2},
-{ 15,  1}, { 15,  2}, { 16,  1}, { 16,  2}, { 17,  1}, { 17,  2}, { 18,  1}, { 18,  2},
-{ 19,  1}, { 19,  2}, { 20,  1}, { 20,  2}, { 21,  1}, { 21,  2}, { 22,  1}, { 22,  2},
-{ 23,  1}, { 23,  2}, { 24,  1}, { 24,  2}, { 25,  1}, { 25,  2}, { 26,  1}, { 26,  2},
-{ 27,  1}, { 27,  2}, { 28,  1}, { 28,  2}, { 29,  1}, { 30,  1}
-}
-};
-
-static const uint8_t vc1_delta_level_table[AC_MODES][31] = {
-{
-      19,    15,    12,    11,     6,     5,     4,     4,     4,     4,
-       3,     3,     3,     3,     3,     3,     2,     2,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1
-},
-{
-      23,    11,     8,     7,     5,     5,     4,     4,     3,     3,
-       3,     3,     2,     2,     2,     2,     2,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1
-},
-{
-      16,    11,     8,     7,     5,     4,     4,     3,     3,     3,
-       3,     3,     3,     3,     2,     2,     1,     1,     1,     1,
-       1
-},
-{
-      14,     9,     5,     4,     4,     4,     3,     3,     3,     3,
-       3,     3,     3,     2,     2,     2,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1
-},
-{
-      27,    10,     5,     4,     3,     3,     3,     3,     2,     2,
-       1,     1,     1,     1,     1
-},
-{
-      12,     6,     4,     3,     3,     3,     3,     2,     2,     2,
-       2,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1
-},
-{
-      56,    20,    10,     7,     6,     5,     4,     3,     3,     3,
-       2,     2,     2,     2,     1
-},
-{
-      32,    13,     8,     6,     5,     4,     4,     3,     3,     3,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     1,     1
-}
-};
-
-static const uint8_t vc1_last_delta_level_table[AC_MODES][44] = {
-{
-       6,     5,     4,     4,     3,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1
-},
-{
-       9,     5,     4,     4,     3,     3,     3,     2,     2,     2,
-       2,     2,     2,     2,     2,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1
-},
-{
-       4,     4,     3,     3,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1
-},
-{
-       5,     4,     3,     3,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1
-},
-{
-       8,     3,     2,     2,     2,     2,     2,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1
-},
-{
-       3,     2,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1
-},
-{
-       4,     3,     3,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     1,     1
-},
-{
-       4,     3,     3,     3,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     1,
-       1
-}
-};
-
-static const uint8_t vc1_delta_run_table[AC_MODES][57] = {
-{
-      -1,    30,    17,    15,     9,     5,     4,     3,     3,     3,
-       3,     3,     2,     1,     1,     1,     0,     0,     0,
-       0
-},
-{
-      -1,    26,    16,    11,     7,     5,     3,     3,     2,     1,
-       1,     1,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0
-},
-{
-      -1,    20,    15,    13,     6,     4,     3,     3,     2,     1,
-       1,     1,     0,     0,     0,     0,     0
-},
-{
-      -1,    29,    15,    12,     5,     2,     1,     1,     1,     1,
-       0,     0,     0,     0,     0
-},
-{
-      -1,    14,     9,     7,     3,     2,     1,     1,     1,     1,
-       1,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0
-},
-{
-      -1,    26,    10,     6,     2,     1,     1,     0,     0,     0,
-       0,     0,     0
-},
-{
-      -1,    14,    13,     9,     6,     5,     4,     3,     2,     2,
-       2,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0
-},
-{
-      -1,    24,    22,     9,     6,     4,     3,     2,     2,     1,
-       1,     1,     1,     1,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0
-}
-};
-
-static const uint8_t vc1_last_delta_run_table[AC_MODES][10] = {
-{
-      -1,    37,    15,     4,     3,     1,     0
-},
-{
-      -1,    36,    14,     6,     3,     1,     0,     0,     0,
-       0
-},
-{
-      -1,    26,    13,     3,     1
-},
-{
-      -1,    43,    15,     3,     1,     0
-},
-{
-      -1,    20,     6,     1,     0,     0,     0,     0,     0
-},
-{
-      -1,    40,     1,     0
-},
-{
-      -1,    16,    14,     2,     0
-},
-{
-      -1,    30,    28,     3,     0
-}
-};
-
-#endif /* AVCODEC_VC1ACDATA_H */
diff --git a/libavcodec/vc1data.c b/libavcodec/vc1data.c
deleted file mode 100644
index 5298079..0000000
--- a/libavcodec/vc1data.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * VC-1 and WMV3 decoder
- * copyright (c) 2006 Konstantin Shishkov
- * (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VC-1 tables.
- */
-
-#include "avcodec.h"
-#include "vc1.h"
-#include "vc1data.h"
-
-/** Table for conversion between TTBLK and TTMB */
-const int ff_vc1_ttblk_to_tt[3][8] = {
-  { TT_8X4, TT_4X8, TT_8X8, TT_4X4, TT_8X4_TOP, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT },
-  { TT_8X8, TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X4, TT_8X4, TT_4X8, TT_8X4_BOTTOM, TT_8X4_TOP },
-  { TT_8X8, TT_4X8, TT_4X4, TT_8X4_BOTTOM, TT_4X8_RIGHT, TT_4X8_LEFT, TT_8X4, TT_8X4_TOP }
-};
-
-const int ff_vc1_ttfrm_to_tt[4] = { TT_8X8, TT_8X4, TT_4X8, TT_4X4 };
-
-/** MV P mode - the 5th element is only used for mode 1 */
-const uint8_t ff_vc1_mv_pmode_table[2][5] = {
-  { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_MIXED_MV },
-  { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_INTENSITY_COMP, MV_PMODE_1MV_HPEL_BILIN }
-};
-const uint8_t ff_vc1_mv_pmode_table2[2][4] = {
-  { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV },
-  { MV_PMODE_1MV, MV_PMODE_MIXED_MV, MV_PMODE_1MV_HPEL, MV_PMODE_1MV_HPEL_BILIN }
-};
-
-const int ff_vc1_fps_nr[5] = { 24, 25, 30, 50, 60 },
-  ff_vc1_fps_dr[2] = { 1000, 1001 };
-const uint8_t ff_vc1_pquant_table[3][32] = {
-  {  /* Implicit quantizer */
-     0,  1,  2,  3,  4,  5,  6,  7,  8,  6,  7,  8,  9, 10, 11, 12,
-    13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31
-  },
-  {  /* Explicit quantizer, pquantizer uniform */
-     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
-  },
-  {  /* Explicit quantizer, pquantizer non-uniform */
-     0,  1,  1,  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, 29, 31
-  }
-};
-
-/** @name VC-1 VLC tables and defines
- *  @todo TODO move this into the context
- */
-//@{
-#define VC1_BFRACTION_VLC_BITS 7
-VLC ff_vc1_bfraction_vlc;
-#define VC1_IMODE_VLC_BITS 4
-VLC ff_vc1_imode_vlc;
-#define VC1_NORM2_VLC_BITS 3
-VLC ff_vc1_norm2_vlc;
-#define VC1_NORM6_VLC_BITS 9
-VLC ff_vc1_norm6_vlc;
-/* Could be optimized, one table only needs 8 bits */
-#define VC1_TTMB_VLC_BITS 9 //12
-VLC ff_vc1_ttmb_vlc[3];
-#define VC1_MV_DIFF_VLC_BITS 9 //15
-VLC ff_vc1_mv_diff_vlc[4];
-#define VC1_CBPCY_P_VLC_BITS 9 //14
-VLC ff_vc1_cbpcy_p_vlc[4];
-#define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
-VLC ff_vc1_4mv_block_pattern_vlc[4];
-#define VC1_TTBLK_VLC_BITS 5
-VLC ff_vc1_ttblk_vlc[3];
-#define VC1_SUBBLKPAT_VLC_BITS 6
-VLC ff_vc1_subblkpat_vlc[3];
-
-VLC ff_vc1_ac_coeff_table[8];
-//@}
-
-
-#if B_FRACTION_DEN==840 //original bfraction from vc9data.h, not conforming to standard
-/* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
-const int16_t ff_vc1_bfraction_lut[23] = {
-  420 /*1/2*/, 280 /*1/3*/, 560 /*2/3*/, 210 /*1/4*/,
-  630 /*3/4*/, 168 /*1/5*/, 336 /*2/5*/,
-  504 /*3/5*/, 672 /*4/5*/, 140 /*1/6*/, 700 /*5/6*/,
-  120 /*1/7*/, 240 /*2/7*/, 360 /*3/7*/, 480 /*4/7*/,
-  600 /*5/7*/, 720 /*6/7*/, 105 /*1/8*/, 315 /*3/8*/,
-  525 /*5/8*/, 735 /*7/8*/,
-  -1 /*inv.*/, 0 /*BI fm*/
-};
-#else
-/* pre-computed scales for all bfractions and base=256 */
-const int16_t ff_vc1_bfraction_lut[23] = {
-  128 /*1/2*/,  85 /*1/3*/, 170 /*2/3*/,  64 /*1/4*/,
-  192 /*3/4*/,  51 /*1/5*/, 102 /*2/5*/,
-  153 /*3/5*/, 204 /*4/5*/,  43 /*1/6*/, 215 /*5/6*/,
-   37 /*1/7*/,  74 /*2/7*/, 111 /*3/7*/, 148 /*4/7*/,
-  185 /*5/7*/, 222 /*6/7*/,  32 /*1/8*/,  96 /*3/8*/,
-  160 /*5/8*/, 224 /*7/8*/,
-  -1 /*inv.*/, 0 /*BI fm*/
-};
-#endif
-
-const uint8_t ff_vc1_bfraction_bits[23] = {
-    3, 3, 3, 3,
-    3, 3, 3,
-    7, 7, 7, 7,
-    7, 7, 7, 7,
-    7, 7, 7, 7,
-    7, 7,
-    7, 7
-};
-const uint8_t ff_vc1_bfraction_codes[23] = {
-     0,   1,   2,   3,
-     4,   5,   6,
-   112, 113, 114, 115,
-   116, 117, 118, 119,
-   120, 121, 122, 123,
-   124, 125,
-   126, 127
-};
-
-//Same as H.264
-const AVRational ff_vc1_pixel_aspect[16]={
- {0, 1},
- {1, 1},
- {12, 11},
- {10, 11},
- {16, 11},
- {40, 33},
- {24, 11},
- {20, 11},
- {32, 11},
- {80, 33},
- {18, 11},
- {15, 11},
- {64, 33},
- {160, 99},
- {0, 1},
- {0, 1}
-};
-
-/* BitPlane IMODE - such a small table... */
-const uint8_t ff_vc1_imode_codes[7] = {
-  0, 2, 1, 3, 1, 2, 3
-};
-const uint8_t ff_vc1_imode_bits[7] = {
-  4, 2, 3, 2, 4, 3, 3
-};
-
-/* Normal-2 imode */
-const uint8_t ff_vc1_norm2_codes[4] = {
-  0, 4, 5, 3
-};
-const uint8_t ff_vc1_norm2_bits[4] = {
-  1, 3, 3, 2
-};
-
-const uint16_t ff_vc1_norm6_codes[64] = {
-0x001, 0x002, 0x003, 0x000, 0x004, 0x001, 0x002, 0x047, 0x005, 0x003, 0x004, 0x04B, 0x005, 0x04D, 0x04E, 0x30E,
-0x006, 0x006, 0x007, 0x053, 0x008, 0x055, 0x056, 0x30D, 0x009, 0x059, 0x05A, 0x30C, 0x05C, 0x30B, 0x30A, 0x037,
-0x007, 0x00A, 0x00B, 0x043, 0x00C, 0x045, 0x046, 0x309, 0x00D, 0x049, 0x04A, 0x308, 0x04C, 0x307, 0x306, 0x036,
-0x00E, 0x051, 0x052, 0x305, 0x054, 0x304, 0x303, 0x035, 0x058, 0x302, 0x301, 0x034, 0x300, 0x033, 0x032, 0x007,
-};
-
-const uint8_t ff_vc1_norm6_bits[64] = {
- 1,  4,  4,  8,  4,  8,  8, 10,  4,  8,  8, 10,  8, 10, 10, 13,
- 4,  8,  8, 10,  8, 10, 10, 13,  8, 10, 10, 13, 10, 13, 13,  9,
- 4,  8,  8, 10,  8, 10, 10, 13,  8, 10, 10, 13, 10, 13, 13,  9,
- 8, 10, 10, 13, 10, 13, 13,  9, 10, 13, 13,  9, 13,  9,  9,  6,
-};
-#if 0
-/* Normal-6 imode */
-const uint8_t ff_vc1_norm6_spec[64][5] = {
-{ 0,  1, 1        },
-{ 1,  2, 4        },
-{ 2,  3, 4        },
-{ 3,  0, 8        },
-{ 4,  4, 4        },
-{ 5,  1, 8        },
-{ 6,  2, 8        },
-{ 7,  2, 5,  7, 5 },
-{ 8,  5, 4        },
-{ 9,  3, 8        },
-{10,  4, 8        },
-{11,  2, 5, 11, 5 },
-{12,  5, 8        },
-{13,  2, 5, 13, 5 },
-{14,  2, 5, 14, 5 },
-{15,  3, 5, 14, 8 },
-{16,  6, 4        },
-{17,  6, 8        },
-{18,  7, 8        },
-{19,  2, 5, 19, 5 },
-{20,  8, 8        },
-{21,  2, 5, 21, 5 },
-{22,  2, 5, 22, 5 },
-{23,  3, 5, 13, 8 },
-{24,  9, 8        },
-{25,  2, 5, 25, 5 },
-{26,  2, 5, 26, 5 },
-{27,  3, 5, 12, 8 },
-{28,  2, 5, 28, 5 },
-{29,  3, 5, 11, 8 },
-{30,  3, 5, 10, 8 },
-{31,  3, 5,  7, 4 },
-{32,  7, 4        },
-{33, 10, 8        },
-{34, 11, 8        },
-{35,  2, 5,  3, 5 },
-{36, 12, 8        },
-{37,  2, 5,  5, 5 },
-{38,  2, 5,  6, 5 },
-{39,  3, 5,  9, 8 },
-{40, 13, 8        },
-{41,  2, 5,  9, 5 },
-{42,  2, 5, 10, 5 },
-{43,  3, 5,  8, 8 },
-{44,  2, 5, 12, 5 },
-{45,  3, 5,  7, 8 },
-{46,  3, 5,  6, 8 },
-{47,  3, 5,  6, 4 },
-{48, 14, 8        },
-{49,  2, 5, 17, 5 },
-{50,  2, 5, 18, 5 },
-{51,  3, 5,  5, 8 },
-{52,  2, 5, 20, 5 },
-{53,  3, 5,  4, 8 },
-{54,  3, 5,  3, 8 },
-{55,  3, 5,  5, 4 },
-{56,  2, 5, 24, 5 },
-{57,  3, 5,  2, 8 },
-{58,  3, 5,  1, 8 },
-{59,  3, 5,  4, 4 },
-{60,  3, 5,  0, 8 },
-{61,  3, 5,  3, 4 },
-{62,  3, 5,  2, 4 },
-{63,  3, 5,  1, 1 },
-};
-#endif
-
-/* 4MV Block pattern VLC tables */
-const uint8_t ff_vc1_4mv_block_pattern_codes[4][16] = {
-  { 14, 58, 59, 25, 12, 26, 15, 15, 13, 24, 27,  0, 28,  1,  2,  2},
-  {  8, 18, 19,  4, 20,  5, 30, 11, 21, 31,  6, 12,  7, 13, 14,  0},
-  { 15,  6,  7,  2,  8,  3, 28,  9, 10, 29,  4, 11,  5, 12, 13,  0},
-  {  0, 11, 12,  4, 13,  5, 30, 16, 14, 31,  6, 17,  7, 18, 19, 10}
-};
-const uint8_t ff_vc1_4mv_block_pattern_bits[4][16] = {
-  { 5, 6, 6, 5, 5, 5, 5, 4, 5, 5, 5, 3, 5, 3, 3, 2},
-  { 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4, 4, 4, 4, 4, 2},
-  { 4, 4, 4, 4, 4, 4, 5, 4, 4, 5, 4, 4, 4, 4, 4, 3},
-  { 2, 4, 4, 4, 4, 4, 5, 5, 4, 5, 4, 5, 4, 5, 5, 4}
-};
-
-const uint8_t wmv3_dc_scale_table[32]={
-    0, 2, 4, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21
-};
-
-/* P-Picture CBPCY VLC tables */
-#if 1 // Looks like original tables are not conforming to standard at all. Are they used for old WMV?
-const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
-  {
-      0,   6,  15,  13,  13,  11,   3,  13,   5,   8,  49,  10,  12, 114, 102, 119,
-      1,  54,  96,   8,  10, 111,   5,  15,  12,  10,   2,  12,  13, 115,  53,  63,
-      1,   7,   1,   7,  14,  12,   4,  14,   1,   9,  97,  11,   7,  58,  52,  62,
-      4, 103,   1,   9,  11,  56, 101, 118,   4, 110, 100,  30,   2,   5,   4,   3
-  },
-  {
-      0,   9,   1,  18,   5,  14, 237,  26,   3, 121,   3,  22,  13,  16,   6,  30,
-      2,  10,   1,  20,  12, 241,   5,  28,  16,  12,   3,  24,  28, 124, 239, 247,
-      1, 240,   1,  19,  18,  15,   4,  27,   1, 122,   2,  23,   1,  17,   7,  31,
-      1,  11,   2,  21,  19, 246, 238,  29,  17,  13, 236,  25,  58,  63,   8, 125
-  },
-  {
-      0, 201,  25, 231,   5, 221,   1,   3,   2, 414,   2, 241,  16, 225, 195, 492,
-      2, 412,   1, 240,   7, 224,  98, 245,   1, 220,  96,   5,   9, 230, 101, 247,
-      1, 102,   1, 415,  24,   3,   2, 244,   3,  54,   3, 484,  17, 114, 200, 493,
-      3, 413,   1,   4,  13, 113,  99, 485,   4, 111, 194, 243,   5,  29,  26,  31
-  },
-  {
-      0,  28,  12,  44,   3,  36,  20,  52,   2,  32,  16,  48,   8,  40,  24,  28,
-      1,  30,  14,  46,   6,  38,  22,  54,   3,  34,  18,  50,  10,  42,  26,  30,
-      1,  29,  13,  45,   5,  37,  21,  53,   2,  33,  17,  49,   9,  41,  25,  29,
-      1,  31,  15,  47,   7,  39,  23,  55,   4,  35,  19,  51,  11,  43,  27,  31
-   }
-};
-
-const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
-  {
-    13,  13,   7,  13,   7,  13,  13,  12,   6,  13,   7,  12,   6,   8,   8,   8,
-     5,   7,   8,  12,   6,   8,  13,  12,   7,  13,  13,  12,   6,   8,   7,   7,
-     6,  13,   8,  12,   7,  13,  13,  12,   7,  13,   8,  12,   5,   7,   7,   7,
-     6,   8,  13,  12,   6,   7,   8,   8,   5,   8,   8,   6,   3,   3,   3,   2
-  },
-  {
-    14,  13,   8,  13,   3,  13,   8,  13,   3,   7,   8,  13,   4,  13,  13,  13,
-     3,  13,  13,  13,   4,   8,  13,  13,   5,  13,  13,  13,   5,   7,   8,   8,
-     3,   8,  14,  13,   5,  13,  13,  13,   4,   7,  13,  13,   6,  13,  13,  13,
-     5,  13,   8,  13,   5,   8,   8,  13,   5,  13,   8,  13,   6,   6,  13,   7
-  },
-  {
-    13,   8,   6,   8,   4,   8,  13,  12,   4,   9,   8,   8,   5,   8,   8,   9,
-     5,   9,  10,   8,   4,   8,   7,   8,   6,   8,   7,  13,   4,   8,   7,   8,
-     5,   7,   8,   9,   6,  13,  13,   8,   4,   6,   8,   9,   5,   7,   8,   9,
-     5,   9,   9,  13,   5,   7,   7,   9,   4,   7,   8,   8,   3,   5,   5,   5
-  },
-  {
-     9,   9,   9,   9,   2,   9,   9,   9,   2,   9,   9,   9,   9,   9,   9,   8,
-     3,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   8,
-     2,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   8,
-     9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   8
-  }
-};
-#else
-const uint16_t ff_vc1_cbpcy_p_codes[4][64] = {
-  {
-      0,   1,   1,   4,   5,   1,  12,   4,  13,  14,  10,  11,  12,   7,  13,   2,
-     15,   1,  96,   1,  49,  97,   2, 100,   3,   4,   5, 101, 102,  52,  53,   4,
-      6,   7,  54, 103,   8,   9,  10, 110,  11,  12, 111,  56, 114,  58, 115,   5,
-     13,   7,   8,   9,  10,  11,  12,  30,  13,  14,  15, 118, 119,  62,  63,   3
-  },
-  {
-      0,   1,   2,   1,   3,   1,  16,  17,   5,  18,  12,  19,  13,   1,  28,  58,
-      1,   1,   1,   2,   3,   2,   3, 236, 237,   4,   5, 238,   6,   7, 239,   8,
-      9, 240,  10,  11, 121, 122,  12,  13,  14,  15, 241, 246,  16,  17, 124,  63,
-     18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31, 247, 125
-  },
-  {
-      0,   1,   2,   3,   2,   3,   1,   4,   5,  24,   7,  13,  16,  17,   9,   5,
-     25,   1,   1,   1,   2,   3,  96, 194,   1,   2,  98,  99, 195, 200, 101,  26,
-    201, 102, 412, 413, 414,  54, 220, 111, 221,   3, 224, 113, 225, 114, 230,  29,
-    231, 415, 240,   4, 241, 484,   5, 243,   3, 244, 245, 485, 492, 493, 247,  31
-  },
-  {
-      0,   1,   1,   1,   2,   2,   3,   4,   3,   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,  28,  29,  30,  31
-   }
-};
-const uint8_t ff_vc1_cbpcy_p_bits[4][64] = {
-  {
-    13,  6,  5,  6,  6,  7,  7,  5,  7,  7,  6,  6,  6,  5,  6,  3,
-     7,  8,  8, 13,  7,  8, 13,  8, 13, 13, 13,  8,  8,  7,  7,  3,
-    13, 13,  7,  8, 13, 13, 13,  8, 13, 13,  8,  7,  8,  7,  8,  3,
-    13, 12, 12, 12, 12, 12, 12,  6, 12, 12, 12,  8,  8,  7,  7,  2
-  },
-  {
-    14,  3,  3,  5,  3,  4,  5,  5,  3,  5,  4,  5,  4,  6,  5,  6,
-     8, 14, 13,  8,  8, 13, 13,  8,  8, 13, 13,  8, 13, 13,  8, 13,
-    13,  8, 13, 13,  7,  7, 13, 13, 13, 13,  8,  8, 13, 13,  7,  6,
-    13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,  8,  7
-  },
-  {
-    13,  5,  5,  5,  4,  4,  6,  4,  4,  6,  4,  5,  5,  5,  4,  3,
-     6,  8, 10,  9,  8,  8,  7,  8, 13, 13,  7,  7,  8,  8,  7,  5,
-     8,  7,  9,  9,  9,  6,  8,  7,  8, 13,  8,  7,  8,  7,  8,  5,
-     8,  9,  8, 13,  8,  9, 13,  8, 12,  8,  8,  9,  9,  9,  8,  5
-  },
-  {
-     9,  2,  3,  9,  2,  9,  9,  9,  2,  9,  9,  9,  9,  9,  9,  9,
-     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  8,  8,  8,  8
-  }
-};
-#endif
-
-/* MacroBlock Transform Type: 7.1.3.11, p89
- * 8x8:B
- * 8x4:B:btm  8x4:B:top  8x4:B:both,
- * 4x8:B:right  4x8:B:left  4x8:B:both
- * 4x4:B  8x8:MB
- * 8x4:MB:btm  8x4:MB:top  8x4,MB,both
- * 4x8,MB,right  4x8,MB,left
- * 4x4,MB                               */
-const uint16_t ff_vc1_ttmb_codes[3][16] = {
-  {
-    0x0003,
-    0x002E, 0x005F, 0x0000,
-    0x0016, 0x0015, 0x0001,
-    0x0004, 0x0014,
-    0x02F1, 0x0179, 0x017B,
-    0x0BC0, 0x0BC1, 0x05E1,
-    0x017A
-  },
-  {
-    0x0006,
-    0x0006, 0x0003, 0x0007,
-    0x000F, 0x000E, 0x0000,
-    0x0002, 0x0002,
-    0x0014, 0x0011, 0x000B,
-    0x0009, 0x0021, 0x0015,
-    0x0020
-  },
-  {
-    0x0006,
-    0x0000, 0x000E, 0x0005,
-    0x0002, 0x0003, 0x0003,
-    0x000F, 0x0002,
-    0x0081, 0x0021, 0x0009,
-    0x0101, 0x0041, 0x0011,
-    0x0100
-  }
-};
-
-const uint8_t ff_vc1_ttmb_bits[3][16] = {
-  {
-     2,
-     6,  7,  2,
-     5,  5,  2,
-     3,  5,
-    10,  9,  9,
-    12, 12, 11,
-     9
-  },
-  {
-    3,
-    4, 4, 4,
-    4, 4, 3,
-    3, 2,
-    7, 7, 6,
-    6, 8, 7,
-    8
-  },
-  {
-     3,
-     3, 4, 5,
-     3, 3, 4,
-     4, 2,
-    10, 8, 6,
-    11, 9, 7,
-    11
-  }
-};
-
-/* TTBLK (Transform Type per Block) tables */
-const uint8_t ff_vc1_ttblk_codes[3][8] = {
-  {  0,  1,  3,  5, 16, 17, 18, 19},
-  {  3,  0,  1,  2,  3,  5,  8,  9},
-  {  1,  0,  1,  4,  6,  7, 10, 11}
-};
-const uint8_t ff_vc1_ttblk_bits[3][8] = {
-  {  2,  2,  2,  3,  5,  5,  5,  5},
-  {  2,  3,  3,  3,  3,  3,  4,  4},
-  {  2,  3,  3,  3,  3,  3,  4,  4}
-};
-
-/* SUBBLKPAT tables, p93-94, reordered */
-const uint8_t ff_vc1_subblkpat_codes[3][15] = {
-  { 14, 12,  7, 11,  9, 26,  2, 10, 27,  8,  0,  6,  1, 15,  1},
-  { 14,  0,  8, 15, 10,  4, 23, 13,  5,  9, 25,  3, 24, 22,  1},
-  {  5,  6,  2,  2,  8,  0, 28,  3,  1,  3, 29,  1, 19, 18, 15}
-};
-const uint8_t ff_vc1_subblkpat_bits[3][15] = {
-  {  5,  5,  5,  5,  5,  6,  4,  5,  6,  5,  4,  5,  4,  5,  1},
-  {  4,  3,  4,  4,  4,  5,  5,  4,  5,  4,  5,  4,  5,  5,  2},
-  {  3,  3,  4,  3,  4,  5,  5,  3,  5,  4,  5,  4,  5,  5,  4}
-};
-
-/* MV differential tables, p265 */
-const uint16_t ff_vc1_mv_diff_codes[4][73] = {
-  {
-       0,    2,    3,    8,  576,    3,    2,    6,
-       5,  577,  578,    7,    8,    9,   40,   19,
-      37,   82,   21,   22,   23,  579,  580,  166,
-      96,  167,   49,  194,  195,  581,  582,  583,
-     292,  293,  294,   13,    2,    7,   24,   50,
-     102,  295,   13,    7,    8,   18,   50,  103,
-      38,   20,   21,   22,   39,  204,  103,   23,
-      24,   25,  104,  410,  105,  106,  107,  108,
-     109,  220,  411,  442,  222,  443,  446,  447,
-       7 /* 73 elements */
-  },
-  {
-       0,    4,    5,    3,    4,    3,    4,    5,
-      20,    6,   21,   44,   45,   46, 3008,   95,
-     112,  113,   57, 3009, 3010,  116,  117, 3011,
-     118, 3012, 3013, 3014, 3015, 3016, 3017, 3018,
-    3019, 3020, 3021, 3022,    1,    4,   15,  160,
-     161,   41,    6,   11,   42,  162,   43,  119,
-      56,   57,   58,  163,  236,  237, 3023,  119,
-     120,  242,  122,  486, 1512,  487,  246,  494,
-    1513,  495, 1514, 1515, 1516, 1517, 1518, 1519,
-      31 /* 73 elements */
-  },
-  {
-       0,  512,  513,  514,  515,    2,    3,  258,
-     259,  260,  261,  262,  263,  264,  265,  266,
-     267,  268,  269,  270,  271,  272,  273,  274,
-     275,  276,  277,  278,  279,  280,  281,  282,
-     283,  284,  285,  286,    1,    5,  287,  288,
-     289,  290,    6,    7,  291,  292,  293,  294,
-     295,  296,  297,  298,  299,  300,  301,  302,
-     303,  304,  305,  306,  307,  308,  309,  310,
-     311,  312,  313,  314,  315,  316,  317,  318,
-     319 /* 73 elements */
-  },
-  {
-       0,    1,    1,    2,    3,    4,    1,    5,
-       4,    3,    5,    8,    6,    9,   10,   11,
-      12,    7,  104,   14,  105,    4,   10,   15,
-      11,    6,   14,    8,  106,  107,  108,   15,
-     109,    9,   55,   10,    1,    2,    1,    2,
-       3,   12,    6,    2,    6,    7,   28,    7,
-      15,    8,    5,   18,   29,  152,   77,   24,
-      25,   26,   39,  108,   13,  109,   55,   56,
-      57,  116,   11,  153,  234,  235,  118,  119,
-      15 /* 73 elements */
-  }
-};
-const uint8_t ff_vc1_mv_diff_bits[4][73] = {
-  {
-     6,  7,  7,  8, 14,  6,  5,  6,  7, 14, 14,  6,  6,  6,  8,  9,
-    10,  9,  7,  7,  7, 14, 14, 10,  9, 10,  8, 10, 10, 14, 14, 14,
-    13, 13, 13,  6,  3,  5,  6,  8,  9, 13,  5,  4,  4,  5,  7,  9,
-     6,  5,  5,  5,  6,  9,  8,  5,  5,  5,  7, 10,  7,  7,  7,  7,
-     7,  8, 10,  9,  8,  9,  9,  9,  3 /* 73 elements */
-  },
-  {
-     5,  7,  7,  6,  6,  5,  5,  6,  7,  5,  7,  8,  8,  8, 14,  9,
-     9,  9,  8, 14, 14,  9,  9, 14,  9, 14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14,  2,  3,  6,  8,  8,  6,  3,  4,  6,  8,  6,  9,
-     6,  6,  6,  8,  8,  8, 14,  7,  7,  8,  7,  9, 13,  9,  8,  9,
-    13,  9, 13, 13, 13, 13, 13, 13,  5 /* 73 elements */
-
-  },
-  {
-     3, 12, 12, 12, 12,  3,  4, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11,  1,  5, 11, 11, 11, 11,  4,  4, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11 /* 73 elements */
-  },
-  {
-    15, 11, 15, 15, 15, 15, 12, 15, 12, 11, 12, 12, 15, 12, 12, 12,
-    12, 15, 15, 12, 15, 10, 11, 12, 11, 10, 11, 10, 15, 15, 15, 11,
-    15, 10, 14, 10,  4,  4,  5,  7,  8,  9,  5,  3,  4,  5,  6,  8,
-     5,  4,  3,  5,  6,  8,  7,  5,  5,  5,  6,  7,  9,  7,  6,  6,
-     6,  7, 10,  8,  8,  8,  7,  7,  4 /* 73 elements */
-  }
-};
-
-/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
-
-/* Table 232 */
-const int8_t ff_vc1_simple_progressive_4x4_zz [16] =
-{
-       0,     8,    16,     1,
-       9,    24,    17,     2,
-      10,    18,    25,     3,
-      11,    26,    19,    27
-};
-
-const int8_t ff_vc1_adv_progressive_8x4_zz [32] = /* Table 233 */
-{
-       0,     8,     1,    16,     2,     9,    10,     3,
-      24,    17,     4,    11,    18,    12,     5,    19,
-      25,    13,    20,    26,    27,     6,    21,    28,
-      14,    22,    29,     7,    30,    15,    23,    31
-};
-
-const int8_t ff_vc1_adv_progressive_4x8_zz [32] = /* Table 234 */
-{
-       0,     1,     8,     2,
-       9,    16,    17,    24,
-      10,    32,    25,    18,
-      40,     3,    33,    26,
-      48,    11,    56,    41,
-      34,    49,    57,    42,
-      19,    50,    27,    58,
-      35,    43,    51,    59
-};
-
-const int8_t ff_vc1_adv_interlaced_8x8_zz [64] = /* Table 235 */
-{
-       0,     8,     1,    16,    24,     9,     2,    32,
-      40,    48,    56,    17,    10,     3,    25,    18,
-      11,     4,    33,    41,    49,    57,    26,    34,
-      42,    50,    58,    19,    12,     5,    27,    20,
-      13,     6,    35,    28,    21,    14,     7,    15,
-      22,    29,    36,    43,    51,    59,    60,    52,
-      44,    37,    30,    23,    31,    38,    45,    53,
-      61,    62,    54,    46,    39,    47,    55,    63
-};
-
-const int8_t ff_vc1_adv_interlaced_8x4_zz [32] = /* Table 236 */
-{
-       0,     8,    16,    24,     1,     9,     2,    17,
-      25,    10,     3,    18,    26,     4,    11,    19,
-      12,     5,    13,    20,    27,     6,    21,    28,
-      14,    22,    29,     7,    30,    15,    23,    31
-};
-
-const int8_t ff_vc1_adv_interlaced_4x8_zz [32] = /* Table 237 */
-{
-       0,     1,     2,     8,
-      16,     9,    24,    17,
-      10,     3,    32,    40,
-      48,    56,    25,    18,
-      33,    26,    41,    34,
-      49,    57,    11,    42,
-      19,    50,    27,    58,
-      35,    43,    51,    59
-};
-
-const int8_t ff_vc1_adv_interlaced_4x4_zz [16] = /* Table 238 */
-{
-       0,     8,    16,    24,
-       1,     9,    17,     2,
-      25,    10,    18,     3,
-      26,    11,    19,    27
-};
-
-
-/* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
-const int32_t ff_vc1_dqscale[63] = {
-0x40000, 0x20000, 0x15555, 0x10000, 0xCCCD, 0xAAAB, 0x9249, 0x8000,
-    0x71C7, 0x6666, 0x5D17, 0x5555, 0x4EC5, 0x4925, 0x4444, 0x4000,
-    0x3C3C, 0x38E4, 0x35E5, 0x3333, 0x30C3, 0x2E8C, 0x2C86, 0x2AAB,
-    0x28F6, 0x2762, 0x25ED, 0x2492, 0x234F, 0x2222, 0x2108, 0x2000,
-    0x1F08, 0x1E1E, 0x1D42, 0x1C72, 0x1BAD, 0x1AF3, 0x1A42, 0x199A,
-    0x18FA, 0x1862, 0x17D0, 0x1746, 0x16C1, 0x1643, 0x15CA, 0x1555,
-    0x14E6, 0x147B, 0x1414, 0x13B1, 0x1352, 0x12F7, 0x129E, 0x1249,
-    0x11F7, 0x11A8, 0x115B, 0x1111, 0x10C9, 0x1084, 0x1000
-};
diff --git a/libavcodec/vc1data.h b/libavcodec/vc1data.h
deleted file mode 100644
index 934627a..0000000
--- a/libavcodec/vc1data.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * VC-1 and WMV3 decoder
- * copyright (c) 2006 Konstantin Shishkov
- * (c) 2005 anonymous, Alex Beregszaszi, Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VC-1 tables.
- */
-
-#ifndef AVCODEC_VC1DATA_H
-#define AVCODEC_VC1DATA_H
-
-#include <stdint.h>
-#include "libavutil/rational.h"
-#include "get_bits.h"
-
-/** Table for conversion between TTBLK and TTMB */
-extern const int ff_vc1_ttblk_to_tt[3][8];
-
-extern const int ff_vc1_ttfrm_to_tt[4];
-
-/** MV P mode - the 5th element is only used for mode 1 */
-extern const uint8_t ff_vc1_mv_pmode_table[2][5];
-extern const uint8_t ff_vc1_mv_pmode_table2[2][4];
-
-extern const int ff_vc1_fps_nr[5], ff_vc1_fps_dr[2];
-extern const uint8_t ff_vc1_pquant_table[3][32];
-
-/** @name VC-1 VLC tables and defines
- *  @todo TODO move this into the context
- */
-//@{
-#define VC1_BFRACTION_VLC_BITS 7
-extern VLC ff_vc1_bfraction_vlc;
-#define VC1_IMODE_VLC_BITS 4
-extern VLC ff_vc1_imode_vlc;
-#define VC1_NORM2_VLC_BITS 3
-extern VLC ff_vc1_norm2_vlc;
-#define VC1_NORM6_VLC_BITS 9
-extern VLC ff_vc1_norm6_vlc;
-/* Could be optimized, one table only needs 8 bits */
-#define VC1_TTMB_VLC_BITS 9 //12
-extern VLC ff_vc1_ttmb_vlc[3];
-#define VC1_MV_DIFF_VLC_BITS 9 //15
-extern VLC ff_vc1_mv_diff_vlc[4];
-#define VC1_CBPCY_P_VLC_BITS 9 //14
-extern VLC ff_vc1_cbpcy_p_vlc[4];
-#define VC1_4MV_BLOCK_PATTERN_VLC_BITS 6
-extern VLC ff_vc1_4mv_block_pattern_vlc[4];
-#define VC1_TTBLK_VLC_BITS 5
-extern VLC ff_vc1_ttblk_vlc[3];
-#define VC1_SUBBLKPAT_VLC_BITS 6
-extern VLC ff_vc1_subblkpat_vlc[3];
-
-extern VLC ff_vc1_ac_coeff_table[8];
-//@}
-
-
-#if 0 //original bfraction from vc9data.h, not conforming to standard
-/* Denominator used for ff_vc1_bfraction_lut */
-#define B_FRACTION_DEN  840
-
-/* bfraction is fractional, we scale to the GCD 3*5*7*8 = 840 */
-extern const int16_t ff_vc1_bfraction_lut[23];
-#else
-/* Denominator used for ff_vc1_bfraction_lut */
-#define B_FRACTION_DEN  256
-
-/* pre-computed scales for all bfractions and base=256 */
-extern const int16_t ff_vc1_bfraction_lut[23];
-#endif
-
-extern const uint8_t ff_vc1_bfraction_bits[23];
-extern const uint8_t ff_vc1_bfraction_codes[23];
-
-//Same as H.264
-extern const AVRational ff_vc1_pixel_aspect[16];
-
-/* BitPlane IMODE - such a small table... */
-extern const uint8_t ff_vc1_imode_codes[7];
-extern const uint8_t ff_vc1_imode_bits[7];
-
-/* Normal-2 imode */
-extern const uint8_t ff_vc1_norm2_codes[4];
-extern const uint8_t ff_vc1_norm2_bits[4];
-extern const uint16_t ff_vc1_norm6_codes[64];
-extern const uint8_t ff_vc1_norm6_bits[64];
-/* Normal-6 imode */
-extern const uint8_t ff_vc1_norm6_spec[64][5];
-
-/* 4MV Block pattern VLC tables */
-extern const uint8_t ff_vc1_4mv_block_pattern_codes[4][16];
-extern const uint8_t ff_vc1_4mv_block_pattern_bits[4][16];
-
-extern const uint8_t wmv3_dc_scale_table[32];
-
-/* P-Picture CBPCY VLC tables */
-extern const uint16_t ff_vc1_cbpcy_p_codes[4][64];
-extern const uint8_t ff_vc1_cbpcy_p_bits[4][64];
-
-/* MacroBlock Transform Type: 7.1.3.11, p89
- * 8x8:B
- * 8x4:B:btm  8x4:B:top  8x4:B:both,
- * 4x8:B:right  4x8:B:left  4x8:B:both
- * 4x4:B  8x8:MB
- * 8x4:MB:btm  8x4:MB:top  8x4,MB,both
- * 4x8,MB,right  4x8,MB,left
- * 4x4,MB                               */
-extern const uint16_t ff_vc1_ttmb_codes[3][16];
-
-extern const uint8_t ff_vc1_ttmb_bits[3][16];
-
-/* TTBLK (Transform Type per Block) tables */
-extern const uint8_t ff_vc1_ttblk_codes[3][8];
-extern const uint8_t ff_vc1_ttblk_bits[3][8];
-
-/* SUBBLKPAT tables, p93-94, reordered */
-extern const uint8_t ff_vc1_subblkpat_codes[3][15];
-extern const uint8_t ff_vc1_subblkpat_bits[3][15];
-
-/* MV differential tables, p265 */
-extern const uint16_t ff_vc1_mv_diff_codes[4][73];
-extern const uint8_t ff_vc1_mv_diff_bits[4][73];
-
-/* DC differentials low+hi-mo, p217 are the same as in msmpeg4data .h */
-
-/* Scantables/ZZ scan are at 11.9 (p262) and 8.1.1.12 (p10) */
-extern const int8_t ff_vc1_simple_progressive_4x4_zz [16];
-extern const int8_t ff_vc1_adv_progressive_8x4_zz [32];
-extern const int8_t ff_vc1_adv_progressive_4x8_zz [32];
-extern const int8_t ff_vc1_adv_interlaced_8x8_zz [64];
-extern const int8_t ff_vc1_adv_interlaced_8x4_zz [32];
-extern const int8_t ff_vc1_adv_interlaced_4x8_zz [32];
-extern const int8_t ff_vc1_adv_interlaced_4x4_zz [16];
-
-/* DQScale as specified in 8.1.3.9 - almost identical to 0x40000/i */
-extern const int32_t ff_vc1_dqscale[63];
-
-#endif /* AVCODEC_VC1DATA_H */
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
deleted file mode 100644
index abcc5ec..0000000
--- a/libavcodec/vc1dec.c
+++ /dev/null
@@ -1,3384 +0,0 @@
-/*
- * VC-1 and WMV3 decoder
- * Copyright (c) 2006-2007 Konstantin Shishkov
- * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VC-1 and WMV3 decoder
- *
- */
-#include "internal.h"
-#include "dsputil.h"
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "vc1.h"
-#include "vc1data.h"
-#include "vc1acdata.h"
-#include "msmpeg4data.h"
-#include "unary.h"
-#include "simple_idct.h"
-#include "mathops.h"
-#include "vdpau_internal.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#define MB_INTRA_VLC_BITS 9
-#define DC_VLC_BITS 9
-#define AC_VLC_BITS 9
-static const uint16_t table_mb_intra[64][2];
-
-
-static const uint16_t vlc_offs[] = {
-       0,   520,   552,   616,  1128,  1160, 1224, 1740, 1772, 1836, 1900, 2436,
-    2986,  3050,  3610,  4154,  4218,  4746, 5326, 5390, 5902, 6554, 7658, 8620,
-    9262, 10202, 10756, 11310, 12228, 15078
-};
-
-/**
- * Init VC-1 specific tables and VC1Context members
- * @param v The VC1Context to initialize
- * @return Status
- */
-static int vc1_init_common(VC1Context *v)
-{
-    static int done = 0;
-    int i = 0;
-    static VLC_TYPE vlc_table[15078][2];
-
-    v->hrd_rate = v->hrd_buffer = NULL;
-
-    /* VLC tables */
-    if(!done)
-    {
-        INIT_VLC_STATIC(&ff_vc1_bfraction_vlc, VC1_BFRACTION_VLC_BITS, 23,
-                 ff_vc1_bfraction_bits, 1, 1,
-                 ff_vc1_bfraction_codes, 1, 1, 1 << VC1_BFRACTION_VLC_BITS);
-        INIT_VLC_STATIC(&ff_vc1_norm2_vlc, VC1_NORM2_VLC_BITS, 4,
-                 ff_vc1_norm2_bits, 1, 1,
-                 ff_vc1_norm2_codes, 1, 1, 1 << VC1_NORM2_VLC_BITS);
-        INIT_VLC_STATIC(&ff_vc1_norm6_vlc, VC1_NORM6_VLC_BITS, 64,
-                 ff_vc1_norm6_bits, 1, 1,
-                 ff_vc1_norm6_codes, 2, 2, 556);
-        INIT_VLC_STATIC(&ff_vc1_imode_vlc, VC1_IMODE_VLC_BITS, 7,
-                 ff_vc1_imode_bits, 1, 1,
-                 ff_vc1_imode_codes, 1, 1, 1 << VC1_IMODE_VLC_BITS);
-        for (i=0; i<3; i++)
-        {
-            ff_vc1_ttmb_vlc[i].table = &vlc_table[vlc_offs[i*3+0]];
-            ff_vc1_ttmb_vlc[i].table_allocated = vlc_offs[i*3+1] - vlc_offs[i*3+0];
-            init_vlc(&ff_vc1_ttmb_vlc[i], VC1_TTMB_VLC_BITS, 16,
-                     ff_vc1_ttmb_bits[i], 1, 1,
-                     ff_vc1_ttmb_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
-            ff_vc1_ttblk_vlc[i].table = &vlc_table[vlc_offs[i*3+1]];
-            ff_vc1_ttblk_vlc[i].table_allocated = vlc_offs[i*3+2] - vlc_offs[i*3+1];
-            init_vlc(&ff_vc1_ttblk_vlc[i], VC1_TTBLK_VLC_BITS, 8,
-                     ff_vc1_ttblk_bits[i], 1, 1,
-                     ff_vc1_ttblk_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-            ff_vc1_subblkpat_vlc[i].table = &vlc_table[vlc_offs[i*3+2]];
-            ff_vc1_subblkpat_vlc[i].table_allocated = vlc_offs[i*3+3] - vlc_offs[i*3+2];
-            init_vlc(&ff_vc1_subblkpat_vlc[i], VC1_SUBBLKPAT_VLC_BITS, 15,
-                     ff_vc1_subblkpat_bits[i], 1, 1,
-                     ff_vc1_subblkpat_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-        }
-        for(i=0; i<4; i++)
-        {
-            ff_vc1_4mv_block_pattern_vlc[i].table = &vlc_table[vlc_offs[i*3+9]];
-            ff_vc1_4mv_block_pattern_vlc[i].table_allocated = vlc_offs[i*3+10] - vlc_offs[i*3+9];
-            init_vlc(&ff_vc1_4mv_block_pattern_vlc[i], VC1_4MV_BLOCK_PATTERN_VLC_BITS, 16,
-                     ff_vc1_4mv_block_pattern_bits[i], 1, 1,
-                     ff_vc1_4mv_block_pattern_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC);
-            ff_vc1_cbpcy_p_vlc[i].table = &vlc_table[vlc_offs[i*3+10]];
-            ff_vc1_cbpcy_p_vlc[i].table_allocated = vlc_offs[i*3+11] - vlc_offs[i*3+10];
-            init_vlc(&ff_vc1_cbpcy_p_vlc[i], VC1_CBPCY_P_VLC_BITS, 64,
-                     ff_vc1_cbpcy_p_bits[i], 1, 1,
-                     ff_vc1_cbpcy_p_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
-            ff_vc1_mv_diff_vlc[i].table = &vlc_table[vlc_offs[i*3+11]];
-            ff_vc1_mv_diff_vlc[i].table_allocated = vlc_offs[i*3+12] - vlc_offs[i*3+11];
-            init_vlc(&ff_vc1_mv_diff_vlc[i], VC1_MV_DIFF_VLC_BITS, 73,
-                     ff_vc1_mv_diff_bits[i], 1, 1,
-                     ff_vc1_mv_diff_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC);
-        }
-        for(i=0; i<8; i++){
-            ff_vc1_ac_coeff_table[i].table = &vlc_table[vlc_offs[i+21]];
-            ff_vc1_ac_coeff_table[i].table_allocated = vlc_offs[i+22] - vlc_offs[i+21];
-            init_vlc(&ff_vc1_ac_coeff_table[i], AC_VLC_BITS, vc1_ac_sizes[i],
-                     &vc1_ac_tables[i][0][1], 8, 4,
-                     &vc1_ac_tables[i][0][0], 8, 4, INIT_VLC_USE_NEW_STATIC);
-        }
-        done = 1;
-    }
-
-    /* Other defaults */
-    v->pq = -1;
-    v->mvrange = 0; /* 7.1.1.18, p80 */
-
-    return 0;
-}
-
-/***********************************************************************/
-/**
- * @defgroup vc1bitplane VC-1 Bitplane decoding
- * @see 8.7, p56
- * @{
- */
-
-/**
- * Imode types
- * @{
- */
-enum Imode {
-    IMODE_RAW,
-    IMODE_NORM2,
-    IMODE_DIFF2,
-    IMODE_NORM6,
-    IMODE_DIFF6,
-    IMODE_ROWSKIP,
-    IMODE_COLSKIP
-};
-/** @} */ //imode defines
-
-
-/** @} */ //Bitplane group
-
-static void vc1_loop_filter_iblk(MpegEncContext *s, int pq)
-{
-    int i, j;
-    if(!s->first_slice_line)
-        s->dsp.vc1_v_loop_filter16(s->dest[0], s->linesize, pq);
-    s->dsp.vc1_v_loop_filter16(s->dest[0] + 8*s->linesize, s->linesize, pq);
-    for(i = !s->mb_x*8; i < 16; i += 8)
-        s->dsp.vc1_h_loop_filter16(s->dest[0] + i, s->linesize, pq);
-    for(j = 0; j < 2; j++){
-        if(!s->first_slice_line)
-            s->dsp.vc1_v_loop_filter8(s->dest[j+1], s->uvlinesize, pq);
-        if(s->mb_x)
-            s->dsp.vc1_h_loop_filter8(s->dest[j+1], s->uvlinesize, pq);
-    }
-}
-
-/** Put block onto picture
- */
-static void vc1_put_block(VC1Context *v, DCTELEM block[6][64])
-{
-    uint8_t *Y;
-    int ys, us, vs;
-    DSPContext *dsp = &v->s.dsp;
-
-    if(v->rangeredfrm) {
-        int i, j, k;
-        for(k = 0; k < 6; k++)
-            for(j = 0; j < 8; j++)
-                for(i = 0; i < 8; i++)
-                    block[k][i + j*8] = ((block[k][i + j*8] - 128) << 1) + 128;
-
-    }
-    ys = v->s.current_picture.linesize[0];
-    us = v->s.current_picture.linesize[1];
-    vs = v->s.current_picture.linesize[2];
-    Y = v->s.dest[0];
-
-    dsp->put_pixels_clamped(block[0], Y, ys);
-    dsp->put_pixels_clamped(block[1], Y + 8, ys);
-    Y += ys * 8;
-    dsp->put_pixels_clamped(block[2], Y, ys);
-    dsp->put_pixels_clamped(block[3], Y + 8, ys);
-
-    if(!(v->s.flags & CODEC_FLAG_GRAY)) {
-        dsp->put_pixels_clamped(block[4], v->s.dest[1], us);
-        dsp->put_pixels_clamped(block[5], v->s.dest[2], vs);
-    }
-}
-
-/** Do motion compensation over 1 macroblock
- * Mostly adapted hpel_motion and qpel_motion from mpegvideo.c
- */
-static void vc1_mc_1mv(VC1Context *v, int dir)
-{
-    MpegEncContext *s = &v->s;
-    DSPContext *dsp = &v->s.dsp;
-    uint8_t *srcY, *srcU, *srcV;
-    int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
-
-    if(!v->s.last_picture.data[0])return;
-
-    mx = s->mv[dir][0][0];
-    my = s->mv[dir][0][1];
-
-    // store motion vectors for further use in B frames
-    if(s->pict_type == FF_P_TYPE) {
-        s->current_picture.motion_val[1][s->block_index[0]][0] = mx;
-        s->current_picture.motion_val[1][s->block_index[0]][1] = my;
-    }
-    uvmx = (mx + ((mx & 3) == 3)) >> 1;
-    uvmy = (my + ((my & 3) == 3)) >> 1;
-    if(v->fastuvmc) {
-        uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
-        uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
-    }
-    if(!dir) {
-        srcY = s->last_picture.data[0];
-        srcU = s->last_picture.data[1];
-        srcV = s->last_picture.data[2];
-    } else {
-        srcY = s->next_picture.data[0];
-        srcU = s->next_picture.data[1];
-        srcV = s->next_picture.data[2];
-    }
-
-    src_x = s->mb_x * 16 + (mx >> 2);
-    src_y = s->mb_y * 16 + (my >> 2);
-    uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
-    uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
-
-    if(v->profile != PROFILE_ADVANCED){
-        src_x   = av_clip(  src_x, -16, s->mb_width  * 16);
-        src_y   = av_clip(  src_y, -16, s->mb_height * 16);
-        uvsrc_x = av_clip(uvsrc_x,  -8, s->mb_width  *  8);
-        uvsrc_y = av_clip(uvsrc_y,  -8, s->mb_height *  8);
-    }else{
-        src_x   = av_clip(  src_x, -17, s->avctx->coded_width);
-        src_y   = av_clip(  src_y, -18, s->avctx->coded_height + 1);
-        uvsrc_x = av_clip(uvsrc_x,  -8, s->avctx->coded_width  >> 1);
-        uvsrc_y = av_clip(uvsrc_y,  -8, s->avctx->coded_height >> 1);
-    }
-
-    srcY += src_y * s->linesize + src_x;
-    srcU += uvsrc_y * s->uvlinesize + uvsrc_x;
-    srcV += uvsrc_y * s->uvlinesize + uvsrc_x;
-
-    /* for grayscale we should not try to read from unknown area */
-    if(s->flags & CODEC_FLAG_GRAY) {
-        srcU = s->edge_emu_buffer + 18 * s->linesize;
-        srcV = s->edge_emu_buffer + 18 * s->linesize;
-    }
-
-    if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
-       || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3
-       || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 16 - s->mspel*3){
-        uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize;
-
-        srcY -= s->mspel * (1 + s->linesize);
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2,
-                            src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
-        srcY = s->edge_emu_buffer;
-        ff_emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, 8+1, 8+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        srcU = uvbuf;
-        srcV = uvbuf + 16;
-        /* if we deal with range reduction we need to scale source blocks */
-        if(v->rangeredfrm) {
-            int i, j;
-            uint8_t *src, *src2;
-
-            src = srcY;
-            for(j = 0; j < 17 + s->mspel*2; j++) {
-                for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
-                src += s->linesize;
-            }
-            src = srcU; src2 = srcV;
-            for(j = 0; j < 9; j++) {
-                for(i = 0; i < 9; i++) {
-                    src[i] = ((src[i] - 128) >> 1) + 128;
-                    src2[i] = ((src2[i] - 128) >> 1) + 128;
-                }
-                src += s->uvlinesize;
-                src2 += s->uvlinesize;
-            }
-        }
-        /* if we deal with intensity compensation we need to scale source blocks */
-        if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
-            int i, j;
-            uint8_t *src, *src2;
-
-            src = srcY;
-            for(j = 0; j < 17 + s->mspel*2; j++) {
-                for(i = 0; i < 17 + s->mspel*2; i++) src[i] = v->luty[src[i]];
-                src += s->linesize;
-            }
-            src = srcU; src2 = srcV;
-            for(j = 0; j < 9; j++) {
-                for(i = 0; i < 9; i++) {
-                    src[i] = v->lutuv[src[i]];
-                    src2[i] = v->lutuv[src2[i]];
-                }
-                src += s->uvlinesize;
-                src2 += s->uvlinesize;
-            }
-        }
-        srcY += s->mspel * (1 + s->linesize);
-    }
-
-    if(s->mspel) {
-        dxy = ((my & 3) << 2) | (mx & 3);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0]    , srcY    , s->linesize, v->rnd);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
-        srcY += s->linesize * 8;
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize    , srcY    , s->linesize, v->rnd);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
-    } else { // hpel mc - always used for luma
-        dxy = (my & 2) | ((mx & 2) >> 1);
-
-        if(!v->rnd)
-            dsp->put_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16);
-        else
-            dsp->put_no_rnd_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16);
-    }
-
-    if(s->flags & CODEC_FLAG_GRAY) return;
-    /* Chroma MC always uses qpel bilinear */
-    uvmx = (uvmx&3)<<1;
-    uvmy = (uvmy&3)<<1;
-    if(!v->rnd){
-        dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
-    }else{
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
-    }
-}
-
-/** Do motion compensation for 4-MV macroblock - luminance block
- */
-static void vc1_mc_4mv_luma(VC1Context *v, int n)
-{
-    MpegEncContext *s = &v->s;
-    DSPContext *dsp = &v->s.dsp;
-    uint8_t *srcY;
-    int dxy, mx, my, src_x, src_y;
-    int off;
-
-    if(!v->s.last_picture.data[0])return;
-    mx = s->mv[0][n][0];
-    my = s->mv[0][n][1];
-    srcY = s->last_picture.data[0];
-
-    off = s->linesize * 4 * (n&2) + (n&1) * 8;
-
-    src_x = s->mb_x * 16 + (n&1) * 8 + (mx >> 2);
-    src_y = s->mb_y * 16 + (n&2) * 4 + (my >> 2);
-
-    if(v->profile != PROFILE_ADVANCED){
-        src_x   = av_clip(  src_x, -16, s->mb_width  * 16);
-        src_y   = av_clip(  src_y, -16, s->mb_height * 16);
-    }else{
-        src_x   = av_clip(  src_x, -17, s->avctx->coded_width);
-        src_y   = av_clip(  src_y, -18, s->avctx->coded_height + 1);
-    }
-
-    srcY += src_y * s->linesize + src_x;
-
-    if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
-       || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2
-       || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel*2){
-        srcY -= s->mspel * (1 + s->linesize);
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2,
-                            src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
-        srcY = s->edge_emu_buffer;
-        /* if we deal with range reduction we need to scale source blocks */
-        if(v->rangeredfrm) {
-            int i, j;
-            uint8_t *src;
-
-            src = srcY;
-            for(j = 0; j < 9 + s->mspel*2; j++) {
-                for(i = 0; i < 9 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
-                src += s->linesize;
-            }
-        }
-        /* if we deal with intensity compensation we need to scale source blocks */
-        if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
-            int i, j;
-            uint8_t *src;
-
-            src = srcY;
-            for(j = 0; j < 9 + s->mspel*2; j++) {
-                for(i = 0; i < 9 + s->mspel*2; i++) src[i] = v->luty[src[i]];
-                src += s->linesize;
-            }
-        }
-        srcY += s->mspel * (1 + s->linesize);
-    }
-
-    if(s->mspel) {
-        dxy = ((my & 3) << 2) | (mx & 3);
-        dsp->put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, v->rnd);
-    } else { // hpel mc - always used for luma
-        dxy = (my & 2) | ((mx & 2) >> 1);
-        if(!v->rnd)
-            dsp->put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8);
-        else
-            dsp->put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8);
-    }
-}
-
-static inline int median4(int a, int b, int c, int d)
-{
-    if(a < b) {
-        if(c < d) return (FFMIN(b, d) + FFMAX(a, c)) / 2;
-        else      return (FFMIN(b, c) + FFMAX(a, d)) / 2;
-    } else {
-        if(c < d) return (FFMIN(a, d) + FFMAX(b, c)) / 2;
-        else      return (FFMIN(a, c) + FFMAX(b, d)) / 2;
-    }
-}
-
-
-/** Do motion compensation for 4-MV macroblock - both chroma blocks
- */
-static void vc1_mc_4mv_chroma(VC1Context *v)
-{
-    MpegEncContext *s = &v->s;
-    DSPContext *dsp = &v->s.dsp;
-    uint8_t *srcU, *srcV;
-    int uvmx, uvmy, uvsrc_x, uvsrc_y;
-    int i, idx, tx = 0, ty = 0;
-    int mvx[4], mvy[4], intra[4];
-    static const int count[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
-
-    if(!v->s.last_picture.data[0])return;
-    if(s->flags & CODEC_FLAG_GRAY) return;
-
-    for(i = 0; i < 4; i++) {
-        mvx[i] = s->mv[0][i][0];
-        mvy[i] = s->mv[0][i][1];
-        intra[i] = v->mb_type[0][s->block_index[i]];
-    }
-
-    /* calculate chroma MV vector from four luma MVs */
-    idx = (intra[3] << 3) | (intra[2] << 2) | (intra[1] << 1) | intra[0];
-    if(!idx) { // all blocks are inter
-        tx = median4(mvx[0], mvx[1], mvx[2], mvx[3]);
-        ty = median4(mvy[0], mvy[1], mvy[2], mvy[3]);
-    } else if(count[idx] == 1) { // 3 inter blocks
-        switch(idx) {
-        case 0x1:
-            tx = mid_pred(mvx[1], mvx[2], mvx[3]);
-            ty = mid_pred(mvy[1], mvy[2], mvy[3]);
-            break;
-        case 0x2:
-            tx = mid_pred(mvx[0], mvx[2], mvx[3]);
-            ty = mid_pred(mvy[0], mvy[2], mvy[3]);
-            break;
-        case 0x4:
-            tx = mid_pred(mvx[0], mvx[1], mvx[3]);
-            ty = mid_pred(mvy[0], mvy[1], mvy[3]);
-            break;
-        case 0x8:
-            tx = mid_pred(mvx[0], mvx[1], mvx[2]);
-            ty = mid_pred(mvy[0], mvy[1], mvy[2]);
-            break;
-        }
-    } else if(count[idx] == 2) {
-        int t1 = 0, t2 = 0;
-        for(i=0; i<3;i++) if(!intra[i]) {t1 = i; break;}
-        for(i= t1+1; i<4; i++)if(!intra[i]) {t2 = i; break;}
-        tx = (mvx[t1] + mvx[t2]) / 2;
-        ty = (mvy[t1] + mvy[t2]) / 2;
-    } else {
-        s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
-        s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
-        return; //no need to do MC for inter blocks
-    }
-
-    s->current_picture.motion_val[1][s->block_index[0]][0] = tx;
-    s->current_picture.motion_val[1][s->block_index[0]][1] = ty;
-    uvmx = (tx + ((tx&3) == 3)) >> 1;
-    uvmy = (ty + ((ty&3) == 3)) >> 1;
-    if(v->fastuvmc) {
-        uvmx = uvmx + ((uvmx<0)?(uvmx&1):-(uvmx&1));
-        uvmy = uvmy + ((uvmy<0)?(uvmy&1):-(uvmy&1));
-    }
-
-    uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
-    uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
-
-    if(v->profile != PROFILE_ADVANCED){
-        uvsrc_x = av_clip(uvsrc_x,  -8, s->mb_width  *  8);
-        uvsrc_y = av_clip(uvsrc_y,  -8, s->mb_height *  8);
-    }else{
-        uvsrc_x = av_clip(uvsrc_x,  -8, s->avctx->coded_width  >> 1);
-        uvsrc_y = av_clip(uvsrc_y,  -8, s->avctx->coded_height >> 1);
-    }
-
-    srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x;
-    srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x;
-    if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
-       || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9
-       || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){
-        ff_emulated_edge_mc(s->edge_emu_buffer     , srcU, s->uvlinesize, 8+1, 8+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        srcU = s->edge_emu_buffer;
-        srcV = s->edge_emu_buffer + 16;
-
-        /* if we deal with range reduction we need to scale source blocks */
-        if(v->rangeredfrm) {
-            int i, j;
-            uint8_t *src, *src2;
-
-            src = srcU; src2 = srcV;
-            for(j = 0; j < 9; j++) {
-                for(i = 0; i < 9; i++) {
-                    src[i] = ((src[i] - 128) >> 1) + 128;
-                    src2[i] = ((src2[i] - 128) >> 1) + 128;
-                }
-                src += s->uvlinesize;
-                src2 += s->uvlinesize;
-            }
-        }
-        /* if we deal with intensity compensation we need to scale source blocks */
-        if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
-            int i, j;
-            uint8_t *src, *src2;
-
-            src = srcU; src2 = srcV;
-            for(j = 0; j < 9; j++) {
-                for(i = 0; i < 9; i++) {
-                    src[i] = v->lutuv[src[i]];
-                    src2[i] = v->lutuv[src2[i]];
-                }
-                src += s->uvlinesize;
-                src2 += s->uvlinesize;
-            }
-        }
-    }
-
-    /* Chroma MC always uses qpel bilinear */
-    uvmx = (uvmx&3)<<1;
-    uvmy = (uvmy&3)<<1;
-    if(!v->rnd){
-        dsp->put_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->put_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
-    }else{
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->put_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
-    }
-}
-
-/***********************************************************************/
-/**
- * @defgroup vc1block VC-1 Block-level functions
- * @see 7.1.4, p91 and 8.1.1.7, p(1)04
- * @{
- */
-
-/**
- * @def GET_MQUANT
- * @brief Get macroblock-level quantizer scale
- */
-#define GET_MQUANT()                                           \
-  if (v->dquantfrm)                                            \
-  {                                                            \
-    int edges = 0;                                             \
-    if (v->dqprofile == DQPROFILE_ALL_MBS)                     \
-    {                                                          \
-      if (v->dqbilevel)                                        \
-      {                                                        \
-        mquant = (get_bits1(gb)) ? v->altpq : v->pq;           \
-      }                                                        \
-      else                                                     \
-      {                                                        \
-        mqdiff = get_bits(gb, 3);                              \
-        if (mqdiff != 7) mquant = v->pq + mqdiff;              \
-        else mquant = get_bits(gb, 5);                         \
-      }                                                        \
-    }                                                          \
-    if(v->dqprofile == DQPROFILE_SINGLE_EDGE)                  \
-        edges = 1 << v->dqsbedge;                              \
-    else if(v->dqprofile == DQPROFILE_DOUBLE_EDGES)            \
-        edges = (3 << v->dqsbedge) % 15;                       \
-    else if(v->dqprofile == DQPROFILE_FOUR_EDGES)              \
-        edges = 15;                                            \
-    if((edges&1) && !s->mb_x)                                  \
-        mquant = v->altpq;                                     \
-    if((edges&2) && s->first_slice_line)                       \
-        mquant = v->altpq;                                     \
-    if((edges&4) && s->mb_x == (s->mb_width - 1))              \
-        mquant = v->altpq;                                     \
-    if((edges&8) && s->mb_y == (s->mb_height - 1))             \
-        mquant = v->altpq;                                     \
-  }
-
-/**
- * @def GET_MVDATA(_dmv_x, _dmv_y)
- * @brief Get MV differentials
- * @see MVDATA decoding from 8.3.5.2, p(1)20
- * @param _dmv_x Horizontal differential for decoded MV
- * @param _dmv_y Vertical differential for decoded MV
- */
-#define GET_MVDATA(_dmv_x, _dmv_y)                                  \
-  index = 1 + get_vlc2(gb, ff_vc1_mv_diff_vlc[s->mv_table_index].table,\
-                       VC1_MV_DIFF_VLC_BITS, 2);                    \
-  if (index > 36)                                                   \
-  {                                                                 \
-    mb_has_coeffs = 1;                                              \
-    index -= 37;                                                    \
-  }                                                                 \
-  else mb_has_coeffs = 0;                                           \
-  s->mb_intra = 0;                                                  \
-  if (!index) { _dmv_x = _dmv_y = 0; }                              \
-  else if (index == 35)                                             \
-  {                                                                 \
-    _dmv_x = get_bits(gb, v->k_x - 1 + s->quarter_sample);          \
-    _dmv_y = get_bits(gb, v->k_y - 1 + s->quarter_sample);          \
-  }                                                                 \
-  else if (index == 36)                                             \
-  {                                                                 \
-    _dmv_x = 0;                                                     \
-    _dmv_y = 0;                                                     \
-    s->mb_intra = 1;                                                \
-  }                                                                 \
-  else                                                              \
-  {                                                                 \
-    index1 = index%6;                                               \
-    if (!s->quarter_sample && index1 == 5) val = 1;                 \
-    else                                   val = 0;                 \
-    if(size_table[index1] - val > 0)                                \
-        val = get_bits(gb, size_table[index1] - val);               \
-    else                                   val = 0;                 \
-    sign = 0 - (val&1);                                             \
-    _dmv_x = (sign ^ ((val>>1) + offset_table[index1])) - sign;     \
-                                                                    \
-    index1 = index/6;                                               \
-    if (!s->quarter_sample && index1 == 5) val = 1;                 \
-    else                                   val = 0;                 \
-    if(size_table[index1] - val > 0)                                \
-        val = get_bits(gb, size_table[index1] - val);               \
-    else                                   val = 0;                 \
-    sign = 0 - (val&1);                                             \
-    _dmv_y = (sign ^ ((val>>1) + offset_table[index1])) - sign;     \
-  }
-
-/** Predict and set motion vector
- */
-static inline void vc1_pred_mv(MpegEncContext *s, int n, int dmv_x, int dmv_y, int mv1, int r_x, int r_y, uint8_t* is_intra)
-{
-    int xy, wrap, off = 0;
-    int16_t *A, *B, *C;
-    int px, py;
-    int sum;
-
-    /* scale MV difference to be quad-pel */
-    dmv_x <<= 1 - s->quarter_sample;
-    dmv_y <<= 1 - s->quarter_sample;
-
-    wrap = s->b8_stride;
-    xy = s->block_index[n];
-
-    if(s->mb_intra){
-        s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0;
-        s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0;
-        s->current_picture.motion_val[1][xy][0] = 0;
-        s->current_picture.motion_val[1][xy][1] = 0;
-        if(mv1) { /* duplicate motion data for 1-MV block */
-            s->current_picture.motion_val[0][xy + 1][0] = 0;
-            s->current_picture.motion_val[0][xy + 1][1] = 0;
-            s->current_picture.motion_val[0][xy + wrap][0] = 0;
-            s->current_picture.motion_val[0][xy + wrap][1] = 0;
-            s->current_picture.motion_val[0][xy + wrap + 1][0] = 0;
-            s->current_picture.motion_val[0][xy + wrap + 1][1] = 0;
-            s->current_picture.motion_val[1][xy + 1][0] = 0;
-            s->current_picture.motion_val[1][xy + 1][1] = 0;
-            s->current_picture.motion_val[1][xy + wrap][0] = 0;
-            s->current_picture.motion_val[1][xy + wrap][1] = 0;
-            s->current_picture.motion_val[1][xy + wrap + 1][0] = 0;
-            s->current_picture.motion_val[1][xy + wrap + 1][1] = 0;
-        }
-        return;
-    }
-
-    C = s->current_picture.motion_val[0][xy - 1];
-    A = s->current_picture.motion_val[0][xy - wrap];
-    if(mv1)
-        off = (s->mb_x == (s->mb_width - 1)) ? -1 : 2;
-    else {
-        //in 4-MV mode different blocks have different B predictor position
-        switch(n){
-        case 0:
-            off = (s->mb_x > 0) ? -1 : 1;
-            break;
-        case 1:
-            off = (s->mb_x == (s->mb_width - 1)) ? -1 : 1;
-            break;
-        case 2:
-            off = 1;
-            break;
-        case 3:
-            off = -1;
-        }
-    }
-    B = s->current_picture.motion_val[0][xy - wrap + off];
-
-    if(!s->first_slice_line || (n==2 || n==3)) { // predictor A is not out of bounds
-        if(s->mb_width == 1) {
-            px = A[0];
-            py = A[1];
-        } else {
-            px = mid_pred(A[0], B[0], C[0]);
-            py = mid_pred(A[1], B[1], C[1]);
-        }
-    } else if(s->mb_x || (n==1 || n==3)) { // predictor C is not out of bounds
-        px = C[0];
-        py = C[1];
-    } else {
-        px = py = 0;
-    }
-    /* Pullback MV as specified in 8.3.5.3.4 */
-    {
-        int qx, qy, X, Y;
-        qx = (s->mb_x << 6) + ((n==1 || n==3) ? 32 : 0);
-        qy = (s->mb_y << 6) + ((n==2 || n==3) ? 32 : 0);
-        X = (s->mb_width << 6) - 4;
-        Y = (s->mb_height << 6) - 4;
-        if(mv1) {
-            if(qx + px < -60) px = -60 - qx;
-            if(qy + py < -60) py = -60 - qy;
-        } else {
-            if(qx + px < -28) px = -28 - qx;
-            if(qy + py < -28) py = -28 - qy;
-        }
-        if(qx + px > X) px = X - qx;
-        if(qy + py > Y) py = Y - qy;
-    }
-    /* Calculate hybrid prediction as specified in 8.3.5.3.5 */
-    if((!s->first_slice_line || (n==2 || n==3)) && (s->mb_x || (n==1 || n==3))) {
-        if(is_intra[xy - wrap])
-            sum = FFABS(px) + FFABS(py);
-        else
-            sum = FFABS(px - A[0]) + FFABS(py - A[1]);
-        if(sum > 32) {
-            if(get_bits1(&s->gb)) {
-                px = A[0];
-                py = A[1];
-            } else {
-                px = C[0];
-                py = C[1];
-            }
-        } else {
-            if(is_intra[xy - 1])
-                sum = FFABS(px) + FFABS(py);
-            else
-                sum = FFABS(px - C[0]) + FFABS(py - C[1]);
-            if(sum > 32) {
-                if(get_bits1(&s->gb)) {
-                    px = A[0];
-                    py = A[1];
-                } else {
-                    px = C[0];
-                    py = C[1];
-                }
-            }
-        }
-    }
-    /* store MV using signed modulus of MV range defined in 4.11 */
-    s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x;
-    s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y;
-    if(mv1) { /* duplicate motion data for 1-MV block */
-        s->current_picture.motion_val[0][xy + 1][0] = s->current_picture.motion_val[0][xy][0];
-        s->current_picture.motion_val[0][xy + 1][1] = s->current_picture.motion_val[0][xy][1];
-        s->current_picture.motion_val[0][xy + wrap][0] = s->current_picture.motion_val[0][xy][0];
-        s->current_picture.motion_val[0][xy + wrap][1] = s->current_picture.motion_val[0][xy][1];
-        s->current_picture.motion_val[0][xy + wrap + 1][0] = s->current_picture.motion_val[0][xy][0];
-        s->current_picture.motion_val[0][xy + wrap + 1][1] = s->current_picture.motion_val[0][xy][1];
-    }
-}
-
-/** Motion compensation for direct or interpolated blocks in B-frames
- */
-static void vc1_interp_mc(VC1Context *v)
-{
-    MpegEncContext *s = &v->s;
-    DSPContext *dsp = &v->s.dsp;
-    uint8_t *srcY, *srcU, *srcV;
-    int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
-
-    if(!v->s.next_picture.data[0])return;
-
-    mx = s->mv[1][0][0];
-    my = s->mv[1][0][1];
-    uvmx = (mx + ((mx & 3) == 3)) >> 1;
-    uvmy = (my + ((my & 3) == 3)) >> 1;
-    if(v->fastuvmc) {
-        uvmx = uvmx + ((uvmx<0)?-(uvmx&1):(uvmx&1));
-        uvmy = uvmy + ((uvmy<0)?-(uvmy&1):(uvmy&1));
-    }
-    srcY = s->next_picture.data[0];
-    srcU = s->next_picture.data[1];
-    srcV = s->next_picture.data[2];
-
-    src_x = s->mb_x * 16 + (mx >> 2);
-    src_y = s->mb_y * 16 + (my >> 2);
-    uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
-    uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
-
-    if(v->profile != PROFILE_ADVANCED){
-        src_x   = av_clip(  src_x, -16, s->mb_width  * 16);
-        src_y   = av_clip(  src_y, -16, s->mb_height * 16);
-        uvsrc_x = av_clip(uvsrc_x,  -8, s->mb_width  *  8);
-        uvsrc_y = av_clip(uvsrc_y,  -8, s->mb_height *  8);
-    }else{
-        src_x   = av_clip(  src_x, -17, s->avctx->coded_width);
-        src_y   = av_clip(  src_y, -18, s->avctx->coded_height + 1);
-        uvsrc_x = av_clip(uvsrc_x,  -8, s->avctx->coded_width  >> 1);
-        uvsrc_y = av_clip(uvsrc_y,  -8, s->avctx->coded_height >> 1);
-    }
-
-    srcY += src_y * s->linesize + src_x;
-    srcU += uvsrc_y * s->uvlinesize + uvsrc_x;
-    srcV += uvsrc_y * s->uvlinesize + uvsrc_x;
-
-    /* for grayscale we should not try to read from unknown area */
-    if(s->flags & CODEC_FLAG_GRAY) {
-        srcU = s->edge_emu_buffer + 18 * s->linesize;
-        srcV = s->edge_emu_buffer + 18 * s->linesize;
-    }
-
-    if(v->rangeredfrm
-       || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel*3
-       || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 16 - s->mspel*3){
-        uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize;
-
-        srcY -= s->mspel * (1 + s->linesize);
-        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2,
-                            src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
-        srcY = s->edge_emu_buffer;
-        ff_emulated_edge_mc(uvbuf     , srcU, s->uvlinesize, 8+1, 8+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1,
-                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
-        srcU = uvbuf;
-        srcV = uvbuf + 16;
-        /* if we deal with range reduction we need to scale source blocks */
-        if(v->rangeredfrm) {
-            int i, j;
-            uint8_t *src, *src2;
-
-            src = srcY;
-            for(j = 0; j < 17 + s->mspel*2; j++) {
-                for(i = 0; i < 17 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
-                src += s->linesize;
-            }
-            src = srcU; src2 = srcV;
-            for(j = 0; j < 9; j++) {
-                for(i = 0; i < 9; i++) {
-                    src[i] = ((src[i] - 128) >> 1) + 128;
-                    src2[i] = ((src2[i] - 128) >> 1) + 128;
-                }
-                src += s->uvlinesize;
-                src2 += s->uvlinesize;
-            }
-        }
-        srcY += s->mspel * (1 + s->linesize);
-    }
-
-    if(s->mspel) {
-        dxy = ((my & 3) << 2) | (mx & 3);
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0]    , srcY    , s->linesize, v->rnd);
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd);
-        srcY += s->linesize * 8;
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize    , srcY    , s->linesize, v->rnd);
-        dsp->avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
-    } else { // hpel mc
-        dxy = (my & 2) | ((mx & 2) >> 1);
-
-        if(!v->rnd)
-            dsp->avg_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16);
-        else
-            dsp->avg_no_rnd_pixels_tab[0][dxy](s->dest[0], srcY, s->linesize, 16);
-    }
-
-    if(s->flags & CODEC_FLAG_GRAY) return;
-    /* Chroma MC always uses qpel blilinear */
-    uvmx = (uvmx&3)<<1;
-    uvmy = (uvmy&3)<<1;
-    if(!v->rnd){
-        dsp->avg_h264_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->avg_h264_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
-    }else{
-        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1], srcU, s->uvlinesize, 8, uvmx, uvmy);
-        dsp->avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2], srcV, s->uvlinesize, 8, uvmx, uvmy);
-    }
-}
-
-static av_always_inline int scale_mv(int value, int bfrac, int inv, int qs)
-{
-    int n = bfrac;
-
-#if B_FRACTION_DEN==256
-    if(inv)
-        n -= 256;
-    if(!qs)
-        return 2 * ((value * n + 255) >> 9);
-    return (value * n + 128) >> 8;
-#else
-    if(inv)
-        n -= B_FRACTION_DEN;
-    if(!qs)
-        return 2 * ((value * n + B_FRACTION_DEN - 1) / (2 * B_FRACTION_DEN));
-    return (value * n + B_FRACTION_DEN/2) / B_FRACTION_DEN;
-#endif
-}
-
-/** Reconstruct motion vector for B-frame and do motion compensation
- */
-static inline void vc1_b_mc(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mode)
-{
-    if(v->use_ic) {
-        v->mv_mode2 = v->mv_mode;
-        v->mv_mode = MV_PMODE_INTENSITY_COMP;
-    }
-    if(direct) {
-        vc1_mc_1mv(v, 0);
-        vc1_interp_mc(v);
-        if(v->use_ic) v->mv_mode = v->mv_mode2;
-        return;
-    }
-    if(mode == BMV_TYPE_INTERPOLATED) {
-        vc1_mc_1mv(v, 0);
-        vc1_interp_mc(v);
-        if(v->use_ic) v->mv_mode = v->mv_mode2;
-        return;
-    }
-
-    if(v->use_ic && (mode == BMV_TYPE_BACKWARD)) v->mv_mode = v->mv_mode2;
-    vc1_mc_1mv(v, (mode == BMV_TYPE_BACKWARD));
-    if(v->use_ic) v->mv_mode = v->mv_mode2;
-}
-
-static inline void vc1_pred_b_mv(VC1Context *v, int dmv_x[2], int dmv_y[2], int direct, int mvtype)
-{
-    MpegEncContext *s = &v->s;
-    int xy, wrap, off = 0;
-    int16_t *A, *B, *C;
-    int px, py;
-    int sum;
-    int r_x, r_y;
-    const uint8_t *is_intra = v->mb_type[0];
-
-    r_x = v->range_x;
-    r_y = v->range_y;
-    /* scale MV difference to be quad-pel */
-    dmv_x[0] <<= 1 - s->quarter_sample;
-    dmv_y[0] <<= 1 - s->quarter_sample;
-    dmv_x[1] <<= 1 - s->quarter_sample;
-    dmv_y[1] <<= 1 - s->quarter_sample;
-
-    wrap = s->b8_stride;
-    xy = s->block_index[0];
-
-    if(s->mb_intra) {
-        s->current_picture.motion_val[0][xy][0] =
-        s->current_picture.motion_val[0][xy][1] =
-        s->current_picture.motion_val[1][xy][0] =
-        s->current_picture.motion_val[1][xy][1] = 0;
-        return;
-    }
-    s->mv[0][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 0, s->quarter_sample);
-    s->mv[0][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 0, s->quarter_sample);
-    s->mv[1][0][0] = scale_mv(s->next_picture.motion_val[1][xy][0], v->bfraction, 1, s->quarter_sample);
-    s->mv[1][0][1] = scale_mv(s->next_picture.motion_val[1][xy][1], v->bfraction, 1, s->quarter_sample);
-
-    /* Pullback predicted motion vectors as specified in 8.4.5.4 */
-    s->mv[0][0][0] = av_clip(s->mv[0][0][0], -60 - (s->mb_x << 6), (s->mb_width  << 6) - 4 - (s->mb_x << 6));
-    s->mv[0][0][1] = av_clip(s->mv[0][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6));
-    s->mv[1][0][0] = av_clip(s->mv[1][0][0], -60 - (s->mb_x << 6), (s->mb_width  << 6) - 4 - (s->mb_x << 6));
-    s->mv[1][0][1] = av_clip(s->mv[1][0][1], -60 - (s->mb_y << 6), (s->mb_height << 6) - 4 - (s->mb_y << 6));
-    if(direct) {
-        s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0];
-        s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1];
-        s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0];
-        s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1];
-        return;
-    }
-
-    if((mvtype == BMV_TYPE_FORWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) {
-        C = s->current_picture.motion_val[0][xy - 2];
-        A = s->current_picture.motion_val[0][xy - wrap*2];
-        off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2;
-        B = s->current_picture.motion_val[0][xy - wrap*2 + off];
-
-        if(!s->mb_x) C[0] = C[1] = 0;
-        if(!s->first_slice_line) { // predictor A is not out of bounds
-            if(s->mb_width == 1) {
-                px = A[0];
-                py = A[1];
-            } else {
-                px = mid_pred(A[0], B[0], C[0]);
-                py = mid_pred(A[1], B[1], C[1]);
-            }
-        } else if(s->mb_x) { // predictor C is not out of bounds
-            px = C[0];
-            py = C[1];
-        } else {
-            px = py = 0;
-        }
-        /* Pullback MV as specified in 8.3.5.3.4 */
-        {
-            int qx, qy, X, Y;
-            if(v->profile < PROFILE_ADVANCED) {
-                qx = (s->mb_x << 5);
-                qy = (s->mb_y << 5);
-                X = (s->mb_width << 5) - 4;
-                Y = (s->mb_height << 5) - 4;
-                if(qx + px < -28) px = -28 - qx;
-                if(qy + py < -28) py = -28 - qy;
-                if(qx + px > X) px = X - qx;
-                if(qy + py > Y) py = Y - qy;
-            } else {
-                qx = (s->mb_x << 6);
-                qy = (s->mb_y << 6);
-                X = (s->mb_width << 6) - 4;
-                Y = (s->mb_height << 6) - 4;
-                if(qx + px < -60) px = -60 - qx;
-                if(qy + py < -60) py = -60 - qy;
-                if(qx + px > X) px = X - qx;
-                if(qy + py > Y) py = Y - qy;
-            }
-        }
-        /* Calculate hybrid prediction as specified in 8.3.5.3.5 */
-        if(0 && !s->first_slice_line && s->mb_x) {
-            if(is_intra[xy - wrap])
-                sum = FFABS(px) + FFABS(py);
-            else
-                sum = FFABS(px - A[0]) + FFABS(py - A[1]);
-            if(sum > 32) {
-                if(get_bits1(&s->gb)) {
-                    px = A[0];
-                    py = A[1];
-                } else {
-                    px = C[0];
-                    py = C[1];
-                }
-            } else {
-                if(is_intra[xy - 2])
-                    sum = FFABS(px) + FFABS(py);
-                else
-                    sum = FFABS(px - C[0]) + FFABS(py - C[1]);
-                if(sum > 32) {
-                    if(get_bits1(&s->gb)) {
-                        px = A[0];
-                        py = A[1];
-                    } else {
-                        px = C[0];
-                        py = C[1];
-                    }
-                }
-            }
-        }
-        /* store MV using signed modulus of MV range defined in 4.11 */
-        s->mv[0][0][0] = ((px + dmv_x[0] + r_x) & ((r_x << 1) - 1)) - r_x;
-        s->mv[0][0][1] = ((py + dmv_y[0] + r_y) & ((r_y << 1) - 1)) - r_y;
-    }
-    if((mvtype == BMV_TYPE_BACKWARD) || (mvtype == BMV_TYPE_INTERPOLATED)) {
-        C = s->current_picture.motion_val[1][xy - 2];
-        A = s->current_picture.motion_val[1][xy - wrap*2];
-        off = (s->mb_x == (s->mb_width - 1)) ? -2 : 2;
-        B = s->current_picture.motion_val[1][xy - wrap*2 + off];
-
-        if(!s->mb_x) C[0] = C[1] = 0;
-        if(!s->first_slice_line) { // predictor A is not out of bounds
-            if(s->mb_width == 1) {
-                px = A[0];
-                py = A[1];
-            } else {
-                px = mid_pred(A[0], B[0], C[0]);
-                py = mid_pred(A[1], B[1], C[1]);
-            }
-        } else if(s->mb_x) { // predictor C is not out of bounds
-            px = C[0];
-            py = C[1];
-        } else {
-            px = py = 0;
-        }
-        /* Pullback MV as specified in 8.3.5.3.4 */
-        {
-            int qx, qy, X, Y;
-            if(v->profile < PROFILE_ADVANCED) {
-                qx = (s->mb_x << 5);
-                qy = (s->mb_y << 5);
-                X = (s->mb_width << 5) - 4;
-                Y = (s->mb_height << 5) - 4;
-                if(qx + px < -28) px = -28 - qx;
-                if(qy + py < -28) py = -28 - qy;
-                if(qx + px > X) px = X - qx;
-                if(qy + py > Y) py = Y - qy;
-            } else {
-                qx = (s->mb_x << 6);
-                qy = (s->mb_y << 6);
-                X = (s->mb_width << 6) - 4;
-                Y = (s->mb_height << 6) - 4;
-                if(qx + px < -60) px = -60 - qx;
-                if(qy + py < -60) py = -60 - qy;
-                if(qx + px > X) px = X - qx;
-                if(qy + py > Y) py = Y - qy;
-            }
-        }
-        /* Calculate hybrid prediction as specified in 8.3.5.3.5 */
-        if(0 && !s->first_slice_line && s->mb_x) {
-            if(is_intra[xy - wrap])
-                sum = FFABS(px) + FFABS(py);
-            else
-                sum = FFABS(px - A[0]) + FFABS(py - A[1]);
-            if(sum > 32) {
-                if(get_bits1(&s->gb)) {
-                    px = A[0];
-                    py = A[1];
-                } else {
-                    px = C[0];
-                    py = C[1];
-                }
-            } else {
-                if(is_intra[xy - 2])
-                    sum = FFABS(px) + FFABS(py);
-                else
-                    sum = FFABS(px - C[0]) + FFABS(py - C[1]);
-                if(sum > 32) {
-                    if(get_bits1(&s->gb)) {
-                        px = A[0];
-                        py = A[1];
-                    } else {
-                        px = C[0];
-                        py = C[1];
-                    }
-                }
-            }
-        }
-        /* store MV using signed modulus of MV range defined in 4.11 */
-
-        s->mv[1][0][0] = ((px + dmv_x[1] + r_x) & ((r_x << 1) - 1)) - r_x;
-        s->mv[1][0][1] = ((py + dmv_y[1] + r_y) & ((r_y << 1) - 1)) - r_y;
-    }
-    s->current_picture.motion_val[0][xy][0] = s->mv[0][0][0];
-    s->current_picture.motion_val[0][xy][1] = s->mv[0][0][1];
-    s->current_picture.motion_val[1][xy][0] = s->mv[1][0][0];
-    s->current_picture.motion_val[1][xy][1] = s->mv[1][0][1];
-}
-
-/** Get predicted DC value for I-frames only
- * prediction dir: left=0, top=1
- * @param s MpegEncContext
- * @param overlap flag indicating that overlap filtering is used
- * @param pq integer part of picture quantizer
- * @param[in] n block index in the current MB
- * @param dc_val_ptr Pointer to DC predictor
- * @param dir_ptr Prediction direction for use in AC prediction
- */
-static inline int vc1_i_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
-                              int16_t **dc_val_ptr, int *dir_ptr)
-{
-    int a, b, c, wrap, pred, scale;
-    int16_t *dc_val;
-    static const uint16_t dcpred[32] = {
-    -1, 1024,  512,  341,  256,  205,  171,  146,  128,
-         114,  102,   93,   85,   79,   73,   68,   64,
-          60,   57,   54,   51,   49,   47,   45,   43,
-          41,   39,   38,   37,   35,   34,   33
-    };
-
-    /* find prediction - wmv3_dc_scale always used here in fact */
-    if (n < 4)     scale = s->y_dc_scale;
-    else           scale = s->c_dc_scale;
-
-    wrap = s->block_wrap[n];
-    dc_val= s->dc_val[0] + s->block_index[n];
-
-    /* B A
-     * C X
-     */
-    c = dc_val[ - 1];
-    b = dc_val[ - 1 - wrap];
-    a = dc_val[ - wrap];
-
-    if (pq < 9 || !overlap)
-    {
-        /* Set outer values */
-        if (s->first_slice_line && (n!=2 && n!=3)) b=a=dcpred[scale];
-        if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=dcpred[scale];
-    }
-    else
-    {
-        /* Set outer values */
-        if (s->first_slice_line && (n!=2 && n!=3)) b=a=0;
-        if (s->mb_x == 0 && (n!=1 && n!=3)) b=c=0;
-    }
-
-    if (abs(a - b) <= abs(b - c)) {
-        pred = c;
-        *dir_ptr = 1;//left
-    } else {
-        pred = a;
-        *dir_ptr = 0;//top
-    }
-
-    /* update predictor */
-    *dc_val_ptr = &dc_val[0];
-    return pred;
-}
-
-
-/** Get predicted DC value
- * prediction dir: left=0, top=1
- * @param s MpegEncContext
- * @param overlap flag indicating that overlap filtering is used
- * @param pq integer part of picture quantizer
- * @param[in] n block index in the current MB
- * @param a_avail flag indicating top block availability
- * @param c_avail flag indicating left block availability
- * @param dc_val_ptr Pointer to DC predictor
- * @param dir_ptr Prediction direction for use in AC prediction
- */
-static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
-                              int a_avail, int c_avail,
-                              int16_t **dc_val_ptr, int *dir_ptr)
-{
-    int a, b, c, wrap, pred;
-    int16_t *dc_val;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-    int q1, q2 = 0;
-
-    wrap = s->block_wrap[n];
-    dc_val= s->dc_val[0] + s->block_index[n];
-
-    /* B A
-     * C X
-     */
-    c = dc_val[ - 1];
-    b = dc_val[ - 1 - wrap];
-    a = dc_val[ - wrap];
-    /* scale predictors if needed */
-    q1 = s->current_picture.qscale_table[mb_pos];
-    if(c_avail && (n!= 1 && n!=3)) {
-        q2 = s->current_picture.qscale_table[mb_pos - 1];
-        if(q2 && q2 != q1)
-            c = (c * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
-    }
-    if(a_avail && (n!= 2 && n!=3)) {
-        q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
-        if(q2 && q2 != q1)
-            a = (a * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
-    }
-    if(a_avail && c_avail && (n!=3)) {
-        int off = mb_pos;
-        if(n != 1) off--;
-        if(n != 2) off -= s->mb_stride;
-        q2 = s->current_picture.qscale_table[off];
-        if(q2 && q2 != q1)
-            b = (b * s->y_dc_scale_table[q2] * ff_vc1_dqscale[s->y_dc_scale_table[q1] - 1] + 0x20000) >> 18;
-    }
-
-    if(a_avail && c_avail) {
-        if(abs(a - b) <= abs(b - c)) {
-            pred = c;
-            *dir_ptr = 1;//left
-        } else {
-            pred = a;
-            *dir_ptr = 0;//top
-        }
-    } else if(a_avail) {
-        pred = a;
-        *dir_ptr = 0;//top
-    } else if(c_avail) {
-        pred = c;
-        *dir_ptr = 1;//left
-    } else {
-        pred = 0;
-        *dir_ptr = 1;//left
-    }
-
-    /* update predictor */
-    *dc_val_ptr = &dc_val[0];
-    return pred;
-}
-
-/** @} */ // Block group
-
-/**
- * @defgroup vc1_std_mb VC1 Macroblock-level functions in Simple/Main Profiles
- * @see 7.1.4, p91 and 8.1.1.7, p(1)04
- * @{
- */
-
-static inline int vc1_coded_block_pred(MpegEncContext * s, int n, uint8_t **coded_block_ptr)
-{
-    int xy, wrap, pred, a, b, c;
-
-    xy = s->block_index[n];
-    wrap = s->b8_stride;
-
-    /* B C
-     * A X
-     */
-    a = s->coded_block[xy - 1       ];
-    b = s->coded_block[xy - 1 - wrap];
-    c = s->coded_block[xy     - wrap];
-
-    if (b == c) {
-        pred = a;
-    } else {
-        pred = c;
-    }
-
-    /* store value */
-    *coded_block_ptr = &s->coded_block[xy];
-
-    return pred;
-}
-
-/**
- * Decode one AC coefficient
- * @param v The VC1 context
- * @param last Last coefficient
- * @param skip How much zero coefficients to skip
- * @param value Decoded AC coefficient value
- * @param codingset set of VLC to decode data
- * @see 8.1.3.4
- */
-static void vc1_decode_ac_coeff(VC1Context *v, int *last, int *skip, int *value, int codingset)
-{
-    GetBitContext *gb = &v->s.gb;
-    int index, escape, run = 0, level = 0, lst = 0;
-
-    index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
-    if (index != vc1_ac_sizes[codingset] - 1) {
-        run = vc1_index_decode_table[codingset][index][0];
-        level = vc1_index_decode_table[codingset][index][1];
-        lst = index >= vc1_last_decode_table[codingset] || get_bits_left(gb) < 0;
-        if(get_bits1(gb))
-            level = -level;
-    } else {
-        escape = decode210(gb);
-        if (escape != 2) {
-            index = get_vlc2(gb, ff_vc1_ac_coeff_table[codingset].table, AC_VLC_BITS, 3);
-            run = vc1_index_decode_table[codingset][index][0];
-            level = vc1_index_decode_table[codingset][index][1];
-            lst = index >= vc1_last_decode_table[codingset];
-            if(escape == 0) {
-                if(lst)
-                    level += vc1_last_delta_level_table[codingset][run];
-                else
-                    level += vc1_delta_level_table[codingset][run];
-            } else {
-                if(lst)
-                    run += vc1_last_delta_run_table[codingset][level] + 1;
-                else
-                    run += vc1_delta_run_table[codingset][level] + 1;
-            }
-            if(get_bits1(gb))
-                level = -level;
-        } else {
-            int sign;
-            lst = get_bits1(gb);
-            if(v->s.esc3_level_length == 0) {
-                if(v->pq < 8 || v->dquantfrm) { // table 59
-                    v->s.esc3_level_length = get_bits(gb, 3);
-                    if(!v->s.esc3_level_length)
-                        v->s.esc3_level_length = get_bits(gb, 2) + 8;
-                } else { //table 60
-                    v->s.esc3_level_length = get_unary(gb, 1, 6) + 2;
-                }
-                v->s.esc3_run_length = 3 + get_bits(gb, 2);
-            }
-            run = get_bits(gb, v->s.esc3_run_length);
-            sign = get_bits1(gb);
-            level = get_bits(gb, v->s.esc3_level_length);
-            if(sign)
-                level = -level;
-        }
-    }
-
-    *last = lst;
-    *skip = run;
-    *value = level;
-}
-
-/** Decode intra block in intra frames - should be faster than decode_intra_block
- * @param v VC1Context
- * @param block block to decode
- * @param[in] n subblock index
- * @param coded are AC coeffs present or not
- * @param codingset set of VLC to decode data
- */
-static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset)
-{
-    GetBitContext *gb = &v->s.gb;
-    MpegEncContext *s = &v->s;
-    int dc_pred_dir = 0; /* Direction of the DC prediction used */
-    int i;
-    int16_t *dc_val;
-    int16_t *ac_val, *ac_val2;
-    int dcdiff;
-
-    /* Get DC differential */
-    if (n < 4) {
-        dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-    } else {
-        dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-    }
-    if (dcdiff < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
-        return -1;
-    }
-    if (dcdiff)
-    {
-        if (dcdiff == 119 /* ESC index value */)
-        {
-            /* TODO: Optimize */
-            if (v->pq == 1) dcdiff = get_bits(gb, 10);
-            else if (v->pq == 2) dcdiff = get_bits(gb, 9);
-            else dcdiff = get_bits(gb, 8);
-        }
-        else
-        {
-            if (v->pq == 1)
-                dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;
-            else if (v->pq == 2)
-                dcdiff = (dcdiff<<1) + get_bits1(gb)   - 1;
-        }
-        if (get_bits1(gb))
-            dcdiff = -dcdiff;
-    }
-
-    /* Prediction */
-    dcdiff += vc1_i_pred_dc(&v->s, v->overlap, v->pq, n, &dc_val, &dc_pred_dir);
-    *dc_val = dcdiff;
-
-    /* Store the quantized DC coeff, used for prediction */
-    if (n < 4) {
-        block[0] = dcdiff * s->y_dc_scale;
-    } else {
-        block[0] = dcdiff * s->c_dc_scale;
-    }
-    /* Skip ? */
-    if (!coded) {
-        goto not_coded;
-    }
-
-    //AC Decoding
-    i = 1;
-
-    {
-        int last = 0, skip, value;
-        const int8_t *zz_table;
-        int scale;
-        int k;
-
-        scale = v->pq * 2 + v->halfpq;
-
-        if(v->s.ac_pred) {
-            if(!dc_pred_dir)
-                zz_table = wmv1_scantable[2];
-            else
-                zz_table = wmv1_scantable[3];
-        } else
-            zz_table = wmv1_scantable[1];
-
-        ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
-        ac_val2 = ac_val;
-        if(dc_pred_dir) //left
-            ac_val -= 16;
-        else //top
-            ac_val -= 16 * s->block_wrap[n];
-
-        while (!last) {
-            vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
-            i += skip;
-            if(i > 63)
-                break;
-            block[zz_table[i++]] = value;
-        }
-
-        /* apply AC prediction if needed */
-        if(s->ac_pred) {
-            if(dc_pred_dir) { //left
-                for(k = 1; k < 8; k++)
-                    block[k << 3] += ac_val[k];
-            } else { //top
-                for(k = 1; k < 8; k++)
-                    block[k] += ac_val[k + 8];
-            }
-        }
-        /* save AC coeffs for further prediction */
-        for(k = 1; k < 8; k++) {
-            ac_val2[k] = block[k << 3];
-            ac_val2[k + 8] = block[k];
-        }
-
-        /* scale AC coeffs */
-        for(k = 1; k < 64; k++)
-            if(block[k]) {
-                block[k] *= scale;
-                if(!v->pquantizer)
-                    block[k] += (block[k] < 0) ? -v->pq : v->pq;
-            }
-
-        if(s->ac_pred) i = 63;
-    }
-
-not_coded:
-    if(!coded) {
-        int k, scale;
-        ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
-        ac_val2 = ac_val;
-
-        i = 0;
-        scale = v->pq * 2 + v->halfpq;
-        memset(ac_val2, 0, 16 * 2);
-        if(dc_pred_dir) {//left
-            ac_val -= 16;
-            if(s->ac_pred)
-                memcpy(ac_val2, ac_val, 8 * 2);
-        } else {//top
-            ac_val -= 16 * s->block_wrap[n];
-            if(s->ac_pred)
-                memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
-        }
-
-        /* apply AC prediction if needed */
-        if(s->ac_pred) {
-            if(dc_pred_dir) { //left
-                for(k = 1; k < 8; k++) {
-                    block[k << 3] = ac_val[k] * scale;
-                    if(!v->pquantizer && block[k << 3])
-                        block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq;
-                }
-            } else { //top
-                for(k = 1; k < 8; k++) {
-                    block[k] = ac_val[k + 8] * scale;
-                    if(!v->pquantizer && block[k])
-                        block[k] += (block[k] < 0) ? -v->pq : v->pq;
-                }
-            }
-            i = 63;
-        }
-    }
-    s->block_last_index[n] = i;
-
-    return 0;
-}
-
-/** Decode intra block in intra frames - should be faster than decode_intra_block
- * @param v VC1Context
- * @param block block to decode
- * @param[in] n subblock number
- * @param coded are AC coeffs present or not
- * @param codingset set of VLC to decode data
- * @param mquant quantizer value for this macroblock
- */
-static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset, int mquant)
-{
-    GetBitContext *gb = &v->s.gb;
-    MpegEncContext *s = &v->s;
-    int dc_pred_dir = 0; /* Direction of the DC prediction used */
-    int i;
-    int16_t *dc_val;
-    int16_t *ac_val, *ac_val2;
-    int dcdiff;
-    int a_avail = v->a_avail, c_avail = v->c_avail;
-    int use_pred = s->ac_pred;
-    int scale;
-    int q1, q2 = 0;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-
-    /* Get DC differential */
-    if (n < 4) {
-        dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-    } else {
-        dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-    }
-    if (dcdiff < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
-        return -1;
-    }
-    if (dcdiff)
-    {
-        if (dcdiff == 119 /* ESC index value */)
-        {
-            /* TODO: Optimize */
-            if (mquant == 1) dcdiff = get_bits(gb, 10);
-            else if (mquant == 2) dcdiff = get_bits(gb, 9);
-            else dcdiff = get_bits(gb, 8);
-        }
-        else
-        {
-            if (mquant == 1)
-                dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;
-            else if (mquant == 2)
-                dcdiff = (dcdiff<<1) + get_bits1(gb)   - 1;
-        }
-        if (get_bits1(gb))
-            dcdiff = -dcdiff;
-    }
-
-    /* Prediction */
-    dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir);
-    *dc_val = dcdiff;
-
-    /* Store the quantized DC coeff, used for prediction */
-    if (n < 4) {
-        block[0] = dcdiff * s->y_dc_scale;
-    } else {
-        block[0] = dcdiff * s->c_dc_scale;
-    }
-
-    //AC Decoding
-    i = 1;
-
-    /* check if AC is needed at all */
-    if(!a_avail && !c_avail) use_pred = 0;
-    ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
-    ac_val2 = ac_val;
-
-    scale = mquant * 2 + ((mquant == v->pq) ? v->halfpq : 0);
-
-    if(dc_pred_dir) //left
-        ac_val -= 16;
-    else //top
-        ac_val -= 16 * s->block_wrap[n];
-
-    q1 = s->current_picture.qscale_table[mb_pos];
-    if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1];
-    if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
-    if(dc_pred_dir && n==1) q2 = q1;
-    if(!dc_pred_dir && n==2) q2 = q1;
-    if(n==3) q2 = q1;
-
-    if(coded) {
-        int last = 0, skip, value;
-        const int8_t *zz_table;
-        int k;
-
-        if(v->s.ac_pred) {
-            if(!dc_pred_dir)
-                zz_table = wmv1_scantable[2];
-            else
-                zz_table = wmv1_scantable[3];
-        } else
-            zz_table = wmv1_scantable[1];
-
-        while (!last) {
-            vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
-            i += skip;
-            if(i > 63)
-                break;
-            block[zz_table[i++]] = value;
-        }
-
-        /* apply AC prediction if needed */
-        if(use_pred) {
-            /* scale predictors if needed*/
-            if(q2 && q1!=q2) {
-                q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
-                q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
-
-                if(dc_pred_dir) { //left
-                    for(k = 1; k < 8; k++)
-                        block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                } else { //top
-                    for(k = 1; k < 8; k++)
-                        block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                }
-            } else {
-                if(dc_pred_dir) { //left
-                    for(k = 1; k < 8; k++)
-                        block[k << 3] += ac_val[k];
-                } else { //top
-                    for(k = 1; k < 8; k++)
-                        block[k] += ac_val[k + 8];
-                }
-            }
-        }
-        /* save AC coeffs for further prediction */
-        for(k = 1; k < 8; k++) {
-            ac_val2[k] = block[k << 3];
-            ac_val2[k + 8] = block[k];
-        }
-
-        /* scale AC coeffs */
-        for(k = 1; k < 64; k++)
-            if(block[k]) {
-                block[k] *= scale;
-                if(!v->pquantizer)
-                    block[k] += (block[k] < 0) ? -mquant : mquant;
-            }
-
-        if(use_pred) i = 63;
-    } else { // no AC coeffs
-        int k;
-
-        memset(ac_val2, 0, 16 * 2);
-        if(dc_pred_dir) {//left
-            if(use_pred) {
-                memcpy(ac_val2, ac_val, 8 * 2);
-                if(q2 && q1!=q2) {
-                    q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
-                    q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
-                    for(k = 1; k < 8; k++)
-                        ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                }
-            }
-        } else {//top
-            if(use_pred) {
-                memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
-                if(q2 && q1!=q2) {
-                    q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
-                    q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
-                    for(k = 1; k < 8; k++)
-                        ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                }
-            }
-        }
-
-        /* apply AC prediction if needed */
-        if(use_pred) {
-            if(dc_pred_dir) { //left
-                for(k = 1; k < 8; k++) {
-                    block[k << 3] = ac_val2[k] * scale;
-                    if(!v->pquantizer && block[k << 3])
-                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
-                }
-            } else { //top
-                for(k = 1; k < 8; k++) {
-                    block[k] = ac_val2[k + 8] * scale;
-                    if(!v->pquantizer && block[k])
-                        block[k] += (block[k] < 0) ? -mquant : mquant;
-                }
-            }
-            i = 63;
-        }
-    }
-    s->block_last_index[n] = i;
-
-    return 0;
-}
-
-/** Decode intra block in inter frames - more generic version than vc1_decode_i_block
- * @param v VC1Context
- * @param block block to decode
- * @param[in] n subblock index
- * @param coded are AC coeffs present or not
- * @param mquant block quantizer
- * @param codingset set of VLC to decode data
- */
-static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant, int codingset)
-{
-    GetBitContext *gb = &v->s.gb;
-    MpegEncContext *s = &v->s;
-    int dc_pred_dir = 0; /* Direction of the DC prediction used */
-    int i;
-    int16_t *dc_val;
-    int16_t *ac_val, *ac_val2;
-    int dcdiff;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-    int a_avail = v->a_avail, c_avail = v->c_avail;
-    int use_pred = s->ac_pred;
-    int scale;
-    int q1, q2 = 0;
-
-    s->dsp.clear_block(block);
-
-    /* XXX: Guard against dumb values of mquant */
-    mquant = (mquant < 1) ? 0 : ( (mquant>31) ? 31 : mquant );
-
-    /* Set DC scale - y and c use the same */
-    s->y_dc_scale = s->y_dc_scale_table[mquant];
-    s->c_dc_scale = s->c_dc_scale_table[mquant];
-
-    /* Get DC differential */
-    if (n < 4) {
-        dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-    } else {
-        dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
-    }
-    if (dcdiff < 0){
-        av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
-        return -1;
-    }
-    if (dcdiff)
-    {
-        if (dcdiff == 119 /* ESC index value */)
-        {
-            /* TODO: Optimize */
-            if (mquant == 1) dcdiff = get_bits(gb, 10);
-            else if (mquant == 2) dcdiff = get_bits(gb, 9);
-            else dcdiff = get_bits(gb, 8);
-        }
-        else
-        {
-            if (mquant == 1)
-                dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;
-            else if (mquant == 2)
-                dcdiff = (dcdiff<<1) + get_bits1(gb)   - 1;
-        }
-        if (get_bits1(gb))
-            dcdiff = -dcdiff;
-    }
-
-    /* Prediction */
-    dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, a_avail, c_avail, &dc_val, &dc_pred_dir);
-    *dc_val = dcdiff;
-
-    /* Store the quantized DC coeff, used for prediction */
-
-    if (n < 4) {
-        block[0] = dcdiff * s->y_dc_scale;
-    } else {
-        block[0] = dcdiff * s->c_dc_scale;
-    }
-
-    //AC Decoding
-    i = 1;
-
-    /* check if AC is needed at all and adjust direction if needed */
-    if(!a_avail) dc_pred_dir = 1;
-    if(!c_avail) dc_pred_dir = 0;
-    if(!a_avail && !c_avail) use_pred = 0;
-    ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
-    ac_val2 = ac_val;
-
-    scale = mquant * 2 + v->halfpq;
-
-    if(dc_pred_dir) //left
-        ac_val -= 16;
-    else //top
-        ac_val -= 16 * s->block_wrap[n];
-
-    q1 = s->current_picture.qscale_table[mb_pos];
-    if(dc_pred_dir && c_avail && mb_pos) q2 = s->current_picture.qscale_table[mb_pos - 1];
-    if(!dc_pred_dir && a_avail && mb_pos >= s->mb_stride) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
-    if(dc_pred_dir && n==1) q2 = q1;
-    if(!dc_pred_dir && n==2) q2 = q1;
-    if(n==3) q2 = q1;
-
-    if(coded) {
-        int last = 0, skip, value;
-        const int8_t *zz_table;
-        int k;
-
-        zz_table = wmv1_scantable[0];
-
-        while (!last) {
-            vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
-            i += skip;
-            if(i > 63)
-                break;
-            block[zz_table[i++]] = value;
-        }
-
-        /* apply AC prediction if needed */
-        if(use_pred) {
-            /* scale predictors if needed*/
-            if(q2 && q1!=q2) {
-                q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
-                q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
-
-                if(dc_pred_dir) { //left
-                    for(k = 1; k < 8; k++)
-                        block[k << 3] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                } else { //top
-                    for(k = 1; k < 8; k++)
-                        block[k] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                }
-            } else {
-                if(dc_pred_dir) { //left
-                    for(k = 1; k < 8; k++)
-                        block[k << 3] += ac_val[k];
-                } else { //top
-                    for(k = 1; k < 8; k++)
-                        block[k] += ac_val[k + 8];
-                }
-            }
-        }
-        /* save AC coeffs for further prediction */
-        for(k = 1; k < 8; k++) {
-            ac_val2[k] = block[k << 3];
-            ac_val2[k + 8] = block[k];
-        }
-
-        /* scale AC coeffs */
-        for(k = 1; k < 64; k++)
-            if(block[k]) {
-                block[k] *= scale;
-                if(!v->pquantizer)
-                    block[k] += (block[k] < 0) ? -mquant : mquant;
-            }
-
-        if(use_pred) i = 63;
-    } else { // no AC coeffs
-        int k;
-
-        memset(ac_val2, 0, 16 * 2);
-        if(dc_pred_dir) {//left
-            if(use_pred) {
-                memcpy(ac_val2, ac_val, 8 * 2);
-                if(q2 && q1!=q2) {
-                    q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
-                    q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
-                    for(k = 1; k < 8; k++)
-                        ac_val2[k] = (ac_val2[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                }
-            }
-        } else {//top
-            if(use_pred) {
-                memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
-                if(q2 && q1!=q2) {
-                    q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
-                    q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
-                    for(k = 1; k < 8; k++)
-                        ac_val2[k + 8] = (ac_val2[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18;
-                }
-            }
-        }
-
-        /* apply AC prediction if needed */
-        if(use_pred) {
-            if(dc_pred_dir) { //left
-                for(k = 1; k < 8; k++) {
-                    block[k << 3] = ac_val2[k] * scale;
-                    if(!v->pquantizer && block[k << 3])
-                        block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
-                }
-            } else { //top
-                for(k = 1; k < 8; k++) {
-                    block[k] = ac_val2[k + 8] * scale;
-                    if(!v->pquantizer && block[k])
-                        block[k] += (block[k] < 0) ? -mquant : mquant;
-                }
-            }
-            i = 63;
-        }
-    }
-    s->block_last_index[n] = i;
-
-    return 0;
-}
-
-/** Decode P block
- */
-static int vc1_decode_p_block(VC1Context *v, DCTELEM block[64], int n, int mquant, int ttmb, int first_block,
-                              uint8_t *dst, int linesize, int skip_block, int apply_filter, int cbp_top, int cbp_left)
-{
-    MpegEncContext *s = &v->s;
-    GetBitContext *gb = &s->gb;
-    int i, j;
-    int subblkpat = 0;
-    int scale, off, idx, last, skip, value;
-    int ttblk = ttmb & 7;
-    int pat = 0;
-
-    s->dsp.clear_block(block);
-
-    if(ttmb == -1) {
-        ttblk = ff_vc1_ttblk_to_tt[v->tt_index][get_vlc2(gb, ff_vc1_ttblk_vlc[v->tt_index].table, VC1_TTBLK_VLC_BITS, 1)];
-    }
-    if(ttblk == TT_4X4) {
-        subblkpat = ~(get_vlc2(gb, ff_vc1_subblkpat_vlc[v->tt_index].table, VC1_SUBBLKPAT_VLC_BITS, 1) + 1);
-    }
-    if((ttblk != TT_8X8 && ttblk != TT_4X4) && (v->ttmbf || (ttmb != -1 && (ttmb & 8) && !first_block))) {
-        subblkpat = decode012(gb);
-        if(subblkpat) subblkpat ^= 3; //swap decoded pattern bits
-        if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) ttblk = TT_8X4;
-        if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) ttblk = TT_4X8;
-    }
-    scale = 2 * mquant + ((v->pq == mquant) ? v->halfpq : 0);
-
-    // convert transforms like 8X4_TOP to generic TT and SUBBLKPAT
-    if(ttblk == TT_8X4_TOP || ttblk == TT_8X4_BOTTOM) {
-        subblkpat = 2 - (ttblk == TT_8X4_TOP);
-        ttblk = TT_8X4;
-    }
-    if(ttblk == TT_4X8_RIGHT || ttblk == TT_4X8_LEFT) {
-        subblkpat = 2 - (ttblk == TT_4X8_LEFT);
-        ttblk = TT_4X8;
-    }
-    switch(ttblk) {
-    case TT_8X8:
-        pat = 0xF;
-        i = 0;
-        last = 0;
-        while (!last) {
-            vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
-            i += skip;
-            if(i > 63)
-                break;
-            idx = wmv1_scantable[0][i++];
-            block[idx] = value * scale;
-            if(!v->pquantizer)
-                block[idx] += (block[idx] < 0) ? -mquant : mquant;
-        }
-        if(!skip_block){
-            if(i==1)
-                s->dsp.vc1_inv_trans_8x8_dc(dst, linesize, block);
-            else{
-                s->dsp.vc1_inv_trans_8x8(block);
-                s->dsp.add_pixels_clamped(block, dst, linesize);
-            }
-            if(apply_filter && cbp_top  & 0xC)
-                s->dsp.vc1_v_loop_filter8(dst, linesize, v->pq);
-            if(apply_filter && cbp_left & 0xA)
-                s->dsp.vc1_h_loop_filter8(dst, linesize, v->pq);
-        }
-        break;
-    case TT_4X4:
-        pat = ~subblkpat & 0xF;
-        for(j = 0; j < 4; j++) {
-            last = subblkpat & (1 << (3 - j));
-            i = 0;
-            off = (j & 1) * 4 + (j & 2) * 16;
-            while (!last) {
-                vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
-                i += skip;
-                if(i > 15)
-                    break;
-                idx = ff_vc1_simple_progressive_4x4_zz[i++];
-                block[idx + off] = value * scale;
-                if(!v->pquantizer)
-                    block[idx + off] += (block[idx + off] < 0) ? -mquant : mquant;
-            }
-            if(!(subblkpat & (1 << (3 - j))) && !skip_block){
-                if(i==1)
-                    s->dsp.vc1_inv_trans_4x4_dc(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
-                else
-                    s->dsp.vc1_inv_trans_4x4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, block + off);
-                if(apply_filter && (j&2 ? pat & (1<<(j-2)) : (cbp_top & (1 << (j + 2)))))
-                    s->dsp.vc1_v_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq);
-                if(apply_filter && (j&1 ? pat & (1<<(j-1)) : (cbp_left & (1 << (j + 1)))))
-                    s->dsp.vc1_h_loop_filter4(dst + (j&1)*4 + (j&2)*2*linesize, linesize, v->pq);
-            }
-        }
-        break;
-    case TT_8X4:
-        pat = ~((subblkpat & 2)*6 + (subblkpat & 1)*3) & 0xF;
-        for(j = 0; j < 2; j++) {
-            last = subblkpat & (1 << (1 - j));
-            i = 0;
-            off = j * 32;
-            while (!last) {
-                vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
-                i += skip;
-                if(i > 31)
-                    break;
-                idx = v->zz_8x4[i++]+off;
-                block[idx] = value * scale;
-                if(!v->pquantizer)
-                    block[idx] += (block[idx] < 0) ? -mquant : mquant;
-            }
-            if(!(subblkpat & (1 << (1 - j))) && !skip_block){
-                if(i==1)
-                    s->dsp.vc1_inv_trans_8x4_dc(dst + j*4*linesize, linesize, block + off);
-                else
-                    s->dsp.vc1_inv_trans_8x4(dst + j*4*linesize, linesize, block + off);
-                if(apply_filter && j ? pat & 0x3 : (cbp_top & 0xC))
-                    s->dsp.vc1_v_loop_filter8(dst + j*4*linesize, linesize, v->pq);
-                if(apply_filter && cbp_left & (2 << j))
-                    s->dsp.vc1_h_loop_filter4(dst + j*4*linesize, linesize, v->pq);
-            }
-        }
-        break;
-    case TT_4X8:
-        pat = ~(subblkpat*5) & 0xF;
-        for(j = 0; j < 2; j++) {
-            last = subblkpat & (1 << (1 - j));
-            i = 0;
-            off = j * 4;
-            while (!last) {
-                vc1_decode_ac_coeff(v, &last, &skip, &value, v->codingset2);
-                i += skip;
-                if(i > 31)
-                    break;
-                idx = v->zz_4x8[i++]+off;
-                block[idx] = value * scale;
-                if(!v->pquantizer)
-                    block[idx] += (block[idx] < 0) ? -mquant : mquant;
-            }
-            if(!(subblkpat & (1 << (1 - j))) && !skip_block){
-                if(i==1)
-                    s->dsp.vc1_inv_trans_4x8_dc(dst + j*4, linesize, block + off);
-                else
-                    s->dsp.vc1_inv_trans_4x8(dst + j*4, linesize, block + off);
-                if(apply_filter && cbp_top & (2 << j))
-                    s->dsp.vc1_v_loop_filter4(dst + j*4, linesize, v->pq);
-                if(apply_filter && j ? pat & 0x5 : (cbp_left & 0xA))
-                    s->dsp.vc1_h_loop_filter8(dst + j*4, linesize, v->pq);
-            }
-        }
-        break;
-    }
-    return pat;
-}
-
-/** @} */ // Macroblock group
-
-static const int size_table  [6] = { 0, 2, 3, 4,  5,  8 };
-static const int offset_table[6] = { 0, 1, 3, 7, 15, 31 };
-
-/** Decode one P-frame MB (in Simple/Main profile)
- */
-static int vc1_decode_p_mb(VC1Context *v)
-{
-    MpegEncContext *s = &v->s;
-    GetBitContext *gb = &s->gb;
-    int i, j;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-    int cbp; /* cbp decoding stuff */
-    int mqdiff, mquant; /* MB quantization */
-    int ttmb = v->ttfrm; /* MB Transform type */
-
-    int mb_has_coeffs = 1; /* last_flag */
-    int dmv_x, dmv_y; /* Differential MV components */
-    int index, index1; /* LUT indexes */
-    int val, sign; /* temp values */
-    int first_block = 1;
-    int dst_idx, off;
-    int skipped, fourmv;
-    int block_cbp = 0, pat;
-    int apply_loop_filter;
-
-    mquant = v->pq; /* Loosy initialization */
-
-    if (v->mv_type_is_raw)
-        fourmv = get_bits1(gb);
-    else
-        fourmv = v->mv_type_mb_plane[mb_pos];
-    if (v->skip_is_raw)
-        skipped = get_bits1(gb);
-    else
-        skipped = v->s.mbskip_table[mb_pos];
-
-    apply_loop_filter = s->loop_filter && !(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY);
-    if (!fourmv) /* 1MV mode */
-    {
-        if (!skipped)
-        {
-            GET_MVDATA(dmv_x, dmv_y);
-
-            if (s->mb_intra) {
-                s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
-                s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
-            }
-            s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16;
-            vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]);
-
-            /* FIXME Set DC val for inter block ? */
-            if (s->mb_intra && !mb_has_coeffs)
-            {
-                GET_MQUANT();
-                s->ac_pred = get_bits1(gb);
-                cbp = 0;
-            }
-            else if (mb_has_coeffs)
-            {
-                if (s->mb_intra) s->ac_pred = get_bits1(gb);
-                cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
-                GET_MQUANT();
-            }
-            else
-            {
-                mquant = v->pq;
-                cbp = 0;
-            }
-            s->current_picture.qscale_table[mb_pos] = mquant;
-
-            if (!v->ttmbf && !s->mb_intra && mb_has_coeffs)
-                ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table,
-                                VC1_TTMB_VLC_BITS, 2);
-            if(!s->mb_intra) vc1_mc_1mv(v, 0);
-            dst_idx = 0;
-            for (i=0; i<6; i++)
-            {
-                s->dc_val[0][s->block_index[i]] = 0;
-                dst_idx += i >> 2;
-                val = ((cbp >> (5 - i)) & 1);
-                off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
-                v->mb_type[0][s->block_index[i]] = s->mb_intra;
-                if(s->mb_intra) {
-                    /* check if prediction blocks A and C are available */
-                    v->a_avail = v->c_avail = 0;
-                    if(i == 2 || i == 3 || !s->first_slice_line)
-                        v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
-                    if(i == 1 || i == 3 || s->mb_x)
-                        v->c_avail = v->mb_type[0][s->block_index[i] - 1];
-
-                    vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
-                    if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
-                    s->dsp.vc1_inv_trans_8x8(s->block[i]);
-                    if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
-                    s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
-                    if(v->pq >= 9 && v->overlap) {
-                        if(v->c_avail)
-                            s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
-                        if(v->a_avail)
-                            s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
-                    }
-                    if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        int left_cbp, top_cbp;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                    }
-                    block_cbp |= 0xF << (i << 2);
-                } else if(val) {
-                    int left_cbp = 0, top_cbp = 0, filter = 0;
-                    if(apply_loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        filter = 1;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                    }
-                    pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
-                    block_cbp |= pat << (i << 2);
-                    if(!v->ttmbf && ttmb < 8) ttmb = -1;
-                    first_block = 0;
-                }
-            }
-        }
-        else //Skipped
-        {
-            s->mb_intra = 0;
-            for(i = 0; i < 6; i++) {
-                v->mb_type[0][s->block_index[i]] = 0;
-                s->dc_val[0][s->block_index[i]] = 0;
-            }
-            s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP;
-            s->current_picture.qscale_table[mb_pos] = 0;
-            vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]);
-            vc1_mc_1mv(v, 0);
-            return 0;
-        }
-    } //1MV mode
-    else //4MV mode
-    {
-        if (!skipped /* unskipped MB */)
-        {
-            int intra_count = 0, coded_inter = 0;
-            int is_intra[6], is_coded[6];
-            /* Get CBPCY */
-            cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
-            for (i=0; i<6; i++)
-            {
-                val = ((cbp >> (5 - i)) & 1);
-                s->dc_val[0][s->block_index[i]] = 0;
-                s->mb_intra = 0;
-                if(i < 4) {
-                    dmv_x = dmv_y = 0;
-                    s->mb_intra = 0;
-                    mb_has_coeffs = 0;
-                    if(val) {
-                        GET_MVDATA(dmv_x, dmv_y);
-                    }
-                    vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]);
-                    if(!s->mb_intra) vc1_mc_4mv_luma(v, i);
-                    intra_count += s->mb_intra;
-                    is_intra[i] = s->mb_intra;
-                    is_coded[i] = mb_has_coeffs;
-                }
-                if(i&4){
-                    is_intra[i] = (intra_count >= 3);
-                    is_coded[i] = val;
-                }
-                if(i == 4) vc1_mc_4mv_chroma(v);
-                v->mb_type[0][s->block_index[i]] = is_intra[i];
-                if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i];
-            }
-            // if there are no coded blocks then don't do anything more
-            if(!intra_count && !coded_inter) return 0;
-            dst_idx = 0;
-            GET_MQUANT();
-            s->current_picture.qscale_table[mb_pos] = mquant;
-            /* test if block is intra and has pred */
-            {
-                int intrapred = 0;
-                for(i=0; i<6; i++)
-                    if(is_intra[i]) {
-                        if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]])
-                            || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) {
-                            intrapred = 1;
-                            break;
-                        }
-                    }
-                if(intrapred)s->ac_pred = get_bits1(gb);
-                else s->ac_pred = 0;
-            }
-            if (!v->ttmbf && coded_inter)
-                ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
-            for (i=0; i<6; i++)
-            {
-                dst_idx += i >> 2;
-                off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
-                s->mb_intra = is_intra[i];
-                if (is_intra[i]) {
-                    /* check if prediction blocks A and C are available */
-                    v->a_avail = v->c_avail = 0;
-                    if(i == 2 || i == 3 || !s->first_slice_line)
-                        v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
-                    if(i == 1 || i == 3 || s->mb_x)
-                        v->c_avail = v->mb_type[0][s->block_index[i] - 1];
-
-                    vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset);
-                    if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
-                    s->dsp.vc1_inv_trans_8x8(s->block[i]);
-                    if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
-                    s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
-                    if(v->pq >= 9 && v->overlap) {
-                        if(v->c_avail)
-                            s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
-                        if(v->a_avail)
-                            s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
-                    }
-                    if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        int left_cbp, top_cbp;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                    }
-                    block_cbp |= 0xF << (i << 2);
-                } else if(is_coded[i]) {
-                    int left_cbp = 0, top_cbp = 0, filter = 0;
-                    if(v->s.loop_filter && s->mb_x && s->mb_x != (s->mb_width - 1) && s->mb_y && s->mb_y != (s->mb_height - 1)){
-                        filter = 1;
-                        if(i & 4){
-                            left_cbp = v->cbp[s->mb_x - 1]            >> (i * 4);
-                            top_cbp  = v->cbp[s->mb_x - s->mb_stride] >> (i * 4);
-                        }else{
-                            left_cbp = (i & 1) ? (cbp >> ((i-1)*4)) : (v->cbp[s->mb_x - 1]           >> ((i+1)*4));
-                            top_cbp  = (i & 2) ? (cbp >> ((i-2)*4)) : (v->cbp[s->mb_x - s->mb_stride] >> ((i+2)*4));
-                        }
-                        if(left_cbp & 0xC)
-                            s->dsp.vc1_v_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                        if(top_cbp  & 0xA)
-                            s->dsp.vc1_h_loop_filter8(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize, v->pq);
-                    }
-                    pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), filter, left_cbp, top_cbp);
-                    block_cbp |= pat << (i << 2);
-                    if(!v->ttmbf && ttmb < 8) ttmb = -1;
-                    first_block = 0;
-                }
-            }
-            return 0;
-        }
-        else //Skipped MB
-        {
-            s->mb_intra = 0;
-            s->current_picture.qscale_table[mb_pos] = 0;
-            for (i=0; i<6; i++) {
-                v->mb_type[0][s->block_index[i]] = 0;
-                s->dc_val[0][s->block_index[i]] = 0;
-            }
-            for (i=0; i<4; i++)
-            {
-                vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]);
-                vc1_mc_4mv_luma(v, i);
-            }
-            vc1_mc_4mv_chroma(v);
-            s->current_picture.qscale_table[mb_pos] = 0;
-            return 0;
-        }
-    }
-    v->cbp[s->mb_x] = block_cbp;
-
-    /* Should never happen */
-    return -1;
-}
-
-/** Decode one B-frame MB (in Main profile)
- */
-static void vc1_decode_b_mb(VC1Context *v)
-{
-    MpegEncContext *s = &v->s;
-    GetBitContext *gb = &s->gb;
-    int i, j;
-    int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-    int cbp = 0; /* cbp decoding stuff */
-    int mqdiff, mquant; /* MB quantization */
-    int ttmb = v->ttfrm; /* MB Transform type */
-    int mb_has_coeffs = 0; /* last_flag */
-    int index, index1; /* LUT indexes */
-    int val, sign; /* temp values */
-    int first_block = 1;
-    int dst_idx, off;
-    int skipped, direct;
-    int dmv_x[2], dmv_y[2];
-    int bmvtype = BMV_TYPE_BACKWARD;
-
-    mquant = v->pq; /* Loosy initialization */
-    s->mb_intra = 0;
-
-    if (v->dmb_is_raw)
-        direct = get_bits1(gb);
-    else
-        direct = v->direct_mb_plane[mb_pos];
-    if (v->skip_is_raw)
-        skipped = get_bits1(gb);
-    else
-        skipped = v->s.mbskip_table[mb_pos];
-
-    dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0;
-    for(i = 0; i < 6; i++) {
-        v->mb_type[0][s->block_index[i]] = 0;
-        s->dc_val[0][s->block_index[i]] = 0;
-    }
-    s->current_picture.qscale_table[mb_pos] = 0;
-
-    if (!direct) {
-        if (!skipped) {
-            GET_MVDATA(dmv_x[0], dmv_y[0]);
-            dmv_x[1] = dmv_x[0];
-            dmv_y[1] = dmv_y[0];
-        }
-        if(skipped || !s->mb_intra) {
-            bmvtype = decode012(gb);
-            switch(bmvtype) {
-            case 0:
-                bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD;
-                break;
-            case 1:
-                bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD;
-                break;
-            case 2:
-                bmvtype = BMV_TYPE_INTERPOLATED;
-                dmv_x[0] = dmv_y[0] = 0;
-            }
-        }
-    }
-    for(i = 0; i < 6; i++)
-        v->mb_type[0][s->block_index[i]] = s->mb_intra;
-
-    if (skipped) {
-        if(direct) bmvtype = BMV_TYPE_INTERPOLATED;
-        vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
-        vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
-        return;
-    }
-    if (direct) {
-        cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
-        GET_MQUANT();
-        s->mb_intra = 0;
-        s->current_picture.qscale_table[mb_pos] = mquant;
-        if(!v->ttmbf)
-            ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
-        dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0;
-        vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
-        vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
-    } else {
-        if(!mb_has_coeffs && !s->mb_intra) {
-            /* no coded blocks - effectively skipped */
-            vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
-            vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
-            return;
-        }
-        if(s->mb_intra && !mb_has_coeffs) {
-            GET_MQUANT();
-            s->current_picture.qscale_table[mb_pos] = mquant;
-            s->ac_pred = get_bits1(gb);
-            cbp = 0;
-            vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
-        } else {
-            if(bmvtype == BMV_TYPE_INTERPOLATED) {
-                GET_MVDATA(dmv_x[0], dmv_y[0]);
-                if(!mb_has_coeffs) {
-                    /* interpolated skipped block */
-                    vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
-                    vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
-                    return;
-                }
-            }
-            vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype);
-            if(!s->mb_intra) {
-                vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype);
-            }
-            if(s->mb_intra)
-                s->ac_pred = get_bits1(gb);
-            cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
-            GET_MQUANT();
-            s->current_picture.qscale_table[mb_pos] = mquant;
-            if(!v->ttmbf && !s->mb_intra && mb_has_coeffs)
-                ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
-        }
-    }
-    dst_idx = 0;
-    for (i=0; i<6; i++)
-    {
-        s->dc_val[0][s->block_index[i]] = 0;
-        dst_idx += i >> 2;
-        val = ((cbp >> (5 - i)) & 1);
-        off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
-        v->mb_type[0][s->block_index[i]] = s->mb_intra;
-        if(s->mb_intra) {
-            /* check if prediction blocks A and C are available */
-            v->a_avail = v->c_avail = 0;
-            if(i == 2 || i == 3 || !s->first_slice_line)
-                v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
-            if(i == 1 || i == 3 || s->mb_x)
-                v->c_avail = v->mb_type[0][s->block_index[i] - 1];
-
-            vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
-            if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
-            s->dsp.vc1_inv_trans_8x8(s->block[i]);
-            if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
-            s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
-        } else if(val) {
-            vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY), 0, 0, 0);
-            if(!v->ttmbf && ttmb < 8) ttmb = -1;
-            first_block = 0;
-        }
-    }
-}
-
-/** Decode blocks of I-frame
- */
-static void vc1_decode_i_blocks(VC1Context *v)
-{
-    int k, j;
-    MpegEncContext *s = &v->s;
-    int cbp, val;
-    uint8_t *coded_val;
-    int mb_pos;
-
-    /* select codingmode used for VLC tables selection */
-    switch(v->y_ac_table_index){
-    case 0:
-        v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
-        break;
-    case 1:
-        v->codingset = CS_HIGH_MOT_INTRA;
-        break;
-    case 2:
-        v->codingset = CS_MID_RATE_INTRA;
-        break;
-    }
-
-    switch(v->c_ac_table_index){
-    case 0:
-        v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
-        break;
-    case 1:
-        v->codingset2 = CS_HIGH_MOT_INTER;
-        break;
-    case 2:
-        v->codingset2 = CS_MID_RATE_INTER;
-        break;
-    }
-
-    /* Set DC scale - y and c use the same */
-    s->y_dc_scale = s->y_dc_scale_table[v->pq];
-    s->c_dc_scale = s->c_dc_scale_table[v->pq];
-
-    //do frame decode
-    s->mb_x = s->mb_y = 0;
-    s->mb_intra = 1;
-    s->first_slice_line = 1;
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
-        s->mb_x = 0;
-        ff_init_block_index(s);
-        for(; s->mb_x < s->mb_width; s->mb_x++) {
-            ff_update_block_index(s);
-            s->dsp.clear_blocks(s->block[0]);
-            mb_pos = s->mb_x + s->mb_y * s->mb_width;
-            s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
-            s->current_picture.qscale_table[mb_pos] = v->pq;
-            s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
-            s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
-
-            // do actual MB decoding and displaying
-            cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
-            v->s.ac_pred = get_bits1(&v->s.gb);
-
-            for(k = 0; k < 6; k++) {
-                val = ((cbp >> (5 - k)) & 1);
-
-                if (k < 4) {
-                    int pred = vc1_coded_block_pred(&v->s, k, &coded_val);
-                    val = val ^ pred;
-                    *coded_val = val;
-                }
-                cbp |= val << (5 - k);
-
-                vc1_decode_i_block(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2);
-
-                s->dsp.vc1_inv_trans_8x8(s->block[k]);
-                if(v->pq >= 9 && v->overlap) {
-                    for(j = 0; j < 64; j++) s->block[k][j] += 128;
-                }
-            }
-
-            vc1_put_block(v, s->block);
-            if(v->pq >= 9 && v->overlap) {
-                if(s->mb_x) {
-                    s->dsp.vc1_h_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
-                    if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
-                    }
-                }
-                s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
-                s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
-                if(!s->first_slice_line) {
-                    s->dsp.vc1_v_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
-                    if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
-                    }
-                }
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
-            }
-            if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
-
-            if(get_bits_count(&s->gb) > v->bits) {
-                ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
-                av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
-                return;
-            }
-        }
-        ff_draw_horiz_band(s, s->mb_y * 16, 16);
-        s->first_slice_line = 0;
-    }
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
-}
-
-/** Decode blocks of I-frame for advanced profile
- */
-static void vc1_decode_i_blocks_adv(VC1Context *v)
-{
-    int k, j;
-    MpegEncContext *s = &v->s;
-    int cbp, val;
-    uint8_t *coded_val;
-    int mb_pos;
-    int mquant = v->pq;
-    int mqdiff;
-    int overlap;
-    GetBitContext *gb = &s->gb;
-
-    /* select codingmode used for VLC tables selection */
-    switch(v->y_ac_table_index){
-    case 0:
-        v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
-        break;
-    case 1:
-        v->codingset = CS_HIGH_MOT_INTRA;
-        break;
-    case 2:
-        v->codingset = CS_MID_RATE_INTRA;
-        break;
-    }
-
-    switch(v->c_ac_table_index){
-    case 0:
-        v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
-        break;
-    case 1:
-        v->codingset2 = CS_HIGH_MOT_INTER;
-        break;
-    case 2:
-        v->codingset2 = CS_MID_RATE_INTER;
-        break;
-    }
-
-    //do frame decode
-    s->mb_x = s->mb_y = 0;
-    s->mb_intra = 1;
-    s->first_slice_line = 1;
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
-        s->mb_x = 0;
-        ff_init_block_index(s);
-        for(;s->mb_x < s->mb_width; s->mb_x++) {
-            ff_update_block_index(s);
-            s->dsp.clear_blocks(s->block[0]);
-            mb_pos = s->mb_x + s->mb_y * s->mb_stride;
-            s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA;
-            s->current_picture.motion_val[1][s->block_index[0]][0] = 0;
-            s->current_picture.motion_val[1][s->block_index[0]][1] = 0;
-
-            // do actual MB decoding and displaying
-            cbp = get_vlc2(&v->s.gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
-            if(v->acpred_is_raw)
-                v->s.ac_pred = get_bits1(&v->s.gb);
-            else
-                v->s.ac_pred = v->acpred_plane[mb_pos];
-
-            if(v->condover == CONDOVER_SELECT) {
-                if(v->overflg_is_raw)
-                    overlap = get_bits1(&v->s.gb);
-                else
-                    overlap = v->over_flags_plane[mb_pos];
-            } else
-                overlap = (v->condover == CONDOVER_ALL);
-
-            GET_MQUANT();
-
-            s->current_picture.qscale_table[mb_pos] = mquant;
-            /* Set DC scale - y and c use the same */
-            s->y_dc_scale = s->y_dc_scale_table[mquant];
-            s->c_dc_scale = s->c_dc_scale_table[mquant];
-
-            for(k = 0; k < 6; k++) {
-                val = ((cbp >> (5 - k)) & 1);
-
-                if (k < 4) {
-                    int pred = vc1_coded_block_pred(&v->s, k, &coded_val);
-                    val = val ^ pred;
-                    *coded_val = val;
-                }
-                cbp |= val << (5 - k);
-
-                v->a_avail = !s->first_slice_line || (k==2 || k==3);
-                v->c_avail = !!s->mb_x || (k==1 || k==3);
-
-                vc1_decode_i_block_adv(v, s->block[k], k, val, (k<4)? v->codingset : v->codingset2, mquant);
-
-                s->dsp.vc1_inv_trans_8x8(s->block[k]);
-                for(j = 0; j < 64; j++) s->block[k][j] += 128;
-            }
-
-            vc1_put_block(v, s->block);
-            if(overlap) {
-                if(s->mb_x) {
-                    s->dsp.vc1_h_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
-                    if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_h_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_h_overlap(s->dest[2], s->uvlinesize);
-                    }
-                }
-                s->dsp.vc1_h_overlap(s->dest[0] + 8, s->linesize);
-                s->dsp.vc1_h_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
-                if(!s->first_slice_line) {
-                    s->dsp.vc1_v_overlap(s->dest[0], s->linesize);
-                    s->dsp.vc1_v_overlap(s->dest[0] + 8, s->linesize);
-                    if(!(s->flags & CODEC_FLAG_GRAY)) {
-                        s->dsp.vc1_v_overlap(s->dest[1], s->uvlinesize);
-                        s->dsp.vc1_v_overlap(s->dest[2], s->uvlinesize);
-                    }
-                }
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize, s->linesize);
-                s->dsp.vc1_v_overlap(s->dest[0] + 8 * s->linesize + 8, s->linesize);
-            }
-            if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
-
-            if(get_bits_count(&s->gb) > v->bits) {
-                ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
-                av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i\n", get_bits_count(&s->gb), v->bits);
-                return;
-            }
-        }
-        ff_draw_horiz_band(s, s->mb_y * 16, 16);
-        s->first_slice_line = 0;
-    }
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
-}
-
-static void vc1_decode_p_blocks(VC1Context *v)
-{
-    MpegEncContext *s = &v->s;
-
-    /* select codingmode used for VLC tables selection */
-    switch(v->c_ac_table_index){
-    case 0:
-        v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
-        break;
-    case 1:
-        v->codingset = CS_HIGH_MOT_INTRA;
-        break;
-    case 2:
-        v->codingset = CS_MID_RATE_INTRA;
-        break;
-    }
-
-    switch(v->c_ac_table_index){
-    case 0:
-        v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
-        break;
-    case 1:
-        v->codingset2 = CS_HIGH_MOT_INTER;
-        break;
-    case 2:
-        v->codingset2 = CS_MID_RATE_INTER;
-        break;
-    }
-
-    s->first_slice_line = 1;
-    memset(v->cbp_base, 0, sizeof(v->cbp_base[0])*2*s->mb_stride);
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
-        s->mb_x = 0;
-        ff_init_block_index(s);
-        for(; s->mb_x < s->mb_width; s->mb_x++) {
-            ff_update_block_index(s);
-
-            vc1_decode_p_mb(v);
-            if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
-                ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
-                av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y);
-                return;
-            }
-        }
-        memmove(v->cbp_base, v->cbp, sizeof(v->cbp_base[0])*s->mb_stride);
-        ff_draw_horiz_band(s, s->mb_y * 16, 16);
-        s->first_slice_line = 0;
-    }
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
-}
-
-static void vc1_decode_b_blocks(VC1Context *v)
-{
-    MpegEncContext *s = &v->s;
-
-    /* select codingmode used for VLC tables selection */
-    switch(v->c_ac_table_index){
-    case 0:
-        v->codingset = (v->pqindex <= 8) ? CS_HIGH_RATE_INTRA : CS_LOW_MOT_INTRA;
-        break;
-    case 1:
-        v->codingset = CS_HIGH_MOT_INTRA;
-        break;
-    case 2:
-        v->codingset = CS_MID_RATE_INTRA;
-        break;
-    }
-
-    switch(v->c_ac_table_index){
-    case 0:
-        v->codingset2 = (v->pqindex <= 8) ? CS_HIGH_RATE_INTER : CS_LOW_MOT_INTER;
-        break;
-    case 1:
-        v->codingset2 = CS_HIGH_MOT_INTER;
-        break;
-    case 2:
-        v->codingset2 = CS_MID_RATE_INTER;
-        break;
-    }
-
-    s->first_slice_line = 1;
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
-        s->mb_x = 0;
-        ff_init_block_index(s);
-        for(; s->mb_x < s->mb_width; s->mb_x++) {
-            ff_update_block_index(s);
-
-            vc1_decode_b_mb(v);
-            if(get_bits_count(&s->gb) > v->bits || get_bits_count(&s->gb) < 0) {
-                ff_er_add_slice(s, 0, 0, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END));
-                av_log(s->avctx, AV_LOG_ERROR, "Bits overconsumption: %i > %i at %ix%i\n", get_bits_count(&s->gb), v->bits,s->mb_x,s->mb_y);
-                return;
-            }
-            if(v->s.loop_filter) vc1_loop_filter_iblk(s, v->pq);
-        }
-        ff_draw_horiz_band(s, s->mb_y * 16, 16);
-        s->first_slice_line = 0;
-    }
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
-}
-
-static void vc1_decode_skip_blocks(VC1Context *v)
-{
-    MpegEncContext *s = &v->s;
-
-    ff_er_add_slice(s, 0, 0, s->mb_width - 1, s->mb_height - 1, (AC_END|DC_END|MV_END));
-    s->first_slice_line = 1;
-    for(s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
-        s->mb_x = 0;
-        ff_init_block_index(s);
-        ff_update_block_index(s);
-        memcpy(s->dest[0], s->last_picture.data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16);
-        memcpy(s->dest[1], s->last_picture.data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8);
-        memcpy(s->dest[2], s->last_picture.data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8);
-        ff_draw_horiz_band(s, s->mb_y * 16, 16);
-        s->first_slice_line = 0;
-    }
-    s->pict_type = FF_P_TYPE;
-}
-
-static void vc1_decode_blocks(VC1Context *v)
-{
-
-    v->s.esc3_level_length = 0;
-    if(v->x8_type){
-        ff_intrax8_decode_picture(&v->x8, 2*v->pq+v->halfpq, v->pq*(!v->pquantizer) );
-    }else{
-
-        switch(v->s.pict_type) {
-        case FF_I_TYPE:
-            if(v->profile == PROFILE_ADVANCED)
-                vc1_decode_i_blocks_adv(v);
-            else
-                vc1_decode_i_blocks(v);
-            break;
-        case FF_P_TYPE:
-            if(v->p_frame_skipped)
-                vc1_decode_skip_blocks(v);
-            else
-                vc1_decode_p_blocks(v);
-            break;
-        case FF_B_TYPE:
-            if(v->bi_type){
-                if(v->profile == PROFILE_ADVANCED)
-                    vc1_decode_i_blocks_adv(v);
-                else
-                    vc1_decode_i_blocks(v);
-            }else
-                vc1_decode_b_blocks(v);
-            break;
-        }
-    }
-}
-
-/** Initialize a VC1/WMV3 decoder
- * @todo TODO: Handle VC-1 IDUs (Transport level?)
- * @todo TODO: Decypher remaining bits in extra_data
- */
-static av_cold int vc1_decode_init(AVCodecContext *avctx)
-{
-    VC1Context *v = avctx->priv_data;
-    MpegEncContext *s = &v->s;
-    GetBitContext gb;
-
-    if (!avctx->extradata_size || !avctx->extradata) return -1;
-    if (!(avctx->flags & CODEC_FLAG_GRAY))
-        avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
-    else
-        avctx->pix_fmt = PIX_FMT_GRAY8;
-    avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
-    v->s.avctx = avctx;
-    avctx->flags |= CODEC_FLAG_EMU_EDGE;
-    v->s.flags |= CODEC_FLAG_EMU_EDGE;
-
-    if(avctx->idct_algo==FF_IDCT_AUTO){
-        avctx->idct_algo=FF_IDCT_WMV2;
-    }
-
-    if(ff_msmpeg4_decode_init(avctx) < 0)
-        return -1;
-    if (vc1_init_common(v) < 0) return -1;
-
-    avctx->coded_width = avctx->width;
-    avctx->coded_height = avctx->height;
-    if (avctx->codec_id == CODEC_ID_WMV3)
-    {
-        int count = 0;
-
-        // looks like WMV3 has a sequence header stored in the extradata
-        // advanced sequence header may be before the first frame
-        // the last byte of the extradata is a version number, 1 for the
-        // samples we can decode
-
-        init_get_bits(&gb, avctx->extradata, avctx->extradata_size*8);
-
-        if (vc1_decode_sequence_header(avctx, v, &gb) < 0)
-          return -1;
-
-        count = avctx->extradata_size*8 - get_bits_count(&gb);
-        if (count>0)
-        {
-            av_log(avctx, AV_LOG_INFO, "Extra data: %i bits left, value: %X\n",
-                   count, get_bits(&gb, count));
-        }
-        else if (count < 0)
-        {
-            av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count);
-        }
-    } else { // VC1/WVC1
-        const uint8_t *start = avctx->extradata;
-        uint8_t *end = avctx->extradata + avctx->extradata_size;
-        const uint8_t *next;
-        int size, buf2_size;
-        uint8_t *buf2 = NULL;
-        int seq_initialized = 0, ep_initialized = 0;
-
-        if(avctx->extradata_size < 16) {
-            av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size);
-            return -1;
-        }
-
-        buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-        start = find_next_marker(start, end); // in WVC1 extradata first byte is its size, but can be 0 in mkv
-        next = start;
-        for(; next < end; start = next){
-            next = find_next_marker(start + 4, end);
-            size = next - start - 4;
-            if(size <= 0) continue;
-            buf2_size = vc1_unescape_buffer(start + 4, size, buf2);
-            init_get_bits(&gb, buf2, buf2_size * 8);
-            switch(AV_RB32(start)){
-            case VC1_CODE_SEQHDR:
-                if(vc1_decode_sequence_header(avctx, v, &gb) < 0){
-                    av_free(buf2);
-                    return -1;
-                }
-                seq_initialized = 1;
-                break;
-            case VC1_CODE_ENTRYPOINT:
-                if(vc1_decode_entry_point(avctx, v, &gb) < 0){
-                    av_free(buf2);
-                    return -1;
-                }
-                ep_initialized = 1;
-                break;
-            }
-        }
-        av_free(buf2);
-        if(!seq_initialized || !ep_initialized){
-            av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
-            return -1;
-        }
-    }
-    avctx->has_b_frames= !!(avctx->max_b_frames);
-    s->low_delay = !avctx->has_b_frames;
-
-    s->mb_width = (avctx->coded_width+15)>>4;
-    s->mb_height = (avctx->coded_height+15)>>4;
-
-    /* Allocate mb bitplanes */
-    v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height);
-    v->direct_mb_plane = av_malloc(s->mb_stride * s->mb_height);
-    v->acpred_plane = av_malloc(s->mb_stride * s->mb_height);
-    v->over_flags_plane = av_malloc(s->mb_stride * s->mb_height);
-
-    v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride);
-    v->cbp = v->cbp_base + s->mb_stride;
-
-    /* allocate block type info in that way so it could be used with s->block_index[] */
-    v->mb_type_base = av_malloc(s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride * (s->mb_height + 1) * 2);
-    v->mb_type[0] = v->mb_type_base + s->b8_stride + 1;
-    v->mb_type[1] = v->mb_type_base + s->b8_stride * (s->mb_height * 2 + 1) + s->mb_stride + 1;
-    v->mb_type[2] = v->mb_type[1] + s->mb_stride * (s->mb_height + 1);
-
-    /* Init coded blocks info */
-    if (v->profile == PROFILE_ADVANCED)
-    {
-//        if (alloc_bitplane(&v->over_flags_plane, s->mb_width, s->mb_height) < 0)
-//            return -1;
-//        if (alloc_bitplane(&v->ac_pred_plane, s->mb_width, s->mb_height) < 0)
-//            return -1;
-    }
-
-    ff_intrax8_common_init(&v->x8,s);
-    return 0;
-}
-
-
-/** Decode a VC1/WMV3 frame
- * @todo TODO: Handle VC-1 IDUs (Transport level?)
- */
-static int vc1_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VC1Context *v = avctx->priv_data;
-    MpegEncContext *s = &v->s;
-    AVFrame *pict = data;
-    uint8_t *buf2 = NULL;
-    const uint8_t *buf_start = buf;
-
-    /* no supplementary picture */
-    if (buf_size == 0) {
-        /* special case for last picture */
-        if (s->low_delay==0 && s->next_picture_ptr) {
-            *pict= *(AVFrame*)s->next_picture_ptr;
-            s->next_picture_ptr= NULL;
-
-            *data_size = sizeof(AVFrame);
-        }
-
-        return 0;
-    }
-
-    /* We need to set current_picture_ptr before reading the header,
-     * otherwise we cannot store anything in there. */
-    if(s->current_picture_ptr==NULL || s->current_picture_ptr->data[0]){
-        int i= ff_find_unused_picture(s, 0);
-        s->current_picture_ptr= &s->picture[i];
-    }
-
-    if (s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){
-        if (v->profile < PROFILE_ADVANCED)
-            avctx->pix_fmt = PIX_FMT_VDPAU_WMV3;
-        else
-            avctx->pix_fmt = PIX_FMT_VDPAU_VC1;
-    }
-
-    //for advanced profile we may need to parse and unescape data
-    if (avctx->codec_id == CODEC_ID_VC1) {
-        int buf_size2 = 0;
-        buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-
-        if(IS_MARKER(AV_RB32(buf))){ /* frame starts with marker and needs to be parsed */
-            const uint8_t *start, *end, *next;
-            int size;
-
-            next = buf;
-            for(start = buf, end = buf + buf_size; next < end; start = next){
-                next = find_next_marker(start + 4, end);
-                size = next - start - 4;
-                if(size <= 0) continue;
-                switch(AV_RB32(start)){
-                case VC1_CODE_FRAME:
-                    if (avctx->hwaccel ||
-                        s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-                        buf_start = start;
-                    buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
-                    break;
-                case VC1_CODE_ENTRYPOINT: /* it should be before frame data */
-                    buf_size2 = vc1_unescape_buffer(start + 4, size, buf2);
-                    init_get_bits(&s->gb, buf2, buf_size2*8);
-                    vc1_decode_entry_point(avctx, v, &s->gb);
-                    break;
-                case VC1_CODE_SLICE:
-                    av_log(avctx, AV_LOG_ERROR, "Sliced decoding is not implemented (yet)\n");
-                    av_free(buf2);
-                    return -1;
-                }
-            }
-        }else if(v->interlace && ((buf[0] & 0xC0) == 0xC0)){ /* WVC1 interlaced stores both fields divided by marker */
-            const uint8_t *divider;
-
-            divider = find_next_marker(buf, buf + buf_size);
-            if((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD){
-                av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n");
-                av_free(buf2);
-                return -1;
-            }
-
-            buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2);
-            // TODO
-            if(!v->warn_interlaced++)
-                av_log(v->s.avctx, AV_LOG_ERROR, "Interlaced WVC1 support is not implemented\n");
-            av_free(buf2);return -1;
-        }else{
-            buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2);
-        }
-        init_get_bits(&s->gb, buf2, buf_size2*8);
-    } else
-        init_get_bits(&s->gb, buf, buf_size*8);
-    // do parse frame header
-    if(v->profile < PROFILE_ADVANCED) {
-        if(vc1_parse_frame_header(v, &s->gb) == -1) {
-            av_free(buf2);
-            return -1;
-        }
-    } else {
-        if(vc1_parse_frame_header_adv(v, &s->gb) == -1) {
-            av_free(buf2);
-            return -1;
-        }
-    }
-
-    if(s->pict_type != FF_I_TYPE && !v->res_rtm_flag){
-        av_free(buf2);
-        return -1;
-    }
-
-    // for hurry_up==5
-    s->current_picture.pict_type= s->pict_type;
-    s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
-
-    /* skip B-frames if we don't have reference frames */
-    if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){
-        av_free(buf2);
-        return -1;//buf_size;
-    }
-    /* skip b frames if we are in a hurry */
-    if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
-    if(   (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
-       || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
-       ||  avctx->skip_frame >= AVDISCARD_ALL) {
-        av_free(buf2);
-        return buf_size;
-    }
-    /* skip everything if we are in a hurry>=5 */
-    if(avctx->hurry_up>=5) {
-        av_free(buf2);
-        return -1;//buf_size;
-    }
-
-    if(s->next_p_frame_damaged){
-        if(s->pict_type==FF_B_TYPE)
-            return buf_size;
-        else
-            s->next_p_frame_damaged=0;
-    }
-
-    if(MPV_frame_start(s, avctx) < 0) {
-        av_free(buf2);
-        return -1;
-    }
-
-    s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
-    s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
-
-    if ((CONFIG_VC1_VDPAU_DECODER)
-        &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
-        ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);
-    else if (avctx->hwaccel) {
-        if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
-            return -1;
-        if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
-            return -1;
-        if (avctx->hwaccel->end_frame(avctx) < 0)
-            return -1;
-    } else {
-        ff_er_frame_start(s);
-
-        v->bits = buf_size * 8;
-        vc1_decode_blocks(v);
-//av_log(s->avctx, AV_LOG_INFO, "Consumed %i/%i bits\n", get_bits_count(&s->gb), buf_size*8);
-//  if(get_bits_count(&s->gb) > buf_size * 8)
-//      return -1;
-        ff_er_frame_end(s);
-    }
-
-    MPV_frame_end(s);
-
-assert(s->current_picture.pict_type == s->current_picture_ptr->pict_type);
-assert(s->current_picture.pict_type == s->pict_type);
-    if (s->pict_type == FF_B_TYPE || s->low_delay) {
-        *pict= *(AVFrame*)s->current_picture_ptr;
-    } else if (s->last_picture_ptr != NULL) {
-        *pict= *(AVFrame*)s->last_picture_ptr;
-    }
-
-    if(s->last_picture_ptr || s->low_delay){
-        *data_size = sizeof(AVFrame);
-        ff_print_debug_info(s, pict);
-    }
-
-    av_free(buf2);
-    return buf_size;
-}
-
-
-/** Close a VC1/WMV3 decoder
- * @warning Initial try at using MpegEncContext stuff
- */
-static av_cold int vc1_decode_end(AVCodecContext *avctx)
-{
-    VC1Context *v = avctx->priv_data;
-
-    av_freep(&v->hrd_rate);
-    av_freep(&v->hrd_buffer);
-    MPV_common_end(&v->s);
-    av_freep(&v->mv_type_mb_plane);
-    av_freep(&v->direct_mb_plane);
-    av_freep(&v->acpred_plane);
-    av_freep(&v->over_flags_plane);
-    av_freep(&v->mb_type_base);
-    av_freep(&v->cbp_base);
-    ff_intrax8_common_end(&v->x8);
-    return 0;
-}
-
-
-AVCodec vc1_decoder = {
-    "vc1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VC1,
-    sizeof(VC1Context),
-    vc1_decode_init,
-    NULL,
-    vc1_decode_end,
-    vc1_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
-    .pix_fmts = ff_hwaccel_pixfmt_list_420
-};
-
-#if CONFIG_WMV3_DECODER
-AVCodec wmv3_decoder = {
-    "wmv3",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WMV3,
-    sizeof(VC1Context),
-    vc1_decode_init,
-    NULL,
-    vc1_decode_end,
-    vc1_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
-    .pix_fmts = ff_hwaccel_pixfmt_list_420
-};
-#endif
-
-#if CONFIG_WMV3_VDPAU_DECODER
-AVCodec wmv3_vdpau_decoder = {
-    "wmv3_vdpau",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WMV3,
-    sizeof(VC1Context),
-    vc1_decode_init,
-    NULL,
-    vc1_decode_end,
-    vc1_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 VDPAU"),
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_WMV3, PIX_FMT_NONE}
-};
-#endif
-
-#if CONFIG_VC1_VDPAU_DECODER
-AVCodec vc1_vdpau_decoder = {
-    "vc1_vdpau",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VC1,
-    sizeof(VC1Context),
-    vc1_decode_init,
-    NULL,
-    vc1_decode_end,
-    vc1_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DELAY | CODEC_CAP_HWACCEL_VDPAU,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1 VDPAU"),
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_VDPAU_VC1, PIX_FMT_NONE}
-};
-#endif
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
deleted file mode 100644
index 47b69c8..0000000
--- a/libavcodec/vc1dsp.c
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- * VC-1 and WMV3 decoder - DSP functions
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
- * VC-1 and WMV3 decoder
- *
- */
-
-#include "dsputil.h"
-
-
-/** Apply overlap transform to horizontal edge
-*/
-static void vc1_v_overlap_c(uint8_t* src, int stride)
-{
-    int i;
-    int a, b, c, d;
-    int d1, d2;
-    int rnd = 1;
-    for(i = 0; i < 8; i++) {
-        a = src[-2*stride];
-        b = src[-stride];
-        c = src[0];
-        d = src[stride];
-        d1 = (a - d + 3 + rnd) >> 3;
-        d2 = (a - d + b - c + 4 - rnd) >> 3;
-
-        src[-2*stride] = a - d1;
-        src[-stride] = av_clip_uint8(b - d2);
-        src[0] = av_clip_uint8(c + d2);
-        src[stride] = d + d1;
-        src++;
-        rnd = !rnd;
-    }
-}
-
-/** Apply overlap transform to vertical edge
-*/
-static void vc1_h_overlap_c(uint8_t* src, int stride)
-{
-    int i;
-    int a, b, c, d;
-    int d1, d2;
-    int rnd = 1;
-    for(i = 0; i < 8; i++) {
-        a = src[-2];
-        b = src[-1];
-        c = src[0];
-        d = src[1];
-        d1 = (a - d + 3 + rnd) >> 3;
-        d2 = (a - d + b - c + 4 - rnd) >> 3;
-
-        src[-2] = a - d1;
-        src[-1] = av_clip_uint8(b - d2);
-        src[0] = av_clip_uint8(c + d2);
-        src[1] = d + d1;
-        src += stride;
-        rnd = !rnd;
-    }
-}
-
-/**
- * VC-1 in-loop deblocking filter for one line
- * @param src source block type
- * @param stride block stride
- * @param pq block quantizer
- * @return whether other 3 pairs should be filtered or not
- * @see 8.6
- */
-static av_always_inline int vc1_filter_line(uint8_t* src, int stride, int pq){
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    int a0 = (2*(src[-2*stride] - src[ 1*stride]) - 5*(src[-1*stride] - src[ 0*stride]) + 4) >> 3;
-    int a0_sign = a0 >> 31;        /* Store sign */
-    a0 = (a0 ^ a0_sign) - a0_sign; /* a0 = FFABS(a0); */
-    if(a0 < pq){
-        int a1 = FFABS((2*(src[-4*stride] - src[-1*stride]) - 5*(src[-3*stride] - src[-2*stride]) + 4) >> 3);
-        int a2 = FFABS((2*(src[ 0*stride] - src[ 3*stride]) - 5*(src[ 1*stride] - src[ 2*stride]) + 4) >> 3);
-        if(a1 < a0 || a2 < a0){
-            int clip = src[-1*stride] - src[ 0*stride];
-            int clip_sign = clip >> 31;
-            clip = ((clip ^ clip_sign) - clip_sign)>>1;
-            if(clip){
-                int a3 = FFMIN(a1, a2);
-                int d = 5 * (a3 - a0);
-                int d_sign = (d >> 31);
-                d = ((d ^ d_sign) - d_sign) >> 3;
-                d_sign ^= a0_sign;
-
-                if( d_sign ^ clip_sign )
-                    d = 0;
-                else{
-                    d = FFMIN(d, clip);
-                    d = (d ^ d_sign) - d_sign;          /* Restore sign */
-                    src[-1*stride] = cm[src[-1*stride] - d];
-                    src[ 0*stride] = cm[src[ 0*stride] + d];
-                }
-                return 1;
-            }
-        }
-    }
-    return 0;
-}
-
-/**
- * VC-1 in-loop deblocking filter
- * @param src source block type
- * @param step distance between horizontally adjacent elements
- * @param stride distance between vertically adjacent elements
- * @param len edge length to filter (4 or 8 pixels)
- * @param pq block quantizer
- * @see 8.6
- */
-static inline void vc1_loop_filter(uint8_t* src, int step, int stride, int len, int pq)
-{
-    int i;
-    int filt3;
-
-    for(i = 0; i < len; i += 4){
-        filt3 = vc1_filter_line(src + 2*step, stride, pq);
-        if(filt3){
-            vc1_filter_line(src + 0*step, stride, pq);
-            vc1_filter_line(src + 1*step, stride, pq);
-            vc1_filter_line(src + 3*step, stride, pq);
-        }
-        src += step * 4;
-    }
-}
-
-static void vc1_v_loop_filter4_c(uint8_t *src, int stride, int pq)
-{
-    vc1_loop_filter(src, 1, stride, 4, pq);
-}
-
-static void vc1_h_loop_filter4_c(uint8_t *src, int stride, int pq)
-{
-    vc1_loop_filter(src, stride, 1, 4, pq);
-}
-
-static void vc1_v_loop_filter8_c(uint8_t *src, int stride, int pq)
-{
-    vc1_loop_filter(src, 1, stride, 8, pq);
-}
-
-static void vc1_h_loop_filter8_c(uint8_t *src, int stride, int pq)
-{
-    vc1_loop_filter(src, stride, 1, 8, pq);
-}
-
-static void vc1_v_loop_filter16_c(uint8_t *src, int stride, int pq)
-{
-    vc1_loop_filter(src, 1, stride, 16, pq);
-}
-
-static void vc1_h_loop_filter16_c(uint8_t *src, int stride, int pq)
-{
-    vc1_loop_filter(src, stride, 1, 16, pq);
-}
-
-/** Do inverse transform on 8x8 block
-*/
-static void vc1_inv_trans_8x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    int dc = block[0];
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    dc = (3 * dc +  1) >> 1;
-    dc = (3 * dc + 16) >> 5;
-    for(i = 0; i < 8; i++){
-        dest[0] = cm[dest[0]+dc];
-        dest[1] = cm[dest[1]+dc];
-        dest[2] = cm[dest[2]+dc];
-        dest[3] = cm[dest[3]+dc];
-        dest[4] = cm[dest[4]+dc];
-        dest[5] = cm[dest[5]+dc];
-        dest[6] = cm[dest[6]+dc];
-        dest[7] = cm[dest[7]+dc];
-        dest += linesize;
-    }
-}
-
-static void vc1_inv_trans_8x8_c(DCTELEM block[64])
-{
-    int i;
-    register int t1,t2,t3,t4,t5,t6,t7,t8;
-    DCTELEM *src, *dst;
-
-    src = block;
-    dst = block;
-    for(i = 0; i < 8; i++){
-        t1 = 12 * (src[0] + src[4]) + 4;
-        t2 = 12 * (src[0] - src[4]) + 4;
-        t3 = 16 * src[2] +  6 * src[6];
-        t4 =  6 * src[2] - 16 * src[6];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[1] + 15 * src[3] +  9 * src[5] +  4 * src[7];
-        t2 = 15 * src[1] -  4 * src[3] - 16 * src[5] -  9 * src[7];
-        t3 =  9 * src[1] - 16 * src[3] +  4 * src[5] + 15 * src[7];
-        t4 =  4 * src[1] -  9 * src[3] + 15 * src[5] - 16 * src[7];
-
-        dst[0] = (t5 + t1) >> 3;
-        dst[1] = (t6 + t2) >> 3;
-        dst[2] = (t7 + t3) >> 3;
-        dst[3] = (t8 + t4) >> 3;
-        dst[4] = (t8 - t4) >> 3;
-        dst[5] = (t7 - t3) >> 3;
-        dst[6] = (t6 - t2) >> 3;
-        dst[7] = (t5 - t1) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block;
-    dst = block;
-    for(i = 0; i < 8; i++){
-        t1 = 12 * (src[ 0] + src[32]) + 64;
-        t2 = 12 * (src[ 0] - src[32]) + 64;
-        t3 = 16 * src[16] +  6 * src[48];
-        t4 =  6 * src[16] - 16 * src[48];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[ 8] + 15 * src[24] +  9 * src[40] +  4 * src[56];
-        t2 = 15 * src[ 8] -  4 * src[24] - 16 * src[40] -  9 * src[56];
-        t3 =  9 * src[ 8] - 16 * src[24] +  4 * src[40] + 15 * src[56];
-        t4 =  4 * src[ 8] -  9 * src[24] + 15 * src[40] - 16 * src[56];
-
-        dst[ 0] = (t5 + t1) >> 7;
-        dst[ 8] = (t6 + t2) >> 7;
-        dst[16] = (t7 + t3) >> 7;
-        dst[24] = (t8 + t4) >> 7;
-        dst[32] = (t8 - t4 + 1) >> 7;
-        dst[40] = (t7 - t3 + 1) >> 7;
-        dst[48] = (t6 - t2 + 1) >> 7;
-        dst[56] = (t5 - t1 + 1) >> 7;
-
-        src++;
-        dst++;
-    }
-}
-
-/** Do inverse transform on 8x4 part of block
-*/
-static void vc1_inv_trans_8x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    int dc = block[0];
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    dc = ( 3 * dc +  1) >> 1;
-    dc = (17 * dc + 64) >> 7;
-    for(i = 0; i < 4; i++){
-        dest[0] = cm[dest[0]+dc];
-        dest[1] = cm[dest[1]+dc];
-        dest[2] = cm[dest[2]+dc];
-        dest[3] = cm[dest[3]+dc];
-        dest[4] = cm[dest[4]+dc];
-        dest[5] = cm[dest[5]+dc];
-        dest[6] = cm[dest[6]+dc];
-        dest[7] = cm[dest[7]+dc];
-        dest += linesize;
-    }
-}
-
-static void vc1_inv_trans_8x4_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    register int t1,t2,t3,t4,t5,t6,t7,t8;
-    DCTELEM *src, *dst;
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    src = block;
-    dst = block;
-    for(i = 0; i < 4; i++){
-        t1 = 12 * (src[0] + src[4]) + 4;
-        t2 = 12 * (src[0] - src[4]) + 4;
-        t3 = 16 * src[2] +  6 * src[6];
-        t4 =  6 * src[2] - 16 * src[6];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[1] + 15 * src[3] +  9 * src[5] +  4 * src[7];
-        t2 = 15 * src[1] -  4 * src[3] - 16 * src[5] -  9 * src[7];
-        t3 =  9 * src[1] - 16 * src[3] +  4 * src[5] + 15 * src[7];
-        t4 =  4 * src[1] -  9 * src[3] + 15 * src[5] - 16 * src[7];
-
-        dst[0] = (t5 + t1) >> 3;
-        dst[1] = (t6 + t2) >> 3;
-        dst[2] = (t7 + t3) >> 3;
-        dst[3] = (t8 + t4) >> 3;
-        dst[4] = (t8 - t4) >> 3;
-        dst[5] = (t7 - t3) >> 3;
-        dst[6] = (t6 - t2) >> 3;
-        dst[7] = (t5 - t1) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block;
-    for(i = 0; i < 8; i++){
-        t1 = 17 * (src[ 0] + src[16]) + 64;
-        t2 = 17 * (src[ 0] - src[16]) + 64;
-        t3 = 22 * src[ 8] + 10 * src[24];
-        t4 = 22 * src[24] - 10 * src[ 8];
-
-        dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3) >> 7)];
-        dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4) >> 7)];
-        dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4) >> 7)];
-        dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3) >> 7)];
-
-        src ++;
-        dest++;
-    }
-}
-
-/** Do inverse transform on 4x8 parts of block
-*/
-static void vc1_inv_trans_4x8_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    int dc = block[0];
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    dc = (17 * dc +  4) >> 3;
-    dc = (12 * dc + 64) >> 7;
-    for(i = 0; i < 8; i++){
-        dest[0] = cm[dest[0]+dc];
-        dest[1] = cm[dest[1]+dc];
-        dest[2] = cm[dest[2]+dc];
-        dest[3] = cm[dest[3]+dc];
-        dest += linesize;
-    }
-}
-
-static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    register int t1,t2,t3,t4,t5,t6,t7,t8;
-    DCTELEM *src, *dst;
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    src = block;
-    dst = block;
-    for(i = 0; i < 8; i++){
-        t1 = 17 * (src[0] + src[2]) + 4;
-        t2 = 17 * (src[0] - src[2]) + 4;
-        t3 = 22 * src[1] + 10 * src[3];
-        t4 = 22 * src[3] - 10 * src[1];
-
-        dst[0] = (t1 + t3) >> 3;
-        dst[1] = (t2 - t4) >> 3;
-        dst[2] = (t2 + t4) >> 3;
-        dst[3] = (t1 - t3) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block;
-    for(i = 0; i < 4; i++){
-        t1 = 12 * (src[ 0] + src[32]) + 64;
-        t2 = 12 * (src[ 0] - src[32]) + 64;
-        t3 = 16 * src[16] +  6 * src[48];
-        t4 =  6 * src[16] - 16 * src[48];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[ 8] + 15 * src[24] +  9 * src[40] +  4 * src[56];
-        t2 = 15 * src[ 8] -  4 * src[24] - 16 * src[40] -  9 * src[56];
-        t3 =  9 * src[ 8] - 16 * src[24] +  4 * src[40] + 15 * src[56];
-        t4 =  4 * src[ 8] -  9 * src[24] + 15 * src[40] - 16 * src[56];
-
-        dest[0*linesize] = cm[dest[0*linesize] + ((t5 + t1) >> 7)];
-        dest[1*linesize] = cm[dest[1*linesize] + ((t6 + t2) >> 7)];
-        dest[2*linesize] = cm[dest[2*linesize] + ((t7 + t3) >> 7)];
-        dest[3*linesize] = cm[dest[3*linesize] + ((t8 + t4) >> 7)];
-        dest[4*linesize] = cm[dest[4*linesize] + ((t8 - t4 + 1) >> 7)];
-        dest[5*linesize] = cm[dest[5*linesize] + ((t7 - t3 + 1) >> 7)];
-        dest[6*linesize] = cm[dest[6*linesize] + ((t6 - t2 + 1) >> 7)];
-        dest[7*linesize] = cm[dest[7*linesize] + ((t5 - t1 + 1) >> 7)];
-
-        src ++;
-        dest++;
-    }
-}
-
-/** Do inverse transform on 4x4 part of block
-*/
-static void vc1_inv_trans_4x4_dc_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    int dc = block[0];
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    dc = (17 * dc +  4) >> 3;
-    dc = (17 * dc + 64) >> 7;
-    for(i = 0; i < 4; i++){
-        dest[0] = cm[dest[0]+dc];
-        dest[1] = cm[dest[1]+dc];
-        dest[2] = cm[dest[2]+dc];
-        dest[3] = cm[dest[3]+dc];
-        dest += linesize;
-    }
-}
-
-static void vc1_inv_trans_4x4_c(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int i;
-    register int t1,t2,t3,t4;
-    DCTELEM *src, *dst;
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    src = block;
-    dst = block;
-    for(i = 0; i < 4; i++){
-        t1 = 17 * (src[0] + src[2]) + 4;
-        t2 = 17 * (src[0] - src[2]) + 4;
-        t3 = 22 * src[1] + 10 * src[3];
-        t4 = 22 * src[3] - 10 * src[1];
-
-        dst[0] = (t1 + t3) >> 3;
-        dst[1] = (t2 - t4) >> 3;
-        dst[2] = (t2 + t4) >> 3;
-        dst[3] = (t1 - t3) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block;
-    for(i = 0; i < 4; i++){
-        t1 = 17 * (src[ 0] + src[16]) + 64;
-        t2 = 17 * (src[ 0] - src[16]) + 64;
-        t3 = 22 * src[ 8] + 10 * src[24];
-        t4 = 22 * src[24] - 10 * src[ 8];
-
-        dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3) >> 7)];
-        dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4) >> 7)];
-        dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4) >> 7)];
-        dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3) >> 7)];
-
-        src ++;
-        dest++;
-    }
-}
-
-/* motion compensation functions */
-/** Filter in case of 2 filters */
-#define VC1_MSPEL_FILTER_16B(DIR, TYPE)                                 \
-static av_always_inline int vc1_mspel_ ## DIR ## _filter_16bits(const TYPE *src, int stride, int mode) \
-{                                                                       \
-    switch(mode){                                                       \
-    case 0: /* no shift - should not occur */                           \
-        return 0;                                                       \
-    case 1: /* 1/4 shift */                                             \
-        return -4*src[-stride] + 53*src[0] + 18*src[stride] - 3*src[stride*2]; \
-    case 2: /* 1/2 shift */                                             \
-        return -src[-stride] + 9*src[0] + 9*src[stride] - src[stride*2]; \
-    case 3: /* 3/4 shift */                                             \
-        return -3*src[-stride] + 18*src[0] + 53*src[stride] - 4*src[stride*2]; \
-    }                                                                   \
-    return 0; /* should not occur */                                    \
-}
-
-VC1_MSPEL_FILTER_16B(ver, uint8_t);
-VC1_MSPEL_FILTER_16B(hor, int16_t);
-
-
-/** Filter used to interpolate fractional pel values
- */
-static av_always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int mode, int r)
-{
-    switch(mode){
-    case 0: //no shift
-        return src[0];
-    case 1: // 1/4 shift
-        return (-4*src[-stride] + 53*src[0] + 18*src[stride] - 3*src[stride*2] + 32 - r) >> 6;
-    case 2: // 1/2 shift
-        return (-src[-stride] + 9*src[0] + 9*src[stride] - src[stride*2] + 8 - r) >> 4;
-    case 3: // 3/4 shift
-        return (-3*src[-stride] + 18*src[0] + 53*src[stride] - 4*src[stride*2] + 32 - r) >> 6;
-    }
-    return 0; //should not occur
-}
-
-/** Function used to do motion compensation with bicubic interpolation
- */
-#define VC1_MSPEL_MC(OP, OPNAME)\
-static void OPNAME ## vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int hmode, int vmode, int rnd)\
-{\
-    int     i, j;\
-\
-    if (vmode) { /* Horizontal filter to apply */\
-        int r;\
-\
-        if (hmode) { /* Vertical filter to apply, output to tmp */\
-            static const int shift_value[] = { 0, 5, 1, 5 };\
-            int              shift = (shift_value[hmode]+shift_value[vmode])>>1;\
-            int16_t          tmp[11*8], *tptr = tmp;\
-\
-            r = (1<<(shift-1)) + rnd-1;\
-\
-            src -= 1;\
-            for(j = 0; j < 8; j++) {\
-                for(i = 0; i < 11; i++)\
-                    tptr[i] = (vc1_mspel_ver_filter_16bits(src + i, stride, vmode)+r)>>shift;\
-                src += stride;\
-                tptr += 11;\
-            }\
-\
-            r = 64-rnd;\
-            tptr = tmp+1;\
-            for(j = 0; j < 8; j++) {\
-                for(i = 0; i < 8; i++)\
-                    OP(dst[i], (vc1_mspel_hor_filter_16bits(tptr + i, 1, hmode)+r)>>7);\
-                dst += stride;\
-                tptr += 11;\
-            }\
-\
-            return;\
-        }\
-        else { /* No horizontal filter, output 8 lines to dst */\
-            r = 1-rnd;\
-\
-            for(j = 0; j < 8; j++) {\
-                for(i = 0; i < 8; i++)\
-                    OP(dst[i], vc1_mspel_filter(src + i, stride, vmode, r));\
-                src += stride;\
-                dst += stride;\
-            }\
-            return;\
-        }\
-    }\
-\
-    /* Horizontal mode with no vertical mode */\
-    for(j = 0; j < 8; j++) {\
-        for(i = 0; i < 8; i++)\
-            OP(dst[i], vc1_mspel_filter(src + i, 1, hmode, rnd));\
-        dst += stride;\
-        src += stride;\
-    }\
-}
-
-#define op_put(a, b) a = av_clip_uint8(b)
-#define op_avg(a, b) a = (a + av_clip_uint8(b) + 1) >> 1
-
-VC1_MSPEL_MC(op_put, put_)
-VC1_MSPEL_MC(op_avg, avg_)
-
-/* pixel functions - really are entry points to vc1_mspel_mc */
-
-#define PUT_VC1_MSPEL(a, b)\
-static void put_vc1_mspel_mc ## a ## b ##_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
-     put_vc1_mspel_mc(dst, src, stride, a, b, rnd);                         \
-}\
-static void avg_vc1_mspel_mc ## a ## b ##_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
-     avg_vc1_mspel_mc(dst, src, stride, a, b, rnd);                         \
-}
-
-PUT_VC1_MSPEL(1, 0)
-PUT_VC1_MSPEL(2, 0)
-PUT_VC1_MSPEL(3, 0)
-
-PUT_VC1_MSPEL(0, 1)
-PUT_VC1_MSPEL(1, 1)
-PUT_VC1_MSPEL(2, 1)
-PUT_VC1_MSPEL(3, 1)
-
-PUT_VC1_MSPEL(0, 2)
-PUT_VC1_MSPEL(1, 2)
-PUT_VC1_MSPEL(2, 2)
-PUT_VC1_MSPEL(3, 2)
-
-PUT_VC1_MSPEL(0, 3)
-PUT_VC1_MSPEL(1, 3)
-PUT_VC1_MSPEL(2, 3)
-PUT_VC1_MSPEL(3, 3)
-
-av_cold void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
-    dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
-    dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
-    dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
-    dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c;
-    dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_c;
-    dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_c;
-    dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_c;
-    dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_c;
-    dsp->vc1_h_overlap = vc1_h_overlap_c;
-    dsp->vc1_v_overlap = vc1_v_overlap_c;
-    dsp->vc1_v_loop_filter4 = vc1_v_loop_filter4_c;
-    dsp->vc1_h_loop_filter4 = vc1_h_loop_filter4_c;
-    dsp->vc1_v_loop_filter8 = vc1_v_loop_filter8_c;
-    dsp->vc1_h_loop_filter8 = vc1_h_loop_filter8_c;
-    dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_c;
-    dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_c;
-
-    dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_c;
-    dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_c;
-    dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_c;
-    dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_c;
-    dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_c;
-    dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_c;
-    dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_c;
-    dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_c;
-    dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_c;
-    dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_c;
-    dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_c;
-    dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_c;
-    dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_c;
-    dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_c;
-    dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_c;
-    dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_c;
-
-    dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_c;
-    dsp->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_c;
-    dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_c;
-    dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_c;
-    dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_c;
-    dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_c;
-    dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_c;
-    dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_c;
-}
diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c
deleted file mode 100644
index 31da94f..0000000
--- a/libavcodec/vcr1.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * ATI VCR1 codec
- * Copyright (c) 2003 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * ati vcr1 codec.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-/* Disable the encoder. */
-#undef CONFIG_VCR1_ENCODER
-#define CONFIG_VCR1_ENCODER 0
-
-typedef struct VCR1Context{
-    AVCodecContext *avctx;
-    AVFrame picture;
-    int delta[16];
-    int offset[4];
-} VCR1Context;
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VCR1Context * const a = avctx->priv_data;
-    AVFrame *picture = data;
-    AVFrame * const p= (AVFrame*)&a->picture;
-    const uint8_t *bytestream= buf;
-    int i, x, y;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    for(i=0; i<16; i++){
-        a->delta[i]= *(bytestream++);
-        bytestream++;
-    }
-
-    for(y=0; y<avctx->height; y++){
-        int offset;
-        uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
-
-        if((y&3) == 0){
-            uint8_t *cb= &a->picture.data[1][ (y>>2)*a->picture.linesize[1] ];
-            uint8_t *cr= &a->picture.data[2][ (y>>2)*a->picture.linesize[2] ];
-
-            for(i=0; i<4; i++)
-                a->offset[i]= *(bytestream++);
-
-            offset= a->offset[0] - a->delta[ bytestream[2]&0xF ];
-            for(x=0; x<avctx->width; x+=4){
-                luma[0]=( offset += a->delta[ bytestream[2]&0xF ]);
-                luma[1]=( offset += a->delta[ bytestream[2]>>4  ]);
-                luma[2]=( offset += a->delta[ bytestream[0]&0xF ]);
-                luma[3]=( offset += a->delta[ bytestream[0]>>4  ]);
-                luma += 4;
-
-                *(cb++) = bytestream[3];
-                *(cr++) = bytestream[1];
-
-                bytestream+= 4;
-            }
-        }else{
-            offset= a->offset[y&3] - a->delta[ bytestream[2]&0xF ];
-
-            for(x=0; x<avctx->width; x+=8){
-                luma[0]=( offset += a->delta[ bytestream[2]&0xF ]);
-                luma[1]=( offset += a->delta[ bytestream[2]>>4  ]);
-                luma[2]=( offset += a->delta[ bytestream[3]&0xF ]);
-                luma[3]=( offset += a->delta[ bytestream[3]>>4  ]);
-                luma[4]=( offset += a->delta[ bytestream[0]&0xF ]);
-                luma[5]=( offset += a->delta[ bytestream[0]>>4  ]);
-                luma[6]=( offset += a->delta[ bytestream[1]&0xF ]);
-                luma[7]=( offset += a->delta[ bytestream[1]>>4  ]);
-                luma += 8;
-                bytestream+= 4;
-            }
-        }
-    }
-
-    *picture= *(AVFrame*)&a->picture;
-    *data_size = sizeof(AVPicture);
-
-    emms_c();
-
-    return buf_size;
-}
-
-#if CONFIG_VCR1_ENCODER
-static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){
-    VCR1Context * const a = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= (AVFrame*)&a->picture;
-    int size;
-
-    *p = *pict;
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    emms_c();
-
-    align_put_bits(&a->pb);
-    while(get_bit_count(&a->pb)&31)
-        put_bits(&a->pb, 8, 0);
-
-    size= get_bit_count(&a->pb)/32;
-
-    return size*4;
-}
-#endif
-
-static av_cold void common_init(AVCodecContext *avctx){
-    VCR1Context * const a = avctx->priv_data;
-
-    avctx->coded_frame= (AVFrame*)&a->picture;
-    a->avctx= avctx;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-
-    common_init(avctx);
-
-    avctx->pix_fmt= PIX_FMT_YUV410P;
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    VCR1Context *s = avctx->priv_data;
-
-    if (s->picture.data[0])
-        avctx->release_buffer(avctx, &s->picture);
-
-    return 0;
-}
-
-#if CONFIG_VCR1_ENCODER
-static av_cold int encode_init(AVCodecContext *avctx){
-
-    common_init(avctx);
-
-    return 0;
-}
-#endif
-
-AVCodec vcr1_decoder = {
-    "vcr1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VCR1,
-    sizeof(VCR1Context),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
-};
-
-#if CONFIG_VCR1_ENCODER
-AVCodec vcr1_encoder = {
-    "vcr1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VCR1,
-    sizeof(VCR1Context),
-    encode_init,
-    encode_frame,
-    //encode_end,
-    .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"),
-};
-#endif
diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c
deleted file mode 100644
index bd721e8..0000000
--- a/libavcodec/vdpau.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * Video Decode and Presentation API for UNIX (VDPAU) is used for
- * HW decode acceleration for MPEG-1/2, MPEG-4 ASP, H.264 and VC-1.
- *
- * Copyright (c) 2008 NVIDIA
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <limits.h>
-#include "avcodec.h"
-#include "h264.h"
-#include "vc1.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#include "vdpau.h"
-#include "vdpau_internal.h"
-
-/**
- * \addtogroup VDPAU_Decoding
- *
- * @{
- */
-
-void ff_vdpau_h264_set_reference_frames(MpegEncContext *s)
-{
-    H264Context *h = s->avctx->priv_data;
-    struct vdpau_render_state *render, *render_ref;
-    VdpReferenceFrameH264 *rf, *rf2;
-    Picture *pic;
-    int i, list, pic_frame_idx;
-
-    render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
-    assert(render);
-
-    rf = &render->info.h264.referenceFrames[0];
-#define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames)
-
-    for (list = 0; list < 2; ++list) {
-        Picture **lp = list ? h->long_ref : h->short_ref;
-        int ls = list ? 16 : h->short_ref_count;
-
-        for (i = 0; i < ls; ++i) {
-            pic = lp[i];
-            if (!pic || !pic->reference)
-                continue;
-            pic_frame_idx = pic->long_ref ? pic->pic_id : pic->frame_num;
-
-            render_ref = (struct vdpau_render_state *)pic->data[0];
-            assert(render_ref);
-
-            rf2 = &render->info.h264.referenceFrames[0];
-            while (rf2 != rf) {
-                if (
-                    (rf2->surface == render_ref->surface)
-                    && (rf2->is_long_term == pic->long_ref)
-                    && (rf2->frame_idx == pic_frame_idx)
-                )
-                    break;
-                ++rf2;
-            }
-            if (rf2 != rf) {
-                rf2->top_is_reference    |= (pic->reference & PICT_TOP_FIELD)    ? VDP_TRUE : VDP_FALSE;
-                rf2->bottom_is_reference |= (pic->reference & PICT_BOTTOM_FIELD) ? VDP_TRUE : VDP_FALSE;
-                continue;
-            }
-
-            if (rf >= &render->info.h264.referenceFrames[H264_RF_COUNT])
-                continue;
-
-            rf->surface             = render_ref->surface;
-            rf->is_long_term        = pic->long_ref;
-            rf->top_is_reference    = (pic->reference & PICT_TOP_FIELD)    ? VDP_TRUE : VDP_FALSE;
-            rf->bottom_is_reference = (pic->reference & PICT_BOTTOM_FIELD) ? VDP_TRUE : VDP_FALSE;
-            rf->field_order_cnt[0]  = pic->field_poc[0];
-            rf->field_order_cnt[1]  = pic->field_poc[1];
-            rf->frame_idx           = pic_frame_idx;
-
-            ++rf;
-        }
-    }
-
-    for (; rf < &render->info.h264.referenceFrames[H264_RF_COUNT]; ++rf) {
-        rf->surface             = VDP_INVALID_HANDLE;
-        rf->is_long_term        = 0;
-        rf->top_is_reference    = 0;
-        rf->bottom_is_reference = 0;
-        rf->field_order_cnt[0]  = 0;
-        rf->field_order_cnt[1]  = 0;
-        rf->frame_idx           = 0;
-    }
-}
-
-void ff_vdpau_add_data_chunk(MpegEncContext *s,
-                             const uint8_t *buf, int buf_size)
-{
-    struct vdpau_render_state *render;
-
-    render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
-    assert(render);
-
-    render->bitstream_buffers= av_fast_realloc(
-        render->bitstream_buffers,
-        &render->bitstream_buffers_allocated,
-        sizeof(*render->bitstream_buffers)*(render->bitstream_buffers_used + 1)
-    );
-
-    render->bitstream_buffers[render->bitstream_buffers_used].struct_version  = VDP_BITSTREAM_BUFFER_VERSION;
-    render->bitstream_buffers[render->bitstream_buffers_used].bitstream       = buf;
-    render->bitstream_buffers[render->bitstream_buffers_used].bitstream_bytes = buf_size;
-    render->bitstream_buffers_used++;
-}
-
-void ff_vdpau_h264_picture_start(MpegEncContext *s)
-{
-    H264Context *h = s->avctx->priv_data;
-    struct vdpau_render_state *render;
-    int i;
-
-    render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
-    assert(render);
-
-    for (i = 0; i < 2; ++i) {
-        int foc = s->current_picture_ptr->field_poc[i];
-        if (foc == INT_MAX)
-            foc = 0;
-        render->info.h264.field_order_cnt[i] = foc;
-    }
-
-    render->info.h264.frame_num = h->frame_num;
-}
-
-void ff_vdpau_h264_picture_complete(MpegEncContext *s)
-{
-    H264Context *h = s->avctx->priv_data;
-    struct vdpau_render_state *render;
-
-    render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
-    assert(render);
-
-    render->info.h264.slice_count = h->slice_num;
-    if (render->info.h264.slice_count < 1)
-        return;
-
-    render->info.h264.is_reference                           = (s->current_picture_ptr->reference & 3) ? VDP_TRUE : VDP_FALSE;
-    render->info.h264.field_pic_flag                         = s->picture_structure != PICT_FRAME;
-    render->info.h264.bottom_field_flag                      = s->picture_structure == PICT_BOTTOM_FIELD;
-    render->info.h264.num_ref_frames                         = h->sps.ref_frame_count;
-    render->info.h264.mb_adaptive_frame_field_flag           = h->sps.mb_aff && !render->info.h264.field_pic_flag;
-    render->info.h264.constrained_intra_pred_flag            = h->pps.constrained_intra_pred;
-    render->info.h264.weighted_pred_flag                     = h->pps.weighted_pred;
-    render->info.h264.weighted_bipred_idc                    = h->pps.weighted_bipred_idc;
-    render->info.h264.frame_mbs_only_flag                    = h->sps.frame_mbs_only_flag;
-    render->info.h264.transform_8x8_mode_flag                = h->pps.transform_8x8_mode;
-    render->info.h264.chroma_qp_index_offset                 = h->pps.chroma_qp_index_offset[0];
-    render->info.h264.second_chroma_qp_index_offset          = h->pps.chroma_qp_index_offset[1];
-    render->info.h264.pic_init_qp_minus26                    = h->pps.init_qp - 26;
-    render->info.h264.num_ref_idx_l0_active_minus1           = h->pps.ref_count[0] - 1;
-    render->info.h264.num_ref_idx_l1_active_minus1           = h->pps.ref_count[1] - 1;
-    render->info.h264.log2_max_frame_num_minus4              = h->sps.log2_max_frame_num - 4;
-    render->info.h264.pic_order_cnt_type                     = h->sps.poc_type;
-    render->info.h264.log2_max_pic_order_cnt_lsb_minus4      = h->sps.poc_type ? 0 : h->sps.log2_max_poc_lsb - 4;
-    render->info.h264.delta_pic_order_always_zero_flag       = h->sps.delta_pic_order_always_zero_flag;
-    render->info.h264.direct_8x8_inference_flag              = h->sps.direct_8x8_inference_flag;
-    render->info.h264.entropy_coding_mode_flag               = h->pps.cabac;
-    render->info.h264.pic_order_present_flag                 = h->pps.pic_order_present;
-    render->info.h264.deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present;
-    render->info.h264.redundant_pic_cnt_present_flag         = h->pps.redundant_pic_cnt_present;
-    memcpy(render->info.h264.scaling_lists_4x4, h->pps.scaling_matrix4, sizeof(render->info.h264.scaling_lists_4x4));
-    memcpy(render->info.h264.scaling_lists_8x8, h->pps.scaling_matrix8, sizeof(render->info.h264.scaling_lists_8x8));
-
-    ff_draw_horiz_band(s, 0, s->avctx->height);
-    render->bitstream_buffers_used = 0;
-}
-
-void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
-                                    int buf_size, int slice_count)
-{
-    struct vdpau_render_state *render, *last, *next;
-    int i;
-
-    if (!s->current_picture_ptr) return;
-
-    render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
-    assert(render);
-
-    /* fill VdpPictureInfoMPEG1Or2 struct */
-    render->info.mpeg.picture_structure          = s->picture_structure;
-    render->info.mpeg.picture_coding_type        = s->pict_type;
-    render->info.mpeg.intra_dc_precision         = s->intra_dc_precision;
-    render->info.mpeg.frame_pred_frame_dct       = s->frame_pred_frame_dct;
-    render->info.mpeg.concealment_motion_vectors = s->concealment_motion_vectors;
-    render->info.mpeg.intra_vlc_format           = s->intra_vlc_format;
-    render->info.mpeg.alternate_scan             = s->alternate_scan;
-    render->info.mpeg.q_scale_type               = s->q_scale_type;
-    render->info.mpeg.top_field_first            = s->top_field_first;
-    render->info.mpeg.full_pel_forward_vector    = s->full_pel[0]; // MPEG-1 only.  Set 0 for MPEG-2
-    render->info.mpeg.full_pel_backward_vector   = s->full_pel[1]; // MPEG-1 only.  Set 0 for MPEG-2
-    render->info.mpeg.f_code[0][0]               = s->mpeg_f_code[0][0]; // For MPEG-1 fill both horiz. & vert.
-    render->info.mpeg.f_code[0][1]               = s->mpeg_f_code[0][1];
-    render->info.mpeg.f_code[1][0]               = s->mpeg_f_code[1][0];
-    render->info.mpeg.f_code[1][1]               = s->mpeg_f_code[1][1];
-    for (i = 0; i < 64; ++i) {
-        render->info.mpeg.intra_quantizer_matrix[i]     = s->intra_matrix[i];
-        render->info.mpeg.non_intra_quantizer_matrix[i] = s->inter_matrix[i];
-    }
-
-    render->info.mpeg.forward_reference          = VDP_INVALID_HANDLE;
-    render->info.mpeg.backward_reference         = VDP_INVALID_HANDLE;
-
-    switch(s->pict_type){
-    case  FF_B_TYPE:
-        next = (struct vdpau_render_state *)s->next_picture.data[0];
-        assert(next);
-        render->info.mpeg.backward_reference     = next->surface;
-        // no return here, going to set forward prediction
-    case  FF_P_TYPE:
-        last = (struct vdpau_render_state *)s->last_picture.data[0];
-        if (!last) // FIXME: Does this test make sense?
-            last = render; // predict second field from the first
-        render->info.mpeg.forward_reference      = last->surface;
-    }
-
-    ff_vdpau_add_data_chunk(s, buf, buf_size);
-
-    render->info.mpeg.slice_count                = slice_count;
-
-    if (slice_count)
-        ff_draw_horiz_band(s, 0, s->avctx->height);
-    render->bitstream_buffers_used               = 0;
-}
-
-void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
-                                 int buf_size)
-{
-    VC1Context *v = s->avctx->priv_data;
-    struct vdpau_render_state *render, *last, *next;
-
-    render = (struct vdpau_render_state *)s->current_picture.data[0];
-    assert(render);
-
-    /*  fill LvPictureInfoVC1 struct */
-    render->info.vc1.frame_coding_mode  = v->fcm;
-    render->info.vc1.postprocflag       = v->postprocflag;
-    render->info.vc1.pulldown           = v->broadcast;
-    render->info.vc1.interlace          = v->interlace;
-    render->info.vc1.tfcntrflag         = v->tfcntrflag;
-    render->info.vc1.finterpflag        = v->finterpflag;
-    render->info.vc1.psf                = v->psf;
-    render->info.vc1.dquant             = v->dquant;
-    render->info.vc1.panscan_flag       = v->panscanflag;
-    render->info.vc1.refdist_flag       = v->refdist_flag;
-    render->info.vc1.quantizer          = v->quantizer_mode;
-    render->info.vc1.extended_mv        = v->extended_mv;
-    render->info.vc1.extended_dmv       = v->extended_dmv;
-    render->info.vc1.overlap            = v->overlap;
-    render->info.vc1.vstransform        = v->vstransform;
-    render->info.vc1.loopfilter         = v->s.loop_filter;
-    render->info.vc1.fastuvmc           = v->fastuvmc;
-    render->info.vc1.range_mapy_flag    = v->range_mapy_flag;
-    render->info.vc1.range_mapy         = v->range_mapy;
-    render->info.vc1.range_mapuv_flag   = v->range_mapuv_flag;
-    render->info.vc1.range_mapuv        = v->range_mapuv;
-    /* Specific to simple/main profile only */
-    render->info.vc1.multires           = v->multires;
-    render->info.vc1.syncmarker         = v->s.resync_marker;
-    render->info.vc1.rangered           = v->rangered | (v->rangeredfrm << 1);
-    render->info.vc1.maxbframes         = v->s.max_b_frames;
-
-    render->info.vc1.deblockEnable      = v->postprocflag & 1;
-    render->info.vc1.pquant             = v->pq;
-
-    render->info.vc1.forward_reference  = VDP_INVALID_HANDLE;
-    render->info.vc1.backward_reference = VDP_INVALID_HANDLE;
-
-    if (v->bi_type)
-        render->info.vc1.picture_type = 4;
-    else
-        render->info.vc1.picture_type = s->pict_type - 1 + s->pict_type / 3;
-
-    switch(s->pict_type){
-    case  FF_B_TYPE:
-        next = (struct vdpau_render_state *)s->next_picture.data[0];
-        assert(next);
-        render->info.vc1.backward_reference = next->surface;
-        // no break here, going to set forward prediction
-    case  FF_P_TYPE:
-        last = (struct vdpau_render_state *)s->last_picture.data[0];
-        if (!last) // FIXME: Does this test make sense?
-            last = render; // predict second field from the first
-        render->info.vc1.forward_reference = last->surface;
-    }
-
-    ff_vdpau_add_data_chunk(s, buf, buf_size);
-
-    render->info.vc1.slice_count          = 1;
-
-    ff_draw_horiz_band(s, 0, s->avctx->height);
-    render->bitstream_buffers_used        = 0;
-}
-
-void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
-                                   int buf_size)
-{
-    struct vdpau_render_state *render, *last, *next;
-    int i;
-
-    if (!s->current_picture_ptr) return;
-
-    render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
-    assert(render);
-
-    /* fill VdpPictureInfoMPEG4Part2 struct */
-    render->info.mpeg4.trd[0]                            = s->pp_time;
-    render->info.mpeg4.trb[0]                            = s->pb_time;
-    render->info.mpeg4.trd[1]                            = s->pp_field_time >> 1;
-    render->info.mpeg4.trb[1]                            = s->pb_field_time >> 1;
-    render->info.mpeg4.vop_time_increment_resolution     = s->avctx->time_base.den;
-    render->info.mpeg4.vop_coding_type                   = 0;
-    render->info.mpeg4.vop_fcode_forward                 = s->f_code;
-    render->info.mpeg4.vop_fcode_backward                = s->b_code;
-    render->info.mpeg4.resync_marker_disable             = !s->resync_marker;
-    render->info.mpeg4.interlaced                        = !s->progressive_sequence;
-    render->info.mpeg4.quant_type                        = s->mpeg_quant;
-    render->info.mpeg4.quarter_sample                    = s->quarter_sample;
-    render->info.mpeg4.short_video_header                = s->avctx->codec->id == CODEC_ID_H263;
-    render->info.mpeg4.rounding_control                  = s->no_rounding;
-    render->info.mpeg4.alternate_vertical_scan_flag      = s->alternate_scan;
-    render->info.mpeg4.top_field_first                   = s->top_field_first;
-    for (i = 0; i < 64; ++i) {
-        render->info.mpeg4.intra_quantizer_matrix[i]     = s->intra_matrix[i];
-        render->info.mpeg4.non_intra_quantizer_matrix[i] = s->inter_matrix[i];
-    }
-    render->info.mpeg4.forward_reference                 = VDP_INVALID_HANDLE;
-    render->info.mpeg4.backward_reference                = VDP_INVALID_HANDLE;
-
-    switch (s->pict_type) {
-    case FF_B_TYPE:
-        next = (struct vdpau_render_state *)s->next_picture.data[0];
-        assert(next);
-        render->info.mpeg4.backward_reference     = next->surface;
-        render->info.mpeg4.vop_coding_type        = 2;
-        // no break here, going to set forward prediction
-    case FF_P_TYPE:
-        last = (struct vdpau_render_state *)s->last_picture.data[0];
-        assert(last);
-        render->info.mpeg4.forward_reference      = last->surface;
-    }
-
-    ff_vdpau_add_data_chunk(s, buf, buf_size);
-
-    ff_draw_horiz_band(s, 0, s->avctx->height);
-    render->bitstream_buffers_used = 0;
-}
-
-/* @}*/
diff --git a/libavcodec/vdpau.h b/libavcodec/vdpau.h
deleted file mode 100644
index a8fa4d3..0000000
--- a/libavcodec/vdpau.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * The Video Decode and Presentation API for UNIX (VDPAU) is used for
- * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1.
- *
- * Copyright (C) 2008 NVIDIA
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VDPAU_H
-#define AVCODEC_VDPAU_H
-
-/**
- * \defgroup Decoder VDPAU Decoder and Renderer
- *
- * VDPAU hardware acceleration has two modules
- * - VDPAU decoding
- * - VDPAU presentation
- *
- * The VDPAU decoding module parses all headers using FFmpeg
- * parsing mechanisms and uses VDPAU for the actual decoding.
- *
- * As per the current implementation, the actual decoding
- * and rendering (API calls) are done as part of the VDPAU
- * presentation (vo_vdpau.c) module.
- *
- * @{
- * \defgroup  VDPAU_Decoding VDPAU Decoding
- * \ingroup Decoder
- * @{
- */
-
-#include <vdpau/vdpau.h>
-#include <vdpau/vdpau_x11.h>
-
-/** \brief The videoSurface is used for rendering. */
-#define FF_VDPAU_STATE_USED_FOR_RENDER 1
-
-/**
- * \brief The videoSurface is needed for reference/prediction.
- * The codec manipulates this.
- */
-#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2
-
-/**
- * \brief This structure is used as a callback between the FFmpeg
- * decoder (vd_) and presentation (vo_) module.
- * This is used for defining a video frame containing surface,
- * picture parameter, bitstream information etc which are passed
- * between the FFmpeg decoder and its clients.
- */
-struct vdpau_render_state {
-    VdpVideoSurface surface; ///< Used as rendered surface, never changed.
-
-    int state; ///< Holds FF_VDPAU_STATE_* values.
-
-    /** picture parameter information for all supported codecs */
-    union VdpPictureInfo {
-        VdpPictureInfoH264        h264;
-        VdpPictureInfoMPEG1Or2    mpeg;
-        VdpPictureInfoVC1          vc1;
-        VdpPictureInfoMPEG4Part2 mpeg4;
-    } info;
-
-    /** Describe size/location of the compressed video data.
-        Set to 0 when freeing bitstream_buffers. */
-    int bitstream_buffers_allocated;
-    int bitstream_buffers_used;
-    /** The user is responsible for freeing this buffer using av_freep(). */
-    VdpBitstreamBuffer *bitstream_buffers;
-};
-
-/* @}*/
-
-#endif /* AVCODEC_VDPAU_H */
diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h
deleted file mode 100644
index 0a8d0b6..0000000
--- a/libavcodec/vdpau_internal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Video Decode and Presentation API for UNIX (VDPAU) is used for
- * HW decode acceleration for MPEG-1/2, H.264 and VC-1.
- *
- * Copyright (C) 2008 NVIDIA
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VDPAU_INTERNAL_H
-#define AVCODEC_VDPAU_INTERNAL_H
-
-#include <stdint.h>
-#include "mpegvideo.h"
-
-void ff_vdpau_add_data_chunk(MpegEncContext *s, const uint8_t *buf,
-                             int buf_size);
-
-void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
-                                    int buf_size, int slice_count);
-
-void ff_vdpau_h264_picture_start(MpegEncContext *s);
-void ff_vdpau_h264_set_reference_frames(MpegEncContext *s);
-void ff_vdpau_h264_picture_complete(MpegEncContext *s);
-
-void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf,
-                                 int buf_size);
-
-void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
-                                   int buf_size);
-
-#endif /* AVCODEC_VDPAU_INTERNAL_H */
diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c
deleted file mode 100644
index 4914d2a..0000000
--- a/libavcodec/vmdav.c
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
- * Sierra VMD Audio & Video Decoders
- * Copyright (C) 2004 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sierra VMD audio & video decoders
- * by Vladimir "VAG" Gneushev (vagsoft at mail.ru)
- * for more information on the Sierra VMD format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *
- * The video decoder outputs PAL8 colorspace data. The decoder expects
- * a 0x330-byte VMD file header to be transmitted via extradata during
- * codec initialization. Each encoded frame that is sent to this decoder
- * is expected to be prepended with the appropriate 16-byte frame
- * information record from the VMD file.
- *
- * The audio decoder, like the video decoder, expects each encoded data
- * chunk to be prepended with the appropriate 16-byte frame information
- * record from the VMD file. It does not require the 0x330-byte VMD file
- * header, but it does need the audio setup parameters passed in through
- * normal libavcodec API means.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#define VMD_HEADER_SIZE 0x330
-#define PALETTE_COUNT 256
-
-/*
- * Video Decoder
- */
-
-typedef struct VmdVideoContext {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-    AVFrame prev_frame;
-
-    const unsigned char *buf;
-    int size;
-
-    unsigned char palette[PALETTE_COUNT * 4];
-    unsigned char *unpack_buffer;
-    int unpack_buffer_size;
-
-    int x_off, y_off;
-} VmdVideoContext;
-
-#define QUEUE_SIZE 0x1000
-#define QUEUE_MASK 0x0FFF
-
-static void lz_unpack(const unsigned char *src, unsigned char *dest, int dest_len)
-{
-    const unsigned char *s;
-    unsigned char *d;
-    unsigned char *d_end;
-    unsigned char queue[QUEUE_SIZE];
-    unsigned int qpos;
-    unsigned int dataleft;
-    unsigned int chainofs;
-    unsigned int chainlen;
-    unsigned int speclen;
-    unsigned char tag;
-    unsigned int i, j;
-
-    s = src;
-    d = dest;
-    d_end = d + dest_len;
-    dataleft = AV_RL32(s);
-    s += 4;
-    memset(queue, 0x20, QUEUE_SIZE);
-    if (AV_RL32(s) == 0x56781234) {
-        s += 4;
-        qpos = 0x111;
-        speclen = 0xF + 3;
-    } else {
-        qpos = 0xFEE;
-        speclen = 100;  /* no speclen */
-    }
-
-    while (dataleft > 0) {
-        tag = *s++;
-        if ((tag == 0xFF) && (dataleft > 8)) {
-            if (d + 8 > d_end)
-                return;
-            for (i = 0; i < 8; i++) {
-                queue[qpos++] = *d++ = *s++;
-                qpos &= QUEUE_MASK;
-            }
-            dataleft -= 8;
-        } else {
-            for (i = 0; i < 8; i++) {
-                if (dataleft == 0)
-                    break;
-                if (tag & 0x01) {
-                    if (d + 1 > d_end)
-                        return;
-                    queue[qpos++] = *d++ = *s++;
-                    qpos &= QUEUE_MASK;
-                    dataleft--;
-                } else {
-                    chainofs = *s++;
-                    chainofs |= ((*s & 0xF0) << 4);
-                    chainlen = (*s++ & 0x0F) + 3;
-                    if (chainlen == speclen)
-                        chainlen = *s++ + 0xF + 3;
-                    if (d + chainlen > d_end)
-                        return;
-                    for (j = 0; j < chainlen; j++) {
-                        *d = queue[chainofs++ & QUEUE_MASK];
-                        queue[qpos++] = *d++;
-                        qpos &= QUEUE_MASK;
-                    }
-                    dataleft -= chainlen;
-                }
-                tag >>= 1;
-            }
-        }
-    }
-}
-
-static int rle_unpack(const unsigned char *src, unsigned char *dest,
-    int src_len, int dest_len)
-{
-    const unsigned char *ps;
-    unsigned char *pd;
-    int i, l;
-    unsigned char *dest_end = dest + dest_len;
-
-    ps = src;
-    pd = dest;
-    if (src_len & 1)
-        *pd++ = *ps++;
-
-    src_len >>= 1;
-    i = 0;
-    do {
-        l = *ps++;
-        if (l & 0x80) {
-            l = (l & 0x7F) * 2;
-            if (pd + l > dest_end)
-                return ps - src;
-            memcpy(pd, ps, l);
-            ps += l;
-            pd += l;
-        } else {
-            if (pd + i > dest_end)
-                return ps - src;
-            for (i = 0; i < l; i++) {
-                *pd++ = ps[0];
-                *pd++ = ps[1];
-            }
-            ps += 2;
-        }
-        i += l;
-    } while (i < src_len);
-
-    return ps - src;
-}
-
-static void vmd_decode(VmdVideoContext *s)
-{
-    int i;
-    unsigned int *palette32;
-    unsigned char r, g, b;
-
-    /* point to the start of the encoded data */
-    const unsigned char *p = s->buf + 16;
-
-    const unsigned char *pb;
-    unsigned char meth;
-    unsigned char *dp;   /* pointer to current frame */
-    unsigned char *pp;   /* pointer to previous frame */
-    unsigned char len;
-    int ofs;
-
-    int frame_x, frame_y;
-    int frame_width, frame_height;
-    int dp_size;
-
-    frame_x = AV_RL16(&s->buf[6]);
-    frame_y = AV_RL16(&s->buf[8]);
-    frame_width = AV_RL16(&s->buf[10]) - frame_x + 1;
-    frame_height = AV_RL16(&s->buf[12]) - frame_y + 1;
-
-    if ((frame_width == s->avctx->width && frame_height == s->avctx->height) &&
-        (frame_x || frame_y)) {
-
-        s->x_off = frame_x;
-        s->y_off = frame_y;
-    }
-    frame_x -= s->x_off;
-    frame_y -= s->y_off;
-
-    /* if only a certain region will be updated, copy the entire previous
-     * frame before the decode */
-    if (frame_x || frame_y || (frame_width != s->avctx->width) ||
-        (frame_height != s->avctx->height)) {
-
-        memcpy(s->frame.data[0], s->prev_frame.data[0],
-            s->avctx->height * s->frame.linesize[0]);
-    }
-
-    /* check if there is a new palette */
-    if (s->buf[15] & 0x02) {
-        p += 2;
-        palette32 = (unsigned int *)s->palette;
-        for (i = 0; i < PALETTE_COUNT; i++) {
-            r = *p++ * 4;
-            g = *p++ * 4;
-            b = *p++ * 4;
-            palette32[i] = (r << 16) | (g << 8) | (b);
-        }
-        s->size -= (256 * 3 + 2);
-    }
-    if (s->size >= 0) {
-        /* originally UnpackFrame in VAG's code */
-        pb = p;
-        meth = *pb++;
-        if (meth & 0x80) {
-            lz_unpack(pb, s->unpack_buffer, s->unpack_buffer_size);
-            meth &= 0x7F;
-            pb = s->unpack_buffer;
-        }
-
-        dp = &s->frame.data[0][frame_y * s->frame.linesize[0] + frame_x];
-        dp_size = s->frame.linesize[0] * s->avctx->height;
-        pp = &s->prev_frame.data[0][frame_y * s->prev_frame.linesize[0] + frame_x];
-        switch (meth) {
-        case 1:
-            for (i = 0; i < frame_height; i++) {
-                ofs = 0;
-                do {
-                    len = *pb++;
-                    if (len & 0x80) {
-                        len = (len & 0x7F) + 1;
-                        if (ofs + len > frame_width)
-                            return;
-                        memcpy(&dp[ofs], pb, len);
-                        pb += len;
-                        ofs += len;
-                    } else {
-                        /* interframe pixel copy */
-                        if (ofs + len + 1 > frame_width)
-                            return;
-                        memcpy(&dp[ofs], &pp[ofs], len + 1);
-                        ofs += len + 1;
-                    }
-                } while (ofs < frame_width);
-                if (ofs > frame_width) {
-                    av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
-                        ofs, frame_width);
-                    break;
-                }
-                dp += s->frame.linesize[0];
-                pp += s->prev_frame.linesize[0];
-            }
-            break;
-
-        case 2:
-            for (i = 0; i < frame_height; i++) {
-                memcpy(dp, pb, frame_width);
-                pb += frame_width;
-                dp += s->frame.linesize[0];
-                pp += s->prev_frame.linesize[0];
-            }
-            break;
-
-        case 3:
-            for (i = 0; i < frame_height; i++) {
-                ofs = 0;
-                do {
-                    len = *pb++;
-                    if (len & 0x80) {
-                        len = (len & 0x7F) + 1;
-                        if (*pb++ == 0xFF)
-                            len = rle_unpack(pb, &dp[ofs], len, frame_width - ofs);
-                        else
-                            memcpy(&dp[ofs], pb, len);
-                        pb += len;
-                        ofs += len;
-                    } else {
-                        /* interframe pixel copy */
-                        if (ofs + len + 1 > frame_width)
-                            return;
-                        memcpy(&dp[ofs], &pp[ofs], len + 1);
-                        ofs += len + 1;
-                    }
-                } while (ofs < frame_width);
-                if (ofs > frame_width) {
-                    av_log(s->avctx, AV_LOG_ERROR, "VMD video: offset > width (%d > %d)\n",
-                        ofs, frame_width);
-                }
-                dp += s->frame.linesize[0];
-                pp += s->prev_frame.linesize[0];
-            }
-            break;
-        }
-    }
-}
-
-static av_cold int vmdvideo_decode_init(AVCodecContext *avctx)
-{
-    VmdVideoContext *s = avctx->priv_data;
-    int i;
-    unsigned int *palette32;
-    int palette_index = 0;
-    unsigned char r, g, b;
-    unsigned char *vmd_header;
-    unsigned char *raw_palette;
-
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    /* make sure the VMD header made it */
-    if (s->avctx->extradata_size != VMD_HEADER_SIZE) {
-        av_log(s->avctx, AV_LOG_ERROR, "VMD video: expected extradata size of %d\n",
-            VMD_HEADER_SIZE);
-        return -1;
-    }
-    vmd_header = (unsigned char *)avctx->extradata;
-
-    s->unpack_buffer_size = AV_RL32(&vmd_header[800]);
-    s->unpack_buffer = av_malloc(s->unpack_buffer_size);
-    if (!s->unpack_buffer)
-        return -1;
-
-    /* load up the initial palette */
-    raw_palette = &vmd_header[28];
-    palette32 = (unsigned int *)s->palette;
-    for (i = 0; i < PALETTE_COUNT; i++) {
-        r = raw_palette[palette_index++] * 4;
-        g = raw_palette[palette_index++] * 4;
-        b = raw_palette[palette_index++] * 4;
-        palette32[i] = (r << 16) | (g << 8) | (b);
-    }
-
-    return 0;
-}
-
-static int vmdvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VmdVideoContext *s = avctx->priv_data;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    if (buf_size < 16)
-        return buf_size;
-
-    s->frame.reference = 1;
-    if (avctx->get_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "VMD Video: get_buffer() failed\n");
-        return -1;
-    }
-
-    vmd_decode(s);
-
-    /* make the palette available on the way out */
-    memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4);
-
-    /* shuffle frames */
-    FFSWAP(AVFrame, s->frame, s->prev_frame);
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->prev_frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int vmdvideo_decode_end(AVCodecContext *avctx)
-{
-    VmdVideoContext *s = avctx->priv_data;
-
-    if (s->prev_frame.data[0])
-        avctx->release_buffer(avctx, &s->prev_frame);
-    av_free(s->unpack_buffer);
-
-    return 0;
-}
-
-
-/*
- * Audio Decoder
- */
-
-typedef struct VmdAudioContext {
-    AVCodecContext *avctx;
-    int channels;
-    int bits;
-    int block_align;
-    int predictors[2];
-} VmdAudioContext;
-
-static const uint16_t vmdaudio_table[128] = {
-    0x000, 0x008, 0x010, 0x020, 0x030, 0x040, 0x050, 0x060, 0x070, 0x080,
-    0x090, 0x0A0, 0x0B0, 0x0C0, 0x0D0, 0x0E0, 0x0F0, 0x100, 0x110, 0x120,
-    0x130, 0x140, 0x150, 0x160, 0x170, 0x180, 0x190, 0x1A0, 0x1B0, 0x1C0,
-    0x1D0, 0x1E0, 0x1F0, 0x200, 0x208, 0x210, 0x218, 0x220, 0x228, 0x230,
-    0x238, 0x240, 0x248, 0x250, 0x258, 0x260, 0x268, 0x270, 0x278, 0x280,
-    0x288, 0x290, 0x298, 0x2A0, 0x2A8, 0x2B0, 0x2B8, 0x2C0, 0x2C8, 0x2D0,
-    0x2D8, 0x2E0, 0x2E8, 0x2F0, 0x2F8, 0x300, 0x308, 0x310, 0x318, 0x320,
-    0x328, 0x330, 0x338, 0x340, 0x348, 0x350, 0x358, 0x360, 0x368, 0x370,
-    0x378, 0x380, 0x388, 0x390, 0x398, 0x3A0, 0x3A8, 0x3B0, 0x3B8, 0x3C0,
-    0x3C8, 0x3D0, 0x3D8, 0x3E0, 0x3E8, 0x3F0, 0x3F8, 0x400, 0x440, 0x480,
-    0x4C0, 0x500, 0x540, 0x580, 0x5C0, 0x600, 0x640, 0x680, 0x6C0, 0x700,
-    0x740, 0x780, 0x7C0, 0x800, 0x900, 0xA00, 0xB00, 0xC00, 0xD00, 0xE00,
-    0xF00, 0x1000, 0x1400, 0x1800, 0x1C00, 0x2000, 0x3000, 0x4000
-};
-
-static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
-{
-    VmdAudioContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->channels = avctx->channels;
-    s->bits = avctx->bits_per_coded_sample;
-    s->block_align = avctx->block_align;
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-
-    av_log(s->avctx, AV_LOG_DEBUG, "%d channels, %d bits/sample, block align = %d, sample rate = %d\n",
-            s->channels, s->bits, s->block_align, avctx->sample_rate);
-
-    return 0;
-}
-
-static void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data,
-    const uint8_t *buf, int buf_size, int stereo)
-{
-    int i;
-    int chan = 0;
-    int16_t *out = (int16_t*)data;
-
-    for(i = 0; i < buf_size; i++) {
-        if(buf[i] & 0x80)
-            s->predictors[chan] -= vmdaudio_table[buf[i] & 0x7F];
-        else
-            s->predictors[chan] += vmdaudio_table[buf[i]];
-        s->predictors[chan] = av_clip_int16(s->predictors[chan]);
-        out[i] = s->predictors[chan];
-        chan ^= stereo;
-    }
-}
-
-static int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data,
-    const uint8_t *buf, int silence, int data_size)
-{
-    int bytes_decoded = 0;
-    int i;
-
-//    if (silence)
-//        av_log(s->avctx, AV_LOG_INFO, "silent block!\n");
-    if (s->channels == 2) {
-
-        /* stereo handling */
-        if (silence) {
-            memset(data, 0, data_size * 2);
-        } else {
-            if (s->bits == 16)
-                vmdaudio_decode_audio(s, data, buf, data_size, 1);
-            else {
-                /* copy the data but convert it to signed */
-                for (i = 0; i < data_size; i++){
-                    *data++ = buf[i] + 0x80;
-                    *data++ = buf[i] + 0x80;
-                }
-            }
-        }
-    } else {
-        bytes_decoded = data_size * 2;
-
-        /* mono handling */
-        if (silence) {
-            memset(data, 0, data_size * 2);
-        } else {
-            if (s->bits == 16) {
-                vmdaudio_decode_audio(s, data, buf, data_size, 0);
-            } else {
-                /* copy the data but convert it to signed */
-                for (i = 0; i < data_size; i++){
-                    *data++ = buf[i] + 0x80;
-                    *data++ = buf[i] + 0x80;
-                }
-            }
-        }
-    }
-
-    return data_size * 2;
-}
-
-static int vmdaudio_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VmdAudioContext *s = avctx->priv_data;
-    unsigned char *output_samples = (unsigned char *)data;
-
-    /* point to the start of the encoded data */
-    const unsigned char *p = buf + 16;
-
-    if (buf_size < 16)
-        return buf_size;
-
-    if (buf[6] == 1) {
-        /* the chunk contains audio */
-        *data_size = vmdaudio_loadsound(s, output_samples, p, 0, buf_size - 16);
-    } else if (buf[6] == 2) {
-        /* initial chunk, may contain audio and silence */
-        uint32_t flags = AV_RB32(p);
-        int raw_block_size = s->block_align * s->bits / 8;
-        int silent_chunks;
-        if(flags == 0xFFFFFFFF)
-            silent_chunks = 32;
-        else
-            silent_chunks = av_log2(flags + 1);
-        if(*data_size < (s->block_align*silent_chunks + buf_size - 20) * 2)
-            return -1;
-        *data_size = 0;
-        memset(output_samples, 0, raw_block_size * silent_chunks);
-        output_samples += raw_block_size * silent_chunks;
-        *data_size = raw_block_size * silent_chunks;
-        *data_size += vmdaudio_loadsound(s, output_samples, p + 4, 0, buf_size - 20);
-    } else if (buf[6] == 3) {
-        /* silent chunk */
-        *data_size = vmdaudio_loadsound(s, output_samples, p, 1, 0);
-    }
-
-    return buf_size;
-}
-
-
-/*
- * Public Data Structures
- */
-
-AVCodec vmdvideo_decoder = {
-    "vmdvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VMDVIDEO,
-    sizeof(VmdVideoContext),
-    vmdvideo_decode_init,
-    NULL,
-    vmdvideo_decode_end,
-    vmdvideo_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"),
-};
-
-AVCodec vmdaudio_decoder = {
-    "vmdaudio",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_VMDAUDIO,
-    sizeof(VmdAudioContext),
-    vmdaudio_decode_init,
-    NULL,
-    NULL,
-    vmdaudio_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"),
-};
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c
deleted file mode 100644
index 49aaeb2..0000000
--- a/libavcodec/vmnc.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * VMware Screen Codec (VMnc) decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VMware Screen Codec (VMnc) decoder
- * As Alex Beregszaszi discovered, this is effectively RFB data dump
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-enum EncTypes {
-    MAGIC_WMVd = 0x574D5664,
-    MAGIC_WMVe,
-    MAGIC_WMVf,
-    MAGIC_WMVg,
-    MAGIC_WMVh,
-    MAGIC_WMVi,
-    MAGIC_WMVj
-};
-
-enum HexTile_Flags {
-    HT_RAW =  1, // tile is raw
-    HT_BKG =  2, // background color is present
-    HT_FG  =  4, // foreground color is present
-    HT_SUB =  8, // subrects are present
-    HT_CLR = 16  // each subrect has own color
-};
-
-/*
- * Decoder context
- */
-typedef struct VmncContext {
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    int bpp;
-    int bpp2;
-    int bigendian;
-    uint8_t pal[768];
-    int width, height;
-
-    /* cursor data */
-    int cur_w, cur_h;
-    int cur_x, cur_y;
-    int cur_hx, cur_hy;
-    uint8_t* curbits, *curmask;
-    uint8_t* screendta;
-} VmncContext;
-
-/* read pixel value from stream */
-static av_always_inline int vmnc_get_pixel(const uint8_t* buf, int bpp, int be) {
-    switch(bpp * 2 + be) {
-    case 2:
-    case 3: return *buf;
-    case 4: return AV_RL16(buf);
-    case 5: return AV_RB16(buf);
-    case 8: return AV_RL32(buf);
-    case 9: return AV_RB32(buf);
-    default: return 0;
-    }
-}
-
-static void load_cursor(VmncContext *c, const uint8_t *src)
-{
-    int i, j, p;
-    const int bpp = c->bpp2;
-    uint8_t  *dst8  = c->curbits;
-    uint16_t *dst16 = (uint16_t*)c->curbits;
-    uint32_t *dst32 = (uint32_t*)c->curbits;
-
-    for(j = 0; j < c->cur_h; j++) {
-        for(i = 0; i < c->cur_w; i++) {
-            p = vmnc_get_pixel(src, bpp, c->bigendian);
-            src += bpp;
-            if(bpp == 1) *dst8++ = p;
-            if(bpp == 2) *dst16++ = p;
-            if(bpp == 4) *dst32++ = p;
-        }
-    }
-    dst8 = c->curmask;
-    dst16 = (uint16_t*)c->curmask;
-    dst32 = (uint32_t*)c->curmask;
-    for(j = 0; j < c->cur_h; j++) {
-        for(i = 0; i < c->cur_w; i++) {
-            p = vmnc_get_pixel(src, bpp, c->bigendian);
-            src += bpp;
-            if(bpp == 1) *dst8++ = p;
-            if(bpp == 2) *dst16++ = p;
-            if(bpp == 4) *dst32++ = p;
-        }
-    }
-}
-
-static void put_cursor(uint8_t *dst, int stride, VmncContext *c, int dx, int dy)
-{
-    int i, j;
-    int w, h, x, y;
-    w = c->cur_w;
-    if(c->width < c->cur_x + c->cur_w) w = c->width - c->cur_x;
-    h = c->cur_h;
-    if(c->height < c->cur_y + c->cur_h) h = c->height - c->cur_y;
-    x = c->cur_x;
-    y = c->cur_y;
-    if(x < 0) {
-        w += x;
-        x = 0;
-    }
-    if(y < 0) {
-        h += y;
-        y = 0;
-    }
-
-    if((w < 1) || (h < 1)) return;
-    dst += x * c->bpp2 + y * stride;
-
-    if(c->bpp2 == 1) {
-        uint8_t* cd = c->curbits, *msk = c->curmask;
-        for(j = 0; j < h; j++) {
-            for(i = 0; i < w; i++)
-                dst[i] = (dst[i] & cd[i]) ^ msk[i];
-            msk += c->cur_w;
-            cd += c->cur_w;
-            dst += stride;
-        }
-    } else if(c->bpp2 == 2) {
-        uint16_t* cd = (uint16_t*)c->curbits, *msk = (uint16_t*)c->curmask;
-        uint16_t* dst2;
-        for(j = 0; j < h; j++) {
-            dst2 = (uint16_t*)dst;
-            for(i = 0; i < w; i++)
-                dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
-            msk += c->cur_w;
-            cd += c->cur_w;
-            dst += stride;
-        }
-    } else if(c->bpp2 == 4) {
-        uint32_t* cd = (uint32_t*)c->curbits, *msk = (uint32_t*)c->curmask;
-        uint32_t* dst2;
-        for(j = 0; j < h; j++) {
-            dst2 = (uint32_t*)dst;
-            for(i = 0; i < w; i++)
-                dst2[i] = (dst2[i] & cd[i]) ^ msk[i];
-            msk += c->cur_w;
-            cd += c->cur_w;
-            dst += stride;
-        }
-    }
-}
-
-/* fill rectangle with given color */
-static av_always_inline void paint_rect(uint8_t *dst, int dx, int dy, int w, int h, int color, int bpp, int stride)
-{
-    int i, j;
-    dst += dx * bpp + dy * stride;
-    if(bpp == 1){
-        for(j = 0; j < h; j++) {
-            memset(dst, color, w);
-            dst += stride;
-        }
-    }else if(bpp == 2){
-        uint16_t* dst2;
-        for(j = 0; j < h; j++) {
-            dst2 = (uint16_t*)dst;
-            for(i = 0; i < w; i++) {
-                *dst2++ = color;
-            }
-            dst += stride;
-        }
-    }else if(bpp == 4){
-        uint32_t* dst2;
-        for(j = 0; j < h; j++) {
-            dst2 = (uint32_t*)dst;
-            for(i = 0; i < w; i++) {
-                dst2[i] = color;
-            }
-            dst += stride;
-        }
-    }
-}
-
-static av_always_inline void paint_raw(uint8_t *dst, int w, int h, const uint8_t* src, int bpp, int be, int stride)
-{
-    int i, j, p;
-    for(j = 0; j < h; j++) {
-        for(i = 0; i < w; i++) {
-            p = vmnc_get_pixel(src, bpp, be);
-            src += bpp;
-            switch(bpp){
-            case 1:
-                dst[i] = p;
-                break;
-            case 2:
-                ((uint16_t*)dst)[i] = p;
-                break;
-            case 4:
-                ((uint32_t*)dst)[i] = p;
-                break;
-            }
-        }
-        dst += stride;
-    }
-}
-
-static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int ssize, int w, int h, int stride)
-{
-    int i, j, k;
-    int bg = 0, fg = 0, rects, color, flags, xy, wh;
-    const int bpp = c->bpp2;
-    uint8_t *dst2;
-    int bw = 16, bh = 16;
-    const uint8_t *ssrc=src;
-
-    for(j = 0; j < h; j += 16) {
-        dst2 = dst;
-        bw = 16;
-        if(j + 16 > h) bh = h - j;
-        for(i = 0; i < w; i += 16, dst2 += 16 * bpp) {
-            if(src - ssrc >= ssize) {
-                av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n");
-                return -1;
-            }
-            if(i + 16 > w) bw = w - i;
-            flags = *src++;
-            if(flags & HT_RAW) {
-                if(src - ssrc > ssize - bw * bh * bpp) {
-                    av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n");
-                    return -1;
-                }
-                paint_raw(dst2, bw, bh, src, bpp, c->bigendian, stride);
-                src += bw * bh * bpp;
-            } else {
-                if(flags & HT_BKG) {
-                    bg = vmnc_get_pixel(src, bpp, c->bigendian); src += bpp;
-                }
-                if(flags & HT_FG) {
-                    fg = vmnc_get_pixel(src, bpp, c->bigendian); src += bpp;
-                }
-                rects = 0;
-                if(flags & HT_SUB)
-                    rects = *src++;
-                color = !!(flags & HT_CLR);
-
-                paint_rect(dst2, 0, 0, bw, bh, bg, bpp, stride);
-
-                if(src - ssrc > ssize - rects * (color * bpp + 2)) {
-                    av_log(c->avctx, AV_LOG_ERROR, "Premature end of data!\n");
-                    return -1;
-                }
-                for(k = 0; k < rects; k++) {
-                    if(color) {
-                        fg = vmnc_get_pixel(src, bpp, c->bigendian); src += bpp;
-                    }
-                    xy = *src++;
-                    wh = *src++;
-                    paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
-                }
-            }
-        }
-        dst += stride * 16;
-    }
-    return src - ssrc;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VmncContext * const c = avctx->priv_data;
-    uint8_t *outptr;
-    const uint8_t *src = buf;
-    int dx, dy, w, h, depth, enc, chunks, res, size_left;
-
-    c->pic.reference = 1;
-    c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if(avctx->reget_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
-        return -1;
-    }
-
-    c->pic.key_frame = 0;
-    c->pic.pict_type = FF_P_TYPE;
-
-    //restore screen after cursor
-    if(c->screendta) {
-        int i;
-        w = c->cur_w;
-        if(c->width < c->cur_x + w) w = c->width - c->cur_x;
-        h = c->cur_h;
-        if(c->height < c->cur_y + h) h = c->height - c->cur_y;
-        dx = c->cur_x;
-        if(dx < 0) {
-            w += dx;
-            dx = 0;
-        }
-        dy = c->cur_y;
-        if(dy < 0) {
-            h += dy;
-            dy = 0;
-        }
-        if((w > 0) && (h > 0)) {
-            outptr = c->pic.data[0] + dx * c->bpp2 + dy * c->pic.linesize[0];
-            for(i = 0; i < h; i++) {
-                memcpy(outptr, c->screendta + i * c->cur_w * c->bpp2, w * c->bpp2);
-                outptr += c->pic.linesize[0];
-            }
-        }
-    }
-    src += 2;
-    chunks = AV_RB16(src); src += 2;
-    while(chunks--) {
-        dx = AV_RB16(src); src += 2;
-        dy = AV_RB16(src); src += 2;
-        w  = AV_RB16(src); src += 2;
-        h  = AV_RB16(src); src += 2;
-        enc = AV_RB32(src); src += 4;
-        outptr = c->pic.data[0] + dx * c->bpp2 + dy * c->pic.linesize[0];
-        size_left = buf_size - (src - buf);
-        switch(enc) {
-        case MAGIC_WMVd: // cursor
-            if(size_left < 2 + w * h * c->bpp2 * 2) {
-                av_log(avctx, AV_LOG_ERROR, "Premature end of data! (need %i got %i)\n", 2 + w * h * c->bpp2 * 2, size_left);
-                return -1;
-            }
-            src += 2;
-            c->cur_w = w;
-            c->cur_h = h;
-            c->cur_hx = dx;
-            c->cur_hy = dy;
-            if((c->cur_hx > c->cur_w) || (c->cur_hy > c->cur_h)) {
-                av_log(avctx, AV_LOG_ERROR, "Cursor hot spot is not in image: %ix%i of %ix%i cursor size\n", c->cur_hx, c->cur_hy, c->cur_w, c->cur_h);
-                c->cur_hx = c->cur_hy = 0;
-            }
-            c->curbits = av_realloc(c->curbits, c->cur_w * c->cur_h * c->bpp2);
-            c->curmask = av_realloc(c->curmask, c->cur_w * c->cur_h * c->bpp2);
-            c->screendta = av_realloc(c->screendta, c->cur_w * c->cur_h * c->bpp2);
-            load_cursor(c, src);
-            src += w * h * c->bpp2 * 2;
-            break;
-        case MAGIC_WMVe: // unknown
-            src += 2;
-            break;
-        case MAGIC_WMVf: // update cursor position
-            c->cur_x = dx - c->cur_hx;
-            c->cur_y = dy - c->cur_hy;
-            break;
-        case MAGIC_WMVg: // unknown
-            src += 10;
-            break;
-        case MAGIC_WMVh: // unknown
-            src += 4;
-            break;
-        case MAGIC_WMVi: // ServerInitialization struct
-            c->pic.key_frame = 1;
-            c->pic.pict_type = FF_I_TYPE;
-            depth = *src++;
-            if(depth != c->bpp) {
-                av_log(avctx, AV_LOG_INFO, "Depth mismatch. Container %i bpp, Frame data: %i bpp\n", c->bpp, depth);
-            }
-            src++;
-            c->bigendian = *src++;
-            if(c->bigendian & (~1)) {
-                av_log(avctx, AV_LOG_INFO, "Invalid header: bigendian flag = %i\n", c->bigendian);
-                return -1;
-            }
-            //skip the rest of pixel format data
-            src += 13;
-            break;
-        case MAGIC_WMVj: // unknown
-            src += 2;
-            break;
-        case 0x00000000: // raw rectangle data
-            if((dx + w > c->width) || (dy + h > c->height)) {
-                av_log(avctx, AV_LOG_ERROR, "Incorrect frame size: %ix%i+%ix%i of %ix%i\n", w, h, dx, dy, c->width, c->height);
-                return -1;
-            }
-            if(size_left < w * h * c->bpp2) {
-                av_log(avctx, AV_LOG_ERROR, "Premature end of data! (need %i got %i)\n", w * h * c->bpp2, size_left);
-                return -1;
-            }
-            paint_raw(outptr, w, h, src, c->bpp2, c->bigendian, c->pic.linesize[0]);
-            src += w * h * c->bpp2;
-            break;
-        case 0x00000005: // HexTile encoded rectangle
-            if((dx + w > c->width) || (dy + h > c->height)) {
-                av_log(avctx, AV_LOG_ERROR, "Incorrect frame size: %ix%i+%ix%i of %ix%i\n", w, h, dx, dy, c->width, c->height);
-                return -1;
-            }
-            res = decode_hextile(c, outptr, src, size_left, w, h, c->pic.linesize[0]);
-            if(res < 0)
-                return -1;
-            src += res;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unsupported block type 0x%08X\n", enc);
-            chunks = 0; // leave chunks decoding loop
-        }
-    }
-    if(c->screendta){
-        int i;
-        //save screen data before painting cursor
-        w = c->cur_w;
-        if(c->width < c->cur_x + w) w = c->width - c->cur_x;
-        h = c->cur_h;
-        if(c->height < c->cur_y + h) h = c->height - c->cur_y;
-        dx = c->cur_x;
-        if(dx < 0) {
-            w += dx;
-            dx = 0;
-        }
-        dy = c->cur_y;
-        if(dy < 0) {
-            h += dy;
-            dy = 0;
-        }
-        if((w > 0) && (h > 0)) {
-            outptr = c->pic.data[0] + dx * c->bpp2 + dy * c->pic.linesize[0];
-            for(i = 0; i < h; i++) {
-                memcpy(c->screendta + i * c->cur_w * c->bpp2, outptr, w * c->bpp2);
-                outptr += c->pic.linesize[0];
-            }
-            outptr = c->pic.data[0];
-            put_cursor(outptr, c->pic.linesize[0], c, c->cur_x, c->cur_y);
-        }
-    }
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-
-/*
- *
- * Init VMnc decoder
- *
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    VmncContext * const c = avctx->priv_data;
-
-    c->avctx = avctx;
-
-    c->width = avctx->width;
-    c->height = avctx->height;
-
-    c->bpp = avctx->bits_per_coded_sample;
-    c->bpp2 = c->bpp/8;
-
-    switch(c->bpp){
-    case 8:
-        avctx->pix_fmt = PIX_FMT_PAL8;
-        break;
-    case 16:
-        avctx->pix_fmt = PIX_FMT_RGB555;
-        break;
-    case 32:
-        avctx->pix_fmt = PIX_FMT_RGB32;
-        break;
-    default:
-        av_log(avctx, AV_LOG_ERROR, "Unsupported bitdepth %i\n", c->bpp);
-    }
-
-    return 0;
-}
-
-
-
-/*
- *
- * Uninit VMnc decoder
- *
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    VmncContext * const c = avctx->priv_data;
-
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-
-    av_free(c->curbits);
-    av_free(c->curmask);
-    av_free(c->screendta);
-    return 0;
-}
-
-AVCodec vmnc_decoder = {
-    "vmnc",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VMNC,
-    sizeof(VmncContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("VMware Screen Codec / VMware Video"),
-};
-
diff --git a/libavcodec/vorbis.c b/libavcodec/vorbis.c
deleted file mode 100644
index 47388d8..0000000
--- a/libavcodec/vorbis.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/**
- * @file
- * Common code for Vorbis I encoder and decoder
- * @author Denes Balatoni  ( dbalatoni programozo hu )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef V_DEBUG
-//#define V_DEBUG
-
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "get_bits.h"
-
-#include "vorbis.h"
-
-
-/* Helper functions */
-
-// x^(1/n)
-unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n)
-{
-    unsigned int ret = 0, i, j;
-
-    do {
-        ++ret;
-        for (i = 0, j = ret; i < n - 1; i++)
-            j *= ret;
-    } while (j <= x);
-
-    return ret - 1;
-}
-
-// Generate vlc codes from vorbis huffman code lengths
-
-// the two bits[p] > 32 checks should be redundant, all calling code should
-// already ensure that, but since it allows overwriting the stack it seems
-// reasonable to check redundantly.
-int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num)
-{
-    uint_fast32_t exit_at_level[33] = {
-        404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-    uint_fast8_t i, j;
-    uint_fast32_t code, p;
-
-#ifdef V_DEBUG
-    GetBitContext gb;
-#endif
-
-    for (p = 0; (bits[p] == 0) && (p < num); ++p)
-        ;
-    if (p == num) {
-//        av_log(vc->avccontext, AV_LOG_INFO, "An empty codebook. Heh?! \n");
-        return 0;
-    }
-
-    codes[p] = 0;
-    if (bits[p] > 32)
-        return 1;
-    for (i = 0; i < bits[p]; ++i)
-        exit_at_level[i+1] = 1 << i;
-
-#ifdef V_DEBUG
-    av_log(NULL, AV_LOG_INFO, " %d. of %d code len %d code %d - ", p, num, bits[p], codes[p]);
-    init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]);
-    for (i = 0; i < bits[p]; ++i)
-        av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0");
-    av_log(NULL, AV_LOG_INFO, "\n");
-#endif
-
-    ++p;
-
-    for (; p < num; ++p) {
-        if (bits[p] > 32)
-             return 1;
-        if (bits[p] == 0)
-             continue;
-        // find corresponding exit(node which the tree can grow further from)
-        for (i = bits[p]; i > 0; --i)
-            if (exit_at_level[i])
-                break;
-        if (!i) // overspecified tree
-             return 1;
-        code = exit_at_level[i];
-        exit_at_level[i] = 0;
-        // construct code (append 0s to end) and introduce new exits
-        for (j = i + 1 ;j <= bits[p]; ++j)
-            exit_at_level[j] = code + (1 << (j - 1));
-        codes[p] = code;
-
-#ifdef V_DEBUG
-        av_log(NULL, AV_LOG_INFO, " %d. code len %d code %d - ", p, bits[p], codes[p]);
-        init_get_bits(&gb, (uint_fast8_t *)&codes[p], bits[p]);
-        for (i = 0; i < bits[p]; ++i)
-            av_log(NULL, AV_LOG_INFO, "%s", get_bits1(&gb) ? "1" : "0");
-        av_log(NULL, AV_LOG_INFO, "\n");
-#endif
-
-    }
-
-    //no exits should be left (underspecified tree - ie. unused valid vlcs - not allowed by SPEC)
-    for (p = 1; p < 33; p++)
-        if (exit_at_level[p])
-            return 1;
-
-    return 0;
-}
-
-void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values)
-{
-    int i;
-    list[0].sort = 0;
-    list[1].sort = 1;
-    for (i = 2; i < values; i++) {
-        int j;
-        list[i].low  = 0;
-        list[i].high = 1;
-        list[i].sort = i;
-        for (j = 2; j < i; j++) {
-            int tmp = list[j].x;
-            if (tmp < list[i].x) {
-                if (tmp > list[list[i].low].x)
-                    list[i].low  =  j;
-            } else {
-                if (tmp < list[list[i].high].x)
-                    list[i].high = j;
-            }
-        }
-    }
-    for (i = 0; i < values - 1; i++) {
-        int j;
-        for (j = i + 1; j < values; j++) {
-            if (list[list[i].sort].x > list[list[j].sort].x) {
-                int tmp = list[i].sort;
-                list[i].sort = list[j].sort;
-                list[j].sort = tmp;
-            }
-        }
-    }
-}
-
-static inline void render_line_unrolled(intptr_t x, intptr_t y, int x1,
-                                        intptr_t sy, int ady, int adx,
-                                        float *buf)
-{
-    int err = -adx;
-    x -= x1 - 1;
-    buf += x1 - 1;
-    while (++x < 0) {
-        err += ady;
-        if (err >= 0) {
-            err += ady - adx;
-            y   += sy;
-            buf[x++] = ff_vorbis_floor1_inverse_db_table[y];
-        }
-        buf[x] = ff_vorbis_floor1_inverse_db_table[y];
-    }
-    if (x <= 0) {
-        if (err + ady >= 0)
-            y += sy;
-        buf[x] = ff_vorbis_floor1_inverse_db_table[y];
-    }
-}
-
-static void render_line(int x0, int y0, int x1, int y1, float *buf)
-{
-    int dy  = y1 - y0;
-    int adx = x1 - x0;
-    int ady = FFABS(dy);
-    int sy  = dy < 0 ? -1 : 1;
-    buf[x0] = ff_vorbis_floor1_inverse_db_table[y0];
-    if (ady*2 <= adx) { // optimized common case
-        render_line_unrolled(x0, y0, x1, sy, ady, adx, buf);
-    } else {
-        int base = dy / adx;
-        int x    = x0;
-        int y    = y0;
-        int err  = -adx;
-        ady -= FFABS(base) * adx;
-        while (++x < x1) {
-            y += base;
-            err += ady;
-            if (err >= 0) {
-                err -= adx;
-                y   += sy;
-            }
-            buf[x] = ff_vorbis_floor1_inverse_db_table[y];
-        }
-    }
-}
-
-void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
-                                  uint_fast16_t *y_list, int *flag,
-                                  int multiplier, float *out, int samples)
-{
-    int lx, ly, i;
-    lx = 0;
-    ly = y_list[0] * multiplier;
-    for (i = 1; i < values; i++) {
-        int pos = list[i].sort;
-        if (flag[pos]) {
-            int x1 = list[pos].x;
-            int y1 = y_list[pos] * multiplier;
-            if (lx < samples)
-                render_line(lx, ly, FFMIN(x1,samples), y1, out);
-            lx = x1;
-            ly = y1;
-        }
-        if (lx >= samples)
-            break;
-    }
-    if (lx < samples)
-        render_line(lx, ly, samples, ly, out);
-}
diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h
deleted file mode 100644
index ce9bead..0000000
--- a/libavcodec/vorbis.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VORBIS_H
-#define AVCODEC_VORBIS_H
-
-#include "avcodec.h"
-
-extern const float ff_vorbis_floor1_inverse_db_table[256];
-extern const float * const ff_vorbis_vwin[8];
-extern const uint8_t ff_vorbis_channel_layout_offsets[8][8];
-extern const int64_t ff_vorbis_channel_layouts[9];
-
-typedef struct {
-    uint_fast16_t x;
-    uint_fast16_t sort;
-    uint_fast16_t low;
-    uint_fast16_t high;
-} vorbis_floor1_entry;
-
-void ff_vorbis_ready_floor1_list(vorbis_floor1_entry * list, int values);
-unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n); // x^(1/n)
-int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, uint_fast32_t num);
-void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values,
-                                  uint_fast16_t * y_list, int * flag,
-                                  int multiplier, float * out, int samples);
-void vorbis_inverse_coupling(float *mag, float *ang, int blocksize);
-
-#define ilog(i) av_log2(2*(i))
-
-#endif /* AVCODEC_VORBIS_H */
diff --git a/libavcodec/vorbis_data.c b/libavcodec/vorbis_data.c
deleted file mode 100644
index 9bc7979..0000000
--- a/libavcodec/vorbis_data.c
+++ /dev/null
@@ -1,2181 +0,0 @@
-/*
- * copyright (c) 2005 Denes Balatoni ( dbalatoni programozo hu )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "dsputil.h"
-#include "vorbis.h"
-
-const uint8_t ff_vorbis_channel_layout_offsets[8][8] = {
-    { 0, },
-    { 0, 1, },
-    { 0, 2, 1, },
-    { 0, 1, 2, 3, },
-    { 0, 2, 1, 3, 4, },
-    { 0, 2, 1, 5, 3, 4, },
-    { 0, 2, 1, 6, 5, 3, 4, },
-    { 0, 2, 1, 7, 5, 6, 3, 4},
-};
-
-const int64_t ff_vorbis_channel_layouts[9] = {
-    CH_LAYOUT_MONO,
-    CH_LAYOUT_STEREO,
-    CH_LAYOUT_SURROUND,
-    CH_LAYOUT_QUAD,
-    CH_LAYOUT_5POINT0_BACK,
-    CH_LAYOUT_5POINT1_BACK,
-    CH_LAYOUT_5POINT1|CH_BACK_CENTER,
-    CH_LAYOUT_7POINT1,
-    0
-};
-
-DECLARE_ALIGNED(16, static const float, vwin64)[32] = {
-    0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F,
-    0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F,
-    0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F,
-    0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F,
-    0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F,
-    0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F,
-    0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F,
-    0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F,
-};
-
-DECLARE_ALIGNED(16, static const float, vwin128)[64] = {
-    0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F,
-    0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F,
-    0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F,
-    0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F,
-    0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F,
-    0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F,
-    0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F,
-    0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F,
-    0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F,
-    0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F,
-    0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F,
-    0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F,
-    0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F,
-    0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F,
-    0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F,
-    0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F,
-};
-
-DECLARE_ALIGNED(16, static const float, vwin256)[128] = {
-    0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F,
-    0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F,
-    0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F,
-    0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F,
-    0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F,
-    0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F,
-    0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F,
-    0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F,
-    0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F,
-    0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F,
-    0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F,
-    0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F,
-    0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F,
-    0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F,
-    0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F,
-    0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F,
-    0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F,
-    0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F,
-    0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F,
-    0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F,
-    0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F,
-    0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F,
-    0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F,
-    0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F,
-    0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F,
-    0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F,
-    0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F,
-    0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F,
-    0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F,
-    0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F,
-    0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F,
-    0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F,
-};
-
-DECLARE_ALIGNED(16, static const float, vwin512)[256] = {
-    0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F,
-    0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F,
-    0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F,
-    0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F,
-    0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F,
-    0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F,
-    0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F,
-    0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F,
-    0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F,
-    0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F,
-    0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F,
-    0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F,
-    0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F,
-    0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F,
-    0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F,
-    0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F,
-    0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F,
-    0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F,
-    0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F,
-    0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F,
-    0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F,
-    0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F,
-    0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F,
-    0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F,
-    0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F,
-    0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F,
-    0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F,
-    0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F,
-    0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F,
-    0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F,
-    0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F,
-    0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F,
-    0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F,
-    0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F,
-    0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F,
-    0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F,
-    0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F,
-    0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F,
-    0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F,
-    0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F,
-    0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F,
-    0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F,
-    0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F,
-    0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F,
-    0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F,
-    0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F,
-    0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F,
-    0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F,
-    0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F,
-    0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F,
-    0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F,
-    0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F,
-    0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F,
-    0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F,
-    0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F,
-    0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F,
-    0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F,
-    0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F,
-    0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F,
-    0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F,
-    0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F,
-    0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F,
-    0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F,
-    0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F,
-};
-
-DECLARE_ALIGNED(16, static const float, vwin1024)[512] = {
-    0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F,
-    0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F,
-    0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F,
-    0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F,
-    0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F,
-    0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F,
-    0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F,
-    0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F,
-    0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F,
-    0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F,
-    0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F,
-    0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F,
-    0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F,
-    0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F,
-    0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F,
-    0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F,
-    0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F,
-    0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F,
-    0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F,
-    0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F,
-    0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F,
-    0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F,
-    0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F,
-    0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F,
-    0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F,
-    0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F,
-    0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F,
-    0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F,
-    0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F,
-    0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F,
-    0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F,
-    0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F,
-    0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F,
-    0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F,
-    0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F,
-    0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F,
-    0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F,
-    0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F,
-    0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F,
-    0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F,
-    0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F,
-    0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F,
-    0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F,
-    0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F,
-    0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F,
-    0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F,
-    0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F,
-    0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F,
-    0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F,
-    0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F,
-    0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F,
-    0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F,
-    0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F,
-    0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F,
-    0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F,
-    0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F,
-    0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F,
-    0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F,
-    0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F,
-    0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F,
-    0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F,
-    0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F,
-    0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F,
-    0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F,
-    0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F,
-    0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F,
-    0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F,
-    0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F,
-    0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F,
-    0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F,
-    0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F,
-    0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F,
-    0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F,
-    0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F,
-    0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F,
-    0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F,
-    0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F,
-    0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F,
-    0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F,
-    0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F,
-    0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F,
-    0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F,
-    0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F,
-    0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F,
-    0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F,
-    0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F,
-    0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F,
-    0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F,
-    0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F,
-    0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F,
-    0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F,
-    0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F,
-    0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F,
-    0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F,
-    0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F,
-    0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F,
-    0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F,
-    0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F,
-    0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F,
-    0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F,
-    0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F,
-    0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F,
-    0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F,
-    0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F,
-    0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F,
-    0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F,
-    0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F,
-    0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F,
-    0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F,
-    0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F,
-    0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F,
-    0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F,
-    0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F,
-    0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F,
-    0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F,
-    0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F,
-    0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F,
-    0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F,
-    0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F,
-    0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F,
-    0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F,
-    0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F,
-    0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F,
-    0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F,
-    0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F,
-    0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F,
-    0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F,
-    0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F,
-};
-
-DECLARE_ALIGNED(16, static const float, vwin2048)[1024] = {
-    0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F,
-    0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F,
-    0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F,
-    0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F,
-    0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F,
-    0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F,
-    0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F,
-    0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F,
-    0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F,
-    0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F,
-    0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F,
-    0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F,
-    0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F,
-    0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F,
-    0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F,
-    0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F,
-    0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F,
-    0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F,
-    0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F,
-    0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F,
-    0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F,
-    0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F,
-    0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F,
-    0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F,
-    0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F,
-    0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F,
-    0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F,
-    0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F,
-    0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F,
-    0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F,
-    0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F,
-    0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F,
-    0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F,
-    0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F,
-    0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F,
-    0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F,
-    0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F,
-    0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F,
-    0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F,
-    0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F,
-    0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F,
-    0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F,
-    0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F,
-    0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F,
-    0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F,
-    0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F,
-    0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F,
-    0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F,
-    0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F,
-    0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F,
-    0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F,
-    0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F,
-    0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F,
-    0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F,
-    0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F,
-    0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F,
-    0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F,
-    0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F,
-    0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F,
-    0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F,
-    0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F,
-    0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F,
-    0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F,
-    0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F,
-    0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F,
-    0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F,
-    0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F,
-    0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F,
-    0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F,
-    0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F,
-    0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F,
-    0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F,
-    0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F,
-    0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F,
-    0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F,
-    0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F,
-    0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F,
-    0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F,
-    0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F,
-    0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F,
-    0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F,
-    0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F,
-    0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F,
-    0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F,
-    0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F,
-    0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F,
-    0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F,
-    0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F,
-    0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F,
-    0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F,
-    0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F,
-    0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F,
-    0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F,
-    0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F,
-    0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F,
-    0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F,
-    0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F,
-    0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F,
-    0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F,
-    0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F,
-    0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F,
-    0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F,
-    0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F,
-    0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F,
-    0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F,
-    0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F,
-    0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F,
-    0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F,
-    0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F,
-    0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F,
-    0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F,
-    0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F,
-    0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F,
-    0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F,
-    0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F,
-    0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F,
-    0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F,
-    0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F,
-    0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F,
-    0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F,
-    0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F,
-    0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F,
-    0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F,
-    0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F,
-    0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F,
-    0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F,
-    0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F,
-    0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F,
-    0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F,
-    0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F,
-    0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F,
-    0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F,
-    0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F,
-    0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F,
-    0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F,
-    0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F,
-    0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F,
-    0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F,
-    0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F,
-    0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F,
-    0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F,
-    0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F,
-    0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F,
-    0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F,
-    0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F,
-    0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F,
-    0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F,
-    0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F,
-    0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F,
-    0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F,
-    0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F,
-    0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F,
-    0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F,
-    0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F,
-    0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F,
-    0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F,
-    0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F,
-    0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F,
-    0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F,
-    0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F,
-    0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F,
-    0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F,
-    0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F,
-    0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F,
-    0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F,
-    0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F,
-    0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F,
-    0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F,
-    0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F,
-    0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F,
-    0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F,
-    0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F,
-    0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F,
-    0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F,
-    0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F,
-    0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F,
-    0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F,
-    0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F,
-    0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F,
-    0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F,
-    0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F,
-    0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F,
-    0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F,
-    0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F,
-    0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F,
-    0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F,
-    0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F,
-    0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F,
-    0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F,
-    0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F,
-    0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F,
-    0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F,
-    0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F,
-    0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F,
-    0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F,
-    0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F,
-    0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F,
-    0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F,
-    0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F,
-    0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F,
-    0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F,
-    0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F,
-    0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F,
-    0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F,
-    0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F,
-    0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F,
-    0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F,
-    0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F,
-    0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F,
-    0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F,
-    0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F,
-    0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F,
-    0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F,
-    0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F,
-    0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F,
-    0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F,
-    0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F,
-    0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F,
-    0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F,
-    0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F,
-    0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F,
-    0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F,
-    0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F,
-    0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F,
-    0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F,
-    0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F,
-    0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F,
-    0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F,
-    0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F,
-    0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F,
-    0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F,
-    0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F,
-    0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F,
-    0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F,
-    0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F,
-    0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F,
-    0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F,
-    0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F,
-    0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F,
-    0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F,
-    0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F,
-    0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F,
-    0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F,
-    0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F,
-    0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F,
-    0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F,
-    0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F,
-    0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F,
-    0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F,
-    0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F,
-    0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F,
-    0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F,
-    0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F,
-    0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F,
-    0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F,
-    0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F,
-};
-
-DECLARE_ALIGNED(16, static const float, vwin4096)[2048] = {
-    0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F,
-    0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F,
-    0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F,
-    0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F,
-    0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F,
-    0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F,
-    0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F,
-    0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F,
-    0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F,
-    0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F,
-    0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F,
-    0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F,
-    0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F,
-    0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F,
-    0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F,
-    0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F,
-    0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F,
-    0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F,
-    0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F,
-    0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F,
-    0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F,
-    0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F,
-    0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F,
-    0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F,
-    0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F,
-    0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F,
-    0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F,
-    0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F,
-    0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F,
-    0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F,
-    0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F,
-    0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F,
-    0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F,
-    0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F,
-    0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F,
-    0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F,
-    0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F,
-    0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F,
-    0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F,
-    0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F,
-    0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F,
-    0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F,
-    0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F,
-    0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F,
-    0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F,
-    0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F,
-    0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F,
-    0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F,
-    0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F,
-    0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F,
-    0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F,
-    0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F,
-    0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F,
-    0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F,
-    0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F,
-    0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F,
-    0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F,
-    0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F,
-    0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F,
-    0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F,
-    0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F,
-    0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F,
-    0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F,
-    0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F,
-    0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F,
-    0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F,
-    0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F,
-    0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F,
-    0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F,
-    0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F,
-    0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F,
-    0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F,
-    0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F,
-    0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F,
-    0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F,
-    0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F,
-    0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F,
-    0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F,
-    0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F,
-    0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F,
-    0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F,
-    0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F,
-    0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F,
-    0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F,
-    0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F,
-    0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F,
-    0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F,
-    0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F,
-    0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F,
-    0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F,
-    0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F,
-    0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F,
-    0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F,
-    0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F,
-    0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F,
-    0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F,
-    0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F,
-    0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F,
-    0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F,
-    0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F,
-    0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F,
-    0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F,
-    0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F,
-    0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F,
-    0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F,
-    0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F,
-    0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F,
-    0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F,
-    0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F,
-    0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F,
-    0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F,
-    0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F,
-    0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F,
-    0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F,
-    0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F,
-    0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F,
-    0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F,
-    0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F,
-    0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F,
-    0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F,
-    0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F,
-    0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F,
-    0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F,
-    0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F,
-    0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F,
-    0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F,
-    0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F,
-    0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F,
-    0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F,
-    0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F,
-    0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F,
-    0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F,
-    0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F,
-    0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F,
-    0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F,
-    0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F,
-    0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F,
-    0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F,
-    0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F,
-    0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F,
-    0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F,
-    0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F,
-    0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F,
-    0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F,
-    0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F,
-    0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F,
-    0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F,
-    0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F,
-    0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F,
-    0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F,
-    0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F,
-    0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F,
-    0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F,
-    0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F,
-    0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F,
-    0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F,
-    0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F,
-    0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F,
-    0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F,
-    0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F,
-    0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F,
-    0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F,
-    0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F,
-    0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F,
-    0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F,
-    0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F,
-    0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F,
-    0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F,
-    0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F,
-    0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F,
-    0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F,
-    0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F,
-    0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F,
-    0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F,
-    0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F,
-    0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F,
-    0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F,
-    0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F,
-    0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F,
-    0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F,
-    0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F,
-    0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F,
-    0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F,
-    0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F,
-    0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F,
-    0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F,
-    0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F,
-    0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F,
-    0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F,
-    0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F,
-    0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F,
-    0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F,
-    0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F,
-    0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F,
-    0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F,
-    0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F,
-    0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F,
-    0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F,
-    0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F,
-    0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F,
-    0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F,
-    0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F,
-    0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F,
-    0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F,
-    0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F,
-    0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F,
-    0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F,
-    0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F,
-    0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F,
-    0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F,
-    0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F,
-    0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F,
-    0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F,
-    0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F,
-    0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F,
-    0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F,
-    0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F,
-    0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F,
-    0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F,
-    0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F,
-    0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F,
-    0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F,
-    0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F,
-    0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F,
-    0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F,
-    0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F,
-    0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F,
-    0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F,
-    0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F,
-    0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F,
-    0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F,
-    0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F,
-    0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F,
-    0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F,
-    0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F,
-    0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F,
-    0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F,
-    0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F,
-    0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F,
-    0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F,
-    0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F,
-    0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F,
-    0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F,
-    0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F,
-    0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F,
-    0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F,
-    0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F,
-    0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F,
-    0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F,
-    0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F,
-    0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F,
-    0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F,
-    0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F,
-    0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F,
-    0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F,
-    0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F,
-    0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F,
-    0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F,
-    0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F,
-    0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F,
-    0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F,
-    0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F,
-    0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F,
-    0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F,
-    0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F,
-    0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F,
-    0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F,
-    0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F,
-    0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F,
-    0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F,
-    0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F,
-    0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F,
-    0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F,
-    0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F,
-    0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F,
-    0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F,
-    0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F,
-    0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F,
-    0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F,
-    0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F,
-    0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F,
-    0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F,
-    0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F,
-    0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F,
-    0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F,
-    0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F,
-    0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F,
-    0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F,
-    0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F,
-    0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F,
-    0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F,
-    0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F,
-    0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F,
-    0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F,
-    0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F,
-    0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F,
-    0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F,
-    0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F,
-    0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F,
-    0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F,
-    0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F,
-    0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F,
-    0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F,
-    0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F,
-    0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F,
-    0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F,
-    0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F,
-    0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F,
-    0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F,
-    0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F,
-    0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F,
-    0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F,
-    0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F,
-    0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F,
-    0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F,
-    0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F,
-    0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F,
-    0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F,
-    0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F,
-    0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F,
-    0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F,
-    0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F,
-    0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F,
-    0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F,
-    0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F,
-    0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F,
-    0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F,
-    0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F,
-    0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F,
-    0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F,
-    0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F,
-    0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F,
-    0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F,
-    0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F,
-    0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F,
-    0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F,
-    0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F,
-    0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F,
-    0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F,
-    0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F,
-    0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F,
-    0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F,
-    0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F,
-    0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F,
-    0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F,
-    0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F,
-    0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F,
-    0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F,
-    0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F,
-    0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F,
-    0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F,
-    0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F,
-    0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F,
-    0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F,
-    0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F,
-    0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F,
-    0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F,
-    0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F,
-    0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F,
-    0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F,
-    0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F,
-    0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F,
-    0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F,
-    0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F,
-    0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F,
-    0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F,
-    0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F,
-    0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F,
-    0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F,
-    0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F,
-    0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F,
-    0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F,
-    0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F,
-    0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F,
-    0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F,
-    0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F,
-    0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F,
-    0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F,
-    0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F,
-    0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F,
-    0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F,
-    0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F,
-    0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F,
-    0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F,
-    0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F,
-    0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F,
-    0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F,
-    0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F,
-    0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F,
-    0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F,
-    0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F,
-    0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F,
-    0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F,
-    0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F,
-    0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F,
-    0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F,
-    0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F,
-    0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F,
-    0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F,
-    0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F,
-    0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F,
-    0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F,
-    0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F,
-    0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F,
-    0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F,
-    0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F,
-    0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F,
-    0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F,
-    0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F,
-    0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F,
-    0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F,
-    0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F,
-    0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F,
-    0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F,
-    0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F,
-    0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F,
-    0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F,
-    0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F,
-    0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F,
-    0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F,
-    0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F,
-    0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F,
-    0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F,
-    0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F,
-    0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F,
-    0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F,
-    0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F,
-    0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F,
-    0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F,
-    0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F,
-    0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F,
-    0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F,
-    0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F,
-    0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F,
-    0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F,
-    0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F,
-    0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F,
-    0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F,
-    0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F,
-    0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F,
-    0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F,
-    0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F,
-    0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F,
-    0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F,
-    0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F,
-    0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F,
-    0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F,
-    0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F,
-    0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F,
-    0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F,
-    0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F,
-    0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F,
-    0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F,
-    0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F,
-    0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F,
-    0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F,
-    0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F,
-    0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F,
-    0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F,
-    0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F,
-    0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F,
-    0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F,
-    0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F,
-    0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F,
-    0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F,
-    0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F,
-    0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F,
-    0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F,
-    0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F,
-    0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F,
-    0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F,
-    0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F,
-    0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F,
-    0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F,
-    0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F,
-    0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F,
-    0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F,
-    0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F,
-    0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F,
-    0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F,
-    0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F,
-    0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F,
-    0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F,
-    0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F,
-    0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F,
-    0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F,
-    0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F,
-    0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F,
-    0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F,
-    0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F,
-    0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F,
-    0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F,
-    0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F,
-    0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F,
-    0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F,
-    0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F,
-    0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F,
-    0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F,
-    0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F,
-    0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F,
-    0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F,
-    0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F,
-    0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F,
-    0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F,
-    0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F,
-    0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F,
-    0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F,
-    0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F,
-    0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F,
-    0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F,
-    0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F,
-    0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
-};
-
-DECLARE_ALIGNED(16, static const float, vwin8192)[4096] = {
-    0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F,
-    0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F,
-    0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F,
-    0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F,
-    0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F,
-    0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F,
-    0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F,
-    0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F,
-    0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F,
-    0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F,
-    0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F,
-    0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F,
-    0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F,
-    0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F,
-    0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F,
-    0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F,
-    0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F,
-    0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F,
-    0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F,
-    0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F,
-    0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F,
-    0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F,
-    0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F,
-    0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F,
-    0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F,
-    0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F,
-    0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F,
-    0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F,
-    0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F,
-    0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F,
-    0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F,
-    0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F,
-    0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F,
-    0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F,
-    0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F,
-    0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F,
-    0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F,
-    0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F,
-    0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F,
-    0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F,
-    0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F,
-    0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F,
-    0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F,
-    0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F,
-    0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F,
-    0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F,
-    0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F,
-    0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F,
-    0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F,
-    0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F,
-    0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F,
-    0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F,
-    0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F,
-    0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F,
-    0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F,
-    0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F,
-    0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F,
-    0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F,
-    0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F,
-    0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F,
-    0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F,
-    0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F,
-    0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F,
-    0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F,
-    0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F,
-    0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F,
-    0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F,
-    0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F,
-    0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F,
-    0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F,
-    0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F,
-    0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F,
-    0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F,
-    0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F,
-    0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F,
-    0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F,
-    0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F,
-    0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F,
-    0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F,
-    0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F,
-    0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F,
-    0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F,
-    0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F,
-    0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F,
-    0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F,
-    0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F,
-    0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F,
-    0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F,
-    0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F,
-    0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F,
-    0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F,
-    0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F,
-    0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F,
-    0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F,
-    0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F,
-    0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F,
-    0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F,
-    0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F,
-    0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F,
-    0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F,
-    0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F,
-    0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F,
-    0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F,
-    0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F,
-    0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F,
-    0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F,
-    0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F,
-    0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F,
-    0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F,
-    0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F,
-    0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F,
-    0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F,
-    0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F,
-    0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F,
-    0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F,
-    0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F,
-    0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F,
-    0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F,
-    0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F,
-    0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F,
-    0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F,
-    0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F,
-    0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F,
-    0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F,
-    0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F,
-    0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F,
-    0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F,
-    0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F,
-    0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F,
-    0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F,
-    0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F,
-    0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F,
-    0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F,
-    0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F,
-    0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F,
-    0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F,
-    0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F,
-    0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F,
-    0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F,
-    0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F,
-    0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F,
-    0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F,
-    0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F,
-    0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F,
-    0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F,
-    0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F,
-    0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F,
-    0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F,
-    0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F,
-    0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F,
-    0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F,
-    0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F,
-    0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F,
-    0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F,
-    0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F,
-    0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F,
-    0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F,
-    0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F,
-    0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F,
-    0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F,
-    0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F,
-    0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F,
-    0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F,
-    0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F,
-    0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F,
-    0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F,
-    0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F,
-    0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F,
-    0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F,
-    0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F,
-    0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F,
-    0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F,
-    0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F,
-    0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F,
-    0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F,
-    0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F,
-    0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F,
-    0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F,
-    0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F,
-    0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F,
-    0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F,
-    0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F,
-    0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F,
-    0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F,
-    0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F,
-    0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F,
-    0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F,
-    0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F,
-    0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F,
-    0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F,
-    0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F,
-    0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F,
-    0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F,
-    0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F,
-    0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F,
-    0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F,
-    0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F,
-    0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F,
-    0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F,
-    0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F,
-    0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F,
-    0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F,
-    0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F,
-    0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F,
-    0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F,
-    0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F,
-    0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F,
-    0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F,
-    0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F,
-    0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F,
-    0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F,
-    0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F,
-    0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F,
-    0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F,
-    0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F,
-    0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F,
-    0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F,
-    0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F,
-    0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F,
-    0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F,
-    0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F,
-    0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F,
-    0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F,
-    0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F,
-    0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F,
-    0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F,
-    0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F,
-    0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F,
-    0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F,
-    0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F,
-    0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F,
-    0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F,
-    0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F,
-    0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F,
-    0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F,
-    0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F,
-    0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F,
-    0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F,
-    0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F,
-    0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F,
-    0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F,
-    0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F,
-    0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F,
-    0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F,
-    0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F,
-    0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F,
-    0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F,
-    0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F,
-    0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F,
-    0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F,
-    0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F,
-    0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F,
-    0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F,
-    0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F,
-    0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F,
-    0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F,
-    0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F,
-    0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F,
-    0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F,
-    0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F,
-    0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F,
-    0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F,
-    0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F,
-    0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F,
-    0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F,
-    0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F,
-    0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F,
-    0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F,
-    0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F,
-    0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F,
-    0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F,
-    0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F,
-    0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F,
-    0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F,
-    0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F,
-    0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F,
-    0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F,
-    0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F,
-    0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F,
-    0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F,
-    0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F,
-    0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F,
-    0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F,
-    0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F,
-    0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F,
-    0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F,
-    0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F,
-    0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F,
-    0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F,
-    0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F,
-    0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F,
-    0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F,
-    0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F,
-    0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F,
-    0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F,
-    0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F,
-    0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F,
-    0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F,
-    0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F,
-    0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F,
-    0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F,
-    0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F,
-    0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F,
-    0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F,
-    0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F,
-    0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F,
-    0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F,
-    0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F,
-    0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F,
-    0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F,
-    0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F,
-    0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F,
-    0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F,
-    0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F,
-    0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F,
-    0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F,
-    0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F,
-    0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F,
-    0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F,
-    0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F,
-    0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F,
-    0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F,
-    0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F,
-    0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F,
-    0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F,
-    0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F,
-    0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F,
-    0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F,
-    0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F,
-    0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F,
-    0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F,
-    0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F,
-    0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F,
-    0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F,
-    0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F,
-    0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F,
-    0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F,
-    0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F,
-    0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F,
-    0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F,
-    0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F,
-    0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F,
-    0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F,
-    0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F,
-    0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F,
-    0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F,
-    0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F,
-    0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F,
-    0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F,
-    0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F,
-    0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F,
-    0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F,
-    0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F,
-    0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F,
-    0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F,
-    0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F,
-    0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F,
-    0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F,
-    0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F,
-    0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F,
-    0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F,
-    0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F,
-    0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F,
-    0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F,
-    0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F,
-    0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F,
-    0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F,
-    0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F,
-    0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F,
-    0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F,
-    0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F,
-    0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F,
-    0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F,
-    0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F,
-    0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F,
-    0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F,
-    0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F,
-    0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F,
-    0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F,
-    0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F,
-    0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F,
-    0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F,
-    0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F,
-    0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F,
-    0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F,
-    0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F,
-    0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F,
-    0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F,
-    0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F,
-    0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F,
-    0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F,
-    0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F,
-    0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F,
-    0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F,
-    0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F,
-    0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F,
-    0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F,
-    0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F,
-    0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F,
-    0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F,
-    0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F,
-    0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F,
-    0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F,
-    0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F,
-    0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F,
-    0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F,
-    0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F,
-    0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F,
-    0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F,
-    0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F,
-    0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F,
-    0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F,
-    0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F,
-    0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F,
-    0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F,
-    0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F,
-    0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F,
-    0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F,
-    0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F,
-    0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F,
-    0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F,
-    0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F,
-    0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F,
-    0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F,
-    0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F,
-    0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F,
-    0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F,
-    0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F,
-    0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F,
-    0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F,
-    0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F,
-    0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F,
-    0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F,
-    0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F,
-    0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F,
-    0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F,
-    0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F,
-    0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F,
-    0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F,
-    0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F,
-    0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F,
-    0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F,
-    0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F,
-    0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F,
-    0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F,
-    0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F,
-    0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F,
-    0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F,
-    0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F,
-    0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F,
-    0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F,
-    0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F,
-    0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F,
-    0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F,
-    0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F,
-    0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F,
-    0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F,
-    0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F,
-    0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F,
-    0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F,
-    0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F,
-    0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F,
-    0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F,
-    0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F,
-    0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F,
-    0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F,
-    0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F,
-    0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F,
-    0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F,
-    0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F,
-    0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F,
-    0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F,
-    0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F,
-    0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F,
-    0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F,
-    0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F,
-    0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F,
-    0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F,
-    0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F,
-    0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F,
-    0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F,
-    0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F,
-    0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F,
-    0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F,
-    0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F,
-    0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F,
-    0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F,
-    0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F,
-    0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F,
-    0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F,
-    0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F,
-    0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F,
-    0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F,
-    0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F,
-    0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F,
-    0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F,
-    0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F,
-    0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F,
-    0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F,
-    0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F,
-    0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F,
-    0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F,
-    0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F,
-    0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F,
-    0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F,
-    0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F,
-    0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F,
-    0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F,
-    0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F,
-    0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F,
-    0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F,
-    0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F,
-    0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F,
-    0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F,
-    0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F,
-    0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F,
-    0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F,
-    0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F,
-    0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F,
-    0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F,
-    0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F,
-    0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F,
-    0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F,
-    0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F,
-    0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F,
-    0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F,
-    0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F,
-    0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F,
-    0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F,
-    0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F,
-    0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F,
-    0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F,
-    0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F,
-    0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F,
-    0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F,
-    0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F,
-    0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F,
-    0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F,
-    0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F,
-    0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F,
-    0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F,
-    0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F,
-    0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F,
-    0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F,
-    0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F,
-    0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F,
-    0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F,
-    0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F,
-    0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F,
-    0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F,
-    0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F,
-    0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F,
-    0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F,
-    0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F,
-    0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F,
-    0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F,
-    0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F,
-    0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F,
-    0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F,
-    0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F,
-    0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F,
-    0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F,
-    0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F,
-    0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F,
-    0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F,
-    0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F,
-    0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F,
-    0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F,
-    0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F,
-    0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F,
-    0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F,
-    0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F,
-    0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F,
-    0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F,
-    0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F,
-    0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F,
-    0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F,
-    0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F,
-    0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F,
-    0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F,
-    0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F,
-    0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F,
-    0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F,
-    0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F,
-    0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F,
-    0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F,
-    0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F,
-    0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F,
-    0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F,
-    0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F,
-    0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F,
-    0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F,
-    0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F,
-    0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F,
-    0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F,
-    0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F,
-    0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F,
-    0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F,
-    0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F,
-    0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F,
-    0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F,
-    0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F,
-    0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F,
-    0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F,
-    0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F,
-    0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F,
-    0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F,
-    0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F,
-    0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F,
-    0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F,
-    0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F,
-    0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F,
-    0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F,
-    0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F,
-    0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F,
-    0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F,
-    0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F,
-    0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F,
-    0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F,
-    0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F,
-    0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F,
-    0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F,
-    0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F,
-    0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F,
-    0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F,
-    0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F,
-    0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F,
-    0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F,
-    0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F,
-    0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F,
-    0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F,
-    0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F,
-    0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F,
-    0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F,
-    0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F,
-    0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F,
-    0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F,
-    0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F,
-    0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F,
-    0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F,
-    0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F,
-    0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F,
-    0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F,
-    0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F,
-    0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F,
-    0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F,
-    0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F,
-    0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F,
-    0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F,
-    0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F,
-    0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F,
-    0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F,
-    0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F,
-    0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F,
-    0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F,
-    0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F,
-    0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F,
-    0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F,
-    0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F,
-    0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F,
-    0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F,
-    0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F,
-    0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F,
-    0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F,
-    0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F,
-    0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F,
-    0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F,
-    0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F,
-    0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F,
-    0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F,
-    0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F,
-    0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F,
-    0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F,
-    0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F,
-    0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F,
-    0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F,
-    0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F,
-    0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F,
-    0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F,
-    0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F,
-    0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F,
-    0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F,
-    0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F,
-    0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F,
-    0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F,
-    0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F,
-    0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F,
-    0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F,
-    0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F,
-    0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F,
-    0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F,
-    0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F,
-    0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F,
-    0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F,
-    0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F,
-    0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F,
-    0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F,
-    0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F,
-    0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F,
-    0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F,
-    0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F,
-    0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F,
-    0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F,
-    0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F,
-    0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F,
-    0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F,
-    0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F,
-    0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F,
-    0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F,
-    0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F,
-    0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F,
-    0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F,
-    0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F,
-    0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F,
-    0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F,
-    0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F,
-    0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F,
-    0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F,
-    0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F,
-    0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F,
-    0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F,
-    0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F,
-    0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F,
-    0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F,
-    0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F,
-    0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F,
-    0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F,
-    0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F,
-    0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F,
-    0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F,
-    0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F,
-    0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F,
-    0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F,
-    0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F,
-    0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F,
-    0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F,
-    0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F,
-    0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F,
-    0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F,
-    0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F,
-    0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F,
-    0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F,
-    0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F,
-    0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F,
-    0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F,
-    0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F,
-    0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F,
-    0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F,
-    0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F,
-    0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F,
-    0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F,
-    0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F,
-    0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F,
-    0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F,
-    0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F,
-    0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F,
-    0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F,
-    0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F,
-    0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F,
-    0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F,
-    0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F,
-    0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F,
-    0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F,
-    0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F,
-    0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F,
-    0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F,
-    0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F,
-    0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F,
-    0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F,
-    0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F,
-    0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F,
-    0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F,
-    0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F,
-    0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F,
-    0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F,
-    0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F,
-    0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F,
-    0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F,
-    0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F,
-    0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F,
-    0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F,
-    0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F,
-    0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F,
-    0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F,
-    0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F,
-    0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F,
-    0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F,
-    0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F,
-    0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F,
-    0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F,
-    0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F,
-    0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F,
-    0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F,
-    0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F,
-    0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F,
-    0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F,
-    0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F,
-    0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F,
-    0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F,
-    0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F,
-    0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F,
-    0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F,
-    0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F,
-    0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F,
-    0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F,
-    0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F,
-    0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F,
-    0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F,
-    0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F,
-    0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F,
-    0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F,
-    0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F,
-    0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F,
-    0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F,
-    0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F,
-    0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F,
-    0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F,
-    0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F,
-    0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F,
-    0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F,
-    0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F,
-    0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F,
-    0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F,
-    0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F,
-    0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F,
-    0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F,
-    0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F,
-    0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F,
-    0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F,
-    0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F,
-    0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F,
-    0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F,
-    0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F,
-    0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F,
-    0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F,
-    0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F,
-    0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F,
-    0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F,
-    0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F,
-    0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F,
-    0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F,
-    0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F,
-    0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F,
-    0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F,
-    0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F,
-    0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F,
-    0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F,
-    0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F,
-    0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F,
-    0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F,
-    0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F,
-    0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F,
-    0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F,
-    0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F,
-    0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F,
-    0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F,
-    0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F,
-    0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F,
-    0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F,
-    0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F,
-    0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F,
-    0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F,
-    0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F,
-    0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F,
-    0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F,
-    0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F,
-    0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F,
-    0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F,
-    0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F,
-    0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F,
-    0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F,
-    0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F,
-    0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F,
-    0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F,
-    0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F,
-    0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F,
-    0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F,
-    0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F,
-    0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F,
-    0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F,
-    0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F,
-    0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F,
-    0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F,
-    0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F,
-    0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F,
-    0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F,
-    0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F,
-    0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F,
-    0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F,
-    0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F,
-    0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F,
-    0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F,
-    0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F,
-    0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F,
-    0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F,
-    0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F,
-    0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F,
-    0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F,
-    0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F,
-    0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F,
-    0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F,
-    0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F,
-    0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F,
-    0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F,
-    0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F,
-    0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F,
-    0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F,
-    0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F,
-    0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F,
-    0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F,
-    0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F,
-    0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F,
-    0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F,
-    0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F,
-    0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F,
-    0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F,
-    0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F,
-    0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F,
-    0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F,
-    0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F,
-    0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F,
-    0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F,
-    0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F,
-    0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F,
-    0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F,
-    0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F,
-    0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F,
-    0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F,
-    0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F,
-    0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F,
-    0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F,
-    0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F,
-    0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F,
-    0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F,
-    0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F,
-    0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F,
-    0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F,
-    0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F,
-    0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F,
-    0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F,
-    0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F,
-    0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F,
-    0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F,
-    0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F,
-    0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F,
-    0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F,
-    0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F,
-    0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F,
-    0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F,
-    0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F,
-    0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F,
-    0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F,
-    0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F,
-    0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F,
-    0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F,
-    0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F,
-    0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F,
-    0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F,
-    0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F,
-    0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F,
-    0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F,
-    0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F,
-    0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F,
-    0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F,
-    0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F,
-    0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F,
-    0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F,
-    0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F,
-    0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F,
-    0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F,
-    0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F,
-    0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F,
-    0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F,
-    0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F,
-    0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F,
-    0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F,
-    0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F,
-    0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F,
-    0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F,
-    0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F,
-    0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F,
-    0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F,
-    0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F,
-    0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F,
-    0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F,
-    0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F,
-    0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F,
-    0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F,
-    0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F,
-    0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F,
-    0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F,
-    0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F,
-    0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F,
-    0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F,
-    0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F,
-    0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F,
-    0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F,
-    0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F,
-    0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F,
-    0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F,
-    0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F,
-    0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F,
-    0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F,
-    0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F,
-    0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F,
-    0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F,
-    0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F,
-    0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F,
-    0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F,
-    0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F,
-    0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F,
-    0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F,
-    0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F,
-    0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F,
-    0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F,
-    0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F,
-    0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F,
-    0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F,
-    0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F,
-    0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F,
-    0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F,
-    0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F,
-    0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
-    1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
-};
-
-const float ff_vorbis_floor1_inverse_db_table[256]={
-    1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
-    1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
-    1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
-    2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
-    2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
-    3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
-    4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
-    6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
-    7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
-    1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
-    1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
-    1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
-    2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
-    2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
-    3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
-    4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
-    5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
-    7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
-    9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
-    1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
-    1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
-    2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
-    2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
-    3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
-    4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
-    5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
-    7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
-    9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
-    0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
-    0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
-    0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
-    0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
-    0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
-    0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
-    0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
-    0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
-    0.00092223983F, 0.00098217216F, 0.0010459992F,  0.0011139742F,
-    0.0011863665F,  0.0012634633F,  0.0013455702F,  0.0014330129F,
-    0.0015261382F,  0.0016253153F,  0.0017309374F,  0.0018434235F,
-    0.0019632195F,  0.0020908006F,  0.0022266726F,  0.0023713743F,
-    0.0025254795F,  0.0026895994F,  0.0028643847F,  0.0030505286F,
-    0.0032487691F,  0.0034598925F,  0.0036847358F,  0.0039241906F,
-    0.0041792066F,  0.0044507950F,  0.0047400328F,  0.0050480668F,
-    0.0053761186F,  0.0057254891F,  0.0060975636F,  0.0064938176F,
-    0.0069158225F,  0.0073652516F,  0.0078438871F,  0.0083536271F,
-    0.0088964928F,  0.009474637F,   0.010090352F,   0.010746080F,
-    0.011444421F,   0.012188144F,   0.012980198F,   0.013823725F,
-    0.014722068F,   0.015678791F,   0.016697687F,   0.017782797F,
-    0.018938423F,   0.020169149F,   0.021479854F,   0.022875735F,
-    0.024362330F,   0.025945531F,   0.027631618F,   0.029427276F,
-    0.031339626F,   0.033376252F,   0.035545228F,   0.037855157F,
-    0.040315199F,   0.042935108F,   0.045725273F,   0.048696758F,
-    0.051861348F,   0.055231591F,   0.058820850F,   0.062643361F,
-    0.066714279F,   0.071049749F,   0.075666962F,   0.080584227F,
-    0.085821044F,   0.091398179F,   0.097337747F,   0.10366330F,
-    0.11039993F,    0.11757434F,    0.12521498F,    0.13335215F,
-    0.14201813F,    0.15124727F,    0.16107617F,    0.17154380F,
-    0.18269168F,    0.19456402F,    0.20720788F,    0.22067342F,
-    0.23501402F,    0.25028656F,    0.26655159F,    0.28387361F,
-    0.30232132F,    0.32196786F,    0.34289114F,    0.36517414F,
-    0.38890521F,    0.41417847F,    0.44109412F,    0.46975890F,
-    0.50028648F,    0.53279791F,    0.56742212F,    0.60429640F,
-    0.64356699F,    0.68538959F,    0.72993007F,    0.77736504F,
-    0.82788260F,    0.88168307F,    0.9389798F,     1.F,
-};
-
-const float * const ff_vorbis_vwin[8] = {
-      vwin64,  vwin128,  vwin256,  vwin512,
-    vwin1024, vwin2048, vwin4096, vwin8192
-};
diff --git a/libavcodec/vorbis_dec.c b/libavcodec/vorbis_dec.c
deleted file mode 100644
index f8067db..0000000
--- a/libavcodec/vorbis_dec.c
+++ /dev/null
@@ -1,1676 +0,0 @@
-/**
- * @file
- * Vorbis I decoder
- * @author Denes Balatoni  ( dbalatoni programozo hu )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef V_DEBUG
-//#define V_DEBUG
-//#define AV_DEBUG(...) av_log(NULL, AV_LOG_INFO, __VA_ARGS__)
-
-#include <math.h>
-
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "get_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-
-#include "vorbis.h"
-#include "xiph.h"
-
-#define V_NB_BITS 8
-#define V_NB_BITS2 11
-#define V_MAX_VLCS (1 << 16)
-#define V_MAX_PARTITIONS (1 << 20)
-
-#ifndef V_DEBUG
-#define AV_DEBUG(...)
-#endif
-
-#undef NDEBUG
-#include <assert.h>
-
-typedef struct {
-    uint_fast8_t dimensions;
-    uint_fast8_t lookup_type;
-    uint_fast8_t maxdepth;
-    VLC vlc;
-    float *codevectors;
-    unsigned int nb_bits;
-} vorbis_codebook;
-
-typedef union  vorbis_floor_u  vorbis_floor_data;
-typedef struct vorbis_floor0_s vorbis_floor0;
-typedef struct vorbis_floor1_s vorbis_floor1;
-struct vorbis_context_s;
-typedef
-int (* vorbis_floor_decode_func)
-    (struct vorbis_context_s *, vorbis_floor_data *, float *);
-typedef struct {
-    uint_fast8_t floor_type;
-    vorbis_floor_decode_func decode;
-    union vorbis_floor_u {
-        struct vorbis_floor0_s {
-            uint_fast8_t  order;
-            uint_fast16_t rate;
-            uint_fast16_t bark_map_size;
-            int_fast32_t *map[2];
-            uint_fast32_t map_size[2];
-            uint_fast8_t  amplitude_bits;
-            uint_fast8_t  amplitude_offset;
-            uint_fast8_t  num_books;
-            uint_fast8_t *book_list;
-            float        *lsp;
-        } t0;
-        struct vorbis_floor1_s {
-            uint_fast8_t partitions;
-            uint_fast8_t maximum_class;
-            uint_fast8_t partition_class[32];
-            uint_fast8_t class_dimensions[16];
-            uint_fast8_t class_subclasses[16];
-            uint_fast8_t class_masterbook[16];
-            int_fast16_t subclass_books[16][8];
-            uint_fast8_t multiplier;
-            uint_fast16_t x_list_dim;
-            vorbis_floor1_entry *list;
-        } t1;
-    } data;
-} vorbis_floor;
-
-typedef struct {
-    uint_fast16_t type;
-    uint_fast32_t begin;
-    uint_fast32_t end;
-    uint_fast32_t partition_size;
-    uint_fast8_t  classifications;
-    uint_fast8_t  classbook;
-    int_fast16_t  books[64][8];
-    uint_fast8_t  maxpass;
-} vorbis_residue;
-
-typedef struct {
-    uint_fast8_t  submaps;
-    uint_fast16_t coupling_steps;
-    uint_fast8_t *magnitude;
-    uint_fast8_t *angle;
-    uint_fast8_t *mux;
-    uint_fast8_t  submap_floor[16];
-    uint_fast8_t  submap_residue[16];
-} vorbis_mapping;
-
-typedef struct {
-    uint_fast8_t  blockflag;
-    uint_fast16_t windowtype;
-    uint_fast16_t transformtype;
-    uint_fast8_t  mapping;
-} vorbis_mode;
-
-typedef struct vorbis_context_s {
-    AVCodecContext *avccontext;
-    GetBitContext gb;
-    DSPContext dsp;
-
-    FFTContext mdct[2];
-    uint_fast8_t  first_frame;
-    uint_fast32_t version;
-    uint_fast8_t  audio_channels;
-    uint_fast32_t audio_samplerate;
-    uint_fast32_t bitrate_maximum;
-    uint_fast32_t bitrate_nominal;
-    uint_fast32_t bitrate_minimum;
-    uint_fast32_t blocksize[2];
-    const float  *win[2];
-    uint_fast16_t codebook_count;
-    vorbis_codebook *codebooks;
-    uint_fast8_t  floor_count;
-    vorbis_floor *floors;
-    uint_fast8_t  residue_count;
-    vorbis_residue *residues;
-    uint_fast8_t  mapping_count;
-    vorbis_mapping *mappings;
-    uint_fast8_t  mode_count;
-    vorbis_mode  *modes;
-    uint_fast8_t  mode_number; // mode number for the current packet
-    uint_fast8_t  previous_window;
-    float        *channel_residues;
-    float        *channel_floors;
-    float        *saved;
-    uint_fast32_t add_bias; // for float->int conversion
-    uint_fast32_t exp_bias;
-} vorbis_context;
-
-/* Helper functions */
-
-#define BARK(x) \
-    (13.1f * atan(0.00074f * (x)) + 2.24f * atan(1.85e-8f * (x) * (x)) + 1e-4f * (x))
-
-static const char idx_err_str[] = "Index value %d out of range (0 - %d) for %s at %s:%i\n";
-#define VALIDATE_INDEX(idx, limit) \
-    if (idx >= limit) {\
-        av_log(vc->avccontext, AV_LOG_ERROR,\
-               idx_err_str,\
-               (int)(idx), (int)(limit - 1), #idx, __FILE__, __LINE__);\
-        return -1;\
-    }
-#define GET_VALIDATED_INDEX(idx, bits, limit) \
-    {\
-        idx = get_bits(gb, bits);\
-        VALIDATE_INDEX(idx, limit)\
-    }
-
-static float vorbisfloat2float(uint_fast32_t val)
-{
-    double mant = val & 0x1fffff;
-    long exp    = (val & 0x7fe00000L) >> 21;
-    if (val & 0x80000000)
-        mant = -mant;
-    return ldexp(mant, exp - 20 - 768);
-}
-
-
-// Free all allocated memory -----------------------------------------
-
-static void vorbis_free(vorbis_context *vc)
-{
-    int_fast16_t i;
-
-    av_freep(&vc->channel_residues);
-    av_freep(&vc->channel_floors);
-    av_freep(&vc->saved);
-
-    av_freep(&vc->residues);
-    av_freep(&vc->modes);
-
-    ff_mdct_end(&vc->mdct[0]);
-    ff_mdct_end(&vc->mdct[1]);
-
-    for (i = 0; i < vc->codebook_count; ++i) {
-        av_free(vc->codebooks[i].codevectors);
-        free_vlc(&vc->codebooks[i].vlc);
-    }
-    av_freep(&vc->codebooks);
-
-    for (i = 0; i < vc->floor_count; ++i) {
-        if (vc->floors[i].floor_type == 0) {
-            av_free(vc->floors[i].data.t0.map[0]);
-            av_free(vc->floors[i].data.t0.map[1]);
-            av_free(vc->floors[i].data.t0.book_list);
-            av_free(vc->floors[i].data.t0.lsp);
-        } else {
-            av_free(vc->floors[i].data.t1.list);
-        }
-    }
-    av_freep(&vc->floors);
-
-    for (i = 0; i < vc->mapping_count; ++i) {
-        av_free(vc->mappings[i].magnitude);
-        av_free(vc->mappings[i].angle);
-        av_free(vc->mappings[i].mux);
-    }
-    av_freep(&vc->mappings);
-}
-
-// Parse setup header -------------------------------------------------
-
-// Process codebooks part
-
-static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc)
-{
-    uint_fast16_t cb;
-    uint8_t  *tmp_vlc_bits;
-    uint32_t *tmp_vlc_codes;
-    GetBitContext *gb = &vc->gb;
-
-    vc->codebook_count = get_bits(gb, 8) + 1;
-
-    AV_DEBUG(" Codebooks: %d \n", vc->codebook_count);
-
-    vc->codebooks = av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));
-    tmp_vlc_bits  = av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
-    tmp_vlc_codes = av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
-
-    for (cb = 0; cb < vc->codebook_count; ++cb) {
-        vorbis_codebook *codebook_setup = &vc->codebooks[cb];
-        uint_fast8_t ordered;
-        uint_fast32_t t, used_entries = 0;
-        uint_fast32_t entries;
-
-        AV_DEBUG(" %d. Codebook \n", cb);
-
-        if (get_bits(gb, 24) != 0x564342) {
-            av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook setup data corrupt. \n", cb);
-            goto error;
-        }
-
-        codebook_setup->dimensions=get_bits(gb, 16);
-        if (codebook_setup->dimensions > 16 || codebook_setup->dimensions == 0) {
-            av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook's dimension is invalid (%d). \n", cb, codebook_setup->dimensions);
-            goto error;
-        }
-        entries = get_bits(gb, 24);
-        if (entries > V_MAX_VLCS) {
-            av_log(vc->avccontext, AV_LOG_ERROR, " %"PRIdFAST16". Codebook has too many entries (%"PRIdFAST32"). \n", cb, entries);
-            goto error;
-        }
-
-        ordered = get_bits1(gb);
-
-        AV_DEBUG(" codebook_dimensions %d, codebook_entries %d \n", codebook_setup->dimensions, entries);
-
-        if (!ordered) {
-            uint_fast16_t ce;
-            uint_fast8_t  flag;
-            uint_fast8_t  sparse = get_bits1(gb);
-
-            AV_DEBUG(" not ordered \n");
-
-            if (sparse) {
-                AV_DEBUG(" sparse \n");
-
-                used_entries = 0;
-                for (ce = 0; ce < entries; ++ce) {
-                    flag = get_bits1(gb);
-                    if (flag) {
-                        tmp_vlc_bits[ce] = get_bits(gb, 5) + 1;
-                        ++used_entries;
-                    } else
-                        tmp_vlc_bits[ce] = 0;
-                }
-            } else {
-                AV_DEBUG(" not sparse \n");
-
-                used_entries = entries;
-                for (ce = 0; ce < entries; ++ce)
-                    tmp_vlc_bits[ce] = get_bits(gb, 5) + 1;
-            }
-        } else {
-            uint_fast16_t current_entry = 0;
-            uint_fast8_t current_length = get_bits(gb, 5)+1;
-
-            AV_DEBUG(" ordered, current length: %d \n", current_length);  //FIXME
-
-            used_entries = entries;
-            for (; current_entry < used_entries && current_length <= 32; ++current_length) {
-                uint_fast16_t i, number;
-
-                AV_DEBUG(" number bits: %d ", ilog(entries - current_entry));
-
-                number = get_bits(gb, ilog(entries - current_entry));
-
-                AV_DEBUG(" number: %d \n", number);
-
-                for (i = current_entry; i < number+current_entry; ++i)
-                    if (i < used_entries)
-                        tmp_vlc_bits[i] = current_length;
-
-                current_entry+=number;
-            }
-            if (current_entry>used_entries) {
-                av_log(vc->avccontext, AV_LOG_ERROR, " More codelengths than codes in codebook. \n");
-                goto error;
-            }
-        }
-
-        codebook_setup->lookup_type = get_bits(gb, 4);
-
-        AV_DEBUG(" lookup type: %d : %s \n", codebook_setup->lookup_type, codebook_setup->lookup_type ? "vq" : "no lookup");
-
-// If the codebook is used for (inverse) VQ, calculate codevectors.
-
-        if (codebook_setup->lookup_type == 1) {
-            uint_fast16_t i, j, k;
-            uint_fast16_t codebook_lookup_values = ff_vorbis_nth_root(entries, codebook_setup->dimensions);
-            uint_fast16_t codebook_multiplicands[codebook_lookup_values];
-
-            float codebook_minimum_value = vorbisfloat2float(get_bits_long(gb, 32));
-            float codebook_delta_value   = vorbisfloat2float(get_bits_long(gb, 32));
-            uint_fast8_t codebook_value_bits = get_bits(gb, 4)+1;
-            uint_fast8_t codebook_sequence_p = get_bits1(gb);
-
-            AV_DEBUG(" We expect %d numbers for building the codevectors. \n", codebook_lookup_values);
-            AV_DEBUG("  delta %f minmum %f \n", codebook_delta_value, codebook_minimum_value);
-
-            for (i = 0; i < codebook_lookup_values; ++i) {
-                codebook_multiplicands[i] = get_bits(gb, codebook_value_bits);
-
-                AV_DEBUG(" multiplicands*delta+minmum : %e \n", (float)codebook_multiplicands[i]*codebook_delta_value+codebook_minimum_value);
-                AV_DEBUG(" multiplicand %d \n", codebook_multiplicands[i]);
-            }
-
-// Weed out unused vlcs and build codevector vector
-            codebook_setup->codevectors = used_entries ? av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float)) : NULL;
-            for (j = 0, i = 0; i < entries; ++i) {
-                uint_fast8_t dim = codebook_setup->dimensions;
-
-                if (tmp_vlc_bits[i]) {
-                    float last = 0.0;
-                    uint_fast32_t lookup_offset = i;
-
-#ifdef V_DEBUG
-                    av_log(vc->avccontext, AV_LOG_INFO, "Lookup offset %d ,", i);
-#endif
-
-                    for (k = 0; k < dim; ++k) {
-                        uint_fast32_t multiplicand_offset = lookup_offset % codebook_lookup_values;
-                        codebook_setup->codevectors[j * dim + k] = codebook_multiplicands[multiplicand_offset] * codebook_delta_value + codebook_minimum_value + last;
-                        if (codebook_sequence_p)
-                            last = codebook_setup->codevectors[j * dim + k];
-                        lookup_offset/=codebook_lookup_values;
-                    }
-                    tmp_vlc_bits[j] = tmp_vlc_bits[i];
-
-#ifdef V_DEBUG
-                    av_log(vc->avccontext, AV_LOG_INFO, "real lookup offset %d, vector: ", j);
-                    for (k = 0; k < dim; ++k)
-                        av_log(vc->avccontext, AV_LOG_INFO, " %f ", codebook_setup->codevectors[j * dim + k]);
-                    av_log(vc->avccontext, AV_LOG_INFO, "\n");
-#endif
-
-                    ++j;
-                }
-            }
-            if (j != used_entries) {
-                av_log(vc->avccontext, AV_LOG_ERROR, "Bug in codevector vector building code. \n");
-                goto error;
-            }
-            entries = used_entries;
-        } else if (codebook_setup->lookup_type >= 2) {
-            av_log(vc->avccontext, AV_LOG_ERROR, "Codebook lookup type not supported. \n");
-            goto error;
-        }
-
-// Initialize VLC table
-        if (ff_vorbis_len2vlc(tmp_vlc_bits, tmp_vlc_codes, entries)) {
-            av_log(vc->avccontext, AV_LOG_ERROR, " Invalid code lengths while generating vlcs. \n");
-            goto error;
-        }
-        codebook_setup->maxdepth = 0;
-        for (t = 0; t < entries; ++t)
-            if (tmp_vlc_bits[t] >= codebook_setup->maxdepth)
-                codebook_setup->maxdepth = tmp_vlc_bits[t];
-
-        if (codebook_setup->maxdepth > 3 * V_NB_BITS)
-            codebook_setup->nb_bits = V_NB_BITS2;
-        else
-            codebook_setup->nb_bits = V_NB_BITS;
-
-        codebook_setup->maxdepth = (codebook_setup->maxdepth+codebook_setup->nb_bits - 1) / codebook_setup->nb_bits;
-
-        if (init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {
-            av_log(vc->avccontext, AV_LOG_ERROR, " Error generating vlc tables. \n");
-            goto error;
-        }
-    }
-
-    av_free(tmp_vlc_bits);
-    av_free(tmp_vlc_codes);
-    return 0;
-
-// Error:
-error:
-    av_free(tmp_vlc_bits);
-    av_free(tmp_vlc_codes);
-    return -1;
-}
-
-// Process time domain transforms part (unused in Vorbis I)
-
-static int vorbis_parse_setup_hdr_tdtransforms(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-    uint_fast8_t i;
-    uint_fast8_t vorbis_time_count = get_bits(gb, 6) + 1;
-
-    for (i = 0; i < vorbis_time_count; ++i) {
-        uint_fast16_t vorbis_tdtransform = get_bits(gb, 16);
-
-        AV_DEBUG(" Vorbis time domain transform %d: %d \n", vorbis_time_count, vorbis_tdtransform);
-
-        if (vorbis_tdtransform) {
-            av_log(vc->avccontext, AV_LOG_ERROR, "Vorbis time domain transform data nonzero. \n");
-            return -1;
-        }
-    }
-    return 0;
-}
-
-// Process floors part
-
-static int vorbis_floor0_decode(vorbis_context *vc,
-                                vorbis_floor_data *vfu, float *vec);
-static void create_map(vorbis_context *vc, uint_fast8_t floor_number);
-static int vorbis_floor1_decode(vorbis_context *vc,
-                                vorbis_floor_data *vfu, float *vec);
-static int vorbis_parse_setup_hdr_floors(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-    uint_fast16_t i,j,k;
-
-    vc->floor_count = get_bits(gb, 6) + 1;
-
-    vc->floors = av_mallocz(vc->floor_count * sizeof(vorbis_floor));
-
-    for (i = 0; i < vc->floor_count; ++i) {
-        vorbis_floor *floor_setup = &vc->floors[i];
-
-        floor_setup->floor_type = get_bits(gb, 16);
-
-        AV_DEBUG(" %d. floor type %d \n", i, floor_setup->floor_type);
-
-        if (floor_setup->floor_type == 1) {
-            uint_fast8_t  maximum_class = 0;
-            uint_fast8_t  rangebits;
-            uint_fast32_t rangemax;
-            uint_fast16_t floor1_values = 2;
-
-            floor_setup->decode = vorbis_floor1_decode;
-
-            floor_setup->data.t1.partitions = get_bits(gb, 5);
-
-            AV_DEBUG(" %d.floor: %d partitions \n", i, floor_setup->data.t1.partitions);
-
-            for (j = 0; j < floor_setup->data.t1.partitions; ++j) {
-                floor_setup->data.t1.partition_class[j] = get_bits(gb, 4);
-                if (floor_setup->data.t1.partition_class[j] > maximum_class)
-                    maximum_class = floor_setup->data.t1.partition_class[j];
-
-                AV_DEBUG(" %d. floor %d partition class %d \n", i, j, floor_setup->data.t1.partition_class[j]);
-
-            }
-
-            AV_DEBUG(" maximum class %d \n", maximum_class);
-
-            floor_setup->data.t1.maximum_class = maximum_class;
-
-            for (j = 0; j <= maximum_class; ++j) {
-                floor_setup->data.t1.class_dimensions[j] = get_bits(gb, 3) + 1;
-                floor_setup->data.t1.class_subclasses[j] = get_bits(gb, 2);
-
-                AV_DEBUG(" %d floor %d class dim: %d subclasses %d \n", i, j, floor_setup->data.t1.class_dimensions[j], floor_setup->data.t1.class_subclasses[j]);
-
-                if (floor_setup->data.t1.class_subclasses[j]) {
-                    GET_VALIDATED_INDEX(floor_setup->data.t1.class_masterbook[j], 8, vc->codebook_count)
-
-                    AV_DEBUG("   masterbook: %d \n", floor_setup->data.t1.class_masterbook[j]);
-                }
-
-                for (k = 0; k < (1 << floor_setup->data.t1.class_subclasses[j]); ++k) {
-                    int16_t bits = get_bits(gb, 8) - 1;
-                    if (bits != -1)
-                        VALIDATE_INDEX(bits, vc->codebook_count)
-                    floor_setup->data.t1.subclass_books[j][k] = bits;
-
-                    AV_DEBUG("    book %d. : %d \n", k, floor_setup->data.t1.subclass_books[j][k]);
-                }
-            }
-
-            floor_setup->data.t1.multiplier = get_bits(gb, 2) + 1;
-            floor_setup->data.t1.x_list_dim = 2;
-
-            for (j = 0; j < floor_setup->data.t1.partitions; ++j)
-                floor_setup->data.t1.x_list_dim+=floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]];
-
-            floor_setup->data.t1.list = av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(vorbis_floor1_entry));
-
-
-            rangebits = get_bits(gb, 4);
-            rangemax = (1 << rangebits);
-            if (rangemax > vc->blocksize[1] / 2) {
-                av_log(vc->avccontext, AV_LOG_ERROR,
-                       "Floor value is too large for blocksize: %d (%d)\n",
-                       rangemax, vc->blocksize[1] / 2);
-                return -1;
-            }
-            floor_setup->data.t1.list[0].x = 0;
-            floor_setup->data.t1.list[1].x = rangemax;
-
-            for (j = 0; j < floor_setup->data.t1.partitions; ++j) {
-                for (k = 0; k < floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]]; ++k, ++floor1_values) {
-                    floor_setup->data.t1.list[floor1_values].x = get_bits(gb, rangebits);
-
-                    AV_DEBUG(" %d. floor1 Y coord. %d \n", floor1_values, floor_setup->data.t1.list[floor1_values].x);
-                }
-            }
-
-// Precalculate order of x coordinates - needed for decode
-            ff_vorbis_ready_floor1_list(floor_setup->data.t1.list, floor_setup->data.t1.x_list_dim);
-        } else if (floor_setup->floor_type == 0) {
-            uint_fast8_t max_codebook_dim = 0;
-
-            floor_setup->decode = vorbis_floor0_decode;
-
-            floor_setup->data.t0.order          = get_bits(gb,  8);
-            floor_setup->data.t0.rate           = get_bits(gb, 16);
-            floor_setup->data.t0.bark_map_size  = get_bits(gb, 16);
-            floor_setup->data.t0.amplitude_bits = get_bits(gb,  6);
-            /* zero would result in a div by zero later *
-             * 2^0 - 1 == 0                             */
-            if (floor_setup->data.t0.amplitude_bits == 0) {
-              av_log(vc->avccontext, AV_LOG_ERROR,
-                     "Floor 0 amplitude bits is 0.\n");
-              return -1;
-            }
-            floor_setup->data.t0.amplitude_offset = get_bits(gb, 8);
-            floor_setup->data.t0.num_books        = get_bits(gb, 4) + 1;
-
-            /* allocate mem for booklist */
-            floor_setup->data.t0.book_list =
-                av_malloc(floor_setup->data.t0.num_books);
-            if (!floor_setup->data.t0.book_list)
-                return -1;
-            /* read book indexes */
-            {
-                int idx;
-                uint_fast8_t book_idx;
-                for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) {
-                    GET_VALIDATED_INDEX(floor_setup->data.t0.book_list[idx], 8, vc->codebook_count)
-                    if (vc->codebooks[book_idx].dimensions > max_codebook_dim)
-                        max_codebook_dim = vc->codebooks[book_idx].dimensions;
-                }
-            }
-
-            create_map(vc, i);
-
-            /* allocate mem for lsp coefficients */
-            {
-                /* codebook dim is for padding if codebook dim doesn't *
-                 * divide order+1 then we need to read more data       */
-                floor_setup->data.t0.lsp =
-                    av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim)
-                              * sizeof(float));
-                if (!floor_setup->data.t0.lsp)
-                    return -1;
-            }
-
-#ifdef V_DEBUG /* debug output parsed headers */
-            AV_DEBUG("floor0 order: %u\n", floor_setup->data.t0.order);
-            AV_DEBUG("floor0 rate: %u\n", floor_setup->data.t0.rate);
-            AV_DEBUG("floor0 bark map size: %u\n",
-              floor_setup->data.t0.bark_map_size);
-            AV_DEBUG("floor0 amplitude bits: %u\n",
-              floor_setup->data.t0.amplitude_bits);
-            AV_DEBUG("floor0 amplitude offset: %u\n",
-              floor_setup->data.t0.amplitude_offset);
-            AV_DEBUG("floor0 number of books: %u\n",
-              floor_setup->data.t0.num_books);
-            AV_DEBUG("floor0 book list pointer: %p\n",
-              floor_setup->data.t0.book_list);
-            {
-              int idx;
-              for (idx = 0; idx < floor_setup->data.t0.num_books; ++idx) {
-                  AV_DEBUG("  Book %d: %u\n",
-                           idx+1,
-                           floor_setup->data.t0.book_list[idx]);
-              }
-            }
-#endif
-        } else {
-            av_log(vc->avccontext, AV_LOG_ERROR, "Invalid floor type!\n");
-            return -1;
-        }
-    }
-    return 0;
-}
-
-// Process residues part
-
-static int vorbis_parse_setup_hdr_residues(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-    uint_fast8_t i, j, k;
-
-    vc->residue_count = get_bits(gb, 6)+1;
-    vc->residues      = av_mallocz(vc->residue_count * sizeof(vorbis_residue));
-
-    AV_DEBUG(" There are %d residues. \n", vc->residue_count);
-
-    for (i = 0; i < vc->residue_count; ++i) {
-        vorbis_residue *res_setup = &vc->residues[i];
-        uint_fast8_t cascade[64];
-        uint_fast8_t high_bits;
-        uint_fast8_t low_bits;
-
-        res_setup->type = get_bits(gb, 16);
-
-        AV_DEBUG(" %d. residue type %d \n", i, res_setup->type);
-
-        res_setup->begin          = get_bits(gb, 24);
-        res_setup->end            = get_bits(gb, 24);
-        res_setup->partition_size = get_bits(gb, 24) + 1;
-        /* Validations to prevent a buffer overflow later. */
-        if (res_setup->begin>res_setup->end ||
-            res_setup->end>vc->blocksize[1] / (res_setup->type == 2 ? 1 : 2) ||
-            (res_setup->end-res_setup->begin) / res_setup->partition_size > V_MAX_PARTITIONS) {
-            av_log(vc->avccontext, AV_LOG_ERROR, "partition out of bounds: type, begin, end, size, blocksize: %"PRIdFAST16", %"PRIdFAST32", %"PRIdFAST32", %"PRIdFAST32", %"PRIdFAST32"\n", res_setup->type, res_setup->begin, res_setup->end, res_setup->partition_size, vc->blocksize[1] / 2);
-            return -1;
-        }
-
-        res_setup->classifications = get_bits(gb, 6) + 1;
-        GET_VALIDATED_INDEX(res_setup->classbook, 8, vc->codebook_count)
-
-        AV_DEBUG("    begin %d end %d part.size %d classif.s %d classbook %d \n", res_setup->begin, res_setup->end, res_setup->partition_size,
-          res_setup->classifications, res_setup->classbook);
-
-        for (j = 0; j < res_setup->classifications; ++j) {
-            high_bits = 0;
-            low_bits  = get_bits(gb, 3);
-            if (get_bits1(gb))
-                high_bits = get_bits(gb, 5);
-            cascade[j] = (high_bits << 3) + low_bits;
-
-            AV_DEBUG("     %d class casscade depth: %d \n", j, ilog(cascade[j]));
-        }
-
-        res_setup->maxpass = 0;
-        for (j = 0; j < res_setup->classifications; ++j) {
-            for (k = 0; k < 8; ++k) {
-                if (cascade[j]&(1 << k)) {
-                    GET_VALIDATED_INDEX(res_setup->books[j][k], 8, vc->codebook_count)
-
-                    AV_DEBUG("     %d class casscade depth %d book: %d \n", j, k, res_setup->books[j][k]);
-
-                    if (k>res_setup->maxpass)
-                        res_setup->maxpass = k;
-                } else {
-                    res_setup->books[j][k] = -1;
-                }
-            }
-        }
-    }
-    return 0;
-}
-
-// Process mappings part
-
-static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-    uint_fast8_t i, j;
-
-    vc->mapping_count = get_bits(gb, 6)+1;
-    vc->mappings      = av_mallocz(vc->mapping_count * sizeof(vorbis_mapping));
-
-    AV_DEBUG(" There are %d mappings. \n", vc->mapping_count);
-
-    for (i = 0; i < vc->mapping_count; ++i) {
-        vorbis_mapping *mapping_setup = &vc->mappings[i];
-
-        if (get_bits(gb, 16)) {
-            av_log(vc->avccontext, AV_LOG_ERROR, "Other mappings than type 0 are not compliant with the Vorbis I specification. \n");
-            return -1;
-        }
-        if (get_bits1(gb)) {
-            mapping_setup->submaps = get_bits(gb, 4) + 1;
-        } else {
-            mapping_setup->submaps = 1;
-        }
-
-        if (get_bits1(gb)) {
-            mapping_setup->coupling_steps = get_bits(gb, 8) + 1;
-            mapping_setup->magnitude      = av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
-            mapping_setup->angle          = av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
-            for (j = 0; j < mapping_setup->coupling_steps; ++j) {
-                GET_VALIDATED_INDEX(mapping_setup->magnitude[j], ilog(vc->audio_channels - 1), vc->audio_channels)
-                GET_VALIDATED_INDEX(mapping_setup->angle[j],     ilog(vc->audio_channels - 1), vc->audio_channels)
-            }
-        } else {
-            mapping_setup->coupling_steps = 0;
-        }
-
-        AV_DEBUG("   %d mapping coupling steps: %d \n", i, mapping_setup->coupling_steps);
-
-        if (get_bits(gb, 2)) {
-            av_log(vc->avccontext, AV_LOG_ERROR, "%d. mapping setup data invalid. \n", i);
-            return -1; // following spec.
-        }
-
-        if (mapping_setup->submaps>1) {
-            mapping_setup->mux = av_mallocz(vc->audio_channels * sizeof(uint_fast8_t));
-            for (j = 0; j < vc->audio_channels; ++j)
-                mapping_setup->mux[j] = get_bits(gb, 4);
-        }
-
-        for (j = 0; j < mapping_setup->submaps; ++j) {
-            skip_bits(gb, 8); // FIXME check?
-            GET_VALIDATED_INDEX(mapping_setup->submap_floor[j],   8, vc->floor_count)
-            GET_VALIDATED_INDEX(mapping_setup->submap_residue[j], 8, vc->residue_count)
-
-            AV_DEBUG("   %d mapping %d submap : floor %d, residue %d \n", i, j, mapping_setup->submap_floor[j], mapping_setup->submap_residue[j]);
-        }
-    }
-    return 0;
-}
-
-// Process modes part
-
-static void create_map(vorbis_context *vc, uint_fast8_t floor_number)
-{
-    vorbis_floor *floors = vc->floors;
-    vorbis_floor0 *vf;
-    int idx;
-    int_fast8_t blockflag;
-    int_fast32_t *map;
-    int_fast32_t n; //TODO: could theoretically be smaller?
-
-    for (blockflag = 0; blockflag < 2; ++blockflag) {
-        n = vc->blocksize[blockflag] / 2;
-        floors[floor_number].data.t0.map[blockflag] =
-            av_malloc((n+1) * sizeof(int_fast32_t)); // n + sentinel
-
-        map =  floors[floor_number].data.t0.map[blockflag];
-        vf  = &floors[floor_number].data.t0;
-
-        for (idx = 0; idx < n; ++idx) {
-            map[idx] = floor(BARK((vf->rate * idx) / (2.0f * n)) *
-                             ((vf->bark_map_size) /
-                              BARK(vf->rate / 2.0f)));
-            if (vf->bark_map_size-1 < map[idx])
-                map[idx] = vf->bark_map_size - 1;
-        }
-        map[n] = -1;
-        vf->map_size[blockflag] = n;
-    }
-
-#   ifdef V_DEBUG
-    for (idx = 0; idx <= n; ++idx) {
-        AV_DEBUG("floor0 map: map at pos %d is %d\n",
-                 idx, map[idx]);
-    }
-#   endif
-}
-
-static int vorbis_parse_setup_hdr_modes(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-    uint_fast8_t i;
-
-    vc->mode_count = get_bits(gb, 6) + 1;
-    vc->modes      = av_mallocz(vc->mode_count * sizeof(vorbis_mode));
-
-    AV_DEBUG(" There are %d modes.\n", vc->mode_count);
-
-    for (i = 0; i < vc->mode_count; ++i) {
-        vorbis_mode *mode_setup = &vc->modes[i];
-
-        mode_setup->blockflag     = get_bits1(gb);
-        mode_setup->windowtype    = get_bits(gb, 16); //FIXME check
-        mode_setup->transformtype = get_bits(gb, 16); //FIXME check
-        GET_VALIDATED_INDEX(mode_setup->mapping, 8, vc->mapping_count);
-
-        AV_DEBUG(" %d mode: blockflag %d, windowtype %d, transformtype %d, mapping %d \n", i, mode_setup->blockflag, mode_setup->windowtype, mode_setup->transformtype, mode_setup->mapping);
-    }
-    return 0;
-}
-
-// Process the whole setup header using the functions above
-
-static int vorbis_parse_setup_hdr(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-
-    if ((get_bits(gb, 8) != 'v') || (get_bits(gb, 8) != 'o') ||
-        (get_bits(gb, 8) != 'r') || (get_bits(gb, 8) != 'b') ||
-        (get_bits(gb, 8) != 'i') || (get_bits(gb, 8) != 's')) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (no vorbis signature). \n");
-        return -1;
-    }
-
-    if (vorbis_parse_setup_hdr_codebooks(vc)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (codebooks). \n");
-        return -2;
-    }
-    if (vorbis_parse_setup_hdr_tdtransforms(vc)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (time domain transforms). \n");
-        return -3;
-    }
-    if (vorbis_parse_setup_hdr_floors(vc)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (floors). \n");
-        return -4;
-    }
-    if (vorbis_parse_setup_hdr_residues(vc)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (residues). \n");
-        return -5;
-    }
-    if (vorbis_parse_setup_hdr_mappings(vc)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (mappings). \n");
-        return -6;
-    }
-    if (vorbis_parse_setup_hdr_modes(vc)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (modes). \n");
-        return -7;
-    }
-    if (!get_bits1(gb)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis setup header packet corrupt (framing flag). \n");
-        return -8; // framing flag bit unset error
-    }
-
-    return 0;
-}
-
-// Process the identification header
-
-static int vorbis_parse_id_hdr(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-    uint_fast8_t bl0, bl1;
-
-    if ((get_bits(gb, 8) != 'v') || (get_bits(gb, 8) != 'o') ||
-        (get_bits(gb, 8) != 'r') || (get_bits(gb, 8) != 'b') ||
-        (get_bits(gb, 8) != 'i') || (get_bits(gb, 8) != 's')) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (no vorbis signature). \n");
-        return -1;
-    }
-
-    vc->version        = get_bits_long(gb, 32);    //FIXME check 0
-    vc->audio_channels = get_bits(gb, 8);
-    if (vc->audio_channels <= 0) {
-        av_log(vc->avccontext, AV_LOG_ERROR, "Invalid number of channels\n");
-        return -1;
-    }
-    vc->audio_samplerate = get_bits_long(gb, 32);
-    if (vc->audio_samplerate <= 0) {
-        av_log(vc->avccontext, AV_LOG_ERROR, "Invalid samplerate\n");
-        return -1;
-    }
-    vc->bitrate_maximum = get_bits_long(gb, 32);
-    vc->bitrate_nominal = get_bits_long(gb, 32);
-    vc->bitrate_minimum = get_bits_long(gb, 32);
-    bl0 = get_bits(gb, 4);
-    bl1 = get_bits(gb, 4);
-    vc->blocksize[0] = (1 << bl0);
-    vc->blocksize[1] = (1 << bl1);
-    if (bl0 > 13 || bl0 < 6 || bl1 > 13 || bl1 < 6 || bl1 < bl0) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (illegal blocksize). \n");
-        return -3;
-    }
-    // output format int16
-    if (vc->blocksize[1] / 2 * vc->audio_channels * 2 > AVCODEC_MAX_AUDIO_FRAME_SIZE) {
-        av_log(vc->avccontext, AV_LOG_ERROR, "Vorbis channel count makes "
-               "output packets too large.\n");
-        return -4;
-    }
-    vc->win[0] = ff_vorbis_vwin[bl0 - 6];
-    vc->win[1] = ff_vorbis_vwin[bl1 - 6];
-
-    if ((get_bits1(gb)) == 0) {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Vorbis id header packet corrupt (framing flag not set). \n");
-        return -2;
-    }
-
-    vc->channel_residues =  av_malloc((vc->blocksize[1]  / 2) * vc->audio_channels * sizeof(float));
-    vc->channel_floors   =  av_malloc((vc->blocksize[1]  / 2) * vc->audio_channels * sizeof(float));
-    vc->saved            =  av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(float));
-    vc->previous_window  = 0;
-
-    ff_mdct_init(&vc->mdct[0], bl0, 1, vc->exp_bias ? -(1 << 15) : -1.0);
-    ff_mdct_init(&vc->mdct[1], bl1, 1, vc->exp_bias ? -(1 << 15) : -1.0);
-
-    AV_DEBUG(" vorbis version %d \n audio_channels %d \n audio_samplerate %d \n bitrate_max %d \n bitrate_nom %d \n bitrate_min %d \n blk_0 %d blk_1 %d \n ",
-            vc->version, vc->audio_channels, vc->audio_samplerate, vc->bitrate_maximum, vc->bitrate_nominal, vc->bitrate_minimum, vc->blocksize[0], vc->blocksize[1]);
-
-/*
-    BLK = vc->blocksize[0];
-    for (i = 0; i < BLK / 2; ++i) {
-        vc->win[0][i] = sin(0.5*3.14159265358*(sin(((float)i + 0.5) / (float)BLK*3.14159265358))*(sin(((float)i + 0.5) / (float)BLK*3.14159265358)));
-    }
-*/
-
-    return 0;
-}
-
-// Process the extradata using the functions above (identification header, setup header)
-
-static av_cold int vorbis_decode_init(AVCodecContext *avccontext)
-{
-    vorbis_context *vc = avccontext->priv_data ;
-    uint8_t *headers   = avccontext->extradata;
-    int headers_len    = avccontext->extradata_size;
-    uint8_t *header_start[3];
-    int header_len[3];
-    GetBitContext *gb = &(vc->gb);
-    int hdr_type;
-
-    vc->avccontext = avccontext;
-    dsputil_init(&vc->dsp, avccontext);
-
-    if (vc->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        vc->add_bias = 385;
-        vc->exp_bias = 0;
-    } else {
-        vc->add_bias = 0;
-        vc->exp_bias = 15 << 23;
-    }
-
-    if (!headers_len) {
-        av_log(avccontext, AV_LOG_ERROR, "Extradata missing.\n");
-        return -1;
-    }
-
-    if (ff_split_xiph_headers(headers, headers_len, 30, header_start, header_len) < 0) {
-        av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n");
-        return -1;
-    }
-
-    init_get_bits(gb, header_start[0], header_len[0]*8);
-    hdr_type = get_bits(gb, 8);
-    if (hdr_type != 1) {
-        av_log(avccontext, AV_LOG_ERROR, "First header is not the id header.\n");
-        return -1;
-    }
-    if (vorbis_parse_id_hdr(vc)) {
-        av_log(avccontext, AV_LOG_ERROR, "Id header corrupt.\n");
-        vorbis_free(vc);
-        return -1;
-    }
-
-    init_get_bits(gb, header_start[2], header_len[2]*8);
-    hdr_type = get_bits(gb, 8);
-    if (hdr_type != 5) {
-        av_log(avccontext, AV_LOG_ERROR, "Third header is not the setup header.\n");
-        vorbis_free(vc);
-        return -1;
-    }
-    if (vorbis_parse_setup_hdr(vc)) {
-        av_log(avccontext, AV_LOG_ERROR, "Setup header corrupt.\n");
-        vorbis_free(vc);
-        return -1;
-    }
-
-    if (vc->audio_channels > 8)
-        avccontext->channel_layout = 0;
-    else
-        avccontext->channel_layout = ff_vorbis_channel_layouts[vc->audio_channels - 1];
-
-    avccontext->channels    = vc->audio_channels;
-    avccontext->sample_rate = vc->audio_samplerate;
-    avccontext->frame_size  = FFMIN(vc->blocksize[0], vc->blocksize[1]) >> 2;
-    avccontext->sample_fmt  = SAMPLE_FMT_S16;
-
-    return 0 ;
-}
-
-// Decode audiopackets -------------------------------------------------
-
-// Read and decode floor
-
-static int vorbis_floor0_decode(vorbis_context *vc,
-                                vorbis_floor_data *vfu, float *vec)
-{
-    vorbis_floor0 *vf = &vfu->t0;
-    float *lsp = vf->lsp;
-    uint_fast32_t amplitude;
-    uint_fast32_t book_idx;
-    uint_fast8_t blockflag = vc->modes[vc->mode_number].blockflag;
-
-    amplitude = get_bits(&vc->gb, vf->amplitude_bits);
-    if (amplitude > 0) {
-        float last = 0;
-        uint_fast16_t lsp_len = 0;
-        uint_fast16_t idx;
-        vorbis_codebook codebook;
-
-        book_idx = get_bits(&vc->gb, ilog(vf->num_books));
-        if (book_idx >= vf->num_books) {
-            av_log(vc->avccontext, AV_LOG_ERROR,
-                    "floor0 dec: booknumber too high!\n");
-            book_idx =  0;
-            //FIXME: look above
-        }
-        AV_DEBUG("floor0 dec: booknumber: %u\n", book_idx);
-        codebook = vc->codebooks[vf->book_list[book_idx]];
-        /* Invalid codebook! */
-        if (!codebook.codevectors)
-            return -1;
-
-        while (lsp_len<vf->order) {
-            int vec_off;
-
-            AV_DEBUG("floor0 dec: book dimension: %d\n", codebook.dimensions);
-            AV_DEBUG("floor0 dec: maximum depth: %d\n", codebook.maxdepth);
-            /* read temp vector */
-            vec_off = get_vlc2(&vc->gb, codebook.vlc.table,
-                               codebook.nb_bits, codebook.maxdepth)
-                      * codebook.dimensions;
-            AV_DEBUG("floor0 dec: vector offset: %d\n", vec_off);
-            /* copy each vector component and add last to it */
-            for (idx = 0; idx < codebook.dimensions; ++idx)
-                lsp[lsp_len+idx] = codebook.codevectors[vec_off+idx] + last;
-            last = lsp[lsp_len+idx-1]; /* set last to last vector component */
-
-            lsp_len += codebook.dimensions;
-        }
-#ifdef V_DEBUG
-        /* DEBUG: output lsp coeffs */
-        {
-            int idx;
-            for (idx = 0; idx < lsp_len; ++idx)
-                AV_DEBUG("floor0 dec: coeff at %d is %f\n", idx, lsp[idx]);
-        }
-#endif
-
-        /* synthesize floor output vector */
-        {
-            int i;
-            int order = vf->order;
-            float wstep = M_PI / vf->bark_map_size;
-
-            for (i = 0; i < order; i++)
-                lsp[i] = 2.0f * cos(lsp[i]);
-
-            AV_DEBUG("floor0 synth: map_size = %d; m = %d; wstep = %f\n",
-                     vf->map_size, order, wstep);
-
-            i = 0;
-            while (i < vf->map_size[blockflag]) {
-                int j, iter_cond = vf->map[blockflag][i];
-                float p = 0.5f;
-                float q = 0.5f;
-                float two_cos_w = 2.0f * cos(wstep * iter_cond); // needed all times
-
-                /* similar part for the q and p products */
-                for (j = 0; j + 1 < order; j += 2) {
-                    q *= lsp[j]     - two_cos_w;
-                    p *= lsp[j + 1] - two_cos_w;
-                }
-                if (j == order) { // even order
-                    p *= p * (2.0f - two_cos_w);
-                    q *= q * (2.0f + two_cos_w);
-                } else { // odd order
-                    q *= two_cos_w-lsp[j]; // one more time for q
-
-                    /* final step and square */
-                    p *= p * (4.f - two_cos_w * two_cos_w);
-                    q *= q;
-                }
-
-                /* calculate linear floor value */
-                {
-                    q = exp((((amplitude*vf->amplitude_offset) /
-                              (((1 << vf->amplitude_bits) - 1) * sqrt(p + q)))
-                             - vf->amplitude_offset) * .11512925f);
-                }
-
-                /* fill vector */
-                do {
-                    vec[i] = q; ++i;
-                } while (vf->map[blockflag][i] == iter_cond);
-            }
-        }
-    } else {
-        /* this channel is unused */
-        return 1;
-    }
-
-    AV_DEBUG(" Floor0 decoded\n");
-
-    return 0;
-}
-
-static int vorbis_floor1_decode(vorbis_context *vc,
-                                vorbis_floor_data *vfu, float *vec)
-{
-    vorbis_floor1 *vf = &vfu->t1;
-    GetBitContext *gb = &vc->gb;
-    uint_fast16_t range_v[4] = { 256, 128, 86, 64 };
-    uint_fast16_t range = range_v[vf->multiplier-1];
-    uint_fast16_t floor1_Y[vf->x_list_dim];
-    uint_fast16_t floor1_Y_final[vf->x_list_dim];
-    int floor1_flag[vf->x_list_dim];
-    uint_fast8_t class_;
-    uint_fast8_t cdim;
-    uint_fast8_t cbits;
-    uint_fast8_t csub;
-    uint_fast8_t cval;
-    int_fast16_t book;
-    uint_fast16_t offset;
-    uint_fast16_t i,j;
-    /*u*/int_fast16_t adx, ady, off, predicted; // WTF ? dy/adx =  (unsigned)dy/adx ?
-    int_fast16_t dy, err;
-
-
-    if (!get_bits1(gb)) // silence
-        return 1;
-
-// Read values (or differences) for the floor's points
-
-    floor1_Y[0] = get_bits(gb, ilog(range - 1));
-    floor1_Y[1] = get_bits(gb, ilog(range - 1));
-
-    AV_DEBUG("floor 0 Y %d floor 1 Y %d \n", floor1_Y[0], floor1_Y[1]);
-
-    offset = 2;
-    for (i = 0; i < vf->partitions; ++i) {
-        class_ = vf->partition_class[i];
-        cdim   = vf->class_dimensions[class_];
-        cbits  = vf->class_subclasses[class_];
-        csub = (1 << cbits) - 1;
-        cval = 0;
-
-        AV_DEBUG("Cbits %d \n", cbits);
-
-        if (cbits) // this reads all subclasses for this partition's class
-            cval = get_vlc2(gb, vc->codebooks[vf->class_masterbook[class_]].vlc.table,
-                            vc->codebooks[vf->class_masterbook[class_]].nb_bits, 3);
-
-        for (j = 0; j < cdim; ++j) {
-            book = vf->subclass_books[class_][cval & csub];
-
-            AV_DEBUG("book %d Cbits %d cval %d  bits:%d \n", book, cbits, cval, get_bits_count(gb));
-
-            cval = cval >> cbits;
-            if (book > -1) {
-                floor1_Y[offset+j] = get_vlc2(gb, vc->codebooks[book].vlc.table,
-                vc->codebooks[book].nb_bits, 3);
-            } else {
-                floor1_Y[offset+j] = 0;
-            }
-
-            AV_DEBUG(" floor(%d) = %d \n", vf->list[offset+j].x, floor1_Y[offset+j]);
-        }
-        offset+=cdim;
-    }
-
-// Amplitude calculation from the differences
-
-    floor1_flag[0] = 1;
-    floor1_flag[1] = 1;
-    floor1_Y_final[0] = floor1_Y[0];
-    floor1_Y_final[1] = floor1_Y[1];
-
-    for (i = 2; i < vf->x_list_dim; ++i) {
-        uint_fast16_t val, highroom, lowroom, room;
-        uint_fast16_t high_neigh_offs;
-        uint_fast16_t low_neigh_offs;
-
-        low_neigh_offs  = vf->list[i].low;
-        high_neigh_offs = vf->list[i].high;
-        dy  = floor1_Y_final[high_neigh_offs] - floor1_Y_final[low_neigh_offs];  // render_point begin
-        adx = vf->list[high_neigh_offs].x - vf->list[low_neigh_offs].x;
-        ady = FFABS(dy);
-        err = ady * (vf->list[i].x - vf->list[low_neigh_offs].x);
-        off = (int16_t)err / (int16_t)adx;
-        if (dy < 0) {
-            predicted = floor1_Y_final[low_neigh_offs] - off;
-        } else {
-            predicted = floor1_Y_final[low_neigh_offs] + off;
-        } // render_point end
-
-        val = floor1_Y[i];
-        highroom = range-predicted;
-        lowroom  = predicted;
-        if (highroom < lowroom) {
-            room = highroom * 2;
-        } else {
-            room = lowroom * 2;   // SPEC mispelling
-        }
-        if (val) {
-            floor1_flag[low_neigh_offs]  = 1;
-            floor1_flag[high_neigh_offs] = 1;
-            floor1_flag[i]               = 1;
-            if (val >= room) {
-                if (highroom > lowroom) {
-                    floor1_Y_final[i] = val - lowroom + predicted;
-                } else {
-                    floor1_Y_final[i] = predicted - val + highroom - 1;
-                }
-            } else {
-                if (val & 1) {
-                    floor1_Y_final[i] = predicted - (val + 1) / 2;
-                } else {
-                    floor1_Y_final[i] = predicted + val / 2;
-                }
-            }
-        } else {
-            floor1_flag[i]    = 0;
-            floor1_Y_final[i] = predicted;
-        }
-
-        AV_DEBUG(" Decoded floor(%d) = %d / val %d \n", vf->list[i].x, floor1_Y_final[i], val);
-    }
-
-// Curve synth - connect the calculated dots and convert from dB scale FIXME optimize ?
-
-    ff_vorbis_floor1_render_list(vf->list, vf->x_list_dim, floor1_Y_final, floor1_flag, vf->multiplier, vec, vf->list[1].x);
-
-    AV_DEBUG(" Floor decoded\n");
-
-    return 0;
-}
-
-// Read and decode residue
-
-static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
-                                                           vorbis_residue *vr,
-                                                           uint_fast8_t ch,
-                                                           uint_fast8_t *do_not_decode,
-                                                           float *vec,
-                                                           uint_fast16_t vlen,
-                                                           int vr_type)
-{
-    GetBitContext *gb = &vc->gb;
-    uint_fast8_t c_p_c = vc->codebooks[vr->classbook].dimensions;
-    uint_fast16_t n_to_read = vr->end-vr->begin;
-    uint_fast16_t ptns_to_read = n_to_read/vr->partition_size;
-    uint_fast8_t classifs[ptns_to_read*vc->audio_channels];
-    uint_fast8_t pass;
-    uint_fast8_t ch_used;
-    uint_fast8_t i,j,l;
-    uint_fast16_t k;
-
-    if (vr_type == 2) {
-        for (j = 1; j < ch; ++j)
-            do_not_decode[0] &= do_not_decode[j];  // FIXME - clobbering input
-        if (do_not_decode[0])
-            return 0;
-        ch_used = 1;
-    } else {
-        ch_used = ch;
-    }
-
-    AV_DEBUG(" residue type 0/1/2 decode begin, ch: %d  cpc %d  \n", ch, c_p_c);
-
-    for (pass = 0; pass <= vr->maxpass; ++pass) { // FIXME OPTIMIZE?
-        uint_fast16_t voffset;
-        uint_fast16_t partition_count;
-        uint_fast16_t j_times_ptns_to_read;
-
-        voffset = vr->begin;
-        for (partition_count = 0; partition_count < ptns_to_read;) {  // SPEC        error
-            if (!pass) {
-                uint_fast32_t inverse_class = ff_inverse[vr->classifications];
-                for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) {
-                    if (!do_not_decode[j]) {
-                        uint_fast32_t temp = get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table,
-                        vc->codebooks[vr->classbook].nb_bits, 3);
-
-                        AV_DEBUG("Classword: %d \n", temp);
-
-                        assert(vr->classifications > 1 && temp <= 65536); //needed for inverse[]
-                        for (i = 0; i < c_p_c; ++i) {
-                            uint_fast32_t temp2;
-
-                            temp2 = (((uint_fast64_t)temp) * inverse_class) >> 32;
-                            if (partition_count + c_p_c - 1 - i < ptns_to_read)
-                                classifs[j_times_ptns_to_read + partition_count + c_p_c - 1 - i] = temp - temp2 * vr->classifications;
-                            temp = temp2;
-                        }
-                    }
-                    j_times_ptns_to_read += ptns_to_read;
-                }
-            }
-            for (i = 0; (i < c_p_c) && (partition_count < ptns_to_read); ++i) {
-                for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) {
-                    uint_fast16_t voffs;
-
-                    if (!do_not_decode[j]) {
-                        uint_fast8_t vqclass = classifs[j_times_ptns_to_read+partition_count];
-                        int_fast16_t vqbook = vr->books[vqclass][pass];
-
-                        if (vqbook >= 0 && vc->codebooks[vqbook].codevectors) {
-                            uint_fast16_t coffs;
-                            unsigned dim =  vc->codebooks[vqbook].dimensions; // not uint_fast8_t: 64bit is slower here on amd64
-                            uint_fast16_t step = dim == 1 ? vr->partition_size
-                                                          : FASTDIV(vr->partition_size, dim);
-                            vorbis_codebook codebook = vc->codebooks[vqbook];
-
-                            if (vr_type == 0) {
-
-                                voffs = voffset+j*vlen;
-                                for (k = 0; k < step; ++k) {
-                                    coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
-                                    for (l = 0; l < dim; ++l)
-                                        vec[voffs + k + l * step] += codebook.codevectors[coffs + l];  // FPMATH
-                                }
-                            } else if (vr_type == 1) {
-                                voffs = voffset + j * vlen;
-                                for (k = 0; k < step; ++k) {
-                                    coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
-                                    for (l = 0; l < dim; ++l, ++voffs) {
-                                        vec[voffs]+=codebook.codevectors[coffs+l];  // FPMATH
-
-                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d  \n", pass, voffs, vec[voffs], codebook.codevectors[coffs+l], coffs);
-                                    }
-                                }
-                            } else if (vr_type == 2 && ch == 2 && (voffset & 1) == 0 && (dim & 1) == 0) { // most frequent case optimized
-                                voffs = voffset >> 1;
-
-                                if (dim == 2) {
-                                    for (k = 0; k < step; ++k) {
-                                        coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 2;
-                                        vec[voffs + k       ] += codebook.codevectors[coffs    ];  // FPMATH
-                                        vec[voffs + k + vlen] += codebook.codevectors[coffs + 1];  // FPMATH
-                                    }
-                                } else if (dim == 4) {
-                                    for (k = 0; k < step; ++k, voffs += 2) {
-                                        coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * 4;
-                                        vec[voffs           ] += codebook.codevectors[coffs    ];  // FPMATH
-                                        vec[voffs + 1       ] += codebook.codevectors[coffs + 2];  // FPMATH
-                                        vec[voffs + vlen    ] += codebook.codevectors[coffs + 1];  // FPMATH
-                                        vec[voffs + vlen + 1] += codebook.codevectors[coffs + 3];  // FPMATH
-                                    }
-                                } else
-                                for (k = 0; k < step; ++k) {
-                                    coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
-                                    for (l = 0; l < dim; l += 2, voffs++) {
-                                        vec[voffs       ] += codebook.codevectors[coffs + l    ];  // FPMATH
-                                        vec[voffs + vlen] += codebook.codevectors[coffs + l + 1];  // FPMATH
-
-                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l);
-                                    }
-                                }
-
-                            } else if (vr_type == 2) {
-                                voffs = voffset;
-
-                                for (k = 0; k < step; ++k) {
-                                    coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
-                                    for (l = 0; l < dim; ++l, ++voffs) {
-                                        vec[voffs / ch + (voffs % ch) * vlen] += codebook.codevectors[coffs + l];  // FPMATH FIXME use if and counter instead of / and %
-
-                                        AV_DEBUG(" pass %d offs: %d curr: %f change: %f cv offs.: %d+%d  \n", pass, voffset / ch + (voffs % ch) * vlen, vec[voffset / ch + (voffs % ch) * vlen], codebook.codevectors[coffs + l], coffs, l);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    j_times_ptns_to_read += ptns_to_read;
-                }
-                ++partition_count;
-                voffset += vr->partition_size;
-            }
-        }
-    }
-    return 0;
-}
-
-static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
-                                        uint_fast8_t ch,
-                                        uint_fast8_t *do_not_decode,
-                                        float *vec, uint_fast16_t vlen)
-{
-    if (vr->type == 2)
-        return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 2);
-    else if (vr->type == 1)
-        return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 1);
-    else if (vr->type == 0)
-        return vorbis_residue_decode_internal(vc, vr, ch, do_not_decode, vec, vlen, 0);
-    else {
-        av_log(vc->avccontext, AV_LOG_ERROR, " Invalid residue type while residue decode?! \n");
-        return -1;
-    }
-}
-
-void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
-{
-    int i;
-    for (i = 0;  i < blocksize;  i++) {
-        if (mag[i] > 0.0) {
-            if (ang[i] > 0.0) {
-                ang[i] = mag[i] - ang[i];
-            } else {
-                float temp = ang[i];
-                ang[i]     = mag[i];
-                mag[i]    += temp;
-            }
-        } else {
-            if (ang[i] > 0.0) {
-                ang[i] += mag[i];
-            } else {
-                float temp = ang[i];
-                ang[i]     = mag[i];
-                mag[i]    -= temp;
-            }
-        }
-    }
-}
-
-static void copy_normalize(float *dst, float *src, int len, int exp_bias,
-                           float add_bias)
-{
-    int i;
-    if (exp_bias) {
-        memcpy(dst, src, len * sizeof(float));
-    } else {
-        for (i = 0; i < len; i++)
-            dst[i] = src[i] + add_bias;
-    }
-}
-
-// Decode the audio packet using the functions above
-
-static int vorbis_parse_audio_packet(vorbis_context *vc)
-{
-    GetBitContext *gb = &vc->gb;
-
-    uint_fast8_t previous_window = vc->previous_window;
-    uint_fast8_t mode_number;
-    uint_fast8_t blockflag;
-    uint_fast16_t blocksize;
-    int_fast32_t i,j;
-    uint_fast8_t no_residue[vc->audio_channels];
-    uint_fast8_t do_not_decode[vc->audio_channels];
-    vorbis_mapping *mapping;
-    float *ch_res_ptr   = vc->channel_residues;
-    float *ch_floor_ptr = vc->channel_floors;
-    uint_fast8_t res_chan[vc->audio_channels];
-    uint_fast8_t res_num = 0;
-    int_fast16_t retlen  = 0;
-    float fadd_bias = vc->add_bias;
-
-    if (get_bits1(gb)) {
-        av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n");
-        return -1; // packet type not audio
-    }
-
-    if (vc->mode_count == 1) {
-        mode_number = 0;
-    } else {
-        GET_VALIDATED_INDEX(mode_number, ilog(vc->mode_count-1), vc->mode_count)
-    }
-    vc->mode_number = mode_number;
-    mapping = &vc->mappings[vc->modes[mode_number].mapping];
-
-    AV_DEBUG(" Mode number: %d , mapping: %d , blocktype %d \n", mode_number, vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag);
-
-    blockflag = vc->modes[mode_number].blockflag;
-    blocksize = vc->blocksize[blockflag];
-    if (blockflag)
-        skip_bits(gb, 2); // previous_window, next_window
-
-    memset(ch_res_ptr,   0, sizeof(float) * vc->audio_channels * blocksize / 2); //FIXME can this be removed ?
-    memset(ch_floor_ptr, 0, sizeof(float) * vc->audio_channels * blocksize / 2); //FIXME can this be removed ?
-
-// Decode floor
-
-    for (i = 0; i < vc->audio_channels; ++i) {
-        vorbis_floor *floor;
-        int ret;
-        if (mapping->submaps > 1) {
-            floor = &vc->floors[mapping->submap_floor[mapping->mux[i]]];
-        } else {
-            floor = &vc->floors[mapping->submap_floor[0]];
-        }
-
-        ret = floor->decode(vc, &floor->data, ch_floor_ptr);
-
-        if (ret < 0) {
-            av_log(vc->avccontext, AV_LOG_ERROR, "Invalid codebook in vorbis_floor_decode.\n");
-            return -1;
-        }
-        no_residue[i] = ret;
-        ch_floor_ptr += blocksize / 2;
-    }
-
-// Nonzero vector propagate
-
-    for (i = mapping->coupling_steps - 1; i >= 0; --i) {
-        if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) {
-            no_residue[mapping->magnitude[i]] = 0;
-            no_residue[mapping->angle[i]]     = 0;
-        }
-    }
-
-// Decode residue
-
-    for (i = 0; i < mapping->submaps; ++i) {
-        vorbis_residue *residue;
-        uint_fast8_t ch = 0;
-
-        for (j = 0; j < vc->audio_channels; ++j) {
-            if ((mapping->submaps == 1) || (i == mapping->mux[j])) {
-                res_chan[j] = res_num;
-                if (no_residue[j]) {
-                    do_not_decode[ch] = 1;
-                } else {
-                    do_not_decode[ch] = 0;
-                }
-                ++ch;
-                ++res_num;
-            }
-        }
-        residue = &vc->residues[mapping->submap_residue[i]];
-        vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2);
-
-        ch_res_ptr += ch * blocksize / 2;
-    }
-
-// Inverse coupling
-
-    for (i = mapping->coupling_steps - 1; i >= 0; --i) { //warning: i has to be signed
-        float *mag, *ang;
-
-        mag = vc->channel_residues+res_chan[mapping->magnitude[i]] * blocksize / 2;
-        ang = vc->channel_residues+res_chan[mapping->angle[i]]     * blocksize / 2;
-        vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize / 2);
-    }
-
-// Dotproduct, MDCT
-
-    for (j = vc->audio_channels-1;j >= 0; j--) {
-        ch_floor_ptr = vc->channel_floors   + j           * blocksize / 2;
-        ch_res_ptr   = vc->channel_residues + res_chan[j] * blocksize / 2;
-        vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize / 2);
-        ff_imdct_half(&vc->mdct[blockflag], ch_res_ptr, ch_floor_ptr);
-    }
-
-// Overlap/add, save data for next overlapping  FPMATH
-
-    retlen = (blocksize + vc->blocksize[previous_window]) / 4;
-    for (j = 0; j < vc->audio_channels; j++) {
-        uint_fast16_t bs0 = vc->blocksize[0];
-        uint_fast16_t bs1 = vc->blocksize[1];
-        float *residue    = vc->channel_residues + res_chan[j] * blocksize / 2;
-        float *saved      = vc->saved + j * bs1 / 4;
-        float *ret        = vc->channel_floors + j * retlen;
-        float *buf        = residue;
-        const float *win  = vc->win[blockflag & previous_window];
-
-        if (blockflag == previous_window) {
-            vc->dsp.vector_fmul_window(ret, saved, buf, win, fadd_bias, blocksize / 4);
-        } else if (blockflag > previous_window) {
-            vc->dsp.vector_fmul_window(ret, saved, buf, win, fadd_bias, bs0 / 4);
-            copy_normalize(ret+bs0/2, buf+bs0/4, (bs1-bs0)/4, vc->exp_bias, fadd_bias);
-        } else {
-            copy_normalize(ret, saved, (bs1 - bs0) / 4, vc->exp_bias, fadd_bias);
-            vc->dsp.vector_fmul_window(ret + (bs1 - bs0) / 4, saved + (bs1 - bs0) / 4, buf, win, fadd_bias, bs0 / 4);
-        }
-        memcpy(saved, buf + blocksize / 4, blocksize / 4 * sizeof(float));
-    }
-
-    vc->previous_window = blockflag;
-    return retlen;
-}
-
-// Return the decoded audio packet through the standard api
-
-static int vorbis_decode_frame(AVCodecContext *avccontext,
-                               void *data, int *data_size,
-                               AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    vorbis_context *vc = avccontext->priv_data ;
-    GetBitContext *gb = &(vc->gb);
-    const float *channel_ptrs[vc->audio_channels];
-    int i;
-
-    int_fast16_t len;
-
-    if (!buf_size)
-        return 0;
-
-    AV_DEBUG("packet length %d \n", buf_size);
-
-    init_get_bits(gb, buf, buf_size*8);
-
-    len = vorbis_parse_audio_packet(vc);
-
-    if (len <= 0) {
-        *data_size = 0;
-        return buf_size;
-    }
-
-    if (!vc->first_frame) {
-        vc->first_frame = 1;
-        *data_size = 0;
-        return buf_size ;
-    }
-
-    AV_DEBUG("parsed %d bytes %d bits, returned %d samples (*ch*bits) \n", get_bits_count(gb)/8, get_bits_count(gb)%8, len);
-
-    if (vc->audio_channels > 8) {
-        for (i = 0; i < vc->audio_channels; i++)
-            channel_ptrs[i] = vc->channel_floors + i * len;
-    } else {
-        for (i = 0; i < vc->audio_channels; i++)
-            channel_ptrs[i] = vc->channel_floors +
-                              len * ff_vorbis_channel_layout_offsets[vc->audio_channels - 1][i];
-    }
-
-    vc->dsp.float_to_int16_interleave(data, channel_ptrs, len, vc->audio_channels);
-    *data_size = len * 2 * vc->audio_channels;
-
-    return buf_size ;
-}
-
-// Close decoder
-
-static av_cold int vorbis_decode_close(AVCodecContext *avccontext)
-{
-    vorbis_context *vc = avccontext->priv_data;
-
-    vorbis_free(vc);
-
-    return 0 ;
-}
-
-AVCodec vorbis_decoder = {
-    "vorbis",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_VORBIS,
-    sizeof(vorbis_context),
-    vorbis_decode_init,
-    NULL,
-    vorbis_decode_close,
-    vorbis_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
-    .channel_layouts = ff_vorbis_channel_layouts,
-};
-
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c
deleted file mode 100644
index 934463d..0000000
--- a/libavcodec/vorbis_enc.c
+++ /dev/null
@@ -1,1105 +0,0 @@
-/*
- * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Native Vorbis encoder.
- * @author Oded Shimon <ods15 at ods15.dyndns.org>
- */
-
-#include <float.h>
-#include "avcodec.h"
-#include "dsputil.h"
-#include "fft.h"
-#include "vorbis.h"
-#include "vorbis_enc_data.h"
-
-#define BITSTREAM_WRITER_LE
-#include "put_bits.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-typedef struct {
-    int nentries;
-    uint8_t *lens;
-    uint32_t *codewords;
-    int ndimentions;
-    float min;
-    float delta;
-    int seq_p;
-    int lookup;
-    int *quantlist;
-    float *dimentions;
-    float *pow2;
-} vorbis_enc_codebook;
-
-typedef struct {
-    int dim;
-    int subclass;
-    int masterbook;
-    int *books;
-} vorbis_enc_floor_class;
-
-typedef struct {
-    int partitions;
-    int *partition_to_class;
-    int nclasses;
-    vorbis_enc_floor_class *classes;
-    int multiplier;
-    int rangebits;
-    int values;
-    vorbis_floor1_entry *list;
-} vorbis_enc_floor;
-
-typedef struct {
-    int type;
-    int begin;
-    int end;
-    int partition_size;
-    int classifications;
-    int classbook;
-    int8_t (*books)[8];
-    float (*maxes)[2];
-} vorbis_enc_residue;
-
-typedef struct {
-    int submaps;
-    int *mux;
-    int *floor;
-    int *residue;
-    int coupling_steps;
-    int *magnitude;
-    int *angle;
-} vorbis_enc_mapping;
-
-typedef struct {
-    int blockflag;
-    int mapping;
-} vorbis_enc_mode;
-
-typedef struct {
-    int channels;
-    int sample_rate;
-    int log2_blocksize[2];
-    FFTContext mdct[2];
-    const float *win[2];
-    int have_saved;
-    float *saved;
-    float *samples;
-    float *floor;  // also used for tmp values for mdct
-    float *coeffs; // also used for residue after floor
-    float quality;
-
-    int ncodebooks;
-    vorbis_enc_codebook *codebooks;
-
-    int nfloors;
-    vorbis_enc_floor *floors;
-
-    int nresidues;
-    vorbis_enc_residue *residues;
-
-    int nmappings;
-    vorbis_enc_mapping *mappings;
-
-    int nmodes;
-    vorbis_enc_mode *modes;
-
-    int64_t sample_count;
-} vorbis_enc_context;
-
-static inline void put_codeword(PutBitContext *pb, vorbis_enc_codebook *cb,
-                                int entry)
-{
-    assert(entry >= 0);
-    assert(entry < cb->nentries);
-    assert(cb->lens[entry]);
-    put_bits(pb, cb->lens[entry], cb->codewords[entry]);
-}
-
-static int cb_lookup_vals(int lookup, int dimentions, int entries)
-{
-    if (lookup == 1)
-        return ff_vorbis_nth_root(entries, dimentions);
-    else if (lookup == 2)
-        return dimentions *entries;
-    return 0;
-}
-
-static void ready_codebook(vorbis_enc_codebook *cb)
-{
-    int i;
-
-    ff_vorbis_len2vlc(cb->lens, cb->codewords, cb->nentries);
-
-    if (!cb->lookup) {
-        cb->pow2 = cb->dimentions = NULL;
-    } else {
-        int vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
-        cb->dimentions = av_malloc(sizeof(float) * cb->nentries * cb->ndimentions);
-        cb->pow2 = av_mallocz(sizeof(float) * cb->nentries);
-        for (i = 0; i < cb->nentries; i++) {
-            float last = 0;
-            int j;
-            int div = 1;
-            for (j = 0; j < cb->ndimentions; j++) {
-                int off;
-                if (cb->lookup == 1)
-                    off = (i / div) % vals; // lookup type 1
-                else
-                    off = i * cb->ndimentions + j; // lookup type 2
-
-                cb->dimentions[i * cb->ndimentions + j] = last + cb->min + cb->quantlist[off] * cb->delta;
-                if (cb->seq_p)
-                    last = cb->dimentions[i * cb->ndimentions + j];
-                cb->pow2[i] += cb->dimentions[i * cb->ndimentions + j] * cb->dimentions[i * cb->ndimentions + j];
-                div *= vals;
-            }
-            cb->pow2[i] /= 2.;
-        }
-    }
-}
-
-static void ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
-{
-    int i;
-    assert(rc->type == 2);
-    rc->maxes = av_mallocz(sizeof(float[2]) * rc->classifications);
-    for (i = 0; i < rc->classifications; i++) {
-        int j;
-        vorbis_enc_codebook * cb;
-        for (j = 0; j < 8; j++)
-            if (rc->books[i][j] != -1)
-                break;
-        if (j == 8) // zero
-            continue;
-        cb = &venc->codebooks[rc->books[i][j]];
-        assert(cb->ndimentions >= 2);
-        assert(cb->lookup);
-
-        for (j = 0; j < cb->nentries; j++) {
-            float a;
-            if (!cb->lens[j])
-                continue;
-            a = fabs(cb->dimentions[j * cb->ndimentions]);
-            if (a > rc->maxes[i][0])
-                rc->maxes[i][0] = a;
-            a = fabs(cb->dimentions[j * cb->ndimentions + 1]);
-            if (a > rc->maxes[i][1])
-                rc->maxes[i][1] = a;
-        }
-    }
-    // small bias
-    for (i = 0; i < rc->classifications; i++) {
-        rc->maxes[i][0] += 0.8;
-        rc->maxes[i][1] += 0.8;
-    }
-}
-
-static void create_vorbis_context(vorbis_enc_context *venc,
-                                  AVCodecContext *avccontext)
-{
-    vorbis_enc_floor   *fc;
-    vorbis_enc_residue *rc;
-    vorbis_enc_mapping *mc;
-    int i, book;
-
-    venc->channels    = avccontext->channels;
-    venc->sample_rate = avccontext->sample_rate;
-    venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11;
-
-    venc->ncodebooks = FF_ARRAY_ELEMS(cvectors);
-    venc->codebooks  = av_malloc(sizeof(vorbis_enc_codebook) * venc->ncodebooks);
-
-    // codebook 0..14 - floor1 book, values 0..255
-    // codebook 15 residue masterbook
-    // codebook 16..29 residue
-    for (book = 0; book < venc->ncodebooks; book++) {
-        vorbis_enc_codebook *cb = &venc->codebooks[book];
-        int vals;
-        cb->ndimentions = cvectors[book].dim;
-        cb->nentries    = cvectors[book].real_len;
-        cb->min         = cvectors[book].min;
-        cb->delta       = cvectors[book].delta;
-        cb->lookup      = cvectors[book].lookup;
-        cb->seq_p       = 0;
-
-        cb->lens      = av_malloc(sizeof(uint8_t)  * cb->nentries);
-        cb->codewords = av_malloc(sizeof(uint32_t) * cb->nentries);
-        memcpy(cb->lens, cvectors[book].clens, cvectors[book].len);
-        memset(cb->lens + cvectors[book].len, 0, cb->nentries - cvectors[book].len);
-
-        if (cb->lookup) {
-            vals = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
-            cb->quantlist = av_malloc(sizeof(int) * vals);
-            for (i = 0; i < vals; i++)
-                cb->quantlist[i] = cvectors[book].quant[i];
-        } else {
-            cb->quantlist = NULL;
-        }
-        ready_codebook(cb);
-    }
-
-    venc->nfloors = 1;
-    venc->floors  = av_malloc(sizeof(vorbis_enc_floor) * venc->nfloors);
-
-    // just 1 floor
-    fc = &venc->floors[0];
-    fc->partitions         = 8;
-    fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions);
-    fc->nclasses           = 0;
-    for (i = 0; i < fc->partitions; i++) {
-        static const int a[] = {0, 1, 2, 2, 3, 3, 4, 4};
-        fc->partition_to_class[i] = a[i];
-        fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[i]);
-    }
-    fc->nclasses++;
-    fc->classes = av_malloc(sizeof(vorbis_enc_floor_class) * fc->nclasses);
-    for (i = 0; i < fc->nclasses; i++) {
-        vorbis_enc_floor_class * c = &fc->classes[i];
-        int j, books;
-        c->dim        = floor_classes[i].dim;
-        c->subclass   = floor_classes[i].subclass;
-        c->masterbook = floor_classes[i].masterbook;
-        books         = (1 << c->subclass);
-        c->books      = av_malloc(sizeof(int) * books);
-        for (j = 0; j < books; j++)
-            c->books[j] = floor_classes[i].nbooks[j];
-    }
-    fc->multiplier = 2;
-    fc->rangebits  = venc->log2_blocksize[0] - 1;
-
-    fc->values = 2;
-    for (i = 0; i < fc->partitions; i++)
-        fc->values += fc->classes[fc->partition_to_class[i]].dim;
-
-    fc->list = av_malloc(sizeof(vorbis_floor1_entry) * fc->values);
-    fc->list[0].x = 0;
-    fc->list[1].x = 1 << fc->rangebits;
-    for (i = 2; i < fc->values; i++) {
-        static const int a[] = {
-             93, 23,372,  6, 46,186,750, 14, 33, 65,
-            130,260,556,  3, 10, 18, 28, 39, 55, 79,
-            111,158,220,312,464,650,850
-        };
-        fc->list[i].x = a[i - 2];
-    }
-    ff_vorbis_ready_floor1_list(fc->list, fc->values);
-
-    venc->nresidues = 1;
-    venc->residues  = av_malloc(sizeof(vorbis_enc_residue) * venc->nresidues);
-
-    // single residue
-    rc = &venc->residues[0];
-    rc->type            = 2;
-    rc->begin           = 0;
-    rc->end             = 1600;
-    rc->partition_size  = 32;
-    rc->classifications = 10;
-    rc->classbook       = 15;
-    rc->books           = av_malloc(sizeof(*rc->books) * rc->classifications);
-    {
-        static const int8_t a[10][8] = {
-            { -1, -1, -1, -1, -1, -1, -1, -1, },
-            { -1, -1, 16, -1, -1, -1, -1, -1, },
-            { -1, -1, 17, -1, -1, -1, -1, -1, },
-            { -1, -1, 18, -1, -1, -1, -1, -1, },
-            { -1, -1, 19, -1, -1, -1, -1, -1, },
-            { -1, -1, 20, -1, -1, -1, -1, -1, },
-            { -1, -1, 21, -1, -1, -1, -1, -1, },
-            { 22, 23, -1, -1, -1, -1, -1, -1, },
-            { 24, 25, -1, -1, -1, -1, -1, -1, },
-            { 26, 27, 28, -1, -1, -1, -1, -1, },
-        };
-        memcpy(rc->books, a, sizeof a);
-    }
-    ready_residue(rc, venc);
-
-    venc->nmappings = 1;
-    venc->mappings  = av_malloc(sizeof(vorbis_enc_mapping) * venc->nmappings);
-
-    // single mapping
-    mc = &venc->mappings[0];
-    mc->submaps = 1;
-    mc->mux     = av_malloc(sizeof(int) * venc->channels);
-    for (i = 0; i < venc->channels; i++)
-        mc->mux[i] = 0;
-    mc->floor   = av_malloc(sizeof(int) * mc->submaps);
-    mc->residue = av_malloc(sizeof(int) * mc->submaps);
-    for (i = 0; i < mc->submaps; i++) {
-        mc->floor[i]   = 0;
-        mc->residue[i] = 0;
-    }
-    mc->coupling_steps = venc->channels == 2 ? 1 : 0;
-    mc->magnitude      = av_malloc(sizeof(int) * mc->coupling_steps);
-    mc->angle          = av_malloc(sizeof(int) * mc->coupling_steps);
-    if (mc->coupling_steps) {
-        mc->magnitude[0] = 0;
-        mc->angle[0]     = 1;
-    }
-
-    venc->nmodes = 1;
-    venc->modes  = av_malloc(sizeof(vorbis_enc_mode) * venc->nmodes);
-
-    // single mode
-    venc->modes[0].blockflag = 0;
-    venc->modes[0].mapping   = 0;
-
-    venc->have_saved = 0;
-    venc->saved      = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);
-    venc->samples    = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]));
-    venc->floor      = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);
-    venc->coeffs     = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);
-
-    venc->win[0] = ff_vorbis_vwin[venc->log2_blocksize[0] - 6];
-    venc->win[1] = ff_vorbis_vwin[venc->log2_blocksize[1] - 6];
-
-    ff_mdct_init(&venc->mdct[0], venc->log2_blocksize[0], 0, 1.0);
-    ff_mdct_init(&venc->mdct[1], venc->log2_blocksize[1], 0, 1.0);
-}
-
-static void put_float(PutBitContext *pb, float f)
-{
-    int exp, mant;
-    uint32_t res = 0;
-    mant = (int)ldexp(frexp(f, &exp), 20);
-    exp += 788 - 20;
-    if (mant < 0) {
-        res |= (1 << 31);
-        mant = -mant;
-    }
-    res |= mant | (exp << 21);
-    put_bits32(pb, res);
-}
-
-static void put_codebook_header(PutBitContext *pb, vorbis_enc_codebook *cb)
-{
-    int i;
-    int ordered = 0;
-
-    put_bits(pb, 24, 0x564342); //magic
-    put_bits(pb, 16, cb->ndimentions);
-    put_bits(pb, 24, cb->nentries);
-
-    for (i = 1; i < cb->nentries; i++)
-        if (cb->lens[i] < cb->lens[i-1])
-            break;
-    if (i == cb->nentries)
-        ordered = 1;
-
-    put_bits(pb, 1, ordered);
-    if (ordered) {
-        int len = cb->lens[0];
-        put_bits(pb, 5, len - 1);
-        i = 0;
-        while (i < cb->nentries) {
-            int j;
-            for (j = 0; j+i < cb->nentries; j++)
-                if (cb->lens[j+i] != len)
-                    break;
-            put_bits(pb, ilog(cb->nentries - i), j);
-            i += j;
-            len++;
-        }
-    } else {
-        int sparse = 0;
-        for (i = 0; i < cb->nentries; i++)
-            if (!cb->lens[i])
-                break;
-        if (i != cb->nentries)
-            sparse = 1;
-        put_bits(pb, 1, sparse);
-
-        for (i = 0; i < cb->nentries; i++) {
-            if (sparse)
-                put_bits(pb, 1, !!cb->lens[i]);
-            if (cb->lens[i])
-                put_bits(pb, 5, cb->lens[i] - 1);
-        }
-    }
-
-    put_bits(pb, 4, cb->lookup);
-    if (cb->lookup) {
-        int tmp  = cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries);
-        int bits = ilog(cb->quantlist[0]);
-
-        for (i = 1; i < tmp; i++)
-            bits = FFMAX(bits, ilog(cb->quantlist[i]));
-
-        put_float(pb, cb->min);
-        put_float(pb, cb->delta);
-
-        put_bits(pb, 4, bits - 1);
-        put_bits(pb, 1, cb->seq_p);
-
-        for (i = 0; i < tmp; i++)
-            put_bits(pb, bits, cb->quantlist[i]);
-    }
-}
-
-static void put_floor_header(PutBitContext *pb, vorbis_enc_floor *fc)
-{
-    int i;
-
-    put_bits(pb, 16, 1); // type, only floor1 is supported
-
-    put_bits(pb, 5, fc->partitions);
-
-    for (i = 0; i < fc->partitions; i++)
-        put_bits(pb, 4, fc->partition_to_class[i]);
-
-    for (i = 0; i < fc->nclasses; i++) {
-        int j, books;
-
-        put_bits(pb, 3, fc->classes[i].dim - 1);
-        put_bits(pb, 2, fc->classes[i].subclass);
-
-        if (fc->classes[i].subclass)
-            put_bits(pb, 8, fc->classes[i].masterbook);
-
-        books = (1 << fc->classes[i].subclass);
-
-        for (j = 0; j < books; j++)
-            put_bits(pb, 8, fc->classes[i].books[j] + 1);
-    }
-
-    put_bits(pb, 2, fc->multiplier - 1);
-    put_bits(pb, 4, fc->rangebits);
-
-    for (i = 2; i < fc->values; i++)
-        put_bits(pb, fc->rangebits, fc->list[i].x);
-}
-
-static void put_residue_header(PutBitContext *pb, vorbis_enc_residue *rc)
-{
-    int i;
-
-    put_bits(pb, 16, rc->type);
-
-    put_bits(pb, 24, rc->begin);
-    put_bits(pb, 24, rc->end);
-    put_bits(pb, 24, rc->partition_size - 1);
-    put_bits(pb, 6, rc->classifications - 1);
-    put_bits(pb, 8, rc->classbook);
-
-    for (i = 0; i < rc->classifications; i++) {
-        int j, tmp = 0;
-        for (j = 0; j < 8; j++)
-            tmp |= (rc->books[i][j] != -1) << j;
-
-        put_bits(pb, 3, tmp & 7);
-        put_bits(pb, 1, tmp > 7);
-
-        if (tmp > 7)
-            put_bits(pb, 5, tmp >> 3);
-    }
-
-    for (i = 0; i < rc->classifications; i++) {
-        int j;
-        for (j = 0; j < 8; j++)
-            if (rc->books[i][j] != -1)
-                put_bits(pb, 8, rc->books[i][j]);
-    }
-}
-
-static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
-{
-    int i;
-    PutBitContext pb;
-    uint8_t buffer[50000] = {0}, *p = buffer;
-    int buffer_len = sizeof buffer;
-    int len, hlens[3];
-
-    // identification header
-    init_put_bits(&pb, p, buffer_len);
-    put_bits(&pb, 8, 1); //magic
-    for (i = 0; "vorbis"[i]; i++)
-        put_bits(&pb, 8, "vorbis"[i]);
-    put_bits32(&pb, 0); // version
-    put_bits(&pb,  8, venc->channels);
-    put_bits32(&pb, venc->sample_rate);
-    put_bits32(&pb, 0); // bitrate
-    put_bits32(&pb, 0); // bitrate
-    put_bits32(&pb, 0); // bitrate
-    put_bits(&pb,  4, venc->log2_blocksize[0]);
-    put_bits(&pb,  4, venc->log2_blocksize[1]);
-    put_bits(&pb,  1, 1); // framing
-
-    flush_put_bits(&pb);
-    hlens[0] = put_bits_count(&pb) >> 3;
-    buffer_len -= hlens[0];
-    p += hlens[0];
-
-    // comment header
-    init_put_bits(&pb, p, buffer_len);
-    put_bits(&pb, 8, 3); //magic
-    for (i = 0; "vorbis"[i]; i++)
-        put_bits(&pb, 8, "vorbis"[i]);
-    put_bits32(&pb, 0); // vendor length TODO
-    put_bits32(&pb, 0); // amount of comments
-    put_bits(&pb,  1, 1); // framing
-
-    flush_put_bits(&pb);
-    hlens[1] = put_bits_count(&pb) >> 3;
-    buffer_len -= hlens[1];
-    p += hlens[1];
-
-    // setup header
-    init_put_bits(&pb, p, buffer_len);
-    put_bits(&pb, 8, 5); //magic
-    for (i = 0; "vorbis"[i]; i++)
-        put_bits(&pb, 8, "vorbis"[i]);
-
-    // codebooks
-    put_bits(&pb, 8, venc->ncodebooks - 1);
-    for (i = 0; i < venc->ncodebooks; i++)
-        put_codebook_header(&pb, &venc->codebooks[i]);
-
-    // time domain, reserved, zero
-    put_bits(&pb,  6, 0);
-    put_bits(&pb, 16, 0);
-
-    // floors
-    put_bits(&pb, 6, venc->nfloors - 1);
-    for (i = 0; i < venc->nfloors; i++)
-        put_floor_header(&pb, &venc->floors[i]);
-
-    // residues
-    put_bits(&pb, 6, venc->nresidues - 1);
-    for (i = 0; i < venc->nresidues; i++)
-        put_residue_header(&pb, &venc->residues[i]);
-
-    // mappings
-    put_bits(&pb, 6, venc->nmappings - 1);
-    for (i = 0; i < venc->nmappings; i++) {
-        vorbis_enc_mapping *mc = &venc->mappings[i];
-        int j;
-        put_bits(&pb, 16, 0); // mapping type
-
-        put_bits(&pb, 1, mc->submaps > 1);
-        if (mc->submaps > 1)
-            put_bits(&pb, 4, mc->submaps - 1);
-
-        put_bits(&pb, 1, !!mc->coupling_steps);
-        if (mc->coupling_steps) {
-            put_bits(&pb, 8, mc->coupling_steps - 1);
-            for (j = 0; j < mc->coupling_steps; j++) {
-                put_bits(&pb, ilog(venc->channels - 1), mc->magnitude[j]);
-                put_bits(&pb, ilog(venc->channels - 1), mc->angle[j]);
-            }
-        }
-
-        put_bits(&pb, 2, 0); // reserved
-
-        if (mc->submaps > 1)
-            for (j = 0; j < venc->channels; j++)
-                put_bits(&pb, 4, mc->mux[j]);
-
-        for (j = 0; j < mc->submaps; j++) {
-            put_bits(&pb, 8, 0); // reserved time configuration
-            put_bits(&pb, 8, mc->floor[j]);
-            put_bits(&pb, 8, mc->residue[j]);
-        }
-    }
-
-    // modes
-    put_bits(&pb, 6, venc->nmodes - 1);
-    for (i = 0; i < venc->nmodes; i++) {
-        put_bits(&pb, 1, venc->modes[i].blockflag);
-        put_bits(&pb, 16, 0); // reserved window type
-        put_bits(&pb, 16, 0); // reserved transform type
-        put_bits(&pb, 8, venc->modes[i].mapping);
-    }
-
-    put_bits(&pb, 1, 1); // framing
-
-    flush_put_bits(&pb);
-    hlens[2] = put_bits_count(&pb) >> 3;
-
-    len = hlens[0] + hlens[1] + hlens[2];
-    p = *out = av_mallocz(64 + len + len/255);
-
-    *p++ = 2;
-    p += av_xiphlacing(p, hlens[0]);
-    p += av_xiphlacing(p, hlens[1]);
-    buffer_len = 0;
-    for (i = 0; i < 3; i++) {
-        memcpy(p, buffer + buffer_len, hlens[i]);
-        p += hlens[i];
-        buffer_len += hlens[i];
-    }
-
-    return p - *out;
-}
-
-static float get_floor_average(vorbis_enc_floor * fc, float *coeffs, int i)
-{
-    int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x;
-    int end   = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x;
-    int j;
-    float average = 0;
-
-    for (j = begin; j < end; j++)
-        average += fabs(coeffs[j]);
-    return average / (end - begin);
-}
-
-static void floor_fit(vorbis_enc_context *venc, vorbis_enc_floor *fc,
-                      float *coeffs, uint_fast16_t *posts, int samples)
-{
-    int range = 255 / fc->multiplier + 1;
-    int i;
-    float tot_average = 0.;
-    float averages[fc->values];
-    for (i = 0; i < fc->values; i++) {
-        averages[i] = get_floor_average(fc, coeffs, i);
-        tot_average += averages[i];
-    }
-    tot_average /= fc->values;
-    tot_average /= venc->quality;
-
-    for (i = 0; i < fc->values; i++) {
-        int position  = fc->list[fc->list[i].sort].x;
-        float average = averages[i];
-        int j;
-
-        average *= pow(tot_average / average, 0.5) * pow(1.25, position/200.); // MAGIC!
-        for (j = 0; j < range - 1; j++)
-            if (ff_vorbis_floor1_inverse_db_table[j * fc->multiplier] > average)
-                break;
-        posts[fc->list[i].sort] = j;
-    }
-}
-
-static int render_point(int x0, int y0, int x1, int y1, int x)
-{
-    return y0 +  (x - x0) * (y1 - y0) / (x1 - x0);
-}
-
-static void floor_encode(vorbis_enc_context *venc, vorbis_enc_floor *fc,
-                         PutBitContext *pb, uint_fast16_t *posts,
-                         float *floor, int samples)
-{
-    int range = 255 / fc->multiplier + 1;
-    int coded[fc->values]; // first 2 values are unused
-    int i, counter;
-
-    put_bits(pb, 1, 1); // non zero
-    put_bits(pb, ilog(range - 1), posts[0]);
-    put_bits(pb, ilog(range - 1), posts[1]);
-    coded[0] = coded[1] = 1;
-
-    for (i = 2; i < fc->values; i++) {
-        int predicted = render_point(fc->list[fc->list[i].low].x,
-                                     posts[fc->list[i].low],
-                                     fc->list[fc->list[i].high].x,
-                                     posts[fc->list[i].high],
-                                     fc->list[i].x);
-        int highroom = range - predicted;
-        int lowroom = predicted;
-        int room = FFMIN(highroom, lowroom);
-        if (predicted == posts[i]) {
-            coded[i] = 0; // must be used later as flag!
-            continue;
-        } else {
-            if (!coded[fc->list[i].low ])
-                coded[fc->list[i].low ] = -1;
-            if (!coded[fc->list[i].high])
-                coded[fc->list[i].high] = -1;
-        }
-        if (posts[i] > predicted) {
-            if (posts[i] - predicted > room)
-                coded[i] = posts[i] - predicted + lowroom;
-            else
-                coded[i] = (posts[i] - predicted) << 1;
-        } else {
-            if (predicted - posts[i] > room)
-                coded[i] = predicted - posts[i] + highroom - 1;
-            else
-                coded[i] = ((predicted - posts[i]) << 1) - 1;
-        }
-    }
-
-    counter = 2;
-    for (i = 0; i < fc->partitions; i++) {
-        vorbis_enc_floor_class * c = &fc->classes[fc->partition_to_class[i]];
-        int k, cval = 0, csub = 1<<c->subclass;
-        if (c->subclass) {
-            vorbis_enc_codebook * book = &venc->codebooks[c->masterbook];
-            int cshift = 0;
-            for (k = 0; k < c->dim; k++) {
-                int l;
-                for (l = 0; l < csub; l++) {
-                    int maxval = 1;
-                    if (c->books[l] != -1)
-                        maxval = venc->codebooks[c->books[l]].nentries;
-                    // coded could be -1, but this still works, cause that is 0
-                    if (coded[counter + k] < maxval)
-                        break;
-                }
-                assert(l != csub);
-                cval   |= l << cshift;
-                cshift += c->subclass;
-            }
-            put_codeword(pb, book, cval);
-        }
-        for (k = 0; k < c->dim; k++) {
-            int book  = c->books[cval & (csub-1)];
-            int entry = coded[counter++];
-            cval >>= c->subclass;
-            if (book == -1)
-                continue;
-            if (entry == -1)
-                entry = 0;
-            put_codeword(pb, &venc->codebooks[book], entry);
-        }
-    }
-
-    ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded,
-                                 fc->multiplier, floor, samples);
-}
-
-static float *put_vector(vorbis_enc_codebook *book, PutBitContext *pb,
-                         float *num)
-{
-    int i, entry = -1;
-    float distance = FLT_MAX;
-    assert(book->dimentions);
-    for (i = 0; i < book->nentries; i++) {
-        float * vec = book->dimentions + i * book->ndimentions, d = book->pow2[i];
-        int j;
-        if (!book->lens[i])
-            continue;
-        for (j = 0; j < book->ndimentions; j++)
-            d -= vec[j] * num[j];
-        if (distance > d) {
-            entry    = i;
-            distance = d;
-        }
-    }
-    put_codeword(pb, book, entry);
-    return &book->dimentions[entry * book->ndimentions];
-}
-
-static void residue_encode(vorbis_enc_context *venc, vorbis_enc_residue *rc,
-                           PutBitContext *pb, float *coeffs, int samples,
-                           int real_ch)
-{
-    int pass, i, j, p, k;
-    int psize      = rc->partition_size;
-    int partitions = (rc->end - rc->begin) / psize;
-    int channels   = (rc->type == 2) ? 1 : real_ch;
-    int classes[channels][partitions];
-    int classwords = venc->codebooks[rc->classbook].ndimentions;
-
-    assert(rc->type == 2);
-    assert(real_ch == 2);
-    for (p = 0; p < partitions; p++) {
-        float max1 = 0., max2 = 0.;
-        int s = rc->begin + p * psize;
-        for (k = s; k < s + psize; k += 2) {
-            max1 = FFMAX(max1, fabs(coeffs[          k / real_ch]));
-            max2 = FFMAX(max2, fabs(coeffs[samples + k / real_ch]));
-        }
-
-        for (i = 0; i < rc->classifications - 1; i++)
-            if (max1 < rc->maxes[i][0] && max2 < rc->maxes[i][1])
-                break;
-        classes[0][p] = i;
-    }
-
-    for (pass = 0; pass < 8; pass++) {
-        p = 0;
-        while (p < partitions) {
-            if (pass == 0)
-                for (j = 0; j < channels; j++) {
-                    vorbis_enc_codebook * book = &venc->codebooks[rc->classbook];
-                    int entry = 0;
-                    for (i = 0; i < classwords; i++) {
-                        entry *= rc->classifications;
-                        entry += classes[j][p + i];
-                    }
-                    put_codeword(pb, book, entry);
-                }
-            for (i = 0; i < classwords && p < partitions; i++, p++) {
-                for (j = 0; j < channels; j++) {
-                    int nbook = rc->books[classes[j][p]][pass];
-                    vorbis_enc_codebook * book = &venc->codebooks[nbook];
-                    float *buf = coeffs + samples*j + rc->begin + p*psize;
-                    if (nbook == -1)
-                        continue;
-
-                    assert(rc->type == 0 || rc->type == 2);
-                    assert(!(psize % book->ndimentions));
-
-                    if (rc->type == 0) {
-                        for (k = 0; k < psize; k += book->ndimentions) {
-                            float *a = put_vector(book, pb, &buf[k]);
-                            int l;
-                            for (l = 0; l < book->ndimentions; l++)
-                                buf[k + l] -= a[l];
-                        }
-                    } else {
-                        int s = rc->begin + p * psize, a1, b1;
-                        a1 = (s % real_ch) * samples;
-                        b1 =  s / real_ch;
-                        s  = real_ch * samples;
-                        for (k = 0; k < psize; k += book->ndimentions) {
-                            int dim, a2 = a1, b2 = b1;
-                            float vec[book->ndimentions], *pv = vec;
-                            for (dim = book->ndimentions; dim--; ) {
-                                *pv++ = coeffs[a2 + b2];
-                                if ((a2 += samples) == s) {
-                                    a2 = 0;
-                                    b2++;
-                                }
-                            }
-                            pv = put_vector(book, pb, vec);
-                            for (dim = book->ndimentions; dim--; ) {
-                                coeffs[a1 + b1] -= *pv++;
-                                if ((a1 += samples) == s) {
-                                    a1 = 0;
-                                    b1++;
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-}
-
-static int apply_window_and_mdct(vorbis_enc_context *venc, signed short *audio,
-                                 int samples)
-{
-    int i, j, channel;
-    const float * win = venc->win[0];
-    int window_len = 1 << (venc->log2_blocksize[0] - 1);
-    float n = (float)(1 << venc->log2_blocksize[0]) / 4.;
-    // FIXME use dsp
-
-    if (!venc->have_saved && !samples)
-        return 0;
-
-    if (venc->have_saved) {
-        for (channel = 0; channel < venc->channels; channel++)
-            memcpy(venc->samples + channel * window_len * 2,
-                   venc->saved + channel * window_len, sizeof(float) * window_len);
-    } else {
-        for (channel = 0; channel < venc->channels; channel++)
-            memset(venc->samples + channel * window_len * 2, 0,
-                   sizeof(float) * window_len);
-    }
-
-    if (samples) {
-        for (channel = 0; channel < venc->channels; channel++) {
-            float * offset = venc->samples + channel*window_len*2 + window_len;
-            j = channel;
-            for (i = 0; i < samples; i++, j += venc->channels)
-                offset[i] = -audio[j] / 32768. / n * win[window_len - i - 1]; //FIXME find out why the sign has to be fliped
-        }
-    } else {
-        for (channel = 0; channel < venc->channels; channel++)
-            memset(venc->samples + channel * window_len * 2 + window_len,
-                   0, sizeof(float) * window_len);
-    }
-
-    for (channel = 0; channel < venc->channels; channel++)
-        ff_mdct_calc(&venc->mdct[0], venc->coeffs + channel * window_len,
-                     venc->samples + channel * window_len * 2);
-
-    if (samples) {
-        for (channel = 0; channel < venc->channels; channel++) {
-            float *offset = venc->saved + channel * window_len;
-            j = channel;
-            for (i = 0; i < samples; i++, j += venc->channels)
-                offset[i] = -audio[j] / 32768. / n * win[i]; //FIXME find out why the sign has to be fliped
-        }
-        venc->have_saved = 1;
-    } else {
-        venc->have_saved = 0;
-    }
-    return 1;
-}
-
-static av_cold int vorbis_encode_init(AVCodecContext *avccontext)
-{
-    vorbis_enc_context *venc = avccontext->priv_data;
-
-    if (avccontext->channels != 2) {
-        av_log(avccontext, AV_LOG_ERROR, "Current FFmpeg Vorbis encoder only supports 2 channels.\n");
-        return -1;
-    }
-
-    create_vorbis_context(venc, avccontext);
-
-    if (avccontext->flags & CODEC_FLAG_QSCALE)
-        venc->quality = avccontext->global_quality / (float)FF_QP2LAMBDA / 10.;
-    else
-        venc->quality = 1.;
-    venc->quality *= venc->quality;
-
-    avccontext->extradata_size = put_main_header(venc, (uint8_t**)&avccontext->extradata);
-
-    avccontext->frame_size     = 1 << (venc->log2_blocksize[0] - 1);
-
-    avccontext->coded_frame            = avcodec_alloc_frame();
-    avccontext->coded_frame->key_frame = 1;
-
-    return 0;
-}
-
-static int vorbis_encode_frame(AVCodecContext *avccontext,
-                               unsigned char *packets,
-                               int buf_size, void *data)
-{
-    vorbis_enc_context *venc = avccontext->priv_data;
-    signed short *audio = data;
-    int samples = data ? avccontext->frame_size : 0;
-    vorbis_enc_mode *mode;
-    vorbis_enc_mapping *mapping;
-    PutBitContext pb;
-    int i;
-
-    if (!apply_window_and_mdct(venc, audio, samples))
-        return 0;
-    samples = 1 << (venc->log2_blocksize[0] - 1);
-
-    init_put_bits(&pb, packets, buf_size);
-
-    put_bits(&pb, 1, 0); // magic bit
-
-    put_bits(&pb, ilog(venc->nmodes - 1), 0); // 0 bits, the mode
-
-    mode    = &venc->modes[0];
-    mapping = &venc->mappings[mode->mapping];
-    if (mode->blockflag) {
-        put_bits(&pb, 1, 0);
-        put_bits(&pb, 1, 0);
-    }
-
-    for (i = 0; i < venc->channels; i++) {
-        vorbis_enc_floor *fc = &venc->floors[mapping->floor[mapping->mux[i]]];
-        uint_fast16_t posts[fc->values];
-        floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples);
-        floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
-    }
-
-    for (i = 0; i < venc->channels * samples; i++)
-        venc->coeffs[i] /= venc->floor[i];
-
-    for (i = 0; i < mapping->coupling_steps; i++) {
-        float *mag = venc->coeffs + mapping->magnitude[i] * samples;
-        float *ang = venc->coeffs + mapping->angle[i]     * samples;
-        int j;
-        for (j = 0; j < samples; j++) {
-            float a = ang[j];
-            ang[j] -= mag[j];
-            if (mag[j] > 0)
-                ang[j] = -ang[j];
-            if (ang[j] < 0)
-                mag[j] = a;
-        }
-    }
-
-    residue_encode(venc, &venc->residues[mapping->residue[mapping->mux[0]]],
-                   &pb, venc->coeffs, samples, venc->channels);
-
-    avccontext->coded_frame->pts = venc->sample_count;
-    venc->sample_count += avccontext->frame_size;
-    flush_put_bits(&pb);
-    return put_bits_count(&pb) >> 3;
-}
-
-
-static av_cold int vorbis_encode_close(AVCodecContext *avccontext)
-{
-    vorbis_enc_context *venc = avccontext->priv_data;
-    int i;
-
-    if (venc->codebooks)
-        for (i = 0; i < venc->ncodebooks; i++) {
-            av_freep(&venc->codebooks[i].lens);
-            av_freep(&venc->codebooks[i].codewords);
-            av_freep(&venc->codebooks[i].quantlist);
-            av_freep(&venc->codebooks[i].dimentions);
-            av_freep(&venc->codebooks[i].pow2);
-        }
-    av_freep(&venc->codebooks);
-
-    if (venc->floors)
-        for (i = 0; i < venc->nfloors; i++) {
-            int j;
-            if (venc->floors[i].classes)
-                for (j = 0; j < venc->floors[i].nclasses; j++)
-                    av_freep(&venc->floors[i].classes[j].books);
-            av_freep(&venc->floors[i].classes);
-            av_freep(&venc->floors[i].partition_to_class);
-            av_freep(&venc->floors[i].list);
-        }
-    av_freep(&venc->floors);
-
-    if (venc->residues)
-        for (i = 0; i < venc->nresidues; i++) {
-            av_freep(&venc->residues[i].books);
-            av_freep(&venc->residues[i].maxes);
-        }
-    av_freep(&venc->residues);
-
-    if (venc->mappings)
-        for (i = 0; i < venc->nmappings; i++) {
-            av_freep(&venc->mappings[i].mux);
-            av_freep(&venc->mappings[i].floor);
-            av_freep(&venc->mappings[i].residue);
-            av_freep(&venc->mappings[i].magnitude);
-            av_freep(&venc->mappings[i].angle);
-        }
-    av_freep(&venc->mappings);
-
-    av_freep(&venc->modes);
-
-    av_freep(&venc->saved);
-    av_freep(&venc->samples);
-    av_freep(&venc->floor);
-    av_freep(&venc->coeffs);
-
-    ff_mdct_end(&venc->mdct[0]);
-    ff_mdct_end(&venc->mdct[1]);
-
-    av_freep(&avccontext->coded_frame);
-    av_freep(&avccontext->extradata);
-
-    return 0 ;
-}
-
-AVCodec vorbis_encoder = {
-    "vorbis",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_VORBIS,
-    sizeof(vorbis_enc_context),
-    vorbis_encode_init,
-    vorbis_encode_frame,
-    vorbis_encode_close,
-    .capabilities= CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Vorbis"),
-};
diff --git a/libavcodec/vorbis_enc_data.h b/libavcodec/vorbis_enc_data.h
deleted file mode 100644
index affc3d6..0000000
--- a/libavcodec/vorbis_enc_data.h
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VORBIS_ENC_DATA_H
-#define AVCODEC_VORBIS_ENC_DATA_H
-
-#include <stdint.h>
-
-static const uint8_t codebook0[] = {
-    2, 10,  8, 14,  7, 12, 11, 14,  1,  5,  3,  7,  4,  9,  7, 13,
-};
-
-static const uint8_t codebook1[] = {
-    1,  4,  2,  6,  3,  7,  5,  7,
-};
-
-static const uint8_t codebook2[] = {
-     1,  5,  7, 21,  5,  8,  9, 21, 10,  9, 12, 20, 20, 16, 20,
-    20,  4,  8,  9, 20,  6,  8,  9, 20, 11, 11, 13, 20, 20, 15,
-    17, 20,  9, 11, 14, 20,  8, 10, 15, 20, 11, 13, 15, 20, 20,
-    20, 20, 20, 20, 20, 20, 20, 13, 20, 20, 20, 18, 18, 20, 20,
-    20, 20, 20, 20,  3,  6,  8, 20,  6,  7,  9, 20, 10,  9, 12,
-    20, 20, 20, 20, 20,  5,  7,  9, 20,  6,  6,  9, 20, 10,  9,
-    12, 20, 20, 20, 20, 20,  8, 10, 13, 20,  8,  9, 12, 20, 11,
-    10, 12, 20, 20, 20, 20, 20, 18, 20, 20, 20, 15, 17, 18, 20,
-    18, 17, 18, 20, 20, 20, 20, 20,  7, 10, 12, 20,  8,  9, 11,
-    20, 14, 13, 14, 20, 20, 20, 20, 20,  6,  9, 12, 20,  7,  8,
-    11, 20, 12, 11, 13, 20, 20, 20, 20, 20,  9, 11, 15, 20,  8,
-    10, 14, 20, 12, 11, 14, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-    20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 11, 16, 18,
-    20, 15, 15, 17, 20, 20, 17, 20, 20, 20, 20, 20, 20,  9, 14,
-    16, 20, 12, 12, 15, 20, 17, 15, 18, 20, 20, 20, 20, 20, 16,
-    19, 18, 20, 15, 16, 20, 20, 17, 17, 20, 20, 20, 20, 20, 20,
-    20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-    20,
-};
-
-static const uint8_t codebook3[] = {
-     2,  3,  7, 13,  4,  4,  7, 15,  8,  6,  9, 17, 21, 16, 15,
-    21,  2,  5,  7, 11,  5,  5,  7, 14,  9,  7, 10, 16, 17, 15,
-    16, 21,  4,  7, 10, 17,  7,  7,  9, 15, 11,  9, 11, 16, 21,
-    18, 15, 21, 18, 21, 21, 21, 15, 17, 17, 19, 21, 19, 18, 20,
-    21, 21, 21, 20,
-};
-
-static const uint8_t codebook4[] = {
-     5,  5,  5,  5,  6,  5,  6,  5,  6,  5,  6,  5,  6,  5,  6,
-     5,  6,  5,  6,  5,  6,  5,  6,  5,  7,  5,  7,  5,  7,  5,
-     7,  5,  8,  6,  8,  6,  8,  6,  9,  6,  9,  6, 10,  6, 10,
-     6, 11,  6, 11,  7, 11,  7, 12,  7, 12,  7, 12,  7, 12,  7,
-    12,  7, 12,  7, 12,  7, 12,  8, 13,  8, 12,  8, 12,  8, 13,
-     8, 13,  9, 13,  9, 13,  9, 13,  9, 12, 10, 12, 10, 13, 10,
-    14, 11, 14, 12, 14, 13, 14, 13, 14, 14, 15, 16, 15, 15, 15,
-    14, 15, 17, 21, 22, 22, 21, 22, 22, 22, 22, 22, 22, 21, 21,
-    21, 21, 21, 21, 21, 21, 21, 21,
-};
-
-static const uint8_t codebook5[] = {
-     2,  5,  5,  4,  5,  4,  5,  4,  5,  4,  6,  5,  6,  5,  6,
-     5,  6,  5,  7,  5,  7,  6,  8,  6,  8,  6,  8,  6,  9,  6,
-     9,  6,
-};
-
-static const uint8_t codebook6[] = {
-     8,  5,  8,  4,  9,  4,  9,  4,  9,  4,  9,  4,  9,  4,  9,
-     4,  9,  4,  9,  4,  9,  4,  8,  4,  8,  4,  9,  5,  9,  5,
-     9,  5,  9,  5,  9,  6, 10,  6, 10,  7, 10,  8, 11,  9, 11,
-    11, 12, 13, 12, 14, 13, 15, 13, 15, 14, 16, 14, 17, 15, 17,
-    15, 15, 16, 16, 15, 16, 16, 16, 15, 18, 16, 15, 17, 17, 19,
-    19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19,
-};
-
-static const uint8_t codebook7[] = {
-     1,  5,  5,  5,  5,  5,  5,  5,  6,  5,  6,  5,  6,  5,  6,
-     5,  6,  6,  7,  7,  7,  7,  8,  7,  8,  8,  9,  8, 10,  9,
-    10,  9,
-};
-
-static const uint8_t codebook8[] = {
-     4,  3,  4,  3,  4,  4,  5,  4,  5,  4,  5,  5,  6,  5,  6,
-     5,  7,  5,  7,  6,  7,  6,  8,  7,  8,  7,  8,  7,  9,  8,
-     9,  9,  9,  9, 10, 10, 10, 11,  9, 12,  9, 12,  9, 15, 10,
-    14,  9, 13, 10, 13, 10, 12, 10, 12, 10, 13, 10, 12, 11, 13,
-    11, 14, 12, 13, 13, 14, 14, 13, 14, 15, 14, 16, 13, 13, 14,
-    16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-    16, 16, 16, 16, 15, 15,
-};
-
-static const uint8_t codebook9[] = {
-     4,  5,  4,  5,  3,  5,  3,  5,  3,  5,  4,  4,  4,  4,  5,
-     5,  5,
-};
-
-static const uint8_t codebook10[] = {
-     3,  3,  4,  3,  4,  4,  4,  4,  5,  5,  5,  5,  5,  6,  5,
-     7,  5,  8,  6,  8,  6,  9,  7, 10,  7, 10,  8, 10,  8, 11,
-     9, 11,
-};
-
-static const uint8_t codebook11[] = {
-   3,  7,  3,  8,  3, 10,  3,  8,  3,  9,  3,  8,  4,  9,  4,
-   9,  5,  9,  6, 10,  6,  9,  7, 11,  7, 12,  9, 13, 10, 13,
-  12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-  12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-  12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-  12, 12, 12,
-};
-
-static const uint8_t codebook12[] = {
-     4,  5,  4,  5,  4,  5,  4,  5,  3,  5,  3,  5,  3,  5,  4,
-     5,  4,
-};
-
-static const uint8_t codebook13[] = {
-     4,  2,  4,  2,  5,  3,  5,  4,  6,  6,  6,  7,  7,  8,  7,
-     8,  7,  8,  7,  9,  8,  9,  8,  9,  8, 10,  8, 11,  9, 12,
-     9, 12,
-};
-
-static const uint8_t codebook14[] = {
-     2,  5,  2,  6,  3,  6,  4,  7,  4,  7,  5,  9,  5, 11,  6,
-    11,  6, 11,  7, 11,  6, 11,  6, 11,  9, 11,  8, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 10,
-    10, 10, 10,
-};
-
-static const uint8_t codebook15[] = {
-     5,  6, 11, 11, 11, 11, 10, 10, 12, 11,  5,  2, 11,  5,  6,
-     6,  7,  9, 11, 13, 13, 10,  7, 11,  6,  7,  8,  9, 10, 12,
-    11,  5, 11,  6,  8,  7,  9, 11, 14, 15, 11,  6,  6,  8,  4,
-     5,  7,  8, 10, 13, 10,  5,  7,  7,  5,  5,  6,  8, 10, 11,
-    10,  7,  7,  8,  6,  5,  5,  7,  9,  9, 11,  8,  8, 11,  8,
-     7,  6,  6,  7,  9, 12, 11, 10, 13,  9,  9,  7,  7,  7,  9,
-    11, 13, 12, 15, 12, 11,  9,  8,  8,  8,
-};
-
-static const uint8_t codebook16[] = {
-     2,  4,  4,  0,  0,  0,  0,  0,  0,  5,  6,  6,  0,  0,  0,
-     0,  0,  0,  5,  6,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  5,  7,  7,  0,  0,  0,  0,  0,  0,
-     7,  8,  8,  0,  0,  0,  0,  0,  0,  6,  7,  8,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  7,  7,
-     0,  0,  0,  0,  0,  0,  6,  8,  7,  0,  0,  0,  0,  0,  0,
-     7,  8,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  7,  7,  0,  0,  0,
-     0,  0,  0,  7,  8,  8,  0,  0,  0,  0,  0,  0,  7,  8,  8,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     7,  8,  8,  0,  0,  0,  0,  0,  0,  8,  8,  9,  0,  0,  0,
-     0,  0,  0,  8,  9,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  6,  8,  8,  0,  0,  0,  0,  0,  0,
-     7,  9,  8,  0,  0,  0,  0,  0,  0,  8,  9,  9,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  5,  7,  7,  0,  0,  0,  0,  0,  0,  7,  8,  8,
-     0,  0,  0,  0,  0,  0,  7,  8,  8,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  8,  8,  0,  0,  0,
-     0,  0,  0,  8,  9,  9,  0,  0,  0,  0,  0,  0,  7,  8,  9,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     6,  8,  8,  0,  0,  0,  0,  0,  0,  8,  9,  9,  0,  0,  0,
-     0,  0,  0,  8,  9,  8,
-};
-
-static const uint8_t codebook17[] = {
-     2,  5,  5,  0,  0,  0,  5,  5,  0,  0,  0,  5,  5,  0,  0,
-     0,  7,  8,  0,  0,  0,  0,  0,  0,  0,  5,  6,  6,  0,  0,
-     0,  7,  7,  0,  0,  0,  7,  7,  0,  0,  0, 10, 10,  0,  0,
-     0,  0,  0,  0,  0,  5,  6,  6,  0,  0,  0,  7,  7,  0,  0,
-     0,  7,  7,  0,  0,  0, 10, 10,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     5,  7,  7,  0,  0,  0,  7,  7,  0,  0,  0,  7,  7,  0,  0,
-     0,  9,  9,  0,  0,  0,  0,  0,  0,  0,  5,  7,  7,  0,  0,
-     0,  7,  7,  0,  0,  0,  7,  7,  0,  0,  0,  9,  9,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  5,  7,  7,  0,  0,  0,  7,  7,  0,  0,
-     0,  7,  7,  0,  0,  0,  9,  9,  0,  0,  0,  0,  0,  0,  0,
-     5,  7,  7,  0,  0,  0,  7,  7,  0,  0,  0,  7,  7,  0,  0,
-     0,  9,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 10, 10,  0,  0,
-     0,  9,  9,  0,  0,  0,  9,  9,  0,  0,  0, 10, 10,  0,  0,
-     0,  0,  0,  0,  0,  8, 10, 10,  0,  0,  0,  9,  9,  0,  0,
-     0,  9,  9,  0,  0,  0, 10, 10,
-};
-
-static const uint8_t codebook18[] = {
-     2,  4,  3,  6,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  4,  6,  6,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  4,  4,  4,  6,  6,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     6,  6,  6,  9,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  6,  7,  9,  9,
-};
-
-static const uint8_t codebook19[] = {
-     2,  3,  3,  6,  6,  0,  0,  0,  0,  0,  4,  4,  6,  6,  0,
-     0,  0,  0,  0,  4,  4,  6,  6,  0,  0,  0,  0,  0,  5,  5,
-     6,  6,  0,  0,  0,  0,  0,  0,  0,  6,  6,  0,  0,  0,  0,
-     0,  0,  0,  7,  8,  0,  0,  0,  0,  0,  0,  0,  7,  7,  0,
-     0,  0,  0,  0,  0,  0,  9,  9,
-};
-
-static const uint8_t codebook20[] = {
-     1,  3,  4,  6,  6,  7,  7,  9,  9,  0,  5,  5,  7,  7,  7,
-     8,  9,  9,  0,  5,  5,  7,  7,  8,  8,  9,  9,  0,  7,  7,
-     8,  8,  8,  8, 10, 10,  0,  0,  0,  8,  8,  8,  8, 10, 10,
-     0,  0,  0,  9,  9,  9,  9, 10, 10,  0,  0,  0,  9,  9,  9,
-     9, 10, 10,  0,  0,  0, 10, 10, 10, 10, 11, 11,  0,  0,  0,
-     0,  0, 10, 10, 11, 11,
-};
-
-static const uint8_t codebook21[] = {
-     2,  3,  3,  6,  6,  7,  7,  8,  8,  8,  8,  9,  9, 10, 10,
-    11, 10,  0,  5,  5,  7,  7,  8,  8,  9,  9,  9,  9, 10, 10,
-    10, 10, 11, 11,  0,  5,  5,  7,  7,  8,  8,  9,  9,  9,  9,
-    10, 10, 10, 10, 11, 11,  0,  6,  6,  7,  7,  8,  8,  9,  9,
-     9,  9, 10, 10, 11, 11, 11, 11,  0,  0,  0,  7,  7,  8,  8,
-     9,  9,  9,  9, 10, 10, 11, 11, 11, 12,  0,  0,  0,  8,  8,
-     8,  8,  9,  9,  9,  9, 10, 10, 11, 11, 12, 12,  0,  0,  0,
-     8,  8,  8,  8,  9,  9,  9,  9, 10, 10, 11, 11, 12, 12,  0,
-     0,  0,  9,  9,  9,  9, 10, 10, 10, 10, 11, 10, 11, 11, 12,
-    12,  0,  0,  0,  0,  0,  9,  9, 10, 10, 10, 10, 11, 11, 11,
-    11, 12, 12,  0,  0,  0,  0,  0,  9,  8,  9,  9, 10, 10, 11,
-    11, 12, 12, 12, 12,  0,  0,  0,  0,  0,  8,  8,  9,  9, 10,
-    10, 11, 11, 12, 11, 12, 12,  0,  0,  0,  0,  0,  9, 10, 10,
-    10, 11, 11, 11, 11, 12, 12, 13, 13,  0,  0,  0,  0,  0,  0,
-     0, 10, 10, 10, 10, 11, 11, 12, 12, 13, 13,  0,  0,  0,  0,
-     0,  0,  0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13,  0,  0,
-     0,  0,  0,  0,  0, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13,
-     0,  0,  0,  0,  0,  0,  0, 11, 11, 12, 12, 12, 12, 13, 13,
-    13, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12, 12, 12, 12,
-    13, 13, 13, 13,
-};
-
-static const uint8_t codebook22[] = {
-     1,  4,  4,  7,  6,  6,  7,  6,  6,  4,  7,  7, 10,  9,  9,
-    11,  9,  9,  4,  7,  7, 10,  9,  9, 11,  9,  9,  7, 10, 10,
-    11, 11, 10, 12, 11, 11,  6,  9,  9, 11, 10, 10, 11, 10, 10,
-     6,  9,  9, 11, 10, 10, 11, 10, 10,  7, 11, 11, 11, 11, 11,
-    12, 11, 11,  6,  9,  9, 11, 10, 10, 11, 10, 10,  6,  9,  9,
-    11, 10, 10, 11, 10, 10,
-};
-
-static const uint8_t codebook23[] = {
-     2,  4,  4,  6,  6,  7,  7,  7,  7,  8,  8, 10,  5,  5,  6,
-     6,  7,  7,  8,  8,  8,  8, 10,  5,  5,  6,  6,  7,  7,  8,
-     8,  8,  8, 10,  6,  6,  7,  7,  8,  8,  8,  8,  8,  8, 10,
-    10, 10,  7,  7,  8,  7,  8,  8,  8,  8, 10, 10, 10,  8,  8,
-     8,  8,  8,  8,  8,  8, 10, 10, 10,  7,  8,  8,  8,  8,  8,
-     8,  8, 10, 10, 10,  8,  8,  8,  8,  8,  8,  8,  8, 10, 10,
-    10, 10, 10,  8,  8,  8,  8,  8,  8, 10, 10, 10, 10, 10,  9,
-     9,  8,  8,  9,  8, 10, 10, 10, 10, 10,  8,  8,  8,  8,  8,
-     8,
-};
-
-static const uint8_t codebook24[] = {
-     1,  4,  4,  6,  6,  7,  7,  8,  8,  9,  9, 10, 10,  6,  5,
-     5,  7,  7,  8,  8,  8,  8,  9,  9, 10, 10,  7,  5,  5,  7,
-     7,  8,  8,  8,  8,  9,  9, 11, 10,  0,  8,  8,  8,  8,  9,
-     9,  9,  9, 10, 10, 11, 11,  0,  8,  8,  8,  8,  9,  9,  9,
-     9, 10, 10, 11, 11,  0, 12, 12,  9,  9, 10, 10, 10, 10, 11,
-    11, 11, 12,  0, 13, 13,  9,  9, 10, 10, 10, 10, 11, 11, 12,
-    12,  0,  0,  0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12,  0,
-     0,  0, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12,  0,  0,  0,
-    14, 14, 11, 11, 11, 11, 12, 12, 13, 13,  0,  0,  0, 14, 14,
-    11, 11, 11, 11, 12, 12, 13, 13,  0,  0,  0,  0,  0, 12, 12,
-    12, 12, 13, 13, 14, 13,  0,  0,  0,  0,  0, 13, 13, 12, 12,
-    13, 12, 14, 13,
-};
-
-static const uint8_t codebook25[] = {
-     2,  4,  4,  5,  5,  6,  5,  5,  5,  5,  6,  4,  5,  5,  5,
-     6,  5,  5,  5,  5,  6,  6,  6,  5,  5,
-};
-
-static const uint8_t codebook26[] = {
-     1,  4,  4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,  4,  9,
-     8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,  2,  9,  7, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11,
-};
-
-static const uint8_t codebook27[] = {
-     1,  4,  4,  6,  6,  7,  7,  8,  7,  9,  9, 10, 10, 10, 10,
-     6,  5,  5,  7,  7,  8,  8, 10,  8, 11, 10, 12, 12, 13, 13,
-     6,  5,  5,  7,  7,  8,  8, 10,  9, 11, 11, 12, 12, 13, 12,
-    18,  8,  8,  8,  8,  9,  9, 10,  9, 11, 10, 12, 12, 13, 13,
-    18,  8,  8,  8,  8,  9,  9, 10, 10, 11, 11, 13, 12, 14, 13,
-    18, 11, 11,  9,  9, 10, 10, 11, 11, 11, 12, 13, 12, 13, 14,
-    18, 11, 11,  9,  8, 11, 10, 11, 11, 11, 11, 12, 12, 14, 13,
-    18, 18, 18, 10, 11, 10, 11, 12, 12, 12, 12, 13, 12, 14, 13,
-    18, 18, 18, 10, 11, 11,  9, 12, 11, 12, 12, 12, 13, 13, 13,
-    18, 18, 17, 14, 14, 11, 11, 12, 12, 13, 12, 14, 12, 14, 13,
-    18, 18, 18, 14, 14, 11, 10, 12,  9, 12, 13, 13, 13, 13, 13,
-    18, 18, 17, 16, 18, 13, 13, 12, 12, 13, 11, 14, 12, 14, 14,
-    17, 18, 18, 17, 18, 13, 12, 13, 10, 12, 11, 14, 14, 14, 14,
-    17, 18, 18, 18, 18, 15, 16, 12, 12, 13, 10, 14, 12, 14, 15,
-    18, 18, 18, 16, 17, 16, 14, 12, 11, 13, 10, 13, 13, 14, 15,
-};
-
-static const uint8_t codebook28[] = {
-     2,  5,  5,  6,  6,  7,  7,  7,  7,  7,  7,  8,  8,  8,  8,
-     8,  8, 10,  6,  6,  7,  7,  8,  7,  8,  8,  8,  8,  8,  9,
-     9,  9,  9,  9, 10,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,
-     9,  9,  9,  9,  9,  9, 10,  7,  7,  7,  7,  8,  8,  8,  8,
-     9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10,  7,  7,  8,  8,
-     8,  9,  9,  9,  9,  9,  9,  9,  9,  9, 11, 11, 11,  8,  8,
-     8,  8,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 10, 10, 10,
-     8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 10,
-    10, 10,  8,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 10,
-     9, 10, 10, 10, 11, 11,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-     9,  9,  9, 11, 10, 11, 11, 11,  9,  9,  9,  9,  9,  9, 10,
-    10,  9,  9, 10,  9, 11, 10, 11, 11, 11,  9,  9,  9,  9,  9,
-     9,  9,  9, 10, 10, 10,  9, 11, 11, 11, 11, 11,  9,  9,  9,
-     9, 10, 10,  9,  9,  9,  9, 10,  9, 11, 11, 11, 11, 11, 11,
-    11,  9,  9,  9,  9,  9,  9, 10, 10, 10, 10, 11, 11, 11, 11,
-    11, 11, 11, 10,  9, 10, 10,  9, 10,  9,  9, 10,  9, 11, 10,
-    10, 11, 11, 11, 11,  9, 10,  9,  9,  9,  9, 10, 10, 10, 10,
-    11, 11, 11, 11, 11, 11, 10, 10, 10,  9,  9, 10,  9, 10,  9,
-    10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11,  9,  9,  9,  9,
-     9, 10, 10, 10,
-};
-
-static const struct {
-    int dim;
-    int len;
-    int real_len;
-    const uint8_t *clens;
-    int lookup;
-    float min;
-    float delta;
-    const uint8_t *quant;
-} cvectors[] = {
-    { 2,   16,   16, codebook0,  0 },
-    { 2,    8,    8, codebook1,  0 },
-    { 2,  256,  256, codebook2,  0 },
-    { 2,   64,   64, codebook3,  0 },
-    { 2,  128,  128, codebook4,  0 },
-    { 2,   32,   32, codebook5,  0 },
-    { 2,   96,   96, codebook6,  0 },
-    { 2,   32,   32, codebook7,  0 },
-    { 2,   96,   96, codebook8,  0 },
-    { 2,   17,   17, codebook9,  0 },
-    { 2,   32,   32, codebook10, 0 },
-    { 2,   78,   78, codebook11, 0 },
-    { 2,   17,   17, codebook12, 0 },
-    { 2,   32,   32, codebook13, 0 },
-    { 2,   78,   78, codebook14, 0 },
-    { 2,  100,  100, codebook15, 0 },
-    { 8, 1641, 6561, codebook16, 1,    -1.0,   1.0, (const uint8_t[]){ 1, 0, 2, } },
-    { 4,  443,  625, codebook17, 1,    -2.0,   1.0, (const uint8_t[]){ 2, 1, 3, 0, 4, } },
-    { 4,  105,  625, codebook18, 1,    -2.0,   1.0, (const uint8_t[]){ 2, 1, 3, 0, 4, } },
-    { 2,   68,   81, codebook19, 1,    -4.0,   1.0, (const uint8_t[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
-    { 2,   81,   81, codebook20, 1,    -4.0,   1.0, (const uint8_t[]){ 4, 3, 5, 2, 6, 1, 7, 0, 8, } },
-    { 2,  289,  289, codebook21, 1,    -8.0,   1.0, (const uint8_t[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
-    { 4,   81,   81, codebook22, 1,   -11.0,  11.0, (const uint8_t[]){ 1, 0, 2, } },
-    { 2,  121,  121, codebook23, 1,    -5.0,   1.0, (const uint8_t[]){ 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, } },
-    { 2,  169,  169, codebook24, 1,   -30.0,   5.0, (const uint8_t[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
-    { 2,   25,   25, codebook25, 1,    -2.0,   1.0, (const uint8_t[]){ 2, 1, 3, 0, 4, } },
-    { 2,  169,  169, codebook26, 1, -1530.0, 255.0, (const uint8_t[]){ 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, } },
-    { 2,  225,  225, codebook27, 1,  -119.0,  17.0, (const uint8_t[]){ 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, } },
-    { 2,  289,  289, codebook28, 1,    -8.0,   1.0, (const uint8_t[]){ 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, } },
-};
-
-static const struct {
-    int dim;
-    int subclass;
-    int masterbook;
-    const int *nbooks;
-} floor_classes[] = {
-    { 3, 0, 0, (const int[]){  4             } },
-    { 4, 1, 0, (const int[]){  5,  6         } },
-    { 3, 1, 1, (const int[]){  7,  8         } },
-    { 4, 2, 2, (const int[]){ -1,  9, 10, 11 } },
-    { 3, 2, 3, (const int[]){ -1, 12, 13, 14 } },
-};
-
-#endif /* AVCODEC_VORBIS_ENC_DATA_H */
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
deleted file mode 100644
index c08de6c..0000000
--- a/libavcodec/vp3.c
+++ /dev/null
@@ -1,2233 +0,0 @@
-/*
- * Copyright (C) 2003-2004 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * On2 VP3 Video Decoder
- *
- * VP3 Video Decoder by Mike Melanson (mike at multimedia.cx)
- * For more information about the VP3 coding process, visit:
- *   http://wiki.multimedia.cx/index.php?title=On2_VP3
- *
- * Theora decoder by Alex Beregszaszi
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-
-#include "vp3data.h"
-#include "xiph.h"
-
-#define FRAGMENT_PIXELS 8
-
-static av_cold int vp3_decode_end(AVCodecContext *avctx);
-
-//FIXME split things out into their own arrays
-typedef struct Vp3Fragment {
-    int16_t dc;
-    uint8_t coding_method;
-    uint8_t qpi;
-} Vp3Fragment;
-
-#define SB_NOT_CODED        0
-#define SB_PARTIALLY_CODED  1
-#define SB_FULLY_CODED      2
-
-// This is the maximum length of a single long bit run that can be encoded
-// for superblock coding or block qps. Theora special-cases this to read a
-// bit instead of flipping the current bit to allow for runs longer than 4129.
-#define MAXIMUM_LONG_BIT_RUN 4129
-
-#define MODE_INTER_NO_MV      0
-#define MODE_INTRA            1
-#define MODE_INTER_PLUS_MV    2
-#define MODE_INTER_LAST_MV    3
-#define MODE_INTER_PRIOR_LAST 4
-#define MODE_USING_GOLDEN     5
-#define MODE_GOLDEN_MV        6
-#define MODE_INTER_FOURMV     7
-#define CODING_MODE_COUNT     8
-
-/* special internal mode */
-#define MODE_COPY             8
-
-/* There are 6 preset schemes, plus a free-form scheme */
-static const int ModeAlphabet[6][CODING_MODE_COUNT] =
-{
-    /* scheme 1: Last motion vector dominates */
-    {    MODE_INTER_LAST_MV,    MODE_INTER_PRIOR_LAST,
-         MODE_INTER_PLUS_MV,    MODE_INTER_NO_MV,
-         MODE_INTRA,            MODE_USING_GOLDEN,
-         MODE_GOLDEN_MV,        MODE_INTER_FOURMV },
-
-    /* scheme 2 */
-    {    MODE_INTER_LAST_MV,    MODE_INTER_PRIOR_LAST,
-         MODE_INTER_NO_MV,      MODE_INTER_PLUS_MV,
-         MODE_INTRA,            MODE_USING_GOLDEN,
-         MODE_GOLDEN_MV,        MODE_INTER_FOURMV },
-
-    /* scheme 3 */
-    {    MODE_INTER_LAST_MV,    MODE_INTER_PLUS_MV,
-         MODE_INTER_PRIOR_LAST, MODE_INTER_NO_MV,
-         MODE_INTRA,            MODE_USING_GOLDEN,
-         MODE_GOLDEN_MV,        MODE_INTER_FOURMV },
-
-    /* scheme 4 */
-    {    MODE_INTER_LAST_MV,    MODE_INTER_PLUS_MV,
-         MODE_INTER_NO_MV,      MODE_INTER_PRIOR_LAST,
-         MODE_INTRA,            MODE_USING_GOLDEN,
-         MODE_GOLDEN_MV,        MODE_INTER_FOURMV },
-
-    /* scheme 5: No motion vector dominates */
-    {    MODE_INTER_NO_MV,      MODE_INTER_LAST_MV,
-         MODE_INTER_PRIOR_LAST, MODE_INTER_PLUS_MV,
-         MODE_INTRA,            MODE_USING_GOLDEN,
-         MODE_GOLDEN_MV,        MODE_INTER_FOURMV },
-
-    /* scheme 6 */
-    {    MODE_INTER_NO_MV,      MODE_USING_GOLDEN,
-         MODE_INTER_LAST_MV,    MODE_INTER_PRIOR_LAST,
-         MODE_INTER_PLUS_MV,    MODE_INTRA,
-         MODE_GOLDEN_MV,        MODE_INTER_FOURMV },
-
-};
-
-static const uint8_t hilbert_offset[16][2] = {
-    {0,0}, {1,0}, {1,1}, {0,1},
-    {0,2}, {0,3}, {1,3}, {1,2},
-    {2,2}, {2,3}, {3,3}, {3,2},
-    {3,1}, {2,1}, {2,0}, {3,0}
-};
-
-#define MIN_DEQUANT_VAL 2
-
-typedef struct Vp3DecodeContext {
-    AVCodecContext *avctx;
-    int theora, theora_tables;
-    int version;
-    int width, height;
-    int chroma_x_shift, chroma_y_shift;
-    AVFrame golden_frame;
-    AVFrame last_frame;
-    AVFrame current_frame;
-    int keyframe;
-    DSPContext dsp;
-    int flipped_image;
-    int last_slice_end;
-
-    int qps[3];
-    int nqps;
-    int last_qps[3];
-
-    int superblock_count;
-    int y_superblock_width;
-    int y_superblock_height;
-    int y_superblock_count;
-    int c_superblock_width;
-    int c_superblock_height;
-    int c_superblock_count;
-    int u_superblock_start;
-    int v_superblock_start;
-    unsigned char *superblock_coding;
-
-    int macroblock_count;
-    int macroblock_width;
-    int macroblock_height;
-
-    int fragment_count;
-    int fragment_width[2];
-    int fragment_height[2];
-
-    Vp3Fragment *all_fragments;
-    int fragment_start[3];
-    int data_offset[3];
-
-    int8_t (*motion_val[2])[2];
-
-    ScanTable scantable;
-
-    /* tables */
-    uint16_t coded_dc_scale_factor[64];
-    uint32_t coded_ac_scale_factor[64];
-    uint8_t base_matrix[384][64];
-    uint8_t qr_count[2][3];
-    uint8_t qr_size [2][3][64];
-    uint16_t qr_base[2][3][64];
-
-    /**
-     * This is a list of all tokens in bitstream order. Reordering takes place
-     * by pulling from each level during IDCT. As a consequence, IDCT must be
-     * in Hilbert order, making the minimum slice height 64 for 4:2:0 and 32
-     * otherwise. The 32 different tokens with up to 12 bits of extradata are
-     * collapsed into 3 types, packed as follows:
-     *   (from the low to high bits)
-     *
-     * 2 bits: type (0,1,2)
-     *   0: EOB run, 14 bits for run length (12 needed)
-     *   1: zero run, 7 bits for run length
-     *                7 bits for the next coefficient (3 needed)
-     *   2: coefficient, 14 bits (11 needed)
-     *
-     * Coefficients are signed, so are packed in the highest bits for automatic
-     * sign extension.
-     */
-    int16_t *dct_tokens[3][64];
-    int16_t *dct_tokens_base;
-#define TOKEN_EOB(eob_run)              ((eob_run) << 2)
-#define TOKEN_ZERO_RUN(coeff, zero_run) (((coeff) << 9) + ((zero_run) << 2) + 1)
-#define TOKEN_COEFF(coeff)              (((coeff) << 2) + 2)
-
-    /**
-     * number of blocks that contain DCT coefficients at the given level or higher
-     */
-    int num_coded_frags[3][64];
-    int total_num_coded_frags;
-
-    /* this is a list of indexes into the all_fragments array indicating
-     * which of the fragments are coded */
-    int *coded_fragment_list[3];
-
-    VLC dc_vlc[16];
-    VLC ac_vlc_1[16];
-    VLC ac_vlc_2[16];
-    VLC ac_vlc_3[16];
-    VLC ac_vlc_4[16];
-
-    VLC superblock_run_length_vlc;
-    VLC fragment_run_length_vlc;
-    VLC mode_code_vlc;
-    VLC motion_vector_vlc;
-
-    /* these arrays need to be on 16-byte boundaries since SSE2 operations
-     * index into them */
-    DECLARE_ALIGNED(16, int16_t, qmat)[3][2][3][64];     //<qmat[qpi][is_inter][plane]
-
-    /* This table contains superblock_count * 16 entries. Each set of 16
-     * numbers corresponds to the fragment indexes 0..15 of the superblock.
-     * An entry will be -1 to indicate that no entry corresponds to that
-     * index. */
-    int *superblock_fragments;
-
-    /* This is an array that indicates how a particular macroblock
-     * is coded. */
-    unsigned char *macroblock_coding;
-
-    uint8_t edge_emu_buffer[9*2048]; //FIXME dynamic alloc
-    int8_t qscale_table[2048]; //FIXME dynamic alloc (width+15)/16
-
-    /* Huffman decode */
-    int hti;
-    unsigned int hbits;
-    int entries;
-    int huff_code_size;
-    uint32_t huffman_table[80][32][2];
-
-    uint8_t filter_limit_values[64];
-    DECLARE_ALIGNED(8, int, bounding_values_array)[256+2];
-} Vp3DecodeContext;
-
-/************************************************************************
- * VP3 specific functions
- ************************************************************************/
-
-/*
- * This function sets up all of the various blocks mappings:
- * superblocks <-> fragments, macroblocks <-> fragments,
- * superblocks <-> macroblocks
- *
- * Returns 0 is successful; returns 1 if *anything* went wrong.
- */
-static int init_block_mapping(Vp3DecodeContext *s)
-{
-    int sb_x, sb_y, plane;
-    int x, y, i, j = 0;
-
-    for (plane = 0; plane < 3; plane++) {
-        int sb_width    = plane ? s->c_superblock_width  : s->y_superblock_width;
-        int sb_height   = plane ? s->c_superblock_height : s->y_superblock_height;
-        int frag_width  = s->fragment_width[!!plane];
-        int frag_height = s->fragment_height[!!plane];
-
-        for (sb_y = 0; sb_y < sb_height; sb_y++)
-            for (sb_x = 0; sb_x < sb_width; sb_x++)
-                for (i = 0; i < 16; i++) {
-                    x = 4*sb_x + hilbert_offset[i][0];
-                    y = 4*sb_y + hilbert_offset[i][1];
-
-                    if (x < frag_width && y < frag_height)
-                        s->superblock_fragments[j++] = s->fragment_start[plane] + y*frag_width + x;
-                    else
-                        s->superblock_fragments[j++] = -1;
-                }
-    }
-
-    return 0;  /* successful path out */
-}
-
-/*
- * This function sets up the dequantization tables used for a particular
- * frame.
- */
-static void init_dequantizer(Vp3DecodeContext *s, int qpi)
-{
-    int ac_scale_factor = s->coded_ac_scale_factor[s->qps[qpi]];
-    int dc_scale_factor = s->coded_dc_scale_factor[s->qps[qpi]];
-    int i, plane, inter, qri, bmi, bmj, qistart;
-
-    for(inter=0; inter<2; inter++){
-        for(plane=0; plane<3; plane++){
-            int sum=0;
-            for(qri=0; qri<s->qr_count[inter][plane]; qri++){
-                sum+= s->qr_size[inter][plane][qri];
-                if(s->qps[qpi] <= sum)
-                    break;
-            }
-            qistart= sum - s->qr_size[inter][plane][qri];
-            bmi= s->qr_base[inter][plane][qri  ];
-            bmj= s->qr_base[inter][plane][qri+1];
-            for(i=0; i<64; i++){
-                int coeff= (  2*(sum    -s->qps[qpi])*s->base_matrix[bmi][i]
-                            - 2*(qistart-s->qps[qpi])*s->base_matrix[bmj][i]
-                            + s->qr_size[inter][plane][qri])
-                           / (2*s->qr_size[inter][plane][qri]);
-
-                int qmin= 8<<(inter + !i);
-                int qscale= i ? ac_scale_factor : dc_scale_factor;
-
-                s->qmat[qpi][inter][plane][s->dsp.idct_permutation[i]]= av_clip((qscale * coeff)/100 * 4, qmin, 4096);
-            }
-            // all DC coefficients use the same quant so as not to interfere with DC prediction
-            s->qmat[qpi][inter][plane][0] = s->qmat[0][inter][plane][0];
-        }
-    }
-
-    memset(s->qscale_table, (FFMAX(s->qmat[0][0][0][1], s->qmat[0][0][1][1])+8)/16, 512); //FIXME finetune
-}
-
-/*
- * This function initializes the loop filter boundary limits if the frame's
- * quality index is different from the previous frame's.
- *
- * The filter_limit_values may not be larger than 127.
- */
-static void init_loop_filter(Vp3DecodeContext *s)
-{
-    int *bounding_values= s->bounding_values_array+127;
-    int filter_limit;
-    int x;
-    int value;
-
-    filter_limit = s->filter_limit_values[s->qps[0]];
-
-    /* set up the bounding values */
-    memset(s->bounding_values_array, 0, 256 * sizeof(int));
-    for (x = 0; x < filter_limit; x++) {
-        bounding_values[-x] = -x;
-        bounding_values[x] = x;
-    }
-    for (x = value = filter_limit; x < 128 && value; x++, value--) {
-        bounding_values[ x] =  value;
-        bounding_values[-x] = -value;
-    }
-    if (value)
-        bounding_values[128] = value;
-    bounding_values[129] = bounding_values[130] = filter_limit * 0x02020202;
-}
-
-/*
- * This function unpacks all of the superblock/macroblock/fragment coding
- * information from the bitstream.
- */
-static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
-{
-    int superblock_starts[3] = { 0, s->u_superblock_start, s->v_superblock_start };
-    int bit = 0;
-    int current_superblock = 0;
-    int current_run = 0;
-    int num_partial_superblocks = 0;
-
-    int i, j;
-    int current_fragment;
-    int plane;
-
-    if (s->keyframe) {
-        memset(s->superblock_coding, SB_FULLY_CODED, s->superblock_count);
-
-    } else {
-
-        /* unpack the list of partially-coded superblocks */
-        bit = get_bits1(gb);
-        while (current_superblock < s->superblock_count && get_bits_left(gb) > 0) {
-                current_run = get_vlc2(gb,
-                    s->superblock_run_length_vlc.table, 6, 2) + 1;
-                if (current_run == 34)
-                    current_run += get_bits(gb, 12);
-
-            if (current_superblock + current_run > s->superblock_count) {
-                av_log(s->avctx, AV_LOG_ERROR, "Invalid partially coded superblock run length\n");
-                return -1;
-            }
-
-            memset(s->superblock_coding + current_superblock, bit, current_run);
-
-            current_superblock += current_run;
-            if (bit)
-                num_partial_superblocks += current_run;
-
-            if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN)
-                bit = get_bits1(gb);
-            else
-                bit ^= 1;
-        }
-
-        /* unpack the list of fully coded superblocks if any of the blocks were
-         * not marked as partially coded in the previous step */
-        if (num_partial_superblocks < s->superblock_count) {
-            int superblocks_decoded = 0;
-
-            current_superblock = 0;
-            bit = get_bits1(gb);
-            while (superblocks_decoded < s->superblock_count - num_partial_superblocks
-                   && get_bits_left(gb) > 0) {
-                        current_run = get_vlc2(gb,
-                            s->superblock_run_length_vlc.table, 6, 2) + 1;
-                        if (current_run == 34)
-                            current_run += get_bits(gb, 12);
-
-                for (j = 0; j < current_run; current_superblock++) {
-                    if (current_superblock >= s->superblock_count) {
-                        av_log(s->avctx, AV_LOG_ERROR, "Invalid fully coded superblock run length\n");
-                        return -1;
-                    }
-
-                /* skip any superblocks already marked as partially coded */
-                if (s->superblock_coding[current_superblock] == SB_NOT_CODED) {
-                    s->superblock_coding[current_superblock] = 2*bit;
-                    j++;
-                }
-                }
-                superblocks_decoded += current_run;
-
-                if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN)
-                    bit = get_bits1(gb);
-                else
-                    bit ^= 1;
-            }
-        }
-
-        /* if there were partial blocks, initialize bitstream for
-         * unpacking fragment codings */
-        if (num_partial_superblocks) {
-
-            current_run = 0;
-            bit = get_bits1(gb);
-            /* toggle the bit because as soon as the first run length is
-             * fetched the bit will be toggled again */
-            bit ^= 1;
-        }
-    }
-
-    /* figure out which fragments are coded; iterate through each
-     * superblock (all planes) */
-    s->total_num_coded_frags = 0;
-    memset(s->macroblock_coding, MODE_COPY, s->macroblock_count);
-
-    for (plane = 0; plane < 3; plane++) {
-        int sb_start = superblock_starts[plane];
-        int sb_end = sb_start + (plane ? s->c_superblock_count : s->y_superblock_count);
-        int num_coded_frags = 0;
-
-    for (i = sb_start; i < sb_end && get_bits_left(gb) > 0; i++) {
-
-        /* iterate through all 16 fragments in a superblock */
-        for (j = 0; j < 16; j++) {
-
-            /* if the fragment is in bounds, check its coding status */
-            current_fragment = s->superblock_fragments[i * 16 + j];
-            if (current_fragment != -1) {
-                int coded = s->superblock_coding[i];
-
-                if (s->superblock_coding[i] == SB_PARTIALLY_CODED) {
-
-                    /* fragment may or may not be coded; this is the case
-                     * that cares about the fragment coding runs */
-                    if (current_run-- == 0) {
-                        bit ^= 1;
-                        current_run = get_vlc2(gb,
-                            s->fragment_run_length_vlc.table, 5, 2);
-                    }
-                    coded = bit;
-                }
-
-                    if (coded) {
-                        /* default mode; actual mode will be decoded in
-                         * the next phase */
-                        s->all_fragments[current_fragment].coding_method =
-                            MODE_INTER_NO_MV;
-                        s->coded_fragment_list[plane][num_coded_frags++] =
-                            current_fragment;
-                    } else {
-                        /* not coded; copy this fragment from the prior frame */
-                        s->all_fragments[current_fragment].coding_method =
-                            MODE_COPY;
-                    }
-            }
-        }
-    }
-        s->total_num_coded_frags += num_coded_frags;
-        for (i = 0; i < 64; i++)
-            s->num_coded_frags[plane][i] = num_coded_frags;
-        if (plane < 2)
-            s->coded_fragment_list[plane+1] = s->coded_fragment_list[plane] + num_coded_frags;
-    }
-    return 0;
-}
-
-/*
- * This function unpacks all the coding mode data for individual macroblocks
- * from the bitstream.
- */
-static int unpack_modes(Vp3DecodeContext *s, GetBitContext *gb)
-{
-    int i, j, k, sb_x, sb_y;
-    int scheme;
-    int current_macroblock;
-    int current_fragment;
-    int coding_mode;
-    int custom_mode_alphabet[CODING_MODE_COUNT];
-    const int *alphabet;
-    Vp3Fragment *frag;
-
-    if (s->keyframe) {
-        for (i = 0; i < s->fragment_count; i++)
-            s->all_fragments[i].coding_method = MODE_INTRA;
-
-    } else {
-
-        /* fetch the mode coding scheme for this frame */
-        scheme = get_bits(gb, 3);
-
-        /* is it a custom coding scheme? */
-        if (scheme == 0) {
-            for (i = 0; i < 8; i++)
-                custom_mode_alphabet[i] = MODE_INTER_NO_MV;
-            for (i = 0; i < 8; i++)
-                custom_mode_alphabet[get_bits(gb, 3)] = i;
-            alphabet = custom_mode_alphabet;
-        } else
-            alphabet = ModeAlphabet[scheme-1];
-
-        /* iterate through all of the macroblocks that contain 1 or more
-         * coded fragments */
-        for (sb_y = 0; sb_y < s->y_superblock_height; sb_y++) {
-            for (sb_x = 0; sb_x < s->y_superblock_width; sb_x++) {
-                if (get_bits_left(gb) <= 0)
-                    return -1;
-
-            for (j = 0; j < 4; j++) {
-                int mb_x = 2*sb_x +   (j>>1);
-                int mb_y = 2*sb_y + (((j>>1)+j)&1);
-                current_macroblock = mb_y * s->macroblock_width + mb_x;
-
-                if (mb_x >= s->macroblock_width || mb_y >= s->macroblock_height)
-                    continue;
-
-#define BLOCK_X (2*mb_x + (k&1))
-#define BLOCK_Y (2*mb_y + (k>>1))
-                /* coding modes are only stored if the macroblock has at least one
-                 * luma block coded, otherwise it must be INTER_NO_MV */
-                for (k = 0; k < 4; k++) {
-                    current_fragment = BLOCK_Y*s->fragment_width[0] + BLOCK_X;
-                    if (s->all_fragments[current_fragment].coding_method != MODE_COPY)
-                        break;
-                }
-                if (k == 4) {
-                    s->macroblock_coding[current_macroblock] = MODE_INTER_NO_MV;
-                    continue;
-                }
-
-                /* mode 7 means get 3 bits for each coding mode */
-                if (scheme == 7)
-                    coding_mode = get_bits(gb, 3);
-                else
-                    coding_mode = alphabet
-                        [get_vlc2(gb, s->mode_code_vlc.table, 3, 3)];
-
-                s->macroblock_coding[current_macroblock] = coding_mode;
-                for (k = 0; k < 4; k++) {
-                    frag = s->all_fragments + BLOCK_Y*s->fragment_width[0] + BLOCK_X;
-                    if (frag->coding_method != MODE_COPY)
-                        frag->coding_method = coding_mode;
-                }
-
-#define SET_CHROMA_MODES \
-    if (frag[s->fragment_start[1]].coding_method != MODE_COPY) \
-        frag[s->fragment_start[1]].coding_method = coding_mode;\
-    if (frag[s->fragment_start[2]].coding_method != MODE_COPY) \
-        frag[s->fragment_start[2]].coding_method = coding_mode;
-
-                if (s->chroma_y_shift) {
-                    frag = s->all_fragments + mb_y*s->fragment_width[1] + mb_x;
-                    SET_CHROMA_MODES
-                } else if (s->chroma_x_shift) {
-                    frag = s->all_fragments + 2*mb_y*s->fragment_width[1] + mb_x;
-                    for (k = 0; k < 2; k++) {
-                        SET_CHROMA_MODES
-                        frag += s->fragment_width[1];
-                    }
-                } else {
-                    for (k = 0; k < 4; k++) {
-                        frag = s->all_fragments + BLOCK_Y*s->fragment_width[1] + BLOCK_X;
-                        SET_CHROMA_MODES
-                    }
-                }
-            }
-            }
-        }
-    }
-
-    return 0;
-}
-
-/*
- * This function unpacks all the motion vectors for the individual
- * macroblocks from the bitstream.
- */
-static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
-{
-    int j, k, sb_x, sb_y;
-    int coding_mode;
-    int motion_x[4];
-    int motion_y[4];
-    int last_motion_x = 0;
-    int last_motion_y = 0;
-    int prior_last_motion_x = 0;
-    int prior_last_motion_y = 0;
-    int current_macroblock;
-    int current_fragment;
-    int frag;
-
-    if (s->keyframe)
-        return 0;
-
-    /* coding mode 0 is the VLC scheme; 1 is the fixed code scheme */
-    coding_mode = get_bits1(gb);
-
-    /* iterate through all of the macroblocks that contain 1 or more
-     * coded fragments */
-    for (sb_y = 0; sb_y < s->y_superblock_height; sb_y++) {
-        for (sb_x = 0; sb_x < s->y_superblock_width; sb_x++) {
-            if (get_bits_left(gb) <= 0)
-                return -1;
-
-        for (j = 0; j < 4; j++) {
-            int mb_x = 2*sb_x +   (j>>1);
-            int mb_y = 2*sb_y + (((j>>1)+j)&1);
-            current_macroblock = mb_y * s->macroblock_width + mb_x;
-
-            if (mb_x >= s->macroblock_width || mb_y >= s->macroblock_height ||
-                (s->macroblock_coding[current_macroblock] == MODE_COPY))
-                continue;
-
-            switch (s->macroblock_coding[current_macroblock]) {
-
-            case MODE_INTER_PLUS_MV:
-            case MODE_GOLDEN_MV:
-                /* all 6 fragments use the same motion vector */
-                if (coding_mode == 0) {
-                    motion_x[0] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
-                    motion_y[0] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
-                } else {
-                    motion_x[0] = fixed_motion_vector_table[get_bits(gb, 6)];
-                    motion_y[0] = fixed_motion_vector_table[get_bits(gb, 6)];
-                }
-
-                /* vector maintenance, only on MODE_INTER_PLUS_MV */
-                if (s->macroblock_coding[current_macroblock] ==
-                    MODE_INTER_PLUS_MV) {
-                    prior_last_motion_x = last_motion_x;
-                    prior_last_motion_y = last_motion_y;
-                    last_motion_x = motion_x[0];
-                    last_motion_y = motion_y[0];
-                }
-                break;
-
-            case MODE_INTER_FOURMV:
-                /* vector maintenance */
-                prior_last_motion_x = last_motion_x;
-                prior_last_motion_y = last_motion_y;
-
-                /* fetch 4 vectors from the bitstream, one for each
-                 * Y fragment, then average for the C fragment vectors */
-                for (k = 0; k < 4; k++) {
-                    current_fragment = BLOCK_Y*s->fragment_width[0] + BLOCK_X;
-                    if (s->all_fragments[current_fragment].coding_method != MODE_COPY) {
-                        if (coding_mode == 0) {
-                            motion_x[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
-                            motion_y[k] = motion_vector_table[get_vlc2(gb, s->motion_vector_vlc.table, 6, 2)];
-                        } else {
-                            motion_x[k] = fixed_motion_vector_table[get_bits(gb, 6)];
-                            motion_y[k] = fixed_motion_vector_table[get_bits(gb, 6)];
-                        }
-                        last_motion_x = motion_x[k];
-                        last_motion_y = motion_y[k];
-                    } else {
-                        motion_x[k] = 0;
-                        motion_y[k] = 0;
-                    }
-                }
-                break;
-
-            case MODE_INTER_LAST_MV:
-                /* all 6 fragments use the last motion vector */
-                motion_x[0] = last_motion_x;
-                motion_y[0] = last_motion_y;
-
-                /* no vector maintenance (last vector remains the
-                 * last vector) */
-                break;
-
-            case MODE_INTER_PRIOR_LAST:
-                /* all 6 fragments use the motion vector prior to the
-                 * last motion vector */
-                motion_x[0] = prior_last_motion_x;
-                motion_y[0] = prior_last_motion_y;
-
-                /* vector maintenance */
-                prior_last_motion_x = last_motion_x;
-                prior_last_motion_y = last_motion_y;
-                last_motion_x = motion_x[0];
-                last_motion_y = motion_y[0];
-                break;
-
-            default:
-                /* covers intra, inter without MV, golden without MV */
-                motion_x[0] = 0;
-                motion_y[0] = 0;
-
-                /* no vector maintenance */
-                break;
-            }
-
-            /* assign the motion vectors to the correct fragments */
-            for (k = 0; k < 4; k++) {
-                current_fragment =
-                    BLOCK_Y*s->fragment_width[0] + BLOCK_X;
-                if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
-                    s->motion_val[0][current_fragment][0] = motion_x[k];
-                    s->motion_val[0][current_fragment][1] = motion_y[k];
-                } else {
-                    s->motion_val[0][current_fragment][0] = motion_x[0];
-                    s->motion_val[0][current_fragment][1] = motion_y[0];
-                }
-            }
-
-            if (s->chroma_y_shift) {
-                if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
-                    motion_x[0] = RSHIFT(motion_x[0] + motion_x[1] + motion_x[2] + motion_x[3], 2);
-                    motion_y[0] = RSHIFT(motion_y[0] + motion_y[1] + motion_y[2] + motion_y[3], 2);
-                }
-                motion_x[0] = (motion_x[0]>>1) | (motion_x[0]&1);
-                motion_y[0] = (motion_y[0]>>1) | (motion_y[0]&1);
-                frag = mb_y*s->fragment_width[1] + mb_x;
-                s->motion_val[1][frag][0] = motion_x[0];
-                s->motion_val[1][frag][1] = motion_y[0];
-            } else if (s->chroma_x_shift) {
-                if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
-                    motion_x[0] = RSHIFT(motion_x[0] + motion_x[1], 1);
-                    motion_y[0] = RSHIFT(motion_y[0] + motion_y[1], 1);
-                    motion_x[1] = RSHIFT(motion_x[2] + motion_x[3], 1);
-                    motion_y[1] = RSHIFT(motion_y[2] + motion_y[3], 1);
-                } else {
-                    motion_x[1] = motion_x[0];
-                    motion_y[1] = motion_y[0];
-                }
-                motion_x[0] = (motion_x[0]>>1) | (motion_x[0]&1);
-                motion_x[1] = (motion_x[1]>>1) | (motion_x[1]&1);
-
-                frag = 2*mb_y*s->fragment_width[1] + mb_x;
-                for (k = 0; k < 2; k++) {
-                    s->motion_val[1][frag][0] = motion_x[k];
-                    s->motion_val[1][frag][1] = motion_y[k];
-                    frag += s->fragment_width[1];
-                }
-            } else {
-                for (k = 0; k < 4; k++) {
-                    frag = BLOCK_Y*s->fragment_width[1] + BLOCK_X;
-                    if (s->macroblock_coding[current_macroblock] == MODE_INTER_FOURMV) {
-                        s->motion_val[1][frag][0] = motion_x[k];
-                        s->motion_val[1][frag][1] = motion_y[k];
-                    } else {
-                        s->motion_val[1][frag][0] = motion_x[0];
-                        s->motion_val[1][frag][1] = motion_y[0];
-                    }
-                }
-            }
-        }
-        }
-    }
-
-    return 0;
-}
-
-static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
-{
-    int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;
-    int num_blocks = s->total_num_coded_frags;
-
-    for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {
-        i = blocks_decoded = num_blocks_at_qpi = 0;
-
-        bit = get_bits1(gb);
-
-        do {
-            run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;
-            if (run_length == 34)
-                run_length += get_bits(gb, 12);
-            blocks_decoded += run_length;
-
-            if (!bit)
-                num_blocks_at_qpi += run_length;
-
-            for (j = 0; j < run_length; i++) {
-                if (i >= s->total_num_coded_frags)
-                    return -1;
-
-                if (s->all_fragments[s->coded_fragment_list[0][i]].qpi == qpi) {
-                    s->all_fragments[s->coded_fragment_list[0][i]].qpi += bit;
-                    j++;
-                }
-            }
-
-            if (run_length == MAXIMUM_LONG_BIT_RUN)
-                bit = get_bits1(gb);
-            else
-                bit ^= 1;
-        } while (blocks_decoded < num_blocks && get_bits_left(gb) > 0);
-
-        num_blocks -= num_blocks_at_qpi;
-    }
-
-    return 0;
-}
-
-/*
- * This function is called by unpack_dct_coeffs() to extract the VLCs from
- * the bitstream. The VLCs encode tokens which are used to unpack DCT
- * data. This function unpacks all the VLCs for either the Y plane or both
- * C planes, and is called for DC coefficients or different AC coefficient
- * levels (since different coefficient types require different VLC tables.
- *
- * This function returns a residual eob run. E.g, if a particular token gave
- * instructions to EOB the next 5 fragments and there were only 2 fragments
- * left in the current fragment range, 3 would be returned so that it could
- * be passed into the next call to this same function.
- */
-static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
-                        VLC *table, int coeff_index,
-                        int plane,
-                        int eob_run)
-{
-    int i, j = 0;
-    int token;
-    int zero_run = 0;
-    DCTELEM coeff = 0;
-    int bits_to_get;
-    int blocks_ended;
-    int coeff_i = 0;
-    int num_coeffs = s->num_coded_frags[plane][coeff_index];
-    int16_t *dct_tokens = s->dct_tokens[plane][coeff_index];
-
-    /* local references to structure members to avoid repeated deferences */
-    int *coded_fragment_list = s->coded_fragment_list[plane];
-    Vp3Fragment *all_fragments = s->all_fragments;
-    VLC_TYPE (*vlc_table)[2] = table->table;
-
-    if (num_coeffs < 0)
-        av_log(s->avctx, AV_LOG_ERROR, "Invalid number of coefficents at level %d\n", coeff_index);
-
-    if (eob_run > num_coeffs) {
-        coeff_i = blocks_ended = num_coeffs;
-        eob_run -= num_coeffs;
-    } else {
-        coeff_i = blocks_ended = eob_run;
-        eob_run = 0;
-    }
-
-    // insert fake EOB token to cover the split between planes or zzi
-    if (blocks_ended)
-        dct_tokens[j++] = blocks_ended << 2;
-
-    while (coeff_i < num_coeffs && get_bits_left(gb) > 0) {
-            /* decode a VLC into a token */
-            token = get_vlc2(gb, vlc_table, 11, 3);
-            /* use the token to get a zero run, a coefficient, and an eob run */
-            if (token <= 6) {
-                eob_run = eob_run_base[token];
-                if (eob_run_get_bits[token])
-                    eob_run += get_bits(gb, eob_run_get_bits[token]);
-
-                // record only the number of blocks ended in this plane,
-                // any spill will be recorded in the next plane.
-                if (eob_run > num_coeffs - coeff_i) {
-                    dct_tokens[j++] = TOKEN_EOB(num_coeffs - coeff_i);
-                    blocks_ended   += num_coeffs - coeff_i;
-                    eob_run        -= num_coeffs - coeff_i;
-                    coeff_i         = num_coeffs;
-                } else {
-                    dct_tokens[j++] = TOKEN_EOB(eob_run);
-                    blocks_ended   += eob_run;
-                    coeff_i        += eob_run;
-                    eob_run = 0;
-                }
-            } else {
-                bits_to_get = coeff_get_bits[token];
-                if (bits_to_get)
-                    bits_to_get = get_bits(gb, bits_to_get);
-                coeff = coeff_tables[token][bits_to_get];
-
-                zero_run = zero_run_base[token];
-                if (zero_run_get_bits[token])
-                    zero_run += get_bits(gb, zero_run_get_bits[token]);
-
-                if (zero_run) {
-                    dct_tokens[j++] = TOKEN_ZERO_RUN(coeff, zero_run);
-                } else {
-                    // Save DC into the fragment structure. DC prediction is
-                    // done in raster order, so the actual DC can't be in with
-                    // other tokens. We still need the token in dct_tokens[]
-                    // however, or else the structure collapses on itself.
-                    if (!coeff_index)
-                        all_fragments[coded_fragment_list[coeff_i]].dc = coeff;
-
-                    dct_tokens[j++] = TOKEN_COEFF(coeff);
-                }
-
-                if (coeff_index + zero_run > 64) {
-                    av_log(s->avctx, AV_LOG_DEBUG, "Invalid zero run of %d with"
-                           " %d coeffs left\n", zero_run, 64-coeff_index);
-                    zero_run = 64 - coeff_index;
-                }
-
-                // zero runs code multiple coefficients,
-                // so don't try to decode coeffs for those higher levels
-                for (i = coeff_index+1; i <= coeff_index+zero_run; i++)
-                    s->num_coded_frags[plane][i]--;
-                coeff_i++;
-            }
-    }
-
-    if (blocks_ended > s->num_coded_frags[plane][coeff_index])
-        av_log(s->avctx, AV_LOG_ERROR, "More blocks ended than coded!\n");
-
-    // decrement the number of blocks that have higher coeffecients for each
-    // EOB run at this level
-    if (blocks_ended)
-        for (i = coeff_index+1; i < 64; i++)
-            s->num_coded_frags[plane][i] -= blocks_ended;
-
-    // setup the next buffer
-    if (plane < 2)
-        s->dct_tokens[plane+1][coeff_index] = dct_tokens + j;
-    else if (coeff_index < 63)
-        s->dct_tokens[0][coeff_index+1] = dct_tokens + j;
-
-    return eob_run;
-}
-
-static void reverse_dc_prediction(Vp3DecodeContext *s,
-                                  int first_fragment,
-                                  int fragment_width,
-                                  int fragment_height);
-/*
- * This function unpacks all of the DCT coefficient data from the
- * bitstream.
- */
-static int unpack_dct_coeffs(Vp3DecodeContext *s, GetBitContext *gb)
-{
-    int i;
-    int dc_y_table;
-    int dc_c_table;
-    int ac_y_table;
-    int ac_c_table;
-    int residual_eob_run = 0;
-    VLC *y_tables[64];
-    VLC *c_tables[64];
-
-    s->dct_tokens[0][0] = s->dct_tokens_base;
-
-    /* fetch the DC table indexes */
-    dc_y_table = get_bits(gb, 4);
-    dc_c_table = get_bits(gb, 4);
-
-    /* unpack the Y plane DC coefficients */
-    residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_y_table], 0,
-        0, residual_eob_run);
-
-    /* reverse prediction of the Y-plane DC coefficients */
-    reverse_dc_prediction(s, 0, s->fragment_width[0], s->fragment_height[0]);
-
-    /* unpack the C plane DC coefficients */
-    residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_c_table], 0,
-        1, residual_eob_run);
-    residual_eob_run = unpack_vlcs(s, gb, &s->dc_vlc[dc_c_table], 0,
-        2, residual_eob_run);
-
-    /* reverse prediction of the C-plane DC coefficients */
-    if (!(s->avctx->flags & CODEC_FLAG_GRAY))
-    {
-        reverse_dc_prediction(s, s->fragment_start[1],
-            s->fragment_width[1], s->fragment_height[1]);
-        reverse_dc_prediction(s, s->fragment_start[2],
-            s->fragment_width[1], s->fragment_height[1]);
-    }
-
-    /* fetch the AC table indexes */
-    ac_y_table = get_bits(gb, 4);
-    ac_c_table = get_bits(gb, 4);
-
-    /* build tables of AC VLC tables */
-    for (i = 1; i <= 5; i++) {
-        y_tables[i] = &s->ac_vlc_1[ac_y_table];
-        c_tables[i] = &s->ac_vlc_1[ac_c_table];
-    }
-    for (i = 6; i <= 14; i++) {
-        y_tables[i] = &s->ac_vlc_2[ac_y_table];
-        c_tables[i] = &s->ac_vlc_2[ac_c_table];
-    }
-    for (i = 15; i <= 27; i++) {
-        y_tables[i] = &s->ac_vlc_3[ac_y_table];
-        c_tables[i] = &s->ac_vlc_3[ac_c_table];
-    }
-    for (i = 28; i <= 63; i++) {
-        y_tables[i] = &s->ac_vlc_4[ac_y_table];
-        c_tables[i] = &s->ac_vlc_4[ac_c_table];
-    }
-
-    /* decode all AC coefficents */
-    for (i = 1; i <= 63; i++) {
-            residual_eob_run = unpack_vlcs(s, gb, y_tables[i], i,
-                0, residual_eob_run);
-
-            residual_eob_run = unpack_vlcs(s, gb, c_tables[i], i,
-                1, residual_eob_run);
-            residual_eob_run = unpack_vlcs(s, gb, c_tables[i], i,
-                2, residual_eob_run);
-    }
-
-    return 0;
-}
-
-/*
- * This function reverses the DC prediction for each coded fragment in
- * the frame. Much of this function is adapted directly from the original
- * VP3 source code.
- */
-#define COMPATIBLE_FRAME(x) \
-  (compatible_frame[s->all_fragments[x].coding_method] == current_frame_type)
-#define DC_COEFF(u) s->all_fragments[u].dc
-
-static void reverse_dc_prediction(Vp3DecodeContext *s,
-                                  int first_fragment,
-                                  int fragment_width,
-                                  int fragment_height)
-{
-
-#define PUL 8
-#define PU 4
-#define PUR 2
-#define PL 1
-
-    int x, y;
-    int i = first_fragment;
-
-    int predicted_dc;
-
-    /* DC values for the left, up-left, up, and up-right fragments */
-    int vl, vul, vu, vur;
-
-    /* indexes for the left, up-left, up, and up-right fragments */
-    int l, ul, u, ur;
-
-    /*
-     * The 6 fields mean:
-     *   0: up-left multiplier
-     *   1: up multiplier
-     *   2: up-right multiplier
-     *   3: left multiplier
-     */
-    static const int predictor_transform[16][4] = {
-        {  0,  0,  0,  0},
-        {  0,  0,  0,128},        // PL
-        {  0,  0,128,  0},        // PUR
-        {  0,  0, 53, 75},        // PUR|PL
-        {  0,128,  0,  0},        // PU
-        {  0, 64,  0, 64},        // PU|PL
-        {  0,128,  0,  0},        // PU|PUR
-        {  0,  0, 53, 75},        // PU|PUR|PL
-        {128,  0,  0,  0},        // PUL
-        {  0,  0,  0,128},        // PUL|PL
-        { 64,  0, 64,  0},        // PUL|PUR
-        {  0,  0, 53, 75},        // PUL|PUR|PL
-        {  0,128,  0,  0},        // PUL|PU
-       {-104,116,  0,116},        // PUL|PU|PL
-        { 24, 80, 24,  0},        // PUL|PU|PUR
-       {-104,116,  0,116}         // PUL|PU|PUR|PL
-    };
-
-    /* This table shows which types of blocks can use other blocks for
-     * prediction. For example, INTRA is the only mode in this table to
-     * have a frame number of 0. That means INTRA blocks can only predict
-     * from other INTRA blocks. There are 2 golden frame coding types;
-     * blocks encoding in these modes can only predict from other blocks
-     * that were encoded with these 1 of these 2 modes. */
-    static const unsigned char compatible_frame[9] = {
-        1,    /* MODE_INTER_NO_MV */
-        0,    /* MODE_INTRA */
-        1,    /* MODE_INTER_PLUS_MV */
-        1,    /* MODE_INTER_LAST_MV */
-        1,    /* MODE_INTER_PRIOR_MV */
-        2,    /* MODE_USING_GOLDEN */
-        2,    /* MODE_GOLDEN_MV */
-        1,    /* MODE_INTER_FOUR_MV */
-        3     /* MODE_COPY */
-    };
-    int current_frame_type;
-
-    /* there is a last DC predictor for each of the 3 frame types */
-    short last_dc[3];
-
-    int transform = 0;
-
-    vul = vu = vur = vl = 0;
-    last_dc[0] = last_dc[1] = last_dc[2] = 0;
-
-    /* for each fragment row... */
-    for (y = 0; y < fragment_height; y++) {
-
-        /* for each fragment in a row... */
-        for (x = 0; x < fragment_width; x++, i++) {
-
-            /* reverse prediction if this block was coded */
-            if (s->all_fragments[i].coding_method != MODE_COPY) {
-
-                current_frame_type =
-                    compatible_frame[s->all_fragments[i].coding_method];
-
-                transform= 0;
-                if(x){
-                    l= i-1;
-                    vl = DC_COEFF(l);
-                    if(COMPATIBLE_FRAME(l))
-                        transform |= PL;
-                }
-                if(y){
-                    u= i-fragment_width;
-                    vu = DC_COEFF(u);
-                    if(COMPATIBLE_FRAME(u))
-                        transform |= PU;
-                    if(x){
-                        ul= i-fragment_width-1;
-                        vul = DC_COEFF(ul);
-                        if(COMPATIBLE_FRAME(ul))
-                            transform |= PUL;
-                    }
-                    if(x + 1 < fragment_width){
-                        ur= i-fragment_width+1;
-                        vur = DC_COEFF(ur);
-                        if(COMPATIBLE_FRAME(ur))
-                            transform |= PUR;
-                    }
-                }
-
-                if (transform == 0) {
-
-                    /* if there were no fragments to predict from, use last
-                     * DC saved */
-                    predicted_dc = last_dc[current_frame_type];
-                } else {
-
-                    /* apply the appropriate predictor transform */
-                    predicted_dc =
-                        (predictor_transform[transform][0] * vul) +
-                        (predictor_transform[transform][1] * vu) +
-                        (predictor_transform[transform][2] * vur) +
-                        (predictor_transform[transform][3] * vl);
-
-                    predicted_dc /= 128;
-
-                    /* check for outranging on the [ul u l] and
-                     * [ul u ur l] predictors */
-                    if ((transform == 15) || (transform == 13)) {
-                        if (FFABS(predicted_dc - vu) > 128)
-                            predicted_dc = vu;
-                        else if (FFABS(predicted_dc - vl) > 128)
-                            predicted_dc = vl;
-                        else if (FFABS(predicted_dc - vul) > 128)
-                            predicted_dc = vul;
-                    }
-                }
-
-                /* at long last, apply the predictor */
-                DC_COEFF(i) += predicted_dc;
-                /* save the DC */
-                last_dc[current_frame_type] = DC_COEFF(i);
-            }
-        }
-    }
-}
-
-static void apply_loop_filter(Vp3DecodeContext *s, int plane, int ystart, int yend)
-{
-    int x, y;
-    int *bounding_values= s->bounding_values_array+127;
-
-    int width           = s->fragment_width[!!plane];
-    int height          = s->fragment_height[!!plane];
-    int fragment        = s->fragment_start        [plane] + ystart * width;
-    int stride          = s->current_frame.linesize[plane];
-    uint8_t *plane_data = s->current_frame.data    [plane];
-    if (!s->flipped_image) stride = -stride;
-    plane_data += s->data_offset[plane] + 8*ystart*stride;
-
-    for (y = ystart; y < yend; y++) {
-
-        for (x = 0; x < width; x++) {
-            /* This code basically just deblocks on the edges of coded blocks.
-             * However, it has to be much more complicated because of the
-             * braindamaged deblock ordering used in VP3/Theora. Order matters
-             * because some pixels get filtered twice. */
-            if( s->all_fragments[fragment].coding_method != MODE_COPY )
-            {
-                /* do not perform left edge filter for left columns frags */
-                if (x > 0) {
-                    s->dsp.vp3_h_loop_filter(
-                        plane_data + 8*x,
-                        stride, bounding_values);
-                }
-
-                /* do not perform top edge filter for top row fragments */
-                if (y > 0) {
-                    s->dsp.vp3_v_loop_filter(
-                        plane_data + 8*x,
-                        stride, bounding_values);
-                }
-
-                /* do not perform right edge filter for right column
-                 * fragments or if right fragment neighbor is also coded
-                 * in this frame (it will be filtered in next iteration) */
-                if ((x < width - 1) &&
-                    (s->all_fragments[fragment + 1].coding_method == MODE_COPY)) {
-                    s->dsp.vp3_h_loop_filter(
-                        plane_data + 8*x + 8,
-                        stride, bounding_values);
-                }
-
-                /* do not perform bottom edge filter for bottom row
-                 * fragments or if bottom fragment neighbor is also coded
-                 * in this frame (it will be filtered in the next row) */
-                if ((y < height - 1) &&
-                    (s->all_fragments[fragment + width].coding_method == MODE_COPY)) {
-                    s->dsp.vp3_v_loop_filter(
-                        plane_data + 8*x + 8*stride,
-                        stride, bounding_values);
-                }
-            }
-
-            fragment++;
-        }
-        plane_data += 8*stride;
-    }
-}
-
-/**
- * Pulls DCT tokens from the 64 levels to decode and dequant the coefficients
- * for the next block in coding order
- */
-static inline int vp3_dequant(Vp3DecodeContext *s, Vp3Fragment *frag,
-                              int plane, int inter, DCTELEM block[64])
-{
-    int16_t *dequantizer = s->qmat[frag->qpi][inter][plane];
-    uint8_t *perm = s->scantable.permutated;
-    int i = 0;
-
-    do {
-        int token = *s->dct_tokens[plane][i];
-        switch (token & 3) {
-        case 0: // EOB
-            if (--token < 4) // 0-3 are token types, so the EOB run must now be 0
-                s->dct_tokens[plane][i]++;
-            else
-                *s->dct_tokens[plane][i] = token & ~3;
-            goto end;
-        case 1: // zero run
-            s->dct_tokens[plane][i]++;
-            i += (token >> 2) & 0x7f;
-            block[perm[i]] = (token >> 9) * dequantizer[perm[i]];
-            i++;
-            break;
-        case 2: // coeff
-            block[perm[i]] = (token >> 2) * dequantizer[perm[i]];
-            s->dct_tokens[plane][i++]++;
-            break;
-        default: // shouldn't happen
-            return i;
-        }
-    } while (i < 64);
-end:
-    // the actual DC+prediction is in the fragment structure
-    block[0] = frag->dc * s->qmat[0][inter][plane][0];
-    return i;
-}
-
-/**
- * called when all pixels up to row y are complete
- */
-static void vp3_draw_horiz_band(Vp3DecodeContext *s, int y)
-{
-    int h, cy;
-    int offset[4];
-
-    if(s->avctx->draw_horiz_band==NULL)
-        return;
-
-    h= y - s->last_slice_end;
-    y -= h;
-
-    if (!s->flipped_image) {
-        if (y == 0)
-            h -= s->height - s->avctx->height;  // account for non-mod16
-        y = s->height - y - h;
-    }
-
-    cy = y >> 1;
-    offset[0] = s->current_frame.linesize[0]*y;
-    offset[1] = s->current_frame.linesize[1]*cy;
-    offset[2] = s->current_frame.linesize[2]*cy;
-    offset[3] = 0;
-
-    emms_c();
-    s->avctx->draw_horiz_band(s->avctx, &s->current_frame, offset, y, 3, h);
-    s->last_slice_end= y + h;
-}
-
-/*
- * Perform the final rendering for a particular slice of data.
- * The slice number ranges from 0..(c_superblock_height - 1).
- */
-static void render_slice(Vp3DecodeContext *s, int slice)
-{
-    int x, y, i, j;
-    LOCAL_ALIGNED_16(DCTELEM, block, [64]);
-    int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef;
-    int motion_halfpel_index;
-    uint8_t *motion_source;
-    int plane, first_pixel;
-
-    if (slice >= s->c_superblock_height)
-        return;
-
-    for (plane = 0; plane < 3; plane++) {
-        uint8_t *output_plane = s->current_frame.data    [plane] + s->data_offset[plane];
-        uint8_t *  last_plane = s->   last_frame.data    [plane] + s->data_offset[plane];
-        uint8_t *golden_plane = s-> golden_frame.data    [plane] + s->data_offset[plane];
-        int stride            = s->current_frame.linesize[plane];
-        int plane_width       = s->width  >> (plane && s->chroma_x_shift);
-        int plane_height      = s->height >> (plane && s->chroma_y_shift);
-        int8_t (*motion_val)[2] = s->motion_val[!!plane];
-
-        int sb_x, sb_y        = slice << (!plane && s->chroma_y_shift);
-        int slice_height      = sb_y + 1 + (!plane && s->chroma_y_shift);
-        int slice_width       = plane ? s->c_superblock_width : s->y_superblock_width;
-
-        int fragment_width    = s->fragment_width[!!plane];
-        int fragment_height   = s->fragment_height[!!plane];
-        int fragment_start    = s->fragment_start[plane];
-
-        if (!s->flipped_image) stride = -stride;
-        if (CONFIG_GRAY && plane && (s->avctx->flags & CODEC_FLAG_GRAY))
-            continue;
-
-
-        if(FFABS(stride) > 2048)
-            return; //various tables are fixed size
-
-        /* for each superblock row in the slice (both of them)... */
-        for (; sb_y < slice_height; sb_y++) {
-
-            /* for each superblock in a row... */
-            for (sb_x = 0; sb_x < slice_width; sb_x++) {
-
-                /* for each block in a superblock... */
-                for (j = 0; j < 16; j++) {
-                    x = 4*sb_x + hilbert_offset[j][0];
-                    y = 4*sb_y + hilbert_offset[j][1];
-
-                    i = fragment_start + y*fragment_width + x;
-
-                    // bounds check
-                    if (x >= fragment_width || y >= fragment_height)
-                        continue;
-
-                first_pixel = 8*y*stride + 8*x;
-
-                /* transform if this block was coded */
-                if (s->all_fragments[i].coding_method != MODE_COPY) {
-                    if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) ||
-                        (s->all_fragments[i].coding_method == MODE_GOLDEN_MV))
-                        motion_source= golden_plane;
-                    else
-                        motion_source= last_plane;
-
-                    motion_source += first_pixel;
-                    motion_halfpel_index = 0;
-
-                    /* sort out the motion vector if this fragment is coded
-                     * using a motion vector method */
-                    if ((s->all_fragments[i].coding_method > MODE_INTRA) &&
-                        (s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) {
-                        int src_x, src_y;
-                        motion_x = motion_val[y*fragment_width + x][0];
-                        motion_y = motion_val[y*fragment_width + x][1];
-
-                        src_x= (motion_x>>1) + 8*x;
-                        src_y= (motion_y>>1) + 8*y;
-
-                        motion_halfpel_index = motion_x & 0x01;
-                        motion_source += (motion_x >> 1);
-
-                        motion_halfpel_index |= (motion_y & 0x01) << 1;
-                        motion_source += ((motion_y >> 1) * stride);
-
-                        if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){
-                            uint8_t *temp= s->edge_emu_buffer;
-                            if(stride<0) temp -= 9*stride;
-                            else temp += 9*stride;
-
-                            ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
-                            motion_source= temp;
-                        }
-                    }
-
-
-                    /* first, take care of copying a block from either the
-                     * previous or the golden frame */
-                    if (s->all_fragments[i].coding_method != MODE_INTRA) {
-                        /* Note, it is possible to implement all MC cases with
-                           put_no_rnd_pixels_l2 which would look more like the
-                           VP3 source but this would be slower as
-                           put_no_rnd_pixels_tab is better optimzed */
-                        if(motion_halfpel_index != 3){
-                            s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index](
-                                output_plane + first_pixel,
-                                motion_source, stride, 8);
-                        }else{
-                            int d= (motion_x ^ motion_y)>>31; // d is 0 if motion_x and _y have the same sign, else -1
-                            s->dsp.put_no_rnd_pixels_l2[1](
-                                output_plane + first_pixel,
-                                motion_source - d,
-                                motion_source + stride + 1 + d,
-                                stride, 8);
-                        }
-                    }
-
-                        s->dsp.clear_block(block);
-
-                    /* invert DCT and place (or add) in final output */
-
-                    if (s->all_fragments[i].coding_method == MODE_INTRA) {
-                        vp3_dequant(s, s->all_fragments + i, plane, 0, block);
-                        if(s->avctx->idct_algo!=FF_IDCT_VP3)
-                            block[0] += 128<<3;
-                        s->dsp.idct_put(
-                            output_plane + first_pixel,
-                            stride,
-                            block);
-                    } else {
-                        if (vp3_dequant(s, s->all_fragments + i, plane, 1, block)) {
-                        s->dsp.idct_add(
-                            output_plane + first_pixel,
-                            stride,
-                            block);
-                        } else {
-                            s->dsp.vp3_idct_dc_add(output_plane + first_pixel, stride, block);
-                        }
-                    }
-                } else {
-
-                    /* copy directly from the previous frame */
-                    s->dsp.put_pixels_tab[1][0](
-                        output_plane + first_pixel,
-                        last_plane + first_pixel,
-                        stride, 8);
-
-                }
-                }
-            }
-
-            // Filter up to the last row in the superblock row
-            apply_loop_filter(s, plane, 4*sb_y - !!sb_y, FFMIN(4*sb_y+3, fragment_height-1));
-        }
-    }
-
-     /* this looks like a good place for slice dispatch... */
-     /* algorithm:
-      *   if (slice == s->macroblock_height - 1)
-      *     dispatch (both last slice & 2nd-to-last slice);
-      *   else if (slice > 0)
-      *     dispatch (slice - 1);
-      */
-
-    vp3_draw_horiz_band(s, FFMIN(64*slice + 64-16, s->height-16));
-}
-
-/*
- * This is the ffmpeg/libavcodec API init function.
- */
-static av_cold int vp3_decode_init(AVCodecContext *avctx)
-{
-    Vp3DecodeContext *s = avctx->priv_data;
-    int i, inter, plane;
-    int c_width;
-    int c_height;
-    int y_fragment_count, c_fragment_count;
-
-    if (avctx->codec_tag == MKTAG('V','P','3','0'))
-        s->version = 0;
-    else
-        s->version = 1;
-
-    s->avctx = avctx;
-    s->width = FFALIGN(avctx->width, 16);
-    s->height = FFALIGN(avctx->height, 16);
-    if (avctx->pix_fmt == PIX_FMT_NONE)
-        avctx->pix_fmt = PIX_FMT_YUV420P;
-    avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
-    if(avctx->idct_algo==FF_IDCT_AUTO)
-        avctx->idct_algo=FF_IDCT_VP3;
-    dsputil_init(&s->dsp, avctx);
-
-    ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
-
-    /* initialize to an impossible value which will force a recalculation
-     * in the first frame decode */
-    for (i = 0; i < 3; i++)
-        s->qps[i] = -1;
-
-    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
-
-    s->y_superblock_width = (s->width + 31) / 32;
-    s->y_superblock_height = (s->height + 31) / 32;
-    s->y_superblock_count = s->y_superblock_width * s->y_superblock_height;
-
-    /* work out the dimensions for the C planes */
-    c_width = s->width >> s->chroma_x_shift;
-    c_height = s->height >> s->chroma_y_shift;
-    s->c_superblock_width = (c_width + 31) / 32;
-    s->c_superblock_height = (c_height + 31) / 32;
-    s->c_superblock_count = s->c_superblock_width * s->c_superblock_height;
-
-    s->superblock_count = s->y_superblock_count + (s->c_superblock_count * 2);
-    s->u_superblock_start = s->y_superblock_count;
-    s->v_superblock_start = s->u_superblock_start + s->c_superblock_count;
-    s->superblock_coding = av_malloc(s->superblock_count);
-
-    s->macroblock_width = (s->width + 15) / 16;
-    s->macroblock_height = (s->height + 15) / 16;
-    s->macroblock_count = s->macroblock_width * s->macroblock_height;
-
-    s->fragment_width[0] = s->width / FRAGMENT_PIXELS;
-    s->fragment_height[0] = s->height / FRAGMENT_PIXELS;
-    s->fragment_width[1]  = s->fragment_width[0]  >> s->chroma_x_shift;
-    s->fragment_height[1] = s->fragment_height[0] >> s->chroma_y_shift;
-
-    /* fragment count covers all 8x8 blocks for all 3 planes */
-    y_fragment_count     = s->fragment_width[0] * s->fragment_height[0];
-    c_fragment_count     = s->fragment_width[1] * s->fragment_height[1];
-    s->fragment_count    = y_fragment_count + 2*c_fragment_count;
-    s->fragment_start[1] = y_fragment_count;
-    s->fragment_start[2] = y_fragment_count + c_fragment_count;
-
-    s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment));
-    s->coded_fragment_list[0] = av_malloc(s->fragment_count * sizeof(int));
-    s->dct_tokens_base = av_malloc(64*s->fragment_count * sizeof(*s->dct_tokens_base));
-    s->motion_val[0] = av_malloc(y_fragment_count * sizeof(*s->motion_val[0]));
-    s->motion_val[1] = av_malloc(c_fragment_count * sizeof(*s->motion_val[1]));
-
-    if (!s->superblock_coding || !s->all_fragments || !s->dct_tokens_base ||
-        !s->coded_fragment_list[0] || !s->motion_val[0] || !s->motion_val[1]) {
-        vp3_decode_end(avctx);
-        return -1;
-    }
-
-    if (!s->theora_tables)
-    {
-        for (i = 0; i < 64; i++) {
-            s->coded_dc_scale_factor[i] = vp31_dc_scale_factor[i];
-            s->coded_ac_scale_factor[i] = vp31_ac_scale_factor[i];
-            s->base_matrix[0][i] = vp31_intra_y_dequant[i];
-            s->base_matrix[1][i] = vp31_intra_c_dequant[i];
-            s->base_matrix[2][i] = vp31_inter_dequant[i];
-            s->filter_limit_values[i] = vp31_filter_limit_values[i];
-        }
-
-        for(inter=0; inter<2; inter++){
-            for(plane=0; plane<3; plane++){
-                s->qr_count[inter][plane]= 1;
-                s->qr_size [inter][plane][0]= 63;
-                s->qr_base [inter][plane][0]=
-                s->qr_base [inter][plane][1]= 2*inter + (!!plane)*!inter;
-            }
-        }
-
-        /* init VLC tables */
-        for (i = 0; i < 16; i++) {
-
-            /* DC histograms */
-            init_vlc(&s->dc_vlc[i], 11, 32,
-                &dc_bias[i][0][1], 4, 2,
-                &dc_bias[i][0][0], 4, 2, 0);
-
-            /* group 1 AC histograms */
-            init_vlc(&s->ac_vlc_1[i], 11, 32,
-                &ac_bias_0[i][0][1], 4, 2,
-                &ac_bias_0[i][0][0], 4, 2, 0);
-
-            /* group 2 AC histograms */
-            init_vlc(&s->ac_vlc_2[i], 11, 32,
-                &ac_bias_1[i][0][1], 4, 2,
-                &ac_bias_1[i][0][0], 4, 2, 0);
-
-            /* group 3 AC histograms */
-            init_vlc(&s->ac_vlc_3[i], 11, 32,
-                &ac_bias_2[i][0][1], 4, 2,
-                &ac_bias_2[i][0][0], 4, 2, 0);
-
-            /* group 4 AC histograms */
-            init_vlc(&s->ac_vlc_4[i], 11, 32,
-                &ac_bias_3[i][0][1], 4, 2,
-                &ac_bias_3[i][0][0], 4, 2, 0);
-        }
-    } else {
-
-        for (i = 0; i < 16; i++) {
-            /* DC histograms */
-            if (init_vlc(&s->dc_vlc[i], 11, 32,
-                &s->huffman_table[i][0][1], 8, 4,
-                &s->huffman_table[i][0][0], 8, 4, 0) < 0)
-                goto vlc_fail;
-
-            /* group 1 AC histograms */
-            if (init_vlc(&s->ac_vlc_1[i], 11, 32,
-                &s->huffman_table[i+16][0][1], 8, 4,
-                &s->huffman_table[i+16][0][0], 8, 4, 0) < 0)
-                goto vlc_fail;
-
-            /* group 2 AC histograms */
-            if (init_vlc(&s->ac_vlc_2[i], 11, 32,
-                &s->huffman_table[i+16*2][0][1], 8, 4,
-                &s->huffman_table[i+16*2][0][0], 8, 4, 0) < 0)
-                goto vlc_fail;
-
-            /* group 3 AC histograms */
-            if (init_vlc(&s->ac_vlc_3[i], 11, 32,
-                &s->huffman_table[i+16*3][0][1], 8, 4,
-                &s->huffman_table[i+16*3][0][0], 8, 4, 0) < 0)
-                goto vlc_fail;
-
-            /* group 4 AC histograms */
-            if (init_vlc(&s->ac_vlc_4[i], 11, 32,
-                &s->huffman_table[i+16*4][0][1], 8, 4,
-                &s->huffman_table[i+16*4][0][0], 8, 4, 0) < 0)
-                goto vlc_fail;
-        }
-    }
-
-    init_vlc(&s->superblock_run_length_vlc, 6, 34,
-        &superblock_run_length_vlc_table[0][1], 4, 2,
-        &superblock_run_length_vlc_table[0][0], 4, 2, 0);
-
-    init_vlc(&s->fragment_run_length_vlc, 5, 30,
-        &fragment_run_length_vlc_table[0][1], 4, 2,
-        &fragment_run_length_vlc_table[0][0], 4, 2, 0);
-
-    init_vlc(&s->mode_code_vlc, 3, 8,
-        &mode_code_vlc_table[0][1], 2, 1,
-        &mode_code_vlc_table[0][0], 2, 1, 0);
-
-    init_vlc(&s->motion_vector_vlc, 6, 63,
-        &motion_vector_vlc_table[0][1], 2, 1,
-        &motion_vector_vlc_table[0][0], 2, 1, 0);
-
-    /* work out the block mapping tables */
-    s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int));
-    s->macroblock_coding = av_malloc(s->macroblock_count + 1);
-    if (!s->superblock_fragments || !s->macroblock_coding) {
-        vp3_decode_end(avctx);
-        return -1;
-    }
-    init_block_mapping(s);
-
-    for (i = 0; i < 3; i++) {
-        s->current_frame.data[i] = NULL;
-        s->last_frame.data[i] = NULL;
-        s->golden_frame.data[i] = NULL;
-    }
-
-    return 0;
-
-vlc_fail:
-    av_log(avctx, AV_LOG_FATAL, "Invalid huffman table\n");
-    return -1;
-}
-
-/*
- * This is the ffmpeg/libavcodec API frame decode function.
- */
-static int vp3_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    Vp3DecodeContext *s = avctx->priv_data;
-    GetBitContext gb;
-    static int counter = 0;
-    int i;
-
-    init_get_bits(&gb, buf, buf_size * 8);
-
-    if (s->theora && get_bits1(&gb))
-    {
-        av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
-        return -1;
-    }
-
-    s->keyframe = !get_bits1(&gb);
-    if (!s->theora)
-        skip_bits(&gb, 1);
-    for (i = 0; i < 3; i++)
-        s->last_qps[i] = s->qps[i];
-
-    s->nqps=0;
-    do{
-        s->qps[s->nqps++]= get_bits(&gb, 6);
-    } while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb));
-    for (i = s->nqps; i < 3; i++)
-        s->qps[i] = -1;
-
-    if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
-            s->keyframe?"key":"", counter, s->qps[0]);
-    counter++;
-
-    if (s->qps[0] != s->last_qps[0])
-        init_loop_filter(s);
-
-    for (i = 0; i < s->nqps; i++)
-        // reinit all dequantizers if the first one changed, because
-        // the DC of the first quantizer must be used for all matrices
-        if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
-            init_dequantizer(s, i);
-
-    if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
-        return buf_size;
-
-    s->current_frame.reference = 3;
-    s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE;
-    if (avctx->get_buffer(avctx, &s->current_frame) < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        goto error;
-    }
-
-    if (s->keyframe) {
-        if (!s->theora)
-        {
-            skip_bits(&gb, 4); /* width code */
-            skip_bits(&gb, 4); /* height code */
-            if (s->version)
-            {
-                s->version = get_bits(&gb, 5);
-                if (counter == 1)
-                    av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version);
-            }
-        }
-        if (s->version || s->theora)
-        {
-                if (get_bits1(&gb))
-                    av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
-            skip_bits(&gb, 2); /* reserved? */
-        }
-    } else {
-        if (!s->golden_frame.data[0]) {
-            av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n");
-
-            s->golden_frame.reference = 3;
-            s->golden_frame.pict_type = FF_I_TYPE;
-            if (avctx->get_buffer(avctx, &s->golden_frame) < 0) {
-                av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-                goto error;
-            }
-            s->last_frame = s->golden_frame;
-            s->last_frame.type = FF_BUFFER_TYPE_COPY;
-        }
-    }
-
-    s->current_frame.qscale_table= s->qscale_table; //FIXME allocate individual tables per AVFrame
-    s->current_frame.qstride= 0;
-
-    memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
-
-    if (unpack_superblocks(s, &gb)){
-        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
-        goto error;
-    }
-    if (unpack_modes(s, &gb)){
-        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
-        goto error;
-    }
-    if (unpack_vectors(s, &gb)){
-        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
-        goto error;
-    }
-    if (unpack_block_qpis(s, &gb)){
-        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n");
-        goto error;
-    }
-    if (unpack_dct_coeffs(s, &gb)){
-        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
-        goto error;
-    }
-
-    for (i = 0; i < 3; i++) {
-        int height = s->height >> (i && s->chroma_y_shift);
-        if (s->flipped_image)
-            s->data_offset[i] = 0;
-        else
-            s->data_offset[i] = (height-1) * s->current_frame.linesize[i];
-    }
-
-    s->last_slice_end = 0;
-    for (i = 0; i < s->c_superblock_height; i++)
-        render_slice(s, i);
-
-    // filter the last row
-    for (i = 0; i < 3; i++) {
-        int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1;
-        apply_loop_filter(s, i, row, row+1);
-    }
-    vp3_draw_horiz_band(s, s->height);
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data= s->current_frame;
-
-    /* release the last frame, if it is allocated and if it is not the
-     * golden frame */
-    if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY)
-        avctx->release_buffer(avctx, &s->last_frame);
-
-    /* shuffle frames (last = current) */
-    s->last_frame= s->current_frame;
-
-    if (s->keyframe) {
-        if (s->golden_frame.data[0])
-            avctx->release_buffer(avctx, &s->golden_frame);
-        s->golden_frame = s->current_frame;
-        s->last_frame.type = FF_BUFFER_TYPE_COPY;
-    }
-
-    s->current_frame.data[0]= NULL; /* ensure that we catch any access to this released frame */
-
-    return buf_size;
-
-error:
-    if (s->current_frame.data[0])
-        avctx->release_buffer(avctx, &s->current_frame);
-    return -1;
-}
-
-/*
- * This is the ffmpeg/libavcodec API module cleanup function.
- */
-static av_cold int vp3_decode_end(AVCodecContext *avctx)
-{
-    Vp3DecodeContext *s = avctx->priv_data;
-    int i;
-
-    av_free(s->superblock_coding);
-    av_free(s->all_fragments);
-    av_free(s->coded_fragment_list[0]);
-    av_free(s->dct_tokens_base);
-    av_free(s->superblock_fragments);
-    av_free(s->macroblock_coding);
-    av_free(s->motion_val[0]);
-    av_free(s->motion_val[1]);
-
-    for (i = 0; i < 16; i++) {
-        free_vlc(&s->dc_vlc[i]);
-        free_vlc(&s->ac_vlc_1[i]);
-        free_vlc(&s->ac_vlc_2[i]);
-        free_vlc(&s->ac_vlc_3[i]);
-        free_vlc(&s->ac_vlc_4[i]);
-    }
-
-    free_vlc(&s->superblock_run_length_vlc);
-    free_vlc(&s->fragment_run_length_vlc);
-    free_vlc(&s->mode_code_vlc);
-    free_vlc(&s->motion_vector_vlc);
-
-    /* release all frames */
-    if (s->golden_frame.data[0])
-        avctx->release_buffer(avctx, &s->golden_frame);
-    if (s->last_frame.data[0] && s->last_frame.type != FF_BUFFER_TYPE_COPY)
-        avctx->release_buffer(avctx, &s->last_frame);
-    /* no need to release the current_frame since it will always be pointing
-     * to the same frame as either the golden or last frame */
-
-    return 0;
-}
-
-static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
-{
-    Vp3DecodeContext *s = avctx->priv_data;
-
-    if (get_bits1(gb)) {
-        int token;
-        if (s->entries >= 32) { /* overflow */
-            av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
-            return -1;
-        }
-        token = get_bits(gb, 5);
-        //av_log(avctx, AV_LOG_DEBUG, "hti %d hbits %x token %d entry : %d size %d\n", s->hti, s->hbits, token, s->entries, s->huff_code_size);
-        s->huffman_table[s->hti][token][0] = s->hbits;
-        s->huffman_table[s->hti][token][1] = s->huff_code_size;
-        s->entries++;
-    }
-    else {
-        if (s->huff_code_size >= 32) {/* overflow */
-            av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
-            return -1;
-        }
-        s->huff_code_size++;
-        s->hbits <<= 1;
-        if (read_huffman_tree(avctx, gb))
-            return -1;
-        s->hbits |= 1;
-        if (read_huffman_tree(avctx, gb))
-            return -1;
-        s->hbits >>= 1;
-        s->huff_code_size--;
-    }
-    return 0;
-}
-
-#if CONFIG_THEORA_DECODER
-static const enum PixelFormat theora_pix_fmts[4] = {
-    PIX_FMT_YUV420P, PIX_FMT_NONE, PIX_FMT_YUV422P, PIX_FMT_YUV444P
-};
-
-static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
-{
-    Vp3DecodeContext *s = avctx->priv_data;
-    int visible_width, visible_height, colorspace;
-    int offset_x = 0, offset_y = 0;
-    AVRational fps;
-
-    s->theora = get_bits_long(gb, 24);
-    av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
-
-    /* 3.2.0 aka alpha3 has the same frame orientation as original vp3 */
-    /* but previous versions have the image flipped relative to vp3 */
-    if (s->theora < 0x030200)
-    {
-        s->flipped_image = 1;
-        av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n");
-    }
-
-    visible_width  = s->width  = get_bits(gb, 16) << 4;
-    visible_height = s->height = get_bits(gb, 16) << 4;
-
-    if(avcodec_check_dimensions(avctx, s->width, s->height)){
-        av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height);
-        s->width= s->height= 0;
-        return -1;
-    }
-
-    if (s->theora >= 0x030200) {
-        visible_width  = get_bits_long(gb, 24);
-        visible_height = get_bits_long(gb, 24);
-
-        offset_x = get_bits(gb, 8); /* offset x */
-        offset_y = get_bits(gb, 8); /* offset y, from bottom */
-    }
-
-    fps.num = get_bits_long(gb, 32);
-    fps.den = get_bits_long(gb, 32);
-    if (fps.num && fps.den) {
-        av_reduce(&avctx->time_base.num, &avctx->time_base.den,
-                  fps.den, fps.num, 1<<30);
-    }
-
-    avctx->sample_aspect_ratio.num = get_bits_long(gb, 24);
-    avctx->sample_aspect_ratio.den = get_bits_long(gb, 24);
-
-    if (s->theora < 0x030200)
-        skip_bits(gb, 5); /* keyframe frequency force */
-    colorspace = get_bits(gb, 8);
-    skip_bits(gb, 24); /* bitrate */
-
-    skip_bits(gb, 6); /* quality hint */
-
-    if (s->theora >= 0x030200)
-    {
-        skip_bits(gb, 5); /* keyframe frequency force */
-        avctx->pix_fmt = theora_pix_fmts[get_bits(gb, 2)];
-        skip_bits(gb, 3); /* reserved */
-    }
-
-//    align_get_bits(gb);
-
-    if (   visible_width  <= s->width  && visible_width  > s->width-16
-        && visible_height <= s->height && visible_height > s->height-16
-        && !offset_x && (offset_y == s->height - visible_height))
-        avcodec_set_dimensions(avctx, visible_width, visible_height);
-    else
-        avcodec_set_dimensions(avctx, s->width, s->height);
-
-    if (colorspace == 1) {
-        avctx->color_primaries = AVCOL_PRI_BT470M;
-    } else if (colorspace == 2) {
-        avctx->color_primaries = AVCOL_PRI_BT470BG;
-    }
-    if (colorspace == 1 || colorspace == 2) {
-        avctx->colorspace = AVCOL_SPC_BT470BG;
-        avctx->color_trc  = AVCOL_TRC_BT709;
-    }
-
-    return 0;
-}
-
-static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
-{
-    Vp3DecodeContext *s = avctx->priv_data;
-    int i, n, matrices, inter, plane;
-
-    if (s->theora >= 0x030200) {
-        n = get_bits(gb, 3);
-        /* loop filter limit values table */
-        for (i = 0; i < 64; i++) {
-            s->filter_limit_values[i] = get_bits(gb, n);
-            if (s->filter_limit_values[i] > 127) {
-                av_log(avctx, AV_LOG_ERROR, "filter limit value too large (%i > 127), clamping\n", s->filter_limit_values[i]);
-                s->filter_limit_values[i] = 127;
-            }
-        }
-    }
-
-    if (s->theora >= 0x030200)
-        n = get_bits(gb, 4) + 1;
-    else
-        n = 16;
-    /* quality threshold table */
-    for (i = 0; i < 64; i++)
-        s->coded_ac_scale_factor[i] = get_bits(gb, n);
-
-    if (s->theora >= 0x030200)
-        n = get_bits(gb, 4) + 1;
-    else
-        n = 16;
-    /* dc scale factor table */
-    for (i = 0; i < 64; i++)
-        s->coded_dc_scale_factor[i] = get_bits(gb, n);
-
-    if (s->theora >= 0x030200)
-        matrices = get_bits(gb, 9) + 1;
-    else
-        matrices = 3;
-
-    if(matrices > 384){
-        av_log(avctx, AV_LOG_ERROR, "invalid number of base matrixes\n");
-        return -1;
-    }
-
-    for(n=0; n<matrices; n++){
-        for (i = 0; i < 64; i++)
-            s->base_matrix[n][i]= get_bits(gb, 8);
-    }
-
-    for (inter = 0; inter <= 1; inter++) {
-        for (plane = 0; plane <= 2; plane++) {
-            int newqr= 1;
-            if (inter || plane > 0)
-                newqr = get_bits1(gb);
-            if (!newqr) {
-                int qtj, plj;
-                if(inter && get_bits1(gb)){
-                    qtj = 0;
-                    plj = plane;
-                }else{
-                    qtj= (3*inter + plane - 1) / 3;
-                    plj= (plane + 2) % 3;
-                }
-                s->qr_count[inter][plane]= s->qr_count[qtj][plj];
-                memcpy(s->qr_size[inter][plane], s->qr_size[qtj][plj], sizeof(s->qr_size[0][0]));
-                memcpy(s->qr_base[inter][plane], s->qr_base[qtj][plj], sizeof(s->qr_base[0][0]));
-            } else {
-                int qri= 0;
-                int qi = 0;
-
-                for(;;){
-                    i= get_bits(gb, av_log2(matrices-1)+1);
-                    if(i>= matrices){
-                        av_log(avctx, AV_LOG_ERROR, "invalid base matrix index\n");
-                        return -1;
-                    }
-                    s->qr_base[inter][plane][qri]= i;
-                    if(qi >= 63)
-                        break;
-                    i = get_bits(gb, av_log2(63-qi)+1) + 1;
-                    s->qr_size[inter][plane][qri++]= i;
-                    qi += i;
-                }
-
-                if (qi > 63) {
-                    av_log(avctx, AV_LOG_ERROR, "invalid qi %d > 63\n", qi);
-                    return -1;
-                }
-                s->qr_count[inter][plane]= qri;
-            }
-        }
-    }
-
-    /* Huffman tables */
-    for (s->hti = 0; s->hti < 80; s->hti++) {
-        s->entries = 0;
-        s->huff_code_size = 1;
-        if (!get_bits1(gb)) {
-            s->hbits = 0;
-            if(read_huffman_tree(avctx, gb))
-                return -1;
-            s->hbits = 1;
-            if(read_huffman_tree(avctx, gb))
-                return -1;
-        }
-    }
-
-    s->theora_tables = 1;
-
-    return 0;
-}
-
-static av_cold int theora_decode_init(AVCodecContext *avctx)
-{
-    Vp3DecodeContext *s = avctx->priv_data;
-    GetBitContext gb;
-    int ptype;
-    uint8_t *header_start[3];
-    int header_len[3];
-    int i;
-
-    s->theora = 1;
-
-    if (!avctx->extradata_size)
-    {
-        av_log(avctx, AV_LOG_ERROR, "Missing extradata!\n");
-        return -1;
-    }
-
-    if (ff_split_xiph_headers(avctx->extradata, avctx->extradata_size,
-                              42, header_start, header_len) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Corrupt extradata\n");
-        return -1;
-    }
-
-  for(i=0;i<3;i++) {
-    init_get_bits(&gb, header_start[i], header_len[i] * 8);
-
-    ptype = get_bits(&gb, 8);
-
-     if (!(ptype & 0x80))
-     {
-        av_log(avctx, AV_LOG_ERROR, "Invalid extradata!\n");
-//        return -1;
-     }
-
-    // FIXME: Check for this as well.
-    skip_bits_long(&gb, 6*8); /* "theora" */
-
-    switch(ptype)
-    {
-        case 0x80:
-            theora_decode_header(avctx, &gb);
-                break;
-        case 0x81:
-// FIXME: is this needed? it breaks sometimes
-//            theora_decode_comments(avctx, gb);
-            break;
-        case 0x82:
-            if (theora_decode_tables(avctx, &gb))
-                return -1;
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Unknown Theora config packet: %d\n", ptype&~0x80);
-            break;
-    }
-    if(ptype != 0x81 && 8*header_len[i] != get_bits_count(&gb))
-        av_log(avctx, AV_LOG_WARNING, "%d bits left in packet %X\n", 8*header_len[i] - get_bits_count(&gb), ptype);
-    if (s->theora < 0x030200)
-        break;
-  }
-
-    return vp3_decode_init(avctx);
-}
-
-AVCodec theora_decoder = {
-    "theora",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_THEORA,
-    sizeof(Vp3DecodeContext),
-    theora_decode_init,
-    NULL,
-    vp3_decode_end,
-    vp3_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("Theora"),
-};
-#endif
-
-AVCodec vp3_decoder = {
-    "vp3",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VP3,
-    sizeof(Vp3DecodeContext),
-    vp3_decode_init,
-    NULL,
-    vp3_decode_end,
-    vp3_decode_frame,
-    CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"),
-};
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
deleted file mode 100644
index c22e6dd..0000000
--- a/libavcodec/vp3_parser.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2008 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "parser.h"
-
-static int parse(AVCodecParserContext *s,
-                           AVCodecContext *avctx,
-                           const uint8_t **poutbuf, int *poutbuf_size,
-                           const uint8_t *buf, int buf_size)
-{
-    if(avctx->codec_id == CODEC_ID_THEORA)
-        s->pict_type= (buf[0]&0x40) ? FF_P_TYPE : FF_I_TYPE;
-    else
-        s->pict_type= (buf[0]&0x80) ? FF_P_TYPE : FF_I_TYPE;
-
-    *poutbuf = buf;
-    *poutbuf_size = buf_size;
-    return buf_size;
-}
-
-AVCodecParser vp3_parser = {
-    { CODEC_ID_THEORA, CODEC_ID_VP3,
-      CODEC_ID_VP6,    CODEC_ID_VP6F, CODEC_ID_VP6A },
-    0,
-    NULL,
-    parse,
-};
diff --git a/libavcodec/vp3data.h b/libavcodec/vp3data.h
deleted file mode 100644
index 904ec6a..0000000
--- a/libavcodec/vp3data.h
+++ /dev/null
@@ -1,3181 +0,0 @@
-/*
- * copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VP3DATA_H
-#define AVCODEC_VP3DATA_H
-
-#include <stdint.h>
-#include <stdlib.h>
-
-/* these coefficients dequantize intraframe Y plane coefficients
- * (note: same as JPEG) */
-static const int16_t vp31_intra_y_dequant[64] =
-{       16,  11,  10,  16,  24,  40,  51,  61,
-        12,  12,  14,  19,  26,  58,  60,  55,
-        14,  13,  16,  24,  40,  57,  69,  56,
-        14,  17,  22,  29,  51,  87,  80,  62,
-        18,  22,  37,  58,  68, 109, 103,  77,
-        24,  35,  55,  64,  81, 104, 113,  92,
-        49,  64,  78,  87, 103, 121, 120, 101,
-        72,  92,  95,  98, 112, 100, 103,  99
-};
-
-/* these coefficients dequantize intraframe C plane coefficients
- * (note: same as JPEG) */
-static const int16_t vp31_intra_c_dequant[64] =
-{       17,  18,     24,     47,     99,     99,     99,     99,
-        18,  21,     26,     66,     99,     99,     99,     99,
-        24,  26,     56,     99,     99,     99,     99,     99,
-        47,  66,     99,     99,     99,     99,     99,     99,
-        99,  99,     99,     99,     99,     99,     99,     99,
-        99,  99,     99,     99,     99,     99,     99,     99,
-        99,  99,     99,     99,     99,     99,     99,     99,
-        99,  99,     99,     99,     99,     99,     99,     99
-};
-
-/* these coefficients dequantize interframe coefficients (all planes) */
-static const int16_t vp31_inter_dequant[64] =
-{   16,  16,  16,  20,  24,  28,  32,  40,
-    16,  16,  20,  24,  28,  32,  40,  48,
-    16,  20,  24,  28,  32,  40,  48,  64,
-    20,  24,  28,  32,  40,  48,  64,  64,
-    24,  28,  32,  40,  48,  64,  64,  64,
-    28,  32,  40,  48,  64,  64,  64,  96,
-    32,  40,  48,  64,  64,  64,  96,  128,
-    40,  48,  64,  64,  64,  96,  128, 128
-};
-
-static const int16_t vp31_dc_scale_factor[64] =
-{ 220, 200, 190, 180, 170, 170, 160, 160,
-  150, 150, 140, 140, 130, 130, 120, 120,
-  110, 110, 100, 100, 90,  90,  90,  80,
-  80,  80,  70,  70,  70,  60,  60,  60,
-  60,  50,  50,  50,  50,  40,  40,  40,
-  40,  40,  30,  30,  30,  30,  30,  30,
-  30,  20,  20,  20,  20,  20,  20,  20,
-  20,  10,  10,  10,  10,  10,  10,  10
-};
-
-static const uint32_t vp31_ac_scale_factor[64] =
-{ 500,  450,  400,  370,  340,  310, 285, 265,
-  245,  225,  210,  195,  185,  180, 170, 160,
-  150,  145,  135,  130,  125,  115, 110, 107,
-  100,   96,   93,   89,   85,   82,  75,  74,
-   70,   68,   64,   60,   57,   56,  52,  50,
-   49,   45,   44,   43,   40,   38,  37,  35,
-   33,   32,   30,   29,   28,   25,  24,  22,
-   21,   19,   18,   17,   15,   13,  12,  10
-};
-
-static const uint8_t vp31_filter_limit_values[64] =
-{  30, 25, 20, 20, 15, 15, 14, 14,
-   13, 13, 12, 12, 11, 11, 10, 10,
-    9,  9,  8,  8,  7,  7,  7,  7,
-    6,  6,  6,  6,  5,  5,  5,  5,
-    4,  4,  4,  4,  3,  3,  3,  3,
-    2,  2,  2,  2,  2,  2,  2,  2,
-    0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0
-};
-
-static const uint16_t superblock_run_length_vlc_table[34][2] = {
-    { 0, 1 },
-
-    { 4, 3 },    { 5, 3 },
-
-    { 0xC, 4 },  { 0xD, 4 },
-
-    { 0x38, 6 },    { 0x39, 6 },    { 0x3A, 6 },    { 0x3B, 6 },
-
-    { 0xF0, 8 },    { 0xF1, 8 },    { 0xF2, 8 },    { 0xF3, 8 },
-    { 0xF4, 8 },    { 0xF5, 8 },    { 0xF6, 8 },    { 0xF7, 8 },
-
-    { 0x3E0, 10 },    { 0x3E1, 10 },    { 0x3E2, 10 },    { 0x3E3, 10 },
-    { 0x3E4, 10 },    { 0x3E5, 10 },    { 0x3E6, 10 },    { 0x3E7, 10 },
-    { 0x3E8, 10 },    { 0x3E9, 10 },    { 0x3EA, 10 },    { 0x3EB, 10 },
-    { 0x3EC, 10 },    { 0x3ED, 10 },    { 0x3EE, 10 },    { 0x3EF, 10 },
-
-    { 0x3F, 6 }  /* this last VLC is a special case for reading 12 more
-                    bits from stream and adding the value 34 */
-};
-
-static const uint16_t fragment_run_length_vlc_table[30][2] = {
-    /* 1 -> 2 */
-    { 0x0, 2 },    { 0x1, 2 },
-
-    /* 3 -> 4 */
-    { 0x4, 3 },    { 0x5, 3 },
-
-    /* 5 -> 6 */
-    { 0xC, 4 },    { 0xD, 4 },
-
-    /* 7 -> 10 */
-    { 0x38, 6 },   { 0x39, 6 },
-    { 0x3A, 6 },   { 0x3B, 6 },
-
-    /* 11 -> 14 */
-    { 0x78, 7 },   { 0x79, 7 },
-    { 0x7A, 7 },   { 0x7B, 7 },
-
-    /* 15 -> 30 */
-    { 0x1F0, 9 },  { 0x1F1, 9 },  { 0x1F2, 9 },  { 0x1F3, 9 },
-    { 0x1F4, 9 },  { 0x1F5, 9 },  { 0x1F6, 9 },  { 0x1F7, 9 },
-    { 0x1F8, 9 },  { 0x1F9, 9 },  { 0x1FA, 9 },  { 0x1FB, 9 },
-    { 0x1FC, 9 },  { 0x1FD, 9 },  { 0x1FE, 9 },  { 0x1FF, 9 }
-};
-
-static const uint8_t mode_code_vlc_table[8][2] = {
-    { 0, 1 },      { 2, 2 },
-    { 6, 3 },      { 14, 4 },
-    { 30, 5 },     { 62, 6 },
-    { 126, 7 },    { 127, 7 }
-};
-
-static const uint8_t motion_vector_vlc_table[63][2] = {
-    { 0, 3 },
-    { 1, 3 },
-    { 2, 3 },
-
-    { 6, 4 },    { 7, 4 },
-
-    { 8, 4 },    { 9, 4 },
-
-    { 40, 6 },    { 41, 6 },    { 42, 6 },    { 43, 6 },
-    { 44, 6 },    { 45, 6 },    { 46, 6 },    { 47, 6 },
-
-    { 96, 7 },    { 97, 7 },    { 98, 7 },    { 99, 7 },
-    { 100, 7 },   { 101, 7 },   { 102, 7 },   { 103, 7 },
-    { 104, 7 },   { 105, 7 },   { 106, 7 },   { 107, 7 },
-    { 108, 7 },   { 109, 7 },   { 110, 7 },   { 111, 7 },
-
-    { 0xE0, 8 },  { 0xE1, 8 },  { 0xE2, 8 },  { 0xE3, 8 },
-    { 0xE4, 8 },  { 0xE5, 8 },  { 0xE6, 8 },  { 0xE7, 8 },
-    { 0xE8, 8 },  { 0xE9, 8 },  { 0xEA, 8 },  { 0xEB, 8 },
-    { 0xEC, 8 },  { 0xED, 8 },  { 0xEE, 8 },  { 0xEF, 8 },
-
-    { 0xF0, 8 },  { 0xF1, 8 },  { 0xF2, 8 },  { 0xF3, 8 },
-    { 0xF4, 8 },  { 0xF5, 8 },  { 0xF6, 8 },  { 0xF7, 8 },
-    { 0xF8, 8 },  { 0xF9, 8 },  { 0xFA, 8 },  { 0xFB, 8 },
-    { 0xFC, 8 },  { 0xFD, 8 },  { 0xFE, 8 },  { 0xFF, 8 }
-};
-
-static const int motion_vector_table[63] = {
-    0, 1, -1,
-    2, -2,
-    3, -3,
-    4, -4, 5, -5, 6, -6, 7, -7,
-    8, -8, 9, -9, 10, -10, 11, -11, 12, -12, 13, -13, 14, -14, 15, -15,
-    16, -16, 17, -17, 18, -18, 19, -19, 20, -20, 21, -21, 22, -22, 23, -23,
-    24, -24, 25, -25, 26, -26, 27, -27, 28, -28, 29, -29, 30, -30, 31, -31
-};
-
-static const int8_t fixed_motion_vector_table[64] = {
-   0,   0,   1,  -1,   2,  -2,   3,  -3,
-   4,  -4,   5,  -5,   6,  -6,   7,  -7,
-   8,  -8,   9,  -9,  10, -10,  11, -11,
-  12, -12,  13, -13,  14, -14,  15, -15,
-  16, -16,  17, -17,  18, -18,  19, -19,
-  20, -20,  21, -21,  22, -22,  23, -23,
-  24, -24,  25, -25,  26, -26,  27, -27,
-  28, -28,  29, -29,  30, -30,  31, -31
-};
-
-/* only tokens 0..6 indicate eob runs */
-static const int eob_run_base[7] = {
-    1, 2, 3, 4, 8, 16, 0
-};
-static const int eob_run_get_bits[7] = {
-    0, 0, 0, 2, 3, 4, 12
-};
-
-static const int zero_run_base[32] = {
-    0, 0, 0, 0, 0, 0, 0,  /* 0..6 are never used */
-    0, 0,  /* 7..8 */
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 9..22 */
-    1, 2, 3, 4, 5,  /* 23..27 */
-    6, 10, 1, 2  /* 28..31 */
-};
-static const int zero_run_get_bits[32] = {
-    0, 0, 0, 0, 0, 0, 0,  /* 0..6 are never used */
-    3, 6,  /* 7..8 */
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 9..22 */
-    0, 0, 0, 0, 0,  /* 23..27 */
-    2, 3, 0, 1  /* 28..31 */
-};
-
-static const int coeff_get_bits[32] = {
-    0, 0, 0, 0, 0, 0, 0,  /* 0..6 are never used */
-    0, 0, 0, 0, 0, 0,  /* 7..12 use constant coeffs */
-    1, 1, 1, 1,  /* 13..16 are constants but still need sign bit */
-    2, 3, 4, 5, 6, 10,  /* 17..22, for reading large coeffs */
-    1, 1, 1, 1, 1, 1, 1,  /* 23..29 are constants but still need sign bit */
-    2, 2  /* 30..31 */
-};
-
-static const int16_t coeff_table_token_7_8[1] = { 0 };
-static const int16_t coeff_table_token_9[1] = { 1 };
-static const int16_t coeff_table_token_10[1] = { -1 };
-static const int16_t coeff_table_token_11[1] = { 2 };
-static const int16_t coeff_table_token_12[1] = { -2 };
-
-static const int16_t coeff_table_token_13[2] = { 3, -3 };
-static const int16_t coeff_table_token_14[2] = { 4, -4 };
-static const int16_t coeff_table_token_15[2] = { 5, -5 };
-static const int16_t coeff_table_token_16[2] = { 6, -6 };
-
-static const int16_t coeff_table_token_23_24_25_26_27_28_29[2] = { 1, -1 };
-static const int16_t coeff_table_token_30[4] = { 2, 3, -2, -3 };
-static const int16_t coeff_table_token_31[4] = { 2, 3, -2, -3 };
-
-static const int16_t coeff_table_token_17[4] = {
-    7, 8, -7, -8
-};
-
-static const int16_t coeff_table_token_18[8] = {
-    9, 10, 11, 12, -9, -10, -11, -12
-};
-
-static const int16_t coeff_table_token_19[16] = {
-    13, 14, 15, 16, 17, 18, 19, 20, -13, -14, -15, -16, -17, -18, -19, -20
-};
-
-static const int16_t coeff_table_token_20[32] = {
-    21, 22, 23, 24, 25, 26, 27, 28,
-    29, 30, 31, 32, 33, 34, 35, 36,
-    -21, -22, -23, -24, -25, -26, -27, -28,
-    -29, -30, -31, -32, -33, -34, -35, -36
-};
-
-static const int16_t coeff_table_token_21[64] = {
-    37, 38, 39, 40, 41, 42, 43, 44,
-    45, 46, 47, 48, 49, 50, 51, 52,
-    53, 54, 55, 56, 57, 58, 59, 60,
-    61, 62, 63, 64, 65, 66, 67, 68,
-    -37, -38, -39, -40, -41, -42, -43, -44,
-    -45, -46, -47, -48, -49, -50, -51, -52,
-    -53, -54, -55, -56, -57, -58, -59, -60,
-    -61, -62, -63, -64, -65, -66, -67, -68
-};
-
-static const int16_t coeff_table_token_22[1024] = {
-    69, 70, 71, 72, 73, 74, 75, 76,
-    77, 78, 79, 80, 81, 82, 83, 84,
-    85, 86, 87, 88, 89, 90, 91, 92,
-    93, 94, 95, 96, 97, 98, 99, 100,
-    101, 102, 103, 104, 105, 106, 107, 108,
-    109, 110, 111, 112, 113, 114, 115, 116,
-    117, 118, 119, 120, 121, 122, 123, 124,
-    125, 126, 127, 128, 129, 130, 131, 132,
-    133, 134, 135, 136, 137, 138, 139, 140,
-    141, 142, 143, 144, 145, 146, 147, 148,
-    149, 150, 151, 152, 153, 154, 155, 156,
-    157, 158, 159, 160, 161, 162, 163, 164,
-    165, 166, 167, 168, 169, 170, 171, 172,
-    173, 174, 175, 176, 177, 178, 179, 180,
-    181, 182, 183, 184, 185, 186, 187, 188,
-    189, 190, 191, 192, 193, 194, 195, 196,
-    197, 198, 199, 200, 201, 202, 203, 204,
-    205, 206, 207, 208, 209, 210, 211, 212,
-    213, 214, 215, 216, 217, 218, 219, 220,
-    221, 222, 223, 224, 225, 226, 227, 228,
-    229, 230, 231, 232, 233, 234, 235, 236,
-    237, 238, 239, 240, 241, 242, 243, 244,
-    245, 246, 247, 248, 249, 250, 251, 252,
-    253, 254, 255, 256, 257, 258, 259, 260,
-    261, 262, 263, 264, 265, 266, 267, 268,
-    269, 270, 271, 272, 273, 274, 275, 276,
-    277, 278, 279, 280, 281, 282, 283, 284,
-    285, 286, 287, 288, 289, 290, 291, 292,
-    293, 294, 295, 296, 297, 298, 299, 300,
-    301, 302, 303, 304, 305, 306, 307, 308,
-    309, 310, 311, 312, 313, 314, 315, 316,
-    317, 318, 319, 320, 321, 322, 323, 324,
-    325, 326, 327, 328, 329, 330, 331, 332,
-    333, 334, 335, 336, 337, 338, 339, 340,
-    341, 342, 343, 344, 345, 346, 347, 348,
-    349, 350, 351, 352, 353, 354, 355, 356,
-    357, 358, 359, 360, 361, 362, 363, 364,
-    365, 366, 367, 368, 369, 370, 371, 372,
-    373, 374, 375, 376, 377, 378, 379, 380,
-    381, 382, 383, 384, 385, 386, 387, 388,
-    389, 390, 391, 392, 393, 394, 395, 396,
-    397, 398, 399, 400, 401, 402, 403, 404,
-    405, 406, 407, 408, 409, 410, 411, 412,
-    413, 414, 415, 416, 417, 418, 419, 420,
-    421, 422, 423, 424, 425, 426, 427, 428,
-    429, 430, 431, 432, 433, 434, 435, 436,
-    437, 438, 439, 440, 441, 442, 443, 444,
-    445, 446, 447, 448, 449, 450, 451, 452,
-    453, 454, 455, 456, 457, 458, 459, 460,
-    461, 462, 463, 464, 465, 466, 467, 468,
-    469, 470, 471, 472, 473, 474, 475, 476,
-    477, 478, 479, 480, 481, 482, 483, 484,
-    485, 486, 487, 488, 489, 490, 491, 492,
-    493, 494, 495, 496, 497, 498, 499, 500,
-    501, 502, 503, 504, 505, 506, 507, 508,
-    509, 510, 511, 512, 513, 514, 515, 516,
-    517, 518, 519, 520, 521, 522, 523, 524,
-    525, 526, 527, 528, 529, 530, 531, 532,
-    533, 534, 535, 536, 537, 538, 539, 540,
-    541, 542, 543, 544, 545, 546, 547, 548,
-    549, 550, 551, 552, 553, 554, 555, 556,
-    557, 558, 559, 560, 561, 562, 563, 564,
-    565, 566, 567, 568, 569, 570, 571, 572,
-    573, 574, 575, 576, 577, 578, 579, 580,
-    -69, -70, -71, -72, -73, -74, -75, -76,
-    -77, -78, -79, -80, -81, -82, -83, -84,
-    -85, -86, -87, -88, -89, -90, -91, -92,
-    -93, -94, -95, -96, -97, -98, -99, -100,
-    -101, -102, -103, -104, -105, -106, -107, -108,
-    -109, -110, -111, -112, -113, -114, -115, -116,
-    -117, -118, -119, -120, -121, -122, -123, -124,
-    -125, -126, -127, -128, -129, -130, -131, -132,
-    -133, -134, -135, -136, -137, -138, -139, -140,
-    -141, -142, -143, -144, -145, -146, -147, -148,
-    -149, -150, -151, -152, -153, -154, -155, -156,
-    -157, -158, -159, -160, -161, -162, -163, -164,
-    -165, -166, -167, -168, -169, -170, -171, -172,
-    -173, -174, -175, -176, -177, -178, -179, -180,
-    -181, -182, -183, -184, -185, -186, -187, -188,
-    -189, -190, -191, -192, -193, -194, -195, -196,
-    -197, -198, -199, -200, -201, -202, -203, -204,
-    -205, -206, -207, -208, -209, -210, -211, -212,
-    -213, -214, -215, -216, -217, -218, -219, -220,
-    -221, -222, -223, -224, -225, -226, -227, -228,
-    -229, -230, -231, -232, -233, -234, -235, -236,
-    -237, -238, -239, -240, -241, -242, -243, -244,
-    -245, -246, -247, -248, -249, -250, -251, -252,
-    -253, -254, -255, -256, -257, -258, -259, -260,
-    -261, -262, -263, -264, -265, -266, -267, -268,
-    -269, -270, -271, -272, -273, -274, -275, -276,
-    -277, -278, -279, -280, -281, -282, -283, -284,
-    -285, -286, -287, -288, -289, -290, -291, -292,
-    -293, -294, -295, -296, -297, -298, -299, -300,
-    -301, -302, -303, -304, -305, -306, -307, -308,
-    -309, -310, -311, -312, -313, -314, -315, -316,
-    -317, -318, -319, -320, -321, -322, -323, -324,
-    -325, -326, -327, -328, -329, -330, -331, -332,
-    -333, -334, -335, -336, -337, -338, -339, -340,
-    -341, -342, -343, -344, -345, -346, -347, -348,
-    -349, -350, -351, -352, -353, -354, -355, -356,
-    -357, -358, -359, -360, -361, -362, -363, -364,
-    -365, -366, -367, -368, -369, -370, -371, -372,
-    -373, -374, -375, -376, -377, -378, -379, -380,
-    -381, -382, -383, -384, -385, -386, -387, -388,
-    -389, -390, -391, -392, -393, -394, -395, -396,
-    -397, -398, -399, -400, -401, -402, -403, -404,
-    -405, -406, -407, -408, -409, -410, -411, -412,
-    -413, -414, -415, -416, -417, -418, -419, -420,
-    -421, -422, -423, -424, -425, -426, -427, -428,
-    -429, -430, -431, -432, -433, -434, -435, -436,
-    -437, -438, -439, -440, -441, -442, -443, -444,
-    -445, -446, -447, -448, -449, -450, -451, -452,
-    -453, -454, -455, -456, -457, -458, -459, -460,
-    -461, -462, -463, -464, -465, -466, -467, -468,
-    -469, -470, -471, -472, -473, -474, -475, -476,
-    -477, -478, -479, -480, -481, -482, -483, -484,
-    -485, -486, -487, -488, -489, -490, -491, -492,
-    -493, -494, -495, -496, -497, -498, -499, -500,
-    -501, -502, -503, -504, -505, -506, -507, -508,
-    -509, -510, -511, -512, -513, -514, -515, -516,
-    -517, -518, -519, -520, -521, -522, -523, -524,
-    -525, -526, -527, -528, -529, -530, -531, -532,
-    -533, -534, -535, -536, -537, -538, -539, -540,
-    -541, -542, -543, -544, -545, -546, -547, -548,
-    -549, -550, -551, -552, -553, -554, -555, -556,
-    -557, -558, -559, -560, -561, -562, -563, -564,
-    -565, -566, -567, -568, -569, -570, -571, -572,
-    -573, -574, -575, -576, -577, -578, -579, -580
-};
-
-static const int16_t *const coeff_tables[32] = {
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    coeff_table_token_7_8,
-
-    coeff_table_token_7_8,
-    coeff_table_token_9,
-    coeff_table_token_10,
-    coeff_table_token_11,
-    coeff_table_token_12,
-    coeff_table_token_13,
-    coeff_table_token_14,
-    coeff_table_token_15,
-
-    coeff_table_token_16,
-    coeff_table_token_17,
-    coeff_table_token_18,
-    coeff_table_token_19,
-    coeff_table_token_20,
-    coeff_table_token_21,
-    coeff_table_token_22,
-    coeff_table_token_23_24_25_26_27_28_29,
-
-    coeff_table_token_23_24_25_26_27_28_29,
-    coeff_table_token_23_24_25_26_27_28_29,
-    coeff_table_token_23_24_25_26_27_28_29,
-    coeff_table_token_23_24_25_26_27_28_29,
-    coeff_table_token_23_24_25_26_27_28_29,
-    coeff_table_token_23_24_25_26_27_28_29,
-    coeff_table_token_30,
-    coeff_table_token_31
-};
-
-static const uint16_t dc_bias[16][32][2] = {
-  {  /* DC bias table 0 */
-    { 0x2D, 6 },
-    { 0x26, 7 },
-    { 0x166, 9 },
-    { 0x4E, 8 },
-    { 0x2CE, 10 },
-    { 0x59E, 11 },
-    { 0x27D, 11 },
-    { 0x8, 5 },
-    { 0x4F9, 12 },
-    { 0xF, 4 },
-    { 0xE, 4 },
-    { 0x1B, 5 },
-    { 0x6, 4 },
-    { 0x8, 4 },
-    { 0x5, 4 },
-    { 0x1A, 5 },
-    { 0x15, 5 },
-    { 0x7, 4 },
-    { 0xC, 4 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0x9, 4 },
-    { 0x17, 5 },
-    { 0x29, 6 },
-    { 0x28, 6 },
-    { 0xB2, 8 },
-    { 0x4F8, 12 },
-    { 0x59F, 11 },
-    { 0x9E, 9 },
-    { 0x13F, 10 },
-    { 0x12, 6 },
-    { 0x58, 7 }
-  },
-  {  /* DC bias table 1 */
-    { 0x10, 5 },
-    { 0x47, 7 },
-    { 0x1FF, 9 },
-    { 0x8C, 8 },
-    { 0x3FC, 10 },
-    { 0x46A, 11 },
-    { 0x469, 11 },
-    { 0x22, 6 },
-    { 0x11A1, 13 },
-    { 0xE, 4 },
-    { 0xD, 4 },
-    { 0x4, 4 },
-    { 0x5, 4 },
-    { 0x9, 4 },
-    { 0x6, 4 },
-    { 0x1E, 5 },
-    { 0x16, 5 },
-    { 0x7, 4 },
-    { 0xC, 4 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0xA, 4 },
-    { 0x17, 5 },
-    { 0x7D, 7 },
-    { 0x7E, 7 },
-    { 0x11B, 9 },
-    { 0x8D1, 12 },
-    { 0x3FD, 10 },
-    { 0x46B, 11 },
-    { 0x11A0, 13 },
-    { 0x7C, 7 },
-    { 0xFE, 8 }
-  },
-  {  /* DC bias table 2 */
-    { 0x16, 5 },
-    { 0x20, 6 },
-    { 0x86, 8 },
-    { 0x87, 8 },
-    { 0x367, 10 },
-    { 0x6CC, 11 },
-    { 0x6CB, 11 },
-    { 0x6E, 7 },
-    { 0x366D, 14 },
-    { 0xF, 4 },
-    { 0xE, 4 },
-    { 0x4, 4 },
-    { 0x5, 4 },
-    { 0xA, 4 },
-    { 0x6, 4 },
-    { 0x1A, 5 },
-    { 0x11, 5 },
-    { 0x7, 4 },
-    { 0xC, 4 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0x9, 4 },
-    { 0x17, 5 },
-    { 0x6F, 7 },
-    { 0x6D, 7 },
-    { 0x364, 10 },
-    { 0xD9A, 12 },
-    { 0x6CA, 11 },
-    { 0x1B37, 13 },
-    { 0x366C, 14 },
-    { 0x42, 7 },
-    { 0xD8, 8 }
-  },
-  {  /* DC bias table 3 */
-    { 0x0, 4 },
-    { 0x2D, 6 },
-    { 0xF7, 8 },
-    { 0x58, 7 },
-    { 0x167, 9 },
-    { 0x2CB, 10 },
-    { 0x2CA, 10 },
-    { 0xE, 6 },
-    { 0x1661, 13 },
-    { 0x3, 3 },
-    { 0x2, 3 },
-    { 0x8, 4 },
-    { 0x9, 4 },
-    { 0xD, 4 },
-    { 0x2, 4 },
-    { 0x1F, 5 },
-    { 0x17, 5 },
-    { 0x1, 4 },
-    { 0xC, 4 },
-    { 0xE, 4 },
-    { 0xA, 4 },
-    { 0x6, 5 },
-    { 0x78, 7 },
-    { 0xF, 6 },
-    { 0x7A, 7 },
-    { 0x164, 9 },
-    { 0x599, 11 },
-    { 0x2CD, 10 },
-    { 0xB31, 12 },
-    { 0x1660, 13 },
-    { 0x79, 7 },
-    { 0xF6, 8 }
-  },
-  {  /* DC bias table 4 */
-    { 0x3, 4 },
-    { 0x3C, 6 },
-    { 0xF, 7 },
-    { 0x7A, 7 },
-    { 0x1D, 8 },
-    { 0x20, 9 },
-    { 0x72, 10 },
-    { 0x6, 6 },
-    { 0x399, 13 },
-    { 0x4, 3 },
-    { 0x5, 3 },
-    { 0x5, 4 },
-    { 0x6, 4 },
-    { 0xE, 4 },
-    { 0x4, 4 },
-    { 0x0, 4 },
-    { 0x19, 5 },
-    { 0x2, 4 },
-    { 0xD, 4 },
-    { 0x7, 4 },
-    { 0x1F, 5 },
-    { 0x30, 6 },
-    { 0x11, 8 },
-    { 0x31, 6 },
-    { 0x5, 6 },
-    { 0x21, 9 },
-    { 0xE7, 11 },
-    { 0x38, 9 },
-    { 0x1CD, 12 },
-    { 0x398, 13 },
-    { 0x7B, 7 },
-    { 0x9, 7 }
-  },
-  {  /* DC bias table 5 */
-    { 0x9, 4 },
-    { 0x2, 5 },
-    { 0x74, 7 },
-    { 0x7, 6 },
-    { 0xEC, 8 },
-    { 0xD1, 9 },
-    { 0x1A6, 10 },
-    { 0x6, 6 },
-    { 0xD21, 13 },
-    { 0x5, 3 },
-    { 0x6, 3 },
-    { 0x8, 4 },
-    { 0x7, 4 },
-    { 0xF, 4 },
-    { 0x4, 4 },
-    { 0x0, 4 },
-    { 0x1C, 5 },
-    { 0x2, 4 },
-    { 0x5, 4 },
-    { 0x3, 4 },
-    { 0xC, 5 },
-    { 0x35, 7 },
-    { 0x1A7, 10 },
-    { 0x1B, 6 },
-    { 0x77, 7 },
-    { 0x1A5, 10 },
-    { 0x349, 11 },
-    { 0xD0, 9 },
-    { 0x691, 12 },
-    { 0xD20, 13 },
-    { 0x75, 7 },
-    { 0xED, 8 }
-  },
-  {  /* DC bias table 6 */
-    { 0xA, 4 },
-    { 0xC, 5 },
-    { 0x12, 6 },
-    { 0x1B, 6 },
-    { 0xB7, 8 },
-    { 0x16C, 9 },
-    { 0x99, 9 },
-    { 0x5A, 7 },
-    { 0x16D8, 13 },
-    { 0x7, 3 },
-    { 0x6, 3 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0x0, 3 },
-    { 0x5, 4 },
-    { 0x17, 5 },
-    { 0xE, 5 },
-    { 0x2, 4 },
-    { 0x3, 4 },
-    { 0xF, 5 },
-    { 0x1A, 6 },
-    { 0x4D, 8 },
-    { 0x2DB3, 14 },
-    { 0x2C, 6 },
-    { 0x11, 6 },
-    { 0x2DA, 10 },
-    { 0x5B7, 11 },
-    { 0x98, 9 },
-    { 0xB6D, 12 },
-    { 0x2DB2, 14 },
-    { 0x10, 6 },
-    { 0x27, 7 }
-  },
-  {  /* DC bias table 7 */
-    { 0xD, 4 },
-    { 0xF, 5 },
-    { 0x1D, 6 },
-    { 0x8, 5 },
-    { 0x51, 7 },
-    { 0x56, 8 },
-    { 0xAF, 9 },
-    { 0x2A, 7 },
-    { 0x148A, 13 },
-    { 0x7, 3 },
-    { 0x0, 2 },
-    { 0x8, 4 },
-    { 0x9, 4 },
-    { 0xC, 4 },
-    { 0x6, 4 },
-    { 0x17, 5 },
-    { 0xB, 5 },
-    { 0x16, 5 },
-    { 0x15, 5 },
-    { 0x9, 5 },
-    { 0x50, 7 },
-    { 0xAE, 9 },
-    { 0x2917, 14 },
-    { 0x1C, 6 },
-    { 0x14, 6 },
-    { 0x290, 10 },
-    { 0x523, 11 },
-    { 0x149, 9 },
-    { 0xA44, 12 },
-    { 0x2916, 14 },
-    { 0x53, 7 },
-    { 0xA5, 8 }
-  },
-  {  /* DC bias table 8 */
-    { 0x1, 4 },
-    { 0x1D, 6 },
-    { 0xF5, 8 },
-    { 0xF4, 8 },
-    { 0x24D, 10 },
-    { 0x499, 11 },
-    { 0x498, 11 },
-    { 0x1, 5 },
-    { 0x21, 6 },
-    { 0x6, 3 },
-    { 0x5, 3 },
-    { 0x6, 4 },
-    { 0x5, 4 },
-    { 0x2, 4 },
-    { 0x7, 5 },
-    { 0x25, 6 },
-    { 0x7B, 7 },
-    { 0x1C, 6 },
-    { 0x20, 6 },
-    { 0xD, 6 },
-    { 0x48, 7 },
-    { 0x92, 8 },
-    { 0x127, 9 },
-    { 0xE, 4 },
-    { 0x4, 4 },
-    { 0x11, 5 },
-    { 0xC, 6 },
-    { 0x3C, 6 },
-    { 0xF, 5 },
-    { 0x0, 5 },
-    { 0x1F, 5 },
-    { 0x13, 5 }
-  },
-  {  /* DC bias table 9 */
-    { 0x5, 4 },
-    { 0x3C, 6 },
-    { 0x40, 7 },
-    { 0xD, 7 },
-    { 0x31, 9 },
-    { 0x61, 10 },
-    { 0x60, 10 },
-    { 0x2, 5 },
-    { 0xF5, 8 },
-    { 0x6, 3 },
-    { 0x5, 3 },
-    { 0x7, 4 },
-    { 0x6, 4 },
-    { 0x2, 4 },
-    { 0x9, 5 },
-    { 0x25, 6 },
-    { 0x7, 6 },
-    { 0x21, 6 },
-    { 0x24, 6 },
-    { 0x10, 6 },
-    { 0x41, 7 },
-    { 0xF4, 8 },
-    { 0x19, 8 },
-    { 0xE, 4 },
-    { 0x3, 4 },
-    { 0x11, 5 },
-    { 0x11, 6 },
-    { 0x3F, 6 },
-    { 0x3E, 6 },
-    { 0x7B, 7 },
-    { 0x0, 4 },
-    { 0x13, 5 }
-  },
-  {  /* DC bias table 10 */
-    { 0xA, 4 },
-    { 0x7, 5 },
-    { 0x1, 6 },
-    { 0x9, 6 },
-    { 0x131, 9 },
-    { 0x261, 10 },
-    { 0x260, 10 },
-    { 0x15, 6 },
-    { 0x1, 7 },
-    { 0x7, 3 },
-    { 0x6, 3 },
-    { 0x8, 4 },
-    { 0x7, 4 },
-    { 0x6, 4 },
-    { 0x12, 5 },
-    { 0x2F, 6 },
-    { 0x14, 6 },
-    { 0x27, 6 },
-    { 0x2D, 6 },
-    { 0x16, 6 },
-    { 0x4D, 7 },
-    { 0x99, 8 },
-    { 0x0, 7 },
-    { 0x4, 4 },
-    { 0x1, 4 },
-    { 0x5, 5 },
-    { 0x17, 6 },
-    { 0x2E, 6 },
-    { 0x2C, 6 },
-    { 0x8, 6 },
-    { 0x6, 5 },
-    { 0x1, 5 }
-  },
-  {  /* DC bias table 11 */
-    { 0x0, 3 },
-    { 0xE, 5 },
-    { 0x17, 6 },
-    { 0x2A, 6 },
-    { 0x10, 7 },
-    { 0xF9, 10 },
-    { 0xF8, 10 },
-    { 0x1E, 7 },
-    { 0x3F, 8 },
-    { 0x7, 3 },
-    { 0x6, 3 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0x6, 4 },
-    { 0xF, 5 },
-    { 0x5, 5 },
-    { 0x16, 6 },
-    { 0x29, 6 },
-    { 0x2B, 6 },
-    { 0x15, 6 },
-    { 0x50, 7 },
-    { 0x11, 7 },
-    { 0x7D, 9 },
-    { 0x4, 4 },
-    { 0x17, 5 },
-    { 0x6, 5 },
-    { 0x14, 6 },
-    { 0x2C, 6 },
-    { 0x2D, 6 },
-    { 0xE, 6 },
-    { 0x9, 6 },
-    { 0x51, 7 }
-  },
-  {  /* DC bias table 12 */
-    { 0x2, 3 },
-    { 0x18, 5 },
-    { 0x2F, 6 },
-    { 0xD, 5 },
-    { 0x53, 7 },
-    { 0x295, 10 },
-    { 0x294, 10 },
-    { 0xA4, 8 },
-    { 0x7C, 8 },
-    { 0x0, 2 },
-    { 0x7, 3 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0x1B, 5 },
-    { 0xC, 5 },
-    { 0x28, 6 },
-    { 0x6A, 7 },
-    { 0x1E, 6 },
-    { 0x1D, 6 },
-    { 0x69, 7 },
-    { 0xD7, 8 },
-    { 0x7D, 8 },
-    { 0x14B, 9 },
-    { 0x19, 5 },
-    { 0x16, 5 },
-    { 0x2E, 6 },
-    { 0x1C, 6 },
-    { 0x2B, 6 },
-    { 0x2A, 6 },
-    { 0x68, 7 },
-    { 0x3F, 7 },
-    { 0xD6, 8 }
-  },
-  {  /* DC bias table 13 */
-    { 0x2, 3 },
-    { 0x1B, 5 },
-    { 0xC, 5 },
-    { 0x18, 5 },
-    { 0x29, 6 },
-    { 0x7F, 8 },
-    { 0x2F0, 10 },
-    { 0x198, 9 },
-    { 0x179, 9 },
-    { 0x0, 2 },
-    { 0x7, 3 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0x1A, 5 },
-    { 0xD, 5 },
-    { 0x2A, 6 },
-    { 0x64, 7 },
-    { 0x1E, 6 },
-    { 0x67, 7 },
-    { 0x5F, 7 },
-    { 0xCD, 8 },
-    { 0x7E, 8 },
-    { 0x2F1, 10 },
-    { 0x16, 5 },
-    { 0xE, 5 },
-    { 0x2E, 6 },
-    { 0x65, 7 },
-    { 0x2B, 6 },
-    { 0x28, 6 },
-    { 0x3E, 7 },
-    { 0xBD, 8 },
-    { 0x199, 9 }
-  },
-  {  /* DC bias table 14 */
-    { 0x2, 3 },
-    { 0x7, 4 },
-    { 0x16, 5 },
-    { 0x6, 4 },
-    { 0x36, 6 },
-    { 0x5C, 7 },
-    { 0x15D, 9 },
-    { 0x15C, 9 },
-    { 0x2BF, 10 },
-    { 0x0, 2 },
-    { 0x7, 3 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0x18, 5 },
-    { 0x34, 6 },
-    { 0x2A, 6 },
-    { 0x5E, 7 },
-    { 0x6A, 7 },
-    { 0x64, 7 },
-    { 0x5D, 7 },
-    { 0xCB, 8 },
-    { 0xAD, 8 },
-    { 0x2BE, 10 },
-    { 0x14, 5 },
-    { 0x33, 6 },
-    { 0x6E, 7 },
-    { 0x5F, 7 },
-    { 0x6F, 7 },
-    { 0x6B, 7 },
-    { 0xCA, 8 },
-    { 0xAC, 8 },
-    { 0x15E, 9 }
-  },
-  {  /* DC bias table 15 */
-    { 0xF, 4 },
-    { 0x1D, 5 },
-    { 0x18, 5 },
-    { 0xB, 4 },
-    { 0x19, 5 },
-    { 0x29, 6 },
-    { 0xD6, 8 },
-    { 0x551, 11 },
-    { 0xAA1, 12 },
-    { 0x1, 2 },
-    { 0x0, 2 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0x1B, 5 },
-    { 0x38, 6 },
-    { 0x28, 6 },
-    { 0x57, 7 },
-    { 0x6A, 7 },
-    { 0x68, 7 },
-    { 0x56, 7 },
-    { 0xE5, 8 },
-    { 0x155, 9 },
-    { 0xAA0, 12 },
-    { 0x73, 7 },
-    { 0x69, 7 },
-    { 0xD7, 8 },
-    { 0xAB, 8 },
-    { 0xE4, 8 },
-    { 0xA9, 8 },
-    { 0x151, 9 },
-    { 0x150, 9 },
-    { 0x2A9, 10 }
-  }
-};
-
-static const uint16_t ac_bias_0[16][32][2] = {
-  {  /* AC bias group 1, table 0 */
-    { 0x8, 5 },
-    { 0x25, 7 },
-    { 0x17A, 9 },
-    { 0x2F7, 10 },
-    { 0xBDB, 12 },
-    { 0x17B4, 13 },
-    { 0x2F6B, 14 },
-    { 0x1D, 5 },
-    { 0x2F6A, 14 },
-    { 0x8, 4 },
-    { 0x7, 4 },
-    { 0x1, 4 },
-    { 0x2, 4 },
-    { 0xA, 4 },
-    { 0x6, 4 },
-    { 0x0, 4 },
-    { 0x1C, 5 },
-    { 0x9, 4 },
-    { 0xD, 4 },
-    { 0xF, 4 },
-    { 0xC, 4 },
-    { 0x3, 4 },
-    { 0xA, 5 },
-    { 0x16, 5 },
-    { 0x13, 6 },
-    { 0x5D, 7 },
-    { 0x24, 7 },
-    { 0xBC, 8 },
-    { 0x5C, 7 },
-    { 0x5EC, 11 },
-    { 0xB, 5 },
-    { 0x5F, 7 }
-  },
-  {  /* AC bias group 1, table 1 */
-    { 0xF, 5 },
-    { 0x10, 6 },
-    { 0x4B, 8 },
-    { 0xC6, 8 },
-    { 0x31D, 10 },
-    { 0xC71, 12 },
-    { 0xC70, 12 },
-    { 0x1, 4 },
-    { 0xC73, 12 },
-    { 0x8, 4 },
-    { 0x9, 4 },
-    { 0x2, 4 },
-    { 0x3, 4 },
-    { 0xB, 4 },
-    { 0x6, 4 },
-    { 0x0, 4 },
-    { 0x1C, 5 },
-    { 0x5, 4 },
-    { 0xD, 4 },
-    { 0xF, 4 },
-    { 0xA, 4 },
-    { 0x19, 5 },
-    { 0x13, 6 },
-    { 0x1D, 5 },
-    { 0x30, 6 },
-    { 0x62, 7 },
-    { 0x24, 7 },
-    { 0x4A, 8 },
-    { 0x18F, 9 },
-    { 0xC72, 12 },
-    { 0xE, 5 },
-    { 0x11, 6 }
-  },
-  {  /* AC bias group 1, table 2 */
-    { 0x1B, 5 },
-    { 0x3, 6 },
-    { 0x8D, 8 },
-    { 0x40, 7 },
-    { 0x239, 10 },
-    { 0x471, 11 },
-    { 0x8E0, 12 },
-    { 0x3, 4 },
-    { 0x11C3, 13 },
-    { 0xA, 4 },
-    { 0x9, 4 },
-    { 0x4, 4 },
-    { 0x5, 4 },
-    { 0xE, 4 },
-    { 0x7, 4 },
-    { 0x1, 4 },
-    { 0x1E, 5 },
-    { 0x6, 4 },
-    { 0xC, 4 },
-    { 0xB, 4 },
-    { 0x2, 4 },
-    { 0x0, 5 },
-    { 0x41, 7 },
-    { 0x1F, 5 },
-    { 0x22, 6 },
-    { 0x2, 6 },
-    { 0x8F, 8 },
-    { 0x8C, 8 },
-    { 0x11D, 9 },
-    { 0x11C2, 13 },
-    { 0x1A, 5 },
-    { 0x21, 6 }
-  },
-  {  /* AC bias group 1, table 3 */
-    { 0x1F, 5 },
-    { 0x3, 6 },
-    { 0x3, 7 },
-    { 0x43, 7 },
-    { 0xB, 9 },
-    { 0x15, 10 },
-    { 0x51, 12 },
-    { 0x3, 4 },
-    { 0x50, 12 },
-    { 0xD, 4 },
-    { 0xC, 4 },
-    { 0x4, 4 },
-    { 0x6, 4 },
-    { 0xE, 4 },
-    { 0xA, 4 },
-    { 0x1, 4 },
-    { 0x1E, 5 },
-    { 0x5, 4 },
-    { 0x9, 4 },
-    { 0x7, 4 },
-    { 0x11, 5 },
-    { 0x2, 6 },
-    { 0x4, 8 },
-    { 0x2, 4 },
-    { 0x2D, 6 },
-    { 0x20, 6 },
-    { 0x42, 7 },
-    { 0x1, 7 },
-    { 0x0, 7 },
-    { 0x29, 11 },
-    { 0x17, 5 },
-    { 0x2C, 6 }
-  },
-  {  /* AC bias group 1, table 4 */
-    { 0x3, 4 },
-    { 0x1F, 6 },
-    { 0x3A, 7 },
-    { 0x5D, 7 },
-    { 0x173, 9 },
-    { 0x2E4, 10 },
-    { 0x172D, 13 },
-    { 0x4, 4 },
-    { 0x172C, 13 },
-    { 0xF, 4 },
-    { 0xE, 4 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0xC, 4 },
-    { 0xA, 4 },
-    { 0x1, 4 },
-    { 0x16, 5 },
-    { 0x2, 4 },
-    { 0x5, 4 },
-    { 0x1A, 5 },
-    { 0x2F, 6 },
-    { 0x38, 7 },
-    { 0x5CA, 11 },
-    { 0x6, 4 },
-    { 0x37, 6 },
-    { 0x1E, 6 },
-    { 0x3B, 7 },
-    { 0x39, 7 },
-    { 0xB8, 8 },
-    { 0xB97, 12 },
-    { 0x0, 4 },
-    { 0x36, 6 }
-  },
-  {  /* AC bias group 1, table 5 */
-    { 0x6, 4 },
-    { 0x37, 6 },
-    { 0x5D, 7 },
-    { 0xC, 6 },
-    { 0xB9, 8 },
-    { 0x2E3, 10 },
-    { 0x5C4, 11 },
-    { 0x4, 4 },
-    { 0x1715, 13 },
-    { 0x0, 3 },
-    { 0xF, 4 },
-    { 0x8, 4 },
-    { 0x7, 4 },
-    { 0xC, 4 },
-    { 0x9, 4 },
-    { 0x1D, 5 },
-    { 0x16, 5 },
-    { 0x1C, 5 },
-    { 0x1A, 5 },
-    { 0xB, 5 },
-    { 0x5E, 7 },
-    { 0x170, 9 },
-    { 0x1714, 13 },
-    { 0xA, 4 },
-    { 0xA, 5 },
-    { 0x36, 6 },
-    { 0x5F, 7 },
-    { 0x1B, 7 },
-    { 0x1A, 7 },
-    { 0xB8B, 12 },
-    { 0x2, 4 },
-    { 0x7, 5 }
-  },
-  {  /* AC bias group 1, table 6 */
-    { 0xC, 4 },
-    { 0xB, 5 },
-    { 0x79, 7 },
-    { 0x22, 6 },
-    { 0xF0, 8 },
-    { 0x119, 9 },
-    { 0x230, 10 },
-    { 0x1D, 5 },
-    { 0x8C4, 12 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0xA, 4 },
-    { 0x9, 4 },
-    { 0xB, 4 },
-    { 0x7, 4 },
-    { 0x1C, 5 },
-    { 0x3D, 6 },
-    { 0xD, 5 },
-    { 0x8, 5 },
-    { 0x15, 6 },
-    { 0x8D, 8 },
-    { 0x118B, 13 },
-    { 0x118A, 13 },
-    { 0xD, 4 },
-    { 0x10, 5 },
-    { 0x9, 5 },
-    { 0x14, 6 },
-    { 0x47, 7 },
-    { 0xF1, 8 },
-    { 0x463, 11 },
-    { 0x1F, 5 },
-    { 0xC, 5 }
-  },
-  {  /* AC bias group 1, table 7 */
-    { 0x0, 3 },
-    { 0x1A, 5 },
-    { 0x33, 6 },
-    { 0xC, 5 },
-    { 0x46, 7 },
-    { 0x1E3, 9 },
-    { 0x3C5, 10 },
-    { 0x17, 5 },
-    { 0x1E21, 13 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0x9, 4 },
-    { 0xA, 4 },
-    { 0x7, 4 },
-    { 0x1B, 5 },
-    { 0x3D, 6 },
-    { 0x1B, 6 },
-    { 0x22, 6 },
-    { 0x79, 7 },
-    { 0xF0, 8 },
-    { 0x1E20, 13 },
-    { 0x1E23, 13 },
-    { 0x1E22, 13 },
-    { 0xE, 4 },
-    { 0x16, 5 },
-    { 0x18, 5 },
-    { 0x32, 6 },
-    { 0x1A, 6 },
-    { 0x47, 7 },
-    { 0x789, 11 },
-    { 0x1F, 5 },
-    { 0x10, 5 }
-  },
-  {  /* AC bias group 1, table 8 */
-    { 0x1D, 5 },
-    { 0x61, 7 },
-    { 0x4E, 8 },
-    { 0x9E, 9 },
-    { 0x27C, 11 },
-    { 0x9F5, 13 },
-    { 0x9F4, 13 },
-    { 0x3, 4 },
-    { 0x60, 7 },
-    { 0x0, 3 },
-    { 0xF, 4 },
-    { 0xB, 4 },
-    { 0xA, 4 },
-    { 0x9, 4 },
-    { 0x5, 4 },
-    { 0xD, 5 },
-    { 0x31, 6 },
-    { 0x8, 5 },
-    { 0x38, 6 },
-    { 0x12, 6 },
-    { 0x26, 7 },
-    { 0x13F, 10 },
-    { 0x4FB, 12 },
-    { 0xD, 4 },
-    { 0x2, 4 },
-    { 0xC, 5 },
-    { 0x39, 6 },
-    { 0x1C, 6 },
-    { 0xF, 5 },
-    { 0x1D, 6 },
-    { 0x8, 4 },
-    { 0x19, 5 }
-  },
-  {  /* AC bias group 1, table 9 */
-    { 0x7, 4 },
-    { 0x19, 6 },
-    { 0xAB, 8 },
-    { 0xAA, 8 },
-    { 0x119, 10 },
-    { 0x461, 12 },
-    { 0x460, 12 },
-    { 0x1B, 5 },
-    { 0x47, 8 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0xC, 4 },
-    { 0xB, 4 },
-    { 0x9, 4 },
-    { 0x5, 4 },
-    { 0xD, 5 },
-    { 0x35, 6 },
-    { 0x3D, 6 },
-    { 0x3C, 6 },
-    { 0x18, 6 },
-    { 0x22, 7 },
-    { 0x8D, 9 },
-    { 0x231, 11 },
-    { 0xE, 4 },
-    { 0x1F, 5 },
-    { 0x9, 5 },
-    { 0x2B, 6 },
-    { 0x10, 6 },
-    { 0x34, 6 },
-    { 0x54, 7 },
-    { 0x8, 4 },
-    { 0x14, 5 }
-  },
-  {  /* AC bias group 1, table 10 */
-    { 0xC, 4 },
-    { 0x5, 5 },
-    { 0x8, 6 },
-    { 0x5B, 7 },
-    { 0x4D, 9 },
-    { 0x131, 11 },
-    { 0x261, 12 },
-    { 0x1A, 5 },
-    { 0x12, 7 },
-    { 0x0, 3 },
-    { 0xF, 4 },
-    { 0xA, 4 },
-    { 0x9, 4 },
-    { 0x6, 4 },
-    { 0x1B, 5 },
-    { 0x6, 5 },
-    { 0x1C, 6 },
-    { 0x2C, 6 },
-    { 0x15, 6 },
-    { 0x5A, 7 },
-    { 0x27, 8 },
-    { 0x99, 10 },
-    { 0x260, 12 },
-    { 0xE, 4 },
-    { 0x4, 4 },
-    { 0xF, 5 },
-    { 0x7, 5 },
-    { 0x1D, 6 },
-    { 0xB, 5 },
-    { 0x14, 6 },
-    { 0x8, 4 },
-    { 0x17, 5 }
-  },
-  {  /* AC bias group 1, table 11 */
-    { 0xF, 4 },
-    { 0x13, 5 },
-    { 0x75, 7 },
-    { 0x24, 6 },
-    { 0x95, 8 },
-    { 0x251, 10 },
-    { 0x4A0, 11 },
-    { 0x10, 5 },
-    { 0xC8, 8 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0x1, 4 },
-    { 0x0, 4 },
-    { 0x1A, 5 },
-    { 0x11, 5 },
-    { 0x2C, 6 },
-    { 0x65, 7 },
-    { 0x74, 7 },
-    { 0x4B, 7 },
-    { 0xC9, 8 },
-    { 0x129, 9 },
-    { 0x943, 12 },
-    { 0x942, 12 },
-    { 0x3, 3 },
-    { 0xA, 4 },
-    { 0x1C, 5 },
-    { 0x18, 5 },
-    { 0x33, 6 },
-    { 0x17, 5 },
-    { 0x2D, 6 },
-    { 0x1B, 5 },
-    { 0x3B, 6 }
-  },
-  {  /* AC bias group 1, table 12 */
-    { 0x3, 3 },
-    { 0x1A, 5 },
-    { 0x2D, 6 },
-    { 0x38, 6 },
-    { 0x28, 7 },
-    { 0x395, 10 },
-    { 0xE51, 12 },
-    { 0x37, 6 },
-    { 0xE4, 8 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0x1F, 5 },
-    { 0x1E, 5 },
-    { 0x17, 5 },
-    { 0x3A, 6 },
-    { 0x73, 7 },
-    { 0x2A, 7 },
-    { 0x2B, 7 },
-    { 0x29, 7 },
-    { 0x1CB, 9 },
-    { 0x729, 11 },
-    { 0x1CA1, 13 },
-    { 0x1CA0, 13 },
-    { 0x4, 3 },
-    { 0xA, 4 },
-    { 0x4, 4 },
-    { 0x18, 5 },
-    { 0x36, 6 },
-    { 0xB, 5 },
-    { 0x2C, 6 },
-    { 0x19, 5 },
-    { 0x3B, 6 }
-  },
-  {  /* AC bias group 1, table 13 */
-    { 0x4, 3 },
-    { 0x4, 4 },
-    { 0x3F, 6 },
-    { 0x17, 5 },
-    { 0x75, 7 },
-    { 0x1F5, 9 },
-    { 0x7D1, 11 },
-    { 0x17, 6 },
-    { 0x1F6, 9 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0x1B, 5 },
-    { 0x1A, 5 },
-    { 0xA, 5 },
-    { 0x32, 6 },
-    { 0x74, 7 },
-    { 0xF8, 8 },
-    { 0xF9, 8 },
-    { 0x1F7, 9 },
-    { 0x3E9, 10 },
-    { 0xFA0, 12 },
-    { 0x1F43, 13 },
-    { 0x1F42, 13 },
-    { 0x3, 3 },
-    { 0xA, 4 },
-    { 0x1E, 5 },
-    { 0x1C, 5 },
-    { 0x3B, 6 },
-    { 0x18, 5 },
-    { 0x16, 6 },
-    { 0x16, 5 },
-    { 0x33, 6 }
-  },
-  {  /* AC bias group 1, table 14 */
-    { 0x4, 3 },
-    { 0x7, 4 },
-    { 0x18, 5 },
-    { 0x1E, 5 },
-    { 0x36, 6 },
-    { 0x31, 7 },
-    { 0x177, 9 },
-    { 0x77, 7 },
-    { 0x176, 9 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0x1A, 5 },
-    { 0x19, 5 },
-    { 0x3A, 6 },
-    { 0x19, 6 },
-    { 0x5C, 7 },
-    { 0xBA, 8 },
-    { 0x61, 8 },
-    { 0xC1, 9 },
-    { 0x180, 10 },
-    { 0x302, 11 },
-    { 0x607, 12 },
-    { 0x606, 12 },
-    { 0x2, 3 },
-    { 0xA, 4 },
-    { 0x1F, 5 },
-    { 0x1C, 5 },
-    { 0x37, 6 },
-    { 0x16, 5 },
-    { 0x76, 7 },
-    { 0xD, 5 },
-    { 0x2F, 6 }
-  },
-  {  /* AC bias group 1, table 15 */
-    { 0x0, 3 },
-    { 0xA, 4 },
-    { 0x1A, 5 },
-    { 0xC, 4 },
-    { 0x1D, 5 },
-    { 0x39, 6 },
-    { 0x78, 7 },
-    { 0x5E, 7 },
-    { 0x393, 11 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0x16, 5 },
-    { 0xF, 5 },
-    { 0x2E, 6 },
-    { 0x5F, 7 },
-    { 0x73, 8 },
-    { 0xE5, 9 },
-    { 0x1C8, 10 },
-    { 0xE4A, 13 },
-    { 0x1C97, 14 },
-    { 0x1C96, 14 },
-    { 0xE49, 13 },
-    { 0xE48, 13 },
-    { 0x4, 3 },
-    { 0x6, 4 },
-    { 0x1F, 5 },
-    { 0x1B, 5 },
-    { 0x1D, 6 },
-    { 0x38, 6 },
-    { 0x38, 7 },
-    { 0x3D, 6 },
-    { 0x79, 7 }
-  }
-};
-
-static const uint16_t ac_bias_1[16][32][2] = {
-  {  /* AC bias group 2, table 0 */
-    { 0xB, 5 },
-    { 0x2B, 7 },
-    { 0x54, 8 },
-    { 0x1B7, 9 },
-    { 0x6D9, 11 },
-    { 0xDB1, 12 },
-    { 0xDB0, 12 },
-    { 0x2, 4 },
-    { 0xAB, 9 },
-    { 0x9, 4 },
-    { 0xA, 4 },
-    { 0x7, 4 },
-    { 0x8, 4 },
-    { 0xF, 4 },
-    { 0xC, 4 },
-    { 0x3, 4 },
-    { 0x1D, 5 },
-    { 0x4, 4 },
-    { 0xB, 4 },
-    { 0x6, 4 },
-    { 0x1A, 5 },
-    { 0x3, 6 },
-    { 0xAA, 9 },
-    { 0x1, 4 },
-    { 0x0, 5 },
-    { 0x14, 6 },
-    { 0x6C, 7 },
-    { 0xDA, 8 },
-    { 0x2, 6 },
-    { 0x36D, 10 },
-    { 0x1C, 5 },
-    { 0x37, 6 }
-  },
-  {  /* AC bias group 2, table 1 */
-    { 0x1D, 5 },
-    { 0x4, 6 },
-    { 0xB6, 8 },
-    { 0x6A, 8 },
-    { 0x5B9, 11 },
-    { 0x16E1, 13 },
-    { 0x16E0, 13 },
-    { 0x7, 4 },
-    { 0x16F, 9 },
-    { 0xC, 4 },
-    { 0xD, 4 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0xF, 4 },
-    { 0xA, 4 },
-    { 0x3, 4 },
-    { 0x17, 5 },
-    { 0x2, 4 },
-    { 0x4, 4 },
-    { 0x1C, 5 },
-    { 0x2C, 6 },
-    { 0x6B, 8 },
-    { 0xB71, 12 },
-    { 0x5, 4 },
-    { 0x3, 5 },
-    { 0x1B, 6 },
-    { 0x5A, 7 },
-    { 0x34, 7 },
-    { 0x5, 6 },
-    { 0x2DD, 10 },
-    { 0x0, 4 },
-    { 0xC, 5 }
-  },
-  {  /* AC bias group 2, table 2 */
-    { 0x3, 4 },
-    { 0x7F, 7 },
-    { 0xA1, 8 },
-    { 0xA0, 8 },
-    { 0x20C, 10 },
-    { 0x834, 12 },
-    { 0x106B, 13 },
-    { 0x7, 4 },
-    { 0x82, 8 },
-    { 0xE, 4 },
-    { 0xD, 4 },
-    { 0xB, 4 },
-    { 0xC, 4 },
-    { 0x0, 3 },
-    { 0x9, 4 },
-    { 0x2, 4 },
-    { 0x11, 5 },
-    { 0x1E, 5 },
-    { 0x15, 5 },
-    { 0x3E, 6 },
-    { 0x40, 7 },
-    { 0x41B, 11 },
-    { 0x106A, 13 },
-    { 0x6, 4 },
-    { 0xA, 5 },
-    { 0x29, 6 },
-    { 0x7E, 7 },
-    { 0x51, 7 },
-    { 0x21, 6 },
-    { 0x107, 9 },
-    { 0x4, 4 },
-    { 0xB, 5 }
-  },
-  {  /* AC bias group 2, table 3 */
-    { 0x7, 4 },
-    { 0x1B, 6 },
-    { 0xF6, 8 },
-    { 0xE9, 8 },
-    { 0x3A1, 10 },
-    { 0x740, 11 },
-    { 0xE82, 12 },
-    { 0x1F, 5 },
-    { 0x1EF, 9 },
-    { 0x1, 3 },
-    { 0x2, 3 },
-    { 0xB, 4 },
-    { 0xC, 4 },
-    { 0xD, 4 },
-    { 0x8, 4 },
-    { 0x1C, 5 },
-    { 0x3, 5 },
-    { 0x12, 5 },
-    { 0x2, 5 },
-    { 0x75, 7 },
-    { 0x1D1, 9 },
-    { 0x1D07, 13 },
-    { 0x1D06, 13 },
-    { 0xA, 4 },
-    { 0x13, 5 },
-    { 0x3B, 6 },
-    { 0x1A, 6 },
-    { 0x7A, 7 },
-    { 0x3C, 6 },
-    { 0x1EE, 9 },
-    { 0x0, 4 },
-    { 0xC, 5 }
-  },
-  {  /* AC bias group 2, table 4 */
-    { 0xD, 4 },
-    { 0x3D, 6 },
-    { 0x42, 7 },
-    { 0x37, 7 },
-    { 0xD9, 9 },
-    { 0x362, 11 },
-    { 0x6C6, 12 },
-    { 0x1F, 5 },
-    { 0x86, 8 },
-    { 0x1, 3 },
-    { 0x2, 3 },
-    { 0xC, 4 },
-    { 0xB, 4 },
-    { 0xA, 4 },
-    { 0x1, 4 },
-    { 0xF, 5 },
-    { 0x25, 6 },
-    { 0x3C, 6 },
-    { 0x1A, 6 },
-    { 0x87, 8 },
-    { 0x1B0, 10 },
-    { 0xD8F, 13 },
-    { 0xD8E, 13 },
-    { 0xE, 4 },
-    { 0x13, 5 },
-    { 0xC, 5 },
-    { 0x24, 6 },
-    { 0x20, 6 },
-    { 0x11, 5 },
-    { 0x6D, 8 },
-    { 0x0, 4 },
-    { 0xE, 5 }
-  },
-  {  /* AC bias group 2, table 5 */
-    { 0x0, 3 },
-    { 0x12, 5 },
-    { 0x76, 7 },
-    { 0x77, 7 },
-    { 0x14D, 9 },
-    { 0x533, 11 },
-    { 0x14C9, 13 },
-    { 0x13, 5 },
-    { 0xA5, 8 },
-    { 0x2, 3 },
-    { 0x3, 3 },
-    { 0xB, 4 },
-    { 0xC, 4 },
-    { 0x8, 4 },
-    { 0x1A, 5 },
-    { 0x2B, 6 },
-    { 0x75, 7 },
-    { 0x74, 7 },
-    { 0xA7, 8 },
-    { 0x298, 10 },
-    { 0x14C8, 13 },
-    { 0x14CB, 13 },
-    { 0x14CA, 13 },
-    { 0xF, 4 },
-    { 0x1C, 5 },
-    { 0x7, 5 },
-    { 0x2A, 6 },
-    { 0x28, 6 },
-    { 0x1B, 5 },
-    { 0xA4, 8 },
-    { 0x2, 4 },
-    { 0x6, 5 }
-  },
-  {  /* AC bias group 2, table 6 */
-    { 0x2, 3 },
-    { 0x1A, 5 },
-    { 0x2B, 6 },
-    { 0x3A, 6 },
-    { 0xED, 8 },
-    { 0x283, 10 },
-    { 0xA0A, 12 },
-    { 0x4, 5 },
-    { 0xA1, 8 },
-    { 0x4, 3 },
-    { 0x3, 3 },
-    { 0xB, 4 },
-    { 0xC, 4 },
-    { 0x1F, 5 },
-    { 0x6, 5 },
-    { 0x77, 7 },
-    { 0xA3, 8 },
-    { 0xA2, 8 },
-    { 0x140, 9 },
-    { 0x1417, 13 },
-    { 0x1416, 13 },
-    { 0xA09, 12 },
-    { 0xA08, 12 },
-    { 0x0, 3 },
-    { 0x1E, 5 },
-    { 0x7, 5 },
-    { 0x2A, 6 },
-    { 0x29, 6 },
-    { 0x1C, 5 },
-    { 0xEC, 8 },
-    { 0x1B, 5 },
-    { 0x5, 5 }
-  },
-  {  /* AC bias group 2, table 7 */
-    { 0x2, 3 },
-    { 0x2, 4 },
-    { 0x18, 5 },
-    { 0x1D, 5 },
-    { 0x35, 6 },
-    { 0xE4, 8 },
-    { 0x1CF, 11 },
-    { 0x1D, 7 },
-    { 0x72, 9 },
-    { 0x4, 3 },
-    { 0x5, 3 },
-    { 0x6, 4 },
-    { 0x7, 4 },
-    { 0x6, 5 },
-    { 0x73, 7 },
-    { 0x38, 8 },
-    { 0x1CE, 11 },
-    { 0x39B, 12 },
-    { 0x398, 12 },
-    { 0x733, 13 },
-    { 0x732, 13 },
-    { 0x735, 13 },
-    { 0x734, 13 },
-    { 0x0, 3 },
-    { 0x1F, 5 },
-    { 0x1B, 5 },
-    { 0x34, 6 },
-    { 0xF, 6 },
-    { 0x1E, 5 },
-    { 0xE5, 8 },
-    { 0x19, 5 },
-    { 0x38, 6 }
-  },
-  {  /* AC bias group 2, table 8 */
-    { 0x16, 5 },
-    { 0x50, 7 },
-    { 0x172, 9 },
-    { 0x2E7, 10 },
-    { 0x1732, 13 },
-    { 0x2E67, 14 },
-    { 0x2E66, 14 },
-    { 0x6, 4 },
-    { 0x51, 7 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0xD, 4 },
-    { 0xC, 4 },
-    { 0x9, 4 },
-    { 0x1C, 5 },
-    { 0x9, 5 },
-    { 0x1C, 6 },
-    { 0x1D, 6 },
-    { 0x5D, 7 },
-    { 0xB8, 8 },
-    { 0x5CD, 11 },
-    { 0x1731, 13 },
-    { 0x1730, 13 },
-    { 0xF, 4 },
-    { 0x5, 4 },
-    { 0xF, 5 },
-    { 0x8, 5 },
-    { 0x29, 6 },
-    { 0x1D, 5 },
-    { 0x2F, 6 },
-    { 0x8, 4 },
-    { 0x15, 5 }
-  },
-  {  /* AC bias group 2, table 9 */
-    { 0x9, 4 },
-    { 0x21, 6 },
-    { 0x40, 7 },
-    { 0xAD, 8 },
-    { 0x2B0, 10 },
-    { 0x1589, 13 },
-    { 0x1588, 13 },
-    { 0x1C, 5 },
-    { 0x5F, 7 },
-    { 0x0, 3 },
-    { 0xF, 4 },
-    { 0xD, 4 },
-    { 0xC, 4 },
-    { 0x6, 4 },
-    { 0x11, 5 },
-    { 0x2A, 6 },
-    { 0x57, 7 },
-    { 0x5E, 7 },
-    { 0x41, 7 },
-    { 0x159, 9 },
-    { 0x563, 11 },
-    { 0x158B, 13 },
-    { 0x158A, 13 },
-    { 0x1, 3 },
-    { 0x5, 4 },
-    { 0x14, 5 },
-    { 0x3B, 6 },
-    { 0x2E, 6 },
-    { 0x4, 4 },
-    { 0x3A, 6 },
-    { 0x7, 4 },
-    { 0x16, 5 }
-  },
-  {  /* AC bias group 2, table 10 */
-    { 0xE, 4 },
-    { 0x7, 5 },
-    { 0x46, 7 },
-    { 0x45, 7 },
-    { 0x64, 9 },
-    { 0x32A, 12 },
-    { 0x657, 13 },
-    { 0x18, 5 },
-    { 0xD, 6 },
-    { 0x0, 3 },
-    { 0xF, 4 },
-    { 0xA, 4 },
-    { 0xB, 4 },
-    { 0x1A, 5 },
-    { 0x36, 6 },
-    { 0x47, 7 },
-    { 0x44, 7 },
-    { 0x18, 7 },
-    { 0x33, 8 },
-    { 0xCB, 10 },
-    { 0x656, 13 },
-    { 0x329, 12 },
-    { 0x328, 12 },
-    { 0x2, 3 },
-    { 0x6, 4 },
-    { 0x19, 5 },
-    { 0xE, 5 },
-    { 0x37, 6 },
-    { 0x9, 4 },
-    { 0xF, 5 },
-    { 0x2, 4 },
-    { 0x10, 5 }
-  },
-  {  /* AC bias group 2, table 11 */
-    { 0x3, 3 },
-    { 0x18, 5 },
-    { 0x23, 6 },
-    { 0x77, 7 },
-    { 0x194, 9 },
-    { 0x1956, 13 },
-    { 0x32AF, 14 },
-    { 0x3A, 6 },
-    { 0x76, 7 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0x1F, 5 },
-    { 0x1E, 5 },
-    { 0x14, 5 },
-    { 0x22, 6 },
-    { 0x64, 7 },
-    { 0x197, 9 },
-    { 0x196, 9 },
-    { 0x32B, 10 },
-    { 0x654, 11 },
-    { 0x32AE, 14 },
-    { 0x1955, 13 },
-    { 0x1954, 13 },
-    { 0x0, 3 },
-    { 0x9, 4 },
-    { 0x1C, 5 },
-    { 0x15, 5 },
-    { 0x10, 5 },
-    { 0xD, 4 },
-    { 0x17, 5 },
-    { 0x16, 5 },
-    { 0x33, 6 }
-  },
-  {  /* AC bias group 2, table 12 */
-    { 0x5, 3 },
-    { 0x6, 4 },
-    { 0x3E, 6 },
-    { 0x10, 5 },
-    { 0x48, 7 },
-    { 0x93F, 12 },
-    { 0x24FA, 14 },
-    { 0x32, 6 },
-    { 0x67, 7 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0x1B, 5 },
-    { 0x1E, 5 },
-    { 0x34, 6 },
-    { 0x66, 7 },
-    { 0x92, 8 },
-    { 0x126, 9 },
-    { 0x24E, 10 },
-    { 0x49E, 11 },
-    { 0x49F7, 15 },
-    { 0x49F6, 15 },
-    { 0x24F9, 14 },
-    { 0x24F8, 14 },
-    { 0x0, 3 },
-    { 0x7, 4 },
-    { 0x18, 5 },
-    { 0x11, 5 },
-    { 0x3F, 6 },
-    { 0xE, 4 },
-    { 0x13, 5 },
-    { 0x35, 6 },
-    { 0x25, 6 }
-  },
-  {  /* AC bias group 2, table 13 */
-    { 0x5, 3 },
-    { 0x8, 4 },
-    { 0x12, 5 },
-    { 0x1C, 5 },
-    { 0x1C, 6 },
-    { 0xEA, 9 },
-    { 0x1D75, 14 },
-    { 0x1E, 6 },
-    { 0x66, 7 },
-    { 0x1, 3 },
-    { 0x2, 3 },
-    { 0x1B, 5 },
-    { 0x1A, 5 },
-    { 0x1F, 6 },
-    { 0x3B, 7 },
-    { 0x74, 8 },
-    { 0x1D6, 10 },
-    { 0x3AF, 11 },
-    { 0x1D74, 14 },
-    { 0x1D77, 14 },
-    { 0x1D76, 14 },
-    { 0xEB9, 13 },
-    { 0xEB8, 13 },
-    { 0xF, 4 },
-    { 0x6, 4 },
-    { 0x13, 5 },
-    { 0x3B, 6 },
-    { 0x3A, 6 },
-    { 0x0, 3 },
-    { 0x18, 5 },
-    { 0x32, 6 },
-    { 0x67, 7 }
-  },
-  {  /* AC bias group 2, table 14 */
-    { 0x4, 3 },
-    { 0xA, 4 },
-    { 0x1B, 5 },
-    { 0xC, 4 },
-    { 0xD, 5 },
-    { 0xE6, 8 },
-    { 0x684, 11 },
-    { 0x72, 7 },
-    { 0xE7, 8 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0x17, 5 },
-    { 0x16, 5 },
-    { 0x18, 6 },
-    { 0xD1, 8 },
-    { 0x1A0, 9 },
-    { 0x686, 11 },
-    { 0xD0F, 12 },
-    { 0xD0A, 12 },
-    { 0x1A17, 13 },
-    { 0x1A16, 13 },
-    { 0x1A1D, 13 },
-    { 0x1A1C, 13 },
-    { 0xF, 4 },
-    { 0x1D, 5 },
-    { 0xE, 5 },
-    { 0x35, 6 },
-    { 0x38, 6 },
-    { 0x0, 3 },
-    { 0xF, 5 },
-    { 0x19, 6 },
-    { 0x69, 7 }
-  },
-  {  /* AC bias group 2, table 15 */
-    { 0x3, 3 },
-    { 0xC, 4 },
-    { 0x1B, 5 },
-    { 0x0, 3 },
-    { 0x3, 4 },
-    { 0x2E, 6 },
-    { 0x51, 9 },
-    { 0xBC, 8 },
-    { 0x53, 9 },
-    { 0x4, 3 },
-    { 0x2, 3 },
-    { 0x16, 5 },
-    { 0x15, 5 },
-    { 0x15, 7 },
-    { 0x50, 9 },
-    { 0xA4, 10 },
-    { 0x294, 12 },
-    { 0x52B, 13 },
-    { 0x52A, 13 },
-    { 0x52D, 13 },
-    { 0x52C, 13 },
-    { 0x52F, 13 },
-    { 0x52E, 13 },
-    { 0xE, 4 },
-    { 0x1A, 5 },
-    { 0x4, 5 },
-    { 0x28, 6 },
-    { 0x29, 6 },
-    { 0xF, 4 },
-    { 0xB, 6 },
-    { 0x5F, 7 },
-    { 0xBD, 8 }
-  }
-};
-
-static const uint16_t ac_bias_2[16][32][2] = {
-  {  /* AC bias group 3, table 0 */
-    { 0x3, 4 },
-    { 0x9, 6 },
-    { 0xD0, 8 },
-    { 0x1A3, 9 },
-    { 0x344, 10 },
-    { 0xD14, 12 },
-    { 0x1A2B, 13 },
-    { 0x4, 4 },
-    { 0x15, 7 },
-    { 0x0, 3 },
-    { 0xF, 4 },
-    { 0xB, 4 },
-    { 0xC, 4 },
-    { 0xE, 4 },
-    { 0x9, 4 },
-    { 0x1B, 5 },
-    { 0xA, 5 },
-    { 0x14, 5 },
-    { 0xD, 5 },
-    { 0x2A, 6 },
-    { 0x14, 7 },
-    { 0x68B, 11 },
-    { 0x1A2A, 13 },
-    { 0x8, 4 },
-    { 0xB, 5 },
-    { 0x2B, 6 },
-    { 0xB, 6 },
-    { 0x69, 7 },
-    { 0x35, 6 },
-    { 0x8, 6 },
-    { 0x7, 4 },
-    { 0xC, 5 }
-  },
-  {  /* AC bias group 3, table 1 */
-    { 0xA, 4 },
-    { 0x3C, 6 },
-    { 0x32, 7 },
-    { 0x30, 7 },
-    { 0xC5, 9 },
-    { 0x621, 12 },
-    { 0x620, 12 },
-    { 0x1F, 5 },
-    { 0x33, 7 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0xE, 4 },
-    { 0xD, 4 },
-    { 0xC, 4 },
-    { 0x4, 4 },
-    { 0xD, 5 },
-    { 0x26, 6 },
-    { 0x27, 6 },
-    { 0x14, 6 },
-    { 0x63, 8 },
-    { 0x189, 10 },
-    { 0x623, 12 },
-    { 0x622, 12 },
-    { 0xB, 4 },
-    { 0x12, 5 },
-    { 0x3D, 6 },
-    { 0x22, 6 },
-    { 0x15, 6 },
-    { 0xB, 5 },
-    { 0x23, 6 },
-    { 0x7, 4 },
-    { 0x10, 5 }
-  },
-  {  /* AC bias group 3, table 2 */
-    { 0xF, 4 },
-    { 0xC, 5 },
-    { 0x43, 7 },
-    { 0x10, 6 },
-    { 0x44, 8 },
-    { 0x114, 10 },
-    { 0x455, 12 },
-    { 0x18, 5 },
-    { 0x23, 7 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0xE, 4 },
-    { 0xD, 4 },
-    { 0x9, 4 },
-    { 0x19, 5 },
-    { 0x9, 5 },
-    { 0x17, 6 },
-    { 0x16, 6 },
-    { 0x42, 7 },
-    { 0x8B, 9 },
-    { 0x454, 12 },
-    { 0x457, 12 },
-    { 0x456, 12 },
-    { 0xB, 4 },
-    { 0x15, 5 },
-    { 0xA, 5 },
-    { 0x29, 6 },
-    { 0x20, 6 },
-    { 0xD, 5 },
-    { 0x28, 6 },
-    { 0x7, 4 },
-    { 0x11, 5 }
-  },
-  {  /* AC bias group 3, table 3 */
-    { 0x1, 3 },
-    { 0x1A, 5 },
-    { 0x29, 6 },
-    { 0x2A, 6 },
-    { 0xA0, 8 },
-    { 0x285, 10 },
-    { 0x1425, 13 },
-    { 0x2, 5 },
-    { 0x0, 7 },
-    { 0x2, 3 },
-    { 0x3, 3 },
-    { 0xC, 4 },
-    { 0xB, 4 },
-    { 0x8, 4 },
-    { 0x12, 5 },
-    { 0x1, 6 },
-    { 0x51, 7 },
-    { 0x1, 7 },
-    { 0x143, 9 },
-    { 0x508, 11 },
-    { 0x1424, 13 },
-    { 0x1427, 13 },
-    { 0x1426, 13 },
-    { 0xF, 4 },
-    { 0x1C, 5 },
-    { 0x3, 5 },
-    { 0x37, 6 },
-    { 0x2B, 6 },
-    { 0x13, 5 },
-    { 0x36, 6 },
-    { 0x1D, 5 },
-    { 0x1, 5 }
-  },
-  {  /* AC bias group 3, table 4 */
-    { 0x4, 3 },
-    { 0x1F, 5 },
-    { 0x3D, 6 },
-    { 0x6, 5 },
-    { 0x16, 7 },
-    { 0x53, 9 },
-    { 0x14A, 11 },
-    { 0x34, 6 },
-    { 0x2A, 8 },
-    { 0x2, 3 },
-    { 0x3, 3 },
-    { 0xB, 4 },
-    { 0xC, 4 },
-    { 0x1C, 5 },
-    { 0x37, 6 },
-    { 0x17, 7 },
-    { 0x2B, 8 },
-    { 0x28, 8 },
-    { 0xA4, 10 },
-    { 0x52D, 13 },
-    { 0x52C, 13 },
-    { 0x52F, 13 },
-    { 0x52E, 13 },
-    { 0x0, 3 },
-    { 0x1D, 5 },
-    { 0x7, 5 },
-    { 0x4, 5 },
-    { 0x35, 6 },
-    { 0x14, 5 },
-    { 0x36, 6 },
-    { 0x15, 5 },
-    { 0x3C, 6 }
-  },
-  {  /* AC bias group 3, table 5 */
-    { 0x4, 3 },
-    { 0xA, 4 },
-    { 0x7, 5 },
-    { 0x1D, 5 },
-    { 0x9, 6 },
-    { 0x1F3, 9 },
-    { 0x7C7, 11 },
-    { 0x8, 6 },
-    { 0x1F0, 9 },
-    { 0x3, 3 },
-    { 0x2, 3 },
-    { 0xD, 4 },
-    { 0xC, 4 },
-    { 0x17, 5 },
-    { 0x7D, 7 },
-    { 0x1F2, 9 },
-    { 0x7C6, 11 },
-    { 0x7C5, 11 },
-    { 0x1F12, 13 },
-    { 0x3E27, 14 },
-    { 0x3E26, 14 },
-    { 0x1F11, 13 },
-    { 0x1F10, 13 },
-    { 0x0, 3 },
-    { 0x1E, 5 },
-    { 0x6, 5 },
-    { 0x39, 6 },
-    { 0x38, 6 },
-    { 0x3F, 6 },
-    { 0x2C, 6 },
-    { 0x5, 5 },
-    { 0x2D, 6 }
-  },
-  {  /* AC bias group 3, table 6 */
-    { 0x2, 3 },
-    { 0x7, 4 },
-    { 0x18, 5 },
-    { 0x3, 4 },
-    { 0x5, 5 },
-    { 0x35, 7 },
-    { 0x4F, 9 },
-    { 0x12, 7 },
-    { 0x4E5, 13 },
-    { 0x5, 3 },
-    { 0x4, 3 },
-    { 0xD, 4 },
-    { 0xE, 4 },
-    { 0x33, 6 },
-    { 0x26, 8 },
-    { 0x9D, 10 },
-    { 0x4E4, 13 },
-    { 0x4E7, 13 },
-    { 0x4E6, 13 },
-    { 0x4E1, 13 },
-    { 0x4E0, 13 },
-    { 0x4E3, 13 },
-    { 0x4E2, 13 },
-    { 0x0, 3 },
-    { 0x1F, 5 },
-    { 0xC, 5 },
-    { 0x3D, 6 },
-    { 0x3C, 6 },
-    { 0x32, 6 },
-    { 0x34, 7 },
-    { 0x1B, 6 },
-    { 0x8, 6 }
-  },
-  {  /* AC bias group 3, table 7 */
-    { 0x0, 3 },
-    { 0x4, 4 },
-    { 0x1C, 5 },
-    { 0xF, 4 },
-    { 0x2, 4 },
-    { 0x7, 5 },
-    { 0x75, 7 },
-    { 0xE8, 8 },
-    { 0x1D2A, 13 },
-    { 0x5, 3 },
-    { 0x4, 3 },
-    { 0xD, 4 },
-    { 0xC, 4 },
-    { 0x77, 7 },
-    { 0xE96, 12 },
-    { 0x3A57, 14 },
-    { 0x3A56, 14 },
-    { 0x3A5D, 14 },
-    { 0x3A5C, 14 },
-    { 0x3A5F, 14 },
-    { 0x3A5E, 14 },
-    { 0x1D29, 13 },
-    { 0x1D28, 13 },
-    { 0x3, 3 },
-    { 0x6, 5 },
-    { 0xA, 5 },
-    { 0x2C, 7 },
-    { 0x17, 6 },
-    { 0x76, 7 },
-    { 0x1D3, 9 },
-    { 0x3A4, 10 },
-    { 0x2D, 7 }
-  },
-  {  /* AC bias group 3, table 8 */
-    { 0xA, 4 },
-    { 0x24, 6 },
-    { 0xBF, 8 },
-    { 0x85, 8 },
-    { 0x211, 10 },
-    { 0x842, 12 },
-    { 0x1087, 13 },
-    { 0x18, 5 },
-    { 0x20, 6 },
-    { 0x1, 3 },
-    { 0x2, 3 },
-    { 0xE, 4 },
-    { 0xD, 4 },
-    { 0x7, 4 },
-    { 0x13, 5 },
-    { 0x25, 6 },
-    { 0x5E, 7 },
-    { 0x43, 7 },
-    { 0xBE, 8 },
-    { 0x109, 9 },
-    { 0x1086, 13 },
-    { 0x841, 12 },
-    { 0x840, 12 },
-    { 0xF, 4 },
-    { 0x1, 4 },
-    { 0x11, 5 },
-    { 0x0, 5 },
-    { 0x2E, 6 },
-    { 0x19, 5 },
-    { 0x1, 5 },
-    { 0x6, 4 },
-    { 0x16, 5 }
-  },
-  {  /* AC bias group 3, table 9 */
-    { 0x2, 3 },
-    { 0xF, 5 },
-    { 0x6F, 7 },
-    { 0x61, 7 },
-    { 0x374, 10 },
-    { 0x1BA8, 13 },
-    { 0x3753, 14 },
-    { 0x12, 5 },
-    { 0x36, 6 },
-    { 0x0, 3 },
-    { 0x1, 3 },
-    { 0xA, 4 },
-    { 0xB, 4 },
-    { 0x1A, 5 },
-    { 0x31, 6 },
-    { 0x60, 7 },
-    { 0xDC, 8 },
-    { 0x1BB, 9 },
-    { 0x6EB, 11 },
-    { 0x1BAB, 13 },
-    { 0x3752, 14 },
-    { 0x3755, 14 },
-    { 0x3754, 14 },
-    { 0xE, 4 },
-    { 0x6, 4 },
-    { 0x13, 5 },
-    { 0xE, 5 },
-    { 0x3E, 6 },
-    { 0x8, 4 },
-    { 0x1E, 5 },
-    { 0x19, 5 },
-    { 0x3F, 6 }
-  },
-  {  /* AC bias group 3, table 10 */
-    { 0x3, 3 },
-    { 0x1C, 5 },
-    { 0x25, 6 },
-    { 0x24, 6 },
-    { 0x1DA, 9 },
-    { 0x1DBD, 13 },
-    { 0x3B7C, 14 },
-    { 0x3C, 6 },
-    { 0x3D, 6 },
-    { 0x0, 3 },
-    { 0x1, 3 },
-    { 0xB, 4 },
-    { 0xA, 4 },
-    { 0xB, 5 },
-    { 0x77, 7 },
-    { 0xEC, 8 },
-    { 0x3B6, 10 },
-    { 0x76E, 11 },
-    { 0x1DBF, 13 },
-    { 0x76FB, 15 },
-    { 0x76FA, 15 },
-    { 0x3B79, 14 },
-    { 0x3B78, 14 },
-    { 0xD, 4 },
-    { 0x1F, 5 },
-    { 0x13, 5 },
-    { 0xA, 5 },
-    { 0x8, 5 },
-    { 0xC, 4 },
-    { 0x8, 4 },
-    { 0x9, 5 },
-    { 0x3A, 6 }
-  },
-  {  /* AC bias group 3, table 11 */
-    { 0x5, 3 },
-    { 0x3, 4 },
-    { 0x4, 5 },
-    { 0x10, 5 },
-    { 0x8F, 8 },
-    { 0x475, 11 },
-    { 0x11D1, 13 },
-    { 0x79, 7 },
-    { 0x27, 6 },
-    { 0x2, 3 },
-    { 0x3, 3 },
-    { 0x1, 4 },
-    { 0x0, 4 },
-    { 0x26, 6 },
-    { 0x46, 7 },
-    { 0x11C, 9 },
-    { 0x477, 11 },
-    { 0x8ED, 12 },
-    { 0x11D0, 13 },
-    { 0x11D3, 13 },
-    { 0x11D2, 13 },
-    { 0x11D9, 13 },
-    { 0x11D8, 13 },
-    { 0xD, 4 },
-    { 0x1F, 5 },
-    { 0x12, 5 },
-    { 0x5, 5 },
-    { 0x3D, 6 },
-    { 0xC, 4 },
-    { 0xE, 4 },
-    { 0x22, 6 },
-    { 0x78, 7 }
-  },
-  {  /* AC bias group 3, table 12 */
-    { 0x5, 3 },
-    { 0xC, 4 },
-    { 0x1B, 5 },
-    { 0x0, 4 },
-    { 0x6, 6 },
-    { 0x3E2, 10 },
-    { 0x3E3D, 14 },
-    { 0xF, 7 },
-    { 0x34, 6 },
-    { 0x3, 3 },
-    { 0x2, 3 },
-    { 0x1E, 5 },
-    { 0x1D, 5 },
-    { 0x7D, 7 },
-    { 0x1F0, 9 },
-    { 0x7C6, 11 },
-    { 0x3E3C, 14 },
-    { 0x3E3F, 14 },
-    { 0x3E3E, 14 },
-    { 0x3E39, 14 },
-    { 0x3E38, 14 },
-    { 0x3E3B, 14 },
-    { 0x3E3A, 14 },
-    { 0x8, 4 },
-    { 0x1C, 5 },
-    { 0x2, 5 },
-    { 0x3F, 6 },
-    { 0x35, 6 },
-    { 0x9, 4 },
-    { 0x1, 3 },
-    { 0xE, 7 },
-    { 0xF9, 8 }
-  },
-  {  /* AC bias group 3, table 13 */
-    { 0x4, 3 },
-    { 0xB, 4 },
-    { 0x1, 4 },
-    { 0xA, 4 },
-    { 0x1E, 6 },
-    { 0xE0, 9 },
-    { 0xE1E, 13 },
-    { 0x71, 8 },
-    { 0x39, 7 },
-    { 0x7, 3 },
-    { 0x6, 3 },
-    { 0xD, 5 },
-    { 0xC, 5 },
-    { 0x20, 7 },
-    { 0x1C2, 10 },
-    { 0x1C3F, 14 },
-    { 0x1C3E, 14 },
-    { 0xE19, 13 },
-    { 0xE18, 13 },
-    { 0xE1B, 13 },
-    { 0xE1A, 13 },
-    { 0xE1D, 13 },
-    { 0xE1C, 13 },
-    { 0x0, 4 },
-    { 0x9, 5 },
-    { 0x1D, 6 },
-    { 0x1F, 6 },
-    { 0x11, 6 },
-    { 0x5, 4 },
-    { 0x1, 3 },
-    { 0x43, 8 },
-    { 0x42, 8 }
-  },
-  {  /* AC bias group 3, table 14 */
-    { 0x4, 3 },
-    { 0xD, 4 },
-    { 0x7, 4 },
-    { 0x2, 3 },
-    { 0x14, 5 },
-    { 0x16C, 9 },
-    { 0x16D1, 13 },
-    { 0x2DF, 10 },
-    { 0x16E, 9 },
-    { 0x0, 2 },
-    { 0x7, 3 },
-    { 0x2C, 6 },
-    { 0x2B, 6 },
-    { 0x2DE, 10 },
-    { 0x16D0, 13 },
-    { 0x16D3, 13 },
-    { 0x16D2, 13 },
-    { 0x2DB5, 14 },
-    { 0x2DB4, 14 },
-    { 0x2DB7, 14 },
-    { 0x2DB6, 14 },
-    { 0x16D9, 13 },
-    { 0x16D8, 13 },
-    { 0xC, 5 },
-    { 0x2A, 6 },
-    { 0x5A, 7 },
-    { 0x1B, 6 },
-    { 0x1A, 6 },
-    { 0x17, 5 },
-    { 0xC, 4 },
-    { 0x5B7, 11 },
-    { 0x5B5, 11 }
-  },
-  {  /* AC bias group 3, table 15 */
-    { 0x2, 2 },
-    { 0xF, 4 },
-    { 0x1C, 5 },
-    { 0xC, 4 },
-    { 0x3B, 6 },
-    { 0x1AC, 9 },
-    { 0x1AD8, 13 },
-    { 0x35B3, 14 },
-    { 0x35B2, 14 },
-    { 0x1, 2 },
-    { 0x0, 2 },
-    { 0x69, 7 },
-    { 0x68, 7 },
-    { 0x35BD, 14 },
-    { 0x35BC, 14 },
-    { 0x35BF, 14 },
-    { 0x35BE, 14 },
-    { 0x35B9, 14 },
-    { 0x35B8, 14 },
-    { 0x35BB, 14 },
-    { 0x35BA, 14 },
-    { 0x35B5, 14 },
-    { 0x35B4, 14 },
-    { 0x1A9, 9 },
-    { 0x1A8, 9 },
-    { 0x35A, 10 },
-    { 0xD7, 8 },
-    { 0xD5, 8 },
-    { 0x3A, 6 },
-    { 0x1B, 5 },
-    { 0x35B7, 14 },
-    { 0x35B6, 14 }
-  }
-};
-
-static const uint16_t ac_bias_3[16][32][2] = {
-  {  /* AC bias group 4, table 0 */
-    { 0x0, 3 },
-    { 0x10, 5 },
-    { 0x72, 7 },
-    { 0x71, 7 },
-    { 0x154, 9 },
-    { 0xAAB, 12 },
-    { 0xAA8, 12 },
-    { 0x14, 5 },
-    { 0x70, 7 },
-    { 0x2, 3 },
-    { 0x3, 3 },
-    { 0xC, 4 },
-    { 0xB, 4 },
-    { 0x3, 4 },
-    { 0x11, 5 },
-    { 0x73, 7 },
-    { 0x54, 7 },
-    { 0xAB, 8 },
-    { 0x2AB, 10 },
-    { 0x1553, 13 },
-    { 0x1552, 13 },
-    { 0x1555, 13 },
-    { 0x1554, 13 },
-    { 0xD, 4 },
-    { 0x1E, 5 },
-    { 0x12, 5 },
-    { 0x3E, 6 },
-    { 0x2B, 6 },
-    { 0x2, 4 },
-    { 0x3F, 6 },
-    { 0x1D, 5 },
-    { 0x13, 5 }
-  },
-  {  /* AC bias group 4, table 1 */
-    { 0x3, 3 },
-    { 0x1F, 5 },
-    { 0x29, 6 },
-    { 0x3D, 6 },
-    { 0xC, 7 },
-    { 0x69, 10 },
-    { 0x345, 13 },
-    { 0x2, 5 },
-    { 0x28, 6 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0xE, 4 },
-    { 0xC, 4 },
-    { 0x15, 5 },
-    { 0x7, 6 },
-    { 0x1B, 8 },
-    { 0x6B, 10 },
-    { 0x6A, 10 },
-    { 0x344, 13 },
-    { 0x347, 13 },
-    { 0x346, 13 },
-    { 0x1A1, 12 },
-    { 0x1A0, 12 },
-    { 0xB, 4 },
-    { 0x1A, 5 },
-    { 0x12, 5 },
-    { 0x0, 5 },
-    { 0x3C, 6 },
-    { 0x8, 4 },
-    { 0x1B, 5 },
-    { 0x13, 5 },
-    { 0x1, 5 }
-  },
-  {  /* AC bias group 4, table 2 */
-    { 0x4, 3 },
-    { 0x4, 4 },
-    { 0x3F, 6 },
-    { 0x14, 5 },
-    { 0x56, 7 },
-    { 0x15C, 9 },
-    { 0x15D5, 13 },
-    { 0x3C, 6 },
-    { 0x2A, 6 },
-    { 0x0, 3 },
-    { 0x1, 3 },
-    { 0xE, 4 },
-    { 0xD, 4 },
-    { 0xC, 5 },
-    { 0xAF, 8 },
-    { 0x2BB, 10 },
-    { 0x15D4, 13 },
-    { 0x15D7, 13 },
-    { 0x15D6, 13 },
-    { 0x15D1, 13 },
-    { 0x15D0, 13 },
-    { 0x15D3, 13 },
-    { 0x15D2, 13 },
-    { 0xB, 4 },
-    { 0x19, 5 },
-    { 0xD, 5 },
-    { 0x3E, 6 },
-    { 0x31, 6 },
-    { 0x7, 4 },
-    { 0x5, 4 },
-    { 0x3D, 6 },
-    { 0x30, 6 }
-  },
-  {  /* AC bias group 4, table 3 */
-    { 0x5, 3 },
-    { 0x8, 4 },
-    { 0x1A, 5 },
-    { 0x0, 4 },
-    { 0x36, 6 },
-    { 0x11, 8 },
-    { 0x106, 12 },
-    { 0xA, 7 },
-    { 0x6E, 7 },
-    { 0x2, 3 },
-    { 0x3, 3 },
-    { 0x3, 4 },
-    { 0x2, 4 },
-    { 0x6F, 7 },
-    { 0x21, 9 },
-    { 0x20F, 13 },
-    { 0x20E, 13 },
-    { 0x101, 12 },
-    { 0x100, 12 },
-    { 0x103, 12 },
-    { 0x102, 12 },
-    { 0x105, 12 },
-    { 0x104, 12 },
-    { 0xC, 4 },
-    { 0x1E, 5 },
-    { 0x3, 5 },
-    { 0x3E, 6 },
-    { 0x3F, 6 },
-    { 0x9, 4 },
-    { 0xE, 4 },
-    { 0xB, 7 },
-    { 0x9, 7 }
-  },
-  {  /* AC bias group 4, table 4 */
-    { 0x2, 3 },
-    { 0xE, 4 },
-    { 0x1E, 5 },
-    { 0xC, 4 },
-    { 0x1F, 5 },
-    { 0x6E, 7 },
-    { 0xAD, 10 },
-    { 0xAF, 10 },
-    { 0x14, 7 },
-    { 0x4, 3 },
-    { 0x3, 3 },
-    { 0x1A, 5 },
-    { 0x17, 5 },
-    { 0x2A, 8 },
-    { 0x576, 13 },
-    { 0xAEF, 14 },
-    { 0xAEE, 14 },
-    { 0x571, 13 },
-    { 0x570, 13 },
-    { 0x573, 13 },
-    { 0x572, 13 },
-    { 0x575, 13 },
-    { 0x574, 13 },
-    { 0x3, 4 },
-    { 0x16, 5 },
-    { 0x4, 5 },
-    { 0x36, 6 },
-    { 0xB, 6 },
-    { 0xA, 4 },
-    { 0x0, 3 },
-    { 0x6F, 7 },
-    { 0xAC, 10 }
-  },
-  {  /* AC bias group 4, table 5 */
-    { 0x4, 3 },
-    { 0x5, 4 },
-    { 0x3, 3 },
-    { 0x1, 3 },
-    { 0x4, 4 },
-    { 0x2F, 6 },
-    { 0x526, 11 },
-    { 0x1495, 13 },
-    { 0xA6, 8 },
-    { 0x7, 3 },
-    { 0x6, 3 },
-    { 0x2D, 6 },
-    { 0x2C, 6 },
-    { 0x1494, 13 },
-    { 0x1497, 13 },
-    { 0x1496, 13 },
-    { 0x1491, 13 },
-    { 0x1490, 13 },
-    { 0x1493, 13 },
-    { 0x1492, 13 },
-    { 0x293D, 14 },
-    { 0x293C, 14 },
-    { 0x293F, 14 },
-    { 0x0, 3 },
-    { 0x28, 6 },
-    { 0xA5, 8 },
-    { 0x148, 9 },
-    { 0xA7, 8 },
-    { 0x2E, 6 },
-    { 0x15, 5 },
-    { 0xA4E, 12 },
-    { 0x293E, 14 }
-  },
-  {  /* AC bias group 4, table 6 */
-    { 0x4, 3 },
-    { 0x5, 4 },
-    { 0x3, 3 },
-    { 0x1, 3 },
-    { 0x4, 4 },
-    { 0x2F, 6 },
-    { 0x526, 11 },
-    { 0x1495, 13 },
-    { 0xA6, 8 },
-    { 0x7, 3 },
-    { 0x6, 3 },
-    { 0x2D, 6 },
-    { 0x2C, 6 },
-    { 0x1494, 13 },
-    { 0x1497, 13 },
-    { 0x1496, 13 },
-    { 0x1491, 13 },
-    { 0x1490, 13 },
-    { 0x1493, 13 },
-    { 0x1492, 13 },
-    { 0x293D, 14 },
-    { 0x293C, 14 },
-    { 0x293F, 14 },
-    { 0x0, 3 },
-    { 0x28, 6 },
-    { 0xA5, 8 },
-    { 0x148, 9 },
-    { 0xA7, 8 },
-    { 0x2E, 6 },
-    { 0x15, 5 },
-    { 0xA4E, 12 },
-    { 0x293E, 14 }
-  },
-  {  /* AC bias group 4, table 7 */
-    { 0x4, 3 },
-    { 0x5, 4 },
-    { 0x3, 3 },
-    { 0x1, 3 },
-    { 0x4, 4 },
-    { 0x2F, 6 },
-    { 0x526, 11 },
-    { 0x1495, 13 },
-    { 0xA6, 8 },
-    { 0x7, 3 },
-    { 0x6, 3 },
-    { 0x2D, 6 },
-    { 0x2C, 6 },
-    { 0x1494, 13 },
-    { 0x1497, 13 },
-    { 0x1496, 13 },
-    { 0x1491, 13 },
-    { 0x1490, 13 },
-    { 0x1493, 13 },
-    { 0x1492, 13 },
-    { 0x293D, 14 },
-    { 0x293C, 14 },
-    { 0x293F, 14 },
-    { 0x0, 3 },
-    { 0x28, 6 },
-    { 0xA5, 8 },
-    { 0x148, 9 },
-    { 0xA7, 8 },
-    { 0x2E, 6 },
-    { 0x15, 5 },
-    { 0xA4E, 12 },
-    { 0x293E, 14 }
-  },
-  {  /* AC bias group 4, table 8 */
-    { 0x3, 3 },
-    { 0x11, 5 },
-    { 0x20, 6 },
-    { 0x74, 7 },
-    { 0x10D, 9 },
-    { 0x863, 12 },
-    { 0x860, 12 },
-    { 0xA, 5 },
-    { 0x75, 7 },
-    { 0x1, 3 },
-    { 0x0, 3 },
-    { 0xB, 4 },
-    { 0xA, 4 },
-    { 0x18, 5 },
-    { 0x38, 6 },
-    { 0x42, 7 },
-    { 0x10F, 9 },
-    { 0x10E, 9 },
-    { 0x219, 10 },
-    { 0x10C3, 13 },
-    { 0x10C2, 13 },
-    { 0x10C5, 13 },
-    { 0x10C4, 13 },
-    { 0xF, 4 },
-    { 0x4, 4 },
-    { 0x19, 5 },
-    { 0xB, 5 },
-    { 0x39, 6 },
-    { 0x9, 4 },
-    { 0x1B, 5 },
-    { 0x1A, 5 },
-    { 0x3B, 6 }
-  },
-  {  /* AC bias group 4, table 9 */
-    { 0x5, 3 },
-    { 0x1, 4 },
-    { 0x3E, 6 },
-    { 0x1, 5 },
-    { 0xE2, 8 },
-    { 0x1C6F, 13 },
-    { 0x38D9, 14 },
-    { 0x39, 6 },
-    { 0x1F, 6 },
-    { 0x2, 3 },
-    { 0x1, 3 },
-    { 0x9, 4 },
-    { 0x8, 4 },
-    { 0x0, 5 },
-    { 0x70, 7 },
-    { 0x1C7, 9 },
-    { 0x38C, 10 },
-    { 0x71A, 11 },
-    { 0x38D8, 14 },
-    { 0x38DB, 14 },
-    { 0x38DA, 14 },
-    { 0x38DD, 14 },
-    { 0x38DC, 14 },
-    { 0xD, 4 },
-    { 0x1D, 5 },
-    { 0xE, 5 },
-    { 0x3F, 6 },
-    { 0x3C, 6 },
-    { 0xC, 4 },
-    { 0x6, 4 },
-    { 0x3D, 6 },
-    { 0x1E, 6 }
-  },
-  {  /* AC bias group 4, table 10 */
-    { 0x6, 3 },
-    { 0xB, 4 },
-    { 0x11, 5 },
-    { 0x1E, 5 },
-    { 0x74, 7 },
-    { 0x3AA, 10 },
-    { 0x1D5C, 13 },
-    { 0x1, 6 },
-    { 0x21, 6 },
-    { 0x1, 3 },
-    { 0x2, 3 },
-    { 0x7, 4 },
-    { 0x6, 4 },
-    { 0x3E, 6 },
-    { 0xEB, 8 },
-    { 0x1D4, 9 },
-    { 0xEAF, 12 },
-    { 0x3ABB, 14 },
-    { 0x3ABA, 14 },
-    { 0x1D59, 13 },
-    { 0x1D58, 13 },
-    { 0x1D5B, 13 },
-    { 0x1D5A, 13 },
-    { 0xA, 4 },
-    { 0x1C, 5 },
-    { 0x1, 5 },
-    { 0x3F, 6 },
-    { 0x3B, 6 },
-    { 0x1, 4 },
-    { 0x9, 4 },
-    { 0x20, 6 },
-    { 0x0, 6 }
-  },
-  {  /* AC bias group 4, table 11 */
-    { 0x4, 3 },
-    { 0xA, 4 },
-    { 0x17, 5 },
-    { 0x4, 4 },
-    { 0x16, 6 },
-    { 0x16A, 9 },
-    { 0x16B1, 13 },
-    { 0x17, 7 },
-    { 0x5B, 7 },
-    { 0x6, 3 },
-    { 0x7, 3 },
-    { 0x1, 4 },
-    { 0x0, 4 },
-    { 0xA, 6 },
-    { 0x2D7, 10 },
-    { 0xB5A, 12 },
-    { 0x16B0, 13 },
-    { 0x16B3, 13 },
-    { 0x16B2, 13 },
-    { 0x2D6D, 14 },
-    { 0x2D6C, 14 },
-    { 0x2D6F, 14 },
-    { 0x2D6E, 14 },
-    { 0x6, 4 },
-    { 0xA, 5 },
-    { 0x4, 5 },
-    { 0x2C, 6 },
-    { 0x17, 6 },
-    { 0x3, 4 },
-    { 0x7, 4 },
-    { 0x16, 7 },
-    { 0xB4, 8 }
-  },
-  {  /* AC bias group 4, table 12 */
-    { 0x5, 3 },
-    { 0xD, 4 },
-    { 0x5, 4 },
-    { 0x9, 4 },
-    { 0x33, 6 },
-    { 0x193, 9 },
-    { 0x192C, 13 },
-    { 0x61, 8 },
-    { 0x31, 7 },
-    { 0x0, 2 },
-    { 0x7, 3 },
-    { 0x10, 5 },
-    { 0x11, 5 },
-    { 0xC8, 8 },
-    { 0x192F, 13 },
-    { 0x325B, 14 },
-    { 0x325A, 14 },
-    { 0x1929, 13 },
-    { 0x1928, 13 },
-    { 0x192B, 13 },
-    { 0x192A, 13 },
-    { 0x325D, 14 },
-    { 0x325C, 14 },
-    { 0x18, 5 },
-    { 0x1A, 6 },
-    { 0x1B, 6 },
-    { 0x65, 7 },
-    { 0x19, 6 },
-    { 0x4, 4 },
-    { 0x7, 4 },
-    { 0x60, 8 },
-    { 0x324, 10 }
-  },
-  {  /* AC bias group 4, table 13 */
-    { 0x6, 3 },
-    { 0x0, 3 },
-    { 0x2, 4 },
-    { 0xF, 4 },
-    { 0x39, 6 },
-    { 0x1D9, 9 },
-    { 0x1D82, 13 },
-    { 0x761, 11 },
-    { 0x3BE, 10 },
-    { 0x1, 2 },
-    { 0x2, 2 },
-    { 0xF, 6 },
-    { 0xE, 6 },
-    { 0x762, 11 },
-    { 0x3B07, 14 },
-    { 0x3B06, 14 },
-    { 0x3B1D, 14 },
-    { 0x3B1C, 14 },
-    { 0x3B1F, 14 },
-    { 0x3B1E, 14 },
-    { 0x3B19, 14 },
-    { 0x3B18, 14 },
-    { 0x3B1B, 14 },
-    { 0x38, 6 },
-    { 0x1DE, 9 },
-    { 0xED, 8 },
-    { 0x3BF, 10 },
-    { 0xEE, 8 },
-    { 0x3A, 6 },
-    { 0x6, 5 },
-    { 0xEC0, 12 },
-    { 0x3B1A, 14 }
-  },
-  {  /* AC bias group 4, table 14 */
-    { 0x0, 2 },
-    { 0x2, 3 },
-    { 0xF, 5 },
-    { 0x6, 4 },
-    { 0x1C, 6 },
-    { 0x1D0, 10 },
-    { 0xE8C, 13 },
-    { 0x1D1B, 14 },
-    { 0x1D1A, 14 },
-    { 0x3, 2 },
-    { 0x2, 2 },
-    { 0xEA, 9 },
-    { 0xE9, 9 },
-    { 0xE89, 13 },
-    { 0xE88, 13 },
-    { 0xE8B, 13 },
-    { 0xE8A, 13 },
-    { 0x1D65, 14 },
-    { 0x1D64, 14 },
-    { 0x1D67, 14 },
-    { 0x1D66, 14 },
-    { 0x1D61, 14 },
-    { 0x1D60, 14 },
-    { 0x3AD, 11 },
-    { 0x1D63, 14 },
-    { 0x1D62, 14 },
-    { 0x1D1D, 14 },
-    { 0x1D1C, 14 },
-    { 0x3B, 7 },
-    { 0x1D7, 10 },
-    { 0x1D1F, 14 },
-    { 0x1D1E, 14 }
-  },
-  {  /* AC bias group 4, table 15 */
-    { 0x2, 2 },
-    { 0xF, 4 },
-    { 0x1C, 5 },
-    { 0xC, 4 },
-    { 0x3B, 6 },
-    { 0x1AC, 9 },
-    { 0x1AD8, 13 },
-    { 0x35B3, 14 },
-    { 0x35B2, 14 },
-    { 0x1, 2 },
-    { 0x0, 2 },
-    { 0x69, 7 },
-    { 0x68, 7 },
-    { 0x35BD, 14 },
-    { 0x35BC, 14 },
-    { 0x35BF, 14 },
-    { 0x35BE, 14 },
-    { 0x35B9, 14 },
-    { 0x35B8, 14 },
-    { 0x35BB, 14 },
-    { 0x35BA, 14 },
-    { 0x35B5, 14 },
-    { 0x35B4, 14 },
-    { 0x1A9, 9 },
-    { 0x1A8, 9 },
-    { 0x35A, 10 },
-    { 0xD7, 8 },
-    { 0xD5, 8 },
-    { 0x3A, 6 },
-    { 0x1B, 5 },
-    { 0x35B7, 14 },
-    { 0x35B6, 14 }
-  }
-};
-
-#endif /* AVCODEC_VP3DATA_H */
diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c
deleted file mode 100644
index 058eb56..0000000
--- a/libavcodec/vp3dsp.c
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright (C) 2004 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Standard C DSP-oriented functions cribbed from the original VP3
- * source code.
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-
-#define IdctAdjustBeforeShift 8
-#define xC1S7 64277
-#define xC2S6 60547
-#define xC3S5 54491
-#define xC4S4 46341
-#define xC5S3 36410
-#define xC6S2 25080
-#define xC7S1 12785
-
-#define M(a,b) (((a) * (b))>>16)
-
-static av_always_inline void idct(uint8_t *dst, int stride, int16_t *input, int type)
-{
-    int16_t *ip = input;
-    uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-
-    int A, B, C, D, Ad, Bd, Cd, Dd, E, F, G, H;
-    int Ed, Gd, Add, Bdd, Fd, Hd;
-
-    int i;
-
-    /* Inverse DCT on the rows now */
-    for (i = 0; i < 8; i++) {
-        /* Check for non-zero values */
-        if ( ip[0] | ip[1] | ip[2] | ip[3] | ip[4] | ip[5] | ip[6] | ip[7] ) {
-            A = M(xC1S7, ip[1]) + M(xC7S1, ip[7]);
-            B = M(xC7S1, ip[1]) - M(xC1S7, ip[7]);
-            C = M(xC3S5, ip[3]) + M(xC5S3, ip[5]);
-            D = M(xC3S5, ip[5]) - M(xC5S3, ip[3]);
-
-            Ad = M(xC4S4, (A - C));
-            Bd = M(xC4S4, (B - D));
-
-            Cd = A + C;
-            Dd = B + D;
-
-            E = M(xC4S4, (ip[0] + ip[4]));
-            F = M(xC4S4, (ip[0] - ip[4]));
-
-            G = M(xC2S6, ip[2]) + M(xC6S2, ip[6]);
-            H = M(xC6S2, ip[2]) - M(xC2S6, ip[6]);
-
-            Ed = E - G;
-            Gd = E + G;
-
-            Add = F + Ad;
-            Bdd = Bd - H;
-
-            Fd = F - Ad;
-            Hd = Bd + H;
-
-            /*  Final sequence of operations over-write original inputs. */
-            ip[0] = Gd + Cd ;
-            ip[7] = Gd - Cd ;
-
-            ip[1] = Add + Hd;
-            ip[2] = Add - Hd;
-
-            ip[3] = Ed + Dd ;
-            ip[4] = Ed - Dd ;
-
-            ip[5] = Fd + Bdd;
-            ip[6] = Fd - Bdd;
-        }
-
-        ip += 8;            /* next row */
-    }
-
-    ip = input;
-
-    for ( i = 0; i < 8; i++) {
-        /* Check for non-zero values (bitwise or faster than ||) */
-        if ( ip[1 * 8] | ip[2 * 8] | ip[3 * 8] |
-             ip[4 * 8] | ip[5 * 8] | ip[6 * 8] | ip[7 * 8] ) {
-
-            A = M(xC1S7, ip[1*8]) + M(xC7S1, ip[7*8]);
-            B = M(xC7S1, ip[1*8]) - M(xC1S7, ip[7*8]);
-            C = M(xC3S5, ip[3*8]) + M(xC5S3, ip[5*8]);
-            D = M(xC3S5, ip[5*8]) - M(xC5S3, ip[3*8]);
-
-            Ad = M(xC4S4, (A - C));
-            Bd = M(xC4S4, (B - D));
-
-            Cd = A + C;
-            Dd = B + D;
-
-            E = M(xC4S4, (ip[0*8] + ip[4*8])) + 8;
-            F = M(xC4S4, (ip[0*8] - ip[4*8])) + 8;
-
-            if(type==1){  //HACK
-                E += 16*128;
-                F += 16*128;
-            }
-
-            G = M(xC2S6, ip[2*8]) + M(xC6S2, ip[6*8]);
-            H = M(xC6S2, ip[2*8]) - M(xC2S6, ip[6*8]);
-
-            Ed = E - G;
-            Gd = E + G;
-
-            Add = F + Ad;
-            Bdd = Bd - H;
-
-            Fd = F - Ad;
-            Hd = Bd + H;
-
-            /* Final sequence of operations over-write original inputs. */
-            if(type==0){
-                ip[0*8] = (Gd + Cd )  >> 4;
-                ip[7*8] = (Gd - Cd )  >> 4;
-
-                ip[1*8] = (Add + Hd ) >> 4;
-                ip[2*8] = (Add - Hd ) >> 4;
-
-                ip[3*8] = (Ed + Dd )  >> 4;
-                ip[4*8] = (Ed - Dd )  >> 4;
-
-                ip[5*8] = (Fd + Bdd ) >> 4;
-                ip[6*8] = (Fd - Bdd ) >> 4;
-            }else if(type==1){
-                dst[0*stride] = cm[(Gd + Cd )  >> 4];
-                dst[7*stride] = cm[(Gd - Cd )  >> 4];
-
-                dst[1*stride] = cm[(Add + Hd ) >> 4];
-                dst[2*stride] = cm[(Add - Hd ) >> 4];
-
-                dst[3*stride] = cm[(Ed + Dd )  >> 4];
-                dst[4*stride] = cm[(Ed - Dd )  >> 4];
-
-                dst[5*stride] = cm[(Fd + Bdd ) >> 4];
-                dst[6*stride] = cm[(Fd - Bdd ) >> 4];
-            }else{
-                dst[0*stride] = cm[dst[0*stride] + ((Gd + Cd )  >> 4)];
-                dst[7*stride] = cm[dst[7*stride] + ((Gd - Cd )  >> 4)];
-
-                dst[1*stride] = cm[dst[1*stride] + ((Add + Hd ) >> 4)];
-                dst[2*stride] = cm[dst[2*stride] + ((Add - Hd ) >> 4)];
-
-                dst[3*stride] = cm[dst[3*stride] + ((Ed + Dd )  >> 4)];
-                dst[4*stride] = cm[dst[4*stride] + ((Ed - Dd )  >> 4)];
-
-                dst[5*stride] = cm[dst[5*stride] + ((Fd + Bdd ) >> 4)];
-                dst[6*stride] = cm[dst[6*stride] + ((Fd - Bdd ) >> 4)];
-            }
-
-        } else {
-            if(type==0){
-                ip[0*8] =
-                ip[1*8] =
-                ip[2*8] =
-                ip[3*8] =
-                ip[4*8] =
-                ip[5*8] =
-                ip[6*8] =
-                ip[7*8] = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
-            }else if(type==1){
-                dst[0*stride]=
-                dst[1*stride]=
-                dst[2*stride]=
-                dst[3*stride]=
-                dst[4*stride]=
-                dst[5*stride]=
-                dst[6*stride]=
-                dst[7*stride]= cm[128 + ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20)];
-            }else{
-                if(ip[0*8]){
-                    int v= ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
-                    dst[0*stride] = cm[dst[0*stride] + v];
-                    dst[1*stride] = cm[dst[1*stride] + v];
-                    dst[2*stride] = cm[dst[2*stride] + v];
-                    dst[3*stride] = cm[dst[3*stride] + v];
-                    dst[4*stride] = cm[dst[4*stride] + v];
-                    dst[5*stride] = cm[dst[5*stride] + v];
-                    dst[6*stride] = cm[dst[6*stride] + v];
-                    dst[7*stride] = cm[dst[7*stride] + v];
-                }
-            }
-        }
-
-        ip++;            /* next column */
-        dst++;
-    }
-}
-
-void ff_vp3_idct_c(DCTELEM *block/* align 16*/){
-    idct(NULL, 0, block, 0);
-}
-
-void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
-    idct(dest, line_size, block, 1);
-}
-
-void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
-    idct(dest, line_size, block, 2);
-}
-
-void ff_vp3_idct_dc_add_c(uint8_t *dest/*align 8*/, int line_size, const DCTELEM *block/*align 16*/){
-    const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
-    int i, dc = block[0];
-    dc = (46341*dc)>>16;
-    dc = (46341*dc + (8<<16))>>20;
-
-    for(i = 0; i < 8; i++){
-        dest[0] = cm[dest[0]+dc];
-        dest[1] = cm[dest[1]+dc];
-        dest[2] = cm[dest[2]+dc];
-        dest[3] = cm[dest[3]+dc];
-        dest[4] = cm[dest[4]+dc];
-        dest[5] = cm[dest[5]+dc];
-        dest[6] = cm[dest[6]+dc];
-        dest[7] = cm[dest[7]+dc];
-        dest += line_size;
-    }
-}
-
-void ff_vp3_v_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
-{
-    unsigned char *end;
-    int filter_value;
-    const int nstride= -stride;
-
-    for (end= first_pixel + 8; first_pixel < end; first_pixel++) {
-        filter_value =
-            (first_pixel[2 * nstride] - first_pixel[ stride])
-         +3*(first_pixel[0          ] - first_pixel[nstride]);
-        filter_value = bounding_values[(filter_value + 4) >> 3];
-        first_pixel[nstride] = av_clip_uint8(first_pixel[nstride] + filter_value);
-        first_pixel[0] = av_clip_uint8(first_pixel[0] - filter_value);
-    }
-}
-
-void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
-{
-    unsigned char *end;
-    int filter_value;
-
-    for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) {
-        filter_value =
-            (first_pixel[-2] - first_pixel[ 1])
-         +3*(first_pixel[ 0] - first_pixel[-1]);
-        filter_value = bounding_values[(filter_value + 4) >> 3];
-        first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value);
-        first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value);
-    }
-}
diff --git a/libavcodec/vp5.c b/libavcodec/vp5.c
deleted file mode 100644
index 1479344..0000000
--- a/libavcodec/vp5.c
+++ /dev/null
@@ -1,280 +0,0 @@
-/**
- * @file
- * VP5 compatible video decoder
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-
-#include "vp56.h"
-#include "vp56data.h"
-#include "vp5data.h"
-
-
-static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
-                            int *golden_frame)
-{
-    VP56RangeCoder *c = &s->c;
-    int rows, cols;
-
-    vp56_init_range_decoder(&s->c, buf, buf_size);
-    s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);
-    vp56_rac_get(c);
-    vp56_init_dequant(s, vp56_rac_gets(c, 6));
-    if (s->framep[VP56_FRAME_CURRENT]->key_frame)
-    {
-        vp56_rac_gets(c, 8);
-        if(vp56_rac_gets(c, 5) > 5)
-            return 0;
-        vp56_rac_gets(c, 2);
-        if (vp56_rac_get(c)) {
-            av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");
-            return 0;
-        }
-        rows = vp56_rac_gets(c, 8);  /* number of stored macroblock rows */
-        cols = vp56_rac_gets(c, 8);  /* number of stored macroblock cols */
-        vp56_rac_gets(c, 8);  /* number of displayed macroblock rows */
-        vp56_rac_gets(c, 8);  /* number of displayed macroblock cols */
-        vp56_rac_gets(c, 2);
-        if (!s->macroblocks || /* first frame */
-            16*cols != s->avctx->coded_width ||
-            16*rows != s->avctx->coded_height) {
-            avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
-            return 2;
-        }
-    } else if (!s->macroblocks)
-        return 0;
-    return 1;
-}
-
-static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    int comp, di;
-
-    for (comp=0; comp<2; comp++) {
-        int delta = 0;
-        if (vp56_rac_get_prob(c, model->vector_dct[comp])) {
-            int sign = vp56_rac_get_prob(c, model->vector_sig[comp]);
-            di  = vp56_rac_get_prob(c, model->vector_pdi[comp][0]);
-            di |= vp56_rac_get_prob(c, model->vector_pdi[comp][1]) << 1;
-            delta = vp56_rac_get_tree(c, vp56_pva_tree,
-                                      model->vector_pdv[comp]);
-            delta = di | (delta << 2);
-            delta = (delta ^ -sign) + sign;
-        }
-        if (!comp)
-            vect->x = delta;
-        else
-            vect->y = delta;
-    }
-}
-
-static void vp5_parse_vector_models(VP56Context *s)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    int comp, node;
-
-    for (comp=0; comp<2; comp++) {
-        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][0]))
-            model->vector_dct[comp] = vp56_rac_gets_nn(c, 7);
-        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][1]))
-            model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
-        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][2]))
-            model->vector_pdi[comp][0] = vp56_rac_gets_nn(c, 7);
-        if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][3]))
-            model->vector_pdi[comp][1] = vp56_rac_gets_nn(c, 7);
-    }
-
-    for (comp=0; comp<2; comp++)
-        for (node=0; node<7; node++)
-            if (vp56_rac_get_prob(c, vp5_vmc_pct[comp][4 + node]))
-                model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
-}
-
-static void vp5_parse_coeff_models(VP56Context *s)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    uint8_t def_prob[11];
-    int node, cg, ctx;
-    int ct;    /* code type */
-    int pt;    /* plane type (0 for Y, 1 for U or V) */
-
-    memset(def_prob, 0x80, sizeof(def_prob));
-
-    for (pt=0; pt<2; pt++)
-        for (node=0; node<11; node++)
-            if (vp56_rac_get_prob(c, vp5_dccv_pct[pt][node])) {
-                def_prob[node] = vp56_rac_gets_nn(c, 7);
-                model->coeff_dccv[pt][node] = def_prob[node];
-            } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
-                model->coeff_dccv[pt][node] = def_prob[node];
-            }
-
-    for (ct=0; ct<3; ct++)
-        for (pt=0; pt<2; pt++)
-            for (cg=0; cg<6; cg++)
-                for (node=0; node<11; node++)
-                    if (vp56_rac_get_prob(c, vp5_ract_pct[ct][pt][cg][node])) {
-                        def_prob[node] = vp56_rac_gets_nn(c, 7);
-                        model->coeff_ract[pt][ct][cg][node] = def_prob[node];
-                    } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
-                        model->coeff_ract[pt][ct][cg][node] = def_prob[node];
-                    }
-
-    /* coeff_dcct is a linear combination of coeff_dccv */
-    for (pt=0; pt<2; pt++)
-        for (ctx=0; ctx<36; ctx++)
-            for (node=0; node<5; node++)
-                model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp5_dccv_lc[node][ctx][0] + 128) >> 8) + vp5_dccv_lc[node][ctx][1], 1, 254);
-
-    /* coeff_acct is a linear combination of coeff_ract */
-    for (ct=0; ct<3; ct++)
-        for (pt=0; pt<2; pt++)
-            for (cg=0; cg<3; cg++)
-                for (ctx=0; ctx<6; ctx++)
-                    for (node=0; node<5; node++)
-                        model->coeff_acct[pt][ct][cg][ctx][node] = av_clip(((model->coeff_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254);
-}
-
-static void vp5_parse_coeff(VP56Context *s)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    uint8_t *permute = s->scantable.permutated;
-    uint8_t *model1, *model2;
-    int coeff, sign, coeff_idx;
-    int b, i, cg, idx, ctx, ctx_last;
-    int pt = 0;    /* plane type (0 for Y, 1 for U or V) */
-
-    for (b=0; b<6; b++) {
-        int ct = 1;    /* code type */
-
-        if (b > 3) pt = 1;
-
-        ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0]
-              + s->above_blocks[s->above_block_idx[b]].not_null_dc;
-        model1 = model->coeff_dccv[pt];
-        model2 = model->coeff_dcct[pt][ctx];
-
-        for (coeff_idx=0; coeff_idx<64; ) {
-            if (vp56_rac_get_prob(c, model2[0])) {
-                if (vp56_rac_get_prob(c, model2[2])) {
-                    if (vp56_rac_get_prob(c, model2[3])) {
-                        s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 4;
-                        idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);
-                        sign = vp56_rac_get(c);
-                        coeff = vp56_coeff_bias[idx+5];
-                        for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
-                            coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
-                    } else {
-                        if (vp56_rac_get_prob(c, model2[4])) {
-                            coeff = 3 + vp56_rac_get_prob(c, model1[5]);
-                            s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3;
-                        } else {
-                            coeff = 2;
-                            s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2;
-                        }
-                        sign = vp56_rac_get(c);
-                    }
-                    ct = 2;
-                } else {
-                    ct = 1;
-                    s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1;
-                    sign = vp56_rac_get(c);
-                    coeff = 1;
-                }
-                coeff = (coeff ^ -sign) + sign;
-                if (coeff_idx)
-                    coeff *= s->dequant_ac;
-                s->block_coeff[b][permute[coeff_idx]] = coeff;
-            } else {
-                if (ct && !vp56_rac_get_prob(c, model2[1]))
-                    break;
-                ct = 0;
-                s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0;
-            }
-
-            cg = vp5_coeff_groups[++coeff_idx];
-            ctx = s->coeff_ctx[vp56_b6to4[b]][coeff_idx];
-            model1 = model->coeff_ract[pt][ct][cg];
-            model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx];
-        }
-
-        ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24);
-        s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx;
-        if (coeff_idx < ctx_last)
-            for (i=coeff_idx; i<=ctx_last; i++)
-                s->coeff_ctx[vp56_b6to4[b]][i] = 5;
-        s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0];
-    }
-}
-
-static void vp5_default_models_init(VP56Context *s)
-{
-    VP56Model *model = s->modelp;
-    int i;
-
-    for (i=0; i<2; i++) {
-        model->vector_sig[i] = 0x80;
-        model->vector_dct[i] = 0x80;
-        model->vector_pdi[i][0] = 0x55;
-        model->vector_pdi[i][1] = 0x80;
-    }
-    memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
-    memset(model->vector_pdv, 0x80, sizeof(model->vector_pdv));
-}
-
-static av_cold int vp5_decode_init(AVCodecContext *avctx)
-{
-    VP56Context *s = avctx->priv_data;
-
-    vp56_init(avctx, 1, 0);
-    s->vp56_coord_div = vp5_coord_div;
-    s->parse_vector_adjustment = vp5_parse_vector_adjustment;
-    s->parse_coeff = vp5_parse_coeff;
-    s->default_models_init = vp5_default_models_init;
-    s->parse_vector_models = vp5_parse_vector_models;
-    s->parse_coeff_models = vp5_parse_coeff_models;
-    s->parse_header = vp5_parse_header;
-
-    return 0;
-}
-
-AVCodec vp5_decoder = {
-    "vp5",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VP5,
-    sizeof(VP56Context),
-    vp5_decode_init,
-    NULL,
-    vp56_free,
-    vp56_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"),
-};
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c
deleted file mode 100644
index 74fe5ff..0000000
--- a/libavcodec/vp56.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/**
- * @file
- * VP5 and VP6 compatible video decoder (common features)
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-
-#include "vp56.h"
-#include "vp56data.h"
-
-
-void vp56_init_dequant(VP56Context *s, int quantizer)
-{
-    s->quantizer = quantizer;
-    s->dequant_dc = vp56_dc_dequant[quantizer] << 2;
-    s->dequant_ac = vp56_ac_dequant[quantizer] << 2;
-    memset(s->qscale_table, quantizer, s->mb_width);
-}
-
-static int vp56_get_vectors_predictors(VP56Context *s, int row, int col,
-                                       VP56Frame ref_frame)
-{
-    int nb_pred = 0;
-    VP56mv vect[2] = {{0,0}, {0,0}};
-    int pos, offset;
-    VP56mv mvp;
-
-    for (pos=0; pos<12; pos++) {
-        mvp.x = col + vp56_candidate_predictor_pos[pos][0];
-        mvp.y = row + vp56_candidate_predictor_pos[pos][1];
-        if (mvp.x < 0 || mvp.x >= s->mb_width ||
-            mvp.y < 0 || mvp.y >= s->mb_height)
-            continue;
-        offset = mvp.x + s->mb_width*mvp.y;
-
-        if (vp56_reference_frame[s->macroblocks[offset].type] != ref_frame)
-            continue;
-        if ((s->macroblocks[offset].mv.x == vect[0].x &&
-             s->macroblocks[offset].mv.y == vect[0].y) ||
-            (s->macroblocks[offset].mv.x == 0 &&
-             s->macroblocks[offset].mv.y == 0))
-            continue;
-
-        vect[nb_pred++] = s->macroblocks[offset].mv;
-        if (nb_pred > 1) {
-            nb_pred = -1;
-            break;
-        }
-        s->vector_candidate_pos = pos;
-    }
-
-    s->vector_candidate[0] = vect[0];
-    s->vector_candidate[1] = vect[1];
-
-    return nb_pred+1;
-}
-
-static void vp56_parse_mb_type_models(VP56Context *s)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    int i, ctx, type;
-
-    for (ctx=0; ctx<3; ctx++) {
-        if (vp56_rac_get_prob(c, 174)) {
-            int idx = vp56_rac_gets(c, 4);
-            memcpy(model->mb_types_stats[ctx],
-                   vp56_pre_def_mb_type_stats[idx][ctx],
-                   sizeof(model->mb_types_stats[ctx]));
-        }
-        if (vp56_rac_get_prob(c, 254)) {
-            for (type=0; type<10; type++) {
-                for(i=0; i<2; i++) {
-                    if (vp56_rac_get_prob(c, 205)) {
-                        int delta, sign = vp56_rac_get(c);
-
-                        delta = vp56_rac_get_tree(c, vp56_pmbtm_tree,
-                                                  vp56_mb_type_model_model);
-                        if (!delta)
-                            delta = 4 * vp56_rac_gets(c, 7);
-                        model->mb_types_stats[ctx][type][i] += (delta ^ -sign) + sign;
-                    }
-                }
-            }
-        }
-    }
-
-    /* compute MB type probability tables based on previous MB type */
-    for (ctx=0; ctx<3; ctx++) {
-        int p[10];
-
-        for (type=0; type<10; type++)
-            p[type] = 100 * model->mb_types_stats[ctx][type][1];
-
-        for (type=0; type<10; type++) {
-            int p02, p34, p0234, p17, p56, p89, p5689, p156789;
-
-            /* conservative MB type probability */
-            model->mb_type[ctx][type][0] = 255 - (255 * model->mb_types_stats[ctx][type][0]) / (1 + model->mb_types_stats[ctx][type][0] + model->mb_types_stats[ctx][type][1]);
-
-            p[type] = 0;    /* same MB type => weight is null */
-
-            /* binary tree parsing probabilities */
-            p02 = p[0] + p[2];
-            p34 = p[3] + p[4];
-            p0234 = p02 + p34;
-            p17 = p[1] + p[7];
-            p56 = p[5] + p[6];
-            p89 = p[8] + p[9];
-            p5689 = p56 + p89;
-            p156789 = p17 + p5689;
-
-            model->mb_type[ctx][type][1] = 1 + 255 * p0234/(1+p0234+p156789);
-            model->mb_type[ctx][type][2] = 1 + 255 * p02  / (1+p0234);
-            model->mb_type[ctx][type][3] = 1 + 255 * p17  / (1+p156789);
-            model->mb_type[ctx][type][4] = 1 + 255 * p[0] / (1+p02);
-            model->mb_type[ctx][type][5] = 1 + 255 * p[3] / (1+p34);
-            model->mb_type[ctx][type][6] = 1 + 255 * p[1] / (1+p17);
-            model->mb_type[ctx][type][7] = 1 + 255 * p56  / (1+p5689);
-            model->mb_type[ctx][type][8] = 1 + 255 * p[5] / (1+p56);
-            model->mb_type[ctx][type][9] = 1 + 255 * p[8] / (1+p89);
-
-            /* restore initial value */
-            p[type] = 100 * model->mb_types_stats[ctx][type][1];
-        }
-    }
-}
-
-static VP56mb vp56_parse_mb_type(VP56Context *s,
-                                 VP56mb prev_type, int ctx)
-{
-    uint8_t *mb_type_model = s->modelp->mb_type[ctx][prev_type];
-    VP56RangeCoder *c = &s->c;
-
-    if (vp56_rac_get_prob(c, mb_type_model[0]))
-        return prev_type;
-    else
-        return vp56_rac_get_tree(c, vp56_pmbt_tree, mb_type_model);
-}
-
-static void vp56_decode_4mv(VP56Context *s, int row, int col)
-{
-    VP56mv mv = {0,0};
-    int type[4];
-    int b;
-
-    /* parse each block type */
-    for (b=0; b<4; b++) {
-        type[b] = vp56_rac_gets(&s->c, 2);
-        if (type[b])
-            type[b]++;  /* only returns 0, 2, 3 or 4 (all INTER_PF) */
-    }
-
-    /* get vectors */
-    for (b=0; b<4; b++) {
-        switch (type[b]) {
-            case VP56_MB_INTER_NOVEC_PF:
-                s->mv[b] = (VP56mv) {0,0};
-                break;
-            case VP56_MB_INTER_DELTA_PF:
-                s->parse_vector_adjustment(s, &s->mv[b]);
-                break;
-            case VP56_MB_INTER_V1_PF:
-                s->mv[b] = s->vector_candidate[0];
-                break;
-            case VP56_MB_INTER_V2_PF:
-                s->mv[b] = s->vector_candidate[1];
-                break;
-        }
-        mv.x += s->mv[b].x;
-        mv.y += s->mv[b].y;
-    }
-
-    /* this is the one selected for the whole MB for prediction */
-    s->macroblocks[row * s->mb_width + col].mv = s->mv[3];
-
-    /* chroma vectors are average luma vectors */
-    if (s->avctx->codec->id == CODEC_ID_VP5) {
-        s->mv[4].x = s->mv[5].x = RSHIFT(mv.x,2);
-        s->mv[4].y = s->mv[5].y = RSHIFT(mv.y,2);
-    } else {
-        s->mv[4] = s->mv[5] = (VP56mv) {mv.x/4, mv.y/4};
-    }
-}
-
-static VP56mb vp56_decode_mv(VP56Context *s, int row, int col)
-{
-    VP56mv *mv, vect = {0,0};
-    int ctx, b;
-
-    ctx = vp56_get_vectors_predictors(s, row, col, VP56_FRAME_PREVIOUS);
-    s->mb_type = vp56_parse_mb_type(s, s->mb_type, ctx);
-    s->macroblocks[row * s->mb_width + col].type = s->mb_type;
-
-    switch (s->mb_type) {
-        case VP56_MB_INTER_V1_PF:
-            mv = &s->vector_candidate[0];
-            break;
-
-        case VP56_MB_INTER_V2_PF:
-            mv = &s->vector_candidate[1];
-            break;
-
-        case VP56_MB_INTER_V1_GF:
-            vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
-            mv = &s->vector_candidate[0];
-            break;
-
-        case VP56_MB_INTER_V2_GF:
-            vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
-            mv = &s->vector_candidate[1];
-            break;
-
-        case VP56_MB_INTER_DELTA_PF:
-            s->parse_vector_adjustment(s, &vect);
-            mv = &vect;
-            break;
-
-        case VP56_MB_INTER_DELTA_GF:
-            vp56_get_vectors_predictors(s, row, col, VP56_FRAME_GOLDEN);
-            s->parse_vector_adjustment(s, &vect);
-            mv = &vect;
-            break;
-
-        case VP56_MB_INTER_4V:
-            vp56_decode_4mv(s, row, col);
-            return s->mb_type;
-
-        default:
-            mv = &vect;
-            break;
-    }
-
-    s->macroblocks[row*s->mb_width + col].mv = *mv;
-
-    /* same vector for all blocks */
-    for (b=0; b<6; b++)
-        s->mv[b] = *mv;
-
-    return s->mb_type;
-}
-
-static void vp56_add_predictors_dc(VP56Context *s, VP56Frame ref_frame)
-{
-    int idx = s->scantable.permutated[0];
-    int b;
-
-    for (b=0; b<6; b++) {
-        VP56RefDc *ab = &s->above_blocks[s->above_block_idx[b]];
-        VP56RefDc *lb = &s->left_block[vp56_b6to4[b]];
-        int count = 0;
-        int dc = 0;
-        int i;
-
-        if (ref_frame == lb->ref_frame) {
-            dc += lb->dc_coeff;
-            count++;
-        }
-        if (ref_frame == ab->ref_frame) {
-            dc += ab->dc_coeff;
-            count++;
-        }
-        if (s->avctx->codec->id == CODEC_ID_VP5)
-            for (i=0; i<2; i++)
-                if (count < 2 && ref_frame == ab[-1+2*i].ref_frame) {
-                    dc += ab[-1+2*i].dc_coeff;
-                    count++;
-                }
-        if (count == 0)
-            dc = s->prev_dc[vp56_b2p[b]][ref_frame];
-        else if (count == 2)
-            dc /= 2;
-
-        s->block_coeff[b][idx] += dc;
-        s->prev_dc[vp56_b2p[b]][ref_frame] = s->block_coeff[b][idx];
-        ab->dc_coeff = s->block_coeff[b][idx];
-        ab->ref_frame = ref_frame;
-        lb->dc_coeff = s->block_coeff[b][idx];
-        lb->ref_frame = ref_frame;
-        s->block_coeff[b][idx] *= s->dequant_dc;
-    }
-}
-
-static void vp56_deblock_filter(VP56Context *s, uint8_t *yuv,
-                                int stride, int dx, int dy)
-{
-    int t = vp56_filter_threshold[s->quantizer];
-    if (dx)  s->vp56dsp.edge_filter_hor(yuv +         10-dx , stride, t);
-    if (dy)  s->vp56dsp.edge_filter_ver(yuv + stride*(10-dy), stride, t);
-}
-
-static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,
-                    int stride, int x, int y)
-{
-    uint8_t *dst=s->framep[VP56_FRAME_CURRENT]->data[plane]+s->block_offset[b];
-    uint8_t *src_block;
-    int src_offset;
-    int overlap_offset = 0;
-    int mask = s->vp56_coord_div[b] - 1;
-    int deblock_filtering = s->deblock_filtering;
-    int dx;
-    int dy;
-
-    if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||
-        (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY
-         && !s->framep[VP56_FRAME_CURRENT]->key_frame))
-        deblock_filtering = 0;
-
-    dx = s->mv[b].x / s->vp56_coord_div[b];
-    dy = s->mv[b].y / s->vp56_coord_div[b];
-
-    if (b >= 4) {
-        x /= 2;
-        y /= 2;
-    }
-    x += dx - 2;
-    y += dy - 2;
-
-    if (x<0 || x+12>=s->plane_width[plane] ||
-        y<0 || y+12>=s->plane_height[plane]) {
-        ff_emulated_edge_mc(s->edge_emu_buffer,
-                            src + s->block_offset[b] + (dy-2)*stride + (dx-2),
-                            stride, 12, 12, x, y,
-                            s->plane_width[plane],
-                            s->plane_height[plane]);
-        src_block = s->edge_emu_buffer;
-        src_offset = 2 + 2*stride;
-    } else if (deblock_filtering) {
-        /* only need a 12x12 block, but there is no such dsp function, */
-        /* so copy a 16x12 block */
-        s->dsp.put_pixels_tab[0][0](s->edge_emu_buffer,
-                                    src + s->block_offset[b] + (dy-2)*stride + (dx-2),
-                                    stride, 12);
-        src_block = s->edge_emu_buffer;
-        src_offset = 2 + 2*stride;
-    } else {
-        src_block = src;
-        src_offset = s->block_offset[b] + dy*stride + dx;
-    }
-
-    if (deblock_filtering)
-        vp56_deblock_filter(s, src_block, stride, dx&7, dy&7);
-
-    if (s->mv[b].x & mask)
-        overlap_offset += (s->mv[b].x > 0) ? 1 : -1;
-    if (s->mv[b].y & mask)
-        overlap_offset += (s->mv[b].y > 0) ? stride : -stride;
-
-    if (overlap_offset) {
-        if (s->filter)
-            s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset,
-                      stride, s->mv[b], mask, s->filter_selection, b<4);
-        else
-            s->dsp.put_no_rnd_pixels_l2[1](dst, src_block+src_offset,
-                                           src_block+src_offset+overlap_offset,
-                                           stride, 8);
-    } else {
-        s->dsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8);
-    }
-}
-
-static void vp56_decode_mb(VP56Context *s, int row, int col, int is_alpha)
-{
-    AVFrame *frame_current, *frame_ref;
-    VP56mb mb_type;
-    VP56Frame ref_frame;
-    int b, ab, b_max, plane, off;
-
-    if (s->framep[VP56_FRAME_CURRENT]->key_frame)
-        mb_type = VP56_MB_INTRA;
-    else
-        mb_type = vp56_decode_mv(s, row, col);
-    ref_frame = vp56_reference_frame[mb_type];
-
-    s->dsp.clear_blocks(*s->block_coeff);
-
-    s->parse_coeff(s);
-
-    vp56_add_predictors_dc(s, ref_frame);
-
-    frame_current = s->framep[VP56_FRAME_CURRENT];
-    frame_ref = s->framep[ref_frame];
-
-    ab = 6*is_alpha;
-    b_max = 6 - 2*is_alpha;
-
-    switch (mb_type) {
-        case VP56_MB_INTRA:
-            for (b=0; b<b_max; b++) {
-                plane = vp56_b2p[b+ab];
-                s->dsp.idct_put(frame_current->data[plane] + s->block_offset[b],
-                                s->stride[plane], s->block_coeff[b]);
-            }
-            break;
-
-        case VP56_MB_INTER_NOVEC_PF:
-        case VP56_MB_INTER_NOVEC_GF:
-            for (b=0; b<b_max; b++) {
-                plane = vp56_b2p[b+ab];
-                off = s->block_offset[b];
-                s->dsp.put_pixels_tab[1][0](frame_current->data[plane] + off,
-                                            frame_ref->data[plane] + off,
-                                            s->stride[plane], 8);
-                s->dsp.idct_add(frame_current->data[plane] + off,
-                                s->stride[plane], s->block_coeff[b]);
-            }
-            break;
-
-        case VP56_MB_INTER_DELTA_PF:
-        case VP56_MB_INTER_V1_PF:
-        case VP56_MB_INTER_V2_PF:
-        case VP56_MB_INTER_DELTA_GF:
-        case VP56_MB_INTER_4V:
-        case VP56_MB_INTER_V1_GF:
-        case VP56_MB_INTER_V2_GF:
-            for (b=0; b<b_max; b++) {
-                int x_off = b==1 || b==3 ? 8 : 0;
-                int y_off = b==2 || b==3 ? 8 : 0;
-                plane = vp56_b2p[b+ab];
-                vp56_mc(s, b, plane, frame_ref->data[plane], s->stride[plane],
-                        16*col+x_off, 16*row+y_off);
-                s->dsp.idct_add(frame_current->data[plane] + s->block_offset[b],
-                                s->stride[plane], s->block_coeff[b]);
-            }
-            break;
-    }
-}
-
-static int vp56_size_changed(AVCodecContext *avctx)
-{
-    VP56Context *s = avctx->priv_data;
-    int stride = s->framep[VP56_FRAME_CURRENT]->linesize[0];
-    int i;
-
-    s->plane_width[0]  = s->plane_width[3]  = avctx->coded_width;
-    s->plane_width[1]  = s->plane_width[2]  = avctx->coded_width/2;
-    s->plane_height[0] = s->plane_height[3] = avctx->coded_height;
-    s->plane_height[1] = s->plane_height[2] = avctx->coded_height/2;
-
-    for (i=0; i<4; i++)
-        s->stride[i] = s->flip * s->framep[VP56_FRAME_CURRENT]->linesize[i];
-
-    s->mb_width  = (avctx->coded_width +15) / 16;
-    s->mb_height = (avctx->coded_height+15) / 16;
-
-    if (s->mb_width > 1000 || s->mb_height > 1000) {
-        av_log(avctx, AV_LOG_ERROR, "picture too big\n");
-        return -1;
-    }
-
-    s->qscale_table = av_realloc(s->qscale_table, s->mb_width);
-    s->above_blocks = av_realloc(s->above_blocks,
-                                 (4*s->mb_width+6) * sizeof(*s->above_blocks));
-    s->macroblocks = av_realloc(s->macroblocks,
-                                s->mb_width*s->mb_height*sizeof(*s->macroblocks));
-    av_free(s->edge_emu_buffer_alloc);
-    s->edge_emu_buffer_alloc = av_malloc(16*stride);
-    s->edge_emu_buffer = s->edge_emu_buffer_alloc;
-    if (s->flip < 0)
-        s->edge_emu_buffer += 15 * stride;
-
-    return 0;
-}
-
-int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                      AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    VP56Context *s = avctx->priv_data;
-    AVFrame *const p = s->framep[VP56_FRAME_CURRENT];
-    int remaining_buf_size = avpkt->size;
-    int is_alpha, av_uninit(alpha_offset);
-
-    if (s->has_alpha) {
-        if (remaining_buf_size < 3)
-            return -1;
-        alpha_offset = bytestream_get_be24(&buf);
-        remaining_buf_size -= 3;
-        if (remaining_buf_size < alpha_offset)
-            return -1;
-    }
-
-    for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) {
-        int mb_row, mb_col, mb_row_flip, mb_offset = 0;
-        int block, y, uv, stride_y, stride_uv;
-        int golden_frame = 0;
-        int res;
-
-        s->modelp = &s->models[is_alpha];
-
-        res = s->parse_header(s, buf, remaining_buf_size, &golden_frame);
-        if (!res)
-            return -1;
-
-        if (!is_alpha) {
-            p->reference = 1;
-            if (avctx->get_buffer(avctx, p) < 0) {
-                av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-                return -1;
-            }
-
-            if (res == 2)
-                if (vp56_size_changed(avctx)) {
-                    avctx->release_buffer(avctx, p);
-                    return -1;
-                }
-        }
-
-        if (p->key_frame) {
-            p->pict_type = FF_I_TYPE;
-            s->default_models_init(s);
-            for (block=0; block<s->mb_height*s->mb_width; block++)
-                s->macroblocks[block].type = VP56_MB_INTRA;
-        } else {
-            p->pict_type = FF_P_TYPE;
-            vp56_parse_mb_type_models(s);
-            s->parse_vector_models(s);
-            s->mb_type = VP56_MB_INTER_NOVEC_PF;
-        }
-
-        s->parse_coeff_models(s);
-
-        memset(s->prev_dc, 0, sizeof(s->prev_dc));
-        s->prev_dc[1][VP56_FRAME_CURRENT] = 128;
-        s->prev_dc[2][VP56_FRAME_CURRENT] = 128;
-
-        for (block=0; block < 4*s->mb_width+6; block++) {
-            s->above_blocks[block].ref_frame = VP56_FRAME_NONE;
-            s->above_blocks[block].dc_coeff = 0;
-            s->above_blocks[block].not_null_dc = 0;
-        }
-        s->above_blocks[2*s->mb_width + 2].ref_frame = VP56_FRAME_CURRENT;
-        s->above_blocks[3*s->mb_width + 4].ref_frame = VP56_FRAME_CURRENT;
-
-        stride_y  = p->linesize[0];
-        stride_uv = p->linesize[1];
-
-        if (s->flip < 0)
-            mb_offset = 7;
-
-        /* main macroblocks loop */
-        for (mb_row=0; mb_row<s->mb_height; mb_row++) {
-            if (s->flip < 0)
-                mb_row_flip = s->mb_height - mb_row - 1;
-            else
-                mb_row_flip = mb_row;
-
-            for (block=0; block<4; block++) {
-                s->left_block[block].ref_frame = VP56_FRAME_NONE;
-                s->left_block[block].dc_coeff = 0;
-                s->left_block[block].not_null_dc = 0;
-            }
-            memset(s->coeff_ctx, 0, sizeof(s->coeff_ctx));
-            memset(s->coeff_ctx_last, 24, sizeof(s->coeff_ctx_last));
-
-            s->above_block_idx[0] = 1;
-            s->above_block_idx[1] = 2;
-            s->above_block_idx[2] = 1;
-            s->above_block_idx[3] = 2;
-            s->above_block_idx[4] = 2*s->mb_width + 2 + 1;
-            s->above_block_idx[5] = 3*s->mb_width + 4 + 1;
-
-            s->block_offset[s->frbi] = (mb_row_flip*16 + mb_offset) * stride_y;
-            s->block_offset[s->srbi] = s->block_offset[s->frbi] + 8*stride_y;
-            s->block_offset[1] = s->block_offset[0] + 8;
-            s->block_offset[3] = s->block_offset[2] + 8;
-            s->block_offset[4] = (mb_row_flip*8 + mb_offset) * stride_uv;
-            s->block_offset[5] = s->block_offset[4];
-
-            for (mb_col=0; mb_col<s->mb_width; mb_col++) {
-                vp56_decode_mb(s, mb_row, mb_col, is_alpha);
-
-                for (y=0; y<4; y++) {
-                    s->above_block_idx[y] += 2;
-                    s->block_offset[y] += 16;
-                }
-
-                for (uv=4; uv<6; uv++) {
-                    s->above_block_idx[uv] += 1;
-                    s->block_offset[uv] += 8;
-                }
-            }
-        }
-
-        if (p->key_frame || golden_frame) {
-            if (s->framep[VP56_FRAME_GOLDEN]->data[0] &&
-                s->framep[VP56_FRAME_GOLDEN] != s->framep[VP56_FRAME_GOLDEN2])
-                avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
-            s->framep[VP56_FRAME_GOLDEN] = p;
-        }
-
-        if (s->has_alpha) {
-            FFSWAP(AVFrame *, s->framep[VP56_FRAME_GOLDEN],
-                              s->framep[VP56_FRAME_GOLDEN2]);
-            buf += alpha_offset;
-            remaining_buf_size -= alpha_offset;
-        }
-    }
-
-    if (s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN] ||
-        s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN2]) {
-        if (s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN] &&
-            s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN2])
-            FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS],
-                              s->framep[VP56_FRAME_UNUSED]);
-        else
-            FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS],
-                              s->framep[VP56_FRAME_UNUSED2]);
-    } else if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
-        avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
-    FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT],
-                      s->framep[VP56_FRAME_PREVIOUS]);
-
-    p->qstride = 0;
-    p->qscale_table = s->qscale_table;
-    p->qscale_type = FF_QSCALE_TYPE_VP56;
-    *(AVFrame*)data = *p;
-    *data_size = sizeof(AVFrame);
-
-    return avpkt->size;
-}
-
-av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
-{
-    VP56Context *s = avctx->priv_data;
-    int i;
-
-    s->avctx = avctx;
-    avctx->pix_fmt = has_alpha ? PIX_FMT_YUVA420P : PIX_FMT_YUV420P;
-
-    if (avctx->idct_algo == FF_IDCT_AUTO)
-        avctx->idct_algo = FF_IDCT_VP3;
-    dsputil_init(&s->dsp, avctx);
-    ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id);
-    ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct);
-
-    for (i=0; i<4; i++)
-        s->framep[i] = &s->frames[i];
-    s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN];
-    s->framep[VP56_FRAME_UNUSED2] = s->framep[VP56_FRAME_GOLDEN2];
-    s->edge_emu_buffer_alloc = NULL;
-
-    s->above_blocks = NULL;
-    s->macroblocks = NULL;
-    s->quantizer = -1;
-    s->deblock_filtering = 1;
-
-    s->filter = NULL;
-
-    s->has_alpha = has_alpha;
-    if (flip) {
-        s->flip = -1;
-        s->frbi = 2;
-        s->srbi = 0;
-    } else {
-        s->flip = 1;
-        s->frbi = 0;
-        s->srbi = 2;
-    }
-}
-
-av_cold int vp56_free(AVCodecContext *avctx)
-{
-    VP56Context *s = avctx->priv_data;
-
-    av_freep(&s->qscale_table);
-    av_freep(&s->above_blocks);
-    av_freep(&s->macroblocks);
-    av_freep(&s->edge_emu_buffer_alloc);
-    if (s->framep[VP56_FRAME_GOLDEN]->data[0])
-        avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
-    if (s->framep[VP56_FRAME_GOLDEN2]->data[0])
-        avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]);
-    if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
-        avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
-    return 0;
-}
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
deleted file mode 100644
index 89eba05..0000000
--- a/libavcodec/vp56.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- * @file
- * VP5 and VP6 compatible video decoder (common features)
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VP56_H
-#define AVCODEC_VP56_H
-
-#include "vp56data.h"
-#include "dsputil.h"
-#include "get_bits.h"
-#include "bytestream.h"
-#include "vp56dsp.h"
-
-typedef struct vp56_context VP56Context;
-typedef struct vp56_mv VP56mv;
-
-typedef void (*VP56ParseVectorAdjustment)(VP56Context *s,
-                                          VP56mv *vect);
-typedef void (*VP56Filter)(VP56Context *s, uint8_t *dst, uint8_t *src,
-                           int offset1, int offset2, int stride,
-                           VP56mv mv, int mask, int select, int luma);
-typedef void (*VP56ParseCoeff)(VP56Context *s);
-typedef void (*VP56DefaultModelsInit)(VP56Context *s);
-typedef void (*VP56ParseVectorModels)(VP56Context *s);
-typedef void (*VP56ParseCoeffModels)(VP56Context *s);
-typedef int  (*VP56ParseHeader)(VP56Context *s, const uint8_t *buf,
-                                int buf_size, int *golden_frame);
-
-typedef struct {
-    int high;
-    int bits;
-    const uint8_t *buffer;
-    const uint8_t *end;
-    unsigned long code_word;
-} VP56RangeCoder;
-
-typedef struct {
-    uint8_t not_null_dc;
-    VP56Frame ref_frame;
-    DCTELEM dc_coeff;
-} VP56RefDc;
-
-struct vp56_mv {
-    int x;
-    int y;
-};
-
-typedef struct {
-    uint8_t type;
-    VP56mv mv;
-} VP56Macroblock;
-
-typedef struct {
-    uint8_t coeff_reorder[64];       /* used in vp6 only */
-    uint8_t coeff_index_to_pos[64];  /* used in vp6 only */
-    uint8_t vector_sig[2];           /* delta sign */
-    uint8_t vector_dct[2];           /* delta coding types */
-    uint8_t vector_pdi[2][2];        /* predefined delta init */
-    uint8_t vector_pdv[2][7];        /* predefined delta values */
-    uint8_t vector_fdv[2][8];        /* 8 bit delta value definition */
-    uint8_t coeff_dccv[2][11];       /* DC coeff value */
-    uint8_t coeff_ract[2][3][6][11]; /* Run/AC coding type and AC coeff value */
-    uint8_t coeff_acct[2][3][3][6][5];/* vp5 only AC coding type for coding group < 3 */
-    uint8_t coeff_dcct[2][36][5];    /* DC coeff coding type */
-    uint8_t coeff_runv[2][14];       /* run value (vp6 only) */
-    uint8_t mb_type[3][10][10];      /* model for decoding MB type */
-    uint8_t mb_types_stats[3][10][2];/* contextual, next MB type stats */
-} VP56Model;
-
-struct vp56_context {
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    VP56DSPContext vp56dsp;
-    ScanTable scantable;
-    AVFrame frames[4];
-    AVFrame *framep[6];
-    uint8_t *edge_emu_buffer_alloc;
-    uint8_t *edge_emu_buffer;
-    VP56RangeCoder c;
-    VP56RangeCoder cc;
-    VP56RangeCoder *ccp;
-    int sub_version;
-
-    /* frame info */
-    int plane_width[4];
-    int plane_height[4];
-    int mb_width;   /* number of horizontal MB */
-    int mb_height;  /* number of vertical MB */
-    int block_offset[6];
-
-    int quantizer;
-    uint16_t dequant_dc;
-    uint16_t dequant_ac;
-    int8_t *qscale_table;
-
-    /* DC predictors management */
-    VP56RefDc *above_blocks;
-    VP56RefDc left_block[4];
-    int above_block_idx[6];
-    DCTELEM prev_dc[3][3];    /* [plan][ref_frame] */
-
-    /* blocks / macroblock */
-    VP56mb mb_type;
-    VP56Macroblock *macroblocks;
-    DECLARE_ALIGNED(16, DCTELEM, block_coeff)[6][64];
-
-    /* motion vectors */
-    VP56mv mv[6];  /* vectors for each block in MB */
-    VP56mv vector_candidate[2];
-    int vector_candidate_pos;
-
-    /* filtering hints */
-    int filter_header;               /* used in vp6 only */
-    int deblock_filtering;
-    int filter_selection;
-    int filter_mode;
-    int max_vector_length;
-    int sample_variance_threshold;
-
-    uint8_t coeff_ctx[4][64];              /* used in vp5 only */
-    uint8_t coeff_ctx_last[4];             /* used in vp5 only */
-
-    int has_alpha;
-
-    /* upside-down flipping hints */
-    int flip;  /* are we flipping ? */
-    int frbi;  /* first row block index in MB */
-    int srbi;  /* second row block index in MB */
-    int stride[4];  /* stride for each plan */
-
-    const uint8_t *vp56_coord_div;
-    VP56ParseVectorAdjustment parse_vector_adjustment;
-    VP56Filter filter;
-    VP56ParseCoeff parse_coeff;
-    VP56DefaultModelsInit default_models_init;
-    VP56ParseVectorModels parse_vector_models;
-    VP56ParseCoeffModels parse_coeff_models;
-    VP56ParseHeader parse_header;
-
-    VP56Model *modelp;
-    VP56Model models[2];
-
-    /* huffman decoding */
-    int use_huffman;
-    GetBitContext gb;
-    VLC dccv_vlc[2];
-    VLC runv_vlc[2];
-    VLC ract_vlc[2][3][6];
-    unsigned int nb_null[2][2];       /* number of consecutive NULL DC/AC */
-};
-
-
-void vp56_init(AVCodecContext *avctx, int flip, int has_alpha);
-int vp56_free(AVCodecContext *avctx);
-void vp56_init_dequant(VP56Context *s, int quantizer);
-int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                      AVPacket *avpkt);
-
-
-/**
- * vp56 specific range coder implementation
- */
-
-static inline void vp56_init_range_decoder(VP56RangeCoder *c,
-                                           const uint8_t *buf, int buf_size)
-{
-    c->high = 255;
-    c->bits = 8;
-    c->buffer = buf;
-    c->end = buf + buf_size;
-    c->code_word = bytestream_get_be16(&c->buffer);
-}
-
-static inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob)
-{
-    unsigned int low = 1 + (((c->high - 1) * prob) / 256);
-    unsigned int low_shift = low << 8;
-    int bit = c->code_word >= low_shift;
-
-    if (bit) {
-        c->high -= low;
-        c->code_word -= low_shift;
-    } else {
-        c->high = low;
-    }
-
-    /* normalize */
-    while (c->high < 128) {
-        c->high <<= 1;
-        c->code_word <<= 1;
-        if (--c->bits == 0 && c->buffer < c->end) {
-            c->bits = 8;
-            c->code_word |= *c->buffer++;
-        }
-    }
-    return bit;
-}
-
-static inline int vp56_rac_get(VP56RangeCoder *c)
-{
-    /* equiprobable */
-    int low = (c->high + 1) >> 1;
-    unsigned int low_shift = low << 8;
-    int bit = c->code_word >= low_shift;
-    if (bit) {
-        c->high = (c->high - low) << 1;
-        c->code_word -= low_shift;
-    } else {
-        c->high = low << 1;
-    }
-
-    /* normalize */
-    c->code_word <<= 1;
-    if (--c->bits == 0 && c->buffer < c->end) {
-        c->bits = 8;
-        c->code_word |= *c->buffer++;
-    }
-    return bit;
-}
-
-static inline int vp56_rac_gets(VP56RangeCoder *c, int bits)
-{
-    int value = 0;
-
-    while (bits--) {
-        value = (value << 1) | vp56_rac_get(c);
-    }
-
-    return value;
-}
-
-static inline int vp56_rac_gets_nn(VP56RangeCoder *c, int bits)
-{
-    int v = vp56_rac_gets(c, 7) << 1;
-    return v + !v;
-}
-
-static inline int vp56_rac_get_tree(VP56RangeCoder *c,
-                                    const VP56Tree *tree,
-                                    const uint8_t *probs)
-{
-    while (tree->val > 0) {
-        if (vp56_rac_get_prob(c, probs[tree->prob_idx]))
-            tree += tree->val;
-        else
-            tree++;
-    }
-    return -tree->val;
-}
-
-#endif /* AVCODEC_VP56_H */
diff --git a/libavcodec/vp56data.c b/libavcodec/vp56data.c
deleted file mode 100644
index b0515c2..0000000
--- a/libavcodec/vp56data.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * @file
- * VP5 and VP6 compatible video decoder (common data)
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "vp56data.h"
-
-const uint8_t vp56_b2p[]   = { 0, 0, 0, 0, 1, 2, 3, 3, 3, 3 };
-const uint8_t vp56_b6to4[] = { 0, 0, 1, 1, 2, 3 };
-
-const uint8_t vp56_coeff_parse_table[6][11] = {
-    { 159,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0 },
-    { 145, 165,   0,   0,   0,   0,   0,   0,   0,   0,   0 },
-    { 140, 148, 173,   0,   0,   0,   0,   0,   0,   0,   0 },
-    { 135, 140, 155, 176,   0,   0,   0,   0,   0,   0,   0 },
-    { 130, 134, 141, 157, 180,   0,   0,   0,   0,   0,   0 },
-    { 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254 },
-};
-
-const uint8_t vp56_def_mb_types_stats[3][10][2] = {
-    { {  69, 42 }, {   1,  2 }, {  1,   7 }, {  44, 42 }, {  6, 22 },
-      {   1,  3 }, {   0,  2 }, {  1,   5 }, {   0,  1 }, {  0,  0 }, },
-    { { 229,  8 }, {   1,  1 }, {  0,   8 }, {   0,  0 }, {  0,  0 },
-      {   1,  2 }, {   0,  1 }, {  0,   0 }, {   1,  1 }, {  0,  0 }, },
-    { { 122, 35 }, {   1,  1 }, {  1,   6 }, {  46, 34 }, {  0,  0 },
-      {   1,  2 }, {   0,  1 }, {  0,   1 }, {   1,  1 }, {  0,  0 }, },
-};
-
-const VP56Tree vp56_pva_tree[] = {
-    { 8, 0},
-    { 4, 1},
-    { 2, 2}, {-0}, {-1},
-    { 2, 3}, {-2}, {-3},
-    { 4, 4},
-    { 2, 5}, {-4}, {-5},
-    { 2, 6}, {-6}, {-7},
-};
-
-const VP56Tree vp56_pc_tree[] = {
-    { 4, 6},
-    { 2, 7}, {-0}, {-1},
-    { 4, 8},
-    { 2, 9}, {-2}, {-3},
-    { 2,10}, {-4}, {-5},
-};
-
-const uint8_t vp56_coeff_bias[] = { 0, 1, 2, 3, 4, 5, 7, 11, 19, 35, 67 };
-const uint8_t vp56_coeff_bit_length[] = { 0, 1, 2, 3, 4, 10 };
diff --git a/libavcodec/vp56data.h b/libavcodec/vp56data.h
deleted file mode 100644
index 57b0968..0000000
--- a/libavcodec/vp56data.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * @file
- * VP5 and VP6 compatible video decoder (common data)
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VP56DATA_H
-#define AVCODEC_VP56DATA_H
-
-#include "libavutil/common.h"
-
-typedef enum {
-    VP56_FRAME_NONE     =-1,
-    VP56_FRAME_CURRENT  = 0,
-    VP56_FRAME_PREVIOUS = 1,
-    VP56_FRAME_GOLDEN   = 2,
-    VP56_FRAME_GOLDEN2  = 3,
-    VP56_FRAME_UNUSED   = 4,
-    VP56_FRAME_UNUSED2  = 5,
-} VP56Frame;
-
-typedef enum {
-    VP56_MB_INTER_NOVEC_PF = 0,  /**< Inter MB, no vector, from previous frame */
-    VP56_MB_INTRA          = 1,  /**< Intra MB */
-    VP56_MB_INTER_DELTA_PF = 2,  /**< Inter MB, above/left vector + delta, from previous frame */
-    VP56_MB_INTER_V1_PF    = 3,  /**< Inter MB, first vector, from previous frame */
-    VP56_MB_INTER_V2_PF    = 4,  /**< Inter MB, second vector, from previous frame */
-    VP56_MB_INTER_NOVEC_GF = 5,  /**< Inter MB, no vector, from golden frame */
-    VP56_MB_INTER_DELTA_GF = 6,  /**< Inter MB, above/left vector + delta, from golden frame */
-    VP56_MB_INTER_4V       = 7,  /**< Inter MB, 4 vectors, from previous frame */
-    VP56_MB_INTER_V1_GF    = 8,  /**< Inter MB, first vector, from golden frame */
-    VP56_MB_INTER_V2_GF    = 9,  /**< Inter MB, second vector, from golden frame */
-} VP56mb;
-
-typedef struct {
-  int8_t val;
-  int8_t prob_idx;
-} VP56Tree;
-
-extern const uint8_t vp56_b2p[];
-extern const uint8_t vp56_b6to4[];
-extern const uint8_t vp56_coeff_parse_table[6][11];
-extern const uint8_t vp56_def_mb_types_stats[3][10][2];
-extern const VP56Tree vp56_pva_tree[];
-extern const VP56Tree vp56_pc_tree[];
-extern const uint8_t vp56_coeff_bias[];
-extern const uint8_t vp56_coeff_bit_length[];
-
-static const VP56Frame vp56_reference_frame[] = {
-    VP56_FRAME_PREVIOUS,  /* VP56_MB_INTER_NOVEC_PF */
-    VP56_FRAME_CURRENT,   /* VP56_MB_INTRA */
-    VP56_FRAME_PREVIOUS,  /* VP56_MB_INTER_DELTA_PF */
-    VP56_FRAME_PREVIOUS,  /* VP56_MB_INTER_V1_PF */
-    VP56_FRAME_PREVIOUS,  /* VP56_MB_INTER_V2_PF */
-    VP56_FRAME_GOLDEN,    /* VP56_MB_INTER_NOVEC_GF */
-    VP56_FRAME_GOLDEN,    /* VP56_MB_INTER_DELTA_GF */
-    VP56_FRAME_PREVIOUS,  /* VP56_MB_INTER_4V */
-    VP56_FRAME_GOLDEN,    /* VP56_MB_INTER_V1_GF */
-    VP56_FRAME_GOLDEN,    /* VP56_MB_INTER_V2_GF */
-};
-
-static const uint8_t vp56_ac_dequant[64] = {
-    94, 92, 90, 88, 86, 82, 78, 74,
-    70, 66, 62, 58, 54, 53, 52, 51,
-    50, 49, 48, 47, 46, 45, 44, 43,
-    42, 40, 39, 37, 36, 35, 34, 33,
-    32, 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,
-};
-
-static const uint8_t vp56_dc_dequant[64] = {
-    47, 47, 47, 47, 45, 43, 43, 43,
-    43, 43, 42, 41, 41, 40, 40, 40,
-    40, 35, 35, 35, 35, 33, 33, 33,
-    33, 32, 32, 32, 27, 27, 26, 26,
-    25, 25, 24, 24, 23, 23, 19, 19,
-    19, 19, 18, 18, 17, 16, 16, 16,
-    16, 16, 15, 11, 11, 11, 10, 10,
-     9,  8,  7,  5,  3,  3,  2,  2,
-};
-
-static const uint8_t vp56_pre_def_mb_type_stats[16][3][10][2] = {
-  { { {   9, 15 }, {  32, 25 }, {  7,  19 }, {   9, 21 }, {  1, 12 },
-      {  14, 12 }, {   3, 18 }, { 14,  23 }, {   3, 10 }, {  0,  4 }, },
-    { {  41, 22 }, {   1,  0 }, {  1,  31 }, {   0,  0 }, {  0,  0 },
-      {   0,  1 }, {   1,  7 }, {  0,   1 }, {  98, 25 }, {  4, 10 }, },
-    { {   2,  3 }, {   2,  3 }, {  0,   2 }, {   0,  2 }, {  0,  0 },
-      {  11,  4 }, {   1,  4 }, {  0,   2 }, {   3,  2 }, {  0,  4 }, }, },
-  { { {  48, 39 }, {   1,  2 }, { 11,  27 }, {  29, 44 }, {  7, 27 },
-      {   1,  4 }, {   0,  3 }, {  1,   6 }, {   1,  2 }, {  0,  0 }, },
-    { { 123, 37 }, {   6,  4 }, {  1,  27 }, {   0,  0 }, {  0,  0 },
-      {   5,  8 }, {   1,  7 }, {  0,   1 }, {  12, 10 }, {  0,  2 }, },
-    { {  49, 46 }, {   3,  4 }, {  7,  31 }, {  42, 41 }, {  0,  0 },
-      {   2,  6 }, {   1,  7 }, {  1,   4 }, {   2,  4 }, {  0,  1 }, }, },
-  { { {  21, 32 }, {   1,  2 }, {  4,  10 }, {  32, 43 }, {  6, 23 },
-      {   2,  3 }, {   1, 19 }, {  1,   6 }, {  12, 21 }, {  0,  7 }, },
-    { {  26, 14 }, {  14, 12 }, {  0,  24 }, {   0,  0 }, {  0,  0 },
-      {  55, 17 }, {   1,  9 }, {  0,  36 }, {   5,  7 }, {  1,  3 }, },
-    { {  26, 25 }, {   1,  1 }, {  2,  10 }, {  67, 39 }, {  0,  0 },
-      {   1,  1 }, {   0, 14 }, {  0,   2 }, {  31, 26 }, {  1,  6 }, }, },
-  { { {  69, 83 }, {   0,  0 }, {  0,   2 }, {  10, 29 }, {  3, 12 },
-      {   0,  1 }, {   0,  3 }, {  0,   3 }, {   2,  2 }, {  0,  0 }, },
-    { { 209,  5 }, {   0,  0 }, {  0,  27 }, {   0,  0 }, {  0,  0 },
-      {   0,  1 }, {   0,  1 }, {  0,   1 }, {   0,  0 }, {  0,  0 }, },
-    { { 103, 46 }, {   1,  2 }, {  2,  10 }, {  33, 42 }, {  0,  0 },
-      {   1,  4 }, {   0,  3 }, {  0,   1 }, {   1,  3 }, {  0,  0 }, }, },
-  { { {  11, 20 }, {   1,  4 }, { 18,  36 }, {  43, 48 }, { 13, 35 },
-      {   0,  2 }, {   0,  5 }, {  3,  12 }, {   1,  2 }, {  0,  0 }, },
-    { {   2,  5 }, {   4,  5 }, {  0, 121 }, {   0,  0 }, {  0,  0 },
-      {   0,  3 }, {   2,  4 }, {  1,   4 }, {   2,  2 }, {  0,  1 }, },
-    { {  14, 31 }, {   9, 13 }, { 14,  54 }, {  22, 29 }, {  0,  0 },
-      {   2,  6 }, {   4, 18 }, {  6,  13 }, {   1,  5 }, {  0,  1 }, }, },
-  { { {  70, 44 }, {   0,  1 }, {  2,  10 }, {  37, 46 }, {  8, 26 },
-      {   0,  2 }, {   0,  2 }, {  0,   2 }, {   0,  1 }, {  0,  0 }, },
-    { { 175,  5 }, {   0,  1 }, {  0,  48 }, {   0,  0 }, {  0,  0 },
-      {   0,  2 }, {   0,  1 }, {  0,   2 }, {   0,  1 }, {  0,  0 }, },
-    { {  85, 39 }, {   0,  0 }, {  1,   9 }, {  69, 40 }, {  0,  0 },
-      {   0,  1 }, {   0,  3 }, {  0,   1 }, {   2,  3 }, {  0,  0 }, }, },
-  { { {   8, 15 }, {   0,  1 }, {  8,  21 }, {  74, 53 }, { 22, 42 },
-      {   0,  1 }, {   0,  2 }, {  0,   3 }, {   1,  2 }, {  0,  0 }, },
-    { {  83,  5 }, {   2,  3 }, {  0, 102 }, {   0,  0 }, {  0,  0 },
-      {   1,  3 }, {   0,  2 }, {  0,   1 }, {   0,  0 }, {  0,  0 }, },
-    { {  31, 28 }, {   0,  0 }, {  3,  14 }, { 130, 34 }, {  0,  0 },
-      {   0,  1 }, {   0,  3 }, {  0,   1 }, {   3,  3 }, {  0,  1 }, }, },
-  { { { 141, 42 }, {   0,  0 }, {  1,   4 }, {  11, 24 }, {  1, 11 },
-      {   0,  1 }, {   0,  1 }, {  0,   2 }, {   0,  0 }, {  0,  0 }, },
-    { { 233,  6 }, {   0,  0 }, {  0,   8 }, {   0,  0 }, {  0,  0 },
-      {   0,  1 }, {   0,  1 }, {  0,   0 }, {   0,  1 }, {  0,  0 }, },
-    { { 171, 25 }, {   0,  0 }, {  1,   5 }, {  25, 21 }, {  0,  0 },
-      {   0,  1 }, {   0,  1 }, {  0,   0 }, {   0,  0 }, {  0,  0 }, }, },
-  { { {   8, 19 }, {   4, 10 }, { 24,  45 }, {  21, 37 }, {  9, 29 },
-      {   0,  3 }, {   1,  7 }, { 11,  25 }, {   0,  2 }, {  0,  1 }, },
-    { {  34, 16 }, { 112, 21 }, {  1,  28 }, {   0,  0 }, {  0,  0 },
-      {   6,  8 }, {   1,  7 }, {  0,   3 }, {   2,  5 }, {  0,  2 }, },
-    { {  17, 21 }, {  68, 29 }, {  6,  15 }, {  13, 22 }, {  0,  0 },
-      {   6, 12 }, {   3, 14 }, {  4,  10 }, {   1,  7 }, {  0,  3 }, }, },
-  { { {  46, 42 }, {   0,  1 }, {  2,  10 }, {  54, 51 }, { 10, 30 },
-      {   0,  2 }, {   0,  2 }, {  0,   1 }, {   0,  1 }, {  0,  0 }, },
-    { { 159, 35 }, {   2,  2 }, {  0,  25 }, {   0,  0 }, {  0,  0 },
-      {   3,  6 }, {   0,  5 }, {  0,   1 }, {   4,  4 }, {  0,  1 }, },
-    { {  51, 39 }, {   0,  1 }, {  2,  12 }, {  91, 44 }, {  0,  0 },
-      {   0,  2 }, {   0,  3 }, {  0,   1 }, {   2,  3 }, {  0,  1 }, }, },
-  { { {  28, 32 }, {   0,  0 }, {  3,  10 }, {  75, 51 }, { 14, 33 },
-      {   0,  1 }, {   0,  2 }, {  0,   1 }, {   1,  2 }, {  0,  0 }, },
-    { {  75, 39 }, {   5,  7 }, {  2,  48 }, {   0,  0 }, {  0,  0 },
-      {   3, 11 }, {   2, 16 }, {  1,   4 }, {   7, 10 }, {  0,  2 }, },
-    { {  81, 25 }, {   0,  0 }, {  2,   9 }, { 106, 26 }, {  0,  0 },
-      {   0,  1 }, {   0,  1 }, {  0,   1 }, {   1,  1 }, {  0,  0 }, }, },
-  { { { 100, 46 }, {   0,  1 }, {  3,   9 }, {  21, 37 }, {  5, 20 },
-      {   0,  1 }, {   0,  2 }, {  1,   2 }, {   0,  1 }, {  0,  0 }, },
-    { { 212, 21 }, {   0,  1 }, {  0,   9 }, {   0,  0 }, {  0,  0 },
-      {   1,  2 }, {   0,  2 }, {  0,   0 }, {   2,  2 }, {  0,  0 }, },
-    { { 140, 37 }, {   0,  1 }, {  1,   8 }, {  24, 33 }, {  0,  0 },
-      {   1,  2 }, {   0,  2 }, {  0,   1 }, {   1,  2 }, {  0,  0 }, }, },
-  { { {  27, 29 }, {   0,  1 }, {  9,  25 }, {  53, 51 }, { 12, 34 },
-      {   0,  1 }, {   0,  3 }, {  1,   5 }, {   0,  2 }, {  0,  0 }, },
-    { {   4,  2 }, {   0,  0 }, {  0, 172 }, {   0,  0 }, {  0,  0 },
-      {   0,  1 }, {   0,  2 }, {  0,   0 }, {   2,  0 }, {  0,  0 }, },
-    { {  14, 23 }, {   1,  3 }, { 11,  53 }, {  90, 31 }, {  0,  0 },
-      {   0,  3 }, {   1,  5 }, {  2,   6 }, {   1,  2 }, {  0,  0 }, }, },
-  { { {  80, 38 }, {   0,  0 }, {  1,   4 }, {  69, 33 }, {  5, 16 },
-      {   0,  1 }, {   0,  1 }, {  0,   0 }, {   0,  1 }, {  0,  0 }, },
-    { { 187, 22 }, {   1,  1 }, {  0,  17 }, {   0,  0 }, {  0,  0 },
-      {   3,  6 }, {   0,  4 }, {  0,   1 }, {   4,  4 }, {  0,  1 }, },
-    { { 123, 29 }, {   0,  0 }, {  1,   7 }, {  57, 30 }, {  0,  0 },
-      {   0,  1 }, {   0,  1 }, {  0,   1 }, {   0,  1 }, {  0,  0 }, }, },
-  { { {  16, 20 }, {   0,  0 }, {  2,   8 }, { 104, 49 }, { 15, 33 },
-      {   0,  1 }, {   0,  1 }, {  0,   1 }, {   1,  1 }, {  0,  0 }, },
-    { { 133,  6 }, {   1,  2 }, {  1,  70 }, {   0,  0 }, {  0,  0 },
-      {   0,  2 }, {   0,  4 }, {  0,   3 }, {   1,  1 }, {  0,  0 }, },
-    { {  13, 14 }, {   0,  0 }, {  4,  20 }, { 175, 20 }, {  0,  0 },
-      {   0,  1 }, {   0,  1 }, {  0,   1 }, {   1,  1 }, {  0,  0 }, }, },
-  { { { 194, 16 }, {   0,  0 }, {  1,   1 }, {   1,  9 }, {  1,  3 },
-      {   0,  0 }, {   0,  1 }, {  0,   1 }, {   0,  0 }, {  0,  0 }, },
-    { { 251,  1 }, {   0,  0 }, {  0,   2 }, {   0,  0 }, {  0,  0 },
-      {   0,  0 }, {   0,  0 }, {  0,   0 }, {   0,  0 }, {  0,  0 }, },
-    { { 202, 23 }, {   0,  0 }, {  1,   3 }, {   2,  9 }, {  0,  0 },
-      {   0,  1 }, {   0,  1 }, {  0,   1 }, {   0,  0 }, {  0,  0 }, }, },
-};
-
-static const uint8_t vp56_filter_threshold[] = {
-    14, 14, 13, 13, 12, 12, 10, 10,
-    10, 10,  8,  8,  8,  8,  8,  8,
-     8,  8,  8,  8,  8,  8,  8,  8,
-     8,  8,  8,  8,  8,  8,  8,  8,
-     8,  8,  8,  8,  7,  7,  7,  7,
-     7,  7,  6,  6,  6,  6,  6,  6,
-     5,  5,  5,  5,  4,  4,  4,  4,
-     4,  4,  4,  3,  3,  3,  3,  2,
-};
-
-static const uint8_t vp56_mb_type_model_model[] = {
-    171, 83, 199, 140, 125, 104,
-};
-
-static const VP56Tree vp56_pmbtm_tree[] = {
-    { 4, 0},
-    { 2, 1}, {-8}, {-4},
-    { 8, 2},
-    { 6, 3},
-    { 4, 4},
-    { 2, 5}, {-24}, {-20}, {-16}, {-12}, {-0},
-};
-
-static const VP56Tree vp56_pmbt_tree[] = {
-    { 8, 1},
-    { 4, 2},
-    { 2, 4}, {-VP56_MB_INTER_NOVEC_PF}, {-VP56_MB_INTER_DELTA_PF},
-    { 2, 5}, {-VP56_MB_INTER_V1_PF},    {-VP56_MB_INTER_V2_PF},
-    { 4, 3},
-    { 2, 6}, {-VP56_MB_INTRA},          {-VP56_MB_INTER_4V},
-    { 4, 7},
-    { 2, 8}, {-VP56_MB_INTER_NOVEC_GF}, {-VP56_MB_INTER_DELTA_GF},
-    { 2, 9}, {-VP56_MB_INTER_V1_GF},    {-VP56_MB_INTER_V2_GF},
-};
-
-/* relative pos of surrounding blocks, from closest to farthest */
-static const int8_t vp56_candidate_predictor_pos[12][2] = {
-    {  0, -1 },
-    { -1,  0 },
-    { -1, -1 },
-    {  1, -1 },
-    {  0, -2 },
-    { -2,  0 },
-    { -2, -1 },
-    { -1, -2 },
-    {  1, -2 },
-    {  2, -1 },
-    { -2, -2 },
-    {  2, -2 },
-};
-
-#endif /* AVCODEC_VP56DATA_H */
diff --git a/libavcodec/vp56dsp.c b/libavcodec/vp56dsp.c
deleted file mode 100644
index 9eb9299..0000000
--- a/libavcodec/vp56dsp.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2006 Aurelien Jacobs <aurel at gnuage.org>
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-#include "avcodec.h"
-#include "vp56dsp.h"
-
-/* Gives very similar result than the vp6 version except in a few cases */
-static int vp5_adjust(int v, int t)
-{
-    int s2, s1 = v >> 31;
-    v ^= s1;
-    v -= s1;
-    v *= v < 2*t;
-    v -= t;
-    s2 = v >> 31;
-    v ^= s2;
-    v -= s2;
-    v = t - v;
-    v += s1;
-    v ^= s1;
-    return v;
-}
-
-static int vp6_adjust(int v, int t)
-{
-    int V = v, s = v >> 31;
-    V ^= s;
-    V -= s;
-    if (V-t-1 >= (unsigned)(t-1))
-        return v;
-    V = 2*t - V;
-    V += s;
-    V ^= s;
-    return V;
-}
-
-
-#define VP56_EDGE_FILTER(pfx, suf, pix_inc, line_inc)                   \
-static void pfx##_edge_filter_##suf(uint8_t *yuv, int stride, int t)    \
-{                                                                       \
-    int pix2_inc = 2 * pix_inc;                                         \
-    int i, v;                                                           \
-                                                                        \
-    for (i=0; i<12; i++) {                                              \
-        v = (yuv[-pix2_inc] + 3*(yuv[0]-yuv[-pix_inc]) - yuv[pix_inc] + 4)>>3;\
-        v = pfx##_adjust(v, t);                                         \
-        yuv[-pix_inc] = av_clip_uint8(yuv[-pix_inc] + v);               \
-        yuv[0] = av_clip_uint8(yuv[0] - v);                             \
-        yuv += line_inc;                                                \
-    }                                                                   \
-}
-
-VP56_EDGE_FILTER(vp5, hor, 1, stride)
-VP56_EDGE_FILTER(vp5, ver, stride, 1)
-VP56_EDGE_FILTER(vp6, hor, 1, stride)
-VP56_EDGE_FILTER(vp6, ver, stride, 1)
-
-void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec)
-{
-    if (codec == CODEC_ID_VP5) {
-        s->edge_filter_hor = vp5_edge_filter_hor;
-        s->edge_filter_ver = vp5_edge_filter_ver;
-    } else {
-        s->edge_filter_hor = vp6_edge_filter_hor;
-        s->edge_filter_ver = vp6_edge_filter_ver;
-    }
-
-    if (ARCH_ARM) ff_vp56dsp_init_arm(s, codec);
-}
diff --git a/libavcodec/vp56dsp.h b/libavcodec/vp56dsp.h
deleted file mode 100644
index 2d6941f..0000000
--- a/libavcodec/vp56dsp.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VP56DSP_H
-#define AVCODEC_VP56DSP_H
-
-#include <stdint.h>
-
-typedef struct VP56DSPContext {
-    void (*edge_filter_hor)(uint8_t *yuv, int stride, int t);
-    void (*edge_filter_ver)(uint8_t *yuv, int stride, int t);
-} VP56DSPContext;
-
-void ff_vp56dsp_init(VP56DSPContext *s, enum CodecID codec);
-void ff_vp56dsp_init_arm(VP56DSPContext *s, enum CodecID codec);
-
-#endif /* AVCODEC_VP56DSP_H */
diff --git a/libavcodec/vp5data.h b/libavcodec/vp5data.h
deleted file mode 100644
index 5c2d46c..0000000
--- a/libavcodec/vp5data.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * @file
- * VP5 compatible video decoder
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VP5DATA_H
-#define AVCODEC_VP5DATA_H
-
-#include <stdint.h>
-
-static const uint8_t vp5_coeff_groups[] = {
-    -1, 0, 1, 1, 2, 1, 1, 2,
-     2, 1, 1, 2, 2, 2, 1, 2,
-     2, 2, 2, 2, 1, 1, 2, 2,
-     3, 3, 4, 3, 4, 4, 4, 3,
-     3, 3, 3, 3, 4, 3, 3, 3,
-     4, 4, 4, 4, 4, 3, 3, 4,
-     4, 4, 3, 4, 4, 4, 4, 4,
-     4, 4, 5, 5, 5, 5, 5, 5,
-};
-
-static const uint8_t vp5_vmc_pct[2][11] = {
-    { 243, 220, 251, 253, 237, 232, 241, 245, 247, 251, 253 },
-    { 235, 211, 246, 249, 234, 231, 248, 249, 252, 252, 254 },
-};
-
-static const uint8_t vp5_dccv_pct[2][11] = {
-    { 146, 197, 181, 207, 232, 243, 238, 251, 244, 250, 249 },
-    { 179, 219, 214, 240, 250, 254, 244, 254, 254, 254, 254 },
-};
-
-static const uint8_t vp5_ract_pct[3][2][6][11] = {
-    { { { 227, 246, 230, 247, 244, 254, 254, 254, 254, 254, 254 },
-        { 202, 254, 209, 231, 231, 249, 249, 253, 254, 254, 254 },
-        { 206, 254, 225, 242, 241, 251, 253, 254, 254, 254, 254 },
-        { 235, 254, 241, 253, 252, 254, 254, 254, 254, 254, 254 },
-        { 234, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } },
-      { { 240, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 238, 254, 240, 253, 254, 254, 254, 254, 254, 254, 254 },
-        { 244, 254, 251, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } },
-    { { { 206, 203, 227, 239, 247, 254, 253, 254, 254, 254, 254 },
-        { 207, 199, 220, 236, 243, 252, 252, 254, 254, 254, 254 },
-        { 212, 219, 230, 243, 244, 253, 252, 254, 254, 254, 254 },
-        { 236, 237, 247, 252, 253, 254, 254, 254, 254, 254, 254 },
-        { 240, 240, 248, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } },
-      { { 230, 233, 249, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 238, 238, 250, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 248, 251, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } },
-    { { { 225, 239, 227, 231, 244, 253, 243, 254, 254, 253, 254 },
-        { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 254 },
-        { 235, 249, 238, 240, 251, 254, 249, 254, 253, 253, 254 },
-        { 249, 253, 251, 250, 254, 254, 254, 254, 254, 254, 254 },
-        { 251, 250, 249, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } },
-      { { 243, 244, 250, 250, 254, 254, 254, 254, 254, 254, 254 },
-        { 249, 248, 250, 253, 254, 254, 254, 254, 254, 254, 254 },
-        { 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 },
-        { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } },
-};
-
-static const int16_t vp5_dccv_lc[5][36][2] = {
-    { {154,  61}, {141,  54}, { 90,  45}, { 54,  34}, { 54,  13}, {128, 109},
-      {136,  54}, {148,  45}, { 92,  41}, { 54,  33}, { 51,  15}, { 87, 113},
-      { 87,  44}, { 97,  40}, { 67,  36}, { 46,  29}, { 41,  15}, { 64,  80},
-      { 59,  33}, { 61,  31}, { 51,  28}, { 44,  22}, { 33,  12}, { 49,  63},
-      { 69,  12}, { 59,  16}, { 46,  14}, { 31,  13}, { 26,   6}, { 92,  26},
-      {128, 108}, { 77, 119}, { 54,  84}, { 26,  71}, { 87,  19}, { 95, 155} },
-    { {154,   4}, {182,   0}, {159,  -8}, {128,  -5}, {143,  -5}, {187,  55},
-      {182,   0}, {228,  -3}, {187,  -7}, {174,  -9}, {189, -11}, {169,  79},
-      {161,  -9}, {192,  -8}, {187,  -9}, {169, -10}, {136,  -9}, {184,  40},
-      {164, -11}, {179, -10}, {174, -10}, {161, -10}, {115,  -7}, {197,  20},
-      {195, -11}, {195, -11}, {146, -10}, {110,  -6}, { 95,  -4}, {195,  39},
-      {182,  55}, {172,  77}, {177,  37}, {169,  29}, {172,  52}, { 92, 162} },
-    { {174,  80}, {164,  80}, { 95,  80}, { 46,  66}, { 56,  24}, { 36, 193},
-      {164,  80}, {166,  77}, {105,  76}, { 49,  68}, { 46,  31}, { 49, 186},
-      { 97,  78}, {110,  74}, { 72,  72}, { 44,  60}, { 33,  30}, { 69, 131},
-      { 61,  61}, { 69,  63}, { 51,  57}, { 31,  48}, { 26,  27}, { 64,  89},
-      { 67,  23}, { 51,  32}, { 36,  33}, { 26,  28}, { 20,  12}, { 44,  68},
-      { 26, 197}, { 41, 189}, { 61, 129}, { 28, 103}, { 49,  52}, {-12, 245} },
-    { {102, 141}, { 79, 166}, { 72, 162}, { 97, 125}, {179,   4}, {307,   0},
-      { 72, 168}, { 69, 175}, { 84, 160}, {105, 127}, {148,  34}, {310,   0},
-      { 84, 151}, { 82, 161}, { 87, 153}, { 87, 135}, {115,  51}, {317,   0},
-      { 97, 125}, {102, 131}, {105, 125}, { 87, 122}, { 84,  64}, { 54, 184},
-      {166,  18}, {146,  43}, {125,  51}, { 90,  64}, { 95,   7}, { 38, 154},
-      {294,   0}, { 13, 225}, { 10, 225}, { 67, 168}, {  0, 167}, {161,  94} },
-    { {172,  76}, {172,  75}, {136,  80}, { 64,  98}, { 74,  67}, {315,   0},
-      {169,  76}, {207,  56}, {164,  66}, { 97,  80}, { 67,  72}, {328,   0},
-      {136,  80}, {187,  53}, {154,  62}, { 72,  85}, { -2, 105}, {305,   0},
-      { 74,  91}, {128,  64}, {113,  64}, { 61,  77}, { 41,  75}, {259,   0},
-      { 46,  84}, { 51,  81}, { 28,  89}, { 31,  78}, { 23,  77}, {202,   0},
-      {323,   0}, {323,   0}, {300,   0}, {236,   0}, {195,   0}, {328,   0} },
-};
-
-static const int16_t vp5_ract_lc[3][3][5][6][2] = {
-    { { { {276,  0}, {238,  0}, {195,  0}, {156,  0}, {113,  0}, {274,  0} },
-        { {  0,  1}, {  0,  1}, {  0,  1}, {  0,  1}, {  0,  1}, {  0,  1} },
-        { {192, 59}, {182, 50}, {141, 48}, {110, 40}, { 92, 19}, {125,128} },
-        { {169, 87}, {169, 83}, {184, 62}, {220, 16}, {184,  0}, {264,  0} },
-        { {212, 40}, {212, 36}, {169, 49}, {174, 27}, {  8,120}, {182, 71} } },
-      { { {259, 10}, {197, 19}, {143, 22}, {123, 16}, {110,  8}, {133, 88} },
-        { {  0,  1}, {256,  0}, {  0,  1}, {  0,  1}, {  0,  1}, {  0,  1} },
-        { {207, 46}, {187, 50}, { 97, 83}, { 23,100}, { 41, 56}, { 56,188} },
-        { {166, 90}, {146,108}, {161, 88}, {136, 95}, {174,  0}, {266,  0} },
-        { {264,  7}, {243, 18}, {184, 43}, {-14,154}, { 20,112}, { 20,199} } },
-      { { {230, 26}, {197, 22}, {159, 20}, {146, 12}, {136,  4}, { 54,162} },
-        { {  0,  1}, {  0,  1}, {  0,  1}, {  0,  1}, {  0,  1}, {  0,  1} },
-        { {192, 59}, {156, 72}, { 84,101}, { 49,101}, { 79, 47}, { 79,167} },
-        { {138,115}, {136,116}, {166, 80}, {238,  0}, {195,  0}, {261,  0} },
-        { {225, 33}, {205, 42}, {159, 61}, { 79, 96}, { 92, 66}, { 28,195} } },
-    }, {
-      { { {200, 37}, {197, 18}, {159, 13}, {143,  7}, {102,  5}, {123,126} },
-        { {197,  3}, {220, -9}, {210,-12}, {187, -6}, {151, -2}, {174, 80} },
-        { {200, 53}, {187, 47}, {159, 40}, {118, 38}, {100, 18}, {141,111} },
-        { {179, 78}, {166, 86}, {197, 50}, {207, 27}, {187,  0}, {115,139} },
-        { {218, 34}, {220, 29}, {174, 46}, {128, 61}, { 54, 89}, {187, 65} } },
-      { { {238, 14}, {197, 18}, {125, 26}, { 90, 25}, { 82, 13}, {161, 86} },
-        { {189,  1}, {205, -2}, {156, -4}, {143, -4}, {146, -4}, {172, 72} },
-        { {230, 31}, {192, 45}, {102, 76}, { 38, 85}, { 56, 41}, { 64,173} },
-        { {166, 91}, {141,111}, {128,116}, {118,109}, {177,  0}, { 23,222} },
-        { {253, 14}, {236, 21}, {174, 49}, { 33,118}, { 44, 93}, { 23,187} } },
-      { { {218, 28}, {179, 28}, {118, 35}, { 95, 30}, { 72, 24}, {128,108} },
-        { {187,  1}, {174, -1}, {125, -1}, {110, -1}, {108, -1}, {202, 52} },
-        { {197, 53}, {146, 75}, { 46,118}, { 33,103}, { 64, 50}, {118,126} },
-        { {138,114}, {128,122}, {161, 86}, {243, -6}, {195,  0}, { 38,210} },
-        { {215, 39}, {179, 58}, { 97,101}, { 95, 85}, { 87, 70}, { 69,152} } },
-    }, {
-      { { {236, 24}, {205, 18}, {172, 12}, {154,  6}, {125,  1}, {169, 75} },
-        { {187,  4}, {230, -2}, {228, -4}, {236, -4}, {241, -2}, {192, 66} },
-        { {200, 46}, {187, 42}, {159, 34}, {136, 25}, {105, 10}, {179, 62} },
-        { {207, 55}, {192, 63}, {192, 54}, {195, 36}, {177,  1}, {143, 98} },
-        { {225, 27}, {207, 34}, {200, 30}, {131, 57}, { 97, 60}, {197, 45} } },
-      { { {271,  8}, {218, 13}, {133, 19}, { 90, 19}, { 72,  7}, {182, 51} },
-        { {179,  1}, {225, -1}, {154, -2}, {110, -1}, { 92,  0}, {195, 41} },
-        { {241, 26}, {189, 40}, { 82, 64}, { 33, 60}, { 67, 17}, {120, 94} },
-        { {192, 68}, {151, 94}, {146, 90}, {143, 72}, {161,  0}, {113,128} },
-        { {256, 12}, {218, 29}, {166, 48}, { 44, 99}, { 31, 87}, {148, 78} } },
-      { { {238, 20}, {184, 22}, {113, 27}, { 90, 22}, { 74,  9}, {192, 37} },
-        { {184,  0}, {215, -1}, {141, -1}, { 97,  0}, { 49,  0}, {264, 13} },
-        { {182, 51}, {138, 61}, { 95, 63}, { 54, 59}, { 64, 25}, {200, 45} },
-        { {179, 75}, {156, 87}, {174, 65}, {177, 44}, {174,  0}, {164, 85} },
-        { {195, 45}, {148, 65}, {105, 79}, { 95, 72}, { 87, 60}, {169, 63} } },
-    }
-};
-
-static const uint8_t vp5_coord_div[] = { 2, 2, 2, 2, 4, 4 };
-
-#endif /* AVCODEC_VP5DATA_H */
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
deleted file mode 100644
index 58c31f9..0000000
--- a/libavcodec/vp6.c
+++ /dev/null
@@ -1,647 +0,0 @@
-/**
- * @file
- * VP6 compatible video decoder
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * The VP6F decoder accepts an optional 1 byte extradata. It is composed of:
- *  - upper 4bits: difference between encoded width and visible width
- *  - lower 4bits: difference between encoded height and visible height
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "get_bits.h"
-#include "huffman.h"
-
-#include "vp56.h"
-#include "vp56data.h"
-#include "vp6data.h"
-
-
-static void vp6_parse_coeff(VP56Context *s);
-static void vp6_parse_coeff_huffman(VP56Context *s);
-
-static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
-                            int *golden_frame)
-{
-    VP56RangeCoder *c = &s->c;
-    int parse_filter_info = 0;
-    int coeff_offset = 0;
-    int vrt_shift = 0;
-    int sub_version;
-    int rows, cols;
-    int res = 1;
-    int separated_coeff = buf[0] & 1;
-
-    s->framep[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80);
-    vp56_init_dequant(s, (buf[0] >> 1) & 0x3F);
-
-    if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
-        sub_version = buf[1] >> 3;
-        if (sub_version > 8)
-            return 0;
-        s->filter_header = buf[1] & 0x06;
-        if (buf[1] & 1) {
-            av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n");
-            return 0;
-        }
-        if (separated_coeff || !s->filter_header) {
-            coeff_offset = AV_RB16(buf+2) - 2;
-            buf += 2;
-            buf_size -= 2;
-        }
-
-        rows = buf[2];  /* number of stored macroblock rows */
-        cols = buf[3];  /* number of stored macroblock cols */
-        /* buf[4] is number of displayed macroblock rows */
-        /* buf[5] is number of displayed macroblock cols */
-
-        if (!s->macroblocks || /* first frame */
-            16*cols != s->avctx->coded_width ||
-            16*rows != s->avctx->coded_height) {
-            avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
-            if (s->avctx->extradata_size == 1) {
-                s->avctx->width  -= s->avctx->extradata[0] >> 4;
-                s->avctx->height -= s->avctx->extradata[0] & 0x0F;
-            }
-            res = 2;
-        }
-
-        vp56_init_range_decoder(c, buf+6, buf_size-6);
-        vp56_rac_gets(c, 2);
-
-        parse_filter_info = s->filter_header;
-        if (sub_version < 8)
-            vrt_shift = 5;
-        s->sub_version = sub_version;
-    } else {
-        if (!s->sub_version)
-            return 0;
-
-        if (separated_coeff || !s->filter_header) {
-            coeff_offset = AV_RB16(buf+1) - 2;
-            buf += 2;
-            buf_size -= 2;
-        }
-        vp56_init_range_decoder(c, buf+1, buf_size-1);
-
-        *golden_frame = vp56_rac_get(c);
-        if (s->filter_header) {
-            s->deblock_filtering = vp56_rac_get(c);
-            if (s->deblock_filtering)
-                vp56_rac_get(c);
-            if (s->sub_version > 7)
-                parse_filter_info = vp56_rac_get(c);
-        }
-    }
-
-    if (parse_filter_info) {
-        if (vp56_rac_get(c)) {
-            s->filter_mode = 2;
-            s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift;
-            s->max_vector_length = 2 << vp56_rac_gets(c, 3);
-        } else if (vp56_rac_get(c)) {
-            s->filter_mode = 1;
-        } else {
-            s->filter_mode = 0;
-        }
-        if (s->sub_version > 7)
-            s->filter_selection = vp56_rac_gets(c, 4);
-        else
-            s->filter_selection = 16;
-    }
-
-    s->use_huffman = vp56_rac_get(c);
-
-    s->parse_coeff = vp6_parse_coeff;
-    if (coeff_offset) {
-        buf      += coeff_offset;
-        buf_size -= coeff_offset;
-        if (buf_size < 0)
-            return 0;
-        if (s->use_huffman) {
-            s->parse_coeff = vp6_parse_coeff_huffman;
-            init_get_bits(&s->gb, buf, buf_size<<3);
-        } else {
-            vp56_init_range_decoder(&s->cc, buf, buf_size);
-            s->ccp = &s->cc;
-        }
-    } else {
-        s->ccp = &s->c;
-    }
-
-    return res;
-}
-
-static void vp6_coeff_order_table_init(VP56Context *s)
-{
-    int i, pos, idx = 1;
-
-    s->modelp->coeff_index_to_pos[0] = 0;
-    for (i=0; i<16; i++)
-        for (pos=1; pos<64; pos++)
-            if (s->modelp->coeff_reorder[pos] == i)
-                s->modelp->coeff_index_to_pos[idx++] = pos;
-}
-
-static void vp6_default_models_init(VP56Context *s)
-{
-    VP56Model *model = s->modelp;
-
-    model->vector_dct[0] = 0xA2;
-    model->vector_dct[1] = 0xA4;
-    model->vector_sig[0] = 0x80;
-    model->vector_sig[1] = 0x80;
-
-    memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
-    memcpy(model->vector_fdv, vp6_def_fdv_vector_model, sizeof(model->vector_fdv));
-    memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv));
-    memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv));
-    memcpy(model->coeff_reorder, vp6_def_coeff_reorder, sizeof(model->coeff_reorder));
-
-    vp6_coeff_order_table_init(s);
-}
-
-static void vp6_parse_vector_models(VP56Context *s)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    int comp, node;
-
-    for (comp=0; comp<2; comp++) {
-        if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][0]))
-            model->vector_dct[comp] = vp56_rac_gets_nn(c, 7);
-        if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][1]))
-            model->vector_sig[comp] = vp56_rac_gets_nn(c, 7);
-    }
-
-    for (comp=0; comp<2; comp++)
-        for (node=0; node<7; node++)
-            if (vp56_rac_get_prob(c, vp6_pdv_pct[comp][node]))
-                model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
-
-    for (comp=0; comp<2; comp++)
-        for (node=0; node<8; node++)
-            if (vp56_rac_get_prob(c, vp6_fdv_pct[comp][node]))
-                model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7);
-}
-
-/* nodes must ascend by count, but with descending symbol order */
-static int vp6_huff_cmp(const void *va, const void *vb)
-{
-    const Node *a = va, *b = vb;
-    return (a->count - b->count)*16 + (b->sym - a->sym);
-}
-
-static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
-                                const uint8_t *map, unsigned size, VLC *vlc)
-{
-    Node nodes[2*size], *tmp = &nodes[size];
-    int a, b, i;
-
-    /* first compute probabilities from model */
-    tmp[0].count = 256;
-    for (i=0; i<size-1; i++) {
-        a = tmp[i].count *        coeff_model[i]  >> 8;
-        b = tmp[i].count * (255 - coeff_model[i]) >> 8;
-        nodes[map[2*i  ]].count = a + !a;
-        nodes[map[2*i+1]].count = b + !b;
-    }
-
-    free_vlc(vlc);
-    /* then build the huffman tree accodring to probabilities */
-    ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp,
-                       FF_HUFFMAN_FLAG_HNODE_FIRST);
-}
-
-static void vp6_parse_coeff_models(VP56Context *s)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    int def_prob[11];
-    int node, cg, ctx, pos;
-    int ct;    /* code type */
-    int pt;    /* plane type (0 for Y, 1 for U or V) */
-
-    memset(def_prob, 0x80, sizeof(def_prob));
-
-    for (pt=0; pt<2; pt++)
-        for (node=0; node<11; node++)
-            if (vp56_rac_get_prob(c, vp6_dccv_pct[pt][node])) {
-                def_prob[node] = vp56_rac_gets_nn(c, 7);
-                model->coeff_dccv[pt][node] = def_prob[node];
-            } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
-                model->coeff_dccv[pt][node] = def_prob[node];
-            }
-
-    if (vp56_rac_get(c)) {
-        for (pos=1; pos<64; pos++)
-            if (vp56_rac_get_prob(c, vp6_coeff_reorder_pct[pos]))
-                model->coeff_reorder[pos] = vp56_rac_gets(c, 4);
-        vp6_coeff_order_table_init(s);
-    }
-
-    for (cg=0; cg<2; cg++)
-        for (node=0; node<14; node++)
-            if (vp56_rac_get_prob(c, vp6_runv_pct[cg][node]))
-                model->coeff_runv[cg][node] = vp56_rac_gets_nn(c, 7);
-
-    for (ct=0; ct<3; ct++)
-        for (pt=0; pt<2; pt++)
-            for (cg=0; cg<6; cg++)
-                for (node=0; node<11; node++)
-                    if (vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node])) {
-                        def_prob[node] = vp56_rac_gets_nn(c, 7);
-                        model->coeff_ract[pt][ct][cg][node] = def_prob[node];
-                    } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) {
-                        model->coeff_ract[pt][ct][cg][node] = def_prob[node];
-                    }
-
-    if (s->use_huffman) {
-        for (pt=0; pt<2; pt++) {
-            vp6_build_huff_tree(s, model->coeff_dccv[pt],
-                                vp6_huff_coeff_map, 12, &s->dccv_vlc[pt]);
-            vp6_build_huff_tree(s, model->coeff_runv[pt],
-                                vp6_huff_run_map, 9, &s->runv_vlc[pt]);
-            for (ct=0; ct<3; ct++)
-                for (cg = 0; cg < 6; cg++)
-                    vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg],
-                                        vp6_huff_coeff_map, 12,
-                                        &s->ract_vlc[pt][ct][cg]);
-        }
-        memset(s->nb_null, 0, sizeof(s->nb_null));
-    } else {
-    /* coeff_dcct is a linear combination of coeff_dccv */
-    for (pt=0; pt<2; pt++)
-        for (ctx=0; ctx<3; ctx++)
-            for (node=0; node<5; node++)
-                model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255);
-    }
-}
-
-static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
-{
-    VP56RangeCoder *c = &s->c;
-    VP56Model *model = s->modelp;
-    int comp;
-
-    *vect = (VP56mv) {0,0};
-    if (s->vector_candidate_pos < 2)
-        *vect = s->vector_candidate[0];
-
-    for (comp=0; comp<2; comp++) {
-        int i, delta = 0;
-
-        if (vp56_rac_get_prob(c, model->vector_dct[comp])) {
-            static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4};
-            for (i=0; i<sizeof(prob_order); i++) {
-                int j = prob_order[i];
-                delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][j])<<j;
-            }
-            if (delta & 0xF0)
-                delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][3])<<3;
-            else
-                delta |= 8;
-        } else {
-            delta = vp56_rac_get_tree(c, vp56_pva_tree,
-                                      model->vector_pdv[comp]);
-        }
-
-        if (delta && vp56_rac_get_prob(c, model->vector_sig[comp]))
-            delta = -delta;
-
-        if (!comp)
-            vect->x += delta;
-        else
-            vect->y += delta;
-    }
-}
-
-/**
- * Read number of consecutive blocks with null DC or AC.
- * This value is < 74.
- */
-static unsigned vp6_get_nb_null(VP56Context *s)
-{
-    unsigned val = get_bits(&s->gb, 2);
-    if (val == 2)
-        val += get_bits(&s->gb, 2);
-    else if (val == 3) {
-        val = get_bits1(&s->gb) << 2;
-        val = 6+val + get_bits(&s->gb, 2+val);
-    }
-    return val;
-}
-
-static void vp6_parse_coeff_huffman(VP56Context *s)
-{
-    VP56Model *model = s->modelp;
-    uint8_t *permute = s->scantable.permutated;
-    VLC *vlc_coeff;
-    int coeff, sign, coeff_idx;
-    int b, cg, idx;
-    int pt = 0;    /* plane type (0 for Y, 1 for U or V) */
-
-    for (b=0; b<6; b++) {
-        int ct = 0;    /* code type */
-        if (b > 3) pt = 1;
-        vlc_coeff = &s->dccv_vlc[pt];
-
-        for (coeff_idx=0; coeff_idx<64; ) {
-            int run = 1;
-            if (coeff_idx<2 && s->nb_null[coeff_idx][pt]) {
-                s->nb_null[coeff_idx][pt]--;
-                if (coeff_idx)
-                    break;
-            } else {
-                if (get_bits_count(&s->gb) >= s->gb.size_in_bits)
-                    return;
-                coeff = get_vlc2(&s->gb, vlc_coeff->table, 9, 3);
-                if (coeff == 0) {
-                    if (coeff_idx) {
-                        int pt = (coeff_idx >= 6);
-                        run += get_vlc2(&s->gb, s->runv_vlc[pt].table, 9, 3);
-                        if (run >= 9)
-                            run += get_bits(&s->gb, 6);
-                    } else
-                        s->nb_null[0][pt] = vp6_get_nb_null(s);
-                    ct = 0;
-                } else if (coeff == 11) {  /* end of block */
-                    if (coeff_idx == 1)    /* first AC coeff ? */
-                        s->nb_null[1][pt] = vp6_get_nb_null(s);
-                    break;
-                } else {
-                    int coeff2 = vp56_coeff_bias[coeff];
-                    if (coeff > 4)
-                        coeff2 += get_bits(&s->gb, coeff <= 9 ? coeff - 4 : 11);
-                    ct = 1 + (coeff2 > 1);
-                    sign = get_bits1(&s->gb);
-                    coeff2 = (coeff2 ^ -sign) + sign;
-                    if (coeff_idx)
-                        coeff2 *= s->dequant_ac;
-                    idx = model->coeff_index_to_pos[coeff_idx];
-                    s->block_coeff[b][permute[idx]] = coeff2;
-                }
-            }
-            coeff_idx+=run;
-            cg = FFMIN(vp6_coeff_groups[coeff_idx], 3);
-            vlc_coeff = &s->ract_vlc[pt][ct][cg];
-        }
-    }
-}
-
-static void vp6_parse_coeff(VP56Context *s)
-{
-    VP56RangeCoder *c = s->ccp;
-    VP56Model *model = s->modelp;
-    uint8_t *permute = s->scantable.permutated;
-    uint8_t *model1, *model2, *model3;
-    int coeff, sign, coeff_idx;
-    int b, i, cg, idx, ctx;
-    int pt = 0;    /* plane type (0 for Y, 1 for U or V) */
-
-    for (b=0; b<6; b++) {
-        int ct = 1;    /* code type */
-        int run = 1;
-
-        if (b > 3) pt = 1;
-
-        ctx = s->left_block[vp56_b6to4[b]].not_null_dc
-              + s->above_blocks[s->above_block_idx[b]].not_null_dc;
-        model1 = model->coeff_dccv[pt];
-        model2 = model->coeff_dcct[pt][ctx];
-
-        for (coeff_idx=0; coeff_idx<64; ) {
-            if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) {
-                /* parse a coeff */
-                if (vp56_rac_get_prob(c, model2[2])) {
-                    if (vp56_rac_get_prob(c, model2[3])) {
-                        idx = vp56_rac_get_tree(c, vp56_pc_tree, model1);
-                        coeff = vp56_coeff_bias[idx+5];
-                        for (i=vp56_coeff_bit_length[idx]; i>=0; i--)
-                            coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i;
-                    } else {
-                        if (vp56_rac_get_prob(c, model2[4]))
-                            coeff = 3 + vp56_rac_get_prob(c, model1[5]);
-                        else
-                            coeff = 2;
-                    }
-                    ct = 2;
-                } else {
-                    ct = 1;
-                    coeff = 1;
-                }
-                sign = vp56_rac_get(c);
-                coeff = (coeff ^ -sign) + sign;
-                if (coeff_idx)
-                    coeff *= s->dequant_ac;
-                idx = model->coeff_index_to_pos[coeff_idx];
-                s->block_coeff[b][permute[idx]] = coeff;
-                run = 1;
-            } else {
-                /* parse a run */
-                ct = 0;
-                if (coeff_idx > 0) {
-                    if (!vp56_rac_get_prob(c, model2[1]))
-                        break;
-
-                    model3 = model->coeff_runv[coeff_idx >= 6];
-                    run = vp56_rac_get_tree(c, vp6_pcr_tree, model3);
-                    if (!run)
-                        for (run=9, i=0; i<6; i++)
-                            run += vp56_rac_get_prob(c, model3[i+8]) << i;
-                }
-            }
-
-            cg = vp6_coeff_groups[coeff_idx+=run];
-            model1 = model2 = model->coeff_ract[pt][ct][cg];
-        }
-
-        s->left_block[vp56_b6to4[b]].not_null_dc =
-        s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0];
-    }
-}
-
-static int vp6_block_variance(uint8_t *src, int stride)
-{
-    int sum = 0, square_sum = 0;
-    int y, x;
-
-    for (y=0; y<8; y+=2) {
-        for (x=0; x<8; x+=2) {
-            sum += src[x];
-            square_sum += src[x]*src[x];
-        }
-        src += 2*stride;
-    }
-    return (16*square_sum - sum*sum) >> 8;
-}
-
-static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride,
-                           int delta, const int16_t *weights)
-{
-    int x, y;
-
-    for (y=0; y<8; y++) {
-        for (x=0; x<8; x++) {
-            dst[x] = av_clip_uint8((  src[x-delta  ] * weights[0]
-                                 + src[x        ] * weights[1]
-                                 + src[x+delta  ] * weights[2]
-                                 + src[x+2*delta] * weights[3] + 64) >> 7);
-        }
-        src += stride;
-        dst += stride;
-    }
-}
-
-static void vp6_filter_diag2(VP56Context *s, uint8_t *dst, uint8_t *src,
-                             int stride, int h_weight, int v_weight)
-{
-    uint8_t *tmp = s->edge_emu_buffer+16;
-    s->dsp.put_h264_chroma_pixels_tab[0](tmp, src, stride, 9, h_weight, 0);
-    s->dsp.put_h264_chroma_pixels_tab[0](dst, tmp, stride, 8, 0, v_weight);
-}
-
-static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src,
-                       int offset1, int offset2, int stride,
-                       VP56mv mv, int mask, int select, int luma)
-{
-    int filter4 = 0;
-    int x8 = mv.x & mask;
-    int y8 = mv.y & mask;
-
-    if (luma) {
-        x8 *= 2;
-        y8 *= 2;
-        filter4 = s->filter_mode;
-        if (filter4 == 2) {
-            if (s->max_vector_length &&
-                (FFABS(mv.x) > s->max_vector_length ||
-                 FFABS(mv.y) > s->max_vector_length)) {
-                filter4 = 0;
-            } else if (s->sample_variance_threshold
-                       && (vp6_block_variance(src+offset1, stride)
-                           < s->sample_variance_threshold)) {
-                filter4 = 0;
-            }
-        }
-    }
-
-    if ((y8 && (offset2-offset1)*s->flip<0) || (!y8 && offset1 > offset2)) {
-        offset1 = offset2;
-    }
-
-    if (filter4) {
-        if (!y8) {                      /* left or right combine */
-            vp6_filter_hv4(dst, src+offset1, stride, 1,
-                           vp6_block_copy_filter[select][x8]);
-        } else if (!x8) {               /* above or below combine */
-            vp6_filter_hv4(dst, src+offset1, stride, stride,
-                           vp6_block_copy_filter[select][y8]);
-        } else {
-            s->dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride,
-                             vp6_block_copy_filter[select][x8],
-                             vp6_block_copy_filter[select][y8]);
-        }
-    } else {
-        if (!x8 || !y8) {
-            s->dsp.put_h264_chroma_pixels_tab[0](dst, src+offset1, stride, 8, x8, y8);
-        } else {
-            vp6_filter_diag2(s, dst, src+offset1 + ((mv.x^mv.y)>>31), stride, x8, y8);
-        }
-    }
-}
-
-static av_cold int vp6_decode_init(AVCodecContext *avctx)
-{
-    VP56Context *s = avctx->priv_data;
-
-    vp56_init(avctx, avctx->codec->id == CODEC_ID_VP6,
-                     avctx->codec->id == CODEC_ID_VP6A);
-    s->vp56_coord_div = vp6_coord_div;
-    s->parse_vector_adjustment = vp6_parse_vector_adjustment;
-    s->filter = vp6_filter;
-    s->default_models_init = vp6_default_models_init;
-    s->parse_vector_models = vp6_parse_vector_models;
-    s->parse_coeff_models = vp6_parse_coeff_models;
-    s->parse_header = vp6_parse_header;
-
-    return 0;
-}
-
-static av_cold int vp6_decode_free(AVCodecContext *avctx)
-{
-    VP56Context *s = avctx->priv_data;
-    int pt, ct, cg;
-
-    vp56_free(avctx);
-
-    for (pt=0; pt<2; pt++) {
-        free_vlc(&s->dccv_vlc[pt]);
-        free_vlc(&s->runv_vlc[pt]);
-        for (ct=0; ct<3; ct++)
-            for (cg=0; cg<6; cg++)
-                free_vlc(&s->ract_vlc[pt][ct][cg]);
-    }
-    return 0;
-}
-
-AVCodec vp6_decoder = {
-    "vp6",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VP6,
-    sizeof(VP56Context),
-    vp6_decode_init,
-    NULL,
-    vp6_decode_free,
-    vp56_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"),
-};
-
-/* flash version, not flipped upside-down */
-AVCodec vp6f_decoder = {
-    "vp6f",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VP6F,
-    sizeof(VP56Context),
-    vp6_decode_init,
-    NULL,
-    vp6_decode_free,
-    vp56_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"),
-};
-
-/* flash version, not flipped upside-down, with alpha channel */
-AVCodec vp6a_decoder = {
-    "vp6a",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VP6A,
-    sizeof(VP56Context),
-    vp6_decode_init,
-    NULL,
-    vp6_decode_free,
-    vp56_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"),
-};
diff --git a/libavcodec/vp6data.h b/libavcodec/vp6data.h
deleted file mode 100644
index 1cfdbe7..0000000
--- a/libavcodec/vp6data.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/**
- * @file
- * VP6 compatible video decoder
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_VP6DATA_H
-#define AVCODEC_VP6DATA_H
-
-#include "vp56data.h"
-
-static const uint8_t vp6_def_fdv_vector_model[2][8] = {
-    { 247, 210, 135, 68, 138, 220, 239, 246 },
-    { 244, 184, 201, 44, 173, 221, 239, 253 },
-};
-
-static const uint8_t vp6_def_pdv_vector_model[2][7] = {
-    { 225, 146, 172, 147, 214,  39, 156 },
-    { 204, 170, 119, 235, 140, 230, 228 },
-};
-
-static const uint8_t vp6_def_coeff_reorder[] = {
-     0,  0,  1,  1,  1,  2,  2,  2,
-     2,  2,  2,  3,  3,  4,  4,  4,
-     5,  5,  5,  5,  6,  6,  7,  7,
-     7,  7,  7,  8,  8,  9,  9,  9,
-     9,  9,  9, 10, 10, 11, 11, 11,
-    11, 11, 11, 12, 12, 12, 12, 12,
-    12, 13, 13, 13, 13, 13, 14, 14,
-    14, 14, 15, 15, 15, 15, 15, 15,
-};
-
-static const uint8_t vp6_def_runv_coeff_model[2][14] = {
-    { 198, 197, 196, 146, 198, 204, 169, 142, 130, 136, 149, 149, 191, 249 },
-    { 135, 201, 181, 154,  98, 117, 132, 126, 146, 169, 184, 240, 246, 254 },
-};
-
-static const uint8_t vp6_sig_dct_pct[2][2] = {
-    { 237, 246 },
-    { 231, 243 },
-};
-
-static const uint8_t vp6_pdv_pct[2][7] = {
-    { 253, 253, 254, 254, 254, 254, 254 },
-    { 245, 253, 254, 254, 254, 254, 254 },
-};
-
-static const uint8_t vp6_fdv_pct[2][8] = {
-    { 254, 254, 254, 254, 254, 250, 250, 252 },
-    { 254, 254, 254, 254, 254, 251, 251, 254 },
-};
-
-static const uint8_t vp6_dccv_pct[2][11] = {
-    { 146, 255, 181, 207, 232, 243, 238, 251, 244, 250, 249 },
-    { 179, 255, 214, 240, 250, 255, 244, 255, 255, 255, 255 },
-};
-
-static const uint8_t vp6_coeff_reorder_pct[] =  {
-    255, 132, 132, 159, 153, 151, 161, 170,
-    164, 162, 136, 110, 103, 114, 129, 118,
-    124, 125, 132, 136, 114, 110, 142, 135,
-    134, 123, 143, 126, 153, 183, 166, 161,
-    171, 180, 179, 164, 203, 218, 225, 217,
-    215, 206, 203, 217, 229, 241, 248, 243,
-    253, 255, 253, 255, 255, 255, 255, 255,
-    255, 255, 255, 255, 255, 255, 255, 255,
-};
-
-static const uint8_t vp6_runv_pct[2][14] = {
-  { 219, 246, 238, 249, 232, 239, 249, 255, 248, 253, 239, 244, 241, 248 },
-  { 198, 232, 251, 253, 219, 241, 253, 255, 248, 249, 244, 238, 251, 255 },
-};
-
-static const uint8_t vp6_ract_pct[3][2][6][11] = {
-  { { { 227, 246, 230, 247, 244, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 209, 231, 231, 249, 249, 253, 255, 255, 255 },
-      { 255, 255, 225, 242, 241, 251, 253, 255, 255, 255, 255 },
-      { 255, 255, 241, 253, 252, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
-    { { 240, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 240, 253, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } },
-  { { { 206, 203, 227, 239, 247, 255, 253, 255, 255, 255, 255 },
-      { 207, 199, 220, 236, 243, 252, 252, 255, 255, 255, 255 },
-      { 212, 219, 230, 243, 244, 253, 252, 255, 255, 255, 255 },
-      { 236, 237, 247, 252, 253, 255, 255, 255, 255, 255, 255 },
-      { 240, 240, 248, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
-    { { 230, 233, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 238, 238, 250, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 248, 251, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } },
-  { { { 225, 239, 227, 231, 244, 253, 243, 255, 255, 253, 255 },
-      { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 255 },
-      { 235, 249, 238, 240, 251, 255, 249, 255, 253, 253, 255 },
-      { 249, 253, 251, 250, 255, 255, 255, 255, 255, 255, 255 },
-      { 251, 250, 249, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } },
-    { { 243, 244, 250, 250, 255, 255, 255, 255, 255, 255, 255 },
-      { 249, 248, 250, 253, 255, 255, 255, 255, 255, 255, 255 },
-      { 253, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 },
-      { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 } } }
-};
-
-static const int vp6_dccv_lc[3][5][2] = {
-  { { 122, 133 }, { 0, 1 }, { 78,  171 }, { 139, 117 }, { 168, 79 } },
-  { { 133,  51 }, { 0, 1 }, { 169,  71 }, { 214,  44 }, { 210, 38 } },
-  { { 142, -16 }, { 0, 1 }, { 221, -30 }, { 246,  -3 }, { 203, 17 } },
-};
-
-static const uint8_t vp6_coeff_groups[] = {
-    0, 0, 1, 1, 1, 2, 2, 2,
-    2, 2, 2, 3, 3, 3, 3, 3,
-    3, 3, 3, 3, 3, 3, 4, 4,
-    4, 4, 4, 4, 4, 4, 4, 4,
-    4, 4, 4, 4, 4, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5,
-    5, 5, 5, 5, 5, 5, 5, 5,
-};
-
-static const int16_t vp6_block_copy_filter[17][8][4] = {
-  { {   0, 128,   0,   0  },  /* 0 */
-    {  -3, 122,   9,   0  },
-    {  -4, 109,  24,  -1  },
-    {  -5,  91,  45,  -3  },
-    {  -4,  68,  68,  -4  },
-    {  -3,  45,  91,  -5  },
-    {  -1,  24, 109,  -4  },
-    {   0,   9, 122,  -3  } },
-  { {   0, 128,   0,   0  },  /* 1 */
-    {  -4, 124,   9,  -1  },
-    {  -5, 110,  25,  -2  },
-    {  -6,  91,  46,  -3  },
-    {  -5,  69,  69,  -5  },
-    {  -3,  46,  91,  -6  },
-    {  -2,  25, 110,  -5  },
-    {  -1,   9, 124,  -4  } },
-  { {   0, 128,   0,   0  },  /* 2 */
-    {  -4, 123,  10,  -1  },
-    {  -6, 110,  26,  -2  },
-    {  -7,  92,  47,  -4  },
-    {  -6,  70,  70,  -6  },
-    {  -4,  47,  92,  -7  },
-    {  -2,  26, 110,  -6  },
-    {  -1,  10, 123,  -4  } },
-  { {   0, 128,   0,   0  },  /* 3 */
-    {  -5, 124,  10,  -1  },
-    {  -7, 110,  27,  -2  },
-    {  -7,  91,  48,  -4  },
-    {  -6,  70,  70,  -6  },
-    {  -4,  48,  92,  -8  },
-    {  -2,  27, 110,  -7  },
-    {  -1,  10, 124,  -5  } },
-  { {   0, 128,   0,   0  },  /* 4 */
-    {  -6, 124,  11,  -1  },
-    {  -8, 111,  28,  -3  },
-    {  -8,  92,  49,  -5  },
-    {  -7,  71,  71,  -7  },
-    {  -5,  49,  92,  -8  },
-    {  -3,  28, 111,  -8  },
-    {  -1,  11, 124,  -6  } },
-  { {  0,  128,   0,   0  },  /* 5 */
-    {  -6, 123,  12,  -1  },
-    {  -9, 111,  29,  -3  },
-    {  -9,  93,  50,  -6  },
-    {  -8,  72,  72,  -8  },
-    {  -6,  50,  93,  -9  },
-    {  -3,  29, 111,  -9  },
-    {  -1,  12, 123,  -6  } },
-  { {   0, 128,   0,   0  },  /* 6 */
-    {  -7, 124,  12,  -1  },
-    { -10, 111,  30,  -3  },
-    { -10,  93,  51,  -6  },
-    {  -9,  73,  73,  -9  },
-    {  -6,  51,  93, -10  },
-    {  -3,  30, 111, -10  },
-    {  -1,  12, 124,  -7  } },
-  { {   0, 128,   0,   0  },  /* 7 */
-    {  -7, 123,  13,  -1  },
-    { -11, 112,  31,  -4  },
-    { -11,  94,  52,  -7  },
-    { -10,  74,  74, -10  },
-    {  -7,  52,  94, -11  },
-    {  -4,  31, 112, -11  },
-    {  -1,  13, 123,  -7  } },
-  { {   0, 128,   0,  0  },  /* 8 */
-    {  -8, 124,  13,  -1  },
-    { -12, 112,  32,  -4  },
-    { -12,  94,  53,  -7  },
-    { -10,  74,  74, -10  },
-    {  -7,  53,  94, -12  },
-    {  -4,  32, 112, -12  },
-    {  -1,  13, 124,  -8  } },
-  { {   0, 128,   0,   0  },  /* 9 */
-    {  -9, 124,  14,  -1  },
-    { -13, 112,  33,  -4  },
-    { -13,  95,  54,  -8  },
-    { -11,  75,  75, -11  },
-    {  -8,  54,  95, -13  },
-    {  -4,  33, 112, -13  },
-    {  -1,  14, 124,  -9  } },
-  { {   0, 128,   0,   0  },  /* 10 */
-    {  -9, 123,  15,  -1  },
-    { -14, 113,  34,  -5  },
-    { -14,  95,  55,  -8  },
-    { -12,  76,  76, -12  },
-    {  -8,  55,  95, -14  },
-    {  -5,  34, 112, -13  },
-    {  -1,  15, 123,  -9  } },
-  { {   0, 128,   0,   0  },  /* 11 */
-    { -10, 124,  15,  -1  },
-    { -14, 113,  34,  -5  },
-    { -15,  96,  56,  -9  },
-    { -13,  77,  77, -13  },
-    {  -9,  56,  96, -15  },
-    {  -5,  34, 113, -14  },
-    {  -1,  15, 124, -10  } },
-  { {   0, 128,   0,   0  },  /* 12 */
-    { -10, 123,  16,  -1  },
-    { -15, 113,  35,  -5  },
-    { -16,  98,  56, -10  },
-    { -14,  78,  78, -14  },
-    { -10,  56,  98, -16  },
-    {  -5,  35, 113, -15  },
-    {  -1,  16, 123, -10  } },
-  { {   0, 128,   0,   0  },  /* 13 */
-    { -11, 124,  17,  -2  },
-    { -16, 113,  36,  -5  },
-    { -17,  98,  57, -10  },
-    { -14,  78,  78, -14  },
-    { -10,  57,  98, -17  },
-    {  -5,  36, 113, -16  },
-    {  -2,  17, 124, -11  } },
-  { {   0, 128,   0,   0  },  /* 14 */
-    { -12, 125,  17,  -2  },
-    { -17, 114,  37,  -6  },
-    { -18,  99,  58, -11  },
-    { -15,  79,  79, -15  },
-    { -11,  58,  99, -18  },
-    {  -6,  37, 114, -17  },
-    {  -2,  17, 125, -12  } },
-  { {   0, 128,   0,   0  },  /* 15 */
-    { -12, 124,  18,  -2  },
-    { -18, 114,  38,  -6  },
-    { -19,  99,  59, -11  },
-    { -16,  80,  80, -16  },
-    { -11,  59,  99, -19  },
-    {  -6,  38, 114, -18  },
-    {  -2,  18, 124, -12  } },
-  { {   0, 128,   0,   0  },  /* 16 */
-    {  -4, 118,  16,  -2  },
-    {  -7, 106,  34,  -5  },
-    {  -8,  90,  53,  -7  },
-    {  -8,  72,  72,  -8  },
-    {  -7,  53,  90,  -8  },
-    {  -5,  34, 106,  -7  },
-    {  -2,  16, 118,  -4  } },
-};
-
-static const VP56Tree vp6_pcr_tree[] = {
-    { 8, 0},
-    { 4, 1},
-    { 2, 2}, {-1}, {-2},
-    { 2, 3}, {-3}, {-4},
-    { 8, 4},
-    { 4, 5},
-    { 2, 6}, {-5}, {-6},
-    { 2, 7}, {-7}, {-8},
-             {-0},
-};
-
-static const uint8_t vp6_coord_div[] = { 4, 4, 4, 4, 8, 8 };
-
-static const uint8_t vp6_huff_coeff_map[] = {
-    13, 14, 11, 0, 1, 15, 16, 18, 2, 17, 3, 4, 19, 20, 5, 6, 21, 22, 7, 8, 9, 10
-};
-
-static const uint8_t vp6_huff_run_map[] = {
-    10, 13, 11, 12, 0, 1, 2, 3, 14, 8, 15, 16, 4, 5, 6, 7
-};
-
-#endif /* AVCODEC_VP6DATA_H */
diff --git a/libavcodec/vp6dsp.c b/libavcodec/vp6dsp.c
deleted file mode 100644
index 69a11ee..0000000
--- a/libavcodec/vp6dsp.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file
- * VP6 DSP-oriented functions
- *
- * Copyright (C) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "dsputil.h"
-
-
-void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
-                           const int16_t *h_weights, const int16_t *v_weights)
-{
-    int x, y;
-    int tmp[8*11];
-    int *t = tmp;
-
-    src -= stride;
-
-    for (y=0; y<11; y++) {
-        for (x=0; x<8; x++) {
-            t[x] = av_clip_uint8((  src[x-1] * h_weights[0]
-                               + src[x  ] * h_weights[1]
-                               + src[x+1] * h_weights[2]
-                               + src[x+2] * h_weights[3] + 64) >> 7);
-        }
-        src += stride;
-        t += 8;
-    }
-
-    t = tmp + 8;
-    for (y=0; y<8; y++) {
-        for (x=0; x<8; x++) {
-            dst[x] = av_clip_uint8((  t[x-8 ] * v_weights[0]
-                                 + t[x   ] * v_weights[1]
-                                 + t[x+8 ] * v_weights[2]
-                                 + t[x+16] * v_weights[3] + 64) >> 7);
-        }
-        dst += stride;
-        t += 8;
-    }
-}
diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
deleted file mode 100644
index a169839..0000000
--- a/libavcodec/vqavideo.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
- * Westwood Studios VQA Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VQA Video Decoder by Mike Melanson (melanson at pcisys.net)
- * For more information about the VQA format, visit:
- *   http://wiki.multimedia.cx/index.php?title=VQA
- *
- * The VQA video decoder outputs PAL8 or RGB555 colorspace data, depending
- * on the type of data in the file.
- *
- * This decoder needs the 42-byte VQHD header from the beginning
- * of the VQA file passed through the extradata field. The VQHD header
- * is laid out as:
- *
- *   bytes 0-3   chunk fourcc: 'VQHD'
- *   bytes 4-7   chunk size in big-endian format, should be 0x0000002A
- *   bytes 8-49  VQHD chunk data
- *
- * Bytes 8-49 are what this decoder expects to see.
- *
- * Briefly, VQA is a vector quantized animation format that operates in a
- * VGA palettized colorspace. It operates on pixel vectors (blocks)
- * of either 4x2 or 4x4 in size. Compressed VQA chunks can contain vector
- * codebooks, palette information, and code maps for rendering vectors onto
- * frames. Any of these components can also be compressed with a run-length
- * encoding (RLE) algorithm commonly referred to as "format80".
- *
- * VQA takes a novel approach to rate control. Each group of n frames
- * (usually, n = 8) relies on a different vector codebook. Rather than
- * transporting an entire codebook every 8th frame, the new codebook is
- * broken up into 8 pieces and sent along with the compressed video chunks
- * for each of the 8 frames preceding the 8 frames which require the
- * codebook. A full codebook is also sent on the very first frame of a
- * file. This is an interesting technique, although it makes random file
- * seeking difficult despite the fact that the frames are all intracoded.
- *
- * V1,2 VQA uses 12-bit codebook indexes. If the 12-bit indexes were
- * packed into bytes and then RLE compressed, bytewise, the results would
- * be poor. That is why the coding method divides each index into 2 parts,
- * the top 4 bits and the bottom 8 bits, then RL encodes the 4-bit pieces
- * together and the 8-bit pieces together. If most of the vectors are
- * clustered into one group of 256 vectors, most of the 4-bit index pieces
- * should be the same.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#define PALETTE_COUNT 256
-#define VQA_HEADER_SIZE 0x2A
-#define CHUNK_PREAMBLE_SIZE 8
-
-/* allocate the maximum vector space, regardless of the file version:
- * (0xFF00 codebook vectors + 0x100 solid pixel vectors) * (4x4 pixels/block) */
-#define MAX_CODEBOOK_VECTORS 0xFF00
-#define SOLID_PIXEL_VECTORS 0x100
-#define MAX_VECTORS (MAX_CODEBOOK_VECTORS + SOLID_PIXEL_VECTORS)
-#define MAX_CODEBOOK_SIZE (MAX_VECTORS * 4 * 4)
-
-#define CBF0_TAG MKBETAG('C', 'B', 'F', '0')
-#define CBFZ_TAG MKBETAG('C', 'B', 'F', 'Z')
-#define CBP0_TAG MKBETAG('C', 'B', 'P', '0')
-#define CBPZ_TAG MKBETAG('C', 'B', 'P', 'Z')
-#define CPL0_TAG MKBETAG('C', 'P', 'L', '0')
-#define CPLZ_TAG MKBETAG('C', 'P', 'L', 'Z')
-#define VPTZ_TAG MKBETAG('V', 'P', 'T', 'Z')
-
-#define VQA_DEBUG 0
-
-#if VQA_DEBUG
-#define vqa_debug printf
-#else
-static inline void vqa_debug(const char *format, ...) { }
-#endif
-
-typedef struct VqaContext {
-
-    AVCodecContext *avctx;
-    AVFrame frame;
-
-    const unsigned char *buf;
-    int size;
-
-    uint32_t palette[PALETTE_COUNT];
-
-    int width;   /* width of a frame */
-    int height;   /* height of a frame */
-    int vector_width;  /* width of individual vector */
-    int vector_height;  /* height of individual vector */
-    int vqa_version;  /* this should be either 1, 2 or 3 */
-
-    unsigned char *codebook;         /* the current codebook */
-    int codebook_size;
-    unsigned char *next_codebook_buffer;  /* accumulator for next codebook */
-    int next_codebook_buffer_index;
-
-    unsigned char *decode_buffer;
-    int decode_buffer_size;
-
-    /* number of frames to go before replacing codebook */
-    int partial_countdown;
-    int partial_count;
-
-} VqaContext;
-
-static av_cold int vqa_decode_init(AVCodecContext *avctx)
-{
-    VqaContext *s = avctx->priv_data;
-    unsigned char *vqa_header;
-    int i, j, codebook_index;
-
-    s->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    /* make sure the extradata made it */
-    if (s->avctx->extradata_size != VQA_HEADER_SIZE) {
-        av_log(s->avctx, AV_LOG_ERROR, "  VQA video: expected extradata size of %d\n", VQA_HEADER_SIZE);
-        return -1;
-    }
-
-    /* load up the VQA parameters from the header */
-    vqa_header = (unsigned char *)s->avctx->extradata;
-    s->vqa_version = vqa_header[0];
-    s->width = AV_RL16(&vqa_header[6]);
-    s->height = AV_RL16(&vqa_header[8]);
-    if(avcodec_check_dimensions(avctx, s->width, s->height)){
-        s->width= s->height= 0;
-        return -1;
-    }
-    s->vector_width = vqa_header[10];
-    s->vector_height = vqa_header[11];
-    s->partial_count = s->partial_countdown = vqa_header[13];
-
-    /* the vector dimensions have to meet very stringent requirements */
-    if ((s->vector_width != 4) ||
-        ((s->vector_height != 2) && (s->vector_height != 4))) {
-        /* return without further initialization */
-        return -1;
-    }
-
-    /* allocate codebooks */
-    s->codebook_size = MAX_CODEBOOK_SIZE;
-    s->codebook = av_malloc(s->codebook_size);
-    s->next_codebook_buffer = av_malloc(s->codebook_size);
-
-    /* initialize the solid-color vectors */
-    if (s->vector_height == 4) {
-        codebook_index = 0xFF00 * 16;
-        for (i = 0; i < 256; i++)
-            for (j = 0; j < 16; j++)
-                s->codebook[codebook_index++] = i;
-    } else {
-        codebook_index = 0xF00 * 8;
-        for (i = 0; i < 256; i++)
-            for (j = 0; j < 8; j++)
-                s->codebook[codebook_index++] = i;
-    }
-    s->next_codebook_buffer_index = 0;
-
-    /* allocate decode buffer */
-    s->decode_buffer_size = (s->width / s->vector_width) *
-        (s->height / s->vector_height) * 2;
-    s->decode_buffer = av_malloc(s->decode_buffer_size);
-
-    s->frame.data[0] = NULL;
-
-    return 0;
-}
-
-#define CHECK_COUNT() \
-    if (dest_index + count > dest_size) { \
-        av_log(NULL, AV_LOG_ERROR, "  VQA video: decode_format80 problem: next op would overflow dest_index\n"); \
-        av_log(NULL, AV_LOG_ERROR, "  VQA video: current dest_index = %d, count = %d, dest_size = %d\n", \
-            dest_index, count, dest_size); \
-        return; \
-    }
-
-static void decode_format80(const unsigned char *src, int src_size,
-    unsigned char *dest, int dest_size, int check_size) {
-
-    int src_index = 0;
-    int dest_index = 0;
-    int count;
-    int src_pos;
-    unsigned char color;
-    int i;
-
-    while (src_index < src_size) {
-
-        vqa_debug("      opcode %02X: ", src[src_index]);
-
-        /* 0x80 means that frame is finished */
-        if (src[src_index] == 0x80)
-            return;
-
-        if (dest_index >= dest_size) {
-            av_log(NULL, AV_LOG_ERROR, "  VQA video: decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n",
-                dest_index, dest_size);
-            return;
-        }
-
-        if (src[src_index] == 0xFF) {
-
-            src_index++;
-            count = AV_RL16(&src[src_index]);
-            src_index += 2;
-            src_pos = AV_RL16(&src[src_index]);
-            src_index += 2;
-            vqa_debug("(1) copy %X bytes from absolute pos %X\n", count, src_pos);
-            CHECK_COUNT();
-            for (i = 0; i < count; i++)
-                dest[dest_index + i] = dest[src_pos + i];
-            dest_index += count;
-
-        } else if (src[src_index] == 0xFE) {
-
-            src_index++;
-            count = AV_RL16(&src[src_index]);
-            src_index += 2;
-            color = src[src_index++];
-            vqa_debug("(2) set %X bytes to %02X\n", count, color);
-            CHECK_COUNT();
-            memset(&dest[dest_index], color, count);
-            dest_index += count;
-
-        } else if ((src[src_index] & 0xC0) == 0xC0) {
-
-            count = (src[src_index++] & 0x3F) + 3;
-            src_pos = AV_RL16(&src[src_index]);
-            src_index += 2;
-            vqa_debug("(3) copy %X bytes from absolute pos %X\n", count, src_pos);
-            CHECK_COUNT();
-            for (i = 0; i < count; i++)
-                dest[dest_index + i] = dest[src_pos + i];
-            dest_index += count;
-
-        } else if (src[src_index] > 0x80) {
-
-            count = src[src_index++] & 0x3F;
-            vqa_debug("(4) copy %X bytes from source to dest\n", count);
-            CHECK_COUNT();
-            memcpy(&dest[dest_index], &src[src_index], count);
-            src_index += count;
-            dest_index += count;
-
-        } else {
-
-            count = ((src[src_index] & 0x70) >> 4) + 3;
-            src_pos = AV_RB16(&src[src_index]) & 0x0FFF;
-            src_index += 2;
-            vqa_debug("(5) copy %X bytes from relpos %X\n", count, src_pos);
-            CHECK_COUNT();
-            for (i = 0; i < count; i++)
-                dest[dest_index + i] = dest[dest_index - src_pos + i];
-            dest_index += count;
-        }
-    }
-
-    /* validate that the entire destination buffer was filled; this is
-     * important for decoding frame maps since each vector needs to have a
-     * codebook entry; it is not important for compressed codebooks because
-     * not every entry needs to be filled */
-    if (check_size)
-        if (dest_index < dest_size)
-            av_log(NULL, AV_LOG_ERROR, "  VQA video: decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n",
-                dest_index, dest_size);
-}
-
-static void vqa_decode_chunk(VqaContext *s)
-{
-    unsigned int chunk_type;
-    unsigned int chunk_size;
-    int byte_skip;
-    unsigned int index = 0;
-    int i;
-    unsigned char r, g, b;
-    int index_shift;
-
-    int cbf0_chunk = -1;
-    int cbfz_chunk = -1;
-    int cbp0_chunk = -1;
-    int cbpz_chunk = -1;
-    int cpl0_chunk = -1;
-    int cplz_chunk = -1;
-    int vptz_chunk = -1;
-
-    int x, y;
-    int lines = 0;
-    int pixel_ptr;
-    int vector_index = 0;
-    int lobyte = 0;
-    int hibyte = 0;
-    int lobytes = 0;
-    int hibytes = s->decode_buffer_size / 2;
-
-    /* first, traverse through the frame and find the subchunks */
-    while (index < s->size) {
-
-        chunk_type = AV_RB32(&s->buf[index]);
-        chunk_size = AV_RB32(&s->buf[index + 4]);
-
-        switch (chunk_type) {
-
-        case CBF0_TAG:
-            cbf0_chunk = index;
-            break;
-
-        case CBFZ_TAG:
-            cbfz_chunk = index;
-            break;
-
-        case CBP0_TAG:
-            cbp0_chunk = index;
-            break;
-
-        case CBPZ_TAG:
-            cbpz_chunk = index;
-            break;
-
-        case CPL0_TAG:
-            cpl0_chunk = index;
-            break;
-
-        case CPLZ_TAG:
-            cplz_chunk = index;
-            break;
-
-        case VPTZ_TAG:
-            vptz_chunk = index;
-            break;
-
-        default:
-            av_log(s->avctx, AV_LOG_ERROR, "  VQA video: Found unknown chunk type: %c%c%c%c (%08X)\n",
-            (chunk_type >> 24) & 0xFF,
-            (chunk_type >> 16) & 0xFF,
-            (chunk_type >>  8) & 0xFF,
-            (chunk_type >>  0) & 0xFF,
-            chunk_type);
-            break;
-        }
-
-        byte_skip = chunk_size & 0x01;
-        index += (CHUNK_PREAMBLE_SIZE + chunk_size + byte_skip);
-    }
-
-    /* next, deal with the palette */
-    if ((cpl0_chunk != -1) && (cplz_chunk != -1)) {
-
-        /* a chunk should not have both chunk types */
-        av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: found both CPL0 and CPLZ chunks\n");
-        return;
-    }
-
-    /* decompress the palette chunk */
-    if (cplz_chunk != -1) {
-
-/* yet to be handled */
-
-    }
-
-    /* convert the RGB palette into the machine's endian format */
-    if (cpl0_chunk != -1) {
-
-        chunk_size = AV_RB32(&s->buf[cpl0_chunk + 4]);
-        /* sanity check the palette size */
-        if (chunk_size / 3 > 256) {
-            av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: found a palette chunk with %d colors\n",
-                chunk_size / 3);
-            return;
-        }
-        cpl0_chunk += CHUNK_PREAMBLE_SIZE;
-        for (i = 0; i < chunk_size / 3; i++) {
-            /* scale by 4 to transform 6-bit palette -> 8-bit */
-            r = s->buf[cpl0_chunk++] * 4;
-            g = s->buf[cpl0_chunk++] * 4;
-            b = s->buf[cpl0_chunk++] * 4;
-            s->palette[i] = (r << 16) | (g << 8) | (b);
-        }
-    }
-
-    /* next, look for a full codebook */
-    if ((cbf0_chunk != -1) && (cbfz_chunk != -1)) {
-
-        /* a chunk should not have both chunk types */
-        av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: found both CBF0 and CBFZ chunks\n");
-        return;
-    }
-
-    /* decompress the full codebook chunk */
-    if (cbfz_chunk != -1) {
-
-        chunk_size = AV_RB32(&s->buf[cbfz_chunk + 4]);
-        cbfz_chunk += CHUNK_PREAMBLE_SIZE;
-        decode_format80(&s->buf[cbfz_chunk], chunk_size,
-            s->codebook, s->codebook_size, 0);
-    }
-
-    /* copy a full codebook */
-    if (cbf0_chunk != -1) {
-
-        chunk_size = AV_RB32(&s->buf[cbf0_chunk + 4]);
-        /* sanity check the full codebook size */
-        if (chunk_size > MAX_CODEBOOK_SIZE) {
-            av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: CBF0 chunk too large (0x%X bytes)\n",
-                chunk_size);
-            return;
-        }
-        cbf0_chunk += CHUNK_PREAMBLE_SIZE;
-
-        memcpy(s->codebook, &s->buf[cbf0_chunk], chunk_size);
-    }
-
-    /* decode the frame */
-    if (vptz_chunk == -1) {
-
-        /* something is wrong if there is no VPTZ chunk */
-        av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: no VPTZ chunk found\n");
-        return;
-    }
-
-    chunk_size = AV_RB32(&s->buf[vptz_chunk + 4]);
-    vptz_chunk += CHUNK_PREAMBLE_SIZE;
-    decode_format80(&s->buf[vptz_chunk], chunk_size,
-        s->decode_buffer, s->decode_buffer_size, 1);
-
-    /* render the final PAL8 frame */
-    if (s->vector_height == 4)
-        index_shift = 4;
-    else
-        index_shift = 3;
-    for (y = 0; y < s->frame.linesize[0] * s->height;
-        y += s->frame.linesize[0] * s->vector_height) {
-
-        for (x = y; x < y + s->width; x += 4, lobytes++, hibytes++) {
-            pixel_ptr = x;
-
-            /* get the vector index, the method for which varies according to
-             * VQA file version */
-            switch (s->vqa_version) {
-
-            case 1:
-/* still need sample media for this case (only one game, "Legend of
- * Kyrandia III : Malcolm's Revenge", is known to use this version) */
-                lobyte = s->decode_buffer[lobytes * 2];
-                hibyte = s->decode_buffer[(lobytes * 2) + 1];
-                vector_index = ((hibyte << 8) | lobyte) >> 3;
-                vector_index <<= index_shift;
-                lines = s->vector_height;
-                /* uniform color fill - a quick hack */
-                if (hibyte == 0xFF) {
-                    while (lines--) {
-                        s->frame.data[0][pixel_ptr + 0] = 255 - lobyte;
-                        s->frame.data[0][pixel_ptr + 1] = 255 - lobyte;
-                        s->frame.data[0][pixel_ptr + 2] = 255 - lobyte;
-                        s->frame.data[0][pixel_ptr + 3] = 255 - lobyte;
-                        pixel_ptr += s->frame.linesize[0];
-                    }
-                    lines=0;
-                }
-                break;
-
-            case 2:
-                lobyte = s->decode_buffer[lobytes];
-                hibyte = s->decode_buffer[hibytes];
-                vector_index = (hibyte << 8) | lobyte;
-                vector_index <<= index_shift;
-                lines = s->vector_height;
-                break;
-
-            case 3:
-/* not implemented yet */
-                lines = 0;
-                break;
-            }
-
-            while (lines--) {
-                s->frame.data[0][pixel_ptr + 0] = s->codebook[vector_index++];
-                s->frame.data[0][pixel_ptr + 1] = s->codebook[vector_index++];
-                s->frame.data[0][pixel_ptr + 2] = s->codebook[vector_index++];
-                s->frame.data[0][pixel_ptr + 3] = s->codebook[vector_index++];
-                pixel_ptr += s->frame.linesize[0];
-            }
-        }
-    }
-
-    /* handle partial codebook */
-    if ((cbp0_chunk != -1) && (cbpz_chunk != -1)) {
-        /* a chunk should not have both chunk types */
-        av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: found both CBP0 and CBPZ chunks\n");
-        return;
-    }
-
-    if (cbp0_chunk != -1) {
-
-        chunk_size = AV_RB32(&s->buf[cbp0_chunk + 4]);
-        cbp0_chunk += CHUNK_PREAMBLE_SIZE;
-
-        /* accumulate partial codebook */
-        memcpy(&s->next_codebook_buffer[s->next_codebook_buffer_index],
-            &s->buf[cbp0_chunk], chunk_size);
-        s->next_codebook_buffer_index += chunk_size;
-
-        s->partial_countdown--;
-        if (s->partial_countdown == 0) {
-
-            /* time to replace codebook */
-            memcpy(s->codebook, s->next_codebook_buffer,
-                s->next_codebook_buffer_index);
-
-            /* reset accounting */
-            s->next_codebook_buffer_index = 0;
-            s->partial_countdown = s->partial_count;
-        }
-    }
-
-    if (cbpz_chunk != -1) {
-
-        chunk_size = AV_RB32(&s->buf[cbpz_chunk + 4]);
-        cbpz_chunk += CHUNK_PREAMBLE_SIZE;
-
-        /* accumulate partial codebook */
-        memcpy(&s->next_codebook_buffer[s->next_codebook_buffer_index],
-            &s->buf[cbpz_chunk], chunk_size);
-        s->next_codebook_buffer_index += chunk_size;
-
-        s->partial_countdown--;
-        if (s->partial_countdown == 0) {
-
-            /* decompress codebook */
-            decode_format80(s->next_codebook_buffer,
-                s->next_codebook_buffer_index,
-                s->codebook, s->codebook_size, 0);
-
-            /* reset accounting */
-            s->next_codebook_buffer_index = 0;
-            s->partial_countdown = s->partial_count;
-        }
-    }
-}
-
-static int vqa_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VqaContext *s = avctx->priv_data;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    if (avctx->get_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "  VQA Video: get_buffer() failed\n");
-        return -1;
-    }
-
-    vqa_decode_chunk(s);
-
-    /* make the palette available on the way out */
-    memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4);
-    s->frame.palette_has_changed = 1;
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int vqa_decode_end(AVCodecContext *avctx)
-{
-    VqaContext *s = avctx->priv_data;
-
-    av_free(s->codebook);
-    av_free(s->next_codebook_buffer);
-    av_free(s->decode_buffer);
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    return 0;
-}
-
-AVCodec vqa_decoder = {
-    "vqavideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WS_VQA,
-    sizeof(VqaContext),
-    vqa_decode_init,
-    NULL,
-    vqa_decode_end,
-    vqa_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"),
-};
diff --git a/libavcodec/w32thread.c b/libavcodec/w32thread.c
deleted file mode 100644
index f7a1430..0000000
--- a/libavcodec/w32thread.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-//#define DEBUG
-
-#include "avcodec.h"
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <process.h>
-
-typedef struct ThreadContext{
-    AVCodecContext *avctx;
-    HANDLE thread;
-    HANDLE work_sem;
-    HANDLE job_sem;
-    HANDLE done_sem;
-    int (*func)(AVCodecContext *c, void *arg);
-    int (*func2)(AVCodecContext *c, void *arg, int, int);
-    void *arg;
-    int argsize;
-    int *jobnr;
-    int *ret;
-    int threadnr;
-}ThreadContext;
-
-
-static unsigned WINAPI attribute_align_arg thread_func(void *v){
-    ThreadContext *c= v;
-
-    for(;;){
-        int ret, jobnr;
-//printf("thread_func %X enter wait\n", (int)v); fflush(stdout);
-        WaitForSingleObject(c->work_sem, INFINITE);
-        // avoid trying to access jobnr if we should quit
-        if (!c->func && !c->func2)
-            break;
-        WaitForSingleObject(c->job_sem, INFINITE);
-        jobnr = (*c->jobnr)++;
-        ReleaseSemaphore(c->job_sem, 1, 0);
-//printf("thread_func %X after wait (func=%X)\n", (int)v, (int)c->func); fflush(stdout);
-        if(c->func)
-            ret= c->func(c->avctx, (uint8_t *)c->arg + jobnr*c->argsize);
-        else
-            ret= c->func2(c->avctx, c->arg, jobnr, c->threadnr);
-        if (c->ret)
-            c->ret[jobnr] = ret;
-//printf("thread_func %X signal complete\n", (int)v); fflush(stdout);
-        ReleaseSemaphore(c->done_sem, 1, 0);
-    }
-
-    return 0;
-}
-
-/**
- * Free what has been allocated by avcodec_thread_init().
- * Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running.
- */
-void avcodec_thread_free(AVCodecContext *s){
-    ThreadContext *c= s->thread_opaque;
-    int i;
-
-    for(i=0; i<s->thread_count; i++){
-
-        c[i].func= NULL;
-        c[i].func2= NULL;
-    }
-    ReleaseSemaphore(c[0].work_sem, s->thread_count, 0);
-    for(i=0; i<s->thread_count; i++){
-        WaitForSingleObject(c[i].thread, INFINITE);
-        if(c[i].thread)   CloseHandle(c[i].thread);
-    }
-    if(c[0].work_sem) CloseHandle(c[0].work_sem);
-    if(c[0].job_sem)  CloseHandle(c[0].job_sem);
-    if(c[0].done_sem) CloseHandle(c[0].done_sem);
-
-    av_freep(&s->thread_opaque);
-}
-
-static int avcodec_thread_execute(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size){
-    ThreadContext *c= s->thread_opaque;
-    int i;
-    int jobnr = 0;
-
-    assert(s == c->avctx);
-
-    /* note, we can be certain that this is not called with the same AVCodecContext by different threads at the same time */
-
-    for(i=0; i<s->thread_count; i++){
-        c[i].arg= arg;
-        c[i].argsize= size;
-        c[i].func= func;
-        c[i].ret= ret;
-        c[i].jobnr = &jobnr;
-    }
-    ReleaseSemaphore(c[0].work_sem, count, 0);
-    for(i=0; i<count; i++)
-        WaitForSingleObject(c[0].done_sem, INFINITE);
-
-    return 0;
-}
-
-static int avcodec_thread_execute2(AVCodecContext *s, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count){
-    ThreadContext *c= s->thread_opaque;
-    int i;
-    for(i=0; i<s->thread_count; i++)
-        c[i].func2 = func;
-    avcodec_thread_execute(s, NULL, arg, ret, count, 0);
-}
-
-int avcodec_thread_init(AVCodecContext *s, int thread_count){
-    int i;
-    ThreadContext *c;
-    uint32_t threadid;
-
-    s->thread_count= thread_count;
-
-    if (thread_count <= 1)
-        return 0;
-
-    assert(!s->thread_opaque);
-    c= av_mallocz(sizeof(ThreadContext)*thread_count);
-    s->thread_opaque= c;
-    if(!(c[0].work_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL)))
-        goto fail;
-    if(!(c[0].job_sem  = CreateSemaphore(NULL, 1, 1, NULL)))
-        goto fail;
-    if(!(c[0].done_sem = CreateSemaphore(NULL, 0, INT_MAX, NULL)))
-        goto fail;
-
-    for(i=0; i<thread_count; i++){
-//printf("init semaphors %d\n", i); fflush(stdout);
-        c[i].avctx= s;
-        c[i].work_sem = c[0].work_sem;
-        c[i].job_sem  = c[0].job_sem;
-        c[i].done_sem = c[0].done_sem;
-        c[i].threadnr = i;
-
-//printf("create thread %d\n", i); fflush(stdout);
-        c[i].thread = (HANDLE)_beginthreadex(NULL, 0, thread_func, &c[i], 0, &threadid );
-        if( !c[i].thread ) goto fail;
-    }
-//printf("init done\n"); fflush(stdout);
-
-    s->execute= avcodec_thread_execute;
-    s->execute2= avcodec_thread_execute2;
-
-    return 0;
-fail:
-    avcodec_thread_free(s);
-    return -1;
-}
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
deleted file mode 100644
index 7358d29..0000000
--- a/libavcodec/wavpack.c
+++ /dev/null
@@ -1,1032 +0,0 @@
-/*
- * WavPack lossless audio decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "get_bits.h"
-#include "unary.h"
-
-/**
- * @file
- * WavPack lossless audio decoder
- */
-
-#define WV_MONO         0x00000004
-#define WV_JOINT_STEREO 0x00000010
-#define WV_FALSE_STEREO 0x40000000
-
-#define WV_HYBRID_MODE    0x00000008
-#define WV_HYBRID_SHAPE   0x00000008
-#define WV_HYBRID_BITRATE 0x00000200
-#define WV_HYBRID_BALANCE 0x00000400
-
-#define WV_FLT_SHIFT_ONES 0x01
-#define WV_FLT_SHIFT_SAME 0x02
-#define WV_FLT_SHIFT_SENT 0x04
-#define WV_FLT_ZERO_SENT  0x08
-#define WV_FLT_ZERO_SIGN  0x10
-
-enum WP_ID_Flags{
-    WP_IDF_MASK   = 0x1F,
-    WP_IDF_IGNORE = 0x20,
-    WP_IDF_ODD    = 0x40,
-    WP_IDF_LONG   = 0x80
-};
-
-enum WP_ID{
-    WP_ID_DUMMY = 0,
-    WP_ID_ENCINFO,
-    WP_ID_DECTERMS,
-    WP_ID_DECWEIGHTS,
-    WP_ID_DECSAMPLES,
-    WP_ID_ENTROPY,
-    WP_ID_HYBRID,
-    WP_ID_SHAPING,
-    WP_ID_FLOATINFO,
-    WP_ID_INT32INFO,
-    WP_ID_DATA,
-    WP_ID_CORR,
-    WP_ID_EXTRABITS,
-    WP_ID_CHANINFO
-};
-
-typedef struct SavedContext {
-    int offset;
-    int size;
-    int bits_used;
-    uint32_t crc;
-} SavedContext;
-
-#define MAX_TERMS 16
-
-typedef struct Decorr {
-    int delta;
-    int value;
-    int weightA;
-    int weightB;
-    int samplesA[8];
-    int samplesB[8];
-} Decorr;
-
-typedef struct WvChannel {
-    int median[3];
-    int slow_level, error_limit;
-    int bitrate_acc, bitrate_delta;
-} WvChannel;
-
-typedef struct WavpackContext {
-    AVCodecContext *avctx;
-    int frame_flags;
-    int stereo, stereo_in;
-    int joint;
-    uint32_t CRC;
-    GetBitContext gb;
-    int got_extra_bits;
-    uint32_t crc_extra_bits;
-    GetBitContext gb_extra_bits;
-    int data_size; // in bits
-    int samples;
-    int terms;
-    Decorr decorr[MAX_TERMS];
-    int zero, one, zeroes;
-    int extra_bits;
-    int and, or, shift;
-    int post_shift;
-    int hybrid, hybrid_bitrate;
-    int float_flag;
-    int float_shift;
-    int float_max_exp;
-    WvChannel ch[2];
-    int samples_left;
-    int max_samples;
-    int pos;
-    SavedContext sc, extra_sc;
-} WavpackContext;
-
-// exponent table copied from WavPack source
-static const uint8_t wp_exp2_table [256] = {
-    0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0a, 0x0b,
-    0x0b, 0x0c, 0x0d, 0x0e, 0x0e, 0x0f, 0x10, 0x10, 0x11, 0x12, 0x13, 0x13, 0x14, 0x15, 0x16, 0x16,
-    0x17, 0x18, 0x19, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1d, 0x1e, 0x1f, 0x20, 0x20, 0x21, 0x22, 0x23,
-    0x24, 0x24, 0x25, 0x26, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
-    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3a, 0x3b, 0x3c, 0x3d,
-    0x3e, 0x3f, 0x40, 0x41, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x48, 0x49, 0x4a, 0x4b,
-    0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
-    0x5b, 0x5c, 0x5d, 0x5e, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
-    0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
-    0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x87, 0x88, 0x89, 0x8a,
-    0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
-    0x9c, 0x9d, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad,
-    0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
-    0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc8, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf, 0xd0, 0xd2, 0xd3, 0xd4,
-    0xd6, 0xd7, 0xd8, 0xd9, 0xdb, 0xdc, 0xdd, 0xde, 0xe0, 0xe1, 0xe2, 0xe4, 0xe5, 0xe6, 0xe8, 0xe9,
-    0xea, 0xec, 0xed, 0xee, 0xf0, 0xf1, 0xf2, 0xf4, 0xf5, 0xf6, 0xf8, 0xf9, 0xfa, 0xfc, 0xfd, 0xff
-};
-
-static const uint8_t wp_log2_table [] = {
-    0x00, 0x01, 0x03, 0x04, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x10, 0x11, 0x12, 0x14, 0x15,
-    0x16, 0x18, 0x19, 0x1a, 0x1c, 0x1d, 0x1e, 0x20, 0x21, 0x22, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2a,
-    0x2c, 0x2d, 0x2e, 0x2f, 0x31, 0x32, 0x33, 0x34, 0x36, 0x37, 0x38, 0x39, 0x3b, 0x3c, 0x3d, 0x3e,
-    0x3f, 0x41, 0x42, 0x43, 0x44, 0x45, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
-    0x52, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63,
-    0x64, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x74, 0x75,
-    0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
-    0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95,
-    0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4,
-    0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb2,
-    0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc0,
-    0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xce,
-    0xcf, 0xd0, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd8, 0xd9, 0xda, 0xdb,
-    0xdc, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe4, 0xe5, 0xe6, 0xe7, 0xe7,
-    0xe8, 0xe9, 0xea, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xee, 0xef, 0xf0, 0xf1, 0xf1, 0xf2, 0xf3, 0xf4,
-    0xf4, 0xf5, 0xf6, 0xf7, 0xf7, 0xf8, 0xf9, 0xf9, 0xfa, 0xfb, 0xfc, 0xfc, 0xfd, 0xfe, 0xff, 0xff
-};
-
-static av_always_inline int wp_exp2(int16_t val)
-{
-    int res, neg = 0;
-
-    if(val < 0){
-        val = -val;
-        neg = 1;
-    }
-
-    res = wp_exp2_table[val & 0xFF] | 0x100;
-    val >>= 8;
-    res = (val > 9) ? (res << (val - 9)) : (res >> (9 - val));
-    return neg ? -res : res;
-}
-
-static av_always_inline int wp_log2(int32_t val)
-{
-    int bits;
-
-    if(!val)
-        return 0;
-    if(val == 1)
-        return 256;
-    val += val >> 9;
-    bits = av_log2(val) + 1;
-    if(bits < 9)
-        return (bits << 8) + wp_log2_table[(val << (9 - bits)) & 0xFF];
-    else
-        return (bits << 8) + wp_log2_table[(val >> (bits - 9)) & 0xFF];
-}
-
-#define LEVEL_DECAY(a)  ((a + 0x80) >> 8)
-
-// macros for manipulating median values
-#define GET_MED(n) ((c->median[n] >> 4) + 1)
-#define DEC_MED(n) c->median[n] -= ((c->median[n] + (128>>n) - 2) / (128>>n)) * 2
-#define INC_MED(n) c->median[n] += ((c->median[n] + (128>>n)) / (128>>n)) * 5
-
-// macros for applying weight
-#define UPDATE_WEIGHT_CLIP(weight, delta, samples, in) \
-        if(samples && in){ \
-            if((samples ^ in) < 0){ \
-                weight -= delta; \
-                if(weight < -1024) weight = -1024; \
-            }else{ \
-                weight += delta; \
-                if(weight > 1024) weight = 1024; \
-            } \
-        }
-
-
-static av_always_inline int get_tail(GetBitContext *gb, int k)
-{
-    int p, e, res;
-
-    if(k<1)return 0;
-    p = av_log2(k);
-    e = (1 << (p + 1)) - k - 1;
-    res = p ? get_bits(gb, p) : 0;
-    if(res >= e){
-        res = (res<<1) - e + get_bits1(gb);
-    }
-    return res;
-}
-
-static void update_error_limit(WavpackContext *ctx)
-{
-    int i, br[2], sl[2];
-
-    for(i = 0; i <= ctx->stereo_in; i++){
-        ctx->ch[i].bitrate_acc += ctx->ch[i].bitrate_delta;
-        br[i] = ctx->ch[i].bitrate_acc >> 16;
-        sl[i] = LEVEL_DECAY(ctx->ch[i].slow_level);
-    }
-    if(ctx->stereo_in && ctx->hybrid_bitrate){
-        int balance = (sl[1] - sl[0] + br[1] + 1) >> 1;
-        if(balance > br[0]){
-            br[1] = br[0] << 1;
-            br[0] = 0;
-        }else if(-balance > br[0]){
-            br[0] <<= 1;
-            br[1] = 0;
-        }else{
-            br[1] = br[0] + balance;
-            br[0] = br[0] - balance;
-        }
-    }
-    for(i = 0; i <= ctx->stereo_in; i++){
-        if(ctx->hybrid_bitrate){
-            if(sl[i] - br[i] > -0x100)
-                ctx->ch[i].error_limit = wp_exp2(sl[i] - br[i] + 0x100);
-            else
-                ctx->ch[i].error_limit = 0;
-        }else{
-            ctx->ch[i].error_limit = wp_exp2(br[i]);
-        }
-    }
-}
-
-static int wv_get_value(WavpackContext *ctx, GetBitContext *gb, int channel, int *last)
-{
-    int t, t2;
-    int sign, base, add, ret;
-    WvChannel *c = &ctx->ch[channel];
-
-    *last = 0;
-
-    if((ctx->ch[0].median[0] < 2U) && (ctx->ch[1].median[0] < 2U) && !ctx->zero && !ctx->one){
-        if(ctx->zeroes){
-            ctx->zeroes--;
-            if(ctx->zeroes){
-                c->slow_level -= LEVEL_DECAY(c->slow_level);
-                return 0;
-            }
-        }else{
-            t = get_unary_0_33(gb);
-            if(t >= 2) t = get_bits(gb, t - 1) | (1 << (t-1));
-            ctx->zeroes = t;
-            if(ctx->zeroes){
-                memset(ctx->ch[0].median, 0, sizeof(ctx->ch[0].median));
-                memset(ctx->ch[1].median, 0, sizeof(ctx->ch[1].median));
-                c->slow_level -= LEVEL_DECAY(c->slow_level);
-                return 0;
-            }
-        }
-    }
-
-    if(get_bits_count(gb) >= ctx->data_size){
-        *last = 1;
-        return 0;
-    }
-
-    if(ctx->zero){
-        t = 0;
-        ctx->zero = 0;
-    }else{
-        t = get_unary_0_33(gb);
-        if(get_bits_count(gb) >= ctx->data_size){
-            *last = 1;
-            return 0;
-        }
-        if(t == 16) {
-            t2 = get_unary_0_33(gb);
-            if(t2 < 2) t += t2;
-            else t += get_bits(gb, t2 - 1) | (1 << (t2 - 1));
-        }
-
-        if(ctx->one){
-            ctx->one = t&1;
-            t = (t>>1) + 1;
-        }else{
-            ctx->one = t&1;
-            t >>= 1;
-        }
-        ctx->zero = !ctx->one;
-    }
-
-    if(ctx->hybrid && !channel)
-        update_error_limit(ctx);
-
-    if(!t){
-        base = 0;
-        add = GET_MED(0) - 1;
-        DEC_MED(0);
-    }else if(t == 1){
-        base = GET_MED(0);
-        add = GET_MED(1) - 1;
-        INC_MED(0);
-        DEC_MED(1);
-    }else if(t == 2){
-        base = GET_MED(0) + GET_MED(1);
-        add = GET_MED(2) - 1;
-        INC_MED(0);
-        INC_MED(1);
-        DEC_MED(2);
-    }else{
-        base = GET_MED(0) + GET_MED(1) + GET_MED(2) * (t - 2);
-        add = GET_MED(2) - 1;
-        INC_MED(0);
-        INC_MED(1);
-        INC_MED(2);
-    }
-    if(!c->error_limit){
-        ret = base + get_tail(gb, add);
-    }else{
-        int mid = (base*2 + add + 1) >> 1;
-        while(add > c->error_limit){
-            if(get_bits1(gb)){
-                add -= (mid - base);
-                base = mid;
-            }else
-                add = mid - base - 1;
-            mid = (base*2 + add + 1) >> 1;
-        }
-        ret = mid;
-    }
-    sign = get_bits1(gb);
-    if(ctx->hybrid_bitrate)
-        c->slow_level += wp_log2(ret) - LEVEL_DECAY(c->slow_level);
-    return sign ? ~ret : ret;
-}
-
-static inline int wv_get_value_integer(WavpackContext *s, uint32_t *crc, int S)
-{
-    int bit;
-
-    if(s->extra_bits){
-        S <<= s->extra_bits;
-
-        if(s->got_extra_bits){
-            S |= get_bits(&s->gb_extra_bits, s->extra_bits);
-            *crc = *crc * 9 + (S&0xffff) * 3 + ((unsigned)S>>16);
-        }
-    }
-    bit = (S & s->and) | s->or;
-    return (((S + bit) << s->shift) - bit) << s->post_shift;
-}
-
-static float wv_get_value_float(WavpackContext *s, uint32_t *crc, int S)
-{
-    union {
-        float    f;
-        uint32_t u;
-    } value;
-
-    int sign;
-    int exp = s->float_max_exp;
-
-    if(s->got_extra_bits){
-        const int max_bits = 1 + 23 + 8 + 1;
-        const int left_bits = get_bits_left(&s->gb_extra_bits);
-
-        if(left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits)
-            return 0.0;
-    }
-
-    if(S){
-        S <<= s->float_shift;
-        sign = S < 0;
-        if(sign)
-            S = -S;
-        if(S >= 0x1000000){
-            if(s->got_extra_bits && get_bits1(&s->gb_extra_bits)){
-                S = get_bits(&s->gb_extra_bits, 23);
-            }else{
-                S = 0;
-            }
-            exp = 255;
-        }else if(exp){
-            int shift = 23 - av_log2(S);
-            exp = s->float_max_exp;
-            if(exp <= shift){
-                shift = --exp;
-            }
-            exp -= shift;
-
-            if(shift){
-                S <<= shift;
-                if((s->float_flag & WV_FLT_SHIFT_ONES) ||
-                   (s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SAME) && get_bits1(&s->gb_extra_bits)) ){
-                    S |= (1 << shift) - 1;
-                } else if(s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SENT)){
-                    S |= get_bits(&s->gb_extra_bits, shift);
-                }
-            }
-        }else{
-            exp = s->float_max_exp;
-        }
-        S &= 0x7fffff;
-    }else{
-        sign = 0;
-        exp = 0;
-        if(s->got_extra_bits && (s->float_flag & WV_FLT_ZERO_SENT)){
-            if(get_bits1(&s->gb_extra_bits)){
-                S = get_bits(&s->gb_extra_bits, 23);
-                if(s->float_max_exp >= 25)
-                    exp = get_bits(&s->gb_extra_bits, 8);
-                sign = get_bits1(&s->gb_extra_bits);
-            }else{
-                if(s->float_flag & WV_FLT_ZERO_SIGN)
-                    sign = get_bits1(&s->gb_extra_bits);
-            }
-        }
-    }
-
-    *crc = *crc * 27 + S * 9 + exp * 3 + sign;
-
-    value.u = (sign << 31) | (exp << 23) | S;
-    return value.f;
-}
-
-static void wv_reset_saved_context(WavpackContext *s)
-{
-    s->pos = 0;
-    s->sc.crc = s->extra_sc.crc = 0xFFFFFFFF;
-}
-
-static inline int wv_unpack_stereo(WavpackContext *s, GetBitContext *gb, void *dst, const int type)
-{
-    int i, j, count = 0;
-    int last, t;
-    int A, B, L, L2, R, R2;
-    int pos = s->pos;
-    uint32_t crc = s->sc.crc;
-    uint32_t crc_extra_bits = s->extra_sc.crc;
-    int16_t *dst16 = dst;
-    int32_t *dst32 = dst;
-    float   *dstfl = dst;
-
-    if(s->samples_left == s->samples)
-        s->one = s->zero = s->zeroes = 0;
-    do{
-        L = wv_get_value(s, gb, 0, &last);
-        if(last) break;
-        R = wv_get_value(s, gb, 1, &last);
-        if(last) break;
-        for(i = 0; i < s->terms; i++){
-            t = s->decorr[i].value;
-            if(t > 0){
-                if(t > 8){
-                    if(t & 1){
-                        A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1];
-                        B = 2 * s->decorr[i].samplesB[0] - s->decorr[i].samplesB[1];
-                    }else{
-                        A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1;
-                        B = (3 * s->decorr[i].samplesB[0] - s->decorr[i].samplesB[1]) >> 1;
-                    }
-                    s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0];
-                    s->decorr[i].samplesB[1] = s->decorr[i].samplesB[0];
-                    j = 0;
-                }else{
-                    A = s->decorr[i].samplesA[pos];
-                    B = s->decorr[i].samplesB[pos];
-                    j = (pos + t) & 7;
-                }
-                if(type != SAMPLE_FMT_S16){
-                    L2 = L + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
-                    R2 = R + ((s->decorr[i].weightB * (int64_t)B + 512) >> 10);
-                }else{
-                    L2 = L + ((s->decorr[i].weightA * A + 512) >> 10);
-                    R2 = R + ((s->decorr[i].weightB * B + 512) >> 10);
-                }
-                if(A && L) s->decorr[i].weightA -= ((((L ^ A) >> 30) & 2) - 1) * s->decorr[i].delta;
-                if(B && R) s->decorr[i].weightB -= ((((R ^ B) >> 30) & 2) - 1) * s->decorr[i].delta;
-                s->decorr[i].samplesA[j] = L = L2;
-                s->decorr[i].samplesB[j] = R = R2;
-            }else if(t == -1){
-                if(type != SAMPLE_FMT_S16)
-                    L2 = L + ((s->decorr[i].weightA * (int64_t)s->decorr[i].samplesA[0] + 512) >> 10);
-                else
-                    L2 = L + ((s->decorr[i].weightA * s->decorr[i].samplesA[0] + 512) >> 10);
-                UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, s->decorr[i].samplesA[0], L);
-                L = L2;
-                if(type != SAMPLE_FMT_S16)
-                    R2 = R + ((s->decorr[i].weightB * (int64_t)L2 + 512) >> 10);
-                else
-                    R2 = R + ((s->decorr[i].weightB * L2 + 512) >> 10);
-                UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, L2, R);
-                R = R2;
-                s->decorr[i].samplesA[0] = R;
-            }else{
-                if(type != SAMPLE_FMT_S16)
-                    R2 = R + ((s->decorr[i].weightB * (int64_t)s->decorr[i].samplesB[0] + 512) >> 10);
-                else
-                    R2 = R + ((s->decorr[i].weightB * s->decorr[i].samplesB[0] + 512) >> 10);
-                UPDATE_WEIGHT_CLIP(s->decorr[i].weightB, s->decorr[i].delta, s->decorr[i].samplesB[0], R);
-                R = R2;
-
-                if(t == -3){
-                    R2 = s->decorr[i].samplesA[0];
-                    s->decorr[i].samplesA[0] = R;
-                }
-
-                if(type != SAMPLE_FMT_S16)
-                    L2 = L + ((s->decorr[i].weightA * (int64_t)R2 + 512) >> 10);
-                else
-                    L2 = L + ((s->decorr[i].weightA * R2 + 512) >> 10);
-                UPDATE_WEIGHT_CLIP(s->decorr[i].weightA, s->decorr[i].delta, R2, L);
-                L = L2;
-                s->decorr[i].samplesB[0] = L;
-            }
-        }
-        pos = (pos + 1) & 7;
-        if(s->joint)
-            L += (R -= (L >> 1));
-        crc = (crc * 3 + L) * 3 + R;
-
-        if(type == SAMPLE_FMT_FLT){
-            *dstfl++ = wv_get_value_float(s, &crc_extra_bits, L);
-            *dstfl++ = wv_get_value_float(s, &crc_extra_bits, R);
-        } else if(type == SAMPLE_FMT_S32){
-            *dst32++ = wv_get_value_integer(s, &crc_extra_bits, L);
-            *dst32++ = wv_get_value_integer(s, &crc_extra_bits, R);
-        } else {
-            *dst16++ = wv_get_value_integer(s, &crc_extra_bits, L);
-            *dst16++ = wv_get_value_integer(s, &crc_extra_bits, R);
-        }
-        count++;
-    }while(!last && count < s->max_samples);
-
-    s->samples_left -= count;
-    if(!s->samples_left){
-        if(crc != s->CRC){
-            av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
-            return -1;
-        }
-        if(s->got_extra_bits && crc_extra_bits != s->crc_extra_bits){
-            av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
-            return -1;
-        }
-        wv_reset_saved_context(s);
-    }else{
-        s->pos = pos;
-        s->sc.crc = crc;
-        s->sc.bits_used = get_bits_count(&s->gb);
-        if(s->got_extra_bits){
-            s->extra_sc.crc = crc_extra_bits;
-            s->extra_sc.bits_used = get_bits_count(&s->gb_extra_bits);
-        }
-    }
-    return count * 2;
-}
-
-static inline int wv_unpack_mono(WavpackContext *s, GetBitContext *gb, void *dst, const int type)
-{
-    int i, j, count = 0;
-    int last, t;
-    int A, S, T;
-    int pos = s->pos;
-    uint32_t crc = s->sc.crc;
-    uint32_t crc_extra_bits = s->extra_sc.crc;
-    int16_t *dst16 = dst;
-    int32_t *dst32 = dst;
-    float   *dstfl = dst;
-
-    if(s->samples_left == s->samples)
-        s->one = s->zero = s->zeroes = 0;
-    do{
-        T = wv_get_value(s, gb, 0, &last);
-        S = 0;
-        if(last) break;
-        for(i = 0; i < s->terms; i++){
-            t = s->decorr[i].value;
-            if(t > 8){
-                if(t & 1)
-                    A = 2 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1];
-                else
-                    A = (3 * s->decorr[i].samplesA[0] - s->decorr[i].samplesA[1]) >> 1;
-                s->decorr[i].samplesA[1] = s->decorr[i].samplesA[0];
-                j = 0;
-            }else{
-                A = s->decorr[i].samplesA[pos];
-                j = (pos + t) & 7;
-            }
-            if(type != SAMPLE_FMT_S16)
-                S = T + ((s->decorr[i].weightA * (int64_t)A + 512) >> 10);
-            else
-                S = T + ((s->decorr[i].weightA * A + 512) >> 10);
-            if(A && T) s->decorr[i].weightA -= ((((T ^ A) >> 30) & 2) - 1) * s->decorr[i].delta;
-            s->decorr[i].samplesA[j] = T = S;
-        }
-        pos = (pos + 1) & 7;
-        crc = crc * 3 + S;
-
-        if(type == SAMPLE_FMT_FLT)
-            *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S);
-        else if(type == SAMPLE_FMT_S32)
-            *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S);
-        else
-            *dst16++ = wv_get_value_integer(s, &crc_extra_bits, S);
-        count++;
-    }while(!last && count < s->samples);
-
-    s->samples_left -= count;
-    if(!s->samples_left){
-        if(crc != s->CRC){
-            av_log(s->avctx, AV_LOG_ERROR, "CRC error\n");
-            return -1;
-        }
-        if(s->got_extra_bits && crc_extra_bits != s->crc_extra_bits){
-            av_log(s->avctx, AV_LOG_ERROR, "Extra bits CRC error\n");
-            return -1;
-        }
-        wv_reset_saved_context(s);
-    }else{
-        s->pos = pos;
-        s->sc.crc = crc;
-        s->sc.bits_used = get_bits_count(&s->gb);
-        if(s->got_extra_bits){
-            s->extra_sc.crc = crc_extra_bits;
-            s->extra_sc.bits_used = get_bits_count(&s->gb_extra_bits);
-        }
-    }
-    return count;
-}
-
-static av_cold int wavpack_decode_init(AVCodecContext *avctx)
-{
-    WavpackContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->stereo = (avctx->channels == 2);
-    if(avctx->bits_per_coded_sample <= 16)
-        avctx->sample_fmt = SAMPLE_FMT_S16;
-    else
-        avctx->sample_fmt = SAMPLE_FMT_S32;
-    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
-
-    wv_reset_saved_context(s);
-
-    return 0;
-}
-
-static int wavpack_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    WavpackContext *s = avctx->priv_data;
-    void *samples = data;
-    int samplecount;
-    int got_terms = 0, got_weights = 0, got_samples = 0, got_entropy = 0, got_bs = 0, got_float = 0;
-    int got_hybrid = 0;
-    const uint8_t* buf_end = buf + buf_size;
-    int i, j, id, size, ssize, weights, t;
-    int bpp;
-
-    if (buf_size == 0){
-        *data_size = 0;
-        return 0;
-    }
-
-    if(!s->samples_left){
-        memset(s->decorr, 0, MAX_TERMS * sizeof(Decorr));
-        memset(s->ch, 0, sizeof(s->ch));
-        s->extra_bits = 0;
-        s->and = s->or = s->shift = 0;
-        s->got_extra_bits = 0;
-    }
-
-    s->samples = AV_RL32(buf); buf += 4;
-    if(!s->samples){
-        *data_size = 0;
-        return buf_size;
-    }
-    s->frame_flags = AV_RL32(buf); buf += 4;
-    if(s->frame_flags&0x80){
-        bpp = sizeof(float);
-        avctx->sample_fmt = SAMPLE_FMT_FLT;
-    } else if((s->frame_flags&0x03) <= 1){
-        bpp = 2;
-        avctx->sample_fmt = SAMPLE_FMT_S16;
-    } else {
-        bpp = 4;
-        avctx->sample_fmt = SAMPLE_FMT_S32;
-    }
-    s->stereo_in = (s->frame_flags & WV_FALSE_STEREO) ? 0 : s->stereo;
-    s->joint = s->frame_flags & WV_JOINT_STEREO;
-    s->hybrid = s->frame_flags & WV_HYBRID_MODE;
-    s->hybrid_bitrate = s->frame_flags & WV_HYBRID_BITRATE;
-    s->post_shift = 8 * (bpp-1-(s->frame_flags&0x03)) + ((s->frame_flags >> 13) & 0x1f);
-    s->CRC = AV_RL32(buf); buf += 4;
-
-    s->max_samples = *data_size / (bpp * avctx->channels);
-    s->max_samples = FFMIN(s->max_samples, s->samples);
-    if(s->samples_left > 0){
-        s->max_samples = FFMIN(s->max_samples, s->samples_left);
-        buf = buf_end;
-    }
-
-    // parse metadata blocks
-    while(buf < buf_end){
-        id = *buf++;
-        size = *buf++;
-        if(id & WP_IDF_LONG) {
-            size |= (*buf++) << 8;
-            size |= (*buf++) << 16;
-        }
-        size <<= 1; // size is specified in words
-        ssize = size;
-        if(id & WP_IDF_ODD) size--;
-        if(size < 0){
-            av_log(avctx, AV_LOG_ERROR, "Got incorrect block %02X with size %i\n", id, size);
-            break;
-        }
-        if(buf + ssize > buf_end){
-            av_log(avctx, AV_LOG_ERROR, "Block size %i is out of bounds\n", size);
-            break;
-        }
-        if(id & WP_IDF_IGNORE){
-            buf += ssize;
-            continue;
-        }
-        switch(id & WP_IDF_MASK){
-        case WP_ID_DECTERMS:
-            s->terms = size;
-            if(s->terms > MAX_TERMS){
-                av_log(avctx, AV_LOG_ERROR, "Too many decorrelation terms\n");
-                buf += ssize;
-                continue;
-            }
-            for(i = 0; i < s->terms; i++) {
-                s->decorr[s->terms - i - 1].value = (*buf & 0x1F) - 5;
-                s->decorr[s->terms - i - 1].delta = *buf >> 5;
-                buf++;
-            }
-            got_terms = 1;
-            break;
-        case WP_ID_DECWEIGHTS:
-            if(!got_terms){
-                av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n");
-                continue;
-            }
-            weights = size >> s->stereo_in;
-            if(weights > MAX_TERMS || weights > s->terms){
-                av_log(avctx, AV_LOG_ERROR, "Too many decorrelation weights\n");
-                buf += ssize;
-                continue;
-            }
-            for(i = 0; i < weights; i++) {
-                t = (int8_t)(*buf++);
-                s->decorr[s->terms - i - 1].weightA = t << 3;
-                if(s->decorr[s->terms - i - 1].weightA > 0)
-                    s->decorr[s->terms - i - 1].weightA += (s->decorr[s->terms - i - 1].weightA + 64) >> 7;
-                if(s->stereo_in){
-                    t = (int8_t)(*buf++);
-                    s->decorr[s->terms - i - 1].weightB = t << 3;
-                    if(s->decorr[s->terms - i - 1].weightB > 0)
-                        s->decorr[s->terms - i - 1].weightB += (s->decorr[s->terms - i - 1].weightB + 64) >> 7;
-                }
-            }
-            got_weights = 1;
-            break;
-        case WP_ID_DECSAMPLES:
-            if(!got_terms){
-                av_log(avctx, AV_LOG_ERROR, "No decorrelation terms met\n");
-                continue;
-            }
-            t = 0;
-            for(i = s->terms - 1; (i >= 0) && (t < size); i--) {
-                if(s->decorr[i].value > 8){
-                    s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2;
-                    s->decorr[i].samplesA[1] = wp_exp2(AV_RL16(buf)); buf += 2;
-                    if(s->stereo_in){
-                        s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2;
-                        s->decorr[i].samplesB[1] = wp_exp2(AV_RL16(buf)); buf += 2;
-                        t += 4;
-                    }
-                    t += 4;
-                }else if(s->decorr[i].value < 0){
-                    s->decorr[i].samplesA[0] = wp_exp2(AV_RL16(buf)); buf += 2;
-                    s->decorr[i].samplesB[0] = wp_exp2(AV_RL16(buf)); buf += 2;
-                    t += 4;
-                }else{
-                    for(j = 0; j < s->decorr[i].value; j++){
-                        s->decorr[i].samplesA[j] = wp_exp2(AV_RL16(buf)); buf += 2;
-                        if(s->stereo_in){
-                            s->decorr[i].samplesB[j] = wp_exp2(AV_RL16(buf)); buf += 2;
-                        }
-                    }
-                    t += s->decorr[i].value * 2 * (s->stereo_in + 1);
-                }
-            }
-            got_samples = 1;
-            break;
-        case WP_ID_ENTROPY:
-            if(size != 6 * (s->stereo_in + 1)){
-                av_log(avctx, AV_LOG_ERROR, "Entropy vars size should be %i, got %i", 6 * (s->stereo_in + 1), size);
-                buf += ssize;
-                continue;
-            }
-            for(j = 0; j <= s->stereo_in; j++){
-                for(i = 0; i < 3; i++){
-                    s->ch[j].median[i] = wp_exp2(AV_RL16(buf));
-                    buf += 2;
-                }
-            }
-            got_entropy = 1;
-            break;
-        case WP_ID_HYBRID:
-            if(s->hybrid_bitrate){
-                for(i = 0; i <= s->stereo_in; i++){
-                    s->ch[i].slow_level = wp_exp2(AV_RL16(buf));
-                    buf += 2;
-                    size -= 2;
-                }
-            }
-            for(i = 0; i < (s->stereo_in + 1); i++){
-                s->ch[i].bitrate_acc = AV_RL16(buf) << 16;
-                buf += 2;
-                size -= 2;
-            }
-            if(size > 0){
-                for(i = 0; i < (s->stereo_in + 1); i++){
-                    s->ch[i].bitrate_delta = wp_exp2((int16_t)AV_RL16(buf));
-                    buf += 2;
-                }
-            }else{
-                for(i = 0; i < (s->stereo_in + 1); i++)
-                    s->ch[i].bitrate_delta = 0;
-            }
-            got_hybrid = 1;
-            break;
-        case WP_ID_INT32INFO:
-            if(size != 4){
-                av_log(avctx, AV_LOG_ERROR, "Invalid INT32INFO, size = %i, sent_bits = %i\n", size, *buf);
-                buf += ssize;
-                continue;
-            }
-            if(buf[0])
-                s->extra_bits = buf[0];
-            else if(buf[1])
-                s->shift = buf[1];
-            else if(buf[2]){
-                s->and = s->or = 1;
-                s->shift = buf[2];
-            }else if(buf[3]){
-                s->and = 1;
-                s->shift = buf[3];
-            }
-            buf += 4;
-            break;
-        case WP_ID_FLOATINFO:
-            if(size != 4){
-                av_log(avctx, AV_LOG_ERROR, "Invalid FLOATINFO, size = %i\n", size);
-                buf += ssize;
-                continue;
-            }
-            s->float_flag = buf[0];
-            s->float_shift = buf[1];
-            s->float_max_exp = buf[2];
-            buf += 4;
-            got_float = 1;
-            break;
-        case WP_ID_DATA:
-            s->sc.offset = buf - avpkt->data;
-            s->sc.size   = size * 8;
-            init_get_bits(&s->gb, buf, size * 8);
-            s->data_size = size * 8;
-            buf += size;
-            got_bs = 1;
-            break;
-        case WP_ID_EXTRABITS:
-            if(size <= 4){
-                av_log(avctx, AV_LOG_ERROR, "Invalid EXTRABITS, size = %i\n", size);
-                buf += size;
-                continue;
-            }
-            s->extra_sc.offset = buf - avpkt->data;
-            s->extra_sc.size   = size * 8;
-            init_get_bits(&s->gb_extra_bits, buf, size * 8);
-            s->crc_extra_bits = get_bits_long(&s->gb_extra_bits, 32);
-            buf += size;
-            s->got_extra_bits = 1;
-            break;
-        default:
-            buf += size;
-        }
-        if(id & WP_IDF_ODD) buf++;
-    }
-    if(!s->samples_left){
-        if(!got_terms){
-            av_log(avctx, AV_LOG_ERROR, "No block with decorrelation terms\n");
-            return -1;
-        }
-        if(!got_weights){
-            av_log(avctx, AV_LOG_ERROR, "No block with decorrelation weights\n");
-            return -1;
-        }
-        if(!got_samples){
-            av_log(avctx, AV_LOG_ERROR, "No block with decorrelation samples\n");
-            return -1;
-        }
-        if(!got_entropy){
-            av_log(avctx, AV_LOG_ERROR, "No block with entropy info\n");
-            return -1;
-        }
-        if(s->hybrid && !got_hybrid){
-            av_log(avctx, AV_LOG_ERROR, "Hybrid config not found\n");
-            return -1;
-        }
-        if(!got_bs){
-            av_log(avctx, AV_LOG_ERROR, "Packed samples not found\n");
-            return -1;
-        }
-        if(!got_float && avctx->sample_fmt == SAMPLE_FMT_FLT){
-            av_log(avctx, AV_LOG_ERROR, "Float information not found\n");
-            return -1;
-        }
-        if(s->got_extra_bits && avctx->sample_fmt != SAMPLE_FMT_FLT){
-            const int size = get_bits_left(&s->gb_extra_bits);
-            const int wanted = s->samples * s->extra_bits << s->stereo_in;
-            if(size < wanted){
-                av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n");
-                s->got_extra_bits = 0;
-            }
-        }
-        s->samples_left = s->samples;
-    }else{
-        init_get_bits(&s->gb, avpkt->data + s->sc.offset, s->sc.size);
-        skip_bits_long(&s->gb, s->sc.bits_used);
-        if(s->got_extra_bits){
-            init_get_bits(&s->gb_extra_bits, avpkt->data + s->extra_sc.offset,
-                          s->extra_sc.size);
-            skip_bits_long(&s->gb_extra_bits, s->extra_sc.bits_used);
-        }
-    }
-
-    if(s->stereo_in){
-        if(avctx->sample_fmt == SAMPLE_FMT_S16)
-            samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_S16);
-        else if(avctx->sample_fmt == SAMPLE_FMT_S32)
-            samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_S32);
-        else
-            samplecount = wv_unpack_stereo(s, &s->gb, samples, SAMPLE_FMT_FLT);
-
-    }else{
-        if(avctx->sample_fmt == SAMPLE_FMT_S16)
-            samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_S16);
-        else if(avctx->sample_fmt == SAMPLE_FMT_S32)
-            samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_S32);
-        else
-            samplecount = wv_unpack_mono(s, &s->gb, samples, SAMPLE_FMT_FLT);
-
-        if(s->stereo && avctx->sample_fmt == SAMPLE_FMT_S16){
-            int16_t *dst = (int16_t*)samples + samplecount * 2;
-            int16_t *src = (int16_t*)samples + samplecount;
-            int cnt = samplecount;
-            while(cnt--){
-                *--dst = *--src;
-                *--dst = *src;
-            }
-            samplecount *= 2;
-        }else if(s->stereo && avctx->sample_fmt == SAMPLE_FMT_S32){
-            int32_t *dst = (int32_t*)samples + samplecount * 2;
-            int32_t *src = (int32_t*)samples + samplecount;
-            int cnt = samplecount;
-            while(cnt--){
-                *--dst = *--src;
-                *--dst = *src;
-            }
-            samplecount *= 2;
-        }else if(s->stereo){
-            float *dst = (float*)samples + samplecount * 2;
-            float *src = (float*)samples + samplecount;
-            int cnt = samplecount;
-            while(cnt--){
-                *--dst = *--src;
-                *--dst = *src;
-            }
-            samplecount *= 2;
-        }
-    }
-    *data_size = samplecount * bpp;
-
-    return s->samples_left > 0 ? 0 : buf_size;
-}
-
-AVCodec wavpack_decoder = {
-    "wavpack",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WAVPACK,
-    sizeof(WavpackContext),
-    wavpack_decode_init,
-    NULL,
-    NULL,
-    wavpack_decode_frame,
-    .capabilities = CODEC_CAP_SUBFRAMES,
-    .long_name = NULL_IF_CONFIG_SMALL("WavPack"),
-};
diff --git a/libavcodec/wma.c b/libavcodec/wma.c
deleted file mode 100644
index 6578045..0000000
--- a/libavcodec/wma.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * WMA compatible codec
- * Copyright (c) 2002-2007 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "wma.h"
-#include "wmadata.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-/* XXX: use same run/length optimization as mpeg decoders */
-//FIXME maybe split decode / encode or pass flag
-static void init_coef_vlc(VLC *vlc, uint16_t **prun_table,
-                          float **plevel_table, uint16_t **pint_table,
-                          const CoefVLCTable *vlc_table)
-{
-    int n = vlc_table->n;
-    const uint8_t  *table_bits   = vlc_table->huffbits;
-    const uint32_t *table_codes  = vlc_table->huffcodes;
-    const uint16_t *levels_table = vlc_table->levels;
-    uint16_t *run_table, *level_table, *int_table;
-    float *flevel_table;
-    int i, l, j, k, level;
-
-    init_vlc(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0);
-
-    run_table   = av_malloc(n * sizeof(uint16_t));
-    level_table = av_malloc(n * sizeof(uint16_t));
-    flevel_table= av_malloc(n * sizeof(*flevel_table));
-    int_table   = av_malloc(n * sizeof(uint16_t));
-    i = 2;
-    level = 1;
-    k = 0;
-    while (i < n) {
-        int_table[k] = i;
-        l = levels_table[k++];
-        for (j = 0; j < l; j++) {
-            run_table[i]   = j;
-            level_table[i] = level;
-            flevel_table[i]= level;
-            i++;
-        }
-        level++;
-    }
-    *prun_table   = run_table;
-    *plevel_table = flevel_table;
-    *pint_table   = int_table;
-    av_free(level_table);
-}
-
-/**
- *@brief Get the samples per frame for this stream.
- *@param sample_rate output sample_rate
- *@param version wma version
- *@param decode_flags codec compression features
- *@return log2 of the number of output samples per frame
- */
-int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
-                                      unsigned int decode_flags)
-{
-
-    int frame_len_bits;
-
-    if (sample_rate <= 16000) {
-        frame_len_bits = 9;
-    } else if (sample_rate <= 22050 ||
-             (sample_rate <= 32000 && version == 1)) {
-        frame_len_bits = 10;
-    } else if (sample_rate <= 48000) {
-        frame_len_bits = 11;
-    } else if (sample_rate <= 96000) {
-        frame_len_bits = 12;
-    } else {
-        frame_len_bits = 13;
-    }
-
-    if (version == 3) {
-        int tmp = decode_flags & 0x6;
-        if (tmp == 0x2) {
-            ++frame_len_bits;
-        } else if (tmp == 0x4) {
-            --frame_len_bits;
-        } else if (tmp == 0x6) {
-            frame_len_bits -= 2;
-        }
-    }
-
-    return frame_len_bits;
-}
-
-int ff_wma_init(AVCodecContext *avctx, int flags2)
-{
-    WMACodecContext *s = avctx->priv_data;
-    int i;
-    float bps1, high_freq;
-    volatile float bps;
-    int sample_rate1;
-    int coef_vlc_table;
-
-    if (   avctx->sample_rate <= 0 || avctx->sample_rate > 50000
-        || avctx->channels    <= 0 || avctx->channels    > 8
-        || avctx->bit_rate    <= 0)
-        return -1;
-
-    s->sample_rate = avctx->sample_rate;
-    s->nb_channels = avctx->channels;
-    s->bit_rate    = avctx->bit_rate;
-    s->block_align = avctx->block_align;
-
-    dsputil_init(&s->dsp, avctx);
-
-    if (avctx->codec->id == CODEC_ID_WMAV1) {
-        s->version = 1;
-    } else {
-        s->version = 2;
-    }
-
-    /* compute MDCT block size */
-    s->frame_len_bits = ff_wma_get_frame_len_bits(s->sample_rate, s->version, 0);
-
-    s->frame_len = 1 << s->frame_len_bits;
-    if (s->use_variable_block_len) {
-        int nb_max, nb;
-        nb = ((flags2 >> 3) & 3) + 1;
-        if ((s->bit_rate / s->nb_channels) >= 32000)
-            nb += 2;
-        nb_max = s->frame_len_bits - BLOCK_MIN_BITS;
-        if (nb > nb_max)
-            nb = nb_max;
-        s->nb_block_sizes = nb + 1;
-    } else {
-        s->nb_block_sizes = 1;
-    }
-
-    /* init rate dependent parameters */
-    s->use_noise_coding = 1;
-    high_freq = s->sample_rate * 0.5;
-
-    /* if version 2, then the rates are normalized */
-    sample_rate1 = s->sample_rate;
-    if (s->version == 2) {
-        if (sample_rate1 >= 44100) {
-            sample_rate1 = 44100;
-        } else if (sample_rate1 >= 22050) {
-            sample_rate1 = 22050;
-        } else if (sample_rate1 >= 16000) {
-            sample_rate1 = 16000;
-        } else if (sample_rate1 >= 11025) {
-            sample_rate1 = 11025;
-        } else if (sample_rate1 >= 8000) {
-            sample_rate1 = 8000;
-        }
-    }
-
-    bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate);
-    s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2;
-
-    /* compute high frequency value and choose if noise coding should
-       be activated */
-    bps1 = bps;
-    if (s->nb_channels == 2)
-        bps1 = bps * 1.6;
-    if (sample_rate1 == 44100) {
-        if (bps1 >= 0.61) {
-            s->use_noise_coding = 0;
-        } else {
-            high_freq = high_freq * 0.4;
-        }
-    } else if (sample_rate1 == 22050) {
-        if (bps1 >= 1.16) {
-            s->use_noise_coding = 0;
-        } else if (bps1 >= 0.72) {
-            high_freq = high_freq * 0.7;
-        } else {
-            high_freq = high_freq * 0.6;
-        }
-    } else if (sample_rate1 == 16000) {
-        if (bps > 0.5) {
-            high_freq = high_freq * 0.5;
-        } else {
-            high_freq = high_freq * 0.3;
-        }
-    } else if (sample_rate1 == 11025) {
-        high_freq = high_freq * 0.7;
-    } else if (sample_rate1 == 8000) {
-        if (bps <= 0.625) {
-            high_freq = high_freq * 0.5;
-        } else if (bps > 0.75) {
-            s->use_noise_coding = 0;
-        } else {
-            high_freq = high_freq * 0.65;
-        }
-    } else {
-        if (bps >= 0.8) {
-            high_freq = high_freq * 0.75;
-        } else if (bps >= 0.6) {
-            high_freq = high_freq * 0.6;
-        } else {
-            high_freq = high_freq * 0.5;
-        }
-    }
-    dprintf(s->avctx, "flags2=0x%x\n", flags2);
-    dprintf(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
-            s->version, s->nb_channels, s->sample_rate, s->bit_rate,
-            s->block_align);
-    dprintf(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
-            bps, bps1, high_freq, s->byte_offset_bits);
-    dprintf(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n",
-            s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes);
-
-    /* compute the scale factor band sizes for each MDCT block size */
-    {
-        int a, b, pos, lpos, k, block_len, i, j, n;
-        const uint8_t *table;
-
-        if (s->version == 1) {
-            s->coefs_start = 3;
-        } else {
-            s->coefs_start = 0;
-        }
-        for (k = 0; k < s->nb_block_sizes; k++) {
-            block_len = s->frame_len >> k;
-
-            if (s->version == 1) {
-                lpos = 0;
-                for (i = 0; i < 25; i++) {
-                    a = ff_wma_critical_freqs[i];
-                    b = s->sample_rate;
-                    pos = ((block_len * 2 * a) + (b >> 1)) / b;
-                    if (pos > block_len)
-                        pos = block_len;
-                    s->exponent_bands[0][i] = pos - lpos;
-                    if (pos >= block_len) {
-                        i++;
-                        break;
-                    }
-                    lpos = pos;
-                }
-                s->exponent_sizes[0] = i;
-            } else {
-                /* hardcoded tables */
-                table = NULL;
-                a = s->frame_len_bits - BLOCK_MIN_BITS - k;
-                if (a < 3) {
-                    if (s->sample_rate >= 44100) {
-                        table = exponent_band_44100[a];
-                    } else if (s->sample_rate >= 32000) {
-                        table = exponent_band_32000[a];
-                    } else if (s->sample_rate >= 22050) {
-                        table = exponent_band_22050[a];
-                    }
-                }
-                if (table) {
-                    n = *table++;
-                    for (i = 0; i < n; i++)
-                        s->exponent_bands[k][i] = table[i];
-                    s->exponent_sizes[k] = n;
-                } else {
-                    j = 0;
-                    lpos = 0;
-                    for (i = 0; i < 25; i++) {
-                        a = ff_wma_critical_freqs[i];
-                        b = s->sample_rate;
-                        pos = ((block_len * 2 * a) + (b << 1)) / (4 * b);
-                        pos <<= 2;
-                        if (pos > block_len)
-                            pos = block_len;
-                        if (pos > lpos)
-                            s->exponent_bands[k][j++] = pos - lpos;
-                        if (pos >= block_len)
-                            break;
-                        lpos = pos;
-                    }
-                    s->exponent_sizes[k] = j;
-                }
-            }
-
-            /* max number of coefs */
-            s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k;
-            /* high freq computation */
-            s->high_band_start[k] = (int)((block_len * 2 * high_freq) /
-                                          s->sample_rate + 0.5);
-            n = s->exponent_sizes[k];
-            j = 0;
-            pos = 0;
-            for (i = 0; i < n; i++) {
-                int start, end;
-                start = pos;
-                pos += s->exponent_bands[k][i];
-                end = pos;
-                if (start < s->high_band_start[k])
-                    start = s->high_band_start[k];
-                if (end > s->coefs_end[k])
-                    end = s->coefs_end[k];
-                if (end > start)
-                    s->exponent_high_bands[k][j++] = end - start;
-            }
-            s->exponent_high_sizes[k] = j;
-#if 0
-            tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ",
-                    s->frame_len >> k,
-                    s->coefs_end[k],
-                    s->high_band_start[k],
-                    s->exponent_high_sizes[k]);
-            for (j = 0; j < s->exponent_high_sizes[k]; j++)
-                tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]);
-            tprintf(s->avctx, "\n");
-#endif
-        }
-    }
-
-#ifdef TRACE
-    {
-        int i, j;
-        for (i = 0; i < s->nb_block_sizes; i++) {
-            tprintf(s->avctx, "%5d: n=%2d:",
-                    s->frame_len >> i,
-                    s->exponent_sizes[i]);
-            for (j = 0; j < s->exponent_sizes[i]; j++)
-                tprintf(s->avctx, " %d", s->exponent_bands[i][j]);
-            tprintf(s->avctx, "\n");
-        }
-    }
-#endif
-
-    /* init MDCT windows : simple sinus window */
-    for (i = 0; i < s->nb_block_sizes; i++) {
-        ff_init_ff_sine_windows(s->frame_len_bits - i);
-        s->windows[i] = ff_sine_windows[s->frame_len_bits - i];
-    }
-
-    s->reset_block_lengths = 1;
-
-    if (s->use_noise_coding) {
-
-        /* init the noise generator */
-        if (s->use_exp_vlc) {
-            s->noise_mult = 0.02;
-        } else {
-            s->noise_mult = 0.04;
-        }
-
-#ifdef TRACE
-        for (i = 0; i < NOISE_TAB_SIZE; i++)
-            s->noise_table[i] = 1.0 * s->noise_mult;
-#else
-        {
-            unsigned int seed;
-            float norm;
-            seed = 1;
-            norm = (1.0 / (float)(1LL << 31)) * sqrt(3) * s->noise_mult;
-            for (i = 0; i < NOISE_TAB_SIZE; i++) {
-                seed = seed * 314159 + 1;
-                s->noise_table[i] = (float)((int)seed) * norm;
-            }
-        }
-#endif
-    }
-
-    /* choose the VLC tables for the coefficients */
-    coef_vlc_table = 2;
-    if (s->sample_rate >= 32000) {
-        if (bps1 < 0.72) {
-            coef_vlc_table = 0;
-        } else if (bps1 < 1.16) {
-            coef_vlc_table = 1;
-        }
-    }
-    s->coef_vlcs[0]= &coef_vlcs[coef_vlc_table * 2    ];
-    s->coef_vlcs[1]= &coef_vlcs[coef_vlc_table * 2 + 1];
-    init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0], &s->int_table[0],
-                  s->coef_vlcs[0]);
-    init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1], &s->int_table[1],
-                  s->coef_vlcs[1]);
-
-    return 0;
-}
-
-int ff_wma_total_gain_to_bits(int total_gain)
-{
-         if (total_gain < 15) return 13;
-    else if (total_gain < 32) return 12;
-    else if (total_gain < 40) return 11;
-    else if (total_gain < 45) return 10;
-    else                      return  9;
-}
-
-int ff_wma_end(AVCodecContext *avctx)
-{
-    WMACodecContext *s = avctx->priv_data;
-    int i;
-
-    for (i = 0; i < s->nb_block_sizes; i++)
-        ff_mdct_end(&s->mdct_ctx[i]);
-
-    if (s->use_exp_vlc) {
-        free_vlc(&s->exp_vlc);
-    }
-    if (s->use_noise_coding) {
-        free_vlc(&s->hgain_vlc);
-    }
-    for (i = 0; i < 2; i++) {
-        free_vlc(&s->coef_vlc[i]);
-        av_free(s->run_table[i]);
-        av_free(s->level_table[i]);
-        av_free(s->int_table[i]);
-    }
-
-    return 0;
-}
-
-/**
- * Decode an uncompressed coefficient.
- * @param s codec context
- * @return the decoded coefficient
- */
-unsigned int ff_wma_get_large_val(GetBitContext* gb)
-{
-    /** consumes up to 34 bits */
-    int n_bits = 8;
-    /** decode length */
-    if (get_bits1(gb)) {
-        n_bits += 8;
-        if (get_bits1(gb)) {
-            n_bits += 8;
-            if (get_bits1(gb)) {
-                n_bits += 7;
-            }
-        }
-    }
-    return get_bits_long(gb, n_bits);
-}
-
-/**
- * Decode run level compressed coefficients.
- * @param avctx codec context
- * @param gb bitstream reader context
- * @param vlc vlc table for get_vlc2
- * @param level_table level codes
- * @param run_table run codes
- * @param version 0 for wma1,2 1 for wmapro
- * @param ptr output buffer
- * @param offset offset in the output buffer
- * @param num_coefs number of input coefficents
- * @param block_len input buffer length (2^n)
- * @param frame_len_bits number of bits for escaped run codes
- * @param coef_nb_bits number of bits for escaped level codes
- * @return 0 on success, -1 otherwise
- */
-int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb,
-                            VLC *vlc,
-                            const float *level_table, const uint16_t *run_table,
-                            int version, WMACoef *ptr, int offset,
-                            int num_coefs, int block_len, int frame_len_bits,
-                            int coef_nb_bits)
-{
-    int code, level, sign;
-    const uint32_t *ilvl = (const uint32_t*)level_table;
-    uint32_t *iptr = (uint32_t*)ptr;
-    const unsigned int coef_mask = block_len - 1;
-    for (; offset < num_coefs; offset++) {
-        code = get_vlc2(gb, vlc->table, VLCBITS, VLCMAX);
-        if (code > 1) {
-            /** normal code */
-            offset += run_table[code];
-            sign = get_bits1(gb) - 1;
-            iptr[offset & coef_mask] = ilvl[code] ^ sign<<31;
-        } else if (code == 1) {
-            /** EOB */
-            break;
-        } else {
-            /** escape */
-            if (!version) {
-                level = get_bits(gb, coef_nb_bits);
-                /** NOTE: this is rather suboptimal. reading
-                    block_len_bits would be better */
-                offset += get_bits(gb, frame_len_bits);
-            } else {
-                level = ff_wma_get_large_val(gb);
-                /** escape decode */
-                if (get_bits1(gb)) {
-                    if (get_bits1(gb)) {
-                        if (get_bits1(gb)) {
-                            av_log(avctx,AV_LOG_ERROR,
-                                "broken escape sequence\n");
-                            return -1;
-                        } else
-                            offset += get_bits(gb, frame_len_bits) + 4;
-                    } else
-                        offset += get_bits(gb, 2) + 1;
-                }
-            }
-            sign = get_bits1(gb) - 1;
-            ptr[offset & coef_mask] = (level^sign) - sign;
-        }
-    }
-    /** NOTE: EOB can be omitted */
-    if (offset > num_coefs) {
-        av_log(avctx, AV_LOG_ERROR, "overflow in spectral RLE, ignoring\n");
-        return -1;
-    }
-
-    return 0;
-}
-
diff --git a/libavcodec/wma.h b/libavcodec/wma.h
deleted file mode 100644
index 11274ad..0000000
--- a/libavcodec/wma.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * WMA compatible codec
- * Copyright (c) 2002-2007 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_WMA_H
-#define AVCODEC_WMA_H
-
-#include "get_bits.h"
-#include "put_bits.h"
-#include "dsputil.h"
-#include "fft.h"
-
-/* size of blocks */
-#define BLOCK_MIN_BITS 7
-#define BLOCK_MAX_BITS 11
-#define BLOCK_MAX_SIZE (1 << BLOCK_MAX_BITS)
-
-#define BLOCK_NB_SIZES (BLOCK_MAX_BITS - BLOCK_MIN_BITS + 1)
-
-/* XXX: find exact max size */
-#define HIGH_BAND_MAX_SIZE 16
-
-#define NB_LSP_COEFS 10
-
-/* XXX: is it a suitable value ? */
-#define MAX_CODED_SUPERFRAME_SIZE 16384
-
-#define MAX_CHANNELS 2
-
-#define NOISE_TAB_SIZE 8192
-
-#define LSP_POW_BITS 7
-
-//FIXME should be in wmadec
-#define VLCBITS 9
-#define VLCMAX ((22+VLCBITS-1)/VLCBITS)
-
-typedef float WMACoef;          ///< type for decoded coefficients, int16_t would be enough for wma 1/2
-
-typedef struct CoefVLCTable {
-    int n;                      ///< total number of codes
-    int max_level;
-    const uint32_t *huffcodes;  ///< VLC bit values
-    const uint8_t *huffbits;    ///< VLC bit size
-    const uint16_t *levels;     ///< table to build run/level tables
-} CoefVLCTable;
-
-typedef struct WMACodecContext {
-    AVCodecContext* avctx;
-    GetBitContext gb;
-    PutBitContext pb;
-    int sample_rate;
-    int nb_channels;
-    int bit_rate;
-    int version;                            ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2)
-    int block_align;
-    int use_bit_reservoir;
-    int use_variable_block_len;
-    int use_exp_vlc;                        ///< exponent coding: 0 = lsp, 1 = vlc + delta
-    int use_noise_coding;                   ///< true if perceptual noise is added
-    int byte_offset_bits;
-    VLC exp_vlc;
-    int exponent_sizes[BLOCK_NB_SIZES];
-    uint16_t exponent_bands[BLOCK_NB_SIZES][25];
-    int high_band_start[BLOCK_NB_SIZES];    ///< index of first coef in high band
-    int coefs_start;                        ///< first coded coef
-    int coefs_end[BLOCK_NB_SIZES];          ///< max number of coded coefficients
-    int exponent_high_sizes[BLOCK_NB_SIZES];
-    int exponent_high_bands[BLOCK_NB_SIZES][HIGH_BAND_MAX_SIZE];
-    VLC hgain_vlc;
-
-    /* coded values in high bands */
-    int high_band_coded[MAX_CHANNELS][HIGH_BAND_MAX_SIZE];
-    int high_band_values[MAX_CHANNELS][HIGH_BAND_MAX_SIZE];
-
-    /* there are two possible tables for spectral coefficients */
-//FIXME the following 3 tables should be shared between decoders
-    VLC coef_vlc[2];
-    uint16_t *run_table[2];
-    float *level_table[2];
-    uint16_t *int_table[2];
-    const CoefVLCTable *coef_vlcs[2];
-    /* frame info */
-    int frame_len;                          ///< frame length in samples
-    int frame_len_bits;                     ///< frame_len = 1 << frame_len_bits
-    int nb_block_sizes;                     ///< number of block sizes
-    /* block info */
-    int reset_block_lengths;
-    int block_len_bits;                     ///< log2 of current block length
-    int next_block_len_bits;                ///< log2 of next block length
-    int prev_block_len_bits;                ///< log2 of prev block length
-    int block_len;                          ///< block length in samples
-    int block_num;                          ///< block number in current frame
-    int block_pos;                          ///< current position in frame
-    uint8_t ms_stereo;                      ///< true if mid/side stereo mode
-    uint8_t channel_coded[MAX_CHANNELS];    ///< true if channel is coded
-    int exponents_bsize[MAX_CHANNELS];      ///< log2 ratio frame/exp. length
-    DECLARE_ALIGNED(16, float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE];
-    float max_exponent[MAX_CHANNELS];
-    WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
-    DECLARE_ALIGNED(16, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE];
-    DECLARE_ALIGNED(16, FFTSample, output)[BLOCK_MAX_SIZE * 2];
-    FFTContext mdct_ctx[BLOCK_NB_SIZES];
-    float *windows[BLOCK_NB_SIZES];
-    /* output buffer for one frame and the last for IMDCT windowing */
-    DECLARE_ALIGNED(16, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2];
-    /* last frame info */
-    uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */
-    int last_bitoffset;
-    int last_superframe_len;
-    float noise_table[NOISE_TAB_SIZE];
-    int noise_index;
-    float noise_mult; /* XXX: suppress that and integrate it in the noise array */
-    /* lsp_to_curve tables */
-    float lsp_cos_table[BLOCK_MAX_SIZE];
-    float lsp_pow_e_table[256];
-    float lsp_pow_m_table1[(1 << LSP_POW_BITS)];
-    float lsp_pow_m_table2[(1 << LSP_POW_BITS)];
-    DSPContext dsp;
-
-#ifdef TRACE
-    int frame_count;
-#endif
-} WMACodecContext;
-
-extern const uint16_t ff_wma_critical_freqs[25];
-extern const uint16_t ff_wma_hgain_huffcodes[37];
-extern const uint8_t ff_wma_hgain_huffbits[37];
-extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16];
-extern const uint32_t ff_aac_scalefactor_code[121];
-extern const uint8_t  ff_aac_scalefactor_bits[121];
-
-int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
-                                      unsigned int decode_flags);
-int ff_wma_init(AVCodecContext * avctx, int flags2);
-int ff_wma_total_gain_to_bits(int total_gain);
-int ff_wma_end(AVCodecContext *avctx);
-unsigned int ff_wma_get_large_val(GetBitContext* gb);
-int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb,
-                            VLC *vlc,
-                            const float *level_table, const uint16_t *run_table,
-                            int version, WMACoef *ptr, int offset,
-                            int num_coefs, int block_len, int frame_len_bits,
-                            int coef_nb_bits);
-
-#endif /* AVCODEC_WMA_H */
diff --git a/libavcodec/wmadata.h b/libavcodec/wmadata.h
deleted file mode 100644
index 381f182..0000000
--- a/libavcodec/wmadata.h
+++ /dev/null
@@ -1,1403 +0,0 @@
-/*
- * WMA compatible decoder
- * copyright (c) 2002 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Various WMA tables.
- */
-
-#ifndef AVCODEC_WMADATA_H
-#define AVCODEC_WMADATA_H
-
-#include <stdint.h>
-#include "wma.h"
-
-const uint16_t ff_wma_critical_freqs[25] = {
-    100,   200,  300, 400,   510,  630,  770,    920,
-    1080, 1270, 1480, 1720, 2000, 2320, 2700,   3150,
-    3700, 4400, 5300, 6400, 7700, 9500, 12000, 15500,
-    24500,
-};
-
-/* first value is number of bands */
-static const uint8_t exponent_band_22050[3][25] = {
-    { 10, 4, 8, 4, 8, 8, 12, 20, 24, 24, 16, },
-    { 14, 4, 8, 8, 4, 12, 12, 16, 24, 16, 20, 24, 32, 40, 36, },
-    { 23, 4, 4, 4, 8, 4, 4, 8, 8, 8, 8, 8, 12, 12, 16, 16, 24, 24, 32, 44, 48, 60, 84, 72, },
-};
-
-static const uint8_t exponent_band_32000[3][25] = {
-    { 11, 4, 4, 8, 4, 4, 12, 16, 24, 20, 28, 4, },
-    { 15, 4, 8, 4, 4, 8, 8, 16, 20, 12, 20, 20, 28, 40, 56, 8, },
-    { 16, 8, 4, 8, 8, 12, 16, 20, 24, 40, 32, 32, 44, 56, 80, 112, 16, },
-};
-
-static const uint8_t exponent_band_44100[3][25] = {
-    { 12,  4,   4,   4,   4,   4,   8,   8,   8,  12,  16,  20,  36, },
-    { 15,  4,   8,   4,   8,   8,   4,   8,   8,  12,  12,  12,  24,  28,  40,  76, },
-    { 17,  4,   8,   8,   4,  12,  12,   8,   8,  24,  16,  20,  24,  32,  40,  60,  80, 152, },
-};
-
-const uint16_t ff_wma_hgain_huffcodes[37] = {
- 0x00003, 0x002e7, 0x00001, 0x005cd, 0x0005d, 0x005c9, 0x0005e, 0x00003,
- 0x00016, 0x0000b, 0x00001, 0x00006, 0x00001, 0x00006, 0x00004, 0x00005,
- 0x00004, 0x00007, 0x00003, 0x00007, 0x00004, 0x0000a, 0x0000a, 0x00002,
- 0x00003, 0x00000, 0x00005, 0x00002, 0x0005f, 0x00004, 0x00003, 0x00002,
- 0x005c8, 0x000b8, 0x005ca, 0x005cb, 0x005cc,
-};
-
-const uint8_t ff_wma_hgain_huffbits[37] = {
- 10, 12, 10, 13,  9, 13,  9,  8,
-  7,  5,  5,  4,  4,  3,  3,  3,
-  4,  3,  4,  4,  5,  5,  6,  8,
-  7, 10,  8, 10,  9,  8,  9,  9,
- 13, 10, 13, 13, 13,
-};
-
-const float ff_wma_lsp_codebook[NB_LSP_COEFS][16] = {
- { 1.98732877, 1.97944528, 1.97179088, 1.96260549, 1.95038374, 1.93336114, 1.90719232, 1.86191415, },
- { 1.97260000, 1.96083160, 1.94982586, 1.93806164, 1.92516608, 1.91010199, 1.89232331, 1.87149812,
-   1.84564818, 1.81358067, 1.77620070, 1.73265264, 1.67907855, 1.60959081, 1.50829650, 1.33120330, },
- { 1.90109110, 1.86482426, 1.83419671, 1.80168452, 1.76650116, 1.72816320, 1.68502700, 1.63738256,
-   1.58501580, 1.51795181, 1.43679906, 1.33950585, 1.24176208, 1.12260729, 0.96749668, 0.74048265, },
- { 1.76943864, 1.67822463, 1.59946365, 1.53560582, 1.47470796, 1.41210167, 1.34509536, 1.27339507,
-   1.19303814, 1.09765169, 0.98818722, 0.87239446, 0.74369172, 0.59768184, 0.43168630, 0.17977021, },
- { 1.43428349, 1.32038354, 1.21074086, 1.10577988, 1.00561746, 0.90335924, 0.80437489, 0.70709671,
-   0.60427395, 0.49814048, 0.38509539, 0.27106800, 0.14407416, 0.00219910, -0.16725141, -0.36936085, },
- { 0.99895687, 0.84188166, 0.70753739, 0.57906595, 0.47055563, 0.36966965, 0.26826648, 0.17163380,
-   0.07208392, -0.03062936, -1.40037388, -0.25128968, -0.37213937, -0.51075646, -0.64887512, -0.80308031, },
- { 0.26515280, 0.06313551, -0.08872080, -0.21103548, -0.31069678, -0.39680323, -0.47223474, -0.54167135,
-   -0.61444740, -0.68943343, -0.76580211, -0.85170082, -0.95289061, -1.06514703, -1.20510707, -1.37617746, },
- { -0.53940301, -0.73770929, -0.88424876, -1.01117930, -1.13389091, -1.26830073, -1.42041987, -1.62033919,
-   -1.10158808, -1.16512566, -1.23337128, -1.30414401, -1.37663312, -1.46853845, -1.57625798, -1.66893638, },
- { -0.38601997, -0.56009350, -0.66978483, -0.76028471, -0.83846064, -0.90868087, -0.97408881, -1.03694962, },
- { -1.56144989, -1.65944032, -1.72689685, -1.77857740, -1.82203011, -1.86220079, -1.90283983, -1.94820479, },
-};
-
-static const uint32_t coef0_huffcodes[666] = {
- 0x00258, 0x0003d, 0x00000, 0x00005, 0x00008, 0x00008, 0x0000c, 0x0001b,
- 0x0001f, 0x00015, 0x00024, 0x00032, 0x0003a, 0x00026, 0x0002c, 0x0002f,
- 0x0004a, 0x0004d, 0x00061, 0x00070, 0x00073, 0x00048, 0x00052, 0x0005a,
- 0x0005d, 0x0006e, 0x00099, 0x0009e, 0x000c1, 0x000ce, 0x000e4, 0x000f0,
- 0x00093, 0x0009e, 0x000a2, 0x000a1, 0x000b8, 0x000d2, 0x000d3, 0x0012e,
- 0x00130, 0x000de, 0x0012d, 0x0019b, 0x001e4, 0x00139, 0x0013a, 0x0013f,
- 0x0014f, 0x0016d, 0x001a2, 0x0027c, 0x0027e, 0x00332, 0x0033c, 0x0033f,
- 0x0038b, 0x00396, 0x003c5, 0x00270, 0x0027c, 0x0025a, 0x00395, 0x00248,
- 0x004bd, 0x004fb, 0x00662, 0x00661, 0x0071b, 0x004e6, 0x004ff, 0x00666,
- 0x0071c, 0x0071a, 0x0071f, 0x00794, 0x00536, 0x004e2, 0x0078e, 0x004ee,
- 0x00518, 0x00535, 0x004fb, 0x0078d, 0x00530, 0x00680, 0x0068f, 0x005cb,
- 0x00965, 0x006a6, 0x00967, 0x0097f, 0x00682, 0x006ae, 0x00cd0, 0x00e28,
- 0x00f13, 0x00f1f, 0x009f5, 0x00cd3, 0x00f11, 0x00926, 0x00964, 0x00f32,
- 0x00f12, 0x00f30, 0x00966, 0x00d0b, 0x00a68, 0x00b91, 0x009c7, 0x00b73,
- 0x012fa, 0x0131d, 0x013f9, 0x01ca0, 0x0199c, 0x01c7a, 0x0198c, 0x01248,
- 0x01c74, 0x01c64, 0x0139e, 0x012fd, 0x00a77, 0x012fc, 0x01c7b, 0x012ca,
- 0x014cc, 0x014d2, 0x014e3, 0x014dc, 0x012dc, 0x03344, 0x02598, 0x0263c,
- 0x0333b, 0x025e6, 0x01a1c, 0x01e3c, 0x014e2, 0x033d4, 0x01a11, 0x03349,
- 0x03cce, 0x014e1, 0x01a34, 0x0273e, 0x02627, 0x0273f, 0x038ee, 0x03971,
- 0x03c67, 0x03c61, 0x0333d, 0x038c2, 0x0263f, 0x038cd, 0x02638, 0x02e41,
- 0x0351f, 0x03348, 0x03c66, 0x03562, 0x02989, 0x027d5, 0x0333c, 0x02e4f,
- 0x0343b, 0x02ddf, 0x04bc8, 0x029c0, 0x02e57, 0x04c72, 0x025b7, 0x03547,
- 0x03540, 0x029d3, 0x04c45, 0x025bb, 0x06600, 0x04c73, 0x04bce, 0x0357b,
- 0x029a6, 0x029d2, 0x0263e, 0x0298a, 0x07183, 0x06602, 0x07958, 0x04b66,
- 0x0537d, 0x05375, 0x04fe9, 0x04b67, 0x0799f, 0x04bc9, 0x051fe, 0x06a3b,
- 0x05bb6, 0x04fa8, 0x0728f, 0x05376, 0x0492c, 0x0537e, 0x0795a, 0x06a3c,
- 0x0e515, 0x07887, 0x0683a, 0x051f9, 0x051fd, 0x0cc6a, 0x06a8a, 0x0cc6d,
- 0x05bb3, 0x0683b, 0x051fc, 0x05378, 0x0728e, 0x07886, 0x05bb7, 0x0f2a4,
- 0x0795b, 0x0683c, 0x09fc1, 0x0683d, 0x0b752, 0x09678, 0x0a3e8, 0x06ac7,
- 0x051f0, 0x0b759, 0x06af3, 0x04b6b, 0x0f2a0, 0x0f2ad, 0x096c3, 0x0e518,
- 0x0b75c, 0x0d458, 0x0cc6b, 0x0537c, 0x067aa, 0x04fea, 0x0343a, 0x0cc71,
- 0x0967f, 0x09fc4, 0x096c2, 0x0e516, 0x0f2a1, 0x0d45c, 0x0d45d, 0x0d45e,
- 0x12fb9, 0x0967e, 0x1982f, 0x09883, 0x096c4, 0x0b753, 0x12fb8, 0x0f2a8,
- 0x1ca21, 0x096c5, 0x0e51a, 0x1ca27, 0x12f3c, 0x0d471, 0x0f2aa, 0x0b75b,
- 0x12fbb, 0x0f2a9, 0x0f2ac, 0x0d45a, 0x0b74f, 0x096c8, 0x16e91, 0x096ca,
- 0x12fbf, 0x0d0a7, 0x13103, 0x0d516, 0x16e99, 0x12cbd, 0x0a3ea, 0x19829,
- 0x0b755, 0x29ba7, 0x1ca28, 0x29ba5, 0x16e93, 0x1982c, 0x19828, 0x25994,
- 0x0a3eb, 0x1ca29, 0x16e90, 0x1ca25, 0x1982d, 0x1ca26, 0x16e9b, 0x0b756,
- 0x0967c, 0x25997, 0x0b75f, 0x198d3, 0x0b757, 0x19a2a, 0x0d45b, 0x0e517,
- 0x1ca24, 0x1ca23, 0x1ca22, 0x0b758, 0x16e97, 0x0cd14, 0x13100, 0x00007,
- 0x0003b, 0x0006b, 0x00097, 0x00138, 0x00125, 0x00173, 0x00258, 0x00335,
- 0x0028e, 0x004c6, 0x00715, 0x00729, 0x004ef, 0x00519, 0x004ed, 0x00532,
- 0x0068c, 0x00686, 0x00978, 0x00e5d, 0x00e31, 0x009f4, 0x00b92, 0x012f8,
- 0x00d06, 0x00a67, 0x00d44, 0x00a76, 0x00d59, 0x012cd, 0x01c78, 0x01c75,
- 0x0199f, 0x0198f, 0x01c67, 0x014c6, 0x01c79, 0x01c76, 0x00b94, 0x00d1b,
- 0x01e32, 0x01e31, 0x01ab0, 0x01a05, 0x01aa1, 0x0333a, 0x025e5, 0x02626,
- 0x03541, 0x03544, 0x03421, 0x03546, 0x02e55, 0x02e56, 0x0492d, 0x02dde,
- 0x0299b, 0x02ddc, 0x0357a, 0x0249c, 0x0668b, 0x1c77f, 0x1ca20, 0x0d45f,
- 0x09886, 0x16e9a, 0x0f2a7, 0x0b751, 0x0a3ee, 0x0cf59, 0x0cf57, 0x0b754,
- 0x0d0a6, 0x16e98, 0x0b760, 0x06ac6, 0x0a3f0, 0x12fbe, 0x13104, 0x0f2a5,
- 0x0a3ef, 0x0d472, 0x12cba, 0x1982e, 0x16e9c, 0x1c77e, 0x198d0, 0x13105,
- 0x16e92, 0x0b75d, 0x0d459, 0x0001a, 0x000c0, 0x0016c, 0x003cd, 0x00350,
- 0x0067b, 0x0051e, 0x006a9, 0x009f4, 0x00b72, 0x00d09, 0x01249, 0x01e3d,
- 0x01ca1, 0x01a1f, 0x01721, 0x01a8a, 0x016e8, 0x03347, 0x01a35, 0x0249d,
- 0x0299a, 0x02596, 0x02e4e, 0x0298b, 0x07182, 0x04c46, 0x025ba, 0x02e40,
- 0x027d6, 0x04fe8, 0x06607, 0x05310, 0x09884, 0x072e1, 0x06a3d, 0x04b6a,
- 0x04c7a, 0x06603, 0x04c7b, 0x03428, 0x06605, 0x09664, 0x09fc0, 0x071de,
- 0x06601, 0x05bb2, 0x09885, 0x0a3e2, 0x1c61f, 0x12cbb, 0x0b750, 0x0cf58,
- 0x0967d, 0x25995, 0x668ad, 0x0b75a, 0x09fc2, 0x0537f, 0x0b75e, 0x13fae,
- 0x12fbc, 0x00031, 0x001c4, 0x004c5, 0x005b8, 0x00cf4, 0x0096f, 0x00d46,
- 0x01e57, 0x01a04, 0x02625, 0x03346, 0x028f9, 0x04c47, 0x072e0, 0x04b69,
- 0x03420, 0x07957, 0x06639, 0x0799e, 0x07959, 0x07881, 0x04b68, 0x09fc3,
- 0x09fd6, 0x0cc70, 0x0a3f1, 0x12cbe, 0x0e30e, 0x0e51b, 0x06af2, 0x12cbc,
- 0x1c77d, 0x0f2ab, 0x12fbd, 0x1aa2f, 0x0a3ec, 0x0d473, 0x05377, 0x0a3e9,
- 0x1982b, 0x0e300, 0x12f3f, 0x0cf5f, 0x096c0, 0x38c3c, 0x16e94, 0x16e95,
- 0x12f3d, 0x29ba4, 0x29ba6, 0x1c77c, 0x6a8ba, 0x3545c, 0x33457, 0x668ac,
- 0x6a8bb, 0x16e9d, 0x0e519, 0x25996, 0x12f3e, 0x00036, 0x0033e, 0x006ad,
- 0x00d03, 0x012c8, 0x0124a, 0x03c42, 0x03ccd, 0x06606, 0x07880, 0x06852,
- 0x06a3a, 0x05bb4, 0x0f2a2, 0x09fc7, 0x12cb9, 0x0cc6c, 0x0a6e8, 0x096c1,
- 0x0004a, 0x00355, 0x012f9, 0x014e8, 0x01abe, 0x025b6, 0x0492e, 0x09fc6,
- 0x051ff, 0x0cc6f, 0x096cb, 0x0d071, 0x198d1, 0x12cb8, 0x38c3d, 0x13faf,
- 0x096c9, 0x0009d, 0x00539, 0x012ce, 0x0341f, 0x029c1, 0x04b33, 0x0a3e3,
- 0x0d070, 0x16e96, 0x0b763, 0x000a0, 0x009ce, 0x038cc, 0x0343d, 0x051fa,
- 0x09888, 0x12fba, 0x000df, 0x00a75, 0x029a7, 0x09fc5, 0x0e301, 0x0967b,
- 0x001e7, 0x012c9, 0x051fb, 0x09889, 0x0f2a6, 0x0016f, 0x01cb9, 0x0cf5a,
- 0x12cbf, 0x09679, 0x00272, 0x01a15, 0x0967a, 0x003cb, 0x025f6, 0x0b762,
- 0x0028d, 0x03c60, 0x0cf5e, 0x00352, 0x03ccc, 0x0072f, 0x07186, 0x004ec,
- 0x05379, 0x0068e, 0x09887, 0x006a7, 0x06af1, 0x00e29, 0x0cf5b, 0x00f31,
- 0x0d470, 0x009c6, 0x013fb, 0x13102, 0x019a5, 0x13101, 0x01983, 0x01c65,
- 0x0124f, 0x014c7, 0x01726, 0x01abf, 0x03304, 0x02624, 0x03c41, 0x027d7,
- 0x02ddd, 0x02e54, 0x0343c, 0x06604, 0x07181, 0x0663a, 0x04fa9, 0x0663b,
- 0x05311, 0x0537a, 0x06839, 0x05bb5, 0x0492f, 0x06af0, 0x096c7, 0x0cc6e,
- 0x0537b, 0x0cf5c, 0x0cf56, 0x198d2, 0x0cf5d, 0x0a3ed, 0x0f2a3, 0x1982a,
- 0x0b761, 0x096c6,
-};
-
-static const uint8_t coef0_huffbits[666] = {
- 11,  6,  2,  3,  4,  5,  5,  5,
-  5,  6,  6,  6,  6,  7,  7,  7,
-  7,  7,  7,  7,  7,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9,  9,  9,  9, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 11, 11, 11, 10, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 12, 12, 11, 12,
- 12, 12, 12, 11, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 13, 13, 12,
- 12, 12, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 13, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 15,
- 15, 14, 14, 15, 15, 15, 14, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 14, 15, 15, 15, 15, 16,
- 16, 16, 15, 16, 15, 15, 16, 16,
- 16, 16, 15, 16, 16, 16, 15, 16,
- 16, 15, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 15, 15, 16, 16,
- 15, 16, 16, 16, 17, 17, 17, 16,
- 16, 17, 16, 16, 16, 16, 17, 16,
- 17, 17, 16, 16, 15, 15, 15, 16,
- 17, 16, 17, 16, 16, 17, 17, 17,
- 17, 17, 17, 16, 17, 17, 17, 16,
- 17, 17, 16, 17, 17, 17, 16, 17,
- 17, 16, 16, 17, 17, 17, 18, 17,
- 17, 17, 17, 17, 18, 18, 17, 17,
- 17, 19, 17, 19, 18, 17, 17, 18,
- 17, 17, 18, 17, 17, 17, 18, 17,
- 17, 18, 17, 17, 17, 17, 17, 16,
- 17, 17, 17, 17, 18, 16, 17,  4,
-  6,  8,  9,  9, 10, 10, 10, 10,
- 11, 11, 11, 11, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 14, 13, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
- 15, 15, 15, 15, 15, 15, 16, 15,
- 15, 15, 15, 15, 15, 17, 17, 17,
- 16, 18, 16, 17, 17, 16, 16, 17,
- 17, 18, 17, 16, 17, 17, 17, 16,
- 17, 17, 18, 17, 18, 17, 17, 17,
- 18, 17, 17,  5,  8, 10, 10, 11,
- 11, 12, 12, 12, 13, 13, 14, 13,
- 13, 14, 14, 14, 14, 14, 14, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 16, 16, 15, 16, 16,
- 15, 15, 15, 15, 15, 16, 16, 15,
- 15, 16, 16, 17, 17, 18, 17, 16,
- 17, 18, 19, 17, 16, 16, 17, 17,
- 17,  6,  9, 11, 12, 12, 13, 13,
- 13, 14, 14, 14, 15, 15, 15, 16,
- 15, 15, 15, 15, 15, 15, 16, 16,
- 16, 16, 17, 18, 16, 16, 16, 18,
- 17, 16, 17, 18, 17, 17, 16, 17,
- 17, 16, 17, 16, 17, 18, 18, 18,
- 17, 19, 19, 17, 20, 19, 18, 19,
- 20, 18, 16, 18, 17,  7, 10, 12,
- 13, 13, 14, 14, 14, 15, 15, 16,
- 16, 16, 16, 16, 18, 16, 17, 17,
-  8, 11, 13, 14, 14, 15, 16, 16,
- 16, 16, 17, 17, 17, 18, 18, 17,
- 17,  8, 12, 14, 15, 15, 15, 17,
- 17, 18, 17,  9, 12, 14, 15, 16,
- 16, 17,  9, 13, 15, 16, 16, 17,
-  9, 13, 16, 16, 16, 10, 13, 16,
- 18, 17, 10, 14, 17, 10, 14, 17,
- 11, 14, 16, 11, 14, 11, 15, 12,
- 16, 12, 16, 12, 16, 12, 16, 12,
- 17, 13, 13, 17, 13, 17, 13, 13,
- 14, 14, 14, 14, 14, 14, 14, 15,
- 15, 15, 15, 15, 15, 15, 16, 15,
- 16, 16, 16, 16, 16, 16, 17, 16,
- 16, 16, 16, 17, 16, 17, 16, 17,
- 17, 17,
-};
-
-static const uint32_t coef1_huffcodes[555] = {
- 0x00115, 0x00002, 0x00001, 0x00000, 0x0000d, 0x00007, 0x00013, 0x0001d,
- 0x00008, 0x0000c, 0x00023, 0x0002b, 0x0003f, 0x00017, 0x0001b, 0x00043,
- 0x00049, 0x00050, 0x00055, 0x00054, 0x00067, 0x00064, 0x0007b, 0x0002d,
- 0x00028, 0x0002a, 0x00085, 0x00089, 0x0002b, 0x00035, 0x00090, 0x00091,
- 0x00094, 0x00088, 0x000c1, 0x000c6, 0x000f2, 0x000e3, 0x000c5, 0x000e2,
- 0x00036, 0x000f0, 0x000a7, 0x000cd, 0x000fb, 0x00059, 0x00116, 0x00103,
- 0x00108, 0x0012b, 0x0012d, 0x00188, 0x0012e, 0x0014c, 0x001c3, 0x00187,
- 0x001e7, 0x0006f, 0x00094, 0x00069, 0x001e6, 0x001ca, 0x00147, 0x00195,
- 0x000a7, 0x00213, 0x00209, 0x00303, 0x00295, 0x00289, 0x0028c, 0x0028d,
- 0x00312, 0x00330, 0x0029b, 0x00308, 0x00328, 0x0029a, 0x0025e, 0x003c5,
- 0x00384, 0x0039f, 0x00397, 0x00296, 0x0032e, 0x00332, 0x003c6, 0x003e6,
- 0x0012d, 0x000d1, 0x00402, 0x000dd, 0x00161, 0x0012b, 0x00127, 0x0045d,
- 0x00601, 0x004ab, 0x0045f, 0x00410, 0x004bf, 0x00528, 0x0045c, 0x00424,
- 0x00400, 0x00511, 0x00618, 0x0073d, 0x0063a, 0x00614, 0x0073c, 0x007c0,
- 0x007cf, 0x00802, 0x00966, 0x00964, 0x00951, 0x008a0, 0x00346, 0x00803,
- 0x00a52, 0x0024a, 0x007c1, 0x0063f, 0x00126, 0x00406, 0x00789, 0x008a2,
- 0x00960, 0x00967, 0x00c05, 0x00c70, 0x00c79, 0x00a5d, 0x00c26, 0x00c4d,
- 0x00372, 0x008a5, 0x00c08, 0x002c5, 0x00f11, 0x00cc4, 0x00f8e, 0x00e16,
- 0x00496, 0x00e77, 0x00f9c, 0x00c25, 0x00f1e, 0x00c27, 0x00f1f, 0x00e17,
- 0x00ccd, 0x00355, 0x00c09, 0x00c78, 0x00f90, 0x00521, 0x00357, 0x00356,
- 0x0068e, 0x00f9d, 0x00c04, 0x00e58, 0x00a20, 0x00a2c, 0x00c4c, 0x0052f,
- 0x00f8d, 0x01178, 0x01053, 0x01097, 0x0180f, 0x0180d, 0x012fb, 0x012aa,
- 0x0202a, 0x00a40, 0x018ed, 0x01ceb, 0x01455, 0x018e3, 0x012a1, 0x00354,
- 0x00353, 0x00f1c, 0x00c7b, 0x00c37, 0x0101d, 0x012cb, 0x01142, 0x0197d,
- 0x01095, 0x01e3b, 0x0186b, 0x00588, 0x01c2a, 0x014b8, 0x01e3a, 0x018ec,
- 0x01f46, 0x012fa, 0x00a53, 0x01ce8, 0x00a55, 0x01c29, 0x0117b, 0x01052,
- 0x012a0, 0x00589, 0x00950, 0x01c2b, 0x00a50, 0x0208b, 0x0180e, 0x02027,
- 0x02556, 0x01e20, 0x006e7, 0x01c28, 0x0197a, 0x00684, 0x020a2, 0x01f22,
- 0x03018, 0x039cf, 0x03e25, 0x02557, 0x0294c, 0x028a6, 0x00d11, 0x028a9,
- 0x02979, 0x00d46, 0x00a56, 0x039ce, 0x030cc, 0x0329a, 0x0149d, 0x0510f,
- 0x0451c, 0x02028, 0x03299, 0x01ced, 0x014b9, 0x00f85, 0x00c7a, 0x01800,
- 0x00341, 0x012ca, 0x039c8, 0x0329d, 0x00d0d, 0x03e20, 0x05144, 0x00d45,
- 0x030d0, 0x0186d, 0x030d5, 0x00d0f, 0x00d40, 0x04114, 0x020a1, 0x0297f,
- 0x03e24, 0x032f1, 0x04047, 0x030d4, 0x028a8, 0x00d0e, 0x0451d, 0x04044,
- 0x0297e, 0x04042, 0x030d2, 0x030cf, 0x03e21, 0x03e26, 0x028a5, 0x0451a,
- 0x00d48, 0x01a16, 0x00d44, 0x04518, 0x0149b, 0x039ca, 0x01498, 0x0403d,
- 0x0451b, 0x0149c, 0x032f3, 0x030cb, 0x08073, 0x03e22, 0x0529a, 0x020aa,
- 0x039cc, 0x0738a, 0x06530, 0x07389, 0x06193, 0x08071, 0x04043, 0x030ce,
- 0x05147, 0x07388, 0x05145, 0x08072, 0x04521, 0x00d47, 0x0297c, 0x030cd,
- 0x030ca, 0x0000b, 0x0000c, 0x00083, 0x000e4, 0x00048, 0x00102, 0x001cc,
- 0x001f5, 0x00097, 0x0020b, 0x00124, 0x00453, 0x00627, 0x00639, 0x00605,
- 0x00517, 0x001b8, 0x00663, 0x00667, 0x007c3, 0x00823, 0x00961, 0x00963,
- 0x00e5a, 0x00e59, 0x00a2b, 0x00cbf, 0x00292, 0x00a2d, 0x007d0, 0x00953,
- 0x00cc5, 0x00f84, 0x004ab, 0x014a7, 0x0068a, 0x0117a, 0x0052e, 0x01442,
- 0x0052c, 0x00c77, 0x00f8f, 0x004aa, 0x01094, 0x01801, 0x012c4, 0x0297b,
- 0x00952, 0x01f19, 0x006a5, 0x01149, 0x012c5, 0x01803, 0x022f2, 0x0329b,
- 0x04520, 0x0149e, 0x00d13, 0x01f16, 0x01ce9, 0x0101c, 0x006e6, 0x039c9,
- 0x06191, 0x07c8e, 0x06192, 0x0ca63, 0x039cd, 0x06190, 0x06884, 0x06885,
- 0x07382, 0x00d49, 0x00d41, 0x0450c, 0x0149a, 0x030d1, 0x08077, 0x03e23,
- 0x01a15, 0x0e701, 0x0e702, 0x08079, 0x0822a, 0x0a218, 0x07887, 0x0403f,
- 0x0520b, 0x0529b, 0x0e700, 0x04519, 0x00007, 0x000e0, 0x000d0, 0x0039b,
- 0x003e5, 0x00163, 0x0063e, 0x007c9, 0x00806, 0x00954, 0x01044, 0x01f44,
- 0x0197c, 0x01f45, 0x00a51, 0x01f47, 0x00951, 0x0052d, 0x02291, 0x0092f,
- 0x00a54, 0x00d12, 0x0297d, 0x00d0c, 0x01499, 0x0329e, 0x032f0, 0x02025,
- 0x039c6, 0x00a57, 0x03e46, 0x00d42, 0x0738b, 0x05146, 0x04046, 0x08078,
- 0x0510e, 0x07886, 0x02904, 0x04156, 0x04157, 0x06032, 0x030d3, 0x08bce,
- 0x04040, 0x0403e, 0x0a414, 0x10457, 0x08075, 0x06887, 0x07c8f, 0x039c7,
- 0x07387, 0x08070, 0x08bcf, 0x1482a, 0x10456, 0x1482b, 0x01a17, 0x06886,
- 0x0450d, 0x00013, 0x0006b, 0x00615, 0x0080b, 0x0082b, 0x00952, 0x00e5b,
- 0x018e2, 0x0186c, 0x01f18, 0x0329f, 0x00d43, 0x03e29, 0x05140, 0x05141,
- 0x0ca62, 0x06033, 0x03c42, 0x03e28, 0x0450f, 0x0a21a, 0x07384, 0x0a219,
- 0x0e703, 0x0a21b, 0x01a14, 0x07383, 0x045e6, 0x0007a, 0x0012c, 0x00ccc,
- 0x0068f, 0x01802, 0x00a52, 0x00953, 0x04045, 0x01a20, 0x0451f, 0x000a4,
- 0x00735, 0x01cec, 0x02029, 0x020a3, 0x0451e, 0x00069, 0x00c24, 0x02024,
- 0x032f2, 0x05142, 0x00196, 0x00523, 0x000a6, 0x0197b, 0x0030b, 0x0092e,
- 0x003e9, 0x03e27, 0x00160, 0x05143, 0x00652, 0x04041, 0x00734, 0x028a7,
- 0x0080f, 0x01483, 0x0097c, 0x00340, 0x0068b, 0x00522, 0x01054, 0x01096,
- 0x01f17, 0x0202b, 0x01cea, 0x020a0, 0x02978, 0x02026, 0x0297a, 0x039cb,
- 0x03e2b, 0x0149f, 0x0329c, 0x07385, 0x08074, 0x0450e, 0x03e2a, 0x05149,
- 0x08076, 0x07386, 0x05148,
-};
-
-static const uint8_t coef1_huffbits[555] = {
-  9,  5,  2,  4,  4,  5,  5,  5,
-  6,  6,  6,  6,  6,  7,  7,  7,
-  7,  7,  7,  7,  7,  7,  7,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  8,  8,  8,  8,  8,  8,  8,  8,
-  9,  8,  8,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9, 10, 10, 10,  9,  9,  9,  9,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 11, 11, 11, 11, 11, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 13, 12, 12, 12, 12, 12, 12, 12,
- 13, 12, 12, 12, 12, 12, 12, 12,
- 12, 13, 12, 12, 12, 13, 13, 13,
- 13, 12, 12, 12, 12, 12, 12, 13,
- 12, 13, 13, 13, 13, 13, 13, 13,
- 14, 14, 13, 13, 13, 13, 13, 13,
- 13, 12, 12, 12, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 14, 13, 14, 13, 13, 13,
- 13, 13, 14, 13, 14, 14, 13, 14,
- 14, 13, 14, 13, 13, 14, 14, 13,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 15, 14, 14, 14, 14, 15, 15,
- 15, 14, 14, 13, 13, 12, 12, 13,
- 13, 13, 14, 14, 15, 14, 15, 15,
- 14, 13, 14, 15, 15, 15, 14, 14,
- 14, 14, 15, 14, 14, 15, 15, 15,
- 14, 15, 14, 14, 14, 14, 14, 15,
- 15, 16, 15, 15, 15, 14, 15, 15,
- 15, 15, 14, 14, 16, 14, 15, 14,
- 14, 15, 15, 15, 15, 16, 15, 14,
- 15, 15, 15, 16, 15, 15, 14, 14,
- 14,  4,  7,  8,  8,  9,  9,  9,
-  9, 10, 10, 11, 11, 11, 11, 11,
- 11, 12, 11, 11, 11, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 11, 12,
- 12, 12, 13, 13, 13, 13, 13, 13,
- 13, 12, 12, 13, 13, 13, 13, 14,
- 14, 13, 14, 13, 13, 13, 14, 14,
- 15, 15, 14, 13, 13, 13, 14, 14,
- 15, 15, 15, 16, 14, 15, 17, 17,
- 15, 15, 15, 15, 15, 14, 16, 14,
- 16, 16, 16, 16, 16, 16, 15, 15,
- 17, 15, 16, 15,  6,  8, 10, 10,
- 10, 11, 11, 11, 12, 12, 13, 13,
- 13, 13, 14, 13, 14, 13, 14, 14,
- 14, 14, 14, 15, 15, 14, 14, 14,
- 14, 14, 14, 15, 15, 15, 15, 16,
- 15, 15, 16, 15, 15, 15, 14, 16,
- 15, 15, 18, 17, 16, 17, 15, 14,
- 15, 16, 16, 19, 17, 19, 16, 17,
- 15,  7, 10, 11, 12, 12, 12, 12,
- 13, 13, 13, 14, 15, 14, 15, 15,
- 16, 15, 14, 14, 15, 16, 15, 16,
- 16, 16, 16, 15, 15,  7, 11, 12,
- 13, 13, 14, 14, 15, 15, 15,  8,
- 11, 13, 14, 14, 15,  9, 12, 14,
- 14, 15,  9, 13, 10, 13, 10, 14,
- 10, 14, 11, 15, 11, 15, 11, 14,
- 12, 15, 12, 13, 13, 13, 13, 13,
- 13, 14, 13, 14, 14, 14, 14, 14,
- 14, 15, 14, 15, 16, 15, 14, 15,
- 16, 15, 15,
-};
-
-static const uint32_t coef2_huffcodes[1336] = {
- 0x003e6, 0x000f6, 0x00000, 0x00002, 0x00006, 0x0000f, 0x0001b, 0x00028,
- 0x00039, 0x0003f, 0x0006b, 0x00076, 0x000b7, 0x000e8, 0x000ef, 0x00169,
- 0x001a7, 0x001d4, 0x001dc, 0x002c4, 0x00349, 0x00355, 0x00391, 0x003dc,
- 0x00581, 0x005b2, 0x00698, 0x0070c, 0x00755, 0x0073a, 0x00774, 0x007cf,
- 0x00b0a, 0x00b66, 0x00d2e, 0x00d5e, 0x00e1b, 0x00eac, 0x00e5a, 0x00f7e,
- 0x00fa1, 0x0163e, 0x01a37, 0x01a52, 0x01c39, 0x01ab3, 0x01d5f, 0x01cb6,
- 0x01f52, 0x01dd9, 0x02c04, 0x02c2e, 0x02c2d, 0x02c23, 0x03467, 0x034a3,
- 0x0351b, 0x03501, 0x03a5d, 0x0351c, 0x03875, 0x03dea, 0x0397b, 0x039db,
- 0x03df1, 0x039d8, 0x03bb4, 0x0580a, 0x0584d, 0x05842, 0x05b13, 0x058ea,
- 0x0697d, 0x06a06, 0x068cc, 0x06ac7, 0x06a96, 0x072f4, 0x07543, 0x072b4,
- 0x07d20, 0x0b003, 0x073b5, 0x07be6, 0x0d180, 0x07bd1, 0x07cb8, 0x07d06,
- 0x07d25, 0x0d2f2, 0x0d19a, 0x0d334, 0x0e1dc, 0x0d529, 0x0d584, 0x0e1d2,
- 0x0e5e3, 0x0eec4, 0x0e564, 0x0fa49, 0x16001, 0x0eedc, 0x0f7fa, 0x1a32c,
- 0x16131, 0x16003, 0x0f9c8, 0x1ef80, 0x1d2a0, 0x1aa4b, 0x0f7ce, 0x1abfe,
- 0x1aa50, 0x1a458, 0x1a816, 0x1cae4, 0x1d2fe, 0x1d52e, 0x1aa4c, 0x2c245,
- 0x1d2a1, 0x1a35d, 0x1ca1b, 0x1d5d8, 0x1f531, 0x1ca1c, 0x1f389, 0x1f4af,
- 0x3a5e7, 0x351fb, 0x2c24b, 0x34bce, 0x2c24d, 0x2c249, 0x2c24a, 0x72dfc,
- 0x357ef, 0x35002, 0x3a5e6, 0x39431, 0x5843b, 0x34a77, 0x58431, 0x3a5f3,
- 0x3a5dd, 0x3e5e5, 0x356bd, 0x3976e, 0x6a3d2, 0x3500d, 0x694c4, 0x580bd,
- 0x3e5e8, 0x74b95, 0x34a6e, 0x3977c, 0x39432, 0x5b0d2, 0x6a3d8, 0x580b8,
- 0x5b0cb, 0x5b0d7, 0x72dee, 0x72ded, 0x72dec, 0x74b9c, 0x3977f, 0x72dea,
- 0x74b9e, 0x7be7d, 0x580bf, 0x5b0d5, 0x7cba8, 0x74b91, 0x3e5dd, 0xb6171,
- 0xd46b3, 0xd46b9, 0x7cba1, 0x74b9f, 0x72de1, 0xe59f5, 0x3e5eb, 0x00004,
- 0x00015, 0x00038, 0x00075, 0x000e8, 0x001d3, 0x00347, 0x0039c, 0x00690,
- 0x0074a, 0x00b60, 0x00e93, 0x00f74, 0x0163d, 0x01a5a, 0x01d24, 0x01cbe,
- 0x01f4b, 0x03468, 0x03562, 0x03947, 0x03e82, 0x05804, 0x05b12, 0x05803,
- 0x0696d, 0x06a9e, 0x0697c, 0x06978, 0x06afb, 0x074b2, 0x072f5, 0x073c0,
- 0x07541, 0x06944, 0x074b7, 0x070d3, 0x07ba9, 0x0b0b1, 0x0d1af, 0x0e1dd,
- 0x0e5e2, 0x0e1a3, 0x0eec3, 0x1612f, 0x0e961, 0x0eeda, 0x0e78e, 0x0fa48,
- 0x1612c, 0x0e511, 0x0e565, 0x0e953, 0x1aa4a, 0x0e59d, 0x1d52c, 0x1a811,
- 0x1cae7, 0x1abfc, 0x1d52d, 0x1cacf, 0x1cf05, 0x2c254, 0x34a72, 0x1f4ac,
- 0x3976b, 0x34a71, 0x2c6d9, 0x2d873, 0x34a6a, 0x357e7, 0x3464c, 0x3e5f5,
- 0x58433, 0x1f53a, 0x3500a, 0x357ea, 0x34a73, 0x3942f, 0x357e5, 0x39775,
- 0x694cd, 0x39772, 0x7cba5, 0x6a3ef, 0x35483, 0x74b98, 0x5b0c1, 0x39770,
- 0x3a5d7, 0x39433, 0x39434, 0x694ce, 0x580be, 0x3e5ff, 0x6a3ec, 0xb616f,
- 0xd46b1, 0x6a3d1, 0x72de5, 0x74b6e, 0x72de9, 0x3e700, 0xd46b6, 0x6a3e9,
- 0x74b69, 0xe5675, 0xd46b8, 0x7cbaa, 0x3a5d1, 0x0000c, 0x0003c, 0x000eb,
- 0x001f1, 0x003a4, 0x006a8, 0x007d5, 0x00d43, 0x00e77, 0x016c5, 0x01cb1,
- 0x02c5d, 0x03a55, 0x03a56, 0x03e51, 0x03bb5, 0x05b0a, 0x06a9f, 0x074b8,
- 0x07d28, 0x0d187, 0x0d40e, 0x0d52e, 0x0d425, 0x0eae3, 0x0e1d3, 0x1612e,
- 0x0e59e, 0x0eec2, 0x0e578, 0x0e51a, 0x0e579, 0x0e515, 0x0e960, 0x0d183,
- 0x0d220, 0x0d2cb, 0x0e512, 0x16c3e, 0x16002, 0x16c42, 0x1cae9, 0x3461a,
- 0x1d2fa, 0x1a308, 0x1a849, 0x1cf07, 0x1f38f, 0x34b65, 0x2c253, 0x1ef9e,
- 0x1cbc3, 0x1cbc1, 0x2c255, 0x1f384, 0x58435, 0x2c5cd, 0x3a5f7, 0x2c252,
- 0x3959c, 0x2c6d8, 0x3a5d3, 0x6ad78, 0x6a3f2, 0x7cba9, 0xb6176, 0x72deb,
- 0x39764, 0x3e5f6, 0x3a5d8, 0x74a8c, 0x6a3e6, 0x694d1, 0x6ad79, 0x1a4592,
- 0xe59fb, 0x7cbb3, 0x5b0cd, 0x00017, 0x000b5, 0x002c3, 0x005b7, 0x00b1c,
- 0x00e5c, 0x0163f, 0x01ab2, 0x01efa, 0x0348a, 0x0396e, 0x058da, 0x06963,
- 0x06a30, 0x072cd, 0x073cf, 0x07ce7, 0x0d2ca, 0x0d2d8, 0x0e764, 0x0e794,
- 0x16008, 0x16167, 0x1617e, 0x1aa49, 0x1a30b, 0x1a813, 0x2c6da, 0x1a580,
- 0x1cbc2, 0x0f9ca, 0x1617f, 0x1d2fe, 0x0f7fc, 0x16c40, 0x0e513, 0x0eec5,
- 0x0f7c3, 0x1d508, 0x1a81e, 0x1d2fd, 0x39430, 0x35486, 0x3e5fd, 0x2c24c,
- 0x2c75a, 0x34a74, 0x3a5f4, 0x3464d, 0x694ca, 0x3a5f1, 0x1d509, 0x1d5c0,
- 0x34648, 0x3464e, 0x6a3d5, 0x6a3e8, 0x6a3e7, 0x5b0c3, 0x2c248, 0x1f38a,
- 0x3a5f2, 0x6a3e5, 0x00029, 0x00168, 0x0058c, 0x00b67, 0x00f9d, 0x01c3d,
- 0x01cbf, 0x02c20, 0x0351d, 0x03df6, 0x06af9, 0x072b5, 0x0b1d7, 0x0b0b2,
- 0x0d40a, 0x0d52b, 0x0e952, 0x0e797, 0x163c3, 0x1c3a0, 0x1f386, 0x1ca21,
- 0x34655, 0x2c247, 0x1f53b, 0x2c250, 0x2c24f, 0x1f385, 0x1ef5d, 0x1cf15,
- 0x1caea, 0x1ab0a, 0x1cf19, 0x1f53d, 0x1d5c2, 0x1d2fb, 0x1ef58, 0x34a78,
- 0x357ec, 0x1f533, 0x3a5e1, 0x694d2, 0x58482, 0x3a5ee, 0x2c6dc, 0x357eb,
- 0x5b0c4, 0x39778, 0x6a3e1, 0x7cbb4, 0x3a5e1, 0x74b68, 0x3a5ef, 0x3a5d2,
- 0x39424, 0x72de2, 0xe59f6, 0xe59f7, 0x3e702, 0x3e5ec, 0x1f38b, 0x0003b,
- 0x001f0, 0x00777, 0x00fa8, 0x01cb2, 0x02d84, 0x03a57, 0x03dd6, 0x06917,
- 0x06a11, 0x07d07, 0x0eae2, 0x0e796, 0x0f9c9, 0x0f7fb, 0x16166, 0x16160,
- 0x1ab1b, 0x1abfa, 0x2d87b, 0x1d2f7, 0x39768, 0x1f38c, 0x34653, 0x34651,
- 0x6a3d9, 0x35001, 0x3abbd, 0x38742, 0x39426, 0x34a76, 0x3a5ec, 0x34a75,
- 0x35000, 0x35488, 0x1cf10, 0x2c6db, 0x357ed, 0x357e8, 0x357e9, 0x3a5f0,
- 0x694c2, 0xb6178, 0x72df5, 0x39425, 0x3942b, 0x74b6d, 0x74b6f, 0xb6177,
- 0xb6179, 0x74b6a, 0xb6172, 0x58487, 0x3e5ee, 0x3e5ed, 0x72df2, 0x72df4,
- 0x7cbae, 0x6a3ca, 0x70e86, 0x34bcf, 0x6a3c8, 0x00059, 0x00384, 0x00d5b,
- 0x01c38, 0x03560, 0x0395b, 0x0584e, 0x06964, 0x073cd, 0x0b1e7, 0x0e798,
- 0x0e78d, 0x0fa43, 0x1a848, 0x1a32f, 0x1aa4e, 0x3464a, 0x1f4ab, 0x1f38d,
- 0x3a5eb, 0x3a5d4, 0x3548a, 0x6a3c7, 0x5b0d0, 0x6a3c5, 0x7cbb0, 0x694cb,
- 0x3a5e5, 0x3e5e2, 0x3942c, 0x2d872, 0x1f4ae, 0x3a5d5, 0x694d3, 0x58481,
- 0x35009, 0x39774, 0x58432, 0xb616c, 0x5b0db, 0x3548b, 0xb6174, 0x1d5d95,
- 0xb004c, 0x7cbb2, 0x3a5e5, 0x74a8f, 0xe59f9, 0x72df6, 0xe59fd, 0x7cbad,
- 0xd427d, 0x72cff, 0x3977a, 0x5b0d9, 0xb616d, 0xb616b, 0x1a4593, 0x7cbaf,
- 0x5b0da, 0x00071, 0x003eb, 0x01603, 0x02c6c, 0x03961, 0x068c8, 0x06a31,
- 0x072bd, 0x0d2c2, 0x0e51b, 0x0e5e6, 0x1abfb, 0x1d2ff, 0x1cae5, 0x1ef5c,
- 0x1ef5e, 0x1cf13, 0x34a6d, 0x3976d, 0xb616a, 0x3e5f2, 0x6a3c4, 0xb6169,
- 0x3e5dc, 0x580b9, 0x74b99, 0x75764, 0x58434, 0x3a5d9, 0x6945a, 0x69459,
- 0x3548c, 0x3a5e9, 0x69457, 0x72df1, 0x6945e, 0x6a35e, 0x3e701, 0xb6168,
- 0x5b0dd, 0x3a5de, 0x6a3c2, 0xd4278, 0x6a3cc, 0x72dfd, 0xb6165, 0x16009a,
- 0x7cbb1, 0xd427c, 0xb6162, 0xe765e, 0x1cecbe, 0x7cbb6, 0x69454, 0xb6160,
- 0xd427a, 0x1d5d96, 0xb1d6d, 0xe59f4, 0x72de8, 0x3a5db, 0x0007a, 0x006ae,
- 0x01c3c, 0x03aba, 0x058e9, 0x072cc, 0x0d2dd, 0x0d22d, 0x0eec1, 0x0eedb,
- 0x1d2a2, 0x1ef5b, 0x357e2, 0x3abbf, 0x1d2f9, 0x35004, 0x3a5dc, 0x351fc,
- 0x3976c, 0x6a3c6, 0x6a3cb, 0x3e5ea, 0xe59f3, 0x6a3ce, 0x69452, 0xe59f0,
- 0x74b90, 0xd4279, 0xd427b, 0x7cbb5, 0x5b0c5, 0x3a5e3, 0x3a5e2, 0x000d0,
- 0x00775, 0x01efe, 0x03dd5, 0x0728c, 0x07cb9, 0x0e1a2, 0x0ea85, 0x0eed8,
- 0x1a30a, 0x1aa4f, 0x3a5df, 0x35008, 0x3a5e0, 0x3e5f4, 0x3e5f7, 0xb1d6c,
- 0x5843e, 0x34a70, 0x72df8, 0x74b6b, 0xd427f, 0x72df0, 0x5b0bf, 0x5b0c0,
- 0xd46b0, 0x72def, 0xe59f8, 0x162e64, 0xb1d6f, 0x3a5e0, 0x39427, 0x69166,
- 0x6a3e2, 0x6a3e3, 0x74a8d, 0xd427e, 0x1d5d97, 0xd46b4, 0x5b0d8, 0x6a3d3,
- 0x000e0, 0x00b63, 0x034cc, 0x06a33, 0x073c9, 0x0e1a0, 0x0f7fd, 0x0f9cc,
- 0x1617d, 0x1caeb, 0x1f4a9, 0x3abb3, 0x69450, 0x39420, 0x39777, 0x3e5e0,
- 0x6a3d4, 0x6a3ed, 0xb6166, 0xe59f1, 0xb1d6e, 0xe5676, 0x6a3ea, 0xe5674,
- 0xb6163, 0xd46b7, 0x7cba6, 0xd46ba, 0x1d5d94, 0xb6164, 0x6a3f1, 0x7cba2,
- 0x69451, 0x72dfa, 0xd46bb, 0x72df7, 0x74b94, 0x1cecbf, 0xe59fa, 0x16009b,
- 0x6a3e4, 0x000e6, 0x00e94, 0x03876, 0x070ef, 0x0d52a, 0x16015, 0x16014,
- 0x1abf9, 0x1cf17, 0x34a79, 0x34650, 0x3e705, 0x6a3d0, 0x58430, 0x74b9d,
- 0x7be7e, 0x5b0be, 0x39773, 0x6a3de, 0x000fb, 0x00f7b, 0x03dd7, 0x07bd0,
- 0x0e59c, 0x0f9cd, 0x1cf18, 0x1d2ff, 0x34a7a, 0x39429, 0x3500c, 0x72de0,
- 0x69456, 0x7be7c, 0xd46b5, 0xd46b2, 0x6a3dd, 0x001a2, 0x0163b, 0x06913,
- 0x0b016, 0x0fa42, 0x1a32d, 0x1cf06, 0x34a7c, 0x34a7d, 0xb6161, 0x35481,
- 0x3e5fa, 0x7cba0, 0x7be7f, 0x7cba3, 0x7cba7, 0x5b0d3, 0x72de6, 0x6a3dc,
- 0x001a9, 0x01ab4, 0x06a34, 0x0d46a, 0x16130, 0x1ef5f, 0x1f532, 0x1f536,
- 0x3942e, 0x58436, 0x6a3db, 0x6945b, 0x001c9, 0x01ca0, 0x0728b, 0x0eed9,
- 0x1f539, 0x1ca1d, 0x39765, 0x39766, 0x58439, 0x6945d, 0x39767, 0x001d3,
- 0x01f2c, 0x07bfc, 0x16161, 0x34652, 0x3a5ed, 0x3548d, 0x58438, 0x6a3da,
- 0x002c1, 0x02c5e, 0x0d335, 0x1ab1a, 0x2d874, 0x35006, 0x35484, 0x5b0cc,
- 0x74b9a, 0x72df3, 0x6a3d6, 0x002da, 0x034b3, 0x0d5ae, 0x1caee, 0x2d871,
- 0x357e3, 0x74b97, 0x72df9, 0x580ba, 0x5b0d4, 0x0034d, 0x0354e, 0x0f750,
- 0x1cbc0, 0x3a5e7, 0x3a5e4, 0x00385, 0x03a58, 0x16c41, 0x2c5cf, 0x3e5e1,
- 0x74b6c, 0xe5677, 0x6a3df, 0x00390, 0x03e50, 0x163c2, 0x2d876, 0x35482,
- 0x5b0d6, 0x5843a, 0x0039f, 0x0585e, 0x1a583, 0x3500f, 0x74b93, 0x39771,
- 0x003e4, 0x06912, 0x16c43, 0x357e1, 0x0058a, 0x0696f, 0x1f538, 0x5b0c9,
- 0x6a3cf, 0x005b6, 0x06af8, 0x1f534, 0x58483, 0x6a3e0, 0x00695, 0x07d02,
- 0x1cae8, 0x58485, 0x006a2, 0x0754a, 0x357ee, 0x3977b, 0x00748, 0x074b2,
- 0x34a7b, 0x00729, 0x0b1e0, 0x34649, 0x3e5e3, 0x0073d, 0x0d2c4, 0x3e5e6,
- 0x007bb, 0x0b099, 0x39762, 0x5b0ce, 0x6945f, 0x007d1, 0x0d5ab, 0x39779,
- 0x007d3, 0x0d52f, 0x39763, 0x6945c, 0x00b1a, 0x0d2c5, 0x35489, 0x00d23,
- 0x0eaed, 0x3e5f8, 0x00d32, 0x16016, 0x3e5fb, 0x00d41, 0x0e768, 0x3a5ed,
- 0x00e1f, 0x16017, 0x58027, 0x00ead, 0x0fa07, 0x69455, 0x00e54, 0x1612b,
- 0x00e55, 0x1a581, 0x00f78, 0x1a32b, 0x580bc, 0x6a3ee, 0x00f79, 0x1abfd,
- 0x00f95, 0x1ab18, 0x6a3f0, 0x01637, 0x1aa4d, 0x0162d, 0x1f53c, 0x6a3f3,
- 0x01a31, 0x1a810, 0x39769, 0x01a50, 0x1caef, 0x01a36, 0x1a32e, 0x01a67,
- 0x1f38e, 0x01a85, 0x1ef59, 0x01aa6, 0x1ef83, 0x01d51, 0x2c012, 0x01d53,
- 0x2d879, 0x01d5e, 0x35005, 0x01cba, 0x1cf04, 0x69453, 0x01d2d, 0x351ff,
- 0x01f2d, 0x2d86f, 0x01f29, 0x35007, 0x02c22, 0x351fa, 0x02c03, 0x3a5ec,
- 0x02c5f, 0x3a5eb, 0x02c58, 0x34a6b, 0x03469, 0x356be, 0x02c59, 0x34a6c,
- 0x0346a, 0x3a5ea, 0x034bd, 0x034bf, 0x356bf, 0x0386a, 0x03ab9, 0x5843f,
- 0x0386b, 0x3a5f5, 0x03a4b, 0x39421, 0x03aa4, 0x3a5e9, 0x03a5a, 0x03960,
- 0x3977e, 0x03de9, 0x03958, 0x03df7, 0x039e1, 0x3e5e4, 0x0395f, 0x69458,
- 0x03e91, 0x03df2, 0x39428, 0x058f2, 0x03e80, 0x6a3c3, 0x03e93, 0x694c0,
- 0x058b8, 0x5b0ca, 0x0584f, 0x694c1, 0x058f1, 0x068d6, 0x06a10, 0x06ac3,
- 0x06a32, 0x070d2, 0x06911, 0x074b1, 0x07494, 0x06ad4, 0x06ad6, 0x072b8,
- 0x06afa, 0x074b3, 0x07540, 0x073ce, 0x0b005, 0x074b3, 0x07495, 0x074b9,
- 0x0d336, 0x07bff, 0x07763, 0x073c8, 0x07d29, 0x0b622, 0x0d221, 0x0d181,
- 0x0b1d1, 0x074b8, 0x0b1d0, 0x0d19b, 0x0d2c3, 0x0b172, 0x0d2dc, 0x0b623,
- 0x0d5aa, 0x0d426, 0x0d182, 0x0e795, 0x0e1d1, 0x0d337, 0x0e96c, 0x0e5e4,
- 0x0e514, 0x0eaee, 0x16000, 0x0e767, 0x0e1a1, 0x0e78f, 0x16004, 0x0f7c2,
- 0x0e799, 0x0e5e7, 0x0e566, 0x0e769, 0x0f751, 0x0eede, 0x0fa06, 0x16005,
- 0x0fa9f, 0x1a5e6, 0x0e766, 0x1636f, 0x0eedd, 0x0eec0, 0x1a309, 0x1ceca,
- 0x163cd, 0x0f9cb, 0x0eedf, 0x1a582, 0x1612d, 0x0e5e5, 0x1abf8, 0x1a30c,
- 0x1ca1f, 0x163cc, 0x1a35c, 0x1ca1e, 0x1aa51, 0x163ac, 0x1a84e, 0x1a53f,
- 0x1cf16, 0x1d2fc, 0x1a5b3, 0x1ab19, 0x1a81f, 0x1d5c3, 0x16c3f, 0x1d5c1,
- 0x1d2fc, 0x1f4aa, 0x1a812, 0x1f535, 0x1cf12, 0x1a817, 0x1617c, 0x1ab0b,
- 0x1d2f8, 0x1ef82, 0x2d87a, 0x1d52f, 0x1f530, 0x1aa48, 0x35487, 0x1d2fd,
- 0x1f4ad, 0x1cf11, 0x3461b, 0x35485, 0x1ca20, 0x1caed, 0x1cae6, 0x1abff,
- 0x3464f, 0x34a6f, 0x1ef81, 0x3464b, 0x39d96, 0x1f383, 0x1f537, 0x1cf14,
- 0x2c5ce, 0x3500e, 0x2c251, 0x1caec, 0x1f387, 0x34654, 0x357e4, 0x2d878,
- 0x3500b, 0x35480, 0x3a5e8, 0x3548e, 0x34b64, 0x1f4a8, 0x35003, 0x3e5df,
- 0x2d870, 0x357e6, 0x3e5f0, 0x1ef5a, 0x3a5ea, 0x1f388, 0x3e703, 0x2c24e,
- 0x3a5e2, 0x351fd, 0x2c6dd, 0x3e704, 0x351fe, 0x2d875, 0x5b0c7, 0x3976a,
- 0x3a5e6, 0x39423, 0x58480, 0x2c246, 0x3a5e3, 0x2d877, 0x3e5f1, 0x3abbe,
- 0x58489, 0x3e5f9, 0x357e0, 0x3abbc, 0x5b0c6, 0x69167, 0x69165, 0x3e5e9,
- 0x39422, 0x3976f, 0x3977d, 0x3e5de, 0x6a3c9, 0x58b98, 0x3a5f6, 0x3a5d0,
- 0x58486, 0x6a3c1, 0x3e5fc, 0x5b0dc, 0x3548f, 0x3942d, 0x694c9, 0x58484,
- 0x3a5e8, 0x74b9b, 0x74b96, 0x694d0, 0x58488, 0x3a5e4, 0x3942a, 0x72ec2,
- 0x39776, 0x5b0d1, 0x5b0cf, 0x3a5d6, 0xe59fc, 0x5b0c8, 0x3e5e7, 0x7cbb7,
- 0x70e87, 0x7cbab, 0x5b0c2, 0x694c3, 0x74a8e, 0x3e5f3, 0x6a3cd, 0x72dfe,
- 0x73b2e, 0x72ec0, 0x694c5, 0x58437, 0x694c8, 0x72dff, 0x39435, 0x5843d,
- 0x6a3d7, 0x72ec1, 0xd22c8, 0x694cf, 0xb6173, 0x3e5fe, 0x580bb, 0xe59f2,
- 0xb616e, 0xb6175, 0x3a5da, 0x5b0bd, 0x694cc, 0x5843c, 0x694c7, 0x74b92,
- 0x72ec3, 0x694c6, 0xb6170, 0x7cbac, 0xb1733, 0x7cba4, 0xb6167, 0x72de7,
- 0x72de4, 0x6a3c0, 0x3e5ef, 0x162e65, 0x72de3, 0x72dfb, 0x6a35f, 0x6a3eb,
-};
-
-static const uint8_t coef2_huffbits[1336] = {
- 11,  9,  2,  3,  4,  4,  5,  6,
-  6,  7,  7,  8,  8,  8,  9,  9,
-  9,  9, 10, 10, 10, 10, 11, 11,
- 11, 11, 11, 11, 11, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 16, 15, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 18, 17, 17, 17, 17,
- 17, 17, 17, 18, 18, 17, 17, 18,
- 17, 17, 18, 17, 18, 18, 18, 18,
- 19, 18, 18, 18, 18, 18, 18, 20,
- 18, 18, 18, 19, 19, 18, 19, 18,
- 19, 19, 18, 19, 19, 18, 19, 19,
- 19, 19, 18, 19, 19, 19, 19, 19,
- 19, 19, 20, 20, 20, 19, 19, 20,
- 19, 20, 19, 19, 20, 19, 19, 20,
- 20, 20, 20, 19, 20, 21, 19,  3,
-  5,  7,  8,  9,  9, 10, 11, 11,
- 12, 12, 12, 13, 13, 13, 13, 14,
- 14, 14, 14, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 16, 16,
- 15, 15, 15, 15, 16, 16, 16, 16,
- 17, 16, 17, 17, 16, 17, 17, 17,
- 17, 17, 17, 16, 17, 17, 17, 17,
- 18, 17, 17, 18, 18, 18, 18, 18,
- 19, 18, 18, 18, 18, 18, 18, 19,
- 19, 18, 18, 18, 18, 19, 18, 19,
- 19, 19, 20, 19, 18, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 20,
- 20, 19, 20, 19, 20, 19, 20, 19,
- 19, 21, 20, 20, 19,  4,  7,  8,
- 10, 11, 11, 12, 12, 13, 13, 14,
- 14, 14, 14, 15, 15, 15, 15, 15,
- 16, 16, 16, 16, 16, 16, 16, 17,
- 17, 17, 17, 17, 17, 17, 16, 16,
- 16, 16, 17, 17, 17, 17, 18, 18,
- 18, 17, 17, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 19, 18, 18, 18,
- 19, 18, 19, 19, 19, 20, 20, 20,
- 19, 19, 19, 19, 19, 19, 19, 21,
- 21, 20, 19,  5,  8, 10, 11, 12,
- 13, 13, 13, 14, 14, 15, 15, 15,
- 15, 16, 16, 16, 16, 16, 17, 17,
- 17, 17, 17, 17, 17, 17, 18, 17,
- 18, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 19, 18, 19, 18,
- 18, 18, 18, 18, 19, 18, 17, 17,
- 18, 18, 19, 19, 19, 19, 18, 18,
- 18, 19,  6,  9, 11, 12, 13, 13,
- 14, 14, 14, 15, 15, 16, 16, 16,
- 16, 16, 16, 17, 17, 17, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 18,
- 18, 17, 18, 18, 17, 18, 18, 18,
- 18, 18, 18, 19, 19, 18, 18, 18,
- 19, 19, 19, 20, 19, 19, 18, 19,
- 19, 20, 21, 21, 19, 19, 18,  6,
- 10, 12, 13, 14, 14, 14, 15, 15,
- 15, 16, 16, 17, 17, 17, 17, 17,
- 17, 17, 18, 18, 19, 18, 18, 18,
- 19, 18, 18, 18, 19, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 18,
- 19, 20, 20, 19, 19, 19, 19, 20,
- 20, 19, 20, 19, 19, 19, 20, 20,
- 20, 19, 19, 18, 19,  7, 10, 12,
- 13, 14, 15, 15, 15, 16, 16, 17,
- 17, 17, 17, 17, 17, 18, 18, 18,
- 18, 19, 18, 19, 19, 19, 20, 19,
- 18, 19, 19, 18, 18, 19, 19, 19,
- 18, 19, 19, 20, 19, 18, 20, 21,
- 20, 20, 19, 19, 21, 20, 21, 20,
- 20, 20, 19, 19, 20, 20, 21, 20,
- 19,  7, 11, 13, 14, 15, 15, 15,
- 16, 16, 17, 17, 17, 17, 18, 18,
- 18, 18, 18, 19, 20, 19, 19, 20,
- 19, 19, 19, 19, 19, 19, 19, 19,
- 18, 18, 19, 20, 19, 19, 19, 20,
- 19, 19, 19, 20, 19, 20, 20, 21,
- 20, 20, 20, 21, 22, 20, 19, 20,
- 20, 21, 20, 21, 20, 19,  8, 11,
- 13, 14, 15, 16, 16, 16, 17, 17,
- 17, 18, 18, 18, 18, 18, 19, 18,
- 19, 19, 19, 19, 21, 19, 19, 21,
- 19, 20, 20, 20, 19, 18, 18,  8,
- 12, 14, 15, 16, 16, 16, 16, 17,
- 17, 17, 19, 18, 18, 19, 19, 20,
- 19, 18, 20, 19, 20, 20, 19, 19,
- 20, 20, 21, 21, 20, 19, 19, 19,
- 19, 19, 19, 20, 21, 20, 19, 19,
-  8, 12, 14, 15, 16, 16, 17, 17,
- 17, 18, 18, 18, 19, 19, 19, 19,
- 19, 19, 20, 21, 20, 21, 19, 21,
- 20, 20, 20, 20, 21, 20, 19, 20,
- 19, 20, 20, 20, 19, 22, 21, 21,
- 19,  9, 12, 14, 15, 16, 17, 17,
- 17, 18, 18, 18, 19, 19, 19, 19,
- 20, 19, 19, 19,  9, 13, 15, 16,
- 17, 17, 18, 18, 18, 19, 18, 20,
- 19, 20, 20, 20, 19,  9, 13, 15,
- 16, 17, 17, 18, 18, 18, 20, 18,
- 19, 20, 20, 20, 20, 19, 20, 19,
-  9, 13, 15, 16, 17, 18, 18, 18,
- 19, 19, 19, 19, 10, 14, 16, 17,
- 18, 18, 19, 19, 19, 19, 19, 10,
- 14, 16, 17, 18, 18, 18, 19, 19,
- 10, 14, 16, 17, 18, 18, 18, 19,
- 19, 20, 19, 10, 14, 16, 18, 18,
- 18, 19, 20, 19, 19, 10, 14, 17,
- 18, 18, 18, 10, 15, 17, 18, 19,
- 19, 21, 19, 11, 15, 17, 18, 18,
- 19, 19, 11, 15, 17, 18, 19, 19,
- 11, 15, 17, 18, 11, 15, 18, 19,
- 19, 11, 15, 18, 19, 19, 11, 16,
- 18, 19, 11, 15, 18, 19, 11, 16,
- 18, 12, 16, 18, 19, 12, 16, 19,
- 12, 16, 19, 19, 19, 12, 16, 19,
- 12, 16, 19, 19, 12, 16, 18, 12,
- 16, 19, 12, 17, 19, 12, 17, 19,
- 12, 17, 19, 12, 17, 19, 13, 17,
- 13, 17, 13, 17, 19, 19, 13, 17,
- 13, 17, 19, 13, 17, 13, 18, 19,
- 13, 17, 19, 13, 18, 13, 17, 13,
- 18, 13, 18, 13, 18, 13, 18, 13,
- 18, 13, 18, 14, 18, 19, 14, 18,
- 14, 18, 14, 18, 14, 18, 14, 19,
- 14, 19, 14, 18, 14, 18, 14, 18,
- 14, 19, 14, 14, 18, 14, 14, 19,
- 14, 18, 14, 19, 14, 19, 14, 15,
- 19, 15, 15, 15, 15, 19, 15, 19,
- 15, 15, 19, 15, 15, 19, 15, 19,
- 15, 19, 15, 19, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 16,
- 15, 15, 15, 16, 16, 16, 15, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 17, 16, 16, 16, 17,
- 17, 16, 17, 17, 16, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 18,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 18, 17, 17, 18, 17, 17, 17, 17,
- 18, 18, 17, 17, 17, 17, 17, 17,
- 17, 18, 17, 18, 18, 17, 17, 17,
- 18, 18, 18, 17, 18, 17, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 17,
- 18, 18, 18, 18, 19, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 18, 18, 18, 18, 19,
- 18, 18, 19, 18, 18, 18, 19, 18,
- 19, 18, 18, 19, 18, 18, 19, 19,
- 19, 19, 19, 18, 19, 18, 19, 18,
- 19, 19, 18, 18, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 18, 19,
- 19, 19, 19, 19, 18, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 20,
- 19, 19, 19, 19, 21, 19, 19, 20,
- 19, 20, 19, 19, 19, 19, 19, 20,
- 20, 20, 19, 19, 19, 20, 19, 19,
- 19, 20, 20, 19, 20, 19, 19, 21,
- 20, 20, 19, 19, 19, 19, 19, 19,
- 20, 19, 20, 20, 20, 20, 20, 20,
- 20, 19, 19, 21, 20, 20, 19, 19,
-};
-
-static const uint32_t coef3_huffcodes[1072] = {
- 0x001b2, 0x00069, 0x00000, 0x00004, 0x00006, 0x0000e, 0x00014, 0x00019,
- 0x00016, 0x0002b, 0x00030, 0x0003d, 0x0003c, 0x0005a, 0x0005f, 0x0006d,
- 0x0007e, 0x0005f, 0x0007f, 0x000b6, 0x000bc, 0x000d8, 0x000f2, 0x000fe,
- 0x000bc, 0x000fc, 0x00161, 0x0016e, 0x00174, 0x00176, 0x001a2, 0x001e3,
- 0x001f3, 0x00174, 0x0017a, 0x001ea, 0x002a8, 0x002c4, 0x002e6, 0x00314,
- 0x00346, 0x00367, 0x003e9, 0x002e5, 0x002ee, 0x003d6, 0x00555, 0x00554,
- 0x00557, 0x005c3, 0x005d6, 0x006e0, 0x0062f, 0x006e2, 0x00799, 0x00789,
- 0x007fa, 0x005ce, 0x007fe, 0x005ec, 0x007cc, 0x007af, 0x00aa7, 0x00b19,
- 0x00b94, 0x00b85, 0x00b9f, 0x00c48, 0x00c45, 0x00dd8, 0x00c4c, 0x00c4b,
- 0x00d99, 0x00d1f, 0x00dc2, 0x00f95, 0x00fa2, 0x00bb5, 0x00b9f, 0x00f5d,
- 0x00bbf, 0x00f47, 0x0154a, 0x00fd5, 0x00f45, 0x00f7f, 0x0160d, 0x01889,
- 0x01757, 0x01722, 0x018b3, 0x0172d, 0x01a39, 0x01a18, 0x01bb3, 0x01b30,
- 0x01e63, 0x0173c, 0x01b35, 0x01723, 0x01e80, 0x01fee, 0x01761, 0x01ffc,
- 0x01f7f, 0x02c7c, 0x01fa1, 0x0177b, 0x01755, 0x0175a, 0x01fa6, 0x02eab,
- 0x0310a, 0x02c69, 0x03669, 0x03127, 0x03103, 0x02e43, 0x03662, 0x03165,
- 0x03124, 0x0313b, 0x03111, 0x03668, 0x0343b, 0x03c52, 0x03efc, 0x02e6c,
- 0x03fda, 0x03ef8, 0x02e7b, 0x03ee2, 0x03cc5, 0x03d72, 0x058c0, 0x03df8,
- 0x02ea9, 0x03e7e, 0x0556d, 0x05c82, 0x03d71, 0x03e7b, 0x03c42, 0x058d7,
- 0x03f4e, 0x06200, 0x03d70, 0x05cb2, 0x05c96, 0x05cb0, 0x03f45, 0x05cb1,
- 0x02e6d, 0x03110, 0x02f68, 0x05c90, 0x07ca6, 0x07c88, 0x06204, 0x062c8,
- 0x078a6, 0x07986, 0x079d5, 0x0b1ad, 0x07989, 0x0b079, 0x05cdd, 0x0aad4,
- 0x05de8, 0x07dcd, 0x07987, 0x05d67, 0x05d99, 0x0b91d, 0x07cf1, 0x05d9b,
- 0x079d7, 0x0b07b, 0x05c85, 0x05d9a, 0x07dcc, 0x07ebf, 0x07dce, 0x07dfb,
- 0x07ec0, 0x07d1a, 0x07a07, 0x05c84, 0x0c471, 0x07cf2, 0x0baef, 0x0b9d2,
- 0x05deb, 0x07bd6, 0x0b845, 0x05d98, 0x0b91a, 0x0bae8, 0x0c4e0, 0x0dc31,
- 0x0f93d, 0x0bbce, 0x0d1d2, 0x0f7a9, 0x0d9b9, 0x0bbcb, 0x0b900, 0x0aad7,
- 0x0babd, 0x0c4e1, 0x0f46f, 0x0c588, 0x0c58b, 0x160e6, 0x0bbcf, 0x0bac3,
- 0x0f945, 0x0f7a3, 0x0d1c1, 0x0fb8e, 0x0f7a4, 0x0fb8c, 0x0f40c, 0x0c473,
- 0x0fd72, 0x0bbcd, 0x0fffa, 0x0f940, 0x0bbc9, 0x0f7a8, 0x1a1ed, 0x0bbc5,
- 0x1f26f, 0x163fd, 0x160c7, 0x1a1f5, 0x0f947, 0x163fc, 0x154b3, 0x0fff6,
- 0x163f6, 0x160e9, 0x1a1f0, 0x0bab9, 0x0baba, 0x17086, 0x0b903, 0x0fd75,
- 0x0f308, 0x176f3, 0x163ff, 0x0fd7d, 0x1bb78, 0x163fb, 0x188db, 0x1a1f7,
- 0x154b2, 0x172fd, 0x163f4, 0x1bb73, 0x172ff, 0x0babc, 0x0f97d, 0x1a1f3,
- 0x1bb6d, 0x1ffd5, 0x1a1f4, 0x1f272, 0x17380, 0x17382, 0x1ffe7, 0x0bac8,
- 0x0bbc4, 0x188d3, 0x160e0, 0x0fd7b, 0x1725f, 0x172f5, 0x1bb79, 0x1fad9,
- 0x1f269, 0x188d0, 0x0bac4, 0x0bac5, 0x31185, 0x188d2, 0x188cc, 0x31187,
- 0x3e7fe, 0x188d1, 0x1bb6c, 0x1f268, 0x1fad2, 0x1ffd9, 0x1a1ea, 0x1bb68,
- 0x1facb, 0x3fdb2, 0x1e81a, 0x188ce, 0x172fb, 0x1a1ef, 0x1face, 0x1bb70,
- 0x0bac1, 0x1bb6b, 0x172f8, 0x1bb66, 0x1ffdf, 0x1bb6a, 0x1ffd7, 0x1f266,
- 0x176f8, 0x37653, 0x1fa7e, 0x31182, 0x1fac8, 0x2c7e3, 0x370ee, 0x176ec,
- 0x176e9, 0x2e4bc, 0x160c5, 0x3765a, 0x3ce9c, 0x17373, 0x176e8, 0x188d4,
- 0x176f1, 0x176ef, 0x37659, 0x1bb7c, 0x1ffde, 0x176f2, 0x3118b, 0x2c7d4,
- 0x37651, 0x5ce9f, 0x37650, 0x31191, 0x3f4f6, 0x3f4f5, 0x7a06c, 0x1fac1,
- 0x5c97b, 0x2c7e0, 0x79d3a, 0x3e7fd, 0x2c7df, 0x3f4f0, 0x7a06d, 0x376c1,
- 0x79d3b, 0x00004, 0x00014, 0x00059, 0x000ab, 0x000b8, 0x00177, 0x001f5,
- 0x001f2, 0x00315, 0x003fc, 0x005bd, 0x0062d, 0x006e8, 0x007dd, 0x00b04,
- 0x007cd, 0x00b1e, 0x00d1e, 0x00f15, 0x00f3b, 0x00f41, 0x01548, 0x018b0,
- 0x0173b, 0x01884, 0x01a1c, 0x01bb4, 0x01f25, 0x017b5, 0x0176d, 0x01ef8,
- 0x02e73, 0x03107, 0x03125, 0x03105, 0x02e49, 0x03ce8, 0x03ef9, 0x03e5e,
- 0x02e72, 0x03471, 0x03fd9, 0x0623f, 0x078a0, 0x06867, 0x05cb3, 0x06272,
- 0x068ec, 0x06e9a, 0x079d4, 0x06e98, 0x0b1aa, 0x06e1a, 0x07985, 0x068ee,
- 0x06e9b, 0x05c88, 0x0b1ac, 0x07dfa, 0x05d65, 0x07cf0, 0x07cbf, 0x0c475,
- 0x160eb, 0x1bb7e, 0x0f7a6, 0x1fedd, 0x160e3, 0x0fffb, 0x0fb8d, 0x0fff9,
- 0x0d1c0, 0x0c58c, 0x1a1e9, 0x0bab8, 0x0f5cf, 0x0fff5, 0x376c5, 0x1a1ec,
- 0x160ed, 0x1fede, 0x1fac9, 0x1a1eb, 0x1f224, 0x176ee, 0x0fd79, 0x17080,
- 0x17387, 0x1bb7a, 0x1ffe9, 0x176f7, 0x17385, 0x17781, 0x2c7d5, 0x17785,
- 0x1ffe3, 0x163f5, 0x1fac2, 0x3e7f9, 0x3118d, 0x3fdb1, 0x1ffe2, 0x1f226,
- 0x3118a, 0x2c7d9, 0x31190, 0x3118c, 0x3f4f3, 0x1bb7f, 0x1bb72, 0x31184,
- 0xb92f4, 0x3e7fb, 0x6e1d9, 0x1faca, 0x62300, 0x3fdb8, 0x3d037, 0x3e7fc,
- 0x62301, 0x3f4f2, 0x1f26a, 0x0000e, 0x00063, 0x000f8, 0x001ee, 0x00377,
- 0x003f7, 0x006e3, 0x005cc, 0x00b05, 0x00dd2, 0x00fd4, 0x0172e, 0x0172a,
- 0x01e23, 0x01f2d, 0x01763, 0x01769, 0x0176c, 0x02e75, 0x03104, 0x02ec1,
- 0x03e58, 0x0583f, 0x03f62, 0x03f44, 0x058c5, 0x0623c, 0x05cf4, 0x07bd7,
- 0x05d9d, 0x0aad2, 0x05d66, 0x0b1a9, 0x0b078, 0x07cfe, 0x0b918, 0x0c46f,
- 0x0b919, 0x0b847, 0x06e1b, 0x0b84b, 0x0aad8, 0x0fd74, 0x172f4, 0x17081,
- 0x0f97c, 0x1f273, 0x0f7a0, 0x0fd7c, 0x172f7, 0x0fd7a, 0x1bb77, 0x172fe,
- 0x1f270, 0x0fd73, 0x1bb7b, 0x1a1bc, 0x1bb7d, 0x0bbc3, 0x172f6, 0x0baeb,
- 0x0fb8f, 0x3f4f4, 0x3fdb4, 0x376c8, 0x3e7fa, 0x1ffd0, 0x62303, 0xb92f5,
- 0x1f261, 0x31189, 0x3fdb5, 0x2c7db, 0x376c9, 0x1fad6, 0x1fad1, 0x00015,
- 0x000f0, 0x002e0, 0x0058e, 0x005d7, 0x00c4d, 0x00fa1, 0x00bdb, 0x01756,
- 0x01f70, 0x02c19, 0x0313c, 0x0370f, 0x03cc0, 0x02ea8, 0x058c6, 0x058c7,
- 0x02eb7, 0x058d0, 0x07d18, 0x0aa58, 0x0b848, 0x05d9e, 0x05d6c, 0x0b84c,
- 0x0c589, 0x0b901, 0x163f8, 0x0bac9, 0x0b9c5, 0x0f93c, 0x188d8, 0x0bbc7,
- 0x160ec, 0x0fd6f, 0x188d9, 0x160ea, 0x0f7a7, 0x0f944, 0x0baab, 0x0dc3a,
- 0x188cf, 0x176fb, 0x2c7d8, 0x2c7d7, 0x1bb75, 0x5ce9e, 0x62302, 0x370ed,
- 0x176f4, 0x1ffd1, 0x370ef, 0x3f4f8, 0x376c7, 0x1ffe1, 0x376c6, 0x176ff,
- 0x6e1d8, 0x176f6, 0x17087, 0x0f5cd, 0x00035, 0x001a0, 0x0058b, 0x00aac,
- 0x00b9a, 0x0175f, 0x01e22, 0x01e8c, 0x01fb2, 0x0310b, 0x058d1, 0x0552e,
- 0x05c27, 0x0686e, 0x07ca7, 0x0c474, 0x0dc33, 0x07bf2, 0x05de9, 0x07a35,
- 0x0baaa, 0x0b9eb, 0x0fb95, 0x0b9b8, 0x17381, 0x1f262, 0x188cd, 0x17088,
- 0x172fa, 0x0f7a2, 0x1fad3, 0x0bac0, 0x3765c, 0x1fedf, 0x1f225, 0x1fad4,
- 0x2c7da, 0x5ce9d, 0x3e7f8, 0x1e203, 0x188d7, 0x00054, 0x002c0, 0x007a1,
- 0x00f78, 0x01b36, 0x01fa3, 0x0313a, 0x03436, 0x0343a, 0x07d1d, 0x07bd8,
- 0x05cdf, 0x0b846, 0x0b189, 0x0d9b8, 0x0fff8, 0x0d9be, 0x0c58a, 0x05dea,
- 0x0d1d3, 0x160e4, 0x1f26b, 0x188da, 0x1e202, 0x2c7d2, 0x163fe, 0x31193,
- 0x17782, 0x376c2, 0x2c7d1, 0x3fdb0, 0x3765d, 0x2c7d0, 0x1fad0, 0x1e201,
- 0x188dd, 0x2c7e2, 0x37657, 0x37655, 0x376c4, 0x376c0, 0x176ea, 0x0006f,
- 0x003cf, 0x00dd5, 0x01f23, 0x02c61, 0x02ed0, 0x05d54, 0x0552d, 0x07883,
- 0x0b1a8, 0x0b91c, 0x0babf, 0x0b902, 0x0f7aa, 0x0f7a5, 0x1a1e8, 0x1ffd6,
- 0x0babe, 0x1a1bf, 0x163f3, 0x1ffd8, 0x1fad7, 0x1f275, 0x1ffdc, 0x0007d,
- 0x005bc, 0x01549, 0x02a99, 0x03def, 0x06273, 0x079d6, 0x07d1b, 0x0aad3,
- 0x0d0fc, 0x2c7dd, 0x188d6, 0x0bac2, 0x2c7e1, 0x1bb76, 0x1a1bd, 0x31186,
- 0x0fd78, 0x1a1be, 0x31183, 0x3fdb6, 0x3f4f1, 0x37652, 0x1fad5, 0x3f4f9,
- 0x3e7ff, 0x5ce9c, 0x3765b, 0x31188, 0x17372, 0x000bd, 0x0078b, 0x01f21,
- 0x03c43, 0x03ded, 0x0aad6, 0x07ec1, 0x0f942, 0x05c86, 0x17089, 0x0babb,
- 0x1ffe8, 0x2c7de, 0x1f26e, 0x1fac4, 0x3f4f7, 0x37656, 0x1fa7d, 0x376c3,
- 0x3fdb3, 0x3118f, 0x1fac6, 0x000f8, 0x007ed, 0x01efd, 0x03e7a, 0x05c91,
- 0x0aad9, 0x0baec, 0x0dc32, 0x0f46e, 0x1e200, 0x176fa, 0x3765e, 0x3fdb7,
- 0x2c7d6, 0x3fdb9, 0x37654, 0x37658, 0x3118e, 0x1ffdb, 0x000f6, 0x00c43,
- 0x03106, 0x068ef, 0x0b84d, 0x0b188, 0x0bbcc, 0x1f264, 0x1bb69, 0x17386,
- 0x1fac0, 0x00171, 0x00f39, 0x03e41, 0x068ed, 0x0d9bc, 0x0f7a1, 0x1bb67,
- 0x1ffdd, 0x176f9, 0x001b9, 0x00f7d, 0x03f63, 0x0d0fd, 0x0b9ea, 0x188dc,
- 0x1fac3, 0x1a1f2, 0x31192, 0x1ffe4, 0x001f6, 0x01754, 0x06865, 0x0f309,
- 0x160e5, 0x176f5, 0x3765f, 0x1facc, 0x001e9, 0x01a1a, 0x06201, 0x0f105,
- 0x176f0, 0x002df, 0x01756, 0x05d6d, 0x163fa, 0x176ed, 0x00342, 0x02e40,
- 0x0d0ff, 0x17082, 0x003cd, 0x02a98, 0x0fffc, 0x2c7dc, 0x1fa7f, 0x003fe,
- 0x03764, 0x0fffd, 0x176fc, 0x1fac5, 0x002f7, 0x02ed1, 0x0fb97, 0x0058a,
- 0x02edc, 0x0bbc8, 0x005d4, 0x0623d, 0x160e8, 0x0062e, 0x05830, 0x163f9,
- 0x006eb, 0x06205, 0x1f274, 0x007de, 0x062c9, 0x1f265, 0x005c9, 0x05cde,
- 0x1ffd3, 0x005d4, 0x07988, 0x007ce, 0x0b849, 0x00b1b, 0x05c89, 0x1fac7,
- 0x00b93, 0x05c83, 0x00b9e, 0x0f14f, 0x00c4a, 0x0b9c7, 0x00dd4, 0x0c470,
- 0x1f271, 0x00f38, 0x0fb96, 0x176eb, 0x00fa0, 0x163f7, 0x00bb2, 0x0b91b,
- 0x00bbe, 0x0f102, 0x00f44, 0x0f946, 0x1facd, 0x00f79, 0x0d9bd, 0x0154d,
- 0x0bbc6, 0x00fd2, 0x160e7, 0x0172b, 0x188cb, 0x0175e, 0x0fd76, 0x0175c,
- 0x1bb71, 0x0189f, 0x1a1ee, 0x01f24, 0x1a1f6, 0x01ba7, 0x0bbca, 0x01f7d,
- 0x0ffff, 0x01f2e, 0x1bb65, 0x01bb5, 0x172f9, 0x01fef, 0x1f26c, 0x01f3e,
- 0x0fd77, 0x01762, 0x1bb6e, 0x01ef9, 0x172fc, 0x01fa0, 0x02ab7, 0x02e4a,
- 0x1f267, 0x01fb3, 0x1ffda, 0x02e42, 0x03101, 0x17780, 0x0313d, 0x03475,
- 0x17784, 0x03126, 0x1facf, 0x03c51, 0x17783, 0x03e40, 0x1ffe5, 0x03663,
- 0x1ffe0, 0x03e8f, 0x1f26d, 0x0343c, 0x03cc1, 0x176fd, 0x03e45, 0x02ec0,
- 0x03f61, 0x03dee, 0x03fd8, 0x0583e, 0x02e45, 0x03e59, 0x03d02, 0x05ce8,
- 0x05568, 0x176fe, 0x02f69, 0x1fad8, 0x058c1, 0x05c83, 0x1ffe6, 0x06271,
- 0x06e1c, 0x062c7, 0x068e1, 0x0552f, 0x06864, 0x06866, 0x06e99, 0x05cbc,
- 0x07ca5, 0x078a1, 0x05c82, 0x07dcf, 0x0623b, 0x0623e, 0x068e8, 0x07a36,
- 0x05d9c, 0x0b077, 0x07cf3, 0x07a34, 0x07ca4, 0x07d19, 0x079d2, 0x07d1c,
- 0x07bd9, 0x0b84a, 0x0fb94, 0x0aad5, 0x0dc30, 0x07bf3, 0x0baee, 0x0b07a,
- 0x0c472, 0x0b91e, 0x0d9ba, 0x05d9f, 0x0d0fe, 0x0b9c6, 0x05c87, 0x0f14e,
- 0x0baed, 0x0b92e, 0x0f103, 0x0b9c4, 0x0fb91, 0x0d9bb, 0x0b1ab, 0x0c58d,
- 0x0fffe, 0x0f93b, 0x0f941, 0x0baea, 0x0b91f, 0x0f5cc, 0x0d9bf, 0x0f943,
- 0x0f104, 0x1f260, 0x0fb92, 0x0f93f, 0x0f3a6, 0x0bac7, 0x0f7ab, 0x0bac6,
- 0x17383, 0x0fd6d, 0x0bae9, 0x0fd6e, 0x1e74f, 0x188ca, 0x1f227, 0x0fb93,
- 0x0fb90, 0x0fff7, 0x17085, 0x17083, 0x160e1, 0x17084, 0x0f93e, 0x160e2,
- 0x160c6, 0x1a1f1, 0x1bb6f, 0x17384, 0x0fd70, 0x1f263, 0x188d5, 0x173a6,
- 0x0f5ce, 0x163f2, 0x0fd71, 0x1ffd2, 0x160c4, 0x1ffd4, 0x2c7d3, 0x1bb74,
-};
-
-static const uint8_t coef3_huffbits[1072] = {
-  9,  7,  2,  3,  4,  4,  5,  5,
-  6,  6,  6,  6,  7,  7,  7,  7,
-  7,  8,  8,  8,  8,  8,  8,  8,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 12, 11, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 13,
- 13, 14, 13, 14, 14, 13, 14, 13,
- 13, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 15,
- 14, 14, 15, 14, 14, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 14, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 14, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 16, 15, 16, 16, 16,
- 16, 15, 15, 16, 16, 16, 16, 16,
- 15, 16, 16, 16, 15, 16, 15, 15,
- 16, 15, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 17, 16, 17, 16, 17, 17, 16,
- 17, 16, 17, 16, 16, 17, 17, 17,
- 16, 17, 16, 16, 17, 16, 17, 16,
- 17, 17, 16, 16, 17, 17, 17, 17,
- 17, 17, 17, 17, 16, 17, 17, 16,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 16, 18, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 16, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 18,
- 17, 17, 17, 17, 18, 17, 17, 18,
- 19, 17, 17, 17, 18, 17, 17, 17,
- 18, 18, 18, 17, 17, 17, 18, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 18, 18, 18, 18, 18, 18, 18, 18,
- 18, 18, 17, 18, 18, 18, 18, 17,
- 18, 18, 18, 17, 17, 18, 18, 18,
- 18, 19, 18, 18, 19, 19, 20, 18,
- 19, 18, 19, 19, 18, 19, 20, 18,
- 19,  4,  6,  7,  8,  9,  9,  9,
- 10, 10, 10, 11, 11, 11, 11, 12,
- 12, 12, 12, 12, 12, 13, 13, 13,
- 13, 13, 13, 13, 13, 14, 14, 14,
- 14, 14, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 16, 15, 15, 15,
- 15, 16, 16, 15, 16, 16, 15, 16,
- 17, 17, 17, 17, 17, 16, 16, 16,
- 16, 16, 17, 17, 17, 16, 18, 17,
- 17, 17, 18, 17, 17, 18, 17, 17,
- 17, 17, 17, 18, 17, 18, 18, 18,
- 17, 17, 18, 19, 18, 18, 17, 17,
- 18, 18, 18, 18, 19, 17, 17, 18,
- 20, 19, 19, 18, 19, 18, 19, 19,
- 19, 19, 17,  5,  7,  9, 10, 10,
- 11, 11, 12, 12, 12, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 15,
- 14, 15, 15, 15, 15, 15, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 15, 16, 16, 17, 17, 17,
- 16, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 16,
- 16, 19, 18, 18, 19, 17, 19, 20,
- 17, 18, 18, 18, 18, 18, 18,  6,
-  8, 10, 11, 12, 12, 12, 13, 13,
- 13, 14, 14, 14, 14, 15, 15, 15,
- 15, 15, 15, 16, 16, 16, 16, 16,
- 16, 17, 17, 17, 16, 16, 17, 17,
- 17, 17, 17, 17, 17, 16, 16, 16,
- 17, 18, 18, 18, 17, 19, 19, 18,
- 18, 17, 18, 19, 18, 17, 18, 18,
- 19, 18, 17, 17,  6,  9, 11, 12,
- 13, 13, 13, 14, 14, 14, 15, 15,
- 15, 15, 15, 16, 16, 16, 16, 16,
- 16, 17, 16, 17, 17, 17, 17, 17,
- 17, 17, 18, 17, 18, 17, 17, 18,
- 18, 19, 19, 17, 17,  7, 10, 12,
- 13, 13, 14, 14, 14, 14, 15, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 17, 17, 17, 17, 18, 17, 18,
- 18, 18, 18, 18, 18, 18, 18, 17,
- 17, 18, 18, 18, 18, 18, 18,  7,
- 10, 12, 13, 14, 15, 15, 15, 15,
- 16, 16, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 18, 17, 17,  8,
- 11, 13, 14, 15, 15, 15, 15, 16,
- 16, 18, 17, 17, 18, 17, 17, 18,
- 17, 17, 18, 18, 19, 18, 18, 19,
- 19, 19, 18, 18, 18,  8, 11, 13,
- 14, 15, 16, 16, 16, 16, 17, 17,
- 17, 18, 17, 18, 19, 18, 18, 18,
- 18, 18, 18,  8, 12, 14, 15, 15,
- 16, 16, 16, 17, 17, 18, 18, 18,
- 18, 18, 18, 18, 18, 17,  9, 12,
- 14, 15, 16, 16, 17, 17, 17, 17,
- 18,  9, 12, 14, 15, 16, 17, 17,
- 17, 18,  9, 13, 15, 16, 17, 17,
- 18, 17, 18, 17,  9, 13, 15, 16,
- 17, 18, 18, 18, 10, 13, 15, 16,
- 18, 10, 14, 16, 17, 18, 10, 14,
- 16, 17, 10, 14, 16, 18, 18, 10,
- 14, 16, 18, 18, 11, 15, 16, 11,
- 15, 17, 11, 15, 17, 11, 15, 17,
- 11, 15, 17, 11, 15, 17, 12, 16,
- 17, 12, 15, 12, 16, 12, 16, 18,
- 12, 16, 12, 16, 12, 16, 12, 16,
- 17, 12, 16, 18, 12, 17, 13, 16,
- 13, 16, 13, 16, 18, 13, 16, 13,
- 17, 13, 17, 13, 17, 13, 17, 13,
- 17, 13, 17, 13, 17, 13, 17, 13,
- 16, 13, 17, 13, 17, 13, 17, 14,
- 17, 14, 17, 14, 17, 14, 14, 14,
- 17, 14, 17, 14, 14, 18, 14, 14,
- 18, 14, 18, 14, 18, 14, 17, 14,
- 17, 14, 17, 14, 14, 18, 14, 15,
- 15, 15, 14, 15, 15, 14, 15, 15,
- 15, 18, 15, 18, 15, 15, 17, 15,
- 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 16, 15, 15, 15, 15, 16,
- 16, 16, 16, 16, 15, 15, 15, 15,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 17, 16, 16,
- 16, 17, 16, 16, 16, 17, 17, 17,
- 17, 17, 16, 17, 17, 17, 17, 16,
- 16, 16, 17, 17, 17, 17, 16, 17,
- 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 18, 17,
-};
-
-static const uint32_t coef4_huffcodes[476] = {
- 0x00f01, 0x0001e, 0x00000, 0x00004, 0x00006, 0x0000d, 0x0000a, 0x00017,
- 0x0001d, 0x00017, 0x0002c, 0x00031, 0x00039, 0x0003e, 0x00039, 0x0005a,
- 0x00066, 0x00070, 0x0007b, 0x00070, 0x00077, 0x000af, 0x000c9, 0x000f2,
- 0x000f4, 0x000b2, 0x000e3, 0x0015b, 0x0015d, 0x00181, 0x0019d, 0x001e3,
- 0x001c5, 0x002b5, 0x002db, 0x00338, 0x003c3, 0x003cc, 0x003f0, 0x002cd,
- 0x003fa, 0x003a1, 0x005b4, 0x00657, 0x007ab, 0x0074d, 0x0074c, 0x00ac1,
- 0x00ac5, 0x0076b, 0x00ca8, 0x00f04, 0x00f00, 0x00fe3, 0x00f3c, 0x00f10,
- 0x00f39, 0x00fe6, 0x00e26, 0x00e90, 0x016c5, 0x01827, 0x01954, 0x015c5,
- 0x01958, 0x01f8a, 0x01c4a, 0x02b0f, 0x02b41, 0x02b0e, 0x033c6, 0x03050,
- 0x01c4f, 0x02d88, 0x0305c, 0x03c18, 0x02b4f, 0x02cc2, 0x03a47, 0x05680,
- 0x0569d, 0x06442, 0x06443, 0x06446, 0x0656e, 0x06444, 0x07120, 0x0748a,
- 0x0c1ba, 0x07e22, 0x07aa6, 0x07f25, 0x07aa7, 0x07e20, 0x0c11b, 0x0c118,
- 0x07aa5, 0x0ad0a, 0x0f389, 0x19ebb, 0x0caad, 0x0fe42, 0x0fe40, 0x16c34,
- 0x2b4e5, 0x33d65, 0x16c30, 0x1e7ae, 0x1e25c, 0x18370, 0x1e703, 0x19eba,
- 0x16c37, 0x0e234, 0x16c6e, 0x00004, 0x0002a, 0x00061, 0x00075, 0x000cb,
- 0x000ff, 0x00190, 0x001eb, 0x001d1, 0x002b9, 0x00307, 0x00339, 0x0033f,
- 0x003fb, 0x003b4, 0x0060c, 0x00679, 0x00645, 0x0067d, 0x0078a, 0x007e3,
- 0x00749, 0x00ac4, 0x00ad2, 0x00ae3, 0x00c10, 0x00c16, 0x00ad1, 0x00cf4,
- 0x00fe2, 0x01586, 0x00e9d, 0x019f1, 0x01664, 0x01e26, 0x01d38, 0x02b4d,
- 0x033c5, 0x01fc2, 0x01fc3, 0x01d28, 0x03c1d, 0x0598e, 0x0f094, 0x07aa4,
- 0x0ad38, 0x0ac0c, 0x0c11a, 0x079ea, 0x0c881, 0x0fe44, 0x0b635, 0x0ac0d,
- 0x0b61e, 0x05987, 0x07121, 0x0f382, 0x0f387, 0x0e237, 0x0fe47, 0x0f383,
- 0x0f091, 0x0f385, 0x0e233, 0x182ee, 0x19eb8, 0x1663e, 0x0f093, 0x00014,
- 0x00058, 0x00159, 0x00167, 0x00300, 0x003d4, 0x005b5, 0x0079d, 0x0076a,
- 0x00b67, 0x00b60, 0x00f05, 0x00cf0, 0x00f17, 0x00e95, 0x01822, 0x01913,
- 0x016c2, 0x0182f, 0x01959, 0x01fcb, 0x01e27, 0x01c40, 0x033c7, 0x01e7b,
- 0x01c49, 0x02d89, 0x01e23, 0x01660, 0x03f12, 0x02cc6, 0x033e1, 0x05b34,
- 0x0609a, 0x06569, 0x07488, 0x07e21, 0x0cf5f, 0x0712c, 0x0389d, 0x067cf,
- 0x07f28, 0x1663f, 0x33d67, 0x1663d, 0x1e25d, 0x3c1ab, 0x15c44, 0x16c36,
- 0x0001f, 0x000ec, 0x00323, 0x005b2, 0x0079f, 0x00ac2, 0x00f16, 0x00e9e,
- 0x01956, 0x01e0f, 0x019ea, 0x01666, 0x02b89, 0x02b02, 0x02d8c, 0x03c1b,
- 0x03c19, 0x032b5, 0x03f9c, 0x02ccf, 0x03897, 0x05b35, 0x0ad02, 0x07f29,
- 0x06441, 0x03884, 0x07888, 0x0784e, 0x06568, 0x0c1bb, 0x05986, 0x067cc,
- 0x0fe49, 0x0fe48, 0x0c1bc, 0x0fe41, 0x18371, 0x1663c, 0x0e231, 0x0711e,
- 0x0ad09, 0x0f092, 0x0002d, 0x001db, 0x00781, 0x00c1a, 0x00f55, 0x01580,
- 0x01ea8, 0x02d9b, 0x032af, 0x03f16, 0x03c1c, 0x07834, 0x03c45, 0x0389c,
- 0x067ce, 0x06445, 0x0c1b9, 0x07889, 0x07f3a, 0x0784f, 0x07f2b, 0x0ad0b,
- 0x0f090, 0x0c11d, 0x0e94e, 0x0711f, 0x0e9f1, 0x0f38e, 0x079e9, 0x0ad03,
- 0x0f09b, 0x0caae, 0x0fe46, 0x2b4e6, 0x0e9f0, 0x19eb6, 0x67ac1, 0x67ac0,
- 0x33d66, 0x0f388, 0x00071, 0x003a0, 0x00ca9, 0x01829, 0x01d39, 0x02b43,
- 0x02cc4, 0x06554, 0x0f09a, 0x0b61f, 0x067cd, 0x0711c, 0x0b636, 0x07f2a,
- 0x0b634, 0x0c11f, 0x0cf5e, 0x0b61d, 0x0f06b, 0x0caab, 0x0c1be, 0x0e94c,
- 0x0f099, 0x182ed, 0x0e94f, 0x0c119, 0x0e232, 0x2b4e4, 0x0f38a, 0x19eb4,
- 0x1e25f, 0x0e94d, 0x000b7, 0x00785, 0x016cc, 0x03051, 0x033c4, 0x0656f,
- 0x03891, 0x0711d, 0x0caaf, 0x0f097, 0x07489, 0x0f098, 0x0c880, 0x0caaa,
- 0x0f386, 0x19eb7, 0x16c6f, 0x0f384, 0x182e8, 0x182e9, 0x0e230, 0x1e700,
- 0x33d62, 0x33d63, 0x33d64, 0x16c33, 0x0e216, 0x000fd, 0x00c15, 0x01665,
- 0x03c4a, 0x07f3b, 0x07896, 0x0c11c, 0x0e215, 0x16c32, 0x0f38b, 0x0f38d,
- 0x182ea, 0x1e701, 0x712df, 0x15c46, 0x00194, 0x00fe0, 0x03f13, 0x0748b,
- 0x0f096, 0x0cf80, 0x1e25e, 0xe25bd, 0x33d61, 0x16c31, 0x001f9, 0x01912,
- 0x05710, 0x0f3d0, 0x0c1bf, 0x00301, 0x01e24, 0x0ad08, 0x003cd, 0x01c41,
- 0x0c1bd, 0x00563, 0x03a52, 0x0f3d1, 0x00570, 0x02cce, 0x0e217, 0x0067b,
- 0x0655d, 0x0074b, 0x06447, 0x00c12, 0x074fb, 0x00f08, 0x0b61c, 0x00e22,
- 0x0fe43, 0x016c7, 0x01836, 0x019f2, 0x01c43, 0x01d3f, 0x01fcf, 0x02b4c,
- 0x0304c, 0x032b6, 0x03a46, 0x05607, 0x03f17, 0x02cc5, 0x0609b, 0x0655c,
- 0x07e23, 0x067c1, 0x07f26, 0x07f27, 0x0f095, 0x0e9f3, 0x0cf81, 0x0c11e,
- 0x0caac, 0x0f38f, 0x0e9f2, 0x074fa, 0x0e236, 0x0fe45, 0x1c428, 0x0e235,
- 0x182ef, 0x19eb5, 0x0f3d6, 0x182ec, 0x16c35, 0x0f38c, 0x2b4e7, 0x15c47,
- 0xe25bc, 0x1e702, 0x1c4b6, 0x0e25a, 0x3c1aa, 0x15c45, 0x1c429, 0x19eb9,
- 0x1e7af, 0x182eb, 0x1e0d4, 0x3896e,
-};
-
-static const uint8_t coef4_huffbits[476] = {
- 12,  6,  2,  3,  4,  4,  5,  5,
-  5,  6,  6,  6,  6,  6,  7,  7,
-  7,  7,  7,  8,  8,  8,  8,  8,
-  8,  9,  9,  9,  9,  9,  9,  9,
- 10, 10, 10, 10, 10, 10, 10, 11,
- 10, 11, 11, 11, 11, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 13, 13, 13, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
- 14, 14, 14, 14, 14, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 16, 16,
- 16, 15, 15, 15, 15, 15, 16, 16,
- 15, 16, 16, 17, 16, 16, 16, 17,
- 18, 18, 17, 17, 17, 17, 17, 17,
- 17, 17, 17,  4,  6,  7,  8,  8,
-  8,  9,  9, 10, 10, 10, 10, 10,
- 10, 11, 11, 11, 11, 11, 11, 11,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 13, 13, 13, 14, 13, 14, 14,
- 14, 13, 13, 14, 14, 16, 16, 15,
- 16, 16, 16, 15, 16, 16, 16, 16,
- 16, 16, 16, 16, 16, 17, 16, 16,
- 16, 16, 17, 17, 17, 18, 16,  5,
-  8,  9, 10, 10, 10, 11, 11, 12,
- 12, 12, 12, 12, 12, 13, 13, 13,
- 13, 13, 13, 13, 13, 14, 14, 13,
- 14, 14, 13, 14, 14, 15, 14, 15,
- 15, 15, 16, 15, 16, 16, 15, 15,
- 15, 18, 18, 18, 17, 18, 17, 17,
-  6,  9, 10, 11, 11, 12, 12, 13,
- 13, 13, 13, 14, 14, 14, 14, 14,
- 14, 14, 14, 15, 15, 15, 16, 15,
- 15, 15, 15, 15, 15, 16, 16, 15,
- 16, 16, 16, 16, 17, 18, 17, 16,
- 16, 16,  7, 10, 11, 12, 12, 13,
- 13, 14, 14, 14, 14, 15, 14, 15,
- 15, 15, 16, 15, 15, 15, 15, 16,
- 16, 16, 17, 16, 17, 16, 15, 16,
- 16, 16, 16, 18, 17, 17, 19, 19,
- 18, 16,  7, 11, 12, 13, 14, 14,
- 15, 15, 16, 16, 15, 16, 16, 15,
- 16, 16, 16, 16, 16, 16, 16, 17,
- 16, 17, 17, 16, 17, 18, 16, 17,
- 17, 17,  8, 11, 13, 14, 14, 15,
- 15, 16, 16, 16, 16, 16, 16, 16,
- 16, 17, 17, 16, 17, 17, 17, 17,
- 18, 18, 18, 17, 17,  8, 12, 14,
- 14, 15, 15, 16, 17, 17, 16, 16,
- 17, 17, 20, 17,  9, 12, 14, 16,
- 16, 16, 17, 21, 18, 17,  9, 13,
- 15, 16, 16, 10, 13, 16, 10, 14,
- 16, 11, 15, 16, 11, 15, 17, 11,
- 15, 12, 15, 12, 16, 12, 16, 13,
- 16, 13, 13, 13, 14, 14, 13, 14,
- 14, 14, 15, 15, 14, 15, 15, 15,
- 15, 15, 15, 15, 16, 17, 16, 16,
- 16, 16, 17, 16, 17, 16, 18, 17,
- 17, 17, 16, 17, 17, 16, 18, 17,
- 21, 17, 18, 17, 18, 17, 18, 17,
- 17, 17, 17, 19,
-};
-
-static const uint32_t coef5_huffcodes[435] = {
- 0x00347, 0x0000b, 0x00001, 0x00001, 0x0000c, 0x00004, 0x00010, 0x00015,
- 0x0001f, 0x0000b, 0x00023, 0x00026, 0x00029, 0x00035, 0x00037, 0x00001,
- 0x00015, 0x0001a, 0x0001d, 0x0001c, 0x0001e, 0x0004e, 0x00049, 0x00051,
- 0x00078, 0x00004, 0x00000, 0x00008, 0x0000d, 0x0007b, 0x00005, 0x00032,
- 0x00095, 0x00091, 0x00096, 0x000a1, 0x000d9, 0x00003, 0x00019, 0x00061,
- 0x00066, 0x00060, 0x00017, 0x0000e, 0x00063, 0x001a0, 0x001b7, 0x001e6,
- 0x001e7, 0x001b6, 0x00018, 0x001e8, 0x00038, 0x00031, 0x00005, 0x0003d,
- 0x00027, 0x001ea, 0x0001a, 0x000c5, 0x000f9, 0x000ff, 0x000db, 0x00250,
- 0x000fc, 0x0025c, 0x00008, 0x00075, 0x003d7, 0x003d3, 0x001b0, 0x0007c,
- 0x003ca, 0x00036, 0x00189, 0x004a6, 0x004a2, 0x004fb, 0x000c0, 0x0007f,
- 0x0009a, 0x00311, 0x0006e, 0x0009b, 0x0068c, 0x006c0, 0x00484, 0x00012,
- 0x000c3, 0x0094f, 0x00979, 0x009f9, 0x00d09, 0x00da6, 0x00da8, 0x00901,
- 0x000c1, 0x00373, 0x00d08, 0x009fa, 0x00d8b, 0x00d85, 0x00d86, 0x000df,
- 0x006e2, 0x000ce, 0x00f24, 0x009fe, 0x001f7, 0x007c1, 0x000cf, 0x009fc,
- 0x009ff, 0x00d89, 0x00da9, 0x009fd, 0x001f8, 0x01a36, 0x0128c, 0x0129d,
- 0x01a37, 0x00196, 0x003ea, 0x00f8b, 0x00d93, 0x01e45, 0x01e58, 0x01e4b,
- 0x01e59, 0x013f1, 0x00309, 0x00265, 0x00308, 0x0243a, 0x027e1, 0x00f89,
- 0x00324, 0x03cbc, 0x03c86, 0x03695, 0x0243c, 0x0243b, 0x0243e, 0x01e4a,
- 0x003a5, 0x03468, 0x03428, 0x03c84, 0x027e0, 0x025e2, 0x01880, 0x00197,
- 0x00325, 0x03cb7, 0x0791e, 0x007ec, 0x06c75, 0x004c8, 0x04bc7, 0x004c6,
- 0x00983, 0x0481e, 0x01b53, 0x0251b, 0x01b58, 0x00984, 0x04fa8, 0x03cbb,
- 0x00f8a, 0x00322, 0x0346a, 0x0243d, 0x00326, 0x03469, 0x0481f, 0x0481d,
- 0x00746, 0x09032, 0x01b50, 0x01d13, 0x0d8e4, 0x0481b, 0x06c74, 0x0796b,
- 0x07969, 0x00985, 0x0d8e3, 0x00986, 0x00fa2, 0x01301, 0x06c7c, 0x00987,
- 0x03cb8, 0x0f4af, 0x00e88, 0x1b1c0, 0x00fce, 0x033eb, 0x03f6a, 0x03f69,
- 0x00fcf, 0x0791f, 0x004c9, 0x04871, 0x00fcd, 0x00982, 0x00fcc, 0x00fa3,
- 0x01d12, 0x0796c, 0x01b47, 0x00321, 0x0796a, 0x0d8e2, 0x04872, 0x04873,
- 0x0000e, 0x00014, 0x0000a, 0x000a0, 0x00012, 0x0007d, 0x001a2, 0x0003b,
- 0x0025f, 0x000dd, 0x0027c, 0x00343, 0x00368, 0x0036b, 0x0003e, 0x001fa,
- 0x00485, 0x001b3, 0x0007f, 0x001b1, 0x0019e, 0x004ba, 0x007ad, 0x00339,
- 0x00066, 0x007a4, 0x00793, 0x006c6, 0x0007e, 0x000f1, 0x00372, 0x009fb,
- 0x00d83, 0x00d8a, 0x00947, 0x009f4, 0x001d0, 0x01b09, 0x01b4b, 0x007ec,
- 0x003e1, 0x000ca, 0x003ec, 0x02539, 0x04fa9, 0x01b57, 0x03429, 0x03d2a,
- 0x00d97, 0x003a7, 0x00dc0, 0x00d96, 0x00dc1, 0x007eb, 0x03cba, 0x00c43,
- 0x00c41, 0x01b52, 0x007ef, 0x00323, 0x03cb9, 0x03c83, 0x007d0, 0x007ed,
- 0x06c7f, 0x09033, 0x03f6c, 0x36383, 0x1e95d, 0x06c78, 0x00747, 0x01b51,
- 0x00022, 0x00016, 0x00039, 0x00252, 0x00079, 0x00486, 0x00338, 0x00369,
- 0x00d88, 0x00026, 0x00d87, 0x00f4b, 0x00d82, 0x00027, 0x001e1, 0x01a15,
- 0x007c7, 0x012f0, 0x001e0, 0x006d0, 0x01a16, 0x01e44, 0x01e5f, 0x03690,
- 0x00d90, 0x00c42, 0x00daf, 0x00d92, 0x00f80, 0x00cfb, 0x0342f, 0x0487f,
- 0x01b46, 0x07968, 0x00d95, 0x00d91, 0x01b55, 0x03f68, 0x04bc6, 0x03cbd,
- 0x00f81, 0x00320, 0x00069, 0x000fe, 0x006d5, 0x0033f, 0x000de, 0x007c6,
- 0x01e40, 0x00d94, 0x00f88, 0x03c8e, 0x03694, 0x00dae, 0x00dad, 0x00267,
- 0x003a6, 0x00327, 0x0487e, 0x007ee, 0x00749, 0x004c7, 0x03692, 0x01b56,
- 0x00fd1, 0x07a56, 0x06c77, 0x09031, 0x00748, 0x06c7a, 0x0796d, 0x033ea,
- 0x06c76, 0x00fd0, 0x36382, 0x1e417, 0x00745, 0x04faf, 0x0d8e1, 0x03f6b,
- 0x1e95c, 0x04fad, 0x0009e, 0x004bd, 0x0067c, 0x01b08, 0x003eb, 0x01b45,
- 0x03691, 0x0d8e5, 0x07904, 0x00981, 0x007ea, 0x019f4, 0x06c7d, 0x04fab,
- 0x04fac, 0x06c7e, 0x01300, 0x06c7b, 0x0006f, 0x003f7, 0x03c85, 0x004c4,
- 0x0001e, 0x006e1, 0x03693, 0x01b44, 0x00241, 0x01e46, 0x0019d, 0x00266,
- 0x004bb, 0x02538, 0x007ac, 0x01b54, 0x00902, 0x04870, 0x00da7, 0x00900,
- 0x00185, 0x06c79, 0x006e3, 0x003e9, 0x01e94, 0x003ed, 0x003f2, 0x0342e,
- 0x0346b, 0x0251a, 0x004c5, 0x01881, 0x0481c, 0x01b59, 0x03c87, 0x04fae,
- 0x007e9, 0x03f6d, 0x0f20a, 0x09030, 0x04faa, 0x0d8e6, 0x03f6f, 0x0481a,
- 0x03f6e, 0x1e416, 0x0d8e7,
-};
-
-static const uint8_t coef5_huffbits[435] = {
- 10,  4,  2,  4,  4,  5,  5,  5,
-  5,  6,  6,  6,  6,  6,  6,  7,
-  7,  7,  7,  7,  7,  7,  7,  7,
-  7,  8,  8,  8,  8,  7,  8,  8,
-  8,  8,  8,  8,  8,  9,  9,  9,
-  9,  9,  9,  9,  9,  9,  9,  9,
-  9,  9, 10,  9, 10, 10, 10, 10,
- 10,  9, 10, 10, 10, 10, 10, 10,
- 10, 10, 11, 11, 10, 10, 11, 11,
- 10, 11, 11, 11, 11, 11, 12, 12,
- 12, 12, 12, 12, 11, 11, 11, 12,
- 12, 12, 12, 12, 12, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 13,
- 13, 13, 12, 12, 13, 13, 13, 12,
- 12, 12, 12, 12, 13, 13, 13, 13,
- 13, 14, 14, 14, 14, 13, 13, 13,
- 13, 13, 14, 14, 14, 14, 14, 14,
- 15, 14, 14, 14, 14, 14, 14, 13,
- 14, 14, 14, 14, 14, 14, 15, 14,
- 15, 14, 15, 15, 15, 15, 15, 15,
- 16, 15, 15, 14, 15, 16, 15, 14,
- 14, 15, 14, 14, 15, 14, 15, 15,
- 15, 16, 15, 17, 16, 15, 15, 15,
- 15, 16, 16, 16, 16, 17, 15, 16,
- 14, 16, 16, 17, 16, 16, 16, 16,
- 16, 15, 15, 15, 16, 16, 16, 16,
- 17, 15, 15, 15, 15, 16, 15, 15,
-  4,  7,  8,  8,  9,  9,  9, 10,
- 10, 10, 10, 10, 10, 10, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 12,
- 12, 11, 11, 11, 12, 12, 12, 12,
- 12, 12, 12, 12, 13, 13, 13, 13,
- 12, 13, 14, 14, 15, 15, 14, 14,
- 14, 14, 14, 14, 14, 15, 14, 14,
- 14, 15, 15, 15, 14, 14, 15, 15,
- 15, 16, 16, 18, 17, 15, 15, 15,
-  6,  9, 10, 10, 11, 11, 12, 12,
- 12, 13, 12, 12, 12, 13, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 14,
- 14, 14, 14, 14, 14, 14, 14, 15,
- 15, 15, 14, 14, 15, 16, 15, 14,
- 14, 15,  7, 10, 11, 12, 13, 13,
- 13, 14, 14, 14, 14, 14, 14, 14,
- 14, 15, 15, 15, 15, 15, 14, 15,
- 16, 15, 15, 16, 15, 15, 15, 16,
- 15, 16, 18, 17, 15, 15, 16, 16,
- 17, 15,  8, 11, 13, 13, 14, 15,
- 14, 16, 15, 16, 15, 15, 15, 15,
- 15, 15, 17, 15,  9, 12, 14, 15,
- 10, 13, 14, 15, 10, 13, 11, 14,
- 11, 14, 11, 15, 12, 15, 12, 12,
- 13, 15, 13, 14, 13, 14, 14, 14,
- 14, 14, 15, 15, 15, 15, 14, 15,
- 15, 16, 16, 16, 15, 16, 16, 15,
- 16, 17, 16,
-};
-
-static const uint16_t levels0[60] = {
-317, 92, 62, 60, 19, 17, 10,  7,
-  6,  5,  5,  3,  3,  3,  2,  2,
-  2,  2,  2,  2,  2,  1,  2,  2,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,
-};
-
-static const uint16_t levels1[40] = {
-311, 91, 61, 28, 10,  6,  5,  2,
-  2,  2,  2,  2,  2,  2,  2,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-};
-
-static const uint16_t levels2[340] = {
-181,110, 78, 63, 61, 62, 60, 61,
- 33, 41, 41, 19, 17, 19, 12, 11,
-  9, 11, 10,  6,  8,  7,  6,  4,
-  5,  5,  4,  4,  3,  4,  3,  5,
-  3,  4,  3,  3,  3,  3,  3,  3,
-  2,  2,  4,  2,  3,  2,  3,  3,
-  2,  2,  2,  2,  2,  2,  2,  2,
-  3,  2,  2,  2,  2,  2,  2,  2,
-  2,  2,  2,  1,  2,  1,  2,  2,
-  2,  2,  1,  2,  1,  1,  1,  2,
-  2,  1,  2,  1,  2,  2,  2,  2,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,
-};
-
-static const uint16_t levels3[180] = {
-351,122, 76, 61, 41, 42, 24, 30,
- 22, 19, 11,  9, 10,  8,  5,  5,
-  4,  5,  5,  3,  3,  3,  3,  3,
-  3,  3,  2,  2,  3,  2,  2,  2,
-  3,  3,  2,  2,  2,  3,  2,  2,
-  2,  2,  2,  2,  2,  2,  2,  2,
-  2,  2,  2,  2,  2,  2,  1,  1,
-  2,  2,  1,  2,  1,  2,  2,  2,
-  2,  2,  2,  1,  2,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  2,
-  2,  1,  2,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,
-};
-
-static const uint16_t levels4[70] = {
-113, 68, 49, 42, 40, 32, 27, 15,
- 10,  5,  3,  3,  3,  3,  2,  2,
-  2,  2,  2,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,
-};
-
-static const uint16_t levels5[40] = {
-214, 72, 42, 40, 18,  4,  4,  2,
-  2,  2,  2,  2,  1,  1,  2,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-  1,  1,  1,  1,  1,  1,  1,  1,
-};
-
-static const CoefVLCTable coef_vlcs[6] = {
-    {
-        sizeof(coef0_huffbits), sizeof(levels0)/2, coef0_huffcodes, coef0_huffbits, levels0,
-    },
-    {
-        sizeof(coef1_huffbits), sizeof(levels1)/2, coef1_huffcodes, coef1_huffbits, levels1,
-    },
-    {
-        sizeof(coef2_huffbits), sizeof(levels2)/2, coef2_huffcodes, coef2_huffbits, levels2,
-    },
-    {
-        sizeof(coef3_huffbits), sizeof(levels3)/2, coef3_huffcodes, coef3_huffbits, levels3,
-    },
-    {
-        sizeof(coef4_huffbits), sizeof(levels4)/2, coef4_huffcodes, coef4_huffbits, levels4,
-    },
-    {
-        sizeof(coef5_huffbits), sizeof(levels5)/2, coef5_huffcodes, coef5_huffbits, levels5,
-    },
-};
-
-#endif /* AVCODEC_WMADATA_H */
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
deleted file mode 100644
index a24256d..0000000
--- a/libavcodec/wmadec.c
+++ /dev/null
@@ -1,968 +0,0 @@
-/*
- * WMA compatible decoder
- * Copyright (c) 2002 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * WMA compatible decoder.
- * This decoder handles Microsoft Windows Media Audio data, versions 1 & 2.
- * WMA v1 is identified by audio format 0x160 in Microsoft media files
- * (ASF/AVI/WAV). WMA v2 is identified by audio format 0x161.
- *
- * To use this decoder, a calling application must supply the extra data
- * bytes provided with the WMA data. These are the extra, codec-specific
- * bytes at the end of a WAVEFORMATEX data structure. Transmit these bytes
- * to the decoder using the extradata[_size] fields in AVCodecContext. There
- * should be 4 extra bytes for v1 data and 6 extra bytes for v2 data.
- */
-
-#include "avcodec.h"
-#include "wma.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-#define EXPVLCBITS 8
-#define EXPMAX ((19+EXPVLCBITS-1)/EXPVLCBITS)
-
-#define HGAINVLCBITS 9
-#define HGAINMAX ((13+HGAINVLCBITS-1)/HGAINVLCBITS)
-
-static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len);
-
-#ifdef TRACE
-static void dump_shorts(WMACodecContext *s, const char *name, const short *tab, int n)
-{
-    int i;
-
-    tprintf(s->avctx, "%s[%d]:\n", name, n);
-    for(i=0;i<n;i++) {
-        if ((i & 7) == 0)
-            tprintf(s->avctx, "%4d: ", i);
-        tprintf(s->avctx, " %5d.0", tab[i]);
-        if ((i & 7) == 7)
-            tprintf(s->avctx, "\n");
-    }
-}
-
-static void dump_floats(WMACodecContext *s, const char *name, int prec, const float *tab, int n)
-{
-    int i;
-
-    tprintf(s->avctx, "%s[%d]:\n", name, n);
-    for(i=0;i<n;i++) {
-        if ((i & 7) == 0)
-            tprintf(s->avctx, "%4d: ", i);
-        tprintf(s->avctx, " %8.*f", prec, tab[i]);
-        if ((i & 7) == 7)
-            tprintf(s->avctx, "\n");
-    }
-    if ((i & 7) != 0)
-        tprintf(s->avctx, "\n");
-}
-#endif
-
-static int wma_decode_init(AVCodecContext * avctx)
-{
-    WMACodecContext *s = avctx->priv_data;
-    int i, flags2;
-    uint8_t *extradata;
-
-    s->avctx = avctx;
-
-    /* extract flag infos */
-    flags2 = 0;
-    extradata = avctx->extradata;
-    if (avctx->codec->id == CODEC_ID_WMAV1 && avctx->extradata_size >= 4) {
-        flags2 = AV_RL16(extradata+2);
-    } else if (avctx->codec->id == CODEC_ID_WMAV2 && avctx->extradata_size >= 6) {
-        flags2 = AV_RL16(extradata+4);
-    }
-// for(i=0; i<avctx->extradata_size; i++)
-//     av_log(NULL, AV_LOG_ERROR, "%02X ", extradata[i]);
-
-    s->use_exp_vlc = flags2 & 0x0001;
-    s->use_bit_reservoir = flags2 & 0x0002;
-    s->use_variable_block_len = flags2 & 0x0004;
-
-    if(ff_wma_init(avctx, flags2)<0)
-        return -1;
-
-    /* init MDCT */
-    for(i = 0; i < s->nb_block_sizes; i++)
-        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 1, 1.0);
-
-    if (s->use_noise_coding) {
-        init_vlc(&s->hgain_vlc, HGAINVLCBITS, sizeof(ff_wma_hgain_huffbits),
-                 ff_wma_hgain_huffbits, 1, 1,
-                 ff_wma_hgain_huffcodes, 2, 2, 0);
-    }
-
-    if (s->use_exp_vlc) {
-        init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(ff_aac_scalefactor_bits), //FIXME move out of context
-                 ff_aac_scalefactor_bits, 1, 1,
-                 ff_aac_scalefactor_code, 4, 4, 0);
-    } else {
-        wma_lsp_to_curve_init(s, s->frame_len);
-    }
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-/**
- * compute x^-0.25 with an exponent and mantissa table. We use linear
- * interpolation to reduce the mantissa table size at a small speed
- * expense (linear interpolation approximately doubles the number of
- * bits of precision).
- */
-static inline float pow_m1_4(WMACodecContext *s, float x)
-{
-    union {
-        float f;
-        unsigned int v;
-    } u, t;
-    unsigned int e, m;
-    float a, b;
-
-    u.f = x;
-    e = u.v >> 23;
-    m = (u.v >> (23 - LSP_POW_BITS)) & ((1 << LSP_POW_BITS) - 1);
-    /* build interpolation scale: 1 <= t < 2. */
-    t.v = ((u.v << LSP_POW_BITS) & ((1 << 23) - 1)) | (127 << 23);
-    a = s->lsp_pow_m_table1[m];
-    b = s->lsp_pow_m_table2[m];
-    return s->lsp_pow_e_table[e] * (a + b * t.f);
-}
-
-static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len)
-{
-    float wdel, a, b;
-    int i, e, m;
-
-    wdel = M_PI / frame_len;
-    for(i=0;i<frame_len;i++)
-        s->lsp_cos_table[i] = 2.0f * cos(wdel * i);
-
-    /* tables for x^-0.25 computation */
-    for(i=0;i<256;i++) {
-        e = i - 126;
-        s->lsp_pow_e_table[i] = pow(2.0, e * -0.25);
-    }
-
-    /* NOTE: these two tables are needed to avoid two operations in
-       pow_m1_4 */
-    b = 1.0;
-    for(i=(1 << LSP_POW_BITS) - 1;i>=0;i--) {
-        m = (1 << LSP_POW_BITS) + i;
-        a = (float)m * (0.5 / (1 << LSP_POW_BITS));
-        a = pow(a, -0.25);
-        s->lsp_pow_m_table1[i] = 2 * a - b;
-        s->lsp_pow_m_table2[i] = b - a;
-        b = a;
-    }
-#if 0
-    for(i=1;i<20;i++) {
-        float v, r1, r2;
-        v = 5.0 / i;
-        r1 = pow_m1_4(s, v);
-        r2 = pow(v,-0.25);
-        printf("%f^-0.25=%f e=%f\n", v, r1, r2 - r1);
-    }
-#endif
-}
-
-/**
- * NOTE: We use the same code as Vorbis here
- * @todo optimize it further with SSE/3Dnow
- */
-static void wma_lsp_to_curve(WMACodecContext *s,
-                             float *out, float *val_max_ptr,
-                             int n, float *lsp)
-{
-    int i, j;
-    float p, q, w, v, val_max;
-
-    val_max = 0;
-    for(i=0;i<n;i++) {
-        p = 0.5f;
-        q = 0.5f;
-        w = s->lsp_cos_table[i];
-        for(j=1;j<NB_LSP_COEFS;j+=2){
-            q *= w - lsp[j - 1];
-            p *= w - lsp[j];
-        }
-        p *= p * (2.0f - w);
-        q *= q * (2.0f + w);
-        v = p + q;
-        v = pow_m1_4(s, v);
-        if (v > val_max)
-            val_max = v;
-        out[i] = v;
-    }
-    *val_max_ptr = val_max;
-}
-
-/**
- * decode exponents coded with LSP coefficients (same idea as Vorbis)
- */
-static void decode_exp_lsp(WMACodecContext *s, int ch)
-{
-    float lsp_coefs[NB_LSP_COEFS];
-    int val, i;
-
-    for(i = 0; i < NB_LSP_COEFS; i++) {
-        if (i == 0 || i >= 8)
-            val = get_bits(&s->gb, 3);
-        else
-            val = get_bits(&s->gb, 4);
-        lsp_coefs[i] = ff_wma_lsp_codebook[i][val];
-    }
-
-    wma_lsp_to_curve(s, s->exponents[ch], &s->max_exponent[ch],
-                     s->block_len, lsp_coefs);
-}
-
-/** pow(10, i / 16.0) for i in -60..95 */
-static const float pow_tab[] = {
-    1.7782794100389e-04, 2.0535250264571e-04,
-    2.3713737056617e-04, 2.7384196342644e-04,
-    3.1622776601684e-04, 3.6517412725484e-04,
-    4.2169650342858e-04, 4.8696752516586e-04,
-    5.6234132519035e-04, 6.4938163157621e-04,
-    7.4989420933246e-04, 8.6596432336006e-04,
-    1.0000000000000e-03, 1.1547819846895e-03,
-    1.3335214321633e-03, 1.5399265260595e-03,
-    1.7782794100389e-03, 2.0535250264571e-03,
-    2.3713737056617e-03, 2.7384196342644e-03,
-    3.1622776601684e-03, 3.6517412725484e-03,
-    4.2169650342858e-03, 4.8696752516586e-03,
-    5.6234132519035e-03, 6.4938163157621e-03,
-    7.4989420933246e-03, 8.6596432336006e-03,
-    1.0000000000000e-02, 1.1547819846895e-02,
-    1.3335214321633e-02, 1.5399265260595e-02,
-    1.7782794100389e-02, 2.0535250264571e-02,
-    2.3713737056617e-02, 2.7384196342644e-02,
-    3.1622776601684e-02, 3.6517412725484e-02,
-    4.2169650342858e-02, 4.8696752516586e-02,
-    5.6234132519035e-02, 6.4938163157621e-02,
-    7.4989420933246e-02, 8.6596432336007e-02,
-    1.0000000000000e-01, 1.1547819846895e-01,
-    1.3335214321633e-01, 1.5399265260595e-01,
-    1.7782794100389e-01, 2.0535250264571e-01,
-    2.3713737056617e-01, 2.7384196342644e-01,
-    3.1622776601684e-01, 3.6517412725484e-01,
-    4.2169650342858e-01, 4.8696752516586e-01,
-    5.6234132519035e-01, 6.4938163157621e-01,
-    7.4989420933246e-01, 8.6596432336007e-01,
-    1.0000000000000e+00, 1.1547819846895e+00,
-    1.3335214321633e+00, 1.5399265260595e+00,
-    1.7782794100389e+00, 2.0535250264571e+00,
-    2.3713737056617e+00, 2.7384196342644e+00,
-    3.1622776601684e+00, 3.6517412725484e+00,
-    4.2169650342858e+00, 4.8696752516586e+00,
-    5.6234132519035e+00, 6.4938163157621e+00,
-    7.4989420933246e+00, 8.6596432336007e+00,
-    1.0000000000000e+01, 1.1547819846895e+01,
-    1.3335214321633e+01, 1.5399265260595e+01,
-    1.7782794100389e+01, 2.0535250264571e+01,
-    2.3713737056617e+01, 2.7384196342644e+01,
-    3.1622776601684e+01, 3.6517412725484e+01,
-    4.2169650342858e+01, 4.8696752516586e+01,
-    5.6234132519035e+01, 6.4938163157621e+01,
-    7.4989420933246e+01, 8.6596432336007e+01,
-    1.0000000000000e+02, 1.1547819846895e+02,
-    1.3335214321633e+02, 1.5399265260595e+02,
-    1.7782794100389e+02, 2.0535250264571e+02,
-    2.3713737056617e+02, 2.7384196342644e+02,
-    3.1622776601684e+02, 3.6517412725484e+02,
-    4.2169650342858e+02, 4.8696752516586e+02,
-    5.6234132519035e+02, 6.4938163157621e+02,
-    7.4989420933246e+02, 8.6596432336007e+02,
-    1.0000000000000e+03, 1.1547819846895e+03,
-    1.3335214321633e+03, 1.5399265260595e+03,
-    1.7782794100389e+03, 2.0535250264571e+03,
-    2.3713737056617e+03, 2.7384196342644e+03,
-    3.1622776601684e+03, 3.6517412725484e+03,
-    4.2169650342858e+03, 4.8696752516586e+03,
-    5.6234132519035e+03, 6.4938163157621e+03,
-    7.4989420933246e+03, 8.6596432336007e+03,
-    1.0000000000000e+04, 1.1547819846895e+04,
-    1.3335214321633e+04, 1.5399265260595e+04,
-    1.7782794100389e+04, 2.0535250264571e+04,
-    2.3713737056617e+04, 2.7384196342644e+04,
-    3.1622776601684e+04, 3.6517412725484e+04,
-    4.2169650342858e+04, 4.8696752516586e+04,
-    5.6234132519035e+04, 6.4938163157621e+04,
-    7.4989420933246e+04, 8.6596432336007e+04,
-    1.0000000000000e+05, 1.1547819846895e+05,
-    1.3335214321633e+05, 1.5399265260595e+05,
-    1.7782794100389e+05, 2.0535250264571e+05,
-    2.3713737056617e+05, 2.7384196342644e+05,
-    3.1622776601684e+05, 3.6517412725484e+05,
-    4.2169650342858e+05, 4.8696752516586e+05,
-    5.6234132519035e+05, 6.4938163157621e+05,
-    7.4989420933246e+05, 8.6596432336007e+05,
-};
-
-/**
- * decode exponents coded with VLC codes
- */
-static int decode_exp_vlc(WMACodecContext *s, int ch)
-{
-    int last_exp, n, code;
-    const uint16_t *ptr;
-    float v, max_scale;
-    uint32_t *q, *q_end, iv;
-    const float *ptab = pow_tab + 60;
-    const uint32_t *iptab = (const uint32_t*)ptab;
-
-    ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits];
-    q = (uint32_t *)s->exponents[ch];
-    q_end = q + s->block_len;
-    max_scale = 0;
-    if (s->version == 1) {
-        last_exp = get_bits(&s->gb, 5) + 10;
-        v = ptab[last_exp];
-        iv = iptab[last_exp];
-        max_scale = v;
-        n = *ptr++;
-        switch (n & 3) do {
-        case 0: *q++ = iv;
-        case 3: *q++ = iv;
-        case 2: *q++ = iv;
-        case 1: *q++ = iv;
-        } while ((n -= 4) > 0);
-    }else
-        last_exp = 36;
-
-    while (q < q_end) {
-        code = get_vlc2(&s->gb, s->exp_vlc.table, EXPVLCBITS, EXPMAX);
-        if (code < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "Exponent vlc invalid\n");
-            return -1;
-        }
-        /* NOTE: this offset is the same as MPEG4 AAC ! */
-        last_exp += code - 60;
-        if ((unsigned)last_exp + 60 > FF_ARRAY_ELEMS(pow_tab)) {
-            av_log(s->avctx, AV_LOG_ERROR, "Exponent out of range: %d\n",
-                   last_exp);
-            return -1;
-        }
-        v = ptab[last_exp];
-        iv = iptab[last_exp];
-        if (v > max_scale)
-            max_scale = v;
-        n = *ptr++;
-        switch (n & 3) do {
-        case 0: *q++ = iv;
-        case 3: *q++ = iv;
-        case 2: *q++ = iv;
-        case 1: *q++ = iv;
-        } while ((n -= 4) > 0);
-    }
-    s->max_exponent[ch] = max_scale;
-    return 0;
-}
-
-
-/**
- * Apply MDCT window and add into output.
- *
- * We ensure that when the windows overlap their squared sum
- * is always 1 (MDCT reconstruction rule).
- */
-static void wma_window(WMACodecContext *s, float *out)
-{
-    float *in = s->output;
-    int block_len, bsize, n;
-
-    /* left part */
-    if (s->block_len_bits <= s->prev_block_len_bits) {
-        block_len = s->block_len;
-        bsize = s->frame_len_bits - s->block_len_bits;
-
-        s->dsp.vector_fmul_add(out, in, s->windows[bsize],
-                               out, block_len);
-
-    } else {
-        block_len = 1 << s->prev_block_len_bits;
-        n = (s->block_len - block_len) / 2;
-        bsize = s->frame_len_bits - s->prev_block_len_bits;
-
-        s->dsp.vector_fmul_add(out+n, in+n, s->windows[bsize],
-                               out+n, block_len);
-
-        memcpy(out+n+block_len, in+n+block_len, n*sizeof(float));
-    }
-
-    out += s->block_len;
-    in += s->block_len;
-
-    /* right part */
-    if (s->block_len_bits <= s->next_block_len_bits) {
-        block_len = s->block_len;
-        bsize = s->frame_len_bits - s->block_len_bits;
-
-        s->dsp.vector_fmul_reverse(out, in, s->windows[bsize], block_len);
-
-    } else {
-        block_len = 1 << s->next_block_len_bits;
-        n = (s->block_len - block_len) / 2;
-        bsize = s->frame_len_bits - s->next_block_len_bits;
-
-        memcpy(out, in, n*sizeof(float));
-
-        s->dsp.vector_fmul_reverse(out+n, in+n, s->windows[bsize], block_len);
-
-        memset(out+n+block_len, 0, n*sizeof(float));
-    }
-}
-
-
-/**
- * @return 0 if OK. 1 if last block of frame. return -1 if
- * unrecorrable error.
- */
-static int wma_decode_block(WMACodecContext *s)
-{
-    int n, v, a, ch, bsize;
-    int coef_nb_bits, total_gain;
-    int nb_coefs[MAX_CHANNELS];
-    float mdct_norm;
-
-#ifdef TRACE
-    tprintf(s->avctx, "***decode_block: %d:%d\n", s->frame_count - 1, s->block_num);
-#endif
-
-    /* compute current block length */
-    if (s->use_variable_block_len) {
-        n = av_log2(s->nb_block_sizes - 1) + 1;
-
-        if (s->reset_block_lengths) {
-            s->reset_block_lengths = 0;
-            v = get_bits(&s->gb, n);
-            if (v >= s->nb_block_sizes){
-                av_log(s->avctx, AV_LOG_ERROR, "prev_block_len_bits %d out of range\n", s->frame_len_bits - v);
-                return -1;
-            }
-            s->prev_block_len_bits = s->frame_len_bits - v;
-            v = get_bits(&s->gb, n);
-            if (v >= s->nb_block_sizes){
-                av_log(s->avctx, AV_LOG_ERROR, "block_len_bits %d out of range\n", s->frame_len_bits - v);
-                return -1;
-            }
-            s->block_len_bits = s->frame_len_bits - v;
-        } else {
-            /* update block lengths */
-            s->prev_block_len_bits = s->block_len_bits;
-            s->block_len_bits = s->next_block_len_bits;
-        }
-        v = get_bits(&s->gb, n);
-        if (v >= s->nb_block_sizes){
-            av_log(s->avctx, AV_LOG_ERROR, "next_block_len_bits %d out of range\n", s->frame_len_bits - v);
-            return -1;
-        }
-        s->next_block_len_bits = s->frame_len_bits - v;
-    } else {
-        /* fixed block len */
-        s->next_block_len_bits = s->frame_len_bits;
-        s->prev_block_len_bits = s->frame_len_bits;
-        s->block_len_bits = s->frame_len_bits;
-    }
-
-    /* now check if the block length is coherent with the frame length */
-    s->block_len = 1 << s->block_len_bits;
-    if ((s->block_pos + s->block_len) > s->frame_len){
-        av_log(s->avctx, AV_LOG_ERROR, "frame_len overflow\n");
-        return -1;
-    }
-
-    if (s->nb_channels == 2) {
-        s->ms_stereo = get_bits1(&s->gb);
-    }
-    v = 0;
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        a = get_bits1(&s->gb);
-        s->channel_coded[ch] = a;
-        v |= a;
-    }
-
-    bsize = s->frame_len_bits - s->block_len_bits;
-
-    /* if no channel coded, no need to go further */
-    /* XXX: fix potential framing problems */
-    if (!v)
-        goto next;
-
-    /* read total gain and extract corresponding number of bits for
-       coef escape coding */
-    total_gain = 1;
-    for(;;) {
-        a = get_bits(&s->gb, 7);
-        total_gain += a;
-        if (a != 127)
-            break;
-    }
-
-    coef_nb_bits= ff_wma_total_gain_to_bits(total_gain);
-
-    /* compute number of coefficients */
-    n = s->coefs_end[bsize] - s->coefs_start;
-    for(ch = 0; ch < s->nb_channels; ch++)
-        nb_coefs[ch] = n;
-
-    /* complex coding */
-    if (s->use_noise_coding) {
-
-        for(ch = 0; ch < s->nb_channels; ch++) {
-            if (s->channel_coded[ch]) {
-                int i, n, a;
-                n = s->exponent_high_sizes[bsize];
-                for(i=0;i<n;i++) {
-                    a = get_bits1(&s->gb);
-                    s->high_band_coded[ch][i] = a;
-                    /* if noise coding, the coefficients are not transmitted */
-                    if (a)
-                        nb_coefs[ch] -= s->exponent_high_bands[bsize][i];
-                }
-            }
-        }
-        for(ch = 0; ch < s->nb_channels; ch++) {
-            if (s->channel_coded[ch]) {
-                int i, n, val, code;
-
-                n = s->exponent_high_sizes[bsize];
-                val = (int)0x80000000;
-                for(i=0;i<n;i++) {
-                    if (s->high_band_coded[ch][i]) {
-                        if (val == (int)0x80000000) {
-                            val = get_bits(&s->gb, 7) - 19;
-                        } else {
-                            code = get_vlc2(&s->gb, s->hgain_vlc.table, HGAINVLCBITS, HGAINMAX);
-                            if (code < 0){
-                                av_log(s->avctx, AV_LOG_ERROR, "hgain vlc invalid\n");
-                                return -1;
-                            }
-                            val += code - 18;
-                        }
-                        s->high_band_values[ch][i] = val;
-                    }
-                }
-            }
-        }
-    }
-
-    /* exponents can be reused in short blocks. */
-    if ((s->block_len_bits == s->frame_len_bits) ||
-        get_bits1(&s->gb)) {
-        for(ch = 0; ch < s->nb_channels; ch++) {
-            if (s->channel_coded[ch]) {
-                if (s->use_exp_vlc) {
-                    if (decode_exp_vlc(s, ch) < 0)
-                        return -1;
-                } else {
-                    decode_exp_lsp(s, ch);
-                }
-                s->exponents_bsize[ch] = bsize;
-            }
-        }
-    }
-
-    /* parse spectral coefficients : just RLE encoding */
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        if (s->channel_coded[ch]) {
-            int tindex;
-            WMACoef* ptr = &s->coefs1[ch][0];
-
-            /* special VLC tables are used for ms stereo because
-               there is potentially less energy there */
-            tindex = (ch == 1 && s->ms_stereo);
-            memset(ptr, 0, s->block_len * sizeof(WMACoef));
-            ff_wma_run_level_decode(s->avctx, &s->gb, &s->coef_vlc[tindex],
-                  s->level_table[tindex], s->run_table[tindex],
-                  0, ptr, 0, nb_coefs[ch],
-                  s->block_len, s->frame_len_bits, coef_nb_bits);
-        }
-        if (s->version == 1 && s->nb_channels >= 2) {
-            align_get_bits(&s->gb);
-        }
-    }
-
-    /* normalize */
-    {
-        int n4 = s->block_len / 2;
-        mdct_norm = 1.0 / (float)n4;
-        if (s->version == 1) {
-            mdct_norm *= sqrt(n4);
-        }
-    }
-
-    /* finally compute the MDCT coefficients */
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        if (s->channel_coded[ch]) {
-            WMACoef *coefs1;
-            float *coefs, *exponents, mult, mult1, noise;
-            int i, j, n, n1, last_high_band, esize;
-            float exp_power[HIGH_BAND_MAX_SIZE];
-
-            coefs1 = s->coefs1[ch];
-            exponents = s->exponents[ch];
-            esize = s->exponents_bsize[ch];
-            mult = pow(10, total_gain * 0.05) / s->max_exponent[ch];
-            mult *= mdct_norm;
-            coefs = s->coefs[ch];
-            if (s->use_noise_coding) {
-                mult1 = mult;
-                /* very low freqs : noise */
-                for(i = 0;i < s->coefs_start; i++) {
-                    *coefs++ = s->noise_table[s->noise_index] *
-                      exponents[i<<bsize>>esize] * mult1;
-                    s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1);
-                }
-
-                n1 = s->exponent_high_sizes[bsize];
-
-                /* compute power of high bands */
-                exponents = s->exponents[ch] +
-                    (s->high_band_start[bsize]<<bsize>>esize);
-                last_high_band = 0; /* avoid warning */
-                for(j=0;j<n1;j++) {
-                    n = s->exponent_high_bands[s->frame_len_bits -
-                                              s->block_len_bits][j];
-                    if (s->high_band_coded[ch][j]) {
-                        float e2, v;
-                        e2 = 0;
-                        for(i = 0;i < n; i++) {
-                            v = exponents[i<<bsize>>esize];
-                            e2 += v * v;
-                        }
-                        exp_power[j] = e2 / n;
-                        last_high_band = j;
-                        tprintf(s->avctx, "%d: power=%f (%d)\n", j, exp_power[j], n);
-                    }
-                    exponents += n<<bsize>>esize;
-                }
-
-                /* main freqs and high freqs */
-                exponents = s->exponents[ch] + (s->coefs_start<<bsize>>esize);
-                for(j=-1;j<n1;j++) {
-                    if (j < 0) {
-                        n = s->high_band_start[bsize] -
-                            s->coefs_start;
-                    } else {
-                        n = s->exponent_high_bands[s->frame_len_bits -
-                                                  s->block_len_bits][j];
-                    }
-                    if (j >= 0 && s->high_band_coded[ch][j]) {
-                        /* use noise with specified power */
-                        mult1 = sqrt(exp_power[j] / exp_power[last_high_band]);
-                        /* XXX: use a table */
-                        mult1 = mult1 * pow(10, s->high_band_values[ch][j] * 0.05);
-                        mult1 = mult1 / (s->max_exponent[ch] * s->noise_mult);
-                        mult1 *= mdct_norm;
-                        for(i = 0;i < n; i++) {
-                            noise = s->noise_table[s->noise_index];
-                            s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1);
-                            *coefs++ =  noise *
-                                exponents[i<<bsize>>esize] * mult1;
-                        }
-                        exponents += n<<bsize>>esize;
-                    } else {
-                        /* coded values + small noise */
-                        for(i = 0;i < n; i++) {
-                            noise = s->noise_table[s->noise_index];
-                            s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1);
-                            *coefs++ = ((*coefs1++) + noise) *
-                                exponents[i<<bsize>>esize] * mult;
-                        }
-                        exponents += n<<bsize>>esize;
-                    }
-                }
-
-                /* very high freqs : noise */
-                n = s->block_len - s->coefs_end[bsize];
-                mult1 = mult * exponents[((-1<<bsize))>>esize];
-                for(i = 0; i < n; i++) {
-                    *coefs++ = s->noise_table[s->noise_index] * mult1;
-                    s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1);
-                }
-            } else {
-                /* XXX: optimize more */
-                for(i = 0;i < s->coefs_start; i++)
-                    *coefs++ = 0.0;
-                n = nb_coefs[ch];
-                for(i = 0;i < n; i++) {
-                    *coefs++ = coefs1[i] * exponents[i<<bsize>>esize] * mult;
-                }
-                n = s->block_len - s->coefs_end[bsize];
-                for(i = 0;i < n; i++)
-                    *coefs++ = 0.0;
-            }
-        }
-    }
-
-#ifdef TRACE
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        if (s->channel_coded[ch]) {
-            dump_floats(s, "exponents", 3, s->exponents[ch], s->block_len);
-            dump_floats(s, "coefs", 1, s->coefs[ch], s->block_len);
-        }
-    }
-#endif
-
-    if (s->ms_stereo && s->channel_coded[1]) {
-        /* nominal case for ms stereo: we do it before mdct */
-        /* no need to optimize this case because it should almost
-           never happen */
-        if (!s->channel_coded[0]) {
-            tprintf(s->avctx, "rare ms-stereo case happened\n");
-            memset(s->coefs[0], 0, sizeof(float) * s->block_len);
-            s->channel_coded[0] = 1;
-        }
-
-        s->dsp.butterflies_float(s->coefs[0], s->coefs[1], s->block_len);
-    }
-
-next:
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        int n4, index;
-
-        n4 = s->block_len / 2;
-        if(s->channel_coded[ch]){
-            ff_imdct_calc(&s->mdct_ctx[bsize], s->output, s->coefs[ch]);
-        }else if(!(s->ms_stereo && ch==1))
-            memset(s->output, 0, sizeof(s->output));
-
-        /* multiply by the window and add in the frame */
-        index = (s->frame_len / 2) + s->block_pos - n4;
-        wma_window(s, &s->frame_out[ch][index]);
-    }
-
-    /* update block number */
-    s->block_num++;
-    s->block_pos += s->block_len;
-    if (s->block_pos >= s->frame_len)
-        return 1;
-    else
-        return 0;
-}
-
-/* decode a frame of frame_len samples */
-static int wma_decode_frame(WMACodecContext *s, int16_t *samples)
-{
-    int ret, i, n, ch, incr;
-    int16_t *ptr;
-    float *iptr;
-
-#ifdef TRACE
-    tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len);
-#endif
-
-    /* read each block */
-    s->block_num = 0;
-    s->block_pos = 0;
-    for(;;) {
-        ret = wma_decode_block(s);
-        if (ret < 0)
-            return -1;
-        if (ret)
-            break;
-    }
-
-    /* convert frame to integer */
-    n = s->frame_len;
-    incr = s->nb_channels;
-    if (s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
-        for(ch = 0; ch < s->nb_channels; ch++) {
-            ptr = samples + ch;
-            iptr = s->frame_out[ch];
-
-            for(i=0;i<n;i++) {
-                *ptr = av_clip_int16(lrintf(*iptr++));
-                ptr += incr;
-            }
-            /* prepare for next block */
-            memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len],
-                    s->frame_len * sizeof(float));
-        }
-    } else {
-        float *output[MAX_CHANNELS];
-        for (ch = 0; ch < MAX_CHANNELS; ch++)
-            output[ch] = s->frame_out[ch];
-        s->dsp.float_to_int16_interleave(samples, (const float **)output, n, incr);
-        for(ch = 0; ch < incr; ch++) {
-            /* prepare for next block */
-            memmove(&s->frame_out[ch][0], &s->frame_out[ch][n], n * sizeof(float));
-        }
-    }
-
-#ifdef TRACE
-    dump_shorts(s, "samples", samples, n * s->nb_channels);
-#endif
-    return 0;
-}
-
-static int wma_decode_superframe(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    WMACodecContext *s = avctx->priv_data;
-    int nb_frames, bit_offset, i, pos, len;
-    uint8_t *q;
-    int16_t *samples;
-
-    tprintf(avctx, "***decode_superframe:\n");
-
-    if(buf_size==0){
-        s->last_superframe_len = 0;
-        return 0;
-    }
-    if (buf_size < s->block_align)
-        return 0;
-    buf_size = s->block_align;
-
-    samples = data;
-
-    init_get_bits(&s->gb, buf, buf_size*8);
-
-    if (s->use_bit_reservoir) {
-        /* read super frame header */
-        skip_bits(&s->gb, 4); /* super frame index */
-        nb_frames = get_bits(&s->gb, 4) - 1;
-
-        if((nb_frames+1) * s->nb_channels * s->frame_len * sizeof(int16_t) > *data_size){
-            av_log(s->avctx, AV_LOG_ERROR, "Insufficient output space\n");
-            goto fail;
-        }
-
-        bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3);
-
-        if (s->last_superframe_len > 0) {
-            //        printf("skip=%d\n", s->last_bitoffset);
-            /* add bit_offset bits to last frame */
-            if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) >
-                MAX_CODED_SUPERFRAME_SIZE)
-                goto fail;
-            q = s->last_superframe + s->last_superframe_len;
-            len = bit_offset;
-            while (len > 7) {
-                *q++ = (get_bits)(&s->gb, 8);
-                len -= 8;
-            }
-            if (len > 0) {
-                *q++ = (get_bits)(&s->gb, len) << (8 - len);
-            }
-
-            /* XXX: bit_offset bits into last frame */
-            init_get_bits(&s->gb, s->last_superframe, MAX_CODED_SUPERFRAME_SIZE*8);
-            /* skip unused bits */
-            if (s->last_bitoffset > 0)
-                skip_bits(&s->gb, s->last_bitoffset);
-            /* this frame is stored in the last superframe and in the
-               current one */
-            if (wma_decode_frame(s, samples) < 0)
-                goto fail;
-            samples += s->nb_channels * s->frame_len;
-        }
-
-        /* read each frame starting from bit_offset */
-        pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3;
-        init_get_bits(&s->gb, buf + (pos >> 3), (MAX_CODED_SUPERFRAME_SIZE - (pos >> 3))*8);
-        len = pos & 7;
-        if (len > 0)
-            skip_bits(&s->gb, len);
-
-        s->reset_block_lengths = 1;
-        for(i=0;i<nb_frames;i++) {
-            if (wma_decode_frame(s, samples) < 0)
-                goto fail;
-            samples += s->nb_channels * s->frame_len;
-        }
-
-        /* we copy the end of the frame in the last frame buffer */
-        pos = get_bits_count(&s->gb) + ((bit_offset + 4 + 4 + s->byte_offset_bits + 3) & ~7);
-        s->last_bitoffset = pos & 7;
-        pos >>= 3;
-        len = buf_size - pos;
-        if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) {
-            av_log(s->avctx, AV_LOG_ERROR, "len %d invalid\n", len);
-            goto fail;
-        }
-        s->last_superframe_len = len;
-        memcpy(s->last_superframe, buf + pos, len);
-    } else {
-        if(s->nb_channels * s->frame_len * sizeof(int16_t) > *data_size){
-            av_log(s->avctx, AV_LOG_ERROR, "Insufficient output space\n");
-            goto fail;
-        }
-        /* single frame decode */
-        if (wma_decode_frame(s, samples) < 0)
-            goto fail;
-        samples += s->nb_channels * s->frame_len;
-    }
-
-//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d outbytes:%d eaten:%d\n", s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len,        (int8_t *)samples - (int8_t *)data, s->block_align);
-
-    *data_size = (int8_t *)samples - (int8_t *)data;
-    return s->block_align;
- fail:
-    /* when error, we reset the bit reservoir */
-    s->last_superframe_len = 0;
-    return -1;
-}
-
-static av_cold void flush(AVCodecContext *avctx)
-{
-    WMACodecContext *s = avctx->priv_data;
-
-    s->last_bitoffset=
-    s->last_superframe_len= 0;
-}
-
-AVCodec wmav1_decoder =
-{
-    "wmav1",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV1,
-    sizeof(WMACodecContext),
-    wma_decode_init,
-    NULL,
-    ff_wma_end,
-    wma_decode_superframe,
-    .flush=flush,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
-};
-
-AVCodec wmav2_decoder =
-{
-    "wmav2",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV2,
-    sizeof(WMACodecContext),
-    wma_decode_init,
-    NULL,
-    ff_wma_end,
-    wma_decode_superframe,
-    .flush=flush,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
-};
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
deleted file mode 100644
index 7aaeb70..0000000
--- a/libavcodec/wmaenc.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * WMA compatible encoder
- * Copyright (c) 2007 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "wma.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-static int encode_init(AVCodecContext * avctx){
-    WMACodecContext *s = avctx->priv_data;
-    int i, flags1, flags2;
-    uint8_t *extradata;
-
-    s->avctx = avctx;
-
-    if(avctx->channels > MAX_CHANNELS)
-        return -1;
-
-    if(avctx->bit_rate < 24*1000)
-        return -1;
-
-    /* extract flag infos */
-    flags1 = 0;
-    flags2 = 1;
-    if (avctx->codec->id == CODEC_ID_WMAV1) {
-        extradata= av_malloc(4);
-        avctx->extradata_size= 4;
-        AV_WL16(extradata, flags1);
-        AV_WL16(extradata+2, flags2);
-    } else if (avctx->codec->id == CODEC_ID_WMAV2) {
-        extradata= av_mallocz(10);
-        avctx->extradata_size= 10;
-        AV_WL32(extradata, flags1);
-        AV_WL16(extradata+4, flags2);
-    }else
-        assert(0);
-    avctx->extradata= extradata;
-    s->use_exp_vlc = flags2 & 0x0001;
-    s->use_bit_reservoir = flags2 & 0x0002;
-    s->use_variable_block_len = flags2 & 0x0004;
-
-    ff_wma_init(avctx, flags2);
-
-    /* init MDCT */
-    for(i = 0; i < s->nb_block_sizes; i++)
-        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
-
-    avctx->block_align=
-    s->block_align= avctx->bit_rate*(int64_t)s->frame_len / (avctx->sample_rate*8);
-//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", s->block_align, avctx->bit_rate, s->frame_len, avctx->sample_rate);
-    avctx->frame_size= s->frame_len;
-
-    return 0;
-}
-
-
-static void apply_window_and_mdct(AVCodecContext * avctx, signed short * audio, int len) {
-    WMACodecContext *s = avctx->priv_data;
-    int window_index= s->frame_len_bits - s->block_len_bits;
-    int i, j, channel;
-    const float * win = s->windows[window_index];
-    int window_len = 1 << s->block_len_bits;
-    float n = window_len/2;
-
-    for (channel = 0; channel < avctx->channels; channel++) {
-        memcpy(s->output, s->frame_out[channel], sizeof(float)*window_len);
-        j = channel;
-        for (i = 0; i < len; i++, j += avctx->channels){
-            s->output[i+window_len]  = audio[j] / n * win[window_len - i - 1];
-            s->frame_out[channel][i] = audio[j] / n * win[i];
-        }
-        ff_mdct_calc(&s->mdct_ctx[window_index], s->coefs[channel], s->output);
-    }
-}
-
-//FIXME use for decoding too
-static void init_exp(WMACodecContext *s, int ch, const int *exp_param){
-    int n;
-    const uint16_t *ptr;
-    float v, *q, max_scale, *q_end;
-
-    ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits];
-    q = s->exponents[ch];
-    q_end = q + s->block_len;
-    max_scale = 0;
-    while (q < q_end) {
-        /* XXX: use a table */
-        v = pow(10, *exp_param++ * (1.0 / 16.0));
-        max_scale= FFMAX(max_scale, v);
-        n = *ptr++;
-        do {
-            *q++ = v;
-        } while (--n);
-    }
-    s->max_exponent[ch] = max_scale;
-}
-
-static void encode_exp_vlc(WMACodecContext *s, int ch, const int *exp_param){
-    int last_exp;
-    const uint16_t *ptr;
-    float *q, *q_end;
-
-    ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits];
-    q = s->exponents[ch];
-    q_end = q + s->block_len;
-    if (s->version == 1) {
-        last_exp= *exp_param++;
-        assert(last_exp-10 >= 0 && last_exp-10 < 32);
-        put_bits(&s->pb, 5, last_exp - 10);
-        q+= *ptr++;
-    }else
-        last_exp = 36;
-    while (q < q_end) {
-        int exp = *exp_param++;
-        int code = exp - last_exp + 60;
-        assert(code >= 0 && code < 120);
-        put_bits(&s->pb, ff_aac_scalefactor_bits[code], ff_aac_scalefactor_code[code]);
-        /* XXX: use a table */
-        q+= *ptr++;
-        last_exp= exp;
-    }
-}
-
-static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE], int total_gain){
-    int v, bsize, ch, coef_nb_bits, parse_exponents;
-    float mdct_norm;
-    int nb_coefs[MAX_CHANNELS];
-    static const int fixed_exp[25]={20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20};
-
-    //FIXME remove duplication relative to decoder
-    if (s->use_variable_block_len) {
-        assert(0); //FIXME not implemented
-    }else{
-        /* fixed block len */
-        s->next_block_len_bits = s->frame_len_bits;
-        s->prev_block_len_bits = s->frame_len_bits;
-        s->block_len_bits = s->frame_len_bits;
-    }
-
-    s->block_len = 1 << s->block_len_bits;
-//     assert((s->block_pos + s->block_len) <= s->frame_len);
-    bsize = s->frame_len_bits - s->block_len_bits;
-
-    //FIXME factor
-    v = s->coefs_end[bsize] - s->coefs_start;
-    for(ch = 0; ch < s->nb_channels; ch++)
-        nb_coefs[ch] = v;
-    {
-        int n4 = s->block_len / 2;
-        mdct_norm = 1.0 / (float)n4;
-        if (s->version == 1) {
-            mdct_norm *= sqrt(n4);
-        }
-    }
-
-    if (s->nb_channels == 2) {
-        put_bits(&s->pb, 1, s->ms_stereo= 1);
-    }
-
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        s->channel_coded[ch] = 1; //FIXME only set channel_coded when needed, instead of always
-        if (s->channel_coded[ch]) {
-            init_exp(s, ch, fixed_exp);
-        }
-    }
-
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        if (s->channel_coded[ch]) {
-            WMACoef *coefs1;
-            float *coefs, *exponents, mult;
-            int i, n;
-
-            coefs1 = s->coefs1[ch];
-            exponents = s->exponents[ch];
-            mult = pow(10, total_gain * 0.05) / s->max_exponent[ch];
-            mult *= mdct_norm;
-            coefs = src_coefs[ch];
-            if (s->use_noise_coding && 0) {
-                assert(0); //FIXME not implemented
-            } else {
-                coefs += s->coefs_start;
-                n = nb_coefs[ch];
-                for(i = 0;i < n; i++){
-                    double t= *coefs++ / (exponents[i] * mult);
-                    if(t<-32768 || t>32767)
-                        return -1;
-
-                    coefs1[i] = lrint(t);
-                }
-            }
-        }
-    }
-
-    v = 0;
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        int a = s->channel_coded[ch];
-        put_bits(&s->pb, 1, a);
-        v |= a;
-    }
-
-    if (!v)
-        return 1;
-
-    for(v= total_gain-1; v>=127; v-= 127)
-        put_bits(&s->pb, 7, 127);
-    put_bits(&s->pb, 7, v);
-
-    coef_nb_bits= ff_wma_total_gain_to_bits(total_gain);
-
-    if (s->use_noise_coding) {
-        for(ch = 0; ch < s->nb_channels; ch++) {
-            if (s->channel_coded[ch]) {
-                int i, n;
-                n = s->exponent_high_sizes[bsize];
-                for(i=0;i<n;i++) {
-                    put_bits(&s->pb, 1, s->high_band_coded[ch][i]= 0);
-                    if (0)
-                        nb_coefs[ch] -= s->exponent_high_bands[bsize][i];
-                }
-            }
-        }
-    }
-
-    parse_exponents = 1;
-    if (s->block_len_bits != s->frame_len_bits) {
-        put_bits(&s->pb, 1, parse_exponents);
-    }
-
-    if (parse_exponents) {
-        for(ch = 0; ch < s->nb_channels; ch++) {
-            if (s->channel_coded[ch]) {
-                if (s->use_exp_vlc) {
-                    encode_exp_vlc(s, ch, fixed_exp);
-                } else {
-                    assert(0); //FIXME not implemented
-//                    encode_exp_lsp(s, ch);
-                }
-            }
-        }
-    } else {
-        assert(0); //FIXME not implemented
-    }
-
-    for(ch = 0; ch < s->nb_channels; ch++) {
-        if (s->channel_coded[ch]) {
-            int run, tindex;
-            WMACoef *ptr, *eptr;
-            tindex = (ch == 1 && s->ms_stereo);
-            ptr = &s->coefs1[ch][0];
-            eptr = ptr + nb_coefs[ch];
-
-            run=0;
-            for(;ptr < eptr; ptr++){
-                if(*ptr){
-                    int level= *ptr;
-                    int abs_level= FFABS(level);
-                    int code= 0;
-                    if(abs_level <= s->coef_vlcs[tindex]->max_level){
-                        if(run < s->coef_vlcs[tindex]->levels[abs_level-1])
-                            code= run + s->int_table[tindex][abs_level-1];
-                    }
-
-                    assert(code < s->coef_vlcs[tindex]->n);
-                    put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[code], s->coef_vlcs[tindex]->huffcodes[code]);
-
-                    if(code == 0){
-                        if(1<<coef_nb_bits <= abs_level)
-                            return -1;
-
-
-                        //Workaround minor rounding differences for the regression tests, FIXME we should find and replace the problematic float by fixpoint for reg tests
-                        if(abs_level == 0x71B && (s->avctx->flags & CODEC_FLAG_BITEXACT)) abs_level=0x71A;
-
-                        put_bits(&s->pb, coef_nb_bits, abs_level);
-                        put_bits(&s->pb, s->frame_len_bits, run);
-                    }
-                    put_bits(&s->pb, 1, level < 0); //FIXME the sign is fliped somewhere
-                    run=0;
-                }else{
-                    run++;
-                }
-            }
-            if(run)
-                put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[1], s->coef_vlcs[tindex]->huffcodes[1]);
-        }
-        if (s->version == 1 && s->nb_channels >= 2) {
-            align_put_bits(&s->pb);
-        }
-    }
-    return 0;
-}
-
-static int encode_frame(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE], uint8_t *buf, int buf_size, int total_gain){
-    init_put_bits(&s->pb, buf, buf_size);
-
-    if (s->use_bit_reservoir) {
-        assert(0);//FIXME not implemented
-    }else{
-        if(encode_block(s, src_coefs, total_gain) < 0)
-            return INT_MAX;
-    }
-
-    align_put_bits(&s->pb);
-
-    return put_bits_count(&s->pb)/8 - s->block_align;
-}
-
-static int encode_superframe(AVCodecContext *avctx,
-                            unsigned char *buf, int buf_size, void *data){
-    WMACodecContext *s = avctx->priv_data;
-    short *samples = data;
-    int i, total_gain;
-
-    s->block_len_bits= s->frame_len_bits; //required by non variable block len
-    s->block_len = 1 << s->block_len_bits;
-
-    apply_window_and_mdct(avctx, samples, avctx->frame_size);
-
-    if (s->ms_stereo) {
-        float a, b;
-        int i;
-
-        for(i = 0; i < s->block_len; i++) {
-            a = s->coefs[0][i]*0.5;
-            b = s->coefs[1][i]*0.5;
-            s->coefs[0][i] = a + b;
-            s->coefs[1][i] = a - b;
-        }
-    }
-
-#if 1
-    total_gain= 128;
-    for(i=64; i; i>>=1){
-        int error= encode_frame(s, s->coefs, buf, buf_size, total_gain-i);
-        if(error<0)
-            total_gain-= i;
-    }
-#else
-    total_gain= 90;
-    best= encode_frame(s, s->coefs, buf, buf_size, total_gain);
-    for(i=32; i; i>>=1){
-        int scoreL= encode_frame(s, s->coefs, buf, buf_size, total_gain-i);
-        int scoreR= encode_frame(s, s->coefs, buf, buf_size, total_gain+i);
-        av_log(NULL, AV_LOG_ERROR, "%d %d %d (%d)\n", scoreL, best, scoreR, total_gain);
-        if(scoreL < FFMIN(best, scoreR)){
-            best = scoreL;
-            total_gain -= i;
-        }else if(scoreR < best){
-            best = scoreR;
-            total_gain += i;
-        }
-    }
-#endif
-
-    encode_frame(s, s->coefs, buf, buf_size, total_gain);
-    assert((put_bits_count(&s->pb) & 7) == 0);
-    i= s->block_align - (put_bits_count(&s->pb)+7)/8;
-    assert(i>=0);
-    while(i--)
-        put_bits(&s->pb, 8, 'N');
-
-    flush_put_bits(&s->pb);
-    return put_bits_ptr(&s->pb) - s->pb.buf;
-}
-
-AVCodec wmav1_encoder =
-{
-    "wmav1",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV1,
-    sizeof(WMACodecContext),
-    encode_init,
-    encode_superframe,
-    ff_wma_end,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
-};
-
-AVCodec wmav2_encoder =
-{
-    "wmav2",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV2,
-    sizeof(WMACodecContext),
-    encode_init,
-    encode_superframe,
-    ff_wma_end,
-    .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
-};
diff --git a/libavcodec/wmaprodata.h b/libavcodec/wmaprodata.h
deleted file mode 100644
index 5382479..0000000
--- a/libavcodec/wmaprodata.h
+++ /dev/null
@@ -1,604 +0,0 @@
-/*
- * WMA 9/3/PRO compatible decoder
- * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
- * Copyright (c) 2008 - 2009 Sascha Sommer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief tables for wmapro decoding
- */
-
-#ifndef AVCODEC_WMAPRODATA_H
-#define AVCODEC_WMAPRODATA_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-/**
- * @brief frequencies to divide the frequency spectrum into scale factor bands
- */
-static const uint16_t critical_freq[] = {
-     100,   200,    300,    400,    510,    630,    770,
-     920,  1080,   1270,   1480,   1720,   2000,   2320,
-    2700,  3150,   3700,   4400,   5300,   6400,   7700,
-    9500, 12000,  15500,  20675,  28575,  41375,  63875,
-};
-
-
-/**
- * @name Huffman tables for DPCM-coded scale factors
- * @{
- */
-#define HUFF_SCALE_SIZE    121
-#define HUFF_SCALE_MAXBITS  19
-static const uint16_t scale_huffcodes[HUFF_SCALE_SIZE] = {
-    0xE639, 0xE6C2, 0xE6C1, 0xE6C0, 0xE63F, 0xE63E, 0xE63D, 0xE63C,
-    0xE63B, 0xE63A, 0xE638, 0xE637, 0xE636, 0xE635, 0xE634, 0xE632,
-    0xE633, 0xE620, 0x737B, 0xE610, 0xE611, 0xE612, 0xE613, 0xE614,
-    0xE615, 0xE616, 0xE617, 0xE618, 0xE619, 0xE61A, 0xE61B, 0xE61C,
-    0xE61D, 0xE61E, 0xE61F, 0xE6C3, 0xE621, 0xE622, 0xE623, 0xE624,
-    0xE625, 0xE626, 0xE627, 0xE628, 0xE629, 0xE62A, 0xE62B, 0xE62C,
-    0xE62D, 0xE62E, 0xE62F, 0xE630, 0xE631, 0x1CDF, 0x0E60, 0x0399,
-    0x00E7, 0x001D, 0x0000, 0x0001, 0x0001, 0x0001, 0x0002, 0x0006,
-    0x0002, 0x0007, 0x0006, 0x000F, 0x0038, 0x0072, 0x039A, 0xE6C4,
-    0xE6C5, 0xE6C6, 0xE6C7, 0xE6C8, 0xE6C9, 0xE6CA, 0xE6CB, 0xE6CC,
-    0xE6CD, 0xE6CE, 0xE6CF, 0xE6D0, 0xE6D1, 0xE6D2, 0xE6D3, 0xE6D4,
-    0xE6D5, 0xE6D6, 0xE6D7, 0xE6D8, 0xE6D9, 0xE6DA, 0xE6DB, 0xE6DC,
-    0xE6DD, 0xE6DE, 0xE6DF, 0xE6E0, 0xE6E1, 0xE6E2, 0xE6E3, 0xE6E4,
-    0xE6E5, 0xE6E6, 0xE6E7, 0xE6E8, 0xE6E9, 0xE6EA, 0xE6EB, 0xE6EC,
-    0xE6ED, 0xE6EE, 0xE6EF, 0xE6F0, 0xE6F1, 0xE6F2, 0xE6F3, 0xE6F4,
-    0xE6F5,
-};
-
-static const uint8_t scale_huffbits[HUFF_SCALE_SIZE] = {
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 18, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 16, 15, 13,
-    11,  8,  5,  2,  1,  3,  5,  6,
-     6,  7,  7,  7,  9, 10, 13, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19, 19, 19, 19, 19, 19, 19, 19,
-    19,
-};
-/** @} */
-
-
-/**
- * @name Huffman, run and level tables for runlevel-coded scale factors
- * @{
- */
-#define HUFF_SCALE_RL_SIZE    120
-#define HUFF_SCALE_RL_MAXBITS  21
-static const uint32_t scale_rl_huffcodes[HUFF_SCALE_RL_SIZE] = {
-    0x00010C, 0x000001, 0x10FE2A, 0x000003, 0x000003, 0x000001, 0x000013,
-    0x000020, 0x000029, 0x000014, 0x000016, 0x000045, 0x000049, 0x00002F,
-    0x000042, 0x00008E, 0x00008F, 0x000129, 0x000009, 0x00000D, 0x0004AC,
-    0x00002C, 0x000561, 0x0002E6, 0x00087C, 0x0002E2, 0x00095C, 0x000018,
-    0x000001, 0x000016, 0x000044, 0x00002A, 0x000007, 0x000159, 0x000143,
-    0x000128, 0x00015A, 0x00012D, 0x00002B, 0x0000A0, 0x000142, 0x00012A,
-    0x0002EF, 0x0004AF, 0x00087D, 0x004AE9, 0x0043F9, 0x000067, 0x000199,
-    0x002B05, 0x001583, 0x0021FE, 0x10FE2C, 0x000004, 0x00002E, 0x00010D,
-    0x00000A, 0x000244, 0x000017, 0x000245, 0x000011, 0x00010E, 0x00012C,
-    0x00002A, 0x00002F, 0x000121, 0x000046, 0x00087E, 0x0000BA, 0x000032,
-    0x0087F0, 0x0056DC, 0x0002EC, 0x0043FA, 0x002B6F, 0x004AE8, 0x0002B7,
-    0x10FE2B, 0x000001, 0x000051, 0x000010, 0x0002EE, 0x000B9C, 0x002576,
-    0x000198, 0x0056DD, 0x0000CD, 0x000AC0, 0x000170, 0x004AEF, 0x00002D,
-    0x0004AD, 0x0021FF, 0x0005CF, 0x002B04, 0x10FE29, 0x10FE28, 0x0002ED,
-    0x002E74, 0x021FC4, 0x004AEE, 0x010FE3, 0x087F17, 0x000000, 0x000097,
-    0x0002E3, 0x000ADA, 0x002575, 0x00173B, 0x0043FB, 0x002E75, 0x10FE2D,
-    0x0015B6, 0x00056C, 0x000057, 0x000123, 0x000120, 0x00021E, 0x000172,
-    0x0002B1,
-};
-
-static const uint8_t scale_rl_huffbits[HUFF_SCALE_RL_SIZE] = {
-     9,  2, 21,  2,  4,  5,  5,
-     6,  6,  7,  7,  7,  7,  6,
-     7,  8,  8,  9, 10, 10, 11,
-    12, 11, 12, 12, 12, 12, 11,
-     4,  5,  7,  8,  9,  9,  9,
-     9,  9,  9,  8,  8,  9,  9,
-    12, 11, 12, 15, 15, 13, 15,
-    14, 13, 14, 21,  5,  6,  9,
-    10, 10, 11, 10, 11,  9,  9,
-     6,  8,  9,  7, 12, 10, 12,
-    16, 15, 12, 15, 14, 15, 10,
-    21,  6,  7, 11, 12, 14, 14,
-    15, 15, 14, 12, 11, 15, 12,
-    11, 14, 13, 14, 21, 21, 12,
-    16, 18, 15, 17, 20,  7,  8,
-    12, 12, 14, 15, 15, 16, 21,
-    13, 11,  7,  9,  9, 10, 11,
-    10,
-};
-
-
-static const uint8_t scale_rl_run[HUFF_SCALE_RL_SIZE] = {
-     0,  0,  0,  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,  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,  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,  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,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,
-     0,  1,  0,  1,  0,  1,
-};
-
-static const uint8_t scale_rl_level[HUFF_SCALE_RL_SIZE] = {
-     0,  0,  1,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
-     2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,
-     3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  4,  4,  4,  4,
-     4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
-     4,  4,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,
-     5,  5,  5,  5,  5,  5,  5,  5,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
-     7,  7,  8,  8,  9,  9,
-};
-/** @} */
-
-
-/**
- * @name Huffman, run and level codes for runlevel-coded coefficients
- * @{
- */
-#define HUFF_COEF0_SIZE    272
-#define HUFF_COEF0_MAXBITS  21
-static const uint32_t coef0_huffcodes[HUFF_COEF0_SIZE] = {
-    0x00004A, 0x00002B, 0x000000, 0x000003, 0x000006, 0x000009, 0x00000F,
-    0x000010, 0x000016, 0x000011, 0x000016, 0x000028, 0x00002F, 0x000026,
-    0x000029, 0x000045, 0x000055, 0x00005D, 0x000042, 0x00004E, 0x000051,
-    0x00005E, 0x00008D, 0x0000A8, 0x0000AD, 0x000080, 0x000096, 0x00009F,
-    0x0000AA, 0x0000BE, 0x00011C, 0x000153, 0x000158, 0x000170, 0x000104,
-    0x00010D, 0x000105, 0x000103, 0x00012F, 0x000177, 0x000175, 0x000157,
-    0x000174, 0x000225, 0x00023B, 0x00020D, 0x00021F, 0x000281, 0x00027B,
-    0x000282, 0x0002AC, 0x0002FD, 0x00044F, 0x000478, 0x00044D, 0x0002EC,
-    0x00044E, 0x000564, 0x000409, 0x00040B, 0x000501, 0x000545, 0x0004F3,
-    0x000541, 0x00043B, 0x0004F1, 0x0004F4, 0x0008FD, 0x000A94, 0x000811,
-    0x000B88, 0x000B91, 0x000B93, 0x0008EA, 0x000899, 0x000B8A, 0x000972,
-    0x0009E5, 0x000A8F, 0x000A84, 0x000A8E, 0x000A00, 0x000830, 0x0008E8,
-    0x000B95, 0x000871, 0x00083A, 0x000814, 0x000873, 0x000BFE, 0x001728,
-    0x001595, 0x001712, 0x00102A, 0x001021, 0x001729, 0x00152E, 0x0013C3,
-    0x001721, 0x001597, 0x00151B, 0x0010F2, 0x001403, 0x001703, 0x001503,
-    0x001708, 0x0013C1, 0x00170E, 0x00170C, 0x0010E1, 0x0011EA, 0x001020,
-    0x001500, 0x0017FA, 0x001704, 0x001705, 0x0017F0, 0x0017FB, 0x0021E6,
-    0x002B2D, 0x0020C6, 0x002B29, 0x002E4A, 0x0023AC, 0x001519, 0x0023F3,
-    0x002B2C, 0x0021C0, 0x0017FE, 0x0023D7, 0x0017F9, 0x0012E7, 0x0013C0,
-    0x002261, 0x0023D3, 0x002057, 0x002056, 0x0021D2, 0x0020C7, 0x0023D2,
-    0x0020EC, 0x0044C0, 0x002FE2, 0x00475B, 0x002A03, 0x002FE3, 0x0021E2,
-    0x0021D0, 0x002A31, 0x002E13, 0x002E05, 0x0047E5, 0x00000E, 0x000024,
-    0x000088, 0x0000B9, 0x00010C, 0x000224, 0x0002B3, 0x000283, 0x0002ED,
-    0x00047B, 0x00041E, 0x00043D, 0x0004F5, 0x0005FD, 0x000A92, 0x000B96,
-    0x000838, 0x000971, 0x000B83, 0x000B80, 0x000BF9, 0x0011D3, 0x0011E8,
-    0x0011D7, 0x001527, 0x0011F8, 0x001073, 0x0010F0, 0x0010E4, 0x0017F8,
-    0x001062, 0x001402, 0x0017E3, 0x00151A, 0x001077, 0x00152B, 0x00170D,
-    0x0021D3, 0x002E41, 0x0013C2, 0x000029, 0x0000A9, 0x00025D, 0x000419,
-    0x000544, 0x000B8B, 0x0009E4, 0x0011D2, 0x001526, 0x001724, 0x0012E6,
-    0x00150B, 0x0017FF, 0x002E26, 0x002E4B, 0x002B28, 0x0021E3, 0x002A14,
-    0x00475A, 0x002E12, 0x000057, 0x00023E, 0x000A90, 0x000BF0, 0x001072,
-    0x001502, 0x0023D6, 0x0020ED, 0x002A30, 0x0044C7, 0x00008C, 0x00047F,
-    0x00152A, 0x002262, 0x002E04, 0x0000A1, 0x0005F9, 0x000173, 0x000875,
-    0x000171, 0x00152D, 0x0002E3, 0x0017E2, 0x0002AD, 0x0021C1, 0x000479,
-    0x0021E7, 0x00041F, 0x005C4E, 0x000543, 0x005C4F, 0x000A91, 0x00898D,
-    0x000B97, 0x008746, 0x000970, 0x008745, 0x000B85, 0x00A856, 0x00152F,
-    0x010E8E, 0x0010E5, 0x00A857, 0x00170F, 0x021D11, 0x002A58, 0x010E8F,
-    0x002E40, 0x021D13, 0x002A59, 0x043A25, 0x002A02, 0x043A21, 0x0044C1,
-    0x087448, 0x0047E4, 0x043A20, 0x00542A, 0x087449, 0x00898C,
-};
-
-static const uint8_t coef0_huffbits[HUFF_COEF0_SIZE] = {
-     8,  7,  2,  3,  3,  4,  4,
-     5,  5,  6,  6,  6,  6,  7,
-     7,  7,  7,  7,  8,  8,  8,
-     8,  8,  8,  8,  9,  9,  9,
-     9,  9,  9,  9,  9,  9, 10,
-    10, 10, 10, 10, 10, 10, 10,
-    10, 10, 10, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11,
-    11, 11, 12, 12, 12, 12, 12,
-    12, 12, 12, 12, 12, 12, 13,
-    12, 12, 12, 12, 12, 12, 13,
-    13, 13, 13, 13, 13, 13, 12,
-    12, 13, 13, 13, 13, 13, 13,
-    13, 13, 14, 14, 13, 13, 14,
-    13, 13, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 13, 14,
-    14, 14, 14, 14, 14, 14, 15,
-    14, 15, 14, 14, 14, 14, 14,
-    14, 15, 14, 14, 14, 14, 14,
-    14, 14, 15, 15, 15, 15, 14,
-    15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15,  4,  7,
-     8,  9, 10, 10, 10, 11, 11,
-    11, 12, 12, 12, 12, 12, 12,
-    13, 13, 13, 13, 13, 13, 13,
-    13, 13, 13, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 13, 14,
-    15, 14, 14,  6,  9, 11, 12,
-    12, 12, 13, 13, 13, 13, 14,
-    14, 14, 14, 14, 14, 15, 15,
-    15, 15,  7, 10, 12, 13, 14,
-    14, 14, 15, 15, 15,  8, 11,
-    13, 14, 15,  9, 12,  9, 13,
-    10, 13, 10, 14, 11, 15, 11,
-    15, 12, 15, 12, 15, 12, 16,
-    12, 17, 13, 17, 13, 17, 13,
-    18, 14, 17, 14, 19, 14, 18,
-    14, 19, 14, 20, 15, 20, 15,
-    21, 15, 20, 16, 21, 16,
-};
-
-
-#define HUFF_COEF1_SIZE    244
-#define HUFF_COEF1_MAXBITS  22
-static const uint32_t coef1_huffcodes[HUFF_COEF1_SIZE] = {
-    0x0001E2, 0x00007F, 0x000000, 0x000002, 0x000008, 0x00000E, 0x000019,
-    0x00002F, 0x000037, 0x000060, 0x00006C, 0x000095, 0x0000C6, 0x0000F0,
-    0x00012E, 0x000189, 0x0001A5, 0x0001F8, 0x000253, 0x00030A, 0x000344,
-    0x00034D, 0x0003F2, 0x0004BD, 0x0005D7, 0x00062A, 0x00068B, 0x000693,
-    0x000797, 0x00097D, 0x000BAB, 0x000C52, 0x000C5E, 0x000D21, 0x000D20,
-    0x000F1A, 0x000FCE, 0x000FD1, 0x0012F1, 0x001759, 0x0018AC, 0x0018A7,
-    0x0018BF, 0x001A2B, 0x001E52, 0x001E50, 0x001E31, 0x001FB8, 0x0025E6,
-    0x0025E7, 0x002EB4, 0x002EB7, 0x003169, 0x00315B, 0x00317C, 0x00316C,
-    0x0034CA, 0x00348D, 0x003F40, 0x003CA2, 0x003F76, 0x004BC3, 0x004BE5,
-    0x003F73, 0x004BF8, 0x004BF9, 0x006131, 0x00628B, 0x006289, 0x0062DA,
-    0x00628A, 0x0062D4, 0x006997, 0x0062B4, 0x006918, 0x00794D, 0x007E7B,
-    0x007E87, 0x007EEA, 0x00794E, 0x00699D, 0x007967, 0x00699F, 0x0062DB,
-    0x007E7A, 0x007EEB, 0x00BAC0, 0x0097C9, 0x00C537, 0x00C5AB, 0x00D233,
-    0x00D338, 0x00BAC1, 0x00D23D, 0x012F91, 0x00D339, 0x00FDC8, 0x00D23C,
-    0x00FDDC, 0x00FDC9, 0x00FDDD, 0x00D33C, 0x000003, 0x000016, 0x00003E,
-    0x0000C3, 0x0001A1, 0x000347, 0x00062E, 0x000BAA, 0x000F2D, 0x001A2A,
-    0x001E58, 0x00309B, 0x003CA3, 0x005D6A, 0x00629A, 0x006996, 0x00794F,
-    0x007EE5, 0x00BAD7, 0x00C5AA, 0x00C5F4, 0x00FDDF, 0x00FDDE, 0x018A20,
-    0x018A6D, 0x01A67B, 0x01A464, 0x025F21, 0x01F9E2, 0x01F9E3, 0x00000A,
-    0x00003D, 0x000128, 0x0003C7, 0x000C24, 0x0018A3, 0x002EB1, 0x003CB2,
-    0x00691F, 0x007E79, 0x000013, 0x0000BB, 0x00034E, 0x000D14, 0x0025FD,
-    0x004BE7, 0x000024, 0x000188, 0x0007EF, 0x000035, 0x000308, 0x0012F2,
-    0x00005C, 0x0003F6, 0x0025E0, 0x00006D, 0x000698, 0x000096, 0x000C25,
-    0x0000C7, 0x000F1B, 0x0000F3, 0x0012FF, 0x000174, 0x001A66, 0x0001A0,
-    0x003099, 0x0001E4, 0x00316B, 0x000252, 0x003F31, 0x00030B, 0x004BE6,
-    0x000346, 0x0062FB, 0x00034F, 0x007966, 0x0003F5, 0x007E86, 0x0005D4,
-    0x00C511, 0x00062C, 0x00C5F5, 0x000692, 0x00F299, 0x000795, 0x00F298,
-    0x0007E9, 0x018A21, 0x00097E, 0x0175AD, 0x000C27, 0x01A67A, 0x000C57,
-    0x02EB59, 0x000D22, 0x0314D9, 0x000F19, 0x03F3C2, 0x000FCD, 0x0348CB,
-    0x0012F8, 0x04BE41, 0x0018A0, 0x03F3C1, 0x0018A1, 0x04BE40, 0x0018B7,
-    0x0629B0, 0x001A64, 0x0D2329, 0x001E30, 0x03F3C3, 0x001F9F, 0x0BAD62,
-    0x001F99, 0x0FCF00, 0x00309A, 0x0629B1, 0x002EB6, 0x175AC3, 0x00314C,
-    0x069195, 0x003168, 0x0BAD63, 0x00348E, 0x175AC1, 0x003F30, 0x07E781,
-    0x003F41, 0x0D2328, 0x003F42, 0x1F9E03, 0x004BC2, 0x175AC2, 0x003F74,
-    0x175AC0, 0x005D61, 0x3F3C05, 0x006130, 0x3F3C04, 0x0062B5,
-};
-
-static const uint8_t coef1_huffbits[HUFF_COEF1_SIZE] = {
-     9,  7,  2,  3,  4,  4,  5,
-     6,  6,  7,  7,  8,  8,  8,
-     9,  9,  9,  9, 10, 10, 10,
-    10, 10, 11, 11, 11, 11, 11,
-    11, 12, 12, 12, 12, 12, 12,
-    12, 12, 12, 13, 13, 13, 13,
-    13, 13, 13, 13, 13, 13, 14,
-    14, 14, 14, 14, 14, 14, 14,
-    14, 14, 14, 14, 14, 15, 15,
-    14, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15,
-    15, 15, 15, 15, 15, 15, 15,
-    15, 15, 16, 16, 16, 16, 16,
-    16, 16, 16, 17, 16, 16, 16,
-    16, 16, 16, 16,  3,  5,  6,
-     8,  9, 10, 11, 12, 12, 13,
-    13, 14, 14, 15, 15, 15, 15,
-    15, 16, 16, 16, 16, 16, 17,
-    17, 17, 17, 18, 17, 17,  4,
-     6,  9, 10, 12, 13, 14, 14,
-    15, 15,  5,  8, 10, 12, 14,
-    15,  6,  9, 11,  6, 10, 13,
-     7, 10, 14,  7, 11,  8, 12,
-     8, 12,  8, 13,  9, 13,  9,
-    14,  9, 14, 10, 14, 10, 15,
-    10, 15, 10, 15, 10, 15, 11,
-    16, 11, 16, 11, 16, 11, 16,
-    11, 17, 12, 17, 12, 17, 12,
-    18, 12, 18, 12, 18, 12, 18,
-    13, 19, 13, 18, 13, 19, 13,
-    19, 13, 20, 13, 18, 13, 20,
-    13, 20, 14, 19, 14, 21, 14,
-    19, 14, 20, 14, 21, 14, 19,
-    14, 20, 14, 21, 15, 21, 14,
-    21, 15, 22, 15, 22, 15,
-};
-
-
-static const uint16_t coef0_run[HUFF_COEF0_SIZE] = {
-      0,   0,   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,  57,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,
-     68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,
-     82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
-     96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
-    110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
-    124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
-    138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,   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,   0,   1,   2,   3,
-      4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,  16,  17,
-     18,  19,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   1,
-      2,   3,   4,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,
-      1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,
-      1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,   1,   0,
-      1,   0,   1,   0,   1,   0,
-};
-
-static const float coef0_level[HUFF_COEF0_SIZE] = {
-      0,   0,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,
-      1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   2,   2,
-      2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,
-      2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,
-      2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   3,   3,   3,   3,
-      3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   3,
-      3,   3,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   5,   5,
-      5,   5,   5,   6,   6,   7,   7,   8,   8,   9,   9,  10,  10,  11,
-     11,  12,  12,  13,  13,  14,  14,  15,  15,  16,  16,  17,  17,  18,
-     18,  19,  19,  20,  20,  21,  21,  22,  22,  23,  23,  24,  24,  25,
-     25,  26,  26,  27,  27,  28,
-};
-
-
-static const uint16_t coef1_run[HUFF_COEF1_SIZE] = {
-     0,  0,  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, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
-    70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
-    88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,  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,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  0,  1,
-     2,  3,  4,  5,  0,  1,  2,  0,  1,  2,  0,  1,  2,  0,  1,  0,  1,  0,
-     1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,
-     1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,
-     1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,
-     1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,  1,  0,
-     1,  0,  1,  0,  1,  0,  1,  0,  0,  0,
-};
-
-static const float coef1_level[HUFF_COEF1_SIZE] = {
-     0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-     1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2,  2,  2,  2,  2,
-     2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,
-     2,  2,  2,  2,  2,  2,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  4,  4,
-     4,  4,  4,  4,  5,  5,  5,  6,  6,  6,  7,  7,  7,  8,  8,  9,  9, 10,
-    10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19,
-    19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28,
-    28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37,
-    37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46,
-    46, 47, 47, 48, 48, 49, 49, 50, 51, 52,
-};
-/** @} */
-
-
-/**
- * @name Huffman and vector lookup tables for vector-coded coefficients
- * @{
- */
-#define HUFF_VEC4_SIZE    127
-#define HUFF_VEC4_MAXBITS  14
-static const uint16_t vec4_huffcodes[HUFF_VEC4_SIZE] = {
-    0x0019, 0x0027, 0x00F2, 0x03BA, 0x0930, 0x1267, 0x0031, 0x0030,
-    0x0097, 0x0221, 0x058B, 0x0124, 0x00EB, 0x01D4, 0x03D8, 0x0584,
-    0x0364, 0x045F, 0x0F66, 0x0931, 0x24CD, 0x002F, 0x0039, 0x00E8,
-    0x02C3, 0x078A, 0x0037, 0x0029, 0x0084, 0x01B1, 0x00ED, 0x0086,
-    0x00F9, 0x03AB, 0x01EB, 0x08BC, 0x011E, 0x00F3, 0x0220, 0x058A,
-    0x00EC, 0x008E, 0x012B, 0x01EA, 0x0119, 0x04B0, 0x04B1, 0x03B8,
-    0x0691, 0x0365, 0x01ED, 0x049A, 0x0EA9, 0x0EA8, 0x08BD, 0x24CC,
-    0x0026, 0x0035, 0x00DB, 0x02C4, 0x07B2, 0x0038, 0x002B, 0x007F,
-    0x01B3, 0x00F4, 0x0091, 0x0116, 0x03BB, 0x0215, 0x0932, 0x002D,
-    0x002A, 0x008A, 0x01DE, 0x0028, 0x0020, 0x005C, 0x0090, 0x0068,
-    0x01EE, 0x00E9, 0x008D, 0x012A, 0x0087, 0x005D, 0x0118, 0x0349,
-    0x01EF, 0x01E3, 0x08B9, 0x00F0, 0x00D3, 0x0214, 0x049B, 0x00DA,
-    0x0089, 0x0125, 0x0217, 0x012D, 0x0690, 0x0094, 0x007D, 0x011F,
-    0x007E, 0x0059, 0x0127, 0x01A5, 0x0111, 0x00F8, 0x045D, 0x03B9,
-    0x0259, 0x0580, 0x02C1, 0x01DF, 0x0585, 0x0216, 0x0163, 0x01B0,
-    0x03C4, 0x08B8, 0x078B, 0x0755, 0x0581, 0x0F67, 0x0000,
-};
-
-static const uint8_t vec4_huffbits[HUFF_VEC4_SIZE] = {
-     5,  6,  8, 10, 12, 13,  6,  6,
-     8, 10, 11,  9,  8,  9, 10, 11,
-    10, 11, 12, 12, 14,  6,  6,  8,
-    10, 11,  6,  6,  8,  9,  8,  8,
-     8, 10,  9, 12,  9,  8, 10, 11,
-     8,  8,  9,  9,  9, 11, 11, 10,
-    11, 10,  9, 11, 12, 12, 12, 14,
-     6,  6,  8, 10, 11,  6,  6,  7,
-     9,  8,  8,  9, 10, 10, 12,  6,
-     6,  8,  9,  6,  6,  7,  8,  7,
-     9,  8,  8,  9,  8,  7,  9, 10,
-     9,  9, 12,  8,  8, 10, 11,  8,
-     8,  9, 10,  9, 11,  8,  7,  9,
-     7,  7,  9,  9,  9,  8, 11, 10,
-    10, 11, 10,  9, 11, 10,  9,  9,
-    10, 12, 11, 11, 11, 12,  1,
-};
-
-
-#define HUFF_VEC2_SIZE    137
-#define HUFF_VEC2_MAXBITS  12
-static const uint16_t vec2_huffcodes[HUFF_VEC2_SIZE] = {
-    0x055, 0x01C, 0x01A, 0x02B, 0x028, 0x067, 0x08B, 0x039,
-    0x170, 0x10D, 0x2A5, 0x047, 0x464, 0x697, 0x523, 0x8CB,
-    0x01B, 0x00E, 0x000, 0x010, 0x012, 0x036, 0x048, 0x04C,
-    0x0C2, 0x09B, 0x171, 0x03B, 0x224, 0x34A, 0x2D6, 0x019,
-    0x00F, 0x002, 0x014, 0x017, 0x006, 0x05D, 0x054, 0x0C7,
-    0x0B4, 0x192, 0x10E, 0x233, 0x043, 0x02C, 0x00F, 0x013,
-    0x006, 0x02F, 0x02C, 0x068, 0x077, 0x0DF, 0x111, 0x1A4,
-    0x16A, 0x2A4, 0x027, 0x011, 0x018, 0x02D, 0x00F, 0x04A,
-    0x040, 0x097, 0x01F, 0x11B, 0x022, 0x16D, 0x066, 0x035,
-    0x005, 0x02B, 0x049, 0x009, 0x075, 0x0CB, 0x0AA, 0x187,
-    0x106, 0x08A, 0x047, 0x060, 0x06E, 0x01D, 0x074, 0x0C4,
-    0x01E, 0x118, 0x1A7, 0x038, 0x042, 0x053, 0x076, 0x0A8,
-    0x0CA, 0x082, 0x110, 0x18D, 0x12D, 0x0B9, 0x0C8, 0x0DE,
-    0x01C, 0x0AB, 0x113, 0x18C, 0x10F, 0x09A, 0x0A5, 0x0B7,
-    0x11A, 0x186, 0x1A6, 0x259, 0x153, 0x18A, 0x193, 0x020,
-    0x10C, 0x046, 0x03A, 0x107, 0x149, 0x16C, 0x2D7, 0x225,
-    0x258, 0x316, 0x696, 0x317, 0x042, 0x522, 0x290, 0x8CA,
-    0x001,
-};
-
-static const uint8_t vec2_huffbits[HUFF_VEC2_SIZE] = {
-     7,  6,  6,  6,  7,  7,  8,  9,
-     9, 10, 10, 11, 11, 11, 12, 12,
-     6,  4,  5,  5,  6,  6,  7,  8,
-     8,  9,  9, 10, 10, 10, 11,  6,
-     4,  5,  5,  6,  7,  7,  8,  8,
-     9,  9, 10, 10, 11,  6,  5,  5,
-     6,  6,  7,  7,  8,  8,  9,  9,
-    10, 10,  7,  6,  6,  6,  7,  7,
-     8,  8,  9,  9, 10, 10,  7,  6,
-     7,  7,  7,  8,  8,  8,  9,  9,
-    10,  8,  7,  7,  7,  8,  8,  8,
-     9,  9,  9,  9,  8,  8,  8,  8,
-     8,  9,  9,  9,  9,  8,  8,  8,
-     9,  9,  9,  9, 10,  9,  9,  9,
-     9,  9,  9, 10,  9,  9,  9, 10,
-    10, 11, 10, 10, 10, 10, 11, 10,
-    10, 10, 11, 10, 11, 12, 11, 12,
-     3,
-};
-
-
-#define HUFF_VEC1_SIZE    101
-#define HUFF_VEC1_MAXBITS  11
-static const uint16_t vec1_huffcodes[HUFF_VEC1_SIZE] = {
-    0x01A, 0x003, 0x017, 0x010, 0x00C, 0x009, 0x005, 0x000,
-    0x00D, 0x00A, 0x009, 0x00C, 0x00F, 0x002, 0x004, 0x007,
-    0x00B, 0x00F, 0x01C, 0x006, 0x010, 0x015, 0x01C, 0x022,
-    0x03B, 0x00E, 0x019, 0x023, 0x034, 0x036, 0x03A, 0x047,
-    0x008, 0x00A, 0x01E, 0x031, 0x037, 0x050, 0x053, 0x06B,
-    0x06F, 0x08C, 0x0E8, 0x0EA, 0x0EB, 0x016, 0x03E, 0x03F,
-    0x06C, 0x089, 0x08A, 0x0A3, 0x0A4, 0x0D4, 0x0DD, 0x0EC,
-    0x0EE, 0x11A, 0x1D2, 0x024, 0x025, 0x02E, 0x027, 0x0C2,
-    0x0C0, 0x0DA, 0x0DB, 0x111, 0x144, 0x116, 0x14A, 0x145,
-    0x1B8, 0x1AB, 0x1DA, 0x1DE, 0x1DB, 0x1DF, 0x236, 0x237,
-    0x3A6, 0x3A7, 0x04D, 0x04C, 0x05E, 0x05F, 0x183, 0x182,
-    0x186, 0x221, 0x187, 0x220, 0x22E, 0x22F, 0x296, 0x354,
-    0x297, 0x355, 0x372, 0x373, 0x016,
-};
-
-static const uint8_t vec1_huffbits[HUFF_VEC1_SIZE] = {
-     7,  6,  5,  5,  5,  5,  5,  5,
-     4,  4,  4,  4,  4,  5,  5,  5,
-     5,  5,  5,  6,  6,  6,  6,  6,
-     6,  7,  7,  7,  7,  7,  7,  7,
-     8,  8,  8,  8,  8,  8,  8,  8,
-     8,  8,  8,  8,  8,  9,  9,  9,
-     9,  9,  9,  9,  9,  9,  9,  9,
-     9,  9,  9, 10, 10, 10, 10, 10,
-    10, 10, 10, 10, 10, 10, 10, 10,
-    10, 10, 10, 10, 10, 10, 10, 10,
-    10, 10, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11, 11, 11, 11, 11,
-    11, 11, 11, 11,  5,
-};
-
-
-static const uint16_t symbol_to_vec4[HUFF_VEC4_SIZE] = {
-        0,    1,      2,     3,     4,     5,    16,    17,    18,    19,
-       20,   32,     33,    34,    35,    48,    49,    50,    64,    65,
-       80,   256,   257,   258,   259,   260,   272,   273,   274,   275,
-      288,   289,   290,   304,   305,   320,   512,   513,   514,   515,
-      528,   529,   530,   544,   545,   560,   768,   769,   770,   784,
-      785,   800,  1024,  1025,  1040,  1280,  4096,  4097,  4098,  4099,
-     4100,  4112,  4113,  4114,  4115,  4128,  4129,  4130,  4144,  4145,
-     4160,  4352,  4353,  4354,  4355,  4368,  4369,  4370,  4384,  4385,
-     4400,  4608,  4609,  4610,  4624,  4625,  4640,  4864,  4865,  4880,
-     5120,  8192,  8193,  8194,  8195,  8208,  8209,  8210,  8224,  8225,
-     8240,  8448,  8449,  8450,  8464,  8465,  8480,  8704,  8705,  8720,
-     8960, 12288, 12289, 12290, 12304, 12305, 12320, 12544, 12545, 12560,
-    12800, 16384, 16385, 16400, 16640, 20480,     0,
-};
-
-
-static const uint8_t symbol_to_vec2[HUFF_VEC2_SIZE] = {
-      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,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,
-     48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  64,  65,
-     66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  80,  81,  82,  83,  84,
-     85,  86,  87,  88,  89,  90,  96,  97,  98,  99, 100, 101, 102, 103, 104,
-    105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 128, 129, 130, 131, 132,
-    133, 134, 135, 144, 145, 146, 147, 148, 149, 150, 160, 161, 162, 163, 164,
-    165, 176, 177, 178, 179, 180, 192, 193, 194, 195, 208, 209, 210, 224, 225,
-    240,   0,
-};
-/** @} */
-
-
-/**
- * @brief decorrelation matrix for multichannel streams
- **/
-static const float default_decorrelation_matrices[] = {
-    1.000000,  0.707031, -0.707031,  0.707031,  0.707031,  0.578125,  0.707031,
-    0.410156,  0.578125, -0.707031,  0.410156,  0.578125,  0.000000, -0.816406,
-    0.500000,  0.652344,  0.500000,  0.269531,  0.500000,  0.269531, -0.500000,
-   -0.652344,  0.500000, -0.269531, -0.500000,  0.652344,  0.500000, -0.652344,
-    0.500000, -0.269531,  0.445312,  0.601562,  0.511719,  0.371094,  0.195312,
-    0.445312,  0.371094, -0.195312, -0.601562, -0.511719,  0.445312,  0.000000,
-   -0.632812,  0.000000,  0.632812,  0.445312, -0.371094, -0.195312,  0.601562,
-   -0.511719,  0.445312, -0.601562,  0.511719, -0.371094,  0.195312,  0.410156,
-    0.558594,  0.500000,  0.410156,  0.289062,  0.148438,  0.410156,  0.410156,
-    0.000000, -0.410156, -0.578125, -0.410156,  0.410156,  0.148438, -0.500000,
-   -0.410156,  0.289062,  0.558594,  0.410156, -0.148438, -0.500000,  0.410156,
-    0.289062, -0.558594,  0.410156, -0.410156,  0.000000,  0.410156, -0.578125,
-    0.410156,  0.410156, -0.558594,  0.500000, -0.410156,  0.289062, -0.148438,
-};
-
-/**
- * @brief default decorrelation matrix offsets
- */
-static const float * const default_decorrelation[] = {
-    NULL,
-    &default_decorrelation_matrices[0],
-    &default_decorrelation_matrices[1],
-    &default_decorrelation_matrices[5],
-    &default_decorrelation_matrices[14],
-    &default_decorrelation_matrices[30],
-    &default_decorrelation_matrices[55]
-};
-
-#endif /* AVCODEC_WMAPRODATA_H */
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
deleted file mode 100644
index 3eca101..0000000
--- a/libavcodec/wmaprodec.c
+++ /dev/null
@@ -1,1579 +0,0 @@
-/*
- * Wmapro compatible decoder
- * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
- * Copyright (c) 2008 - 2009 Sascha Sommer, Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief wmapro decoder implementation
- * Wmapro is an MDCT based codec comparable to wma standard or AAC.
- * The decoding therefore consists of the following steps:
- * - bitstream decoding
- * - reconstruction of per-channel data
- * - rescaling and inverse quantization
- * - IMDCT
- * - windowing and overlapp-add
- *
- * The compressed wmapro bitstream is split into individual packets.
- * Every such packet contains one or more wma frames.
- * The compressed frames may have a variable length and frames may
- * cross packet boundaries.
- * Common to all wmapro frames is the number of samples that are stored in
- * a frame.
- * The number of samples and a few other decode flags are stored
- * as extradata that has to be passed to the decoder.
- *
- * The wmapro frames themselves are again split into a variable number of
- * subframes. Every subframe contains the data for 2^N time domain samples
- * where N varies between 7 and 12.
- *
- * Example wmapro bitstream (in samples):
- *
- * ||   packet 0           || packet 1 || packet 2      packets
- * ---------------------------------------------------
- * || frame 0      || frame 1       || frame 2    ||    frames
- * ---------------------------------------------------
- * ||   |      |   ||   |   |   |   ||            ||    subframes of channel 0
- * ---------------------------------------------------
- * ||      |   |   ||   |   |   |   ||            ||    subframes of channel 1
- * ---------------------------------------------------
- *
- * The frame layouts for the individual channels of a wma frame does not need
- * to be the same.
- *
- * However, if the offsets and lengths of several subframes of a frame are the
- * same, the subframes of the channels can be grouped.
- * Every group may then use special coding techniques like M/S stereo coding
- * to improve the compression ratio. These channel transformations do not
- * need to be applied to a whole subframe. Instead, they can also work on
- * individual scale factor bands (see below).
- * The coefficients that carry the audio signal in the frequency domain
- * are transmitted as huffman-coded vectors with 4, 2 and 1 elements.
- * In addition to that, the encoder can switch to a runlevel coding scheme
- * by transmitting subframe_length / 128 zero coefficients.
- *
- * Before the audio signal can be converted to the time domain, the
- * coefficients have to be rescaled and inverse quantized.
- * A subframe is therefore split into several scale factor bands that get
- * scaled individually.
- * Scale factors are submitted for every frame but they might be shared
- * between the subframes of a channel. Scale factors are initially DPCM-coded.
- * Once scale factors are shared, the differences are transmitted as runlevel
- * codes.
- * Every subframe length and offset combination in the frame layout shares a
- * common quantization factor that can be adjusted for every channel by a
- * modifier.
- * After the inverse quantization, the coefficients get processed by an IMDCT.
- * The resulting values are then windowed with a sine window and the first half
- * of the values are added to the second half of the output from the previous
- * subframe in order to reconstruct the output samples.
- */
-
-#include "avcodec.h"
-#include "internal.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "wmaprodata.h"
-#include "dsputil.h"
-#include "wma.h"
-
-/** current decoder limitations */
-#define WMAPRO_MAX_CHANNELS    8                             ///< max number of handled channels
-#define MAX_SUBFRAMES  32                                    ///< max number of subframes per channel
-#define MAX_BANDS      29                                    ///< max number of scale factor bands
-#define MAX_FRAMESIZE  32768                                 ///< maximum compressed frame size
-
-#define WMAPRO_BLOCK_MAX_BITS 12                                           ///< log2 of max block size
-#define WMAPRO_BLOCK_MAX_SIZE (1 << WMAPRO_BLOCK_MAX_BITS)                 ///< maximum block size
-#define WMAPRO_BLOCK_SIZES    (WMAPRO_BLOCK_MAX_BITS - BLOCK_MIN_BITS + 1) ///< possible block sizes
-
-
-#define VLCBITS            9
-#define SCALEVLCBITS       8
-#define VEC4MAXDEPTH    ((HUFF_VEC4_MAXBITS+VLCBITS-1)/VLCBITS)
-#define VEC2MAXDEPTH    ((HUFF_VEC2_MAXBITS+VLCBITS-1)/VLCBITS)
-#define VEC1MAXDEPTH    ((HUFF_VEC1_MAXBITS+VLCBITS-1)/VLCBITS)
-#define SCALEMAXDEPTH   ((HUFF_SCALE_MAXBITS+SCALEVLCBITS-1)/SCALEVLCBITS)
-#define SCALERLMAXDEPTH ((HUFF_SCALE_RL_MAXBITS+VLCBITS-1)/VLCBITS)
-
-static VLC              sf_vlc;           ///< scale factor DPCM vlc
-static VLC              sf_rl_vlc;        ///< scale factor run length vlc
-static VLC              vec4_vlc;         ///< 4 coefficients per symbol
-static VLC              vec2_vlc;         ///< 2 coefficients per symbol
-static VLC              vec1_vlc;         ///< 1 coefficient per symbol
-static VLC              coef_vlc[2];      ///< coefficient run length vlc codes
-static float            sin64[33];        ///< sinus table for decorrelation
-
-/**
- * @brief frame specific decoder context for a single channel
- */
-typedef struct {
-    int16_t  prev_block_len;                          ///< length of the previous block
-    uint8_t  transmit_coefs;
-    uint8_t  num_subframes;
-    uint16_t subframe_len[MAX_SUBFRAMES];             ///< subframe length in samples
-    uint16_t subframe_offset[MAX_SUBFRAMES];          ///< subframe positions in the current frame
-    uint8_t  cur_subframe;                            ///< current subframe number
-    uint16_t decoded_samples;                         ///< number of already processed samples
-    uint8_t  grouped;                                 ///< channel is part of a group
-    int      quant_step;                              ///< quantization step for the current subframe
-    int8_t   reuse_sf;                                ///< share scale factors between subframes
-    int8_t   scale_factor_step;                       ///< scaling step for the current subframe
-    int      max_scale_factor;                        ///< maximum scale factor for the current subframe
-    int      saved_scale_factors[2][MAX_BANDS];       ///< resampled and (previously) transmitted scale factor values
-    int8_t   scale_factor_idx;                        ///< index for the transmitted scale factor values (used for resampling)
-    int*     scale_factors;                           ///< pointer to the scale factor values used for decoding
-    uint8_t  table_idx;                               ///< index in sf_offsets for the scale factor reference block
-    float*   coeffs;                                  ///< pointer to the subframe decode buffer
-    DECLARE_ALIGNED(16, float, out)[WMAPRO_BLOCK_MAX_SIZE + WMAPRO_BLOCK_MAX_SIZE / 2]; ///< output buffer
-} WMAProChannelCtx;
-
-/**
- * @brief channel group for channel transformations
- */
-typedef struct {
-    uint8_t num_channels;                                     ///< number of channels in the group
-    int8_t  transform;                                        ///< transform on / off
-    int8_t  transform_band[MAX_BANDS];                        ///< controls if the transform is enabled for a certain band
-    float   decorrelation_matrix[WMAPRO_MAX_CHANNELS*WMAPRO_MAX_CHANNELS];
-    float*  channel_data[WMAPRO_MAX_CHANNELS];                ///< transformation coefficients
-} WMAProChannelGrp;
-
-/**
- * @brief main decoder context
- */
-typedef struct WMAProDecodeCtx {
-    /* generic decoder variables */
-    AVCodecContext*  avctx;                         ///< codec context for av_log
-    DSPContext       dsp;                           ///< accelerated DSP functions
-    uint8_t          frame_data[MAX_FRAMESIZE +
-                      FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
-    PutBitContext    pb;                            ///< context for filling the frame_data buffer
-    FFTContext       mdct_ctx[WMAPRO_BLOCK_SIZES];  ///< MDCT context per block size
-    DECLARE_ALIGNED(16, float, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT output buffer
-    float*           windows[WMAPRO_BLOCK_SIZES];   ///< windows for the different block sizes
-
-    /* frame size dependent frame information (set during initialization) */
-    uint32_t         decode_flags;                  ///< used compression features
-    uint8_t          len_prefix;                    ///< frame is prefixed with its length
-    uint8_t          dynamic_range_compression;     ///< frame contains DRC data
-    uint8_t          bits_per_sample;               ///< integer audio sample size for the unscaled IMDCT output (used to scale to [-1.0, 1.0])
-    uint16_t         samples_per_frame;             ///< number of samples to output
-    uint16_t         log2_frame_size;
-    int8_t           num_channels;                  ///< number of channels in the stream (same as AVCodecContext.num_channels)
-    int8_t           lfe_channel;                   ///< lfe channel index
-    uint8_t          max_num_subframes;
-    uint8_t          subframe_len_bits;             ///< number of bits used for the subframe length
-    uint8_t          max_subframe_len_bit;          ///< flag indicating that the subframe is of maximum size when the first subframe length bit is 1
-    uint16_t         min_samples_per_subframe;
-    int8_t           num_sfb[WMAPRO_BLOCK_SIZES];   ///< scale factor bands per block size
-    int16_t          sfb_offsets[WMAPRO_BLOCK_SIZES][MAX_BANDS];                    ///< scale factor band offsets (multiples of 4)
-    int8_t           sf_offsets[WMAPRO_BLOCK_SIZES][WMAPRO_BLOCK_SIZES][MAX_BANDS]; ///< scale factor resample matrix
-    int16_t          subwoofer_cutoffs[WMAPRO_BLOCK_SIZES]; ///< subwoofer cutoff values
-
-    /* packet decode state */
-    GetBitContext    pgb;                           ///< bitstream reader context for the packet
-    uint8_t          packet_offset;                 ///< frame offset in the packet
-    uint8_t          packet_sequence_number;        ///< current packet number
-    int              num_saved_bits;                ///< saved number of bits
-    int              frame_offset;                  ///< frame offset in the bit reservoir
-    int              subframe_offset;               ///< subframe offset in the bit reservoir
-    uint8_t          packet_loss;                   ///< set in case of bitstream error
-    uint8_t          packet_done;                   ///< set when a packet is fully decoded
-
-    /* frame decode state */
-    uint32_t         frame_num;                     ///< current frame number (not used for decoding)
-    GetBitContext    gb;                            ///< bitstream reader context
-    int              buf_bit_size;                  ///< buffer size in bits
-    float*           samples;                       ///< current samplebuffer pointer
-    float*           samples_end;                   ///< maximum samplebuffer pointer
-    uint8_t          drc_gain;                      ///< gain for the DRC tool
-    int8_t           skip_frame;                    ///< skip output step
-    int8_t           parsed_all_subframes;          ///< all subframes decoded?
-
-    /* subframe/block decode state */
-    int16_t          subframe_len;                  ///< current subframe length
-    int8_t           channels_for_cur_subframe;     ///< number of channels that contain the subframe
-    int8_t           channel_indexes_for_cur_subframe[WMAPRO_MAX_CHANNELS];
-    int8_t           num_bands;                     ///< number of scale factor bands
-    int16_t*         cur_sfb_offsets;               ///< sfb offsets for the current block
-    uint8_t          table_idx;                     ///< index for the num_sfb, sfb_offsets, sf_offsets and subwoofer_cutoffs tables
-    int8_t           esc_len;                       ///< length of escaped coefficients
-
-    uint8_t          num_chgroups;                  ///< number of channel groups
-    WMAProChannelGrp chgroup[WMAPRO_MAX_CHANNELS];  ///< channel group information
-
-    WMAProChannelCtx channel[WMAPRO_MAX_CHANNELS];  ///< per channel data
-} WMAProDecodeCtx;
-
-
-/**
- *@brief helper function to print the most important members of the context
- *@param s context
- */
-static void av_cold dump_context(WMAProDecodeCtx *s)
-{
-#define PRINT(a, b)     av_log(s->avctx, AV_LOG_DEBUG, " %s = %d\n", a, b);
-#define PRINT_HEX(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %x\n", a, b);
-
-    PRINT("ed sample bit depth", s->bits_per_sample);
-    PRINT_HEX("ed decode flags", s->decode_flags);
-    PRINT("samples per frame",   s->samples_per_frame);
-    PRINT("log2 frame size",     s->log2_frame_size);
-    PRINT("max num subframes",   s->max_num_subframes);
-    PRINT("len prefix",          s->len_prefix);
-    PRINT("num channels",        s->num_channels);
-}
-
-/**
- *@brief Uninitialize the decoder and free all resources.
- *@param avctx codec context
- *@return 0 on success, < 0 otherwise
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    WMAProDecodeCtx *s = avctx->priv_data;
-    int i;
-
-    for (i = 0; i < WMAPRO_BLOCK_SIZES; i++)
-        ff_mdct_end(&s->mdct_ctx[i]);
-
-    return 0;
-}
-
-/**
- *@brief Initialize the decoder.
- *@param avctx codec context
- *@return 0 on success, -1 otherwise
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    WMAProDecodeCtx *s = avctx->priv_data;
-    uint8_t *edata_ptr = avctx->extradata;
-    unsigned int channel_mask;
-    int i;
-    int log2_max_num_subframes;
-    int num_possible_block_sizes;
-
-    s->avctx = avctx;
-    dsputil_init(&s->dsp, avctx);
-    init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
-
-    avctx->sample_fmt = SAMPLE_FMT_FLT;
-
-    if (avctx->extradata_size >= 18) {
-        s->decode_flags    = AV_RL16(edata_ptr+14);
-        channel_mask       = AV_RL32(edata_ptr+2);
-        s->bits_per_sample = AV_RL16(edata_ptr);
-        /** dump the extradata */
-        for (i = 0; i < avctx->extradata_size; i++)
-            dprintf(avctx, "[%x] ", avctx->extradata[i]);
-        dprintf(avctx, "\n");
-
-    } else {
-        av_log_ask_for_sample(avctx, "Unknown extradata size\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    /** generic init */
-    s->log2_frame_size = av_log2(avctx->block_align) + 4;
-
-    /** frame info */
-    s->skip_frame  = 1; /** skip first frame */
-    s->packet_loss = 1;
-    s->len_prefix  = (s->decode_flags & 0x40);
-
-    if (!s->len_prefix) {
-        av_log_ask_for_sample(avctx, "no length prefix\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    /** get frame len */
-    s->samples_per_frame = 1 << ff_wma_get_frame_len_bits(avctx->sample_rate,
-                                                          3, s->decode_flags);
-
-    /** init previous block len */
-    for (i = 0; i < avctx->channels; i++)
-        s->channel[i].prev_block_len = s->samples_per_frame;
-
-    /** subframe info */
-    log2_max_num_subframes       = ((s->decode_flags & 0x38) >> 3);
-    s->max_num_subframes         = 1 << log2_max_num_subframes;
-    if (s->max_num_subframes == 16)
-        s->max_subframe_len_bit = 1;
-    s->subframe_len_bits = av_log2(log2_max_num_subframes) + 1;
-
-    num_possible_block_sizes     = log2_max_num_subframes + 1;
-    s->min_samples_per_subframe  = s->samples_per_frame / s->max_num_subframes;
-    s->dynamic_range_compression = (s->decode_flags & 0x80);
-
-    if (s->max_num_subframes > MAX_SUBFRAMES) {
-        av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %i\n",
-               s->max_num_subframes);
-        return AVERROR_INVALIDDATA;
-    }
-
-    s->num_channels = avctx->channels;
-
-    /** extract lfe channel position */
-    s->lfe_channel = -1;
-
-    if (channel_mask & 8) {
-        unsigned int mask;
-        for (mask = 1; mask < 16; mask <<= 1) {
-            if (channel_mask & mask)
-                ++s->lfe_channel;
-        }
-    }
-
-    if (s->num_channels < 0) {
-        av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", s->num_channels);
-        return AVERROR_INVALIDDATA;
-    } else if (s->num_channels > WMAPRO_MAX_CHANNELS) {
-        av_log_ask_for_sample(avctx, "unsupported number of channels\n");
-        return AVERROR_PATCHWELCOME;
-    }
-
-    INIT_VLC_STATIC(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE,
-                    scale_huffbits, 1, 1,
-                    scale_huffcodes, 2, 2, 616);
-
-    INIT_VLC_STATIC(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE,
-                    scale_rl_huffbits, 1, 1,
-                    scale_rl_huffcodes, 4, 4, 1406);
-
-    INIT_VLC_STATIC(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE,
-                    coef0_huffbits, 1, 1,
-                    coef0_huffcodes, 4, 4, 2108);
-
-    INIT_VLC_STATIC(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE,
-                    coef1_huffbits, 1, 1,
-                    coef1_huffcodes, 4, 4, 3912);
-
-    INIT_VLC_STATIC(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE,
-                    vec4_huffbits, 1, 1,
-                    vec4_huffcodes, 2, 2, 604);
-
-    INIT_VLC_STATIC(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE,
-                    vec2_huffbits, 1, 1,
-                    vec2_huffcodes, 2, 2, 562);
-
-    INIT_VLC_STATIC(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE,
-                    vec1_huffbits, 1, 1,
-                    vec1_huffcodes, 2, 2, 562);
-
-    /** calculate number of scale factor bands and their offsets
-        for every possible block size */
-    for (i = 0; i < num_possible_block_sizes; i++) {
-        int subframe_len = s->samples_per_frame >> i;
-        int x;
-        int band = 1;
-
-        s->sfb_offsets[i][0] = 0;
-
-        for (x = 0; x < MAX_BANDS-1 && s->sfb_offsets[i][band - 1] < subframe_len; x++) {
-            int offset = (subframe_len * 2 * critical_freq[x])
-                          / s->avctx->sample_rate + 2;
-            offset &= ~3;
-            if (offset > s->sfb_offsets[i][band - 1])
-                s->sfb_offsets[i][band++] = offset;
-        }
-        s->sfb_offsets[i][band - 1] = subframe_len;
-        s->num_sfb[i]               = band - 1;
-    }
-
-
-    /** Scale factors can be shared between blocks of different size
-        as every block has a different scale factor band layout.
-        The matrix sf_offsets is needed to find the correct scale factor.
-     */
-
-    for (i = 0; i < num_possible_block_sizes; i++) {
-        int b;
-        for (b = 0; b < s->num_sfb[i]; b++) {
-            int x;
-            int offset = ((s->sfb_offsets[i][b]
-                           + s->sfb_offsets[i][b + 1] - 1) << i) >> 1;
-            for (x = 0; x < num_possible_block_sizes; x++) {
-                int v = 0;
-                while (s->sfb_offsets[x][v + 1] << x < offset)
-                    ++v;
-                s->sf_offsets[i][x][b] = v;
-            }
-        }
-    }
-
-    /** init MDCT, FIXME: only init needed sizes */
-    for (i = 0; i < WMAPRO_BLOCK_SIZES; i++)
-        ff_mdct_init(&s->mdct_ctx[i], BLOCK_MIN_BITS+1+i, 1,
-                     1.0 / (1 << (BLOCK_MIN_BITS + i - 1))
-                     / (1 << (s->bits_per_sample - 1)));
-
-    /** init MDCT windows: simple sinus window */
-    for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) {
-        const int win_idx = WMAPRO_BLOCK_MAX_BITS - i;
-        ff_init_ff_sine_windows(win_idx);
-        s->windows[WMAPRO_BLOCK_SIZES - i - 1] = ff_sine_windows[win_idx];
-    }
-
-    /** calculate subwoofer cutoff values */
-    for (i = 0; i < num_possible_block_sizes; i++) {
-        int block_size = s->samples_per_frame >> i;
-        int cutoff = (440*block_size + 3 * (s->avctx->sample_rate >> 1) - 1)
-                     / s->avctx->sample_rate;
-        s->subwoofer_cutoffs[i] = av_clip(cutoff, 4, block_size);
-    }
-
-    /** calculate sine values for the decorrelation matrix */
-    for (i = 0; i < 33; i++)
-        sin64[i] = sin(i*M_PI / 64.0);
-
-    if (avctx->debug & FF_DEBUG_BITSTREAM)
-        dump_context(s);
-
-    avctx->channel_layout = channel_mask;
-    return 0;
-}
-
-/**
- *@brief Decode the subframe length.
- *@param s context
- *@param offset sample offset in the frame
- *@return decoded subframe length on success, < 0 in case of an error
- */
-static int decode_subframe_length(WMAProDecodeCtx *s, int offset)
-{
-    int frame_len_shift = 0;
-    int subframe_len;
-
-    /** no need to read from the bitstream when only one length is possible */
-    if (offset == s->samples_per_frame - s->min_samples_per_subframe)
-        return s->min_samples_per_subframe;
-
-    /** 1 bit indicates if the subframe is of maximum length */
-    if (s->max_subframe_len_bit) {
-        if (get_bits1(&s->gb))
-            frame_len_shift = 1 + get_bits(&s->gb, s->subframe_len_bits-1);
-    } else
-        frame_len_shift = get_bits(&s->gb, s->subframe_len_bits);
-
-    subframe_len = s->samples_per_frame >> frame_len_shift;
-
-    /** sanity check the length */
-    if (subframe_len < s->min_samples_per_subframe ||
-        subframe_len > s->samples_per_frame) {
-        av_log(s->avctx, AV_LOG_ERROR, "broken frame: subframe_len %i\n",
-               subframe_len);
-        return AVERROR_INVALIDDATA;
-    }
-    return subframe_len;
-}
-
-/**
- *@brief Decode how the data in the frame is split into subframes.
- *       Every WMA frame contains the encoded data for a fixed number of
- *       samples per channel. The data for every channel might be split
- *       into several subframes. This function will reconstruct the list of
- *       subframes for every channel.
- *
- *       If the subframes are not evenly split, the algorithm estimates the
- *       channels with the lowest number of total samples.
- *       Afterwards, for each of these channels a bit is read from the
- *       bitstream that indicates if the channel contains a subframe with the
- *       next subframe size that is going to be read from the bitstream or not.
- *       If a channel contains such a subframe, the subframe size gets added to
- *       the channel's subframe list.
- *       The algorithm repeats these steps until the frame is properly divided
- *       between the individual channels.
- *
- *@param s context
- *@return 0 on success, < 0 in case of an error
- */
-static int decode_tilehdr(WMAProDecodeCtx *s)
-{
-    uint16_t num_samples[WMAPRO_MAX_CHANNELS];        /** sum of samples for all currently known subframes of a channel */
-    uint8_t  contains_subframe[WMAPRO_MAX_CHANNELS];  /** flag indicating if a channel contains the current subframe */
-    int channels_for_cur_subframe = s->num_channels;  /** number of channels that contain the current subframe */
-    int fixed_channel_layout = 0;                     /** flag indicating that all channels use the same subframe offsets and sizes */
-    int min_channel_len = 0;                          /** smallest sum of samples (channels with this length will be processed first) */
-    int c;
-
-    /* Should never consume more than 3073 bits (256 iterations for the
-     * while loop when always the minimum amount of 128 samples is substracted
-     * from missing samples in the 8 channel case).
-     * 1 + BLOCK_MAX_SIZE * MAX_CHANNELS / BLOCK_MIN_SIZE * (MAX_CHANNELS  + 4)
-     */
-
-    /** reset tiling information */
-    for (c = 0; c < s->num_channels; c++)
-        s->channel[c].num_subframes = 0;
-
-    memset(num_samples, 0, sizeof(num_samples));
-
-    if (s->max_num_subframes == 1 || get_bits1(&s->gb))
-        fixed_channel_layout = 1;
-
-    /** loop until the frame data is split between the subframes */
-    do {
-        int subframe_len;
-
-        /** check which channels contain the subframe */
-        for (c = 0; c < s->num_channels; c++) {
-            if (num_samples[c] == min_channel_len) {
-                if (fixed_channel_layout || channels_for_cur_subframe == 1 ||
-                   (min_channel_len == s->samples_per_frame - s->min_samples_per_subframe))
-                    contains_subframe[c] = 1;
-                else
-                    contains_subframe[c] = get_bits1(&s->gb);
-            } else
-                contains_subframe[c] = 0;
-        }
-
-        /** get subframe length, subframe_len == 0 is not allowed */
-        if ((subframe_len = decode_subframe_length(s, min_channel_len)) <= 0)
-            return AVERROR_INVALIDDATA;
-
-        /** add subframes to the individual channels and find new min_channel_len */
-        min_channel_len += subframe_len;
-        for (c = 0; c < s->num_channels; c++) {
-            WMAProChannelCtx* chan = &s->channel[c];
-
-            if (contains_subframe[c]) {
-                if (chan->num_subframes >= MAX_SUBFRAMES) {
-                    av_log(s->avctx, AV_LOG_ERROR,
-                           "broken frame: num subframes > 31\n");
-                    return AVERROR_INVALIDDATA;
-                }
-                chan->subframe_len[chan->num_subframes] = subframe_len;
-                num_samples[c] += subframe_len;
-                ++chan->num_subframes;
-                if (num_samples[c] > s->samples_per_frame) {
-                    av_log(s->avctx, AV_LOG_ERROR, "broken frame: "
-                           "channel len > samples_per_frame\n");
-                    return AVERROR_INVALIDDATA;
-                }
-            } else if (num_samples[c] <= min_channel_len) {
-                if (num_samples[c] < min_channel_len) {
-                    channels_for_cur_subframe = 0;
-                    min_channel_len = num_samples[c];
-                }
-                ++channels_for_cur_subframe;
-            }
-        }
-    } while (min_channel_len < s->samples_per_frame);
-
-    for (c = 0; c < s->num_channels; c++) {
-        int i;
-        int offset = 0;
-        for (i = 0; i < s->channel[c].num_subframes; i++) {
-            dprintf(s->avctx, "frame[%i] channel[%i] subframe[%i]"
-                    " len %i\n", s->frame_num, c, i,
-                    s->channel[c].subframe_len[i]);
-            s->channel[c].subframe_offset[i] = offset;
-            offset += s->channel[c].subframe_len[i];
-        }
-    }
-
-    return 0;
-}
-
-/**
- *@brief Calculate a decorrelation matrix from the bitstream parameters.
- *@param s codec context
- *@param chgroup channel group for which the matrix needs to be calculated
- */
-static void decode_decorrelation_matrix(WMAProDecodeCtx *s,
-                                        WMAProChannelGrp *chgroup)
-{
-    int i;
-    int offset = 0;
-    int8_t rotation_offset[WMAPRO_MAX_CHANNELS * WMAPRO_MAX_CHANNELS];
-    memset(chgroup->decorrelation_matrix, 0, s->num_channels *
-           s->num_channels * sizeof(*chgroup->decorrelation_matrix));
-
-    for (i = 0; i < chgroup->num_channels * (chgroup->num_channels - 1) >> 1; i++)
-        rotation_offset[i] = get_bits(&s->gb, 6);
-
-    for (i = 0; i < chgroup->num_channels; i++)
-        chgroup->decorrelation_matrix[chgroup->num_channels * i + i] =
-            get_bits1(&s->gb) ? 1.0 : -1.0;
-
-    for (i = 1; i < chgroup->num_channels; i++) {
-        int x;
-        for (x = 0; x < i; x++) {
-            int y;
-            for (y = 0; y < i + 1; y++) {
-                float v1 = chgroup->decorrelation_matrix[x * chgroup->num_channels + y];
-                float v2 = chgroup->decorrelation_matrix[i * chgroup->num_channels + y];
-                int n = rotation_offset[offset + x];
-                float sinv;
-                float cosv;
-
-                if (n < 32) {
-                    sinv = sin64[n];
-                    cosv = sin64[32 - n];
-                } else {
-                    sinv =  sin64[64 -  n];
-                    cosv = -sin64[n  - 32];
-                }
-
-                chgroup->decorrelation_matrix[y + x * chgroup->num_channels] =
-                                               (v1 * sinv) - (v2 * cosv);
-                chgroup->decorrelation_matrix[y + i * chgroup->num_channels] =
-                                               (v1 * cosv) + (v2 * sinv);
-            }
-        }
-        offset += i;
-    }
-}
-
-/**
- *@brief Decode channel transformation parameters
- *@param s codec context
- *@return 0 in case of success, < 0 in case of bitstream errors
- */
-static int decode_channel_transform(WMAProDecodeCtx* s)
-{
-    int i;
-    /* should never consume more than 1921 bits for the 8 channel case
-     * 1 + MAX_CHANNELS * (MAX_CHANNELS + 2 + 3 * MAX_CHANNELS * MAX_CHANNELS
-     * + MAX_CHANNELS + MAX_BANDS + 1)
-     */
-
-    /** in the one channel case channel transforms are pointless */
-    s->num_chgroups = 0;
-    if (s->num_channels > 1) {
-        int remaining_channels = s->channels_for_cur_subframe;
-
-        if (get_bits1(&s->gb)) {
-            av_log_ask_for_sample(s->avctx,
-                                  "unsupported channel transform bit\n");
-            return AVERROR_INVALIDDATA;
-        }
-
-        for (s->num_chgroups = 0; remaining_channels &&
-             s->num_chgroups < s->channels_for_cur_subframe; s->num_chgroups++) {
-            WMAProChannelGrp* chgroup = &s->chgroup[s->num_chgroups];
-            float** channel_data = chgroup->channel_data;
-            chgroup->num_channels = 0;
-            chgroup->transform = 0;
-
-            /** decode channel mask */
-            if (remaining_channels > 2) {
-                for (i = 0; i < s->channels_for_cur_subframe; i++) {
-                    int channel_idx = s->channel_indexes_for_cur_subframe[i];
-                    if (!s->channel[channel_idx].grouped
-                        && get_bits1(&s->gb)) {
-                        ++chgroup->num_channels;
-                        s->channel[channel_idx].grouped = 1;
-                        *channel_data++ = s->channel[channel_idx].coeffs;
-                    }
-                }
-            } else {
-                chgroup->num_channels = remaining_channels;
-                for (i = 0; i < s->channels_for_cur_subframe; i++) {
-                    int channel_idx = s->channel_indexes_for_cur_subframe[i];
-                    if (!s->channel[channel_idx].grouped)
-                        *channel_data++ = s->channel[channel_idx].coeffs;
-                    s->channel[channel_idx].grouped = 1;
-                }
-            }
-
-            /** decode transform type */
-            if (chgroup->num_channels == 2) {
-                if (get_bits1(&s->gb)) {
-                    if (get_bits1(&s->gb)) {
-                        av_log_ask_for_sample(s->avctx,
-                                              "unsupported channel transform type\n");
-                    }
-                } else {
-                    chgroup->transform = 1;
-                    if (s->num_channels == 2) {
-                        chgroup->decorrelation_matrix[0] =  1.0;
-                        chgroup->decorrelation_matrix[1] = -1.0;
-                        chgroup->decorrelation_matrix[2] =  1.0;
-                        chgroup->decorrelation_matrix[3] =  1.0;
-                    } else {
-                        /** cos(pi/4) */
-                        chgroup->decorrelation_matrix[0] =  0.70703125;
-                        chgroup->decorrelation_matrix[1] = -0.70703125;
-                        chgroup->decorrelation_matrix[2] =  0.70703125;
-                        chgroup->decorrelation_matrix[3] =  0.70703125;
-                    }
-                }
-            } else if (chgroup->num_channels > 2) {
-                if (get_bits1(&s->gb)) {
-                    chgroup->transform = 1;
-                    if (get_bits1(&s->gb)) {
-                        decode_decorrelation_matrix(s, chgroup);
-                    } else {
-                        /** FIXME: more than 6 coupled channels not supported */
-                        if (chgroup->num_channels > 6) {
-                            av_log_ask_for_sample(s->avctx,
-                                                  "coupled channels > 6\n");
-                        } else {
-                            memcpy(chgroup->decorrelation_matrix,
-                                   default_decorrelation[chgroup->num_channels],
-                                   chgroup->num_channels * chgroup->num_channels *
-                                   sizeof(*chgroup->decorrelation_matrix));
-                        }
-                    }
-                }
-            }
-
-            /** decode transform on / off */
-            if (chgroup->transform) {
-                if (!get_bits1(&s->gb)) {
-                    int i;
-                    /** transform can be enabled for individual bands */
-                    for (i = 0; i < s->num_bands; i++) {
-                        chgroup->transform_band[i] = get_bits1(&s->gb);
-                    }
-                } else {
-                    memset(chgroup->transform_band, 1, s->num_bands);
-                }
-            }
-            remaining_channels -= chgroup->num_channels;
-        }
-    }
-    return 0;
-}
-
-/**
- *@brief Extract the coefficients from the bitstream.
- *@param s codec context
- *@param c current channel number
- *@return 0 on success, < 0 in case of bitstream errors
- */
-static int decode_coeffs(WMAProDecodeCtx *s, int c)
-{
-    /* Integers 0..15 as single-precision floats.  The table saves a
-       costly int to float conversion, and storing the values as
-       integers allows fast sign-flipping. */
-    static const int fval_tab[16] = {
-        0x00000000, 0x3f800000, 0x40000000, 0x40400000,
-        0x40800000, 0x40a00000, 0x40c00000, 0x40e00000,
-        0x41000000, 0x41100000, 0x41200000, 0x41300000,
-        0x41400000, 0x41500000, 0x41600000, 0x41700000,
-    };
-    int vlctable;
-    VLC* vlc;
-    WMAProChannelCtx* ci = &s->channel[c];
-    int rl_mode = 0;
-    int cur_coeff = 0;
-    int num_zeros = 0;
-    const uint16_t* run;
-    const float* level;
-
-    dprintf(s->avctx, "decode coefficients for channel %i\n", c);
-
-    vlctable = get_bits1(&s->gb);
-    vlc = &coef_vlc[vlctable];
-
-    if (vlctable) {
-        run = coef1_run;
-        level = coef1_level;
-    } else {
-        run = coef0_run;
-        level = coef0_level;
-    }
-
-    /** decode vector coefficients (consumes up to 167 bits per iteration for
-      4 vector coded large values) */
-    while (!rl_mode && cur_coeff + 3 < s->subframe_len) {
-        int vals[4];
-        int i;
-        unsigned int idx;
-
-        idx = get_vlc2(&s->gb, vec4_vlc.table, VLCBITS, VEC4MAXDEPTH);
-
-        if (idx == HUFF_VEC4_SIZE - 1) {
-            for (i = 0; i < 4; i += 2) {
-                idx = get_vlc2(&s->gb, vec2_vlc.table, VLCBITS, VEC2MAXDEPTH);
-                if (idx == HUFF_VEC2_SIZE - 1) {
-                    int v0, v1;
-                    v0 = get_vlc2(&s->gb, vec1_vlc.table, VLCBITS, VEC1MAXDEPTH);
-                    if (v0 == HUFF_VEC1_SIZE - 1)
-                        v0 += ff_wma_get_large_val(&s->gb);
-                    v1 = get_vlc2(&s->gb, vec1_vlc.table, VLCBITS, VEC1MAXDEPTH);
-                    if (v1 == HUFF_VEC1_SIZE - 1)
-                        v1 += ff_wma_get_large_val(&s->gb);
-                    ((float*)vals)[i  ] = v0;
-                    ((float*)vals)[i+1] = v1;
-                } else {
-                    vals[i]   = fval_tab[symbol_to_vec2[idx] >> 4 ];
-                    vals[i+1] = fval_tab[symbol_to_vec2[idx] & 0xF];
-                }
-            }
-        } else {
-            vals[0] = fval_tab[ symbol_to_vec4[idx] >> 12      ];
-            vals[1] = fval_tab[(symbol_to_vec4[idx] >> 8) & 0xF];
-            vals[2] = fval_tab[(symbol_to_vec4[idx] >> 4) & 0xF];
-            vals[3] = fval_tab[ symbol_to_vec4[idx]       & 0xF];
-        }
-
-        /** decode sign */
-        for (i = 0; i < 4; i++) {
-            if (vals[i]) {
-                int sign = get_bits1(&s->gb) - 1;
-                *(uint32_t*)&ci->coeffs[cur_coeff] = vals[i] ^ sign<<31;
-                num_zeros = 0;
-            } else {
-                ci->coeffs[cur_coeff] = 0;
-                /** switch to run level mode when subframe_len / 128 zeros
-                    were found in a row */
-                rl_mode |= (++num_zeros > s->subframe_len >> 8);
-            }
-            ++cur_coeff;
-        }
-    }
-
-    /** decode run level coded coefficients */
-    if (rl_mode) {
-        memset(&ci->coeffs[cur_coeff], 0,
-               sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff));
-        if (ff_wma_run_level_decode(s->avctx, &s->gb, vlc,
-                                    level, run, 1, ci->coeffs,
-                                    cur_coeff, s->subframe_len,
-                                    s->subframe_len, s->esc_len, 0))
-            return AVERROR_INVALIDDATA;
-    }
-
-    return 0;
-}
-
-/**
- *@brief Extract scale factors from the bitstream.
- *@param s codec context
- *@return 0 on success, < 0 in case of bitstream errors
- */
-static int decode_scale_factors(WMAProDecodeCtx* s)
-{
-    int i;
-
-    /** should never consume more than 5344 bits
-     *  MAX_CHANNELS * (1 +  MAX_BANDS * 23)
-     */
-
-    for (i = 0; i < s->channels_for_cur_subframe; i++) {
-        int c = s->channel_indexes_for_cur_subframe[i];
-        int* sf;
-        int* sf_end;
-        s->channel[c].scale_factors = s->channel[c].saved_scale_factors[!s->channel[c].scale_factor_idx];
-        sf_end = s->channel[c].scale_factors + s->num_bands;
-
-        /** resample scale factors for the new block size
-         *  as the scale factors might need to be resampled several times
-         *  before some  new values are transmitted, a backup of the last
-         *  transmitted scale factors is kept in saved_scale_factors
-         */
-        if (s->channel[c].reuse_sf) {
-            const int8_t* sf_offsets = s->sf_offsets[s->table_idx][s->channel[c].table_idx];
-            int b;
-            for (b = 0; b < s->num_bands; b++)
-                s->channel[c].scale_factors[b] =
-                    s->channel[c].saved_scale_factors[s->channel[c].scale_factor_idx][*sf_offsets++];
-        }
-
-        if (!s->channel[c].cur_subframe || get_bits1(&s->gb)) {
-
-            if (!s->channel[c].reuse_sf) {
-                int val;
-                /** decode DPCM coded scale factors */
-                s->channel[c].scale_factor_step = get_bits(&s->gb, 2) + 1;
-                val = 45 / s->channel[c].scale_factor_step;
-                for (sf = s->channel[c].scale_factors; sf < sf_end; sf++) {
-                    val += get_vlc2(&s->gb, sf_vlc.table, SCALEVLCBITS, SCALEMAXDEPTH) - 60;
-                    *sf = val;
-                }
-            } else {
-                int i;
-                /** run level decode differences to the resampled factors */
-                for (i = 0; i < s->num_bands; i++) {
-                    int idx;
-                    int skip;
-                    int val;
-                    int sign;
-
-                    idx = get_vlc2(&s->gb, sf_rl_vlc.table, VLCBITS, SCALERLMAXDEPTH);
-
-                    if (!idx) {
-                        uint32_t code = get_bits(&s->gb, 14);
-                        val  =  code >> 6;
-                        sign = (code & 1) - 1;
-                        skip = (code & 0x3f) >> 1;
-                    } else if (idx == 1) {
-                        break;
-                    } else {
-                        skip = scale_rl_run[idx];
-                        val  = scale_rl_level[idx];
-                        sign = get_bits1(&s->gb)-1;
-                    }
-
-                    i += skip;
-                    if (i >= s->num_bands) {
-                        av_log(s->avctx, AV_LOG_ERROR,
-                               "invalid scale factor coding\n");
-                        return AVERROR_INVALIDDATA;
-                    }
-                    s->channel[c].scale_factors[i] += (val ^ sign) - sign;
-                }
-            }
-            /** swap buffers */
-            s->channel[c].scale_factor_idx = !s->channel[c].scale_factor_idx;
-            s->channel[c].table_idx = s->table_idx;
-            s->channel[c].reuse_sf  = 1;
-        }
-
-        /** calculate new scale factor maximum */
-        s->channel[c].max_scale_factor = s->channel[c].scale_factors[0];
-        for (sf = s->channel[c].scale_factors + 1; sf < sf_end; sf++) {
-            s->channel[c].max_scale_factor =
-                FFMAX(s->channel[c].max_scale_factor, *sf);
-        }
-
-    }
-    return 0;
-}
-
-/**
- *@brief Reconstruct the individual channel data.
- *@param s codec context
- */
-static void inverse_channel_transform(WMAProDecodeCtx *s)
-{
-    int i;
-
-    for (i = 0; i < s->num_chgroups; i++) {
-        if (s->chgroup[i].transform) {
-            float data[WMAPRO_MAX_CHANNELS];
-            const int num_channels = s->chgroup[i].num_channels;
-            float** ch_data = s->chgroup[i].channel_data;
-            float** ch_end = ch_data + num_channels;
-            const int8_t* tb = s->chgroup[i].transform_band;
-            int16_t* sfb;
-
-            /** multichannel decorrelation */
-            for (sfb = s->cur_sfb_offsets;
-                 sfb < s->cur_sfb_offsets + s->num_bands; sfb++) {
-                int y;
-                if (*tb++ == 1) {
-                    /** multiply values with the decorrelation_matrix */
-                    for (y = sfb[0]; y < FFMIN(sfb[1], s->subframe_len); y++) {
-                        const float* mat = s->chgroup[i].decorrelation_matrix;
-                        const float* data_end = data + num_channels;
-                        float* data_ptr = data;
-                        float** ch;
-
-                        for (ch = ch_data; ch < ch_end; ch++)
-                            *data_ptr++ = (*ch)[y];
-
-                        for (ch = ch_data; ch < ch_end; ch++) {
-                            float sum = 0;
-                            data_ptr = data;
-                            while (data_ptr < data_end)
-                                sum += *data_ptr++ * *mat++;
-
-                            (*ch)[y] = sum;
-                        }
-                    }
-                } else if (s->num_channels == 2) {
-                    int len = FFMIN(sfb[1], s->subframe_len) - sfb[0];
-                    s->dsp.vector_fmul_scalar(ch_data[0] + sfb[0],
-                                              ch_data[0] + sfb[0],
-                                              181.0 / 128, len);
-                    s->dsp.vector_fmul_scalar(ch_data[1] + sfb[0],
-                                              ch_data[1] + sfb[0],
-                                              181.0 / 128, len);
-                }
-            }
-        }
-    }
-}
-
-/**
- *@brief Apply sine window and reconstruct the output buffer.
- *@param s codec context
- */
-static void wmapro_window(WMAProDecodeCtx *s)
-{
-    int i;
-    for (i = 0; i < s->channels_for_cur_subframe; i++) {
-        int c = s->channel_indexes_for_cur_subframe[i];
-        float* window;
-        int winlen = s->channel[c].prev_block_len;
-        float* start = s->channel[c].coeffs - (winlen >> 1);
-
-        if (s->subframe_len < winlen) {
-            start += (winlen - s->subframe_len) >> 1;
-            winlen = s->subframe_len;
-        }
-
-        window = s->windows[av_log2(winlen) - BLOCK_MIN_BITS];
-
-        winlen >>= 1;
-
-        s->dsp.vector_fmul_window(start, start, start + winlen,
-                                  window, 0, winlen);
-
-        s->channel[c].prev_block_len = s->subframe_len;
-    }
-}
-
-/**
- *@brief Decode a single subframe (block).
- *@param s codec context
- *@return 0 on success, < 0 when decoding failed
- */
-static int decode_subframe(WMAProDecodeCtx *s)
-{
-    int offset = s->samples_per_frame;
-    int subframe_len = s->samples_per_frame;
-    int i;
-    int total_samples   = s->samples_per_frame * s->num_channels;
-    int transmit_coeffs = 0;
-    int cur_subwoofer_cutoff;
-
-    s->subframe_offset = get_bits_count(&s->gb);
-
-    /** reset channel context and find the next block offset and size
-        == the next block of the channel with the smallest number of
-        decoded samples
-    */
-    for (i = 0; i < s->num_channels; i++) {
-        s->channel[i].grouped = 0;
-        if (offset > s->channel[i].decoded_samples) {
-            offset = s->channel[i].decoded_samples;
-            subframe_len =
-                s->channel[i].subframe_len[s->channel[i].cur_subframe];
-        }
-    }
-
-    dprintf(s->avctx,
-            "processing subframe with offset %i len %i\n", offset, subframe_len);
-
-    /** get a list of all channels that contain the estimated block */
-    s->channels_for_cur_subframe = 0;
-    for (i = 0; i < s->num_channels; i++) {
-        const int cur_subframe = s->channel[i].cur_subframe;
-        /** substract already processed samples */
-        total_samples -= s->channel[i].decoded_samples;
-
-        /** and count if there are multiple subframes that match our profile */
-        if (offset == s->channel[i].decoded_samples &&
-            subframe_len == s->channel[i].subframe_len[cur_subframe]) {
-            total_samples -= s->channel[i].subframe_len[cur_subframe];
-            s->channel[i].decoded_samples +=
-                s->channel[i].subframe_len[cur_subframe];
-            s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i;
-            ++s->channels_for_cur_subframe;
-        }
-    }
-
-    /** check if the frame will be complete after processing the
-        estimated block */
-    if (!total_samples)
-        s->parsed_all_subframes = 1;
-
-
-    dprintf(s->avctx, "subframe is part of %i channels\n",
-            s->channels_for_cur_subframe);
-
-    /** calculate number of scale factor bands and their offsets */
-    s->table_idx         = av_log2(s->samples_per_frame/subframe_len);
-    s->num_bands         = s->num_sfb[s->table_idx];
-    s->cur_sfb_offsets   = s->sfb_offsets[s->table_idx];
-    cur_subwoofer_cutoff = s->subwoofer_cutoffs[s->table_idx];
-
-    /** configure the decoder for the current subframe */
-    for (i = 0; i < s->channels_for_cur_subframe; i++) {
-        int c = s->channel_indexes_for_cur_subframe[i];
-
-        s->channel[c].coeffs = &s->channel[c].out[(s->samples_per_frame >> 1)
-                                                  + offset];
-    }
-
-    s->subframe_len = subframe_len;
-    s->esc_len = av_log2(s->subframe_len - 1) + 1;
-
-    /** skip extended header if any */
-    if (get_bits1(&s->gb)) {
-        int num_fill_bits;
-        if (!(num_fill_bits = get_bits(&s->gb, 2))) {
-            int len = get_bits(&s->gb, 4);
-            num_fill_bits = get_bits(&s->gb, len) + 1;
-        }
-
-        if (num_fill_bits >= 0) {
-            if (get_bits_count(&s->gb) + num_fill_bits > s->num_saved_bits) {
-                av_log(s->avctx, AV_LOG_ERROR, "invalid number of fill bits\n");
-                return AVERROR_INVALIDDATA;
-            }
-
-            skip_bits_long(&s->gb, num_fill_bits);
-        }
-    }
-
-    /** no idea for what the following bit is used */
-    if (get_bits1(&s->gb)) {
-        av_log_ask_for_sample(s->avctx, "reserved bit set\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-
-    if (decode_channel_transform(s) < 0)
-        return AVERROR_INVALIDDATA;
-
-
-    for (i = 0; i < s->channels_for_cur_subframe; i++) {
-        int c = s->channel_indexes_for_cur_subframe[i];
-        if ((s->channel[c].transmit_coefs = get_bits1(&s->gb)))
-            transmit_coeffs = 1;
-    }
-
-    if (transmit_coeffs) {
-        int step;
-        int quant_step = 90 * s->bits_per_sample >> 4;
-        if ((get_bits1(&s->gb))) {
-            /** FIXME: might change run level mode decision */
-            av_log_ask_for_sample(s->avctx, "unsupported quant step coding\n");
-            return AVERROR_INVALIDDATA;
-        }
-        /** decode quantization step */
-        step = get_sbits(&s->gb, 6);
-        quant_step += step;
-        if (step == -32 || step == 31) {
-            const int sign = (step == 31) - 1;
-            int quant = 0;
-            while (get_bits_count(&s->gb) + 5 < s->num_saved_bits &&
-                   (step = get_bits(&s->gb, 5)) == 31) {
-                quant += 31;
-            }
-            quant_step += ((quant + step) ^ sign) - sign;
-        }
-        if (quant_step < 0) {
-            av_log(s->avctx, AV_LOG_DEBUG, "negative quant step\n");
-        }
-
-        /** decode quantization step modifiers for every channel */
-
-        if (s->channels_for_cur_subframe == 1) {
-            s->channel[s->channel_indexes_for_cur_subframe[0]].quant_step = quant_step;
-        } else {
-            int modifier_len = get_bits(&s->gb, 3);
-            for (i = 0; i < s->channels_for_cur_subframe; i++) {
-                int c = s->channel_indexes_for_cur_subframe[i];
-                s->channel[c].quant_step = quant_step;
-                if (get_bits1(&s->gb)) {
-                    if (modifier_len) {
-                        s->channel[c].quant_step += get_bits(&s->gb, modifier_len) + 1;
-                    } else
-                        ++s->channel[c].quant_step;
-                }
-            }
-        }
-
-        /** decode scale factors */
-        if (decode_scale_factors(s) < 0)
-            return AVERROR_INVALIDDATA;
-    }
-
-    dprintf(s->avctx, "BITSTREAM: subframe header length was %i\n",
-            get_bits_count(&s->gb) - s->subframe_offset);
-
-    /** parse coefficients */
-    for (i = 0; i < s->channels_for_cur_subframe; i++) {
-        int c = s->channel_indexes_for_cur_subframe[i];
-        if (s->channel[c].transmit_coefs &&
-            get_bits_count(&s->gb) < s->num_saved_bits) {
-            decode_coeffs(s, c);
-        } else
-            memset(s->channel[c].coeffs, 0,
-                   sizeof(*s->channel[c].coeffs) * subframe_len);
-    }
-
-    dprintf(s->avctx, "BITSTREAM: subframe length was %i\n",
-            get_bits_count(&s->gb) - s->subframe_offset);
-
-    if (transmit_coeffs) {
-        /** reconstruct the per channel data */
-        inverse_channel_transform(s);
-        for (i = 0; i < s->channels_for_cur_subframe; i++) {
-            int c = s->channel_indexes_for_cur_subframe[i];
-            const int* sf = s->channel[c].scale_factors;
-            int b;
-
-            if (c == s->lfe_channel)
-                memset(&s->tmp[cur_subwoofer_cutoff], 0, sizeof(*s->tmp) *
-                       (subframe_len - cur_subwoofer_cutoff));
-
-            /** inverse quantization and rescaling */
-            for (b = 0; b < s->num_bands; b++) {
-                const int end = FFMIN(s->cur_sfb_offsets[b+1], s->subframe_len);
-                const int exp = s->channel[c].quant_step -
-                            (s->channel[c].max_scale_factor - *sf++) *
-                            s->channel[c].scale_factor_step;
-                const float quant = pow(10.0, exp / 20.0);
-                int start = s->cur_sfb_offsets[b];
-                s->dsp.vector_fmul_scalar(s->tmp + start,
-                                          s->channel[c].coeffs + start,
-                                          quant, end - start);
-            }
-
-            /** apply imdct (ff_imdct_half == DCTIV with reverse) */
-            ff_imdct_half(&s->mdct_ctx[av_log2(subframe_len) - BLOCK_MIN_BITS],
-                          s->channel[c].coeffs, s->tmp);
-        }
-    }
-
-    /** window and overlapp-add */
-    wmapro_window(s);
-
-    /** handled one subframe */
-    for (i = 0; i < s->channels_for_cur_subframe; i++) {
-        int c = s->channel_indexes_for_cur_subframe[i];
-        if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) {
-            av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n");
-            return AVERROR_INVALIDDATA;
-        }
-        ++s->channel[c].cur_subframe;
-    }
-
-    return 0;
-}
-
-/**
- *@brief Decode one WMA frame.
- *@param s codec context
- *@return 0 if the trailer bit indicates that this is the last frame,
- *        1 if there are additional frames
- */
-static int decode_frame(WMAProDecodeCtx *s)
-{
-    GetBitContext* gb = &s->gb;
-    int more_frames = 0;
-    int len = 0;
-    int i;
-
-    /** check for potential output buffer overflow */
-    if (s->num_channels * s->samples_per_frame > s->samples_end - s->samples) {
-        /** return an error if no frame could be decoded at all */
-        av_log(s->avctx, AV_LOG_ERROR,
-               "not enough space for the output samples\n");
-        s->packet_loss = 1;
-        return 0;
-    }
-
-    /** get frame length */
-    if (s->len_prefix)
-        len = get_bits(gb, s->log2_frame_size);
-
-    dprintf(s->avctx, "decoding frame with length %x\n", len);
-
-    /** decode tile information */
-    if (decode_tilehdr(s)) {
-        s->packet_loss = 1;
-        return 0;
-    }
-
-    /** read postproc transform */
-    if (s->num_channels > 1 && get_bits1(gb)) {
-        av_log_ask_for_sample(s->avctx, "Unsupported postproc transform found\n");
-        s->packet_loss = 1;
-        return 0;
-    }
-
-    /** read drc info */
-    if (s->dynamic_range_compression) {
-        s->drc_gain = get_bits(gb, 8);
-        dprintf(s->avctx, "drc_gain %i\n", s->drc_gain);
-    }
-
-    /** no idea what these are for, might be the number of samples
-        that need to be skipped at the beginning or end of a stream */
-    if (get_bits1(gb)) {
-        int skip;
-
-        /** usually true for the first frame */
-        if (get_bits1(gb)) {
-            skip = get_bits(gb, av_log2(s->samples_per_frame * 2));
-            dprintf(s->avctx, "start skip: %i\n", skip);
-        }
-
-        /** sometimes true for the last frame */
-        if (get_bits1(gb)) {
-            skip = get_bits(gb, av_log2(s->samples_per_frame * 2));
-            dprintf(s->avctx, "end skip: %i\n", skip);
-        }
-
-    }
-
-    dprintf(s->avctx, "BITSTREAM: frame header length was %i\n",
-            get_bits_count(gb) - s->frame_offset);
-
-    /** reset subframe states */
-    s->parsed_all_subframes = 0;
-    for (i = 0; i < s->num_channels; i++) {
-        s->channel[i].decoded_samples = 0;
-        s->channel[i].cur_subframe    = 0;
-        s->channel[i].reuse_sf        = 0;
-    }
-
-    /** decode all subframes */
-    while (!s->parsed_all_subframes) {
-        if (decode_subframe(s) < 0) {
-            s->packet_loss = 1;
-            return 0;
-        }
-    }
-
-    /** interleave samples and write them to the output buffer */
-    for (i = 0; i < s->num_channels; i++) {
-        float* ptr  = s->samples + i;
-        int incr = s->num_channels;
-        float* iptr = s->channel[i].out;
-        float* iend = iptr + s->samples_per_frame;
-
-        // FIXME should create/use a DSP function here
-        while (iptr < iend) {
-            *ptr = *iptr++;
-            ptr += incr;
-        }
-
-        /** reuse second half of the IMDCT output for the next frame */
-        memcpy(&s->channel[i].out[0],
-               &s->channel[i].out[s->samples_per_frame],
-               s->samples_per_frame * sizeof(*s->channel[i].out) >> 1);
-    }
-
-    if (s->skip_frame) {
-        s->skip_frame = 0;
-    } else
-        s->samples += s->num_channels * s->samples_per_frame;
-
-    if (len != (get_bits_count(gb) - s->frame_offset) + 2) {
-        /** FIXME: not sure if this is always an error */
-        av_log(s->avctx, AV_LOG_ERROR, "frame[%i] would have to skip %i bits\n",
-               s->frame_num, len - (get_bits_count(gb) - s->frame_offset) - 1);
-        s->packet_loss = 1;
-        return 0;
-    }
-
-    /** skip the rest of the frame data */
-    skip_bits_long(gb, len - (get_bits_count(gb) - s->frame_offset) - 1);
-
-    /** decode trailer bit */
-    more_frames = get_bits1(gb);
-
-    ++s->frame_num;
-    return more_frames;
-}
-
-/**
- *@brief Calculate remaining input buffer length.
- *@param s codec context
- *@param gb bitstream reader context
- *@return remaining size in bits
- */
-static int remaining_bits(WMAProDecodeCtx *s, GetBitContext *gb)
-{
-    return s->buf_bit_size - get_bits_count(gb);
-}
-
-/**
- *@brief Fill the bit reservoir with a (partial) frame.
- *@param s codec context
- *@param gb bitstream reader context
- *@param len length of the partial frame
- *@param append decides wether to reset the buffer or not
- */
-static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len,
-                      int append)
-{
-    int buflen;
-
-    /** when the frame data does not need to be concatenated, the input buffer
-        is resetted and additional bits from the previous frame are copyed
-        and skipped later so that a fast byte copy is possible */
-
-    if (!append) {
-        s->frame_offset = get_bits_count(gb) & 7;
-        s->num_saved_bits = s->frame_offset;
-        init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
-    }
-
-    buflen = (s->num_saved_bits + len + 8) >> 3;
-
-    if (len <= 0 || buflen > MAX_FRAMESIZE) {
-        av_log_ask_for_sample(s->avctx, "input buffer too small\n");
-        s->packet_loss = 1;
-        return;
-    }
-
-    s->num_saved_bits += len;
-    if (!append) {
-        ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3),
-                     s->num_saved_bits);
-    } else {
-        int align = 8 - (get_bits_count(gb) & 7);
-        align = FFMIN(align, len);
-        put_bits(&s->pb, align, get_bits(gb, align));
-        len -= align;
-        ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len);
-    }
-    skip_bits_long(gb, len);
-
-    {
-        PutBitContext tmp = s->pb;
-        flush_put_bits(&tmp);
-    }
-
-    init_get_bits(&s->gb, s->frame_data, s->num_saved_bits);
-    skip_bits(&s->gb, s->frame_offset);
-}
-
-/**
- *@brief Decode a single WMA packet.
- *@param avctx codec context
- *@param data the output buffer
- *@param data_size number of bytes that were written to the output buffer
- *@param avpkt input packet
- *@return number of bytes that were read from the input buffer
- */
-static int decode_packet(AVCodecContext *avctx,
-                         void *data, int *data_size, AVPacket* avpkt)
-{
-    WMAProDecodeCtx *s = avctx->priv_data;
-    GetBitContext* gb  = &s->pgb;
-    const uint8_t* buf = avpkt->data;
-    int buf_size       = avpkt->size;
-    int num_bits_prev_frame;
-    int packet_sequence_number;
-
-    s->samples       = data;
-    s->samples_end   = (float*)((int8_t*)data + *data_size);
-    *data_size = 0;
-
-    if (s->packet_done || s->packet_loss) {
-        s->packet_done = 0;
-        s->buf_bit_size = buf_size << 3;
-
-        /** sanity check for the buffer length */
-        if (buf_size < avctx->block_align)
-            return 0;
-
-        buf_size = avctx->block_align;
-
-        /** parse packet header */
-        init_get_bits(gb, buf, s->buf_bit_size);
-        packet_sequence_number = get_bits(gb, 4);
-        skip_bits(gb, 2);
-
-        /** get number of bits that need to be added to the previous frame */
-        num_bits_prev_frame = get_bits(gb, s->log2_frame_size);
-        dprintf(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number,
-                num_bits_prev_frame);
-
-        /** check for packet loss */
-        if (!s->packet_loss &&
-            ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) {
-            s->packet_loss = 1;
-            av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n",
-                   s->packet_sequence_number, packet_sequence_number);
-        }
-        s->packet_sequence_number = packet_sequence_number;
-
-        if (num_bits_prev_frame > 0) {
-            /** append the previous frame data to the remaining data from the
-                previous packet to create a full frame */
-            save_bits(s, gb, num_bits_prev_frame, 1);
-            dprintf(avctx, "accumulated %x bits of frame data\n",
-                    s->num_saved_bits - s->frame_offset);
-
-            /** decode the cross packet frame if it is valid */
-            if (!s->packet_loss)
-                decode_frame(s);
-        } else if (s->num_saved_bits - s->frame_offset) {
-            dprintf(avctx, "ignoring %x previously saved bits\n",
-                    s->num_saved_bits - s->frame_offset);
-        }
-
-        s->packet_loss = 0;
-
-    } else {
-        int frame_size;
-        s->buf_bit_size = avpkt->size << 3;
-        init_get_bits(gb, avpkt->data, s->buf_bit_size);
-        skip_bits(gb, s->packet_offset);
-        if (remaining_bits(s, gb) > s->log2_frame_size &&
-            (frame_size = show_bits(gb, s->log2_frame_size)) &&
-            frame_size <= remaining_bits(s, gb)) {
-            save_bits(s, gb, frame_size, 0);
-            s->packet_done = !decode_frame(s);
-        } else
-            s->packet_done = 1;
-    }
-
-    if (s->packet_done && !s->packet_loss &&
-        remaining_bits(s, gb) > 0) {
-        /** save the rest of the data so that it can be decoded
-            with the next packet */
-        save_bits(s, gb, remaining_bits(s, gb), 0);
-    }
-
-    *data_size = (int8_t *)s->samples - (int8_t *)data;
-    s->packet_offset = get_bits_count(gb) & 7;
-
-    return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3;
-}
-
-/**
- *@brief Clear decoder buffers (for seeking).
- *@param avctx codec context
- */
-static void flush(AVCodecContext *avctx)
-{
-    WMAProDecodeCtx *s = avctx->priv_data;
-    int i;
-    /** reset output buffer as a part of it is used during the windowing of a
-        new frame */
-    for (i = 0; i < s->num_channels; i++)
-        memset(s->channel[i].out, 0, s->samples_per_frame *
-               sizeof(*s->channel[i].out));
-    s->packet_loss = 1;
-}
-
-
-/**
- *@brief wmapro decoder
- */
-AVCodec wmapro_decoder = {
-    "wmapro",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAPRO,
-    sizeof(WMAProDecodeCtx),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_packet,
-    .capabilities = CODEC_CAP_SUBFRAMES,
-    .flush= flush,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
-};
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
deleted file mode 100644
index 4ec17eb..0000000
--- a/libavcodec/wmavoice.c
+++ /dev/null
@@ -1,2030 +0,0 @@
-/*
- * Windows Media Audio Voice decoder.
- * Copyright (c) 2009 Ronald S. Bultje
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Windows Media Audio Voice compatible decoder
- * @author Ronald S. Bultje <rsbultje at gmail.com>
- */
-
-#include <math.h>
-#include "avcodec.h"
-#include "get_bits.h"
-#include "put_bits.h"
-#include "wmavoice_data.h"
-#include "celp_math.h"
-#include "celp_filters.h"
-#include "acelp_vectors.h"
-#include "acelp_filters.h"
-#include "lsp.h"
-#include "libavutil/lzo.h"
-#include "avfft.h"
-#include "fft.h"
-
-#define MAX_BLOCKS           8   ///< maximum number of blocks per frame
-#define MAX_LSPS             16  ///< maximum filter order
-#define MAX_LSPS_ALIGN16     16  ///< same as #MAX_LSPS; needs to be multiple
-                                 ///< of 16 for ASM input buffer alignment
-#define MAX_FRAMES           3   ///< maximum number of frames per superframe
-#define MAX_FRAMESIZE        160 ///< maximum number of samples per frame
-#define MAX_SIGNAL_HISTORY   416 ///< maximum excitation signal history
-#define MAX_SFRAMESIZE       (MAX_FRAMESIZE * MAX_FRAMES)
-                                 ///< maximum number of samples per superframe
-#define SFRAME_CACHE_MAXSIZE 256 ///< maximum cache size for frame data that
-                                 ///< was split over two packets
-#define VLC_NBITS            6   ///< number of bits to read per VLC iteration
-
-/**
- * Frame type VLC coding.
- */
-static VLC frame_type_vlc;
-
-/**
- * Adaptive codebook types.
- */
-enum {
-    ACB_TYPE_NONE       = 0, ///< no adaptive codebook (only hardcoded fixed)
-    ACB_TYPE_ASYMMETRIC = 1, ///< adaptive codebook with per-frame pitch, which
-                             ///< we interpolate to get a per-sample pitch.
-                             ///< Signal is generated using an asymmetric sinc
-                             ///< window function
-                             ///< @note see #wmavoice_ipol1_coeffs
-    ACB_TYPE_HAMMING    = 2  ///< Per-block pitch with signal generation using
-                             ///< a Hamming sinc window function
-                             ///< @note see #wmavoice_ipol2_coeffs
-};
-
-/**
- * Fixed codebook types.
- */
-enum {
-    FCB_TYPE_SILENCE    = 0, ///< comfort noise during silence
-                             ///< generated from a hardcoded (fixed) codebook
-                             ///< with per-frame (low) gain values
-    FCB_TYPE_HARDCODED  = 1, ///< hardcoded (fixed) codebook with per-block
-                             ///< gain values
-    FCB_TYPE_AW_PULSES  = 2, ///< Pitch-adaptive window (AW) pulse signals,
-                             ///< used in particular for low-bitrate streams
-    FCB_TYPE_EXC_PULSES = 3, ///< Innovation (fixed) codebook pulse sets in
-                             ///< combinations of either single pulses or
-                             ///< pulse pairs
-};
-
-/**
- * Description of frame types.
- */
-static const struct frame_type_desc {
-    uint8_t n_blocks;     ///< amount of blocks per frame (each block
-                          ///< (contains 160/#n_blocks samples)
-    uint8_t log_n_blocks; ///< log2(#n_blocks)
-    uint8_t acb_type;     ///< Adaptive codebook type (ACB_TYPE_*)
-    uint8_t fcb_type;     ///< Fixed codebook type (FCB_TYPE_*)
-    uint8_t dbl_pulses;   ///< how many pulse vectors have pulse pairs
-                          ///< (rather than just one single pulse)
-                          ///< only if #fcb_type == #FCB_TYPE_EXC_PULSES
-    uint16_t frame_size;  ///< the amount of bits that make up the block
-                          ///< data (per frame)
-} frame_descs[17] = {
-    { 1, 0, ACB_TYPE_NONE,       FCB_TYPE_SILENCE,    0,   0 },
-    { 2, 1, ACB_TYPE_NONE,       FCB_TYPE_HARDCODED,  0,  28 },
-    { 2, 1, ACB_TYPE_ASYMMETRIC, FCB_TYPE_AW_PULSES,  0,  46 },
-    { 2, 1, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 2,  80 },
-    { 2, 1, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 5, 104 },
-    { 4, 2, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 0, 108 },
-    { 4, 2, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 2, 132 },
-    { 4, 2, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 5, 168 },
-    { 2, 1, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 0,  64 },
-    { 2, 1, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 2,  80 },
-    { 2, 1, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 5, 104 },
-    { 4, 2, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 0, 108 },
-    { 4, 2, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 2, 132 },
-    { 4, 2, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 5, 168 },
-    { 8, 3, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 0, 176 },
-    { 8, 3, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 2, 208 },
-    { 8, 3, ACB_TYPE_HAMMING,    FCB_TYPE_EXC_PULSES, 5, 256 }
-};
-
-/**
- * WMA Voice decoding context.
- */
-typedef struct {
-    /**
-     * @defgroup struct_global Global values
-     * Global values, specified in the stream header / extradata or used
-     * all over.
-     * @{
-     */
-    GetBitContext gb;             ///< packet bitreader. During decoder init,
-                                  ///< it contains the extradata from the
-                                  ///< demuxer. During decoding, it contains
-                                  ///< packet data.
-    int8_t vbm_tree[25];          ///< converts VLC codes to frame type
-
-    int spillover_bitsize;        ///< number of bits used to specify
-                                  ///< #spillover_nbits in the packet header
-                                  ///< = ceil(log2(ctx->block_align << 3))
-    int history_nsamples;         ///< number of samples in history for signal
-                                  ///< prediction (through ACB)
-
-    /* postfilter specific values */
-    int do_apf;                   ///< whether to apply the averaged
-                                  ///< projection filter (APF)
-    int denoise_strength;         ///< strength of denoising in Wiener filter
-                                  ///< [0-11]
-    int denoise_tilt_corr;        ///< Whether to apply tilt correction to the
-                                  ///< Wiener filter coefficients (postfilter)
-    int dc_level;                 ///< Predicted amount of DC noise, based
-                                  ///< on which a DC removal filter is used
-
-    int lsps;                     ///< number of LSPs per frame [10 or 16]
-    int lsp_q_mode;               ///< defines quantizer defaults [0, 1]
-    int lsp_def_mode;             ///< defines different sets of LSP defaults
-                                  ///< [0, 1]
-    int frame_lsp_bitsize;        ///< size (in bits) of LSPs, when encoded
-                                  ///< per-frame (independent coding)
-    int sframe_lsp_bitsize;       ///< size (in bits) of LSPs, when encoded
-                                  ///< per superframe (residual coding)
-
-    int min_pitch_val;            ///< base value for pitch parsing code
-    int max_pitch_val;            ///< max value + 1 for pitch parsing
-    int pitch_nbits;              ///< number of bits used to specify the
-                                  ///< pitch value in the frame header
-    int block_pitch_nbits;        ///< number of bits used to specify the
-                                  ///< first block's pitch value
-    int block_pitch_range;        ///< range of the block pitch
-    int block_delta_pitch_nbits;  ///< number of bits used to specify the
-                                  ///< delta pitch between this and the last
-                                  ///< block's pitch value, used in all but
-                                  ///< first block
-    int block_delta_pitch_hrange; ///< 1/2 range of the delta (full range is
-                                  ///< from -this to +this-1)
-    uint16_t block_conv_table[4]; ///< boundaries for block pitch unit/scale
-                                  ///< conversion
-
-    /**
-     * @}
-     * @defgroup struct_packet Packet values
-     * Packet values, specified in the packet header or related to a packet.
-     * A packet is considered to be a single unit of data provided to this
-     * decoder by the demuxer.
-     * @{
-     */
-    int spillover_nbits;          ///< number of bits of the previous packet's
-                                  ///< last superframe preceeding this
-                                  ///< packet's first full superframe (useful
-                                  ///< for re-synchronization also)
-    int has_residual_lsps;        ///< if set, superframes contain one set of
-                                  ///< LSPs that cover all frames, encoded as
-                                  ///< independent and residual LSPs; if not
-                                  ///< set, each frame contains its own, fully
-                                  ///< independent, LSPs
-    int skip_bits_next;           ///< number of bits to skip at the next call
-                                  ///< to #wmavoice_decode_packet() (since
-                                  ///< they're part of the previous superframe)
-
-    uint8_t sframe_cache[SFRAME_CACHE_MAXSIZE + FF_INPUT_BUFFER_PADDING_SIZE];
-                                  ///< cache for superframe data split over
-                                  ///< multiple packets
-    int sframe_cache_size;        ///< set to >0 if we have data from an
-                                  ///< (incomplete) superframe from a previous
-                                  ///< packet that spilled over in the current
-                                  ///< packet; specifies the amount of bits in
-                                  ///< #sframe_cache
-    PutBitContext pb;             ///< bitstream writer for #sframe_cache
-
-    /**
-     * @}
-     * @defgroup struct_frame Frame and superframe values
-     * Superframe and frame data - these can change from frame to frame,
-     * although some of them do in that case serve as a cache / history for
-     * the next frame or superframe.
-     * @{
-     */
-    double prev_lsps[MAX_LSPS];   ///< LSPs of the last frame of the previous
-                                  ///< superframe
-    int last_pitch_val;           ///< pitch value of the previous frame
-    int last_acb_type;            ///< frame type [0-2] of the previous frame
-    int pitch_diff_sh16;          ///< ((cur_pitch_val - #last_pitch_val)
-                                  ///< << 16) / #MAX_FRAMESIZE
-    float silence_gain;           ///< set for use in blocks if #ACB_TYPE_NONE
-
-    int aw_idx_is_ext;            ///< whether the AW index was encoded in
-                                  ///< 8 bits (instead of 6)
-    int aw_pulse_range;           ///< the range over which #aw_pulse_set1()
-                                  ///< can apply the pulse, relative to the
-                                  ///< value in aw_first_pulse_off. The exact
-                                  ///< position of the first AW-pulse is within
-                                  ///< [pulse_off, pulse_off + this], and
-                                  ///< depends on bitstream values; [16 or 24]
-    int aw_n_pulses[2];           ///< number of AW-pulses in each block; note
-                                  ///< that this number can be negative (in
-                                  ///< which case it basically means "zero")
-    int aw_first_pulse_off[2];    ///< index of first sample to which to
-                                  ///< apply AW-pulses, or -0xff if unset
-    int aw_next_pulse_off_cache;  ///< the position (relative to start of the
-                                  ///< second block) at which pulses should
-                                  ///< start to be positioned, serves as a
-                                  ///< cache for pitch-adaptive window pulses
-                                  ///< between blocks
-
-    int frame_cntr;               ///< current frame index [0 - 0xFFFE]; is
-                                  ///< only used for comfort noise in #pRNG()
-    float gain_pred_err[6];       ///< cache for gain prediction
-    float excitation_history[MAX_SIGNAL_HISTORY];
-                                  ///< cache of the signal of previous
-                                  ///< superframes, used as a history for
-                                  ///< signal generation
-    float synth_history[MAX_LSPS]; ///< see #excitation_history
-    /**
-     * @}
-     * @defgroup post_filter Postfilter values
-     * Varibales used for postfilter implementation, mostly history for
-     * smoothing and so on, and context variables for FFT/iFFT.
-     * @{
-     */
-    RDFTContext rdft, irdft;      ///< contexts for FFT-calculation in the
-                                  ///< postfilter (for denoise filter)
-    DCTContext dct, dst;          ///< contexts for phase shift (in Hilbert
-                                  ///< transform, part of postfilter)
-    float sin[511], cos[511];     ///< 8-bit cosine/sine windows over [-pi,pi]
-                                  ///< range
-    float postfilter_agc;         ///< gain control memory, used in
-                                  ///< #adaptive_gain_control()
-    float dcf_mem[2];             ///< DC filter history
-    float zero_exc_pf[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE];
-                                  ///< zero filter output (i.e. excitation)
-                                  ///< by postfilter
-    float denoise_filter_cache[MAX_FRAMESIZE];
-    int   denoise_filter_cache_size; ///< samples in #denoise_filter_cache
-    DECLARE_ALIGNED(16, float, tilted_lpcs_pf)[0x80];
-                                  ///< aligned buffer for LPC tilting
-    DECLARE_ALIGNED(16, float, denoise_coeffs_pf)[0x80];
-                                  ///< aligned buffer for denoise coefficients
-    DECLARE_ALIGNED(16, float, synth_filter_out_buf)[0x80 + MAX_LSPS_ALIGN16];
-                                  ///< aligned buffer for postfilter speech
-                                  ///< synthesis
-    /**
-     * @}
-     */
-} WMAVoiceContext;
-
-/**
- * Sets up the variable bit mode (VBM) tree from container extradata.
- * @param gb bit I/O context.
- *           The bit context (s->gb) should be loaded with byte 23-46 of the
- *           container extradata (i.e. the ones containing the VBM tree).
- * @param vbm_tree pointer to array to which the decoded VBM tree will be
- *                 written.
- * @return 0 on success, <0 on error.
- */
-static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
-{
-    static const uint8_t bits[] = {
-         2,  2,  2,  4,  4,  4,
-         6,  6,  6,  8,  8,  8,
-        10, 10, 10, 12, 12, 12,
-        14, 14, 14, 14
-    };
-    static const uint16_t codes[] = {
-          0x0000, 0x0001, 0x0002,        //              00/01/10
-          0x000c, 0x000d, 0x000e,        //           11+00/01/10
-          0x003c, 0x003d, 0x003e,        //         1111+00/01/10
-          0x00fc, 0x00fd, 0x00fe,        //       111111+00/01/10
-          0x03fc, 0x03fd, 0x03fe,        //     11111111+00/01/10
-          0x0ffc, 0x0ffd, 0x0ffe,        //   1111111111+00/01/10
-          0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx
-    };
-    int cntr[8], n, res;
-
-    memset(vbm_tree, 0xff, sizeof(vbm_tree));
-    memset(cntr,     0,    sizeof(cntr));
-    for (n = 0; n < 17; n++) {
-        res = get_bits(gb, 3);
-        if (cntr[res] > 3) // should be >= 3 + (res == 7))
-            return -1;
-        vbm_tree[res * 3 + cntr[res]++] = n;
-    }
-    INIT_VLC_STATIC(&frame_type_vlc, VLC_NBITS, sizeof(bits),
-                    bits, 1, 1, codes, 2, 2, 132);
-    return 0;
-}
-
-/**
- * Set up decoder with parameters from demuxer (extradata etc.).
- */
-static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
-{
-    int n, flags, pitch_range, lsp16_flag;
-    WMAVoiceContext *s = ctx->priv_data;
-
-    /**
-     * Extradata layout:
-     * - byte  0-18: WMAPro-in-WMAVoice extradata (see wmaprodec.c),
-     * - byte 19-22: flags field (annoyingly in LE; see below for known
-     *               values),
-     * - byte 23-46: variable bitmode tree (really just 17 * 3 bits,
-     *               rest is 0).
-     */
-    if (ctx->extradata_size != 46) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Invalid extradata size %d (should be 46)\n",
-               ctx->extradata_size);
-        return -1;
-    }
-    flags                = AV_RL32(ctx->extradata + 18);
-    s->spillover_bitsize = 3 + av_ceil_log2(ctx->block_align);
-    s->do_apf            =    flags & 0x1;
-    if (s->do_apf) {
-        ff_rdft_init(&s->rdft,  7, DFT_R2C);
-        ff_rdft_init(&s->irdft, 7, IDFT_C2R);
-        ff_dct_init(&s->dct,  6, DCT_I);
-        ff_dct_init(&s->dst,  6, DST_I);
-
-        ff_sine_window_init(s->cos, 256);
-        memcpy(&s->sin[255], s->cos, 256 * sizeof(s->cos[0]));
-        for (n = 0; n < 255; n++) {
-            s->sin[n]       = -s->sin[510 - n];
-            s->cos[510 - n] =  s->cos[n];
-        }
-    }
-    s->denoise_strength  =   (flags >> 2) & 0xF;
-    if (s->denoise_strength >= 12) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Invalid denoise filter strength %d (max=11)\n",
-               s->denoise_strength);
-        return -1;
-    }
-    s->denoise_tilt_corr = !!(flags & 0x40);
-    s->dc_level          =   (flags >> 7) & 0xF;
-    s->lsp_q_mode        = !!(flags & 0x2000);
-    s->lsp_def_mode      = !!(flags & 0x4000);
-    lsp16_flag           =    flags & 0x1000;
-    if (lsp16_flag) {
-        s->lsps               = 16;
-        s->frame_lsp_bitsize  = 34;
-        s->sframe_lsp_bitsize = 60;
-    } else {
-        s->lsps               = 10;
-        s->frame_lsp_bitsize  = 24;
-        s->sframe_lsp_bitsize = 48;
-    }
-    for (n = 0; n < s->lsps; n++)
-        s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0);
-
-    init_get_bits(&s->gb, ctx->extradata + 22, (ctx->extradata_size - 22) << 3);
-    if (decode_vbmtree(&s->gb, s->vbm_tree) < 0) {
-        av_log(ctx, AV_LOG_ERROR, "Invalid VBM tree; broken extradata?\n");
-        return -1;
-    }
-
-    s->min_pitch_val    = ((ctx->sample_rate << 8)      /  400 + 50) >> 8;
-    s->max_pitch_val    = ((ctx->sample_rate << 8) * 37 / 2000 + 50) >> 8;
-    pitch_range         = s->max_pitch_val - s->min_pitch_val;
-    s->pitch_nbits      = av_ceil_log2(pitch_range);
-    s->last_pitch_val   = 40;
-    s->last_acb_type    = ACB_TYPE_NONE;
-    s->history_nsamples = s->max_pitch_val + 8;
-
-    if (s->min_pitch_val < 1 || s->history_nsamples > MAX_SIGNAL_HISTORY) {
-        int min_sr = ((((1 << 8) - 50) * 400) + 0xFF) >> 8,
-            max_sr = ((((MAX_SIGNAL_HISTORY - 8) << 8) + 205) * 2000 / 37) >> 8;
-
-        av_log(ctx, AV_LOG_ERROR,
-               "Unsupported samplerate %d (min=%d, max=%d)\n",
-               ctx->sample_rate, min_sr, max_sr); // 322-22097 Hz
-
-        return -1;
-    }
-
-    s->block_conv_table[0]      = s->min_pitch_val;
-    s->block_conv_table[1]      = (pitch_range * 25) >> 6;
-    s->block_conv_table[2]      = (pitch_range * 44) >> 6;
-    s->block_conv_table[3]      = s->max_pitch_val - 1;
-    s->block_delta_pitch_hrange = (pitch_range >> 3) & ~0xF;
-    s->block_delta_pitch_nbits  = 1 + av_ceil_log2(s->block_delta_pitch_hrange);
-    s->block_pitch_range        = s->block_conv_table[2] +
-                                  s->block_conv_table[3] + 1 +
-                                  2 * (s->block_conv_table[1] - 2 * s->min_pitch_val);
-    s->block_pitch_nbits        = av_ceil_log2(s->block_pitch_range);
-
-    ctx->sample_fmt             = SAMPLE_FMT_FLT;
-
-    return 0;
-}
-
-/**
- * @defgroup postfilter Postfilter functions
- * Postfilter functions (gain control, wiener denoise filter, DC filter,
- * kalman smoothening, plus surrounding code to wrap it)
- * @{
- */
-/**
- * Adaptive gain control (as used in postfilter).
- *
- * Identical to #ff_adaptive_gain_control() in acelp_vectors.c, except
- * that the energy here is calculated using sum(abs(...)), whereas the
- * other codecs (e.g. AMR-NB, SIPRO) use sqrt(dotproduct(...)).
- *
- * @param out output buffer for filtered samples
- * @param in input buffer containing the samples as they are after the
- *           postfilter steps so far
- * @param speech_synth input buffer containing speech synth before postfilter
- * @param size input buffer size
- * @param alpha exponential filter factor
- * @param gain_mem pointer to filter memory (single float)
- */
-static void adaptive_gain_control(float *out, const float *in,
-                                  const float *speech_synth,
-                                  int size, float alpha, float *gain_mem)
-{
-    int i;
-    float speech_energy = 0.0, postfilter_energy = 0.0, gain_scale_factor;
-    float mem = *gain_mem;
-
-    for (i = 0; i < size; i++) {
-        speech_energy     += fabsf(speech_synth[i]);
-        postfilter_energy += fabsf(in[i]);
-    }
-    gain_scale_factor = (1.0 - alpha) * speech_energy / postfilter_energy;
-
-    for (i = 0; i < size; i++) {
-        mem = alpha * mem + gain_scale_factor;
-        out[i] = in[i] * mem;
-    }
-
-    *gain_mem = mem;
-}
-
-/**
- * Kalman smoothing function.
- *
- * This function looks back pitch +/- 3 samples back into history to find
- * the best fitting curve (that one giving the optimal gain of the two
- * signals, i.e. the highest dot product between the two), and then
- * uses that signal history to smoothen the output of the speech synthesis
- * filter.
- *
- * @param s WMA Voice decoding context
- * @param pitch pitch of the speech signal
- * @param in input speech signal
- * @param out output pointer for smoothened signal
- * @param size input/output buffer size
- *
- * @returns -1 if no smoothening took place, e.g. because no optimal
- *          fit could be found, or 0 on success.
- */
-static int kalman_smoothen(WMAVoiceContext *s, int pitch,
-                           const float *in, float *out, int size)
-{
-    int n;
-    float optimal_gain = 0, dot;
-    const float *ptr = &in[-FFMAX(s->min_pitch_val, pitch - 3)],
-                *end = &in[-FFMIN(s->max_pitch_val, pitch + 3)],
-                *best_hist_ptr;
-
-    /* find best fitting point in history */
-    do {
-        dot = ff_dot_productf(in, ptr, size);
-        if (dot > optimal_gain) {
-            optimal_gain  = dot;
-            best_hist_ptr = ptr;
-        }
-    } while (--ptr >= end);
-
-    if (optimal_gain <= 0)
-        return -1;
-    dot = ff_dot_productf(best_hist_ptr, best_hist_ptr, size);
-    if (dot <= 0) // would be 1.0
-        return -1;
-
-    if (optimal_gain <= dot) {
-        dot = dot / (dot + 0.6 * optimal_gain); // 0.625-1.000
-    } else
-        dot = 0.625;
-
-    /* actual smoothing */
-    for (n = 0; n < size; n++)
-        out[n] = best_hist_ptr[n] + dot * (in[n] - best_hist_ptr[n]);
-
-    return 0;
-}
-
-/**
- * Get the tilt factor of a formant filter from its transfer function
- * @see #tilt_factor() in amrnbdec.c, which does essentially the same,
- *      but somehow (??) it does a speech synthesis filter in the
- *      middle, which is missing here
- *
- * @param lpcs LPC coefficients
- * @param n_lpcs Size of LPC buffer
- * @returns the tilt factor
- */
-static float tilt_factor(const float *lpcs, int n_lpcs)
-{
-    float rh0, rh1;
-
-    rh0 = 1.0     + ff_dot_productf(lpcs,  lpcs,    n_lpcs);
-    rh1 = lpcs[0] + ff_dot_productf(lpcs, &lpcs[1], n_lpcs - 1);
-
-    return rh1 / rh0;
-}
-
-/**
- * Derive denoise filter coefficients (in real domain) from the LPCs.
- */
-static void calc_input_response(WMAVoiceContext *s, float *lpcs,
-                                int fcb_type, float *coeffs, int remainder)
-{
-    float last_coeff, min = 15.0, max = -15.0;
-    float irange, angle_mul, gain_mul, range, sq;
-    int n, idx;
-
-    /* Create frequency power spectrum of speech input (i.e. RDFT of LPCs) */
-    ff_rdft_calc(&s->rdft, lpcs);
-#define log_range(var, assign) do { \
-        float tmp = log10f(assign);  var = tmp; \
-        max       = FFMAX(max, tmp); min = FFMIN(min, tmp); \
-    } while (0)
-    log_range(last_coeff,  lpcs[1]         * lpcs[1]);
-    for (n = 1; n < 64; n++)
-        log_range(lpcs[n], lpcs[n * 2]     * lpcs[n * 2] +
-                           lpcs[n * 2 + 1] * lpcs[n * 2 + 1]);
-    log_range(lpcs[0],     lpcs[0]         * lpcs[0]);
-#undef log_range
-    range    = max - min;
-    lpcs[64] = last_coeff;
-
-    /* Now, use this spectrum to pick out these frequencies with higher
-     * (relative) power/energy (which we then take to be "not noise"),
-     * and set up a table (still in lpc[]) of (relative) gains per frequency.
-     * These frequencies will be maintained, while others ("noise") will be
-     * decreased in the filter output. */
-    irange    = 64.0 / range; // so irange*(max-value) is in the range [0, 63]
-    gain_mul  = range * (fcb_type == FCB_TYPE_HARDCODED ? (5.0 / 13.0) :
-                                                          (5.0 / 14.7));
-    angle_mul = gain_mul * (8.0 * M_LN10 / M_PI);
-    for (n = 0; n <= 64; n++) {
-        float pow;
-
-        idx = FFMAX(0, lrint((max - lpcs[n]) * irange) - 1);
-        pow = wmavoice_denoise_power_table[s->denoise_strength][idx];
-        lpcs[n] = angle_mul * pow;
-
-        /* 70.57 =~ 1/log10(1.0331663) */
-        idx = (pow * gain_mul - 0.0295) * 70.570526123;
-        if (idx > 127) { // fallback if index falls outside table range
-            coeffs[n] = wmavoice_energy_table[127] *
-                        powf(1.0331663, idx - 127);
-        } else
-            coeffs[n] = wmavoice_energy_table[FFMAX(0, idx)];
-    }
-
-    /* calculate the Hilbert transform of the gains, which we do (since this
-     * is a sinus input) by doing a phase shift (in theory, H(sin())=cos()).
-     * Hilbert_Transform(RDFT(x)) = Laplace_Transform(x), which calculates the
-     * "moment" of the LPCs in this filter. */
-    ff_dct_calc(&s->dct, lpcs);
-    ff_dct_calc(&s->dst, lpcs);
-
-    /* Split out the coefficient indexes into phase/magnitude pairs */
-    idx = 255 + av_clip(lpcs[64],               -255, 255);
-    coeffs[0]  = coeffs[0]  * s->cos[idx];
-    idx = 255 + av_clip(lpcs[64] - 2 * lpcs[63], -255, 255);
-    last_coeff = coeffs[64] * s->cos[idx];
-    for (n = 63;; n--) {
-        idx = 255 + av_clip(-lpcs[64] - 2 * lpcs[n - 1], -255, 255);
-        coeffs[n * 2 + 1] = coeffs[n] * s->sin[idx];
-        coeffs[n * 2]     = coeffs[n] * s->cos[idx];
-
-        if (!--n) break;
-
-        idx = 255 + av_clip( lpcs[64] - 2 * lpcs[n - 1], -255, 255);
-        coeffs[n * 2 + 1] = coeffs[n] * s->sin[idx];
-        coeffs[n * 2]     = coeffs[n] * s->cos[idx];
-    }
-    coeffs[1] = last_coeff;
-
-    /* move into real domain */
-    ff_rdft_calc(&s->irdft, coeffs);
-
-    /* tilt correction and normalize scale */
-    memset(&coeffs[remainder], 0, sizeof(coeffs[0]) * (128 - remainder));
-    if (s->denoise_tilt_corr) {
-        float tilt_mem = 0;
-
-        coeffs[remainder - 1] = 0;
-        ff_tilt_compensation(&tilt_mem,
-                             -1.8 * tilt_factor(coeffs, remainder - 1),
-                             coeffs, remainder);
-    }
-    sq = (1.0 / 64.0) * sqrtf(1 / ff_dot_productf(coeffs, coeffs, remainder));
-    for (n = 0; n < remainder; n++)
-        coeffs[n] *= sq;
-}
-
-/**
- * This function applies a Wiener filter on the (noisy) speech signal as
- * a means to denoise it.
- *
- * - take RDFT of LPCs to get the power spectrum of the noise + speech;
- * - using this power spectrum, calculate (for each frequency) the Wiener
- *    filter gain, which depends on the frequency power and desired level
- *    of noise subtraction (when set too high, this leads to artifacts)
- *    We can do this symmetrically over the X-axis (so 0-4kHz is the inverse
- *    of 4-8kHz);
- * - by doing a phase shift, calculate the Hilbert transform of this array
- *    of per-frequency filter-gains to get the filtering coefficients;
- * - smoothen/normalize/de-tilt these filter coefficients as desired;
- * - take RDFT of noisy sound, apply the coefficients and take its IRDFT
- *    to get the denoised speech signal;
- * - the leftover (i.e. output of the IRDFT on denoised speech data beyond
- *    the frame boundary) are saved and applied to subsequent frames by an
- *    overlap-add method (otherwise you get clicking-artifacts).
- *
- * @param s WMA Voice decoding context
- * @param s fcb_type Frame (codebook) type
- * @param synth_pf input: the noisy speech signal, output: denoised speech
- *                 data; should be 16-byte aligned (for ASM purposes)
- * @param size size of the speech data
- * @param lpcs LPCs used to synthesize this frame's speech data
- */
-static void wiener_denoise(WMAVoiceContext *s, int fcb_type,
-                           float *synth_pf, int size,
-                           const float *lpcs)
-{
-    int remainder, lim, n;
-
-    if (fcb_type != FCB_TYPE_SILENCE) {
-        float *tilted_lpcs = s->tilted_lpcs_pf,
-              *coeffs = s->denoise_coeffs_pf, tilt_mem = 0;
-
-        tilted_lpcs[0]           = 1.0;
-        memcpy(&tilted_lpcs[1], lpcs, sizeof(lpcs[0]) * s->lsps);
-        memset(&tilted_lpcs[s->lsps + 1], 0,
-               sizeof(tilted_lpcs[0]) * (128 - s->lsps - 1));
-        ff_tilt_compensation(&tilt_mem, 0.7 * tilt_factor(lpcs, s->lsps),
-                             tilted_lpcs, s->lsps + 2);
-
-        /* The IRDFT output (127 samples for 7-bit filter) beyond the frame
-         * size is applied to the next frame. All input beyond this is zero,
-         * and thus all output beyond this will go towards zero, hence we can
-         * limit to min(size-1, 127-size) as a performance consideration. */
-        remainder = FFMIN(127 - size, size - 1);
-        calc_input_response(s, tilted_lpcs, fcb_type, coeffs, remainder);
-
-        /* apply coefficients (in frequency spectrum domain), i.e. complex
-         * number multiplication */
-        memset(&synth_pf[size], 0, sizeof(synth_pf[0]) * (128 - size));
-        ff_rdft_calc(&s->rdft, synth_pf);
-        ff_rdft_calc(&s->rdft, coeffs);
-        synth_pf[0] *= coeffs[0];
-        synth_pf[1] *= coeffs[1];
-        for (n = 1; n < 64; n++) {
-            float v1 = synth_pf[n * 2], v2 = synth_pf[n * 2 + 1];
-            synth_pf[n * 2]     = v1 * coeffs[n * 2] - v2 * coeffs[n * 2 + 1];
-            synth_pf[n * 2 + 1] = v2 * coeffs[n * 2] + v1 * coeffs[n * 2 + 1];
-        }
-        ff_rdft_calc(&s->irdft, synth_pf);
-    }
-
-    /* merge filter output with the history of previous runs */
-    if (s->denoise_filter_cache_size) {
-        lim = FFMIN(s->denoise_filter_cache_size, size);
-        for (n = 0; n < lim; n++)
-            synth_pf[n] += s->denoise_filter_cache[n];
-        s->denoise_filter_cache_size -= lim;
-        memmove(s->denoise_filter_cache, &s->denoise_filter_cache[size],
-                sizeof(s->denoise_filter_cache[0]) * s->denoise_filter_cache_size);
-    }
-
-    /* move remainder of filter output into a cache for future runs */
-    if (fcb_type != FCB_TYPE_SILENCE) {
-        lim = FFMIN(remainder, s->denoise_filter_cache_size);
-        for (n = 0; n < lim; n++)
-            s->denoise_filter_cache[n] += synth_pf[size + n];
-        if (lim < remainder) {
-            memcpy(&s->denoise_filter_cache[lim], &synth_pf[size + lim],
-                   sizeof(s->denoise_filter_cache[0]) * (remainder - lim));
-            s->denoise_filter_cache_size = remainder;
-        }
-    }
-}
-
-/**
- * Averaging projection filter, the postfilter used in WMAVoice.
- *
- * This uses the following steps:
- * - A zero-synthesis filter (generate excitation from synth signal)
- * - Kalman smoothing on excitation, based on pitch
- * - Re-synthesized smoothened output
- * - Iterative Wiener denoise filter
- * - Adaptive gain filter
- * - DC filter
- *
- * @param s WMAVoice decoding context
- * @param synth Speech synthesis output (before postfilter)
- * @param samples Output buffer for filtered samples
- * @param size Buffer size of synth & samples
- * @param lpcs Generated LPCs used for speech synthesis
- * @param fcb_type Frame type (silence, hardcoded, AW-pulses or FCB-pulses)
- * @param pitch Pitch of the input signal
- */
-static void postfilter(WMAVoiceContext *s, const float *synth,
-                       float *samples,    int size,
-                       const float *lpcs, float *zero_exc_pf,
-                       int fcb_type,      int pitch)
-{
-    float synth_filter_in_buf[MAX_FRAMESIZE / 2],
-          *synth_pf = &s->synth_filter_out_buf[MAX_LSPS_ALIGN16],
-          *synth_filter_in = zero_exc_pf;
-
-    assert(size <= MAX_FRAMESIZE / 2);
-
-    /* generate excitation from input signal */
-    ff_celp_lp_zero_synthesis_filterf(zero_exc_pf, lpcs, synth, size, s->lsps);
-
-    if (fcb_type >= FCB_TYPE_AW_PULSES &&
-        !kalman_smoothen(s, pitch, zero_exc_pf, synth_filter_in_buf, size))
-        synth_filter_in = synth_filter_in_buf;
-
-    /* re-synthesize speech after smoothening, and keep history */
-    ff_celp_lp_synthesis_filterf(synth_pf, lpcs,
-                                 synth_filter_in, size, s->lsps);
-    memcpy(&synth_pf[-s->lsps], &synth_pf[size - s->lsps],
-           sizeof(synth_pf[0]) * s->lsps);
-
-    wiener_denoise(s, fcb_type, synth_pf, size, lpcs);
-
-    adaptive_gain_control(samples, synth_pf, synth, size, 0.99,
-                          &s->postfilter_agc);
-
-    if (s->dc_level > 8) {
-        /* remove ultra-low frequency DC noise / highpass filter;
-         * coefficients are identical to those used in SIPR decoding,
-         * and very closely resemble those used in AMR-NB decoding. */
-        ff_acelp_apply_order_2_transfer_function(samples, samples,
-            (const float[2]) { -1.99997,      1.0 },
-            (const float[2]) { -1.9330735188, 0.93589198496 },
-            0.93980580475, s->dcf_mem, size);
-    }
-}
-/**
- * @}
- */
-
-/**
- * Dequantize LSPs
- * @param lsps output pointer to the array that will hold the LSPs
- * @param num number of LSPs to be dequantized
- * @param values quantized values, contains n_stages values
- * @param sizes range (i.e. max value) of each quantized value
- * @param n_stages number of dequantization runs
- * @param table dequantization table to be used
- * @param mul_q LSF multiplier
- * @param base_q base (lowest) LSF values
- */
-static void dequant_lsps(double *lsps, int num,
-                         const uint16_t *values,
-                         const uint16_t *sizes,
-                         int n_stages, const uint8_t *table,
-                         const double *mul_q,
-                         const double *base_q)
-{
-    int n, m;
-
-    memset(lsps, 0, num * sizeof(*lsps));
-    for (n = 0; n < n_stages; n++) {
-        const uint8_t *t_off = &table[values[n] * num];
-        double base = base_q[n], mul = mul_q[n];
-
-        for (m = 0; m < num; m++)
-            lsps[m] += base + mul * t_off[m];
-
-        table += sizes[n] * num;
-    }
-}
-
-/**
- * @defgroup lsp_dequant LSP dequantization routines
- * LSP dequantization routines, for 10/16LSPs and independent/residual coding.
- * @note we assume enough bits are available, caller should check.
- * lsp10i() consumes 24 bits; lsp10r() consumes an additional 24 bits;
- * lsp16i() consumes 34 bits; lsp16r() consumes an additional 26 bits.
- * @{
- */
-/**
- * Parse 10 independently-coded LSPs.
- */
-static void dequant_lsp10i(GetBitContext *gb, double *lsps)
-{
-    static const uint16_t vec_sizes[4] = { 256, 64, 32, 32 };
-    static const double mul_lsf[4] = {
-        5.2187144800e-3,    1.4626986422e-3,
-        9.6179549166e-4,    1.1325736225e-3
-    };
-    static const double base_lsf[4] = {
-        M_PI * -2.15522e-1, M_PI * -6.1646e-2,
-        M_PI * -3.3486e-2,  M_PI * -5.7408e-2
-    };
-    uint16_t v[4];
-
-    v[0] = get_bits(gb, 8);
-    v[1] = get_bits(gb, 6);
-    v[2] = get_bits(gb, 5);
-    v[3] = get_bits(gb, 5);
-
-    dequant_lsps(lsps, 10, v, vec_sizes, 4, wmavoice_dq_lsp10i,
-                 mul_lsf, base_lsf);
-}
-
-/**
- * Parse 10 independently-coded LSPs, and then derive the tables to
- * generate LSPs for the other frames from them (residual coding).
- */
-static void dequant_lsp10r(GetBitContext *gb,
-                           double *i_lsps, const double *old,
-                           double *a1, double *a2, int q_mode)
-{
-    static const uint16_t vec_sizes[3] = { 128, 64, 64 };
-    static const double mul_lsf[3] = {
-        2.5807601174e-3,    1.2354460219e-3,   1.1763821673e-3
-    };
-    static const double base_lsf[3] = {
-        M_PI * -1.07448e-1, M_PI * -5.2706e-2, M_PI * -5.1634e-2
-    };
-    const float (*ipol_tab)[2][10] = q_mode ?
-        wmavoice_lsp10_intercoeff_b : wmavoice_lsp10_intercoeff_a;
-    uint16_t interpol, v[3];
-    int n;
-
-    dequant_lsp10i(gb, i_lsps);
-
-    interpol = get_bits(gb, 5);
-    v[0]     = get_bits(gb, 7);
-    v[1]     = get_bits(gb, 6);
-    v[2]     = get_bits(gb, 6);
-
-    for (n = 0; n < 10; n++) {
-        double delta = old[n] - i_lsps[n];
-        a1[n]        = ipol_tab[interpol][0][n] * delta + i_lsps[n];
-        a1[10 + n]   = ipol_tab[interpol][1][n] * delta + i_lsps[n];
-    }
-
-    dequant_lsps(a2, 20, v, vec_sizes, 3, wmavoice_dq_lsp10r,
-                 mul_lsf, base_lsf);
-}
-
-/**
- * Parse 16 independently-coded LSPs.
- */
-static void dequant_lsp16i(GetBitContext *gb, double *lsps)
-{
-    static const uint16_t vec_sizes[5] = { 256, 64, 128, 64, 128 };
-    static const double mul_lsf[5] = {
-        3.3439586280e-3,    6.9908173703e-4,
-        3.3216608306e-3,    1.0334960326e-3,
-        3.1899104283e-3
-    };
-    static const double base_lsf[5] = {
-        M_PI * -1.27576e-1, M_PI * -2.4292e-2,
-        M_PI * -1.28094e-1, M_PI * -3.2128e-2,
-        M_PI * -1.29816e-1
-    };
-    uint16_t v[5];
-
-    v[0] = get_bits(gb, 8);
-    v[1] = get_bits(gb, 6);
-    v[2] = get_bits(gb, 7);
-    v[3] = get_bits(gb, 6);
-    v[4] = get_bits(gb, 7);
-
-    dequant_lsps( lsps,     5,  v,     vec_sizes,    2,
-                 wmavoice_dq_lsp16i1,  mul_lsf,     base_lsf);
-    dequant_lsps(&lsps[5],  5, &v[2], &vec_sizes[2], 2,
-                 wmavoice_dq_lsp16i2, &mul_lsf[2], &base_lsf[2]);
-    dequant_lsps(&lsps[10], 6, &v[4], &vec_sizes[4], 1,
-                 wmavoice_dq_lsp16i3, &mul_lsf[4], &base_lsf[4]);
-}
-
-/**
- * Parse 16 independently-coded LSPs, and then derive the tables to
- * generate LSPs for the other frames from them (residual coding).
- */
-static void dequant_lsp16r(GetBitContext *gb,
-                           double *i_lsps, const double *old,
-                           double *a1, double *a2, int q_mode)
-{
-    static const uint16_t vec_sizes[3] = { 128, 128, 128 };
-    static const double mul_lsf[3] = {
-        1.2232979501e-3,   1.4062241527e-3,   1.6114744851e-3
-    };
-    static const double base_lsf[3] = {
-        M_PI * -5.5830e-2, M_PI * -5.2908e-2, M_PI * -5.4776e-2
-    };
-    const float (*ipol_tab)[2][16] = q_mode ?
-        wmavoice_lsp16_intercoeff_b : wmavoice_lsp16_intercoeff_a;
-    uint16_t interpol, v[3];
-    int n;
-
-    dequant_lsp16i(gb, i_lsps);
-
-    interpol = get_bits(gb, 5);
-    v[0]     = get_bits(gb, 7);
-    v[1]     = get_bits(gb, 7);
-    v[2]     = get_bits(gb, 7);
-
-    for (n = 0; n < 16; n++) {
-        double delta = old[n] - i_lsps[n];
-        a1[n]        = ipol_tab[interpol][0][n] * delta + i_lsps[n];
-        a1[16 + n]   = ipol_tab[interpol][1][n] * delta + i_lsps[n];
-    }
-
-    dequant_lsps( a2,     10,  v,     vec_sizes,    1,
-                 wmavoice_dq_lsp16r1,  mul_lsf,     base_lsf);
-    dequant_lsps(&a2[10], 10, &v[1], &vec_sizes[1], 1,
-                 wmavoice_dq_lsp16r2, &mul_lsf[1], &base_lsf[1]);
-    dequant_lsps(&a2[20], 12, &v[2], &vec_sizes[2], 1,
-                 wmavoice_dq_lsp16r3, &mul_lsf[2], &base_lsf[2]);
-}
-
-/**
- * @}
- * @defgroup aw Pitch-adaptive window coding functions
- * The next few functions are for pitch-adaptive window coding.
- * @{
- */
-/**
- * Parse the offset of the first pitch-adaptive window pulses, and
- * the distribution of pulses between the two blocks in this frame.
- * @param s WMA Voice decoding context private data
- * @param gb bit I/O context
- * @param pitch pitch for each block in this frame
- */
-static void aw_parse_coords(WMAVoiceContext *s, GetBitContext *gb,
-                            const int *pitch)
-{
-    static const int16_t start_offset[94] = {
-        -11,  -9,  -7,  -5,  -3,  -1,   1,   3,   5,   7,   9,  11,
-         13,  15,  18,  17,  19,  20,  21,  22,  23,  24,  25,  26,
-         27,  28,  29,  30,  31,  32,  33,  35,  37,  39,  41,  43,
-         45,  47,  49,  51,  53,  55,  57,  59,  61,  63,  65,  67,
-         69,  71,  73,  75,  77,  79,  81,  83,  85,  87,  89,  91,
-         93,  95,  97,  99, 101, 103, 105, 107, 109, 111, 113, 115,
-        117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139,
-        141, 143, 145, 147, 149, 151, 153, 155, 157, 159
-    };
-    int bits, offset;
-
-    /* position of pulse */
-    s->aw_idx_is_ext = 0;
-    if ((bits = get_bits(gb, 6)) >= 54) {
-        s->aw_idx_is_ext = 1;
-        bits += (bits - 54) * 3 + get_bits(gb, 2);
-    }
-
-    /* for a repeated pulse at pulse_off with a pitch_lag of pitch[], count
-     * the distribution of the pulses in each block contained in this frame. */
-    s->aw_pulse_range        = FFMIN(pitch[0], pitch[1]) > 32 ? 24 : 16;
-    for (offset = start_offset[bits]; offset < 0; offset += pitch[0]) ;
-    s->aw_n_pulses[0]        = (pitch[0] - 1 + MAX_FRAMESIZE / 2 - offset) / pitch[0];
-    s->aw_first_pulse_off[0] = offset - s->aw_pulse_range / 2;
-    offset                  += s->aw_n_pulses[0] * pitch[0];
-    s->aw_n_pulses[1]        = (pitch[1] - 1 + MAX_FRAMESIZE - offset) / pitch[1];
-    s->aw_first_pulse_off[1] = offset - (MAX_FRAMESIZE + s->aw_pulse_range) / 2;
-
-    /* if continuing from a position before the block, reset position to
-     * start of block (when corrected for the range over which it can be
-     * spread in aw_pulse_set1()). */
-    if (start_offset[bits] < MAX_FRAMESIZE / 2) {
-        while (s->aw_first_pulse_off[1] - pitch[1] + s->aw_pulse_range > 0)
-            s->aw_first_pulse_off[1] -= pitch[1];
-        if (start_offset[bits] < 0)
-            while (s->aw_first_pulse_off[0] - pitch[0] + s->aw_pulse_range > 0)
-                s->aw_first_pulse_off[0] -= pitch[0];
-    }
-}
-
-/**
- * Apply second set of pitch-adaptive window pulses.
- * @param s WMA Voice decoding context private data
- * @param gb bit I/O context
- * @param block_idx block index in frame [0, 1]
- * @param fcb structure containing fixed codebook vector info
- */
-static void aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb,
-                          int block_idx, AMRFixed *fcb)
-{
-    uint16_t use_mask[7]; // only 5 are used, rest is padding
-    /* in this function, idx is the index in the 80-bit (+ padding) use_mask
-     * bit-array. Since use_mask consists of 16-bit values, the lower 4 bits
-     * of idx are the position of the bit within a particular item in the
-     * array (0 being the most significant bit, and 15 being the least
-     * significant bit), and the remainder (>> 4) is the index in the
-     * use_mask[]-array. This is faster and uses less memory than using a
-     * 80-byte/80-int array. */
-    int pulse_off = s->aw_first_pulse_off[block_idx],
-        pulse_start, n, idx, range, aidx, start_off = 0;
-
-    /* set offset of first pulse to within this block */
-    if (s->aw_n_pulses[block_idx] > 0)
-        while (pulse_off + s->aw_pulse_range < 1)
-            pulse_off += fcb->pitch_lag;
-
-    /* find range per pulse */
-    if (s->aw_n_pulses[0] > 0) {
-        if (block_idx == 0) {
-            range = 32;
-        } else /* block_idx = 1 */ {
-            range = 8;
-            if (s->aw_n_pulses[block_idx] > 0)
-                pulse_off = s->aw_next_pulse_off_cache;
-        }
-    } else
-        range = 16;
-    pulse_start = s->aw_n_pulses[block_idx] > 0 ? pulse_off - range / 2 : 0;
-
-    /* aw_pulse_set1() already applies pulses around pulse_off (to be exactly,
-     * in the range of [pulse_off, pulse_off + s->aw_pulse_range], and thus
-     * we exclude that range from being pulsed again in this function. */
-    memset( use_mask,   -1, 5 * sizeof(use_mask[0]));
-    memset(&use_mask[5], 0, 2 * sizeof(use_mask[0]));
-    if (s->aw_n_pulses[block_idx] > 0)
-        for (idx = pulse_off; idx < MAX_FRAMESIZE / 2; idx += fcb->pitch_lag) {
-            int excl_range         = s->aw_pulse_range; // always 16 or 24
-            uint16_t *use_mask_ptr = &use_mask[idx >> 4];
-            int first_sh           = 16 - (idx & 15);
-            *use_mask_ptr++       &= 0xFFFF << first_sh;
-            excl_range            -= first_sh;
-            if (excl_range >= 16) {
-                *use_mask_ptr++    = 0;
-                *use_mask_ptr     &= 0xFFFF >> (excl_range - 16);
-            } else
-                *use_mask_ptr     &= 0xFFFF >> excl_range;
-        }
-
-    /* find the 'aidx'th offset that is not excluded */
-    aidx = get_bits(gb, s->aw_n_pulses[0] > 0 ? 5 - 2 * block_idx : 4);
-    for (n = 0; n <= aidx; pulse_start++) {
-        for (idx = pulse_start; idx < 0; idx += fcb->pitch_lag) ;
-        if (idx >= MAX_FRAMESIZE / 2) { // find from zero
-            if (use_mask[0])      idx = 0x0F;
-            else if (use_mask[1]) idx = 0x1F;
-            else if (use_mask[2]) idx = 0x2F;
-            else if (use_mask[3]) idx = 0x3F;
-            else if (use_mask[4]) idx = 0x4F;
-            else                  return;
-            idx -= av_log2_16bit(use_mask[idx >> 4]);
-        }
-        if (use_mask[idx >> 4] & (0x8000 >> (idx & 15))) {
-            use_mask[idx >> 4] &= ~(0x8000 >> (idx & 15));
-            n++;
-            start_off = idx;
-        }
-    }
-
-    fcb->x[fcb->n] = start_off;
-    fcb->y[fcb->n] = get_bits1(gb) ? -1.0 : 1.0;
-    fcb->n++;
-
-    /* set offset for next block, relative to start of that block */
-    n = (MAX_FRAMESIZE / 2 - start_off) % fcb->pitch_lag;
-    s->aw_next_pulse_off_cache = n ? fcb->pitch_lag - n : 0;
-}
-
-/**
- * Apply first set of pitch-adaptive window pulses.
- * @param s WMA Voice decoding context private data
- * @param gb bit I/O context
- * @param block_idx block index in frame [0, 1]
- * @param fcb storage location for fixed codebook pulse info
- */
-static void aw_pulse_set1(WMAVoiceContext *s, GetBitContext *gb,
-                          int block_idx, AMRFixed *fcb)
-{
-    int val = get_bits(gb, 12 - 2 * (s->aw_idx_is_ext && !block_idx));
-    float v;
-
-    if (s->aw_n_pulses[block_idx] > 0) {
-        int n, v_mask, i_mask, sh, n_pulses;
-
-        if (s->aw_pulse_range == 24) { // 3 pulses, 1:sign + 3:index each
-            n_pulses = 3;
-            v_mask   = 8;
-            i_mask   = 7;
-            sh       = 4;
-        } else { // 4 pulses, 1:sign + 2:index each
-            n_pulses = 4;
-            v_mask   = 4;
-            i_mask   = 3;
-            sh       = 3;
-        }
-
-        for (n = n_pulses - 1; n >= 0; n--, val >>= sh) {
-            fcb->y[fcb->n] = (val & v_mask) ? -1.0 : 1.0;
-            fcb->x[fcb->n] = (val & i_mask) * n_pulses + n +
-                                 s->aw_first_pulse_off[block_idx];
-            while (fcb->x[fcb->n] < 0)
-                fcb->x[fcb->n] += fcb->pitch_lag;
-            if (fcb->x[fcb->n] < MAX_FRAMESIZE / 2)
-                fcb->n++;
-        }
-    } else {
-        int num2 = (val & 0x1FF) >> 1, delta, idx;
-
-        if (num2 < 1 * 79)      { delta = 1; idx = num2 + 1; }
-        else if (num2 < 2 * 78) { delta = 3; idx = num2 + 1 - 1 * 77; }
-        else if (num2 < 3 * 77) { delta = 5; idx = num2 + 1 - 2 * 76; }
-        else                    { delta = 7; idx = num2 + 1 - 3 * 75; }
-        v = (val & 0x200) ? -1.0 : 1.0;
-
-        fcb->no_repeat_mask |= 3 << fcb->n;
-        fcb->x[fcb->n]       = idx - delta;
-        fcb->y[fcb->n]       = v;
-        fcb->x[fcb->n + 1]   = idx;
-        fcb->y[fcb->n + 1]   = (val & 1) ? -v : v;
-        fcb->n              += 2;
-    }
-}
-
-/**
- * @}
- *
- * Generate a random number from frame_cntr and block_idx, which will lief
- * in the range [0, 1000 - block_size] (so it can be used as an index in a
- * table of size 1000 of which you want to read block_size entries).
- *
- * @param frame_cntr current frame number
- * @param block_num current block index
- * @param block_size amount of entries we want to read from a table
- *                   that has 1000 entries
- * @return a (non-)random number in the [0, 1000 - block_size] range.
- */
-static int pRNG(int frame_cntr, int block_num, int block_size)
-{
-    /* array to simplify the calculation of z:
-     * y = (x % 9) * 5 + 6;
-     * z = (49995 * x) / y;
-     * Since y only has 9 values, we can remove the division by using a
-     * LUT and using FASTDIV-style divisions. For each of the 9 values
-     * of y, we can rewrite z as:
-     * z = x * (49995 / y) + x * ((49995 % y) / y)
-     * In this table, each col represents one possible value of y, the
-     * first number is 49995 / y, and the second is the FASTDIV variant
-     * of 49995 % y / y. */
-    static const unsigned int div_tbl[9][2] = {
-        { 8332,  3 * 715827883U }, // y =  6
-        { 4545,  0 * 390451573U }, // y = 11
-        { 3124, 11 * 268435456U }, // y = 16
-        { 2380, 15 * 204522253U }, // y = 21
-        { 1922, 23 * 165191050U }, // y = 26
-        { 1612, 23 * 138547333U }, // y = 31
-        { 1388, 27 * 119304648U }, // y = 36
-        { 1219, 16 * 104755300U }, // y = 41
-        { 1086, 39 *  93368855U }  // y = 46
-    };
-    unsigned int z, y, x = MUL16(block_num, 1877) + frame_cntr;
-    if (x >= 0xFFFF) x -= 0xFFFF;   // max value of x is 8*1877+0xFFFE=0x13AA6,
-                                    // so this is effectively a modulo (%)
-    y = x - 9 * MULH(477218589, x); // x % 9
-    z = (uint16_t) (x * div_tbl[y][0] + UMULH(x, div_tbl[y][1]));
-                                    // z = x * 49995 / (y * 5 + 6)
-    return z % (1000 - block_size);
-}
-
-/**
- * Parse hardcoded signal for a single block.
- * @note see #synth_block().
- */
-static void synth_block_hardcoded(WMAVoiceContext *s, GetBitContext *gb,
-                                 int block_idx, int size,
-                                 const struct frame_type_desc *frame_desc,
-                                 float *excitation)
-{
-    float gain;
-    int n, r_idx;
-
-    assert(size <= MAX_FRAMESIZE);
-
-    /* Set the offset from which we start reading wmavoice_std_codebook */
-    if (frame_desc->fcb_type == FCB_TYPE_SILENCE) {
-        r_idx = pRNG(s->frame_cntr, block_idx, size);
-        gain  = s->silence_gain;
-    } else /* FCB_TYPE_HARDCODED */ {
-        r_idx = get_bits(gb, 8);
-        gain  = wmavoice_gain_universal[get_bits(gb, 6)];
-    }
-
-    /* Clear gain prediction parameters */
-    memset(s->gain_pred_err, 0, sizeof(s->gain_pred_err));
-
-    /* Apply gain to hardcoded codebook and use that as excitation signal */
-    for (n = 0; n < size; n++)
-        excitation[n] = wmavoice_std_codebook[r_idx + n] * gain;
-}
-
-/**
- * Parse FCB/ACB signal for a single block.
- * @note see #synth_block().
- */
-static void synth_block_fcb_acb(WMAVoiceContext *s, GetBitContext *gb,
-                                int block_idx, int size,
-                                int block_pitch_sh2,
-                                const struct frame_type_desc *frame_desc,
-                                float *excitation)
-{
-    static const float gain_coeff[6] = {
-        0.8169, -0.06545, 0.1726, 0.0185, -0.0359, 0.0458
-    };
-    float pulses[MAX_FRAMESIZE / 2], pred_err, acb_gain, fcb_gain;
-    int n, idx, gain_weight;
-    AMRFixed fcb;
-
-    assert(size <= MAX_FRAMESIZE / 2);
-    memset(pulses, 0, sizeof(*pulses) * size);
-
-    fcb.pitch_lag      = block_pitch_sh2 >> 2;
-    fcb.pitch_fac      = 1.0;
-    fcb.no_repeat_mask = 0;
-    fcb.n              = 0;
-
-    /* For the other frame types, this is where we apply the innovation
-     * (fixed) codebook pulses of the speech signal. */
-    if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {
-        aw_pulse_set1(s, gb, block_idx, &fcb);
-        aw_pulse_set2(s, gb, block_idx, &fcb);
-    } else /* FCB_TYPE_EXC_PULSES */ {
-        int offset_nbits = 5 - frame_desc->log_n_blocks;
-
-        fcb.no_repeat_mask = -1;
-        /* similar to ff_decode_10_pulses_35bits(), but with single pulses
-         * (instead of double) for a subset of pulses */
-        for (n = 0; n < 5; n++) {
-            float sign;
-            int pos1, pos2;
-
-            sign           = get_bits1(gb) ? 1.0 : -1.0;
-            pos1           = get_bits(gb, offset_nbits);
-            fcb.x[fcb.n]   = n + 5 * pos1;
-            fcb.y[fcb.n++] = sign;
-            if (n < frame_desc->dbl_pulses) {
-                pos2           = get_bits(gb, offset_nbits);
-                fcb.x[fcb.n]   = n + 5 * pos2;
-                fcb.y[fcb.n++] = (pos1 < pos2) ? -sign : sign;
-            }
-        }
-    }
-    ff_set_fixed_vector(pulses, &fcb, 1.0, size);
-
-    /* Calculate gain for adaptive & fixed codebook signal.
-     * see ff_amr_set_fixed_gain(). */
-    idx = get_bits(gb, 7);
-    fcb_gain = expf(ff_dot_productf(s->gain_pred_err, gain_coeff, 6) -
-                    5.2409161640 + wmavoice_gain_codebook_fcb[idx]);
-    acb_gain = wmavoice_gain_codebook_acb[idx];
-    pred_err = av_clipf(wmavoice_gain_codebook_fcb[idx],
-                        -2.9957322736 /* log(0.05) */,
-                         1.6094379124 /* log(5.0)  */);
-
-    gain_weight = 8 >> frame_desc->log_n_blocks;
-    memmove(&s->gain_pred_err[gain_weight], s->gain_pred_err,
-            sizeof(*s->gain_pred_err) * (6 - gain_weight));
-    for (n = 0; n < gain_weight; n++)
-        s->gain_pred_err[n] = pred_err;
-
-    /* Calculation of adaptive codebook */
-    if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) {
-        int len;
-        for (n = 0; n < size; n += len) {
-            int next_idx_sh16;
-            int abs_idx    = block_idx * size + n;
-            int pitch_sh16 = (s->last_pitch_val << 16) +
-                             s->pitch_diff_sh16 * abs_idx;
-            int pitch      = (pitch_sh16 + 0x6FFF) >> 16;
-            int idx_sh16   = ((pitch << 16) - pitch_sh16) * 8 + 0x58000;
-            idx            = idx_sh16 >> 16;
-            if (s->pitch_diff_sh16) {
-                if (s->pitch_diff_sh16 > 0) {
-                    next_idx_sh16 = (idx_sh16) &~ 0xFFFF;
-                } else
-                    next_idx_sh16 = (idx_sh16 + 0x10000) &~ 0xFFFF;
-                len = av_clip((idx_sh16 - next_idx_sh16) / s->pitch_diff_sh16 / 8,
-                              1, size - n);
-            } else
-                len = size;
-
-            ff_acelp_interpolatef(&excitation[n], &excitation[n - pitch],
-                                  wmavoice_ipol1_coeffs, 17,
-                                  idx, 9, len);
-        }
-    } else /* ACB_TYPE_HAMMING */ {
-        int block_pitch = block_pitch_sh2 >> 2;
-        idx             = block_pitch_sh2 & 3;
-        if (idx) {
-            ff_acelp_interpolatef(excitation, &excitation[-block_pitch],
-                                  wmavoice_ipol2_coeffs, 4,
-                                  idx, 8, size);
-        } else
-            av_memcpy_backptr(excitation, sizeof(float) * block_pitch,
-                              sizeof(float) * size);
-    }
-
-    /* Interpolate ACB/FCB and use as excitation signal */
-    ff_weighted_vector_sumf(excitation, excitation, pulses,
-                            acb_gain, fcb_gain, size);
-}
-
-/**
- * Parse data in a single block.
- * @note we assume enough bits are available, caller should check.
- *
- * @param s WMA Voice decoding context private data
- * @param gb bit I/O context
- * @param block_idx index of the to-be-read block
- * @param size amount of samples to be read in this block
- * @param block_pitch_sh2 pitch for this block << 2
- * @param lsps LSPs for (the end of) this frame
- * @param prev_lsps LSPs for the last frame
- * @param frame_desc frame type descriptor
- * @param excitation target memory for the ACB+FCB interpolated signal
- * @param synth target memory for the speech synthesis filter output
- * @return 0 on success, <0 on error.
- */
-static void synth_block(WMAVoiceContext *s, GetBitContext *gb,
-                        int block_idx, int size,
-                        int block_pitch_sh2,
-                        const double *lsps, const double *prev_lsps,
-                        const struct frame_type_desc *frame_desc,
-                        float *excitation, float *synth)
-{
-    double i_lsps[MAX_LSPS];
-    float lpcs[MAX_LSPS];
-    float fac;
-    int n;
-
-    if (frame_desc->acb_type == ACB_TYPE_NONE)
-        synth_block_hardcoded(s, gb, block_idx, size, frame_desc, excitation);
-    else
-        synth_block_fcb_acb(s, gb, block_idx, size, block_pitch_sh2,
-                            frame_desc, excitation);
-
-    /* convert interpolated LSPs to LPCs */
-    fac = (block_idx + 0.5) / frame_desc->n_blocks;
-    for (n = 0; n < s->lsps; n++) // LSF -> LSP
-        i_lsps[n] = cos(prev_lsps[n] + fac * (lsps[n] - prev_lsps[n]));
-    ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1);
-
-    /* Speech synthesis */
-    ff_celp_lp_synthesis_filterf(synth, lpcs, excitation, size, s->lsps);
-}
-
-/**
- * Synthesize output samples for a single frame.
- * @note we assume enough bits are available, caller should check.
- *
- * @param ctx WMA Voice decoder context
- * @param gb bit I/O context (s->gb or one for cross-packet superframes)
- * @param frame_idx Frame number within superframe [0-2]
- * @param samples pointer to output sample buffer, has space for at least 160
- *                samples
- * @param lsps LSP array
- * @param prev_lsps array of previous frame's LSPs
- * @param excitation target buffer for excitation signal
- * @param synth target buffer for synthesized speech data
- * @return 0 on success, <0 on error.
- */
-static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx,
-                       float *samples,
-                       const double *lsps, const double *prev_lsps,
-                       float *excitation, float *synth)
-{
-    WMAVoiceContext *s = ctx->priv_data;
-    int n, n_blocks_x2, log_n_blocks_x2, cur_pitch_val;
-    int pitch[MAX_BLOCKS], last_block_pitch;
-
-    /* Parse frame type ("frame header"), see frame_descs */
-    int bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)],
-        block_nsamples = MAX_FRAMESIZE / frame_descs[bd_idx].n_blocks;
-
-    if (bd_idx < 0) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Invalid frame type VLC code, skipping\n");
-        return -1;
-    }
-
-    /* Pitch calculation for ACB_TYPE_ASYMMETRIC ("pitch-per-frame") */
-    if (frame_descs[bd_idx].acb_type == ACB_TYPE_ASYMMETRIC) {
-        /* Pitch is provided per frame, which is interpreted as the pitch of
-         * the last sample of the last block of this frame. We can interpolate
-         * the pitch of other blocks (and even pitch-per-sample) by gradually
-         * incrementing/decrementing prev_frame_pitch to cur_pitch_val. */
-        n_blocks_x2      = frame_descs[bd_idx].n_blocks << 1;
-        log_n_blocks_x2  = frame_descs[bd_idx].log_n_blocks + 1;
-        cur_pitch_val    = s->min_pitch_val + get_bits(gb, s->pitch_nbits);
-        cur_pitch_val    = FFMIN(cur_pitch_val, s->max_pitch_val - 1);
-        if (s->last_acb_type == ACB_TYPE_NONE ||
-            20 * abs(cur_pitch_val - s->last_pitch_val) >
-                (cur_pitch_val + s->last_pitch_val))
-            s->last_pitch_val = cur_pitch_val;
-
-        /* pitch per block */
-        for (n = 0; n < frame_descs[bd_idx].n_blocks; n++) {
-            int fac = n * 2 + 1;
-
-            pitch[n] = (MUL16(fac,                 cur_pitch_val) +
-                        MUL16((n_blocks_x2 - fac), s->last_pitch_val) +
-                        frame_descs[bd_idx].n_blocks) >> log_n_blocks_x2;
-        }
-
-        /* "pitch-diff-per-sample" for calculation of pitch per sample */
-        s->pitch_diff_sh16 =
-            ((cur_pitch_val - s->last_pitch_val) << 16) / MAX_FRAMESIZE;
-    }
-
-    /* Global gain (if silence) and pitch-adaptive window coordinates */
-    switch (frame_descs[bd_idx].fcb_type) {
-    case FCB_TYPE_SILENCE:
-        s->silence_gain = wmavoice_gain_silence[get_bits(gb, 8)];
-        break;
-    case FCB_TYPE_AW_PULSES:
-        aw_parse_coords(s, gb, pitch);
-        break;
-    }
-
-    for (n = 0; n < frame_descs[bd_idx].n_blocks; n++) {
-        int bl_pitch_sh2;
-
-        /* Pitch calculation for ACB_TYPE_HAMMING ("pitch-per-block") */
-        switch (frame_descs[bd_idx].acb_type) {
-        case ACB_TYPE_HAMMING: {
-            /* Pitch is given per block. Per-block pitches are encoded as an
-             * absolute value for the first block, and then delta values
-             * relative to this value) for all subsequent blocks. The scale of
-             * this pitch value is semi-logaritmic compared to its use in the
-             * decoder, so we convert it to normal scale also. */
-            int block_pitch,
-                t1 = (s->block_conv_table[1] - s->block_conv_table[0]) << 2,
-                t2 = (s->block_conv_table[2] - s->block_conv_table[1]) << 1,
-                t3 =  s->block_conv_table[3] - s->block_conv_table[2] + 1;
-
-            if (n == 0) {
-                block_pitch = get_bits(gb, s->block_pitch_nbits);
-            } else
-                block_pitch = last_block_pitch - s->block_delta_pitch_hrange +
-                                 get_bits(gb, s->block_delta_pitch_nbits);
-            /* Convert last_ so that any next delta is within _range */
-            last_block_pitch = av_clip(block_pitch,
-                                       s->block_delta_pitch_hrange,
-                                       s->block_pitch_range -
-                                           s->block_delta_pitch_hrange);
-
-            /* Convert semi-log-style scale back to normal scale */
-            if (block_pitch < t1) {
-                bl_pitch_sh2 = (s->block_conv_table[0] << 2) + block_pitch;
-            } else {
-                block_pitch -= t1;
-                if (block_pitch < t2) {
-                    bl_pitch_sh2 =
-                        (s->block_conv_table[1] << 2) + (block_pitch << 1);
-                } else {
-                    block_pitch -= t2;
-                    if (block_pitch < t3) {
-                        bl_pitch_sh2 =
-                            (s->block_conv_table[2] + block_pitch) << 2;
-                    } else
-                        bl_pitch_sh2 = s->block_conv_table[3] << 2;
-                }
-            }
-            pitch[n] = bl_pitch_sh2 >> 2;
-            break;
-        }
-
-        case ACB_TYPE_ASYMMETRIC: {
-            bl_pitch_sh2 = pitch[n] << 2;
-            break;
-        }
-
-        default: // ACB_TYPE_NONE has no pitch
-            bl_pitch_sh2 = 0;
-            break;
-        }
-
-        synth_block(s, gb, n, block_nsamples, bl_pitch_sh2,
-                    lsps, prev_lsps, &frame_descs[bd_idx],
-                    &excitation[n * block_nsamples],
-                    &synth[n * block_nsamples]);
-    }
-
-    /* Averaging projection filter, if applicable. Else, just copy samples
-     * from synthesis buffer */
-    if (s->do_apf) {
-        double i_lsps[MAX_LSPS];
-        float lpcs[MAX_LSPS];
-
-        for (n = 0; n < s->lsps; n++) // LSF -> LSP
-            i_lsps[n] = cos(0.5 * (prev_lsps[n] + lsps[n]));
-        ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1);
-        postfilter(s, synth, samples, 80, lpcs,
-                   &s->zero_exc_pf[s->history_nsamples + MAX_FRAMESIZE * frame_idx],
-                   frame_descs[bd_idx].fcb_type, pitch[0]);
-
-        for (n = 0; n < s->lsps; n++) // LSF -> LSP
-            i_lsps[n] = cos(lsps[n]);
-        ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1);
-        postfilter(s, &synth[80], &samples[80], 80, lpcs,
-                   &s->zero_exc_pf[s->history_nsamples + MAX_FRAMESIZE * frame_idx + 80],
-                   frame_descs[bd_idx].fcb_type, pitch[0]);
-    } else
-        memcpy(samples, synth, 160 * sizeof(synth[0]));
-
-    /* Cache values for next frame */
-    s->frame_cntr++;
-    if (s->frame_cntr >= 0xFFFF) s->frame_cntr -= 0xFFFF; // i.e. modulo (%)
-    s->last_acb_type = frame_descs[bd_idx].acb_type;
-    switch (frame_descs[bd_idx].acb_type) {
-    case ACB_TYPE_NONE:
-        s->last_pitch_val = 0;
-        break;
-    case ACB_TYPE_ASYMMETRIC:
-        s->last_pitch_val = cur_pitch_val;
-        break;
-    case ACB_TYPE_HAMMING:
-        s->last_pitch_val = pitch[frame_descs[bd_idx].n_blocks - 1];
-        break;
-    }
-
-    return 0;
-}
-
-/**
- * Ensure minimum value for first item, maximum value for last value,
- * proper spacing between each value and proper ordering.
- *
- * @param lsps array of LSPs
- * @param num size of LSP array
- *
- * @note basically a double version of #ff_acelp_reorder_lsf(), might be
- *       useful to put in a generic location later on. Parts are also
- *       present in #ff_set_min_dist_lsf() + #ff_sort_nearly_sorted_floats(),
- *       which is in float.
- */
-static void stabilize_lsps(double *lsps, int num)
-{
-    int n, m, l;
-
-    /* set minimum value for first, maximum value for last and minimum
-     * spacing between LSF values.
-     * Very similar to ff_set_min_dist_lsf(), but in double. */
-    lsps[0]       = FFMAX(lsps[0],       0.0015 * M_PI);
-    for (n = 1; n < num; n++)
-        lsps[n]   = FFMAX(lsps[n],       lsps[n - 1] + 0.0125 * M_PI);
-    lsps[num - 1] = FFMIN(lsps[num - 1], 0.9985 * M_PI);
-
-    /* reorder (looks like one-time / non-recursed bubblesort).
-     * Very similar to ff_sort_nearly_sorted_floats(), but in double. */
-    for (n = 1; n < num; n++) {
-        if (lsps[n] < lsps[n - 1]) {
-            for (m = 1; m < num; m++) {
-                double tmp = lsps[m];
-                for (l = m - 1; l >= 0; l--) {
-                    if (lsps[l] <= tmp) break;
-                    lsps[l + 1] = lsps[l];
-                }
-                lsps[l + 1] = tmp;
-            }
-            break;
-        }
-    }
-}
-
-/**
- * Test if there's enough bits to read 1 superframe.
- *
- * @param orig_gb bit I/O context used for reading. This function
- *                does not modify the state of the bitreader; it
- *                only uses it to copy the current stream position
- * @param s WMA Voice decoding context private data
- * @return -1 if unsupported, 1 on not enough bits or 0 if OK.
- */
-static int check_bits_for_superframe(GetBitContext *orig_gb,
-                                     WMAVoiceContext *s)
-{
-    GetBitContext s_gb, *gb = &s_gb;
-    int n, need_bits, bd_idx;
-    const struct frame_type_desc *frame_desc;
-
-    /* initialize a copy */
-    init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
-    skip_bits_long(gb, get_bits_count(orig_gb));
-    assert(get_bits_left(gb) == get_bits_left(orig_gb));
-
-    /* superframe header */
-    if (get_bits_left(gb) < 14)
-        return 1;
-    if (!get_bits1(gb))
-        return -1;                        // WMAPro-in-WMAVoice superframe
-    if (get_bits1(gb)) skip_bits(gb, 12); // number of  samples in superframe
-    if (s->has_residual_lsps) {           // residual LSPs (for all frames)
-        if (get_bits_left(gb) < s->sframe_lsp_bitsize)
-            return 1;
-        skip_bits_long(gb, s->sframe_lsp_bitsize);
-    }
-
-    /* frames */
-    for (n = 0; n < MAX_FRAMES; n++) {
-        int aw_idx_is_ext = 0;
-
-        if (!s->has_residual_lsps) {     // independent LSPs (per-frame)
-           if (get_bits_left(gb) < s->frame_lsp_bitsize) return 1;
-           skip_bits_long(gb, s->frame_lsp_bitsize);
-        }
-        bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)];
-        if (bd_idx < 0)
-            return -1;                   // invalid frame type VLC code
-        frame_desc = &frame_descs[bd_idx];
-        if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) {
-            if (get_bits_left(gb) < s->pitch_nbits)
-                return 1;
-            skip_bits_long(gb, s->pitch_nbits);
-        }
-        if (frame_desc->fcb_type == FCB_TYPE_SILENCE) {
-            skip_bits(gb, 8);
-        } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {
-            int tmp = get_bits(gb, 6);
-            if (tmp >= 0x36) {
-                skip_bits(gb, 2);
-                aw_idx_is_ext = 1;
-            }
-        }
-
-        /* blocks */
-        if (frame_desc->acb_type == ACB_TYPE_HAMMING) {
-            need_bits = s->block_pitch_nbits +
-                (frame_desc->n_blocks - 1) * s->block_delta_pitch_nbits;
-        } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {
-            need_bits = 2 * !aw_idx_is_ext;
-        } else
-            need_bits = 0;
-        need_bits += frame_desc->frame_size;
-        if (get_bits_left(gb) < need_bits)
-            return 1;
-        skip_bits_long(gb, need_bits);
-    }
-
-    return 0;
-}
-
-/**
- * Synthesize output samples for a single superframe. If we have any data
- * cached in s->sframe_cache, that will be used instead of whatever is loaded
- * in s->gb.
- *
- * WMA Voice superframes contain 3 frames, each containing 160 audio samples,
- * to give a total of 480 samples per frame. See #synth_frame() for frame
- * parsing. In addition to 3 frames, superframes can also contain the LSPs
- * (if these are globally specified for all frames (residually); they can
- * also be specified individually per-frame. See the s->has_residual_lsps
- * option), and can specify the number of samples encoded in this superframe
- * (if less than 480), usually used to prevent blanks at track boundaries.
- *
- * @param ctx WMA Voice decoder context
- * @param samples pointer to output buffer for voice samples
- * @param data_size pointer containing the size of #samples on input, and the
- *                  amount of #samples filled on output
- * @return 0 on success, <0 on error or 1 if there was not enough data to
- *         fully parse the superframe
- */
-static int synth_superframe(AVCodecContext *ctx,
-                            float *samples, int *data_size)
-{
-    WMAVoiceContext *s = ctx->priv_data;
-    GetBitContext *gb = &s->gb, s_gb;
-    int n, res, n_samples = 480;
-    double lsps[MAX_FRAMES][MAX_LSPS];
-    const double *mean_lsf = s->lsps == 16 ?
-        wmavoice_mean_lsf16[s->lsp_def_mode] : wmavoice_mean_lsf10[s->lsp_def_mode];
-    float excitation[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE + 12];
-    float synth[MAX_LSPS + MAX_SFRAMESIZE];
-
-    memcpy(synth,      s->synth_history,
-           s->lsps             * sizeof(*synth));
-    memcpy(excitation, s->excitation_history,
-           s->history_nsamples * sizeof(*excitation));
-
-    if (s->sframe_cache_size > 0) {
-        gb = &s_gb;
-        init_get_bits(gb, s->sframe_cache, s->sframe_cache_size);
-        s->sframe_cache_size = 0;
-    }
-
-    if ((res = check_bits_for_superframe(gb, s)) == 1) return 1;
-
-    /* First bit is speech/music bit, it differentiates between WMAVoice
-     * speech samples (the actual codec) and WMAVoice music samples, which
-     * are really WMAPro-in-WMAVoice-superframes. I've never seen those in
-     * the wild yet. */
-    if (!get_bits1(gb)) {
-        av_log_missing_feature(ctx, "WMAPro-in-WMAVoice support", 1);
-        return -1;
-    }
-
-    /* (optional) nr. of samples in superframe; always <= 480 and >= 0 */
-    if (get_bits1(gb)) {
-        if ((n_samples = get_bits(gb, 12)) > 480) {
-            av_log(ctx, AV_LOG_ERROR,
-                   "Superframe encodes >480 samples (%d), not allowed\n",
-                   n_samples);
-            return -1;
-        }
-    }
-    /* Parse LSPs, if global for the superframe (can also be per-frame). */
-    if (s->has_residual_lsps) {
-        double prev_lsps[MAX_LSPS], a1[MAX_LSPS * 2], a2[MAX_LSPS * 2];
-
-        for (n = 0; n < s->lsps; n++)
-            prev_lsps[n] = s->prev_lsps[n] - mean_lsf[n];
-
-        if (s->lsps == 10) {
-            dequant_lsp10r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode);
-        } else /* s->lsps == 16 */
-            dequant_lsp16r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode);
-
-        for (n = 0; n < s->lsps; n++) {
-            lsps[0][n]  = mean_lsf[n] + (a1[n]           - a2[n * 2]);
-            lsps[1][n]  = mean_lsf[n] + (a1[s->lsps + n] - a2[n * 2 + 1]);
-            lsps[2][n] += mean_lsf[n];
-        }
-        for (n = 0; n < 3; n++)
-            stabilize_lsps(lsps[n], s->lsps);
-    }
-
-    /* Parse frames, optionally preceeded by per-frame (independent) LSPs. */
-    for (n = 0; n < 3; n++) {
-        if (!s->has_residual_lsps) {
-            int m;
-
-            if (s->lsps == 10) {
-                dequant_lsp10i(gb, lsps[n]);
-            } else /* s->lsps == 16 */
-                dequant_lsp16i(gb, lsps[n]);
-
-            for (m = 0; m < s->lsps; m++)
-                lsps[n][m] += mean_lsf[m];
-            stabilize_lsps(lsps[n], s->lsps);
-        }
-
-        if ((res = synth_frame(ctx, gb, n,
-                               &samples[n * MAX_FRAMESIZE],
-                               lsps[n], n == 0 ? s->prev_lsps : lsps[n - 1],
-                               &excitation[s->history_nsamples + n * MAX_FRAMESIZE],
-                               &synth[s->lsps + n * MAX_FRAMESIZE])))
-            return res;
-    }
-
-    /* Statistics? FIXME - we don't check for length, a slight overrun
-     * will be caught by internal buffer padding, and anything else
-     * will be skipped, not read. */
-    if (get_bits1(gb)) {
-        res = get_bits(gb, 4);
-        skip_bits(gb, 10 * (res + 1));
-    }
-
-    /* Specify nr. of output samples */
-    *data_size = n_samples * sizeof(float);
-
-    /* Update history */
-    memcpy(s->prev_lsps,           lsps[2],
-           s->lsps             * sizeof(*s->prev_lsps));
-    memcpy(s->synth_history,      &synth[MAX_SFRAMESIZE],
-           s->lsps             * sizeof(*synth));
-    memcpy(s->excitation_history, &excitation[MAX_SFRAMESIZE],
-           s->history_nsamples * sizeof(*excitation));
-    if (s->do_apf)
-        memmove(s->zero_exc_pf,       &s->zero_exc_pf[MAX_SFRAMESIZE],
-                s->history_nsamples * sizeof(*s->zero_exc_pf));
-
-    return 0;
-}
-
-/**
- * Parse the packet header at the start of each packet (input data to this
- * decoder).
- *
- * @param s WMA Voice decoding context private data
- * @return 1 if not enough bits were available, or 0 on success.
- */
-static int parse_packet_header(WMAVoiceContext *s)
-{
-    GetBitContext *gb = &s->gb;
-    unsigned int res;
-
-    if (get_bits_left(gb) < 11)
-        return 1;
-    skip_bits(gb, 4);          // packet sequence number
-    s->has_residual_lsps = get_bits1(gb);
-    do {
-        res = get_bits(gb, 6); // number of superframes per packet
-                               // (minus first one if there is spillover)
-        if (get_bits_left(gb) < 6 * (res == 0x3F) + s->spillover_bitsize)
-            return 1;
-    } while (res == 0x3F);
-    s->spillover_nbits   = get_bits(gb, s->spillover_bitsize);
-
-    return 0;
-}
-
-/**
- * Copy (unaligned) bits from gb/data/size to pb.
- *
- * @param pb target buffer to copy bits into
- * @param data source buffer to copy bits from
- * @param size size of the source data, in bytes
- * @param gb bit I/O context specifying the current position in the source.
- *           data. This function might use this to align the bit position to
- *           a whole-byte boundary before calling #ff_copy_bits() on aligned
- *           source data
- * @param nbits the amount of bits to copy from source to target
- *
- * @note after calling this function, the current position in the input bit
- *       I/O context is undefined.
- */
-static void copy_bits(PutBitContext *pb,
-                      const uint8_t *data, int size,
-                      GetBitContext *gb, int nbits)
-{
-    int rmn_bytes, rmn_bits;
-
-    rmn_bits = rmn_bytes = get_bits_left(gb);
-    if (rmn_bits < nbits)
-        return;
-    rmn_bits &= 7; rmn_bytes >>= 3;
-    if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0)
-        put_bits(pb, rmn_bits, get_bits(gb, rmn_bits));
-    ff_copy_bits(pb, data + size - rmn_bytes,
-                 FFMIN(nbits - rmn_bits, rmn_bytes << 3));
-}
-
-/**
- * Packet decoding: a packet is anything that the (ASF) demuxer contains,
- * and we expect that the demuxer / application provides it to us as such
- * (else you'll probably get garbage as output). Every packet has a size of
- * ctx->block_align bytes, starts with a packet header (see
- * #parse_packet_header()), and then a series of superframes. Superframe
- * boundaries may exceed packets, i.e. superframes can split data over
- * multiple (two) packets.
- *
- * For more information about frames, see #synth_superframe().
- */
-static int wmavoice_decode_packet(AVCodecContext *ctx, void *data,
-                                  int *data_size, AVPacket *avpkt)
-{
-    WMAVoiceContext *s = ctx->priv_data;
-    GetBitContext *gb = &s->gb;
-    int size, res, pos;
-
-    if (*data_size < 480 * sizeof(float)) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Output buffer too small (%d given - %lu needed)\n",
-               *data_size, 480 * sizeof(float));
-        return -1;
-    }
-    *data_size = 0;
-
-    /* Packets are sometimes a multiple of ctx->block_align, with a packet
-     * header at each ctx->block_align bytes. However, FFmpeg's ASF demuxer
-     * feeds us ASF packets, which may concatenate multiple "codec" packets
-     * in a single "muxer" packet, so we artificially emulate that by
-     * capping the packet size at ctx->block_align. */
-    for (size = avpkt->size; size > ctx->block_align; size -= ctx->block_align);
-    if (!size)
-        return 0;
-    init_get_bits(&s->gb, avpkt->data, size << 3);
-
-    /* size == ctx->block_align is used to indicate whether we are dealing with
-     * a new packet or a packet of which we already read the packet header
-     * previously. */
-    if (size == ctx->block_align) { // new packet header
-        if ((res = parse_packet_header(s)) < 0)
-            return res;
-
-        /* If the packet header specifies a s->spillover_nbits, then we want
-         * to push out all data of the previous packet (+ spillover) before
-         * continuing to parse new superframes in the current packet. */
-        if (s->spillover_nbits > 0) {
-            if (s->sframe_cache_size > 0) {
-                int cnt = get_bits_count(gb);
-                copy_bits(&s->pb, avpkt->data, size, gb, s->spillover_nbits);
-                flush_put_bits(&s->pb);
-                s->sframe_cache_size += s->spillover_nbits;
-                if ((res = synth_superframe(ctx, data, data_size)) == 0 &&
-                    *data_size > 0) {
-                    cnt += s->spillover_nbits;
-                    s->skip_bits_next = cnt & 7;
-                    return cnt >> 3;
-                } else
-                    skip_bits_long (gb, s->spillover_nbits - cnt +
-                                    get_bits_count(gb)); // resync
-            } else
-                skip_bits_long(gb, s->spillover_nbits);  // resync
-        }
-    } else if (s->skip_bits_next)
-        skip_bits(gb, s->skip_bits_next);
-
-    /* Try parsing superframes in current packet */
-    s->sframe_cache_size = 0;
-    s->skip_bits_next = 0;
-    pos = get_bits_left(gb);
-    if ((res = synth_superframe(ctx, data, data_size)) < 0) {
-        return res;
-    } else if (*data_size > 0) {
-        int cnt = get_bits_count(gb);
-        s->skip_bits_next = cnt & 7;
-        return cnt >> 3;
-    } else if ((s->sframe_cache_size = pos) > 0) {
-        /* rewind bit reader to start of last (incomplete) superframe... */
-        init_get_bits(gb, avpkt->data, size << 3);
-        skip_bits_long(gb, (size << 3) - pos);
-        assert(get_bits_left(gb) == pos);
-
-        /* ...and cache it for spillover in next packet */
-        init_put_bits(&s->pb, s->sframe_cache, SFRAME_CACHE_MAXSIZE);
-        copy_bits(&s->pb, avpkt->data, size, gb, s->sframe_cache_size);
-        // FIXME bad - just copy bytes as whole and add use the
-        // skip_bits_next field
-    }
-
-    return size;
-}
-
-static av_cold int wmavoice_decode_end(AVCodecContext *ctx)
-{
-    WMAVoiceContext *s = ctx->priv_data;
-
-    if (s->do_apf) {
-        ff_rdft_end(&s->rdft);
-        ff_rdft_end(&s->irdft);
-        ff_dct_end(&s->dct);
-        ff_dct_end(&s->dst);
-    }
-
-    return 0;
-}
-
-static av_cold void wmavoice_flush(AVCodecContext *ctx)
-{
-    WMAVoiceContext *s = ctx->priv_data;
-    int n;
-
-    s->postfilter_agc    = 0;
-    s->sframe_cache_size = 0;
-    s->skip_bits_next    = 0;
-    for (n = 0; n < s->lsps; n++)
-        s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0);
-    memset(s->excitation_history, 0,
-           sizeof(*s->excitation_history) * MAX_SIGNAL_HISTORY);
-    memset(s->synth_history,      0,
-           sizeof(*s->synth_history)      * MAX_LSPS);
-    memset(s->gain_pred_err,      0,
-           sizeof(s->gain_pred_err));
-
-    if (s->do_apf) {
-        memset(&s->synth_filter_out_buf[MAX_LSPS_ALIGN16 - s->lsps], 0,
-               sizeof(*s->synth_filter_out_buf) * s->lsps);
-        memset(s->dcf_mem,              0,
-               sizeof(*s->dcf_mem)              * 2);
-        memset(s->zero_exc_pf,          0,
-               sizeof(*s->zero_exc_pf)          * s->history_nsamples);
-        memset(s->denoise_filter_cache, 0, sizeof(s->denoise_filter_cache));
-    }
-}
-
-AVCodec wmavoice_decoder = {
-    "wmavoice",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAVOICE,
-    sizeof(WMAVoiceContext),
-    wmavoice_decode_init,
-    NULL,
-    wmavoice_decode_end,
-    wmavoice_decode_packet,
-    CODEC_CAP_SUBFRAMES,
-    .flush     = wmavoice_flush,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),
-};
diff --git a/libavcodec/wmavoice_data.h b/libavcodec/wmavoice_data.h
deleted file mode 100644
index cbf65b0..0000000
--- a/libavcodec/wmavoice_data.h
+++ /dev/null
@@ -1,3259 +0,0 @@
-/*
- * Windows Media Voice (WMAVoice) tables.
- * Copyright (c) 2009 Ronald S. Bultje
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Windows Media Voice (WMAVoice) tables
- * @author Ronald S. Bultje <rsbultje at gmail.com>
- */
-
-#ifndef AVCODEC_WMAVOICE_DATA_H
-#define AVCODEC_WMAVOICE_DATA_H
-
-#include <stdint.h>
-
-static const uint8_t wmavoice_dq_lsp10i[0xf00] = {
-    125, 109,  84,  55,  34,  51, 109, 112, 118, 132,
-    122, 102,  78,  80, 132, 119, 132, 132, 125, 131,
-    109,  91, 131, 131, 136, 136, 137, 137, 140, 145,
-    140, 143, 117, 136, 122, 106, 109,  91, 115, 119,
-    133, 117, 103,  80,  55, 117, 123, 102,  93,  80,
-    139, 116,  70,  39,  95,  89, 103, 113, 112, 122,
-    135, 244, 229, 215, 199, 181, 163, 150, 146, 144,
-    143, 173, 171, 154, 155, 154, 151, 148, 145, 143,
-    132, 138, 116,  85, 117,  94, 108, 117, 107, 116,
-    132, 118, 123, 119,  88,  67,  49,  95,  84,  95,
-    121, 103,  74,  70, 179, 164, 141, 126, 107, 112,
-    119,  95, 103, 149, 139, 148, 144, 147, 148, 141,
-    151, 133, 142, 129, 111, 131, 108, 128, 122, 108,
-    121,  96, 115, 138, 116,  93, 105, 115, 115, 123,
-    129, 106, 136, 180, 147, 130, 108, 141, 131, 118,
-    136, 155, 176, 156, 135, 129, 140, 146, 142, 134,
-    141, 130, 109,  80,  52,  38,  18,  47, 118, 134,
-    155, 141, 100,  78,  72,  89,  79,  96,  92,  98,
-    133, 111,  83,  91,  72,  58, 105, 115, 112, 120,
-    145, 127, 135, 113, 113, 105, 105,  85,  69,  61,
-    115,  96, 116, 145, 159, 170, 175, 175, 168, 155,
-    140, 120,  84,  52,  80, 145, 125, 127, 116, 126,
-    128, 108, 101, 198, 227, 200, 178, 159, 147, 148,
-    121,  88,  46, 109, 124, 126, 126, 137, 147, 147,
-    129, 107, 164, 148, 127, 117, 134, 120, 111, 116,
-    120, 103,  98,  73,  66,  61,  70, 115, 116, 125,
-    126, 100,  77, 188, 162, 140, 114, 128, 139, 123,
-    145, 165, 164, 134, 109, 100, 108, 118, 127, 130,
-    156, 182, 190, 173, 167, 165, 162, 157, 152, 147,
-    150, 164, 179, 183, 173, 155, 140, 136, 134, 135,
-    122,  92,  69, 140, 132, 118, 108, 128, 138, 132,
-    123, 127, 148, 137, 150, 149, 139, 127, 124, 130,
-    136, 138, 112,  70,  41,  37, 132, 140, 129, 125,
-    130, 111,  78,  33,  51, 161, 141, 136, 120, 122,
-    126, 110,  87, 106,  85,  68,  48,  81, 112, 113,
-    135, 125,  98,  85, 102,  80, 100,  87,  86, 116,
-    142, 133, 110,  66,  48, 152, 139, 135, 136, 123,
-    128, 116,  89, 102, 128,  99,  83,  61, 105, 124,
-    120,  94,  73,  83,  78, 100, 122, 124, 128, 132,
-    144, 137, 116, 102,  75, 144, 136, 127, 140, 127,
-    154, 144, 118,  99,  90,  90,  89,  75,  68,  83,
-    123, 103,  89, 198, 180, 154, 138, 122, 136, 120,
-    138, 118, 121, 136, 110, 105,  85, 111, 101, 104,
-    121, 126, 139, 115,  99, 101, 107, 110, 123, 126,
-    127, 115,  88, 109, 164, 134, 138, 138, 120, 121,
-    130, 202, 195, 202, 199, 201, 181, 164, 159, 148,
-    120, 116, 194, 199, 186, 171, 154, 142, 137, 133,
-    137, 129, 112, 149, 134, 112, 149, 138, 120, 134,
-    119, 102, 107,  83,  79, 114, 119, 127, 128, 128,
-    144, 148, 165, 155, 161, 150, 135, 122, 116, 115,
-    120,  99,  80, 120, 123, 124, 111,  89,  70, 108,
-    118,  95,  66,  53, 105, 126, 125, 105,  83, 111,
-    129, 197, 191, 197, 206, 213, 216, 208, 196, 169,
-    133, 109, 127, 164, 134, 121,  99,  92,  82,  71,
-    131, 121,  93,  91, 136, 105, 115, 140, 120, 110,
-    150, 164, 139, 108,  87,  81,  93,  92, 104, 116,
-    133, 114, 125, 126, 111, 136, 110, 156, 147, 133,
-    113,  94, 118, 120, 115, 125, 124, 126, 127, 134,
-    116, 131, 161, 158, 166, 157, 150, 150, 144, 141,
-    125, 185, 169, 142, 140, 143, 139, 131, 134, 138,
-    179, 188, 170, 150, 134, 140, 144, 133, 127, 127,
-    150, 177, 204, 184, 192, 194, 190, 193, 177, 158,
-    114, 113, 138, 116, 137, 135, 132, 131, 127, 134,
-    120, 147, 163, 135, 133, 137, 136, 136, 133, 135,
-    137, 120,  95,  73,  46,  48, 111,  97,  97, 123,
-    139, 130, 109,  76,  52,  72,  61,  61, 125, 127,
-    132, 119, 119,  90,  66,  41,  64, 156, 143, 129,
-    131, 106,  58,  25,  99, 115, 122, 136, 129, 132,
-    134, 123,  97,  53,  27, 114, 125, 114, 120, 123,
-    122, 107,  93,  57,  47, 133, 128, 138, 141, 131,
-    145, 132, 122, 110,  79,  57,  30,  73, 153, 144,
-    150, 132,  85,  59, 133, 125, 130, 115, 100,  96,
-    148, 127, 111,  86,  61,  38, 110, 121, 108,  99,
-    157, 143, 105,  77, 116, 118, 115, 131, 122, 122,
-    133, 119, 134, 108,  86,  61, 129, 165, 143, 127,
-    125, 105,  89, 111,  97,  85, 113,  99,  98, 117,
-    149, 131, 101, 106,  88,  95,  79, 119, 123, 120,
-    125, 109,  81, 100, 201, 183, 156, 138, 115, 116,
-    141, 119, 129, 105,  76,  60, 110,  99,  92,  82,
-    150, 156, 129,  95,  69, 115, 115, 113, 134, 125,
-    118,  97,  67,  96, 203, 197, 171, 151, 133, 125,
-    143, 131, 120, 134, 105,  80,  51,  60, 139, 134,
-    129, 160, 223, 219, 219, 212, 197, 173, 157, 146,
-    132, 112, 164, 144, 119, 102,  92,  76,  73,  94,
-    132, 112, 124, 114,  93,  92,  83,  73,  69,  99,
-    129, 103, 188, 163, 142, 132, 127, 101,  82,  59,
-    140, 141, 111,  74,  46, 105, 113,  99, 127, 122,
-    125,  94,  63, 112, 116, 101,  81, 120, 136, 134,
-    133, 190, 224, 193, 179, 158, 146, 143, 140, 136,
-    152, 161, 132, 120, 112,  94, 114, 102,  92, 116,
-    129, 194, 196, 202, 211, 212, 210, 190, 169, 152,
-    166, 166, 145, 111,  91, 132, 133, 128, 136, 130,
-    118,  94,  72,  74,  92,  86,  89,  92, 106, 123,
-    126, 100,  86, 137, 117,  92,  76, 104, 106, 114,
-    133, 109, 204, 192, 166, 148, 138, 128, 111,  81,
-    118,  99,  79, 146, 169, 141, 123, 102, 131, 120,
-    127, 105, 136, 204, 170, 154, 131, 145, 135, 119,
-    117,  95,  64,  83, 141, 136, 118,  96,  99, 126,
-    115,  93,  98, 102,  95, 105, 106, 114, 119, 128,
-    131, 121,  98, 139, 149, 119, 109,  86, 105, 129,
-    134, 119, 104, 169, 185, 155, 141, 122, 107, 127,
-    136, 115,  85, 108,  87, 126, 102, 128, 136, 129,
-    125,  99, 126, 158, 133, 139, 132, 113,  91, 107,
-    141, 122, 128, 161, 130, 127, 105, 120, 118, 106,
-    122, 140, 161, 168, 187, 184, 176, 158, 144, 140,
-    127, 111,  89, 130, 132, 105, 134, 121, 100, 122,
-    129, 110, 128, 115, 129, 116, 132, 118, 114, 119,
-    138, 133, 132, 188, 183, 159, 161, 147, 134, 140,
-    132, 113,  84, 167, 147, 132, 124, 109, 133, 121,
-    132, 128, 116, 121,  98, 101, 145, 129, 128, 129,
-    124, 112, 152, 158, 136, 161, 139, 165, 158, 142,
-    139, 138, 110, 127, 148, 117, 126, 118, 101, 116,
-    155, 168, 154, 128, 120, 152, 150, 141, 140, 135,
-    127, 111, 109, 134, 104, 133, 110, 112, 132, 114,
-    111,  87,  68,  89, 107, 121, 121, 126, 126, 129,
-    120, 148, 169, 163, 173, 178, 185, 188, 178, 163,
-    122,  97,  86, 117, 101, 138, 118, 142, 155, 139,
-    125, 114, 131, 138, 153, 149, 163, 150, 143, 141,
-    157, 161, 138, 152, 134, 121, 122, 109, 110, 124,
-    151, 171, 196, 168, 145, 139, 147, 151, 146, 139,
-    134, 169, 179, 170, 175, 178, 177, 173, 165, 154,
-    120, 151, 118, 107, 125, 129, 133, 133, 136, 139,
-    119, 141, 159, 151, 160, 165, 168, 169, 162, 152,
-    115, 111, 119,  94, 117, 121, 127, 127, 132, 136,
-    134, 153, 147, 142, 142, 147, 159, 159, 154, 147,
-    110, 106, 139, 135, 143, 142, 147, 146, 147, 147,
-    115, 133, 151, 133, 141, 142, 151, 152, 147, 144,
-    115, 132, 144, 131, 125, 126, 128, 130, 131, 136,
-    138, 118,  96,  71,  48,  26,  43, 130, 125, 125,
-    134, 122,  98,  54,  28,  84,  77,  73, 109, 125,
-    133, 112,  67,  48, 141, 129, 126, 113, 112, 118,
-    143, 123,  89,  54,  71,  73,  75, 131, 123, 123,
-    126, 109,  81,  31,  15,  94, 110, 109, 119, 128,
-    132, 122,  97,  92,  73,  50,  27,  22, 104, 133,
-    133, 119,  94,  48,  34, 168, 160, 154, 151, 130,
-    147, 133,  90,  54,  71, 123, 106, 105,  93, 117,
-    143, 132, 107,  69,  45,  78, 178, 169, 150, 139,
-    138, 123, 116,  96,  69,  49,  32, 113, 103, 112,
-    154, 151, 125,  79,  60, 152, 160, 154, 155, 137,
-    142, 151, 124,  88,  66,  59,  94,  87,  95, 119,
-    166, 154, 122,  92, 138, 132, 124, 114,  97,  97,
-    122,  99,  98, 219, 191, 176, 165, 159, 153, 131,
-    130, 119,  91,  51,  24,  41, 144, 156, 147, 139,
-    139, 122,  81,  65, 124, 111, 104,  90,  94,  98,
-    138, 120, 112,  91,  63,  65,  89,  75,  78, 106,
-    126, 107,  91,  85,  69,  95,  90,  84, 108, 120,
-    155, 139, 100,  78, 120, 110, 109,  91,  77,  73,
-    144, 130, 135, 112,  88,  65,  62, 142, 129, 126,
-    170, 154, 150, 131, 121, 116, 100,  92,  83,  86,
-    131, 122,  98, 107, 102,  75,  54,  38, 117, 130,
-    146, 139, 117, 107,  86,  66,  44,  30,  97, 128,
-    129, 116, 100,  59, 108, 127, 119, 139, 129, 129,
-    124, 106,  79,  49, 154, 190, 166, 152, 133, 123,
-    141, 149, 123,  89,  61,  70, 143, 132, 125, 126,
-    136, 113, 177, 166, 141, 123, 109, 108, 105,  93,
-    137, 117, 147, 123,  99,  85, 109,  98,  91,  75,
-    129, 121, 102,  78,  53,  90, 149, 136, 134, 135,
-    144, 136, 126,  90, 114, 152, 137, 152, 138, 128,
-    133, 115, 107, 129,  99,  78,  60, 129, 125, 118,
-    147, 141, 119, 124, 110,  91,  79,  64, 106, 117,
-    134, 111, 164, 143, 123, 113, 116,  95,  76,  56,
-    147, 159, 140, 109,  83,  84, 140, 135, 127, 129,
-    123, 104, 116,  99,  91,  87,  80, 110, 113, 121,
-    124, 106, 174, 174, 152, 141, 132, 134, 126, 124,
-    140, 190, 240, 215, 212, 189, 173, 158, 144, 137,
-    123,  97,  79, 102, 110, 111,  90,  75, 126, 124,
-    134, 121, 104, 145, 127, 100,  77,  65, 120, 118,
-    123, 106,  87,  41,  68, 119, 106, 115, 109, 119,
-    137, 232, 241, 225, 217, 202, 183, 169, 156, 145,
-    161, 146, 127, 110,  97, 107,  88, 114, 108, 106,
-    141, 244, 216, 192, 172, 163, 148, 143, 144, 144,
-    128, 127, 109,  89,  77,  68, 124, 120, 121, 125,
-    125,  94,  48,  71, 116, 113, 104, 120, 142, 137,
-    133, 129, 115,  82,  68, 120,  99, 133, 134, 124,
-    130, 106, 108, 160, 130, 111,  89, 129, 124, 119,
-    134, 120, 149, 143, 116,  95,  87, 142, 132, 122,
-    126, 114, 108, 107,  80, 141, 133, 123, 137, 124,
-    117,  95,  69,  43,  62,  98, 114, 116, 112, 120,
-    122,  99,  87, 164, 145, 123,  99,  95, 118, 105,
-    126, 101, 102, 120, 113, 110,  92, 139, 134, 126,
-    148, 194, 241, 219, 221, 215, 200, 193, 174, 151,
-    127, 104, 122, 136, 113, 106, 110,  95,  78, 106,
-    131, 163, 217, 199, 194, 175, 164, 155, 142, 138,
-    139, 124,  88,  57, 161, 161, 145, 139, 124, 116,
-    127, 110,  91,  98, 126, 104, 113,  98,  94,  94,
-    145, 138, 114,  90,  75, 130, 117, 107,  99,  90,
-    119,  98,  86, 101, 148, 133, 103,  83, 124, 131,
-    143, 168, 169, 133, 110, 117, 139, 149, 147, 137,
-    124, 106,  80, 138, 194, 163, 142, 119, 106, 130,
-    136, 125, 105, 114,  87, 113, 101,  89, 108, 102,
-    114,  90,  53,  46, 105, 116, 126, 122, 118, 122,
-    124, 102,  92, 195, 167, 160, 144, 154, 154, 132,
-    118,  97,  88,  72,  98, 120, 112,  98,  79, 117,
-    114, 107, 185, 191, 191, 188, 175, 165, 153, 143,
-    119,  97,  90,  89, 120, 151, 136, 113,  99, 112,
-    141, 121, 144, 122, 125, 113, 133, 111,  92,  69,
-    120,  98,  78, 109, 151, 145, 157, 157, 151, 143,
-    130, 110, 120, 188, 159, 141, 119, 112, 109,  98,
-    126, 112,  83, 110, 169, 139, 127, 105,  93, 123,
-    141, 145, 117, 106,  91,  78, 123, 107, 101, 125,
-    117,  95,  71, 147, 176, 153, 148, 133, 135, 127,
-    124, 106,  79,  64, 115,  96, 108, 115, 106, 105,
-    127, 115,  90,  98, 105,  81, 144, 135, 117, 125,
-    126, 104,  98, 165, 138, 136, 112, 149, 148, 131,
-    119, 144, 186, 185, 204, 202, 209, 200, 182, 161,
-    123, 153, 190, 189, 199, 194, 191, 176, 157, 147,
-    121, 103, 119,  98, 100, 120, 106,  97,  95, 126,
-    137, 130, 102, 117, 117,  92, 126, 114, 101, 118,
-    131, 219, 190, 167, 153, 151, 144, 140, 142, 143,
-    114, 102, 151, 152, 132, 120, 112, 120, 127, 131,
-    138, 122,  91, 143, 118, 120, 114, 104, 124, 117,
-    148, 142, 117, 126,  97, 125, 108, 116, 142, 125,
-    126, 106,  91, 169, 208, 178, 158, 138, 127, 135,
-    133, 126, 101,  83, 147, 130, 125, 117, 114, 117,
-    120, 103,  94, 149, 136, 129, 139, 118, 133, 133,
-    147, 152, 126, 132, 119,  97, 132, 129, 114, 126,
-    112, 107, 148, 125, 112, 114, 124, 125, 129, 135,
-    139, 121, 157, 151, 131, 140, 118, 147, 136, 121,
-    115, 105, 159, 167, 185, 191, 196, 190, 176, 160,
-    124, 106, 104, 122, 130, 114, 152, 144, 134, 136,
-    136, 152, 159, 153, 131, 114, 116, 126, 129, 129,
-    124, 109,  87, 131, 107, 115, 130, 107, 144, 131,
-    126, 162, 176, 175, 180, 176, 160, 141, 134, 134,
-    136, 127, 108, 161, 162, 133, 141, 124, 112, 128,
-    130, 115, 110, 140, 107, 155, 134, 131, 156, 137,
-    122, 106, 116, 127, 118, 161, 150, 170, 167, 152,
-    139, 177, 203, 176, 155, 139, 130, 128, 129, 132,
-    137, 119, 125, 103, 110, 123, 107, 120, 108, 101,
-    113, 107, 160, 154, 160, 166, 169, 176, 168, 156,
-    115,  90,  65, 115, 115, 104, 120, 112, 109, 124,
-    131, 123, 100, 109, 185, 158, 141, 132, 116, 119,
-    139, 130, 119, 156, 124, 138, 127, 116, 141, 128,
-    133, 118, 115, 180, 149, 151, 135, 130, 147, 129,
-    117,  90,  80, 119, 124, 128, 132, 130, 128, 135,
-    112,  97, 142, 161, 167, 165, 154, 142, 136, 135,
-    118, 141, 193, 172, 157, 152, 148, 145, 146, 141,
-    125, 147, 165, 166, 149, 133, 123, 122, 128, 131,
-    128, 193, 177, 174, 182, 186, 197, 193, 191, 173,
-    124, 144, 162, 133, 113, 113, 123, 128, 129, 130,
-    117,  98, 121, 122, 137, 132, 110,  97, 111, 130,
-    128, 176, 151, 125, 126, 134, 130, 121, 127, 130,
-    122, 151, 142, 111, 106, 121, 126, 126, 130, 134,
-    148, 167, 186, 153, 129, 122, 124, 128, 130, 128,
-    148, 172, 206, 178, 171, 182, 169, 180, 172, 156,
-    133, 164, 174, 160, 155, 163, 163, 172, 169, 158,
-    132, 150, 147, 142, 152, 140, 140, 140, 134, 135,
-    137, 158, 167, 172, 163, 153, 169, 158, 146, 147,
-    150, 161, 162, 172, 153, 133, 140, 144, 136, 135,
-    109,  84, 101, 120, 129, 134, 133, 136, 137, 143,
-    112, 114, 157, 147, 141, 136, 135, 133, 135, 138,
-    121, 154, 161, 150, 149, 154, 151, 144, 146, 144,
-    111, 117, 125, 125, 130, 131, 135, 137, 143, 148,
-    121, 141, 146, 131, 138, 126, 118, 111, 119, 130,
-    120, 135, 145, 121, 140, 134, 138, 137, 131, 134,
-    115, 137, 132, 137, 139, 138, 138, 139, 145, 149,
-    131, 149, 147, 133, 132, 126, 131, 134, 130, 133,
-    110,  98,  84, 141, 107, 169, 169, 123, 125, 126,
-    118, 210,  98, 126, 132, 138, 128, 139, 156, 157,
-    140, 142, 129,  95, 192, 178, 182, 186, 183, 159,
-    135, 134, 144, 124, 100, 228, 203, 161, 122, 104,
-    139, 159, 134, 161, 121, 126, 192, 152, 218, 180,
-    132, 132, 119,  99,  96,  97,  80,  53, 134, 143,
-    102, 114, 133, 114, 127,  83,  77, 126,  85, 107,
-    110, 114, 194, 186, 139, 116, 147, 104, 129, 138,
-    126, 133, 109, 144, 115,  45, 130,  97, 159, 155,
-    157, 162, 189, 185, 168, 163, 151, 151, 142, 135,
-    144, 147, 120,  74, 192, 186, 149, 118,  71,  84,
-    143, 156, 133, 178, 168, 107, 119, 149, 105, 112,
-    182, 184, 158, 118, 118, 148, 128, 177, 171, 152,
-    139, 135, 126, 209, 171, 150, 123, 100, 190, 158,
-    166,  97, 136, 123, 136, 139, 128, 138, 126, 121,
-    132, 131, 128,  95,  60, 168, 127, 140, 208, 161,
-    109, 102, 119, 162, 150, 137, 107, 200, 156, 136,
-    136, 128, 103,  95,  74,  91, 220, 173, 152, 138,
-    139, 129, 140, 136, 122,  82, 180, 115,  53,  90,
-    121, 107,  99, 148, 116, 139, 100,  63, 191, 155,
-    130, 129, 163, 155,  98, 175,  95, 151, 127, 107,
-    124, 124, 116,  88,  71, 164, 148,  96,  57,  89,
-    125, 117,  77,  63, 162, 144, 113, 109, 137, 134,
-    134, 130, 149, 174, 158, 158, 130,  81,  28,  67,
-    142, 139, 129, 100, 194, 134,  68, 175, 131, 103,
-    136, 132, 122,  96, 119,  82, 115, 249, 215, 168,
-    125, 139, 199,  96, 146, 123, 136, 179, 142, 137,
-    181, 166, 106,  86, 122, 106, 123, 131, 106, 119,
-    129, 189, 188, 147, 126, 110, 101, 114, 147, 136,
-    132, 106,  72, 175, 148,  99, 130, 153, 125, 136,
-    123, 119, 147, 170, 157, 126, 209, 188, 158, 152,
-    101,  89, 142, 131, 161, 150, 148, 124,  89, 119,
-    141, 137, 131, 103,  81,  85,  64, 175, 129, 121,
-    137, 144, 142, 145, 119, 205, 148,  80, 165, 138,
-    143, 137, 167, 165, 148, 149, 110, 234, 217, 170,
-    167, 152,  75, 140, 155, 155, 175, 129, 136, 134,
-    136, 152, 161, 131, 140, 121,  91,  79, 255, 209,
-    132, 147, 120, 114, 177, 128, 110,  61,  89, 131,
-    125, 127,  93,  87, 167, 115, 186, 162, 107, 106,
-    134, 162, 151, 100,  79,  67, 151, 116, 130, 142,
-    162, 153, 155, 143, 122,  85, 202, 187, 135, 125,
-    158, 155, 103, 129,  74, 149, 130,  98, 129, 126,
-    148, 152, 153, 133, 118,  94,  80,  70,  47,  90,
-    124, 118, 143, 184, 158, 126,  70,  82, 111, 113,
-    126, 135, 175, 141, 203, 166, 123, 123, 134, 133,
-    113, 111, 128,  76, 128, 177, 151, 178, 134, 125,
-    120, 120, 193, 106,  98, 134, 101,  86, 101, 114,
-    136, 127, 134, 196,  86, 105, 145, 128, 119, 137,
-    138, 126, 230, 161, 141, 128, 129, 136,  88,  83,
-    103, 118, 178, 123,  89, 101, 161, 173, 165, 147,
-    130, 123, 171, 158, 131,  81,  50, 177, 162, 136,
-    125, 115,  82, 173, 195, 168, 130, 112, 112, 121,
-    152, 148, 167,  87,  82, 161, 142, 147,  98,  89,
-    168, 138,  97, 157, 132, 114,  74, 126, 161, 141,
-    135, 123,  68, 137, 124, 118, 112,  92,  65,  96,
-    191, 181, 161, 151, 141, 145, 129, 102,  97, 111,
-    144, 128,  55, 128, 115, 155, 129, 184, 167, 147,
-    131, 141, 125,  33, 127, 111, 127, 131, 125, 130,
-    137, 130, 121, 195, 172, 177, 176, 149,  98,  97,
-    126, 106, 168, 159, 144, 185, 156, 151, 182, 158,
-    123,  93, 110, 116,  98,  99, 125, 136, 139, 148,
-     79, 112, 149, 128, 147, 136, 118, 105, 166, 152,
-    117, 115,  92, 128, 148, 132, 170, 143, 226, 190,
-    122, 192, 165, 121, 143, 144, 174, 124, 113, 124,
-    122, 135,  34,  93, 118, 111, 111, 136, 123, 116,
-     99, 195, 139,  99, 114, 102,  96, 108, 111, 112,
-    113, 129, 172, 137, 105, 139, 154,  86, 113, 108,
-    132,  79,  63, 120,  93, 162,  90, 103,  94,  95,
-    117, 127, 104, 100, 142, 129,  93,  27, 196, 153,
-    113,  91, 101,  90,  84,  68, 138,  38, 118, 148,
-     87, 103, 125, 109,  96, 152, 100,  56,  31,  62,
-    176, 129, 124, 115, 103,  92, 100, 121, 130, 125,
-    128,  71,  82,  71, 152,  85, 107, 116, 138, 133,
-    103, 116, 139, 144,  72,  37, 118, 141, 109,  95,
-     86,  92, 121, 167, 156, 104,  92,  91, 122, 114,
-     89,  61, 172, 128,  95, 103,  84, 101,  88,  84,
-    116, 125, 108,  62,  74, 108, 160, 143, 189, 164,
-     91, 115, 144,  43, 116,  79, 106, 108,  74,  83,
-     87,  90,  61,  71,  76,  76,  95, 130,  89,  94,
-    114, 107, 101, 145, 161, 147, 143, 163, 147, 129,
-    101,  73, 111, 108,  93, 104, 186, 141,  99,  89,
-    112, 126, 111, 113, 152,  41, 159, 115, 131, 124,
-    117, 101, 115, 130, 124,  87,  59, 177,  63,  85,
-    109, 116, 103,  68, 145, 132,  29, 119,  96,  89,
-    117,  90, 181, 103, 101, 111,  97,  96, 199, 171,
-    113, 120,  93, 119, 101,  64,  56,  55,  63,  90,
-    105, 101,  86,  45, 136, 179, 142, 102, 115, 114,
-    113, 108, 121,  84,  23, 125,  76, 102, 119, 107,
-    120, 104,  73, 177,  83, 114, 128,  85, 152, 126,
-    137, 115, 149, 109, 163, 133, 110,  98,  54,  61,
-     95, 111, 135, 103,  88, 164, 115, 187, 122,  98,
-    129, 132,  95,  86,  71, 119, 146, 111,  38,  67,
-    102, 100,  66, 148, 137, 103, 145,  95,  35,  85,
-     44, 136, 102, 111, 108, 115, 136, 105, 120, 110,
-    108, 147, 112, 169, 116, 146,  81, 120,  94,  84,
-     93,  97,  90, 119, 102,  91,  48, 147, 204, 151,
-    148, 160, 144, 131, 144, 175, 158, 133, 212, 163,
-    172, 152, 151, 112, 148, 151, 145, 179, 160, 124,
-    164, 164, 167, 161, 141, 120, 131, 141, 198, 177,
-    169, 156, 146, 156, 124, 185, 164, 195, 181, 193,
-    201, 147, 148, 168, 165, 159, 162, 148, 150, 148,
-    146, 157, 158, 149, 164, 129, 160, 214, 174, 166,
-    154, 176, 146, 141, 155, 140, 140, 169, 106, 155,
-    166, 162, 134, 193, 157, 155, 146, 196, 171, 107,
-    177, 174, 163, 155, 147, 203, 162, 146, 150,  83,
-    157, 170, 180, 178, 159, 157, 151, 117, 115, 183,
-    170, 180, 174, 150, 177, 173, 136, 181, 196, 184,
-    164, 168, 165, 148, 175, 168, 209, 189, 159, 114,
-    157, 158, 141, 168, 170, 139, 175, 128, 151,  39,
-    128, 154, 159, 161, 148, 180, 131, 165, 159, 131,
-    163, 150, 174, 178, 178, 198, 172, 138, 184, 191,
-    143, 164, 161, 163, 210, 171, 155, 168, 150, 116,
-    182, 170, 145, 152, 141, 139, 191, 149, 160, 202,
-    145, 169, 145, 181, 148, 183, 197, 165, 146, 171,
-    161, 153, 157, 170, 164, 149, 183, 167, 246, 235,
-    162, 144, 170, 152, 173, 150, 113, 135, 156, 154,
-    158, 148, 178, 159, 161, 114, 180, 156, 116, 163,
-    164, 161, 122, 164, 164, 183, 135, 135, 144, 182,
-    160, 147, 163, 152, 169, 185, 159, 177,  99, 211,
-    168, 167, 215, 170, 150, 157, 154, 176, 154, 143,
-    163, 117, 178, 160, 163, 165, 164, 166, 174, 136,
-    159, 169, 152, 123, 199, 149, 169, 140, 159, 208,
-    155, 161, 186, 122, 134, 167, 171, 145, 148, 176,
-    148, 137, 114, 160, 166, 153, 162, 156, 164, 172,
-    155, 148, 155, 182, 114, 150, 157, 154, 140, 159,
-    166, 160, 169, 206, 182, 145, 157, 165, 147, 202,
-    131, 154, 193, 162, 162, 149, 167, 157, 191, 188,
-    149, 205, 147, 166, 150, 150, 159, 153, 171, 160
-};
-
-static const uint8_t wmavoice_dq_lsp16i1[0x640] = {
-    142, 121, 141, 112,  99, 119,  92, 122, 183, 155,
-    122,  98,  75,  78,  85, 101, 108, 134, 128, 123,
-    115,  90,  79,  58,  73, 127, 106,  60,  97, 107,
-    141, 163, 130, 123, 136, 156, 201, 189, 204, 206,
-    140, 116,  69,  60, 117, 123, 106, 124,  91,  63,
-    150, 144, 110,  80,  63, 112,  80,  70,  76,  63,
-    114,  86, 147, 165, 137, 125, 120, 140, 115, 101,
-    101,  99, 166, 158, 158, 104, 126, 131, 134, 143,
-    121, 102,  73,  36,  83, 132, 113,  76,  38,  20,
-    132, 111,  78,  73,  51, 131, 108, 131, 105,  80,
-    148, 138, 101,  65,  47, 115,  86,  50, 124, 129,
-    116,  89,  85,  87,  64, 111,  74,  39, 115, 113,
-    112,  83,  75, 122, 127, 114,  91, 106, 125, 130,
-    131, 108,  79, 136, 112, 110, 147, 164, 144, 124,
-    121, 236, 218, 190, 168, 106, 101, 160, 172, 191,
-    113, 138, 102,  91, 109, 100,  71,  85, 112, 119,
-    121,  96,  51,  64, 126, 135, 114,  76,  34, 104,
-    145, 127,  90,  56, 131, 142, 131,  92, 123, 102,
-    128, 105,  63,  24,  95, 115,  87,  49, 156, 174,
-    123, 105,  88,  58,  55, 141, 119,  99,  75,  81,
-    137, 117, 114,  80,  56, 119,  91, 106, 166, 135,
-    114,  84,  38,  93, 116, 129, 103,  97,  87,  97,
-    115, 184, 193, 173, 157, 117,  88, 114, 151, 121,
-    126, 111,  75, 129, 133, 130, 107,  71, 115,  92,
-    128, 108, 120, 100,  97, 111,  80, 119, 122,  91,
-    114,  94, 149, 129, 136, 114,  88, 132, 110,  85,
-    116,  99, 101,  71,  71, 110, 140, 142, 131, 110,
-    122,  98,  83, 127, 100, 106, 130, 123, 114, 103,
-    113,  87, 140, 116, 113, 140, 161, 171, 145, 129,
-    115, 178, 158, 161, 160, 118, 195, 209, 221, 228,
-     99,  83, 140, 134, 140, 127, 186, 168, 187, 187,
-    107, 114, 100, 111, 111, 104, 130, 131, 116, 128,
-    128, 104,  64,  18,  49, 126, 107,  69,  56, 153,
-    154, 142, 110, 113,  89, 120,  93,  73, 190, 172,
-    119,  96,  57,  21,  60, 126, 122,  81,  99, 117,
-    159, 141, 108,  88, 120, 144, 125,  89,  44,  94,
-    147, 131,  93,  81,  61, 133, 113,  85,  47,  62,
-    123, 121,  87,  53,  90, 120,  94,  76,  70,  48,
-    125, 103,  93,  64,  35, 140, 129,  88,  47,  30,
-    127, 104,  58,  51, 103, 124, 100, 102,  76,  47,
-    115,  87,  54,  46,  77, 182, 218, 174, 163, 145,
-    140, 126,  89, 105,  82, 125, 119, 101,  69,  58,
-    125, 107, 172, 145, 128, 138, 113, 109,  92,  90,
-    117,  93,  83,  93, 132, 125, 102,  67, 148, 161,
-    131, 110,  96,  99,  74, 119,  92,  54,  84,  81,
-    110, 152, 120, 106, 131, 108,  74,  68,  99, 107,
-    121,  97, 120, 101,  78, 132, 110, 127, 164, 134,
-    111, 159, 204, 189, 178, 158, 183, 146, 144, 137,
-    123, 106, 136, 108, 135, 117,  91, 163, 135, 113,
-    119, 177, 134, 122, 121, 132, 109, 157, 131, 113,
-    115,  87,  87, 100,  92, 120,  95,  59, 146, 139,
-    129, 101, 135, 122, 101, 119, 100, 112,  88,  99,
-    118,  90, 123, 125, 107, 121,  98,  73, 104,  80,
-    112,  79,  86, 122,  96, 104,  81, 107,  90,  93,
-    112, 150, 140, 109, 115, 113,  86,  73,  76, 112,
-    130, 111, 101, 112,  84, 123,  97,  63, 134, 115,
-    109,  77, 128, 141, 119, 125, 101, 108, 147, 119,
-    134, 149, 150, 127, 115, 136, 244, 220, 210, 189,
-    105, 138, 171, 156, 174, 117, 162, 133, 146, 141,
-    115,  93, 119,  98, 122, 114, 106, 154, 145, 162,
-    107, 131, 189, 165, 152, 101, 107, 129, 114, 139,
-    116, 186, 186, 161, 180, 100,  89, 137, 116, 116,
-    106, 130, 194, 196, 207, 110, 156, 157, 138, 149,
-    102,  93, 159, 138, 120, 109, 132, 105, 122, 135,
-    148, 128,  85,  76, 102, 168, 154, 141, 117, 100,
-    125, 106,  62, 101, 146, 124, 102,  65,  25,  15,
-    120,  94,  46,  21,  94, 149, 128, 115,  85,  92,
-    119,  93,  70,  52,  30, 162, 151, 123,  91,  80,
-    126, 112,  84,  47,  33, 138, 114,  73,  60,  87,
-    126, 211, 174, 158, 143, 129, 106,  65,  31, 133,
-    119,  95,  52,  99, 173, 123,  96, 119, 206, 178,
-    127, 104,  60,  61,  67, 152, 136, 104,  63,  83,
-    133, 130,  92,  64,  45, 120,  96,  53,  30, 130,
-    128, 103,  74,  59,  35, 135, 114,  77,  30,  57,
-    108, 130, 123,  90,  87, 143, 125,  93,  54,  60,
-    133, 118,  79,  87,  95, 115,  89, 111,  88,  65,
-    124, 102,  70,  40,  47, 148, 131, 123, 130, 104,
-    127, 109,  87,  56, 121, 147, 123, 121, 107,  85,
-    178, 237, 200, 193, 170, 139, 118, 100,  75, 110,
-    133, 121,  81,  73,  68, 120, 195, 157, 141, 131,
-    127, 102, 107,  88,  60, 136, 113, 100,  69,  45,
-    128, 105,  93,  77,  67, 131, 116, 149, 184, 156,
-    115,  85,  35,  45, 112, 128, 108,  68,  73, 111,
-    118,  93, 187, 162, 139, 136, 115,  84,  57,  37,
-    131, 133, 125,  98,  85, 138, 115,  92,  86,  61,
-    116,  96,  70,  52, 110, 115, 109, 135, 104,  88,
-    136, 159, 122, 109, 115, 122, 110,  98,  70,  95,
-    112,  81,  68,  85,  90, 124, 101,  87,  56,  89,
-    109,  82,  98, 100, 115, 124, 102,  76,  88,  63,
-    111,  78,  42,  78, 102, 110,  71,  64, 131, 111,
-    125, 104, 107,  87, 123, 129, 131,  99,  85,  68,
-    147, 137, 102,  99,  75, 120, 155, 142, 109,  91,
-    132, 109, 131, 141, 113, 136, 119,  94, 152, 128,
-    127, 102,  79, 159, 134, 111,  78,  98, 109,  80,
-    115,  86,  51,  63, 103, 116,  86, 170, 149, 123,
-    135, 178, 159, 125, 114, 113, 189, 226, 203, 202,
-    140, 117, 116,  94,  70, 128, 103,  94, 174, 149,
-    118,  98,  83,  84, 106, 115, 157, 120,  94,  95,
-    131, 112,  75,  96,  74, 121,  97, 144, 117,  95,
-    120,  90, 140, 138, 110, 119,  93,  55,  92, 114,
-    114,  87, 151, 125, 100, 111,  82,  83, 160, 139,
-    114,  86,  56,  90, 138, 104, 109, 101,  77, 118,
-    140, 142, 143, 148, 126, 121, 102, 129, 107, 111,
-    113,  79,  58, 111,  91, 120,  94,  63, 115,  98,
-    121,  94,  99,  97,  78, 120,  92,  68, 173, 148,
-    122, 114, 109,  87,  82, 132, 229, 192, 176, 155,
-    137, 116, 123,  97, 115, 132, 115,  86, 120,  95,
-    135, 116, 101, 136, 108, 109,  74, 100, 125, 115,
-    112, 158, 144, 124, 134, 114,  83,  73, 147, 120,
-    120, 104, 150, 122, 116, 110, 104, 192, 183, 174,
-    134, 112, 116, 120,  93, 121, 101,  93, 110,  90,
-    121,  93, 147, 152, 122, 115, 153, 171, 161, 142,
-    123,  95, 116, 114,  93, 113,  89,  96,  77,  93,
-    113, 174, 180, 143, 138, 116,  86, 100, 135, 106,
-    103, 121, 149, 115, 103, 121,  95,  82, 149, 121,
-    117,  92,  93, 111, 114, 123, 209, 196, 193, 183,
-    125, 102, 107, 130, 104, 115,  91, 113, 103,  99,
-    114,  86,  68, 108, 110, 111, 159, 162, 125, 113,
-    125, 235, 234, 225, 214,  99,  74, 118, 121, 127,
-    104, 123, 158, 128, 127, 113,  96, 116, 136, 158,
-    100,  80, 138, 155, 166, 118, 143, 115, 125, 114,
-    119, 137, 133, 136, 139, 151, 188, 172, 174, 173,
-    138, 161, 158, 158, 155, 121, 198, 194, 211, 202,
-    100,  90, 112, 110, 122, 100,  91, 122, 128, 135,
-    101, 109, 127, 101, 114, 105, 126, 160, 147, 143,
-    109, 138, 142, 158, 163, 113, 174, 185, 188, 206,
-    112, 154, 166, 176, 183, 101, 108, 140, 140, 143,
-    106, 135, 130, 137, 126, 103, 114, 115, 128, 126,
-    107,  86,  21, 115,  75, 117, 139,  97,  65, 105,
-     64, 191, 101, 106, 139, 107,  98, 218, 132, 104,
-     73, 136, 165,  84, 118, 150, 111,  58, 130, 107,
-     99, 136, 132,  56,  52, 102, 136,  69,  78, 163,
-     85, 173, 148, 138,  85,  69, 106, 128, 133, 155,
-    104,  91, 149,  56, 104, 103, 101, 172,  96,  57,
-    104,  97, 125, 197, 166, 107, 169,  47, 120, 103,
-    150,  89,  99, 139, 162, 101,  69, 137, 158, 126,
-    191, 173, 127,  79, 155,  51, 131, 112,  86,  74,
-    135,  61, 114,  81, 125, 117, 112,  72, 175,  72,
-    127, 123, 142, 132,  78, 116, 158, 111, 121, 143,
-    108, 102,  89,  20, 194,  81,  99, 107,  65, 150,
-    103,  78,  91,  69,  96, 104, 116, 116, 103, 105,
-    107, 117, 110, 130,  28,  88, 103,  62,  72,  85,
-    125, 126, 141, 126, 178, 121, 102,  57,  46, 124,
-     97,  91,  89, 138,  95,  98, 143,  99, 169, 123,
-    140, 119, 113,  82, 140, 118, 112,  91,  92, 241,
-    134,  89,  95, 112,  78, 167, 140, 145, 121, 100,
-    109, 205, 144,  91, 100, 113, 103, 142, 175,  95,
-    117, 121,  35, 121, 127, 159, 129,  85,  64,  75,
-    116,  98, 103, 127, 129,  66,  68, 110,  96,  86,
-     79, 100, 156, 133,  92, 135,  96, 164, 132, 121,
-     93, 163, 134,  91, 208, 104,  77, 126, 116,  58,
-    136, 118, 132,  81,  61,  73, 115,  66, 129, 123,
-    111,  85,  42, 178, 134, 108, 132, 159,  45, 157,
-    105, 164, 100,  94,  60,  96,  57, 154, 105, 102,
-    103, 114,  96,  12,  91, 119, 115,  67,  92,  64,
-     94,  61, 106, 106, 165, 105,  94,  98,  68,  30,
-    146, 130, 107, 173, 140, 102,  90, 163, 106, 184,
-    100,  53,  68, 131,  92, 105, 111,  68, 153, 186,
-    101,  82,  48,  99, 147, 122, 136, 176,  96,  96,
-    104, 132, 167, 149, 136, 138, 144,  97, 120,  92
-};
-
-static const uint8_t wmavoice_dq_lsp16i2[0x3c0] = {
-     23,  12, 107, 119, 110, 205, 214, 212, 208, 201,
-    102,  95,  69, 117, 107, 118, 123, 118, 123, 121,
-     82,  58,  83,  95,  84, 139, 145, 153, 161, 169,
-    102, 100, 138, 121, 101, 129, 130, 138, 150, 139,
-     76, 104,  86, 112, 133, 113,  91,  63,  73, 129,
-    199, 193, 182, 181, 172, 119, 101,  83,  94,  76,
-    161, 157, 152, 157, 158, 110,  90, 121,  96,  79,
-    124, 107, 114,  88,  73, 152, 137, 121, 107,  99,
-     57,  50, 100,  81,  74, 115,  96,  72,  49,  69,
-     83,  68,  40,  53, 103,  36, 131, 107,  84,  64,
-    236, 245, 242, 231, 213,  95, 109,  88,  69, 110,
-    228, 221, 204, 182, 170, 129, 110,  97, 118, 104,
-     98,  76,  98,  75,  61,  93,  77, 113,  91,  72,
-    116,  94, 106, 134, 118, 177, 188, 169, 162, 153,
-    163, 149, 131, 131, 132, 177, 163, 173, 168, 158,
-    113, 131, 107, 113, 100, 132, 143, 131, 134, 142,
-     45,  36, 121, 113, 102,  43,  95,  84,  67,  56,
-     76,  82,  68,  48,  33,  55,  58,  59,  43,  65,
-     66,  85,  66,  81,  94, 102,  82,  54,  33,  94,
-    113, 111,  89,  60,  34, 138, 120, 101, 101,  86,
-     88,  73,  55, 114, 115,  92,  74,  93,  77, 123,
-     90, 117,  99,  79,  59,  97,  75,  97, 122, 104,
-    233, 237, 227, 208, 190, 209, 230, 233, 240, 241,
-    195, 197, 188, 167, 147, 204, 185, 168, 162, 157,
-    142, 124, 119, 123, 106, 117, 110,  81, 121, 123,
-     74, 116, 124, 119, 120, 178, 168, 146, 132, 125,
-    102, 104, 105, 110, 114, 104,  82,  78, 100,  86,
-    120, 102, 105,  93, 143, 127, 108, 128, 106,  88,
-    177, 189, 203, 207, 215, 101, 131, 119,  95,  73,
-    149, 139, 135, 147, 153, 160, 167, 165, 174, 177,
-    120, 109, 134, 140, 145, 131, 130, 142, 139, 161,
-    143, 158, 148, 145, 145, 123, 142, 132, 116, 102,
-     40,  23,  79,  82,  84,  26,  83, 141, 130, 122,
-     65,  46,  43,  89,  86,  28,  75,  80,  79,  98,
-     84,  65,  47,  26,  44,  49, 112, 101, 100,  94,
-     88,  76,  75,  48,  82, 104, 100,  75,  45,  15,
-     99,  83,  63,  34,  30,  66,  55,  94, 118, 113,
-    122, 106,  91,  68,  60, 135, 122, 104,  77,  59,
-     82, 102,  84,  62,  46,  92,  74,  55,  82,  71,
-    145, 134, 118,  93,  75,  79,  62,  83,  65,  55,
-     91,  94,  64,  70,  98,  89, 117, 110,  87,  97,
-    210, 223, 225, 223, 213,  83, 103,  86, 101,  85,
-    126, 106,  81,  79, 105, 216, 219, 217, 199, 179,
-     86,  78, 115, 138, 135, 102,  84,  87,  59,  46,
-    219, 206, 184, 167, 158, 201, 188, 165, 145, 135,
-     87, 113, 142, 152, 155, 190, 170, 153, 149, 146,
-    205, 208, 201, 185, 167,  84,  73, 124, 104,  96,
-     76,  88,  99,  74,  80, 110, 125, 122,  99, 112,
-    108,  84,  70, 130, 137, 161, 152, 136, 119, 105,
-    110,  91, 101,  74,  96, 111, 101,  93, 153, 149,
-    133, 124, 102,  97, 120, 101,  93,  75,  81,  64,
-    111,  94, 107,  79,  58, 188, 206, 215, 221, 232,
-    163, 175, 165, 150, 136, 103, 106, 123, 133, 132,
-    168, 184, 191, 183, 170, 110, 117,  90,  98,  93,
-    104,  87, 122,  98, 127, 129, 110, 127, 113, 125,
-    134, 118, 102, 140, 132, 186, 199, 202, 198, 188,
-    149, 147, 175, 185, 186, 117,  93,  99, 112,  93,
-    107, 138, 138, 129, 128,  96, 129, 104, 118, 134,
-    145, 136, 115, 121, 129, 138, 155, 148, 134, 120,
-    170, 151, 150, 145, 138, 168, 173, 185, 194, 200,
-    144, 159, 172, 168, 156, 121, 121, 138, 173, 168,
-    126, 111, 140, 139, 117, 149, 133, 142, 137, 130,
-    143, 139, 158, 158, 146, 119, 128, 121, 132, 145,
-    122, 136, 159, 153, 141, 133, 133, 130, 129, 126,
-    120,  76,  50, 149, 109,  92, 155, 118,  90,  66,
-    132, 117,  87, 156, 117, 119, 102,  44,  83,  91,
-    109,  73, 106,  84,  29,  55, 130, 112,  81, 241,
-     75,  40,  91,  89,  67, 112,  90, 149,  81,  72,
-    128,  90,  71,  28, 160,  73, 157, 123, 143, 108,
-     63,  88,  70,  81,  97,  75, 111, 149, 113,  96,
-     78, 104,  83, 179,  95, 105, 106,  65, 130,  66,
-     51, 118,  92,  53,  68, 105,  75, 176, 151, 115,
-     94,  75,  68,  95, 220, 103, 125, 105,  43,  95,
-     39, 114,  65, 145, 135,  33, 142, 138, 103,  52,
-     82,  85, 117, 110,  67, 102,  74,  42,  62, 118,
-    144, 121,  82,  57, 102,  67,  75,  44, 129,  96,
-     75,  63,  88,  48, 116, 135,  94,  85, 102,  66,
-    122,  77, 105, 122, 152, 120,  56,  90,  83, 100,
-     90, 128,  63,  80, 103, 126, 117, 103,  80, 193,
-     42,  73, 117,  93,  91,  95, 128, 100, 128, 162,
-     70, 120, 126,  73, 123,  99,  99,  91,  75, 135,
-     81, 125, 111,  77,  13,  94,  78,  85, 187, 157,
-     11, 143, 109,  99, 119,  53, 141,  82, 122,  68,
-    132,  89, 136, 119,  88,  75,  49, 174, 119,  70,
-    138, 121, 108,  78,  52, 104,  90,  96,  93,  93,
-    114,  90,  78,  46,  58,  62, 114,  69,  44, 162,
-    103,  58,  98, 141,  83, 137,  95, 119,  73, 111,
-     81,  46, 126, 111, 123, 107, 117, 122, 121,  54,
-    106, 104,  59, 110, 148,  97, 155,  97,  83, 133,
-     97,  71,  57,  91,  58,  52,  79, 127, 152, 109,
-     96,  92, 145, 107, 149, 102,  61, 125,  61, 170,
-     56,  89,  77, 106,  38, 147,  96,  77, 105, 123,
-     85,  83, 117,  63,  69, 126, 133,  93, 107,  92,
-     77, 115,  95, 111, 103,  61,  87, 103,  98, 155,
-     94, 111,  80,  78,  54, 117, 128, 130,  99, 109,
-    106,  99, 113, 133, 115,  89,  65,  74, 112, 127
-};
-
-static const uint8_t wmavoice_dq_lsp16i3[0x300] = {
-     70, 100, 121, 129, 132, 132, 201, 188, 165, 145, 144, 136,
-    112, 127, 116, 125, 130, 129, 124, 135, 135, 146, 129, 128,
-    162, 158, 144, 151, 135, 129, 103,  86, 111, 113, 112, 122,
-     90, 139, 129, 117, 126, 129, 142, 145, 167, 147, 124, 124,
-    230, 209, 189, 175, 156, 141,  64,  80,  86, 108, 121, 129,
-     44,  79, 115, 113, 115, 128, 133, 106,  79, 109, 125, 127,
-    171, 156, 132, 109, 103, 115, 106,  70,  93, 145, 141, 128,
-    148, 125, 122, 107, 110, 117, 146, 145, 128, 110,  98, 111,
-    237, 212, 185, 156, 139, 133,  84,  55,  26,  77, 114, 127,
-    172, 170, 171, 168, 162, 143,  82,  82,  76,  70, 104, 126,
-     17,  95, 109, 111, 120, 132,  81,  74,  57, 126, 141, 131,
-    110, 127, 162, 148, 129, 123, 177, 172, 155, 151, 145, 134,
-    144, 123,  90,  66, 109, 130,  82, 127, 103, 123, 132, 131,
-    127,  97,  97, 142, 140, 128, 159, 134, 136, 123, 113, 117,
-    131, 140, 154, 169, 158, 134,  96, 109, 150, 122, 105, 120,
-    120, 150, 152, 122, 119, 125, 123, 126, 124, 107, 100, 113,
-    248, 233, 216, 189, 160, 142,  58,  24,  13,  77, 111, 127,
-    183, 189, 182, 157, 140, 131,  96,  83,  59,  43,  73, 119,
-    222, 196, 171, 146, 129, 128,  32,  13,  53, 101, 114, 127,
-    119, 101,  70,  70, 110, 127,  77,  86, 161, 148, 130, 118,
-    199, 183, 170, 167, 156, 141,  30, 115, 142, 133, 131, 130,
-    101, 103, 181, 176, 152, 126,  66,  44,  73,  94, 111, 128,
-    150, 122, 100, 101, 104, 118,  61, 110,  87,  76,  93, 125,
-    190, 170, 150, 134, 135, 129, 112,  89,  63, 123, 141, 132,
-    175, 154, 136, 142, 140, 132, 117, 143, 129, 128, 136, 132,
-    168, 142, 112, 113, 128, 128, 155, 169, 159, 144, 139, 131,
-     61, 136, 144, 124, 112, 123,  86,  81, 104, 121, 129, 130,
-    160, 127, 118, 150, 151, 134, 126, 115, 121, 132, 134, 131,
-    137, 148, 144, 139, 140, 134, 106, 102, 105,  90,  87, 113,
-    134, 129, 128, 121, 121, 123, 153, 151, 129, 139, 142, 134,
-    150, 142, 141, 148, 149, 141, 100, 121, 133, 147, 150, 134,
-    163, 158, 147, 132, 141, 132, 142, 127, 141, 136, 136, 132,
-    232, 218, 205, 189, 169, 146, 243, 224, 201, 171, 147, 138,
-    224, 196, 169, 162, 154, 140,  51,  20,  59, 111, 121, 128,
-    203, 197, 193, 177, 162, 145,  75,  40,  47, 122, 130, 129,
-    102,  77,  47,  83, 121, 129, 111, 108,  84,  56,  63, 114,
-    211, 181, 154, 137, 126, 125, 213, 198, 186, 162, 144, 138,
-     41,  45,  90, 110, 118, 130,  83,  63, 130, 164, 153, 128,
-    195, 167, 142, 123, 113, 119,  19,  42, 105, 113, 120, 132,
-     50,  63,  49,  64, 112, 128, 114,  90, 132, 171, 162, 134,
-    129, 128, 107,  83,  74, 110,  50, 116, 109, 120, 128, 132,
-     94,  59,  73, 111, 117, 126, 197, 170, 166, 153, 138, 132,
-     65,  48, 109, 133, 131, 128, 170, 163, 172, 158, 138, 130,
-     66, 126, 147, 160, 151, 132,  42, 129, 117,  95,  91, 120,
-     97, 165, 164, 142, 133, 125, 163, 142, 114,  88,  97, 122,
-    104,  77, 142, 143, 128, 120, 136, 160, 188, 169, 149, 130,
-    113,  83,  85, 102, 114, 125, 164, 169, 142, 120, 122, 124,
-     98, 152, 132, 105,  92, 117,  42,  71, 125, 155, 151, 137,
-     94, 105,  81, 107, 118, 126,  84,  56, 123, 117, 108, 122,
-    174, 179, 166, 137, 118, 121, 130, 103, 147, 152, 134, 124,
-    148, 127,  94, 117, 144, 134, 129, 106, 102,  95, 106, 118,
-    147, 157, 153, 125, 103, 117, 155, 128, 113, 132, 120, 122,
-    181, 151, 136, 126, 122, 122, 110, 111, 109, 108, 120, 124,
-     97, 130, 103,  89, 107, 124, 179, 158, 158, 142, 131, 128,
-    142, 111, 115, 122, 126, 125, 145, 145, 134, 115, 129, 128,
-    130, 139, 112,  99, 121, 125,  79, 104, 119, 102, 105, 123,
-    116, 121, 136, 125, 126, 127, 124, 100, 122, 119, 111, 119,
-    159, 140, 139, 128, 138, 131, 105, 100, 116, 128, 135, 132,
-    159, 142, 156, 147, 140, 134, 130, 150, 129, 126, 114, 120,
-    138, 124, 146, 131, 109, 119,  93, 115, 125, 131, 125, 129,
-    125, 121, 101, 119, 114, 120, 163, 154, 151, 153, 153, 139,
-    166, 153, 150, 133, 119, 121, 159, 151, 128, 130, 122, 123,
-    147, 154, 144, 133, 128, 127, 129, 131, 134, 140, 148, 138,
-    138, 136, 120, 131, 135, 131, 150, 140, 137, 144, 129, 129
-};
-
-static const uint8_t wmavoice_dq_lsp10r[0x1400] = {
-    128, 128, 129, 129, 130, 130, 131, 130, 129, 129,
-    134, 133, 127, 125, 136, 135, 135, 134, 173, 172,
-    133, 139, 136, 165, 133, 176, 137, 159, 135, 152,
-    147, 161, 147, 152, 149, 156, 146, 146, 140, 136,
-    134, 135, 136, 140, 139, 155, 123, 133, 132, 142,
-    132, 148, 143, 177, 124, 143, 123, 136, 126, 134,
-    126, 125, 125, 124, 129, 128, 123, 123, 133, 133,
-    116, 116, 121, 121, 121, 120, 129, 128, 131, 131,
-    132, 133, 132, 129, 138, 124, 138, 124, 132, 100,
-    135,  94, 149, 111, 152, 115, 150, 128, 141, 133,
-    129, 129, 130, 129, 147, 145, 136, 137, 120, 122,
-    120, 122, 127, 129, 104, 108, 113, 115, 124, 124,
-    140, 139, 147, 145, 132, 130, 184, 177, 201, 196,
-    170, 171, 160, 161, 145, 147, 137, 145, 131, 131,
-    130, 130, 130, 130, 130, 130, 132, 134, 131, 132,
-    131, 133, 141, 144, 142, 149,  84,  93, 103, 104,
-    139, 139, 142, 140, 147, 147, 172, 165, 122, 121,
-     98, 100, 101, 106, 112, 117, 122, 124, 124, 124,
-    134, 133, 133, 133, 146, 142, 147, 145, 156, 156,
-    143, 146, 119, 124, 129, 132, 151, 149, 136, 135,
-    147, 148, 181, 180, 199, 188, 190, 173, 166, 161,
-    147, 142, 153, 149, 154, 146, 150, 146, 138, 134,
-    131, 135,  96, 136,  48, 138,  56, 131,  63, 124,
-     85, 128, 103, 132, 117, 134, 120, 132, 125, 129,
-    131, 130, 129, 128, 129, 128, 163, 168, 117, 120,
-    121, 121, 136, 138, 131, 132, 135, 136, 131, 133,
-    133, 133, 133, 134, 117, 118, 105, 109, 142, 151,
-    144, 159, 131, 138, 121, 126, 123, 123, 121, 124,
-    131, 131, 129, 129, 141, 140, 142, 134,  87,  90,
-    109, 109, 130, 127, 139, 143, 133, 131, 127, 126,
-    134, 135, 134, 136,  97,  98, 130, 132, 134, 137,
-    115, 119, 125, 130, 107, 109, 119, 118, 126, 127,
-    134, 135, 127, 132, 172, 203, 160, 196, 152, 179,
-    152, 172, 148, 168, 153, 172, 145, 156, 137, 140,
-    102, 116,  42,  56,  74,  61,  82,  70,  86,  78,
-    101,  97, 104, 100, 115, 108, 116, 108, 123, 118,
-    149, 143, 166, 129, 168,  96, 142,  95, 135,  98,
-    117,  86, 116,  93, 121, 108, 119, 107, 121, 117,
-    135, 135, 127, 138,  72, 132,  99, 136, 112, 147,
-    120, 152, 136, 155, 138, 146, 140, 142, 134, 139,
-    163, 145, 192, 130, 147, 124, 147, 125, 133, 125,
-    127, 124, 128, 123, 129, 122, 130, 122, 130, 125,
-    130, 137, 135, 180, 124, 133, 130, 129, 132, 133,
-    124, 124, 131, 130, 132, 136, 126, 124, 127, 125,
-    132, 132, 133, 133, 144, 140, 143, 142, 137, 135,
-    143, 138, 152, 149, 221, 219, 158, 161, 143, 141,
-    130, 129, 140, 135, 170, 145, 193, 156, 186, 152,
-    167, 139, 151, 131, 142, 127, 134, 120, 131, 125,
-    135, 133, 141, 125, 199, 109, 137, 126, 134, 123,
-    130, 129, 132, 123, 128, 125, 122, 126, 125, 125,
-    130, 128,  91,  89, 138, 135, 139, 134, 133, 129,
-    132, 130, 125, 128, 136, 135, 129, 127, 126, 126,
-    132, 131, 133, 131, 128, 120, 132, 126, 126, 119,
-    134, 130, 131, 123, 104,  95, 140, 141, 136, 137,
-    133, 133, 133, 134, 117,  98,  74,  49, 112, 111,
-    123, 122, 126, 127, 131, 131, 127, 126, 128, 129,
-    130, 131, 124, 127, 101, 107, 108, 109, 115, 115,
-    100,  99, 130, 128, 134, 136, 125, 127, 128, 130,
-    136, 137, 145, 150, 149, 164, 136, 151, 114, 111,
-    124, 125, 143, 150, 162, 174, 158, 169, 136, 137,
-    131, 131, 131, 131, 132, 133, 111, 110, 122, 121,
-    136, 136, 134, 133, 131, 132, 127, 127, 125, 125,
-    128, 129, 129, 130, 125, 127, 140, 140, 148, 149,
-    133, 136, 146, 153, 110, 118, 127, 129, 128, 129,
-    131, 133, 127, 131, 140, 161, 167, 224, 131, 139,
-    136, 143, 135, 139, 138, 143, 149, 155, 141, 143,
-    134, 132, 120, 111,  83,  83, 121, 126, 102, 107,
-    112, 115,  97, 104, 120, 115, 129, 123, 122, 122,
-    134, 135, 122, 131, 102, 124, 114, 119,  93, 103,
-     78,  79,  67,  72,  66,  73,  78,  82, 103, 102,
-    144, 135, 165, 139, 165, 129, 160, 126, 153, 127,
-    161, 134, 160, 142, 160, 143, 148, 140, 138, 135,
-    138,  95, 147,  54, 143,  78, 140, 112, 142, 113,
-    140, 121, 135, 117, 135, 122, 136, 131, 131, 132,
-    147, 159, 140, 156, 127,  81, 142, 128, 146, 127,
-    144, 125, 146, 128, 149, 130, 144, 135, 133, 128,
-    130, 131, 131, 131, 134, 139, 126, 134, 141, 154,
-    168, 205, 153, 176, 148, 163, 147, 158, 141, 143,
-    131, 135, 126, 146, 108, 157, 107, 156, 119, 146,
-    100, 138, 104, 125, 119, 134, 101, 122, 113, 122,
-     95, 133,  52, 140,  83, 136, 110, 133, 114, 131,
-    123, 131, 133, 131, 138, 135, 132, 132, 127, 127,
-    129, 128, 124, 122, 128, 126, 145, 170, 143, 172,
-    141, 163, 143, 176, 138, 164, 139, 155, 135, 145,
-    135, 136, 136, 127, 132,  76, 128,  76, 127,  63,
-    125,  66, 123,  67, 120,  71, 124,  92, 122, 111,
-    133, 133, 135, 136, 139, 140, 147, 147, 150, 144,
-    156, 147, 150, 145, 154, 146, 120, 123, 123, 124,
-    137, 133, 170, 141, 124, 124, 135, 134, 134, 135,
-    132, 132, 129, 129, 130, 130, 136, 136, 130, 132,
-    147, 159, 135, 158, 115, 146, 120, 148, 117, 136,
-    115, 137, 113, 132, 133, 142, 140, 144, 132, 134,
-    134, 135, 134, 137, 137, 147, 162, 178, 136, 147,
-    134, 144, 123, 132, 111, 113, 113, 113, 124, 124,
-    132, 131, 126, 126, 117, 114, 100,  95, 130, 125,
-    157, 145, 164, 156, 163, 158, 145, 145, 133, 134,
-    134, 134, 127, 126, 113, 102, 136, 130, 124, 122,
-    143, 145, 127, 131, 135, 143, 133, 137, 132, 132,
-     92,  94, 122, 125, 128, 129, 131, 130, 134, 135,
-    132, 128, 129, 127, 132, 132, 131, 129, 127, 127,
-    129, 129, 132, 131, 139, 131, 137, 132, 216, 178,
-    146, 134, 147, 137, 151, 142, 148, 139, 144, 138,
-    128, 127, 129, 129, 123, 131,  71,  91, 126, 128,
-    130, 134, 117, 123, 125, 125, 135, 140, 129, 132,
-    132, 132, 133, 134, 124, 130, 127, 133, 133, 138,
-    142, 149, 135, 141, 145, 149, 154, 164, 135, 138,
-    135, 135, 141, 142, 138, 137, 116,  96, 105,  86,
-    127, 118, 128, 120, 124, 117, 125, 117, 125, 121,
-    131, 131, 132, 134, 144, 145, 112, 112, 121, 123,
-    113, 116, 121, 123, 139, 138, 128, 128, 131, 131,
-    134, 132, 132, 132, 125, 128, 127, 130, 125, 131,
-    120, 128,  90, 119,  68,  98,  99, 112, 115, 124,
-    135, 135, 134, 134, 128, 129, 137, 137, 137, 138,
-    110, 114, 129, 130, 144, 145, 123, 125, 129, 129,
-    132, 133, 129, 130, 168, 187, 140, 149, 137, 144,
-    129, 130, 129, 134, 133, 138, 118, 118, 122, 120,
-    131, 130, 129, 128, 133, 133, 125, 125, 124, 123,
-    181, 179, 129, 129, 131, 127, 139, 136, 130, 128,
-    133, 133, 132, 132, 121, 120, 122, 119, 132, 129,
-    129, 125, 107,  96, 136, 137, 150, 146, 135, 134,
-    131, 131, 130, 130, 126, 123, 126, 123, 128, 125,
-    130, 123, 134, 127, 183, 159, 143, 135, 137, 134,
-    129, 129, 128, 128, 134, 133, 139, 138, 133, 132,
-    129, 127, 154, 151, 150, 144, 146, 146, 141, 142,
-    132, 132, 131, 131, 130, 130, 132, 133, 114, 115,
-    132, 132, 122, 122, 132, 131, 115, 117, 120, 120,
-    129, 129, 130, 130, 130, 129, 130, 131, 129, 131,
-    130, 130, 129, 129, 133, 132, 143, 144,  91,  91,
-    137, 136, 118, 107,  60,  45,  56,  49,  57,  52,
-     60,  56,  71,  75,  77,  80,  92,  97, 106, 106,
-    112, 131,  58, 121,  19,  65,  84, 101, 108, 122,
-    121, 127, 112, 117, 106, 112, 117, 124, 126, 127,
-    130, 129, 138, 133, 166, 155, 192, 179, 192, 177,
-    208, 191, 204, 192, 186, 179, 163, 163, 138, 142,
-    134, 134, 144, 142, 243, 236, 148, 146, 141, 137,
-    145, 141, 151, 144, 147, 143, 135, 139, 134, 133,
-    134, 128, 138,  88, 142,  10, 127,  76, 130,  96,
-    129, 102, 128, 108, 123, 111, 127, 119, 127, 124,
-    136, 136, 139, 139, 142, 140, 246, 241, 158, 167,
-    143, 145, 146, 149, 143, 145, 148, 152, 133, 134,
-    139, 135, 135, 136,  99, 137,  95, 133,  75, 138,
-     67, 135,  73, 128,  83, 132,  96, 126, 115, 127,
-    130, 132, 137, 136, 140, 135, 134, 130, 137, 131,
-    159, 151, 215, 197, 181, 170, 160, 149, 150, 143,
-    145, 148, 186, 207, 141, 147, 135, 137, 122, 122,
-    126, 125, 128, 126, 127, 127, 134, 126, 131, 123,
-    133, 133, 126, 122, 128, 122,  99,  93,  59,  60,
-     82,  82, 106, 107, 119, 123, 124, 128, 128, 129,
-    134, 137, 133, 139, 133, 136, 141, 132, 139, 122,
-    142,  97, 130,  81, 128,  89, 129, 101, 125, 112,
-    137, 140, 129, 148, 101, 159, 118, 180, 122, 178,
-    120, 178, 116, 168, 118, 153, 127, 151, 126, 136,
-    132, 134, 125, 126, 118, 105, 156, 124, 180, 132,
-    163, 124, 148, 121, 131, 112, 127, 115, 125, 122,
-    129, 131, 128, 129, 136, 134, 142, 141, 165, 158,
-    203, 182, 141, 136, 132, 130, 135, 135, 130, 130,
-    133, 133, 132, 132, 127, 126, 106, 105, 112, 110,
-    106, 105,  80,  84, 100, 101, 122, 125, 126, 128,
-    101, 109,  46,  59, 114, 112, 119, 119, 126, 121,
-    129, 124, 128, 125, 125, 122, 123, 120, 125, 122,
-    135, 134, 121, 134,  56, 139, 131, 145, 135, 138,
-    136, 139, 126, 130, 122, 132, 126, 129, 124, 129,
-    153, 169, 146, 179, 138, 139, 151, 143, 148, 138,
-    153, 137, 142, 129, 144, 126, 140, 128, 133, 126,
-    136, 134, 154, 149, 173, 157, 152, 144, 149, 141,
-    137, 136, 127, 121, 123, 121, 121, 126, 120, 123,
-    157, 143, 166, 135, 120, 122, 112, 118, 102, 118,
-    111, 124, 134, 131, 141, 138, 135, 134, 126, 129,
-    140, 123, 152,  76, 131, 116, 138, 136, 126, 134,
-    130, 142, 126, 136, 120, 132, 126, 128, 124, 127,
-    131, 138,  80, 147, 126, 138, 130, 140, 129, 134,
-    133, 135, 131, 132, 126, 127, 127, 125, 125, 123,
-    132, 132, 130, 132, 123, 130, 102, 102, 107, 110,
-    116, 127, 132, 152, 142, 160, 143, 151, 142, 146,
-    132, 132, 132, 132, 125, 126, 132, 140, 158, 199,
-    135, 149, 134, 140, 135, 131, 129, 120, 127, 121,
-    129, 130, 122, 123, 125, 124, 138, 138, 138, 135,
-    140, 141, 101,  94, 105,  98, 121, 122, 127, 128,
-    126, 127, 119, 121, 133, 156, 132, 159, 130, 148,
-    137, 164, 127, 138, 130, 137, 135, 140, 126, 126,
-    128, 129, 129, 129, 126, 124, 130, 128, 143, 138,
-    149, 143, 185, 170, 129, 127, 138, 133, 138, 135,
-    132, 134, 137, 144, 139, 183, 131, 145, 127, 128,
-    128, 127, 128, 122, 129, 125, 145, 139, 135, 131,
-    132, 133, 132, 130, 152,  96, 159,  85, 150, 105,
-    154, 115, 143, 120, 138, 126, 134, 124, 130, 126,
-    128, 127, 121, 123, 122, 123, 116, 125,  84,  87,
-    133, 135, 129, 131, 123, 126, 133, 135, 131, 130,
-    136, 134, 129, 119,  79,  63, 116, 116, 136, 133,
-    133, 130, 140, 143, 127, 127, 124, 125, 127, 128,
-    128, 126, 124, 120, 139, 128, 153, 134, 151, 134,
-    174, 145, 159, 136, 165, 144, 171, 149, 143, 135,
-    134, 134, 133, 133, 121, 119, 177, 162, 166, 154,
-    127, 130, 132, 132, 136, 137, 142, 143, 138, 137,
-    167, 151, 162, 142, 128, 136, 142, 148, 128, 143,
-    145, 153, 140, 149, 132, 141, 128, 139, 127, 133,
-    156, 169, 131, 129, 126, 120, 127, 125, 129, 120,
-    131, 126, 126, 123, 124, 121, 122, 121, 123, 123,
-    138, 140, 149, 156, 145, 152, 105, 102, 131, 126,
-    151, 146, 147, 139, 144, 137, 143, 133, 135, 130,
-    132, 130, 131, 129, 126, 130, 126, 129, 110, 135,
-    115, 139, 108, 146, 105, 147, 121, 134, 124, 133,
-    137, 137, 135, 134, 143, 142, 146, 146, 120, 121,
-    139, 137, 133, 129, 149, 145, 139, 133, 130, 127,
-    134, 134, 134, 134, 125, 124, 117, 119, 120, 113,
-     84,  80, 122, 125, 108, 112,  97, 102, 118, 120,
-    124, 123, 115, 116, 110, 111,  98,  97, 127, 124,
-    129, 127, 120, 117, 114, 109, 106, 104, 116, 116,
-    138, 138, 139, 141, 142, 146, 127, 125, 133, 130,
-    134, 128, 134, 127, 116,  91, 105,  84, 114, 106,
-    128, 128, 126, 126, 131, 137, 126, 129, 133, 139,
-    134, 145, 132, 143, 150, 192, 131, 142, 138, 141,
-    132, 130, 132, 130, 149, 138, 196, 152, 137, 125,
-    134, 125, 139, 128, 133, 125, 141, 134, 134, 135,
-    134, 135, 134, 135, 131, 130, 136, 133, 110, 106,
-    142, 144, 153, 162, 131, 129, 134, 132, 131, 130,
-    126, 125, 132, 130, 168, 153, 126, 124, 130, 126,
-    140, 135, 140, 134, 138, 133, 145, 137, 135, 134,
-    130, 130, 132, 131, 133, 132, 129, 129, 125, 128,
-    128, 130, 133, 139, 143, 152, 193, 215, 152, 160,
-    130, 131, 129, 131, 130, 131, 135, 136, 136, 141,
-     83,  81, 121, 120, 136, 130, 150, 145, 147, 145,
-    134, 133, 135, 133, 146, 142, 135, 131, 127, 128,
-    134, 135,  93, 102, 126, 132, 131, 133, 127, 129,
-    124, 125, 120, 122, 103, 106, 128, 129, 139, 138,
-    127, 128, 134, 134, 143, 138, 139, 134, 135, 133,
-    131, 130, 133, 131, 139, 134, 138, 136, 166, 156,
-    119, 116, 121, 122, 126, 124, 116, 117, 123, 124,
-    131, 131, 129, 129, 130, 128, 141, 138, 135, 132,
-    154, 145, 137, 129, 131, 125, 146, 137, 138, 135,
-    131, 131, 131, 132, 129, 130, 134, 138, 111, 116,
-    113, 118, 123, 125, 122, 124, 143, 147, 138, 140,
-    116, 113, 114, 112, 130, 126, 117, 115, 127, 126,
-    139, 137, 141, 139, 131, 132, 143, 144, 139, 140,
-    130, 130, 129, 128, 136, 134, 119, 117, 152, 143,
-    155, 143, 120, 119, 142, 139, 124, 130, 126, 128,
-    112, 110, 112, 109, 136, 132, 125, 118, 121, 115,
-    103, 101, 109, 100, 125, 120, 121, 117, 122, 121,
-    128, 128, 127, 127, 124, 124, 128, 127, 131, 129,
-    142, 138, 147, 141, 115, 108, 113, 109, 122, 119,
-    136, 133, 150, 139, 142, 131, 119, 111, 151, 137,
-    121, 116, 146, 134, 137, 129, 121, 123, 127, 129,
-    130, 130, 130, 130, 136, 137, 126, 126, 136, 136,
-    133, 133, 139, 139, 142, 143, 119, 120, 134, 134,
-    132, 132, 133, 133, 135, 138, 129, 131, 133, 134,
-    135, 138, 126, 130, 117, 118, 131, 132, 135, 135,
-    129, 129, 128, 128, 126, 129, 127, 129, 123, 125,
-    115, 117, 156, 157, 127, 131, 129, 129, 128, 129,
-    129, 130, 131, 131, 126, 127, 135, 134, 136, 135,
-    140, 136, 117, 113, 132, 128, 104,  97, 109, 106,
-    131, 131, 131, 131, 121, 123, 124, 125, 126, 127,
-    127, 127, 135, 135, 128, 128, 130, 130, 141, 140,
-    129, 129, 129, 129, 129, 127, 127, 125, 149, 146,
-    125, 123, 134, 133, 134, 132, 152, 150, 138, 138,
-    128, 128, 126, 125, 132, 133, 141, 143, 136, 136,
-    126, 127, 126, 127, 129, 131, 128, 129, 135, 134,
-    176, 139, 192, 135, 145, 122, 149, 117, 155, 134,
-    169, 133, 157, 139, 142, 136, 151, 152, 142, 147,
-    166, 174, 103, 107, 141, 134, 140, 136, 144, 135,
-    147, 135, 156, 131, 153, 127, 133, 126, 130, 124,
-    127, 130, 123, 124, 114, 105, 195, 193, 156, 157,
-    165, 158, 126, 122, 149, 141, 174, 173, 152, 147,
-    136, 139, 131, 138, 163, 169, 103, 124,  80, 102,
-    153, 186, 121, 151, 134, 161, 156, 190, 141, 151,
-    121, 123, 124, 127, 119, 127, 133, 134, 157, 156,
-     81,  69, 136, 134, 160, 169, 118, 114, 135, 128,
-    114, 116,  97,  97, 117, 122, 152, 161, 115, 121,
-    106, 122, 135, 137, 111, 113, 125, 135, 141, 145,
-    143, 146, 143, 150, 132, 136, 142, 150, 151, 167,
-    101, 107, 155, 173, 112, 124, 105, 100, 128, 126,
-    127, 130, 133, 134, 142, 121, 131, 116, 176, 145,
-    161, 120, 209, 150, 196, 133, 147, 115, 149, 130,
-    144, 145, 144, 145, 120, 119, 163, 160, 117, 118,
-    123, 117, 154, 119, 193,  98, 149, 101, 137, 116,
-    133, 135, 140, 143, 144, 156, 131, 146, 186, 201,
-    140, 139, 123, 125, 158, 169, 157, 166, 142, 143,
-    130, 131, 132, 132, 128, 128, 141, 142, 147, 149,
-    145, 148, 137, 139, 129, 129, 107, 108, 157, 157,
-    120, 121, 119, 119, 140, 132, 137, 131, 118, 113,
-    143, 136, 134, 135, 164, 158, 133, 125, 127, 124,
-    148, 122, 197, 130, 173, 145, 110, 139, 123, 165,
-     83, 158,  90, 167,  93, 142, 136, 169, 134, 152,
-    130, 126, 154, 138, 227, 150, 156, 114, 147, 114,
-    142, 109, 135, 110, 166, 135, 176, 150, 152, 142,
-    132, 132, 136, 136, 130, 135, 143, 152, 136, 144,
-    152, 160, 177, 185, 112, 112, 165, 166, 160, 161,
-    145, 145, 138, 139, 116, 118, 127, 131,  66,  80,
-    132, 142, 119, 127, 101, 108, 120, 130, 126, 130,
-    135, 135, 142, 139, 153, 137,  55,  30, 142, 139,
-    139, 143, 135, 133, 129, 133, 109, 108, 129, 129,
-    136, 135, 134, 131, 129, 132, 132, 134, 135, 149,
-     79, 206, 123, 137, 135, 143, 130, 140, 131, 134,
-    100,  99, 165, 164, 142, 123, 148, 133, 133, 122,
-    142, 133, 138, 125, 119, 111, 129, 123, 137, 130,
-    131, 132, 123, 129, 174, 185, 196, 181, 127, 111,
-    156, 141, 132, 114, 129, 106, 132, 107, 126, 117,
-    134, 140, 131, 136, 119, 146,  92, 246, 128, 132,
-    125, 129, 132, 140, 128, 141, 126, 145, 137, 142,
-    130, 130, 110, 115, 124, 139, 127, 151, 118, 152,
-     98, 146,  36, 108, 126, 158, 112, 146, 112, 130,
-    138, 136, 145, 138, 153, 145, 116, 125,  90, 103,
-    137, 138, 189, 185, 141, 151,  86,  93, 111, 111,
-    133, 171, 125, 209, 140, 132, 130, 134, 129, 101,
-    142, 120, 142, 132, 135, 126, 141, 140, 140, 134,
-    128, 123, 131, 123, 138, 118, 163, 133, 240, 197,
-    176, 151, 126, 123,  81,  94, 109, 118, 124, 133,
-    135, 133, 137, 134, 154, 135, 140, 155,  69, 190,
-    119, 149, 141, 151, 142, 123, 135, 125, 129, 130,
-    127, 125, 132, 127, 107,  80, 123, 103, 145, 131,
-    133, 107, 140, 103, 135, 106, 170, 145, 159, 143,
-    136, 137, 127, 130, 105, 119, 129, 134, 141, 151,
-    116, 127, 119, 140,  75, 119, 152, 162, 149, 152,
-     72, 138,   9, 143, 118, 160, 126, 134, 141, 147,
-    135, 131, 129, 129, 135, 129, 136, 126, 133, 125,
-    137, 135, 146, 141, 145, 139, 141, 140, 133, 130,
-    213, 208, 139, 130, 139, 136, 117, 117, 126, 125,
-    133, 130, 138, 131, 141, 100, 145,  93, 159, 121,
-    144, 132, 117, 160, 102, 187,  99, 162, 117, 144,
-    132, 132, 134, 134, 140, 141, 127, 126, 128, 131,
-    116, 116, 121, 127, 119, 126, 114, 114,  99, 100,
-    141, 144, 148, 159, 179, 224,  95, 131, 100, 125,
-     87, 110, 112, 132, 134, 147, 111, 125, 122, 122,
-    137, 140, 141, 129, 169,  12, 144, 132, 133, 144,
-    141, 146, 137, 147, 136, 122, 133, 130, 131, 128,
-    141, 142, 128, 139,  15,  69, 160, 159, 142, 130,
-    137, 126, 159, 141, 145, 143, 128, 125, 134, 128,
-    131, 130, 127, 127, 114, 104, 119,  98,  83,  68,
-    139, 120, 173, 142, 199, 154, 191, 153, 158, 145,
-    128, 130, 127, 127, 148, 150, 110,  99, 119, 109,
-    120, 113, 163, 154, 110,  90, 138, 129, 149, 144,
-    131, 134, 124, 142,  76, 217, 130, 129, 140, 138,
-    133, 135, 145, 150, 136, 138, 127, 130, 130, 134,
-    144, 119, 178,  70, 143, 130, 115, 136, 139, 138,
-    129, 109, 136, 116, 147, 122, 126, 112, 126, 123,
-    132, 139, 128, 144, 107, 156,  75, 163, 120, 164,
-    151, 136, 151,  99, 160, 112, 159, 126, 143, 126,
-    140, 138, 137, 135, 152, 108, 251,  85, 138, 116,
-    137, 118, 141, 119, 136, 121, 150, 134, 138, 131,
-    137, 137, 143, 144, 150, 153, 148, 154, 152, 151,
-    117, 104, 124,  96,  93,  67, 146, 138, 149, 148,
-    149, 153, 172, 193, 108, 114, 125, 128, 145, 165,
-    149, 160, 121, 130, 115, 120, 110, 112, 121, 118,
-    145, 146, 141, 142, 127, 127, 103,  95, 138, 143,
-    114, 126, 109, 115, 143, 136, 153, 149, 144, 142,
-    140, 138, 150, 144, 128, 116, 142, 136, 135, 122,
-     93,  88, 164, 163, 141, 142, 171, 182, 154, 160,
-    124, 125, 122, 123, 158, 155, 111,  97, 138, 130,
-    157, 134, 101,  65, 129, 118, 121, 114, 124, 119,
-    131, 133, 125, 129, 136, 147, 135, 152, 131, 133,
-    110, 115, 118, 114, 161, 159, 233, 218, 172, 166,
-    140, 107, 125,   0, 140, 103, 140, 115, 125, 113,
-    132, 135, 128, 133, 138, 146, 131, 145, 127, 133,
-    131, 131, 122, 122, 135, 132, 126, 124, 132, 133,
-    164, 167, 121, 127, 117, 120, 167, 162, 145, 143,
-    135, 134, 136, 134, 156, 146, 195, 177, 127, 139,
-    108, 140, 141, 173, 141, 178, 131, 155, 129, 141,
-    134, 134, 119, 114, 184, 184, 127, 126, 147, 151,
-    130, 140, 146, 159, 134, 145, 131, 136, 137, 142,
-    135, 137, 128, 136,  83, 108,  97,  98, 152, 119,
-    207, 144, 142, 121, 144, 129, 131, 127, 130, 132,
-    124, 125, 108, 107,  94, 116,  81, 114, 139, 173,
-    131, 158, 145, 177, 141, 163, 136, 140, 143, 144,
-    135, 141, 132, 136, 134, 142, 142, 136, 173,  50,
-    143, 106, 142, 127, 134, 139, 127, 133, 125, 125,
-    129, 130, 131, 133, 132, 148, 110, 138, 113, 135,
-    138, 175, 108, 151,  55, 119,  51, 100,  93, 116,
-    121, 121, 146, 151,  99, 120, 127, 137, 107, 122,
-    125, 139, 110, 132, 135, 156, 141, 156, 148, 157,
-    137, 137, 141, 140, 139, 137, 130, 128, 138, 136,
-    132, 134, 115, 110, 177, 179,  81,  86, 100,  98,
-     84,  83, 121, 121, 148, 157, 127, 133, 146, 156,
-    127, 136, 143, 151, 135, 139, 138, 142, 136, 136,
-    201, 164, 151, 129, 123, 136, 147, 148, 127, 142,
-    128, 143, 101, 126, 119, 133, 114, 131, 116, 126,
-    132, 133, 140, 140, 126, 125, 156, 153, 142, 129,
-    140, 130,  77,  69, 134, 132, 146, 148, 135, 136,
-    133, 132, 123, 116, 116, 103, 150, 135, 144, 127,
-    130, 117, 136, 122, 122, 106,  48,  38,  81,  78,
-    145, 146, 135, 136, 123, 122, 126, 133, 133, 138,
-    145, 145, 144, 150, 160, 181, 142, 139, 150, 150,
-    136, 136, 139, 139, 133, 133, 139, 135, 134, 129,
-    140, 137, 153, 145, 132, 131, 151, 144,  68,  66,
-    137, 137, 139, 139, 146, 146, 142, 139, 129, 128,
-    131, 129, 133, 132, 135, 134, 135, 134, 201, 200,
-    137, 136, 146, 143, 155, 153, 157, 158, 131, 138,
-    140, 139, 143, 144, 128, 123, 216, 192, 159, 150,
-    137, 138, 136, 142, 145, 148, 126, 162, 140, 170,
-    186,  95, 131, 140, 143, 148, 133, 128, 130, 133,
-    141, 139, 153, 150, 122, 122, 134, 144, 124, 130,
-    159, 166, 133, 139, 151, 150, 138, 139, 131, 134,
-    121, 121, 131, 129, 148, 180, 121, 135, 118, 131,
-    124, 148, 119, 119, 129, 126, 150, 156, 155, 160,
-     40, 154, 115, 157, 133, 129, 140, 133, 143, 133,
-    143, 132, 144, 130, 141, 131, 134, 130, 137, 133,
-    134, 136, 141, 140, 145, 137, 152, 124, 183,  91,
-    118, 154, 123, 158, 136, 134, 140, 142, 138, 142,
-    138, 135, 131, 131, 138, 129, 121, 128, 146, 219,
-    124, 123, 125, 135, 120, 126, 127, 141, 133, 136,
-    127, 124, 120, 107, 152, 125, 149, 108, 158, 144,
-    196, 185, 174, 164, 151, 149, 138, 131, 140, 137,
-    149, 148, 144, 145, 143, 145, 140, 143, 141, 147,
-    112, 125, 113, 113, 149, 155, 143, 149, 146, 151,
-    138, 138, 141, 138, 144, 129, 134, 125, 143, 140,
-    153, 154, 142, 123, 162,  42, 154, 106, 153, 130,
-    153, 153, 137, 137, 144, 144, 142, 140, 165, 151,
-    161, 140, 144, 134, 156, 124, 167, 143, 166, 155,
-    132, 132, 137, 138, 137, 132, 124, 127, 140, 144,
-    134, 140, 162, 180, 127, 131, 152, 169, 145, 156,
-    133, 134, 131, 133, 130, 132, 147, 149, 125, 117,
-    127, 118, 159, 155, 147, 142, 122, 117, 145, 144,
-    138, 137, 130, 133, 113, 149, 168, 224, 166, 201,
-    129, 151, 147, 154, 136, 135, 140, 136, 152, 141,
-    120, 112, 140, 127, 161, 100, 132, 115, 118, 125,
-    115, 133, 115, 157, 144, 146, 114, 135, 127, 139,
-    138, 141, 135, 135, 137, 136, 147, 142, 143, 144,
-    139, 152, 142, 136, 147, 143, 177,  39, 125,  71,
-    147, 143,  66,  88, 132, 158, 123, 126, 116, 135,
-    119, 124, 128, 135, 133, 140, 137, 126, 137, 130,
-    155,  38, 149, 103, 130, 135, 139, 143, 127, 137,
-    135, 141, 138, 148, 131, 148, 136, 147, 132, 139,
-    136, 140, 115, 129, 115, 151, 136, 160,  87, 131,
-    157, 176, 150, 164, 140, 141, 135, 119, 137, 133,
-    141, 140, 140, 139, 134, 134, 142, 144, 131, 132,
-    131, 134, 131, 132, 116, 114, 129, 133, 205, 207,
-    130, 133, 160, 170, 137, 127, 124, 112, 158, 146,
-    155, 137, 134, 136, 137, 142, 177, 184, 149, 152,
-    135, 134, 133, 132, 135, 129, 144, 136, 139, 134,
-    161, 155, 126, 109, 215, 186, 177, 153, 160, 149,
-    139, 139, 136, 140, 140, 142, 186,  71, 129, 144,
-    131, 165, 142, 152, 140, 151, 141, 143, 137, 139,
-    144, 138, 150, 135, 133, 126, 136, 143,  99, 152,
-    139, 131, 190, 118, 122, 147, 134, 155, 136, 143,
-    138, 135, 137, 132, 147, 144, 150, 144, 138, 134,
-    129, 133, 130, 138,  56, 175, 129, 166, 147, 165,
-    140, 138, 144, 137, 141, 133, 150, 139, 129, 135,
-     40,  83, 126, 130, 110, 120, 100, 110, 126, 128,
-    141, 142, 217, 175, 172, 151, 146, 153, 125, 132,
-    128, 137, 141, 141, 145, 145, 140, 133, 132, 131,
-    129, 144, 128, 177, 133, 195, 147, 120, 138, 131,
-    161, 114, 166, 134, 162, 118, 161, 115, 155, 129,
-    137, 136, 141, 129, 141, 132,  55, 168, 121, 126,
-    136, 139, 120, 133, 149, 147, 132, 141, 131, 136,
-    147, 150, 151, 132, 101,  31, 117, 101, 129, 132,
-    122, 138, 128, 137, 140, 170, 131, 143, 131, 134,
-    149, 192, 122, 158, 136, 146, 133, 166, 143, 141,
-    141, 136, 141, 129, 125, 155, 140, 138, 137, 131,
-    111, 112, 131, 132, 120, 127, 149, 148, 151, 141,
-    156, 148, 133, 129, 127, 124, 144, 137, 142, 139,
-    134, 133, 141, 138, 133, 135, 124,  96, 226, 152,
-    116, 108, 128, 105, 155, 130, 153, 138, 144, 139,
-    142, 141, 137, 135, 142, 143, 156, 162, 136,  89,
-    188, 145, 181, 152, 138, 146, 146, 154, 145, 149,
-    152, 133, 158, 133,  42, 153, 117, 144, 149, 139,
-    125, 139, 134, 128, 150, 128, 143, 125, 135, 132,
-    143, 141, 143, 141, 164, 173, 141, 142, 156, 155,
-    154, 154, 169, 170,  77,  80, 112, 105, 135, 134,
-    126, 143, 120, 172, 111, 144, 120, 154, 107, 153,
-     95, 134, 104, 134, 128, 116, 163, 131, 151, 136,
-    135, 133, 142, 143, 152, 204, 149, 112, 156, 128,
-    150, 126, 127, 129, 139, 175, 143, 141, 138, 135,
-    168, 148, 152, 105, 164, 121, 134, 122, 119, 109,
-    122, 148, 136, 143, 153, 132, 158, 148, 149, 150,
-    133, 131, 142, 141, 150, 149, 156, 173, 138, 155,
-    129, 144, 111, 107, 130, 129,  96,  89, 106, 104,
-    135, 135, 144, 146, 131, 153, 134, 154, 146, 166,
-    117, 138, 163, 187, 190, 216, 149, 156, 149, 152,
-    142, 142, 153, 154, 109, 145,  40, 102, 116, 126,
-    137, 139, 149, 157, 108, 124, 139, 146, 142, 147,
-    130, 126, 120, 111, 172, 146, 169, 136, 150, 135,
-    126,  96, 159, 143, 150, 122, 162, 129, 156, 142,
-    135, 142, 144, 138, 222, 109, 137, 145, 144, 142,
-    141, 143, 138, 136, 124, 150, 133, 144, 137, 145,
-    141, 144, 139, 144, 134, 154, 114, 136, 145, 173,
-    151, 215, 110, 115, 127, 134, 145, 150, 145, 144,
-    144, 142, 139, 131, 147, 132, 141, 119, 143, 106,
-    165,  41, 147, 129, 129, 144, 138, 135, 138, 140,
-    128, 150,  89, 163, 154, 115, 141, 127, 132, 145,
-    135, 157, 143, 145, 140, 141, 127, 135, 127, 129,
-    142, 147, 116, 147, 104, 162, 153, 143, 146, 130,
-    144, 110, 133, 123, 130, 137, 118, 198, 126, 152,
-    154, 146, 139, 127, 147, 112, 207, 151, 156, 136,
-    162, 137, 108, 121, 130, 135, 125, 131, 131, 134,
-    134, 134, 141, 144, 107, 143, 137, 144, 124, 136,
-    115, 147, 130, 157, 119, 167,  71, 144,  97, 128,
-    134, 138, 132, 133, 138, 138, 146, 146, 147, 131,
-    141, 138, 185,  65, 145, 123, 139, 130, 142, 128,
-    139, 136, 157, 147, 124, 119, 164, 148, 170, 154,
-    133, 130, 157, 148, 140, 141, 130, 135, 134, 137,
-    136, 137, 143, 144, 144, 144, 178, 186,  71,  73,
-    120, 118, 127, 124, 152, 151, 155, 146, 141, 138,
-    142, 143, 139, 143, 133, 134, 139, 140, 138, 135,
-    146, 141,  78, 198, 129, 139, 141, 141, 134, 141,
-    137, 136, 120, 120, 124, 118, 143, 148, 148, 152,
-    131, 143, 129, 137, 152, 158, 157, 160, 175, 178,
-    137, 139, 131, 133, 146, 152, 121, 147, 142, 143,
-    129, 136, 149, 145, 197, 114, 103, 141, 124, 140,
-    141, 140, 129, 129, 127, 130, 131, 124, 123, 117,
-    150, 139, 120, 109, 119, 120, 163, 163, 117, 121,
-    139, 139, 136, 136,  94,  74, 150, 145, 126, 127,
-    147, 150, 158, 162,  84,  74, 136, 129, 140, 132,
-    136, 135, 146, 145, 124, 116, 129, 120, 130, 129,
-    130, 109, 122, 111, 160, 141, 135, 113, 131, 121,
-    136, 135, 135, 135, 147, 147, 140, 140, 144, 145,
-    139, 142, 131, 137, 145, 145, 143, 153,  48,  49,
-    145, 143, 151, 147, 158, 146, 135, 124, 124, 116,
-    159, 140, 131, 126, 123, 120, 103, 117, 113, 119,
-    148, 146, 128, 124, 123, 126, 123, 120, 158, 141,
-    148, 137, 146, 143, 125, 143,  89, 107, 116, 123,
-    149, 147, 141, 139, 149, 153, 118, 121, 139, 138,
-    105, 119, 168, 147, 139, 141, 143, 138, 133, 130,
-    126, 126, 143, 142, 146, 144, 124, 123, 143, 145,
-    149, 148, 147, 141, 151, 143, 118, 113, 175, 171
-};
-
-static const uint8_t wmavoice_dq_lsp16r1[0x500] = {
-    147, 145, 193, 168, 188, 156, 141, 145, 141, 139,
-    148, 149, 148, 149, 153, 157, 144, 144, 152, 152,
-    141, 145, 153, 143, 243, 134, 151, 133, 166, 135,
-    150, 149, 135, 132,  32,  39, 110, 111, 109, 114,
-    126, 127, 147, 146, 177, 169, 162, 156, 210, 187,
-    141, 147,  95, 150, 127, 155, 108, 133, 139, 148,
-    138, 138, 140, 140, 147, 146, 134, 130, 136, 134,
-    147, 146, 142, 150,  62, 174, 126, 151, 122, 156,
-    154, 156, 179, 184, 115, 107, 105,  99, 127, 124,
-    146, 131, 140,  44, 132, 125, 156, 146, 153, 153,
-    136, 137, 145, 144, 141, 139, 158, 152, 138, 132,
-    145, 145, 147, 145, 146, 141, 144, 140, 110,  97,
-    140, 141, 143, 142, 130, 123, 127, 117, 126, 120,
-    147, 146, 161, 155, 169, 135, 122, 117, 166, 155,
-    144, 144, 142, 142, 125, 122, 137, 128, 194, 172,
-    127,  85, 148, 143, 153, 141, 147, 147, 140, 143,
-    118, 140,   0,  69,  51,  60, 111, 123, 137, 135,
-    146, 146, 164, 165, 207, 214, 145, 143, 149, 147,
-    178, 168, 197, 170, 134, 154, 148, 159, 115, 140,
-    103, 118,  13,  38, 139, 138, 135, 138, 140, 141,
-    144, 144, 140, 140, 150, 150, 156, 157, 164, 171,
-    143, 143, 140, 142, 118, 120, 172, 172, 160, 163,
-    146, 147, 150, 151, 176, 176, 230, 237, 153, 153,
-    168, 156, 173, 149, 164, 148, 162, 146, 178, 158,
-    147, 145, 143, 145, 111, 126, 111, 130,  89, 118,
-    153, 158, 122, 120, 142, 125, 124, 105, 148, 138,
-    145, 144, 156, 151, 193, 154, 146, 147, 119, 135,
-    142, 141, 145, 145, 152, 147, 142, 141, 146, 146,
-    139, 138, 154, 154, 148, 150, 147, 149, 144, 145,
-    134, 134, 141, 140, 135, 134, 145, 147, 160, 163,
-    144, 145, 149, 146, 115,  67, 127, 119, 141, 135,
-    145, 141, 130, 124, 143, 144, 151, 165, 141, 144,
-    154, 152, 160, 136, 115,  82,  64,  71,  64,  65,
-    143, 143, 151, 149, 240, 251, 165, 173, 173, 179,
-    148, 134, 156,  55, 160, 105, 133,  91, 129,  96,
-    149, 149, 145, 144, 160, 154, 171, 159, 140, 142,
-    154, 163, 178, 244, 147, 140, 153, 150, 137, 121,
-    145, 144, 145, 146, 138, 139, 149, 152, 189, 198,
-    148, 148, 156, 158, 168, 182, 165, 182, 172, 201,
-    143, 142,  99,  92, 152, 152, 143, 143, 127, 127,
-    165, 148, 173, 124, 113, 122, 134, 142, 127, 142,
-    124, 126, 137, 137, 131, 132, 144, 142, 141, 138,
-    172, 176, 138, 111, 152, 136, 167, 154, 156, 137,
-    140, 150,  78, 145, 158, 157, 161, 154, 155, 147,
-    153, 164, 156, 191, 129, 109, 153, 146, 153, 141,
-    138, 137, 141, 138, 115,  94, 144, 141, 155, 147,
-    144, 142, 144, 137, 168, 113, 141, 134, 145, 137,
-    146, 144, 150, 148, 140, 155, 103, 178, 137, 149,
-    145, 147, 148, 153, 175, 201, 138, 146, 110, 108,
-    143, 146, 124, 134, 124, 127, 164, 158, 127, 135,
-    145, 146, 150, 150, 145, 147,  95,  80, 150, 151,
-    149, 149, 162, 162, 144, 152, 170, 169, 145, 154,
-    145, 149, 143, 146, 142, 145, 152, 146, 160,  98,
-    141, 141, 153, 153, 140, 137, 131, 131, 145, 146,
-    133, 132, 127, 124, 158, 150, 173, 164, 178, 167,
-    146, 146, 154, 155, 117, 127, 143, 147, 147, 156,
-    142, 143, 144, 145, 146, 152, 170, 199, 151, 165,
-    146, 147, 139, 140, 147, 149, 132, 134, 147, 149,
-    138, 139, 142, 143, 162, 188, 145, 149, 160, 164,
-    150, 150, 139, 139, 143, 142, 146, 146, 137, 138,
-    142, 142, 141, 140, 152, 153, 164, 171, 110, 112,
-    139, 139, 143, 143, 138, 138, 142, 142, 143, 143,
-    137, 140, 142, 142, 145, 141, 149, 141, 182, 135,
-    146, 146, 150, 150, 144, 145, 150, 151, 135, 137,
-    137, 145,  51,  62,  68,  54,  69,  57,  62,  41,
-    137, 139, 139, 144, 135, 150, 225, 232, 208, 197,
-    136, 135, 141, 143, 145, 150, 160, 169, 213, 247,
-    142, 137,  72,  54, 110, 107, 105, 107, 127, 130,
-    145, 143, 169, 155, 219, 174, 195, 164, 183, 157,
-    155, 157, 239, 232, 169, 164, 170, 172, 156, 159,
-    142, 143, 136, 144,  59, 100, 139, 142, 130, 138,
-    147, 146, 150, 161, 128, 235, 143, 155, 146, 167,
-    154, 149, 128, 151,  42, 149,  55, 136,  59, 127,
-    128, 126,  74,  92, 143, 153, 140, 150, 166, 176,
-    146, 152, 150, 145, 140, 100, 140, 105, 124,  59,
-    195, 191, 146, 148, 144, 136, 136, 133, 129, 122,
-    133, 148,  40, 147, 102, 140, 123, 148, 118, 136,
-    143, 143, 150, 148, 184, 153, 160, 147, 166, 149,
-     58,  68, 127, 135, 141, 145, 143, 147, 150, 151,
-    140, 143, 137, 137, 120, 114,  71,  65, 125, 123,
-    153, 148, 215, 159, 136, 135, 150, 146, 150, 150,
-    148, 138, 166,  94, 150, 145, 145, 139, 147, 145,
-    146, 147, 150, 139, 171,  63, 158, 142, 153, 133,
-    147, 148, 143, 143,  76,  72, 155, 159, 164, 176,
-    149, 149, 173, 195, 145, 165, 138, 144, 150, 167,
-    180, 169, 146, 151, 146, 166, 147, 166, 149, 171,
-    157, 156, 168, 166, 147, 149, 121, 122, 116, 124,
-    145, 145, 147, 148, 172, 189, 168, 180, 144, 146,
-    139, 145, 141, 150, 115, 172, 141, 146, 143, 148,
-    145, 145, 142, 143, 145, 147, 138, 143,  58,  73,
-    141, 142, 146, 145, 163, 149, 218, 161, 147, 132,
-    152, 147, 146, 147, 140, 150, 141, 152,  89, 150,
-     78, 134, 135, 137, 139, 142, 140, 137, 137, 130,
-    144, 144, 152, 151, 145, 140, 181, 170, 191, 168,
-    164, 166, 136, 148, 112, 124, 139, 144, 146, 149,
-    142, 151, 113, 182, 137, 150, 143, 156, 138, 147,
-    154, 156, 108, 102, 118, 119, 133, 139, 113, 111,
-    145, 144, 150, 147, 175, 151, 104, 106, 116, 114,
-    143, 144, 151, 157, 151, 191, 135, 113, 138, 123,
-    146, 146, 155, 157, 106, 145, 132, 127, 140, 125,
-    161, 165, 146, 150, 151, 154, 139, 140, 142, 143,
-    144, 148, 145, 149, 147, 138, 168, 104, 146, 136,
-    138, 140,  91, 108, 111, 110, 145, 140, 158, 154,
-    130, 112, 122, 118, 136, 135, 119, 118, 141, 140,
-    147, 146, 146, 145, 138, 138, 182, 188, 132, 132,
-    144, 144, 156, 155, 168, 172, 123, 128, 144, 151,
-    142, 140, 145, 145, 137, 144, 141, 152, 128, 188,
-    149, 149, 160, 161, 160, 160, 166, 163, 130, 107,
-    143, 143, 142, 142, 149, 149, 132, 132, 170, 174,
-    148, 148, 154, 153, 118, 111, 157, 155, 114, 109,
-    140, 139, 138, 137, 205, 187, 137, 133, 147, 144,
-    144, 145, 147, 149, 105, 125, 108, 117, 155, 162,
-    146, 146, 162, 157, 144, 122, 154, 143, 161, 139,
-    141, 142, 130, 131, 144, 144, 142, 141, 144, 142,
-    132, 132, 141, 141, 150, 151, 139, 141, 151, 153,
-    142, 142, 154, 154, 150, 150, 148, 148, 166, 165,
-    143, 142, 144, 144, 132, 132, 142, 144, 130, 128,
-    142, 142, 143, 143, 153, 153, 147, 142, 129, 125,
-    142, 141, 143, 142, 143, 147, 105, 122, 135, 140,
-    141, 140, 140, 140, 151, 151, 156, 155, 146, 146,
-    133, 134, 140, 142, 142, 145, 141, 146, 112, 133,
-    142, 142, 145, 145, 137, 138, 155, 157, 149, 150,
-    144, 144, 139, 138, 130, 128, 132, 131, 147, 147,
-    139, 140, 142, 143, 115, 121, 141, 143, 137, 141,
-    146, 146, 150, 150, 145, 144, 133, 133, 133, 135,
-    143, 144, 144, 144, 166, 167, 139, 142, 139, 140,
-    150, 149, 138, 138, 142, 140, 148, 147, 160, 155,
-    146, 146, 147, 147, 138, 137, 143, 142, 151, 150
-};
-
-static const uint8_t wmavoice_dq_lsp16r2[0x500] = {
-     98,  98, 119, 121, 109, 112, 128, 135, 115, 121,
-    159, 113, 113, 106, 127, 114, 101, 102, 105, 111,
-    161, 162, 137, 138, 161, 159, 152, 150, 150, 148,
-    128,  79, 131, 102, 142, 120, 133, 119, 130, 117,
-    121, 115, 142, 133, 186, 155, 179, 144, 169, 135,
-    107, 103, 106, 106, 122, 122, 111, 112, 112, 115,
-    127, 123, 118, 115, 128, 125, 123, 119, 115, 109,
-    124, 130, 117, 126, 121, 133,  84, 144,  99, 114,
-    122, 125, 123, 131, 124, 135, 176, 200, 158, 176,
-     68,  74,  86,  87, 117, 115, 119, 116, 135, 128,
-    115, 116, 102, 104, 119, 123, 133, 148, 102, 109,
-     71, 121, 106, 117, 107, 127, 106, 122, 100, 110,
-    117, 115, 129, 128,  87,  84, 116, 116, 151, 157,
-    116, 128, 110, 117, 119, 134, 100, 114, 120, 129,
-    142, 141, 146, 151,  94,  91, 114, 114, 118, 118,
-    114, 112, 112, 109, 115, 112, 123, 123, 147, 148,
-    110, 164, 106, 152, 110, 158, 106, 151, 105, 135,
-     85,  51,  71,  27,  71,  34,  74,  45,  85,  53,
-    145, 134, 140, 130, 136, 134, 118, 122, 118, 126,
-    117,  84, 121,  81, 106,  80, 109, 106, 121, 127,
-     95,  94, 112, 110,  90,  94, 109, 107, 114, 109,
-    117, 118, 118, 123, 107, 107,  86,  93,  29,  31,
-    125, 112, 104,  60, 121, 111, 127, 116, 133, 130,
-    118, 117, 148, 145, 122, 126, 124, 127,  90,  91,
-    113, 110, 119, 118, 152, 147, 115, 112, 132, 131,
-    129, 140,  98, 112,  73,  85, 109, 115, 122, 126,
-    123, 122, 122, 122, 126, 125, 137, 140, 203, 210,
-    164, 176, 114, 114, 125, 122, 119, 112, 125, 120,
-    124, 122, 118, 115,  95,  96, 141, 144, 132, 131,
-    127, 130, 132, 134, 116, 114, 122, 123, 137, 134,
-    111, 111, 112, 116, 106, 118,  77, 101, 104, 115,
-    111, 111, 125, 126, 118, 121, 113, 115, 113, 113,
-    171, 170, 202, 199, 221, 206, 199, 184, 177, 167,
-     73,  90,  61,  93,  43,  74,  51,  71,  51,  72,
-    130, 130, 140, 137, 134, 132, 164, 160, 118, 111,
-    123, 136, 133, 154, 130, 158, 106, 110, 110, 114,
-     97,  97,  91,  94,  70,  69, 125, 123, 141, 140,
-    119, 100, 116,  77, 111,  67, 105,  52,  95,  34,
-    100, 122,  90, 124,  68, 120,  43, 117,  50, 112,
-    130, 129, 192, 188, 123, 118, 124, 117, 121, 115,
-    122, 111, 129, 111, 157,  85, 125, 109, 125, 119,
-    143, 152, 119, 128, 114, 116, 129, 136, 148, 157,
-    119, 117, 115, 115, 150, 148, 163, 154, 109, 102,
-    120, 126,  73, 119, 106, 121, 102, 122,  96, 113,
-     84,  83, 117, 115, 122, 117, 154, 143, 159, 142,
-    118, 122, 114, 117, 115, 122, 114, 130,  99, 156,
-    123, 120, 122, 116, 100,  81,  99,  91, 121, 112,
-    139, 131, 164, 142, 132, 119, 145, 133, 157, 141,
-    112, 109, 118, 116, 142, 134, 108, 110,  96,  99,
-    111, 110, 113, 112, 111, 104,  98,  94, 131, 131,
-    115, 114, 121, 118, 120, 115, 173, 148, 123, 117,
-    121, 124, 122, 124, 140, 146,  78,  82,  96,  93,
-     86,  90, 124, 125, 121, 123, 105, 106, 134, 135,
-    107, 109, 132, 141, 100,  95, 113, 114, 102, 105,
-    113, 130,  98, 145, 116, 115, 124, 117, 115, 105,
-    120, 123,  89,  87, 109, 108, 102, 101, 117, 117,
-    113, 122, 132, 138,  77, 116,  86,  99, 118, 126,
-    123, 120, 117, 111, 124, 119, 129, 118,  63,  58,
-    141, 135, 108, 106, 109, 111, 108, 110, 135, 138,
-    117, 114, 134, 127, 139, 129, 138, 130, 126, 122,
-    121, 118, 124, 121, 133, 130,  98,  85, 130, 123,
-    147, 129, 118, 112, 148, 130, 136, 123, 148, 131,
-    113, 112, 123, 118, 123, 115, 147,  95, 117, 110,
-    118, 119, 112, 113, 112, 113, 119, 119, 120, 120,
-    158, 133, 198, 145, 188, 129, 197, 137, 195, 133,
-    132, 140, 140, 139, 158, 156, 223, 217, 233, 233,
-     48,  56,  34,  37,  82,  84, 102, 102, 108, 110,
-    120, 142, 136, 169, 146, 195, 136, 186, 140, 182,
-    196, 186, 158, 155, 142, 134, 132, 125, 120, 119,
-     97, 105,  72,  75,  82,  85,  81,  84, 107, 109,
-     67, 121,  43, 119,  69, 124,  87, 129,  88, 128,
-     53,  57,  93,  98,  91,  94,  93,  98, 104, 104,
-    124, 123, 133, 133, 182, 181, 119, 121, 114, 116,
-    128, 105, 134, 112, 131,  72, 119,  59, 111,  84,
-    132, 142, 145, 180, 124, 132, 131, 143, 122, 134,
-     88,  85, 103, 103, 136, 140, 131, 143, 114, 132,
-    116,  57, 113,  57, 121,  76, 126,  80, 118,  86,
-    127, 112, 127,  97, 131, 100, 149,  91, 163,  86,
-    122, 119, 128, 121, 128, 116, 142, 127, 173, 139,
-    162, 116, 166, 107, 149, 103, 152, 107, 141, 108,
-    114, 113, 118, 116,  56,  43,  90,  90, 105, 105,
-    132, 134, 110, 107, 106, 105,  82,  84,  84,  84,
-    102, 106,  79,  89,  99,  99, 127, 129, 114, 118,
-    139, 157, 116, 123, 116, 123,  87,  89, 110, 113,
-    119, 126,  97,  97, 155, 163, 142, 153, 143, 146,
-    117, 114,  66,  67, 125, 126, 127, 128, 114, 113,
-    111, 114, 127, 133, 123, 132, 143, 162, 133, 148,
-    105, 108, 114, 114, 110, 109,  57,  48, 109, 106,
-    113, 130, 104, 131,  88, 139, 102, 169, 100, 172,
-    129, 114, 150,  97, 114, 112, 117, 119, 109, 116,
-     92, 107,  96, 116,  90, 125, 101, 122, 125, 140,
-    125, 133, 122, 129, 136, 153, 125, 135, 131, 139,
-     84,  71, 129, 123, 135, 120, 114, 103, 112, 101,
-    108, 121, 115, 156, 106, 123, 116, 131, 127, 139,
-    137, 147, 109, 117, 119, 126, 135, 144, 117, 119,
-    120, 127,  76, 105, 111, 116, 120, 125, 141, 138,
-    107, 104, 162, 155, 135, 130, 127, 123, 127, 121,
-    102, 104,  84,  87, 112, 115,  97, 102,  78,  82,
-    119, 118, 120, 123,  91, 105, 114, 119, 119, 126,
-    130, 126, 134, 126, 158, 134, 133,  99, 116, 100,
-    125, 122, 145, 143, 126, 117,  98,  96, 121, 120,
-    152, 148, 131, 126, 130, 129, 126, 119,  87,  87,
-    131, 131, 139, 137, 101, 102, 104, 105,  86,  83,
-     92,  89, 111, 105, 121, 115, 137, 124,  96,  84,
-    100,  96, 122, 119, 107, 108,  93,  96,  79,  82,
-    128, 123, 108, 106, 123, 120, 150, 150, 143, 140,
-    121, 120,  97,  99,  79,  80, 116, 116,  88,  90,
-    128, 131, 101,  97, 140, 140, 117, 116, 116, 118,
-    137, 135, 100,  91, 115, 112, 134, 121, 107,  99,
-    120, 122, 122, 125, 124, 126, 136, 141,  89,  95,
-    103, 119, 103, 116, 122, 139, 125, 137, 152, 170,
-    121, 122, 124, 124,  98,  97, 137, 140,  96,  92,
-    115, 113, 136, 136, 128, 132, 122, 124, 151, 158,
-    100, 107, 121, 131, 131, 158, 119, 130, 113, 114,
-    114, 109, 148, 130, 103,  95, 127, 116, 137, 120,
-    103, 108,  97,  97, 133, 128, 113, 109, 136, 128,
-    125, 124, 118, 118, 122, 121, 101,  99, 157, 152,
-    138, 134, 124, 115, 113, 101, 123, 112, 124, 110,
-    116, 113, 128, 121, 119, 110, 124, 113, 128,  67,
-    114, 118, 114, 123, 109, 121, 102, 123,  56, 116,
-    117, 111, 112,  99, 124, 114, 112,  79, 114,  88,
-    112, 113, 115, 117, 126, 127, 130, 132, 123, 122,
-    111, 104, 111, 102, 112, 102, 129, 118, 129, 115,
-    123, 124, 130, 133, 114, 117, 125, 127, 112, 117,
-    124, 125, 119, 120, 117, 116, 105, 104, 110, 110,
-    125, 124, 118, 116, 124, 123, 124, 121, 133, 132,
-    111, 111, 124, 124, 120, 119, 116, 116, 134, 130,
-    114, 116, 112, 113, 109, 111, 116, 118,  95,  98
-};
-
-static const uint8_t wmavoice_dq_lsp16r3[0x600] = {
-     84,  82,  95,  94, 125, 131,  98, 102,  94,  93, 104, 104,
-    127, 113,  87,  77, 125, 114, 109,  94,  94,  91, 106, 105,
-    168, 125, 163, 120, 128, 100, 119,  99, 108,  97, 108, 106,
-     86,  85, 128, 125,  79,  73, 103, 102, 123, 123, 116, 117,
-     84,  76, 135, 131, 133, 133, 129, 130, 125, 123, 115, 114,
-     94,  97,  79,  81, 115, 115,  94,  93, 128, 127, 126, 125,
-    124, 111, 105, 114, 104, 117, 109, 110, 124, 125, 118, 117,
-    107, 110, 106, 110,  93,  93, 149, 148, 118, 119, 111, 110,
-    147, 157, 143, 156, 134, 136, 118, 121, 106, 107, 105, 105,
-    114,  83, 114,  46, 106,  53, 110,  83, 107,  94, 105, 103,
-     92,  90, 109, 106, 172, 160, 114, 110, 109, 110, 110, 109,
-     90,  98,  98, 109, 102,  98,  97,  92, 100, 100, 101, 102,
-    123, 117, 124,  98,  82,  80, 117, 115, 112, 110, 109, 108,
-    107, 111, 100, 115, 105, 120, 104, 105,  83,  82,  95,  96,
-    109, 120,  72,  71,  97, 104,  69,  74,  99, 102, 118, 117,
-    137, 133, 142, 135, 105, 110, 121, 121, 125, 122, 114, 112,
-    151, 186, 115, 132, 103, 111, 100, 104,  99, 101, 104, 105,
-     18,  38,  56,  65,  76,  83,  85,  91, 101, 103, 108, 110,
-    144, 135, 126, 121, 115, 113,  79,  80, 118, 117, 117, 117,
-    117, 124, 115, 115, 126, 113, 130, 116, 112, 106, 108, 105,
-     77,  76,  76,  80, 109, 109, 125, 129, 130, 133, 116, 118,
-     96,  86, 109,  99, 102,  69,  84,  69, 107, 103, 114, 113,
-     78, 118,  82, 114,  84, 129,  69, 112,  78,  98,  96, 103,
-     89, 137,  96, 111, 105,  97,  93,  93, 101, 105, 105, 105,
-    141, 123, 102,  93,  91,  79,  87,  81, 102,  99, 109, 108,
-     94,  92, 124, 123, 130, 134, 100, 107,  71,  75,  92,  91,
-     94, 104, 107,  83, 106, 101, 113, 114, 122, 122, 114, 114,
-    118, 124, 103, 106,  95, 116,  90,  93, 107, 104, 109, 107,
-    116, 118,  76,  72,  88,  88, 132, 132, 140, 141, 116, 116,
-     90,  81, 111,  95, 139,  97, 123,  96, 112, 100, 110, 108,
-    112, 116, 133, 140, 112, 120,  80,  85,  55,  55,  85,  84,
-    125,  94, 111, 104, 116, 103, 112,  86,  93,  84,  99,  98,
-    180, 179, 197, 197, 169, 163, 149, 146, 130, 124, 116, 115,
-     76,  47,  36,  11,  43,  28,  66,  53,  82,  80, 102,  99,
-    119, 123, 176, 201, 113, 120, 112, 111, 103, 105, 106, 110,
-    145, 114, 112,  89, 120,  93, 123, 104, 131, 123, 113, 111,
-     97, 109,  82, 106,  75, 104, 103, 115, 120, 124, 111, 114,
-    114, 111, 113, 105,  34,  33,  63,  63, 105, 106, 122, 122,
-     51,  41,  96,  92, 125, 125, 118, 118, 118, 119, 113, 113,
-    111, 180, 108, 178, 107, 171, 110, 160, 105, 136, 102, 117,
-     76,  79,  90,  92,  80,  88,  88,  93, 123, 124, 122, 122,
-    131, 128, 123, 122, 151, 158, 108, 107, 129, 128, 119, 119,
-     97,  99, 114, 120, 121, 125, 151, 157,  82,  89,  95,  96,
-    128,  94, 130,  95, 149, 113, 149, 120, 127, 115, 113, 109,
-    167, 171,  83,  80,  84,  79, 106, 106, 112, 110, 107, 108,
-    130, 139,  81,  88, 107, 106, 112, 112, 119, 118, 114, 112,
-    108, 105, 100,  98, 120, 116, 122, 117,  38,  37,  72,  73,
-    118, 125, 110, 120, 114, 126, 135, 142, 139, 142, 118, 119,
-    119, 119, 156, 145,  78,  75,  94,  94, 112, 110, 113, 113,
-    101, 108,  98, 104, 103, 109, 117, 118, 167, 167, 132, 132,
-    116, 108, 118, 111, 149, 136,  85,  74,  95,  92, 113, 112,
-     74,  69, 104, 107,  96, 100, 117, 121, 103, 105, 103, 103,
-    110, 106, 111, 101,  82,  72,  96,  92, 132, 130, 120, 121,
-    116, 113, 138, 139, 104, 103, 131, 131,  68,  69,  92,  92,
-     97,  97, 146, 151, 122, 132,  97,  95, 117, 116, 115, 116,
-    139, 134, 110, 110, 124, 129, 100, 110,  86,  91, 100, 102,
-    116, 136,  88,  90, 137, 139, 103, 114, 114, 117, 111, 110,
-     82,  83, 104, 102,  97,  99,  97,  97,  58,  56,  84,  84,
-     83, 122,  76, 105, 112, 126, 120, 134, 112, 120, 108, 110,
-    114, 128,  73,  90,  72,  76,  98, 100,  95,  96, 101, 102,
-    101, 108, 118, 126,  94, 102,  81,  83, 138, 140, 131, 130,
-     88, 100, 112, 124, 105, 106, 122, 123, 121, 121, 114, 114,
-     76, 108,  73,  83,  93,  95, 110, 111,  98,  99, 103, 103,
-    105, 112,  98, 108, 114,  95, 117,  98, 120, 116, 116, 115,
-    231, 238, 150, 146, 124, 126, 115, 122, 117, 121, 112, 112,
-     74,  73,  72,  74,  60,  61,  62,  61,  85,  85, 101, 101,
-     67,  69,  50,  51,  83,  83, 110, 110, 118, 113, 112, 111,
-    199, 124, 184, 115, 176, 117, 165, 120, 138, 115, 116, 114,
-     52, 116,  36, 107,  49,  99,  72, 106,  91, 107, 104, 105,
-    140, 138, 141, 135, 154, 147, 166, 159, 139, 136, 116, 115,
-    130, 119, 180, 157, 183, 149, 136, 121, 119, 114, 111, 110,
-    104, 129, 113, 154, 111, 148, 108, 132, 105, 117, 106, 111,
-    114,  35,  99,  65, 113,  94, 110,  98, 111, 107, 107, 106,
-    106, 110, 128, 135, 162, 175, 143, 155, 115, 116, 109, 109,
-    168, 155, 112, 109, 125, 125, 126, 122, 126, 124, 111, 112,
-    128,  96, 160,  77, 151,  77, 121,  80, 114,  94, 107, 103,
-     97, 104, 101, 116,  56,  79,  74,  83,  92,  95, 104, 106,
-     63,  68,  76,  77, 110, 107,  96,  90,  85,  83,  97,  96,
-    116, 110,  46,  42, 103, 100, 122, 120, 102, 101, 104, 104,
-    106, 101, 109,  98,  96,  61,  67,  35,  72,  61,  96,  93,
-     88,  80,  81,  76, 113, 110, 144, 143,  88,  89,  93,  94,
-     95,  96, 100, 101, 136, 132, 166, 160, 148, 147, 115, 116,
-     80,  78, 130, 129, 120, 108,  91,  85,  95,  91, 104, 102,
-    151, 147, 106, 109, 110, 110,  64,  69,  68,  67,  96,  96,
-     90, 166,  97, 128,  99, 120, 104, 121, 109, 118, 105, 109,
-    122, 138, 110, 143,  75,  97,  83,  94,  89,  94, 102, 103,
-    136, 142, 103, 110,  83,  89,  99, 101, 138, 138, 120, 122,
-    168,  88, 105,  90, 109, 107, 110, 111, 106, 105, 103, 102,
-     68,  72, 102, 104,  92, 102,  65,  75,  89,  94, 106, 106,
-     83,  74,  93,  85,  73,  66, 106, 102, 100,  92,  99,  97,
-     93,  99, 101,  96, 116, 112, 125, 120,  88,  88,  96,  96,
-     44,  98,  93, 115, 104, 116, 103, 107, 112, 113, 107, 107,
-     93,  83, 105,  99,  93,  84, 127, 125, 141, 143, 117, 118,
-    106, 103, 126, 121, 137, 123, 123, 114, 147, 142, 127, 123,
-    103, 110,  89,  91, 121, 124,  66,  71,  68,  69,  96,  97,
-    114, 105,  68,  65,  69,  67,  96,  94, 131, 130, 123, 121,
-    111, 104, 130, 121,  95,  95,  72,  74,  88,  88, 105, 104,
-    135, 124, 110,  98, 114, 111, 159, 158, 111, 113, 104, 106,
-    103, 108,  94, 107,  55,  57, 115, 118, 121, 122, 111, 111,
-     97,  99, 106, 111, 119, 126,  59,  62, 111, 112, 124, 125,
-     86,  93, 100, 110, 118, 145, 113, 132, 120, 125, 112, 112,
-    101, 115,  78, 149,  81, 114, 111, 121, 108, 112, 107, 108,
-    104, 104,  94,  96,  84,  83, 135, 132,  71,  69,  88,  86,
-    100,  98,  62,  60,  81,  80,  90,  89,  63,  66,  89,  90,
-    123, 116, 108,  99,  90,  86,  91,  92,  65,  65,  88,  88,
-     84,  79, 115, 109, 123, 111,  99,  99, 134, 136, 121, 123,
-    127, 137,  84,  88, 104, 107, 128, 130,  74,  69,  89,  89,
-    118, 112, 143, 132, 141, 131, 113, 113,  99, 102, 104, 105,
-    117, 115, 100,  99, 131, 126,  90,  88, 145, 144, 128, 127,
-    112, 114, 131, 133,  85,  84, 118, 119, 151, 152, 117, 117,
-    110, 105, 162, 140, 116, 107, 140, 134, 124, 122, 113, 113,
-    107, 110, 124, 133,  98, 103,  99, 107, 109, 113, 112, 112,
-    115, 105,  82,  77, 125, 122, 133, 132, 118, 120, 113, 113,
-    101,  88,  84,  80,  97,  99,  91,  91,  94,  94, 101, 100,
-    121,  86, 139, 108, 106,  93, 103,  99, 112, 108, 108, 107,
-    113,  83, 105, 102, 125, 125, 114, 115, 110, 112, 108, 109,
-     93, 112, 113, 121, 125, 131, 101, 101, 107, 109, 111, 111,
-     98, 102, 117, 126,  80,  84, 107, 109,  83,  84,  96,  97,
-    132, 136, 112, 118,  94,  93, 121, 118,  99,  98, 102, 103,
-    122, 127, 128, 133, 118, 104, 102,  88, 100,  94, 104, 102,
-    115, 116, 102, 105, 140, 142, 135, 130,  90,  88, 100, 101,
-     94,  86, 112, 112,  89, 121,  92, 101, 109, 108, 110, 112,
-     99,  93, 129, 114, 109,  99, 131, 119, 102,  97, 103, 103,
-    103, 116, 124, 101, 115,  95, 105, 101,  94,  91, 100, 100,
-    113,  90,  94,  86,  92,  92, 117, 111, 106, 103, 106, 105,
-    115,  99, 110,  91, 107, 104,  81,  90, 108, 113, 112, 113,
-    113, 114,  93, 101, 101, 102, 101, 126,  93, 103, 104, 105,
-    117, 106, 124, 107, 104, 119, 108, 133, 104, 111, 104, 106
-};
-
-static const float wmavoice_lsp10_intercoeff_a[32][2][10] = {
-    { {  0.5108627081,  0.0480548441, -1.5099149644,  0.6736935377,
-         0.7536551058,  0.7651474178,  0.8510628343,  0.6667704582,
-         0.7576012611,  0.7091397047 },
-      {  0.1351471841, -0.1965375543, -1.6313457787,  0.3218626380,
-         0.4132472873,  0.4663473070,  0.5805781186,  0.3962165117,
-         0.4818550050,  0.4907165468 } },
-    { {  0.8556320667,  0.7774704993, -0.0175759494, -0.1882298589,
-         0.1892164350,  0.4850396216,  0.6270319819,  0.6327089071,
-         0.6513319910,  0.6075088978 },
-      {  0.4374088347,  0.3505934179, -0.0762144327, -0.2830760479,
-        -0.0626451969,  0.1500318050,  0.2602472305,  0.2781780064,
-         0.3167395592,  0.3596626520 } },
-    { {  0.1899779737,  0.0650856197,  0.1699010432,  0.9122628570,
-         0.9097705483,  0.7433397174,  0.6304935217,  0.5164704025,
-         0.4174703658,  0.5215242505 },
-      {  0.0704856217,  0.0169009864,  0.0188394487,  0.5587704182,
-         0.5194473267,  0.3539164960,  0.2426626086,  0.1721164286,
-         0.1371548772,  0.2594856918 } },
-    { {  0.8858859241,  0.9100474715,  0.8921859264,  0.9332397878,
-         1.0225475132,  1.0555013716,  1.0983552337,  1.1290244758,
-         1.0363244414,  0.9277705550 },
-      {  0.4810934663,  0.5782935023,  0.6835935414,  0.7650781870,
-         0.9018090069,  0.9996321201,  1.0219936669,  1.0474705994,
-         0.9109474719,  0.7774704993 } },
-    { {  0.4359549880,  0.2275702953,  0.0993548632,  0.1763395071,
-         0.1055856347,  0.1018471718,  0.1170087159,  0.1221317947,
-         0.1834010482,  0.2988780141 },
-      {  0.1573702693,  0.1041317880,  0.0506856143,  0.0781702399,
-         0.0058932900, -0.0026913285, -0.0031067133,  0.0070702136,
-         0.0116394460,  0.0566394627 } },
-    { {  0.8528628349,  0.8028782010,  0.4680088460,  0.9055474699,
-         1.3742399514,  1.1093629301,  0.4122780561,  0.4003703594,
-         0.6360319853,  0.6415704489 },
-      {  0.4252934456,  0.3823703527,  0.1676856577,  0.5241550207,
-         1.1995706558,  0.9088013172,  0.1224087179,  0.0730471611,
-         0.3071857095,  0.3772472739 } },
-    { {  0.5508781075,  0.2829549313, -0.0022067130,  0.1042702496,
-         1.0318244398,  1.3258476257,  1.3550630212,  0.9931936562,
-         0.7195243239,  0.6807550788 },
-      {  0.2679318488,  0.0960317850, -0.1357529163, -0.1291759908,
-         0.6451012194,  0.9968628883,  0.9510321021,  0.6608166099,
-         0.3799472749,  0.3735780418 } },
-    { {  0.9967244267,  1.0255244374,  0.9800398052,  0.7939474285,
-         0.8288397491,  0.8390166759,  0.8660166860,  0.9247936308,
-         0.9127474725,  0.8684397638 },
-      {  0.7921474278,  0.9416859448,  0.8547320664,  0.5348165631,
-         0.6231550574,  0.6703012288,  0.6987550855,  0.8147858977,
-         0.7406397164,  0.6496012211 } },
-    { {  0.1439394951, -0.3193529844, -0.2024914026, -0.1854606271,
-         0.0877240896,  0.1617318094,  0.3087087870,  0.3777318895,
-         0.3910242021,  0.4797780812 },
-      { -0.0157067180, -0.1778452396, -0.1554836929, -0.1759760082,
-        -0.0607759655, -0.0161221027,  0.0393317640,  0.0758856237,
-         0.1163856387,  0.1947548985 } },
-    { {  1.1021629274,  0.9958244264,  0.4658626914,  0.3089164793,
-         0.3740626574,  0.2962472439,  0.3170857131,  0.2420395315,
-         0.2649549246,  0.2936857045 },
-      {  0.4700857699,  0.1809087396,  0.0311625302,  0.0106009841,
-         0.0311625302,  0.0266625285,  0.0221625268,  0.0156548321,
-         0.0551163852,  0.1010164022 } },
-    { {  0.2925087810,  0.3418011069,  0.7339243293,  0.7322627902,
-         0.7288704813,  0.7924935818,  0.7724166512,  0.7819012702,
-         0.8325782120,  0.7954705060 },
-      {  0.0559471548, -0.0456144214, -0.0462374985, -0.1005144417,
-        -0.0511528850, -0.0455451906, -0.0044220984,  0.0451471508,
-         0.1232394874,  0.2085318267 } },
-    { {  0.2230702937, -0.9052532017,  1.2441552877,  1.0825706124,
-         0.9088705480,  0.8797243834,  0.8648397624,  0.8091089725,
-         0.7633474171,  0.7468704879 },
-      { -0.2030452490, -1.4167303145,  1.3542322516,  0.8369397521,
-         0.6148473620,  0.5560704172,  0.5450627208,  0.4978473186,
-         0.4200319052,  0.4904396236 } },
-    { {  0.6088242829,  0.5965704322,  0.6547242999,  0.8554936051,
-        -0.2989298999,  0.2404472232,  0.3573780358,  0.7499166429,
-         0.7691628039,  0.6824858487 },
-      {  0.2582395375,  0.2721549273,  0.3462318778,  0.4820626974,
-        -0.4780299664, -0.0712990463,  0.0200163722,  0.4246703684,
-         0.4660011530,  0.4172626734 } },
-    { {  1.1749937236,  1.0773090720,  1.0566782951,  1.0249013603,
-         0.9947167337,  0.9626628757,  0.9562244117,  0.9072782397,
-         0.7654243410,  0.6448935270 },
-      {  1.1595552564,  0.9340013266,  0.3959395885,  0.3693549633,
-         0.3915780485,  0.3104395568,  0.3499011099,  0.2236933708,
-         0.1638087332,  0.1811856627 } },
-    { {  0.9572628736,  0.9389859438,  0.6619243026,  0.6849089265,
-         0.7276935577,  0.7839781940,  0.7987243533,  0.7748397291,
-         0.7101089358,  0.7277627885 },
-      {  0.5809935033,  0.5575934947,  0.3544703424,  0.3636780381,
-         0.3736472726,  0.4486242235,  0.4684934616,  0.4481396079,
-         0.3456780314,  0.4478626847 } },
-    { {  0.1259394884,  1.3096476197,  1.0794552267,  1.0009475052,
-         0.9061013162,  0.9216782451,  0.8954397738,  0.9160013199,
-         0.8575012982,  0.7479089499 },
-      { -0.3689222336,  1.5293861628,  0.7323320210,  0.4102703631,
-         0.3825780451,  0.2828164697,  0.2644010782,  0.2455010712,
-         0.2482010722,  0.2335241437 } },
-    { {  0.5380704105,  0.1600702703, -0.0657605827, -0.2390452623,
-        -0.3885837793, -0.4150299430, -0.3001760542, -0.1451683044,
-         0.1312010288,  0.2798395455 },
-      {  0.2074933648,  0.0560163856, -0.0956682861, -0.2893068194,
-        -0.3889991641, -0.3918376267, -0.3550068438, -0.2649375796,
-        -0.0554451942,  0.1167317927 } },
-    { {  0.6092396677,  0.5101011693,  0.4012011290,  0.5416011810,
-         0.5715781152,  0.6476627588,  0.6988243163,  0.7306012511,
-         0.7531704903,  0.6534781456 },
-      {  0.2060395181,  0.1409625709,  0.1024702489,  0.1834010482,
-         0.1946856678,  0.2547779977,  0.3134857118,  0.3283011019,
-         0.3837549686,  0.3501780331 } },
-    { {  0.4516011477,  0.5351627171,  0.8068243563,  0.7049858570,
-         0.7165473998,  0.6005858183,  0.4870473146,  0.2500010729,
-         0.3132087886,  0.4462703764 },
-      {  0.1053087115,  0.1348702610,  0.4457857609,  0.3499703407,
-         0.3537780344,  0.2628780007,  0.1665087342,  0.0200856030,
-         0.0329625309,  0.1525241137 } },
-    { {  0.7058166265,  0.7305320203,  1.1684860289,  1.4524707496,
-         1.3212091625,  1.2613245249,  1.1712552607,  1.1154552400,
-         1.0487167537,  0.9153782427 },
-      {  0.2286087573,  0.2851703167,  1.2016475797,  1.5154707730,
-         1.2726091444,  1.1459167898,  0.9801090360,  0.9296397865,
-         0.8490551412,  0.6772243083 } },
-    { {  0.6686396897,  0.5728935003,  0.4734780788,  0.6970243156,
-         0.5852165818, -0.0762836635, -0.2054683268, -0.1380375326,
-         0.1282933354,  0.3467164934 },
-      {  0.2925087810,  0.2344933748,  0.1677548885,  0.2747856975,
-         0.2097087502, -0.2795452774, -0.3761222363, -0.3183837533,
-        -0.0834836662,  0.1482318044 } },
-    { {  0.6559704542,  0.7737320364,  0.9867551923,  0.9912551939,
-         0.9508936405,  0.9114320874,  0.8336859047,  0.7905551195,
-         0.7672935724,  0.7532397211 },
-      {  0.1843702793,  0.2565087676,  0.7571858764,  0.7545551062,
-         0.6793704629,  0.5981627405,  0.5078165531,  0.4282011390,
-         0.3948318958,  0.4502165318 } },
-    { {  0.4430857599,  0.6102781296,  0.8485012949,  0.8573628366,
-         0.9078320861,  0.9979705811,  1.0411013663,  1.0524552166,
-         1.0194321275,  0.9023628533 },
-      {  0.0070009828,  0.0084548295,  0.1613856554,  0.3484472632,
-         0.4385857582,  0.5895088911,  0.6367935240,  0.6736935377,
-         0.7026320100,  0.5924165845 } },
-    { {  1.0532859862,  1.1059706211,  1.1311013997,  1.1250783205,
-         1.0425552130,  0.9993551970,  0.9673013389,  0.9386397898,
-         0.8836013079,  0.8336859047 },
-      {  0.9791398048,  1.1481321752,  1.1275706291,  1.0082167387,
-         0.8809705377,  0.8031551242,  0.7287320197,  0.6496704519,
-         0.5211088657,  0.4734088480 } },
-    { { -0.0251221061, -0.0443682671,  0.1282241046,  0.3850703537,
-         0.4252934456,  0.4547857642,  0.4690473080,  0.4873242378,
-         0.6001012027,  0.5882627368 },
-      { -0.0562759638, -0.0246374905,  0.0070009828,  0.0971394777,
-         0.1232394874,  0.1278779507,  0.1302317977,  0.1462241113,
-         0.2073549032,  0.2446010709 } },
-    { {  1.1749244928,  1.1155937016,  0.9236167073,  0.6288319826,
-         0.6515396833,  0.5391781032,  0.5398011804,  0.4997165501,
-         0.4066703618,  0.3998857439 },
-      {  0.9403013289,  0.7346166372,  0.1841625869,  0.1319625676,
-         0.1395087242,  0.0857856274,  0.0952702463,  0.0860625505,
-         0.0829471648,  0.1132010221 } },
-    { {  0.9047167003,  0.9840551913,  0.9933321178,  0.9360090196,
-         0.9164859354,  0.9213320911,  0.8701705337,  0.8815936148,
-         0.8414397538,  0.8188012838 },
-      {  0.0961010158, -0.0147374868,  0.0202240646,  0.1002548635,
-         0.1407548785,  0.1837472022,  0.1858241260,  0.2064549029,
-         0.2228626013,  0.2859318554 } },
-    { {  0.4034165144,  0.1918472052,  2.1959402561,  0.4763165414,
-         0.6577012241,  0.7036704719,  0.6626858413,  0.7650089562,
-         0.7702704966,  0.6543781459 },
-      {  0.0940933228, -0.1222529113,  2.3491480052,  0.1385394931,
-         0.3052472472,  0.3665857315,  0.3350857198,  0.4722319245,
-         0.4313857555,  0.3846549690 } },
-    { {  0.8215012848,  0.8613782227,  1.0399936736,  1.4082322717,
-         0.4075011313,  0.4091626704,  0.5230473280,  0.6101396680,
-         0.7510243356,  0.7237474024 },
-      {  0.4810934663,  0.5670088828,  0.9207782447,  1.3007860780,
-         0.0453548431,  0.0858548582,  0.1803548932,  0.2790087759,
-         0.3974626660,  0.4581780732 } },
-    { {  1.5921784937,  1.4987169206,  1.1321398616,  0.8235089779,
-         0.6888550818,  0.6621319950,  0.6192089021,  0.6533396840,
-         0.7196627855,  0.6549319923 },
-      {  1.5911400318,  1.4768399894,  0.9358705580,  0.4674549997,
-         0.3522549570,  0.3144549429,  0.2985318601,  0.3559241891,
-         0.4061857462,  0.3958703578 } },
-    { {  0.7975474298,  0.8712782264,  0.8974474669,  0.3008164763,
-         0.5562088788,  0.6655935347,  0.8921166956,  1.0918475389,
-         0.9544936419,  0.8554936051 },
-      {  0.3769703507,  0.4930703938,  0.6619243026, -0.0382759571,
-         0.1766856611,  0.3015780151,  0.5952550471,  0.8903859258,
-         0.7395320237,  0.6205935180 } },
-    { {  0.2206472158,  2.4467634261,  1.2920629978,  1.0239321291,
-         0.9014628530,  0.8552166820,  0.8219859004,  0.9005628526,
-         0.7614781857,  0.7763628066 },
-      { -0.2722068131,  2.8967635930,  1.3039706945,  0.7695089579,
-         0.6132550538,  0.5701242685,  0.5737935007,  0.6533396840,
-         0.5422934890,  0.5150857866 } },
-};
-
-static const float wmavoice_lsp10_intercoeff_b[32][2][10] = {
-    { {  0.4881048799, -0.1998192370, -0.3872502148,  0.0109423101,
-         0.0406953394,  0.1788437665,  0.1673750877,  0.3409781158,
-         0.4061202109,  0.5221177042 },
-      {  0.1492218077, -0.1372330189, -0.2683691680, -0.0621950924,
-        -0.0624572337, -0.0068177581, -0.0076041818,  0.0680235624,
-         0.1055752933,  0.1199930608 } },
-    { {  0.7934338748,  0.0012430847,  0.4239458144,  0.5521328747,
-         0.6497149467,  0.6423749924,  0.7170197070,  0.7169541717,
-         0.7778364718,  0.8397018015 },
-      {  0.2768190503, -0.0491535664, -0.0325731337,  0.0261465013,
-         0.0469867289,  0.0649434030,  0.0781815350,  0.1031504869,
-         0.1194687784,  0.2451654971 } },
-    { {  0.7212139666,  0.1658677757,  0.0101558864,  0.5636015534,
-         1.3175852597,  1.1911676526,  1.1266809106,  0.8230558336,
-         0.8604109585,  0.8094900250 },
-      {  0.3658815324,  0.0816549063, -0.2092563212,  0.1946377754,
-         1.0856558084,  0.9491457641,  0.8461242616,  0.5193652213,
-         0.5975488424,  0.5293265879 } },
-    { {  0.9507186115,  0.9078585207,  0.8773190677,  0.8677509129,
-         0.8024122119,  0.8127667904,  0.8246286809,  0.8779088855,
-         0.9454102516,  0.9863698184 },
-      {  0.6883807778,  0.6900191605,  0.7059442401,  0.6552854478,
-         0.5843107104,  0.5553441048,  0.5887671113,  0.6494528055,
-         0.7725936472,  0.7792782485 } },
-    { {  0.2399882078,  0.1938513517,  0.4441962242,  0.4475385249,
-         0.3055235147,  0.1745184362,  0.1174371839,  0.0679580271,
-         0.0782470703,  0.1695377529 },
-      {  0.0170370936,  0.0253600776,  0.2072205544,  0.1907711923,
-         0.1096384823,  0.0327000320, -0.0134368241, -0.0461389422,
-        -0.0372916758, -0.0243156850 } },
-    { {  0.5457104146,  0.3774812818,  0.5235594809,  0.2994287312,
-         0.2394639254,  0.5731041729,  0.9971176088,  1.1646913886,
-         0.9028123021,  0.7777709365 },
-      {  0.2288472056,  0.1181580722,  0.2074171603,  0.0355180502,
-        -0.0024924278,  0.2596487999,  0.7474936247,  0.9103488624,
-         0.5927647650,  0.4772915542 } },
-    { {  0.6541713476,  0.6412608922,  0.7625012100,  0.7826205492,
-         0.4839106202,  0.3311478198,  0.4577620327,  0.8572652638,
-         0.9442306161,  0.8282986581 },
-      {  0.2852075696,  0.2614837885,  0.4221763611,  0.4314823747,
-         0.1434547007,  0.0435788929,  0.1397191882,  0.5525916219,
-         0.6752081811,  0.5487250388 } },
-    { {  0.6742251515,  1.0610800683,  1.0500701368,  0.9570100009,
-         0.9325653315,  0.9243078828,  0.9148707986,  0.8317720294,
-         0.7696445584,  0.6784849465 },
-      {  0.2283884585,  0.9739181101,  0.5336519182,  0.4974764287,
-         0.3998288214,  0.3674543798,  0.2719694376,  0.2608939707,
-         0.2087934017,  0.1675716937 } },
-    { {  0.3736146986, -1.5457833707,  0.9216864705,  0.7959242165,
-         0.7358283401,  0.7233110964,  0.7271121442,  0.6852350831,
-         0.6891672015,  0.6589554250 },
-      {  0.1246460676, -1.7167649865,  0.7037160397,  0.4803061783,
-         0.4694928527,  0.4654951990,  0.5208069980,  0.5305717587,
-         0.5288023055,  0.5278192759 } },
-    { {  1.0116009116,  0.9882703424,  0.8393741250,  0.8889843524,
-         0.8934407532,  0.8906227350,  0.9222107530,  0.8973073363,
-         0.9257496595,  0.9306648076 },
-      {  0.5097970665, -0.0106843412,  0.1419473886,  0.2804890275,
-         0.3719763160,  0.3694859743,  0.4640534222,  0.5034401417,
-         0.5592106879,  0.6652468145 } },
-    { {  0.9718209803,  0.7615181804,  0.2172474563,  0.4920369983,
-         0.4310891628,  0.5038333535,  0.4668059051,  0.5339140594,
-         0.4453758597,  0.4050061107 },
-      {  0.6543679535,  0.1205173433, -0.0050483048,  0.1580035388,
-         0.1308719218,  0.1700620353,  0.1740596890,  0.2179683447,
-         0.1967349052,  0.1703897119 } },
-    { {  0.7663022578,  0.4025157690,  1.3811545074,  1.1642981768,
-         1.0709758997,  0.9812580645,  1.0092416406,  0.9089070857,
-         0.7776398659,  0.8189926445 },
-      {  0.3471384346,  0.0602248609,  1.3968829811,  1.0841484964,
-         0.8940305710,  0.7313719392,  0.7345176339,  0.5304406881,
-         0.4076275229,  0.4535677731 } },
-    { {  0.1300854981,  0.1323136985,  0.7564064264,  0.7335346043,
-         0.7924508452,  0.6039057672,  0.6896914840,  0.3694859743,
-         0.2825861573,  0.3179096878 },
-      { -0.0208423138, -0.0530856848,  0.3449102342,  0.3819376826,
-         0.4466865659,  0.2807511687,  0.3842969537,  0.1144880950,
-         0.0617321730,  0.0767397583 } },
-    { {  0.7559476793,  0.8462553322,  0.6452585459,  1.1308751702,
-         1.0606868565,  0.9498666525,  0.7425129414,  0.6221901178,
-         0.6574481130,  0.6976212561 },
-      {  0.3420922160,  0.4310236275,  0.2800958157,  0.9317133725,
-         0.8210897744,  0.6144569516,  0.3227593005,  0.2464762032,
-         0.2769501209,  0.3521846533 } },
-    { {  0.7609938979,  0.6943444908,  1.1490939856,  0.4350868165,
-         0.6101971567,  0.6246149242,  0.7370079756,  0.6522052884,
-         0.6966382265,  0.7565374970 },
-      {  0.3939306438,  0.3449102342,  0.9874839187,  0.0910919905,
-         0.2804234922,  0.2888775468,  0.4060546756,  0.3284608722,
-         0.3483836055,  0.4819445610 } },
-    { {  0.7828826904,  1.1833034158,  1.9916158915,  0.8667678833,
-         0.9218830764,  0.8856420517,  0.9373494089,  0.7415299118,
-         0.7450032830,  0.7074515522 },
-      {  0.4685098231,  1.1713104546,  1.9853245020,  0.6206828058,
-         0.6664264500,  0.6033814847,  0.6089519858,  0.3784643114,
-         0.4212588668,  0.3441893458 } },
-    { {  0.4671335816,  0.4177199602,  0.0804097354, -0.1836975515,
-        -0.1802241802, -0.0775958896, -0.0250365734,  0.0884050429,
-         0.2136430144,  0.3472039700 },
-      {  0.1187478900,  0.1122598946, -0.0381436348, -0.2284581661,
-        -0.2302276194, -0.1738672554, -0.1350048184, -0.0547896028,
-         0.0000634491,  0.0545888245 } },
-    { {  0.5545576811,  0.4791920781,  0.8204999566,  0.8462553322,
-         0.9212277234,  0.8946203887,  0.9659883380,  0.9137566984,
-         0.9225384295,  0.9207034409 },
-      {  0.1176993251, -0.0429277122, -0.0330318809,  0.0566859543,
-         0.0983008742,  0.1593797803,  0.1732077301,  0.2320584357,
-         0.2739354968,  0.3753186166 } },
-    { {  0.7157745361,  0.6367389560, -1.2036890686,  0.7107283175,
-         0.6885118484,  0.7332724631,  0.7436270416,  0.7113181353,
-         0.5935511887,  0.6023984551 },
-      {  0.3664058149,  0.3280676603, -1.3082178831,  0.3909815550,
-         0.3641776145,  0.3926854730,  0.3898674548,  0.4086760879,
-         0.3127979338,  0.3949792087 } },
-    { {  1.0267395675,  1.0621941686,  1.0415505469,  0.9971176088,
-         0.9764739871,  0.9904330075,  0.9591071308,  0.9338760376,
-         0.9026156962,  0.9073997736 },
-      {  0.9855833948,  1.0548542142,  0.9787021875,  0.8573307991,
-         0.8360973597,  0.8193203211,  0.7386463583,  0.7038471103,
-         0.6333966553,  0.6434235573 } },
-    { {  0.6235008240,  0.7635497749,  0.8094900250,  0.7227212787,
-        -0.0610809922, -0.1357912421, -0.2359291911,  0.0800165236,
-         0.3972729445,  0.5078965425 },
-      {  0.2983146310,  0.4983939230,  0.4145742655,  0.3284608722,
-        -0.3203386664, -0.3495018780, -0.4734291434, -0.1808139980,
-         0.1211071610,  0.2001427412 } },
-    { {  0.8925887942,  0.8804647624,  0.6153089106,  0.6760601401,
-         0.7887153327,  1.0065546930,  1.0829033256,  1.0347348750,
-         0.9800128937,  0.9125770628 },
-      {  0.5955827832,  0.6195687056,  0.2924164534,  0.3553958833,
-         0.5417127609,  0.8713553548,  0.9977729619,  0.8817754686,
-         0.7645328045,  0.6604627371 } },
-    { {  1.1581378579,  1.0359145105,  0.7731179297,  0.6839243770,
-         0.6839899123,  0.6664264500,  0.6910677254,  0.6579068601,
-         0.6779606640,  0.6243527830 },
-      {  1.1508634388,  0.8400294781,  0.2358594835,  0.2542749047,
-         0.2484422624,  0.2620736063,  0.2676441073,  0.2713796198,
-         0.3068997562,  0.3223005533 } },
-    { {  0.1376220584,  1.2572927773,  0.8593623936,  0.6218624413,
-         0.5128116906,  0.5393534899,  0.4436064065,  0.4334484339,
-         0.4494390488,  0.4002220333 },
-      { -0.1159995794,  1.2433337569,  0.4805027843,  0.2632532418,
-         0.1769432425,  0.1868390739,  0.1555131972,  0.1530228555,
-         0.1490252018,  0.1559064090 } },
-    { {  0.1817273200, -0.0085216761,  0.0739872754,  0.1808098257,
-         0.2770811915,  0.3344901204,  0.4292541742,  0.5404020548,
-         0.5780193210,  0.5707449019 },
-      { -0.0035409927, -0.0188107193, -0.0057691932,  0.0132360458,
-         0.0560961366,  0.0534747243,  0.1002013981,  0.1737320125,
-         0.1706518531,  0.1637706459 } },
-    { {  0.9648087025,  1.0030813217,  0.9501943290,  0.8381944895,
-         0.7545059025,  0.7621735334,  0.7121700943,  0.7328792512,
-         0.7534573376,  0.7414643764 },
-      {  0.1872322857, -0.0081939995,  0.0663851798,  0.0963348150,
-         0.0509188473,  0.0565548837,  0.0471833348,  0.0809340179,
-         0.1049199402,  0.1751082540 } },
-    { {  0.6792713702,  0.9521603882,  0.5296542645,  0.3657504618,
-         0.3905883431,  0.3121425807,  0.2726903260,  0.3156159520,
-         0.2859284580,  0.3179096878 },
-      {  0.2307477295,  0.3771536052,  0.0743804872,  0.0260154307,
-         0.0477731526,  0.0391880274,  0.0228042006,  0.0572757721,
-         0.0337485969,  0.0492149293 } },
-    { {  0.8649328947,  0.9505875409,  1.0443030298,  1.1704584956,
-         1.2709241211,  1.3232212961,  1.2477901578,  1.1513877213,
-         1.0346038043,  0.9695272446 },
-      {  0.4620873630,  0.5685822368,  0.8975039423,  1.0476453304,
-         1.2278674245,  1.2290470600,  1.1962138712,  1.0051129162,
-         0.8706344664,  0.7477557659 } },
-    { {  0.4188340604,  0.6011532843,  0.4726385474,  0.6389671564,
-         0.6753392518,  0.7842589319,  0.6147846282,  0.6708828509,
-         0.6406055391,  0.5398777723 },
-      {  0.1012499630,  0.2312064767,  0.1773364544,  0.2800302804,
-         0.3348177969,  0.4343003929,  0.2822584808,  0.3293128312,
-         0.3024433553,  0.2401848137 } },
-    { {  0.5049474537,  0.7943513691,  0.9536021650,  0.9407572448,
-         0.9823721647,  0.9747045338,  1.0145500004,  0.9629737139,
-         0.9526191354,  0.9283710718 },
-      {  0.0566204190,  0.0973178446,  0.5812305510,  0.5687133074,
-         0.6834000945,  0.6616423726,  0.7611905038,  0.6683925092,
-         0.6463071108,  0.6118355393 } },
-    { {  0.8969141245,  0.9359731674,  0.8756151497,  0.8419300020,
-         0.8353109360,  0.6807131469,  0.3358008265,  0.3386188447,
-         0.3524467945,  0.4495045841 },
-      {  0.5298508704,  0.4606455863,  0.4934132397,  0.4415748119,
-         0.4015327394,  0.2052544951, -0.0329663455, -0.0154684186,
-         0.0418094397,  0.1631152928 } },
-    { {  0.6345762908,  2.5209445655,  1.0373562872,  0.9166402519,
-         0.8865595460,  0.8907538056,  0.8522190452,  0.7290782034,
-         0.7385808229,  0.6345107555 },
-      {  0.2641707361,  2.5696372986,  0.8539884984,  0.6532538533,
-         0.6087553799,  0.5851626694,  0.5276226699,  0.4330552220,
-         0.3971418738,  0.3599833548 } },
-};
-
-static const float wmavoice_lsp16_intercoeff_a[32][2][16] = {
-    { {  0.5337238312,  0.4810695648, -0.3766536713, -0.1204767227,
-        -0.0898437500, -0.0070896149,  0.1134738922,  0.1337728500,
-         0.3739156723,  0.3849058151,  0.4220180511,  0.5404901505,
-         0.5224876404,  0.5502910614,  0.5313453674,  0.4405946732 },
-      {  0.1775283813,  0.1679325104, -0.2702789307, -0.1359367371,
-        -0.1452455521, -0.0888595581, -0.0256662369, -0.0023736954,
-         0.1074047089,  0.1431636810,  0.1357412338,  0.2045526505,
-         0.2686481476,  0.3404531479,  0.3209333420,  0.1493968964 } },
-    { {  0.7402400970,  0.0838251114,  0.6486282349,  0.6145095825,
-         0.7331047058,  0.7183008194,  0.7436847687,  0.7627944946,
-         0.7653779984,  0.7795667648,  0.8399305344,  0.8393154144,
-         0.8219690323,  0.7474164963,  0.6681070328,  0.6490793228 },
-      {  0.2850513458, -0.0544128418, -0.0300130844,  0.0204677582,
-         0.0328931808,  0.0589332581,  0.0796422958,  0.1187639236,
-         0.1320505142,  0.1539077759,  0.2189874649,  0.2865276337,
-         0.2973947525,  0.2614307404,  0.2416648865,  0.2428951263 } },
-    { {  0.6129922867,  0.7300701141,  0.2073822021,  0.5005893707,
-         0.5713691711,  0.5374965668,  0.6293134689,  0.5639057159,
-         0.7402811050,  0.6982889175,  0.4668397903,  0.6698703766,
-         0.8758535385,  0.8678569794,  0.8678569794,  0.7810840607 },
-      {  0.2986249924,  0.3269615173,  0.0096416473,  0.1800708771,
-         0.2474060059,  0.2203407288,  0.3007984161,  0.2674179077,
-         0.4424810410,  0.4046306610,  0.2063980103,  0.4230022430,
-         0.6222190857,  0.6574449539,  0.6776618958,  0.6604385376 } },
-    { {  0.7258052826,  0.5073966980, -0.3947381973,  0.5254812241,
-         1.0561246872,  0.9706230164,  0.9727144241,  0.9185838699,
-         0.8184833527,  0.9093980789,  0.8645353317,  0.7870302200,
-         0.6347675323,  0.5123996735,  0.2846002579,  0.3252801895 },
-      {  0.4306297302,  0.2182903290, -0.4902458191,  0.1783485413,
-         0.7783365250,  0.7152252197,  0.7404451370,  0.6012639999,
-         0.5421304703,  0.6619558334,  0.6316919327,  0.5596818924,
-         0.3952398300,  0.3567333221,  0.1505041122,  0.1290159225 } },
-    { {  0.3077287674,  0.2543363571,  0.2834520340,  0.5282287598,
-         0.5350360870,  0.4943971634,  0.4521999359,  0.3086309433,
-         0.2372770309,  0.0819387436, -0.1385612488, -0.0848407745,
-        -0.0380916595,  0.1192150116,  0.3228197098,  0.3012905121 },
-      {  0.0567188263,  0.0196886063,  0.0682420731,  0.2102527618,
-         0.2452325821,  0.2060699463,  0.1620273590,  0.0784120560,
-         0.0418329239, -0.0508041382, -0.2193880081, -0.1644783020,
-        -0.1361827850, -0.0307512283,  0.1486587524,  0.2356367111 } },
-    { {  0.4387903214,  0.5723943710,  0.6147556305,  0.9973602295,
-         1.1645498276,  1.1898927689,  1.0326681137,  0.6939010620,
-         0.6064310074,  0.4686441422,  0.4646663666,  0.4895582199,
-         0.5654230118,  0.6004848480,  0.6179132462,  0.6439123154 },
-      {  0.1324195862,  0.2426080704,  0.3132238388,  0.7359752655,
-         0.9749288559,  0.9535636902,  0.8105278015,  0.4118890762,
-         0.3013315201,  0.2006158829,  0.2331352234,  0.2535161972,
-         0.3375005722,  0.4103307724,  0.4102897644,  0.4529380798 } },
-    { {  0.7335557938,  0.9203472137,  0.4852113724,  0.8646993637,
-         0.7304391861,  0.7503690720,  0.6289854050,  0.6900463104,
-         0.6421079636,  0.5184278488,  0.4444904327,  0.2660236359,
-         0.2143125534,  0.2406396866,  0.4836940765,  0.5597229004 },
-      {  0.3689947128,  0.4967346191,  0.1176567078,  0.5127687454,
-         0.3235168457,  0.3426265717,  0.2417469025,  0.3310623169,
-         0.2629890442,  0.2130823135,  0.1329116821,  0.0468769073,
-        -0.0081968307,  0.0146446228,  0.2440433502,  0.3408632278 } },
-    { {  0.9425325394,  0.9597969055,  0.6160678864,  0.7050962448,
-         0.8063859940,  0.9063224792,  0.9890356064,  1.0038805008,
-         1.0338163376,  0.9453620911,  0.9634056091,  0.8068370819,
-         0.6859455109,  0.8909034729,  0.9990415573,  1.0122871399 },
-      {  0.6895952225,  0.6451835632,  0.3169965744,  0.4268569946,
-         0.5666122437,  0.7722673416,  0.8845882416,  0.9061584473,
-         0.9550399780,  0.8118810654,  0.8601064682,  0.6129922867,
-         0.5069866180,  0.7065315247,  0.7862920761,  0.7766551971 } },
-    { {  0.5641517639, -0.0941905975,  0.0412998199,  0.1810550690,
-         0.3459482193,  0.4213209152,  0.4401025772,  0.5397109985,
-         0.5607891083,  0.6348905563,  0.6861915588,  0.7280607224,
-         0.7267074585,  0.6447324753,  0.5948257446,  0.5475025177 },
-      {  0.1906919479, -0.0519113541, -0.0608100891, -0.0018815994,
-         0.0383062363,  0.0362558365,  0.0529870987,  0.0692672729,
-         0.0953073502,  0.1327886581,  0.1390628815,  0.1904459000,
-         0.2362518311,  0.2063980103,  0.2311668396,  0.2291574478 } },
-    { {  0.9901428223,  0.9589767456,  0.9012374878,  0.8017930984,
-         0.8929538727,  0.8512077332,  0.8790111542,  0.8832759857,
-         0.8949632645,  0.9159183502,  0.9293279648,  0.9152622223,
-         0.9247350693,  0.8753614426,  0.8730239868,  0.8066730499 },
-      {  0.4230432510, -0.0464572906,  0.0182533264,  0.1159753799,
-         0.2349395752,  0.2740612030,  0.2987070084,  0.3620643616,
-         0.3923282623,  0.4694643021,  0.5202322006,  0.5356512070,
-         0.5564012527,  0.5362663269,  0.4791831970,  0.5046901703 } },
-    { {  0.9785375595,  0.8820457458,  0.3965110779,  0.4790191650,
-         0.3907699585,  0.4195575714,  0.2938270569,  0.4091415405,
-         0.3659191132,  0.4030723572,  0.4168510437,  0.5030908585,
-         0.5023117065,  0.5511522293,  0.5354051590,  0.5563192368 },
-      {  0.6592903137,  0.2933759689,  0.0562677383,  0.1286878586,
-         0.0758285522,  0.1192560196,  0.0508956909,  0.1175336838,
-         0.0684061050,  0.0988750458,  0.0923957825,  0.1819572449,
-         0.1965150833,  0.2257537842,  0.3049812317,  0.2993221283 } },
-    { {  0.7120265961,  0.7847747803,  0.6065950394,  0.7235908508,
-         0.6740531921,  0.6535081863,  0.3734235764,  0.4788551331,
-         0.4410867691,  0.6927528381,  1.0758495331,  1.1148891449,
-         1.0708875656,  0.8896322250,  0.6401805878,  0.5057153702 },
-      {  0.4210338593,  0.4763126373,  0.3229017258,  0.4079113007,
-         0.3922462463,  0.3529195786,  0.1258993149,  0.2168960571,
-         0.2207508087,  0.4605655670,  0.8759355545,  0.9526205063,
-         0.8843832016,  0.7001342773,  0.4503545761,  0.3484086990 } },
-    { {  0.5254402161,  0.5349540710,  0.7036199570,  0.6240234375,
-         0.6464548111,  0.7537727356,  0.8311548233,  0.7334327698,
-         0.3484907150,  0.1846637726,  0.0894021988,  0.3977823257,
-         0.7672233582,  0.9224796295,  0.8818407059,  0.7453250885 },
-      {  0.2587652206,  0.2524499893,  0.4135704041,  0.3129367828,
-         0.3403711319,  0.4473199844,  0.5330266953,  0.4227561951,
-         0.1080198288, -0.0044651031, -0.0727024078,  0.1583776474,
-         0.5302381516,  0.7313823700,  0.6735610962,  0.5630855560 } },
-    { {  0.7936325073,  0.8551034927,  0.9755849838,  0.8953323364,
-         0.9345769882,  0.7202281952,  0.8388233185,  0.7941656113,
-         0.7550849915,  0.7894906998,  0.8590402603,  0.7813711166,
-         0.8483371735,  0.8652324677,  0.8586711884,  0.9584846497 },
-      {  0.4781579971,  0.4731960297,  0.8289403915,  0.6175031662,
-         0.7262973785,  0.3638277054,  0.5544328690,  0.4761896133,
-         0.4388723373,  0.5021476746,  0.5630445480,  0.4562187195,
-         0.5190429688,  0.5937595367,  0.6121721268,  0.6973457336 } },
-    { {  1.0724458694,  1.0449705124,  0.8594503403,  0.7604160309,
-         0.7837905884,  0.8136444092,  0.7623023987,  0.6098756790,
-         0.6432561874,  0.6395244598,  0.6853713989,  0.7401580811,
-         0.7399530411,  0.7652549744,  0.7675104141,  0.7393789291 },
-      {  0.9382266998,  0.8419809341,  0.3087539673,  0.3620233536,
-         0.3547649384,  0.4241094589,  0.2857894897,  0.2123851776,
-         0.2355957031,  0.2794332504,  0.3219995499,  0.3898267746,
-         0.3937635422,  0.4058198929,  0.4228382111,  0.4181222916 } },
-    { {  1.0275421143,  1.0940570831,  1.0164289474,  0.9097671509,
-         0.9400720596,  0.8976287842,  0.9175586700,  0.8900833130,
-         0.9154262543,  0.9492578506,  1.0011329651,  1.0361537933,
-         1.0359487534,  0.9320344925,  0.8974237442,  0.8811845779 },
-      {  1.0046186447,  1.0860195160,  0.9442958832,  0.7473344803,
-         0.7876043320,  0.7410602570,  0.7422084808,  0.6844692230,
-         0.7256412506,  0.8455486298,  0.8969316483,  0.9362173080,
-         0.9092340469,  0.8227071762,  0.7481546402,  0.7088689804 } },
-    { {  0.2205047607, -0.0129537582,  0.0972347260,  0.1154832840,
-         0.0951843262,  0.1532516479,  0.1288108826,  0.1749858856,
-         0.1591157913,  0.2134923935,  0.2477340698,  0.2634811401,
-         0.3032999039,  0.3272485733,  0.3170785904,  0.3172016144 },
-      {  0.0032854080, -0.0446119308,  0.0284643173,  0.0155467987,
-        -0.0063104630,  0.0226001740,  0.0086984634,  0.0262088776,
-         0.0173921585,  0.0360507965,  0.0366659164,  0.0215339661,
-         0.0412178040,  0.1047391891,  0.1258172989,  0.0609836578 } },
-    { {  0.1495609283,  0.3275766373,  0.8598194122,  0.6847562790,
-         0.7550849915,  0.5662431717,  0.6930398941,  0.7526245117,
-         0.7300291061,  0.7284708023,  0.6608896255,  0.5224056244,
-         0.4273900986,  0.5757160187,  0.4625749588,  0.5123586655 },
-      { -0.0352210999, -0.0428895950,  0.3110914230,  0.2699604034,
-         0.3307752609,  0.2059469223,  0.2332172394,  0.3204412460,
-         0.2846412659,  0.3354911804,  0.2448635101,  0.1514062881,
-         0.1062564850,  0.2613077164,  0.2123441696,  0.3000602722 } },
-    { {  0.6218910217,  0.6033554077,  0.4551525116,  0.3161764145,
-         0.2864866257,  0.6195125580,  0.7577505112,  1.0062179565,
-         0.8485012054,  0.6777849197,  0.7455301285,  0.3630485535,
-         0.2327661514,  0.5563192368,  0.4448595047,  0.3806819916 },
-      {  0.2624969482,  0.2679510117,  0.1839666367,  0.0335903168,
-         0.0294075012,  0.2902593613,  0.4959144592,  0.7905979156,
-         0.5748548508,  0.3753919601,  0.4855394363,  0.1089630127,
-         0.0362968445,  0.3632535934,  0.2681150436,  0.2735691071 } },
-    { {  0.7064495087,  0.4431781769,  0.7628355026,  0.7271585464,
-         0.7812070847,  0.7806739807,  0.8909854889,  0.8958654404,
-         0.9126787186,  0.9038209915,  0.9246120453,  0.9624624252,
-         0.9732475281,  0.7420034409,  0.5060844421,  0.5189199448 },
-      {  0.3457021713, -0.0149221420,  0.3174476624,  0.3580865860,
-         0.4243965149,  0.4275541306,  0.5887155533,  0.6478490829,
-         0.6320610046,  0.6627349854,  0.6868886948,  0.7396659851,
-         0.7551259995,  0.5275316238,  0.3075237274,  0.3806819916 } },
-    { {  0.4376831055,  0.4904603958,  0.6262788773,  0.5901098251,
-         0.4176712036,  0.0221490860, -0.1612796783, -0.2236118317,
-        -0.1087894440, -0.0022506714,  0.1051902771,  0.3307752609,
-         0.4167690277,  0.4997692108,  0.4645843506,  0.5228567123 },
-      {  0.1228237152,  0.1671123505,  0.2931299210,  0.2549924850,
-         0.1435737610, -0.1124801636, -0.2181987762, -0.2723293304,
-        -0.1573429108, -0.0837745667, -0.0325555801,  0.1024427414,
-         0.1938495636,  0.2825498581,  0.2247285843,  0.2879629135 } },
-    { {  0.6100807190,  0.7900238037,  0.9581155777,  0.8999662399,
-         0.9277286530,  0.9720993042,  0.9966220856,  0.9630365372,
-         0.9571723938,  0.8992280960,  0.8370189667,  0.7417984009,
-         0.7174396515,  0.6122951508,  0.6746683121,  0.7030458450 },
-      {  0.0859165192,  0.0914115906,  0.6077432632,  0.5471334457,
-         0.5943746567,  0.6805324554,  0.6680250168,  0.6033554077,
-         0.6302976608,  0.4874258041,  0.3647298813,  0.2770137787,
-         0.2544183731,  0.2608156204,  0.3331537247,  0.4950942993 } },
-    { {  0.4051227570,  1.1022176743,  0.8262338638,  0.6573219299,
-         0.5948667526,  0.5426225662,  0.4987850189,  0.4370269775,
-         0.4421119690,  0.3837165833,  0.3728494644,  0.3706760406,
-         0.4169740677,  0.3559951782,  0.2994041443,  0.3896217346 },
-      {  0.0716867447,  0.9253911972,  0.2780799866,  0.2460117340,
-         0.1675224304,  0.1527595520,  0.1278266907,  0.1226596832,
-         0.1165084839,  0.0982189178,  0.0952253342,  0.1113414764,
-         0.1498889923,  0.0940361023,  0.0802984238,  0.1560811996 } },
-    { {  0.7024717331,  0.7363853455,  0.9629545212,  0.9635286331,
-         1.0819597244,  1.1529855728,  1.2984409332,  1.2693252563,
-         1.2848672867,  1.2877378464,  1.2133083344,  1.0696573257,
-         1.0864706039,  0.9851808548,  0.8312368393,  0.8047866821 },
-      {  0.3001422882,  0.2273120880,  0.6279602051,  0.6936140060,
-         0.8097076416,  0.9440498352,  1.1028738022,  1.1766471863,
-         1.1199741364,  1.1608181000,  1.0665817261,  0.8872537613,
-         0.9082908630,  0.7602519989,  0.6542053223,  0.7317514420 } },
-    { {  0.0643463135, -0.6808919907,  0.2889881134,  0.6142225266,
-         0.6356697083,  0.6825828552,  0.6259508133,  0.4945611954,
-         0.5866651535,  0.6357517242,  0.5208883286,  0.4207878113,
-         0.5125637054,  0.3758020401,  0.5424175262,  0.6172571182 },
-      { -0.0636806488, -0.7585611343,  0.0850553513,  0.2996912003,
-         0.3620643616,  0.4444084167,  0.4597454071,  0.3120756149,
-         0.4016780853,  0.5026807785,  0.4111919403,  0.3183498383,
-         0.3666572571,  0.1829824448,  0.3269205093,  0.4095926285 } },
-    { {  0.9277286530,  0.9651279449,  0.9602069855,  0.9327726364,
-         0.9208393097,  0.8868436813,  0.9011554718,  0.8569488525,
-         0.9015245438,  0.8969726562,  0.9367094040,  0.9445009232,
-         0.8617057800,  0.8215589523,  0.8333692551,  0.7939195633 },
-      {  0.1719102859,  0.1142530441,  0.1245460510,  0.1646108627,
-         0.1408672333,  0.0949792862,  0.0271930695,  0.0265779495,
-        -0.0064334869, -0.0109033585,  0.0152187347,  0.0252656937,
-         0.0166950226,  0.0736141205,  0.1205682755,  0.1895437241 } },
-    { {  0.5964250565,  0.6065130234,  0.7228116989,  0.7348270416,
-         0.0718097687,  0.2369899750,  0.2456426620,  0.4961194992,
-         0.6410417557,  0.6765956879,  0.6771287918,  0.7285938263,
-         0.6706905365,  0.5105543137,  0.5068635941,  0.5430326462 },
-      {  0.2782440186,  0.2620048523,  0.4424400330,  0.4124631882,
-        -0.1158838272,  0.0186223984,  0.0059919357,  0.1853609085,
-         0.3568563461,  0.3791646957,  0.4100847244,  0.4654865265,
-         0.4614677429,  0.3209743500,  0.3199081421,  0.3836755753 } },
-    { {  0.8051557541,  0.8506336212,  0.9544658661,  0.5584516525,
-         0.5874032974,  0.5727224350,  0.6177902222,  0.7659521103,
-         0.9526205063,  1.0424280167,  1.0705595016,  1.0042905807,
-         0.6005258560,  0.3886785507,  0.4739751816,  0.6542463303 },
-      {  0.4775428772,  0.5541868210,  0.7128057480,  0.2146816254,
-         0.2502765656,  0.2488822937,  0.3009214401,  0.4667987823,
-         0.6929988861,  0.8599834442,  0.8784780502,  0.7463912964,
-         0.3217535019,  0.1274986267,  0.2767267227,  0.5119485855 } },
-    { {  0.5978193283,  0.5092830658,  1.0738401413,  0.7688636780,
-         0.8214769363,  0.7682075500,  0.4970626831,  0.2783260345,
-         0.2652854919,  0.3625154495,  0.5700569153,  0.5044031143,
-         0.4003248215,  0.5162544250,  0.5727634430,  0.5538587570 },
-      {  0.2752094269,  0.1747808456,  0.8557186127,  0.4280872345,
-         0.5143680573,  0.4139804840,  0.1810960770,  0.0109539032,
-         0.0317039490,  0.0842351913,  0.3129367828,  0.2614717484,
-         0.1564092636,  0.2352676392,  0.3249931335,  0.3505821228 } },
-    { {  0.7093610764,  0.7587757111,  1.8517618179,  1.0092525482,
-         0.8078622818,  0.8792982101,  0.8210668564,  0.8600654602,
-         0.6913585663,  0.6436662674,  0.6216859818,  0.6123771667,
-         0.5940465927,  0.5910940170,  0.6505966187,  0.5801038742 },
-      {  0.3370904922,  0.4681930542,  1.9236078262,  0.8053607941,
-         0.5321245193,  0.6342344284,  0.5054693222,  0.5788326263,
-         0.4400615692,  0.4086904526,  0.3924102783,  0.4220180511,
-         0.3835115433,  0.4230432510,  0.5190839767,  0.3990535736 } },
-    { {  0.6277141571,  1.1122236252,  1.0259838104,  0.9486427307,
-         0.9184608459,  0.9059944153,  0.9080038071,  0.8282022476,
-         0.8440313339,  0.7887935638,  0.7468013763,  0.6746683121,
-         0.6319379807,  0.6246795654,  0.7263793945,  0.7349090576 },
-      {  0.2427721024,  1.0851583481,  0.6180362701,  0.5837125778,
-         0.4324750900,  0.4684801102,  0.3745307922,  0.3027257919,
-         0.3646888733,  0.2409267426,  0.2158298492,  0.2052907944,
-         0.2100887299,  0.2276401520,  0.3409452438,  0.4045896530 } },
-    { {  0.8391513824,  0.8713426590,  1.1366233826,  1.1440868378,
-         1.1443738937,  1.0877418518,  1.0516138077,  1.0099496841,
-         0.9216184616,  0.8990640640,  0.9001302719,  0.8993101120,
-         0.8055248260,  0.8150796890,  0.7272815704,  0.7196130753 },
-      {  0.4634771347,  0.5807189941,  1.1287908554,  1.1066875458,
-         1.0765056610,  0.9287538528,  0.8956193924,  0.8026132584,
-         0.6725769043,  0.5856809616,  0.5527515411,  0.5183868408,
-         0.4529380798,  0.5074377060,  0.4632720947,  0.5554990768 } },
-};
-
-static const float wmavoice_lsp16_intercoeff_b[32][2][16] = {
-    { {  0.5431776047, -0.1212130189, -0.2471650839,  0.0683670044,
-         0.1418520808,  0.2518971562,  0.3708084226,  0.4141484499,
-         0.5712364912,  0.5852659345,  0.5670641661,  0.6401320100,
-         0.6447737217,  0.6726239920,  0.4994724989,  0.5574678183 },
-      {  0.2040718794, -0.1271064281, -0.2266163826, -0.0406349897,
-        -0.0145058036,  0.0283126831,  0.0851084590,  0.0913147926,
-         0.1307432652,  0.1926501393,  0.2310355306,  0.2828245163,
-         0.3171940446,  0.4424681067,  0.2960716486,  0.3510941863 } },
-    { {  0.8073900938,  0.0403081179,  0.5392660499,  0.6928597689,
-         0.6499369740,  0.7328097820,  0.7755761147,  0.7766191959,
-         0.8820225596,  0.8423333168,  0.8898978233,  0.8488525748,
-         0.8654375672,  0.6728326082,  0.6169234514,  0.6755967736 },
-      {  0.3653843999, -0.0846008658, -0.0224332213,  0.1120721102,
-         0.1020585299,  0.1741876006,  0.2129902244,  0.2160151601,
-         0.3619422317,  0.4185815454,  0.5455245376,  0.5363975763,
-         0.5429168344,  0.3505726457,  0.3296067119,  0.3620986938 } },
-    { {  0.1843576431,  0.0179861784,  0.3122915626,  0.3600125313,
-         0.2466817498,  0.2172668576,  0.1975526214,  0.1177569032,
-         0.1196866035,  0.0849519968,  0.0962694287,  0.1591672301,
-         0.2300446033,  0.3082756996,  0.4047607183,  0.3925045133 },
-      { -0.0275964737, -0.0794897676,  0.1168181300,  0.1591150761,
-         0.0915755630,  0.0460972190,  0.0562151074,  0.0084419847,
-        -0.0095511675, -0.0408957601, -0.0376100540, -0.0166962743,
-         0.0656028390,  0.1226072311,  0.2293144464,  0.2142419219 } },
-    { {  0.4781936407, -1.2478972673,  0.4884679914,  0.7755239606,
-         0.6785174012,  0.6590117812,  0.6177057624,  0.6427918673,
-         0.5402048230,  0.5512614846,  0.6424267888,  0.4229103327,
-         0.5106334686,  0.5136062503,  0.4490395188,  0.4753251672 },
-      {  0.2852236032, -1.3815159798,  0.1904075146,  0.4874770641,
-         0.4593138695,  0.4182686210,  0.4174863100,  0.4604612589,
-         0.4089330435,  0.3891666532,  0.4700576067,  0.2383370996,
-         0.2801646590,  0.3398289084,  0.2766703367,  0.3374298215 } },
-    { {  0.5925153494,  0.3858809471,  1.0754098296,  0.5752002001,
-         0.5516265631,  0.4853909016,  0.4719351530,  0.5018194318,
-         0.3037382960,  0.5154316425,  0.8809794784,  0.7755761147,
-         0.5941321254,  0.3974069953,  0.5925675035,  0.6097261906 },
-      {  0.3008176684,  0.0706617832,  0.8484353423,  0.2574254870,
-         0.2815728188,  0.1930673718,  0.2523665428,  0.2691601515,
-         0.1271967888,  0.2653007507,  0.6473292708,  0.5275835395,
-         0.3928174376,  0.2405275702,  0.4008491635,  0.4556109309 } },
-    { {  0.7339050174,  0.4290645123,  0.6859754324,  0.6349166036,
-         0.8034263849,  0.8509387374,  0.8591269255,  1.1049811840,
-         1.3928194642,  1.3423343301,  1.0849018693,  0.8943830729,
-         0.8579795361,  0.6920774579,  0.5613272190,  0.4303162098 },
-      {  0.4534726143,  0.0901674032,  0.3465046287,  0.3470261693,
-         0.5217422843,  0.5874564052,  0.6014336944,  0.9161834717,
-         1.2823571563,  1.2193550467,  0.8868207335,  0.6514494419,
-         0.6249030232,  0.4453887343,  0.3665317893,  0.2242033482 } },
-    { {  0.4293252826,  0.3303368688,  0.6181751490,  0.9884168506,
-         0.9915460944,  0.7939864993,  0.3019129038,  0.2443348169,
-         0.4543070793,  0.5617444515,  0.4895110726,  0.6600027084,
-         0.6290231943,  0.5580936670,  0.5459417701,  0.4647378922 },
-      {  0.1409133077, -0.0050137639,  0.2551307082,  0.6764833927,
-         0.7112701535,  0.4648943543,  0.0301380754, -0.0235806108,
-         0.1018499136,  0.2422486544,  0.2406318784,  0.4000146985,
-         0.3713299632,  0.3259559274,  0.3820737004,  0.2888743877 } },
-    { {  0.7733334899,  0.8321111202,  1.3098945022,  1.0331128836,
-         1.0380675197,  0.9479974508,  0.9740223289,  0.9442945123,
-         0.8926619887,  0.8719046712,  0.8640815616,  0.8404036164,
-         0.8359183669,  0.7675965428,  0.6895219088,  0.7266034484 },
-      {  0.3655408621,  0.4643206596,  1.2171645761,  0.8341451287,
-         0.8387868404,  0.6713201404,  0.6814901829,  0.6294404268,
-         0.5172048807,  0.5205948949,  0.5408828259,  0.5298783183,
-         0.5781729817,  0.5000983477,  0.4727174640,  0.4326109886 } },
-    { {  0.8902629018,  0.4598354101,  0.6392975450,  0.4483093619,
-         0.6220867038,  0.6323089004,  0.7063676715,  0.3717993498,
-         0.6718416810,  0.7876758575,  0.2807383537,  0.3118221760,
-         0.6703813672,  0.7662405372,  0.7122610807,  0.7851724625 },
-      {  0.6301705837,  0.1221378446,  0.3532846570,  0.1412783861,
-         0.3471826315,  0.3435318470,  0.4466925859,  0.1390357614,
-         0.4092981219,  0.5406742096,  0.0690450072,  0.0829179883,
-         0.4625995755,  0.5700891018,  0.5542864203,  0.6545265317 } },
-    { { -0.1100520492,  0.3803526163,  0.8075987101,  0.6903563738,
-         0.8012359142,  0.7835035324,  0.8195941448,  0.8381088376,
-         0.8033220768,  0.7511680126,  0.6393496990,  0.6096218824,
-         0.6934856176,  0.6690253615,  0.6401841640,  0.5600233674 },
-      { -0.1776958704, -0.0293175578,  0.1520742774,  0.1746048331,
-         0.2222214937,  0.3052507639,  0.2977927327,  0.3797789216,
-         0.3395681381,  0.2976884246,  0.2516885400,  0.2403711081,
-         0.3567789793,  0.3302847147,  0.3368039727,  0.3310148716 } },
-    { {  0.5587195158,  0.4676063657,  0.1392965317, -0.0990996957,
-        -0.0816280842, -0.1146416068, -0.0116894841,  0.0521992445,
-         0.1626615524,  0.2923687100,  0.4029874802,  0.4528989196,
-         0.4694839120,  0.5058352947,  0.5369191170,  0.5105291605 },
-      {  0.2193530202,  0.1211469173,  0.0179861784, -0.2022604346,
-        -0.1409794092, -0.2121175528, -0.1152674556, -0.0594626069,
-        -0.0122110248,  0.0274260640,  0.1414870024,  0.2044369578,
-         0.2167974710,  0.2615978122,  0.3348221183,  0.3707562685 } },
-    { {  0.5948622823,  0.7065241337,  0.9414781928,  0.9340723157,
-         0.8835350275,  0.9730835557,  0.8503650427,  0.8902629018,
-         0.8746688366,  0.6910865307,  0.6404449344,  0.6976057887,
-         0.5916287303,  0.6022160053,  0.7729684114,  0.6096740365 },
-      {  0.1262058616,  0.1300652623,  0.6594290137,  0.6535877585,
-         0.5639349222,  0.6982316375,  0.4828875065,  0.5577285886,
-         0.4591052532,  0.2964367270,  0.2695252299,  0.3324751854,
-         0.2860580683,  0.2902825475,  0.4623388052,  0.3369604349 } },
-    { {  0.8821268678,  0.8539636731,  0.2898653150,  0.7478301525,
-         0.5109463930,  0.8577187657,  0.4884679914,  0.7846509218,
-         0.7684310079,  0.7032384276,  0.6691296697,  0.8593355417,
-         0.9383489490,  0.9808023572,  0.6804992557,  0.6403927803 },
-      {  0.5590324402,  0.4209806323,  0.0259135962,  0.4318808317,
-         0.2104346752,  0.5453680754,  0.1783599257,  0.4467447400,
-         0.4352708459,  0.4089330435,  0.3994410038,  0.5984609127,
-         0.6872792840,  0.7321317792,  0.4408513308,  0.4542027712 } },
-    { {  0.6371070743,  0.6311093569,  0.7152860165,  0.6929640770,
-         0.2292101383,  0.3234525323,  0.9644259810,  0.9881039262,
-         0.8722697496,  0.4370440841,  0.4051779509,  0.4944135547,
-         0.5392660499,  0.5969484448,  0.4268740416,  0.4990552664 },
-      {  0.4233797193,  0.3647063971,  0.4345406890,  0.4180078506,
-        -0.0006328225,  0.0586141944,  0.7620160580,  0.8152132034,
-         0.6707985997,  0.2095480561,  0.2178405523,  0.2776612639,
-         0.3142212629,  0.3808741570,  0.2676998377,  0.2804775834 } },
-    { {  0.4509170651,  0.9490405321,  0.8557890654,  0.8271043301,
-         0.6915559173,  0.7321839333,  0.6257896423,  0.6274064183,
-         0.5238284469,  0.5194996595,  0.4116972089,  0.3382642865,
-         0.3755022883,  0.4867990613,  0.5686287880,  0.5106856227 },
-      {  0.0989292860,  0.6244857907,  0.4700576067,  0.3905226588,
-         0.2630059719,  0.3009741306,  0.2150763869,  0.2067838907,
-         0.1533781290,  0.1815934777,  0.1023714542,  0.0373874903,
-         0.0897501707,  0.1849313378,  0.2852757573,  0.2625887394 } },
-    { {  0.9954054952,  0.9554033279,  0.8237664700,  0.9780903459,
-         0.7261862159,  0.7884581685,  0.7933084965,  0.7393290401,
-         0.8783196211,  1.0409359932,  1.0217954516,  0.9159227014,
-         0.8698185086,  0.7057939768,  0.7662926912,  0.7339571714 },
-      {  0.7913266420,  0.6739278436,  0.5061482191,  0.7058982849,
-         0.3480692506,  0.4338105321,  0.4428853393,  0.3758152127,
-         0.5962182879,  0.7925261855,  0.7968549728,  0.6629754901,
-         0.6325175166,  0.4598354101,  0.5310778618,  0.5518873334 } },
-    { {  0.4638512731,  0.0604917407,  0.1897295117,  0.3403504491,
-         0.4708399177,  0.5241413713,  0.6061275601,  0.6446694136,
-         0.7313494682,  0.7208143473,  0.6268848777,  0.6081094146,
-         0.4913364649,  0.3529717326,  0.4954566360,  0.5767126679 },
-      {  0.1353849769, -0.0274400115,  0.0002537966,  0.0272174478,
-         0.0555371046,  0.0652899146,  0.1010676026,  0.1073260903,
-         0.1568724513,  0.2207611799,  0.1434167027,  0.2262373567,
-         0.1177047491,  0.0162650943,  0.2529402375,  0.4087765813 } },
-    { {  0.9700064659,  0.9917025566,  0.9159227014,  0.9309430718,
-         0.8991290927,  0.9314124584,  0.9059612751,  0.9473194480,
-         0.9604622722,  0.9377752542,  0.9197821021,  0.8869771957,
-         0.8506779671,  0.8594920039,  0.8320589662,  0.8739908338 },
-      {  0.2892394662,  0.0551198721,  0.0892807841,  0.1158793569,
-         0.0905846357,  0.0738953352,  0.0395258069,  0.0240360498,
-         0.0477139950,  0.0751470327,  0.1171310544,  0.1555164456,
-         0.1384620667,  0.1818542480,  0.2104868293,  0.1288135648 } },
-    { {  0.4101847410,  0.3326316476,  0.4666675925,  0.5077128410,
-         0.5892296433,  0.4272912741,  0.0603352785, -0.8668596745,
-        -1.1103670001, -0.0900248885,  0.1626615524,  0.1487885714,
-         0.4130010605,  0.5119373202,  0.5820323825,  0.5486016273 },
-      {  0.0383262634,  0.1300652623,  0.2295230627,  0.2706204653,
-         0.3722165823,  0.1698066592, -0.0934670568, -0.8677462935,
-        -1.0724509954, -0.2164463401, -0.0056917667, -0.0301520228,
-         0.1299088001,  0.2579991817,  0.3482257128,  0.2469425201 } },
-    { {  0.6031547785,  0.5515222549,  0.4292209744,  0.5027582049,
-         0.8167778254,  1.0925685167,  0.9878953099,  0.7019345760,
-         0.2509583831,  0.2475162148,  0.5660732388,  0.5145971775,
-         0.4824181199,  0.5970005989,  0.5996604562,  0.5384315848 },
-      {  0.3677313328,  0.2650399804,  0.1585935354,  0.2213348746,
-         0.5566333532,  0.8425940871,  0.7604514360,  0.4523773789,
-         0.0681062341,  0.0737388730,  0.3169854283,  0.2868403792,
-         0.2661873698,  0.3635068536,  0.4300554395,  0.3743027449 } },
-    { {  0.5017672777,  0.6634970307,  0.6869142056,  0.7066284418,
-         0.5669598579,  0.0621085167,  0.0634645224,  0.2321307659,
-         0.8322675824,  0.9855483770,  0.8296598792,  0.6140028238,
-         0.5462546945,  0.6730412245,  0.6856103539,  0.5975221395 },
-      {  0.2680649161,  0.3324230313,  0.3688787222,  0.3886451125,
-         0.2774004936, -0.1695076823, -0.1353467703,  0.0159000158,
-         0.5895425677,  0.7586781979,  0.5639870763,  0.3687744141,
-         0.3401418328,  0.4477356672,  0.4782979488,  0.4034568667 } },
-    { {  0.8838479519,  0.9025712609,  0.7326533198,  0.8124490380,
-         0.8956347704,  1.1007045507,  1.2731780410,  1.2029786706,
-         1.0839109421,  0.9664078355,  0.7356782556,  0.6942157745,
-         0.6917645335,  0.6383587718,  0.6503020525,  0.5989302993 },
-      {  0.5576764345,  0.4596789479,  0.3790487647,  0.5514179468,
-         0.7333834767,  0.9612445831,  1.1976589561,  1.1094664335,
-         0.8868207335,  0.6789346337,  0.4643206596,  0.4029353261,
-         0.4384522438,  0.3871847987,  0.4326109886,  0.3691916466 } },
-    { {  0.8520861268,  0.8413423896,  0.7238392830,  0.9103943706,
-         0.7072542906,  0.6479029655,  0.4557673931,  0.1908247471,
-        -0.0569070578, -0.1013423204,  0.2517406940,  0.4854952097,
-         0.5820845366,  0.5886037946,  0.6177579165,  0.6226603985 },
-      {  0.6160889864,  0.4592095613,  0.4752208591,  0.6685559750,
-         0.4326109886,  0.4077335000,  0.2314006090,  0.0173603296,
-        -0.2208272815, -0.3014574647,  0.0321199298,  0.2559130192,
-         0.3603254557,  0.3466089368,  0.4072119594,  0.4776199460 } },
-    { {  0.7083495259,  0.9001721740,  0.6795083284,  1.2743254304,
-         1.3672639728,  1.2563322783,  0.8557369113,  0.8287732601,
-         0.7942472696,  0.8006622195,  0.7034991980,  0.5479236245,
-         0.6391932368,  0.6248508692,  0.5495925546,  0.4719351530 },
-      {  0.4000146985,  0.6493632793,  0.4583229423,  1.1484255195,
-         1.2521599531,  1.1232351065,  0.6150459051,  0.5347808003,
-         0.4726653099,  0.5269576907,  0.4278128147,  0.2745841742,
-         0.3868718743,  0.4183729291,  0.3474434018,  0.3150035739 } },
-    { {  0.9070043564,  0.7648323774,  0.4281778932,  0.5475063920,
-         0.4134704471,  0.4706834555,  0.4549329281,  0.4648422003,
-         0.4572798610,  0.4823138118,  0.4666154385,  0.4841913581,
-         0.4018922448,  0.4297946692,  0.4646857381,  0.6091003418 },
-      {  0.4925360084,  0.2065231204,  0.0948612690,  0.1716842055,
-         0.0992422104,  0.1332988143,  0.1255800128,  0.1257364750,
-         0.0955392718,  0.1118634939,  0.1372103691,  0.1525958180,
-         0.0902717113,  0.1591672301,  0.2335910797,  0.3767018318 } },
-    { {  0.3185500503,  0.8677845001,  0.7776622772,  0.8160476685,
-         0.8624126315,  0.8057211637,  0.8852561116,  0.8471314907,
-         0.9145145416,  0.8945916891,  0.8638729453,  0.8531292081,
-         0.7425104380,  0.6215651631,  0.6501455903,  0.6341864467 },
-      { -0.0499705672,  0.0687842369,  0.3051464558,  0.3368039727,
-         0.4942049384,  0.3823344707,  0.5683158636,  0.5044271350,
-         0.6278236508,  0.5777035952,  0.5745221972,  0.5502184033,
-         0.4244228005,  0.3163595796,  0.3525545001,  0.3582914472 } },
-    { {  0.3200625181,  0.9415303469,  0.6067534089,  0.3568832874,
-         0.1600538492,  0.2938811779,  0.2037589550,  0.3017564416,
-         0.2572168708,  0.4796018004,  0.6938506961,  0.6847758889,
-         0.7232134342,  0.6111343503,  0.5159531832,  0.4856516719 },
-      {  0.0680540800,  0.6285016537,  0.2514277697,  0.0790064335,
-        -0.0687981844,  0.0521992445, -0.0055874586,  0.0537117124,
-         0.0188206434,  0.1883213520,  0.4493002892,  0.4300554395,
-         0.4750122428,  0.3658016324,  0.3119786382,  0.2818335891 } },
-    { {  0.6864969730,  1.0815640092,  0.9838794470,  0.8845259547,
-         0.9438772798,  0.8888025880,  0.8178730607,  0.8581881523,
-         0.7128347754,  0.7120524645,  0.7345308661,  0.7945601940,
-         0.7854853868,  0.8261655569,  0.6941114664,  0.6646444201 },
-      {  0.2847542167,  0.9535257816,  0.6691818237,  0.5026538968,
-         0.5945493579,  0.4125838280,  0.3886451125,  0.3740941286,
-         0.2453778982,  0.2928902507,  0.3219922185,  0.4065861106,
-         0.3838469386,  0.4289602041,  0.3910441995,  0.3821780086 } },
-    { {  1.1335094571,  1.0390062928,  0.7019867301,  0.6203134656,
-         0.6951545477,  0.4863818288,  0.6171320677,  0.6247465611,
-         0.5907421112,  0.6711115241,  0.7322882414,  0.7042293549,
-         0.5635698438,  0.6174449921,  0.6727283001,  0.6431047916 },
-      {  1.0146503448,  0.7762541175,  0.2200310230,  0.2459515929,
-         0.2703596950,  0.1376276016,  0.2522100806,  0.2622758150,
-         0.2389107943,  0.2956544161,  0.3799875379,  0.3653843999,
-         0.2561216354,  0.2842326760,  0.4034568667,  0.3700782657 } },
-    { {  0.6342907548,  0.9627570510,  0.5214815140, -0.0226939917,
-         0.5616401434,  0.7231091261,  0.7417802811,  0.9092991352,
-         0.9739701748,  0.7804785967,  0.6771092415,  0.6352295280,
-         0.4660417438,  0.5869870186,  0.6692339778,  0.5986173749 },
-      {  0.3988673091,  0.6997441053,  0.2316613793, -0.2566571236,
-         0.2685343027,  0.4484136701,  0.4490395188,  0.6886874437,
-         0.7703085542,  0.5847443938,  0.4539941549,  0.4098196626,
-         0.2579991817,  0.3376384377,  0.4754816294,  0.5095382333 } },
-    { {  0.4443456531,  2.0296727419,  0.6569256186,  0.6439914107,
-         0.6436263323,  0.5507399440,  0.6095175743,  0.6066491008,
-         0.5347808003,  0.2529402375,  0.4443978071,  0.7000570297,
-         0.8259569407,  0.5927761197,  0.5078171492,  0.4418422580 },
-      {  0.2430831194,  1.9133691788,  0.3723730445,  0.3764410615,
-         0.3874977231,  0.3212099075,  0.3832210898,  0.4474227428,
-         0.3644977808,  0.0814055204,  0.2752621770,  0.4647378922,
-         0.6619845629,  0.4304205179,  0.3143777251,  0.2705683112 } },
-    { {  0.9740744829,  1.0730628967,  0.9743352532,  0.9098728299,
-         0.9453375936,  0.9661470652,  0.9270836711,  0.9643738270,
-         0.9989519715,  0.9627048969,  0.9348546267,  0.9865393043,
-         0.9399657249,  0.9752218723,  0.8440544009,  0.8819182515 },
-      {  0.9258319736,  1.0357205868,  0.8463491797,  0.8108844161,
-         0.8391519189,  0.8566235304,  0.8305986524,  0.8880724311,
-         0.9181653261,  0.8670021892,  0.8305986524,  0.8995984793,
-         0.8300249577,  0.8711223602,  0.7195626497,  0.8138571978 } },
-};
-
-static const double wmavoice_mean_lsf10[2][10] = {
-    { 0.2235394066, 0.4097484909, 0.7025292732, 1.1077160169,
-      1.3939179044, 1.6741291716, 1.9552949226, 2.2199793918,
-      2.5103400247, 2.7829212906 },
-    { 0.1493683393, 0.3714357373, 0.7702730245, 1.0609411394,
-      1.3270362536, 1.5806033119, 1.8398507524, 2.1116740248,
-      2.3823505771, 2.6865718527 }
-};
-
-static const double wmavoice_mean_lsf16[2][16] = {
-    { 0.0999206754, 0.2345933590, 0.4621011210, 0.6772546160,
-      0.8346396060, 1.0067495130, 1.1571691668, 1.3292508688,
-      1.4941465650, 1.6600755584, 1.8461284908, 2.0529487333,
-      2.2690810112, 2.4949894820, 2.7172752965, 2.9164840903 },
-    { 0.0918298402, 0.2475621892, 0.4782937721, 0.6284774045,
-      0.7861951264, 0.9303736000, 1.0940441024, 1.2521029300,
-      1.4434732098, 1.6551410742, 1.8917962963, 2.0967280403,
-      2.2981430375, 2.4826173497, 2.6827972461, 2.8811350800 }
-};
-
-static const float wmavoice_std_codebook[1000] = {
-    -0.185013, -0.150405, -0.707267, -0.284100,  0.882898,
-    -0.788627,  0.061005,  0.374431,  0.053843, -0.909826,
-     0.543602,  0.219326,  0.285698,  0.154709, -0.455005,
-     0.426276, -0.868852, -0.952324, -0.550001,  0.813814,
-    -0.352815,  0.242122,  0.820495, -0.189574, -0.449538,
-     0.499132, -0.247783,  0.598159,  0.732040, -0.564406,
-    -0.631788, -0.452973,  0.285189, -0.339055,  0.262927,
-     0.168087, -0.127682, -0.676067, -0.457481,  0.926161,
-    -0.585893, -0.913880,  0.145487,  0.699804,  0.240829,
-     0.690482,  0.126081,  0.371977,  0.738158,  0.576080,
-     0.185791, -0.614657, -0.181799,  0.006285,  0.195768,
-     0.368663, -0.494583,  0.947985, -0.033178, -0.762543,
-    -0.616421,  0.335034, -0.215516,  0.668769,  0.995979,
-    -0.952588, -0.163144, -0.131704, -0.628655,  0.379374,
-    -0.205543, -0.214549,  0.465494,  0.939944, -0.514744,
-    -0.293676,  0.630426,  0.611336, -0.921699,  0.368584,
-     0.187416,  0.264092,  0.753927, -0.994382, -0.729623,
-    -0.050304,  0.374280, -0.224205, -0.102319, -0.658897,
-     0.013252,  0.281260,  0.676137,  0.797736, -0.049971,
-     0.672115,  0.845148,  0.786885, -0.459588, -0.783507,
-     0.166259,  0.334869,  0.001944, -0.368247,  0.274813,
-     0.487200,  0.338077, -0.094761,  0.098536,  0.416378,
-    -0.726176, -0.714048, -0.319530, -0.972249, -0.708430,
-    -0.049153, -0.022553,  0.665850,  0.726642,  0.875127,
-    -0.993047, -0.260106,  0.156387,  0.683090, -0.462370,
-    -0.893584,  0.355205, -0.617222,  0.893301,  0.895617,
-    -0.400729,  0.059559,  0.230486,  0.601215,  0.691313,
-    -0.494701,  0.088415,  0.029390,  0.410539, -0.813049,
-    -0.554232,  0.684362, -0.527097,  0.126238,  0.712113,
-    -0.235528, -0.922915, -0.310440, -0.569678,  0.803727,
-    -0.435313, -0.562725, -0.456380,  0.721075, -0.879635,
-     0.081250,  0.827491,  0.475570,  0.464029,  0.720792,
-     0.371187, -0.936700, -0.219649, -0.398327,  0.664515,
-    -0.528336,  0.106972, -0.247070,  0.501053, -0.482490,
-    -0.060119,  0.946821, -0.798127,  0.412784,  0.073058,
-     0.913986, -0.822744,  0.150143, -0.396453, -0.392421,
-    -0.046130,  0.168234,  0.044854,  0.497490, -0.110691,
-     0.165219, -0.421259, -0.283200, -0.359212, -0.957231,
-    -0.562409, -0.988025, -0.893931,  0.217942, -0.386352,
-     0.770585,  0.689606,  0.720620, -0.476485,  0.190659,
-    -0.761870,  0.463395,  0.137480, -0.559997, -0.123821,
-    -0.789461, -0.646011,  0.053435,  0.360682, -0.042464,
-     0.661014, -0.685448, -0.874230, -0.294133,  0.812042,
-     0.015078,  0.871086, -0.609218,  0.731878, -0.488126,
-    -0.566448, -0.830530, -0.476150, -0.460379,  0.387412,
-     0.137497, -0.689794,  0.077018, -0.141883, -0.166280,
-    -0.732322,  0.096247, -0.702884,  0.405158,  0.536250,
-     0.173295,  0.615696,  0.890239, -0.773270, -0.023622,
-    -0.152226,  0.887744,  0.290930, -0.026456, -0.406389,
-     0.102972,  0.988622, -0.535303,  0.493754,  0.720500,
-    -0.023428,  0.927306,  0.889970,  0.500421, -0.533073,
-     0.277382, -0.362081, -0.222867, -0.645599,  0.496035,
-     0.610853, -0.377922, -0.407718,  0.907969, -0.972764,
-    -0.871468,  0.081264,  0.642933, -0.981230,  0.307994,
-    -0.380689, -0.133456,  0.195738,  0.910241,  0.840088,
-     0.789349,  0.013213,  0.828710, -0.745954, -0.493033,
-     0.549210,  0.230618, -0.565727,  0.439180, -0.268961,
-    -0.098800, -0.283438,  0.368958,  0.678333,  0.070963,
-    -0.135007,  0.289186,  0.693041,  0.457275,  0.197155,
-     0.720277,  0.585807, -0.721581,  0.363210,  0.604577,
-     0.586413,  0.982521, -0.528878, -0.217849,  0.892762,
-    -0.688791, -0.428500, -0.094025, -0.860081, -0.174454,
-     0.412942,  0.689129, -0.943836,  0.847215,  0.128309,
-    -0.212797, -0.251585,  0.844871, -0.843839, -0.573252,
-    -0.084167,  0.021154,  0.715935, -0.391126, -0.521570,
-    -0.086910, -0.670848, -0.935763,  0.191509,  0.692361,
-     0.668814, -0.222078,  0.674882, -0.860064,  0.560073,
-     0.567644, -0.548855, -0.868427, -0.526382, -0.408936,
-    -0.042881,  0.886560, -0.719807,  0.013283,  0.733775,
-     0.408502,  0.800487, -0.517810,  0.253372,  0.956648,
-    -0.091062, -0.830794, -0.022198, -0.375127, -0.221920,
-     0.456232,  0.537963,  0.107232,  0.520469, -0.270529,
-    -0.200406,  0.189284,  0.507393, -0.525524,  0.329220,
-     0.067466, -0.957881,  0.780365,  0.199039, -0.484262,
-    -0.628570, -0.843843, -0.597703, -0.348377,  0.169441,
-    -0.863928, -0.939875, -0.030073, -0.381738,  0.313497,
-    -0.073425,  0.527200,  0.482703,  0.904377, -0.847927,
-    -0.739217,  0.360609,  0.690035,  0.368015, -0.118921,
-    -0.580493, -0.832391, -0.929638,  0.926900, -0.357915,
-     0.399582, -0.005634, -0.315796,  0.179947, -0.806596,
-     0.393360,  0.732931, -0.415833, -0.724526,  0.957347,
-    -0.892887,  0.475366,  0.173583, -0.418554, -0.302536,
-     0.627315,  0.782000,  0.497542,  0.139082,  0.570111,
-     0.732375, -0.454643,  0.302218, -0.019505,  0.881778,
-    -0.057606,  0.273041,  0.414170, -0.503501, -0.079602,
-    -0.083941,  0.007178, -0.171925,  0.506856,  0.520953,
-     0.631684, -0.099784,  0.253885, -0.784149,  0.175691,
-     0.211231, -0.677036, -0.348943, -0.615186, -0.095591,
-     0.348521, -0.987871, -0.313590, -0.153938,  0.151210,
-    -0.743479, -0.421562,  0.696567,  0.558739,  0.558933,
-     0.578346, -0.498867, -0.168026, -0.007485, -0.002368,
-     0.752372,  0.908575, -0.995190, -0.419553,  0.415430,
-     0.525763, -0.787869, -0.684353, -0.220353, -0.572018,
-     0.491337,  0.990879, -0.249054, -0.857606, -0.624307,
-     0.655355,  0.490915, -0.612178, -0.658235, -0.663023,
-     0.539032, -0.401714, -0.084585,  0.235599, -0.842975,
-    -0.525653, -0.186055, -0.341841,  0.306321,  0.806460,
-     0.655791,  0.058693,  0.715035,  0.660601,  0.639140,
-     0.130465,  0.186363,  0.851271,  0.446112,  0.966011,
-    -0.720746, -0.062551,  0.956890,  0.030200,  0.079843,
-    -0.667418, -0.314445, -0.429243, -0.279596,  0.027320,
-    -0.092266, -0.740564,  0.625606,  0.823149,  0.495035,
-     0.782632, -0.702504, -0.691020, -0.559209,  0.603818,
-    -0.884560, -0.903419, -0.337489,  0.830475,  0.757182,
-    -0.698349, -0.039060, -0.056455, -0.847078, -0.592948,
-    -0.090444, -0.567824,  0.344501, -0.133554,  0.462375,
-    -0.575656,  0.199028, -0.852070, -0.004899,  0.919432,
-     0.175251,  0.902835, -0.821132, -0.199143,  0.725984,
-     0.673903, -0.416511, -0.976519,  0.982883,  0.024279,
-     0.627298, -0.901677,  0.120861, -0.710191,  0.928798,
-    -0.121958, -0.408540, -0.110261,  0.821588, -0.255618,
-     0.296790, -0.268856,  0.176557, -0.358709,  0.597589,
-    -0.361067,  0.065635, -0.203382, -0.213137, -0.939264,
-    -0.283951,  0.962113,  0.963571, -0.105083, -0.237030,
-     0.689556, -0.431180,  0.346459,  0.713037, -0.448297,
-    -0.629262,  0.340335, -0.349973,  0.491599,  0.630144,
-    -0.421175, -0.630359, -0.778396,  0.468564, -0.808771,
-    -0.034014, -0.234646, -0.077627, -0.857457,  0.406645,
-    -0.480038, -0.218524, -0.527720,  0.316580,  0.568338,
-    -0.466984, -0.967371,  0.530452, -0.503413, -0.072454,
-    -0.706578, -0.813857,  0.496366,  0.639881,  0.899179,
-    -0.951931, -0.989381,  0.239514, -0.301904,  0.502218,
-    -0.130341,  0.276921,  0.871860,  0.091262, -0.254515,
-    -0.936911, -0.942752,  0.510839, -0.014539, -0.800209,
-    -0.082516,  0.505423, -0.018733,  0.389763, -0.177997,
-    -0.450395,  0.922779, -0.145368, -0.919943, -0.580634,
-     0.782178, -0.626521, -0.394491,  0.278545, -0.986640,
-    -0.495312,  0.326614, -0.976021,  0.744203, -0.975290,
-     0.526197, -0.386139,  0.301631,  0.398057,  0.705124,
-    -0.952884,  0.461146,  0.762372,  0.557954, -0.553393,
-     0.962163, -0.524562,  0.952030, -0.056570,  0.865202,
-    -0.225967,  0.493035,  0.787981,  0.628665,  0.573093,
-    -0.792653,  0.410844,  0.946571, -0.187144, -0.310612,
-     0.959931,  0.317544, -0.983998,  0.983911,  0.061747,
-    -0.959287,  0.510108,  0.675608,  0.342344, -0.091835,
-     0.380731,  0.389460, -0.630689,  0.143103, -0.052586,
-    -0.184083,  0.105266,  0.422852, -0.232052, -0.951303,
-     0.288054,  0.541981,  0.541732,  0.076035,  0.170646,
-     0.114825,  0.283382, -0.418510,  0.061396, -0.903763,
-     0.270879,  0.021327,  0.413782,  0.286881,  0.005238,
-    -0.524472,  0.327594, -0.484654, -0.848864, -0.330063,
-     0.423511,  0.531868, -0.940603,  0.792822, -0.325029,
-     0.006811, -0.391261,  0.780237, -0.570337,  0.376687,
-     0.828934,  0.717717, -0.081333,  0.370666, -0.206248,
-    -0.910686, -0.514510, -0.922867, -0.329196,  0.546886,
-    -0.826629,  0.941683, -0.431786,  0.587152,  0.228564,
-     0.573452, -0.937320, -0.443843, -0.911202, -0.786184,
-     0.226094,  0.512309,  0.745684,  0.285491,  0.305131,
-    -0.579345, -0.707698,  0.913870, -0.799108, -0.278035,
-     0.290556, -0.970174, -0.560318, -0.790776,  0.400492,
-     0.233434, -0.701462,  0.885982,  0.310567, -0.030658,
-     0.432868,  0.483938, -0.088976, -0.998918,  0.071090,
-    -0.860412,  0.574534,  0.133770, -0.304255,  0.663332,
-     0.347586,  0.921839,  0.175641,  0.093270,  0.207330,
-    -0.519228,  0.513925,  0.499633, -0.605358,  0.714817,
-    -0.778402,  0.685198,  0.744643, -0.338720,  0.894422,
-     0.145135,  0.894714, -0.807041,  0.031117,  0.205281,
-     0.162301, -0.536015, -0.310781, -0.926675, -0.534932,
-     0.760308, -0.787088, -0.960398, -0.105922, -0.091343,
-     0.702934, -0.758336, -0.169504, -0.121425,  0.334935,
-    -0.962173,  0.359347, -0.151140,  0.537460,  0.753989,
-    -0.436323,  0.759058,  0.439187, -0.691680, -0.579662,
-     0.333608,  0.453454, -0.684948,  0.526567, -0.515429,
-     0.520333, -0.311132, -0.051443, -0.790448, -0.237807,
-     0.413625,  0.969861, -0.024895,  0.453226, -0.136061,
-     0.883762,  0.156160,  0.105603, -0.285741, -0.965264,
-    -0.559462, -0.247914,  0.394083,  0.289398, -0.710455,
-     0.148072,  0.853074, -0.951397, -0.412742, -0.838606,
-    -0.531059,  0.920866,  0.614848, -0.216007,  0.447434,
-    -0.900580, -0.695673, -0.863698,  0.047977, -0.486121,
-    -0.101505, -0.538399, -0.516261,  0.873600,  0.914828,
-     0.347678,  0.757362,  0.070988, -0.546718, -0.528380,
-     0.105724, -0.106180,  0.223706, -0.500194, -0.816782,
-     0.513251,  0.647878, -0.963708,  0.561854, -0.764864,
-    -0.802314, -0.969205, -0.843997,  0.812534, -0.185212,
-     0.603436,  0.911954,  0.119114,  0.739738, -0.040069,
-     0.632993, -0.361767,  0.421532, -0.883268, -0.488168,
-     0.336360,  0.464411, -0.730806, -0.592652,  0.917693,
-    -0.259186,  0.513071, -0.188487,  0.964520, -0.987122,
-    -0.005270,  0.477771,  0.660756,  0.031023,  0.039625,
-     0.895892,  0.228709,  0.070419, -0.948105,  0.041243,
-     0.885207,  0.655331, -0.046803,  0.004321,  0.395069,
-     0.913128, -0.362686, -0.966698,  0.334661, -0.245954,
-    -0.454865, -0.328980, -0.781543, -0.185671,  0.078368,
-    -0.863850,  0.555143, -0.408560, -0.052338,  0.519663,
-    -0.395683,  0.942393, -0.002565, -0.734927, -0.026585,
-    -0.962941, -0.839035, -0.797876,  0.107479, -0.787140,
-     0.243367, -0.007314,  0.868191, -0.803435,  0.997007,
-     0.263261, -0.890307, -0.365679,  0.296563,  0.444354,
-     0.388367,  0.841698, -0.884626,  0.606824, -0.343973,
-     0.193743,  0.742974, -0.788830,  0.785182, -0.309364,
-     0.730833, -0.610500, -0.366971, -0.271732, -0.345427,
-     0.606444, -0.234673, -0.184462,  0.808568,  0.872806,
-     0.028398,  0.051936, -0.134508, -0.103410,  0.248500,
-    -0.137501, -0.840150,  0.358194,  0.496819,  0.456413,
-    -0.197453, -0.114814,  0.298111, -0.082078, -0.507990,
-     0.954138, -0.888336, -0.765016, -0.834692,  0.896847,
-    -0.074380,  0.896141, -0.713654,  0.558649, -0.375591,
-    -0.059081,  0.165093,  0.389736,  0.756458, -0.026339,
-     0.262542, -0.215144, -0.974403, -0.871966,  0.681446
-};
-
-static const float wmavoice_gain_silence[256] = {
-    0.0000188351, 0.0000249147, 0.0000294447, 0.0000365973,
-    0.0000423193, 0.0000464916, 0.0000498295, 0.0000525713,
-    0.0000550747, 0.0000574589, 0.0000596046, 0.0000615120,
-    0.0000634193, 0.0000649691, 0.0000665188, 0.0000679493,
-    0.0000692606, 0.0000704527, 0.0000716448, 0.0000728369,
-    0.0000737906, 0.0000747442, 0.0000755787, 0.0000762939,
-    0.0000770092, 0.0000778437, 0.0000785589, 0.0000792742,
-    0.0000799894, 0.0000807047, 0.0000814199, 0.0000822544,
-    0.0000829697, 0.0000838041, 0.0000845194, 0.0000854731,
-    0.0000865459, 0.0000876188, 0.0000889301, 0.0000904799,
-    0.0000923872, 0.0000950098, 0.0000988245, 0.0001032352,
-    0.0001088381, 0.0001147985, 0.0001225471, 0.0001319647,
-    0.0001431704, 0.0001568794, 0.0001744032, 0.0001952648,
-    0.0002206564, 0.0002535582, 0.0002965927, 0.0003464222,
-    0.0004109144, 0.0004891157, 0.0005909204, 0.0007261038,
-    0.0008867979, 0.0010721684, 0.0012696981, 0.0015079975,
-    0.0017461777, 0.0019979477, 0.0022052526, 0.0023679733,
-    0.0025173426, 0.0026556253, 0.0027927160, 0.0029264688,
-    0.0030447245, 0.0031807423, 0.0033060312, 0.0034313202,
-    0.0035454035, 0.0036598444, 0.0037686825, 0.0038731098,
-    0.0039769411, 0.0040702820, 0.0041661263, 0.0042562485,
-    0.0043400526, 0.0044249296, 0.0045082569, 0.0045900345,
-    0.0046693087, 0.0047430992, 0.0048171282, 0.0048881769,
-    0.0049589872, 0.0050252676, 0.0050880909, 0.0051497221,
-    0.0052082539, 0.0052671432, 0.0053246021, 0.0053800344,
-    0.0054348707, 0.0054861307, 0.0055367947, 0.0055862665,
-    0.0056355000, 0.0056805611, 0.0057252645, 0.0057705641,
-    0.0058110952, 0.0058538914, 0.0058966875, 0.0059366226,
-    0.0059723854, 0.0060091019, 0.0060437918, 0.0060794353,
-    0.0061159134, 0.0061485767, 0.0061824322, 0.0062153339,
-    0.0062497854, 0.0062820911, 0.0063197613, 0.0063550472,
-    0.0063927174, 0.0064336061, 0.0064769983, 0.0065194368,
-    0.0065603256, 0.0066006184, 0.0066410303, 0.0066826344,
-    0.0067234039, 0.0067654848, 0.0068060160, 0.0068466663,
-    0.0068866014, 0.0069231987, 0.0069609880, 0.0069983006,
-    0.0070366859, 0.0070750713, 0.0071122646, 0.0071535110,
-    0.0071973801, 0.0072410107, 0.0072846413, 0.0073343515,
-    0.0073832273, 0.0074360371, 0.0074878931, 0.0075426102,
-    0.0076007843, 0.0076560974, 0.0077134371, 0.0077683926,
-    0.0078265667, 0.0078855753, 0.0079488754, 0.0080170631,
-    0.0080827475, 0.0081528425, 0.0082212687, 0.0082877874,
-    0.0083510876, 0.0084129572, 0.0084775686, 0.0085455179,
-    0.0086110830, 0.0086781979, 0.0087503195, 0.0088242292,
-    0.0089002848, 0.0089734793, 0.0090423822, 0.0091133118,
-    0.0091816187, 0.0092473030, 0.0093164444, 0.0093911886,
-    0.0094678402, 0.0095427036, 0.0096175671, 0.0096931458,
-    0.0097666979, 0.0098397732, 0.0099166632, 0.0099946260,
-    0.0100749731, 0.0101612806, 0.0102528334, 0.0103493929,
-    0.0104434490, 0.0105448961, 0.0106583834, 0.0107737780,
-    0.0108981133, 0.0110142231, 0.0111318827, 0.0112472773,
-    0.0113576651, 0.0114786625, 0.0116028786, 0.0117331743,
-    0.0118676424, 0.0120122433, 0.0121580362, 0.0123010874,
-    0.0124633312, 0.0126402378, 0.0128232241, 0.0130140781,
-    0.0132108927, 0.0134289265, 0.0136625767, 0.0138912201,
-    0.0141364336, 0.0144006014, 0.0146615505, 0.0149335861,
-    0.0152134895, 0.0155050755, 0.0158376694, 0.0162067413,
-    0.0165973902, 0.0169926882, 0.0174319744, 0.0179271698,
-    0.0184448957, 0.0190744400, 0.0197248459, 0.0204203129,
-    0.0212460756, 0.0221523046, 0.0231562853, 0.0243031979,
-    0.0256397724, 0.0271918774, 0.0289602280, 0.0310072899,
-    0.0333702564, 0.0363805294, 0.0401413441, 0.0443998575,
-    0.0498176813, 0.0562580824, 0.0640066862, 0.0732775927,
-    0.0836604834, 0.0962959528, 0.1122496128, 0.1335854530,
-    0.1608980894, 0.1990102530, 0.2616490126, 0.3926030397
-};
-
-static const float wmavoice_gain_universal[64] = {
-    0.0000000000, 0.0000000000, 0.0000015497, 0.0000015497,
-    0.0000095367, 0.0000164509, 0.0000379086, 0.0000494719,
-    0.0000799894, 0.0001058578, 0.0001349449, 0.0001627207,
-    0.0001972914, 0.0002325773, 0.0002671480, 0.0003106594,
-    0.0003589392, 0.0004127026, 0.0004582405, 0.0005071163,
-    0.0005759001, 0.0006588697, 0.0007554293, 0.0008602142,
-    0.0009772778, 0.0011068583, 0.0012603998, 0.0013889074,
-    0.0015437603, 0.0016924143, 0.0018980503, 0.0021264553,
-    0.0023632050, 0.0025693178, 0.0028522015, 0.0031896830,
-    0.0034654140, 0.0037885904, 0.0041683912, 0.0046081543,
-    0.0050576925, 0.0055632591, 0.0061818361, 0.0068151951,
-    0.0073953867, 0.0081818104, 0.0091186762, 0.0102789402,
-    0.0119919777, 0.0134155750, 0.0154829025, 0.0173798800,
-    0.0199711323, 0.0229473114, 0.0268185139, 0.0319474936,
-    0.0393068790, 0.0460114479, 0.0523469448, 0.0637906790,
-    0.0845471621, 0.1105458736, 0.1499300003, 0.2219169140
-};
-
-static const float wmavoice_gain_codebook_acb[128] = {
-    0.05, 0.14, 0.16, 0.05, 0.17, 0.25, 0.07, 0.21,
-    0.12, 0.22, 0.23, 0.13, 0.24, 0.32, 0.14, 0.29,
-    0.31, 0.41, 0.43, 0.32, 0.43, 0.51, 0.34, 0.48,
-    0.38, 0.47, 0.49, 0.38, 0.49, 0.57, 0.40, 0.54,
-    0.49, 0.59, 0.61, 0.50, 0.61, 0.69, 0.52, 0.66,
-    0.56, 0.65, 0.67, 0.56, 0.67, 0.75, 0.58, 0.72,
-    0.65, 0.74, 0.76, 0.65, 0.76, 0.84, 0.67, 0.81,
-    0.71, 0.80, 0.82, 0.71, 0.82, 0.90, 0.73, 0.87,
-    0.81, 0.90, 0.92, 0.81, 0.93, 1.01, 0.83, 0.97,
-    0.87, 0.96, 0.98, 0.87, 0.98, 1.06, 0.89, 1.03,
-    0.92, 1.02, 1.04, 0.93, 1.04, 1.12, 0.95, 1.09,
-    0.93, 1.02, 1.04, 0.93, 1.04, 1.12, 0.95, 1.09,
-    0.94, 1.04, 1.05, 0.10, 1.06, 1.14, 0.96, 1.11,
-    0.98, 1.08, 1.10, 0.99, 1.10, 1.18, 1.01, 1.15,
-    1.06, 1.15, 1.17, 1.06, 1.17, 1.25, 1.08, 1.22,
-    1.16, 1.25, 1.27, 1.16, 1.28, 1.36, 1.18, 1.32
-};
-
-static const float wmavoice_gain_codebook_fcb[128] = {
-    -0.8439700703 /* log(0.430) */, -0.6143360001 /* log(0.541) */,
-    -0.1531511795 /* log(0.858) */, -0.0998203353 /* log(0.905) */,
-     0.3213585988 /* log(1.379) */,  0.3777512695 /* log(1.459) */,
-     0.7158866675 /* log(2.046) */,  1.2700414043 /* log(3.561) */,
-    -1.6873994539 /* log(0.185) */, -1.2173958247 /* log(0.296) */,
-    -0.4893903430 /* log(0.613) */, -0.4155154440 /* log(0.660) */,
-     0.1257512053 /* log(1.134) */,  0.1947440768 /* log(1.215) */,
-     0.5883420662 /* log(1.801) */,  1.1987592373 /* log(3.316) */,
-    -1.3586791941 /* log(0.257) */, -0.9996723408 /* log(0.368) */,
-    -0.3768776513 /* log(0.686) */, -0.3119747650 /* log(0.732) */,
-     0.1881379421 /* log(1.207) */,  0.2523139286 /* log(1.287) */,
-     0.6280751838 /* log(1.874) */,  1.2202397768 /* log(3.388) */,
-    -0.7381445465 /* log(0.478) */, -0.5310283311 /* log(0.588) */,
-    -0.0987159729 /* log(0.906) */, -0.0491902442 /* log(0.952) */,
-     0.3555743385 /* log(1.427) */,  0.4101209196 /* log(1.507) */,
-     0.7390761124 /* log(2.094) */,  1.2831536022 /* log(3.608) */,
-    -0.2497442331 /* log(0.779) */, -0.1165338163 /* log(0.890) */,
-     0.1881379421 /* log(1.207) */,  0.2255406759 /* log(1.253) */,
-     0.5469646704 /* log(1.728) */,  0.5922212620 /* log(1.808) */,
-     0.8733832309 /* log(2.395) */,  1.3632815868 /* log(3.909) */,
-    -1.3903023825 /* log(0.249) */, -1.0216512475 /* log(0.360) */,
-    -0.3900840061 /* log(0.677) */, -0.3229638866 /* log(0.724) */,
-     0.1806534997 /* log(1.198) */,  0.2460785226 /* log(1.279) */,
-     0.6232610531 /* log(1.865) */,  1.2178757095 /* log(3.380) */,
-    -0.6033064766 /* log(0.547) */, -0.4185503477 /* log(0.658) */,
-    -0.0253178080 /* log(0.975) */,  0.0217614918 /* log(1.022) */,
-     0.4027948796 /* log(1.496) */,  0.4555243080 /* log(1.577) */,
-     0.7714961470 /* log(2.163) */,  1.3023691262 /* log(3.678) */,
-    -1.1056369036 /* log(0.331) */, -0.8164453969 /* log(0.442) */,
-    -0.2757535016 /* log(0.759) */, -0.2156715365 /* log(0.806) */,
-     0.2468600779 /* log(1.280) */,  0.3082197237 /* log(1.361) */,
-     0.6662897264 /* log(1.947) */,  1.2418464568 /* log(3.462) */,
-    -0.5395680926 /* log(0.583) */, -0.3652833185 /* log(0.694) */,
-     0.0109399400 /* log(1.011) */,  0.0554347069 /* log(1.057) */,
-     0.4265740713 /* log(1.532) */,  0.4774756441 /* log(1.612) */,
-     0.7880027116 /* log(2.199) */,  1.3118401752 /* log(3.713) */,
-    -0.9571127264 /* log(0.384) */, -0.7031975164 /* log(0.495) */,
-    -0.2082549388 /* log(0.812) */, -0.1519863570 /* log(0.859) */,
-     0.2874320412 /* log(1.333) */,  0.3464225675 /* log(1.414) */,
-     0.6931471806 /* log(2.000) */,  1.2570395253 /* log(3.515) */,
-    -0.2420715612 /* log(0.785) */, -0.1098148660 /* log(0.896) */,
-     0.1930966300 /* log(1.213) */,  0.2311117210 /* log(1.260) */,
-     0.5504308784 /* log(1.734) */,  0.5960854677 /* log(1.815) */,
-     0.8758853172 /* log(2.401) */,  1.3650707247 /* log(3.916) */,
-     0.6564831962 /* log(1.928) */,  0.7124594916 /* log(2.039) */,
-     0.8569652658 /* log(2.356) */,  0.8767179568 /* log(2.403) */,
-     1.0567480846 /* log(2.877) */,  1.0841752409 /* log(2.957) */,
-     1.2652560327 /* log(3.544) */,  1.6211688353 /* log(5.059) */,
-    -1.5417792640 /* log(0.214) */, -1.1239300967 /* log(0.325) */,
-    -0.4431669753 /* log(0.642) */, -5.2983173665 /* log(0.005) */,
-     0.1510028735 /* log(1.163) */,  0.2183319943 /* log(1.244) */,
-     0.6043159669 /* log(1.830) */,  1.2074666936 /* log(3.345) */,
-    -0.5124936809 /* log(0.599) */, -0.3424903089 /* log(0.710) */,
-     0.0266419309 /* log(1.027) */,  0.0713899961 /* log(1.074) */,
-     0.4369637752 /* log(1.548) */,  0.4879663296 /* log(1.629) */,
-     0.7952524035 /* log(2.215) */,  1.3164082337 /* log(3.730) */,
-    -0.8867319296 /* log(0.412) */, -0.6481738149 /* log(0.523) */,
-    -0.1743533871 /* log(0.840) */, -0.1199102967 /* log(0.887) */,
-     0.3089542077 /* log(1.362) */,  0.3660310389 /* log(1.442) */,
-     0.7075430608 /* log(2.029) */,  1.2649738259 /* log(3.543) */,
-    -0.0943106795 /* log(0.910) */,  0.0207825392 /* log(1.021) */,
-     0.2911759617 /* log(1.338) */,  0.3249778572 /* log(1.384) */,
-     0.6200387087 /* log(1.859) */,  0.6621723763 /* log(1.939) */,
-     0.9266370239 /* log(2.526) */,  1.3962446920 /* log(4.040) */
-};
-
-static const float wmavoice_ipol1_coeffs[17*9] = {
-     0,
-     0.6308171151,  0.7613050340,  0.8632577061,  0.9280143976,
-     0.9499985575,  0.9273047447,  0.8618999123,  0.7594153284,
-    -0.1791058179, -0.1351341452, -0.0589959878,  0.0472882274,
-     0.1784339990,  0.3262237605,  0.4801855979,  0.6285545824,
-     0,
-    -0.1921342459, -0.1786532696, -0.1341681625, -0.0575229186,
-     0.0492091286,  0.1806929555,  0.3286687729,  0.4826357064,
-     0.0807464118,  0.0506337392,  0.0080115446, -0.0428523305,
-    -0.0958572026, -0.1436148431, -0.1782128509, -0.1921164688,
-     0,
-     0.0960653644,  0.0803771760,  0.0500416081,  0.0072485465,
-    -0.0437018941, -0.0966834794, -0.1442930843, -0.1786170151,
-    -0.0391932014, -0.0189622506,  0.0070230183,  0.0356589290,
-     0.0630142610,  0.0847979258,  0.0969368290,  0.0961942221,
-     0,
-    -0.0515680681, -0.0389267015, -0.0185848991,  0.0074699190,
-     0.0361179407,  0.0634181346,  0.0850781347,  0.0970333587,
-     0.0178811825,  0.0048708571, -0.0108041526, -0.0271167825,
-    -0.0416534986, -0.0519338618, -0.0557823736, -0.0517020743,
-     0,
-     0.0267091128,  0.0177022810,  0.0046363524, -0.0110662053,
-    -0.0273700613, -0.0418578978, -0.0520511451, -0.0557823028,
-    -0.0069270437,  0.0008217385,  0.0097293532,  0.0185749526,
-     0.0259542684,  0.0304777338,  0.0309953480,  0.0268154419,
-     0,
-    -0.0125539196, -0.0068173436,  0.0009580161,  0.0098749646,
-     0.0187084037,  0.0260526291,  0.0305201071,  0.0309665180,
-     0.0019149571, -0.0022503408, -0.0068592466, -0.0112465904,
-    -0.0146595868, -0.0163685936, -0.0157934162, -0.0126258885,
-     0,
-     0.0050976076,  0.0018546581, -0.0023221741, -0.0069331308,
-    -0.0113109085, -0.0147021576, -0.0163786146, -0.0157635096,
-    -0.0001162733,  0.0019313511,  0.0040823850,  0.0060192454,
-     0.0073876535,  0.0078486321,  0.0071403184,  0.0051400312,
-     0,
-    -0.0017920607, -0.0000857157,  0.0019657183,  0.0041159806,
-     0.0060465694,  0.0074030068,  0.0078470460,  0.0071185785,
-    -0.0004100171, -0.0015364708, -0.0025490071, -0.0033188616,
-    -0.0037196307, -0.0036417283, -0.0030119629, -0.0018155784,
-     0,
-     0.0006907531, -0.0004282868, -0.0015539061, -0.0025635813,
-    -0.0033285026, -0.0037224069, -0.0036361245, -0.0029972247,
-     0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/**
- * Hamming-window sinc function (num = 32, x = [ 0, 31 ]):
- * (0.54 + 0.46 * cos(2 * M_PI * x / (num - 1))) *
- *     sin(x * M_PI / 4) / (x * M_PI / 4)
- */
-static const float wmavoice_ipol2_coeffs[32] = {
-    1,  0.8563459515,  0.5888634918,  0.2648358640,
-    0, -0.1360490318, -0.1434589471, -0.0758505310,
-    0,  0.0410402636,  0.0412485781,  0.0200064587,
-    0, -0.0081391358, -0.0068223253, -0.0029313546,
-    0,  0.0025864919,  0.0053062555,  0.0055688801,
-    0, -0.0104795941, -0.0187493577, -0.0160592399,
-    0,  0.0212381664,  0.0331059131,  0.0251942366,
-    0, -0.0273968070, -0.0392575669, -0.0276240534
-};
-
-/**
- * LUT for 1.071575641632 * pow(1.0331663, n - 127)
- */
-static const float wmavoice_energy_table[128] = {
-    0.0169982178, 0.0175619858, 0.0181444519, 0.0187462362,
-    0.0193679795, 0.0200103437, 0.0206740128, 0.0213596933,
-    0.0220681153, 0.0228000330, 0.0235562258, 0.0243374986,
-    0.0251446834, 0.0259786395, 0.0268402549, 0.0277304468,
-    0.0286501631, 0.0296003830, 0.0305821182, 0.0315964139,
-    0.0326443501, 0.0337270424, 0.0348456436, 0.0360013446,
-    0.0371953760, 0.0384290090, 0.0397035571, 0.0410203772,
-    0.0423808713, 0.0437864880, 0.0452387238, 0.0467391249,
-    0.0482892887, 0.0498908657, 0.0515455612, 0.0532551367,
-    0.0550214125, 0.0568462692, 0.0587316496, 0.0606795611,
-    0.0626920777, 0.0647713419, 0.0669195677, 0.0691390421,
-    0.0714321284, 0.0738012678, 0.0762489827, 0.0787778794,
-    0.0813906502, 0.0840900769, 0.0868790336, 0.0897604897,
-    0.0927375130, 0.0958132732, 0.0989910450, 0.1022742117,
-    0.1056662688, 0.1091708280, 0.1127916204, 0.1165325012,
-    0.1203974531, 0.1243905911, 0.1285161668, 0.1327785725,
-    0.1371823465, 0.1417321773, 0.1464329093, 0.1512895470,
-    0.1563072616, 0.1614913951, 0.1668474671, 0.1723811803,
-    0.1780984262, 0.1840052921, 0.1901080668, 0.1964132480,
-    0.2029275487, 0.2096579046, 0.2166114816, 0.2237956830,
-    0.2312181577, 0.2388868085, 0.2468098001, 0.2549955679,
-    0.2634528274, 0.2721905830, 0.2812181375, 0.2905451026,
-    0.3001814086, 0.3101373153, 0.3204234225, 0.3310506819,
-    0.3420304081, 0.3533742912, 0.3650944090, 0.3772032397,
-    0.3897136755, 0.4026390362, 0.4159930832, 0.4297900346,
-    0.4440445799, 0.4587718956, 0.4739876619, 0.4897080789,
-    0.5059498840, 0.5227303696, 0.5400674019, 0.5579794393,
-    0.5764855528, 0.5956054456, 0.6153594745, 0.6357686714,
-    0.6568547659, 0.6786402082, 0.7011481929, 0.7244026842,
-    0.7484284410, 0.7732510432, 0.7988969192, 0.8253933741,
-    0.8527686184, 0.8810517982, 0.9102730265, 0.9404634147,
-    0.9716551065, 1.0038813113, 1.0371763400, 1.0715756416
-};
-
-/**
- * LUT for f(x,y) = pow((y + 6.9) / 64, 0.025 * (x + 1)).
- */
-static const float wmavoice_denoise_power_table[12][64] = {
-    { 0.9458379339, 0.9490436287, 0.9518757236, 0.9544130754,
-      0.9567118717, 0.9588135761, 0.9607496688, 0.9625446194,
-      0.9642178285, 0.9657849396, 0.9672587526, 0.9686498743,
-      0.9699671937, 0.9712182343, 0.9724094211, 0.9735462842,
-      0.9746336187, 0.9756756090, 0.9766759291, 0.9776378218,
-      0.9785641645, 0.9794575217, 0.9803201890, 0.9811542296,
-      0.9819615045, 0.9827436985, 0.9835023412, 0.9842388263,
-      0.9849544265, 0.9856503078, 0.9863275406, 0.9869871101,
-      0.9876299254, 0.9882568267, 0.9888685922, 0.9894659445,
-      0.9900495551, 0.9906200497, 0.9911780119, 0.9917239872,
-      0.9922584859, 0.9927819864, 0.9932949377, 0.9937977618,
-      0.9942908555, 0.9947745929, 0.9952493267, 0.9957153901,
-      0.9961730980, 0.9966227482, 0.9970646231, 0.9974989903,
-      0.9979261037, 0.9983462046, 0.9987595223, 0.9991662752,
-      0.9995666709, 0.9999609077, 1.0003491745, 1.0007316515,
-      1.0011085110, 1.0014799178, 1.0018460292, 1.0022069960 },
-    { 0.8946093973, 0.9006838092, 0.9060673931, 0.9109043185,
-      0.9152976055, 0.9193234737, 0.9230399260, 0.9264921443,
-      0.9297160207, 0.9327405496, 0.9355894944, 0.9382825789,
-      0.9408363568, 0.9432648587, 0.9455800822, 0.9477923675,
-      0.9499106907, 0.9519428941, 0.9538958704, 0.9557757107,
-      0.9575878241, 0.9593370368, 0.9610276730, 0.9626636222,
-      0.9642483964, 0.9657851769, 0.9672768552, 0.9687260672,
-      0.9701352224, 0.9715065293, 0.9728420173, 0.9741435556,
-      0.9754128696, 0.9766515555, 0.9778610927, 0.9790428553,
-      0.9801981216, 0.9813280829, 0.9824338513, 0.9835164667,
-      0.9845769028, 0.9856160726, 0.9866348334, 0.9876339913,
-      0.9886143053, 0.9895764906, 0.9905212223, 0.9914491381,
-      0.9923608411, 0.9932569022, 0.9941378627, 0.9950042356,
-      0.9958565084, 0.9966951442, 0.9975205834, 0.9983332454,
-      0.9991335296, 0.9999218170, 1.0006984708, 1.0014638383,
-      1.0022182509, 1.0029620257, 1.0036954662, 1.0044188628 },
-    { 0.8461555040, 0.8547882305, 0.8624635555, 0.8693789920,
-      0.8756760853, 0.8814598273, 0.8868103032, 0.8917900284,
-      0.8964487626, 0.9008267754, 0.9049571273, 0.9088673021,
-      0.9125804007, 0.9161160306, 0.9194909803, 0.9227197376,
-      0.9258148939, 0.9287874629, 0.9316471355, 0.9344024839,
-      0.9370611291, 0.9396298766, 0.9421148300, 0.9445214846,
-      0.9468548060, 0.9491192967, 0.9513190517, 0.9534578074,
-      0.9555389816, 0.9575657096, 0.9595408742, 0.9614671327,
-      0.9633469396, 0.9651825670, 0.9669761222, 0.9687295635,
-      0.9704447142, 0.9721232742, 0.9737668316, 0.9753768718,
-      0.9769547868, 0.9785018824, 0.9800193854, 0.9815084500,
-      0.9829701633, 0.9844055505, 0.9858155796, 0.9872011653,
-      0.9885631734, 0.9899024236, 0.9912196934, 0.9925157203,
-      0.9937912053, 0.9950468143, 0.9962831814, 0.9975009102,
-      0.9987005760, 0.9998827277, 1.0010478892, 1.0021965608,
-      1.0033292209, 1.0044463270, 1.0055483173, 1.0066356112 },
-    { 0.8003259737, 0.8112313241, 0.8209581209, 0.8297466775,
-      0.8377697066, 0.8451556492, 0.8520027051, 0.8583876935,
-      0.8643718792, 0.8700049328, 0.8753277020, 0.8803741979,
-      0.8851730502, 0.8897485937, 0.8941216918, 0.8983103719,
-      0.9023303202, 0.9061952736, 0.9099173316, 0.9135072091,
-      0.9169744409, 0.9203275502, 0.9235741882, 0.9267212496,
-      0.9297749699, 0.9327410079, 0.9356245146, 0.9384301933,
-      0.9411623497, 0.9438249364, 0.9464215906, 0.9489556668,
-      0.9514302661, 0.9538482608, 0.9562123167, 0.9585249126,
-      0.9607883576, 0.9630048062, 0.9651762722, 0.9673046403,
-      0.9693916775, 0.9714390425, 0.9734482944, 0.9754209007,
-      0.9773582446, 0.9792616307, 0.9811322918, 0.9829713934,
-      0.9847800389, 0.9865592739, 0.9883100900, 0.9900334289,
-      0.9917301853, 0.9934012104, 0.9950473143, 0.9966692689,
-      0.9982678100, 0.9998436400, 1.0013974295, 1.0029298194,
-      1.0044414224, 1.0059328250, 1.0074045889, 1.0088572520 },
-    { 0.7569786654, 0.7698939195, 0.7814501054, 0.7919210783,
-      0.8015042240, 0.8103467104, 0.8185613167, 0.8262364557,
-      0.8334427763, 0.8402376615, 0.8466683811, 0.8527743561,
-      0.8585888194, 0.8641400582, 0.8694523567, 0.8745467247,
-      0.8794414652, 0.8841526254, 0.8886943552, 0.8930791981,
-      0.8973183276, 0.9014217415, 0.9053984227, 0.9092564737,
-      0.9130032283, 0.9166453478, 0.9201889007, 0.9236394320,
-      0.9270020224, 0.9302813390, 0.9334816797, 0.9366070112,
-      0.9396610028, 0.9426470554, 0.9455683275, 0.9484277579,
-      0.9512280860, 0.9539718690, 0.9566614986, 0.9592992147,
-      0.9618871182, 0.9644271823, 0.9669212630, 0.9693711079,
-      0.9717783651, 0.9741445900, 0.9764712529, 0.9787597445,
-      0.9810113822, 0.9832274148, 0.9854090274, 0.9875573457,
-      0.9896734398, 0.9917583281, 0.9938129803, 0.9958383209,
-      0.9978352315, 0.9998045539, 1.0017470919, 1.0036636145,
-      1.0055548568, 1.0074215229, 1.0092642871, 1.0110837959 },
-    { 0.7159791370, 0.7306629191, 0.7438433845, 0.7558198318,
-      0.7668086064, 0.7769714272, 0.7864325139, 0.7952894548,
-      0.8036203840, 0.8114888792, 0.8189474022, 0.8260397728,
-      0.8328029877, 0.8392685815, 0.8454636629, 0.8514117142,
-      0.8571332177, 0.8626461513, 0.8679663850, 0.8731080020,
-      0.8780835596, 0.8829043049, 0.8875803529, 0.8921208349,
-      0.8965340237, 0.9008274393, 0.9050079382, 0.9090817905,
-      0.9130547454, 0.9169320882, 0.9207186893, 0.9244190474,
-      0.9280373261, 0.9315773876, 0.9350428208, 0.9384369673,
-      0.9417629433, 0.9450236603, 0.9482218422, 0.9513600421,
-      0.9544406555, 0.9574659338, 0.9604379957, 0.9633588374,
-      0.9662303420, 0.9690542879, 0.9718323569, 0.9745661408,
-      0.9772571477, 0.9799068082, 0.9825164805, 0.9850874551,
-      0.9876209597, 0.9901181627, 0.9925801775, 0.9950080658,
-      0.9974028405, 0.9997654692, 1.0020968764, 1.0043979464,
-      1.0066695255, 1.0089124239, 1.0111274185, 1.0133152537 },
-    { 0.6772002277, 0.6934309881, 0.7080464599, 0.7213643301,
-      0.7336148970, 0.7449707526, 0.7555647772, 0.7655015856,
-      0.7748651015, 0.7837237382, 0.7921340426, 0.8001433220,
-      0.8077915768, 0.8151129499, 0.8221368310, 0.8288887107,
-      0.8353908496, 0.8416628090, 0.8477218755, 0.8535834053,
-      0.8592611049, 0.8647672624, 0.8701129393, 0.8753081305,
-      0.8803618988, 0.8852824894, 0.8900774261, 0.8947535945,
-      0.8993173131, 0.9037743949, 0.9081302004, 0.9123896841,
-      0.9165574352, 0.9206377129, 0.9246344779, 0.9285514202,
-      0.9323919830, 0.9361593853, 0.9398566405, 0.9434865742,
-      0.9470518396, 0.9505549317, 0.9539981992, 0.9573838564,
-      0.9607139933, 0.9639905847, 0.9672154989, 0.9703905051,
-      0.9735172803, 0.9765974162, 0.9796324243, 0.9826237418,
-      0.9855727362, 0.9884807098, 0.9913489039, 0.9941785028,
-      0.9969706369, 0.9997263861, 1.0024467831, 1.0051328157,
-      1.0077854297, 1.0104055314, 1.0129939892, 1.0155516364 },
-    { 0.6405216642, 0.6580962612, 0.6739722363, 0.6884795488,
-      0.7018580813, 0.7142880714, 0.7259086094, 0.7368294324,
-      0.7471387455, 0.7569085832, 0.7661985859, 0.7750587283,
-      0.7835313288, 0.7916525600, 0.7994535998, 0.8069615243,
-      0.8142000068, 0.8211898738, 0.8279495504, 0.8344954211,
-      0.8408421252, 0.8470027997, 0.8529892811, 0.8588122744,
-      0.8644814947, 0.8700057878, 0.8753932324, 0.8806512276,
-      0.8857865684, 0.8908055105, 0.8957138271, 0.9005168576,
-      0.9052195513, 0.9098265046, 0.9143419945, 0.9187700080,
-      0.9231142680, 0.9273782568, 0.9315652364, 0.9356782672,
-      0.9397202245, 0.9436938133, 0.9476015819, 0.9514459336,
-      0.9552291382, 0.9589533414, 0.9626205741, 0.9662327603,
-      0.9697917251, 0.9732992008, 0.9767568340, 0.9801661903,
-      0.9835287605, 0.9868459649, 0.9901191578, 0.9933496315,
-      0.9965386205, 0.9996873045, 1.0027968119, 1.0058682226,
-      1.0089025710, 1.0119008485, 1.0148640056, 1.0177929548 },
-    { 0.6058296875, 0.6245620637, 0.6415378101, 0.6570938835,
-      0.6714759586, 0.6848691001, 0.6974164561, 0.7092312055,
-      0.7204044988, 0.7310109103, 0.7411122884, 0.7507605397,
-      0.7599996842, 0.7688674015, 0.7773962122, 0.7856143935,
-      0.7935466990, 0.8012149303, 0.8086383963, 0.8158342858,
-      0.8228179717, 0.8296032631, 0.8362026133, 0.8426272954,
-      0.8488875492, 0.8549927056, 0.8609512936, 0.8667711307,
-      0.8724594015, 0.8780227256, 0.8834672161, 0.8887985309,
-      0.8940219180, 0.8991422543, 0.9041640810, 0.9090916337,
-      0.9139288704, 0.9186794948, 0.9233469789, 0.9279345818,
-      0.9324453671, 0.9368822185, 0.9412478543, 0.9455448393,
-      0.9497755970, 0.9539424198, 0.9580474782, 0.9620928299,
-      0.9660804271, 0.9700121244, 0.9738896845, 0.9777147851,
-      0.9814890239, 0.9852139236, 0.9888909370, 0.9925214512,
-      0.9961067913, 0.9996482244, 1.0031469629, 1.0066041676,
-      1.0100209506, 1.0133983785, 1.0167374742, 1.0200392198 },
-    { 0.5730166999, 0.5927366473, 0.6106642672, 0.6271389942,
-      0.6424090212, 0.6566617910, 0.6700426292, 0.6826666808,
-      0.6946268614, 0.7059993279, 0.7168473476, 0.7272241023,
-      0.7371747608, 0.7467380401, 0.7559474006, 0.7648319736,
-      0.7734172908, 0.7817258650, 0.7897776570, 0.7975904541,
-      0.8051801811, 0.8125611560, 0.8197463039, 0.8267473349,
-      0.8335748949, 0.8402386937, 0.8467476129, 0.8531098003,
-      0.8593327495, 0.8654233698, 0.8713880464, 0.8772326935,
-      0.8829628002, 0.8885834710, 0.8940994619, 0.8995152120,
-      0.9048348715, 0.9100623268, 0.9152012229, 0.9202549833,
-      0.9252268281, 0.9301197899, 0.9349367288, 0.9396803449,
-      0.9443531909, 0.9489576823, 0.9534961076, 0.9579706374,
-      0.9623833320, 0.9667361492, 0.9710309512, 0.9752695109,
-      0.9794535174, 0.9835845813, 0.9876642399, 0.9916939614,
-      0.9956751493, 0.9996091459, 1.0034972362, 1.0073406510,
-      1.0111405700, 1.0148981248, 1.0186144013, 1.0222904422 },
-    { 0.5419809316, 0.5625329386, 0.5812764912, 0.5985496562,
-      0.6146003370, 0.6296162401, 0.6437432340, 0.6570971404,
-      0.6697716039, 0.6818435182, 0.6933768712, 0.7044255353,
-      0.7150353340, 0.7252456009, 0.7350903742, 0.7445993259,
-      0.7537984929, 0.7627108595, 0.7713568269, 0.7797545943,
-      0.7879204712, 0.7958691361, 0.8036138516, 0.8111666444,
-      0.8185384580, 0.8257392814, 0.8327782597, 0.8396637886,
-      0.8464035955, 0.8530048108, 0.8594740287, 0.8658173611,
-      0.8720404845, 0.8781486812, 0.8841468762, 0.8900396688,
-      0.8958313620, 0.9015259874, 0.9071273286, 0.9126389413,
-      0.9180641715, 0.9234061727, 0.9286679198, 0.9338522236,
-      0.9389617420, 0.9439989920, 0.9489663591, 0.9538661069,
-      0.9587003852, 0.9634712378, 0.9681806094, 0.9728303524,
-      0.9774222323, 0.9819579336, 0.9864390644, 0.9908671615,
-      0.9952436943, 0.9995700689, 1.0038476318, 1.0080776733,
-      1.0122614305, 1.0164000906, 1.0204947932, 1.0245466331 },
-    { 0.5126261246, 0.5338683013, 0.5533029807, 0.5712636181,
-      0.5879954388, 0.6036845987, 0.6184760989, 0.6324853169,
-      0.6458057215, 0.6585142011, 0.6706748475, 0.6823417062,
-      0.6935608163, 0.7043717519, 0.7148088052, 0.7249019070,
-      0.7346773529, 0.7441583823, 0.7533656456, 0.7623175831,
-      0.7710307376, 0.7795200117, 0.7877988829, 0.7958795841,
-      0.8037732557, 0.8114900754, 0.8190393682, 0.8264297018,
-      0.8336689680, 0.8407644543, 0.8477229049, 0.8545505751,
-      0.8612532786, 0.8678364291, 0.8743050768, 0.8806639416,
-      0.8869174414, 0.8930697184, 0.8991246621, 0.9050859297,
-      0.9109569648, 0.9167410144, 0.9224411436, 0.9280602496,
-      0.9336010737, 0.9390662129, 0.9444581300, 0.9497791628,
-      0.9550315328, 0.9602173528, 0.9653386345, 0.9703972943,
-      0.9753951600, 0.9803339761, 0.9852154088, 0.9900410510,
-      0.9948124263, 0.9995309934, 1.0041981497, 1.0088152348,
-      1.0133835335, 1.0179042791, 1.0223786564, 1.0268078035 },
-};
-
-#endif /* AVCODEC_WMAVOICE_DATA_H */
diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c
deleted file mode 100644
index e872b44..0000000
--- a/libavcodec/wmv2.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2002 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "mpegvideo.h"
-#include "msmpeg4data.h"
-#include "simple_idct.h"
-#include "wmv2.h"
-
-
-av_cold void ff_wmv2_common_init(Wmv2Context * w){
-    MpegEncContext * const s= &w->s;
-
-    ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[0], wmv2_scantableA);
-    ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[1], wmv2_scantableB);
-}
-
-static void wmv2_add_block(Wmv2Context *w, DCTELEM *block1, uint8_t *dst, int stride, int n){
-    MpegEncContext * const s= &w->s;
-
-  if (s->block_last_index[n] >= 0) {
-    switch(w->abt_type_table[n]){
-    case 0:
-        s->dsp.idct_add (dst, stride, block1);
-        break;
-    case 1:
-        ff_simple_idct84_add(dst           , stride, block1);
-        ff_simple_idct84_add(dst + 4*stride, stride, w->abt_block2[n]);
-        s->dsp.clear_block(w->abt_block2[n]);
-        break;
-    case 2:
-        ff_simple_idct48_add(dst           , stride, block1);
-        ff_simple_idct48_add(dst + 4       , stride, w->abt_block2[n]);
-        s->dsp.clear_block(w->abt_block2[n]);
-        break;
-    default:
-        av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
-    }
-  }
-}
-
-void ff_wmv2_add_mb(MpegEncContext *s, DCTELEM block1[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr){
-    Wmv2Context * const w= (Wmv2Context*)s;
-
-    wmv2_add_block(w, block1[0], dest_y                    , s->linesize, 0);
-    wmv2_add_block(w, block1[1], dest_y + 8                , s->linesize, 1);
-    wmv2_add_block(w, block1[2], dest_y +     8*s->linesize, s->linesize, 2);
-    wmv2_add_block(w, block1[3], dest_y + 8 + 8*s->linesize, s->linesize, 3);
-
-    if(s->flags&CODEC_FLAG_GRAY) return;
-
-    wmv2_add_block(w, block1[4], dest_cb                   , s->uvlinesize, 4);
-    wmv2_add_block(w, block1[5], dest_cr                   , s->uvlinesize, 5);
-}
-
-void ff_mspel_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
-                               int motion_x, int motion_y, int h)
-{
-    Wmv2Context * const w= (Wmv2Context*)s;
-    uint8_t *ptr;
-    int dxy, offset, mx, my, src_x, src_y, v_edge_pos, linesize, uvlinesize;
-    int emu=0;
-
-    dxy = ((motion_y & 1) << 1) | (motion_x & 1);
-    dxy = 2*dxy + w->hshift;
-    src_x = s->mb_x * 16 + (motion_x >> 1);
-    src_y = s->mb_y * 16 + (motion_y >> 1);
-
-    /* WARNING: do no forget half pels */
-    v_edge_pos = s->v_edge_pos;
-    src_x = av_clip(src_x, -16, s->width);
-    src_y = av_clip(src_y, -16, s->height);
-
-    if(src_x<=-16 || src_x >= s->width)
-        dxy &= ~3;
-    if(src_y<=-16 || src_y >= s->height)
-        dxy &= ~4;
-
-    linesize   = s->linesize;
-    uvlinesize = s->uvlinesize;
-    ptr = ref_picture[0] + (src_y * linesize) + src_x;
-
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(src_x<1 || src_y<1 || src_x + 17  >= s->h_edge_pos
-                              || src_y + h+1 >= v_edge_pos){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19,
-                             src_x-1, src_y-1, s->h_edge_pos, s->v_edge_pos);
-            ptr= s->edge_emu_buffer + 1 + s->linesize;
-            emu=1;
-        }
-    }
-
-    s->dsp.put_mspel_pixels_tab[dxy](dest_y             , ptr             , linesize);
-    s->dsp.put_mspel_pixels_tab[dxy](dest_y+8           , ptr+8           , linesize);
-    s->dsp.put_mspel_pixels_tab[dxy](dest_y  +8*linesize, ptr  +8*linesize, linesize);
-    s->dsp.put_mspel_pixels_tab[dxy](dest_y+8+8*linesize, ptr+8+8*linesize, linesize);
-
-    if(s->flags&CODEC_FLAG_GRAY) return;
-
-    if (s->out_format == FMT_H263) {
-        dxy = 0;
-        if ((motion_x & 3) != 0)
-            dxy |= 1;
-        if ((motion_y & 3) != 0)
-            dxy |= 2;
-        mx = motion_x >> 2;
-        my = motion_y >> 2;
-    } else {
-        mx = motion_x / 2;
-        my = motion_y / 2;
-        dxy = ((my & 1) << 1) | (mx & 1);
-        mx >>= 1;
-        my >>= 1;
-    }
-
-    src_x = s->mb_x * 8 + mx;
-    src_y = s->mb_y * 8 + my;
-    src_x = av_clip(src_x, -8, s->width >> 1);
-    if (src_x == (s->width >> 1))
-        dxy &= ~1;
-    src_y = av_clip(src_y, -8, s->height >> 1);
-    if (src_y == (s->height >> 1))
-        dxy &= ~2;
-    offset = (src_y * uvlinesize) + src_x;
-    ptr = ref_picture[1] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
-                         src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
-    }
-    pix_op[1][dxy](dest_cb, ptr, uvlinesize, h >> 1);
-
-    ptr = ref_picture[2] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,
-                         src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
-    }
-    pix_op[1][dxy](dest_cr, ptr, uvlinesize, h >> 1);
-}
diff --git a/libavcodec/wmv2.h b/libavcodec/wmv2.h
deleted file mode 100644
index c69c9f4..0000000
--- a/libavcodec/wmv2.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2002 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_WMV2_H
-#define AVCODEC_WMV2_H
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "intrax8.h"
-
-#define SKIP_TYPE_NONE 0
-#define SKIP_TYPE_MPEG 1
-#define SKIP_TYPE_ROW  2
-#define SKIP_TYPE_COL  3
-
-
-typedef struct Wmv2Context{
-    MpegEncContext s;
-    IntraX8Context x8;
-    int j_type_bit;
-    int j_type;
-    int abt_flag;
-    int abt_type;
-    int abt_type_table[6];
-    int per_mb_abt;
-    int per_block_abt;
-    int mspel_bit;
-    int cbp_table_index;
-    int top_left_mv_flag;
-    int per_mb_rl_bit;
-    int skip_type;
-    int hshift;
-
-    ScanTable abt_scantable[2];
-    DECLARE_ALIGNED(16, DCTELEM, abt_block2)[6][64];
-}Wmv2Context;
-
-void ff_wmv2_common_init(Wmv2Context * w);
-
-#endif /* AVCODEC_WMV2_H */
diff --git a/libavcodec/wmv2dec.c b/libavcodec/wmv2dec.c
deleted file mode 100644
index a9bb80c..0000000
--- a/libavcodec/wmv2dec.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * Copyright (c) 2002 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "h263.h"
-#include "mathops.h"
-#include "msmpeg4.h"
-#include "msmpeg4data.h"
-#include "intrax8.h"
-#include "wmv2.h"
-
-
-static void parse_mb_skip(Wmv2Context * w){
-    int mb_x, mb_y;
-    MpegEncContext * const s= &w->s;
-    uint32_t * const mb_type= s->current_picture_ptr->mb_type;
-
-    w->skip_type= get_bits(&s->gb, 2);
-    switch(w->skip_type){
-    case SKIP_TYPE_NONE:
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                mb_type[mb_y*s->mb_stride + mb_x]= MB_TYPE_16x16 | MB_TYPE_L0;
-            }
-        }
-        break;
-    case SKIP_TYPE_MPEG:
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
-            }
-        }
-        break;
-    case SKIP_TYPE_ROW:
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            if(get_bits1(&s->gb)){
-                for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                    mb_type[mb_y*s->mb_stride + mb_x]=  MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-                }
-            }else{
-                for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                    mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
-                }
-            }
-        }
-        break;
-    case SKIP_TYPE_COL:
-        for(mb_x=0; mb_x<s->mb_width; mb_x++){
-            if(get_bits1(&s->gb)){
-                for(mb_y=0; mb_y<s->mb_height; mb_y++){
-                    mb_type[mb_y*s->mb_stride + mb_x]=  MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
-                }
-            }else{
-                for(mb_y=0; mb_y<s->mb_height; mb_y++){
-                    mb_type[mb_y*s->mb_stride + mb_x]= (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
-                }
-            }
-        }
-        break;
-    }
-}
-
-static int decode_ext_header(Wmv2Context *w){
-    MpegEncContext * const s= &w->s;
-    GetBitContext gb;
-    int fps;
-    int code;
-
-    if(s->avctx->extradata_size<4) return -1;
-
-    init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8);
-
-    fps                = get_bits(&gb, 5);
-    s->bit_rate        = get_bits(&gb, 11)*1024;
-    w->mspel_bit       = get_bits1(&gb);
-    s->loop_filter     = get_bits1(&gb);
-    w->abt_flag        = get_bits1(&gb);
-    w->j_type_bit      = get_bits1(&gb);
-    w->top_left_mv_flag= get_bits1(&gb);
-    w->per_mb_rl_bit   = get_bits1(&gb);
-    code               = get_bits(&gb, 3);
-
-    if(code==0) return -1;
-
-    s->slice_height = s->mb_height / code;
-
-    if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-        av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, slices:%d\n",
-        fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
-        code);
-    }
-    return 0;
-}
-
-int ff_wmv2_decode_picture_header(MpegEncContext * s)
-{
-    Wmv2Context * const w= (Wmv2Context*)s;
-    int code;
-
-#if 0
-{
-int i;
-for(i=0; i<s->gb.size*8; i++)
-    printf("%d", get_bits1(&s->gb));
-//    get_bits1(&s->gb);
-printf("END\n");
-return -1;
-}
-#endif
-    if(s->picture_number==0)
-        decode_ext_header(w);
-
-    s->pict_type = get_bits1(&s->gb) + 1;
-    if(s->pict_type == FF_I_TYPE){
-        code = get_bits(&s->gb, 7);
-        av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
-    }
-    s->chroma_qscale= s->qscale = get_bits(&s->gb, 5);
-    if(s->qscale <= 0)
-       return -1;
-
-    return 0;
-}
-
-int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)
-{
-    Wmv2Context * const w= (Wmv2Context*)s;
-
-    if (s->pict_type == FF_I_TYPE) {
-        if(w->j_type_bit) w->j_type= get_bits1(&s->gb);
-        else              w->j_type= 0; //FIXME check
-
-        if(!w->j_type){
-            if(w->per_mb_rl_bit) s->per_mb_rl_table= get_bits1(&s->gb);
-            else                 s->per_mb_rl_table= 0;
-
-            if(!s->per_mb_rl_table){
-                s->rl_chroma_table_index = decode012(&s->gb);
-                s->rl_table_index = decode012(&s->gb);
-            }
-
-            s->dc_table_index = get_bits1(&s->gb);
-        }
-        s->inter_intra_pred= 0;
-        s->no_rounding = 1;
-        if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-            av_log(s->avctx, AV_LOG_DEBUG, "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
-                s->qscale,
-                s->rl_chroma_table_index,
-                s->rl_table_index,
-                s->dc_table_index,
-                s->per_mb_rl_table,
-                w->j_type);
-        }
-    }else{
-        int cbp_index;
-        w->j_type=0;
-
-        parse_mb_skip(w);
-        cbp_index= decode012(&s->gb);
-        if(s->qscale <= 10){
-            int map[3]= {0,2,1};
-            w->cbp_table_index= map[cbp_index];
-        }else if(s->qscale <= 20){
-            int map[3]= {1,0,2};
-            w->cbp_table_index= map[cbp_index];
-        }else{
-            int map[3]= {2,1,0};
-            w->cbp_table_index= map[cbp_index];
-        }
-
-        if(w->mspel_bit) s->mspel= get_bits1(&s->gb);
-        else             s->mspel= 0; //FIXME check
-
-        if(w->abt_flag){
-            w->per_mb_abt= get_bits1(&s->gb)^1;
-            if(!w->per_mb_abt){
-                w->abt_type= decode012(&s->gb);
-            }
-        }
-
-        if(w->per_mb_rl_bit) s->per_mb_rl_table= get_bits1(&s->gb);
-        else                 s->per_mb_rl_table= 0;
-
-        if(!s->per_mb_rl_table){
-            s->rl_table_index = decode012(&s->gb);
-            s->rl_chroma_table_index = s->rl_table_index;
-        }
-
-        s->dc_table_index = get_bits1(&s->gb);
-        s->mv_table_index = get_bits1(&s->gb);
-
-        s->inter_intra_pred= 0;//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
-        s->no_rounding ^= 1;
-
-        if(s->avctx->debug&FF_DEBUG_PICT_INFO){
-            av_log(s->avctx, AV_LOG_DEBUG, "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
-                s->rl_table_index,
-                s->rl_chroma_table_index,
-                s->dc_table_index,
-                s->mv_table_index,
-                s->per_mb_rl_table,
-                s->qscale,
-                s->mspel,
-                w->per_mb_abt,
-                w->abt_type,
-                w->cbp_table_index,
-                s->inter_intra_pred);
-        }
-    }
-    s->esc3_level_length= 0;
-    s->esc3_run_length= 0;
-
-s->picture_number++; //FIXME ?
-
-
-    if(w->j_type){
-        ff_intrax8_decode_picture(&w->x8, 2*s->qscale, (s->qscale-1)|1 );
-        return 1;
-    }
-
-    return 0;
-}
-
-static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr){
-    MpegEncContext * const s= &w->s;
-    int ret;
-
-    ret= ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
-
-    if(ret<0) return -1;
-
-    if((((*mx_ptr)|(*my_ptr)) & 1) && s->mspel)
-        w->hshift= get_bits1(&s->gb);
-    else
-        w->hshift= 0;
-
-//printf("%d %d  ", *mx_ptr, *my_ptr);
-
-    return 0;
-}
-
-static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){
-    MpegEncContext * const s= &w->s;
-    int xy, wrap, diff, type;
-    int16_t *A, *B, *C, *mot_val;
-
-    wrap = s->b8_stride;
-    xy = s->block_index[0];
-
-    mot_val = s->current_picture.motion_val[0][xy];
-
-    A = s->current_picture.motion_val[0][xy - 1];
-    B = s->current_picture.motion_val[0][xy - wrap];
-    C = s->current_picture.motion_val[0][xy + 2 - wrap];
-
-    if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
-        diff= FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
-    else
-        diff=0;
-
-    if(diff >= 8)
-        type= get_bits1(&s->gb);
-    else
-        type= 2;
-
-    if(type == 0){
-        *px= A[0];
-        *py= A[1];
-    }else if(type == 1){
-        *px= B[0];
-        *py= B[1];
-    }else{
-        /* special case for first (slice) line */
-        if (s->first_slice_line) {
-            *px = A[0];
-            *py = A[1];
-        } else {
-            *px = mid_pred(A[0], B[0], C[0]);
-            *py = mid_pred(A[1], B[1], C[1]);
-        }
-    }
-
-    return mot_val;
-}
-
-static inline int wmv2_decode_inter_block(Wmv2Context *w, DCTELEM *block, int n, int cbp){
-    MpegEncContext * const s= &w->s;
-    static const int sub_cbp_table[3]= {2,3,1};
-    int sub_cbp;
-
-    if(!cbp){
-        s->block_last_index[n] = -1;
-
-        return 0;
-    }
-
-    if(w->per_block_abt)
-        w->abt_type= decode012(&s->gb);
-#if 0
-    if(w->per_block_abt)
-        printf("B%d", w->abt_type);
-#endif
-    w->abt_type_table[n]= w->abt_type;
-
-    if(w->abt_type){
-//        const uint8_t *scantable= w->abt_scantable[w->abt_type-1].permutated;
-        const uint8_t *scantable= w->abt_scantable[w->abt_type-1].scantable;
-//        const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
-
-        sub_cbp= sub_cbp_table[ decode012(&s->gb) ];
-//        printf("S%d", sub_cbp);
-
-        if(sub_cbp&1){
-            if (ff_msmpeg4_decode_block(s, block, n, 1, scantable) < 0)
-                return -1;
-        }
-
-        if(sub_cbp&2){
-            if (ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable) < 0)
-                return -1;
-        }
-        s->block_last_index[n] = 63;
-
-        return 0;
-    }else{
-        return ff_msmpeg4_decode_block(s, block, n, 1, s->inter_scantable.permutated);
-    }
-}
-
-
-int ff_wmv2_decode_mb(MpegEncContext *s, DCTELEM block[6][64])
-{
-    Wmv2Context * const w= (Wmv2Context*)s;
-    int cbp, code, i;
-    uint8_t *coded_val;
-
-    if(w->j_type) return 0;
-
-    if (s->pict_type == FF_P_TYPE) {
-        if(IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])){
-            /* skip mb */
-            s->mb_intra = 0;
-            for(i=0;i<6;i++)
-                s->block_last_index[i] = -1;
-            s->mv_dir = MV_DIR_FORWARD;
-            s->mv_type = MV_TYPE_16X16;
-            s->mv[0][0][0] = 0;
-            s->mv[0][0][1] = 0;
-            s->mb_skipped = 1;
-            w->hshift=0;
-            return 0;
-        }
-
-        code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3);
-        if (code < 0)
-            return -1;
-        s->mb_intra = (~code & 0x40) >> 6;
-
-        cbp = code & 0x3f;
-    } else {
-        s->mb_intra = 1;
-        code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
-        if (code < 0){
-            av_log(s->avctx, AV_LOG_ERROR, "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
-            return -1;
-        }
-        /* predict coded block pattern */
-        cbp = 0;
-        for(i=0;i<6;i++) {
-            int val = ((code >> (5 - i)) & 1);
-            if (i < 4) {
-                int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
-                val = val ^ pred;
-                *coded_val = val;
-            }
-            cbp |= val << (5 - i);
-        }
-    }
-
-    if (!s->mb_intra) {
-        int mx, my;
-//printf("P at %d %d\n", s->mb_x, s->mb_y);
-        wmv2_pred_motion(w, &mx, &my);
-
-        if(cbp){
-            s->dsp.clear_blocks(s->block[0]);
-            if(s->per_mb_rl_table){
-                s->rl_table_index = decode012(&s->gb);
-                s->rl_chroma_table_index = s->rl_table_index;
-            }
-
-            if(w->abt_flag && w->per_mb_abt){
-                w->per_block_abt= get_bits1(&s->gb);
-                if(!w->per_block_abt)
-                    w->abt_type= decode012(&s->gb);
-            }else
-                w->per_block_abt=0;
-        }
-
-        if (wmv2_decode_motion(w, &mx, &my) < 0)
-            return -1;
-
-        s->mv_dir = MV_DIR_FORWARD;
-        s->mv_type = MV_TYPE_16X16;
-        s->mv[0][0][0] = mx;
-        s->mv[0][0][1] = my;
-
-        for (i = 0; i < 6; i++) {
-            if (wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0)
-            {
-                av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding inter block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
-                return -1;
-            }
-        }
-    } else {
-//if(s->pict_type==FF_P_TYPE)
-//   printf("%d%d ", s->inter_intra_pred, cbp);
-//printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24));
-        s->ac_pred = get_bits1(&s->gb);
-        if(s->inter_intra_pred){
-            s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc.table, INTER_INTRA_VLC_BITS, 1);
-//            printf("%d%d %d %d/", s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
-        }
-        if(s->per_mb_rl_table && cbp){
-            s->rl_table_index = decode012(&s->gb);
-            s->rl_chroma_table_index = s->rl_table_index;
-        }
-
-        s->dsp.clear_blocks(s->block[0]);
-        for (i = 0; i < 6; i++) {
-            if (ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL) < 0)
-            {
-                av_log(s->avctx, AV_LOG_ERROR, "\nerror while decoding intra block: %d x %d (%d)\n", s->mb_x, s->mb_y, i);
-                return -1;
-            }
-        }
-    }
-
-    return 0;
-}
-
-static av_cold int wmv2_decode_init(AVCodecContext *avctx){
-    Wmv2Context * const w= avctx->priv_data;
-
-    if(avctx->idct_algo==FF_IDCT_AUTO){
-        avctx->idct_algo=FF_IDCT_WMV2;
-    }
-
-    if(ff_msmpeg4_decode_init(avctx) < 0)
-        return -1;
-
-    ff_wmv2_common_init(w);
-
-    ff_intrax8_common_init(&w->x8,&w->s);
-
-    return 0;
-}
-
-static av_cold int wmv2_decode_end(AVCodecContext *avctx)
-{
-    Wmv2Context *w = avctx->priv_data;
-
-    ff_intrax8_common_end(&w->x8);
-    return ff_h263_decode_end(avctx);
-}
-
-AVCodec wmv2_decoder = {
-    "wmv2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WMV2,
-    sizeof(Wmv2Context),
-    wmv2_decode_init,
-    NULL,
-    wmv2_decode_end,
-    ff_h263_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
-    .pix_fmts= ff_pixfmt_list_420,
-};
diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
deleted file mode 100644
index 7416f85..0000000
--- a/libavcodec/wmv2enc.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2002 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "msmpeg4.h"
-#include "msmpeg4data.h"
-#include "h263.h"
-#include "wmv2.h"
-
-
-static int encode_ext_header(Wmv2Context *w){
-    MpegEncContext * const s= &w->s;
-    PutBitContext pb;
-    int code;
-
-    init_put_bits(&pb, s->avctx->extradata, s->avctx->extradata_size);
-
-    put_bits(&pb, 5, s->avctx->time_base.den / s->avctx->time_base.num); //yes 29.97 -> 29
-    put_bits(&pb, 11, FFMIN(s->bit_rate/1024, 2047));
-
-    put_bits(&pb, 1, w->mspel_bit=1);
-    put_bits(&pb, 1, s->loop_filter);
-    put_bits(&pb, 1, w->abt_flag=1);
-    put_bits(&pb, 1, w->j_type_bit=1);
-    put_bits(&pb, 1, w->top_left_mv_flag=0);
-    put_bits(&pb, 1, w->per_mb_rl_bit=1);
-    put_bits(&pb, 3, code=1);
-
-    flush_put_bits(&pb);
-
-    s->slice_height = s->mb_height / code;
-
-    return 0;
-}
-
-static av_cold int wmv2_encode_init(AVCodecContext *avctx){
-    Wmv2Context * const w= avctx->priv_data;
-
-    if(MPV_encode_init(avctx) < 0)
-        return -1;
-
-    ff_wmv2_common_init(w);
-
-    avctx->extradata_size= 4;
-    avctx->extradata= av_mallocz(avctx->extradata_size + 10);
-    encode_ext_header(w);
-
-    return 0;
-}
-
-int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number)
-{
-    Wmv2Context * const w= (Wmv2Context*)s;
-
-    put_bits(&s->pb, 1, s->pict_type - 1);
-    if(s->pict_type == FF_I_TYPE){
-        put_bits(&s->pb, 7, 0);
-    }
-    put_bits(&s->pb, 5, s->qscale);
-
-    s->dc_table_index = 1;
-    s->mv_table_index = 1; /* only if P frame */
-    s->per_mb_rl_table = 0;
-    s->mspel= 0;
-    w->per_mb_abt=0;
-    w->abt_type=0;
-    w->j_type=0;
-
-    assert(s->flipflop_rounding);
-
-    if (s->pict_type == FF_I_TYPE) {
-        assert(s->no_rounding==1);
-        if(w->j_type_bit) put_bits(&s->pb, 1, w->j_type);
-
-        if(w->per_mb_rl_bit) put_bits(&s->pb, 1, s->per_mb_rl_table);
-
-        if(!s->per_mb_rl_table){
-            ff_msmpeg4_code012(&s->pb, s->rl_chroma_table_index);
-            ff_msmpeg4_code012(&s->pb, s->rl_table_index);
-        }
-
-        put_bits(&s->pb, 1, s->dc_table_index);
-
-        s->inter_intra_pred= 0;
-    }else{
-        int cbp_index;
-
-        put_bits(&s->pb, 2, SKIP_TYPE_NONE);
-
-        ff_msmpeg4_code012(&s->pb, cbp_index=0);
-        if(s->qscale <= 10){
-            int map[3]= {0,2,1};
-            w->cbp_table_index= map[cbp_index];
-        }else if(s->qscale <= 20){
-            int map[3]= {1,0,2};
-            w->cbp_table_index= map[cbp_index];
-        }else{
-            int map[3]= {2,1,0};
-            w->cbp_table_index= map[cbp_index];
-        }
-
-        if(w->mspel_bit) put_bits(&s->pb, 1, s->mspel);
-
-        if(w->abt_flag){
-            put_bits(&s->pb, 1, w->per_mb_abt^1);
-            if(!w->per_mb_abt){
-                ff_msmpeg4_code012(&s->pb, w->abt_type);
-            }
-        }
-
-        if(w->per_mb_rl_bit) put_bits(&s->pb, 1, s->per_mb_rl_table);
-
-        if(!s->per_mb_rl_table){
-            ff_msmpeg4_code012(&s->pb, s->rl_table_index);
-            s->rl_chroma_table_index = s->rl_table_index;
-        }
-        put_bits(&s->pb, 1, s->dc_table_index);
-        put_bits(&s->pb, 1, s->mv_table_index);
-
-        s->inter_intra_pred= 0;//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
-    }
-    s->esc3_level_length= 0;
-    s->esc3_run_length= 0;
-
-    return 0;
-}
-
-/* Nearly identical to wmv1 but that is just because we do not use the
- * useless M$ crap features. It is duplicated here in case someone wants
- * to add support for these crap features. */
-void ff_wmv2_encode_mb(MpegEncContext * s,
-                       DCTELEM block[6][64],
-                       int motion_x, int motion_y)
-{
-    Wmv2Context * const w= (Wmv2Context*)s;
-    int cbp, coded_cbp, i;
-    int pred_x, pred_y;
-    uint8_t *coded_block;
-
-    ff_msmpeg4_handle_slices(s);
-
-    if (!s->mb_intra) {
-        /* compute cbp */
-        cbp = 0;
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0)
-                cbp |= 1 << (5 - i);
-        }
-
-        put_bits(&s->pb,
-                 wmv2_inter_table[w->cbp_table_index][cbp + 64][1],
-                 wmv2_inter_table[w->cbp_table_index][cbp + 64][0]);
-
-        /* motion vector */
-        h263_pred_motion(s, 0, 0, &pred_x, &pred_y);
-        ff_msmpeg4_encode_motion(s, motion_x - pred_x,
-                              motion_y - pred_y);
-    } else {
-        /* compute cbp */
-        cbp = 0;
-        coded_cbp = 0;
-        for (i = 0; i < 6; i++) {
-            int val, pred;
-            val = (s->block_last_index[i] >= 1);
-            cbp |= val << (5 - i);
-            if (i < 4) {
-                /* predict value for close blocks only for luma */
-                pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block);
-                *coded_block = val;
-                val = val ^ pred;
-            }
-            coded_cbp |= val << (5 - i);
-        }
-
-        if (s->pict_type == FF_I_TYPE) {
-            put_bits(&s->pb,
-                     ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]);
-        } else {
-            put_bits(&s->pb,
-                     wmv2_inter_table[w->cbp_table_index][cbp][1],
-                     wmv2_inter_table[w->cbp_table_index][cbp][0]);
-        }
-        put_bits(&s->pb, 1, 0);         /* no AC prediction yet */
-        if(s->inter_intra_pred){
-            s->h263_aic_dir=0;
-            put_bits(&s->pb, table_inter_intra[s->h263_aic_dir][1], table_inter_intra[s->h263_aic_dir][0]);
-        }
-    }
-
-    for (i = 0; i < 6; i++) {
-        ff_msmpeg4_encode_block(s, block[i], i);
-    }
-}
-
-AVCodec wmv2_encoder = {
-    "wmv2",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WMV2,
-    sizeof(Wmv2Context),
-    wmv2_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
-};
diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
deleted file mode 100644
index 56634d1..0000000
--- a/libavcodec/wnv1.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Winnov WNV1 codec
- * Copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Winnov WNV1 codec.
- */
-
-#include "avcodec.h"
-#include "get_bits.h"
-#include "libavutil/common.h"
-
-
-typedef struct WNV1Context{
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    int shift;
-    GetBitContext gb;
-} WNV1Context;
-
-static const uint16_t code_tab[16][2]={
-{0x1FD,9}, {0xFD,8}, {0x7D,7}, {0x3D,6}, {0x1D,5}, {0x0D,4}, {0x005,3},
-{0x000,1},
-{0x004,3}, {0x0C,4}, {0x1C,5}, {0x3C,6}, {0x7C,7}, {0xFC,8}, {0x1FC,9}, {0xFF,8}
-};
-
-#define CODE_VLC_BITS 9
-static VLC code_vlc;
-
-/* returns modified base_value */
-static inline int wnv1_get_code(WNV1Context *w, int base_value)
-{
-    int v = get_vlc2(&w->gb, code_vlc.table, CODE_VLC_BITS, 1);
-
-    if(v==15)
-        return av_reverse[ get_bits(&w->gb, 8 - w->shift) ];
-    else
-        return base_value + ((v - 7)<<w->shift);
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    WNV1Context * const l = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&l->pic;
-    unsigned char *Y,*U,*V;
-    int i, j;
-    int prev_y = 0, prev_u = 0, prev_v = 0;
-    uint8_t *rbuf;
-
-    rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if(!rbuf){
-        av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
-        return -1;
-    }
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        av_free(rbuf);
-        return -1;
-    }
-    p->key_frame = 1;
-
-    for(i=8; i<buf_size; i++)
-        rbuf[i]= av_reverse[ buf[i] ];
-    init_get_bits(&l->gb, rbuf+8, (buf_size-8)*8);
-
-    if (buf[2] >> 4 == 6)
-        l->shift = 2;
-    else {
-        l->shift = 8 - (buf[2] >> 4);
-        if (l->shift > 4) {
-            av_log(avctx, AV_LOG_ERROR, "Unknown WNV1 frame header value %i, please upload file for study\n", buf[2] >> 4);
-            l->shift = 4;
-        }
-        if (l->shift < 1) {
-            av_log(avctx, AV_LOG_ERROR, "Unknown WNV1 frame header value %i, please upload file for study\n", buf[2] >> 4);
-            l->shift = 1;
-        }
-    }
-
-    Y = p->data[0];
-    U = p->data[1];
-    V = p->data[2];
-    for (j = 0; j < avctx->height; j++) {
-        for (i = 0; i < avctx->width / 2; i++) {
-            Y[i * 2] = wnv1_get_code(l, prev_y);
-            prev_u = U[i] = wnv1_get_code(l, prev_u);
-            prev_y = Y[(i * 2) + 1] = wnv1_get_code(l, Y[i * 2]);
-            prev_v = V[i] = wnv1_get_code(l, prev_v);
-        }
-        Y += p->linesize[0];
-        U += p->linesize[1];
-        V += p->linesize[2];
-    }
-
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = l->pic;
-    av_free(rbuf);
-
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-    WNV1Context * const l = avctx->priv_data;
-    static VLC_TYPE code_table[1 << CODE_VLC_BITS][2];
-
-    l->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_YUV422P;
-
-    code_vlc.table = code_table;
-    code_vlc.table_allocated = 1 << CODE_VLC_BITS;
-    init_vlc(&code_vlc, CODE_VLC_BITS, 16,
-             &code_tab[0][1], 4, 2,
-             &code_tab[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    WNV1Context * const l = avctx->priv_data;
-    AVFrame *pic = &l->pic;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    return 0;
-}
-
-AVCodec wnv1_decoder = {
-    "wnv1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_WNV1,
-    sizeof(WNV1Context),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"),
-};
diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c
deleted file mode 100644
index a383673..0000000
--- a/libavcodec/ws-snd1.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Westwood SNDx codecs
- * Copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-/**
- * @file
- * Westwood SNDx codecs.
- *
- * Reference documents about VQA format and its audio codecs
- * can be found here:
- * http://www.multimedia.cx
- */
-
-static const char ws_adpcm_2bit[] = { -2, -1, 0, 1};
-static const char ws_adpcm_4bit[] = {
-    -9, -8, -6, -5, -4, -3, -2, -1,
-     0,  1,  2,  3,  4,  5,  6,  8 };
-
-#define CLIP8(a) if(a>127)a=127;if(a<-128)a=-128;
-
-static av_cold int ws_snd_decode_init(AVCodecContext * avctx)
-{
-//    WSSNDContext *c = avctx->priv_data;
-
-    avctx->sample_fmt = SAMPLE_FMT_S16;
-    return 0;
-}
-
-static int ws_snd_decode_frame(AVCodecContext *avctx,
-                void *data, int *data_size,
-                AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-//    WSSNDContext *c = avctx->priv_data;
-
-    int in_size, out_size;
-    int sample = 0;
-    int i;
-    short *samples = data;
-
-    if (!buf_size)
-        return 0;
-
-    out_size = AV_RL16(&buf[0]);
-    *data_size = out_size * 2;
-    in_size = AV_RL16(&buf[2]);
-    buf += 4;
-
-    if (out_size > *data_size) {
-        av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n");
-        return -1;
-    }
-    if (in_size > buf_size) {
-        av_log(avctx, AV_LOG_ERROR, "Frame data is larger than input buffer\n");
-        return -1;
-    }
-    if (in_size == out_size) {
-        for (i = 0; i < out_size; i++)
-            *samples++ = (*buf++ - 0x80) << 8;
-        return buf_size;
-    }
-
-    while (out_size > 0) {
-        int code;
-        uint8_t count;
-        code = (*buf) >> 6;
-        count = (*buf) & 0x3F;
-        buf++;
-        switch(code) {
-        case 0: /* ADPCM 2-bit */
-            for (count++; count > 0; count--) {
-                code = *buf++;
-                sample += ws_adpcm_2bit[code & 0x3];
-                CLIP8(sample);
-                *samples++ = sample << 8;
-                sample += ws_adpcm_2bit[(code >> 2) & 0x3];
-                CLIP8(sample);
-                *samples++ = sample << 8;
-                sample += ws_adpcm_2bit[(code >> 4) & 0x3];
-                CLIP8(sample);
-                *samples++ = sample << 8;
-                sample += ws_adpcm_2bit[(code >> 6) & 0x3];
-                CLIP8(sample);
-                *samples++ = sample << 8;
-                out_size -= 4;
-            }
-            break;
-        case 1: /* ADPCM 4-bit */
-            for (count++; count > 0; count--) {
-                code = *buf++;
-                sample += ws_adpcm_4bit[code & 0xF];
-                CLIP8(sample);
-                *samples++ = sample << 8;
-                sample += ws_adpcm_4bit[code >> 4];
-                CLIP8(sample);
-                *samples++ = sample << 8;
-                out_size -= 2;
-            }
-            break;
-        case 2: /* no compression */
-            if (count & 0x20) { /* big delta */
-                char t;
-                t = count;
-                t <<= 3;
-                sample += t >> 3;
-                *samples++ = sample << 8;
-                out_size--;
-            } else { /* copy */
-                for (count++; count > 0; count--) {
-                    *samples++ = (*buf++ - 0x80) << 8;
-                    out_size--;
-                }
-                sample = buf[-1] - 0x80;
-            }
-            break;
-        default: /* run */
-            for(count++; count > 0; count--) {
-                *samples++ = sample << 8;
-                out_size--;
-            }
-        }
-    }
-
-    return buf_size;
-}
-
-AVCodec ws_snd1_decoder = {
-    "ws_snd1",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WESTWOOD_SND1,
-    0,
-    ws_snd_decode_init,
-    NULL,
-    NULL,
-    ws_snd_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"),
-};
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
deleted file mode 100644
index f4d0c84..0000000
--- a/libavcodec/x86/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-OBJS-$(CONFIG_MLP_DECODER)             += x86/mlpdsp.o
-OBJS-$(CONFIG_TRUEHD_DECODER)          += x86/mlpdsp.o
-
-YASM-OBJS-FFT-$(HAVE_AMD3DNOW)         += x86/fft_3dn.o
-YASM-OBJS-FFT-$(HAVE_AMD3DNOWEXT)      += x86/fft_3dn2.o
-YASM-OBJS-FFT-$(HAVE_SSE)              += x86/fft_sse.o
-YASM-OBJS-$(CONFIG_FFT)                += x86/fft_mmx.o                 \
-                                          $(YASM-OBJS-FFT-yes)
-YASM-OBJS-$(CONFIG_GPL)                += x86/h264_deblock_sse2.o       \
-                                          x86/h264_idct_sse2.o          \
-
-MMX-OBJS-$(CONFIG_CAVS_DECODER)        += x86/cavsdsp_mmx.o
-MMX-OBJS-$(CONFIG_ENCODERS)            += x86/dsputilenc_mmx.o
-MMX-OBJS-$(CONFIG_GPL)                 += x86/idct_mmx.o
-MMX-OBJS-$(CONFIG_LPC)                 += x86/lpc_mmx.o
-MMX-OBJS-$(CONFIG_DWT)                 += x86/snowdsp_mmx.o
-MMX-OBJS-$(CONFIG_VC1_DECODER)         += x86/vc1dsp_mmx.o
-MMX-OBJS-$(CONFIG_VP3_DECODER)         += x86/vp3dsp_mmx.o              \
-                                          x86/vp3dsp_sse2.o
-MMX-OBJS-$(CONFIG_VP5_DECODER)         += x86/vp3dsp_mmx.o              \
-                                          x86/vp3dsp_sse2.o
-MMX-OBJS-$(CONFIG_VP6_DECODER)         += x86/vp3dsp_mmx.o              \
-                                          x86/vp3dsp_sse2.o             \
-                                          x86/vp6dsp_mmx.o              \
-                                          x86/vp6dsp_sse2.o
-MMX-OBJS-$(HAVE_YASM)                  += x86/dsputil_yasm.o            \
-                                          $(YASM-OBJS-yes)
-
-MMX-OBJS-$(CONFIG_FFT)                 += x86/fft.o
-
-OBJS-$(HAVE_MMX)                       += x86/cpuid.o                   \
-                                          x86/dnxhd_mmx.o               \
-                                          x86/dsputil_mmx.o             \
-                                          x86/fdct_mmx.o                \
-                                          x86/idct_mmx_xvid.o           \
-                                          x86/idct_sse2_xvid.o          \
-                                          x86/motion_est_mmx.o          \
-                                          x86/mpegvideo_mmx.o           \
-                                          x86/simple_idct_mmx.o         \
diff --git a/libavcodec/x86/cavsdsp_mmx.c b/libavcodec/x86/cavsdsp_mmx.c
deleted file mode 100644
index 638eaf7..0000000
--- a/libavcodec/x86/cavsdsp_mmx.c
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Chinese AVS video (AVS1-P2, JiZhun profile) decoder.
- * Copyright (c) 2006  Stefan Gehrer <stefan.gehrer at gmx.de>
- *
- * MMX-optimized DSP functions, based on H.264 optimizations by
- * Michael Niedermayer and Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-
-/*****************************************************************************
- *
- * inverse transform
- *
- ****************************************************************************/
-
-static inline void cavs_idct8_1d(int16_t *block, uint64_t bias)
-{
-    __asm__ volatile(
-        "movq 112(%0), %%mm4  \n\t" /* mm4 = src7 */
-        "movq  16(%0), %%mm5  \n\t" /* mm5 = src1 */
-        "movq  80(%0), %%mm2  \n\t" /* mm2 = src5 */
-        "movq  48(%0), %%mm7  \n\t" /* mm7 = src3 */
-        "movq   %%mm4, %%mm0  \n\t"
-        "movq   %%mm5, %%mm3  \n\t"
-        "movq   %%mm2, %%mm6  \n\t"
-        "movq   %%mm7, %%mm1  \n\t"
-
-        "paddw  %%mm4, %%mm4  \n\t" /* mm4 = 2*src7 */
-        "paddw  %%mm3, %%mm3  \n\t" /* mm3 = 2*src1 */
-        "paddw  %%mm6, %%mm6  \n\t" /* mm6 = 2*src5 */
-        "paddw  %%mm1, %%mm1  \n\t" /* mm1 = 2*src3 */
-        "paddw  %%mm4, %%mm0  \n\t" /* mm0 = 3*src7 */
-        "paddw  %%mm3, %%mm5  \n\t" /* mm5 = 3*src1 */
-        "paddw  %%mm6, %%mm2  \n\t" /* mm2 = 3*src5 */
-        "paddw  %%mm1, %%mm7  \n\t" /* mm7 = 3*src3 */
-        "psubw  %%mm4, %%mm5  \n\t" /* mm5 = 3*src1 - 2*src7 = a0 */
-        "paddw  %%mm6, %%mm7  \n\t" /* mm7 = 3*src3 + 2*src5 = a1 */
-        "psubw  %%mm2, %%mm1  \n\t" /* mm1 = 2*src3 - 3*src5 = a2 */
-        "paddw  %%mm0, %%mm3  \n\t" /* mm3 = 2*src1 + 3*src7 = a3 */
-
-        "movq   %%mm5, %%mm4  \n\t"
-        "movq   %%mm7, %%mm6  \n\t"
-        "movq   %%mm3, %%mm0  \n\t"
-        "movq   %%mm1, %%mm2  \n\t"
-        SUMSUB_BA( %%mm7, %%mm5 )   /* mm7 = a0 + a1  mm5 = a0 - a1 */
-        "paddw  %%mm3, %%mm7  \n\t" /* mm7 = a0 + a1 + a3 */
-        "paddw  %%mm1, %%mm5  \n\t" /* mm5 = a0 - a1 + a2 */
-        "paddw  %%mm7, %%mm7  \n\t"
-        "paddw  %%mm5, %%mm5  \n\t"
-        "paddw  %%mm6, %%mm7  \n\t" /* mm7 = b4 */
-        "paddw  %%mm4, %%mm5  \n\t" /* mm5 = b5 */
-
-        SUMSUB_BA( %%mm1, %%mm3 )   /* mm1 = a3 + a2  mm3 = a3 - a2 */
-        "psubw  %%mm1, %%mm4  \n\t" /* mm4 = a0 - a2 - a3 */
-        "movq   %%mm4, %%mm1  \n\t" /* mm1 = a0 - a2 - a3 */
-        "psubw  %%mm6, %%mm3  \n\t" /* mm3 = a3 - a2 - a1 */
-        "paddw  %%mm1, %%mm1  \n\t"
-        "paddw  %%mm3, %%mm3  \n\t"
-        "psubw  %%mm2, %%mm1  \n\t" /* mm1 = b7 */
-        "paddw  %%mm0, %%mm3  \n\t" /* mm3 = b6 */
-
-        "movq  32(%0), %%mm2  \n\t" /* mm2 = src2 */
-        "movq  96(%0), %%mm6  \n\t" /* mm6 = src6 */
-        "movq   %%mm2, %%mm4  \n\t"
-        "movq   %%mm6, %%mm0  \n\t"
-        "psllw  $2,    %%mm4  \n\t" /* mm4 = 4*src2 */
-        "psllw  $2,    %%mm6  \n\t" /* mm6 = 4*src6 */
-        "paddw  %%mm4, %%mm2  \n\t" /* mm2 = 5*src2 */
-        "paddw  %%mm6, %%mm0  \n\t" /* mm0 = 5*src6 */
-        "paddw  %%mm2, %%mm2  \n\t"
-        "paddw  %%mm0, %%mm0  \n\t"
-        "psubw  %%mm0, %%mm4  \n\t" /* mm4 = 4*src2 - 10*src6 = a7 */
-        "paddw  %%mm2, %%mm6  \n\t" /* mm6 = 4*src6 + 10*src2 = a6 */
-
-        "movq    (%0), %%mm2  \n\t" /* mm2 = src0 */
-        "movq  64(%0), %%mm0  \n\t" /* mm0 = src4 */
-        SUMSUB_BA( %%mm0, %%mm2 )   /* mm0 = src0+src4  mm2 = src0-src4 */
-        "psllw  $3,    %%mm0  \n\t"
-        "psllw  $3,    %%mm2  \n\t"
-        "paddw  %1,    %%mm0  \n\t" /* add rounding bias */
-        "paddw  %1,    %%mm2  \n\t" /* add rounding bias */
-
-        SUMSUB_BA( %%mm6, %%mm0 )   /* mm6 = a4 + a6  mm0 = a4 - a6 */
-        SUMSUB_BA( %%mm4, %%mm2 )   /* mm4 = a5 + a7  mm2 = a5 - a7 */
-        SUMSUB_BA( %%mm7, %%mm6 )   /* mm7 = dst0  mm6 = dst7 */
-        SUMSUB_BA( %%mm5, %%mm4 )   /* mm5 = dst1  mm4 = dst6 */
-        SUMSUB_BA( %%mm3, %%mm2 )   /* mm3 = dst2  mm2 = dst5 */
-        SUMSUB_BA( %%mm1, %%mm0 )   /* mm1 = dst3  mm0 = dst4 */
-        :: "r"(block), "m"(bias)
-    );
-}
-
-static void cavs_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
-{
-    int i;
-    DECLARE_ALIGNED(8, int16_t, b2)[64];
-
-    for(i=0; i<2; i++){
-        DECLARE_ALIGNED(8, uint64_t, tmp);
-
-        cavs_idct8_1d(block+4*i, ff_pw_4);
-
-        __asm__ volatile(
-            "psraw     $3, %%mm7  \n\t"
-            "psraw     $3, %%mm6  \n\t"
-            "psraw     $3, %%mm5  \n\t"
-            "psraw     $3, %%mm4  \n\t"
-            "psraw     $3, %%mm3  \n\t"
-            "psraw     $3, %%mm2  \n\t"
-            "psraw     $3, %%mm1  \n\t"
-            "psraw     $3, %%mm0  \n\t"
-            "movq   %%mm7,    %0   \n\t"
-            TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
-            "movq   %%mm0,  8(%1)  \n\t"
-            "movq   %%mm6, 24(%1)  \n\t"
-            "movq   %%mm7, 40(%1)  \n\t"
-            "movq   %%mm4, 56(%1)  \n\t"
-            "movq    %0,    %%mm7  \n\t"
-            TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
-            "movq   %%mm7,   (%1)  \n\t"
-            "movq   %%mm1, 16(%1)  \n\t"
-            "movq   %%mm0, 32(%1)  \n\t"
-            "movq   %%mm3, 48(%1)  \n\t"
-            : "=m"(tmp)
-            : "r"(b2+32*i)
-            : "memory"
-        );
-    }
-
-    for(i=0; i<2; i++){
-        cavs_idct8_1d(b2+4*i, ff_pw_64.a);
-
-        __asm__ volatile(
-            "psraw     $7, %%mm7  \n\t"
-            "psraw     $7, %%mm6  \n\t"
-            "psraw     $7, %%mm5  \n\t"
-            "psraw     $7, %%mm4  \n\t"
-            "psraw     $7, %%mm3  \n\t"
-            "psraw     $7, %%mm2  \n\t"
-            "psraw     $7, %%mm1  \n\t"
-            "psraw     $7, %%mm0  \n\t"
-            "movq   %%mm7,    (%0)  \n\t"
-            "movq   %%mm5,  16(%0)  \n\t"
-            "movq   %%mm3,  32(%0)  \n\t"
-            "movq   %%mm1,  48(%0)  \n\t"
-            "movq   %%mm0,  64(%0)  \n\t"
-            "movq   %%mm2,  80(%0)  \n\t"
-            "movq   %%mm4,  96(%0)  \n\t"
-            "movq   %%mm6, 112(%0)  \n\t"
-            :: "r"(b2+4*i)
-            : "memory"
-        );
-    }
-
-    add_pixels_clamped_mmx(b2, dst, stride);
-}
-
-/*****************************************************************************
- *
- * motion compensation
- *
- ****************************************************************************/
-
-/* vertical filter [-1 -2 96 42 -7  0]  */
-#define QPEL_CAVSV1(A,B,C,D,E,F,OP,MUL2) \
-        "movd (%0), "#F"            \n\t"\
-        "movq "#C", %%mm6           \n\t"\
-        "pmullw %5, %%mm6           \n\t"\
-        "movq "#D", %%mm7           \n\t"\
-        "pmullw "MANGLE(MUL2)", %%mm7\n\t"\
-        "psllw $3, "#E"             \n\t"\
-        "psubw "#E", %%mm6          \n\t"\
-        "psraw $3, "#E"             \n\t"\
-        "paddw %%mm7, %%mm6         \n\t"\
-        "paddw "#E", %%mm6          \n\t"\
-        "paddw "#B", "#B"           \n\t"\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "add %2, %0                 \n\t"\
-        "punpcklbw %%mm7, "#F"      \n\t"\
-        "psubw "#B", %%mm6          \n\t"\
-        "psraw $1, "#B"             \n\t"\
-        "psubw "#A", %%mm6          \n\t"\
-        "paddw %4, %%mm6            \n\t"\
-        "psraw $7, %%mm6            \n\t"\
-        "packuswb %%mm6, %%mm6      \n\t"\
-        OP(%%mm6, (%1), A, d)            \
-        "add %3, %1                 \n\t"
-
-/* vertical filter [ 0 -1  5  5 -1  0]  */
-#define QPEL_CAVSV2(A,B,C,D,E,F,OP,MUL2) \
-        "movd (%0), "#F"            \n\t"\
-        "movq "#C", %%mm6           \n\t"\
-        "paddw "#D", %%mm6          \n\t"\
-        "pmullw %5, %%mm6           \n\t"\
-        "add %2, %0                 \n\t"\
-        "punpcklbw %%mm7, "#F"      \n\t"\
-        "psubw "#B", %%mm6          \n\t"\
-        "psubw "#E", %%mm6          \n\t"\
-        "paddw %4, %%mm6            \n\t"\
-        "psraw $3, %%mm6            \n\t"\
-        "packuswb %%mm6, %%mm6      \n\t"\
-        OP(%%mm6, (%1), A, d)            \
-        "add %3, %1                 \n\t"
-
-/* vertical filter [ 0 -7 42 96 -2 -1]  */
-#define QPEL_CAVSV3(A,B,C,D,E,F,OP,MUL2) \
-        "movd (%0), "#F"            \n\t"\
-        "movq "#C", %%mm6           \n\t"\
-        "pmullw "MANGLE(MUL2)", %%mm6\n\t"\
-        "movq "#D", %%mm7           \n\t"\
-        "pmullw %5, %%mm7           \n\t"\
-        "psllw $3, "#B"             \n\t"\
-        "psubw "#B", %%mm6          \n\t"\
-        "psraw $3, "#B"             \n\t"\
-        "paddw %%mm7, %%mm6         \n\t"\
-        "paddw "#B", %%mm6          \n\t"\
-        "paddw "#E", "#E"           \n\t"\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "add %2, %0                 \n\t"\
-        "punpcklbw %%mm7, "#F"      \n\t"\
-        "psubw "#E", %%mm6          \n\t"\
-        "psraw $1, "#E"             \n\t"\
-        "psubw "#F", %%mm6          \n\t"\
-        "paddw %4, %%mm6            \n\t"\
-        "psraw $7, %%mm6            \n\t"\
-        "packuswb %%mm6, %%mm6      \n\t"\
-        OP(%%mm6, (%1), A, d)            \
-        "add %3, %1                 \n\t"
-
-
-#define QPEL_CAVSVNUM(VOP,OP,ADD,MUL1,MUL2)\
-    int w= 2;\
-    src -= 2*srcStride;\
-    \
-    while(w--){\
-      __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movd (%0), %%mm0           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm1           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm2           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm3           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm4           \n\t"\
-        "add %2, %0                 \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpcklbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpcklbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm4     \n\t"\
-        VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
-        VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
-        VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
-        VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
-        VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\
-        VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\
-        VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
-        VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
-        \
-        : "+a"(src), "+c"(dst)\
-        : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD), "m"(MUL1)\
-        : "memory"\
-     );\
-     if(h==16){\
-        __asm__ volatile(\
-            VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
-            VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
-            VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\
-            VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\
-            VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\
-            VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\
-            VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\
-            VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\
-            \
-           : "+a"(src), "+c"(dst)\
-           : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD),  "m"(MUL1)\
-           : "memory"\
-        );\
-     }\
-     src += 4-(h+5)*srcStride;\
-     dst += 4-h*dstStride;\
-   }
-
-#define QPEL_CAVS(OPNAME, OP, MMX)\
-static void OPNAME ## cavs_qpel8_h_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    int h=8;\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movq %5, %%mm6             \n\t"\
-        "1:                         \n\t"\
-        "movq    (%0), %%mm0        \n\t"\
-        "movq   1(%0), %%mm2        \n\t"\
-        "movq %%mm0, %%mm1          \n\t"\
-        "movq %%mm2, %%mm3          \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpckhbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpckhbw %%mm7, %%mm3     \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "paddw %%mm3, %%mm1         \n\t"\
-        "pmullw %%mm6, %%mm0        \n\t"\
-        "pmullw %%mm6, %%mm1        \n\t"\
-        "movq   -1(%0), %%mm2       \n\t"\
-        "movq    2(%0), %%mm4       \n\t"\
-        "movq %%mm2, %%mm3          \n\t"\
-        "movq %%mm4, %%mm5          \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpckhbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm4     \n\t"\
-        "punpckhbw %%mm7, %%mm5     \n\t"\
-        "paddw %%mm4, %%mm2         \n\t"\
-        "paddw %%mm3, %%mm5         \n\t"\
-        "psubw %%mm2, %%mm0         \n\t"\
-        "psubw %%mm5, %%mm1         \n\t"\
-        "movq %6, %%mm5             \n\t"\
-        "paddw %%mm5, %%mm0         \n\t"\
-        "paddw %%mm5, %%mm1         \n\t"\
-        "psraw $3, %%mm0            \n\t"\
-        "psraw $3, %%mm1            \n\t"\
-        "packuswb %%mm1, %%mm0      \n\t"\
-        OP(%%mm0, (%1),%%mm5, q)         \
-        "add %3, %0                 \n\t"\
-        "add %4, %1                 \n\t"\
-        "decl %2                    \n\t"\
-        " jnz 1b                    \n\t"\
-        : "+a"(src), "+c"(dst), "+m"(h)\
-        : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_4)\
-        : "memory"\
-    );\
-}\
-\
-static inline void OPNAME ## cavs_qpel8or16_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-  QPEL_CAVSVNUM(QPEL_CAVSV1,OP,ff_pw_64,ff_pw_96,ff_pw_42)      \
-}\
-\
-static inline void OPNAME ## cavs_qpel8or16_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-  QPEL_CAVSVNUM(QPEL_CAVSV2,OP,ff_pw_4,ff_pw_5,ff_pw_5)         \
-}\
-\
-static inline void OPNAME ## cavs_qpel8or16_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-  QPEL_CAVSVNUM(QPEL_CAVSV3,OP,ff_pw_64,ff_pw_96,ff_pw_42)      \
-}\
-\
-static void OPNAME ## cavs_qpel8_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst  , src  , dstStride, srcStride, 8);\
-}\
-static void OPNAME ## cavs_qpel16_v1_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst  , src  , dstStride, srcStride, 16);\
-    OPNAME ## cavs_qpel8or16_v1_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## cavs_qpel8_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst  , src  , dstStride, srcStride, 8);\
-}\
-static void OPNAME ## cavs_qpel16_v2_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst  , src  , dstStride, srcStride, 16);\
-    OPNAME ## cavs_qpel8or16_v2_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## cavs_qpel8_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst  , src  , dstStride, srcStride, 8);\
-}\
-static void OPNAME ## cavs_qpel16_v3_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst  , src  , dstStride, srcStride, 16);\
-    OPNAME ## cavs_qpel8or16_v3_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## cavs_qpel16_h_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## cavs_qpel8_h_ ## MMX(dst  , src  , dstStride, srcStride);\
-    OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## cavs_qpel8_h_ ## MMX(dst  , src  , dstStride, srcStride);\
-    OPNAME ## cavs_qpel8_h_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-}\
-
-#define CAVS_MC(OPNAME, SIZE, MMX) \
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_qpel ## SIZE ## _h_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_qpel ## SIZE ## _v1_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_qpel ## SIZE ## _v2_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void ff_ ## OPNAME ## cavs_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## cavs_qpel ## SIZE ## _v3_ ## MMX(dst, src, stride, stride);\
-}\
-
-#define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b "    \n\t"
-#define AVG_3DNOW_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp "   \n\t"\
-"pavgusb " #temp ", " #a "        \n\t"\
-"mov" #size " " #a ", " #b "      \n\t"
-#define AVG_MMX2_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp "   \n\t"\
-"pavgb " #temp ", " #a "          \n\t"\
-"mov" #size " " #a ", " #b "      \n\t"
-
-QPEL_CAVS(put_,       PUT_OP, 3dnow)
-QPEL_CAVS(avg_, AVG_3DNOW_OP, 3dnow)
-QPEL_CAVS(put_,       PUT_OP, mmx2)
-QPEL_CAVS(avg_,  AVG_MMX2_OP, mmx2)
-
-CAVS_MC(put_, 8, 3dnow)
-CAVS_MC(put_, 16,3dnow)
-CAVS_MC(avg_, 8, 3dnow)
-CAVS_MC(avg_, 16,3dnow)
-CAVS_MC(put_, 8, mmx2)
-CAVS_MC(put_, 16,mmx2)
-CAVS_MC(avg_, 8, mmx2)
-CAVS_MC(avg_, 16,mmx2)
-
-void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx) {
-#define dspfunc(PFX, IDX, NUM) \
-    c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \
-    c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_mmx2; \
-    c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_mmx2; \
-    c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_mmx2; \
-    c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_mmx2; \
-
-    dspfunc(put_cavs_qpel, 0, 16);
-    dspfunc(put_cavs_qpel, 1, 8);
-    dspfunc(avg_cavs_qpel, 0, 16);
-    dspfunc(avg_cavs_qpel, 1, 8);
-#undef dspfunc
-    c->cavs_idct8_add = cavs_idct8_add_mmx;
-}
-
-void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx) {
-#define dspfunc(PFX, IDX, NUM) \
-    c->PFX ## _pixels_tab[IDX][ 0] = ff_ ## PFX ## NUM ## _mc00_mmx2; \
-    c->PFX ## _pixels_tab[IDX][ 2] = ff_ ## PFX ## NUM ## _mc20_3dnow; \
-    c->PFX ## _pixels_tab[IDX][ 4] = ff_ ## PFX ## NUM ## _mc01_3dnow; \
-    c->PFX ## _pixels_tab[IDX][ 8] = ff_ ## PFX ## NUM ## _mc02_3dnow; \
-    c->PFX ## _pixels_tab[IDX][12] = ff_ ## PFX ## NUM ## _mc03_3dnow; \
-
-    dspfunc(put_cavs_qpel, 0, 16);
-    dspfunc(put_cavs_qpel, 1, 8);
-    dspfunc(avg_cavs_qpel, 0, 16);
-    dspfunc(avg_cavs_qpel, 1, 8);
-#undef dspfunc
-    c->cavs_idct8_add = cavs_idct8_add_mmx;
-}
diff --git a/libavcodec/x86/cpuid.c b/libavcodec/x86/cpuid.c
deleted file mode 100644
index 1ed4d2e..0000000
--- a/libavcodec/x86/cpuid.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * CPU detection code, extracted from mmx.h
- * (c)1997-99 by H. Dietz and R. Fisher
- * Converted to C and improved by Fabrice Bellard.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-
-#undef printf
-
-/* ebx saving is necessary for PIC. gcc seems unable to see it alone */
-#define cpuid(index,eax,ebx,ecx,edx)\
-    __asm__ volatile\
-        ("mov %%"REG_b", %%"REG_S"\n\t"\
-         "cpuid\n\t"\
-         "xchg %%"REG_b", %%"REG_S\
-         : "=a" (eax), "=S" (ebx),\
-           "=c" (ecx), "=d" (edx)\
-         : "0" (index));
-
-/* Function to test if multimedia instructions are supported...  */
-int mm_support(void)
-{
-    int rval = 0;
-    int eax, ebx, ecx, edx;
-    int max_std_level, max_ext_level, std_caps=0, ext_caps=0;
-
-#if ARCH_X86_32
-    x86_reg a, c;
-    __asm__ volatile (
-        /* See if CPUID instruction is supported ... */
-        /* ... Get copies of EFLAGS into eax and ecx */
-        "pushfl\n\t"
-        "pop %0\n\t"
-        "mov %0, %1\n\t"
-
-        /* ... Toggle the ID bit in one copy and store */
-        /*     to the EFLAGS reg */
-        "xor $0x200000, %0\n\t"
-        "push %0\n\t"
-        "popfl\n\t"
-
-        /* ... Get the (hopefully modified) EFLAGS */
-        "pushfl\n\t"
-        "pop %0\n\t"
-        : "=a" (a), "=c" (c)
-        :
-        : "cc"
-        );
-
-    if (a == c)
-        return 0; /* CPUID not supported */
-#endif
-
-    cpuid(0, max_std_level, ebx, ecx, edx);
-
-    if(max_std_level >= 1){
-        cpuid(1, eax, ebx, ecx, std_caps);
-        if (std_caps & (1<<23))
-            rval |= FF_MM_MMX;
-        if (std_caps & (1<<25))
-            rval |= FF_MM_MMX2
-#if HAVE_SSE
-                  | FF_MM_SSE;
-        if (std_caps & (1<<26))
-            rval |= FF_MM_SSE2;
-        if (ecx & 1)
-            rval |= FF_MM_SSE3;
-        if (ecx & 0x00000200 )
-            rval |= FF_MM_SSSE3;
-        if (ecx & 0x00080000 )
-            rval |= FF_MM_SSE4;
-        if (ecx & 0x00100000 )
-            rval |= FF_MM_SSE42;
-#endif
-                  ;
-    }
-
-    cpuid(0x80000000, max_ext_level, ebx, ecx, edx);
-
-    if(max_ext_level >= 0x80000001){
-        cpuid(0x80000001, eax, ebx, ecx, ext_caps);
-        if (ext_caps & (1<<31))
-            rval |= FF_MM_3DNOW;
-        if (ext_caps & (1<<30))
-            rval |= FF_MM_3DNOWEXT;
-        if (ext_caps & (1<<23))
-            rval |= FF_MM_MMX;
-        if (ext_caps & (1<<22))
-            rval |= FF_MM_MMX2;
-    }
-
-#if 0
-    av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s%s%s%s%s\n",
-        (rval&FF_MM_MMX) ? "MMX ":"",
-        (rval&FF_MM_MMX2) ? "MMX2 ":"",
-        (rval&FF_MM_SSE) ? "SSE ":"",
-        (rval&FF_MM_SSE2) ? "SSE2 ":"",
-        (rval&FF_MM_SSE3) ? "SSE3 ":"",
-        (rval&FF_MM_SSSE3) ? "SSSE3 ":"",
-        (rval&FF_MM_SSE4) ? "SSE4.1 ":"",
-        (rval&FF_MM_SSE42) ? "SSE4.2 ":"",
-        (rval&FF_MM_3DNOW) ? "3DNow ":"",
-        (rval&FF_MM_3DNOWEXT) ? "3DNowExt ":"");
-#endif
-    return rval;
-}
-
-#ifdef TEST
-int main ( void )
-{
-    int mm_flags;
-    mm_flags = mm_support();
-    printf("mm_support = 0x%08X\n",mm_flags);
-    return 0;
-}
-#endif
diff --git a/libavcodec/x86/dnxhd_mmx.c b/libavcodec/x86/dnxhd_mmx.c
deleted file mode 100644
index 59bcb39..0000000
--- a/libavcodec/x86/dnxhd_mmx.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * VC3/DNxHD SIMD functions
- * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * VC-3 encoder funded by the British Broadcasting Corporation
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dnxhdenc.h"
-
-static void get_pixels_8x4_sym_sse2(DCTELEM *block, const uint8_t *pixels, int line_size)
-{
-    __asm__ volatile(
-        "pxor %%xmm7,      %%xmm7       \n\t"
-        "movq (%0),        %%xmm0       \n\t"
-        "add  %2,          %0           \n\t"
-        "movq (%0),        %%xmm1       \n\t"
-        "movq (%0, %2),    %%xmm2       \n\t"
-        "movq (%0, %2,2),  %%xmm3       \n\t"
-        "punpcklbw %%xmm7, %%xmm0       \n\t"
-        "punpcklbw %%xmm7, %%xmm1       \n\t"
-        "punpcklbw %%xmm7, %%xmm2       \n\t"
-        "punpcklbw %%xmm7, %%xmm3       \n\t"
-        "movdqa %%xmm0,      (%1)       \n\t"
-        "movdqa %%xmm1,    16(%1)       \n\t"
-        "movdqa %%xmm2,    32(%1)       \n\t"
-        "movdqa %%xmm3,    48(%1)       \n\t"
-        "movdqa %%xmm3 ,   64(%1)       \n\t"
-        "movdqa %%xmm2 ,   80(%1)       \n\t"
-        "movdqa %%xmm1 ,   96(%1)       \n\t"
-        "movdqa %%xmm0,   112(%1)       \n\t"
-        : "+r" (pixels)
-        : "r" (block), "r" ((x86_reg)line_size)
-    );
-}
-
-void ff_dnxhd_init_mmx(DNXHDEncContext *ctx)
-{
-    if (mm_flags & FF_MM_SSE2) {
-        ctx->get_pixels_8x4_sym = get_pixels_8x4_sym_sse2;
-    }
-}
diff --git a/libavcodec/x86/dsputil_h264_template_mmx.c b/libavcodec/x86/dsputil_h264_template_mmx.c
deleted file mode 100644
index bc2379e..0000000
--- a/libavcodec/x86/dsputil_h264_template_mmx.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (c) 2005 Zoltan Hidvegi <hzoli -a- hzoli -d- com>,
- *                    Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * MMX optimized version of (put|avg)_h264_chroma_mc8.
- * H264_CHROMA_MC8_TMPL must be defined to the desired function name
- * H264_CHROMA_OP must be defined to empty for put and pavgb/pavgusb for avg
- * H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function
- */
-static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, const uint64_t *rnd_reg)
-{
-    DECLARE_ALIGNED(8, uint64_t, AA);
-    DECLARE_ALIGNED(8, uint64_t, DD);
-    int i;
-
-    if(y==0 && x==0) {
-        /* no filter needed */
-        H264_CHROMA_MC8_MV0(dst, src, stride, h);
-        return;
-    }
-
-    assert(x<8 && y<8 && x>=0 && y>=0);
-
-    if(y==0 || x==0)
-    {
-        /* 1 dimensional filter only */
-        const int dxy = x ? 1 : stride;
-
-        __asm__ volatile(
-            "movd %0, %%mm5\n\t"
-            "movq %1, %%mm4\n\t"
-            "movq %2, %%mm6\n\t"         /* mm6 = rnd >> 3 */
-            "punpcklwd %%mm5, %%mm5\n\t"
-            "punpckldq %%mm5, %%mm5\n\t" /* mm5 = B = x */
-            "pxor %%mm7, %%mm7\n\t"
-            "psubw %%mm5, %%mm4\n\t"     /* mm4 = A = 8-x */
-            :: "rm"(x+y), "m"(ff_pw_8), "m"(*(rnd_reg+1)));
-
-        for(i=0; i<h; i++) {
-            __asm__ volatile(
-                /* mm0 = src[0..7], mm1 = src[1..8] */
-                "movq %0, %%mm0\n\t"
-                "movq %1, %%mm2\n\t"
-                :: "m"(src[0]), "m"(src[dxy]));
-
-            __asm__ volatile(
-                /* [mm0,mm1] = A * src[0..7] */
-                /* [mm2,mm3] = B * src[1..8] */
-                "movq %%mm0, %%mm1\n\t"
-                "movq %%mm2, %%mm3\n\t"
-                "punpcklbw %%mm7, %%mm0\n\t"
-                "punpckhbw %%mm7, %%mm1\n\t"
-                "punpcklbw %%mm7, %%mm2\n\t"
-                "punpckhbw %%mm7, %%mm3\n\t"
-                "pmullw %%mm4, %%mm0\n\t"
-                "pmullw %%mm4, %%mm1\n\t"
-                "pmullw %%mm5, %%mm2\n\t"
-                "pmullw %%mm5, %%mm3\n\t"
-
-                /* dst[0..7] = (A * src[0..7] + B * src[1..8] + (rnd >> 3)) >> 3 */
-                "paddw %%mm6, %%mm0\n\t"
-                "paddw %%mm6, %%mm1\n\t"
-                "paddw %%mm2, %%mm0\n\t"
-                "paddw %%mm3, %%mm1\n\t"
-                "psrlw $3, %%mm0\n\t"
-                "psrlw $3, %%mm1\n\t"
-                "packuswb %%mm1, %%mm0\n\t"
-                H264_CHROMA_OP(%0, %%mm0)
-                "movq %%mm0, %0\n\t"
-                : "=m" (dst[0]));
-
-            src += stride;
-            dst += stride;
-        }
-        return;
-    }
-
-    /* general case, bilinear */
-    __asm__ volatile("movd %2, %%mm4\n\t"
-                 "movd %3, %%mm6\n\t"
-                 "punpcklwd %%mm4, %%mm4\n\t"
-                 "punpcklwd %%mm6, %%mm6\n\t"
-                 "punpckldq %%mm4, %%mm4\n\t" /* mm4 = x words */
-                 "punpckldq %%mm6, %%mm6\n\t" /* mm6 = y words */
-                 "movq %%mm4, %%mm5\n\t"
-                 "pmullw %%mm6, %%mm4\n\t"    /* mm4 = x * y */
-                 "psllw $3, %%mm5\n\t"
-                 "psllw $3, %%mm6\n\t"
-                 "movq %%mm5, %%mm7\n\t"
-                 "paddw %%mm6, %%mm7\n\t"
-                 "movq %%mm4, %1\n\t"         /* DD = x * y */
-                 "psubw %%mm4, %%mm5\n\t"     /* mm5 = B = 8x - xy */
-                 "psubw %%mm4, %%mm6\n\t"     /* mm6 = C = 8y - xy */
-                 "paddw %4, %%mm4\n\t"
-                 "psubw %%mm7, %%mm4\n\t"     /* mm4 = A = xy - (8x+8y) + 64 */
-                 "pxor %%mm7, %%mm7\n\t"
-                 "movq %%mm4, %0\n\t"
-                 : "=m" (AA), "=m" (DD) : "rm" (x), "rm" (y), "m" (ff_pw_64));
-
-    __asm__ volatile(
-        /* mm0 = src[0..7], mm1 = src[1..8] */
-        "movq %0, %%mm0\n\t"
-        "movq %1, %%mm1\n\t"
-        : : "m" (src[0]), "m" (src[1]));
-
-    for(i=0; i<h; i++) {
-        src += stride;
-
-        __asm__ volatile(
-            /* mm2 = A * src[0..3] + B * src[1..4] */
-            /* mm3 = A * src[4..7] + B * src[5..8] */
-            "movq %%mm0, %%mm2\n\t"
-            "movq %%mm1, %%mm3\n\t"
-            "punpckhbw %%mm7, %%mm0\n\t"
-            "punpcklbw %%mm7, %%mm1\n\t"
-            "punpcklbw %%mm7, %%mm2\n\t"
-            "punpckhbw %%mm7, %%mm3\n\t"
-            "pmullw %0, %%mm0\n\t"
-            "pmullw %0, %%mm2\n\t"
-            "pmullw %%mm5, %%mm1\n\t"
-            "pmullw %%mm5, %%mm3\n\t"
-            "paddw %%mm1, %%mm2\n\t"
-            "paddw %%mm0, %%mm3\n\t"
-            : : "m" (AA));
-
-        __asm__ volatile(
-            /* [mm2,mm3] += C * src[0..7] */
-            "movq %0, %%mm0\n\t"
-            "movq %%mm0, %%mm1\n\t"
-            "punpcklbw %%mm7, %%mm0\n\t"
-            "punpckhbw %%mm7, %%mm1\n\t"
-            "pmullw %%mm6, %%mm0\n\t"
-            "pmullw %%mm6, %%mm1\n\t"
-            "paddw %%mm0, %%mm2\n\t"
-            "paddw %%mm1, %%mm3\n\t"
-            : : "m" (src[0]));
-
-        __asm__ volatile(
-            /* [mm2,mm3] += D * src[1..8] */
-            "movq %1, %%mm1\n\t"
-            "movq %%mm1, %%mm0\n\t"
-            "movq %%mm1, %%mm4\n\t"
-            "punpcklbw %%mm7, %%mm0\n\t"
-            "punpckhbw %%mm7, %%mm4\n\t"
-            "pmullw %2, %%mm0\n\t"
-            "pmullw %2, %%mm4\n\t"
-            "paddw %%mm0, %%mm2\n\t"
-            "paddw %%mm4, %%mm3\n\t"
-            "movq %0, %%mm0\n\t"
-            : : "m" (src[0]), "m" (src[1]), "m" (DD));
-
-        __asm__ volatile(
-            /* dst[0..7] = ([mm2,mm3] + rnd) >> 6 */
-            "paddw %1, %%mm2\n\t"
-            "paddw %1, %%mm3\n\t"
-            "psrlw $6, %%mm2\n\t"
-            "psrlw $6, %%mm3\n\t"
-            "packuswb %%mm3, %%mm2\n\t"
-            H264_CHROMA_OP(%0, %%mm2)
-            "movq %%mm2, %0\n\t"
-            : "=m" (dst[0]) : "m" (*rnd_reg));
-        dst+= stride;
-    }
-}
-
-static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, const uint64_t *rnd_reg)
-{
-    __asm__ volatile(
-        "pxor   %%mm7, %%mm7        \n\t"
-        "movd %5, %%mm2             \n\t"
-        "movd %6, %%mm3             \n\t"
-        "movq "MANGLE(ff_pw_8)", %%mm4\n\t"
-        "movq "MANGLE(ff_pw_8)", %%mm5\n\t"
-        "punpcklwd %%mm2, %%mm2     \n\t"
-        "punpcklwd %%mm3, %%mm3     \n\t"
-        "punpcklwd %%mm2, %%mm2     \n\t"
-        "punpcklwd %%mm3, %%mm3     \n\t"
-        "psubw %%mm2, %%mm4         \n\t"
-        "psubw %%mm3, %%mm5         \n\t"
-
-        "movd  (%1), %%mm0          \n\t"
-        "movd 1(%1), %%mm6          \n\t"
-        "add %3, %1                 \n\t"
-        "punpcklbw %%mm7, %%mm0     \n\t"
-        "punpcklbw %%mm7, %%mm6     \n\t"
-        "pmullw %%mm4, %%mm0        \n\t"
-        "pmullw %%mm2, %%mm6        \n\t"
-        "paddw %%mm0, %%mm6         \n\t"
-
-        "1:                         \n\t"
-        "movd  (%1), %%mm0          \n\t"
-        "movd 1(%1), %%mm1          \n\t"
-        "add %3, %1                 \n\t"
-        "punpcklbw %%mm7, %%mm0     \n\t"
-        "punpcklbw %%mm7, %%mm1     \n\t"
-        "pmullw %%mm4, %%mm0        \n\t"
-        "pmullw %%mm2, %%mm1        \n\t"
-        "paddw %%mm0, %%mm1         \n\t"
-        "movq %%mm1, %%mm0          \n\t"
-        "pmullw %%mm5, %%mm6        \n\t"
-        "pmullw %%mm3, %%mm1        \n\t"
-        "paddw %4, %%mm6            \n\t"
-        "paddw %%mm6, %%mm1         \n\t"
-        "psrlw $6, %%mm1            \n\t"
-        "packuswb %%mm1, %%mm1      \n\t"
-        H264_CHROMA_OP4((%0), %%mm1, %%mm6)
-        "movd %%mm1, (%0)           \n\t"
-        "add %3, %0                 \n\t"
-        "movd  (%1), %%mm6          \n\t"
-        "movd 1(%1), %%mm1          \n\t"
-        "add %3, %1                 \n\t"
-        "punpcklbw %%mm7, %%mm6     \n\t"
-        "punpcklbw %%mm7, %%mm1     \n\t"
-        "pmullw %%mm4, %%mm6        \n\t"
-        "pmullw %%mm2, %%mm1        \n\t"
-        "paddw %%mm6, %%mm1         \n\t"
-        "movq %%mm1, %%mm6          \n\t"
-        "pmullw %%mm5, %%mm0        \n\t"
-        "pmullw %%mm3, %%mm1        \n\t"
-        "paddw %4, %%mm0            \n\t"
-        "paddw %%mm0, %%mm1         \n\t"
-        "psrlw $6, %%mm1            \n\t"
-        "packuswb %%mm1, %%mm1      \n\t"
-        H264_CHROMA_OP4((%0), %%mm1, %%mm0)
-        "movd %%mm1, (%0)           \n\t"
-        "add %3, %0                 \n\t"
-        "sub $2, %2                 \n\t"
-        "jnz 1b                     \n\t"
-        : "+r"(dst), "+r"(src), "+r"(h)
-        : "r"((x86_reg)stride), "m"(*rnd_reg), "m"(x), "m"(y)
-    );
-}
-
-#ifdef H264_CHROMA_MC2_TMPL
-static void H264_CHROMA_MC2_TMPL(uint8_t *dst/*align 2*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    int tmp = ((1<<16)-1)*x + 8;
-    int CD= tmp*y;
-    int AB= (tmp<<3) - CD;
-    __asm__ volatile(
-        /* mm5 = {A,B,A,B} */
-        /* mm6 = {C,D,C,D} */
-        "movd %0, %%mm5\n\t"
-        "movd %1, %%mm6\n\t"
-        "punpckldq %%mm5, %%mm5\n\t"
-        "punpckldq %%mm6, %%mm6\n\t"
-        "pxor %%mm7, %%mm7\n\t"
-        /* mm0 = src[0,1,1,2] */
-        "movd %2, %%mm2\n\t"
-        "punpcklbw %%mm7, %%mm2\n\t"
-        "pshufw $0x94, %%mm2, %%mm2\n\t"
-        :: "r"(AB), "r"(CD), "m"(src[0]));
-
-
-    __asm__ volatile(
-        "1:\n\t"
-        "add %4, %1\n\t"
-        /* mm1 = A * src[0,1] + B * src[1,2] */
-        "movq    %%mm2, %%mm1\n\t"
-        "pmaddwd %%mm5, %%mm1\n\t"
-        /* mm0 = src[0,1,1,2] */
-        "movd (%1), %%mm0\n\t"
-        "punpcklbw %%mm7, %%mm0\n\t"
-        "pshufw $0x94, %%mm0, %%mm0\n\t"
-        /* mm1 += C * src[0,1] + D * src[1,2] */
-        "movq    %%mm0, %%mm2\n\t"
-        "pmaddwd %%mm6, %%mm0\n\t"
-        "paddw      %3, %%mm1\n\t"
-        "paddw   %%mm0, %%mm1\n\t"
-        /* dst[0,1] = pack((mm1 + 32) >> 6) */
-        "psrlw $6, %%mm1\n\t"
-        "packssdw %%mm7, %%mm1\n\t"
-        "packuswb %%mm7, %%mm1\n\t"
-        H264_CHROMA_OP4((%0), %%mm1, %%mm3)
-        "movd %%mm1, %%esi\n\t"
-        "movw %%si, (%0)\n\t"
-        "add %4, %0\n\t"
-        "sub $1, %2\n\t"
-        "jnz 1b\n\t"
-        : "+r" (dst), "+r"(src), "+r"(h)
-        : "m" (ff_pw_32), "r"((x86_reg)stride)
-        : "%esi");
-
-}
-#endif
-
diff --git a/libavcodec/x86/dsputil_h264_template_ssse3.c b/libavcodec/x86/dsputil_h264_template_ssse3.c
deleted file mode 100644
index e29e05e..0000000
--- a/libavcodec/x86/dsputil_h264_template_ssse3.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2008 Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SSSE3 optimized version of (put|avg)_h264_chroma_mc8.
- * H264_CHROMA_MC8_TMPL must be defined to the desired function name
- * H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function
- * AVG_OP must be defined to empty for put and the identify for avg
- */
-static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, int rnd)
-{
-    if(y==0 && x==0) {
-        /* no filter needed */
-        H264_CHROMA_MC8_MV0(dst, src, stride, h);
-        return;
-    }
-
-    assert(x<8 && y<8 && x>=0 && y>=0);
-
-    if(y==0 || x==0)
-    {
-        /* 1 dimensional filter only */
-        __asm__ volatile(
-            "movd %0, %%xmm7 \n\t"
-            "movq %1, %%xmm6 \n\t"
-            "pshuflw $0, %%xmm7, %%xmm7 \n\t"
-            "movlhps %%xmm6, %%xmm6 \n\t"
-            "movlhps %%xmm7, %%xmm7 \n\t"
-            :: "r"(255*(x+y)+8), "m"(*(rnd?&ff_pw_4:&ff_pw_3))
-        );
-
-        if(x) {
-            __asm__ volatile(
-                "1: \n\t"
-                "movq (%1), %%xmm0 \n\t"
-                "movq 1(%1), %%xmm1 \n\t"
-                "movq (%1,%3), %%xmm2 \n\t"
-                "movq 1(%1,%3), %%xmm3 \n\t"
-                "punpcklbw %%xmm1, %%xmm0 \n\t"
-                "punpcklbw %%xmm3, %%xmm2 \n\t"
-                "pmaddubsw %%xmm7, %%xmm0 \n\t"
-                "pmaddubsw %%xmm7, %%xmm2 \n\t"
-         AVG_OP("movq (%0), %%xmm4 \n\t")
-         AVG_OP("movhps (%0,%3), %%xmm4 \n\t")
-                "paddw %%xmm6, %%xmm0 \n\t"
-                "paddw %%xmm6, %%xmm2 \n\t"
-                "psrlw $3, %%xmm0 \n\t"
-                "psrlw $3, %%xmm2 \n\t"
-                "packuswb %%xmm2, %%xmm0 \n\t"
-         AVG_OP("pavgb %%xmm4, %%xmm0 \n\t")
-                "movq %%xmm0, (%0) \n\t"
-                "movhps %%xmm0, (%0,%3) \n\t"
-                "sub $2, %2 \n\t"
-                "lea (%1,%3,2), %1 \n\t"
-                "lea (%0,%3,2), %0 \n\t"
-                "jg 1b \n\t"
-                :"+r"(dst), "+r"(src), "+r"(h)
-                :"r"((x86_reg)stride)
-            );
-        } else {
-            __asm__ volatile(
-                "1: \n\t"
-                "movq (%1), %%xmm0 \n\t"
-                "movq (%1,%3), %%xmm1 \n\t"
-                "movdqa %%xmm1, %%xmm2 \n\t"
-                "movq (%1,%3,2), %%xmm3 \n\t"
-                "punpcklbw %%xmm1, %%xmm0 \n\t"
-                "punpcklbw %%xmm3, %%xmm2 \n\t"
-                "pmaddubsw %%xmm7, %%xmm0 \n\t"
-                "pmaddubsw %%xmm7, %%xmm2 \n\t"
-         AVG_OP("movq (%0), %%xmm4 \n\t")
-         AVG_OP("movhps (%0,%3), %%xmm4 \n\t")
-                "paddw %%xmm6, %%xmm0 \n\t"
-                "paddw %%xmm6, %%xmm2 \n\t"
-                "psrlw $3, %%xmm0 \n\t"
-                "psrlw $3, %%xmm2 \n\t"
-                "packuswb %%xmm2, %%xmm0 \n\t"
-         AVG_OP("pavgb %%xmm4, %%xmm0 \n\t")
-                "movq %%xmm0, (%0) \n\t"
-                "movhps %%xmm0, (%0,%3) \n\t"
-                "sub $2, %2 \n\t"
-                "lea (%1,%3,2), %1 \n\t"
-                "lea (%0,%3,2), %0 \n\t"
-                "jg 1b \n\t"
-                :"+r"(dst), "+r"(src), "+r"(h)
-                :"r"((x86_reg)stride)
-            );
-        }
-        return;
-    }
-
-    /* general case, bilinear */
-    __asm__ volatile(
-        "movd %0, %%xmm7 \n\t"
-        "movd %1, %%xmm6 \n\t"
-        "movdqa %2, %%xmm5 \n\t"
-        "pshuflw $0, %%xmm7, %%xmm7 \n\t"
-        "pshuflw $0, %%xmm6, %%xmm6 \n\t"
-        "movlhps %%xmm7, %%xmm7 \n\t"
-        "movlhps %%xmm6, %%xmm6 \n\t"
-        :: "r"((x*255+8)*(8-y)), "r"((x*255+8)*y), "m"(*(rnd?&ff_pw_32:&ff_pw_28))
-    );
-
-    __asm__ volatile(
-        "movq (%1), %%xmm0 \n\t"
-        "movq 1(%1), %%xmm1 \n\t"
-        "punpcklbw %%xmm1, %%xmm0 \n\t"
-        "add %3, %1 \n\t"
-        "1: \n\t"
-        "movq (%1), %%xmm1 \n\t"
-        "movq 1(%1), %%xmm2 \n\t"
-        "movq (%1,%3), %%xmm3 \n\t"
-        "movq 1(%1,%3), %%xmm4 \n\t"
-        "lea (%1,%3,2), %1 \n\t"
-        "punpcklbw %%xmm2, %%xmm1 \n\t"
-        "punpcklbw %%xmm4, %%xmm3 \n\t"
-        "movdqa %%xmm1, %%xmm2 \n\t"
-        "movdqa %%xmm3, %%xmm4 \n\t"
-        "pmaddubsw %%xmm7, %%xmm0 \n\t"
-        "pmaddubsw %%xmm6, %%xmm1 \n\t"
-        "pmaddubsw %%xmm7, %%xmm2 \n\t"
-        "pmaddubsw %%xmm6, %%xmm3 \n\t"
-        "paddw %%xmm5, %%xmm0 \n\t"
-        "paddw %%xmm5, %%xmm2 \n\t"
-        "paddw %%xmm0, %%xmm1 \n\t"
-        "paddw %%xmm2, %%xmm3 \n\t"
-        "movdqa %%xmm4, %%xmm0 \n\t"
-        "psrlw $6, %%xmm1 \n\t"
-        "psrlw $6, %%xmm3 \n\t"
- AVG_OP("movq (%0), %%xmm2 \n\t")
- AVG_OP("movhps (%0,%3), %%xmm2 \n\t")
-        "packuswb %%xmm3, %%xmm1 \n\t"
- AVG_OP("pavgb %%xmm2, %%xmm1 \n\t")
-        "movq %%xmm1, (%0)\n\t"
-        "movhps %%xmm1, (%0,%3)\n\t"
-        "sub $2, %2 \n\t"
-        "lea (%0,%3,2), %0 \n\t"
-        "jg 1b \n\t"
-        :"+r"(dst), "+r"(src), "+r"(h)
-        :"r"((x86_reg)stride)
-    );
-}
-
-static void H264_CHROMA_MC4_TMPL(uint8_t *dst/*align 4*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    __asm__ volatile(
-        "movd %0, %%mm7 \n\t"
-        "movd %1, %%mm6 \n\t"
-        "movq %2, %%mm5 \n\t"
-        "pshufw $0, %%mm7, %%mm7 \n\t"
-        "pshufw $0, %%mm6, %%mm6 \n\t"
-        :: "r"((x*255+8)*(8-y)), "r"((x*255+8)*y), "m"(ff_pw_32)
-    );
-
-    __asm__ volatile(
-        "movd (%1), %%mm0 \n\t"
-        "punpcklbw 1(%1), %%mm0 \n\t"
-        "add %3, %1 \n\t"
-        "1: \n\t"
-        "movd (%1), %%mm1 \n\t"
-        "movd (%1,%3), %%mm3 \n\t"
-        "punpcklbw 1(%1), %%mm1 \n\t"
-        "punpcklbw 1(%1,%3), %%mm3 \n\t"
-        "lea (%1,%3,2), %1 \n\t"
-        "movq %%mm1, %%mm2 \n\t"
-        "movq %%mm3, %%mm4 \n\t"
-        "pmaddubsw %%mm7, %%mm0 \n\t"
-        "pmaddubsw %%mm6, %%mm1 \n\t"
-        "pmaddubsw %%mm7, %%mm2 \n\t"
-        "pmaddubsw %%mm6, %%mm3 \n\t"
-        "paddw %%mm5, %%mm0 \n\t"
-        "paddw %%mm5, %%mm2 \n\t"
-        "paddw %%mm0, %%mm1 \n\t"
-        "paddw %%mm2, %%mm3 \n\t"
-        "movq %%mm4, %%mm0 \n\t"
-        "psrlw $6, %%mm1 \n\t"
-        "psrlw $6, %%mm3 \n\t"
-        "packuswb %%mm1, %%mm1 \n\t"
-        "packuswb %%mm3, %%mm3 \n\t"
- AVG_OP("pavgb (%0), %%mm1 \n\t")
- AVG_OP("pavgb (%0,%3), %%mm3 \n\t")
-        "movd %%mm1, (%0)\n\t"
-        "movd %%mm3, (%0,%3)\n\t"
-        "sub $2, %2 \n\t"
-        "lea (%0,%3,2), %0 \n\t"
-        "jg 1b \n\t"
-        :"+r"(dst), "+r"(src), "+r"(h)
-        :"r"((x86_reg)stride)
-    );
-}
-
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
deleted file mode 100644
index cc2f881..0000000
--- a/libavcodec/x86/dsputil_mmx.c
+++ /dev/null
@@ -1,3002 +0,0 @@
-/*
- * MMX optimized DSP utils
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * MMX optimization by Nick Kurshev <nickols_k at mail.ru>
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/h264dsp.h"
-#include "libavcodec/mpegvideo.h"
-#include "libavcodec/simple_idct.h"
-#include "dsputil_mmx.h"
-#include "vp3dsp_mmx.h"
-#include "vp3dsp_sse2.h"
-#include "vp6dsp_mmx.h"
-#include "vp6dsp_sse2.h"
-#include "idct_xvid.h"
-
-//#undef NDEBUG
-//#include <assert.h>
-
-int mm_flags; /* multimedia extension flags */
-
-/* pixel operations */
-DECLARE_ALIGNED(8,  const uint64_t, ff_bone) = 0x0101010101010101ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_wtwo) = 0x0002000200020002ULL;
-
-DECLARE_ALIGNED(16, const uint64_t, ff_pdw_80000000)[2] =
-{0x8000000080000000ULL, 0x8000000080000000ULL};
-
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_3  ) = 0x0003000300030003ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_4  ) = 0x0004000400040004ULL;
-DECLARE_ALIGNED(16, const xmm_reg,  ff_pw_5  ) = {0x0005000500050005ULL, 0x0005000500050005ULL};
-DECLARE_ALIGNED(16, const xmm_reg,  ff_pw_8  ) = {0x0008000800080008ULL, 0x0008000800080008ULL};
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_15 ) = 0x000F000F000F000FULL;
-DECLARE_ALIGNED(16, const xmm_reg,  ff_pw_16 ) = {0x0010001000100010ULL, 0x0010001000100010ULL};
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_20 ) = 0x0014001400140014ULL;
-DECLARE_ALIGNED(16, const xmm_reg,  ff_pw_28 ) = {0x001C001C001C001CULL, 0x001C001C001C001CULL};
-DECLARE_ALIGNED(16, const xmm_reg,  ff_pw_32 ) = {0x0020002000200020ULL, 0x0020002000200020ULL};
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_42 ) = 0x002A002A002A002AULL;
-DECLARE_ALIGNED(16, const xmm_reg,  ff_pw_64 ) = {0x0040004000400040ULL, 0x0040004000400040ULL};
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_96 ) = 0x0060006000600060ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_128) = 0x0080008000800080ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pw_255) = 0x00ff00ff00ff00ffULL;
-
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_1  ) = 0x0101010101010101ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_3  ) = 0x0303030303030303ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_7  ) = 0x0707070707070707ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_1F ) = 0x1F1F1F1F1F1F1F1FULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_3F ) = 0x3F3F3F3F3F3F3F3FULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_81 ) = 0x8181818181818181ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_A1 ) = 0xA1A1A1A1A1A1A1A1ULL;
-DECLARE_ALIGNED(8,  const uint64_t, ff_pb_FC ) = 0xFCFCFCFCFCFCFCFCULL;
-
-DECLARE_ALIGNED(16, const double, ff_pd_1)[2] = { 1.0, 1.0 };
-DECLARE_ALIGNED(16, const double, ff_pd_2)[2] = { 2.0, 2.0 };
-
-#define JUMPALIGN() __asm__ volatile (ASMALIGN(3)::)
-#define MOVQ_ZERO(regd)  __asm__ volatile ("pxor %%" #regd ", %%" #regd ::)
-
-#define MOVQ_BFE(regd) \
-    __asm__ volatile ( \
-    "pcmpeqd %%" #regd ", %%" #regd " \n\t"\
-    "paddb %%" #regd ", %%" #regd " \n\t" ::)
-
-#ifndef PIC
-#define MOVQ_BONE(regd)  __asm__ volatile ("movq %0, %%" #regd " \n\t" ::"m"(ff_bone))
-#define MOVQ_WTWO(regd)  __asm__ volatile ("movq %0, %%" #regd " \n\t" ::"m"(ff_wtwo))
-#else
-// for shared library it's better to use this way for accessing constants
-// pcmpeqd -> -1
-#define MOVQ_BONE(regd) \
-    __asm__ volatile ( \
-    "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
-    "psrlw $15, %%" #regd " \n\t" \
-    "packuswb %%" #regd ", %%" #regd " \n\t" ::)
-
-#define MOVQ_WTWO(regd) \
-    __asm__ volatile ( \
-    "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
-    "psrlw $15, %%" #regd " \n\t" \
-    "psllw $1, %%" #regd " \n\t"::)
-
-#endif
-
-// using regr as temporary and for the output result
-// first argument is unmodifed and second is trashed
-// regfe is supposed to contain 0xfefefefefefefefe
-#define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \
-    "movq " #rega ", " #regr "  \n\t"\
-    "pand " #regb ", " #regr "  \n\t"\
-    "pxor " #rega ", " #regb "  \n\t"\
-    "pand " #regfe "," #regb "  \n\t"\
-    "psrlq $1, " #regb "        \n\t"\
-    "paddb " #regb ", " #regr " \n\t"
-
-#define PAVGB_MMX(rega, regb, regr, regfe) \
-    "movq " #rega ", " #regr "  \n\t"\
-    "por  " #regb ", " #regr "  \n\t"\
-    "pxor " #rega ", " #regb "  \n\t"\
-    "pand " #regfe "," #regb "  \n\t"\
-    "psrlq $1, " #regb "        \n\t"\
-    "psubb " #regb ", " #regr " \n\t"
-
-// mm6 is supposed to contain 0xfefefefefefefefe
-#define PAVGBP_MMX_NO_RND(rega, regb, regr,  regc, regd, regp) \
-    "movq " #rega ", " #regr "  \n\t"\
-    "movq " #regc ", " #regp "  \n\t"\
-    "pand " #regb ", " #regr "  \n\t"\
-    "pand " #regd ", " #regp "  \n\t"\
-    "pxor " #rega ", " #regb "  \n\t"\
-    "pxor " #regc ", " #regd "  \n\t"\
-    "pand %%mm6, " #regb "      \n\t"\
-    "pand %%mm6, " #regd "      \n\t"\
-    "psrlq $1, " #regb "        \n\t"\
-    "psrlq $1, " #regd "        \n\t"\
-    "paddb " #regb ", " #regr " \n\t"\
-    "paddb " #regd ", " #regp " \n\t"
-
-#define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \
-    "movq " #rega ", " #regr "  \n\t"\
-    "movq " #regc ", " #regp "  \n\t"\
-    "por  " #regb ", " #regr "  \n\t"\
-    "por  " #regd ", " #regp "  \n\t"\
-    "pxor " #rega ", " #regb "  \n\t"\
-    "pxor " #regc ", " #regd "  \n\t"\
-    "pand %%mm6, " #regb "      \n\t"\
-    "pand %%mm6, " #regd "      \n\t"\
-    "psrlq $1, " #regd "        \n\t"\
-    "psrlq $1, " #regb "        \n\t"\
-    "psubb " #regb ", " #regr " \n\t"\
-    "psubb " #regd ", " #regp " \n\t"
-
-/***********************************/
-/* MMX no rounding */
-#define DEF(x, y) x ## _no_rnd_ ## y ##_mmx
-#define SET_RND  MOVQ_WONE
-#define PAVGBP(a, b, c, d, e, f)        PAVGBP_MMX_NO_RND(a, b, c, d, e, f)
-#define PAVGB(a, b, c, e)               PAVGB_MMX_NO_RND(a, b, c, e)
-#define OP_AVG(a, b, c, e)              PAVGB_MMX(a, b, c, e)
-
-#include "dsputil_mmx_rnd_template.c"
-
-#undef DEF
-#undef SET_RND
-#undef PAVGBP
-#undef PAVGB
-/***********************************/
-/* MMX rounding */
-
-#define DEF(x, y) x ## _ ## y ##_mmx
-#define SET_RND  MOVQ_WTWO
-#define PAVGBP(a, b, c, d, e, f)        PAVGBP_MMX(a, b, c, d, e, f)
-#define PAVGB(a, b, c, e)               PAVGB_MMX(a, b, c, e)
-
-#include "dsputil_mmx_rnd_template.c"
-
-#undef DEF
-#undef SET_RND
-#undef PAVGBP
-#undef PAVGB
-#undef OP_AVG
-
-/***********************************/
-/* 3Dnow specific */
-
-#define DEF(x) x ## _3dnow
-#define PAVGB "pavgusb"
-#define OP_AVG PAVGB
-
-#include "dsputil_mmx_avg_template.c"
-
-#undef DEF
-#undef PAVGB
-#undef OP_AVG
-
-/***********************************/
-/* MMX2 specific */
-
-#define DEF(x) x ## _mmx2
-
-/* Introduced only in MMX2 set */
-#define PAVGB "pavgb"
-#define OP_AVG PAVGB
-
-#include "dsputil_mmx_avg_template.c"
-
-#undef DEF
-#undef PAVGB
-#undef OP_AVG
-
-#define put_no_rnd_pixels16_mmx put_pixels16_mmx
-#define put_no_rnd_pixels8_mmx put_pixels8_mmx
-#define put_pixels16_mmx2 put_pixels16_mmx
-#define put_pixels8_mmx2 put_pixels8_mmx
-#define put_pixels4_mmx2 put_pixels4_mmx
-#define put_no_rnd_pixels16_mmx2 put_no_rnd_pixels16_mmx
-#define put_no_rnd_pixels8_mmx2 put_no_rnd_pixels8_mmx
-#define put_pixels16_3dnow put_pixels16_mmx
-#define put_pixels8_3dnow put_pixels8_mmx
-#define put_pixels4_3dnow put_pixels4_mmx
-#define put_no_rnd_pixels16_3dnow put_no_rnd_pixels16_mmx
-#define put_no_rnd_pixels8_3dnow put_no_rnd_pixels8_mmx
-
-/***********************************/
-/* standard MMX */
-
-void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
-{
-    const DCTELEM *p;
-    uint8_t *pix;
-
-    /* read the pixels */
-    p = block;
-    pix = pixels;
-    /* unrolled loop */
-        __asm__ volatile(
-                "movq   %3, %%mm0               \n\t"
-                "movq   8%3, %%mm1              \n\t"
-                "movq   16%3, %%mm2             \n\t"
-                "movq   24%3, %%mm3             \n\t"
-                "movq   32%3, %%mm4             \n\t"
-                "movq   40%3, %%mm5             \n\t"
-                "movq   48%3, %%mm6             \n\t"
-                "movq   56%3, %%mm7             \n\t"
-                "packuswb %%mm1, %%mm0          \n\t"
-                "packuswb %%mm3, %%mm2          \n\t"
-                "packuswb %%mm5, %%mm4          \n\t"
-                "packuswb %%mm7, %%mm6          \n\t"
-                "movq   %%mm0, (%0)             \n\t"
-                "movq   %%mm2, (%0, %1)         \n\t"
-                "movq   %%mm4, (%0, %1, 2)      \n\t"
-                "movq   %%mm6, (%0, %2)         \n\t"
-                ::"r" (pix), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*3), "m"(*p)
-                :"memory");
-        pix += line_size*4;
-        p += 32;
-
-    // if here would be an exact copy of the code above
-    // compiler would generate some very strange code
-    // thus using "r"
-    __asm__ volatile(
-            "movq       (%3), %%mm0             \n\t"
-            "movq       8(%3), %%mm1            \n\t"
-            "movq       16(%3), %%mm2           \n\t"
-            "movq       24(%3), %%mm3           \n\t"
-            "movq       32(%3), %%mm4           \n\t"
-            "movq       40(%3), %%mm5           \n\t"
-            "movq       48(%3), %%mm6           \n\t"
-            "movq       56(%3), %%mm7           \n\t"
-            "packuswb %%mm1, %%mm0              \n\t"
-            "packuswb %%mm3, %%mm2              \n\t"
-            "packuswb %%mm5, %%mm4              \n\t"
-            "packuswb %%mm7, %%mm6              \n\t"
-            "movq       %%mm0, (%0)             \n\t"
-            "movq       %%mm2, (%0, %1)         \n\t"
-            "movq       %%mm4, (%0, %1, 2)      \n\t"
-            "movq       %%mm6, (%0, %2)         \n\t"
-            ::"r" (pix), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*3), "r"(p)
-            :"memory");
-}
-
-DECLARE_ASM_CONST(8, uint8_t, ff_vector128)[8] =
-  { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 };
-
-#define put_signed_pixels_clamped_mmx_half(off) \
-            "movq    "#off"(%2), %%mm1          \n\t"\
-            "movq 16+"#off"(%2), %%mm2          \n\t"\
-            "movq 32+"#off"(%2), %%mm3          \n\t"\
-            "movq 48+"#off"(%2), %%mm4          \n\t"\
-            "packsswb  8+"#off"(%2), %%mm1      \n\t"\
-            "packsswb 24+"#off"(%2), %%mm2      \n\t"\
-            "packsswb 40+"#off"(%2), %%mm3      \n\t"\
-            "packsswb 56+"#off"(%2), %%mm4      \n\t"\
-            "paddb %%mm0, %%mm1                 \n\t"\
-            "paddb %%mm0, %%mm2                 \n\t"\
-            "paddb %%mm0, %%mm3                 \n\t"\
-            "paddb %%mm0, %%mm4                 \n\t"\
-            "movq %%mm1, (%0)                   \n\t"\
-            "movq %%mm2, (%0, %3)               \n\t"\
-            "movq %%mm3, (%0, %3, 2)            \n\t"\
-            "movq %%mm4, (%0, %1)               \n\t"
-
-void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
-{
-    x86_reg line_skip = line_size;
-    x86_reg line_skip3;
-
-    __asm__ volatile (
-            "movq "MANGLE(ff_vector128)", %%mm0 \n\t"
-            "lea (%3, %3, 2), %1                \n\t"
-            put_signed_pixels_clamped_mmx_half(0)
-            "lea (%0, %3, 4), %0                \n\t"
-            put_signed_pixels_clamped_mmx_half(64)
-            :"+&r" (pixels), "=&r" (line_skip3)
-            :"r" (block), "r"(line_skip)
-            :"memory");
-}
-
-void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size)
-{
-    const DCTELEM *p;
-    uint8_t *pix;
-    int i;
-
-    /* read the pixels */
-    p = block;
-    pix = pixels;
-    MOVQ_ZERO(mm7);
-    i = 4;
-    do {
-        __asm__ volatile(
-                "movq   (%2), %%mm0     \n\t"
-                "movq   8(%2), %%mm1    \n\t"
-                "movq   16(%2), %%mm2   \n\t"
-                "movq   24(%2), %%mm3   \n\t"
-                "movq   %0, %%mm4       \n\t"
-                "movq   %1, %%mm6       \n\t"
-                "movq   %%mm4, %%mm5    \n\t"
-                "punpcklbw %%mm7, %%mm4 \n\t"
-                "punpckhbw %%mm7, %%mm5 \n\t"
-                "paddsw %%mm4, %%mm0    \n\t"
-                "paddsw %%mm5, %%mm1    \n\t"
-                "movq   %%mm6, %%mm5    \n\t"
-                "punpcklbw %%mm7, %%mm6 \n\t"
-                "punpckhbw %%mm7, %%mm5 \n\t"
-                "paddsw %%mm6, %%mm2    \n\t"
-                "paddsw %%mm5, %%mm3    \n\t"
-                "packuswb %%mm1, %%mm0  \n\t"
-                "packuswb %%mm3, %%mm2  \n\t"
-                "movq   %%mm0, %0       \n\t"
-                "movq   %%mm2, %1       \n\t"
-                :"+m"(*pix), "+m"(*(pix+line_size))
-                :"r"(p)
-                :"memory");
-        pix += line_size*2;
-        p += 16;
-    } while (--i);
-}
-
-static void put_pixels4_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-         "lea (%3, %3), %%"REG_a"       \n\t"
-         ASMALIGN(3)
-         "1:                            \n\t"
-         "movd (%1), %%mm0              \n\t"
-         "movd (%1, %3), %%mm1          \n\t"
-         "movd %%mm0, (%2)              \n\t"
-         "movd %%mm1, (%2, %3)          \n\t"
-         "add %%"REG_a", %1             \n\t"
-         "add %%"REG_a", %2             \n\t"
-         "movd (%1), %%mm0              \n\t"
-         "movd (%1, %3), %%mm1          \n\t"
-         "movd %%mm0, (%2)              \n\t"
-         "movd %%mm1, (%2, %3)          \n\t"
-         "add %%"REG_a", %1             \n\t"
-         "add %%"REG_a", %2             \n\t"
-         "subl $4, %0                   \n\t"
-         "jnz 1b                        \n\t"
-         : "+g"(h), "+r" (pixels),  "+r" (block)
-         : "r"((x86_reg)line_size)
-         : "%"REG_a, "memory"
-        );
-}
-
-static void put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-         "lea (%3, %3), %%"REG_a"       \n\t"
-         ASMALIGN(3)
-         "1:                            \n\t"
-         "movq (%1), %%mm0              \n\t"
-         "movq (%1, %3), %%mm1          \n\t"
-         "movq %%mm0, (%2)              \n\t"
-         "movq %%mm1, (%2, %3)          \n\t"
-         "add %%"REG_a", %1             \n\t"
-         "add %%"REG_a", %2             \n\t"
-         "movq (%1), %%mm0              \n\t"
-         "movq (%1, %3), %%mm1          \n\t"
-         "movq %%mm0, (%2)              \n\t"
-         "movq %%mm1, (%2, %3)          \n\t"
-         "add %%"REG_a", %1             \n\t"
-         "add %%"REG_a", %2             \n\t"
-         "subl $4, %0                   \n\t"
-         "jnz 1b                        \n\t"
-         : "+g"(h), "+r" (pixels),  "+r" (block)
-         : "r"((x86_reg)line_size)
-         : "%"REG_a, "memory"
-        );
-}
-
-static void put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-         "lea (%3, %3), %%"REG_a"       \n\t"
-         ASMALIGN(3)
-         "1:                            \n\t"
-         "movq (%1), %%mm0              \n\t"
-         "movq 8(%1), %%mm4             \n\t"
-         "movq (%1, %3), %%mm1          \n\t"
-         "movq 8(%1, %3), %%mm5         \n\t"
-         "movq %%mm0, (%2)              \n\t"
-         "movq %%mm4, 8(%2)             \n\t"
-         "movq %%mm1, (%2, %3)          \n\t"
-         "movq %%mm5, 8(%2, %3)         \n\t"
-         "add %%"REG_a", %1             \n\t"
-         "add %%"REG_a", %2             \n\t"
-         "movq (%1), %%mm0              \n\t"
-         "movq 8(%1), %%mm4             \n\t"
-         "movq (%1, %3), %%mm1          \n\t"
-         "movq 8(%1, %3), %%mm5         \n\t"
-         "movq %%mm0, (%2)              \n\t"
-         "movq %%mm4, 8(%2)             \n\t"
-         "movq %%mm1, (%2, %3)          \n\t"
-         "movq %%mm5, 8(%2, %3)         \n\t"
-         "add %%"REG_a", %1             \n\t"
-         "add %%"REG_a", %2             \n\t"
-         "subl $4, %0                   \n\t"
-         "jnz 1b                        \n\t"
-         : "+g"(h), "+r" (pixels),  "+r" (block)
-         : "r"((x86_reg)line_size)
-         : "%"REG_a, "memory"
-        );
-}
-
-static void put_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-         "1:                            \n\t"
-         "movdqu (%1), %%xmm0           \n\t"
-         "movdqu (%1,%3), %%xmm1        \n\t"
-         "movdqu (%1,%3,2), %%xmm2      \n\t"
-         "movdqu (%1,%4), %%xmm3        \n\t"
-         "movdqa %%xmm0, (%2)           \n\t"
-         "movdqa %%xmm1, (%2,%3)        \n\t"
-         "movdqa %%xmm2, (%2,%3,2)      \n\t"
-         "movdqa %%xmm3, (%2,%4)        \n\t"
-         "subl $4, %0                   \n\t"
-         "lea (%1,%3,4), %1             \n\t"
-         "lea (%2,%3,4), %2             \n\t"
-         "jnz 1b                        \n\t"
-         : "+g"(h), "+r" (pixels),  "+r" (block)
-         : "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size)
-         : "memory"
-        );
-}
-
-static void avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-         "1:                            \n\t"
-         "movdqu (%1), %%xmm0           \n\t"
-         "movdqu (%1,%3), %%xmm1        \n\t"
-         "movdqu (%1,%3,2), %%xmm2      \n\t"
-         "movdqu (%1,%4), %%xmm3        \n\t"
-         "pavgb  (%2), %%xmm0           \n\t"
-         "pavgb  (%2,%3), %%xmm1        \n\t"
-         "pavgb  (%2,%3,2), %%xmm2      \n\t"
-         "pavgb  (%2,%4), %%xmm3        \n\t"
-         "movdqa %%xmm0, (%2)           \n\t"
-         "movdqa %%xmm1, (%2,%3)        \n\t"
-         "movdqa %%xmm2, (%2,%3,2)      \n\t"
-         "movdqa %%xmm3, (%2,%4)        \n\t"
-         "subl $4, %0                   \n\t"
-         "lea (%1,%3,4), %1             \n\t"
-         "lea (%2,%3,4), %2             \n\t"
-         "jnz 1b                        \n\t"
-         : "+g"(h), "+r" (pixels),  "+r" (block)
-         : "r"((x86_reg)line_size), "r"((x86_reg)3L*line_size)
-         : "memory"
-        );
-}
-
-#define CLEAR_BLOCKS(name,n) \
-static void name(DCTELEM *blocks)\
-{\
-    __asm__ volatile(\
-                "pxor %%mm7, %%mm7              \n\t"\
-                "mov     %1, %%"REG_a"          \n\t"\
-                "1:                             \n\t"\
-                "movq %%mm7, (%0, %%"REG_a")    \n\t"\
-                "movq %%mm7, 8(%0, %%"REG_a")   \n\t"\
-                "movq %%mm7, 16(%0, %%"REG_a")  \n\t"\
-                "movq %%mm7, 24(%0, %%"REG_a")  \n\t"\
-                "add $32, %%"REG_a"             \n\t"\
-                " js 1b                         \n\t"\
-                : : "r" (((uint8_t *)blocks)+128*n),\
-                    "i" (-128*n)\
-                : "%"REG_a\
-        );\
-}
-CLEAR_BLOCKS(clear_blocks_mmx, 6)
-CLEAR_BLOCKS(clear_block_mmx, 1)
-
-static void clear_block_sse(DCTELEM *block)
-{
-    __asm__ volatile(
-        "xorps  %%xmm0, %%xmm0  \n"
-        "movaps %%xmm0,    (%0) \n"
-        "movaps %%xmm0,  16(%0) \n"
-        "movaps %%xmm0,  32(%0) \n"
-        "movaps %%xmm0,  48(%0) \n"
-        "movaps %%xmm0,  64(%0) \n"
-        "movaps %%xmm0,  80(%0) \n"
-        "movaps %%xmm0,  96(%0) \n"
-        "movaps %%xmm0, 112(%0) \n"
-        :: "r"(block)
-        : "memory"
-    );
-}
-
-static void clear_blocks_sse(DCTELEM *blocks)
-{\
-    __asm__ volatile(
-        "xorps  %%xmm0, %%xmm0  \n"
-        "mov     %1, %%"REG_a"  \n"
-        "1:                     \n"
-        "movaps %%xmm0,    (%0, %%"REG_a") \n"
-        "movaps %%xmm0,  16(%0, %%"REG_a") \n"
-        "movaps %%xmm0,  32(%0, %%"REG_a") \n"
-        "movaps %%xmm0,  48(%0, %%"REG_a") \n"
-        "movaps %%xmm0,  64(%0, %%"REG_a") \n"
-        "movaps %%xmm0,  80(%0, %%"REG_a") \n"
-        "movaps %%xmm0,  96(%0, %%"REG_a") \n"
-        "movaps %%xmm0, 112(%0, %%"REG_a") \n"
-        "add $128, %%"REG_a"    \n"
-        " js 1b                 \n"
-        : : "r" (((uint8_t *)blocks)+128*6),
-            "i" (-128*6)
-        : "%"REG_a
-    );
-}
-
-static void add_bytes_mmx(uint8_t *dst, uint8_t *src, int w){
-    x86_reg i=0;
-    __asm__ volatile(
-        "jmp 2f                         \n\t"
-        "1:                             \n\t"
-        "movq  (%1, %0), %%mm0          \n\t"
-        "movq  (%2, %0), %%mm1          \n\t"
-        "paddb %%mm0, %%mm1             \n\t"
-        "movq %%mm1, (%2, %0)           \n\t"
-        "movq 8(%1, %0), %%mm0          \n\t"
-        "movq 8(%2, %0), %%mm1          \n\t"
-        "paddb %%mm0, %%mm1             \n\t"
-        "movq %%mm1, 8(%2, %0)          \n\t"
-        "add $16, %0                    \n\t"
-        "2:                             \n\t"
-        "cmp %3, %0                     \n\t"
-        " js 1b                         \n\t"
-        : "+r" (i)
-        : "r"(src), "r"(dst), "r"((x86_reg)w-15)
-    );
-    for(; i<w; i++)
-        dst[i+0] += src[i+0];
-}
-
-static void add_bytes_l2_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
-    x86_reg i=0;
-    __asm__ volatile(
-        "jmp 2f                         \n\t"
-        "1:                             \n\t"
-        "movq   (%2, %0), %%mm0         \n\t"
-        "movq  8(%2, %0), %%mm1         \n\t"
-        "paddb  (%3, %0), %%mm0         \n\t"
-        "paddb 8(%3, %0), %%mm1         \n\t"
-        "movq %%mm0,  (%1, %0)          \n\t"
-        "movq %%mm1, 8(%1, %0)          \n\t"
-        "add $16, %0                    \n\t"
-        "2:                             \n\t"
-        "cmp %4, %0                     \n\t"
-        " js 1b                         \n\t"
-        : "+r" (i)
-        : "r"(dst), "r"(src1), "r"(src2), "r"((x86_reg)w-15)
-    );
-    for(; i<w; i++)
-        dst[i] = src1[i] + src2[i];
-}
-
-#if HAVE_7REGS && HAVE_TEN_OPERANDS
-static void add_hfyu_median_prediction_cmov(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top) {
-    x86_reg w2 = -w;
-    x86_reg x;
-    int l = *left & 0xff;
-    int tl = *left_top & 0xff;
-    int t;
-    __asm__ volatile(
-        "mov    %7, %3 \n"
-        "1: \n"
-        "movzx (%3,%4), %2 \n"
-        "mov    %2, %k3 \n"
-        "sub   %b1, %b3 \n"
-        "add   %b0, %b3 \n"
-        "mov    %2, %1 \n"
-        "cmp    %0, %2 \n"
-        "cmovg  %0, %2 \n"
-        "cmovg  %1, %0 \n"
-        "cmp   %k3, %0 \n"
-        "cmovg %k3, %0 \n"
-        "mov    %7, %3 \n"
-        "cmp    %2, %0 \n"
-        "cmovl  %2, %0 \n"
-        "add (%6,%4), %b0 \n"
-        "mov   %b0, (%5,%4) \n"
-        "inc    %4 \n"
-        "jl 1b \n"
-        :"+&q"(l), "+&q"(tl), "=&r"(t), "=&q"(x), "+&r"(w2)
-        :"r"(dst+w), "r"(diff+w), "rm"(top+w)
-    );
-    *left = l;
-    *left_top = tl;
-}
-#endif
-
-#define H263_LOOP_FILTER \
-        "pxor %%mm7, %%mm7              \n\t"\
-        "movq  %0, %%mm0                \n\t"\
-        "movq  %0, %%mm1                \n\t"\
-        "movq  %3, %%mm2                \n\t"\
-        "movq  %3, %%mm3                \n\t"\
-        "punpcklbw %%mm7, %%mm0         \n\t"\
-        "punpckhbw %%mm7, %%mm1         \n\t"\
-        "punpcklbw %%mm7, %%mm2         \n\t"\
-        "punpckhbw %%mm7, %%mm3         \n\t"\
-        "psubw %%mm2, %%mm0             \n\t"\
-        "psubw %%mm3, %%mm1             \n\t"\
-        "movq  %1, %%mm2                \n\t"\
-        "movq  %1, %%mm3                \n\t"\
-        "movq  %2, %%mm4                \n\t"\
-        "movq  %2, %%mm5                \n\t"\
-        "punpcklbw %%mm7, %%mm2         \n\t"\
-        "punpckhbw %%mm7, %%mm3         \n\t"\
-        "punpcklbw %%mm7, %%mm4         \n\t"\
-        "punpckhbw %%mm7, %%mm5         \n\t"\
-        "psubw %%mm2, %%mm4             \n\t"\
-        "psubw %%mm3, %%mm5             \n\t"\
-        "psllw $2, %%mm4                \n\t"\
-        "psllw $2, %%mm5                \n\t"\
-        "paddw %%mm0, %%mm4             \n\t"\
-        "paddw %%mm1, %%mm5             \n\t"\
-        "pxor %%mm6, %%mm6              \n\t"\
-        "pcmpgtw %%mm4, %%mm6           \n\t"\
-        "pcmpgtw %%mm5, %%mm7           \n\t"\
-        "pxor %%mm6, %%mm4              \n\t"\
-        "pxor %%mm7, %%mm5              \n\t"\
-        "psubw %%mm6, %%mm4             \n\t"\
-        "psubw %%mm7, %%mm5             \n\t"\
-        "psrlw $3, %%mm4                \n\t"\
-        "psrlw $3, %%mm5                \n\t"\
-        "packuswb %%mm5, %%mm4          \n\t"\
-        "packsswb %%mm7, %%mm6          \n\t"\
-        "pxor %%mm7, %%mm7              \n\t"\
-        "movd %4, %%mm2                 \n\t"\
-        "punpcklbw %%mm2, %%mm2         \n\t"\
-        "punpcklbw %%mm2, %%mm2         \n\t"\
-        "punpcklbw %%mm2, %%mm2         \n\t"\
-        "psubusb %%mm4, %%mm2           \n\t"\
-        "movq %%mm2, %%mm3              \n\t"\
-        "psubusb %%mm4, %%mm3           \n\t"\
-        "psubb %%mm3, %%mm2             \n\t"\
-        "movq %1, %%mm3                 \n\t"\
-        "movq %2, %%mm4                 \n\t"\
-        "pxor %%mm6, %%mm3              \n\t"\
-        "pxor %%mm6, %%mm4              \n\t"\
-        "paddusb %%mm2, %%mm3           \n\t"\
-        "psubusb %%mm2, %%mm4           \n\t"\
-        "pxor %%mm6, %%mm3              \n\t"\
-        "pxor %%mm6, %%mm4              \n\t"\
-        "paddusb %%mm2, %%mm2           \n\t"\
-        "packsswb %%mm1, %%mm0          \n\t"\
-        "pcmpgtb %%mm0, %%mm7           \n\t"\
-        "pxor %%mm7, %%mm0              \n\t"\
-        "psubb %%mm7, %%mm0             \n\t"\
-        "movq %%mm0, %%mm1              \n\t"\
-        "psubusb %%mm2, %%mm0           \n\t"\
-        "psubb %%mm0, %%mm1             \n\t"\
-        "pand %5, %%mm1                 \n\t"\
-        "psrlw $2, %%mm1                \n\t"\
-        "pxor %%mm7, %%mm1              \n\t"\
-        "psubb %%mm7, %%mm1             \n\t"\
-        "movq %0, %%mm5                 \n\t"\
-        "movq %3, %%mm6                 \n\t"\
-        "psubb %%mm1, %%mm5             \n\t"\
-        "paddb %%mm1, %%mm6             \n\t"
-
-static void h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale){
-    if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
-    const int strength= ff_h263_loop_filter_strength[qscale];
-
-    __asm__ volatile(
-
-        H263_LOOP_FILTER
-
-        "movq %%mm3, %1                 \n\t"
-        "movq %%mm4, %2                 \n\t"
-        "movq %%mm5, %0                 \n\t"
-        "movq %%mm6, %3                 \n\t"
-        : "+m" (*(uint64_t*)(src - 2*stride)),
-          "+m" (*(uint64_t*)(src - 1*stride)),
-          "+m" (*(uint64_t*)(src + 0*stride)),
-          "+m" (*(uint64_t*)(src + 1*stride))
-        : "g" (2*strength), "m"(ff_pb_FC)
-    );
-    }
-}
-
-static inline void transpose4x4(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride){
-    __asm__ volatile( //FIXME could save 1 instruction if done as 8x4 ...
-        "movd  %4, %%mm0                \n\t"
-        "movd  %5, %%mm1                \n\t"
-        "movd  %6, %%mm2                \n\t"
-        "movd  %7, %%mm3                \n\t"
-        "punpcklbw %%mm1, %%mm0         \n\t"
-        "punpcklbw %%mm3, %%mm2         \n\t"
-        "movq %%mm0, %%mm1              \n\t"
-        "punpcklwd %%mm2, %%mm0         \n\t"
-        "punpckhwd %%mm2, %%mm1         \n\t"
-        "movd  %%mm0, %0                \n\t"
-        "punpckhdq %%mm0, %%mm0         \n\t"
-        "movd  %%mm0, %1                \n\t"
-        "movd  %%mm1, %2                \n\t"
-        "punpckhdq %%mm1, %%mm1         \n\t"
-        "movd  %%mm1, %3                \n\t"
-
-        : "=m" (*(uint32_t*)(dst + 0*dst_stride)),
-          "=m" (*(uint32_t*)(dst + 1*dst_stride)),
-          "=m" (*(uint32_t*)(dst + 2*dst_stride)),
-          "=m" (*(uint32_t*)(dst + 3*dst_stride))
-        :  "m" (*(uint32_t*)(src + 0*src_stride)),
-           "m" (*(uint32_t*)(src + 1*src_stride)),
-           "m" (*(uint32_t*)(src + 2*src_stride)),
-           "m" (*(uint32_t*)(src + 3*src_stride))
-    );
-}
-
-static void h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale){
-    if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
-    const int strength= ff_h263_loop_filter_strength[qscale];
-    DECLARE_ALIGNED(8, uint64_t, temp)[4];
-    uint8_t *btemp= (uint8_t*)temp;
-
-    src -= 2;
-
-    transpose4x4(btemp  , src           , 8, stride);
-    transpose4x4(btemp+4, src + 4*stride, 8, stride);
-    __asm__ volatile(
-        H263_LOOP_FILTER // 5 3 4 6
-
-        : "+m" (temp[0]),
-          "+m" (temp[1]),
-          "+m" (temp[2]),
-          "+m" (temp[3])
-        : "g" (2*strength), "m"(ff_pb_FC)
-    );
-
-    __asm__ volatile(
-        "movq %%mm5, %%mm1              \n\t"
-        "movq %%mm4, %%mm0              \n\t"
-        "punpcklbw %%mm3, %%mm5         \n\t"
-        "punpcklbw %%mm6, %%mm4         \n\t"
-        "punpckhbw %%mm3, %%mm1         \n\t"
-        "punpckhbw %%mm6, %%mm0         \n\t"
-        "movq %%mm5, %%mm3              \n\t"
-        "movq %%mm1, %%mm6              \n\t"
-        "punpcklwd %%mm4, %%mm5         \n\t"
-        "punpcklwd %%mm0, %%mm1         \n\t"
-        "punpckhwd %%mm4, %%mm3         \n\t"
-        "punpckhwd %%mm0, %%mm6         \n\t"
-        "movd %%mm5, (%0)               \n\t"
-        "punpckhdq %%mm5, %%mm5         \n\t"
-        "movd %%mm5, (%0,%2)            \n\t"
-        "movd %%mm3, (%0,%2,2)          \n\t"
-        "punpckhdq %%mm3, %%mm3         \n\t"
-        "movd %%mm3, (%0,%3)            \n\t"
-        "movd %%mm1, (%1)               \n\t"
-        "punpckhdq %%mm1, %%mm1         \n\t"
-        "movd %%mm1, (%1,%2)            \n\t"
-        "movd %%mm6, (%1,%2,2)          \n\t"
-        "punpckhdq %%mm6, %%mm6         \n\t"
-        "movd %%mm6, (%1,%3)            \n\t"
-        :: "r" (src),
-           "r" (src + 4*stride),
-           "r" ((x86_reg)   stride ),
-           "r" ((x86_reg)(3*stride))
-    );
-    }
-}
-
-/* draw the edges of width 'w' of an image of size width, height
-   this mmx version can only handle w==8 || w==16 */
-static void draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, int w)
-{
-    uint8_t *ptr, *last_line;
-    int i;
-
-    last_line = buf + (height - 1) * wrap;
-    /* left and right */
-    ptr = buf;
-    if(w==8)
-    {
-        __asm__ volatile(
-                "1:                             \n\t"
-                "movd (%0), %%mm0               \n\t"
-                "punpcklbw %%mm0, %%mm0         \n\t"
-                "punpcklwd %%mm0, %%mm0         \n\t"
-                "punpckldq %%mm0, %%mm0         \n\t"
-                "movq %%mm0, -8(%0)             \n\t"
-                "movq -8(%0, %2), %%mm1         \n\t"
-                "punpckhbw %%mm1, %%mm1         \n\t"
-                "punpckhwd %%mm1, %%mm1         \n\t"
-                "punpckhdq %%mm1, %%mm1         \n\t"
-                "movq %%mm1, (%0, %2)           \n\t"
-                "add %1, %0                     \n\t"
-                "cmp %3, %0                     \n\t"
-                " jb 1b                         \n\t"
-                : "+r" (ptr)
-                : "r" ((x86_reg)wrap), "r" ((x86_reg)width), "r" (ptr + wrap*height)
-        );
-    }
-    else
-    {
-        __asm__ volatile(
-                "1:                             \n\t"
-                "movd (%0), %%mm0               \n\t"
-                "punpcklbw %%mm0, %%mm0         \n\t"
-                "punpcklwd %%mm0, %%mm0         \n\t"
-                "punpckldq %%mm0, %%mm0         \n\t"
-                "movq %%mm0, -8(%0)             \n\t"
-                "movq %%mm0, -16(%0)            \n\t"
-                "movq -8(%0, %2), %%mm1         \n\t"
-                "punpckhbw %%mm1, %%mm1         \n\t"
-                "punpckhwd %%mm1, %%mm1         \n\t"
-                "punpckhdq %%mm1, %%mm1         \n\t"
-                "movq %%mm1, (%0, %2)           \n\t"
-                "movq %%mm1, 8(%0, %2)          \n\t"
-                "add %1, %0                     \n\t"
-                "cmp %3, %0                     \n\t"
-                " jb 1b                         \n\t"
-                : "+r" (ptr)
-                : "r" ((x86_reg)wrap), "r" ((x86_reg)width), "r" (ptr + wrap*height)
-        );
-    }
-
-    for(i=0;i<w;i+=4) {
-        /* top and bottom (and hopefully also the corners) */
-        ptr= buf - (i + 1) * wrap - w;
-        __asm__ volatile(
-                "1:                             \n\t"
-                "movq (%1, %0), %%mm0           \n\t"
-                "movq %%mm0, (%0)               \n\t"
-                "movq %%mm0, (%0, %2)           \n\t"
-                "movq %%mm0, (%0, %2, 2)        \n\t"
-                "movq %%mm0, (%0, %3)           \n\t"
-                "add $8, %0                     \n\t"
-                "cmp %4, %0                     \n\t"
-                " jb 1b                         \n\t"
-                : "+r" (ptr)
-                : "r" ((x86_reg)buf - (x86_reg)ptr - w), "r" ((x86_reg)-wrap), "r" ((x86_reg)-wrap*3), "r" (ptr+width+2*w)
-        );
-        ptr= last_line + (i + 1) * wrap - w;
-        __asm__ volatile(
-                "1:                             \n\t"
-                "movq (%1, %0), %%mm0           \n\t"
-                "movq %%mm0, (%0)               \n\t"
-                "movq %%mm0, (%0, %2)           \n\t"
-                "movq %%mm0, (%0, %2, 2)        \n\t"
-                "movq %%mm0, (%0, %3)           \n\t"
-                "add $8, %0                     \n\t"
-                "cmp %4, %0                     \n\t"
-                " jb 1b                         \n\t"
-                : "+r" (ptr)
-                : "r" ((x86_reg)last_line - (x86_reg)ptr - w), "r" ((x86_reg)wrap), "r" ((x86_reg)wrap*3), "r" (ptr+width+2*w)
-        );
-    }
-}
-
-#define PAETH(cpu, abs3)\
-static void add_png_paeth_prediction_##cpu(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp)\
-{\
-    x86_reg i = -bpp;\
-    x86_reg end = w-3;\
-    __asm__ volatile(\
-        "pxor      %%mm7, %%mm7 \n"\
-        "movd    (%1,%0), %%mm0 \n"\
-        "movd    (%2,%0), %%mm1 \n"\
-        "punpcklbw %%mm7, %%mm0 \n"\
-        "punpcklbw %%mm7, %%mm1 \n"\
-        "add       %4, %0 \n"\
-        "1: \n"\
-        "movq      %%mm1, %%mm2 \n"\
-        "movd    (%2,%0), %%mm1 \n"\
-        "movq      %%mm2, %%mm3 \n"\
-        "punpcklbw %%mm7, %%mm1 \n"\
-        "movq      %%mm2, %%mm4 \n"\
-        "psubw     %%mm1, %%mm3 \n"\
-        "psubw     %%mm0, %%mm4 \n"\
-        "movq      %%mm3, %%mm5 \n"\
-        "paddw     %%mm4, %%mm5 \n"\
-        abs3\
-        "movq      %%mm4, %%mm6 \n"\
-        "pminsw    %%mm5, %%mm6 \n"\
-        "pcmpgtw   %%mm6, %%mm3 \n"\
-        "pcmpgtw   %%mm5, %%mm4 \n"\
-        "movq      %%mm4, %%mm6 \n"\
-        "pand      %%mm3, %%mm4 \n"\
-        "pandn     %%mm3, %%mm6 \n"\
-        "pandn     %%mm0, %%mm3 \n"\
-        "movd    (%3,%0), %%mm0 \n"\
-        "pand      %%mm1, %%mm6 \n"\
-        "pand      %%mm4, %%mm2 \n"\
-        "punpcklbw %%mm7, %%mm0 \n"\
-        "movq      %6,    %%mm5 \n"\
-        "paddw     %%mm6, %%mm0 \n"\
-        "paddw     %%mm2, %%mm3 \n"\
-        "paddw     %%mm3, %%mm0 \n"\
-        "pand      %%mm5, %%mm0 \n"\
-        "movq      %%mm0, %%mm3 \n"\
-        "packuswb  %%mm3, %%mm3 \n"\
-        "movd      %%mm3, (%1,%0) \n"\
-        "add       %4, %0 \n"\
-        "cmp       %5, %0 \n"\
-        "jle 1b \n"\
-        :"+r"(i)\
-        :"r"(dst), "r"(top), "r"(src), "r"((x86_reg)bpp), "g"(end),\
-         "m"(ff_pw_255)\
-        :"memory"\
-    );\
-}
-
-#define ABS3_MMX2\
-        "psubw     %%mm5, %%mm7 \n"\
-        "pmaxsw    %%mm7, %%mm5 \n"\
-        "pxor      %%mm6, %%mm6 \n"\
-        "pxor      %%mm7, %%mm7 \n"\
-        "psubw     %%mm3, %%mm6 \n"\
-        "psubw     %%mm4, %%mm7 \n"\
-        "pmaxsw    %%mm6, %%mm3 \n"\
-        "pmaxsw    %%mm7, %%mm4 \n"\
-        "pxor      %%mm7, %%mm7 \n"
-
-#define ABS3_SSSE3\
-        "pabsw     %%mm3, %%mm3 \n"\
-        "pabsw     %%mm4, %%mm4 \n"\
-        "pabsw     %%mm5, %%mm5 \n"
-
-PAETH(mmx2, ABS3_MMX2)
-#if HAVE_SSSE3
-PAETH(ssse3, ABS3_SSSE3)
-#endif
-
-#define QPEL_V_LOW(m3,m4,m5,m6, pw_20, pw_3, rnd, in0, in1, in2, in7, out, OP)\
-        "paddw " #m4 ", " #m3 "           \n\t" /* x1 */\
-        "movq "MANGLE(ff_pw_20)", %%mm4   \n\t" /* 20 */\
-        "pmullw " #m3 ", %%mm4            \n\t" /* 20x1 */\
-        "movq "#in7", " #m3 "             \n\t" /* d */\
-        "movq "#in0", %%mm5               \n\t" /* D */\
-        "paddw " #m3 ", %%mm5             \n\t" /* x4 */\
-        "psubw %%mm5, %%mm4               \n\t" /* 20x1 - x4 */\
-        "movq "#in1", %%mm5               \n\t" /* C */\
-        "movq "#in2", %%mm6               \n\t" /* B */\
-        "paddw " #m6 ", %%mm5             \n\t" /* x3 */\
-        "paddw " #m5 ", %%mm6             \n\t" /* x2 */\
-        "paddw %%mm6, %%mm6               \n\t" /* 2x2 */\
-        "psubw %%mm6, %%mm5               \n\t" /* -2x2 + x3 */\
-        "pmullw "MANGLE(ff_pw_3)", %%mm5  \n\t" /* -6x2 + 3x3 */\
-        "paddw " #rnd ", %%mm4            \n\t" /* x2 */\
-        "paddw %%mm4, %%mm5               \n\t" /* 20x1 - 6x2 + 3x3 - x4 */\
-        "psraw $5, %%mm5                  \n\t"\
-        "packuswb %%mm5, %%mm5            \n\t"\
-        OP(%%mm5, out, %%mm7, d)
-
-#define QPEL_BASE(OPNAME, ROUNDER, RND, OP_MMX2, OP_3DNOW)\
-static void OPNAME ## mpeg4_qpel16_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    uint64_t temp;\
-\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7                \n\t"\
-        "1:                               \n\t"\
-        "movq  (%0), %%mm0                \n\t" /* ABCDEFGH */\
-        "movq %%mm0, %%mm1                \n\t" /* ABCDEFGH */\
-        "movq %%mm0, %%mm2                \n\t" /* ABCDEFGH */\
-        "punpcklbw %%mm7, %%mm0           \n\t" /* 0A0B0C0D */\
-        "punpckhbw %%mm7, %%mm1           \n\t" /* 0E0F0G0H */\
-        "pshufw $0x90, %%mm0, %%mm5       \n\t" /* 0A0A0B0C */\
-        "pshufw $0x41, %%mm0, %%mm6       \n\t" /* 0B0A0A0B */\
-        "movq %%mm2, %%mm3                \n\t" /* ABCDEFGH */\
-        "movq %%mm2, %%mm4                \n\t" /* ABCDEFGH */\
-        "psllq $8, %%mm2                  \n\t" /* 0ABCDEFG */\
-        "psllq $16, %%mm3                 \n\t" /* 00ABCDEF */\
-        "psllq $24, %%mm4                 \n\t" /* 000ABCDE */\
-        "punpckhbw %%mm7, %%mm2           \n\t" /* 0D0E0F0G */\
-        "punpckhbw %%mm7, %%mm3           \n\t" /* 0C0D0E0F */\
-        "punpckhbw %%mm7, %%mm4           \n\t" /* 0B0C0D0E */\
-        "paddw %%mm3, %%mm5               \n\t" /* b */\
-        "paddw %%mm2, %%mm6               \n\t" /* c */\
-        "paddw %%mm5, %%mm5               \n\t" /* 2b */\
-        "psubw %%mm5, %%mm6               \n\t" /* c - 2b */\
-        "pshufw $0x06, %%mm0, %%mm5       \n\t" /* 0C0B0A0A */\
-        "pmullw "MANGLE(ff_pw_3)", %%mm6  \n\t" /* 3c - 6b */\
-        "paddw %%mm4, %%mm0               \n\t" /* a */\
-        "paddw %%mm1, %%mm5               \n\t" /* d */\
-        "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
-        "psubw %%mm5, %%mm0               \n\t" /* 20a - d */\
-        "paddw %6, %%mm6                  \n\t"\
-        "paddw %%mm6, %%mm0               \n\t" /* 20a - 6b + 3c - d */\
-        "psraw $5, %%mm0                  \n\t"\
-        "movq %%mm0, %5                   \n\t"\
-        /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
-        \
-        "movq 5(%0), %%mm0                \n\t" /* FGHIJKLM */\
-        "movq %%mm0, %%mm5                \n\t" /* FGHIJKLM */\
-        "movq %%mm0, %%mm6                \n\t" /* FGHIJKLM */\
-        "psrlq $8, %%mm0                  \n\t" /* GHIJKLM0 */\
-        "psrlq $16, %%mm5                 \n\t" /* HIJKLM00 */\
-        "punpcklbw %%mm7, %%mm0           \n\t" /* 0G0H0I0J */\
-        "punpcklbw %%mm7, %%mm5           \n\t" /* 0H0I0J0K */\
-        "paddw %%mm0, %%mm2               \n\t" /* b */\
-        "paddw %%mm5, %%mm3               \n\t" /* c */\
-        "paddw %%mm2, %%mm2               \n\t" /* 2b */\
-        "psubw %%mm2, %%mm3               \n\t" /* c - 2b */\
-        "movq %%mm6, %%mm2                \n\t" /* FGHIJKLM */\
-        "psrlq $24, %%mm6                 \n\t" /* IJKLM000 */\
-        "punpcklbw %%mm7, %%mm2           \n\t" /* 0F0G0H0I */\
-        "punpcklbw %%mm7, %%mm6           \n\t" /* 0I0J0K0L */\
-        "pmullw "MANGLE(ff_pw_3)", %%mm3  \n\t" /* 3c - 6b */\
-        "paddw %%mm2, %%mm1               \n\t" /* a */\
-        "paddw %%mm6, %%mm4               \n\t" /* d */\
-        "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
-        "psubw %%mm4, %%mm3               \n\t" /* - 6b +3c - d */\
-        "paddw %6, %%mm1                  \n\t"\
-        "paddw %%mm1, %%mm3               \n\t" /* 20a - 6b +3c - d */\
-        "psraw $5, %%mm3                  \n\t"\
-        "movq %5, %%mm1                   \n\t"\
-        "packuswb %%mm3, %%mm1            \n\t"\
-        OP_MMX2(%%mm1, (%1),%%mm4, q)\
-        /* mm0= GHIJ, mm2=FGHI, mm5=HIJK, mm6=IJKL, mm7=0 */\
-        \
-        "movq 9(%0), %%mm1                \n\t" /* JKLMNOPQ */\
-        "movq %%mm1, %%mm4                \n\t" /* JKLMNOPQ */\
-        "movq %%mm1, %%mm3                \n\t" /* JKLMNOPQ */\
-        "psrlq $8, %%mm1                  \n\t" /* KLMNOPQ0 */\
-        "psrlq $16, %%mm4                 \n\t" /* LMNOPQ00 */\
-        "punpcklbw %%mm7, %%mm1           \n\t" /* 0K0L0M0N */\
-        "punpcklbw %%mm7, %%mm4           \n\t" /* 0L0M0N0O */\
-        "paddw %%mm1, %%mm5               \n\t" /* b */\
-        "paddw %%mm4, %%mm0               \n\t" /* c */\
-        "paddw %%mm5, %%mm5               \n\t" /* 2b */\
-        "psubw %%mm5, %%mm0               \n\t" /* c - 2b */\
-        "movq %%mm3, %%mm5                \n\t" /* JKLMNOPQ */\
-        "psrlq $24, %%mm3                 \n\t" /* MNOPQ000 */\
-        "pmullw "MANGLE(ff_pw_3)", %%mm0  \n\t" /* 3c - 6b */\
-        "punpcklbw %%mm7, %%mm3           \n\t" /* 0M0N0O0P */\
-        "paddw %%mm3, %%mm2               \n\t" /* d */\
-        "psubw %%mm2, %%mm0               \n\t" /* -6b + 3c - d */\
-        "movq %%mm5, %%mm2                \n\t" /* JKLMNOPQ */\
-        "punpcklbw %%mm7, %%mm2           \n\t" /* 0J0K0L0M */\
-        "punpckhbw %%mm7, %%mm5           \n\t" /* 0N0O0P0Q */\
-        "paddw %%mm2, %%mm6               \n\t" /* a */\
-        "pmullw "MANGLE(ff_pw_20)", %%mm6 \n\t" /* 20a */\
-        "paddw %6, %%mm0                  \n\t"\
-        "paddw %%mm6, %%mm0               \n\t" /* 20a - 6b + 3c - d */\
-        "psraw $5, %%mm0                  \n\t"\
-        /* mm1=KLMN, mm2=JKLM, mm3=MNOP, mm4=LMNO, mm5=NOPQ mm7=0 */\
-        \
-        "paddw %%mm5, %%mm3               \n\t" /* a */\
-        "pshufw $0xF9, %%mm5, %%mm6       \n\t" /* 0O0P0Q0Q */\
-        "paddw %%mm4, %%mm6               \n\t" /* b */\
-        "pshufw $0xBE, %%mm5, %%mm4       \n\t" /* 0P0Q0Q0P */\
-        "pshufw $0x6F, %%mm5, %%mm5       \n\t" /* 0Q0Q0P0O */\
-        "paddw %%mm1, %%mm4               \n\t" /* c */\
-        "paddw %%mm2, %%mm5               \n\t" /* d */\
-        "paddw %%mm6, %%mm6               \n\t" /* 2b */\
-        "psubw %%mm6, %%mm4               \n\t" /* c - 2b */\
-        "pmullw "MANGLE(ff_pw_20)", %%mm3 \n\t" /* 20a */\
-        "pmullw "MANGLE(ff_pw_3)", %%mm4  \n\t" /* 3c - 6b */\
-        "psubw %%mm5, %%mm3               \n\t" /* -6b + 3c - d */\
-        "paddw %6, %%mm4                  \n\t"\
-        "paddw %%mm3, %%mm4               \n\t" /* 20a - 6b + 3c - d */\
-        "psraw $5, %%mm4                  \n\t"\
-        "packuswb %%mm4, %%mm0            \n\t"\
-        OP_MMX2(%%mm0, 8(%1), %%mm4, q)\
-        \
-        "add %3, %0                       \n\t"\
-        "add %4, %1                       \n\t"\
-        "decl %2                          \n\t"\
-        " jnz 1b                          \n\t"\
-        : "+a"(src), "+c"(dst), "+D"(h)\
-        : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(temp), "m"(ROUNDER)\
-        : "memory"\
-    );\
-}\
-\
-static void OPNAME ## mpeg4_qpel16_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    int i;\
-    int16_t temp[16];\
-    /* quick HACK, XXX FIXME MUST be optimized */\
-    for(i=0; i<h; i++)\
-    {\
-        temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\
-        temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\
-        temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\
-        temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\
-        temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\
-        temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 9]);\
-        temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 9])*3 - (src[ 3]+src[10]);\
-        temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 9])*6 + (src[ 5]+src[10])*3 - (src[ 4]+src[11]);\
-        temp[ 8]= (src[ 8]+src[ 9])*20 - (src[ 7]+src[10])*6 + (src[ 6]+src[11])*3 - (src[ 5]+src[12]);\
-        temp[ 9]= (src[ 9]+src[10])*20 - (src[ 8]+src[11])*6 + (src[ 7]+src[12])*3 - (src[ 6]+src[13]);\
-        temp[10]= (src[10]+src[11])*20 - (src[ 9]+src[12])*6 + (src[ 8]+src[13])*3 - (src[ 7]+src[14]);\
-        temp[11]= (src[11]+src[12])*20 - (src[10]+src[13])*6 + (src[ 9]+src[14])*3 - (src[ 8]+src[15]);\
-        temp[12]= (src[12]+src[13])*20 - (src[11]+src[14])*6 + (src[10]+src[15])*3 - (src[ 9]+src[16]);\
-        temp[13]= (src[13]+src[14])*20 - (src[12]+src[15])*6 + (src[11]+src[16])*3 - (src[10]+src[16]);\
-        temp[14]= (src[14]+src[15])*20 - (src[13]+src[16])*6 + (src[12]+src[16])*3 - (src[11]+src[15]);\
-        temp[15]= (src[15]+src[16])*20 - (src[14]+src[16])*6 + (src[13]+src[15])*3 - (src[12]+src[14]);\
-        __asm__ volatile(\
-            "movq (%0), %%mm0               \n\t"\
-            "movq 8(%0), %%mm1              \n\t"\
-            "paddw %2, %%mm0                \n\t"\
-            "paddw %2, %%mm1                \n\t"\
-            "psraw $5, %%mm0                \n\t"\
-            "psraw $5, %%mm1                \n\t"\
-            "packuswb %%mm1, %%mm0          \n\t"\
-            OP_3DNOW(%%mm0, (%1), %%mm1, q)\
-            "movq 16(%0), %%mm0             \n\t"\
-            "movq 24(%0), %%mm1             \n\t"\
-            "paddw %2, %%mm0                \n\t"\
-            "paddw %2, %%mm1                \n\t"\
-            "psraw $5, %%mm0                \n\t"\
-            "psraw $5, %%mm1                \n\t"\
-            "packuswb %%mm1, %%mm0          \n\t"\
-            OP_3DNOW(%%mm0, 8(%1), %%mm1, q)\
-            :: "r"(temp), "r"(dst), "m"(ROUNDER)\
-            : "memory"\
-        );\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_h_lowpass_mmx2(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7                \n\t"\
-        "1:                               \n\t"\
-        "movq  (%0), %%mm0                \n\t" /* ABCDEFGH */\
-        "movq %%mm0, %%mm1                \n\t" /* ABCDEFGH */\
-        "movq %%mm0, %%mm2                \n\t" /* ABCDEFGH */\
-        "punpcklbw %%mm7, %%mm0           \n\t" /* 0A0B0C0D */\
-        "punpckhbw %%mm7, %%mm1           \n\t" /* 0E0F0G0H */\
-        "pshufw $0x90, %%mm0, %%mm5       \n\t" /* 0A0A0B0C */\
-        "pshufw $0x41, %%mm0, %%mm6       \n\t" /* 0B0A0A0B */\
-        "movq %%mm2, %%mm3                \n\t" /* ABCDEFGH */\
-        "movq %%mm2, %%mm4                \n\t" /* ABCDEFGH */\
-        "psllq $8, %%mm2                  \n\t" /* 0ABCDEFG */\
-        "psllq $16, %%mm3                 \n\t" /* 00ABCDEF */\
-        "psllq $24, %%mm4                 \n\t" /* 000ABCDE */\
-        "punpckhbw %%mm7, %%mm2           \n\t" /* 0D0E0F0G */\
-        "punpckhbw %%mm7, %%mm3           \n\t" /* 0C0D0E0F */\
-        "punpckhbw %%mm7, %%mm4           \n\t" /* 0B0C0D0E */\
-        "paddw %%mm3, %%mm5               \n\t" /* b */\
-        "paddw %%mm2, %%mm6               \n\t" /* c */\
-        "paddw %%mm5, %%mm5               \n\t" /* 2b */\
-        "psubw %%mm5, %%mm6               \n\t" /* c - 2b */\
-        "pshufw $0x06, %%mm0, %%mm5       \n\t" /* 0C0B0A0A */\
-        "pmullw "MANGLE(ff_pw_3)", %%mm6  \n\t" /* 3c - 6b */\
-        "paddw %%mm4, %%mm0               \n\t" /* a */\
-        "paddw %%mm1, %%mm5               \n\t" /* d */\
-        "pmullw "MANGLE(ff_pw_20)", %%mm0 \n\t" /* 20a */\
-        "psubw %%mm5, %%mm0               \n\t" /* 20a - d */\
-        "paddw %5, %%mm6                  \n\t"\
-        "paddw %%mm6, %%mm0               \n\t" /* 20a - 6b + 3c - d */\
-        "psraw $5, %%mm0                  \n\t"\
-        /* mm1=EFGH, mm2=DEFG, mm3=CDEF, mm4=BCDE, mm7=0 */\
-        \
-        "movd 5(%0), %%mm5                \n\t" /* FGHI */\
-        "punpcklbw %%mm7, %%mm5           \n\t" /* 0F0G0H0I */\
-        "pshufw $0xF9, %%mm5, %%mm6       \n\t" /* 0G0H0I0I */\
-        "paddw %%mm5, %%mm1               \n\t" /* a */\
-        "paddw %%mm6, %%mm2               \n\t" /* b */\
-        "pshufw $0xBE, %%mm5, %%mm6       \n\t" /* 0H0I0I0H */\
-        "pshufw $0x6F, %%mm5, %%mm5       \n\t" /* 0I0I0H0G */\
-        "paddw %%mm6, %%mm3               \n\t" /* c */\
-        "paddw %%mm5, %%mm4               \n\t" /* d */\
-        "paddw %%mm2, %%mm2               \n\t" /* 2b */\
-        "psubw %%mm2, %%mm3               \n\t" /* c - 2b */\
-        "pmullw "MANGLE(ff_pw_20)", %%mm1 \n\t" /* 20a */\
-        "pmullw "MANGLE(ff_pw_3)", %%mm3  \n\t" /* 3c - 6b */\
-        "psubw %%mm4, %%mm3               \n\t" /* -6b + 3c - d */\
-        "paddw %5, %%mm1                  \n\t"\
-        "paddw %%mm1, %%mm3               \n\t" /* 20a - 6b + 3c - d */\
-        "psraw $5, %%mm3                  \n\t"\
-        "packuswb %%mm3, %%mm0            \n\t"\
-        OP_MMX2(%%mm0, (%1), %%mm4, q)\
-        \
-        "add %3, %0                       \n\t"\
-        "add %4, %1                       \n\t"\
-        "decl %2                          \n\t"\
-        " jnz 1b                          \n\t"\
-        : "+a"(src), "+c"(dst), "+d"(h)\
-        : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER)\
-        : "memory"\
-    );\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_h_lowpass_3dnow(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    int i;\
-    int16_t temp[8];\
-    /* quick HACK, XXX FIXME MUST be optimized */\
-    for(i=0; i<h; i++)\
-    {\
-        temp[ 0]= (src[ 0]+src[ 1])*20 - (src[ 0]+src[ 2])*6 + (src[ 1]+src[ 3])*3 - (src[ 2]+src[ 4]);\
-        temp[ 1]= (src[ 1]+src[ 2])*20 - (src[ 0]+src[ 3])*6 + (src[ 0]+src[ 4])*3 - (src[ 1]+src[ 5]);\
-        temp[ 2]= (src[ 2]+src[ 3])*20 - (src[ 1]+src[ 4])*6 + (src[ 0]+src[ 5])*3 - (src[ 0]+src[ 6]);\
-        temp[ 3]= (src[ 3]+src[ 4])*20 - (src[ 2]+src[ 5])*6 + (src[ 1]+src[ 6])*3 - (src[ 0]+src[ 7]);\
-        temp[ 4]= (src[ 4]+src[ 5])*20 - (src[ 3]+src[ 6])*6 + (src[ 2]+src[ 7])*3 - (src[ 1]+src[ 8]);\
-        temp[ 5]= (src[ 5]+src[ 6])*20 - (src[ 4]+src[ 7])*6 + (src[ 3]+src[ 8])*3 - (src[ 2]+src[ 8]);\
-        temp[ 6]= (src[ 6]+src[ 7])*20 - (src[ 5]+src[ 8])*6 + (src[ 4]+src[ 8])*3 - (src[ 3]+src[ 7]);\
-        temp[ 7]= (src[ 7]+src[ 8])*20 - (src[ 6]+src[ 8])*6 + (src[ 5]+src[ 7])*3 - (src[ 4]+src[ 6]);\
-        __asm__ volatile(\
-            "movq (%0), %%mm0           \n\t"\
-            "movq 8(%0), %%mm1          \n\t"\
-            "paddw %2, %%mm0            \n\t"\
-            "paddw %2, %%mm1            \n\t"\
-            "psraw $5, %%mm0            \n\t"\
-            "psraw $5, %%mm1            \n\t"\
-            "packuswb %%mm1, %%mm0      \n\t"\
-            OP_3DNOW(%%mm0, (%1), %%mm1, q)\
-            :: "r"(temp), "r"(dst), "m"(ROUNDER)\
-            :"memory"\
-        );\
-        dst+=dstStride;\
-        src+=srcStride;\
-    }\
-}
-
-#define QPEL_OP(OPNAME, ROUNDER, RND, OP, MMX)\
-\
-static void OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    uint64_t temp[17*4];\
-    uint64_t *temp_ptr= temp;\
-    int count= 17;\
-\
-    /*FIXME unroll */\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7              \n\t"\
-        "1:                             \n\t"\
-        "movq (%0), %%mm0               \n\t"\
-        "movq (%0), %%mm1               \n\t"\
-        "movq 8(%0), %%mm2              \n\t"\
-        "movq 8(%0), %%mm3              \n\t"\
-        "punpcklbw %%mm7, %%mm0         \n\t"\
-        "punpckhbw %%mm7, %%mm1         \n\t"\
-        "punpcklbw %%mm7, %%mm2         \n\t"\
-        "punpckhbw %%mm7, %%mm3         \n\t"\
-        "movq %%mm0, (%1)               \n\t"\
-        "movq %%mm1, 17*8(%1)           \n\t"\
-        "movq %%mm2, 2*17*8(%1)         \n\t"\
-        "movq %%mm3, 3*17*8(%1)         \n\t"\
-        "add $8, %1                     \n\t"\
-        "add %3, %0                     \n\t"\
-        "decl %2                        \n\t"\
-        " jnz 1b                        \n\t"\
-        : "+r" (src), "+r" (temp_ptr), "+r"(count)\
-        : "r" ((x86_reg)srcStride)\
-        : "memory"\
-    );\
-    \
-    temp_ptr= temp;\
-    count=4;\
-    \
-/*FIXME reorder for speed */\
-    __asm__ volatile(\
-        /*"pxor %%mm7, %%mm7              \n\t"*/\
-        "1:                             \n\t"\
-        "movq (%0), %%mm0               \n\t"\
-        "movq 8(%0), %%mm1              \n\t"\
-        "movq 16(%0), %%mm2             \n\t"\
-        "movq 24(%0), %%mm3             \n\t"\
-        QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0),  8(%0),   (%0), 32(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5,  8(%0),   (%0),   (%0), 40(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5,   (%0),   (%0),  8(%0), 48(%0), (%1), OP)\
-        \
-        QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5,   (%0),  8(%0), 16(%0), 56(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5,  8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 72(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 80(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 88(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 40(%0), 48(%0), 56(%0), 96(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 48(%0), 56(%0), 64(%0),104(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 56(%0), 64(%0), 72(%0),112(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 64(%0), 72(%0), 80(%0),120(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 72(%0), 80(%0), 88(%0),128(%0), (%1), OP)\
-        \
-        QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 80(%0), 88(%0), 96(%0),128(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"  \
-        QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 88(%0), 96(%0),104(%0),120(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 96(%0),104(%0),112(%0),112(%0), (%1, %3), OP)\
-        \
-        "add $136, %0                   \n\t"\
-        "add %6, %1                     \n\t"\
-        "decl %2                        \n\t"\
-        " jnz 1b                        \n\t"\
-        \
-        : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
-        : "r"((x86_reg)dstStride), "r"(2*(x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-14*(x86_reg)dstStride)\
-        :"memory"\
-    );\
-}\
-\
-static void OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    uint64_t temp[9*2];\
-    uint64_t *temp_ptr= temp;\
-    int count= 9;\
-\
-    /*FIXME unroll */\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7              \n\t"\
-        "1:                             \n\t"\
-        "movq (%0), %%mm0               \n\t"\
-        "movq (%0), %%mm1               \n\t"\
-        "punpcklbw %%mm7, %%mm0         \n\t"\
-        "punpckhbw %%mm7, %%mm1         \n\t"\
-        "movq %%mm0, (%1)               \n\t"\
-        "movq %%mm1, 9*8(%1)            \n\t"\
-        "add $8, %1                     \n\t"\
-        "add %3, %0                     \n\t"\
-        "decl %2                        \n\t"\
-        " jnz 1b                        \n\t"\
-        : "+r" (src), "+r" (temp_ptr), "+r"(count)\
-        : "r" ((x86_reg)srcStride)\
-        : "memory"\
-    );\
-    \
-    temp_ptr= temp;\
-    count=2;\
-    \
-/*FIXME reorder for speed */\
-    __asm__ volatile(\
-        /*"pxor %%mm7, %%mm7              \n\t"*/\
-        "1:                             \n\t"\
-        "movq (%0), %%mm0               \n\t"\
-        "movq 8(%0), %%mm1              \n\t"\
-        "movq 16(%0), %%mm2             \n\t"\
-        "movq 24(%0), %%mm3             \n\t"\
-        QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5, 16(%0),  8(%0),   (%0), 32(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5,  8(%0),   (%0),   (%0), 40(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5,   (%0),   (%0),  8(%0), 48(%0), (%1), OP)\
-        \
-        QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5,   (%0),  8(%0), 16(%0), 56(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm0, %%mm1, %%mm2, %%mm3, %5, %6, %5,  8(%0), 16(%0), 24(%0), 64(%0), (%1), OP)\
-        \
-        QPEL_V_LOW(%%mm1, %%mm2, %%mm3, %%mm0, %5, %6, %5, 16(%0), 24(%0), 32(%0), 64(%0), (%1, %3), OP)\
-        "add %4, %1                     \n\t"\
-        QPEL_V_LOW(%%mm2, %%mm3, %%mm0, %%mm1, %5, %6, %5, 24(%0), 32(%0), 40(%0), 56(%0), (%1), OP)\
-        QPEL_V_LOW(%%mm3, %%mm0, %%mm1, %%mm2, %5, %6, %5, 32(%0), 40(%0), 48(%0), 48(%0), (%1, %3), OP)\
-                \
-        "add $72, %0                    \n\t"\
-        "add %6, %1                     \n\t"\
-        "decl %2                        \n\t"\
-        " jnz 1b                        \n\t"\
-         \
-        : "+r"(temp_ptr), "+r"(dst), "+g"(count)\
-        : "r"((x86_reg)dstStride), "r"(2*(x86_reg)dstStride), /*"m"(ff_pw_20), "m"(ff_pw_3),*/ "m"(ROUNDER), "g"(4-6*(x86_reg)dstStride)\
-        : "memory"\
-   );\
-}\
-\
-static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels8_ ## MMX(dst, src, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[8];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[8];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, stride, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, src+1, half, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[8];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, src, half, stride, stride, 8);\
-}\
-\
-static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[8];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, 8, stride);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, src+stride, half, stride, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half) + 64;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half) + 64;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half) + 64;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half) + 64;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half) + 64;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half) + 64;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\
-    OPNAME ## pixels8_l2_ ## MMX(dst, halfH+8, halfHV, stride, 8, 8);\
-}\
-static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, stride, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[8 + 9];\
-    uint8_t * const halfH= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    put ## RND ## pixels8_l2_ ## MMX(halfH, src+1, halfH, 8, stride, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[9];\
-    uint8_t * const halfH= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, stride, 9);\
-    OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, stride, 8);\
-}\
-static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels16_ ## MMX(dst, src, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[32];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[32];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, stride, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, src+1, half, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[32];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, stride, 16);\
-}\
-\
-static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t temp[32];\
-    uint8_t * const half= (uint8_t*)temp;\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, stride);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, stride, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[16*2 + 17*2];\
-    uint8_t * const halfH= ((uint8_t*)half) + 256;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[16*2 + 17*2];\
-    uint8_t * const halfH= ((uint8_t*)half) + 256;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[16*2 + 17*2];\
-    uint8_t * const halfH= ((uint8_t*)half) + 256;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[16*2 + 17*2];\
-    uint8_t * const halfH= ((uint8_t*)half) + 256;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[16*2 + 17*2];\
-    uint8_t * const halfH= ((uint8_t*)half) + 256;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[16*2 + 17*2];\
-    uint8_t * const halfH= ((uint8_t*)half) + 256;\
-    uint8_t * const halfHV= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, 16, 16);\
-    OPNAME ## pixels16_l2_ ## MMX(dst, halfH+16, halfHV, stride, 16, 16);\
-}\
-static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[17*2];\
-    uint8_t * const halfH= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, stride, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[17*2];\
-    uint8_t * const halfH= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    put ## RND ## pixels16_l2_ ## MMX(halfH, src+1, halfH, 16, stride, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
-}\
-static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    uint64_t half[17*2];\
-    uint8_t * const halfH= ((uint8_t*)half);\
-    put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, stride, 17);\
-    OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, stride, 16);\
-}
-
-#define PUT_OP(a,b,temp, size) "mov" #size " " #a ", " #b "        \n\t"
-#define AVG_3DNOW_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp "   \n\t"\
-"pavgusb " #temp ", " #a "        \n\t"\
-"mov" #size " " #a ", " #b "      \n\t"
-#define AVG_MMX2_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp "   \n\t"\
-"pavgb " #temp ", " #a "          \n\t"\
-"mov" #size " " #a ", " #b "      \n\t"
-
-QPEL_BASE(put_       , ff_pw_16, _       , PUT_OP, PUT_OP)
-QPEL_BASE(avg_       , ff_pw_16, _       , AVG_MMX2_OP, AVG_3DNOW_OP)
-QPEL_BASE(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, PUT_OP)
-QPEL_OP(put_       , ff_pw_16, _       , PUT_OP, 3dnow)
-QPEL_OP(avg_       , ff_pw_16, _       , AVG_3DNOW_OP, 3dnow)
-QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, 3dnow)
-QPEL_OP(put_       , ff_pw_16, _       , PUT_OP, mmx2)
-QPEL_OP(avg_       , ff_pw_16, _       , AVG_MMX2_OP, mmx2)
-QPEL_OP(put_no_rnd_, ff_pw_15, _no_rnd_, PUT_OP, mmx2)
-
-/***********************************/
-/* bilinear qpel: not compliant to any spec, only for -lavdopts fast */
-
-#define QPEL_2TAP_XY(OPNAME, SIZE, MMX, XY, HPEL)\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels ## SIZE ## HPEL(dst, src, stride, SIZE);\
-}
-#define QPEL_2TAP_L3(OPNAME, SIZE, MMX, XY, S0, S1, S2)\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc ## XY ## _ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## 2tap_qpel ## SIZE ## _l3_ ## MMX(dst, src+S0, stride, SIZE, S1, S2);\
-}
-
-#define QPEL_2TAP(OPNAME, SIZE, MMX)\
-QPEL_2TAP_XY(OPNAME, SIZE, MMX, 20, _x2_ ## MMX)\
-QPEL_2TAP_XY(OPNAME, SIZE, MMX, 02, _y2_ ## MMX)\
-QPEL_2TAP_XY(OPNAME, SIZE, MMX, 22, _xy2_mmx)\
-static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc00_ ## MMX =\
-                          OPNAME ## qpel ## SIZE ## _mc00_ ## MMX;\
-static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc21_ ## MMX =\
-                          OPNAME ## 2tap_qpel ## SIZE ## _mc20_ ## MMX;\
-static const qpel_mc_func OPNAME ## 2tap_qpel ## SIZE ## _mc12_ ## MMX =\
-                          OPNAME ## 2tap_qpel ## SIZE ## _mc02_ ## MMX;\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels ## SIZE ## _y2_ ## MMX(dst, src+1, stride, SIZE);\
-}\
-static void OPNAME ## 2tap_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels ## SIZE ## _x2_ ## MMX(dst, src+stride, stride, SIZE);\
-}\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 10, 0,         1,       0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 30, 1,        -1,       0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 01, 0,         stride,  0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 03, stride,   -stride,  0)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 11, 0,         stride,  1)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 31, 1,         stride, -1)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 13, stride,   -stride,  1)\
-QPEL_2TAP_L3(OPNAME, SIZE, MMX, 33, stride+1, -stride, -1)\
-
-QPEL_2TAP(put_, 16, mmx2)
-QPEL_2TAP(avg_, 16, mmx2)
-QPEL_2TAP(put_,  8, mmx2)
-QPEL_2TAP(avg_,  8, mmx2)
-QPEL_2TAP(put_, 16, 3dnow)
-QPEL_2TAP(avg_, 16, 3dnow)
-QPEL_2TAP(put_,  8, 3dnow)
-QPEL_2TAP(avg_,  8, 3dnow)
-
-
-#if 0
-static void just_return(void) { return; }
-#endif
-
-static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy,
-                    int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height){
-    const int w = 8;
-    const int ix = ox>>(16+shift);
-    const int iy = oy>>(16+shift);
-    const int oxs = ox>>4;
-    const int oys = oy>>4;
-    const int dxxs = dxx>>4;
-    const int dxys = dxy>>4;
-    const int dyxs = dyx>>4;
-    const int dyys = dyy>>4;
-    const uint16_t r4[4] = {r,r,r,r};
-    const uint16_t dxy4[4] = {dxys,dxys,dxys,dxys};
-    const uint16_t dyy4[4] = {dyys,dyys,dyys,dyys};
-    const uint64_t shift2 = 2*shift;
-    uint8_t edge_buf[(h+1)*stride];
-    int x, y;
-
-    const int dxw = (dxx-(1<<(16+shift)))*(w-1);
-    const int dyh = (dyy-(1<<(16+shift)))*(h-1);
-    const int dxh = dxy*(h-1);
-    const int dyw = dyx*(w-1);
-    if( // non-constant fullpel offset (3% of blocks)
-        ((ox^(ox+dxw)) | (ox^(ox+dxh)) | (ox^(ox+dxw+dxh)) |
-         (oy^(oy+dyw)) | (oy^(oy+dyh)) | (oy^(oy+dyw+dyh))) >> (16+shift)
-        // uses more than 16 bits of subpel mv (only at huge resolution)
-        || (dxx|dxy|dyx|dyy)&15 )
-    {
-        //FIXME could still use mmx for some of the rows
-        ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, width, height);
-        return;
-    }
-
-    src += ix + iy*stride;
-    if( (unsigned)ix >= width-w ||
-        (unsigned)iy >= height-h )
-    {
-        ff_emulated_edge_mc(edge_buf, src, stride, w+1, h+1, ix, iy, width, height);
-        src = edge_buf;
-    }
-
-    __asm__ volatile(
-        "movd         %0, %%mm6 \n\t"
-        "pxor      %%mm7, %%mm7 \n\t"
-        "punpcklwd %%mm6, %%mm6 \n\t"
-        "punpcklwd %%mm6, %%mm6 \n\t"
-        :: "r"(1<<shift)
-    );
-
-    for(x=0; x<w; x+=4){
-        uint16_t dx4[4] = { oxs - dxys + dxxs*(x+0),
-                            oxs - dxys + dxxs*(x+1),
-                            oxs - dxys + dxxs*(x+2),
-                            oxs - dxys + dxxs*(x+3) };
-        uint16_t dy4[4] = { oys - dyys + dyxs*(x+0),
-                            oys - dyys + dyxs*(x+1),
-                            oys - dyys + dyxs*(x+2),
-                            oys - dyys + dyxs*(x+3) };
-
-        for(y=0; y<h; y++){
-            __asm__ volatile(
-                "movq   %0,  %%mm4 \n\t"
-                "movq   %1,  %%mm5 \n\t"
-                "paddw  %2,  %%mm4 \n\t"
-                "paddw  %3,  %%mm5 \n\t"
-                "movq   %%mm4, %0  \n\t"
-                "movq   %%mm5, %1  \n\t"
-                "psrlw  $12, %%mm4 \n\t"
-                "psrlw  $12, %%mm5 \n\t"
-                : "+m"(*dx4), "+m"(*dy4)
-                : "m"(*dxy4), "m"(*dyy4)
-            );
-
-            __asm__ volatile(
-                "movq   %%mm6, %%mm2 \n\t"
-                "movq   %%mm6, %%mm1 \n\t"
-                "psubw  %%mm4, %%mm2 \n\t"
-                "psubw  %%mm5, %%mm1 \n\t"
-                "movq   %%mm2, %%mm0 \n\t"
-                "movq   %%mm4, %%mm3 \n\t"
-                "pmullw %%mm1, %%mm0 \n\t" // (s-dx)*(s-dy)
-                "pmullw %%mm5, %%mm3 \n\t" // dx*dy
-                "pmullw %%mm5, %%mm2 \n\t" // (s-dx)*dy
-                "pmullw %%mm4, %%mm1 \n\t" // dx*(s-dy)
-
-                "movd   %4,    %%mm5 \n\t"
-                "movd   %3,    %%mm4 \n\t"
-                "punpcklbw %%mm7, %%mm5 \n\t"
-                "punpcklbw %%mm7, %%mm4 \n\t"
-                "pmullw %%mm5, %%mm3 \n\t" // src[1,1] * dx*dy
-                "pmullw %%mm4, %%mm2 \n\t" // src[0,1] * (s-dx)*dy
-
-                "movd   %2,    %%mm5 \n\t"
-                "movd   %1,    %%mm4 \n\t"
-                "punpcklbw %%mm7, %%mm5 \n\t"
-                "punpcklbw %%mm7, %%mm4 \n\t"
-                "pmullw %%mm5, %%mm1 \n\t" // src[1,0] * dx*(s-dy)
-                "pmullw %%mm4, %%mm0 \n\t" // src[0,0] * (s-dx)*(s-dy)
-                "paddw  %5,    %%mm1 \n\t"
-                "paddw  %%mm3, %%mm2 \n\t"
-                "paddw  %%mm1, %%mm0 \n\t"
-                "paddw  %%mm2, %%mm0 \n\t"
-
-                "psrlw    %6,    %%mm0 \n\t"
-                "packuswb %%mm0, %%mm0 \n\t"
-                "movd     %%mm0, %0    \n\t"
-
-                : "=m"(dst[x+y*stride])
-                : "m"(src[0]), "m"(src[1]),
-                  "m"(src[stride]), "m"(src[stride+1]),
-                  "m"(*r4), "m"(shift2)
-            );
-            src += stride;
-        }
-        src += 4-h*stride;
-    }
-}
-
-#define PREFETCH(name, op) \
-static void name(void *mem, int stride, int h){\
-    const uint8_t *p= mem;\
-    do{\
-        __asm__ volatile(#op" %0" :: "m"(*p));\
-        p+= stride;\
-    }while(--h);\
-}
-PREFETCH(prefetch_mmx2,  prefetcht0)
-PREFETCH(prefetch_3dnow, prefetch)
-#undef PREFETCH
-
-#include "h264dsp_mmx.c"
-#include "rv40dsp_mmx.c"
-
-/* CAVS specific */
-void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
-    put_pixels8_mmx(dst, src, stride, 8);
-}
-void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
-    avg_pixels8_mmx(dst, src, stride, 8);
-}
-void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
-    put_pixels16_mmx(dst, src, stride, 16);
-}
-void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride) {
-    avg_pixels16_mmx(dst, src, stride, 16);
-}
-
-/* VC1 specific */
-void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    put_pixels8_mmx(dst, src, stride, 8);
-}
-void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    avg_pixels8_mmx2(dst, src, stride, 8);
-}
-
-/* XXX: those functions should be suppressed ASAP when all IDCTs are
-   converted */
-#if CONFIG_GPL
-static void ff_libmpeg2mmx_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_mmx_idct (block);
-    put_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_libmpeg2mmx_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_mmx_idct (block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_libmpeg2mmx2_idct_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_mmxext_idct (block);
-    put_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_libmpeg2mmx2_idct_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_mmxext_idct (block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
-#endif
-static void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_idct_xvid_mmx (block);
-    put_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_idct_xvid_mmx (block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_idct_xvid_mmx2_put(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_idct_xvid_mmx2 (block);
-    put_pixels_clamped_mmx(block, dest, line_size);
-}
-static void ff_idct_xvid_mmx2_add(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_idct_xvid_mmx2 (block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
-
-static void vorbis_inverse_coupling_3dnow(float *mag, float *ang, int blocksize)
-{
-    int i;
-    __asm__ volatile("pxor %%mm7, %%mm7":);
-    for(i=0; i<blocksize; i+=2) {
-        __asm__ volatile(
-            "movq    %0,    %%mm0 \n\t"
-            "movq    %1,    %%mm1 \n\t"
-            "movq    %%mm0, %%mm2 \n\t"
-            "movq    %%mm1, %%mm3 \n\t"
-            "pfcmpge %%mm7, %%mm2 \n\t" // m <= 0.0
-            "pfcmpge %%mm7, %%mm3 \n\t" // a <= 0.0
-            "pslld   $31,   %%mm2 \n\t" // keep only the sign bit
-            "pxor    %%mm2, %%mm1 \n\t"
-            "movq    %%mm3, %%mm4 \n\t"
-            "pand    %%mm1, %%mm3 \n\t"
-            "pandn   %%mm1, %%mm4 \n\t"
-            "pfadd   %%mm0, %%mm3 \n\t" // a = m + ((a<0) & (a ^ sign(m)))
-            "pfsub   %%mm4, %%mm0 \n\t" // m = m + ((a>0) & (a ^ sign(m)))
-            "movq    %%mm3, %1    \n\t"
-            "movq    %%mm0, %0    \n\t"
-            :"+m"(mag[i]), "+m"(ang[i])
-            ::"memory"
-        );
-    }
-    __asm__ volatile("femms");
-}
-static void vorbis_inverse_coupling_sse(float *mag, float *ang, int blocksize)
-{
-    int i;
-
-    __asm__ volatile(
-            "movaps  %0,     %%xmm5 \n\t"
-        ::"m"(ff_pdw_80000000[0])
-    );
-    for(i=0; i<blocksize; i+=4) {
-        __asm__ volatile(
-            "movaps  %0,     %%xmm0 \n\t"
-            "movaps  %1,     %%xmm1 \n\t"
-            "xorps   %%xmm2, %%xmm2 \n\t"
-            "xorps   %%xmm3, %%xmm3 \n\t"
-            "cmpleps %%xmm0, %%xmm2 \n\t" // m <= 0.0
-            "cmpleps %%xmm1, %%xmm3 \n\t" // a <= 0.0
-            "andps   %%xmm5, %%xmm2 \n\t" // keep only the sign bit
-            "xorps   %%xmm2, %%xmm1 \n\t"
-            "movaps  %%xmm3, %%xmm4 \n\t"
-            "andps   %%xmm1, %%xmm3 \n\t"
-            "andnps  %%xmm1, %%xmm4 \n\t"
-            "addps   %%xmm0, %%xmm3 \n\t" // a = m + ((a<0) & (a ^ sign(m)))
-            "subps   %%xmm4, %%xmm0 \n\t" // m = m + ((a>0) & (a ^ sign(m)))
-            "movaps  %%xmm3, %1     \n\t"
-            "movaps  %%xmm0, %0     \n\t"
-            :"+m"(mag[i]), "+m"(ang[i])
-            ::"memory"
-        );
-    }
-}
-
-#define IF1(x) x
-#define IF0(x)
-
-#define MIX5(mono,stereo)\
-    __asm__ volatile(\
-        "movss          0(%2), %%xmm5 \n"\
-        "movss          8(%2), %%xmm6 \n"\
-        "movss         24(%2), %%xmm7 \n"\
-        "shufps    $0, %%xmm5, %%xmm5 \n"\
-        "shufps    $0, %%xmm6, %%xmm6 \n"\
-        "shufps    $0, %%xmm7, %%xmm7 \n"\
-        "1: \n"\
-        "movaps       (%0,%1), %%xmm0 \n"\
-        "movaps  0x400(%0,%1), %%xmm1 \n"\
-        "movaps  0x800(%0,%1), %%xmm2 \n"\
-        "movaps  0xc00(%0,%1), %%xmm3 \n"\
-        "movaps 0x1000(%0,%1), %%xmm4 \n"\
-        "mulps         %%xmm5, %%xmm0 \n"\
-        "mulps         %%xmm6, %%xmm1 \n"\
-        "mulps         %%xmm5, %%xmm2 \n"\
-        "mulps         %%xmm7, %%xmm3 \n"\
-        "mulps         %%xmm7, %%xmm4 \n"\
- stereo("addps         %%xmm1, %%xmm0 \n")\
-        "addps         %%xmm1, %%xmm2 \n"\
-        "addps         %%xmm3, %%xmm0 \n"\
-        "addps         %%xmm4, %%xmm2 \n"\
-   mono("addps         %%xmm2, %%xmm0 \n")\
-        "movaps  %%xmm0,      (%0,%1) \n"\
- stereo("movaps  %%xmm2, 0x400(%0,%1) \n")\
-        "add $16, %0 \n"\
-        "jl 1b \n"\
-        :"+&r"(i)\
-        :"r"(samples[0]+len), "r"(matrix)\
-        :"memory"\
-    );
-
-#define MIX_MISC(stereo)\
-    __asm__ volatile(\
-        "1: \n"\
-        "movaps  (%3,%0), %%xmm0 \n"\
- stereo("movaps   %%xmm0, %%xmm1 \n")\
-        "mulps    %%xmm6, %%xmm0 \n"\
- stereo("mulps    %%xmm7, %%xmm1 \n")\
-        "lea 1024(%3,%0), %1 \n"\
-        "mov %5, %2 \n"\
-        "2: \n"\
-        "movaps   (%1),   %%xmm2 \n"\
- stereo("movaps   %%xmm2, %%xmm3 \n")\
-        "mulps   (%4,%2), %%xmm2 \n"\
- stereo("mulps 16(%4,%2), %%xmm3 \n")\
-        "addps    %%xmm2, %%xmm0 \n"\
- stereo("addps    %%xmm3, %%xmm1 \n")\
-        "add $1024, %1 \n"\
-        "add $32, %2 \n"\
-        "jl 2b \n"\
-        "movaps   %%xmm0,     (%3,%0) \n"\
- stereo("movaps   %%xmm1, 1024(%3,%0) \n")\
-        "add $16, %0 \n"\
-        "jl 1b \n"\
-        :"+&r"(i), "=&r"(j), "=&r"(k)\
-        :"r"(samples[0]+len), "r"(matrix_simd+in_ch), "g"((intptr_t)-32*(in_ch-1))\
-        :"memory"\
-    );
-
-static void ac3_downmix_sse(float (*samples)[256], float (*matrix)[2], int out_ch, int in_ch, int len)
-{
-    int (*matrix_cmp)[2] = (int(*)[2])matrix;
-    intptr_t i,j,k;
-
-    i = -len*sizeof(float);
-    if(in_ch == 5 && out_ch == 2 && !(matrix_cmp[0][1]|matrix_cmp[2][0]|matrix_cmp[3][1]|matrix_cmp[4][0]|(matrix_cmp[1][0]^matrix_cmp[1][1])|(matrix_cmp[0][0]^matrix_cmp[2][1]))) {
-        MIX5(IF0,IF1);
-    } else if(in_ch == 5 && out_ch == 1 && matrix_cmp[0][0]==matrix_cmp[2][0] && matrix_cmp[3][0]==matrix_cmp[4][0]) {
-        MIX5(IF1,IF0);
-    } else {
-        DECLARE_ALIGNED(16, float, matrix_simd)[in_ch][2][4];
-        j = 2*in_ch*sizeof(float);
-        __asm__ volatile(
-            "1: \n"
-            "sub $8, %0 \n"
-            "movss     (%2,%0), %%xmm6 \n"
-            "movss    4(%2,%0), %%xmm7 \n"
-            "shufps $0, %%xmm6, %%xmm6 \n"
-            "shufps $0, %%xmm7, %%xmm7 \n"
-            "movaps %%xmm6,   (%1,%0,4) \n"
-            "movaps %%xmm7, 16(%1,%0,4) \n"
-            "jg 1b \n"
-            :"+&r"(j)
-            :"r"(matrix_simd), "r"(matrix)
-            :"memory"
-        );
-        if(out_ch == 2) {
-            MIX_MISC(IF1);
-        } else {
-            MIX_MISC(IF0);
-        }
-    }
-}
-
-static void vector_fmul_3dnow(float *dst, const float *src, int len){
-    x86_reg i = (len-4)*4;
-    __asm__ volatile(
-        "1: \n\t"
-        "movq    (%1,%0), %%mm0 \n\t"
-        "movq   8(%1,%0), %%mm1 \n\t"
-        "pfmul   (%2,%0), %%mm0 \n\t"
-        "pfmul  8(%2,%0), %%mm1 \n\t"
-        "movq   %%mm0,  (%1,%0) \n\t"
-        "movq   %%mm1, 8(%1,%0) \n\t"
-        "sub  $16, %0 \n\t"
-        "jge 1b \n\t"
-        "femms  \n\t"
-        :"+r"(i)
-        :"r"(dst), "r"(src)
-        :"memory"
-    );
-}
-static void vector_fmul_sse(float *dst, const float *src, int len){
-    x86_reg i = (len-8)*4;
-    __asm__ volatile(
-        "1: \n\t"
-        "movaps    (%1,%0), %%xmm0 \n\t"
-        "movaps  16(%1,%0), %%xmm1 \n\t"
-        "mulps     (%2,%0), %%xmm0 \n\t"
-        "mulps   16(%2,%0), %%xmm1 \n\t"
-        "movaps  %%xmm0,   (%1,%0) \n\t"
-        "movaps  %%xmm1, 16(%1,%0) \n\t"
-        "sub  $32, %0 \n\t"
-        "jge 1b \n\t"
-        :"+r"(i)
-        :"r"(dst), "r"(src)
-        :"memory"
-    );
-}
-
-static void vector_fmul_reverse_3dnow2(float *dst, const float *src0, const float *src1, int len){
-    x86_reg i = len*4-16;
-    __asm__ volatile(
-        "1: \n\t"
-        "pswapd   8(%1), %%mm0 \n\t"
-        "pswapd    (%1), %%mm1 \n\t"
-        "pfmul  (%3,%0), %%mm0 \n\t"
-        "pfmul 8(%3,%0), %%mm1 \n\t"
-        "movq  %%mm0,  (%2,%0) \n\t"
-        "movq  %%mm1, 8(%2,%0) \n\t"
-        "add   $16, %1 \n\t"
-        "sub   $16, %0 \n\t"
-        "jge   1b \n\t"
-        :"+r"(i), "+r"(src1)
-        :"r"(dst), "r"(src0)
-    );
-    __asm__ volatile("femms");
-}
-static void vector_fmul_reverse_sse(float *dst, const float *src0, const float *src1, int len){
-    x86_reg i = len*4-32;
-    __asm__ volatile(
-        "1: \n\t"
-        "movaps        16(%1), %%xmm0 \n\t"
-        "movaps          (%1), %%xmm1 \n\t"
-        "shufps $0x1b, %%xmm0, %%xmm0 \n\t"
-        "shufps $0x1b, %%xmm1, %%xmm1 \n\t"
-        "mulps        (%3,%0), %%xmm0 \n\t"
-        "mulps      16(%3,%0), %%xmm1 \n\t"
-        "movaps     %%xmm0,   (%2,%0) \n\t"
-        "movaps     %%xmm1, 16(%2,%0) \n\t"
-        "add    $32, %1 \n\t"
-        "sub    $32, %0 \n\t"
-        "jge    1b \n\t"
-        :"+r"(i), "+r"(src1)
-        :"r"(dst), "r"(src0)
-    );
-}
-
-static void vector_fmul_add_3dnow(float *dst, const float *src0, const float *src1,
-                                  const float *src2, int len){
-    x86_reg i = (len-4)*4;
-    __asm__ volatile(
-        "1: \n\t"
-        "movq    (%2,%0), %%mm0 \n\t"
-        "movq   8(%2,%0), %%mm1 \n\t"
-        "pfmul   (%3,%0), %%mm0 \n\t"
-        "pfmul  8(%3,%0), %%mm1 \n\t"
-        "pfadd   (%4,%0), %%mm0 \n\t"
-        "pfadd  8(%4,%0), %%mm1 \n\t"
-        "movq  %%mm0,   (%1,%0) \n\t"
-        "movq  %%mm1,  8(%1,%0) \n\t"
-        "sub  $16, %0 \n\t"
-        "jge  1b \n\t"
-        :"+r"(i)
-        :"r"(dst), "r"(src0), "r"(src1), "r"(src2)
-        :"memory"
-    );
-    __asm__ volatile("femms");
-}
-static void vector_fmul_add_sse(float *dst, const float *src0, const float *src1,
-                                const float *src2, int len){
-    x86_reg i = (len-8)*4;
-    __asm__ volatile(
-        "1: \n\t"
-        "movaps   (%2,%0), %%xmm0 \n\t"
-        "movaps 16(%2,%0), %%xmm1 \n\t"
-        "mulps    (%3,%0), %%xmm0 \n\t"
-        "mulps  16(%3,%0), %%xmm1 \n\t"
-        "addps    (%4,%0), %%xmm0 \n\t"
-        "addps  16(%4,%0), %%xmm1 \n\t"
-        "movaps %%xmm0,   (%1,%0) \n\t"
-        "movaps %%xmm1, 16(%1,%0) \n\t"
-        "sub  $32, %0 \n\t"
-        "jge  1b \n\t"
-        :"+r"(i)
-        :"r"(dst), "r"(src0), "r"(src1), "r"(src2)
-        :"memory"
-    );
-}
-
-static void vector_fmul_window_3dnow2(float *dst, const float *src0, const float *src1,
-                                      const float *win, float add_bias, int len){
-#if HAVE_6REGS
-    if(add_bias == 0){
-        x86_reg i = -len*4;
-        x86_reg j = len*4-8;
-        __asm__ volatile(
-            "1: \n"
-            "pswapd  (%5,%1), %%mm1 \n"
-            "movq    (%5,%0), %%mm0 \n"
-            "pswapd  (%4,%1), %%mm5 \n"
-            "movq    (%3,%0), %%mm4 \n"
-            "movq      %%mm0, %%mm2 \n"
-            "movq      %%mm1, %%mm3 \n"
-            "pfmul     %%mm4, %%mm2 \n" // src0[len+i]*win[len+i]
-            "pfmul     %%mm5, %%mm3 \n" // src1[    j]*win[len+j]
-            "pfmul     %%mm4, %%mm1 \n" // src0[len+i]*win[len+j]
-            "pfmul     %%mm5, %%mm0 \n" // src1[    j]*win[len+i]
-            "pfadd     %%mm3, %%mm2 \n"
-            "pfsub     %%mm0, %%mm1 \n"
-            "pswapd    %%mm2, %%mm2 \n"
-            "movq      %%mm1, (%2,%0) \n"
-            "movq      %%mm2, (%2,%1) \n"
-            "sub $8, %1 \n"
-            "add $8, %0 \n"
-            "jl 1b \n"
-            "femms \n"
-            :"+r"(i), "+r"(j)
-            :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
-        );
-    }else
-#endif
-        ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len);
-}
-
-static void vector_fmul_window_sse(float *dst, const float *src0, const float *src1,
-                                   const float *win, float add_bias, int len){
-#if HAVE_6REGS
-    if(add_bias == 0){
-        x86_reg i = -len*4;
-        x86_reg j = len*4-16;
-        __asm__ volatile(
-            "1: \n"
-            "movaps       (%5,%1), %%xmm1 \n"
-            "movaps       (%5,%0), %%xmm0 \n"
-            "movaps       (%4,%1), %%xmm5 \n"
-            "movaps       (%3,%0), %%xmm4 \n"
-            "shufps $0x1b, %%xmm1, %%xmm1 \n"
-            "shufps $0x1b, %%xmm5, %%xmm5 \n"
-            "movaps        %%xmm0, %%xmm2 \n"
-            "movaps        %%xmm1, %%xmm3 \n"
-            "mulps         %%xmm4, %%xmm2 \n" // src0[len+i]*win[len+i]
-            "mulps         %%xmm5, %%xmm3 \n" // src1[    j]*win[len+j]
-            "mulps         %%xmm4, %%xmm1 \n" // src0[len+i]*win[len+j]
-            "mulps         %%xmm5, %%xmm0 \n" // src1[    j]*win[len+i]
-            "addps         %%xmm3, %%xmm2 \n"
-            "subps         %%xmm0, %%xmm1 \n"
-            "shufps $0x1b, %%xmm2, %%xmm2 \n"
-            "movaps        %%xmm1, (%2,%0) \n"
-            "movaps        %%xmm2, (%2,%1) \n"
-            "sub $16, %1 \n"
-            "add $16, %0 \n"
-            "jl 1b \n"
-            :"+r"(i), "+r"(j)
-            :"r"(dst+len), "r"(src0+len), "r"(src1), "r"(win+len)
-        );
-    }else
-#endif
-        ff_vector_fmul_window_c(dst, src0, src1, win, add_bias, len);
-}
-
-static void int32_to_float_fmul_scalar_sse(float *dst, const int *src, float mul, int len)
-{
-    x86_reg i = -4*len;
-    __asm__ volatile(
-        "movss  %3, %%xmm4 \n"
-        "shufps $0, %%xmm4, %%xmm4 \n"
-        "1: \n"
-        "cvtpi2ps   (%2,%0), %%xmm0 \n"
-        "cvtpi2ps  8(%2,%0), %%xmm1 \n"
-        "cvtpi2ps 16(%2,%0), %%xmm2 \n"
-        "cvtpi2ps 24(%2,%0), %%xmm3 \n"
-        "movlhps  %%xmm1,    %%xmm0 \n"
-        "movlhps  %%xmm3,    %%xmm2 \n"
-        "mulps    %%xmm4,    %%xmm0 \n"
-        "mulps    %%xmm4,    %%xmm2 \n"
-        "movaps   %%xmm0,   (%1,%0) \n"
-        "movaps   %%xmm2, 16(%1,%0) \n"
-        "add $32, %0 \n"
-        "jl 1b \n"
-        :"+r"(i)
-        :"r"(dst+len), "r"(src+len), "m"(mul)
-    );
-}
-
-static void int32_to_float_fmul_scalar_sse2(float *dst, const int *src, float mul, int len)
-{
-    x86_reg i = -4*len;
-    __asm__ volatile(
-        "movss  %3, %%xmm4 \n"
-        "shufps $0, %%xmm4, %%xmm4 \n"
-        "1: \n"
-        "cvtdq2ps   (%2,%0), %%xmm0 \n"
-        "cvtdq2ps 16(%2,%0), %%xmm1 \n"
-        "mulps    %%xmm4,    %%xmm0 \n"
-        "mulps    %%xmm4,    %%xmm1 \n"
-        "movaps   %%xmm0,   (%1,%0) \n"
-        "movaps   %%xmm1, 16(%1,%0) \n"
-        "add $32, %0 \n"
-        "jl 1b \n"
-        :"+r"(i)
-        :"r"(dst+len), "r"(src+len), "m"(mul)
-    );
-}
-
-static void vector_clipf_sse(float *dst, const float *src, float min, float max,
-                             int len)
-{
-    x86_reg i = (len-16)*4;
-    __asm__ volatile(
-        "movss  %3, %%xmm4 \n"
-        "movss  %4, %%xmm5 \n"
-        "shufps $0, %%xmm4, %%xmm4 \n"
-        "shufps $0, %%xmm5, %%xmm5 \n"
-        "1: \n\t"
-        "movaps    (%2,%0), %%xmm0 \n\t" // 3/1 on intel
-        "movaps  16(%2,%0), %%xmm1 \n\t"
-        "movaps  32(%2,%0), %%xmm2 \n\t"
-        "movaps  48(%2,%0), %%xmm3 \n\t"
-        "maxps      %%xmm4, %%xmm0 \n\t"
-        "maxps      %%xmm4, %%xmm1 \n\t"
-        "maxps      %%xmm4, %%xmm2 \n\t"
-        "maxps      %%xmm4, %%xmm3 \n\t"
-        "minps      %%xmm5, %%xmm0 \n\t"
-        "minps      %%xmm5, %%xmm1 \n\t"
-        "minps      %%xmm5, %%xmm2 \n\t"
-        "minps      %%xmm5, %%xmm3 \n\t"
-        "movaps  %%xmm0,   (%1,%0) \n\t"
-        "movaps  %%xmm1, 16(%1,%0) \n\t"
-        "movaps  %%xmm2, 32(%1,%0) \n\t"
-        "movaps  %%xmm3, 48(%1,%0) \n\t"
-        "sub  $64, %0 \n\t"
-        "jge 1b \n\t"
-        :"+&r"(i)
-        :"r"(dst), "r"(src), "m"(min), "m"(max)
-        :"memory"
-    );
-}
-
-static void float_to_int16_3dnow(int16_t *dst, const float *src, long len){
-    x86_reg reglen = len;
-    // not bit-exact: pf2id uses different rounding than C and SSE
-    __asm__ volatile(
-        "add        %0          , %0        \n\t"
-        "lea         (%2,%0,2)  , %2        \n\t"
-        "add        %0          , %1        \n\t"
-        "neg        %0                      \n\t"
-        "1:                                 \n\t"
-        "pf2id       (%2,%0,2)  , %%mm0     \n\t"
-        "pf2id      8(%2,%0,2)  , %%mm1     \n\t"
-        "pf2id     16(%2,%0,2)  , %%mm2     \n\t"
-        "pf2id     24(%2,%0,2)  , %%mm3     \n\t"
-        "packssdw   %%mm1       , %%mm0     \n\t"
-        "packssdw   %%mm3       , %%mm2     \n\t"
-        "movq       %%mm0       ,  (%1,%0)  \n\t"
-        "movq       %%mm2       , 8(%1,%0)  \n\t"
-        "add        $16         , %0        \n\t"
-        " js 1b                             \n\t"
-        "femms                              \n\t"
-        :"+r"(reglen), "+r"(dst), "+r"(src)
-    );
-}
-static void float_to_int16_sse(int16_t *dst, const float *src, long len){
-    x86_reg reglen = len;
-    __asm__ volatile(
-        "add        %0          , %0        \n\t"
-        "lea         (%2,%0,2)  , %2        \n\t"
-        "add        %0          , %1        \n\t"
-        "neg        %0                      \n\t"
-        "1:                                 \n\t"
-        "cvtps2pi    (%2,%0,2)  , %%mm0     \n\t"
-        "cvtps2pi   8(%2,%0,2)  , %%mm1     \n\t"
-        "cvtps2pi  16(%2,%0,2)  , %%mm2     \n\t"
-        "cvtps2pi  24(%2,%0,2)  , %%mm3     \n\t"
-        "packssdw   %%mm1       , %%mm0     \n\t"
-        "packssdw   %%mm3       , %%mm2     \n\t"
-        "movq       %%mm0       ,  (%1,%0)  \n\t"
-        "movq       %%mm2       , 8(%1,%0)  \n\t"
-        "add        $16         , %0        \n\t"
-        " js 1b                             \n\t"
-        "emms                               \n\t"
-        :"+r"(reglen), "+r"(dst), "+r"(src)
-    );
-}
-
-static void float_to_int16_sse2(int16_t *dst, const float *src, long len){
-    x86_reg reglen = len;
-    __asm__ volatile(
-        "add        %0          , %0        \n\t"
-        "lea         (%2,%0,2)  , %2        \n\t"
-        "add        %0          , %1        \n\t"
-        "neg        %0                      \n\t"
-        "1:                                 \n\t"
-        "cvtps2dq    (%2,%0,2)  , %%xmm0    \n\t"
-        "cvtps2dq  16(%2,%0,2)  , %%xmm1    \n\t"
-        "packssdw   %%xmm1      , %%xmm0    \n\t"
-        "movdqa     %%xmm0      ,  (%1,%0)  \n\t"
-        "add        $16         , %0        \n\t"
-        " js 1b                             \n\t"
-        :"+r"(reglen), "+r"(dst), "+r"(src)
-    );
-}
-
-void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len);
-void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len);
-void ff_float_to_int16_interleave6_3dn2(int16_t *dst, const float **src, int len);
-int32_t ff_scalarproduct_int16_mmx2(int16_t *v1, int16_t *v2, int order, int shift);
-int32_t ff_scalarproduct_int16_sse2(int16_t *v1, int16_t *v2, int order, int shift);
-int32_t ff_scalarproduct_and_madd_int16_mmx2(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul);
-int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul);
-int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul);
-void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top);
-int  ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, int w, int left);
-int  ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, int left);
-void ff_x264_deblock_v_luma_sse2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0);
-void ff_x264_deblock_h_luma_sse2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0);
-void ff_x264_deblock_h_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta);
-void ff_x264_deblock_v_luma_intra_sse2(uint8_t *pix, int stride, int alpha, int beta);
-void ff_x264_deblock_h_luma_intra_sse2(uint8_t *pix, int stride, int alpha, int beta);
-
-#if HAVE_YASM && ARCH_X86_32
-void ff_x264_deblock_v8_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta);
-static void ff_x264_deblock_v_luma_intra_mmxext(uint8_t *pix, int stride, int alpha, int beta)
-{
-    ff_x264_deblock_v8_luma_intra_mmxext(pix+0, stride, alpha, beta);
-    ff_x264_deblock_v8_luma_intra_mmxext(pix+8, stride, alpha, beta);
-}
-#elif !HAVE_YASM
-#define ff_float_to_int16_interleave6_sse(a,b,c)   float_to_int16_interleave_misc_sse(a,b,c,6)
-#define ff_float_to_int16_interleave6_3dnow(a,b,c) float_to_int16_interleave_misc_3dnow(a,b,c,6)
-#define ff_float_to_int16_interleave6_3dn2(a,b,c)  float_to_int16_interleave_misc_3dnow(a,b,c,6)
-#endif
-#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse
-
-#define FLOAT_TO_INT16_INTERLEAVE(cpu, body) \
-/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\
-static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\
-    DECLARE_ALIGNED(16, int16_t, tmp)[len];\
-    int i,j,c;\
-    for(c=0; c<channels; c++){\
-        float_to_int16_##cpu(tmp, src[c], len);\
-        for(i=0, j=c; i<len; i++, j+=channels)\
-            dst[j] = tmp[i];\
-    }\
-}\
-\
-static void float_to_int16_interleave_##cpu(int16_t *dst, const float **src, long len, int channels){\
-    if(channels==1)\
-        float_to_int16_##cpu(dst, src[0], len);\
-    else if(channels==2){\
-        x86_reg reglen = len; \
-        const float *src0 = src[0];\
-        const float *src1 = src[1];\
-        __asm__ volatile(\
-            "shl $2, %0 \n"\
-            "add %0, %1 \n"\
-            "add %0, %2 \n"\
-            "add %0, %3 \n"\
-            "neg %0 \n"\
-            body\
-            :"+r"(reglen), "+r"(dst), "+r"(src0), "+r"(src1)\
-        );\
-    }else if(channels==6){\
-        ff_float_to_int16_interleave6_##cpu(dst, src, len);\
-    }else\
-        float_to_int16_interleave_misc_##cpu(dst, src, len, channels);\
-}
-
-FLOAT_TO_INT16_INTERLEAVE(3dnow,
-    "1:                         \n"
-    "pf2id     (%2,%0), %%mm0   \n"
-    "pf2id    8(%2,%0), %%mm1   \n"
-    "pf2id     (%3,%0), %%mm2   \n"
-    "pf2id    8(%3,%0), %%mm3   \n"
-    "packssdw    %%mm1, %%mm0   \n"
-    "packssdw    %%mm3, %%mm2   \n"
-    "movq        %%mm0, %%mm1   \n"
-    "punpcklwd   %%mm2, %%mm0   \n"
-    "punpckhwd   %%mm2, %%mm1   \n"
-    "movq        %%mm0,  (%1,%0)\n"
-    "movq        %%mm1, 8(%1,%0)\n"
-    "add $16, %0                \n"
-    "js 1b                      \n"
-    "femms                      \n"
-)
-
-FLOAT_TO_INT16_INTERLEAVE(sse,
-    "1:                         \n"
-    "cvtps2pi  (%2,%0), %%mm0   \n"
-    "cvtps2pi 8(%2,%0), %%mm1   \n"
-    "cvtps2pi  (%3,%0), %%mm2   \n"
-    "cvtps2pi 8(%3,%0), %%mm3   \n"
-    "packssdw    %%mm1, %%mm0   \n"
-    "packssdw    %%mm3, %%mm2   \n"
-    "movq        %%mm0, %%mm1   \n"
-    "punpcklwd   %%mm2, %%mm0   \n"
-    "punpckhwd   %%mm2, %%mm1   \n"
-    "movq        %%mm0,  (%1,%0)\n"
-    "movq        %%mm1, 8(%1,%0)\n"
-    "add $16, %0                \n"
-    "js 1b                      \n"
-    "emms                       \n"
-)
-
-FLOAT_TO_INT16_INTERLEAVE(sse2,
-    "1:                         \n"
-    "cvtps2dq  (%2,%0), %%xmm0  \n"
-    "cvtps2dq  (%3,%0), %%xmm1  \n"
-    "packssdw   %%xmm1, %%xmm0  \n"
-    "movhlps    %%xmm0, %%xmm1  \n"
-    "punpcklwd  %%xmm1, %%xmm0  \n"
-    "movdqa     %%xmm0, (%1,%0) \n"
-    "add $16, %0                \n"
-    "js 1b                      \n"
-)
-
-static void float_to_int16_interleave_3dn2(int16_t *dst, const float **src, long len, int channels){
-    if(channels==6)
-        ff_float_to_int16_interleave6_3dn2(dst, src, len);
-    else
-        float_to_int16_interleave_3dnow(dst, src, len, channels);
-}
-
-float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order);
-
-void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
-{
-    mm_flags = mm_support();
-
-    if (avctx->dsp_mask) {
-        if (avctx->dsp_mask & FF_MM_FORCE)
-            mm_flags |= (avctx->dsp_mask & 0xffff);
-        else
-            mm_flags &= ~(avctx->dsp_mask & 0xffff);
-    }
-
-#if 0
-    av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:");
-    if (mm_flags & FF_MM_MMX)
-        av_log(avctx, AV_LOG_INFO, " mmx");
-    if (mm_flags & FF_MM_MMX2)
-        av_log(avctx, AV_LOG_INFO, " mmx2");
-    if (mm_flags & FF_MM_3DNOW)
-        av_log(avctx, AV_LOG_INFO, " 3dnow");
-    if (mm_flags & FF_MM_SSE)
-        av_log(avctx, AV_LOG_INFO, " sse");
-    if (mm_flags & FF_MM_SSE2)
-        av_log(avctx, AV_LOG_INFO, " sse2");
-    av_log(avctx, AV_LOG_INFO, "\n");
-#endif
-
-    if (mm_flags & FF_MM_MMX) {
-        const int idct_algo= avctx->idct_algo;
-
-        if(avctx->lowres==0){
-            if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){
-                c->idct_put= ff_simple_idct_put_mmx;
-                c->idct_add= ff_simple_idct_add_mmx;
-                c->idct    = ff_simple_idct_mmx;
-                c->idct_permutation_type= FF_SIMPLE_IDCT_PERM;
-#if CONFIG_GPL
-            }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){
-                if(mm_flags & FF_MM_MMX2){
-                    c->idct_put= ff_libmpeg2mmx2_idct_put;
-                    c->idct_add= ff_libmpeg2mmx2_idct_add;
-                    c->idct    = ff_mmxext_idct;
-                }else{
-                    c->idct_put= ff_libmpeg2mmx_idct_put;
-                    c->idct_add= ff_libmpeg2mmx_idct_add;
-                    c->idct    = ff_mmx_idct;
-                }
-                c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
-#endif
-            }else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER) &&
-                     idct_algo==FF_IDCT_VP3){
-                if(mm_flags & FF_MM_SSE2){
-                    c->idct_put= ff_vp3_idct_put_sse2;
-                    c->idct_add= ff_vp3_idct_add_sse2;
-                    c->idct    = ff_vp3_idct_sse2;
-                    c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM;
-                }else{
-                    c->idct_put= ff_vp3_idct_put_mmx;
-                    c->idct_add= ff_vp3_idct_add_mmx;
-                    c->idct    = ff_vp3_idct_mmx;
-                    c->idct_permutation_type= FF_PARTTRANS_IDCT_PERM;
-                }
-            }else if(idct_algo==FF_IDCT_CAVS){
-                    c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM;
-            }else if(idct_algo==FF_IDCT_XVIDMMX){
-                if(mm_flags & FF_MM_SSE2){
-                    c->idct_put= ff_idct_xvid_sse2_put;
-                    c->idct_add= ff_idct_xvid_sse2_add;
-                    c->idct    = ff_idct_xvid_sse2;
-                    c->idct_permutation_type= FF_SSE2_IDCT_PERM;
-                }else if(mm_flags & FF_MM_MMX2){
-                    c->idct_put= ff_idct_xvid_mmx2_put;
-                    c->idct_add= ff_idct_xvid_mmx2_add;
-                    c->idct    = ff_idct_xvid_mmx2;
-                }else{
-                    c->idct_put= ff_idct_xvid_mmx_put;
-                    c->idct_add= ff_idct_xvid_mmx_add;
-                    c->idct    = ff_idct_xvid_mmx;
-                }
-            }
-        }
-
-        c->put_pixels_clamped = put_pixels_clamped_mmx;
-        c->put_signed_pixels_clamped = put_signed_pixels_clamped_mmx;
-        c->add_pixels_clamped = add_pixels_clamped_mmx;
-        c->clear_block  = clear_block_mmx;
-        c->clear_blocks = clear_blocks_mmx;
-        if ((mm_flags & FF_MM_SSE) &&
-            !(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)){
-            /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */
-            c->clear_block  = clear_block_sse;
-            c->clear_blocks = clear_blocks_sse;
-        }
-
-#define SET_HPEL_FUNCS(PFX, IDX, SIZE, CPU) \
-        c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## SIZE ## _ ## CPU; \
-        c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## SIZE ## _x2_ ## CPU; \
-        c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## SIZE ## _y2_ ## CPU; \
-        c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## SIZE ## _xy2_ ## CPU
-
-        SET_HPEL_FUNCS(put, 0, 16, mmx);
-        SET_HPEL_FUNCS(put_no_rnd, 0, 16, mmx);
-        SET_HPEL_FUNCS(avg, 0, 16, mmx);
-        SET_HPEL_FUNCS(avg_no_rnd, 0, 16, mmx);
-        SET_HPEL_FUNCS(put, 1, 8, mmx);
-        SET_HPEL_FUNCS(put_no_rnd, 1, 8, mmx);
-        SET_HPEL_FUNCS(avg, 1, 8, mmx);
-        SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx);
-
-        c->gmc= gmc_mmx;
-
-        c->add_bytes= add_bytes_mmx;
-        c->add_bytes_l2= add_bytes_l2_mmx;
-
-        c->draw_edges = draw_edges_mmx;
-
-        if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
-            c->h263_v_loop_filter= h263_v_loop_filter_mmx;
-            c->h263_h_loop_filter= h263_h_loop_filter_mmx;
-        }
-        c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_rnd;
-        c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_mmx;
-        c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_vc1_chroma_mc8_mmx_nornd;
-
-        c->put_rv40_chroma_pixels_tab[0]= put_rv40_chroma_mc8_mmx;
-        c->put_rv40_chroma_pixels_tab[1]= put_rv40_chroma_mc4_mmx;
-
-        if (CONFIG_VP6_DECODER) {
-            c->vp6_filter_diag4 = ff_vp6_filter_diag4_mmx;
-        }
-
-        if (mm_flags & FF_MM_MMX2) {
-            c->prefetch = prefetch_mmx2;
-
-            c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
-            c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2;
-
-            c->avg_pixels_tab[0][0] = avg_pixels16_mmx2;
-            c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx2;
-            c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2;
-
-            c->put_pixels_tab[1][1] = put_pixels8_x2_mmx2;
-            c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2;
-
-            c->avg_pixels_tab[1][0] = avg_pixels8_mmx2;
-            c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
-            c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
-
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2;
-                c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2;
-                c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2;
-                c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2;
-                c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
-                c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2;
-
-                if (CONFIG_VP3_DECODER) {
-                    c->vp3_v_loop_filter= ff_vp3_v_loop_filter_mmx2;
-                    c->vp3_h_loop_filter= ff_vp3_h_loop_filter_mmx2;
-                }
-            }
-            if (CONFIG_VP3_DECODER) {
-                c->vp3_idct_dc_add = ff_vp3_idct_dc_add_mmx2;
-            }
-
-#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU) \
-            c->PFX ## _pixels_tab[IDX][ 0] = PFX ## SIZE ## _mc00_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 1] = PFX ## SIZE ## _mc10_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 2] = PFX ## SIZE ## _mc20_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 3] = PFX ## SIZE ## _mc30_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 4] = PFX ## SIZE ## _mc01_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 5] = PFX ## SIZE ## _mc11_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 6] = PFX ## SIZE ## _mc21_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 7] = PFX ## SIZE ## _mc31_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 8] = PFX ## SIZE ## _mc02_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][ 9] = PFX ## SIZE ## _mc12_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][10] = PFX ## SIZE ## _mc22_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][11] = PFX ## SIZE ## _mc32_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][12] = PFX ## SIZE ## _mc03_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][13] = PFX ## SIZE ## _mc13_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][14] = PFX ## SIZE ## _mc23_ ## CPU; \
-            c->PFX ## _pixels_tab[IDX][15] = PFX ## SIZE ## _mc33_ ## CPU
-
-            SET_QPEL_FUNCS(put_qpel, 0, 16, mmx2);
-            SET_QPEL_FUNCS(put_qpel, 1, 8, mmx2);
-            SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmx2);
-            SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmx2);
-            SET_QPEL_FUNCS(avg_qpel, 0, 16, mmx2);
-            SET_QPEL_FUNCS(avg_qpel, 1, 8, mmx2);
-
-            SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmx2);
-            SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmx2);
-            SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmx2);
-            SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmx2);
-            SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmx2);
-            SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmx2);
-
-            SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, mmx2);
-            SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, mmx2);
-            SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2);
-            SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2);
-
-            c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_mmx2;
-            c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_mmx2;
-
-            c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_vc1_chroma_mc8_mmx2_nornd;
-
-            c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2_rnd;
-            c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_mmx2;
-            c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_mmx2;
-            c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_mmx2;
-
-#if HAVE_YASM
-            c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmx2;
-#endif
-#if HAVE_7REGS && HAVE_TEN_OPERANDS
-            if( mm_flags&FF_MM_3DNOW )
-                c->add_hfyu_median_prediction = add_hfyu_median_prediction_cmov;
-#endif
-
-            if (CONFIG_CAVS_DECODER)
-                ff_cavsdsp_init_mmx2(c, avctx);
-
-            if (CONFIG_VC1_DECODER)
-                ff_vc1dsp_init_mmx(c, avctx);
-
-            c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2;
-        } else if (mm_flags & FF_MM_3DNOW) {
-            c->prefetch = prefetch_3dnow;
-
-            c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
-            c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;
-
-            c->avg_pixels_tab[0][0] = avg_pixels16_3dnow;
-            c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow;
-            c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow;
-
-            c->put_pixels_tab[1][1] = put_pixels8_x2_3dnow;
-            c->put_pixels_tab[1][2] = put_pixels8_y2_3dnow;
-
-            c->avg_pixels_tab[1][0] = avg_pixels8_3dnow;
-            c->avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow;
-            c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow;
-
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow;
-                c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow;
-                c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow;
-                c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow;
-                c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow;
-                c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow;
-            }
-
-            SET_QPEL_FUNCS(put_qpel, 0, 16, 3dnow);
-            SET_QPEL_FUNCS(put_qpel, 1, 8, 3dnow);
-            SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, 3dnow);
-            SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, 3dnow);
-            SET_QPEL_FUNCS(avg_qpel, 0, 16, 3dnow);
-            SET_QPEL_FUNCS(avg_qpel, 1, 8, 3dnow);
-
-            SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 3dnow);
-            SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 3dnow);
-            SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 3dnow);
-            SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 3dnow);
-            SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 3dnow);
-            SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 3dnow);
-
-            SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, 3dnow);
-            SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, 3dnow);
-            SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow);
-            SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow);
-
-            c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow_rnd;
-            c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow;
-
-            c->avg_rv40_chroma_pixels_tab[0]= avg_rv40_chroma_mc8_3dnow;
-            c->avg_rv40_chroma_pixels_tab[1]= avg_rv40_chroma_mc4_3dnow;
-
-            if (CONFIG_CAVS_DECODER)
-                ff_cavsdsp_init_3dnow(c, avctx);
-        }
-
-
-#define H264_QPEL_FUNCS(x, y, CPU)\
-            c->put_h264_qpel_pixels_tab[0][x+y*4] = put_h264_qpel16_mc##x##y##_##CPU;\
-            c->put_h264_qpel_pixels_tab[1][x+y*4] = put_h264_qpel8_mc##x##y##_##CPU;\
-            c->avg_h264_qpel_pixels_tab[0][x+y*4] = avg_h264_qpel16_mc##x##y##_##CPU;\
-            c->avg_h264_qpel_pixels_tab[1][x+y*4] = avg_h264_qpel8_mc##x##y##_##CPU;
-        if((mm_flags & FF_MM_SSE2) && !(mm_flags & FF_MM_3DNOW)){
-            // these functions are slower than mmx on AMD, but faster on Intel
-            c->put_pixels_tab[0][0] = put_pixels16_sse2;
-            c->avg_pixels_tab[0][0] = avg_pixels16_sse2;
-            H264_QPEL_FUNCS(0, 0, sse2);
-        }
-        if(mm_flags & FF_MM_SSE2){
-            H264_QPEL_FUNCS(0, 1, sse2);
-            H264_QPEL_FUNCS(0, 2, sse2);
-            H264_QPEL_FUNCS(0, 3, sse2);
-            H264_QPEL_FUNCS(1, 1, sse2);
-            H264_QPEL_FUNCS(1, 2, sse2);
-            H264_QPEL_FUNCS(1, 3, sse2);
-            H264_QPEL_FUNCS(2, 1, sse2);
-            H264_QPEL_FUNCS(2, 2, sse2);
-            H264_QPEL_FUNCS(2, 3, sse2);
-            H264_QPEL_FUNCS(3, 1, sse2);
-            H264_QPEL_FUNCS(3, 2, sse2);
-            H264_QPEL_FUNCS(3, 3, sse2);
-
-            if (CONFIG_VP6_DECODER) {
-                c->vp6_filter_diag4 = ff_vp6_filter_diag4_sse2;
-            }
-        }
-#if HAVE_SSSE3
-        if(mm_flags & FF_MM_SSSE3){
-            H264_QPEL_FUNCS(1, 0, ssse3);
-            H264_QPEL_FUNCS(1, 1, ssse3);
-            H264_QPEL_FUNCS(1, 2, ssse3);
-            H264_QPEL_FUNCS(1, 3, ssse3);
-            H264_QPEL_FUNCS(2, 0, ssse3);
-            H264_QPEL_FUNCS(2, 1, ssse3);
-            H264_QPEL_FUNCS(2, 2, ssse3);
-            H264_QPEL_FUNCS(2, 3, ssse3);
-            H264_QPEL_FUNCS(3, 0, ssse3);
-            H264_QPEL_FUNCS(3, 1, ssse3);
-            H264_QPEL_FUNCS(3, 2, ssse3);
-            H264_QPEL_FUNCS(3, 3, ssse3);
-            c->put_no_rnd_vc1_chroma_pixels_tab[0]= put_vc1_chroma_mc8_ssse3_nornd;
-            c->avg_no_rnd_vc1_chroma_pixels_tab[0]= avg_vc1_chroma_mc8_ssse3_nornd;
-            c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_ssse3_rnd;
-            c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_ssse3_rnd;
-            c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_ssse3;
-            c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_ssse3;
-            c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3;
-#if HAVE_YASM
-            c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_ssse3;
-            if (mm_flags & FF_MM_SSE4) // not really sse4, just slow on Conroe
-                c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_sse4;
-#endif
-        }
-#endif
-
-        if(mm_flags & FF_MM_3DNOW){
-            c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow;
-            c->vector_fmul = vector_fmul_3dnow;
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->float_to_int16 = float_to_int16_3dnow;
-                c->float_to_int16_interleave = float_to_int16_interleave_3dnow;
-            }
-        }
-        if(mm_flags & FF_MM_3DNOWEXT){
-            c->vector_fmul_reverse = vector_fmul_reverse_3dnow2;
-            c->vector_fmul_window = vector_fmul_window_3dnow2;
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->float_to_int16_interleave = float_to_int16_interleave_3dn2;
-            }
-        }
-        if(mm_flags & FF_MM_MMX2){
-#if HAVE_YASM
-            c->scalarproduct_int16 = ff_scalarproduct_int16_mmx2;
-            c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmx2;
-#endif
-        }
-        if(mm_flags & FF_MM_SSE){
-            c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse;
-            c->ac3_downmix = ac3_downmix_sse;
-            c->vector_fmul = vector_fmul_sse;
-            c->vector_fmul_reverse = vector_fmul_reverse_sse;
-            c->vector_fmul_add = vector_fmul_add_sse;
-            c->vector_fmul_window = vector_fmul_window_sse;
-            c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse;
-            c->vector_clipf = vector_clipf_sse;
-            c->float_to_int16 = float_to_int16_sse;
-            c->float_to_int16_interleave = float_to_int16_interleave_sse;
-#if HAVE_YASM
-            c->scalarproduct_float = ff_scalarproduct_float_sse;
-#endif
-        }
-        if(mm_flags & FF_MM_3DNOW)
-            c->vector_fmul_add = vector_fmul_add_3dnow; // faster than sse
-        if(mm_flags & FF_MM_SSE2){
-            c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2;
-            c->float_to_int16 = float_to_int16_sse2;
-            c->float_to_int16_interleave = float_to_int16_interleave_sse2;
-#if HAVE_YASM
-            c->scalarproduct_int16 = ff_scalarproduct_int16_sse2;
-            c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2;
-#endif
-        }
-        if((mm_flags & FF_MM_SSSE3) && !(mm_flags & (FF_MM_SSE42|FF_MM_3DNOW)) && HAVE_YASM) // cachesplit
-            c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3;
-    }
-
-    if (CONFIG_ENCODERS)
-        dsputilenc_init_mmx(c, avctx);
-
-#if 0
-    // for speed testing
-    get_pixels = just_return;
-    put_pixels_clamped = just_return;
-    add_pixels_clamped = just_return;
-
-    pix_abs16x16 = just_return;
-    pix_abs16x16_x2 = just_return;
-    pix_abs16x16_y2 = just_return;
-    pix_abs16x16_xy2 = just_return;
-
-    put_pixels_tab[0] = just_return;
-    put_pixels_tab[1] = just_return;
-    put_pixels_tab[2] = just_return;
-    put_pixels_tab[3] = just_return;
-
-    put_no_rnd_pixels_tab[0] = just_return;
-    put_no_rnd_pixels_tab[1] = just_return;
-    put_no_rnd_pixels_tab[2] = just_return;
-    put_no_rnd_pixels_tab[3] = just_return;
-
-    avg_pixels_tab[0] = just_return;
-    avg_pixels_tab[1] = just_return;
-    avg_pixels_tab[2] = just_return;
-    avg_pixels_tab[3] = just_return;
-
-    avg_no_rnd_pixels_tab[0] = just_return;
-    avg_no_rnd_pixels_tab[1] = just_return;
-    avg_no_rnd_pixels_tab[2] = just_return;
-    avg_no_rnd_pixels_tab[3] = just_return;
-
-    //av_fdct = just_return;
-    //ff_idct = just_return;
-#endif
-}
-
-#if CONFIG_H264DSP
-void ff_h264dsp_init_x86(H264DSPContext *c)
-{
-    mm_flags = mm_support();
-
-    if (mm_flags & FF_MM_MMX) {
-        c->h264_idct_dc_add=
-        c->h264_idct_add= ff_h264_idct_add_mmx;
-        c->h264_idct8_dc_add=
-        c->h264_idct8_add= ff_h264_idct8_add_mmx;
-
-        c->h264_idct_add16     = ff_h264_idct_add16_mmx;
-        c->h264_idct8_add4     = ff_h264_idct8_add4_mmx;
-        c->h264_idct_add8      = ff_h264_idct_add8_mmx;
-        c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx;
-
-        if (mm_flags & FF_MM_MMX2) {
-            c->h264_idct_dc_add= ff_h264_idct_dc_add_mmx2;
-            c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2;
-            c->h264_idct_add16     = ff_h264_idct_add16_mmx2;
-            c->h264_idct8_add4     = ff_h264_idct8_add4_mmx2;
-            c->h264_idct_add8      = ff_h264_idct_add8_mmx2;
-            c->h264_idct_add16intra= ff_h264_idct_add16intra_mmx2;
-
-            c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_mmx2;
-            c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_mmx2;
-            c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_mmx2;
-            c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_mmx2;
-            c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_mmx2;
-            c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_mmx2;
-            c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2;
-
-            c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2;
-            c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2;
-            c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_mmx2;
-            c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_mmx2;
-            c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_mmx2;
-            c->weight_h264_pixels_tab[5]= ff_h264_weight_4x8_mmx2;
-            c->weight_h264_pixels_tab[6]= ff_h264_weight_4x4_mmx2;
-            c->weight_h264_pixels_tab[7]= ff_h264_weight_4x2_mmx2;
-
-            c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_mmx2;
-            c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_mmx2;
-            c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_mmx2;
-            c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_mmx2;
-            c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_mmx2;
-            c->biweight_h264_pixels_tab[5]= ff_h264_biweight_4x8_mmx2;
-            c->biweight_h264_pixels_tab[6]= ff_h264_biweight_4x4_mmx2;
-            c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2;
-        }
-        if(mm_flags & FF_MM_SSE2){
-            c->h264_idct8_add = ff_h264_idct8_add_sse2;
-            c->h264_idct8_add4= ff_h264_idct8_add4_sse2;
-        }
-
-#if CONFIG_GPL && HAVE_YASM
-        if (mm_flags & FF_MM_MMX2){
-#if ARCH_X86_32
-            c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_mmxext;
-            c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_mmxext;
-#endif
-            if( mm_flags&FF_MM_SSE2 ){
-#if ARCH_X86_64 || !defined(__ICC) || __ICC > 1110
-                c->h264_v_loop_filter_luma = ff_x264_deblock_v_luma_sse2;
-                c->h264_h_loop_filter_luma = ff_x264_deblock_h_luma_sse2;
-                c->h264_v_loop_filter_luma_intra = ff_x264_deblock_v_luma_intra_sse2;
-                c->h264_h_loop_filter_luma_intra = ff_x264_deblock_h_luma_intra_sse2;
-#endif
-                c->h264_idct_add16 = ff_h264_idct_add16_sse2;
-                c->h264_idct_add8  = ff_h264_idct_add8_sse2;
-                c->h264_idct_add16intra = ff_h264_idct_add16intra_sse2;
-            }
-        }
-#endif
-    }
-}
-#endif /* CONFIG_H264DSP */
diff --git a/libavcodec/x86/dsputil_mmx.h b/libavcodec/x86/dsputil_mmx.h
deleted file mode 100644
index 7d1bf7f..0000000
--- a/libavcodec/x86/dsputil_mmx.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * MMX optimized DSP utils
- * Copyright (c) 2007  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_X86_DSPUTIL_MMX_H
-#define AVCODEC_X86_DSPUTIL_MMX_H
-
-#include <stdint.h>
-#include "libavcodec/dsputil.h"
-
-typedef struct { uint64_t a, b; } xmm_reg;
-
-extern const uint64_t ff_bone;
-extern const uint64_t ff_wtwo;
-
-extern const uint64_t ff_pdw_80000000[2];
-
-extern const uint64_t ff_pw_3;
-extern const uint64_t ff_pw_4;
-extern const xmm_reg  ff_pw_5;
-extern const xmm_reg  ff_pw_8;
-extern const uint64_t ff_pw_15;
-extern const xmm_reg  ff_pw_16;
-extern const uint64_t ff_pw_20;
-extern const xmm_reg  ff_pw_28;
-extern const xmm_reg  ff_pw_32;
-extern const uint64_t ff_pw_42;
-extern const xmm_reg  ff_pw_64;
-extern const uint64_t ff_pw_96;
-extern const uint64_t ff_pw_128;
-extern const uint64_t ff_pw_255;
-
-extern const uint64_t ff_pb_1;
-extern const uint64_t ff_pb_3;
-extern const uint64_t ff_pb_7;
-extern const uint64_t ff_pb_1F;
-extern const uint64_t ff_pb_3F;
-extern const uint64_t ff_pb_81;
-extern const uint64_t ff_pb_A1;
-extern const uint64_t ff_pb_FC;
-
-extern const double ff_pd_1[2];
-extern const double ff_pd_2[2];
-
-#define LOAD4(stride,in,a,b,c,d)\
-    "movq 0*"#stride"+"#in", "#a"\n\t"\
-    "movq 1*"#stride"+"#in", "#b"\n\t"\
-    "movq 2*"#stride"+"#in", "#c"\n\t"\
-    "movq 3*"#stride"+"#in", "#d"\n\t"
-
-#define STORE4(stride,out,a,b,c,d)\
-    "movq "#a", 0*"#stride"+"#out"\n\t"\
-    "movq "#b", 1*"#stride"+"#out"\n\t"\
-    "movq "#c", 2*"#stride"+"#out"\n\t"\
-    "movq "#d", 3*"#stride"+"#out"\n\t"
-
-/* in/out: mma=mma+mmb, mmb=mmb-mma */
-#define SUMSUB_BA( a, b ) \
-    "paddw "#b", "#a" \n\t"\
-    "paddw "#b", "#b" \n\t"\
-    "psubw "#a", "#b" \n\t"
-
-#define SBUTTERFLY(a,b,t,n,m)\
-    "mov" #m " " #a ", " #t "         \n\t" /* abcd */\
-    "punpckl" #n " " #b ", " #a "     \n\t" /* aebf */\
-    "punpckh" #n " " #b ", " #t "     \n\t" /* cgdh */\
-
-#define TRANSPOSE4(a,b,c,d,t)\
-    SBUTTERFLY(a,b,t,wd,q) /* a=aebf t=cgdh */\
-    SBUTTERFLY(c,d,b,wd,q) /* c=imjn b=kolp */\
-    SBUTTERFLY(a,c,d,dq,q) /* a=aeim d=bfjn */\
-    SBUTTERFLY(t,b,c,dq,q) /* t=cgko c=dhlp */
-
-// e,f,g,h can be memory
-// out: a,d,t,c
-#define TRANSPOSE8x4(a,b,c,d,e,f,g,h,t)\
-    "punpcklbw " #e ", " #a " \n\t" /* a0 e0 a1 e1 a2 e2 a3 e3 */\
-    "punpcklbw " #f ", " #b " \n\t" /* b0 f0 b1 f1 b2 f2 b3 f3 */\
-    "punpcklbw " #g ", " #c " \n\t" /* c0 g0 c1 g1 c2 g2 d3 g3 */\
-    "punpcklbw " #h ", " #d " \n\t" /* d0 h0 d1 h1 d2 h2 d3 h3 */\
-    SBUTTERFLY(a, b, t, bw, q)   /* a= a0 b0 e0 f0 a1 b1 e1 f1 */\
-                                 /* t= a2 b2 e2 f2 a3 b3 e3 f3 */\
-    SBUTTERFLY(c, d, b, bw, q)   /* c= c0 d0 g0 h0 c1 d1 g1 h1 */\
-                                 /* b= c2 d2 g2 h2 c3 d3 g3 h3 */\
-    SBUTTERFLY(a, c, d, wd, q)   /* a= a0 b0 c0 d0 e0 f0 g0 h0 */\
-                                 /* d= a1 b1 c1 d1 e1 f1 g1 h1 */\
-    SBUTTERFLY(t, b, c, wd, q)   /* t= a2 b2 c2 d2 e2 f2 g2 h2 */\
-                                 /* c= a3 b3 c3 d3 e3 f3 g3 h3 */
-
-#if ARCH_X86_64
-// permutes 01234567 -> 05736421
-#define TRANSPOSE8(a,b,c,d,e,f,g,h,t)\
-    SBUTTERFLY(a,b,%%xmm8,wd,dqa)\
-    SBUTTERFLY(c,d,b,wd,dqa)\
-    SBUTTERFLY(e,f,d,wd,dqa)\
-    SBUTTERFLY(g,h,f,wd,dqa)\
-    SBUTTERFLY(a,c,h,dq,dqa)\
-    SBUTTERFLY(%%xmm8,b,c,dq,dqa)\
-    SBUTTERFLY(e,g,b,dq,dqa)\
-    SBUTTERFLY(d,f,g,dq,dqa)\
-    SBUTTERFLY(a,e,f,qdq,dqa)\
-    SBUTTERFLY(%%xmm8,d,e,qdq,dqa)\
-    SBUTTERFLY(h,b,d,qdq,dqa)\
-    SBUTTERFLY(c,g,b,qdq,dqa)\
-    "movdqa %%xmm8, "#g"              \n\t"
-#else
-#define TRANSPOSE8(a,b,c,d,e,f,g,h,t)\
-    "movdqa "#h", "#t"                \n\t"\
-    SBUTTERFLY(a,b,h,wd,dqa)\
-    "movdqa "#h", 16"#t"              \n\t"\
-    "movdqa "#t", "#h"                \n\t"\
-    SBUTTERFLY(c,d,b,wd,dqa)\
-    SBUTTERFLY(e,f,d,wd,dqa)\
-    SBUTTERFLY(g,h,f,wd,dqa)\
-    SBUTTERFLY(a,c,h,dq,dqa)\
-    "movdqa "#h", "#t"                \n\t"\
-    "movdqa 16"#t", "#h"              \n\t"\
-    SBUTTERFLY(h,b,c,dq,dqa)\
-    SBUTTERFLY(e,g,b,dq,dqa)\
-    SBUTTERFLY(d,f,g,dq,dqa)\
-    SBUTTERFLY(a,e,f,qdq,dqa)\
-    SBUTTERFLY(h,d,e,qdq,dqa)\
-    "movdqa "#h", 16"#t"              \n\t"\
-    "movdqa "#t", "#h"                \n\t"\
-    SBUTTERFLY(h,b,d,qdq,dqa)\
-    SBUTTERFLY(c,g,b,qdq,dqa)\
-    "movdqa 16"#t", "#g"              \n\t"
-#endif
-
-#define MOVQ_WONE(regd) \
-    __asm__ volatile ( \
-    "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
-    "psrlw $15, %%" #regd ::)
-
-void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx);
-void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx);
-
-void add_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
-void put_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
-void put_signed_pixels_clamped_mmx(const DCTELEM *block, uint8_t *pixels, int line_size);
-
-void ff_cavsdsp_init_mmx2(DSPContext* c, AVCodecContext *avctx);
-void ff_cavsdsp_init_3dnow(DSPContext* c, AVCodecContext *avctx);
-void ff_put_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
-void ff_avg_cavs_qpel8_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
-void ff_put_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
-void ff_avg_cavs_qpel16_mc00_mmx2(uint8_t *dst, uint8_t *src, int stride);
-
-void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx);
-void ff_put_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd);
-void ff_avg_vc1_mspel_mc00_mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd);
-
-void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag,
-                                   double *autoc);
-
-void ff_mmx_idct(DCTELEM *block);
-void ff_mmxext_idct(DCTELEM *block);
-
-#endif /* AVCODEC_X86_DSPUTIL_MMX_H */
diff --git a/libavcodec/x86/dsputil_mmx_avg_template.c b/libavcodec/x86/dsputil_mmx_avg_template.c
deleted file mode 100644
index 8220867..0000000
--- a/libavcodec/x86/dsputil_mmx_avg_template.c
+++ /dev/null
@@ -1,896 +0,0 @@
-/*
- * DSP utils : average functions are compiled twice for 3dnow/mmx2
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * MMX optimization by Nick Kurshev <nickols_k at mail.ru>
- * mostly rewritten by Michael Niedermayer <michaelni at gmx.at>
- * and improved by Zdenek Kabelac <kabi at users.sf.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* XXX: we use explicit registers to avoid a gcc 2.95.2 register asm
-   clobber bug - now it will work with 2.95.2 and also with -fPIC
- */
-static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "1:                             \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        PAVGB" 1(%1), %%mm0             \n\t"
-        PAVGB" 1(%1, %3), %%mm1         \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        PAVGB" 1(%1), %%mm0             \n\t"
-        PAVGB" 1(%1, %3), %%mm1         \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-static void DEF(put_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movd   (%1), %%mm0             \n\t"
-        "movd   (%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $4, %2                  \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        "movd   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movd   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movd   (%1), %%mm1             \n\t"
-        "movd   (%2), %%mm2             \n\t"
-        "movd   4(%2), %%mm3            \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" %%mm2, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm1             \n\t"
-        "movd   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movd   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movd   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movd   (%1), %%mm1             \n\t"
-        "movd   8(%2), %%mm2            \n\t"
-        "movd   12(%2), %%mm3           \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" %%mm2, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm1             \n\t"
-        "movd   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movd   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $16, %2                 \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-}
-
-
-static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   (%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $8, %2                  \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" 8(%2), %%mm1             \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" 16(%2), %%mm0            \n\t"
-        PAVGB" 24(%2), %%mm1            \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $32, %2                 \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-//the following should be used, though better not with gcc ...
-/*        :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
-        :"r"(src1Stride), "r"(dstStride)
-        :"memory");*/
-}
-
-static void DEF(put_no_rnd_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "pcmpeqb %%mm6, %%mm6           \n\t"
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   (%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $8, %2                  \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%2), %%mm2             \n\t"
-        "movq   8(%2), %%mm3            \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "pxor %%mm6, %%mm2              \n\t"
-        "pxor %%mm6, %%mm3              \n\t"
-        PAVGB" %%mm2, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm1             \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   16(%2), %%mm2           \n\t"
-        "movq   24(%2), %%mm3           \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "pxor %%mm6, %%mm2              \n\t"
-        "pxor %%mm6, %%mm3              \n\t"
-        PAVGB" %%mm2, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm1             \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $32, %2                 \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-//the following should be used, though better not with gcc ...
-/*        :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
-        :"r"(src1Stride), "r"(dstStride)
-        :"memory");*/
-}
-
-static void DEF(avg_pixels4_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movd   (%1), %%mm0             \n\t"
-        "movd   (%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $4, %2                  \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        "movd   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movd   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movd   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" 4(%2), %%mm1             \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        "movd   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        PAVGB" (%3), %%mm1              \n\t"
-        "movd   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movd   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movd   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" 8(%2), %%mm0             \n\t"
-        PAVGB" 12(%2), %%mm1            \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        "movd   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        PAVGB" (%3), %%mm1              \n\t"
-        "movd   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $16, %2                 \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-}
-
-
-static void DEF(avg_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   (%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $8, %2                  \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" 8(%2), %%mm1             \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        PAVGB" (%3), %%mm1              \n\t"
-        "movq   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" 16(%2), %%mm0            \n\t"
-        PAVGB" 24(%2), %%mm1            \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        PAVGB" (%3), %%mm1              \n\t"
-        "movq   %%mm1, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $32, %2                 \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE  //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-//the following should be used, though better not with gcc ...
-/*        :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
-        :"r"(src1Stride), "r"(dstStride)
-        :"memory");*/
-}
-
-static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "1:                             \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq 8(%1), %%mm2              \n\t"
-        "movq 8(%1, %3), %%mm3          \n\t"
-        PAVGB" 1(%1), %%mm0             \n\t"
-        PAVGB" 1(%1, %3), %%mm1         \n\t"
-        PAVGB" 9(%1), %%mm2             \n\t"
-        PAVGB" 9(%1, %3), %%mm3         \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "movq %%mm2, 8(%2)              \n\t"
-        "movq %%mm3, 8(%2, %3)          \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq 8(%1), %%mm2              \n\t"
-        "movq 8(%1, %3), %%mm3          \n\t"
-        PAVGB" 1(%1), %%mm0             \n\t"
-        PAVGB" 1(%1, %3), %%mm1         \n\t"
-        PAVGB" 9(%1), %%mm2             \n\t"
-        PAVGB" 9(%1, %3), %%mm3         \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "movq %%mm2, 8(%2)              \n\t"
-        "movq %%mm3, 8(%2, %3)          \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" 8(%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $16, %2                 \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" 8(%2), %%mm1             \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" 16(%2), %%mm0            \n\t"
-        PAVGB" 24(%2), %%mm1            \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $32, %2                 \n\t"
-        "subl   $2, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE  //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-//the following should be used, though better not with gcc ...
-/*        :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
-        :"r"(src1Stride), "r"(dstStride)
-        :"memory");*/
-}
-
-static void DEF(avg_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" 8(%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $16, %2                 \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        PAVGB" 8(%3), %%mm1             \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" 8(%2), %%mm1             \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        PAVGB" 8(%3), %%mm1             \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGB" 16(%2), %%mm0            \n\t"
-        PAVGB" 24(%2), %%mm1            \n\t"
-        PAVGB" (%3), %%mm0              \n\t"
-        PAVGB" 8(%3), %%mm1             \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $32, %2                 \n\t"
-        "subl   $2, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE  //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-//the following should be used, though better not with gcc ...
-/*        :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
-        :"r"(src1Stride), "r"(dstStride)
-        :"memory");*/
-}
-
-static void DEF(put_no_rnd_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    __asm__ volatile(
-        "pcmpeqb %%mm6, %%mm6           \n\t"
-        "testl $1, %0                   \n\t"
-            " jz 1f                     \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        "movq   (%2), %%mm2             \n\t"
-        "movq   8(%2), %%mm3            \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "pxor %%mm6, %%mm2              \n\t"
-        "pxor %%mm6, %%mm3              \n\t"
-        PAVGB" %%mm2, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm1             \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $16, %2                 \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%2), %%mm2             \n\t"
-        "movq   8(%2), %%mm3            \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "pxor %%mm6, %%mm2              \n\t"
-        "pxor %%mm6, %%mm3              \n\t"
-        PAVGB" %%mm2, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm1             \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   8(%1), %%mm1            \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   16(%2), %%mm2           \n\t"
-        "movq   24(%2), %%mm3           \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "pxor %%mm6, %%mm2              \n\t"
-        "pxor %%mm6, %%mm3              \n\t"
-        PAVGB" %%mm2, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm1             \n\t"
-        "pxor %%mm6, %%mm0              \n\t"
-        "pxor %%mm6, %%mm1              \n\t"
-        "movq   %%mm0, (%3)             \n\t"
-        "movq   %%mm1, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $32, %2                 \n\t"
-        "subl   $2, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-//the following should be used, though better not with gcc ...
-/*        :"+g"(h), "+r"(src1), "+r"(src2), "+r"(dst)
-        :"r"(src1Stride), "r"(dstStride)
-        :"memory");*/
-}
-
-/* GL: this function does incorrect rounding if overflow */
-static void DEF(put_no_rnd_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BONE(mm6);
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "1:                             \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm2           \n\t"
-        "movq 1(%1), %%mm1              \n\t"
-        "movq 1(%1, %3), %%mm3          \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "psubusb %%mm6, %%mm0           \n\t"
-        "psubusb %%mm6, %%mm2           \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm2             \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm2, (%2, %3)           \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq 1(%1), %%mm1              \n\t"
-        "movq (%1, %3), %%mm2           \n\t"
-        "movq 1(%1, %3), %%mm3          \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "psubusb %%mm6, %%mm0           \n\t"
-        "psubusb %%mm6, %%mm2           \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" %%mm3, %%mm2             \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm2, (%2, %3)           \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-static void DEF(put_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "sub %3, %2                     \n\t"
-        "1:                             \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq (%1, %%"REG_a"), %%mm2    \n\t"
-        "add %%"REG_a", %1              \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" %%mm2, %%mm1             \n\t"
-        "movq %%mm0, (%2, %3)           \n\t"
-        "movq %%mm1, (%2, %%"REG_a")    \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "add %%"REG_a", %1              \n\t"
-        PAVGB" %%mm1, %%mm2             \n\t"
-        PAVGB" %%mm0, %%mm1             \n\t"
-        "movq %%mm2, (%2, %3)           \n\t"
-        "movq %%mm1, (%2, %%"REG_a")    \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D" (block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-/* GL: this function does incorrect rounding if overflow */
-static void DEF(put_no_rnd_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BONE(mm6);
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "sub %3, %2                     \n\t"
-        "1:                             \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq (%1, %%"REG_a"), %%mm2    \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "psubusb %%mm6, %%mm1           \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" %%mm2, %%mm1             \n\t"
-        "movq %%mm0, (%2, %3)           \n\t"
-        "movq %%mm1, (%2, %%"REG_a")    \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "psubusb %%mm6, %%mm1           \n\t"
-        PAVGB" %%mm1, %%mm2             \n\t"
-        PAVGB" %%mm0, %%mm1             \n\t"
-        "movq %%mm2, (%2, %3)           \n\t"
-        "movq %%mm1, (%2, %%"REG_a")    \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D" (block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-static void DEF(avg_pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "1:                             \n\t"
-        "movq (%2), %%mm0               \n\t"
-        "movq (%2, %3), %%mm1           \n\t"
-        PAVGB" (%1), %%mm0              \n\t"
-        PAVGB" (%1, %3), %%mm1          \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "movq (%2), %%mm0               \n\t"
-        "movq (%2, %3), %%mm1           \n\t"
-        PAVGB" (%1), %%mm0              \n\t"
-        PAVGB" (%1, %3), %%mm1          \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-static void DEF(avg_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "1:                             \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm2           \n\t"
-        PAVGB" 1(%1), %%mm0             \n\t"
-        PAVGB" 1(%1, %3), %%mm2         \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" (%2, %3), %%mm2          \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm2, (%2, %3)           \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm2           \n\t"
-        PAVGB" 1(%1), %%mm0             \n\t"
-        PAVGB" 1(%1, %3), %%mm2         \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "add %%"REG_a", %1              \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" (%2, %3), %%mm2          \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm2, (%2, %3)           \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-static void DEF(avg_pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "sub %3, %2                     \n\t"
-        "1:                             \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq (%1, %%"REG_a"), %%mm2    \n\t"
-        "add %%"REG_a", %1              \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" %%mm2, %%mm1             \n\t"
-        "movq (%2, %3), %%mm3           \n\t"
-        "movq (%2, %%"REG_a"), %%mm4    \n\t"
-        PAVGB" %%mm3, %%mm0             \n\t"
-        PAVGB" %%mm4, %%mm1             \n\t"
-        "movq %%mm0, (%2, %3)           \n\t"
-        "movq %%mm1, (%2, %%"REG_a")    \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        PAVGB" %%mm1, %%mm2             \n\t"
-        PAVGB" %%mm0, %%mm1             \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "add %%"REG_a", %1              \n\t"
-        "movq (%2, %3), %%mm3           \n\t"
-        "movq (%2, %%"REG_a"), %%mm4    \n\t"
-        PAVGB" %%mm3, %%mm2             \n\t"
-        PAVGB" %%mm4, %%mm1             \n\t"
-        "movq %%mm2, (%2, %3)           \n\t"
-        "movq %%mm1, (%2, %%"REG_a")    \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a, "memory");
-}
-
-/* Note this is not correctly rounded, but this function is only
- * used for B-frames so it does not matter. */
-static void DEF(avg_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BONE(mm6);
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "movq (%1), %%mm0               \n\t"
-        PAVGB" 1(%1), %%mm0             \n\t"
-         ASMALIGN(3)
-        "1:                             \n\t"
-        "movq (%1, %%"REG_a"), %%mm2    \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "psubusb %%mm6, %%mm2           \n\t"
-        PAVGB" 1(%1, %3), %%mm1         \n\t"
-        PAVGB" 1(%1, %%"REG_a"), %%mm2  \n\t"
-        "add %%"REG_a", %1              \n\t"
-        PAVGB" %%mm1, %%mm0             \n\t"
-        PAVGB" %%mm2, %%mm1             \n\t"
-        PAVGB" (%2), %%mm0              \n\t"
-        PAVGB" (%2, %3), %%mm1          \n\t"
-        "movq %%mm0, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        PAVGB" 1(%1, %3), %%mm1         \n\t"
-        PAVGB" 1(%1, %%"REG_a"), %%mm0  \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "add %%"REG_a", %1              \n\t"
-        PAVGB" %%mm1, %%mm2             \n\t"
-        PAVGB" %%mm0, %%mm1             \n\t"
-        PAVGB" (%2), %%mm2              \n\t"
-        PAVGB" (%2, %3), %%mm1          \n\t"
-        "movq %%mm2, (%2)               \n\t"
-        "movq %%mm1, (%2, %3)           \n\t"
-        "add %%"REG_a", %2              \n\t"
-        "subl $4, %0                    \n\t"
-        "jnz 1b                         \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r" ((x86_reg)line_size)
-        :"%"REG_a,  "memory");
-}
-
-static void DEF(avg_pixels4)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    do {
-        __asm__ volatile(
-            "movd (%1), %%mm0               \n\t"
-            "movd (%1, %2), %%mm1           \n\t"
-            "movd (%1, %2, 2), %%mm2        \n\t"
-            "movd (%1, %3), %%mm3           \n\t"
-            PAVGB" (%0), %%mm0              \n\t"
-            PAVGB" (%0, %2), %%mm1          \n\t"
-            PAVGB" (%0, %2, 2), %%mm2       \n\t"
-            PAVGB" (%0, %3), %%mm3          \n\t"
-            "movd %%mm0, (%1)               \n\t"
-            "movd %%mm1, (%1, %2)           \n\t"
-            "movd %%mm2, (%1, %2, 2)        \n\t"
-            "movd %%mm3, (%1, %3)           \n\t"
-            ::"S"(pixels), "D"(block),
-             "r" ((x86_reg)line_size), "r"((x86_reg)3L*line_size)
-            :"memory");
-        block += 4*line_size;
-        pixels += 4*line_size;
-        h -= 4;
-    } while(h > 0);
-}
-
-//FIXME the following could be optimized too ...
-static void DEF(put_no_rnd_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(put_no_rnd_pixels8_x2)(block  , pixels  , line_size, h);
-    DEF(put_no_rnd_pixels8_x2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(put_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(put_pixels8_y2)(block  , pixels  , line_size, h);
-    DEF(put_pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(put_no_rnd_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(put_no_rnd_pixels8_y2)(block  , pixels  , line_size, h);
-    DEF(put_no_rnd_pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(avg_pixels8)(block  , pixels  , line_size, h);
-    DEF(avg_pixels8)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(avg_pixels8_x2)(block  , pixels  , line_size, h);
-    DEF(avg_pixels8_x2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(avg_pixels8_y2)(block  , pixels  , line_size, h);
-    DEF(avg_pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-static void DEF(avg_pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(avg_pixels8_xy2)(block  , pixels  , line_size, h);
-    DEF(avg_pixels8_xy2)(block+8, pixels+8, line_size, h);
-}
-
-#define QPEL_2TAP_L3(OPNAME) \
-static void DEF(OPNAME ## 2tap_qpel16_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
-    __asm__ volatile(\
-        "1:                    \n\t"\
-        "movq   (%1,%2), %%mm0 \n\t"\
-        "movq  8(%1,%2), %%mm1 \n\t"\
-        PAVGB"  (%1,%3), %%mm0 \n\t"\
-        PAVGB" 8(%1,%3), %%mm1 \n\t"\
-        PAVGB"  (%1),    %%mm0 \n\t"\
-        PAVGB" 8(%1),    %%mm1 \n\t"\
-        STORE_OP( (%1,%4),%%mm0)\
-        STORE_OP(8(%1,%4),%%mm1)\
-        "movq  %%mm0,  (%1,%4) \n\t"\
-        "movq  %%mm1, 8(%1,%4) \n\t"\
-        "add   %5, %1          \n\t"\
-        "decl  %0              \n\t"\
-        "jnz   1b              \n\t"\
-        :"+g"(h), "+r"(src)\
-        :"r"((x86_reg)off1), "r"((x86_reg)off2),\
-         "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
-        :"memory"\
-    );\
-}\
-static void DEF(OPNAME ## 2tap_qpel8_l3)(uint8_t *dst, uint8_t *src, int stride, int h, int off1, int off2){\
-    __asm__ volatile(\
-        "1:                    \n\t"\
-        "movq   (%1,%2), %%mm0 \n\t"\
-        PAVGB"  (%1,%3), %%mm0 \n\t"\
-        PAVGB"  (%1),    %%mm0 \n\t"\
-        STORE_OP((%1,%4),%%mm0)\
-        "movq  %%mm0,  (%1,%4) \n\t"\
-        "add   %5, %1          \n\t"\
-        "decl  %0              \n\t"\
-        "jnz   1b              \n\t"\
-        :"+g"(h), "+r"(src)\
-        :"r"((x86_reg)off1), "r"((x86_reg)off2),\
-         "r"((x86_reg)(dst-src)), "r"((x86_reg)stride)\
-        :"memory"\
-    );\
-}
-
-#define STORE_OP(a,b) PAVGB" "#a","#b" \n\t"
-QPEL_2TAP_L3(avg_)
-#undef STORE_OP
-#define STORE_OP(a,b)
-QPEL_2TAP_L3(put_)
-#undef STORE_OP
-#undef QPEL_2TAP_L3
diff --git a/libavcodec/x86/dsputil_mmx_qns_template.c b/libavcodec/x86/dsputil_mmx_qns_template.c
deleted file mode 100644
index d2dbfc5..0000000
--- a/libavcodec/x86/dsputil_mmx_qns_template.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * DSP utils : QNS functions are compiled 3 times for mmx/3dnow/ssse3
- * Copyright (c) 2004 Michael Niedermayer
- *
- * MMX optimization by Michael Niedermayer <michaelni at gmx.at>
- * 3DNow! and SSSE3 optimization by Zuxy Meng <zuxy.meng at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define MAX_ABS (512 >> (SCALE_OFFSET>0 ? SCALE_OFFSET : 0))
-
-static int DEF(try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale)
-{
-    x86_reg i=0;
-
-    assert(FFABS(scale) < MAX_ABS);
-    scale<<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
-
-    SET_RND(mm6);
-    __asm__ volatile(
-        "pxor %%mm7, %%mm7              \n\t"
-        "movd  %4, %%mm5                \n\t"
-        "punpcklwd %%mm5, %%mm5         \n\t"
-        "punpcklwd %%mm5, %%mm5         \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq  (%1, %0), %%mm0          \n\t"
-        "movq  8(%1, %0), %%mm1         \n\t"
-        PMULHRW(%%mm0, %%mm1, %%mm5, %%mm6)
-        "paddw (%2, %0), %%mm0          \n\t"
-        "paddw 8(%2, %0), %%mm1         \n\t"
-        "psraw $6, %%mm0                \n\t"
-        "psraw $6, %%mm1                \n\t"
-        "pmullw (%3, %0), %%mm0         \n\t"
-        "pmullw 8(%3, %0), %%mm1        \n\t"
-        "pmaddwd %%mm0, %%mm0           \n\t"
-        "pmaddwd %%mm1, %%mm1           \n\t"
-        "paddd %%mm1, %%mm0             \n\t"
-        "psrld $4, %%mm0                \n\t"
-        "paddd %%mm0, %%mm7             \n\t"
-        "add $16, %0                    \n\t"
-        "cmp $128, %0                   \n\t" //FIXME optimize & bench
-        " jb 1b                         \n\t"
-        PHADDD(%%mm7, %%mm6)
-        "psrld $2, %%mm7                \n\t"
-        "movd %%mm7, %0                 \n\t"
-
-        : "+r" (i)
-        : "r"(basis), "r"(rem), "r"(weight), "g"(scale)
-    );
-    return i;
-}
-
-static void DEF(add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale)
-{
-    x86_reg i=0;
-
-    if(FFABS(scale) < MAX_ABS){
-        scale<<= 16 + SCALE_OFFSET - BASIS_SHIFT + RECON_SHIFT;
-        SET_RND(mm6);
-        __asm__ volatile(
-                "movd  %3, %%mm5        \n\t"
-                "punpcklwd %%mm5, %%mm5 \n\t"
-                "punpcklwd %%mm5, %%mm5 \n\t"
-                ASMALIGN(4)
-                "1:                     \n\t"
-                "movq  (%1, %0), %%mm0  \n\t"
-                "movq  8(%1, %0), %%mm1 \n\t"
-                PMULHRW(%%mm0, %%mm1, %%mm5, %%mm6)
-                "paddw (%2, %0), %%mm0  \n\t"
-                "paddw 8(%2, %0), %%mm1 \n\t"
-                "movq %%mm0, (%2, %0)   \n\t"
-                "movq %%mm1, 8(%2, %0)  \n\t"
-                "add $16, %0            \n\t"
-                "cmp $128, %0           \n\t" // FIXME optimize & bench
-                " jb 1b                 \n\t"
-
-                : "+r" (i)
-                : "r"(basis), "r"(rem), "g"(scale)
-        );
-    }else{
-        for(i=0; i<8*8; i++){
-            rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT);
-        }
-    }
-}
diff --git a/libavcodec/x86/dsputil_mmx_rnd_template.c b/libavcodec/x86/dsputil_mmx_rnd_template.c
deleted file mode 100644
index 2fc1756..0000000
--- a/libavcodec/x86/dsputil_mmx_rnd_template.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * DSP utils mmx functions are compiled twice for rnd/no_rnd
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2003-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * MMX optimization by Nick Kurshev <nickols_k at mail.ru>
- * mostly rewritten by Michael Niedermayer <michaelni at gmx.at>
- * and improved by Zdenek Kabelac <kabi at users.sf.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-// put_pixels
-static void DEF(put, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    __asm__ volatile(
-        "lea    (%3, %3), %%"REG_a"     \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   1(%1), %%mm1            \n\t"
-        "movq   (%1, %3), %%mm2         \n\t"
-        "movq   1(%1, %3), %%mm3        \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%2)             \n\t"
-        "movq   %%mm5, (%2, %3)         \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   1(%1), %%mm1            \n\t"
-        "movq   (%1, %3), %%mm2         \n\t"
-        "movq   1(%1, %3), %%mm3        \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%2)             \n\t"
-        "movq   %%mm5, (%2, %3)         \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r"((x86_reg)line_size)
-        :REG_a, "memory");
-}
-
-static void av_unused DEF(put, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    MOVQ_BFE(mm6);
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-        " jz 1f                         \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   (%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $8, %2                  \n\t"
-        PAVGB(%%mm0, %%mm1, %%mm4, %%mm6)
-        "movq   %%mm4, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   (%2), %%mm1             \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm2             \n\t"
-        "movq   8(%2), %%mm3            \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   %%mm5, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   16(%2), %%mm1           \n\t"
-        "add    %4, %1                  \n\t"
-        "movq   (%1), %%mm2             \n\t"
-        "movq   24(%2), %%mm3           \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $32, %2                 \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   %%mm5, (%3)             \n\t"
-        "add    %5, %3                  \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-}
-
-static void DEF(put, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    __asm__ volatile(
-        "lea        (%3, %3), %%"REG_a" \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   1(%1), %%mm1            \n\t"
-        "movq   (%1, %3), %%mm2         \n\t"
-        "movq   1(%1, %3), %%mm3        \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%2)             \n\t"
-        "movq   %%mm5, (%2, %3)         \n\t"
-        "movq   8(%1), %%mm0            \n\t"
-        "movq   9(%1), %%mm1            \n\t"
-        "movq   8(%1, %3), %%mm2        \n\t"
-        "movq   9(%1, %3), %%mm3        \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, 8(%2)            \n\t"
-        "movq   %%mm5, 8(%2, %3)        \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   1(%1), %%mm1            \n\t"
-        "movq   (%1, %3), %%mm2         \n\t"
-        "movq   1(%1, %3), %%mm3        \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%2)             \n\t"
-        "movq   %%mm5, (%2, %3)         \n\t"
-        "movq   8(%1), %%mm0            \n\t"
-        "movq   9(%1), %%mm1            \n\t"
-        "movq   8(%1, %3), %%mm2        \n\t"
-        "movq   9(%1, %3), %%mm3        \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, 8(%2)            \n\t"
-        "movq   %%mm5, 8(%2, %3)        \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r"((x86_reg)line_size)
-        :REG_a, "memory");
-}
-
-static void av_unused DEF(put, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    MOVQ_BFE(mm6);
-    __asm__ volatile(
-        "testl $1, %0                   \n\t"
-        " jz 1f                         \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   (%2), %%mm1             \n\t"
-        "movq   8(%1), %%mm2            \n\t"
-        "movq   8(%2), %%mm3            \n\t"
-        "add    %4, %1                  \n\t"
-        "add    $16, %2                 \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%3)             \n\t"
-        "movq   %%mm5, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "decl   %0                      \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   (%2), %%mm1             \n\t"
-        "movq   8(%1), %%mm2            \n\t"
-        "movq   8(%2), %%mm3            \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%3)             \n\t"
-        "movq   %%mm5, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        "movq   16(%2), %%mm1           \n\t"
-        "movq   8(%1), %%mm2            \n\t"
-        "movq   24(%2), %%mm3           \n\t"
-        "add    %4, %1                  \n\t"
-        PAVGBP(%%mm0, %%mm1, %%mm4,   %%mm2, %%mm3, %%mm5)
-        "movq   %%mm4, (%3)             \n\t"
-        "movq   %%mm5, 8(%3)            \n\t"
-        "add    %5, %3                  \n\t"
-        "add    $32, %2                 \n\t"
-        "subl   $2, %0                  \n\t"
-        "jnz    1b                      \n\t"
-#if !HAVE_EBX_AVAILABLE  //Note "+bm" and "+mb" are buggy too (with gcc 3.2.2 at least) and cannot be used
-        :"+m"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#else
-        :"+b"(h), "+a"(src1), "+c"(src2), "+d"(dst)
-#endif
-        :"S"((x86_reg)src1Stride), "D"((x86_reg)dstStride)
-        :"memory");
-}
-
-static void DEF(put, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    __asm__ volatile(
-        "lea (%3, %3), %%"REG_a"        \n\t"
-        "movq (%1), %%mm0               \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1, %3), %%mm1         \n\t"
-        "movq   (%1, %%"REG_a"),%%mm2   \n\t"
-        PAVGBP(%%mm1, %%mm0, %%mm4,   %%mm2, %%mm1, %%mm5)
-        "movq   %%mm4, (%2)             \n\t"
-        "movq   %%mm5, (%2, %3)         \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-        "movq   (%1, %3), %%mm1         \n\t"
-        "movq   (%1, %%"REG_a"),%%mm0   \n\t"
-        PAVGBP(%%mm1, %%mm2, %%mm4,   %%mm0, %%mm1, %%mm5)
-        "movq   %%mm4, (%2)             \n\t"
-        "movq   %%mm5, (%2, %3)         \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r"((x86_reg)line_size)
-        :REG_a, "memory");
-}
-
-static void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_ZERO(mm7);
-    SET_RND(mm6); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "movq   (%1), %%mm0             \n\t"
-        "movq   1(%1), %%mm4            \n\t"
-        "movq   %%mm0, %%mm1            \n\t"
-        "movq   %%mm4, %%mm5            \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpcklbw %%mm7, %%mm4         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpckhbw %%mm7, %%mm5         \n\t"
-        "paddusw %%mm0, %%mm4           \n\t"
-        "paddusw %%mm1, %%mm5           \n\t"
-        "xor    %%"REG_a", %%"REG_a"    \n\t"
-        "add    %3, %1                  \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1, %%"REG_a"), %%mm0  \n\t"
-        "movq   1(%1, %%"REG_a"), %%mm2 \n\t"
-        "movq   %%mm0, %%mm1            \n\t"
-        "movq   %%mm2, %%mm3            \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "paddusw %%mm2, %%mm0           \n\t"
-        "paddusw %%mm3, %%mm1           \n\t"
-        "paddusw %%mm6, %%mm4           \n\t"
-        "paddusw %%mm6, %%mm5           \n\t"
-        "paddusw %%mm0, %%mm4           \n\t"
-        "paddusw %%mm1, %%mm5           \n\t"
-        "psrlw  $2, %%mm4               \n\t"
-        "psrlw  $2, %%mm5               \n\t"
-        "packuswb  %%mm5, %%mm4         \n\t"
-        "movq   %%mm4, (%2, %%"REG_a")  \n\t"
-        "add    %3, %%"REG_a"           \n\t"
-
-        "movq   (%1, %%"REG_a"), %%mm2  \n\t" // 0 <-> 2   1 <-> 3
-        "movq   1(%1, %%"REG_a"), %%mm4 \n\t"
-        "movq   %%mm2, %%mm3            \n\t"
-        "movq   %%mm4, %%mm5            \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpcklbw %%mm7, %%mm4         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "punpckhbw %%mm7, %%mm5         \n\t"
-        "paddusw %%mm2, %%mm4           \n\t"
-        "paddusw %%mm3, %%mm5           \n\t"
-        "paddusw %%mm6, %%mm0           \n\t"
-        "paddusw %%mm6, %%mm1           \n\t"
-        "paddusw %%mm4, %%mm0           \n\t"
-        "paddusw %%mm5, %%mm1           \n\t"
-        "psrlw  $2, %%mm0               \n\t"
-        "psrlw  $2, %%mm1               \n\t"
-        "packuswb  %%mm1, %%mm0         \n\t"
-        "movq   %%mm0, (%2, %%"REG_a")  \n\t"
-        "add    %3, %%"REG_a"           \n\t"
-
-        "subl   $2, %0                  \n\t"
-        "jnz    1b                      \n\t"
-        :"+g"(h), "+S"(pixels)
-        :"D"(block), "r"((x86_reg)line_size)
-        :REG_a, "memory");
-}
-
-// avg_pixels
-static void av_unused DEF(avg, pixels4)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    JUMPALIGN();
-    do {
-        __asm__ volatile(
-             "movd  %0, %%mm0           \n\t"
-             "movd  %1, %%mm1           \n\t"
-             OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
-             "movd  %%mm2, %0           \n\t"
-             :"+m"(*block)
-             :"m"(*pixels)
-             :"memory");
-        pixels += line_size;
-        block += line_size;
-    }
-    while (--h);
-}
-
-// in case more speed is needed - unroling would certainly help
-static void DEF(avg, pixels8)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    JUMPALIGN();
-    do {
-        __asm__ volatile(
-             "movq  %0, %%mm0           \n\t"
-             "movq  %1, %%mm1           \n\t"
-             OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
-             "movq  %%mm2, %0           \n\t"
-             :"+m"(*block)
-             :"m"(*pixels)
-             :"memory");
-        pixels += line_size;
-        block += line_size;
-    }
-    while (--h);
-}
-
-static void DEF(avg, pixels16)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    JUMPALIGN();
-    do {
-        __asm__ volatile(
-             "movq  %0, %%mm0           \n\t"
-             "movq  %1, %%mm1           \n\t"
-             OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
-             "movq  %%mm2, %0           \n\t"
-             "movq  8%0, %%mm0          \n\t"
-             "movq  8%1, %%mm1          \n\t"
-             OP_AVG(%%mm0, %%mm1, %%mm2, %%mm6)
-             "movq  %%mm2, 8%0          \n\t"
-             :"+m"(*block)
-             :"m"(*pixels)
-             :"memory");
-        pixels += line_size;
-        block += line_size;
-    }
-    while (--h);
-}
-
-static void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    JUMPALIGN();
-    do {
-        __asm__ volatile(
-            "movq  %1, %%mm0            \n\t"
-            "movq  1%1, %%mm1           \n\t"
-            "movq  %0, %%mm3            \n\t"
-            PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
-            OP_AVG(%%mm3, %%mm2, %%mm0, %%mm6)
-            "movq  %%mm0, %0            \n\t"
-            :"+m"(*block)
-            :"m"(*pixels)
-            :"memory");
-        pixels += line_size;
-        block += line_size;
-    } while (--h);
-}
-
-static av_unused void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    MOVQ_BFE(mm6);
-    JUMPALIGN();
-    do {
-        __asm__ volatile(
-            "movq  %1, %%mm0            \n\t"
-            "movq  %2, %%mm1            \n\t"
-            "movq  %0, %%mm3            \n\t"
-            PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
-            OP_AVG(%%mm3, %%mm2, %%mm0, %%mm6)
-            "movq  %%mm0, %0            \n\t"
-            :"+m"(*dst)
-            :"m"(*src1), "m"(*src2)
-            :"memory");
-        dst += dstStride;
-        src1 += src1Stride;
-        src2 += 8;
-    } while (--h);
-}
-
-static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    JUMPALIGN();
-    do {
-        __asm__ volatile(
-            "movq  %1, %%mm0            \n\t"
-            "movq  1%1, %%mm1           \n\t"
-            "movq  %0, %%mm3            \n\t"
-            PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
-            OP_AVG(%%mm3, %%mm2, %%mm0, %%mm6)
-            "movq  %%mm0, %0            \n\t"
-            "movq  8%1, %%mm0           \n\t"
-            "movq  9%1, %%mm1           \n\t"
-            "movq  8%0, %%mm3           \n\t"
-            PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
-            OP_AVG(%%mm3, %%mm2, %%mm0, %%mm6)
-            "movq  %%mm0, 8%0           \n\t"
-            :"+m"(*block)
-            :"m"(*pixels)
-            :"memory");
-        pixels += line_size;
-        block += line_size;
-    } while (--h);
-}
-
-static av_unused void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h)
-{
-    MOVQ_BFE(mm6);
-    JUMPALIGN();
-    do {
-        __asm__ volatile(
-            "movq  %1, %%mm0            \n\t"
-            "movq  %2, %%mm1            \n\t"
-            "movq  %0, %%mm3            \n\t"
-            PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
-            OP_AVG(%%mm3, %%mm2, %%mm0, %%mm6)
-            "movq  %%mm0, %0            \n\t"
-            "movq  8%1, %%mm0           \n\t"
-            "movq  8%2, %%mm1           \n\t"
-            "movq  8%0, %%mm3           \n\t"
-            PAVGB(%%mm0, %%mm1, %%mm2, %%mm6)
-            OP_AVG(%%mm3, %%mm2, %%mm0, %%mm6)
-            "movq  %%mm0, 8%0           \n\t"
-            :"+m"(*dst)
-            :"m"(*src1), "m"(*src2)
-            :"memory");
-        dst += dstStride;
-        src1 += src1Stride;
-        src2 += 16;
-    } while (--h);
-}
-
-static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_BFE(mm6);
-    __asm__ volatile(
-        "lea    (%3, %3), %%"REG_a"     \n\t"
-        "movq   (%1), %%mm0             \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1, %3), %%mm1         \n\t"
-        "movq   (%1, %%"REG_a"), %%mm2  \n\t"
-        PAVGBP(%%mm1, %%mm0, %%mm4,   %%mm2, %%mm1, %%mm5)
-        "movq   (%2), %%mm3             \n\t"
-        OP_AVG(%%mm3, %%mm4, %%mm0, %%mm6)
-        "movq   (%2, %3), %%mm3         \n\t"
-        OP_AVG(%%mm3, %%mm5, %%mm1, %%mm6)
-        "movq   %%mm0, (%2)             \n\t"
-        "movq   %%mm1, (%2, %3)         \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-
-        "movq   (%1, %3), %%mm1         \n\t"
-        "movq   (%1, %%"REG_a"), %%mm0  \n\t"
-        PAVGBP(%%mm1, %%mm2, %%mm4,   %%mm0, %%mm1, %%mm5)
-        "movq   (%2), %%mm3             \n\t"
-        OP_AVG(%%mm3, %%mm4, %%mm2, %%mm6)
-        "movq   (%2, %3), %%mm3         \n\t"
-        OP_AVG(%%mm3, %%mm5, %%mm1, %%mm6)
-        "movq   %%mm2, (%2)             \n\t"
-        "movq   %%mm1, (%2, %3)         \n\t"
-        "add    %%"REG_a", %1           \n\t"
-        "add    %%"REG_a", %2           \n\t"
-
-        "subl   $4, %0                  \n\t"
-        "jnz    1b                      \n\t"
-        :"+g"(h), "+S"(pixels), "+D"(block)
-        :"r"((x86_reg)line_size)
-        :REG_a, "memory");
-}
-
-// this routine is 'slightly' suboptimal but mostly unused
-static void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h)
-{
-    MOVQ_ZERO(mm7);
-    SET_RND(mm6); // =2 for rnd  and  =1 for no_rnd version
-    __asm__ volatile(
-        "movq   (%1), %%mm0             \n\t"
-        "movq   1(%1), %%mm4            \n\t"
-        "movq   %%mm0, %%mm1            \n\t"
-        "movq   %%mm4, %%mm5            \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpcklbw %%mm7, %%mm4         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpckhbw %%mm7, %%mm5         \n\t"
-        "paddusw %%mm0, %%mm4           \n\t"
-        "paddusw %%mm1, %%mm5           \n\t"
-        "xor    %%"REG_a", %%"REG_a"    \n\t"
-        "add    %3, %1                  \n\t"
-        ASMALIGN(3)
-        "1:                             \n\t"
-        "movq   (%1, %%"REG_a"), %%mm0  \n\t"
-        "movq   1(%1, %%"REG_a"), %%mm2 \n\t"
-        "movq   %%mm0, %%mm1            \n\t"
-        "movq   %%mm2, %%mm3            \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "paddusw %%mm2, %%mm0           \n\t"
-        "paddusw %%mm3, %%mm1           \n\t"
-        "paddusw %%mm6, %%mm4           \n\t"
-        "paddusw %%mm6, %%mm5           \n\t"
-        "paddusw %%mm0, %%mm4           \n\t"
-        "paddusw %%mm1, %%mm5           \n\t"
-        "psrlw  $2, %%mm4               \n\t"
-        "psrlw  $2, %%mm5               \n\t"
-                "movq   (%2, %%"REG_a"), %%mm3  \n\t"
-        "packuswb  %%mm5, %%mm4         \n\t"
-                "pcmpeqd %%mm2, %%mm2   \n\t"
-                "paddb %%mm2, %%mm2     \n\t"
-                OP_AVG(%%mm3, %%mm4, %%mm5, %%mm2)
-                "movq   %%mm5, (%2, %%"REG_a")  \n\t"
-        "add    %3, %%"REG_a"                \n\t"
-
-        "movq   (%1, %%"REG_a"), %%mm2  \n\t" // 0 <-> 2   1 <-> 3
-        "movq   1(%1, %%"REG_a"), %%mm4 \n\t"
-        "movq   %%mm2, %%mm3            \n\t"
-        "movq   %%mm4, %%mm5            \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpcklbw %%mm7, %%mm4         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "punpckhbw %%mm7, %%mm5         \n\t"
-        "paddusw %%mm2, %%mm4           \n\t"
-        "paddusw %%mm3, %%mm5           \n\t"
-        "paddusw %%mm6, %%mm0           \n\t"
-        "paddusw %%mm6, %%mm1           \n\t"
-        "paddusw %%mm4, %%mm0           \n\t"
-        "paddusw %%mm5, %%mm1           \n\t"
-        "psrlw  $2, %%mm0               \n\t"
-        "psrlw  $2, %%mm1               \n\t"
-                "movq   (%2, %%"REG_a"), %%mm3  \n\t"
-        "packuswb  %%mm1, %%mm0         \n\t"
-                "pcmpeqd %%mm2, %%mm2   \n\t"
-                "paddb %%mm2, %%mm2     \n\t"
-                OP_AVG(%%mm3, %%mm0, %%mm1, %%mm2)
-                "movq   %%mm1, (%2, %%"REG_a")  \n\t"
-        "add    %3, %%"REG_a"           \n\t"
-
-        "subl   $2, %0                  \n\t"
-        "jnz    1b                      \n\t"
-        :"+g"(h), "+S"(pixels)
-        :"D"(block), "r"((x86_reg)line_size)
-        :REG_a, "memory");
-}
-
-//FIXME optimize
-static void DEF(put, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(put, pixels8_y2)(block  , pixels  , line_size, h);
-    DEF(put, pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-
-static void DEF(put, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(put, pixels8_xy2)(block  , pixels  , line_size, h);
-    DEF(put, pixels8_xy2)(block+8, pixels+8, line_size, h);
-}
-
-static void DEF(avg, pixels16_y2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(avg, pixels8_y2)(block  , pixels  , line_size, h);
-    DEF(avg, pixels8_y2)(block+8, pixels+8, line_size, h);
-}
-
-static void DEF(avg, pixels16_xy2)(uint8_t *block, const uint8_t *pixels, int line_size, int h){
-    DEF(avg, pixels8_xy2)(block  , pixels  , line_size, h);
-    DEF(avg, pixels8_xy2)(block+8, pixels+8, line_size, h);
-}
diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm
deleted file mode 100644
index e2478a4..0000000
--- a/libavcodec/x86/dsputil_yasm.asm
+++ /dev/null
@@ -1,423 +0,0 @@
-;******************************************************************************
-;* MMX optimized DSP utils
-;* Copyright (c) 2008 Loren Merritt
-;*
-;* This file is part of FFmpeg.
-;*
-;* FFmpeg 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.
-;*
-;* FFmpeg 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 FFmpeg; if not, write to the Free Software
-;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-;******************************************************************************
-
-%include "x86inc.asm"
-
-SECTION_RODATA
-pb_f: times 16 db 15
-pb_zzzzzzzz77777777: times 8 db -1
-pb_7: times 8 db 7
-pb_zzzz3333zzzzbbbb: db -1,-1,-1,-1,3,3,3,3,-1,-1,-1,-1,11,11,11,11
-pb_zz11zz55zz99zzdd: db -1,-1,1,1,-1,-1,5,5,-1,-1,9,9,-1,-1,13,13
-
-section .text align=16
-
-%macro PSWAPD_SSE 2
-    pshufw %1, %2, 0x4e
-%endmacro
-%macro PSWAPD_3DN1 2
-    movq  %1, %2
-    psrlq %1, 32
-    punpckldq %1, %2
-%endmacro
-
-%macro FLOAT_TO_INT16_INTERLEAVE6 1
-; void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len)
-cglobal float_to_int16_interleave6_%1, 2,7,0, dst, src, src1, src2, src3, src4, src5
-%ifdef ARCH_X86_64
-    %define lend r10d
-    mov     lend, r2d
-%else
-    %define lend dword r2m
-%endif
-    mov src1q, [srcq+1*gprsize]
-    mov src2q, [srcq+2*gprsize]
-    mov src3q, [srcq+3*gprsize]
-    mov src4q, [srcq+4*gprsize]
-    mov src5q, [srcq+5*gprsize]
-    mov srcq,  [srcq]
-    sub src1q, srcq
-    sub src2q, srcq
-    sub src3q, srcq
-    sub src4q, srcq
-    sub src5q, srcq
-.loop:
-    cvtps2pi   mm0, [srcq]
-    cvtps2pi   mm1, [srcq+src1q]
-    cvtps2pi   mm2, [srcq+src2q]
-    cvtps2pi   mm3, [srcq+src3q]
-    cvtps2pi   mm4, [srcq+src4q]
-    cvtps2pi   mm5, [srcq+src5q]
-    packssdw   mm0, mm3
-    packssdw   mm1, mm4
-    packssdw   mm2, mm5
-    pswapd     mm3, mm0
-    punpcklwd  mm0, mm1
-    punpckhwd  mm1, mm2
-    punpcklwd  mm2, mm3
-    pswapd     mm3, mm0
-    punpckldq  mm0, mm2
-    punpckhdq  mm2, mm1
-    punpckldq  mm1, mm3
-    movq [dstq   ], mm0
-    movq [dstq+16], mm2
-    movq [dstq+ 8], mm1
-    add srcq, 8
-    add dstq, 24
-    sub lend, 2
-    jg .loop
-    emms
-    RET
-%endmacro ; FLOAT_TO_INT16_INTERLEAVE6
-
-%define pswapd PSWAPD_SSE
-FLOAT_TO_INT16_INTERLEAVE6 sse
-%define cvtps2pi pf2id
-%define pswapd PSWAPD_3DN1
-FLOAT_TO_INT16_INTERLEAVE6 3dnow
-%undef pswapd
-FLOAT_TO_INT16_INTERLEAVE6 3dn2
-%undef cvtps2pi
-
-
-
-%macro SCALARPRODUCT 1
-; int scalarproduct_int16(int16_t *v1, int16_t *v2, int order, int shift)
-cglobal scalarproduct_int16_%1, 3,3,4, v1, v2, order, shift
-    shl orderq, 1
-    add v1q, orderq
-    add v2q, orderq
-    neg orderq
-    movd    m3, shiftm
-    pxor    m2, m2
-.loop:
-    movu    m0, [v1q + orderq]
-    movu    m1, [v1q + orderq + mmsize]
-    pmaddwd m0, [v2q + orderq]
-    pmaddwd m1, [v2q + orderq + mmsize]
-    paddd   m2, m0
-    paddd   m2, m1
-    add     orderq, mmsize*2
-    jl .loop
-%if mmsize == 16
-    movhlps m0, m2
-    paddd   m2, m0
-    psrad   m2, m3
-    pshuflw m0, m2, 0x4e
-%else
-    psrad   m2, m3
-    pshufw  m0, m2, 0x4e
-%endif
-    paddd   m2, m0
-    movd   eax, m2
-    RET
-
-; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
-cglobal scalarproduct_and_madd_int16_%1, 4,4,8, v1, v2, v3, order, mul
-    shl orderq, 1
-    movd    m7, mulm
-%if mmsize == 16
-    pshuflw m7, m7, 0
-    punpcklqdq m7, m7
-%else
-    pshufw  m7, m7, 0
-%endif
-    pxor    m6, m6
-    add v1q, orderq
-    add v2q, orderq
-    add v3q, orderq
-    neg orderq
-.loop:
-    movu    m0, [v2q + orderq]
-    movu    m1, [v2q + orderq + mmsize]
-    mova    m4, [v1q + orderq]
-    mova    m5, [v1q + orderq + mmsize]
-    movu    m2, [v3q + orderq]
-    movu    m3, [v3q + orderq + mmsize]
-    pmaddwd m0, m4
-    pmaddwd m1, m5
-    pmullw  m2, m7
-    pmullw  m3, m7
-    paddd   m6, m0
-    paddd   m6, m1
-    paddw   m2, m4
-    paddw   m3, m5
-    mova    [v1q + orderq], m2
-    mova    [v1q + orderq + mmsize], m3
-    add     orderq, mmsize*2
-    jl .loop
-%if mmsize == 16
-    movhlps m0, m6
-    paddd   m6, m0
-    pshuflw m0, m6, 0x4e
-%else
-    pshufw  m0, m6, 0x4e
-%endif
-    paddd   m6, m0
-    movd   eax, m6
-    RET
-%endmacro
-
-INIT_MMX
-SCALARPRODUCT mmx2
-INIT_XMM
-SCALARPRODUCT sse2
-
-%macro SCALARPRODUCT_LOOP 1
-align 16
-.loop%1:
-    sub     orderq, mmsize*2
-%if %1
-    mova    m1, m4
-    mova    m4, [v2q + orderq]
-    mova    m0, [v2q + orderq + mmsize]
-    palignr m1, m0, %1
-    palignr m0, m4, %1
-    mova    m3, m5
-    mova    m5, [v3q + orderq]
-    mova    m2, [v3q + orderq + mmsize]
-    palignr m3, m2, %1
-    palignr m2, m5, %1
-%else
-    mova    m0, [v2q + orderq]
-    mova    m1, [v2q + orderq + mmsize]
-    mova    m2, [v3q + orderq]
-    mova    m3, [v3q + orderq + mmsize]
-%endif
-    %define t0  [v1q + orderq]
-    %define t1  [v1q + orderq + mmsize]
-%ifdef ARCH_X86_64
-    mova    m8, t0
-    mova    m9, t1
-    %define t0  m8
-    %define t1  m9
-%endif
-    pmaddwd m0, t0
-    pmaddwd m1, t1
-    pmullw  m2, m7
-    pmullw  m3, m7
-    paddw   m2, t0
-    paddw   m3, t1
-    paddd   m6, m0
-    paddd   m6, m1
-    mova    [v1q + orderq], m2
-    mova    [v1q + orderq + mmsize], m3
-    jg .loop%1
-%if %1
-    jmp .end
-%endif
-%endmacro
-
-; int scalarproduct_and_madd_int16(int16_t *v1, int16_t *v2, int16_t *v3, int order, int mul)
-cglobal scalarproduct_and_madd_int16_ssse3, 4,5,10, v1, v2, v3, order, mul
-    shl orderq, 1
-    movd    m7, mulm
-    pshuflw m7, m7, 0
-    punpcklqdq m7, m7
-    pxor    m6, m6
-    mov    r4d, v2d
-    and    r4d, 15
-    and    v2q, ~15
-    and    v3q, ~15
-    mova    m4, [v2q + orderq]
-    mova    m5, [v3q + orderq]
-    ; linear is faster than branch tree or jump table, because the branches taken are cyclic (i.e. predictable)
-    cmp    r4d, 0
-    je .loop0
-    cmp    r4d, 2
-    je .loop2
-    cmp    r4d, 4
-    je .loop4
-    cmp    r4d, 6
-    je .loop6
-    cmp    r4d, 8
-    je .loop8
-    cmp    r4d, 10
-    je .loop10
-    cmp    r4d, 12
-    je .loop12
-SCALARPRODUCT_LOOP 14
-SCALARPRODUCT_LOOP 12
-SCALARPRODUCT_LOOP 10
-SCALARPRODUCT_LOOP 8
-SCALARPRODUCT_LOOP 6
-SCALARPRODUCT_LOOP 4
-SCALARPRODUCT_LOOP 2
-SCALARPRODUCT_LOOP 0
-.end:
-    movhlps m0, m6
-    paddd   m6, m0
-    pshuflw m0, m6, 0x4e
-    paddd   m6, m0
-    movd   eax, m6
-    RET
-
-
-
-; void ff_add_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top)
-cglobal add_hfyu_median_prediction_mmx2, 6,6,0, dst, top, diff, w, left, left_top
-    movq    mm0, [topq]
-    movq    mm2, mm0
-    movd    mm4, [left_topq]
-    psllq   mm2, 8
-    movq    mm1, mm0
-    por     mm4, mm2
-    movd    mm3, [leftq]
-    psubb   mm0, mm4 ; t-tl
-    add    dstq, wq
-    add    topq, wq
-    add   diffq, wq
-    neg      wq
-    jmp .skip
-.loop:
-    movq    mm4, [topq+wq]
-    movq    mm0, mm4
-    psllq   mm4, 8
-    por     mm4, mm1
-    movq    mm1, mm0 ; t
-    psubb   mm0, mm4 ; t-tl
-.skip:
-    movq    mm2, [diffq+wq]
-%assign i 0
-%rep 8
-    movq    mm4, mm0
-    paddb   mm4, mm3 ; t-tl+l
-    movq    mm5, mm3
-    pmaxub  mm3, mm1
-    pminub  mm5, mm1
-    pminub  mm3, mm4
-    pmaxub  mm3, mm5 ; median
-    paddb   mm3, mm2 ; +residual
-%if i==0
-    movq    mm7, mm3
-    psllq   mm7, 56
-%else
-    movq    mm6, mm3
-    psrlq   mm7, 8
-    psllq   mm6, 56
-    por     mm7, mm6
-%endif
-%if i<7
-    psrlq   mm0, 8
-    psrlq   mm1, 8
-    psrlq   mm2, 8
-%endif
-%assign i i+1
-%endrep
-    movq [dstq+wq], mm7
-    add      wq, 8
-    jl .loop
-    movzx   r2d, byte [dstq-1]
-    mov [leftq], r2d
-    movzx   r2d, byte [topq-1]
-    mov [left_topq], r2d
-    RET
-
-
-%macro ADD_HFYU_LEFT_LOOP 1 ; %1 = is_aligned
-    add     srcq, wq
-    add     dstq, wq
-    neg     wq
-%%.loop:
-    mova    m1, [srcq+wq]
-    mova    m2, m1
-    psllw   m1, 8
-    paddb   m1, m2
-    mova    m2, m1
-    pshufb  m1, m3
-    paddb   m1, m2
-    pshufb  m0, m5
-    mova    m2, m1
-    pshufb  m1, m4
-    paddb   m1, m2
-%if mmsize == 16
-    mova    m2, m1
-    pshufb  m1, m6
-    paddb   m1, m2
-%endif
-    paddb   m0, m1
-%if %1
-    mova    [dstq+wq], m0
-%else
-    movq    [dstq+wq], m0
-    movhps  [dstq+wq+8], m0
-%endif
-    add     wq, mmsize
-    jl %%.loop
-    mov     eax, mmsize-1
-    sub     eax, wd
-    movd    m1, eax
-    pshufb  m0, m1
-    movd    eax, m0
-    RET
-%endmacro
-
-; int ff_add_hfyu_left_prediction(uint8_t *dst, const uint8_t *src, int w, int left)
-INIT_MMX
-cglobal add_hfyu_left_prediction_ssse3, 3,3,7, dst, src, w, left
-.skip_prologue:
-    mova    m5, [pb_7 GLOBAL]
-    mova    m4, [pb_zzzz3333zzzzbbbb GLOBAL]
-    mova    m3, [pb_zz11zz55zz99zzdd GLOBAL]
-    movd    m0, leftm
-    psllq   m0, 56
-    ADD_HFYU_LEFT_LOOP 1
-
-INIT_XMM
-cglobal add_hfyu_left_prediction_sse4, 3,3,7, dst, src, w, left
-    mova    m5, [pb_f GLOBAL]
-    mova    m6, [pb_zzzzzzzz77777777 GLOBAL]
-    mova    m4, [pb_zzzz3333zzzzbbbb GLOBAL]
-    mova    m3, [pb_zz11zz55zz99zzdd GLOBAL]
-    movd    m0, leftm
-    pslldq  m0, 15
-    test    srcq, 15
-    jnz add_hfyu_left_prediction_ssse3.skip_prologue
-    test    dstq, 15
-    jnz .unaligned
-    ADD_HFYU_LEFT_LOOP 1
-.unaligned:
-    ADD_HFYU_LEFT_LOOP 0
-
-
-; float ff_scalarproduct_float_sse(const float *v1, const float *v2, int len)
-cglobal scalarproduct_float_sse, 3,3,2, v1, v2, offset
-    neg offsetq
-    shl offsetq, 2
-    sub v1q, offsetq
-    sub v2q, offsetq
-    xorps xmm0, xmm0
-    .loop:
-        movaps   xmm1, [v1q+offsetq]
-        mulps    xmm1, [v2q+offsetq]
-        addps    xmm0, xmm1
-        add      offsetq, 16
-        js       .loop
-    movhlps xmm1, xmm0
-    addps   xmm0, xmm1
-    movss   xmm1, xmm0
-    shufps  xmm0, xmm0, 1
-    addss   xmm0, xmm1
-%ifndef ARCH_X86_64
-    movd    r0m,  xmm0
-    fld     dword r0m
-%endif
-    RET
diff --git a/libavcodec/x86/dsputilenc_mmx.c b/libavcodec/x86/dsputilenc_mmx.c
deleted file mode 100644
index f491111..0000000
--- a/libavcodec/x86/dsputilenc_mmx.c
+++ /dev/null
@@ -1,1438 +0,0 @@
-/*
- * MMX optimized DSP utils
- * Copyright (c) 2000, 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * MMX optimization by Nick Kurshev <nickols_k at mail.ru>
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "libavcodec/mathops.h"
-#include "dsputil_mmx.h"
-
-
-static void get_pixels_mmx(DCTELEM *block, const uint8_t *pixels, int line_size)
-{
-    __asm__ volatile(
-        "mov $-128, %%"REG_a"           \n\t"
-        "pxor %%mm7, %%mm7              \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%0), %%mm0               \n\t"
-        "movq (%0, %2), %%mm2           \n\t"
-        "movq %%mm0, %%mm1              \n\t"
-        "movq %%mm2, %%mm3              \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "movq %%mm0, (%1, %%"REG_a")    \n\t"
-        "movq %%mm1, 8(%1, %%"REG_a")   \n\t"
-        "movq %%mm2, 16(%1, %%"REG_a")  \n\t"
-        "movq %%mm3, 24(%1, %%"REG_a")  \n\t"
-        "add %3, %0                     \n\t"
-        "add $32, %%"REG_a"             \n\t"
-        "js 1b                          \n\t"
-        : "+r" (pixels)
-        : "r" (block+64), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*2)
-        : "%"REG_a
-    );
-}
-
-static void get_pixels_sse2(DCTELEM *block, const uint8_t *pixels, int line_size)
-{
-    __asm__ volatile(
-        "pxor %%xmm7,      %%xmm7         \n\t"
-        "movq (%0),        %%xmm0         \n\t"
-        "movq (%0, %2),    %%xmm1         \n\t"
-        "movq (%0, %2,2),  %%xmm2         \n\t"
-        "movq (%0, %3),    %%xmm3         \n\t"
-        "lea (%0,%2,4), %0                \n\t"
-        "punpcklbw %%xmm7, %%xmm0         \n\t"
-        "punpcklbw %%xmm7, %%xmm1         \n\t"
-        "punpcklbw %%xmm7, %%xmm2         \n\t"
-        "punpcklbw %%xmm7, %%xmm3         \n\t"
-        "movdqa %%xmm0,      (%1)         \n\t"
-        "movdqa %%xmm1,    16(%1)         \n\t"
-        "movdqa %%xmm2,    32(%1)         \n\t"
-        "movdqa %%xmm3,    48(%1)         \n\t"
-        "movq (%0),        %%xmm0         \n\t"
-        "movq (%0, %2),    %%xmm1         \n\t"
-        "movq (%0, %2,2),  %%xmm2         \n\t"
-        "movq (%0, %3),    %%xmm3         \n\t"
-        "punpcklbw %%xmm7, %%xmm0         \n\t"
-        "punpcklbw %%xmm7, %%xmm1         \n\t"
-        "punpcklbw %%xmm7, %%xmm2         \n\t"
-        "punpcklbw %%xmm7, %%xmm3         \n\t"
-        "movdqa %%xmm0,    64(%1)         \n\t"
-        "movdqa %%xmm1,    80(%1)         \n\t"
-        "movdqa %%xmm2,    96(%1)         \n\t"
-        "movdqa %%xmm3,   112(%1)         \n\t"
-        : "+r" (pixels)
-        : "r" (block), "r" ((x86_reg)line_size), "r" ((x86_reg)line_size*3)
-    );
-}
-
-static inline void diff_pixels_mmx(DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride)
-{
-    __asm__ volatile(
-        "pxor %%mm7, %%mm7              \n\t"
-        "mov $-128, %%"REG_a"           \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%0), %%mm0               \n\t"
-        "movq (%1), %%mm2               \n\t"
-        "movq %%mm0, %%mm1              \n\t"
-        "movq %%mm2, %%mm3              \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "psubw %%mm2, %%mm0             \n\t"
-        "psubw %%mm3, %%mm1             \n\t"
-        "movq %%mm0, (%2, %%"REG_a")    \n\t"
-        "movq %%mm1, 8(%2, %%"REG_a")   \n\t"
-        "add %3, %0                     \n\t"
-        "add %3, %1                     \n\t"
-        "add $16, %%"REG_a"             \n\t"
-        "jnz 1b                         \n\t"
-        : "+r" (s1), "+r" (s2)
-        : "r" (block+64), "r" ((x86_reg)stride)
-        : "%"REG_a
-    );
-}
-
-static int pix_sum16_mmx(uint8_t * pix, int line_size){
-    const int h=16;
-    int sum;
-    x86_reg index= -line_size*h;
-
-    __asm__ volatile(
-                "pxor %%mm7, %%mm7              \n\t"
-                "pxor %%mm6, %%mm6              \n\t"
-                "1:                             \n\t"
-                "movq (%2, %1), %%mm0           \n\t"
-                "movq (%2, %1), %%mm1           \n\t"
-                "movq 8(%2, %1), %%mm2          \n\t"
-                "movq 8(%2, %1), %%mm3          \n\t"
-                "punpcklbw %%mm7, %%mm0         \n\t"
-                "punpckhbw %%mm7, %%mm1         \n\t"
-                "punpcklbw %%mm7, %%mm2         \n\t"
-                "punpckhbw %%mm7, %%mm3         \n\t"
-                "paddw %%mm0, %%mm1             \n\t"
-                "paddw %%mm2, %%mm3             \n\t"
-                "paddw %%mm1, %%mm3             \n\t"
-                "paddw %%mm3, %%mm6             \n\t"
-                "add %3, %1                     \n\t"
-                " js 1b                         \n\t"
-                "movq %%mm6, %%mm5              \n\t"
-                "psrlq $32, %%mm6               \n\t"
-                "paddw %%mm5, %%mm6             \n\t"
-                "movq %%mm6, %%mm5              \n\t"
-                "psrlq $16, %%mm6               \n\t"
-                "paddw %%mm5, %%mm6             \n\t"
-                "movd %%mm6, %0                 \n\t"
-                "andl $0xFFFF, %0               \n\t"
-                : "=&r" (sum), "+r" (index)
-                : "r" (pix - index), "r" ((x86_reg)line_size)
-        );
-
-        return sum;
-}
-
-static int pix_norm1_mmx(uint8_t *pix, int line_size) {
-    int tmp;
-  __asm__ volatile (
-      "movl $16,%%ecx\n"
-      "pxor %%mm0,%%mm0\n"
-      "pxor %%mm7,%%mm7\n"
-      "1:\n"
-      "movq (%0),%%mm2\n"       /* mm2 = pix[0-7] */
-      "movq 8(%0),%%mm3\n"      /* mm3 = pix[8-15] */
-
-      "movq %%mm2,%%mm1\n"      /* mm1 = mm2 = pix[0-7] */
-
-      "punpckhbw %%mm0,%%mm1\n" /* mm1 = [pix4-7] */
-      "punpcklbw %%mm0,%%mm2\n" /* mm2 = [pix0-3] */
-
-      "movq %%mm3,%%mm4\n"      /* mm4 = mm3 = pix[8-15] */
-      "punpckhbw %%mm0,%%mm3\n" /* mm3 = [pix12-15] */
-      "punpcklbw %%mm0,%%mm4\n" /* mm4 = [pix8-11] */
-
-      "pmaddwd %%mm1,%%mm1\n"   /* mm1 = (pix0^2+pix1^2,pix2^2+pix3^2) */
-      "pmaddwd %%mm2,%%mm2\n"   /* mm2 = (pix4^2+pix5^2,pix6^2+pix7^2) */
-
-      "pmaddwd %%mm3,%%mm3\n"
-      "pmaddwd %%mm4,%%mm4\n"
-
-      "paddd %%mm1,%%mm2\n"     /* mm2 = (pix0^2+pix1^2+pix4^2+pix5^2,
-                                          pix2^2+pix3^2+pix6^2+pix7^2) */
-      "paddd %%mm3,%%mm4\n"
-      "paddd %%mm2,%%mm7\n"
-
-      "add %2, %0\n"
-      "paddd %%mm4,%%mm7\n"
-      "dec %%ecx\n"
-      "jnz 1b\n"
-
-      "movq %%mm7,%%mm1\n"
-      "psrlq $32, %%mm7\n"      /* shift hi dword to lo */
-      "paddd %%mm7,%%mm1\n"
-      "movd %%mm1,%1\n"
-      : "+r" (pix), "=r"(tmp) : "r" ((x86_reg)line_size) : "%ecx" );
-    return tmp;
-}
-
-static int sse8_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
-    int tmp;
-  __asm__ volatile (
-      "movl %4,%%ecx\n"
-      "shr $1,%%ecx\n"
-      "pxor %%mm0,%%mm0\n"      /* mm0 = 0 */
-      "pxor %%mm7,%%mm7\n"      /* mm7 holds the sum */
-      "1:\n"
-      "movq (%0),%%mm1\n"       /* mm1 = pix1[0][0-7] */
-      "movq (%1),%%mm2\n"       /* mm2 = pix2[0][0-7] */
-      "movq (%0,%3),%%mm3\n"    /* mm3 = pix1[1][0-7] */
-      "movq (%1,%3),%%mm4\n"    /* mm4 = pix2[1][0-7] */
-
-      /* todo: mm1-mm2, mm3-mm4 */
-      /* algo: subtract mm1 from mm2 with saturation and vice versa */
-      /*       OR the results to get absolute difference */
-      "movq %%mm1,%%mm5\n"
-      "movq %%mm3,%%mm6\n"
-      "psubusb %%mm2,%%mm1\n"
-      "psubusb %%mm4,%%mm3\n"
-      "psubusb %%mm5,%%mm2\n"
-      "psubusb %%mm6,%%mm4\n"
-
-      "por %%mm1,%%mm2\n"
-      "por %%mm3,%%mm4\n"
-
-      /* now convert to 16-bit vectors so we can square them */
-      "movq %%mm2,%%mm1\n"
-      "movq %%mm4,%%mm3\n"
-
-      "punpckhbw %%mm0,%%mm2\n"
-      "punpckhbw %%mm0,%%mm4\n"
-      "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */
-      "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */
-
-      "pmaddwd %%mm2,%%mm2\n"
-      "pmaddwd %%mm4,%%mm4\n"
-      "pmaddwd %%mm1,%%mm1\n"
-      "pmaddwd %%mm3,%%mm3\n"
-
-      "lea (%0,%3,2), %0\n"     /* pix1 += 2*line_size */
-      "lea (%1,%3,2), %1\n"     /* pix2 += 2*line_size */
-
-      "paddd %%mm2,%%mm1\n"
-      "paddd %%mm4,%%mm3\n"
-      "paddd %%mm1,%%mm7\n"
-      "paddd %%mm3,%%mm7\n"
-
-      "decl %%ecx\n"
-      "jnz 1b\n"
-
-      "movq %%mm7,%%mm1\n"
-      "psrlq $32, %%mm7\n"      /* shift hi dword to lo */
-      "paddd %%mm7,%%mm1\n"
-      "movd %%mm1,%2\n"
-      : "+r" (pix1), "+r" (pix2), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "m" (h)
-      : "%ecx");
-    return tmp;
-}
-
-static int sse16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
-    int tmp;
-  __asm__ volatile (
-      "movl %4,%%ecx\n"
-      "pxor %%mm0,%%mm0\n"      /* mm0 = 0 */
-      "pxor %%mm7,%%mm7\n"      /* mm7 holds the sum */
-      "1:\n"
-      "movq (%0),%%mm1\n"       /* mm1 = pix1[0-7] */
-      "movq (%1),%%mm2\n"       /* mm2 = pix2[0-7] */
-      "movq 8(%0),%%mm3\n"      /* mm3 = pix1[8-15] */
-      "movq 8(%1),%%mm4\n"      /* mm4 = pix2[8-15] */
-
-      /* todo: mm1-mm2, mm3-mm4 */
-      /* algo: subtract mm1 from mm2 with saturation and vice versa */
-      /*       OR the results to get absolute difference */
-      "movq %%mm1,%%mm5\n"
-      "movq %%mm3,%%mm6\n"
-      "psubusb %%mm2,%%mm1\n"
-      "psubusb %%mm4,%%mm3\n"
-      "psubusb %%mm5,%%mm2\n"
-      "psubusb %%mm6,%%mm4\n"
-
-      "por %%mm1,%%mm2\n"
-      "por %%mm3,%%mm4\n"
-
-      /* now convert to 16-bit vectors so we can square them */
-      "movq %%mm2,%%mm1\n"
-      "movq %%mm4,%%mm3\n"
-
-      "punpckhbw %%mm0,%%mm2\n"
-      "punpckhbw %%mm0,%%mm4\n"
-      "punpcklbw %%mm0,%%mm1\n" /* mm1 now spread over (mm1,mm2) */
-      "punpcklbw %%mm0,%%mm3\n" /* mm4 now spread over (mm3,mm4) */
-
-      "pmaddwd %%mm2,%%mm2\n"
-      "pmaddwd %%mm4,%%mm4\n"
-      "pmaddwd %%mm1,%%mm1\n"
-      "pmaddwd %%mm3,%%mm3\n"
-
-      "add %3,%0\n"
-      "add %3,%1\n"
-
-      "paddd %%mm2,%%mm1\n"
-      "paddd %%mm4,%%mm3\n"
-      "paddd %%mm1,%%mm7\n"
-      "paddd %%mm3,%%mm7\n"
-
-      "decl %%ecx\n"
-      "jnz 1b\n"
-
-      "movq %%mm7,%%mm1\n"
-      "psrlq $32, %%mm7\n"      /* shift hi dword to lo */
-      "paddd %%mm7,%%mm1\n"
-      "movd %%mm1,%2\n"
-      : "+r" (pix1), "+r" (pix2), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "m" (h)
-      : "%ecx");
-    return tmp;
-}
-
-static int sse16_sse2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
-    int tmp;
-  __asm__ volatile (
-      "shr $1,%2\n"
-      "pxor %%xmm0,%%xmm0\n"    /* mm0 = 0 */
-      "pxor %%xmm7,%%xmm7\n"    /* mm7 holds the sum */
-      "1:\n"
-      "movdqu (%0),%%xmm1\n"    /* mm1 = pix1[0][0-15] */
-      "movdqu (%1),%%xmm2\n"    /* mm2 = pix2[0][0-15] */
-      "movdqu (%0,%4),%%xmm3\n" /* mm3 = pix1[1][0-15] */
-      "movdqu (%1,%4),%%xmm4\n" /* mm4 = pix2[1][0-15] */
-
-      /* todo: mm1-mm2, mm3-mm4 */
-      /* algo: subtract mm1 from mm2 with saturation and vice versa */
-      /*       OR the results to get absolute difference */
-      "movdqa %%xmm1,%%xmm5\n"
-      "movdqa %%xmm3,%%xmm6\n"
-      "psubusb %%xmm2,%%xmm1\n"
-      "psubusb %%xmm4,%%xmm3\n"
-      "psubusb %%xmm5,%%xmm2\n"
-      "psubusb %%xmm6,%%xmm4\n"
-
-      "por %%xmm1,%%xmm2\n"
-      "por %%xmm3,%%xmm4\n"
-
-      /* now convert to 16-bit vectors so we can square them */
-      "movdqa %%xmm2,%%xmm1\n"
-      "movdqa %%xmm4,%%xmm3\n"
-
-      "punpckhbw %%xmm0,%%xmm2\n"
-      "punpckhbw %%xmm0,%%xmm4\n"
-      "punpcklbw %%xmm0,%%xmm1\n"  /* mm1 now spread over (mm1,mm2) */
-      "punpcklbw %%xmm0,%%xmm3\n"  /* mm4 now spread over (mm3,mm4) */
-
-      "pmaddwd %%xmm2,%%xmm2\n"
-      "pmaddwd %%xmm4,%%xmm4\n"
-      "pmaddwd %%xmm1,%%xmm1\n"
-      "pmaddwd %%xmm3,%%xmm3\n"
-
-      "lea (%0,%4,2), %0\n"        /* pix1 += 2*line_size */
-      "lea (%1,%4,2), %1\n"        /* pix2 += 2*line_size */
-
-      "paddd %%xmm2,%%xmm1\n"
-      "paddd %%xmm4,%%xmm3\n"
-      "paddd %%xmm1,%%xmm7\n"
-      "paddd %%xmm3,%%xmm7\n"
-
-      "decl %2\n"
-      "jnz 1b\n"
-
-      "movdqa %%xmm7,%%xmm1\n"
-      "psrldq $8, %%xmm7\n"        /* shift hi qword to lo */
-      "paddd %%xmm1,%%xmm7\n"
-      "movdqa %%xmm7,%%xmm1\n"
-      "psrldq $4, %%xmm7\n"        /* shift hi dword to lo */
-      "paddd %%xmm1,%%xmm7\n"
-      "movd %%xmm7,%3\n"
-      : "+r" (pix1), "+r" (pix2), "+r"(h), "=r"(tmp)
-      : "r" ((x86_reg)line_size));
-    return tmp;
-}
-
-static int hf_noise8_mmx(uint8_t * pix1, int line_size, int h) {
-    int tmp;
-  __asm__ volatile (
-      "movl %3,%%ecx\n"
-      "pxor %%mm7,%%mm7\n"
-      "pxor %%mm6,%%mm6\n"
-
-      "movq (%0),%%mm0\n"
-      "movq %%mm0, %%mm1\n"
-      "psllq $8, %%mm0\n"
-      "psrlq $8, %%mm1\n"
-      "psrlq $8, %%mm0\n"
-      "movq %%mm0, %%mm2\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm0\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm2\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm0\n"
-      "psubw %%mm3, %%mm2\n"
-
-      "add %2,%0\n"
-
-      "movq (%0),%%mm4\n"
-      "movq %%mm4, %%mm1\n"
-      "psllq $8, %%mm4\n"
-      "psrlq $8, %%mm1\n"
-      "psrlq $8, %%mm4\n"
-      "movq %%mm4, %%mm5\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm4\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm5\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm4\n"
-      "psubw %%mm3, %%mm5\n"
-      "psubw %%mm4, %%mm0\n"
-      "psubw %%mm5, %%mm2\n"
-      "pxor %%mm3, %%mm3\n"
-      "pxor %%mm1, %%mm1\n"
-      "pcmpgtw %%mm0, %%mm3\n\t"
-      "pcmpgtw %%mm2, %%mm1\n\t"
-      "pxor %%mm3, %%mm0\n"
-      "pxor %%mm1, %%mm2\n"
-      "psubw %%mm3, %%mm0\n"
-      "psubw %%mm1, %%mm2\n"
-      "paddw %%mm0, %%mm2\n"
-      "paddw %%mm2, %%mm6\n"
-
-      "add %2,%0\n"
-      "1:\n"
-
-      "movq (%0),%%mm0\n"
-      "movq %%mm0, %%mm1\n"
-      "psllq $8, %%mm0\n"
-      "psrlq $8, %%mm1\n"
-      "psrlq $8, %%mm0\n"
-      "movq %%mm0, %%mm2\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm0\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm2\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm0\n"
-      "psubw %%mm3, %%mm2\n"
-      "psubw %%mm0, %%mm4\n"
-      "psubw %%mm2, %%mm5\n"
-      "pxor %%mm3, %%mm3\n"
-      "pxor %%mm1, %%mm1\n"
-      "pcmpgtw %%mm4, %%mm3\n\t"
-      "pcmpgtw %%mm5, %%mm1\n\t"
-      "pxor %%mm3, %%mm4\n"
-      "pxor %%mm1, %%mm5\n"
-      "psubw %%mm3, %%mm4\n"
-      "psubw %%mm1, %%mm5\n"
-      "paddw %%mm4, %%mm5\n"
-      "paddw %%mm5, %%mm6\n"
-
-      "add %2,%0\n"
-
-      "movq (%0),%%mm4\n"
-      "movq %%mm4, %%mm1\n"
-      "psllq $8, %%mm4\n"
-      "psrlq $8, %%mm1\n"
-      "psrlq $8, %%mm4\n"
-      "movq %%mm4, %%mm5\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm4\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm5\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm4\n"
-      "psubw %%mm3, %%mm5\n"
-      "psubw %%mm4, %%mm0\n"
-      "psubw %%mm5, %%mm2\n"
-      "pxor %%mm3, %%mm3\n"
-      "pxor %%mm1, %%mm1\n"
-      "pcmpgtw %%mm0, %%mm3\n\t"
-      "pcmpgtw %%mm2, %%mm1\n\t"
-      "pxor %%mm3, %%mm0\n"
-      "pxor %%mm1, %%mm2\n"
-      "psubw %%mm3, %%mm0\n"
-      "psubw %%mm1, %%mm2\n"
-      "paddw %%mm0, %%mm2\n"
-      "paddw %%mm2, %%mm6\n"
-
-      "add %2,%0\n"
-      "subl $2, %%ecx\n"
-      " jnz 1b\n"
-
-      "movq %%mm6, %%mm0\n"
-      "punpcklwd %%mm7,%%mm0\n"
-      "punpckhwd %%mm7,%%mm6\n"
-      "paddd %%mm0, %%mm6\n"
-
-      "movq %%mm6,%%mm0\n"
-      "psrlq $32, %%mm6\n"
-      "paddd %%mm6,%%mm0\n"
-      "movd %%mm0,%1\n"
-      : "+r" (pix1), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "g" (h-2)
-      : "%ecx");
-      return tmp;
-}
-
-static int hf_noise16_mmx(uint8_t * pix1, int line_size, int h) {
-    int tmp;
-    uint8_t * pix= pix1;
-  __asm__ volatile (
-      "movl %3,%%ecx\n"
-      "pxor %%mm7,%%mm7\n"
-      "pxor %%mm6,%%mm6\n"
-
-      "movq (%0),%%mm0\n"
-      "movq 1(%0),%%mm1\n"
-      "movq %%mm0, %%mm2\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm0\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm2\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm0\n"
-      "psubw %%mm3, %%mm2\n"
-
-      "add %2,%0\n"
-
-      "movq (%0),%%mm4\n"
-      "movq 1(%0),%%mm1\n"
-      "movq %%mm4, %%mm5\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm4\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm5\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm4\n"
-      "psubw %%mm3, %%mm5\n"
-      "psubw %%mm4, %%mm0\n"
-      "psubw %%mm5, %%mm2\n"
-      "pxor %%mm3, %%mm3\n"
-      "pxor %%mm1, %%mm1\n"
-      "pcmpgtw %%mm0, %%mm3\n\t"
-      "pcmpgtw %%mm2, %%mm1\n\t"
-      "pxor %%mm3, %%mm0\n"
-      "pxor %%mm1, %%mm2\n"
-      "psubw %%mm3, %%mm0\n"
-      "psubw %%mm1, %%mm2\n"
-      "paddw %%mm0, %%mm2\n"
-      "paddw %%mm2, %%mm6\n"
-
-      "add %2,%0\n"
-      "1:\n"
-
-      "movq (%0),%%mm0\n"
-      "movq 1(%0),%%mm1\n"
-      "movq %%mm0, %%mm2\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm0\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm2\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm0\n"
-      "psubw %%mm3, %%mm2\n"
-      "psubw %%mm0, %%mm4\n"
-      "psubw %%mm2, %%mm5\n"
-      "pxor %%mm3, %%mm3\n"
-      "pxor %%mm1, %%mm1\n"
-      "pcmpgtw %%mm4, %%mm3\n\t"
-      "pcmpgtw %%mm5, %%mm1\n\t"
-      "pxor %%mm3, %%mm4\n"
-      "pxor %%mm1, %%mm5\n"
-      "psubw %%mm3, %%mm4\n"
-      "psubw %%mm1, %%mm5\n"
-      "paddw %%mm4, %%mm5\n"
-      "paddw %%mm5, %%mm6\n"
-
-      "add %2,%0\n"
-
-      "movq (%0),%%mm4\n"
-      "movq 1(%0),%%mm1\n"
-      "movq %%mm4, %%mm5\n"
-      "movq %%mm1, %%mm3\n"
-      "punpcklbw %%mm7,%%mm4\n"
-      "punpcklbw %%mm7,%%mm1\n"
-      "punpckhbw %%mm7,%%mm5\n"
-      "punpckhbw %%mm7,%%mm3\n"
-      "psubw %%mm1, %%mm4\n"
-      "psubw %%mm3, %%mm5\n"
-      "psubw %%mm4, %%mm0\n"
-      "psubw %%mm5, %%mm2\n"
-      "pxor %%mm3, %%mm3\n"
-      "pxor %%mm1, %%mm1\n"
-      "pcmpgtw %%mm0, %%mm3\n\t"
-      "pcmpgtw %%mm2, %%mm1\n\t"
-      "pxor %%mm3, %%mm0\n"
-      "pxor %%mm1, %%mm2\n"
-      "psubw %%mm3, %%mm0\n"
-      "psubw %%mm1, %%mm2\n"
-      "paddw %%mm0, %%mm2\n"
-      "paddw %%mm2, %%mm6\n"
-
-      "add %2,%0\n"
-      "subl $2, %%ecx\n"
-      " jnz 1b\n"
-
-      "movq %%mm6, %%mm0\n"
-      "punpcklwd %%mm7,%%mm0\n"
-      "punpckhwd %%mm7,%%mm6\n"
-      "paddd %%mm0, %%mm6\n"
-
-      "movq %%mm6,%%mm0\n"
-      "psrlq $32, %%mm6\n"
-      "paddd %%mm6,%%mm0\n"
-      "movd %%mm0,%1\n"
-      : "+r" (pix1), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "g" (h-2)
-      : "%ecx");
-      return tmp + hf_noise8_mmx(pix+8, line_size, h);
-}
-
-static int nsse16_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
-    MpegEncContext *c = p;
-    int score1, score2;
-
-    if(c) score1 = c->dsp.sse[0](c, pix1, pix2, line_size, h);
-    else  score1 = sse16_mmx(c, pix1, pix2, line_size, h);
-    score2= hf_noise16_mmx(pix1, line_size, h) - hf_noise16_mmx(pix2, line_size, h);
-
-    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + FFABS(score2)*8;
-}
-
-static int nsse8_mmx(void *p, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
-    MpegEncContext *c = p;
-    int score1= sse8_mmx(c, pix1, pix2, line_size, h);
-    int score2= hf_noise8_mmx(pix1, line_size, h) - hf_noise8_mmx(pix2, line_size, h);
-
-    if(c) return score1 + FFABS(score2)*c->avctx->nsse_weight;
-    else  return score1 + FFABS(score2)*8;
-}
-
-static int vsad_intra16_mmx(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
-    int tmp;
-
-    assert( (((int)pix) & 7) == 0);
-    assert((line_size &7) ==0);
-
-#define SUM(in0, in1, out0, out1) \
-      "movq (%0), %%mm2\n"\
-      "movq 8(%0), %%mm3\n"\
-      "add %2,%0\n"\
-      "movq %%mm2, " #out0 "\n"\
-      "movq %%mm3, " #out1 "\n"\
-      "psubusb " #in0 ", %%mm2\n"\
-      "psubusb " #in1 ", %%mm3\n"\
-      "psubusb " #out0 ", " #in0 "\n"\
-      "psubusb " #out1 ", " #in1 "\n"\
-      "por %%mm2, " #in0 "\n"\
-      "por %%mm3, " #in1 "\n"\
-      "movq " #in0 ", %%mm2\n"\
-      "movq " #in1 ", %%mm3\n"\
-      "punpcklbw %%mm7, " #in0 "\n"\
-      "punpcklbw %%mm7, " #in1 "\n"\
-      "punpckhbw %%mm7, %%mm2\n"\
-      "punpckhbw %%mm7, %%mm3\n"\
-      "paddw " #in1 ", " #in0 "\n"\
-      "paddw %%mm3, %%mm2\n"\
-      "paddw %%mm2, " #in0 "\n"\
-      "paddw " #in0 ", %%mm6\n"
-
-
-  __asm__ volatile (
-      "movl %3,%%ecx\n"
-      "pxor %%mm6,%%mm6\n"
-      "pxor %%mm7,%%mm7\n"
-      "movq (%0),%%mm0\n"
-      "movq 8(%0),%%mm1\n"
-      "add %2,%0\n"
-      "jmp 2f\n"
-      "1:\n"
-
-      SUM(%%mm4, %%mm5, %%mm0, %%mm1)
-      "2:\n"
-      SUM(%%mm0, %%mm1, %%mm4, %%mm5)
-
-      "subl $2, %%ecx\n"
-      "jnz 1b\n"
-
-      "movq %%mm6,%%mm0\n"
-      "psrlq $32, %%mm6\n"
-      "paddw %%mm6,%%mm0\n"
-      "movq %%mm0,%%mm6\n"
-      "psrlq $16, %%mm0\n"
-      "paddw %%mm6,%%mm0\n"
-      "movd %%mm0,%1\n"
-      : "+r" (pix), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "m" (h)
-      : "%ecx");
-    return tmp & 0xFFFF;
-}
-#undef SUM
-
-static int vsad_intra16_mmx2(void *v, uint8_t * pix, uint8_t * dummy, int line_size, int h) {
-    int tmp;
-
-    assert( (((int)pix) & 7) == 0);
-    assert((line_size &7) ==0);
-
-#define SUM(in0, in1, out0, out1) \
-      "movq (%0), " #out0 "\n"\
-      "movq 8(%0), " #out1 "\n"\
-      "add %2,%0\n"\
-      "psadbw " #out0 ", " #in0 "\n"\
-      "psadbw " #out1 ", " #in1 "\n"\
-      "paddw " #in1 ", " #in0 "\n"\
-      "paddw " #in0 ", %%mm6\n"
-
-  __asm__ volatile (
-      "movl %3,%%ecx\n"
-      "pxor %%mm6,%%mm6\n"
-      "pxor %%mm7,%%mm7\n"
-      "movq (%0),%%mm0\n"
-      "movq 8(%0),%%mm1\n"
-      "add %2,%0\n"
-      "jmp 2f\n"
-      "1:\n"
-
-      SUM(%%mm4, %%mm5, %%mm0, %%mm1)
-      "2:\n"
-      SUM(%%mm0, %%mm1, %%mm4, %%mm5)
-
-      "subl $2, %%ecx\n"
-      "jnz 1b\n"
-
-      "movd %%mm6,%1\n"
-      : "+r" (pix), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "m" (h)
-      : "%ecx");
-    return tmp;
-}
-#undef SUM
-
-static int vsad16_mmx(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
-    int tmp;
-
-    assert( (((int)pix1) & 7) == 0);
-    assert( (((int)pix2) & 7) == 0);
-    assert((line_size &7) ==0);
-
-#define SUM(in0, in1, out0, out1) \
-      "movq (%0),%%mm2\n"\
-      "movq (%1)," #out0 "\n"\
-      "movq 8(%0),%%mm3\n"\
-      "movq 8(%1)," #out1 "\n"\
-      "add %3,%0\n"\
-      "add %3,%1\n"\
-      "psubb " #out0 ", %%mm2\n"\
-      "psubb " #out1 ", %%mm3\n"\
-      "pxor %%mm7, %%mm2\n"\
-      "pxor %%mm7, %%mm3\n"\
-      "movq %%mm2, " #out0 "\n"\
-      "movq %%mm3, " #out1 "\n"\
-      "psubusb " #in0 ", %%mm2\n"\
-      "psubusb " #in1 ", %%mm3\n"\
-      "psubusb " #out0 ", " #in0 "\n"\
-      "psubusb " #out1 ", " #in1 "\n"\
-      "por %%mm2, " #in0 "\n"\
-      "por %%mm3, " #in1 "\n"\
-      "movq " #in0 ", %%mm2\n"\
-      "movq " #in1 ", %%mm3\n"\
-      "punpcklbw %%mm7, " #in0 "\n"\
-      "punpcklbw %%mm7, " #in1 "\n"\
-      "punpckhbw %%mm7, %%mm2\n"\
-      "punpckhbw %%mm7, %%mm3\n"\
-      "paddw " #in1 ", " #in0 "\n"\
-      "paddw %%mm3, %%mm2\n"\
-      "paddw %%mm2, " #in0 "\n"\
-      "paddw " #in0 ", %%mm6\n"
-
-
-  __asm__ volatile (
-      "movl %4,%%ecx\n"
-      "pxor %%mm6,%%mm6\n"
-      "pcmpeqw %%mm7,%%mm7\n"
-      "psllw $15, %%mm7\n"
-      "packsswb %%mm7, %%mm7\n"
-      "movq (%0),%%mm0\n"
-      "movq (%1),%%mm2\n"
-      "movq 8(%0),%%mm1\n"
-      "movq 8(%1),%%mm3\n"
-      "add %3,%0\n"
-      "add %3,%1\n"
-      "psubb %%mm2, %%mm0\n"
-      "psubb %%mm3, %%mm1\n"
-      "pxor %%mm7, %%mm0\n"
-      "pxor %%mm7, %%mm1\n"
-      "jmp 2f\n"
-      "1:\n"
-
-      SUM(%%mm4, %%mm5, %%mm0, %%mm1)
-      "2:\n"
-      SUM(%%mm0, %%mm1, %%mm4, %%mm5)
-
-      "subl $2, %%ecx\n"
-      "jnz 1b\n"
-
-      "movq %%mm6,%%mm0\n"
-      "psrlq $32, %%mm6\n"
-      "paddw %%mm6,%%mm0\n"
-      "movq %%mm0,%%mm6\n"
-      "psrlq $16, %%mm0\n"
-      "paddw %%mm6,%%mm0\n"
-      "movd %%mm0,%2\n"
-      : "+r" (pix1), "+r" (pix2), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "m" (h)
-      : "%ecx");
-    return tmp & 0x7FFF;
-}
-#undef SUM
-
-static int vsad16_mmx2(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h) {
-    int tmp;
-
-    assert( (((int)pix1) & 7) == 0);
-    assert( (((int)pix2) & 7) == 0);
-    assert((line_size &7) ==0);
-
-#define SUM(in0, in1, out0, out1) \
-      "movq (%0)," #out0 "\n"\
-      "movq (%1),%%mm2\n"\
-      "movq 8(%0)," #out1 "\n"\
-      "movq 8(%1),%%mm3\n"\
-      "add %3,%0\n"\
-      "add %3,%1\n"\
-      "psubb %%mm2, " #out0 "\n"\
-      "psubb %%mm3, " #out1 "\n"\
-      "pxor %%mm7, " #out0 "\n"\
-      "pxor %%mm7, " #out1 "\n"\
-      "psadbw " #out0 ", " #in0 "\n"\
-      "psadbw " #out1 ", " #in1 "\n"\
-      "paddw " #in1 ", " #in0 "\n"\
-      "paddw " #in0 ", %%mm6\n"
-
-  __asm__ volatile (
-      "movl %4,%%ecx\n"
-      "pxor %%mm6,%%mm6\n"
-      "pcmpeqw %%mm7,%%mm7\n"
-      "psllw $15, %%mm7\n"
-      "packsswb %%mm7, %%mm7\n"
-      "movq (%0),%%mm0\n"
-      "movq (%1),%%mm2\n"
-      "movq 8(%0),%%mm1\n"
-      "movq 8(%1),%%mm3\n"
-      "add %3,%0\n"
-      "add %3,%1\n"
-      "psubb %%mm2, %%mm0\n"
-      "psubb %%mm3, %%mm1\n"
-      "pxor %%mm7, %%mm0\n"
-      "pxor %%mm7, %%mm1\n"
-      "jmp 2f\n"
-      "1:\n"
-
-      SUM(%%mm4, %%mm5, %%mm0, %%mm1)
-      "2:\n"
-      SUM(%%mm0, %%mm1, %%mm4, %%mm5)
-
-      "subl $2, %%ecx\n"
-      "jnz 1b\n"
-
-      "movd %%mm6,%2\n"
-      : "+r" (pix1), "+r" (pix2), "=r"(tmp)
-      : "r" ((x86_reg)line_size) , "m" (h)
-      : "%ecx");
-    return tmp;
-}
-#undef SUM
-
-static void diff_bytes_mmx(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
-    x86_reg i=0;
-    __asm__ volatile(
-        "1:                             \n\t"
-        "movq  (%2, %0), %%mm0          \n\t"
-        "movq  (%1, %0), %%mm1          \n\t"
-        "psubb %%mm0, %%mm1             \n\t"
-        "movq %%mm1, (%3, %0)           \n\t"
-        "movq 8(%2, %0), %%mm0          \n\t"
-        "movq 8(%1, %0), %%mm1          \n\t"
-        "psubb %%mm0, %%mm1             \n\t"
-        "movq %%mm1, 8(%3, %0)          \n\t"
-        "add $16, %0                    \n\t"
-        "cmp %4, %0                     \n\t"
-        " jb 1b                         \n\t"
-        : "+r" (i)
-        : "r"(src1), "r"(src2), "r"(dst), "r"((x86_reg)w-15)
-    );
-    for(; i<w; i++)
-        dst[i+0] = src1[i+0]-src2[i+0];
-}
-
-static void sub_hfyu_median_prediction_mmx2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top){
-    x86_reg i=0;
-    uint8_t l, lt;
-
-    __asm__ volatile(
-        "1:                             \n\t"
-        "movq  -1(%1, %0), %%mm0        \n\t" // LT
-        "movq  (%1, %0), %%mm1          \n\t" // T
-        "movq  -1(%2, %0), %%mm2        \n\t" // L
-        "movq  (%2, %0), %%mm3          \n\t" // X
-        "movq %%mm2, %%mm4              \n\t" // L
-        "psubb %%mm0, %%mm2             \n\t"
-        "paddb %%mm1, %%mm2             \n\t" // L + T - LT
-        "movq %%mm4, %%mm5              \n\t" // L
-        "pmaxub %%mm1, %%mm4            \n\t" // max(T, L)
-        "pminub %%mm5, %%mm1            \n\t" // min(T, L)
-        "pminub %%mm2, %%mm4            \n\t"
-        "pmaxub %%mm1, %%mm4            \n\t"
-        "psubb %%mm4, %%mm3             \n\t" // dst - pred
-        "movq %%mm3, (%3, %0)           \n\t"
-        "add $8, %0                     \n\t"
-        "cmp %4, %0                     \n\t"
-        " jb 1b                         \n\t"
-        : "+r" (i)
-        : "r"(src1), "r"(src2), "r"(dst), "r"((x86_reg)w)
-    );
-
-    l= *left;
-    lt= *left_top;
-
-    dst[0]= src2[0] - mid_pred(l, src1[0], (l + src1[0] - lt)&0xFF);
-
-    *left_top= src1[w-1];
-    *left    = src2[w-1];
-}
-
-#define DIFF_PIXELS_1(m,a,t,p1,p2)\
-    "mov"#m" "#p1", "#a"              \n\t"\
-    "mov"#m" "#p2", "#t"              \n\t"\
-    "punpcklbw "#a", "#t"             \n\t"\
-    "punpcklbw "#a", "#a"             \n\t"\
-    "psubw     "#t", "#a"             \n\t"\
-
-#define DIFF_PIXELS_8(m0,m1,mm,p1,p2,stride,temp) {\
-    uint8_t *p1b=p1, *p2b=p2;\
-    __asm__ volatile(\
-        DIFF_PIXELS_1(m0, mm##0, mm##7, (%1), (%2))\
-        DIFF_PIXELS_1(m0, mm##1, mm##7, (%1,%3), (%2,%3))\
-        DIFF_PIXELS_1(m0, mm##2, mm##7, (%1,%3,2), (%2,%3,2))\
-        "add %4, %1                   \n\t"\
-        "add %4, %2                   \n\t"\
-        DIFF_PIXELS_1(m0, mm##3, mm##7, (%1), (%2))\
-        DIFF_PIXELS_1(m0, mm##4, mm##7, (%1,%3), (%2,%3))\
-        DIFF_PIXELS_1(m0, mm##5, mm##7, (%1,%3,2), (%2,%3,2))\
-        DIFF_PIXELS_1(m0, mm##6, mm##7, (%1,%4), (%2,%4))\
-        "mov"#m1" "#mm"0, %0          \n\t"\
-        DIFF_PIXELS_1(m0, mm##7, mm##0, (%1,%3,4), (%2,%3,4))\
-        "mov"#m1" %0, "#mm"0          \n\t"\
-        : "+m"(temp), "+r"(p1b), "+r"(p2b)\
-        : "r"((x86_reg)stride), "r"((x86_reg)stride*3)\
-    );\
-}
-    //the "+m"(temp) is needed as gcc 2.95 sometimes fails to compile "=m"(temp)
-
-#define DIFF_PIXELS_4x8(p1,p2,stride,temp) DIFF_PIXELS_8(d, q,   %%mm,  p1, p2, stride, temp)
-#define DIFF_PIXELS_8x8(p1,p2,stride,temp) DIFF_PIXELS_8(q, dqa, %%xmm, p1, p2, stride, temp)
-
-#define LBUTTERFLY2(a1,b1,a2,b2)\
-    "paddw " #b1 ", " #a1 "           \n\t"\
-    "paddw " #b2 ", " #a2 "           \n\t"\
-    "paddw " #b1 ", " #b1 "           \n\t"\
-    "paddw " #b2 ", " #b2 "           \n\t"\
-    "psubw " #a1 ", " #b1 "           \n\t"\
-    "psubw " #a2 ", " #b2 "           \n\t"
-
-#define HADAMARD8(m0, m1, m2, m3, m4, m5, m6, m7)\
-        LBUTTERFLY2(m0, m1, m2, m3)\
-        LBUTTERFLY2(m4, m5, m6, m7)\
-        LBUTTERFLY2(m0, m2, m1, m3)\
-        LBUTTERFLY2(m4, m6, m5, m7)\
-        LBUTTERFLY2(m0, m4, m1, m5)\
-        LBUTTERFLY2(m2, m6, m3, m7)\
-
-#define HADAMARD48 HADAMARD8(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm6, %%mm7)
-
-#define MMABS_MMX(a,z)\
-    "pxor " #z ", " #z "              \n\t"\
-    "pcmpgtw " #a ", " #z "           \n\t"\
-    "pxor " #z ", " #a "              \n\t"\
-    "psubw " #z ", " #a "             \n\t"
-
-#define MMABS_MMX2(a,z)\
-    "pxor " #z ", " #z "              \n\t"\
-    "psubw " #a ", " #z "             \n\t"\
-    "pmaxsw " #z ", " #a "            \n\t"
-
-#define MMABS_SSSE3(a,z)\
-    "pabsw " #a ", " #a "             \n\t"
-
-#define MMABS_SUM(a,z, sum)\
-    MMABS(a,z)\
-    "paddusw " #a ", " #sum "         \n\t"
-
-#define MMABS_SUM_8x8_NOSPILL\
-    MMABS(%%xmm0, %%xmm8)\
-    MMABS(%%xmm1, %%xmm9)\
-    MMABS_SUM(%%xmm2, %%xmm8, %%xmm0)\
-    MMABS_SUM(%%xmm3, %%xmm9, %%xmm1)\
-    MMABS_SUM(%%xmm4, %%xmm8, %%xmm0)\
-    MMABS_SUM(%%xmm5, %%xmm9, %%xmm1)\
-    MMABS_SUM(%%xmm6, %%xmm8, %%xmm0)\
-    MMABS_SUM(%%xmm7, %%xmm9, %%xmm1)\
-    "paddusw %%xmm1, %%xmm0           \n\t"
-
-#if ARCH_X86_64
-#define MMABS_SUM_8x8_SSE2 MMABS_SUM_8x8_NOSPILL
-#else
-#define MMABS_SUM_8x8_SSE2\
-    "movdqa %%xmm7, (%1)              \n\t"\
-    MMABS(%%xmm0, %%xmm7)\
-    MMABS(%%xmm1, %%xmm7)\
-    MMABS_SUM(%%xmm2, %%xmm7, %%xmm0)\
-    MMABS_SUM(%%xmm3, %%xmm7, %%xmm1)\
-    MMABS_SUM(%%xmm4, %%xmm7, %%xmm0)\
-    MMABS_SUM(%%xmm5, %%xmm7, %%xmm1)\
-    MMABS_SUM(%%xmm6, %%xmm7, %%xmm0)\
-    "movdqa (%1), %%xmm2              \n\t"\
-    MMABS_SUM(%%xmm2, %%xmm7, %%xmm1)\
-    "paddusw %%xmm1, %%xmm0           \n\t"
-#endif
-
-/* FIXME: HSUM_* saturates at 64k, while an 8x8 hadamard or dct block can get up to
- * about 100k on extreme inputs. But that's very unlikely to occur in natural video,
- * and it's even more unlikely to not have any alternative mvs/modes with lower cost. */
-#define HSUM_MMX(a, t, dst)\
-    "movq "#a", "#t"                  \n\t"\
-    "psrlq $32, "#a"                  \n\t"\
-    "paddusw "#t", "#a"               \n\t"\
-    "movq "#a", "#t"                  \n\t"\
-    "psrlq $16, "#a"                  \n\t"\
-    "paddusw "#t", "#a"               \n\t"\
-    "movd "#a", "#dst"                \n\t"\
-
-#define HSUM_MMX2(a, t, dst)\
-    "pshufw $0x0E, "#a", "#t"         \n\t"\
-    "paddusw "#t", "#a"               \n\t"\
-    "pshufw $0x01, "#a", "#t"         \n\t"\
-    "paddusw "#t", "#a"               \n\t"\
-    "movd "#a", "#dst"                \n\t"\
-
-#define HSUM_SSE2(a, t, dst)\
-    "movhlps "#a", "#t"               \n\t"\
-    "paddusw "#t", "#a"               \n\t"\
-    "pshuflw $0x0E, "#a", "#t"        \n\t"\
-    "paddusw "#t", "#a"               \n\t"\
-    "pshuflw $0x01, "#a", "#t"        \n\t"\
-    "paddusw "#t", "#a"               \n\t"\
-    "movd "#a", "#dst"                \n\t"\
-
-#define HADAMARD8_DIFF_MMX(cpu) \
-static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\
-    DECLARE_ALIGNED(8, uint64_t, temp)[13];\
-    int sum;\
-\
-    assert(h==8);\
-\
-    DIFF_PIXELS_4x8(src1, src2, stride, temp[0]);\
-\
-    __asm__ volatile(\
-        HADAMARD48\
-\
-        "movq %%mm7, 96(%1)             \n\t"\
-\
-        TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
-        STORE4(8,  0(%1), %%mm0, %%mm3, %%mm7, %%mm2)\
-\
-        "movq 96(%1), %%mm7             \n\t"\
-        TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
-        STORE4(8, 64(%1), %%mm4, %%mm7, %%mm0, %%mm6)\
-\
-        : "=r" (sum)\
-        : "r"(temp)\
-    );\
-\
-    DIFF_PIXELS_4x8(src1+4, src2+4, stride, temp[4]);\
-\
-    __asm__ volatile(\
-        HADAMARD48\
-\
-        "movq %%mm7, 96(%1)             \n\t"\
-\
-        TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
-        STORE4(8, 32(%1), %%mm0, %%mm3, %%mm7, %%mm2)\
-\
-        "movq 96(%1), %%mm7             \n\t"\
-        TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
-        "movq %%mm7, %%mm5              \n\t"/*FIXME remove*/\
-        "movq %%mm6, %%mm7              \n\t"\
-        "movq %%mm0, %%mm6              \n\t"\
-\
-        LOAD4(8, 64(%1), %%mm0, %%mm1, %%mm2, %%mm3)\
-\
-        HADAMARD48\
-        "movq %%mm7, 64(%1)             \n\t"\
-        MMABS(%%mm0, %%mm7)\
-        MMABS(%%mm1, %%mm7)\
-        MMABS_SUM(%%mm2, %%mm7, %%mm0)\
-        MMABS_SUM(%%mm3, %%mm7, %%mm1)\
-        MMABS_SUM(%%mm4, %%mm7, %%mm0)\
-        MMABS_SUM(%%mm5, %%mm7, %%mm1)\
-        MMABS_SUM(%%mm6, %%mm7, %%mm0)\
-        "movq 64(%1), %%mm2             \n\t"\
-        MMABS_SUM(%%mm2, %%mm7, %%mm1)\
-        "paddusw %%mm1, %%mm0           \n\t"\
-        "movq %%mm0, 64(%1)             \n\t"\
-\
-        LOAD4(8,  0(%1), %%mm0, %%mm1, %%mm2, %%mm3)\
-        LOAD4(8, 32(%1), %%mm4, %%mm5, %%mm6, %%mm7)\
-\
-        HADAMARD48\
-        "movq %%mm7, (%1)               \n\t"\
-        MMABS(%%mm0, %%mm7)\
-        MMABS(%%mm1, %%mm7)\
-        MMABS_SUM(%%mm2, %%mm7, %%mm0)\
-        MMABS_SUM(%%mm3, %%mm7, %%mm1)\
-        MMABS_SUM(%%mm4, %%mm7, %%mm0)\
-        MMABS_SUM(%%mm5, %%mm7, %%mm1)\
-        MMABS_SUM(%%mm6, %%mm7, %%mm0)\
-        "movq (%1), %%mm2               \n\t"\
-        MMABS_SUM(%%mm2, %%mm7, %%mm1)\
-        "paddusw 64(%1), %%mm0          \n\t"\
-        "paddusw %%mm1, %%mm0           \n\t"\
-\
-        HSUM(%%mm0, %%mm1, %0)\
-\
-        : "=r" (sum)\
-        : "r"(temp)\
-    );\
-    return sum&0xFFFF;\
-}\
-WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
-
-#define HADAMARD8_DIFF_SSE2(cpu) \
-static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\
-    DECLARE_ALIGNED(16, uint64_t, temp)[4];\
-    int sum;\
-\
-    assert(h==8);\
-\
-    DIFF_PIXELS_8x8(src1, src2, stride, temp[0]);\
-\
-    __asm__ volatile(\
-        HADAMARD8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)\
-        TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%1))\
-        HADAMARD8(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1)\
-        MMABS_SUM_8x8\
-        HSUM_SSE2(%%xmm0, %%xmm1, %0)\
-        : "=r" (sum)\
-        : "r"(temp)\
-    );\
-    return sum&0xFFFF;\
-}\
-WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
-
-#define MMABS(a,z)         MMABS_MMX(a,z)
-#define HSUM(a,t,dst)      HSUM_MMX(a,t,dst)
-HADAMARD8_DIFF_MMX(mmx)
-#undef MMABS
-#undef HSUM
-
-#define MMABS(a,z)         MMABS_MMX2(a,z)
-#define MMABS_SUM_8x8      MMABS_SUM_8x8_SSE2
-#define HSUM(a,t,dst)      HSUM_MMX2(a,t,dst)
-HADAMARD8_DIFF_MMX(mmx2)
-HADAMARD8_DIFF_SSE2(sse2)
-#undef MMABS
-#undef MMABS_SUM_8x8
-#undef HSUM
-
-#if HAVE_SSSE3
-#define MMABS(a,z)         MMABS_SSSE3(a,z)
-#define MMABS_SUM_8x8      MMABS_SUM_8x8_NOSPILL
-HADAMARD8_DIFF_SSE2(ssse3)
-#undef MMABS
-#undef MMABS_SUM_8x8
-#endif
-
-#define DCT_SAD4(m,mm,o)\
-    "mov"#m" "#o"+ 0(%1), "#mm"2      \n\t"\
-    "mov"#m" "#o"+16(%1), "#mm"3      \n\t"\
-    "mov"#m" "#o"+32(%1), "#mm"4      \n\t"\
-    "mov"#m" "#o"+48(%1), "#mm"5      \n\t"\
-    MMABS_SUM(mm##2, mm##6, mm##0)\
-    MMABS_SUM(mm##3, mm##7, mm##1)\
-    MMABS_SUM(mm##4, mm##6, mm##0)\
-    MMABS_SUM(mm##5, mm##7, mm##1)\
-
-#define DCT_SAD_MMX\
-    "pxor %%mm0, %%mm0                \n\t"\
-    "pxor %%mm1, %%mm1                \n\t"\
-    DCT_SAD4(q, %%mm, 0)\
-    DCT_SAD4(q, %%mm, 8)\
-    DCT_SAD4(q, %%mm, 64)\
-    DCT_SAD4(q, %%mm, 72)\
-    "paddusw %%mm1, %%mm0             \n\t"\
-    HSUM(%%mm0, %%mm1, %0)
-
-#define DCT_SAD_SSE2\
-    "pxor %%xmm0, %%xmm0              \n\t"\
-    "pxor %%xmm1, %%xmm1              \n\t"\
-    DCT_SAD4(dqa, %%xmm, 0)\
-    DCT_SAD4(dqa, %%xmm, 64)\
-    "paddusw %%xmm1, %%xmm0           \n\t"\
-    HSUM(%%xmm0, %%xmm1, %0)
-
-#define DCT_SAD_FUNC(cpu) \
-static int sum_abs_dctelem_##cpu(DCTELEM *block){\
-    int sum;\
-    __asm__ volatile(\
-        DCT_SAD\
-        :"=r"(sum)\
-        :"r"(block)\
-    );\
-    return sum&0xFFFF;\
-}
-
-#define DCT_SAD       DCT_SAD_MMX
-#define HSUM(a,t,dst) HSUM_MMX(a,t,dst)
-#define MMABS(a,z)    MMABS_MMX(a,z)
-DCT_SAD_FUNC(mmx)
-#undef MMABS
-#undef HSUM
-
-#define HSUM(a,t,dst) HSUM_MMX2(a,t,dst)
-#define MMABS(a,z)    MMABS_MMX2(a,z)
-DCT_SAD_FUNC(mmx2)
-#undef HSUM
-#undef DCT_SAD
-
-#define DCT_SAD       DCT_SAD_SSE2
-#define HSUM(a,t,dst) HSUM_SSE2(a,t,dst)
-DCT_SAD_FUNC(sse2)
-#undef MMABS
-
-#if HAVE_SSSE3
-#define MMABS(a,z)    MMABS_SSSE3(a,z)
-DCT_SAD_FUNC(ssse3)
-#undef MMABS
-#endif
-#undef HSUM
-#undef DCT_SAD
-
-static int ssd_int8_vs_int16_mmx(const int8_t *pix1, const int16_t *pix2, int size){
-    int sum;
-    x86_reg i=size;
-    __asm__ volatile(
-        "pxor %%mm4, %%mm4 \n"
-        "1: \n"
-        "sub $8, %0 \n"
-        "movq (%2,%0), %%mm2 \n"
-        "movq (%3,%0,2), %%mm0 \n"
-        "movq 8(%3,%0,2), %%mm1 \n"
-        "punpckhbw %%mm2, %%mm3 \n"
-        "punpcklbw %%mm2, %%mm2 \n"
-        "psraw $8, %%mm3 \n"
-        "psraw $8, %%mm2 \n"
-        "psubw %%mm3, %%mm1 \n"
-        "psubw %%mm2, %%mm0 \n"
-        "pmaddwd %%mm1, %%mm1 \n"
-        "pmaddwd %%mm0, %%mm0 \n"
-        "paddd %%mm1, %%mm4 \n"
-        "paddd %%mm0, %%mm4 \n"
-        "jg 1b \n"
-        "movq %%mm4, %%mm3 \n"
-        "psrlq $32, %%mm3 \n"
-        "paddd %%mm3, %%mm4 \n"
-        "movd %%mm4, %1 \n"
-        :"+r"(i), "=r"(sum)
-        :"r"(pix1), "r"(pix2)
-    );
-    return sum;
-}
-
-#define PHADDD(a, t)\
-    "movq "#a", "#t"                  \n\t"\
-    "psrlq $32, "#a"                  \n\t"\
-    "paddd "#t", "#a"                 \n\t"
-/*
-   pmulhw: dst[0-15]=(src[0-15]*dst[0-15])[16-31]
-   pmulhrw: dst[0-15]=(src[0-15]*dst[0-15] + 0x8000)[16-31]
-   pmulhrsw: dst[0-15]=(src[0-15]*dst[0-15] + 0x4000)[15-30]
- */
-#define PMULHRW(x, y, s, o)\
-    "pmulhw " #s ", "#x "            \n\t"\
-    "pmulhw " #s ", "#y "            \n\t"\
-    "paddw " #o ", "#x "             \n\t"\
-    "paddw " #o ", "#y "             \n\t"\
-    "psraw $1, "#x "                 \n\t"\
-    "psraw $1, "#y "                 \n\t"
-#define DEF(x) x ## _mmx
-#define SET_RND MOVQ_WONE
-#define SCALE_OFFSET 1
-
-#include "dsputil_mmx_qns_template.c"
-
-#undef DEF
-#undef SET_RND
-#undef SCALE_OFFSET
-#undef PMULHRW
-
-#define DEF(x) x ## _3dnow
-#define SET_RND(x)
-#define SCALE_OFFSET 0
-#define PMULHRW(x, y, s, o)\
-    "pmulhrw " #s ", "#x "           \n\t"\
-    "pmulhrw " #s ", "#y "           \n\t"
-
-#include "dsputil_mmx_qns_template.c"
-
-#undef DEF
-#undef SET_RND
-#undef SCALE_OFFSET
-#undef PMULHRW
-
-#if HAVE_SSSE3
-#undef PHADDD
-#define DEF(x) x ## _ssse3
-#define SET_RND(x)
-#define SCALE_OFFSET -1
-#define PHADDD(a, t)\
-    "pshufw $0x0E, "#a", "#t"         \n\t"\
-    "paddd "#t", "#a"                 \n\t" /* faster than phaddd on core2 */
-#define PMULHRW(x, y, s, o)\
-    "pmulhrsw " #s ", "#x "          \n\t"\
-    "pmulhrsw " #s ", "#y "          \n\t"
-
-#include "dsputil_mmx_qns_template.c"
-
-#undef DEF
-#undef SET_RND
-#undef SCALE_OFFSET
-#undef PMULHRW
-#undef PHADDD
-#endif //HAVE_SSSE3
-
-
-void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
-{
-    if (mm_flags & FF_MM_MMX) {
-        const int dct_algo = avctx->dct_algo;
-        if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
-            if(mm_flags & FF_MM_SSE2){
-                c->fdct = ff_fdct_sse2;
-            }else if(mm_flags & FF_MM_MMX2){
-                c->fdct = ff_fdct_mmx2;
-            }else{
-                c->fdct = ff_fdct_mmx;
-            }
-        }
-
-        c->get_pixels = get_pixels_mmx;
-        c->diff_pixels = diff_pixels_mmx;
-        c->pix_sum = pix_sum16_mmx;
-
-        c->diff_bytes= diff_bytes_mmx;
-        c->sum_abs_dctelem= sum_abs_dctelem_mmx;
-
-        c->hadamard8_diff[0]= hadamard8_diff16_mmx;
-        c->hadamard8_diff[1]= hadamard8_diff_mmx;
-
-        c->pix_norm1 = pix_norm1_mmx;
-        c->sse[0] = (mm_flags & FF_MM_SSE2) ? sse16_sse2 : sse16_mmx;
-          c->sse[1] = sse8_mmx;
-        c->vsad[4]= vsad_intra16_mmx;
-
-        c->nsse[0] = nsse16_mmx;
-        c->nsse[1] = nsse8_mmx;
-        if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-            c->vsad[0] = vsad16_mmx;
-        }
-
-        if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-            c->try_8x8basis= try_8x8basis_mmx;
-        }
-        c->add_8x8basis= add_8x8basis_mmx;
-
-        c->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx;
-
-
-        if (mm_flags & FF_MM_MMX2) {
-            c->sum_abs_dctelem= sum_abs_dctelem_mmx2;
-            c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
-            c->hadamard8_diff[1]= hadamard8_diff_mmx2;
-            c->vsad[4]= vsad_intra16_mmx2;
-
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->vsad[0] = vsad16_mmx2;
-            }
-
-            c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2;
-        }
-
-        if(mm_flags & FF_MM_SSE2){
-            c->get_pixels = get_pixels_sse2;
-            c->sum_abs_dctelem= sum_abs_dctelem_sse2;
-            c->hadamard8_diff[0]= hadamard8_diff16_sse2;
-            c->hadamard8_diff[1]= hadamard8_diff_sse2;
-#if CONFIG_LPC
-            c->lpc_compute_autocorr = ff_lpc_compute_autocorr_sse2;
-#endif
-        }
-
-#if HAVE_SSSE3
-        if(mm_flags & FF_MM_SSSE3){
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->try_8x8basis= try_8x8basis_ssse3;
-            }
-            c->add_8x8basis= add_8x8basis_ssse3;
-            c->sum_abs_dctelem= sum_abs_dctelem_ssse3;
-            c->hadamard8_diff[0]= hadamard8_diff16_ssse3;
-            c->hadamard8_diff[1]= hadamard8_diff_ssse3;
-        }
-#endif
-
-        if(mm_flags & FF_MM_3DNOW){
-            if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-                c->try_8x8basis= try_8x8basis_3dnow;
-            }
-            c->add_8x8basis= add_8x8basis_3dnow;
-        }
-    }
-
-    dsputil_init_pix_mmx(c, avctx);
-}
diff --git a/libavcodec/x86/fdct_mmx.c b/libavcodec/x86/fdct_mmx.c
deleted file mode 100644
index 6e52285..0000000
--- a/libavcodec/x86/fdct_mmx.c
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * MMX optimized forward DCT
- * The gcc porting is Copyright (c) 2001 Fabrice Bellard.
- * cleanup/optimizations are Copyright (c) 2002-2004 Michael Niedermayer <michaelni at gmx.at>
- * SSE2 optimization is Copyright (c) 2004 Denes Balatoni.
- *
- * from  fdctam32.c - AP922 MMX(3D-Now) forward-DCT
- *
- *  Intel Application Note AP-922 - fast, precise implementation of DCT
- *        http://developer.intel.com/vtune/cbts/appnotes.htm
- *
- * Also of inspiration:
- * a page about fdct at http://www.geocities.com/ssavekar/dct.htm
- * Skal's fdct at http://skal.planet-d.net/coding/dct.html
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "libavcodec/dsputil.h"
-
-//////////////////////////////////////////////////////////////////////
-//
-// constants for the forward DCT
-// -----------------------------
-//
-// Be sure to check that your compiler is aligning all constants to QWORD
-// (8-byte) memory boundaries!  Otherwise the unaligned memory access will
-// severely stall MMX execution.
-//
-//////////////////////////////////////////////////////////////////////
-
-#define BITS_FRW_ACC   3 //; 2 or 3 for accuracy
-#define SHIFT_FRW_COL  BITS_FRW_ACC
-#define SHIFT_FRW_ROW  (BITS_FRW_ACC + 17 - 3)
-#define RND_FRW_ROW    (1 << (SHIFT_FRW_ROW-1))
-//#define RND_FRW_COL    (1 << (SHIFT_FRW_COL-1))
-
-#define X8(x) x,x,x,x,x,x,x,x
-
-//concatenated table, for forward DCT transformation
-DECLARE_ALIGNED(16, static const int16_t, fdct_tg_all_16)[24] = {
-    X8(13036),  // tg * (2<<16) + 0.5
-    X8(27146),  // tg * (2<<16) + 0.5
-    X8(-21746)  // tg * (2<<16) + 0.5
-};
-
-DECLARE_ALIGNED(16, static const int16_t, ocos_4_16)[8] = {
-    X8(23170)   //cos * (2<<15) + 0.5
-};
-
-DECLARE_ALIGNED(16, static const int16_t, fdct_one_corr)[8] = { X8(1) };
-
-DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = {RND_FRW_ROW, RND_FRW_ROW };
-
-static struct
-{
- DECLARE_ALIGNED(16, const int32_t, fdct_r_row_sse2)[4];
-} fdct_r_row_sse2 =
-{{
- RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW
-}};
-//DECLARE_ALIGNED(16, static const long, fdct_r_row_sse2)[4] = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
-
-DECLARE_ALIGNED(8, static const int16_t, tab_frw_01234567)[] = {  // forward_dct coeff table
-  16384,   16384,   22725,   19266,
-  16384,   16384,   12873,    4520,
-  21407,    8867,   19266,   -4520,
-  -8867,  -21407,  -22725,  -12873,
-  16384,  -16384,   12873,  -22725,
- -16384,   16384,    4520,   19266,
-   8867,  -21407,    4520,  -12873,
-  21407,   -8867,   19266,  -22725,
-
-  22725,   22725,   31521,   26722,
-  22725,   22725,   17855,    6270,
-  29692,   12299,   26722,   -6270,
- -12299,  -29692,  -31521,  -17855,
-  22725,  -22725,   17855,  -31521,
- -22725,   22725,    6270,   26722,
-  12299,  -29692,    6270,  -17855,
-  29692,  -12299,   26722,  -31521,
-
-  21407,   21407,   29692,   25172,
-  21407,   21407,   16819,    5906,
-  27969,   11585,   25172,   -5906,
- -11585,  -27969,  -29692,  -16819,
-  21407,  -21407,   16819,  -29692,
- -21407,   21407,    5906,   25172,
-  11585,  -27969,    5906,  -16819,
-  27969,  -11585,   25172,  -29692,
-
-  19266,   19266,   26722,   22654,
-  19266,   19266,   15137,    5315,
-  25172,   10426,   22654,   -5315,
- -10426,  -25172,  -26722,  -15137,
-  19266,  -19266,   15137,  -26722,
- -19266,   19266,    5315,   22654,
-  10426,  -25172,    5315,  -15137,
-  25172,  -10426,   22654,  -26722,
-
-  16384,   16384,   22725,   19266,
-  16384,   16384,   12873,    4520,
-  21407,    8867,   19266,   -4520,
-  -8867,  -21407,  -22725,  -12873,
-  16384,  -16384,   12873,  -22725,
- -16384,   16384,    4520,   19266,
-   8867,  -21407,    4520,  -12873,
-  21407,   -8867,   19266,  -22725,
-
-  19266,   19266,   26722,   22654,
-  19266,   19266,   15137,    5315,
-  25172,   10426,   22654,   -5315,
- -10426,  -25172,  -26722,  -15137,
-  19266,  -19266,   15137,  -26722,
- -19266,   19266,    5315,   22654,
-  10426,  -25172,    5315,  -15137,
-  25172,  -10426,   22654,  -26722,
-
-  21407,   21407,   29692,   25172,
-  21407,   21407,   16819,    5906,
-  27969,   11585,   25172,   -5906,
- -11585,  -27969,  -29692,  -16819,
-  21407,  -21407,   16819,  -29692,
- -21407,   21407,    5906,   25172,
-  11585,  -27969,    5906,  -16819,
-  27969,  -11585,   25172,  -29692,
-
-  22725,   22725,   31521,   26722,
-  22725,   22725,   17855,    6270,
-  29692,   12299,   26722,   -6270,
- -12299,  -29692,  -31521,  -17855,
-  22725,  -22725,   17855,  -31521,
- -22725,   22725,    6270,   26722,
-  12299,  -29692,    6270,  -17855,
-  29692,  -12299,   26722,  -31521,
-};
-
-static struct
-{
- DECLARE_ALIGNED(16, const int16_t, tab_frw_01234567_sse2)[256];
-} tab_frw_01234567_sse2 =
-{{
-//DECLARE_ALIGNED(16, static const int16_t, tab_frw_01234567_sse2)[] = {  // forward_dct coeff table
-#define TABLE_SSE2 C4,  C4,  C1,  C3, -C6, -C2, -C1, -C5, \
-                   C4,  C4,  C5,  C7,  C2,  C6,  C3, -C7, \
-                  -C4,  C4,  C7,  C3,  C6, -C2,  C7, -C5, \
-                   C4, -C4,  C5, -C1,  C2, -C6,  C3, -C1,
-// c1..c7 * cos(pi/4) * 2^15
-#define C1 22725
-#define C2 21407
-#define C3 19266
-#define C4 16384
-#define C5 12873
-#define C6 8867
-#define C7 4520
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 31521
-#define C2 29692
-#define C3 26722
-#define C4 22725
-#define C5 17855
-#define C6 12299
-#define C7 6270
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 29692
-#define C2 27969
-#define C3 25172
-#define C4 21407
-#define C5 16819
-#define C6 11585
-#define C7 5906
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 26722
-#define C2 25172
-#define C3 22654
-#define C4 19266
-#define C5 15137
-#define C6 10426
-#define C7 5315
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 22725
-#define C2 21407
-#define C3 19266
-#define C4 16384
-#define C5 12873
-#define C6 8867
-#define C7 4520
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 26722
-#define C2 25172
-#define C3 22654
-#define C4 19266
-#define C5 15137
-#define C6 10426
-#define C7 5315
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 29692
-#define C2 27969
-#define C3 25172
-#define C4 21407
-#define C5 16819
-#define C6 11585
-#define C7 5906
-TABLE_SSE2
-
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-#define C1 31521
-#define C2 29692
-#define C3 26722
-#define C4 22725
-#define C5 17855
-#define C6 12299
-#define C7 6270
-TABLE_SSE2
-}};
-
-#define S(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
-
-#define FDCT_COL(cpu, mm, mov)\
-static av_always_inline void fdct_col_##cpu(const int16_t *in, int16_t *out, int offset)\
-{\
-    __asm__ volatile (\
-        #mov"      16(%0),  %%"#mm"0 \n\t" \
-        #mov"      96(%0),  %%"#mm"1 \n\t" \
-        #mov"    %%"#mm"0,  %%"#mm"2 \n\t" \
-        #mov"      32(%0),  %%"#mm"3 \n\t" \
-        "paddsw  %%"#mm"1,  %%"#mm"0 \n\t" \
-        #mov"      80(%0),  %%"#mm"4 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)", %%"#mm"0 \n\t" \
-        #mov"        (%0),  %%"#mm"5 \n\t" \
-        "paddsw  %%"#mm"3,  %%"#mm"4 \n\t" \
-        "paddsw   112(%0),  %%"#mm"5 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)", %%"#mm"4 \n\t" \
-        #mov"    %%"#mm"0,  %%"#mm"6 \n\t" \
-        "psubsw  %%"#mm"1,  %%"#mm"2 \n\t" \
-        #mov"      16(%1),  %%"#mm"1 \n\t" \
-        "psubsw  %%"#mm"4,  %%"#mm"0 \n\t" \
-        #mov"      48(%0),  %%"#mm"7 \n\t" \
-        "pmulhw  %%"#mm"0,  %%"#mm"1 \n\t" \
-        "paddsw    64(%0),  %%"#mm"7 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)", %%"#mm"5 \n\t" \
-        "paddsw  %%"#mm"4,  %%"#mm"6 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)", %%"#mm"7 \n\t" \
-        #mov"    %%"#mm"5,  %%"#mm"4 \n\t" \
-        "psubsw  %%"#mm"7,  %%"#mm"5 \n\t" \
-        "paddsw  %%"#mm"5,  %%"#mm"1 \n\t" \
-        "paddsw  %%"#mm"7,  %%"#mm"4 \n\t" \
-        "por         (%2),  %%"#mm"1 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)"+1, %%"#mm"2 \n\t" \
-        "pmulhw    16(%1),  %%"#mm"5 \n\t" \
-        #mov"    %%"#mm"4,  %%"#mm"7 \n\t" \
-        "psubsw    80(%0),  %%"#mm"3 \n\t" \
-        "psubsw  %%"#mm"6,  %%"#mm"4 \n\t" \
-        #mov"    %%"#mm"1,    32(%3) \n\t" \
-        "paddsw  %%"#mm"6,  %%"#mm"7 \n\t" \
-        #mov"      48(%0),  %%"#mm"1 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)"+1, %%"#mm"3 \n\t" \
-        "psubsw    64(%0),  %%"#mm"1 \n\t" \
-        #mov"    %%"#mm"2,  %%"#mm"6 \n\t" \
-        #mov"    %%"#mm"4,    64(%3) \n\t" \
-        "paddsw  %%"#mm"3,  %%"#mm"2 \n\t" \
-        "pmulhw      (%4),  %%"#mm"2 \n\t" \
-        "psubsw  %%"#mm"3,  %%"#mm"6 \n\t" \
-        "pmulhw      (%4),  %%"#mm"6 \n\t" \
-        "psubsw  %%"#mm"0,  %%"#mm"5 \n\t" \
-        "por         (%2),  %%"#mm"5 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)", %%"#mm"1 \n\t" \
-        "por         (%2),  %%"#mm"2 \n\t" \
-        #mov"    %%"#mm"1,  %%"#mm"4 \n\t" \
-        #mov"        (%0),  %%"#mm"3 \n\t" \
-        "paddsw  %%"#mm"6,  %%"#mm"1 \n\t" \
-        "psubsw   112(%0),  %%"#mm"3 \n\t" \
-        "psubsw  %%"#mm"6,  %%"#mm"4 \n\t" \
-        #mov"        (%1),  %%"#mm"0 \n\t" \
-        "psllw  $"S(SHIFT_FRW_COL)", %%"#mm"3 \n\t" \
-        #mov"      32(%1),  %%"#mm"6 \n\t" \
-        "pmulhw  %%"#mm"1,  %%"#mm"0 \n\t" \
-        #mov"    %%"#mm"7,      (%3) \n\t" \
-        "pmulhw  %%"#mm"4,  %%"#mm"6 \n\t" \
-        #mov"    %%"#mm"5,    96(%3) \n\t" \
-        #mov"    %%"#mm"3,  %%"#mm"7 \n\t" \
-        #mov"      32(%1),  %%"#mm"5 \n\t" \
-        "psubsw  %%"#mm"2,  %%"#mm"7 \n\t" \
-        "paddsw  %%"#mm"2,  %%"#mm"3 \n\t" \
-        "pmulhw  %%"#mm"7,  %%"#mm"5 \n\t" \
-        "paddsw  %%"#mm"3,  %%"#mm"0 \n\t" \
-        "paddsw  %%"#mm"4,  %%"#mm"6 \n\t" \
-        "pmulhw      (%1),  %%"#mm"3 \n\t" \
-        "por         (%2),  %%"#mm"0 \n\t" \
-        "paddsw  %%"#mm"7,  %%"#mm"5 \n\t" \
-        "psubsw  %%"#mm"6,  %%"#mm"7 \n\t" \
-        #mov"    %%"#mm"0,    16(%3) \n\t" \
-        "paddsw  %%"#mm"4,  %%"#mm"5 \n\t" \
-        #mov"    %%"#mm"7,    48(%3) \n\t" \
-        "psubsw  %%"#mm"1,  %%"#mm"3 \n\t" \
-        #mov"    %%"#mm"5,    80(%3) \n\t" \
-        #mov"    %%"#mm"3,   112(%3) \n\t" \
-        : \
-        : "r" (in  + offset), "r" (fdct_tg_all_16), "r" (fdct_one_corr), \
-          "r" (out + offset), "r" (ocos_4_16)); \
-}
-
-FDCT_COL(mmx, mm, movq)
-FDCT_COL(sse2, xmm, movdqa)
-
-static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
-{
-    __asm__ volatile(
-#define FDCT_ROW_SSE2_H1(i,t)                    \
-        "movq      " #i "(%0), %%xmm2      \n\t" \
-        "movq      " #i "+8(%0), %%xmm0    \n\t" \
-        "movdqa    " #t "+32(%1), %%xmm3   \n\t" \
-        "movdqa    " #t "+48(%1), %%xmm7   \n\t" \
-        "movdqa    " #t "(%1), %%xmm4      \n\t" \
-        "movdqa    " #t "+16(%1), %%xmm5   \n\t"
-
-#define FDCT_ROW_SSE2_H2(i,t)                    \
-        "movq      " #i "(%0), %%xmm2      \n\t" \
-        "movq      " #i "+8(%0), %%xmm0    \n\t" \
-        "movdqa    " #t "+32(%1), %%xmm3   \n\t" \
-        "movdqa    " #t "+48(%1), %%xmm7   \n\t"
-
-#define FDCT_ROW_SSE2(i)                      \
-        "movq      %%xmm2, %%xmm1       \n\t" \
-        "pshuflw   $27, %%xmm0, %%xmm0  \n\t" \
-        "paddsw    %%xmm0, %%xmm1       \n\t" \
-        "psubsw    %%xmm0, %%xmm2       \n\t" \
-        "punpckldq %%xmm2, %%xmm1       \n\t" \
-        "pshufd    $78, %%xmm1, %%xmm2  \n\t" \
-        "pmaddwd   %%xmm2, %%xmm3       \n\t" \
-        "pmaddwd   %%xmm1, %%xmm7       \n\t" \
-        "pmaddwd   %%xmm5, %%xmm2       \n\t" \
-        "pmaddwd   %%xmm4, %%xmm1       \n\t" \
-        "paddd     %%xmm7, %%xmm3       \n\t" \
-        "paddd     %%xmm2, %%xmm1       \n\t" \
-        "paddd     %%xmm6, %%xmm3       \n\t" \
-        "paddd     %%xmm6, %%xmm1       \n\t" \
-        "psrad     %3, %%xmm3           \n\t" \
-        "psrad     %3, %%xmm1           \n\t" \
-        "packssdw  %%xmm3, %%xmm1       \n\t" \
-        "movdqa    %%xmm1, " #i "(%4)   \n\t"
-
-        "movdqa    (%2), %%xmm6         \n\t"
-        FDCT_ROW_SSE2_H1(0,0)
-        FDCT_ROW_SSE2(0)
-        FDCT_ROW_SSE2_H2(64,0)
-        FDCT_ROW_SSE2(64)
-
-        FDCT_ROW_SSE2_H1(16,64)
-        FDCT_ROW_SSE2(16)
-        FDCT_ROW_SSE2_H2(112,64)
-        FDCT_ROW_SSE2(112)
-
-        FDCT_ROW_SSE2_H1(32,128)
-        FDCT_ROW_SSE2(32)
-        FDCT_ROW_SSE2_H2(96,128)
-        FDCT_ROW_SSE2(96)
-
-        FDCT_ROW_SSE2_H1(48,192)
-        FDCT_ROW_SSE2(48)
-        FDCT_ROW_SSE2_H2(80,192)
-        FDCT_ROW_SSE2(80)
-        :
-        : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2), "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out)
-    );
-}
-
-static av_always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table)
-{
-    __asm__ volatile (
-        "pshufw    $0x1B, 8(%0), %%mm5 \n\t"
-        "movq       (%0), %%mm0 \n\t"
-        "movq      %%mm0, %%mm1 \n\t"
-        "paddsw    %%mm5, %%mm0 \n\t"
-        "psubsw    %%mm5, %%mm1 \n\t"
-        "movq      %%mm0, %%mm2 \n\t"
-        "punpckldq %%mm1, %%mm0 \n\t"
-        "punpckhdq %%mm1, %%mm2 \n\t"
-        "movq       (%1), %%mm1 \n\t"
-        "movq      8(%1), %%mm3 \n\t"
-        "movq     16(%1), %%mm4 \n\t"
-        "movq     24(%1), %%mm5 \n\t"
-        "movq     32(%1), %%mm6 \n\t"
-        "movq     40(%1), %%mm7 \n\t"
-        "pmaddwd   %%mm0, %%mm1 \n\t"
-        "pmaddwd   %%mm2, %%mm3 \n\t"
-        "pmaddwd   %%mm0, %%mm4 \n\t"
-        "pmaddwd   %%mm2, %%mm5 \n\t"
-        "pmaddwd   %%mm0, %%mm6 \n\t"
-        "pmaddwd   %%mm2, %%mm7 \n\t"
-        "pmaddwd  48(%1), %%mm0 \n\t"
-        "pmaddwd  56(%1), %%mm2 \n\t"
-        "paddd     %%mm1, %%mm3 \n\t"
-        "paddd     %%mm4, %%mm5 \n\t"
-        "paddd     %%mm6, %%mm7 \n\t"
-        "paddd     %%mm0, %%mm2 \n\t"
-        "movq       (%2), %%mm0 \n\t"
-        "paddd     %%mm0, %%mm3 \n\t"
-        "paddd     %%mm0, %%mm5 \n\t"
-        "paddd     %%mm0, %%mm7 \n\t"
-        "paddd     %%mm0, %%mm2 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm3 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm5 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm7 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm2 \n\t"
-        "packssdw  %%mm5, %%mm3 \n\t"
-        "packssdw  %%mm2, %%mm7 \n\t"
-        "movq      %%mm3,  (%3) \n\t"
-        "movq      %%mm7, 8(%3) \n\t"
-        :
-        : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
-}
-
-static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table)
-{
-    //FIXME reorder (I do not have an old MMX-only CPU here to benchmark ...)
-    __asm__ volatile(
-        "movd     12(%0), %%mm1 \n\t"
-        "punpcklwd 8(%0), %%mm1 \n\t"
-        "movq      %%mm1, %%mm2 \n\t"
-        "psrlq     $0x20, %%mm1 \n\t"
-        "movq      0(%0), %%mm0 \n\t"
-        "punpcklwd %%mm2, %%mm1 \n\t"
-        "movq      %%mm0, %%mm5 \n\t"
-        "paddsw    %%mm1, %%mm0 \n\t"
-        "psubsw    %%mm1, %%mm5 \n\t"
-        "movq      %%mm0, %%mm2 \n\t"
-        "punpckldq %%mm5, %%mm0 \n\t"
-        "punpckhdq %%mm5, %%mm2 \n\t"
-        "movq      0(%1), %%mm1 \n\t"
-        "movq      8(%1), %%mm3 \n\t"
-        "movq     16(%1), %%mm4 \n\t"
-        "movq     24(%1), %%mm5 \n\t"
-        "movq     32(%1), %%mm6 \n\t"
-        "movq     40(%1), %%mm7 \n\t"
-        "pmaddwd   %%mm0, %%mm1 \n\t"
-        "pmaddwd   %%mm2, %%mm3 \n\t"
-        "pmaddwd   %%mm0, %%mm4 \n\t"
-        "pmaddwd   %%mm2, %%mm5 \n\t"
-        "pmaddwd   %%mm0, %%mm6 \n\t"
-        "pmaddwd   %%mm2, %%mm7 \n\t"
-        "pmaddwd  48(%1), %%mm0 \n\t"
-        "pmaddwd  56(%1), %%mm2 \n\t"
-        "paddd     %%mm1, %%mm3 \n\t"
-        "paddd     %%mm4, %%mm5 \n\t"
-        "paddd     %%mm6, %%mm7 \n\t"
-        "paddd     %%mm0, %%mm2 \n\t"
-        "movq       (%2), %%mm0 \n\t"
-        "paddd     %%mm0, %%mm3 \n\t"
-        "paddd     %%mm0, %%mm5 \n\t"
-        "paddd     %%mm0, %%mm7 \n\t"
-        "paddd     %%mm0, %%mm2 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm3 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm5 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm7 \n\t"
-        "psrad $"S(SHIFT_FRW_ROW)", %%mm2 \n\t"
-        "packssdw  %%mm5, %%mm3 \n\t"
-        "packssdw  %%mm2, %%mm7 \n\t"
-        "movq      %%mm3, 0(%3) \n\t"
-        "movq      %%mm7, 8(%3) \n\t"
-        :
-        : "r" (in), "r" (table), "r" (fdct_r_row), "r" (out));
-}
-
-void ff_fdct_mmx(int16_t *block)
-{
-    DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
-    int16_t * block1= (int16_t*)align_tmp;
-    const int16_t *table= tab_frw_01234567;
-    int i;
-
-    fdct_col_mmx(block, block1, 0);
-    fdct_col_mmx(block, block1, 4);
-
-    for(i=8;i>0;i--) {
-        fdct_row_mmx(block1, block, table);
-        block1 += 8;
-        table += 32;
-        block += 8;
-    }
-}
-
-void ff_fdct_mmx2(int16_t *block)
-{
-    DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
-    int16_t *block1= (int16_t*)align_tmp;
-    const int16_t *table= tab_frw_01234567;
-    int i;
-
-    fdct_col_mmx(block, block1, 0);
-    fdct_col_mmx(block, block1, 4);
-
-    for(i=8;i>0;i--) {
-        fdct_row_mmx2(block1, block, table);
-        block1 += 8;
-        table += 32;
-        block += 8;
-    }
-}
-
-void ff_fdct_sse2(int16_t *block)
-{
-    DECLARE_ALIGNED(16, int64_t, align_tmp)[16];
-    int16_t * const block1= (int16_t*)align_tmp;
-
-    fdct_col_sse2(block, block1, 0);
-    fdct_row_sse2(block1, block);
-}
-
diff --git a/libavcodec/x86/fft.c b/libavcodec/x86/fft.c
deleted file mode 100644
index 2c46c63..0000000
--- a/libavcodec/x86/fft.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "fft.h"
-
-av_cold void ff_fft_init_mmx(FFTContext *s)
-{
-#if HAVE_YASM
-    int has_vectors = mm_support();
-    if (has_vectors & FF_MM_SSE && HAVE_SSE) {
-        /* SSE for P3/P4/K8 */
-        s->imdct_calc  = ff_imdct_calc_sse;
-        s->imdct_half  = ff_imdct_half_sse;
-        s->fft_permute = ff_fft_permute_sse;
-        s->fft_calc    = ff_fft_calc_sse;
-    } else if (has_vectors & FF_MM_3DNOWEXT && HAVE_AMD3DNOWEXT) {
-        /* 3DNowEx for K7 */
-        s->imdct_calc = ff_imdct_calc_3dn2;
-        s->imdct_half = ff_imdct_half_3dn2;
-        s->fft_calc   = ff_fft_calc_3dn2;
-    } else if (has_vectors & FF_MM_3DNOW && HAVE_AMD3DNOW) {
-        /* 3DNow! for K6-2/3 */
-        s->imdct_calc = ff_imdct_calc_3dn;
-        s->imdct_half = ff_imdct_half_3dn;
-        s->fft_calc   = ff_fft_calc_3dn;
-    }
-#endif
-}
diff --git a/libavcodec/x86/fft.h b/libavcodec/x86/fft.h
deleted file mode 100644
index 7ef5839..0000000
--- a/libavcodec/x86/fft.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_X86_FFT_H
-#define AVCODEC_X86_FFT_H
-
-#include "libavcodec/fft.h"
-
-void ff_fft_permute_sse(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_sse(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z);
-void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z);
-
-void ff_imdct_calc_3dn(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_3dn(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input);
-void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input);
-
-#endif
diff --git a/libavcodec/x86/fft_3dn.c b/libavcodec/x86/fft_3dn.c
deleted file mode 100644
index 6f2e2e8..0000000
--- a/libavcodec/x86/fft_3dn.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * FFT/MDCT transform with 3DNow! optimizations
- * Copyright (c) 2008 Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define EMULATE_3DNOWEXT
-#include "fft_3dn2.c"
diff --git a/libavcodec/x86/fft_3dn2.c b/libavcodec/x86/fft_3dn2.c
deleted file mode 100644
index b3bec46..0000000
--- a/libavcodec/x86/fft_3dn2.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * FFT/MDCT transform with Extended 3DNow! optimizations
- * Copyright (c) 2006-2008 Zuxy MENG Jie, Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "fft.h"
-
-DECLARE_ALIGNED(8, static const int, m1m1)[2] = { 1<<31, 1<<31 };
-
-#ifdef EMULATE_3DNOWEXT
-#define PSWAPD(s,d)\
-    "movq "#s","#d"\n"\
-    "psrlq $32,"#d"\n"\
-    "punpckldq "#s","#d"\n"
-#define ff_fft_calc_3dn2 ff_fft_calc_3dn
-#define ff_fft_dispatch_3dn2 ff_fft_dispatch_3dn
-#define ff_fft_dispatch_interleave_3dn2 ff_fft_dispatch_interleave_3dn
-#define ff_imdct_calc_3dn2 ff_imdct_calc_3dn
-#define ff_imdct_half_3dn2 ff_imdct_half_3dn
-#else
-#define PSWAPD(s,d) "pswapd "#s","#d"\n"
-#endif
-
-void ff_fft_dispatch_3dn2(FFTComplex *z, int nbits);
-void ff_fft_dispatch_interleave_3dn2(FFTComplex *z, int nbits);
-
-void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z)
-{
-    int n = 1<<s->nbits;
-    int i;
-    ff_fft_dispatch_interleave_3dn2(z, s->nbits);
-    __asm__ volatile("femms");
-    if(n <= 8)
-        for(i=0; i<n; i+=2)
-            FFSWAP(FFTSample, z[i].im, z[i+1].re);
-}
-
-void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    x86_reg j, k;
-    long n = 1 << s->mdct_bits;
-    long n2 = n >> 1;
-    long n4 = n >> 2;
-    long n8 = n >> 3;
-    const uint16_t *revtab = s->revtab;
-    const FFTSample *tcos = s->tcos;
-    const FFTSample *tsin = s->tsin;
-    const FFTSample *in1, *in2;
-    FFTComplex *z = (FFTComplex *)output;
-
-    /* pre rotation */
-    in1 = input;
-    in2 = input + n2 - 1;
-#ifdef EMULATE_3DNOWEXT
-    __asm__ volatile("movd %0, %%mm7" ::"r"(1<<31));
-#endif
-    for(k = 0; k < n4; k++) {
-        // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it
-        __asm__ volatile(
-            "movd         %0, %%mm0 \n"
-            "movd         %2, %%mm1 \n"
-            "punpckldq    %1, %%mm0 \n"
-            "punpckldq    %3, %%mm1 \n"
-            "movq      %%mm0, %%mm2 \n"
-            PSWAPD(    %%mm1, %%mm3 )
-            "pfmul     %%mm1, %%mm0 \n"
-            "pfmul     %%mm3, %%mm2 \n"
-#ifdef EMULATE_3DNOWEXT
-            "movq      %%mm0, %%mm1 \n"
-            "punpckhdq %%mm2, %%mm0 \n"
-            "punpckldq %%mm2, %%mm1 \n"
-            "pxor      %%mm7, %%mm0 \n"
-            "pfadd     %%mm1, %%mm0 \n"
-#else
-            "pfpnacc   %%mm2, %%mm0 \n"
-#endif
-            ::"m"(in2[-2*k]), "m"(in1[2*k]),
-              "m"(tcos[k]), "m"(tsin[k])
-        );
-        __asm__ volatile(
-            "movq    %%mm0, %0    \n\t"
-            :"=m"(z[revtab[k]])
-        );
-    }
-
-    ff_fft_dispatch_3dn2(z, s->nbits);
-
-#define CMUL(j,mm0,mm1)\
-        "movq  (%2,"#j",2), %%mm6 \n"\
-        "movq 8(%2,"#j",2), "#mm0"\n"\
-        "movq        %%mm6, "#mm1"\n"\
-        "movq        "#mm0",%%mm7 \n"\
-        "pfmul   (%3,"#j"), %%mm6 \n"\
-        "pfmul   (%4,"#j"), "#mm0"\n"\
-        "pfmul   (%4,"#j"), "#mm1"\n"\
-        "pfmul   (%3,"#j"), %%mm7 \n"\
-        "pfsub       %%mm6, "#mm0"\n"\
-        "pfadd       %%mm7, "#mm1"\n"
-
-    /* post rotation */
-    j = -n2;
-    k = n2-8;
-    __asm__ volatile(
-        "1: \n"
-        CMUL(%0, %%mm0, %%mm1)
-        CMUL(%1, %%mm2, %%mm3)
-        "movd   %%mm0,  (%2,%0,2) \n"
-        "movd   %%mm1,12(%2,%1,2) \n"
-        "movd   %%mm2,  (%2,%1,2) \n"
-        "movd   %%mm3,12(%2,%0,2) \n"
-        "psrlq  $32,   %%mm0 \n"
-        "psrlq  $32,   %%mm1 \n"
-        "psrlq  $32,   %%mm2 \n"
-        "psrlq  $32,   %%mm3 \n"
-        "movd   %%mm0, 8(%2,%0,2) \n"
-        "movd   %%mm1, 4(%2,%1,2) \n"
-        "movd   %%mm2, 8(%2,%1,2) \n"
-        "movd   %%mm3, 4(%2,%0,2) \n"
-        "sub $8, %1 \n"
-        "add $8, %0 \n"
-        "jl 1b \n"
-        :"+r"(j), "+r"(k)
-        :"r"(z+n8), "r"(tcos+n8), "r"(tsin+n8)
-        :"memory"
-    );
-    __asm__ volatile("femms");
-}
-
-void ff_imdct_calc_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    x86_reg j, k;
-    long n = 1 << s->mdct_bits;
-    long n4 = n >> 2;
-
-    ff_imdct_half_3dn2(s, output+n4, input);
-
-    j = -n;
-    k = n-8;
-    __asm__ volatile(
-        "movq %4, %%mm7 \n"
-        "1: \n"
-        PSWAPD((%2,%1), %%mm0)
-        PSWAPD((%3,%0), %%mm1)
-        "pxor    %%mm7, %%mm0 \n"
-        "movq    %%mm1, (%3,%1) \n"
-        "movq    %%mm0, (%2,%0) \n"
-        "sub $8, %1 \n"
-        "add $8, %0 \n"
-        "jl 1b \n"
-        :"+r"(j), "+r"(k)
-        :"r"(output+n4), "r"(output+n4*3),
-         "m"(*m1m1)
-    );
-    __asm__ volatile("femms");
-}
-
diff --git a/libavcodec/x86/fft_mmx.asm b/libavcodec/x86/fft_mmx.asm
deleted file mode 100644
index 9cb0ae1..0000000
--- a/libavcodec/x86/fft_mmx.asm
+++ /dev/null
@@ -1,480 +0,0 @@
-;******************************************************************************
-;* FFT transform with SSE/3DNow optimizations
-;* Copyright (c) 2008 Loren Merritt
-;*
-;* This file is part of FFmpeg.
-;*
-;* FFmpeg 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.
-;*
-;* FFmpeg 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 FFmpeg; if not, write to the Free Software
-;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-;******************************************************************************
-
-; These functions are not individually interchangeable with the C versions.
-; While C takes arrays of FFTComplex, SSE/3DNow leave intermediate results
-; in blocks as conventient to the vector size.
-; i.e. {4x real, 4x imaginary, 4x real, ...} (or 2x respectively)
-
-%include "x86inc.asm"
-
-SECTION_RODATA
-
-%define M_SQRT1_2 0.70710678118654752440
-ps_root2: times 4 dd M_SQRT1_2
-ps_root2mppm: dd -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2
-ps_m1p1: dd 1<<31, 0
-
-%assign i 16
-%rep 13
-cextern ff_cos_ %+ i
-%assign i i<<1
-%endrep
-
-%ifdef ARCH_X86_64
-    %define pointer dq
-%else
-    %define pointer dd
-%endif
-
-%macro IF0 1+
-%endmacro
-%macro IF1 1+
-    %1
-%endmacro
-
-section .text align=16
-
-%macro T2_3DN 4 ; z0, z1, mem0, mem1
-    mova     %1, %3
-    mova     %2, %1
-    pfadd    %1, %4
-    pfsub    %2, %4
-%endmacro
-
-%macro T4_3DN 6 ; z0, z1, z2, z3, tmp0, tmp1
-    mova     %5, %3
-    pfsub    %3, %4
-    pfadd    %5, %4 ; {t6,t5}
-    pxor     %3, [ps_m1p1 GLOBAL] ; {t8,t7}
-    mova     %6, %1
-    pswapd   %3, %3
-    pfadd    %1, %5 ; {r0,i0}
-    pfsub    %6, %5 ; {r2,i2}
-    mova     %4, %2
-    pfadd    %2, %3 ; {r1,i1}
-    pfsub    %4, %3 ; {r3,i3}
-    SWAP     %3, %6
-%endmacro
-
-; in:  %1={r0,i0,r1,i1} %2={r2,i2,r3,i3}
-; out: %1={r0,r1,r2,r3} %2={i0,i1,i2,i3}
-%macro T4_SSE 3
-    mova     %3, %1
-    shufps   %1, %2, 0x64 ; {r0,i0,r3,i2}
-    shufps   %3, %2, 0xce ; {r1,i1,r2,i3}
-    mova     %2, %1
-    addps    %1, %3       ; {t1,t2,t6,t5}
-    subps    %2, %3       ; {t3,t4,t8,t7}
-    mova     %3, %1
-    shufps   %1, %2, 0x44 ; {t1,t2,t3,t4}
-    shufps   %3, %2, 0xbe ; {t6,t5,t7,t8}
-    mova     %2, %1
-    addps    %1, %3       ; {r0,i0,r1,i1}
-    subps    %2, %3       ; {r2,i2,r3,i3}
-    mova     %3, %1
-    shufps   %1, %2, 0x88 ; {r0,r1,r2,r3}
-    shufps   %3, %2, 0xdd ; {i0,i1,i2,i3}
-    SWAP     %2, %3
-%endmacro
-
-%macro T8_SSE 6 ; r0,i0,r1,i1,t0,t1
-    mova     %5, %3
-    shufps   %3, %4, 0x44 ; {r4,i4,r6,i6}
-    shufps   %5, %4, 0xee ; {r5,i5,r7,i7}
-    mova     %6, %3
-    subps    %3, %5       ; {r5,i5,r7,i7}
-    addps    %6, %5       ; {t1,t2,t3,t4}
-    mova     %5, %3
-    shufps   %5, %5, 0xb1 ; {i5,r5,i7,r7}
-    mulps    %3, [ps_root2mppm GLOBAL] ; {-r5,i5,r7,-i7}
-    mulps    %5, [ps_root2 GLOBAL]
-    addps    %3, %5       ; {t8,t7,ta,t9}
-    mova     %5, %6
-    shufps   %6, %3, 0x36 ; {t3,t2,t9,t8}
-    shufps   %5, %3, 0x9c ; {t1,t4,t7,ta}
-    mova     %3, %6
-    addps    %6, %5       ; {t1,t2,t9,ta}
-    subps    %3, %5       ; {t6,t5,tc,tb}
-    mova     %5, %6
-    shufps   %6, %3, 0xd8 ; {t1,t9,t5,tb}
-    shufps   %5, %3, 0x8d ; {t2,ta,t6,tc}
-    mova     %3, %1
-    mova     %4, %2
-    addps    %1, %6       ; {r0,r1,r2,r3}
-    addps    %2, %5       ; {i0,i1,i2,i3}
-    subps    %3, %6       ; {r4,r5,r6,r7}
-    subps    %4, %5       ; {i4,i5,i6,i7}
-%endmacro
-
-; scheduled for cpu-bound sizes
-%macro PASS_SMALL 3 ; (to load m4-m7), wre, wim
-IF%1 mova    m4, Z(4)
-IF%1 mova    m5, Z(5)
-    mova     m0, %2 ; wre
-    mova     m2, m4
-    mova     m1, %3 ; wim
-    mova     m3, m5
-    mulps    m2, m0 ; r2*wre
-IF%1 mova    m6, Z(6)
-    mulps    m3, m1 ; i2*wim
-IF%1 mova    m7, Z(7)
-    mulps    m4, m1 ; r2*wim
-    mulps    m5, m0 ; i2*wre
-    addps    m2, m3 ; r2*wre + i2*wim
-    mova     m3, m1
-    mulps    m1, m6 ; r3*wim
-    subps    m5, m4 ; i2*wre - r2*wim
-    mova     m4, m0
-    mulps    m3, m7 ; i3*wim
-    mulps    m4, m6 ; r3*wre
-    mulps    m0, m7 ; i3*wre
-    subps    m4, m3 ; r3*wre - i3*wim
-    mova     m3, Z(0)
-    addps    m0, m1 ; i3*wre + r3*wim
-    mova     m1, m4
-    addps    m4, m2 ; t5
-    subps    m1, m2 ; t3
-    subps    m3, m4 ; r2
-    addps    m4, Z(0) ; r0
-    mova     m6, Z(2)
-    mova   Z(4), m3
-    mova   Z(0), m4
-    mova     m3, m5
-    subps    m5, m0 ; t4
-    mova     m4, m6
-    subps    m6, m5 ; r3
-    addps    m5, m4 ; r1
-    mova   Z(6), m6
-    mova   Z(2), m5
-    mova     m2, Z(3)
-    addps    m3, m0 ; t6
-    subps    m2, m1 ; i3
-    mova     m7, Z(1)
-    addps    m1, Z(3) ; i1
-    mova   Z(7), m2
-    mova   Z(3), m1
-    mova     m4, m7
-    subps    m7, m3 ; i2
-    addps    m3, m4 ; i0
-    mova   Z(5), m7
-    mova   Z(1), m3
-%endmacro
-
-; scheduled to avoid store->load aliasing
-%macro PASS_BIG 1 ; (!interleave)
-    mova     m4, Z(4) ; r2
-    mova     m5, Z(5) ; i2
-    mova     m2, m4
-    mova     m0, [wq] ; wre
-    mova     m3, m5
-    mova     m1, [wq+o1q] ; wim
-    mulps    m2, m0 ; r2*wre
-    mova     m6, Z(6) ; r3
-    mulps    m3, m1 ; i2*wim
-    mova     m7, Z(7) ; i3
-    mulps    m4, m1 ; r2*wim
-    mulps    m5, m0 ; i2*wre
-    addps    m2, m3 ; r2*wre + i2*wim
-    mova     m3, m1
-    mulps    m1, m6 ; r3*wim
-    subps    m5, m4 ; i2*wre - r2*wim
-    mova     m4, m0
-    mulps    m3, m7 ; i3*wim
-    mulps    m4, m6 ; r3*wre
-    mulps    m0, m7 ; i3*wre
-    subps    m4, m3 ; r3*wre - i3*wim
-    mova     m3, Z(0)
-    addps    m0, m1 ; i3*wre + r3*wim
-    mova     m1, m4
-    addps    m4, m2 ; t5
-    subps    m1, m2 ; t3
-    subps    m3, m4 ; r2
-    addps    m4, Z(0) ; r0
-    mova     m6, Z(2)
-    mova   Z(4), m3
-    mova   Z(0), m4
-    mova     m3, m5
-    subps    m5, m0 ; t4
-    mova     m4, m6
-    subps    m6, m5 ; r3
-    addps    m5, m4 ; r1
-IF%1 mova  Z(6), m6
-IF%1 mova  Z(2), m5
-    mova     m2, Z(3)
-    addps    m3, m0 ; t6
-    subps    m2, m1 ; i3
-    mova     m7, Z(1)
-    addps    m1, Z(3) ; i1
-IF%1 mova  Z(7), m2
-IF%1 mova  Z(3), m1
-    mova     m4, m7
-    subps    m7, m3 ; i2
-    addps    m3, m4 ; i0
-IF%1 mova  Z(5), m7
-IF%1 mova  Z(1), m3
-%if %1==0
-    mova     m4, m5 ; r1
-    mova     m0, m6 ; r3
-    unpcklps m5, m1
-    unpckhps m4, m1
-    unpcklps m6, m2
-    unpckhps m0, m2
-    mova     m1, Z(0)
-    mova     m2, Z(4)
-    mova   Z(2), m5
-    mova   Z(3), m4
-    mova   Z(6), m6
-    mova   Z(7), m0
-    mova     m5, m1 ; r0
-    mova     m4, m2 ; r2
-    unpcklps m1, m3
-    unpckhps m5, m3
-    unpcklps m2, m7
-    unpckhps m4, m7
-    mova   Z(0), m1
-    mova   Z(1), m5
-    mova   Z(4), m2
-    mova   Z(5), m4
-%endif
-%endmacro
-
-%macro PUNPCK 3
-    mova      %3, %1
-    punpckldq %1, %2
-    punpckhdq %3, %2
-%endmacro
-
-INIT_XMM
-%define mova movaps
-
-%define Z(x) [r0+mmsize*x]
-
-align 16
-fft4_sse:
-    mova     m0, Z(0)
-    mova     m1, Z(1)
-    T4_SSE   m0, m1, m2
-    mova   Z(0), m0
-    mova   Z(1), m1
-    ret
-
-align 16
-fft8_sse:
-    mova     m0, Z(0)
-    mova     m1, Z(1)
-    T4_SSE   m0, m1, m2
-    mova     m2, Z(2)
-    mova     m3, Z(3)
-    T8_SSE   m0, m1, m2, m3, m4, m5
-    mova   Z(0), m0
-    mova   Z(1), m1
-    mova   Z(2), m2
-    mova   Z(3), m3
-    ret
-
-align 16
-fft16_sse:
-    mova     m0, Z(0)
-    mova     m1, Z(1)
-    T4_SSE   m0, m1, m2
-    mova     m2, Z(2)
-    mova     m3, Z(3)
-    T8_SSE   m0, m1, m2, m3, m4, m5
-    mova     m4, Z(4)
-    mova     m5, Z(5)
-    mova   Z(0), m0
-    mova   Z(1), m1
-    mova   Z(2), m2
-    mova   Z(3), m3
-    T4_SSE   m4, m5, m6
-    mova     m6, Z(6)
-    mova     m7, Z(7)
-    T4_SSE   m6, m7, m0
-    PASS_SMALL 0, [ff_cos_16 GLOBAL], [ff_cos_16+16 GLOBAL]
-    ret
-
-
-INIT_MMX
-
-%macro FFT48_3DN 1
-align 16
-fft4%1:
-    T2_3DN   m0, m1, Z(0), Z(1)
-    mova     m2, Z(2)
-    mova     m3, Z(3)
-    T4_3DN   m0, m1, m2, m3, m4, m5
-    PUNPCK   m0, m1, m4
-    PUNPCK   m2, m3, m5
-    mova   Z(0), m0
-    mova   Z(1), m4
-    mova   Z(2), m2
-    mova   Z(3), m5
-    ret
-
-align 16
-fft8%1:
-    T2_3DN   m0, m1, Z(0), Z(1)
-    mova     m2, Z(2)
-    mova     m3, Z(3)
-    T4_3DN   m0, m1, m2, m3, m4, m5
-    mova   Z(0), m0
-    mova   Z(2), m2
-    T2_3DN   m4, m5, Z(4), Z(5)
-    T2_3DN   m6, m7, Z(6), Z(7)
-    pswapd   m0, m5
-    pswapd   m2, m7
-    pxor     m0, [ps_m1p1 GLOBAL]
-    pxor     m2, [ps_m1p1 GLOBAL]
-    pfsub    m5, m0
-    pfadd    m7, m2
-    pfmul    m5, [ps_root2 GLOBAL]
-    pfmul    m7, [ps_root2 GLOBAL]
-    T4_3DN   m1, m3, m5, m7, m0, m2
-    mova   Z(5), m5
-    mova   Z(7), m7
-    mova     m0, Z(0)
-    mova     m2, Z(2)
-    T4_3DN   m0, m2, m4, m6, m5, m7
-    PUNPCK   m0, m1, m5
-    PUNPCK   m2, m3, m7
-    mova   Z(0), m0
-    mova   Z(1), m5
-    mova   Z(2), m2
-    mova   Z(3), m7
-    PUNPCK   m4, Z(5), m5
-    PUNPCK   m6, Z(7), m7
-    mova   Z(4), m4
-    mova   Z(5), m5
-    mova   Z(6), m6
-    mova   Z(7), m7
-    ret
-%endmacro
-
-FFT48_3DN _3dn2
-
-%macro pswapd 2
-%ifidn %1, %2
-    movd [r0+12], %1
-    punpckhdq %1, [r0+8]
-%else
-    movq  %1, %2
-    psrlq %1, 32
-    punpckldq %1, %2
-%endif
-%endmacro
-
-FFT48_3DN _3dn
-
-
-%define Z(x) [zq + o1q*(x&6)*((x/6)^1) + o3q*(x/6) + mmsize*(x&1)]
-
-%macro DECL_PASS 2+ ; name, payload
-align 16
-%1:
-DEFINE_ARGS z, w, n, o1, o3
-    lea o3q, [nq*3]
-    lea o1q, [nq*8]
-    shl o3q, 4
-.loop:
-    %2
-    add zq, mmsize*2
-    add wq, mmsize
-    sub nd, mmsize/8
-    jg .loop
-    rep ret
-%endmacro
-
-INIT_XMM
-%define mova movaps
-DECL_PASS pass_sse, PASS_BIG 1
-DECL_PASS pass_interleave_sse, PASS_BIG 0
-
-INIT_MMX
-%define mulps pfmul
-%define addps pfadd
-%define subps pfsub
-%define unpcklps punpckldq
-%define unpckhps punpckhdq
-DECL_PASS pass_3dn, PASS_SMALL 1, [wq], [wq+o1q]
-DECL_PASS pass_interleave_3dn, PASS_BIG 0
-%define pass_3dn2 pass_3dn
-%define pass_interleave_3dn2 pass_interleave_3dn
-
-%ifdef PIC
-%define SECTION_REL - $$
-%else
-%define SECTION_REL
-%endif
-
-%macro DECL_FFT 2-3 ; nbits, cpu, suffix
-%xdefine list_of_fft fft4%2 SECTION_REL, fft8%2 SECTION_REL
-%if %1==5
-%xdefine list_of_fft list_of_fft, fft16%2 SECTION_REL
-%endif
-
-%assign n 1<<%1
-%rep 17-%1
-%assign n2 n/2
-%assign n4 n/4
-%xdefine list_of_fft list_of_fft, fft %+ n %+ %3%2 SECTION_REL
-
-align 16
-fft %+ n %+ %3%2:
-    call fft %+ n2 %+ %2
-    add r0, n*4 - (n&(-2<<%1))
-    call fft %+ n4 %+ %2
-    add r0, n*2 - (n2&(-2<<%1))
-    call fft %+ n4 %+ %2
-    sub r0, n*6 + (n2&(-2<<%1))
-    lea r1, [ff_cos_ %+ n GLOBAL]
-    mov r2d, n4/2
-    jmp pass%3%2
-
-%assign n n*2
-%endrep
-%undef n
-
-align 8
-dispatch_tab%3%2: pointer list_of_fft
-
-section .text
-
-; On x86_32, this function does the register saving and restoring for all of fft.
-; The others pass args in registers and don't spill anything.
-cglobal fft_dispatch%3%2, 2,5,8, z, nbits
-    lea r2, [dispatch_tab%3%2 GLOBAL]
-    mov r2, [r2 + (nbitsq-2)*gprsize]
-%ifdef PIC
-    lea r3, [$$ GLOBAL]
-    add r2, r3
-%endif
-    call r2
-    RET
-%endmacro ; DECL_FFT
-
-DECL_FFT 5, _sse
-DECL_FFT 5, _sse, _interleave
-DECL_FFT 4, _3dn
-DECL_FFT 4, _3dn, _interleave
-DECL_FFT 4, _3dn2
-DECL_FFT 4, _3dn2, _interleave
-
diff --git a/libavcodec/x86/fft_sse.c b/libavcodec/x86/fft_sse.c
deleted file mode 100644
index a4cce69..0000000
--- a/libavcodec/x86/fft_sse.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * FFT/MDCT transform with SSE optimizations
- * Copyright (c) 2008 Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "fft.h"
-
-DECLARE_ALIGNED(16, static const int, m1m1m1m1)[4] =
-    { 1 << 31, 1 << 31, 1 << 31, 1 << 31 };
-
-void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
-void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);
-
-void ff_fft_calc_sse(FFTContext *s, FFTComplex *z)
-{
-    int n = 1 << s->nbits;
-
-    ff_fft_dispatch_interleave_sse(z, s->nbits);
-
-    if(n <= 16) {
-        x86_reg i = -8*n;
-        __asm__ volatile(
-            "1: \n"
-            "movaps     (%0,%1), %%xmm0 \n"
-            "movaps      %%xmm0, %%xmm1 \n"
-            "unpcklps 16(%0,%1), %%xmm0 \n"
-            "unpckhps 16(%0,%1), %%xmm1 \n"
-            "movaps      %%xmm0,   (%0,%1) \n"
-            "movaps      %%xmm1, 16(%0,%1) \n"
-            "add $32, %0 \n"
-            "jl 1b \n"
-            :"+r"(i)
-            :"r"(z+n)
-            :"memory"
-        );
-    }
-}
-
-void ff_fft_permute_sse(FFTContext *s, FFTComplex *z)
-{
-    int n = 1 << s->nbits;
-    int i;
-    for(i=0; i<n; i+=2) {
-        __asm__ volatile(
-            "movaps %2, %%xmm0 \n"
-            "movlps %%xmm0, %0 \n"
-            "movhps %%xmm0, %1 \n"
-            :"=m"(s->tmp_buf[s->revtab[i]]),
-             "=m"(s->tmp_buf[s->revtab[i+1]])
-            :"m"(z[i])
-        );
-    }
-    memcpy(z, s->tmp_buf, n*sizeof(FFTComplex));
-}
-
-void ff_imdct_half_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    av_unused x86_reg i, j, k, l;
-    long n = 1 << s->mdct_bits;
-    long n2 = n >> 1;
-    long n4 = n >> 2;
-    long n8 = n >> 3;
-    const uint16_t *revtab = s->revtab + n8;
-    const FFTSample *tcos = s->tcos;
-    const FFTSample *tsin = s->tsin;
-    FFTComplex *z = (FFTComplex *)output;
-
-    /* pre rotation */
-    for(k=n8-2; k>=0; k-=2) {
-        __asm__ volatile(
-            "movaps     (%2,%1,2), %%xmm0 \n" // { z[k].re,    z[k].im,    z[k+1].re,  z[k+1].im  }
-            "movaps  -16(%2,%0,2), %%xmm1 \n" // { z[-k-2].re, z[-k-2].im, z[-k-1].re, z[-k-1].im }
-            "movaps        %%xmm0, %%xmm2 \n"
-            "shufps $0x88, %%xmm1, %%xmm0 \n" // { z[k].re,    z[k+1].re,  z[-k-2].re, z[-k-1].re }
-            "shufps $0x77, %%xmm2, %%xmm1 \n" // { z[-k-1].im, z[-k-2].im, z[k+1].im,  z[k].im    }
-            "movlps       (%3,%1), %%xmm4 \n"
-            "movlps       (%4,%1), %%xmm5 \n"
-            "movhps     -8(%3,%0), %%xmm4 \n" // { cos[k],     cos[k+1],   cos[-k-2],  cos[-k-1]  }
-            "movhps     -8(%4,%0), %%xmm5 \n" // { sin[k],     sin[k+1],   sin[-k-2],  sin[-k-1]  }
-            "movaps        %%xmm0, %%xmm2 \n"
-            "movaps        %%xmm1, %%xmm3 \n"
-            "mulps         %%xmm5, %%xmm0 \n" // re*sin
-            "mulps         %%xmm4, %%xmm1 \n" // im*cos
-            "mulps         %%xmm4, %%xmm2 \n" // re*cos
-            "mulps         %%xmm5, %%xmm3 \n" // im*sin
-            "subps         %%xmm0, %%xmm1 \n" // -> re
-            "addps         %%xmm3, %%xmm2 \n" // -> im
-            "movaps        %%xmm1, %%xmm0 \n"
-            "unpcklps      %%xmm2, %%xmm1 \n" // { z[k],    z[k+1]  }
-            "unpckhps      %%xmm2, %%xmm0 \n" // { z[-k-2], z[-k-1] }
-            ::"r"(-4*k), "r"(4*k),
-              "r"(input+n4), "r"(tcos+n8), "r"(tsin+n8)
-        );
-#if ARCH_X86_64
-        // if we have enough regs, don't let gcc make the luts latency-bound
-        // but if not, latency is faster than spilling
-        __asm__("movlps %%xmm0, %0 \n"
-            "movhps %%xmm0, %1 \n"
-            "movlps %%xmm1, %2 \n"
-            "movhps %%xmm1, %3 \n"
-            :"=m"(z[revtab[-k-2]]),
-             "=m"(z[revtab[-k-1]]),
-             "=m"(z[revtab[ k  ]]),
-             "=m"(z[revtab[ k+1]])
-        );
-#else
-        __asm__("movlps %%xmm0, %0" :"=m"(z[revtab[-k-2]]));
-        __asm__("movhps %%xmm0, %0" :"=m"(z[revtab[-k-1]]));
-        __asm__("movlps %%xmm1, %0" :"=m"(z[revtab[ k  ]]));
-        __asm__("movhps %%xmm1, %0" :"=m"(z[revtab[ k+1]]));
-#endif
-    }
-
-    ff_fft_dispatch_sse(z, s->nbits);
-
-    /* post rotation + reinterleave + reorder */
-
-#define CMUL(j,xmm0,xmm1)\
-        "movaps   (%2,"#j",2), %%xmm6 \n"\
-        "movaps 16(%2,"#j",2), "#xmm0"\n"\
-        "movaps        %%xmm6, "#xmm1"\n"\
-        "movaps        "#xmm0",%%xmm7 \n"\
-        "mulps      (%3,"#j"), %%xmm6 \n"\
-        "mulps      (%4,"#j"), "#xmm0"\n"\
-        "mulps      (%4,"#j"), "#xmm1"\n"\
-        "mulps      (%3,"#j"), %%xmm7 \n"\
-        "subps         %%xmm6, "#xmm0"\n"\
-        "addps         %%xmm7, "#xmm1"\n"
-
-    j = -n2;
-    k = n2-16;
-    __asm__ volatile(
-        "1: \n"
-        CMUL(%0, %%xmm0, %%xmm1)
-        CMUL(%1, %%xmm4, %%xmm5)
-        "shufps    $0x1b, %%xmm1, %%xmm1 \n"
-        "shufps    $0x1b, %%xmm5, %%xmm5 \n"
-        "movaps   %%xmm4, %%xmm6 \n"
-        "unpckhps %%xmm1, %%xmm4 \n"
-        "unpcklps %%xmm1, %%xmm6 \n"
-        "movaps   %%xmm0, %%xmm2 \n"
-        "unpcklps %%xmm5, %%xmm0 \n"
-        "unpckhps %%xmm5, %%xmm2 \n"
-        "movaps   %%xmm6,   (%2,%1,2) \n"
-        "movaps   %%xmm4, 16(%2,%1,2) \n"
-        "movaps   %%xmm0,   (%2,%0,2) \n"
-        "movaps   %%xmm2, 16(%2,%0,2) \n"
-        "sub $16, %1 \n"
-        "add $16, %0 \n"
-        "jl 1b \n"
-        :"+&r"(j), "+&r"(k)
-        :"r"(z+n8), "r"(tcos+n8), "r"(tsin+n8)
-        :"memory"
-    );
-}
-
-void ff_imdct_calc_sse(FFTContext *s, FFTSample *output, const FFTSample *input)
-{
-    x86_reg j, k;
-    long n = 1 << s->mdct_bits;
-    long n4 = n >> 2;
-
-    ff_imdct_half_sse(s, output+n4, input);
-
-    j = -n;
-    k = n-16;
-    __asm__ volatile(
-        "movaps %4, %%xmm7 \n"
-        "1: \n"
-        "movaps       (%2,%1), %%xmm0 \n"
-        "movaps       (%3,%0), %%xmm1 \n"
-        "shufps $0x1b, %%xmm0, %%xmm0 \n"
-        "shufps $0x1b, %%xmm1, %%xmm1 \n"
-        "xorps         %%xmm7, %%xmm0 \n"
-        "movaps        %%xmm1, (%3,%1) \n"
-        "movaps        %%xmm0, (%2,%0) \n"
-        "sub $16, %1 \n"
-        "add $16, %0 \n"
-        "jl 1b \n"
-        :"+r"(j), "+r"(k)
-        :"r"(output+n4), "r"(output+n4*3),
-         "m"(*m1m1m1m1)
-    );
-}
-
diff --git a/libavcodec/x86/h264_deblock_sse2.asm b/libavcodec/x86/h264_deblock_sse2.asm
deleted file mode 100644
index bf45c7e..0000000
--- a/libavcodec/x86/h264_deblock_sse2.asm
+++ /dev/null
@@ -1,759 +0,0 @@
-;*****************************************************************************
-;* MMX/SSE2-optimized H.264 deblocking code
-;*****************************************************************************
-;* Copyright (C) 2005-2008 x264 project
-;*
-;* Authors: Loren Merritt <lorenm at u.washington.edu>
-;*
-;* 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
-;*****************************************************************************
-
-%include "x86inc.asm"
-
-SECTION_RODATA
-pb_00: times 16 db 0x00
-pb_01: times 16 db 0x01
-pb_03: times 16 db 0x03
-pb_a1: times 16 db 0xa1
-
-SECTION .text
-
-; expands to [base],...,[base+7*stride]
-%define PASS8ROWS(base, base3, stride, stride3) \
-    [base], [base+stride], [base+stride*2], [base3], \
-    [base3+stride], [base3+stride*2], [base3+stride3], [base3+stride*4]
-
-; in: 8 rows of 4 bytes in %1..%8
-; out: 4 rows of 8 bytes in m0..m3
-%macro TRANSPOSE4x8_LOAD 8
-    movd       m0, %1
-    movd       m2, %2
-    movd       m1, %3
-    movd       m3, %4
-    punpcklbw  m0, m2
-    punpcklbw  m1, m3
-    movq       m2, m0
-    punpcklwd  m0, m1
-    punpckhwd  m2, m1
-
-    movd       m4, %5
-    movd       m6, %6
-    movd       m5, %7
-    movd       m7, %8
-    punpcklbw  m4, m6
-    punpcklbw  m5, m7
-    movq       m6, m4
-    punpcklwd  m4, m5
-    punpckhwd  m6, m5
-
-    movq       m1, m0
-    movq       m3, m2
-    punpckldq  m0, m4
-    punpckhdq  m1, m4
-    punpckldq  m2, m6
-    punpckhdq  m3, m6
-%endmacro
-
-; in: 4 rows of 8 bytes in m0..m3
-; out: 8 rows of 4 bytes in %1..%8
-%macro TRANSPOSE8x4_STORE 8
-    movq       m4, m0
-    movq       m5, m1
-    movq       m6, m2
-    punpckhdq  m4, m4
-    punpckhdq  m5, m5
-    punpckhdq  m6, m6
-
-    punpcklbw  m0, m1
-    punpcklbw  m2, m3
-    movq       m1, m0
-    punpcklwd  m0, m2
-    punpckhwd  m1, m2
-    movd       %1, m0
-    punpckhdq  m0, m0
-    movd       %2, m0
-    movd       %3, m1
-    punpckhdq  m1, m1
-    movd       %4, m1
-
-    punpckhdq  m3, m3
-    punpcklbw  m4, m5
-    punpcklbw  m6, m3
-    movq       m5, m4
-    punpcklwd  m4, m6
-    punpckhwd  m5, m6
-    movd       %5, m4
-    punpckhdq  m4, m4
-    movd       %6, m4
-    movd       %7, m5
-    punpckhdq  m5, m5
-    movd       %8, m5
-%endmacro
-
-%macro SBUTTERFLY 4
-    movq       %4, %2
-    punpckl%1  %2, %3
-    punpckh%1  %4, %3
-%endmacro
-
-; in: 8 rows of 8 (only the middle 6 pels are used) in %1..%8
-; out: 6 rows of 8 in [%9+0*16] .. [%9+5*16]
-%macro TRANSPOSE6x8_MEM 9
-    movq  m0, %1
-    movq  m1, %2
-    movq  m2, %3
-    movq  m3, %4
-    movq  m4, %5
-    movq  m5, %6
-    movq  m6, %7
-    SBUTTERFLY bw, m0, m1, m7
-    SBUTTERFLY bw, m2, m3, m1
-    SBUTTERFLY bw, m4, m5, m3
-    movq  [%9+0x10], m1
-    SBUTTERFLY bw, m6, %8, m5
-    SBUTTERFLY wd, m0, m2, m1
-    SBUTTERFLY wd, m4, m6, m2
-    punpckhdq m0, m4
-    movq  [%9+0x00], m0
-    SBUTTERFLY wd, m7, [%9+0x10], m6
-    SBUTTERFLY wd, m3, m5, m4
-    SBUTTERFLY dq, m7, m3, m0
-    SBUTTERFLY dq, m1, m2, m5
-    punpckldq m6, m4
-    movq  [%9+0x10], m1
-    movq  [%9+0x20], m5
-    movq  [%9+0x30], m7
-    movq  [%9+0x40], m0
-    movq  [%9+0x50], m6
-%endmacro
-
-; in: 8 rows of 8 in %1..%8
-; out: 8 rows of 8 in %9..%16
-%macro TRANSPOSE8x8_MEM 16
-    movq  m0, %1
-    movq  m1, %2
-    movq  m2, %3
-    movq  m3, %4
-    movq  m4, %5
-    movq  m5, %6
-    movq  m6, %7
-    SBUTTERFLY bw, m0, m1, m7
-    SBUTTERFLY bw, m2, m3, m1
-    SBUTTERFLY bw, m4, m5, m3
-    SBUTTERFLY bw, m6, %8, m5
-    movq  %9,  m3
-    SBUTTERFLY wd, m0, m2, m3
-    SBUTTERFLY wd, m4, m6, m2
-    SBUTTERFLY wd, m7, m1, m6
-    movq  %11, m2
-    movq  m2,  %9
-    SBUTTERFLY wd, m2, m5, m1
-    SBUTTERFLY dq, m0, m4, m5
-    SBUTTERFLY dq, m7, m2, m4
-    movq  %9,  m0
-    movq  %10, m5
-    movq  %13, m7
-    movq  %14, m4
-    SBUTTERFLY dq, m3, %11, m0
-    SBUTTERFLY dq, m6, m1, m5
-    movq  %11, m3
-    movq  %12, m0
-    movq  %15, m6
-    movq  %16, m5
-%endmacro
-
-; out: %4 = |%1-%2|>%3
-; clobbers: %5
-%macro DIFF_GT 5
-    mova    %5, %2
-    mova    %4, %1
-    psubusb %5, %1
-    psubusb %4, %2
-    por     %4, %5
-    psubusb %4, %3
-%endmacro
-
-; out: %4 = |%1-%2|>%3
-; clobbers: %5
-%macro DIFF_GT2 5
-    mova    %5, %2
-    mova    %4, %1
-    psubusb %5, %1
-    psubusb %4, %2
-    psubusb %5, %3
-    psubusb %4, %3
-    pcmpeqb %4, %5
-%endmacro
-
-%macro SPLATW 1
-%ifidn m0, xmm0
-    pshuflw  %1, %1, 0
-    punpcklqdq %1, %1
-%else
-    pshufw   %1, %1, 0
-%endif
-%endmacro
-
-; in: m0=p1 m1=p0 m2=q0 m3=q1 %1=alpha-1 %2=beta-1
-; out: m5=beta-1, m7=mask, %3=alpha-1
-; clobbers: m4,m6
-%macro LOAD_MASK 2-3
-    movd     m4, %1
-    movd     m5, %2
-    SPLATW   m4
-    SPLATW   m5
-    packuswb m4, m4  ; 16x alpha-1
-    packuswb m5, m5  ; 16x beta-1
-%if %0>2
-    mova     %3, m4
-%endif
-    DIFF_GT  m1, m2, m4, m7, m6 ; |p0-q0| > alpha-1
-    DIFF_GT  m0, m1, m5, m4, m6 ; |p1-p0| > beta-1
-    por      m7, m4
-    DIFF_GT  m3, m2, m5, m4, m6 ; |q1-q0| > beta-1
-    por      m7, m4
-    pxor     m6, m6
-    pcmpeqb  m7, m6
-%endmacro
-
-; in: m0=p1 m1=p0 m2=q0 m3=q1 m7=(tc&mask)
-; out: m1=p0' m2=q0'
-; clobbers: m0,3-6
-%macro DEBLOCK_P0_Q0 0
-    mova    m5, m1
-    pxor    m5, m2           ; p0^q0
-    pand    m5, [pb_01 GLOBAL] ; (p0^q0)&1
-    pcmpeqb m4, m4
-    pxor    m3, m4
-    pavgb   m3, m0           ; (p1 - q1 + 256)>>1
-    pavgb   m3, [pb_03 GLOBAL] ; (((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2
-    pxor    m4, m1
-    pavgb   m4, m2           ; (q0 - p0 + 256)>>1
-    pavgb   m3, m5
-    paddusb m3, m4           ; d+128+33
-    mova    m6, [pb_a1 GLOBAL]
-    psubusb m6, m3
-    psubusb m3, [pb_a1 GLOBAL]
-    pminub  m6, m7
-    pminub  m3, m7
-    psubusb m1, m6
-    psubusb m2, m3
-    paddusb m1, m3
-    paddusb m2, m6
-%endmacro
-
-; in: m1=p0 m2=q0
-;     %1=p1 %2=q2 %3=[q2] %4=[q1] %5=tc0 %6=tmp
-; out: [q1] = clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 )
-; clobbers: q2, tmp, tc0
-%macro LUMA_Q1 6
-    mova    %6, m1
-    pavgb   %6, m2
-    pavgb   %2, %6             ; avg(p2,avg(p0,q0))
-    pxor    %6, %3
-    pand    %6, [pb_01 GLOBAL] ; (p2^avg(p0,q0))&1
-    psubusb %2, %6             ; (p2+((p0+q0+1)>>1))>>1
-    mova    %6, %1
-    psubusb %6, %5
-    paddusb %5, %1
-    pmaxub  %2, %6
-    pminub  %2, %5
-    mova    %4, %2
-%endmacro
-
-%ifdef ARCH_X86_64
-;-----------------------------------------------------------------------------
-; void x264_deblock_v_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
-;-----------------------------------------------------------------------------
-INIT_XMM
-cglobal x264_deblock_v_luma_sse2, 5,5,10
-    movd    m8, [r4] ; tc0
-    lea     r4, [r1*3]
-    dec     r2d        ; alpha-1
-    neg     r4
-    dec     r3d        ; beta-1
-    add     r4, r0     ; pix-3*stride
-
-    mova    m0, [r4+r1]   ; p1
-    mova    m1, [r4+2*r1] ; p0
-    mova    m2, [r0]      ; q0
-    mova    m3, [r0+r1]   ; q1
-    LOAD_MASK r2d, r3d
-
-    punpcklbw m8, m8
-    punpcklbw m8, m8 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0]
-    pcmpeqb m9, m9
-    pcmpeqb m9, m8
-    pandn   m9, m7
-    pand    m8, m9
-
-    movdqa  m3, [r4] ; p2
-    DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1
-    pand    m6, m9
-    mova    m7, m8
-    psubb   m7, m6
-    pand    m6, m8
-    LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4
-
-    movdqa  m4, [r0+2*r1] ; q2
-    DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1
-    pand    m6, m9
-    pand    m8, m6
-    psubb   m7, m6
-    mova    m3, [r0+r1]
-    LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m8, m6
-
-    DEBLOCK_P0_Q0
-    mova    [r4+2*r1], m1
-    mova    [r0], m2
-    RET
-
-;-----------------------------------------------------------------------------
-; void x264_deblock_h_luma_sse2( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
-;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal x264_deblock_h_luma_sse2, 5,7
-    movsxd r10, r1d
-    lea    r11, [r10+r10*2]
-    lea    r6,  [r0-4]
-    lea    r5,  [r0-4+r11]
-%ifdef WIN64
-    sub    rsp, 0x98
-    %define pix_tmp rsp+0x30
-%else
-    sub    rsp, 0x68
-    %define pix_tmp rsp
-%endif
-
-    ; transpose 6x16 -> tmp space
-    TRANSPOSE6x8_MEM  PASS8ROWS(r6, r5, r10, r11), pix_tmp
-    lea    r6, [r6+r10*8]
-    lea    r5, [r5+r10*8]
-    TRANSPOSE6x8_MEM  PASS8ROWS(r6, r5, r10, r11), pix_tmp+8
-
-    ; vertical filter
-    ; alpha, beta, tc0 are still in r2d, r3d, r4
-    ; don't backup r6, r5, r10, r11 because x264_deblock_v_luma_sse2 doesn't use them
-    lea    r0, [pix_tmp+0x30]
-    mov    r1d, 0x10
-%ifdef WIN64
-    mov    [rsp+0x20], r4
-%endif
-    call   x264_deblock_v_luma_sse2
-
-    ; transpose 16x4 -> original space  (only the middle 4 rows were changed by the filter)
-    add    r6, 2
-    add    r5, 2
-    movq   m0, [pix_tmp+0x18]
-    movq   m1, [pix_tmp+0x28]
-    movq   m2, [pix_tmp+0x38]
-    movq   m3, [pix_tmp+0x48]
-    TRANSPOSE8x4_STORE  PASS8ROWS(r6, r5, r10, r11)
-
-    shl    r10, 3
-    sub    r6,  r10
-    sub    r5,  r10
-    shr    r10, 3
-    movq   m0, [pix_tmp+0x10]
-    movq   m1, [pix_tmp+0x20]
-    movq   m2, [pix_tmp+0x30]
-    movq   m3, [pix_tmp+0x40]
-    TRANSPOSE8x4_STORE  PASS8ROWS(r6, r5, r10, r11)
-
-%ifdef WIN64
-    add    rsp, 0x98
-%else
-    add    rsp, 0x68
-%endif
-    RET
-
-%else
-
-%macro DEBLOCK_LUMA 3
-;-----------------------------------------------------------------------------
-; void x264_deblock_v8_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
-;-----------------------------------------------------------------------------
-cglobal x264_deblock_%2_luma_%1, 5,5
-    lea     r4, [r1*3]
-    dec     r2     ; alpha-1
-    neg     r4
-    dec     r3     ; beta-1
-    add     r4, r0 ; pix-3*stride
-    %assign pad 2*%3+12-(stack_offset&15)
-    SUB     esp, pad
-
-    mova    m0, [r4+r1]   ; p1
-    mova    m1, [r4+2*r1] ; p0
-    mova    m2, [r0]      ; q0
-    mova    m3, [r0+r1]   ; q1
-    LOAD_MASK r2, r3
-
-    mov     r3, r4mp
-    movd    m4, [r3] ; tc0
-    punpcklbw m4, m4
-    punpcklbw m4, m4 ; tc = 4x tc0[3], 4x tc0[2], 4x tc0[1], 4x tc0[0]
-    mova   [esp+%3], m4 ; tc
-    pcmpeqb m3, m3
-    pcmpgtb m4, m3
-    pand    m4, m7
-    mova   [esp], m4 ; mask
-
-    mova    m3, [r4] ; p2
-    DIFF_GT2 m1, m3, m5, m6, m7 ; |p2-p0| > beta-1
-    pand    m6, m4
-    pand    m4, [esp+%3] ; tc
-    mova    m7, m4
-    psubb   m7, m6
-    pand    m6, m4
-    LUMA_Q1 m0, m3, [r4], [r4+r1], m6, m4
-
-    mova    m4, [r0+2*r1] ; q2
-    DIFF_GT2 m2, m4, m5, m6, m3 ; |q2-q0| > beta-1
-    mova    m5, [esp] ; mask
-    pand    m6, m5
-    mova    m5, [esp+%3] ; tc
-    pand    m5, m6
-    psubb   m7, m6
-    mova    m3, [r0+r1]
-    LUMA_Q1 m3, m4, [r0+2*r1], [r0+r1], m5, m6
-
-    DEBLOCK_P0_Q0
-    mova    [r4+2*r1], m1
-    mova    [r0], m2
-    ADD     esp, pad
-    RET
-
-;-----------------------------------------------------------------------------
-; void x264_deblock_h_luma_mmxext( uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0 )
-;-----------------------------------------------------------------------------
-INIT_MMX
-cglobal x264_deblock_h_luma_%1, 0,5
-    mov    r0, r0mp
-    mov    r3, r1m
-    lea    r4, [r3*3]
-    sub    r0, 4
-    lea    r1, [r0+r4]
-    %assign pad 0x78-(stack_offset&15)
-    SUB    esp, pad
-%define pix_tmp esp+12
-
-    ; transpose 6x16 -> tmp space
-    TRANSPOSE6x8_MEM  PASS8ROWS(r0, r1, r3, r4), pix_tmp
-    lea    r0, [r0+r3*8]
-    lea    r1, [r1+r3*8]
-    TRANSPOSE6x8_MEM  PASS8ROWS(r0, r1, r3, r4), pix_tmp+8
-
-    ; vertical filter
-    lea    r0, [pix_tmp+0x30]
-    PUSH   dword r4m
-    PUSH   dword r3m
-    PUSH   dword r2m
-    PUSH   dword 16
-    PUSH   dword r0
-    call   x264_deblock_%2_luma_%1
-%ifidn %2, v8
-    add    dword [esp   ], 8 ; pix_tmp+0x38
-    add    dword [esp+16], 2 ; tc0+2
-    call   x264_deblock_%2_luma_%1
-%endif
-    ADD    esp, 20
-
-    ; transpose 16x4 -> original space  (only the middle 4 rows were changed by the filter)
-    mov    r0, r0mp
-    sub    r0, 2
-    lea    r1, [r0+r4]
-
-    movq   m0, [pix_tmp+0x10]
-    movq   m1, [pix_tmp+0x20]
-    movq   m2, [pix_tmp+0x30]
-    movq   m3, [pix_tmp+0x40]
-    TRANSPOSE8x4_STORE  PASS8ROWS(r0, r1, r3, r4)
-
-    lea    r0, [r0+r3*8]
-    lea    r1, [r1+r3*8]
-    movq   m0, [pix_tmp+0x18]
-    movq   m1, [pix_tmp+0x28]
-    movq   m2, [pix_tmp+0x38]
-    movq   m3, [pix_tmp+0x48]
-    TRANSPOSE8x4_STORE  PASS8ROWS(r0, r1, r3, r4)
-
-    ADD    esp, pad
-    RET
-%endmacro ; DEBLOCK_LUMA
-
-INIT_XMM
-DEBLOCK_LUMA sse2, v, 16
-
-%endif ; ARCH
-
-
-
-%macro LUMA_INTRA_P012 4 ; p0..p3 in memory
-    mova  t0, p2
-    mova  t1, p0
-    pavgb t0, p1
-    pavgb t1, q0
-    pavgb t0, t1 ; ((p2+p1+1)/2 + (p0+q0+1)/2 + 1)/2
-    mova  t5, t1
-    mova  t2, p2
-    mova  t3, p0
-    paddb t2, p1
-    paddb t3, q0
-    paddb t2, t3
-    mova  t3, t2
-    mova  t4, t2
-    psrlw t2, 1
-    pavgb t2, mpb_00
-    pxor  t2, t0
-    pand  t2, mpb_01
-    psubb t0, t2 ; p1' = (p2+p1+p0+q0+2)/4;
-
-    mova  t1, p2
-    mova  t2, p2
-    pavgb t1, q1
-    psubb t2, q1
-    paddb t3, t3
-    psubb t3, t2 ; p2+2*p1+2*p0+2*q0+q1
-    pand  t2, mpb_01
-    psubb t1, t2
-    pavgb t1, p1
-    pavgb t1, t5 ; (((p2+q1)/2 + p1+1)/2 + (p0+q0+1)/2 + 1)/2
-    psrlw t3, 2
-    pavgb t3, mpb_00
-    pxor  t3, t1
-    pand  t3, mpb_01
-    psubb t1, t3 ; p0'a = (p2+2*p1+2*p0+2*q0+q1+4)/8
-
-    mova  t3, p0
-    mova  t2, p0
-    pxor  t3, q1
-    pavgb t2, q1
-    pand  t3, mpb_01
-    psubb t2, t3
-    pavgb t2, p1 ; p0'b = (2*p1+p0+q0+2)/4
-
-    pxor  t1, t2
-    pxor  t2, p0
-    pand  t1, mask1p
-    pand  t2, mask0
-    pxor  t1, t2
-    pxor  t1, p0
-    mova  %1, t1 ; store p0
-
-    mova  t1, %4 ; p3
-    mova  t2, t1
-    pavgb t1, p2
-    paddb t2, p2
-    pavgb t1, t0 ; (p3+p2+1)/2 + (p2+p1+p0+q0+2)/4
-    paddb t2, t2
-    paddb t2, t4 ; 2*p3+3*p2+p1+p0+q0
-    psrlw t2, 2
-    pavgb t2, mpb_00
-    pxor  t2, t1
-    pand  t2, mpb_01
-    psubb t1, t2 ; p2' = (2*p3+3*p2+p1+p0+q0+4)/8
-
-    pxor  t0, p1
-    pxor  t1, p2
-    pand  t0, mask1p
-    pand  t1, mask1p
-    pxor  t0, p1
-    pxor  t1, p2
-    mova  %2, t0 ; store p1
-    mova  %3, t1 ; store p2
-%endmacro
-
-%macro LUMA_INTRA_SWAP_PQ 0
-    %define q1 m0
-    %define q0 m1
-    %define p0 m2
-    %define p1 m3
-    %define p2 q2
-    %define mask1p mask1q
-%endmacro
-
-%macro DEBLOCK_LUMA_INTRA 2
-    %define p1 m0
-    %define p0 m1
-    %define q0 m2
-    %define q1 m3
-    %define t0 m4
-    %define t1 m5
-    %define t2 m6
-    %define t3 m7
-%ifdef ARCH_X86_64
-    %define p2 m8
-    %define q2 m9
-    %define t4 m10
-    %define t5 m11
-    %define mask0 m12
-    %define mask1p m13
-    %define mask1q [rsp-24]
-    %define mpb_00 m14
-    %define mpb_01 m15
-%else
-    %define spill(x) [esp+16*x+((stack_offset+4)&15)]
-    %define p2 [r4+r1]
-    %define q2 [r0+2*r1]
-    %define t4 spill(0)
-    %define t5 spill(1)
-    %define mask0 spill(2)
-    %define mask1p spill(3)
-    %define mask1q spill(4)
-    %define mpb_00 [pb_00 GLOBAL]
-    %define mpb_01 [pb_01 GLOBAL]
-%endif
-
-;-----------------------------------------------------------------------------
-; void x264_deblock_v_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta )
-;-----------------------------------------------------------------------------
-cglobal x264_deblock_%2_luma_intra_%1, 4,6,16
-%ifndef ARCH_X86_64
-    sub     esp, 0x60
-%endif
-    lea     r4, [r1*4]
-    lea     r5, [r1*3] ; 3*stride
-    dec     r2d        ; alpha-1
-    jl .end
-    neg     r4
-    dec     r3d        ; beta-1
-    jl .end
-    add     r4, r0     ; pix-4*stride
-    mova    p1, [r4+2*r1]
-    mova    p0, [r4+r5]
-    mova    q0, [r0]
-    mova    q1, [r0+r1]
-%ifdef ARCH_X86_64
-    pxor    mpb_00, mpb_00
-    mova    mpb_01, [pb_01 GLOBAL]
-    LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0
-    SWAP    7, 12 ; m12=mask0
-    pavgb   t5, mpb_00
-    pavgb   t5, mpb_01 ; alpha/4+1
-    movdqa  p2, [r4+r1]
-    movdqa  q2, [r0+2*r1]
-    DIFF_GT2 p0, q0, t5, t0, t3 ; t0 = |p0-q0| > alpha/4+1
-    DIFF_GT2 p0, p2, m5, t2, t5 ; mask1 = |p2-p0| > beta-1
-    DIFF_GT2 q0, q2, m5, t4, t5 ; t4 = |q2-q0| > beta-1
-    pand    t0, mask0
-    pand    t4, t0
-    pand    t2, t0
-    mova    mask1q, t4
-    mova    mask1p, t2
-%else
-    LOAD_MASK r2d, r3d, t5 ; m5=beta-1, t5=alpha-1, m7=mask0
-    mova    m4, t5
-    mova    mask0, m7
-    pavgb   m4, [pb_00 GLOBAL]
-    pavgb   m4, [pb_01 GLOBAL] ; alpha/4+1
-    DIFF_GT2 p0, q0, m4, m6, m7 ; m6 = |p0-q0| > alpha/4+1
-    pand    m6, mask0
-    DIFF_GT2 p0, p2, m5, m4, m7 ; m4 = |p2-p0| > beta-1
-    pand    m4, m6
-    mova    mask1p, m4
-    DIFF_GT2 q0, q2, m5, m4, m7 ; m4 = |q2-q0| > beta-1
-    pand    m4, m6
-    mova    mask1q, m4
-%endif
-    LUMA_INTRA_P012 [r4+r5], [r4+2*r1], [r4+r1], [r4]
-    LUMA_INTRA_SWAP_PQ
-    LUMA_INTRA_P012 [r0], [r0+r1], [r0+2*r1], [r0+r5]
-.end:
-%ifndef ARCH_X86_64
-    add     esp, 0x60
-%endif
-    RET
-
-INIT_MMX
-%ifdef ARCH_X86_64
-;-----------------------------------------------------------------------------
-; void x264_deblock_h_luma_intra_sse2( uint8_t *pix, int stride, int alpha, int beta )
-;-----------------------------------------------------------------------------
-cglobal x264_deblock_h_luma_intra_%1, 4,7
-    movsxd r10, r1d
-    lea    r11, [r10*3]
-    lea    r6,  [r0-4]
-    lea    r5,  [r0-4+r11]
-    sub    rsp, 0x88
-    %define pix_tmp rsp
-
-    ; transpose 8x16 -> tmp space
-    TRANSPOSE8x8_MEM  PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
-    lea    r6, [r6+r10*8]
-    lea    r5, [r5+r10*8]
-    TRANSPOSE8x8_MEM  PASS8ROWS(r6, r5, r10, r11), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
-
-    lea    r0,  [pix_tmp+0x40]
-    mov    r1,  0x10
-    call   x264_deblock_v_luma_intra_%1
-
-    ; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8)
-    lea    r5, [r6+r11]
-    TRANSPOSE8x8_MEM  PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11)
-    shl    r10, 3
-    sub    r6,  r10
-    sub    r5,  r10
-    shr    r10, 3
-    TRANSPOSE8x8_MEM  PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r6, r5, r10, r11)
-    add    rsp, 0x88
-    RET
-%else
-cglobal x264_deblock_h_luma_intra_%1, 2,4
-    lea    r3,  [r1*3]
-    sub    r0,  4
-    lea    r2,  [r0+r3]
-%assign pad 0x8c-(stack_offset&15)
-    SUB    rsp, pad
-    %define pix_tmp rsp
-
-    ; transpose 8x16 -> tmp space
-    TRANSPOSE8x8_MEM  PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30)
-    lea    r0,  [r0+r1*8]
-    lea    r2,  [r2+r1*8]
-    TRANSPOSE8x8_MEM  PASS8ROWS(r0, r2, r1, r3), PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30)
-
-    lea    r0,  [pix_tmp+0x40]
-    PUSH   dword r3m
-    PUSH   dword r2m
-    PUSH   dword 16
-    PUSH   r0
-    call   x264_deblock_%2_luma_intra_%1
-%ifidn %2, v8
-    add    dword [rsp], 8 ; pix_tmp+8
-    call   x264_deblock_%2_luma_intra_%1
-%endif
-    ADD    esp, 16
-
-    mov    r1,  r1m
-    mov    r0,  r0mp
-    lea    r3,  [r1*3]
-    sub    r0,  4
-    lea    r2,  [r0+r3]
-    ; transpose 16x6 -> original space (but we can't write only 6 pixels, so really 16x8)
-    TRANSPOSE8x8_MEM  PASS8ROWS(pix_tmp, pix_tmp+0x30, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3)
-    lea    r0,  [r0+r1*8]
-    lea    r2,  [r2+r1*8]
-    TRANSPOSE8x8_MEM  PASS8ROWS(pix_tmp+8, pix_tmp+0x38, 0x10, 0x30), PASS8ROWS(r0, r2, r1, r3)
-    ADD    rsp, pad
-    RET
-%endif ; ARCH_X86_64
-%endmacro ; DEBLOCK_LUMA_INTRA
-
-INIT_XMM
-DEBLOCK_LUMA_INTRA sse2, v
-%ifndef ARCH_X86_64
-INIT_MMX
-DEBLOCK_LUMA_INTRA mmxext, v8
-%endif
diff --git a/libavcodec/x86/h264_i386.h b/libavcodec/x86/h264_i386.h
deleted file mode 100644
index 26c163b..0000000
--- a/libavcodec/x86/h264_i386.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG4 part10 codec.
- * non-MMX i386-specific optimizations for H.264
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVCODEC_X86_H264_I386_H
-#define AVCODEC_X86_H264_I386_H
-
-#include "libavcodec/cabac.h"
-
-//FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
-//as that would make optimization work hard)
-#if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
-static int decode_significance_x86(CABACContext *c, int max_coeff,
-                                   uint8_t *significant_coeff_ctx_base,
-                                   int *index){
-    void *end= significant_coeff_ctx_base + max_coeff - 1;
-    int minusstart= -(int)significant_coeff_ctx_base;
-    int minusindex= 4-(int)index;
-    int coeff_count;
-    __asm__ volatile(
-        "movl "RANGE    "(%3), %%esi            \n\t"
-        "movl "LOW      "(%3), %%ebx            \n\t"
-
-        "2:                                     \n\t"
-
-        BRANCHLESS_GET_CABAC("%%edx", "%3", "(%1)", "%%ebx",
-                             "%%bx", "%%esi", "%%eax", "%%al")
-
-        "test $1, %%edx                         \n\t"
-        " jz 3f                                 \n\t"
-
-        BRANCHLESS_GET_CABAC("%%edx", "%3", "61(%1)", "%%ebx",
-                             "%%bx", "%%esi", "%%eax", "%%al")
-
-        "mov  %2, %%"REG_a"                     \n\t"
-        "movl %4, %%ecx                         \n\t"
-        "add  %1, %%"REG_c"                     \n\t"
-        "movl %%ecx, (%%"REG_a")                \n\t"
-
-        "test $1, %%edx                         \n\t"
-        " jnz 4f                                \n\t"
-
-        "add  $4, %%"REG_a"                     \n\t"
-        "mov  %%"REG_a", %2                     \n\t"
-
-        "3:                                     \n\t"
-        "add  $1, %1                            \n\t"
-        "cmp  %5, %1                            \n\t"
-        " jb 2b                                 \n\t"
-        "mov  %2, %%"REG_a"                     \n\t"
-        "movl %4, %%ecx                         \n\t"
-        "add  %1, %%"REG_c"                     \n\t"
-        "movl %%ecx, (%%"REG_a")                \n\t"
-        "4:                                     \n\t"
-        "add  %6, %%eax                         \n\t"
-        "shr $2, %%eax                          \n\t"
-
-        "movl %%esi, "RANGE    "(%3)            \n\t"
-        "movl %%ebx, "LOW      "(%3)            \n\t"
-        :"=&a"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index)
-        :"r"(c), "m"(minusstart), "m"(end), "m"(minusindex)
-        : "%"REG_c, "%ebx", "%edx", "%esi", "memory"
-    );
-    return coeff_count;
-}
-
-static int decode_significance_8x8_x86(CABACContext *c,
-                                       uint8_t *significant_coeff_ctx_base,
-                                       int *index, const uint8_t *sig_off){
-    int minusindex= 4-(int)index;
-    int coeff_count;
-    x86_reg last=0;
-    __asm__ volatile(
-        "movl "RANGE    "(%3), %%esi            \n\t"
-        "movl "LOW      "(%3), %%ebx            \n\t"
-
-        "mov %1, %%"REG_D"                      \n\t"
-        "2:                                     \n\t"
-
-        "mov %6, %%"REG_a"                      \n\t"
-        "movzbl (%%"REG_a", %%"REG_D"), %%edi   \n\t"
-        "add %5, %%"REG_D"                      \n\t"
-
-        BRANCHLESS_GET_CABAC("%%edx", "%3", "(%%"REG_D")", "%%ebx",
-                             "%%bx", "%%esi", "%%eax", "%%al")
-
-        "mov %1, %%edi                          \n\t"
-        "test $1, %%edx                         \n\t"
-        " jz 3f                                 \n\t"
-
-        "movzbl "MANGLE(last_coeff_flag_offset_8x8)"(%%edi), %%edi\n\t"
-        "add %5, %%"REG_D"                      \n\t"
-
-        BRANCHLESS_GET_CABAC("%%edx", "%3", "15(%%"REG_D")", "%%ebx",
-                             "%%bx", "%%esi", "%%eax", "%%al")
-
-        "mov %2, %%"REG_a"                      \n\t"
-        "mov %1, %%edi                          \n\t"
-        "movl %%edi, (%%"REG_a")                \n\t"
-
-        "test $1, %%edx                         \n\t"
-        " jnz 4f                                \n\t"
-
-        "add $4, %%"REG_a"                      \n\t"
-        "mov %%"REG_a", %2                      \n\t"
-
-        "3:                                     \n\t"
-        "addl $1, %%edi                         \n\t"
-        "mov %%edi, %1                          \n\t"
-        "cmpl $63, %%edi                        \n\t"
-        " jb 2b                                 \n\t"
-        "mov %2, %%"REG_a"                      \n\t"
-        "movl %%edi, (%%"REG_a")                \n\t"
-        "4:                                     \n\t"
-        "addl %4, %%eax                         \n\t"
-        "shr $2, %%eax                          \n\t"
-
-        "movl %%esi, "RANGE    "(%3)            \n\t"
-        "movl %%ebx, "LOW      "(%3)            \n\t"
-        :"=&a"(coeff_count),"+m"(last), "+m"(index)
-        :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)
-        : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"
-    );
-    return coeff_count;
-}
-#endif /* ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE */
-       /* !defined(BROKEN_RELOCATIONS) */
-
-#endif /* AVCODEC_X86_H264_I386_H */
diff --git a/libavcodec/x86/h264_idct_sse2.asm b/libavcodec/x86/h264_idct_sse2.asm
deleted file mode 100644
index f8ee2b6..0000000
--- a/libavcodec/x86/h264_idct_sse2.asm
+++ /dev/null
@@ -1,54 +0,0 @@
-;*****************************************************************************
-;* SSE2-optimized H.264 iDCT
-;*****************************************************************************
-;* Copyright (C) 2003-2008 x264 project
-;*
-;* Authors: Laurent Aimar <fenrir at via.ecp.fr>
-;*          Loren Merritt <lorenm at u.washington.edu>
-;*          Holger Lubitz <hal at duncan.ol.sub.de>
-;*          Min Chen <chenm001.163.com>
-;*
-;* 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
-;*****************************************************************************
-
-%include "x86inc.asm"
-%include "x86util.asm"
-
-SECTION_RODATA
-pw_32: times 8 dw 32
-
-SECTION .text
-
-INIT_XMM
-cglobal x264_add8x4_idct_sse2, 3,3,8
-    movq   m0, [r1+ 0]
-    movq   m1, [r1+ 8]
-    movq   m2, [r1+16]
-    movq   m3, [r1+24]
-    movhps m0, [r1+32]
-    movhps m1, [r1+40]
-    movhps m2, [r1+48]
-    movhps m3, [r1+56]
-    IDCT4_1D 0,1,2,3,4,5
-    TRANSPOSE2x4x4W 0,1,2,3,4
-    paddw m0, [pw_32 GLOBAL]
-    IDCT4_1D 0,1,2,3,4,5
-    pxor  m7, m7
-    STORE_DIFF  m0, m4, m7, [r0]
-    STORE_DIFF  m1, m4, m7, [r0+r2]
-    lea   r0, [r0+r2*2]
-    STORE_DIFF  m2, m4, m7, [r0]
-    STORE_DIFF  m3, m4, m7, [r0+r2]
-    RET
diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c
deleted file mode 100644
index fd16a02..0000000
--- a/libavcodec/x86/h264dsp_mmx.c
+++ /dev/null
@@ -1,2324 +0,0 @@
-/*
- * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "dsputil_mmx.h"
-
-DECLARE_ALIGNED(8, static const uint64_t, ff_pb_3_1  ) = 0x0103010301030103ULL;
-DECLARE_ALIGNED(8, static const uint64_t, ff_pb_7_3  ) = 0x0307030703070307ULL;
-
-/***********************************/
-/* IDCT */
-
-#define SUMSUB_BADC( a, b, c, d ) \
-    "paddw "#b", "#a" \n\t"\
-    "paddw "#d", "#c" \n\t"\
-    "paddw "#b", "#b" \n\t"\
-    "paddw "#d", "#d" \n\t"\
-    "psubw "#a", "#b" \n\t"\
-    "psubw "#c", "#d" \n\t"
-
-#define SUMSUBD2_AB( a, b, t ) \
-    "movq  "#b", "#t" \n\t"\
-    "psraw  $1 , "#b" \n\t"\
-    "paddw "#a", "#b" \n\t"\
-    "psraw  $1 , "#a" \n\t"\
-    "psubw "#t", "#a" \n\t"
-
-#define IDCT4_1D( s02, s13, d02, d13, t ) \
-    SUMSUB_BA  ( s02, d02 )\
-    SUMSUBD2_AB( s13, d13, t )\
-    SUMSUB_BADC( d13, s02, s13, d02 )
-
-#define STORE_DIFF_4P( p, t, z ) \
-    "psraw      $6,     "#p" \n\t"\
-    "movd       (%0),   "#t" \n\t"\
-    "punpcklbw "#z",    "#t" \n\t"\
-    "paddsw    "#t",    "#p" \n\t"\
-    "packuswb  "#z",    "#p" \n\t"\
-    "movd      "#p",    (%0) \n\t"
-
-static void ff_h264_idct_add_mmx(uint8_t *dst, int16_t *block, int stride)
-{
-    /* Load dct coeffs */
-    __asm__ volatile(
-        "movq   (%0), %%mm0 \n\t"
-        "movq  8(%0), %%mm1 \n\t"
-        "movq 16(%0), %%mm2 \n\t"
-        "movq 24(%0), %%mm3 \n\t"
-    :: "r"(block) );
-
-    __asm__ volatile(
-        /* mm1=s02+s13  mm2=s02-s13  mm4=d02+d13  mm0=d02-d13 */
-        IDCT4_1D( %%mm2, %%mm1, %%mm0, %%mm3, %%mm4 )
-
-        "movq      %0,    %%mm6 \n\t"
-        /* in: 1,4,0,2  out: 1,2,3,0 */
-        TRANSPOSE4( %%mm3, %%mm1, %%mm0, %%mm2, %%mm4 )
-
-        "paddw     %%mm6, %%mm3 \n\t"
-
-        /* mm2=s02+s13  mm3=s02-s13  mm4=d02+d13  mm1=d02-d13 */
-        IDCT4_1D( %%mm4, %%mm2, %%mm3, %%mm0, %%mm1 )
-
-        "pxor %%mm7, %%mm7    \n\t"
-    :: "m"(ff_pw_32));
-
-    __asm__ volatile(
-    STORE_DIFF_4P( %%mm0, %%mm1, %%mm7)
-        "add %1, %0             \n\t"
-    STORE_DIFF_4P( %%mm2, %%mm1, %%mm7)
-        "add %1, %0             \n\t"
-    STORE_DIFF_4P( %%mm3, %%mm1, %%mm7)
-        "add %1, %0             \n\t"
-    STORE_DIFF_4P( %%mm4, %%mm1, %%mm7)
-        : "+r"(dst)
-        : "r" ((x86_reg)stride)
-    );
-}
-
-static inline void h264_idct8_1d(int16_t *block)
-{
-    __asm__ volatile(
-        "movq 112(%0), %%mm7  \n\t"
-        "movq  80(%0), %%mm0  \n\t"
-        "movq  48(%0), %%mm3  \n\t"
-        "movq  16(%0), %%mm5  \n\t"
-
-        "movq   %%mm0, %%mm4  \n\t"
-        "movq   %%mm5, %%mm1  \n\t"
-        "psraw  $1,    %%mm4  \n\t"
-        "psraw  $1,    %%mm1  \n\t"
-        "paddw  %%mm0, %%mm4  \n\t"
-        "paddw  %%mm5, %%mm1  \n\t"
-        "paddw  %%mm7, %%mm4  \n\t"
-        "paddw  %%mm0, %%mm1  \n\t"
-        "psubw  %%mm5, %%mm4  \n\t"
-        "paddw  %%mm3, %%mm1  \n\t"
-
-        "psubw  %%mm3, %%mm5  \n\t"
-        "psubw  %%mm3, %%mm0  \n\t"
-        "paddw  %%mm7, %%mm5  \n\t"
-        "psubw  %%mm7, %%mm0  \n\t"
-        "psraw  $1,    %%mm3  \n\t"
-        "psraw  $1,    %%mm7  \n\t"
-        "psubw  %%mm3, %%mm5  \n\t"
-        "psubw  %%mm7, %%mm0  \n\t"
-
-        "movq   %%mm4, %%mm3  \n\t"
-        "movq   %%mm1, %%mm7  \n\t"
-        "psraw  $2,    %%mm1  \n\t"
-        "psraw  $2,    %%mm3  \n\t"
-        "paddw  %%mm5, %%mm3  \n\t"
-        "psraw  $2,    %%mm5  \n\t"
-        "paddw  %%mm0, %%mm1  \n\t"
-        "psraw  $2,    %%mm0  \n\t"
-        "psubw  %%mm4, %%mm5  \n\t"
-        "psubw  %%mm0, %%mm7  \n\t"
-
-        "movq  32(%0), %%mm2  \n\t"
-        "movq  96(%0), %%mm6  \n\t"
-        "movq   %%mm2, %%mm4  \n\t"
-        "movq   %%mm6, %%mm0  \n\t"
-        "psraw  $1,    %%mm4  \n\t"
-        "psraw  $1,    %%mm6  \n\t"
-        "psubw  %%mm0, %%mm4  \n\t"
-        "paddw  %%mm2, %%mm6  \n\t"
-
-        "movq    (%0), %%mm2  \n\t"
-        "movq  64(%0), %%mm0  \n\t"
-        SUMSUB_BA( %%mm0, %%mm2 )
-        SUMSUB_BA( %%mm6, %%mm0 )
-        SUMSUB_BA( %%mm4, %%mm2 )
-        SUMSUB_BA( %%mm7, %%mm6 )
-        SUMSUB_BA( %%mm5, %%mm4 )
-        SUMSUB_BA( %%mm3, %%mm2 )
-        SUMSUB_BA( %%mm1, %%mm0 )
-        :: "r"(block)
-    );
-}
-
-static void ff_h264_idct8_add_mmx(uint8_t *dst, int16_t *block, int stride)
-{
-    int i;
-    DECLARE_ALIGNED(8, int16_t, b2)[64];
-
-    block[0] += 32;
-
-    for(i=0; i<2; i++){
-        DECLARE_ALIGNED(8, uint64_t, tmp);
-
-        h264_idct8_1d(block+4*i);
-
-        __asm__ volatile(
-            "movq   %%mm7,    %0   \n\t"
-            TRANSPOSE4( %%mm0, %%mm2, %%mm4, %%mm6, %%mm7 )
-            "movq   %%mm0,  8(%1)  \n\t"
-            "movq   %%mm6, 24(%1)  \n\t"
-            "movq   %%mm7, 40(%1)  \n\t"
-            "movq   %%mm4, 56(%1)  \n\t"
-            "movq    %0,    %%mm7  \n\t"
-            TRANSPOSE4( %%mm7, %%mm5, %%mm3, %%mm1, %%mm0 )
-            "movq   %%mm7,   (%1)  \n\t"
-            "movq   %%mm1, 16(%1)  \n\t"
-            "movq   %%mm0, 32(%1)  \n\t"
-            "movq   %%mm3, 48(%1)  \n\t"
-            : "=m"(tmp)
-            : "r"(b2+32*i)
-            : "memory"
-        );
-    }
-
-    for(i=0; i<2; i++){
-        h264_idct8_1d(b2+4*i);
-
-        __asm__ volatile(
-            "psraw     $6, %%mm7  \n\t"
-            "psraw     $6, %%mm6  \n\t"
-            "psraw     $6, %%mm5  \n\t"
-            "psraw     $6, %%mm4  \n\t"
-            "psraw     $6, %%mm3  \n\t"
-            "psraw     $6, %%mm2  \n\t"
-            "psraw     $6, %%mm1  \n\t"
-            "psraw     $6, %%mm0  \n\t"
-
-            "movq   %%mm7,    (%0)  \n\t"
-            "movq   %%mm5,  16(%0)  \n\t"
-            "movq   %%mm3,  32(%0)  \n\t"
-            "movq   %%mm1,  48(%0)  \n\t"
-            "movq   %%mm0,  64(%0)  \n\t"
-            "movq   %%mm2,  80(%0)  \n\t"
-            "movq   %%mm4,  96(%0)  \n\t"
-            "movq   %%mm6, 112(%0)  \n\t"
-            :: "r"(b2+4*i)
-            : "memory"
-        );
-    }
-
-    add_pixels_clamped_mmx(b2, dst, stride);
-}
-
-#define STORE_DIFF_8P( p, d, t, z )\
-        "movq       "#d", "#t" \n"\
-        "psraw       $6,  "#p" \n"\
-        "punpcklbw  "#z", "#t" \n"\
-        "paddsw     "#t", "#p" \n"\
-        "packuswb   "#p", "#p" \n"\
-        "movq       "#p", "#d" \n"
-
-#define H264_IDCT8_1D_SSE2(a,b,c,d,e,f,g,h)\
-        "movdqa     "#c", "#a" \n"\
-        "movdqa     "#g", "#e" \n"\
-        "psraw       $1,  "#c" \n"\
-        "psraw       $1,  "#g" \n"\
-        "psubw      "#e", "#c" \n"\
-        "paddw      "#a", "#g" \n"\
-        "movdqa     "#b", "#e" \n"\
-        "psraw       $1,  "#e" \n"\
-        "paddw      "#b", "#e" \n"\
-        "paddw      "#d", "#e" \n"\
-        "paddw      "#f", "#e" \n"\
-        "movdqa     "#f", "#a" \n"\
-        "psraw       $1,  "#a" \n"\
-        "paddw      "#f", "#a" \n"\
-        "paddw      "#h", "#a" \n"\
-        "psubw      "#b", "#a" \n"\
-        "psubw      "#d", "#b" \n"\
-        "psubw      "#d", "#f" \n"\
-        "paddw      "#h", "#b" \n"\
-        "psubw      "#h", "#f" \n"\
-        "psraw       $1,  "#d" \n"\
-        "psraw       $1,  "#h" \n"\
-        "psubw      "#d", "#b" \n"\
-        "psubw      "#h", "#f" \n"\
-        "movdqa     "#e", "#d" \n"\
-        "movdqa     "#a", "#h" \n"\
-        "psraw       $2,  "#d" \n"\
-        "psraw       $2,  "#h" \n"\
-        "paddw      "#f", "#d" \n"\
-        "paddw      "#b", "#h" \n"\
-        "psraw       $2,  "#f" \n"\
-        "psraw       $2,  "#b" \n"\
-        "psubw      "#f", "#e" \n"\
-        "psubw      "#a", "#b" \n"\
-        "movdqa 0x00(%1), "#a" \n"\
-        "movdqa 0x40(%1), "#f" \n"\
-        SUMSUB_BA(f, a)\
-        SUMSUB_BA(g, f)\
-        SUMSUB_BA(c, a)\
-        SUMSUB_BA(e, g)\
-        SUMSUB_BA(b, c)\
-        SUMSUB_BA(h, a)\
-        SUMSUB_BA(d, f)
-
-static void ff_h264_idct8_add_sse2(uint8_t *dst, int16_t *block, int stride)
-{
-    __asm__ volatile(
-        "movdqa   0x10(%1), %%xmm1 \n"
-        "movdqa   0x20(%1), %%xmm2 \n"
-        "movdqa   0x30(%1), %%xmm3 \n"
-        "movdqa   0x50(%1), %%xmm5 \n"
-        "movdqa   0x60(%1), %%xmm6 \n"
-        "movdqa   0x70(%1), %%xmm7 \n"
-        H264_IDCT8_1D_SSE2(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)
-        TRANSPOSE8(%%xmm4, %%xmm1, %%xmm7, %%xmm3, %%xmm5, %%xmm0, %%xmm2, %%xmm6, (%1))
-        "paddw          %4, %%xmm4 \n"
-        "movdqa     %%xmm4, 0x00(%1) \n"
-        "movdqa     %%xmm2, 0x40(%1) \n"
-        H264_IDCT8_1D_SSE2(%%xmm4, %%xmm0, %%xmm6, %%xmm3, %%xmm2, %%xmm5, %%xmm7, %%xmm1)
-        "movdqa     %%xmm6, 0x60(%1) \n"
-        "movdqa     %%xmm7, 0x70(%1) \n"
-        "pxor       %%xmm7, %%xmm7 \n"
-        STORE_DIFF_8P(%%xmm2, (%0),      %%xmm6, %%xmm7)
-        STORE_DIFF_8P(%%xmm0, (%0,%2),   %%xmm6, %%xmm7)
-        STORE_DIFF_8P(%%xmm1, (%0,%2,2), %%xmm6, %%xmm7)
-        STORE_DIFF_8P(%%xmm3, (%0,%3),   %%xmm6, %%xmm7)
-        "lea     (%0,%2,4), %0 \n"
-        STORE_DIFF_8P(%%xmm5, (%0),      %%xmm6, %%xmm7)
-        STORE_DIFF_8P(%%xmm4, (%0,%2),   %%xmm6, %%xmm7)
-        "movdqa   0x60(%1), %%xmm0 \n"
-        "movdqa   0x70(%1), %%xmm1 \n"
-        STORE_DIFF_8P(%%xmm0, (%0,%2,2), %%xmm6, %%xmm7)
-        STORE_DIFF_8P(%%xmm1, (%0,%3),   %%xmm6, %%xmm7)
-        :"+r"(dst)
-        :"r"(block), "r"((x86_reg)stride), "r"((x86_reg)3L*stride), "m"(ff_pw_32)
-    );
-}
-
-static void ff_h264_idct_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
-{
-    int dc = (block[0] + 32) >> 6;
-    __asm__ volatile(
-        "movd          %0, %%mm0 \n\t"
-        "pshufw $0, %%mm0, %%mm0 \n\t"
-        "pxor       %%mm1, %%mm1 \n\t"
-        "psubw      %%mm0, %%mm1 \n\t"
-        "packuswb   %%mm0, %%mm0 \n\t"
-        "packuswb   %%mm1, %%mm1 \n\t"
-        ::"r"(dc)
-    );
-    __asm__ volatile(
-        "movd          %0, %%mm2 \n\t"
-        "movd          %1, %%mm3 \n\t"
-        "movd          %2, %%mm4 \n\t"
-        "movd          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movd       %%mm2, %0    \n\t"
-        "movd       %%mm3, %1    \n\t"
-        "movd       %%mm4, %2    \n\t"
-        "movd       %%mm5, %3    \n\t"
-        :"+m"(*(uint32_t*)(dst+0*stride)),
-         "+m"(*(uint32_t*)(dst+1*stride)),
-         "+m"(*(uint32_t*)(dst+2*stride)),
-         "+m"(*(uint32_t*)(dst+3*stride))
-    );
-}
-
-static void ff_h264_idct8_dc_add_mmx2(uint8_t *dst, int16_t *block, int stride)
-{
-    int dc = (block[0] + 32) >> 6;
-    int y;
-    __asm__ volatile(
-        "movd          %0, %%mm0 \n\t"
-        "pshufw $0, %%mm0, %%mm0 \n\t"
-        "pxor       %%mm1, %%mm1 \n\t"
-        "psubw      %%mm0, %%mm1 \n\t"
-        "packuswb   %%mm0, %%mm0 \n\t"
-        "packuswb   %%mm1, %%mm1 \n\t"
-        ::"r"(dc)
-    );
-    for(y=2; y--; dst += 4*stride){
-    __asm__ volatile(
-        "movq          %0, %%mm2 \n\t"
-        "movq          %1, %%mm3 \n\t"
-        "movq          %2, %%mm4 \n\t"
-        "movq          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movq       %%mm2, %0    \n\t"
-        "movq       %%mm3, %1    \n\t"
-        "movq       %%mm4, %2    \n\t"
-        "movq       %%mm5, %3    \n\t"
-        :"+m"(*(uint64_t*)(dst+0*stride)),
-         "+m"(*(uint64_t*)(dst+1*stride)),
-         "+m"(*(uint64_t*)(dst+2*stride)),
-         "+m"(*(uint64_t*)(dst+3*stride))
-    );
-    }
-}
-
-//FIXME this table is a duplicate from h264data.h, and will be removed once the tables from, h264 have been split
-static const uint8_t scan8[16 + 2*4]={
- 4+1*8, 5+1*8, 4+2*8, 5+2*8,
- 6+1*8, 7+1*8, 6+2*8, 7+2*8,
- 4+3*8, 5+3*8, 4+4*8, 5+4*8,
- 6+3*8, 7+3*8, 6+4*8, 7+4*8,
- 1+1*8, 2+1*8,
- 1+2*8, 2+2*8,
- 1+4*8, 2+4*8,
- 1+5*8, 2+5*8,
-};
-
-static void ff_h264_idct_add16_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        if(nnzc[ scan8[i] ])
-            ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride);
-    }
-}
-
-static void ff_h264_idct8_add4_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i+=4){
-        if(nnzc[ scan8[i] ])
-            ff_h264_idct8_add_mmx(dst + block_offset[i], block + i*16, stride);
-    }
-}
-
-
-static void ff_h264_idct_add16_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        int nnz = nnzc[ scan8[i] ];
-        if(nnz){
-            if(nnz==1 && block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
-            else                      ff_h264_idct_add_mmx    (dst + block_offset[i], block + i*16, stride);
-        }
-    }
-}
-
-static void ff_h264_idct_add16intra_mmx(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        if(nnzc[ scan8[i] ] || block[i*16])
-            ff_h264_idct_add_mmx(dst + block_offset[i], block + i*16, stride);
-    }
-}
-
-static void ff_h264_idct_add16intra_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i++){
-        if(nnzc[ scan8[i] ]) ff_h264_idct_add_mmx    (dst + block_offset[i], block + i*16, stride);
-        else if(block[i*16]) ff_h264_idct_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
-    }
-}
-
-static void ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i+=4){
-        int nnz = nnzc[ scan8[i] ];
-        if(nnz){
-            if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
-            else                      ff_h264_idct8_add_mmx    (dst + block_offset[i], block + i*16, stride);
-        }
-    }
-}
-
-static void ff_h264_idct8_add4_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i+=4){
-        int nnz = nnzc[ scan8[i] ];
-        if(nnz){
-            if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
-            else                      ff_h264_idct8_add_sse2   (dst + block_offset[i], block + i*16, stride);
-        }
-    }
-}
-
-static void ff_h264_idct_add8_mmx(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=16; i<16+8; i++){
-        if(nnzc[ scan8[i] ] || block[i*16])
-            ff_h264_idct_add_mmx    (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-    }
-}
-
-static void ff_h264_idct_add8_mmx2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=16; i<16+8; i++){
-        if(nnzc[ scan8[i] ])
-            ff_h264_idct_add_mmx    (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-        else if(block[i*16])
-            ff_h264_idct_dc_add_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-    }
-}
-
-#if CONFIG_GPL && HAVE_YASM
-static void ff_h264_idct_dc_add8_mmx2(uint8_t *dst, int16_t *block, int stride)
-{
-    __asm__ volatile(
-        "movd             %0, %%mm0 \n\t"   //  0 0 X D
-        "punpcklwd        %1, %%mm0 \n\t"   //  x X d D
-        "paddsw           %2, %%mm0 \n\t"
-        "psraw            $6, %%mm0 \n\t"
-        "punpcklwd     %%mm0, %%mm0 \n\t"   //  d d D D
-        "pxor          %%mm1, %%mm1 \n\t"   //  0 0 0 0
-        "psubw         %%mm0, %%mm1 \n\t"   // -d-d-D-D
-        "packuswb      %%mm1, %%mm0 \n\t"   // -d-d-D-D d d D D
-        "pshufw $0xFA, %%mm0, %%mm1 \n\t"   // -d-d-d-d-D-D-D-D
-        "punpcklwd     %%mm0, %%mm0 \n\t"   //  d d d d D D D D
-        ::"m"(block[ 0]),
-          "m"(block[16]),
-          "m"(ff_pw_32)
-    );
-    __asm__ volatile(
-        "movq          %0, %%mm2 \n\t"
-        "movq          %1, %%mm3 \n\t"
-        "movq          %2, %%mm4 \n\t"
-        "movq          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movq       %%mm2, %0    \n\t"
-        "movq       %%mm3, %1    \n\t"
-        "movq       %%mm4, %2    \n\t"
-        "movq       %%mm5, %3    \n\t"
-        :"+m"(*(uint64_t*)(dst+0*stride)),
-         "+m"(*(uint64_t*)(dst+1*stride)),
-         "+m"(*(uint64_t*)(dst+2*stride)),
-         "+m"(*(uint64_t*)(dst+3*stride))
-    );
-}
-
-extern void ff_x264_add8x4_idct_sse2(uint8_t *dst, int16_t *block, int stride);
-
-static void ff_h264_idct_add16_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i+=2)
-        if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ])
-            ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride);
-}
-
-static void ff_h264_idct_add16intra_sse2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=0; i<16; i+=2){
-        if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ])
-            ff_x264_add8x4_idct_sse2 (dst + block_offset[i], block + i*16, stride);
-        else if(block[i*16]|block[i*16+16])
-            ff_h264_idct_dc_add8_mmx2(dst + block_offset[i], block + i*16, stride);
-    }
-}
-
-static void ff_h264_idct_add8_sse2(uint8_t **dest, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
-    int i;
-    for(i=16; i<16+8; i+=2){
-        if(nnzc[ scan8[i+0] ]|nnzc[ scan8[i+1] ])
-            ff_x264_add8x4_idct_sse2 (dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-        else if(block[i*16]|block[i*16+16])
-            ff_h264_idct_dc_add8_mmx2(dest[(i&4)>>2] + block_offset[i], block + i*16, stride);
-    }
-}
-#endif
-
-/***********************************/
-/* deblocking */
-
-// out: o = |x-y|>a
-// clobbers: t
-#define DIFF_GT_MMX(x,y,a,o,t)\
-    "movq     "#y", "#t"  \n\t"\
-    "movq     "#x", "#o"  \n\t"\
-    "psubusb  "#x", "#t"  \n\t"\
-    "psubusb  "#y", "#o"  \n\t"\
-    "por      "#t", "#o"  \n\t"\
-    "psubusb  "#a", "#o"  \n\t"
-
-// out: o = |x-y|>a
-// clobbers: t
-#define DIFF_GT2_MMX(x,y,a,o,t)\
-    "movq     "#y", "#t"  \n\t"\
-    "movq     "#x", "#o"  \n\t"\
-    "psubusb  "#x", "#t"  \n\t"\
-    "psubusb  "#y", "#o"  \n\t"\
-    "psubusb  "#a", "#t"  \n\t"\
-    "psubusb  "#a", "#o"  \n\t"\
-    "pcmpeqb  "#t", "#o"  \n\t"\
-
-// in: mm0=p1 mm1=p0 mm2=q0 mm3=q1
-// out: mm5=beta-1, mm7=mask
-// clobbers: mm4,mm6
-#define H264_DEBLOCK_MASK(alpha1, beta1) \
-    "pshufw $0, "#alpha1", %%mm4 \n\t"\
-    "pshufw $0, "#beta1 ", %%mm5 \n\t"\
-    "packuswb  %%mm4, %%mm4      \n\t"\
-    "packuswb  %%mm5, %%mm5      \n\t"\
-    DIFF_GT_MMX(%%mm1, %%mm2, %%mm4, %%mm7, %%mm6) /* |p0-q0| > alpha-1 */\
-    DIFF_GT_MMX(%%mm0, %%mm1, %%mm5, %%mm4, %%mm6) /* |p1-p0| > beta-1 */\
-    "por       %%mm4, %%mm7      \n\t"\
-    DIFF_GT_MMX(%%mm3, %%mm2, %%mm5, %%mm4, %%mm6) /* |q1-q0| > beta-1 */\
-    "por       %%mm4, %%mm7      \n\t"\
-    "pxor      %%mm6, %%mm6      \n\t"\
-    "pcmpeqb   %%mm6, %%mm7      \n\t"
-
-// in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask)
-// out: mm1=p0' mm2=q0'
-// clobbers: mm0,3-6
-#define H264_DEBLOCK_P0_Q0(pb_01, pb_3f)\
-        "movq    %%mm1              , %%mm5 \n\t"\
-        "pxor    %%mm2              , %%mm5 \n\t" /* p0^q0*/\
-        "pand    "#pb_01"           , %%mm5 \n\t" /* (p0^q0)&1*/\
-        "pcmpeqb %%mm4              , %%mm4 \n\t"\
-        "pxor    %%mm4              , %%mm3 \n\t"\
-        "pavgb   %%mm0              , %%mm3 \n\t" /* (p1 - q1 + 256)>>1*/\
-        "pavgb   "MANGLE(ff_pb_3)"  , %%mm3 \n\t" /*(((p1 - q1 + 256)>>1)+4)>>1 = 64+2+(p1-q1)>>2*/\
-        "pxor    %%mm1              , %%mm4 \n\t"\
-        "pavgb   %%mm2              , %%mm4 \n\t" /* (q0 - p0 + 256)>>1*/\
-        "pavgb   %%mm5              , %%mm3 \n\t"\
-        "paddusb %%mm4              , %%mm3 \n\t" /* d+128+33*/\
-        "movq    "MANGLE(ff_pb_A1)" , %%mm6 \n\t"\
-        "psubusb %%mm3              , %%mm6 \n\t"\
-        "psubusb "MANGLE(ff_pb_A1)" , %%mm3 \n\t"\
-        "pminub  %%mm7              , %%mm6 \n\t"\
-        "pminub  %%mm7              , %%mm3 \n\t"\
-        "psubusb %%mm6              , %%mm1 \n\t"\
-        "psubusb %%mm3              , %%mm2 \n\t"\
-        "paddusb %%mm3              , %%mm1 \n\t"\
-        "paddusb %%mm6              , %%mm2 \n\t"
-
-// in: mm0=p1 mm1=p0 mm2=q0 mm3=q1 mm7=(tc&mask) %8=ff_bone
-// out: (q1addr) = av_clip( (q2+((p0+q0+1)>>1))>>1, q1-tc0, q1+tc0 )
-// clobbers: q2, tmp, tc0
-#define H264_DEBLOCK_Q1(p1, q2, q2addr, q1addr, tc0, tmp)\
-        "movq     %%mm1,  "#tmp"   \n\t"\
-        "pavgb    %%mm2,  "#tmp"   \n\t"\
-        "pavgb    "#tmp", "#q2"    \n\t" /* avg(p2,avg(p0,q0)) */\
-        "pxor   "q2addr", "#tmp"   \n\t"\
-        "pand     %9,     "#tmp"   \n\t" /* (p2^avg(p0,q0))&1 */\
-        "psubusb  "#tmp", "#q2"    \n\t" /* (p2+((p0+q0+1)>>1))>>1 */\
-        "movq     "#p1",  "#tmp"   \n\t"\
-        "psubusb  "#tc0", "#tmp"   \n\t"\
-        "paddusb  "#p1",  "#tc0"   \n\t"\
-        "pmaxub   "#tmp", "#q2"    \n\t"\
-        "pminub   "#tc0", "#q2"    \n\t"\
-        "movq     "#q2",  "q1addr" \n\t"
-
-static inline void h264_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha1, int beta1, int8_t *tc0)
-{
-    DECLARE_ALIGNED(8, uint64_t, tmp0)[2];
-
-    __asm__ volatile(
-        "movq    (%2,%4), %%mm0    \n\t" //p1
-        "movq    (%2,%4,2), %%mm1  \n\t" //p0
-        "movq    (%3),    %%mm2    \n\t" //q0
-        "movq    (%3,%4), %%mm3    \n\t" //q1
-        H264_DEBLOCK_MASK(%7, %8)
-
-        "movd      %6,    %%mm4    \n\t"
-        "punpcklbw %%mm4, %%mm4    \n\t"
-        "punpcklwd %%mm4, %%mm4    \n\t"
-        "pcmpeqb   %%mm3, %%mm3    \n\t"
-        "movq      %%mm4, %%mm6    \n\t"
-        "pcmpgtb   %%mm3, %%mm4    \n\t"
-        "movq      %%mm6, %1       \n\t"
-        "pand      %%mm4, %%mm7    \n\t"
-        "movq      %%mm7, %0       \n\t"
-
-        /* filter p1 */
-        "movq     (%2),   %%mm3    \n\t" //p2
-        DIFF_GT2_MMX(%%mm1, %%mm3, %%mm5, %%mm6, %%mm4) // |p2-p0|>beta-1
-        "pand     %%mm7,  %%mm6    \n\t" // mask & |p2-p0|<beta
-        "pand     %1,     %%mm7    \n\t" // mask & tc0
-        "movq     %%mm7,  %%mm4    \n\t"
-        "psubb    %%mm6,  %%mm7    \n\t"
-        "pand     %%mm4,  %%mm6    \n\t" // mask & |p2-p0|<beta & tc0
-        H264_DEBLOCK_Q1(%%mm0, %%mm3, "(%2)", "(%2,%4)", %%mm6, %%mm4)
-
-        /* filter q1 */
-        "movq    (%3,%4,2), %%mm4  \n\t" //q2
-        DIFF_GT2_MMX(%%mm2, %%mm4, %%mm5, %%mm6, %%mm3) // |q2-q0|>beta-1
-        "pand     %0,     %%mm6    \n\t"
-        "movq     %1,     %%mm5    \n\t" // can be merged with the and below but is slower then
-        "pand     %%mm6,  %%mm5    \n\t"
-        "psubb    %%mm6,  %%mm7    \n\t"
-        "movq    (%3,%4), %%mm3    \n\t"
-        H264_DEBLOCK_Q1(%%mm3, %%mm4, "(%3,%4,2)", "(%3,%4)", %%mm5, %%mm6)
-
-        /* filter p0, q0 */
-        H264_DEBLOCK_P0_Q0(%9, unused)
-        "movq      %%mm1, (%2,%4,2) \n\t"
-        "movq      %%mm2, (%3)      \n\t"
-
-        : "=m"(tmp0[0]), "=m"(tmp0[1])
-        : "r"(pix-3*stride), "r"(pix), "r"((x86_reg)stride),
-          "m"(*tmp0/*unused*/), "m"(*(uint32_t*)tc0), "m"(alpha1), "m"(beta1),
-          "m"(ff_bone)
-    );
-}
-
-static void h264_v_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    if((tc0[0] & tc0[1]) >= 0)
-        h264_loop_filter_luma_mmx2(pix, stride, alpha-1, beta-1, tc0);
-    if((tc0[2] & tc0[3]) >= 0)
-        h264_loop_filter_luma_mmx2(pix+8, stride, alpha-1, beta-1, tc0+2);
-}
-static void h264_h_loop_filter_luma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    //FIXME: could cut some load/stores by merging transpose with filter
-    // also, it only needs to transpose 6x8
-    DECLARE_ALIGNED(8, uint8_t, trans)[8*8];
-    int i;
-    for(i=0; i<2; i++, pix+=8*stride, tc0+=2) {
-        if((tc0[0] & tc0[1]) < 0)
-            continue;
-        transpose4x4(trans,       pix-4,          8, stride);
-        transpose4x4(trans  +4*8, pix,            8, stride);
-        transpose4x4(trans+4,     pix-4+4*stride, 8, stride);
-        transpose4x4(trans+4+4*8, pix  +4*stride, 8, stride);
-        h264_loop_filter_luma_mmx2(trans+4*8, 8, alpha-1, beta-1, tc0);
-        transpose4x4(pix-2,          trans  +2*8, stride, 8);
-        transpose4x4(pix-2+4*stride, trans+4+2*8, stride, 8);
-    }
-}
-
-static inline void h264_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha1, int beta1, int8_t *tc0)
-{
-    __asm__ volatile(
-        "movq    (%0),    %%mm0     \n\t" //p1
-        "movq    (%0,%2), %%mm1     \n\t" //p0
-        "movq    (%1),    %%mm2     \n\t" //q0
-        "movq    (%1,%2), %%mm3     \n\t" //q1
-        H264_DEBLOCK_MASK(%4, %5)
-        "movd      %3,    %%mm6     \n\t"
-        "punpcklbw %%mm6, %%mm6     \n\t"
-        "pand      %%mm6, %%mm7     \n\t" // mm7 = tc&mask
-        H264_DEBLOCK_P0_Q0(%6, %7)
-        "movq      %%mm1, (%0,%2)   \n\t"
-        "movq      %%mm2, (%1)      \n\t"
-
-        :: "r"(pix-2*stride), "r"(pix), "r"((x86_reg)stride),
-           "r"(*(uint32_t*)tc0),
-           "m"(alpha1), "m"(beta1), "m"(ff_bone), "m"(ff_pb_3F)
-    );
-}
-
-static void h264_v_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    h264_loop_filter_chroma_mmx2(pix, stride, alpha-1, beta-1, tc0);
-}
-
-static void h264_h_loop_filter_chroma_mmx2(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
-{
-    //FIXME: could cut some load/stores by merging transpose with filter
-    DECLARE_ALIGNED(8, uint8_t, trans)[8*4];
-    transpose4x4(trans, pix-2, 8, stride);
-    transpose4x4(trans+4, pix-2+4*stride, 8, stride);
-    h264_loop_filter_chroma_mmx2(trans+2*8, 8, alpha-1, beta-1, tc0);
-    transpose4x4(pix-2, trans, stride, 8);
-    transpose4x4(pix-2+4*stride, trans+4, stride, 8);
-}
-
-// p0 = (p0 + q1 + 2*p1 + 2) >> 2
-#define H264_FILTER_CHROMA4(p0, p1, q1, one) \
-    "movq    "#p0", %%mm4  \n\t"\
-    "pxor    "#q1", %%mm4  \n\t"\
-    "pand   "#one", %%mm4  \n\t" /* mm4 = (p0^q1)&1 */\
-    "pavgb   "#q1", "#p0"  \n\t"\
-    "psubusb %%mm4, "#p0"  \n\t"\
-    "pavgb   "#p1", "#p0"  \n\t" /* dst = avg(p1, avg(p0,q1) - ((p0^q1)&1)) */\
-
-static inline void h264_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha1, int beta1)
-{
-    __asm__ volatile(
-        "movq    (%0),    %%mm0     \n\t"
-        "movq    (%0,%2), %%mm1     \n\t"
-        "movq    (%1),    %%mm2     \n\t"
-        "movq    (%1,%2), %%mm3     \n\t"
-        H264_DEBLOCK_MASK(%3, %4)
-        "movq    %%mm1,   %%mm5     \n\t"
-        "movq    %%mm2,   %%mm6     \n\t"
-        H264_FILTER_CHROMA4(%%mm1, %%mm0, %%mm3, %5) //p0'
-        H264_FILTER_CHROMA4(%%mm2, %%mm3, %%mm0, %5) //q0'
-        "psubb   %%mm5,   %%mm1     \n\t"
-        "psubb   %%mm6,   %%mm2     \n\t"
-        "pand    %%mm7,   %%mm1     \n\t"
-        "pand    %%mm7,   %%mm2     \n\t"
-        "paddb   %%mm5,   %%mm1     \n\t"
-        "paddb   %%mm6,   %%mm2     \n\t"
-        "movq    %%mm1,   (%0,%2)   \n\t"
-        "movq    %%mm2,   (%1)      \n\t"
-        :: "r"(pix-2*stride), "r"(pix), "r"((x86_reg)stride),
-           "m"(alpha1), "m"(beta1), "m"(ff_bone)
-    );
-}
-
-static void h264_v_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta)
-{
-    h264_loop_filter_chroma_intra_mmx2(pix, stride, alpha-1, beta-1);
-}
-
-static void h264_h_loop_filter_chroma_intra_mmx2(uint8_t *pix, int stride, int alpha, int beta)
-{
-    //FIXME: could cut some load/stores by merging transpose with filter
-    DECLARE_ALIGNED(8, uint8_t, trans)[8*4];
-    transpose4x4(trans, pix-2, 8, stride);
-    transpose4x4(trans+4, pix-2+4*stride, 8, stride);
-    h264_loop_filter_chroma_intra_mmx2(trans+2*8, 8, alpha-1, beta-1);
-    transpose4x4(pix-2, trans, stride, 8);
-    transpose4x4(pix-2+4*stride, trans+4, stride, 8);
-}
-
-static void h264_loop_filter_strength_mmx2( int16_t bS[2][4][4], uint8_t nnz[40], int8_t ref[2][40], int16_t mv[2][40][2],
-                                            int bidir, int edges, int step, int mask_mv0, int mask_mv1, int field ) {
-    int dir;
-    __asm__ volatile(
-        "movq %0, %%mm7 \n"
-        "movq %1, %%mm6 \n"
-        ::"m"(ff_pb_1), "m"(ff_pb_3)
-    );
-    if(field)
-        __asm__ volatile(
-            "movq %0, %%mm6 \n"
-            ::"m"(ff_pb_3_1)
-        );
-    __asm__ volatile(
-        "movq  %%mm6, %%mm5 \n"
-        "paddb %%mm5, %%mm5 \n"
-    :);
-
-    // could do a special case for dir==0 && edges==1, but it only reduces the
-    // average filter time by 1.2%
-    for( dir=1; dir>=0; dir-- ) {
-        const x86_reg d_idx = dir ? -8 : -1;
-        const int mask_mv = dir ? mask_mv1 : mask_mv0;
-        DECLARE_ALIGNED(8, const uint64_t, mask_dir) = dir ? 0 : 0xffffffffffffffffULL;
-        int b_idx, edge;
-        for( b_idx=12, edge=0; edge<edges; edge+=step, b_idx+=8*step ) {
-            __asm__ volatile(
-                "pand %0, %%mm0 \n\t"
-                ::"m"(mask_dir)
-            );
-            if(!(mask_mv & edge)) {
-                if(bidir) {
-                    __asm__ volatile(
-                        "movd         (%1,%0), %%mm2 \n"
-                        "punpckldq  40(%1,%0), %%mm2 \n" // { ref0[bn], ref1[bn] }
-                        "pshufw $0x44,   (%1), %%mm0 \n" // { ref0[b], ref0[b] }
-                        "pshufw $0x44, 40(%1), %%mm1 \n" // { ref1[b], ref1[b] }
-                        "pshufw $0x4E, %%mm2, %%mm3 \n"
-                        "psubb         %%mm2, %%mm0 \n" // { ref0[b]!=ref0[bn], ref0[b]!=ref1[bn] }
-                        "psubb         %%mm3, %%mm1 \n" // { ref1[b]!=ref1[bn], ref1[b]!=ref0[bn] }
-                        "1: \n"
-                        "por           %%mm1, %%mm0 \n"
-                        "movq      (%2,%0,4), %%mm1 \n"
-                        "movq     8(%2,%0,4), %%mm2 \n"
-                        "movq          %%mm1, %%mm3 \n"
-                        "movq          %%mm2, %%mm4 \n"
-                        "psubw          (%2), %%mm1 \n"
-                        "psubw         8(%2), %%mm2 \n"
-                        "psubw       160(%2), %%mm3 \n"
-                        "psubw       168(%2), %%mm4 \n"
-                        "packsswb      %%mm2, %%mm1 \n"
-                        "packsswb      %%mm4, %%mm3 \n"
-                        "paddb         %%mm6, %%mm1 \n"
-                        "paddb         %%mm6, %%mm3 \n"
-                        "psubusb       %%mm5, %%mm1 \n" // abs(mv[b] - mv[bn]) >= limit
-                        "psubusb       %%mm5, %%mm3 \n"
-                        "packsswb      %%mm3, %%mm1 \n"
-                        "add $40, %0 \n"
-                        "cmp $40, %0 \n"
-                        "jl 1b \n"
-                        "sub $80, %0 \n"
-                        "pshufw $0x4E, %%mm1, %%mm1 \n"
-                        "por           %%mm1, %%mm0 \n"
-                        "pshufw $0x4E, %%mm0, %%mm1 \n"
-                        "pminub        %%mm1, %%mm0 \n"
-                        ::"r"(d_idx),
-                          "r"(ref[0]+b_idx),
-                          "r"(mv[0]+b_idx)
-                    );
-                } else {
-                    __asm__ volatile(
-                        "movd        (%1), %%mm0 \n"
-                        "psubb    (%1,%0), %%mm0 \n" // ref[b] != ref[bn]
-                        "movq        (%2), %%mm1 \n"
-                        "movq       8(%2), %%mm2 \n"
-                        "psubw  (%2,%0,4), %%mm1 \n"
-                        "psubw 8(%2,%0,4), %%mm2 \n"
-                        "packsswb   %%mm2, %%mm1 \n"
-                        "paddb      %%mm6, %%mm1 \n"
-                        "psubusb    %%mm5, %%mm1 \n" // abs(mv[b] - mv[bn]) >= limit
-                        "packsswb   %%mm1, %%mm1 \n"
-                        "por        %%mm1, %%mm0 \n"
-                        ::"r"(d_idx),
-                          "r"(ref[0]+b_idx),
-                          "r"(mv[0]+b_idx)
-                    );
-                }
-            }
-            __asm__ volatile(
-                "movd %0, %%mm1 \n"
-                "por  %1, %%mm1 \n" // nnz[b] || nnz[bn]
-                ::"m"(nnz[b_idx]),
-                  "m"(nnz[b_idx+d_idx])
-            );
-            __asm__ volatile(
-                "pminub    %%mm7, %%mm1 \n"
-                "pminub    %%mm7, %%mm0 \n"
-                "psllw        $1, %%mm1 \n"
-                "pxor      %%mm2, %%mm2 \n"
-                "pmaxub    %%mm0, %%mm1 \n"
-                "punpcklbw %%mm2, %%mm1 \n"
-                "movq      %%mm1, %0    \n"
-                :"=m"(*bS[dir][edge])
-                ::"memory"
-            );
-        }
-        edges = 4;
-        step = 1;
-    }
-    __asm__ volatile(
-        "movq   (%0), %%mm0 \n\t"
-        "movq  8(%0), %%mm1 \n\t"
-        "movq 16(%0), %%mm2 \n\t"
-        "movq 24(%0), %%mm3 \n\t"
-        TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4)
-        "movq %%mm0,   (%0) \n\t"
-        "movq %%mm3,  8(%0) \n\t"
-        "movq %%mm4, 16(%0) \n\t"
-        "movq %%mm2, 24(%0) \n\t"
-        ::"r"(bS[0])
-        :"memory"
-    );
-}
-
-/***********************************/
-/* motion compensation */
-
-#define QPEL_H264V_MM(A,B,C,D,E,F,OP,T,Z,d,q)\
-        "mov"#q" "#C", "#T"         \n\t"\
-        "mov"#d" (%0), "#F"         \n\t"\
-        "paddw "#D", "#T"           \n\t"\
-        "psllw $2, "#T"             \n\t"\
-        "psubw "#B", "#T"           \n\t"\
-        "psubw "#E", "#T"           \n\t"\
-        "punpcklbw "#Z", "#F"       \n\t"\
-        "pmullw %4, "#T"            \n\t"\
-        "paddw %5, "#A"             \n\t"\
-        "add %2, %0                 \n\t"\
-        "paddw "#F", "#A"           \n\t"\
-        "paddw "#A", "#T"           \n\t"\
-        "psraw $5, "#T"             \n\t"\
-        "packuswb "#T", "#T"        \n\t"\
-        OP(T, (%1), A, d)\
-        "add %3, %1                 \n\t"
-
-#define QPEL_H264HV_MM(A,B,C,D,E,F,OF,T,Z,d,q)\
-        "mov"#q" "#C", "#T"         \n\t"\
-        "mov"#d" (%0), "#F"         \n\t"\
-        "paddw "#D", "#T"           \n\t"\
-        "psllw $2, "#T"             \n\t"\
-        "paddw %4, "#A"             \n\t"\
-        "psubw "#B", "#T"           \n\t"\
-        "psubw "#E", "#T"           \n\t"\
-        "punpcklbw "#Z", "#F"       \n\t"\
-        "pmullw %3, "#T"            \n\t"\
-        "paddw "#F", "#A"           \n\t"\
-        "add %2, %0                 \n\t"\
-        "paddw "#A", "#T"           \n\t"\
-        "mov"#q" "#T", "#OF"(%1)    \n\t"
-
-#define QPEL_H264V(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%mm6,%%mm7,d,q)
-#define QPEL_H264HV(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%mm6,%%mm7,d,q)
-#define QPEL_H264V_XMM(A,B,C,D,E,F,OP) QPEL_H264V_MM(A,B,C,D,E,F,OP,%%xmm6,%%xmm7,q,dqa)
-#define QPEL_H264HV_XMM(A,B,C,D,E,F,OF) QPEL_H264HV_MM(A,B,C,D,E,F,OF,%%xmm6,%%xmm7,q,dqa)
-
-
-#define QPEL_H264(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel4_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    int h=4;\
-\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movq "MANGLE(ff_pw_5) ", %%mm4\n\t"\
-        "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\
-        "1:                         \n\t"\
-        "movd  -1(%0), %%mm1        \n\t"\
-        "movd    (%0), %%mm2        \n\t"\
-        "movd   1(%0), %%mm3        \n\t"\
-        "movd   2(%0), %%mm0        \n\t"\
-        "punpcklbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpcklbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "paddw %%mm0, %%mm1         \n\t"\
-        "paddw %%mm3, %%mm2         \n\t"\
-        "movd  -2(%0), %%mm0        \n\t"\
-        "movd   3(%0), %%mm3        \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpcklbw %%mm7, %%mm3     \n\t"\
-        "paddw %%mm3, %%mm0         \n\t"\
-        "psllw $2, %%mm2            \n\t"\
-        "psubw %%mm1, %%mm2         \n\t"\
-        "pmullw %%mm4, %%mm2        \n\t"\
-        "paddw %%mm5, %%mm0         \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "psraw $5, %%mm0            \n\t"\
-        "packuswb %%mm0, %%mm0      \n\t"\
-        OP(%%mm0, (%1),%%mm6, d)\
-        "add %3, %0                 \n\t"\
-        "add %4, %1                 \n\t"\
-        "decl %2                    \n\t"\
-        " jnz 1b                    \n\t"\
-        : "+a"(src), "+c"(dst), "+g"(h)\
-        : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
-        : "memory"\
-    );\
-}\
-static av_noinline void OPNAME ## h264_qpel4_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
-    int h=4;\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movq %0, %%mm4             \n\t"\
-        "movq %1, %%mm5             \n\t"\
-        :: "m"(ff_pw_5), "m"(ff_pw_16)\
-    );\
-    do{\
-    __asm__ volatile(\
-        "movd  -1(%0), %%mm1        \n\t"\
-        "movd    (%0), %%mm2        \n\t"\
-        "movd   1(%0), %%mm3        \n\t"\
-        "movd   2(%0), %%mm0        \n\t"\
-        "punpcklbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpcklbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "paddw %%mm0, %%mm1         \n\t"\
-        "paddw %%mm3, %%mm2         \n\t"\
-        "movd  -2(%0), %%mm0        \n\t"\
-        "movd   3(%0), %%mm3        \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpcklbw %%mm7, %%mm3     \n\t"\
-        "paddw %%mm3, %%mm0         \n\t"\
-        "psllw $2, %%mm2            \n\t"\
-        "psubw %%mm1, %%mm2         \n\t"\
-        "pmullw %%mm4, %%mm2        \n\t"\
-        "paddw %%mm5, %%mm0         \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "movd   (%2), %%mm3         \n\t"\
-        "psraw $5, %%mm0            \n\t"\
-        "packuswb %%mm0, %%mm0      \n\t"\
-        PAVGB" %%mm3, %%mm0         \n\t"\
-        OP(%%mm0, (%1),%%mm6, d)\
-        "add %4, %0                 \n\t"\
-        "add %4, %1                 \n\t"\
-        "add %3, %2                 \n\t"\
-        : "+a"(src), "+c"(dst), "+d"(src2)\
-        : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride)\
-        : "memory"\
-    );\
-    }while(--h);\
-}\
-static av_noinline void OPNAME ## h264_qpel4_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    src -= 2*srcStride;\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movd (%0), %%mm0           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm1           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm2           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm3           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm4           \n\t"\
-        "add %2, %0                 \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpcklbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpcklbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm4     \n\t"\
-        QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
-        QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
-        QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
-        QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
-         \
-        : "+a"(src), "+c"(dst)\
-        : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-        : "memory"\
-    );\
-}\
-static av_noinline void OPNAME ## h264_qpel4_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    int h=4;\
-    int w=3;\
-    src -= 2*srcStride+2;\
-    while(w--){\
-        __asm__ volatile(\
-            "pxor %%mm7, %%mm7      \n\t"\
-            "movd (%0), %%mm0       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm1       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm2       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm3       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm4       \n\t"\
-            "add %2, %0             \n\t"\
-            "punpcklbw %%mm7, %%mm0 \n\t"\
-            "punpcklbw %%mm7, %%mm1 \n\t"\
-            "punpcklbw %%mm7, %%mm2 \n\t"\
-            "punpcklbw %%mm7, %%mm3 \n\t"\
-            "punpcklbw %%mm7, %%mm4 \n\t"\
-            QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*8*3)\
-            QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*8*3)\
-            QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*8*3)\
-            QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*8*3)\
-             \
-            : "+a"(src)\
-            : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-            : "memory"\
-        );\
-        tmp += 4;\
-        src += 4 - 9*srcStride;\
-    }\
-    tmp -= 3*4;\
-    __asm__ volatile(\
-        "1:                         \n\t"\
-        "movq     (%0), %%mm0       \n\t"\
-        "paddw  10(%0), %%mm0       \n\t"\
-        "movq    2(%0), %%mm1       \n\t"\
-        "paddw   8(%0), %%mm1       \n\t"\
-        "movq    4(%0), %%mm2       \n\t"\
-        "paddw   6(%0), %%mm2       \n\t"\
-        "psubw %%mm1, %%mm0         \n\t"/*a-b   (abccba)*/\
-        "psraw $2, %%mm0            \n\t"/*(a-b)/4 */\
-        "psubw %%mm1, %%mm0         \n\t"/*(a-b)/4-b */\
-        "paddsw %%mm2, %%mm0        \n\t"\
-        "psraw $2, %%mm0            \n\t"/*((a-b)/4-b+c)/4 */\
-        "paddw %%mm2, %%mm0         \n\t"/*(a-5*b+20*c)/16 */\
-        "psraw $6, %%mm0            \n\t"\
-        "packuswb %%mm0, %%mm0      \n\t"\
-        OP(%%mm0, (%1),%%mm7, d)\
-        "add $24, %0                \n\t"\
-        "add %3, %1                 \n\t"\
-        "decl %2                    \n\t"\
-        " jnz 1b                    \n\t"\
-        : "+a"(tmp), "+c"(dst), "+g"(h)\
-        : "S"((x86_reg)dstStride)\
-        : "memory"\
-    );\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    int h=8;\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\
-        "1:                         \n\t"\
-        "movq    (%0), %%mm0        \n\t"\
-        "movq   1(%0), %%mm2        \n\t"\
-        "movq %%mm0, %%mm1          \n\t"\
-        "movq %%mm2, %%mm3          \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpckhbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpckhbw %%mm7, %%mm3     \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "paddw %%mm3, %%mm1         \n\t"\
-        "psllw $2, %%mm0            \n\t"\
-        "psllw $2, %%mm1            \n\t"\
-        "movq   -1(%0), %%mm2       \n\t"\
-        "movq    2(%0), %%mm4       \n\t"\
-        "movq %%mm2, %%mm3          \n\t"\
-        "movq %%mm4, %%mm5          \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpckhbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm4     \n\t"\
-        "punpckhbw %%mm7, %%mm5     \n\t"\
-        "paddw %%mm4, %%mm2         \n\t"\
-        "paddw %%mm3, %%mm5         \n\t"\
-        "psubw %%mm2, %%mm0         \n\t"\
-        "psubw %%mm5, %%mm1         \n\t"\
-        "pmullw %%mm6, %%mm0        \n\t"\
-        "pmullw %%mm6, %%mm1        \n\t"\
-        "movd   -2(%0), %%mm2       \n\t"\
-        "movd    7(%0), %%mm5       \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpcklbw %%mm7, %%mm5     \n\t"\
-        "paddw %%mm3, %%mm2         \n\t"\
-        "paddw %%mm5, %%mm4         \n\t"\
-        "movq "MANGLE(ff_pw_16)", %%mm5\n\t"\
-        "paddw %%mm5, %%mm2         \n\t"\
-        "paddw %%mm5, %%mm4         \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "paddw %%mm4, %%mm1         \n\t"\
-        "psraw $5, %%mm0            \n\t"\
-        "psraw $5, %%mm1            \n\t"\
-        "packuswb %%mm1, %%mm0      \n\t"\
-        OP(%%mm0, (%1),%%mm5, q)\
-        "add %3, %0                 \n\t"\
-        "add %4, %1                 \n\t"\
-        "decl %2                    \n\t"\
-        " jnz 1b                    \n\t"\
-        : "+a"(src), "+c"(dst), "+g"(h)\
-        : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
-        : "memory"\
-    );\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
-    int h=8;\
-    __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movq %0, %%mm6             \n\t"\
-        :: "m"(ff_pw_5)\
-    );\
-    do{\
-    __asm__ volatile(\
-        "movq    (%0), %%mm0        \n\t"\
-        "movq   1(%0), %%mm2        \n\t"\
-        "movq %%mm0, %%mm1          \n\t"\
-        "movq %%mm2, %%mm3          \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpckhbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpckhbw %%mm7, %%mm3     \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "paddw %%mm3, %%mm1         \n\t"\
-        "psllw $2, %%mm0            \n\t"\
-        "psllw $2, %%mm1            \n\t"\
-        "movq   -1(%0), %%mm2       \n\t"\
-        "movq    2(%0), %%mm4       \n\t"\
-        "movq %%mm2, %%mm3          \n\t"\
-        "movq %%mm4, %%mm5          \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpckhbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm4     \n\t"\
-        "punpckhbw %%mm7, %%mm5     \n\t"\
-        "paddw %%mm4, %%mm2         \n\t"\
-        "paddw %%mm3, %%mm5         \n\t"\
-        "psubw %%mm2, %%mm0         \n\t"\
-        "psubw %%mm5, %%mm1         \n\t"\
-        "pmullw %%mm6, %%mm0        \n\t"\
-        "pmullw %%mm6, %%mm1        \n\t"\
-        "movd   -2(%0), %%mm2       \n\t"\
-        "movd    7(%0), %%mm5       \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpcklbw %%mm7, %%mm5     \n\t"\
-        "paddw %%mm3, %%mm2         \n\t"\
-        "paddw %%mm5, %%mm4         \n\t"\
-        "movq %5, %%mm5             \n\t"\
-        "paddw %%mm5, %%mm2         \n\t"\
-        "paddw %%mm5, %%mm4         \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "paddw %%mm4, %%mm1         \n\t"\
-        "psraw $5, %%mm0            \n\t"\
-        "psraw $5, %%mm1            \n\t"\
-        "movq (%2), %%mm4           \n\t"\
-        "packuswb %%mm1, %%mm0      \n\t"\
-        PAVGB" %%mm4, %%mm0         \n\t"\
-        OP(%%mm0, (%1),%%mm5, q)\
-        "add %4, %0                 \n\t"\
-        "add %4, %1                 \n\t"\
-        "add %3, %2                 \n\t"\
-        : "+a"(src), "+c"(dst), "+d"(src2)\
-        : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\
-          "m"(ff_pw_16)\
-        : "memory"\
-    );\
-    }while(--h);\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    int w= 2;\
-    src -= 2*srcStride;\
-    \
-    while(w--){\
-      __asm__ volatile(\
-        "pxor %%mm7, %%mm7          \n\t"\
-        "movd (%0), %%mm0           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm1           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm2           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm3           \n\t"\
-        "add %2, %0                 \n\t"\
-        "movd (%0), %%mm4           \n\t"\
-        "add %2, %0                 \n\t"\
-        "punpcklbw %%mm7, %%mm0     \n\t"\
-        "punpcklbw %%mm7, %%mm1     \n\t"\
-        "punpcklbw %%mm7, %%mm2     \n\t"\
-        "punpcklbw %%mm7, %%mm3     \n\t"\
-        "punpcklbw %%mm7, %%mm4     \n\t"\
-        QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
-        QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
-        QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
-        QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
-        QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
-        QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
-        QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
-        QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
-         \
-        : "+a"(src), "+c"(dst)\
-        : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-        : "memory"\
-     );\
-     if(h==16){\
-        __asm__ volatile(\
-            QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
-            QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
-            QPEL_H264V(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP)\
-            QPEL_H264V(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP)\
-            QPEL_H264V(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP)\
-            QPEL_H264V(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP)\
-            QPEL_H264V(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP)\
-            QPEL_H264V(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP)\
-            \
-           : "+a"(src), "+c"(dst)\
-           : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-           : "memory"\
-        );\
-     }\
-     src += 4-(h+5)*srcStride;\
-     dst += 4-h*dstStride;\
-   }\
-}\
-static av_always_inline void OPNAME ## h264_qpel8or16_hv1_lowpass_ ## MMX(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){\
-    int w = (size+8)>>2;\
-    src -= 2*srcStride+2;\
-    while(w--){\
-        __asm__ volatile(\
-            "pxor %%mm7, %%mm7      \n\t"\
-            "movd (%0), %%mm0       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm1       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm2       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm3       \n\t"\
-            "add %2, %0             \n\t"\
-            "movd (%0), %%mm4       \n\t"\
-            "add %2, %0             \n\t"\
-            "punpcklbw %%mm7, %%mm0 \n\t"\
-            "punpcklbw %%mm7, %%mm1 \n\t"\
-            "punpcklbw %%mm7, %%mm2 \n\t"\
-            "punpcklbw %%mm7, %%mm3 \n\t"\
-            "punpcklbw %%mm7, %%mm4 \n\t"\
-            QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 0*48)\
-            QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 1*48)\
-            QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 2*48)\
-            QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 3*48)\
-            QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 4*48)\
-            QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 5*48)\
-            QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 6*48)\
-            QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 7*48)\
-            : "+a"(src)\
-            : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-            : "memory"\
-        );\
-        if(size==16){\
-            __asm__ volatile(\
-                QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1,  8*48)\
-                QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2,  9*48)\
-                QPEL_H264HV(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, 10*48)\
-                QPEL_H264HV(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, 11*48)\
-                QPEL_H264HV(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, 12*48)\
-                QPEL_H264HV(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, 13*48)\
-                QPEL_H264HV(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, 14*48)\
-                QPEL_H264HV(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, 15*48)\
-                : "+a"(src)\
-                : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-                : "memory"\
-            );\
-        }\
-        tmp += 4;\
-        src += 4 - (size+5)*srcStride;\
-    }\
-}\
-static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\
-    int w = size>>4;\
-    do{\
-    int h = size;\
-    __asm__ volatile(\
-        "1:                         \n\t"\
-        "movq     (%0), %%mm0       \n\t"\
-        "movq    8(%0), %%mm3       \n\t"\
-        "movq    2(%0), %%mm1       \n\t"\
-        "movq   10(%0), %%mm4       \n\t"\
-        "paddw   %%mm4, %%mm0       \n\t"\
-        "paddw   %%mm3, %%mm1       \n\t"\
-        "paddw  18(%0), %%mm3       \n\t"\
-        "paddw  16(%0), %%mm4       \n\t"\
-        "movq    4(%0), %%mm2       \n\t"\
-        "movq   12(%0), %%mm5       \n\t"\
-        "paddw   6(%0), %%mm2       \n\t"\
-        "paddw  14(%0), %%mm5       \n\t"\
-        "psubw %%mm1, %%mm0         \n\t"\
-        "psubw %%mm4, %%mm3         \n\t"\
-        "psraw $2, %%mm0            \n\t"\
-        "psraw $2, %%mm3            \n\t"\
-        "psubw %%mm1, %%mm0         \n\t"\
-        "psubw %%mm4, %%mm3         \n\t"\
-        "paddsw %%mm2, %%mm0        \n\t"\
-        "paddsw %%mm5, %%mm3        \n\t"\
-        "psraw $2, %%mm0            \n\t"\
-        "psraw $2, %%mm3            \n\t"\
-        "paddw %%mm2, %%mm0         \n\t"\
-        "paddw %%mm5, %%mm3         \n\t"\
-        "psraw $6, %%mm0            \n\t"\
-        "psraw $6, %%mm3            \n\t"\
-        "packuswb %%mm3, %%mm0      \n\t"\
-        OP(%%mm0, (%1),%%mm7, q)\
-        "add $48, %0                \n\t"\
-        "add %3, %1                 \n\t"\
-        "decl %2                    \n\t"\
-        " jnz 1b                    \n\t"\
-        : "+a"(tmp), "+c"(dst), "+g"(h)\
-        : "S"((x86_reg)dstStride)\
-        : "memory"\
-    );\
-    tmp += 8 - size*24;\
-    dst += 8 - size*dstStride;\
-    }while(w--);\
-}\
-\
-static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst  , src  , dstStride, srcStride, 8);\
-}\
-static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst  , src  , dstStride, srcStride, 16);\
-    OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}\
-\
-static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst  , src  , src2  , dstStride, src2Stride);\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
-    src += 8*dstStride;\
-    dst += 8*dstStride;\
-    src2 += 8*src2Stride;\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst  , src  , src2  , dstStride, src2Stride);\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
-}\
-\
-static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
-          put_h264_qpel8or16_hv1_lowpass_ ## MMX(tmp, src, tmpStride, srcStride, size);\
-    OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
-}\
-static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst  , tmp  , src  , dstStride, tmpStride, srcStride, 8);\
-}\
-\
-static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst  , tmp  , src  , dstStride, tmpStride, srcStride, 16);\
-}\
-\
-static av_noinline void OPNAME ## pixels4_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
-{\
-    __asm__ volatile(\
-        "movq      (%1), %%mm0          \n\t"\
-        "movq    24(%1), %%mm1          \n\t"\
-        "psraw      $5,  %%mm0          \n\t"\
-        "psraw      $5,  %%mm1          \n\t"\
-        "packuswb %%mm0, %%mm0          \n\t"\
-        "packuswb %%mm1, %%mm1          \n\t"\
-        PAVGB"     (%0), %%mm0          \n\t"\
-        PAVGB"  (%0,%3), %%mm1          \n\t"\
-        OP(%%mm0, (%2),    %%mm4, d)\
-        OP(%%mm1, (%2,%4), %%mm5, d)\
-        "lea  (%0,%3,2), %0             \n\t"\
-        "lea  (%2,%4,2), %2             \n\t"\
-        "movq    48(%1), %%mm0          \n\t"\
-        "movq    72(%1), %%mm1          \n\t"\
-        "psraw      $5,  %%mm0          \n\t"\
-        "psraw      $5,  %%mm1          \n\t"\
-        "packuswb %%mm0, %%mm0          \n\t"\
-        "packuswb %%mm1, %%mm1          \n\t"\
-        PAVGB"     (%0), %%mm0          \n\t"\
-        PAVGB"  (%0,%3), %%mm1          \n\t"\
-        OP(%%mm0, (%2),    %%mm4, d)\
-        OP(%%mm1, (%2,%4), %%mm5, d)\
-        :"+a"(src8), "+c"(src16), "+d"(dst)\
-        :"S"((x86_reg)src8Stride), "D"((x86_reg)dstStride)\
-        :"memory");\
-}\
-static av_noinline void OPNAME ## pixels8_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
-{\
-    do{\
-    __asm__ volatile(\
-        "movq      (%1), %%mm0          \n\t"\
-        "movq     8(%1), %%mm1          \n\t"\
-        "movq    48(%1), %%mm2          \n\t"\
-        "movq  8+48(%1), %%mm3          \n\t"\
-        "psraw      $5,  %%mm0          \n\t"\
-        "psraw      $5,  %%mm1          \n\t"\
-        "psraw      $5,  %%mm2          \n\t"\
-        "psraw      $5,  %%mm3          \n\t"\
-        "packuswb %%mm1, %%mm0          \n\t"\
-        "packuswb %%mm3, %%mm2          \n\t"\
-        PAVGB"     (%0), %%mm0          \n\t"\
-        PAVGB"  (%0,%3), %%mm2          \n\t"\
-        OP(%%mm0, (%2), %%mm5, q)\
-        OP(%%mm2, (%2,%4), %%mm5, q)\
-        ::"a"(src8), "c"(src16), "d"(dst),\
-          "r"((x86_reg)src8Stride), "r"((x86_reg)dstStride)\
-        :"memory");\
-        src8 += 2L*src8Stride;\
-        src16 += 48;\
-        dst += 2L*dstStride;\
-    }while(h-=2);\
-}\
-static void OPNAME ## pixels16_l2_shift5_ ## MMX(uint8_t *dst, int16_t *src16, uint8_t *src8, int dstStride, int src8Stride, int h)\
-{\
-    OPNAME ## pixels8_l2_shift5_ ## MMX(dst  , src16  , src8  , dstStride, src8Stride, h);\
-    OPNAME ## pixels8_l2_shift5_ ## MMX(dst+8, src16+8, src8+8, dstStride, src8Stride, h);\
-}\
-
-
-#if ARCH_X86_64
-#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
-    int h=16;\
-    __asm__ volatile(\
-        "pxor %%xmm15, %%xmm15      \n\t"\
-        "movdqa %6, %%xmm14         \n\t"\
-        "movdqa %7, %%xmm13         \n\t"\
-        "1:                         \n\t"\
-        "lddqu    6(%0), %%xmm1     \n\t"\
-        "lddqu   -2(%0), %%xmm7     \n\t"\
-        "movdqa  %%xmm1, %%xmm0     \n\t"\
-        "punpckhbw %%xmm15, %%xmm1  \n\t"\
-        "punpcklbw %%xmm15, %%xmm0  \n\t"\
-        "punpcklbw %%xmm15, %%xmm7  \n\t"\
-        "movdqa  %%xmm1, %%xmm2     \n\t"\
-        "movdqa  %%xmm0, %%xmm6     \n\t"\
-        "movdqa  %%xmm1, %%xmm3     \n\t"\
-        "movdqa  %%xmm0, %%xmm8     \n\t"\
-        "movdqa  %%xmm1, %%xmm4     \n\t"\
-        "movdqa  %%xmm0, %%xmm9     \n\t"\
-        "movdqa  %%xmm0, %%xmm12    \n\t"\
-        "movdqa  %%xmm1, %%xmm11    \n\t"\
-        "palignr $10,%%xmm0, %%xmm11\n\t"\
-        "palignr $10,%%xmm7, %%xmm12\n\t"\
-        "palignr $2, %%xmm0, %%xmm4 \n\t"\
-        "palignr $2, %%xmm7, %%xmm9 \n\t"\
-        "palignr $4, %%xmm0, %%xmm3 \n\t"\
-        "palignr $4, %%xmm7, %%xmm8 \n\t"\
-        "palignr $6, %%xmm0, %%xmm2 \n\t"\
-        "palignr $6, %%xmm7, %%xmm6 \n\t"\
-        "paddw   %%xmm0 ,%%xmm11    \n\t"\
-        "palignr $8, %%xmm0, %%xmm1 \n\t"\
-        "palignr $8, %%xmm7, %%xmm0 \n\t"\
-        "paddw   %%xmm12,%%xmm7     \n\t"\
-        "paddw   %%xmm3, %%xmm2     \n\t"\
-        "paddw   %%xmm8, %%xmm6     \n\t"\
-        "paddw   %%xmm4, %%xmm1     \n\t"\
-        "paddw   %%xmm9, %%xmm0     \n\t"\
-        "psllw   $2,     %%xmm2     \n\t"\
-        "psllw   $2,     %%xmm6     \n\t"\
-        "psubw   %%xmm1, %%xmm2     \n\t"\
-        "psubw   %%xmm0, %%xmm6     \n\t"\
-        "paddw   %%xmm13,%%xmm11    \n\t"\
-        "paddw   %%xmm13,%%xmm7     \n\t"\
-        "pmullw  %%xmm14,%%xmm2     \n\t"\
-        "pmullw  %%xmm14,%%xmm6     \n\t"\
-        "lddqu   (%2),   %%xmm3     \n\t"\
-        "paddw   %%xmm11,%%xmm2     \n\t"\
-        "paddw   %%xmm7, %%xmm6     \n\t"\
-        "psraw   $5,     %%xmm2     \n\t"\
-        "psraw   $5,     %%xmm6     \n\t"\
-        "packuswb %%xmm2,%%xmm6     \n\t"\
-        "pavgb   %%xmm3, %%xmm6     \n\t"\
-        OP(%%xmm6, (%1), %%xmm4, dqa)\
-        "add %5, %0                 \n\t"\
-        "add %5, %1                 \n\t"\
-        "add %4, %2                 \n\t"\
-        "decl %3                    \n\t"\
-        "jg 1b                      \n\t"\
-        : "+a"(src), "+c"(dst), "+d"(src2), "+g"(h)\
-        : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\
-          "m"(ff_pw_5), "m"(ff_pw_16)\
-        : "memory"\
-    );\
-}
-#else // ARCH_X86_64
-#define QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel16_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst  , src  , src2  , dstStride, src2Stride);\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
-    src += 8*dstStride;\
-    dst += 8*dstStride;\
-    src2 += 8*src2Stride;\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst  , src  , src2  , dstStride, src2Stride);\
-    OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(dst+8, src+8, src2+8, dstStride, src2Stride);\
-}
-#endif // ARCH_X86_64
-
-#define QPEL_H264_H_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_l2_ ## MMX(uint8_t *dst, uint8_t *src, uint8_t *src2, int dstStride, int src2Stride){\
-    int h=8;\
-    __asm__ volatile(\
-        "pxor %%xmm7, %%xmm7        \n\t"\
-        "movdqa %0, %%xmm6          \n\t"\
-        :: "m"(ff_pw_5)\
-    );\
-    do{\
-    __asm__ volatile(\
-        "lddqu   -2(%0), %%xmm1     \n\t"\
-        "movdqa  %%xmm1, %%xmm0     \n\t"\
-        "punpckhbw %%xmm7, %%xmm1   \n\t"\
-        "punpcklbw %%xmm7, %%xmm0   \n\t"\
-        "movdqa  %%xmm1, %%xmm2     \n\t"\
-        "movdqa  %%xmm1, %%xmm3     \n\t"\
-        "movdqa  %%xmm1, %%xmm4     \n\t"\
-        "movdqa  %%xmm1, %%xmm5     \n\t"\
-        "palignr $2, %%xmm0, %%xmm4 \n\t"\
-        "palignr $4, %%xmm0, %%xmm3 \n\t"\
-        "palignr $6, %%xmm0, %%xmm2 \n\t"\
-        "palignr $8, %%xmm0, %%xmm1 \n\t"\
-        "palignr $10,%%xmm0, %%xmm5 \n\t"\
-        "paddw   %%xmm5, %%xmm0     \n\t"\
-        "paddw   %%xmm3, %%xmm2     \n\t"\
-        "paddw   %%xmm4, %%xmm1     \n\t"\
-        "psllw   $2,     %%xmm2     \n\t"\
-        "movq    (%2),   %%xmm3     \n\t"\
-        "psubw   %%xmm1, %%xmm2     \n\t"\
-        "paddw   %5,     %%xmm0     \n\t"\
-        "pmullw  %%xmm6, %%xmm2     \n\t"\
-        "paddw   %%xmm0, %%xmm2     \n\t"\
-        "psraw   $5,     %%xmm2     \n\t"\
-        "packuswb %%xmm2, %%xmm2    \n\t"\
-        "pavgb   %%xmm3, %%xmm2     \n\t"\
-        OP(%%xmm2, (%1), %%xmm4, q)\
-        "add %4, %0                 \n\t"\
-        "add %4, %1                 \n\t"\
-        "add %3, %2                 \n\t"\
-        : "+a"(src), "+c"(dst), "+d"(src2)\
-        : "D"((x86_reg)src2Stride), "S"((x86_reg)dstStride),\
-          "m"(ff_pw_16)\
-        : "memory"\
-    );\
-    }while(--h);\
-}\
-QPEL_H264_H16_XMM(OPNAME, OP, MMX)\
-\
-static av_noinline void OPNAME ## h264_qpel8_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    int h=8;\
-    __asm__ volatile(\
-        "pxor %%xmm7, %%xmm7        \n\t"\
-        "movdqa "MANGLE(ff_pw_5)", %%xmm6\n\t"\
-        "1:                         \n\t"\
-        "lddqu   -2(%0), %%xmm1     \n\t"\
-        "movdqa  %%xmm1, %%xmm0     \n\t"\
-        "punpckhbw %%xmm7, %%xmm1   \n\t"\
-        "punpcklbw %%xmm7, %%xmm0   \n\t"\
-        "movdqa  %%xmm1, %%xmm2     \n\t"\
-        "movdqa  %%xmm1, %%xmm3     \n\t"\
-        "movdqa  %%xmm1, %%xmm4     \n\t"\
-        "movdqa  %%xmm1, %%xmm5     \n\t"\
-        "palignr $2, %%xmm0, %%xmm4 \n\t"\
-        "palignr $4, %%xmm0, %%xmm3 \n\t"\
-        "palignr $6, %%xmm0, %%xmm2 \n\t"\
-        "palignr $8, %%xmm0, %%xmm1 \n\t"\
-        "palignr $10,%%xmm0, %%xmm5 \n\t"\
-        "paddw   %%xmm5, %%xmm0     \n\t"\
-        "paddw   %%xmm3, %%xmm2     \n\t"\
-        "paddw   %%xmm4, %%xmm1     \n\t"\
-        "psllw   $2,     %%xmm2     \n\t"\
-        "psubw   %%xmm1, %%xmm2     \n\t"\
-        "paddw   "MANGLE(ff_pw_16)", %%xmm0\n\t"\
-        "pmullw  %%xmm6, %%xmm2     \n\t"\
-        "paddw   %%xmm0, %%xmm2     \n\t"\
-        "psraw   $5,     %%xmm2     \n\t"\
-        "packuswb %%xmm2, %%xmm2    \n\t"\
-        OP(%%xmm2, (%1), %%xmm4, q)\
-        "add %3, %0                 \n\t"\
-        "add %4, %1                 \n\t"\
-        "decl %2                    \n\t"\
-        " jnz 1b                    \n\t"\
-        : "+a"(src), "+c"(dst), "+g"(h)\
-        : "D"((x86_reg)srcStride), "S"((x86_reg)dstStride)\
-        : "memory"\
-    );\
-}\
-static void OPNAME ## h264_qpel16_h_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-    src += 8*srcStride;\
-    dst += 8*dstStride;\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst  , src  , dstStride, srcStride);\
-    OPNAME ## h264_qpel8_h_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride);\
-}\
-
-#define QPEL_H264_V_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\
-    src -= 2*srcStride;\
-    \
-    __asm__ volatile(\
-        "pxor %%xmm7, %%xmm7        \n\t"\
-        "movq (%0), %%xmm0          \n\t"\
-        "add %2, %0                 \n\t"\
-        "movq (%0), %%xmm1          \n\t"\
-        "add %2, %0                 \n\t"\
-        "movq (%0), %%xmm2          \n\t"\
-        "add %2, %0                 \n\t"\
-        "movq (%0), %%xmm3          \n\t"\
-        "add %2, %0                 \n\t"\
-        "movq (%0), %%xmm4          \n\t"\
-        "add %2, %0                 \n\t"\
-        "punpcklbw %%xmm7, %%xmm0   \n\t"\
-        "punpcklbw %%xmm7, %%xmm1   \n\t"\
-        "punpcklbw %%xmm7, %%xmm2   \n\t"\
-        "punpcklbw %%xmm7, %%xmm3   \n\t"\
-        "punpcklbw %%xmm7, %%xmm4   \n\t"\
-        QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
-        QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
-        QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
-        QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
-        QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\
-        QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\
-        QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
-        QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
-         \
-        : "+a"(src), "+c"(dst)\
-        : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-        : "memory"\
-    );\
-    if(h==16){\
-        __asm__ volatile(\
-            QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
-            QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
-            QPEL_H264V_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, OP)\
-            QPEL_H264V_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, OP)\
-            QPEL_H264V_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, OP)\
-            QPEL_H264V_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, OP)\
-            QPEL_H264V_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, OP)\
-            QPEL_H264V_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, OP)\
-            \
-            : "+a"(src), "+c"(dst)\
-            : "S"((x86_reg)srcStride), "D"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_16)\
-            : "memory"\
-        );\
-    }\
-}\
-static void OPNAME ## h264_qpel8_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst  , src  , dstStride, srcStride, 8);\
-}\
-static av_noinline void OPNAME ## h264_qpel16_v_lowpass_ ## MMX(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst  , src  , dstStride, srcStride, 16);\
-    OPNAME ## h264_qpel8or16_v_lowpass_ ## MMX(dst+8, src+8, dstStride, srcStride, 16);\
-}
-
-static av_always_inline void put_h264_qpel8or16_hv1_lowpass_sse2(int16_t *tmp, uint8_t *src, int tmpStride, int srcStride, int size){
-    int w = (size+8)>>3;
-    src -= 2*srcStride+2;
-    while(w--){
-        __asm__ volatile(
-            "pxor %%xmm7, %%xmm7        \n\t"
-            "movq (%0), %%xmm0          \n\t"
-            "add %2, %0                 \n\t"
-            "movq (%0), %%xmm1          \n\t"
-            "add %2, %0                 \n\t"
-            "movq (%0), %%xmm2          \n\t"
-            "add %2, %0                 \n\t"
-            "movq (%0), %%xmm3          \n\t"
-            "add %2, %0                 \n\t"
-            "movq (%0), %%xmm4          \n\t"
-            "add %2, %0                 \n\t"
-            "punpcklbw %%xmm7, %%xmm0   \n\t"
-            "punpcklbw %%xmm7, %%xmm1   \n\t"
-            "punpcklbw %%xmm7, %%xmm2   \n\t"
-            "punpcklbw %%xmm7, %%xmm3   \n\t"
-            "punpcklbw %%xmm7, %%xmm4   \n\t"
-            QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 0*48)
-            QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 1*48)
-            QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 2*48)
-            QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 3*48)
-            QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 4*48)
-            QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 5*48)
-            QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 6*48)
-            QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 7*48)
-            : "+a"(src)
-            : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)
-            : "memory"
-        );
-        if(size==16){
-            __asm__ volatile(
-                QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1,  8*48)
-                QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2,  9*48)
-                QPEL_H264HV_XMM(%%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, 10*48)
-                QPEL_H264HV_XMM(%%xmm5, %%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, 11*48)
-                QPEL_H264HV_XMM(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, 12*48)
-                QPEL_H264HV_XMM(%%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, 13*48)
-                QPEL_H264HV_XMM(%%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, 14*48)
-                QPEL_H264HV_XMM(%%xmm3, %%xmm4, %%xmm5, %%xmm0, %%xmm1, %%xmm2, 15*48)
-                : "+a"(src)
-                : "c"(tmp), "S"((x86_reg)srcStride), "m"(ff_pw_5), "m"(ff_pw_16)
-                : "memory"
-            );
-        }
-        tmp += 8;
-        src += 8 - (size+5)*srcStride;
-    }
-}
-
-#define QPEL_H264_HV2_XMM(OPNAME, OP, MMX)\
-static av_always_inline void OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, int dstStride, int tmpStride, int size){\
-    int h = size;\
-    if(size == 16){\
-        __asm__ volatile(\
-            "1:                         \n\t"\
-            "movdqa 32(%0), %%xmm4      \n\t"\
-            "movdqa 16(%0), %%xmm5      \n\t"\
-            "movdqa   (%0), %%xmm7      \n\t"\
-            "movdqa %%xmm4, %%xmm3      \n\t"\
-            "movdqa %%xmm4, %%xmm2      \n\t"\
-            "movdqa %%xmm4, %%xmm1      \n\t"\
-            "movdqa %%xmm4, %%xmm0      \n\t"\
-            "palignr $10, %%xmm5, %%xmm0 \n\t"\
-            "palignr  $8, %%xmm5, %%xmm1 \n\t"\
-            "palignr  $6, %%xmm5, %%xmm2 \n\t"\
-            "palignr  $4, %%xmm5, %%xmm3 \n\t"\
-            "palignr  $2, %%xmm5, %%xmm4 \n\t"\
-            "paddw  %%xmm5, %%xmm0      \n\t"\
-            "paddw  %%xmm4, %%xmm1      \n\t"\
-            "paddw  %%xmm3, %%xmm2      \n\t"\
-            "movdqa %%xmm5, %%xmm6      \n\t"\
-            "movdqa %%xmm5, %%xmm4      \n\t"\
-            "movdqa %%xmm5, %%xmm3      \n\t"\
-            "palignr  $8, %%xmm7, %%xmm4 \n\t"\
-            "palignr  $2, %%xmm7, %%xmm6 \n\t"\
-            "palignr $10, %%xmm7, %%xmm3 \n\t"\
-            "paddw  %%xmm6, %%xmm4      \n\t"\
-            "movdqa %%xmm5, %%xmm6      \n\t"\
-            "palignr  $6, %%xmm7, %%xmm5 \n\t"\
-            "palignr  $4, %%xmm7, %%xmm6 \n\t"\
-            "paddw  %%xmm7, %%xmm3      \n\t"\
-            "paddw  %%xmm6, %%xmm5      \n\t"\
-            \
-            "psubw  %%xmm1, %%xmm0      \n\t"\
-            "psubw  %%xmm4, %%xmm3      \n\t"\
-            "psraw      $2, %%xmm0      \n\t"\
-            "psraw      $2, %%xmm3      \n\t"\
-            "psubw  %%xmm1, %%xmm0      \n\t"\
-            "psubw  %%xmm4, %%xmm3      \n\t"\
-            "paddw  %%xmm2, %%xmm0      \n\t"\
-            "paddw  %%xmm5, %%xmm3      \n\t"\
-            "psraw      $2, %%xmm0      \n\t"\
-            "psraw      $2, %%xmm3      \n\t"\
-            "paddw  %%xmm2, %%xmm0      \n\t"\
-            "paddw  %%xmm5, %%xmm3      \n\t"\
-            "psraw      $6, %%xmm0      \n\t"\
-            "psraw      $6, %%xmm3      \n\t"\
-            "packuswb %%xmm0, %%xmm3    \n\t"\
-            OP(%%xmm3, (%1), %%xmm7, dqa)\
-            "add $48, %0                \n\t"\
-            "add %3, %1                 \n\t"\
-            "decl %2                    \n\t"\
-            " jnz 1b                    \n\t"\
-            : "+a"(tmp), "+c"(dst), "+g"(h)\
-            : "S"((x86_reg)dstStride)\
-            : "memory"\
-        );\
-    }else{\
-        __asm__ volatile(\
-            "1:                         \n\t"\
-            "movdqa 16(%0), %%xmm1      \n\t"\
-            "movdqa   (%0), %%xmm0      \n\t"\
-            "movdqa %%xmm1, %%xmm2      \n\t"\
-            "movdqa %%xmm1, %%xmm3      \n\t"\
-            "movdqa %%xmm1, %%xmm4      \n\t"\
-            "movdqa %%xmm1, %%xmm5      \n\t"\
-            "palignr $10, %%xmm0, %%xmm5 \n\t"\
-            "palignr  $8, %%xmm0, %%xmm4 \n\t"\
-            "palignr  $6, %%xmm0, %%xmm3 \n\t"\
-            "palignr  $4, %%xmm0, %%xmm2 \n\t"\
-            "palignr  $2, %%xmm0, %%xmm1 \n\t"\
-            "paddw  %%xmm5, %%xmm0      \n\t"\
-            "paddw  %%xmm4, %%xmm1      \n\t"\
-            "paddw  %%xmm3, %%xmm2      \n\t"\
-            "psubw  %%xmm1, %%xmm0      \n\t"\
-            "psraw      $2, %%xmm0      \n\t"\
-            "psubw  %%xmm1, %%xmm0      \n\t"\
-            "paddw  %%xmm2, %%xmm0      \n\t"\
-            "psraw      $2, %%xmm0      \n\t"\
-            "paddw  %%xmm2, %%xmm0      \n\t"\
-            "psraw      $6, %%xmm0      \n\t"\
-            "packuswb %%xmm0, %%xmm0    \n\t"\
-            OP(%%xmm0, (%1), %%xmm7, q)\
-            "add $48, %0                \n\t"\
-            "add %3, %1                 \n\t"\
-            "decl %2                    \n\t"\
-            " jnz 1b                    \n\t"\
-            : "+a"(tmp), "+c"(dst), "+g"(h)\
-            : "S"((x86_reg)dstStride)\
-            : "memory"\
-        );\
-    }\
-}
-
-#define QPEL_H264_HV_XMM(OPNAME, OP, MMX)\
-static av_noinline void OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride, int size){\
-          put_h264_qpel8or16_hv1_lowpass_sse2(tmp, src, tmpStride, srcStride, size);\
-    OPNAME ## h264_qpel8or16_hv2_lowpass_ ## MMX(dst, tmp, dstStride, tmpStride, size);\
-}\
-static void OPNAME ## h264_qpel8_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 8);\
-}\
-static void OPNAME ## h264_qpel16_hv_lowpass_ ## MMX(uint8_t *dst, int16_t *tmp, uint8_t *src, int dstStride, int tmpStride, int srcStride){\
-    OPNAME ## h264_qpel8or16_hv_lowpass_ ## MMX(dst, tmp, src, dstStride, tmpStride, srcStride, 16);\
-}\
-
-#define put_pixels8_l2_sse2 put_pixels8_l2_mmx2
-#define avg_pixels8_l2_sse2 avg_pixels8_l2_mmx2
-#define put_pixels16_l2_sse2 put_pixels16_l2_mmx2
-#define avg_pixels16_l2_sse2 avg_pixels16_l2_mmx2
-#define put_pixels8_l2_ssse3 put_pixels8_l2_mmx2
-#define avg_pixels8_l2_ssse3 avg_pixels8_l2_mmx2
-#define put_pixels16_l2_ssse3 put_pixels16_l2_mmx2
-#define avg_pixels16_l2_ssse3 avg_pixels16_l2_mmx2
-
-#define put_pixels8_l2_shift5_sse2 put_pixels8_l2_shift5_mmx2
-#define avg_pixels8_l2_shift5_sse2 avg_pixels8_l2_shift5_mmx2
-#define put_pixels16_l2_shift5_sse2 put_pixels16_l2_shift5_mmx2
-#define avg_pixels16_l2_shift5_sse2 avg_pixels16_l2_shift5_mmx2
-#define put_pixels8_l2_shift5_ssse3 put_pixels8_l2_shift5_mmx2
-#define avg_pixels8_l2_shift5_ssse3 avg_pixels8_l2_shift5_mmx2
-#define put_pixels16_l2_shift5_ssse3 put_pixels16_l2_shift5_mmx2
-#define avg_pixels16_l2_shift5_ssse3 avg_pixels16_l2_shift5_mmx2
-
-#define put_h264_qpel8_h_lowpass_l2_sse2 put_h264_qpel8_h_lowpass_l2_mmx2
-#define avg_h264_qpel8_h_lowpass_l2_sse2 avg_h264_qpel8_h_lowpass_l2_mmx2
-#define put_h264_qpel16_h_lowpass_l2_sse2 put_h264_qpel16_h_lowpass_l2_mmx2
-#define avg_h264_qpel16_h_lowpass_l2_sse2 avg_h264_qpel16_h_lowpass_l2_mmx2
-
-#define put_h264_qpel8_v_lowpass_ssse3 put_h264_qpel8_v_lowpass_sse2
-#define avg_h264_qpel8_v_lowpass_ssse3 avg_h264_qpel8_v_lowpass_sse2
-#define put_h264_qpel16_v_lowpass_ssse3 put_h264_qpel16_v_lowpass_sse2
-#define avg_h264_qpel16_v_lowpass_ssse3 avg_h264_qpel16_v_lowpass_sse2
-
-#define put_h264_qpel8or16_hv2_lowpass_sse2 put_h264_qpel8or16_hv2_lowpass_mmx2
-#define avg_h264_qpel8or16_hv2_lowpass_sse2 avg_h264_qpel8or16_hv2_lowpass_mmx2
-
-#define H264_MC(OPNAME, SIZE, MMX, ALIGN) \
-H264_MC_C(OPNAME, SIZE, MMX, ALIGN)\
-H264_MC_V(OPNAME, SIZE, MMX, ALIGN)\
-H264_MC_H(OPNAME, SIZE, MMX, ALIGN)\
-H264_MC_HV(OPNAME, SIZE, MMX, ALIGN)\
-
-static void put_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
-    put_pixels16_sse2(dst, src, stride, 16);
-}
-static void avg_h264_qpel16_mc00_sse2 (uint8_t *dst, uint8_t *src, int stride){
-    avg_pixels16_sse2(dst, src, stride, 16);
-}
-#define put_h264_qpel8_mc00_sse2 put_h264_qpel8_mc00_mmx2
-#define avg_h264_qpel8_mc00_sse2 avg_h264_qpel8_mc00_mmx2
-
-#define H264_MC_C(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## MMX (uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## pixels ## SIZE ## _ ## MMX(dst, src, stride, SIZE);\
-}\
-
-#define H264_MC_H(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, src+1, stride, stride);\
-}\
-
-#define H264_MC_V(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src, temp, stride, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## MMX(dst, src, stride, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_ ## MMX(dst, src+stride, temp, stride, stride, SIZE);\
-}\
-
-#define H264_MC_HV(OPNAME, SIZE, MMX, ALIGN) \
-static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src, SIZE, stride);\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*SIZE];\
-    put_h264_qpel ## SIZE ## _v_lowpass_ ## MMX(temp, src+1, SIZE, stride);\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, temp, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint16_t, temp)[SIZE*(SIZE<8?12:24)];\
-    OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(dst, temp, src, stride, SIZE, stride);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
-    uint8_t * const halfHV= temp;\
-    int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
-    assert(((int)temp & 7) == 0);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src, halfHV, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
-    uint8_t * const halfHV= temp;\
-    int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
-    assert(((int)temp & 7) == 0);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
-    OPNAME ## h264_qpel ## SIZE ## _h_lowpass_l2_ ## MMX(dst, src+stride, halfHV, stride, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
-    uint8_t * const halfHV= temp;\
-    int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
-    assert(((int)temp & 7) == 0);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+2, halfHV, stride, SIZE, SIZE);\
-}\
-\
-static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
-    DECLARE_ALIGNED(ALIGN, uint8_t, temp)[SIZE*(SIZE<8?12:24)*2 + SIZE*SIZE];\
-    uint8_t * const halfHV= temp;\
-    int16_t * const halfV= (int16_t*)(temp + SIZE*SIZE);\
-    assert(((int)temp & 7) == 0);\
-    put_h264_qpel ## SIZE ## _hv_lowpass_ ## MMX(halfHV, halfV, src, SIZE, SIZE, stride);\
-    OPNAME ## pixels ## SIZE ## _l2_shift5_ ## MMX(dst, halfV+3, halfHV, stride, SIZE, SIZE);\
-}\
-
-#define H264_MC_4816(MMX)\
-H264_MC(put_, 4, MMX, 8)\
-H264_MC(put_, 8, MMX, 8)\
-H264_MC(put_, 16,MMX, 8)\
-H264_MC(avg_, 4, MMX, 8)\
-H264_MC(avg_, 8, MMX, 8)\
-H264_MC(avg_, 16,MMX, 8)\
-
-#define H264_MC_816(QPEL, XMM)\
-QPEL(put_, 8, XMM, 16)\
-QPEL(put_, 16,XMM, 16)\
-QPEL(avg_, 8, XMM, 16)\
-QPEL(avg_, 16,XMM, 16)\
-
-
-#define AVG_3DNOW_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp "   \n\t"\
-"pavgusb " #temp ", " #a "        \n\t"\
-"mov" #size " " #a ", " #b "      \n\t"
-#define AVG_MMX2_OP(a,b,temp, size) \
-"mov" #size " " #b ", " #temp "   \n\t"\
-"pavgb " #temp ", " #a "          \n\t"\
-"mov" #size " " #a ", " #b "      \n\t"
-
-#define PAVGB "pavgusb"
-QPEL_H264(put_,       PUT_OP, 3dnow)
-QPEL_H264(avg_, AVG_3DNOW_OP, 3dnow)
-#undef PAVGB
-#define PAVGB "pavgb"
-QPEL_H264(put_,       PUT_OP, mmx2)
-QPEL_H264(avg_,  AVG_MMX2_OP, mmx2)
-QPEL_H264_V_XMM(put_,       PUT_OP, sse2)
-QPEL_H264_V_XMM(avg_,  AVG_MMX2_OP, sse2)
-QPEL_H264_HV_XMM(put_,       PUT_OP, sse2)
-QPEL_H264_HV_XMM(avg_,  AVG_MMX2_OP, sse2)
-#if HAVE_SSSE3
-QPEL_H264_H_XMM(put_,       PUT_OP, ssse3)
-QPEL_H264_H_XMM(avg_,  AVG_MMX2_OP, ssse3)
-QPEL_H264_HV2_XMM(put_,       PUT_OP, ssse3)
-QPEL_H264_HV2_XMM(avg_,  AVG_MMX2_OP, ssse3)
-QPEL_H264_HV_XMM(put_,       PUT_OP, ssse3)
-QPEL_H264_HV_XMM(avg_,  AVG_MMX2_OP, ssse3)
-#endif
-#undef PAVGB
-
-H264_MC_4816(3dnow)
-H264_MC_4816(mmx2)
-H264_MC_816(H264_MC_V, sse2)
-H264_MC_816(H264_MC_HV, sse2)
-#if HAVE_SSSE3
-H264_MC_816(H264_MC_H, ssse3)
-H264_MC_816(H264_MC_HV, ssse3)
-#endif
-
-/* rnd interleaved with rnd div 8, use p+1 to access rnd div 8 */
-DECLARE_ALIGNED(8, static const uint64_t, h264_rnd_reg)[4] = {
-    0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL
-};
-
-#define H264_CHROMA_OP(S,D)
-#define H264_CHROMA_OP4(S,D,T)
-#define H264_CHROMA_MC8_TMPL put_h264_chroma_generic_mc8_mmx
-#define H264_CHROMA_MC4_TMPL put_h264_chroma_generic_mc4_mmx
-#define H264_CHROMA_MC2_TMPL put_h264_chroma_mc2_mmx2
-#define H264_CHROMA_MC8_MV0 put_pixels8_mmx
-#include "dsputil_h264_template_mmx.c"
-
-static void put_h264_chroma_mc8_mmx_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, h264_rnd_reg);
-}
-static void put_vc1_chroma_mc8_mmx_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, h264_rnd_reg+2);
-}
-static void put_h264_chroma_mc4_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    put_h264_chroma_generic_mc4_mmx(dst, src, stride, h, x, y, h264_rnd_reg);
-}
-
-#undef H264_CHROMA_OP
-#undef H264_CHROMA_OP4
-#undef H264_CHROMA_MC8_TMPL
-#undef H264_CHROMA_MC4_TMPL
-#undef H264_CHROMA_MC2_TMPL
-#undef H264_CHROMA_MC8_MV0
-
-#define H264_CHROMA_OP(S,D) "pavgb " #S ", " #D " \n\t"
-#define H264_CHROMA_OP4(S,D,T) "movd  " #S ", " #T " \n\t"\
-                               "pavgb " #T ", " #D " \n\t"
-#define H264_CHROMA_MC8_TMPL avg_h264_chroma_generic_mc8_mmx2
-#define H264_CHROMA_MC4_TMPL avg_h264_chroma_generic_mc4_mmx2
-#define H264_CHROMA_MC2_TMPL avg_h264_chroma_mc2_mmx2
-#define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2
-#include "dsputil_h264_template_mmx.c"
-static void avg_h264_chroma_mc8_mmx2_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, h264_rnd_reg);
-}
-static void avg_vc1_chroma_mc8_mmx2_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, h264_rnd_reg+2);
-}
-static void avg_h264_chroma_mc4_mmx2(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc4_mmx2(dst, src, stride, h, x, y, h264_rnd_reg);
-}
-#undef H264_CHROMA_OP
-#undef H264_CHROMA_OP4
-#undef H264_CHROMA_MC8_TMPL
-#undef H264_CHROMA_MC4_TMPL
-#undef H264_CHROMA_MC2_TMPL
-#undef H264_CHROMA_MC8_MV0
-
-#define H264_CHROMA_OP(S,D) "pavgusb " #S ", " #D " \n\t"
-#define H264_CHROMA_OP4(S,D,T) "movd " #S ", " #T " \n\t"\
-                               "pavgusb " #T ", " #D " \n\t"
-#define H264_CHROMA_MC8_TMPL avg_h264_chroma_generic_mc8_3dnow
-#define H264_CHROMA_MC4_TMPL avg_h264_chroma_generic_mc4_3dnow
-#define H264_CHROMA_MC8_MV0 avg_pixels8_3dnow
-#include "dsputil_h264_template_mmx.c"
-static void avg_h264_chroma_mc8_3dnow_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc8_3dnow(dst, src, stride, h, x, y, h264_rnd_reg);
-}
-static void avg_h264_chroma_mc4_3dnow(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc4_3dnow(dst, src, stride, h, x, y, h264_rnd_reg);
-}
-#undef H264_CHROMA_OP
-#undef H264_CHROMA_OP4
-#undef H264_CHROMA_MC8_TMPL
-#undef H264_CHROMA_MC4_TMPL
-#undef H264_CHROMA_MC8_MV0
-
-#if HAVE_SSSE3
-#define AVG_OP(X)
-#undef H264_CHROMA_MC8_TMPL
-#undef H264_CHROMA_MC4_TMPL
-#define H264_CHROMA_MC8_TMPL put_h264_chroma_mc8_ssse3
-#define H264_CHROMA_MC4_TMPL put_h264_chroma_mc4_ssse3
-#define H264_CHROMA_MC8_MV0 put_pixels8_mmx
-#include "dsputil_h264_template_ssse3.c"
-static void put_h264_chroma_mc8_ssse3_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    put_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 1);
-}
-static void put_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    put_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 0);
-}
-
-#undef AVG_OP
-#undef H264_CHROMA_MC8_TMPL
-#undef H264_CHROMA_MC4_TMPL
-#undef H264_CHROMA_MC8_MV0
-#define AVG_OP(X) X
-#define H264_CHROMA_MC8_TMPL avg_h264_chroma_mc8_ssse3
-#define H264_CHROMA_MC4_TMPL avg_h264_chroma_mc4_ssse3
-#define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2
-#include "dsputil_h264_template_ssse3.c"
-static void avg_h264_chroma_mc8_ssse3_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 1);
-}
-static void avg_vc1_chroma_mc8_ssse3_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_mc8_ssse3(dst, src, stride, h, x, y, 0);
-}
-#undef AVG_OP
-#undef H264_CHROMA_MC8_TMPL
-#undef H264_CHROMA_MC4_TMPL
-#undef H264_CHROMA_MC8_MV0
-#endif
-
-/***********************************/
-/* weighted prediction */
-
-static inline void ff_h264_weight_WxH_mmx2(uint8_t *dst, int stride, int log2_denom, int weight, int offset, int w, int h)
-{
-    int x, y;
-    offset <<= log2_denom;
-    offset += (1 << log2_denom) >> 1;
-    __asm__ volatile(
-        "movd    %0, %%mm4        \n\t"
-        "movd    %1, %%mm5        \n\t"
-        "movd    %2, %%mm6        \n\t"
-        "pshufw  $0, %%mm4, %%mm4 \n\t"
-        "pshufw  $0, %%mm5, %%mm5 \n\t"
-        "pxor    %%mm7, %%mm7     \n\t"
-        :: "g"(weight), "g"(offset), "g"(log2_denom)
-    );
-    for(y=0; y<h; y+=2){
-        for(x=0; x<w; x+=4){
-            __asm__ volatile(
-                "movd      %0,    %%mm0 \n\t"
-                "movd      %1,    %%mm1 \n\t"
-                "punpcklbw %%mm7, %%mm0 \n\t"
-                "punpcklbw %%mm7, %%mm1 \n\t"
-                "pmullw    %%mm4, %%mm0 \n\t"
-                "pmullw    %%mm4, %%mm1 \n\t"
-                "paddsw    %%mm5, %%mm0 \n\t"
-                "paddsw    %%mm5, %%mm1 \n\t"
-                "psraw     %%mm6, %%mm0 \n\t"
-                "psraw     %%mm6, %%mm1 \n\t"
-                "packuswb  %%mm7, %%mm0 \n\t"
-                "packuswb  %%mm7, %%mm1 \n\t"
-                "movd      %%mm0, %0    \n\t"
-                "movd      %%mm1, %1    \n\t"
-                : "+m"(*(uint32_t*)(dst+x)),
-                  "+m"(*(uint32_t*)(dst+x+stride))
-            );
-        }
-        dst += 2*stride;
-    }
-}
-
-static inline void ff_h264_biweight_WxH_mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset, int w, int h)
-{
-    int x, y;
-    offset = ((offset + 1) | 1) << log2_denom;
-    __asm__ volatile(
-        "movd    %0, %%mm3        \n\t"
-        "movd    %1, %%mm4        \n\t"
-        "movd    %2, %%mm5        \n\t"
-        "movd    %3, %%mm6        \n\t"
-        "pshufw  $0, %%mm3, %%mm3 \n\t"
-        "pshufw  $0, %%mm4, %%mm4 \n\t"
-        "pshufw  $0, %%mm5, %%mm5 \n\t"
-        "pxor    %%mm7, %%mm7     \n\t"
-        :: "g"(weightd), "g"(weights), "g"(offset), "g"(log2_denom+1)
-    );
-    for(y=0; y<h; y++){
-        for(x=0; x<w; x+=4){
-            __asm__ volatile(
-                "movd      %0,    %%mm0 \n\t"
-                "movd      %1,    %%mm1 \n\t"
-                "punpcklbw %%mm7, %%mm0 \n\t"
-                "punpcklbw %%mm7, %%mm1 \n\t"
-                "pmullw    %%mm3, %%mm0 \n\t"
-                "pmullw    %%mm4, %%mm1 \n\t"
-                "paddsw    %%mm1, %%mm0 \n\t"
-                "paddsw    %%mm5, %%mm0 \n\t"
-                "psraw     %%mm6, %%mm0 \n\t"
-                "packuswb  %%mm0, %%mm0 \n\t"
-                "movd      %%mm0, %0    \n\t"
-                : "+m"(*(uint32_t*)(dst+x))
-                :  "m"(*(uint32_t*)(src+x))
-            );
-        }
-        src += stride;
-        dst += stride;
-    }
-}
-
-#define H264_WEIGHT(W,H) \
-static void ff_h264_biweight_ ## W ## x ## H ## _mmx2(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offset){ \
-    ff_h264_biweight_WxH_mmx2(dst, src, stride, log2_denom, weightd, weights, offset, W, H); \
-} \
-static void ff_h264_weight_ ## W ## x ## H ## _mmx2(uint8_t *dst, int stride, int log2_denom, int weight, int offset){ \
-    ff_h264_weight_WxH_mmx2(dst, stride, log2_denom, weight, offset, W, H); \
-}
-
-H264_WEIGHT(16,16)
-H264_WEIGHT(16, 8)
-H264_WEIGHT( 8,16)
-H264_WEIGHT( 8, 8)
-H264_WEIGHT( 8, 4)
-H264_WEIGHT( 4, 8)
-H264_WEIGHT( 4, 4)
-H264_WEIGHT( 4, 2)
-
diff --git a/libavcodec/x86/idct_mmx.c b/libavcodec/x86/idct_mmx.c
deleted file mode 100644
index d6ab04e..0000000
--- a/libavcodec/x86/idct_mmx.c
+++ /dev/null
@@ -1,601 +0,0 @@
-/*
- * idct_mmx.c
- * Copyright (C) 1999-2001 Aaron Holtzman <aholtzma at ess.engr.uvic.ca>
- *
- * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
- * See http://libmpeg2.sourceforge.net/ for updates.
- *
- * mpeg2dec 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.
- *
- * mpeg2dec 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 mpeg2dec; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "libavcodec/dsputil.h"
-
-#include "dsputil_mmx.h"
-#include "mmx.h"
-
-#define ROW_SHIFT 11
-#define COL_SHIFT 6
-
-#define round(bias) ((int)(((bias)+0.5) * (1<<ROW_SHIFT)))
-#define rounder(bias) {round (bias), round (bias)}
-
-
-#if 0
-/* C row IDCT - it is just here to document the MMXEXT and MMX versions */
-static inline void idct_row (int16_t * row, int offset,
-                             int16_t * table, int32_t * rounder)
-{
-    int C1, C2, C3, C4, C5, C6, C7;
-    int a0, a1, a2, a3, b0, b1, b2, b3;
-
-    row += offset;
-
-    C1 = table[1];
-    C2 = table[2];
-    C3 = table[3];
-    C4 = table[4];
-    C5 = table[5];
-    C6 = table[6];
-    C7 = table[7];
-
-    a0 = C4*row[0] + C2*row[2] + C4*row[4] + C6*row[6] + *rounder;
-    a1 = C4*row[0] + C6*row[2] - C4*row[4] - C2*row[6] + *rounder;
-    a2 = C4*row[0] - C6*row[2] - C4*row[4] + C2*row[6] + *rounder;
-    a3 = C4*row[0] - C2*row[2] + C4*row[4] - C6*row[6] + *rounder;
-
-    b0 = C1*row[1] + C3*row[3] + C5*row[5] + C7*row[7];
-    b1 = C3*row[1] - C7*row[3] - C1*row[5] - C5*row[7];
-    b2 = C5*row[1] - C1*row[3] + C7*row[5] + C3*row[7];
-    b3 = C7*row[1] - C5*row[3] + C3*row[5] - C1*row[7];
-
-    row[0] = (a0 + b0) >> ROW_SHIFT;
-    row[1] = (a1 + b1) >> ROW_SHIFT;
-    row[2] = (a2 + b2) >> ROW_SHIFT;
-    row[3] = (a3 + b3) >> ROW_SHIFT;
-    row[4] = (a3 - b3) >> ROW_SHIFT;
-    row[5] = (a2 - b2) >> ROW_SHIFT;
-    row[6] = (a1 - b1) >> ROW_SHIFT;
-    row[7] = (a0 - b0) >> ROW_SHIFT;
-}
-#endif
-
-
-/* MMXEXT row IDCT */
-
-#define mmxext_table(c1,c2,c3,c4,c5,c6,c7)      {  c4,  c2, -c4, -c2,   \
-                                                   c4,  c6,  c4,  c6,   \
-                                                   c1,  c3, -c1, -c5,   \
-                                                   c5,  c7,  c3, -c7,   \
-                                                   c4, -c6,  c4, -c6,   \
-                                                  -c4,  c2,  c4, -c2,   \
-                                                   c5, -c1,  c3, -c1,   \
-                                                   c7,  c3,  c7, -c5 }
-
-static inline void mmxext_row_head (int16_t * const row, const int offset,
-                                    const int16_t * const table)
-{
-    movq_m2r (*(row+offset), mm2);      /* mm2 = x6 x4 x2 x0 */
-
-    movq_m2r (*(row+offset+4), mm5);    /* mm5 = x7 x5 x3 x1 */
-    movq_r2r (mm2, mm0);                /* mm0 = x6 x4 x2 x0 */
-
-    movq_m2r (*table, mm3);             /* mm3 = -C2 -C4 C2 C4 */
-    movq_r2r (mm5, mm6);                /* mm6 = x7 x5 x3 x1 */
-
-    movq_m2r (*(table+4), mm4);         /* mm4 = C6 C4 C6 C4 */
-    pmaddwd_r2r (mm0, mm3);             /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
-
-    pshufw_r2r (mm2, mm2, 0x4e);        /* mm2 = x2 x0 x6 x4 */
-}
-
-static inline void mmxext_row (const int16_t * const table,
-                               const int32_t * const rounder)
-{
-    movq_m2r (*(table+8), mm1);         /* mm1 = -C5 -C1 C3 C1 */
-    pmaddwd_r2r (mm2, mm4);             /* mm4 = C4*x0+C6*x2 C4*x4+C6*x6 */
-
-    pmaddwd_m2r (*(table+16), mm0);     /* mm0 = C4*x4-C6*x6 C4*x0-C6*x2 */
-    pshufw_r2r (mm6, mm6, 0x4e);        /* mm6 = x3 x1 x7 x5 */
-
-    movq_m2r (*(table+12), mm7);        /* mm7 = -C7 C3 C7 C5 */
-    pmaddwd_r2r (mm5, mm1);             /* mm1 = -C1*x5-C5*x7 C1*x1+C3*x3 */
-
-    paddd_m2r (*rounder, mm3);          /* mm3 += rounder */
-    pmaddwd_r2r (mm6, mm7);             /* mm7 = C3*x1-C7*x3 C5*x5+C7*x7 */
-
-    pmaddwd_m2r (*(table+20), mm2);     /* mm2 = C4*x0-C2*x2 -C4*x4+C2*x6 */
-    paddd_r2r (mm4, mm3);               /* mm3 = a1 a0 + rounder */
-
-    pmaddwd_m2r (*(table+24), mm5);     /* mm5 = C3*x5-C1*x7 C5*x1-C1*x3 */
-    movq_r2r (mm3, mm4);                /* mm4 = a1 a0 + rounder */
-
-    pmaddwd_m2r (*(table+28), mm6);     /* mm6 = C7*x1-C5*x3 C7*x5+C3*x7 */
-    paddd_r2r (mm7, mm1);               /* mm1 = b1 b0 */
-
-    paddd_m2r (*rounder, mm0);          /* mm0 += rounder */
-    psubd_r2r (mm1, mm3);               /* mm3 = a1-b1 a0-b0 + rounder */
-
-    psrad_i2r (ROW_SHIFT, mm3);         /* mm3 = y6 y7 */
-    paddd_r2r (mm4, mm1);               /* mm1 = a1+b1 a0+b0 + rounder */
-
-    paddd_r2r (mm2, mm0);               /* mm0 = a3 a2 + rounder */
-    psrad_i2r (ROW_SHIFT, mm1);         /* mm1 = y1 y0 */
-
-    paddd_r2r (mm6, mm5);               /* mm5 = b3 b2 */
-    movq_r2r (mm0, mm4);                /* mm4 = a3 a2 + rounder */
-
-    paddd_r2r (mm5, mm0);               /* mm0 = a3+b3 a2+b2 + rounder */
-    psubd_r2r (mm5, mm4);               /* mm4 = a3-b3 a2-b2 + rounder */
-}
-
-static inline void mmxext_row_tail (int16_t * const row, const int store)
-{
-    psrad_i2r (ROW_SHIFT, mm0);         /* mm0 = y3 y2 */
-
-    psrad_i2r (ROW_SHIFT, mm4);         /* mm4 = y4 y5 */
-
-    packssdw_r2r (mm0, mm1);            /* mm1 = y3 y2 y1 y0 */
-
-    packssdw_r2r (mm3, mm4);            /* mm4 = y6 y7 y4 y5 */
-
-    movq_r2m (mm1, *(row+store));       /* save y3 y2 y1 y0 */
-    pshufw_r2r (mm4, mm4, 0xb1);        /* mm4 = y7 y6 y5 y4 */
-
-    /* slot */
-
-    movq_r2m (mm4, *(row+store+4));     /* save y7 y6 y5 y4 */
-}
-
-static inline void mmxext_row_mid (int16_t * const row, const int store,
-                                   const int offset,
-                                   const int16_t * const table)
-{
-    movq_m2r (*(row+offset), mm2);      /* mm2 = x6 x4 x2 x0 */
-    psrad_i2r (ROW_SHIFT, mm0);         /* mm0 = y3 y2 */
-
-    movq_m2r (*(row+offset+4), mm5);    /* mm5 = x7 x5 x3 x1 */
-    psrad_i2r (ROW_SHIFT, mm4);         /* mm4 = y4 y5 */
-
-    packssdw_r2r (mm0, mm1);            /* mm1 = y3 y2 y1 y0 */
-    movq_r2r (mm5, mm6);                /* mm6 = x7 x5 x3 x1 */
-
-    packssdw_r2r (mm3, mm4);            /* mm4 = y6 y7 y4 y5 */
-    movq_r2r (mm2, mm0);                /* mm0 = x6 x4 x2 x0 */
-
-    movq_r2m (mm1, *(row+store));       /* save y3 y2 y1 y0 */
-    pshufw_r2r (mm4, mm4, 0xb1);        /* mm4 = y7 y6 y5 y4 */
-
-    movq_m2r (*table, mm3);             /* mm3 = -C2 -C4 C2 C4 */
-    movq_r2m (mm4, *(row+store+4));     /* save y7 y6 y5 y4 */
-
-    pmaddwd_r2r (mm0, mm3);             /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
-
-    movq_m2r (*(table+4), mm4);         /* mm4 = C6 C4 C6 C4 */
-    pshufw_r2r (mm2, mm2, 0x4e);        /* mm2 = x2 x0 x6 x4 */
-}
-
-
-/* MMX row IDCT */
-
-#define mmx_table(c1,c2,c3,c4,c5,c6,c7) {  c4,  c2,  c4,  c6,   \
-                                           c4,  c6, -c4, -c2,   \
-                                           c1,  c3,  c3, -c7,   \
-                                           c5,  c7, -c1, -c5,   \
-                                           c4, -c6,  c4, -c2,   \
-                                          -c4,  c2,  c4, -c6,   \
-                                           c5, -c1,  c7, -c5,   \
-                                           c7,  c3,  c3, -c1 }
-
-static inline void mmx_row_head (int16_t * const row, const int offset,
-                                 const int16_t * const table)
-{
-    movq_m2r (*(row+offset), mm2);      /* mm2 = x6 x4 x2 x0 */
-
-    movq_m2r (*(row+offset+4), mm5);    /* mm5 = x7 x5 x3 x1 */
-    movq_r2r (mm2, mm0);                /* mm0 = x6 x4 x2 x0 */
-
-    movq_m2r (*table, mm3);             /* mm3 = C6 C4 C2 C4 */
-    movq_r2r (mm5, mm6);                /* mm6 = x7 x5 x3 x1 */
-
-    punpckldq_r2r (mm0, mm0);           /* mm0 = x2 x0 x2 x0 */
-
-    movq_m2r (*(table+4), mm4);         /* mm4 = -C2 -C4 C6 C4 */
-    pmaddwd_r2r (mm0, mm3);             /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
-
-    movq_m2r (*(table+8), mm1);         /* mm1 = -C7 C3 C3 C1 */
-    punpckhdq_r2r (mm2, mm2);           /* mm2 = x6 x4 x6 x4 */
-}
-
-static inline void mmx_row (const int16_t * const table,
-                            const int32_t * const rounder)
-{
-    pmaddwd_r2r (mm2, mm4);             /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */
-    punpckldq_r2r (mm5, mm5);           /* mm5 = x3 x1 x3 x1 */
-
-    pmaddwd_m2r (*(table+16), mm0);     /* mm0 = C4*x0-C2*x2 C4*x0-C6*x2 */
-    punpckhdq_r2r (mm6, mm6);           /* mm6 = x7 x5 x7 x5 */
-
-    movq_m2r (*(table+12), mm7);        /* mm7 = -C5 -C1 C7 C5 */
-    pmaddwd_r2r (mm5, mm1);             /* mm1 = C3*x1-C7*x3 C1*x1+C3*x3 */
-
-    paddd_m2r (*rounder, mm3);          /* mm3 += rounder */
-    pmaddwd_r2r (mm6, mm7);             /* mm7 = -C1*x5-C5*x7 C5*x5+C7*x7 */
-
-    pmaddwd_m2r (*(table+20), mm2);     /* mm2 = C4*x4-C6*x6 -C4*x4+C2*x6 */
-    paddd_r2r (mm4, mm3);               /* mm3 = a1 a0 + rounder */
-
-    pmaddwd_m2r (*(table+24), mm5);     /* mm5 = C7*x1-C5*x3 C5*x1-C1*x3 */
-    movq_r2r (mm3, mm4);                /* mm4 = a1 a0 + rounder */
-
-    pmaddwd_m2r (*(table+28), mm6);     /* mm6 = C3*x5-C1*x7 C7*x5+C3*x7 */
-    paddd_r2r (mm7, mm1);               /* mm1 = b1 b0 */
-
-    paddd_m2r (*rounder, mm0);          /* mm0 += rounder */
-    psubd_r2r (mm1, mm3);               /* mm3 = a1-b1 a0-b0 + rounder */
-
-    psrad_i2r (ROW_SHIFT, mm3);         /* mm3 = y6 y7 */
-    paddd_r2r (mm4, mm1);               /* mm1 = a1+b1 a0+b0 + rounder */
-
-    paddd_r2r (mm2, mm0);               /* mm0 = a3 a2 + rounder */
-    psrad_i2r (ROW_SHIFT, mm1);         /* mm1 = y1 y0 */
-
-    paddd_r2r (mm6, mm5);               /* mm5 = b3 b2 */
-    movq_r2r (mm0, mm7);                /* mm7 = a3 a2 + rounder */
-
-    paddd_r2r (mm5, mm0);               /* mm0 = a3+b3 a2+b2 + rounder */
-    psubd_r2r (mm5, mm7);               /* mm7 = a3-b3 a2-b2 + rounder */
-}
-
-static inline void mmx_row_tail (int16_t * const row, const int store)
-{
-    psrad_i2r (ROW_SHIFT, mm0);         /* mm0 = y3 y2 */
-
-    psrad_i2r (ROW_SHIFT, mm7);         /* mm7 = y4 y5 */
-
-    packssdw_r2r (mm0, mm1);            /* mm1 = y3 y2 y1 y0 */
-
-    packssdw_r2r (mm3, mm7);            /* mm7 = y6 y7 y4 y5 */
-
-    movq_r2m (mm1, *(row+store));       /* save y3 y2 y1 y0 */
-    movq_r2r (mm7, mm4);                /* mm4 = y6 y7 y4 y5 */
-
-    pslld_i2r (16, mm7);                /* mm7 = y7 0 y5 0 */
-
-    psrld_i2r (16, mm4);                /* mm4 = 0 y6 0 y4 */
-
-    por_r2r (mm4, mm7);                 /* mm7 = y7 y6 y5 y4 */
-
-    /* slot */
-
-    movq_r2m (mm7, *(row+store+4));     /* save y7 y6 y5 y4 */
-}
-
-static inline void mmx_row_mid (int16_t * const row, const int store,
-                                const int offset, const int16_t * const table)
-{
-    movq_m2r (*(row+offset), mm2);      /* mm2 = x6 x4 x2 x0 */
-    psrad_i2r (ROW_SHIFT, mm0);         /* mm0 = y3 y2 */
-
-    movq_m2r (*(row+offset+4), mm5);    /* mm5 = x7 x5 x3 x1 */
-    psrad_i2r (ROW_SHIFT, mm7);         /* mm7 = y4 y5 */
-
-    packssdw_r2r (mm0, mm1);            /* mm1 = y3 y2 y1 y0 */
-    movq_r2r (mm5, mm6);                /* mm6 = x7 x5 x3 x1 */
-
-    packssdw_r2r (mm3, mm7);            /* mm7 = y6 y7 y4 y5 */
-    movq_r2r (mm2, mm0);                /* mm0 = x6 x4 x2 x0 */
-
-    movq_r2m (mm1, *(row+store));       /* save y3 y2 y1 y0 */
-    movq_r2r (mm7, mm1);                /* mm1 = y6 y7 y4 y5 */
-
-    punpckldq_r2r (mm0, mm0);           /* mm0 = x2 x0 x2 x0 */
-    psrld_i2r (16, mm7);                /* mm7 = 0 y6 0 y4 */
-
-    movq_m2r (*table, mm3);             /* mm3 = C6 C4 C2 C4 */
-    pslld_i2r (16, mm1);                /* mm1 = y7 0 y5 0 */
-
-    movq_m2r (*(table+4), mm4);         /* mm4 = -C2 -C4 C6 C4 */
-    por_r2r (mm1, mm7);                 /* mm7 = y7 y6 y5 y4 */
-
-    movq_m2r (*(table+8), mm1);         /* mm1 = -C7 C3 C3 C1 */
-    punpckhdq_r2r (mm2, mm2);           /* mm2 = x6 x4 x6 x4 */
-
-    movq_r2m (mm7, *(row+store+4));     /* save y7 y6 y5 y4 */
-    pmaddwd_r2r (mm0, mm3);             /* mm3 = C4*x0+C6*x2 C4*x0+C2*x2 */
-}
-
-
-#if 0
-/* C column IDCT - it is just here to document the MMXEXT and MMX versions */
-static inline void idct_col (int16_t * col, int offset)
-{
-/* multiplication - as implemented on mmx */
-#define F(c,x) (((c) * (x)) >> 16)
-
-/* saturation - it helps us handle torture test cases */
-#define S(x) (((x)>32767) ? 32767 : ((x)<-32768) ? -32768 : (x))
-
-    int16_t x0, x1, x2, x3, x4, x5, x6, x7;
-    int16_t y0, y1, y2, y3, y4, y5, y6, y7;
-    int16_t a0, a1, a2, a3, b0, b1, b2, b3;
-    int16_t u04, v04, u26, v26, u17, v17, u35, v35, u12, v12;
-
-    col += offset;
-
-    x0 = col[0*8];
-    x1 = col[1*8];
-    x2 = col[2*8];
-    x3 = col[3*8];
-    x4 = col[4*8];
-    x5 = col[5*8];
-    x6 = col[6*8];
-    x7 = col[7*8];
-
-    u04 = S (x0 + x4);
-    v04 = S (x0 - x4);
-    u26 = S (F (T2, x6) + x2);
-    v26 = S (F (T2, x2) - x6);
-
-    a0 = S (u04 + u26);
-    a1 = S (v04 + v26);
-    a2 = S (v04 - v26);
-    a3 = S (u04 - u26);
-
-    u17 = S (F (T1, x7) + x1);
-    v17 = S (F (T1, x1) - x7);
-    u35 = S (F (T3, x5) + x3);
-    v35 = S (F (T3, x3) - x5);
-
-    b0 = S (u17 + u35);
-    b3 = S (v17 - v35);
-    u12 = S (u17 - u35);
-    v12 = S (v17 + v35);
-    u12 = S (2 * F (C4, u12));
-    v12 = S (2 * F (C4, v12));
-    b1 = S (u12 + v12);
-    b2 = S (u12 - v12);
-
-    y0 = S (a0 + b0) >> COL_SHIFT;
-    y1 = S (a1 + b1) >> COL_SHIFT;
-    y2 = S (a2 + b2) >> COL_SHIFT;
-    y3 = S (a3 + b3) >> COL_SHIFT;
-
-    y4 = S (a3 - b3) >> COL_SHIFT;
-    y5 = S (a2 - b2) >> COL_SHIFT;
-    y6 = S (a1 - b1) >> COL_SHIFT;
-    y7 = S (a0 - b0) >> COL_SHIFT;
-
-    col[0*8] = y0;
-    col[1*8] = y1;
-    col[2*8] = y2;
-    col[3*8] = y3;
-    col[4*8] = y4;
-    col[5*8] = y5;
-    col[6*8] = y6;
-    col[7*8] = y7;
-}
-#endif
-
-
-/* MMX column IDCT */
-static inline void idct_col (int16_t * const col, const int offset)
-{
-#define T1 13036
-#define T2 27146
-#define T3 43790
-#define C4 23170
-
-    DECLARE_ALIGNED(8, static const short, t1_vector)[] = {T1,T1,T1,T1};
-    DECLARE_ALIGNED(8, static const short, t2_vector)[] = {T2,T2,T2,T2};
-    DECLARE_ALIGNED(8, static const short, t3_vector)[] = {T3,T3,T3,T3};
-    DECLARE_ALIGNED(8, static const short, c4_vector)[] = {C4,C4,C4,C4};
-
-    /* column code adapted from Peter Gubanov */
-    /* http://www.elecard.com/peter/idct.shtml */
-
-    movq_m2r (*t1_vector, mm0);         /* mm0 = T1 */
-
-    movq_m2r (*(col+offset+1*8), mm1);  /* mm1 = x1 */
-    movq_r2r (mm0, mm2);                /* mm2 = T1 */
-
-    movq_m2r (*(col+offset+7*8), mm4);  /* mm4 = x7 */
-    pmulhw_r2r (mm1, mm0);              /* mm0 = T1*x1 */
-
-    movq_m2r (*t3_vector, mm5);         /* mm5 = T3 */
-    pmulhw_r2r (mm4, mm2);              /* mm2 = T1*x7 */
-
-    movq_m2r (*(col+offset+5*8), mm6);  /* mm6 = x5 */
-    movq_r2r (mm5, mm7);                /* mm7 = T3-1 */
-
-    movq_m2r (*(col+offset+3*8), mm3);  /* mm3 = x3 */
-    psubsw_r2r (mm4, mm0);              /* mm0 = v17 */
-
-    movq_m2r (*t2_vector, mm4);         /* mm4 = T2 */
-    pmulhw_r2r (mm3, mm5);              /* mm5 = (T3-1)*x3 */
-
-    paddsw_r2r (mm2, mm1);              /* mm1 = u17 */
-    pmulhw_r2r (mm6, mm7);              /* mm7 = (T3-1)*x5 */
-
-    /* slot */
-
-    movq_r2r (mm4, mm2);                /* mm2 = T2 */
-    paddsw_r2r (mm3, mm5);              /* mm5 = T3*x3 */
-
-    pmulhw_m2r (*(col+offset+2*8), mm4);/* mm4 = T2*x2 */
-    paddsw_r2r (mm6, mm7);              /* mm7 = T3*x5 */
-
-    psubsw_r2r (mm6, mm5);              /* mm5 = v35 */
-    paddsw_r2r (mm3, mm7);              /* mm7 = u35 */
-
-    movq_m2r (*(col+offset+6*8), mm3);  /* mm3 = x6 */
-    movq_r2r (mm0, mm6);                /* mm6 = v17 */
-
-    pmulhw_r2r (mm3, mm2);              /* mm2 = T2*x6 */
-    psubsw_r2r (mm5, mm0);              /* mm0 = b3 */
-
-    psubsw_r2r (mm3, mm4);              /* mm4 = v26 */
-    paddsw_r2r (mm6, mm5);              /* mm5 = v12 */
-
-    movq_r2m (mm0, *(col+offset+3*8));  /* save b3 in scratch0 */
-    movq_r2r (mm1, mm6);                /* mm6 = u17 */
-
-    paddsw_m2r (*(col+offset+2*8), mm2);/* mm2 = u26 */
-    paddsw_r2r (mm7, mm6);              /* mm6 = b0 */
-
-    psubsw_r2r (mm7, mm1);              /* mm1 = u12 */
-    movq_r2r (mm1, mm7);                /* mm7 = u12 */
-
-    movq_m2r (*(col+offset+0*8), mm3);  /* mm3 = x0 */
-    paddsw_r2r (mm5, mm1);              /* mm1 = u12+v12 */
-
-    movq_m2r (*c4_vector, mm0);         /* mm0 = C4/2 */
-    psubsw_r2r (mm5, mm7);              /* mm7 = u12-v12 */
-
-    movq_r2m (mm6, *(col+offset+5*8));  /* save b0 in scratch1 */
-    pmulhw_r2r (mm0, mm1);              /* mm1 = b1/2 */
-
-    movq_r2r (mm4, mm6);                /* mm6 = v26 */
-    pmulhw_r2r (mm0, mm7);              /* mm7 = b2/2 */
-
-    movq_m2r (*(col+offset+4*8), mm5);  /* mm5 = x4 */
-    movq_r2r (mm3, mm0);                /* mm0 = x0 */
-
-    psubsw_r2r (mm5, mm3);              /* mm3 = v04 */
-    paddsw_r2r (mm5, mm0);              /* mm0 = u04 */
-
-    paddsw_r2r (mm3, mm4);              /* mm4 = a1 */
-    movq_r2r (mm0, mm5);                /* mm5 = u04 */
-
-    psubsw_r2r (mm6, mm3);              /* mm3 = a2 */
-    paddsw_r2r (mm2, mm5);              /* mm5 = a0 */
-
-    paddsw_r2r (mm1, mm1);              /* mm1 = b1 */
-    psubsw_r2r (mm2, mm0);              /* mm0 = a3 */
-
-    paddsw_r2r (mm7, mm7);              /* mm7 = b2 */
-    movq_r2r (mm3, mm2);                /* mm2 = a2 */
-
-    movq_r2r (mm4, mm6);                /* mm6 = a1 */
-    paddsw_r2r (mm7, mm3);              /* mm3 = a2+b2 */
-
-    psraw_i2r (COL_SHIFT, mm3);         /* mm3 = y2 */
-    paddsw_r2r (mm1, mm4);              /* mm4 = a1+b1 */
-
-    psraw_i2r (COL_SHIFT, mm4);         /* mm4 = y1 */
-    psubsw_r2r (mm1, mm6);              /* mm6 = a1-b1 */
-
-    movq_m2r (*(col+offset+5*8), mm1);  /* mm1 = b0 */
-    psubsw_r2r (mm7, mm2);              /* mm2 = a2-b2 */
-
-    psraw_i2r (COL_SHIFT, mm6);         /* mm6 = y6 */
-    movq_r2r (mm5, mm7);                /* mm7 = a0 */
-
-    movq_r2m (mm4, *(col+offset+1*8));  /* save y1 */
-    psraw_i2r (COL_SHIFT, mm2);         /* mm2 = y5 */
-
-    movq_r2m (mm3, *(col+offset+2*8));  /* save y2 */
-    paddsw_r2r (mm1, mm5);              /* mm5 = a0+b0 */
-
-    movq_m2r (*(col+offset+3*8), mm4);  /* mm4 = b3 */
-    psubsw_r2r (mm1, mm7);              /* mm7 = a0-b0 */
-
-    psraw_i2r (COL_SHIFT, mm5);         /* mm5 = y0 */
-    movq_r2r (mm0, mm3);                /* mm3 = a3 */
-
-    movq_r2m (mm2, *(col+offset+5*8));  /* save y5 */
-    psubsw_r2r (mm4, mm3);              /* mm3 = a3-b3 */
-
-    psraw_i2r (COL_SHIFT, mm7);         /* mm7 = y7 */
-    paddsw_r2r (mm0, mm4);              /* mm4 = a3+b3 */
-
-    movq_r2m (mm5, *(col+offset+0*8));  /* save y0 */
-    psraw_i2r (COL_SHIFT, mm3);         /* mm3 = y4 */
-
-    movq_r2m (mm6, *(col+offset+6*8));  /* save y6 */
-    psraw_i2r (COL_SHIFT, mm4);         /* mm4 = y3 */
-
-    movq_r2m (mm7, *(col+offset+7*8));  /* save y7 */
-
-    movq_r2m (mm3, *(col+offset+4*8));  /* save y4 */
-
-    movq_r2m (mm4, *(col+offset+3*8));  /* save y3 */
-
-#undef T1
-#undef T2
-#undef T3
-#undef C4
-}
-
-
-DECLARE_ALIGNED(8, static const int32_t, rounder0)[] =
-    rounder ((1 << (COL_SHIFT - 1)) - 0.5);
-DECLARE_ALIGNED(8, static const int32_t, rounder4)[] = rounder (0);
-DECLARE_ALIGNED(8, static const int32_t, rounder1)[] =
-    rounder (1.25683487303);        /* C1*(C1/C4+C1+C7)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder7)[] =
-    rounder (-0.25);                /* C1*(C7/C4+C7-C1)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder2)[] =
-    rounder (0.60355339059);        /* C2 * (C6+C2)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder6)[] =
-    rounder (-0.25);                /* C2 * (C6-C2)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder3)[] =
-    rounder (0.087788325588);       /* C3*(-C3/C4+C3+C5)/2 */
-DECLARE_ALIGNED(8, static const int32_t, rounder5)[] =
-    rounder (-0.441341716183);      /* C3*(-C5/C4+C5-C3)/2 */
-
-#undef COL_SHIFT
-#undef ROW_SHIFT
-
-#define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \
-void idct (int16_t * const block)                                       \
-{                                                                       \
-    DECLARE_ALIGNED(16, static const int16_t, table04)[] =              \
-        table (22725, 21407, 19266, 16384, 12873,  8867, 4520);         \
-    DECLARE_ALIGNED(16, static const int16_t, table17)[] =              \
-        table (31521, 29692, 26722, 22725, 17855, 12299, 6270);         \
-    DECLARE_ALIGNED(16, static const int16_t, table26)[] =              \
-        table (29692, 27969, 25172, 21407, 16819, 11585, 5906);         \
-    DECLARE_ALIGNED(16, static const int16_t, table35)[] =              \
-        table (26722, 25172, 22654, 19266, 15137, 10426, 5315);         \
-                                                                        \
-    idct_row_head (block, 0*8, table04);                                \
-    idct_row (table04, rounder0);                                       \
-    idct_row_mid (block, 0*8, 4*8, table04);                            \
-    idct_row (table04, rounder4);                                       \
-    idct_row_mid (block, 4*8, 1*8, table17);                            \
-    idct_row (table17, rounder1);                                       \
-    idct_row_mid (block, 1*8, 7*8, table17);                            \
-    idct_row (table17, rounder7);                                       \
-    idct_row_mid (block, 7*8, 2*8, table26);                            \
-    idct_row (table26, rounder2);                                       \
-    idct_row_mid (block, 2*8, 6*8, table26);                            \
-    idct_row (table26, rounder6);                                       \
-    idct_row_mid (block, 6*8, 3*8, table35);                            \
-    idct_row (table35, rounder3);                                       \
-    idct_row_mid (block, 3*8, 5*8, table35);                            \
-    idct_row (table35, rounder5);                                       \
-    idct_row_tail (block, 5*8);                                         \
-                                                                        \
-    idct_col (block, 0);                                                \
-    idct_col (block, 4);                                                \
-}
-
-declare_idct (ff_mmxext_idct, mmxext_table,
-              mmxext_row_head, mmxext_row, mmxext_row_tail, mmxext_row_mid)
-
-declare_idct (ff_mmx_idct, mmx_table,
-              mmx_row_head, mmx_row, mmx_row_tail, mmx_row_mid)
-
diff --git a/libavcodec/x86/idct_mmx_xvid.c b/libavcodec/x86/idct_mmx_xvid.c
deleted file mode 100644
index 466cf75..0000000
--- a/libavcodec/x86/idct_mmx_xvid.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * XVID MPEG-4 VIDEO CODEC
- * - MMX and XMM forward discrete cosine transform -
- *
- * Copyright(C) 2001 Peter Ross <pross at xvid.org>
- *
- * Originally provided by Intel at AP-922
- * http://developer.intel.com/vtune/cbts/strmsimd/922down.htm
- * (See more app notes at http://developer.intel.com/vtune/cbts/strmsimd/appnotes.htm)
- * but in a limited edition.
- * New macro implements a column part for precise iDCT
- * The routine precision now satisfies IEEE standard 1180-1990.
- *
- * Copyright(C) 2000-2001 Peter Gubanov <peter at elecard.net.ru>
- * Rounding trick Copyright(C) 2000 Michel Lespinasse <walken at zoy.org>
- *
- * http://www.elecard.com/peter/idct.html
- * http://www.linuxvideo.org/mpeg2dec/
- *
- * These examples contain code fragments for first stage iDCT 8x8
- * (for rows) and first stage DCT 8x8 (for columns)
- *
- * conversion to gcc syntax by Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-#include "libavcodec/avcodec.h"
-#include "idct_xvid.h"
-
-//=============================================================================
-// Macros and other preprocessor constants
-//=============================================================================
-
-#define BITS_INV_ACC    5                              // 4 or 5 for IEEE
-#define SHIFT_INV_ROW   (16 - BITS_INV_ACC) //11
-#define SHIFT_INV_COL   (1 + BITS_INV_ACC) //6
-#define RND_INV_ROW     (1024 * (6 - BITS_INV_ACC))
-#define RND_INV_COL     (16 * (BITS_INV_ACC - 3))
-#define RND_INV_CORR    (RND_INV_COL - 1)
-
-#define BITS_FRW_ACC    3                              // 2 or 3 for accuracy
-#define SHIFT_FRW_COL   BITS_FRW_ACC
-#define SHIFT_FRW_ROW   (BITS_FRW_ACC + 17)
-#define RND_FRW_ROW     (262144*(BITS_FRW_ACC - 1))
-
-
-//-----------------------------------------------------------------------------
-// Various memory constants (trigonometric values or rounding values)
-//-----------------------------------------------------------------------------
-
-
-DECLARE_ALIGNED(8, static const int16_t, tg_1_16)[4*4] = {
-  13036,13036,13036,13036,        // tg * (2<<16) + 0.5
-  27146,27146,27146,27146,        // tg * (2<<16) + 0.5
-  -21746,-21746,-21746,-21746,    // tg * (2<<16) + 0.5
-  23170,23170,23170,23170};       // cos * (2<<15) + 0.5
-
-DECLARE_ALIGNED(8, static const int32_t, rounder_0)[2*8] = {
-  65536,65536,
-  3597,3597,
-  2260,2260,
-  1203,1203,
-  0,0,
-  120,120,
-  512,512,
-  512,512};
-
-//-----------------------------------------------------------------------------
-//
-// The first stage iDCT 8x8 - inverse DCTs of rows
-//
-//-----------------------------------------------------------------------------
-// The 8-point inverse DCT direct algorithm
-//-----------------------------------------------------------------------------
-//
-// static const short w[32] = {
-//       FIX(cos_4_16),  FIX(cos_2_16),  FIX(cos_4_16),  FIX(cos_6_16),
-//       FIX(cos_4_16),  FIX(cos_6_16), -FIX(cos_4_16), -FIX(cos_2_16),
-//       FIX(cos_4_16), -FIX(cos_6_16), -FIX(cos_4_16),  FIX(cos_2_16),
-//       FIX(cos_4_16), -FIX(cos_2_16),  FIX(cos_4_16), -FIX(cos_6_16),
-//       FIX(cos_1_16),  FIX(cos_3_16),  FIX(cos_5_16),  FIX(cos_7_16),
-//       FIX(cos_3_16), -FIX(cos_7_16), -FIX(cos_1_16), -FIX(cos_5_16),
-//       FIX(cos_5_16), -FIX(cos_1_16),  FIX(cos_7_16),  FIX(cos_3_16),
-//       FIX(cos_7_16), -FIX(cos_5_16),  FIX(cos_3_16), -FIX(cos_1_16) };
-//
-// #define DCT_8_INV_ROW(x, y)
-// {
-//       int a0, a1, a2, a3, b0, b1, b2, b3;
-//
-//       a0 =x[0]*w[0]+x[2]*w[1]+x[4]*w[2]+x[6]*w[3];
-//       a1 =x[0]*w[4]+x[2]*w[5]+x[4]*w[6]+x[6]*w[7];
-//       a2 = x[0] * w[ 8] + x[2] * w[ 9] + x[4] * w[10] + x[6] * w[11];
-//       a3 = x[0] * w[12] + x[2] * w[13] + x[4] * w[14] + x[6] * w[15];
-//       b0 = x[1] * w[16] + x[3] * w[17] + x[5] * w[18] + x[7] * w[19];
-//       b1 = x[1] * w[20] + x[3] * w[21] + x[5] * w[22] + x[7] * w[23];
-//       b2 = x[1] * w[24] + x[3] * w[25] + x[5] * w[26] + x[7] * w[27];
-//       b3 = x[1] * w[28] + x[3] * w[29] + x[5] * w[30] + x[7] * w[31];
-//
-//       y[0] = SHIFT_ROUND ( a0 + b0 );
-//       y[1] = SHIFT_ROUND ( a1 + b1 );
-//       y[2] = SHIFT_ROUND ( a2 + b2 );
-//       y[3] = SHIFT_ROUND ( a3 + b3 );
-//       y[4] = SHIFT_ROUND ( a3 - b3 );
-//       y[5] = SHIFT_ROUND ( a2 - b2 );
-//       y[6] = SHIFT_ROUND ( a1 - b1 );
-//       y[7] = SHIFT_ROUND ( a0 - b0 );
-// }
-//
-//-----------------------------------------------------------------------------
-//
-// In this implementation the outputs of the iDCT-1D are multiplied
-//       for rows 0,4 - by cos_4_16,
-//       for rows 1,7 - by cos_1_16,
-//       for rows 2,6 - by cos_2_16,
-//       for rows 3,5 - by cos_3_16
-// and are shifted to the left for better accuracy
-//
-// For the constants used,
-//       FIX(float_const) = (short) (float_const * (1<<15) + 0.5)
-//
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-// Tables for mmx processors
-//-----------------------------------------------------------------------------
-
-// Table for rows 0,4 - constants are multiplied by cos_4_16
-DECLARE_ALIGNED(8, static const int16_t, tab_i_04_mmx)[32*4] = {
-  16384,16384,16384,-16384,       // movq-> w06 w04 w02 w00
-  21407,8867,8867,-21407,         // w07 w05 w03 w01
-  16384,-16384,16384,16384,       // w14 w12 w10 w08
-  -8867,21407,-21407,-8867,       // w15 w13 w11 w09
-  22725,12873,19266,-22725,       // w22 w20 w18 w16
-  19266,4520,-4520,-12873,        // w23 w21 w19 w17
-  12873,4520,4520,19266,          // w30 w28 w26 w24
-  -22725,19266,-12873,-22725,     // w31 w29 w27 w25
-// Table for rows 1,7 - constants are multiplied by cos_1_16
-  22725,22725,22725,-22725,       // movq-> w06 w04 w02 w00
-  29692,12299,12299,-29692,       // w07 w05 w03 w01
-  22725,-22725,22725,22725,       // w14 w12 w10 w08
-  -12299,29692,-29692,-12299,     // w15 w13 w11 w09
-  31521,17855,26722,-31521,       // w22 w20 w18 w16
-  26722,6270,-6270,-17855,        // w23 w21 w19 w17
-  17855,6270,6270,26722,          // w30 w28 w26 w24
-  -31521,26722,-17855,-31521,     // w31 w29 w27 w25
-// Table for rows 2,6 - constants are multiplied by cos_2_16
-  21407,21407,21407,-21407,       // movq-> w06 w04 w02 w00
-  27969,11585,11585,-27969,       // w07 w05 w03 w01
-  21407,-21407,21407,21407,       // w14 w12 w10 w08
-  -11585,27969,-27969,-11585,     // w15 w13 w11 w09
-  29692,16819,25172,-29692,       // w22 w20 w18 w16
-  25172,5906,-5906,-16819,        // w23 w21 w19 w17
-  16819,5906,5906,25172,          // w30 w28 w26 w24
-  -29692,25172,-16819,-29692,     // w31 w29 w27 w25
-// Table for rows 3,5 - constants are multiplied by cos_3_16
-  19266,19266,19266,-19266,       // movq-> w06 w04 w02 w00
-  25172,10426,10426,-25172,       // w07 w05 w03 w01
-  19266,-19266,19266,19266,       // w14 w12 w10 w08
-  -10426,25172,-25172,-10426,     // w15 w13 w11 w09
-  26722,15137,22654,-26722,       // w22 w20 w18 w16
-  22654,5315,-5315,-15137,        // w23 w21 w19 w17
-  15137,5315,5315,22654,          // w30 w28 w26 w24
-  -26722,22654,-15137,-26722,     // w31 w29 w27 w25
-};
-//-----------------------------------------------------------------------------
-// Tables for xmm processors
-//-----------------------------------------------------------------------------
-
-// %3 for rows 0,4 - constants are multiplied by cos_4_16
-DECLARE_ALIGNED(8, static const int16_t, tab_i_04_xmm)[32*4] = {
-  16384,21407,16384,8867,      // movq-> w05 w04 w01 w00
-  16384,8867,-16384,-21407,    // w07 w06 w03 w02
-  16384,-8867,16384,-21407,    // w13 w12 w09 w08
-  -16384,21407,16384,-8867,    // w15 w14 w11 w10
-  22725,19266,19266,-4520,     // w21 w20 w17 w16
-  12873,4520,-22725,-12873,    // w23 w22 w19 w18
-  12873,-22725,4520,-12873,    // w29 w28 w25 w24
-  4520,19266,19266,-22725,     // w31 w30 w27 w26
-// %3 for rows 1,7 - constants are multiplied by cos_1_16
-  22725,29692,22725,12299,     // movq-> w05 w04 w01 w00
-  22725,12299,-22725,-29692,   // w07 w06 w03 w02
-  22725,-12299,22725,-29692,   // w13 w12 w09 w08
-  -22725,29692,22725,-12299,   // w15 w14 w11 w10
-  31521,26722,26722,-6270,     // w21 w20 w17 w16
-  17855,6270,-31521,-17855,    // w23 w22 w19 w18
-  17855,-31521,6270,-17855,    // w29 w28 w25 w24
-  6270,26722,26722,-31521,     // w31 w30 w27 w26
-// %3 for rows 2,6 - constants are multiplied by cos_2_16
-  21407,27969,21407,11585,     // movq-> w05 w04 w01 w00
-  21407,11585,-21407,-27969,   // w07 w06 w03 w02
-  21407,-11585,21407,-27969,   // w13 w12 w09 w08
-  -21407,27969,21407,-11585,   // w15 w14 w11 w10
-  29692,25172,25172,-5906,     // w21 w20 w17 w16
-  16819,5906,-29692,-16819,    // w23 w22 w19 w18
-  16819,-29692,5906,-16819,    // w29 w28 w25 w24
-  5906,25172,25172,-29692,     // w31 w30 w27 w26
-// %3 for rows 3,5 - constants are multiplied by cos_3_16
-  19266,25172,19266,10426,     // movq-> w05 w04 w01 w00
-  19266,10426,-19266,-25172,   // w07 w06 w03 w02
-  19266,-10426,19266,-25172,   // w13 w12 w09 w08
-  -19266,25172,19266,-10426,   // w15 w14 w11 w10
-  26722,22654,22654,-5315,     // w21 w20 w17 w16
-  15137,5315,-26722,-15137,    // w23 w22 w19 w18
-  15137,-26722,5315,-15137,    // w29 w28 w25 w24
-  5315,22654,22654,-26722,     // w31 w30 w27 w26
-};
-//=============================================================================
-// Helper macros for the code
-//=============================================================================
-
-//-----------------------------------------------------------------------------
-// DCT_8_INV_ROW_MMX( INP, OUT, TABLE, ROUNDER
-//-----------------------------------------------------------------------------
-
-#define DCT_8_INV_ROW_MMX(A1,A2,A3,A4)\
-  "movq " #A1 ",%%mm0              \n\t"/* 0 ; x3 x2 x1 x0*/\
-  "movq 8+" #A1 ",%%mm1            \n\t"/* 1 ; x7 x6 x5 x4*/\
-  "movq %%mm0,%%mm2            \n\t"/* 2  ; x3 x2 x1 x0*/\
-  "movq " #A3 ",%%mm3              \n\t"/* 3 ; w06 w04 w02 w00*/\
-  "punpcklwd %%mm1,%%mm0       \n\t"/* x5 x1 x4 x0*/\
-  "movq %%mm0,%%mm5            \n\t"/* 5 ; x5 x1 x4 x0*/\
-  "punpckldq %%mm0,%%mm0       \n\t"/* x4 x0 x4 x0*/\
-  "movq 8+" #A3 ",%%mm4            \n\t"/* 4 ; w07 w05 w03 w01*/\
-  "punpckhwd %%mm1,%%mm2       \n\t"/* 1 ; x7 x3 x6 x2*/\
-  "pmaddwd %%mm0,%%mm3         \n\t"/* x4*w06+x0*w04 x4*w02+x0*w00*/\
-  "movq %%mm2,%%mm6            \n\t"/* 6 ; x7 x3 x6 x2*/\
-  "movq 32+" #A3 ",%%mm1           \n\t"/* 1 ; w22 w20 w18 w16*/\
-  "punpckldq %%mm2,%%mm2       \n\t"/* x6 x2 x6 x2*/\
-  "pmaddwd %%mm2,%%mm4         \n\t"/* x6*w07+x2*w05 x6*w03+x2*w01*/\
-  "punpckhdq %%mm5,%%mm5       \n\t"/* x5 x1 x5 x1*/\
-  "pmaddwd 16+" #A3 ",%%mm0        \n\t"/* x4*w14+x0*w12 x4*w10+x0*w08*/\
-  "punpckhdq %%mm6,%%mm6       \n\t"/* x7 x3 x7 x3*/\
-  "movq 40+" #A3 ",%%mm7           \n\t"/* 7 ; w23 w21 w19 w17*/\
-  "pmaddwd %%mm5,%%mm1         \n\t"/* x5*w22+x1*w20 x5*w18+x1*w16*/\
-  "paddd " #A4 ",%%mm3             \n\t"/* +%4*/\
-  "pmaddwd %%mm6,%%mm7         \n\t"/* x7*w23+x3*w21 x7*w19+x3*w17*/\
-  "pmaddwd 24+" #A3 ",%%mm2        \n\t"/* x6*w15+x2*w13 x6*w11+x2*w09*/\
-  "paddd %%mm4,%%mm3           \n\t"/* 4 ; a1=sum(even1) a0=sum(even0)*/\
-  "pmaddwd 48+" #A3 ",%%mm5        \n\t"/* x5*w30+x1*w28 x5*w26+x1*w24*/\
-  "movq %%mm3,%%mm4            \n\t"/* 4 ; a1 a0*/\
-  "pmaddwd 56+" #A3 ",%%mm6        \n\t"/* x7*w31+x3*w29 x7*w27+x3*w25*/\
-  "paddd %%mm7,%%mm1           \n\t"/* 7 ; b1=sum(odd1) b0=sum(odd0)*/\
-  "paddd " #A4 ",%%mm0             \n\t"/* +%4*/\
-  "psubd %%mm1,%%mm3           \n\t"/* a1-b1 a0-b0*/\
-  "psrad $11,%%mm3 \n\t"/* y6=a1-b1 y7=a0-b0*/\
-  "paddd %%mm4,%%mm1           \n\t"/* 4 ; a1+b1 a0+b0*/\
-  "paddd %%mm2,%%mm0           \n\t"/* 2 ; a3=sum(even3) a2=sum(even2)*/\
-  "psrad $11,%%mm1 \n\t"/* y1=a1+b1 y0=a0+b0*/\
-  "paddd %%mm6,%%mm5           \n\t"/* 6 ; b3=sum(odd3) b2=sum(odd2)*/\
-  "movq %%mm0,%%mm4            \n\t"/* 4 ; a3 a2*/\
-  "paddd %%mm5,%%mm0           \n\t"/* a3+b3 a2+b2*/\
-  "psubd %%mm5,%%mm4           \n\t"/* 5 ; a3-b3 a2-b2*/\
-  "psrad $11,%%mm0 \n\t"/* y3=a3+b3 y2=a2+b2*/\
-  "psrad $11,%%mm4 \n\t"/* y4=a3-b3 y5=a2-b2*/\
-  "packssdw %%mm0,%%mm1        \n\t"/* 0 ; y3 y2 y1 y0*/\
-  "packssdw %%mm3,%%mm4        \n\t"/* 3 ; y6 y7 y4 y5*/\
-  "movq %%mm4,%%mm7            \n\t"/* 7 ; y6 y7 y4 y5*/\
-  "psrld $16,%%mm4            \n\t"/* 0 y6 0 y4*/\
-  "pslld $16,%%mm7            \n\t"/* y7 0 y5 0*/\
-  "movq %%mm1," #A2 "              \n\t"/* 1 ; save y3 y2 y1 y0*/\
-  "por %%mm4,%%mm7             \n\t"/* 4 ; y7 y6 y5 y4*/\
-  "movq %%mm7,8            +" #A2 "\n\t"/* 7 ; save y7 y6 y5 y4*/\
-
-
-//-----------------------------------------------------------------------------
-// DCT_8_INV_ROW_XMM( INP, OUT, TABLE, ROUNDER
-//-----------------------------------------------------------------------------
-
-#define DCT_8_INV_ROW_XMM(A1,A2,A3,A4)\
-  "movq " #A1 ",%%mm0                  \n\t"/* 0     ; x3 x2 x1 x0*/\
-  "movq 8+" #A1 ",%%mm1                \n\t"/* 1     ; x7 x6 x5 x4*/\
-  "movq %%mm0,%%mm2                \n\t"/* 2     ; x3 x2 x1 x0*/\
-  "movq " #A3 ",%%mm3                  \n\t"/* 3     ; w05 w04 w01 w00*/\
-  "pshufw $0x88,%%mm0,%%mm0        \n\t"/* x2 x0 x2 x0*/\
-  "movq 8+" #A3 ",%%mm4                \n\t"/* 4     ; w07 w06 w03 w02*/\
-  "movq %%mm1,%%mm5                \n\t"/* 5     ; x7 x6 x5 x4*/\
-  "pmaddwd %%mm0,%%mm3             \n\t"/* x2*w05+x0*w04 x2*w01+x0*w00*/\
-  "movq 32+" #A3 ",%%mm6               \n\t"/* 6     ; w21 w20 w17 w16*/\
-  "pshufw $0x88,%%mm1,%%mm1        \n\t"/* x6 x4 x6 x4*/\
-  "pmaddwd %%mm1,%%mm4             \n\t"/* x6*w07+x4*w06 x6*w03+x4*w02*/\
-  "movq 40+" #A3 ",%%mm7               \n\t"/* 7    ; w23 w22 w19 w18*/\
-  "pshufw $0xdd,%%mm2,%%mm2        \n\t"/* x3 x1 x3 x1*/\
-  "pmaddwd %%mm2,%%mm6             \n\t"/* x3*w21+x1*w20 x3*w17+x1*w16*/\
-  "pshufw $0xdd,%%mm5,%%mm5        \n\t"/* x7 x5 x7 x5*/\
-  "pmaddwd %%mm5,%%mm7             \n\t"/* x7*w23+x5*w22 x7*w19+x5*w18*/\
-  "paddd " #A4 ",%%mm3                 \n\t"/* +%4*/\
-  "pmaddwd 16+" #A3 ",%%mm0            \n\t"/* x2*w13+x0*w12 x2*w09+x0*w08*/\
-  "paddd %%mm4,%%mm3               \n\t"/* 4     ; a1=sum(even1) a0=sum(even0)*/\
-  "pmaddwd 24+" #A3 ",%%mm1            \n\t"/* x6*w15+x4*w14 x6*w11+x4*w10*/\
-  "movq %%mm3,%%mm4                \n\t"/* 4     ; a1 a0*/\
-  "pmaddwd 48+" #A3 ",%%mm2            \n\t"/* x3*w29+x1*w28 x3*w25+x1*w24*/\
-  "paddd %%mm7,%%mm6               \n\t"/* 7     ; b1=sum(odd1) b0=sum(odd0)*/\
-  "pmaddwd 56+" #A3 ",%%mm5            \n\t"/* x7*w31+x5*w30 x7*w27+x5*w26*/\
-  "paddd %%mm6,%%mm3               \n\t"/* a1+b1 a0+b0*/\
-  "paddd " #A4 ",%%mm0                 \n\t"/* +%4*/\
-  "psrad $11,%%mm3     \n\t"/* y1=a1+b1 y0=a0+b0*/\
-  "paddd %%mm1,%%mm0               \n\t"/* 1     ; a3=sum(even3) a2=sum(even2)*/\
-  "psubd %%mm6,%%mm4               \n\t"/* 6     ; a1-b1 a0-b0*/\
-  "movq %%mm0,%%mm7                \n\t"/* 7     ; a3 a2*/\
-  "paddd %%mm5,%%mm2               \n\t"/* 5     ; b3=sum(odd3) b2=sum(odd2)*/\
-  "paddd %%mm2,%%mm0               \n\t"/* a3+b3 a2+b2*/\
-  "psrad $11,%%mm4     \n\t"/* y6=a1-b1 y7=a0-b0*/\
-  "psubd %%mm2,%%mm7               \n\t"/* 2     ; a3-b3 a2-b2*/\
-  "psrad $11,%%mm0     \n\t"/* y3=a3+b3 y2=a2+b2*/\
-  "psrad $11,%%mm7     \n\t"/* y4=a3-b3 y5=a2-b2*/\
-  "packssdw %%mm0,%%mm3            \n\t"/* 0     ; y3 y2 y1 y0*/\
-  "packssdw %%mm4,%%mm7            \n\t"/* 4     ; y6 y7 y4 y5*/\
-  "movq %%mm3, " #A2 "                  \n\t"/* 3     ; save y3 y2 y1 y0*/\
-  "pshufw $0xb1,%%mm7,%%mm7        \n\t"/* y7 y6 y5 y4*/\
-  "movq %%mm7,8                +" #A2 "\n\t"/* 7     ; save y7 y6 y5 y4*/\
-
-
-//-----------------------------------------------------------------------------
-//
-// The first stage DCT 8x8 - forward DCTs of columns
-//
-// The %2puts are multiplied
-// for rows 0,4 - on cos_4_16,
-// for rows 1,7 - on cos_1_16,
-// for rows 2,6 - on cos_2_16,
-// for rows 3,5 - on cos_3_16
-// and are shifted to the left for rise of accuracy
-//
-//-----------------------------------------------------------------------------
-//
-// The 8-point scaled forward DCT algorithm (26a8m)
-//
-//-----------------------------------------------------------------------------
-//
-// #define DCT_8_FRW_COL(x, y)
-//{
-// short t0, t1, t2, t3, t4, t5, t6, t7;
-// short tp03, tm03, tp12, tm12, tp65, tm65;
-// short tp465, tm465, tp765, tm765;
-//
-// t0 = LEFT_SHIFT ( x[0] + x[7] );
-// t1 = LEFT_SHIFT ( x[1] + x[6] );
-// t2 = LEFT_SHIFT ( x[2] + x[5] );
-// t3 = LEFT_SHIFT ( x[3] + x[4] );
-// t4 = LEFT_SHIFT ( x[3] - x[4] );
-// t5 = LEFT_SHIFT ( x[2] - x[5] );
-// t6 = LEFT_SHIFT ( x[1] - x[6] );
-// t7 = LEFT_SHIFT ( x[0] - x[7] );
-//
-// tp03 = t0 + t3;
-// tm03 = t0 - t3;
-// tp12 = t1 + t2;
-// tm12 = t1 - t2;
-//
-// y[0] = tp03 + tp12;
-// y[4] = tp03 - tp12;
-//
-// y[2] = tm03 + tm12 * tg_2_16;
-// y[6] = tm03 * tg_2_16 - tm12;
-//
-// tp65 =(t6 +t5 )*cos_4_16;
-// tm65 =(t6 -t5 )*cos_4_16;
-//
-// tp765 = t7 + tp65;
-// tm765 = t7 - tp65;
-// tp465 = t4 + tm65;
-// tm465 = t4 - tm65;
-//
-// y[1] = tp765 + tp465 * tg_1_16;
-// y[7] = tp765 * tg_1_16 - tp465;
-// y[5] = tm765 * tg_3_16 + tm465;
-// y[3] = tm765 - tm465 * tg_3_16;
-//}
-//
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-// DCT_8_INV_COL_4  INP,OUT
-//-----------------------------------------------------------------------------
-
-#define DCT_8_INV_COL(A1,A2)\
-  "movq 2*8(%3),%%mm0\n\t"\
-  "movq 16*3+" #A1 ",%%mm3\n\t"\
-  "movq %%mm0,%%mm1            \n\t"/* tg_3_16*/\
-  "movq 16*5+" #A1 ",%%mm5\n\t"\
-  "pmulhw %%mm3,%%mm0          \n\t"/* x3*(tg_3_16-1)*/\
-  "movq (%3),%%mm4\n\t"\
-  "pmulhw %%mm5,%%mm1          \n\t"/* x5*(tg_3_16-1)*/\
-  "movq 16*7+" #A1 ",%%mm7\n\t"\
-  "movq %%mm4,%%mm2            \n\t"/* tg_1_16*/\
-  "movq 16*1+" #A1 ",%%mm6\n\t"\
-  "pmulhw %%mm7,%%mm4          \n\t"/* x7*tg_1_16*/\
-  "paddsw %%mm3,%%mm0          \n\t"/* x3*tg_3_16*/\
-  "pmulhw %%mm6,%%mm2          \n\t"/* x1*tg_1_16*/\
-  "paddsw %%mm3,%%mm1          \n\t"/* x3+x5*(tg_3_16-1)*/\
-  "psubsw %%mm5,%%mm0          \n\t"/* x3*tg_3_16-x5 = tm35*/\
-  "movq 3*8(%3),%%mm3\n\t"\
-  "paddsw %%mm5,%%mm1          \n\t"/* x3+x5*tg_3_16 = tp35*/\
-  "paddsw %%mm6,%%mm4          \n\t"/* x1+tg_1_16*x7 = tp17*/\
-  "psubsw %%mm7,%%mm2          \n\t"/* x1*tg_1_16-x7 = tm17*/\
-  "movq %%mm4,%%mm5            \n\t"/* tp17*/\
-  "movq %%mm2,%%mm6            \n\t"/* tm17*/\
-  "paddsw %%mm1,%%mm5          \n\t"/* tp17+tp35 = b0*/\
-  "psubsw %%mm0,%%mm6          \n\t"/* tm17-tm35 = b3*/\
-  "psubsw %%mm1,%%mm4          \n\t"/* tp17-tp35 = t1*/\
-  "paddsw %%mm0,%%mm2          \n\t"/* tm17+tm35 = t2*/\
-  "movq 1*8(%3),%%mm7\n\t"\
-  "movq %%mm4,%%mm1            \n\t"/* t1*/\
-  "movq %%mm5,3*16         +" #A2 "\n\t"/* save b0*/\
-  "paddsw %%mm2,%%mm1          \n\t"/* t1+t2*/\
-  "movq %%mm6,5*16         +" #A2 "\n\t"/* save b3*/\
-  "psubsw %%mm2,%%mm4          \n\t"/* t1-t2*/\
-  "movq 2*16+" #A1 ",%%mm5\n\t"\
-  "movq %%mm7,%%mm0            \n\t"/* tg_2_16*/\
-  "movq 6*16+" #A1 ",%%mm6\n\t"\
-  "pmulhw %%mm5,%%mm0          \n\t"/* x2*tg_2_16*/\
-  "pmulhw %%mm6,%%mm7          \n\t"/* x6*tg_2_16*/\
-  "pmulhw %%mm3,%%mm1          \n\t"/* ocos_4_16*(t1+t2) = b1/2*/\
-  "movq 0*16+" #A1 ",%%mm2\n\t"\
-  "pmulhw %%mm3,%%mm4          \n\t"/* ocos_4_16*(t1-t2) = b2/2*/\
-  "psubsw %%mm6,%%mm0          \n\t"/* t2*tg_2_16-x6 = tm26*/\
-  "movq %%mm2,%%mm3            \n\t"/* x0*/\
-  "movq 4*16+" #A1 ",%%mm6\n\t"\
-  "paddsw %%mm5,%%mm7          \n\t"/* x2+x6*tg_2_16 = tp26*/\
-  "paddsw %%mm6,%%mm2          \n\t"/* x0+x4 = tp04*/\
-  "psubsw %%mm6,%%mm3          \n\t"/* x0-x4 = tm04*/\
-  "movq %%mm2,%%mm5            \n\t"/* tp04*/\
-  "movq %%mm3,%%mm6            \n\t"/* tm04*/\
-  "psubsw %%mm7,%%mm2          \n\t"/* tp04-tp26 = a3*/\
-  "paddsw %%mm0,%%mm3          \n\t"/* tm04+tm26 = a1*/\
-  "paddsw %%mm1,%%mm1          \n\t"/* b1*/\
-  "paddsw %%mm4,%%mm4          \n\t"/* b2*/\
-  "paddsw %%mm7,%%mm5          \n\t"/* tp04+tp26 = a0*/\
-  "psubsw %%mm0,%%mm6          \n\t"/* tm04-tm26 = a2*/\
-  "movq %%mm3,%%mm7            \n\t"/* a1*/\
-  "movq %%mm6,%%mm0            \n\t"/* a2*/\
-  "paddsw %%mm1,%%mm3          \n\t"/* a1+b1*/\
-  "paddsw %%mm4,%%mm6          \n\t"/* a2+b2*/\
-  "psraw $6,%%mm3 \n\t"/* dst1*/\
-  "psubsw %%mm1,%%mm7          \n\t"/* a1-b1*/\
-  "psraw $6,%%mm6 \n\t"/* dst2*/\
-  "psubsw %%mm4,%%mm0          \n\t"/* a2-b2*/\
-  "movq 3*16+" #A2 ",%%mm1         \n\t"/* load b0*/\
-  "psraw $6,%%mm7 \n\t"/* dst6*/\
-  "movq %%mm5,%%mm4            \n\t"/* a0*/\
-  "psraw $6,%%mm0 \n\t"/* dst5*/\
-  "movq %%mm3,1*16+" #A2 "\n\t"\
-  "paddsw %%mm1,%%mm5          \n\t"/* a0+b0*/\
-  "movq %%mm6,2*16+" #A2 "\n\t"\
-  "psubsw %%mm1,%%mm4          \n\t"/* a0-b0*/\
-  "movq 5*16+" #A2 ",%%mm3         \n\t"/* load b3*/\
-  "psraw $6,%%mm5 \n\t"/* dst0*/\
-  "movq %%mm2,%%mm6            \n\t"/* a3*/\
-  "psraw $6,%%mm4 \n\t"/* dst7*/\
-  "movq %%mm0,5*16+" #A2 "\n\t"\
-  "paddsw %%mm3,%%mm2          \n\t"/* a3+b3*/\
-  "movq %%mm7,6*16+" #A2 "\n\t"\
-  "psubsw %%mm3,%%mm6          \n\t"/* a3-b3*/\
-  "movq %%mm5,0*16+" #A2 "\n\t"\
-  "psraw $6,%%mm2 \n\t"/* dst3*/\
-  "movq %%mm4,7*16+" #A2 "\n\t"\
-  "psraw $6,%%mm6 \n\t"/* dst4*/\
-  "movq %%mm2,3*16+" #A2 "\n\t"\
-  "movq %%mm6,4*16+" #A2 "\n\t"
-
-//=============================================================================
-// Code
-//=============================================================================
-
-//-----------------------------------------------------------------------------
-// void idct_mmx(uint16_t block[64]);
-//-----------------------------------------------------------------------------
-
-
-void ff_idct_xvid_mmx(short *block){
-__asm__ volatile(
-            //# Process each row
-    DCT_8_INV_ROW_MMX(0*16(%0), 0*16(%0), 64*0(%2), 8*0(%1))
-    DCT_8_INV_ROW_MMX(1*16(%0), 1*16(%0), 64*1(%2), 8*1(%1))
-    DCT_8_INV_ROW_MMX(2*16(%0), 2*16(%0), 64*2(%2), 8*2(%1))
-    DCT_8_INV_ROW_MMX(3*16(%0), 3*16(%0), 64*3(%2), 8*3(%1))
-    DCT_8_INV_ROW_MMX(4*16(%0), 4*16(%0), 64*0(%2), 8*4(%1))
-    DCT_8_INV_ROW_MMX(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1))
-    DCT_8_INV_ROW_MMX(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1))
-    DCT_8_INV_ROW_MMX(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1))
-
-            //# Process the columns (4 at a time)
-    DCT_8_INV_COL(0(%0), 0(%0))
-    DCT_8_INV_COL(8(%0), 8(%0))
-    :: "r"(block), "r"(rounder_0), "r"(tab_i_04_mmx), "r"(tg_1_16));
-}
-
-//-----------------------------------------------------------------------------
-// void idct_xmm(uint16_t block[64]);
-//-----------------------------------------------------------------------------
-
-
-void ff_idct_xvid_mmx2(short *block){
-__asm__ volatile(
-            //# Process each row
-    DCT_8_INV_ROW_XMM(0*16(%0), 0*16(%0), 64*0(%2), 8*0(%1))
-    DCT_8_INV_ROW_XMM(1*16(%0), 1*16(%0), 64*1(%2), 8*1(%1))
-    DCT_8_INV_ROW_XMM(2*16(%0), 2*16(%0), 64*2(%2), 8*2(%1))
-    DCT_8_INV_ROW_XMM(3*16(%0), 3*16(%0), 64*3(%2), 8*3(%1))
-    DCT_8_INV_ROW_XMM(4*16(%0), 4*16(%0), 64*0(%2), 8*4(%1))
-    DCT_8_INV_ROW_XMM(5*16(%0), 5*16(%0), 64*3(%2), 8*5(%1))
-    DCT_8_INV_ROW_XMM(6*16(%0), 6*16(%0), 64*2(%2), 8*6(%1))
-    DCT_8_INV_ROW_XMM(7*16(%0), 7*16(%0), 64*1(%2), 8*7(%1))
-
-            //# Process the columns (4 at a time)
-    DCT_8_INV_COL(0(%0), 0(%0))
-    DCT_8_INV_COL(8(%0), 8(%0))
-    :: "r"(block), "r"(rounder_0), "r"(tab_i_04_xmm), "r"(tg_1_16));
-}
-
diff --git a/libavcodec/x86/idct_sse2_xvid.c b/libavcodec/x86/idct_sse2_xvid.c
deleted file mode 100644
index fc670e2..0000000
--- a/libavcodec/x86/idct_sse2_xvid.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- * XVID MPEG-4 VIDEO CODEC
- * - SSE2 inverse discrete cosine transform -
- *
- * Copyright(C) 2003 Pascal Massimino <skal at planet-d.net>
- *
- * Conversion to gcc syntax with modifications
- * by Alexander Strange <astrange at ithinksw.com>
- *
- * Originally from dct/x86_asm/fdct_sse2_skal.asm in Xvid.
- *
- * This file is part of FFmpeg.
- *
- * Vertical pass is an implementation of the scheme:
- *  Loeffler C., Ligtenberg A., and Moschytz C.S.:
- *  Practical Fast 1D DCT Algorithm with Eleven Multiplications,
- *  Proc. ICASSP 1989, 988-991.
- *
- * Horizontal pass is a double 4x4 vector/matrix multiplication,
- * (see also Intel's Application Note 922:
- *  http://developer.intel.com/vtune/cbts/strmsimd/922down.htm
- *  Copyright (C) 1999 Intel Corporation)
- *
- * More details at http://skal.planet-d.net/coding/dct.html
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/dsputil.h"
-#include "idct_xvid.h"
-#include "dsputil_mmx.h"
-
-/*!
- * @file
- * @brief SSE2 idct compatible with xvidmmx
- */
-
-#define X8(x)     x,x,x,x,x,x,x,x
-
-#define ROW_SHIFT 11
-#define COL_SHIFT 6
-
-DECLARE_ASM_CONST(16, int16_t, tan1)[] = {X8(13036)}; // tan( pi/16)
-DECLARE_ASM_CONST(16, int16_t, tan2)[] = {X8(27146)}; // tan(2pi/16) = sqrt(2)-1
-DECLARE_ASM_CONST(16, int16_t, tan3)[] = {X8(43790)}; // tan(3pi/16)-1
-DECLARE_ASM_CONST(16, int16_t, sqrt2)[]= {X8(23170)}; // 0.5/sqrt(2)
-DECLARE_ASM_CONST(8,  uint8_t, m127)[] = {X8(127)};
-
-DECLARE_ASM_CONST(16, int16_t, iTab1)[] = {
- 0x4000, 0x539f, 0xc000, 0xac61, 0x4000, 0xdd5d, 0x4000, 0xdd5d,
- 0x4000, 0x22a3, 0x4000, 0x22a3, 0xc000, 0x539f, 0x4000, 0xac61,
- 0x3249, 0x11a8, 0x4b42, 0xee58, 0x11a8, 0x4b42, 0x11a8, 0xcdb7,
- 0x58c5, 0x4b42, 0xa73b, 0xcdb7, 0x3249, 0xa73b, 0x4b42, 0xa73b
-};
-
-DECLARE_ASM_CONST(16, int16_t, iTab2)[] = {
- 0x58c5, 0x73fc, 0xa73b, 0x8c04, 0x58c5, 0xcff5, 0x58c5, 0xcff5,
- 0x58c5, 0x300b, 0x58c5, 0x300b, 0xa73b, 0x73fc, 0x58c5, 0x8c04,
- 0x45bf, 0x187e, 0x6862, 0xe782, 0x187e, 0x6862, 0x187e, 0xba41,
- 0x7b21, 0x6862, 0x84df, 0xba41, 0x45bf, 0x84df, 0x6862, 0x84df
-};
-
-DECLARE_ASM_CONST(16, int16_t, iTab3)[] = {
- 0x539f, 0x6d41, 0xac61, 0x92bf, 0x539f, 0xd2bf, 0x539f, 0xd2bf,
- 0x539f, 0x2d41, 0x539f, 0x2d41, 0xac61, 0x6d41, 0x539f, 0x92bf,
- 0x41b3, 0x1712, 0x6254, 0xe8ee, 0x1712, 0x6254, 0x1712, 0xbe4d,
- 0x73fc, 0x6254, 0x8c04, 0xbe4d, 0x41b3, 0x8c04, 0x6254, 0x8c04
-};
-
-DECLARE_ASM_CONST(16, int16_t, iTab4)[] = {
- 0x4b42, 0x6254, 0xb4be, 0x9dac, 0x4b42, 0xd746, 0x4b42, 0xd746,
- 0x4b42, 0x28ba, 0x4b42, 0x28ba, 0xb4be, 0x6254, 0x4b42, 0x9dac,
- 0x3b21, 0x14c3, 0x587e, 0xeb3d, 0x14c3, 0x587e, 0x14c3, 0xc4df,
- 0x6862, 0x587e, 0x979e, 0xc4df, 0x3b21, 0x979e, 0x587e, 0x979e
-};
-
-DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders)[] = {
- 65536, 65536, 65536, 65536,
-  3597,  3597,  3597,  3597,
-  2260,  2260,  2260,  2260,
-  1203,  1203,  1203,  1203,
-   120,   120,   120,   120,
-   512,   512,   512,   512
-};
-
-// Temporary storage before the column pass
-#define ROW1 "%%xmm6"
-#define ROW3 "%%xmm4"
-#define ROW5 "%%xmm5"
-#define ROW7 "%%xmm7"
-
-#define CLEAR_ODD(r) "pxor  "r","r" \n\t"
-#define PUT_ODD(dst) "pshufhw  $0x1B, %%xmm2, "dst"   \n\t"
-
-#if ARCH_X86_64
-
-# define ROW0 "%%xmm8"
-# define REG0 ROW0
-# define ROW2 "%%xmm9"
-# define REG2 ROW2
-# define ROW4 "%%xmm10"
-# define REG4 ROW4
-# define ROW6 "%%xmm11"
-# define REG6 ROW6
-# define CLEAR_EVEN(r) CLEAR_ODD(r)
-# define PUT_EVEN(dst) PUT_ODD(dst)
-# define XMMS "%%xmm12"
-# define MOV_32_ONLY "#"
-# define SREG2 REG2
-# define TAN3 "%%xmm13"
-# define TAN1 "%%xmm14"
-
-#else
-
-# define ROW0 "(%0)"
-# define REG0 "%%xmm4"
-# define ROW2 "2*16(%0)"
-# define REG2 "%%xmm4"
-# define ROW4 "4*16(%0)"
-# define REG4 "%%xmm6"
-# define ROW6 "6*16(%0)"
-# define REG6 "%%xmm6"
-# define CLEAR_EVEN(r)
-# define PUT_EVEN(dst) \
-    "pshufhw  $0x1B, %%xmm2, %%xmm2   \n\t" \
-    "movdqa          %%xmm2, "dst"    \n\t"
-# define XMMS "%%xmm2"
-# define MOV_32_ONLY "movdqa "
-# define SREG2 "%%xmm7"
-# define TAN3 "%%xmm0"
-# define TAN1 "%%xmm2"
-
-#endif
-
-#define ROUND(x) "paddd   "MANGLE(x)
-
-#define JZ(reg, to)                         \
-    "testl     "reg","reg"            \n\t" \
-    "jz        "to"                   \n\t"
-
-#define JNZ(reg, to)                        \
-    "testl     "reg","reg"            \n\t" \
-    "jnz       "to"                   \n\t"
-
-#define TEST_ONE_ROW(src, reg, clear)       \
-    clear                                   \
-    "movq     "src", %%mm1            \n\t" \
-    "por    8+"src", %%mm1            \n\t" \
-    "paddusb  %%mm0, %%mm1            \n\t" \
-    "pmovmskb %%mm1, "reg"            \n\t"
-
-#define TEST_TWO_ROWS(row1, row2, reg1, reg2, clear1, clear2) \
-    clear1                                  \
-    clear2                                  \
-    "movq     "row1", %%mm1           \n\t" \
-    "por    8+"row1", %%mm1           \n\t" \
-    "movq     "row2", %%mm2           \n\t" \
-    "por    8+"row2", %%mm2           \n\t" \
-    "paddusb   %%mm0, %%mm1           \n\t" \
-    "paddusb   %%mm0, %%mm2           \n\t" \
-    "pmovmskb  %%mm1, "reg1"          \n\t" \
-    "pmovmskb  %%mm2, "reg2"          \n\t"
-
-///IDCT pass on rows.
-#define iMTX_MULT(src, table, rounder, put) \
-    "movdqa        "src", %%xmm3      \n\t" \
-    "movdqa       %%xmm3, %%xmm0      \n\t" \
-    "pshufd   $0x11, %%xmm3, %%xmm1   \n\t" /* 4602 */ \
-    "punpcklqdq   %%xmm0, %%xmm0      \n\t" /* 0246 */ \
-    "pmaddwd     "table", %%xmm0      \n\t" \
-    "pmaddwd  16+"table", %%xmm1      \n\t" \
-    "pshufd   $0xBB, %%xmm3, %%xmm2   \n\t" /* 5713 */ \
-    "punpckhqdq   %%xmm3, %%xmm3      \n\t" /* 1357 */ \
-    "pmaddwd  32+"table", %%xmm2      \n\t" \
-    "pmaddwd  48+"table", %%xmm3      \n\t" \
-    "paddd        %%xmm1, %%xmm0      \n\t" \
-    "paddd        %%xmm3, %%xmm2      \n\t" \
-    rounder",     %%xmm0              \n\t" \
-    "movdqa       %%xmm2, %%xmm3      \n\t" \
-    "paddd        %%xmm0, %%xmm2      \n\t" \
-    "psubd        %%xmm3, %%xmm0      \n\t" \
-    "psrad           $11, %%xmm2      \n\t" \
-    "psrad           $11, %%xmm0      \n\t" \
-    "packssdw     %%xmm0, %%xmm2      \n\t" \
-    put                                     \
-    "1:                               \n\t"
-
-#define iLLM_HEAD                           \
-    "movdqa   "MANGLE(tan3)", "TAN3"  \n\t" \
-    "movdqa   "MANGLE(tan1)", "TAN1"  \n\t" \
-
-///IDCT pass on columns.
-#define iLLM_PASS(dct)                      \
-    "movdqa   "TAN3", %%xmm1          \n\t" \
-    "movdqa   "TAN1", %%xmm3          \n\t" \
-    "pmulhw   %%xmm4, "TAN3"          \n\t" \
-    "pmulhw   %%xmm5, %%xmm1          \n\t" \
-    "paddsw   %%xmm4, "TAN3"          \n\t" \
-    "paddsw   %%xmm5, %%xmm1          \n\t" \
-    "psubsw   %%xmm5, "TAN3"          \n\t" \
-    "paddsw   %%xmm4, %%xmm1          \n\t" \
-    "pmulhw   %%xmm7, %%xmm3          \n\t" \
-    "pmulhw   %%xmm6, "TAN1"          \n\t" \
-    "paddsw   %%xmm6, %%xmm3          \n\t" \
-    "psubsw   %%xmm7, "TAN1"          \n\t" \
-    "movdqa   %%xmm3, %%xmm7          \n\t" \
-    "movdqa   "TAN1", %%xmm6          \n\t" \
-    "psubsw   %%xmm1, %%xmm3          \n\t" \
-    "psubsw   "TAN3", "TAN1"          \n\t" \
-    "paddsw   %%xmm7, %%xmm1          \n\t" \
-    "paddsw   %%xmm6, "TAN3"          \n\t" \
-    "movdqa   %%xmm3, %%xmm6          \n\t" \
-    "psubsw   "TAN3", %%xmm3          \n\t" \
-    "paddsw   %%xmm6, "TAN3"          \n\t" \
-    "movdqa   "MANGLE(sqrt2)", %%xmm4 \n\t" \
-    "pmulhw   %%xmm4, %%xmm3          \n\t" \
-    "pmulhw   %%xmm4, "TAN3"          \n\t" \
-    "paddsw   "TAN3", "TAN3"          \n\t" \
-    "paddsw   %%xmm3, %%xmm3          \n\t" \
-    "movdqa   "MANGLE(tan2)", %%xmm7  \n\t" \
-    MOV_32_ONLY ROW2", "REG2"         \n\t" \
-    MOV_32_ONLY ROW6", "REG6"         \n\t" \
-    "movdqa   %%xmm7, %%xmm5          \n\t" \
-    "pmulhw   "REG6", %%xmm7          \n\t" \
-    "pmulhw   "REG2", %%xmm5          \n\t" \
-    "paddsw   "REG2", %%xmm7          \n\t" \
-    "psubsw   "REG6", %%xmm5          \n\t" \
-    MOV_32_ONLY ROW0", "REG0"         \n\t" \
-    MOV_32_ONLY ROW4", "REG4"         \n\t" \
-    MOV_32_ONLY"  "TAN1", (%0)        \n\t" \
-    "movdqa   "REG0", "XMMS"          \n\t" \
-    "psubsw   "REG4", "REG0"          \n\t" \
-    "paddsw   "XMMS", "REG4"          \n\t" \
-    "movdqa   "REG4", "XMMS"          \n\t" \
-    "psubsw   %%xmm7, "REG4"          \n\t" \
-    "paddsw   "XMMS", %%xmm7          \n\t" \
-    "movdqa   "REG0", "XMMS"          \n\t" \
-    "psubsw   %%xmm5, "REG0"          \n\t" \
-    "paddsw   "XMMS", %%xmm5          \n\t" \
-    "movdqa   %%xmm5, "XMMS"          \n\t" \
-    "psubsw   "TAN3", %%xmm5          \n\t" \
-    "paddsw   "XMMS", "TAN3"          \n\t" \
-    "movdqa   "REG0", "XMMS"          \n\t" \
-    "psubsw   %%xmm3, "REG0"          \n\t" \
-    "paddsw   "XMMS", %%xmm3          \n\t" \
-    MOV_32_ONLY"  (%0), "TAN1"        \n\t" \
-    "psraw        $6, %%xmm5          \n\t" \
-    "psraw        $6, "REG0"          \n\t" \
-    "psraw        $6, "TAN3"          \n\t" \
-    "psraw        $6, %%xmm3          \n\t" \
-    "movdqa   "TAN3", 1*16("dct")     \n\t" \
-    "movdqa   %%xmm3, 2*16("dct")     \n\t" \
-    "movdqa   "REG0", 5*16("dct")     \n\t" \
-    "movdqa   %%xmm5, 6*16("dct")     \n\t" \
-    "movdqa   %%xmm7, %%xmm0          \n\t" \
-    "movdqa   "REG4", %%xmm4          \n\t" \
-    "psubsw   %%xmm1, %%xmm7          \n\t" \
-    "psubsw   "TAN1", "REG4"          \n\t" \
-    "paddsw   %%xmm0, %%xmm1          \n\t" \
-    "paddsw   %%xmm4, "TAN1"          \n\t" \
-    "psraw        $6, %%xmm1          \n\t" \
-    "psraw        $6, %%xmm7          \n\t" \
-    "psraw        $6, "TAN1"          \n\t" \
-    "psraw        $6, "REG4"          \n\t" \
-    "movdqa   %%xmm1, ("dct")         \n\t" \
-    "movdqa   "TAN1", 3*16("dct")     \n\t" \
-    "movdqa   "REG4", 4*16("dct")     \n\t" \
-    "movdqa   %%xmm7, 7*16("dct")     \n\t"
-
-///IDCT pass on columns, assuming rows 4-7 are zero.
-#define iLLM_PASS_SPARSE(dct)               \
-    "pmulhw   %%xmm4, "TAN3"          \n\t" \
-    "paddsw   %%xmm4, "TAN3"          \n\t" \
-    "movdqa   %%xmm6, %%xmm3          \n\t" \
-    "pmulhw   %%xmm6, "TAN1"          \n\t" \
-    "movdqa   %%xmm4, %%xmm1          \n\t" \
-    "psubsw   %%xmm1, %%xmm3          \n\t" \
-    "paddsw   %%xmm6, %%xmm1          \n\t" \
-    "movdqa   "TAN1", %%xmm6          \n\t" \
-    "psubsw   "TAN3", "TAN1"          \n\t" \
-    "paddsw   %%xmm6, "TAN3"          \n\t" \
-    "movdqa   %%xmm3, %%xmm6          \n\t" \
-    "psubsw   "TAN3", %%xmm3          \n\t" \
-    "paddsw   %%xmm6, "TAN3"          \n\t" \
-    "movdqa   "MANGLE(sqrt2)", %%xmm4 \n\t" \
-    "pmulhw   %%xmm4, %%xmm3          \n\t" \
-    "pmulhw   %%xmm4, "TAN3"          \n\t" \
-    "paddsw   "TAN3", "TAN3"          \n\t" \
-    "paddsw   %%xmm3, %%xmm3          \n\t" \
-    "movdqa   "MANGLE(tan2)", %%xmm5  \n\t" \
-    MOV_32_ONLY ROW2", "SREG2"        \n\t" \
-    "pmulhw   "SREG2", %%xmm5         \n\t" \
-    MOV_32_ONLY ROW0", "REG0"         \n\t" \
-    "movdqa   "REG0", %%xmm6          \n\t" \
-    "psubsw   "SREG2", %%xmm6         \n\t" \
-    "paddsw   "REG0", "SREG2"         \n\t" \
-    MOV_32_ONLY"  "TAN1", (%0)        \n\t" \
-    "movdqa   "REG0", "XMMS"          \n\t" \
-    "psubsw   %%xmm5, "REG0"          \n\t" \
-    "paddsw   "XMMS", %%xmm5          \n\t" \
-    "movdqa   %%xmm5, "XMMS"          \n\t" \
-    "psubsw   "TAN3", %%xmm5          \n\t" \
-    "paddsw   "XMMS", "TAN3"          \n\t" \
-    "movdqa   "REG0", "XMMS"          \n\t" \
-    "psubsw   %%xmm3, "REG0"          \n\t" \
-    "paddsw   "XMMS", %%xmm3          \n\t" \
-    MOV_32_ONLY"  (%0), "TAN1"        \n\t" \
-    "psraw        $6, %%xmm5          \n\t" \
-    "psraw        $6, "REG0"          \n\t" \
-    "psraw        $6, "TAN3"          \n\t" \
-    "psraw        $6, %%xmm3          \n\t" \
-    "movdqa   "TAN3", 1*16("dct")     \n\t" \
-    "movdqa   %%xmm3, 2*16("dct")     \n\t" \
-    "movdqa   "REG0", 5*16("dct")     \n\t" \
-    "movdqa   %%xmm5, 6*16("dct")     \n\t" \
-    "movdqa   "SREG2", %%xmm0         \n\t" \
-    "movdqa   %%xmm6, %%xmm4          \n\t" \
-    "psubsw   %%xmm1, "SREG2"         \n\t" \
-    "psubsw   "TAN1", %%xmm6          \n\t" \
-    "paddsw   %%xmm0, %%xmm1          \n\t" \
-    "paddsw   %%xmm4, "TAN1"          \n\t" \
-    "psraw        $6, %%xmm1          \n\t" \
-    "psraw        $6, "SREG2"         \n\t" \
-    "psraw        $6, "TAN1"          \n\t" \
-    "psraw        $6, %%xmm6          \n\t" \
-    "movdqa   %%xmm1, ("dct")         \n\t" \
-    "movdqa   "TAN1", 3*16("dct")     \n\t" \
-    "movdqa   %%xmm6, 4*16("dct")     \n\t" \
-    "movdqa   "SREG2", 7*16("dct")    \n\t"
-
-inline void ff_idct_xvid_sse2(short *block)
-{
-    __asm__ volatile(
-    "movq     "MANGLE(m127)", %%mm0                              \n\t"
-    iMTX_MULT("(%0)",     MANGLE(iTab1), ROUND(walkenIdctRounders),      PUT_EVEN(ROW0))
-    iMTX_MULT("1*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+1*16), PUT_ODD(ROW1))
-    iMTX_MULT("2*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+2*16), PUT_EVEN(ROW2))
-
-    TEST_TWO_ROWS("3*16(%0)", "4*16(%0)", "%%eax", "%%ecx", CLEAR_ODD(ROW3), CLEAR_EVEN(ROW4))
-    JZ("%%eax", "1f")
-    iMTX_MULT("3*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+3*16), PUT_ODD(ROW3))
-
-    TEST_TWO_ROWS("5*16(%0)", "6*16(%0)", "%%eax", "%%edx", CLEAR_ODD(ROW5), CLEAR_EVEN(ROW6))
-    TEST_ONE_ROW("7*16(%0)", "%%esi", CLEAR_ODD(ROW7))
-    iLLM_HEAD
-    ASMALIGN(4)
-    JNZ("%%ecx", "2f")
-    JNZ("%%eax", "3f")
-    JNZ("%%edx", "4f")
-    JNZ("%%esi", "5f")
-    iLLM_PASS_SPARSE("%0")
-    "jmp 6f                                                      \n\t"
-    "2:                                                          \n\t"
-    iMTX_MULT("4*16(%0)", MANGLE(iTab1), "#", PUT_EVEN(ROW4))
-    "3:                                                          \n\t"
-    iMTX_MULT("5*16(%0)", MANGLE(iTab4), ROUND(walkenIdctRounders+4*16), PUT_ODD(ROW5))
-    JZ("%%edx", "1f")
-    "4:                                                          \n\t"
-    iMTX_MULT("6*16(%0)", MANGLE(iTab3), ROUND(walkenIdctRounders+5*16), PUT_EVEN(ROW6))
-    JZ("%%esi", "1f")
-    "5:                                                          \n\t"
-    iMTX_MULT("7*16(%0)", MANGLE(iTab2), ROUND(walkenIdctRounders+5*16), PUT_ODD(ROW7))
-#if !ARCH_X86_64
-    iLLM_HEAD
-#endif
-    iLLM_PASS("%0")
-    "6:                                                          \n\t"
-    : "+r"(block)
-    :
-    : "%eax", "%ecx", "%edx", "%esi", "memory");
-}
-
-void ff_idct_xvid_sse2_put(uint8_t *dest, int line_size, short *block)
-{
-    ff_idct_xvid_sse2(block);
-    put_pixels_clamped_mmx(block, dest, line_size);
-}
-
-void ff_idct_xvid_sse2_add(uint8_t *dest, int line_size, short *block)
-{
-    ff_idct_xvid_sse2(block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
diff --git a/libavcodec/x86/idct_xvid.h b/libavcodec/x86/idct_xvid.h
deleted file mode 100644
index 5fdc20d..0000000
--- a/libavcodec/x86/idct_xvid.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * XVID MPEG-4 VIDEO CODEC
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*!
- * @file
- * header for Xvid IDCT functions
- */
-
-#ifndef AVCODEC_X86_IDCT_XVID_H
-#define AVCODEC_X86_IDCT_XVID_H
-
-#include <stdint.h>
-
-void ff_idct_xvid_mmx(short *block);
-void ff_idct_xvid_mmx2(short *block);
-void ff_idct_xvid_sse2(short *block);
-void ff_idct_xvid_sse2_put(uint8_t *dest, int line_size, short *block);
-void ff_idct_xvid_sse2_add(uint8_t *dest, int line_size, short *block);
-
-#endif /* AVCODEC_X86_IDCT_XVID_H */
diff --git a/libavcodec/x86/lpc_mmx.c b/libavcodec/x86/lpc_mmx.c
deleted file mode 100644
index 2ef5fa6..0000000
--- a/libavcodec/x86/lpc_mmx.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * MMX optimized LPC DSP utils
- * Copyright (c) 2007 Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "dsputil_mmx.h"
-
-static void apply_welch_window_sse2(const int32_t *data, int len, double *w_data)
-{
-    double c = 2.0 / (len-1.0);
-    int n2 = len>>1;
-    x86_reg i = -n2*sizeof(int32_t);
-    x86_reg j =  n2*sizeof(int32_t);
-    __asm__ volatile(
-        "movsd   %0,     %%xmm7                \n\t"
-        "movapd  "MANGLE(ff_pd_1)", %%xmm6     \n\t"
-        "movapd  "MANGLE(ff_pd_2)", %%xmm5     \n\t"
-        "movlhps %%xmm7, %%xmm7                \n\t"
-        "subpd   %%xmm5, %%xmm7                \n\t"
-        "addsd   %%xmm6, %%xmm7                \n\t"
-        ::"m"(c)
-    );
-#define WELCH(MOVPD, offset)\
-    __asm__ volatile(\
-        "1:                                    \n\t"\
-        "movapd   %%xmm7,  %%xmm1              \n\t"\
-        "mulpd    %%xmm1,  %%xmm1              \n\t"\
-        "movapd   %%xmm6,  %%xmm0              \n\t"\
-        "subpd    %%xmm1,  %%xmm0              \n\t"\
-        "pshufd   $0x4e,   %%xmm0, %%xmm1      \n\t"\
-        "cvtpi2pd (%3,%0), %%xmm2              \n\t"\
-        "cvtpi2pd "#offset"*4(%3,%1), %%xmm3   \n\t"\
-        "mulpd    %%xmm0,  %%xmm2              \n\t"\
-        "mulpd    %%xmm1,  %%xmm3              \n\t"\
-        "movapd   %%xmm2, (%2,%0,2)            \n\t"\
-        MOVPD"    %%xmm3, "#offset"*8(%2,%1,2) \n\t"\
-        "subpd    %%xmm5,  %%xmm7              \n\t"\
-        "sub      $8,      %1                  \n\t"\
-        "add      $8,      %0                  \n\t"\
-        "jl 1b                                 \n\t"\
-        :"+&r"(i), "+&r"(j)\
-        :"r"(w_data+n2), "r"(data+n2)\
-    );
-    if(len&1)
-        WELCH("movupd", -1)
-    else
-        WELCH("movapd", -2)
-#undef WELCH
-}
-
-void ff_lpc_compute_autocorr_sse2(const int32_t *data, int len, int lag,
-                                   double *autoc)
-{
-    double tmp[len + lag + 2];
-    double *data1 = tmp + lag;
-    int j;
-
-    if((x86_reg)data1 & 15)
-        data1++;
-
-    apply_welch_window_sse2(data, len, data1);
-
-    for(j=0; j<lag; j++)
-        data1[j-lag]= 0.0;
-    data1[len] = 0.0;
-
-    for(j=0; j<lag; j+=2){
-        x86_reg i = -len*sizeof(double);
-        if(j == lag-2) {
-            __asm__ volatile(
-                "movsd    "MANGLE(ff_pd_1)", %%xmm0 \n\t"
-                "movsd    "MANGLE(ff_pd_1)", %%xmm1 \n\t"
-                "movsd    "MANGLE(ff_pd_1)", %%xmm2 \n\t"
-                "1:                                 \n\t"
-                "movapd   (%2,%0), %%xmm3           \n\t"
-                "movupd -8(%3,%0), %%xmm4           \n\t"
-                "movapd   (%3,%0), %%xmm5           \n\t"
-                "mulpd     %%xmm3, %%xmm4           \n\t"
-                "mulpd     %%xmm3, %%xmm5           \n\t"
-                "mulpd -16(%3,%0), %%xmm3           \n\t"
-                "addpd     %%xmm4, %%xmm1           \n\t"
-                "addpd     %%xmm5, %%xmm0           \n\t"
-                "addpd     %%xmm3, %%xmm2           \n\t"
-                "add       $16,    %0               \n\t"
-                "jl 1b                              \n\t"
-                "movhlps   %%xmm0, %%xmm3           \n\t"
-                "movhlps   %%xmm1, %%xmm4           \n\t"
-                "movhlps   %%xmm2, %%xmm5           \n\t"
-                "addsd     %%xmm3, %%xmm0           \n\t"
-                "addsd     %%xmm4, %%xmm1           \n\t"
-                "addsd     %%xmm5, %%xmm2           \n\t"
-                "movsd     %%xmm0,   (%1)           \n\t"
-                "movsd     %%xmm1,  8(%1)           \n\t"
-                "movsd     %%xmm2, 16(%1)           \n\t"
-                :"+&r"(i)
-                :"r"(autoc+j), "r"(data1+len), "r"(data1+len-j)
-                :"memory"
-            );
-        } else {
-            __asm__ volatile(
-                "movsd    "MANGLE(ff_pd_1)", %%xmm0 \n\t"
-                "movsd    "MANGLE(ff_pd_1)", %%xmm1 \n\t"
-                "1:                                 \n\t"
-                "movapd   (%3,%0), %%xmm3           \n\t"
-                "movupd -8(%4,%0), %%xmm4           \n\t"
-                "mulpd     %%xmm3, %%xmm4           \n\t"
-                "mulpd    (%4,%0), %%xmm3           \n\t"
-                "addpd     %%xmm4, %%xmm1           \n\t"
-                "addpd     %%xmm3, %%xmm0           \n\t"
-                "add       $16,    %0               \n\t"
-                "jl 1b                              \n\t"
-                "movhlps   %%xmm0, %%xmm3           \n\t"
-                "movhlps   %%xmm1, %%xmm4           \n\t"
-                "addsd     %%xmm3, %%xmm0           \n\t"
-                "addsd     %%xmm4, %%xmm1           \n\t"
-                "movsd     %%xmm0, %1               \n\t"
-                "movsd     %%xmm1, %2               \n\t"
-                :"+&r"(i), "=m"(autoc[j]), "=m"(autoc[j+1])
-                :"r"(data1+len), "r"(data1+len-j)
-            );
-        }
-    }
-}
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
deleted file mode 100644
index 5949dfe..0000000
--- a/libavcodec/x86/mathops.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * simple math operations
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at> et al
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_X86_MATHOPS_H
-#define AVCODEC_X86_MATHOPS_H
-
-#include "config.h"
-#include "libavutil/common.h"
-
-#if ARCH_X86_32
-#define MULL(ra, rb, shift) \
-        ({ int rt, dummy; __asm__ (\
-            "imull %3               \n\t"\
-            "shrdl %4, %%edx, %%eax \n\t"\
-            : "=a"(rt), "=d"(dummy)\
-            : "a" ((int)(ra)), "rm" ((int)(rb)), "i"(shift));\
-         rt; })
-
-#define MULH(ra, rb) \
-    ({ int rt, dummy;\
-     __asm__ ("imull %3\n\t" : "=d"(rt), "=a"(dummy): "a" ((int)(ra)), "rm" ((int)(rb)));\
-     rt; })
-
-#define MUL64(ra, rb) \
-    ({ int64_t rt;\
-     __asm__ ("imull %2\n\t" : "=A"(rt) : "a" ((int)(ra)), "g" ((int)(rb)));\
-     rt; })
-#endif
-
-#if HAVE_CMOV
-/* median of 3 */
-#define mid_pred mid_pred
-static inline av_const int mid_pred(int a, int b, int c)
-{
-    int i=b;
-    __asm__ volatile(
-        "cmp    %2, %1 \n\t"
-        "cmovg  %1, %0 \n\t"
-        "cmovg  %2, %1 \n\t"
-        "cmp    %3, %1 \n\t"
-        "cmovl  %3, %1 \n\t"
-        "cmp    %1, %0 \n\t"
-        "cmovg  %1, %0 \n\t"
-        :"+&r"(i), "+&r"(a)
-        :"r"(b), "r"(c)
-    );
-    return i;
-}
-#endif
-
-#if HAVE_CMOV
-#define COPY3_IF_LT(x, y, a, b, c, d)\
-__asm__ volatile(\
-    "cmpl  %0, %3       \n\t"\
-    "cmovl %3, %0       \n\t"\
-    "cmovl %4, %1       \n\t"\
-    "cmovl %5, %2       \n\t"\
-    : "+&r" (x), "+&r" (a), "+r" (c)\
-    : "r" (y), "r" (b), "r" (d)\
-);
-#endif
-
-// avoid +32 for shift optimization (gcc should do that ...)
-#define NEG_SSR32 NEG_SSR32
-static inline  int32_t NEG_SSR32( int32_t a, int8_t s){
-    __asm__ ("sarl %1, %0\n\t"
-         : "+r" (a)
-         : "ic" ((uint8_t)(-s))
-    );
-    return a;
-}
-
-#define NEG_USR32 NEG_USR32
-static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
-    __asm__ ("shrl %1, %0\n\t"
-         : "+r" (a)
-         : "ic" ((uint8_t)(-s))
-    );
-    return a;
-}
-
-#endif /* AVCODEC_X86_MATHOPS_H */
diff --git a/libavcodec/x86/mlpdsp.c b/libavcodec/x86/mlpdsp.c
deleted file mode 100644
index 486a927..0000000
--- a/libavcodec/x86/mlpdsp.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * MLP DSP functions x86-optimized
- * Copyright (c) 2009 Ramiro Polla
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mlp.h"
-
-#if HAVE_7REGS && HAVE_TEN_OPERANDS
-
-extern void ff_mlp_firorder_8;
-extern void ff_mlp_firorder_7;
-extern void ff_mlp_firorder_6;
-extern void ff_mlp_firorder_5;
-extern void ff_mlp_firorder_4;
-extern void ff_mlp_firorder_3;
-extern void ff_mlp_firorder_2;
-extern void ff_mlp_firorder_1;
-extern void ff_mlp_firorder_0;
-
-extern void ff_mlp_iirorder_4;
-extern void ff_mlp_iirorder_3;
-extern void ff_mlp_iirorder_2;
-extern void ff_mlp_iirorder_1;
-extern void ff_mlp_iirorder_0;
-
-static const void *firtable[9] = { &ff_mlp_firorder_0, &ff_mlp_firorder_1,
-                                   &ff_mlp_firorder_2, &ff_mlp_firorder_3,
-                                   &ff_mlp_firorder_4, &ff_mlp_firorder_5,
-                                   &ff_mlp_firorder_6, &ff_mlp_firorder_7,
-                                   &ff_mlp_firorder_8 };
-static const void *iirtable[5] = { &ff_mlp_iirorder_0, &ff_mlp_iirorder_1,
-                                   &ff_mlp_iirorder_2, &ff_mlp_iirorder_3,
-                                   &ff_mlp_iirorder_4 };
-
-#if ARCH_X86_64
-
-#define MLPMUL(label, offset, offs, offc)   \
-    LABEL_MANGLE(label)":             \n\t" \
-    "movslq "offset"+"offs"(%0), %%rax\n\t" \
-    "movslq "offset"+"offc"(%1), %%rdx\n\t" \
-    "imul                 %%rdx, %%rax\n\t" \
-    "add                  %%rax, %%rsi\n\t"
-
-#define FIRMULREG(label, offset, firc)\
-    LABEL_MANGLE(label)":       \n\t" \
-    "movslq "#offset"(%0), %%rax\n\t" \
-    "imul        %"#firc", %%rax\n\t" \
-    "add            %%rax, %%rsi\n\t"
-
-#define CLEAR_ACCUM                   \
-    "xor            %%rsi, %%rsi\n\t"
-
-#define SHIFT_ACCUM                   \
-    "shr     %%cl,         %%rsi\n\t"
-
-#define ACCUM    "%%rdx"
-#define RESULT   "%%rsi"
-#define RESULT32 "%%esi"
-
-#else /* if ARCH_X86_32 */
-
-#define MLPMUL(label, offset, offs, offc)  \
-    LABEL_MANGLE(label)":            \n\t" \
-    "mov   "offset"+"offs"(%0), %%eax\n\t" \
-    "imull "offset"+"offc"(%1)       \n\t" \
-    "add                %%eax , %%esi\n\t" \
-    "adc                %%edx , %%ecx\n\t"
-
-#define FIRMULREG(label, offset, firc)  \
-    MLPMUL(label, #offset, "0", "0")
-
-#define CLEAR_ACCUM                  \
-    "xor           %%esi, %%esi\n\t" \
-    "xor           %%ecx, %%ecx\n\t"
-
-#define SHIFT_ACCUM                  \
-    "mov           %%ecx, %%edx\n\t" \
-    "mov           %%esi, %%eax\n\t" \
-    "movzbl        %7   , %%ecx\n\t" \
-    "shrd    %%cl, %%edx, %%eax\n\t" \
-
-#define ACCUM    "%%edx"
-#define RESULT   "%%eax"
-#define RESULT32 "%%eax"
-
-#endif /* !ARCH_X86_64 */
-
-#define BINC  AV_STRINGIFY(4* MAX_CHANNELS)
-#define IOFFS AV_STRINGIFY(4*(MAX_FIR_ORDER + MAX_BLOCKSIZE))
-#define IOFFC AV_STRINGIFY(4* MAX_FIR_ORDER)
-
-#define FIRMUL(label, offset) MLPMUL(label, #offset,   "0",   "0")
-#define IIRMUL(label, offset) MLPMUL(label, #offset, IOFFS, IOFFC)
-
-static void mlp_filter_channel_x86(int32_t *state, const int32_t *coeff,
-                                   int firorder, int iirorder,
-                                   unsigned int filter_shift, int32_t mask,
-                                   int blocksize, int32_t *sample_buffer)
-{
-    const void *firjump = firtable[firorder];
-    const void *iirjump = iirtable[iirorder];
-
-    blocksize = -blocksize;
-
-    __asm__ volatile(
-        "1:                           \n\t"
-        CLEAR_ACCUM
-        "jmp  *%5                     \n\t"
-        FIRMUL   (ff_mlp_firorder_8, 0x1c   )
-        FIRMUL   (ff_mlp_firorder_7, 0x18   )
-        FIRMUL   (ff_mlp_firorder_6, 0x14   )
-        FIRMUL   (ff_mlp_firorder_5, 0x10   )
-        FIRMUL   (ff_mlp_firorder_4, 0x0c   )
-        FIRMULREG(ff_mlp_firorder_3, 0x08,10)
-        FIRMULREG(ff_mlp_firorder_2, 0x04, 9)
-        FIRMULREG(ff_mlp_firorder_1, 0x00, 8)
-        LABEL_MANGLE(ff_mlp_firorder_0)":\n\t"
-        "jmp  *%6                     \n\t"
-        IIRMUL   (ff_mlp_iirorder_4, 0x0c   )
-        IIRMUL   (ff_mlp_iirorder_3, 0x08   )
-        IIRMUL   (ff_mlp_iirorder_2, 0x04   )
-        IIRMUL   (ff_mlp_iirorder_1, 0x00   )
-        LABEL_MANGLE(ff_mlp_iirorder_0)":\n\t"
-        SHIFT_ACCUM
-        "mov  "RESULT"  ,"ACCUM"      \n\t"
-        "add  (%2)      ,"RESULT"     \n\t"
-        "and   %4       ,"RESULT"     \n\t"
-        "sub   $4       ,  %0         \n\t"
-        "mov  "RESULT32", (%0)        \n\t"
-        "mov  "RESULT32", (%2)        \n\t"
-        "add $"BINC"    ,  %2         \n\t"
-        "sub  "ACCUM"   ,"RESULT"     \n\t"
-        "mov  "RESULT32","IOFFS"(%0)  \n\t"
-        "incl              %3         \n\t"
-        "js 1b                        \n\t"
-        : /* 0*/"+r"(state),
-          /* 1*/"+r"(coeff),
-          /* 2*/"+r"(sample_buffer),
-#if ARCH_X86_64
-          /* 3*/"+r"(blocksize)
-        : /* 4*/"r"((x86_reg)mask), /* 5*/"r"(firjump),
-          /* 6*/"r"(iirjump)      , /* 7*/"c"(filter_shift)
-        , /* 8*/"r"((int64_t)coeff[0])
-        , /* 9*/"r"((int64_t)coeff[1])
-        , /*10*/"r"((int64_t)coeff[2])
-        : "rax", "rdx", "rsi"
-#else /* ARCH_X86_32 */
-          /* 3*/"+m"(blocksize)
-        : /* 4*/"m"(         mask), /* 5*/"m"(firjump),
-          /* 6*/"m"(iirjump)      , /* 7*/"m"(filter_shift)
-        : "eax", "edx", "esi", "ecx"
-#endif /* !ARCH_X86_64 */
-    );
-}
-
-#endif /* HAVE_7REGS && HAVE_TEN_OPERANDS */
-
-void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx)
-{
-#if HAVE_7REGS && HAVE_TEN_OPERANDS
-    c->mlp_filter_channel = mlp_filter_channel_x86;
-#endif
-}
diff --git a/libavcodec/x86/mmx.h b/libavcodec/x86/mmx.h
deleted file mode 100644
index d7a76bb..0000000
--- a/libavcodec/x86/mmx.h
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * mmx.h
- * Copyright (C) 1997-2001 H. Dietz and R. Fisher
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVCODEC_X86_MMX_H
-#define AVCODEC_X86_MMX_H
-
-#warning Everything in this header is deprecated, use plain __asm__()! New code using this header will be rejected.
-
-
-#define         mmx_i2r(op,imm,reg) \
-        __asm__ volatile (#op " %0, %%" #reg \
-                              : /* nothing */ \
-                              : "i" (imm) )
-
-#define         mmx_m2r(op,mem,reg) \
-        __asm__ volatile (#op " %0, %%" #reg \
-                              : /* nothing */ \
-                              : "m" (mem))
-
-#define         mmx_r2m(op,reg,mem) \
-        __asm__ volatile (#op " %%" #reg ", %0" \
-                              : "=m" (mem) \
-                              : /* nothing */ )
-
-#define         mmx_r2r(op,regs,regd) \
-        __asm__ volatile (#op " %" #regs ", %" #regd)
-
-
-#define         emms() __asm__ volatile ("emms")
-
-#define         movd_m2r(var,reg)           mmx_m2r (movd, var, reg)
-#define         movd_r2m(reg,var)           mmx_r2m (movd, reg, var)
-#define         movd_r2r(regs,regd)         mmx_r2r (movd, regs, regd)
-
-#define         movq_m2r(var,reg)           mmx_m2r (movq, var, reg)
-#define         movq_r2m(reg,var)           mmx_r2m (movq, reg, var)
-#define         movq_r2r(regs,regd)         mmx_r2r (movq, regs, regd)
-
-#define         packssdw_m2r(var,reg)       mmx_m2r (packssdw, var, reg)
-#define         packssdw_r2r(regs,regd)     mmx_r2r (packssdw, regs, regd)
-#define         packsswb_m2r(var,reg)       mmx_m2r (packsswb, var, reg)
-#define         packsswb_r2r(regs,regd)     mmx_r2r (packsswb, regs, regd)
-
-#define         packuswb_m2r(var,reg)       mmx_m2r (packuswb, var, reg)
-#define         packuswb_r2r(regs,regd)     mmx_r2r (packuswb, regs, regd)
-
-#define         paddb_m2r(var,reg)          mmx_m2r (paddb, var, reg)
-#define         paddb_r2r(regs,regd)        mmx_r2r (paddb, regs, regd)
-#define         paddd_m2r(var,reg)          mmx_m2r (paddd, var, reg)
-#define         paddd_r2r(regs,regd)        mmx_r2r (paddd, regs, regd)
-#define         paddw_m2r(var,reg)          mmx_m2r (paddw, var, reg)
-#define         paddw_r2r(regs,regd)        mmx_r2r (paddw, regs, regd)
-
-#define         paddsb_m2r(var,reg)         mmx_m2r (paddsb, var, reg)
-#define         paddsb_r2r(regs,regd)       mmx_r2r (paddsb, regs, regd)
-#define         paddsw_m2r(var,reg)         mmx_m2r (paddsw, var, reg)
-#define         paddsw_r2r(regs,regd)       mmx_r2r (paddsw, regs, regd)
-
-#define         paddusb_m2r(var,reg)        mmx_m2r (paddusb, var, reg)
-#define         paddusb_r2r(regs,regd)      mmx_r2r (paddusb, regs, regd)
-#define         paddusw_m2r(var,reg)        mmx_m2r (paddusw, var, reg)
-#define         paddusw_r2r(regs,regd)      mmx_r2r (paddusw, regs, regd)
-
-#define         pand_m2r(var,reg)           mmx_m2r (pand, var, reg)
-#define         pand_r2r(regs,regd)         mmx_r2r (pand, regs, regd)
-
-#define         pandn_m2r(var,reg)          mmx_m2r (pandn, var, reg)
-#define         pandn_r2r(regs,regd)        mmx_r2r (pandn, regs, regd)
-
-#define         pcmpeqb_m2r(var,reg)        mmx_m2r (pcmpeqb, var, reg)
-#define         pcmpeqb_r2r(regs,regd)      mmx_r2r (pcmpeqb, regs, regd)
-#define         pcmpeqd_m2r(var,reg)        mmx_m2r (pcmpeqd, var, reg)
-#define         pcmpeqd_r2r(regs,regd)      mmx_r2r (pcmpeqd, regs, regd)
-#define         pcmpeqw_m2r(var,reg)        mmx_m2r (pcmpeqw, var, reg)
-#define         pcmpeqw_r2r(regs,regd)      mmx_r2r (pcmpeqw, regs, regd)
-
-#define         pcmpgtb_m2r(var,reg)        mmx_m2r (pcmpgtb, var, reg)
-#define         pcmpgtb_r2r(regs,regd)      mmx_r2r (pcmpgtb, regs, regd)
-#define         pcmpgtd_m2r(var,reg)        mmx_m2r (pcmpgtd, var, reg)
-#define         pcmpgtd_r2r(regs,regd)      mmx_r2r (pcmpgtd, regs, regd)
-#define         pcmpgtw_m2r(var,reg)        mmx_m2r (pcmpgtw, var, reg)
-#define         pcmpgtw_r2r(regs,regd)      mmx_r2r (pcmpgtw, regs, regd)
-
-#define         pmaddwd_m2r(var,reg)        mmx_m2r (pmaddwd, var, reg)
-#define         pmaddwd_r2r(regs,regd)      mmx_r2r (pmaddwd, regs, regd)
-
-#define         pmulhw_m2r(var,reg)         mmx_m2r (pmulhw, var, reg)
-#define         pmulhw_r2r(regs,regd)       mmx_r2r (pmulhw, regs, regd)
-
-#define         pmullw_m2r(var,reg)         mmx_m2r (pmullw, var, reg)
-#define         pmullw_r2r(regs,regd)       mmx_r2r (pmullw, regs, regd)
-
-#define         por_m2r(var,reg)            mmx_m2r (por, var, reg)
-#define         por_r2r(regs,regd)          mmx_r2r (por, regs, regd)
-
-#define         pslld_i2r(imm,reg)          mmx_i2r (pslld, imm, reg)
-#define         pslld_m2r(var,reg)          mmx_m2r (pslld, var, reg)
-#define         pslld_r2r(regs,regd)        mmx_r2r (pslld, regs, regd)
-#define         psllq_i2r(imm,reg)          mmx_i2r (psllq, imm, reg)
-#define         psllq_m2r(var,reg)          mmx_m2r (psllq, var, reg)
-#define         psllq_r2r(regs,regd)        mmx_r2r (psllq, regs, regd)
-#define         psllw_i2r(imm,reg)          mmx_i2r (psllw, imm, reg)
-#define         psllw_m2r(var,reg)          mmx_m2r (psllw, var, reg)
-#define         psllw_r2r(regs,regd)        mmx_r2r (psllw, regs, regd)
-
-#define         psrad_i2r(imm,reg)          mmx_i2r (psrad, imm, reg)
-#define         psrad_m2r(var,reg)          mmx_m2r (psrad, var, reg)
-#define         psrad_r2r(regs,regd)        mmx_r2r (psrad, regs, regd)
-#define         psraw_i2r(imm,reg)          mmx_i2r (psraw, imm, reg)
-#define         psraw_m2r(var,reg)          mmx_m2r (psraw, var, reg)
-#define         psraw_r2r(regs,regd)        mmx_r2r (psraw, regs, regd)
-
-#define         psrld_i2r(imm,reg)          mmx_i2r (psrld, imm, reg)
-#define         psrld_m2r(var,reg)          mmx_m2r (psrld, var, reg)
-#define         psrld_r2r(regs,regd)        mmx_r2r (psrld, regs, regd)
-#define         psrlq_i2r(imm,reg)          mmx_i2r (psrlq, imm, reg)
-#define         psrlq_m2r(var,reg)          mmx_m2r (psrlq, var, reg)
-#define         psrlq_r2r(regs,regd)        mmx_r2r (psrlq, regs, regd)
-#define         psrlw_i2r(imm,reg)          mmx_i2r (psrlw, imm, reg)
-#define         psrlw_m2r(var,reg)          mmx_m2r (psrlw, var, reg)
-#define         psrlw_r2r(regs,regd)        mmx_r2r (psrlw, regs, regd)
-
-#define         psubb_m2r(var,reg)          mmx_m2r (psubb, var, reg)
-#define         psubb_r2r(regs,regd)        mmx_r2r (psubb, regs, regd)
-#define         psubd_m2r(var,reg)          mmx_m2r (psubd, var, reg)
-#define         psubd_r2r(regs,regd)        mmx_r2r (psubd, regs, regd)
-#define         psubw_m2r(var,reg)          mmx_m2r (psubw, var, reg)
-#define         psubw_r2r(regs,regd)        mmx_r2r (psubw, regs, regd)
-
-#define         psubsb_m2r(var,reg)         mmx_m2r (psubsb, var, reg)
-#define         psubsb_r2r(regs,regd)       mmx_r2r (psubsb, regs, regd)
-#define         psubsw_m2r(var,reg)         mmx_m2r (psubsw, var, reg)
-#define         psubsw_r2r(regs,regd)       mmx_r2r (psubsw, regs, regd)
-
-#define         psubusb_m2r(var,reg)        mmx_m2r (psubusb, var, reg)
-#define         psubusb_r2r(regs,regd)      mmx_r2r (psubusb, regs, regd)
-#define         psubusw_m2r(var,reg)        mmx_m2r (psubusw, var, reg)
-#define         psubusw_r2r(regs,regd)      mmx_r2r (psubusw, regs, regd)
-
-#define         punpckhbw_m2r(var,reg)      mmx_m2r (punpckhbw, var, reg)
-#define         punpckhbw_r2r(regs,regd)    mmx_r2r (punpckhbw, regs, regd)
-#define         punpckhdq_m2r(var,reg)      mmx_m2r (punpckhdq, var, reg)
-#define         punpckhdq_r2r(regs,regd)    mmx_r2r (punpckhdq, regs, regd)
-#define         punpckhwd_m2r(var,reg)      mmx_m2r (punpckhwd, var, reg)
-#define         punpckhwd_r2r(regs,regd)    mmx_r2r (punpckhwd, regs, regd)
-
-#define         punpcklbw_m2r(var,reg)      mmx_m2r (punpcklbw, var, reg)
-#define         punpcklbw_r2r(regs,regd)    mmx_r2r (punpcklbw, regs, regd)
-#define         punpckldq_m2r(var,reg)      mmx_m2r (punpckldq, var, reg)
-#define         punpckldq_r2r(regs,regd)    mmx_r2r (punpckldq, regs, regd)
-#define         punpcklwd_m2r(var,reg)      mmx_m2r (punpcklwd, var, reg)
-#define         punpcklwd_r2r(regs,regd)    mmx_r2r (punpcklwd, regs, regd)
-
-#define         pxor_m2r(var,reg)           mmx_m2r (pxor, var, reg)
-#define         pxor_r2r(regs,regd)         mmx_r2r (pxor, regs, regd)
-
-
-/* 3DNOW extensions */
-
-#define         pavgusb_m2r(var,reg)        mmx_m2r (pavgusb, var, reg)
-#define         pavgusb_r2r(regs,regd)      mmx_r2r (pavgusb, regs, regd)
-
-
-/* AMD MMX extensions - also available in intel SSE */
-
-
-#define         mmx_m2ri(op,mem,reg,imm) \
-        __asm__ volatile (#op " %1, %0, %%" #reg \
-                              : /* nothing */ \
-                              : "m" (mem), "i" (imm))
-#define         mmx_r2ri(op,regs,regd,imm) \
-        __asm__ volatile (#op " %0, %%" #regs ", %%" #regd \
-                              : /* nothing */ \
-                              : "i" (imm) )
-
-#define         mmx_fetch(mem,hint) \
-        __asm__ volatile ("prefetch" #hint " %0" \
-                              : /* nothing */ \
-                              : "m" (mem))
-
-
-#define         maskmovq(regs,maskreg)      mmx_r2ri (maskmovq, regs, maskreg)
-
-#define         movntq_r2m(mmreg,var)       mmx_r2m (movntq, mmreg, var)
-
-#define         pavgb_m2r(var,reg)          mmx_m2r (pavgb, var, reg)
-#define         pavgb_r2r(regs,regd)        mmx_r2r (pavgb, regs, regd)
-#define         pavgw_m2r(var,reg)          mmx_m2r (pavgw, var, reg)
-#define         pavgw_r2r(regs,regd)        mmx_r2r (pavgw, regs, regd)
-
-#define         pextrw_r2r(mmreg,reg,imm)   mmx_r2ri (pextrw, mmreg, reg, imm)
-
-#define         pinsrw_r2r(reg,mmreg,imm)   mmx_r2ri (pinsrw, reg, mmreg, imm)
-
-#define         pmaxsw_m2r(var,reg)         mmx_m2r (pmaxsw, var, reg)
-#define         pmaxsw_r2r(regs,regd)       mmx_r2r (pmaxsw, regs, regd)
-
-#define         pmaxub_m2r(var,reg)         mmx_m2r (pmaxub, var, reg)
-#define         pmaxub_r2r(regs,regd)       mmx_r2r (pmaxub, regs, regd)
-
-#define         pminsw_m2r(var,reg)         mmx_m2r (pminsw, var, reg)
-#define         pminsw_r2r(regs,regd)       mmx_r2r (pminsw, regs, regd)
-
-#define         pminub_m2r(var,reg)         mmx_m2r (pminub, var, reg)
-#define         pminub_r2r(regs,regd)       mmx_r2r (pminub, regs, regd)
-
-#define         pmovmskb(mmreg,reg) \
-        __asm__ volatile ("movmskps %" #mmreg ", %" #reg)
-
-#define         pmulhuw_m2r(var,reg)        mmx_m2r (pmulhuw, var, reg)
-#define         pmulhuw_r2r(regs,regd)      mmx_r2r (pmulhuw, regs, regd)
-
-#define         prefetcht0(mem)             mmx_fetch (mem, t0)
-#define         prefetcht1(mem)             mmx_fetch (mem, t1)
-#define         prefetcht2(mem)             mmx_fetch (mem, t2)
-#define         prefetchnta(mem)            mmx_fetch (mem, nta)
-
-#define         psadbw_m2r(var,reg)         mmx_m2r (psadbw, var, reg)
-#define         psadbw_r2r(regs,regd)       mmx_r2r (psadbw, regs, regd)
-
-#define         pshufw_m2r(var,reg,imm)     mmx_m2ri(pshufw, var, reg, imm)
-#define         pshufw_r2r(regs,regd,imm)   mmx_r2ri(pshufw, regs, regd, imm)
-
-#define         sfence() __asm__ volatile ("sfence\n\t")
-
-/* SSE2 */
-#define         pshufhw_m2r(var,reg,imm)    mmx_m2ri(pshufhw, var, reg, imm)
-#define         pshufhw_r2r(regs,regd,imm)  mmx_r2ri(pshufhw, regs, regd, imm)
-#define         pshuflw_m2r(var,reg,imm)    mmx_m2ri(pshuflw, var, reg, imm)
-#define         pshuflw_r2r(regs,regd,imm)  mmx_r2ri(pshuflw, regs, regd, imm)
-
-#define         pshufd_r2r(regs,regd,imm)   mmx_r2ri(pshufd, regs, regd, imm)
-
-#define         movdqa_m2r(var,reg)         mmx_m2r (movdqa, var, reg)
-#define         movdqa_r2m(reg,var)         mmx_r2m (movdqa, reg, var)
-#define         movdqa_r2r(regs,regd)       mmx_r2r (movdqa, regs, regd)
-#define         movdqu_m2r(var,reg)         mmx_m2r (movdqu, var, reg)
-#define         movdqu_r2m(reg,var)         mmx_r2m (movdqu, reg, var)
-#define         movdqu_r2r(regs,regd)       mmx_r2r (movdqu, regs, regd)
-
-#define         pmullw_r2m(reg,var)         mmx_r2m (pmullw, reg, var)
-
-#define         pslldq_i2r(imm,reg)         mmx_i2r (pslldq, imm, reg)
-#define         psrldq_i2r(imm,reg)         mmx_i2r (psrldq, imm, reg)
-
-#define         punpcklqdq_r2r(regs,regd)   mmx_r2r (punpcklqdq, regs, regd)
-#define         punpckhqdq_r2r(regs,regd)   mmx_r2r (punpckhqdq, regs, regd)
-
-
-#endif /* AVCODEC_X86_MMX_H */
diff --git a/libavcodec/x86/motion_est_mmx.c b/libavcodec/x86/motion_est_mmx.c
deleted file mode 100644
index 0272410..0000000
--- a/libavcodec/x86/motion_est_mmx.c
+++ /dev/null
@@ -1,462 +0,0 @@
-/*
- * MMX optimized motion estimation
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer
- *
- * mostly by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-
-DECLARE_ASM_CONST(8, uint64_t, round_tab)[3]={
-0x0000000000000000ULL,
-0x0001000100010001ULL,
-0x0002000200020002ULL,
-};
-
-DECLARE_ASM_CONST(8, uint64_t, bone)= 0x0101010101010101LL;
-
-static inline void sad8_1_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    x86_reg len= -(stride*h);
-    __asm__ volatile(
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "movq (%2, %%"REG_a"), %%mm2    \n\t"
-        "movq (%2, %%"REG_a"), %%mm4    \n\t"
-        "add %3, %%"REG_a"              \n\t"
-        "psubusb %%mm0, %%mm2           \n\t"
-        "psubusb %%mm4, %%mm0           \n\t"
-        "movq (%1, %%"REG_a"), %%mm1    \n\t"
-        "movq (%2, %%"REG_a"), %%mm3    \n\t"
-        "movq (%2, %%"REG_a"), %%mm5    \n\t"
-        "psubusb %%mm1, %%mm3           \n\t"
-        "psubusb %%mm5, %%mm1           \n\t"
-        "por %%mm2, %%mm0               \n\t"
-        "por %%mm1, %%mm3               \n\t"
-        "movq %%mm0, %%mm1              \n\t"
-        "movq %%mm3, %%mm2              \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpcklbw %%mm7, %%mm3         \n\t"
-        "punpckhbw %%mm7, %%mm2         \n\t"
-        "paddw %%mm1, %%mm0             \n\t"
-        "paddw %%mm3, %%mm2             \n\t"
-        "paddw %%mm2, %%mm0             \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "add %3, %%"REG_a"              \n\t"
-        " js 1b                         \n\t"
-        : "+a" (len)
-        : "r" (blk1 - len), "r" (blk2 - len), "r" ((x86_reg)stride)
-    );
-}
-
-static inline void sad8_1_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    __asm__ volatile(
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "psadbw (%2), %%mm0             \n\t"
-        "psadbw (%2, %3), %%mm1         \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "paddw %%mm1, %%mm6             \n\t"
-        "lea (%1,%3,2), %1              \n\t"
-        "lea (%2,%3,2), %2              \n\t"
-        "sub $2, %0                     \n\t"
-        " jg 1b                         \n\t"
-        : "+r" (h), "+r" (blk1), "+r" (blk2)
-        : "r" ((x86_reg)stride)
-    );
-}
-
-static int sad16_sse2(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)
-{
-    int ret;
-    __asm__ volatile(
-        "pxor %%xmm6, %%xmm6            \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movdqu (%1), %%xmm0            \n\t"
-        "movdqu (%1, %3), %%xmm1        \n\t"
-        "psadbw (%2), %%xmm0            \n\t"
-        "psadbw (%2, %3), %%xmm1        \n\t"
-        "paddw %%xmm0, %%xmm6           \n\t"
-        "paddw %%xmm1, %%xmm6           \n\t"
-        "lea (%1,%3,2), %1              \n\t"
-        "lea (%2,%3,2), %2              \n\t"
-        "sub $2, %0                     \n\t"
-        " jg 1b                         \n\t"
-        : "+r" (h), "+r" (blk1), "+r" (blk2)
-        : "r" ((x86_reg)stride)
-    );
-    __asm__ volatile(
-        "movhlps %%xmm6, %%xmm0         \n\t"
-        "paddw   %%xmm0, %%xmm6         \n\t"
-        "movd    %%xmm6, %0             \n\t"
-        : "=r"(ret)
-    );
-    return ret;
-}
-
-static inline void sad8_x2a_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    __asm__ volatile(
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "movq (%1, %3), %%mm1           \n\t"
-        "pavgb 1(%1), %%mm0             \n\t"
-        "pavgb 1(%1, %3), %%mm1         \n\t"
-        "psadbw (%2), %%mm0             \n\t"
-        "psadbw (%2, %3), %%mm1         \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "paddw %%mm1, %%mm6             \n\t"
-        "lea (%1,%3,2), %1              \n\t"
-        "lea (%2,%3,2), %2              \n\t"
-        "sub $2, %0                     \n\t"
-        " jg 1b                         \n\t"
-        : "+r" (h), "+r" (blk1), "+r" (blk2)
-        : "r" ((x86_reg)stride)
-    );
-}
-
-static inline void sad8_y2a_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    __asm__ volatile(
-        "movq (%1), %%mm0               \n\t"
-        "add %3, %1                     \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%1), %%mm1               \n\t"
-        "movq (%1, %3), %%mm2           \n\t"
-        "pavgb %%mm1, %%mm0             \n\t"
-        "pavgb %%mm2, %%mm1             \n\t"
-        "psadbw (%2), %%mm0             \n\t"
-        "psadbw (%2, %3), %%mm1         \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "paddw %%mm1, %%mm6             \n\t"
-        "movq %%mm2, %%mm0              \n\t"
-        "lea (%1,%3,2), %1              \n\t"
-        "lea (%2,%3,2), %2              \n\t"
-        "sub $2, %0                     \n\t"
-        " jg 1b                         \n\t"
-        : "+r" (h), "+r" (blk1), "+r" (blk2)
-        : "r" ((x86_reg)stride)
-    );
-}
-
-static inline void sad8_4_mmx2(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    __asm__ volatile(
-        "movq "MANGLE(bone)", %%mm5     \n\t"
-        "movq (%1), %%mm0               \n\t"
-        "pavgb 1(%1), %%mm0             \n\t"
-        "add %3, %1                     \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%1), %%mm1               \n\t"
-        "movq (%1,%3), %%mm2            \n\t"
-        "pavgb 1(%1), %%mm1             \n\t"
-        "pavgb 1(%1,%3), %%mm2          \n\t"
-        "psubusb %%mm5, %%mm1           \n\t"
-        "pavgb %%mm1, %%mm0             \n\t"
-        "pavgb %%mm2, %%mm1             \n\t"
-        "psadbw (%2), %%mm0             \n\t"
-        "psadbw (%2,%3), %%mm1          \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "paddw %%mm1, %%mm6             \n\t"
-        "movq %%mm2, %%mm0              \n\t"
-        "lea (%1,%3,2), %1              \n\t"
-        "lea (%2,%3,2), %2              \n\t"
-        "sub $2, %0                     \n\t"
-        " jg 1b                         \n\t"
-        : "+r" (h), "+r" (blk1), "+r" (blk2)
-        : "r" ((x86_reg)stride)
-    );
-}
-
-static inline void sad8_2_mmx(uint8_t *blk1a, uint8_t *blk1b, uint8_t *blk2, int stride, int h)
-{
-    x86_reg len= -(stride*h);
-    __asm__ volatile(
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "movq (%2, %%"REG_a"), %%mm1    \n\t"
-        "movq (%1, %%"REG_a"), %%mm2    \n\t"
-        "movq (%2, %%"REG_a"), %%mm3    \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpcklbw %%mm7, %%mm1         \n\t"
-        "punpckhbw %%mm7, %%mm2         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "paddw %%mm0, %%mm1             \n\t"
-        "paddw %%mm2, %%mm3             \n\t"
-        "movq (%3, %%"REG_a"), %%mm4    \n\t"
-        "movq (%3, %%"REG_a"), %%mm2    \n\t"
-        "paddw %%mm5, %%mm1             \n\t"
-        "paddw %%mm5, %%mm3             \n\t"
-        "psrlw $1, %%mm1                \n\t"
-        "psrlw $1, %%mm3                \n\t"
-        "packuswb %%mm3, %%mm1          \n\t"
-        "psubusb %%mm1, %%mm4           \n\t"
-        "psubusb %%mm2, %%mm1           \n\t"
-        "por %%mm4, %%mm1               \n\t"
-        "movq %%mm1, %%mm0              \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "paddw %%mm1, %%mm0             \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "add %4, %%"REG_a"              \n\t"
-        " js 1b                         \n\t"
-        : "+a" (len)
-        : "r" (blk1a - len), "r" (blk1b -len), "r" (blk2 - len), "r" ((x86_reg)stride)
-    );
-}
-
-static inline void sad8_4_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    x86_reg len= -(stride*h);
-    __asm__ volatile(
-        "movq (%1, %%"REG_a"), %%mm0    \n\t"
-        "movq 1(%1, %%"REG_a"), %%mm2   \n\t"
-        "movq %%mm0, %%mm1              \n\t"
-        "movq %%mm2, %%mm3              \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpckhbw %%mm7, %%mm1         \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "paddw %%mm2, %%mm0             \n\t"
-        "paddw %%mm3, %%mm1             \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        "movq (%2, %%"REG_a"), %%mm2    \n\t"
-        "movq 1(%2, %%"REG_a"), %%mm4   \n\t"
-        "movq %%mm2, %%mm3              \n\t"
-        "movq %%mm4, %%mm5              \n\t"
-        "punpcklbw %%mm7, %%mm2         \n\t"
-        "punpckhbw %%mm7, %%mm3         \n\t"
-        "punpcklbw %%mm7, %%mm4         \n\t"
-        "punpckhbw %%mm7, %%mm5         \n\t"
-        "paddw %%mm4, %%mm2             \n\t"
-        "paddw %%mm5, %%mm3             \n\t"
-        "movq 16+"MANGLE(round_tab)", %%mm5 \n\t"
-        "paddw %%mm2, %%mm0             \n\t"
-        "paddw %%mm3, %%mm1             \n\t"
-        "paddw %%mm5, %%mm0             \n\t"
-        "paddw %%mm5, %%mm1             \n\t"
-        "movq (%3, %%"REG_a"), %%mm4    \n\t"
-        "movq (%3, %%"REG_a"), %%mm5    \n\t"
-        "psrlw $2, %%mm0                \n\t"
-        "psrlw $2, %%mm1                \n\t"
-        "packuswb %%mm1, %%mm0          \n\t"
-        "psubusb %%mm0, %%mm4           \n\t"
-        "psubusb %%mm5, %%mm0           \n\t"
-        "por %%mm4, %%mm0               \n\t"
-        "movq %%mm0, %%mm4              \n\t"
-        "punpcklbw %%mm7, %%mm0         \n\t"
-        "punpckhbw %%mm7, %%mm4         \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "paddw %%mm4, %%mm6             \n\t"
-        "movq  %%mm2, %%mm0             \n\t"
-        "movq  %%mm3, %%mm1             \n\t"
-        "add %4, %%"REG_a"              \n\t"
-        " js 1b                         \n\t"
-        : "+a" (len)
-        : "r" (blk1 - len), "r" (blk1 -len + stride), "r" (blk2 - len), "r" ((x86_reg)stride)
-    );
-}
-
-static inline int sum_mmx(void)
-{
-    int ret;
-    __asm__ volatile(
-        "movq %%mm6, %%mm0              \n\t"
-        "psrlq $32, %%mm6               \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "movq %%mm6, %%mm0              \n\t"
-        "psrlq $16, %%mm6               \n\t"
-        "paddw %%mm0, %%mm6             \n\t"
-        "movd %%mm6, %0                 \n\t"
-        : "=r" (ret)
-    );
-    return ret&0xFFFF;
-}
-
-static inline int sum_mmx2(void)
-{
-    int ret;
-    __asm__ volatile(
-        "movd %%mm6, %0                 \n\t"
-        : "=r" (ret)
-    );
-    return ret;
-}
-
-static inline void sad8_x2a_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    sad8_2_mmx(blk1, blk1+1, blk2, stride, h);
-}
-static inline void sad8_y2a_mmx(uint8_t *blk1, uint8_t *blk2, int stride, int h)
-{
-    sad8_2_mmx(blk1, blk1+stride, blk2, stride, h);
-}
-
-
-#define PIX_SAD(suf)\
-static int sad8_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    assert(h==8);\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t":);\
-\
-    sad8_1_ ## suf(blk1, blk2, stride, 8);\
-\
-    return sum_ ## suf();\
-}\
-static int sad8_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    assert(h==8);\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t"\
-                 "movq %0, %%mm5        \n\t"\
-                 :: "m"(round_tab[1]) \
-                 );\
-\
-    sad8_x2a_ ## suf(blk1, blk2, stride, 8);\
-\
-    return sum_ ## suf();\
-}\
-\
-static int sad8_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    assert(h==8);\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t"\
-                 "movq %0, %%mm5        \n\t"\
-                 :: "m"(round_tab[1]) \
-                 );\
-\
-    sad8_y2a_ ## suf(blk1, blk2, stride, 8);\
-\
-    return sum_ ## suf();\
-}\
-\
-static int sad8_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    assert(h==8);\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t"\
-                 ::);\
-\
-    sad8_4_ ## suf(blk1, blk2, stride, 8);\
-\
-    return sum_ ## suf();\
-}\
-\
-static int sad16_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t":);\
-\
-    sad8_1_ ## suf(blk1  , blk2  , stride, h);\
-    sad8_1_ ## suf(blk1+8, blk2+8, stride, h);\
-\
-    return sum_ ## suf();\
-}\
-static int sad16_x2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t"\
-                 "movq %0, %%mm5        \n\t"\
-                 :: "m"(round_tab[1]) \
-                 );\
-\
-    sad8_x2a_ ## suf(blk1  , blk2  , stride, h);\
-    sad8_x2a_ ## suf(blk1+8, blk2+8, stride, h);\
-\
-    return sum_ ## suf();\
-}\
-static int sad16_y2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t"\
-                 "movq %0, %%mm5        \n\t"\
-                 :: "m"(round_tab[1]) \
-                 );\
-\
-    sad8_y2a_ ## suf(blk1  , blk2  , stride, h);\
-    sad8_y2a_ ## suf(blk1+8, blk2+8, stride, h);\
-\
-    return sum_ ## suf();\
-}\
-static int sad16_xy2_ ## suf(void *v, uint8_t *blk2, uint8_t *blk1, int stride, int h)\
-{\
-    __asm__ volatile("pxor %%mm7, %%mm7     \n\t"\
-                 "pxor %%mm6, %%mm6     \n\t"\
-                 ::);\
-\
-    sad8_4_ ## suf(blk1  , blk2  , stride, h);\
-    sad8_4_ ## suf(blk1+8, blk2+8, stride, h);\
-\
-    return sum_ ## suf();\
-}\
-
-PIX_SAD(mmx)
-PIX_SAD(mmx2)
-
-void dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx)
-{
-    if (mm_flags & FF_MM_MMX) {
-        c->pix_abs[0][0] = sad16_mmx;
-        c->pix_abs[0][1] = sad16_x2_mmx;
-        c->pix_abs[0][2] = sad16_y2_mmx;
-        c->pix_abs[0][3] = sad16_xy2_mmx;
-        c->pix_abs[1][0] = sad8_mmx;
-        c->pix_abs[1][1] = sad8_x2_mmx;
-        c->pix_abs[1][2] = sad8_y2_mmx;
-        c->pix_abs[1][3] = sad8_xy2_mmx;
-
-        c->sad[0]= sad16_mmx;
-        c->sad[1]= sad8_mmx;
-    }
-    if (mm_flags & FF_MM_MMX2) {
-        c->pix_abs[0][0] = sad16_mmx2;
-        c->pix_abs[1][0] = sad8_mmx2;
-
-        c->sad[0]= sad16_mmx2;
-        c->sad[1]= sad8_mmx2;
-
-        if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
-            c->pix_abs[0][1] = sad16_x2_mmx2;
-            c->pix_abs[0][2] = sad16_y2_mmx2;
-            c->pix_abs[0][3] = sad16_xy2_mmx2;
-            c->pix_abs[1][1] = sad8_x2_mmx2;
-            c->pix_abs[1][2] = sad8_y2_mmx2;
-            c->pix_abs[1][3] = sad8_xy2_mmx2;
-        }
-    }
-    if ((mm_flags & FF_MM_SSE2) && !(mm_flags & FF_MM_3DNOW) && avctx->codec_id != CODEC_ID_SNOW) {
-        c->sad[0]= sad16_sse2;
-    }
-}
diff --git a/libavcodec/x86/mpegvideo_mmx.c b/libavcodec/x86/mpegvideo_mmx.c
deleted file mode 100644
index 5deb68d..0000000
--- a/libavcodec/x86/mpegvideo_mmx.c
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
- * Optimized for ia32 CPUs by Nick Kurshev <nickols_k at mail.ru>
- * h263, mpeg1, mpeg2 dequantizer & draw_edges by Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/dsputil.h"
-#include "libavcodec/mpegvideo.h"
-#include "dsputil_mmx.h"
-
-extern uint16_t inv_zigzag_direct16[64];
-
-
-static void dct_unquantize_h263_intra_mmx(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    x86_reg level, qmul, qadd, nCoeffs;
-
-    qmul = qscale << 1;
-
-    assert(s->block_last_index[n]>=0 || s->h263_aic);
-
-    if (!s->h263_aic) {
-        if (n < 4)
-            level = block[0] * s->y_dc_scale;
-        else
-            level = block[0] * s->c_dc_scale;
-        qadd = (qscale - 1) | 1;
-    }else{
-        qadd = 0;
-        level= block[0];
-    }
-    if(s->ac_pred)
-        nCoeffs=63;
-    else
-        nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-//printf("%d %d  ", qmul, qadd);
-__asm__ volatile(
-                "movd %1, %%mm6                 \n\t" //qmul
-                "packssdw %%mm6, %%mm6          \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "movd %2, %%mm5                 \n\t" //qadd
-                "pxor %%mm7, %%mm7              \n\t"
-                "packssdw %%mm5, %%mm5          \n\t"
-                "packssdw %%mm5, %%mm5          \n\t"
-                "psubw %%mm5, %%mm7             \n\t"
-                "pxor %%mm4, %%mm4              \n\t"
-                ASMALIGN(4)
-                "1:                             \n\t"
-                "movq (%0, %3), %%mm0           \n\t"
-                "movq 8(%0, %3), %%mm1          \n\t"
-
-                "pmullw %%mm6, %%mm0            \n\t"
-                "pmullw %%mm6, %%mm1            \n\t"
-
-                "movq (%0, %3), %%mm2           \n\t"
-                "movq 8(%0, %3), %%mm3          \n\t"
-
-                "pcmpgtw %%mm4, %%mm2           \n\t" // block[i] < 0 ? -1 : 0
-                "pcmpgtw %%mm4, %%mm3           \n\t" // block[i] < 0 ? -1 : 0
-
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-
-                "paddw %%mm7, %%mm0             \n\t"
-                "paddw %%mm7, %%mm1             \n\t"
-
-                "pxor %%mm0, %%mm2              \n\t"
-                "pxor %%mm1, %%mm3              \n\t"
-
-                "pcmpeqw %%mm7, %%mm0           \n\t" // block[i] == 0 ? -1 : 0
-                "pcmpeqw %%mm7, %%mm1           \n\t" // block[i] == 0 ? -1 : 0
-
-                "pandn %%mm2, %%mm0             \n\t"
-                "pandn %%mm3, %%mm1             \n\t"
-
-                "movq %%mm0, (%0, %3)           \n\t"
-                "movq %%mm1, 8(%0, %3)          \n\t"
-
-                "add $16, %3                    \n\t"
-                "jng 1b                         \n\t"
-                ::"r" (block+nCoeffs), "rm"(qmul), "rm" (qadd), "r" (2*(-nCoeffs))
-                : "memory"
-        );
-        block[0]= level;
-}
-
-
-static void dct_unquantize_h263_inter_mmx(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    x86_reg qmul, qadd, nCoeffs;
-
-    qmul = qscale << 1;
-    qadd = (qscale - 1) | 1;
-
-    assert(s->block_last_index[n]>=0 || s->h263_aic);
-
-    nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-//printf("%d %d  ", qmul, qadd);
-__asm__ volatile(
-                "movd %1, %%mm6                 \n\t" //qmul
-                "packssdw %%mm6, %%mm6          \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "movd %2, %%mm5                 \n\t" //qadd
-                "pxor %%mm7, %%mm7              \n\t"
-                "packssdw %%mm5, %%mm5          \n\t"
-                "packssdw %%mm5, %%mm5          \n\t"
-                "psubw %%mm5, %%mm7             \n\t"
-                "pxor %%mm4, %%mm4              \n\t"
-                ASMALIGN(4)
-                "1:                             \n\t"
-                "movq (%0, %3), %%mm0           \n\t"
-                "movq 8(%0, %3), %%mm1          \n\t"
-
-                "pmullw %%mm6, %%mm0            \n\t"
-                "pmullw %%mm6, %%mm1            \n\t"
-
-                "movq (%0, %3), %%mm2           \n\t"
-                "movq 8(%0, %3), %%mm3          \n\t"
-
-                "pcmpgtw %%mm4, %%mm2           \n\t" // block[i] < 0 ? -1 : 0
-                "pcmpgtw %%mm4, %%mm3           \n\t" // block[i] < 0 ? -1 : 0
-
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-
-                "paddw %%mm7, %%mm0             \n\t"
-                "paddw %%mm7, %%mm1             \n\t"
-
-                "pxor %%mm0, %%mm2              \n\t"
-                "pxor %%mm1, %%mm3              \n\t"
-
-                "pcmpeqw %%mm7, %%mm0           \n\t" // block[i] == 0 ? -1 : 0
-                "pcmpeqw %%mm7, %%mm1           \n\t" // block[i] == 0 ? -1 : 0
-
-                "pandn %%mm2, %%mm0             \n\t"
-                "pandn %%mm3, %%mm1             \n\t"
-
-                "movq %%mm0, (%0, %3)           \n\t"
-                "movq %%mm1, 8(%0, %3)          \n\t"
-
-                "add $16, %3                    \n\t"
-                "jng 1b                         \n\t"
-                ::"r" (block+nCoeffs), "rm"(qmul), "rm" (qadd), "r" (2*(-nCoeffs))
-                : "memory"
-        );
-}
-
-
-/*
-  NK:
-  Note: looking at PARANOID:
-  "enable all paranoid tests for rounding, overflows, etc..."
-
-#ifdef PARANOID
-                if (level < -2048 || level > 2047)
-                    fprintf(stderr, "unquant error %d %d\n", i, level);
-#endif
-  We can suppose that result of two multiplications can't be greater than 0xFFFF
-  i.e. is 16-bit, so we use here only PMULLW instruction and can avoid
-  a complex multiplication.
-=====================================================
- Full formula for multiplication of 2 integer numbers
- which are represent as high:low words:
- input: value1 = high1:low1
-        value2 = high2:low2
- output: value3 = value1*value2
- value3=high3:low3 (on overflow: modulus 2^32 wrap-around)
- this mean that for 0x123456 * 0x123456 correct result is 0x766cb0ce4
- but this algorithm will compute only 0x66cb0ce4
- this limited by 16-bit size of operands
- ---------------------------------
- tlow1 = high1*low2
- tlow2 = high2*low1
- tlow1 = tlow1 + tlow2
- high3:low3 = low1*low2
- high3 += tlow1
-*/
-static void dct_unquantize_mpeg1_intra_mmx(MpegEncContext *s,
-                                     DCTELEM *block, int n, int qscale)
-{
-    x86_reg nCoeffs;
-    const uint16_t *quant_matrix;
-    int block0;
-
-    assert(s->block_last_index[n]>=0);
-
-    nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1;
-
-    if (n < 4)
-        block0 = block[0] * s->y_dc_scale;
-    else
-        block0 = block[0] * s->c_dc_scale;
-    /* XXX: only mpeg1 */
-    quant_matrix = s->intra_matrix;
-__asm__ volatile(
-                "pcmpeqw %%mm7, %%mm7           \n\t"
-                "psrlw $15, %%mm7               \n\t"
-                "movd %2, %%mm6                 \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
-                "1:                             \n\t"
-                "movq (%0, %%"REG_a"), %%mm0    \n\t"
-                "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
-                "movq (%1, %%"REG_a"), %%mm4    \n\t"
-                "movq 8(%1, %%"REG_a"), %%mm5   \n\t"
-                "pmullw %%mm6, %%mm4            \n\t" // q=qscale*quant_matrix[i]
-                "pmullw %%mm6, %%mm5            \n\t" // q=qscale*quant_matrix[i]
-                "pxor %%mm2, %%mm2              \n\t"
-                "pxor %%mm3, %%mm3              \n\t"
-                "pcmpgtw %%mm0, %%mm2           \n\t" // block[i] < 0 ? -1 : 0
-                "pcmpgtw %%mm1, %%mm3           \n\t" // block[i] < 0 ? -1 : 0
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t" // abs(block[i])
-                "psubw %%mm3, %%mm1             \n\t" // abs(block[i])
-                "pmullw %%mm4, %%mm0            \n\t" // abs(block[i])*q
-                "pmullw %%mm5, %%mm1            \n\t" // abs(block[i])*q
-                "pxor %%mm4, %%mm4              \n\t"
-                "pxor %%mm5, %%mm5              \n\t" // FIXME slow
-                "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
-                "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
-                "psraw $3, %%mm0                \n\t"
-                "psraw $3, %%mm1                \n\t"
-                "psubw %%mm7, %%mm0             \n\t"
-                "psubw %%mm7, %%mm1             \n\t"
-                "por %%mm7, %%mm0               \n\t"
-                "por %%mm7, %%mm1               \n\t"
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t"
-                "psubw %%mm3, %%mm1             \n\t"
-                "pandn %%mm0, %%mm4             \n\t"
-                "pandn %%mm1, %%mm5             \n\t"
-                "movq %%mm4, (%0, %%"REG_a")    \n\t"
-                "movq %%mm5, 8(%0, %%"REG_a")   \n\t"
-
-                "add $16, %%"REG_a"             \n\t"
-                "js 1b                          \n\t"
-                ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
-                : "%"REG_a, "memory"
-        );
-    block[0]= block0;
-}
-
-static void dct_unquantize_mpeg1_inter_mmx(MpegEncContext *s,
-                                     DCTELEM *block, int n, int qscale)
-{
-    x86_reg nCoeffs;
-    const uint16_t *quant_matrix;
-
-    assert(s->block_last_index[n]>=0);
-
-    nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ]+1;
-
-        quant_matrix = s->inter_matrix;
-__asm__ volatile(
-                "pcmpeqw %%mm7, %%mm7           \n\t"
-                "psrlw $15, %%mm7               \n\t"
-                "movd %2, %%mm6                 \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
-                "1:                             \n\t"
-                "movq (%0, %%"REG_a"), %%mm0    \n\t"
-                "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
-                "movq (%1, %%"REG_a"), %%mm4    \n\t"
-                "movq 8(%1, %%"REG_a"), %%mm5   \n\t"
-                "pmullw %%mm6, %%mm4            \n\t" // q=qscale*quant_matrix[i]
-                "pmullw %%mm6, %%mm5            \n\t" // q=qscale*quant_matrix[i]
-                "pxor %%mm2, %%mm2              \n\t"
-                "pxor %%mm3, %%mm3              \n\t"
-                "pcmpgtw %%mm0, %%mm2           \n\t" // block[i] < 0 ? -1 : 0
-                "pcmpgtw %%mm1, %%mm3           \n\t" // block[i] < 0 ? -1 : 0
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t" // abs(block[i])
-                "psubw %%mm3, %%mm1             \n\t" // abs(block[i])
-                "paddw %%mm0, %%mm0             \n\t" // abs(block[i])*2
-                "paddw %%mm1, %%mm1             \n\t" // abs(block[i])*2
-                "paddw %%mm7, %%mm0             \n\t" // abs(block[i])*2 + 1
-                "paddw %%mm7, %%mm1             \n\t" // abs(block[i])*2 + 1
-                "pmullw %%mm4, %%mm0            \n\t" // (abs(block[i])*2 + 1)*q
-                "pmullw %%mm5, %%mm1            \n\t" // (abs(block[i])*2 + 1)*q
-                "pxor %%mm4, %%mm4              \n\t"
-                "pxor %%mm5, %%mm5              \n\t" // FIXME slow
-                "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
-                "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
-                "psraw $4, %%mm0                \n\t"
-                "psraw $4, %%mm1                \n\t"
-                "psubw %%mm7, %%mm0             \n\t"
-                "psubw %%mm7, %%mm1             \n\t"
-                "por %%mm7, %%mm0               \n\t"
-                "por %%mm7, %%mm1               \n\t"
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t"
-                "psubw %%mm3, %%mm1             \n\t"
-                "pandn %%mm0, %%mm4             \n\t"
-                "pandn %%mm1, %%mm5             \n\t"
-                "movq %%mm4, (%0, %%"REG_a")    \n\t"
-                "movq %%mm5, 8(%0, %%"REG_a")   \n\t"
-
-                "add $16, %%"REG_a"             \n\t"
-                "js 1b                          \n\t"
-                ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
-                : "%"REG_a, "memory"
-        );
-}
-
-static void dct_unquantize_mpeg2_intra_mmx(MpegEncContext *s,
-                                     DCTELEM *block, int n, int qscale)
-{
-    x86_reg nCoeffs;
-    const uint16_t *quant_matrix;
-    int block0;
-
-    assert(s->block_last_index[n]>=0);
-
-    if(s->alternate_scan) nCoeffs= 63; //FIXME
-    else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
-
-    if (n < 4)
-        block0 = block[0] * s->y_dc_scale;
-    else
-        block0 = block[0] * s->c_dc_scale;
-    quant_matrix = s->intra_matrix;
-__asm__ volatile(
-                "pcmpeqw %%mm7, %%mm7           \n\t"
-                "psrlw $15, %%mm7               \n\t"
-                "movd %2, %%mm6                 \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
-                "1:                             \n\t"
-                "movq (%0, %%"REG_a"), %%mm0    \n\t"
-                "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
-                "movq (%1, %%"REG_a"), %%mm4    \n\t"
-                "movq 8(%1, %%"REG_a"), %%mm5   \n\t"
-                "pmullw %%mm6, %%mm4            \n\t" // q=qscale*quant_matrix[i]
-                "pmullw %%mm6, %%mm5            \n\t" // q=qscale*quant_matrix[i]
-                "pxor %%mm2, %%mm2              \n\t"
-                "pxor %%mm3, %%mm3              \n\t"
-                "pcmpgtw %%mm0, %%mm2           \n\t" // block[i] < 0 ? -1 : 0
-                "pcmpgtw %%mm1, %%mm3           \n\t" // block[i] < 0 ? -1 : 0
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t" // abs(block[i])
-                "psubw %%mm3, %%mm1             \n\t" // abs(block[i])
-                "pmullw %%mm4, %%mm0            \n\t" // abs(block[i])*q
-                "pmullw %%mm5, %%mm1            \n\t" // abs(block[i])*q
-                "pxor %%mm4, %%mm4              \n\t"
-                "pxor %%mm5, %%mm5              \n\t" // FIXME slow
-                "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
-                "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
-                "psraw $3, %%mm0                \n\t"
-                "psraw $3, %%mm1                \n\t"
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t"
-                "psubw %%mm3, %%mm1             \n\t"
-                "pandn %%mm0, %%mm4             \n\t"
-                "pandn %%mm1, %%mm5             \n\t"
-                "movq %%mm4, (%0, %%"REG_a")    \n\t"
-                "movq %%mm5, 8(%0, %%"REG_a")   \n\t"
-
-                "add $16, %%"REG_a"             \n\t"
-                "jng 1b                         \n\t"
-                ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "g" (-2*nCoeffs)
-                : "%"REG_a, "memory"
-        );
-    block[0]= block0;
-        //Note, we do not do mismatch control for intra as errors cannot accumulate
-}
-
-static void dct_unquantize_mpeg2_inter_mmx(MpegEncContext *s,
-                                     DCTELEM *block, int n, int qscale)
-{
-    x86_reg nCoeffs;
-    const uint16_t *quant_matrix;
-
-    assert(s->block_last_index[n]>=0);
-
-    if(s->alternate_scan) nCoeffs= 63; //FIXME
-    else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
-
-        quant_matrix = s->inter_matrix;
-__asm__ volatile(
-                "pcmpeqw %%mm7, %%mm7           \n\t"
-                "psrlq $48, %%mm7               \n\t"
-                "movd %2, %%mm6                 \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "packssdw %%mm6, %%mm6          \n\t"
-                "mov %3, %%"REG_a"              \n\t"
-                ASMALIGN(4)
-                "1:                             \n\t"
-                "movq (%0, %%"REG_a"), %%mm0    \n\t"
-                "movq 8(%0, %%"REG_a"), %%mm1   \n\t"
-                "movq (%1, %%"REG_a"), %%mm4    \n\t"
-                "movq 8(%1, %%"REG_a"), %%mm5   \n\t"
-                "pmullw %%mm6, %%mm4            \n\t" // q=qscale*quant_matrix[i]
-                "pmullw %%mm6, %%mm5            \n\t" // q=qscale*quant_matrix[i]
-                "pxor %%mm2, %%mm2              \n\t"
-                "pxor %%mm3, %%mm3              \n\t"
-                "pcmpgtw %%mm0, %%mm2           \n\t" // block[i] < 0 ? -1 : 0
-                "pcmpgtw %%mm1, %%mm3           \n\t" // block[i] < 0 ? -1 : 0
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t" // abs(block[i])
-                "psubw %%mm3, %%mm1             \n\t" // abs(block[i])
-                "paddw %%mm0, %%mm0             \n\t" // abs(block[i])*2
-                "paddw %%mm1, %%mm1             \n\t" // abs(block[i])*2
-                "pmullw %%mm4, %%mm0            \n\t" // abs(block[i])*2*q
-                "pmullw %%mm5, %%mm1            \n\t" // abs(block[i])*2*q
-                "paddw %%mm4, %%mm0             \n\t" // (abs(block[i])*2 + 1)*q
-                "paddw %%mm5, %%mm1             \n\t" // (abs(block[i])*2 + 1)*q
-                "pxor %%mm4, %%mm4              \n\t"
-                "pxor %%mm5, %%mm5              \n\t" // FIXME slow
-                "pcmpeqw (%0, %%"REG_a"), %%mm4 \n\t" // block[i] == 0 ? -1 : 0
-                "pcmpeqw 8(%0, %%"REG_a"), %%mm5\n\t" // block[i] == 0 ? -1 : 0
-                "psrlw $4, %%mm0                \n\t"
-                "psrlw $4, %%mm1                \n\t"
-                "pxor %%mm2, %%mm0              \n\t"
-                "pxor %%mm3, %%mm1              \n\t"
-                "psubw %%mm2, %%mm0             \n\t"
-                "psubw %%mm3, %%mm1             \n\t"
-                "pandn %%mm0, %%mm4             \n\t"
-                "pandn %%mm1, %%mm5             \n\t"
-                "pxor %%mm4, %%mm7              \n\t"
-                "pxor %%mm5, %%mm7              \n\t"
-                "movq %%mm4, (%0, %%"REG_a")    \n\t"
-                "movq %%mm5, 8(%0, %%"REG_a")   \n\t"
-
-                "add $16, %%"REG_a"             \n\t"
-                "jng 1b                         \n\t"
-                "movd 124(%0, %3), %%mm0        \n\t"
-                "movq %%mm7, %%mm6              \n\t"
-                "psrlq $32, %%mm7               \n\t"
-                "pxor %%mm6, %%mm7              \n\t"
-                "movq %%mm7, %%mm6              \n\t"
-                "psrlq $16, %%mm7               \n\t"
-                "pxor %%mm6, %%mm7              \n\t"
-                "pslld $31, %%mm7               \n\t"
-                "psrlq $15, %%mm7               \n\t"
-                "pxor %%mm7, %%mm0              \n\t"
-                "movd %%mm0, 124(%0, %3)        \n\t"
-
-                ::"r" (block+nCoeffs), "r"(quant_matrix+nCoeffs), "rm" (qscale), "r" (-2*nCoeffs)
-                : "%"REG_a, "memory"
-        );
-}
-
-static void  denoise_dct_mmx(MpegEncContext *s, DCTELEM *block){
-    const int intra= s->mb_intra;
-    int *sum= s->dct_error_sum[intra];
-    uint16_t *offset= s->dct_offset[intra];
-
-    s->dct_count[intra]++;
-
-    __asm__ volatile(
-        "pxor %%mm7, %%mm7                      \n\t"
-        "1:                                     \n\t"
-        "pxor %%mm0, %%mm0                      \n\t"
-        "pxor %%mm1, %%mm1                      \n\t"
-        "movq (%0), %%mm2                       \n\t"
-        "movq 8(%0), %%mm3                      \n\t"
-        "pcmpgtw %%mm2, %%mm0                   \n\t"
-        "pcmpgtw %%mm3, %%mm1                   \n\t"
-        "pxor %%mm0, %%mm2                      \n\t"
-        "pxor %%mm1, %%mm3                      \n\t"
-        "psubw %%mm0, %%mm2                     \n\t"
-        "psubw %%mm1, %%mm3                     \n\t"
-        "movq %%mm2, %%mm4                      \n\t"
-        "movq %%mm3, %%mm5                      \n\t"
-        "psubusw (%2), %%mm2                    \n\t"
-        "psubusw 8(%2), %%mm3                   \n\t"
-        "pxor %%mm0, %%mm2                      \n\t"
-        "pxor %%mm1, %%mm3                      \n\t"
-        "psubw %%mm0, %%mm2                     \n\t"
-        "psubw %%mm1, %%mm3                     \n\t"
-        "movq %%mm2, (%0)                       \n\t"
-        "movq %%mm3, 8(%0)                      \n\t"
-        "movq %%mm4, %%mm2                      \n\t"
-        "movq %%mm5, %%mm3                      \n\t"
-        "punpcklwd %%mm7, %%mm4                 \n\t"
-        "punpckhwd %%mm7, %%mm2                 \n\t"
-        "punpcklwd %%mm7, %%mm5                 \n\t"
-        "punpckhwd %%mm7, %%mm3                 \n\t"
-        "paddd (%1), %%mm4                      \n\t"
-        "paddd 8(%1), %%mm2                     \n\t"
-        "paddd 16(%1), %%mm5                    \n\t"
-        "paddd 24(%1), %%mm3                    \n\t"
-        "movq %%mm4, (%1)                       \n\t"
-        "movq %%mm2, 8(%1)                      \n\t"
-        "movq %%mm5, 16(%1)                     \n\t"
-        "movq %%mm3, 24(%1)                     \n\t"
-        "add $16, %0                            \n\t"
-        "add $32, %1                            \n\t"
-        "add $16, %2                            \n\t"
-        "cmp %3, %0                             \n\t"
-            " jb 1b                             \n\t"
-        : "+r" (block), "+r" (sum), "+r" (offset)
-        : "r"(block+64)
-    );
-}
-
-static void  denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){
-    const int intra= s->mb_intra;
-    int *sum= s->dct_error_sum[intra];
-    uint16_t *offset= s->dct_offset[intra];
-
-    s->dct_count[intra]++;
-
-    __asm__ volatile(
-        "pxor %%xmm7, %%xmm7                    \n\t"
-        "1:                                     \n\t"
-        "pxor %%xmm0, %%xmm0                    \n\t"
-        "pxor %%xmm1, %%xmm1                    \n\t"
-        "movdqa (%0), %%xmm2                    \n\t"
-        "movdqa 16(%0), %%xmm3                  \n\t"
-        "pcmpgtw %%xmm2, %%xmm0                 \n\t"
-        "pcmpgtw %%xmm3, %%xmm1                 \n\t"
-        "pxor %%xmm0, %%xmm2                    \n\t"
-        "pxor %%xmm1, %%xmm3                    \n\t"
-        "psubw %%xmm0, %%xmm2                   \n\t"
-        "psubw %%xmm1, %%xmm3                   \n\t"
-        "movdqa %%xmm2, %%xmm4                  \n\t"
-        "movdqa %%xmm3, %%xmm5                  \n\t"
-        "psubusw (%2), %%xmm2                   \n\t"
-        "psubusw 16(%2), %%xmm3                 \n\t"
-        "pxor %%xmm0, %%xmm2                    \n\t"
-        "pxor %%xmm1, %%xmm3                    \n\t"
-        "psubw %%xmm0, %%xmm2                   \n\t"
-        "psubw %%xmm1, %%xmm3                   \n\t"
-        "movdqa %%xmm2, (%0)                    \n\t"
-        "movdqa %%xmm3, 16(%0)                  \n\t"
-        "movdqa %%xmm4, %%xmm6                  \n\t"
-        "movdqa %%xmm5, %%xmm0                  \n\t"
-        "punpcklwd %%xmm7, %%xmm4               \n\t"
-        "punpckhwd %%xmm7, %%xmm6               \n\t"
-        "punpcklwd %%xmm7, %%xmm5               \n\t"
-        "punpckhwd %%xmm7, %%xmm0               \n\t"
-        "paddd (%1), %%xmm4                     \n\t"
-        "paddd 16(%1), %%xmm6                   \n\t"
-        "paddd 32(%1), %%xmm5                   \n\t"
-        "paddd 48(%1), %%xmm0                   \n\t"
-        "movdqa %%xmm4, (%1)                    \n\t"
-        "movdqa %%xmm6, 16(%1)                  \n\t"
-        "movdqa %%xmm5, 32(%1)                  \n\t"
-        "movdqa %%xmm0, 48(%1)                  \n\t"
-        "add $32, %0                            \n\t"
-        "add $64, %1                            \n\t"
-        "add $32, %2                            \n\t"
-        "cmp %3, %0                             \n\t"
-            " jb 1b                             \n\t"
-        : "+r" (block), "+r" (sum), "+r" (offset)
-        : "r"(block+64)
-    );
-}
-
-#if HAVE_SSSE3
-#define HAVE_SSSE3_BAK
-#endif
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 0
-
-#undef HAVE_SSE2
-#undef HAVE_MMX2
-#define HAVE_SSE2 0
-#define HAVE_MMX2 0
-#define RENAME(a) a ## _MMX
-#define RENAMEl(a) a ## _mmx
-#include "mpegvideo_mmx_template.c"
-
-#undef HAVE_MMX2
-#define HAVE_MMX2 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _MMX2
-#define RENAMEl(a) a ## _mmx2
-#include "mpegvideo_mmx_template.c"
-
-#undef HAVE_SSE2
-#define HAVE_SSE2 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _SSE2
-#define RENAMEl(a) a ## _sse2
-#include "mpegvideo_mmx_template.c"
-
-#ifdef HAVE_SSSE3_BAK
-#undef HAVE_SSSE3
-#define HAVE_SSSE3 1
-#undef RENAME
-#undef RENAMEl
-#define RENAME(a) a ## _SSSE3
-#define RENAMEl(a) a ## _sse2
-#include "mpegvideo_mmx_template.c"
-#endif
-
-void MPV_common_init_mmx(MpegEncContext *s)
-{
-    if (mm_flags & FF_MM_MMX) {
-        const int dct_algo = s->avctx->dct_algo;
-
-        s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_mmx;
-        s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_mmx;
-        s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_mmx;
-        s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_mmx;
-        if(!(s->flags & CODEC_FLAG_BITEXACT))
-            s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_mmx;
-        s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_mmx;
-
-        if (mm_flags & FF_MM_SSE2) {
-            s->denoise_dct= denoise_dct_sse2;
-        } else {
-                s->denoise_dct= denoise_dct_mmx;
-        }
-
-        if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
-#if HAVE_SSSE3
-            if(mm_flags & FF_MM_SSSE3){
-                s->dct_quantize= dct_quantize_SSSE3;
-            } else
-#endif
-            if(mm_flags & FF_MM_SSE2){
-                s->dct_quantize= dct_quantize_SSE2;
-            } else if(mm_flags & FF_MM_MMX2){
-                s->dct_quantize= dct_quantize_MMX2;
-            } else {
-                s->dct_quantize= dct_quantize_MMX;
-            }
-        }
-    }
-}
diff --git a/libavcodec/x86/mpegvideo_mmx_template.c b/libavcodec/x86/mpegvideo_mmx_template.c
deleted file mode 100644
index 0d92792..0000000
--- a/libavcodec/x86/mpegvideo_mmx_template.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * MPEG video MMX templates
- *
- * Copyright (c) 2002 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef MMREG_WIDTH
-#undef MM
-#undef MOVQ
-#undef SPREADW
-#undef PMAXW
-#undef PMAX
-#undef SAVE_SIGN
-#undef RESTORE_SIGN
-
-#if HAVE_SSE2
-#define MMREG_WIDTH "16"
-#define MM "%%xmm"
-#define MOVQ "movdqa"
-#define SPREADW(a) \
-            "pshuflw $0, "a", "a"       \n\t"\
-            "punpcklwd "a", "a"         \n\t"
-#define PMAXW(a,b) "pmaxsw "a", "b"     \n\t"
-#define PMAX(a,b) \
-            "movhlps "a", "b"           \n\t"\
-            PMAXW(b, a)\
-            "pshuflw $0x0E, "a", "b"    \n\t"\
-            PMAXW(b, a)\
-            "pshuflw $0x01, "a", "b"    \n\t"\
-            PMAXW(b, a)
-#else
-#define MMREG_WIDTH "8"
-#define MM "%%mm"
-#define MOVQ "movq"
-#if HAVE_MMX2
-#define SPREADW(a) "pshufw $0, "a", "a" \n\t"
-#define PMAXW(a,b) "pmaxsw "a", "b"     \n\t"
-#define PMAX(a,b) \
-            "pshufw $0x0E, "a", "b"     \n\t"\
-            PMAXW(b, a)\
-            "pshufw $0x01, "a", "b"     \n\t"\
-            PMAXW(b, a)
-#else
-#define SPREADW(a) \
-            "punpcklwd "a", "a"         \n\t"\
-            "punpcklwd "a", "a"         \n\t"
-#define PMAXW(a,b) \
-            "psubusw "a", "b"           \n\t"\
-            "paddw "a", "b"             \n\t"
-#define PMAX(a,b)  \
-            "movq "a", "b"              \n\t"\
-            "psrlq $32, "a"             \n\t"\
-            PMAXW(b, a)\
-            "movq "a", "b"              \n\t"\
-            "psrlq $16, "a"             \n\t"\
-            PMAXW(b, a)
-
-#endif
-#endif
-
-#if HAVE_SSSE3
-#define SAVE_SIGN(a,b) \
-            "movdqa "b", "a"            \n\t"\
-            "pabsw  "b", "b"            \n\t"
-#define RESTORE_SIGN(a,b) \
-            "psignw "a", "b"            \n\t"
-#else
-#define SAVE_SIGN(a,b) \
-            "pxor "a", "a"              \n\t"\
-            "pcmpgtw "b", "a"           \n\t" /* block[i] <= 0 ? 0xFF : 0x00 */\
-            "pxor "a", "b"              \n\t"\
-            "psubw "a", "b"             \n\t" /* ABS(block[i]) */
-#define RESTORE_SIGN(a,b) \
-            "pxor "a", "b"              \n\t"\
-            "psubw "a", "b"             \n\t" // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
-#endif
-
-static int RENAME(dct_quantize)(MpegEncContext *s,
-                            DCTELEM *block, int n,
-                            int qscale, int *overflow)
-{
-    x86_reg last_non_zero_p1;
-    int level=0, q; //=0 is because gcc says uninitialized ...
-    const uint16_t *qmat, *bias;
-    DECLARE_ALIGNED(16, int16_t, temp_block)[64];
-
-    assert((7&(int)(&temp_block[0])) == 0); //did gcc align it correctly?
-
-    //s->fdct (block);
-    RENAMEl(ff_fdct) (block); //cannot be anything else ...
-
-    if(s->dct_error_sum)
-        s->denoise_dct(s, block);
-
-    if (s->mb_intra) {
-        int dummy;
-        if (n < 4)
-            q = s->y_dc_scale;
-        else
-            q = s->c_dc_scale;
-        /* note: block[0] is assumed to be positive */
-        if (!s->h263_aic) {
-#if 1
-        __asm__ volatile (
-                "mul %%ecx                \n\t"
-                : "=d" (level), "=a"(dummy)
-                : "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1])
-        );
-#else
-        __asm__ volatile (
-                "xorl %%edx, %%edx        \n\t"
-                "divw %%cx                \n\t"
-                "movzwl %%ax, %%eax       \n\t"
-                : "=a" (level)
-                : "a" ((block[0]>>2) + q), "c" (q<<1)
-                : "%edx"
-        );
-#endif
-        } else
-            /* For AIC we skip quant/dequant of INTRADC */
-            level = (block[0] + 4)>>3;
-
-        block[0]=0; //avoid fake overflow
-//        temp_block[0] = (block[0] + (q >> 1)) / q;
-        last_non_zero_p1 = 1;
-        bias = s->q_intra_matrix16[qscale][1];
-        qmat = s->q_intra_matrix16[qscale][0];
-    } else {
-        last_non_zero_p1 = 0;
-        bias = s->q_inter_matrix16[qscale][1];
-        qmat = s->q_inter_matrix16[qscale][0];
-    }
-
-    if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){
-
-        __asm__ volatile(
-            "movd %%"REG_a", "MM"3              \n\t" // last_non_zero_p1
-            SPREADW(MM"3")
-            "pxor "MM"7, "MM"7                  \n\t" // 0
-            "pxor "MM"4, "MM"4                  \n\t" // 0
-            MOVQ" (%2), "MM"5                   \n\t" // qmat[0]
-            "pxor "MM"6, "MM"6                  \n\t"
-            "psubw (%3), "MM"6                  \n\t" // -bias[0]
-            "mov $-128, %%"REG_a"               \n\t"
-            ASMALIGN(4)
-            "1:                                 \n\t"
-            MOVQ" (%1, %%"REG_a"), "MM"0        \n\t" // block[i]
-            SAVE_SIGN(MM"1", MM"0")                   // ABS(block[i])
-            "psubusw "MM"6, "MM"0               \n\t" // ABS(block[i]) + bias[0]
-            "pmulhw "MM"5, "MM"0                \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
-            "por "MM"0, "MM"4                   \n\t"
-            RESTORE_SIGN(MM"1", MM"0")                // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
-            MOVQ" "MM"0, (%5, %%"REG_a")        \n\t"
-            "pcmpeqw "MM"7, "MM"0               \n\t" // out==0 ? 0xFF : 0x00
-            MOVQ" (%4, %%"REG_a"), "MM"1        \n\t"
-            MOVQ" "MM"7, (%1, %%"REG_a")        \n\t" // 0
-            "pandn "MM"1, "MM"0                 \n\t"
-            PMAXW(MM"0", MM"3")
-            "add $"MMREG_WIDTH", %%"REG_a"      \n\t"
-            " js 1b                             \n\t"
-            PMAX(MM"3", MM"0")
-            "movd "MM"3, %%"REG_a"              \n\t"
-            "movzb %%al, %%"REG_a"              \n\t" // last_non_zero_p1
-            : "+a" (last_non_zero_p1)
-            : "r" (block+64), "r" (qmat), "r" (bias),
-              "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
-        );
-    }else{ // FMT_H263
-        __asm__ volatile(
-            "movd %%"REG_a", "MM"3              \n\t" // last_non_zero_p1
-            SPREADW(MM"3")
-            "pxor "MM"7, "MM"7                  \n\t" // 0
-            "pxor "MM"4, "MM"4                  \n\t" // 0
-            "mov $-128, %%"REG_a"               \n\t"
-            ASMALIGN(4)
-            "1:                                 \n\t"
-            MOVQ" (%1, %%"REG_a"), "MM"0        \n\t" // block[i]
-            SAVE_SIGN(MM"1", MM"0")                   // ABS(block[i])
-            MOVQ" (%3, %%"REG_a"), "MM"6        \n\t" // bias[0]
-            "paddusw "MM"6, "MM"0               \n\t" // ABS(block[i]) + bias[0]
-            MOVQ" (%2, %%"REG_a"), "MM"5        \n\t" // qmat[i]
-            "pmulhw "MM"5, "MM"0                \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
-            "por "MM"0, "MM"4                   \n\t"
-            RESTORE_SIGN(MM"1", MM"0")                // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
-            MOVQ" "MM"0, (%5, %%"REG_a")        \n\t"
-            "pcmpeqw "MM"7, "MM"0               \n\t" // out==0 ? 0xFF : 0x00
-            MOVQ" (%4, %%"REG_a"), "MM"1        \n\t"
-            MOVQ" "MM"7, (%1, %%"REG_a")        \n\t" // 0
-            "pandn "MM"1, "MM"0                 \n\t"
-            PMAXW(MM"0", MM"3")
-            "add $"MMREG_WIDTH", %%"REG_a"      \n\t"
-            " js 1b                             \n\t"
-            PMAX(MM"3", MM"0")
-            "movd "MM"3, %%"REG_a"              \n\t"
-            "movzb %%al, %%"REG_a"              \n\t" // last_non_zero_p1
-            : "+a" (last_non_zero_p1)
-            : "r" (block+64), "r" (qmat+64), "r" (bias+64),
-              "r" (inv_zigzag_direct16+64), "r" (temp_block+64)
-        );
-    }
-    __asm__ volatile(
-        "movd %1, "MM"1                     \n\t" // max_qcoeff
-        SPREADW(MM"1")
-        "psubusw "MM"1, "MM"4               \n\t"
-        "packuswb "MM"4, "MM"4              \n\t"
-#if HAVE_SSE2
-        "packuswb "MM"4, "MM"4              \n\t"
-#endif
-        "movd "MM"4, %0                     \n\t" // *overflow
-        : "=g" (*overflow)
-        : "g" (s->max_qcoeff)
-    );
-
-    if(s->mb_intra) block[0]= level;
-    else            block[0]= temp_block[0];
-
-    if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){
-        if(last_non_zero_p1 <= 1) goto end;
-        block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];
-        block[0x20] = temp_block[0x10];
-        if(last_non_zero_p1 <= 4) goto end;
-        block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];
-        block[0x09] = temp_block[0x03];
-        if(last_non_zero_p1 <= 7) goto end;
-        block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];
-        block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];
-        if(last_non_zero_p1 <= 11) goto end;
-        block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];
-        block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];
-        block[0x0C] = temp_block[0x05];
-        if(last_non_zero_p1 <= 16) goto end;
-        block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];
-        block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];
-        block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];
-        block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];
-        if(last_non_zero_p1 <= 24) goto end;
-        block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];
-        block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];
-        block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];
-        block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];
-        if(last_non_zero_p1 <= 32) goto end;
-        block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];
-        block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];
-        block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];
-        block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];
-        if(last_non_zero_p1 <= 40) goto end;
-        block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];
-        block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];
-        block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];
-        block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];
-        if(last_non_zero_p1 <= 48) goto end;
-        block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
-        block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];
-        block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
-        block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
-        if(last_non_zero_p1 <= 56) goto end;
-        block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];
-        block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];
-        block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];
-        block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
-    }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){
-        if(last_non_zero_p1 <= 1) goto end;
-        block[0x04] = temp_block[0x01];
-        block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
-        if(last_non_zero_p1 <= 4) goto end;
-        block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];
-        block[0x05] = temp_block[0x03];
-        if(last_non_zero_p1 <= 7) goto end;
-        block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];
-        block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
-        if(last_non_zero_p1 <= 11) goto end;
-        block[0x1C] = temp_block[0x19];
-        block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];
-        block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];
-        if(last_non_zero_p1 <= 16) goto end;
-        block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];
-        block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];
-        block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
-        block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];
-        if(last_non_zero_p1 <= 24) goto end;
-        block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];
-        block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];
-        block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];
-        block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];
-        if(last_non_zero_p1 <= 32) goto end;
-        block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];
-        block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];
-        block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];
-        block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];
-        if(last_non_zero_p1 <= 40) goto end;
-        block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];
-        block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
-        block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];
-        block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];
-        if(last_non_zero_p1 <= 48) goto end;
-        block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];
-        block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];
-            block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
-        block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];
-        if(last_non_zero_p1 <= 56) goto end;
-        block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];
-        block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];
-        block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
-        block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
-    }else{
-        if(last_non_zero_p1 <= 1) goto end;
-        block[0x01] = temp_block[0x01];
-        block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
-        if(last_non_zero_p1 <= 4) goto end;
-        block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];
-        block[0x03] = temp_block[0x03];
-        if(last_non_zero_p1 <= 7) goto end;
-        block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];
-        block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
-        if(last_non_zero_p1 <= 11) goto end;
-        block[0x19] = temp_block[0x19];
-        block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];
-        block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];
-        if(last_non_zero_p1 <= 16) goto end;
-        block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];
-        block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];
-        block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
-        block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];
-        if(last_non_zero_p1 <= 24) goto end;
-        block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];
-        block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];
-        block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];
-        block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];
-        if(last_non_zero_p1 <= 32) goto end;
-        block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];
-        block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];
-        block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];
-        block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
-        if(last_non_zero_p1 <= 40) goto end;
-        block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];
-        block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
-        block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];
-        block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];
-        if(last_non_zero_p1 <= 48) goto end;
-        block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
-        block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
-        block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
-        block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];
-        if(last_non_zero_p1 <= 56) goto end;
-        block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];
-        block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
-        block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
-        block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
-    }
-    end:
-/*
-    for(i=0; i<last_non_zero_p1; i++)
-    {
-       int j= zigzag_direct_noperm[i];
-       block[block_permute_op(j)]= temp_block[j];
-    }
-*/
-
-    return last_non_zero_p1 - 1;
-}
diff --git a/libavcodec/x86/rv40dsp_mmx.c b/libavcodec/x86/rv40dsp_mmx.c
deleted file mode 100644
index 2b154c0..0000000
--- a/libavcodec/x86/rv40dsp_mmx.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2008 Konstantin Shishkov, Mathieu Velten
- *
- * MMX-optimized DSP functions for RV40, based on H.264 optimizations by
- * Michael Niedermayer and Loren Merritt
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "dsputil_mmx.h"
-
-/* bias interleaved with bias div 8, use p+1 to access bias div 8 */
-DECLARE_ALIGNED(8, static const uint64_t, rv40_bias_reg)[4][8] = {
-    { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0010001000100010ULL, 0x0002000200020002ULL,
-      0x0020002000200020ULL, 0x0004000400040004ULL, 0x0010001000100010ULL, 0x0002000200020002ULL },
-    { 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL,
-      0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL },
-    { 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0020002000200020ULL, 0x0004000400040004ULL,
-      0x0010001000100010ULL, 0x0002000200020002ULL, 0x0020002000200020ULL, 0x0004000400040004ULL },
-    { 0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL,
-      0x0020002000200020ULL, 0x0004000400040004ULL, 0x001C001C001C001CULL, 0x0003000300030003ULL }
-};
-
-static void put_rv40_chroma_mc8_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    put_h264_chroma_generic_mc8_mmx(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]);
-}
-static void put_rv40_chroma_mc4_mmx(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    put_h264_chroma_generic_mc4_mmx(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]);
-}
-static void avg_rv40_chroma_mc8_mmx2(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc8_mmx2(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]);
-}
-static void avg_rv40_chroma_mc4_mmx2(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc4_mmx2(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]);
-}
-static void avg_rv40_chroma_mc8_3dnow(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc8_3dnow(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]);
-}
-static void avg_rv40_chroma_mc4_3dnow(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
-{
-    avg_h264_chroma_generic_mc4_3dnow(dst, src, stride, h, x, y, &rv40_bias_reg[y>>1][x&(~1)]);
-}
diff --git a/libavcodec/x86/simple_idct_mmx.c b/libavcodec/x86/simple_idct_mmx.c
deleted file mode 100644
index 5ea4c84..0000000
--- a/libavcodec/x86/simple_idct_mmx.c
+++ /dev/null
@@ -1,1296 +0,0 @@
-/*
- * Simple IDCT MMX
- *
- * Copyright (c) 2001, 2002 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "libavcodec/dsputil.h"
-#include "libavcodec/simple_idct.h"
-#include "dsputil_mmx.h"
-
-/*
-23170.475006
-22725.260826
-21406.727617
-19265.545870
-16384.000000
-12872.826198
-8866.956905
-4520.335430
-*/
-#define C0 23170 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#if 0
-#define C4 16384 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#else
-#define C4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) - 0.5
-#endif
-#define C5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C6 8867  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-#define C7 4520  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-
-#define ROW_SHIFT 11
-#define COL_SHIFT 20 // 6
-
-DECLARE_ASM_CONST(8, uint64_t, wm1010)= 0xFFFF0000FFFF0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, d40000)= 0x0000000000040000ULL;
-
-DECLARE_ALIGNED(8, static const int16_t, coeffs)[]= {
-        1<<(ROW_SHIFT-1), 0, 1<<(ROW_SHIFT-1), 0,
-//        1<<(COL_SHIFT-1), 0, 1<<(COL_SHIFT-1), 0,
-//        0, 1<<(COL_SHIFT-1-16), 0, 1<<(COL_SHIFT-1-16),
-        1<<(ROW_SHIFT-1), 1, 1<<(ROW_SHIFT-1), 0,
-        // the 1 = ((1<<(COL_SHIFT-1))/C4)<<ROW_SHIFT :)
-//        0, 0, 0, 0,
-//        0, 0, 0, 0,
-
- C4,  C4,  C4,  C4,
- C4, -C4,  C4, -C4,
-
- C2,  C6,  C2,  C6,
- C6, -C2,  C6, -C2,
-
- C1,  C3,  C1,  C3,
- C5,  C7,  C5,  C7,
-
- C3, -C7,  C3, -C7,
--C1, -C5, -C1, -C5,
-
- C5, -C1,  C5, -C1,
- C7,  C3,  C7,  C3,
-
- C7, -C5,  C7, -C5,
- C3, -C1,  C3, -C1
-};
-
-#if 0
-static void unused_var_killer(void)
-{
-        int a= wm1010 + d40000;
-        temp[0]=a;
-}
-
-static void inline idctCol (int16_t * col, int16_t *input)
-{
-#undef C0
-#undef C1
-#undef C2
-#undef C3
-#undef C4
-#undef C5
-#undef C6
-#undef C7
-        int a0, a1, a2, a3, b0, b1, b2, b3;
-        const int C0 = 23170; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C1 = 22725; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C2 = 21407; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C3 = 19266; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C4 = 16383; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C5 = 12873; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C6 = 8867;  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C7 = 4520;  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-/*
-        if( !(col[8*1] | col[8*2] |col[8*3] |col[8*4] |col[8*5] |col[8*6] | col[8*7])) {
-                col[8*0] = col[8*1] = col[8*2] = col[8*3] = col[8*4] =
-                        col[8*5] = col[8*6] = col[8*7] = col[8*0]<<3;
-                return;
-        }*/
-
-col[8*0] = input[8*0 + 0];
-col[8*1] = input[8*2 + 0];
-col[8*2] = input[8*0 + 1];
-col[8*3] = input[8*2 + 1];
-col[8*4] = input[8*4 + 0];
-col[8*5] = input[8*6 + 0];
-col[8*6] = input[8*4 + 1];
-col[8*7] = input[8*6 + 1];
-
-        a0 = C4*col[8*0] + C2*col[8*2] + C4*col[8*4] + C6*col[8*6] + (1<<(COL_SHIFT-1));
-        a1 = C4*col[8*0] + C6*col[8*2] - C4*col[8*4] - C2*col[8*6] + (1<<(COL_SHIFT-1));
-        a2 = C4*col[8*0] - C6*col[8*2] - C4*col[8*4] + C2*col[8*6] + (1<<(COL_SHIFT-1));
-        a3 = C4*col[8*0] - C2*col[8*2] + C4*col[8*4] - C6*col[8*6] + (1<<(COL_SHIFT-1));
-
-        b0 = C1*col[8*1] + C3*col[8*3] + C5*col[8*5] + C7*col[8*7];
-        b1 = C3*col[8*1] - C7*col[8*3] - C1*col[8*5] - C5*col[8*7];
-        b2 = C5*col[8*1] - C1*col[8*3] + C7*col[8*5] + C3*col[8*7];
-        b3 = C7*col[8*1] - C5*col[8*3] + C3*col[8*5] - C1*col[8*7];
-
-        col[8*0] = (a0 + b0) >> COL_SHIFT;
-        col[8*1] = (a1 + b1) >> COL_SHIFT;
-        col[8*2] = (a2 + b2) >> COL_SHIFT;
-        col[8*3] = (a3 + b3) >> COL_SHIFT;
-        col[8*4] = (a3 - b3) >> COL_SHIFT;
-        col[8*5] = (a2 - b2) >> COL_SHIFT;
-        col[8*6] = (a1 - b1) >> COL_SHIFT;
-        col[8*7] = (a0 - b0) >> COL_SHIFT;
-}
-
-static void inline idctRow (int16_t * output, int16_t * input)
-{
-        int16_t row[8];
-
-        int a0, a1, a2, a3, b0, b1, b2, b3;
-        const int C0 = 23170; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C1 = 22725; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C2 = 21407; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C3 = 19266; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C4 = 16383; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C5 = 12873; //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C6 = 8867;  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-        const int C7 = 4520;  //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5
-
-row[0] = input[0];
-row[2] = input[1];
-row[4] = input[4];
-row[6] = input[5];
-row[1] = input[8];
-row[3] = input[9];
-row[5] = input[12];
-row[7] = input[13];
-
-        if( !(row[1] | row[2] |row[3] |row[4] |row[5] |row[6] | row[7]) ) {
-                row[0] = row[1] = row[2] = row[3] = row[4] =
-                        row[5] = row[6] = row[7] = row[0]<<3;
-        output[0]  = row[0];
-        output[2]  = row[1];
-        output[4]  = row[2];
-        output[6]  = row[3];
-        output[8]  = row[4];
-        output[10] = row[5];
-        output[12] = row[6];
-        output[14] = row[7];
-                return;
-        }
-
-        a0 = C4*row[0] + C2*row[2] + C4*row[4] + C6*row[6] + (1<<(ROW_SHIFT-1));
-        a1 = C4*row[0] + C6*row[2] - C4*row[4] - C2*row[6] + (1<<(ROW_SHIFT-1));
-        a2 = C4*row[0] - C6*row[2] - C4*row[4] + C2*row[6] + (1<<(ROW_SHIFT-1));
-        a3 = C4*row[0] - C2*row[2] + C4*row[4] - C6*row[6] + (1<<(ROW_SHIFT-1));
-
-        b0 = C1*row[1] + C3*row[3] + C5*row[5] + C7*row[7];
-        b1 = C3*row[1] - C7*row[3] - C1*row[5] - C5*row[7];
-        b2 = C5*row[1] - C1*row[3] + C7*row[5] + C3*row[7];
-        b3 = C7*row[1] - C5*row[3] + C3*row[5] - C1*row[7];
-
-        row[0] = (a0 + b0) >> ROW_SHIFT;
-        row[1] = (a1 + b1) >> ROW_SHIFT;
-        row[2] = (a2 + b2) >> ROW_SHIFT;
-        row[3] = (a3 + b3) >> ROW_SHIFT;
-        row[4] = (a3 - b3) >> ROW_SHIFT;
-        row[5] = (a2 - b2) >> ROW_SHIFT;
-        row[6] = (a1 - b1) >> ROW_SHIFT;
-        row[7] = (a0 - b0) >> ROW_SHIFT;
-
-        output[0]  = row[0];
-        output[2]  = row[1];
-        output[4]  = row[2];
-        output[6]  = row[3];
-        output[8]  = row[4];
-        output[10] = row[5];
-        output[12] = row[6];
-        output[14] = row[7];
-}
-#endif
-
-static inline void idct(int16_t *block)
-{
-        DECLARE_ALIGNED(8, int64_t, align_tmp)[16];
-        int16_t * const temp= (int16_t*)align_tmp;
-
-        __asm__ volatile(
-#if 0 //Alternative, simpler variant
-
-#define ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        #rounder ", %%mm4               \n\t"\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq 56(%2), %%mm5             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        #rounder ", %%mm0               \n\t"\
-        "paddd %%mm0, %%mm1             \n\t" /* A1             a1 */\
-        "paddd %%mm0, %%mm0             \n\t" \
-        "psubd %%mm1, %%mm0             \n\t" /* A2             a2 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm5, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm5             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm5             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm1, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm5, %%mm1             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm5, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm1, %%mm7          \n\t" /* A1+B1  a1+b1   A0+B0   a0+b0 */\
-        "packssdw %%mm4, %%mm2          \n\t" /* A0-B0  a0-b0   A1-B1   a1-b1 */\
-        "movq %%mm7, " #dst "           \n\t"\
-        "movq " #src1 ", %%mm1          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "movq %%mm2, 24+" #dst "        \n\t"\
-        "pmaddwd %%mm1, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm1          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm0, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm0             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm1, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "packssdw %%mm6, %%mm2          \n\t" /* A3+B3  a3+b3   A2+B2   a2+b2 */\
-        "movq %%mm2, 8+" #dst "         \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm0, %%mm4          \n\t" /* A2-B2  a2-b2   A3-B3   a3-b3 */\
-        "movq %%mm4, 16+" #dst "        \n\t"\
-
-#define COL_IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1             a1 */\
-        "psubd %%mm1, %%mm5             \n\t" /* A2             a2 */\
-        "movq 56(%2), %%mm1             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm1, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm1             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm1             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm0, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm1, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm7, %%mm7          \n\t" /* A0+B0  a0+b0 */\
-        "movd %%mm7, " #dst "           \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t" /* A1+B1  a1+b1 */\
-        "movd %%mm0, 16+" #dst "        \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A1-B1  a1-b1 */\
-        "movd %%mm2, 96+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A0-B0  a0-b0 */\
-        "movd %%mm4, 112+" #dst "       \n\t"\
-        "movq " #src1 ", %%mm0          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm0          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm5, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm5             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm0, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A2+B2  a2+b2 */\
-        "packssdw %%mm6, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movd %%mm2, 32+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A3-B3  a3-b3 */\
-        "packssdw %%mm5, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movd %%mm6, 48+" #dst "        \n\t"\
-        "movd %%mm4, 64+" #dst "        \n\t"\
-        "movd %%mm5, 80+" #dst "        \n\t"\
-
-
-#define DC_COND_ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq "MANGLE(wm1010)", %%mm4   \n\t"\
-        "pand %%mm0, %%mm4              \n\t"\
-        "por %%mm1, %%mm4               \n\t"\
-        "por %%mm2, %%mm4               \n\t"\
-        "por %%mm3, %%mm4               \n\t"\
-        "packssdw %%mm4,%%mm4           \n\t"\
-        "movd %%mm4, %%eax              \n\t"\
-        "orl %%eax, %%eax               \n\t"\
-        "jz 1f                          \n\t"\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        #rounder ", %%mm4               \n\t"\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq 56(%2), %%mm5             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        #rounder ", %%mm0               \n\t"\
-        "paddd %%mm0, %%mm1             \n\t" /* A1             a1 */\
-        "paddd %%mm0, %%mm0             \n\t" \
-        "psubd %%mm1, %%mm0             \n\t" /* A2             a2 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm5, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm5             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm5             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm1, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm5, %%mm1             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm5, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm1, %%mm7          \n\t" /* A1+B1  a1+b1   A0+B0   a0+b0 */\
-        "packssdw %%mm4, %%mm2          \n\t" /* A0-B0  a0-b0   A1-B1   a1-b1 */\
-        "movq %%mm7, " #dst "           \n\t"\
-        "movq " #src1 ", %%mm1          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "movq %%mm2, 24+" #dst "        \n\t"\
-        "pmaddwd %%mm1, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm1          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm0, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm0             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm1, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "packssdw %%mm6, %%mm2          \n\t" /* A3+B3  a3+b3   A2+B2   a2+b2 */\
-        "movq %%mm2, 8+" #dst "         \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm0, %%mm4          \n\t" /* A2-B2  a2-b2   A3-B3   a3-b3 */\
-        "movq %%mm4, 16+" #dst "        \n\t"\
-        "jmp 2f                         \n\t"\
-        "1:                             \n\t"\
-        "pslld $16, %%mm0               \n\t"\
-        "#paddd "MANGLE(d40000)", %%mm0 \n\t"\
-        "psrad $13, %%mm0               \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t"\
-        "movq %%mm0, " #dst "           \n\t"\
-        "movq %%mm0, 8+" #dst "         \n\t"\
-        "movq %%mm0, 16+" #dst "        \n\t"\
-        "movq %%mm0, 24+" #dst "        \n\t"\
-        "2:                             \n\t"
-
-
-//IDCT(      src0,   src4,   src1,   src5,    dst,    rounder, shift)
-ROW_IDCT(    (%0),  8(%0), 16(%0), 24(%0),  0(%1),paddd 8(%2), 11)
-/*ROW_IDCT(  32(%0), 40(%0), 48(%0), 56(%0), 32(%1), paddd (%2), 11)
-ROW_IDCT(  64(%0), 72(%0), 80(%0), 88(%0), 64(%1), paddd (%2), 11)
-ROW_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1), paddd (%2), 11)*/
-
-DC_COND_ROW_IDCT(  32(%0), 40(%0), 48(%0), 56(%0), 32(%1),paddd (%2), 11)
-DC_COND_ROW_IDCT(  64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11)
-DC_COND_ROW_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11)
-
-
-//IDCT(      src0,   src4,   src1,    src5,    dst, shift)
-COL_IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-COL_IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-COL_IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-COL_IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-
-#else
-
-#define DC_COND_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq "MANGLE(wm1010)", %%mm4   \n\t"\
-        "pand %%mm0, %%mm4              \n\t"\
-        "por %%mm1, %%mm4               \n\t"\
-        "por %%mm2, %%mm4               \n\t"\
-        "por %%mm3, %%mm4               \n\t"\
-        "packssdw %%mm4,%%mm4           \n\t"\
-        "movd %%mm4, %%eax              \n\t"\
-        "orl %%eax, %%eax               \n\t"\
-        "jz 1f                          \n\t"\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        #rounder ", %%mm4               \n\t"\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq 56(%2), %%mm5             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        #rounder ", %%mm0               \n\t"\
-        "paddd %%mm0, %%mm1             \n\t" /* A1             a1 */\
-        "paddd %%mm0, %%mm0             \n\t" \
-        "psubd %%mm1, %%mm0             \n\t" /* A2             a2 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm5, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm5             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm5             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm1, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm5, %%mm1             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm5, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm1, %%mm7          \n\t" /* A1+B1  a1+b1   A0+B0   a0+b0 */\
-        "packssdw %%mm4, %%mm2          \n\t" /* A0-B0  a0-b0   A1-B1   a1-b1 */\
-        "movq %%mm7, " #dst "           \n\t"\
-        "movq " #src1 ", %%mm1          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "movq %%mm2, 24+" #dst "        \n\t"\
-        "pmaddwd %%mm1, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm1          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm0, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm0             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm1, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "packssdw %%mm6, %%mm2          \n\t" /* A3+B3  a3+b3   A2+B2   a2+b2 */\
-        "movq %%mm2, 8+" #dst "         \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm0, %%mm4          \n\t" /* A2-B2  a2-b2   A3-B3   a3-b3 */\
-        "movq %%mm4, 16+" #dst "        \n\t"\
-        "jmp 2f                         \n\t"\
-        "1:                             \n\t"\
-        "pslld $16, %%mm0               \n\t"\
-        "paddd "MANGLE(d40000)", %%mm0  \n\t"\
-        "psrad $13, %%mm0               \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t"\
-        "movq %%mm0, " #dst "           \n\t"\
-        "movq %%mm0, 8+" #dst "         \n\t"\
-        "movq %%mm0, 16+" #dst "        \n\t"\
-        "movq %%mm0, 24+" #dst "        \n\t"\
-        "2:                             \n\t"
-
-#define Z_COND_IDCT(src0, src4, src1, src5, dst, rounder, shift, bt) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq %%mm0, %%mm4              \n\t"\
-        "por %%mm1, %%mm4               \n\t"\
-        "por %%mm2, %%mm4               \n\t"\
-        "por %%mm3, %%mm4               \n\t"\
-        "packssdw %%mm4,%%mm4           \n\t"\
-        "movd %%mm4, %%eax              \n\t"\
-        "orl %%eax, %%eax               \n\t"\
-        "jz " #bt "                     \n\t"\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        #rounder ", %%mm4               \n\t"\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq 56(%2), %%mm5             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        #rounder ", %%mm0               \n\t"\
-        "paddd %%mm0, %%mm1             \n\t" /* A1             a1 */\
-        "paddd %%mm0, %%mm0             \n\t" \
-        "psubd %%mm1, %%mm0             \n\t" /* A2             a2 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm5, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm5             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm5             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm1, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm5, %%mm1             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm5, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm1, %%mm7          \n\t" /* A1+B1  a1+b1   A0+B0   a0+b0 */\
-        "packssdw %%mm4, %%mm2          \n\t" /* A0-B0  a0-b0   A1-B1   a1-b1 */\
-        "movq %%mm7, " #dst "           \n\t"\
-        "movq " #src1 ", %%mm1          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "movq %%mm2, 24+" #dst "        \n\t"\
-        "pmaddwd %%mm1, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm1          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm0, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm0             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm1, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "packssdw %%mm6, %%mm2          \n\t" /* A3+B3  a3+b3   A2+B2   a2+b2 */\
-        "movq %%mm2, 8+" #dst "         \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm0, %%mm4          \n\t" /* A2-B2  a2-b2   A3-B3   a3-b3 */\
-        "movq %%mm4, 16+" #dst "        \n\t"\
-
-#define ROW_IDCT(src0, src4, src1, src5, dst, rounder, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        #rounder ", %%mm4               \n\t"\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq 56(%2), %%mm5             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        #rounder ", %%mm0               \n\t"\
-        "paddd %%mm0, %%mm1             \n\t" /* A1             a1 */\
-        "paddd %%mm0, %%mm0             \n\t" \
-        "psubd %%mm1, %%mm0             \n\t" /* A2             a2 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm5, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm5             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm5           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm5             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm1, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm5, %%mm1             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm5, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm1, %%mm7          \n\t" /* A1+B1  a1+b1   A0+B0   a0+b0 */\
-        "packssdw %%mm4, %%mm2          \n\t" /* A0-B0  a0-b0   A1-B1   a1-b1 */\
-        "movq %%mm7, " #dst "           \n\t"\
-        "movq " #src1 ", %%mm1          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "movq %%mm2, 24+" #dst "        \n\t"\
-        "pmaddwd %%mm1, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm1          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm0, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm0             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm1, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "packssdw %%mm6, %%mm2          \n\t" /* A3+B3  a3+b3   A2+B2   a2+b2 */\
-        "movq %%mm2, 8+" #dst "         \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm0, %%mm4          \n\t" /* A2-B2  a2-b2   A3-B3   a3-b3 */\
-        "movq %%mm4, 16+" #dst "        \n\t"\
-
-//IDCT(         src0,   src4,   src1,   src5,    dst,   rounder, shift)
-DC_COND_IDCT(  0(%0),  8(%0), 16(%0), 24(%0),  0(%1),paddd 8(%2), 11)
-Z_COND_IDCT(  32(%0), 40(%0), 48(%0), 56(%0), 32(%1),paddd (%2), 11, 4f)
-Z_COND_IDCT(  64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 2f)
-Z_COND_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 1f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1             a1 */\
-        "psubd %%mm1, %%mm5             \n\t" /* A2             a2 */\
-        "movq 56(%2), %%mm1             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm1, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm1             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm1             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm0, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm1, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm7, %%mm7          \n\t" /* A0+B0  a0+b0 */\
-        "movd %%mm7, " #dst "           \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t" /* A1+B1  a1+b1 */\
-        "movd %%mm0, 16+" #dst "        \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A1-B1  a1-b1 */\
-        "movd %%mm2, 96+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A0-B0  a0-b0 */\
-        "movd %%mm4, 112+" #dst "       \n\t"\
-        "movq " #src1 ", %%mm0          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm0          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm5, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm5             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm0, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A2+B2  a2+b2 */\
-        "packssdw %%mm6, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movd %%mm2, 32+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A3-B3  a3-b3 */\
-        "packssdw %%mm5, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movd %%mm6, 48+" #dst "        \n\t"\
-        "movd %%mm4, 64+" #dst "        \n\t"\
-        "movd %%mm5, 80+" #dst "        \n\t"
-
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-        "jmp 9f                         \n\t"
-
-        "#" ASMALIGN(4)                      \
-        "4:                             \n\t"
-Z_COND_IDCT(  64(%0), 72(%0), 80(%0), 88(%0), 64(%1),paddd (%2), 11, 6f)
-Z_COND_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 5f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1             a1 */\
-        "psubd %%mm1, %%mm5             \n\t" /* A2             a2 */\
-        "movq 56(%2), %%mm1             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        "movq 72(%2), %%mm7             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm1             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm1, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm0, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm7, %%mm0             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm7, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm1, %%mm1          \n\t" /* A0+B0  a0+b0 */\
-        "movd %%mm1, " #dst "           \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t" /* A1+B1  a1+b1 */\
-        "movd %%mm0, 16+" #dst "        \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A1-B1  a1-b1 */\
-        "movd %%mm2, 96+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A0-B0  a0-b0 */\
-        "movd %%mm4, 112+" #dst "       \n\t"\
-        "movq 88(%2), %%mm1             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm5, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm1, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm1, %%mm5             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "movq %%mm6, %%mm1              \n\t" /* A3             a3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm1             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A2+B2  a2+b2 */\
-        "packssdw %%mm6, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movd %%mm2, 32+" #dst "        \n\t"\
-        "packssdw %%mm1, %%mm1          \n\t" /* A3-B3  a3-b3 */\
-        "packssdw %%mm5, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movd %%mm6, 48+" #dst "        \n\t"\
-        "movd %%mm1, 64+" #dst "        \n\t"\
-        "movd %%mm5, 80+" #dst "        \n\t"
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-        "jmp 9f                         \n\t"
-
-        "#" ASMALIGN(4)                      \
-        "6:                             \n\t"
-Z_COND_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 7f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 56(%2), %%mm1             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        "movq 72(%2), %%mm7             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm1             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm1, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm0, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm7, %%mm0             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm7, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm1, %%mm1          \n\t" /* A0+B0  a0+b0 */\
-        "movd %%mm1, " #dst "           \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t" /* A1+B1  a1+b1 */\
-        "movd %%mm0, 16+" #dst "        \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A1-B1  a1-b1 */\
-        "movd %%mm2, 96+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A0-B0  a0-b0 */\
-        "movd %%mm4, 112+" #dst "       \n\t"\
-        "movq 88(%2), %%mm1             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm5, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm1, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm1, %%mm5             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "movq %%mm6, %%mm1              \n\t" /* A3             a3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm1             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A2+B2  a2+b2 */\
-        "packssdw %%mm6, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movd %%mm2, 32+" #dst "        \n\t"\
-        "packssdw %%mm1, %%mm1          \n\t" /* A3-B3  a3-b3 */\
-        "packssdw %%mm5, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movd %%mm6, 48+" #dst "        \n\t"\
-        "movd %%mm1, 64+" #dst "        \n\t"\
-        "movd %%mm5, 80+" #dst "        \n\t"
-
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-        "jmp 9f                         \n\t"
-
-        "#" ASMALIGN(4)                      \
-        "2:                             \n\t"
-Z_COND_IDCT(  96(%0),104(%0),112(%0),120(%0), 96(%1),paddd (%2), 11, 3f)
-
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq " #src5 ", %%mm3          \n\t" /* R7     R5      r7      r5 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 56(%2), %%mm1             \n\t" /* C7     C5      C7      C5 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* C7R7+C5R5      C7r7+C5r5 */\
-        "pmaddwd 64(%2), %%mm2          \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm1, %%mm7             \n\t" /* B0             b0 */\
-        "movq 72(%2), %%mm1             \n\t" /* -C5    -C1     -C5     -C1 */\
-        "pmaddwd %%mm3, %%mm1           \n\t" /* -C5R7-C1R5     -C5r7-C1r5 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "paddd %%mm2, %%mm1             \n\t" /* B1             b1 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm0, %%mm2              \n\t" /* A1             a1 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm1, %%mm2             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm7, %%mm7          \n\t" /* A0+B0  a0+b0 */\
-        "movd %%mm7, " #dst "           \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t" /* A1+B1  a1+b1 */\
-        "movd %%mm0, 16+" #dst "        \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A1-B1  a1-b1 */\
-        "movd %%mm2, 96+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A0-B0  a0-b0 */\
-        "movd %%mm4, 112+" #dst "       \n\t"\
-        "movq " #src1 ", %%mm0          \n\t" /* R3     R1      r3      r1 */\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "movq 88(%2), %%mm7             \n\t" /* C3     C7      C3      C7 */\
-        "pmaddwd 96(%2), %%mm0          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C3R7+C7R5      C3r7+C7r5 */\
-        "movq %%mm5, %%mm2              \n\t" /* A2             a2 */\
-        "pmaddwd 104(%2), %%mm3         \n\t" /* -C1R7+C3R5     -C1r7+C3r5 */\
-        "paddd %%mm7, %%mm4             \n\t" /* B2             b2 */\
-        "paddd %%mm4, %%mm2             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm5             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm0, %%mm3             \n\t" /* B3             b3 */\
-        "paddd %%mm3, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm3, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm2, %%mm2          \n\t" /* A2+B2  a2+b2 */\
-        "packssdw %%mm6, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movd %%mm2, 32+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A3-B3  a3-b3 */\
-        "packssdw %%mm5, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movd %%mm6, 48+" #dst "        \n\t"\
-        "movd %%mm4, 64+" #dst "        \n\t"\
-        "movd %%mm5, 80+" #dst "        \n\t"
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-        "jmp 9f                         \n\t"
-
-        "#" ASMALIGN(4)                      \
-        "3:                             \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 64(%2), %%mm3             \n\t"\
-        "pmaddwd %%mm2, %%mm3           \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm0, %%mm1              \n\t" /* A1             a1 */\
-        "paddd %%mm3, %%mm0             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm3, %%mm1             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "packssdw %%mm7, %%mm7          \n\t" /* A0+B0  a0+b0 */\
-        "movd %%mm7, " #dst "           \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t" /* A1+B1  a1+b1 */\
-        "movd %%mm0, 16+" #dst "        \n\t"\
-        "packssdw %%mm1, %%mm1          \n\t" /* A1-B1  a1-b1 */\
-        "movd %%mm1, 96+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A0-B0  a0-b0 */\
-        "movd %%mm4, 112+" #dst "       \n\t"\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "pmaddwd %%mm2, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "pmaddwd 96(%2), %%mm2          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "movq %%mm5, %%mm1              \n\t" /* A2             a2 */\
-        "paddd %%mm4, %%mm1             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm5             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm2, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm2, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm1, %%mm1          \n\t" /* A2+B2  a2+b2 */\
-        "packssdw %%mm6, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movd %%mm1, 32+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A3-B3  a3-b3 */\
-        "packssdw %%mm5, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movd %%mm6, 48+" #dst "        \n\t"\
-        "movd %%mm4, 64+" #dst "        \n\t"\
-        "movd %%mm5, 80+" #dst "        \n\t"
-
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-        "jmp 9f                         \n\t"
-
-        "#" ASMALIGN(4)                      \
-        "5:                             \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1             a1 */\
-        "psubd %%mm1, %%mm5             \n\t" /* A2             a2 */\
-        "movq 8+" #src0 ", %%mm2        \n\t" /* R4     R0      r4      r0 */\
-        "movq 8+" #src4 ", %%mm3        \n\t" /* R6     R2      r6      r2 */\
-        "movq 16(%2), %%mm1             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm2, %%mm1           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm7             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm7, %%mm2           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm7             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm3, %%mm7           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "pmaddwd 40(%2), %%mm3          \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "paddd %%mm1, %%mm7             \n\t" /* A0             a0 */\
-        "paddd %%mm1, %%mm1             \n\t" /* 2C0            2c0 */\
-        "psubd %%mm7, %%mm1             \n\t" /* A3             a3 */\
-        "paddd %%mm2, %%mm3             \n\t" /* A1             a1 */\
-        "paddd %%mm2, %%mm2             \n\t" /* 2C1            2c1 */\
-        "psubd %%mm3, %%mm2             \n\t" /* A2             a2 */\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm3       \n\t"\
-        "packssdw %%mm7, %%mm4          \n\t" /* A0     a0 */\
-        "movq %%mm4, " #dst "           \n\t"\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "packssdw %%mm3, %%mm0          \n\t" /* A1     a1 */\
-        "movq %%mm0, 16+" #dst "        \n\t"\
-        "movq %%mm0, 96+" #dst "        \n\t"\
-        "movq %%mm4, 112+" #dst "       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm2, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movq %%mm5, 32+" #dst "        \n\t"\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "packssdw %%mm1, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movq %%mm6, 48+" #dst "        \n\t"\
-        "movq %%mm6, 64+" #dst "        \n\t"\
-        "movq %%mm5, 80+" #dst "        \n\t"
-
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(    0(%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-//IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-//IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-        "jmp 9f                         \n\t"
-
-
-        "#" ASMALIGN(4)                      \
-        "1:                             \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq " #src4 ", %%mm1          \n\t" /* R6     R2      r6      r2 */\
-        "movq " #src1 ", %%mm2          \n\t" /* R3     R1      r3      r1 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm5             \n\t" /* C6     C2      C6      C2 */\
-        "pmaddwd %%mm1, %%mm5           \n\t" /* C6R6+C2R2      C6r6+C2r2 */\
-        "movq 40(%2), %%mm6             \n\t" /* -C2    C6      -C2     C6 */\
-        "pmaddwd %%mm6, %%mm1           \n\t" /* -C2R6+C6R2     -C2r6+C6r2 */\
-        "movq %%mm4, %%mm6              \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 48(%2), %%mm7             \n\t" /* C3     C1      C3      C1 */\
-        "pmaddwd %%mm2, %%mm7           \n\t" /* C3R3+C1R1      C3r3+C1r1 */\
-        "paddd %%mm5, %%mm4             \n\t" /* A0             a0 */\
-        "psubd %%mm5, %%mm6             \n\t" /* A3             a3 */\
-        "movq %%mm0, %%mm5              \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1             a1 */\
-        "psubd %%mm1, %%mm5             \n\t" /* A2             a2 */\
-        "movq 64(%2), %%mm1             \n\t"\
-        "pmaddwd %%mm2, %%mm1           \n\t" /* -C7R3+C3R1     -C7r3+C3r1 */\
-        "paddd %%mm4, %%mm7             \n\t" /* A0+B0          a0+b0 */\
-        "paddd %%mm4, %%mm4             \n\t" /* 2A0            2a0 */\
-        "psubd %%mm7, %%mm4             \n\t" /* A0-B0          a0-b0 */\
-        "psrad $" #shift ", %%mm7       \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "movq %%mm0, %%mm3              \n\t" /* A1             a1 */\
-        "paddd %%mm1, %%mm0             \n\t" /* A1+B1          a1+b1 */\
-        "psubd %%mm1, %%mm3             \n\t" /* A1-B1          a1-b1 */\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "psrad $" #shift ", %%mm3       \n\t"\
-        "packssdw %%mm7, %%mm7          \n\t" /* A0+B0  a0+b0 */\
-        "movd %%mm7, " #dst "           \n\t"\
-        "packssdw %%mm0, %%mm0          \n\t" /* A1+B1  a1+b1 */\
-        "movd %%mm0, 16+" #dst "        \n\t"\
-        "packssdw %%mm3, %%mm3          \n\t" /* A1-B1  a1-b1 */\
-        "movd %%mm3, 96+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A0-B0  a0-b0 */\
-        "movd %%mm4, 112+" #dst "       \n\t"\
-        "movq 80(%2), %%mm4             \n\t" /* -C1    C5      -C1     C5 */\
-        "pmaddwd %%mm2, %%mm4           \n\t" /* -C1R3+C5R1     -C1r3+C5r1 */\
-        "pmaddwd 96(%2), %%mm2          \n\t" /* -C5R3+C7R1     -C5r3+C7r1 */\
-        "movq %%mm5, %%mm3              \n\t" /* A2             a2 */\
-        "paddd %%mm4, %%mm3             \n\t" /* A2+B2          a2+b2 */\
-        "psubd %%mm4, %%mm5             \n\t" /* a2-B2          a2-b2 */\
-        "psrad $" #shift ", %%mm3       \n\t"\
-        "psrad $" #shift ", %%mm5       \n\t"\
-        "movq %%mm6, %%mm4              \n\t" /* A3             a3 */\
-        "paddd %%mm2, %%mm6             \n\t" /* A3+B3          a3+b3 */\
-        "psubd %%mm2, %%mm4             \n\t" /* a3-B3          a3-b3 */\
-        "psrad $" #shift ", %%mm6       \n\t"\
-        "packssdw %%mm3, %%mm3          \n\t" /* A2+B2  a2+b2 */\
-        "movd %%mm3, 32+" #dst "        \n\t"\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "packssdw %%mm6, %%mm6          \n\t" /* A3+B3  a3+b3 */\
-        "movd %%mm6, 48+" #dst "        \n\t"\
-        "packssdw %%mm4, %%mm4          \n\t" /* A3-B3  a3-b3 */\
-        "packssdw %%mm5, %%mm5          \n\t" /* A2-B2  a2-b2 */\
-        "movd %%mm4, 64+" #dst "        \n\t"\
-        "movd %%mm5, 80+" #dst "        \n\t"
-
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(    (%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-        "jmp 9f                         \n\t"
-
-
-        "#" ASMALIGN(4)
-        "7:                             \n\t"
-#undef IDCT
-#define IDCT(src0, src4, src1, src5, dst, shift) \
-        "movq " #src0 ", %%mm0          \n\t" /* R4     R0      r4      r0 */\
-        "movq 16(%2), %%mm4             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm0, %%mm4           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm5             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm5, %%mm0           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "psrad $" #shift ", %%mm4       \n\t"\
-        "psrad $" #shift ", %%mm0       \n\t"\
-        "movq 8+" #src0 ", %%mm2        \n\t" /* R4     R0      r4      r0 */\
-        "movq 16(%2), %%mm1             \n\t" /* C4     C4      C4      C4 */\
-        "pmaddwd %%mm2, %%mm1           \n\t" /* C4R4+C4R0      C4r4+C4r0 */\
-        "movq 24(%2), %%mm7             \n\t" /* -C4    C4      -C4     C4 */\
-        "pmaddwd %%mm7, %%mm2           \n\t" /* -C4R4+C4R0     -C4r4+C4r0 */\
-        "movq 32(%2), %%mm7             \n\t" /* C6     C2      C6      C2 */\
-        "psrad $" #shift ", %%mm1       \n\t"\
-        "packssdw %%mm1, %%mm4          \n\t" /* A0     a0 */\
-        "movq %%mm4, " #dst "           \n\t"\
-        "psrad $" #shift ", %%mm2       \n\t"\
-        "packssdw %%mm2, %%mm0          \n\t" /* A1     a1 */\
-        "movq %%mm0, 16+" #dst "        \n\t"\
-        "movq %%mm0, 96+" #dst "        \n\t"\
-        "movq %%mm4, 112+" #dst "       \n\t"\
-        "movq %%mm0, 32+" #dst "        \n\t"\
-        "movq %%mm4, 48+" #dst "        \n\t"\
-        "movq %%mm4, 64+" #dst "        \n\t"\
-        "movq %%mm0, 80+" #dst "        \n\t"
-
-//IDCT(  src0,   src4,   src1,    src5,    dst, shift)
-IDCT(   0(%1), 64(%1), 32(%1),  96(%1),  0(%0), 20)
-//IDCT(   8(%1), 72(%1), 40(%1), 104(%1),  4(%0), 20)
-IDCT(  16(%1), 80(%1), 48(%1), 112(%1),  8(%0), 20)
-//IDCT(  24(%1), 88(%1), 56(%1), 120(%1), 12(%0), 20)
-
-
-#endif
-
-/*
-Input
- 00 40 04 44 20 60 24 64
- 10 30 14 34 50 70 54 74
- 01 41 03 43 21 61 23 63
- 11 31 13 33 51 71 53 73
- 02 42 06 46 22 62 26 66
- 12 32 16 36 52 72 56 76
- 05 45 07 47 25 65 27 67
- 15 35 17 37 55 75 57 77
-
-Temp
- 00 04 10 14 20 24 30 34
- 40 44 50 54 60 64 70 74
- 01 03 11 13 21 23 31 33
- 41 43 51 53 61 63 71 73
- 02 06 12 16 22 26 32 36
- 42 46 52 56 62 66 72 76
- 05 07 15 17 25 27 35 37
- 45 47 55 57 65 67 75 77
-*/
-
-"9: \n\t"
-                :: "r" (block), "r" (temp), "r" (coeffs)
-                : "%eax"
-        );
-}
-
-void ff_simple_idct_mmx(int16_t *block)
-{
-    idct(block);
-}
-
-//FIXME merge add/put into the idct
-
-void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    idct(block);
-    put_pixels_clamped_mmx(block, dest, line_size);
-}
-void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    idct(block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
diff --git a/libavcodec/x86/snowdsp_mmx.c b/libavcodec/x86/snowdsp_mmx.c
deleted file mode 100644
index 263f0bb..0000000
--- a/libavcodec/x86/snowdsp_mmx.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/*
- * MMX and SSE2 optimized snow DSP utils
- * Copyright (c) 2005-2006 Robert Edele <yartrebo at earthlink.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/avcodec.h"
-#include "libavcodec/snow.h"
-#include "libavcodec/dwt.h"
-#include "dsputil_mmx.h"
-
-static void ff_snow_horizontal_compose97i_sse2(IDWTELEM *b, int width){
-    const int w2= (width+1)>>1;
-    DECLARE_ALIGNED(16, IDWTELEM, temp)[width>>1];
-    const int w_l= (width>>1);
-    const int w_r= w2 - 1;
-    int i;
-
-    { // Lift 0
-        IDWTELEM * const ref = b + w2 - 1;
-        IDWTELEM b_0 = b[0]; //By allowing the first entry in b[0] to be calculated twice
-        // (the first time erroneously), we allow the SSE2 code to run an extra pass.
-        // The savings in code and time are well worth having to store this value and
-        // calculate b[0] correctly afterwards.
-
-        i = 0;
-        __asm__ volatile(
-            "pcmpeqd   %%xmm7, %%xmm7         \n\t"
-            "pcmpeqd   %%xmm3, %%xmm3         \n\t"
-            "psllw         $1, %%xmm3         \n\t"
-            "paddw     %%xmm7, %%xmm3         \n\t"
-            "psllw        $13, %%xmm3         \n\t"
-        ::);
-        for(; i<w_l-15; i+=16){
-            __asm__ volatile(
-                "movdqu   (%1), %%xmm1        \n\t"
-                "movdqu 16(%1), %%xmm5        \n\t"
-                "movdqu  2(%1), %%xmm2        \n\t"
-                "movdqu 18(%1), %%xmm6        \n\t"
-                "paddw  %%xmm1, %%xmm2        \n\t"
-                "paddw  %%xmm5, %%xmm6        \n\t"
-                "paddw  %%xmm7, %%xmm2        \n\t"
-                "paddw  %%xmm7, %%xmm6        \n\t"
-                "pmulhw %%xmm3, %%xmm2        \n\t"
-                "pmulhw %%xmm3, %%xmm6        \n\t"
-                "paddw    (%0), %%xmm2        \n\t"
-                "paddw  16(%0), %%xmm6        \n\t"
-                "movdqa %%xmm2, (%0)          \n\t"
-                "movdqa %%xmm6, 16(%0)        \n\t"
-                :: "r"(&b[i]), "r"(&ref[i])
-                : "memory"
-            );
-        }
-        snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
-        b[0] = b_0 - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
-    }
-
-    { // Lift 1
-        IDWTELEM * const dst = b+w2;
-
-        i = 0;
-        for(; (((x86_reg)&dst[i]) & 0x1F) && i<w_r; i++){
-            dst[i] = dst[i] - (b[i] + b[i + 1]);
-        }
-        for(; i<w_r-15; i+=16){
-            __asm__ volatile(
-                "movdqu   (%1), %%xmm1        \n\t"
-                "movdqu 16(%1), %%xmm5        \n\t"
-                "movdqu  2(%1), %%xmm2        \n\t"
-                "movdqu 18(%1), %%xmm6        \n\t"
-                "paddw  %%xmm1, %%xmm2        \n\t"
-                "paddw  %%xmm5, %%xmm6        \n\t"
-                "movdqa   (%0), %%xmm0        \n\t"
-                "movdqa 16(%0), %%xmm4        \n\t"
-                "psubw  %%xmm2, %%xmm0        \n\t"
-                "psubw  %%xmm6, %%xmm4        \n\t"
-                "movdqa %%xmm0, (%0)          \n\t"
-                "movdqa %%xmm4, 16(%0)        \n\t"
-                :: "r"(&dst[i]), "r"(&b[i])
-                : "memory"
-            );
-        }
-        snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
-    }
-
-    { // Lift 2
-        IDWTELEM * const ref = b+w2 - 1;
-        IDWTELEM b_0 = b[0];
-
-        i = 0;
-        __asm__ volatile(
-            "psllw         $15, %%xmm7        \n\t"
-            "pcmpeqw    %%xmm6, %%xmm6        \n\t"
-            "psrlw         $13, %%xmm6        \n\t"
-            "paddw      %%xmm7, %%xmm6        \n\t"
-        ::);
-        for(; i<w_l-15; i+=16){
-            __asm__ volatile(
-                "movdqu   (%1), %%xmm0        \n\t"
-                "movdqu 16(%1), %%xmm4        \n\t"
-                "movdqu  2(%1), %%xmm1        \n\t"
-                "movdqu 18(%1), %%xmm5        \n\t" //FIXME try aligned reads and shifts
-                "paddw  %%xmm6, %%xmm0        \n\t"
-                "paddw  %%xmm6, %%xmm4        \n\t"
-                "paddw  %%xmm7, %%xmm1        \n\t"
-                "paddw  %%xmm7, %%xmm5        \n\t"
-                "pavgw  %%xmm1, %%xmm0        \n\t"
-                "pavgw  %%xmm5, %%xmm4        \n\t"
-                "psubw  %%xmm7, %%xmm0        \n\t"
-                "psubw  %%xmm7, %%xmm4        \n\t"
-                "psraw      $1, %%xmm0        \n\t"
-                "psraw      $1, %%xmm4        \n\t"
-                "movdqa   (%0), %%xmm1        \n\t"
-                "movdqa 16(%0), %%xmm5        \n\t"
-                "paddw  %%xmm1, %%xmm0        \n\t"
-                "paddw  %%xmm5, %%xmm4        \n\t"
-                "psraw      $2, %%xmm0        \n\t"
-                "psraw      $2, %%xmm4        \n\t"
-                "paddw  %%xmm1, %%xmm0        \n\t"
-                "paddw  %%xmm5, %%xmm4        \n\t"
-                "movdqa %%xmm0, (%0)          \n\t"
-                "movdqa %%xmm4, 16(%0)        \n\t"
-                :: "r"(&b[i]), "r"(&ref[i])
-                : "memory"
-            );
-        }
-        snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
-        b[0] = b_0 + ((2 * ref[1] + W_BO-1 + 4 * b_0) >> W_BS);
-    }
-
-    { // Lift 3
-        IDWTELEM * const src = b+w2;
-
-        i = 0;
-        for(; (((x86_reg)&temp[i]) & 0x1F) && i<w_r; i++){
-            temp[i] = src[i] - ((-W_AM*(b[i] + b[i+1]))>>W_AS);
-        }
-        for(; i<w_r-7; i+=8){
-            __asm__ volatile(
-                "movdqu  2(%1), %%xmm2        \n\t"
-                "movdqu 18(%1), %%xmm6        \n\t"
-                "paddw    (%1), %%xmm2        \n\t"
-                "paddw  16(%1), %%xmm6        \n\t"
-                "movdqu   (%0), %%xmm0        \n\t"
-                "movdqu 16(%0), %%xmm4        \n\t"
-                "paddw  %%xmm2, %%xmm0        \n\t"
-                "paddw  %%xmm6, %%xmm4        \n\t"
-                "psraw      $1, %%xmm2        \n\t"
-                "psraw      $1, %%xmm6        \n\t"
-                "paddw  %%xmm0, %%xmm2        \n\t"
-                "paddw  %%xmm4, %%xmm6        \n\t"
-                "movdqa %%xmm2, (%2)          \n\t"
-                "movdqa %%xmm6, 16(%2)        \n\t"
-                :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
-                 : "memory"
-               );
-        }
-        snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
-    }
-
-    {
-        snow_interleave_line_header(&i, width, b, temp);
-
-        for (; (i & 0x3E) != 0x3E; i-=2){
-            b[i+1] = temp[i>>1];
-            b[i] = b[i>>1];
-        }
-        for (i-=62; i>=0; i-=64){
-            __asm__ volatile(
-                "movdqa      (%1), %%xmm0       \n\t"
-                "movdqa    16(%1), %%xmm2       \n\t"
-                "movdqa    32(%1), %%xmm4       \n\t"
-                "movdqa    48(%1), %%xmm6       \n\t"
-                "movdqa      (%1), %%xmm1       \n\t"
-                "movdqa    16(%1), %%xmm3       \n\t"
-                "movdqa    32(%1), %%xmm5       \n\t"
-                "movdqa    48(%1), %%xmm7       \n\t"
-                "punpcklwd   (%2), %%xmm0       \n\t"
-                "punpcklwd 16(%2), %%xmm2       \n\t"
-                "punpcklwd 32(%2), %%xmm4       \n\t"
-                "punpcklwd 48(%2), %%xmm6       \n\t"
-                "movdqa    %%xmm0, (%0)         \n\t"
-                "movdqa    %%xmm2, 32(%0)       \n\t"
-                "movdqa    %%xmm4, 64(%0)       \n\t"
-                "movdqa    %%xmm6, 96(%0)       \n\t"
-                "punpckhwd   (%2), %%xmm1       \n\t"
-                "punpckhwd 16(%2), %%xmm3       \n\t"
-                "punpckhwd 32(%2), %%xmm5       \n\t"
-                "punpckhwd 48(%2), %%xmm7       \n\t"
-                "movdqa    %%xmm1, 16(%0)       \n\t"
-                "movdqa    %%xmm3, 48(%0)       \n\t"
-                "movdqa    %%xmm5, 80(%0)       \n\t"
-                "movdqa    %%xmm7, 112(%0)      \n\t"
-                :: "r"(&(b)[i]), "r"(&(b)[i>>1]), "r"(&(temp)[i>>1])
-                 : "memory"
-               );
-        }
-    }
-}
-
-static void ff_snow_horizontal_compose97i_mmx(IDWTELEM *b, int width){
-    const int w2= (width+1)>>1;
-    IDWTELEM temp[width >> 1];
-    const int w_l= (width>>1);
-    const int w_r= w2 - 1;
-    int i;
-
-    { // Lift 0
-        IDWTELEM * const ref = b + w2 - 1;
-
-        i = 1;
-        b[0] = b[0] - ((W_DM * 2 * ref[1]+W_DO)>>W_DS);
-        __asm__ volatile(
-            "pcmpeqw    %%mm7, %%mm7         \n\t"
-            "pcmpeqw    %%mm3, %%mm3         \n\t"
-            "psllw         $1, %%mm3         \n\t"
-            "paddw      %%mm7, %%mm3         \n\t"
-            "psllw        $13, %%mm3         \n\t"
-           ::);
-        for(; i<w_l-7; i+=8){
-            __asm__ volatile(
-                "movq     (%1), %%mm2        \n\t"
-                "movq    8(%1), %%mm6        \n\t"
-                "paddw   2(%1), %%mm2        \n\t"
-                "paddw  10(%1), %%mm6        \n\t"
-                "paddw   %%mm7, %%mm2        \n\t"
-                "paddw   %%mm7, %%mm6        \n\t"
-                "pmulhw  %%mm3, %%mm2        \n\t"
-                "pmulhw  %%mm3, %%mm6        \n\t"
-                "paddw    (%0), %%mm2        \n\t"
-                "paddw   8(%0), %%mm6        \n\t"
-                "movq    %%mm2, (%0)         \n\t"
-                "movq    %%mm6, 8(%0)        \n\t"
-                :: "r"(&b[i]), "r"(&ref[i])
-                 : "memory"
-               );
-        }
-        snow_horizontal_compose_lift_lead_out(i, b, b, ref, width, w_l, 0, W_DM, W_DO, W_DS);
-    }
-
-    { // Lift 1
-        IDWTELEM * const dst = b+w2;
-
-        i = 0;
-        for(; i<w_r-7; i+=8){
-            __asm__ volatile(
-                "movq     (%1), %%mm2        \n\t"
-                "movq    8(%1), %%mm6        \n\t"
-                "paddw   2(%1), %%mm2        \n\t"
-                "paddw  10(%1), %%mm6        \n\t"
-                "movq     (%0), %%mm0        \n\t"
-                "movq    8(%0), %%mm4        \n\t"
-                "psubw   %%mm2, %%mm0        \n\t"
-                "psubw   %%mm6, %%mm4        \n\t"
-                "movq    %%mm0, (%0)         \n\t"
-                "movq    %%mm4, 8(%0)        \n\t"
-                :: "r"(&dst[i]), "r"(&b[i])
-                 : "memory"
-               );
-        }
-        snow_horizontal_compose_lift_lead_out(i, dst, dst, b, width, w_r, 1, W_CM, W_CO, W_CS);
-    }
-
-    { // Lift 2
-        IDWTELEM * const ref = b+w2 - 1;
-
-        i = 1;
-        b[0] = b[0] + (((2 * ref[1] + W_BO) + 4 * b[0]) >> W_BS);
-        __asm__ volatile(
-            "psllw         $15, %%mm7        \n\t"
-            "pcmpeqw     %%mm6, %%mm6        \n\t"
-            "psrlw         $13, %%mm6        \n\t"
-            "paddw       %%mm7, %%mm6        \n\t"
-           ::);
-        for(; i<w_l-7; i+=8){
-            __asm__ volatile(
-                "movq     (%1), %%mm0        \n\t"
-                "movq    8(%1), %%mm4        \n\t"
-                "movq    2(%1), %%mm1        \n\t"
-                "movq   10(%1), %%mm5        \n\t"
-                "paddw   %%mm6, %%mm0        \n\t"
-                "paddw   %%mm6, %%mm4        \n\t"
-                "paddw   %%mm7, %%mm1        \n\t"
-                "paddw   %%mm7, %%mm5        \n\t"
-                "pavgw   %%mm1, %%mm0        \n\t"
-                "pavgw   %%mm5, %%mm4        \n\t"
-                "psubw   %%mm7, %%mm0        \n\t"
-                "psubw   %%mm7, %%mm4        \n\t"
-                "psraw      $1, %%mm0        \n\t"
-                "psraw      $1, %%mm4        \n\t"
-                "movq     (%0), %%mm1        \n\t"
-                "movq    8(%0), %%mm5        \n\t"
-                "paddw   %%mm1, %%mm0        \n\t"
-                "paddw   %%mm5, %%mm4        \n\t"
-                "psraw      $2, %%mm0        \n\t"
-                "psraw      $2, %%mm4        \n\t"
-                "paddw   %%mm1, %%mm0        \n\t"
-                "paddw   %%mm5, %%mm4        \n\t"
-                "movq    %%mm0, (%0)         \n\t"
-                "movq    %%mm4, 8(%0)        \n\t"
-                :: "r"(&b[i]), "r"(&ref[i])
-                 : "memory"
-               );
-        }
-        snow_horizontal_compose_liftS_lead_out(i, b, b, ref, width, w_l);
-    }
-
-    { // Lift 3
-        IDWTELEM * const src = b+w2;
-        i = 0;
-
-        for(; i<w_r-7; i+=8){
-            __asm__ volatile(
-                "movq    2(%1), %%mm2        \n\t"
-                "movq   10(%1), %%mm6        \n\t"
-                "paddw    (%1), %%mm2        \n\t"
-                "paddw   8(%1), %%mm6        \n\t"
-                "movq     (%0), %%mm0        \n\t"
-                "movq    8(%0), %%mm4        \n\t"
-                "paddw   %%mm2, %%mm0        \n\t"
-                "paddw   %%mm6, %%mm4        \n\t"
-                "psraw      $1, %%mm2        \n\t"
-                "psraw      $1, %%mm6        \n\t"
-                "paddw   %%mm0, %%mm2        \n\t"
-                "paddw   %%mm4, %%mm6        \n\t"
-                "movq    %%mm2, (%2)         \n\t"
-                "movq    %%mm6, 8(%2)        \n\t"
-                :: "r"(&src[i]), "r"(&b[i]), "r"(&temp[i])
-                 : "memory"
-               );
-        }
-        snow_horizontal_compose_lift_lead_out(i, temp, src, b, width, w_r, 1, -W_AM, W_AO+1, W_AS);
-    }
-
-    {
-        snow_interleave_line_header(&i, width, b, temp);
-
-        for (; (i & 0x1E) != 0x1E; i-=2){
-            b[i+1] = temp[i>>1];
-            b[i] = b[i>>1];
-        }
-        for (i-=30; i>=0; i-=32){
-            __asm__ volatile(
-                "movq        (%1), %%mm0       \n\t"
-                "movq       8(%1), %%mm2       \n\t"
-                "movq      16(%1), %%mm4       \n\t"
-                "movq      24(%1), %%mm6       \n\t"
-                "movq        (%1), %%mm1       \n\t"
-                "movq       8(%1), %%mm3       \n\t"
-                "movq      16(%1), %%mm5       \n\t"
-                "movq      24(%1), %%mm7       \n\t"
-                "punpcklwd   (%2), %%mm0       \n\t"
-                "punpcklwd  8(%2), %%mm2       \n\t"
-                "punpcklwd 16(%2), %%mm4       \n\t"
-                "punpcklwd 24(%2), %%mm6       \n\t"
-                "movq       %%mm0, (%0)        \n\t"
-                "movq       %%mm2, 16(%0)      \n\t"
-                "movq       %%mm4, 32(%0)      \n\t"
-                "movq       %%mm6, 48(%0)      \n\t"
-                "punpckhwd   (%2), %%mm1       \n\t"
-                "punpckhwd  8(%2), %%mm3       \n\t"
-                "punpckhwd 16(%2), %%mm5       \n\t"
-                "punpckhwd 24(%2), %%mm7       \n\t"
-                "movq       %%mm1, 8(%0)       \n\t"
-                "movq       %%mm3, 24(%0)      \n\t"
-                "movq       %%mm5, 40(%0)      \n\t"
-                "movq       %%mm7, 56(%0)      \n\t"
-                :: "r"(&b[i]), "r"(&b[i>>1]), "r"(&temp[i>>1])
-                 : "memory"
-               );
-        }
-    }
-}
-
-#if HAVE_7REGS
-#define snow_vertical_compose_sse2_load_add(op,r,t0,t1,t2,t3)\
-        ""op" ("r",%%"REG_d"), %%"t0"      \n\t"\
-        ""op" 16("r",%%"REG_d"), %%"t1"    \n\t"\
-        ""op" 32("r",%%"REG_d"), %%"t2"    \n\t"\
-        ""op" 48("r",%%"REG_d"), %%"t3"    \n\t"
-
-#define snow_vertical_compose_sse2_load(r,t0,t1,t2,t3)\
-        snow_vertical_compose_sse2_load_add("movdqa",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_sse2_add(r,t0,t1,t2,t3)\
-        snow_vertical_compose_sse2_load_add("paddw",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_r2r_sub(s0,s1,s2,s3,t0,t1,t2,t3)\
-        "psubw %%"s0", %%"t0" \n\t"\
-        "psubw %%"s1", %%"t1" \n\t"\
-        "psubw %%"s2", %%"t2" \n\t"\
-        "psubw %%"s3", %%"t3" \n\t"
-
-#define snow_vertical_compose_sse2_store(w,s0,s1,s2,s3)\
-        "movdqa %%"s0", ("w",%%"REG_d")      \n\t"\
-        "movdqa %%"s1", 16("w",%%"REG_d")    \n\t"\
-        "movdqa %%"s2", 32("w",%%"REG_d")    \n\t"\
-        "movdqa %%"s3", 48("w",%%"REG_d")    \n\t"
-
-#define snow_vertical_compose_sra(n,t0,t1,t2,t3)\
-        "psraw $"n", %%"t0" \n\t"\
-        "psraw $"n", %%"t1" \n\t"\
-        "psraw $"n", %%"t2" \n\t"\
-        "psraw $"n", %%"t3" \n\t"
-
-#define snow_vertical_compose_r2r_add(s0,s1,s2,s3,t0,t1,t2,t3)\
-        "paddw %%"s0", %%"t0" \n\t"\
-        "paddw %%"s1", %%"t1" \n\t"\
-        "paddw %%"s2", %%"t2" \n\t"\
-        "paddw %%"s3", %%"t3" \n\t"
-
-#define snow_vertical_compose_r2r_pmulhw(s0,s1,s2,s3,t0,t1,t2,t3)\
-        "pmulhw %%"s0", %%"t0" \n\t"\
-        "pmulhw %%"s1", %%"t1" \n\t"\
-        "pmulhw %%"s2", %%"t2" \n\t"\
-        "pmulhw %%"s3", %%"t3" \n\t"
-
-#define snow_vertical_compose_sse2_move(s0,s1,s2,s3,t0,t1,t2,t3)\
-        "movdqa %%"s0", %%"t0" \n\t"\
-        "movdqa %%"s1", %%"t1" \n\t"\
-        "movdqa %%"s2", %%"t2" \n\t"\
-        "movdqa %%"s3", %%"t3" \n\t"
-
-static void ff_snow_vertical_compose97i_sse2(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
-    x86_reg i = width;
-
-    while(i & 0x1F)
-    {
-        i--;
-        b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
-        b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
-        b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
-        b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
-    }
-    i+=i;
-
-         __asm__ volatile (
-        "jmp 2f                                      \n\t"
-        "1:                                          \n\t"
-        snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_add("%6","xmm0","xmm2","xmm4","xmm6")
-
-
-        "pcmpeqw    %%xmm0, %%xmm0                   \n\t"
-        "pcmpeqw    %%xmm2, %%xmm2                   \n\t"
-        "paddw      %%xmm2, %%xmm2                   \n\t"
-        "paddw      %%xmm0, %%xmm2                   \n\t"
-        "psllw         $13, %%xmm2                   \n\t"
-        snow_vertical_compose_r2r_add("xmm0","xmm0","xmm0","xmm0","xmm1","xmm3","xmm5","xmm7")
-        snow_vertical_compose_r2r_pmulhw("xmm2","xmm2","xmm2","xmm2","xmm1","xmm3","xmm5","xmm7")
-        snow_vertical_compose_sse2_add("%5","xmm1","xmm3","xmm5","xmm7")
-        snow_vertical_compose_sse2_store("%5","xmm1","xmm3","xmm5","xmm7")
-        snow_vertical_compose_sse2_load("%4","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_add("%3","xmm1","xmm3","xmm5","xmm7")
-        snow_vertical_compose_r2r_sub("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_store("%4","xmm0","xmm2","xmm4","xmm6")
-
-        "pcmpeqw %%xmm7, %%xmm7                      \n\t"
-        "pcmpeqw %%xmm5, %%xmm5                      \n\t"
-        "psllw $15, %%xmm7                           \n\t"
-        "psrlw $13, %%xmm5                           \n\t"
-        "paddw %%xmm7, %%xmm5                        \n\t"
-        snow_vertical_compose_r2r_add("xmm5","xmm5","xmm5","xmm5","xmm0","xmm2","xmm4","xmm6")
-        "movq   (%2,%%"REG_d"), %%xmm1        \n\t"
-        "movq  8(%2,%%"REG_d"), %%xmm3        \n\t"
-        "paddw %%xmm7, %%xmm1                        \n\t"
-        "paddw %%xmm7, %%xmm3                        \n\t"
-        "pavgw %%xmm1, %%xmm0                        \n\t"
-        "pavgw %%xmm3, %%xmm2                        \n\t"
-        "movq 16(%2,%%"REG_d"), %%xmm1        \n\t"
-        "movq 24(%2,%%"REG_d"), %%xmm3        \n\t"
-        "paddw %%xmm7, %%xmm1                        \n\t"
-        "paddw %%xmm7, %%xmm3                        \n\t"
-        "pavgw %%xmm1, %%xmm4                        \n\t"
-        "pavgw %%xmm3, %%xmm6                        \n\t"
-        snow_vertical_compose_r2r_sub("xmm7","xmm7","xmm7","xmm7","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6")
-
-        snow_vertical_compose_sra("2","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_add("%3","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_store("%3","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_add("%1","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_move("xmm0","xmm2","xmm4","xmm6","xmm1","xmm3","xmm5","xmm7")
-        snow_vertical_compose_sra("1","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_r2r_add("xmm1","xmm3","xmm5","xmm7","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_add("%2","xmm0","xmm2","xmm4","xmm6")
-        snow_vertical_compose_sse2_store("%2","xmm0","xmm2","xmm4","xmm6")
-
-        "2:                                          \n\t"
-        "sub $64, %%"REG_d"                          \n\t"
-        "jge 1b                                      \n\t"
-        :"+d"(i)
-        :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5));
-}
-
-#define snow_vertical_compose_mmx_load_add(op,r,t0,t1,t2,t3)\
-        ""op" ("r",%%"REG_d"), %%"t0"   \n\t"\
-        ""op" 8("r",%%"REG_d"), %%"t1"  \n\t"\
-        ""op" 16("r",%%"REG_d"), %%"t2" \n\t"\
-        ""op" 24("r",%%"REG_d"), %%"t3" \n\t"
-
-#define snow_vertical_compose_mmx_load(r,t0,t1,t2,t3)\
-        snow_vertical_compose_mmx_load_add("movq",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_mmx_add(r,t0,t1,t2,t3)\
-        snow_vertical_compose_mmx_load_add("paddw",r,t0,t1,t2,t3)
-
-#define snow_vertical_compose_mmx_store(w,s0,s1,s2,s3)\
-        "movq %%"s0", ("w",%%"REG_d")   \n\t"\
-        "movq %%"s1", 8("w",%%"REG_d")  \n\t"\
-        "movq %%"s2", 16("w",%%"REG_d") \n\t"\
-        "movq %%"s3", 24("w",%%"REG_d") \n\t"
-
-#define snow_vertical_compose_mmx_move(s0,s1,s2,s3,t0,t1,t2,t3)\
-        "movq %%"s0", %%"t0" \n\t"\
-        "movq %%"s1", %%"t1" \n\t"\
-        "movq %%"s2", %%"t2" \n\t"\
-        "movq %%"s3", %%"t3" \n\t"
-
-
-static void ff_snow_vertical_compose97i_mmx(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5, int width){
-    x86_reg i = width;
-    while(i & 15)
-    {
-        i--;
-        b4[i] -= (W_DM*(b3[i] + b5[i])+W_DO)>>W_DS;
-        b3[i] -= (W_CM*(b2[i] + b4[i])+W_CO)>>W_CS;
-        b2[i] += (W_BM*(b1[i] + b3[i])+4*b2[i]+W_BO)>>W_BS;
-        b1[i] += (W_AM*(b0[i] + b2[i])+W_AO)>>W_AS;
-    }
-    i+=i;
-    __asm__ volatile(
-        "jmp 2f                                      \n\t"
-        "1:                                          \n\t"
-
-        snow_vertical_compose_mmx_load("%4","mm1","mm3","mm5","mm7")
-        snow_vertical_compose_mmx_add("%6","mm1","mm3","mm5","mm7")
-        "pcmpeqw    %%mm0, %%mm0                     \n\t"
-        "pcmpeqw    %%mm2, %%mm2                     \n\t"
-        "paddw      %%mm2, %%mm2                     \n\t"
-        "paddw      %%mm0, %%mm2                     \n\t"
-        "psllw        $13, %%mm2                     \n\t"
-        snow_vertical_compose_r2r_add("mm0","mm0","mm0","mm0","mm1","mm3","mm5","mm7")
-        snow_vertical_compose_r2r_pmulhw("mm2","mm2","mm2","mm2","mm1","mm3","mm5","mm7")
-        snow_vertical_compose_mmx_add("%5","mm1","mm3","mm5","mm7")
-        snow_vertical_compose_mmx_store("%5","mm1","mm3","mm5","mm7")
-        snow_vertical_compose_mmx_load("%4","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_add("%3","mm1","mm3","mm5","mm7")
-        snow_vertical_compose_r2r_sub("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_store("%4","mm0","mm2","mm4","mm6")
-        "pcmpeqw %%mm7, %%mm7                        \n\t"
-        "pcmpeqw %%mm5, %%mm5                        \n\t"
-        "psllw $15, %%mm7                            \n\t"
-        "psrlw $13, %%mm5                            \n\t"
-        "paddw %%mm7, %%mm5                          \n\t"
-        snow_vertical_compose_r2r_add("mm5","mm5","mm5","mm5","mm0","mm2","mm4","mm6")
-        "movq   (%2,%%"REG_d"), %%mm1         \n\t"
-        "movq  8(%2,%%"REG_d"), %%mm3         \n\t"
-        "paddw %%mm7, %%mm1                          \n\t"
-        "paddw %%mm7, %%mm3                          \n\t"
-        "pavgw %%mm1, %%mm0                          \n\t"
-        "pavgw %%mm3, %%mm2                          \n\t"
-        "movq 16(%2,%%"REG_d"), %%mm1         \n\t"
-        "movq 24(%2,%%"REG_d"), %%mm3         \n\t"
-        "paddw %%mm7, %%mm1                          \n\t"
-        "paddw %%mm7, %%mm3                          \n\t"
-        "pavgw %%mm1, %%mm4                          \n\t"
-        "pavgw %%mm3, %%mm6                          \n\t"
-        snow_vertical_compose_r2r_sub("mm7","mm7","mm7","mm7","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6")
-
-        snow_vertical_compose_sra("2","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_add("%3","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_store("%3","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_add("%1","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_move("mm0","mm2","mm4","mm6","mm1","mm3","mm5","mm7")
-        snow_vertical_compose_sra("1","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_r2r_add("mm1","mm3","mm5","mm7","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_add("%2","mm0","mm2","mm4","mm6")
-        snow_vertical_compose_mmx_store("%2","mm0","mm2","mm4","mm6")
-
-        "2:                                          \n\t"
-        "sub $32, %%"REG_d"                          \n\t"
-        "jge 1b                                      \n\t"
-        :"+d"(i)
-        :"r"(b0),"r"(b1),"r"(b2),"r"(b3),"r"(b4),"r"(b5));
-}
-#endif //HAVE_7REGS
-
-#define snow_inner_add_yblock_sse2_header \
-    IDWTELEM * * dst_array = sb->line + src_y;\
-    x86_reg tmp;\
-    __asm__ volatile(\
-             "mov  %7, %%"REG_c"             \n\t"\
-             "mov  %6, %2                    \n\t"\
-             "mov  %4, %%"REG_S"             \n\t"\
-             "pxor %%xmm7, %%xmm7            \n\t" /* 0 */\
-             "pcmpeqd %%xmm3, %%xmm3         \n\t"\
-             "psllw $15, %%xmm3              \n\t"\
-             "psrlw $12, %%xmm3              \n\t" /* FRAC_BITS >> 1 */\
-             "1:                             \n\t"\
-             "mov %1, %%"REG_D"              \n\t"\
-             "mov (%%"REG_D"), %%"REG_D"     \n\t"\
-             "add %3, %%"REG_D"              \n\t"
-
-#define snow_inner_add_yblock_sse2_start_8(out_reg1, out_reg2, ptr_offset, s_offset)\
-             "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
-             "movq (%%"REG_d"), %%"out_reg1" \n\t"\
-             "movq (%%"REG_d", %%"REG_c"), %%"out_reg2" \n\t"\
-             "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
-             "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
-             "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
-             "movq "s_offset"+16(%%"REG_S"), %%xmm4 \n\t"\
-             "punpcklbw %%xmm7, %%xmm0       \n\t"\
-             "punpcklbw %%xmm7, %%xmm4       \n\t"\
-             "pmullw %%xmm0, %%"out_reg1"    \n\t"\
-             "pmullw %%xmm4, %%"out_reg2"    \n\t"
-
-#define snow_inner_add_yblock_sse2_start_16(out_reg1, out_reg2, ptr_offset, s_offset)\
-             "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
-             "movq (%%"REG_d"), %%"out_reg1" \n\t"\
-             "movq 8(%%"REG_d"), %%"out_reg2" \n\t"\
-             "punpcklbw %%xmm7, %%"out_reg1" \n\t"\
-             "punpcklbw %%xmm7, %%"out_reg2" \n\t"\
-             "movq "s_offset"(%%"REG_S"), %%xmm0 \n\t"\
-             "movq "s_offset"+8(%%"REG_S"), %%xmm4 \n\t"\
-             "punpcklbw %%xmm7, %%xmm0       \n\t"\
-             "punpcklbw %%xmm7, %%xmm4       \n\t"\
-             "pmullw %%xmm0, %%"out_reg1"    \n\t"\
-             "pmullw %%xmm4, %%"out_reg2"    \n\t"
-
-#define snow_inner_add_yblock_sse2_accum_8(ptr_offset, s_offset) \
-             snow_inner_add_yblock_sse2_start_8("xmm2", "xmm6", ptr_offset, s_offset)\
-             "paddusw %%xmm2, %%xmm1         \n\t"\
-             "paddusw %%xmm6, %%xmm5         \n\t"
-
-#define snow_inner_add_yblock_sse2_accum_16(ptr_offset, s_offset) \
-             snow_inner_add_yblock_sse2_start_16("xmm2", "xmm6", ptr_offset, s_offset)\
-             "paddusw %%xmm2, %%xmm1         \n\t"\
-             "paddusw %%xmm6, %%xmm5         \n\t"
-
-#define snow_inner_add_yblock_sse2_end_common1\
-             "add $32, %%"REG_S"             \n\t"\
-             "add %%"REG_c", %0              \n\t"\
-             "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
-             "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
-             "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
-             "add %%"REG_c", (%%"REG_a")     \n\t"
-
-#define snow_inner_add_yblock_sse2_end_common2\
-             "jnz 1b                         \n\t"\
-             :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
-             :\
-             "rm"((x86_reg)(src_x<<1)),"m"(obmc),"a"(block),"m"(b_h),"m"(src_stride):\
-             "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
-
-#define snow_inner_add_yblock_sse2_end_8\
-             "sal $1, %%"REG_c"              \n\t"\
-             "add $"PTR_SIZE"*2, %1          \n\t"\
-             snow_inner_add_yblock_sse2_end_common1\
-             "sar $1, %%"REG_c"              \n\t"\
-             "sub $2, %2                     \n\t"\
-             snow_inner_add_yblock_sse2_end_common2
-
-#define snow_inner_add_yblock_sse2_end_16\
-             "add $"PTR_SIZE"*1, %1          \n\t"\
-             snow_inner_add_yblock_sse2_end_common1\
-             "dec %2                         \n\t"\
-             snow_inner_add_yblock_sse2_end_common2
-
-static void inner_add_yblock_bw_8_obmc_16_bh_even_sse2(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
-                      int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_sse2_header
-snow_inner_add_yblock_sse2_start_8("xmm1", "xmm5", "3", "0")
-snow_inner_add_yblock_sse2_accum_8("2", "8")
-snow_inner_add_yblock_sse2_accum_8("1", "128")
-snow_inner_add_yblock_sse2_accum_8("0", "136")
-
-             "mov %0, %%"REG_d"              \n\t"
-             "movdqa (%%"REG_D"), %%xmm0     \n\t"
-             "movdqa %%xmm1, %%xmm2          \n\t"
-
-             "punpckhwd %%xmm7, %%xmm1       \n\t"
-             "punpcklwd %%xmm7, %%xmm2       \n\t"
-             "paddd %%xmm2, %%xmm0           \n\t"
-             "movdqa 16(%%"REG_D"), %%xmm2   \n\t"
-             "paddd %%xmm1, %%xmm2           \n\t"
-             "paddd %%xmm3, %%xmm0           \n\t"
-             "paddd %%xmm3, %%xmm2           \n\t"
-
-             "mov %1, %%"REG_D"              \n\t"
-             "mov "PTR_SIZE"(%%"REG_D"), %%"REG_D";\n\t"
-             "add %3, %%"REG_D"              \n\t"
-
-             "movdqa (%%"REG_D"), %%xmm4     \n\t"
-             "movdqa %%xmm5, %%xmm6          \n\t"
-             "punpckhwd %%xmm7, %%xmm5       \n\t"
-             "punpcklwd %%xmm7, %%xmm6       \n\t"
-             "paddd %%xmm6, %%xmm4           \n\t"
-             "movdqa 16(%%"REG_D"), %%xmm6   \n\t"
-             "paddd %%xmm5, %%xmm6           \n\t"
-             "paddd %%xmm3, %%xmm4           \n\t"
-             "paddd %%xmm3, %%xmm6           \n\t"
-
-             "psrad $8, %%xmm0               \n\t" /* FRAC_BITS. */
-             "psrad $8, %%xmm2               \n\t" /* FRAC_BITS. */
-             "packssdw %%xmm2, %%xmm0        \n\t"
-             "packuswb %%xmm7, %%xmm0        \n\t"
-             "movq %%xmm0, (%%"REG_d")       \n\t"
-
-             "psrad $8, %%xmm4               \n\t" /* FRAC_BITS. */
-             "psrad $8, %%xmm6               \n\t" /* FRAC_BITS. */
-             "packssdw %%xmm6, %%xmm4        \n\t"
-             "packuswb %%xmm7, %%xmm4        \n\t"
-             "movq %%xmm4, (%%"REG_d",%%"REG_c");\n\t"
-snow_inner_add_yblock_sse2_end_8
-}
-
-static void inner_add_yblock_bw_16_obmc_32_sse2(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
-                      int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_sse2_header
-snow_inner_add_yblock_sse2_start_16("xmm1", "xmm5", "3", "0")
-snow_inner_add_yblock_sse2_accum_16("2", "16")
-snow_inner_add_yblock_sse2_accum_16("1", "512")
-snow_inner_add_yblock_sse2_accum_16("0", "528")
-
-             "mov %0, %%"REG_d"              \n\t"
-             "psrlw $4, %%xmm1               \n\t"
-             "psrlw $4, %%xmm5               \n\t"
-             "paddw   (%%"REG_D"), %%xmm1    \n\t"
-             "paddw 16(%%"REG_D"), %%xmm5    \n\t"
-             "paddw %%xmm3, %%xmm1           \n\t"
-             "paddw %%xmm3, %%xmm5           \n\t"
-             "psraw $4, %%xmm1               \n\t" /* FRAC_BITS. */
-             "psraw $4, %%xmm5               \n\t" /* FRAC_BITS. */
-             "packuswb %%xmm5, %%xmm1        \n\t"
-
-             "movdqu %%xmm1, (%%"REG_d")       \n\t"
-
-snow_inner_add_yblock_sse2_end_16
-}
-
-#define snow_inner_add_yblock_mmx_header \
-    IDWTELEM * * dst_array = sb->line + src_y;\
-    x86_reg tmp;\
-    __asm__ volatile(\
-             "mov  %7, %%"REG_c"             \n\t"\
-             "mov  %6, %2                    \n\t"\
-             "mov  %4, %%"REG_S"             \n\t"\
-             "pxor %%mm7, %%mm7              \n\t" /* 0 */\
-             "pcmpeqd %%mm3, %%mm3           \n\t"\
-             "psllw $15, %%mm3               \n\t"\
-             "psrlw $12, %%mm3               \n\t" /* FRAC_BITS >> 1 */\
-             "1:                             \n\t"\
-             "mov %1, %%"REG_D"              \n\t"\
-             "mov (%%"REG_D"), %%"REG_D"     \n\t"\
-             "add %3, %%"REG_D"              \n\t"
-
-#define snow_inner_add_yblock_mmx_start(out_reg1, out_reg2, ptr_offset, s_offset, d_offset)\
-             "mov "PTR_SIZE"*"ptr_offset"(%%"REG_a"), %%"REG_d"; \n\t"\
-             "movd "d_offset"(%%"REG_d"), %%"out_reg1" \n\t"\
-             "movd "d_offset"+4(%%"REG_d"), %%"out_reg2" \n\t"\
-             "punpcklbw %%mm7, %%"out_reg1" \n\t"\
-             "punpcklbw %%mm7, %%"out_reg2" \n\t"\
-             "movd "s_offset"(%%"REG_S"), %%mm0 \n\t"\
-             "movd "s_offset"+4(%%"REG_S"), %%mm4 \n\t"\
-             "punpcklbw %%mm7, %%mm0       \n\t"\
-             "punpcklbw %%mm7, %%mm4       \n\t"\
-             "pmullw %%mm0, %%"out_reg1"    \n\t"\
-             "pmullw %%mm4, %%"out_reg2"    \n\t"
-
-#define snow_inner_add_yblock_mmx_accum(ptr_offset, s_offset, d_offset) \
-             snow_inner_add_yblock_mmx_start("mm2", "mm6", ptr_offset, s_offset, d_offset)\
-             "paddusw %%mm2, %%mm1         \n\t"\
-             "paddusw %%mm6, %%mm5         \n\t"
-
-#define snow_inner_add_yblock_mmx_mix(read_offset, write_offset)\
-             "mov %0, %%"REG_d"              \n\t"\
-             "psrlw $4, %%mm1                \n\t"\
-             "psrlw $4, %%mm5                \n\t"\
-             "paddw "read_offset"(%%"REG_D"), %%mm1 \n\t"\
-             "paddw "read_offset"+8(%%"REG_D"), %%mm5 \n\t"\
-             "paddw %%mm3, %%mm1             \n\t"\
-             "paddw %%mm3, %%mm5             \n\t"\
-             "psraw $4, %%mm1                \n\t"\
-             "psraw $4, %%mm5                \n\t"\
-             "packuswb %%mm5, %%mm1          \n\t"\
-             "movq %%mm1, "write_offset"(%%"REG_d") \n\t"
-
-#define snow_inner_add_yblock_mmx_end(s_step)\
-             "add $"s_step", %%"REG_S"             \n\t"\
-             "add %%"REG_c", "PTR_SIZE"*3(%%"REG_a");\n\t"\
-             "add %%"REG_c", "PTR_SIZE"*2(%%"REG_a");\n\t"\
-             "add %%"REG_c", "PTR_SIZE"*1(%%"REG_a");\n\t"\
-             "add %%"REG_c", (%%"REG_a")     \n\t"\
-             "add $"PTR_SIZE"*1, %1          \n\t"\
-             "add %%"REG_c", %0              \n\t"\
-             "dec %2                         \n\t"\
-             "jnz 1b                         \n\t"\
-             :"+m"(dst8),"+m"(dst_array),"=&r"(tmp)\
-             :\
-             "rm"((x86_reg)(src_x<<1)),"m"(obmc),"a"(block),"m"(b_h),"m"(src_stride):\
-             "%"REG_c"","%"REG_S"","%"REG_D"","%"REG_d"");
-
-static void inner_add_yblock_bw_8_obmc_16_mmx(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
-                      int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_mmx_header
-snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
-snow_inner_add_yblock_mmx_accum("2", "8", "0")
-snow_inner_add_yblock_mmx_accum("1", "128", "0")
-snow_inner_add_yblock_mmx_accum("0", "136", "0")
-snow_inner_add_yblock_mmx_mix("0", "0")
-snow_inner_add_yblock_mmx_end("16")
-}
-
-static void inner_add_yblock_bw_16_obmc_32_mmx(const uint8_t *obmc, const x86_reg obmc_stride, uint8_t * * block, int b_w, x86_reg b_h,
-                      int src_x, int src_y, x86_reg src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-snow_inner_add_yblock_mmx_header
-snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "0", "0")
-snow_inner_add_yblock_mmx_accum("2", "16", "0")
-snow_inner_add_yblock_mmx_accum("1", "512", "0")
-snow_inner_add_yblock_mmx_accum("0", "528", "0")
-snow_inner_add_yblock_mmx_mix("0", "0")
-
-snow_inner_add_yblock_mmx_start("mm1", "mm5", "3", "8", "8")
-snow_inner_add_yblock_mmx_accum("2", "24", "8")
-snow_inner_add_yblock_mmx_accum("1", "520", "8")
-snow_inner_add_yblock_mmx_accum("0", "536", "8")
-snow_inner_add_yblock_mmx_mix("16", "8")
-snow_inner_add_yblock_mmx_end("32")
-}
-
-static void ff_snow_inner_add_yblock_sse2(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
-                           int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-
-    if (b_w == 16)
-        inner_add_yblock_bw_16_obmc_32_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-    else if (b_w == 8 && obmc_stride == 16) {
-        if (!(b_h & 1))
-            inner_add_yblock_bw_8_obmc_16_bh_even_sse2(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-        else
-            inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-    } else
-         ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-}
-
-static void ff_snow_inner_add_yblock_mmx(const uint8_t *obmc, const int obmc_stride, uint8_t * * block, int b_w, int b_h,
-                          int src_x, int src_y, int src_stride, slice_buffer * sb, int add, uint8_t * dst8){
-    if (b_w == 16)
-        inner_add_yblock_bw_16_obmc_32_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-    else if (b_w == 8 && obmc_stride == 16)
-        inner_add_yblock_bw_8_obmc_16_mmx(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-    else
-        ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
-}
-
-void ff_dwt_init_x86(DWTContext *c)
-{
-    mm_flags = mm_support();
-
-    if (mm_flags & FF_MM_MMX) {
-        if(mm_flags & FF_MM_SSE2 & 0){
-            c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2;
-#if HAVE_7REGS
-            c->vertical_compose97i = ff_snow_vertical_compose97i_sse2;
-#endif
-            c->inner_add_yblock = ff_snow_inner_add_yblock_sse2;
-        }
-        else{
-            if(mm_flags & FF_MM_MMX2){
-            c->horizontal_compose97i = ff_snow_horizontal_compose97i_mmx;
-#if HAVE_7REGS
-            c->vertical_compose97i = ff_snow_vertical_compose97i_mmx;
-#endif
-            }
-            c->inner_add_yblock = ff_snow_inner_add_yblock_mmx;
-        }
-    }
-}
diff --git a/libavcodec/x86/vc1dsp_mmx.c b/libavcodec/x86/vc1dsp_mmx.c
deleted file mode 100644
index e0b1f5b..0000000
--- a/libavcodec/x86/vc1dsp_mmx.c
+++ /dev/null
@@ -1,741 +0,0 @@
-/*
- * VC-1 and WMV3 - DSP functions MMX-optimized
- * Copyright (c) 2007 Christophe GISQUET <christophe.gisquet at free.fr>
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-
-#define OP_PUT(S,D)
-#define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t"
-
-/** Add rounder from mm7 to mm3 and pack result at destination */
-#define NORMALIZE_MMX(SHIFT)                                    \
-     "paddw     %%mm7, %%mm3           \n\t" /* +bias-r */      \
-     "paddw     %%mm7, %%mm4           \n\t" /* +bias-r */      \
-     "psraw     "SHIFT", %%mm3         \n\t"                    \
-     "psraw     "SHIFT", %%mm4         \n\t"
-
-#define TRANSFER_DO_PACK(OP)                    \
-     "packuswb  %%mm4, %%mm3           \n\t"    \
-     OP((%2), %%mm3)                            \
-     "movq      %%mm3, (%2)            \n\t"
-
-#define TRANSFER_DONT_PACK(OP)                  \
-     OP(0(%2), %%mm3)                           \
-     OP(8(%2), %%mm4)                           \
-     "movq      %%mm3, 0(%2)           \n\t"    \
-     "movq      %%mm4, 8(%2)           \n\t"
-
-/** @see MSPEL_FILTER13_CORE for use as UNPACK macro */
-#define DO_UNPACK(reg)  "punpcklbw %%mm0, " reg "\n\t"
-#define DONT_UNPACK(reg)
-
-/** Compute the rounder 32-r or 8-r and unpacks it to mm7 */
-#define LOAD_ROUNDER_MMX(ROUND)                 \
-     "movd      "ROUND", %%mm7         \n\t"    \
-     "punpcklwd %%mm7, %%mm7           \n\t"    \
-     "punpckldq %%mm7, %%mm7           \n\t"
-
-#define SHIFT2_LINE(OFF, R0,R1,R2,R3)           \
-    "paddw     %%mm"#R2", %%mm"#R1"    \n\t"    \
-    "movd      (%0,%3), %%mm"#R0"      \n\t"    \
-    "pmullw    %%mm6, %%mm"#R1"        \n\t"    \
-    "punpcklbw %%mm0, %%mm"#R0"        \n\t"    \
-    "movd      (%0,%2), %%mm"#R3"      \n\t"    \
-    "psubw     %%mm"#R0", %%mm"#R1"    \n\t"    \
-    "punpcklbw %%mm0, %%mm"#R3"        \n\t"    \
-    "paddw     %%mm7, %%mm"#R1"        \n\t"    \
-    "psubw     %%mm"#R3", %%mm"#R1"    \n\t"    \
-    "psraw     %4, %%mm"#R1"           \n\t"    \
-    "movq      %%mm"#R1", "#OFF"(%1)   \n\t"    \
-    "add       %2, %0                  \n\t"
-
-DECLARE_ALIGNED(16, const uint64_t, ff_pw_9) = 0x0009000900090009ULL;
-
-/** Sacrifying mm6 allows to pipeline loads from src */
-static void vc1_put_ver_16b_shift2_mmx(int16_t *dst,
-                                       const uint8_t *src, x86_reg stride,
-                                       int rnd, int64_t shift)
-{
-    __asm__ volatile(
-        "mov       $3, %%"REG_c"           \n\t"
-        LOAD_ROUNDER_MMX("%5")
-        "movq      "MANGLE(ff_pw_9)", %%mm6 \n\t"
-        "1:                                \n\t"
-        "movd      (%0), %%mm2             \n\t"
-        "add       %2, %0                  \n\t"
-        "movd      (%0), %%mm3             \n\t"
-        "punpcklbw %%mm0, %%mm2            \n\t"
-        "punpcklbw %%mm0, %%mm3            \n\t"
-        SHIFT2_LINE(  0, 1, 2, 3, 4)
-        SHIFT2_LINE( 24, 2, 3, 4, 1)
-        SHIFT2_LINE( 48, 3, 4, 1, 2)
-        SHIFT2_LINE( 72, 4, 1, 2, 3)
-        SHIFT2_LINE( 96, 1, 2, 3, 4)
-        SHIFT2_LINE(120, 2, 3, 4, 1)
-        SHIFT2_LINE(144, 3, 4, 1, 2)
-        SHIFT2_LINE(168, 4, 1, 2, 3)
-        "sub       %6, %0                  \n\t"
-        "add       $8, %1                  \n\t"
-        "dec       %%"REG_c"               \n\t"
-        "jnz 1b                            \n\t"
-        : "+r"(src), "+r"(dst)
-        : "r"(stride), "r"(-2*stride),
-          "m"(shift), "m"(rnd), "r"(9*stride-4)
-        : "%"REG_c, "memory"
-    );
-}
-
-/**
- * Data is already unpacked, so some operations can directly be made from
- * memory.
- */
-#define VC1_HOR_16b_SHIFT2(OP, OPNAME)\
-static void OPNAME ## vc1_hor_16b_shift2_mmx(uint8_t *dst, x86_reg stride,\
-                                             const int16_t *src, int rnd)\
-{\
-    int h = 8;\
-\
-    src -= 1;\
-    rnd -= (-1+9+9-1)*1024; /* Add -1024 bias */\
-    __asm__ volatile(\
-        LOAD_ROUNDER_MMX("%4")\
-        "movq      "MANGLE(ff_pw_128)", %%mm6\n\t"\
-        "movq      "MANGLE(ff_pw_9)", %%mm5 \n\t"\
-        "1:                                \n\t"\
-        "movq      2*0+0(%1), %%mm1        \n\t"\
-        "movq      2*0+8(%1), %%mm2        \n\t"\
-        "movq      2*1+0(%1), %%mm3        \n\t"\
-        "movq      2*1+8(%1), %%mm4        \n\t"\
-        "paddw     2*3+0(%1), %%mm1        \n\t"\
-        "paddw     2*3+8(%1), %%mm2        \n\t"\
-        "paddw     2*2+0(%1), %%mm3        \n\t"\
-        "paddw     2*2+8(%1), %%mm4        \n\t"\
-        "pmullw    %%mm5, %%mm3            \n\t"\
-        "pmullw    %%mm5, %%mm4            \n\t"\
-        "psubw     %%mm1, %%mm3            \n\t"\
-        "psubw     %%mm2, %%mm4            \n\t"\
-        NORMALIZE_MMX("$7")\
-        /* Remove bias */\
-        "paddw     %%mm6, %%mm3            \n\t"\
-        "paddw     %%mm6, %%mm4            \n\t"\
-        TRANSFER_DO_PACK(OP)\
-        "add       $24, %1                 \n\t"\
-        "add       %3, %2                  \n\t"\
-        "decl      %0                      \n\t"\
-        "jnz 1b                            \n\t"\
-        : "+r"(h), "+r" (src),  "+r" (dst)\
-        : "r"(stride), "m"(rnd)\
-        : "memory"\
-    );\
-}
-
-VC1_HOR_16b_SHIFT2(OP_PUT, put_)
-VC1_HOR_16b_SHIFT2(OP_AVG, avg_)
-
-
-/**
- * Purely vertical or horizontal 1/2 shift interpolation.
- * Sacrify mm6 for *9 factor.
- */
-#define VC1_SHIFT2(OP, OPNAME)\
-static void OPNAME ## vc1_shift2_mmx(uint8_t *dst, const uint8_t *src,\
-                                     x86_reg stride, int rnd, x86_reg offset)\
-{\
-    rnd = 8-rnd;\
-    __asm__ volatile(\
-        "mov       $8, %%"REG_c"           \n\t"\
-        LOAD_ROUNDER_MMX("%5")\
-        "movq      "MANGLE(ff_pw_9)", %%mm6\n\t"\
-        "1:                                \n\t"\
-        "movd      0(%0   ), %%mm3         \n\t"\
-        "movd      4(%0   ), %%mm4         \n\t"\
-        "movd      0(%0,%2), %%mm1         \n\t"\
-        "movd      4(%0,%2), %%mm2         \n\t"\
-        "add       %2, %0                  \n\t"\
-        "punpcklbw %%mm0, %%mm3            \n\t"\
-        "punpcklbw %%mm0, %%mm4            \n\t"\
-        "punpcklbw %%mm0, %%mm1            \n\t"\
-        "punpcklbw %%mm0, %%mm2            \n\t"\
-        "paddw     %%mm1, %%mm3            \n\t"\
-        "paddw     %%mm2, %%mm4            \n\t"\
-        "movd      0(%0,%3), %%mm1         \n\t"\
-        "movd      4(%0,%3), %%mm2         \n\t"\
-        "pmullw    %%mm6, %%mm3            \n\t" /* 0,9,9,0*/\
-        "pmullw    %%mm6, %%mm4            \n\t" /* 0,9,9,0*/\
-        "punpcklbw %%mm0, %%mm1            \n\t"\
-        "punpcklbw %%mm0, %%mm2            \n\t"\
-        "psubw     %%mm1, %%mm3            \n\t" /*-1,9,9,0*/\
-        "psubw     %%mm2, %%mm4            \n\t" /*-1,9,9,0*/\
-        "movd      0(%0,%2), %%mm1         \n\t"\
-        "movd      4(%0,%2), %%mm2         \n\t"\
-        "punpcklbw %%mm0, %%mm1            \n\t"\
-        "punpcklbw %%mm0, %%mm2            \n\t"\
-        "psubw     %%mm1, %%mm3            \n\t" /*-1,9,9,-1*/\
-        "psubw     %%mm2, %%mm4            \n\t" /*-1,9,9,-1*/\
-        NORMALIZE_MMX("$4")\
-        "packuswb  %%mm4, %%mm3            \n\t"\
-        OP((%1), %%mm3)\
-        "movq      %%mm3, (%1)             \n\t"\
-        "add       %6, %0                  \n\t"\
-        "add       %4, %1                  \n\t"\
-        "dec       %%"REG_c"               \n\t"\
-        "jnz 1b                            \n\t"\
-        : "+r"(src),  "+r"(dst)\
-        : "r"(offset), "r"(-2*offset), "g"(stride), "m"(rnd),\
-          "g"(stride-offset)\
-        : "%"REG_c, "memory"\
-    );\
-}
-
-VC1_SHIFT2(OP_PUT, put_)
-VC1_SHIFT2(OP_AVG, avg_)
-
-/**
- * Filter coefficients made global to allow access by all 1 or 3 quarter shift
- * interpolation functions.
- */
-DECLARE_ASM_CONST(16, uint64_t, ff_pw_53) = 0x0035003500350035ULL;
-DECLARE_ASM_CONST(16, uint64_t, ff_pw_18) = 0x0012001200120012ULL;
-
-/**
- * Core of the 1/4 and 3/4 shift bicubic interpolation.
- *
- * @param UNPACK  Macro unpacking arguments from 8 to 16bits (can be empty).
- * @param MOVQ    "movd 1" or "movq 2", if data read is already unpacked.
- * @param A1      Address of 1st tap (beware of unpacked/packed).
- * @param A2      Address of 2nd tap
- * @param A3      Address of 3rd tap
- * @param A4      Address of 4th tap
- */
-#define MSPEL_FILTER13_CORE(UNPACK, MOVQ, A1, A2, A3, A4)       \
-     MOVQ "*0+"A1", %%mm1       \n\t"                           \
-     MOVQ "*4+"A1", %%mm2       \n\t"                           \
-     UNPACK("%%mm1")                                            \
-     UNPACK("%%mm2")                                            \
-     "pmullw    "MANGLE(ff_pw_3)", %%mm1\n\t"                   \
-     "pmullw    "MANGLE(ff_pw_3)", %%mm2\n\t"                   \
-     MOVQ "*0+"A2", %%mm3       \n\t"                           \
-     MOVQ "*4+"A2", %%mm4       \n\t"                           \
-     UNPACK("%%mm3")                                            \
-     UNPACK("%%mm4")                                            \
-     "pmullw    %%mm6, %%mm3    \n\t" /* *18 */                 \
-     "pmullw    %%mm6, %%mm4    \n\t" /* *18 */                 \
-     "psubw     %%mm1, %%mm3    \n\t" /* 18,-3 */               \
-     "psubw     %%mm2, %%mm4    \n\t" /* 18,-3 */               \
-     MOVQ "*0+"A4", %%mm1       \n\t"                           \
-     MOVQ "*4+"A4", %%mm2       \n\t"                           \
-     UNPACK("%%mm1")                                            \
-     UNPACK("%%mm2")                                            \
-     "psllw     $2, %%mm1       \n\t" /* 4* */                  \
-     "psllw     $2, %%mm2       \n\t" /* 4* */                  \
-     "psubw     %%mm1, %%mm3    \n\t" /* -4,18,-3 */            \
-     "psubw     %%mm2, %%mm4    \n\t" /* -4,18,-3 */            \
-     MOVQ "*0+"A3", %%mm1       \n\t"                           \
-     MOVQ "*4+"A3", %%mm2       \n\t"                           \
-     UNPACK("%%mm1")                                            \
-     UNPACK("%%mm2")                                            \
-     "pmullw    %%mm5, %%mm1    \n\t" /* *53 */                 \
-     "pmullw    %%mm5, %%mm2    \n\t" /* *53 */                 \
-     "paddw     %%mm1, %%mm3    \n\t" /* 4,53,18,-3 */          \
-     "paddw     %%mm2, %%mm4    \n\t" /* 4,53,18,-3 */
-
-/**
- * Macro to build the vertical 16bits version of vc1_put_shift[13].
- * Here, offset=src_stride. Parameters passed A1 to A4 must use
- * %3 (src_stride) and %4 (3*src_stride).
- *
- * @param  NAME   Either 1 or 3
- * @see MSPEL_FILTER13_CORE for information on A1->A4
- */
-#define MSPEL_FILTER13_VER_16B(NAME, A1, A2, A3, A4)                    \
-static void                                                             \
-vc1_put_ver_16b_ ## NAME ## _mmx(int16_t *dst, const uint8_t *src,      \
-                                 x86_reg src_stride,                   \
-                                 int rnd, int64_t shift)                \
-{                                                                       \
-    int h = 8;                                                          \
-    src -= src_stride;                                                  \
-    __asm__ volatile(                                                       \
-        LOAD_ROUNDER_MMX("%5")                                          \
-        "movq      "MANGLE(ff_pw_53)", %%mm5\n\t"                       \
-        "movq      "MANGLE(ff_pw_18)", %%mm6\n\t"                       \
-        ASMALIGN(3)                                                     \
-        "1:                        \n\t"                                \
-        MSPEL_FILTER13_CORE(DO_UNPACK, "movd  1", A1, A2, A3, A4)       \
-        NORMALIZE_MMX("%6")                                             \
-        TRANSFER_DONT_PACK(OP_PUT)                                      \
-        /* Last 3 (in fact 4) bytes on the line */                      \
-        "movd      8+"A1", %%mm1   \n\t"                                \
-        DO_UNPACK("%%mm1")                                              \
-        "movq      %%mm1, %%mm3    \n\t"                                \
-        "paddw     %%mm1, %%mm1    \n\t"                                \
-        "paddw     %%mm3, %%mm1    \n\t" /* 3* */                       \
-        "movd      8+"A2", %%mm3   \n\t"                                \
-        DO_UNPACK("%%mm3")                                              \
-        "pmullw    %%mm6, %%mm3    \n\t" /* *18 */                      \
-        "psubw     %%mm1, %%mm3    \n\t" /*18,-3 */                     \
-        "movd      8+"A3", %%mm1   \n\t"                                \
-        DO_UNPACK("%%mm1")                                              \
-        "pmullw    %%mm5, %%mm1    \n\t" /* *53 */                      \
-        "paddw     %%mm1, %%mm3    \n\t" /*53,18,-3 */                  \
-        "movd      8+"A4", %%mm1   \n\t"                                \
-        DO_UNPACK("%%mm1")                                              \
-        "psllw     $2, %%mm1       \n\t" /* 4* */                       \
-        "psubw     %%mm1, %%mm3    \n\t"                                \
-        "paddw     %%mm7, %%mm3    \n\t"                                \
-        "psraw     %6, %%mm3       \n\t"                                \
-        "movq      %%mm3, 16(%2)   \n\t"                                \
-        "add       %3, %1          \n\t"                                \
-        "add       $24, %2         \n\t"                                \
-        "decl      %0              \n\t"                                \
-        "jnz 1b                    \n\t"                                \
-        : "+r"(h), "+r" (src),  "+r" (dst)                              \
-        : "r"(src_stride), "r"(3*src_stride),                           \
-          "m"(rnd), "m"(shift)                                          \
-        : "memory"                                                      \
-    );                                                                  \
-}
-
-/**
- * Macro to build the horizontal 16bits version of vc1_put_shift[13].
- * Here, offset=16bits, so parameters passed A1 to A4 should be simple.
- *
- * @param  NAME   Either 1 or 3
- * @see MSPEL_FILTER13_CORE for information on A1->A4
- */
-#define MSPEL_FILTER13_HOR_16B(NAME, A1, A2, A3, A4, OP, OPNAME)        \
-static void                                                             \
-OPNAME ## vc1_hor_16b_ ## NAME ## _mmx(uint8_t *dst, x86_reg stride,    \
-                                 const int16_t *src, int rnd)           \
-{                                                                       \
-    int h = 8;                                                          \
-    src -= 1;                                                           \
-    rnd -= (-4+58+13-3)*256; /* Add -256 bias */                        \
-    __asm__ volatile(                                                       \
-        LOAD_ROUNDER_MMX("%4")                                          \
-        "movq      "MANGLE(ff_pw_18)", %%mm6   \n\t"                    \
-        "movq      "MANGLE(ff_pw_53)", %%mm5   \n\t"                    \
-        ASMALIGN(3)                                                     \
-        "1:                        \n\t"                                \
-        MSPEL_FILTER13_CORE(DONT_UNPACK, "movq 2", A1, A2, A3, A4)      \
-        NORMALIZE_MMX("$7")                                             \
-        /* Remove bias */                                               \
-        "paddw     "MANGLE(ff_pw_128)", %%mm3  \n\t"                    \
-        "paddw     "MANGLE(ff_pw_128)", %%mm4  \n\t"                    \
-        TRANSFER_DO_PACK(OP)                                            \
-        "add       $24, %1         \n\t"                                \
-        "add       %3, %2          \n\t"                                \
-        "decl      %0              \n\t"                                \
-        "jnz 1b                    \n\t"                                \
-        : "+r"(h), "+r" (src),  "+r" (dst)                              \
-        : "r"(stride), "m"(rnd)                                         \
-        : "memory"                                                      \
-    );                                                                  \
-}
-
-/**
- * Macro to build the 8bits, any direction, version of vc1_put_shift[13].
- * Here, offset=src_stride. Parameters passed A1 to A4 must use
- * %3 (offset) and %4 (3*offset).
- *
- * @param  NAME   Either 1 or 3
- * @see MSPEL_FILTER13_CORE for information on A1->A4
- */
-#define MSPEL_FILTER13_8B(NAME, A1, A2, A3, A4, OP, OPNAME)             \
-static void                                                             \
-OPNAME ## vc1_## NAME ## _mmx(uint8_t *dst, const uint8_t *src,         \
-                        x86_reg stride, int rnd, x86_reg offset)      \
-{                                                                       \
-    int h = 8;                                                          \
-    src -= offset;                                                      \
-    rnd = 32-rnd;                                                       \
-    __asm__ volatile (                                                      \
-        LOAD_ROUNDER_MMX("%6")                                          \
-        "movq      "MANGLE(ff_pw_53)", %%mm5       \n\t"                \
-        "movq      "MANGLE(ff_pw_18)", %%mm6       \n\t"                \
-        ASMALIGN(3)                                                     \
-        "1:                        \n\t"                                \
-        MSPEL_FILTER13_CORE(DO_UNPACK, "movd   1", A1, A2, A3, A4)      \
-        NORMALIZE_MMX("$6")                                             \
-        TRANSFER_DO_PACK(OP)                                            \
-        "add       %5, %1          \n\t"                                \
-        "add       %5, %2          \n\t"                                \
-        "decl      %0              \n\t"                                \
-        "jnz 1b                    \n\t"                                \
-        : "+r"(h), "+r" (src),  "+r" (dst)                              \
-        : "r"(offset), "r"(3*offset), "g"(stride), "m"(rnd)             \
-        : "memory"                                                      \
-    );                                                                  \
-}
-
-/** 1/4 shift bicubic interpolation */
-MSPEL_FILTER13_8B     (shift1, "0(%1,%4  )", "0(%1,%3,2)", "0(%1,%3  )", "0(%1     )", OP_PUT, put_)
-MSPEL_FILTER13_8B     (shift1, "0(%1,%4  )", "0(%1,%3,2)", "0(%1,%3  )", "0(%1     )", OP_AVG, avg_)
-MSPEL_FILTER13_VER_16B(shift1, "0(%1,%4  )", "0(%1,%3,2)", "0(%1,%3  )", "0(%1     )")
-MSPEL_FILTER13_HOR_16B(shift1, "2*3(%1)", "2*2(%1)", "2*1(%1)", "2*0(%1)", OP_PUT, put_)
-MSPEL_FILTER13_HOR_16B(shift1, "2*3(%1)", "2*2(%1)", "2*1(%1)", "2*0(%1)", OP_AVG, avg_)
-
-/** 3/4 shift bicubic interpolation */
-MSPEL_FILTER13_8B     (shift3, "0(%1     )", "0(%1,%3  )", "0(%1,%3,2)", "0(%1,%4  )", OP_PUT, put_)
-MSPEL_FILTER13_8B     (shift3, "0(%1     )", "0(%1,%3  )", "0(%1,%3,2)", "0(%1,%4  )", OP_AVG, avg_)
-MSPEL_FILTER13_VER_16B(shift3, "0(%1     )", "0(%1,%3  )", "0(%1,%3,2)", "0(%1,%4  )")
-MSPEL_FILTER13_HOR_16B(shift3, "2*0(%1)", "2*1(%1)", "2*2(%1)", "2*3(%1)", OP_PUT, put_)
-MSPEL_FILTER13_HOR_16B(shift3, "2*0(%1)", "2*1(%1)", "2*2(%1)", "2*3(%1)", OP_AVG, avg_)
-
-typedef void (*vc1_mspel_mc_filter_ver_16bits)(int16_t *dst, const uint8_t *src, x86_reg src_stride, int rnd, int64_t shift);
-typedef void (*vc1_mspel_mc_filter_hor_16bits)(uint8_t *dst, x86_reg dst_stride, const int16_t *src, int rnd);
-typedef void (*vc1_mspel_mc_filter_8bits)(uint8_t *dst, const uint8_t *src, x86_reg stride, int rnd, x86_reg offset);
-
-/**
- * Interpolates fractional pel values by applying proper vertical then
- * horizontal filter.
- *
- * @param  dst     Destination buffer for interpolated pels.
- * @param  src     Source buffer.
- * @param  stride  Stride for both src and dst buffers.
- * @param  hmode   Horizontal filter (expressed in quarter pixels shift).
- * @param  hmode   Vertical filter.
- * @param  rnd     Rounding bias.
- */
-#define VC1_MSPEL_MC(OP)\
-static void OP ## vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride,\
-                               int hmode, int vmode, int rnd)\
-{\
-    static const vc1_mspel_mc_filter_ver_16bits vc1_put_shift_ver_16bits[] =\
-         { NULL, vc1_put_ver_16b_shift1_mmx, vc1_put_ver_16b_shift2_mmx, vc1_put_ver_16b_shift3_mmx };\
-    static const vc1_mspel_mc_filter_hor_16bits vc1_put_shift_hor_16bits[] =\
-         { NULL, OP ## vc1_hor_16b_shift1_mmx, OP ## vc1_hor_16b_shift2_mmx, OP ## vc1_hor_16b_shift3_mmx };\
-    static const vc1_mspel_mc_filter_8bits vc1_put_shift_8bits[] =\
-         { NULL, OP ## vc1_shift1_mmx, OP ## vc1_shift2_mmx, OP ## vc1_shift3_mmx };\
-\
-    __asm__ volatile(\
-        "pxor %%mm0, %%mm0         \n\t"\
-        ::: "memory"\
-    );\
-\
-    if (vmode) { /* Vertical filter to apply */\
-        if (hmode) { /* Horizontal filter to apply, output to tmp */\
-            static const int shift_value[] = { 0, 5, 1, 5 };\
-            int              shift = (shift_value[hmode]+shift_value[vmode])>>1;\
-            int              r;\
-            DECLARE_ALIGNED(16, int16_t, tmp)[12*8];\
-\
-            r = (1<<(shift-1)) + rnd-1;\
-            vc1_put_shift_ver_16bits[vmode](tmp, src-1, stride, r, shift);\
-\
-            vc1_put_shift_hor_16bits[hmode](dst, stride, tmp+1, 64-rnd);\
-            return;\
-        }\
-        else { /* No horizontal filter, output 8 lines to dst */\
-            vc1_put_shift_8bits[vmode](dst, src, stride, 1-rnd, stride);\
-            return;\
-        }\
-    }\
-\
-    /* Horizontal mode with no vertical mode */\
-    vc1_put_shift_8bits[hmode](dst, src, stride, rnd, 1);\
-}
-
-VC1_MSPEL_MC(put_)
-VC1_MSPEL_MC(avg_)
-
-/** Macro to ease bicubic filter interpolation functions declarations */
-#define DECLARE_FUNCTION(a, b)                                          \
-static void put_vc1_mspel_mc ## a ## b ## _mmx(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
-     put_vc1_mspel_mc(dst, src, stride, a, b, rnd);                     \
-}\
-static void avg_vc1_mspel_mc ## a ## b ## _mmx2(uint8_t *dst, const uint8_t *src, int stride, int rnd) { \
-     avg_vc1_mspel_mc(dst, src, stride, a, b, rnd);                     \
-}
-
-DECLARE_FUNCTION(0, 1)
-DECLARE_FUNCTION(0, 2)
-DECLARE_FUNCTION(0, 3)
-
-DECLARE_FUNCTION(1, 0)
-DECLARE_FUNCTION(1, 1)
-DECLARE_FUNCTION(1, 2)
-DECLARE_FUNCTION(1, 3)
-
-DECLARE_FUNCTION(2, 0)
-DECLARE_FUNCTION(2, 1)
-DECLARE_FUNCTION(2, 2)
-DECLARE_FUNCTION(2, 3)
-
-DECLARE_FUNCTION(3, 0)
-DECLARE_FUNCTION(3, 1)
-DECLARE_FUNCTION(3, 2)
-DECLARE_FUNCTION(3, 3)
-
-static void vc1_inv_trans_4x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int dc = block[0];
-    dc = (17 * dc +  4) >> 3;
-    dc = (17 * dc + 64) >> 7;
-    __asm__ volatile(
-        "movd          %0, %%mm0 \n\t"
-        "pshufw $0, %%mm0, %%mm0 \n\t"
-        "pxor       %%mm1, %%mm1 \n\t"
-        "psubw      %%mm0, %%mm1 \n\t"
-        "packuswb   %%mm0, %%mm0 \n\t"
-        "packuswb   %%mm1, %%mm1 \n\t"
-        ::"r"(dc)
-    );
-    __asm__ volatile(
-        "movd          %0, %%mm2 \n\t"
-        "movd          %1, %%mm3 \n\t"
-        "movd          %2, %%mm4 \n\t"
-        "movd          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movd       %%mm2, %0    \n\t"
-        "movd       %%mm3, %1    \n\t"
-        "movd       %%mm4, %2    \n\t"
-        "movd       %%mm5, %3    \n\t"
-        :"+m"(*(uint32_t*)(dest+0*linesize)),
-         "+m"(*(uint32_t*)(dest+1*linesize)),
-         "+m"(*(uint32_t*)(dest+2*linesize)),
-         "+m"(*(uint32_t*)(dest+3*linesize))
-    );
-}
-
-static void vc1_inv_trans_4x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int dc = block[0];
-    dc = (17 * dc +  4) >> 3;
-    dc = (12 * dc + 64) >> 7;
-    __asm__ volatile(
-        "movd          %0, %%mm0 \n\t"
-        "pshufw $0, %%mm0, %%mm0 \n\t"
-        "pxor       %%mm1, %%mm1 \n\t"
-        "psubw      %%mm0, %%mm1 \n\t"
-        "packuswb   %%mm0, %%mm0 \n\t"
-        "packuswb   %%mm1, %%mm1 \n\t"
-        ::"r"(dc)
-    );
-    __asm__ volatile(
-        "movd          %0, %%mm2 \n\t"
-        "movd          %1, %%mm3 \n\t"
-        "movd          %2, %%mm4 \n\t"
-        "movd          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movd       %%mm2, %0    \n\t"
-        "movd       %%mm3, %1    \n\t"
-        "movd       %%mm4, %2    \n\t"
-        "movd       %%mm5, %3    \n\t"
-        :"+m"(*(uint32_t*)(dest+0*linesize)),
-         "+m"(*(uint32_t*)(dest+1*linesize)),
-         "+m"(*(uint32_t*)(dest+2*linesize)),
-         "+m"(*(uint32_t*)(dest+3*linesize))
-    );
-    dest += 4*linesize;
-    __asm__ volatile(
-        "movd          %0, %%mm2 \n\t"
-        "movd          %1, %%mm3 \n\t"
-        "movd          %2, %%mm4 \n\t"
-        "movd          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movd       %%mm2, %0    \n\t"
-        "movd       %%mm3, %1    \n\t"
-        "movd       %%mm4, %2    \n\t"
-        "movd       %%mm5, %3    \n\t"
-        :"+m"(*(uint32_t*)(dest+0*linesize)),
-         "+m"(*(uint32_t*)(dest+1*linesize)),
-         "+m"(*(uint32_t*)(dest+2*linesize)),
-         "+m"(*(uint32_t*)(dest+3*linesize))
-    );
-}
-
-static void vc1_inv_trans_8x4_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int dc = block[0];
-    dc = ( 3 * dc +  1) >> 1;
-    dc = (17 * dc + 64) >> 7;
-    __asm__ volatile(
-        "movd          %0, %%mm0 \n\t"
-        "pshufw $0, %%mm0, %%mm0 \n\t"
-        "pxor       %%mm1, %%mm1 \n\t"
-        "psubw      %%mm0, %%mm1 \n\t"
-        "packuswb   %%mm0, %%mm0 \n\t"
-        "packuswb   %%mm1, %%mm1 \n\t"
-        ::"r"(dc)
-    );
-    __asm__ volatile(
-        "movq          %0, %%mm2 \n\t"
-        "movq          %1, %%mm3 \n\t"
-        "movq          %2, %%mm4 \n\t"
-        "movq          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movq       %%mm2, %0    \n\t"
-        "movq       %%mm3, %1    \n\t"
-        "movq       %%mm4, %2    \n\t"
-        "movq       %%mm5, %3    \n\t"
-        :"+m"(*(uint32_t*)(dest+0*linesize)),
-         "+m"(*(uint32_t*)(dest+1*linesize)),
-         "+m"(*(uint32_t*)(dest+2*linesize)),
-         "+m"(*(uint32_t*)(dest+3*linesize))
-    );
-}
-
-static void vc1_inv_trans_8x8_dc_mmx2(uint8_t *dest, int linesize, DCTELEM *block)
-{
-    int dc = block[0];
-    dc = (3 * dc +  1) >> 1;
-    dc = (3 * dc + 16) >> 5;
-    __asm__ volatile(
-        "movd          %0, %%mm0 \n\t"
-        "pshufw $0, %%mm0, %%mm0 \n\t"
-        "pxor       %%mm1, %%mm1 \n\t"
-        "psubw      %%mm0, %%mm1 \n\t"
-        "packuswb   %%mm0, %%mm0 \n\t"
-        "packuswb   %%mm1, %%mm1 \n\t"
-        ::"r"(dc)
-    );
-    __asm__ volatile(
-        "movq          %0, %%mm2 \n\t"
-        "movq          %1, %%mm3 \n\t"
-        "movq          %2, %%mm4 \n\t"
-        "movq          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movq       %%mm2, %0    \n\t"
-        "movq       %%mm3, %1    \n\t"
-        "movq       %%mm4, %2    \n\t"
-        "movq       %%mm5, %3    \n\t"
-        :"+m"(*(uint32_t*)(dest+0*linesize)),
-         "+m"(*(uint32_t*)(dest+1*linesize)),
-         "+m"(*(uint32_t*)(dest+2*linesize)),
-         "+m"(*(uint32_t*)(dest+3*linesize))
-    );
-    dest += 4*linesize;
-    __asm__ volatile(
-        "movq          %0, %%mm2 \n\t"
-        "movq          %1, %%mm3 \n\t"
-        "movq          %2, %%mm4 \n\t"
-        "movq          %3, %%mm5 \n\t"
-        "paddusb    %%mm0, %%mm2 \n\t"
-        "paddusb    %%mm0, %%mm3 \n\t"
-        "paddusb    %%mm0, %%mm4 \n\t"
-        "paddusb    %%mm0, %%mm5 \n\t"
-        "psubusb    %%mm1, %%mm2 \n\t"
-        "psubusb    %%mm1, %%mm3 \n\t"
-        "psubusb    %%mm1, %%mm4 \n\t"
-        "psubusb    %%mm1, %%mm5 \n\t"
-        "movq       %%mm2, %0    \n\t"
-        "movq       %%mm3, %1    \n\t"
-        "movq       %%mm4, %2    \n\t"
-        "movq       %%mm5, %3    \n\t"
-        :"+m"(*(uint32_t*)(dest+0*linesize)),
-         "+m"(*(uint32_t*)(dest+1*linesize)),
-         "+m"(*(uint32_t*)(dest+2*linesize)),
-         "+m"(*(uint32_t*)(dest+3*linesize))
-    );
-}
-
-void ff_vc1dsp_init_mmx(DSPContext* dsp, AVCodecContext *avctx) {
-    mm_flags = mm_support();
-
-    dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx;
-    dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx;
-
-    dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx;
-    dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx;
-
-    dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx;
-    dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx;
-    dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx;
-
-    dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx;
-    dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx;
-    dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx;
-    dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx;
-
-    if (mm_flags & FF_MM_MMX2){
-        dsp->avg_vc1_mspel_pixels_tab[ 0] = ff_avg_vc1_mspel_mc00_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmx2;
-
-        dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmx2;
-
-        dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmx2;
-
-        dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmx2;
-        dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmx2;
-
-        dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmx2;
-        dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmx2;
-        dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmx2;
-        dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmx2;
-    }
-}
diff --git a/libavcodec/x86/vp3dsp_mmx.c b/libavcodec/x86/vp3dsp_mmx.c
deleted file mode 100644
index 44a8477..0000000
--- a/libavcodec/x86/vp3dsp_mmx.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (C) 2004 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MMX-optimized functions cribbed from the original VP3 source code.
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-#include "vp3dsp_mmx.h"
-
-extern const uint16_t ff_vp3_idct_data[];
-
-// this is off by one or two for some cases when filter_limit is greater than 63
-// in:  p0 in mm6, p1 in mm4, p2 in mm2, p3 in mm1
-// out: p1 in mm4, p2 in mm3
-#define VP3_LOOP_FILTER(flim) \
-    "movq       %%mm6, %%mm7 \n\t" \
-    "pand    "MANGLE(ff_pb_7 )", %%mm6 \n\t" /* p0&7 */ \
-    "psrlw         $3, %%mm7 \n\t" \
-    "pand    "MANGLE(ff_pb_1F)", %%mm7 \n\t" /* p0>>3 */ \
-    "movq       %%mm2, %%mm3 \n\t" /* mm3 = p2 */ \
-    "pxor       %%mm4, %%mm2 \n\t" \
-    "pand    "MANGLE(ff_pb_1 )", %%mm2 \n\t" /* (p2^p1)&1 */ \
-    "movq       %%mm2, %%mm5 \n\t" \
-    "paddb      %%mm2, %%mm2 \n\t" \
-    "paddb      %%mm5, %%mm2 \n\t" /* 3*(p2^p1)&1 */ \
-    "paddb      %%mm6, %%mm2 \n\t" /* extra bits lost in shifts */ \
-    "pcmpeqb    %%mm0, %%mm0 \n\t" \
-    "pxor       %%mm0, %%mm1 \n\t" /* 255 - p3 */ \
-    "pavgb      %%mm2, %%mm1 \n\t" /* (256 - p3 + extrabits) >> 1 */ \
-    "pxor       %%mm4, %%mm0 \n\t" /* 255 - p1 */ \
-    "pavgb      %%mm3, %%mm0 \n\t" /* (256 + p2-p1) >> 1 */ \
-    "paddb   "MANGLE(ff_pb_3 )", %%mm1 \n\t" \
-    "pavgb      %%mm0, %%mm1 \n\t" /* 128+2+(   p2-p1  - p3) >> 2 */ \
-    "pavgb      %%mm0, %%mm1 \n\t" /* 128+1+(3*(p2-p1) - p3) >> 3 */ \
-    "paddusb    %%mm1, %%mm7 \n\t" /* d+128+1 */ \
-    "movq    "MANGLE(ff_pb_81)", %%mm6 \n\t" \
-    "psubusb    %%mm7, %%mm6 \n\t" \
-    "psubusb "MANGLE(ff_pb_81)", %%mm7 \n\t" \
-\
-    "movq     "#flim", %%mm5 \n\t" \
-    "pminub     %%mm5, %%mm6 \n\t" \
-    "pminub     %%mm5, %%mm7 \n\t" \
-    "movq       %%mm6, %%mm0 \n\t" \
-    "movq       %%mm7, %%mm1 \n\t" \
-    "paddb      %%mm6, %%mm6 \n\t" \
-    "paddb      %%mm7, %%mm7 \n\t" \
-    "pminub     %%mm5, %%mm6 \n\t" \
-    "pminub     %%mm5, %%mm7 \n\t" \
-    "psubb      %%mm0, %%mm6 \n\t" \
-    "psubb      %%mm1, %%mm7 \n\t" \
-    "paddusb    %%mm7, %%mm4 \n\t" \
-    "psubusb    %%mm6, %%mm4 \n\t" \
-    "psubusb    %%mm7, %%mm3 \n\t" \
-    "paddusb    %%mm6, %%mm3 \n\t"
-
-#define STORE_4_WORDS(dst0, dst1, dst2, dst3, mm) \
-    "movd "#mm", %0        \n\t" \
-    "movw   %w0, -1"#dst0" \n\t" \
-    "psrlq  $32, "#mm"     \n\t" \
-    "shr    $16, %0        \n\t" \
-    "movw   %w0, -1"#dst1" \n\t" \
-    "movd "#mm", %0        \n\t" \
-    "movw   %w0, -1"#dst2" \n\t" \
-    "shr    $16, %0        \n\t" \
-    "movw   %w0, -1"#dst3" \n\t"
-
-void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values)
-{
-    __asm__ volatile(
-        "movq          %0, %%mm6 \n\t"
-        "movq          %1, %%mm4 \n\t"
-        "movq          %2, %%mm2 \n\t"
-        "movq          %3, %%mm1 \n\t"
-
-        VP3_LOOP_FILTER(%4)
-
-        "movq       %%mm4, %1    \n\t"
-        "movq       %%mm3, %2    \n\t"
-
-        : "+m" (*(uint64_t*)(src - 2*stride)),
-          "+m" (*(uint64_t*)(src - 1*stride)),
-          "+m" (*(uint64_t*)(src + 0*stride)),
-          "+m" (*(uint64_t*)(src + 1*stride))
-        : "m"(*(uint64_t*)(bounding_values+129))
-    );
-}
-
-void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values)
-{
-    x86_reg tmp;
-
-    __asm__ volatile(
-        "movd -2(%1),      %%mm6 \n\t"
-        "movd -2(%1,%3),   %%mm0 \n\t"
-        "movd -2(%1,%3,2), %%mm1 \n\t"
-        "movd -2(%1,%4),   %%mm4 \n\t"
-
-        TRANSPOSE8x4(%%mm6, %%mm0, %%mm1, %%mm4, -2(%2), -2(%2,%3), -2(%2,%3,2), -2(%2,%4), %%mm2)
-        VP3_LOOP_FILTER(%5)
-        SBUTTERFLY(%%mm4, %%mm3, %%mm5, bw, q)
-
-        STORE_4_WORDS((%1), (%1,%3), (%1,%3,2), (%1,%4), %%mm4)
-        STORE_4_WORDS((%2), (%2,%3), (%2,%3,2), (%2,%4), %%mm5)
-
-        : "=&r"(tmp)
-        : "r"(src), "r"(src+4*stride), "r"((x86_reg)stride), "r"((x86_reg)3*stride),
-          "m"(*(uint64_t*)(bounding_values+129))
-        : "memory"
-    );
-}
-
-/* from original comments: The Macro does IDct on 4 1-D Dcts */
-#define BeginIDCT() \
-    "movq   "I(3)", %%mm2 \n\t" \
-    "movq   "C(3)", %%mm6 \n\t" \
-    "movq    %%mm2, %%mm4 \n\t" \
-    "movq   "J(5)", %%mm7 \n\t" \
-    "pmulhw  %%mm6, %%mm4 \n\t"    /* r4 = c3*i3 - i3 */ \
-    "movq   "C(5)", %%mm1 \n\t" \
-    "pmulhw  %%mm7, %%mm6 \n\t"    /* r6 = c3*i5 - i5 */ \
-    "movq    %%mm1, %%mm5 \n\t" \
-    "pmulhw  %%mm2, %%mm1 \n\t"    /* r1 = c5*i3 - i3 */ \
-    "movq   "I(1)", %%mm3 \n\t" \
-    "pmulhw  %%mm7, %%mm5 \n\t"    /* r5 = c5*i5 - i5 */ \
-    "movq   "C(1)", %%mm0 \n\t" \
-    "paddw   %%mm2, %%mm4 \n\t"    /* r4 = c3*i3 */ \
-    "paddw   %%mm7, %%mm6 \n\t"    /* r6 = c3*i5 */ \
-    "paddw   %%mm1, %%mm2 \n\t"    /* r2 = c5*i3 */ \
-    "movq   "J(7)", %%mm1 \n\t" \
-    "paddw   %%mm5, %%mm7 \n\t"    /* r7 = c5*i5 */ \
-    "movq    %%mm0, %%mm5 \n\t"    /* r5 = c1 */ \
-    "pmulhw  %%mm3, %%mm0 \n\t"    /* r0 = c1*i1 - i1 */ \
-    "paddsw  %%mm7, %%mm4 \n\t"    /* r4 = C = c3*i3 + c5*i5 */ \
-    "pmulhw  %%mm1, %%mm5 \n\t"    /* r5 = c1*i7 - i7 */ \
-    "movq   "C(7)", %%mm7 \n\t" \
-    "psubsw  %%mm2, %%mm6 \n\t"    /* r6 = D = c3*i5 - c5*i3 */ \
-    "paddw   %%mm3, %%mm0 \n\t"    /* r0 = c1*i1 */ \
-    "pmulhw  %%mm7, %%mm3 \n\t"    /* r3 = c7*i1 */ \
-    "movq   "I(2)", %%mm2 \n\t" \
-    "pmulhw  %%mm1, %%mm7 \n\t"    /* r7 = c7*i7 */ \
-    "paddw   %%mm1, %%mm5 \n\t"    /* r5 = c1*i7 */ \
-    "movq    %%mm2, %%mm1 \n\t"    /* r1 = i2 */ \
-    "pmulhw "C(2)", %%mm2 \n\t"    /* r2 = c2*i2 - i2 */ \
-    "psubsw  %%mm5, %%mm3 \n\t"    /* r3 = B = c7*i1 - c1*i7 */ \
-    "movq   "J(6)", %%mm5 \n\t" \
-    "paddsw  %%mm7, %%mm0 \n\t"    /* r0 = A = c1*i1 + c7*i7 */ \
-    "movq    %%mm5, %%mm7 \n\t"    /* r7 = i6 */ \
-    "psubsw  %%mm4, %%mm0 \n\t"    /* r0 = A - C */ \
-    "pmulhw "C(2)", %%mm5 \n\t"    /* r5 = c2*i6 - i6 */ \
-    "paddw   %%mm1, %%mm2 \n\t"    /* r2 = c2*i2 */ \
-    "pmulhw "C(6)", %%mm1 \n\t"    /* r1 = c6*i2 */ \
-    "paddsw  %%mm4, %%mm4 \n\t"    /* r4 = C + C */ \
-    "paddsw  %%mm0, %%mm4 \n\t"    /* r4 = C. = A + C */ \
-    "psubsw  %%mm6, %%mm3 \n\t"    /* r3 = B - D */ \
-    "paddw   %%mm7, %%mm5 \n\t"    /* r5 = c2*i6 */ \
-    "paddsw  %%mm6, %%mm6 \n\t"    /* r6 = D + D */ \
-    "pmulhw "C(6)", %%mm7 \n\t"    /* r7 = c6*i6 */ \
-    "paddsw  %%mm3, %%mm6 \n\t"    /* r6 = D. = B + D */ \
-    "movq    %%mm4, "I(1)"\n\t"    /* save C. at I(1) */ \
-    "psubsw  %%mm5, %%mm1 \n\t"    /* r1 = H = c6*i2 - c2*i6 */ \
-    "movq   "C(4)", %%mm4 \n\t" \
-    "movq    %%mm3, %%mm5 \n\t"    /* r5 = B - D */ \
-    "pmulhw  %%mm4, %%mm3 \n\t"    /* r3 = (c4 - 1) * (B - D) */ \
-    "paddsw  %%mm2, %%mm7 \n\t"    /* r3 = (c4 - 1) * (B - D) */ \
-    "movq    %%mm6, "I(2)"\n\t"    /* save D. at I(2) */ \
-    "movq    %%mm0, %%mm2 \n\t"    /* r2 = A - C */ \
-    "movq   "I(0)", %%mm6 \n\t" \
-    "pmulhw  %%mm4, %%mm0 \n\t"    /* r0 = (c4 - 1) * (A - C) */ \
-    "paddw   %%mm3, %%mm5 \n\t"    /* r5 = B. = c4 * (B - D) */ \
-    "movq   "J(4)", %%mm3 \n\t" \
-    "psubsw  %%mm1, %%mm5 \n\t"    /* r5 = B.. = B. - H */ \
-    "paddw   %%mm0, %%mm2 \n\t"    /* r0 = A. = c4 * (A - C) */ \
-    "psubsw  %%mm3, %%mm6 \n\t"    /* r6 = i0 - i4 */ \
-    "movq    %%mm6, %%mm0 \n\t" \
-    "pmulhw  %%mm4, %%mm6 \n\t"    /* r6 = (c4 - 1) * (i0 - i4) */ \
-    "paddsw  %%mm3, %%mm3 \n\t"    /* r3 = i4 + i4 */ \
-    "paddsw  %%mm1, %%mm1 \n\t"    /* r1 = H + H */ \
-    "paddsw  %%mm0, %%mm3 \n\t"    /* r3 = i0 + i4 */ \
-    "paddsw  %%mm5, %%mm1 \n\t"    /* r1 = H. = B + H */ \
-    "pmulhw  %%mm3, %%mm4 \n\t"    /* r4 = (c4 - 1) * (i0 + i4) */ \
-    "paddsw  %%mm0, %%mm6 \n\t"    /* r6 = F = c4 * (i0 - i4) */ \
-    "psubsw  %%mm2, %%mm6 \n\t"    /* r6 = F. = F - A. */ \
-    "paddsw  %%mm2, %%mm2 \n\t"    /* r2 = A. + A. */ \
-    "movq   "I(1)", %%mm0 \n\t"    /* r0 = C. */ \
-    "paddsw  %%mm6, %%mm2 \n\t"    /* r2 = A.. = F + A. */ \
-    "paddw   %%mm3, %%mm4 \n\t"    /* r4 = E = c4 * (i0 + i4) */ \
-    "psubsw  %%mm1, %%mm2 \n\t"    /* r2 = R2 = A.. - H. */
-
-/* RowIDCT gets ready to transpose */
-#define RowIDCT() \
-    BeginIDCT() \
-    "movq   "I(2)", %%mm3 \n\t"    /* r3 = D. */ \
-    "psubsw  %%mm7, %%mm4 \n\t"    /* r4 = E. = E - G */ \
-    "paddsw  %%mm1, %%mm1 \n\t"    /* r1 = H. + H. */ \
-    "paddsw  %%mm7, %%mm7 \n\t"    /* r7 = G + G */ \
-    "paddsw  %%mm2, %%mm1 \n\t"    /* r1 = R1 = A.. + H. */ \
-    "paddsw  %%mm4, %%mm7 \n\t"    /* r1 = R1 = A.. + H. */ \
-    "psubsw  %%mm3, %%mm4 \n\t"    /* r4 = R4 = E. - D. */ \
-    "paddsw  %%mm3, %%mm3 \n\t" \
-    "psubsw  %%mm5, %%mm6 \n\t"    /* r6 = R6 = F. - B.. */ \
-    "paddsw  %%mm5, %%mm5 \n\t" \
-    "paddsw  %%mm4, %%mm3 \n\t"    /* r3 = R3 = E. + D. */ \
-    "paddsw  %%mm6, %%mm5 \n\t"    /* r5 = R5 = F. + B.. */ \
-    "psubsw  %%mm0, %%mm7 \n\t"    /* r7 = R7 = G. - C. */ \
-    "paddsw  %%mm0, %%mm0 \n\t" \
-    "movq    %%mm1, "I(1)"\n\t"    /* save R1 */ \
-    "paddsw  %%mm7, %%mm0 \n\t"    /* r0 = R0 = G. + C. */
-
-/* Column IDCT normalizes and stores final results */
-#define ColumnIDCT() \
-    BeginIDCT() \
-    "paddsw "OC_8", %%mm2 \n\t"    /* adjust R2 (and R1) for shift */ \
-    "paddsw  %%mm1, %%mm1 \n\t"    /* r1 = H. + H. */ \
-    "paddsw  %%mm2, %%mm1 \n\t"    /* r1 = R1 = A.. + H. */ \
-    "psraw      $4, %%mm2 \n\t"    /* r2 = NR2 */ \
-    "psubsw  %%mm7, %%mm4 \n\t"    /* r4 = E. = E - G */ \
-    "psraw      $4, %%mm1 \n\t"    /* r1 = NR1 */ \
-    "movq   "I(2)", %%mm3 \n\t"    /* r3 = D. */ \
-    "paddsw  %%mm7, %%mm7 \n\t"    /* r7 = G + G */ \
-    "movq    %%mm2, "I(2)"\n\t"    /* store NR2 at I2 */ \
-    "paddsw  %%mm4, %%mm7 \n\t"    /* r7 = G. = E + G */ \
-    "movq    %%mm1, "I(1)"\n\t"    /* store NR1 at I1 */ \
-    "psubsw  %%mm3, %%mm4 \n\t"    /* r4 = R4 = E. - D. */ \
-    "paddsw "OC_8", %%mm4 \n\t"    /* adjust R4 (and R3) for shift */ \
-    "paddsw  %%mm3, %%mm3 \n\t"    /* r3 = D. + D. */ \
-    "paddsw  %%mm4, %%mm3 \n\t"    /* r3 = R3 = E. + D. */ \
-    "psraw      $4, %%mm4 \n\t"    /* r4 = NR4 */ \
-    "psubsw  %%mm5, %%mm6 \n\t"    /* r6 = R6 = F. - B.. */ \
-    "psraw      $4, %%mm3 \n\t"    /* r3 = NR3 */ \
-    "paddsw "OC_8", %%mm6 \n\t"    /* adjust R6 (and R5) for shift */ \
-    "paddsw  %%mm5, %%mm5 \n\t"    /* r5 = B.. + B.. */ \
-    "paddsw  %%mm6, %%mm5 \n\t"    /* r5 = R5 = F. + B.. */ \
-    "psraw      $4, %%mm6 \n\t"    /* r6 = NR6 */ \
-    "movq    %%mm4, "J(4)"\n\t"    /* store NR4 at J4 */ \
-    "psraw      $4, %%mm5 \n\t"    /* r5 = NR5 */ \
-    "movq    %%mm3, "I(3)"\n\t"    /* store NR3 at I3 */ \
-    "psubsw  %%mm0, %%mm7 \n\t"    /* r7 = R7 = G. - C. */ \
-    "paddsw "OC_8", %%mm7 \n\t"    /* adjust R7 (and R0) for shift */ \
-    "paddsw  %%mm0, %%mm0 \n\t"    /* r0 = C. + C. */ \
-    "paddsw  %%mm7, %%mm0 \n\t"    /* r0 = R0 = G. + C. */ \
-    "psraw      $4, %%mm7 \n\t"    /* r7 = NR7 */ \
-    "movq    %%mm6, "J(6)"\n\t"    /* store NR6 at J6 */ \
-    "psraw      $4, %%mm0 \n\t"    /* r0 = NR0 */ \
-    "movq    %%mm5, "J(5)"\n\t"    /* store NR5 at J5 */ \
-    "movq    %%mm7, "J(7)"\n\t"    /* store NR7 at J7 */ \
-    "movq    %%mm0, "I(0)"\n\t"    /* store NR0 at I0 */
-
-/* Following macro does two 4x4 transposes in place.
-
-  At entry (we assume):
-
-    r0 = a3 a2 a1 a0
-    I(1) = b3 b2 b1 b0
-    r2 = c3 c2 c1 c0
-    r3 = d3 d2 d1 d0
-
-    r4 = e3 e2 e1 e0
-    r5 = f3 f2 f1 f0
-    r6 = g3 g2 g1 g0
-    r7 = h3 h2 h1 h0
-
-  At exit, we have:
-
-    I(0) = d0 c0 b0 a0
-    I(1) = d1 c1 b1 a1
-    I(2) = d2 c2 b2 a2
-    I(3) = d3 c3 b3 a3
-
-    J(4) = h0 g0 f0 e0
-    J(5) = h1 g1 f1 e1
-    J(6) = h2 g2 f2 e2
-    J(7) = h3 g3 f3 e3
-
-   I(0) I(1) I(2) I(3)  is the transpose of r0 I(1) r2 r3.
-   J(4) J(5) J(6) J(7)  is the transpose of r4 r5 r6 r7.
-
-   Since r1 is free at entry, we calculate the Js first. */
-#define Transpose() \
-    "movq       %%mm4, %%mm1 \n\t"    /* r1 = e3 e2 e1 e0 */ \
-    "punpcklwd  %%mm5, %%mm4 \n\t"    /* r4 = f1 e1 f0 e0 */ \
-    "movq       %%mm0, "I(0)"\n\t"    /* save a3 a2 a1 a0 */ \
-    "punpckhwd  %%mm5, %%mm1 \n\t"    /* r1 = f3 e3 f2 e2 */ \
-    "movq       %%mm6, %%mm0 \n\t"    /* r0 = g3 g2 g1 g0 */ \
-    "punpcklwd  %%mm7, %%mm6 \n\t"    /* r6 = h1 g1 h0 g0 */ \
-    "movq       %%mm4, %%mm5 \n\t"    /* r5 = f1 e1 f0 e0 */ \
-    "punpckldq  %%mm6, %%mm4 \n\t"    /* r4 = h0 g0 f0 e0 = R4 */ \
-    "punpckhdq  %%mm6, %%mm5 \n\t"    /* r5 = h1 g1 f1 e1 = R5 */ \
-    "movq       %%mm1, %%mm6 \n\t"    /* r6 = f3 e3 f2 e2 */ \
-    "movq       %%mm4, "J(4)"\n\t" \
-    "punpckhwd  %%mm7, %%mm0 \n\t"    /* r0 = h3 g3 h2 g2 */ \
-    "movq       %%mm5, "J(5)"\n\t" \
-    "punpckhdq  %%mm0, %%mm6 \n\t"    /* r6 = h3 g3 f3 e3 = R7 */ \
-    "movq      "I(0)", %%mm4 \n\t"    /* r4 = a3 a2 a1 a0 */ \
-    "punpckldq  %%mm0, %%mm1 \n\t"    /* r1 = h2 g2 f2 e2 = R6 */ \
-    "movq      "I(1)", %%mm5 \n\t"    /* r5 = b3 b2 b1 b0 */ \
-    "movq       %%mm4, %%mm0 \n\t"    /* r0 = a3 a2 a1 a0 */ \
-    "movq       %%mm6, "J(7)"\n\t" \
-    "punpcklwd  %%mm5, %%mm0 \n\t"    /* r0 = b1 a1 b0 a0 */ \
-    "movq       %%mm1, "J(6)"\n\t" \
-    "punpckhwd  %%mm5, %%mm4 \n\t"    /* r4 = b3 a3 b2 a2 */ \
-    "movq       %%mm2, %%mm5 \n\t"    /* r5 = c3 c2 c1 c0 */ \
-    "punpcklwd  %%mm3, %%mm2 \n\t"    /* r2 = d1 c1 d0 c0 */ \
-    "movq       %%mm0, %%mm1 \n\t"    /* r1 = b1 a1 b0 a0 */ \
-    "punpckldq  %%mm2, %%mm0 \n\t"    /* r0 = d0 c0 b0 a0 = R0 */ \
-    "punpckhdq  %%mm2, %%mm1 \n\t"    /* r1 = d1 c1 b1 a1 = R1 */ \
-    "movq       %%mm4, %%mm2 \n\t"    /* r2 = b3 a3 b2 a2 */ \
-    "movq       %%mm0, "I(0)"\n\t" \
-    "punpckhwd  %%mm3, %%mm5 \n\t"    /* r5 = d3 c3 d2 c2 */ \
-    "movq       %%mm1, "I(1)"\n\t" \
-    "punpckhdq  %%mm5, %%mm4 \n\t"    /* r4 = d3 c3 b3 a3 = R3 */ \
-    "punpckldq  %%mm5, %%mm2 \n\t"    /* r2 = d2 c2 b2 a2 = R2 */ \
-    "movq       %%mm4, "I(3)"\n\t" \
-    "movq       %%mm2, "I(2)"\n\t"
-
-void ff_vp3_idct_mmx(int16_t *output_data)
-{
-    /* eax = quantized input
-     * ebx = dequantizer matrix
-     * ecx = IDCT constants
-     *  M(I) = ecx + MaskOffset(0) + I * 8
-     *  C(I) = ecx + CosineOffset(32) + (I-1) * 8
-     * edx = output
-     * r0..r7 = mm0..mm7
-     */
-
-#define C(x) AV_STRINGIFY(16*(x-1))"(%1)"
-#define OC_8 "%2"
-
-    /* at this point, function has completed dequantization + dezigzag +
-     * partial transposition; now do the idct itself */
-#define I(x) AV_STRINGIFY(16* x       )"(%0)"
-#define J(x) AV_STRINGIFY(16*(x-4) + 8)"(%0)"
-
-    __asm__ volatile (
-        RowIDCT()
-        Transpose()
-
-#undef I
-#undef J
-#define I(x) AV_STRINGIFY(16* x    + 64)"(%0)"
-#define J(x) AV_STRINGIFY(16*(x-4) + 72)"(%0)"
-
-        RowIDCT()
-        Transpose()
-
-#undef I
-#undef J
-#define I(x) AV_STRINGIFY(16*x)"(%0)"
-#define J(x) AV_STRINGIFY(16*x)"(%0)"
-
-        ColumnIDCT()
-
-#undef I
-#undef J
-#define I(x) AV_STRINGIFY(16*x + 8)"(%0)"
-#define J(x) AV_STRINGIFY(16*x + 8)"(%0)"
-
-        ColumnIDCT()
-        :: "r"(output_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8)
-    );
-#undef I
-#undef J
-
-}
-
-void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_vp3_idct_mmx(block);
-    put_signed_pixels_clamped_mmx(block, dest, line_size);
-}
-
-void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_vp3_idct_mmx(block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
-
-void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int linesize, const DCTELEM *block)
-{
-    int dc = block[0];
-    dc = (46341*dc)>>16;
-    dc = (46341*dc + (8<<16))>>20;
-
-    __asm__ volatile(
-        "movd          %3, %%mm0 \n\t"
-        "pshufw $0, %%mm0, %%mm0 \n\t"
-        "pxor       %%mm1, %%mm1 \n\t"
-        "psubw      %%mm0, %%mm1 \n\t"
-        "packuswb   %%mm0, %%mm0 \n\t"
-        "packuswb   %%mm1, %%mm1 \n\t"
-
-#define DC_ADD \
-        "movq        (%0), %%mm2 \n\t" \
-        "movq     (%0,%1), %%mm3 \n\t" \
-        "paddusb    %%mm0, %%mm2 \n\t" \
-        "movq   (%0,%1,2), %%mm4 \n\t" \
-        "paddusb    %%mm0, %%mm3 \n\t" \
-        "movq     (%0,%2), %%mm5 \n\t" \
-        "paddusb    %%mm0, %%mm4 \n\t" \
-        "paddusb    %%mm0, %%mm5 \n\t" \
-        "psubusb    %%mm1, %%mm2 \n\t" \
-        "psubusb    %%mm1, %%mm3 \n\t" \
-        "movq       %%mm2, (%0)  \n\t" \
-        "psubusb    %%mm1, %%mm4 \n\t" \
-        "movq       %%mm3, (%0,%1) \n\t" \
-        "psubusb    %%mm1, %%mm5 \n\t" \
-        "movq       %%mm4, (%0,%1,2) \n\t" \
-        "movq       %%mm5, (%0,%2) \n\t"
-
-        DC_ADD
-        "lea    (%0,%1,4), %0 \n\t"
-        DC_ADD
-
-        : "+r"(dest)
-        : "r"((x86_reg)linesize), "r"((x86_reg)3*linesize), "r"(dc)
-    );
-}
diff --git a/libavcodec/x86/vp3dsp_mmx.h b/libavcodec/x86/vp3dsp_mmx.h
deleted file mode 100644
index e0ebf0b..0000000
--- a/libavcodec/x86/vp3dsp_mmx.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * vp3dsp MMX function declarations
- * Copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_X86_VP3DSP_MMX_H
-#define AVCODEC_X86_VP3DSP_MMX_H
-
-#include <stdint.h>
-#include "libavcodec/dsputil.h"
-
-void ff_vp3_idct_mmx(int16_t *data);
-void ff_vp3_idct_put_mmx(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_mmx(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_dc_add_mmx2(uint8_t *dest, int line_size, const DCTELEM *block);
-
-void ff_vp3_v_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
-void ff_vp3_h_loop_filter_mmx2(uint8_t *src, int stride, int *bounding_values);
-
-#endif /* AVCODEC_X86_VP3DSP_MMX_H */
diff --git a/libavcodec/x86/vp3dsp_sse2.c b/libavcodec/x86/vp3dsp_sse2.c
deleted file mode 100644
index e0ebd42..0000000
--- a/libavcodec/x86/vp3dsp_sse2.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2004 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * SSE2-optimized functions cribbed from the original VP3 source code.
- */
-
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-#include "vp3dsp_sse2.h"
-
-DECLARE_ALIGNED(16, const uint16_t, ff_vp3_idct_data)[7 * 8] =
-{
-    64277,64277,64277,64277,64277,64277,64277,64277,
-    60547,60547,60547,60547,60547,60547,60547,60547,
-    54491,54491,54491,54491,54491,54491,54491,54491,
-    46341,46341,46341,46341,46341,46341,46341,46341,
-    36410,36410,36410,36410,36410,36410,36410,36410,
-    25080,25080,25080,25080,25080,25080,25080,25080,
-    12785,12785,12785,12785,12785,12785,12785,12785
-};
-
-
-#define VP3_1D_IDCT_SSE2(ADD, SHIFT) \
-    "movdqa "I(3)", %%xmm2 \n\t"     /* xmm2 = i3 */ \
-    "movdqa "C(3)", %%xmm6 \n\t"     /* xmm6 = c3 */ \
-    "movdqa %%xmm2, %%xmm4 \n\t"     /* xmm4 = i3 */ \
-    "movdqa "I(5)", %%xmm7 \n\t"     /* xmm7 = i5 */ \
-    "pmulhw %%xmm6, %%xmm4 \n\t"     /* xmm4 = c3 * i3 - i3 */ \
-    "movdqa "C(5)", %%xmm1 \n\t"     /* xmm1 = c5 */ \
-    "pmulhw %%xmm7, %%xmm6 \n\t"     /* xmm6 = c3 * i5 - i5 */ \
-    "movdqa %%xmm1, %%xmm5 \n\t"     /* xmm5 = c5 */ \
-    "pmulhw %%xmm2, %%xmm1 \n\t"     /* xmm1 = c5 * i3 - i3 */ \
-    "movdqa "I(1)", %%xmm3 \n\t"     /* xmm3 = i1 */ \
-    "pmulhw %%xmm7, %%xmm5 \n\t"     /* xmm5 = c5 * i5 - i5 */ \
-    "movdqa "C(1)", %%xmm0 \n\t"     /* xmm0 = c1 */ \
-    "paddw  %%xmm2, %%xmm4 \n\t"     /* xmm4 = c3 * i3 */ \
-    "paddw  %%xmm7, %%xmm6 \n\t"     /* xmm6 = c3 * i5 */ \
-    "paddw  %%xmm1, %%xmm2 \n\t"     /* xmm2 = c5 * i3 */ \
-    "movdqa "I(7)", %%xmm1 \n\t"     /* xmm1 = i7 */ \
-    "paddw  %%xmm5, %%xmm7 \n\t"     /* xmm7 = c5 * i5 */ \
-    "movdqa %%xmm0, %%xmm5 \n\t"     /* xmm5 = c1 */ \
-    "pmulhw %%xmm3, %%xmm0 \n\t"     /* xmm0 = c1 * i1 - i1 */ \
-    "paddsw %%xmm7, %%xmm4 \n\t"     /* xmm4 = c3 * i3 + c5 * i5 = C */ \
-    "pmulhw %%xmm1, %%xmm5 \n\t"     /* xmm5 = c1 * i7 - i7 */ \
-    "movdqa "C(7)", %%xmm7 \n\t"     /* xmm7 = c7 */ \
-    "psubsw %%xmm2, %%xmm6 \n\t"     /* xmm6 = c3 * i5 - c5 * i3 = D */ \
-    "paddw  %%xmm3, %%xmm0 \n\t"     /* xmm0 = c1 * i1 */ \
-    "pmulhw %%xmm7, %%xmm3 \n\t"     /* xmm3 = c7 * i1 */ \
-    "movdqa "I(2)", %%xmm2 \n\t"     /* xmm2 = i2 */ \
-    "pmulhw %%xmm1, %%xmm7 \n\t"     /* xmm7 = c7 * i7 */ \
-    "paddw  %%xmm1, %%xmm5 \n\t"     /* xmm5 = c1 * i7 */ \
-    "movdqa %%xmm2, %%xmm1 \n\t"     /* xmm1 = i2 */ \
-    "pmulhw "C(2)", %%xmm2 \n\t"     /* xmm2 = i2 * c2 -i2 */ \
-    "psubsw %%xmm5, %%xmm3 \n\t"     /* xmm3 = c7 * i1 - c1 * i7 = B */ \
-    "movdqa "I(6)", %%xmm5 \n\t"     /* xmm5 = i6 */ \
-    "paddsw %%xmm7, %%xmm0 \n\t"     /* xmm0 = c1 * i1 + c7 * i7 = A */ \
-    "movdqa %%xmm5, %%xmm7 \n\t"     /* xmm7 = i6 */ \
-    "psubsw %%xmm4, %%xmm0 \n\t"     /* xmm0 = A - C */ \
-    "pmulhw "C(2)", %%xmm5 \n\t"     /* xmm5 = c2 * i6 - i6 */ \
-    "paddw  %%xmm1, %%xmm2 \n\t"     /* xmm2 = i2 * c2 */ \
-    "pmulhw "C(6)", %%xmm1 \n\t"     /* xmm1 = c6 * i2 */ \
-    "paddsw %%xmm4, %%xmm4 \n\t"     /* xmm4 = C + C */ \
-    "paddsw %%xmm0, %%xmm4 \n\t"     /* xmm4 = A + C = C. */ \
-    "psubsw %%xmm6, %%xmm3 \n\t"     /* xmm3 = B - D */ \
-    "paddw  %%xmm7, %%xmm5 \n\t"     /* xmm5 = c2 * i6 */ \
-    "paddsw %%xmm6, %%xmm6 \n\t"     /* xmm6 = D + D */ \
-    "pmulhw "C(6)", %%xmm7 \n\t"     /* xmm7 = c6 * i6 */ \
-    "paddsw %%xmm3, %%xmm6 \n\t"     /* xmm6 = B + D = D. */ \
-    "movdqa %%xmm4, "I(1)" \n\t"     /* Save C. at I(1) */ \
-    "psubsw %%xmm5, %%xmm1 \n\t"     /* xmm1 = c6 * i2 - c2 * i6 = H */ \
-    "movdqa "C(4)", %%xmm4 \n\t"     /* xmm4 = c4 */ \
-    "movdqa %%xmm3, %%xmm5 \n\t"     /* xmm5 = B - D */ \
-    "pmulhw %%xmm4, %%xmm3 \n\t"     /* xmm3 = ( c4 -1 ) * ( B - D ) */ \
-    "paddsw %%xmm2, %%xmm7 \n\t"     /* xmm7 = c2 * i2 + c6 * i6 = G */ \
-    "movdqa %%xmm6, "I(2)" \n\t"     /* Save D. at I(2) */ \
-    "movdqa %%xmm0, %%xmm2 \n\t"     /* xmm2 = A - C */ \
-    "movdqa "I(0)", %%xmm6 \n\t"     /* xmm6 = i0 */ \
-    "pmulhw %%xmm4, %%xmm0 \n\t"     /* xmm0 = ( c4 - 1 ) * ( A - C ) = A. */ \
-    "paddw  %%xmm3, %%xmm5 \n\t"     /* xmm5 = c4 * ( B - D ) = B. */ \
-    "movdqa "I(4)", %%xmm3 \n\t"     /* xmm3 = i4 */ \
-    "psubsw %%xmm1, %%xmm5 \n\t"     /* xmm5 = B. - H = B.. */ \
-    "paddw  %%xmm0, %%xmm2 \n\t"     /* xmm2 = c4 * ( A - C) = A. */ \
-    "psubsw %%xmm3, %%xmm6 \n\t"     /* xmm6 = i0 - i4 */ \
-    "movdqa %%xmm6, %%xmm0 \n\t"     /* xmm0 = i0 - i4 */ \
-    "pmulhw %%xmm4, %%xmm6 \n\t"     /* xmm6 = (c4 - 1) * (i0 - i4) = F */ \
-    "paddsw %%xmm3, %%xmm3 \n\t"     /* xmm3 = i4 + i4 */ \
-    "paddsw %%xmm1, %%xmm1 \n\t"     /* xmm1 = H + H */ \
-    "paddsw %%xmm0, %%xmm3 \n\t"     /* xmm3 = i0 + i4 */ \
-    "paddsw %%xmm5, %%xmm1 \n\t"     /* xmm1 = B. + H = H. */ \
-    "pmulhw %%xmm3, %%xmm4 \n\t"     /* xmm4 = ( c4 - 1 ) * ( i0 + i4 )  */ \
-    "paddw  %%xmm0, %%xmm6 \n\t"     /* xmm6 = c4 * ( i0 - i4 ) */ \
-    "psubsw %%xmm2, %%xmm6 \n\t"     /* xmm6 = F - A. = F. */ \
-    "paddsw %%xmm2, %%xmm2 \n\t"     /* xmm2 = A. + A. */ \
-    "movdqa "I(1)", %%xmm0 \n\t"     /* Load        C. from I(1) */ \
-    "paddsw %%xmm6, %%xmm2 \n\t"     /* xmm2 = F + A. = A.. */ \
-    "paddw  %%xmm3, %%xmm4 \n\t"     /* xmm4 = c4 * ( i0 + i4 ) = 3 */ \
-    "psubsw %%xmm1, %%xmm2 \n\t"     /* xmm2 = A.. - H. = R2 */ \
-    ADD(%%xmm2)                      /* Adjust R2 and R1 before shifting */ \
-    "paddsw %%xmm1, %%xmm1 \n\t"     /* xmm1 = H. + H. */ \
-    "paddsw %%xmm2, %%xmm1 \n\t"     /* xmm1 = A.. + H. = R1 */ \
-    SHIFT(%%xmm2)                    /* xmm2 = op2 */ \
-    "psubsw %%xmm7, %%xmm4 \n\t"     /* xmm4 = E - G = E. */ \
-    SHIFT(%%xmm1)                    /* xmm1 = op1 */ \
-    "movdqa "I(2)", %%xmm3 \n\t"     /* Load D. from I(2) */ \
-    "paddsw %%xmm7, %%xmm7 \n\t"     /* xmm7 = G + G */ \
-    "paddsw %%xmm4, %%xmm7 \n\t"     /* xmm7 = E + G = G. */ \
-    "psubsw %%xmm3, %%xmm4 \n\t"     /* xmm4 = E. - D. = R4 */ \
-    ADD(%%xmm4)                      /* Adjust R4 and R3 before shifting */ \
-    "paddsw %%xmm3, %%xmm3 \n\t"     /* xmm3 = D. + D. */ \
-    "paddsw %%xmm4, %%xmm3 \n\t"     /* xmm3 = E. + D. = R3 */ \
-    SHIFT(%%xmm4)                    /* xmm4 = op4 */ \
-    "psubsw %%xmm5, %%xmm6 \n\t"     /* xmm6 = F. - B..= R6 */ \
-    SHIFT(%%xmm3)                    /* xmm3 = op3 */ \
-    ADD(%%xmm6)                      /* Adjust R6 and R5 before shifting */ \
-    "paddsw %%xmm5, %%xmm5 \n\t"     /* xmm5 = B.. + B.. */ \
-    "paddsw %%xmm6, %%xmm5 \n\t"     /* xmm5 = F. + B.. = R5 */ \
-    SHIFT(%%xmm6)                    /* xmm6 = op6 */ \
-    SHIFT(%%xmm5)                    /* xmm5 = op5 */ \
-    "psubsw %%xmm0, %%xmm7 \n\t"     /* xmm7 = G. - C. = R7 */ \
-    ADD(%%xmm7)                      /* Adjust R7 and R0 before shifting */ \
-    "paddsw %%xmm0, %%xmm0 \n\t"     /* xmm0 = C. + C. */ \
-    "paddsw %%xmm7, %%xmm0 \n\t"     /* xmm0 = G. + C. */ \
-    SHIFT(%%xmm7)                    /* xmm7 = op7 */ \
-    SHIFT(%%xmm0)                    /* xmm0 = op0 */
-
-#define PUT_BLOCK(r0, r1, r2, r3, r4, r5, r6, r7) \
-    "movdqa " #r0 ", " O(0) "\n\t" \
-    "movdqa " #r1 ", " O(1) "\n\t" \
-    "movdqa " #r2 ", " O(2) "\n\t" \
-    "movdqa " #r3 ", " O(3) "\n\t" \
-    "movdqa " #r4 ", " O(4) "\n\t" \
-    "movdqa " #r5 ", " O(5) "\n\t" \
-    "movdqa " #r6 ", " O(6) "\n\t" \
-    "movdqa " #r7 ", " O(7) "\n\t"
-
-#define NOP(xmm)
-#define SHIFT4(xmm) "psraw  $4, "#xmm"\n\t"
-#define ADD8(xmm)   "paddsw %2, "#xmm"\n\t"
-
-void ff_vp3_idct_sse2(int16_t *input_data)
-{
-#define I(x) AV_STRINGIFY(16*x)"(%0)"
-#define O(x) I(x)
-#define C(x) AV_STRINGIFY(16*(x-1))"(%1)"
-
-    __asm__ volatile (
-        VP3_1D_IDCT_SSE2(NOP, NOP)
-
-        TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%0))
-        PUT_BLOCK(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1)
-
-        VP3_1D_IDCT_SSE2(ADD8, SHIFT4)
-        PUT_BLOCK(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)
-        :: "r"(input_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8)
-    );
-}
-
-void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_vp3_idct_sse2(block);
-    put_signed_pixels_clamped_mmx(block, dest, line_size);
-}
-
-void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block)
-{
-    ff_vp3_idct_sse2(block);
-    add_pixels_clamped_mmx(block, dest, line_size);
-}
diff --git a/libavcodec/x86/vp3dsp_sse2.h b/libavcodec/x86/vp3dsp_sse2.h
deleted file mode 100644
index 9094620..0000000
--- a/libavcodec/x86/vp3dsp_sse2.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * vp3dsp SSE2 function declarations
- * Copyright (c) 2007 Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_X86_VP3DSP_SSE2_H
-#define AVCODEC_X86_VP3DSP_SSE2_H
-
-#include "libavcodec/dsputil.h"
-
-void ff_vp3_idct_sse2(int16_t *input_data);
-void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block);
-void ff_vp3_idct_add_sse2(uint8_t *dest, int line_size, DCTELEM *block);
-
-#endif /* AVCODEC_X86_VP3DSP_SSE2_H */
diff --git a/libavcodec/x86/vp6dsp_mmx.c b/libavcodec/x86/vp6dsp_mmx.c
deleted file mode 100644
index 905b3a7..0000000
--- a/libavcodec/x86/vp6dsp_mmx.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @file
- * MMX-optimized functions for the VP6 decoder
- *
- * Copyright (C) 2009  Sebastien Lucas <sebastien.lucas at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-#include "vp6dsp_mmx.h"
-
-
-#define DIAG4_MMX(in1,in2,in3,in4)                                            \
-    "movq  "#in1"(%0), %%mm0             \n\t"                                \
-    "movq  "#in2"(%0), %%mm1             \n\t"                                \
-    "movq       %%mm0, %%mm3             \n\t"                                \
-    "movq       %%mm1, %%mm4             \n\t"                                \
-    "punpcklbw  %%mm7, %%mm0             \n\t"                                \
-    "punpcklbw  %%mm7, %%mm1             \n\t"                                \
-    "punpckhbw  %%mm7, %%mm3             \n\t"                                \
-    "punpckhbw  %%mm7, %%mm4             \n\t"                                \
-    "pmullw     0(%2), %%mm0             \n\t" /* src[x-8 ] * biweight [0] */ \
-    "pmullw     8(%2), %%mm1             \n\t" /* src[x   ] * biweight [1] */ \
-    "pmullw     0(%2), %%mm3             \n\t" /* src[x-8 ] * biweight [0] */ \
-    "pmullw     8(%2), %%mm4             \n\t" /* src[x   ] * biweight [1] */ \
-    "paddw      %%mm1, %%mm0             \n\t"                                \
-    "paddw      %%mm4, %%mm3             \n\t"                                \
-    "movq  "#in3"(%0), %%mm1             \n\t"                                \
-    "movq  "#in4"(%0), %%mm2             \n\t"                                \
-    "movq       %%mm1, %%mm4             \n\t"                                \
-    "movq       %%mm2, %%mm5             \n\t"                                \
-    "punpcklbw  %%mm7, %%mm1             \n\t"                                \
-    "punpcklbw  %%mm7, %%mm2             \n\t"                                \
-    "punpckhbw  %%mm7, %%mm4             \n\t"                                \
-    "punpckhbw  %%mm7, %%mm5             \n\t"                                \
-    "pmullw    16(%2), %%mm1             \n\t" /* src[x+8 ] * biweight [2] */ \
-    "pmullw    24(%2), %%mm2             \n\t" /* src[x+16] * biweight [3] */ \
-    "pmullw    16(%2), %%mm4             \n\t" /* src[x+8 ] * biweight [2] */ \
-    "pmullw    24(%2), %%mm5             \n\t" /* src[x+16] * biweight [3] */ \
-    "paddw      %%mm2, %%mm1             \n\t"                                \
-    "paddw      %%mm5, %%mm4             \n\t"                                \
-    "paddsw     %%mm1, %%mm0             \n\t"                                \
-    "paddsw     %%mm4, %%mm3             \n\t"                                \
-    "paddsw     %%mm6, %%mm0             \n\t" /* Add 64 */                   \
-    "paddsw     %%mm6, %%mm3             \n\t" /* Add 64 */                   \
-    "psraw         $7, %%mm0             \n\t"                                \
-    "psraw         $7, %%mm3             \n\t"                                \
-    "packuswb   %%mm3, %%mm0             \n\t"                                \
-    "movq       %%mm0,  (%1)             \n\t"
-
-void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride,
-                             const int16_t *h_weights, const int16_t *v_weights)
-{
-    uint8_t tmp[8*11], *t = tmp;
-    int16_t weights[4*4];
-    int i;
-    src -= stride;
-
-    for (i=0; i<4*4; i++)
-        weights[i] = h_weights[i>>2];
-
-    __asm__ volatile(
-    "pxor %%mm7, %%mm7                   \n\t"
-    "movq "MANGLE(ff_pw_64)", %%mm6      \n\t"
-    "1:                                  \n\t"
-    DIAG4_MMX(-1,0,1,2)
-    "add  $8, %1                         \n\t"
-    "add  %3, %0                         \n\t"
-    "decl %4                             \n\t"
-    "jnz 1b                              \n\t"
-    : "+r"(src), "+r"(t)
-    : "r"(weights), "r"((x86_reg)stride), "r"(11)
-    : "memory");
-
-    t = tmp + 8;
-    for (i=0; i<4*4; i++)
-        weights[i] = v_weights[i>>2];
-
-    __asm__ volatile(
-    "pxor %%mm7, %%mm7                   \n\t"
-    "movq "MANGLE(ff_pw_64)", %%mm6      \n\t"
-    "1:                                  \n\t"
-    DIAG4_MMX(-8,0,8,16)
-    "add  $8, %0                         \n\t"
-    "add  %3, %1                         \n\t"
-    "decl %4                             \n\t"
-    "jnz 1b                              \n\t"
-    : "+r"(t), "+r"(dst)
-    : "r"(weights), "r"((x86_reg)stride), "r"(8)
-    : "memory");
-}
diff --git a/libavcodec/x86/vp6dsp_mmx.h b/libavcodec/x86/vp6dsp_mmx.h
deleted file mode 100644
index 743bc43..0000000
--- a/libavcodec/x86/vp6dsp_mmx.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * vp6dsp MMX function declarations
- * Copyright (c) 2009  Sebastien Lucas <sebastien.lucas at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_X86_VP6DSP_MMX_H
-#define AVCODEC_X86_VP6DSP_MMX_H
-
-#include <stdint.h>
-
-void ff_vp6_filter_diag4_mmx(uint8_t *dst, uint8_t *src, int stride,
-                             const int16_t *h_weights,const int16_t *v_weights);
-
-#endif /* AVCODEC_X86_VP6DSP_MMX_H */
diff --git a/libavcodec/x86/vp6dsp_sse2.c b/libavcodec/x86/vp6dsp_sse2.c
deleted file mode 100644
index bfd733a..0000000
--- a/libavcodec/x86/vp6dsp_sse2.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * @file
- * SSE2-optimized functions for the VP6 decoder
- *
- * Copyright (C) 2009  Zuxy Meng <zuxy.meng at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/x86_cpu.h"
-#include "libavcodec/dsputil.h"
-#include "dsputil_mmx.h"
-#include "vp6dsp_sse2.h"
-
-#define DIAG4_SSE2(in1,in2,in3,in4)                                           \
-    "movq  "#in1"(%0), %%xmm0            \n\t"                                \
-    "movq  "#in2"(%0), %%xmm1            \n\t"                                \
-    "punpcklbw %%xmm7, %%xmm0            \n\t"                                \
-    "punpcklbw %%xmm7, %%xmm1            \n\t"                                \
-    "pmullw    %%xmm4, %%xmm0            \n\t" /* src[x-8 ] * biweight [0] */ \
-    "pmullw    %%xmm5, %%xmm1            \n\t" /* src[x   ] * biweight [1] */ \
-    "paddw     %%xmm1, %%xmm0            \n\t"                                \
-    "movq  "#in3"(%0), %%xmm1            \n\t"                                \
-    "movq  "#in4"(%0), %%xmm2            \n\t"                                \
-    "punpcklbw %%xmm7, %%xmm1            \n\t"                                \
-    "punpcklbw %%xmm7, %%xmm2            \n\t"                                \
-    "pmullw    %%xmm6, %%xmm1            \n\t" /* src[x+8 ] * biweight [2] */ \
-    "pmullw    %%xmm3, %%xmm2            \n\t" /* src[x+16] * biweight [3] */ \
-    "paddw     %%xmm2, %%xmm1            \n\t"                                \
-    "paddsw     %%xmm1, %%xmm0           \n\t"                                \
-    "paddsw "MANGLE(ff_pw_64)", %%xmm0   \n\t" /* Add 64 */                   \
-    "psraw         $7, %%xmm0            \n\t"                                \
-    "packuswb  %%xmm0, %%xmm0            \n\t"                                \
-    "movq      %%xmm0,   (%1)            \n\t"                                \
-
-void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
-                              const int16_t *h_weights,const int16_t *v_weights)
-{
-    uint8_t tmp[8*11], *t = tmp;
-    src -= stride;
-
-    __asm__ volatile(
-    "pxor           %%xmm7, %%xmm7       \n\t"
-    "movq               %4, %%xmm3       \n\t"
-    "pshuflw    $0, %%xmm3, %%xmm4       \n\t"
-    "punpcklqdq     %%xmm4, %%xmm4       \n\t"
-    "pshuflw   $85, %%xmm3, %%xmm5       \n\t"
-    "punpcklqdq     %%xmm5, %%xmm5       \n\t"
-    "pshuflw  $170, %%xmm3, %%xmm6       \n\t"
-    "punpcklqdq     %%xmm6, %%xmm6       \n\t"
-    "pshuflw  $255, %%xmm3, %%xmm3       \n\t"
-    "punpcklqdq     %%xmm3, %%xmm3       \n\t"
-    "1:                                  \n\t"
-    DIAG4_SSE2(-1,0,1,2)
-    "add  $8, %1                         \n\t"
-    "add  %2, %0                         \n\t"
-    "decl %3                             \n\t"
-    "jnz 1b                              \n\t"
-    : "+r"(src), "+r"(t)
-    : "g"((x86_reg)stride), "r"(11), "m"(*(const int64_t*)h_weights)
-    : "memory");
-
-    t = tmp + 8;
-
-    __asm__ volatile(
-    "movq               %4, %%xmm3       \n\t"
-    "pshuflw    $0, %%xmm3, %%xmm4       \n\t"
-    "punpcklqdq     %%xmm4, %%xmm4       \n\t"
-    "pshuflw   $85, %%xmm3, %%xmm5       \n\t"
-    "punpcklqdq     %%xmm5, %%xmm5       \n\t"
-    "pshuflw  $170, %%xmm3, %%xmm6       \n\t"
-    "punpcklqdq     %%xmm6, %%xmm6       \n\t"
-    "pshuflw  $255, %%xmm3, %%xmm3       \n\t"
-    "punpcklqdq     %%xmm3, %%xmm3       \n\t"
-    "1:                                  \n\t"
-    DIAG4_SSE2(-8,0,8,16)
-    "add  $8, %0                         \n\t"
-    "add  %2, %1                         \n\t"
-    "decl %3                             \n\t"
-    "jnz 1b                              \n\t"
-    : "+r"(t), "+r"(dst)
-    : "g"((x86_reg)stride), "r"(8), "m"(*(const int64_t*)v_weights)
-    : "memory");
-}
diff --git a/libavcodec/x86/vp6dsp_sse2.h b/libavcodec/x86/vp6dsp_sse2.h
deleted file mode 100644
index a30089a..0000000
--- a/libavcodec/x86/vp6dsp_sse2.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * vp6dsp SSE2 function declarations
- * Copyright (c) 2009  Zuxy Meng <zuxy.meng at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_X86_VP6DSP_SSE2_H
-#define AVCODEC_X86_VP6DSP_SSE2_H
-
-#include <stdint.h>
-
-void ff_vp6_filter_diag4_sse2(uint8_t *dst, uint8_t *src, int stride,
-                             const int16_t *h_weights,const int16_t *v_weights);
-
-#endif /* AVCODEC_X86_VP6DSP_SSE2_H */
diff --git a/libavcodec/x86/x86inc.asm b/libavcodec/x86/x86inc.asm
deleted file mode 100644
index c29ef3e..0000000
--- a/libavcodec/x86/x86inc.asm
+++ /dev/null
@@ -1,625 +0,0 @@
-;*****************************************************************************
-;* x86inc.asm
-;*****************************************************************************
-;* Copyright (C) 2005-2008 Loren Merritt <lorenm at u.washington.edu>
-;*
-;* This file is part of FFmpeg.
-;*
-;* FFmpeg 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.
-;*
-;* FFmpeg 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 FFmpeg; if not, write to the Free Software
-;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-;*****************************************************************************
-
-%ifdef ARCH_X86_64
-    %ifidn __OUTPUT_FORMAT__,win32
-        %define WIN64
-    %else
-        %define UNIX64
-    %endif
-%endif
-
-; FIXME: All of the 64bit asm functions that take a stride as an argument
-; via register, assume that the high dword of that register is filled with 0.
-; This is true in practice (since we never do any 64bit arithmetic on strides,
-; and x264's strides are all positive), but is not guaranteed by the ABI.
-
-; Name of the .rodata section.
-; Kludge: Something on OS X fails to align .rodata even given an align attribute,
-; so use a different read-only section.
-%macro SECTION_RODATA 0-1 16
-    %ifidn __OUTPUT_FORMAT__,macho64
-        SECTION .text align=%1
-    %elifidn __OUTPUT_FORMAT__,macho
-        SECTION .text align=%1
-        fakegot:
-    %else
-        SECTION .rodata align=%1
-    %endif
-%endmacro
-
-; PIC support macros.
-; x86_64 can't fit 64bit address literals in most instruction types,
-; so shared objects (under the assumption that they might be anywhere
-; in memory) must use an address mode that does fit.
-; So all accesses to global variables must use this macro, e.g.
-;     mov eax, [foo GLOBAL]
-; instead of
-;     mov eax, [foo]
-;
-; x86_32 doesn't require PIC.
-; Some distros prefer shared objects to be PIC, but nothing breaks if
-; the code contains a few textrels, so we'll skip that complexity.
-
-%ifdef WIN64
-    %define PIC
-%elifndef ARCH_X86_64
-    %undef PIC
-%endif
-%ifdef PIC
-    %define GLOBAL wrt rip
-%else
-    %define GLOBAL
-%endif
-
-; Macros to eliminate most code duplication between x86_32 and x86_64:
-; Currently this works only for leaf functions which load all their arguments
-; into registers at the start, and make no other use of the stack. Luckily that
-; covers most of x264's asm.
-
-; PROLOGUE:
-; %1 = number of arguments. loads them from stack if needed.
-; %2 = number of registers used. pushes callee-saved regs if needed.
-; %3 = number of xmm registers used. pushes callee-saved xmm regs if needed.
-; %4 = list of names to define to registers
-; PROLOGUE can also be invoked by adding the same options to cglobal
-
-; e.g.
-; cglobal foo, 2,3,0, dst, src, tmp
-; declares a function (foo), taking two args (dst and src) and one local variable (tmp)
-
-; TODO Some functions can use some args directly from the stack. If they're the
-; last args then you can just not declare them, but if they're in the middle
-; we need more flexible macro.
-
-; RET:
-; Pops anything that was pushed by PROLOGUE
-
-; REP_RET:
-; Same, but if it doesn't pop anything it becomes a 2-byte ret, for athlons
-; which are slow when a normal ret follows a branch.
-
-; registers:
-; rN and rNq are the native-size register holding function argument N
-; rNd, rNw, rNb are dword, word, and byte size
-; rNm is the original location of arg N (a register or on the stack), dword
-; rNmp is native size
-
-%macro DECLARE_REG 6
-    %define r%1q %2
-    %define r%1d %3
-    %define r%1w %4
-    %define r%1b %5
-    %define r%1m %6
-    %ifid %6 ; i.e. it's a register
-        %define r%1mp %2
-    %elifdef ARCH_X86_64 ; memory
-        %define r%1mp qword %6
-    %else
-        %define r%1mp dword %6
-    %endif
-    %define r%1  %2
-%endmacro
-
-%macro DECLARE_REG_SIZE 2
-    %define r%1q r%1
-    %define e%1q r%1
-    %define r%1d e%1
-    %define e%1d e%1
-    %define r%1w %1
-    %define e%1w %1
-    %define r%1b %2
-    %define e%1b %2
-%ifndef ARCH_X86_64
-    %define r%1  e%1
-%endif
-%endmacro
-
-DECLARE_REG_SIZE ax, al
-DECLARE_REG_SIZE bx, bl
-DECLARE_REG_SIZE cx, cl
-DECLARE_REG_SIZE dx, dl
-DECLARE_REG_SIZE si, sil
-DECLARE_REG_SIZE di, dil
-DECLARE_REG_SIZE bp, bpl
-
-; t# defines for when per-arch register allocation is more complex than just function arguments
-
-%macro DECLARE_REG_TMP 1-*
-    %assign %%i 0
-    %rep %0
-        CAT_XDEFINE t, %%i, r%1
-        %assign %%i %%i+1
-        %rotate 1
-    %endrep
-%endmacro
-
-%macro DECLARE_REG_TMP_SIZE 0-*
-    %rep %0
-        %define t%1q t%1 %+ q
-        %define t%1d t%1 %+ d
-        %define t%1w t%1 %+ w
-        %define t%1b t%1 %+ b
-        %rotate 1
-    %endrep
-%endmacro
-
-DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7
-
-%ifdef ARCH_X86_64
-    %define gprsize 8
-%else
-    %define gprsize 4
-%endif
-
-%macro PUSH 1
-    push %1
-    %assign stack_offset stack_offset+gprsize
-%endmacro
-
-%macro POP 1
-    pop %1
-    %assign stack_offset stack_offset-gprsize
-%endmacro
-
-%macro SUB 2
-    sub %1, %2
-    %ifidn %1, rsp
-        %assign stack_offset stack_offset+(%2)
-    %endif
-%endmacro
-
-%macro ADD 2
-    add %1, %2
-    %ifidn %1, rsp
-        %assign stack_offset stack_offset-(%2)
-    %endif
-%endmacro
-
-%macro movifnidn 2
-    %ifnidn %1, %2
-        mov %1, %2
-    %endif
-%endmacro
-
-%macro movsxdifnidn 2
-    %ifnidn %1, %2
-        movsxd %1, %2
-    %endif
-%endmacro
-
-%macro ASSERT 1
-    %if (%1) == 0
-        %error assert failed
-    %endif
-%endmacro
-
-%macro DEFINE_ARGS 0-*
-    %ifdef n_arg_names
-        %assign %%i 0
-        %rep n_arg_names
-            CAT_UNDEF arg_name %+ %%i, q
-            CAT_UNDEF arg_name %+ %%i, d
-            CAT_UNDEF arg_name %+ %%i, w
-            CAT_UNDEF arg_name %+ %%i, b
-            CAT_UNDEF arg_name %+ %%i, m
-            CAT_UNDEF arg_name, %%i
-            %assign %%i %%i+1
-        %endrep
-    %endif
-
-    %assign %%i 0
-    %rep %0
-        %xdefine %1q r %+ %%i %+ q
-        %xdefine %1d r %+ %%i %+ d
-        %xdefine %1w r %+ %%i %+ w
-        %xdefine %1b r %+ %%i %+ b
-        %xdefine %1m r %+ %%i %+ m
-        CAT_XDEFINE arg_name, %%i, %1
-        %assign %%i %%i+1
-        %rotate 1
-    %endrep
-    %assign n_arg_names %%i
-%endmacro
-
-%ifdef WIN64 ; Windows x64 ;=================================================
-
-DECLARE_REG 0, rcx, ecx, cx,  cl,  ecx
-DECLARE_REG 1, rdx, edx, dx,  dl,  edx
-DECLARE_REG 2, r8,  r8d, r8w, r8b, r8d
-DECLARE_REG 3, r9,  r9d, r9w, r9b, r9d
-DECLARE_REG 4, rdi, edi, di,  dil, [rsp + stack_offset + 40]
-DECLARE_REG 5, rsi, esi, si,  sil, [rsp + stack_offset + 48]
-DECLARE_REG 6, rax, eax, ax,  al,  [rsp + stack_offset + 56]
-%define r7m [rsp + stack_offset + 64]
-%define r8m [rsp + stack_offset + 72]
-
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
-    %if %1 < %2
-        mov r%1, [rsp + stack_offset + 8 + %1*8]
-    %endif
-%endmacro
-
-%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
-    ASSERT %2 >= %1
-    %assign regs_used %2
-    ASSERT regs_used <= 7
-    %if %0 > 2
-        %assign xmm_regs_used %3
-    %else
-        %assign xmm_regs_used 0
-    %endif
-    ASSERT xmm_regs_used <= 16
-    %if regs_used > 4
-        push r4
-        push r5
-        %assign stack_offset stack_offset+16
-    %endif
-    %if xmm_regs_used > 6
-        sub rsp, (xmm_regs_used-6)*16+16
-        %assign stack_offset stack_offset+(xmm_regs_used-6)*16+16
-        %assign %%i xmm_regs_used
-        %rep (xmm_regs_used-6)
-            %assign %%i %%i-1
-            movdqa [rsp + (%%i-6)*16+8], xmm %+ %%i
-        %endrep
-    %endif
-    LOAD_IF_USED 4, %1
-    LOAD_IF_USED 5, %1
-    LOAD_IF_USED 6, %1
-    DEFINE_ARGS %4
-%endmacro
-
-%macro RESTORE_XMM_INTERNAL 1
-    %if xmm_regs_used > 6
-        %assign %%i xmm_regs_used
-        %rep (xmm_regs_used-6)
-            %assign %%i %%i-1
-            movdqa xmm %+ %%i, [%1 + (%%i-6)*16+8]
-        %endrep
-        add %1, (xmm_regs_used-6)*16+16
-    %endif
-%endmacro
-
-%macro RESTORE_XMM 1
-    RESTORE_XMM_INTERNAL %1
-    %assign stack_offset stack_offset-(xmm_regs_used-6)*16+16
-    %assign xmm_regs_used 0
-%endmacro
-
-%macro RET 0
-    RESTORE_XMM_INTERNAL rsp
-    %if regs_used > 4
-        pop r5
-        pop r4
-    %endif
-    ret
-%endmacro
-
-%macro REP_RET 0
-    %if regs_used > 4 || xmm_regs_used > 6
-        RET
-    %else
-        rep ret
-    %endif
-%endmacro
-
-%elifdef ARCH_X86_64 ; *nix x64 ;=============================================
-
-DECLARE_REG 0, rdi, edi, di,  dil, edi
-DECLARE_REG 1, rsi, esi, si,  sil, esi
-DECLARE_REG 2, rdx, edx, dx,  dl,  edx
-DECLARE_REG 3, rcx, ecx, cx,  cl,  ecx
-DECLARE_REG 4, r8,  r8d, r8w, r8b, r8d
-DECLARE_REG 5, r9,  r9d, r9w, r9b, r9d
-DECLARE_REG 6, rax, eax, ax,  al,  [rsp + stack_offset + 8]
-%define r7m [rsp + stack_offset + 16]
-%define r8m [rsp + stack_offset + 24]
-
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
-    %if %1 < %2
-        mov r%1, [rsp - 40 + %1*8]
-    %endif
-%endmacro
-
-%macro PROLOGUE 2-4+ ; #args, #regs, #xmm_regs, arg_names...
-    ASSERT %2 >= %1
-    ASSERT %2 <= 7
-    LOAD_IF_USED 6, %1
-    DEFINE_ARGS %4
-%endmacro
-
-%macro RET 0
-    ret
-%endmacro
-
-%macro REP_RET 0
-    rep ret
-%endmacro
-
-%else ; X86_32 ;==============================================================
-
-DECLARE_REG 0, eax, eax, ax, al,   [esp + stack_offset + 4]
-DECLARE_REG 1, ecx, ecx, cx, cl,   [esp + stack_offset + 8]
-DECLARE_REG 2, edx, edx, dx, dl,   [esp + stack_offset + 12]
-DECLARE_REG 3, ebx, ebx, bx, bl,   [esp + stack_offset + 16]
-DECLARE_REG 4, esi, esi, si, null, [esp + stack_offset + 20]
-DECLARE_REG 5, edi, edi, di, null, [esp + stack_offset + 24]
-DECLARE_REG 6, ebp, ebp, bp, null, [esp + stack_offset + 28]
-%define r7m [esp + stack_offset + 32]
-%define r8m [esp + stack_offset + 36]
-%define rsp esp
-
-%macro PUSH_IF_USED 1 ; reg_id
-    %if %1 < regs_used
-        push r%1
-        %assign stack_offset stack_offset+4
-    %endif
-%endmacro
-
-%macro POP_IF_USED 1 ; reg_id
-    %if %1 < regs_used
-        pop r%1
-    %endif
-%endmacro
-
-%macro LOAD_IF_USED 2 ; reg_id, number_of_args
-    %if %1 < %2
-        mov r%1, [esp + stack_offset + 4 + %1*4]
-    %endif
-%endmacro
-
-%macro PROLOGUE 2-4+ ; #args, #regs, arg_names...
-    ASSERT %2 >= %1
-    %assign regs_used %2
-    ASSERT regs_used <= 7
-    PUSH_IF_USED 3
-    PUSH_IF_USED 4
-    PUSH_IF_USED 5
-    PUSH_IF_USED 6
-    LOAD_IF_USED 0, %1
-    LOAD_IF_USED 1, %1
-    LOAD_IF_USED 2, %1
-    LOAD_IF_USED 3, %1
-    LOAD_IF_USED 4, %1
-    LOAD_IF_USED 5, %1
-    LOAD_IF_USED 6, %1
-    DEFINE_ARGS %4
-%endmacro
-
-%macro RET 0
-    POP_IF_USED 6
-    POP_IF_USED 5
-    POP_IF_USED 4
-    POP_IF_USED 3
-    ret
-%endmacro
-
-%macro REP_RET 0
-    %if regs_used > 3
-        RET
-    %else
-        rep ret
-    %endif
-%endmacro
-
-%endif ;======================================================================
-
-
-
-;=============================================================================
-; arch-independent part
-;=============================================================================
-
-%assign function_align 16
-
-; Symbol prefix for C linkage
-%macro cglobal 1-2+
-    %xdefine %1 ff_%1
-    %ifdef PREFIX
-        %xdefine %1 _ %+ %1
-    %endif
-    %xdefine %1.skip_prologue %1 %+ .skip_prologue
-    %ifidn __OUTPUT_FORMAT__,elf
-        global %1:function hidden
-    %else
-        global %1
-    %endif
-    align function_align
-    %1:
-    RESET_MM_PERMUTATION ; not really needed, but makes disassembly somewhat nicer
-    %assign stack_offset 0
-    %if %0 > 1
-        PROLOGUE %2
-    %endif
-%endmacro
-
-%macro cextern 1
-    %ifdef PREFIX
-        %xdefine %1 _%1
-    %endif
-    extern %1
-%endmacro
-
-; This is needed for ELF, otherwise the GNU linker assumes the stack is
-; executable by default.
-%ifidn __OUTPUT_FORMAT__,elf
-SECTION .note.GNU-stack noalloc noexec nowrite progbits
-%endif
-
-%assign FENC_STRIDE 16
-%assign FDEC_STRIDE 32
-
-; merge mmx and sse*
-
-%macro CAT_XDEFINE 3
-    %xdefine %1%2 %3
-%endmacro
-
-%macro CAT_UNDEF 2
-    %undef %1%2
-%endmacro
-
-%macro INIT_MMX 0
-    %define RESET_MM_PERMUTATION INIT_MMX
-    %define mmsize 8
-    %define num_mmregs 8
-    %define mova movq
-    %define movu movq
-    %define movh movd
-    %define movnt movntq
-    %assign %%i 0
-    %rep 8
-    CAT_XDEFINE m, %%i, mm %+ %%i
-    CAT_XDEFINE nmm, %%i, %%i
-    %assign %%i %%i+1
-    %endrep
-    %rep 8
-    CAT_UNDEF m, %%i
-    CAT_UNDEF nmm, %%i
-    %assign %%i %%i+1
-    %endrep
-%endmacro
-
-%macro INIT_XMM 0
-    %define RESET_MM_PERMUTATION INIT_XMM
-    %define mmsize 16
-    %define num_mmregs 8
-    %ifdef ARCH_X86_64
-    %define num_mmregs 16
-    %endif
-    %define mova movdqa
-    %define movu movdqu
-    %define movh movq
-    %define movnt movntdq
-    %assign %%i 0
-    %rep num_mmregs
-    CAT_XDEFINE m, %%i, xmm %+ %%i
-    CAT_XDEFINE nxmm, %%i, %%i
-    %assign %%i %%i+1
-    %endrep
-%endmacro
-
-INIT_MMX
-
-; I often want to use macros that permute their arguments. e.g. there's no
-; efficient way to implement butterfly or transpose or dct without swapping some
-; arguments.
-;
-; I would like to not have to manually keep track of the permutations:
-; If I insert a permutation in the middle of a function, it should automatically
-; change everything that follows. For more complex macros I may also have multiple
-; implementations, e.g. the SSE2 and SSSE3 versions may have different permutations.
-;
-; Hence these macros. Insert a PERMUTE or some SWAPs at the end of a macro that
-; permutes its arguments. It's equivalent to exchanging the contents of the
-; registers, except that this way you exchange the register names instead, so it
-; doesn't cost any cycles.
-
-%macro PERMUTE 2-* ; takes a list of pairs to swap
-%rep %0/2
-    %xdefine tmp%2 m%2
-    %xdefine ntmp%2 nm%2
-    %rotate 2
-%endrep
-%rep %0/2
-    %xdefine m%1 tmp%2
-    %xdefine nm%1 ntmp%2
-    %undef tmp%2
-    %undef ntmp%2
-    %rotate 2
-%endrep
-%endmacro
-
-%macro SWAP 2-* ; swaps a single chain (sometimes more concise than pairs)
-%rep %0-1
-%ifdef m%1
-    %xdefine tmp m%1
-    %xdefine m%1 m%2
-    %xdefine m%2 tmp
-    CAT_XDEFINE n, m%1, %1
-    CAT_XDEFINE n, m%2, %2
-%else
-    ; If we were called as "SWAP m0,m1" rather than "SWAP 0,1" infer the original numbers here.
-    ; Be careful using this mode in nested macros though, as in some cases there may be
-    ; other copies of m# that have already been dereferenced and don't get updated correctly.
-    %xdefine %%n1 n %+ %1
-    %xdefine %%n2 n %+ %2
-    %xdefine tmp m %+ %%n1
-    CAT_XDEFINE m, %%n1, m %+ %%n2
-    CAT_XDEFINE m, %%n2, tmp
-    CAT_XDEFINE n, m %+ %%n1, %%n1
-    CAT_XDEFINE n, m %+ %%n2, %%n2
-%endif
-    %undef tmp
-    %rotate 1
-%endrep
-%endmacro
-
-%macro SAVE_MM_PERMUTATION 1
-    %assign %%i 0
-    %rep num_mmregs
-    CAT_XDEFINE %1_m, %%i, m %+ %%i
-    %assign %%i %%i+1
-    %endrep
-%endmacro
-
-%macro LOAD_MM_PERMUTATION 1
-    %assign %%i 0
-    %rep num_mmregs
-    CAT_XDEFINE m, %%i, %1_m %+ %%i
-    CAT_XDEFINE n, m %+ %%i, %%i
-    %assign %%i %%i+1
-    %endrep
-%endmacro
-
-%macro call 1
-    call %1
-    %ifdef %1_m0
-        LOAD_MM_PERMUTATION %1
-    %endif
-%endmacro
-
-;Substitutions that reduce instruction size but are functionally equivalent
-%macro add 2
-    %ifnum %2
-        %if %2==128
-            sub %1, -128
-        %else
-            add %1, %2
-        %endif
-    %else
-        add %1, %2
-    %endif
-%endmacro
-
-%macro sub 2
-    %ifnum %2
-        %if %2==128
-            add %1, -128
-        %else
-            sub %1, %2
-        %endif
-    %else
-        sub %1, %2
-    %endif
-%endmacro
diff --git a/libavcodec/x86/x86util.asm b/libavcodec/x86/x86util.asm
deleted file mode 100644
index f3e0e2d..0000000
--- a/libavcodec/x86/x86util.asm
+++ /dev/null
@@ -1,515 +0,0 @@
-;*****************************************************************************
-;* x86util.asm
-;*****************************************************************************
-;* Copyright (C) 2008 Loren Merritt <lorenm at u.washington.edu>
-;*
-;* 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., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
-;*****************************************************************************
-
-%macro SBUTTERFLY 4
-    mova      m%4, m%2
-    punpckl%1 m%2, m%3
-    punpckh%1 m%4, m%3
-    SWAP %3, %4
-%endmacro
-
-%macro TRANSPOSE4x4W 5
-    SBUTTERFLY wd, %1, %2, %5
-    SBUTTERFLY wd, %3, %4, %5
-    SBUTTERFLY dq, %1, %3, %5
-    SBUTTERFLY dq, %2, %4, %5
-    SWAP %2, %3
-%endmacro
-
-%macro TRANSPOSE2x4x4W 5
-    SBUTTERFLY wd,  %1, %2, %5
-    SBUTTERFLY wd,  %3, %4, %5
-    SBUTTERFLY dq,  %1, %3, %5
-    SBUTTERFLY dq,  %2, %4, %5
-    SBUTTERFLY qdq, %1, %2, %5
-    SBUTTERFLY qdq, %3, %4, %5
-%endmacro
-
-%macro TRANSPOSE4x4D 5
-    SBUTTERFLY dq,  %1, %2, %5
-    SBUTTERFLY dq,  %3, %4, %5
-    SBUTTERFLY qdq, %1, %3, %5
-    SBUTTERFLY qdq, %2, %4, %5
-    SWAP %2, %3
-%endmacro
-
-%macro TRANSPOSE8x8W 9-11
-%ifdef ARCH_X86_64
-    SBUTTERFLY wd,  %1, %2, %9
-    SBUTTERFLY wd,  %3, %4, %9
-    SBUTTERFLY wd,  %5, %6, %9
-    SBUTTERFLY wd,  %7, %8, %9
-    SBUTTERFLY dq,  %1, %3, %9
-    SBUTTERFLY dq,  %2, %4, %9
-    SBUTTERFLY dq,  %5, %7, %9
-    SBUTTERFLY dq,  %6, %8, %9
-    SBUTTERFLY qdq, %1, %5, %9
-    SBUTTERFLY qdq, %2, %6, %9
-    SBUTTERFLY qdq, %3, %7, %9
-    SBUTTERFLY qdq, %4, %8, %9
-    SWAP %2, %5
-    SWAP %4, %7
-%else
-; in:  m0..m7, unless %11 in which case m6 is in %9
-; out: m0..m7, unless %11 in which case m4 is in %10
-; spills into %9 and %10
-%if %0<11
-    movdqa %9, m%7
-%endif
-    SBUTTERFLY wd,  %1, %2, %7
-    movdqa %10, m%2
-    movdqa m%7, %9
-    SBUTTERFLY wd,  %3, %4, %2
-    SBUTTERFLY wd,  %5, %6, %2
-    SBUTTERFLY wd,  %7, %8, %2
-    SBUTTERFLY dq,  %1, %3, %2
-    movdqa %9, m%3
-    movdqa m%2, %10
-    SBUTTERFLY dq,  %2, %4, %3
-    SBUTTERFLY dq,  %5, %7, %3
-    SBUTTERFLY dq,  %6, %8, %3
-    SBUTTERFLY qdq, %1, %5, %3
-    SBUTTERFLY qdq, %2, %6, %3
-    movdqa %10, m%2
-    movdqa m%3, %9
-    SBUTTERFLY qdq, %3, %7, %2
-    SBUTTERFLY qdq, %4, %8, %2
-    SWAP %2, %5
-    SWAP %4, %7
-%if %0<11
-    movdqa m%5, %10
-%endif
-%endif
-%endmacro
-
-%macro ABS1_MMX 2    ; a, tmp
-    pxor    %2, %2
-    psubw   %2, %1
-    pmaxsw  %1, %2
-%endmacro
-
-%macro ABS2_MMX 4    ; a, b, tmp0, tmp1
-    pxor    %3, %3
-    pxor    %4, %4
-    psubw   %3, %1
-    psubw   %4, %2
-    pmaxsw  %1, %3
-    pmaxsw  %2, %4
-%endmacro
-
-%macro ABS1_SSSE3 2
-    pabsw   %1, %1
-%endmacro
-
-%macro ABS2_SSSE3 4
-    pabsw   %1, %1
-    pabsw   %2, %2
-%endmacro
-
-%define ABS1 ABS1_MMX
-%define ABS2 ABS2_MMX
-
-%macro ABS4 6
-    ABS2 %1, %2, %5, %6
-    ABS2 %3, %4, %5, %6
-%endmacro
-
-%macro SPLATB_MMX 3
-    movd      %1, [%2-3] ;to avoid crossing a cacheline
-    punpcklbw %1, %1
-%if mmsize==16
-    pshuflw   %1, %1, 0xff
-    punpcklqdq %1, %1
-%else
-    pshufw    %1, %1, 0xff
-%endif
-%endmacro
-
-%macro SPLATB_SSSE3 3
-    movd      %1, [%2-3]
-    pshufb    %1, %3
-%endmacro
-
-%macro PALIGNR_MMX 4
-    %ifnidn %4, %2
-    mova    %4, %2
-    %endif
-    %if mmsize == 8
-    psllq   %1, (8-%3)*8
-    psrlq   %4, %3*8
-    %else
-    pslldq  %1, 16-%3
-    psrldq  %4, %3
-    %endif
-    por     %1, %4
-%endmacro
-
-%macro PALIGNR_SSSE3 4
-    palignr %1, %2, %3
-%endmacro
-
-%macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from
-%ifnum %5
-    mova   m%1, m%5
-    mova   m%3, m%5
-%else
-    mova   m%1, %5
-    mova   m%3, m%1
-%endif
-    pand   m%1, m%2 ; dst .. y6 .. y4
-    pand   m%3, m%4 ; src .. y6 .. y4
-    psrlw  m%2, 8   ; dst .. y7 .. y5
-    psrlw  m%4, 8   ; src .. y7 .. y5
-%endmacro
-
-%macro SUMSUB_BA 2-3
-%if %0==2
-    paddw   %1, %2
-    paddw   %2, %2
-    psubw   %2, %1
-%else
-    mova    %3, %1
-    paddw   %1, %2
-    psubw   %2, %3
-%endif
-%endmacro
-
-%macro SUMSUB_BADC 4-5
-%if %0==5
-    SUMSUB_BA %1, %2, %5
-    SUMSUB_BA %3, %4, %5
-%else
-    paddw   %1, %2
-    paddw   %3, %4
-    paddw   %2, %2
-    paddw   %4, %4
-    psubw   %2, %1
-    psubw   %4, %3
-%endif
-%endmacro
-
-%macro HADAMARD4_V 4+
-    SUMSUB_BADC %1, %2, %3, %4
-    SUMSUB_BADC %1, %3, %2, %4
-%endmacro
-
-%macro HADAMARD8_V 8+
-    SUMSUB_BADC %1, %2, %3, %4
-    SUMSUB_BADC %5, %6, %7, %8
-    SUMSUB_BADC %1, %3, %2, %4
-    SUMSUB_BADC %5, %7, %6, %8
-    SUMSUB_BADC %1, %5, %2, %6
-    SUMSUB_BADC %3, %7, %4, %8
-%endmacro
-
-%macro TRANS_SSE2 5-6
-; TRANSPOSE2x2
-; %1: transpose width (d/q) - use SBUTTERFLY qdq for dq
-; %2: ord/unord (for compat with sse4, unused)
-; %3/%4: source regs
-; %5/%6: tmp regs
-%ifidn %1, d
-%define mask [mask_10 GLOBAL]
-%define shift 16
-%elifidn %1, q
-%define mask [mask_1100 GLOBAL]
-%define shift 32
-%endif
-%if %0==6 ; less dependency if we have two tmp
-    mova   m%5, mask   ; ff00
-    mova   m%6, m%4    ; x5x4
-    psll%1 m%4, shift  ; x4..
-    pand   m%6, m%5    ; x5..
-    pandn  m%5, m%3    ; ..x0
-    psrl%1 m%3, shift  ; ..x1
-    por    m%4, m%5    ; x4x0
-    por    m%3, m%6    ; x5x1
-%else ; more dependency, one insn less. sometimes faster, sometimes not
-    mova   m%5, m%4    ; x5x4
-    psll%1 m%4, shift  ; x4..
-    pxor   m%4, m%3    ; (x4^x1)x0
-    pand   m%4, mask   ; (x4^x1)..
-    pxor   m%3, m%4    ; x4x0
-    psrl%1 m%4, shift  ; ..(x1^x4)
-    pxor   m%5, m%4    ; x5x1
-    SWAP   %4, %3, %5
-%endif
-%endmacro
-
-%macro TRANS_SSE4 5-6 ; see above
-%ifidn %1, d
-    mova   m%5, m%3
-%ifidn %2, ord
-    psrl%1 m%3, 16
-%endif
-    pblendw m%3, m%4, 10101010b
-    psll%1 m%4, 16
-%ifidn %2, ord
-    pblendw m%4, m%5, 01010101b
-%else
-    psrl%1 m%5, 16
-    por    m%4, m%5
-%endif
-%elifidn %1, q
-    mova   m%5, m%3
-    shufps m%3, m%4, 10001000b
-    shufps m%5, m%4, 11011101b
-    SWAP   %4, %5
-%endif
-%endmacro
-
-%macro HADAMARD 5-6
-; %1=distance in words (0 for vertical pass, 1/2/4 for horizontal passes)
-; %2=sumsub/max/amax (sum and diff / maximum / maximum of absolutes)
-; %3/%4: regs
-; %5(%6): tmpregs
-%if %1!=0 ; have to reorder stuff for horizontal op
-    %ifidn %2, sumsub
-         %define ORDER ord
-         ; sumsub needs order because a-b != b-a unless a=b
-    %else
-         %define ORDER unord
-         ; if we just max, order doesn't matter (allows pblendw+or in sse4)
-    %endif
-    %if %1==1
-         TRANS d, ORDER, %3, %4, %5, %6
-    %elif %1==2
-         %if mmsize==8
-             SBUTTERFLY dq, %3, %4, %5
-         %else
-             TRANS q, ORDER, %3, %4, %5, %6
-         %endif
-    %elif %1==4
-         SBUTTERFLY qdq, %3, %4, %5
-    %endif
-%endif
-%ifidn %2, sumsub
-    SUMSUB_BA m%3, m%4, m%5
-%else
-    %ifidn %2, amax
-        %if %0==6
-            ABS2 m%3, m%4, m%5, m%6
-        %else
-            ABS1 m%3, m%5
-            ABS1 m%4, m%5
-        %endif
-    %endif
-    pmaxsw m%3, m%4
-%endif
-%endmacro
-
-
-%macro HADAMARD2_2D 6-7 sumsub
-    HADAMARD 0, sumsub, %1, %2, %5
-    HADAMARD 0, sumsub, %3, %4, %5
-    SBUTTERFLY %6, %1, %2, %5
-%ifnum %7
-    HADAMARD 0, amax, %1, %2, %5, %7
-%else
-    HADAMARD 0, %7, %1, %2, %5
-%endif
-    SBUTTERFLY %6, %3, %4, %5
-%ifnum %7
-    HADAMARD 0, amax, %3, %4, %5, %7
-%else
-    HADAMARD 0, %7, %3, %4, %5
-%endif
-%endmacro
-
-%macro HADAMARD4_2D 5-6 sumsub
-    HADAMARD2_2D %1, %2, %3, %4, %5, wd
-    HADAMARD2_2D %1, %3, %2, %4, %5, dq, %6
-    SWAP %2, %3
-%endmacro
-
-%macro HADAMARD4_2D_SSE 5-6 sumsub
-    HADAMARD  0, sumsub, %1, %2, %5 ; 1st V row 0 + 1
-    HADAMARD  0, sumsub, %3, %4, %5 ; 1st V row 2 + 3
-    SBUTTERFLY   wd, %1, %2, %5     ; %1: m0 1+0 %2: m1 1+0
-    SBUTTERFLY   wd, %3, %4, %5     ; %3: m0 3+2 %4: m1 3+2
-    HADAMARD2_2D %1, %3, %2, %4, %5, dq
-    SBUTTERFLY  qdq, %1, %2, %5
-    HADAMARD  0, %6, %1, %2, %5     ; 2nd H m1/m0 row 0+1
-    SBUTTERFLY  qdq, %3, %4, %5
-    HADAMARD  0, %6, %3, %4, %5     ; 2nd H m1/m0 row 2+3
-%endmacro
-
-%macro HADAMARD8_2D 9-10 sumsub
-    HADAMARD2_2D %1, %2, %3, %4, %9, wd
-    HADAMARD2_2D %5, %6, %7, %8, %9, wd
-    HADAMARD2_2D %1, %3, %2, %4, %9, dq
-    HADAMARD2_2D %5, %7, %6, %8, %9, dq
-    HADAMARD2_2D %1, %5, %3, %7, %9, qdq, %10
-    HADAMARD2_2D %2, %6, %4, %8, %9, qdq, %10
-%ifnidn %10, amax
-    SWAP %2, %5
-    SWAP %4, %7
-%endif
-%endmacro
-
-%macro SUMSUB2_AB 3
-    mova    %3, %1
-    paddw   %1, %1
-    paddw   %1, %2
-    psubw   %3, %2
-    psubw   %3, %2
-%endmacro
-
-%macro SUMSUB2_BA 3
-    mova    m%3, m%1
-    paddw   m%1, m%2
-    paddw   m%1, m%2
-    psubw   m%2, m%3
-    psubw   m%2, m%3
-%endmacro
-
-%macro SUMSUBD2_AB 4
-    mova    %4, %1
-    mova    %3, %2
-    psraw   %2, 1
-    psraw   %1, 1
-    paddw   %2, %4
-    psubw   %1, %3
-%endmacro
-
-%macro DCT4_1D 5
-%ifnum %5
-    SUMSUB_BADC m%4, m%1, m%3, m%2; m%5
-    SUMSUB_BA   m%3, m%4, m%5
-    SUMSUB2_AB  m%1, m%2, m%5
-    SWAP %1, %3, %4, %5, %2
-%else
-    SUMSUB_BADC m%4, m%1, m%3, m%2
-    SUMSUB_BA   m%3, m%4
-    mova       [%5], m%2
-    SUMSUB2_AB m%1, [%5], m%2
-    SWAP %1, %3, %4, %2
-%endif
-%endmacro
-
-%macro IDCT4_1D 5-6
-%ifnum %5
-    SUMSUBD2_AB m%2, m%4, m%6, m%5
-    SUMSUB_BA   m%3, m%1, m%6
-    SUMSUB_BADC m%4, m%3, m%2, m%1, m%6
-%else
-    SUMSUBD2_AB m%2, m%4, [%5], [%5+16]
-    SUMSUB_BA   m%3, m%1
-    SUMSUB_BADC m%4, m%3, m%2, m%1
-%endif
-    SWAP %1, %4, %3
-%endmacro
-
-%macro LOAD_DIFF 5
-%ifidn %3, none
-    movh       %1, %4
-    movh       %2, %5
-    punpcklbw  %1, %2
-    punpcklbw  %2, %2
-    psubw      %1, %2
-%else
-    movh       %1, %4
-    punpcklbw  %1, %3
-    movh       %2, %5
-    punpcklbw  %2, %3
-    psubw      %1, %2
-%endif
-%endmacro
-
-%macro LOAD_DIFF8x4_SSE2 8
-    LOAD_DIFF  m%1, m%5, m%6, [%7+%1*FENC_STRIDE], [%8+%1*FDEC_STRIDE]
-    LOAD_DIFF  m%2, m%5, m%6, [%7+%2*FENC_STRIDE], [%8+%2*FDEC_STRIDE]
-    LOAD_DIFF  m%3, m%5, m%6, [%7+%3*FENC_STRIDE], [%8+%3*FDEC_STRIDE]
-    LOAD_DIFF  m%4, m%5, m%6, [%7+%4*FENC_STRIDE], [%8+%4*FDEC_STRIDE]
-%endmacro
-
-%macro LOAD_DIFF8x4_SSSE3 8 ; 4x dst, 1x tmp, 1x mul, 2x ptr
-    movh       m%2, [%8+%1*FDEC_STRIDE]
-    movh       m%1, [%7+%1*FENC_STRIDE]
-    punpcklbw  m%1, m%2
-    movh       m%3, [%8+%2*FDEC_STRIDE]
-    movh       m%2, [%7+%2*FENC_STRIDE]
-    punpcklbw  m%2, m%3
-    movh       m%4, [%8+%3*FDEC_STRIDE]
-    movh       m%3, [%7+%3*FENC_STRIDE]
-    punpcklbw  m%3, m%4
-    movh       m%5, [%8+%4*FDEC_STRIDE]
-    movh       m%4, [%7+%4*FENC_STRIDE]
-    punpcklbw  m%4, m%5
-    pmaddubsw  m%1, m%6
-    pmaddubsw  m%2, m%6
-    pmaddubsw  m%3, m%6
-    pmaddubsw  m%4, m%6
-%endmacro
-
-%macro STORE_DCT 6
-    movq   [%5+%6+ 0], m%1
-    movq   [%5+%6+ 8], m%2
-    movq   [%5+%6+16], m%3
-    movq   [%5+%6+24], m%4
-    movhps [%5+%6+32], m%1
-    movhps [%5+%6+40], m%2
-    movhps [%5+%6+48], m%3
-    movhps [%5+%6+56], m%4
-%endmacro
-
-%macro STORE_IDCT 4
-    movhps [r0-4*FDEC_STRIDE], %1
-    movh   [r0-3*FDEC_STRIDE], %1
-    movhps [r0-2*FDEC_STRIDE], %2
-    movh   [r0-1*FDEC_STRIDE], %2
-    movhps [r0+0*FDEC_STRIDE], %3
-    movh   [r0+1*FDEC_STRIDE], %3
-    movhps [r0+2*FDEC_STRIDE], %4
-    movh   [r0+3*FDEC_STRIDE], %4
-%endmacro
-
-%macro LOAD_DIFF_8x4P 7-10 r0,r2,0 ; 4x dest, 2x temp, 2x pointer, increment?
-    LOAD_DIFF m%1, m%5, m%7, [%8],      [%9]
-    LOAD_DIFF m%2, m%6, m%7, [%8+r1],   [%9+r3]
-    LOAD_DIFF m%3, m%5, m%7, [%8+2*r1], [%9+2*r3]
-    LOAD_DIFF m%4, m%6, m%7, [%8+r4],   [%9+r5]
-%if %10
-    lea %8, [%8+4*r1]
-    lea %9, [%9+4*r3]
-%endif
-%endmacro
-
-%macro DIFFx2 6-7
-    movh       %3, %5
-    punpcklbw  %3, %4
-    psraw      %1, 6
-    paddsw     %1, %3
-    movh       %3, %6
-    punpcklbw  %3, %4
-    psraw      %2, 6
-    paddsw     %2, %3
-    packuswb   %2, %1
-%endmacro
-
-%macro STORE_DIFF 4
-    movh       %2, %4
-    punpcklbw  %2, %3
-    psraw      %1, 6
-    paddsw     %1, %2
-    packuswb   %1, %1
-    movh       %4, %1
-%endmacro
-
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
deleted file mode 100644
index 3f6aa8c..0000000
--- a/libavcodec/xan.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * Wing Commander/Xan Video Decoder
- * Copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Xan video decoder for Wing Commander III computer game
- * by Mario Brito (mbrito at student.dei.uc.pt)
- * and Mike Melanson (melanson at pcisys.net)
- *
- * The xan_wc3 decoder outputs PAL8 data.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-#include "bytestream.h"
-#define ALT_BITSTREAM_READER_LE
-#include "get_bits.h"
-// for av_memcpy_backptr
-#include "libavutil/lzo.h"
-
-typedef struct XanContext {
-
-    AVCodecContext *avctx;
-    AVFrame last_frame;
-    AVFrame current_frame;
-
-    const unsigned char *buf;
-    int size;
-
-    /* scratch space */
-    unsigned char *buffer1;
-    int buffer1_size;
-    unsigned char *buffer2;
-    int buffer2_size;
-
-    int frame_size;
-
-} XanContext;
-
-static av_cold int xan_decode_init(AVCodecContext *avctx)
-{
-    XanContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->frame_size = 0;
-
-    if ((avctx->codec->id == CODEC_ID_XAN_WC3) &&
-        (s->avctx->palctrl == NULL)) {
-        av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n");
-        return -1;
-    }
-
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    s->buffer1_size = avctx->width * avctx->height;
-    s->buffer1 = av_malloc(s->buffer1_size);
-    if (!s->buffer1)
-        return -1;
-    s->buffer2_size = avctx->width * avctx->height;
-    s->buffer2 = av_malloc(s->buffer2_size + 130);
-    if (!s->buffer2) {
-        av_freep(&s->buffer1);
-        return -1;
-    }
-
-    return 0;
-}
-
-static int xan_huffman_decode(unsigned char *dest, const unsigned char *src,
-    int dest_len)
-{
-    unsigned char byte = *src++;
-    unsigned char ival = byte + 0x16;
-    const unsigned char * ptr = src + byte*2;
-    unsigned char val = ival;
-    unsigned char *dest_end = dest + dest_len;
-    GetBitContext gb;
-
-    init_get_bits(&gb, ptr, 0); // FIXME: no src size available
-
-    while ( val != 0x16 ) {
-        val = src[val - 0x17 + get_bits1(&gb) * byte];
-
-        if ( val < 0x16 ) {
-            if (dest >= dest_end)
-                return 0;
-            *dest++ = val;
-            val = ival;
-        }
-    }
-
-    return 0;
-}
-
-/**
- * unpack simple compression
- *
- * @param dest destination buffer of dest_len, must be padded with at least 130 bytes
- */
-static void xan_unpack(unsigned char *dest, const unsigned char *src, int dest_len)
-{
-    unsigned char opcode;
-    int size;
-    unsigned char *dest_end = dest + dest_len;
-
-    while (dest < dest_end) {
-        opcode = *src++;
-
-        if (opcode < 0xe0) {
-            int size2, back;
-            if ( (opcode & 0x80) == 0 ) {
-
-                size = opcode & 3;
-
-                back  = ((opcode & 0x60) << 3) + *src++ + 1;
-                size2 = ((opcode & 0x1c) >> 2) + 3;
-
-            } else if ( (opcode & 0x40) == 0 ) {
-
-                size = *src >> 6;
-
-                back  = (bytestream_get_be16(&src) & 0x3fff) + 1;
-                size2 = (opcode & 0x3f) + 4;
-
-            } else {
-
-                size = opcode & 3;
-
-                back  = ((opcode & 0x10) << 12) + bytestream_get_be16(&src) + 1;
-                size2 = ((opcode & 0x0c) <<  6) + *src++ + 5;
-                if (size + size2 > dest_end - dest)
-                    return;
-            }
-            memcpy(dest, src, size);  dest += size;  src += size;
-            av_memcpy_backptr(dest, back, size2);
-            dest += size2;
-        } else {
-            int finish = opcode >= 0xfc;
-            size = finish ? opcode & 3 : ((opcode & 0x1f) << 2) + 4;
-
-            memcpy(dest, src, size);  dest += size;  src += size;
-            if (finish)
-                return;
-        }
-    }
-}
-
-static inline void xan_wc3_output_pixel_run(XanContext *s,
-    const unsigned char *pixel_buffer, int x, int y, int pixel_count)
-{
-    int stride;
-    int line_inc;
-    int index;
-    int current_x;
-    int width = s->avctx->width;
-    unsigned char *palette_plane;
-
-    palette_plane = s->current_frame.data[0];
-    stride = s->current_frame.linesize[0];
-    line_inc = stride - width;
-    index = y * stride + x;
-    current_x = x;
-    while(pixel_count && (index < s->frame_size)) {
-        int count = FFMIN(pixel_count, width - current_x);
-        memcpy(palette_plane + index, pixel_buffer, count);
-        pixel_count  -= count;
-        index        += count;
-        pixel_buffer += count;
-        current_x    += count;
-
-        if (current_x >= width) {
-            index += line_inc;
-            current_x = 0;
-        }
-    }
-}
-
-static inline void xan_wc3_copy_pixel_run(XanContext *s,
-    int x, int y, int pixel_count, int motion_x, int motion_y)
-{
-    int stride;
-    int line_inc;
-    int curframe_index, prevframe_index;
-    int curframe_x, prevframe_x;
-    int width = s->avctx->width;
-    unsigned char *palette_plane, *prev_palette_plane;
-
-    palette_plane = s->current_frame.data[0];
-    prev_palette_plane = s->last_frame.data[0];
-    stride = s->current_frame.linesize[0];
-    line_inc = stride - width;
-    curframe_index = y * stride + x;
-    curframe_x = x;
-    prevframe_index = (y + motion_y) * stride + x + motion_x;
-    prevframe_x = x + motion_x;
-    while(pixel_count && (curframe_index < s->frame_size)) {
-        int count = FFMIN3(pixel_count, width - curframe_x, width - prevframe_x);
-
-        memcpy(palette_plane + curframe_index, prev_palette_plane + prevframe_index, count);
-        pixel_count     -= count;
-        curframe_index  += count;
-        prevframe_index += count;
-        curframe_x      += count;
-        prevframe_x     += count;
-
-        if (curframe_x >= width) {
-            curframe_index += line_inc;
-            curframe_x = 0;
-        }
-
-        if (prevframe_x >= width) {
-            prevframe_index += line_inc;
-            prevframe_x = 0;
-        }
-    }
-}
-
-static void xan_wc3_decode_frame(XanContext *s) {
-
-    int width = s->avctx->width;
-    int height = s->avctx->height;
-    int total_pixels = width * height;
-    unsigned char opcode;
-    unsigned char flag = 0;
-    int size = 0;
-    int motion_x, motion_y;
-    int x, y;
-
-    unsigned char *opcode_buffer = s->buffer1;
-    int opcode_buffer_size = s->buffer1_size;
-    const unsigned char *imagedata_buffer = s->buffer2;
-
-    /* pointers to segments inside the compressed chunk */
-    const unsigned char *huffman_segment;
-    const unsigned char *size_segment;
-    const unsigned char *vector_segment;
-    const unsigned char *imagedata_segment;
-
-    huffman_segment =   s->buf + AV_RL16(&s->buf[0]);
-    size_segment =      s->buf + AV_RL16(&s->buf[2]);
-    vector_segment =    s->buf + AV_RL16(&s->buf[4]);
-    imagedata_segment = s->buf + AV_RL16(&s->buf[6]);
-
-    xan_huffman_decode(opcode_buffer, huffman_segment, opcode_buffer_size);
-
-    if (imagedata_segment[0] == 2)
-        xan_unpack(s->buffer2, &imagedata_segment[1], s->buffer2_size);
-    else
-        imagedata_buffer = &imagedata_segment[1];
-
-    /* use the decoded data segments to build the frame */
-    x = y = 0;
-    while (total_pixels) {
-
-        opcode = *opcode_buffer++;
-        size = 0;
-
-        switch (opcode) {
-
-        case 0:
-            flag ^= 1;
-            continue;
-
-        case 1:
-        case 2:
-        case 3:
-        case 4:
-        case 5:
-        case 6:
-        case 7:
-        case 8:
-            size = opcode;
-            break;
-
-        case 12:
-        case 13:
-        case 14:
-        case 15:
-        case 16:
-        case 17:
-        case 18:
-            size += (opcode - 10);
-            break;
-
-        case 9:
-        case 19:
-            size = *size_segment++;
-            break;
-
-        case 10:
-        case 20:
-            size = AV_RB16(&size_segment[0]);
-            size_segment += 2;
-            break;
-
-        case 11:
-        case 21:
-            size = AV_RB24(size_segment);
-            size_segment += 3;
-            break;
-        }
-
-        if (opcode < 12) {
-            flag ^= 1;
-            if (flag) {
-                /* run of (size) pixels is unchanged from last frame */
-                xan_wc3_copy_pixel_run(s, x, y, size, 0, 0);
-            } else {
-                /* output a run of pixels from imagedata_buffer */
-                xan_wc3_output_pixel_run(s, imagedata_buffer, x, y, size);
-                imagedata_buffer += size;
-            }
-        } else {
-            /* run-based motion compensation from last frame */
-            motion_x = sign_extend(*vector_segment >> 4,  4);
-            motion_y = sign_extend(*vector_segment & 0xF, 4);
-            vector_segment++;
-
-            /* copy a run of pixels from the previous frame */
-            xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y);
-
-            flag = 0;
-        }
-
-        /* coordinate accounting */
-        total_pixels -= size;
-        y += (x + size) / width;
-        x  = (x + size) % width;
-    }
-}
-
-static void xan_wc4_decode_frame(XanContext *s) {
-}
-
-static int xan_decode_frame(AVCodecContext *avctx,
-                            void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    XanContext *s = avctx->priv_data;
-    AVPaletteControl *palette_control = avctx->palctrl;
-
-    if (avctx->get_buffer(avctx, &s->current_frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "  Xan Video: get_buffer() failed\n");
-        return -1;
-    }
-    s->current_frame.reference = 3;
-
-    if (!s->frame_size)
-        s->frame_size = s->current_frame.linesize[0] * s->avctx->height;
-
-    palette_control->palette_changed = 0;
-    memcpy(s->current_frame.data[1], palette_control->palette,
-           AVPALETTE_SIZE);
-    s->current_frame.palette_has_changed = 1;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    if (avctx->codec->id == CODEC_ID_XAN_WC3)
-        xan_wc3_decode_frame(s);
-    else if (avctx->codec->id == CODEC_ID_XAN_WC4)
-        xan_wc4_decode_frame(s);
-
-    /* release the last frame if it is allocated */
-    if (s->last_frame.data[0])
-        avctx->release_buffer(avctx, &s->last_frame);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->current_frame;
-
-    /* shuffle frames */
-    FFSWAP(AVFrame, s->current_frame, s->last_frame);
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static av_cold int xan_decode_end(AVCodecContext *avctx)
-{
-    XanContext *s = avctx->priv_data;
-
-    /* release the frames */
-    if (s->last_frame.data[0])
-        avctx->release_buffer(avctx, &s->last_frame);
-    if (s->current_frame.data[0])
-        avctx->release_buffer(avctx, &s->current_frame);
-
-    av_freep(&s->buffer1);
-    av_freep(&s->buffer2);
-
-    return 0;
-}
-
-AVCodec xan_wc3_decoder = {
-    "xan_wc3",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_XAN_WC3,
-    sizeof(XanContext),
-    xan_decode_init,
-    NULL,
-    xan_decode_end,
-    xan_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"),
-};
-
-/*
-AVCodec xan_wc4_decoder = {
-    "xan_wc4",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_XAN_WC4,
-    sizeof(XanContext),
-    xan_decode_init,
-    NULL,
-    xan_decode_end,
-    xan_decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"),
-};
-*/
diff --git a/libavcodec/xiph.c b/libavcodec/xiph.c
deleted file mode 100644
index 2f4f25c..0000000
--- a/libavcodec/xiph.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2007  FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "xiph.h"
-
-int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,
-                          int first_header_size, uint8_t *header_start[3],
-                          int header_len[3])
-{
-    int i;
-
-    if (extradata_size >= 6 && AV_RB16(extradata) == first_header_size) {
-        int overall_len = 6;
-        for (i=0; i<3; i++) {
-            header_len[i] = AV_RB16(extradata);
-            extradata += 2;
-            header_start[i] = extradata;
-            extradata += header_len[i];
-            if (overall_len > extradata_size - header_len[i])
-                return -1;
-            overall_len += header_len[i];
-        }
-    } else if (extradata_size >= 3 && extradata_size < INT_MAX - 0x1ff && extradata[0] == 2) {
-        int overall_len = 3;
-        extradata++;
-        for (i=0; i<2; i++, extradata++) {
-            header_len[i] = 0;
-            for (; overall_len < extradata_size && *extradata==0xff; extradata++) {
-                header_len[i] += 0xff;
-                overall_len   += 0xff + 1;
-            }
-            header_len[i] += *extradata;
-            overall_len   += *extradata;
-            if (overall_len > extradata_size)
-                return -1;
-        }
-        header_len[2] = extradata_size - overall_len;
-        header_start[0] = extradata;
-        header_start[1] = header_start[0] + header_len[0];
-        header_start[2] = header_start[1] + header_len[1];
-    } else {
-        return -1;
-    }
-    return 0;
-}
diff --git a/libavcodec/xiph.h b/libavcodec/xiph.h
deleted file mode 100644
index 60f4a95..0000000
--- a/libavcodec/xiph.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2007  FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_XIPH_H
-#define AVCODEC_XIPH_H
-
-#include "libavutil/common.h"
-
-/**
- * Splits a single extradata buffer into the three headers that most
- * Xiph codecs use. (e.g. Theora and Vorbis)
- * Works both with Matroska's packing and lavc's packing.
- *
- * @param[in] extradata The single chunk that combines all three headers
- * @param[in] extradata_size The size of the extradata buffer
- * @param[in] first_header_size The size of the first header, used to
- * differentiate between the Matroska packing and lavc packing.
- * @param[out] header_start Pointers to the start of the three separate headers.
- * @param[out] header_len The sizes of each of the three headers.
- * @return On error a negative value is returned, on success zero.
- */
-int ff_split_xiph_headers(uint8_t *extradata, int extradata_size,
-                          int first_header_size, uint8_t *header_start[3],
-                          int header_len[3]);
-
-#endif /* AVCODEC_XIPH_H */
diff --git a/libavcodec/xl.c b/libavcodec/xl.c
deleted file mode 100644
index f7d025e..0000000
--- a/libavcodec/xl.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Miro VideoXL codec
- * Copyright (c) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Miro VideoXL codec.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-typedef struct VideoXLContext{
-    AVCodecContext *avctx;
-    AVFrame pic;
-} VideoXLContext;
-
-static const int xl_table[32] = {
-   0,   1,   2,   3,   4,   5,   6,   7,
-   8,   9,  12,  15,  20,  25,  34,  46,
-  64,  82,  94, 103, 108, 113, 116, 119,
- 120, 121, 122, 123, 124, 125, 126, 127};
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    VideoXLContext * const a = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&a->pic;
-    uint8_t *Y, *U, *V;
-    int i, j;
-    int stride;
-    uint32_t val;
-    int y0, y1, y2, y3 = 0, c0 = 0, c1 = 0;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference = 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    p->pict_type= FF_I_TYPE;
-    p->key_frame= 1;
-
-    Y = a->pic.data[0];
-    U = a->pic.data[1];
-    V = a->pic.data[2];
-
-    stride = avctx->width - 4;
-    for (i = 0; i < avctx->height; i++) {
-        /* lines are stored in reversed order */
-        buf += stride;
-
-        for (j = 0; j < avctx->width; j += 4) {
-            /* value is stored in LE dword with word swapped */
-            val = AV_RL32(buf);
-            buf -= 4;
-            val = ((val >> 16) & 0xFFFF) | ((val & 0xFFFF) << 16);
-
-            if(!j)
-                y0 = (val & 0x1F) << 2;
-            else
-                y0 = y3 + xl_table[val & 0x1F];
-            val >>= 5;
-            y1 = y0 + xl_table[val & 0x1F];
-            val >>= 5;
-            y2 = y1 + xl_table[val & 0x1F];
-            val >>= 6; /* align to word */
-            y3 = y2 + xl_table[val & 0x1F];
-            val >>= 5;
-            if(!j)
-                c0 = (val & 0x1F) << 2;
-            else
-                c0 += xl_table[val & 0x1F];
-            val >>= 5;
-            if(!j)
-                c1 = (val & 0x1F) << 2;
-            else
-                c1 += xl_table[val & 0x1F];
-
-            Y[j + 0] = y0 << 1;
-            Y[j + 1] = y1 << 1;
-            Y[j + 2] = y2 << 1;
-            Y[j + 3] = y3 << 1;
-
-            U[j >> 2] = c0 << 1;
-            V[j >> 2] = c1 << 1;
-        }
-
-        buf += avctx->width + 4;
-        Y += a->pic.linesize[0];
-        U += a->pic.linesize[1];
-        V += a->pic.linesize[2];
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = a->pic;
-
-    return buf_size;
-}
-
-static av_cold int decode_init(AVCodecContext *avctx){
-//    VideoXLContext * const a = avctx->priv_data;
-
-    avctx->pix_fmt= PIX_FMT_YUV411P;
-
-    return 0;
-}
-
-static av_cold int decode_end(AVCodecContext *avctx){
-    VideoXLContext * const a = avctx->priv_data;
-    AVFrame *pic = &a->pic;
-
-    if (pic->data[0])
-        avctx->release_buffer(avctx, pic);
-
-    return 0;
-}
-
-AVCodec xl_decoder = {
-    "xl",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_VIXL,
-    sizeof(VideoXLContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Miro VideoXL"),
-};
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
deleted file mode 100644
index 0055ebb..0000000
--- a/libavcodec/xsubdec.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * XSUB subtitle decoder
- * Copyright (c) 2007 Reimar Döffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avcodec.h"
-#include "get_bits.h"
-#include "bytestream.h"
-
-static av_cold int decode_init(AVCodecContext *avctx) {
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    return 0;
-}
-
-static const uint8_t tc_offsets[9] = { 0, 1, 3, 4, 6, 7, 9, 10, 11 };
-static const uint8_t tc_muls[9] = { 10, 6, 10, 6, 10, 10, 10, 10, 1 };
-
-static int64_t parse_timecode(const uint8_t *buf, int64_t packet_time) {
-    int i;
-    int64_t ms = 0;
-    if (buf[2] != ':' || buf[5] != ':' || buf[8] != '.')
-        return AV_NOPTS_VALUE;
-    for (i = 0; i < sizeof(tc_offsets); i++) {
-        uint8_t c = buf[tc_offsets[i]] - '0';
-        if (c > 9) return AV_NOPTS_VALUE;
-        ms = (ms + c) * tc_muls[i];
-    }
-    return ms - packet_time;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                        AVPacket *avpkt) {
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    AVSubtitle *sub = data;
-    const uint8_t *buf_end = buf + buf_size;
-    uint8_t *bitmap;
-    int w, h, x, y, rlelen, i;
-    int64_t packet_time = 0;
-    GetBitContext gb;
-
-    memset(sub, 0, sizeof(*sub));
-
-    // check that at least header fits
-    if (buf_size < 27 + 7 * 2 + 4 * 3) {
-        av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
-        return -1;
-    }
-
-    // read start and end time
-    if (buf[0] != '[' || buf[13] != '-' || buf[26] != ']') {
-        av_log(avctx, AV_LOG_ERROR, "invalid time code\n");
-        return -1;
-    }
-    if (avpkt->pts != AV_NOPTS_VALUE)
-        packet_time = av_rescale_q(avpkt->pts, AV_TIME_BASE_Q, (AVRational){1, 1000});
-    sub->start_display_time = parse_timecode(buf +  1, packet_time);
-    sub->end_display_time   = parse_timecode(buf + 14, packet_time);
-    buf += 27;
-
-    // read header
-    w = bytestream_get_le16(&buf);
-    h = bytestream_get_le16(&buf);
-    if (avcodec_check_dimensions(avctx, w, h) < 0)
-        return -1;
-    x = bytestream_get_le16(&buf);
-    y = bytestream_get_le16(&buf);
-    // skip bottom right position, it gives no new information
-    bytestream_get_le16(&buf);
-    bytestream_get_le16(&buf);
-    rlelen = bytestream_get_le16(&buf);
-
-    // allocate sub and set values
-    sub->rects =  av_mallocz(sizeof(*sub->rects));
-    sub->rects[0] = av_mallocz(sizeof(*sub->rects[0]));
-    sub->num_rects = 1;
-    sub->rects[0]->x = x; sub->rects[0]->y = y;
-    sub->rects[0]->w = w; sub->rects[0]->h = h;
-    sub->rects[0]->type = SUBTITLE_BITMAP;
-    sub->rects[0]->pict.linesize[0] = w;
-    sub->rects[0]->pict.data[0] = av_malloc(w * h);
-    sub->rects[0]->nb_colors = 4;
-    sub->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
-
-    // read palette
-    for (i = 0; i < sub->rects[0]->nb_colors; i++)
-        ((uint32_t*)sub->rects[0]->pict.data[1])[i] = bytestream_get_be24(&buf);
-    // make all except background (first entry) non-transparent
-    for (i = 1; i < sub->rects[0]->nb_colors; i++)
-        ((uint32_t*)sub->rects[0]->pict.data[1])[i] |= 0xff000000;
-
-    // process RLE-compressed data
-    rlelen = FFMIN(rlelen, buf_end - buf);
-    init_get_bits(&gb, buf, rlelen * 8);
-    bitmap = sub->rects[0]->pict.data[0];
-    for (y = 0; y < h; y++) {
-        // interlaced: do odd lines
-        if (y == (h + 1) / 2) bitmap = sub->rects[0]->pict.data[0] + w;
-        for (x = 0; x < w; ) {
-            int log2 = ff_log2_tab[show_bits(&gb, 8)];
-            int run = get_bits(&gb, 14 - 4 * (log2 >> 1));
-            int color = get_bits(&gb, 2);
-            run = FFMIN(run, w - x);
-            // run length 0 means till end of row
-            if (!run) run = w - x;
-            memset(bitmap, color, run);
-            bitmap += run;
-            x += run;
-        }
-        // interlaced, skip every second line
-        bitmap += w;
-        align_get_bits(&gb);
-    }
-    *data_size = 1;
-    return buf_size;
-}
-
-AVCodec xsub_decoder = {
-    "xsub",
-    AVMEDIA_TYPE_SUBTITLE,
-    CODEC_ID_XSUB,
-    0,
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("XSUB"),
-};
diff --git a/libavcodec/xsubenc.c b/libavcodec/xsubenc.c
deleted file mode 100644
index 903cbd2..0000000
--- a/libavcodec/xsubenc.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * DivX (XSUB) subtitle encoder
- * Copyright (c) 2005 DivX, Inc.
- * Copyright (c) 2009 Bjorn Axelsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avcodec.h"
-#include "bytestream.h"
-#include "put_bits.h"
-
-/**
- * Number of pixels to pad left and right.
- *
- * The official encoder pads the subtitles with two pixels on either side,
- * but until we find out why, we won't do it (we will pad to have width
- * divisible by 2 though).
- */
-#define PADDING 0
-#define PADDING_COLOR 0
-
-/**
- * Encodes a single color run. At most 16 bits will be used.
- * \param len   length of the run, values > 255 mean "until end of line", may not be < 0.
- * \param color color to encode, only the lowest two bits are used and all others must be 0.
- */
-static void put_xsub_rle(PutBitContext *pb, int len, int color)
-{
-    if (len <= 255)
-        put_bits(pb, 2 + ((ff_log2_tab[len] >> 1) << 2), len);
-    else
-        put_bits(pb, 14, 0);
-    put_bits(pb, 2, color);
-}
-
-/**
- * Encodes a 4-color bitmap with XSUB rle.
- *
- * The encoded bitmap may be wider than the source bitmap due to padding.
- */
-static int xsub_encode_rle(PutBitContext *pb, const uint8_t *bitmap,
-                           int linesize, int w, int h)
-{
-    int x0, x1, y, len, color = PADDING_COLOR;
-
-    for (y = 0; y < h; y++) {
-        x0 = 0;
-        while (x0 < w) {
-            // Make sure we have enough room for at least one run and padding
-            if (pb->size_in_bits - put_bits_count(pb) < 7*8)
-                return -1;
-
-            x1 = x0;
-            color = bitmap[x1++] & 3;
-            while (x1 < w && (bitmap[x1] & 3) == color)
-                x1++;
-            len = x1 - x0;
-            if (PADDING && x0 == 0) {
-                if (color == PADDING_COLOR) {
-                    len += PADDING;
-                    x0  -= PADDING;
-                } else
-                    put_xsub_rle(pb, PADDING, PADDING_COLOR);
-            }
-
-            // Run can't be longer than 255, unless it is the rest of a row
-            if (x1 == w && color == PADDING_COLOR) {
-                len += PADDING + (w&1);
-            } else
-                len = FFMIN(len, 255);
-            put_xsub_rle(pb, len, color);
-
-            x0 += len;
-        }
-        if (color != PADDING_COLOR && (PADDING + (w&1)))
-            put_xsub_rle(pb, PADDING + (w&1), PADDING_COLOR);
-
-        align_put_bits(pb);
-
-        bitmap += linesize;
-    }
-
-    return 0;
-}
-
-static int make_tc(uint64_t ms, int *tc)
-{
-    static const int tc_divs[3] = { 1000, 60, 60 };
-    int i;
-    for (i=0; i<3; i++) {
-        tc[i] = ms % tc_divs[i];
-        ms /= tc_divs[i];
-    }
-    tc[3] = ms;
-    return ms > 99;
-}
-
-static int xsub_encode(AVCodecContext *avctx, unsigned char *buf,
-                       int bufsize, void *data)
-{
-    AVSubtitle *h = data;
-    uint64_t startTime = h->pts / 1000; // FIXME: need better solution...
-    uint64_t endTime = startTime + h->end_display_time - h->start_display_time;
-    int start_tc[4], end_tc[4];
-    uint8_t *hdr = buf + 27; // Point behind the timestamp
-    uint8_t *rlelenptr;
-    uint16_t width, height;
-    int i;
-    PutBitContext pb;
-
-    if (bufsize < 27 + 7*2 + 4*3) {
-        av_log(avctx, AV_LOG_ERROR, "Buffer too small for XSUB header.\n");
-        return -1;
-    }
-
-    // TODO: support multiple rects
-    if (h->num_rects > 1)
-        av_log(avctx, AV_LOG_WARNING, "Only single rects supported (%d in subtitle.)\n", h->num_rects);
-
-    // TODO: render text-based subtitles into bitmaps
-    if (!h->rects[0]->pict.data[0] || !h->rects[0]->pict.data[1]) {
-        av_log(avctx, AV_LOG_WARNING, "No subtitle bitmap available.\n");
-        return -1;
-    }
-
-    // TODO: color reduction, similar to dvdsub encoder
-    if (h->rects[0]->nb_colors > 4)
-        av_log(avctx, AV_LOG_WARNING, "No more than 4 subtitle colors supported (%d found.)\n", h->rects[0]->nb_colors);
-
-    // TODO: Palette swapping if color zero is not transparent
-    if (((uint32_t *)h->rects[0]->pict.data[1])[0] & 0xff)
-        av_log(avctx, AV_LOG_WARNING, "Color index 0 is not transparent. Transparency will be messed up.\n");
-
-    if (make_tc(startTime, start_tc) || make_tc(endTime, end_tc)) {
-        av_log(avctx, AV_LOG_WARNING, "Time code >= 100 hours.\n");
-        return -1;
-    }
-
-    snprintf(buf, 28,
-        "[%02d:%02d:%02d.%03d-%02d:%02d:%02d.%03d]",
-        start_tc[3], start_tc[2], start_tc[1], start_tc[0],
-        end_tc[3],   end_tc[2],   end_tc[1],   end_tc[0]);
-
-    // Width and height must probably be multiples of 2.
-    // 2 pixels required on either side of subtitle.
-    // Possibly due to limitations of hardware renderers.
-    // TODO: check if the bitmap is already padded
-    width  = FFALIGN(h->rects[0]->w, 2) + PADDING * 2;
-    height = FFALIGN(h->rects[0]->h, 2);
-
-    bytestream_put_le16(&hdr, width);
-    bytestream_put_le16(&hdr, height);
-    bytestream_put_le16(&hdr, h->rects[0]->x);
-    bytestream_put_le16(&hdr, h->rects[0]->y);
-    bytestream_put_le16(&hdr, h->rects[0]->x + width);
-    bytestream_put_le16(&hdr, h->rects[0]->y + height);
-
-    rlelenptr = hdr; // Will store length of first field here later.
-    hdr+=2;
-
-    // Palette
-    for (i=0; i<4; i++)
-        bytestream_put_be24(&hdr, ((uint32_t *)h->rects[0]->pict.data[1])[i]);
-
-    // Bitmap
-    // RLE buffer. Reserve 2 bytes for possible padding after the last row.
-    init_put_bits(&pb, hdr, bufsize - (hdr - buf) - 2);
-    if (xsub_encode_rle(&pb, h->rects[0]->pict.data[0],
-                        h->rects[0]->pict.linesize[0]*2,
-                        h->rects[0]->w, (h->rects[0]->h + 1) >> 1))
-        return -1;
-    bytestream_put_le16(&rlelenptr, put_bits_count(&pb) >> 3); // Length of first field
-
-    if (xsub_encode_rle(&pb, h->rects[0]->pict.data[0] + h->rects[0]->pict.linesize[0],
-                        h->rects[0]->pict.linesize[0]*2,
-                        h->rects[0]->w, h->rects[0]->h >> 1))
-        return -1;
-
-    // Enforce total height to be be multiple of 2
-    if (h->rects[0]->h & 1) {
-        put_xsub_rle(&pb, h->rects[0]->w, PADDING_COLOR);
-        align_put_bits(&pb);
-    }
-
-    flush_put_bits(&pb);
-
-    return hdr - buf + put_bits_count(&pb)/8;
-}
-
-static av_cold int xsub_encoder_init(AVCodecContext *avctx)
-{
-    if (!avctx->codec_tag)
-        avctx->codec_tag = MKTAG('D','X','S','B');
-
-    return 0;
-}
-
-AVCodec xsub_encoder = {
-    "xsub",
-    AVMEDIA_TYPE_SUBTITLE,
-    CODEC_ID_XSUB,
-    0,
-    xsub_encoder_init,
-    xsub_encode,
-    NULL,
-    .long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"),
-};
diff --git a/libavcodec/xvmc.h b/libavcodec/xvmc.h
deleted file mode 100644
index 01f84b2..0000000
--- a/libavcodec/xvmc.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2003 Ivan Kalvachev
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_XVMC_H
-#define AVCODEC_XVMC_H
-
-#include <X11/extensions/XvMC.h>
-
-#include "avcodec.h"
-
-#if LIBAVCODEC_VERSION_MAJOR < 53
-#define AV_XVMC_STATE_DISPLAY_PENDING          1  /**  the surface should be shown, the video driver manipulates this */
-#define AV_XVMC_STATE_PREDICTION               2  /**  the surface is needed for prediction, the codec manipulates this */
-#define AV_XVMC_STATE_OSD_SOURCE               4  /**  the surface is needed for subpicture rendering */
-#endif
-#define AV_XVMC_ID                    0x1DC711C0  /**< special value to ensure that regular pixel routines haven't corrupted the struct
-                                                       the number is 1337 speak for the letters IDCT MCo (motion compensation) */
-
-struct xvmc_pix_fmt {
-    /** The field contains the special constant value AV_XVMC_ID.
-        It is used as a test that the application correctly uses the API,
-        and that there is no corruption caused by pixel routines.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             xvmc_id;
-
-    /** Pointer to the block array allocated by XvMCCreateBlocks().
-        The array has to be freed by XvMCDestroyBlocks().
-        Each group of 64 values represents one data block of differential
-        pixel information (in MoCo mode) or coefficients for IDCT.
-        - application - set the pointer during initialization
-        - libavcodec  - fills coefficients/pixel data into the array
-    */
-    short*          data_blocks;
-
-    /** Pointer to the macroblock description array allocated by
-        XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
-        - application - set the pointer during initialization
-        - libavcodec  - fills description data into the array
-    */
-    XvMCMacroBlock* mv_blocks;
-
-    /** Number of macroblock descriptions that can be stored in the mv_blocks
-        array.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             allocated_mv_blocks;
-
-    /** Number of blocks that can be stored at once in the data_blocks array.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             allocated_data_blocks;
-
-    /** Indicates that the hardware would interpret data_blocks as IDCT
-        coefficients and perform IDCT on them.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             idct;
-
-    /** In MoCo mode it indicates that intra macroblocks are assumed to be in
-        unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    int             unsigned_intra;
-
-    /** Pointer to the surface allocated by XvMCCreateSurface().
-        It has to be freed by XvMCDestroySurface() on application exit.
-        It identifies the frame and its state on the video hardware.
-        - application - set during initialization
-        - libavcodec  - unchanged
-    */
-    XvMCSurface*    p_surface;
-
-/** Set by the decoder before calling ff_draw_horiz_band(),
-    needed by the XvMCRenderSurface function. */
-//@{
-    /** Pointer to the surface used as past reference
-        - application - unchanged
-        - libavcodec  - set
-    */
-    XvMCSurface*    p_past_surface;
-
-    /** Pointer to the surface used as future reference
-        - application - unchanged
-        - libavcodec  - set
-    */
-    XvMCSurface*    p_future_surface;
-
-    /** top/bottom field or frame
-        - application - unchanged
-        - libavcodec  - set
-    */
-    unsigned int    picture_structure;
-
-    /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
-        - application - unchanged
-        - libavcodec  - set
-    */
-    unsigned int    flags;
-//}@
-
-    /** Number of macroblock descriptions in the mv_blocks array
-        that have already been passed to the hardware.
-        - application - zeroes it on get_buffer().
-                        A successful ff_draw_horiz_band() may increment it
-                        with filled_mb_block_num or zero both.
-        - libavcodec  - unchanged
-    */
-    int             start_mv_blocks_num;
-
-    /** Number of new macroblock descriptions in the mv_blocks array (after
-        start_mv_blocks_num) that are filled by libavcodec and have to be
-        passed to the hardware.
-        - application - zeroes it on get_buffer() or after successful
-                        ff_draw_horiz_band().
-        - libavcodec  - increment with one of each stored MB
-    */
-    int             filled_mv_blocks_num;
-
-    /** Number of the the next free data block; one data block consists of
-        64 short values in the data_blocks array.
-        All blocks before this one have already been claimed by placing their
-        position into the corresponding block description structure field,
-        that are part of the mv_blocks array.
-        - application - zeroes it on get_buffer().
-                        A successful ff_draw_horiz_band() may zero it together
-                        with start_mb_blocks_num.
-        - libavcodec  - each decoded macroblock increases it by the number
-                        of coded blocks it contains.
-    */
-    int             next_free_data_block_num;
-
-/** extensions may be placed here */
-#if LIBAVCODEC_VERSION_MAJOR < 53
-//@{
-    /** State flags used to work around limitations in the MPlayer video system.
-        0   - Surface is not used.
-        1   - Surface is still held in application to be displayed or is
-              still visible.
-        2   - Surface is still held in libavcodec buffer for prediction.
-    */
-    int             state;
-
-    /** pointer to the surface where the subpicture is rendered */
-    void*           p_osd_target_surface_render;
-//}@
-#endif
-};
-
-#endif /* AVCODEC_XVMC_H */
diff --git a/libavcodec/xvmc_internal.h b/libavcodec/xvmc_internal.h
deleted file mode 100644
index 9bb8909..0000000
--- a/libavcodec/xvmc_internal.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * XVideo Motion Compensation internal functions
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_INTERNAL_XVMC_H
-#define AVCODEC_INTERNAL_XVMC_H
-
-#include "avcodec.h"
-#include "mpegvideo.h"
-
-void ff_xvmc_init_block(MpegEncContext *s);
-void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp);
-int  ff_xvmc_field_start(MpegEncContext*s, AVCodecContext *avctx);
-void ff_xvmc_field_end(MpegEncContext *s);
-void ff_xvmc_decode_mb(MpegEncContext *s);
-
-#endif /* AVCODEC_INTERNAL_XVMC_H */
diff --git a/libavcodec/yop.c b/libavcodec/yop.c
deleted file mode 100644
index 1eb76b1..0000000
--- a/libavcodec/yop.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/**
- * @file
- * Psygnosis YOP decoder
- *
- * Copyright (C) 2010 Mohamed Naufal Basheer <naufal11 at gmail.com>
- * derived from the code by
- * Copyright (C) 2009 Thomas P. Higdon <thomas.p.higdon at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-
-#include "avcodec.h"
-#include "get_bits.h"
-
-typedef struct YopDecContext {
-    AVFrame frame;
-    AVCodecContext *avctx;
-
-    int num_pal_colors;
-    int first_color[2];
-    int frame_data_length;
-    int row_pos;
-
-    uint8_t *low_nibble;
-    uint8_t *srcptr;
-    uint8_t *dstptr;
-    uint8_t *dstbuf;
-} YopDecContext;
-
-// These tables are taken directly from:
-// http://wiki.multimedia.cx/index.php?title=Psygnosis_YOP
-
-/**
- * Lookup table for painting macroblocks. Bytes 0-2 of each entry contain
- * the macroblock positions to be painted (taken as (0, B0, B1, B2)).
- * Byte 3 contains the number of bytes consumed on the input,
- * equal to max(bytes 0-2) + 1.
- */
-static const uint8_t paint_lut[15][4] =
-    {{1, 2, 3, 4}, {1, 2, 0, 3},
-     {1, 2, 1, 3}, {1, 2, 2, 3},
-     {1, 0, 2, 3}, {1, 0, 0, 2},
-     {1, 0, 1, 2}, {1, 1, 2, 3},
-     {0, 1, 2, 3}, {0, 1, 0, 2},
-     {1, 1, 0, 2}, {0, 1, 1, 2},
-     {0, 0, 1, 2}, {0, 0, 0, 1},
-     {1, 1, 1, 2},
-    };
-
-/**
- * Lookup table for copying macroblocks. Each entry contains the respective
- * x and y pixel offset for the copy source.
- */
-static const int8_t motion_vector[16][2] =
-    {{-4, -4}, {-2, -4},
-     { 0, -4}, { 2, -4},
-     {-4, -2}, {-4,  0},
-     {-3, -3}, {-1, -3},
-     { 1, -3}, { 3, -3},
-     {-3, -1}, {-2, -2},
-     { 0, -2}, { 2, -2},
-     { 4, -2}, {-2,  0},
-    };
-
-static av_cold int yop_decode_init(AVCodecContext *avctx)
-{
-    YopDecContext *s = avctx->priv_data;
-    s->avctx = avctx;
-
-    if (avctx->width & 1 || avctx->height & 1 ||
-        avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "YOP has invalid dimensions\n");
-        return -1;
-    }
-
-    avctx->pix_fmt = PIX_FMT_PAL8;
-
-    s->num_pal_colors = avctx->extradata[0];
-    s->first_color[0] = avctx->extradata[1];
-    s->first_color[1] = avctx->extradata[2];
-
-    if (s->num_pal_colors + s->first_color[0] > 256 ||
-        s->num_pal_colors + s->first_color[1] > 256) {
-        av_log(avctx, AV_LOG_ERROR,
-               "YOP: palette parameters invalid, header probably corrupt\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    return 0;
-}
-
-static av_cold int yop_decode_close(AVCodecContext *avctx)
-{
-    YopDecContext *s = avctx->priv_data;
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-    return 0;
-}
-
-/**
- * Paints a macroblock using the pattern in paint_lut.
- * @param s codec context
- * @param tag the tag that was in the nibble
- */
-static void yop_paint_block(YopDecContext *s, int tag)
-{
-    s->dstptr[0]                        = s->srcptr[0];
-    s->dstptr[1]                        = s->srcptr[paint_lut[tag][0]];
-    s->dstptr[s->frame.linesize[0]]     = s->srcptr[paint_lut[tag][1]];
-    s->dstptr[s->frame.linesize[0] + 1] = s->srcptr[paint_lut[tag][2]];
-
-    // The number of src bytes consumed is in the last part of the lut entry.
-    s->srcptr += paint_lut[tag][3];
-}
-
-/**
- * Copies a previously painted macroblock to the current_block.
- * @param copy_tag the tag that was in the nibble
- */
-static int yop_copy_previous_block(YopDecContext *s, int copy_tag)
-{
-    uint8_t *bufptr;
-
-    // Calculate position for the copy source
-    bufptr = s->dstptr + motion_vector[copy_tag][0] +
-             s->frame.linesize[0] * motion_vector[copy_tag][1];
-    if (bufptr < s->dstbuf) {
-        av_log(s->avctx, AV_LOG_ERROR,
-               "YOP: cannot decode, file probably corrupt\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    s->dstptr[0]                        = bufptr[0];
-    s->dstptr[1]                        = bufptr[1];
-    s->dstptr[s->frame.linesize[0]]     = bufptr[s->frame.linesize[0]];
-    s->dstptr[s->frame.linesize[0] + 1] = bufptr[s->frame.linesize[0] + 1];
-
-    return 0;
-}
-
-/**
- * Returns the next nibble in sequence, consuming a new byte on the input
- * only if necessary.
- */
-static uint8_t yop_get_next_nibble(YopDecContext *s)
-{
-    int ret;
-
-    if (s->low_nibble) {
-        ret           = *s->low_nibble & 0xf;
-        s->low_nibble = NULL;
-    }else {
-        s->low_nibble = s->srcptr++;
-        ret           = *s->low_nibble >> 4;
-    }
-    return ret;
-}
-
-/**
- * Takes s->dstptr to the next macroblock in sequence.
- */
-static void yop_next_macroblock(YopDecContext *s)
-{
-    // If we are advancing to the next row of macroblocks
-    if (s->row_pos == s->frame.linesize[0] - 2) {
-        s->dstptr  += s->frame.linesize[0];
-        s->row_pos =  0;
-    }else {
-        s->row_pos += 2;
-    }
-    s->dstptr += 2;
-}
-
-static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
-                            AVPacket *avpkt)
-{
-    YopDecContext *s = avctx->priv_data;
-    int tag, firstcolor, is_odd_frame;
-    int ret, i;
-    uint32_t *palette;
-
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    ret = avctx->get_buffer(avctx, &s->frame);
-    if (ret < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return ret;
-    }
-
-    s->frame.linesize[0] = avctx->width;
-
-    s->dstbuf     = s->frame.data[0];
-    s->dstptr     = s->frame.data[0];
-    s->srcptr     = avpkt->data + 4;
-    s->row_pos    = 0;
-    s->low_nibble = NULL;
-
-    is_odd_frame = avpkt->data[0];
-    firstcolor   = s->first_color[is_odd_frame];
-    palette      = (uint32_t *)s->frame.data[1];
-
-    for (i = 0; i < s->num_pal_colors; i++, s->srcptr += 3)
-        palette[i + firstcolor] = (s->srcptr[0] << 18) |
-                                  (s->srcptr[1] << 10) |
-                                  (s->srcptr[2] << 2);
-
-    s->frame.palette_has_changed = 1;
-
-    while (s->dstptr - s->dstbuf <
-           avctx->width * avctx->height &&
-           s->srcptr - avpkt->data < avpkt->size) {
-
-        tag = yop_get_next_nibble(s);
-
-        if (tag != 0xf) {
-            yop_paint_block(s, tag);
-        }else {
-            tag = yop_get_next_nibble(s);
-            ret = yop_copy_previous_block(s, tag);
-            if (ret < 0) {
-                avctx->release_buffer(avctx, &s->frame);
-                return ret;
-            }
-        }
-        yop_next_macroblock(s);
-    }
-
-    *data_size        = sizeof(AVFrame);
-    *(AVFrame *) data = s->frame;
-    return avpkt->size;
-}
-
-AVCodec yop_decoder = {
-    "yop",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_YOP,
-    sizeof(YopDecContext),
-    yop_decode_init,
-    NULL,
-    yop_decode_close,
-    yop_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"),
-};
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
deleted file mode 100644
index 8af8c84..0000000
--- a/libavcodec/zmbv.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/*
- * Zip Motion Blocks Video (ZMBV) decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Zip Motion Blocks Video decoder
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#include <zlib.h>
-
-#define ZMBV_KEYFRAME 1
-#define ZMBV_DELTAPAL 2
-
-enum ZmbvFormat {
-    ZMBV_FMT_NONE  = 0,
-    ZMBV_FMT_1BPP  = 1,
-    ZMBV_FMT_2BPP  = 2,
-    ZMBV_FMT_4BPP  = 3,
-    ZMBV_FMT_8BPP  = 4,
-    ZMBV_FMT_15BPP = 5,
-    ZMBV_FMT_16BPP = 6,
-    ZMBV_FMT_24BPP = 7,
-    ZMBV_FMT_32BPP = 8
-};
-
-/*
- * Decoder context
- */
-typedef struct ZmbvContext {
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    int bpp;
-    unsigned int decomp_size;
-    uint8_t* decomp_buf;
-    uint8_t pal[768];
-    uint8_t *prev, *cur;
-    int width, height;
-    int fmt;
-    int comp;
-    int flags;
-    int bw, bh, bx, by;
-    int decomp_len;
-    z_stream zstream;
-    int (*decode_intra)(struct ZmbvContext *c);
-    int (*decode_xor)(struct ZmbvContext *c);
-} ZmbvContext;
-
-/**
- * Decode XOR'ed frame - 8bpp version
- */
-
-static int zmbv_decode_xor_8(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint8_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-
-    output = c->cur;
-    prev = c->prev;
-
-    if(c->flags & ZMBV_DELTAPAL){
-        for(i = 0; i < 768; i++)
-            c->pal[i] ^= *src++;
-    }
-
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint8_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x;
-            tprev = prev + x + dx + dy * c->width;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width))
-                            out[i] = 0;
-                        else
-                            out[i] = tprev[i];
-                    }
-                }
-                out += c->width;
-                tprev += c->width;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++)
-                        out[i] ^= *src++;
-                    out += c->width;
-                }
-            }
-        }
-        output += c->width * c->bh;
-        prev += c->width * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %ti of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-
-/**
- * Decode XOR'ed frame - 15bpp and 16bpp version
- */
-
-static int zmbv_decode_xor_16(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint16_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-
-    output = (uint16_t*)c->cur;
-    prev = (uint16_t*)c->prev;
-
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint16_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x;
-            tprev = prev + x + dx + dy * c->width;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2 * 2);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width))
-                            out[i] = 0;
-                        else
-                            out[i] = tprev[i];
-                    }
-                }
-                out += c->width;
-                tprev += c->width;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++) {
-                        out[i] ^= *((uint16_t*)src);
-                        src += 2;
-                    }
-                    out += c->width;
-                }
-            }
-        }
-        output += c->width * c->bh;
-        prev += c->width * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %ti of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-
-#ifdef ZMBV_ENABLE_24BPP
-/**
- * Decode XOR'ed frame - 24bpp version
- */
-
-static int zmbv_decode_xor_24(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint8_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-    int stride;
-
-    output = c->cur;
-    prev = c->prev;
-
-    stride = c->width * 3;
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint8_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x * 3;
-            tprev = prev + (x + dx) * 3 + dy * stride;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2 * 3);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width)) {
-                            out[i * 3 + 0] = 0;
-                            out[i * 3 + 1] = 0;
-                            out[i * 3 + 2] = 0;
-                        } else {
-                            out[i * 3 + 0] = tprev[i * 3 + 0];
-                            out[i * 3 + 1] = tprev[i * 3 + 1];
-                            out[i * 3 + 2] = tprev[i * 3 + 2];
-                        }
-                    }
-                }
-                out += stride;
-                tprev += stride;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x * 3;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++) {
-                        out[i * 3 + 0] ^= *src++;
-                        out[i * 3 + 1] ^= *src++;
-                        out[i * 3 + 2] ^= *src++;
-                    }
-                    out += stride;
-                }
-            }
-        }
-        output += stride * c->bh;
-        prev += stride * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-#endif //ZMBV_ENABLE_24BPP
-
-/**
- * Decode XOR'ed frame - 32bpp version
- */
-
-static int zmbv_decode_xor_32(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint32_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-
-    output = (uint32_t*)c->cur;
-    prev = (uint32_t*)c->prev;
-
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint32_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x;
-            tprev = prev + x + dx + dy * c->width;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2 * 4);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width))
-                            out[i] = 0;
-                        else
-                            out[i] = tprev[i];
-                    }
-                }
-                out += c->width;
-                tprev += c->width;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++) {
-                        out[i] ^= *((uint32_t*)src);
-                        src += 4;
-                    }
-                    out += c->width;
-                }
-            }
-        }
-        output += c->width * c->bh;
-        prev += c->width * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %ti of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-
-/**
- * Decode intraframe
- */
-static int zmbv_decode_intra(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-
-    /* make the palette available on the way out */
-    if (c->fmt == ZMBV_FMT_8BPP) {
-        memcpy(c->pal, src, 768);
-        src += 768;
-    }
-
-    memcpy(c->cur, src, c->width * c->height * (c->bpp / 8));
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
-{
-    const uint8_t *buf = avpkt->data;
-    int buf_size = avpkt->size;
-    ZmbvContext * const c = avctx->priv_data;
-    uint8_t *outptr;
-    int zret = Z_OK; // Zlib return code
-    int len = buf_size;
-    int hi_ver, lo_ver;
-
-    if(c->pic.data[0])
-            avctx->release_buffer(avctx, &c->pic);
-
-    c->pic.reference = 1;
-    c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    outptr = c->pic.data[0]; // Output image pointer
-
-    /* parse header */
-    c->flags = buf[0];
-    buf++; len--;
-    if(c->flags & ZMBV_KEYFRAME) {
-        hi_ver = buf[0];
-        lo_ver = buf[1];
-        c->comp = buf[2];
-        c->fmt = buf[3];
-        c->bw = buf[4];
-        c->bh = buf[5];
-
-        buf += 6;
-        len -= 6;
-        av_log(avctx, AV_LOG_DEBUG, "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
-        if(hi_ver != 0 || lo_ver != 1) {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported version %i.%i\n", hi_ver, lo_ver);
-            return -1;
-        }
-        if(c->bw == 0 || c->bh == 0) {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported block size %ix%i\n", c->bw, c->bh);
-            return -1;
-        }
-        if(c->comp != 0 && c->comp != 1) {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported compression type %i\n", c->comp);
-            return -1;
-        }
-
-        switch(c->fmt) {
-        case ZMBV_FMT_8BPP:
-            c->bpp = 8;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_8;
-            break;
-        case ZMBV_FMT_15BPP:
-        case ZMBV_FMT_16BPP:
-            c->bpp = 16;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_16;
-            break;
-#ifdef ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_24BPP:
-            c->bpp = 24;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_24;
-            break;
-#endif //ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_32BPP:
-            c->bpp = 32;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_32;
-            break;
-        default:
-            c->decode_intra = NULL;
-            c->decode_xor = NULL;
-            av_log(avctx, AV_LOG_ERROR, "Unsupported (for now) format %i\n", c->fmt);
-            return -1;
-        }
-
-        zret = inflateReset(&c->zstream);
-        if (zret != Z_OK) {
-            av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
-            return -1;
-        }
-
-        c->cur = av_realloc(c->cur, avctx->width * avctx->height * (c->bpp / 8));
-        c->prev = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
-        c->bx = (c->width + c->bw - 1) / c->bw;
-        c->by = (c->height+ c->bh - 1) / c->bh;
-    }
-
-    if(c->decode_intra == NULL) {
-        av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
-        return -1;
-    }
-
-    if(c->comp == 0) { //Uncompressed data
-        memcpy(c->decomp_buf, buf, len);
-        c->decomp_size = 1;
-    } else { // ZLIB-compressed data
-        c->zstream.total_in = c->zstream.total_out = 0;
-        c->zstream.next_in = buf;
-        c->zstream.avail_in = len;
-        c->zstream.next_out = c->decomp_buf;
-        c->zstream.avail_out = c->decomp_size;
-        inflate(&c->zstream, Z_FINISH);
-        c->decomp_len = c->zstream.total_out;
-    }
-    if(c->flags & ZMBV_KEYFRAME) {
-        c->pic.key_frame = 1;
-        c->pic.pict_type = FF_I_TYPE;
-        c->decode_intra(c);
-    } else {
-        c->pic.key_frame = 0;
-        c->pic.pict_type = FF_P_TYPE;
-        if(c->decomp_len)
-            c->decode_xor(c);
-    }
-
-    /* update frames */
-    {
-        uint8_t *out, *src;
-        int i, j;
-
-        out = c->pic.data[0];
-        src = c->cur;
-        switch(c->fmt) {
-        case ZMBV_FMT_8BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    out[i * 3 + 0] = c->pal[(*src) * 3 + 0];
-                    out[i * 3 + 1] = c->pal[(*src) * 3 + 1];
-                    out[i * 3 + 2] = c->pal[(*src) * 3 + 2];
-                    src++;
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-        case ZMBV_FMT_15BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    uint16_t tmp = AV_RL16(src);
-                    src += 2;
-                    out[i * 3 + 0] = (tmp & 0x7C00) >> 7;
-                    out[i * 3 + 1] = (tmp & 0x03E0) >> 2;
-                    out[i * 3 + 2] = (tmp & 0x001F) << 3;
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-        case ZMBV_FMT_16BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    uint16_t tmp = AV_RL16(src);
-                    src += 2;
-                    out[i * 3 + 0] = (tmp & 0xF800) >> 8;
-                    out[i * 3 + 1] = (tmp & 0x07E0) >> 3;
-                    out[i * 3 + 2] = (tmp & 0x001F) << 3;
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-#ifdef ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_24BPP:
-            for(j = 0; j < c->height; j++) {
-                memcpy(out, src, c->width * 3);
-                src += c->width * 3;
-                out += c->pic.linesize[0];
-            }
-            break;
-#endif //ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_32BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    uint32_t tmp = AV_RL32(src);
-                    src += 4;
-                    AV_WB24(out+(i*3), tmp);
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Cannot handle format %i\n", c->fmt);
-        }
-        memcpy(c->prev, c->cur, c->width * c->height * (c->bpp / 8));
-    }
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-
-/*
- *
- * Init zmbv decoder
- *
- */
-static av_cold int decode_init(AVCodecContext *avctx)
-{
-    ZmbvContext * const c = avctx->priv_data;
-    int zret; // Zlib return code
-
-    c->avctx = avctx;
-
-    c->width = avctx->width;
-    c->height = avctx->height;
-
-    c->bpp = avctx->bits_per_coded_sample;
-
-    // Needed if zlib unused or init aborted before inflateInit
-    memset(&(c->zstream), 0, sizeof(z_stream));
-
-    avctx->pix_fmt = PIX_FMT_RGB24;
-    c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
-
-    /* Allocate decompression buffer */
-    if (c->decomp_size) {
-        if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-            return 1;
-        }
-    }
-
-    c->zstream.zalloc = Z_NULL;
-    c->zstream.zfree = Z_NULL;
-    c->zstream.opaque = Z_NULL;
-    zret = inflateInit(&(c->zstream));
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
-        return 1;
-    }
-
-    return 0;
-}
-
-
-
-/*
- *
- * Uninit zmbv decoder
- *
- */
-static av_cold int decode_end(AVCodecContext *avctx)
-{
-    ZmbvContext * const c = avctx->priv_data;
-
-    av_freep(&c->decomp_buf);
-
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-    inflateEnd(&(c->zstream));
-    av_freep(&c->cur);
-    av_freep(&c->prev);
-
-    return 0;
-}
-
-AVCodec zmbv_decoder = {
-    "zmbv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ZMBV,
-    sizeof(ZmbvContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
-};
-
diff --git a/libavcodec/zmbvenc.c b/libavcodec/zmbvenc.c
deleted file mode 100644
index 95f2906..0000000
--- a/libavcodec/zmbvenc.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Zip Motion Blocks Video (ZMBV) encoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Zip Motion Blocks Video encoder
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avcodec.h"
-
-#include <zlib.h>
-
-#define ZMBV_KEYFRAME 1
-#define ZMBV_DELTAPAL 2
-
-#define ZMBV_BLOCK 16
-
-/**
- * Encoder context
- */
-typedef struct ZmbvEncContext {
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    int range;
-    uint8_t *comp_buf, *work_buf;
-    uint8_t pal[768];
-    uint32_t pal2[256]; //for quick comparisons
-    uint8_t *prev;
-    int pstride;
-    int comp_size;
-    int keyint, curfrm;
-    z_stream zstream;
-} ZmbvEncContext;
-
-static int score_tab[256];
-
-/** Block comparing function
- * XXX should be optimized and moved to DSPContext
- * TODO handle out of edge ME
- */
-static inline int block_cmp(uint8_t *src, int stride, uint8_t *src2, int stride2,
-                            int bw, int bh, int *xored)
-{
-    int sum = 0;
-    int i, j;
-    uint8_t histogram[256] = {0};
-
-    *xored = 0;
-    for(j = 0; j < bh; j++){
-        for(i = 0; i < bw; i++){
-            int t = src[i] ^ src2[i];
-            histogram[t]++;
-            *xored |= t;
-        }
-        src += stride;
-        src2 += stride2;
-    }
-
-    for(i = 1; i < 256; i++)
-        sum += score_tab[histogram[i]];
-
-    return sum;
-}
-
-/** Motion estimation function
- * TODO make better ME decisions
- */
-static int zmbv_me(ZmbvEncContext *c, uint8_t *src, int sstride, uint8_t *prev,
-                   int pstride, int x, int y, int *mx, int *my, int *xored)
-{
-    int dx, dy, tx, ty, tv, bv, bw, bh;
-
-    *mx = *my = 0;
-    bw = FFMIN(ZMBV_BLOCK, c->avctx->width - x);
-    bh = FFMIN(ZMBV_BLOCK, c->avctx->height - y);
-    bv = block_cmp(src, sstride, prev, pstride, bw, bh, xored);
-    if(!bv) return 0;
-    for(ty = FFMAX(y - c->range, 0); ty < FFMIN(y + c->range, c->avctx->height - bh); ty++){
-        for(tx = FFMAX(x - c->range, 0); tx < FFMIN(x + c->range, c->avctx->width - bw); tx++){
-            if(tx == x && ty == y) continue; // we already tested this block
-            dx = tx - x;
-            dy = ty - y;
-            tv = block_cmp(src, sstride, prev + dx + dy*pstride, pstride, bw, bh, xored);
-            if(tv < bv){
-                 bv = tv;
-                 *mx = dx;
-                 *my = dy;
-                 if(!bv) return 0;
-             }
-         }
-    }
-    return bv;
-}
-
-static int encode_frame(AVCodecContext *avctx, uint8_t *buf, int buf_size, void *data)
-{
-    ZmbvEncContext * const c = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p = &c->pic;
-    uint8_t *src, *prev;
-    uint32_t *palptr;
-    int len = 0;
-    int keyframe, chpal;
-    int fl;
-    int work_size = 0;
-    int bw, bh;
-    int i, j;
-
-    keyframe = !c->curfrm;
-    c->curfrm++;
-    if(c->curfrm == c->keyint)
-        c->curfrm = 0;
-    *p = *pict;
-    p->pict_type= keyframe ? FF_I_TYPE : FF_P_TYPE;
-    p->key_frame= keyframe;
-    chpal = !keyframe && memcmp(p->data[1], c->pal2, 1024);
-
-    fl = (keyframe ? ZMBV_KEYFRAME : 0) | (chpal ? ZMBV_DELTAPAL : 0);
-    *buf++ = fl; len++;
-    if(keyframe){
-        deflateReset(&c->zstream);
-        *buf++ = 0; len++; // hi ver
-        *buf++ = 1; len++; // lo ver
-        *buf++ = 1; len++; // comp
-        *buf++ = 4; len++; // format - 8bpp
-        *buf++ = ZMBV_BLOCK; len++; // block width
-        *buf++ = ZMBV_BLOCK; len++; // block height
-    }
-    palptr = (uint32_t*)p->data[1];
-    src = p->data[0];
-    prev = c->prev;
-    if(chpal){
-        uint8_t tpal[3];
-        for(i = 0; i < 256; i++){
-            AV_WB24(tpal, palptr[i]);
-            c->work_buf[work_size++] = tpal[0] ^ c->pal[i * 3 + 0];
-            c->work_buf[work_size++] = tpal[1] ^ c->pal[i * 3 + 1];
-            c->work_buf[work_size++] = tpal[2] ^ c->pal[i * 3 + 2];
-            c->pal[i * 3 + 0] = tpal[0];
-            c->pal[i * 3 + 1] = tpal[1];
-            c->pal[i * 3 + 2] = tpal[2];
-        }
-        memcpy(c->pal2, p->data[1], 1024);
-    }
-    if(keyframe){
-        for(i = 0; i < 256; i++){
-            AV_WB24(c->pal+(i*3), palptr[i]);
-        }
-        memcpy(c->work_buf, c->pal, 768);
-        memcpy(c->pal2, p->data[1], 1024);
-        work_size = 768;
-        for(i = 0; i < avctx->height; i++){
-            memcpy(c->work_buf + work_size, src, avctx->width);
-            src += p->linesize[0];
-            work_size += avctx->width;
-        }
-    }else{
-        int x, y, bh2, bw2, xored;
-        uint8_t *tsrc, *tprev;
-        uint8_t *mv;
-        int mx, my, bv;
-
-        bw = (avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK;
-        bh = (avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK;
-        mv = c->work_buf + work_size;
-        memset(c->work_buf + work_size, 0, (bw * bh * 2 + 3) & ~3);
-        work_size += (bw * bh * 2 + 3) & ~3;
-        /* for now just XOR'ing */
-        for(y = 0; y < avctx->height; y += ZMBV_BLOCK) {
-            bh2 = FFMIN(avctx->height - y, ZMBV_BLOCK);
-            for(x = 0; x < avctx->width; x += ZMBV_BLOCK, mv += 2) {
-                bw2 = FFMIN(avctx->width - x, ZMBV_BLOCK);
-
-                tsrc = src + x;
-                tprev = prev + x;
-
-                bv = zmbv_me(c, tsrc, p->linesize[0], tprev, c->pstride, x, y, &mx, &my, &xored);
-                mv[0] = (mx << 1) | !!xored;
-                mv[1] = my << 1;
-                tprev += mx + my * c->pstride;
-                if(xored){
-                    for(j = 0; j < bh2; j++){
-                        for(i = 0; i < bw2; i++)
-                            c->work_buf[work_size++] = tsrc[i] ^ tprev[i];
-                        tsrc += p->linesize[0];
-                        tprev += c->pstride;
-                    }
-                }
-            }
-            src += p->linesize[0] * ZMBV_BLOCK;
-            prev += c->pstride * ZMBV_BLOCK;
-        }
-    }
-    /* save the previous frame */
-    src = p->data[0];
-    prev = c->prev;
-    for(i = 0; i < avctx->height; i++){
-        memcpy(prev, src, avctx->width);
-        prev += c->pstride;
-        src += p->linesize[0];
-    }
-
-    c->zstream.next_in = c->work_buf;
-    c->zstream.avail_in = work_size;
-    c->zstream.total_in = 0;
-
-    c->zstream.next_out = c->comp_buf;
-    c->zstream.avail_out = c->comp_size;
-    c->zstream.total_out = 0;
-    if(deflate(&c->zstream, Z_SYNC_FLUSH) != Z_OK){
-        av_log(avctx, AV_LOG_ERROR, "Error compressing data\n");
-        return -1;
-    }
-
-    memcpy(buf, c->comp_buf, c->zstream.total_out);
-    return len + c->zstream.total_out;
-}
-
-
-/**
- * Init zmbv encoder
- */
-static av_cold int encode_init(AVCodecContext *avctx)
-{
-    ZmbvEncContext * const c = avctx->priv_data;
-    int zret; // Zlib return code
-    int i;
-    int lvl = 9;
-
-    for(i=1; i<256; i++)
-        score_tab[i]= -i * log(i/(double)(ZMBV_BLOCK*ZMBV_BLOCK)) * (256/M_LN2);
-
-    c->avctx = avctx;
-
-    c->curfrm = 0;
-    c->keyint = avctx->keyint_min;
-    c->range = 8;
-    if(avctx->me_range > 0)
-        c->range = FFMIN(avctx->me_range, 127);
-
-    if(avctx->compression_level >= 0)
-        lvl = avctx->compression_level;
-    if(lvl < 0 || lvl > 9){
-        av_log(avctx, AV_LOG_ERROR, "Compression level should be 0-9, not %i\n", lvl);
-        return -1;
-    }
-
-    // Needed if zlib unused or init aborted before deflateInit
-    memset(&(c->zstream), 0, sizeof(z_stream));
-    c->comp_size = avctx->width * avctx->height + 1024 +
-        ((avctx->width + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * ((avctx->height + ZMBV_BLOCK - 1) / ZMBV_BLOCK) * 2 + 4;
-    if ((c->work_buf = av_malloc(c->comp_size)) == NULL) {
-        av_log(avctx, AV_LOG_ERROR, "Can't allocate work buffer.\n");
-        return -1;
-    }
-    /* Conservative upper bound taken from zlib v1.2.1 source via lcl.c */
-    c->comp_size = c->comp_size + ((c->comp_size + 7) >> 3) +
-                           ((c->comp_size + 63) >> 6) + 11;
-
-    /* Allocate compression buffer */
-    if ((c->comp_buf = av_malloc(c->comp_size)) == NULL) {
-        av_log(avctx, AV_LOG_ERROR, "Can't allocate compression buffer.\n");
-        return -1;
-    }
-    c->pstride = FFALIGN(avctx->width, 16);
-    if ((c->prev = av_malloc(c->pstride * avctx->height)) == NULL) {
-        av_log(avctx, AV_LOG_ERROR, "Can't allocate picture.\n");
-        return -1;
-    }
-
-    c->zstream.zalloc = Z_NULL;
-    c->zstream.zfree = Z_NULL;
-    c->zstream.opaque = Z_NULL;
-    zret = deflateInit(&(c->zstream), lvl);
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
-        return -1;
-    }
-
-    avctx->coded_frame = (AVFrame*)&c->pic;
-
-    return 0;
-}
-
-
-
-/**
- * Uninit zmbv encoder
- */
-static av_cold int encode_end(AVCodecContext *avctx)
-{
-    ZmbvEncContext * const c = avctx->priv_data;
-
-    av_freep(&c->comp_buf);
-    av_freep(&c->work_buf);
-
-    deflateEnd(&(c->zstream));
-    av_freep(&c->prev);
-
-    return 0;
-}
-
-AVCodec zmbv_encoder = {
-    "zmbv",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ZMBV,
-    sizeof(ZmbvEncContext),
-    encode_init,
-    encode_frame,
-    encode_end,
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_PAL8, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"),
-};
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
deleted file mode 100644
index a0c3858..0000000
--- a/libavdevice/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME    = avdevice
-FFLIBS  = avformat avcodec avutil
-
-HEADERS = avdevice.h
-
-OBJS    = alldevices.o avdevice.o
-
-# input/output devices
-OBJS-$(CONFIG_ALSA_INDEV)                += alsa-audio-common.o \
-                                            alsa-audio-dec.o
-OBJS-$(CONFIG_ALSA_OUTDEV)               += alsa-audio-common.o \
-                                            alsa-audio-enc.o
-OBJS-$(CONFIG_BKTR_INDEV)                += bktr.o
-OBJS-$(CONFIG_DV1394_INDEV)              += dv1394.o
-OBJS-$(CONFIG_JACK_INDEV)                += jack_audio.o
-OBJS-$(CONFIG_OSS_INDEV)                 += oss_audio.o
-OBJS-$(CONFIG_OSS_OUTDEV)                += oss_audio.o
-OBJS-$(CONFIG_V4L2_INDEV)                += v4l2.o
-OBJS-$(CONFIG_V4L_INDEV)                 += v4l.o
-OBJS-$(CONFIG_VFWCAP_INDEV)              += vfwcap.o
-OBJS-$(CONFIG_X11_GRAB_DEVICE_INDEV)     += x11grab.o
-
-# external libraries
-OBJS-$(CONFIG_LIBDC1394_INDEV)           += libdc1394.o
-
-OBJS-$(CONFIG_AUDIO_BEOS_INDEV)          += beosaudio.o
-OBJS-$(CONFIG_AUDIO_BEOS_OUTDEV)         += beosaudio.o
-
-SKIPHEADERS-$(HAVE_ALSA_ASOUNDLIB_H)     += alsa-audio.h
-
-include $(SUBDIR)../subdir.mak
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
deleted file mode 100644
index e7a9a5e..0000000
--- a/libavdevice/alldevices.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Register all the grabbing devices.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "libavformat/avformat.h"
-#include "avdevice.h"
-
-#define REGISTER_OUTDEV(X,x) { \
-          extern AVOutputFormat x##_muxer; \
-          if(CONFIG_##X##_OUTDEV)  av_register_output_format(&x##_muxer); }
-#define REGISTER_INDEV(X,x) { \
-          extern AVInputFormat x##_demuxer; \
-          if(CONFIG_##X##_INDEV)   av_register_input_format(&x##_demuxer); }
-#define REGISTER_INOUTDEV(X,x)  REGISTER_OUTDEV(X,x); REGISTER_INDEV(X,x)
-
-void avdevice_register_all(void)
-{
-    static int initialized;
-
-    if (initialized)
-        return;
-    initialized = 1;
-
-    /* devices */
-    REGISTER_INOUTDEV (ALSA, alsa);
-    REGISTER_INOUTDEV (AUDIO_BEOS, audio_beos);
-    REGISTER_INDEV    (BKTR, bktr);
-    REGISTER_INDEV    (DV1394, dv1394);
-    REGISTER_INDEV    (JACK, jack);
-    REGISTER_INOUTDEV (OSS, oss);
-    REGISTER_INDEV    (V4L2, v4l2);
-    REGISTER_INDEV    (V4L, v4l);
-    REGISTER_INDEV    (VFWCAP, vfwcap);
-    REGISTER_INDEV    (X11_GRAB_DEVICE, x11_grab_device);
-
-    /* external libraries */
-    REGISTER_INDEV    (LIBDC1394, libdc1394);
-}
diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c
deleted file mode 100644
index 38cb0de..0000000
--- a/libavdevice/alsa-audio-common.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * ALSA input and output
- * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
- * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * ALSA input and output: common code
- * @author Luca Abeni ( lucabe72 email it )
- * @author Benoit Fouet ( benoit fouet free fr )
- * @author Nicolas George ( nicolas george normalesup org )
- */
-
-#include <alsa/asoundlib.h>
-#include "libavformat/avformat.h"
-
-#include "alsa-audio.h"
-
-static av_cold snd_pcm_format_t codec_id_to_pcm_format(int codec_id)
-{
-    switch(codec_id) {
-        case CODEC_ID_PCM_S16LE: return SND_PCM_FORMAT_S16_LE;
-        case CODEC_ID_PCM_S16BE: return SND_PCM_FORMAT_S16_BE;
-        case CODEC_ID_PCM_S8:    return SND_PCM_FORMAT_S8;
-        default:                 return SND_PCM_FORMAT_UNKNOWN;
-    }
-}
-
-av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
-                         unsigned int *sample_rate,
-                         int channels, enum CodecID *codec_id)
-{
-    AlsaData *s = ctx->priv_data;
-    const char *audio_device;
-    int res, flags = 0;
-    snd_pcm_format_t format;
-    snd_pcm_t *h;
-    snd_pcm_hw_params_t *hw_params;
-    snd_pcm_uframes_t buffer_size, period_size;
-
-    if (ctx->filename[0] == 0) audio_device = "default";
-    else                       audio_device = ctx->filename;
-
-    if (*codec_id == CODEC_ID_NONE)
-        *codec_id = DEFAULT_CODEC_ID;
-    format = codec_id_to_pcm_format(*codec_id);
-    if (format == SND_PCM_FORMAT_UNKNOWN) {
-        av_log(ctx, AV_LOG_ERROR, "sample format 0x%04x is not supported\n", *codec_id);
-        return AVERROR(ENOSYS);
-    }
-    s->frame_size = av_get_bits_per_sample(*codec_id) / 8 * channels;
-
-    if (ctx->flags & AVFMT_FLAG_NONBLOCK) {
-        flags = SND_PCM_NONBLOCK;
-    }
-    res = snd_pcm_open(&h, audio_device, mode, flags);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot open audio device %s (%s)\n",
-               audio_device, snd_strerror(res));
-        return AVERROR(EIO);
-    }
-
-    res = snd_pcm_hw_params_malloc(&hw_params);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n",
-               snd_strerror(res));
-        goto fail1;
-    }
-
-    res = snd_pcm_hw_params_any(h, hw_params);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n",
-               snd_strerror(res));
-        goto fail;
-    }
-
-    res = snd_pcm_hw_params_set_access(h, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot set access type (%s)\n",
-               snd_strerror(res));
-        goto fail;
-    }
-
-    res = snd_pcm_hw_params_set_format(h, hw_params, format);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot set sample format 0x%04x %d (%s)\n",
-               *codec_id, format, snd_strerror(res));
-        goto fail;
-    }
-
-    res = snd_pcm_hw_params_set_rate_near(h, hw_params, sample_rate, 0);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot set sample rate (%s)\n",
-               snd_strerror(res));
-        goto fail;
-    }
-
-    res = snd_pcm_hw_params_set_channels(h, hw_params, channels);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot set channel count to %d (%s)\n",
-               channels, snd_strerror(res));
-        goto fail;
-    }
-
-    snd_pcm_hw_params_get_buffer_size_max(hw_params, &buffer_size);
-    /* TODO: maybe use ctx->max_picture_buffer somehow */
-    res = snd_pcm_hw_params_set_buffer_size_near(h, hw_params, &buffer_size);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot set ALSA buffer size (%s)\n",
-               snd_strerror(res));
-        goto fail;
-    }
-
-    snd_pcm_hw_params_get_period_size_min(hw_params, &period_size, NULL);
-    res = snd_pcm_hw_params_set_period_size_near(h, hw_params, &period_size, NULL);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot set ALSA period size (%s)\n",
-               snd_strerror(res));
-        goto fail;
-    }
-    s->period_size = period_size;
-
-    res = snd_pcm_hw_params(h, hw_params);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "cannot set parameters (%s)\n",
-               snd_strerror(res));
-        goto fail;
-    }
-
-    snd_pcm_hw_params_free(hw_params);
-
-    s->h = h;
-    return 0;
-
-fail:
-    snd_pcm_hw_params_free(hw_params);
-fail1:
-    snd_pcm_close(h);
-    return AVERROR(EIO);
-}
-
-av_cold int ff_alsa_close(AVFormatContext *s1)
-{
-    AlsaData *s = s1->priv_data;
-
-    snd_pcm_close(s->h);
-    return 0;
-}
-
-int ff_alsa_xrun_recover(AVFormatContext *s1, int err)
-{
-    AlsaData *s = s1->priv_data;
-    snd_pcm_t *handle = s->h;
-
-    av_log(s1, AV_LOG_WARNING, "ALSA buffer xrun.\n");
-    if (err == -EPIPE) {
-        err = snd_pcm_prepare(handle);
-        if (err < 0) {
-            av_log(s1, AV_LOG_ERROR, "cannot recover from underrun (snd_pcm_prepare failed: %s)\n", snd_strerror(err));
-
-            return AVERROR(EIO);
-        }
-    } else if (err == -ESTRPIPE) {
-        av_log(s1, AV_LOG_ERROR, "-ESTRPIPE... Unsupported!\n");
-
-        return -1;
-    }
-    return err;
-}
diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
deleted file mode 100644
index f1dd29b..0000000
--- a/libavdevice/alsa-audio-dec.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * ALSA input and output
- * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
- * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * ALSA input and output: input
- * @author Luca Abeni ( lucabe72 email it )
- * @author Benoit Fouet ( benoit fouet free fr )
- * @author Nicolas George ( nicolas george normalesup org )
- *
- * This avdevice decoder allows to capture audio from an ALSA (Advanced
- * Linux Sound Architecture) device.
- *
- * The filename parameter is the name of an ALSA PCM device capable of
- * capture, for example "default" or "plughw:1"; see the ALSA documentation
- * for naming conventions. The empty string is equivalent to "default".
- *
- * The capture period is set to the lower value available for the device,
- * which gives a low latency suitable for real-time capture.
- *
- * The PTS are an Unix time in microsecond.
- *
- * Due to a bug in the ALSA library
- * (https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4308), this
- * decoder does not work with certain ALSA plugins, especially the dsnoop
- * plugin.
- */
-
-#include <alsa/asoundlib.h>
-#include "libavformat/avformat.h"
-
-#include "alsa-audio.h"
-
-static av_cold int audio_read_header(AVFormatContext *s1,
-                                     AVFormatParameters *ap)
-{
-    AlsaData *s = s1->priv_data;
-    AVStream *st;
-    int ret;
-    unsigned int sample_rate;
-    enum CodecID codec_id;
-    snd_pcm_sw_params_t *sw_params;
-
-    if (ap->sample_rate <= 0) {
-        av_log(s1, AV_LOG_ERROR, "Bad sample rate %d\n", ap->sample_rate);
-
-        return AVERROR(EIO);
-    }
-
-    if (ap->channels <= 0) {
-        av_log(s1, AV_LOG_ERROR, "Bad channels number %d\n", ap->channels);
-
-        return AVERROR(EIO);
-    }
-
-    st = av_new_stream(s1, 0);
-    if (!st) {
-        av_log(s1, AV_LOG_ERROR, "Cannot add stream\n");
-
-        return AVERROR(ENOMEM);
-    }
-    sample_rate = ap->sample_rate;
-    codec_id    = s1->audio_codec_id;
-
-    ret = ff_alsa_open(s1, SND_PCM_STREAM_CAPTURE, &sample_rate, ap->channels,
-        &codec_id);
-    if (ret < 0) {
-        return AVERROR(EIO);
-    }
-
-    if (snd_pcm_type(s->h) != SND_PCM_TYPE_HW)
-        av_log(s1, AV_LOG_WARNING,
-               "capture with some ALSA plugins, especially dsnoop, "
-               "may hang.\n");
-
-    ret = snd_pcm_sw_params_malloc(&sw_params);
-    if (ret < 0) {
-        av_log(s1, AV_LOG_ERROR, "cannot allocate software parameters structure (%s)\n",
-               snd_strerror(ret));
-        goto fail;
-    }
-
-    snd_pcm_sw_params_current(s->h, sw_params);
-    snd_pcm_sw_params_set_tstamp_mode(s->h, sw_params, SND_PCM_TSTAMP_ENABLE);
-
-    ret = snd_pcm_sw_params(s->h, sw_params);
-    snd_pcm_sw_params_free(sw_params);
-    if (ret < 0) {
-        av_log(s1, AV_LOG_ERROR, "cannot install ALSA software parameters (%s)\n",
-               snd_strerror(ret));
-        goto fail;
-    }
-
-    /* take real parameters */
-    st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id    = codec_id;
-    st->codec->sample_rate = sample_rate;
-    st->codec->channels    = ap->channels;
-    av_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
-
-    return 0;
-
-fail:
-    snd_pcm_close(s->h);
-    return AVERROR(EIO);
-}
-
-static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    AlsaData *s  = s1->priv_data;
-    AVStream *st = s1->streams[0];
-    int res;
-    snd_htimestamp_t timestamp;
-    snd_pcm_uframes_t ts_delay;
-
-    if (av_new_packet(pkt, s->period_size) < 0) {
-        return AVERROR(EIO);
-    }
-
-    while ((res = snd_pcm_readi(s->h, pkt->data, pkt->size / s->frame_size)) < 0) {
-        if (res == -EAGAIN) {
-            av_free_packet(pkt);
-
-            return AVERROR(EAGAIN);
-        }
-        if (ff_alsa_xrun_recover(s1, res) < 0) {
-            av_log(s1, AV_LOG_ERROR, "ALSA read error: %s\n",
-                   snd_strerror(res));
-            av_free_packet(pkt);
-
-            return AVERROR(EIO);
-        }
-    }
-
-    snd_pcm_htimestamp(s->h, &ts_delay, &timestamp);
-    ts_delay += res;
-    pkt->pts = timestamp.tv_sec * 1000000LL
-               + (timestamp.tv_nsec * st->codec->sample_rate
-                  - ts_delay * 1000000000LL + st->codec->sample_rate * 500LL)
-               / (st->codec->sample_rate * 1000LL);
-
-    pkt->size = res * s->frame_size;
-
-    return 0;
-}
-
-AVInputFormat alsa_demuxer = {
-    "alsa",
-    NULL_IF_CONFIG_SMALL("ALSA audio input"),
-    sizeof(AlsaData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    ff_alsa_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c
deleted file mode 100644
index 7c07bf7..0000000
--- a/libavdevice/alsa-audio-enc.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * ALSA input and output
- * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
- * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * ALSA input and output: output
- * @author Luca Abeni ( lucabe72 email it )
- * @author Benoit Fouet ( benoit fouet free fr )
- *
- * This avdevice encoder allows to play audio to an ALSA (Advanced Linux
- * Sound Architecture) device.
- *
- * The filename parameter is the name of an ALSA PCM device capable of
- * capture, for example "default" or "plughw:1"; see the ALSA documentation
- * for naming conventions. The empty string is equivalent to "default".
- *
- * The playback period is set to the lower value available for the device,
- * which gives a low latency suitable for real-time playback.
- */
-
-#include <alsa/asoundlib.h>
-#include "libavformat/avformat.h"
-
-#include "alsa-audio.h"
-
-static av_cold int audio_write_header(AVFormatContext *s1)
-{
-    AlsaData *s = s1->priv_data;
-    AVStream *st;
-    unsigned int sample_rate;
-    enum CodecID codec_id;
-    int res;
-
-    st = s1->streams[0];
-    sample_rate = st->codec->sample_rate;
-    codec_id    = st->codec->codec_id;
-    res = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &sample_rate,
-        st->codec->channels, &codec_id);
-    if (sample_rate != st->codec->sample_rate) {
-        av_log(s1, AV_LOG_ERROR,
-               "sample rate %d not available, nearest is %d\n",
-               st->codec->sample_rate, sample_rate);
-        goto fail;
-    }
-
-    return res;
-
-fail:
-    snd_pcm_close(s->h);
-    return AVERROR(EIO);
-}
-
-static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    AlsaData *s = s1->priv_data;
-    int res;
-    int size     = pkt->size;
-    uint8_t *buf = pkt->data;
-
-    while((res = snd_pcm_writei(s->h, buf, size / s->frame_size)) < 0) {
-        if (res == -EAGAIN) {
-
-            return AVERROR(EAGAIN);
-        }
-
-        if (ff_alsa_xrun_recover(s1, res) < 0) {
-            av_log(s1, AV_LOG_ERROR, "ALSA write error: %s\n",
-                   snd_strerror(res));
-
-            return AVERROR(EIO);
-        }
-    }
-
-    return 0;
-}
-
-AVOutputFormat alsa_muxer = {
-    "alsa",
-    NULL_IF_CONFIG_SMALL("ALSA audio output"),
-    "",
-    "",
-    sizeof(AlsaData),
-    DEFAULT_CODEC_ID,
-    CODEC_ID_NONE,
-    audio_write_header,
-    audio_write_packet,
-    ff_alsa_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h
deleted file mode 100644
index 9a8a089..0000000
--- a/libavdevice/alsa-audio.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * ALSA input and output
- * Copyright (c) 2007 Luca Abeni ( lucabe72 email it )
- * Copyright (c) 2007 Benoit Fouet ( benoit fouet free fr )
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * ALSA input and output: definitions and structures
- * @author Luca Abeni ( lucabe72 email it )
- * @author Benoit Fouet ( benoit fouet free fr )
- */
-
-#ifndef AVDEVICE_ALSA_AUDIO_H
-#define AVDEVICE_ALSA_AUDIO_H
-
-#include <alsa/asoundlib.h>
-#include "config.h"
-#include "libavformat/avformat.h"
-
-/* XXX: we make the assumption that the soundcard accepts this format */
-/* XXX: find better solution with "preinit" method, needed also in
-        other formats */
-#if HAVE_BIGENDIAN
-#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16BE
-#else
-#define DEFAULT_CODEC_ID CODEC_ID_PCM_S16LE
-#endif
-
-typedef struct {
-    snd_pcm_t *h;
-    int frame_size;  ///< preferred size for reads and writes
-    int period_size; ///< bytes per sample * channels
-} AlsaData;
-
-/**
- * Opens an ALSA PCM.
- *
- * @param s media file handle
- * @param mode either SND_PCM_STREAM_CAPTURE or SND_PCM_STREAM_PLAYBACK
- * @param sample_rate in: requested sample rate;
- *                    out: actually selected sample rate
- * @param channels number of channels
- * @param codec_id in: requested CodecID or CODEC_ID_NONE;
- *                 out: actually selected CodecID, changed only if
- *                 CODEC_ID_NONE was requested
- *
- * @return 0 if OK, AVERROR_xxx on error
- */
-int ff_alsa_open(AVFormatContext *s, snd_pcm_stream_t mode,
-                 unsigned int *sample_rate,
-                 int channels, enum CodecID *codec_id);
-
-/**
- * Closes the ALSA PCM.
- *
- * @param s1 media file handle
- *
- * @return 0
- */
-int ff_alsa_close(AVFormatContext *s1);
-
-/**
- * Tries to recover from ALSA buffer underrun.
- *
- * @param s1 media file handle
- * @param err error code reported by the previous ALSA call
- *
- * @return 0 if OK, AVERROR_xxx on error
- */
-int ff_alsa_xrun_recover(AVFormatContext *s1, int err);
-
-#endif /* AVDEVICE_ALSA_AUDIO_H */
diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
deleted file mode 100644
index 3d67b4b..0000000
--- a/libavdevice/avdevice.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avdevice.h"
-
-unsigned avdevice_version(void)
-{
-    return LIBAVDEVICE_VERSION_INT;
-}
-
-const char * avdevice_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char * avdevice_license(void)
-{
-#define LICENSE_PREFIX "libavdevice license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
deleted file mode 100644
index dcd835c..0000000
--- a/libavdevice/avdevice.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVDEVICE_AVDEVICE_H
-#define AVDEVICE_AVDEVICE_H
-
-#include "libavutil/avutil.h"
-
-#define LIBAVDEVICE_VERSION_MAJOR 52
-#define LIBAVDEVICE_VERSION_MINOR  2
-#define LIBAVDEVICE_VERSION_MICRO  0
-
-#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
-                                               LIBAVDEVICE_VERSION_MINOR, \
-                                               LIBAVDEVICE_VERSION_MICRO)
-#define LIBAVDEVICE_VERSION     AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
-                                           LIBAVDEVICE_VERSION_MINOR, \
-                                           LIBAVDEVICE_VERSION_MICRO)
-#define LIBAVDEVICE_BUILD       LIBAVDEVICE_VERSION_INT
-
-/**
- * Returns the LIBAVDEVICE_VERSION_INT constant.
- */
-unsigned avdevice_version(void);
-
-/**
- * Returns the libavdevice build-time configuration.
- */
-const char *avdevice_configuration(void);
-
-/**
- * Returns the libavdevice license.
- */
-const char *avdevice_license(void);
-
-/**
- * Initialize libavdevice and register all the input and output devices.
- * @warning This function is not thread safe.
- */
-void avdevice_register_all(void);
-
-#endif /* AVDEVICE_AVDEVICE_H */
-
diff --git a/libavdevice/beosaudio.cpp b/libavdevice/beosaudio.cpp
deleted file mode 100644
index 9f32571..0000000
--- a/libavdevice/beosaudio.cpp
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * BeOS audio play interface
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include <Application.h>
-#include <SoundPlayer.h>
-
-extern "C" {
-#include "libavformat/avformat.h"
-}
-
-#if HAVE_BSOUNDRECORDER
-#include <SoundRecorder.h>
-using namespace BPrivate::Media::Experimental;
-#endif
-
-/* enable performance checks */
-//#define PERF_CHECK
-
-/* enable Media Kit latency checks */
-//#define LATENCY_CHECK
-
-#define AUDIO_BLOCK_SIZE 4096
-#define AUDIO_BLOCK_COUNT 8
-
-#define AUDIO_BUFFER_SIZE (AUDIO_BLOCK_SIZE*AUDIO_BLOCK_COUNT)
-
-typedef struct {
-    int fd; // UNUSED
-    int sample_rate;
-    int channels;
-    int frame_size; /* in bytes ! */
-    CodecID codec_id;
-    uint8_t buffer[AUDIO_BUFFER_SIZE];
-    int buffer_ptr;
-    /* ring buffer */
-    sem_id input_sem;
-    int input_index;
-    sem_id output_sem;
-    int output_index;
-    BSoundPlayer *player;
-#if HAVE_BSOUNDRECORDER
-    BSoundRecorder *recorder;
-#endif
-    int has_quit; /* signal callbacks not to wait */
-    volatile bigtime_t starve_time;
-} AudioData;
-
-static thread_id main_thid;
-static thread_id bapp_thid;
-static int own_BApp_created = 0;
-static int refcount = 0;
-
-/* create the BApplication and Run() it */
-static int32 bapp_thread(void *arg)
-{
-    new BApplication("application/x-vnd.ffmpeg");
-    own_BApp_created = 1;
-    be_app->Run();
-    /* kill the process group */
-//    kill(0, SIGINT);
-//    kill(main_thid, SIGHUP);
-    return B_OK;
-}
-
-/* create the BApplication only if needed */
-static void create_bapp_if_needed(void)
-{
-    if (refcount++ == 0) {
-        /* needed by libmedia */
-        if (be_app == NULL) {
-            bapp_thid = spawn_thread(bapp_thread, "ffmpeg BApplication", B_NORMAL_PRIORITY, NULL);
-            resume_thread(bapp_thid);
-            while (!own_BApp_created)
-                snooze(50000);
-        }
-    }
-}
-
-static void destroy_bapp_if_needed(void)
-{
-    if (--refcount == 0 && own_BApp_created) {
-        be_app->Lock();
-        be_app->Quit();
-        be_app = NULL;
-    }
-}
-
-/* called back by BSoundPlayer */
-static void audioplay_callback(void *cookie, void *buffer, size_t bufferSize, const media_raw_audio_format &format)
-{
-    AudioData *s;
-    size_t len, amount;
-    unsigned char *buf = (unsigned char *)buffer;
-
-    s = (AudioData *)cookie;
-    if (s->has_quit)
-        return;
-    while (bufferSize > 0) {
-#ifdef PERF_CHECK
-        bigtime_t t;
-        t = system_time();
-#endif
-        len = MIN(AUDIO_BLOCK_SIZE, bufferSize);
-        if (acquire_sem_etc(s->output_sem, len, B_CAN_INTERRUPT, 0LL) < B_OK) {
-            s->has_quit = 1;
-            s->player->SetHasData(false);
-            return;
-        }
-        amount = MIN(len, (AUDIO_BUFFER_SIZE - s->output_index));
-        memcpy(buf, &s->buffer[s->output_index], amount);
-        s->output_index += amount;
-        if (s->output_index >= AUDIO_BUFFER_SIZE) {
-            s->output_index %= AUDIO_BUFFER_SIZE;
-            memcpy(buf + amount, &s->buffer[s->output_index], len - amount);
-            s->output_index += len-amount;
-            s->output_index %= AUDIO_BUFFER_SIZE;
-        }
-        release_sem_etc(s->input_sem, len, 0);
-#ifdef PERF_CHECK
-        t = system_time() - t;
-        s->starve_time = MAX(s->starve_time, t);
-#endif
-        buf += len;
-        bufferSize -= len;
-    }
-}
-
-#if HAVE_BSOUNDRECORDER
-/* called back by BSoundRecorder */
-static void audiorecord_callback(void *cookie, bigtime_t timestamp, void *buffer, size_t bufferSize, const media_multi_audio_format &format)
-{
-    AudioData *s;
-    size_t len, amount;
-    unsigned char *buf = (unsigned char *)buffer;
-
-    s = (AudioData *)cookie;
-    if (s->has_quit)
-        return;
-
-    while (bufferSize > 0) {
-        len = MIN(bufferSize, AUDIO_BLOCK_SIZE);
-        //printf("acquire_sem(input, %d)\n", len);
-        if (acquire_sem_etc(s->input_sem, len, B_CAN_INTERRUPT, 0LL) < B_OK) {
-            s->has_quit = 1;
-            return;
-        }
-        amount = MIN(len, (AUDIO_BUFFER_SIZE - s->input_index));
-        memcpy(&s->buffer[s->input_index], buf, amount);
-        s->input_index += amount;
-        if (s->input_index >= AUDIO_BUFFER_SIZE) {
-            s->input_index %= AUDIO_BUFFER_SIZE;
-            memcpy(&s->buffer[s->input_index], buf + amount, len - amount);
-            s->input_index += len - amount;
-        }
-        release_sem_etc(s->output_sem, len, 0);
-        //printf("release_sem(output, %d)\n", len);
-        buf += len;
-        bufferSize -= len;
-    }
-}
-#endif
-
-static int audio_open(AudioData *s, int is_output, const char *audio_device)
-{
-    int p[2];
-    int ret;
-    media_raw_audio_format format;
-    media_multi_audio_format iformat;
-
-#if !HAVE_BSOUNDRECORDER
-    if (!is_output)
-        return AVERROR(EIO); /* not for now */
-#endif
-    s->input_sem = create_sem(AUDIO_BUFFER_SIZE, "ffmpeg_ringbuffer_input");
-    if (s->input_sem < B_OK)
-        return AVERROR(EIO);
-    s->output_sem = create_sem(0, "ffmpeg_ringbuffer_output");
-    if (s->output_sem < B_OK) {
-        delete_sem(s->input_sem);
-        return AVERROR(EIO);
-    }
-    s->input_index = 0;
-    s->output_index = 0;
-    create_bapp_if_needed();
-    s->frame_size = AUDIO_BLOCK_SIZE;
-    /* bump up the priority (avoid realtime though) */
-    set_thread_priority(find_thread(NULL), B_DISPLAY_PRIORITY+1);
-#if HAVE_BSOUNDRECORDER
-    if (!is_output) {
-        bool wait_for_input = false;
-        if (audio_device && !strcmp(audio_device, "wait:"))
-            wait_for_input = true;
-        s->recorder = new BSoundRecorder(&iformat, wait_for_input, "ffmpeg input", audiorecord_callback);
-        if (wait_for_input && (s->recorder->InitCheck() == B_OK)) {
-            s->recorder->WaitForIncomingConnection(&iformat);
-        }
-        if (s->recorder->InitCheck() != B_OK || iformat.format != media_raw_audio_format::B_AUDIO_SHORT) {
-            delete s->recorder;
-            s->recorder = NULL;
-            if (s->input_sem)
-                delete_sem(s->input_sem);
-            if (s->output_sem)
-                delete_sem(s->output_sem);
-            return AVERROR(EIO);
-        }
-        s->codec_id = (iformat.byte_order == B_MEDIA_LITTLE_ENDIAN)?CODEC_ID_PCM_S16LE:CODEC_ID_PCM_S16BE;
-        s->channels = iformat.channel_count;
-        s->sample_rate = (int)iformat.frame_rate;
-        s->frame_size = iformat.buffer_size;
-        s->recorder->SetCookie(s);
-        s->recorder->SetVolume(1.0);
-        s->recorder->Start();
-        return 0;
-    }
-#endif
-    format = media_raw_audio_format::wildcard;
-    format.format = media_raw_audio_format::B_AUDIO_SHORT;
-    format.byte_order = B_HOST_IS_LENDIAN ? B_MEDIA_LITTLE_ENDIAN : B_MEDIA_BIG_ENDIAN;
-    format.channel_count = s->channels;
-    format.buffer_size = s->frame_size;
-    format.frame_rate = s->sample_rate;
-    s->player = new BSoundPlayer(&format, "ffmpeg output", audioplay_callback);
-    if (s->player->InitCheck() != B_OK) {
-        delete s->player;
-        s->player = NULL;
-        if (s->input_sem)
-            delete_sem(s->input_sem);
-        if (s->output_sem)
-            delete_sem(s->output_sem);
-        return AVERROR(EIO);
-    }
-    s->player->SetCookie(s);
-    s->player->SetVolume(1.0);
-    s->player->Start();
-    s->player->SetHasData(true);
-    return 0;
-}
-
-static int audio_close(AudioData *s)
-{
-    if (s->input_sem)
-        delete_sem(s->input_sem);
-    if (s->output_sem)
-        delete_sem(s->output_sem);
-    s->has_quit = 1;
-    if (s->player) {
-        s->player->Stop();
-    }
-    if (s->player)
-        delete s->player;
-#if HAVE_BSOUNDRECORDER
-    if (s->recorder)
-        delete s->recorder;
-#endif
-    destroy_bapp_if_needed();
-    return 0;
-}
-
-/* sound output support */
-static int audio_write_header(AVFormatContext *s1)
-{
-    AudioData *s = (AudioData *)s1->priv_data;
-    AVStream *st;
-    int ret;
-
-    st = s1->streams[0];
-    s->sample_rate = st->codec->sample_rate;
-    s->channels = st->codec->channels;
-    ret = audio_open(s, 1, NULL);
-    if (ret < 0)
-        return AVERROR(EIO);
-    return 0;
-}
-
-static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    AudioData *s = (AudioData *)s1->priv_data;
-    int len, ret;
-    const uint8_t *buf = pkt->data;
-    int size = pkt->size;
-#ifdef LATENCY_CHECK
-bigtime_t lat1, lat2;
-lat1 = s->player->Latency();
-#endif
-#ifdef PERF_CHECK
-    bigtime_t t = s->starve_time;
-    s->starve_time = 0;
-    printf("starve_time: %lld    \n", t);
-#endif
-    while (size > 0) {
-        int amount;
-        len = MIN(size, AUDIO_BLOCK_SIZE);
-        if (acquire_sem_etc(s->input_sem, len, B_CAN_INTERRUPT, 0LL) < B_OK)
-            return AVERROR(EIO);
-        amount = MIN(len, (AUDIO_BUFFER_SIZE - s->input_index));
-        memcpy(&s->buffer[s->input_index], buf, amount);
-        s->input_index += amount;
-        if (s->input_index >= AUDIO_BUFFER_SIZE) {
-            s->input_index %= AUDIO_BUFFER_SIZE;
-            memcpy(&s->buffer[s->input_index], buf + amount, len - amount);
-            s->input_index += len - amount;
-        }
-        release_sem_etc(s->output_sem, len, 0);
-        buf += len;
-        size -= len;
-    }
-#ifdef LATENCY_CHECK
-lat2 = s->player->Latency();
-printf("#### BSoundPlayer::Latency(): before= %lld, after= %lld\n", lat1, lat2);
-#endif
-    return 0;
-}
-
-static int audio_write_trailer(AVFormatContext *s1)
-{
-    AudioData *s = (AudioData *)s1->priv_data;
-
-    audio_close(s);
-    return 0;
-}
-
-/* grab support */
-
-static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    AudioData *s = (AudioData *)s1->priv_data;
-    AVStream *st;
-    int ret;
-
-    if (!ap || ap->sample_rate <= 0 || ap->channels <= 0)
-        return -1;
-
-    st = av_new_stream(s1, 0);
-    if (!st) {
-        return AVERROR(ENOMEM);
-    }
-    s->sample_rate = ap->sample_rate;
-    s->channels = ap->channels;
-
-    ret = audio_open(s, 0, s1->filename);
-    if (ret < 0) {
-        av_free(st);
-        return AVERROR(EIO);
-    }
-    /* take real parameters */
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = s->codec_id;
-    st->codec->sample_rate = s->sample_rate;
-    st->codec->channels = s->channels;
-    return 0;
-    av_set_pts_info(st, 48, 1, 1000000);  /* 48 bits pts in us */
-}
-
-static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    AudioData *s = (AudioData *)s1->priv_data;
-    int size;
-    size_t len, amount;
-    unsigned char *buf;
-    status_t err;
-
-    if (av_new_packet(pkt, s->frame_size) < 0)
-        return AVERROR(EIO);
-    buf = (unsigned char *)pkt->data;
-    size = pkt->size;
-    while (size > 0) {
-        len = MIN(AUDIO_BLOCK_SIZE, size);
-        //printf("acquire_sem(output, %d)\n", len);
-        while ((err=acquire_sem_etc(s->output_sem, len, B_CAN_INTERRUPT, 0LL)) == B_INTERRUPTED);
-        if (err < B_OK) {
-            av_free_packet(pkt);
-            return AVERROR(EIO);
-        }
-        amount = MIN(len, (AUDIO_BUFFER_SIZE - s->output_index));
-        memcpy(buf, &s->buffer[s->output_index], amount);
-        s->output_index += amount;
-        if (s->output_index >= AUDIO_BUFFER_SIZE) {
-            s->output_index %= AUDIO_BUFFER_SIZE;
-            memcpy(buf + amount, &s->buffer[s->output_index], len - amount);
-            s->output_index += len-amount;
-            s->output_index %= AUDIO_BUFFER_SIZE;
-        }
-        release_sem_etc(s->input_sem, len, 0);
-        //printf("release_sem(input, %d)\n", len);
-        buf += len;
-        size -= len;
-    }
-    //XXX: add pts info
-    return 0;
-}
-
-static int audio_read_close(AVFormatContext *s1)
-{
-    AudioData *s = (AudioData *)s1->priv_data;
-
-    audio_close(s);
-    return 0;
-}
-
-static AVInputFormat audio_beos_demuxer = {
-    "audio_beos",
-    NULL_IF_CONFIG_SMALL("audio grab and output"),
-    sizeof(AudioData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    audio_read_close,
-    NULL,
-    NULL,
-    AVFMT_NOFILE,
-};
-
-AVOutputFormat audio_beos_muxer = {
-    "audio_beos",
-    NULL_IF_CONFIG_SMALL("audio grab and output"),
-    "",
-    "",
-    sizeof(AudioData),
-#if HAVE_BIGENDIAN
-    CODEC_ID_PCM_S16BE,
-#else
-    CODEC_ID_PCM_S16LE,
-#endif
-    CODEC_ID_NONE,
-    audio_write_header,
-    audio_write_packet,
-    audio_write_trailer,
-    AVFMT_NOFILE,
-};
-
-extern "C" {
-
-int audio_init(void)
-{
-    main_thid = find_thread(NULL);
-    av_register_input_format(&audio_beos_demuxer);
-    av_register_output_format(&audio_beos_muxer);
-    return 0;
-}
-
-} // "C"
-
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
deleted file mode 100644
index afb94b6..0000000
--- a/libavdevice/bktr.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * *BSD video grab interface
- * Copyright (c) 2002 Steve O'Hara-Smith
- * based on
- *           Linux video grab interface
- *           Copyright (c) 2000,2001 Gerard Lantau
- * and
- *           simple_grab.c Copyright (c) 1999 Roger Hardiman
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define _BSD_SOURCE 1
-#define _NETBSD_SOURCE
-
-#include "libavformat/avformat.h"
-#if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H
-# include <dev/bktr/ioctl_meteor.h>
-# include <dev/bktr/ioctl_bt848.h>
-#elif HAVE_MACHINE_IOCTL_METEOR_H && HAVE_MACHINE_IOCTL_BT848_H
-# include <machine/ioctl_meteor.h>
-# include <machine/ioctl_bt848.h>
-#elif HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H && HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H
-# include <dev/video/meteor/ioctl_meteor.h>
-# include <dev/video/bktr/ioctl_bt848.h>
-#elif HAVE_DEV_IC_BT8XX_H
-# include <dev/ic/bt8xx.h>
-#endif
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <stdint.h>
-#include <strings.h>
-
-typedef struct {
-    int video_fd;
-    int tuner_fd;
-    int width, height;
-    int frame_rate;
-    int frame_rate_base;
-    uint64_t per_frame;
-} VideoData;
-
-
-#define PAL 1
-#define PALBDGHI 1
-#define NTSC 2
-#define NTSCM 2
-#define SECAM 3
-#define PALN 4
-#define PALM 5
-#define NTSCJ 6
-
-/* PAL is 768 x 576. NTSC is 640 x 480 */
-#define PAL_HEIGHT 576
-#define SECAM_HEIGHT 576
-#define NTSC_HEIGHT 480
-
-#ifndef VIDEO_FORMAT
-#define VIDEO_FORMAT NTSC
-#endif
-
-static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
-    METEOR_DEV3, METEOR_DEV_SVIDEO };
-
-uint8_t *video_buf;
-size_t video_buf_size;
-uint64_t last_frame_time;
-volatile sig_atomic_t nsignals;
-
-
-static void catchsignal(int signal)
-{
-    nsignals++;
-    return;
-}
-
-static av_cold int bktr_init(const char *video_device, int width, int height,
-    int format, int *video_fd, int *tuner_fd, int idev, double frequency)
-{
-    struct meteor_geomet geo;
-    int h_max;
-    long ioctl_frequency;
-    char *arg;
-    int c;
-    struct sigaction act, old;
-
-    if (idev < 0 || idev > 4)
-    {
-        arg = getenv ("BKTR_DEV");
-        if (arg)
-            idev = atoi (arg);
-        if (idev < 0 || idev > 4)
-            idev = 1;
-    }
-
-    if (format < 1 || format > 6)
-    {
-        arg = getenv ("BKTR_FORMAT");
-        if (arg)
-            format = atoi (arg);
-        if (format < 1 || format > 6)
-            format = VIDEO_FORMAT;
-    }
-
-    if (frequency <= 0)
-    {
-        arg = getenv ("BKTR_FREQUENCY");
-        if (arg)
-            frequency = atof (arg);
-        if (frequency <= 0)
-            frequency = 0.0;
-    }
-
-    memset(&act, 0, sizeof(act));
-    sigemptyset(&act.sa_mask);
-    act.sa_handler = catchsignal;
-    sigaction(SIGUSR1, &act, &old);
-
-    *tuner_fd = open("/dev/tuner0", O_RDONLY);
-    if (*tuner_fd < 0)
-        av_log(NULL, AV_LOG_ERROR, "Warning. Tuner not opened, continuing: %s\n", strerror(errno));
-
-    *video_fd = open(video_device, O_RDONLY);
-    if (*video_fd < 0) {
-        av_log(NULL, AV_LOG_ERROR, "%s: %s\n", video_device, strerror(errno));
-        return -1;
-    }
-
-    geo.rows = height;
-    geo.columns = width;
-    geo.frames = 1;
-    geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12;
-
-    switch (format) {
-    case PAL:   h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALBDGHI; break;
-    case PALN:  h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALN;     break;
-    case PALM:  h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALM;     break;
-    case SECAM: h_max = SECAM_HEIGHT; c = BT848_IFORM_F_SECAM;    break;
-    case NTSC:  h_max = NTSC_HEIGHT;  c = BT848_IFORM_F_NTSCM;    break;
-    case NTSCJ: h_max = NTSC_HEIGHT;  c = BT848_IFORM_F_NTSCJ;    break;
-    default:    h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALBDGHI; break;
-    }
-
-    if (height <= h_max / 2)
-        geo.oformat |= METEOR_GEO_EVEN_ONLY;
-
-    if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) {
-        av_log(NULL, AV_LOG_ERROR, "METEORSETGEO: %s\n", strerror(errno));
-        return -1;
-    }
-
-    if (ioctl(*video_fd, BT848SFMT, &c) < 0) {
-        av_log(NULL, AV_LOG_ERROR, "BT848SFMT: %s\n", strerror(errno));
-        return -1;
-    }
-
-    c = bktr_dev[idev];
-    if (ioctl(*video_fd, METEORSINPUT, &c) < 0) {
-        av_log(NULL, AV_LOG_ERROR, "METEORSINPUT: %s\n", strerror(errno));
-        return -1;
-    }
-
-    video_buf_size = width * height * 12 / 8;
-
-    video_buf = (uint8_t *)mmap((caddr_t)0, video_buf_size,
-        PROT_READ, MAP_SHARED, *video_fd, (off_t)0);
-    if (video_buf == MAP_FAILED) {
-        av_log(NULL, AV_LOG_ERROR, "mmap: %s\n", strerror(errno));
-        return -1;
-    }
-
-    if (frequency != 0.0) {
-        ioctl_frequency  = (unsigned long)(frequency*16);
-        if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency) < 0)
-            av_log(NULL, AV_LOG_ERROR, "TVTUNER_SETFREQ: %s\n", strerror(errno));
-    }
-
-    c = AUDIO_UNMUTE;
-    if (ioctl(*tuner_fd, BT848_SAUDIO, &c) < 0)
-        av_log(NULL, AV_LOG_ERROR, "TVTUNER_SAUDIO: %s\n", strerror(errno));
-
-    c = METEOR_CAP_CONTINOUS;
-    ioctl(*video_fd, METEORCAPTUR, &c);
-
-    c = SIGUSR1;
-    ioctl(*video_fd, METEORSSIGNAL, &c);
-
-    return 0;
-}
-
-static void bktr_getframe(uint64_t per_frame)
-{
-    uint64_t curtime;
-
-    curtime = av_gettime();
-    if (!last_frame_time
-        || ((last_frame_time + per_frame) > curtime)) {
-        if (!usleep(last_frame_time + per_frame + per_frame / 8 - curtime)) {
-            if (!nsignals)
-                av_log(NULL, AV_LOG_INFO,
-                       "SLEPT NO signals - %d microseconds late\n",
-                       (int)(av_gettime() - last_frame_time - per_frame));
-        }
-    }
-    nsignals = 0;
-    last_frame_time = curtime;
-}
-
-
-/* note: we support only one picture read at a time */
-static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    VideoData *s = s1->priv_data;
-
-    if (av_new_packet(pkt, video_buf_size) < 0)
-        return AVERROR(EIO);
-
-    bktr_getframe(s->per_frame);
-
-    pkt->pts = av_gettime();
-    memcpy(pkt->data, video_buf, video_buf_size);
-
-    return video_buf_size;
-}
-
-static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    VideoData *s = s1->priv_data;
-    AVStream *st;
-    int width, height;
-    int frame_rate;
-    int frame_rate_base;
-    int format = -1;
-
-    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
-        return -1;
-
-    width = ap->width;
-    height = ap->height;
-    frame_rate = ap->time_base.den;
-    frame_rate_base = ap->time_base.num;
-
-    st = av_new_stream(s1, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */
-
-    s->width = width;
-    s->height = height;
-    s->frame_rate = frame_rate;
-    s->frame_rate_base = frame_rate_base;
-    s->per_frame = ((uint64_t)1000000 * s->frame_rate_base) / s->frame_rate;
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->pix_fmt = PIX_FMT_YUV420P;
-    st->codec->codec_id = CODEC_ID_RAWVIDEO;
-    st->codec->width = width;
-    st->codec->height = height;
-    st->codec->time_base.den = frame_rate;
-    st->codec->time_base.num = frame_rate_base;
-
-    if (ap->standard) {
-        if (!strcasecmp(ap->standard, "pal"))
-            format = PAL;
-        else if (!strcasecmp(ap->standard, "secam"))
-            format = SECAM;
-        else if (!strcasecmp(ap->standard, "ntsc"))
-            format = NTSC;
-    }
-
-    if (bktr_init(s1->filename, width, height, format,
-            &(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0)
-        return AVERROR(EIO);
-
-    nsignals = 0;
-    last_frame_time = 0;
-
-    return 0;
-}
-
-static int grab_read_close(AVFormatContext *s1)
-{
-    VideoData *s = s1->priv_data;
-    int c;
-
-    c = METEOR_CAP_STOP_CONT;
-    ioctl(s->video_fd, METEORCAPTUR, &c);
-    close(s->video_fd);
-
-    c = AUDIO_MUTE;
-    ioctl(s->tuner_fd, BT848_SAUDIO, &c);
-    close(s->tuner_fd);
-
-    munmap((caddr_t)video_buf, video_buf_size);
-
-    return 0;
-}
-
-AVInputFormat bktr_demuxer = {
-    "bktr",
-    NULL_IF_CONFIG_SMALL("video grab"),
-    sizeof(VideoData),
-    NULL,
-    grab_read_header,
-    grab_read_packet,
-    grab_read_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavdevice/dv1394.c b/libavdevice/dv1394.c
deleted file mode 100644
index a55fa97..0000000
--- a/libavdevice/dv1394.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Linux DV1394 interface
- * Copyright (c) 2003 Max Krasnyansky <maxk at qualcomm.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <poll.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#include <time.h>
-#include <strings.h>
-
-#include "libavformat/avformat.h"
-
-#undef DV1394_DEBUG
-
-#include "libavformat/dv.h"
-#include "dv1394.h"
-
-struct dv1394_data {
-    int fd;
-    int channel;
-    int format;
-
-    uint8_t *ring; /* Ring buffer */
-    int index;  /* Current frame index */
-    int avail;  /* Number of frames available for reading */
-    int done;   /* Number of completed frames */
-
-    DVDemuxContext* dv_demux; /* Generic DV muxing/demuxing context */
-};
-
-/*
- * The trick here is to kludge around well known problem with kernel Ooopsing
- * when you try to capture PAL on a device node configure for NTSC. That's
- * why we have to configure the device node for PAL, and then read only NTSC
- * amount of data.
- */
-static int dv1394_reset(struct dv1394_data *dv)
-{
-    struct dv1394_init init;
-
-    init.channel     = dv->channel;
-    init.api_version = DV1394_API_VERSION;
-    init.n_frames    = DV1394_RING_FRAMES;
-    init.format      = DV1394_PAL;
-
-    if (ioctl(dv->fd, DV1394_INIT, &init) < 0)
-        return -1;
-
-    dv->avail  = dv->done = 0;
-    return 0;
-}
-
-static int dv1394_start(struct dv1394_data *dv)
-{
-    /* Tell DV1394 driver to enable receiver */
-    if (ioctl(dv->fd, DV1394_START_RECEIVE, 0) < 0) {
-        av_log(NULL, AV_LOG_ERROR, "Failed to start receiver: %s\n", strerror(errno));
-        return -1;
-    }
-    return 0;
-}
-
-static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap)
-{
-    struct dv1394_data *dv = context->priv_data;
-
-    dv->dv_demux = dv_init_demux(context);
-    if (!dv->dv_demux)
-        goto failed;
-
-    if (ap->standard && !strcasecmp(ap->standard, "pal"))
-        dv->format = DV1394_PAL;
-    else
-        dv->format = DV1394_NTSC;
-
-    if (ap->channel)
-        dv->channel = ap->channel;
-    else
-        dv->channel = DV1394_DEFAULT_CHANNEL;
-
-    /* Open and initialize DV1394 device */
-    dv->fd = open(context->filename, O_RDONLY);
-    if (dv->fd < 0) {
-        av_log(context, AV_LOG_ERROR, "Failed to open DV interface: %s\n", strerror(errno));
-        goto failed;
-    }
-
-    if (dv1394_reset(dv) < 0) {
-        av_log(context, AV_LOG_ERROR, "Failed to initialize DV interface: %s\n", strerror(errno));
-        goto failed;
-    }
-
-    dv->ring = mmap(NULL, DV1394_PAL_FRAME_SIZE * DV1394_RING_FRAMES,
-                    PROT_READ, MAP_PRIVATE, dv->fd, 0);
-    if (dv->ring == MAP_FAILED) {
-        av_log(context, AV_LOG_ERROR, "Failed to mmap DV ring buffer: %s\n", strerror(errno));
-        goto failed;
-    }
-
-    if (dv1394_start(dv) < 0)
-        goto failed;
-
-    return 0;
-
-failed:
-    close(dv->fd);
-    return AVERROR(EIO);
-}
-
-static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
-{
-    struct dv1394_data *dv = context->priv_data;
-    int size;
-
-    size = dv_get_packet(dv->dv_demux, pkt);
-    if (size > 0)
-        return size;
-
-    if (!dv->avail) {
-        struct dv1394_status s;
-        struct pollfd p;
-
-        if (dv->done) {
-            /* Request more frames */
-            if (ioctl(dv->fd, DV1394_RECEIVE_FRAMES, dv->done) < 0) {
-                /* This usually means that ring buffer overflowed.
-                 * We have to reset :(.
-                 */
-
-                av_log(context, AV_LOG_ERROR, "DV1394: Ring buffer overflow. Reseting ..\n");
-
-                dv1394_reset(dv);
-                dv1394_start(dv);
-            }
-            dv->done = 0;
-        }
-
-        /* Wait until more frames are available */
-restart_poll:
-        p.fd = dv->fd;
-        p.events = POLLIN | POLLERR | POLLHUP;
-        if (poll(&p, 1, -1) < 0) {
-            if (errno == EAGAIN || errno == EINTR)
-                goto restart_poll;
-            av_log(context, AV_LOG_ERROR, "Poll failed: %s\n", strerror(errno));
-            return AVERROR(EIO);
-        }
-
-        if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
-            av_log(context, AV_LOG_ERROR, "Failed to get status: %s\n", strerror(errno));
-            return AVERROR(EIO);
-        }
-#ifdef DV1394_DEBUG
-        av_log(context, AV_LOG_DEBUG, "DV1394: status\n"
-                "\tactive_frame\t%d\n"
-                "\tfirst_clear_frame\t%d\n"
-                "\tn_clear_frames\t%d\n"
-                "\tdropped_frames\t%d\n",
-                s.active_frame, s.first_clear_frame,
-                s.n_clear_frames, s.dropped_frames);
-#endif
-
-        dv->avail = s.n_clear_frames;
-        dv->index = s.first_clear_frame;
-        dv->done  = 0;
-
-        if (s.dropped_frames) {
-            av_log(context, AV_LOG_ERROR, "DV1394: Frame drop detected (%d). Reseting ..\n",
-                    s.dropped_frames);
-
-            dv1394_reset(dv);
-            dv1394_start(dv);
-        }
-    }
-
-#ifdef DV1394_DEBUG
-    av_log(context, AV_LOG_DEBUG, "index %d, avail %d, done %d\n", dv->index, dv->avail,
-            dv->done);
-#endif
-
-    size = dv_produce_packet(dv->dv_demux, pkt,
-                             dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE),
-                             DV1394_PAL_FRAME_SIZE);
-    dv->index = (dv->index + 1) % DV1394_RING_FRAMES;
-    dv->done++; dv->avail--;
-
-    return size;
-}
-
-static int dv1394_close(AVFormatContext * context)
-{
-    struct dv1394_data *dv = context->priv_data;
-
-    /* Shutdown DV1394 receiver */
-    if (ioctl(dv->fd, DV1394_SHUTDOWN, 0) < 0)
-        av_log(context, AV_LOG_ERROR, "Failed to shutdown DV1394: %s\n", strerror(errno));
-
-    /* Unmap ring buffer */
-    if (munmap(dv->ring, DV1394_NTSC_FRAME_SIZE * DV1394_RING_FRAMES) < 0)
-        av_log(context, AV_LOG_ERROR, "Failed to munmap DV1394 ring buffer: %s\n", strerror(errno));
-
-    close(dv->fd);
-    av_free(dv->dv_demux);
-
-    return 0;
-}
-
-AVInputFormat dv1394_demuxer = {
-    .name           = "dv1394",
-    .long_name      = NULL_IF_CONFIG_SMALL("DV1394 A/V grab"),
-    .priv_data_size = sizeof(struct dv1394_data),
-    .read_header    = dv1394_read_header,
-    .read_packet    = dv1394_read_packet,
-    .read_close     = dv1394_close,
-    .flags          = AVFMT_NOFILE
-};
diff --git a/libavdevice/dv1394.h b/libavdevice/dv1394.h
deleted file mode 100644
index 00706f7..0000000
--- a/libavdevice/dv1394.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * DV input/output over IEEE 1394 on OHCI chips
- *   Copyright (C)2001 Daniel Maas <dmaas at dcine.com>
- *     receive, proc_fs by Dan Dennedy <dan at dennedy.org>
- *
- * based on:
- *   video1394.h - driver for OHCI 1394 boards
- *   Copyright (C)1999,2000 Sebastien Rougeaux <sebastien.rougeaux at anu.edu.au>
- *                          Peter Schlaile <udbz at rz.uni-karlsruhe.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVDEVICE_DV1394_H
-#define AVDEVICE_DV1394_H
-
-#define DV1394_DEFAULT_CHANNEL 63
-#define DV1394_DEFAULT_CARD    0
-#define DV1394_RING_FRAMES     20
-
-#define DV1394_WIDTH  720
-#define DV1394_NTSC_HEIGHT 480
-#define DV1394_PAL_HEIGHT 576
-
-/* This is the public user-space interface. Try not to break it. */
-
-#define DV1394_API_VERSION 0x20011127
-
-/* ********************
-   **                **
-   **   DV1394 API   **
-   **                **
-   ********************
-
-   There are two methods of operating the DV1394 DV output device.
-
-   1)
-
-   The simplest is an interface based on write(): simply write
-   full DV frames of data to the device, and they will be transmitted
-   as quickly as possible. The FD may be set for non-blocking I/O,
-   in which case you can use select() or poll() to wait for output
-   buffer space.
-
-   To set the DV output parameters (e.g. whether you want NTSC or PAL
-   video), use the DV1394_INIT ioctl, passing in the parameters you
-   want in a struct dv1394_init.
-
-   Example 1:
-         To play a raw .DV file:   cat foo.DV > /dev/dv1394
-         (cat will use write() internally)
-
-   Example 2:
-           static struct dv1394_init init = {
-              0x63,        (broadcast channel)
-              4,           (four-frame ringbuffer)
-              DV1394_NTSC, (send NTSC video)
-              0, 0         (default empty packet rate)
-           }
-
-           ioctl(fd, DV1394_INIT, &init);
-
-           while(1) {
-                  read( <a raw DV file>, buf, DV1394_NTSC_FRAME_SIZE );
-                  write( <the dv1394 FD>, buf, DV1394_NTSC_FRAME_SIZE );
-           }
-
-   2)
-
-   For more control over buffering, and to avoid unnecessary copies
-   of the DV data, you can use the more sophisticated the mmap() interface.
-   First, call the DV1394_INIT ioctl to specify your parameters,
-   including the number of frames in the ringbuffer. Then, calling mmap()
-   on the dv1394 device will give you direct access to the ringbuffer
-   from which the DV card reads your frame data.
-
-   The ringbuffer is simply one large, contiguous region of memory
-   containing two or more frames of packed DV data. Each frame of DV data
-   is 120000 bytes (NTSC) or 144000 bytes (PAL).
-
-   Fill one or more frames in the ringbuffer, then use the DV1394_SUBMIT_FRAMES
-   ioctl to begin I/O. You can use either the DV1394_WAIT_FRAMES ioctl
-   or select()/poll() to wait until the frames are transmitted. Next, you'll
-   need to call the DV1394_GET_STATUS ioctl to determine which ringbuffer
-   frames are clear (ready to be filled with new DV data). Finally, use
-   DV1394_SUBMIT_FRAMES again to send the new data to the DV output.
-
-
-   Example: here is what a four-frame ringbuffer might look like
-            during DV transmission:
-
-
-         frame 0   frame 1   frame 2   frame 3
-
-        *--------------------------------------*
-        | CLEAR   | DV data | DV data | CLEAR  |
-        *--------------------------------------*
-                   <ACTIVE>
-
-        transmission goes in this direction --->>>
-
-
-   The DV hardware is currently transmitting the data in frame 1.
-   Once frame 1 is finished, it will automatically transmit frame 2.
-   (if frame 2 finishes before frame 3 is submitted, the device
-   will continue to transmit frame 2, and will increase the dropped_frames
-   counter each time it repeats the transmission).
-
-
-   If you called DV1394_GET_STATUS at this instant, you would
-   receive the following values:
-
-                  n_frames          = 4
-                  active_frame      = 1
-                  first_clear_frame = 3
-                  n_clear_frames    = 2
-
-   At this point, you should write new DV data into frame 3 and optionally
-   frame 0. Then call DV1394_SUBMIT_FRAMES to inform the device that
-   it may transmit the new frames.
-
-   ERROR HANDLING
-
-   An error (buffer underflow/overflow or a break in the DV stream due
-   to a 1394 bus reset) can be detected by checking the dropped_frames
-   field of struct dv1394_status (obtained through the
-   DV1394_GET_STATUS ioctl).
-
-   The best way to recover from such an error is to re-initialize
-   dv1394, either by using the DV1394_INIT ioctl call, or closing the
-   file descriptor and opening it again. (note that you must unmap all
-   ringbuffer mappings when closing the file descriptor, or else
-   dv1394 will still be considered 'in use').
-
-   MAIN LOOP
-
-   For maximum efficiency and robustness against bus errors, you are
-   advised to model the main loop of your application after the
-   following pseudo-code example:
-
-   (checks of system call return values omitted for brevity; always
-   check return values in your code!)
-
-   while( frames left ) {
-
-    struct pollfd *pfd = ...;
-
-    pfd->fd = dv1394_fd;
-    pfd->revents = 0;
-    pfd->events = POLLOUT | POLLIN; (OUT for transmit, IN for receive)
-
-    (add other sources of I/O here)
-
-    poll(pfd, 1, -1); (or select(); add a timeout if you want)
-
-    if(pfd->revents) {
-         struct dv1394_status status;
-
-         ioctl(dv1394_fd, DV1394_GET_STATUS, &status);
-
-         if(status.dropped_frames > 0) {
-              reset_dv1394();
-         } else {
-              for(int i = 0; i < status.n_clear_frames; i++) {
-                  copy_DV_frame();
-              }
-         }
-    }
-   }
-
-   where copy_DV_frame() reads or writes on the dv1394 file descriptor
-   (read/write mode) or copies data to/from the mmap ringbuffer and
-   then calls ioctl(DV1394_SUBMIT_FRAMES) to notify dv1394 that new
-   frames are availble (mmap mode).
-
-   reset_dv1394() is called in the event of a buffer
-   underflow/overflow or a halt in the DV stream (e.g. due to a 1394
-   bus reset). To guarantee recovery from the error, this function
-   should close the dv1394 file descriptor (and munmap() all
-   ringbuffer mappings, if you are using them), then re-open the
-   dv1394 device (and re-map the ringbuffer).
-
-*/
-
-
-/* maximum number of frames in the ringbuffer */
-#define DV1394_MAX_FRAMES 32
-
-/* number of *full* isochronous packets per DV frame */
-#define DV1394_NTSC_PACKETS_PER_FRAME 250
-#define DV1394_PAL_PACKETS_PER_FRAME  300
-
-/* size of one frame's worth of DV data, in bytes */
-#define DV1394_NTSC_FRAME_SIZE (480 * DV1394_NTSC_PACKETS_PER_FRAME)
-#define DV1394_PAL_FRAME_SIZE  (480 * DV1394_PAL_PACKETS_PER_FRAME)
-
-
-/* ioctl() commands */
-
-enum {
-        /* I don't like using 0 as a valid ioctl() */
-        DV1394_INVALID = 0,
-
-
-        /* get the driver ready to transmit video.
-           pass a struct dv1394_init* as the parameter (see below),
-           or NULL to get default parameters */
-        DV1394_INIT,
-
-
-        /* stop transmitting video and free the ringbuffer */
-        DV1394_SHUTDOWN,
-
-
-        /* submit N new frames to be transmitted, where
-           the index of the first new frame is first_clear_buffer,
-           and the index of the last new frame is
-           (first_clear_buffer + N) % n_frames */
-        DV1394_SUBMIT_FRAMES,
-
-
-        /* block until N buffers are clear (pass N as the parameter)
-           Because we re-transmit the last frame on underrun, there
-           will at most be n_frames - 1 clear frames at any time */
-        DV1394_WAIT_FRAMES,
-
-        /* capture new frames that have been received, where
-           the index of the first new frame is first_clear_buffer,
-           and the index of the last new frame is
-           (first_clear_buffer + N) % n_frames */
-        DV1394_RECEIVE_FRAMES,
-
-
-        DV1394_START_RECEIVE,
-
-
-        /* pass a struct dv1394_status* as the parameter (see below) */
-        DV1394_GET_STATUS,
-};
-
-
-
-enum pal_or_ntsc {
-        DV1394_NTSC = 0,
-        DV1394_PAL
-};
-
-
-
-
-/* this is the argument to DV1394_INIT */
-struct dv1394_init {
-        /* DV1394_API_VERSION */
-        unsigned int api_version;
-
-        /* isochronous transmission channel to use */
-        unsigned int channel;
-
-        /* number of frames in the ringbuffer. Must be at least 2
-           and at most DV1394_MAX_FRAMES. */
-        unsigned int n_frames;
-
-        /* send/receive PAL or NTSC video format */
-        enum pal_or_ntsc format;
-
-        /* the following are used only for transmission */
-
-        /* set these to zero unless you want a
-           non-default empty packet rate (see below) */
-        unsigned long cip_n;
-        unsigned long cip_d;
-
-        /* set this to zero unless you want a
-           non-default SYT cycle offset (default = 3 cycles) */
-        unsigned int syt_offset;
-};
-
-/* NOTE: you may only allocate the DV frame ringbuffer once each time
-   you open the dv1394 device. DV1394_INIT will fail if you call it a
-   second time with different 'n_frames' or 'format' arguments (which
-   would imply a different size for the ringbuffer). If you need a
-   different buffer size, simply close and re-open the device, then
-   initialize it with your new settings. */
-
-/* Q: What are cip_n and cip_d? */
-
-/*
-  A: DV video streams do not utilize 100% of the potential bandwidth offered
-  by IEEE 1394 (FireWire). To achieve the correct rate of data transmission,
-  DV devices must periodically insert empty packets into the 1394 data stream.
-  Typically there is one empty packet per 14-16 data-carrying packets.
-
-  Some DV devices will accept a wide range of empty packet rates, while others
-  require a precise rate. If the dv1394 driver produces empty packets at
-  a rate that your device does not accept, you may see ugly patterns on the
-  DV output, or even no output at all.
-
-  The default empty packet insertion rate seems to work for many people; if
-  your DV output is stable, you can simply ignore this discussion. However,
-  we have exposed the empty packet rate as a parameter to support devices that
-  do not work with the default rate.
-
-  The decision to insert an empty packet is made with a numerator/denominator
-  algorithm. Empty packets are produced at an average rate of CIP_N / CIP_D.
-  You can alter the empty packet rate by passing non-zero values for cip_n
-  and cip_d to the INIT ioctl.
-
- */
-
-
-
-struct dv1394_status {
-        /* this embedded init struct returns the current dv1394
-           parameters in use */
-        struct dv1394_init init;
-
-        /* the ringbuffer frame that is currently being
-           displayed. (-1 if the device is not transmitting anything) */
-        int active_frame;
-
-        /* index of the first buffer (ahead of active_frame) that
-           is ready to be filled with data */
-        unsigned int first_clear_frame;
-
-        /* how many buffers, including first_clear_buffer, are
-           ready to be filled with data */
-        unsigned int n_clear_frames;
-
-        /* how many times the DV stream has underflowed, overflowed,
-           or otherwise encountered an error, since the previous call
-           to DV1394_GET_STATUS */
-        unsigned int dropped_frames;
-
-        /* N.B. The dropped_frames counter is only a lower bound on the actual
-           number of dropped frames, with the special case that if dropped_frames
-           is zero, then it is guaranteed that NO frames have been dropped
-           since the last call to DV1394_GET_STATUS.
-        */
-};
-
-
-#endif /* AVDEVICE_DV1394_H */
diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c
deleted file mode 100644
index b41bbdf..0000000
--- a/libavdevice/jack_audio.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * JACK Audio Connection Kit input device
- * Copyright (c) 2009 Samalyse
- * Author: Olivier Guilyardi <olivier samalyse com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include <semaphore.h>
-#include <jack/jack.h>
-
-#include "libavutil/log.h"
-#include "libavutil/fifo.h"
-#include "libavcodec/avcodec.h"
-#include "libavformat/avformat.h"
-#include "libavformat/timefilter.h"
-
-/**
- * Size of the internal FIFO buffers as a number of audio packets
- */
-#define FIFO_PACKETS_NUM 16
-
-typedef struct {
-    jack_client_t * client;
-    int             activated;
-    sem_t           packet_count;
-    jack_nframes_t  sample_rate;
-    jack_nframes_t  buffer_size;
-    jack_port_t **  ports;
-    int             nports;
-    TimeFilter *    timefilter;
-    AVFifoBuffer *  new_pkts;
-    AVFifoBuffer *  filled_pkts;
-    int             pkt_xrun;
-    int             jack_xrun;
-} JackData;
-
-static int process_callback(jack_nframes_t nframes, void *arg)
-{
-    /* Warning: this function runs in realtime. One mustn't allocate memory here
-     * or do any other thing that could block. */
-
-    int i, j;
-    JackData *self = arg;
-    float * buffer;
-    jack_nframes_t latency, cycle_delay;
-    AVPacket pkt;
-    float *pkt_data;
-    double cycle_time;
-
-    if (!self->client)
-        return 0;
-
-    /* The approximate delay since the hardware interrupt as a number of frames */
-    cycle_delay = jack_frames_since_cycle_start(self->client);
-
-    /* Retrieve filtered cycle time */
-    cycle_time = ff_timefilter_update(self->timefilter,
-                                      av_gettime() / 1000000.0 - (double) cycle_delay / self->sample_rate,
-                                      self->buffer_size);
-
-    /* Check if an empty packet is available, and if there's enough space to send it back once filled */
-    if ((av_fifo_size(self->new_pkts) < sizeof(pkt)) || (av_fifo_space(self->filled_pkts) < sizeof(pkt))) {
-        self->pkt_xrun = 1;
-        return 0;
-    }
-
-    /* Retrieve empty (but allocated) packet */
-    av_fifo_generic_read(self->new_pkts, &pkt, sizeof(pkt), NULL);
-
-    pkt_data  = (float *) pkt.data;
-    latency   = 0;
-
-    /* Copy and interleave audio data from the JACK buffer into the packet */
-    for (i = 0; i < self->nports; i++) {
-        latency += jack_port_get_total_latency(self->client, self->ports[i]);
-        buffer = jack_port_get_buffer(self->ports[i], self->buffer_size);
-        for (j = 0; j < self->buffer_size; j++)
-            pkt_data[j * self->nports + i] = buffer[j];
-    }
-
-    /* Timestamp the packet with the cycle start time minus the average latency */
-    pkt.pts = (cycle_time - (double) latency / (self->nports * self->sample_rate)) * 1000000.0;
-
-    /* Send the now filled packet back, and increase packet counter */
-    av_fifo_generic_write(self->filled_pkts, &pkt, sizeof(pkt), NULL);
-    sem_post(&self->packet_count);
-
-    return 0;
-}
-
-static void shutdown_callback(void *arg)
-{
-    JackData *self = arg;
-    self->client = NULL;
-}
-
-static int xrun_callback(void *arg)
-{
-    JackData *self = arg;
-    self->jack_xrun = 1;
-    ff_timefilter_reset(self->timefilter);
-    return 0;
-}
-
-static int supply_new_packets(JackData *self, AVFormatContext *context)
-{
-    AVPacket pkt;
-    int test, pkt_size = self->buffer_size * self->nports * sizeof(float);
-
-    /* Supply the process callback with new empty packets, by filling the new
-     * packets FIFO buffer with as many packets as possible. process_callback()
-     * can't do this by itself, because it can't allocate memory in realtime. */
-    while (av_fifo_space(self->new_pkts) >= sizeof(pkt)) {
-        if ((test = av_new_packet(&pkt, pkt_size)) < 0) {
-            av_log(context, AV_LOG_ERROR, "Could not create packet of size %d\n", pkt_size);
-            return test;
-        }
-        av_fifo_generic_write(self->new_pkts, &pkt, sizeof(pkt), NULL);
-    }
-    return 0;
-}
-
-static int start_jack(AVFormatContext *context, AVFormatParameters *params)
-{
-    JackData *self = context->priv_data;
-    jack_status_t status;
-    int i, test;
-    double o, period;
-
-    /* Register as a JACK client, using the context filename as client name. */
-    self->client = jack_client_open(context->filename, JackNullOption, &status);
-    if (!self->client) {
-        av_log(context, AV_LOG_ERROR, "Unable to register as a JACK client\n");
-        return AVERROR(EIO);
-    }
-
-    sem_init(&self->packet_count, 0, 0);
-
-    self->sample_rate = jack_get_sample_rate(self->client);
-    self->nports      = params->channels;
-    self->ports       = av_malloc(self->nports * sizeof(*self->ports));
-    self->buffer_size = jack_get_buffer_size(self->client);
-
-    /* Register JACK ports */
-    for (i = 0; i < self->nports; i++) {
-        char str[16];
-        snprintf(str, sizeof(str), "input_%d", i + 1);
-        self->ports[i] = jack_port_register(self->client, str,
-                                            JACK_DEFAULT_AUDIO_TYPE,
-                                            JackPortIsInput, 0);
-        if (!self->ports[i]) {
-            av_log(context, AV_LOG_ERROR, "Unable to register port %s:%s\n",
-                   context->filename, str);
-            jack_client_close(self->client);
-            return AVERROR(EIO);
-        }
-    }
-
-    /* Register JACK callbacks */
-    jack_set_process_callback(self->client, process_callback, self);
-    jack_on_shutdown(self->client, shutdown_callback, self);
-    jack_set_xrun_callback(self->client, xrun_callback, self);
-
-    /* Create time filter */
-    period            = (double) self->buffer_size / self->sample_rate;
-    o                 = 2 * M_PI * 1.5 * period; /// bandwidth: 1.5Hz
-    self->timefilter  = ff_timefilter_new (1.0 / self->sample_rate, sqrt(2 * o), o * o);
-
-    /* Create FIFO buffers */
-    self->filled_pkts = av_fifo_alloc(FIFO_PACKETS_NUM * sizeof(AVPacket));
-    /* New packets FIFO with one extra packet for safety against underruns */
-    self->new_pkts    = av_fifo_alloc((FIFO_PACKETS_NUM + 1) * sizeof(AVPacket));
-    if ((test = supply_new_packets(self, context))) {
-        jack_client_close(self->client);
-        return test;
-    }
-
-    return 0;
-
-}
-
-static void free_pkt_fifo(AVFifoBuffer *fifo)
-{
-    AVPacket pkt;
-    while (av_fifo_size(fifo)) {
-        av_fifo_generic_read(fifo, &pkt, sizeof(pkt), NULL);
-        av_free_packet(&pkt);
-    }
-    av_fifo_free(fifo);
-}
-
-static void stop_jack(JackData *self)
-{
-    if (self->client) {
-        if (self->activated)
-            jack_deactivate(self->client);
-        jack_client_close(self->client);
-    }
-    sem_destroy(&self->packet_count);
-    free_pkt_fifo(self->new_pkts);
-    free_pkt_fifo(self->filled_pkts);
-    av_freep(&self->ports);
-    ff_timefilter_destroy(self->timefilter);
-}
-
-static int audio_read_header(AVFormatContext *context, AVFormatParameters *params)
-{
-    JackData *self = context->priv_data;
-    AVStream *stream;
-    int test;
-
-    if (params->sample_rate <= 0 || params->channels <= 0)
-        return -1;
-
-    if ((test = start_jack(context, params)))
-        return test;
-
-    stream = av_new_stream(context, 0);
-    if (!stream) {
-        stop_jack(self);
-        return AVERROR(ENOMEM);
-    }
-
-    stream->codec->codec_type   = AVMEDIA_TYPE_AUDIO;
-#if HAVE_BIGENDIAN
-    stream->codec->codec_id     = CODEC_ID_PCM_F32BE;
-#else
-    stream->codec->codec_id     = CODEC_ID_PCM_F32LE;
-#endif
-    stream->codec->sample_rate  = self->sample_rate;
-    stream->codec->channels     = self->nports;
-
-    av_set_pts_info(stream, 64, 1, 1000000);  /* 64 bits pts in us */
-    return 0;
-}
-
-static int audio_read_packet(AVFormatContext *context, AVPacket *pkt)
-{
-    JackData *self = context->priv_data;
-    struct timespec timeout = {0, 0};
-    int test;
-
-    /* Activate the JACK client on first packet read. Activating the JACK client
-     * means that process_callback() starts to get called at regular interval.
-     * If we activate it in audio_read_header(), we're actually reading audio data
-     * from the device before instructed to, and that may result in an overrun. */
-    if (!self->activated) {
-        if (!jack_activate(self->client)) {
-            self->activated = 1;
-            av_log(context, AV_LOG_INFO,
-                   "JACK client registered and activated (rate=%dHz, buffer_size=%d frames)\n",
-                   self->sample_rate, self->buffer_size);
-        } else {
-            av_log(context, AV_LOG_ERROR, "Unable to activate JACK client\n");
-            return AVERROR(EIO);
-        }
-    }
-
-    /* Wait for a packet comming back from process_callback(), if one isn't available yet */
-    timeout.tv_sec = av_gettime() / 1000000 + 2;
-    if (sem_timedwait(&self->packet_count, &timeout)) {
-        if (errno == ETIMEDOUT) {
-            av_log(context, AV_LOG_ERROR,
-                   "Input error: timed out when waiting for JACK process callback output\n");
-        } else {
-            av_log(context, AV_LOG_ERROR, "Error while waiting for audio packet: %s\n",
-                   strerror(errno));
-        }
-        if (!self->client)
-            av_log(context, AV_LOG_ERROR, "Input error: JACK server is gone\n");
-
-        return AVERROR(EIO);
-    }
-
-    if (self->pkt_xrun) {
-        av_log(context, AV_LOG_WARNING, "Audio packet xrun\n");
-        self->pkt_xrun = 0;
-    }
-
-    if (self->jack_xrun) {
-        av_log(context, AV_LOG_WARNING, "JACK xrun\n");
-        self->jack_xrun = 0;
-    }
-
-    /* Retrieve the packet filled with audio data by process_callback() */
-    av_fifo_generic_read(self->filled_pkts, pkt, sizeof(*pkt), NULL);
-
-    if ((test = supply_new_packets(self, context)))
-        return test;
-
-    return 0;
-}
-
-static int audio_read_close(AVFormatContext *context)
-{
-    JackData *self = context->priv_data;
-    stop_jack(self);
-    return 0;
-}
-
-AVInputFormat jack_demuxer = {
-    "jack",
-    NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
-    sizeof(JackData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    audio_read_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v
deleted file mode 100644
index 663af85..0000000
--- a/libavdevice/libavdevice.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBAVDEVICE_$MAJOR {
-        global: avdevice_*;
-        local: *;
-};
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
deleted file mode 100644
index 1f35135..0000000
--- a/libavdevice/libdc1394.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * IIDC1394 grab interface (uses libdc1394 and libraw1394)
- * Copyright (c) 2004 Roman Shaposhnik
- * Copyright (c) 2008 Alessandro Sappia
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "libavformat/avformat.h"
-
-#if HAVE_LIBDC1394_2
-#include <dc1394/dc1394.h>
-#elif HAVE_LIBDC1394_1
-#include <libraw1394/raw1394.h>
-#include <libdc1394/dc1394_control.h>
-
-#define DC1394_VIDEO_MODE_320x240_YUV422 MODE_320x240_YUV422
-#define DC1394_VIDEO_MODE_640x480_YUV411 MODE_640x480_YUV411
-#define DC1394_VIDEO_MODE_640x480_YUV422 MODE_640x480_YUV422
-#define DC1394_FRAMERATE_1_875 FRAMERATE_1_875
-#define DC1394_FRAMERATE_3_75  FRAMERATE_3_75
-#define DC1394_FRAMERATE_7_5   FRAMERATE_7_5
-#define DC1394_FRAMERATE_15    FRAMERATE_15
-#define DC1394_FRAMERATE_30    FRAMERATE_30
-#define DC1394_FRAMERATE_60    FRAMERATE_60
-#define DC1394_FRAMERATE_120   FRAMERATE_120
-#define DC1394_FRAMERATE_240   FRAMERATE_240
-#endif
-
-#undef free
-
-typedef struct dc1394_data {
-#if HAVE_LIBDC1394_1
-    raw1394handle_t handle;
-    dc1394_cameracapture camera;
-#elif HAVE_LIBDC1394_2
-    dc1394_t *d;
-    dc1394camera_t *camera;
-    dc1394video_frame_t *frame;
-#endif
-    int current_frame;
-    int fps;
-
-    AVPacket packet;
-} dc1394_data;
-
-struct dc1394_frame_format {
-    int width;
-    int height;
-    enum PixelFormat pix_fmt;
-    int frame_size_id;
-} dc1394_frame_formats[] = {
-    { 320, 240, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 },
-    { 640, 480, PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 },
-    { 640, 480, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 },
-    { 0, 0, 0, 0 } /* gotta be the last one */
-};
-
-struct dc1394_frame_rate {
-    int frame_rate;
-    int frame_rate_id;
-} dc1394_frame_rates[] = {
-    {  1875, DC1394_FRAMERATE_1_875 },
-    {  3750, DC1394_FRAMERATE_3_75  },
-    {  7500, DC1394_FRAMERATE_7_5   },
-    { 15000, DC1394_FRAMERATE_15    },
-    { 30000, DC1394_FRAMERATE_30    },
-    { 60000, DC1394_FRAMERATE_60    },
-    {120000, DC1394_FRAMERATE_120   },
-    {240000, DC1394_FRAMERATE_240    },
-    { 0, 0 } /* gotta be the last one */
-};
-
-static inline int dc1394_read_common(AVFormatContext *c, AVFormatParameters *ap,
-                                     struct dc1394_frame_format **select_fmt, struct dc1394_frame_rate **select_fps)
-{
-    dc1394_data* dc1394 = c->priv_data;
-    AVStream* vst;
-    struct dc1394_frame_format *fmt;
-    struct dc1394_frame_rate *fps;
-    enum PixelFormat pix_fmt = ap->pix_fmt == PIX_FMT_NONE ? PIX_FMT_UYVY422 : ap->pix_fmt; /* defaults */
-    int width                = !ap->width ? 320 : ap->width;
-    int height               = !ap->height ? 240 : ap->height;
-    int frame_rate           = !ap->time_base.num ? 30000 : av_rescale(1000, ap->time_base.den, ap->time_base.num);
-
-    for (fmt = dc1394_frame_formats; fmt->width; fmt++)
-         if (fmt->pix_fmt == pix_fmt && fmt->width == width && fmt->height == height)
-             break;
-
-    for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
-         if (fps->frame_rate == frame_rate)
-             break;
-
-    if (!fps->frame_rate || !fmt->width) {
-        av_log(c, AV_LOG_ERROR, "Can't find matching camera format for %s, %dx%d@%d:1000fps\n", avcodec_get_pix_fmt_name(pix_fmt),
-                                                                                                width, height, frame_rate);
-        goto out;
-    }
-
-    /* create a video stream */
-    vst = av_new_stream(c, 0);
-    if (!vst)
-        goto out;
-    av_set_pts_info(vst, 64, 1, 1000);
-    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id = CODEC_ID_RAWVIDEO;
-    vst->codec->time_base.den = fps->frame_rate;
-    vst->codec->time_base.num = 1000;
-    vst->codec->width = fmt->width;
-    vst->codec->height = fmt->height;
-    vst->codec->pix_fmt = fmt->pix_fmt;
-
-    /* packet init */
-    av_init_packet(&dc1394->packet);
-    dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height);
-    dc1394->packet.stream_index = vst->index;
-    dc1394->packet.flags |= AV_PKT_FLAG_KEY;
-
-    dc1394->current_frame = 0;
-    dc1394->fps = fps->frame_rate;
-
-    vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
-    *select_fps = fps;
-    *select_fmt = fmt;
-    return 0;
-out:
-    return -1;
-}
-
-#if HAVE_LIBDC1394_1
-static int dc1394_v1_read_header(AVFormatContext *c, AVFormatParameters * ap)
-{
-    dc1394_data* dc1394 = c->priv_data;
-    AVStream* vst;
-    nodeid_t* camera_nodes;
-    int res;
-    struct dc1394_frame_format *fmt = NULL;
-    struct dc1394_frame_rate *fps = NULL;
-
-    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
-        return -1;
-
-    /* Now let us prep the hardware. */
-    dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
-    if (!dc1394->handle) {
-        av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
-        goto out;
-    }
-    camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
-    if (!camera_nodes || camera_nodes[ap->channel] == DC1394_NO_CAMERA) {
-        av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", ap->channel);
-        goto out_handle;
-    }
-    res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel],
-                                   0,
-                                   FORMAT_VGA_NONCOMPRESSED,
-                                   fmt->frame_size_id,
-                                   SPEED_400,
-                                   fps->frame_rate_id, 8, 1,
-                                   c->filename,
-                                   &dc1394->camera);
-    dc1394_free_camera_nodes(camera_nodes);
-    if (res != DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
-        goto out_handle;
-    }
-
-    res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
-    if (res != DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
-        goto out_handle_dma;
-    }
-
-    return 0;
-
-out_handle_dma:
-    dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
-    dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
-out_handle:
-    dc1394_destroy_handle(dc1394->handle);
-out:
-    return -1;
-}
-
-static int dc1394_v1_read_packet(AVFormatContext *c, AVPacket *pkt)
-{
-    struct dc1394_data *dc1394 = c->priv_data;
-    int res;
-
-    /* discard stale frame */
-    if (dc1394->current_frame++) {
-        if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
-            av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
-    }
-
-    res = dc1394_dma_single_capture(&dc1394->camera);
-
-    if (res == DC1394_SUCCESS) {
-        dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer);
-        dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->fps;
-        res = dc1394->packet.size;
-    } else {
-        av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
-        dc1394->packet.data = NULL;
-        res = -1;
-    }
-
-    *pkt = dc1394->packet;
-    return res;
-}
-
-static int dc1394_v1_close(AVFormatContext * context)
-{
-    struct dc1394_data *dc1394 = context->priv_data;
-
-    dc1394_stop_iso_transmission(dc1394->handle, dc1394->camera.node);
-    dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
-    dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
-    dc1394_destroy_handle(dc1394->handle);
-
-    return 0;
-}
-
-#elif HAVE_LIBDC1394_2
-static int dc1394_v2_read_header(AVFormatContext *c, AVFormatParameters * ap)
-{
-    dc1394_data* dc1394 = c->priv_data;
-    dc1394camera_list_t *list;
-    int res, i;
-    struct dc1394_frame_format *fmt = NULL;
-    struct dc1394_frame_rate *fps = NULL;
-
-    if (dc1394_read_common(c,ap,&fmt,&fps) != 0)
-       return -1;
-
-    /* Now let us prep the hardware. */
-    dc1394->d = dc1394_new();
-    dc1394_camera_enumerate (dc1394->d, &list);
-    if ( !list || list->num == 0) {
-        av_log(c, AV_LOG_ERROR, "Unable to look for an IIDC camera\n\n");
-        goto out;
-    }
-
-    /* FIXME: To select a specific camera I need to search in list its guid */
-    dc1394->camera = dc1394_camera_new (dc1394->d, list->ids[0].guid);
-    if (list->num > 1) {
-        av_log(c, AV_LOG_INFO, "Working with the first camera found\n");
-    }
-
-    /* Freeing list of cameras */
-    dc1394_camera_free_list (list);
-
-    /* Select MAX Speed possible from the cam */
-    if (dc1394->camera->bmode_capable>0) {
-       dc1394_video_set_operation_mode(dc1394->camera, DC1394_OPERATION_MODE_1394B);
-       i = DC1394_ISO_SPEED_800;
-    } else {
-       i = DC1394_ISO_SPEED_400;
-    }
-
-    for (res = DC1394_FAILURE; i >= DC1394_ISO_SPEED_MIN && res != DC1394_SUCCESS; i--) {
-            res=dc1394_video_set_iso_speed(dc1394->camera, i);
-    }
-    if (res != DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Couldn't set ISO Speed\n");
-        goto out_camera;
-    }
-
-    if (dc1394_video_set_mode(dc1394->camera, fmt->frame_size_id) != DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Couldn't set video format\n");
-        goto out_camera;
-    }
-
-    if (dc1394_video_set_framerate(dc1394->camera,fps->frame_rate_id) != DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Couldn't set framerate %d \n",fps->frame_rate);
-        goto out_camera;
-    }
-    if (dc1394_capture_setup(dc1394->camera, 10, DC1394_CAPTURE_FLAGS_DEFAULT)!=DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Cannot setup camera \n");
-        goto out_camera;
-    }
-
-    if (dc1394_video_set_transmission(dc1394->camera, DC1394_ON) !=DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Cannot start capture\n");
-        goto out_camera;
-    }
-    return 0;
-
-out_camera:
-    dc1394_capture_stop(dc1394->camera);
-    dc1394_video_set_transmission(dc1394->camera, DC1394_OFF);
-    dc1394_camera_free (dc1394->camera);
-out:
-    dc1394_free(dc1394->d);
-    return -1;
-}
-
-static int dc1394_v2_read_packet(AVFormatContext *c, AVPacket *pkt)
-{
-    struct dc1394_data *dc1394 = c->priv_data;
-    int res;
-
-    /* discard stale frame */
-    if (dc1394->current_frame++) {
-        if (dc1394_capture_enqueue(dc1394->camera, dc1394->frame) != DC1394_SUCCESS)
-            av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
-    }
-
-    res = dc1394_capture_dequeue(dc1394->camera, DC1394_CAPTURE_POLICY_WAIT, &dc1394->frame);
-    if (res == DC1394_SUCCESS) {
-        dc1394->packet.data = (uint8_t *)(dc1394->frame->image);
-        dc1394->packet.pts = (dc1394->current_frame  * 1000000) / (dc1394->fps);
-        res = dc1394->frame->image_bytes;
-    } else {
-        av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
-        dc1394->packet.data = NULL;
-        res = -1;
-    }
-
-    *pkt = dc1394->packet;
-    return res;
-}
-
-static int dc1394_v2_close(AVFormatContext * context)
-{
-    struct dc1394_data *dc1394 = context->priv_data;
-
-    dc1394_video_set_transmission(dc1394->camera, DC1394_OFF);
-    dc1394_capture_stop(dc1394->camera);
-    dc1394_camera_free(dc1394->camera);
-    dc1394_free(dc1394->d);
-
-    return 0;
-}
-
-AVInputFormat libdc1394_demuxer = {
-    .name           = "libdc1394",
-    .long_name      = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"),
-    .priv_data_size = sizeof(struct dc1394_data),
-    .read_header    = dc1394_v2_read_header,
-    .read_packet    = dc1394_v2_read_packet,
-    .read_close     = dc1394_v2_close,
-    .flags          = AVFMT_NOFILE
-};
-
-#endif
-#if HAVE_LIBDC1394_1
-AVInputFormat libdc1394_demuxer = {
-    .name           = "libdc1394",
-    .long_name      = NULL_IF_CONFIG_SMALL("dc1394 v.1 A/V grab"),
-    .priv_data_size = sizeof(struct dc1394_data),
-    .read_header    = dc1394_v1_read_header,
-    .read_packet    = dc1394_v1_read_packet,
-    .read_close     = dc1394_v1_close,
-    .flags          = AVFMT_NOFILE
-};
-#endif
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
deleted file mode 100644
index d382c03..0000000
--- a/libavdevice/oss_audio.c
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Linux audio play and grab interface
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <errno.h>
-#if HAVE_SOUNDCARD_H
-#include <soundcard.h>
-#else
-#include <sys/soundcard.h>
-#endif
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/select.h>
-
-#include "libavutil/log.h"
-#include "libavcodec/avcodec.h"
-#include "libavformat/avformat.h"
-
-#define AUDIO_BLOCK_SIZE 4096
-
-typedef struct {
-    int fd;
-    int sample_rate;
-    int channels;
-    int frame_size; /* in bytes ! */
-    enum CodecID codec_id;
-    unsigned int flip_left : 1;
-    uint8_t buffer[AUDIO_BLOCK_SIZE];
-    int buffer_ptr;
-} AudioData;
-
-static int audio_open(AVFormatContext *s1, int is_output, const char *audio_device)
-{
-    AudioData *s = s1->priv_data;
-    int audio_fd;
-    int tmp, err;
-    char *flip = getenv("AUDIO_FLIP_LEFT");
-
-    if (is_output)
-        audio_fd = open(audio_device, O_WRONLY);
-    else
-        audio_fd = open(audio_device, O_RDONLY);
-    if (audio_fd < 0) {
-        av_log(s1, AV_LOG_ERROR, "%s: %s\n", audio_device, strerror(errno));
-        return AVERROR(EIO);
-    }
-
-    if (flip && *flip == '1') {
-        s->flip_left = 1;
-    }
-
-    /* non blocking mode */
-    if (!is_output)
-        fcntl(audio_fd, F_SETFL, O_NONBLOCK);
-
-    s->frame_size = AUDIO_BLOCK_SIZE;
-#if 0
-    tmp = (NB_FRAGMENTS << 16) | FRAGMENT_BITS;
-    err = ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &tmp);
-    if (err < 0) {
-        perror("SNDCTL_DSP_SETFRAGMENT");
-    }
-#endif
-
-    /* select format : favour native format */
-    err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
-
-#if HAVE_BIGENDIAN
-    if (tmp & AFMT_S16_BE) {
-        tmp = AFMT_S16_BE;
-    } else if (tmp & AFMT_S16_LE) {
-        tmp = AFMT_S16_LE;
-    } else {
-        tmp = 0;
-    }
-#else
-    if (tmp & AFMT_S16_LE) {
-        tmp = AFMT_S16_LE;
-    } else if (tmp & AFMT_S16_BE) {
-        tmp = AFMT_S16_BE;
-    } else {
-        tmp = 0;
-    }
-#endif
-
-    switch(tmp) {
-    case AFMT_S16_LE:
-        s->codec_id = CODEC_ID_PCM_S16LE;
-        break;
-    case AFMT_S16_BE:
-        s->codec_id = CODEC_ID_PCM_S16BE;
-        break;
-    default:
-        av_log(s1, AV_LOG_ERROR, "Soundcard does not support 16 bit sample format\n");
-        close(audio_fd);
-        return AVERROR(EIO);
-    }
-    err=ioctl(audio_fd, SNDCTL_DSP_SETFMT, &tmp);
-    if (err < 0) {
-        av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_SETFMT: %s\n", strerror(errno));
-        goto fail;
-    }
-
-    tmp = (s->channels == 2);
-    err = ioctl(audio_fd, SNDCTL_DSP_STEREO, &tmp);
-    if (err < 0) {
-        av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_STEREO: %s\n", strerror(errno));
-        goto fail;
-    }
-
-    tmp = s->sample_rate;
-    err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &tmp);
-    if (err < 0) {
-        av_log(s1, AV_LOG_ERROR, "SNDCTL_DSP_SPEED: %s\n", strerror(errno));
-        goto fail;
-    }
-    s->sample_rate = tmp; /* store real sample rate */
-    s->fd = audio_fd;
-
-    return 0;
- fail:
-    close(audio_fd);
-    return AVERROR(EIO);
-}
-
-static int audio_close(AudioData *s)
-{
-    close(s->fd);
-    return 0;
-}
-
-/* sound output support */
-static int audio_write_header(AVFormatContext *s1)
-{
-    AudioData *s = s1->priv_data;
-    AVStream *st;
-    int ret;
-
-    st = s1->streams[0];
-    s->sample_rate = st->codec->sample_rate;
-    s->channels = st->codec->channels;
-    ret = audio_open(s1, 1, s1->filename);
-    if (ret < 0) {
-        return AVERROR(EIO);
-    } else {
-        return 0;
-    }
-}
-
-static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    AudioData *s = s1->priv_data;
-    int len, ret;
-    int size= pkt->size;
-    uint8_t *buf= pkt->data;
-
-    while (size > 0) {
-        len = AUDIO_BLOCK_SIZE - s->buffer_ptr;
-        if (len > size)
-            len = size;
-        memcpy(s->buffer + s->buffer_ptr, buf, len);
-        s->buffer_ptr += len;
-        if (s->buffer_ptr >= AUDIO_BLOCK_SIZE) {
-            for(;;) {
-                ret = write(s->fd, s->buffer, AUDIO_BLOCK_SIZE);
-                if (ret > 0)
-                    break;
-                if (ret < 0 && (errno != EAGAIN && errno != EINTR))
-                    return AVERROR(EIO);
-            }
-            s->buffer_ptr = 0;
-        }
-        buf += len;
-        size -= len;
-    }
-    return 0;
-}
-
-static int audio_write_trailer(AVFormatContext *s1)
-{
-    AudioData *s = s1->priv_data;
-
-    audio_close(s);
-    return 0;
-}
-
-/* grab support */
-
-static int audio_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    AudioData *s = s1->priv_data;
-    AVStream *st;
-    int ret;
-
-    if (ap->sample_rate <= 0 || ap->channels <= 0)
-        return -1;
-
-    st = av_new_stream(s1, 0);
-    if (!st) {
-        return AVERROR(ENOMEM);
-    }
-    s->sample_rate = ap->sample_rate;
-    s->channels = ap->channels;
-
-    ret = audio_open(s1, 0, s1->filename);
-    if (ret < 0) {
-        return AVERROR(EIO);
-    }
-
-    /* take real parameters */
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = s->codec_id;
-    st->codec->sample_rate = s->sample_rate;
-    st->codec->channels = s->channels;
-
-    av_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
-    return 0;
-}
-
-static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    AudioData *s = s1->priv_data;
-    int ret, bdelay;
-    int64_t cur_time;
-    struct audio_buf_info abufi;
-
-    if ((ret=av_new_packet(pkt, s->frame_size)) < 0)
-        return ret;
-
-    ret = read(s->fd, pkt->data, pkt->size);
-    if (ret <= 0){
-        av_free_packet(pkt);
-        pkt->size = 0;
-        if (ret<0)  return AVERROR(errno);
-        else        return AVERROR_EOF;
-    }
-    pkt->size = ret;
-
-    /* compute pts of the start of the packet */
-    cur_time = av_gettime();
-    bdelay = ret;
-    if (ioctl(s->fd, SNDCTL_DSP_GETISPACE, &abufi) == 0) {
-        bdelay += abufi.bytes;
-    }
-    /* subtract time represented by the number of bytes in the audio fifo */
-    cur_time -= (bdelay * 1000000LL) / (s->sample_rate * s->channels);
-
-    /* convert to wanted units */
-    pkt->pts = cur_time;
-
-    if (s->flip_left && s->channels == 2) {
-        int i;
-        short *p = (short *) pkt->data;
-
-        for (i = 0; i < ret; i += 4) {
-            *p = ~*p;
-            p += 2;
-        }
-    }
-    return 0;
-}
-
-static int audio_read_close(AVFormatContext *s1)
-{
-    AudioData *s = s1->priv_data;
-
-    audio_close(s);
-    return 0;
-}
-
-#if CONFIG_OSS_INDEV
-AVInputFormat oss_demuxer = {
-    "oss",
-    NULL_IF_CONFIG_SMALL("Open Sound System capture"),
-    sizeof(AudioData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    audio_read_close,
-    .flags = AVFMT_NOFILE,
-};
-#endif
-
-#if CONFIG_OSS_OUTDEV
-AVOutputFormat oss_muxer = {
-    "oss",
-    NULL_IF_CONFIG_SMALL("Open Sound System playback"),
-    "",
-    "",
-    sizeof(AudioData),
-    /* XXX: we make the assumption that the soundcard accepts this format */
-    /* XXX: find better solution with "preinit" method, needed also in
-       other formats */
-#if HAVE_BIGENDIAN
-    CODEC_ID_PCM_S16BE,
-#else
-    CODEC_ID_PCM_S16LE,
-#endif
-    CODEC_ID_NONE,
-    audio_write_header,
-    audio_write_packet,
-    audio_write_trailer,
-    .flags = AVFMT_NOFILE,
-};
-#endif
diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
deleted file mode 100644
index d0ef7d5..0000000
--- a/libavdevice/v4l.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Linux video grab interface
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef __STRICT_ANSI__ //workaround due to broken kernel headers
-#include "config.h"
-#include "libavutil/rational.h"
-#include "libavformat/avformat.h"
-#include "libavcodec/dsputil.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#define _LINUX_TIME_H 1
-#include <linux/videodev.h>
-#include <time.h>
-#include <strings.h>
-
-typedef struct {
-    int fd;
-    int frame_format; /* see VIDEO_PALETTE_xxx */
-    int use_mmap;
-    AVRational time_base;
-    int64_t time_frame;
-    int frame_size;
-    struct video_capability video_cap;
-    struct video_audio audio_saved;
-    struct video_window video_win;
-    uint8_t *video_buf;
-    struct video_mbuf gb_buffers;
-    struct video_mmap gb_buf;
-    int gb_frame;
-} VideoData;
-
-static const struct {
-    int palette;
-    int depth;
-    enum PixelFormat pix_fmt;
-} video_formats [] = {
-    {.palette = VIDEO_PALETTE_YUV420P, .depth = 12, .pix_fmt = PIX_FMT_YUV420P },
-    {.palette = VIDEO_PALETTE_YUV422,  .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
-    {.palette = VIDEO_PALETTE_UYVY,    .depth = 16, .pix_fmt = PIX_FMT_UYVY422 },
-    {.palette = VIDEO_PALETTE_YUYV,    .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
-    /* NOTE: v4l uses BGR24, not RGB24 */
-    {.palette = VIDEO_PALETTE_RGB24,   .depth = 24, .pix_fmt = PIX_FMT_BGR24   },
-    {.palette = VIDEO_PALETTE_RGB565,  .depth = 16, .pix_fmt = PIX_FMT_BGR565  },
-    {.palette = VIDEO_PALETTE_GREY,    .depth = 8,  .pix_fmt = PIX_FMT_GRAY8   },
-};
-
-
-static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    VideoData *s = s1->priv_data;
-    AVStream *st;
-    int video_fd;
-    int desired_palette, desired_depth;
-    struct video_tuner tuner;
-    struct video_audio audio;
-    struct video_picture pict;
-    int j;
-    int vformat_num = FF_ARRAY_ELEMS(video_formats);
-
-    if (ap->time_base.den <= 0) {
-        av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den);
-        return -1;
-    }
-    s->time_base = ap->time_base;
-
-    s->video_win.width = ap->width;
-    s->video_win.height = ap->height;
-
-    st = av_new_stream(s1, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
-
-    video_fd = open(s1->filename, O_RDWR);
-    if (video_fd < 0) {
-        av_log(s1, AV_LOG_ERROR, "%s: %s\n", s1->filename, strerror(errno));
-        goto fail;
-    }
-
-    if (ioctl(video_fd, VIDIOCGCAP, &s->video_cap) < 0) {
-        av_log(s1, AV_LOG_ERROR, "VIDIOCGCAP: %s\n", strerror(errno));
-        goto fail;
-    }
-
-    if (!(s->video_cap.type & VID_TYPE_CAPTURE)) {
-        av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not handle capture\n");
-        goto fail;
-    }
-
-    /* no values set, autodetect them */
-    if (s->video_win.width <= 0 || s->video_win.height <= 0) {
-        if (ioctl(video_fd, VIDIOCGWIN, &s->video_win, sizeof(s->video_win)) < 0) {
-            av_log(s1, AV_LOG_ERROR, "VIDIOCGWIN: %s\n", strerror(errno));
-            goto fail;
-        }
-    }
-
-    if(avcodec_check_dimensions(s1, s->video_win.width, s->video_win.height) < 0)
-        return -1;
-
-    desired_palette = -1;
-    desired_depth = -1;
-    for (j = 0; j < vformat_num; j++) {
-        if (ap->pix_fmt == video_formats[j].pix_fmt) {
-            desired_palette = video_formats[j].palette;
-            desired_depth = video_formats[j].depth;
-            break;
-        }
-    }
-
-    /* set tv standard */
-    if (ap->standard && !ioctl(video_fd, VIDIOCGTUNER, &tuner)) {
-        if (!strcasecmp(ap->standard, "pal"))
-            tuner.mode = VIDEO_MODE_PAL;
-        else if (!strcasecmp(ap->standard, "secam"))
-            tuner.mode = VIDEO_MODE_SECAM;
-        else
-            tuner.mode = VIDEO_MODE_NTSC;
-        ioctl(video_fd, VIDIOCSTUNER, &tuner);
-    }
-
-    /* unmute audio */
-    audio.audio = 0;
-    ioctl(video_fd, VIDIOCGAUDIO, &audio);
-    memcpy(&s->audio_saved, &audio, sizeof(audio));
-    audio.flags &= ~VIDEO_AUDIO_MUTE;
-    ioctl(video_fd, VIDIOCSAUDIO, &audio);
-
-    ioctl(video_fd, VIDIOCGPICT, &pict);
-#if 0
-    printf("v4l: colour=%d hue=%d brightness=%d constrast=%d whiteness=%d\n",
-           pict.colour,
-           pict.hue,
-           pict.brightness,
-           pict.contrast,
-           pict.whiteness);
-#endif
-    /* try to choose a suitable video format */
-    pict.palette = desired_palette;
-    pict.depth= desired_depth;
-    if (desired_palette == -1 || ioctl(video_fd, VIDIOCSPICT, &pict) < 0) {
-        for (j = 0; j < vformat_num; j++) {
-            pict.palette = video_formats[j].palette;
-            pict.depth = video_formats[j].depth;
-            if (-1 != ioctl(video_fd, VIDIOCSPICT, &pict))
-                break;
-        }
-        if (j >= vformat_num)
-            goto fail1;
-    }
-
-    if (ioctl(video_fd, VIDIOCGMBUF, &s->gb_buffers) < 0) {
-        /* try to use read based access */
-        int val;
-
-        s->video_win.x = 0;
-        s->video_win.y = 0;
-        s->video_win.chromakey = -1;
-        s->video_win.flags = 0;
-
-        if (ioctl(video_fd, VIDIOCSWIN, s->video_win) < 0) {
-            av_log(s1, AV_LOG_ERROR, "VIDIOCSWIN: %s\n", strerror(errno));
-            goto fail;
-        }
-
-        s->frame_format = pict.palette;
-
-        val = 1;
-        if (ioctl(video_fd, VIDIOCCAPTURE, &val) < 0) {
-            av_log(s1, AV_LOG_ERROR, "VIDIOCCAPTURE: %s\n", strerror(errno));
-            goto fail;
-        }
-
-        s->time_frame = av_gettime() * s->time_base.den / s->time_base.num;
-        s->use_mmap = 0;
-    } else {
-        s->video_buf = mmap(0, s->gb_buffers.size, PROT_READ|PROT_WRITE, MAP_SHARED, video_fd, 0);
-        if ((unsigned char*)-1 == s->video_buf) {
-            s->video_buf = mmap(0, s->gb_buffers.size, PROT_READ|PROT_WRITE, MAP_PRIVATE, video_fd, 0);
-            if ((unsigned char*)-1 == s->video_buf) {
-                av_log(s1, AV_LOG_ERROR, "mmap: %s\n", strerror(errno));
-                goto fail;
-            }
-        }
-        s->gb_frame = 0;
-        s->time_frame = av_gettime() * s->time_base.den / s->time_base.num;
-
-        /* start to grab the first frame */
-        s->gb_buf.frame = s->gb_frame % s->gb_buffers.frames;
-        s->gb_buf.height = s->video_win.height;
-        s->gb_buf.width = s->video_win.width;
-        s->gb_buf.format = pict.palette;
-
-        if (ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf) < 0) {
-            if (errno != EAGAIN) {
-            fail1:
-                av_log(s1, AV_LOG_ERROR, "VIDIOCMCAPTURE: %s\n", strerror(errno));
-            } else {
-                av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not receive any video signal\n");
-            }
-            goto fail;
-        }
-        for (j = 1; j < s->gb_buffers.frames; j++) {
-          s->gb_buf.frame = j;
-          ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf);
-        }
-        s->frame_format = s->gb_buf.format;
-        s->use_mmap = 1;
-    }
-
-    for (j = 0; j < vformat_num; j++) {
-        if (s->frame_format == video_formats[j].palette) {
-            s->frame_size = s->video_win.width * s->video_win.height * video_formats[j].depth / 8;
-            st->codec->pix_fmt = video_formats[j].pix_fmt;
-            break;
-        }
-    }
-
-    if (j >= vformat_num)
-        goto fail;
-
-    s->fd = video_fd;
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_RAWVIDEO;
-    st->codec->width = s->video_win.width;
-    st->codec->height = s->video_win.height;
-    st->codec->time_base = s->time_base;
-    st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
-
-    return 0;
- fail:
-    if (video_fd >= 0)
-        close(video_fd);
-    return AVERROR(EIO);
-}
-
-static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
-{
-    uint8_t *ptr;
-
-    while (ioctl(s->fd, VIDIOCSYNC, &s->gb_frame) < 0 &&
-           (errno == EAGAIN || errno == EINTR));
-
-    ptr = s->video_buf + s->gb_buffers.offsets[s->gb_frame];
-    memcpy(buf, ptr, s->frame_size);
-
-    /* Setup to capture the next frame */
-    s->gb_buf.frame = s->gb_frame;
-    if (ioctl(s->fd, VIDIOCMCAPTURE, &s->gb_buf) < 0) {
-        if (errno == EAGAIN)
-            av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
-        else
-            av_log(NULL, AV_LOG_ERROR, "VIDIOCMCAPTURE: %s\n", strerror(errno));
-        return AVERROR(EIO);
-    }
-
-    /* This is now the grabbing frame */
-    s->gb_frame = (s->gb_frame + 1) % s->gb_buffers.frames;
-
-    return s->frame_size;
-}
-
-static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    VideoData *s = s1->priv_data;
-    int64_t curtime, delay;
-    struct timespec ts;
-
-    /* Calculate the time of the next frame */
-    s->time_frame += INT64_C(1000000);
-
-    /* wait based on the frame rate */
-    for(;;) {
-        curtime = av_gettime();
-        delay = s->time_frame * s->time_base.num / s->time_base.den - curtime;
-        if (delay <= 0) {
-            if (delay < INT64_C(-1000000) * s->time_base.num / s->time_base.den) {
-                /* printf("grabbing is %d frames late (dropping)\n", (int) -(delay / 16666)); */
-                s->time_frame += INT64_C(1000000);
-            }
-            break;
-        }
-        ts.tv_sec = delay / 1000000;
-        ts.tv_nsec = (delay % 1000000) * 1000;
-        nanosleep(&ts, NULL);
-    }
-
-    if (av_new_packet(pkt, s->frame_size) < 0)
-        return AVERROR(EIO);
-
-    pkt->pts = curtime;
-
-    /* read one frame */
-    if (s->use_mmap) {
-        return v4l_mm_read_picture(s, pkt->data);
-    } else {
-        if (read(s->fd, pkt->data, pkt->size) != pkt->size)
-            return AVERROR(EIO);
-        return s->frame_size;
-    }
-}
-
-static int grab_read_close(AVFormatContext *s1)
-{
-    VideoData *s = s1->priv_data;
-
-    if (s->use_mmap)
-        munmap(s->video_buf, s->gb_buffers.size);
-
-    /* mute audio. we must force it because the BTTV driver does not
-       return its state correctly */
-    s->audio_saved.flags |= VIDEO_AUDIO_MUTE;
-    ioctl(s->fd, VIDIOCSAUDIO, &s->audio_saved);
-
-    close(s->fd);
-    return 0;
-}
-
-AVInputFormat v4l_demuxer = {
-    "video4linux",
-    NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
-    sizeof(VideoData),
-    NULL,
-    grab_read_header,
-    grab_read_packet,
-    grab_read_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
deleted file mode 100644
index ce88903..0000000
--- a/libavdevice/v4l2.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
- * Video4Linux2 grab interface
- * Copyright (c) 2000,2001 Fabrice Bellard
- * Copyright (c) 2006 Luca Abeni
- *
- * Part of this file is based on the V4L2 video capture example
- * (http://v4l2spec.bytesex.org/v4l2spec/capture.c)
- *
- * Thanks to Michael Niedermayer for providing the mapping between
- * V4L2_PIX_FMT_* and PIX_FMT_*
- *
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef __STRICT_ANSI__ //workaround due to broken kernel headers
-#include "config.h"
-#include "libavformat/avformat.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#if HAVE_SYS_VIDEOIO_H
-#include <sys/videoio.h>
-#else
-#include <asm/types.h>
-#include <linux/videodev2.h>
-#endif
-#include <time.h>
-#include <strings.h>
-
-static const int desired_video_buffers = 256;
-
-enum io_method {
-    io_read,
-    io_mmap,
-    io_userptr
-};
-
-struct video_data {
-    int fd;
-    int frame_format; /* V4L2_PIX_FMT_* */
-    enum io_method io_method;
-    int width, height;
-    int frame_size;
-    int top_field_first;
-
-    int buffers;
-    void **buf_start;
-    unsigned int *buf_len;
-};
-
-struct buff_data {
-    int index;
-    int fd;
-};
-
-struct fmt_map {
-    enum PixelFormat ff_fmt;
-    enum CodecID codec_id;
-    uint32_t v4l2_fmt;
-};
-
-static struct fmt_map fmt_conversion_table[] = {
-    {
-        .ff_fmt = PIX_FMT_YUV420P,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_YUV420,
-    },
-    {
-        .ff_fmt = PIX_FMT_YUV422P,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_YUV422P,
-    },
-    {
-        .ff_fmt = PIX_FMT_YUYV422,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_YUYV,
-    },
-    {
-        .ff_fmt = PIX_FMT_UYVY422,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_UYVY,
-    },
-    {
-        .ff_fmt = PIX_FMT_YUV411P,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_YUV411P,
-    },
-    {
-        .ff_fmt = PIX_FMT_YUV410P,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_YUV410,
-    },
-    {
-        .ff_fmt = PIX_FMT_RGB555,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_RGB555,
-    },
-    {
-        .ff_fmt = PIX_FMT_RGB565,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_RGB565,
-    },
-    {
-        .ff_fmt = PIX_FMT_BGR24,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_BGR24,
-    },
-    {
-        .ff_fmt = PIX_FMT_RGB24,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_RGB24,
-    },
-    {
-        .ff_fmt = PIX_FMT_BGRA,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_BGR32,
-    },
-    {
-        .ff_fmt = PIX_FMT_GRAY8,
-        .codec_id = CODEC_ID_RAWVIDEO,
-        .v4l2_fmt = V4L2_PIX_FMT_GREY,
-    },
-    {
-        .ff_fmt = PIX_FMT_NONE,
-        .codec_id = CODEC_ID_MJPEG,
-        .v4l2_fmt = V4L2_PIX_FMT_MJPEG,
-    },
-    {
-        .ff_fmt = PIX_FMT_NONE,
-        .codec_id = CODEC_ID_MJPEG,
-        .v4l2_fmt = V4L2_PIX_FMT_JPEG,
-    },
-};
-
-static int device_open(AVFormatContext *ctx, uint32_t *capabilities)
-{
-    struct v4l2_capability cap;
-    int fd;
-    int res, err;
-    int flags = O_RDWR;
-
-    if (ctx->flags & AVFMT_FLAG_NONBLOCK) {
-        flags |= O_NONBLOCK;
-    }
-    fd = open(ctx->filename, flags, 0);
-    if (fd < 0) {
-        av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n",
-                 ctx->filename, strerror(errno));
-
-        return AVERROR(errno);
-    }
-
-    res = ioctl(fd, VIDIOC_QUERYCAP, &cap);
-    // ENOIOCTLCMD definition only availble on __KERNEL__
-    if (res < 0 && ((err = errno) == 515)) {
-        av_log(ctx, AV_LOG_ERROR, "QUERYCAP not implemented, probably V4L device but not supporting V4L2\n");
-        close(fd);
-
-        return AVERROR(515);
-    }
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
-                 strerror(errno));
-        close(fd);
-
-        return AVERROR(err);
-    }
-    if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) {
-        av_log(ctx, AV_LOG_ERROR, "Not a video capture device\n");
-        close(fd);
-
-        return AVERROR(ENODEV);
-    }
-    *capabilities = cap.capabilities;
-
-    return fd;
-}
-
-static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pix_fmt)
-{
-    struct video_data *s = ctx->priv_data;
-    int fd = s->fd;
-    struct v4l2_format fmt;
-    int res;
-
-    memset(&fmt, 0, sizeof(struct v4l2_format));
-    fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    fmt.fmt.pix.width = *width;
-    fmt.fmt.pix.height = *height;
-    fmt.fmt.pix.pixelformat = pix_fmt;
-    fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
-    res = ioctl(fd, VIDIOC_S_FMT, &fmt);
-    if ((*width != fmt.fmt.pix.width) || (*height != fmt.fmt.pix.height)) {
-        av_log(ctx, AV_LOG_INFO, "The V4L2 driver changed the video from %dx%d to %dx%d\n", *width, *height, fmt.fmt.pix.width, fmt.fmt.pix.height);
-        *width = fmt.fmt.pix.width;
-        *height = fmt.fmt.pix.height;
-    }
-
-    if (pix_fmt != fmt.fmt.pix.pixelformat) {
-        av_log(ctx, AV_LOG_DEBUG, "The V4L2 driver changed the pixel format from 0x%08X to 0x%08X\n", pix_fmt, fmt.fmt.pix.pixelformat);
-        res = -1;
-    }
-
-    return res;
-}
-
-static int first_field(int fd)
-{
-    int res;
-    v4l2_std_id std;
-
-    res = ioctl(fd, VIDIOC_G_STD, &std);
-    if (res < 0) {
-        return 0;
-    }
-    if (std & V4L2_STD_NTSC) {
-        return 0;
-    }
-
-    return 1;
-}
-
-static uint32_t fmt_ff2v4l(enum PixelFormat pix_fmt, enum CodecID codec_id)
-{
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
-        if ((codec_id == CODEC_ID_NONE ||
-             fmt_conversion_table[i].codec_id == codec_id) &&
-            (pix_fmt == PIX_FMT_NONE ||
-             fmt_conversion_table[i].ff_fmt == pix_fmt)) {
-            return fmt_conversion_table[i].v4l2_fmt;
-        }
-    }
-
-    return 0;
-}
-
-static enum PixelFormat fmt_v4l2ff(uint32_t v4l2_fmt, enum CodecID codec_id)
-{
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
-        if (fmt_conversion_table[i].v4l2_fmt == v4l2_fmt &&
-            fmt_conversion_table[i].codec_id == codec_id) {
-            return fmt_conversion_table[i].ff_fmt;
-        }
-    }
-
-    return PIX_FMT_NONE;
-}
-
-static enum CodecID fmt_v4l2codec(uint32_t v4l2_fmt)
-{
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
-        if (fmt_conversion_table[i].v4l2_fmt == v4l2_fmt) {
-            return fmt_conversion_table[i].codec_id;
-        }
-    }
-
-    return CODEC_ID_NONE;
-}
-
-static int mmap_init(AVFormatContext *ctx)
-{
-    struct video_data *s = ctx->priv_data;
-    struct v4l2_requestbuffers req;
-    int i, res;
-
-    memset(&req, 0, sizeof(struct v4l2_requestbuffers));
-    req.count = desired_video_buffers;
-    req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    req.memory = V4L2_MEMORY_MMAP;
-    res = ioctl (s->fd, VIDIOC_REQBUFS, &req);
-    if (res < 0) {
-        if (errno == EINVAL) {
-            av_log(ctx, AV_LOG_ERROR, "Device does not support mmap\n");
-        } else {
-            av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_REQBUFS)\n");
-        }
-
-        return AVERROR(errno);
-    }
-
-    if (req.count < 2) {
-        av_log(ctx, AV_LOG_ERROR, "Insufficient buffer memory\n");
-
-        return AVERROR(ENOMEM);
-    }
-    s->buffers = req.count;
-    s->buf_start = av_malloc(sizeof(void *) * s->buffers);
-    if (s->buf_start == NULL) {
-        av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer pointers\n");
-
-        return AVERROR(ENOMEM);
-    }
-    s->buf_len = av_malloc(sizeof(unsigned int) * s->buffers);
-    if (s->buf_len == NULL) {
-        av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer sizes\n");
-        av_free(s->buf_start);
-
-        return AVERROR(ENOMEM);
-    }
-
-    for (i = 0; i < req.count; i++) {
-        struct v4l2_buffer buf;
-
-        memset(&buf, 0, sizeof(struct v4l2_buffer));
-        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-        buf.memory = V4L2_MEMORY_MMAP;
-        buf.index = i;
-        res = ioctl (s->fd, VIDIOC_QUERYBUF, &buf);
-        if (res < 0) {
-            av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYBUF)\n");
-
-            return AVERROR(errno);
-        }
-
-        s->buf_len[i] = buf.length;
-        if (s->frame_size > 0 && s->buf_len[i] < s->frame_size) {
-            av_log(ctx, AV_LOG_ERROR, "Buffer len [%d] = %d != %d\n", i, s->buf_len[i], s->frame_size);
-
-            return -1;
-        }
-        s->buf_start[i] = mmap (NULL, buf.length,
-                        PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, buf.m.offset);
-        if (s->buf_start[i] == MAP_FAILED) {
-            av_log(ctx, AV_LOG_ERROR, "mmap: %s\n", strerror(errno));
-
-            return AVERROR(errno);
-        }
-    }
-
-    return 0;
-}
-
-static int read_init(AVFormatContext *ctx)
-{
-    return -1;
-}
-
-static void mmap_release_buffer(AVPacket *pkt)
-{
-    struct v4l2_buffer buf;
-    int res, fd;
-    struct buff_data *buf_descriptor = pkt->priv;
-
-    if (pkt->data == NULL) {
-         return;
-    }
-
-    memset(&buf, 0, sizeof(struct v4l2_buffer));
-    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    buf.memory = V4L2_MEMORY_MMAP;
-    buf.index = buf_descriptor->index;
-    fd = buf_descriptor->fd;
-    av_free(buf_descriptor);
-
-    res = ioctl (fd, VIDIOC_QBUF, &buf);
-    if (res < 0) {
-        av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF)\n");
-    }
-    pkt->data = NULL;
-    pkt->size = 0;
-}
-
-static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
-{
-    struct video_data *s = ctx->priv_data;
-    struct v4l2_buffer buf;
-    struct buff_data *buf_descriptor;
-    int res;
-
-    memset(&buf, 0, sizeof(struct v4l2_buffer));
-    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    buf.memory = V4L2_MEMORY_MMAP;
-
-    /* FIXME: Some special treatment might be needed in case of loss of signal... */
-    while ((res = ioctl(s->fd, VIDIOC_DQBUF, &buf)) < 0 && (errno == EINTR));
-    if (res < 0) {
-        if (errno == EAGAIN) {
-            pkt->size = 0;
-
-            return AVERROR(EAGAIN);
-        }
-        av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_DQBUF): %s\n", strerror(errno));
-
-        return AVERROR(errno);
-    }
-    assert (buf.index < s->buffers);
-    if (s->frame_size > 0 && buf.bytesused != s->frame_size) {
-        av_log(ctx, AV_LOG_ERROR, "The v4l2 frame is %d bytes, but %d bytes are expected\n", buf.bytesused, s->frame_size);
-
-        return AVERROR_INVALIDDATA;
-    }
-
-    /* Image is at s->buff_start[buf.index] */
-    pkt->data= s->buf_start[buf.index];
-    pkt->size = buf.bytesused;
-    pkt->pts = buf.timestamp.tv_sec * INT64_C(1000000) + buf.timestamp.tv_usec;
-    pkt->destruct = mmap_release_buffer;
-    buf_descriptor = av_malloc(sizeof(struct buff_data));
-    if (buf_descriptor == NULL) {
-        /* Something went wrong... Since av_malloc() failed, we cannot even
-         * allocate a buffer for memcopying into it
-         */
-        av_log(ctx, AV_LOG_ERROR, "Failed to allocate a buffer descriptor\n");
-        res = ioctl (s->fd, VIDIOC_QBUF, &buf);
-
-        return AVERROR(ENOMEM);
-    }
-    buf_descriptor->fd = s->fd;
-    buf_descriptor->index = buf.index;
-    pkt->priv = buf_descriptor;
-
-    return s->buf_len[buf.index];
-}
-
-static int read_frame(AVFormatContext *ctx, AVPacket *pkt)
-{
-    return -1;
-}
-
-static int mmap_start(AVFormatContext *ctx)
-{
-    struct video_data *s = ctx->priv_data;
-    enum v4l2_buf_type type;
-    int i, res;
-
-    for (i = 0; i < s->buffers; i++) {
-        struct v4l2_buffer buf;
-
-        memset(&buf, 0, sizeof(struct v4l2_buffer));
-        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-        buf.memory = V4L2_MEMORY_MMAP;
-        buf.index  = i;
-
-        res = ioctl (s->fd, VIDIOC_QBUF, &buf);
-        if (res < 0) {
-            av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", strerror(errno));
-
-            return AVERROR(errno);
-        }
-    }
-
-    type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    res = ioctl (s->fd, VIDIOC_STREAMON, &type);
-    if (res < 0) {
-        av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_STREAMON): %s\n", strerror(errno));
-
-        return AVERROR(errno);
-    }
-
-    return 0;
-}
-
-static void mmap_close(struct video_data *s)
-{
-    enum v4l2_buf_type type;
-    int i;
-
-    type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-    /* We do not check for the result, because we could
-     * not do anything about it anyway...
-     */
-    ioctl(s->fd, VIDIOC_STREAMOFF, &type);
-    for (i = 0; i < s->buffers; i++) {
-        munmap(s->buf_start[i], s->buf_len[i]);
-    }
-    av_free(s->buf_start);
-    av_free(s->buf_len);
-}
-
-static int v4l2_set_parameters( AVFormatContext *s1, AVFormatParameters *ap )
-{
-    struct video_data *s = s1->priv_data;
-    struct v4l2_input input;
-    struct v4l2_standard standard;
-    int i;
-
-    if(ap->channel>=0) {
-        /* set tv video input */
-        memset (&input, 0, sizeof (input));
-        input.index = ap->channel;
-        if(ioctl (s->fd, VIDIOC_ENUMINPUT, &input) < 0) {
-            av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl enum input failed:\n");
-            return AVERROR(EIO);
-        }
-
-        av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n",
-               ap->channel, input.name);
-        if(ioctl (s->fd, VIDIOC_S_INPUT, &input.index) < 0 ) {
-            av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n",
-                   ap->channel);
-            return AVERROR(EIO);
-        }
-    }
-
-    if(ap->standard) {
-        av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n",
-               ap->standard );
-        /* set tv standard */
-        memset (&standard, 0, sizeof (standard));
-        for(i=0;;i++) {
-            standard.index = i;
-            if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
-                av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
-                       ap->standard);
-                return AVERROR(EIO);
-            }
-
-            if(!strcasecmp(standard.name, ap->standard)) {
-                break;
-            }
-        }
-
-        av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s, id: %"PRIu64"\n",
-               ap->standard, (uint64_t)standard.id);
-        if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
-            av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
-                   ap->standard);
-            return AVERROR(EIO);
-        }
-    }
-
-    return 0;
-}
-
-static uint32_t device_try_init(AVFormatContext *s1,
-                                const AVFormatParameters *ap,
-                                int *width,
-                                int *height,
-                                enum CodecID *codec_id)
-{
-    uint32_t desired_format = fmt_ff2v4l(ap->pix_fmt, s1->video_codec_id);
-
-    if (desired_format == 0 ||
-        device_init(s1, width, height, desired_format) < 0) {
-        int i;
-
-        desired_format = 0;
-        for (i = 0; i<FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
-            if (s1->video_codec_id == CODEC_ID_NONE ||
-                fmt_conversion_table[i].codec_id == s1->video_codec_id) {
-                desired_format = fmt_conversion_table[i].v4l2_fmt;
-                if (device_init(s1, width, height, desired_format) >= 0) {
-                    break;
-                }
-                desired_format = 0;
-            }
-        }
-    }
-    if (desired_format != 0) {
-        *codec_id = fmt_v4l2codec(desired_format);
-        assert(*codec_id != CODEC_ID_NONE);
-    }
-
-    return desired_format;
-}
-
-static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    struct video_data *s = s1->priv_data;
-    AVStream *st;
-    int res;
-    uint32_t desired_format, capabilities;
-    enum CodecID codec_id;
-
-    st = av_new_stream(s1, 0);
-    if (!st) {
-        return AVERROR(ENOMEM);
-    }
-    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
-
-    s->width  = ap->width;
-    s->height = ap->height;
-
-    capabilities = 0;
-    s->fd = device_open(s1, &capabilities);
-    if (s->fd < 0) {
-        return AVERROR(EIO);
-    }
-    av_log(s1, AV_LOG_VERBOSE, "[%d]Capabilities: %x\n", s->fd, capabilities);
-
-    if (!s->width && !s->height) {
-        struct v4l2_format fmt;
-
-        av_log(s1, AV_LOG_VERBOSE, "Querying the device for the current frame size\n");
-        fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-        if (ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) {
-            av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", strerror(errno));
-            return AVERROR(errno);
-        }
-        s->width  = fmt.fmt.pix.width;
-        s->height = fmt.fmt.pix.height;
-        av_log(s1, AV_LOG_VERBOSE, "Setting frame size to %dx%d\n", s->width, s->height);
-    }
-
-    desired_format = device_try_init(s1, ap, &s->width, &s->height, &codec_id);
-    if (desired_format == 0) {
-        av_log(s1, AV_LOG_ERROR, "Cannot find a proper format for "
-               "codec_id %d, pix_fmt %d.\n", s1->video_codec_id, ap->pix_fmt);
-        close(s->fd);
-
-        return AVERROR(EIO);
-    }
-    if (avcodec_check_dimensions(s1, s->width, s->height) < 0)
-        return AVERROR(EINVAL);
-    s->frame_format = desired_format;
-
-    if( v4l2_set_parameters( s1, ap ) < 0 )
-        return AVERROR(EIO);
-
-    st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id);
-    s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
-    if (capabilities & V4L2_CAP_STREAMING) {
-        s->io_method = io_mmap;
-        res = mmap_init(s1);
-        if (res == 0) {
-            res = mmap_start(s1);
-        }
-    } else {
-        s->io_method = io_read;
-        res = read_init(s1);
-    }
-    if (res < 0) {
-        close(s->fd);
-
-        return AVERROR(EIO);
-    }
-    s->top_field_first = first_field(s->fd);
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = codec_id;
-    st->codec->width = s->width;
-    st->codec->height = s->height;
-    st->codec->time_base.den = ap->time_base.den;
-    st->codec->time_base.num = ap->time_base.num;
-    st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
-
-    return 0;
-}
-
-static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    struct video_data *s = s1->priv_data;
-    int res;
-
-    if (s->io_method == io_mmap) {
-        av_init_packet(pkt);
-        res = mmap_read_frame(s1, pkt);
-    } else if (s->io_method == io_read) {
-        if (av_new_packet(pkt, s->frame_size) < 0)
-            return AVERROR(EIO);
-
-        res = read_frame(s1, pkt);
-    } else {
-        return AVERROR(EIO);
-    }
-    if (res < 0) {
-        return res;
-    }
-
-    if (s1->streams[0]->codec->coded_frame) {
-        s1->streams[0]->codec->coded_frame->interlaced_frame = 1;
-        s1->streams[0]->codec->coded_frame->top_field_first = s->top_field_first;
-    }
-
-    return pkt->size;
-}
-
-static int v4l2_read_close(AVFormatContext *s1)
-{
-    struct video_data *s = s1->priv_data;
-
-    if (s->io_method == io_mmap) {
-        mmap_close(s);
-    }
-
-    close(s->fd);
-    return 0;
-}
-
-AVInputFormat v4l2_demuxer = {
-    "video4linux2",
-    NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
-    sizeof(struct video_data),
-    NULL,
-    v4l2_read_header,
-    v4l2_read_packet,
-    v4l2_read_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
deleted file mode 100644
index 13aaad9..0000000
--- a/libavdevice/vfwcap.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * VFW capture interface
- * Copyright (c) 2006-2008 Ramiro Polla
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavformat/avformat.h"
-#include <windows.h>
-#include <vfw.h>
-
-//#define DEBUG_VFW
-
-/* Defines for VFW missing from MinGW.
- * Remove this when MinGW incorporates them. */
-#define HWND_MESSAGE                ((HWND)-3)
-
-#define BI_RGB                      0
-
-/* End of missing MinGW defines */
-
-struct vfw_ctx {
-    HWND hwnd;
-    HANDLE mutex;
-    HANDLE event;
-    AVPacketList *pktl;
-    unsigned int curbufsize;
-    unsigned int frame_num;
-};
-
-static enum PixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount)
-{
-    switch(biCompression) {
-    case MKTAG('U', 'Y', 'V', 'Y'):
-        return PIX_FMT_UYVY422;
-    case MKTAG('Y', 'U', 'Y', '2'):
-        return PIX_FMT_YUYV422;
-    case MKTAG('I', '4', '2', '0'):
-        return PIX_FMT_YUV420P;
-    case BI_RGB:
-        switch(biBitCount) { /* 1-8 are untested */
-            case 1:
-                return PIX_FMT_MONOWHITE;
-            case 4:
-                return PIX_FMT_RGB4;
-            case 8:
-                return PIX_FMT_RGB8;
-            case 16:
-                return PIX_FMT_RGB555;
-            case 24:
-                return PIX_FMT_BGR24;
-            case 32:
-                return PIX_FMT_RGB32;
-        }
-    }
-    return PIX_FMT_NONE;
-}
-
-static enum CodecID vfw_codecid(DWORD biCompression)
-{
-    switch(biCompression) {
-    case MKTAG('d', 'v', 's', 'd'):
-        return CODEC_ID_DVVIDEO;
-    case MKTAG('M', 'J', 'P', 'G'):
-    case MKTAG('m', 'j', 'p', 'g'):
-        return CODEC_ID_MJPEG;
-    }
-    return CODEC_ID_NONE;
-}
-
-#define dstruct(pctx, sname, var, type) \
-    av_log(pctx, AV_LOG_DEBUG, #var":\t%"type"\n", sname->var)
-
-static void dump_captureparms(AVFormatContext *s, CAPTUREPARMS *cparms)
-{
-    av_log(s, AV_LOG_DEBUG, "CAPTUREPARMS\n");
-    dstruct(s, cparms, dwRequestMicroSecPerFrame, "lu");
-    dstruct(s, cparms, fMakeUserHitOKToCapture, "d");
-    dstruct(s, cparms, wPercentDropForError, "u");
-    dstruct(s, cparms, fYield, "d");
-    dstruct(s, cparms, dwIndexSize, "lu");
-    dstruct(s, cparms, wChunkGranularity, "u");
-    dstruct(s, cparms, fUsingDOSMemory, "d");
-    dstruct(s, cparms, wNumVideoRequested, "u");
-    dstruct(s, cparms, fCaptureAudio, "d");
-    dstruct(s, cparms, wNumAudioRequested, "u");
-    dstruct(s, cparms, vKeyAbort, "u");
-    dstruct(s, cparms, fAbortLeftMouse, "d");
-    dstruct(s, cparms, fAbortRightMouse, "d");
-    dstruct(s, cparms, fLimitEnabled, "d");
-    dstruct(s, cparms, wTimeLimit, "u");
-    dstruct(s, cparms, fMCIControl, "d");
-    dstruct(s, cparms, fStepMCIDevice, "d");
-    dstruct(s, cparms, dwMCIStartTime, "lu");
-    dstruct(s, cparms, dwMCIStopTime, "lu");
-    dstruct(s, cparms, fStepCaptureAt2x, "d");
-    dstruct(s, cparms, wStepCaptureAverageFrames, "u");
-    dstruct(s, cparms, dwAudioBufferSize, "lu");
-    dstruct(s, cparms, fDisableWriteCache, "d");
-    dstruct(s, cparms, AVStreamMaster, "u");
-}
-
-static void dump_videohdr(AVFormatContext *s, VIDEOHDR *vhdr)
-{
-#ifdef DEBUG_VFW
-    av_log(s, AV_LOG_DEBUG, "VIDEOHDR\n");
-    dstruct(s, vhdr, lpData, "p");
-    dstruct(s, vhdr, dwBufferLength, "lu");
-    dstruct(s, vhdr, dwBytesUsed, "lu");
-    dstruct(s, vhdr, dwTimeCaptured, "lu");
-    dstruct(s, vhdr, dwUser, "lu");
-    dstruct(s, vhdr, dwFlags, "lu");
-    dstruct(s, vhdr, dwReserved[0], "lu");
-    dstruct(s, vhdr, dwReserved[1], "lu");
-    dstruct(s, vhdr, dwReserved[2], "lu");
-    dstruct(s, vhdr, dwReserved[3], "lu");
-#endif
-}
-
-static void dump_bih(AVFormatContext *s, BITMAPINFOHEADER *bih)
-{
-    av_log(s, AV_LOG_DEBUG, "BITMAPINFOHEADER\n");
-    dstruct(s, bih, biSize, "lu");
-    dstruct(s, bih, biWidth, "ld");
-    dstruct(s, bih, biHeight, "ld");
-    dstruct(s, bih, biPlanes, "d");
-    dstruct(s, bih, biBitCount, "d");
-    dstruct(s, bih, biCompression, "lu");
-    av_log(s, AV_LOG_DEBUG, "    biCompression:\t\"%.4s\"\n",
-                   (char*) &bih->biCompression);
-    dstruct(s, bih, biSizeImage, "lu");
-    dstruct(s, bih, biXPelsPerMeter, "lu");
-    dstruct(s, bih, biYPelsPerMeter, "lu");
-    dstruct(s, bih, biClrUsed, "lu");
-    dstruct(s, bih, biClrImportant, "lu");
-}
-
-static int shall_we_drop(AVFormatContext *s)
-{
-    struct vfw_ctx *ctx = s->priv_data;
-    const uint8_t dropscore[] = {62, 75, 87, 100};
-    const int ndropscores = FF_ARRAY_ELEMS(dropscore);
-    unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer;
-
-    if(dropscore[++ctx->frame_num%ndropscores] <= buffer_fullness) {
-        av_log(s, AV_LOG_ERROR,
-              "real-time buffer %d%% full! frame dropped!\n", buffer_fullness);
-        return 1;
-    }
-
-    return 0;
-}
-
-static LRESULT CALLBACK videostream_cb(HWND hwnd, LPVIDEOHDR vdhdr)
-{
-    AVFormatContext *s;
-    struct vfw_ctx *ctx;
-    AVPacketList **ppktl, *pktl_next;
-
-    s = (AVFormatContext *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
-    ctx = s->priv_data;
-
-    dump_videohdr(s, vdhdr);
-
-    if(shall_we_drop(s))
-        return FALSE;
-
-    WaitForSingleObject(ctx->mutex, INFINITE);
-
-    pktl_next = av_mallocz(sizeof(AVPacketList));
-    if(!pktl_next)
-        goto fail;
-
-    if(av_new_packet(&pktl_next->pkt, vdhdr->dwBytesUsed) < 0) {
-        av_free(pktl_next);
-        goto fail;
-    }
-
-    pktl_next->pkt.pts = vdhdr->dwTimeCaptured;
-    memcpy(pktl_next->pkt.data, vdhdr->lpData, vdhdr->dwBytesUsed);
-
-    for(ppktl = &ctx->pktl ; *ppktl ; ppktl = &(*ppktl)->next);
-    *ppktl = pktl_next;
-
-    ctx->curbufsize += vdhdr->dwBytesUsed;
-
-    SetEvent(ctx->event);
-    ReleaseMutex(ctx->mutex);
-
-    return TRUE;
-fail:
-    ReleaseMutex(ctx->mutex);
-    return FALSE;
-}
-
-static int vfw_read_close(AVFormatContext *s)
-{
-    struct vfw_ctx *ctx = s->priv_data;
-    AVPacketList *pktl;
-
-    if(ctx->hwnd) {
-        SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
-        SendMessage(ctx->hwnd, WM_CAP_DRIVER_DISCONNECT, 0, 0);
-        DestroyWindow(ctx->hwnd);
-    }
-    if(ctx->mutex)
-        CloseHandle(ctx->mutex);
-    if(ctx->event)
-        CloseHandle(ctx->event);
-
-    pktl = ctx->pktl;
-    while (pktl) {
-        AVPacketList *next = pktl->next;
-        av_destruct_packet(&pktl->pkt);
-        av_free(pktl);
-        pktl = next;
-    }
-
-    return 0;
-}
-
-static int vfw_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    struct vfw_ctx *ctx = s->priv_data;
-    AVCodecContext *codec;
-    AVStream *st;
-    int devnum;
-    int bisize;
-    BITMAPINFO *bi;
-    CAPTUREPARMS cparms;
-    DWORD biCompression;
-    WORD biBitCount;
-    int width;
-    int height;
-    int ret;
-
-    if(!ap->time_base.den) {
-        av_log(s, AV_LOG_ERROR, "A time base must be specified.\n");
-        return AVERROR(EIO);
-    }
-
-    ctx->hwnd = capCreateCaptureWindow(NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, 0);
-    if(!ctx->hwnd) {
-        av_log(s, AV_LOG_ERROR, "Could not create capture window.\n");
-        return AVERROR(EIO);
-    }
-
-    /* If atoi fails, devnum==0 and the default device is used */
-    devnum = atoi(s->filename);
-
-    ret = SendMessage(ctx->hwnd, WM_CAP_DRIVER_CONNECT, devnum, 0);
-    if(!ret) {
-        av_log(s, AV_LOG_ERROR, "Could not connect to device.\n");
-        DestroyWindow(ctx->hwnd);
-        return AVERROR(ENODEV);
-    }
-
-    SendMessage(ctx->hwnd, WM_CAP_SET_OVERLAY, 0, 0);
-    SendMessage(ctx->hwnd, WM_CAP_SET_PREVIEW, 0, 0);
-
-    ret = SendMessage(ctx->hwnd, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0,
-                      (LPARAM) videostream_cb);
-    if(!ret) {
-        av_log(s, AV_LOG_ERROR, "Could not set video stream callback.\n");
-        goto fail_io;
-    }
-
-    SetWindowLongPtr(ctx->hwnd, GWLP_USERDATA, (LONG_PTR) s);
-
-    st = av_new_stream(s, 0);
-    if(!st) {
-        vfw_read_close(s);
-        return AVERROR(ENOMEM);
-    }
-
-    /* Set video format */
-    bisize = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, 0, 0);
-    if(!bisize)
-        goto fail_io;
-    bi = av_malloc(bisize);
-    if(!bi) {
-        vfw_read_close(s);
-        return AVERROR(ENOMEM);
-    }
-    ret = SendMessage(ctx->hwnd, WM_CAP_GET_VIDEOFORMAT, bisize, (LPARAM) bi);
-    if(!ret)
-        goto fail_bi;
-
-    dump_bih(s, &bi->bmiHeader);
-
-    width  = ap->width  ? ap->width  : bi->bmiHeader.biWidth ;
-    height = ap->height ? ap->height : bi->bmiHeader.biHeight;
-    bi->bmiHeader.biWidth  = width ;
-    bi->bmiHeader.biHeight = height;
-
-    if (0) {
-        /* For testing yet unsupported compressions
-         * Copy these values from user-supplied verbose information */
-        bi->bmiHeader.biWidth       = 320;
-        bi->bmiHeader.biHeight      = 240;
-        bi->bmiHeader.biPlanes      = 1;
-        bi->bmiHeader.biBitCount    = 12;
-        bi->bmiHeader.biCompression = MKTAG('I','4','2','0');
-        bi->bmiHeader.biSizeImage   = 115200;
-        dump_bih(s, &bi->bmiHeader);
-    }
-
-    ret = SendMessage(ctx->hwnd, WM_CAP_SET_VIDEOFORMAT, bisize, (LPARAM) bi);
-    if(!ret) {
-        av_log(s, AV_LOG_ERROR, "Could not set Video Format.\n");
-        goto fail_bi;
-    }
-
-    biCompression = bi->bmiHeader.biCompression;
-    biBitCount = bi->bmiHeader.biBitCount;
-
-    av_free(bi);
-
-    /* Set sequence setup */
-    ret = SendMessage(ctx->hwnd, WM_CAP_GET_SEQUENCE_SETUP, sizeof(cparms),
-                      (LPARAM) &cparms);
-    if(!ret)
-        goto fail_io;
-
-    dump_captureparms(s, &cparms);
-
-    cparms.fYield = 1; // Spawn a background thread
-    cparms.dwRequestMicroSecPerFrame =
-                               (ap->time_base.num*1000000) / ap->time_base.den;
-    cparms.fAbortLeftMouse = 0;
-    cparms.fAbortRightMouse = 0;
-    cparms.fCaptureAudio = 0;
-    cparms.vKeyAbort = 0;
-
-    ret = SendMessage(ctx->hwnd, WM_CAP_SET_SEQUENCE_SETUP, sizeof(cparms),
-                      (LPARAM) &cparms);
-    if(!ret)
-        goto fail_io;
-
-    codec = st->codec;
-    codec->time_base = ap->time_base;
-    codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    codec->width = width;
-    codec->height = height;
-    codec->pix_fmt = vfw_pixfmt(biCompression, biBitCount);
-    if(codec->pix_fmt == PIX_FMT_NONE) {
-        codec->codec_id = vfw_codecid(biCompression);
-        if(codec->codec_id == CODEC_ID_NONE) {
-            av_log(s, AV_LOG_ERROR, "Unknown compression type. "
-                             "Please report verbose (-v 9) debug information.\n");
-            vfw_read_close(s);
-            return AVERROR_PATCHWELCOME;
-        }
-        codec->bits_per_coded_sample = biBitCount;
-    } else {
-        codec->codec_id = CODEC_ID_RAWVIDEO;
-        if(biCompression == BI_RGB) {
-            codec->bits_per_coded_sample = biBitCount;
-            codec->extradata = av_malloc(9 + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (codec->extradata) {
-                codec->extradata_size = 9;
-                memcpy(codec->extradata, "BottomUp", 9);
-            }
-        }
-    }
-
-    av_set_pts_info(st, 32, 1, 1000);
-
-    ctx->mutex = CreateMutex(NULL, 0, NULL);
-    if(!ctx->mutex) {
-        av_log(s, AV_LOG_ERROR, "Could not create Mutex.\n" );
-        goto fail_io;
-    }
-    ctx->event = CreateEvent(NULL, 1, 0, NULL);
-    if(!ctx->event) {
-        av_log(s, AV_LOG_ERROR, "Could not create Event.\n" );
-        goto fail_io;
-    }
-
-    ret = SendMessage(ctx->hwnd, WM_CAP_SEQUENCE_NOFILE, 0, 0);
-    if(!ret) {
-        av_log(s, AV_LOG_ERROR, "Could not start capture sequence.\n" );
-        goto fail_io;
-    }
-
-    return 0;
-
-fail_bi:
-    av_free(bi);
-
-fail_io:
-    vfw_read_close(s);
-    return AVERROR(EIO);
-}
-
-static int vfw_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    struct vfw_ctx *ctx = s->priv_data;
-    AVPacketList *pktl = NULL;
-
-    while(!pktl) {
-        WaitForSingleObject(ctx->mutex, INFINITE);
-        pktl = ctx->pktl;
-        if(ctx->pktl) {
-            *pkt = ctx->pktl->pkt;
-            ctx->pktl = ctx->pktl->next;
-            av_free(pktl);
-        }
-        ResetEvent(ctx->event);
-        ReleaseMutex(ctx->mutex);
-        if(!pktl) {
-            if(s->flags & AVFMT_FLAG_NONBLOCK) {
-                return AVERROR(EAGAIN);
-            } else {
-                WaitForSingleObject(ctx->event, INFINITE);
-            }
-        }
-    }
-
-    ctx->curbufsize -= pkt->size;
-
-    return pkt->size;
-}
-
-AVInputFormat vfwcap_demuxer = {
-    "vfwcap",
-    NULL_IF_CONFIG_SMALL("VFW video capture"),
-    sizeof(struct vfw_ctx),
-    NULL,
-    vfw_read_header,
-    vfw_read_packet,
-    vfw_read_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
deleted file mode 100644
index ab0a94c..0000000
--- a/libavdevice/x11grab.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * X11 video grab interface
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg integration:
- * Copyright (C) 2006 Clemens Fruhwirth <clemens at endorphin.org>
- *                    Edouard Gomez <ed.gomez at free.fr>
- *
- * This file contains code from grab.c:
- * Copyright (c) 2000-2001 Fabrice Bellard
- *
- * This file contains code from the xvidcap project:
- * Copyright (C) 1997-1998 Rasca, Berlin
- *               2003-2004 Karl H. Beckers, Frankfurt
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * X11 frame device demuxer by Clemens Fruhwirth <clemens at endorphin.org>
- * and Edouard Gomez <ed.gomez at free.fr>.
- */
-
-#define _XOPEN_SOURCE 600
-
-#include "config.h"
-#include "libavformat/avformat.h"
-#include <time.h>
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xlibint.h>
-#include <X11/Xproto.h>
-#include <X11/Xutil.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-#include <X11/extensions/Xfixes.h>
-
-/**
- * X11 Device Demuxer context
- */
-struct x11_grab
-{
-    int frame_size;          /**< Size in bytes of a grabbed frame */
-    AVRational time_base;    /**< Time base */
-    int64_t time_frame;      /**< Current time */
-
-    int height;              /**< Height of the grab frame */
-    int width;               /**< Width of the grab frame */
-    int x_off;               /**< Horizontal top-left corner coordinate */
-    int y_off;               /**< Vertical top-left corner coordinate */
-
-    Display *dpy;            /**< X11 display from which x11grab grabs frames */
-    XImage *image;           /**< X11 image holding the grab */
-    int use_shm;             /**< !0 when using XShm extension */
-    XShmSegmentInfo shminfo; /**< When using XShm, keeps track of XShm infos */
-    int nomouse;
-};
-
-/**
- * Initializes the x11 grab device demuxer (public device demuxer API).
- *
- * @param s1 Context from avformat core
- * @param ap Parameters from avformat core
- * @return <ul>
- *          <li>AVERROR(ENOMEM) no memory left</li>
- *          <li>AVERROR(EIO) other failure case</li>
- *          <li>0 success</li>
- *         </ul>
- */
-static int
-x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    struct x11_grab *x11grab = s1->priv_data;
-    Display *dpy;
-    AVStream *st = NULL;
-    enum PixelFormat input_pixfmt;
-    XImage *image;
-    int x_off = 0;
-    int y_off = 0;
-    int use_shm;
-    char *param, *offset;
-
-    param = av_strdup(s1->filename);
-    offset = strchr(param, '+');
-    if (offset) {
-        sscanf(offset, "%d,%d", &x_off, &y_off);
-        x11grab->nomouse= strstr(offset, "nomouse");
-        *offset= 0;
-    }
-
-    av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d height: %d\n", s1->filename, param, x_off, y_off, ap->width, ap->height);
-
-    dpy = XOpenDisplay(param);
-    if(!dpy) {
-        av_log(s1, AV_LOG_ERROR, "Could not open X display.\n");
-        return AVERROR(EIO);
-    }
-
-    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
-        av_log(s1, AV_LOG_ERROR, "AVParameters don't have video size and/or rate. Use -s and -r.\n");
-        return AVERROR(EIO);
-    }
-
-    st = av_new_stream(s1, 0);
-    if (!st) {
-        return AVERROR(ENOMEM);
-    }
-    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
-
-    use_shm = XShmQueryExtension(dpy);
-    av_log(s1, AV_LOG_INFO, "shared memory extension %s found\n", use_shm ? "" : "not");
-
-    if(use_shm) {
-        int scr = XDefaultScreen(dpy);
-        image = XShmCreateImage(dpy,
-                                DefaultVisual(dpy, scr),
-                                DefaultDepth(dpy, scr),
-                                ZPixmap,
-                                NULL,
-                                &x11grab->shminfo,
-                                ap->width, ap->height);
-        x11grab->shminfo.shmid = shmget(IPC_PRIVATE,
-                                        image->bytes_per_line * image->height,
-                                        IPC_CREAT|0777);
-        if (x11grab->shminfo.shmid == -1) {
-            av_log(s1, AV_LOG_ERROR, "Fatal: Can't get shared memory!\n");
-            return AVERROR(ENOMEM);
-        }
-        x11grab->shminfo.shmaddr = image->data = shmat(x11grab->shminfo.shmid, 0, 0);
-        x11grab->shminfo.readOnly = False;
-
-        if (!XShmAttach(dpy, &x11grab->shminfo)) {
-            av_log(s1, AV_LOG_ERROR, "Fatal: Failed to attach shared memory!\n");
-            /* needs some better error subroutine :) */
-            return AVERROR(EIO);
-        }
-    } else {
-        image = XGetImage(dpy, RootWindow(dpy, DefaultScreen(dpy)),
-                          x_off,y_off,
-                          ap->width,ap->height,
-                          AllPlanes, ZPixmap);
-    }
-
-    switch (image->bits_per_pixel) {
-    case 8:
-        av_log (s1, AV_LOG_DEBUG, "8 bit palette\n");
-        input_pixfmt = PIX_FMT_PAL8;
-        break;
-    case 16:
-        if (       image->red_mask   == 0xf800 &&
-                   image->green_mask == 0x07e0 &&
-                   image->blue_mask  == 0x001f ) {
-            av_log (s1, AV_LOG_DEBUG, "16 bit RGB565\n");
-            input_pixfmt = PIX_FMT_RGB565;
-        } else if (image->red_mask   == 0x7c00 &&
-                   image->green_mask == 0x03e0 &&
-                   image->blue_mask  == 0x001f ) {
-            av_log(s1, AV_LOG_DEBUG, "16 bit RGB555\n");
-            input_pixfmt = PIX_FMT_RGB555;
-        } else {
-            av_log(s1, AV_LOG_ERROR, "RGB ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
-            av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
-            return AVERROR(EIO);
-        }
-        break;
-    case 24:
-        if (        image->red_mask   == 0xff0000 &&
-                    image->green_mask == 0x00ff00 &&
-                    image->blue_mask  == 0x0000ff ) {
-            input_pixfmt = PIX_FMT_BGR24;
-        } else if ( image->red_mask   == 0x0000ff &&
-                    image->green_mask == 0x00ff00 &&
-                    image->blue_mask  == 0xff0000 ) {
-            input_pixfmt = PIX_FMT_RGB24;
-        } else {
-            av_log(s1, AV_LOG_ERROR,"rgb ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel);
-            av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask);
-            return AVERROR(EIO);
-        }
-        break;
-    case 32:
-#if 0
-        GetColorInfo (image, &c_info);
-        if ( c_info.alpha_mask == 0xff000000 && image->green_mask == 0x0000ff00) {
-            /* byte order is relevant here, not endianness
-             * endianness is handled by avcodec, but atm no such thing
-             * as having ABGR, instead of ARGB in a word. Since we
-             * need this for Solaris/SPARC, but need to do the conversion
-             * for every frame we do it outside of this loop, cf. below
-             * this matches both ARGB32 and ABGR32 */
-            input_pixfmt = PIX_FMT_ARGB32;
-        }  else {
-            av_log(s1, AV_LOG_ERROR,"image depth %i not supported ... aborting\n", image->bits_per_pixel);
-            return AVERROR(EIO);
-        }
-#endif
-        input_pixfmt = PIX_FMT_RGB32;
-        break;
-    default:
-        av_log(s1, AV_LOG_ERROR, "image depth %i not supported ... aborting\n", image->bits_per_pixel);
-        return -1;
-    }
-
-    x11grab->frame_size = ap->width * ap->height * image->bits_per_pixel/8;
-    x11grab->dpy = dpy;
-    x11grab->width = ap->width;
-    x11grab->height = ap->height;
-    x11grab->time_base  = ap->time_base;
-    x11grab->time_frame = av_gettime() / av_q2d(ap->time_base);
-    x11grab->x_off = x_off;
-    x11grab->y_off = y_off;
-    x11grab->image = image;
-    x11grab->use_shm = use_shm;
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_RAWVIDEO;
-    st->codec->width = ap->width;
-    st->codec->height = ap->height;
-    st->codec->pix_fmt = input_pixfmt;
-    st->codec->time_base = ap->time_base;
-    st->codec->bit_rate = x11grab->frame_size * 1/av_q2d(ap->time_base) * 8;
-
-    return 0;
-}
-
-/**
- * Paints a mouse pointer in an X11 image.
- *
- * @param image image to paint the mouse pointer to
- * @param s context used to retrieve original grabbing rectangle
- *          coordinates
- * @param x Mouse pointer coordinate
- * @param y Mouse pointer coordinate
- */
-static void
-paint_mouse_pointer(XImage *image, struct x11_grab *s)
-{
-    int x_off = s->x_off;
-    int y_off = s->y_off;
-    int width = s->width;
-    int height = s->height;
-    Display *dpy = s->dpy;
-    XFixesCursorImage *xcim;
-    int x, y;
-    int line, column;
-    int to_line, to_column;
-    int image_addr, xcim_addr;
-
-    xcim = XFixesGetCursorImage(dpy);;
-
-    x = xcim->x - xcim->xhot;
-    y = xcim->y - xcim->yhot;
-
-    to_line = FFMIN((y + xcim->height), (height + y_off));
-    to_column = FFMIN((x + xcim->width), (width + x_off));
-
-    for (line = FFMAX(y, y_off); line < to_line; line++) {
-        for (column = FFMAX(x, x_off); column < to_column; column++) {
-            xcim_addr = (line - y) * xcim->width + column - x;
-
-            if ((unsigned char)(xcim->pixels[xcim_addr] >> 24) != 0) { // skip fully transparent pixel
-                image_addr = ((line - y_off) * width + column - x_off) * 4;
-
-                image->data[image_addr] = (unsigned char)(xcim->pixels[xcim_addr] >> 0);
-                image->data[image_addr+1] = (unsigned char)(xcim->pixels[xcim_addr] >> 8);
-                image->data[image_addr+2] = (unsigned char)(xcim->pixels[xcim_addr] >> 16);
-            }
-        }
-    }
-
-    XFree(xcim);
-    xcim = NULL;
-}
-
-
-/**
- * Reads new data in the image structure.
- *
- * @param dpy X11 display to grab from
- * @param d
- * @param image Image where the grab will be put
- * @param x Top-Left grabbing rectangle horizontal coordinate
- * @param y Top-Left grabbing rectangle vertical coordinate
- * @return 0 if error, !0 if successful
- */
-static int
-xget_zpixmap(Display *dpy, Drawable d, XImage *image, int x, int y)
-{
-    xGetImageReply rep;
-    xGetImageReq *req;
-    long nbytes;
-
-    if (!image) {
-        return 0;
-    }
-
-    LockDisplay(dpy);
-    GetReq(GetImage, req);
-
-    /* First set up the standard stuff in the request */
-    req->drawable = d;
-    req->x = x;
-    req->y = y;
-    req->width = image->width;
-    req->height = image->height;
-    req->planeMask = (unsigned int)AllPlanes;
-    req->format = ZPixmap;
-
-    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.length) {
-        UnlockDisplay(dpy);
-        SyncHandle();
-        return 0;
-    }
-
-    nbytes = (long)rep.length << 2;
-    _XReadPad(dpy, image->data, nbytes);
-
-    UnlockDisplay(dpy);
-    SyncHandle();
-    return 1;
-}
-
-/**
- * Grabs a frame from x11 (public device demuxer API).
- *
- * @param s1 Context from avformat core
- * @param pkt Packet holding the brabbed frame
- * @return frame size in bytes
- */
-static int
-x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    struct x11_grab *s = s1->priv_data;
-    Display *dpy = s->dpy;
-    XImage *image = s->image;
-    int x_off = s->x_off;
-    int y_off = s->y_off;
-
-    int64_t curtime, delay;
-    struct timespec ts;
-
-    /* Calculate the time of the next frame */
-    s->time_frame += INT64_C(1000000);
-
-    /* wait based on the frame rate */
-    for(;;) {
-        curtime = av_gettime();
-        delay = s->time_frame * av_q2d(s->time_base) - curtime;
-        if (delay <= 0) {
-            if (delay < INT64_C(-1000000) * av_q2d(s->time_base)) {
-                s->time_frame += INT64_C(1000000);
-            }
-            break;
-        }
-        ts.tv_sec = delay / 1000000;
-        ts.tv_nsec = (delay % 1000000) * 1000;
-        nanosleep(&ts, NULL);
-    }
-
-    if (av_new_packet(pkt, s->frame_size) < 0) {
-        return AVERROR(EIO);
-    }
-
-    pkt->pts = curtime;
-
-    if(s->use_shm) {
-        if (!XShmGetImage(dpy, RootWindow(dpy, DefaultScreen(dpy)), image, x_off, y_off, AllPlanes)) {
-            av_log (s1, AV_LOG_INFO, "XShmGetImage() failed\n");
-        }
-    } else {
-        if (!xget_zpixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)), image, x_off, y_off)) {
-            av_log (s1, AV_LOG_INFO, "XGetZPixmap() failed\n");
-        }
-    }
-
-    if(!s->nomouse){
-        paint_mouse_pointer(image, s);
-    }
-
-
-    /* XXX: avoid memcpy */
-    memcpy(pkt->data, image->data, s->frame_size);
-    return s->frame_size;
-}
-
-/**
- * Closes x11 frame grabber (public device demuxer API).
- *
- * @param s1 Context from avformat core
- * @return 0 success, !0 failure
- */
-static int
-x11grab_read_close(AVFormatContext *s1)
-{
-    struct x11_grab *x11grab = s1->priv_data;
-
-    /* Detach cleanly from shared mem */
-    if (x11grab->use_shm) {
-        XShmDetach(x11grab->dpy, &x11grab->shminfo);
-        shmdt(x11grab->shminfo.shmaddr);
-        shmctl(x11grab->shminfo.shmid, IPC_RMID, NULL);
-    }
-
-    /* Destroy X11 image */
-    if (x11grab->image) {
-        XDestroyImage(x11grab->image);
-        x11grab->image = NULL;
-    }
-
-    /* Free X11 display */
-    XCloseDisplay(x11grab->dpy);
-    return 0;
-}
-
-/** x11 grabber device demuxer declaration */
-AVInputFormat x11_grab_device_demuxer =
-{
-    "x11grab",
-    NULL_IF_CONFIG_SMALL("X11grab"),
-    sizeof(struct x11_grab),
-    NULL,
-    x11grab_read_header,
-    x11grab_read_packet,
-    x11grab_read_close,
-    .flags = AVFMT_NOFILE,
-};
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
deleted file mode 100644
index 84f7a9c..0000000
--- a/libavfilter/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = avfilter
-FFLIBS = avcodec avutil swscale
-FFLIBS-$(CONFIG_AVFILTER_LAVF) += avformat
-
-HEADERS = avfilter.h
-
-OBJS = allfilters.o                                                     \
-       avfilter.o                                                       \
-       avfiltergraph.o                                                  \
-       defaults.o                                                       \
-       formats.o                                                        \
-       graphparser.o                                                    \
-       parseutils.o                                                     \
-
-OBJS-$(CONFIG_ASPECT_FILTER)                 += vf_aspect.o
-OBJS-$(CONFIG_CROP_FILTER)                   += vf_crop.o
-OBJS-$(CONFIG_FORMAT_FILTER)                 += vf_format.o
-OBJS-$(CONFIG_NOFORMAT_FILTER)               += vf_format.o
-OBJS-$(CONFIG_NULL_FILTER)                   += vf_null.o
-OBJS-$(CONFIG_PIXELASPECT_FILTER)            += vf_aspect.o
-OBJS-$(CONFIG_SCALE_FILTER)                  += vf_scale.o
-OBJS-$(CONFIG_SLICIFY_FILTER)                += vf_slicify.o
-OBJS-$(CONFIG_UNSHARP_FILTER)                += vf_unsharp.o
-OBJS-$(CONFIG_VFLIP_FILTER)                  += vf_vflip.o
-
-OBJS-$(CONFIG_NULLSRC_FILTER)                += vsrc_nullsrc.o
-
-OBJS-$(CONFIG_NULLSINK_FILTER)               += vsink_nullsink.o
-
-include $(SUBDIR)../subdir.mak
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
deleted file mode 100644
index 75d42cc..0000000
--- a/libavfilter/allfilters.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * filter registration
- * copyright (c) 2008 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avfilter.h"
-
-
-#define REGISTER_FILTER(X,x,y) { \
-          extern AVFilter avfilter_##y##_##x ; \
-          if(CONFIG_##X##_FILTER )  avfilter_register(&avfilter_##y##_##x ); }
-
-void avfilter_register_all(void)
-{
-    static int initialized;
-
-    if (initialized)
-        return;
-    initialized = 1;
-
-    REGISTER_FILTER (ASPECT,      aspect,      vf);
-    REGISTER_FILTER (CROP,        crop,        vf);
-    REGISTER_FILTER (FORMAT,      format,      vf);
-    REGISTER_FILTER (NOFORMAT,    noformat,    vf);
-    REGISTER_FILTER (NULL,        null,        vf);
-    REGISTER_FILTER (PIXELASPECT, pixelaspect, vf);
-    REGISTER_FILTER (SCALE,       scale,       vf);
-    REGISTER_FILTER (SLICIFY,     slicify,     vf);
-    REGISTER_FILTER (UNSHARP,     unsharp,     vf);
-    REGISTER_FILTER (VFLIP,       vflip,       vf);
-
-    REGISTER_FILTER (NULLSRC,     nullsrc,     vsrc);
-
-    REGISTER_FILTER (NULLSINK,    nullsink,    vsink);
-}
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
deleted file mode 100644
index 3ed59d7..0000000
--- a/libavfilter/avfilter.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * filter layer
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* #define DEBUG */
-
-#include "libavcodec/imgconvert.h"
-#include "libavutil/pixdesc.h"
-#include "avfilter.h"
-
-unsigned avfilter_version(void) {
-    return LIBAVFILTER_VERSION_INT;
-}
-
-const char *avfilter_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char *avfilter_license(void)
-{
-#define LICENSE_PREFIX "libavfilter license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
-
-/** helper macros to get the in/out pad on the dst/src filter */
-#define link_dpad(link)     link->dst-> input_pads[link->dstpad]
-#define link_spad(link)     link->src->output_pads[link->srcpad]
-
-AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask)
-{
-    AVFilterPicRef *ret = av_malloc(sizeof(AVFilterPicRef));
-    *ret = *ref;
-    ret->perms &= pmask;
-    ret->pic->refcount ++;
-    return ret;
-}
-
-void avfilter_unref_pic(AVFilterPicRef *ref)
-{
-    if(!(--ref->pic->refcount))
-        ref->pic->free(ref->pic);
-    av_free(ref);
-}
-
-void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
-                         AVFilterPad **pads, AVFilterLink ***links,
-                         AVFilterPad *newpad)
-{
-    unsigned i;
-
-    idx = FFMIN(idx, *count);
-
-    *pads  = av_realloc(*pads,  sizeof(AVFilterPad)   * (*count + 1));
-    *links = av_realloc(*links, sizeof(AVFilterLink*) * (*count + 1));
-    memmove(*pads +idx+1, *pads +idx, sizeof(AVFilterPad)   * (*count-idx));
-    memmove(*links+idx+1, *links+idx, sizeof(AVFilterLink*) * (*count-idx));
-    memcpy(*pads+idx, newpad, sizeof(AVFilterPad));
-    (*links)[idx] = NULL;
-
-    (*count) ++;
-    for(i = idx+1; i < *count; i ++)
-        if(*links[i])
-            (*(unsigned *)((uint8_t *) *links[i] + padidx_off)) ++;
-}
-
-int avfilter_link(AVFilterContext *src, unsigned srcpad,
-                  AVFilterContext *dst, unsigned dstpad)
-{
-    AVFilterLink *link;
-
-    if(src->output_count <= srcpad || dst->input_count <= dstpad ||
-       src->outputs[srcpad]        || dst->inputs[dstpad])
-        return -1;
-
-    src->outputs[srcpad] =
-    dst-> inputs[dstpad] = link = av_mallocz(sizeof(AVFilterLink));
-
-    link->src     = src;
-    link->dst     = dst;
-    link->srcpad  = srcpad;
-    link->dstpad  = dstpad;
-    link->format  = PIX_FMT_NONE;
-
-    return 0;
-}
-
-int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
-                           unsigned in, unsigned out)
-{
-    av_log(link->dst, AV_LOG_INFO, "auto-inserting filter '%s' "
-           "between the filter '%s' and the filter '%s'\n",
-           filt->name, link->src->name, link->dst->name);
-
-    link->dst->inputs[link->dstpad] = NULL;
-    if(avfilter_link(filt, out, link->dst, link->dstpad)) {
-        /* failed to link output filter to new filter */
-        link->dst->inputs[link->dstpad] = link;
-        return -1;
-    }
-
-    /* re-hookup the link to the new destination filter we inserted */
-    link->dst = filt;
-    link->dstpad = in;
-    filt->inputs[in] = link;
-
-    /* if any information on supported colorspaces already exists on the
-     * link, we need to preserve that */
-    if(link->out_formats)
-        avfilter_formats_changeref(&link->out_formats,
-                                   &filt->outputs[out]->out_formats);
-
-    return 0;
-}
-
-int avfilter_config_links(AVFilterContext *filter)
-{
-    int (*config_link)(AVFilterLink *);
-    unsigned i;
-
-    for(i = 0; i < filter->input_count; i ++) {
-        AVFilterLink *link = filter->inputs[i];
-
-        if(!link) continue;
-
-        switch(link->init_state) {
-        case AVLINK_INIT:
-            continue;
-        case AVLINK_STARTINIT:
-            av_log(filter, AV_LOG_INFO, "circular filter chain detected\n");
-            return 0;
-        case AVLINK_UNINIT:
-            link->init_state = AVLINK_STARTINIT;
-
-            if(avfilter_config_links(link->src))
-                return -1;
-
-            if(!(config_link = link_spad(link).config_props))
-                config_link  = avfilter_default_config_output_link;
-            if(config_link(link))
-                return -1;
-
-            if((config_link = link_dpad(link).config_props))
-                if(config_link(link))
-                    return -1;
-
-            link->init_state = AVLINK_INIT;
-        }
-    }
-
-    return 0;
-}
-
-static void dprintf_picref(void *ctx, AVFilterPicRef *picref, int end)
-{
-    dprintf(ctx,
-            "picref[%p data[%p, %p, %p, %p] linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64" a:%d/%d s:%dx%d]%s",
-            picref,
-            picref->data    [0], picref->data    [1], picref->data    [2], picref->data    [3],
-            picref->linesize[0], picref->linesize[1], picref->linesize[2], picref->linesize[3],
-            picref->pts, picref->pos,
-            picref->pixel_aspect.num, picref->pixel_aspect.den, picref->w, picref->h,
-            end ? "\n" : "");
-}
-
-static void dprintf_link(void *ctx, AVFilterLink *link, int end)
-{
-    dprintf(ctx,
-            "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s",
-            link, link->w, link->h,
-            av_pix_fmt_descriptors[link->format].name,
-            link->src ? link->src->filter->name : "",
-            link->dst ? link->dst->filter->name : "",
-            end ? "\n" : "");
-}
-
-#define DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func)
-
-AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
-    AVFilterPicRef *ret = NULL;
-
-    DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h);
-
-    if(link_dpad(link).get_video_buffer)
-        ret = link_dpad(link).get_video_buffer(link, perms, w, h);
-
-    if(!ret)
-        ret = avfilter_default_get_video_buffer(link, perms, w, h);
-
-    DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); dprintf_picref(NULL, ret, 1);
-
-    return ret;
-}
-
-int avfilter_request_frame(AVFilterLink *link)
-{
-    DPRINTF_START(NULL, request_frame); dprintf_link(NULL, link, 1);
-
-    if(link_spad(link).request_frame)
-        return link_spad(link).request_frame(link);
-    else if(link->src->inputs[0])
-        return avfilter_request_frame(link->src->inputs[0]);
-    else return -1;
-}
-
-int avfilter_poll_frame(AVFilterLink *link)
-{
-    int i, min=INT_MAX;
-
-    if(link_spad(link).poll_frame)
-        return link_spad(link).poll_frame(link);
-
-    for (i=0; i<link->src->input_count; i++) {
-        int val;
-        if(!link->src->inputs[i])
-            return -1;
-        val = avfilter_poll_frame(link->src->inputs[i]);
-        min = FFMIN(min, val);
-    }
-
-    return min;
-}
-
-/* XXX: should we do the duplicating of the picture ref here, instead of
- * forcing the source filter to do it? */
-void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    void (*start_frame)(AVFilterLink *, AVFilterPicRef *);
-    AVFilterPad *dst = &link_dpad(link);
-
-    DPRINTF_START(NULL, start_frame); dprintf_link(NULL, link, 0); dprintf(NULL, " "); dprintf_picref(NULL, picref, 1);
-
-    if(!(start_frame = dst->start_frame))
-        start_frame = avfilter_default_start_frame;
-
-    /* prepare to copy the picture if it has insufficient permissions */
-    if((dst->min_perms & picref->perms) != dst->min_perms ||
-        dst->rej_perms & picref->perms) {
-        /*
-        av_log(link->dst, AV_LOG_INFO,
-                "frame copy needed (have perms %x, need %x, reject %x)\n",
-                picref->perms,
-                link_dpad(link).min_perms, link_dpad(link).rej_perms);
-        */
-
-        link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
-        link->srcpic = picref;
-        link->cur_pic->pts = link->srcpic->pts;
-        link->cur_pic->pos = link->srcpic->pos;
-        link->cur_pic->pixel_aspect = link->srcpic->pixel_aspect;
-    }
-    else
-        link->cur_pic = picref;
-
-    start_frame(link, link->cur_pic);
-}
-
-void avfilter_end_frame(AVFilterLink *link)
-{
-    void (*end_frame)(AVFilterLink *);
-
-    if(!(end_frame = link_dpad(link).end_frame))
-        end_frame = avfilter_default_end_frame;
-
-    end_frame(link);
-
-    /* unreference the source picture if we're feeding the destination filter
-     * a copied version dues to permission issues */
-    if(link->srcpic) {
-        avfilter_unref_pic(link->srcpic);
-        link->srcpic = NULL;
-    }
-
-}
-
-void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    uint8_t *src[4], *dst[4];
-    int i, j, vsub;
-    void (*draw_slice)(AVFilterLink *, int, int, int);
-
-    DPRINTF_START(NULL, draw_slice); dprintf_link(NULL, link, 0); dprintf(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
-
-    /* copy the slice if needed for permission reasons */
-    if(link->srcpic) {
-        vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
-
-        for(i = 0; i < 4; i ++) {
-            if(link->srcpic->data[i]) {
-                src[i] = link->srcpic-> data[i] +
-                    (y >> (i==0 ? 0 : vsub)) * link->srcpic-> linesize[i];
-                dst[i] = link->cur_pic->data[i] +
-                    (y >> (i==0 ? 0 : vsub)) * link->cur_pic->linesize[i];
-            } else
-                src[i] = dst[i] = NULL;
-        }
-
-        for(i = 0; i < 4; i ++) {
-            int planew =
-                ff_get_plane_bytewidth(link->format, link->cur_pic->w, i);
-
-            if(!src[i]) continue;
-
-            for(j = 0; j < h >> (i==0 ? 0 : vsub); j ++) {
-                memcpy(dst[i], src[i], planew);
-                src[i] += link->srcpic ->linesize[i];
-                dst[i] += link->cur_pic->linesize[i];
-            }
-        }
-    }
-
-    if(!(draw_slice = link_dpad(link).draw_slice))
-        draw_slice = avfilter_default_draw_slice;
-    draw_slice(link, y, h, slice_dir);
-}
-
-#define MAX_REGISTERED_AVFILTERS_NB 64
-
-static AVFilter *registered_avfilters[MAX_REGISTERED_AVFILTERS_NB + 1];
-
-static int next_registered_avfilter_idx = 0;
-
-AVFilter *avfilter_get_by_name(const char *name)
-{
-    int i;
-
-    for (i = 0; registered_avfilters[i]; i++)
-        if (!strcmp(registered_avfilters[i]->name, name))
-            return registered_avfilters[i];
-
-    return NULL;
-}
-
-int avfilter_register(AVFilter *filter)
-{
-    if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB)
-        return -1;
-
-    registered_avfilters[next_registered_avfilter_idx++] = filter;
-    return 0;
-}
-
-AVFilter **av_filter_next(AVFilter **filter)
-{
-    return filter ? ++filter : &registered_avfilters[0];
-}
-
-void avfilter_uninit(void)
-{
-    memset(registered_avfilters, 0, sizeof(registered_avfilters));
-    next_registered_avfilter_idx = 0;
-}
-
-static int pad_count(const AVFilterPad *pads)
-{
-    int count;
-
-    for(count = 0; pads->name; count ++) pads ++;
-    return count;
-}
-
-static const char *filter_name(void *p)
-{
-    AVFilterContext *filter = p;
-    return filter->filter->name;
-}
-
-static const AVClass avfilter_class = {
-    "AVFilter",
-    filter_name,
-    NULL,
-    LIBAVUTIL_VERSION_INT,
-};
-
-AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name)
-{
-    AVFilterContext *ret;
-
-    if (!filter)
-        return 0;
-
-    ret = av_mallocz(sizeof(AVFilterContext));
-
-    ret->av_class = &avfilter_class;
-    ret->filter   = filter;
-    ret->name     = inst_name ? av_strdup(inst_name) : NULL;
-    ret->priv     = av_mallocz(filter->priv_size);
-
-    ret->input_count  = pad_count(filter->inputs);
-    if (ret->input_count) {
-        ret->input_pads   = av_malloc(sizeof(AVFilterPad) * ret->input_count);
-        memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count);
-        ret->inputs       = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);
-    }
-
-    ret->output_count = pad_count(filter->outputs);
-    if (ret->output_count) {
-        ret->output_pads  = av_malloc(sizeof(AVFilterPad) * ret->output_count);
-        memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count);
-        ret->outputs      = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
-    }
-
-    return ret;
-}
-
-void avfilter_destroy(AVFilterContext *filter)
-{
-    int i;
-
-    if(filter->filter->uninit)
-        filter->filter->uninit(filter);
-
-    for(i = 0; i < filter->input_count; i ++) {
-        if(filter->inputs[i])
-            filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
-        av_freep(&filter->inputs[i]);
-    }
-    for(i = 0; i < filter->output_count; i ++) {
-        if(filter->outputs[i])
-            filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;
-        av_freep(&filter->outputs[i]);
-    }
-
-    av_freep(&filter->name);
-    av_freep(&filter->input_pads);
-    av_freep(&filter->output_pads);
-    av_freep(&filter->inputs);
-    av_freep(&filter->outputs);
-    av_freep(&filter->priv);
-    av_free(filter);
-}
-
-int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque)
-{
-    int ret=0;
-
-    if(filter->filter->init)
-        ret = filter->filter->init(filter, args, opaque);
-    return ret;
-}
-
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
deleted file mode 100644
index 214b8d4..0000000
--- a/libavfilter/avfilter.h
+++ /dev/null
@@ -1,703 +0,0 @@
-/*
- * filter layer
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFILTER_AVFILTER_H
-#define AVFILTER_AVFILTER_H
-
-#include "libavutil/avutil.h"
-
-#define LIBAVFILTER_VERSION_MAJOR  1
-#define LIBAVFILTER_VERSION_MINOR 19
-#define LIBAVFILTER_VERSION_MICRO  0
-
-#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
-                                               LIBAVFILTER_VERSION_MINOR, \
-                                               LIBAVFILTER_VERSION_MICRO)
-#define LIBAVFILTER_VERSION     AV_VERSION(LIBAVFILTER_VERSION_MAJOR,   \
-                                           LIBAVFILTER_VERSION_MINOR,   \
-                                           LIBAVFILTER_VERSION_MICRO)
-#define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
-
-#include <stddef.h>
-#include "libavcodec/avcodec.h"
-
-/**
- * Returns the LIBAVFILTER_VERSION_INT constant.
- */
-unsigned avfilter_version(void);
-
-/**
- * Returns the libavfilter build-time configuration.
- */
-const char *avfilter_configuration(void);
-
-/**
- * Returns the libavfilter license.
- */
-const char *avfilter_license(void);
-
-
-typedef struct AVFilterContext AVFilterContext;
-typedef struct AVFilterLink    AVFilterLink;
-typedef struct AVFilterPad     AVFilterPad;
-
-/* TODO: look for other flags which may be useful in this structure (interlace
- * flags, etc)
- */
-/**
- * A reference-counted picture data type used by the filter system. Filters
- * should not store pointers to this structure directly, but instead use the
- * AVFilterPicRef structure below.
- */
-typedef struct AVFilterPic
-{
-    uint8_t *data[4];           ///< picture data for each plane
-    int linesize[4];            ///< number of bytes per line
-    enum PixelFormat format;    ///< colorspace
-
-    unsigned refcount;          ///< number of references to this image
-
-    /** private data to be used by a custom free function */
-    void *priv;
-    /**
-     * A pointer to the function to deallocate this image if the default
-     * function is not sufficient. This could, for example, add the memory
-     * back into a memory pool to be reused later without the overhead of
-     * reallocating it from scratch.
-     */
-    void (*free)(struct AVFilterPic *pic);
-
-    int w, h;                  ///< width and height of the allocated buffer
-} AVFilterPic;
-
-/**
- * A reference to an AVFilterPic. Since filters can manipulate the origin of
- * a picture to, for example, crop image without any memcpy, the picture origin
- * and dimensions are per-reference properties. Linesize is also useful for
- * image flipping, frame to field filters, etc, and so is also per-reference.
- *
- * TODO: add anything necessary for frame reordering
- */
-typedef struct AVFilterPicRef
-{
-    AVFilterPic *pic;           ///< the picture that this is a reference to
-    uint8_t *data[4];           ///< picture data for each plane
-    int linesize[4];            ///< number of bytes per line
-    int w;                      ///< image width
-    int h;                      ///< image height
-
-    int64_t pts;                ///< presentation timestamp in units of 1/AV_TIME_BASE
-    int64_t pos;                ///< byte position in stream, -1 if unknown
-
-    AVRational pixel_aspect;    ///< pixel aspect ratio
-
-    int perms;                  ///< permissions
-#define AV_PERM_READ     0x01   ///< can read from the buffer
-#define AV_PERM_WRITE    0x02   ///< can write to the buffer
-#define AV_PERM_PRESERVE 0x04   ///< nobody else can overwrite the buffer
-#define AV_PERM_REUSE    0x08   ///< can output the buffer multiple times, with the same contents each time
-#define AV_PERM_REUSE2   0x10   ///< can output the buffer multiple times, modified each time
-} AVFilterPicRef;
-
-/**
- * Adds a new reference to a picture.
- * @param ref   an existing reference to the picture
- * @param pmask a bitmask containing the allowable permissions in the new
- *              reference
- * @return      a new reference to the picture with the same properties as the
- *              old, excluding any permissions denied by pmask
- */
-AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask);
-
-/**
- * Removes a reference to a picture. If this is the last reference to the
- * picture, the picture itself is also automatically freed.
- * @param ref reference to the picture
- */
-void avfilter_unref_pic(AVFilterPicRef *ref);
-
-/**
- * A list of supported formats for one end of a filter link. This is used
- * during the format negotiation process to try to pick the best format to
- * use to minimize the number of necessary conversions. Each filter gives a
- * list of the formats supported by each input and output pad. The list
- * given for each pad need not be distinct - they may be references to the
- * same list of formats, as is often the case when a filter supports multiple
- * formats, but will always output the same format as it is given in input.
- *
- * In this way, a list of possible input formats and a list of possible
- * output formats are associated with each link. When a set of formats is
- * negotiated over a link, the input and output lists are merged to form a
- * new list containing only the common elements of each list. In the case
- * that there were no common elements, a format conversion is necessary.
- * Otherwise, the lists are merged, and all other links which reference
- * either of the format lists involved in the merge are also affected.
- *
- * For example, consider the filter chain:
- * filter (a) --> (b) filter (b) --> (c) filter
- *
- * where the letters in parenthesis indicate a list of formats supported on
- * the input or output of the link. Suppose the lists are as follows:
- * (a) = {A, B}
- * (b) = {A, B, C}
- * (c) = {B, C}
- *
- * First, the first link's lists are merged, yielding:
- * filter (a) --> (a) filter (a) --> (c) filter
- *
- * Notice that format list (b) now refers to the same list as filter list (a).
- * Next, the lists for the second link are merged, yielding:
- * filter (a) --> (a) filter (a) --> (a) filter
- *
- * where (a) = {B}.
- *
- * Unfortunately, when the format lists at the two ends of a link are merged,
- * we must ensure that all links which reference either pre-merge format list
- * get updated as well. Therefore, we have the format list structure store a
- * pointer to each of the pointers to itself.
- */
-typedef struct AVFilterFormats AVFilterFormats;
-struct AVFilterFormats
-{
-    unsigned format_count;      ///< number of formats
-    enum PixelFormat *formats;  ///< list of pixel formats
-
-    unsigned refcount;          ///< number of references to this list
-    AVFilterFormats ***refs;    ///< references to this list
-};
-
-/**
- * Creates a list of supported formats. This is intended for use in
- * AVFilter->query_formats().
- * @param pix_fmt list of pixel formats, terminated by PIX_FMT_NONE
- * @return the format list, with no existing references
- */
-AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts);
-
-/**
- * Adds pix_fmt to the list of pixel formats contained in *avff.
- * If *avff is NULL the function allocates the filter formats struct
- * and puts its pointer in *avff.
- *
- * @return a non negative value in case of success, or a negative
- * value corresponding to an AVERROR code in case of error
- */
-int avfilter_add_colorspace(AVFilterFormats **avff, enum PixelFormat pix_fmt);
-
-/**
- * Returns a list of all colorspaces supported by FFmpeg.
- */
-AVFilterFormats *avfilter_all_colorspaces(void);
-
-/**
- * Returns a format list which contains the intersection of the formats of
- * a and b. Also, all the references of a, all the references of b, and
- * a and b themselves will be deallocated.
- *
- * If a and b do not share any common formats, neither is modified, and NULL
- * is returned.
- */
-AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b);
-
-/**
- * Adds *ref as a new reference to formats.
- * That is the pointers will point like in the ascii art below:
- *   ________
- *  |formats |<--------.
- *  |  ____  |     ____|___________________
- *  | |refs| |    |  __|_
- *  | |* * | |    | |  | |  AVFilterLink
- *  | |* *--------->|*ref|
- *  | |____| |    | |____|
- *  |________|    |________________________
- */
-void avfilter_formats_ref(AVFilterFormats *formats, AVFilterFormats **ref);
-
-/**
- * If *ref is non-NULL, removes *ref as a reference to the format list
- * it currently points to, deallocates that list if this was the last
- * reference, and sets *ref to NULL.
- *
- *         Before                                 After
- *   ________                               ________         NULL
- *  |formats |<--------.                   |formats |         ^
- *  |  ____  |     ____|________________   |  ____  |     ____|________________
- *  | |refs| |    |  __|_                  | |refs| |    |  __|_
- *  | |* * | |    | |  | |  AVFilterLink   | |* * | |    | |  | |  AVFilterLink
- *  | |* *--------->|*ref|                 | |*   | |    | |*ref|
- *  | |____| |    | |____|                 | |____| |    | |____|
- *  |________|    |_____________________   |________|    |_____________________
- */
-void avfilter_formats_unref(AVFilterFormats **ref);
-
-/**
- *
- *         Before                                 After
- *   ________                         ________
- *  |formats |<---------.            |formats |<---------.
- *  |  ____  |       ___|___         |  ____  |       ___|___
- *  | |refs| |      |   |   |        | |refs| |      |   |   |   NULL
- *  | |* *--------->|*oldref|        | |* *--------->|*newref|     ^
- *  | |* * | |      |_______|        | |* * | |      |_______|  ___|___
- *  | |____| |                       | |____| |                |   |   |
- *  |________|                       |________|                |*oldref|
- *                                                             |_______|
- */
-void avfilter_formats_changeref(AVFilterFormats **oldref,
-                                AVFilterFormats **newref);
-
-/**
- * A filter pad used for either input or output.
- */
-struct AVFilterPad
-{
-    /**
-     * Pad name. The name is unique among inputs and among outputs, but an
-     * input may have the same name as an output. This may be NULL if this
-     * pad has no need to ever be referenced by name.
-     */
-    const char *name;
-
-    /**
-     * AVFilterPad type. Only video supported now, hopefully someone will
-     * add audio in the future.
-     */
-    enum AVMediaType type;
-
-    /**
-     * Minimum required permissions on incoming buffers. Any buffer with
-     * insufficient permissions will be automatically copied by the filter
-     * system to a new buffer which provides the needed access permissions.
-     *
-     * Input pads only.
-     */
-    int min_perms;
-
-    /**
-     * Permissions which are not accepted on incoming buffers. Any buffer
-     * which has any of these permissions set will be automatically copied
-     * by the filter system to a new buffer which does not have those
-     * permissions. This can be used to easily disallow buffers with
-     * AV_PERM_REUSE.
-     *
-     * Input pads only.
-     */
-    int rej_perms;
-
-    /**
-     * Callback called before passing the first slice of a new frame. If
-     * NULL, the filter layer will default to storing a reference to the
-     * picture inside the link structure.
-     *
-     * Input video pads only.
-     */
-    void (*start_frame)(AVFilterLink *link, AVFilterPicRef *picref);
-
-    /**
-     * Callback function to get a buffer. If NULL, the filter system will
-     * use avfilter_default_get_video_buffer().
-     *
-     * Input video pads only.
-     */
-    AVFilterPicRef *(*get_video_buffer)(AVFilterLink *link, int perms, int w, int h);
-
-    /**
-     * Callback called after the slices of a frame are completely sent. If
-     * NULL, the filter layer will default to releasing the reference stored
-     * in the link structure during start_frame().
-     *
-     * Input video pads only.
-     */
-    void (*end_frame)(AVFilterLink *link);
-
-    /**
-     * Slice drawing callback. This is where a filter receives video data
-     * and should do its processing.
-     *
-     * Input video pads only.
-     */
-    void (*draw_slice)(AVFilterLink *link, int y, int height, int slice_dir);
-
-    /**
-     * Frame poll callback. This returns the number of immediately available
-     * frames. It should return a positive value if the next request_frame()
-     * is guaranteed to return one frame (with no delay).
-     *
-     * Defaults to just calling the source poll_frame() method.
-     *
-     * Output video pads only.
-     */
-    int (*poll_frame)(AVFilterLink *link);
-
-    /**
-     * Frame request callback. A call to this should result in at least one
-     * frame being output over the given link. This should return zero on
-     * success, and another value on error.
-     *
-     * Output video pads only.
-     */
-    int (*request_frame)(AVFilterLink *link);
-
-    /**
-     * Link configuration callback.
-     *
-     * For output pads, this should set the link properties such as
-     * width/height. This should NOT set the format property - that is
-     * negotiated between filters by the filter system using the
-     * query_formats() callback before this function is called.
-     *
-     * For input pads, this should check the properties of the link, and update
-     * the filter's internal state as necessary.
-     *
-     * For both input and output filters, this should return zero on success,
-     * and another value on error.
-     */
-    int (*config_props)(AVFilterLink *link);
-};
-
-/** default handler for start_frame() for video inputs */
-void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
-/** default handler for draw_slice() for video inputs */
-void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
-/** default handler for end_frame() for video inputs */
-void avfilter_default_end_frame(AVFilterLink *link);
-/** default handler for config_props() for video outputs */
-int avfilter_default_config_output_link(AVFilterLink *link);
-/** default handler for config_props() for video inputs */
-int avfilter_default_config_input_link (AVFilterLink *link);
-/** default handler for get_video_buffer() for video inputs */
-AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link,
-                                                  int perms, int w, int h);
-/**
- * A helper for query_formats() which sets all links to the same list of
- * formats. If there are no links hooked to this filter, the list of formats is
- * freed.
- */
-void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
-/** Default handler for query_formats() */
-int avfilter_default_query_formats(AVFilterContext *ctx);
-
-/** start_frame() handler for filters which simply pass video along */
-void avfilter_null_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
-
-/** draw_slice() handler for filters which simply pass video along */
-void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
-
-/** end_frame() handler for filters which simply pass video along */
-void avfilter_null_end_frame(AVFilterLink *link);
-
-/** get_video_buffer() handler for filters which simply pass video along */
-AVFilterPicRef *avfilter_null_get_video_buffer(AVFilterLink *link,
-                                                  int perms, int w, int h);
-
-/**
- * Filter definition. This defines the pads a filter contains, and all the
- * callback functions used to interact with the filter.
- */
-typedef struct AVFilter
-{
-    const char *name;         ///< filter name
-
-    int priv_size;      ///< size of private data to allocate for the filter
-
-    /**
-     * Filter initialization function. Args contains the user-supplied
-     * parameters. FIXME: maybe an AVOption-based system would be better?
-     * opaque is data provided by the code requesting creation of the filter,
-     * and is used to pass data to the filter.
-     */
-    int (*init)(AVFilterContext *ctx, const char *args, void *opaque);
-
-    /**
-     * Filter uninitialization function. Should deallocate any memory held
-     * by the filter, release any picture references, etc. This does not need
-     * to deallocate the AVFilterContext->priv memory itself.
-     */
-    void (*uninit)(AVFilterContext *ctx);
-
-    /**
-     * Queries formats supported by the filter and its pads, and sets the
-     * in_formats for links connected to its output pads, and out_formats
-     * for links connected to its input pads.
-     *
-     * @return zero on success, a negative value corresponding to an
-     * AVERROR code otherwise
-     */
-    int (*query_formats)(AVFilterContext *);
-
-    const AVFilterPad *inputs;  ///< NULL terminated list of inputs. NULL if none
-    const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none
-
-    /**
-     * A description for the filter. You should use the
-     * NULL_IF_CONFIG_SMALL() macro to define it.
-     */
-    const char *description;
-} AVFilter;
-
-/** An instance of a filter */
-struct AVFilterContext
-{
-    const AVClass *av_class;              ///< needed for av_log()
-
-    AVFilter *filter;               ///< the AVFilter of which this is an instance
-
-    char *name;                     ///< name of this filter instance
-
-    unsigned input_count;           ///< number of input pads
-    AVFilterPad   *input_pads;      ///< array of input pads
-    AVFilterLink **inputs;          ///< array of pointers to input links
-
-    unsigned output_count;          ///< number of output pads
-    AVFilterPad   *output_pads;     ///< array of output pads
-    AVFilterLink **outputs;         ///< array of pointers to output links
-
-    void *priv;                     ///< private data for use by the filter
-};
-
-/**
- * A link between two filters. This contains pointers to the source and
- * destination filters between which this link exists, and the indexes of
- * the pads involved. In addition, this link also contains the parameters
- * which have been negotiated and agreed upon between the filter, such as
- * image dimensions, format, etc.
- */
-struct AVFilterLink
-{
-    AVFilterContext *src;       ///< source filter
-    unsigned int srcpad;        ///< index of the output pad on the source filter
-
-    AVFilterContext *dst;       ///< dest filter
-    unsigned int dstpad;        ///< index of the input pad on the dest filter
-
-    /** stage of the initialization of the link properties (dimensions, etc) */
-    enum {
-        AVLINK_UNINIT = 0,      ///< not started
-        AVLINK_STARTINIT,       ///< started, but incomplete
-        AVLINK_INIT             ///< complete
-    } init_state;
-
-    int w;                      ///< agreed upon image width
-    int h;                      ///< agreed upon image height
-    enum PixelFormat format;    ///< agreed upon image colorspace
-
-    /**
-     * Lists of formats supported by the input and output filters respectively.
-     * These lists are used for negotiating the format to actually be used,
-     * which will be loaded into the format member, above, when chosen.
-     */
-    AVFilterFormats *in_formats;
-    AVFilterFormats *out_formats;
-
-    /**
-     * The picture reference currently being sent across the link by the source
-     * filter. This is used internally by the filter system to allow
-     * automatic copying of pictures which do not have sufficient permissions
-     * for the destination. This should not be accessed directly by the
-     * filters.
-     */
-    AVFilterPicRef *srcpic;
-
-    AVFilterPicRef *cur_pic;
-    AVFilterPicRef *outpic;
-};
-
-/**
- * Links two filters together.
- * @param src    the source filter
- * @param srcpad index of the output pad on the source filter
- * @param dst    the destination filter
- * @param dstpad index of the input pad on the destination filter
- * @return       zero on success
- */
-int avfilter_link(AVFilterContext *src, unsigned srcpad,
-                  AVFilterContext *dst, unsigned dstpad);
-
-/**
- * Negotiates the colorspace, dimensions, etc of all inputs to a filter.
- * @param filter the filter to negotiate the properties for its inputs
- * @return       zero on successful negotiation
- */
-int avfilter_config_links(AVFilterContext *filter);
-
-/**
- * Requests a picture buffer with a specific set of permissions.
- * @param link  the output link to the filter from which the picture will
- *              be requested
- * @param perms the required access permissions
- * @param w     the minimum width of the buffer to allocate
- * @param h     the minimum height of the buffer to allocate
- * @return      A reference to the picture. This must be unreferenced with
- *              avfilter_unref_pic when you are finished with it.
- */
-AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms,
-                                          int w, int h);
-
-/**
- * Requests an input frame from the filter at the other end of the link.
- * @param link the input link
- * @return     zero on success
- */
-int avfilter_request_frame(AVFilterLink *link);
-
-/**
- * Polls a frame from the filter chain.
- * @param  link the input link
- * @return the number of immediately available frames, a negative
- * number in case of error
- */
-int avfilter_poll_frame(AVFilterLink *link);
-
-/**
- * Notifies the next filter of the start of a frame.
- * @param link   the output link the frame will be sent over
- * @param picref A reference to the frame about to be sent. The data for this
- *               frame need only be valid once draw_slice() is called for that
- *               portion. The receiving filter will free this reference when
- *               it no longer needs it.
- */
-void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref);
-
-/**
- * Notifies the next filter that the current frame has finished.
- * @param link the output link the frame was sent over
- */
-void avfilter_end_frame(AVFilterLink *link);
-
-/**
- * Sends a slice to the next filter.
- *
- * Slices have to be provided in sequential order, either in
- * top-bottom or bottom-top order. If slices are provided in
- * non-sequential order the behavior of the function is undefined.
- *
- * @param link the output link over which the frame is being sent
- * @param y    offset in pixels from the top of the image for this slice
- * @param h    height of this slice in pixels
- * @param slice_dir the assumed direction for sending slices,
- *             from the top slice to the bottom slice if the value is 1,
- *             from the bottom slice to the top slice if the value is -1,
- *             for other values the behavior of the function is undefined.
- */
-void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
-
-/** Initializes the filter system. Registers all builtin filters. */
-void avfilter_register_all(void);
-
-/** Uninitializes the filter system. Unregisters all filters. */
-void avfilter_uninit(void);
-
-/**
- * Registers a filter. This is only needed if you plan to use
- * avfilter_get_by_name later to lookup the AVFilter structure by name. A
- * filter can still by instantiated with avfilter_open even if it is not
- * registered.
- * @param filter the filter to register
- * @return 0 if the registration was succesfull, a negative value
- * otherwise
- */
-int avfilter_register(AVFilter *filter);
-
-/**
- * Gets a filter definition matching the given name.
- * @param name the filter name to find
- * @return     the filter definition, if any matching one is registered.
- *             NULL if none found.
- */
-AVFilter *avfilter_get_by_name(const char *name);
-
-/**
- * If filter is NULL, returns a pointer to the first registered filter pointer,
- * if filter is non-NULL, returns the next pointer after filter.
- * If the returned pointer points to NULL, the last registered filter
- * was already reached.
- */
-AVFilter **av_filter_next(AVFilter **filter);
-
-/**
- * Creates a filter instance.
- * @param filter    the filter to create an instance of
- * @param inst_name Name to give to the new instance. Can be NULL for none.
- * @return          Pointer to the new instance on success. NULL on failure.
- */
-AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name);
-
-/**
- * Initializes a filter.
- * @param filter the filter to initialize
- * @param args   A string of parameters to use when initializing the filter.
- *               The format and meaning of this string varies by filter.
- * @param opaque Any extra non-string data needed by the filter. The meaning
- *               of this parameter varies by filter.
- * @return       zero on success
- */
-int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque);
-
-/**
- * Destroys a filter.
- * @param filter the filter to destroy
- */
-void avfilter_destroy(AVFilterContext *filter);
-
-/**
- * Inserts a filter in the middle of an existing link.
- * @param link the link into which the filter should be inserted
- * @param filt the filter to be inserted
- * @param in   the input pad on the filter to connect
- * @param out  the output pad on the filter to connect
- * @return     zero on success
- */
-int avfilter_insert_filter(AVFilterLink *link, AVFilterContext *filt,
-                           unsigned in, unsigned out);
-
-/**
- * Inserts a new pad.
- * @param idx Insertion point. Pad is inserted at the end if this point
- *            is beyond the end of the list of pads.
- * @param count Pointer to the number of pads in the list
- * @param padidx_off Offset within an AVFilterLink structure to the element
- *                   to increment when inserting a new pad causes link
- *                   numbering to change
- * @param pads Pointer to the pointer to the beginning of the list of pads
- * @param links Pointer to the pointer to the beginning of the list of links
- * @param newpad The new pad to add. A copy is made when adding.
- */
-void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
-                         AVFilterPad **pads, AVFilterLink ***links,
-                         AVFilterPad *newpad);
-
-/** Inserts a new input pad for the filter. */
-static inline void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
-                                         AVFilterPad *p)
-{
-    avfilter_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
-                        &f->input_pads, &f->inputs, p);
-}
-
-/** Inserts a new output pad for the filter. */
-static inline void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
-                                          AVFilterPad *p)
-{
-    avfilter_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
-                        &f->output_pads, &f->outputs, p);
-}
-
-#endif  /* AVFILTER_AVFILTER_H */
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
deleted file mode 100644
index 9ad6536..0000000
--- a/libavfilter/avfiltergraph.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * filter graphs
- * copyright (c) 2008 Vitor Sessak
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <ctype.h>
-#include <string.h>
-
-#include "avfilter.h"
-#include "avfiltergraph.h"
-
-void avfilter_graph_destroy(AVFilterGraph *graph)
-{
-    for(; graph->filter_count > 0; graph->filter_count --)
-        avfilter_destroy(graph->filters[graph->filter_count - 1]);
-    av_freep(&graph->scale_sws_opts);
-    av_freep(&graph->filters);
-}
-
-int avfilter_graph_add_filter(AVFilterGraph *graph, AVFilterContext *filter)
-{
-    AVFilterContext **filters = av_realloc(graph->filters,
-                                           sizeof(AVFilterContext*) * (graph->filter_count+1));
-    if (!filters)
-        return AVERROR(ENOMEM);
-
-    graph->filters = filters;
-    graph->filters[graph->filter_count++] = filter;
-
-    return 0;
-}
-
-int avfilter_graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
-{
-    AVFilterContext *filt;
-    int i, j;
-
-    for (i=0; i < graph->filter_count; i++) {
-        filt = graph->filters[i];
-
-        for (j = 0; j < filt->input_count; j++) {
-            if (!filt->inputs[j] || !filt->inputs[j]->src) {
-                av_log(log_ctx, AV_LOG_ERROR,
-                       "Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",
-                       filt->input_pads[j].name, filt->name, filt->filter->name);
-                return -1;
-            }
-        }
-
-        for (j = 0; j < filt->output_count; j++) {
-            if (!filt->outputs[j] || !filt->outputs[j]->dst) {
-                av_log(log_ctx, AV_LOG_ERROR,
-                       "Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",
-                       filt->output_pads[j].name, filt->name, filt->filter->name);
-                return -1;
-            }
-        }
-    }
-
-    return 0;
-}
-
-int avfilter_graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
-{
-    AVFilterContext *filt;
-    int i, ret;
-
-    for (i=0; i < graph->filter_count; i++) {
-        filt = graph->filters[i];
-
-        if (!filt->output_count) {
-            if ((ret = avfilter_config_links(filt)))
-                return ret;
-        }
-    }
-
-    return 0;
-}
-
-AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name)
-{
-    int i;
-
-    for(i = 0; i < graph->filter_count; i ++)
-        if(graph->filters[i]->name && !strcmp(name, graph->filters[i]->name))
-            return graph->filters[i];
-
-    return NULL;
-}
-
-static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
-{
-    int i, j;
-    int scaler_count = 0;
-    char inst_name[30];
-
-    /* ask all the sub-filters for their supported colorspaces */
-    for(i = 0; i < graph->filter_count; i ++) {
-        if(graph->filters[i]->filter->query_formats)
-            graph->filters[i]->filter->query_formats(graph->filters[i]);
-        else
-            avfilter_default_query_formats(graph->filters[i]);
-    }
-
-    /* go through and merge as many format lists as possible */
-    for(i = 0; i < graph->filter_count; i ++) {
-        AVFilterContext *filter = graph->filters[i];
-
-        for(j = 0; j < filter->input_count; j ++) {
-            AVFilterLink *link = filter->inputs[j];
-            if(link && link->in_formats != link->out_formats) {
-                if(!avfilter_merge_formats(link->in_formats,
-                                           link->out_formats)) {
-                    AVFilterContext *scale;
-                    char scale_args[256];
-                    /* couldn't merge format lists. auto-insert scale filter */
-                    snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
-                             scaler_count++);
-                    scale =
-                        avfilter_open(avfilter_get_by_name("scale"),inst_name);
-
-                    snprintf(scale_args, sizeof(scale_args), "0:0:%s", graph->scale_sws_opts);
-                    if(!scale || scale->filter->init(scale, scale_args, NULL) ||
-                                 avfilter_insert_filter(link, scale, 0, 0)) {
-                        avfilter_destroy(scale);
-                        return -1;
-                    }
-
-                    if (avfilter_graph_add_filter(graph, scale) < 0)
-                        return -1;
-
-                    scale->filter->query_formats(scale);
-                    if (((link = scale-> inputs[0]) &&
-                         !avfilter_merge_formats(link->in_formats, link->out_formats)) ||
-                        ((link = scale->outputs[0]) &&
-                         !avfilter_merge_formats(link->in_formats, link->out_formats))) {
-                        av_log(log_ctx, AV_LOG_ERROR,
-                               "Impossible to convert between the formats supported by the filter "
-                               "'%s' and the filter '%s'\n", link->src->name, link->dst->name);
-                        return -1;
-                    }
-                }
-            }
-        }
-    }
-
-    return 0;
-}
-
-static void pick_format(AVFilterLink *link)
-{
-    if(!link || !link->in_formats)
-        return;
-
-    link->in_formats->format_count = 1;
-    link->format = link->in_formats->formats[0];
-
-    avfilter_formats_unref(&link->in_formats);
-    avfilter_formats_unref(&link->out_formats);
-}
-
-static void pick_formats(AVFilterGraph *graph)
-{
-    int i, j;
-
-    for(i = 0; i < graph->filter_count; i ++) {
-        AVFilterContext *filter = graph->filters[i];
-
-        for(j = 0; j < filter->input_count; j ++)
-            pick_format(filter->inputs[j]);
-        for(j = 0; j < filter->output_count; j ++)
-            pick_format(filter->outputs[j]);
-    }
-}
-
-int avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
-{
-    /* find supported formats from sub-filters, and merge along links */
-    if(query_formats(graph, log_ctx))
-        return -1;
-
-    /* Once everything is merged, it's possible that we'll still have
-     * multiple valid colorspace choices. We pick the first one. */
-    pick_formats(graph);
-
-    return 0;
-}
-
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
deleted file mode 100644
index 1640795..0000000
--- a/libavfilter/avfiltergraph.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Filter graphs
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFILTER_AVFILTERGRAPH_H
-#define AVFILTER_AVFILTERGRAPH_H
-
-#include "avfilter.h"
-
-typedef struct AVFilterGraph {
-    unsigned filter_count;
-    AVFilterContext **filters;
-
-    char *scale_sws_opts; ///< sws options to use for the auto-inserted scale filters
-} AVFilterGraph;
-
-/**
- * Gets a filter instance with name name from graph.
- *
- * @return the pointer to the found filter instance or NULL if it
- * cannot be found.
- */
-AVFilterContext *avfilter_graph_get_filter(AVFilterGraph *graph, char *name);
-
-/**
- * Adds an existing filter instance to a filter graph.
- *
- * @param graph  the filter graph
- * @param filter the filter to be added
- */
-int avfilter_graph_add_filter(AVFilterGraph *graphctx, AVFilterContext *filter);
-
-/**
- * Checks for the validity of graph.
- *
- * A graph is considered valid if all its input and output pads are
- * connected.
- *
- * @return 0 in case of success, a negative value otherwise
- */
-int avfilter_graph_check_validity(AVFilterGraph *graphctx, AVClass *log_ctx);
-
-/**
- * Configures all the links of graphctx.
- *
- * @return 0 in case of success, a negative value otherwise
- */
-int avfilter_graph_config_links(AVFilterGraph *graphctx, AVClass *log_ctx);
-
-/**
- * Configures the formats of all the links in the graph.
- */
-int avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx);
-
-/**
- * Frees a graph and destroys its links.
- */
-void avfilter_graph_destroy(AVFilterGraph *graph);
-
-#endif  /* AVFILTER_AVFILTERGRAPH_H */
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
deleted file mode 100644
index afa0f66..0000000
--- a/libavfilter/defaults.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Filter layer - default implementations
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/imgconvert.h"
-#include "avfilter.h"
-
-/* TODO: buffer pool.  see comment for avfilter_default_get_video_buffer() */
-static void avfilter_default_free_video_buffer(AVFilterPic *pic)
-{
-    av_free(pic->data[0]);
-    av_free(pic);
-}
-
-/* TODO: set the buffer's priv member to a context structure for the whole
- * filter chain.  This will allow for a buffer pool instead of the constant
- * alloc & free cycle currently implemented. */
-AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
-    AVFilterPic *pic = av_mallocz(sizeof(AVFilterPic));
-    AVFilterPicRef *ref = av_mallocz(sizeof(AVFilterPicRef));
-    int i, tempsize;
-    char *buf;
-
-    ref->pic   = pic;
-    ref->w     = pic->w = w;
-    ref->h     = pic->h = h;
-
-    /* make sure the buffer gets read permission or it's useless for output */
-    ref->perms = perms | AV_PERM_READ;
-
-    pic->refcount = 1;
-    pic->format   = link->format;
-    pic->free     = avfilter_default_free_video_buffer;
-    ff_fill_linesize((AVPicture *)pic, pic->format, ref->w);
-
-    for (i=0; i<4;i++)
-        pic->linesize[i] = FFALIGN(pic->linesize[i], 16);
-
-    tempsize = ff_fill_pointer((AVPicture *)pic, NULL, pic->format, ref->h);
-    buf = av_malloc(tempsize);
-    ff_fill_pointer((AVPicture *)pic, buf, pic->format, ref->h);
-
-    memcpy(ref->data,     pic->data,     sizeof(pic->data));
-    memcpy(ref->linesize, pic->linesize, sizeof(pic->linesize));
-
-    return ref;
-}
-
-void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    AVFilterLink *out = NULL;
-
-    if(link->dst->output_count)
-        out = link->dst->outputs[0];
-
-    if(out) {
-        out->outpic      = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h);
-        out->outpic->pts = picref->pts;
-        out->outpic->pos = picref->pos;
-        out->outpic->pixel_aspect = picref->pixel_aspect;
-        avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
-    }
-}
-
-void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    AVFilterLink *out = NULL;
-
-    if(link->dst->output_count)
-        out = link->dst->outputs[0];
-
-    if(out)
-        avfilter_draw_slice(out, y, h, slice_dir);
-}
-
-void avfilter_default_end_frame(AVFilterLink *link)
-{
-    AVFilterLink *out = NULL;
-
-    if(link->dst->output_count)
-        out = link->dst->outputs[0];
-
-    avfilter_unref_pic(link->cur_pic);
-    link->cur_pic = NULL;
-
-    if(out) {
-        if(out->outpic) {
-            avfilter_unref_pic(out->outpic);
-            out->outpic = NULL;
-        }
-        avfilter_end_frame(out);
-    }
-}
-
-/**
- * default config_link() implementation for output video links to simplify
- * the implementation of one input one output video filters */
-int avfilter_default_config_output_link(AVFilterLink *link)
-{
-    if(link->src->input_count && link->src->inputs[0]) {
-        link->w = link->src->inputs[0]->w;
-        link->h = link->src->inputs[0]->h;
-    } else {
-        /* XXX: any non-simple filter which would cause this branch to be taken
-         * really should implement its own config_props() for this link. */
-        return -1;
-    }
-
-    return 0;
-}
-
-/**
- * A helper for query_formats() which sets all links to the same list of
- * formats. If there are no links hooked to this filter, the list of formats is
- * freed.
- *
- * FIXME: this will need changed for filters with a mix of pad types
- * (video + audio, etc)
- */
-void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
-{
-    int count = 0, i;
-
-    for(i = 0; i < ctx->input_count; i ++) {
-        if(ctx->inputs[i]) {
-            avfilter_formats_ref(formats, &ctx->inputs[i]->out_formats);
-            count ++;
-        }
-    }
-    for(i = 0; i < ctx->output_count; i ++) {
-        if(ctx->outputs[i]) {
-            avfilter_formats_ref(formats, &ctx->outputs[i]->in_formats);
-            count ++;
-        }
-    }
-
-    if(!count) {
-        av_free(formats->formats);
-        av_free(formats->refs);
-        av_free(formats);
-    }
-}
-
-int avfilter_default_query_formats(AVFilterContext *ctx)
-{
-    avfilter_set_common_formats(ctx, avfilter_all_colorspaces());
-    return 0;
-}
-
-void avfilter_null_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
-}
-
-void avfilter_null_end_frame(AVFilterLink *link)
-{
-    avfilter_end_frame(link->dst->outputs[0]);
-}
-
-AVFilterPicRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
-    return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
deleted file mode 100644
index 2a9bdb0..0000000
--- a/libavfilter/formats.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Filter layer - format negotiation
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/pixdesc.h"
-#include "avfilter.h"
-
-/**
- * Add all refs from a to ret and destroy a.
- */
-static void merge_ref(AVFilterFormats *ret, AVFilterFormats *a)
-{
-    int i;
-
-    for(i = 0; i < a->refcount; i ++) {
-        ret->refs[ret->refcount] = a->refs[i];
-        *ret->refs[ret->refcount++] = ret;
-    }
-
-    av_free(a->refs);
-    av_free(a->formats);
-    av_free(a);
-}
-
-AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
-{
-    AVFilterFormats *ret;
-    unsigned i, j, k = 0;
-
-    ret = av_mallocz(sizeof(AVFilterFormats));
-
-    /* merge list of formats */
-    ret->formats = av_malloc(sizeof(*ret->formats) * FFMIN(a->format_count,
-                                                           b->format_count));
-    for(i = 0; i < a->format_count; i ++)
-        for(j = 0; j < b->format_count; j ++)
-            if(a->formats[i] == b->formats[j])
-                ret->formats[k++] = a->formats[i];
-
-    ret->format_count = k;
-    /* check that there was at least one common format */
-    if(!ret->format_count) {
-        av_free(ret->formats);
-        av_free(ret);
-        return NULL;
-    }
-
-    ret->refs = av_malloc(sizeof(AVFilterFormats**)*(a->refcount+b->refcount));
-
-    merge_ref(ret, a);
-    merge_ref(ret, b);
-
-    return ret;
-}
-
-AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts)
-{
-    AVFilterFormats *formats;
-    int count;
-
-    for (count = 0; pix_fmts[count] != PIX_FMT_NONE; count++)
-        ;
-
-    formats               = av_mallocz(sizeof(AVFilterFormats));
-    formats->formats      = av_malloc(sizeof(*formats->formats) * count);
-    formats->format_count = count;
-    memcpy(formats->formats, pix_fmts, sizeof(*formats->formats) * count);
-
-    return formats;
-}
-
-int avfilter_add_colorspace(AVFilterFormats **avff, enum PixelFormat pix_fmt)
-{
-    enum PixelFormat *pix_fmts;
-
-    if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))
-        return AVERROR(ENOMEM);
-
-    pix_fmts = av_realloc((*avff)->formats,
-                          sizeof((*avff)->formats) * ((*avff)->format_count+1));
-    if (!pix_fmts)
-        return AVERROR(ENOMEM);
-
-    (*avff)->formats = pix_fmts;
-    (*avff)->formats[(*avff)->format_count++] = pix_fmt;
-    return 0;
-}
-
-AVFilterFormats *avfilter_all_colorspaces(void)
-{
-    AVFilterFormats *ret = NULL;
-    enum PixelFormat pix_fmt;
-
-    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
-        if (!(av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL))
-            avfilter_add_colorspace(&ret, pix_fmt);
-
-    return ret;
-}
-
-void avfilter_formats_ref(AVFilterFormats *f, AVFilterFormats **ref)
-{
-    *ref = f;
-    f->refs = av_realloc(f->refs, sizeof(AVFilterFormats**) * ++f->refcount);
-    f->refs[f->refcount-1] = ref;
-}
-
-static int find_ref_index(AVFilterFormats **ref)
-{
-    int i;
-    for(i = 0; i < (*ref)->refcount; i ++)
-        if((*ref)->refs[i] == ref)
-            return i;
-    return -1;
-}
-
-void avfilter_formats_unref(AVFilterFormats **ref)
-{
-    int idx;
-
-    if (!*ref)
-        return;
-
-    idx = find_ref_index(ref);
-
-    if(idx >= 0)
-        memmove((*ref)->refs + idx, (*ref)->refs + idx+1,
-            sizeof(AVFilterFormats**) * ((*ref)->refcount-idx-1));
-
-    if(!--(*ref)->refcount) {
-        av_free((*ref)->formats);
-        av_free((*ref)->refs);
-        av_free(*ref);
-    }
-    *ref = NULL;
-}
-
-void avfilter_formats_changeref(AVFilterFormats **oldref,
-                                AVFilterFormats **newref)
-{
-    int idx = find_ref_index(oldref);
-
-    if(idx >= 0) {
-        (*oldref)->refs[idx] = newref;
-        *newref = *oldref;
-        *oldref = NULL;
-    }
-}
-
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
deleted file mode 100644
index c4a3bdf..0000000
--- a/libavfilter/graphparser.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * filter graph parser
- * copyright (c) 2008 Vitor Sessak
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <ctype.h>
-#include <string.h>
-
-#include "graphparser.h"
-#include "avfilter.h"
-#include "avfiltergraph.h"
-#include "parseutils.h"
-
-#define WHITESPACES " \n\t"
-
-static int link_filter(AVFilterContext *src, int srcpad,
-                       AVFilterContext *dst, int dstpad,
-                       AVClass *log_ctx)
-{
-    if(avfilter_link(src, srcpad, dst, dstpad)) {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "cannot create the link %s:%d -> %s:%d\n",
-               src->filter->name, srcpad, dst->filter->name, dstpad);
-        return -1;
-    }
-
-    return 0;
-}
-
-/**
- * Parse "[linkname]"
- * @param name a pointer (that need to be free'd after use) to the name between
- *        parenthesis
- */
-static char *parse_link_name(const char **buf, AVClass *log_ctx)
-{
-    const char *start = *buf;
-    char *name;
-    (*buf)++;
-
-    name = av_get_token(buf, "]");
-
-    if(!name[0]) {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "Bad (empty?) label found in the following: \"%s\".\n", start);
-        goto fail;
-    }
-
-    if(*(*buf)++ != ']') {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "Mismatched '[' found in the following: \"%s\".\n", start);
-    fail:
-        av_freep(&name);
-    }
-
-    return name;
-}
-
-static AVFilterContext *create_filter(AVFilterGraph *ctx, int index,
-                                      const char *filt_name, const char *args,
-                                      AVClass *log_ctx)
-{
-    AVFilterContext *filt_ctx;
-
-    AVFilter *filt;
-    char inst_name[30];
-
-    snprintf(inst_name, sizeof(inst_name), "Parsed filter %d", index);
-
-    filt = avfilter_get_by_name(filt_name);
-
-    if(!filt) {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "no such filter: '%s'\n", filt_name);
-        return NULL;
-    }
-
-    filt_ctx = avfilter_open(filt, inst_name);
-    if(!filt_ctx) {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "error creating filter '%s'\n", filt_name);
-        return NULL;
-    }
-
-    if(avfilter_graph_add_filter(ctx, filt_ctx) < 0) {
-        avfilter_destroy(filt_ctx);
-        return NULL;
-    }
-
-    if(avfilter_init_filter(filt_ctx, args, NULL)) {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "error initializing filter '%s' with args '%s'\n", filt_name, args);
-        return NULL;
-    }
-
-    return filt_ctx;
-}
-
-/**
- * Parse "filter=params"
- */
-static AVFilterContext *parse_filter(const char **buf, AVFilterGraph *graph,
-                                     int index, AVClass *log_ctx)
-{
-    char *opts = NULL;
-    char *name = av_get_token(buf, "=,;[\n");
-    AVFilterContext *ret;
-
-    if(**buf == '=') {
-        (*buf)++;
-        opts = av_get_token(buf, "[],;\n");
-    }
-
-    ret = create_filter(graph, index, name, opts, log_ctx);
-    av_free(name);
-    av_free(opts);
-    return ret;
-}
-
-static void free_inout(AVFilterInOut *head)
-{
-    while(head) {
-        AVFilterInOut *next = head->next;
-        av_free(head->name);
-        av_free(head);
-        head = next;
-    }
-}
-
-static AVFilterInOut *extract_inout(const char *label, AVFilterInOut **links)
-{
-    AVFilterInOut *ret;
-
-    while(*links && strcmp((*links)->name, label))
-        links = &((*links)->next);
-
-    ret = *links;
-
-    if(ret)
-        *links = ret->next;
-
-    return ret;
-}
-
-static void insert_inout(AVFilterInOut **inouts, AVFilterInOut *element)
-{
-    element->next = *inouts;
-    *inouts = element;
-}
-
-static int link_filter_inouts(AVFilterContext *filter,
-                              AVFilterInOut **curr_inputs,
-                              AVFilterInOut **open_inputs, AVClass *log_ctx)
-{
-    int pad = filter->input_count;
-
-    while(pad--) {
-        AVFilterInOut *p = *curr_inputs;
-        if(!p) {
-            av_log(log_ctx, AV_LOG_ERROR,
-                   "Not enough inputs specified for the \"%s\" filter.\n",
-                   filter->filter->name);
-            return -1;
-        }
-
-        *curr_inputs = (*curr_inputs)->next;
-
-        if(p->filter) {
-            if(link_filter(p->filter, p->pad_idx, filter, pad, log_ctx))
-                return -1;
-            av_free(p->name);
-            av_free(p);
-        } else {
-            p->filter = filter;
-            p->pad_idx = pad;
-            insert_inout(open_inputs, p);
-        }
-    }
-
-    if(*curr_inputs) {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "Too many inputs specified for the \"%s\" filter.\n",
-               filter->filter->name);
-        return -1;
-    }
-
-    pad = filter->output_count;
-    while(pad--) {
-        AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut));
-        currlinkn->filter  = filter;
-        currlinkn->pad_idx = pad;
-        insert_inout(curr_inputs, currlinkn);
-    }
-
-    return 0;
-}
-
-static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs,
-                        AVFilterInOut **open_outputs, AVClass *log_ctx)
-{
-    int pad = 0;
-
-    while(**buf == '[') {
-        char *name = parse_link_name(buf, log_ctx);
-        AVFilterInOut *match;
-
-        if(!name)
-            return -1;
-
-        /* First check if the label is not in the open_outputs list */
-        match = extract_inout(name, open_outputs);
-
-        if(match) {
-            av_free(name);
-        } else {
-            /* Not in the list, so add it as an input */
-            match = av_mallocz(sizeof(AVFilterInOut));
-            match->name    = name;
-            match->pad_idx = pad;
-        }
-
-        insert_inout(curr_inputs, match);
-
-        *buf += strspn(*buf, WHITESPACES);
-        pad++;
-    }
-
-    return pad;
-}
-
-static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs,
-                         AVFilterInOut **open_inputs,
-                         AVFilterInOut **open_outputs, AVClass *log_ctx)
-{
-    int pad = 0;
-
-    while(**buf == '[') {
-        char *name = parse_link_name(buf, log_ctx);
-        AVFilterInOut *match;
-
-        AVFilterInOut *input = *curr_inputs;
-        *curr_inputs = (*curr_inputs)->next;
-
-        if(!name)
-            return -1;
-
-        /* First check if the label is not in the open_inputs list */
-        match = extract_inout(name, open_inputs);
-
-        if(match) {
-            if(link_filter(input->filter, input->pad_idx,
-                           match->filter, match->pad_idx, log_ctx) < 0)
-                return -1;
-            av_free(match->name);
-            av_free(name);
-            av_free(match);
-            av_free(input);
-        } else {
-            /* Not in the list, so add the first input as a open_output */
-            input->name = name;
-            insert_inout(open_outputs, input);
-        }
-        *buf += strspn(*buf, WHITESPACES);
-        pad++;
-    }
-
-    return pad;
-}
-
-int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
-                         AVFilterInOut *open_inputs,
-                         AVFilterInOut *open_outputs, AVClass *log_ctx)
-{
-    int index = 0;
-    char chr = 0;
-
-    AVFilterInOut *curr_inputs = NULL;
-
-    do {
-        AVFilterContext *filter;
-        filters += strspn(filters, WHITESPACES);
-
-        if(parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx) < 0)
-            goto fail;
-
-        filter = parse_filter(&filters, graph, index, log_ctx);
-
-        if(!filter)
-            goto fail;
-
-        if(filter->input_count == 1 && !curr_inputs && !index) {
-            /* First input can be omitted if it is "[in]" */
-            const char *tmp = "[in]";
-            if(parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx) < 0)
-                goto fail;
-        }
-
-        if(link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx) < 0)
-            goto fail;
-
-        if(parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs,
-                         log_ctx) < 0)
-            goto fail;
-
-        filters += strspn(filters, WHITESPACES);
-        chr = *filters++;
-
-        if(chr == ';' && curr_inputs) {
-            av_log(log_ctx, AV_LOG_ERROR,
-                   "Could not find a output to link when parsing \"%s\"\n",
-                   filters - 1);
-            goto fail;
-        }
-        index++;
-    } while(chr == ',' || chr == ';');
-
-    if (chr) {
-        av_log(log_ctx, AV_LOG_ERROR,
-               "Unable to parse graph description substring: \"%s\"\n",
-               filters - 1);
-        goto fail;
-    }
-
-    if(open_inputs && !strcmp(open_inputs->name, "out") && curr_inputs) {
-        /* Last output can be omitted if it is "[out]" */
-        const char *tmp = "[out]";
-        if(parse_outputs(&tmp, &curr_inputs, &open_inputs,
-                         &open_outputs, log_ctx) < 0)
-            goto fail;
-    }
-
-    return 0;
-
- fail:
-    avfilter_graph_destroy(graph);
-    free_inout(open_inputs);
-    free_inout(open_outputs);
-    free_inout(curr_inputs);
-    return -1;
-}
diff --git a/libavfilter/graphparser.h b/libavfilter/graphparser.h
deleted file mode 100644
index e69f295..0000000
--- a/libavfilter/graphparser.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Filter graph parser
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFILTER_GRAPHPARSER_H
-#define AVFILTER_GRAPHPARSER_H
-
-#include "avfilter.h"
-#include "avfiltergraph.h"
-
-/**
- * A linked-list of the inputs/outputs of the filter chain.
- */
-typedef struct AVFilterInOut {
-    char *name;
-    AVFilterContext *filter;
-    int pad_idx;
-
-    struct AVFilterInOut *next;
-} AVFilterInOut;
-
-/**
- * Adds a graph described by a string to a graph.
- *
- * @param graph   the filter graph where to link the parsed graph context
- * @param filters string to be parsed
- * @param inputs  linked list to the inputs of the graph
- * @param outputs linked list to the outputs of the graph
- * @return        zero on success, -1 on error
- */
-int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
-                         AVFilterInOut *inputs, AVFilterInOut *outputs,
-                         AVClass *log_ctx);
-
-#endif  /* AVFILTER_GRAPHPARSER_H */
diff --git a/libavfilter/libavfilter.v b/libavfilter/libavfilter.v
deleted file mode 100644
index 83e8887..0000000
--- a/libavfilter/libavfilter.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBAVFILTER_$MAJOR {
-        global: avfilter_*; av_*;
-        local: *;
-};
diff --git a/libavfilter/parseutils.c b/libavfilter/parseutils.c
deleted file mode 100644
index 222ac73..0000000
--- a/libavfilter/parseutils.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * copyright (c) 2009 Stefano Sabatini
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * parsing utils
- */
-
-#include <strings.h>
-#include "libavutil/avutil.h"
-#include "libavutil/random_seed.h"
-#include "parseutils.h"
-
-#define WHITESPACES " \n\t"
-
-char *av_get_token(const char **buf, const char *term)
-{
-    char *out = av_malloc(strlen(*buf) + 1);
-    char *ret= out, *end= out;
-    const char *p = *buf;
-    p += strspn(p, WHITESPACES);
-
-    while(*p && !strspn(p, term)) {
-        char c = *p++;
-        if(c == '\\' && *p){
-            *out++ = *p++;
-            end= out;
-        }else if(c == '\''){
-            while(*p && *p != '\'')
-                *out++ = *p++;
-            if(*p){
-                p++;
-                end= out;
-            }
-        }else{
-            *out++ = c;
-        }
-    }
-
-    do{
-        *out-- = 0;
-    }while(out >= end && strspn(out, WHITESPACES));
-
-    *buf = p;
-
-    return ret;
-}
-
-typedef struct {
-    const char *name;            ///< a string representing the name of the color
-    uint8_t     rgba_color[4];   ///< RGBA values for the color
-} ColorEntry;
-
-static ColorEntry color_table[] = {
-    { "AliceBlue",            { 0xF0, 0xF8, 0xFF } },
-    { "AntiqueWhite",         { 0xFA, 0xEB, 0xD7 } },
-    { "Aqua",                 { 0x00, 0xFF, 0xFF } },
-    { "Aquamarine",           { 0x7F, 0xFF, 0xD4 } },
-    { "Azure",                { 0xF0, 0xFF, 0xFF } },
-    { "Beige",                { 0xF5, 0xF5, 0xDC } },
-    { "Bisque",               { 0xFF, 0xE4, 0xC4 } },
-    { "Black",                { 0x00, 0x00, 0x00 } },
-    { "BlanchedAlmond",       { 0xFF, 0xEB, 0xCD } },
-    { "Blue",                 { 0x00, 0x00, 0xFF } },
-    { "BlueViolet",           { 0x8A, 0x2B, 0xE2 } },
-    { "Brown",                { 0xA5, 0x2A, 0x2A } },
-    { "BurlyWood",            { 0xDE, 0xB8, 0x87 } },
-    { "CadetBlue",            { 0x5F, 0x9E, 0xA0 } },
-    { "Chartreuse",           { 0x7F, 0xFF, 0x00 } },
-    { "Chocolate",            { 0xD2, 0x69, 0x1E } },
-    { "Coral",                { 0xFF, 0x7F, 0x50 } },
-    { "CornflowerBlue",       { 0x64, 0x95, 0xED } },
-    { "Cornsilk",             { 0xFF, 0xF8, 0xDC } },
-    { "Crimson",              { 0xDC, 0x14, 0x3C } },
-    { "Cyan",                 { 0x00, 0xFF, 0xFF } },
-    { "DarkBlue",             { 0x00, 0x00, 0x8B } },
-    { "DarkCyan",             { 0x00, 0x8B, 0x8B } },
-    { "DarkGoldenRod",        { 0xB8, 0x86, 0x0B } },
-    { "DarkGray",             { 0xA9, 0xA9, 0xA9 } },
-    { "DarkGreen",            { 0x00, 0x64, 0x00 } },
-    { "DarkKhaki",            { 0xBD, 0xB7, 0x6B } },
-    { "DarkMagenta",          { 0x8B, 0x00, 0x8B } },
-    { "DarkOliveGreen",       { 0x55, 0x6B, 0x2F } },
-    { "Darkorange",           { 0xFF, 0x8C, 0x00 } },
-    { "DarkOrchid",           { 0x99, 0x32, 0xCC } },
-    { "DarkRed",              { 0x8B, 0x00, 0x00 } },
-    { "DarkSalmon",           { 0xE9, 0x96, 0x7A } },
-    { "DarkSeaGreen",         { 0x8F, 0xBC, 0x8F } },
-    { "DarkSlateBlue",        { 0x48, 0x3D, 0x8B } },
-    { "DarkSlateGray",        { 0x2F, 0x4F, 0x4F } },
-    { "DarkTurquoise",        { 0x00, 0xCE, 0xD1 } },
-    { "DarkViolet",           { 0x94, 0x00, 0xD3 } },
-    { "DeepPink",             { 0xFF, 0x14, 0x93 } },
-    { "DeepSkyBlue",          { 0x00, 0xBF, 0xFF } },
-    { "DimGray",              { 0x69, 0x69, 0x69 } },
-    { "DodgerBlue",           { 0x1E, 0x90, 0xFF } },
-    { "FireBrick",            { 0xB2, 0x22, 0x22 } },
-    { "FloralWhite",          { 0xFF, 0xFA, 0xF0 } },
-    { "ForestGreen",          { 0x22, 0x8B, 0x22 } },
-    { "Fuchsia",              { 0xFF, 0x00, 0xFF } },
-    { "Gainsboro",            { 0xDC, 0xDC, 0xDC } },
-    { "GhostWhite",           { 0xF8, 0xF8, 0xFF } },
-    { "Gold",                 { 0xFF, 0xD7, 0x00 } },
-    { "GoldenRod",            { 0xDA, 0xA5, 0x20 } },
-    { "Gray",                 { 0x80, 0x80, 0x80 } },
-    { "Green",                { 0x00, 0x80, 0x00 } },
-    { "GreenYellow",          { 0xAD, 0xFF, 0x2F } },
-    { "HoneyDew",             { 0xF0, 0xFF, 0xF0 } },
-    { "HotPink",              { 0xFF, 0x69, 0xB4 } },
-    { "IndianRed",            { 0xCD, 0x5C, 0x5C } },
-    { "Indigo",               { 0x4B, 0x00, 0x82 } },
-    { "Ivory",                { 0xFF, 0xFF, 0xF0 } },
-    { "Khaki",                { 0xF0, 0xE6, 0x8C } },
-    { "Lavender",             { 0xE6, 0xE6, 0xFA } },
-    { "LavenderBlush",        { 0xFF, 0xF0, 0xF5 } },
-    { "LawnGreen",            { 0x7C, 0xFC, 0x00 } },
-    { "LemonChiffon",         { 0xFF, 0xFA, 0xCD } },
-    { "LightBlue",            { 0xAD, 0xD8, 0xE6 } },
-    { "LightCoral",           { 0xF0, 0x80, 0x80 } },
-    { "LightCyan",            { 0xE0, 0xFF, 0xFF } },
-    { "LightGoldenRodYellow", { 0xFA, 0xFA, 0xD2 } },
-    { "LightGrey",            { 0xD3, 0xD3, 0xD3 } },
-    { "LightGreen",           { 0x90, 0xEE, 0x90 } },
-    { "LightPink",            { 0xFF, 0xB6, 0xC1 } },
-    { "LightSalmon",          { 0xFF, 0xA0, 0x7A } },
-    { "LightSeaGreen",        { 0x20, 0xB2, 0xAA } },
-    { "LightSkyBlue",         { 0x87, 0xCE, 0xFA } },
-    { "LightSlateGray",       { 0x77, 0x88, 0x99 } },
-    { "LightSteelBlue",       { 0xB0, 0xC4, 0xDE } },
-    { "LightYellow",          { 0xFF, 0xFF, 0xE0 } },
-    { "Lime",                 { 0x00, 0xFF, 0x00 } },
-    { "LimeGreen",            { 0x32, 0xCD, 0x32 } },
-    { "Linen",                { 0xFA, 0xF0, 0xE6 } },
-    { "Magenta",              { 0xFF, 0x00, 0xFF } },
-    { "Maroon",               { 0x80, 0x00, 0x00 } },
-    { "MediumAquaMarine",     { 0x66, 0xCD, 0xAA } },
-    { "MediumBlue",           { 0x00, 0x00, 0xCD } },
-    { "MediumOrchid",         { 0xBA, 0x55, 0xD3 } },
-    { "MediumPurple",         { 0x93, 0x70, 0xD8 } },
-    { "MediumSeaGreen",       { 0x3C, 0xB3, 0x71 } },
-    { "MediumSlateBlue",      { 0x7B, 0x68, 0xEE } },
-    { "MediumSpringGreen",    { 0x00, 0xFA, 0x9A } },
-    { "MediumTurquoise",      { 0x48, 0xD1, 0xCC } },
-    { "MediumVioletRed",      { 0xC7, 0x15, 0x85 } },
-    { "MidnightBlue",         { 0x19, 0x19, 0x70 } },
-    { "MintCream",            { 0xF5, 0xFF, 0xFA } },
-    { "MistyRose",            { 0xFF, 0xE4, 0xE1 } },
-    { "Moccasin",             { 0xFF, 0xE4, 0xB5 } },
-    { "NavajoWhite",          { 0xFF, 0xDE, 0xAD } },
-    { "Navy",                 { 0x00, 0x00, 0x80 } },
-    { "OldLace",              { 0xFD, 0xF5, 0xE6 } },
-    { "Olive",                { 0x80, 0x80, 0x00 } },
-    { "OliveDrab",            { 0x6B, 0x8E, 0x23 } },
-    { "Orange",               { 0xFF, 0xA5, 0x00 } },
-    { "OrangeRed",            { 0xFF, 0x45, 0x00 } },
-    { "Orchid",               { 0xDA, 0x70, 0xD6 } },
-    { "PaleGoldenRod",        { 0xEE, 0xE8, 0xAA } },
-    { "PaleGreen",            { 0x98, 0xFB, 0x98 } },
-    { "PaleTurquoise",        { 0xAF, 0xEE, 0xEE } },
-    { "PaleVioletRed",        { 0xD8, 0x70, 0x93 } },
-    { "PapayaWhip",           { 0xFF, 0xEF, 0xD5 } },
-    { "PeachPuff",            { 0xFF, 0xDA, 0xB9 } },
-    { "Peru",                 { 0xCD, 0x85, 0x3F } },
-    { "Pink",                 { 0xFF, 0xC0, 0xCB } },
-    { "Plum",                 { 0xDD, 0xA0, 0xDD } },
-    { "PowderBlue",           { 0xB0, 0xE0, 0xE6 } },
-    { "Purple",               { 0x80, 0x00, 0x80 } },
-    { "Red",                  { 0xFF, 0x00, 0x00 } },
-    { "RosyBrown",            { 0xBC, 0x8F, 0x8F } },
-    { "RoyalBlue",            { 0x41, 0x69, 0xE1 } },
-    { "SaddleBrown",          { 0x8B, 0x45, 0x13 } },
-    { "Salmon",               { 0xFA, 0x80, 0x72 } },
-    { "SandyBrown",           { 0xF4, 0xA4, 0x60 } },
-    { "SeaGreen",             { 0x2E, 0x8B, 0x57 } },
-    { "SeaShell",             { 0xFF, 0xF5, 0xEE } },
-    { "Sienna",               { 0xA0, 0x52, 0x2D } },
-    { "Silver",               { 0xC0, 0xC0, 0xC0 } },
-    { "SkyBlue",              { 0x87, 0xCE, 0xEB } },
-    { "SlateBlue",            { 0x6A, 0x5A, 0xCD } },
-    { "SlateGray",            { 0x70, 0x80, 0x90 } },
-    { "Snow",                 { 0xFF, 0xFA, 0xFA } },
-    { "SpringGreen",          { 0x00, 0xFF, 0x7F } },
-    { "SteelBlue",            { 0x46, 0x82, 0xB4 } },
-    { "Tan",                  { 0xD2, 0xB4, 0x8C } },
-    { "Teal",                 { 0x00, 0x80, 0x80 } },
-    { "Thistle",              { 0xD8, 0xBF, 0xD8 } },
-    { "Tomato",               { 0xFF, 0x63, 0x47 } },
-    { "Turquoise",            { 0x40, 0xE0, 0xD0 } },
-    { "Violet",               { 0xEE, 0x82, 0xEE } },
-    { "Wheat",                { 0xF5, 0xDE, 0xB3 } },
-    { "White",                { 0xFF, 0xFF, 0xFF } },
-    { "WhiteSmoke",           { 0xF5, 0xF5, 0xF5 } },
-    { "Yellow",               { 0xFF, 0xFF, 0x00 } },
-    { "YellowGreen",          { 0x9A, 0xCD, 0x32 } },
-};
-
-static int color_table_compare(const void *lhs, const void *rhs)
-{
-    return strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
-}
-
-int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
-{
-    if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) {
-        int rgba = ff_random_get_seed();
-        rgba_color[0] = rgba >> 24;
-        rgba_color[1] = rgba >> 16;
-        rgba_color[2] = rgba >> 8;
-        rgba_color[3] = rgba;
-    } else
-    if (!strncmp(color_string, "0x", 2)) {
-        char *tail;
-        int len = strlen(color_string);
-        unsigned int rgba = strtoul(color_string, &tail, 16);
-
-        if (*tail || (len != 8 && len != 10)) {
-            av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string);
-            return -1;
-        }
-        if (len == 10) {
-            rgba_color[3] = rgba;
-            rgba >>= 8;
-        }
-        rgba_color[0] = rgba >> 16;
-        rgba_color[1] = rgba >> 8;
-        rgba_color[2] = rgba;
-    } else {
-        const ColorEntry *entry = bsearch(color_string,
-                                          color_table,
-                                          FF_ARRAY_ELEMS(color_table),
-                                          sizeof(ColorEntry),
-                                          color_table_compare);
-        if (!entry) {
-            av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string);
-            return -1;
-        }
-        memcpy(rgba_color, entry->rgba_color, 4);
-    }
-
-    return 0;
-}
-
-/**
- * Stores the value in the field in ctx that is named like key.
- * ctx must be an AVClass context, storing is done using AVOptions.
- *
- * @param buf the string to parse, buf will be updated to point at the
- * separator just after the parsed key/value pair
- * @param key_val_sep a 0-terminated list of characters used to
- * separate key from value
- * @param pairs_sep a 0-terminated list of characters used to separate
- * two pairs from each other
- * @return 0 if the key/value pair has been successfully parsed and
- * set, or a negative value corresponding to an AVERROR code in case
- * of error:
- * AVERROR(EINVAL) if the key/value pair cannot be parsed,
- * the error code issued by av_set_string3() if the key/value pair
- * cannot be set
- */
-static int parse_key_value_pair(void *ctx, const char **buf,
-                                const char *key_val_sep, const char *pairs_sep)
-{
-    char *key = av_get_token(buf, key_val_sep);
-    char *val;
-    int ret;
-
-    if (*key && strspn(*buf, key_val_sep)) {
-        (*buf)++;
-        val = av_get_token(buf, pairs_sep);
-    } else {
-        av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key);
-        av_free(key);
-        return AVERROR(EINVAL);
-    }
-
-    av_log(ctx, AV_LOG_DEBUG, "Setting value '%s' for key '%s'\n", val, key);
-
-    ret = av_set_string3(ctx, key, val, 1, NULL);
-    if (ret == AVERROR(ENOENT))
-        av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key);
-
-    av_free(key);
-    av_free(val);
-    return ret;
-}
-
-int av_set_options_string(void *ctx, const char *opts,
-                          const char *key_val_sep, const char *pairs_sep)
-{
-    int ret, count = 0;
-
-    while (*opts) {
-        if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0)
-            return ret;
-        count++;
-
-        if (*opts)
-            opts++;
-    }
-
-    return count;
-}
-
-#ifdef TEST
-
-#undef printf
-
-typedef struct TestContext
-{
-    const AVClass *class;
-    int num;
-    int toggle;
-    char *string;
-    int flags;
-    AVRational rational;
-} TestContext;
-
-#define OFFSET(x) offsetof(TestContext, x)
-
-#define TEST_FLAG_COOL 01
-#define TEST_FLAG_LAME 02
-#define TEST_FLAG_MU   04
-
-static const AVOption test_options[]= {
-{"num",      "set num",        OFFSET(num),      FF_OPT_TYPE_INT,      0,              0,        100                 },
-{"toggle",   "set toggle",     OFFSET(toggle),   FF_OPT_TYPE_INT,      0,              0,        1                   },
-{"rational", "set rational",   OFFSET(rational), FF_OPT_TYPE_RATIONAL, 0,              0,        10                  },
-{"string",   "set string",     OFFSET(string),   FF_OPT_TYPE_STRING,   0,              CHAR_MIN, CHAR_MAX            },
-{"flags",    "set flags",      OFFSET(flags),    FF_OPT_TYPE_FLAGS,    0,              0,        INT_MAX, 0, "flags" },
-{"cool",     "set cool flag ", 0,                FF_OPT_TYPE_CONST,    TEST_FLAG_COOL, INT_MIN,  INT_MAX, 0, "flags" },
-{"lame",     "set lame flag ", 0,                FF_OPT_TYPE_CONST,    TEST_FLAG_LAME, INT_MIN,  INT_MAX, 0, "flags" },
-{"mu",       "set mu flag ",   0,                FF_OPT_TYPE_CONST,    TEST_FLAG_MU,   INT_MIN,  INT_MAX, 0, "flags" },
-{NULL},
-};
-
-static const char *test_get_name(void *ctx)
-{
-    return "test";
-}
-
-static const AVClass test_class = {
-    "TestContext",
-    test_get_name,
-    test_options
-};
-
-int main(void)
-{
-    int i;
-
-    const char *strings[] = {
-        "''",
-        "",
-        ":",
-        "\\",
-        "'",
-        "    ''    :",
-        "    ''  ''  :",
-        "foo   '' :",
-        "'foo'",
-        "foo     ",
-        "foo\\",
-        "foo':  blah:blah",
-        "foo\\:  blah:blah",
-        "foo\'",
-        "'foo :  '  :blahblah",
-        "\\ :blah",
-        "     foo",
-        "      foo       ",
-        "      foo     \\ ",
-        "foo ':blah",
-        " foo   bar    :   blahblah",
-        "\\f\\o\\o",
-        "'foo : \\ \\  '   : blahblah",
-        "'\\fo\\o:': blahblah",
-        "\\'fo\\o\\:':  foo  '  :blahblah"
-    };
-
-    for (i=0; i < FF_ARRAY_ELEMS(strings); i++) {
-        const char *p= strings[i];
-        printf("|%s|", p);
-        printf(" -> |%s|", av_get_token(&p, ":"));
-        printf(" + |%s|\n", p);
-    }
-
-    printf("\nTesting av_parse_color()\n");
-    {
-        uint8_t rgba[4];
-        const char *color_names[] = {
-            "bikeshed",
-            "RaNdOm",
-            "foo",
-            "red",
-            "Red ",
-            "RED",
-            "Violet",
-            "Yellow",
-            "Red",
-            "0x000000",
-            "0x0000000",
-            "0xff000000",
-            "0x3e34ff",
-            "0x3e34ffaa",
-            "0xffXXee",
-            "0xfoobar",
-            "0xffffeeeeeeee",
-        };
-
-        av_log_set_level(AV_LOG_DEBUG);
-
-        for (int i = 0;  i < FF_ARRAY_ELEMS(color_names); i++) {
-            if (av_parse_color(rgba, color_names[i], NULL) >= 0)
-                printf("%s -> R(%d) G(%d) B(%d) A(%d)\n", color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
-        }
-    }
-
-    printf("\nTesting av_set_options_string()\n");
-    {
-        TestContext test_ctx;
-        const char *options[] = {
-            "",
-            ":",
-            "=",
-            "foo=:",
-            ":=foo",
-            "=foo",
-            "foo=",
-            "foo",
-            "foo=val",
-            "foo==val",
-            "toggle=:",
-            "string=:",
-            "toggle=1 : foo",
-            "toggle=100",
-            "toggle==1",
-            "flags=+mu-lame : num=42: toggle=0",
-            "num=42 : string=blahblah",
-            "rational=0 : rational=1/2 : rational=1/-1",
-            "rational=-1/0",
-        };
-
-        test_ctx.class = &test_class;
-        av_opt_set_defaults2(&test_ctx, 0, 0);
-        test_ctx.string = av_strdup("default");
-
-        av_log_set_level(AV_LOG_DEBUG);
-
-        for (i=0; i < FF_ARRAY_ELEMS(options); i++) {
-            av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]);
-            if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0)
-                av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]);
-            printf("\n");
-        }
-    }
-
-    return 0;
-}
-
-#endif
diff --git a/libavfilter/parseutils.h b/libavfilter/parseutils.h
deleted file mode 100644
index b5b494e..0000000
--- a/libavfilter/parseutils.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * copyright (c) 2009 Stefano Sabatini
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * parsing utils
- */
-
-#ifndef AVFILTER_PARSEUTILS_H
-#define AVFILTER_PARSEUTILS_H
-
-#include "libavcodec/opt.h"
-
-/**
- * Unescapes the given string until a non escaped terminating char,
- * and returns the token corresponding to the unescaped string.
- *
- * The normal \ and ' escaping is supported. Leading and trailing
- * whitespaces are removed.
- *
- * @param term a 0-terminated list of terminating chars
- * @param buf the buffer to parse, buf will be updated to point to the
- * terminating char
- * @return the malloced unescaped string, which must be av_freed by
- * the user
- */
-char *av_get_token(const char **buf, const char *term);
-
-/**
- * Puts the RGBA values that correspond to color_string in rgba_color.
- *
- * @param color_string a string specifying a color. It can be the name of
- * a color (case insensitive match) or a 0xRRGGBB[AA] sequence.
- * The string "random" will result in a random color.
- * @return >= 0 in case of success, a negative value in case of
- * failure (for example if color_string cannot be parsed).
- */
-int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx);
-
-/**
- * Parses the key/value pairs list in opts. For each key/value pair
- * found, stores the value in the field in ctx that is named like the
- * key. ctx must be an AVClass context, storing is done using
- * AVOptions.
- *
- * @param key_val_sep a 0-terminated list of characters used to
- * separate key from value
- * @param pairs_sep a 0-terminated list of characters used to separate
- * two pairs from each other
- * @return the number of successfully set key/value pairs, or a negative
- * value corresponding to an AVERROR code in case of error:
- * AVERROR(EINVAL) if opts cannot be parsed,
- * the error code issued by av_set_string3() if a key/value pair
- * cannot be set
- */
-int av_set_options_string(void *ctx, const char *opts,
-                          const char *key_val_sep, const char *pairs_sep);
-
-#endif  /* AVFILTER_PARSEUTILS_H */
diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c
deleted file mode 100644
index 2627722..0000000
--- a/libavfilter/vf_aspect.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Aspect ratio modification video filter
- * Copyright (c) 2010 Bobby Bingham
-
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * aspect ratio modification video filter
- */
-
-#include "avfilter.h"
-
-typedef struct {
-    AVRational aspect;
-} AspectContext;
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    AspectContext *aspect = ctx->priv;
-    double  ratio;
-    int64_t gcd;
-
-    if(args) {
-        if(sscanf(args, "%d:%d", &aspect->aspect.num, &aspect->aspect.den) < 2) {
-            if(sscanf(args, "%lf", &ratio) < 1)
-                return -1;
-            aspect->aspect = av_d2q(ratio, 100);
-        } else {
-            gcd = av_gcd(FFABS(aspect->aspect.num), FFABS(aspect->aspect.den));
-            if(gcd) {
-                aspect->aspect.num /= gcd;
-                aspect->aspect.den /= gcd;
-            }
-        }
-    }
-
-    if(aspect->aspect.den == 0)
-        aspect->aspect = (AVRational) {0, 1};
-
-    return 0;
-}
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    AspectContext *aspect = link->dst->priv;
-
-    picref->pixel_aspect = aspect->aspect;
-    avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-#if CONFIG_ASPECT_FILTER
-/* for aspect filter, convert from frame aspect ratio to pixel aspect ratio */
-static int frameaspect_config_props(AVFilterLink *inlink)
-{
-    AspectContext *aspect = inlink->dst->priv;
-
-    av_reduce(&aspect->aspect.num, &aspect->aspect.den,
-               aspect->aspect.num * inlink->h,
-               aspect->aspect.den * inlink->w, 100);
-
-    return 0;
-}
-
-AVFilter avfilter_vf_aspect = {
-    .name      = "aspect",
-    .description = NULL_IF_CONFIG_SMALL("Set the frame aspect ratio."),
-
-    .init      = init,
-
-    .priv_size = sizeof(AspectContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .config_props     = frameaspect_config_props,
-                                    .get_video_buffer = avfilter_null_get_video_buffer,
-                                    .start_frame      = start_frame,
-                                    .end_frame        = avfilter_null_end_frame },
-                                  { .name = NULL}},
-
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO, },
-                                  { .name = NULL}},
-};
-#endif /* CONFIG_ASPECT_FILTER */
-
-#if CONFIG_PIXELASPECT_FILTER
-AVFilter avfilter_vf_pixelaspect = {
-    .name      = "pixelaspect",
-    .description = NULL_IF_CONFIG_SMALL("Set the pixel aspect ratio."),
-
-    .init      = init,
-
-    .priv_size = sizeof(AspectContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .get_video_buffer = avfilter_null_get_video_buffer,
-                                    .start_frame      = start_frame,
-                                    .end_frame        = avfilter_null_end_frame },
-                                  { .name = NULL}},
-
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO, },
-                                  { .name = NULL}},
-};
-#endif /* CONFIG_PIXELASPECT_FILTER */
-
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
deleted file mode 100644
index 204adcf..0000000
--- a/libavfilter/vf_crop.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * video crop filter
- */
-
-#include "avfilter.h"
-#include "libavutil/pixdesc.h"
-
-typedef struct {
-    int  x;             ///< x offset of the non-cropped area with respect to the input area
-    int  y;             ///< y offset of the non-cropped area with respect to the input area
-    int  w;             ///< width of the cropped area
-    int  h;             ///< height of the cropped area
-
-    int bpp;            ///< bits per pixel
-    int hsub, vsub;     ///< chroma subsampling
-} CropContext;
-
-static int query_formats(AVFilterContext *ctx)
-{
-    static const enum PixelFormat pix_fmts[] = {
-        PIX_FMT_RGB48BE,      PIX_FMT_RGB48LE,
-        PIX_FMT_ARGB,         PIX_FMT_RGBA,
-        PIX_FMT_ABGR,         PIX_FMT_BGRA,
-        PIX_FMT_RGB24,        PIX_FMT_BGR24,
-        PIX_FMT_RGB565BE,     PIX_FMT_RGB565LE,
-        PIX_FMT_RGB555BE,     PIX_FMT_RGB555LE,
-        PIX_FMT_BGR565BE,     PIX_FMT_BGR565LE,
-        PIX_FMT_BGR555BE,     PIX_FMT_BGR555LE,
-        PIX_FMT_GRAY16BE,     PIX_FMT_GRAY16LE,
-        PIX_FMT_YUV420P16LE,  PIX_FMT_YUV420P16BE,
-        PIX_FMT_YUV422P16LE,  PIX_FMT_YUV422P16BE,
-        PIX_FMT_YUV444P16LE,  PIX_FMT_YUV444P16BE,
-        PIX_FMT_YUV444P,      PIX_FMT_YUV422P,
-        PIX_FMT_YUV420P,      PIX_FMT_YUV411P,
-        PIX_FMT_YUV410P,      PIX_FMT_YUV440P,
-        PIX_FMT_YUVJ444P,     PIX_FMT_YUVJ422P,
-        PIX_FMT_YUVJ420P,     PIX_FMT_YUVJ440P,
-        PIX_FMT_YUVA420P,
-        PIX_FMT_RGB8,         PIX_FMT_BGR8,
-        PIX_FMT_RGB4_BYTE,    PIX_FMT_BGR4_BYTE,
-        PIX_FMT_PAL8,         PIX_FMT_GRAY8,
-        PIX_FMT_NONE
-    };
-
-    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
-
-    return 0;
-}
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    CropContext *crop = ctx->priv;
-
-    if (args)
-        sscanf(args, "%d:%d:%d:%d", &crop->x, &crop->y, &crop->w, &crop->h);
-
-    return 0;
-}
-
-static int config_input(AVFilterLink *link)
-{
-    AVFilterContext *ctx = link->dst;
-    CropContext *crop = ctx->priv;
-
-    switch (link->format) {
-    case PIX_FMT_RGB48BE:
-    case PIX_FMT_RGB48LE:
-        crop->bpp = 48;
-        break;
-    case PIX_FMT_ARGB:
-    case PIX_FMT_RGBA:
-    case PIX_FMT_ABGR:
-    case PIX_FMT_BGRA:
-        crop->bpp = 32;
-        break;
-    case PIX_FMT_RGB24:
-    case PIX_FMT_BGR24:
-        crop->bpp = 24;
-        break;
-    case PIX_FMT_RGB565BE:
-    case PIX_FMT_RGB565LE:
-    case PIX_FMT_RGB555BE:
-    case PIX_FMT_RGB555LE:
-    case PIX_FMT_BGR565BE:
-    case PIX_FMT_BGR565LE:
-    case PIX_FMT_BGR555BE:
-    case PIX_FMT_BGR555LE:
-    case PIX_FMT_GRAY16BE:
-    case PIX_FMT_GRAY16LE:
-    case PIX_FMT_YUV420P16LE:
-    case PIX_FMT_YUV420P16BE:
-    case PIX_FMT_YUV422P16LE:
-    case PIX_FMT_YUV422P16BE:
-    case PIX_FMT_YUV444P16LE:
-    case PIX_FMT_YUV444P16BE:
-        crop->bpp = 16;
-        break;
-    default:
-        crop->bpp = 8;
-    }
-
-    avcodec_get_chroma_sub_sample(link->format, &crop->hsub, &crop->vsub);
-
-    if (crop->w == 0)
-        crop->w = link->w - crop->x;
-    if (crop->h == 0)
-        crop->h = link->h - crop->y;
-
-    crop->x &= ~((1 << crop->hsub) - 1);
-    crop->y &= ~((1 << crop->vsub) - 1);
-
-    av_log(link->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d\n",
-           crop->x, crop->y, crop->w, crop->h);
-
-    if (crop->x <  0 || crop->y <  0                    ||
-        crop->w <= 0 || crop->h <= 0                    ||
-        (unsigned)crop->x + (unsigned)crop->w > link->w ||
-        (unsigned)crop->y + (unsigned)crop->h > link->h) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Output area %d:%d:%d:%d not within the input area 0:0:%d:%d or zero-sized\n",
-               crop->x, crop->y, crop->w, crop->h, link->w, link->h);
-        return -1;
-    }
-
-    return 0;
-}
-
-static int config_output(AVFilterLink *link)
-{
-    CropContext *crop = link->src->priv;
-
-    link->w = crop->w;
-    link->h = crop->h;
-
-    return 0;
-}
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    CropContext *crop = link->dst->priv;
-    AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0);
-    int i;
-
-    ref2->w        = crop->w;
-    ref2->h        = crop->h;
-
-    ref2->data[0] += crop->y * ref2->linesize[0];
-    ref2->data[0] += (crop->x * crop->bpp) >> 3;
-
-    if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) {
-        for (i = 1; i < 3; i ++) {
-            if (ref2->data[i]) {
-                ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];
-                ref2->data[i] += ((crop->x * crop->bpp) >> 3) >> crop->hsub;
-            }
-        }
-    }
-
-    /* alpha plane */
-    if (ref2->data[3]) {
-        ref2->data[3] += crop->y * ref2->linesize[3];
-        ref2->data[3] += (crop->x * crop->bpp) >> 3;
-    }
-
-    avfilter_start_frame(link->dst->outputs[0], ref2);
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    AVFilterContext *ctx = link->dst;
-    CropContext *crop = ctx->priv;
-
-    if (y >= crop->y + crop->h || y + h <= crop->y)
-        return;
-
-    if (y < crop->y) {
-        h -= crop->y - y;
-        y  = crop->y;
-    }
-    if (y + h > crop->y + crop->h)
-        h = crop->y + crop->h - y;
-
-    avfilter_draw_slice(ctx->outputs[0], y - crop->y, h, slice_dir);
-}
-
-AVFilter avfilter_vf_crop = {
-    .name      = "crop",
-    .description = NULL_IF_CONFIG_SMALL("Crop the input video to x:y:width:height."),
-
-    .priv_size = sizeof(CropContext),
-
-    .query_formats = query_formats,
-    .init          = init,
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .start_frame      = start_frame,
-                                    .draw_slice       = draw_slice,
-                                    .get_video_buffer = avfilter_null_get_video_buffer,
-                                    .config_props     = config_input, },
-                                  { .name = NULL}},
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .config_props     = config_output, },
-                                  { .name = NULL}},
-};
diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c
deleted file mode 100644
index 36b7d33..0000000
--- a/libavfilter/vf_format.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * format and noformat video filters
- */
-
-#include "libavutil/pixdesc.h"
-#include "avfilter.h"
-
-typedef struct {
-    /**
-     * List of flags telling if a given image format has been listed
-     * as argument to the filter.
-     */
-    int listed_pix_fmt_flags[PIX_FMT_NB];
-} FormatContext;
-
-#define PIX_FMT_NAME_MAXSIZE 32
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    FormatContext *format = ctx->priv;
-    const char *cur, *sep;
-    char             pix_fmt_name[PIX_FMT_NAME_MAXSIZE];
-    int              pix_fmt_name_len;
-    enum PixelFormat pix_fmt;
-
-    /* parse the list of formats */
-    for (cur = args; cur; cur = sep ? sep+1 : NULL) {
-        if (!(sep = strchr(cur, ':')))
-            pix_fmt_name_len = strlen(cur);
-        else
-            pix_fmt_name_len = sep - cur;
-        if (pix_fmt_name_len >= PIX_FMT_NAME_MAXSIZE) {
-            av_log(ctx, AV_LOG_ERROR, "Format name too long\n");
-            return -1;
-        }
-
-        memcpy(pix_fmt_name, cur, pix_fmt_name_len);
-        pix_fmt_name[pix_fmt_name_len] = 0;
-        pix_fmt = av_get_pix_fmt(pix_fmt_name);
-
-        if (pix_fmt == PIX_FMT_NONE) {
-            av_log(ctx, AV_LOG_ERROR, "Unknown pixel format: %s\n", pix_fmt_name);
-            return -1;
-        }
-
-        format->listed_pix_fmt_flags[pix_fmt] = 1;
-    }
-
-    return 0;
-}
-
-static AVFilterFormats *make_format_list(FormatContext *format, int flag)
-{
-    AVFilterFormats *formats;
-    enum PixelFormat pix_fmt;
-
-    formats = av_mallocz(sizeof(AVFilterFormats));
-    formats->formats = av_malloc(sizeof(enum PixelFormat) * PIX_FMT_NB);
-
-    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
-        if (format->listed_pix_fmt_flags[pix_fmt] == flag)
-            formats->formats[formats->format_count++] = pix_fmt;
-
-    return formats;
-}
-
-#if CONFIG_FORMAT_FILTER
-static int query_formats_format(AVFilterContext *ctx)
-{
-    avfilter_set_common_formats(ctx, make_format_list(ctx->priv, 1));
-    return 0;
-}
-
-AVFilter avfilter_vf_format = {
-    .name      = "format",
-    .description = "Convert the input video to one of the specified pixel formats.",
-
-    .init      = init,
-
-    .query_formats = query_formats_format,
-
-    .priv_size = sizeof(FormatContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name            = "default",
-                                    .type            = AVMEDIA_TYPE_VIDEO,
-                                    .get_video_buffer= avfilter_null_get_video_buffer,
-                                    .start_frame     = avfilter_null_start_frame,
-                                    .draw_slice      = avfilter_null_draw_slice,
-                                    .end_frame       = avfilter_null_end_frame, },
-                                  { .name = NULL}},
-    .outputs   = (AVFilterPad[]) {{ .name            = "default",
-                                    .type            = AVMEDIA_TYPE_VIDEO },
-                                  { .name = NULL}},
-};
-#endif /* CONFIG_FORMAT_FILTER */
-
-#if CONFIG_NOFORMAT_FILTER
-static int query_formats_noformat(AVFilterContext *ctx)
-{
-    avfilter_set_common_formats(ctx, make_format_list(ctx->priv, 0));
-    return 0;
-}
-
-AVFilter avfilter_vf_noformat = {
-    .name      = "noformat",
-    .description = "Force libavfilter not to use any of the specified pixel formats for the input to the next filter.",
-
-    .init      = init,
-
-    .query_formats = query_formats_noformat,
-
-    .priv_size = sizeof(FormatContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name            = "default",
-                                    .type            = AVMEDIA_TYPE_VIDEO,
-                                    .get_video_buffer= avfilter_null_get_video_buffer,
-                                    .start_frame     = avfilter_null_start_frame,
-                                    .draw_slice      = avfilter_null_draw_slice,
-                                    .end_frame       = avfilter_null_end_frame, },
-                                  { .name = NULL}},
-    .outputs   = (AVFilterPad[]) {{ .name            = "default",
-                                    .type            = AVMEDIA_TYPE_VIDEO },
-                                  { .name = NULL}},
-};
-#endif /* CONFIG_NOFORMAT_FILTER */
-
diff --git a/libavfilter/vf_null.c b/libavfilter/vf_null.c
deleted file mode 100644
index 989cd86..0000000
--- a/libavfilter/vf_null.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * null video filter
- */
-
-#include "avfilter.h"
-
-AVFilter avfilter_vf_null = {
-    .name      = "null",
-    .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."),
-
-    .priv_size = 0,
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .get_video_buffer = avfilter_null_get_video_buffer,
-                                    .start_frame      = avfilter_null_start_frame,
-                                    .end_frame        = avfilter_null_end_frame },
-                                  { .name = NULL}},
-
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO, },
-                                  { .name = NULL}},
-};
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
deleted file mode 100644
index a6b50ac..0000000
--- a/libavfilter/vf_scale.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * scale video filter
- */
-
-#include "avfilter.h"
-#include "libavutil/pixdesc.h"
-#include "libswscale/swscale.h"
-
-typedef struct {
-    struct SwsContext *sws;     ///< software scaler context
-
-    /**
-     * New dimensions. Special values are:
-     *   0 = original width/height
-     *  -1 = keep original aspect
-     */
-    int w, h;
-
-    int hsub, vsub;             ///< chroma subsampling
-    int slice_y;                ///< top of current output slice
-    int input_is_pal;           ///< set to 1 if the input format is paletted
-} ScaleContext;
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    ScaleContext *scale = ctx->priv;
-
-    if (args)
-        sscanf(args, "%d:%d", &scale->w, &scale->h);
-
-    /* sanity check params */
-    if (scale->w <  -1 || scale->h <  -1) {
-        av_log(ctx, AV_LOG_ERROR, "Size values less than -1 are not acceptable.\n");
-        return -1;
-    }
-    if (scale->w == -1 && scale->h == -1)
-        scale->w = scale->h = 0;
-
-    return 0;
-}
-
-static av_cold void uninit(AVFilterContext *ctx)
-{
-    ScaleContext *scale = ctx->priv;
-    sws_freeContext(scale->sws);
-    scale->sws = NULL;
-}
-
-static int query_formats(AVFilterContext *ctx)
-{
-    AVFilterFormats *formats;
-    enum PixelFormat pix_fmt;
-    int ret;
-
-    if (ctx->inputs[0]) {
-        formats = NULL;
-        for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
-            if (   sws_isSupportedInput(pix_fmt)
-                && (ret = avfilter_add_colorspace(&formats, pix_fmt)) < 0) {
-                avfilter_formats_unref(&formats);
-                return ret;
-            }
-        avfilter_formats_ref(formats, &ctx->inputs[0]->out_formats);
-    }
-    if (ctx->outputs[0]) {
-        formats = NULL;
-        for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
-            if (    sws_isSupportedOutput(pix_fmt)
-                && (ret = avfilter_add_colorspace(&formats, pix_fmt)) < 0) {
-                avfilter_formats_unref(&formats);
-                return ret;
-            }
-        avfilter_formats_ref(formats, &ctx->outputs[0]->in_formats);
-    }
-
-    return 0;
-}
-
-static int config_props(AVFilterLink *outlink)
-{
-    AVFilterContext *ctx = outlink->src;
-    AVFilterLink *inlink = outlink->src->inputs[0];
-    ScaleContext *scale = ctx->priv;
-    int64_t w, h;
-
-    if (!(w = scale->w))
-        w = inlink->w;
-    if (!(h = scale->h))
-        h = inlink->h;
-    if (w == -1)
-        w = av_rescale(h, inlink->w, inlink->h);
-    if (h == -1)
-        h = av_rescale(w, inlink->h, inlink->w);
-
-    if (w > INT_MAX || h > INT_MAX ||
-        (h * inlink->w) > INT_MAX  ||
-        (w * inlink->h) > INT_MAX)
-        av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n");
-
-    outlink->w = w;
-    outlink->h = h;
-
-    /* TODO: make algorithm configurable */
-    scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
-                                outlink->w, outlink->h, outlink->format,
-                                SWS_BILINEAR, NULL, NULL, NULL);
-
-    av_log(ctx, AV_LOG_INFO, "w:%d h:%d fmt:%s\n",
-           outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name);
-
-    scale->input_is_pal = av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL;
-
-    return !scale->sws;
-}
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    ScaleContext *scale = link->dst->priv;
-    AVFilterLink *outlink = link->dst->outputs[0];
-    AVFilterPicRef *outpicref;
-
-    scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w;
-    scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
-
-    outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
-    outpicref->pts = picref->pts;
-    outpicref->pos = picref->pos;
-    outlink->outpic = outpicref;
-
-    av_reduce(&outpicref->pixel_aspect.num, &outpicref->pixel_aspect.den,
-              (int64_t)picref->pixel_aspect.num * outlink->h * link->w,
-              (int64_t)picref->pixel_aspect.den * outlink->w * link->h,
-              INT_MAX);
-
-    scale->slice_y = 0;
-    avfilter_start_frame(outlink, avfilter_ref_pic(outpicref, ~0));
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    ScaleContext *scale = link->dst->priv;
-    int out_h;
-    AVFilterPicRef *cur_pic = link->cur_pic;
-    uint8_t *data[4];
-
-    if (scale->slice_y == 0 && slice_dir == -1)
-        scale->slice_y = link->dst->outputs[0]->h;
-
-    data[0] = cur_pic->data[0] +  y               * cur_pic->linesize[0];
-    data[1] = scale->input_is_pal ?
-              cur_pic->data[1] :
-              cur_pic->data[1] + (y>>scale->vsub) * cur_pic->linesize[1];
-    data[2] = cur_pic->data[2] + (y>>scale->vsub) * cur_pic->linesize[2];
-    data[3] = cur_pic->data[3] +  y               * cur_pic->linesize[3];
-
-    out_h = sws_scale(scale->sws, data, cur_pic->linesize, y, h,
-                      link->dst->outputs[0]->outpic->data,
-                      link->dst->outputs[0]->outpic->linesize);
-
-    if (slice_dir == -1)
-        scale->slice_y -= out_h;
-    avfilter_draw_slice(link->dst->outputs[0], scale->slice_y, out_h, slice_dir);
-    if (slice_dir == 1)
-        scale->slice_y += out_h;
-}
-
-AVFilter avfilter_vf_scale = {
-    .name      = "scale",
-    .description = "Scale the input video to width:height size and/or convert the image format.",
-
-    .init      = init,
-    .uninit    = uninit,
-
-    .query_formats = query_formats,
-
-    .priv_size = sizeof(ScaleContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .start_frame      = start_frame,
-                                    .draw_slice       = draw_slice,
-                                    .min_perms        = AV_PERM_READ, },
-                                  { .name = NULL}},
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .config_props     = config_props, },
-                                  { .name = NULL}},
-};
diff --git a/libavfilter/vf_slicify.c b/libavfilter/vf_slicify.c
deleted file mode 100644
index 35e05da..0000000
--- a/libavfilter/vf_slicify.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * video slicing filter
- */
-
-#include "avfilter.h"
-#include "libavutil/pixdesc.h"
-
-typedef struct {
-    int h;          ///< output slice height
-    int vshift;     ///< vertical chroma subsampling shift
-    uint32_t lcg_state; ///< LCG state used to compute random slice height
-    int use_random_h;   ///< enable the use of random slice height values
-} SliceContext;
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    SliceContext *slice = ctx->priv;
-
-    slice->h = 16;
-    if (args) {
-        if (!strcmp(args, "random")) {
-            slice->use_random_h = 1;
-        } else {
-            sscanf(args, "%d", &slice->h);
-        }
-    }
-    return 0;
-}
-
-static int config_props(AVFilterLink *link)
-{
-    SliceContext *slice = link->dst->priv;
-
-    slice->vshift = av_pix_fmt_descriptors[link->format].log2_chroma_h;
-
-    return 0;
-}
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    SliceContext *slice = link->dst->priv;
-
-    if (slice->use_random_h) {
-        slice->lcg_state = slice->lcg_state * 1664525 + 1013904223;
-        slice->h = 8 + (uint64_t)slice->lcg_state * 25 / UINT32_MAX;
-    }
-
-    /* ensure that slices play nice with chroma subsampling, and enforce
-     * a reasonable minimum size for the slices */
-    slice->h = FFMAX(8, slice->h & (-1 << slice->vshift));
-
-    av_log(link->dst, AV_LOG_DEBUG, "h:%d\n", slice->h);
-
-    avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    SliceContext *slice = link->dst->priv;
-    int y2;
-
-    if (slice_dir == 1) {
-        for (y2 = y; y2 + slice->h <= y + h; y2 += slice->h)
-            avfilter_draw_slice(link->dst->outputs[0], y2, slice->h, slice_dir);
-
-        if (y2 < y + h)
-            avfilter_draw_slice(link->dst->outputs[0], y2, y + h - y2, slice_dir);
-    } else if (slice_dir == -1) {
-        for (y2 = y + h; y2 - slice->h >= y; y2 -= slice->h)
-            avfilter_draw_slice(link->dst->outputs[0], y2 - slice->h, slice->h, slice_dir);
-
-        if (y2 > y)
-            avfilter_draw_slice(link->dst->outputs[0], y, y2 - y, slice_dir);
-    }
-}
-
-AVFilter avfilter_vf_slicify = {
-    .name      = "slicify",
-    .description = "Pass the images of input video on to next video filter as multiple slices.",
-
-    .init      = init,
-
-    .priv_size = sizeof(SliceContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .get_video_buffer = avfilter_null_get_video_buffer,
-                                    .start_frame      = start_frame,
-                                    .draw_slice       = draw_slice,
-                                    .config_props     = config_props,
-                                    .end_frame        = avfilter_null_end_frame, },
-                                  { .name = NULL}},
-    .outputs   = (AVFilterPad[]) {{ .name            = "default",
-                                    .type            = AVMEDIA_TYPE_VIDEO, },
-                                  { .name = NULL}},
-};
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
deleted file mode 100644
index 78a6d7c..0000000
--- a/libavfilter/vf_unsharp.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Ported to FFmpeg from MPlayer libmpcodecs/unsharp.c
- * Original copyright (C) 2002 Remi Guyomarch <rguyom at pobox.com>
- * Port copyright (C) 2010 Daniel G. Taylor <dan at programmer-art.org>
- * Relicensed to the LGPL with permission from Remi Guyomarch.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * blur / sharpen filter
- *
- * This code is based on:
- *
- * An Efficient algorithm for Gaussian blur using finite-state machines
- * Frederick M. Waltz and John W. V. Miller
- *
- * SPIE Conf. on Machine Vision Systems for Inspection and Metrology VII
- * Originally published Boston, Nov 98
- *
- * http://www.engin.umd.umich.edu/~jwvm/ece581/21_GBlur.pdf
- */
-
-#include "avfilter.h"
-#include "libavutil/common.h"
-#include "libavutil/mem.h"
-#include "libavutil/pixdesc.h"
-
-#define MIN_SIZE 3
-#define MAX_SIZE 13
-
-#define CHROMA_WIDTH(link)  -((-link->w) >> av_pix_fmt_descriptors[link->format].log2_chroma_w)
-#define CHROMA_HEIGHT(link) -((-link->h) >> av_pix_fmt_descriptors[link->format].log2_chroma_h)
-
-typedef struct FilterParam {
-    int msize_x;                             ///< matrix width
-    int msize_y;                             ///< matrix height
-    int amount;                              ///< effect amount
-    int steps_x;                             ///< horizontal step count
-    int steps_y;                             ///< vertical step count
-    int scalebits;                           ///< bits to shift pixel
-    int32_t halfscale;                       ///< amount to add to pixel
-    uint32_t *sc[(MAX_SIZE * MAX_SIZE) - 1]; ///< finite state machine storage
-} FilterParam;
-
-typedef struct {
-    FilterParam luma;   ///< luma parameters (width, height, amount)
-    FilterParam chroma; ///< chroma parameters (width, height, amount)
-} UnsharpContext;
-
-static void unsharpen(uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, FilterParam *fp)
-{
-    uint32_t **sc = fp->sc;
-    uint32_t sr[(MAX_SIZE * MAX_SIZE) - 1], tmp1, tmp2;
-
-    int32_t res;
-    int x, y, z;
-
-    if (!fp->amount) {
-        if (dst_stride == src_stride)
-            memcpy(dst, src, src_stride * height);
-        else
-            for (y = 0; y < height; y++, dst += dst_stride, src += src_stride)
-                memcpy(dst, src, width);
-        return;
-    }
-
-    for (y = 0; y < 2 * fp->steps_y; y++)
-        memset(sc[y], 0, sizeof(sc[y][0]) * (width + 2 * fp->steps_x));
-
-    for (y =- fp->steps_y; y < height + fp->steps_y; y++) {
-        memset(sr, 0, sizeof(sr[0]) * (2 * fp->steps_x - 1));
-        for (x =- fp->steps_x; x < width + fp->steps_x; x++) {
-            tmp1 = x <= 0 ? src[0] : x >= width ? src[width-1] : src[x];
-            for (z = 0; z < fp->steps_x * 2; z += 2) {
-                tmp2 = sr[z + 0] + tmp1; sr[z + 0] = tmp1;
-                tmp1 = sr[z + 1] + tmp2; sr[z + 1] = tmp2;
-            }
-            for (z = 0; z < fp->steps_y * 2; z += 2) {
-                tmp2 = sc[z + 0][x + fp->steps_x] + tmp1; sc[z + 0][x + fp->steps_x] = tmp1;
-                tmp1 = sc[z + 1][x + fp->steps_x] + tmp2; sc[z + 1][x + fp->steps_x] = tmp2;
-            }
-            if (x >= fp->steps_x && y >= fp->steps_y) {
-                uint8_t* srx = src - fp->steps_y * src_stride + x - fp->steps_x;
-                uint8_t* dsx = dst - fp->steps_y * dst_stride + x - fp->steps_x;
-
-                res = (int32_t)*srx + ((((int32_t) * srx - (int32_t)((tmp1 + fp->halfscale) >> fp->scalebits)) * fp->amount) >> 16);
-                *dsx = av_clip_uint8(res);
-            }
-        }
-        if (y >= 0) {
-            dst += dst_stride;
-            src += src_stride;
-        }
-    }
-}
-
-static void set_filter_param(FilterParam *fp, int msize_x, int msize_y, double amount)
-{
-    fp->msize_x = msize_x;
-    fp->msize_y = msize_y;
-    fp->amount = amount * 65536.0;
-
-    fp->steps_x = msize_x / 2;
-    fp->steps_y = msize_y / 2;
-    fp->scalebits = (fp->steps_x + fp->steps_y) * 2;
-    fp->halfscale = 1 << (fp->scalebits - 1);
-}
-
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    UnsharpContext *unsharp = ctx->priv;
-    int lmsize_x = 5, cmsize_x = 0;
-    int lmsize_y = 5, cmsize_y = 0;
-    double lamount = 1.0f, camount = 0.0f;
-
-    if (args)
-        sscanf(args, "%d:%d:%lf:%d:%d:%lf", &lmsize_x, &lmsize_y, &lamount,
-                                            &cmsize_x, &cmsize_y, &camount);
-
-    set_filter_param(&unsharp->luma,   lmsize_x, lmsize_y, lamount);
-    set_filter_param(&unsharp->chroma, cmsize_x, cmsize_y, camount);
-
-    return 0;
-}
-
-static int query_formats(AVFilterContext *ctx)
-{
-    enum PixelFormat pix_fmts[] = {
-        PIX_FMT_YUV420P,  PIX_FMT_YUV422P,  PIX_FMT_YUV444P,  PIX_FMT_YUV410P,
-        PIX_FMT_YUV411P,  PIX_FMT_YUV440P,  PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P,
-        PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P, PIX_FMT_NONE
-    };
-
-    avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
-
-    return 0;
-}
-
-static void init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char *effect_type, int width)
-{
-    int z;
-    const char *effect;
-
-    effect = fp->amount == 0 ? "none" : fp->amount < 0 ? "blur" : "sharpen";
-
-    av_log(ctx, AV_LOG_INFO, "effect:%s type:%s msize_x:%d msize_y:%d amount:%0.2f\n",
-           effect, effect_type, fp->msize_x, fp->msize_y, fp->amount / 65535.0);
-
-    for (z = 0; z < 2 * fp->steps_y; z++)
-        fp->sc[z] = av_malloc(sizeof(*(fp->sc[z])) * (width + 2 * fp->steps_x));
-}
-
-static int config_props(AVFilterLink *link)
-{
-    UnsharpContext *unsharp = link->dst->priv;
-
-    init_filter_param(link->dst, &unsharp->luma,   "luma",   link->w);
-    init_filter_param(link->dst, &unsharp->chroma, "chroma", CHROMA_WIDTH(link));
-
-    return 0;
-}
-
-static void free_filter_param(FilterParam *fp)
-{
-    int z;
-
-    for (z = 0; z < 2 * fp->steps_y; z++)
-        av_free(fp->sc[z]);
-}
-
-static av_cold void uninit(AVFilterContext *ctx)
-{
-    UnsharpContext *unsharp = ctx->priv;
-
-    free_filter_param(&unsharp->luma);
-    free_filter_param(&unsharp->chroma);
-}
-
-static void end_frame(AVFilterLink *link)
-{
-    UnsharpContext *unsharp = link->dst->priv;
-    AVFilterPicRef *in  = link->cur_pic;
-    AVFilterPicRef *out = link->dst->outputs[0]->outpic;
-
-    unsharpen(out->data[0], in->data[0], out->linesize[0], in->linesize[0], link->w,            link->h,             &unsharp->luma);
-    unsharpen(out->data[1], in->data[1], out->linesize[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma);
-    unsharpen(out->data[2], in->data[2], out->linesize[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma);
-
-    avfilter_unref_pic(in);
-    avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1);
-    avfilter_end_frame(link->dst->outputs[0]);
-    avfilter_unref_pic(out);
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-}
-
-AVFilter avfilter_vf_unsharp = {
-    .name      = "unsharp",
-    .description = NULL_IF_CONFIG_SMALL("Sharpen or blur the input video."),
-
-    .priv_size = sizeof(UnsharpContext),
-
-    .init = init,
-    .uninit = uninit,
-    .query_formats = query_formats,
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .draw_slice       = draw_slice,
-                                    .end_frame        = end_frame,
-                                    .config_props     = config_props,
-                                    .min_perms        = AV_PERM_READ, },
-                                  { .name = NULL}},
-
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO, },
-                                  { .name = NULL}},
-};
diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c
deleted file mode 100644
index 0dfcb35..0000000
--- a/libavfilter/vf_vflip.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * copyright (c) 2007 Bobby Bingham
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * video vertical flip filter
- */
-
-#include "libavutil/pixdesc.h"
-#include "avfilter.h"
-
-typedef struct {
-    int vsub;   ///< vertical chroma subsampling
-} FlipContext;
-
-static int config_input(AVFilterLink *link)
-{
-    FlipContext *flip = link->dst->priv;
-
-    flip->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
-
-    return 0;
-}
-
-static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
-                                        int w, int h)
-{
-    FlipContext *flip = link->dst->priv;
-    int i;
-
-    AVFilterPicRef *picref = avfilter_get_video_buffer(link->dst->outputs[0],
-                                                       perms, w, h);
-
-    for (i = 0; i < 4; i ++) {
-        int vsub = i == 1 || i == 2 ? flip->vsub : 0;
-
-        if (picref->data[i]) {
-            picref->data[i] += ((h >> vsub)-1) * picref->linesize[i];
-            picref->linesize[i] = -picref->linesize[i];
-        }
-    }
-
-    return picref;
-}
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    FlipContext *flip = link->dst->priv;
-    int i;
-
-    for (i = 0; i < 4; i ++) {
-        int vsub = i == 1 || i == 2 ? flip->vsub : 0;
-
-        if (picref->data[i]) {
-            picref->data[i] += ((link->h >> vsub)-1) * picref->linesize[i];
-            picref->linesize[i] = -picref->linesize[i];
-        }
-    }
-
-    avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    AVFilterContext *ctx = link->dst;
-
-    avfilter_draw_slice(ctx->outputs[0], link->h - (y+h), h, -1 * slice_dir);
-}
-
-AVFilter avfilter_vf_vflip = {
-    .name      = "vflip",
-    .description = NULL_IF_CONFIG_SMALL("Flip the input video vertically."),
-
-    .priv_size = sizeof(FlipContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO,
-                                    .get_video_buffer = get_video_buffer,
-                                    .start_frame      = start_frame,
-                                    .draw_slice       = draw_slice,
-                                    .end_frame        = avfilter_null_end_frame,
-                                    .config_props     = config_input, },
-                                  { .name = NULL}},
-    .outputs   = (AVFilterPad[]) {{ .name             = "default",
-                                    .type             = AVMEDIA_TYPE_VIDEO, },
-                                  { .name = NULL}},
-};
diff --git a/libavfilter/vsink_nullsink.c b/libavfilter/vsink_nullsink.c
deleted file mode 100644
index d11912f..0000000
--- a/libavfilter/vsink_nullsink.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avfilter.h"
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-}
-
-static void end_frame(AVFilterLink *link)
-{
-}
-
-AVFilter avfilter_vsink_nullsink = {
-    .name        = "nullsink",
-    .description = "Do absolutely nothing with the input video.",
-
-    .priv_size = 0,
-
-    .inputs    = (AVFilterPad[]) {
-        {
-            .name            = "default",
-            .type            = AVMEDIA_TYPE_VIDEO,
-            .start_frame     = start_frame,
-            .end_frame       = end_frame,
-        },
-        { .name = NULL},
-    },
-    .outputs   = (AVFilterPad[]) {{ .name = NULL }},
-};
diff --git a/libavfilter/vsrc_nullsrc.c b/libavfilter/vsrc_nullsrc.c
deleted file mode 100644
index 4356199..0000000
--- a/libavfilter/vsrc_nullsrc.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * null video source
- */
-
-#include "avfilter.h"
-
-typedef struct {
-    int w, h;
-} NullContext;
-
-static int init(AVFilterContext *ctx, const char *args, void *opaque)
-{
-    NullContext *priv = ctx->priv;
-
-    priv->w = 352;
-    priv->h = 288;
-
-    if (args)
-        sscanf(args, "%d:%d", &priv->w, &priv->h);
-
-    if (priv->w <= 0 || priv->h <= 0) {
-        av_log(ctx, AV_LOG_ERROR, "Non-positive size values are not acceptable.\n");
-        return -1;
-    }
-
-    return 0;
-}
-
-static int config_props(AVFilterLink *outlink)
-{
-    NullContext *priv = outlink->src->priv;
-
-    outlink->w = priv->w;
-    outlink->h = priv->h;
-
-    av_log(outlink->src, AV_LOG_INFO, "w:%d h:%d\n", priv->w, priv->h);
-
-    return 0;
-}
-
-static int request_frame(AVFilterLink *link)
-{
-    return -1;
-}
-
-AVFilter avfilter_vsrc_nullsrc = {
-    .name        = "nullsrc",
-    .description = "Null video source, never return images.",
-
-    .init       = init,
-    .priv_size = sizeof(NullContext),
-
-    .inputs    = (AVFilterPad[]) {{ .name = NULL}},
-
-    .outputs   = (AVFilterPad[]) {
-        {
-            .name            = "default",
-            .type            = AVMEDIA_TYPE_VIDEO,
-            .config_props    = config_props,
-            .request_frame   = request_frame,
-        },
-        { .name = NULL}
-    },
-};
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
deleted file mode 100644
index a697f8d..0000000
--- a/libavformat/4xm.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * 4X Technologies .4xm File Demuxer (no muxer)
- * Copyright (c) 2003  The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * 4X Technologies file demuxer
- * by Mike Melanson (melanson at pcisys.net)
- * for more information on the .4xm file format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define     RIFF_TAG MKTAG('R', 'I', 'F', 'F')
-#define  FOURXMV_TAG MKTAG('4', 'X', 'M', 'V')
-#define     LIST_TAG MKTAG('L', 'I', 'S', 'T')
-#define     HEAD_TAG MKTAG('H', 'E', 'A', 'D')
-#define     TRK__TAG MKTAG('T', 'R', 'K', '_')
-#define     MOVI_TAG MKTAG('M', 'O', 'V', 'I')
-#define     VTRK_TAG MKTAG('V', 'T', 'R', 'K')
-#define     STRK_TAG MKTAG('S', 'T', 'R', 'K')
-#define     std__TAG MKTAG('s', 't', 'd', '_')
-#define     name_TAG MKTAG('n', 'a', 'm', 'e')
-#define     vtrk_TAG MKTAG('v', 't', 'r', 'k')
-#define     strk_TAG MKTAG('s', 't', 'r', 'k')
-#define     ifrm_TAG MKTAG('i', 'f', 'r', 'm')
-#define     pfrm_TAG MKTAG('p', 'f', 'r', 'm')
-#define     cfrm_TAG MKTAG('c', 'f', 'r', 'm')
-#define     ifr2_TAG MKTAG('i', 'f', 'r', '2')
-#define     pfr2_TAG MKTAG('p', 'f', 'r', '2')
-#define     cfr2_TAG MKTAG('c', 'f', 'r', '2')
-#define     snd__TAG MKTAG('s', 'n', 'd', '_')
-
-#define vtrk_SIZE 0x44
-#define strk_SIZE 0x28
-
-#define GET_LIST_HEADER() \
-    fourcc_tag = get_le32(pb); \
-    size = get_le32(pb); \
-    if (fourcc_tag != LIST_TAG) \
-        return AVERROR_INVALIDDATA; \
-    fourcc_tag = get_le32(pb);
-
-typedef struct AudioTrack {
-    int sample_rate;
-    int bits;
-    int channels;
-    int stream_index;
-    int adpcm;
-    int64_t audio_pts;
-} AudioTrack;
-
-typedef struct FourxmDemuxContext {
-    int width;
-    int height;
-    int video_stream_index;
-    int track_count;
-    AudioTrack *tracks;
-
-    int64_t video_pts;
-    float fps;
-} FourxmDemuxContext;
-
-static int fourxm_probe(AVProbeData *p)
-{
-    if ((AV_RL32(&p->buf[0]) != RIFF_TAG) ||
-        (AV_RL32(&p->buf[8]) != FOURXMV_TAG))
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int fourxm_read_header(AVFormatContext *s,
-                              AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    unsigned int fourcc_tag;
-    unsigned int size;
-    int header_size;
-    FourxmDemuxContext *fourxm = s->priv_data;
-    unsigned char *header;
-    int i, ret;
-    AVStream *st;
-
-    fourxm->track_count = 0;
-    fourxm->tracks = NULL;
-    fourxm->fps = 1.0;
-
-    /* skip the first 3 32-bit numbers */
-    url_fseek(pb, 12, SEEK_CUR);
-
-    /* check for LIST-HEAD */
-    GET_LIST_HEADER();
-    header_size = size - 4;
-    if (fourcc_tag != HEAD_TAG || header_size < 0)
-        return AVERROR_INVALIDDATA;
-
-    /* allocate space for the header and load the whole thing */
-    header = av_malloc(header_size);
-    if (!header)
-        return AVERROR(ENOMEM);
-    if (get_buffer(pb, header, header_size) != header_size){
-        av_free(header);
-        return AVERROR(EIO);
-    }
-
-    /* take the lazy approach and search for any and all vtrk and strk chunks */
-    for (i = 0; i < header_size - 8; i++) {
-        fourcc_tag = AV_RL32(&header[i]);
-        size = AV_RL32(&header[i + 4]);
-
-        if (fourcc_tag == std__TAG) {
-            fourxm->fps = av_int2flt(AV_RL32(&header[i + 12]));
-        } else if (fourcc_tag == vtrk_TAG) {
-            /* check that there is enough data */
-            if (size != vtrk_SIZE) {
-                ret= AVERROR_INVALIDDATA;
-                goto fail;
-            }
-            fourxm->width  = AV_RL32(&header[i + 36]);
-            fourxm->height = AV_RL32(&header[i + 40]);
-
-            /* allocate a new AVStream */
-            st = av_new_stream(s, 0);
-            if (!st){
-                ret= AVERROR(ENOMEM);
-                goto fail;
-            }
-            av_set_pts_info(st, 60, 1, fourxm->fps);
-
-            fourxm->video_stream_index = st->index;
-
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_4XM;
-            st->codec->extradata_size = 4;
-            st->codec->extradata = av_malloc(4);
-            AV_WL32(st->codec->extradata, AV_RL32(&header[i + 16]));
-            st->codec->width  = fourxm->width;
-            st->codec->height = fourxm->height;
-
-            i += 8 + size;
-        } else if (fourcc_tag == strk_TAG) {
-            int current_track;
-            /* check that there is enough data */
-            if (size != strk_SIZE) {
-                ret= AVERROR_INVALIDDATA;
-                goto fail;
-            }
-            current_track = AV_RL32(&header[i + 8]);
-            if((unsigned)current_track >= UINT_MAX / sizeof(AudioTrack) - 1){
-                av_log(s, AV_LOG_ERROR, "current_track too large\n");
-                ret= -1;
-                goto fail;
-            }
-            if (current_track + 1 > fourxm->track_count) {
-                fourxm->track_count = current_track + 1;
-                fourxm->tracks = av_realloc(fourxm->tracks,
-                    fourxm->track_count * sizeof(AudioTrack));
-                if (!fourxm->tracks) {
-                    ret=  AVERROR(ENOMEM);
-                    goto fail;
-                }
-            }
-            fourxm->tracks[current_track].adpcm       = AV_RL32(&header[i + 12]);
-            fourxm->tracks[current_track].channels    = AV_RL32(&header[i + 36]);
-            fourxm->tracks[current_track].sample_rate = AV_RL32(&header[i + 40]);
-            fourxm->tracks[current_track].bits        = AV_RL32(&header[i + 44]);
-            fourxm->tracks[current_track].audio_pts   = 0;
-            i += 8 + size;
-
-            /* allocate a new AVStream */
-            st = av_new_stream(s, current_track);
-            if (!st){
-                ret= AVERROR(ENOMEM);
-                goto fail;
-            }
-
-            av_set_pts_info(st, 60, 1, fourxm->tracks[current_track].sample_rate);
-
-            fourxm->tracks[current_track].stream_index = st->index;
-
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_tag = 0;
-            st->codec->channels              = fourxm->tracks[current_track].channels;
-            st->codec->sample_rate           = fourxm->tracks[current_track].sample_rate;
-            st->codec->bits_per_coded_sample = fourxm->tracks[current_track].bits;
-            st->codec->bit_rate              = st->codec->channels * st->codec->sample_rate *
-                st->codec->bits_per_coded_sample;
-            st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-            if (fourxm->tracks[current_track].adpcm){
-                st->codec->codec_id = CODEC_ID_ADPCM_4XM;
-            }else if (st->codec->bits_per_coded_sample == 8){
-                st->codec->codec_id = CODEC_ID_PCM_U8;
-            }else
-                st->codec->codec_id = CODEC_ID_PCM_S16LE;
-        }
-    }
-
-    /* skip over the LIST-MOVI chunk (which is where the stream should be */
-    GET_LIST_HEADER();
-    if (fourcc_tag != MOVI_TAG){
-        ret= AVERROR_INVALIDDATA;
-        goto fail;
-    }
-
-    av_free(header);
-    /* initialize context members */
-    fourxm->video_pts = -1;  /* first frame will push to 0 */
-
-    return 0;
-fail:
-    av_freep(&fourxm->tracks);
-    av_free(header);
-    return ret;
-}
-
-static int fourxm_read_packet(AVFormatContext *s,
-                              AVPacket *pkt)
-{
-    FourxmDemuxContext *fourxm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned int fourcc_tag;
-    unsigned int size, out_size;
-    int ret = 0;
-    unsigned int track_number;
-    int packet_read = 0;
-    unsigned char header[8];
-    int audio_frame_count;
-
-    while (!packet_read) {
-
-        if ((ret = get_buffer(s->pb, header, 8)) < 0)
-            return ret;
-        fourcc_tag = AV_RL32(&header[0]);
-        size = AV_RL32(&header[4]);
-        if (url_feof(pb))
-            return AVERROR(EIO);
-        switch (fourcc_tag) {
-
-        case LIST_TAG:
-            /* this is a good time to bump the video pts */
-            fourxm->video_pts ++;
-
-            /* skip the LIST-* tag and move on to the next fourcc */
-            get_le32(pb);
-            break;
-
-        case ifrm_TAG:
-        case pfrm_TAG:
-        case cfrm_TAG:
-        case ifr2_TAG:
-        case pfr2_TAG:
-        case cfr2_TAG:
-            /* allocate 8 more bytes than 'size' to account for fourcc
-             * and size */
-            if (size + 8 < size || av_new_packet(pkt, size + 8))
-                return AVERROR(EIO);
-            pkt->stream_index = fourxm->video_stream_index;
-            pkt->pts = fourxm->video_pts;
-            pkt->pos = url_ftell(s->pb);
-            memcpy(pkt->data, header, 8);
-            ret = get_buffer(s->pb, &pkt->data[8], size);
-
-            if (ret < 0){
-                av_free_packet(pkt);
-            }else
-                packet_read = 1;
-            break;
-
-        case snd__TAG:
-            track_number = get_le32(pb);
-            out_size= get_le32(pb);
-            size-=8;
-
-            if (track_number < fourxm->track_count) {
-                ret= av_get_packet(s->pb, pkt, size);
-                if(ret<0)
-                    return AVERROR(EIO);
-                pkt->stream_index =
-                    fourxm->tracks[track_number].stream_index;
-                pkt->pts = fourxm->tracks[track_number].audio_pts;
-                packet_read = 1;
-
-                /* pts accounting */
-                audio_frame_count = size;
-                if (fourxm->tracks[track_number].adpcm)
-                    audio_frame_count -=
-                        2 * (fourxm->tracks[track_number].channels);
-                audio_frame_count /=
-                      fourxm->tracks[track_number].channels;
-                if (fourxm->tracks[track_number].adpcm){
-                    audio_frame_count *= 2;
-                }else
-                    audio_frame_count /=
-                    (fourxm->tracks[track_number].bits / 8);
-                fourxm->tracks[track_number].audio_pts += audio_frame_count;
-
-            } else {
-                url_fseek(pb, size, SEEK_CUR);
-            }
-            break;
-
-        default:
-            url_fseek(pb, size, SEEK_CUR);
-            break;
-        }
-    }
-    return ret;
-}
-
-static int fourxm_read_close(AVFormatContext *s)
-{
-    FourxmDemuxContext *fourxm = s->priv_data;
-
-    av_freep(&fourxm->tracks);
-
-    return 0;
-}
-
-AVInputFormat fourxm_demuxer = {
-    "4xm",
-    NULL_IF_CONFIG_SMALL("4X Technologies format"),
-    sizeof(FourxmDemuxContext),
-    fourxm_probe,
-    fourxm_read_header,
-    fourxm_read_packet,
-    fourxm_read_close,
-};
diff --git a/libavformat/Makefile b/libavformat/Makefile
deleted file mode 100644
index 7a2d00f..0000000
--- a/libavformat/Makefile
+++ /dev/null
@@ -1,299 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = avformat
-FFLIBS = avcodec avutil
-
-HEADERS = avformat.h avio.h
-
-OBJS = allformats.o         \
-       cutils.o             \
-       metadata.o           \
-       metadata_compat.o    \
-       options.o            \
-       os_support.o         \
-       sdp.o                \
-       seek.o               \
-       utils.o              \
-
-# muxers/demuxers
-OBJS-$(CONFIG_AAC_DEMUXER)               += raw.o id3v1.o id3v2.o
-OBJS-$(CONFIG_AC3_DEMUXER)               += raw.o
-OBJS-$(CONFIG_AC3_MUXER)                 += raw.o
-OBJS-$(CONFIG_ADTS_MUXER)                += adtsenc.o
-OBJS-$(CONFIG_AEA_DEMUXER)               += aea.o raw.o
-OBJS-$(CONFIG_AIFF_DEMUXER)              += aiffdec.o riff.o raw.o
-OBJS-$(CONFIG_AIFF_MUXER)                += aiffenc.o riff.o
-OBJS-$(CONFIG_AMR_DEMUXER)               += amr.o
-OBJS-$(CONFIG_AMR_MUXER)                 += amr.o
-OBJS-$(CONFIG_ANM_DEMUXER)               += anm.o
-OBJS-$(CONFIG_APC_DEMUXER)               += apc.o
-OBJS-$(CONFIG_APE_DEMUXER)               += ape.o apetag.o
-OBJS-$(CONFIG_ASF_DEMUXER)               += asfdec.o asf.o asfcrypt.o \
-                                            riff.o avlanguage.o
-OBJS-$(CONFIG_ASF_MUXER)                 += asfenc.o asf.o riff.o
-OBJS-$(CONFIG_ASS_DEMUXER)               += assdec.o
-OBJS-$(CONFIG_ASS_MUXER)                 += assenc.o
-OBJS-$(CONFIG_AU_DEMUXER)                += au.o raw.o
-OBJS-$(CONFIG_AU_MUXER)                  += au.o
-OBJS-$(CONFIG_AVI_DEMUXER)               += avidec.o riff.o avi.o
-OBJS-$(CONFIG_AVI_MUXER)                 += avienc.o riff.o avi.o
-OBJS-$(CONFIG_AVISYNTH)                  += avisynth.o
-OBJS-$(CONFIG_AVM2_MUXER)                += swfenc.o
-OBJS-$(CONFIG_AVS_DEMUXER)               += avs.o vocdec.o voc.o
-OBJS-$(CONFIG_BETHSOFTVID_DEMUXER)       += bethsoftvid.o
-OBJS-$(CONFIG_BFI_DEMUXER)               += bfi.o
-OBJS-$(CONFIG_BINK_DEMUXER)              += bink.o
-OBJS-$(CONFIG_C93_DEMUXER)               += c93.o vocdec.o voc.o
-OBJS-$(CONFIG_CAF_DEMUXER)               += cafdec.o caf.o mov.o riff.o isom.o
-OBJS-$(CONFIG_CAVSVIDEO_DEMUXER)         += raw.o
-OBJS-$(CONFIG_CDG_DEMUXER)               += cdg.o
-OBJS-$(CONFIG_CRC_MUXER)                 += crcenc.o
-OBJS-$(CONFIG_DAUD_DEMUXER)              += daud.o
-OBJS-$(CONFIG_DAUD_MUXER)                += daud.o
-OBJS-$(CONFIG_DIRAC_DEMUXER)             += raw.o
-OBJS-$(CONFIG_DIRAC_MUXER)               += raw.o
-OBJS-$(CONFIG_DNXHD_DEMUXER)             += raw.o
-OBJS-$(CONFIG_DNXHD_MUXER)               += raw.o
-OBJS-$(CONFIG_DSICIN_DEMUXER)            += dsicin.o
-OBJS-$(CONFIG_DTS_DEMUXER)               += raw.o id3v2.o
-OBJS-$(CONFIG_DTS_MUXER)                 += raw.o
-OBJS-$(CONFIG_DV_DEMUXER)                += dv.o
-OBJS-$(CONFIG_DV_MUXER)                  += dvenc.o
-OBJS-$(CONFIG_DXA_DEMUXER)               += dxa.o riff.o
-OBJS-$(CONFIG_EA_CDATA_DEMUXER)          += eacdata.o
-OBJS-$(CONFIG_EA_DEMUXER)                += electronicarts.o
-OBJS-$(CONFIG_EAC3_DEMUXER)              += raw.o id3v2.o
-OBJS-$(CONFIG_EAC3_MUXER)                += raw.o
-OBJS-$(CONFIG_FFM_DEMUXER)               += ffmdec.o
-OBJS-$(CONFIG_FFM_MUXER)                 += ffmenc.o
-OBJS-$(CONFIG_FILMSTRIP_DEMUXER)         += filmstripdec.o
-OBJS-$(CONFIG_FILMSTRIP_MUXER)           += filmstripenc.o
-OBJS-$(CONFIG_FLAC_DEMUXER)              += flacdec.o raw.o id3v1.o \
-                                            id3v2.o oggparsevorbis.o \
-                                            vorbiscomment.o
-OBJS-$(CONFIG_FLAC_MUXER)                += flacenc.o flacenc_header.o \
-                                            vorbiscomment.o
-OBJS-$(CONFIG_FLIC_DEMUXER)              += flic.o
-OBJS-$(CONFIG_FLV_DEMUXER)               += flvdec.o
-OBJS-$(CONFIG_FLV_MUXER)                 += flvenc.o avc.o
-OBJS-$(CONFIG_FOURXM_DEMUXER)            += 4xm.o
-OBJS-$(CONFIG_FRAMECRC_MUXER)            += framecrcenc.o
-OBJS-$(CONFIG_GIF_MUXER)                 += gif.o
-OBJS-$(CONFIG_GSM_DEMUXER)               += raw.o id3v2.o
-OBJS-$(CONFIG_GXF_DEMUXER)               += gxf.o
-OBJS-$(CONFIG_GXF_MUXER)                 += gxfenc.o audiointerleave.o
-OBJS-$(CONFIG_H261_DEMUXER)              += raw.o
-OBJS-$(CONFIG_H261_MUXER)                += raw.o
-OBJS-$(CONFIG_H263_DEMUXER)              += raw.o
-OBJS-$(CONFIG_H263_MUXER)                += raw.o
-OBJS-$(CONFIG_H264_DEMUXER)              += raw.o
-OBJS-$(CONFIG_H264_MUXER)                += raw.o
-OBJS-$(CONFIG_IDCIN_DEMUXER)             += idcin.o
-OBJS-$(CONFIG_IFF_DEMUXER)               += iff.o
-OBJS-$(CONFIG_IMAGE2_DEMUXER)            += img2.o
-OBJS-$(CONFIG_IMAGE2_MUXER)              += img2.o
-OBJS-$(CONFIG_IMAGE2PIPE_DEMUXER)        += img2.o
-OBJS-$(CONFIG_IMAGE2PIPE_MUXER)          += img2.o
-OBJS-$(CONFIG_INGENIENT_DEMUXER)         += raw.o
-OBJS-$(CONFIG_IPMOVIE_DEMUXER)           += ipmovie.o
-OBJS-$(CONFIG_ISS_DEMUXER)               += iss.o
-OBJS-$(CONFIG_IV8_DEMUXER)               += iv8.o
-OBJS-$(CONFIG_LMLM4_DEMUXER)             += lmlm4.o
-OBJS-$(CONFIG_M4V_DEMUXER)               += raw.o
-OBJS-$(CONFIG_M4V_MUXER)                 += raw.o
-OBJS-$(CONFIG_MATROSKA_DEMUXER)          += matroskadec.o matroska.o \
-                                            riff.o isom.o rmdec.o rm.o
-OBJS-$(CONFIG_MATROSKA_MUXER)            += matroskaenc.o matroska.o \
-                                            riff.o isom.o avc.o \
-                                            flacenc_header.o
-OBJS-$(CONFIG_MJPEG_DEMUXER)             += raw.o
-OBJS-$(CONFIG_MJPEG_MUXER)               += raw.o
-OBJS-$(CONFIG_MLP_DEMUXER)               += raw.o id3v2.o
-OBJS-$(CONFIG_MLP_MUXER)                 += raw.o
-OBJS-$(CONFIG_MM_DEMUXER)                += mm.o
-OBJS-$(CONFIG_MMF_DEMUXER)               += mmf.o raw.o
-OBJS-$(CONFIG_MMF_MUXER)                 += mmf.o riff.o
-OBJS-$(CONFIG_MOV_DEMUXER)               += mov.o riff.o isom.o
-OBJS-$(CONFIG_MOV_MUXER)                 += movenc.o riff.o isom.o avc.o movenchint.o
-OBJS-$(CONFIG_MP2_MUXER)                 += mp3.o id3v1.o
-OBJS-$(CONFIG_MP3_DEMUXER)               += mp3.o id3v1.o id3v2.o
-OBJS-$(CONFIG_MP3_MUXER)                 += mp3.o id3v1.o id3v2.o
-OBJS-$(CONFIG_MPC_DEMUXER)               += mpc.o id3v1.o id3v2.o apetag.o
-OBJS-$(CONFIG_MPC8_DEMUXER)              += mpc8.o
-OBJS-$(CONFIG_MPEG1SYSTEM_MUXER)         += mpegenc.o
-OBJS-$(CONFIG_MPEG1VCD_MUXER)            += mpegenc.o
-OBJS-$(CONFIG_MPEG2DVD_MUXER)            += mpegenc.o
-OBJS-$(CONFIG_MPEG2VOB_MUXER)            += mpegenc.o
-OBJS-$(CONFIG_MPEG2SVCD_MUXER)           += mpegenc.o
-OBJS-$(CONFIG_MPEG1VIDEO_MUXER)          += raw.o
-OBJS-$(CONFIG_MPEG2VIDEO_MUXER)          += raw.o
-OBJS-$(CONFIG_MPEGPS_DEMUXER)            += mpeg.o
-OBJS-$(CONFIG_MPEGTS_DEMUXER)            += mpegts.o
-OBJS-$(CONFIG_MPEGTS_MUXER)              += mpegtsenc.o adtsenc.o
-OBJS-$(CONFIG_MPEGVIDEO_DEMUXER)         += raw.o
-OBJS-$(CONFIG_MPJPEG_MUXER)              += mpjpeg.o
-OBJS-$(CONFIG_MSNWC_TCP_DEMUXER)         += msnwc_tcp.o
-OBJS-$(CONFIG_MTV_DEMUXER)               += mtv.o
-OBJS-$(CONFIG_MVI_DEMUXER)               += mvi.o
-OBJS-$(CONFIG_MXF_DEMUXER)               += mxfdec.o mxf.o
-OBJS-$(CONFIG_MXF_MUXER)                 += mxfenc.o mxf.o audiointerleave.o
-OBJS-$(CONFIG_NC_DEMUXER)                += ncdec.o
-OBJS-$(CONFIG_NSV_DEMUXER)               += nsvdec.o
-OBJS-$(CONFIG_NULL_MUXER)                += raw.o
-OBJS-$(CONFIG_NUT_DEMUXER)               += nutdec.o nut.o riff.o
-OBJS-$(CONFIG_NUT_MUXER)                 += nutenc.o nut.o riff.o
-OBJS-$(CONFIG_NUV_DEMUXER)               += nuv.o riff.o
-OBJS-$(CONFIG_OGG_DEMUXER)               += oggdec.o         \
-                                            oggparsedirac.o  \
-                                            oggparseflac.o   \
-                                            oggparseogm.o    \
-                                            oggparseskeleton.o \
-                                            oggparsespeex.o  \
-                                            oggparsetheora.o \
-                                            oggparsevorbis.o \
-                                            riff.o \
-                                            vorbiscomment.o
-OBJS-$(CONFIG_OGG_MUXER)                 += oggenc.o \
-                                            vorbiscomment.o
-OBJS-$(CONFIG_OMA_DEMUXER)               += oma.o raw.o
-OBJS-$(CONFIG_PCM_ALAW_DEMUXER)          += raw.o
-OBJS-$(CONFIG_PCM_ALAW_MUXER)            += raw.o
-OBJS-$(CONFIG_PCM_F32BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_F32BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_F32LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_F32LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_F64BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_F64BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_F64LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_F64LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_MULAW_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_MULAW_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_S16BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_S16BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_S16LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_S16LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_S24BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_S24BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_S24LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_S24LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_S32BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_S32BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_S32LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_S32LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_S8_DEMUXER)            += raw.o
-OBJS-$(CONFIG_PCM_S8_MUXER)              += raw.o
-OBJS-$(CONFIG_PCM_U16BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_U16BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_U16LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_U16LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_U24BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_U24BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_U24LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_U24LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_U32BE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_U32BE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_U32LE_DEMUXER)         += raw.o
-OBJS-$(CONFIG_PCM_U32LE_MUXER)           += raw.o
-OBJS-$(CONFIG_PCM_U8_DEMUXER)            += raw.o
-OBJS-$(CONFIG_PCM_U8_MUXER)              += raw.o
-OBJS-$(CONFIG_PVA_DEMUXER)               += pva.o
-OBJS-$(CONFIG_QCP_DEMUXER)               += qcp.o
-OBJS-$(CONFIG_R3D_DEMUXER)               += r3d.o
-OBJS-$(CONFIG_RAWVIDEO_DEMUXER)          += raw.o
-OBJS-$(CONFIG_RAWVIDEO_MUXER)            += raw.o
-OBJS-$(CONFIG_RL2_DEMUXER)               += rl2.o
-OBJS-$(CONFIG_RM_DEMUXER)                += rmdec.o rm.o
-OBJS-$(CONFIG_RM_MUXER)                  += rmenc.o rm.o
-OBJS-$(CONFIG_ROQ_DEMUXER)               += idroq.o
-OBJS-$(CONFIG_ROQ_MUXER)                 += raw.o
-OBJS-$(CONFIG_RPL_DEMUXER)               += rpl.o
-OBJS-$(CONFIG_RTP_MUXER)                 += rtp.o         \
-                                            rtpenc_aac.o     \
-                                            rtpenc_amr.o     \
-                                            rtpenc_h263.o    \
-                                            rtpenc_mpv.o     \
-                                            rtpenc.o      \
-                                            rtpenc_h264.o \
-                                            avc.o
-OBJS-$(CONFIG_RTSP_DEMUXER)              += rtsp.o httpauth.o
-OBJS-$(CONFIG_RTSP_MUXER)                += rtsp.o rtspenc.o httpauth.o
-OBJS-$(CONFIG_SDP_DEMUXER)               += rtsp.o        \
-                                            rdt.o         \
-                                            rtp.o         \
-                                            rtpdec.o      \
-                                            rtpdec_amr.o  \
-                                            rtpdec_asf.o  \
-                                            rtpdec_h263.o \
-                                            rtpdec_h264.o \
-                                            rtpdec_xiph.o
-OBJS-$(CONFIG_SEGAFILM_DEMUXER)          += segafilm.o
-OBJS-$(CONFIG_SHORTEN_DEMUXER)           += raw.o id3v2.o
-OBJS-$(CONFIG_SIFF_DEMUXER)              += siff.o
-OBJS-$(CONFIG_SMACKER_DEMUXER)           += smacker.o
-OBJS-$(CONFIG_SOL_DEMUXER)               += sol.o raw.o
-OBJS-$(CONFIG_SOX_DEMUXER)               += soxdec.o raw.o
-OBJS-$(CONFIG_SOX_MUXER)                 += soxenc.o
-OBJS-$(CONFIG_SPDIF_MUXER)               += spdif.o
-OBJS-$(CONFIG_STR_DEMUXER)               += psxstr.o
-OBJS-$(CONFIG_SWF_DEMUXER)               += swfdec.o
-OBJS-$(CONFIG_SWF_MUXER)                 += swfenc.o
-OBJS-$(CONFIG_THP_DEMUXER)               += thp.o
-OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER)        += tiertexseq.o
-OBJS-$(CONFIG_TMV_DEMUXER)               += tmv.o
-OBJS-$(CONFIG_TRUEHD_DEMUXER)            += raw.o id3v2.o
-OBJS-$(CONFIG_TRUEHD_MUXER)              += raw.o
-OBJS-$(CONFIG_TTA_DEMUXER)               += tta.o id3v1.o id3v2.o
-OBJS-$(CONFIG_TXD_DEMUXER)               += txd.o
-OBJS-$(CONFIG_VC1_DEMUXER)               += raw.o
-OBJS-$(CONFIG_VC1T_DEMUXER)              += vc1test.o
-OBJS-$(CONFIG_VC1T_MUXER)                += vc1testenc.o
-OBJS-$(CONFIG_VMD_DEMUXER)               += sierravmd.o
-OBJS-$(CONFIG_VOC_DEMUXER)               += vocdec.o voc.o
-OBJS-$(CONFIG_VOC_MUXER)                 += vocenc.o voc.o
-OBJS-$(CONFIG_VQF_DEMUXER)               += vqf.o
-OBJS-$(CONFIG_W64_DEMUXER)               += wav.o riff.o raw.o
-OBJS-$(CONFIG_WAV_DEMUXER)               += wav.o riff.o raw.o
-OBJS-$(CONFIG_WAV_MUXER)                 += wav.o riff.o
-OBJS-$(CONFIG_WC3_DEMUXER)               += wc3movie.o
-OBJS-$(CONFIG_WEBM_MUXER)                += matroskaenc.o matroska.o \
-                                            riff.o isom.o avc.o \
-                                            flacenc_header.o
-OBJS-$(CONFIG_WSAUD_DEMUXER)             += westwood.o
-OBJS-$(CONFIG_WSVQA_DEMUXER)             += westwood.o
-OBJS-$(CONFIG_WV_DEMUXER)                += wv.o apetag.o id3v1.o
-OBJS-$(CONFIG_XA_DEMUXER)                += xa.o
-OBJS-$(CONFIG_YOP_DEMUXER)               += yop.o
-OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER)        += yuv4mpeg.o
-OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER)      += yuv4mpeg.o
-
-# external libraries
-OBJS-$(CONFIG_LIBNUT_DEMUXER)            += libnut.o riff.o
-OBJS-$(CONFIG_LIBNUT_MUXER)              += libnut.o riff.o
-
-# protocols I/O
-OBJS+= avio.o aviobuf.o
-
-OBJS-$(CONFIG_FILE_PROTOCOL)             += file.o
-OBJS-$(CONFIG_GOPHER_PROTOCOL)           += gopher.o
-OBJS-$(CONFIG_HTTP_PROTOCOL)             += http.o httpauth.o
-OBJS-$(CONFIG_PIPE_PROTOCOL)             += file.o
-
-# external or internal rtmp
-RTMP-OBJS-$(CONFIG_LIBRTMP)               = librtmp.o
-RTMP-OBJS-$(!CONFIG_LIBRTMP)              = rtmpproto.o rtmppkt.o
-OBJS-$(CONFIG_RTMP_PROTOCOL)             += $(RTMP-OBJS-yes)
-
-OBJS-$(CONFIG_RTP_PROTOCOL)              += rtpproto.o
-OBJS-$(CONFIG_TCP_PROTOCOL)              += tcp.o
-OBJS-$(CONFIG_UDP_PROTOCOL)              += udp.o
-OBJS-$(CONFIG_CONCAT_PROTOCOL)           += concat.o
-
-# libavdevice dependencies
-OBJS-$(CONFIG_JACK_INDEV)                += timefilter.o
-
-EXAMPLES  = output
-TESTPROGS = timefilter
-
-include $(SUBDIR)../subdir.mak
-
-$(SUBDIR)output-example$(EXESUF): ELIBS = -lswscale
diff --git a/libavformat/adts.h b/libavformat/adts.h
deleted file mode 100644
index 1da57be..0000000
--- a/libavformat/adts.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * ADTS muxer.
- * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at smartjog.com>
- *                    Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_ADTS_H
-#define AVFORMAT_ADTS_H
-
-#include "avformat.h"
-#include "libavcodec/mpeg4audio.h"
-
-#define ADTS_HEADER_SIZE 7
-
-typedef struct {
-    int write_adts;
-    int objecttype;
-    int sample_rate_index;
-    int channel_conf;
-    int pce_size;
-    uint8_t pce_data[MAX_PCE_SIZE];
-} ADTSContext;
-
-int ff_adts_write_frame_header(ADTSContext *ctx, uint8_t *buf,
-                               int size, int pce_size);
-int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts,
-                             uint8_t *buf, int size);
-
-#endif /* AVFORMAT_ADTS_H */
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
deleted file mode 100644
index ecc8dc4..0000000
--- a/libavformat/adtsenc.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * ADTS muxer.
- * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at smartjog.com>
- *                    Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/get_bits.h"
-#include "libavcodec/put_bits.h"
-#include "libavcodec/avcodec.h"
-#include "avformat.h"
-#include "adts.h"
-
-int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf, int size)
-{
-    GetBitContext gb;
-    PutBitContext pb;
-
-    init_get_bits(&gb, buf, size * 8);
-    adts->objecttype = get_bits(&gb, 5) - 1;
-    adts->sample_rate_index = get_bits(&gb, 4);
-    adts->channel_conf = get_bits(&gb, 4);
-
-    if (adts->objecttype > 3U) {
-        av_log(s, AV_LOG_ERROR, "MPEG-4 AOT %d is not allowed in ADTS\n", adts->objecttype+1);
-        return -1;
-    }
-    if (adts->sample_rate_index == 15) {
-        av_log(s, AV_LOG_ERROR, "Escape sample rate index illegal in ADTS\n");
-        return -1;
-    }
-    if (get_bits(&gb, 1)) {
-        av_log(s, AV_LOG_ERROR, "960/120 MDCT window is not allowed in ADTS\n");
-        return -1;
-    }
-    if (get_bits(&gb, 1)) {
-        av_log(s, AV_LOG_ERROR, "Scalable configurations are not allowed in ADTS\n");
-        return -1;
-    }
-    if (get_bits(&gb, 1)) {
-        av_log_missing_feature(s, "Signaled SBR or PS", 0);
-        return -1;
-    }
-    if (!adts->channel_conf) {
-        init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE);
-
-        put_bits(&pb, 3, 5); //ID_PCE
-        adts->pce_size = (ff_copy_pce_data(&pb, &gb) + 3) / 8;
-        flush_put_bits(&pb);
-    }
-
-    adts->write_adts = 1;
-
-    return 0;
-}
-
-static int adts_write_header(AVFormatContext *s)
-{
-    ADTSContext *adts = s->priv_data;
-    AVCodecContext *avc = s->streams[0]->codec;
-
-    if(avc->extradata_size > 0 &&
-            ff_adts_decode_extradata(s, adts, avc->extradata, avc->extradata_size) < 0)
-        return -1;
-
-    return 0;
-}
-
-int ff_adts_write_frame_header(ADTSContext *ctx,
-                               uint8_t *buf, int size, int pce_size)
-{
-    PutBitContext pb;
-
-    init_put_bits(&pb, buf, ADTS_HEADER_SIZE);
-
-    /* adts_fixed_header */
-    put_bits(&pb, 12, 0xfff);   /* syncword */
-    put_bits(&pb, 1, 0);        /* ID */
-    put_bits(&pb, 2, 0);        /* layer */
-    put_bits(&pb, 1, 1);        /* protection_absent */
-    put_bits(&pb, 2, ctx->objecttype); /* profile_objecttype */
-    put_bits(&pb, 4, ctx->sample_rate_index);
-    put_bits(&pb, 1, 0);        /* private_bit */
-    put_bits(&pb, 3, ctx->channel_conf); /* channel_configuration */
-    put_bits(&pb, 1, 0);        /* original_copy */
-    put_bits(&pb, 1, 0);        /* home */
-
-    /* adts_variable_header */
-    put_bits(&pb, 1, 0);        /* copyright_identification_bit */
-    put_bits(&pb, 1, 0);        /* copyright_identification_start */
-    put_bits(&pb, 13, ADTS_HEADER_SIZE + size + pce_size); /* aac_frame_length */
-    put_bits(&pb, 11, 0x7ff);   /* adts_buffer_fullness */
-    put_bits(&pb, 2, 0);        /* number_of_raw_data_blocks_in_frame */
-
-    flush_put_bits(&pb);
-
-    return 0;
-}
-
-static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ADTSContext *adts = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint8_t buf[ADTS_HEADER_SIZE];
-
-    if (!pkt->size)
-        return 0;
-    if(adts->write_adts) {
-        ff_adts_write_frame_header(adts, buf, pkt->size, adts->pce_size);
-        put_buffer(pb, buf, ADTS_HEADER_SIZE);
-        if(adts->pce_size) {
-            put_buffer(pb, adts->pce_data, adts->pce_size);
-            adts->pce_size = 0;
-        }
-    }
-    put_buffer(pb, pkt->data, pkt->size);
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-AVOutputFormat adts_muxer = {
-    "adts",
-    NULL_IF_CONFIG_SMALL("ADTS AAC"),
-    "audio/aac",
-    "aac,adts",
-    sizeof(ADTSContext),
-    CODEC_ID_AAC,
-    CODEC_ID_NONE,
-    adts_write_header,
-    adts_write_packet,
-};
diff --git a/libavformat/aea.c b/libavformat/aea.c
deleted file mode 100644
index 518995c..0000000
--- a/libavformat/aea.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * MD STUDIO audio demuxer
- *
- * Copyright (c) 2009 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "raw.h"
-#include "libavutil/intreadwrite.h"
-
-#define AT1_SU_SIZE     212
-
-static int aea_read_probe(AVProbeData *p)
-{
-    if (p->buf_size <= 2048+212)
-        return 0;
-
-    /* Magic is '00 08 00 00' in Little Endian*/
-    if (AV_RL32(p->buf)==0x800) {
-        int bsm_s, bsm_e, inb_s, inb_e, ch;
-        ch    = p->buf[264];
-        bsm_s = p->buf[2048];
-        inb_s = p->buf[2048+1];
-        inb_e = p->buf[2048+210];
-        bsm_e = p->buf[2048+211];
-
-        if (ch != 1 && ch != 2)
-            return 0;
-
-        /* Check so that the redundant bsm bytes and info bytes are valid
-         * the block size mode bytes have to be the same
-         * the info bytes have to be the same
-         */
-        if (bsm_s == bsm_e && inb_s == inb_e)
-            return AVPROBE_SCORE_MAX / 4 + 1;
-    }
-    return 0;
-}
-
-static int aea_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    AVStream *st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    /* Parse the amount of channels and skip to pos 2048(0x800) */
-    url_fskip(s->pb, 264);
-    st->codec->channels = get_byte(s->pb);
-    url_fskip(s->pb, 1783);
-
-
-    st->codec->codec_type     = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id       = CODEC_ID_ATRAC1;
-    st->codec->sample_rate    = 44100;
-    st->codec->bit_rate       = 292000;
-
-    if (st->codec->channels != 1 && st->codec->channels != 2) {
-        av_log(s,AV_LOG_ERROR,"Channels %d not supported!\n",st->codec->channels);
-        return -1;
-    }
-
-    st->codec->channel_layout = (st->codec->channels == 1) ? CH_LAYOUT_MONO : CH_LAYOUT_STEREO;
-
-    st->codec->block_align = AT1_SU_SIZE * st->codec->channels;
-    return 0;
-}
-
-static int aea_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret = av_get_packet(s->pb, pkt, s->streams[0]->codec->block_align);
-
-    pkt->stream_index = 0;
-    if (ret <= 0)
-        return AVERROR(EIO);
-
-    return ret;
-}
-
-AVInputFormat aea_demuxer = {
-    "aea",
-    NULL_IF_CONFIG_SMALL("MD STUDIO audio"),
-    0,
-    aea_read_probe,
-    aea_read_header,
-    aea_read_packet,
-    0,
-    pcm_read_seek,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "aea",
-};
-
diff --git a/libavformat/aiff.h b/libavformat/aiff.h
deleted file mode 100644
index 047f81d..0000000
--- a/libavformat/aiff.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * AIFF/AIFF-C muxer/demuxer common header
- * Copyright (c) 2006  Patrick Guimond
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * common header for AIFF muxer and demuxer
- */
-
-#ifndef AVFORMAT_AIFF_H
-#define AVFORMAT_AIFF_H
-
-#include "avformat.h"
-#include "riff.h"
-
-static const AVCodecTag ff_codec_aiff_tags[] = {
-    { CODEC_ID_PCM_S16BE,    MKTAG('N','O','N','E') },
-    { CODEC_ID_PCM_S8,       MKTAG('N','O','N','E') },
-    { CODEC_ID_PCM_S24BE,    MKTAG('N','O','N','E') },
-    { CODEC_ID_PCM_S32BE,    MKTAG('N','O','N','E') },
-    { CODEC_ID_PCM_F32BE,    MKTAG('f','l','3','2') },
-    { CODEC_ID_PCM_F64BE,    MKTAG('f','l','6','4') },
-    { CODEC_ID_PCM_ALAW,     MKTAG('a','l','a','w') },
-    { CODEC_ID_PCM_MULAW,    MKTAG('u','l','a','w') },
-    { CODEC_ID_MACE3,        MKTAG('M','A','C','3') },
-    { CODEC_ID_MACE6,        MKTAG('M','A','C','6') },
-    { CODEC_ID_GSM,          MKTAG('G','S','M',' ') },
-    { CODEC_ID_ADPCM_G726,   MKTAG('G','7','2','6') },
-    { CODEC_ID_PCM_S16LE,    MKTAG('s','o','w','t') },
-    { CODEC_ID_ADPCM_IMA_QT, MKTAG('i','m','a','4') },
-    { CODEC_ID_QDM2,         MKTAG('Q','D','M','2') },
-    { CODEC_ID_QCELP,        MKTAG('Q','c','l','p') },
-    { CODEC_ID_NONE,         0 },
-};
-
-#endif /* AVFORMAT_AIFF_H */
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
deleted file mode 100644
index f72af00..0000000
--- a/libavformat/aiffdec.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * AIFF/AIFF-C demuxer
- * Copyright (c) 2006  Patrick Guimond
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intfloat_readwrite.h"
-#include "avformat.h"
-#include "raw.h"
-#include "aiff.h"
-
-#define AIFF                    0
-#define AIFF_C_VERSION1         0xA2805140
-
-typedef struct {
-    int64_t data_end;
-} AIFFInputContext;
-
-static enum CodecID aiff_codec_get_id(int bps)
-{
-    if (bps <= 8)
-        return CODEC_ID_PCM_S8;
-    if (bps <= 16)
-        return CODEC_ID_PCM_S16BE;
-    if (bps <= 24)
-        return CODEC_ID_PCM_S24BE;
-    if (bps <= 32)
-        return CODEC_ID_PCM_S32BE;
-
-    /* bigger than 32 isn't allowed  */
-    return CODEC_ID_NONE;
-}
-
-/* returns the size of the found tag */
-static int get_tag(ByteIOContext *pb, uint32_t * tag)
-{
-    int size;
-
-    if (url_feof(pb))
-        return AVERROR(EIO);
-
-    *tag = get_le32(pb);
-    size = get_be32(pb);
-
-    if (size < 0)
-        size = 0x7fffffff;
-
-    return size;
-}
-
-/* Metadata string read */
-static void get_meta(AVFormatContext *s, const char *key, int size)
-{
-    uint8_t *str = av_malloc(size+1);
-    int res;
-
-    if (!str) {
-        url_fskip(s->pb, size);
-        return;
-    }
-
-    res = get_buffer(s->pb, str, size);
-    if (res < 0)
-        return;
-
-    str[res] = 0;
-    av_metadata_set2(&s->metadata, key, str, AV_METADATA_DONT_STRDUP_VAL);
-}
-
-/* Returns the number of sound data frames or negative on error */
-static unsigned int get_aiff_header(ByteIOContext *pb, AVCodecContext *codec,
-                             int size, unsigned version)
-{
-    AVExtFloat ext;
-    double sample_rate;
-    unsigned int num_frames;
-
-    if (size & 1)
-        size++;
-    codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    codec->channels = get_be16(pb);
-    num_frames = get_be32(pb);
-    codec->bits_per_coded_sample = get_be16(pb);
-
-    get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
-    sample_rate = av_ext2dbl(ext);          /* 80 bits BE IEEE extended float */
-    codec->sample_rate = sample_rate;
-    size -= 18;
-
-    /* Got an AIFF-C? */
-    if (version == AIFF_C_VERSION1) {
-        codec->codec_tag = get_le32(pb);
-        codec->codec_id  = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag);
-
-        switch (codec->codec_id) {
-        case CODEC_ID_PCM_S16BE:
-            codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
-            codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
-            break;
-        case CODEC_ID_ADPCM_IMA_QT:
-            codec->block_align = 34*codec->channels;
-            codec->frame_size = 64;
-            break;
-        case CODEC_ID_MACE3:
-            codec->block_align = 2*codec->channels;
-            codec->frame_size = 6;
-            break;
-        case CODEC_ID_MACE6:
-            codec->block_align = 1*codec->channels;
-            codec->frame_size = 6;
-            break;
-        case CODEC_ID_GSM:
-            codec->block_align = 33;
-            codec->frame_size = 160;
-            break;
-        case CODEC_ID_QCELP:
-            codec->block_align = 35;
-            codec->frame_size= 160;
-            break;
-        default:
-            break;
-        }
-        size -= 4;
-    } else {
-        /* Need the codec type */
-        codec->codec_id = aiff_codec_get_id(codec->bits_per_coded_sample);
-        codec->bits_per_coded_sample = av_get_bits_per_sample(codec->codec_id);
-    }
-
-    /* Block align needs to be computed in all cases, as the definition
-     * is specific to applications -> here we use the WAVE format definition */
-    if (!codec->block_align)
-        codec->block_align = (codec->bits_per_coded_sample * codec->channels) >> 3;
-
-    codec->bit_rate = (codec->frame_size ? codec->sample_rate/codec->frame_size :
-                       codec->sample_rate) * (codec->block_align << 3);
-
-    /* Chunk is over */
-    if (size)
-        url_fseek(pb, size, SEEK_CUR);
-
-    return num_frames;
-}
-
-static int aiff_probe(AVProbeData *p)
-{
-    /* check file header */
-    if (p->buf[0] == 'F' && p->buf[1] == 'O' &&
-        p->buf[2] == 'R' && p->buf[3] == 'M' &&
-        p->buf[8] == 'A' && p->buf[9] == 'I' &&
-        p->buf[10] == 'F' && (p->buf[11] == 'F' || p->buf[11] == 'C'))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-/* aiff input */
-static int aiff_read_header(AVFormatContext *s,
-                            AVFormatParameters *ap)
-{
-    int size, filesize;
-    int64_t offset = 0;
-    uint32_t tag;
-    unsigned version = AIFF_C_VERSION1;
-    ByteIOContext *pb = s->pb;
-    AVStream * st;
-    AIFFInputContext *aiff = s->priv_data;
-
-    /* check FORM header */
-    filesize = get_tag(pb, &tag);
-    if (filesize < 0 || tag != MKTAG('F', 'O', 'R', 'M'))
-        return AVERROR_INVALIDDATA;
-
-    /* AIFF data type */
-    tag = get_le32(pb);
-    if (tag == MKTAG('A', 'I', 'F', 'F'))       /* Got an AIFF file */
-        version = AIFF;
-    else if (tag != MKTAG('A', 'I', 'F', 'C'))  /* An AIFF-C file then */
-        return AVERROR_INVALIDDATA;
-
-    filesize -= 4;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    while (filesize > 0) {
-        /* parse different chunks */
-        size = get_tag(pb, &tag);
-        if (size < 0)
-            return size;
-
-        filesize -= size + 8;
-
-        switch (tag) {
-        case MKTAG('C', 'O', 'M', 'M'):     /* Common chunk */
-            /* Then for the complete header info */
-            st->nb_frames = get_aiff_header(pb, st->codec, size, version);
-            if (st->nb_frames < 0)
-                return st->nb_frames;
-            if (offset > 0) // COMM is after SSND
-                goto got_sound;
-            break;
-        case MKTAG('F', 'V', 'E', 'R'):     /* Version chunk */
-            version = get_be32(pb);
-            break;
-        case MKTAG('N', 'A', 'M', 'E'):     /* Sample name chunk */
-            get_meta(s, "title"    , size);
-            break;
-        case MKTAG('A', 'U', 'T', 'H'):     /* Author chunk */
-            get_meta(s, "author"   , size);
-            break;
-        case MKTAG('(', 'c', ')', ' '):     /* Copyright chunk */
-            get_meta(s, "copyright", size);
-            break;
-        case MKTAG('A', 'N', 'N', 'O'):     /* Annotation chunk */
-            get_meta(s, "comment"  , size);
-            break;
-        case MKTAG('S', 'S', 'N', 'D'):     /* Sampled sound chunk */
-            aiff->data_end = url_ftell(pb) + size;
-            offset = get_be32(pb);      /* Offset of sound data */
-            get_be32(pb);               /* BlockSize... don't care */
-            offset += url_ftell(pb);    /* Compute absolute data offset */
-            if (st->codec->block_align)    /* Assume COMM already parsed */
-                goto got_sound;
-            if (url_is_streamed(pb)) {
-                av_log(s, AV_LOG_ERROR, "file is not seekable\n");
-                return -1;
-            }
-            url_fskip(pb, size - 8);
-            break;
-        case MKTAG('w', 'a', 'v', 'e'):
-            if ((uint64_t)size > (1<<30))
-                return -1;
-            st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (!st->codec->extradata)
-                return AVERROR(ENOMEM);
-            st->codec->extradata_size = size;
-            get_buffer(pb, st->codec->extradata, size);
-            break;
-        default: /* Jump */
-            if (size & 1)   /* Always even aligned */
-                size++;
-            url_fskip (pb, size);
-        }
-    }
-
-    if (!st->codec->block_align) {
-        av_log(s, AV_LOG_ERROR, "could not find COMM tag\n");
-        return -1;
-    }
-
-got_sound:
-    /* Now positioned, get the sound data start and end */
-    if (st->nb_frames)
-        s->file_size = st->nb_frames * st->codec->block_align;
-
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-    st->start_time = 0;
-    st->duration = st->codec->frame_size ?
-        st->nb_frames * st->codec->frame_size : st->nb_frames;
-
-    /* Position the stream at the first block */
-    url_fseek(pb, offset, SEEK_SET);
-
-    return 0;
-}
-
-#define MAX_SIZE 4096
-
-static int aiff_read_packet(AVFormatContext *s,
-                            AVPacket *pkt)
-{
-    AVStream *st = s->streams[0];
-    AIFFInputContext *aiff = s->priv_data;
-    int64_t max_size;
-    int res, size;
-
-    /* calculate size of remaining data */
-    max_size = aiff->data_end - url_ftell(s->pb);
-    if (max_size <= 0)
-        return AVERROR_EOF;
-
-    /* Now for that packet */
-    if (st->codec->block_align >= 33) // GSM, QCLP, IMA4
-        size = st->codec->block_align;
-    else
-        size = (MAX_SIZE / st->codec->block_align) * st->codec->block_align;
-    size = FFMIN(max_size, size);
-    res = av_get_packet(s->pb, pkt, size);
-    if (res < 0)
-        return res;
-
-    /* Only one stream in an AIFF file */
-    pkt->stream_index = 0;
-    return 0;
-}
-
-AVInputFormat aiff_demuxer = {
-    "aiff",
-    NULL_IF_CONFIG_SMALL("Audio IFF"),
-    sizeof(AIFFInputContext),
-    aiff_probe,
-    aiff_read_header,
-    aiff_read_packet,
-    NULL,
-    pcm_read_seek,
-    .codec_tag= (const AVCodecTag* const []){ff_codec_aiff_tags, 0},
-};
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
deleted file mode 100644
index e3c6a0b..0000000
--- a/libavformat/aiffenc.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * AIFF/AIFF-C muxer
- * Copyright (c) 2006  Patrick Guimond
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "aiff.h"
-
-typedef struct {
-    int64_t form;
-    int64_t frames;
-    int64_t ssnd;
-} AIFFOutputContext;
-
-static int aiff_write_header(AVFormatContext *s)
-{
-    AIFFOutputContext *aiff = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *enc = s->streams[0]->codec;
-    AVExtFloat sample_rate;
-    int aifc = 0;
-
-    /* First verify if format is ok */
-    if (!enc->codec_tag)
-        return -1;
-    if (enc->codec_tag != MKTAG('N','O','N','E'))
-        aifc = 1;
-
-    /* FORM AIFF header */
-    put_tag(pb, "FORM");
-    aiff->form = url_ftell(pb);
-    put_be32(pb, 0);                    /* file length */
-    put_tag(pb, aifc ? "AIFC" : "AIFF");
-
-    if (aifc) { // compressed audio
-        enc->bits_per_coded_sample = 16;
-        if (!enc->block_align) {
-            av_log(s, AV_LOG_ERROR, "block align not set\n");
-            return -1;
-        }
-        /* Version chunk */
-        put_tag(pb, "FVER");
-        put_be32(pb, 4);
-        put_be32(pb, 0xA2805140);
-    }
-
-    /* Common chunk */
-    put_tag(pb, "COMM");
-    put_be32(pb, aifc ? 24 : 18); /* size */
-    put_be16(pb, enc->channels);  /* Number of channels */
-
-    aiff->frames = url_ftell(pb);
-    put_be32(pb, 0);              /* Number of frames */
-
-    if (!enc->bits_per_coded_sample)
-        enc->bits_per_coded_sample = av_get_bits_per_sample(enc->codec_id);
-    if (!enc->bits_per_coded_sample) {
-        av_log(s, AV_LOG_ERROR, "could not compute bits per sample\n");
-        return -1;
-    }
-    if (!enc->block_align)
-        enc->block_align = (enc->bits_per_coded_sample * enc->channels) >> 3;
-
-    put_be16(pb, enc->bits_per_coded_sample); /* Sample size */
-
-    sample_rate = av_dbl2ext((double)enc->sample_rate);
-    put_buffer(pb, (uint8_t*)&sample_rate, sizeof(sample_rate));
-
-    if (aifc) {
-        put_le32(pb, enc->codec_tag);
-        put_be16(pb, 0);
-    }
-
-    /* Sound data chunk */
-    put_tag(pb, "SSND");
-    aiff->ssnd = url_ftell(pb);         /* Sound chunk size */
-    put_be32(pb, 0);                    /* Sound samples data size */
-    put_be32(pb, 0);                    /* Data offset */
-    put_be32(pb, 0);                    /* Block-size (block align) */
-
-    av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
-
-    /* Data is starting here */
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static int aiff_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
-    return 0;
-}
-
-static int aiff_write_trailer(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    AIFFOutputContext *aiff = s->priv_data;
-    AVCodecContext *enc = s->streams[0]->codec;
-
-    /* Chunks sizes must be even */
-    int64_t file_size, end_size;
-    end_size = file_size = url_ftell(pb);
-    if (file_size & 1) {
-        put_byte(pb, 0);
-        end_size++;
-    }
-
-    if (!url_is_streamed(s->pb)) {
-        /* File length */
-        url_fseek(pb, aiff->form, SEEK_SET);
-        put_be32(pb, file_size - aiff->form - 4);
-
-        /* Number of sample frames */
-        url_fseek(pb, aiff->frames, SEEK_SET);
-        put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align);
-
-        /* Sound Data chunk size */
-        url_fseek(pb, aiff->ssnd, SEEK_SET);
-        put_be32(pb, file_size - aiff->ssnd - 4);
-
-        /* return to the end */
-        url_fseek(pb, end_size, SEEK_SET);
-
-        put_flush_packet(pb);
-    }
-
-    return 0;
-}
-
-AVOutputFormat aiff_muxer = {
-    "aiff",
-    NULL_IF_CONFIG_SMALL("Audio IFF"),
-    "audio/aiff",
-    "aif,aiff,afc,aifc",
-    sizeof(AIFFOutputContext),
-    CODEC_ID_PCM_S16BE,
-    CODEC_ID_NONE,
-    aiff_write_header,
-    aiff_write_packet,
-    aiff_write_trailer,
-    .codec_tag= (const AVCodecTag* const []){ff_codec_aiff_tags, 0},
-};
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
deleted file mode 100644
index 27a9555..0000000
--- a/libavformat/allformats.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Register all the formats and protocols
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "rtp.h"
-#include "rdt.h"
-
-#define REGISTER_MUXER(X,x) { \
-    extern AVOutputFormat x##_muxer; \
-    if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); }
-
-#define REGISTER_DEMUXER(X,x) { \
-    extern AVInputFormat x##_demuxer; \
-    if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }
-
-#define REGISTER_MUXDEMUX(X,x)  REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
-
-#define REGISTER_PROTOCOL(X,x) { \
-    extern URLProtocol x##_protocol; \
-    if(CONFIG_##X##_PROTOCOL) av_register_protocol(&x##_protocol); }
-
-void av_register_all(void)
-{
-    static int initialized;
-
-    if (initialized)
-        return;
-    initialized = 1;
-
-    avcodec_register_all();
-
-    /* (de)muxers */
-    REGISTER_DEMUXER  (AAC, aac);
-    REGISTER_MUXDEMUX (AC3, ac3);
-    REGISTER_MUXER    (ADTS, adts);
-    REGISTER_DEMUXER  (AEA, aea);
-    REGISTER_MUXDEMUX (AIFF, aiff);
-    REGISTER_MUXDEMUX (AMR, amr);
-    REGISTER_DEMUXER  (ANM, anm);
-    REGISTER_DEMUXER  (APC, apc);
-    REGISTER_DEMUXER  (APE, ape);
-    REGISTER_MUXDEMUX (ASF, asf);
-    REGISTER_MUXDEMUX (ASS, ass);
-    REGISTER_MUXER    (ASF_STREAM, asf_stream);
-    REGISTER_MUXDEMUX (AU, au);
-    REGISTER_MUXDEMUX (AVI, avi);
-    REGISTER_DEMUXER  (AVISYNTH, avisynth);
-    REGISTER_MUXER    (AVM2, avm2);
-    REGISTER_DEMUXER  (AVS, avs);
-    REGISTER_DEMUXER  (BETHSOFTVID, bethsoftvid);
-    REGISTER_DEMUXER  (BFI, bfi);
-    REGISTER_DEMUXER  (BINK, bink);
-    REGISTER_DEMUXER  (C93, c93);
-    REGISTER_DEMUXER  (CAF, caf);
-    REGISTER_DEMUXER  (CAVSVIDEO, cavsvideo);
-    REGISTER_DEMUXER  (CDG, cdg);
-    REGISTER_MUXER    (CRC, crc);
-    REGISTER_MUXDEMUX (DAUD, daud);
-    REGISTER_MUXDEMUX (DIRAC, dirac);
-    REGISTER_MUXDEMUX (DNXHD, dnxhd);
-    REGISTER_DEMUXER  (DSICIN, dsicin);
-    REGISTER_MUXDEMUX (DTS, dts);
-    REGISTER_MUXDEMUX (DV, dv);
-    REGISTER_DEMUXER  (DXA, dxa);
-    REGISTER_DEMUXER  (EA, ea);
-    REGISTER_DEMUXER  (EA_CDATA, ea_cdata);
-    REGISTER_MUXDEMUX (EAC3, eac3);
-    REGISTER_MUXDEMUX (FFM, ffm);
-    REGISTER_MUXDEMUX (FILMSTRIP, filmstrip);
-    REGISTER_MUXDEMUX (FLAC, flac);
-    REGISTER_DEMUXER  (FLIC, flic);
-    REGISTER_MUXDEMUX (FLV, flv);
-    REGISTER_DEMUXER  (FOURXM, fourxm);
-    REGISTER_MUXER    (FRAMECRC, framecrc);
-    REGISTER_MUXER    (GIF, gif);
-    REGISTER_DEMUXER  (GSM, gsm);
-    REGISTER_MUXDEMUX (GXF, gxf);
-    REGISTER_MUXDEMUX (H261, h261);
-    REGISTER_MUXDEMUX (H263, h263);
-    REGISTER_MUXDEMUX (H264, h264);
-    REGISTER_DEMUXER  (IDCIN, idcin);
-    REGISTER_DEMUXER  (IFF, iff);
-    REGISTER_MUXDEMUX (IMAGE2, image2);
-    REGISTER_MUXDEMUX (IMAGE2PIPE, image2pipe);
-    REGISTER_DEMUXER  (INGENIENT, ingenient);
-    REGISTER_DEMUXER  (IPMOVIE, ipmovie);
-    REGISTER_MUXER    (IPOD, ipod);
-    REGISTER_DEMUXER  (ISS, iss);
-    REGISTER_DEMUXER  (IV8, iv8);
-    REGISTER_DEMUXER  (LMLM4, lmlm4);
-    REGISTER_MUXDEMUX (M4V, m4v);
-    REGISTER_MUXDEMUX (MATROSKA, matroska);
-    REGISTER_MUXER    (MATROSKA_AUDIO, matroska_audio);
-    REGISTER_MUXDEMUX (MJPEG, mjpeg);
-    REGISTER_MUXDEMUX (MLP, mlp);
-    REGISTER_DEMUXER  (MM, mm);
-    REGISTER_MUXDEMUX (MMF, mmf);
-    REGISTER_MUXDEMUX (MOV, mov);
-    REGISTER_MUXER    (MP2, mp2);
-    REGISTER_MUXDEMUX (MP3, mp3);
-    REGISTER_MUXER    (MP4, mp4);
-    REGISTER_DEMUXER  (MPC, mpc);
-    REGISTER_DEMUXER  (MPC8, mpc8);
-    REGISTER_MUXER    (MPEG1SYSTEM, mpeg1system);
-    REGISTER_MUXER    (MPEG1VCD, mpeg1vcd);
-    REGISTER_MUXER    (MPEG1VIDEO, mpeg1video);
-    REGISTER_MUXER    (MPEG2DVD, mpeg2dvd);
-    REGISTER_MUXER    (MPEG2SVCD, mpeg2svcd);
-    REGISTER_MUXER    (MPEG2VIDEO, mpeg2video);
-    REGISTER_MUXER    (MPEG2VOB, mpeg2vob);
-    REGISTER_DEMUXER  (MPEGPS, mpegps);
-    REGISTER_MUXDEMUX (MPEGTS, mpegts);
-    REGISTER_DEMUXER  (MPEGTSRAW, mpegtsraw);
-    REGISTER_DEMUXER  (MPEGVIDEO, mpegvideo);
-    REGISTER_MUXER    (MPJPEG, mpjpeg);
-    REGISTER_DEMUXER  (MSNWC_TCP, msnwc_tcp);
-    REGISTER_DEMUXER  (MTV, mtv);
-    REGISTER_DEMUXER  (MVI, mvi);
-    REGISTER_MUXDEMUX (MXF, mxf);
-    REGISTER_MUXER    (MXF_D10, mxf_d10);
-    REGISTER_DEMUXER  (NC, nc);
-    REGISTER_DEMUXER  (NSV, nsv);
-    REGISTER_MUXER    (NULL, null);
-    REGISTER_MUXDEMUX (NUT, nut);
-    REGISTER_DEMUXER  (NUV, nuv);
-    REGISTER_MUXDEMUX (OGG, ogg);
-    REGISTER_DEMUXER  (OMA, oma);
-    REGISTER_MUXDEMUX (PCM_ALAW,  pcm_alaw);
-    REGISTER_MUXDEMUX (PCM_MULAW, pcm_mulaw);
-    REGISTER_MUXDEMUX (PCM_F64BE, pcm_f64be);
-    REGISTER_MUXDEMUX (PCM_F64LE, pcm_f64le);
-    REGISTER_MUXDEMUX (PCM_F32BE, pcm_f32be);
-    REGISTER_MUXDEMUX (PCM_F32LE, pcm_f32le);
-    REGISTER_MUXDEMUX (PCM_S32BE, pcm_s32be);
-    REGISTER_MUXDEMUX (PCM_S32LE, pcm_s32le);
-    REGISTER_MUXDEMUX (PCM_S24BE, pcm_s24be);
-    REGISTER_MUXDEMUX (PCM_S24LE, pcm_s24le);
-    REGISTER_MUXDEMUX (PCM_S16BE, pcm_s16be);
-    REGISTER_MUXDEMUX (PCM_S16LE, pcm_s16le);
-    REGISTER_MUXDEMUX (PCM_S8,    pcm_s8);
-    REGISTER_MUXDEMUX (PCM_U32BE, pcm_u32be);
-    REGISTER_MUXDEMUX (PCM_U32LE, pcm_u32le);
-    REGISTER_MUXDEMUX (PCM_U24BE, pcm_u24be);
-    REGISTER_MUXDEMUX (PCM_U24LE, pcm_u24le);
-    REGISTER_MUXDEMUX (PCM_U16BE, pcm_u16be);
-    REGISTER_MUXDEMUX (PCM_U16LE, pcm_u16le);
-    REGISTER_MUXDEMUX (PCM_U8,    pcm_u8);
-    REGISTER_MUXER    (PSP, psp);
-    REGISTER_DEMUXER  (PVA, pva);
-    REGISTER_DEMUXER  (QCP, qcp);
-    REGISTER_DEMUXER  (R3D, r3d);
-    REGISTER_MUXDEMUX (RAWVIDEO, rawvideo);
-    REGISTER_DEMUXER  (RL2, rl2);
-    REGISTER_MUXDEMUX (RM, rm);
-    REGISTER_MUXDEMUX (ROQ, roq);
-    REGISTER_DEMUXER  (RPL, rpl);
-    REGISTER_MUXER    (RTP, rtp);
-    REGISTER_MUXDEMUX (RTSP, rtsp);
-    REGISTER_DEMUXER  (SDP, sdp);
-#if CONFIG_SDP_DEMUXER
-    av_register_rtp_dynamic_payload_handlers();
-    av_register_rdt_dynamic_payload_handlers();
-#endif
-    REGISTER_DEMUXER  (SEGAFILM, segafilm);
-    REGISTER_DEMUXER  (SHORTEN, shorten);
-    REGISTER_DEMUXER  (SIFF, siff);
-    REGISTER_DEMUXER  (SMACKER, smacker);
-    REGISTER_DEMUXER  (SOL, sol);
-    REGISTER_MUXDEMUX (SOX, sox);
-    REGISTER_MUXER    (SPDIF, spdif);
-    REGISTER_DEMUXER  (STR, str);
-    REGISTER_MUXDEMUX (SWF, swf);
-    REGISTER_MUXER    (TG2, tg2);
-    REGISTER_MUXER    (TGP, tgp);
-    REGISTER_DEMUXER  (THP, thp);
-    REGISTER_DEMUXER  (TIERTEXSEQ, tiertexseq);
-    REGISTER_DEMUXER  (TMV, tmv);
-    REGISTER_MUXDEMUX (TRUEHD, truehd);
-    REGISTER_DEMUXER  (TTA, tta);
-    REGISTER_DEMUXER  (TXD, txd);
-    REGISTER_DEMUXER  (VC1, vc1);
-    REGISTER_MUXDEMUX (VC1T, vc1t);
-    REGISTER_DEMUXER  (VMD, vmd);
-    REGISTER_MUXDEMUX (VOC, voc);
-    REGISTER_DEMUXER  (VQF, vqf);
-    REGISTER_DEMUXER  (W64, w64);
-    REGISTER_MUXDEMUX (WAV, wav);
-    REGISTER_DEMUXER  (WC3, wc3);
-    REGISTER_MUXER    (WEBM, webm);
-    REGISTER_DEMUXER  (WSAUD, wsaud);
-    REGISTER_DEMUXER  (WSVQA, wsvqa);
-    REGISTER_DEMUXER  (WV, wv);
-    REGISTER_DEMUXER  (XA, xa);
-    REGISTER_DEMUXER  (YOP, yop);
-    REGISTER_MUXDEMUX (YUV4MPEGPIPE, yuv4mpegpipe);
-
-    /* external libraries */
-    REGISTER_MUXDEMUX (LIBNUT, libnut);
-
-    /* protocols */
-    REGISTER_PROTOCOL (FILE, file);
-    REGISTER_PROTOCOL (GOPHER, gopher);
-    REGISTER_PROTOCOL (HTTP, http);
-    REGISTER_PROTOCOL (PIPE, pipe);
-    REGISTER_PROTOCOL (RTMP, rtmp);
-#if CONFIG_LIBRTMP
-    REGISTER_PROTOCOL (RTMP, rtmpt);
-    REGISTER_PROTOCOL (RTMP, rtmpe);
-    REGISTER_PROTOCOL (RTMP, rtmpte);
-    REGISTER_PROTOCOL (RTMP, rtmps);
-#endif
-    REGISTER_PROTOCOL (RTP, rtp);
-    REGISTER_PROTOCOL (TCP, tcp);
-    REGISTER_PROTOCOL (UDP, udp);
-    REGISTER_PROTOCOL (CONCAT, concat);
-}
diff --git a/libavformat/amr.c b/libavformat/amr.c
deleted file mode 100644
index d16b4c0..0000000
--- a/libavformat/amr.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * amr file format
- * Copyright (c) 2001 ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
-Write and read amr data according to RFC3267, http://www.ietf.org/rfc/rfc3267.txt?number=3267
-
-Only mono files are supported.
-
-*/
-#include "avformat.h"
-
-static const char AMR_header [] = "#!AMR\n";
-static const char AMRWB_header [] = "#!AMR-WB\n";
-
-#if CONFIG_AMR_MUXER
-static int amr_write_header(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *enc = s->streams[0]->codec;
-
-    s->priv_data = NULL;
-
-    if (enc->codec_id == CODEC_ID_AMR_NB)
-    {
-        put_tag(pb, AMR_header);       /* magic number */
-    }
-    else if(enc->codec_id == CODEC_ID_AMR_WB)
-    {
-        put_tag(pb, AMRWB_header);       /* magic number */
-    }
-    else
-    {
-        return -1;
-    }
-    put_flush_packet(pb);
-    return 0;
-}
-
-static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
-    return 0;
-}
-#endif /* CONFIG_AMR_MUXER */
-
-static int amr_probe(AVProbeData *p)
-{
-    //Only check for "#!AMR" which could be amr-wb, amr-nb.
-    //This will also trigger multichannel files: "#!AMR_MC1.0\n" and
-    //"#!AMR-WB_MC1.0\n" (not supported)
-
-    if(memcmp(p->buf,AMR_header,5)==0)
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-/* amr input */
-static int amr_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    uint8_t header[9];
-
-    get_buffer(pb, header, 6);
-
-    st = av_new_stream(s, 0);
-    if (!st)
-    {
-        return AVERROR(ENOMEM);
-    }
-    if(memcmp(header,AMR_header,6)!=0)
-    {
-        get_buffer(pb, header+6, 3);
-        if(memcmp(header,AMRWB_header,9)!=0)
-        {
-            return -1;
-        }
-
-        st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b');
-        st->codec->codec_id = CODEC_ID_AMR_WB;
-        st->codec->sample_rate = 16000;
-    }
-    else
-    {
-        st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r');
-        st->codec->codec_id = CODEC_ID_AMR_NB;
-        st->codec->sample_rate = 8000;
-    }
-    st->codec->channels = 1;
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-    return 0;
-}
-
-static int amr_read_packet(AVFormatContext *s,
-                          AVPacket *pkt)
-{
-    AVCodecContext *enc = s->streams[0]->codec;
-    int read, size = 0, toc, mode;
-
-    if (url_feof(s->pb))
-    {
-        return AVERROR(EIO);
-    }
-
-//FIXME this is wrong, this should rather be in a AVParset
-    toc=get_byte(s->pb);
-    mode = (toc >> 3) & 0x0F;
-
-    if (enc->codec_id == CODEC_ID_AMR_NB)
-    {
-        static const uint8_t packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
-
-        size=packed_size[mode]+1;
-    }
-    else if(enc->codec_id == CODEC_ID_AMR_WB)
-    {
-        static uint8_t packed_size[16] = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1};
-
-        size=packed_size[mode];
-    }
-    else
-    {
-        assert(0);
-    }
-
-    if ( (size==0) || av_new_packet(pkt, size))
-    {
-        return AVERROR(EIO);
-    }
-
-    pkt->stream_index = 0;
-    pkt->pos= url_ftell(s->pb);
-    pkt->data[0]=toc;
-    pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
-    read = get_buffer(s->pb, pkt->data+1, size-1);
-
-    if (read != size-1)
-    {
-        av_free_packet(pkt);
-        return AVERROR(EIO);
-    }
-
-    return 0;
-}
-
-#if CONFIG_AMR_DEMUXER
-AVInputFormat amr_demuxer = {
-    "amr",
-    NULL_IF_CONFIG_SMALL("3GPP AMR file format"),
-    0, /*priv_data_size*/
-    amr_probe,
-    amr_read_header,
-    amr_read_packet,
-    NULL,
-};
-#endif
-
-#if CONFIG_AMR_MUXER
-AVOutputFormat amr_muxer = {
-    "amr",
-    NULL_IF_CONFIG_SMALL("3GPP AMR file format"),
-    "audio/amr",
-    "amr",
-    0,
-    CODEC_ID_AMR_NB,
-    CODEC_ID_NONE,
-    amr_write_header,
-    amr_write_packet,
-};
-#endif
diff --git a/libavformat/anm.c b/libavformat/anm.c
deleted file mode 100644
index ba77e18..0000000
--- a/libavformat/anm.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Deluxe Paint Animation demuxer
- * Copyright (c) 2009 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Deluxe Paint Animation demuxer
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-typedef struct {
-    int base_record;
-    unsigned int nb_records;
-    int size;
-} Page;
-
-typedef struct {
-    unsigned int nb_pages;    /** total pages in file */
-    unsigned int nb_records;  /** total records in file */
-    int page_table_offset;
-#define MAX_PAGES  256        /** Deluxe Paint hardcoded value */
-    Page pt[MAX_PAGES];       /** page table */
-    int page;                 /** current page (or AVERROR_xxx code) */
-    int record;               /** current record (with in page) */
-} AnmDemuxContext;
-
-#define LPF_TAG  MKTAG('L','P','F',' ')
-#define ANIM_TAG MKTAG('A','N','I','M')
-
-static int probe(AVProbeData *p)
-{
-    /* verify tags and video dimensions */
-    if (AV_RL32(&p->buf[0])  == LPF_TAG &&
-        AV_RL32(&p->buf[16]) == ANIM_TAG &&
-        AV_RL16(&p->buf[20]) && AV_RL16(&p->buf[22]))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-/**
- * @return page containing the requested record or AVERROR_XXX
- */
-static int find_record(const AnmDemuxContext *anm, int record)
-{
-    int i;
-
-    if (record >= anm->nb_records)
-        return AVERROR_EOF;
-
-    for (i = 0; i < MAX_PAGES; i++) {
-        const Page *p = &anm->pt[i];
-        if (p->nb_records > 0 && record >= p->base_record && record < p->base_record + p->nb_records)
-            return i;
-    }
-
-    return AVERROR_INVALIDDATA;
-}
-
-static int read_header(AVFormatContext *s,
-                       AVFormatParameters *ap)
-{
-    AnmDemuxContext *anm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    int i, ret;
-
-    url_fskip(pb, 4); /* magic number */
-    if (get_le16(pb) != MAX_PAGES) {
-        av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    anm->nb_pages   = get_le16(pb);
-    anm->nb_records = get_le32(pb);
-    url_fskip(pb, 2); /* max records per page */
-    anm->page_table_offset = get_le16(pb);
-    if (get_le32(pb) != ANIM_TAG)
-        return AVERROR_INVALIDDATA;
-
-    /* video stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_ANM;
-    st->codec->codec_tag  = 0; /* no fourcc */
-    st->codec->width      = get_le16(pb);
-    st->codec->height     = get_le16(pb);
-    if (get_byte(pb) != 0)
-        goto invalid;
-    url_fskip(pb, 1); /* frame rate multiplier info */
-
-    /* ignore last delta record (used for looping) */
-    if (get_byte(pb))  /* has_last_delta */
-        anm->nb_records = FFMAX(anm->nb_records - 1, 0);
-
-    url_fskip(pb, 1); /* last_delta_valid */
-
-    if (get_byte(pb) != 0)
-        goto invalid;
-
-    if (get_byte(pb) != 1)
-        goto invalid;
-
-    url_fskip(pb, 1); /* other recs per frame */
-
-    if (get_byte(pb) != 1)
-        goto invalid;
-
-    url_fskip(pb, 32); /* record_types */
-    st->nb_frames = get_le32(pb);
-    av_set_pts_info(st, 64, 1, get_le16(pb));
-    url_fskip(pb, 58);
-
-    /* color cycling and palette data */
-    st->codec->extradata_size = 16*8 + 4*256;
-    st->codec->extradata      = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata) {
-        ret = AVERROR(ENOMEM);
-        goto close_and_return;
-    }
-    ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
-    if (ret < 0)
-        goto close_and_return;
-
-    /* read page table */
-    ret = url_fseek(pb, anm->page_table_offset, SEEK_SET);
-    if (ret < 0)
-        goto close_and_return;
-
-    for (i = 0; i < MAX_PAGES; i++) {
-        Page *p = &anm->pt[i];
-        p->base_record = get_le16(pb);
-        p->nb_records  = get_le16(pb);
-        p->size        = get_le16(pb);
-    }
-
-    /* find page of first frame */
-    anm->page = find_record(anm, 0);
-    if (anm->page < 0) {
-        ret = anm->page;
-        goto close_and_return;
-    }
-
-    anm->record = -1;
-    return 0;
-
-invalid:
-    av_log_ask_for_sample(s, NULL);
-    ret = AVERROR_INVALIDDATA;
-
-close_and_return:
-    av_close_input_stream(s);
-    return ret;
-}
-
-static int read_packet(AVFormatContext *s,
-                       AVPacket *pkt)
-{
-    AnmDemuxContext *anm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    Page *p;
-    int tmp, record_size;
-
-    if (url_feof(s->pb))
-        return AVERROR(EIO);
-
-    if (anm->page < 0)
-        return anm->page;
-
-repeat:
-    p = &anm->pt[anm->page];
-
-    /* parse page header */
-    if (anm->record < 0) {
-        url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
-        url_fskip(pb, 8 + 2*p->nb_records);
-        anm->record = 0;
-    }
-
-    /* if we have fetched all records in this page, then find the
-       next page and repeat */
-    if (anm->record >= p->nb_records) {
-        anm->page = find_record(anm, p->base_record + p->nb_records);
-        if (anm->page < 0)
-            return anm->page;
-        anm->record = -1;
-        goto repeat;
-    }
-
-    /* fetch record size */
-    tmp = url_ftell(pb);
-    url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
-              8 + anm->record * 2, SEEK_SET);
-    record_size = get_le16(pb);
-    url_fseek(pb, tmp, SEEK_SET);
-
-    /* fetch record */
-    pkt->size = av_get_packet(s->pb, pkt, record_size);
-    if (pkt->size < 0)
-        return pkt->size;
-    if (p->base_record + anm->record == 0)
-        pkt->flags |= AV_PKT_FLAG_KEY;
-
-    anm->record++;
-    return 0;
-}
-
-AVInputFormat anm_demuxer = {
-    "anm",
-    NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
-    sizeof(AnmDemuxContext),
-    probe,
-    read_header,
-    read_packet,
-};
diff --git a/libavformat/apc.c b/libavformat/apc.c
deleted file mode 100644
index 9b4a8ad..0000000
--- a/libavformat/apc.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * CRYO APC audio format demuxer
- * Copyright (c) 2007 Anssi Hannula <anssi.hannula at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-#include "avformat.h"
-
-static int apc_probe(AVProbeData *p)
-{
-    if (!strncmp(p->buf, "CRYO_APC", 8))
-        return AVPROBE_SCORE_MAX;
-
-    return 0;
-}
-
-static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-
-    get_le32(pb); /* CRYO */
-    get_le32(pb); /* _APC */
-    get_le32(pb); /* 1.20 */
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
-
-    get_le32(pb); /* number of samples */
-    st->codec->sample_rate = get_le32(pb);
-
-    st->codec->extradata_size = 2 * 4;
-    st->codec->extradata = av_malloc(st->codec->extradata_size +
-                                     FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata)
-        return AVERROR(ENOMEM);
-
-    /* initial predictor values for adpcm decoder */
-    get_buffer(pb, st->codec->extradata, 2 * 4);
-
-    st->codec->channels = 1;
-    if (get_le32(pb))
-        st->codec->channels = 2;
-
-    st->codec->bits_per_coded_sample = 4;
-    st->codec->bit_rate = st->codec->bits_per_coded_sample * st->codec->channels
-                          * st->codec->sample_rate;
-    st->codec->block_align = 1;
-
-    return 0;
-}
-
-#define MAX_READ_SIZE 4096
-
-static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0)
-        return AVERROR(EIO);
-    pkt->stream_index = 0;
-    return 0;
-}
-
-AVInputFormat apc_demuxer = {
-    "apc",
-    NULL_IF_CONFIG_SMALL("CRYO APC format"),
-    0,
-    apc_probe,
-    apc_read_header,
-    apc_read_packet,
-};
diff --git a/libavformat/ape.c b/libavformat/ape.c
deleted file mode 100644
index 0ebc307..0000000
--- a/libavformat/ape.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Monkey's Audio APE demuxer
- * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
- *  based upon libdemac from Dave Chapman.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "apetag.h"
-
-#define ENABLE_DEBUG 0
-
-/* The earliest and latest file formats supported by this library */
-#define APE_MIN_VERSION 3950
-#define APE_MAX_VERSION 3990
-
-#define MAC_FORMAT_FLAG_8_BIT                 1 // is 8-bit [OBSOLETE]
-#define MAC_FORMAT_FLAG_CRC                   2 // uses the new CRC32 error detection [OBSOLETE]
-#define MAC_FORMAT_FLAG_HAS_PEAK_LEVEL        4 // uint32 nPeakLevel after the header [OBSOLETE]
-#define MAC_FORMAT_FLAG_24_BIT                8 // is 24-bit [OBSOLETE]
-#define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS    16 // has the number of seek elements after the peak level
-#define MAC_FORMAT_FLAG_CREATE_WAV_HEADER    32 // create the wave header on decompression (not stored)
-
-#define MAC_SUBFRAME_SIZE 4608
-
-#define APE_EXTRADATA_SIZE 6
-
-typedef struct {
-    int64_t pos;
-    int nblocks;
-    int size;
-    int skip;
-    int64_t pts;
-} APEFrame;
-
-typedef struct {
-    /* Derived fields */
-    uint32_t junklength;
-    uint32_t firstframe;
-    uint32_t totalsamples;
-    int currentframe;
-    APEFrame *frames;
-
-    /* Info from Descriptor Block */
-    char magic[4];
-    int16_t fileversion;
-    int16_t padding1;
-    uint32_t descriptorlength;
-    uint32_t headerlength;
-    uint32_t seektablelength;
-    uint32_t wavheaderlength;
-    uint32_t audiodatalength;
-    uint32_t audiodatalength_high;
-    uint32_t wavtaillength;
-    uint8_t md5[16];
-
-    /* Info from Header Block */
-    uint16_t compressiontype;
-    uint16_t formatflags;
-    uint32_t blocksperframe;
-    uint32_t finalframeblocks;
-    uint32_t totalframes;
-    uint16_t bps;
-    uint16_t channels;
-    uint32_t samplerate;
-
-    /* Seektable */
-    uint32_t *seektable;
-} APEContext;
-
-static int ape_probe(AVProbeData * p)
-{
-    if (p->buf[0] == 'M' && p->buf[1] == 'A' && p->buf[2] == 'C' && p->buf[3] == ' ')
-        return AVPROBE_SCORE_MAX;
-
-    return 0;
-}
-
-static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx)
-{
-#if ENABLE_DEBUG
-    int i;
-
-    av_log(s, AV_LOG_DEBUG, "Descriptor Block:\n\n");
-    av_log(s, AV_LOG_DEBUG, "magic                = \"%c%c%c%c\"\n", ape_ctx->magic[0], ape_ctx->magic[1], ape_ctx->magic[2], ape_ctx->magic[3]);
-    av_log(s, AV_LOG_DEBUG, "fileversion          = %d\n", ape_ctx->fileversion);
-    av_log(s, AV_LOG_DEBUG, "descriptorlength     = %d\n", ape_ctx->descriptorlength);
-    av_log(s, AV_LOG_DEBUG, "headerlength         = %d\n", ape_ctx->headerlength);
-    av_log(s, AV_LOG_DEBUG, "seektablelength      = %d\n", ape_ctx->seektablelength);
-    av_log(s, AV_LOG_DEBUG, "wavheaderlength      = %d\n", ape_ctx->wavheaderlength);
-    av_log(s, AV_LOG_DEBUG, "audiodatalength      = %d\n", ape_ctx->audiodatalength);
-    av_log(s, AV_LOG_DEBUG, "audiodatalength_high = %d\n", ape_ctx->audiodatalength_high);
-    av_log(s, AV_LOG_DEBUG, "wavtaillength        = %d\n", ape_ctx->wavtaillength);
-    av_log(s, AV_LOG_DEBUG, "md5                  = ");
-    for (i = 0; i < 16; i++)
-         av_log(s, AV_LOG_DEBUG, "%02x", ape_ctx->md5[i]);
-    av_log(s, AV_LOG_DEBUG, "\n");
-
-    av_log(s, AV_LOG_DEBUG, "\nHeader Block:\n\n");
-
-    av_log(s, AV_LOG_DEBUG, "compressiontype      = %d\n", ape_ctx->compressiontype);
-    av_log(s, AV_LOG_DEBUG, "formatflags          = %d\n", ape_ctx->formatflags);
-    av_log(s, AV_LOG_DEBUG, "blocksperframe       = %d\n", ape_ctx->blocksperframe);
-    av_log(s, AV_LOG_DEBUG, "finalframeblocks     = %d\n", ape_ctx->finalframeblocks);
-    av_log(s, AV_LOG_DEBUG, "totalframes          = %d\n", ape_ctx->totalframes);
-    av_log(s, AV_LOG_DEBUG, "bps                  = %d\n", ape_ctx->bps);
-    av_log(s, AV_LOG_DEBUG, "channels             = %d\n", ape_ctx->channels);
-    av_log(s, AV_LOG_DEBUG, "samplerate           = %d\n", ape_ctx->samplerate);
-
-    av_log(s, AV_LOG_DEBUG, "\nSeektable\n\n");
-    if ((ape_ctx->seektablelength / sizeof(uint32_t)) != ape_ctx->totalframes) {
-        av_log(s, AV_LOG_DEBUG, "No seektable\n");
-    } else {
-        for (i = 0; i < ape_ctx->seektablelength / sizeof(uint32_t); i++) {
-            if (i < ape_ctx->totalframes - 1) {
-                av_log(s, AV_LOG_DEBUG, "%8d   %d (%d bytes)\n", i, ape_ctx->seektable[i], ape_ctx->seektable[i + 1] - ape_ctx->seektable[i]);
-            } else {
-                av_log(s, AV_LOG_DEBUG, "%8d   %d\n", i, ape_ctx->seektable[i]);
-            }
-        }
-    }
-
-    av_log(s, AV_LOG_DEBUG, "\nFrames\n\n");
-    for (i = 0; i < ape_ctx->totalframes; i++)
-        av_log(s, AV_LOG_DEBUG, "%8d   %8lld %8d (%d samples)\n", i, ape_ctx->frames[i].pos, ape_ctx->frames[i].size, ape_ctx->frames[i].nblocks);
-
-    av_log(s, AV_LOG_DEBUG, "\nCalculated information:\n\n");
-    av_log(s, AV_LOG_DEBUG, "junklength           = %d\n", ape_ctx->junklength);
-    av_log(s, AV_LOG_DEBUG, "firstframe           = %d\n", ape_ctx->firstframe);
-    av_log(s, AV_LOG_DEBUG, "totalsamples         = %d\n", ape_ctx->totalsamples);
-#endif
-}
-
-static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
-{
-    ByteIOContext *pb = s->pb;
-    APEContext *ape = s->priv_data;
-    AVStream *st;
-    uint32_t tag;
-    int i;
-    int total_blocks;
-    int64_t pts;
-
-    /* TODO: Skip any leading junk such as id3v2 tags */
-    ape->junklength = 0;
-
-    tag = get_le32(pb);
-    if (tag != MKTAG('M', 'A', 'C', ' '))
-        return -1;
-
-    ape->fileversion = get_le16(pb);
-
-    if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {
-        av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10);
-        return -1;
-    }
-
-    if (ape->fileversion >= 3980) {
-        ape->padding1             = get_le16(pb);
-        ape->descriptorlength     = get_le32(pb);
-        ape->headerlength         = get_le32(pb);
-        ape->seektablelength      = get_le32(pb);
-        ape->wavheaderlength      = get_le32(pb);
-        ape->audiodatalength      = get_le32(pb);
-        ape->audiodatalength_high = get_le32(pb);
-        ape->wavtaillength        = get_le32(pb);
-        get_buffer(pb, ape->md5, 16);
-
-        /* Skip any unknown bytes at the end of the descriptor.
-           This is for future compatibility */
-        if (ape->descriptorlength > 52)
-            url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
-
-        /* Read header data */
-        ape->compressiontype      = get_le16(pb);
-        ape->formatflags          = get_le16(pb);
-        ape->blocksperframe       = get_le32(pb);
-        ape->finalframeblocks     = get_le32(pb);
-        ape->totalframes          = get_le32(pb);
-        ape->bps                  = get_le16(pb);
-        ape->channels             = get_le16(pb);
-        ape->samplerate           = get_le32(pb);
-    } else {
-        ape->descriptorlength = 0;
-        ape->headerlength = 32;
-
-        ape->compressiontype      = get_le16(pb);
-        ape->formatflags          = get_le16(pb);
-        ape->channels             = get_le16(pb);
-        ape->samplerate           = get_le32(pb);
-        ape->wavheaderlength      = get_le32(pb);
-        ape->wavtaillength        = get_le32(pb);
-        ape->totalframes          = get_le32(pb);
-        ape->finalframeblocks     = get_le32(pb);
-
-        if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
-            url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
-            ape->headerlength += 4;
-        }
-
-        if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {
-            ape->seektablelength = get_le32(pb);
-            ape->headerlength += 4;
-            ape->seektablelength *= sizeof(int32_t);
-        } else
-            ape->seektablelength = ape->totalframes * sizeof(int32_t);
-
-        if (ape->formatflags & MAC_FORMAT_FLAG_8_BIT)
-            ape->bps = 8;
-        else if (ape->formatflags & MAC_FORMAT_FLAG_24_BIT)
-            ape->bps = 24;
-        else
-            ape->bps = 16;
-
-        if (ape->fileversion >= 3950)
-            ape->blocksperframe = 73728 * 4;
-        else if (ape->fileversion >= 3900 || (ape->fileversion >= 3800  && ape->compressiontype >= 4000))
-            ape->blocksperframe = 73728;
-        else
-            ape->blocksperframe = 9216;
-
-        /* Skip any stored wav header */
-        if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
-            url_fskip(pb, ape->wavheaderlength);
-    }
-
-    if(!ape->totalframes){
-        av_log(s, AV_LOG_ERROR, "No frames in the file!\n");
-        return AVERROR(EINVAL);
-    }
-    if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
-        av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
-        return -1;
-    }
-    ape->frames       = av_malloc(ape->totalframes * sizeof(APEFrame));
-    if(!ape->frames)
-        return AVERROR(ENOMEM);
-    ape->firstframe   = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength;
-    ape->currentframe = 0;
-
-
-    ape->totalsamples = ape->finalframeblocks;
-    if (ape->totalframes > 1)
-        ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1);
-
-    if (ape->seektablelength > 0) {
-        ape->seektable = av_malloc(ape->seektablelength);
-        for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
-            ape->seektable[i] = get_le32(pb);
-    }
-
-    ape->frames[0].pos     = ape->firstframe;
-    ape->frames[0].nblocks = ape->blocksperframe;
-    ape->frames[0].skip    = 0;
-    for (i = 1; i < ape->totalframes; i++) {
-        ape->frames[i].pos      = ape->seektable[i]; //ape->frames[i-1].pos + ape->blocksperframe;
-        ape->frames[i].nblocks  = ape->blocksperframe;
-        ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos;
-        ape->frames[i].skip     = (ape->frames[i].pos - ape->frames[0].pos) & 3;
-    }
-    ape->frames[ape->totalframes - 1].size    = ape->finalframeblocks * 4;
-    ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks;
-
-    for (i = 0; i < ape->totalframes; i++) {
-        if(ape->frames[i].skip){
-            ape->frames[i].pos  -= ape->frames[i].skip;
-            ape->frames[i].size += ape->frames[i].skip;
-        }
-        ape->frames[i].size = (ape->frames[i].size + 3) & ~3;
-    }
-
-
-    ape_dumpinfo(s, ape);
-
-    /* try to read APE tags */
-    if (!url_is_streamed(pb)) {
-        ff_ape_parse_tag(s);
-        url_fseek(pb, 0, SEEK_SET);
-    }
-
-    av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype);
-
-    /* now we are ready: build format streams */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-
-    total_blocks = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks;
-
-    st->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id        = CODEC_ID_APE;
-    st->codec->codec_tag       = MKTAG('A', 'P', 'E', ' ');
-    st->codec->channels        = ape->channels;
-    st->codec->sample_rate     = ape->samplerate;
-    st->codec->bits_per_coded_sample = ape->bps;
-    st->codec->frame_size      = MAC_SUBFRAME_SIZE;
-
-    st->nb_frames = ape->totalframes;
-    st->start_time = 0;
-    st->duration  = total_blocks / MAC_SUBFRAME_SIZE;
-    av_set_pts_info(st, 64, MAC_SUBFRAME_SIZE, ape->samplerate);
-
-    st->codec->extradata = av_malloc(APE_EXTRADATA_SIZE);
-    st->codec->extradata_size = APE_EXTRADATA_SIZE;
-    AV_WL16(st->codec->extradata + 0, ape->fileversion);
-    AV_WL16(st->codec->extradata + 2, ape->compressiontype);
-    AV_WL16(st->codec->extradata + 4, ape->formatflags);
-
-    pts = 0;
-    for (i = 0; i < ape->totalframes; i++) {
-        ape->frames[i].pts = pts;
-        av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME);
-        pts += ape->blocksperframe / MAC_SUBFRAME_SIZE;
-    }
-
-    return 0;
-}
-
-static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
-{
-    int ret;
-    int nblocks;
-    APEContext *ape = s->priv_data;
-    uint32_t extra_size = 8;
-
-    if (url_feof(s->pb))
-        return AVERROR(EIO);
-    if (ape->currentframe > ape->totalframes)
-        return AVERROR(EIO);
-
-    url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
-
-    /* Calculate how many blocks there are in this frame */
-    if (ape->currentframe == (ape->totalframes - 1))
-        nblocks = ape->finalframeblocks;
-    else
-        nblocks = ape->blocksperframe;
-
-    if (av_new_packet(pkt,  ape->frames[ape->currentframe].size + extra_size) < 0)
-        return AVERROR(ENOMEM);
-
-    AV_WL32(pkt->data    , nblocks);
-    AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
-    ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
-
-    pkt->pts = ape->frames[ape->currentframe].pts;
-    pkt->stream_index = 0;
-
-    /* note: we need to modify the packet size here to handle the last
-       packet */
-    pkt->size = ret + extra_size;
-
-    ape->currentframe++;
-
-    return 0;
-}
-
-static int ape_read_close(AVFormatContext * s)
-{
-    APEContext *ape = s->priv_data;
-
-    av_freep(&ape->frames);
-    av_freep(&ape->seektable);
-    return 0;
-}
-
-static int ape_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st = s->streams[stream_index];
-    APEContext *ape = s->priv_data;
-    int index = av_index_search_timestamp(st, timestamp, flags);
-
-    if (index < 0)
-        return -1;
-
-    ape->currentframe = index;
-    return 0;
-}
-
-AVInputFormat ape_demuxer = {
-    "ape",
-    NULL_IF_CONFIG_SMALL("Monkey's Audio"),
-    sizeof(APEContext),
-    ape_probe,
-    ape_read_header,
-    ape_read_packet,
-    ape_read_close,
-    ape_read_seek,
-    .extensions = "ape,apl,mac"
-};
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
deleted file mode 100644
index d30c132..0000000
--- a/libavformat/apetag.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * APE tag handling
- * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
- *  based upon libdemac from Dave Chapman.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "apetag.h"
-
-#define ENABLE_DEBUG 0
-
-#define APE_TAG_VERSION               2000
-#define APE_TAG_FOOTER_BYTES          32
-#define APE_TAG_FLAG_CONTAINS_HEADER  (1 << 31)
-#define APE_TAG_FLAG_IS_HEADER        (1 << 29)
-
-static int ape_tag_read_field(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    uint8_t key[1024], *value;
-    uint32_t size, flags;
-    int i, c;
-
-    size = get_le32(pb);  /* field size */
-    flags = get_le32(pb); /* field flags */
-    for (i = 0; i < sizeof(key) - 1; i++) {
-        c = get_byte(pb);
-        if (c < 0x20 || c > 0x7E)
-            break;
-        else
-            key[i] = c;
-    }
-    key[i] = 0;
-    if (c != 0) {
-        av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key);
-        return -1;
-    }
-    if (size >= UINT_MAX)
-        return -1;
-    value = av_malloc(size+1);
-    if (!value)
-        return AVERROR(ENOMEM);
-    get_buffer(pb, value, size);
-    value[size] = 0;
-    av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
-    return 0;
-}
-
-void ff_ape_parse_tag(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    int file_size = url_fsize(pb);
-    uint32_t val, fields, tag_bytes;
-    uint8_t buf[8];
-    int i;
-
-    if (file_size < APE_TAG_FOOTER_BYTES)
-        return;
-
-    url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
-
-    get_buffer(pb, buf, 8);    /* APETAGEX */
-    if (strncmp(buf, "APETAGEX", 8)) {
-        return;
-    }
-
-    val = get_le32(pb);        /* APE tag version */
-    if (val > APE_TAG_VERSION) {
-        av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION);
-        return;
-    }
-
-    tag_bytes = get_le32(pb);  /* tag size */
-    if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {
-        av_log(s, AV_LOG_ERROR, "Tag size is way too big\n");
-        return;
-    }
-
-    fields = get_le32(pb);     /* number of fields */
-    if (fields > 65536) {
-        av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
-        return;
-    }
-
-    val = get_le32(pb);        /* flags */
-    if (val & APE_TAG_FLAG_IS_HEADER) {
-        av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
-        return;
-    }
-
-    url_fseek(pb, file_size - tag_bytes, SEEK_SET);
-
-    for (i=0; i<fields; i++)
-        if (ape_tag_read_field(s) < 0) break;
-}
diff --git a/libavformat/apetag.h b/libavformat/apetag.h
deleted file mode 100644
index 8aaef68..0000000
--- a/libavformat/apetag.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * APE tag handling
- * Copyright (c) 2007 Benjamin Zores <ben at geexbox.org>
- *  based upon libdemac from Dave Chapman.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_APETAG_H
-#define AVFORMAT_APETAG_H
-
-#include "avformat.h"
-
-/**
- * Read and parse an APE tag
- */
-void ff_ape_parse_tag(AVFormatContext *s);
-
-#endif /* AVFORMAT_ID3V2_H */
diff --git a/libavformat/asf.c b/libavformat/asf.c
deleted file mode 100644
index e25ac03..0000000
--- a/libavformat/asf.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "asf.h"
-
-
-const ff_asf_guid ff_asf_header = {
-    0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C
-};
-
-const ff_asf_guid ff_asf_file_header = {
-    0xA1, 0xDC, 0xAB, 0x8C, 0x47, 0xA9, 0xCF, 0x11, 0x8E, 0xE4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65
-};
-
-const ff_asf_guid ff_asf_stream_header = {
-    0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65
-};
-
-const ff_asf_guid ff_asf_ext_stream_header = {
-    0xCB, 0xA5, 0xE6, 0x14, 0x72, 0xC6, 0x32, 0x43, 0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A
-};
-
-const ff_asf_guid ff_asf_audio_stream = {
-    0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B
-};
-
-const ff_asf_guid ff_asf_audio_conceal_none = {
-    // 0x40, 0xa4, 0xf1, 0x49, 0x4ece, 0x11d0, 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6
-    // New value lifted from avifile
-    0x00, 0x57, 0xfb, 0x20, 0x55, 0x5B, 0xCF, 0x11, 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b
-};
-
-const ff_asf_guid ff_asf_audio_conceal_spread = {
-     0x50, 0xCD, 0xC3, 0xBF, 0x8F, 0x61, 0xCF, 0x11, 0x8B, 0xB2, 0x00, 0xAA, 0x00, 0xB4, 0xE2, 0x20
-};
-
-const ff_asf_guid ff_asf_video_stream = {
-    0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B
-};
-
-const ff_asf_guid ff_asf_video_conceal_none = {
-    0x00, 0x57, 0xFB, 0x20, 0x55, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B
-};
-
-const ff_asf_guid ff_asf_command_stream = {
-    0xC0, 0xCF, 0xDA, 0x59, 0xE6, 0x59, 0xD0, 0x11, 0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6
-};
-
-const ff_asf_guid ff_asf_comment_header = {
-    0x33, 0x26, 0xb2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
-};
-
-const ff_asf_guid ff_asf_codec_comment_header = {
-    0x40, 0x52, 0xD1, 0x86, 0x1D, 0x31, 0xD0, 0x11, 0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6
-};
-const ff_asf_guid ff_asf_codec_comment1_header = {
-    0x41, 0x52, 0xd1, 0x86, 0x1D, 0x31, 0xD0, 0x11, 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6
-};
-
-const ff_asf_guid ff_asf_data_header = {
-    0x36, 0x26, 0xb2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c
-};
-
-const ff_asf_guid ff_asf_head1_guid = {
-    0xb5, 0x03, 0xbf, 0x5f, 0x2E, 0xA9, 0xCF, 0x11, 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65
-};
-
-const ff_asf_guid ff_asf_head2_guid = {
-    0x11, 0xd2, 0xd3, 0xab, 0xBA, 0xA9, 0xCF, 0x11, 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65
-};
-
-const ff_asf_guid ff_asf_extended_content_header = {
-        0x40, 0xA4, 0xD0, 0xD2, 0x07, 0xE3, 0xD2, 0x11, 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50
-};
-
-const ff_asf_guid ff_asf_simple_index_header = {
-        0x90, 0x08, 0x00, 0x33, 0xB1, 0xE5, 0xCF, 0x11, 0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB
-};
-
-const ff_asf_guid ff_asf_ext_stream_embed_stream_header = {
-        0xe2, 0x65, 0xfb, 0x3a, 0xEF, 0x47, 0xF2, 0x40, 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43
-};
-
-const ff_asf_guid ff_asf_ext_stream_audio_stream = {
-        0x9d, 0x8c, 0x17, 0x31, 0xE1, 0x03, 0x28, 0x45, 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03
-};
-
-const ff_asf_guid ff_asf_metadata_header = {
-        0xea, 0xcb, 0xf8, 0xc5, 0xaf, 0x5b, 0x77, 0x48, 0x84, 0x67, 0xaa, 0x8c, 0x44, 0xfa, 0x4c, 0xca
-};
-
-const ff_asf_guid ff_asf_marker_header = {
-        0x01, 0xCD, 0x87, 0xF4, 0x51, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65
-};
-
-/* I am not a number !!! This GUID is the one found on the PC used to
-   generate the stream */
-const ff_asf_guid ff_asf_my_guid = {
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-const ff_asf_guid ff_asf_language_guid = {
-    0xa9, 0x46, 0x43, 0x7c, 0xe0, 0xef, 0xfc, 0x4b, 0xb2, 0x29, 0x39, 0x3e, 0xde, 0x41, 0x5c, 0x85
-};
-
-const ff_asf_guid ff_asf_content_encryption = {
-    0xfb, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e
-};
-
-const ff_asf_guid ff_asf_ext_content_encryption = {
-    0x14, 0xe6, 0x8a, 0x29, 0x22, 0x26, 0x17, 0x4c, 0xb9, 0x35, 0xda, 0xe0, 0x7e, 0xe9, 0x28, 0x9c
-};
-
-const ff_asf_guid ff_asf_digital_signature = {
-    0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e
-};
-
-/* List of official tags at http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */
-const AVMetadataConv ff_asf_metadata_conv[] = {
-    { "WM/AlbumArtist"     , "album_artist"},
-    { "WM/AlbumTitle"      , "album"       },
-    { "Author"             , "artist"      },
-    { "Description"        , "comment"     },
-    { "WM/Composer"        , "composer"    },
-    { "WM/EncodedBy"       , "encoded_by"  },
-    { "WM/EncodingSettings", "encoder"     },
-    { "WM/Genre"           , "genre"       },
-    { "WM/Language"        , "language"    },
-    { "WM/OriginalFilename", "filename"    },
-    { "WM/PartOfSet"       , "disc"        },
-    { "WM/Publisher"       , "publisher"   },
-    { "WM/Tool"            , "encoder"     },
-    { "WM/TrackNumber"     , "track"       },
-    { "WM/Track"           , "track"       },
-//  { "Year"               , "date"        }, TODO: conversion year<->date
-    { 0 }
-};
-
-int ff_put_str16_nolen(ByteIOContext *s, const char *tag)
-{
-    const uint8_t *q = tag;
-    int ret = 0;
-
-    while (*q) {
-        uint32_t ch;
-        uint16_t tmp;
-
-        GET_UTF8(ch, *q++, break;)
-        PUT_UTF16(ch, tmp, put_le16(s, tmp);ret += 2;)
-    }
-    put_le16(s, 0);
-    ret += 2;
-    return ret;
-}
diff --git a/libavformat/asf.h b/libavformat/asf.h
deleted file mode 100644
index 85e54cc..0000000
--- a/libavformat/asf.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_ASF_H
-#define AVFORMAT_ASF_H
-
-#include <stdint.h>
-#include "avformat.h"
-#include "metadata.h"
-
-#define PACKET_SIZE 3200
-
-typedef struct {
-    int num;
-    unsigned char seq;
-    /* use for reading */
-    AVPacket pkt;
-    int frag_offset;
-    int timestamp;
-    int64_t duration;
-
-    int ds_span;                /* descrambling  */
-    int ds_packet_size;
-    int ds_chunk_size;
-
-    int64_t packet_pos;
-
-    uint16_t stream_language_index;
-
-} ASFStream;
-
-typedef uint8_t ff_asf_guid[16];
-
-typedef struct {
-    ff_asf_guid guid;                  ///< generated by client computer
-    uint64_t file_size;         /**< in bytes
-                                 *   invalid if broadcasting */
-    uint64_t create_time;       /**< time of creation, in 100-nanosecond units since 1.1.1601
-                                 *   invalid if broadcasting */
-    uint64_t play_time;         /**< play time, in 100-nanosecond units
-                                 * invalid if broadcasting */
-    uint64_t send_time;         /**< time to send file, in 100-nanosecond units
-                                 *   invalid if broadcasting (could be ignored) */
-    uint32_t preroll;           /**< timestamp of the first packet, in milliseconds
-                                 *   if nonzero - subtract from time */
-    uint32_t ignore;            ///< preroll is 64bit - but let's just ignore it
-    uint32_t flags;             /**< 0x01 - broadcast
-                                 *   0x02 - seekable
-                                 *   rest is reserved should be 0 */
-    uint32_t min_pktsize;       /**< size of a data packet
-                                 *   invalid if broadcasting */
-    uint32_t max_pktsize;       /**< shall be the same as for min_pktsize
-                                 *   invalid if broadcasting */
-    uint32_t max_bitrate;       /**< bandwidth of stream in bps
-                                 *   should be the sum of bitrates of the
-                                 *   individual media streams */
-} ASFMainHeader;
-
-
-typedef struct {
-    uint32_t packet_number;
-    uint16_t packet_count;
-} ASFIndex;
-
-
-typedef struct {
-    uint32_t seqno;
-    int is_streamed;
-    int asfid2avid[128];                 ///< conversion table from asf ID 2 AVStream ID
-    ASFStream streams[128];              ///< it's max number and it's not that big
-    uint32_t stream_bitrates[128];       ///< max number of streams, bitrate for each (for streaming)
-    char stream_languages[128][6];       ///< max number of streams, language for each (RFC1766, e.g. en-US)
-    /* non streamed additonnal info */
-    uint64_t nb_packets;                 ///< how many packets are there in the file, invalid if broadcasting
-    int64_t duration;                    ///< in 100ns units
-    /* packet filling */
-    unsigned char multi_payloads_present;
-    int packet_size_left;
-    int packet_timestamp_start;
-    int packet_timestamp_end;
-    unsigned int packet_nb_payloads;
-    int packet_nb_frames;
-    uint8_t packet_buf[PACKET_SIZE];
-    ByteIOContext pb;
-    /* only for reading */
-    uint64_t data_offset;                ///< beginning of the first data packet
-    uint64_t data_object_offset;         ///< data object offset (excl. GUID & size)
-    uint64_t data_object_size;           ///< size of the data object
-    int index_read;
-
-    ASFMainHeader hdr;
-
-    int packet_flags;
-    int packet_property;
-    int packet_timestamp;
-    int packet_segsizetype;
-    int packet_segments;
-    int packet_seq;
-    int packet_replic_size;
-    int packet_key_frame;
-    int packet_padsize;
-    unsigned int packet_frag_offset;
-    unsigned int packet_frag_size;
-    int64_t packet_frag_timestamp;
-    int packet_multi_size;
-    int packet_obj_size;
-    int packet_time_delta;
-    int packet_time_start;
-    int64_t packet_pos;
-
-    int stream_index;
-
-
-    int64_t last_indexed_pts;
-    ASFIndex* index_ptr;
-    uint32_t nb_index_count;
-    uint32_t nb_index_memory_alloc;
-    uint16_t maximum_packet;
-
-    ASFStream* asf_st;                   ///< currently decoded stream
-} ASFContext;
-
-extern const ff_asf_guid ff_asf_header;
-extern const ff_asf_guid ff_asf_file_header;
-extern const ff_asf_guid ff_asf_stream_header;
-extern const ff_asf_guid ff_asf_ext_stream_header;
-extern const ff_asf_guid ff_asf_audio_stream;
-extern const ff_asf_guid ff_asf_audio_conceal_none;
-extern const ff_asf_guid ff_asf_audio_conceal_spread;
-extern const ff_asf_guid ff_asf_video_stream;
-extern const ff_asf_guid ff_asf_video_conceal_none;
-extern const ff_asf_guid ff_asf_command_stream;
-extern const ff_asf_guid ff_asf_comment_header;
-extern const ff_asf_guid ff_asf_codec_comment_header;
-extern const ff_asf_guid ff_asf_codec_comment1_header;
-extern const ff_asf_guid ff_asf_data_header;
-extern const ff_asf_guid ff_asf_head1_guid;
-extern const ff_asf_guid ff_asf_head2_guid;
-extern const ff_asf_guid ff_asf_extended_content_header;
-extern const ff_asf_guid ff_asf_simple_index_header;
-extern const ff_asf_guid ff_asf_ext_stream_embed_stream_header;
-extern const ff_asf_guid ff_asf_ext_stream_audio_stream;
-extern const ff_asf_guid ff_asf_metadata_header;
-extern const ff_asf_guid ff_asf_marker_header;
-extern const ff_asf_guid ff_asf_my_guid;
-extern const ff_asf_guid ff_asf_language_guid;
-extern const ff_asf_guid ff_asf_content_encryption;
-extern const ff_asf_guid ff_asf_ext_content_encryption;
-extern const ff_asf_guid ff_asf_digital_signature;
-
-extern const AVMetadataConv ff_asf_metadata_conv[];
-
-#define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 0000
-
-
-//   ASF data packet structure
-//   =========================
-//
-//
-//  -----------------------------------
-// | Error Correction Data             |  Optional
-//  -----------------------------------
-// | Payload Parsing Information (PPI) |
-//  -----------------------------------
-// | Payload Data                      |
-//  -----------------------------------
-// | Padding Data                      |
-//  -----------------------------------
-
-
-// PPI_FLAG - Payload parsing information flags
-#define ASF_PPI_FLAG_MULTIPLE_PAYLOADS_PRESENT 1
-
-#define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_BYTE  0x02 //0000 0010
-#define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_WORD  0x04 //0000 0100
-#define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_DWORD 0x06 //0000 0110
-#define ASF_PPI_MASK_SEQUENCE_FIELD_SIZE     0x06 //0000 0110
-
-#define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE  0x08 //0000 1000
-#define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD  0x10 //0001 0000
-#define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_DWORD 0x18 //0001 1000
-#define ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE     0x18 //0001 1000
-
-#define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_BYTE  0x20 //0010 0000
-#define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_WORD  0x40 //0100 0000
-#define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_DWORD 0x60 //0110 0000
-#define ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE     0x60 //0110 0000
-
-// PL_FLAG - Payload flags
-#define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE   0x01 //0000 0001
-#define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_WORD   0x02 //0000 0010
-#define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_DWORD  0x03 //0000 0011
-#define ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE      0x03 //0000 0011
-
-#define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_BYTE  0x04 //0000 0100
-#define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_WORD  0x08 //0000 1000
-#define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD 0x0c //0000 1100
-#define ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE     0x0c //0000 1100
-
-#define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE  0x10 //0001 0000
-#define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_WORD  0x20 //0010 0000
-#define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_DWORD 0x30 //0011 0000
-#define ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE     0x30 //0011 0000
-
-#define ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE  0x40 //0100 0000
-#define ASF_PL_MASK_STREAM_NUMBER_LENGTH_FIELD_SIZE     0xc0 //1100 0000
-
-#define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_BYTE  0x40 //0100 0000
-#define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD  0x80 //1000 0000
-#define ASF_PL_MASK_PAYLOAD_LENGTH_FIELD_SIZE     0xc0 //1100 0000
-
-#define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000
-
-extern AVInputFormat asf_demuxer;
-int ff_put_str16_nolen(ByteIOContext *s, const char *tag);
-
-#endif /* AVFORMAT_ASF_H */
diff --git a/libavformat/asfcrypt.c b/libavformat/asfcrypt.c
deleted file mode 100644
index 09e9af6..0000000
--- a/libavformat/asfcrypt.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * ASF decryption
- * Copyright (c) 2007 Reimar Doeffinger
- * This is a rewrite of code contained in freeme/freeme2
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/bswap.h"
-#include "libavutil/des.h"
-#include "libavutil/rc4.h"
-#include "asfcrypt.h"
-
-/**
- * \brief find multiplicative inverse modulo 2 ^ 32
- * \param v number to invert, must be odd!
- * \return number so that result * v = 1 (mod 2^32)
- */
-static uint32_t inverse(uint32_t v) {
-    // v ^ 3 gives the inverse (mod 16), could also be implemented
-    // as table etc. (only lowest 4 bits matter!)
-    uint32_t inverse = v * v * v;
-    // uses a fixpoint-iteration that doubles the number
-    // of correct lowest bits each time
-    inverse *= 2 - v * inverse;
-    inverse *= 2 - v * inverse;
-    inverse *= 2 - v * inverse;
-    return inverse;
-}
-
-/**
- * \brief read keys from keybuf into keys
- * \param keybuf buffer containing the keys
- * \param keys output key array containing the keys for encryption in
- *             native endianness
- */
-static void multiswap_init(const uint8_t keybuf[48], uint32_t keys[12]) {
-    int i;
-    for (i = 0; i < 12; i++)
-        keys[i] = AV_RL32(keybuf + (i << 2)) | 1;
-}
-
-/**
- * \brief invert the keys so that encryption become decryption keys and
- *        the other way round.
- * \param keys key array of ints to invert
- */
-static void multiswap_invert_keys(uint32_t keys[12]) {
-    int i;
-    for (i = 0; i < 5; i++)
-        keys[i] = inverse(keys[i]);
-    for (i = 6; i < 11; i++)
-        keys[i] = inverse(keys[i]);
-}
-
-static uint32_t multiswap_step(const uint32_t keys[12], uint32_t v) {
-    int i;
-    v *= keys[0];
-    for (i = 1; i < 5; i++) {
-        v = (v >> 16) | (v << 16);
-        v *= keys[i];
-    }
-    v += keys[5];
-    return v;
-}
-
-static uint32_t multiswap_inv_step(const uint32_t keys[12], uint32_t v) {
-    int i;
-    v -= keys[5];
-    for (i = 4; i > 0; i--) {
-        v *= keys[i];
-        v = (v >> 16) | (v << 16);
-    }
-    v *= keys[0];
-    return v;
-}
-
-/**
- * \brief "MultiSwap" encryption
- * \param keys 32 bit numbers in machine endianness,
- *             0-4 and 6-10 must be inverted from decryption
- * \param key another key, this one must be the same for the decryption
- * \param data data to encrypt
- * \return encrypted data
- */
-static uint64_t multiswap_enc(const uint32_t keys[12], uint64_t key, uint64_t data) {
-    uint32_t a = data;
-    uint32_t b = data >> 32;
-    uint32_t c;
-    uint32_t tmp;
-    a += key;
-    tmp = multiswap_step(keys    , a);
-    b += tmp;
-    c = (key >> 32) + tmp;
-    tmp = multiswap_step(keys + 6, b);
-    c += tmp;
-    return ((uint64_t)c << 32) | tmp;
-}
-
-/**
- * \brief "MultiSwap" decryption
- * \param keys 32 bit numbers in machine endianness,
- *             0-4 and 6-10 must be inverted from encryption
- * \param key another key, this one must be the same as for the encryption
- * \param data data to decrypt
- * \return decrypted data
- */
-static uint64_t multiswap_dec(const uint32_t keys[12], uint64_t key, uint64_t data) {
-    uint32_t a;
-    uint32_t b;
-    uint32_t c = data >> 32;
-    uint32_t tmp = data;
-    c -= tmp;
-    b = multiswap_inv_step(keys + 6, tmp);
-    tmp = c - (key >> 32);
-    b -= tmp;
-    a = multiswap_inv_step(keys    , tmp);
-    a -= key;
-    return ((uint64_t)b << 32) | a;
-}
-
-void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) {
-    struct AVDES des;
-    struct AVRC4 rc4;
-    int num_qwords = len >> 3;
-    uint64_t *qwords = (uint64_t *)data;
-    uint64_t rc4buff[8];
-    uint64_t packetkey;
-    uint32_t ms_keys[12];
-    uint64_t ms_state;
-    int i;
-    if (len < 16) {
-        for (i = 0; i < len; i++)
-            data[i] ^= key[i];
-        return;
-    }
-
-    memset(rc4buff, 0, sizeof(rc4buff));
-    av_rc4_init(&rc4, key, 12 * 8, 1);
-    av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1);
-    multiswap_init((uint8_t *)rc4buff, ms_keys);
-
-    packetkey = qwords[num_qwords - 1];
-    packetkey ^= rc4buff[7];
-    av_des_init(&des, key + 12, 64, 1);
-    av_des_crypt(&des, (uint8_t *)&packetkey, (uint8_t *)&packetkey, 1, NULL, 1);
-    packetkey ^= rc4buff[6];
-
-    av_rc4_init(&rc4, (uint8_t *)&packetkey, 64, 1);
-    av_rc4_crypt(&rc4, data, data, len, NULL, 1);
-
-    ms_state = 0;
-    for (i = 0; i < num_qwords - 1; i++, qwords++)
-        ms_state = multiswap_enc(ms_keys, ms_state, AV_RL64(qwords));
-    multiswap_invert_keys(ms_keys);
-    packetkey = (packetkey << 32) | (packetkey >> 32);
-    packetkey = le2me_64(packetkey);
-    packetkey = multiswap_dec(ms_keys, ms_state, packetkey);
-    AV_WL64(qwords, packetkey);
-}
diff --git a/libavformat/asfcrypt.h b/libavformat/asfcrypt.h
deleted file mode 100644
index 8b80d63..0000000
--- a/libavformat/asfcrypt.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * ASF decryption
- * Copyright (c) 2007 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_ASFCRYPT_H
-#define AVFORMAT_ASFCRYPT_H
-
-#include <inttypes.h>
-
-void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len);
-
-#endif /* AVFORMAT_ASFCRYPT_H */
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
deleted file mode 100644
index 8aea8c7..0000000
--- a/libavformat/asfdec.c
+++ /dev/null
@@ -1,1205 +0,0 @@
-/*
- * ASF compatible demuxer
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define DEBUG
-
-#include "libavutil/common.h"
-#include "libavutil/avstring.h"
-#include "libavcodec/mpegaudio.h"
-#include "avformat.h"
-#include "riff.h"
-#include "asf.h"
-#include "asfcrypt.h"
-#include "avlanguage.h"
-
-void ff_mms_set_stream_selection(URLContext *h, AVFormatContext *format);
-
-#undef NDEBUG
-#include <assert.h>
-
-#define FRAME_HEADER_SIZE 17
-// Fix Me! FRAME_HEADER_SIZE may be different.
-
-static const ff_asf_guid index_guid = {
-    0x90, 0x08, 0x00, 0x33, 0xb1, 0xe5, 0xcf, 0x11, 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb
-};
-
-static const ff_asf_guid stream_bitrate_guid = { /* (http://get.to/sdp) */
-    0xce, 0x75, 0xf8, 0x7b, 0x8d, 0x46, 0xd1, 0x11, 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2
-};
-/**********************************/
-/* decoding */
-
-static int guidcmp(const void *g1, const void *g2)
-{
-    return memcmp(g1, g2, sizeof(ff_asf_guid));
-}
-
-#ifdef DEBUG
-#define PRINT_IF_GUID(g,cmp) \
-if (!guidcmp(g, &cmp)) \
-    dprintf(NULL, "(GUID: %s) ", #cmp)
-
-static void print_guid(const ff_asf_guid *g)
-{
-    int i;
-    PRINT_IF_GUID(g, ff_asf_header);
-    else PRINT_IF_GUID(g, ff_asf_file_header);
-    else PRINT_IF_GUID(g, ff_asf_stream_header);
-    else PRINT_IF_GUID(g, ff_asf_audio_stream);
-    else PRINT_IF_GUID(g, ff_asf_audio_conceal_none);
-    else PRINT_IF_GUID(g, ff_asf_video_stream);
-    else PRINT_IF_GUID(g, ff_asf_video_conceal_none);
-    else PRINT_IF_GUID(g, ff_asf_command_stream);
-    else PRINT_IF_GUID(g, ff_asf_comment_header);
-    else PRINT_IF_GUID(g, ff_asf_codec_comment_header);
-    else PRINT_IF_GUID(g, ff_asf_codec_comment1_header);
-    else PRINT_IF_GUID(g, ff_asf_data_header);
-    else PRINT_IF_GUID(g, index_guid);
-    else PRINT_IF_GUID(g, ff_asf_head1_guid);
-    else PRINT_IF_GUID(g, ff_asf_head2_guid);
-    else PRINT_IF_GUID(g, ff_asf_my_guid);
-    else PRINT_IF_GUID(g, ff_asf_ext_stream_header);
-    else PRINT_IF_GUID(g, ff_asf_extended_content_header);
-    else PRINT_IF_GUID(g, ff_asf_ext_stream_embed_stream_header);
-    else PRINT_IF_GUID(g, ff_asf_ext_stream_audio_stream);
-    else PRINT_IF_GUID(g, ff_asf_metadata_header);
-    else PRINT_IF_GUID(g, ff_asf_marker_header);
-    else PRINT_IF_GUID(g, stream_bitrate_guid);
-    else PRINT_IF_GUID(g, ff_asf_language_guid);
-    else
-        dprintf(NULL, "(GUID: unknown) ");
-    for(i=0;i<16;i++)
-        dprintf(NULL, " 0x%02x,", (*g)[i]);
-    dprintf(NULL, "}\n");
-}
-#undef PRINT_IF_GUID
-#else
-#define print_guid(g)
-#endif
-
-static void get_guid(ByteIOContext *s, ff_asf_guid *g)
-{
-    assert(sizeof(*g) == 16);
-    get_buffer(s, *g, sizeof(*g));
-}
-
-#if 0
-static void get_str16(ByteIOContext *pb, char *buf, int buf_size)
-{
-    int len, c;
-    char *q;
-
-    len = get_le16(pb);
-    q = buf;
-    while (len > 0) {
-        c = get_le16(pb);
-        if ((q - buf) < buf_size - 1)
-            *q++ = c;
-        len--;
-    }
-    *q = '\0';
-}
-#endif
-
-static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size)
-{
-    char* q = buf;
-    while (len > 1) {
-        uint8_t tmp;
-        uint32_t ch;
-
-        GET_UTF16(ch, (len -= 2) >= 0 ? get_le16(pb) : 0, break;)
-        PUT_UTF8(ch, tmp, if (q - buf < buf_size - 1) *q++ = tmp;)
-    }
-    if (len > 0)
-        url_fskip(pb, len);
-    *q = '\0';
-}
-
-static int asf_probe(AVProbeData *pd)
-{
-    /* check file header */
-    if (!guidcmp(pd->buf, &ff_asf_header))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int get_value(ByteIOContext *pb, int type){
-    switch(type){
-        case 2: return get_le32(pb);
-        case 3: return get_le32(pb);
-        case 4: return get_le64(pb);
-        case 5: return get_le16(pb);
-        default:return INT_MIN;
-    }
-}
-
-static void get_tag(AVFormatContext *s, const char *key, int type, int len)
-{
-    char *value;
-
-    if ((unsigned)len >= (UINT_MAX - 1)/2)
-        return;
-
-    value = av_malloc(2*len+1);
-    if (!value)
-        return;
-
-    if (type == 0) {         // UTF16-LE
-        get_str16_nolen(s->pb, len, value, 2*len + 1);
-    } else if (type > 1 && type <= 5) {  // boolean or DWORD or QWORD or WORD
-        uint64_t num = get_value(s->pb, type);
-        snprintf(value, len, "%"PRIu64, num);
-    } else {
-        url_fskip(s->pb, len);
-        av_freep(&value);
-        av_log(s, AV_LOG_DEBUG, "Unsupported value type %d in tag %s.\n", type, key);
-        return;
-    }
-    av_metadata_set2(&s->metadata, key, value, 0);
-    av_freep(&value);
-}
-
-static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    ASFContext *asf = s->priv_data;
-    ff_asf_guid g;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    ASFStream *asf_st;
-    int size, i;
-    int64_t gsize;
-    AVRational dar[128];
-    uint32_t bitrate[128];
-
-    memset(dar, 0, sizeof(dar));
-    memset(bitrate, 0, sizeof(bitrate));
-
-    get_guid(pb, &g);
-    if (guidcmp(&g, &ff_asf_header))
-        return -1;
-    get_le64(pb);
-    get_le32(pb);
-    get_byte(pb);
-    get_byte(pb);
-    memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
-    for(;;) {
-        uint64_t gpos= url_ftell(pb);
-        get_guid(pb, &g);
-        gsize = get_le64(pb);
-        dprintf(s, "%08"PRIx64": ", gpos);
-        print_guid(&g);
-        dprintf(s, "  size=0x%"PRIx64"\n", gsize);
-        if (!guidcmp(&g, &ff_asf_data_header)) {
-            asf->data_object_offset = url_ftell(pb);
-            // if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
-            if (!(asf->hdr.flags & 0x01) && gsize >= 100) {
-                asf->data_object_size = gsize - 24;
-            } else {
-                asf->data_object_size = (uint64_t)-1;
-            }
-            break;
-        }
-        if (gsize < 24)
-            return -1;
-        if (!guidcmp(&g, &ff_asf_file_header)) {
-            get_guid(pb, &asf->hdr.guid);
-            asf->hdr.file_size          = get_le64(pb);
-            asf->hdr.create_time        = get_le64(pb);
-            asf->nb_packets             = get_le64(pb);
-            asf->hdr.play_time          = get_le64(pb);
-            asf->hdr.send_time          = get_le64(pb);
-            asf->hdr.preroll            = get_le32(pb);
-            asf->hdr.ignore             = get_le32(pb);
-            asf->hdr.flags              = get_le32(pb);
-            asf->hdr.min_pktsize        = get_le32(pb);
-            asf->hdr.max_pktsize        = get_le32(pb);
-            asf->hdr.max_bitrate        = get_le32(pb);
-            s->packet_size = asf->hdr.max_pktsize;
-        } else if (!guidcmp(&g, &ff_asf_stream_header)) {
-            enum AVMediaType type;
-            int type_specific_size, sizeX;
-            uint64_t total_size;
-            unsigned int tag1;
-            int64_t pos1, pos2, start_time;
-            int test_for_ext_stream_audio, is_dvr_ms_audio=0;
-
-            pos1 = url_ftell(pb);
-
-            st = av_new_stream(s, 0);
-            if (!st)
-                return AVERROR(ENOMEM);
-            av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
-            asf_st = av_mallocz(sizeof(ASFStream));
-            if (!asf_st)
-                return AVERROR(ENOMEM);
-            st->priv_data = asf_st;
-            start_time = asf->hdr.preroll;
-
-            asf_st->stream_language_index = 128; // invalid stream index means no language info
-
-            if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming...
-                st->duration = asf->hdr.play_time /
-                    (10000000 / 1000) - start_time;
-            }
-            get_guid(pb, &g);
-
-            test_for_ext_stream_audio = 0;
-            if (!guidcmp(&g, &ff_asf_audio_stream)) {
-                type = AVMEDIA_TYPE_AUDIO;
-            } else if (!guidcmp(&g, &ff_asf_video_stream)) {
-                type = AVMEDIA_TYPE_VIDEO;
-            } else if (!guidcmp(&g, &ff_asf_command_stream)) {
-                type = AVMEDIA_TYPE_DATA;
-            } else if (!guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) {
-                test_for_ext_stream_audio = 1;
-                type = AVMEDIA_TYPE_UNKNOWN;
-            } else {
-                return -1;
-            }
-            get_guid(pb, &g);
-            total_size = get_le64(pb);
-            type_specific_size = get_le32(pb);
-            get_le32(pb);
-            st->id = get_le16(pb) & 0x7f; /* stream id */
-            // mapping of asf ID to AV stream ID;
-            asf->asfid2avid[st->id] = s->nb_streams - 1;
-
-            get_le32(pb);
-
-            if (test_for_ext_stream_audio) {
-                get_guid(pb, &g);
-                if (!guidcmp(&g, &ff_asf_ext_stream_audio_stream)) {
-                    type = AVMEDIA_TYPE_AUDIO;
-                    is_dvr_ms_audio=1;
-                    get_guid(pb, &g);
-                    get_le32(pb);
-                    get_le32(pb);
-                    get_le32(pb);
-                    get_guid(pb, &g);
-                    get_le32(pb);
-                }
-            }
-
-            st->codec->codec_type = type;
-            if (type == AVMEDIA_TYPE_AUDIO) {
-                ff_get_wav_header(pb, st->codec, type_specific_size);
-                if (is_dvr_ms_audio) {
-                    // codec_id and codec_tag are unreliable in dvr_ms
-                    // files. Set them later by probing stream.
-                    st->codec->codec_id = CODEC_ID_PROBE;
-                    st->codec->codec_tag = 0;
-                }
-                if (st->codec->codec_id == CODEC_ID_AAC) {
-                    st->need_parsing = AVSTREAM_PARSE_NONE;
-                } else {
-                    st->need_parsing = AVSTREAM_PARSE_FULL;
-                }
-                /* We have to init the frame size at some point .... */
-                pos2 = url_ftell(pb);
-                if (gsize >= (pos2 + 8 - pos1 + 24)) {
-                    asf_st->ds_span = get_byte(pb);
-                    asf_st->ds_packet_size = get_le16(pb);
-                    asf_st->ds_chunk_size = get_le16(pb);
-                    get_le16(pb); //ds_data_size
-                    get_byte(pb); //ds_silence_data
-                }
-                //printf("Descrambling: ps:%d cs:%d ds:%d s:%d  sd:%d\n",
-                //       asf_st->ds_packet_size, asf_st->ds_chunk_size,
-                //       asf_st->ds_data_size, asf_st->ds_span, asf_st->ds_silence_data);
-                if (asf_st->ds_span > 1) {
-                    if (!asf_st->ds_chunk_size
-                        || (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1)
-                        || asf_st->ds_packet_size % asf_st->ds_chunk_size)
-                        asf_st->ds_span = 0; // disable descrambling
-                }
-                switch (st->codec->codec_id) {
-                case CODEC_ID_MP3:
-                    st->codec->frame_size = MPA_FRAME_SIZE;
-                    break;
-                case CODEC_ID_PCM_S16LE:
-                case CODEC_ID_PCM_S16BE:
-                case CODEC_ID_PCM_U16LE:
-                case CODEC_ID_PCM_U16BE:
-                case CODEC_ID_PCM_S8:
-                case CODEC_ID_PCM_U8:
-                case CODEC_ID_PCM_ALAW:
-                case CODEC_ID_PCM_MULAW:
-                    st->codec->frame_size = 1;
-                    break;
-                default:
-                    /* This is probably wrong, but it prevents a crash later */
-                    st->codec->frame_size = 1;
-                    break;
-                }
-            } else if (type == AVMEDIA_TYPE_VIDEO) {
-                get_le32(pb);
-                get_le32(pb);
-                get_byte(pb);
-                size = get_le16(pb); /* size */
-                sizeX= get_le32(pb); /* size */
-                st->codec->width = get_le32(pb);
-                st->codec->height = get_le32(pb);
-                /* not available for asf */
-                get_le16(pb); /* panes */
-                st->codec->bits_per_coded_sample = get_le16(pb); /* depth */
-                tag1 = get_le32(pb);
-                url_fskip(pb, 20);
-//                av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
-                size= sizeX;
-                if (size > 40) {
-                    st->codec->extradata_size = size - 40;
-                    st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                    get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
-                }
-
-                /* Extract palette from extradata if bpp <= 8 */
-                /* This code assumes that extradata contains only palette */
-                /* This is true for all paletted codecs implemented in ffmpeg */
-                if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
-                    st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
-#if HAVE_BIGENDIAN
-                    for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
-                        st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]);
-#else
-                    memcpy(st->codec->palctrl->palette, st->codec->extradata,
-                           FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
-#endif
-                    st->codec->palctrl->palette_changed = 1;
-                }
-
-                st->codec->codec_tag = tag1;
-                st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1);
-                if(tag1 == MKTAG('D', 'V', 'R', ' '))
-                    st->need_parsing = AVSTREAM_PARSE_FULL;
-            }
-            pos2 = url_ftell(pb);
-            url_fskip(pb, gsize - (pos2 - pos1 + 24));
-        } else if (!guidcmp(&g, &ff_asf_comment_header)) {
-            int len1, len2, len3, len4, len5;
-
-            len1 = get_le16(pb);
-            len2 = get_le16(pb);
-            len3 = get_le16(pb);
-            len4 = get_le16(pb);
-            len5 = get_le16(pb);
-            get_tag(s, "title"    , 0, len1);
-            get_tag(s, "author"   , 0, len2);
-            get_tag(s, "copyright", 0, len3);
-            get_tag(s, "comment"  , 0, len4);
-            url_fskip(pb, len5);
-        } else if (!guidcmp(&g, &stream_bitrate_guid)) {
-            int stream_count = get_le16(pb);
-            int j;
-
-//            av_log(s, AV_LOG_ERROR, "stream bitrate properties\n");
-//            av_log(s, AV_LOG_ERROR, "streams %d\n", streams);
-            for(j = 0; j < stream_count; j++) {
-                int flags, bitrate, stream_id;
-
-                flags= get_le16(pb);
-                bitrate= get_le32(pb);
-                stream_id= (flags & 0x7f);
-//                av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate);
-                asf->stream_bitrates[stream_id]= bitrate;
-            }
-        } else if (!guidcmp(&g, &ff_asf_language_guid)) {
-            int j;
-            int stream_count = get_le16(pb);
-            for(j = 0; j < stream_count; j++) {
-                char lang[6];
-                unsigned int lang_len = get_byte(pb);
-                get_str16_nolen(pb, lang_len, lang, sizeof(lang));
-                if (j < 128)
-                    av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages));
-            }
-        } else if (!guidcmp(&g, &ff_asf_extended_content_header)) {
-            int desc_count, i;
-
-            desc_count = get_le16(pb);
-            for(i=0;i<desc_count;i++) {
-                    int name_len,value_type,value_len;
-                    char name[1024];
-
-                    name_len = get_le16(pb);
-                    if (name_len%2)     // must be even, broken lavf versions wrote len-1
-                        name_len += 1;
-                    get_str16_nolen(pb, name_len, name, sizeof(name));
-                    value_type = get_le16(pb);
-                    value_len  = get_le16(pb);
-                    if (!value_type && value_len%2)
-                        value_len += 1;
-                    get_tag(s, name, value_type, value_len);
-            }
-        } else if (!guidcmp(&g, &ff_asf_metadata_header)) {
-            int n, stream_num, name_len, value_len, value_type, value_num;
-            n = get_le16(pb);
-
-            for(i=0;i<n;i++) {
-                char name[1024];
-
-                get_le16(pb); //lang_list_index
-                stream_num= get_le16(pb);
-                name_len=   get_le16(pb);
-                value_type= get_le16(pb);
-                value_len=  get_le32(pb);
-
-                get_str16_nolen(pb, name_len, name, sizeof(name));
-//av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
-                value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
-                url_fskip(pb, value_len - 2);
-
-                if(stream_num<128){
-                    if     (!strcmp(name, "AspectRatioX")) dar[stream_num].num= value_num;
-                    else if(!strcmp(name, "AspectRatioY")) dar[stream_num].den= value_num;
-                }
-            }
-        } else if (!guidcmp(&g, &ff_asf_ext_stream_header)) {
-            int ext_len, payload_ext_ct, stream_ct;
-            uint32_t ext_d, leak_rate, stream_num;
-            unsigned int stream_languageid_index;
-
-            get_le64(pb); // starttime
-            get_le64(pb); // endtime
-            leak_rate = get_le32(pb); // leak-datarate
-            get_le32(pb); // bucket-datasize
-            get_le32(pb); // init-bucket-fullness
-            get_le32(pb); // alt-leak-datarate
-            get_le32(pb); // alt-bucket-datasize
-            get_le32(pb); // alt-init-bucket-fullness
-            get_le32(pb); // max-object-size
-            get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
-            stream_num = get_le16(pb); // stream-num
-
-            stream_languageid_index = get_le16(pb); // stream-language-id-index
-            if (stream_num < 128)
-                asf->streams[stream_num].stream_language_index = stream_languageid_index;
-
-            get_le64(pb); // avg frametime in 100ns units
-            stream_ct = get_le16(pb); //stream-name-count
-            payload_ext_ct = get_le16(pb); //payload-extension-system-count
-
-            if (stream_num < 128)
-                bitrate[stream_num] = leak_rate;
-
-            for (i=0; i<stream_ct; i++){
-                get_le16(pb);
-                ext_len = get_le16(pb);
-                url_fseek(pb, ext_len, SEEK_CUR);
-            }
-
-            for (i=0; i<payload_ext_ct; i++){
-                get_guid(pb, &g);
-                ext_d=get_le16(pb);
-                ext_len=get_le32(pb);
-                url_fseek(pb, ext_len, SEEK_CUR);
-            }
-
-            // there could be a optional stream properties object to follow
-            // if so the next iteration will pick it up
-        } else if (!guidcmp(&g, &ff_asf_head1_guid)) {
-            int v1, v2;
-            get_guid(pb, &g);
-            v1 = get_le32(pb);
-            v2 = get_le16(pb);
-        } else if (!guidcmp(&g, &ff_asf_marker_header)) {
-            int i, count, name_len;
-            char name[1024];
-
-            get_le64(pb);            // reserved 16 bytes
-            get_le64(pb);            // ...
-            count = get_le32(pb);    // markers count
-            get_le16(pb);            // reserved 2 bytes
-            name_len = get_le16(pb); // name length
-            for(i=0;i<name_len;i++){
-                get_byte(pb); // skip the name
-            }
-
-            for(i=0;i<count;i++){
-                int64_t pres_time;
-                int name_len;
-
-                get_le64(pb);             // offset, 8 bytes
-                pres_time = get_le64(pb); // presentation time
-                get_le16(pb);             // entry length
-                get_le32(pb);             // send time
-                get_le32(pb);             // flags
-                name_len = get_le32(pb);  // name length
-                get_str16_nolen(pb, name_len * 2, name, sizeof(name));
-                ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
-            }
-#if 0
-        } else if (!guidcmp(&g, &ff_asf_codec_comment_header)) {
-            int len, v1, n, num;
-            char str[256], *q;
-            char tag[16];
-
-            get_guid(pb, &g);
-            print_guid(&g);
-
-            n = get_le32(pb);
-            for(i=0;i<n;i++) {
-                num = get_le16(pb); /* stream number */
-                get_str16(pb, str, sizeof(str));
-                get_str16(pb, str, sizeof(str));
-                len = get_le16(pb);
-                q = tag;
-                while (len > 0) {
-                    v1 = get_byte(pb);
-                    if ((q - tag) < sizeof(tag) - 1)
-                        *q++ = v1;
-                    len--;
-                }
-                *q = '\0';
-            }
-#endif
-        } else if (url_feof(pb)) {
-            return -1;
-        } else {
-            if (!s->keylen) {
-                if (!guidcmp(&g, &ff_asf_content_encryption)) {
-                    av_log(s, AV_LOG_WARNING, "DRM protected stream detected, decoding will likely fail!\n");
-                } else if (!guidcmp(&g, &ff_asf_ext_content_encryption)) {
-                    av_log(s, AV_LOG_WARNING, "Ext DRM protected stream detected, decoding will likely fail!\n");
-                } else if (!guidcmp(&g, &ff_asf_digital_signature)) {
-                    av_log(s, AV_LOG_WARNING, "Digital signature detected, decoding will likely fail!\n");
-                }
-            }
-        }
-        if(url_ftell(pb) != gpos + gsize)
-            av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize);
-        url_fseek(pb, gpos + gsize, SEEK_SET);
-    }
-    get_guid(pb, &g);
-    get_le64(pb);
-    get_byte(pb);
-    get_byte(pb);
-    if (url_feof(pb))
-        return -1;
-    asf->data_offset = url_ftell(pb);
-    asf->packet_size_left = 0;
-
-
-    for(i=0; i<128; i++){
-        int stream_num= asf->asfid2avid[i];
-        if(stream_num>=0){
-            AVStream *st = s->streams[stream_num];
-            if (!st->codec->bit_rate)
-                st->codec->bit_rate = bitrate[i];
-            if (dar[i].num > 0 && dar[i].den > 0)
-                av_reduce(&st->sample_aspect_ratio.num,
-                          &st->sample_aspect_ratio.den,
-                          dar[i].num, dar[i].den, INT_MAX);
-//av_log(s, AV_LOG_ERROR, "dar %d:%d sar=%d:%d\n", dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
-
-            // copy and convert language codes to the frontend
-            if (asf->streams[i].stream_language_index < 128) {
-                const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index];
-                if (rfc1766 && strlen(rfc1766) > 1) {
-                    const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any
-                    const char *iso6392 = av_convert_lang_to(primary_tag, AV_LANG_ISO639_2_BIBL);
-                    if (iso6392)
-                        av_metadata_set2(&st->metadata, "language", iso6392, 0);
-                }
-            }
-        }
-    }
-
-    return 0;
-}
-
-#define DO_2BITS(bits, var, defval) \
-    switch (bits & 3) \
-    { \
-    case 3: var = get_le32(pb); rsize += 4; break; \
-    case 2: var = get_le16(pb); rsize += 2; break; \
-    case 1: var = get_byte(pb); rsize++; break; \
-    default: var = defval; break; \
-    }
-
-/**
- * Load a single ASF packet into the demuxer.
- * @param s demux context
- * @param pb context to read data from
- * @return 0 on success, <0 on error
- */
-static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
-{
-    ASFContext *asf = s->priv_data;
-    uint32_t packet_length, padsize;
-    int rsize = 8;
-    int c, d, e, off;
-
-    // if we do not know packet size, allow skipping up to 32 kB
-    off= 32768;
-    if (s->packet_size > 0)
-        off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3;
-
-    c=d=e=-1;
-    while(off-- > 0){
-        c=d; d=e;
-        e= get_byte(pb);
-        if(c == 0x82 && !d && !e)
-            break;
-    }
-
-    if (c != 0x82) {
-        /**
-         * This code allows handling of -EAGAIN at packet boundaries (i.e.
-         * if the packet sync code above triggers -EAGAIN). This does not
-         * imply complete -EAGAIN handling support at random positions in
-         * the stream.
-         */
-        if (url_ferror(pb) == AVERROR(EAGAIN))
-            return AVERROR(EAGAIN);
-        if (!url_feof(pb))
-            av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, url_ftell(pb));
-    }
-    if ((c & 0x8f) == 0x82) {
-        if (d || e) {
-            if (!url_feof(pb))
-                av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
-            return -1;
-        }
-        c= get_byte(pb);
-        d= get_byte(pb);
-        rsize+=3;
-    }else{
-        url_fseek(pb, -1, SEEK_CUR); //FIXME
-    }
-
-    asf->packet_flags    = c;
-    asf->packet_property = d;
-
-    DO_2BITS(asf->packet_flags >> 5, packet_length, s->packet_size);
-    DO_2BITS(asf->packet_flags >> 1, padsize, 0); // sequence ignored
-    DO_2BITS(asf->packet_flags >> 3, padsize, 0); // padding length
-
-    //the following checks prevent overflows and infinite loops
-    if(!packet_length || packet_length >= (1U<<29)){
-        av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, url_ftell(pb));
-        return -1;
-    }
-    if(padsize >= packet_length){
-        av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, url_ftell(pb));
-        return -1;
-    }
-
-    asf->packet_timestamp = get_le32(pb);
-    get_le16(pb); /* duration */
-    // rsize has at least 11 bytes which have to be present
-
-    if (asf->packet_flags & 0x01) {
-        asf->packet_segsizetype = get_byte(pb); rsize++;
-        asf->packet_segments = asf->packet_segsizetype & 0x3f;
-    } else {
-        asf->packet_segments = 1;
-        asf->packet_segsizetype = 0x80;
-    }
-    asf->packet_size_left = packet_length - padsize - rsize;
-    if (packet_length < asf->hdr.min_pktsize)
-        padsize += asf->hdr.min_pktsize - packet_length;
-    asf->packet_padsize = padsize;
-    dprintf(s, "packet: size=%d padsize=%d  left=%d\n", s->packet_size, asf->packet_padsize, asf->packet_size_left);
-    return 0;
-}
-
-/**
- *
- * @return <0 if error
- */
-static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
-    ASFContext *asf = s->priv_data;
-    int rsize = 1;
-    int num = get_byte(pb);
-    int64_t ts0, ts1;
-
-    asf->packet_segments--;
-    asf->packet_key_frame = num >> 7;
-    asf->stream_index = asf->asfid2avid[num & 0x7f];
-    // sequence should be ignored!
-    DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0);
-    DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0);
-    DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
-//printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size);
-    if (asf->packet_replic_size >= 8) {
-        asf->packet_obj_size = get_le32(pb);
-        if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){
-            av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n");
-            return -1;
-        }
-        asf->packet_frag_timestamp = get_le32(pb); // timestamp
-        if(asf->packet_replic_size >= 8+38+4){
-//            for(i=0; i<asf->packet_replic_size-8; i++)
-//                av_log(s, AV_LOG_DEBUG, "%02X ",get_byte(pb));
-//            av_log(s, AV_LOG_DEBUG, "\n");
-            url_fskip(pb, 10);
-            ts0= get_le64(pb);
-            ts1= get_le64(pb);
-            url_fskip(pb, 12);
-            get_le32(pb);
-            url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4);
-            if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
-            else         asf->packet_frag_timestamp= AV_NOPTS_VALUE;
-        }else
-            url_fskip(pb, asf->packet_replic_size - 8);
-        rsize += asf->packet_replic_size; // FIXME - check validity
-    } else if (asf->packet_replic_size==1){
-        // multipacket - frag_offset is beginning timestamp
-        asf->packet_time_start = asf->packet_frag_offset;
-        asf->packet_frag_offset = 0;
-        asf->packet_frag_timestamp = asf->packet_timestamp;
-
-        asf->packet_time_delta = get_byte(pb);
-        rsize++;
-    }else if(asf->packet_replic_size!=0){
-        av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size);
-        return -1;
-    }
-    if (asf->packet_flags & 0x01) {
-        DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal
-        if(asf->packet_frag_size > asf->packet_size_left - rsize){
-            av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid\n");
-            return -1;
-        }
-        //printf("Fragsize %d\n", asf->packet_frag_size);
-    } else {
-        asf->packet_frag_size = asf->packet_size_left - rsize;
-        //printf("Using rest  %d %d %d\n", asf->packet_frag_size, asf->packet_size_left, rsize);
-    }
-    if (asf->packet_replic_size == 1) {
-        asf->packet_multi_size = asf->packet_frag_size;
-        if (asf->packet_multi_size > asf->packet_size_left)
-            return -1;
-    }
-    asf->packet_size_left -= rsize;
-    //printf("___objsize____  %d   %d    rs:%d\n", asf->packet_obj_size, asf->packet_frag_offset, rsize);
-
-    return 0;
-}
-
-/**
- * Parse data from individual ASF packets (which were previously loaded
- * with asf_get_packet()).
- * @param s demux context
- * @param pb context to read data from
- * @param pkt pointer to store packet data into
- * @return 0 if data was stored in pkt, <0 on error or 1 if more ASF
- *          packets need to be loaded (through asf_get_packet())
- */
-static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt)
-{
-    ASFContext *asf = s->priv_data;
-    ASFStream *asf_st = 0;
-    for (;;) {
-        if(url_feof(pb))
-            return AVERROR_EOF;
-        if (asf->packet_size_left < FRAME_HEADER_SIZE
-            || asf->packet_segments < 1) {
-            //asf->packet_size_left <= asf->packet_padsize) {
-            int ret = asf->packet_size_left + asf->packet_padsize;
-            //printf("PacketLeftSize:%d  Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
-            assert(ret>=0);
-            /* fail safe */
-            url_fskip(pb, ret);
-
-            asf->packet_pos= url_ftell(pb);
-            if (asf->data_object_size != (uint64_t)-1 &&
-                (asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
-                return AVERROR_EOF; /* Do not exceed the size of the data object */
-            return 1;
-        }
-        if (asf->packet_time_start == 0) {
-            if(asf_read_frame_header(s, pb) < 0){
-                asf->packet_segments= 0;
-                continue;
-            }
-            if (asf->stream_index < 0
-                || s->streams[asf->stream_index]->discard >= AVDISCARD_ALL
-                || (!asf->packet_key_frame && s->streams[asf->stream_index]->discard >= AVDISCARD_NONKEY)
-                ) {
-                asf->packet_time_start = 0;
-                /* unhandled packet (should not happen) */
-                url_fskip(pb, asf->packet_frag_size);
-                asf->packet_size_left -= asf->packet_frag_size;
-                if(asf->stream_index < 0)
-                    av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size);
-                continue;
-            }
-            asf->asf_st = s->streams[asf->stream_index]->priv_data;
-        }
-        asf_st = asf->asf_st;
-
-        if (asf->packet_replic_size == 1) {
-            // frag_offset is here used as the beginning timestamp
-            asf->packet_frag_timestamp = asf->packet_time_start;
-            asf->packet_time_start += asf->packet_time_delta;
-            asf->packet_obj_size = asf->packet_frag_size = get_byte(pb);
-            asf->packet_size_left--;
-            asf->packet_multi_size--;
-            if (asf->packet_multi_size < asf->packet_obj_size)
-            {
-                asf->packet_time_start = 0;
-                url_fskip(pb, asf->packet_multi_size);
-                asf->packet_size_left -= asf->packet_multi_size;
-                continue;
-            }
-            asf->packet_multi_size -= asf->packet_obj_size;
-            //printf("COMPRESS size  %d  %d  %d   ms:%d\n", asf->packet_obj_size, asf->packet_frag_timestamp, asf->packet_size_left, asf->packet_multi_size);
-        }
-        if(   /*asf->packet_frag_size == asf->packet_obj_size*/
-              asf_st->frag_offset + asf->packet_frag_size <= asf_st->pkt.size
-           && asf_st->frag_offset + asf->packet_frag_size > asf->packet_obj_size){
-            av_log(s, AV_LOG_INFO, "ignoring invalid packet_obj_size (%d %d %d %d)\n",
-                asf_st->frag_offset, asf->packet_frag_size,
-                asf->packet_obj_size, asf_st->pkt.size);
-            asf->packet_obj_size= asf_st->pkt.size;
-        }
-
-        if (   asf_st->pkt.size != asf->packet_obj_size
-            || asf_st->frag_offset + asf->packet_frag_size > asf_st->pkt.size) { //FIXME is this condition sufficient?
-            if(asf_st->pkt.data){
-                av_log(s, AV_LOG_INFO, "freeing incomplete packet size %d, new %d\n", asf_st->pkt.size, asf->packet_obj_size);
-                asf_st->frag_offset = 0;
-                av_free_packet(&asf_st->pkt);
-            }
-            /* new packet */
-            av_new_packet(&asf_st->pkt, asf->packet_obj_size);
-            asf_st->seq = asf->packet_seq;
-            asf_st->pkt.dts = asf->packet_frag_timestamp;
-            asf_st->pkt.stream_index = asf->stream_index;
-            asf_st->pkt.pos =
-            asf_st->packet_pos= asf->packet_pos;
-//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n",
-//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY,
-//s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size);
-            if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
-                asf->packet_key_frame = 1;
-            if (asf->packet_key_frame)
-                asf_st->pkt.flags |= AV_PKT_FLAG_KEY;
-        }
-
-        /* read data */
-        //printf("READ PACKET s:%d  os:%d  o:%d,%d  l:%d   DATA:%p\n",
-        //       s->packet_size, asf_st->pkt.size, asf->packet_frag_offset,
-        //       asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data);
-        asf->packet_size_left -= asf->packet_frag_size;
-        if (asf->packet_size_left < 0)
-            continue;
-
-        if(   asf->packet_frag_offset >= asf_st->pkt.size
-           || asf->packet_frag_size > asf_st->pkt.size - asf->packet_frag_offset){
-            av_log(s, AV_LOG_ERROR, "packet fragment position invalid %u,%u not in %u\n",
-                asf->packet_frag_offset, asf->packet_frag_size, asf_st->pkt.size);
-            continue;
-        }
-
-        get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
-                   asf->packet_frag_size);
-        if (s->key && s->keylen == 20)
-            ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset,
-                            asf->packet_frag_size);
-        asf_st->frag_offset += asf->packet_frag_size;
-        /* test if whole packet is read */
-        if (asf_st->frag_offset == asf_st->pkt.size) {
-            //workaround for macroshit radio DVR-MS files
-            if(   s->streams[asf->stream_index]->codec->codec_id == CODEC_ID_MPEG2VIDEO
-               && asf_st->pkt.size > 100){
-                int i;
-                for(i=0; i<asf_st->pkt.size && !asf_st->pkt.data[i]; i++);
-                if(i == asf_st->pkt.size){
-                    av_log(s, AV_LOG_DEBUG, "discarding ms fart\n");
-                    asf_st->frag_offset = 0;
-                    av_free_packet(&asf_st->pkt);
-                    continue;
-                }
-            }
-
-            /* return packet */
-            if (asf_st->ds_span > 1) {
-              if(asf_st->pkt.size != asf_st->ds_packet_size * asf_st->ds_span){
-                    av_log(s, AV_LOG_ERROR, "pkt.size != ds_packet_size * ds_span (%d %d %d)\n", asf_st->pkt.size, asf_st->ds_packet_size, asf_st->ds_span);
-              }else{
-                /* packet descrambling */
-                uint8_t *newdata = av_malloc(asf_st->pkt.size);
-                if (newdata) {
-                    int offset = 0;
-                    while (offset < asf_st->pkt.size) {
-                        int off = offset / asf_st->ds_chunk_size;
-                        int row = off / asf_st->ds_span;
-                        int col = off % asf_st->ds_span;
-                        int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size;
-                        //printf("off:%d  row:%d  col:%d  idx:%d\n", off, row, col, idx);
-
-                        assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size);
-                        assert(idx+1 <= asf_st->pkt.size / asf_st->ds_chunk_size);
-                        memcpy(newdata + offset,
-                               asf_st->pkt.data + idx * asf_st->ds_chunk_size,
-                               asf_st->ds_chunk_size);
-                        offset += asf_st->ds_chunk_size;
-                    }
-                    av_free(asf_st->pkt.data);
-                    asf_st->pkt.data = newdata;
-                }
-              }
-            }
-            asf_st->frag_offset = 0;
-            *pkt= asf_st->pkt;
-            //printf("packet %d %d\n", asf_st->pkt.size, asf->packet_frag_size);
-            asf_st->pkt.size = 0;
-            asf_st->pkt.data = 0;
-            break; // packet completed
-        }
-    }
-    return 0;
-}
-
-static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ASFContext *asf = s->priv_data;
-
-    for (;;) {
-        int ret;
-
-        /* parse cached packets, if any */
-        if ((ret = ff_asf_parse_packet(s, s->pb, pkt)) <= 0)
-            return ret;
-        if ((ret = ff_asf_get_packet(s, s->pb)) < 0)
-            assert(asf->packet_size_left < FRAME_HEADER_SIZE || asf->packet_segments < 1);
-        asf->packet_time_start = 0;
-    }
-
-    return 0;
-}
-
-// Added to support seeking after packets have been read
-// If information is not reset, read_packet fails due to
-// leftover information from previous reads
-static void asf_reset_header(AVFormatContext *s)
-{
-    ASFContext *asf = s->priv_data;
-    ASFStream *asf_st;
-    int i;
-
-    asf->packet_nb_frames = 0;
-    asf->packet_size_left = 0;
-    asf->packet_segments = 0;
-    asf->packet_flags = 0;
-    asf->packet_property = 0;
-    asf->packet_timestamp = 0;
-    asf->packet_segsizetype = 0;
-    asf->packet_segments = 0;
-    asf->packet_seq = 0;
-    asf->packet_replic_size = 0;
-    asf->packet_key_frame = 0;
-    asf->packet_padsize = 0;
-    asf->packet_frag_offset = 0;
-    asf->packet_frag_size = 0;
-    asf->packet_frag_timestamp = 0;
-    asf->packet_multi_size = 0;
-    asf->packet_obj_size = 0;
-    asf->packet_time_delta = 0;
-    asf->packet_time_start = 0;
-
-    for(i=0; i<s->nb_streams; i++){
-        asf_st= s->streams[i]->priv_data;
-        av_free_packet(&asf_st->pkt);
-        asf_st->frag_offset=0;
-        asf_st->seq=0;
-    }
-    asf->asf_st= NULL;
-}
-
-static int asf_read_close(AVFormatContext *s)
-{
-    int i;
-
-    asf_reset_header(s);
-    for(i=0;i<s->nb_streams;i++) {
-        AVStream *st = s->streams[i];
-        av_free(st->codec->palctrl);
-    }
-    return 0;
-}
-
-static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
-{
-    AVPacket pkt1, *pkt = &pkt1;
-    ASFStream *asf_st;
-    int64_t pts;
-    int64_t pos= *ppos;
-    int i;
-    int64_t start_pos[s->nb_streams];
-
-    for(i=0; i<s->nb_streams; i++){
-        start_pos[i]= pos;
-    }
-
-    if (s->packet_size > 0)
-        pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
-    *ppos= pos;
-    url_fseek(s->pb, pos, SEEK_SET);
-
-//printf("asf_read_pts\n");
-    asf_reset_header(s);
-    for(;;){
-        if (av_read_frame(s, pkt) < 0){
-            av_log(s, AV_LOG_INFO, "asf_read_pts failed\n");
-            return AV_NOPTS_VALUE;
-        }
-
-        pts= pkt->pts;
-
-        av_free_packet(pkt);
-        if(pkt->flags&AV_PKT_FLAG_KEY){
-            i= pkt->stream_index;
-
-            asf_st= s->streams[i]->priv_data;
-
-//            assert((asf_st->packet_pos - s->data_offset) % s->packet_size == 0);
-            pos= asf_st->packet_pos;
-
-            av_add_index_entry(s->streams[i], pos, pts, pkt->size, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
-            start_pos[i]= asf_st->packet_pos + 1;
-
-            if(pkt->stream_index == stream_index)
-               break;
-        }
-    }
-
-    *ppos= pos;
-//printf("found keyframe at %"PRId64" stream %d stamp:%"PRId64"\n", *ppos, stream_index, pts);
-
-    return pts;
-}
-
-static void asf_build_simple_index(AVFormatContext *s, int stream_index)
-{
-    ff_asf_guid g;
-    ASFContext *asf = s->priv_data;
-    int64_t current_pos= url_ftell(s->pb);
-    int i;
-
-    url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
-    get_guid(s->pb, &g);
-    if (!guidcmp(&g, &index_guid)) {
-        int64_t itime, last_pos=-1;
-        int pct, ict;
-        int64_t av_unused gsize= get_le64(s->pb);
-        get_guid(s->pb, &g);
-        itime=get_le64(s->pb);
-        pct=get_le32(s->pb);
-        ict=get_le32(s->pb);
-        av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);
-
-        for (i=0;i<ict;i++){
-            int pktnum=get_le32(s->pb);
-            int pktct =get_le16(s->pb);
-            int64_t pos      = s->data_offset + s->packet_size*(int64_t)pktnum;
-            int64_t index_pts= av_rescale(itime, i, 10000);
-
-            if(pos != last_pos){
-            av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d\n", pktnum, pktct);
-            av_add_index_entry(s->streams[stream_index], pos, index_pts, s->packet_size, 0, AVINDEX_KEYFRAME);
-            last_pos=pos;
-            }
-        }
-        asf->index_read= 1;
-    }
-    url_fseek(s->pb, current_pos, SEEK_SET);
-}
-
-static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
-{
-    ASFContext *asf = s->priv_data;
-    AVStream *st = s->streams[stream_index];
-    int64_t pos;
-    int index;
-
-    if (s->packet_size <= 0)
-        return -1;
-
-    /* Try using the protocol's read_seek if available */
-    if(s->pb) {
-        int ret = av_url_read_fseek(s->pb, stream_index, pts, flags);
-        if(ret >= 0)
-            asf_reset_header(s);
-        if (ret != AVERROR(ENOSYS))
-            return ret;
-    }
-
-    if (!asf->index_read)
-        asf_build_simple_index(s, stream_index);
-
-    if(!(asf->index_read && st->index_entries)){
-        if(av_seek_frame_binary(s, stream_index, pts, flags)<0)
-            return -1;
-    }else{
-        index= av_index_search_timestamp(st, pts, flags);
-        if(index<0)
-            return -1;
-
-        /* find the position */
-        pos = st->index_entries[index].pos;
-
-    // various attempts to find key frame have failed so far
-    //    asf_reset_header(s);
-    //    url_fseek(s->pb, pos, SEEK_SET);
-    //    key_pos = pos;
-    //     for(i=0;i<16;i++){
-    //         pos = url_ftell(s->pb);
-    //         if (av_read_frame(s, &pkt) < 0){
-    //             av_log(s, AV_LOG_INFO, "seek failed\n");
-    //             return -1;
-    //         }
-    //         asf_st = s->streams[stream_index]->priv_data;
-    //         pos += st->parser->frame_offset;
-    //
-    //         if (pkt.size > b) {
-    //             b = pkt.size;
-    //             key_pos = pos;
-    //         }
-    //
-    //         av_free_packet(&pkt);
-    //     }
-
-        /* do the seek */
-        av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
-        url_fseek(s->pb, pos, SEEK_SET);
-    }
-    asf_reset_header(s);
-    return 0;
-}
-
-AVInputFormat asf_demuxer = {
-    "asf",
-    NULL_IF_CONFIG_SMALL("ASF format"),
-    sizeof(ASFContext),
-    asf_probe,
-    asf_read_header,
-    asf_read_packet,
-    asf_read_close,
-    asf_read_seek,
-    asf_read_pts,
-    .metadata_conv = ff_asf_metadata_conv,
-};
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
deleted file mode 100644
index 9f8d69a..0000000
--- a/libavformat/asfenc.c
+++ /dev/null
@@ -1,897 +0,0 @@
-/*
- * ASF muxer
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "metadata.h"
-#include "riff.h"
-#include "asf.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-
-#define ASF_INDEXED_INTERVAL    10000000
-#define ASF_INDEX_BLOCK         600
-
-#define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE 0x2
-#define ASF_PACKET_ERROR_CORRECTION_FLAGS (\
-                ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT | \
-                ASF_PACKET_ERROR_CORRECTION_DATA_SIZE\
-                )
-
-#if (ASF_PACKET_ERROR_CORRECTION_FLAGS != 0)
-#   define ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE 1
-#else
-#   define ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE 0
-#endif
-
-#define ASF_PPI_PROPERTY_FLAGS (\
-                ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE | \
-                ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD | \
-                ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE | \
-                ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE \
-                )
-
-#define ASF_PPI_LENGTH_TYPE_FLAGS 0
-
-#define ASF_PAYLOAD_FLAGS ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD
-
-#if (ASF_PPI_FLAG_SEQUENCE_FIELD_IS_BYTE == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_SEQUENCE_FIELD_SIZE))
-#   define ASF_PPI_SEQUENCE_FIELD_SIZE 1
-#endif
-#if (ASF_PPI_FLAG_SEQUENCE_FIELD_IS_WORD == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_SEQUENCE_FIELD_SIZE))
-#   define ASF_PPI_SEQUENCE_FIELD_SIZE 2
-#endif
-#if (ASF_PPI_FLAG_SEQUENCE_FIELD_IS_DWORD == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_SEQUENCE_FIELD_SIZE))
-#   define ASF_PPI_SEQUENCE_FIELD_SIZE 4
-#endif
-#ifndef ASF_PPI_SEQUENCE_FIELD_SIZE
-#   define ASF_PPI_SEQUENCE_FIELD_SIZE 0
-#endif
-
-
-#if (ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_BYTE == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE))
-#   define ASF_PPI_PACKET_LENGTH_FIELD_SIZE 1
-#endif
-#if (ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_WORD == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE))
-#   define ASF_PPI_PACKET_LENGTH_FIELD_SIZE 2
-#endif
-#if (ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_DWORD == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE))
-#   define ASF_PPI_PACKET_LENGTH_FIELD_SIZE 4
-#endif
-#ifndef ASF_PPI_PACKET_LENGTH_FIELD_SIZE
-#   define ASF_PPI_PACKET_LENGTH_FIELD_SIZE 0
-#endif
-
-#if (ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE))
-#   define ASF_PPI_PADDING_LENGTH_FIELD_SIZE 1
-#endif
-#if (ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE))
-#   define ASF_PPI_PADDING_LENGTH_FIELD_SIZE 2
-#endif
-#if (ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_DWORD == (ASF_PPI_LENGTH_TYPE_FLAGS & ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE))
-#   define ASF_PPI_PADDING_LENGTH_FIELD_SIZE 4
-#endif
-#ifndef ASF_PPI_PADDING_LENGTH_FIELD_SIZE
-#   define ASF_PPI_PADDING_LENGTH_FIELD_SIZE 0
-#endif
-
-#if (ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE 1
-#endif
-#if (ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_WORD == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE 2
-#endif
-#if (ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_DWORD == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE 4
-#endif
-#ifndef ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE
-#   define ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE 0
-#endif
-
-#if (ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_BYTE == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE 1
-#endif
-#if (ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_WORD == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE 2
-#endif
-#if (ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE 4
-#endif
-#ifndef ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE
-#   define ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE 0
-#endif
-
-#if (ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE 1
-#endif
-#if (ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_WORD == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE 2
-#endif
-#if (ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_DWORD == (ASF_PPI_PROPERTY_FLAGS & ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE 4
-#endif
-#ifndef ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE
-#   define ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE 0
-#endif
-
-#if (ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_BYTE == (ASF_PAYLOAD_FLAGS & ASF_PL_MASK_PAYLOAD_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_LENGTH_FIELD_SIZE 1
-#endif
-#if (ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD == (ASF_PAYLOAD_FLAGS & ASF_PL_MASK_PAYLOAD_LENGTH_FIELD_SIZE))
-#   define ASF_PAYLOAD_LENGTH_FIELD_SIZE 2
-#endif
-#ifndef ASF_PAYLOAD_LENGTH_FIELD_SIZE
-#   define ASF_PAYLOAD_LENGTH_FIELD_SIZE 0
-#endif
-
-#define PACKET_HEADER_MIN_SIZE (\
-                ASF_PACKET_ERROR_CORRECTION_FLAGS_FIELD_SIZE + \
-                ASF_PACKET_ERROR_CORRECTION_DATA_SIZE + \
-                1 + /*Length Type Flags*/ \
-                1 + /*Property Flags*/ \
-                ASF_PPI_PACKET_LENGTH_FIELD_SIZE + \
-                ASF_PPI_SEQUENCE_FIELD_SIZE + \
-                ASF_PPI_PADDING_LENGTH_FIELD_SIZE + \
-                4 + /*Send Time Field*/ \
-                2   /*Duration Field*/ \
-                )
-
-
-// Replicated Data shall be at least 8 bytes long.
-#define ASF_PAYLOAD_REPLICATED_DATA_LENGTH 0x08
-
-#define PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD (\
-                1 + /*Stream Number*/ \
-                ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE + \
-                ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE + \
-                ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE + \
-                ASF_PAYLOAD_REPLICATED_DATA_LENGTH \
-                )
-
-#define PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS (\
-                1 + /*Stream Number*/ \
-                ASF_PAYLOAD_MEDIA_OBJECT_NUMBER_FIELD_SIZE + \
-                ASF_PAYLOAD_OFFSET_INTO_MEDIA_OBJECT_FIELD_SIZE + \
-                ASF_PAYLOAD_REPLICATED_DATA_LENGTH_FIELD_SIZE + \
-                ASF_PAYLOAD_REPLICATED_DATA_LENGTH + \
-                ASF_PAYLOAD_LENGTH_FIELD_SIZE \
-                )
-
-#define SINGLE_PAYLOAD_DATA_LENGTH (\
-                PACKET_SIZE - \
-                PACKET_HEADER_MIN_SIZE - \
-                PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD \
-                )
-
-#define MULTI_PAYLOAD_CONSTANT (\
-                PACKET_SIZE - \
-                PACKET_HEADER_MIN_SIZE - \
-                1 - /*Payload Flags*/ \
-                2*PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS \
-                )
-
-static const AVCodecTag codec_asf_bmp_tags[] = {
-    { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
-    { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
-    { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
-    { CODEC_ID_NONE, 0 },
-};
-
-#define PREROLL_TIME 3100
-
-static void put_guid(ByteIOContext *s, const ff_asf_guid *g)
-{
-    assert(sizeof(*g) == 16);
-    put_buffer(s, *g, sizeof(*g));
-}
-
-static void put_str16(ByteIOContext *s, const char *tag)
-{
-    int len;
-    uint8_t *pb;
-    ByteIOContext *dyn_buf;
-    if (url_open_dyn_buf(&dyn_buf) < 0)
-        return;
-
-    ff_put_str16_nolen(dyn_buf, tag);
-    len = url_close_dyn_buf(dyn_buf, &pb);
-    put_le16(s, len);
-    put_buffer(s, pb, len);
-    av_freep(&pb);
-}
-
-static int64_t put_header(ByteIOContext *pb, const ff_asf_guid *g)
-{
-    int64_t pos;
-
-    pos = url_ftell(pb);
-    put_guid(pb, g);
-    put_le64(pb, 24);
-    return pos;
-}
-
-/* update header size */
-static void end_header(ByteIOContext *pb, int64_t pos)
-{
-    int64_t pos1;
-
-    pos1 = url_ftell(pb);
-    url_fseek(pb, pos + 16, SEEK_SET);
-    put_le64(pb, pos1 - pos);
-    url_fseek(pb, pos1, SEEK_SET);
-}
-
-/* write an asf chunk (only used in streaming case) */
-static void put_chunk(AVFormatContext *s, int type, int payload_length, int flags)
-{
-    ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int length;
-
-    length = payload_length + 8;
-    put_le16(pb, type);
-    put_le16(pb, length);    //size
-    put_le32(pb, asf->seqno);//sequence number
-    put_le16(pb, flags); /* unknown bytes */
-    put_le16(pb, length);    //size_confirm
-    asf->seqno++;
-}
-
-/* convert from unix to windows time */
-static int64_t unix_to_file_time(int ti)
-{
-    int64_t t;
-
-    t = ti * INT64_C(10000000);
-    t += INT64_C(116444736000000000);
-    return t;
-}
-
-/* write the header (used two times if non streamed) */
-static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size)
-{
-    ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVMetadataTag *tags[5];
-    int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
-    int has_title;
-    int metadata_count;
-    AVCodecContext *enc;
-    int64_t header_offset, cur_pos, hpos;
-    int bit_rate;
-    int64_t duration;
-
-    tags[0] = av_metadata_get(s->metadata, "title"    , NULL, 0);
-    tags[1] = av_metadata_get(s->metadata, "author"   , NULL, 0);
-    tags[2] = av_metadata_get(s->metadata, "copyright", NULL, 0);
-    tags[3] = av_metadata_get(s->metadata, "comment"  , NULL, 0);
-    tags[4] = av_metadata_get(s->metadata, "rating"   , NULL, 0);
-
-    duration = asf->duration + PREROLL_TIME * 10000;
-    has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4];
-    metadata_count = s->metadata ? s->metadata->count : 0;
-
-    bit_rate = 0;
-    for(n=0;n<s->nb_streams;n++) {
-        enc = s->streams[n]->codec;
-
-        av_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */
-
-        bit_rate += enc->bit_rate;
-    }
-
-    if (asf->is_streamed) {
-        put_chunk(s, 0x4824, 0, 0xc00); /* start of stream (length will be patched later) */
-    }
-
-    put_guid(pb, &ff_asf_header);
-    put_le64(pb, -1); /* header length, will be patched after */
-    put_le32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */
-    put_byte(pb, 1); /* ??? */
-    put_byte(pb, 2); /* ??? */
-
-    /* file header */
-    header_offset = url_ftell(pb);
-    hpos = put_header(pb, &ff_asf_file_header);
-    put_guid(pb, &ff_asf_my_guid);
-    put_le64(pb, file_size);
-    file_time = 0;
-    put_le64(pb, unix_to_file_time(file_time));
-    put_le64(pb, asf->nb_packets); /* number of packets */
-    put_le64(pb, duration); /* end time stamp (in 100ns units) */
-    put_le64(pb, asf->duration); /* duration (in 100ns units) */
-    put_le64(pb, PREROLL_TIME); /* start time stamp */
-    put_le32(pb, (asf->is_streamed || url_is_streamed(pb)) ? 3 : 2); /* ??? */
-    put_le32(pb, s->packet_size); /* packet size */
-    put_le32(pb, s->packet_size); /* packet size */
-    put_le32(pb, bit_rate); /* Nominal data rate in bps */
-    end_header(pb, hpos);
-
-    /* unknown headers */
-    hpos = put_header(pb, &ff_asf_head1_guid);
-    put_guid(pb, &ff_asf_head2_guid);
-    put_le32(pb, 6);
-    put_le16(pb, 0);
-    end_header(pb, hpos);
-
-    /* title and other infos */
-    if (has_title) {
-        int len;
-        uint8_t *buf;
-        ByteIOContext *dyn_buf;
-
-        if (url_open_dyn_buf(&dyn_buf) < 0)
-            return AVERROR(ENOMEM);
-
-        hpos = put_header(pb, &ff_asf_comment_header);
-
-        for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) {
-            len = tags[n] ? ff_put_str16_nolen(dyn_buf, tags[n]->value) : 0;
-            put_le16(pb, len);
-        }
-        len = url_close_dyn_buf(dyn_buf, &buf);
-        put_buffer(pb, buf, len);
-        av_freep(&buf);
-        end_header(pb, hpos);
-    }
-    if (metadata_count) {
-        AVMetadataTag *tag = NULL;
-        hpos = put_header(pb, &ff_asf_extended_content_header);
-        put_le16(pb, metadata_count);
-        while ((tag = av_metadata_get(s->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
-            put_str16(pb, tag->key);
-            put_le16(pb, 0);
-            put_str16(pb, tag->value);
-        }
-        end_header(pb, hpos);
-    }
-
-    /* stream headers */
-    for(n=0;n<s->nb_streams;n++) {
-        int64_t es_pos;
-        //        ASFStream *stream = &asf->streams[n];
-
-        enc = s->streams[n]->codec;
-        asf->streams[n].num = n + 1;
-        asf->streams[n].seq = 0;
-
-
-        switch(enc->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            wav_extra_size = 0;
-            extra_size = 18 + wav_extra_size;
-            extra_size2 = 8;
-            break;
-        default:
-        case AVMEDIA_TYPE_VIDEO:
-            wav_extra_size = enc->extradata_size;
-            extra_size = 0x33 + wav_extra_size;
-            extra_size2 = 0;
-            break;
-        }
-
-        hpos = put_header(pb, &ff_asf_stream_header);
-        if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            put_guid(pb, &ff_asf_audio_stream);
-            put_guid(pb, &ff_asf_audio_conceal_spread);
-        } else {
-            put_guid(pb, &ff_asf_video_stream);
-            put_guid(pb, &ff_asf_video_conceal_none);
-        }
-        put_le64(pb, 0); /* ??? */
-        es_pos = url_ftell(pb);
-        put_le32(pb, extra_size); /* wav header len */
-        put_le32(pb, extra_size2); /* additional data len */
-        put_le16(pb, n + 1); /* stream number */
-        put_le32(pb, 0); /* ??? */
-
-        if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            /* WAVEFORMATEX header */
-            int wavsize = ff_put_wav_header(pb, enc);
-            if ((enc->codec_id != CODEC_ID_MP3) && (enc->codec_id != CODEC_ID_MP2) && (enc->codec_id != CODEC_ID_ADPCM_IMA_WAV) && (enc->extradata_size==0)) {
-                wavsize += 2;
-                put_le16(pb, 0);
-            }
-
-            if (wavsize < 0)
-                return -1;
-            if (wavsize != extra_size) {
-                cur_pos = url_ftell(pb);
-                url_fseek(pb, es_pos, SEEK_SET);
-                put_le32(pb, wavsize); /* wav header len */
-                url_fseek(pb, cur_pos, SEEK_SET);
-            }
-            /* ERROR Correction */
-            put_byte(pb, 0x01);
-            if(enc->codec_id == CODEC_ID_ADPCM_G726 || !enc->block_align){
-                put_le16(pb, 0x0190);
-                put_le16(pb, 0x0190);
-            }else{
-                put_le16(pb, enc->block_align);
-                put_le16(pb, enc->block_align);
-            }
-            put_le16(pb, 0x01);
-            put_byte(pb, 0x00);
-        } else {
-            put_le32(pb, enc->width);
-            put_le32(pb, enc->height);
-            put_byte(pb, 2); /* ??? */
-            put_le16(pb, 40 + enc->extradata_size); /* size */
-
-            /* BITMAPINFOHEADER header */
-            ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1);
-        }
-        end_header(pb, hpos);
-    }
-
-    /* media comments */
-
-    hpos = put_header(pb, &ff_asf_codec_comment_header);
-    put_guid(pb, &ff_asf_codec_comment1_header);
-    put_le32(pb, s->nb_streams);
-    for(n=0;n<s->nb_streams;n++) {
-        AVCodec *p;
-        const char *desc;
-        int len;
-        uint8_t *buf;
-        ByteIOContext *dyn_buf;
-
-        enc = s->streams[n]->codec;
-        p = avcodec_find_encoder(enc->codec_id);
-
-        if(enc->codec_type == AVMEDIA_TYPE_AUDIO)
-            put_le16(pb, 2);
-        else if(enc->codec_type == AVMEDIA_TYPE_VIDEO)
-            put_le16(pb, 1);
-        else
-            put_le16(pb, -1);
-
-        if(enc->codec_id == CODEC_ID_WMAV2)
-            desc = "Windows Media Audio V8";
-        else
-            desc = p ? p->name : enc->codec_name;
-
-        if ( url_open_dyn_buf(&dyn_buf) < 0)
-            return AVERROR(ENOMEM);
-
-        ff_put_str16_nolen(dyn_buf, desc);
-        len = url_close_dyn_buf(dyn_buf, &buf);
-        put_le16(pb, len / 2); // "number of characters" = length in bytes / 2
-
-        put_buffer(pb, buf, len);
-        av_freep(&buf);
-
-        put_le16(pb, 0); /* no parameters */
-
-
-        /* id */
-        if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            put_le16(pb, 2);
-            put_le16(pb, enc->codec_tag);
-        } else {
-            put_le16(pb, 4);
-            put_le32(pb, enc->codec_tag);
-        }
-        if(!enc->codec_tag)
-            return -1;
-    }
-    end_header(pb, hpos);
-
-    /* patch the header size fields */
-
-    cur_pos = url_ftell(pb);
-    header_size = cur_pos - header_offset;
-    if (asf->is_streamed) {
-        header_size += 8 + 30 + 50;
-
-        url_fseek(pb, header_offset - 10 - 30, SEEK_SET);
-        put_le16(pb, header_size);
-        url_fseek(pb, header_offset - 2 - 30, SEEK_SET);
-        put_le16(pb, header_size);
-
-        header_size -= 8 + 30 + 50;
-    }
-    header_size += 24 + 6;
-    url_fseek(pb, header_offset - 14, SEEK_SET);
-    put_le64(pb, header_size);
-    url_fseek(pb, cur_pos, SEEK_SET);
-
-    /* movie chunk, followed by packets of packet_size */
-    asf->data_offset = cur_pos;
-    put_guid(pb, &ff_asf_data_header);
-    put_le64(pb, data_chunk_size);
-    put_guid(pb, &ff_asf_my_guid);
-    put_le64(pb, asf->nb_packets); /* nb packets */
-    put_byte(pb, 1); /* ??? */
-    put_byte(pb, 1); /* ??? */
-    return 0;
-}
-
-static int asf_write_header(AVFormatContext *s)
-{
-    ASFContext *asf = s->priv_data;
-
-    s->packet_size  = PACKET_SIZE;
-    asf->nb_packets = 0;
-
-    asf->last_indexed_pts = 0;
-    asf->index_ptr = av_malloc( sizeof(ASFIndex) * ASF_INDEX_BLOCK );
-    asf->nb_index_memory_alloc = ASF_INDEX_BLOCK;
-    asf->nb_index_count = 0;
-    asf->maximum_packet = 0;
-
-    /* the data-chunk-size has to be 50, which is data_size - asf->data_offset
-     *  at the moment this function is done. It is needed to use asf as
-     *  streamable format. */
-    if (asf_write_header1(s, 0, 50) < 0) {
-        //av_free(asf);
-        return -1;
-    }
-
-    put_flush_packet(s->pb);
-
-    asf->packet_nb_payloads = 0;
-    asf->packet_timestamp_start = -1;
-    asf->packet_timestamp_end = -1;
-    init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1,
-                  NULL, NULL, NULL, NULL);
-
-    return 0;
-}
-
-static int asf_write_stream_header(AVFormatContext *s)
-{
-    ASFContext *asf = s->priv_data;
-
-    asf->is_streamed = 1;
-
-    return asf_write_header(s);
-}
-
-static int put_payload_parsing_info(
-                                AVFormatContext *s,
-                                unsigned int    sendtime,
-                                unsigned int    duration,
-                                int             nb_payloads,
-                                int             padsize
-            )
-{
-    ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ppi_size, i;
-    int64_t start= url_ftell(pb);
-
-    int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS;
-
-    padsize -= PACKET_HEADER_MIN_SIZE;
-    if(asf->multi_payloads_present)
-        padsize--;
-    assert(padsize>=0);
-
-    put_byte(pb, ASF_PACKET_ERROR_CORRECTION_FLAGS);
-    for (i = 0; i < ASF_PACKET_ERROR_CORRECTION_DATA_SIZE; i++){
-        put_byte(pb, 0x0);
-    }
-
-    if (asf->multi_payloads_present)
-        iLengthTypeFlags |= ASF_PPI_FLAG_MULTIPLE_PAYLOADS_PRESENT;
-
-    if (padsize > 0) {
-        if (padsize < 256)
-            iLengthTypeFlags |= ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE;
-        else
-            iLengthTypeFlags |= ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD;
-    }
-    put_byte(pb, iLengthTypeFlags);
-
-    put_byte(pb, ASF_PPI_PROPERTY_FLAGS);
-
-    if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD)
-        put_le16(pb, padsize - 2);
-    if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE)
-        put_byte(pb, padsize - 1);
-
-    put_le32(pb, sendtime);
-    put_le16(pb, duration);
-    if (asf->multi_payloads_present)
-        put_byte(pb, nb_payloads | ASF_PAYLOAD_FLAGS);
-
-    ppi_size = url_ftell(pb) - start;
-
-    return ppi_size;
-}
-
-static void flush_packet(AVFormatContext *s)
-{
-    ASFContext *asf = s->priv_data;
-    int packet_hdr_size, packet_filled_size;
-
-    assert(asf->packet_timestamp_end >= asf->packet_timestamp_start);
-
-    if (asf->is_streamed) {
-        put_chunk(s, 0x4424, s->packet_size, 0);
-    }
-
-    packet_hdr_size = put_payload_parsing_info(
-                            s,
-                            asf->packet_timestamp_start,
-                            asf->packet_timestamp_end - asf->packet_timestamp_start,
-                            asf->packet_nb_payloads,
-                            asf->packet_size_left
-                        );
-
-    packet_filled_size = PACKET_SIZE - asf->packet_size_left;
-    assert(packet_hdr_size <= asf->packet_size_left);
-    memset(asf->packet_buf + packet_filled_size, 0, asf->packet_size_left);
-
-    put_buffer(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size);
-
-    put_flush_packet(s->pb);
-    asf->nb_packets++;
-    asf->packet_nb_payloads = 0;
-    asf->packet_timestamp_start = -1;
-    asf->packet_timestamp_end = -1;
-    init_put_byte(&asf->pb, asf->packet_buf, s->packet_size, 1,
-                  NULL, NULL, NULL, NULL);
-}
-
-static void put_payload_header(
-                                AVFormatContext *s,
-                                ASFStream       *stream,
-                                int             presentation_time,
-                                int             m_obj_size,
-                                int             m_obj_offset,
-                                int             payload_len,
-                                int             flags
-            )
-{
-    ASFContext *asf = s->priv_data;
-    ByteIOContext *pb = &asf->pb;
-    int val;
-
-    val = stream->num;
-    if (flags & AV_PKT_FLAG_KEY)
-        val |= ASF_PL_FLAG_KEY_FRAME;
-    put_byte(pb, val);
-
-    put_byte(pb, stream->seq);  //Media object number
-    put_le32(pb, m_obj_offset); //Offset Into Media Object
-
-    // Replicated Data shall be at least 8 bytes long.
-    // The first 4 bytes of data shall contain the
-    // Size of the Media Object that the payload belongs to.
-    // The next 4 bytes of data shall contain the
-    // Presentation Time for the media object that the payload belongs to.
-    put_byte(pb, ASF_PAYLOAD_REPLICATED_DATA_LENGTH);
-
-    put_le32(pb, m_obj_size);       //Replicated Data - Media Object Size
-    put_le32(pb, presentation_time);//Replicated Data - Presentation Time
-
-    if (asf->multi_payloads_present){
-        put_le16(pb, payload_len);   //payload length
-    }
-}
-
-static void put_frame(
-                    AVFormatContext *s,
-                    ASFStream       *stream,
-                    AVStream        *avst,
-                    int             timestamp,
-                    const uint8_t   *buf,
-                    int             m_obj_size,
-                    int             flags
-                )
-{
-    ASFContext *asf = s->priv_data;
-    int m_obj_offset, payload_len, frag_len1;
-
-    m_obj_offset = 0;
-    while (m_obj_offset < m_obj_size) {
-        payload_len = m_obj_size - m_obj_offset;
-        if (asf->packet_timestamp_start == -1) {
-            asf->multi_payloads_present = (payload_len < MULTI_PAYLOAD_CONSTANT);
-
-            asf->packet_size_left = PACKET_SIZE;
-            if (asf->multi_payloads_present){
-                frag_len1 = MULTI_PAYLOAD_CONSTANT - 1;
-            }
-            else {
-                frag_len1 = SINGLE_PAYLOAD_DATA_LENGTH;
-            }
-            asf->packet_timestamp_start = timestamp;
-        }
-        else {
-            // multi payloads
-            frag_len1 = asf->packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS - PACKET_HEADER_MIN_SIZE - 1;
-
-            if(frag_len1 < payload_len && avst->codec->codec_type == AVMEDIA_TYPE_AUDIO){
-                flush_packet(s);
-                continue;
-            }
-        }
-        if (frag_len1 > 0) {
-            if (payload_len > frag_len1)
-                payload_len = frag_len1;
-            else if (payload_len == (frag_len1 - 1))
-                payload_len = frag_len1 - 2;  //additional byte need to put padding length
-
-            put_payload_header(s, stream, timestamp+PREROLL_TIME, m_obj_size, m_obj_offset, payload_len, flags);
-            put_buffer(&asf->pb, buf, payload_len);
-
-            if (asf->multi_payloads_present)
-                asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS);
-            else
-                asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD);
-            asf->packet_timestamp_end = timestamp;
-
-            asf->packet_nb_payloads++;
-        } else {
-            payload_len = 0;
-        }
-        m_obj_offset += payload_len;
-        buf += payload_len;
-
-        if (!asf->multi_payloads_present)
-            flush_packet(s);
-        else if (asf->packet_size_left <= (PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + PACKET_HEADER_MIN_SIZE + 1))
-            flush_packet(s);
-    }
-    stream->seq++;
-}
-
-static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ASFContext *asf = s->priv_data;
-    ASFStream *stream;
-    int64_t duration;
-    AVCodecContext *codec;
-    int64_t packet_st,pts;
-    int start_sec,i;
-    int flags= pkt->flags;
-
-    codec = s->streams[pkt->stream_index]->codec;
-    stream = &asf->streams[pkt->stream_index];
-
-    if(codec->codec_type == AVMEDIA_TYPE_AUDIO)
-        flags &= ~AV_PKT_FLAG_KEY;
-
-    pts = (pkt->pts != AV_NOPTS_VALUE) ? pkt->pts : pkt->dts;
-    assert(pts != AV_NOPTS_VALUE);
-    duration = pts * 10000;
-    asf->duration= FFMAX(asf->duration, duration + pkt->duration * 10000);
-
-    packet_st = asf->nb_packets;
-    put_frame(s, stream, s->streams[pkt->stream_index], pkt->dts, pkt->data, pkt->size, flags);
-
-    /* check index */
-    if ((!asf->is_streamed) && (flags & AV_PKT_FLAG_KEY)) {
-        start_sec = (int)(duration / INT64_C(10000000));
-        if (start_sec != (int)(asf->last_indexed_pts / INT64_C(10000000))) {
-            for(i=asf->nb_index_count;i<start_sec;i++) {
-                if (i>=asf->nb_index_memory_alloc) {
-                    asf->nb_index_memory_alloc += ASF_INDEX_BLOCK;
-                    asf->index_ptr = (ASFIndex*)av_realloc( asf->index_ptr, sizeof(ASFIndex) * asf->nb_index_memory_alloc );
-                }
-                // store
-                asf->index_ptr[i].packet_number = (uint32_t)packet_st;
-                asf->index_ptr[i].packet_count  = (uint16_t)(asf->nb_packets-packet_st);
-                asf->maximum_packet = FFMAX(asf->maximum_packet, (uint16_t)(asf->nb_packets-packet_st));
-            }
-            asf->nb_index_count = start_sec;
-            asf->last_indexed_pts = duration;
-        }
-    }
-    return 0;
-}
-
-//
-static int asf_write_index(AVFormatContext *s, ASFIndex *index, uint16_t max, uint32_t count)
-{
-    ByteIOContext *pb = s->pb;
-    int i;
-
-    put_guid(pb, &ff_asf_simple_index_header);
-    put_le64(pb, 24 + 16 + 8 + 4 + 4 + (4 + 2)*count);
-    put_guid(pb, &ff_asf_my_guid);
-    put_le64(pb, ASF_INDEXED_INTERVAL);
-    put_le32(pb, max);
-    put_le32(pb, count);
-    for(i=0; i<count; i++) {
-        put_le32(pb, index[i].packet_number);
-        put_le16(pb, index[i].packet_count);
-    }
-
-    return 0;
-}
-
-static int asf_write_trailer(AVFormatContext *s)
-{
-    ASFContext *asf = s->priv_data;
-    int64_t file_size,data_size;
-
-    /* flush the current packet */
-    if (asf->pb.buf_ptr > asf->pb.buffer)
-        flush_packet(s);
-
-    /* write index */
-    data_size = url_ftell(s->pb);
-    if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
-        asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
-    }
-    put_flush_packet(s->pb);
-
-    if (asf->is_streamed || url_is_streamed(s->pb)) {
-        put_chunk(s, 0x4524, 0, 0); /* end of stream */
-    } else {
-        /* rewrite an updated header */
-        file_size = url_ftell(s->pb);
-        url_fseek(s->pb, 0, SEEK_SET);
-        asf_write_header1(s, file_size, data_size - asf->data_offset);
-    }
-
-    put_flush_packet(s->pb);
-    av_free(asf->index_ptr);
-    return 0;
-}
-
-#if CONFIG_ASF_MUXER
-AVOutputFormat asf_muxer = {
-    "asf",
-    NULL_IF_CONFIG_SMALL("ASF format"),
-    "video/x-ms-asf",
-    "asf,wmv,wma",
-    sizeof(ASFContext),
-#if CONFIG_LIBMP3LAME
-    CODEC_ID_MP3,
-#else
-    CODEC_ID_MP2,
-#endif
-    CODEC_ID_MSMPEG4V3,
-    asf_write_header,
-    asf_write_packet,
-    asf_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-    .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0},
-    .metadata_conv = ff_asf_metadata_conv,
-};
-#endif
-
-#if CONFIG_ASF_STREAM_MUXER
-AVOutputFormat asf_stream_muxer = {
-    "asf_stream",
-    NULL_IF_CONFIG_SMALL("ASF format"),
-    "video/x-ms-asf",
-    "asf,wmv,wma",
-    sizeof(ASFContext),
-#if CONFIG_LIBMP3LAME
-    CODEC_ID_MP3,
-#else
-    CODEC_ID_MP2,
-#endif
-    CODEC_ID_MSMPEG4V3,
-    asf_write_stream_header,
-    asf_write_packet,
-    asf_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-    .codec_tag= (const AVCodecTag* const []){codec_asf_bmp_tags, ff_codec_bmp_tags, ff_codec_wav_tags, 0},
-    .metadata_conv = ff_asf_metadata_conv,
-};
-#endif //CONFIG_ASF_STREAM_MUXER
diff --git a/libavformat/assdec.c b/libavformat/assdec.c
deleted file mode 100644
index 5f8e0b9..0000000
--- a/libavformat/assdec.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * SSA/ASS demuxer
- * Copyright (c) 2008 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-#define MAX_LINESIZE 2000
-
-typedef struct ASSContext{
-    uint8_t *event_buffer;
-    uint8_t **event;
-    unsigned int event_count;
-    unsigned int event_index;
-}ASSContext;
-
-static void get_line(ByteIOContext *s, char *buf, int maxlen)
-{
-    int i = 0;
-    char c;
-
-    do{
-        c = get_byte(s);
-        if (i < maxlen-1)
-            buf[i++] = c;
-    }while(c != '\n' && c);
-
-    buf[i] = 0;
-}
-
-static int probe(AVProbeData *p)
-{
-    const char *header= "[Script Info]";
-
-    if(   !memcmp(p->buf  , header, strlen(header))
-       || !memcmp(p->buf+3, header, strlen(header)))
-        return AVPROBE_SCORE_MAX;
-
-    return 0;
-}
-
-static int read_close(AVFormatContext *s)
-{
-    ASSContext *ass = s->priv_data;
-
-    av_freep(&ass->event_buffer);
-    av_freep(&ass->event);
-
-    return 0;
-}
-
-static int64_t get_pts(const uint8_t *p)
-{
-    int hour, min, sec, hsec;
-
-    if(sscanf(p, "%*[^,],%d:%d:%d%*c%d", &hour, &min, &sec, &hsec) != 4)
-        return AV_NOPTS_VALUE;
-
-//    av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d [%s]\n", i, hour, min, sec, hsec, p);
-
-    min+= 60*hour;
-    sec+= 60*min;
-
-    return sec*100+hsec;
-}
-
-static int event_cmp(uint8_t **a, uint8_t **b)
-{
-    return get_pts(*a) - get_pts(*b);
-}
-
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    int i, header_remaining;
-    ASSContext *ass = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    int allocated[2]={0};
-    uint8_t *p, **dst[2]={0};
-    int pos[2]={0};
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-    av_set_pts_info(st, 64, 1, 100);
-    st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-    st->codec->codec_id= CODEC_ID_SSA;
-
-    header_remaining= INT_MAX;
-    dst[0] = &st->codec->extradata;
-    dst[1] = &ass->event_buffer;
-    while(!url_feof(pb)){
-        uint8_t line[MAX_LINESIZE];
-
-        get_line(pb, line, sizeof(line));
-
-        if(!memcmp(line, "[Events]", 8))
-            header_remaining= 2;
-        else if(line[0]=='[')
-            header_remaining= INT_MAX;
-
-        i= header_remaining==0;
-
-        if(i && get_pts(line) == AV_NOPTS_VALUE)
-            continue;
-
-        p = av_fast_realloc(*(dst[i]), &allocated[i], pos[i]+MAX_LINESIZE);
-        if(!p)
-            goto fail;
-        *(dst[i])= p;
-        memcpy(p + pos[i], line, strlen(line)+1);
-        pos[i] += strlen(line);
-        if(i) ass->event_count++;
-        else  header_remaining--;
-    }
-    st->codec->extradata_size= pos[0];
-
-    if(ass->event_count >= UINT_MAX / sizeof(*ass->event))
-        goto fail;
-
-    ass->event= av_malloc(ass->event_count * sizeof(*ass->event));
-    p= ass->event_buffer;
-    for(i=0; i<ass->event_count; i++){
-        ass->event[i]= p;
-        while(*p && *p != '\n')
-            p++;
-        p++;
-    }
-
-    qsort(ass->event, ass->event_count, sizeof(*ass->event), (void*)event_cmp);
-
-    return 0;
-
-fail:
-    read_close(s);
-
-    return -1;
-}
-
-static int read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ASSContext *ass = s->priv_data;
-    uint8_t *p, *end;
-
-    if(ass->event_index >= ass->event_count)
-        return AVERROR(EIO);
-
-    p= ass->event[ ass->event_index ];
-
-    end= strchr(p, '\n');
-    av_new_packet(pkt, end ? end-p+1 : strlen(p));
-    pkt->flags |= AV_PKT_FLAG_KEY;
-    pkt->pos= p - ass->event_buffer + s->streams[0]->codec->extradata_size;
-    pkt->pts= pkt->dts= get_pts(p);
-    memcpy(pkt->data, p, pkt->size);
-
-    ass->event_index++;
-
-    return 0;
-}
-
-AVInputFormat ass_demuxer = {
-    "ass",
-    NULL_IF_CONFIG_SMALL("SSA/ASS format"),
-    sizeof(ASSContext),
-    probe,
-    read_header,
-    read_packet,
-    read_close,
-//    read_seek,
-};
diff --git a/libavformat/assenc.c b/libavformat/assenc.c
deleted file mode 100644
index d1b93e8..0000000
--- a/libavformat/assenc.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * SSA/ASS muxer
- * Copyright (c) 2008 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-typedef struct ASSContext{
-    unsigned int extra_index;
-}ASSContext;
-
-static int write_header(AVFormatContext *s)
-{
-    ASSContext *ass = s->priv_data;
-    AVCodecContext *avctx= s->streams[0]->codec;
-    uint8_t *last= NULL;
-
-    if(s->nb_streams != 1 || avctx->codec_id != CODEC_ID_SSA){
-        av_log(s, AV_LOG_ERROR, "Exactly one ASS/SSA stream is needed.\n");
-        return -1;
-    }
-
-    while(ass->extra_index < avctx->extradata_size){
-        uint8_t *p  = avctx->extradata + ass->extra_index;
-        uint8_t *end= strchr(p, '\n');
-        if(!end) end= avctx->extradata + avctx->extradata_size;
-        else     end++;
-
-        put_buffer(s->pb, p, end-p);
-        ass->extra_index += end-p;
-
-        if(last && !memcmp(last, "[Events]", 8))
-            break;
-        last=p;
-    }
-
-    put_flush_packet(s->pb);
-
-    return 0;
-}
-
-static int write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    put_buffer(s->pb, pkt->data, pkt->size);
-
-    put_flush_packet(s->pb);
-
-    return 0;
-}
-
-static int write_trailer(AVFormatContext *s)
-{
-    ASSContext *ass = s->priv_data;
-    AVCodecContext *avctx= s->streams[0]->codec;
-
-    put_buffer(s->pb, avctx->extradata      + ass->extra_index,
-                      avctx->extradata_size - ass->extra_index);
-
-    put_flush_packet(s->pb);
-
-    return 0;
-}
-
-AVOutputFormat ass_muxer = {
-    "ass",
-    NULL_IF_CONFIG_SMALL("SSA/ASS format"),
-    NULL,
-    "ass,ssa",
-    sizeof(ASSContext),
-    CODEC_ID_NONE,
-    CODEC_ID_NONE,
-    write_header,
-    write_packet,
-    write_trailer,
-    .flags = AVFMT_GLOBALHEADER | AVFMT_NOTIMESTAMPS
-};
diff --git a/libavformat/au.c b/libavformat/au.c
deleted file mode 100644
index f8f718d..0000000
--- a/libavformat/au.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * AU muxer and demuxer
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * First version by Francois Revol revol at free.fr
- *
- * Reference documents:
- * http://www.opengroup.org/public/pubs/external/auformat.html
- * http://www.goice.co.jp/member/mo/formats/au.html
- */
-
-#include "avformat.h"
-#include "raw.h"
-#include "riff.h"
-
-/* if we don't know the size in advance */
-#define AU_UNKNOWN_SIZE ((uint32_t)(~0))
-
-/* The ffmpeg codecs we support, and the IDs they have in the file */
-static const AVCodecTag codec_au_tags[] = {
-    { CODEC_ID_PCM_MULAW, 1 },
-    { CODEC_ID_PCM_S8, 2 },
-    { CODEC_ID_PCM_S16BE, 3 },
-    { CODEC_ID_PCM_S24BE, 4 },
-    { CODEC_ID_PCM_S32BE, 5 },
-    { CODEC_ID_PCM_F32BE, 6 },
-    { CODEC_ID_PCM_F64BE, 7 },
-    { CODEC_ID_PCM_ALAW, 27 },
-    { CODEC_ID_NONE, 0 },
-};
-
-#if CONFIG_AU_MUXER
-/* AUDIO_FILE header */
-static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
-{
-    if(!enc->codec_tag)
-        return -1;
-    put_tag(pb, ".snd");       /* magic number */
-    put_be32(pb, 24);           /* header size */
-    put_be32(pb, AU_UNKNOWN_SIZE); /* data size */
-    put_be32(pb, (uint32_t)enc->codec_tag);     /* codec ID */
-    put_be32(pb, enc->sample_rate);
-    put_be32(pb, (uint32_t)enc->channels);
-    return 0;
-}
-
-static int au_write_header(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-
-    s->priv_data = NULL;
-
-    /* format header */
-    if (put_au_header(pb, s->streams[0]->codec) < 0) {
-        return -1;
-    }
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static int au_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
-    return 0;
-}
-
-static int au_write_trailer(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    int64_t file_size;
-
-    if (!url_is_streamed(s->pb)) {
-
-        /* update file size */
-        file_size = url_ftell(pb);
-        url_fseek(pb, 8, SEEK_SET);
-        put_be32(pb, (uint32_t)(file_size - 24));
-        url_fseek(pb, file_size, SEEK_SET);
-
-        put_flush_packet(pb);
-    }
-
-    return 0;
-}
-#endif /* CONFIG_AU_MUXER */
-
-static int au_probe(AVProbeData *p)
-{
-    /* check file header */
-    if (p->buf[0] == '.' && p->buf[1] == 's' &&
-        p->buf[2] == 'n' && p->buf[3] == 'd')
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-/* au input */
-static int au_read_header(AVFormatContext *s,
-                          AVFormatParameters *ap)
-{
-    int size;
-    unsigned int tag;
-    ByteIOContext *pb = s->pb;
-    unsigned int id, channels, rate;
-    enum CodecID codec;
-    AVStream *st;
-
-    /* check ".snd" header */
-    tag = get_le32(pb);
-    if (tag != MKTAG('.', 's', 'n', 'd'))
-        return -1;
-    size = get_be32(pb); /* header size */
-    get_be32(pb); /* data size */
-
-    id = get_be32(pb);
-    rate = get_be32(pb);
-    channels = get_be32(pb);
-
-    codec = ff_codec_get_id(codec_au_tags, id);
-
-    if (size >= 24) {
-        /* skip unused data */
-        url_fseek(pb, size - 24, SEEK_CUR);
-    }
-
-    /* now we are ready: build format streams */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_tag = id;
-    st->codec->codec_id = codec;
-    st->codec->channels = channels;
-    st->codec->sample_rate = rate;
-    av_set_pts_info(st, 64, 1, rate);
-    return 0;
-}
-
-#define BLOCK_SIZE 1024
-
-static int au_read_packet(AVFormatContext *s,
-                          AVPacket *pkt)
-{
-    int ret;
-
-    ret= av_get_packet(s->pb, pkt, BLOCK_SIZE *
-                       s->streams[0]->codec->channels *
-                       av_get_bits_per_sample(s->streams[0]->codec->codec_id) >> 3);
-    if (ret < 0)
-        return ret;
-    pkt->stream_index = 0;
-
-    /* note: we need to modify the packet size here to handle the last
-       packet */
-    pkt->size = ret;
-    return 0;
-}
-
-#if CONFIG_AU_DEMUXER
-AVInputFormat au_demuxer = {
-    "au",
-    NULL_IF_CONFIG_SMALL("SUN AU format"),
-    0,
-    au_probe,
-    au_read_header,
-    au_read_packet,
-    NULL,
-    pcm_read_seek,
-    .codec_tag= (const AVCodecTag* const []){codec_au_tags, 0},
-};
-#endif
-
-#if CONFIG_AU_MUXER
-AVOutputFormat au_muxer = {
-    "au",
-    NULL_IF_CONFIG_SMALL("SUN AU format"),
-    "audio/basic",
-    "au",
-    0,
-    CODEC_ID_PCM_S16BE,
-    CODEC_ID_NONE,
-    au_write_header,
-    au_write_packet,
-    au_write_trailer,
-    .codec_tag= (const AVCodecTag* const []){codec_au_tags, 0},
-};
-#endif //CONFIG_AU_MUXER
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
deleted file mode 100644
index 3c235c0..0000000
--- a/libavformat/audiointerleave.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Audio Interleaving functions
- *
- * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/fifo.h"
-#include "avformat.h"
-#include "audiointerleave.h"
-#include "internal.h"
-
-void ff_audio_interleave_close(AVFormatContext *s)
-{
-    int i;
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        AudioInterleaveContext *aic = st->priv_data;
-
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
-            av_fifo_free(aic->fifo);
-    }
-}
-
-int ff_audio_interleave_init(AVFormatContext *s,
-                             const int *samples_per_frame,
-                             AVRational time_base)
-{
-    int i;
-
-    if (!samples_per_frame)
-        return -1;
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        AudioInterleaveContext *aic = st->priv_data;
-
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            aic->sample_size = (st->codec->channels *
-                                av_get_bits_per_sample(st->codec->codec_id)) / 8;
-            if (!aic->sample_size) {
-                av_log(s, AV_LOG_ERROR, "could not compute sample size\n");
-                return -1;
-            }
-            aic->samples_per_frame = samples_per_frame;
-            aic->samples = aic->samples_per_frame;
-            aic->time_base = time_base;
-
-            aic->fifo_size = 100* *aic->samples;
-            aic->fifo= av_fifo_alloc(100 * *aic->samples);
-        }
-    }
-
-    return 0;
-}
-
-static int ff_interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt,
-                                   int stream_index, int flush)
-{
-    AVStream *st = s->streams[stream_index];
-    AudioInterleaveContext *aic = st->priv_data;
-
-    int size = FFMIN(av_fifo_size(aic->fifo), *aic->samples * aic->sample_size);
-    if (!size || (!flush && size == av_fifo_size(aic->fifo)))
-        return 0;
-
-    av_new_packet(pkt, size);
-    av_fifo_generic_read(aic->fifo, pkt->data, size, NULL);
-
-    pkt->dts = pkt->pts = aic->dts;
-    pkt->duration = av_rescale_q(*aic->samples, st->time_base, aic->time_base);
-    pkt->stream_index = stream_index;
-    aic->dts += pkt->duration;
-
-    aic->samples++;
-    if (!*aic->samples)
-        aic->samples = aic->samples_per_frame;
-
-    return size;
-}
-
-int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,
-                        int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),
-                        int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *))
-{
-    int i;
-
-    if (pkt) {
-        AVStream *st = s->streams[pkt->stream_index];
-        AudioInterleaveContext *aic = st->priv_data;
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            unsigned new_size = av_fifo_size(aic->fifo) + pkt->size;
-            if (new_size > aic->fifo_size) {
-                if (av_fifo_realloc2(aic->fifo, new_size) < 0)
-                    return -1;
-                aic->fifo_size = new_size;
-            }
-            av_fifo_generic_write(aic->fifo, pkt->data, pkt->size, NULL);
-        } else {
-            // rewrite pts and dts to be decoded time line position
-            pkt->pts = pkt->dts = aic->dts;
-            aic->dts += pkt->duration;
-            ff_interleave_add_packet(s, pkt, compare_ts);
-        }
-        pkt = NULL;
-    }
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            AVPacket new_pkt;
-            while (ff_interleave_new_audio_packet(s, &new_pkt, i, flush))
-                ff_interleave_add_packet(s, &new_pkt, compare_ts);
-        }
-    }
-
-    return get_packet(s, out, pkt, flush);
-}
diff --git a/libavformat/audiointerleave.h b/libavformat/audiointerleave.h
deleted file mode 100644
index c948c36..0000000
--- a/libavformat/audiointerleave.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * audio interleaving prototypes and declarations
- *
- * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_AUDIOINTERLEAVE_H
-#define AVFORMAT_AUDIOINTERLEAVE_H
-
-#include "libavutil/fifo.h"
-#include "avformat.h"
-
-typedef struct {
-    AVFifoBuffer *fifo;
-    unsigned fifo_size;           ///< size of currently allocated FIFO
-    uint64_t dts;                 ///< current dts
-    int sample_size;              ///< size of one sample all channels included
-    const int *samples_per_frame; ///< must be 0-terminated
-    const int *samples;           ///< current samples per frame, pointer to samples_per_frame
-    AVRational time_base;         ///< time base of output audio packets
-} AudioInterleaveContext;
-
-int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base);
-void ff_audio_interleave_close(AVFormatContext *s);
-
-int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt);
-/**
- * Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame
- * and interleave them correctly.
- * The first element of AVStream->priv_data must be AudioInterleaveContext
- * when using this function.
- *
- * @param get_packet function will output a packet when streams are correctly interleaved.
- * @param compare_ts function will compare AVPackets and decide interleaving order.
- */
-int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush,
-                        int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int),
-                        int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *));
-
-#endif /* AVFORMAT_AUDIOINTERLEAVE_H */
diff --git a/libavformat/avc.c b/libavformat/avc.c
deleted file mode 100644
index 7c99196..0000000
--- a/libavformat/avc.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * AVC helper functions for muxers
- * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at smartjog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "avio.h"
-#include "avc.h"
-
-static const uint8_t *ff_avc_find_startcode_internal(const uint8_t *p, const uint8_t *end)
-{
-    const uint8_t *a = p + 4 - ((intptr_t)p & 3);
-
-    for (end -= 3; p < a && p < end; p++) {
-        if (p[0] == 0 && p[1] == 0 && p[2] == 1)
-            return p;
-    }
-
-    for (end -= 3; p < end; p += 4) {
-        uint32_t x = *(const uint32_t*)p;
-//      if ((x - 0x01000100) & (~x) & 0x80008000) // little endian
-//      if ((x - 0x00010001) & (~x) & 0x00800080) // big endian
-        if ((x - 0x01010101) & (~x) & 0x80808080) { // generic
-            if (p[1] == 0) {
-                if (p[0] == 0 && p[2] == 1)
-                    return p;
-                if (p[2] == 0 && p[3] == 1)
-                    return p+1;
-            }
-            if (p[3] == 0) {
-                if (p[2] == 0 && p[4] == 1)
-                    return p+2;
-                if (p[4] == 0 && p[5] == 1)
-                    return p+3;
-            }
-        }
-    }
-
-    for (end += 3; p < end; p++) {
-        if (p[0] == 0 && p[1] == 0 && p[2] == 1)
-            return p;
-    }
-
-    return end + 3;
-}
-
-const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end){
-    const uint8_t *out= ff_avc_find_startcode_internal(p, end);
-    if(p<out && out<end && !out[-1]) out--;
-    return out;
-}
-
-int ff_avc_parse_nal_units(ByteIOContext *pb, const uint8_t *buf_in, int size)
-{
-    const uint8_t *p = buf_in;
-    const uint8_t *end = p + size;
-    const uint8_t *nal_start, *nal_end;
-
-    size = 0;
-    nal_start = ff_avc_find_startcode(p, end);
-    while (nal_start < end) {
-        while(!*(nal_start++));
-        nal_end = ff_avc_find_startcode(nal_start, end);
-        put_be32(pb, nal_end - nal_start);
-        put_buffer(pb, nal_start, nal_end - nal_start);
-        size += 4 + nal_end - nal_start;
-        nal_start = nal_end;
-    }
-    return size;
-}
-
-int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
-{
-    ByteIOContext *pb;
-    int ret = url_open_dyn_buf(&pb);
-    if(ret < 0)
-        return ret;
-
-    ff_avc_parse_nal_units(pb, buf_in, *size);
-
-    av_freep(buf);
-    *size = url_close_dyn_buf(pb, buf);
-    return 0;
-}
-
-int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len)
-{
-    if (len > 6) {
-        /* check for h264 start code */
-        if (AV_RB32(data) == 0x00000001 ||
-            AV_RB24(data) == 0x000001) {
-            uint8_t *buf=NULL, *end, *start;
-            uint32_t sps_size=0, pps_size=0;
-            uint8_t *sps=0, *pps=0;
-
-            int ret = ff_avc_parse_nal_units_buf(data, &buf, &len);
-            if (ret < 0)
-                return ret;
-            start = buf;
-            end = buf + len;
-
-            /* look for sps and pps */
-            while (buf < end) {
-                unsigned int size;
-                uint8_t nal_type;
-                size = AV_RB32(buf);
-                nal_type = buf[4] & 0x1f;
-                if (nal_type == 7) { /* SPS */
-                    sps = buf + 4;
-                    sps_size = size;
-                } else if (nal_type == 8) { /* PPS */
-                    pps = buf + 4;
-                    pps_size = size;
-                }
-                buf += size + 4;
-            }
-            assert(sps);
-            assert(pps);
-
-            put_byte(pb, 1); /* version */
-            put_byte(pb, sps[1]); /* profile */
-            put_byte(pb, sps[2]); /* profile compat */
-            put_byte(pb, sps[3]); /* level */
-            put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
-            put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
-
-            put_be16(pb, sps_size);
-            put_buffer(pb, sps, sps_size);
-            put_byte(pb, 1); /* number of pps */
-            put_be16(pb, pps_size);
-            put_buffer(pb, pps, pps_size);
-            av_free(start);
-        } else {
-            put_buffer(pb, data, len);
-        }
-    }
-    return 0;
-}
diff --git a/libavformat/avc.h b/libavformat/avc.h
deleted file mode 100644
index 2deb77d..0000000
--- a/libavformat/avc.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * AVC helper functions for muxers
- * Copyright (c) 2008 Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_AVC_H
-#define AVFORMAT_AVC_H
-
-#include <stdint.h>
-#include "avio.h"
-
-int ff_avc_parse_nal_units(ByteIOContext *s, const uint8_t *buf, int size);
-int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size);
-int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len);
-const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end);
-
-#endif /* AVFORMAT_AVC_H */
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
deleted file mode 100644
index dbd22bb..0000000
--- a/libavformat/avformat.h
+++ /dev/null
@@ -1,1369 +0,0 @@
-/*
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_AVFORMAT_H
-#define AVFORMAT_AVFORMAT_H
-
-#define LIBAVFORMAT_VERSION_MAJOR 52
-#define LIBAVFORMAT_VERSION_MINOR 64
-#define LIBAVFORMAT_VERSION_MICRO  2
-
-#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-                                               LIBAVFORMAT_VERSION_MINOR, \
-                                               LIBAVFORMAT_VERSION_MICRO)
-#define LIBAVFORMAT_VERSION     AV_VERSION(LIBAVFORMAT_VERSION_MAJOR,   \
-                                           LIBAVFORMAT_VERSION_MINOR,   \
-                                           LIBAVFORMAT_VERSION_MICRO)
-#define LIBAVFORMAT_BUILD       LIBAVFORMAT_VERSION_INT
-
-#define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
-
-/**
- * I return the LIBAVFORMAT_VERSION_INT constant.  You got
- * a fucking problem with that, douchebag?
- */
-unsigned avformat_version(void);
-
-/**
- * Returns the libavformat build-time configuration.
- */
-const char *avformat_configuration(void);
-
-/**
- * Returns the libavformat license.
- */
-const char *avformat_license(void);
-
-#include <time.h>
-#include <stdio.h>  /* FILE */
-#include "libavcodec/avcodec.h"
-
-#include "avio.h"
-
-struct AVFormatContext;
-
-
-/*
- * Public Metadata API.
- * The metadata API allows libavformat to export metadata tags to a client
- * application using a sequence of key/value pairs. Like all strings in FFmpeg,
- * metadata must be stored as UTF-8 encoded Unicode. Note that metadata
- * exported by demuxers isn't checked to be valid UTF-8 in most cases.
- * Important concepts to keep in mind:
- * 1. Keys are unique; there can never be 2 tags with the same key. This is
- *    also meant semantically, i.e., a demuxer should not knowingly produce
- *    several keys that are literally different but semantically identical.
- *    E.g., key=Author5, key=Author6. In this example, all authors must be
- *    placed in the same tag.
- * 2. Metadata is flat, not hierarchical; there are no subtags. If you
- *    want to store, e.g., the email address of the child of producer Alice
- *    and actor Bob, that could have key=alice_and_bobs_childs_email_address.
- * 3. Several modifiers can be applied to the tag name. This is done by
- *    appending a dash character ('-') and the modifier name in the order
- *    they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
- *    a) language -- a tag whose value is localized for a particular language
- *       is appended with the ISO 639-2/B 3-letter language code.
- *       For example: Author-ger=Michael, Author-eng=Mike
- *       The original/default language is in the unqualified "Author" tag.
- *       A demuxer should set a default if it sets any translated tag.
- *    b) sorting  -- a modified version of a tag that should be used for
- *       sorting will have '-sort' appended. E.g. artist="The Beatles",
- *       artist-sort="Beatles, The".
- *
- * 4. Tag names are normally exported exactly as stored in the container to
- *    allow lossless remuxing to the same format. For container-independent
- *    handling of metadata, av_metadata_conv() can convert it to ffmpeg generic
- *    format. Follows a list of generic tag names:
- *
- * album        -- name of the set this work belongs to
- * album_artist -- main creator of the set/album, if different from artist.
- *                 e.g. "Various Artists" for compilation albums.
- * artist       -- main creator of the work
- * comment      -- any additional description of the file.
- * composer     -- who composed the work, if different from artist.
- * copyright    -- name of copyright holder.
- * date         -- date when the work was created, preferably in ISO 8601.
- * disc         -- number of a subset, e.g. disc in a multi-disc collection.
- * encoder      -- name/settings of the software/hardware that produced the file.
- * encoded_by   -- person/group who created the file.
- * filename     -- original name of the file.
- * genre        -- <self-evident>.
- * language     -- main language in which the work is performed, preferably
- *                 in ISO 639-2 format.
- * performer    -- artist who performed the work, if different from artist.
- *                 E.g for "Also sprach Zarathustra", artist would be "Richard
- *                 Strauss" and performer "London Philharmonic Orchestra".
- * publisher    -- name of the label/publisher.
- * title        -- name of the work.
- * track        -- number of this work in the set, can be in form current/total.
- */
-
-#define AV_METADATA_MATCH_CASE      1
-#define AV_METADATA_IGNORE_SUFFIX   2
-#define AV_METADATA_DONT_STRDUP_KEY 4
-#define AV_METADATA_DONT_STRDUP_VAL 8
-#define AV_METADATA_DONT_OVERWRITE 16   ///< Don't overwrite existing tags.
-
-typedef struct {
-    char *key;
-    char *value;
-}AVMetadataTag;
-
-typedef struct AVMetadata AVMetadata;
-typedef struct AVMetadataConv AVMetadataConv;
-
-/**
- * Gets a metadata element with matching key.
- * @param prev Set to the previous matching element to find the next.
- *             If set to NULL the first matching element is returned.
- * @param flags Allows case as well as suffix-insensitive comparisons.
- * @return Found tag or NULL, changing key or value leads to undefined behavior.
- */
-AVMetadataTag *
-av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags);
-
-#if LIBAVFORMAT_VERSION_MAJOR == 52
-/**
- * Sets the given tag in m, overwriting an existing tag.
- * @param key tag key to add to m (will be av_strduped)
- * @param value tag value to add to m (will be av_strduped)
- * @return >= 0 on success otherwise an error code <0
- * @deprecated Use av_metadata_set2() instead.
- */
-attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
-#endif
-
-/**
- * Sets the given tag in m, overwriting an existing tag.
- * @param key tag key to add to m (will be av_strduped depending on flags)
- * @param value tag value to add to m (will be av_strduped depending on flags)
- * @return >= 0 on success otherwise an error code <0
- */
-int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags);
-
-/**
- * Converts all the metadata sets from ctx according to the source and
- * destination conversion tables. If one of the tables is NULL, then
- * tags are converted to/from ffmpeg generic tag names.
- * @param d_conv destination tags format conversion table
- * @param s_conv source tags format conversion table
- */
-void av_metadata_conv(struct AVFormatContext *ctx,const AVMetadataConv *d_conv,
-                                                  const AVMetadataConv *s_conv);
-
-/**
- * Frees all the memory allocated for an AVMetadata struct.
- */
-void av_metadata_free(AVMetadata **m);
-
-
-/* packet functions */
-
-
-/**
- * Allocates and reads the payload of a packet and initializes its
- * fields with default values.
- *
- * @param pkt packet
- * @param size desired payload size
- * @return >0 (read size) if OK, AVERROR_xxx otherwise
- */
-int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
-
-
-/*************************************************/
-/* fractional numbers for exact pts handling */
-
-/**
- * The exact value of the fractional number is: 'val + num / den'.
- * num is assumed to be 0 <= num < den.
- */
-typedef struct AVFrac {
-    int64_t val, num, den;
-} AVFrac;
-
-/*************************************************/
-/* input/output formats */
-
-struct AVCodecTag;
-
-/** This structure contains the data a format has to probe a file. */
-typedef struct AVProbeData {
-    const char *filename;
-    unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */
-    int buf_size;       /**< Size of buf except extra allocated bytes */
-} AVProbeData;
-
-#define AVPROBE_SCORE_MAX 100               ///< maximum score, half of that is used for file-extension-based detection
-#define AVPROBE_PADDING_SIZE 32             ///< extra allocated bytes at the end of the probe buffer
-
-typedef struct AVFormatParameters {
-    AVRational time_base;
-    int sample_rate;
-    int channels;
-    int width;
-    int height;
-    enum PixelFormat pix_fmt;
-    int channel; /**< Used to select DV channel. */
-    const char *standard; /**< TV standard, NTSC, PAL, SECAM */
-    unsigned int mpeg2ts_raw:1;  /**< Force raw MPEG-2 transport stream output, if possible. */
-    unsigned int mpeg2ts_compute_pcr:1; /**< Compute exact PCR for each transport
-                                            stream packet (only meaningful if
-                                            mpeg2ts_raw is TRUE). */
-    unsigned int initial_pause:1;       /**< Do not begin to play the stream
-                                            immediately (RTSP only). */
-    unsigned int prealloced_context:1;
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    enum CodecID video_codec_id;
-    enum CodecID audio_codec_id;
-#endif
-} AVFormatParameters;
-
-//! Demuxer will use url_fopen, no opened file should be provided by the caller.
-#define AVFMT_NOFILE        0x0001
-#define AVFMT_NEEDNUMBER    0x0002 /**< Needs '%d' in filename. */
-#define AVFMT_SHOW_IDS      0x0008 /**< Show format stream IDs numbers. */
-#define AVFMT_RAWPICTURE    0x0020 /**< Format wants AVPicture structure for
-                                      raw picture data. */
-#define AVFMT_GLOBALHEADER  0x0040 /**< Format wants global header. */
-#define AVFMT_NOTIMESTAMPS  0x0080 /**< Format does not need / have any timestamps. */
-#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */
-#define AVFMT_TS_DISCONT    0x0200 /**< Format allows timestamp discontinuities. */
-#define AVFMT_VARIABLE_FPS  0x0400 /**< Format allows variable fps. */
-#define AVFMT_NODIMENSIONS  0x0800 /**< Format does not need width/height */
-
-typedef struct AVOutputFormat {
-    const char *name;
-    /**
-     * Descriptive name for the format, meant to be more human-readable
-     * than name. You should use the NULL_IF_CONFIG_SMALL() macro
-     * to define it.
-     */
-    const char *long_name;
-    const char *mime_type;
-    const char *extensions; /**< comma-separated filename extensions */
-    /** size of private data so that it can be allocated in the wrapper */
-    int priv_data_size;
-    /* output support */
-    enum CodecID audio_codec; /**< default audio codec */
-    enum CodecID video_codec; /**< default video codec */
-    int (*write_header)(struct AVFormatContext *);
-    int (*write_packet)(struct AVFormatContext *, AVPacket *pkt);
-    int (*write_trailer)(struct AVFormatContext *);
-    /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */
-    int flags;
-    /** Currently only used to set pixel format if not YUV420P. */
-    int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *);
-    int (*interleave_packet)(struct AVFormatContext *, AVPacket *out,
-                             AVPacket *in, int flush);
-
-    /**
-     * List of supported codec_id-codec_tag pairs, ordered by "better
-     * choice first". The arrays are all terminated by CODEC_ID_NONE.
-     */
-    const struct AVCodecTag * const *codec_tag;
-
-    enum CodecID subtitle_codec; /**< default subtitle codec */
-
-    const AVMetadataConv *metadata_conv;
-
-    /* private fields */
-    struct AVOutputFormat *next;
-} AVOutputFormat;
-
-typedef struct AVInputFormat {
-    const char *name;
-    /**
-     * Descriptive name for the format, meant to be more human-readable
-     * than name. You should use the NULL_IF_CONFIG_SMALL() macro
-     * to define it.
-     */
-    const char *long_name;
-    /** Size of private data so that it can be allocated in the wrapper. */
-    int priv_data_size;
-    /**
-     * Tell if a given file has a chance of being parsed as this format.
-     * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes
-     * big so you do not have to check for that unless you need more.
-     */
-    int (*read_probe)(AVProbeData *);
-    /** Read the format header and initialize the AVFormatContext
-       structure. Return 0 if OK. 'ap' if non-NULL contains
-       additional parameters. Only used in raw format right
-       now. 'av_new_stream' should be called to create new streams.  */
-    int (*read_header)(struct AVFormatContext *,
-                       AVFormatParameters *ap);
-    /** Read one packet and put it in 'pkt'. pts and flags are also
-       set. 'av_new_stream' can be called only if the flag
-       AVFMTCTX_NOHEADER is used.
-       @return 0 on success, < 0 on error.
-               When returning an error, pkt must not have been allocated
-               or must be freed before returning */
-    int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
-    /** Close the stream. The AVFormatContext and AVStreams are not
-       freed by this function */
-    int (*read_close)(struct AVFormatContext *);
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-    /**
-     * Seek to a given timestamp relative to the frames in
-     * stream component stream_index.
-     * @param stream_index Must not be -1.
-     * @param flags Selects which direction should be preferred if no exact
-     *              match is available.
-     * @return >= 0 on success (but not necessarily the new offset)
-     */
-    int (*read_seek)(struct AVFormatContext *,
-                     int stream_index, int64_t timestamp, int flags);
-#endif
-    /**
-     * Gets the next timestamp in stream[stream_index].time_base units.
-     * @return the timestamp or AV_NOPTS_VALUE if an error occurred
-     */
-    int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index,
-                              int64_t *pos, int64_t pos_limit);
-    /** Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. */
-    int flags;
-    /** If extensions are defined, then no probe is done. You should
-       usually not use extension format guessing because it is not
-       reliable enough */
-    const char *extensions;
-    /** General purpose read-only value that the format can use. */
-    int value;
-
-    /** Starts/resumes playing - only meaningful if using a network-based format
-       (RTSP). */
-    int (*read_play)(struct AVFormatContext *);
-
-    /** Pauses playing - only meaningful if using a network-based format
-       (RTSP). */
-    int (*read_pause)(struct AVFormatContext *);
-
-    const struct AVCodecTag * const *codec_tag;
-
-    /**
-     * Seeks to timestamp ts.
-     * Seeking will be done so that the point from which all active streams
-     * can be presented successfully will be closest to ts and within min/max_ts.
-     * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
-     */
-    int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-
-    const AVMetadataConv *metadata_conv;
-
-    /* private fields */
-    struct AVInputFormat *next;
-} AVInputFormat;
-
-enum AVStreamParseType {
-    AVSTREAM_PARSE_NONE,
-    AVSTREAM_PARSE_FULL,       /**< full parsing and repack */
-    AVSTREAM_PARSE_HEADERS,    /**< Only parse headers, do not repack. */
-    AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */
-};
-
-typedef struct AVIndexEntry {
-    int64_t pos;
-    int64_t timestamp;
-#define AVINDEX_KEYFRAME 0x0001
-    int flags:2;
-    int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment).
-    int min_distance;         /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */
-} AVIndexEntry;
-
-#define AV_DISPOSITION_DEFAULT   0x0001
-#define AV_DISPOSITION_DUB       0x0002
-#define AV_DISPOSITION_ORIGINAL  0x0004
-#define AV_DISPOSITION_COMMENT   0x0008
-#define AV_DISPOSITION_LYRICS    0x0010
-#define AV_DISPOSITION_KARAOKE   0x0020
-
-/**
- * Stream structure.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(AVStream) must not be used outside libav*.
- */
-typedef struct AVStream {
-    int index;    /**< stream index in AVFormatContext */
-    int id;       /**< format-specific stream ID */
-    AVCodecContext *codec; /**< codec context */
-    /**
-     * Real base framerate of the stream.
-     * This is the lowest framerate with which all timestamps can be
-     * represented accurately (it is the least common multiple of all
-     * framerates in the stream). Note, this value is just a guess!
-     * For example, if the time base is 1/90000 and all frames have either
-     * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
-     */
-    AVRational r_frame_rate;
-    void *priv_data;
-
-    /* internal data used in av_find_stream_info() */
-    int64_t first_dts;
-    /** encoding: pts generation when outputting stream */
-    struct AVFrac pts;
-
-    /**
-     * This is the fundamental unit of time (in seconds) in terms
-     * of which frame timestamps are represented. For fixed-fps content,
-     * time base should be 1/framerate and timestamp increments should be 1.
-     */
-    AVRational time_base;
-    int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */
-    /* ffmpeg.c private use */
-    int stream_copy; /**< If set, just copy stream. */
-    enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
-    //FIXME move stuff to a flags field?
-    /** Quality, as it has been removed from AVCodecContext and put in AVVideoFrame.
-     * MN: dunno if that is the right place for it */
-    float quality;
-    /**
-     * Decoding: pts of the first frame of the stream, in stream time base.
-     * Only set this if you are absolutely 100% sure that the value you set
-     * it to really is the pts of the first frame.
-     * This may be undefined (AV_NOPTS_VALUE).
-     * @note The ASF header does NOT contain a correct start_time the ASF
-     * demuxer must NOT set this.
-     */
-    int64_t start_time;
-    /**
-     * Decoding: duration of the stream, in stream time base.
-     * If a source file does not specify a duration, but does specify
-     * a bitrate, this value will be estimated from bitrate and file size.
-     */
-    int64_t duration;
-
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    char language[4]; /** ISO 639-2/B 3-letter language code (empty string if undefined) */
-#endif
-
-    /* av_read_frame() support */
-    enum AVStreamParseType need_parsing;
-    struct AVCodecParserContext *parser;
-
-    int64_t cur_dts;
-    int last_IP_duration;
-    int64_t last_IP_pts;
-    /* av_seek_frame() support */
-    AVIndexEntry *index_entries; /**< Only used if the format does not
-                                    support seeking natively. */
-    int nb_index_entries;
-    unsigned int index_entries_allocated_size;
-
-    int64_t nb_frames;                 ///< number of frames in this stream if known or 0
-
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    int64_t unused[4+1];
-
-    char *filename; /**< source filename of the stream */
-#endif
-
-    int disposition; /**< AV_DISPOSITION_* bit field */
-
-    AVProbeData probe_data;
-#define MAX_REORDER_DELAY 16
-    int64_t pts_buffer[MAX_REORDER_DELAY+1];
-
-    /**
-     * sample aspect ratio (0 if unknown)
-     * - encoding: Set by user.
-     * - decoding: Set by libavformat.
-     */
-    AVRational sample_aspect_ratio;
-
-    AVMetadata *metadata;
-
-    /* av_read_frame() support */
-    const uint8_t *cur_ptr;
-    int cur_len;
-    AVPacket cur_pkt;
-
-    // Timestamp generation support:
-    /**
-     * Timestamp corresponding to the last dts sync point.
-     *
-     * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
-     * a DTS is received from the underlying container. Otherwise set to
-     * AV_NOPTS_VALUE by default.
-     */
-    int64_t reference_dts;
-
-    /**
-     * Number of packets to buffer for codec probing
-     * NOT PART OF PUBLIC API
-     */
-#define MAX_PROBE_PACKETS 2500
-    int probe_packets;
-
-    /**
-     * last packet in packet_buffer for this stream when muxing.
-     * used internally, NOT PART OF PUBLIC API, dont read or write from outside of libav*
-     */
-    struct AVPacketList *last_in_packet_buffer;
-
-    /**
-     * Average framerate
-     */
-    AVRational avg_frame_rate;
-
-    /**
-     * Number of frames that have been demuxed during av_find_stream_info()
-     */
-    int codec_info_nb_frames;
-} AVStream;
-
-#define AV_PROGRAM_RUNNING 1
-
-/**
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(AVProgram) must not be used outside libav*.
- */
-typedef struct AVProgram {
-    int            id;
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    char           *provider_name; ///< network name for DVB streams
-    char           *name;          ///< service name for DVB streams
-#endif
-    int            flags;
-    enum AVDiscard discard;        ///< selects which program to discard and which to feed to the caller
-    unsigned int   *stream_index;
-    unsigned int   nb_stream_indexes;
-    AVMetadata *metadata;
-} AVProgram;
-
-#define AVFMTCTX_NOHEADER      0x0001 /**< signal that no header is present
-                                         (streams are added dynamically) */
-
-typedef struct AVChapter {
-    int id;                 ///< unique ID to identify the chapter
-    AVRational time_base;   ///< time base in which the start/end timestamps are specified
-    int64_t start, end;     ///< chapter start/end time in time_base units
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    char *title;            ///< chapter title
-#endif
-    AVMetadata *metadata;
-} AVChapter;
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-#define MAX_STREAMS 20
-#else
-#define MAX_STREAMS 100
-#endif
-
-/**
- * Format I/O context.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(AVFormatContext) must not be used outside libav*.
- */
-typedef struct AVFormatContext {
-    const AVClass *av_class; /**< Set by avformat_alloc_context. */
-    /* Can only be iformat or oformat, not both at the same time. */
-    struct AVInputFormat *iformat;
-    struct AVOutputFormat *oformat;
-    void *priv_data;
-    ByteIOContext *pb;
-    unsigned int nb_streams;
-    AVStream *streams[MAX_STREAMS];
-    char filename[1024]; /**< input or output filename */
-    /* stream info */
-    int64_t timestamp;
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    char title[512];
-    char author[512];
-    char copyright[512];
-    char comment[512];
-    char album[512];
-    int year;  /**< ID3 year, 0 if none */
-    int track; /**< track number, 0 if none */
-    char genre[32]; /**< ID3 genre */
-#endif
-
-    int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
-    /* private data for pts handling (do not modify directly). */
-    /** This buffer is only needed when packets were already buffered but
-       not decoded, for example to get the codec parameters in MPEG
-       streams. */
-    struct AVPacketList *packet_buffer;
-
-    /** Decoding: position of the first frame of the component, in
-       AV_TIME_BASE fractional seconds. NEVER set this value directly:
-       It is deduced from the AVStream values.  */
-    int64_t start_time;
-    /** Decoding: duration of the stream, in AV_TIME_BASE fractional
-       seconds. Only set this value if you know none of the individual stream
-       durations and also dont set any of them. This is deduced from the
-       AVStream values if not set.  */
-    int64_t duration;
-    /** decoding: total file size, 0 if unknown */
-    int64_t file_size;
-    /** Decoding: total stream bitrate in bit/s, 0 if not
-       available. Never set it directly if the file_size and the
-       duration are known as FFmpeg can compute it automatically. */
-    int bit_rate;
-
-    /* av_read_frame() support */
-    AVStream *cur_st;
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    const uint8_t *cur_ptr_deprecated;
-    int cur_len_deprecated;
-    AVPacket cur_pkt_deprecated;
-#endif
-
-    /* av_seek_frame() support */
-    int64_t data_offset; /** offset of the first packet */
-    int index_built;
-
-    int mux_rate;
-    unsigned int packet_size;
-    int preload;
-    int max_delay;
-
-#define AVFMT_NOOUTPUTLOOP -1
-#define AVFMT_INFINITEOUTPUTLOOP 0
-    /** number of times to loop output in formats that support it */
-    int loop_output;
-
-    int flags;
-#define AVFMT_FLAG_GENPTS       0x0001 ///< Generate missing pts even if it requires parsing future frames.
-#define AVFMT_FLAG_IGNIDX       0x0002 ///< Ignore index.
-#define AVFMT_FLAG_NONBLOCK     0x0004 ///< Do not block when reading packets from input.
-#define AVFMT_FLAG_IGNDTS       0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
-#define AVFMT_FLAG_NOFILLIN     0x0010 ///< Do not infer any values from other values, just return what is stored in the container
-#define AVFMT_FLAG_NOPARSE      0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
-#define AVFMT_FLAG_RTP_HINT     0x0040 ///< Add RTP hinting to the output file
-
-    int loop_input;
-    /** decoding: size of data to probe; encoding: unused. */
-    unsigned int probesize;
-
-    /**
-     * Maximum time (in AV_TIME_BASE units) during which the input should
-     * be analyzed in av_find_stream_info().
-     */
-    int max_analyze_duration;
-
-    const uint8_t *key;
-    int keylen;
-
-    unsigned int nb_programs;
-    AVProgram **programs;
-
-    /**
-     * Forced video codec_id.
-     * Demuxing: Set by user.
-     */
-    enum CodecID video_codec_id;
-    /**
-     * Forced audio codec_id.
-     * Demuxing: Set by user.
-     */
-    enum CodecID audio_codec_id;
-    /**
-     * Forced subtitle codec_id.
-     * Demuxing: Set by user.
-     */
-    enum CodecID subtitle_codec_id;
-
-    /**
-     * Maximum amount of memory in bytes to use for the index of each stream.
-     * If the index exceeds this size, entries will be discarded as
-     * needed to maintain a smaller size. This can lead to slower or less
-     * accurate seeking (depends on demuxer).
-     * Demuxers for which a full in-memory index is mandatory will ignore
-     * this.
-     * muxing  : unused
-     * demuxing: set by user
-     */
-    unsigned int max_index_size;
-
-    /**
-     * Maximum amount of memory in bytes to use for buffering frames
-     * obtained from realtime capture devices.
-     */
-    unsigned int max_picture_buffer;
-
-    unsigned int nb_chapters;
-    AVChapter **chapters;
-
-    /**
-     * Flags to enable debugging.
-     */
-    int debug;
-#define FF_FDEBUG_TS        0x0001
-
-    /**
-     * Raw packets from the demuxer, prior to parsing and decoding.
-     * This buffer is used for buffering packets until the codec can
-     * be identified, as parsing cannot be done without knowing the
-     * codec.
-     */
-    struct AVPacketList *raw_packet_buffer;
-    struct AVPacketList *raw_packet_buffer_end;
-
-    struct AVPacketList *packet_buffer_end;
-
-    AVMetadata *metadata;
-
-    /**
-     * Remaining size available for raw_packet_buffer, in bytes.
-     * NOT PART OF PUBLIC API
-     */
-#define RAW_PACKET_BUFFER_SIZE 2500000
-    int raw_packet_buffer_remaining_size;
-
-    /**
-     * Start time of the stream in real world time, in microseconds
-     * since the unix epoch (00:00 1st January 1970). That is, pts=0
-     * in the stream was captured at this real world time.
-     * - encoding: Set by user.
-     * - decoding: Unused.
-     */
-    int64_t start_time_realtime;
-} AVFormatContext;
-
-typedef struct AVPacketList {
-    AVPacket pkt;
-    struct AVPacketList *next;
-} AVPacketList;
-
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-extern AVInputFormat *first_iformat;
-extern AVOutputFormat *first_oformat;
-#endif
-
-/**
- * If f is NULL, returns the first registered input format,
- * if f is non-NULL, returns the next registered input format after f
- * or NULL if f is the last one.
- */
-AVInputFormat  *av_iformat_next(AVInputFormat  *f);
-
-/**
- * If f is NULL, returns the first registered output format,
- * if f is non-NULL, returns the next registered output format after f
- * or NULL if f is the last one.
- */
-AVOutputFormat *av_oformat_next(AVOutputFormat *f);
-
-enum CodecID av_guess_image2_codec(const char *filename);
-
-/* XXX: Use automatic init with either ELF sections or C file parser */
-/* modules. */
-
-/* utils.c */
-void av_register_input_format(AVInputFormat *format);
-void av_register_output_format(AVOutputFormat *format);
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name,
-                                    const char *filename,
-                                    const char *mime_type);
-
-/**
- * @deprecated Use av_guess_format() instead.
- */
-attribute_deprecated AVOutputFormat *guess_format(const char *short_name,
-                                                  const char *filename,
-                                                  const char *mime_type);
-#endif
-
-/**
- * Returns the output format in the list of registered output formats
- * which best matches the provided parameters, or returns NULL if
- * there is no match.
- *
- * @param short_name if non-NULL checks if short_name matches with the
- * names of the registered formats
- * @param filename if non-NULL checks if filename terminates with the
- * extensions of the registered formats
- * @param mime_type if non-NULL checks if mime_type matches with the
- * MIME type of the registered formats
- */
-AVOutputFormat *av_guess_format(const char *short_name,
-                                const char *filename,
-                                const char *mime_type);
-
-/**
- * Guesses the codec ID based upon muxer and filename.
- */
-enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
-                            const char *filename, const char *mime_type,
-                            enum AVMediaType type);
-
-/**
- * Sends a nice hexadecimal dump of a buffer to the specified file stream.
- *
- * @param f The file stream pointer where the dump should be sent to.
- * @param buf buffer
- * @param size buffer size
- *
- * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log
- */
-void av_hex_dump(FILE *f, uint8_t *buf, int size);
-
-/**
- * Sends a nice hexadecimal dump of a buffer to the log.
- *
- * @param avcl A pointer to an arbitrary struct of which the first field is a
- * pointer to an AVClass struct.
- * @param level The importance level of the message, lower values signifying
- * higher importance.
- * @param buf buffer
- * @param size buffer size
- *
- * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log
- */
-void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);
-
-/**
- * Sends a nice dump of a packet to the specified file stream.
- *
- * @param f The file stream pointer where the dump should be sent to.
- * @param pkt packet to dump
- * @param dump_payload True if the payload must be displayed, too.
- */
-void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
-
-/**
- * Sends a nice dump of a packet to the log.
- *
- * @param avcl A pointer to an arbitrary struct of which the first field is a
- * pointer to an AVClass struct.
- * @param level The importance level of the message, lower values signifying
- * higher importance.
- * @param pkt packet to dump
- * @param dump_payload True if the payload must be displayed, too.
- */
-void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload);
-
-/**
- * Initializes libavformat and registers all the muxers, demuxers and
- * protocols. If you do not call this function, then you can select
- * exactly which formats you want to support.
- *
- * @see av_register_input_format()
- * @see av_register_output_format()
- * @see av_register_protocol()
- */
-void av_register_all(void);
-
-/**
- * Gets the CodecID for the given codec tag tag.
- * If no codec id is found returns CODEC_ID_NONE.
- *
- * @param tags list of supported codec_id-codec_tag pairs, as stored
- * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
- */
-enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag);
-
-/**
- * Gets the codec tag for the given codec id id.
- * If no codec tag is found returns 0.
- *
- * @param tags list of supported codec_id-codec_tag pairs, as stored
- * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag
- */
-unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id);
-
-/* media file input */
-
-/**
- * Finds AVInputFormat based on the short name of the input format.
- */
-AVInputFormat *av_find_input_format(const char *short_name);
-
-/**
- * Guesses the file format.
- *
- * @param is_opened Whether the file is already opened; determines whether
- *                  demuxers with or without AVFMT_NOFILE are probed.
- */
-AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
-
-/**
- * Guesses the file format.
- *
- * @param is_opened Whether the file is already opened; determines whether
- *                  demuxers with or without AVFMT_NOFILE are probed.
- * @param score_max A probe score larger that this is required to accept a
- *                  detection, the variable is set to the actual detection
- *                  score afterwards.
- *                  If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended
- *                  to retry with a larger probe buffer.
- */
-AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
-
-/**
- * Allocates all the structures needed to read an input stream.
- *        This does not open the needed codecs for decoding the stream[s].
- */
-int av_open_input_stream(AVFormatContext **ic_ptr,
-                         ByteIOContext *pb, const char *filename,
-                         AVInputFormat *fmt, AVFormatParameters *ap);
-
-/**
- * Opens a media file as input. The codecs are not opened. Only the file
- * header (if present) is read.
- *
- * @param ic_ptr The opened media file handle is put here.
- * @param filename filename to open
- * @param fmt If non-NULL, force the file format to use.
- * @param buf_size optional buffer size (zero if default is OK)
- * @param ap Additional parameters needed when opening the file
- *           (NULL if default).
- * @return 0 if OK, AVERROR_xxx otherwise
- */
-int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
-                       AVInputFormat *fmt,
-                       int buf_size,
-                       AVFormatParameters *ap);
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-/**
- * @deprecated Use avformat_alloc_context() instead.
- */
-attribute_deprecated AVFormatContext *av_alloc_format_context(void);
-#endif
-
-/**
- * Allocates an AVFormatContext.
- * Can be freed with av_free() but do not forget to free everything you
- * explicitly allocated as well!
- */
-AVFormatContext *avformat_alloc_context(void);
-
-/**
- * Reads packets of a media file to get stream information. This
- * is useful for file formats with no headers such as MPEG. This
- * function also computes the real framerate in case of MPEG-2 repeat
- * frame mode.
- * The logical file position is not changed by this function;
- * examined packets may be buffered for later processing.
- *
- * @param ic media file handle
- * @return >=0 if OK, AVERROR_xxx on error
- * @todo Let the user decide somehow what information is needed so that
- *       we do not waste time getting stuff the user does not need.
- */
-int av_find_stream_info(AVFormatContext *ic);
-
-/**
- * Reads a transport packet from a media file.
- *
- * This function is obsolete and should never be used.
- * Use av_read_frame() instead.
- *
- * @param s media file handle
- * @param pkt is filled
- * @return 0 if OK, AVERROR_xxx on error
- */
-int av_read_packet(AVFormatContext *s, AVPacket *pkt);
-
-/**
- * Returns the next frame of a stream.
- *
- * The returned packet is valid
- * until the next av_read_frame() or until av_close_input_file() and
- * must be freed with av_free_packet. For video, the packet contains
- * exactly one frame. For audio, it contains an integer number of
- * frames if each frame has a known fixed size (e.g. PCM or ADPCM
- * data). If the audio frames have a variable size (e.g. MPEG audio),
- * then it contains one frame.
- *
- * pkt->pts, pkt->dts and pkt->duration are always set to correct
- * values in AVStream.time_base units (and guessed if the format cannot
- * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format
- * has B-frames, so it is better to rely on pkt->dts if you do not
- * decompress the payload.
- *
- * @return 0 if OK, < 0 on error or end of file
- */
-int av_read_frame(AVFormatContext *s, AVPacket *pkt);
-
-/**
- * Seeks to the keyframe at timestamp.
- * 'timestamp' in 'stream_index'.
- * @param stream_index If stream_index is (-1), a default
- * stream is selected, and timestamp is automatically converted
- * from AV_TIME_BASE units to the stream specific time_base.
- * @param timestamp Timestamp in AVStream.time_base units
- *        or, if no stream is specified, in AV_TIME_BASE units.
- * @param flags flags which select direction and seeking mode
- * @return >= 0 on success
- */
-int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
-                  int flags);
-
-/**
- * Seeks to timestamp ts.
- * Seeking will be done so that the point from which all active streams
- * can be presented successfully will be closest to ts and within min/max_ts.
- * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
- *
- * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and
- * are the file position (this may not be supported by all demuxers).
- * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames
- * in the stream with stream_index (this may not be supported by all demuxers).
- * Otherwise all timestamps are in units of the stream selected by stream_index
- * or if stream_index is -1, in AV_TIME_BASE units.
- * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as
- * keyframes (this may not be supported by all demuxers).
- *
- * @param stream_index index of the stream which is used as time base reference
- * @param min_ts smallest acceptable timestamp
- * @param ts target timestamp
- * @param max_ts largest acceptable timestamp
- * @param flags flags
- * @return >=0 on success, error code otherwise
- *
- * @NOTE This is part of the new seek API which is still under construction.
- *       Thus do not use this yet. It may change at any time, do not expect
- *       ABI compatibility yet!
- */
-int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
-
-/**
- * Starts playing a network-based stream (e.g. RTSP stream) at the
- * current position.
- */
-int av_read_play(AVFormatContext *s);
-
-/**
- * Pauses a network-based stream (e.g. RTSP stream).
- *
- * Use av_read_play() to resume it.
- */
-int av_read_pause(AVFormatContext *s);
-
-/**
- * Frees a AVFormatContext allocated by av_open_input_stream.
- * @param s context to free
- */
-void av_close_input_stream(AVFormatContext *s);
-
-/**
- * Closes a media file (but not its codecs).
- *
- * @param s media file handle
- */
-void av_close_input_file(AVFormatContext *s);
-
-/**
- * Adds a new stream to a media file.
- *
- * Can only be called in the read_header() function. If the flag
- * AVFMTCTX_NOHEADER is in the format context, then new streams
- * can be added in read_packet too.
- *
- * @param s media file handle
- * @param id file-format-dependent stream ID
- */
-AVStream *av_new_stream(AVFormatContext *s, int id);
-AVProgram *av_new_program(AVFormatContext *s, int id);
-
-/**
- * Adds a new chapter.
- * This function is NOT part of the public API
- * and should ONLY be used by demuxers.
- *
- * @param s media file handle
- * @param id unique ID for this chapter
- * @param start chapter start time in time_base units
- * @param end chapter end time in time_base units
- * @param title chapter title
- *
- * @return AVChapter or NULL on error
- */
-AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
-                          int64_t start, int64_t end, const char *title);
-
-/**
- * Sets the pts for a given stream.
- *
- * @param s stream
- * @param pts_wrap_bits number of bits effectively used by the pts
- *        (used for wrap control, 33 is the value for MPEG)
- * @param pts_num numerator to convert to seconds (MPEG: 1)
- * @param pts_den denominator to convert to seconds (MPEG: 90000)
- */
-void av_set_pts_info(AVStream *s, int pts_wrap_bits,
-                     unsigned int pts_num, unsigned int pts_den);
-
-#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
-#define AVSEEK_FLAG_BYTE     2 ///< seeking based on position in bytes
-#define AVSEEK_FLAG_ANY      4 ///< seek to any frame, even non-keyframes
-#define AVSEEK_FLAG_FRAME    8 ///< seeking based on frame number
-
-int av_find_default_stream_index(AVFormatContext *s);
-
-/**
- * Gets the index for a specific timestamp.
- * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond
- *                 to the timestamp which is <= the requested one, if backward
- *                 is 0, then it will be >=
- *              if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise
- * @return < 0 if no such timestamp could be found
- */
-int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
-
-/**
- * Ensures the index uses less memory than the maximum specified in
- * AVFormatContext.max_index_size by discarding entries if it grows
- * too large.
- * This function is not part of the public API and should only be called
- * by demuxers.
- */
-void ff_reduce_index(AVFormatContext *s, int stream_index);
-
-/**
- * Adds an index entry into a sorted list. Updates the entry if the list
- * already contains it.
- *
- * @param timestamp timestamp in the time base of the given stream
- */
-int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp,
-                       int size, int distance, int flags);
-
-/**
- * Does a binary search using av_index_search_timestamp() and
- * AVCodec.read_timestamp().
- * This is not supposed to be called directly by a user application,
- * but by demuxers.
- * @param target_ts target timestamp in the time base of the given stream
- * @param stream_index stream number
- */
-int av_seek_frame_binary(AVFormatContext *s, int stream_index,
-                         int64_t target_ts, int flags);
-
-/**
- * Updates cur_dts of all streams based on the given timestamp and AVStream.
- *
- * Stream ref_st unchanged, others set cur_dts in their native time base.
- * Only needed for timestamp wrapping or if (dts not set and pts!=dts).
- * @param timestamp new dts expressed in time_base of param ref_st
- * @param ref_st reference stream giving time_base of param timestamp
- */
-void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp);
-
-/**
- * Does a binary search using read_timestamp().
- * This is not supposed to be called directly by a user application,
- * but by demuxers.
- * @param target_ts target timestamp in the time base of the given stream
- * @param stream_index stream number
- */
-int64_t av_gen_search(AVFormatContext *s, int stream_index,
-                      int64_t target_ts, int64_t pos_min,
-                      int64_t pos_max, int64_t pos_limit,
-                      int64_t ts_min, int64_t ts_max,
-                      int flags, int64_t *ts_ret,
-                      int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t ));
-
-/** media file output */
-int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
-
-/**
- * Allocates the stream private data and writes the stream header to an
- * output media file.
- *
- * @param s media file handle
- * @return 0 if OK, AVERROR_xxx on error
- */
-int av_write_header(AVFormatContext *s);
-
-/**
- * Writes a packet to an output media file.
- *
- * The packet shall contain one audio or video frame.
- * The packet must be correctly interleaved according to the container
- * specification, if not then av_interleaved_write_frame must be used.
- *
- * @param s media file handle
- * @param pkt The packet, which contains the stream_index, buf/buf_size,
-              dts/pts, ...
- * @return < 0 on error, = 0 if OK, 1 if end of stream wanted
- */
-int av_write_frame(AVFormatContext *s, AVPacket *pkt);
-
-/**
- * Writes a packet to an output media file ensuring correct interleaving.
- *
- * The packet must contain one audio or video frame.
- * If the packets are already correctly interleaved, the application should
- * call av_write_frame() instead as it is slightly faster. It is also important
- * to keep in mind that completely non-interleaved input will need huge amounts
- * of memory to interleave with this, so it is preferable to interleave at the
- * demuxer level.
- *
- * @param s media file handle
- * @param pkt The packet, which contains the stream_index, buf/buf_size,
-              dts/pts, ...
- * @return < 0 on error, = 0 if OK, 1 if end of stream wanted
- */
-int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
-
-/**
- * Interleaves a packet per dts in an output media file.
- *
- * Packets with pkt->destruct == av_destruct_packet will be freed inside this
- * function, so they cannot be used after it. Note that calling av_free_packet()
- * on them is still safe.
- *
- * @param s media file handle
- * @param out the interleaved packet will be output here
- * @param in the input packet
- * @param flush 1 if no further packets are available as input and all
- *              remaining packets should be output
- * @return 1 if a packet was output, 0 if no packet could be output,
- *         < 0 if an error occurred
- */
-int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
-                                 AVPacket *pkt, int flush);
-
-/**
- * Writes the stream trailer to an output media file and frees the
- * file private data.
- *
- * May only be called after a successful call to av_write_header.
- *
- * @param s media file handle
- * @return 0 if OK, AVERROR_xxx on error
- */
-int av_write_trailer(AVFormatContext *s);
-
-void dump_format(AVFormatContext *ic,
-                 int index,
-                 const char *url,
-                 int is_output);
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-/**
- * Parses width and height out of string str.
- * @deprecated Use av_parse_video_frame_size instead.
- */
-attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr,
-                                          const char *str);
-
-/**
- * Converts framerate from a string to a fraction.
- * @deprecated Use av_parse_video_frame_rate instead.
- */
-attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
-                                          const char *arg);
-#endif
-
-/**
- * Parses datestr and returns a corresponding number of microseconds.
- * @param datestr String representing a date or a duration.
- * - If a date the syntax is:
- * @code
- *  [{YYYY-MM-DD|YYYYMMDD}]{T| }{HH[:MM[:SS[.m...]]][Z]|HH[MM[SS[.m...]]][Z]}
- * @endcode
- * Time is local time unless Z is appended, in which case it is
- * interpreted as UTC.
- * If the year-month-day part is not specified it takes the current
- * year-month-day.
- * Returns the number of microseconds since 1st of January, 1970 up to
- * the time of the parsed date or INT64_MIN if datestr cannot be
- * successfully parsed.
- * - If a duration the syntax is:
- * @code
- *  [-]HH[:MM[:SS[.m...]]]
- *  [-]S+[.m...]
- * @endcode
- * Returns the number of microseconds contained in a time interval
- * with the specified duration or INT64_MIN if datestr cannot be
- * successfully parsed.
- * @param duration Flag which tells how to interpret datestr, if
- * not zero datestr is interpreted as a duration, otherwise as a
- * date.
- */
-int64_t parse_date(const char *datestr, int duration);
-
-/** Gets the current time in microseconds. */
-int64_t av_gettime(void);
-
-/* ffm-specific for ffserver */
-#define FFM_PACKET_SIZE 4096
-int64_t ffm_read_write_index(int fd);
-int ffm_write_write_index(int fd, int64_t pos);
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
-
-/**
- * Attempts to find a specific tag in a URL.
- *
- * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
- * Return 1 if found.
- */
-int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
-
-/**
- * Returns in 'buf' the path with '%d' replaced by a number.
- *
- * Also handles the '%0nd' format where 'n' is the total number
- * of digits and '%%'.
- *
- * @param buf destination buffer
- * @param buf_size destination buffer size
- * @param path numbered sequence string
- * @param number frame number
- * @return 0 if OK, -1 on format error
- */
-int av_get_frame_filename(char *buf, int buf_size,
-                          const char *path, int number);
-
-/**
- * Checks whether filename actually is a numbered sequence generator.
- *
- * @param filename possible numbered sequence string
- * @return 1 if a valid numbered sequence string, 0 otherwise
- */
-int av_filename_number_test(const char *filename);
-
-/**
- * Generates an SDP for an RTP session.
- *
- * @param ac array of AVFormatContexts describing the RTP streams. If the
- *           array is composed by only one context, such context can contain
- *           multiple AVStreams (one AVStream per RTP stream). Otherwise,
- *           all the contexts in the array (an AVCodecContext per RTP stream)
- *           must contain only one AVStream.
- * @param n_files number of AVCodecContexts contained in ac
- * @param buff buffer where the SDP will be stored (must be allocated by
- *             the caller)
- * @param size the size of the buffer
- * @return 0 if OK, AVERROR_xxx on error
- */
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
-
-/**
- * Returns a positive value if the given filename has one of the given
- * extensions, 0 otherwise.
- *
- * @param extensions a comma-separated list of filename extensions
- */
-int av_match_ext(const char *filename, const char *extensions);
-
-#endif /* AVFORMAT_AVFORMAT_H */
diff --git a/libavformat/avi.c b/libavformat/avi.c
deleted file mode 100644
index 705ad03..0000000
--- a/libavformat/avi.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * AVI common data
- * Copyright (c) 2010 Anton Khirnov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avi.h"
-
-const AVMetadataConv ff_avi_metadata_conv[] = {
-    { "IART", "artist"    },
-    { "ICMT", "comment"   },
-    { "ICOP", "copyright" },
-    { "ICRD", "date"      },
-    { "IGNR", "genre"     },
-    { "ILNG", "language"  },
-    { "INAM", "title"     },
-    { "IPRD", "album"     },
-    { "IPRT", "track"     },
-    { "ISFT", "encoder"   },
-    { "ITCH", "encoded_by"},
-    { "strn", "title"     },
-    { 0 },
-};
-
-const char ff_avi_tags[][5] = {
-    "IARL", "IART", "ICMS", "ICMT", "ICOP", "ICRD", "ICRP", "IDIM", "IDPI",
-    "IENG", "IGNR", "IKEY", "ILGT", "ILNG", "IMED", "INAM", "IPLT", "IPRD",
-    "IPRT", "ISBJ", "ISFT", "ISHP", "ISRC", "ISRF", "ITCH",
-    {0}
-};
diff --git a/libavformat/avi.h b/libavformat/avi.h
deleted file mode 100644
index f345c14..0000000
--- a/libavformat/avi.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_AVI_H
-#define AVFORMAT_AVI_H
-
-#include "metadata.h"
-
-#define AVIF_HASINDEX           0x00000010        // Index at end of file?
-#define AVIF_MUSTUSEINDEX       0x00000020
-#define AVIF_ISINTERLEAVED      0x00000100
-#define AVIF_TRUSTCKTYPE        0x00000800        // Use CKType to find key frames?
-#define AVIF_WASCAPTUREFILE     0x00010000
-#define AVIF_COPYRIGHTED        0x00020000
-
-#define AVI_MAX_RIFF_SIZE       0x40000000LL
-#define AVI_MASTER_INDEX_SIZE   256
-
-/* index flags */
-#define AVIIF_INDEX             0x10
-
-extern const AVMetadataConv ff_avi_metadata_conv[];
-
-/**
- * A list of AVI info tags.
- */
-extern const char ff_avi_tags[][5];
-
-#endif /* AVFORMAT_AVI_H */
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
deleted file mode 100644
index 485c4eb..0000000
--- a/libavformat/avidec.c
+++ /dev/null
@@ -1,1198 +0,0 @@
-/*
- * AVI demuxer
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define DEBUG
-//#define DEBUG_SEEK
-
-#include "libavutil/intreadwrite.h"
-#include "libavutil/bswap.h"
-#include "avformat.h"
-#include "avi.h"
-#include "dv.h"
-#include "riff.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-typedef struct AVIStream {
-    int64_t frame_offset; /* current frame (video) or byte (audio) counter
-                         (used to compute the pts) */
-    int remaining;
-    int packet_size;
-
-    int scale;
-    int rate;
-    int sample_size; /* size of one sample (or packet) (in the rate/scale sense) in bytes */
-
-    int64_t cum_len; /* temporary storage (used during seek) */
-
-    int prefix;                       ///< normally 'd'<<8 + 'c' or 'w'<<8 + 'b'
-    int prefix_count;
-    uint32_t pal[256];
-    int has_pal;
-} AVIStream;
-
-typedef struct {
-    int64_t  riff_end;
-    int64_t  movi_end;
-    int64_t  fsize;
-    int64_t movi_list;
-    int64_t last_pkt_pos;
-    int index_loaded;
-    int is_odml;
-    int non_interleaved;
-    int stream_index;
-    DVDemuxContext* dv_demux;
-} AVIContext;
-
-static const char avi_headers[][8] = {
-    { 'R', 'I', 'F', 'F',    'A', 'V', 'I', ' ' },
-    { 'R', 'I', 'F', 'F',    'A', 'V', 'I', 'X' },
-    { 'R', 'I', 'F', 'F',    'A', 'V', 'I', 0x19},
-    { 'O', 'N', '2', ' ',    'O', 'N', '2', 'f' },
-    { 'R', 'I', 'F', 'F',    'A', 'M', 'V', ' ' },
-    { 0 }
-};
-
-static int avi_load_index(AVFormatContext *s);
-static int guess_ni_flag(AVFormatContext *s);
-
-#ifdef DEBUG
-static void print_tag(const char *str, unsigned int tag, int size)
-{
-    dprintf(NULL, "%s: tag=%c%c%c%c size=0x%x\n",
-           str, tag & 0xff,
-           (tag >> 8) & 0xff,
-           (tag >> 16) & 0xff,
-           (tag >> 24) & 0xff,
-           size);
-}
-#endif
-
-static int get_riff(AVFormatContext *s, ByteIOContext *pb)
-{
-    AVIContext *avi = s->priv_data;
-    char header[8];
-    int i;
-
-    /* check RIFF header */
-    get_buffer(pb, header, 4);
-    avi->riff_end = get_le32(pb);   /* RIFF chunk size */
-    avi->riff_end += url_ftell(pb); /* RIFF chunk end */
-    get_buffer(pb, header+4, 4);
-
-    for(i=0; avi_headers[i][0]; i++)
-        if(!memcmp(header, avi_headers[i], 8))
-            break;
-    if(!avi_headers[i][0])
-        return -1;
-
-    if(header[7] == 0x19)
-        av_log(s, AV_LOG_INFO, "This file has been generated by a totally broken muxer.\n");
-
-    return 0;
-}
-
-static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int longs_pre_entry= get_le16(pb);
-    int index_sub_type = get_byte(pb);
-    int index_type     = get_byte(pb);
-    int entries_in_use = get_le32(pb);
-    int chunk_id       = get_le32(pb);
-    int64_t base       = get_le64(pb);
-    int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0');
-    AVStream *st;
-    AVIStream *ast;
-    int i;
-    int64_t last_pos= -1;
-    int64_t filesize= url_fsize(s->pb);
-
-#ifdef DEBUG_SEEK
-    av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
-        longs_pre_entry,index_type, entries_in_use, chunk_id, base);
-#endif
-
-    if(stream_id >= s->nb_streams || stream_id < 0)
-        return -1;
-    st= s->streams[stream_id];
-    ast = st->priv_data;
-
-    if(index_sub_type)
-        return -1;
-
-    get_le32(pb);
-
-    if(index_type && longs_pre_entry != 2)
-        return -1;
-    if(index_type>1)
-        return -1;
-
-    if(filesize > 0 && base >= filesize){
-        av_log(s, AV_LOG_ERROR, "ODML index invalid\n");
-        if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF)
-            base &= 0xFFFFFFFF;
-        else
-            return -1;
-    }
-
-    for(i=0; i<entries_in_use; i++){
-        if(index_type){
-            int64_t pos= get_le32(pb) + base - 8;
-            int len    = get_le32(pb);
-            int key= len >= 0;
-            len &= 0x7FFFFFFF;
-
-#ifdef DEBUG_SEEK
-            av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len);
-#endif
-            if(url_feof(pb))
-                return -1;
-
-            if(last_pos == pos || pos == base - 8)
-                avi->non_interleaved= 1;
-            if(last_pos != pos && (len || !ast->sample_size))
-                av_add_index_entry(st, pos, ast->cum_len, len, 0, key ? AVINDEX_KEYFRAME : 0);
-
-            if(ast->sample_size)
-                ast->cum_len += len;
-            else
-                ast->cum_len ++;
-            last_pos= pos;
-        }else{
-            int64_t offset, pos;
-            int duration;
-            offset = get_le64(pb);
-            get_le32(pb);       /* size */
-            duration = get_le32(pb);
-
-            if(url_feof(pb))
-                return -1;
-
-            pos = url_ftell(pb);
-
-            url_fseek(pb, offset+8, SEEK_SET);
-            read_braindead_odml_indx(s, frame_num);
-            frame_num += duration;
-
-            url_fseek(pb, pos, SEEK_SET);
-        }
-    }
-    avi->index_loaded=1;
-    return 0;
-}
-
-static void clean_index(AVFormatContext *s){
-    int i;
-    int64_t j;
-
-    for(i=0; i<s->nb_streams; i++){
-        AVStream *st = s->streams[i];
-        AVIStream *ast = st->priv_data;
-        int n= st->nb_index_entries;
-        int max= ast->sample_size;
-        int64_t pos, size, ts;
-
-        if(n != 1 || ast->sample_size==0)
-            continue;
-
-        while(max < 1024) max+=max;
-
-        pos= st->index_entries[0].pos;
-        size= st->index_entries[0].size;
-        ts= st->index_entries[0].timestamp;
-
-        for(j=0; j<size; j+=max){
-            av_add_index_entry(st, pos+j, ts+j, FFMIN(max, size-j), 0, AVINDEX_KEYFRAME);
-        }
-    }
-}
-
-static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t size)
-{
-    ByteIOContext *pb = s->pb;
-    char key[5] = {0}, *value;
-
-    size += (size & 1);
-
-    if (size == UINT_MAX)
-        return -1;
-    value = av_malloc(size+1);
-    if (!value)
-        return -1;
-    get_buffer(pb, value, size);
-    value[size]=0;
-
-    AV_WL32(key, tag);
-
-    if(st)
-        return av_metadata_set2(&st->metadata, key, value,
-                                    AV_METADATA_DONT_STRDUP_VAL);
-    else
-    return av_metadata_set2(&s->metadata, key, value,
-                                  AV_METADATA_DONT_STRDUP_VAL);
-}
-
-static void avi_read_info(AVFormatContext *s, uint64_t end)
-{
-    while (url_ftell(s->pb) < end) {
-        uint32_t tag  = get_le32(s->pb);
-        uint32_t size = get_le32(s->pb);
-        avi_read_tag(s, NULL, tag, size);
-    }
-}
-
-static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned int tag, tag1, handler;
-    int codec_type, stream_index, frame_period, bit_rate;
-    unsigned int size;
-    int i;
-    AVStream *st;
-    AVIStream *ast = NULL;
-    int avih_width=0, avih_height=0;
-    int amv_file_format=0;
-    uint64_t list_end = 0;
-
-    avi->stream_index= -1;
-
-    if (get_riff(s, pb) < 0)
-        return -1;
-
-    avi->fsize = url_fsize(pb);
-    if(avi->fsize<=0)
-        avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end;
-
-    /* first list tag */
-    stream_index = -1;
-    codec_type = -1;
-    frame_period = 0;
-    for(;;) {
-        if (url_feof(pb))
-            goto fail;
-        tag = get_le32(pb);
-        size = get_le32(pb);
-#ifdef DEBUG
-        print_tag("tag", tag, size);
-#endif
-
-        switch(tag) {
-        case MKTAG('L', 'I', 'S', 'T'):
-            list_end = url_ftell(pb) + size;
-            /* Ignored, except at start of video packets. */
-            tag1 = get_le32(pb);
-#ifdef DEBUG
-            print_tag("list", tag1, 0);
-#endif
-            if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
-                avi->movi_list = url_ftell(pb) - 4;
-                if(size) avi->movi_end = avi->movi_list + size + (size & 1);
-                else     avi->movi_end = url_fsize(pb);
-                dprintf(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
-                goto end_of_header;
-            }
-            else if (tag1 == MKTAG('I', 'N', 'F', 'O'))
-                avi_read_info(s, list_end);
-
-            break;
-        case MKTAG('d', 'm', 'l', 'h'):
-            avi->is_odml = 1;
-            url_fskip(pb, size + (size & 1));
-            break;
-        case MKTAG('a', 'm', 'v', 'h'):
-            amv_file_format=1;
-        case MKTAG('a', 'v', 'i', 'h'):
-            /* AVI header */
-            /* using frame_period is bad idea */
-            frame_period = get_le32(pb);
-            bit_rate = get_le32(pb) * 8;
-            get_le32(pb);
-            avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX;
-
-            url_fskip(pb, 2 * 4);
-            get_le32(pb);
-            get_le32(pb);
-            avih_width=get_le32(pb);
-            avih_height=get_le32(pb);
-
-            url_fskip(pb, size - 10 * 4);
-            break;
-        case MKTAG('s', 't', 'r', 'h'):
-            /* stream header */
-
-            tag1 = get_le32(pb);
-            handler = get_le32(pb); /* codec tag */
-
-            if(tag1 == MKTAG('p', 'a', 'd', 's')){
-                url_fskip(pb, size - 8);
-                break;
-            }else{
-                stream_index++;
-                st = av_new_stream(s, stream_index);
-                if (!st)
-                    goto fail;
-
-                ast = av_mallocz(sizeof(AVIStream));
-                if (!ast)
-                    goto fail;
-                st->priv_data = ast;
-            }
-            if(amv_file_format)
-                tag1 = stream_index ? MKTAG('a','u','d','s') : MKTAG('v','i','d','s');
-
-#ifdef DEBUG
-            print_tag("strh", tag1, -1);
-#endif
-            if(tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')){
-                int64_t dv_dur;
-
-                /*
-                 * After some consideration -- I don't think we
-                 * have to support anything but DV in type1 AVIs.
-                 */
-                if (s->nb_streams != 1)
-                    goto fail;
-
-                if (handler != MKTAG('d', 'v', 's', 'd') &&
-                    handler != MKTAG('d', 'v', 'h', 'd') &&
-                    handler != MKTAG('d', 'v', 's', 'l'))
-                   goto fail;
-
-                ast = s->streams[0]->priv_data;
-                av_freep(&s->streams[0]->codec->extradata);
-                av_freep(&s->streams[0]);
-                s->nb_streams = 0;
-                if (CONFIG_DV_DEMUXER) {
-                    avi->dv_demux = dv_init_demux(s);
-                    if (!avi->dv_demux)
-                        goto fail;
-                }
-                s->streams[0]->priv_data = ast;
-                url_fskip(pb, 3 * 4);
-                ast->scale = get_le32(pb);
-                ast->rate = get_le32(pb);
-                url_fskip(pb, 4);  /* start time */
-
-                dv_dur = get_le32(pb);
-                if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
-                    dv_dur *= AV_TIME_BASE;
-                    s->duration = av_rescale(dv_dur, ast->scale, ast->rate);
-                }
-                /*
-                 * else, leave duration alone; timing estimation in utils.c
-                 *      will make a guess based on bitrate.
-                 */
-
-                stream_index = s->nb_streams - 1;
-                url_fskip(pb, size - 9*4);
-                break;
-            }
-
-            assert(stream_index < s->nb_streams);
-            st->codec->stream_codec_tag= handler;
-
-            get_le32(pb); /* flags */
-            get_le16(pb); /* priority */
-            get_le16(pb); /* language */
-            get_le32(pb); /* initial frame */
-            ast->scale = get_le32(pb);
-            ast->rate = get_le32(pb);
-            if(!(ast->scale && ast->rate)){
-                av_log(s, AV_LOG_WARNING, "scale/rate is %u/%u which is invalid. (This file has been generated by broken software.)\n", ast->scale, ast->rate);
-                if(frame_period){
-                    ast->rate = 1000000;
-                    ast->scale = frame_period;
-                }else{
-                    ast->rate = 25;
-                    ast->scale = 1;
-                }
-            }
-            av_set_pts_info(st, 64, ast->scale, ast->rate);
-
-            ast->cum_len=get_le32(pb); /* start */
-            st->nb_frames = get_le32(pb);
-
-            st->start_time = 0;
-            get_le32(pb); /* buffer size */
-            get_le32(pb); /* quality */
-            ast->sample_size = get_le32(pb); /* sample ssize */
-            ast->cum_len *= FFMAX(1, ast->sample_size);
-//            av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
-
-            switch(tag1) {
-            case MKTAG('v', 'i', 'd', 's'):
-                codec_type = AVMEDIA_TYPE_VIDEO;
-
-                ast->sample_size = 0;
-                break;
-            case MKTAG('a', 'u', 'd', 's'):
-                codec_type = AVMEDIA_TYPE_AUDIO;
-                break;
-            case MKTAG('t', 'x', 't', 's'):
-                //FIXME
-                codec_type = AVMEDIA_TYPE_DATA; //AVMEDIA_TYPE_SUB ?  FIXME
-                break;
-            case MKTAG('d', 'a', 't', 's'):
-                codec_type = AVMEDIA_TYPE_DATA;
-                break;
-            default:
-                av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
-                goto fail;
-            }
-            if(ast->sample_size == 0)
-                st->duration = st->nb_frames;
-            ast->frame_offset= ast->cum_len;
-            url_fskip(pb, size - 12 * 4);
-            break;
-        case MKTAG('s', 't', 'r', 'f'):
-            /* stream header */
-            if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
-                url_fskip(pb, size);
-            } else {
-                uint64_t cur_pos = url_ftell(pb);
-                if (cur_pos < list_end)
-                    size = FFMIN(size, list_end - cur_pos);
-                st = s->streams[stream_index];
-                switch(codec_type) {
-                case AVMEDIA_TYPE_VIDEO:
-                    if(amv_file_format){
-                        st->codec->width=avih_width;
-                        st->codec->height=avih_height;
-                        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-                        st->codec->codec_id = CODEC_ID_AMV;
-                        url_fskip(pb, size);
-                        break;
-                    }
-                    get_le32(pb); /* size */
-                    st->codec->width = get_le32(pb);
-                    st->codec->height = (int32_t)get_le32(pb);
-                    get_le16(pb); /* panes */
-                    st->codec->bits_per_coded_sample= get_le16(pb); /* depth */
-                    tag1 = get_le32(pb);
-                    get_le32(pb); /* ImageSize */
-                    get_le32(pb); /* XPelsPerMeter */
-                    get_le32(pb); /* YPelsPerMeter */
-                    get_le32(pb); /* ClrUsed */
-                    get_le32(pb); /* ClrImportant */
-
-                    if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D','X','S','A')) {
-                        st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-                        st->codec->codec_tag = tag1;
-                        st->codec->codec_id = CODEC_ID_XSUB;
-                        break;
-                    }
-
-                    if(size > 10*4 && size<(1<<30)){
-                        st->codec->extradata_size= size - 10*4;
-                        st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                        if (!st->codec->extradata) {
-                            st->codec->extradata_size= 0;
-                            return AVERROR(ENOMEM);
-                        }
-                        get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
-                    }
-
-                    if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly
-                        get_byte(pb);
-
-                    /* Extract palette from extradata if bpp <= 8. */
-                    /* This code assumes that extradata contains only palette. */
-                    /* This is true for all paletted codecs implemented in FFmpeg. */
-                    if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) {
-                        st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
-#if HAVE_BIGENDIAN
-                        for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
-                            st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]);
-#else
-                        memcpy(st->codec->palctrl->palette, st->codec->extradata,
-                               FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
-#endif
-                        st->codec->palctrl->palette_changed = 1;
-                    }
-
-#ifdef DEBUG
-                    print_tag("video", tag1, 0);
-#endif
-                    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-                    st->codec->codec_tag = tag1;
-                    st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1);
-                    st->need_parsing = AVSTREAM_PARSE_HEADERS; // This is needed to get the pict type which is necessary for generating correct pts.
-                    // Support "Resolution 1:1" for Avid AVI Codec
-                    if(tag1 == MKTAG('A', 'V', 'R', 'n') &&
-                       st->codec->extradata_size >= 31 &&
-                       !memcmp(&st->codec->extradata[28], "1:1", 3))
-                        st->codec->codec_id = CODEC_ID_RAWVIDEO;
-
-                    if(st->codec->codec_tag==0 && st->codec->height > 0 && st->codec->extradata_size < 1U<<30){
-                        st->codec->extradata_size+= 9;
-                        st->codec->extradata= av_realloc(st->codec->extradata, st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                        if(st->codec->extradata)
-                            memcpy(st->codec->extradata + st->codec->extradata_size - 9, "BottomUp", 9);
-                    }
-                    st->codec->height= FFABS(st->codec->height);
-
-//                    url_fskip(pb, size - 5 * 4);
-                    break;
-                case AVMEDIA_TYPE_AUDIO:
-                    ff_get_wav_header(pb, st->codec, size);
-                    if(ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align){
-                        av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align);
-                        ast->sample_size= st->codec->block_align;
-                    }
-                    if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
-                        url_fskip(pb, 1);
-                    /* Force parsing as several audio frames can be in
-                     * one packet and timestamps refer to packet start. */
-                    st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
-                    /* ADTS header is in extradata, AAC without header must be
-                     * stored as exact frames. Parser not needed and it will
-                     * fail. */
-                    if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size)
-                        st->need_parsing = AVSTREAM_PARSE_NONE;
-                    /* AVI files with Xan DPCM audio (wrongly) declare PCM
-                     * audio in the header but have Axan as stream_code_tag. */
-                    if (st->codec->stream_codec_tag == AV_RL32("Axan")){
-                        st->codec->codec_id  = CODEC_ID_XAN_DPCM;
-                        st->codec->codec_tag = 0;
-                    }
-                    if (amv_file_format)
-                        st->codec->codec_id  = CODEC_ID_ADPCM_IMA_AMV;
-                    break;
-                default:
-                    st->codec->codec_type = AVMEDIA_TYPE_DATA;
-                    st->codec->codec_id= CODEC_ID_NONE;
-                    st->codec->codec_tag= 0;
-                    url_fskip(pb, size);
-                    break;
-                }
-            }
-            break;
-        case MKTAG('i', 'n', 'd', 'x'):
-            i= url_ftell(pb);
-            if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){
-                read_braindead_odml_indx(s, 0);
-            }
-            url_fseek(pb, i+size, SEEK_SET);
-            break;
-        case MKTAG('v', 'p', 'r', 'p'):
-            if(stream_index < (unsigned)s->nb_streams && size > 9*4){
-                AVRational active, active_aspect;
-
-                st = s->streams[stream_index];
-                get_le32(pb);
-                get_le32(pb);
-                get_le32(pb);
-                get_le32(pb);
-                get_le32(pb);
-
-                active_aspect.den= get_le16(pb);
-                active_aspect.num= get_le16(pb);
-                active.num       = get_le32(pb);
-                active.den       = get_le32(pb);
-                get_le32(pb); //nbFieldsPerFrame
-
-                if(active_aspect.num && active_aspect.den && active.num && active.den){
-                    st->sample_aspect_ratio= av_div_q(active_aspect, active);
-//av_log(s, AV_LOG_ERROR, "vprp %d/%d %d/%d\n", active_aspect.num, active_aspect.den, active.num, active.den);
-                }
-                size -= 9*4;
-            }
-            url_fseek(pb, size, SEEK_CUR);
-            break;
-        case MKTAG('s', 't', 'r', 'n'):
-            if(s->nb_streams){
-                avi_read_tag(s, s->streams[s->nb_streams-1], tag, size);
-                break;
-            }
-        default:
-            if(size > 1000000){
-                av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "
-                                        "I will ignore it and try to continue anyway.\n");
-                avi->movi_list = url_ftell(pb) - 4;
-                avi->movi_end  = url_fsize(pb);
-                goto end_of_header;
-            }
-            /* skip tag */
-            size += (size & 1);
-            url_fskip(pb, size);
-            break;
-        }
-    }
- end_of_header:
-    /* check stream number */
-    if (stream_index != s->nb_streams - 1) {
-    fail:
-        return -1;
-    }
-
-    if(!avi->index_loaded && !url_is_streamed(pb))
-        avi_load_index(s);
-    avi->index_loaded = 1;
-    avi->non_interleaved |= guess_ni_flag(s);
-    for(i=0; i<s->nb_streams; i++){
-        AVStream *st = s->streams[i];
-        if(st->nb_index_entries)
-            break;
-    }
-    if(i==s->nb_streams && avi->non_interleaved) {
-        av_log(s, AV_LOG_WARNING, "non-interleaved AVI without index, switching to interleaved\n");
-        avi->non_interleaved=0;
-    }
-
-    if(avi->non_interleaved) {
-        av_log(s, AV_LOG_INFO, "non-interleaved AVI\n");
-        clean_index(s);
-    }
-
-    return 0;
-}
-
-static int get_stream_idx(int *d){
-    if(    d[0] >= '0' && d[0] <= '9'
-        && d[1] >= '0' && d[1] <= '9'){
-        return (d[0] - '0') * 10 + (d[1] - '0');
-    }else{
-        return 100; //invalid stream ID
-    }
-}
-
-static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int n, d[8];
-    unsigned int size;
-    int64_t i, sync;
-    void* dstr;
-
-    if (CONFIG_DV_DEMUXER && avi->dv_demux) {
-        int size = dv_get_packet(avi->dv_demux, pkt);
-        if (size >= 0)
-            return size;
-    }
-
-    if(avi->non_interleaved){
-        int best_stream_index = 0;
-        AVStream *best_st= NULL;
-        AVIStream *best_ast;
-        int64_t best_ts= INT64_MAX;
-        int i;
-
-        for(i=0; i<s->nb_streams; i++){
-            AVStream *st = s->streams[i];
-            AVIStream *ast = st->priv_data;
-            int64_t ts= ast->frame_offset;
-            int64_t last_ts;
-
-            if(!st->nb_index_entries)
-                continue;
-
-            last_ts = st->index_entries[st->nb_index_entries - 1].timestamp;
-            if(!ast->remaining && ts > last_ts)
-                continue;
-
-            ts = av_rescale_q(ts, st->time_base, (AVRational){FFMAX(1, ast->sample_size), AV_TIME_BASE});
-
-//            av_log(s, AV_LOG_DEBUG, "%"PRId64" %d/%d %"PRId64"\n", ts, st->time_base.num, st->time_base.den, ast->frame_offset);
-            if(ts < best_ts){
-                best_ts= ts;
-                best_st= st;
-                best_stream_index= i;
-            }
-        }
-        if(!best_st)
-            return -1;
-
-        best_ast = best_st->priv_data;
-        best_ts = av_rescale_q(best_ts, (AVRational){FFMAX(1, best_ast->sample_size), AV_TIME_BASE}, best_st->time_base);
-        if(best_ast->remaining)
-            i= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD);
-        else{
-            i= av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY);
-            if(i>=0)
-                best_ast->frame_offset= best_st->index_entries[i].timestamp;
-        }
-
-//        av_log(s, AV_LOG_DEBUG, "%d\n", i);
-        if(i>=0){
-            int64_t pos= best_st->index_entries[i].pos;
-            pos += best_ast->packet_size - best_ast->remaining;
-            url_fseek(s->pb, pos + 8, SEEK_SET);
-//        av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
-
-            assert(best_ast->remaining <= best_ast->packet_size);
-
-            avi->stream_index= best_stream_index;
-            if(!best_ast->remaining)
-                best_ast->packet_size=
-                best_ast->remaining= best_st->index_entries[i].size;
-        }
-    }
-
-resync:
-    if(avi->stream_index >= 0){
-        AVStream *st= s->streams[ avi->stream_index ];
-        AVIStream *ast= st->priv_data;
-        int size, err;
-
-        if(ast->sample_size <= 1) // minorityreport.AVI block_align=1024 sample_size=1 IMA-ADPCM
-            size= INT_MAX;
-        else if(ast->sample_size < 32)
-            // arbitrary multiplier to avoid tiny packets for raw PCM data
-            size= 1024*ast->sample_size;
-        else
-            size= ast->sample_size;
-
-        if(size > ast->remaining)
-            size= ast->remaining;
-        avi->last_pkt_pos= url_ftell(pb);
-        err= av_get_packet(pb, pkt, size);
-        if(err<0)
-            return err;
-
-        if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){
-            void *ptr= av_realloc(pkt->data, pkt->size + 4*256 + FF_INPUT_BUFFER_PADDING_SIZE);
-            if(ptr){
-            ast->has_pal=0;
-            pkt->size += 4*256;
-            pkt->data= ptr;
-                memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256);
-            }else
-                av_log(s, AV_LOG_ERROR, "Failed to append palette\n");
-        }
-
-        if (CONFIG_DV_DEMUXER && avi->dv_demux) {
-            dstr = pkt->destruct;
-            size = dv_produce_packet(avi->dv_demux, pkt,
-                                    pkt->data, pkt->size);
-            pkt->destruct = dstr;
-            pkt->flags |= AV_PKT_FLAG_KEY;
-        } else {
-            /* XXX: How to handle B-frames in AVI? */
-            pkt->dts = ast->frame_offset;
-//                pkt->dts += ast->start;
-            if(ast->sample_size)
-                pkt->dts /= ast->sample_size;
-//av_log(s, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
-            pkt->stream_index = avi->stream_index;
-
-            if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-                AVIndexEntry *e;
-                int index;
-                assert(st->index_entries);
-
-                index= av_index_search_timestamp(st, ast->frame_offset, 0);
-                e= &st->index_entries[index];
-
-                if(index >= 0 && e->timestamp == ast->frame_offset){
-                    if (e->flags & AVINDEX_KEYFRAME)
-                        pkt->flags |= AV_PKT_FLAG_KEY;
-                }
-            } else {
-                pkt->flags |= AV_PKT_FLAG_KEY;
-            }
-            if(ast->sample_size)
-                ast->frame_offset += pkt->size;
-            else
-                ast->frame_offset++;
-        }
-        ast->remaining -= size;
-        if(!ast->remaining){
-            avi->stream_index= -1;
-            ast->packet_size= 0;
-        }
-
-        return size;
-    }
-
-    memset(d, -1, sizeof(int)*8);
-    for(i=sync=url_ftell(pb); !url_feof(pb); i++) {
-        int j;
-
-        for(j=0; j<7; j++)
-            d[j]= d[j+1];
-        d[7]= get_byte(pb);
-
-        size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
-
-        n= get_stream_idx(d+2);
-//av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
-        if(i + (uint64_t)size > avi->fsize || d[0]<0)
-            continue;
-
-        //parse ix##
-        if(  (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams)
-        //parse JUNK
-           ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
-           ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
-            url_fskip(pb, size);
-//av_log(s, AV_LOG_DEBUG, "SKIP\n");
-            goto resync;
-        }
-
-        //parse stray LIST
-        if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){
-            url_fskip(pb, 4);
-            goto resync;
-        }
-
-        n= get_stream_idx(d);
-
-        if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams)
-            continue;
-
-        //detect ##ix chunk and skip
-        if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){
-            url_fskip(pb, size);
-            goto resync;
-        }
-
-        //parse ##dc/##wb
-        if(n < s->nb_streams){
-            AVStream *st;
-            AVIStream *ast;
-            st = s->streams[n];
-            ast = st->priv_data;
-
-            if(s->nb_streams>=2){
-                AVStream *st1  = s->streams[1];
-                AVIStream *ast1= st1->priv_data;
-                //workaround for broken small-file-bug402.avi
-                if(   d[2] == 'w' && d[3] == 'b'
-                   && n==0
-                   && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO
-                   && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO
-                   && ast->prefix == 'd'*256+'c'
-                   && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count)
-                  ){
-                    n=1;
-                    st = st1;
-                    ast = ast1;
-                    av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n");
-                }
-            }
-
-
-            if(   (st->discard >= AVDISCARD_DEFAULT && size==0)
-               /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
-               || st->discard >= AVDISCARD_ALL){
-                if(ast->sample_size) ast->frame_offset += size;
-                else                 ast->frame_offset++;
-                url_fskip(pb, size);
-                goto resync;
-            }
-
-            if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) {
-                int k = get_byte(pb);
-                int last = (k + get_byte(pb) - 1) & 0xFF;
-
-                get_le16(pb); //flags
-
-                for (; k <= last; k++)
-                    ast->pal[k] = get_be32(pb)>>8;// b + (g << 8) + (r << 16);
-                ast->has_pal= 1;
-                goto resync;
-            } else if(   ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) ||
-                         d[2]*256+d[3] == ast->prefix /*||
-                         (d[2] == 'd' && d[3] == 'c') ||
-                         (d[2] == 'w' && d[3] == 'b')*/) {
-
-//av_log(s, AV_LOG_DEBUG, "OK\n");
-                if(d[2]*256+d[3] == ast->prefix)
-                    ast->prefix_count++;
-                else{
-                    ast->prefix= d[2]*256+d[3];
-                    ast->prefix_count= 0;
-                }
-
-                avi->stream_index= n;
-                ast->packet_size= size + 8;
-                ast->remaining= size;
-
-                if(size || !ast->sample_size){
-                    uint64_t pos= url_ftell(pb) - 8;
-                    if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
-                        av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
-                    }
-                }
-                goto resync;
-            }
-        }
-    }
-
-    return AVERROR_EOF;
-}
-
-/* XXX: We make the implicit supposition that the positions are sorted
-   for each stream. */
-static int avi_read_idx1(AVFormatContext *s, int size)
-{
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int nb_index_entries, i;
-    AVStream *st;
-    AVIStream *ast;
-    unsigned int index, tag, flags, pos, len;
-    unsigned last_pos= -1;
-
-    nb_index_entries = size / 16;
-    if (nb_index_entries <= 0)
-        return -1;
-
-    /* Read the entries and sort them in each stream component. */
-    for(i = 0; i < nb_index_entries; i++) {
-        tag = get_le32(pb);
-        flags = get_le32(pb);
-        pos = get_le32(pb);
-        len = get_le32(pb);
-#if defined(DEBUG_SEEK)
-        av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
-               i, tag, flags, pos, len);
-#endif
-        if(i==0 && pos > avi->movi_list)
-            avi->movi_list= 0; //FIXME better check
-        pos += avi->movi_list;
-
-        index = ((tag & 0xff) - '0') * 10;
-        index += ((tag >> 8) & 0xff) - '0';
-        if (index >= s->nb_streams)
-            continue;
-        st = s->streams[index];
-        ast = st->priv_data;
-
-#if defined(DEBUG_SEEK)
-        av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
-#endif
-        if(url_feof(pb))
-            return -1;
-
-        if(last_pos == pos)
-            avi->non_interleaved= 1;
-        else if(len || !ast->sample_size)
-            av_add_index_entry(st, pos, ast->cum_len, len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
-        if(ast->sample_size)
-            ast->cum_len += len;
-        else
-            ast->cum_len ++;
-        last_pos= pos;
-    }
-    return 0;
-}
-
-static int guess_ni_flag(AVFormatContext *s){
-    int i;
-    int64_t last_start=0;
-    int64_t first_end= INT64_MAX;
-    int64_t oldpos= url_ftell(s->pb);
-
-    for(i=0; i<s->nb_streams; i++){
-        AVStream *st = s->streams[i];
-        int n= st->nb_index_entries;
-        unsigned int size;
-
-        if(n <= 0)
-            continue;
-
-        if(n >= 2){
-            int64_t pos= st->index_entries[0].pos;
-            url_fseek(s->pb, pos + 4, SEEK_SET);
-            size= get_le32(s->pb);
-            if(pos + size > st->index_entries[1].pos)
-                last_start= INT64_MAX;
-        }
-
-        if(st->index_entries[0].pos > last_start)
-            last_start= st->index_entries[0].pos;
-        if(st->index_entries[n-1].pos < first_end)
-            first_end= st->index_entries[n-1].pos;
-    }
-    url_fseek(s->pb, oldpos, SEEK_SET);
-    return last_start > first_end;
-}
-
-static int avi_load_index(AVFormatContext *s)
-{
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint32_t tag, size;
-    int64_t pos= url_ftell(pb);
-    int ret = -1;
-
-    if (url_fseek(pb, avi->movi_end, SEEK_SET) < 0)
-        goto the_end; // maybe truncated file
-#ifdef DEBUG_SEEK
-    printf("movi_end=0x%"PRIx64"\n", avi->movi_end);
-#endif
-    for(;;) {
-        if (url_feof(pb))
-            break;
-        tag = get_le32(pb);
-        size = get_le32(pb);
-#ifdef DEBUG_SEEK
-        printf("tag=%c%c%c%c size=0x%x\n",
-               tag & 0xff,
-               (tag >> 8) & 0xff,
-               (tag >> 16) & 0xff,
-               (tag >> 24) & 0xff,
-               size);
-#endif
-        switch(tag) {
-        case MKTAG('i', 'd', 'x', '1'):
-            if (avi_read_idx1(s, size) < 0)
-                goto skip;
-            ret = 0;
-                goto the_end;
-            break;
-        default:
-        skip:
-            size += (size & 1);
-            if (url_fseek(pb, size, SEEK_CUR) < 0)
-                goto the_end; // something is wrong here
-            break;
-        }
-    }
- the_end:
-    url_fseek(pb, pos, SEEK_SET);
-    return ret;
-}
-
-static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    AVIContext *avi = s->priv_data;
-    AVStream *st;
-    int i, index;
-    int64_t pos;
-    AVIStream *ast;
-
-    if (!avi->index_loaded) {
-        /* we only load the index on demand */
-        avi_load_index(s);
-        avi->index_loaded = 1;
-    }
-    assert(stream_index>= 0);
-
-    st = s->streams[stream_index];
-    ast= st->priv_data;
-    index= av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags);
-    if(index<0)
-        return -1;
-
-    /* find the position */
-    pos = st->index_entries[index].pos;
-    timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
-
-//    av_log(s, AV_LOG_DEBUG, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp);
-
-    if (CONFIG_DV_DEMUXER && avi->dv_demux) {
-        /* One and only one real stream for DV in AVI, and it has video  */
-        /* offsets. Calling with other stream indexes should have failed */
-        /* the av_index_search_timestamp call above.                     */
-        assert(stream_index == 0);
-
-        /* Feed the DV video stream version of the timestamp to the */
-        /* DV demux so it can synthesize correct timestamps.        */
-        dv_offset_reset(avi->dv_demux, timestamp);
-
-        url_fseek(s->pb, pos, SEEK_SET);
-        avi->stream_index= -1;
-        return 0;
-    }
-
-    for(i = 0; i < s->nb_streams; i++) {
-        AVStream *st2 = s->streams[i];
-        AVIStream *ast2 = st2->priv_data;
-
-        ast2->packet_size=
-        ast2->remaining= 0;
-
-        if (st2->nb_index_entries <= 0)
-            continue;
-
-//        assert(st2->codec->block_align);
-        assert((int64_t)st2->time_base.num*ast2->rate == (int64_t)st2->time_base.den*ast2->scale);
-        index = av_index_search_timestamp(
-                st2,
-                av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1),
-                flags | AVSEEK_FLAG_BACKWARD);
-        if(index<0)
-            index=0;
-
-        if(!avi->non_interleaved){
-            while(index>0 && st2->index_entries[index].pos > pos)
-                index--;
-            while(index+1 < st2->nb_index_entries && st2->index_entries[index].pos < pos)
-                index++;
-        }
-
-//        av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %"PRId64"\n", timestamp, index, st2->index_entries[index].timestamp);
-        /* extract the current frame number */
-        ast2->frame_offset = st2->index_entries[index].timestamp;
-    }
-
-    /* do the seek */
-    url_fseek(s->pb, pos, SEEK_SET);
-    avi->stream_index= -1;
-    return 0;
-}
-
-static int avi_read_close(AVFormatContext *s)
-{
-    int i;
-    AVIContext *avi = s->priv_data;
-
-    for(i=0;i<s->nb_streams;i++) {
-        AVStream *st = s->streams[i];
-        av_free(st->codec->palctrl);
-    }
-
-    if (avi->dv_demux)
-        av_free(avi->dv_demux);
-
-    return 0;
-}
-
-static int avi_probe(AVProbeData *p)
-{
-    int i;
-
-    /* check file header */
-    for(i=0; avi_headers[i][0]; i++)
-        if(!memcmp(p->buf  , avi_headers[i]  , 4) &&
-           !memcmp(p->buf+8, avi_headers[i]+4, 4))
-            return AVPROBE_SCORE_MAX;
-
-    return 0;
-}
-
-AVInputFormat avi_demuxer = {
-    "avi",
-    NULL_IF_CONFIG_SMALL("AVI format"),
-    sizeof(AVIContext),
-    avi_probe,
-    avi_read_header,
-    avi_read_packet,
-    avi_read_close,
-    avi_read_seek,
-    .metadata_conv = ff_avi_metadata_conv,
-};
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
deleted file mode 100644
index b4a31ec..0000000
--- a/libavformat/avienc.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
- * AVI muxer
- * Copyright (c) 2000 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "avi.h"
-#include "riff.h"
-#include "libavutil/intreadwrite.h"
-
-/*
- * TODO:
- *  - fill all fields if non streamed (nb_frames for example)
- */
-
-typedef struct AVIIentry {
-    unsigned int flags, pos, len;
-} AVIIentry;
-
-#define AVI_INDEX_CLUSTER_SIZE 16384
-
-typedef struct AVIIndex {
-    int64_t     indx_start;
-    int         entry;
-    int         ents_allocated;
-    AVIIentry** cluster;
-} AVIIndex;
-
-typedef struct {
-    int64_t riff_start, movi_list, odml_list;
-    int64_t frames_hdr_all;
-    int riff_id;
-} AVIContext;
-
-typedef struct  {
-    int64_t frames_hdr_strm;
-    int audio_strm_length;
-    int packet_count;
-    int entry;
-
-    AVIIndex indexes;
-} AVIStream ;
-
-static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
-{
-    int cl = ent_id / AVI_INDEX_CLUSTER_SIZE;
-    int id = ent_id % AVI_INDEX_CLUSTER_SIZE;
-    return &idx->cluster[cl][id];
-}
-
-static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb,
-                                  const char* riff_tag, const char* list_tag)
-{
-    AVIContext *avi= s->priv_data;
-    int64_t loff;
-    int i;
-
-    avi->riff_id++;
-    for (i=0; i<s->nb_streams; i++){
-        AVIStream *avist= s->streams[i]->priv_data;
-        avist->indexes.entry = 0;
-    }
-
-    avi->riff_start = ff_start_tag(pb, "RIFF");
-    put_tag(pb, riff_tag);
-    loff = ff_start_tag(pb, "LIST");
-    put_tag(pb, list_tag);
-    return loff;
-}
-
-static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
-{
-    tag[0] = '0';
-    tag[1] = '0' + index;
-    if (type == AVMEDIA_TYPE_VIDEO) {
-        tag[2] = 'd';
-        tag[3] = 'c';
-    } else if (type == AVMEDIA_TYPE_SUBTITLE) {
-        // note: this is not an official code
-        tag[2] = 's';
-        tag[3] = 'b';
-    } else {
-        tag[2] = 'w';
-        tag[3] = 'b';
-    }
-    tag[4] = '\0';
-    return tag;
-}
-
-static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str)
-{
-    int len = strlen(str);
-    if (len > 0) {
-        len++;
-        put_tag(pb, tag);
-        put_le32(pb, len);
-        put_strz(pb, str);
-        if (len & 1)
-            put_byte(pb, 0);
-    }
-}
-
-static int avi_write_counters(AVFormatContext* s, int riff_id)
-{
-    ByteIOContext *pb = s->pb;
-    AVIContext *avi = s->priv_data;
-    int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
-    int64_t file_size;
-    AVCodecContext* stream;
-
-    file_size = url_ftell(pb);
-    for(n = 0; n < s->nb_streams; n++) {
-        AVIStream *avist= s->streams[n]->priv_data;
-
-        assert(avist->frames_hdr_strm);
-        stream = s->streams[n]->codec;
-        url_fseek(pb, avist->frames_hdr_strm, SEEK_SET);
-        ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
-        if(au_ssize == 0) {
-            put_le32(pb, avist->packet_count);
-        } else {
-            put_le32(pb, avist->audio_strm_length / au_ssize);
-        }
-        if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
-            nb_frames = FFMAX(nb_frames, avist->packet_count);
-    }
-    if(riff_id == 1) {
-        assert(avi->frames_hdr_all);
-        url_fseek(pb, avi->frames_hdr_all, SEEK_SET);
-        put_le32(pb, nb_frames);
-    }
-    url_fseek(pb, file_size, SEEK_SET);
-
-    return 0;
-}
-
-static int avi_write_header(AVFormatContext *s)
-{
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
-    AVCodecContext *stream, *video_enc;
-    int64_t list1, list2, strh, strf;
-    AVMetadataTag *t = NULL;
-
-    for(n=0;n<s->nb_streams;n++) {
-        s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream));
-        if(!s->streams[n]->priv_data)
-            return AVERROR(ENOMEM);
-    }
-
-    /* header list */
-    avi->riff_id = 0;
-    list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl");
-
-    /* avi header */
-    put_tag(pb, "avih");
-    put_le32(pb, 14 * 4);
-    bitrate = 0;
-
-    video_enc = NULL;
-    for(n=0;n<s->nb_streams;n++) {
-        stream = s->streams[n]->codec;
-        bitrate += stream->bit_rate;
-        if (stream->codec_type == AVMEDIA_TYPE_VIDEO)
-            video_enc = stream;
-    }
-
-    nb_frames = 0;
-
-    if(video_enc){
-        put_le32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den));
-    } else {
-        put_le32(pb, 0);
-    }
-    put_le32(pb, bitrate / 8); /* XXX: not quite exact */
-    put_le32(pb, 0); /* padding */
-    if (url_is_streamed(pb))
-        put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
-    else
-        put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
-    avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
-    put_le32(pb, nb_frames); /* nb frames, filled later */
-    put_le32(pb, 0); /* initial frame */
-    put_le32(pb, s->nb_streams); /* nb streams */
-    put_le32(pb, 1024 * 1024); /* suggested buffer size */
-    if(video_enc){
-        put_le32(pb, video_enc->width);
-        put_le32(pb, video_enc->height);
-    } else {
-        put_le32(pb, 0);
-        put_le32(pb, 0);
-    }
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-
-    /* stream list */
-    for(i=0;i<n;i++) {
-        AVIStream *avist= s->streams[i]->priv_data;
-        list2 = ff_start_tag(pb, "LIST");
-        put_tag(pb, "strl");
-
-        stream = s->streams[i]->codec;
-
-        /* stream generic header */
-        strh = ff_start_tag(pb, "strh");
-        switch(stream->codec_type) {
-        case AVMEDIA_TYPE_SUBTITLE:
-            // XSUB subtitles behave like video tracks, other subtitles
-            // are not (yet) supported.
-            if (stream->codec_id != CODEC_ID_XSUB) break;
-        case AVMEDIA_TYPE_VIDEO: put_tag(pb, "vids"); break;
-        case AVMEDIA_TYPE_AUDIO: put_tag(pb, "auds"); break;
-//        case AVMEDIA_TYPE_TEXT : put_tag(pb, "txts"); break;
-        case AVMEDIA_TYPE_DATA : put_tag(pb, "dats"); break;
-        }
-        if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
-           stream->codec_id == CODEC_ID_XSUB)
-            put_le32(pb, stream->codec_tag);
-        else
-            put_le32(pb, 1);
-        put_le32(pb, 0); /* flags */
-        put_le16(pb, 0); /* priority */
-        put_le16(pb, 0); /* language */
-        put_le32(pb, 0); /* initial frame */
-
-        ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
-
-        put_le32(pb, au_scale); /* scale */
-        put_le32(pb, au_byterate); /* rate */
-        av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
-
-        put_le32(pb, 0); /* start */
-        avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */
-        if (url_is_streamed(pb))
-            put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
-        else
-            put_le32(pb, 0); /* length, XXX: filled later */
-
-        /* suggested buffer size */ //FIXME set at the end to largest chunk
-        if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
-            put_le32(pb, 1024 * 1024);
-        else if(stream->codec_type == AVMEDIA_TYPE_AUDIO)
-            put_le32(pb, 12 * 1024);
-        else
-            put_le32(pb, 0);
-        put_le32(pb, -1); /* quality */
-        put_le32(pb, au_ssize); /* sample size */
-        put_le32(pb, 0);
-        put_le16(pb, stream->width);
-        put_le16(pb, stream->height);
-        ff_end_tag(pb, strh);
-
-      if(stream->codec_type != AVMEDIA_TYPE_DATA){
-        strf = ff_start_tag(pb, "strf");
-        switch(stream->codec_type) {
-        case AVMEDIA_TYPE_SUBTITLE:
-            // XSUB subtitles behave like video tracks, other subtitles
-            // are not (yet) supported.
-            if (stream->codec_id != CODEC_ID_XSUB) break;
-        case AVMEDIA_TYPE_VIDEO:
-            ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0);
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            if (ff_put_wav_header(pb, stream) < 0) {
-                return -1;
-            }
-            break;
-        default:
-            return -1;
-        }
-        ff_end_tag(pb, strf);
-        if ((t = av_metadata_get(s->streams[i]->metadata, "strn", NULL, 0))) {
-            avi_write_info_tag(s->pb, t->key, t->value);
-            t = NULL;
-        }
-        //FIXME a limitation of metadata conversion system
-        else if ((t = av_metadata_get(s->streams[i]->metadata, "INAM", NULL, 0))) {
-            avi_write_info_tag(s->pb, "strn", t->value);
-            t = NULL;
-        }
-      }
-
-        if (!url_is_streamed(pb)) {
-            unsigned char tag[5];
-            int j;
-
-            /* Starting to lay out AVI OpenDML master index.
-             * We want to make it JUNK entry for now, since we'd
-             * like to get away without making AVI an OpenDML one
-             * for compatibility reasons.
-             */
-            avist->indexes.entry = avist->indexes.ents_allocated = 0;
-            avist->indexes.indx_start = ff_start_tag(pb, "JUNK");
-            put_le16(pb, 4);        /* wLongsPerEntry */
-            put_byte(pb, 0);        /* bIndexSubType (0 == frame index) */
-            put_byte(pb, 0);        /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
-            put_le32(pb, 0);        /* nEntriesInUse (will fill out later on) */
-            put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
-                                    /* dwChunkId */
-            put_le64(pb, 0);        /* dwReserved[3]
-            put_le32(pb, 0);           Must be 0.    */
-            for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++)
-                 put_le64(pb, 0);
-            ff_end_tag(pb, avist->indexes.indx_start);
-        }
-
-        if(   stream->codec_type == AVMEDIA_TYPE_VIDEO
-           && s->streams[i]->sample_aspect_ratio.num>0
-           && s->streams[i]->sample_aspect_ratio.den>0){
-            int vprp= ff_start_tag(pb, "vprp");
-            AVRational dar = av_mul_q(s->streams[i]->sample_aspect_ratio,
-                                      (AVRational){stream->width, stream->height});
-            int num, den;
-            av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
-
-            put_le32(pb, 0); //video format  = unknown
-            put_le32(pb, 0); //video standard= unknown
-            put_le32(pb, lrintf(1.0/av_q2d(stream->time_base)));
-            put_le32(pb, stream->width );
-            put_le32(pb, stream->height);
-            put_le16(pb, den);
-            put_le16(pb, num);
-            put_le32(pb, stream->width );
-            put_le32(pb, stream->height);
-            put_le32(pb, 1); //progressive FIXME
-
-            put_le32(pb, stream->height);
-            put_le32(pb, stream->width );
-            put_le32(pb, stream->height);
-            put_le32(pb, stream->width );
-            put_le32(pb, 0);
-            put_le32(pb, 0);
-
-            put_le32(pb, 0);
-            put_le32(pb, 0);
-            ff_end_tag(pb, vprp);
-        }
-
-        ff_end_tag(pb, list2);
-    }
-
-    if (!url_is_streamed(pb)) {
-        /* AVI could become an OpenDML one, if it grows beyond 2Gb range */
-        avi->odml_list = ff_start_tag(pb, "JUNK");
-        put_tag(pb, "odml");
-        put_tag(pb, "dmlh");
-        put_le32(pb, 248);
-        for (i = 0; i < 248; i+= 4)
-             put_le32(pb, 0);
-        ff_end_tag(pb, avi->odml_list);
-    }
-
-    ff_end_tag(pb, list1);
-
-    list2 = ff_start_tag(pb, "LIST");
-    put_tag(pb, "INFO");
-    for (i = 0; *ff_avi_tags[i]; i++) {
-        if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE)))
-            avi_write_info_tag(s->pb, t->key, t->value);
-    }
-    ff_end_tag(pb, list2);
-
-    /* some padding for easier tag editing */
-    list2 = ff_start_tag(pb, "JUNK");
-    for (i = 0; i < 1016; i += 4)
-        put_le32(pb, 0);
-    ff_end_tag(pb, list2);
-
-    avi->movi_list = ff_start_tag(pb, "LIST");
-    put_tag(pb, "movi");
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static int avi_write_ix(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    AVIContext *avi = s->priv_data;
-    char tag[5];
-    char ix_tag[] = "ix00";
-    int i, j;
-
-    assert(!url_is_streamed(pb));
-
-    if (avi->riff_id > AVI_MASTER_INDEX_SIZE)
-        return -1;
-
-    for (i=0;i<s->nb_streams;i++) {
-        AVIStream *avist= s->streams[i]->priv_data;
-         int64_t ix, pos;
-
-         avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
-         ix_tag[3] = '0' + i;
-
-         /* Writing AVI OpenDML leaf index chunk */
-         ix = url_ftell(pb);
-         put_tag(pb, &ix_tag[0]);     /* ix?? */
-         put_le32(pb, avist->indexes.entry * 8 + 24);
-                                      /* chunk size */
-         put_le16(pb, 2);             /* wLongsPerEntry */
-         put_byte(pb, 0);             /* bIndexSubType (0 == frame index) */
-         put_byte(pb, 1);             /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */
-         put_le32(pb, avist->indexes.entry);
-                                      /* nEntriesInUse */
-         put_tag(pb, &tag[0]);        /* dwChunkId */
-         put_le64(pb, avi->movi_list);/* qwBaseOffset */
-         put_le32(pb, 0);             /* dwReserved_3 (must be 0) */
-
-         for (j=0; j<avist->indexes.entry; j++) {
-             AVIIentry* ie = avi_get_ientry(&avist->indexes, j);
-             put_le32(pb, ie->pos + 8);
-             put_le32(pb, ((uint32_t)ie->len & ~0x80000000) |
-                          (ie->flags & 0x10 ? 0 : 0x80000000));
-         }
-         put_flush_packet(pb);
-         pos = url_ftell(pb);
-
-         /* Updating one entry in the AVI OpenDML master index */
-         url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET);
-         put_tag(pb, "indx");                 /* enabling this entry */
-         url_fskip(pb, 8);
-         put_le32(pb, avi->riff_id);          /* nEntriesInUse */
-         url_fskip(pb, 16*avi->riff_id);
-         put_le64(pb, ix);                    /* qwOffset */
-         put_le32(pb, pos - ix);              /* dwSize */
-         put_le32(pb, avist->indexes.entry); /* dwDuration */
-
-         url_fseek(pb, pos, SEEK_SET);
-    }
-    return 0;
-}
-
-static int avi_write_idx1(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    AVIContext *avi = s->priv_data;
-    int64_t idx_chunk;
-    int i;
-    char tag[5];
-
-    if (!url_is_streamed(pb)) {
-        AVIStream *avist;
-        AVIIentry* ie = 0, *tie;
-        int empty, stream_id = -1;
-
-        idx_chunk = ff_start_tag(pb, "idx1");
-        for(i=0; i<s->nb_streams; i++){
-            avist= s->streams[i]->priv_data;
-            avist->entry=0;
-        }
-
-        do {
-            empty = 1;
-            for (i=0; i<s->nb_streams; i++) {
-                avist= s->streams[i]->priv_data;
-                 if (avist->indexes.entry <= avist->entry)
-                     continue;
-
-                 tie = avi_get_ientry(&avist->indexes, avist->entry);
-                 if (empty || tie->pos < ie->pos) {
-                     ie = tie;
-                     stream_id = i;
-                 }
-                 empty = 0;
-            }
-            if (!empty) {
-                avist= s->streams[stream_id]->priv_data;
-                avi_stream2fourcc(&tag[0], stream_id,
-                                  s->streams[stream_id]->codec->codec_type);
-                put_tag(pb, &tag[0]);
-                put_le32(pb, ie->flags);
-                put_le32(pb, ie->pos);
-                put_le32(pb, ie->len);
-                avist->entry++;
-            }
-        } while (!empty);
-        ff_end_tag(pb, idx_chunk);
-
-        avi_write_counters(s, avi->riff_id);
-    }
-    return 0;
-}
-
-static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned char tag[5];
-    unsigned int flags=0;
-    const int stream_index= pkt->stream_index;
-    AVIStream *avist= s->streams[stream_index]->priv_data;
-    AVCodecContext *enc= s->streams[stream_index]->codec;
-    int size= pkt->size;
-
-//    av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index);
-    while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count){
-        AVPacket empty_packet;
-
-        av_init_packet(&empty_packet);
-        empty_packet.size= 0;
-        empty_packet.data= NULL;
-        empty_packet.stream_index= stream_index;
-        avi_write_packet(s, &empty_packet);
-//        av_log(s, AV_LOG_DEBUG, "dup %"PRId64" %d\n", pkt->dts, avi->packet_count[stream_index]);
-    }
-    avist->packet_count++;
-
-    // Make sure to put an OpenDML chunk when the file size exceeds the limits
-    if (!url_is_streamed(pb) &&
-        (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
-
-        avi_write_ix(s);
-        ff_end_tag(pb, avi->movi_list);
-
-        if (avi->riff_id == 1)
-            avi_write_idx1(s);
-
-        ff_end_tag(pb, avi->riff_start);
-        avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi");
-    }
-
-    avi_stream2fourcc(&tag[0], stream_index, enc->codec_type);
-    if(pkt->flags&AV_PKT_FLAG_KEY)
-        flags = 0x10;
-    if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-       avist->audio_strm_length += size;
-    }
-
-    if (!url_is_streamed(s->pb)) {
-        AVIIndex* idx = &avist->indexes;
-        int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE;
-        int id = idx->entry % AVI_INDEX_CLUSTER_SIZE;
-        if (idx->ents_allocated <= idx->entry) {
-            idx->cluster = av_realloc(idx->cluster, (cl+1)*sizeof(void*));
-            if (!idx->cluster)
-                return -1;
-            idx->cluster[cl] = av_malloc(AVI_INDEX_CLUSTER_SIZE*sizeof(AVIIentry));
-            if (!idx->cluster[cl])
-                return -1;
-            idx->ents_allocated += AVI_INDEX_CLUSTER_SIZE;
-        }
-
-        idx->cluster[cl][id].flags = flags;
-        idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
-        idx->cluster[cl][id].len = size;
-        idx->entry++;
-    }
-
-    put_buffer(pb, tag, 4);
-    put_le32(pb, size);
-    put_buffer(pb, pkt->data, size);
-    if (size & 1)
-        put_byte(pb, 0);
-
-    put_flush_packet(pb);
-    return 0;
-}
-
-static int avi_write_trailer(AVFormatContext *s)
-{
-    AVIContext *avi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int res = 0;
-    int i, j, n, nb_frames;
-    int64_t file_size;
-
-    if (!url_is_streamed(pb)){
-        if (avi->riff_id == 1) {
-            ff_end_tag(pb, avi->movi_list);
-            res = avi_write_idx1(s);
-            ff_end_tag(pb, avi->riff_start);
-        } else {
-            avi_write_ix(s);
-            ff_end_tag(pb, avi->movi_list);
-            ff_end_tag(pb, avi->riff_start);
-
-            file_size = url_ftell(pb);
-            url_fseek(pb, avi->odml_list - 8, SEEK_SET);
-            put_tag(pb, "LIST"); /* Making this AVI OpenDML one */
-            url_fskip(pb, 16);
-
-            for (n=nb_frames=0;n<s->nb_streams;n++) {
-                AVCodecContext *stream = s->streams[n]->codec;
-                AVIStream *avist= s->streams[n]->priv_data;
-
-                if (stream->codec_type == AVMEDIA_TYPE_VIDEO) {
-                    if (nb_frames < avist->packet_count)
-                        nb_frames = avist->packet_count;
-                } else {
-                    if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) {
-                        nb_frames += avist->packet_count;
-                    }
-                }
-            }
-            put_le32(pb, nb_frames);
-            url_fseek(pb, file_size, SEEK_SET);
-
-            avi_write_counters(s, avi->riff_id);
-        }
-    }
-    put_flush_packet(pb);
-
-    for (i=0; i<s->nb_streams; i++) {
-         AVIStream *avist= s->streams[i]->priv_data;
-         for (j=0; j<avist->indexes.ents_allocated/AVI_INDEX_CLUSTER_SIZE; j++)
-              av_free(avist->indexes.cluster[j]);
-         av_freep(&avist->indexes.cluster);
-         avist->indexes.ents_allocated = avist->indexes.entry = 0;
-    }
-
-    return res;
-}
-
-AVOutputFormat avi_muxer = {
-    "avi",
-    NULL_IF_CONFIG_SMALL("AVI format"),
-    "video/x-msvideo",
-    "avi",
-    sizeof(AVIContext),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG4,
-    avi_write_header,
-    avi_write_packet,
-    avi_write_trailer,
-    .codec_tag= (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
-    .flags= AVFMT_VARIABLE_FPS,
-    .metadata_conv = ff_avi_metadata_conv,
-};
diff --git a/libavformat/avio.c b/libavformat/avio.c
deleted file mode 100644
index 48399d0..0000000
--- a/libavformat/avio.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Unbuffered io for ffmpeg system
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* needed for usleep() */
-#define _XOPEN_SOURCE 600
-#include <unistd.h>
-#include "libavutil/avstring.h"
-#include "libavcodec/opt.h"
-#include "os_support.h"
-#include "avformat.h"
-#if CONFIG_NETWORK
-#include "network.h"
-#endif
-
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
-/** @name Logging context. */
-/*@{*/
-static const char *urlcontext_to_name(void *ptr)
-{
-    URLContext *h = (URLContext *)ptr;
-    if(h->prot) return h->prot->name;
-    else        return "NULL";
-}
-static const AVOption options[] = {{NULL}};
-static const AVClass urlcontext_class =
-        { "URLContext", urlcontext_to_name, options, LIBAVUTIL_VERSION_INT };
-/*@}*/
-#endif
-
-static int default_interrupt_cb(void);
-
-URLProtocol *first_protocol = NULL;
-URLInterruptCB *url_interrupt_cb = default_interrupt_cb;
-
-URLProtocol *av_protocol_next(URLProtocol *p)
-{
-    if(p) return p->next;
-    else  return first_protocol;
-}
-
-int av_register_protocol(URLProtocol *protocol)
-{
-    URLProtocol **p;
-    p = &first_protocol;
-    while (*p != NULL) p = &(*p)->next;
-    *p = protocol;
-    protocol->next = NULL;
-    return 0;
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-int register_protocol(URLProtocol *protocol)
-{
-    return av_register_protocol(protocol);
-}
-#endif
-
-int url_open_protocol (URLContext **puc, struct URLProtocol *up,
-                       const char *filename, int flags)
-{
-    URLContext *uc;
-    int err;
-
-#if CONFIG_NETWORK
-    if (!ff_network_init())
-        return AVERROR(EIO);
-#endif
-    uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1);
-    if (!uc) {
-        err = AVERROR(ENOMEM);
-        goto fail;
-    }
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
-    uc->av_class = &urlcontext_class;
-#endif
-    uc->filename = (char *) &uc[1];
-    strcpy(uc->filename, filename);
-    uc->prot = up;
-    uc->flags = flags;
-    uc->is_streamed = 0; /* default = not streamed */
-    uc->max_packet_size = 0; /* default: stream file */
-    err = up->url_open(uc, filename, flags);
-    if (err < 0) {
-        av_free(uc);
-        goto fail;
-    }
-
-    //We must be careful here as url_seek() could be slow, for example for http
-    if(   (flags & (URL_WRONLY | URL_RDWR))
-       || !strcmp(up->name, "file"))
-        if(!uc->is_streamed && url_seek(uc, 0, SEEK_SET) < 0)
-            uc->is_streamed= 1;
-    *puc = uc;
-    return 0;
- fail:
-    *puc = NULL;
-#if CONFIG_NETWORK
-    ff_network_close();
-#endif
-    return err;
-}
-
-int url_open(URLContext **puc, const char *filename, int flags)
-{
-    URLProtocol *up;
-    const char *p;
-    char proto_str[128], *q;
-
-    p = filename;
-    q = proto_str;
-    while (*p != '\0' && *p != ':') {
-        /* protocols can only contain alphabetic chars */
-        if (!isalpha(*p))
-            goto file_proto;
-        if ((q - proto_str) < sizeof(proto_str) - 1)
-            *q++ = *p;
-        p++;
-    }
-    /* if the protocol has length 1, we consider it is a dos drive */
-    if (*p == '\0' || is_dos_path(filename)) {
-    file_proto:
-        strcpy(proto_str, "file");
-    } else {
-        *q = '\0';
-    }
-
-    up = first_protocol;
-    while (up != NULL) {
-        if (!strcmp(proto_str, up->name))
-            return url_open_protocol (puc, up, filename, flags);
-        up = up->next;
-    }
-    *puc = NULL;
-    return AVERROR(ENOENT);
-}
-
-int url_read(URLContext *h, unsigned char *buf, int size)
-{
-    int ret;
-    if (h->flags & URL_WRONLY)
-        return AVERROR(EIO);
-    ret = h->prot->url_read(h, buf, size);
-    return ret;
-}
-
-int url_read_complete(URLContext *h, unsigned char *buf, int size)
-{
-    int ret, len;
-    int fast_retries = 5;
-
-    len = 0;
-    while (len < size) {
-        ret = url_read(h, buf+len, size-len);
-        if (ret == AVERROR(EAGAIN)) {
-            ret = 0;
-            if (fast_retries)
-                fast_retries--;
-            else
-                usleep(1000);
-        } else if (ret < 1)
-            return ret < 0 ? ret : len;
-        if (ret)
-           fast_retries = FFMAX(fast_retries, 2);
-        len += ret;
-    }
-    return len;
-}
-
-int url_write(URLContext *h, unsigned char *buf, int size)
-{
-    int ret;
-    if (!(h->flags & (URL_WRONLY | URL_RDWR)))
-        return AVERROR(EIO);
-    /* avoid sending too big packets */
-    if (h->max_packet_size && size > h->max_packet_size)
-        return AVERROR(EIO);
-    ret = h->prot->url_write(h, buf, size);
-    return ret;
-}
-
-int64_t url_seek(URLContext *h, int64_t pos, int whence)
-{
-    int64_t ret;
-
-    if (!h->prot->url_seek)
-        return AVERROR(ENOSYS);
-    ret = h->prot->url_seek(h, pos, whence & ~AVSEEK_FORCE);
-    return ret;
-}
-
-int url_close(URLContext *h)
-{
-    int ret = 0;
-    if (!h) return 0; /* can happen when url_open fails */
-
-    if (h->prot->url_close)
-        ret = h->prot->url_close(h);
-#if CONFIG_NETWORK
-    ff_network_close();
-#endif
-    av_free(h);
-    return ret;
-}
-
-int url_exist(const char *filename)
-{
-    URLContext *h;
-    if (url_open(&h, filename, URL_RDONLY) < 0)
-        return 0;
-    url_close(h);
-    return 1;
-}
-
-int64_t url_filesize(URLContext *h)
-{
-    int64_t pos, size;
-
-    size= url_seek(h, 0, AVSEEK_SIZE);
-    if(size<0){
-        pos = url_seek(h, 0, SEEK_CUR);
-        if ((size = url_seek(h, -1, SEEK_END)) < 0)
-            return size;
-        size++;
-        url_seek(h, pos, SEEK_SET);
-    }
-    return size;
-}
-
-int url_get_file_handle(URLContext *h)
-{
-    if (!h->prot->url_get_file_handle)
-        return -1;
-    return h->prot->url_get_file_handle(h);
-}
-
-int url_get_max_packet_size(URLContext *h)
-{
-    return h->max_packet_size;
-}
-
-void url_get_filename(URLContext *h, char *buf, int buf_size)
-{
-    av_strlcpy(buf, h->filename, buf_size);
-}
-
-
-static int default_interrupt_cb(void)
-{
-    return 0;
-}
-
-void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
-{
-    if (!interrupt_cb)
-        interrupt_cb = default_interrupt_cb;
-    url_interrupt_cb = interrupt_cb;
-}
-
-int av_url_read_pause(URLContext *h, int pause)
-{
-    if (!h->prot->url_read_pause)
-        return AVERROR(ENOSYS);
-    return h->prot->url_read_pause(h, pause);
-}
-
-int64_t av_url_read_seek(URLContext *h,
-        int stream_index, int64_t timestamp, int flags)
-{
-    if (!h->prot->url_read_seek)
-        return AVERROR(ENOSYS);
-    return h->prot->url_read_seek(h, stream_index, timestamp, flags);
-}
diff --git a/libavformat/avio.h b/libavformat/avio.h
deleted file mode 100644
index 9ffe935..0000000
--- a/libavformat/avio.h
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVFORMAT_AVIO_H
-#define AVFORMAT_AVIO_H
-
-/**
- * @file
- * unbuffered I/O operations
- *
- * @warning This file has to be considered an internal but installed
- * header, so it should not be directly included in your projects.
- */
-
-#include <stdint.h>
-
-#include "libavutil/common.h"
-
-/* unbuffered I/O */
-
-/**
- * URL Context.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(URLContext) must not be used outside libav*.
- */
-typedef struct URLContext {
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
-    const AVClass *av_class; ///< information for av_log(). Set by url_open().
-#endif
-    struct URLProtocol *prot;
-    int flags;
-    int is_streamed;  /**< true if streamed (no seek possible), default = false */
-    int max_packet_size;  /**< if non zero, the stream is packetized with this max packet size */
-    void *priv_data;
-    char *filename; /**< specified URL */
-} URLContext;
-
-typedef struct URLPollEntry {
-    URLContext *handle;
-    int events;
-    int revents;
-} URLPollEntry;
-
-#define URL_RDONLY 0
-#define URL_WRONLY 1
-#define URL_RDWR   2
-
-typedef int URLInterruptCB(void);
-
-/**
- * Creates an URLContext for accessing to the resource indicated by
- * url, and opens it using the URLProtocol up.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int url_open_protocol (URLContext **puc, struct URLProtocol *up,
-                       const char *url, int flags);
-
-/**
- * Creates an URLContext for accessing to the resource indicated by
- * url, and opens it.
- *
- * @param puc pointer to the location where, in case of success, the
- * function puts the pointer to the created URLContext
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int url_open(URLContext **h, const char *url, int flags);
-
-/**
- * Reads up to size bytes from the resource accessed by h, and stores
- * the read bytes in buf.
- *
- * @return The number of bytes actually read, or a negative value
- * corresponding to an AVERROR code in case of error. A value of zero
- * indicates that it is not possible to read more from the accessed
- * resource (except if the value of the size argument is also zero).
- */
-int url_read(URLContext *h, unsigned char *buf, int size);
-
-/**
- * Read as many bytes as possible (up to size), calling the
- * read function multiple times if necessary.
- * Will also retry if the read function returns AVERROR(EAGAIN).
- * This makes special short-read handling in applications
- * unnecessary, if the return value is < size then it is
- * certain there was either an error or the end of file was reached.
- */
-int url_read_complete(URLContext *h, unsigned char *buf, int size);
-int url_write(URLContext *h, unsigned char *buf, int size);
-
-/**
- * Changes the position that will be used by the next read/write
- * operation on the resource accessed by h.
- *
- * @param pos specifies the new position to set
- * @param whence specifies how pos should be interpreted, it must be
- * one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the
- * current position), SEEK_END (seek from the end), or AVSEEK_SIZE
- * (return the filesize of the requested resource, pos is ignored).
- * @return a negative value corresponding to an AVERROR code in case
- * of failure, or the resulting file position, measured in bytes from
- * the beginning of the file. You can use this feature together with
- * SEEK_CUR to read the current file position.
- */
-int64_t url_seek(URLContext *h, int64_t pos, int whence);
-
-/**
- * Closes the resource accessed by the URLContext h, and frees the
- * memory used by it.
- *
- * @return a negative value if an error condition occurred, 0
- * otherwise
- */
-int url_close(URLContext *h);
-
-/**
- * Returns a non-zero value if the resource indicated by url
- * exists, 0 otherwise.
- */
-int url_exist(const char *url);
-
-int64_t url_filesize(URLContext *h);
-
-/**
- * Return the file descriptor associated with this URL. For RTP, this
- * will return only the RTP file descriptor, not the RTCP file descriptor.
- * To get both, use rtp_get_file_handles().
- *
- * @return the file descriptor associated with this URL, or <0 on error.
- */
-int url_get_file_handle(URLContext *h);
-
-/**
- * Return the maximum packet size associated to packetized file
- * handle. If the file is not packetized (stream like HTTP or file on
- * disk), then 0 is returned.
- *
- * @param h file handle
- * @return maximum packet size in bytes
- */
-int url_get_max_packet_size(URLContext *h);
-void url_get_filename(URLContext *h, char *buf, int buf_size);
-
-/**
- * The callback is called in blocking functions to test regulary if
- * asynchronous interruption is needed. AVERROR(EINTR) is returned
- * in this case by the interrupted function. 'NULL' means no interrupt
- * callback is given.
- */
-void url_set_interrupt_cb(URLInterruptCB *interrupt_cb);
-
-/* not implemented */
-int url_poll(URLPollEntry *poll_table, int n, int timeout);
-
-/**
- * Pause and resume playing - only meaningful if using a network streaming
- * protocol (e.g. MMS).
- * @param pause 1 for pause, 0 for resume
- */
-int av_url_read_pause(URLContext *h, int pause);
-
-/**
- * Seek to a given timestamp relative to some component stream.
- * Only meaningful if using a network streaming protocol (e.g. MMS.).
- * @param stream_index The stream index that the timestamp is relative to.
- *        If stream_index is (-1) the timestamp should be in AV_TIME_BASE
- *        units from the beginning of the presentation.
- *        If a stream_index >= 0 is used and the protocol does not support
- *        seeking based on component streams, the call will fail with ENOTSUP.
- * @param timestamp timestamp in AVStream.time_base units
- *        or if there is no stream specified then in AV_TIME_BASE units.
- * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE
- *        and AVSEEK_FLAG_ANY. The protocol may silently ignore
- *        AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will
- *        fail with ENOTSUP if used and not supported.
- * @return >= 0 on success
- * @see AVInputFormat::read_seek
- */
-int64_t av_url_read_seek(URLContext *h, int stream_index,
-                         int64_t timestamp, int flags);
-
-/**
- * Passing this as the "whence" parameter to a seek function causes it to
- * return the filesize without seeking anywhere. Supporting this is optional.
- * If it is not supported then the seek function will return <0.
- */
-#define AVSEEK_SIZE 0x10000
-
-/**
- * Oring this flag as into the "whence" parameter to a seek function causes it to
- * seek by any means (like reopening and linear reading) or other normally unreasonble
- * means that can be extreemly slow.
- * This may be ignored by the seek code.
- */
-#define AVSEEK_FORCE 0x20000
-
-typedef struct URLProtocol {
-    const char *name;
-    int (*url_open)(URLContext *h, const char *url, int flags);
-    int (*url_read)(URLContext *h, unsigned char *buf, int size);
-    int (*url_write)(URLContext *h, unsigned char *buf, int size);
-    int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
-    int (*url_close)(URLContext *h);
-    struct URLProtocol *next;
-    int (*url_read_pause)(URLContext *h, int pause);
-    int64_t (*url_read_seek)(URLContext *h, int stream_index,
-                             int64_t timestamp, int flags);
-    int (*url_get_file_handle)(URLContext *h);
-} URLProtocol;
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-extern URLProtocol *first_protocol;
-#endif
-
-extern URLInterruptCB *url_interrupt_cb;
-
-/**
- * If protocol is NULL, returns the first registered protocol,
- * if protocol is non-NULL, returns the next registered protocol after protocol,
- * or NULL if protocol is the last one.
- */
-URLProtocol *av_protocol_next(URLProtocol *p);
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-/**
- * @deprecated Use av_register_protocol() instead.
- */
-attribute_deprecated int register_protocol(URLProtocol *protocol);
-#endif
-
-/**
- * Registers the URLProtocol protocol.
- */
-int av_register_protocol(URLProtocol *protocol);
-
-/**
- * Bytestream IO Context.
- * New fields can be added to the end with minor version bumps.
- * Removal, reordering and changes to existing fields require a major
- * version bump.
- * sizeof(ByteIOContext) must not be used outside libav*.
- */
-typedef struct {
-    unsigned char *buffer;
-    int buffer_size;
-    unsigned char *buf_ptr, *buf_end;
-    void *opaque;
-    int (*read_packet)(void *opaque, uint8_t *buf, int buf_size);
-    int (*write_packet)(void *opaque, uint8_t *buf, int buf_size);
-    int64_t (*seek)(void *opaque, int64_t offset, int whence);
-    int64_t pos; /**< position in the file of the current buffer */
-    int must_flush; /**< true if the next seek should flush */
-    int eof_reached; /**< true if eof reached */
-    int write_flag;  /**< true if open for writing */
-    int is_streamed;
-    int max_packet_size;
-    unsigned long checksum;
-    unsigned char *checksum_ptr;
-    unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size);
-    int error;         ///< contains the error code or 0 if no error happened
-    int (*read_pause)(void *opaque, int pause);
-    int64_t (*read_seek)(void *opaque, int stream_index,
-                         int64_t timestamp, int flags);
-} ByteIOContext;
-
-int init_put_byte(ByteIOContext *s,
-                  unsigned char *buffer,
-                  int buffer_size,
-                  int write_flag,
-                  void *opaque,
-                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
-ByteIOContext *av_alloc_put_byte(
-                  unsigned char *buffer,
-                  int buffer_size,
-                  int write_flag,
-                  void *opaque,
-                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int64_t (*seek)(void *opaque, int64_t offset, int whence));
-
-void put_byte(ByteIOContext *s, int b);
-void put_buffer(ByteIOContext *s, const unsigned char *buf, int size);
-void put_le64(ByteIOContext *s, uint64_t val);
-void put_be64(ByteIOContext *s, uint64_t val);
-void put_le32(ByteIOContext *s, unsigned int val);
-void put_be32(ByteIOContext *s, unsigned int val);
-void put_le24(ByteIOContext *s, unsigned int val);
-void put_be24(ByteIOContext *s, unsigned int val);
-void put_le16(ByteIOContext *s, unsigned int val);
-void put_be16(ByteIOContext *s, unsigned int val);
-void put_tag(ByteIOContext *s, const char *tag);
-
-void put_strz(ByteIOContext *s, const char *buf);
-
-/**
- * fseek() equivalent for ByteIOContext.
- * @return new position or AVERROR.
- */
-int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence);
-
-/**
- * Skip given number of bytes forward.
- * @param offset number of bytes
- */
-void url_fskip(ByteIOContext *s, int64_t offset);
-
-/**
- * ftell() equivalent for ByteIOContext.
- * @return position or AVERROR.
- */
-int64_t url_ftell(ByteIOContext *s);
-
-/**
- * Gets the filesize.
- * @return filesize or AVERROR
- */
-int64_t url_fsize(ByteIOContext *s);
-
-/**
- * feof() equivalent for ByteIOContext.
- * @return non zero if and only if end of file
- */
-int url_feof(ByteIOContext *s);
-
-int url_ferror(ByteIOContext *s);
-
-int av_url_read_fpause(ByteIOContext *h, int pause);
-int64_t av_url_read_fseek(ByteIOContext *h, int stream_index,
-                          int64_t timestamp, int flags);
-
-#define URL_EOF (-1)
-/** @note return URL_EOF (-1) if EOF */
-int url_fgetc(ByteIOContext *s);
-
-/** @warning currently size is limited */
-#ifdef __GNUC__
-int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
-#else
-int url_fprintf(ByteIOContext *s, const char *fmt, ...);
-#endif
-
-/** @note unlike fgets, the EOL character is not returned and a whole
-    line is parsed. return NULL if first char read was EOF */
-char *url_fgets(ByteIOContext *s, char *buf, int buf_size);
-
-void put_flush_packet(ByteIOContext *s);
-
-
-/**
- * Reads size bytes from ByteIOContext into buf.
- * @return number of bytes read or AVERROR
- */
-int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
-
-/**
- * Reads size bytes from ByteIOContext into buf.
- * This reads at most 1 packet. If that is not enough fewer bytes will be
- * returned.
- * @return number of bytes read or AVERROR
- */
-int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size);
-
-/** @note return 0 if EOF, so you cannot use it if EOF handling is
-    necessary */
-int get_byte(ByteIOContext *s);
-unsigned int get_le24(ByteIOContext *s);
-unsigned int get_le32(ByteIOContext *s);
-uint64_t get_le64(ByteIOContext *s);
-unsigned int get_le16(ByteIOContext *s);
-
-char *get_strz(ByteIOContext *s, char *buf, int maxlen);
-unsigned int get_be16(ByteIOContext *s);
-unsigned int get_be24(ByteIOContext *s);
-unsigned int get_be32(ByteIOContext *s);
-uint64_t get_be64(ByteIOContext *s);
-
-uint64_t ff_get_v(ByteIOContext *bc);
-
-static inline int url_is_streamed(ByteIOContext *s)
-{
-    return s->is_streamed;
-}
-
-/**
- * Creates and initializes a ByteIOContext for accessing the
- * resource referenced by the URLContext h.
- * @note When the URLContext h has been opened in read+write mode, the
- * ByteIOContext can be used only for writing.
- *
- * @param s Used to return the pointer to the created ByteIOContext.
- * In case of failure the pointed to value is set to NULL.
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int url_fdopen(ByteIOContext **s, URLContext *h);
-
-/** @warning must be called before any I/O */
-int url_setbufsize(ByteIOContext *s, int buf_size);
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-/** Reset the buffer for reading or writing.
- * @note Will drop any data currently in the buffer without transmitting it.
- * @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
- *        to set up the buffer for writing. */
-int url_resetbuf(ByteIOContext *s, int flags);
-#endif
-
-/**
- * Rewinds the ByteIOContext using the specified buffer containing the first buf_size bytes of the file.
- * Used after probing to avoid seeking.
- * Joins buf and s->buffer, taking any overlap into consideration.
- * @note s->buffer must overlap with buf or they can't be joined and the function fails
- * @note This function is NOT part of the public API
- *
- * @param s The read-only ByteIOContext to rewind
- * @param buf The probe buffer containing the first buf_size bytes of the file
- * @param buf_size The size of buf
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size);
-
-/**
- * Creates and initializes a ByteIOContext for accessing the
- * resource indicated by url.
- * @note When the resource indicated by url has been opened in
- * read+write mode, the ByteIOContext can be used only for writing.
- *
- * @param s Used to return the pointer to the created ByteIOContext.
- * In case of failure the pointed to value is set to NULL.
- * @param flags flags which control how the resource indicated by url
- * is to be opened
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code in case of failure
- */
-int url_fopen(ByteIOContext **s, const char *url, int flags);
-
-int url_fclose(ByteIOContext *s);
-URLContext *url_fileno(ByteIOContext *s);
-
-/**
- * Return the maximum packet size associated to packetized buffered file
- * handle. If the file is not packetized (stream like http or file on
- * disk), then 0 is returned.
- *
- * @param s buffered file handle
- * @return maximum packet size in bytes
- */
-int url_fget_max_packet_size(ByteIOContext *s);
-
-int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags);
-
-/** return the written or read size */
-int url_close_buf(ByteIOContext *s);
-
-/**
- * Open a write only memory stream.
- *
- * @param s new IO context
- * @return zero if no error.
- */
-int url_open_dyn_buf(ByteIOContext **s);
-
-/**
- * Open a write only packetized memory stream with a maximum packet
- * size of 'max_packet_size'.  The stream is stored in a memory buffer
- * with a big endian 4 byte header giving the packet size in bytes.
- *
- * @param s new IO context
- * @param max_packet_size maximum packet size (must be > 0)
- * @return zero if no error.
- */
-int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size);
-
-/**
- * Return the written size and a pointer to the buffer. The buffer
- *  must be freed with av_free().
- * @param s IO context
- * @param pbuffer pointer to a byte buffer
- * @return the length of the byte buffer
- */
-int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer);
-
-unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
-                                    unsigned int len);
-unsigned long get_checksum(ByteIOContext *s);
-void init_checksum(ByteIOContext *s,
-                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
-                   unsigned long checksum);
-
-/* udp.c */
-int udp_set_remote_url(URLContext *h, const char *uri);
-int udp_get_local_port(URLContext *h);
-#if (LIBAVFORMAT_VERSION_MAJOR <= 52)
-int udp_get_file_handle(URLContext *h);
-#endif
-
-#endif /* AVFORMAT_AVIO_H */
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
deleted file mode 100644
index 2a2fb78..0000000
--- a/libavformat/aviobuf.c
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- * Buffered I/O for ffmpeg system
- * Copyright (c) 2000,2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/crc.h"
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "avio.h"
-#include <stdarg.h>
-
-#define IO_BUFFER_SIZE 32768
-
-/**
- * Do seeks within this distance ahead of the current buffer by skipping
- * data instead of calling the protocol seek function, for seekable
- * protocols.
- */
-#define SHORT_SEEK_THRESHOLD 4096
-
-static void fill_buffer(ByteIOContext *s);
-#if LIBAVFORMAT_VERSION_MAJOR >= 53
-static int url_resetbuf(ByteIOContext *s, int flags);
-#endif
-
-int init_put_byte(ByteIOContext *s,
-                  unsigned char *buffer,
-                  int buffer_size,
-                  int write_flag,
-                  void *opaque,
-                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
-{
-    s->buffer = buffer;
-    s->buffer_size = buffer_size;
-    s->buf_ptr = buffer;
-    s->opaque = opaque;
-    url_resetbuf(s, write_flag ? URL_WRONLY : URL_RDONLY);
-    s->write_packet = write_packet;
-    s->read_packet = read_packet;
-    s->seek = seek;
-    s->pos = 0;
-    s->must_flush = 0;
-    s->eof_reached = 0;
-    s->error = 0;
-    s->is_streamed = 0;
-    s->max_packet_size = 0;
-    s->update_checksum= NULL;
-    if(!read_packet && !write_flag){
-        s->pos = buffer_size;
-        s->buf_end = s->buffer + buffer_size;
-    }
-    s->read_pause = NULL;
-    s->read_seek  = NULL;
-    return 0;
-}
-
-ByteIOContext *av_alloc_put_byte(
-                  unsigned char *buffer,
-                  int buffer_size,
-                  int write_flag,
-                  void *opaque,
-                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
-                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
-{
-    ByteIOContext *s = av_mallocz(sizeof(ByteIOContext));
-    init_put_byte(s, buffer, buffer_size, write_flag, opaque,
-                  read_packet, write_packet, seek);
-    return s;
-}
-
-static void flush_buffer(ByteIOContext *s)
-{
-    if (s->buf_ptr > s->buffer) {
-        if (s->write_packet && !s->error){
-            int ret= s->write_packet(s->opaque, s->buffer, s->buf_ptr - s->buffer);
-            if(ret < 0){
-                s->error = ret;
-            }
-        }
-        if(s->update_checksum){
-            s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
-            s->checksum_ptr= s->buffer;
-        }
-        s->pos += s->buf_ptr - s->buffer;
-    }
-    s->buf_ptr = s->buffer;
-}
-
-void put_byte(ByteIOContext *s, int b)
-{
-    *(s->buf_ptr)++ = b;
-    if (s->buf_ptr >= s->buf_end)
-        flush_buffer(s);
-}
-
-void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)
-{
-    while (size > 0) {
-        int len = FFMIN(s->buf_end - s->buf_ptr, size);
-        memcpy(s->buf_ptr, buf, len);
-        s->buf_ptr += len;
-
-        if (s->buf_ptr >= s->buf_end)
-            flush_buffer(s);
-
-        buf += len;
-        size -= len;
-    }
-}
-
-void put_flush_packet(ByteIOContext *s)
-{
-    flush_buffer(s);
-    s->must_flush = 0;
-}
-
-int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
-{
-    int64_t offset1;
-    int64_t pos;
-    int force = whence & AVSEEK_FORCE;
-    whence &= ~AVSEEK_FORCE;
-
-    if(!s)
-        return AVERROR(EINVAL);
-
-    pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
-
-    if (whence != SEEK_CUR && whence != SEEK_SET)
-        return AVERROR(EINVAL);
-
-    if (whence == SEEK_CUR) {
-        offset1 = pos + (s->buf_ptr - s->buffer);
-        if (offset == 0)
-            return offset1;
-        offset += offset1;
-    }
-    offset1 = offset - pos;
-    if (!s->must_flush &&
-        offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
-        /* can do the seek inside the buffer */
-        s->buf_ptr = s->buffer + offset1;
-    } else if ((s->is_streamed ||
-               offset1 <= s->buf_end + SHORT_SEEK_THRESHOLD - s->buffer) &&
-               !s->write_flag && offset1 >= 0 &&
-              (whence != SEEK_END || force)) {
-        while(s->pos < offset && !s->eof_reached)
-            fill_buffer(s);
-        if (s->eof_reached)
-            return AVERROR_EOF;
-        s->buf_ptr = s->buf_end + offset - s->pos;
-    } else {
-        int64_t res;
-
-#if CONFIG_MUXERS || CONFIG_NETWORK
-        if (s->write_flag) {
-            flush_buffer(s);
-            s->must_flush = 1;
-        }
-#endif /* CONFIG_MUXERS || CONFIG_NETWORK */
-        if (!s->seek)
-            return AVERROR(EPIPE);
-        if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0)
-            return res;
-        if (!s->write_flag)
-            s->buf_end = s->buffer;
-        s->buf_ptr = s->buffer;
-        s->pos = offset;
-    }
-    s->eof_reached = 0;
-    return offset;
-}
-
-void url_fskip(ByteIOContext *s, int64_t offset)
-{
-    url_fseek(s, offset, SEEK_CUR);
-}
-
-int64_t url_ftell(ByteIOContext *s)
-{
-    return url_fseek(s, 0, SEEK_CUR);
-}
-
-int64_t url_fsize(ByteIOContext *s)
-{
-    int64_t size;
-
-    if(!s)
-        return AVERROR(EINVAL);
-
-    if (!s->seek)
-        return AVERROR(ENOSYS);
-    size = s->seek(s->opaque, 0, AVSEEK_SIZE);
-    if(size<0){
-        if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
-            return size;
-        size++;
-        s->seek(s->opaque, s->pos, SEEK_SET);
-    }
-    return size;
-}
-
-int url_feof(ByteIOContext *s)
-{
-    if(!s)
-        return 0;
-    return s->eof_reached;
-}
-
-int url_ferror(ByteIOContext *s)
-{
-    if(!s)
-        return 0;
-    return s->error;
-}
-
-void put_le32(ByteIOContext *s, unsigned int val)
-{
-    put_byte(s, val);
-    put_byte(s, val >> 8);
-    put_byte(s, val >> 16);
-    put_byte(s, val >> 24);
-}
-
-void put_be32(ByteIOContext *s, unsigned int val)
-{
-    put_byte(s, val >> 24);
-    put_byte(s, val >> 16);
-    put_byte(s, val >> 8);
-    put_byte(s, val);
-}
-
-void put_strz(ByteIOContext *s, const char *str)
-{
-    if (str)
-        put_buffer(s, (const unsigned char *) str, strlen(str) + 1);
-    else
-        put_byte(s, 0);
-}
-
-void put_le64(ByteIOContext *s, uint64_t val)
-{
-    put_le32(s, (uint32_t)(val & 0xffffffff));
-    put_le32(s, (uint32_t)(val >> 32));
-}
-
-void put_be64(ByteIOContext *s, uint64_t val)
-{
-    put_be32(s, (uint32_t)(val >> 32));
-    put_be32(s, (uint32_t)(val & 0xffffffff));
-}
-
-void put_le16(ByteIOContext *s, unsigned int val)
-{
-    put_byte(s, val);
-    put_byte(s, val >> 8);
-}
-
-void put_be16(ByteIOContext *s, unsigned int val)
-{
-    put_byte(s, val >> 8);
-    put_byte(s, val);
-}
-
-void put_le24(ByteIOContext *s, unsigned int val)
-{
-    put_le16(s, val & 0xffff);
-    put_byte(s, val >> 16);
-}
-
-void put_be24(ByteIOContext *s, unsigned int val)
-{
-    put_be16(s, val >> 8);
-    put_byte(s, val);
-}
-
-void put_tag(ByteIOContext *s, const char *tag)
-{
-    while (*tag) {
-        put_byte(s, *tag++);
-    }
-}
-
-/* Input stream */
-
-static void fill_buffer(ByteIOContext *s)
-{
-    uint8_t *dst= !s->max_packet_size && s->buf_end - s->buffer < s->buffer_size ? s->buf_ptr : s->buffer;
-    int len= s->buffer_size - (dst - s->buffer);
-    int max_buffer_size = s->max_packet_size ? s->max_packet_size : IO_BUFFER_SIZE;
-
-    assert(s->buf_ptr == s->buf_end);
-
-    /* no need to do anything if EOF already reached */
-    if (s->eof_reached)
-        return;
-
-    if(s->update_checksum && dst == s->buffer){
-        if(s->buf_end > s->checksum_ptr)
-            s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_end - s->checksum_ptr);
-        s->checksum_ptr= s->buffer;
-    }
-
-    /* make buffer smaller in case it ended up large after probing */
-    if (s->buffer_size > max_buffer_size) {
-        url_setbufsize(s, max_buffer_size);
-
-        s->checksum_ptr = dst = s->buffer;
-        len = s->buffer_size;
-    }
-
-    if(s->read_packet)
-        len = s->read_packet(s->opaque, dst, len);
-    else
-        len = 0;
-    if (len <= 0) {
-        /* do not modify buffer if EOF reached so that a seek back can
-           be done without rereading data */
-        s->eof_reached = 1;
-        if(len<0)
-            s->error= len;
-    } else {
-        s->pos += len;
-        s->buf_ptr = dst;
-        s->buf_end = dst + len;
-    }
-}
-
-unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
-                                    unsigned int len)
-{
-    return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len);
-}
-
-unsigned long get_checksum(ByteIOContext *s)
-{
-    s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
-    s->update_checksum= NULL;
-    return s->checksum;
-}
-
-void init_checksum(ByteIOContext *s,
-                   unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
-                   unsigned long checksum)
-{
-    s->update_checksum= update_checksum;
-    if(s->update_checksum){
-        s->checksum= checksum;
-        s->checksum_ptr= s->buf_ptr;
-    }
-}
-
-/* XXX: put an inline version */
-int get_byte(ByteIOContext *s)
-{
-    if (s->buf_ptr < s->buf_end) {
-        return *s->buf_ptr++;
-    } else {
-        fill_buffer(s);
-        if (s->buf_ptr < s->buf_end)
-            return *s->buf_ptr++;
-        else
-            return 0;
-    }
-}
-
-int url_fgetc(ByteIOContext *s)
-{
-    if (s->buf_ptr < s->buf_end) {
-        return *s->buf_ptr++;
-    } else {
-        fill_buffer(s);
-        if (s->buf_ptr < s->buf_end)
-            return *s->buf_ptr++;
-        else
-            return URL_EOF;
-    }
-}
-
-int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
-{
-    int len, size1;
-
-    size1 = size;
-    while (size > 0) {
-        len = s->buf_end - s->buf_ptr;
-        if (len > size)
-            len = size;
-        if (len == 0) {
-            if(size > s->buffer_size && !s->update_checksum){
-                if(s->read_packet)
-                    len = s->read_packet(s->opaque, buf, size);
-                if (len <= 0) {
-                    /* do not modify buffer if EOF reached so that a seek back can
-                    be done without rereading data */
-                    s->eof_reached = 1;
-                    if(len<0)
-                        s->error= len;
-                    break;
-                } else {
-                    s->pos += len;
-                    size -= len;
-                    buf += len;
-                    s->buf_ptr = s->buffer;
-                    s->buf_end = s->buffer/* + len*/;
-                }
-            }else{
-                fill_buffer(s);
-                len = s->buf_end - s->buf_ptr;
-                if (len == 0)
-                    break;
-            }
-        } else {
-            memcpy(buf, s->buf_ptr, len);
-            buf += len;
-            s->buf_ptr += len;
-            size -= len;
-        }
-    }
-    if (size1 == size) {
-        if (url_ferror(s)) return url_ferror(s);
-        if (url_feof(s))   return AVERROR_EOF;
-    }
-    return size1 - size;
-}
-
-int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
-{
-    int len;
-
-    if(size<0)
-        return -1;
-
-    len = s->buf_end - s->buf_ptr;
-    if (len == 0) {
-        fill_buffer(s);
-        len = s->buf_end - s->buf_ptr;
-    }
-    if (len > size)
-        len = size;
-    memcpy(buf, s->buf_ptr, len);
-    s->buf_ptr += len;
-    if (!len) {
-        if (url_ferror(s)) return url_ferror(s);
-        if (url_feof(s))   return AVERROR_EOF;
-    }
-    return len;
-}
-
-unsigned int get_le16(ByteIOContext *s)
-{
-    unsigned int val;
-    val = get_byte(s);
-    val |= get_byte(s) << 8;
-    return val;
-}
-
-unsigned int get_le24(ByteIOContext *s)
-{
-    unsigned int val;
-    val = get_le16(s);
-    val |= get_byte(s) << 16;
-    return val;
-}
-
-unsigned int get_le32(ByteIOContext *s)
-{
-    unsigned int val;
-    val = get_le16(s);
-    val |= get_le16(s) << 16;
-    return val;
-}
-
-uint64_t get_le64(ByteIOContext *s)
-{
-    uint64_t val;
-    val = (uint64_t)get_le32(s);
-    val |= (uint64_t)get_le32(s) << 32;
-    return val;
-}
-
-unsigned int get_be16(ByteIOContext *s)
-{
-    unsigned int val;
-    val = get_byte(s) << 8;
-    val |= get_byte(s);
-    return val;
-}
-
-unsigned int get_be24(ByteIOContext *s)
-{
-    unsigned int val;
-    val = get_be16(s) << 8;
-    val |= get_byte(s);
-    return val;
-}
-unsigned int get_be32(ByteIOContext *s)
-{
-    unsigned int val;
-    val = get_be16(s) << 16;
-    val |= get_be16(s);
-    return val;
-}
-
-char *get_strz(ByteIOContext *s, char *buf, int maxlen)
-{
-    int i = 0;
-    char c;
-
-    while ((c = get_byte(s))) {
-        if (i < maxlen-1)
-            buf[i++] = c;
-    }
-
-    buf[i] = 0; /* Ensure null terminated, but may be truncated */
-
-    return buf;
-}
-
-uint64_t get_be64(ByteIOContext *s)
-{
-    uint64_t val;
-    val = (uint64_t)get_be32(s) << 32;
-    val |= (uint64_t)get_be32(s);
-    return val;
-}
-
-uint64_t ff_get_v(ByteIOContext *bc){
-    uint64_t val = 0;
-    int tmp;
-
-    do{
-        tmp = get_byte(bc);
-        val= (val<<7) + (tmp&127);
-    }while(tmp&128);
-    return val;
-}
-
-int url_fdopen(ByteIOContext **s, URLContext *h)
-{
-    uint8_t *buffer;
-    int buffer_size, max_packet_size;
-
-    max_packet_size = url_get_max_packet_size(h);
-    if (max_packet_size) {
-        buffer_size = max_packet_size; /* no need to bufferize more than one packet */
-    } else {
-        buffer_size = IO_BUFFER_SIZE;
-    }
-    buffer = av_malloc(buffer_size);
-    if (!buffer)
-        return AVERROR(ENOMEM);
-
-    *s = av_mallocz(sizeof(ByteIOContext));
-    if(!*s) {
-        av_free(buffer);
-        return AVERROR(ENOMEM);
-    }
-
-    if (init_put_byte(*s, buffer, buffer_size,
-                      (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
-                      url_read, url_write, url_seek) < 0) {
-        av_free(buffer);
-        av_freep(s);
-        return AVERROR(EIO);
-    }
-    (*s)->is_streamed = h->is_streamed;
-    (*s)->max_packet_size = max_packet_size;
-    if(h->prot) {
-        (*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause;
-        (*s)->read_seek  = (int64_t (*)(void *, int, int64_t, int))h->prot->url_read_seek;
-    }
-    return 0;
-}
-
-int url_setbufsize(ByteIOContext *s, int buf_size)
-{
-    uint8_t *buffer;
-    buffer = av_malloc(buf_size);
-    if (!buffer)
-        return AVERROR(ENOMEM);
-
-    av_free(s->buffer);
-    s->buffer = buffer;
-    s->buffer_size = buf_size;
-    s->buf_ptr = buffer;
-    url_resetbuf(s, s->write_flag ? URL_WRONLY : URL_RDONLY);
-    return 0;
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-int url_resetbuf(ByteIOContext *s, int flags)
-#else
-static int url_resetbuf(ByteIOContext *s, int flags)
-#endif
-{
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-    URLContext *h = s->opaque;
-    if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR))
-        return AVERROR(EINVAL);
-#else
-    assert(flags == URL_WRONLY || flags == URL_RDONLY);
-#endif
-
-    if (flags & URL_WRONLY) {
-        s->buf_end = s->buffer + s->buffer_size;
-        s->write_flag = 1;
-    } else {
-        s->buf_end = s->buffer;
-        s->write_flag = 0;
-    }
-    return 0;
-}
-
-int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size)
-{
-    int64_t buffer_start;
-    int buffer_size;
-    int overlap, new_size;
-
-    if (s->write_flag)
-        return AVERROR(EINVAL);
-
-    buffer_size = s->buf_end - s->buffer;
-
-    /* the buffers must touch or overlap */
-    if ((buffer_start = s->pos - buffer_size) > buf_size)
-        return AVERROR(EINVAL);
-
-    overlap = buf_size - buffer_start;
-    new_size = buf_size + buffer_size - overlap;
-
-    if (new_size > buf_size) {
-        if (!(buf = av_realloc(buf, new_size)))
-            return AVERROR(ENOMEM);
-
-        memcpy(buf + buf_size, s->buffer + overlap, buffer_size - overlap);
-        buf_size = new_size;
-    }
-
-    av_free(s->buffer);
-    s->buf_ptr = s->buffer = buf;
-    s->pos = s->buffer_size = buf_size;
-    s->buf_end = s->buf_ptr + buf_size;
-    s->eof_reached = 0;
-    s->must_flush = 0;
-
-    return 0;
-}
-
-int url_fopen(ByteIOContext **s, const char *filename, int flags)
-{
-    URLContext *h;
-    int err;
-
-    err = url_open(&h, filename, flags);
-    if (err < 0)
-        return err;
-    err = url_fdopen(s, h);
-    if (err < 0) {
-        url_close(h);
-        return err;
-    }
-    return 0;
-}
-
-int url_fclose(ByteIOContext *s)
-{
-    URLContext *h = s->opaque;
-
-    av_free(s->buffer);
-    av_free(s);
-    return url_close(h);
-}
-
-URLContext *url_fileno(ByteIOContext *s)
-{
-    return s->opaque;
-}
-
-#if CONFIG_MUXERS
-int url_fprintf(ByteIOContext *s, const char *fmt, ...)
-{
-    va_list ap;
-    char buf[4096];
-    int ret;
-
-    va_start(ap, fmt);
-    ret = vsnprintf(buf, sizeof(buf), fmt, ap);
-    va_end(ap);
-    put_buffer(s, buf, strlen(buf));
-    return ret;
-}
-#endif //CONFIG_MUXERS
-
-char *url_fgets(ByteIOContext *s, char *buf, int buf_size)
-{
-    int c;
-    char *q;
-
-    c = url_fgetc(s);
-    if (c == EOF)
-        return NULL;
-    q = buf;
-    for(;;) {
-        if (c == EOF || c == '\n')
-            break;
-        if ((q - buf) < buf_size - 1)
-            *q++ = c;
-        c = url_fgetc(s);
-    }
-    if (buf_size > 0)
-        *q = '\0';
-    return buf;
-}
-
-int url_fget_max_packet_size(ByteIOContext *s)
-{
-    return s->max_packet_size;
-}
-
-int av_url_read_fpause(ByteIOContext *s, int pause)
-{
-    if (!s->read_pause)
-        return AVERROR(ENOSYS);
-    return s->read_pause(s->opaque, pause);
-}
-
-int64_t av_url_read_fseek(ByteIOContext *s, int stream_index,
-                          int64_t timestamp, int flags)
-{
-    URLContext *h = s->opaque;
-    int64_t ret;
-    if (!s->read_seek)
-        return AVERROR(ENOSYS);
-    ret = s->read_seek(h, stream_index, timestamp, flags);
-    if(ret >= 0) {
-        int64_t pos;
-        s->buf_ptr = s->buf_end; // Flush buffer
-        pos = s->seek(h, 0, SEEK_CUR);
-        if (pos >= 0)
-            s->pos = pos;
-        else if (pos != AVERROR(ENOSYS))
-            ret = pos;
-    }
-    return ret;
-}
-
-/* url_open_dyn_buf and url_close_dyn_buf are used in rtp.c to send a response
- * back to the server even if CONFIG_MUXERS is false. */
-#if CONFIG_MUXERS || CONFIG_NETWORK
-/* buffer handling */
-int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags)
-{
-    int ret;
-    *s = av_mallocz(sizeof(ByteIOContext));
-    if(!*s)
-        return AVERROR(ENOMEM);
-    ret = init_put_byte(*s, buf, buf_size,
-                        (flags & URL_WRONLY || flags & URL_RDWR),
-                        NULL, NULL, NULL, NULL);
-    if(ret != 0)
-        av_freep(s);
-    return ret;
-}
-
-int url_close_buf(ByteIOContext *s)
-{
-    put_flush_packet(s);
-    return s->buf_ptr - s->buffer;
-}
-
-/* output in a dynamic buffer */
-
-typedef struct DynBuffer {
-    int pos, size, allocated_size;
-    uint8_t *buffer;
-    int io_buffer_size;
-    uint8_t io_buffer[1];
-} DynBuffer;
-
-static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size)
-{
-    DynBuffer *d = opaque;
-    unsigned new_size, new_allocated_size;
-
-    /* reallocate buffer if needed */
-    new_size = d->pos + buf_size;
-    new_allocated_size = d->allocated_size;
-    if(new_size < d->pos || new_size > INT_MAX/2)
-        return -1;
-    while (new_size > new_allocated_size) {
-        if (!new_allocated_size)
-            new_allocated_size = new_size;
-        else
-            new_allocated_size += new_allocated_size / 2 + 1;
-    }
-
-    if (new_allocated_size > d->allocated_size) {
-        d->buffer = av_realloc(d->buffer, new_allocated_size);
-        if(d->buffer == NULL)
-             return AVERROR(ENOMEM);
-        d->allocated_size = new_allocated_size;
-    }
-    memcpy(d->buffer + d->pos, buf, buf_size);
-    d->pos = new_size;
-    if (d->pos > d->size)
-        d->size = d->pos;
-    return buf_size;
-}
-
-static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size)
-{
-    unsigned char buf1[4];
-    int ret;
-
-    /* packetized write: output the header */
-    AV_WB32(buf1, buf_size);
-    ret= dyn_buf_write(opaque, buf1, 4);
-    if(ret < 0)
-        return ret;
-
-    /* then the data */
-    return dyn_buf_write(opaque, buf, buf_size);
-}
-
-static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence)
-{
-    DynBuffer *d = opaque;
-
-    if (whence == SEEK_CUR)
-        offset += d->pos;
-    else if (whence == SEEK_END)
-        offset += d->size;
-    if (offset < 0 || offset > 0x7fffffffLL)
-        return -1;
-    d->pos = offset;
-    return 0;
-}
-
-static int url_open_dyn_buf_internal(ByteIOContext **s, int max_packet_size)
-{
-    DynBuffer *d;
-    int ret;
-    unsigned io_buffer_size = max_packet_size ? max_packet_size : 1024;
-
-    if(sizeof(DynBuffer) + io_buffer_size < io_buffer_size)
-        return -1;
-    d = av_mallocz(sizeof(DynBuffer) + io_buffer_size);
-    if (!d)
-        return AVERROR(ENOMEM);
-    *s = av_mallocz(sizeof(ByteIOContext));
-    if(!*s) {
-        av_free(d);
-        return AVERROR(ENOMEM);
-    }
-    d->io_buffer_size = io_buffer_size;
-    ret = init_put_byte(*s, d->io_buffer, io_buffer_size,
-                        1, d, NULL,
-                        max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
-                        max_packet_size ? NULL : dyn_buf_seek);
-    if (ret == 0) {
-        (*s)->max_packet_size = max_packet_size;
-    } else {
-        av_free(d);
-        av_freep(s);
-    }
-    return ret;
-}
-
-int url_open_dyn_buf(ByteIOContext **s)
-{
-    return url_open_dyn_buf_internal(s, 0);
-}
-
-int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size)
-{
-    if (max_packet_size <= 0)
-        return -1;
-    return url_open_dyn_buf_internal(s, max_packet_size);
-}
-
-int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)
-{
-    DynBuffer *d = s->opaque;
-    int size;
-
-    put_flush_packet(s);
-
-    *pbuffer = d->buffer;
-    size = d->size;
-    av_free(d);
-    av_free(s);
-    return size;
-}
-#endif /* CONFIG_MUXERS || CONFIG_NETWORK */
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
deleted file mode 100644
index e2a8a3c..0000000
--- a/libavformat/avisynth.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * AVISynth support for ffmpeg system
- * Copyright (c) 2006 DivX, Inc.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "riff.h"
-
-#include <windows.h>
-#include <vfw.h>
-
-typedef struct {
-  PAVISTREAM handle;
-  AVISTREAMINFO info;
-  DWORD read;
-  LONG chunck_size;
-  LONG chunck_samples;
-} AVISynthStream;
-
-typedef struct {
-  PAVIFILE file;
-  AVISynthStream *streams;
-  int nb_streams;
-  int next_stream;
-} AVISynthContext;
-
-static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-  AVISynthContext *avs = s->priv_data;
-  HRESULT res;
-  AVIFILEINFO info;
-  DWORD id;
-  AVStream *st;
-  AVISynthStream *stream;
-
-  AVIFileInit();
-
-  res = AVIFileOpen(&avs->file, s->filename, OF_READ|OF_SHARE_DENY_WRITE, NULL);
-  if (res != S_OK)
-    {
-      av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res);
-      AVIFileExit();
-      return -1;
-    }
-
-  res = AVIFileInfo(avs->file, &info, sizeof(info));
-  if (res != S_OK)
-    {
-      av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %ld", res);
-      AVIFileExit();
-      return -1;
-    }
-
-  avs->streams = av_mallocz(info.dwStreams * sizeof(AVISynthStream));
-
-  for (id=0; id<info.dwStreams; id++)
-    {
-      stream = &avs->streams[id];
-      stream->read = 0;
-      if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK)
-        {
-          if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK)
-            {
-              if (stream->info.fccType == streamtypeAUDIO)
-                {
-                  WAVEFORMATEX wvfmt;
-                  LONG struct_size = sizeof(WAVEFORMATEX);
-                  if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)
-                    continue;
-
-                  st = av_new_stream(s, id);
-                  st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-
-                  st->codec->block_align = wvfmt.nBlockAlign;
-                  st->codec->channels = wvfmt.nChannels;
-                  st->codec->sample_rate = wvfmt.nSamplesPerSec;
-                  st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8;
-                  st->codec->bits_per_coded_sample = wvfmt.wBitsPerSample;
-
-                  stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate;
-                  stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;
-
-                  st->codec->codec_tag = wvfmt.wFormatTag;
-                  st->codec->codec_id = ff_wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_coded_sample);
-                }
-              else if (stream->info.fccType == streamtypeVIDEO)
-                {
-                  BITMAPINFO imgfmt;
-                  LONG struct_size = sizeof(BITMAPINFO);
-
-                  stream->chunck_size = stream->info.dwSampleSize;
-                  stream->chunck_samples = 1;
-
-                  if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)
-                    continue;
-
-                  st = av_new_stream(s, id);
-                  st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-                  st->r_frame_rate.num = stream->info.dwRate;
-                  st->r_frame_rate.den = stream->info.dwScale;
-
-                  st->codec->width = imgfmt.bmiHeader.biWidth;
-                  st->codec->height = imgfmt.bmiHeader.biHeight;
-
-                  st->codec->bits_per_coded_sample = imgfmt.bmiHeader.biBitCount;
-                  st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale;
-                  st->codec->codec_tag = imgfmt.bmiHeader.biCompression;
-                  st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, imgfmt.bmiHeader.biCompression);
-
-                  st->duration = stream->info.dwLength;
-                }
-              else
-                {
-                  AVIStreamRelease(stream->handle);
-                  continue;
-                }
-
-              avs->nb_streams++;
-
-              st->codec->stream_codec_tag = stream->info.fccHandler;
-
-              av_set_pts_info(st, 64, info.dwScale, info.dwRate);
-              st->start_time = stream->info.dwStart;
-            }
-        }
-    }
-
-  return 0;
-}
-
-static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-  AVISynthContext *avs = s->priv_data;
-  HRESULT res;
-  AVISynthStream *stream;
-  int stream_id = avs->next_stream;
-  LONG read_size;
-
-  // handle interleaving manually...
-  stream = &avs->streams[stream_id];
-
-  if (stream->read >= stream->info.dwLength)
-    return AVERROR(EIO);
-
-  if (av_new_packet(pkt, stream->chunck_size))
-    return AVERROR(EIO);
-  pkt->stream_index = stream_id;
-  pkt->pts = avs->streams[stream_id].read / avs->streams[stream_id].chunck_samples;
-
-  res = AVIStreamRead(stream->handle, stream->read, stream->chunck_samples, pkt->data, stream->chunck_size, &read_size, NULL);
-
-  pkt->pts = stream->read;
-  pkt->size = read_size;
-
-  stream->read += stream->chunck_samples;
-
-  // prepare for the next stream to read
-  do {
-    avs->next_stream = (avs->next_stream+1) % avs->nb_streams;
-  } while (avs->next_stream != stream_id && s->streams[avs->next_stream]->discard >= AVDISCARD_ALL);
-
-  return (res == S_OK) ? pkt->size : -1;
-}
-
-static int avisynth_read_close(AVFormatContext *s)
-{
-  AVISynthContext *avs = s->priv_data;
-  int i;
-
-  for (i=0;i<avs->nb_streams;i++)
-    {
-      AVIStreamRelease(avs->streams[i].handle);
-    }
-
-  av_free(avs->streams);
-  AVIFileRelease(avs->file);
-  AVIFileExit();
-  return 0;
-}
-
-static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
-{
-  AVISynthContext *avs = s->priv_data;
-  int stream_id;
-
-  for (stream_id = 0; stream_id < avs->nb_streams; stream_id++)
-    {
-      avs->streams[stream_id].read = pts * avs->streams[stream_id].chunck_samples;
-    }
-
-  return 0;
-}
-
-AVInputFormat avisynth_demuxer = {
-  "avs",
-  NULL_IF_CONFIG_SMALL("AVISynth"),
-  sizeof(AVISynthContext),
-  NULL,
-  avisynth_read_header,
-  avisynth_read_packet,
-  avisynth_read_close,
-  avisynth_read_seek,
-  NULL,
-  0,
-  "avs",
-};
diff --git a/libavformat/avlanguage.c b/libavformat/avlanguage.c
deleted file mode 100644
index 525bf07..0000000
--- a/libavformat/avlanguage.c
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * Cyril Comparon, Larbi Joubala, Resonate-MP4 2009
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avlanguage.h"
-#include "libavutil/avstring.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-typedef struct LangEntry {
-    const char str[4];
-    uint16_t next_equivalent;
-} LangEntry;
-
-static const uint16_t lang_table_counts[] = { 484, 20, 184 };
-static const uint16_t lang_table_offsets[] = { 0, 484, 504 };
-
-static const LangEntry lang_table[] = {
-    /*----- AV_LANG_ISO639_2_BIBL entries (484) -----*/
-    /*0000*/ { "aar",  504 },
-    /*0001*/ { "abk",  505 },
-    /*0002*/ { "ace",    2 },
-    /*0003*/ { "ach",    3 },
-    /*0004*/ { "ada",    4 },
-    /*0005*/ { "ady",    5 },
-    /*0006*/ { "afa",    6 },
-    /*0007*/ { "afh",    7 },
-    /*0008*/ { "afr",  507 },
-    /*0009*/ { "ain",    9 },
-    /*0010*/ { "aka",  508 },
-    /*0011*/ { "akk",   11 },
-    /*0012*/ { "alb",  502 },
-    /*0013*/ { "ale",   13 },
-    /*0014*/ { "alg",   14 },
-    /*0015*/ { "alt",   15 },
-    /*0016*/ { "amh",  509 },
-    /*0017*/ { "ang",   17 },
-    /*0018*/ { "anp",   18 },
-    /*0019*/ { "apa",   19 },
-    /*0020*/ { "ara",  511 },
-    /*0021*/ { "arc",   21 },
-    /*0022*/ { "arg",  510 },
-    /*0023*/ { "arm",  492 },
-    /*0024*/ { "arn",   24 },
-    /*0025*/ { "arp",   25 },
-    /*0026*/ { "art",   26 },
-    /*0027*/ { "arw",   27 },
-    /*0028*/ { "asm",  512 },
-    /*0029*/ { "ast",   29 },
-    /*0030*/ { "ath",   30 },
-    /*0031*/ { "aus",   31 },
-    /*0032*/ { "ava",  513 },
-    /*0033*/ { "ave",  506 },
-    /*0034*/ { "awa",   34 },
-    /*0035*/ { "aym",  514 },
-    /*0036*/ { "aze",  515 },
-    /*0037*/ { "bad",   37 },
-    /*0038*/ { "bai",   38 },
-    /*0039*/ { "bak",  516 },
-    /*0040*/ { "bal",   40 },
-    /*0041*/ { "bam",  521 },
-    /*0042*/ { "ban",   42 },
-    /*0043*/ { "baq",  489 },
-    /*0044*/ { "bas",   44 },
-    /*0045*/ { "bat",   45 },
-    /*0046*/ { "bej",   46 },
-    /*0047*/ { "bel",  517 },
-    /*0048*/ { "bem",   48 },
-    /*0049*/ { "ben",  522 },
-    /*0050*/ { "ber",   50 },
-    /*0051*/ { "bho",   51 },
-    /*0052*/ { "bih",  519 },
-    /*0053*/ { "bik",   53 },
-    /*0054*/ { "bin",   54 },
-    /*0055*/ { "bis",  520 },
-    /*0056*/ { "bla",   56 },
-    /*0057*/ { "bnt",   57 },
-    /*0058*/ { "bos",  525 },
-    /*0059*/ { "bra",   59 },
-    /*0060*/ { "bre",  524 },
-    /*0061*/ { "btk",   61 },
-    /*0062*/ { "bua",   62 },
-    /*0063*/ { "bug",   63 },
-    /*0064*/ { "bul",  518 },
-    /*0065*/ { "bur",  498 },
-    /*0066*/ { "byn",   66 },
-    /*0067*/ { "cad",   67 },
-    /*0068*/ { "cai",   68 },
-    /*0069*/ { "car",   69 },
-    /*0070*/ { "cat",  526 },
-    /*0071*/ { "cau",   71 },
-    /*0072*/ { "ceb",   72 },
-    /*0073*/ { "cel",   73 },
-    /*0074*/ { "cha",  528 },
-    /*0075*/ { "chb",   75 },
-    /*0076*/ { "che",  527 },
-    /*0077*/ { "chg",   77 },
-    /*0078*/ { "chi",  503 },
-    /*0079*/ { "chk",   79 },
-    /*0080*/ { "chm",   80 },
-    /*0081*/ { "chn",   81 },
-    /*0082*/ { "cho",   82 },
-    /*0083*/ { "chp",   83 },
-    /*0084*/ { "chr",   84 },
-    /*0085*/ { "chu",  532 },
-    /*0086*/ { "chv",  533 },
-    /*0087*/ { "chy",   87 },
-    /*0088*/ { "cmc",   88 },
-    /*0089*/ { "cop",   89 },
-    /*0090*/ { "cor",  593 },
-    /*0091*/ { "cos",  529 },
-    /*0092*/ { "cpe",   92 },
-    /*0093*/ { "cpf",   93 },
-    /*0094*/ { "cpp",   94 },
-    /*0095*/ { "cre",  530 },
-    /*0096*/ { "crh",   96 },
-    /*0097*/ { "crp",   97 },
-    /*0098*/ { "csb",   98 },
-    /*0099*/ { "cus",   99 },
-    /*0100*/ { "cze",  485 },
-    /*0101*/ { "dak",  101 },
-    /*0102*/ { "dan",  535 },
-    /*0103*/ { "dar",  103 },
-    /*0104*/ { "day",  104 },
-    /*0105*/ { "del",  105 },
-    /*0106*/ { "den",  106 },
-    /*0107*/ { "dgr",  107 },
-    /*0108*/ { "din",  108 },
-    /*0109*/ { "div",  537 },
-    /*0110*/ { "doi",  110 },
-    /*0111*/ { "dra",  111 },
-    /*0112*/ { "dsb",  112 },
-    /*0113*/ { "dua",  113 },
-    /*0114*/ { "dum",  114 },
-    /*0115*/ { "dut",  499 },
-    /*0116*/ { "dyu",  116 },
-    /*0117*/ { "dzo",  538 },
-    /*0118*/ { "efi",  118 },
-    /*0119*/ { "egy",  119 },
-    /*0120*/ { "eka",  120 },
-    /*0121*/ { "elx",  121 },
-    /*0122*/ { "eng",  541 },
-    /*0123*/ { "enm",  123 },
-    /*0124*/ { "epo",  542 },
-    /*0125*/ { "est",  544 },
-    /*0126*/ { "ewe",  539 },
-    /*0127*/ { "ewo",  127 },
-    /*0128*/ { "fan",  128 },
-    /*0129*/ { "fao",  550 },
-    /*0130*/ { "fat",  130 },
-    /*0131*/ { "fij",  549 },
-    /*0132*/ { "fil",  132 },
-    /*0133*/ { "fin",  548 },
-    /*0134*/ { "fiu",  134 },
-    /*0135*/ { "fon",  135 },
-    /*0136*/ { "fre",  491 },
-    /*0137*/ { "frm",  137 },
-    /*0138*/ { "fro",  138 },
-    /*0139*/ { "frr",  139 },
-    /*0140*/ { "frs",  140 },
-    /*0141*/ { "fry",  552 },
-    /*0142*/ { "ful",  547 },
-    /*0143*/ { "fur",  143 },
-    /*0144*/ { "gaa",  144 },
-    /*0145*/ { "gay",  145 },
-    /*0146*/ { "gba",  146 },
-    /*0147*/ { "gem",  147 },
-    /*0148*/ { "geo",  494 },
-    /*0149*/ { "ger",  487 },
-    /*0150*/ { "gez",  150 },
-    /*0151*/ { "gil",  151 },
-    /*0152*/ { "gla",  554 },
-    /*0153*/ { "gle",  553 },
-    /*0154*/ { "glg",  555 },
-    /*0155*/ { "glv",  558 },
-    /*0156*/ { "gmh",  156 },
-    /*0157*/ { "goh",  157 },
-    /*0158*/ { "gon",  158 },
-    /*0159*/ { "gor",  159 },
-    /*0160*/ { "got",  160 },
-    /*0161*/ { "grb",  161 },
-    /*0162*/ { "grc",  162 },
-    /*0163*/ { "gre",  488 },
-    /*0164*/ { "grn",  556 },
-    /*0165*/ { "gsw",  165 },
-    /*0166*/ { "guj",  557 },
-    /*0167*/ { "gwi",  167 },
-    /*0168*/ { "hai",  168 },
-    /*0169*/ { "hat",  564 },
-    /*0170*/ { "hau",  559 },
-    /*0171*/ { "haw",  171 },
-    /*0172*/ { "heb",  560 },
-    /*0173*/ { "her",  567 },
-    /*0174*/ { "hil",  174 },
-    /*0175*/ { "him",  175 },
-    /*0176*/ { "hin",  561 },
-    /*0177*/ { "hit",  177 },
-    /*0178*/ { "hmn",  178 },
-    /*0179*/ { "hmo",  562 },
-    /*0180*/ { "hrv",  563 },
-    /*0181*/ { "hsb",  181 },
-    /*0182*/ { "hun",  565 },
-    /*0183*/ { "hup",  183 },
-    /*0184*/ { "iba",  184 },
-    /*0185*/ { "ibo",  571 },
-    /*0186*/ { "ice",  493 },
-    /*0187*/ { "ido",  574 },
-    /*0188*/ { "iii",  572 },
-    /*0189*/ { "ijo",  189 },
-    /*0190*/ { "iku",  577 },
-    /*0191*/ { "ile",  570 },
-    /*0192*/ { "ilo",  192 },
-    /*0193*/ { "ina",  568 },
-    /*0194*/ { "inc",  194 },
-    /*0195*/ { "ind",  569 },
-    /*0196*/ { "ine",  196 },
-    /*0197*/ { "inh",  197 },
-    /*0198*/ { "ipk",  573 },
-    /*0199*/ { "ira",  199 },
-    /*0200*/ { "iro",  200 },
-    /*0201*/ { "ita",  576 },
-    /*0202*/ { "jav",  579 },
-    /*0203*/ { "jbo",  203 },
-    /*0204*/ { "jpn",  578 },
-    /*0205*/ { "jpr",  205 },
-    /*0206*/ { "jrb",  206 },
-    /*0207*/ { "kaa",  207 },
-    /*0208*/ { "kab",  208 },
-    /*0209*/ { "kac",  209 },
-    /*0210*/ { "kal",  585 },
-    /*0211*/ { "kam",  211 },
-    /*0212*/ { "kan",  587 },
-    /*0213*/ { "kar",  213 },
-    /*0214*/ { "kas",  590 },
-    /*0215*/ { "kau",  589 },
-    /*0216*/ { "kaw",  216 },
-    /*0217*/ { "kaz",  584 },
-    /*0218*/ { "kbd",  218 },
-    /*0219*/ { "kha",  219 },
-    /*0220*/ { "khi",  220 },
-    /*0221*/ { "khm",  586 },
-    /*0222*/ { "kho",  222 },
-    /*0223*/ { "kik",  582 },
-    /*0224*/ { "kin",  640 },
-    /*0225*/ { "kir",  594 },
-    /*0226*/ { "kmb",  226 },
-    /*0227*/ { "kok",  227 },
-    /*0228*/ { "kom",  592 },
-    /*0229*/ { "kon",  581 },
-    /*0230*/ { "kor",  588 },
-    /*0231*/ { "kos",  231 },
-    /*0232*/ { "kpe",  232 },
-    /*0233*/ { "krc",  233 },
-    /*0234*/ { "krl",  234 },
-    /*0235*/ { "kro",  235 },
-    /*0236*/ { "kru",  236 },
-    /*0237*/ { "kua",  583 },
-    /*0238*/ { "kum",  238 },
-    /*0239*/ { "kur",  591 },
-    /*0240*/ { "kut",  240 },
-    /*0241*/ { "lad",  241 },
-    /*0242*/ { "lah",  242 },
-    /*0243*/ { "lam",  243 },
-    /*0244*/ { "lao",  600 },
-    /*0245*/ { "lat",  595 },
-    /*0246*/ { "lav",  603 },
-    /*0247*/ { "lez",  247 },
-    /*0248*/ { "lim",  598 },
-    /*0249*/ { "lin",  599 },
-    /*0250*/ { "lit",  601 },
-    /*0251*/ { "lol",  251 },
-    /*0252*/ { "loz",  252 },
-    /*0253*/ { "ltz",  596 },
-    /*0254*/ { "lua",  254 },
-    /*0255*/ { "lub",  602 },
-    /*0256*/ { "lug",  597 },
-    /*0257*/ { "lui",  257 },
-    /*0258*/ { "lun",  258 },
-    /*0259*/ { "luo",  259 },
-    /*0260*/ { "lus",  260 },
-    /*0261*/ { "mac",  495 },
-    /*0262*/ { "mad",  262 },
-    /*0263*/ { "mag",  263 },
-    /*0264*/ { "mah",  605 },
-    /*0265*/ { "mai",  265 },
-    /*0266*/ { "mak",  266 },
-    /*0267*/ { "mal",  608 },
-    /*0268*/ { "man",  268 },
-    /*0269*/ { "mao",  496 },
-    /*0270*/ { "map",  270 },
-    /*0271*/ { "mar",  610 },
-    /*0272*/ { "mas",  272 },
-    /*0273*/ { "may",  497 },
-    /*0274*/ { "mdf",  274 },
-    /*0275*/ { "mdr",  275 },
-    /*0276*/ { "men",  276 },
-    /*0277*/ { "mga",  277 },
-    /*0278*/ { "mic",  278 },
-    /*0279*/ { "min",  279 },
-    /*0280*/ { "mis",  280 },
-    /*0281*/ { "mkh",  281 },
-    /*0282*/ { "mlg",  604 },
-    /*0283*/ { "mlt",  612 },
-    /*0284*/ { "mnc",  284 },
-    /*0285*/ { "mni",  285 },
-    /*0286*/ { "mno",  286 },
-    /*0287*/ { "moh",  287 },
-    /*0288*/ { "mon",  609 },
-    /*0289*/ { "mos",  289 },
-    /*0290*/ { "mul",  290 },
-    /*0291*/ { "mun",  291 },
-    /*0292*/ { "mus",  292 },
-    /*0293*/ { "mwl",  293 },
-    /*0294*/ { "mwr",  294 },
-    /*0295*/ { "myn",  295 },
-    /*0296*/ { "myv",  296 },
-    /*0297*/ { "nah",  297 },
-    /*0298*/ { "nai",  298 },
-    /*0299*/ { "nap",  299 },
-    /*0300*/ { "nau",  614 },
-    /*0301*/ { "nav",  623 },
-    /*0302*/ { "nbl",  622 },
-    /*0303*/ { "nde",  616 },
-    /*0304*/ { "ndo",  618 },
-    /*0305*/ { "nds",  305 },
-    /*0306*/ { "nep",  617 },
-    /*0307*/ { "new",  307 },
-    /*0308*/ { "nia",  308 },
-    /*0309*/ { "nic",  309 },
-    /*0310*/ { "niu",  310 },
-    /*0311*/ { "nno",  620 },
-    /*0312*/ { "nob",  615 },
-    /*0313*/ { "nog",  313 },
-    /*0314*/ { "non",  314 },
-    /*0315*/ { "nor",  621 },
-    /*0316*/ { "nqo",  316 },
-    /*0317*/ { "nso",  317 },
-    /*0318*/ { "nub",  318 },
-    /*0319*/ { "nwc",  319 },
-    /*0320*/ { "nya",  624 },
-    /*0321*/ { "nym",  321 },
-    /*0322*/ { "nyn",  322 },
-    /*0323*/ { "nyo",  323 },
-    /*0324*/ { "nzi",  324 },
-    /*0325*/ { "oci",  625 },
-    /*0326*/ { "oji",  626 },
-    /*0327*/ { "ori",  628 },
-    /*0328*/ { "orm",  627 },
-    /*0329*/ { "osa",  329 },
-    /*0330*/ { "oss",  629 },
-    /*0331*/ { "ota",  331 },
-    /*0332*/ { "oto",  332 },
-    /*0333*/ { "paa",  333 },
-    /*0334*/ { "pag",  334 },
-    /*0335*/ { "pal",  335 },
-    /*0336*/ { "pam",  336 },
-    /*0337*/ { "pan",  630 },
-    /*0338*/ { "pap",  338 },
-    /*0339*/ { "pau",  339 },
-    /*0340*/ { "peo",  340 },
-    /*0341*/ { "per",  490 },
-    /*0342*/ { "phi",  342 },
-    /*0343*/ { "phn",  343 },
-    /*0344*/ { "pli",  631 },
-    /*0345*/ { "pol",  632 },
-    /*0346*/ { "pon",  346 },
-    /*0347*/ { "por",  634 },
-    /*0348*/ { "pra",  348 },
-    /*0349*/ { "pro",  349 },
-    /*0350*/ { "pus",  633 },
-    /*0351*/ { "que",  635 },
-    /*0352*/ { "raj",  352 },
-    /*0353*/ { "rap",  353 },
-    /*0354*/ { "rar",  354 },
-    /*0355*/ { "roa",  355 },
-    /*0356*/ { "roh",  636 },
-    /*0357*/ { "rom",  357 },
-    /*0358*/ { "rum",  500 },
-    /*0359*/ { "run",  637 },
-    /*0360*/ { "rup",  360 },
-    /*0361*/ { "rus",  639 },
-    /*0362*/ { "sad",  362 },
-    /*0363*/ { "sag",  645 },
-    /*0364*/ { "sah",  364 },
-    /*0365*/ { "sai",  365 },
-    /*0366*/ { "sal",  366 },
-    /*0367*/ { "sam",  367 },
-    /*0368*/ { "san",  641 },
-    /*0369*/ { "sas",  369 },
-    /*0370*/ { "sat",  370 },
-    /*0371*/ { "scn",  371 },
-    /*0372*/ { "sco",  372 },
-    /*0373*/ { "sel",  373 },
-    /*0374*/ { "sem",  374 },
-    /*0375*/ { "sga",  375 },
-    /*0376*/ { "sgn",  376 },
-    /*0377*/ { "shn",  377 },
-    /*0378*/ { "sid",  378 },
-    /*0379*/ { "sin",  646 },
-    /*0380*/ { "sio",  380 },
-    /*0381*/ { "sit",  381 },
-    /*0382*/ { "sla",  382 },
-    /*0383*/ { "slo",  501 },
-    /*0384*/ { "slv",  648 },
-    /*0385*/ { "sma",  385 },
-    /*0386*/ { "sme",  644 },
-    /*0387*/ { "smi",  387 },
-    /*0388*/ { "smj",  388 },
-    /*0389*/ { "smn",  389 },
-    /*0390*/ { "smo",  649 },
-    /*0391*/ { "sms",  391 },
-    /*0392*/ { "sna",  650 },
-    /*0393*/ { "snd",  643 },
-    /*0394*/ { "snk",  394 },
-    /*0395*/ { "sog",  395 },
-    /*0396*/ { "som",  651 },
-    /*0397*/ { "son",  397 },
-    /*0398*/ { "sot",  655 },
-    /*0399*/ { "spa",  543 },
-    /*0400*/ { "srd",  642 },
-    /*0401*/ { "srn",  401 },
-    /*0402*/ { "srp",  653 },
-    /*0403*/ { "srr",  403 },
-    /*0404*/ { "ssa",  404 },
-    /*0405*/ { "ssw",  654 },
-    /*0406*/ { "suk",  406 },
-    /*0407*/ { "sun",  656 },
-    /*0408*/ { "sus",  408 },
-    /*0409*/ { "sux",  409 },
-    /*0410*/ { "swa",  658 },
-    /*0411*/ { "swe",  657 },
-    /*0412*/ { "syc",  412 },
-    /*0413*/ { "syr",  413 },
-    /*0414*/ { "tah",  672 },
-    /*0415*/ { "tai",  415 },
-    /*0416*/ { "tam",  659 },
-    /*0417*/ { "tat",  670 },
-    /*0418*/ { "tel",  660 },
-    /*0419*/ { "tem",  419 },
-    /*0420*/ { "ter",  420 },
-    /*0421*/ { "tet",  421 },
-    /*0422*/ { "tgk",  661 },
-    /*0423*/ { "tgl",  665 },
-    /*0424*/ { "tha",  662 },
-    /*0425*/ { "tib",  484 },
-    /*0426*/ { "tig",  426 },
-    /*0427*/ { "tir",  663 },
-    /*0428*/ { "tiv",  428 },
-    /*0429*/ { "tkl",  429 },
-    /*0430*/ { "tlh",  430 },
-    /*0431*/ { "tli",  431 },
-    /*0432*/ { "tmh",  432 },
-    /*0433*/ { "tog",  433 },
-    /*0434*/ { "ton",  667 },
-    /*0435*/ { "tpi",  435 },
-    /*0436*/ { "tsi",  436 },
-    /*0437*/ { "tsn",  666 },
-    /*0438*/ { "tso",  669 },
-    /*0439*/ { "tuk",  664 },
-    /*0440*/ { "tum",  440 },
-    /*0441*/ { "tup",  441 },
-    /*0442*/ { "tur",  668 },
-    /*0443*/ { "tut",  443 },
-    /*0444*/ { "tvl",  444 },
-    /*0445*/ { "twi",  671 },
-    /*0446*/ { "tyv",  446 },
-    /*0447*/ { "udm",  447 },
-    /*0448*/ { "uga",  448 },
-    /*0449*/ { "uig",  673 },
-    /*0450*/ { "ukr",  674 },
-    /*0451*/ { "umb",  451 },
-    /*0452*/ { "und",  452 },
-    /*0453*/ { "urd",  675 },
-    /*0454*/ { "uzb",  676 },
-    /*0455*/ { "vai",  455 },
-    /*0456*/ { "ven",  677 },
-    /*0457*/ { "vie",  678 },
-    /*0458*/ { "vol",  679 },
-    /*0459*/ { "vot",  459 },
-    /*0460*/ { "wak",  460 },
-    /*0461*/ { "wal",  461 },
-    /*0462*/ { "war",  462 },
-    /*0463*/ { "was",  463 },
-    /*0464*/ { "wel",  486 },
-    /*0465*/ { "wen",  465 },
-    /*0466*/ { "wln",  680 },
-    /*0467*/ { "wol",  681 },
-    /*0468*/ { "xal",  468 },
-    /*0469*/ { "xho",  682 },
-    /*0470*/ { "yao",  470 },
-    /*0471*/ { "yap",  471 },
-    /*0472*/ { "yid",  683 },
-    /*0473*/ { "yor",  684 },
-    /*0474*/ { "ypk",  474 },
-    /*0475*/ { "zap",  475 },
-    /*0476*/ { "zbl",  476 },
-    /*0477*/ { "zen",  477 },
-    /*0478*/ { "zha",  685 },
-    /*0479*/ { "znd",  479 },
-    /*0480*/ { "zul",  687 },
-    /*0481*/ { "zun",  481 },
-    /*0482*/ { "zxx",  482 },
-    /*0483*/ { "zza",  483 },
-    /*----- AV_LANG_ISO639_2_TERM entries (20) -----*/
-    /*0484*/ { "bod",  523 },
-    /*0485*/ { "ces",  531 },
-    /*0486*/ { "cym",  534 },
-    /*0487*/ { "deu",  536 },
-    /*0488*/ { "ell",  540 },
-    /*0489*/ { "eus",  545 },
-    /*0490*/ { "fas",  546 },
-    /*0491*/ { "fra",  551 },
-    /*0492*/ { "hye",  566 },
-    /*0493*/ { "isl",  575 },
-    /*0494*/ { "kat",  580 },
-    /*0495*/ { "mkd",  607 },
-    /*0496*/ { "mri",  606 },
-    /*0497*/ { "msa",  611 },
-    /*0498*/ { "mya",  613 },
-    /*0499*/ { "nld",  619 },
-    /*0500*/ { "ron",  638 },
-    /*0501*/ { "slk",  647 },
-    /*0502*/ { "sqi",  652 },
-    /*0503*/ { "zho",  686 },
-    /*----- AV_LANG_ISO639_1 entries (184) -----*/
-    /*0504*/ { "aa" ,    0 },
-    /*0505*/ { "ab" ,    1 },
-    /*0506*/ { "ae" ,   33 },
-    /*0507*/ { "af" ,    8 },
-    /*0508*/ { "ak" ,   10 },
-    /*0509*/ { "am" ,   16 },
-    /*0510*/ { "an" ,   22 },
-    /*0511*/ { "ar" ,   20 },
-    /*0512*/ { "as" ,   28 },
-    /*0513*/ { "av" ,   32 },
-    /*0514*/ { "ay" ,   35 },
-    /*0515*/ { "az" ,   36 },
-    /*0516*/ { "ba" ,   39 },
-    /*0517*/ { "be" ,   47 },
-    /*0518*/ { "bg" ,   64 },
-    /*0519*/ { "bh" ,   52 },
-    /*0520*/ { "bi" ,   55 },
-    /*0521*/ { "bm" ,   41 },
-    /*0522*/ { "bn" ,   49 },
-    /*0523*/ { "bo" ,  425 },
-    /*0524*/ { "br" ,   60 },
-    /*0525*/ { "bs" ,   58 },
-    /*0526*/ { "ca" ,   70 },
-    /*0527*/ { "ce" ,   76 },
-    /*0528*/ { "ch" ,   74 },
-    /*0529*/ { "co" ,   91 },
-    /*0530*/ { "cr" ,   95 },
-    /*0531*/ { "cs" ,  100 },
-    /*0532*/ { "cu" ,   85 },
-    /*0533*/ { "cv" ,   86 },
-    /*0534*/ { "cy" ,  464 },
-    /*0535*/ { "da" ,  102 },
-    /*0536*/ { "de" ,  149 },
-    /*0537*/ { "dv" ,  109 },
-    /*0538*/ { "dz" ,  117 },
-    /*0539*/ { "ee" ,  126 },
-    /*0540*/ { "el" ,  163 },
-    /*0541*/ { "en" ,  122 },
-    /*0542*/ { "eo" ,  124 },
-    /*0543*/ { "es" ,  399 },
-    /*0544*/ { "et" ,  125 },
-    /*0545*/ { "eu" ,   43 },
-    /*0546*/ { "fa" ,  341 },
-    /*0547*/ { "ff" ,  142 },
-    /*0548*/ { "fi" ,  133 },
-    /*0549*/ { "fj" ,  131 },
-    /*0550*/ { "fo" ,  129 },
-    /*0551*/ { "fr" ,  136 },
-    /*0552*/ { "fy" ,  141 },
-    /*0553*/ { "ga" ,  153 },
-    /*0554*/ { "gd" ,  152 },
-    /*0555*/ { "gl" ,  154 },
-    /*0556*/ { "gn" ,  164 },
-    /*0557*/ { "gu" ,  166 },
-    /*0558*/ { "gv" ,  155 },
-    /*0559*/ { "ha" ,  170 },
-    /*0560*/ { "he" ,  172 },
-    /*0561*/ { "hi" ,  176 },
-    /*0562*/ { "ho" ,  179 },
-    /*0563*/ { "hr" ,  180 },
-    /*0564*/ { "ht" ,  169 },
-    /*0565*/ { "hu" ,  182 },
-    /*0566*/ { "hy" ,   23 },
-    /*0567*/ { "hz" ,  173 },
-    /*0568*/ { "ia" ,  193 },
-    /*0569*/ { "id" ,  195 },
-    /*0570*/ { "ie" ,  191 },
-    /*0571*/ { "ig" ,  185 },
-    /*0572*/ { "ii" ,  188 },
-    /*0573*/ { "ik" ,  198 },
-    /*0574*/ { "io" ,  187 },
-    /*0575*/ { "is" ,  186 },
-    /*0576*/ { "it" ,  201 },
-    /*0577*/ { "iu" ,  190 },
-    /*0578*/ { "ja" ,  204 },
-    /*0579*/ { "jv" ,  202 },
-    /*0580*/ { "ka" ,  148 },
-    /*0581*/ { "kg" ,  229 },
-    /*0582*/ { "ki" ,  223 },
-    /*0583*/ { "kj" ,  237 },
-    /*0584*/ { "kk" ,  217 },
-    /*0585*/ { "kl" ,  210 },
-    /*0586*/ { "km" ,  221 },
-    /*0587*/ { "kn" ,  212 },
-    /*0588*/ { "ko" ,  230 },
-    /*0589*/ { "kr" ,  215 },
-    /*0590*/ { "ks" ,  214 },
-    /*0591*/ { "ku" ,  239 },
-    /*0592*/ { "kv" ,  228 },
-    /*0593*/ { "kw" ,   90 },
-    /*0594*/ { "ky" ,  225 },
-    /*0595*/ { "la" ,  245 },
-    /*0596*/ { "lb" ,  253 },
-    /*0597*/ { "lg" ,  256 },
-    /*0598*/ { "li" ,  248 },
-    /*0599*/ { "ln" ,  249 },
-    /*0600*/ { "lo" ,  244 },
-    /*0601*/ { "lt" ,  250 },
-    /*0602*/ { "lu" ,  255 },
-    /*0603*/ { "lv" ,  246 },
-    /*0604*/ { "mg" ,  282 },
-    /*0605*/ { "mh" ,  264 },
-    /*0606*/ { "mi" ,  269 },
-    /*0607*/ { "mk" ,  261 },
-    /*0608*/ { "ml" ,  267 },
-    /*0609*/ { "mn" ,  288 },
-    /*0610*/ { "mr" ,  271 },
-    /*0611*/ { "ms" ,  273 },
-    /*0612*/ { "mt" ,  283 },
-    /*0613*/ { "my" ,   65 },
-    /*0614*/ { "na" ,  300 },
-    /*0615*/ { "nb" ,  312 },
-    /*0616*/ { "nd" ,  303 },
-    /*0617*/ { "ne" ,  306 },
-    /*0618*/ { "ng" ,  304 },
-    /*0619*/ { "nl" ,  115 },
-    /*0620*/ { "nn" ,  311 },
-    /*0621*/ { "no" ,  315 },
-    /*0622*/ { "nr" ,  302 },
-    /*0623*/ { "nv" ,  301 },
-    /*0624*/ { "ny" ,  320 },
-    /*0625*/ { "oc" ,  325 },
-    /*0626*/ { "oj" ,  326 },
-    /*0627*/ { "om" ,  328 },
-    /*0628*/ { "or" ,  327 },
-    /*0629*/ { "os" ,  330 },
-    /*0630*/ { "pa" ,  337 },
-    /*0631*/ { "pi" ,  344 },
-    /*0632*/ { "pl" ,  345 },
-    /*0633*/ { "ps" ,  350 },
-    /*0634*/ { "pt" ,  347 },
-    /*0635*/ { "qu" ,  351 },
-    /*0636*/ { "rm" ,  356 },
-    /*0637*/ { "rn" ,  359 },
-    /*0638*/ { "ro" ,  358 },
-    /*0639*/ { "ru" ,  361 },
-    /*0640*/ { "rw" ,  224 },
-    /*0641*/ { "sa" ,  368 },
-    /*0642*/ { "sc" ,  400 },
-    /*0643*/ { "sd" ,  393 },
-    /*0644*/ { "se" ,  386 },
-    /*0645*/ { "sg" ,  363 },
-    /*0646*/ { "si" ,  379 },
-    /*0647*/ { "sk" ,  383 },
-    /*0648*/ { "sl" ,  384 },
-    /*0649*/ { "sm" ,  390 },
-    /*0650*/ { "sn" ,  392 },
-    /*0651*/ { "so" ,  396 },
-    /*0652*/ { "sq" ,   12 },
-    /*0653*/ { "sr" ,  402 },
-    /*0654*/ { "ss" ,  405 },
-    /*0655*/ { "st" ,  398 },
-    /*0656*/ { "su" ,  407 },
-    /*0657*/ { "sv" ,  411 },
-    /*0658*/ { "sw" ,  410 },
-    /*0659*/ { "ta" ,  416 },
-    /*0660*/ { "te" ,  418 },
-    /*0661*/ { "tg" ,  422 },
-    /*0662*/ { "th" ,  424 },
-    /*0663*/ { "ti" ,  427 },
-    /*0664*/ { "tk" ,  439 },
-    /*0665*/ { "tl" ,  423 },
-    /*0666*/ { "tn" ,  437 },
-    /*0667*/ { "to" ,  434 },
-    /*0668*/ { "tr" ,  442 },
-    /*0669*/ { "ts" ,  438 },
-    /*0670*/ { "tt" ,  417 },
-    /*0671*/ { "tw" ,  445 },
-    /*0672*/ { "ty" ,  414 },
-    /*0673*/ { "ug" ,  449 },
-    /*0674*/ { "uk" ,  450 },
-    /*0675*/ { "ur" ,  453 },
-    /*0676*/ { "uz" ,  454 },
-    /*0677*/ { "ve" ,  456 },
-    /*0678*/ { "vi" ,  457 },
-    /*0679*/ { "vo" ,  458 },
-    /*0680*/ { "wa" ,  466 },
-    /*0681*/ { "wo" ,  467 },
-    /*0682*/ { "xh" ,  469 },
-    /*0683*/ { "yi" ,  472 },
-    /*0684*/ { "yo" ,  473 },
-    /*0685*/ { "za" ,  478 },
-    /*0686*/ { "zh" ,   78 },
-    /*0687*/ { "zu" ,  480 },
-    { "", 0 }
-};
-
-static int lang_table_compare(const void *lhs, const void *rhs)
-{
-    return strcmp(lhs, ((const LangEntry *)rhs)->str);
-}
-
-const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
-{
-    int i;
-    const LangEntry *entry = NULL;
-    const int NB_CODESPACES = sizeof(lang_table_counts)/sizeof(*lang_table_counts);
-
-    if (target_codespace >= NB_CODESPACES)
-        return NULL;
-
-    for (i=0; !entry && i<NB_CODESPACES; i++)
-        entry = bsearch(lang,
-                        lang_table + lang_table_offsets[i],
-                        lang_table_counts[i],
-                        sizeof(LangEntry),
-                        lang_table_compare);
-    if (!entry)
-        return NULL;
-
-    for (i=0; i<NB_CODESPACES; i++)
-        if (entry >= lang_table + lang_table_offsets[target_codespace] &&
-            entry < lang_table + lang_table_offsets[target_codespace] + lang_table_counts[target_codespace])
-            return entry->str;
-        else
-            entry = lang_table + entry->next_equivalent;
-
-    if (target_codespace == AV_LANG_ISO639_2_TERM)
-        return av_convert_lang_to(lang, AV_LANG_ISO639_2_BIBL);
-
-    return NULL;
-}
diff --git a/libavformat/avlanguage.h b/libavformat/avlanguage.h
deleted file mode 100644
index eac0031..0000000
--- a/libavformat/avlanguage.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Cyril Comparon, Larbi Joubala, Resonate-MP4 2009
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_AVLANGUAGE_H
-#define AVFORMAT_AVLANGUAGE_H
-
-/**
- * Known language codespaces
- */
-enum AVLangCodespace {
-    AV_LANG_ISO639_2_BIBL, /** 3-char bibliographic language codes as per ISO-IEC 639-2 */
-    AV_LANG_ISO639_2_TERM, /** 3-char terminologic language codes as per ISO-IEC 639-2 */
-    AV_LANG_ISO639_1       /** 2-char code of language as per ISO/IEC 639-1 */
-};
-
-/**
- * Converts a language code to a target codespace. The source codespace is guessed.
- * Returns NULL if the provided lang is null or invalid.
- */
-const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace);
-
-#endif /* AVFORMAT_AVLANGUAGE_H */
diff --git a/libavformat/avs.c b/libavformat/avs.c
deleted file mode 100644
index caf3a89..0000000
--- a/libavformat/avs.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * AVS demuxer.
- * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "voc.h"
-
-
-typedef struct avs_format {
-    VocDecContext voc;
-    AVStream *st_video;
-    AVStream *st_audio;
-    int width;
-    int height;
-    int bits_per_sample;
-    int fps;
-    int nb_frames;
-    int remaining_frame_size;
-    int remaining_audio_size;
-} AvsFormat;
-
-typedef enum avs_block_type {
-    AVS_NONE      = 0x00,
-    AVS_VIDEO     = 0x01,
-    AVS_AUDIO     = 0x02,
-    AVS_PALETTE   = 0x03,
-    AVS_GAME_DATA = 0x04,
-} AvsBlockType;
-
-static int avs_probe(AVProbeData * p)
-{
-    const uint8_t *d;
-
-    d = p->buf;
-    if (d[0] == 'w' && d[1] == 'W' && d[2] == 0x10 && d[3] == 0)
-        return 50;
-
-    return 0;
-}
-
-static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
-{
-    AvsFormat *avs = s->priv_data;
-
-    s->ctx_flags |= AVFMTCTX_NOHEADER;
-
-    url_fskip(s->pb, 4);
-    avs->width = get_le16(s->pb);
-    avs->height = get_le16(s->pb);
-    avs->bits_per_sample = get_le16(s->pb);
-    avs->fps = get_le16(s->pb);
-    avs->nb_frames = get_le32(s->pb);
-    avs->remaining_frame_size = 0;
-    avs->remaining_audio_size = 0;
-
-    avs->st_video = avs->st_audio = NULL;
-
-    if (avs->width != 318 || avs->height != 198)
-        av_log(s, AV_LOG_ERROR, "This avs pretend to be %dx%d "
-               "when the avs format is supposed to be 318x198 only.\n",
-               avs->width, avs->height);
-
-    return 0;
-}
-
-static int
-avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
-                      AvsBlockType type, int sub_type, int size,
-                      uint8_t * palette, int palette_size)
-{
-    AvsFormat *avs = s->priv_data;
-    int ret;
-
-    ret = av_new_packet(pkt, size + palette_size);
-    if (ret < 0)
-        return ret;
-
-    if (palette_size) {
-        pkt->data[0] = 0x00;
-        pkt->data[1] = 0x03;
-        pkt->data[2] = palette_size & 0xFF;
-        pkt->data[3] = (palette_size >> 8) & 0xFF;
-        memcpy(pkt->data + 4, palette, palette_size - 4);
-    }
-
-    pkt->data[palette_size + 0] = sub_type;
-    pkt->data[palette_size + 1] = type;
-    pkt->data[palette_size + 2] = size & 0xFF;
-    pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
-    ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
-    if (ret < size) {
-        av_free_packet(pkt);
-        return AVERROR(EIO);
-    }
-
-    pkt->size = ret + palette_size;
-    pkt->stream_index = avs->st_video->index;
-    if (sub_type == 0)
-        pkt->flags |= AV_PKT_FLAG_KEY;
-
-    return 0;
-}
-
-static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
-{
-    AvsFormat *avs = s->priv_data;
-    int ret, size;
-
-    size = url_ftell(s->pb);
-    ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
-    size = url_ftell(s->pb) - size;
-    avs->remaining_audio_size -= size;
-
-    if (ret == AVERROR(EIO))
-        return 0;    /* this indicate EOS */
-    if (ret < 0)
-        return ret;
-
-    pkt->stream_index = avs->st_audio->index;
-    pkt->flags |= AV_PKT_FLAG_KEY;
-
-    return size;
-}
-
-static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
-{
-    AvsFormat *avs = s->priv_data;
-    int sub_type = 0, size = 0;
-    AvsBlockType type = AVS_NONE;
-    int palette_size = 0;
-    uint8_t palette[4 + 3 * 256];
-    int ret;
-
-    if (avs->remaining_audio_size > 0)
-        if (avs_read_audio_packet(s, pkt) > 0)
-            return 0;
-
-    while (1) {
-        if (avs->remaining_frame_size <= 0) {
-            if (!get_le16(s->pb))    /* found EOF */
-                return AVERROR(EIO);
-            avs->remaining_frame_size = get_le16(s->pb) - 4;
-        }
-
-        while (avs->remaining_frame_size > 0) {
-            sub_type = get_byte(s->pb);
-            type = get_byte(s->pb);
-            size = get_le16(s->pb);
-            avs->remaining_frame_size -= size;
-
-            switch (type) {
-            case AVS_PALETTE:
-                ret = get_buffer(s->pb, palette, size - 4);
-                if (ret < size - 4)
-                    return AVERROR(EIO);
-                palette_size = size;
-                break;
-
-            case AVS_VIDEO:
-                if (!avs->st_video) {
-                    avs->st_video = av_new_stream(s, AVS_VIDEO);
-                    if (avs->st_video == NULL)
-                        return AVERROR(ENOMEM);
-                    avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-                    avs->st_video->codec->codec_id = CODEC_ID_AVS;
-                    avs->st_video->codec->width = avs->width;
-                    avs->st_video->codec->height = avs->height;
-                    avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;
-                    avs->st_video->nb_frames = avs->nb_frames;
-                    avs->st_video->codec->time_base = (AVRational) {
-                    1, avs->fps};
-                }
-                return avs_read_video_packet(s, pkt, type, sub_type, size,
-                                             palette, palette_size);
-
-            case AVS_AUDIO:
-                if (!avs->st_audio) {
-                    avs->st_audio = av_new_stream(s, AVS_AUDIO);
-                    if (avs->st_audio == NULL)
-                        return AVERROR(ENOMEM);
-                    avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-                }
-                avs->remaining_audio_size = size - 4;
-                size = avs_read_audio_packet(s, pkt);
-                if (size != 0)
-                    return size;
-                break;
-
-            default:
-                url_fskip(s->pb, size - 4);
-            }
-        }
-    }
-}
-
-static int avs_read_close(AVFormatContext * s)
-{
-    return 0;
-}
-
-AVInputFormat avs_demuxer = {
-    "avs",
-    NULL_IF_CONFIG_SMALL("AVS format"),
-    sizeof(AvsFormat),
-    avs_probe,
-    avs_read_header,
-    avs_read_packet,
-    avs_read_close,
-};
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
deleted file mode 100644
index 4f9d1c1..0000000
--- a/libavformat/bethsoftvid.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Bethsoft VID format Demuxer
- * Copyright (c) 2007 Nicholas Tung
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Bethesda Softworks VID (.vid) file demuxer
- * @author Nicholas Tung [ntung (at. ntung com] (2007-03)
- * @sa http://wiki.multimedia.cx/index.php?title=Bethsoft_VID
- * @sa http://www.svatopluk.com/andux/docs/dfvid.html
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "libavcodec/bethsoftvideo.h"
-
-typedef struct BVID_DemuxContext
-{
-    int nframes;
-    /** delay value between frames, added to individual frame delay.
-     * custom units, which will be added to other custom units (~=16ms according
-     * to free, unofficial documentation) */
-    int bethsoft_global_delay;
-
-    /** video presentation time stamp.
-     * delay = 16 milliseconds * (global_delay + per_frame_delay) */
-    int video_pts;
-
-    int is_finished;
-
-} BVID_DemuxContext;
-
-static int vid_probe(AVProbeData *p)
-{
-    // little endian VID tag, file starts with "VID\0"
-    if (AV_RL32(p->buf) != MKTAG('V', 'I', 'D', 0))
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int vid_read_header(AVFormatContext *s,
-                            AVFormatParameters *ap)
-{
-    BVID_DemuxContext *vid = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *stream;
-
-    /* load main header. Contents:
-    *    bytes: 'V' 'I' 'D'
-    *    int16s: always_512, nframes, width, height, delay, always_14
-    */
-    url_fseek(pb, 5, SEEK_CUR);
-    vid->nframes = get_le16(pb);
-
-    stream = av_new_stream(s, 0);
-    if (!stream)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(stream, 32, 1, 60);     // 16 ms increments, i.e. 60 fps
-    stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
-    stream->codec->width = get_le16(pb);
-    stream->codec->height = get_le16(pb);
-    stream->codec->pix_fmt = PIX_FMT_PAL8;
-    vid->bethsoft_global_delay = get_le16(pb);
-    get_le16(pb);
-
-    // done with video codec, set up audio codec
-    stream = av_new_stream(s, 0);
-    if (!stream)
-        return AVERROR(ENOMEM);
-    stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    stream->codec->codec_id = CODEC_ID_PCM_U8;
-    stream->codec->channels = 1;
-    stream->codec->sample_rate = 11025;
-    stream->codec->bits_per_coded_sample = 8;
-    stream->codec->bit_rate = stream->codec->channels * stream->codec->sample_rate * stream->codec->bits_per_coded_sample;
-
-    return 0;
-}
-
-#define BUFFER_PADDING_SIZE 1000
-static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
-                      uint8_t block_type, AVFormatContext *s, int npixels)
-{
-    uint8_t * vidbuf_start = NULL;
-    int vidbuf_nbytes = 0;
-    int code;
-    int bytes_copied = 0;
-    int position;
-    unsigned int vidbuf_capacity;
-
-    vidbuf_start = av_malloc(vidbuf_capacity = BUFFER_PADDING_SIZE);
-    if(!vidbuf_start)
-        return AVERROR(ENOMEM);
-
-    // save the file position for the packet, include block type
-    position = url_ftell(pb) - 1;
-
-    vidbuf_start[vidbuf_nbytes++] = block_type;
-
-    // get the video delay (next int16), and set the presentation time
-    vid->video_pts += vid->bethsoft_global_delay + get_le16(pb);
-
-    // set the y offset if it exists (decoder header data should be in data section)
-    if(block_type == VIDEO_YOFF_P_FRAME){
-        if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
-            goto fail;
-        vidbuf_nbytes += 2;
-    }
-
-    do{
-        vidbuf_start = av_fast_realloc(vidbuf_start, &vidbuf_capacity, vidbuf_nbytes + BUFFER_PADDING_SIZE);
-        if(!vidbuf_start)
-            return AVERROR(ENOMEM);
-
-        code = get_byte(pb);
-        vidbuf_start[vidbuf_nbytes++] = code;
-
-        if(code >= 0x80){ // rle sequence
-            if(block_type == VIDEO_I_FRAME)
-                vidbuf_start[vidbuf_nbytes++] = get_byte(pb);
-        } else if(code){ // plain sequence
-            if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
-                goto fail;
-            vidbuf_nbytes += code;
-        }
-        bytes_copied += code & 0x7F;
-        if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied
-            // may contain a 0 byte even if read all pixels
-            if(get_byte(pb))
-                url_fseek(pb, -1, SEEK_CUR);
-            break;
-        }
-        if(bytes_copied > npixels)
-            goto fail;
-    } while(code);
-
-    // copy data into packet
-    if(av_new_packet(pkt, vidbuf_nbytes) < 0)
-        goto fail;
-    memcpy(pkt->data, vidbuf_start, vidbuf_nbytes);
-    av_free(vidbuf_start);
-
-    pkt->pos = position;
-    pkt->stream_index = 0;  // use the video decoder, which was initialized as the first stream
-    pkt->pts = vid->video_pts;
-
-    vid->nframes--;  // used to check if all the frames were read
-    return vidbuf_nbytes;
-fail:
-    av_free(vidbuf_start);
-    return -1;
-}
-
-static int vid_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    BVID_DemuxContext *vid = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned char block_type;
-    int audio_length;
-    int ret_value;
-
-    if(vid->is_finished || url_feof(pb))
-        return AVERROR(EIO);
-
-    block_type = get_byte(pb);
-    switch(block_type){
-        case PALETTE_BLOCK:
-            url_fseek(pb, -1, SEEK_CUR);     // include block type
-            ret_value = av_get_packet(pb, pkt, 3 * 256 + 1);
-            if(ret_value != 3 * 256 + 1){
-                av_free_packet(pkt);
-                return AVERROR(EIO);
-            }
-            pkt->stream_index = 0;
-            return ret_value;
-
-        case FIRST_AUDIO_BLOCK:
-            get_le16(pb);
-            // soundblaster DAC used for sample rate, as on specification page (link above)
-            s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
-            s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
-        case AUDIO_BLOCK:
-            audio_length = get_le16(pb);
-            ret_value = av_get_packet(pb, pkt, audio_length);
-            pkt->stream_index = 1;
-            return ret_value != audio_length ? AVERROR(EIO) : ret_value;
-
-        case VIDEO_P_FRAME:
-        case VIDEO_YOFF_P_FRAME:
-        case VIDEO_I_FRAME:
-            return read_frame(vid, pb, pkt, block_type, s,
-                              s->streams[0]->codec->width * s->streams[0]->codec->height);
-
-        case EOF_BLOCK:
-            if(vid->nframes != 0)
-                av_log(s, AV_LOG_VERBOSE, "reached terminating character but not all frames read.\n");
-            vid->is_finished = 1;
-            return AVERROR(EIO);
-        default:
-            av_log(s, AV_LOG_ERROR, "unknown block (character = %c, decimal = %d, hex = %x)!!!\n",
-                   block_type, block_type, block_type); return -1;
-    }
-
-    return 0;
-}
-
-AVInputFormat bethsoftvid_demuxer = {
-    "bethsoftvid",
-    NULL_IF_CONFIG_SMALL("Bethesda Softworks VID format"),
-    sizeof(BVID_DemuxContext),
-    vid_probe,
-    vid_read_header,
-    vid_read_packet,
-};
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
deleted file mode 100644
index 94014a4..0000000
--- a/libavformat/bfi.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Brute Force & Ignorance (BFI) demuxer
- * Copyright (c) 2008 Sisir Koppaka
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Brute Force & Ignorance (.bfi) file demuxer
- * @author Sisir Koppaka ( sisir.koppaka at gmail dot com )
- * @sa http://wiki.multimedia.cx/index.php?title=BFI
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-typedef struct BFIContext {
-    int nframes;
-    int audio_frame;
-    int video_frame;
-    int video_size;
-    int avflag;
-} BFIContext;
-
-static int bfi_probe(AVProbeData * p)
-{
-    /* Check file header */
-    if (AV_RL32(p->buf) == MKTAG('B', 'F', '&', 'I'))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
-{
-    BFIContext *bfi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *vstream;
-    AVStream *astream;
-    int fps, chunk_header;
-
-    /* Initialize the video codec... */
-    vstream = av_new_stream(s, 0);
-    if (!vstream)
-        return AVERROR(ENOMEM);
-
-    /* Initialize the audio codec... */
-    astream = av_new_stream(s, 0);
-    if (!astream)
-        return AVERROR(ENOMEM);
-
-    /* Set the total number of frames. */
-    url_fskip(pb, 8);
-    chunk_header           = get_le32(pb);
-    bfi->nframes           = get_le32(pb);
-    get_le32(pb);
-    get_le32(pb);
-    get_le32(pb);
-    fps                    = get_le32(pb);
-    url_fskip(pb, 12);
-    vstream->codec->width  = get_le32(pb);
-    vstream->codec->height = get_le32(pb);
-
-    /*Load the palette to extradata */
-    url_fskip(pb, 8);
-    vstream->codec->extradata      = av_malloc(768);
-    vstream->codec->extradata_size = 768;
-    get_buffer(pb, vstream->codec->extradata,
-               vstream->codec->extradata_size);
-
-    astream->codec->sample_rate = get_le32(pb);
-
-    /* Set up the video codec... */
-    av_set_pts_info(vstream, 32, 1, fps);
-    vstream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vstream->codec->codec_id   = CODEC_ID_BFI;
-    vstream->codec->pix_fmt    = PIX_FMT_PAL8;
-
-    /* Set up the audio codec now... */
-    astream->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
-    astream->codec->codec_id        = CODEC_ID_PCM_U8;
-    astream->codec->channels        = 1;
-    astream->codec->bits_per_coded_sample = 8;
-    astream->codec->bit_rate        =
-        astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
-    url_fseek(pb, chunk_header - 3, SEEK_SET);
-    av_set_pts_info(astream, 64, 1, astream->codec->sample_rate);
-    return 0;
-}
-
-
-static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
-{
-    BFIContext *bfi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
-    if (bfi->nframes == 0 || url_feof(pb)) {
-        return AVERROR(EIO);
-    }
-
-    /* If all previous chunks were completely read, then find a new one... */
-    if (!bfi->avflag) {
-        uint32_t state = 0;
-        while(state != MKTAG('S','A','V','I')){
-            if (url_feof(pb))
-                return AVERROR(EIO);
-            state = 256*state + get_byte(pb);
-        }
-        /* Now that the chunk's location is confirmed, we proceed... */
-        chunk_size      = get_le32(pb);
-        get_le32(pb);
-        audio_offset    = get_le32(pb);
-        get_le32(pb);
-        video_offset    = get_le32(pb);
-        audio_size      = video_offset - audio_offset;
-        bfi->video_size = chunk_size - video_offset;
-
-        //Tossing an audio packet at the audio decoder.
-        ret = av_get_packet(pb, pkt, audio_size);
-        if (ret < 0)
-            return ret;
-
-        pkt->pts          = bfi->audio_frame;
-        bfi->audio_frame += ret;
-    }
-
-    else {
-
-        //Tossing a video packet at the video decoder.
-        ret = av_get_packet(pb, pkt, bfi->video_size);
-        if (ret < 0)
-            return ret;
-
-        pkt->pts          = bfi->video_frame;
-        bfi->video_frame += ret / bfi->video_size;
-
-        /* One less frame to read. A cursory decrement. */
-        bfi->nframes--;
-    }
-
-    bfi->avflag       = !bfi->avflag;
-    pkt->stream_index = bfi->avflag;
-    return ret;
-}
-
-AVInputFormat bfi_demuxer = {
-    "bfi",
-    NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"),
-    sizeof(BFIContext),
-    bfi_probe,
-    bfi_read_header,
-    bfi_read_packet,
-};
diff --git a/libavformat/bink.c b/libavformat/bink.c
deleted file mode 100644
index afa629f..0000000
--- a/libavformat/bink.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Bink demuxer
- * Copyright (c) 2008-2010 Peter Ross (pross at xvid.org)
- * Copyright (c) 2009 Daniel Verkamp (daniel at drv.nu)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Bink demuxer
- *
- * Technical details here:
- *  http://wiki.multimedia.cx/index.php?title=Bink_Container
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-enum BinkAudFlags {
-    BINK_AUD_16BITS = 0x4000, ///< prefer 16-bit output
-    BINK_AUD_STEREO = 0x2000,
-    BINK_AUD_USEDCT = 0x1000,
-};
-
-#define BINK_EXTRADATA_SIZE     1
-#define BINK_MAX_AUDIO_TRACKS   256
-#define BINK_MAX_WIDTH          7680
-#define BINK_MAX_HEIGHT         4800
-
-typedef struct {
-    uint32_t file_size;
-
-    uint32_t num_audio_tracks;
-    int current_track;      ///< audio track to return in next packet
-    int64_t video_pts;
-    int64_t audio_pts[BINK_MAX_AUDIO_TRACKS];
-
-    uint32_t remain_packet_size;
-} BinkDemuxContext;
-
-static int probe(AVProbeData *p)
-{
-    const uint8_t *b = p->buf;
-
-    if ( b[0] == 'B' && b[1] == 'I' && b[2] == 'K' &&
-        (b[3] == 'b' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || b[3] == 'i') &&
-        AV_RL32(b+8) > 0 &&  // num_frames
-        AV_RL32(b+20) > 0 && AV_RL32(b+20) <= BINK_MAX_WIDTH &&
-        AV_RL32(b+24) > 0 && AV_RL32(b+24) <= BINK_MAX_HEIGHT &&
-        AV_RL32(b+28) > 0 && AV_RL32(b+32) > 0)  // fps num,den
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    BinkDemuxContext *bink = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint32_t fps_num, fps_den;
-    AVStream *vst, *ast;
-    unsigned int i;
-    uint32_t pos, next_pos;
-    uint16_t flags;
-    int keyframe;
-
-    vst = av_new_stream(s, 0);
-    if (!vst)
-        return AVERROR(ENOMEM);
-
-    vst->codec->codec_tag = get_le32(pb);
-
-    bink->file_size = get_le32(pb) + 8;
-    vst->duration   = get_le32(pb);
-
-    if (vst->duration > 1000000) {
-        av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n");
-        return AVERROR(EIO);
-    }
-
-    if (get_le32(pb) > bink->file_size) {
-        av_log(s, AV_LOG_ERROR,
-               "invalid header: largest frame size greater than file size\n");
-        return AVERROR(EIO);
-    }
-
-    url_fskip(pb, 4);
-
-    vst->codec->width  = get_le32(pb);
-    vst->codec->height = get_le32(pb);
-
-    fps_num = get_le32(pb);
-    fps_den = get_le32(pb);
-    if (fps_num == 0 || fps_den == 0) {
-        av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den);
-        return AVERROR(EIO);
-    }
-    av_set_pts_info(vst, 64, fps_den, fps_num);
-
-    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id   = CODEC_ID_BINKVIDEO;
-    vst->codec->extradata  = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
-    vst->codec->extradata_size = 4;
-    get_buffer(pb, vst->codec->extradata, 4);
-
-    bink->num_audio_tracks = get_le32(pb);
-
-    if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) {
-        av_log(s, AV_LOG_ERROR,
-               "invalid header: more than "AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)" audio tracks (%d)\n",
-               bink->num_audio_tracks);
-        return AVERROR(EIO);
-    }
-
-    if (bink->num_audio_tracks) {
-        url_fskip(pb, 4 * bink->num_audio_tracks);
-
-        for (i = 0; i < bink->num_audio_tracks; i++) {
-            ast = av_new_stream(s, 1);
-            if (!ast)
-                return AVERROR(ENOMEM);
-            ast->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-            ast->codec->codec_tag   = 0;
-            ast->codec->sample_rate = get_le16(pb);
-            av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
-            flags = get_le16(pb);
-            ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
-                                   CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
-            ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
-        }
-
-        url_fskip(pb, 4 * bink->num_audio_tracks);
-    }
-
-    /* frame index table */
-    next_pos = get_le32(pb);
-    for (i = 0; i < vst->duration; i++) {
-        pos = next_pos;
-        if (i == vst->duration - 1) {
-            next_pos = bink->file_size;
-            keyframe = 0;
-        } else {
-            next_pos = get_le32(pb);
-            keyframe = pos & 1;
-        }
-        pos &= ~1;
-        next_pos &= ~1;
-
-        if (next_pos <= pos) {
-            av_log(s, AV_LOG_ERROR, "invalid frame index table\n");
-            return AVERROR(EIO);
-        }
-        av_add_index_entry(vst, pos, i, next_pos - pos, 0,
-                           keyframe ? AVINDEX_KEYFRAME : 0);
-    }
-
-    url_fskip(pb, 4);
-
-    bink->current_track = -1;
-    return 0;
-}
-
-static int read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    BinkDemuxContext *bink = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret;
-
-    if (bink->current_track < 0) {
-        int index_entry;
-        AVStream *st = s->streams[0]; // stream 0 is video stream with index
-
-        if (bink->video_pts >= st->duration)
-            return AVERROR(EIO);
-
-        index_entry = av_index_search_timestamp(st, bink->video_pts,
-                                                AVSEEK_FLAG_ANY);
-        if (index_entry < 0) {
-            av_log(s, AV_LOG_ERROR,
-                   "could not find index entry for frame %"PRId64"\n",
-                   bink->video_pts);
-            return AVERROR(EIO);
-        }
-
-        bink->remain_packet_size = st->index_entries[index_entry].size;
-        bink->current_track = 0;
-    }
-
-    while (bink->current_track < bink->num_audio_tracks) {
-        uint32_t audio_size = get_le32(pb);
-        if (audio_size > bink->remain_packet_size - 4) {
-            av_log(s, AV_LOG_ERROR,
-                   "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n",
-                   bink->video_pts, audio_size, bink->remain_packet_size);
-            return AVERROR(EIO);
-        }
-        bink->remain_packet_size -= 4 + audio_size;
-        bink->current_track++;
-        if (audio_size >= 4) {
-            /* get one audio packet per track */
-            if ((ret = av_get_packet(pb, pkt, audio_size)) < 0)
-                return ret;
-            pkt->stream_index = bink->current_track;
-            pkt->pts = bink->audio_pts[bink->current_track - 1];
-
-            /* Each audio packet reports the number of decompressed samples
-               (in bytes). We use this value to calcuate the audio PTS */
-            if (pkt->size >= 4)
-                bink->audio_pts[bink->current_track -1] +=
-                    AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
-            return 0;
-        } else {
-            url_fseek(pb, audio_size, SEEK_CUR);
-        }
-    }
-
-    /* get video packet */
-    if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size)) < 0)
-        return ret;
-    pkt->stream_index = 0;
-    pkt->pts = bink->video_pts++;
-    pkt->flags |= AV_PKT_FLAG_KEY;
-
-    /* -1 instructs the next call to read_packet() to read the next frame */
-    bink->current_track = -1;
-
-    return 0;
-}
-
-static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    BinkDemuxContext *bink = s->priv_data;
-    AVStream *vst = s->streams[0];
-
-    if (url_is_streamed(s->pb))
-        return -1;
-
-    /* seek to the first frame */
-    url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET);
-    bink->video_pts = 0;
-    memset(bink->audio_pts, 0, sizeof(bink->audio_pts));
-    bink->current_track = -1;
-    return 0;
-}
-
-AVInputFormat bink_demuxer = {
-    "bink",
-    NULL_IF_CONFIG_SMALL("Bink"),
-    sizeof(BinkDemuxContext),
-    probe,
-    read_header,
-    read_packet,
-    NULL,
-    read_seek,
-};
diff --git a/libavformat/c93.c b/libavformat/c93.c
deleted file mode 100644
index 033b36b..0000000
--- a/libavformat/c93.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Interplay C93 demuxer
- * Copyright (c) 2007 Anssi Hannula <anssi.hannula at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "voc.h"
-#include "libavutil/intreadwrite.h"
-
-typedef struct {
-    uint16_t index;
-    uint8_t length;
-    uint8_t frames;
-} C93BlockRecord;
-
-typedef struct {
-    VocDecContext voc;
-
-    C93BlockRecord block_records[512];
-    int current_block;
-
-    uint32_t frame_offsets[32];
-    int current_frame;
-    int next_pkt_is_audio;
-
-    AVStream *audio;
-} C93DemuxContext;
-
-static int probe(AVProbeData *p)
-{
-    int i;
-    int index = 1;
-    if (p->buf_size < 16)
-        return 0;
-    for (i = 0; i < 16; i += 4) {
-        if (AV_RL16(p->buf + i) != index || !p->buf[i + 2] || !p->buf[i + 3])
-            return 0;
-        index += p->buf[i + 2];
-    }
-    return AVPROBE_SCORE_MAX;
-}
-
-static int read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    AVStream *video;
-    ByteIOContext *pb = s->pb;
-    C93DemuxContext *c93 = s->priv_data;
-    int i;
-    int framecount = 0;
-
-    for (i = 0; i < 512; i++) {
-        c93->block_records[i].index = get_le16(pb);
-        c93->block_records[i].length = get_byte(pb);
-        c93->block_records[i].frames = get_byte(pb);
-        if (c93->block_records[i].frames > 32) {
-            av_log(s, AV_LOG_ERROR, "too many frames in block\n");
-            return AVERROR_INVALIDDATA;
-        }
-        framecount += c93->block_records[i].frames;
-    }
-
-    /* Audio streams are added if audio packets are found */
-    s->ctx_flags |= AVFMTCTX_NOHEADER;
-
-    video = av_new_stream(s, 0);
-    if (!video)
-        return AVERROR(ENOMEM);
-
-    video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    video->codec->codec_id = CODEC_ID_C93;
-    video->codec->width = 320;
-    video->codec->height = 192;
-    /* 4:3 320x200 with 8 empty lines */
-    video->sample_aspect_ratio = (AVRational) { 5, 6 };
-    video->time_base = (AVRational) { 2, 25 };
-    video->nb_frames = framecount;
-    video->duration = framecount;
-    video->start_time = 0;
-
-    c93->current_block = 0;
-    c93->current_frame = 0;
-    c93->next_pkt_is_audio = 0;
-    return 0;
-}
-
-#define C93_HAS_PALETTE 0x01
-#define C93_FIRST_FRAME 0x02
-
-static int read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    C93DemuxContext *c93 = s->priv_data;
-    C93BlockRecord *br = &c93->block_records[c93->current_block];
-    int datasize;
-    int ret, i;
-
-    if (c93->next_pkt_is_audio) {
-        c93->current_frame++;
-        c93->next_pkt_is_audio = 0;
-        datasize = get_le16(pb);
-        if (datasize > 42) {
-            if (!c93->audio) {
-                c93->audio = av_new_stream(s, 1);
-                if (!c93->audio)
-                    return AVERROR(ENOMEM);
-                c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            }
-            url_fskip(pb, 26); /* VOC header */
-            ret = voc_get_packet(s, pkt, c93->audio, datasize - 26);
-            if (ret > 0) {
-                pkt->stream_index = 1;
-                pkt->flags |= AV_PKT_FLAG_KEY;
-                return ret;
-            }
-        }
-    }
-    if (c93->current_frame >= br->frames) {
-        if (c93->current_block >= 511 || !br[1].length)
-            return AVERROR(EIO);
-        br++;
-        c93->current_block++;
-        c93->current_frame = 0;
-    }
-
-    if (c93->current_frame == 0) {
-        url_fseek(pb, br->index * 2048, SEEK_SET);
-        for (i = 0; i < 32; i++) {
-            c93->frame_offsets[i] = get_le32(pb);
-        }
-    }
-
-    url_fseek(pb,br->index * 2048 +
-            c93->frame_offsets[c93->current_frame], SEEK_SET);
-    datasize = get_le16(pb); /* video frame size */
-
-    ret = av_new_packet(pkt, datasize + 768 + 1);
-    if (ret < 0)
-        return ret;
-    pkt->data[0] = 0;
-    pkt->size = datasize + 1;
-
-    ret = get_buffer(pb, pkt->data + 1, datasize);
-    if (ret < datasize) {
-        ret = AVERROR(EIO);
-        goto fail;
-    }
-
-    datasize = get_le16(pb); /* palette size */
-    if (datasize) {
-        if (datasize != 768) {
-            av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize);
-            ret = AVERROR_INVALIDDATA;
-            goto fail;
-        }
-        pkt->data[0] |= C93_HAS_PALETTE;
-        ret = get_buffer(pb, pkt->data + pkt->size, datasize);
-        if (ret < datasize) {
-            ret = AVERROR(EIO);
-            goto fail;
-        }
-        pkt->size += 768;
-    }
-    pkt->stream_index = 0;
-    c93->next_pkt_is_audio = 1;
-
-    /* only the first frame is guaranteed to not reference previous frames */
-    if (c93->current_block == 0 && c93->current_frame == 0) {
-        pkt->flags |= AV_PKT_FLAG_KEY;
-        pkt->data[0] |= C93_FIRST_FRAME;
-    }
-    return 0;
-
-    fail:
-    av_free_packet(pkt);
-    return ret;
-}
-
-AVInputFormat c93_demuxer = {
-    "c93",
-    NULL_IF_CONFIG_SMALL("Interplay C93"),
-    sizeof(C93DemuxContext),
-    probe,
-    read_header,
-    read_packet,
-};
diff --git a/libavformat/caf.c b/libavformat/caf.c
deleted file mode 100644
index a814ab0..0000000
--- a/libavformat/caf.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * CAF common code
- * Copyright (c) 2007  Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * CAF common code
- */
-
-#include "avformat.h"
-#include "riff.h"
-#include "caf.h"
-
-/**
- * Known codec tags for CAF
- */
-const AVCodecTag ff_codec_caf_tags[] = {
-    { CODEC_ID_AAC,             MKBETAG('a','a','c',' ') },
-    { CODEC_ID_AC3,             MKBETAG('a','c','-','3') },
-    { CODEC_ID_ALAC,            MKBETAG('a','l','a','c') },
-  /* FIXME: use DV demuxer, as done in MOV */
-  /*{ CODEC_ID_DVAUDIO,         MKBETAG('v','d','v','a') },*/
-  /*{ CODEC_ID_DVAUDIO,         MKBETAG('d','v','c','a') },*/
-    { CODEC_ID_ADPCM_IMA_QT,    MKBETAG('i','m','a','4') },
-    { CODEC_ID_MACE3,           MKBETAG('M','A','C','3') },
-    { CODEC_ID_MACE6,           MKBETAG('M','A','C','6') },
-    { CODEC_ID_MP3,             MKBETAG('.','m','p','3') },
-    { CODEC_ID_MP2,             MKBETAG('.','m','p','2') },
-    { CODEC_ID_MP1,             MKBETAG('.','m','p','1') },
-    { CODEC_ID_PCM_ALAW,        MKBETAG('a','l','a','w') },
-    { CODEC_ID_PCM_MULAW,       MKBETAG('u','l','a','w') },
-    { CODEC_ID_QCELP,           MKBETAG('Q','c','l','p') },
-    { CODEC_ID_QDM2,            MKBETAG('Q','D','M','2') },
-    { CODEC_ID_QDM2,            MKBETAG('Q','D','M','C') },
-  /* currently unsupported codecs */
-  /*{ AC-3 over S/PDIF          MKBETAG('c','a','c','3') },*/
-  /*{ MPEG4CELP                 MKBETAG('c','e','l','p') },*/
-  /*{ MPEG4HVXC                 MKBETAG('h','v','x','c') },*/
-  /*{ MPEG4TwinVQ               MKBETAG('t','w','v','q') },*/
-    { CODEC_ID_NONE,            0 },
-};
diff --git a/libavformat/caf.h b/libavformat/caf.h
deleted file mode 100644
index e1f93a6..0000000
--- a/libavformat/caf.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * CAF common code
- * Copyright (c) 2007  Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * CAF common code
- */
-
-#ifndef AVFORMAT_CAF_H
-#define AVFORMAT_CAF_H
-
-#include "riff.h"
-
-extern const AVCodecTag ff_codec_caf_tags[];
-
-#endif /* AVFORMAT_CAF_H */
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
deleted file mode 100644
index c020579..0000000
--- a/libavformat/cafdec.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Core Audio Format demuxer
- * Copyright (c) 2007 Justin Ruggles
- * Copyright (c) 2009 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Core Audio Format demuxer
- */
-
-#include "avformat.h"
-#include "riff.h"
-#include "isom.h"
-#include "libavutil/intreadwrite.h"
-#include "caf.h"
-
-typedef struct {
-    int bytes_per_packet;           ///< bytes in a packet, or 0 if variable
-    int frames_per_packet;          ///< frames in a packet, or 0 if variable
-    int64_t num_bytes;              ///< total number of bytes in stream
-
-    int64_t packet_cnt;             ///< packet counter
-    int64_t frame_cnt;              ///< frame counter
-
-    int64_t data_start;             ///< data start position, in bytes
-    int64_t data_size;              ///< raw data size, in bytes
-} CaffContext;
-
-static int probe(AVProbeData *p)
-{
-    if (AV_RB32(p->buf) == MKBETAG('c','a','f','f') && AV_RB16(&p->buf[4]) == 1)
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-/** Read audio description chunk */
-static int read_desc_chunk(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    CaffContext *caf  = s->priv_data;
-    AVStream *st;
-    int flags;
-
-    /* new audio stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    /* parse format description */
-    st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-    st->codec->sample_rate = av_int2dbl(get_be64(pb));
-    st->codec->codec_tag   = get_be32(pb);
-    flags = get_be32(pb);
-    caf->bytes_per_packet  = get_be32(pb);
-    st->codec->block_align = caf->bytes_per_packet;
-    caf->frames_per_packet = get_be32(pb);
-    st->codec->channels    = get_be32(pb);
-    st->codec->bits_per_coded_sample = get_be32(pb);
-
-    /* calculate bit rate for constant size packets */
-    if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
-        st->codec->bit_rate = (uint64_t)st->codec->sample_rate * (uint64_t)caf->bytes_per_packet * 8
-                              / (uint64_t)caf->frames_per_packet;
-    } else {
-        st->codec->bit_rate = 0;
-    }
-
-    /* determine codec */
-    if (st->codec->codec_tag == MKBETAG('l','p','c','m'))
-        st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, (flags ^ 0x2) | 0x4);
-    else
-        st->codec->codec_id = ff_codec_get_id(ff_codec_caf_tags, st->codec->codec_tag);
-    return 0;
-}
-
-/** Read magic cookie chunk */
-static int read_kuki_chunk(AVFormatContext *s, int64_t size)
-{
-    ByteIOContext *pb = s->pb;
-    AVStream *st      = s->streams[0];
-
-    if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
-        return -1;
-
-    if (st->codec->codec_id == CODEC_ID_AAC) {
-        /* The magic cookie format for AAC is an mp4 esds atom.
-           The lavc AAC decoder requires the data from the codec specific
-           description as extradata input. */
-        int strt, skip;
-        MOVAtom atom;
-
-        strt = url_ftell(pb);
-        ff_mov_read_esds(s, pb, atom);
-        skip = size - (url_ftell(pb) - strt);
-        if (skip < 0 || !st->codec->extradata ||
-            st->codec->codec_id != CODEC_ID_AAC) {
-            av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n");
-            return AVERROR_INVALIDDATA;
-        }
-        url_fskip(pb, skip);
-    } else {
-        st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
-        if (!st->codec->extradata)
-            return AVERROR(ENOMEM);
-        get_buffer(pb, st->codec->extradata, size);
-        st->codec->extradata_size = size;
-    }
-
-    return 0;
-}
-
-/** Read packet table chunk */
-static int read_pakt_chunk(AVFormatContext *s, int64_t size)
-{
-    ByteIOContext *pb = s->pb;
-    AVStream *st      = s->streams[0];
-    CaffContext *caf  = s->priv_data;
-    int64_t pos = 0, ccount;
-    int num_packets, i;
-
-    ccount = url_ftell(pb);
-
-    num_packets = get_be64(pb);
-    if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
-        return AVERROR_INVALIDDATA;
-
-    st->nb_frames  = get_be64(pb); /* valid frames */
-    st->nb_frames += get_be32(pb); /* priming frames */
-    st->nb_frames += get_be32(pb); /* remainder frames */
-
-    st->duration = 0;
-    for (i = 0; i < num_packets; i++) {
-        av_add_index_entry(s->streams[0], pos, st->duration, 0, 0, AVINDEX_KEYFRAME);
-        pos += caf->bytes_per_packet ? caf->bytes_per_packet : ff_mp4_read_descr_len(pb);
-        st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
-    }
-
-    if (url_ftell(pb) - ccount != size) {
-        av_log(s, AV_LOG_ERROR, "error reading packet table\n");
-        return -1;
-    }
-
-    caf->num_bytes = pos;
-    return 0;
-}
-
-/** Read information chunk */
-static void read_info_chunk(AVFormatContext *s, int64_t size)
-{
-    ByteIOContext *pb = s->pb;
-    unsigned int i;
-    unsigned int nb_entries = get_be32(pb);
-    for (i = 0; i < nb_entries; i++) {
-        char key[32];
-        char value[1024];
-        get_strz(pb, key, sizeof(key));
-        get_strz(pb, value, sizeof(value));
-        av_metadata_set2(&s->metadata, key, value, 0);
-    }
-}
-
-static int read_header(AVFormatContext *s,
-                       AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    CaffContext *caf  = s->priv_data;
-    AVStream *st;
-    uint32_t tag = 0;
-    int found_data, ret;
-    int64_t size;
-
-    url_fskip(pb, 8); /* magic, version, file flags */
-
-    /* audio description chunk */
-    if (get_be32(pb) != MKBETAG('d','e','s','c')) {
-        av_log(s, AV_LOG_ERROR, "desc chunk not present\n");
-        return AVERROR_INVALIDDATA;
-    }
-    size = get_be64(pb);
-    if (size != 32)
-        return AVERROR_INVALIDDATA;
-
-    ret = read_desc_chunk(s);
-    if (ret)
-        return ret;
-    st = s->streams[0];
-
-    /* parse each chunk */
-    found_data = 0;
-    while (!url_feof(pb)) {
-
-        /* stop at data chunk if seeking is not supported or
-           data chunk size is unknown */
-        if (found_data && (caf->data_size < 0 || url_is_streamed(pb)))
-            break;
-
-        tag  = get_be32(pb);
-        size = get_be64(pb);
-        if (url_feof(pb))
-            break;
-
-        switch (tag) {
-        case MKBETAG('d','a','t','a'):
-            url_fskip(pb, 4); /* edit count */
-            caf->data_start = url_ftell(pb);
-            caf->data_size  = size < 0 ? -1 : size - 4;
-            if (caf->data_size > 0 && !url_is_streamed(pb))
-                url_fskip(pb, caf->data_size);
-            found_data = 1;
-            break;
-
-        /* magic cookie chunk */
-        case MKBETAG('k','u','k','i'):
-            if (read_kuki_chunk(s, size))
-                return AVERROR_INVALIDDATA;
-            break;
-
-        /* packet table chunk */
-        case MKBETAG('p','a','k','t'):
-            if (read_pakt_chunk(s, size))
-                return AVERROR_INVALIDDATA;
-            break;
-
-        case MKBETAG('i','n','f','o'):
-            read_info_chunk(s, size);
-            break;
-
-        default:
-#define _(x) ((x) >= ' ' ? (x) : ' ')
-            av_log(s, AV_LOG_WARNING, "skipping CAF chunk: %08X (%c%c%c%c)\n",
-                tag, _(tag>>24), _((tag>>16)&0xFF), _((tag>>8)&0xFF), _(tag&0xFF));
-#undef _
-        case MKBETAG('f','r','e','e'):
-            if (size < 0)
-                return AVERROR_INVALIDDATA;
-            url_fskip(pb, size);
-            break;
-        }
-    }
-
-    if (!found_data)
-        return AVERROR_INVALIDDATA;
-
-    if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) {
-        if (caf->data_size > 0)
-            st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet;
-    } else if (st->nb_index_entries) {
-        st->codec->bit_rate = st->codec->sample_rate * caf->data_size * 8 /
-                              st->duration;
-    } else {
-        av_log(s, AV_LOG_ERROR, "Missing packet table. It is required when "
-                                "block size or frame size are variable.\n");
-        return AVERROR_INVALIDDATA;
-    }
-    s->file_size = url_fsize(pb);
-    s->file_size = FFMAX(0, s->file_size);
-
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-    st->start_time = 0;
-
-    /* position the stream at the start of data */
-    if (caf->data_size >= 0)
-        url_fseek(pb, caf->data_start, SEEK_SET);
-
-    return 0;
-}
-
-#define CAF_MAX_PKT_SIZE 4096
-
-static int read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    AVStream *st      = s->streams[0];
-    CaffContext *caf  = s->priv_data;
-    int res, pkt_size = 0, pkt_frames = 0;
-    int64_t left      = CAF_MAX_PKT_SIZE;
-
-    if (url_feof(pb))
-        return AVERROR(EIO);
-
-    /* don't read past end of data chunk */
-    if (caf->data_size > 0) {
-        left = (caf->data_start + caf->data_size) - url_ftell(pb);
-        if (left <= 0)
-            return AVERROR(EIO);
-    }
-
-    pkt_frames = caf->frames_per_packet;
-    pkt_size   = caf->bytes_per_packet;
-
-    if (pkt_size > 0 && pkt_frames == 1) {
-        pkt_size   = (CAF_MAX_PKT_SIZE / pkt_size) * pkt_size;
-        pkt_size   = FFMIN(pkt_size, left);
-        pkt_frames = pkt_size / caf->bytes_per_packet;
-    } else if (st->nb_index_entries) {
-        if (caf->packet_cnt < st->nb_index_entries - 1) {
-            pkt_size   = st->index_entries[caf->packet_cnt + 1].pos       - st->index_entries[caf->packet_cnt].pos;
-            pkt_frames = st->index_entries[caf->packet_cnt + 1].timestamp - st->index_entries[caf->packet_cnt].timestamp;
-        } else if (caf->packet_cnt == st->nb_index_entries - 1) {
-            pkt_size   = caf->num_bytes - st->index_entries[caf->packet_cnt].pos;
-            pkt_frames = st->duration   - st->index_entries[caf->packet_cnt].timestamp;
-        } else {
-            return AVERROR(EIO);
-        }
-    }
-
-    if (pkt_size == 0 || pkt_frames == 0 || pkt_size > left)
-        return AVERROR(EIO);
-
-    res = av_get_packet(pb, pkt, pkt_size);
-    if (res < 0)
-        return res;
-
-    pkt->size           = res;
-    pkt->stream_index   = 0;
-    pkt->dts = pkt->pts = caf->frame_cnt;
-
-    caf->packet_cnt++;
-    caf->frame_cnt += pkt_frames;
-
-    return 0;
-}
-
-static int read_seek(AVFormatContext *s, int stream_index,
-                     int64_t timestamp, int flags)
-{
-    AVStream *st = s->streams[0];
-    CaffContext *caf = s->priv_data;
-    int64_t pos;
-
-    timestamp = FFMAX(timestamp, 0);
-
-    if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
-        /* calculate new byte position based on target frame position */
-        pos = caf->bytes_per_packet * timestamp / caf->frames_per_packet;
-        if (caf->data_size > 0)
-            pos = FFMIN(pos, caf->data_size);
-        caf->packet_cnt = pos / caf->bytes_per_packet;
-        caf->frame_cnt  = caf->frames_per_packet * caf->packet_cnt;
-    } else if (st->nb_index_entries) {
-        caf->packet_cnt = av_index_search_timestamp(st, timestamp, flags);
-        caf->frame_cnt  = st->index_entries[caf->packet_cnt].timestamp;
-        pos             = st->index_entries[caf->packet_cnt].pos;
-    } else {
-        return -1;
-    }
-
-    url_fseek(s->pb, pos + caf->data_start, SEEK_SET);
-    return 0;
-}
-
-AVInputFormat caf_demuxer = {
-    "caf",
-    NULL_IF_CONFIG_SMALL("Apple Core Audio Format"),
-    sizeof(CaffContext),
-    probe,
-    read_header,
-    read_packet,
-    NULL,
-    read_seek,
-    .codec_tag = (const AVCodecTag*[]){ff_codec_caf_tags, 0},
-};
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
deleted file mode 100644
index 2f4fb27..0000000
--- a/libavformat/cdg.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * CD Graphics Demuxer
- * Copyright (c) 2009 Michael Tison
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-#define CDG_PACKET_SIZE    24
-
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    AVStream *vst;
-    int ret;
-
-    vst = av_new_stream(s, 0);
-    if (!vst)
-        return AVERROR(ENOMEM);
-
-    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id   = CODEC_ID_CDGRAPHICS;
-
-    /// 75 sectors/sec * 4 packets/sector = 300 packets/sec
-    av_set_pts_info(vst, 32, 1, 300);
-
-    ret = url_fsize(s->pb);
-    if (ret > 0)
-        vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300);
-
-    return 0;
-}
-
-static int read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret;
-
-    ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE);
-
-    pkt->stream_index = 0;
-    return ret;
-}
-
-AVInputFormat cdg_demuxer = {
-    "cdg",
-    NULL_IF_CONFIG_SMALL("CD Graphics Format"),
-    0,
-    NULL,
-    read_header,
-    read_packet,
-    .extensions = "cdg"
-};
diff --git a/libavformat/concat.c b/libavformat/concat.c
deleted file mode 100644
index 3a19d0a..0000000
--- a/libavformat/concat.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Concat URL protocol
- * Copyright (c) 2006 Steve Lhomme
- * Copyright (c) 2007 Wolfram Gloger
- * Copyright (c) 2010 Michele Orrù
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "libavutil/avstring.h"
-#include "libavutil/mem.h"
-
-#define AV_CAT_SEPARATOR "|"
-
-struct concat_nodes {
-    URLContext *uc;                ///< node's URLContext
-    int64_t     size;              ///< url filesize
-};
-
-struct concat_data {
-    struct concat_nodes *nodes;    ///< list of nodes to concat
-    size_t               length;   ///< number of cat'ed nodes
-    size_t               current;  ///< index of currently read node
-};
-
-static av_cold int concat_close(URLContext *h)
-{
-    int err = 0;
-    size_t i;
-    struct concat_data  *data  = h->priv_data;
-    struct concat_nodes *nodes = data->nodes;
-
-    for (i = 0; i != data->length; i++)
-        err |= url_close(nodes[i].uc);
-
-    av_freep(&data->nodes);
-    av_freep(&h->priv_data);
-
-    return err < 0 ? -1 : 0;
-}
-
-static av_cold int concat_open(URLContext *h, const char *uri, int flags)
-{
-    char *node_uri = NULL, *tmp_uri;
-    int err = 0;
-    int64_t size;
-    size_t  len, i;
-    URLContext *uc;
-    struct concat_data  *data;
-    struct concat_nodes *nodes;
-
-    av_strstart(uri, "concat:", &uri);
-
-    /* creating data */
-    if (!(data = av_mallocz(sizeof(*data))))
-        return AVERROR(ENOMEM);
-    h->priv_data = data;
-
-    for (i = 0, len = 1; uri[i]; i++)
-        if (uri[i] == *AV_CAT_SEPARATOR)
-            /* integer overflow */
-            if (++len == UINT_MAX / sizeof(*nodes)) {
-                av_freep(&h->priv_data);
-                return AVERROR(ENAMETOOLONG);
-            }
-
-    if (!(nodes = av_malloc(sizeof(*nodes) * len))) {
-        av_freep(&h->priv_data);
-        return AVERROR(ENOMEM);
-    } else
-        data->nodes = nodes;
-
-    /* handle input */
-    if (!*uri)
-        err = AVERROR(ENOENT);
-    for (i = 0; *uri; i++) {
-        /* parsing uri */
-        len = strcspn(uri, AV_CAT_SEPARATOR);
-        if (!(tmp_uri = av_realloc(node_uri, len+1))) {
-            err = AVERROR(ENOMEM);
-            break;
-        } else
-            node_uri = tmp_uri;
-        av_strlcpy(node_uri, uri, len+1);
-        uri += len + strspn(uri+len, AV_CAT_SEPARATOR);
-
-        /* creating URLContext */
-        if ((err = url_open(&uc, node_uri, flags)) < 0)
-            break;
-
-        /* creating size */
-        if ((size = url_filesize(uc)) < 0) {
-            url_close(uc);
-            err = AVERROR(ENOSYS);
-            break;
-        }
-
-        /* assembling */
-        nodes[i].uc   = uc;
-        nodes[i].size = size;
-    }
-    av_free(node_uri);
-    data->length = i;
-
-    if (err < 0)
-        concat_close(h);
-    else if (!(nodes = av_realloc(nodes, data->length * sizeof(*nodes)))) {
-        concat_close(h);
-        err = AVERROR(ENOMEM);
-    } else
-        data->nodes = nodes;
-    return err;
-}
-
-static int concat_read(URLContext *h, unsigned char *buf, int size)
-{
-    int result, total = 0;
-    struct concat_data  *data  = h->priv_data;
-    struct concat_nodes *nodes = data->nodes;
-    size_t i = data->current;
-
-    while (size > 0) {
-        result = url_read(nodes[i].uc, buf, size);
-        if (result < 0)
-            return total ? total : result;
-        if (!result)
-            if (i + 1 == data->length ||
-                url_seek(nodes[++i].uc, 0, SEEK_SET) < 0)
-                break;
-        total += result;
-        buf   += result;
-        size  -= result;
-    }
-    data->current = i;
-    return total;
-}
-
-static int64_t concat_seek(URLContext *h, int64_t pos, int whence)
-{
-    int64_t result;
-    struct concat_data  *data  = h->priv_data;
-    struct concat_nodes *nodes = data->nodes;
-    size_t i;
-
-    switch (whence) {
-    case SEEK_END:
-        for (i = data->length - 1;
-             i && pos < -nodes[i].size;
-             i--)
-            pos += nodes[i].size;
-        break;
-    case SEEK_CUR:
-        /* get the absolute position */
-        for (i = 0; i != data->current; i++)
-            pos += nodes[i].size;
-        pos += url_seek(nodes[i].uc, 0, SEEK_CUR);
-        whence = SEEK_SET;
-        /* fall through with the absolute position */
-    case SEEK_SET:
-        for (i = 0; i != data->length - 1 && pos >= nodes[i].size; i++)
-            pos -= nodes[i].size;
-        break;
-    default:
-        return AVERROR(EINVAL);
-    }
-
-    result = url_seek(nodes[i].uc, pos, whence);
-    if (result >= 0) {
-        data->current = i;
-        while (i)
-            result += nodes[--i].size;
-    }
-    return result;
-}
-
-URLProtocol concat_protocol = {
-    "concat",
-    concat_open,
-    concat_read,
-    NULL,
-    concat_seek,
-    concat_close,
-};
diff --git a/libavformat/crcenc.c b/libavformat/crcenc.c
deleted file mode 100644
index b343464..0000000
--- a/libavformat/crcenc.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * CRC encoder (for codec/format testing)
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/adler32.h"
-#include "avformat.h"
-
-typedef struct CRCState {
-    uint32_t crcval;
-} CRCState;
-
-static int crc_write_header(struct AVFormatContext *s)
-{
-    CRCState *crc = s->priv_data;
-
-    /* init CRC */
-    crc->crcval = 1;
-
-    return 0;
-}
-
-static int crc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    CRCState *crc = s->priv_data;
-    crc->crcval = av_adler32_update(crc->crcval, pkt->data, pkt->size);
-    return 0;
-}
-
-static int crc_write_trailer(struct AVFormatContext *s)
-{
-    CRCState *crc = s->priv_data;
-    char buf[64];
-
-    snprintf(buf, sizeof(buf), "CRC=0x%08x\n", crc->crcval);
-    put_buffer(s->pb, buf, strlen(buf));
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-AVOutputFormat crc_muxer = {
-    "crc",
-    NULL_IF_CONFIG_SMALL("CRC testing format"),
-    NULL,
-    "",
-    sizeof(CRCState),
-    CODEC_ID_PCM_S16LE,
-    CODEC_ID_RAWVIDEO,
-    crc_write_header,
-    crc_write_packet,
-    crc_write_trailer,
-};
diff --git a/libavformat/cutils.c b/libavformat/cutils.c
deleted file mode 100644
index 5092d99..0000000
--- a/libavformat/cutils.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Various simple utilities for ffmpeg system
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "internal.h"
-
-/* add one element to a dynamic array */
-void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem)
-{
-    int nb, nb_alloc;
-    intptr_t *tab;
-
-    nb = *nb_ptr;
-    tab = *tab_ptr;
-    if ((nb & (nb - 1)) == 0) {
-        if (nb == 0)
-            nb_alloc = 1;
-        else
-            nb_alloc = nb * 2;
-        tab = av_realloc(tab, nb_alloc * sizeof(intptr_t));
-        *tab_ptr = tab;
-    }
-    tab[nb++] = elem;
-    *nb_ptr = nb;
-}
-
-time_t mktimegm(struct tm *tm)
-{
-    time_t t;
-
-    int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday;
-
-    if (m < 3) {
-        m += 12;
-        y--;
-    }
-
-    t = 86400 *
-        (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469);
-
-    t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec;
-
-    return t;
-}
-
-#define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0))
-#define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400)
-
-/* This is our own gmtime_r. It differs from its POSIX counterpart in a
-   couple of places, though. */
-struct tm *brktimegm(time_t secs, struct tm *tm)
-{
-    int days, y, ny, m;
-    int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-
-    days = secs / 86400;
-    secs %= 86400;
-    tm->tm_hour = secs / 3600;
-    tm->tm_min = (secs % 3600) / 60;
-    tm->tm_sec =  secs % 60;
-
-    /* oh well, may be someone some day will invent a formula for this stuff */
-    y = 1970; /* start "guessing" */
-    while (days > 365) {
-        ny = (y + days/366);
-        days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1);
-        y = ny;
-    }
-    if (days==365 && !ISLEAP(y)) { days=0; y++; }
-    md[1] = ISLEAP(y)?29:28;
-    for (m=0; days >= md[m]; m++)
-         days -= md[m];
-
-    tm->tm_year = y;  /* unlike gmtime_r we store complete year here */
-    tm->tm_mon = m+1; /* unlike gmtime_r tm_mon is from 1 to 12 */
-    tm->tm_mday = days+1;
-
-    return tm;
-}
-
-/* get a positive number between n_min and n_max, for a maximum length
-   of len_max. Return -1 if error. */
-static int date_get_num(const char **pp,
-                        int n_min, int n_max, int len_max)
-{
-    int i, val, c;
-    const char *p;
-
-    p = *pp;
-    val = 0;
-    for(i = 0; i < len_max; i++) {
-        c = *p;
-        if (!isdigit(c))
-            break;
-        val = (val * 10) + c - '0';
-        p++;
-    }
-    /* no number read ? */
-    if (p == *pp)
-        return -1;
-    if (val < n_min || val > n_max)
-        return -1;
-    *pp = p;
-    return val;
-}
-
-/* small strptime for ffmpeg */
-const char *small_strptime(const char *p, const char *fmt,
-                           struct tm *dt)
-{
-    int c, val;
-
-    for(;;) {
-        c = *fmt++;
-        if (c == '\0') {
-            return p;
-        } else if (c == '%') {
-            c = *fmt++;
-            switch(c) {
-            case 'H':
-                val = date_get_num(&p, 0, 23, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_hour = val;
-                break;
-            case 'M':
-                val = date_get_num(&p, 0, 59, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_min = val;
-                break;
-            case 'S':
-                val = date_get_num(&p, 0, 59, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_sec = val;
-                break;
-            case 'Y':
-                val = date_get_num(&p, 0, 9999, 4);
-                if (val == -1)
-                    return NULL;
-                dt->tm_year = val - 1900;
-                break;
-            case 'm':
-                val = date_get_num(&p, 1, 12, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_mon = val - 1;
-                break;
-            case 'd':
-                val = date_get_num(&p, 1, 31, 2);
-                if (val == -1)
-                    return NULL;
-                dt->tm_mday = val;
-                break;
-            case '%':
-                goto match;
-            default:
-                return NULL;
-            }
-        } else {
-        match:
-            if (c != *p)
-                return NULL;
-            p++;
-        }
-    }
-    return p;
-}
-
diff --git a/libavformat/daud.c b/libavformat/daud.c
deleted file mode 100644
index 9b0e008..0000000
--- a/libavformat/daud.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * D-Cinema audio demuxer
- * Copyright (c) 2005 Reimar Döffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-
-static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
-    AVStream *st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_PCM_S24DAUD;
-    st->codec->codec_tag = MKTAG('d', 'a', 'u', 'd');
-    st->codec->channels = 6;
-    st->codec->sample_rate = 96000;
-    st->codec->bit_rate = 3 * 6 * 96000 * 8;
-    st->codec->block_align = 3 * 6;
-    st->codec->bits_per_coded_sample = 24;
-    return 0;
-}
-
-static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
-    int ret, size;
-    if (url_feof(pb))
-        return AVERROR(EIO);
-    size = get_be16(pb);
-    get_be16(pb); // unknown
-    ret = av_get_packet(pb, pkt, size);
-    pkt->stream_index = 0;
-    return ret;
-}
-
-static int daud_write_header(struct AVFormatContext *s)
-{
-    AVCodecContext *codec = s->streams[0]->codec;
-    if (codec->channels!=6 || codec->sample_rate!=96000)
-        return -1;
-    return 0;
-}
-
-static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    put_be16(s->pb, pkt->size);
-    put_be16(s->pb, 0x8010); // unknown
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-#if CONFIG_DAUD_DEMUXER
-AVInputFormat daud_demuxer = {
-    "daud",
-    NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
-    0,
-    NULL,
-    daud_header,
-    daud_packet,
-    NULL,
-    NULL,
-    .extensions = "302",
-};
-#endif
-
-#if CONFIG_DAUD_MUXER
-AVOutputFormat daud_muxer =
-{
-    "daud",
-    NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
-    NULL,
-    "302",
-    0,
-    CODEC_ID_PCM_S24DAUD,
-    CODEC_ID_NONE,
-    daud_write_header,
-    daud_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
deleted file mode 100644
index af5e2d9..0000000
--- a/libavformat/dsicin.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Delphine Software International CIN File Demuxer
- * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Delphine Software International CIN file demuxer
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-
-typedef struct CinFileHeader {
-    int video_frame_size;
-    int video_frame_width;
-    int video_frame_height;
-    int audio_frequency;
-    int audio_bits;
-    int audio_stereo;
-    int audio_frame_size;
-} CinFileHeader;
-
-typedef struct CinFrameHeader {
-    int audio_frame_type;
-    int video_frame_type;
-    int pal_colors_count;
-    int audio_frame_size;
-    int video_frame_size;
-} CinFrameHeader;
-
-typedef struct CinDemuxContext {
-    int audio_stream_index;
-    int video_stream_index;
-    CinFileHeader file_header;
-    int64_t audio_stream_pts;
-    int64_t video_stream_pts;
-    CinFrameHeader frame_header;
-    int audio_buffer_size;
-} CinDemuxContext;
-
-
-static int cin_probe(AVProbeData *p)
-{
-    /* header starts with this special marker */
-    if (AV_RL32(&p->buf[0]) != 0x55AA0000)
-        return 0;
-
-    /* for accuracy, check some header field values */
-    if (AV_RL32(&p->buf[12]) != 22050 || p->buf[16] != 16 || p->buf[17] != 0)
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int cin_read_file_header(CinDemuxContext *cin, ByteIOContext *pb) {
-    CinFileHeader *hdr = &cin->file_header;
-
-    if (get_le32(pb) != 0x55AA0000)
-        return AVERROR_INVALIDDATA;
-
-    hdr->video_frame_size   = get_le32(pb);
-    hdr->video_frame_width  = get_le16(pb);
-    hdr->video_frame_height = get_le16(pb);
-    hdr->audio_frequency    = get_le32(pb);
-    hdr->audio_bits         = get_byte(pb);
-    hdr->audio_stereo       = get_byte(pb);
-    hdr->audio_frame_size   = get_le16(pb);
-
-    if (hdr->audio_frequency != 22050 || hdr->audio_bits != 16 || hdr->audio_stereo != 0)
-        return AVERROR_INVALIDDATA;
-
-    return 0;
-}
-
-static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    int rc;
-    CinDemuxContext *cin = s->priv_data;
-    CinFileHeader *hdr = &cin->file_header;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-
-    rc = cin_read_file_header(cin, pb);
-    if (rc)
-        return rc;
-
-    cin->video_stream_pts = 0;
-    cin->audio_stream_pts = 0;
-    cin->audio_buffer_size = 0;
-
-    /* initialize the video decoder stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 32, 1, 12);
-    cin->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_DSICINVIDEO;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = hdr->video_frame_width;
-    st->codec->height = hdr->video_frame_height;
-
-    /* initialize the audio decoder stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 32, 1, 22050);
-    cin->audio_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_DSICINAUDIO;
-    st->codec->codec_tag = 0;  /* no tag */
-    st->codec->channels = 1;
-    st->codec->sample_rate = 22050;
-    st->codec->bits_per_coded_sample = 16;
-    st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
-    st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-
-    return 0;
-}
-
-static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
-    CinFrameHeader *hdr = &cin->frame_header;
-
-    hdr->video_frame_type = get_byte(pb);
-    hdr->audio_frame_type = get_byte(pb);
-    hdr->pal_colors_count = get_le16(pb);
-    hdr->video_frame_size = get_le32(pb);
-    hdr->audio_frame_size = get_le32(pb);
-
-    if (url_feof(pb) || url_ferror(pb))
-        return AVERROR(EIO);
-
-    if (get_le32(pb) != 0xAA55AA55)
-        return AVERROR_INVALIDDATA;
-
-    return 0;
-}
-
-static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    CinDemuxContext *cin = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    CinFrameHeader *hdr = &cin->frame_header;
-    int rc, palette_type, pkt_size;
-    int ret;
-
-    if (cin->audio_buffer_size == 0) {
-        rc = cin_read_frame_header(cin, pb);
-        if (rc)
-            return rc;
-
-        if ((int16_t)hdr->pal_colors_count < 0) {
-            hdr->pal_colors_count = -(int16_t)hdr->pal_colors_count;
-            palette_type = 1;
-        } else {
-            palette_type = 0;
-        }
-
-        /* palette and video packet */
-        pkt_size = (palette_type + 3) * hdr->pal_colors_count + hdr->video_frame_size;
-
-        ret = av_new_packet(pkt, 4 + pkt_size);
-        if (ret < 0)
-            return ret;
-
-        pkt->stream_index = cin->video_stream_index;
-        pkt->pts = cin->video_stream_pts++;
-
-        pkt->data[0] = palette_type;
-        pkt->data[1] = hdr->pal_colors_count & 0xFF;
-        pkt->data[2] = hdr->pal_colors_count >> 8;
-        pkt->data[3] = hdr->video_frame_type;
-
-        ret = get_buffer(pb, &pkt->data[4], pkt_size);
-        if (ret < 0) {
-            av_free_packet(pkt);
-            return ret;
-        }
-        if (ret < pkt_size)
-            av_shrink_packet(pkt, 4 + ret);
-
-        /* sound buffer will be processed on next read_packet() call */
-        cin->audio_buffer_size = hdr->audio_frame_size;
-        return 0;
-    }
-
-    /* audio packet */
-    ret = av_get_packet(pb, pkt, cin->audio_buffer_size);
-    if (ret < 0)
-        return ret;
-
-    pkt->stream_index = cin->audio_stream_index;
-    pkt->pts = cin->audio_stream_pts;
-    cin->audio_stream_pts += cin->audio_buffer_size * 2 / cin->file_header.audio_frame_size;
-    cin->audio_buffer_size = 0;
-    return 0;
-}
-
-AVInputFormat dsicin_demuxer = {
-    "dsicin",
-    NULL_IF_CONFIG_SMALL("Delphine Software International CIN format"),
-    sizeof(CinDemuxContext),
-    cin_probe,
-    cin_read_header,
-    cin_read_packet,
-};
diff --git a/libavformat/dv.c b/libavformat/dv.c
deleted file mode 100644
index b6f9c6a..0000000
--- a/libavformat/dv.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * General DV muxer/demuxer
- * Copyright (c) 2003 Roman Shaposhnik
- *
- * Many thanks to Dan Dennedy <dan at dennedy.org> for providing wealth
- * of DV technical info.
- *
- * Raw DV format
- * Copyright (c) 2002 Fabrice Bellard
- *
- * 50 Mbps (DVCPRO50) and 100 Mbps (DVCPRO HD) support
- * Copyright (c) 2006 Daniel Maas <dmaas at maasdigital.com>
- * Funded by BBC Research & Development
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <time.h>
-#include "avformat.h"
-#include "libavcodec/dvdata.h"
-#include "libavutil/intreadwrite.h"
-#include "dv.h"
-
-struct DVDemuxContext {
-    const DVprofile*  sys;    /* Current DV profile. E.g.: 525/60, 625/50 */
-    AVFormatContext*  fctx;
-    AVStream*         vst;
-    AVStream*         ast[4];
-    AVPacket          audio_pkt[4];
-    uint8_t           audio_buf[4][8192];
-    int               ach;
-    int               frames;
-    uint64_t          abytes;
-};
-
-static inline uint16_t dv_audio_12to16(uint16_t sample)
-{
-    uint16_t shift, result;
-
-    sample = (sample < 0x800) ? sample : sample | 0xf000;
-    shift  = (sample & 0xf00) >> 8;
-
-    if (shift < 0x2 || shift > 0xd) {
-        result = sample;
-    } else if (shift < 0x8) {
-        shift--;
-        result = (sample - (256 * shift)) << shift;
-    } else {
-        shift = 0xe - shift;
-        result = ((sample + ((256 * shift) + 1)) << shift) - 1;
-    }
-
-    return result;
-}
-
-/*
- * This is the dumbest implementation of all -- it simply looks at
- * a fixed offset and if pack isn't there -- fails. We might want
- * to have a fallback mechanism for complete search of missing packs.
- */
-static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t)
-{
-    int offs;
-
-    switch (t) {
-    case dv_audio_source:
-        offs = (80*6 + 80*16*3 + 3);
-        break;
-    case dv_audio_control:
-        offs = (80*6 + 80*16*4 + 3);
-        break;
-    case dv_video_control:
-        offs = (80*5 + 48 + 5);
-        break;
-    default:
-        return NULL;
-    }
-
-    return frame[offs] == t ? &frame[offs] : NULL;
-}
-
-/*
- * There's a couple of assumptions being made here:
- * 1. By default we silence erroneous (0x8000/16bit 0x800/12bit) audio samples.
- *    We can pass them upwards when ffmpeg will be ready to deal with them.
- * 2. We don't do software emphasis.
- * 3. Audio is always returned as 16bit linear samples: 12bit nonlinear samples
- *    are converted into 16bit linear ones.
- */
-static int dv_extract_audio(uint8_t* frame, uint8_t* ppcm[4],
-                            const DVprofile *sys)
-{
-    int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
-    uint16_t lc, rc;
-    const uint8_t* as_pack;
-    uint8_t *pcm, ipcm;
-
-    as_pack = dv_extract_pack(frame, dv_audio_source);
-    if (!as_pack)    /* No audio ? */
-        return 0;
-
-    smpls =  as_pack[1] & 0x3f;       /* samples in this frame - min. samples */
-    freq  = (as_pack[4] >> 3) & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
-    quant =  as_pack[4] & 0x07;       /* 0 - 16bit linear, 1 - 12bit nonlinear */
-
-    if (quant > 1)
-        return -1; /* unsupported quantization */
-
-    size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
-    half_ch = sys->difseg_size / 2;
-
-    /* We work with 720p frames split in half, thus even frames have
-     * channels 0,1 and odd 2,3. */
-    ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0;
-    pcm  = ppcm[ipcm++];
-
-    /* for each DIF channel */
-    for (chan = 0; chan < sys->n_difchan; chan++) {
-        /* for each DIF segment */
-        for (i = 0; i < sys->difseg_size; i++) {
-            frame += 6 * 80; /* skip DIF segment header */
-            if (quant == 1 && i == half_ch) {
-                /* next stereo channel (12bit mode only) */
-                pcm = ppcm[ipcm++];
-                if (!pcm)
-                    break;
-            }
-
-            /* for each AV sequence */
-            for (j = 0; j < 9; j++) {
-                for (d = 8; d < 80; d += 2) {
-                    if (quant == 0) {  /* 16bit quantization */
-                        of = sys->audio_shuffle[i][j] + (d - 8) / 2 * sys->audio_stride;
-                        if (of*2 >= size)
-                            continue;
-
-                        pcm[of*2]   = frame[d+1]; // FIXME: maybe we have to admit
-                        pcm[of*2+1] = frame[d];   //        that DV is a big-endian PCM
-                        if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00)
-                            pcm[of*2+1] = 0;
-                    } else {           /* 12bit quantization */
-                        lc = ((uint16_t)frame[d]   << 4) |
-                             ((uint16_t)frame[d+2] >> 4);
-                        rc = ((uint16_t)frame[d+1] << 4) |
-                             ((uint16_t)frame[d+2] & 0x0f);
-                        lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
-                        rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
-
-                        of = sys->audio_shuffle[i%half_ch][j] + (d - 8) / 3 * sys->audio_stride;
-                        if (of*2 >= size)
-                            continue;
-
-                        pcm[of*2]   = lc & 0xff; // FIXME: maybe we have to admit
-                        pcm[of*2+1] = lc >> 8;   //        that DV is a big-endian PCM
-                        of = sys->audio_shuffle[i%half_ch+half_ch][j] +
-                            (d - 8) / 3 * sys->audio_stride;
-                        pcm[of*2]   = rc & 0xff; // FIXME: maybe we have to admit
-                        pcm[of*2+1] = rc >> 8;   //        that DV is a big-endian PCM
-                        ++d;
-                    }
-                }
-
-                frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
-            }
-        }
-
-        /* next stereo channel (50Mbps and 100Mbps only) */
-        pcm = ppcm[ipcm++];
-        if (!pcm)
-            break;
-    }
-
-    return size;
-}
-
-static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
-{
-    const uint8_t* as_pack;
-    int freq, stype, smpls, quant, i, ach;
-
-    as_pack = dv_extract_pack(frame, dv_audio_source);
-    if (!as_pack || !c->sys) {    /* No audio ? */
-        c->ach = 0;
-        return 0;
-    }
-
-    smpls =  as_pack[1] & 0x3f;       /* samples in this frame - min. samples */
-    freq  = (as_pack[4] >> 3) & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */
-    stype = (as_pack[3] & 0x1f);      /* 0 - 2CH, 2 - 4CH, 3 - 8CH */
-    quant =  as_pack[4] & 0x07;       /* 0 - 16bit linear, 1 - 12bit nonlinear */
-
-    /* note: ach counts PAIRS of channels (i.e. stereo channels) */
-    ach = ((int[4]){  1,  0,  2,  4})[stype];
-    if (ach == 1 && quant && freq == 2)
-        ach = 2;
-
-    /* Dynamic handling of the audio streams in DV */
-    for (i = 0; i < ach; i++) {
-       if (!c->ast[i]) {
-           c->ast[i] = av_new_stream(c->fctx, 0);
-           if (!c->ast[i])
-               break;
-           av_set_pts_info(c->ast[i], 64, 1, 30000);
-           c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-           c->ast[i]->codec->codec_id   = CODEC_ID_PCM_S16LE;
-
-           av_init_packet(&c->audio_pkt[i]);
-           c->audio_pkt[i].size         = 0;
-           c->audio_pkt[i].data         = c->audio_buf[i];
-           c->audio_pkt[i].stream_index = c->ast[i]->index;
-           c->audio_pkt[i].flags       |= AV_PKT_FLAG_KEY;
-       }
-       c->ast[i]->codec->sample_rate = dv_audio_frequency[freq];
-       c->ast[i]->codec->channels    = 2;
-       c->ast[i]->codec->bit_rate    = 2 * dv_audio_frequency[freq] * 16;
-       c->ast[i]->start_time         = 0;
-    }
-    c->ach = i;
-
-    return (c->sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */;
-}
-
-static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame)
-{
-    const uint8_t* vsc_pack;
-    AVCodecContext* avctx;
-    int apt, is16_9;
-    int size = 0;
-
-    if (c->sys) {
-        avctx = c->vst->codec;
-
-        av_set_pts_info(c->vst, 64, c->sys->time_base.num,
-                        c->sys->time_base.den);
-        avctx->time_base= c->sys->time_base;
-        if (!avctx->width){
-            avctx->width = c->sys->width;
-            avctx->height = c->sys->height;
-        }
-        avctx->pix_fmt = c->sys->pix_fmt;
-
-        /* finding out SAR is a little bit messy */
-        vsc_pack = dv_extract_pack(frame, dv_video_control);
-        apt      = frame[4] & 0x07;
-        is16_9   = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 ||
-                                (!apt && (vsc_pack[2] & 0x07) == 0x07)));
-        c->vst->sample_aspect_ratio = c->sys->sar[is16_9];
-        avctx->bit_rate = av_rescale_q(c->sys->frame_size, (AVRational){8,1},
-                                       c->sys->time_base);
-        size = c->sys->frame_size;
-    }
-    return size;
-}
-
-/*
- * The following 3 functions constitute our interface to the world
- */
-
-DVDemuxContext* dv_init_demux(AVFormatContext *s)
-{
-    DVDemuxContext *c;
-
-    c = av_mallocz(sizeof(DVDemuxContext));
-    if (!c)
-        return NULL;
-
-    c->vst = av_new_stream(s, 0);
-    if (!c->vst) {
-        av_free(c);
-        return NULL;
-    }
-
-    c->sys  = NULL;
-    c->fctx = s;
-    memset(c->ast, 0, sizeof(c->ast));
-    c->ach    = 0;
-    c->frames = 0;
-    c->abytes = 0;
-
-    c->vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    c->vst->codec->codec_id   = CODEC_ID_DVVIDEO;
-    c->vst->codec->bit_rate   = 25000000;
-    c->vst->start_time        = 0;
-
-    return c;
-}
-
-int dv_get_packet(DVDemuxContext *c, AVPacket *pkt)
-{
-    int size = -1;
-    int i;
-
-    for (i = 0; i < c->ach; i++) {
-       if (c->ast[i] && c->audio_pkt[i].size) {
-           *pkt = c->audio_pkt[i];
-           c->audio_pkt[i].size = 0;
-           size = pkt->size;
-           break;
-       }
-    }
-
-    return size;
-}
-
-int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
-                      uint8_t* buf, int buf_size)
-{
-    int size, i;
-    uint8_t *ppcm[4] = {0};
-
-    if (buf_size < DV_PROFILE_BYTES ||
-        !(c->sys = ff_dv_frame_profile(c->sys, buf, buf_size)) ||
-        buf_size < c->sys->frame_size) {
-          return -1;   /* Broken frame, or not enough data */
-    }
-
-    /* Queueing audio packet */
-    /* FIXME: in case of no audio/bad audio we have to do something */
-    size = dv_extract_audio_info(c, buf);
-    for (i = 0; i < c->ach; i++) {
-       c->audio_pkt[i].size = size;
-       c->audio_pkt[i].pts  = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate;
-       ppcm[i] = c->audio_buf[i];
-    }
-    dv_extract_audio(buf, ppcm, c->sys);
-
-    /* We work with 720p frames split in half, thus even frames have
-     * channels 0,1 and odd 2,3. */
-    if (c->sys->height == 720) {
-        if (buf[1] & 0x0C) {
-            c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
-        } else {
-            c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
-            c->abytes += size;
-        }
-    } else {
-        c->abytes += size;
-    }
-
-    /* Now it's time to return video packet */
-    size = dv_extract_video_info(c, buf);
-    av_init_packet(pkt);
-    pkt->data         = buf;
-    pkt->size         = size;
-    pkt->flags       |= AV_PKT_FLAG_KEY;
-    pkt->stream_index = c->vst->id;
-    pkt->pts          = c->frames;
-
-    c->frames++;
-
-    return size;
-}
-
-static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
-                              int64_t timestamp, int flags)
-{
-    // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
-    const DVprofile* sys = ff_dv_codec_profile(c->vst->codec);
-    int64_t offset;
-    int64_t size = url_fsize(s->pb);
-    int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
-
-    offset = sys->frame_size * timestamp;
-
-    if (size >= 0 && offset > max_offset) offset = max_offset;
-    else if (offset < 0) offset = 0;
-
-    return offset;
-}
-
-void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset)
-{
-    c->frames= frame_offset;
-    if (c->ach)
-        c->abytes= av_rescale_q(c->frames, c->sys->time_base,
-                                (AVRational){8, c->ast[0]->codec->bit_rate});
-    c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
-    c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
-}
-
-/************************************************************
- * Implementation of the easiest DV storage of all -- raw DV.
- ************************************************************/
-
-typedef struct RawDVContext {
-    DVDemuxContext* dv_demux;
-    uint8_t         buf[DV_MAX_FRAME_SIZE];
-} RawDVContext;
-
-static int dv_read_header(AVFormatContext *s,
-                          AVFormatParameters *ap)
-{
-    unsigned state, marker_pos = 0;
-    RawDVContext *c = s->priv_data;
-
-    c->dv_demux = dv_init_demux(s);
-    if (!c->dv_demux)
-        return -1;
-
-    state = get_be32(s->pb);
-    while ((state & 0xffffff7f) != 0x1f07003f) {
-        if (url_feof(s->pb)) {
-            av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
-            return -1;
-        }
-        if (state == 0x003f0700 || state == 0xff3f0700)
-            marker_pos = url_ftell(s->pb);
-        if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
-            url_fseek(s->pb, -163, SEEK_CUR);
-            state = get_be32(s->pb);
-            break;
-        }
-        state = (state << 8) | get_byte(s->pb);
-    }
-    AV_WB32(c->buf, state);
-
-    if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
-        url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
-        return AVERROR(EIO);
-
-    c->dv_demux->sys = ff_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES);
-    if (!c->dv_demux->sys) {
-        av_log(s, AV_LOG_ERROR, "Can't determine profile of DV input stream.\n");
-        return -1;
-    }
-
-    s->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size, (AVRational){8,1},
-                               c->dv_demux->sys->time_base);
-
-    return 0;
-}
-
-
-static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int size;
-    RawDVContext *c = s->priv_data;
-
-    size = dv_get_packet(c->dv_demux, pkt);
-
-    if (size < 0) {
-        if (!c->dv_demux->sys)
-            return AVERROR(EIO);
-        size = c->dv_demux->sys->frame_size;
-        if (get_buffer(s->pb, c->buf, size) <= 0)
-            return AVERROR(EIO);
-
-        size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
-    }
-
-    return size;
-}
-
-static int dv_read_seek(AVFormatContext *s, int stream_index,
-                       int64_t timestamp, int flags)
-{
-    RawDVContext *r   = s->priv_data;
-    DVDemuxContext *c = r->dv_demux;
-    int64_t offset    = dv_frame_offset(s, c, timestamp, flags);
-
-    dv_offset_reset(c, offset / c->sys->frame_size);
-
-    offset = url_fseek(s->pb, offset, SEEK_SET);
-    return (offset < 0) ? offset : 0;
-}
-
-static int dv_read_close(AVFormatContext *s)
-{
-    RawDVContext *c = s->priv_data;
-    av_free(c->dv_demux);
-    return 0;
-}
-
-static int dv_probe(AVProbeData *p)
-{
-    unsigned state, marker_pos = 0;
-    int i;
-    int matches = 0;
-    int secondary_matches = 0;
-
-    if (p->buf_size < 5)
-        return 0;
-
-    state = AV_RB32(p->buf);
-    for (i = 4; i < p->buf_size; i++) {
-        if ((state & 0xffffff7f) == 0x1f07003f)
-            matches++;
-        // any section header, also with seq/chan num != 0,
-        // should appear around every 12000 bytes, at least 10 per frame
-        if ((state & 0xff07ff7f) == 0x1f07003f)
-            secondary_matches++;
-        if (state == 0x003f0700 || state == 0xff3f0700)
-            marker_pos = i;
-        if (state == 0xff3f0701 && i - marker_pos == 80)
-            matches++;
-        state = (state << 8) | p->buf[i];
-    }
-
-    if (matches && p->buf_size / matches < 1024*1024) {
-        if (matches > 4 || (secondary_matches >= 10 && p->buf_size / secondary_matches < 24000))
-            return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match
-        return AVPROBE_SCORE_MAX/4;
-    }
-    return 0;
-}
-
-#if CONFIG_DV_DEMUXER
-AVInputFormat dv_demuxer = {
-    "dv",
-    NULL_IF_CONFIG_SMALL("DV video format"),
-    sizeof(RawDVContext),
-    dv_probe,
-    dv_read_header,
-    dv_read_packet,
-    dv_read_close,
-    dv_read_seek,
-    .extensions = "dv,dif",
-};
-#endif
diff --git a/libavformat/dv.h b/libavformat/dv.h
deleted file mode 100644
index ae16bef..0000000
--- a/libavformat/dv.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * General DV muxer/demuxer
- * Copyright (c) 2003 Roman Shaposhnik
- *
- * Many thanks to Dan Dennedy <dan at dennedy.org> for providing wealth
- * of DV technical info.
- *
- * Raw DV format
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_DV_H
-#define AVFORMAT_DV_H
-
-#include "avformat.h"
-
-typedef struct DVDemuxContext DVDemuxContext;
-DVDemuxContext* dv_init_demux(AVFormatContext* s);
-int dv_get_packet(DVDemuxContext*, AVPacket *);
-int dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int);
-void dv_offset_reset(DVDemuxContext *c, int64_t frame_offset);
-
-typedef struct DVMuxContext DVMuxContext;
-DVMuxContext* dv_init_mux(AVFormatContext* s);
-int dv_assemble_frame(DVMuxContext *c, AVStream*, uint8_t*, int, uint8_t**);
-void dv_delete_mux(DVMuxContext*);
-
-#endif /* AVFORMAT_DV_H */
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
deleted file mode 100644
index 0176ac9..0000000
--- a/libavformat/dvenc.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * General DV muxer/demuxer
- * Copyright (c) 2003 Roman Shaposhnik
- *
- * Many thanks to Dan Dennedy <dan at dennedy.org> for providing wealth
- * of DV technical info.
- *
- * Raw DV format
- * Copyright (c) 2002 Fabrice Bellard
- *
- * 50 Mbps (DVCPRO50) support
- * Copyright (c) 2006 Daniel Maas <dmaas at maasdigital.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <time.h>
-#include <stdarg.h>
-
-#include "avformat.h"
-#include "internal.h"
-#include "libavcodec/dvdata.h"
-#include "dv.h"
-#include "libavutil/fifo.h"
-
-struct DVMuxContext {
-    const DVprofile*  sys;           /* current DV profile, e.g.: 525/60, 625/50 */
-    int               n_ast;         /* number of stereo audio streams (up to 2) */
-    AVStream         *ast[2];        /* stereo audio streams */
-    AVFifoBuffer     *audio_data[2]; /* FIFO for storing excessive amounts of PCM */
-    int               frames;        /* current frame number */
-    time_t            start_time;    /* recording start time */
-    int               has_audio;     /* frame under contruction has audio */
-    int               has_video;     /* frame under contruction has video */
-    uint8_t           frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */
-};
-
-static const int dv_aaux_packs_dist[12][9] = {
-    { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
-    { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
-    { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
-    { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
-    { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
-    { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
-    { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
-    { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
-    { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
-    { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
-    { 0xff, 0xff, 0xff, 0x50, 0x51, 0x52, 0x53, 0xff, 0xff },
-    { 0x50, 0x51, 0x52, 0x53, 0xff, 0xff, 0xff, 0xff, 0xff },
-};
-
-static int dv_audio_frame_size(const DVprofile* sys, int frame)
-{
-    return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist) /
-                                            sizeof(sys->audio_samples_dist[0]))];
-}
-
-static int dv_write_pack(enum dv_pack_type pack_id, DVMuxContext *c, uint8_t* buf, ...)
-{
-    struct tm tc;
-    time_t ct;
-    int ltc_frame;
-    va_list ap;
-
-    buf[0] = (uint8_t)pack_id;
-    switch (pack_id) {
-    case dv_timecode:
-        ct = (time_t)av_rescale_rnd(c->frames, c->sys->time_base.num,
-                                    c->sys->time_base.den, AV_ROUND_DOWN);
-        brktimegm(ct, &tc);
-        /*
-         * LTC drop-frame frame counter drops two frames (0 and 1) every
-         * minute, unless it is exactly divisible by 10
-         */
-        ltc_frame = (c->frames + 2 * ct / 60 - 2 * ct / 600) % c->sys->ltc_divisor;
-        buf[1] = (0                 << 7) | /* color frame: 0 - unsync; 1 - sync mode */
-                 (1                 << 6) | /* drop frame timecode: 0 - nondrop; 1 - drop */
-                 ((ltc_frame / 10)  << 4) | /* tens of frames */
-                 (ltc_frame % 10);          /* units of frames */
-        buf[2] = (1                 << 7) | /* biphase mark polarity correction: 0 - even; 1 - odd */
-                 ((tc.tm_sec / 10)  << 4) | /* tens of seconds */
-                 (tc.tm_sec % 10);          /* units of seconds */
-        buf[3] = (1                 << 7) | /* binary group flag BGF0 */
-                 ((tc.tm_min / 10)  << 4) | /* tens of minutes */
-                 (tc.tm_min % 10);          /* units of minutes */
-        buf[4] = (1                 << 7) | /* binary group flag BGF2 */
-                 (1                 << 6) | /* binary group flag BGF1 */
-                 ((tc.tm_hour / 10) << 4) | /* tens of hours */
-                 (tc.tm_hour % 10);         /* units of hours */
-        break;
-    case dv_audio_source:  /* AAUX source pack */
-        va_start(ap, buf);
-        buf[1] = (1 << 7) | /* locked mode -- SMPTE only supports locked mode */
-                 (1 << 6) | /* reserved -- always 1 */
-                 (dv_audio_frame_size(c->sys, c->frames) -
-                  c->sys->audio_min_samples[0]);
-                            /* # of samples      */
-        buf[2] = (0 << 7) | /* multi-stereo      */
-                 (0 << 5) | /* #of audio channels per block: 0 -- 1 channel */
-                 (0 << 4) | /* pair bit: 0 -- one pair of channels */
-                 !!va_arg(ap, int); /* audio mode        */
-        buf[3] = (1 << 7) | /* res               */
-                 (1 << 6) | /* multi-language flag */
-                 (c->sys->dsf << 5) | /*  system: 60fields/50fields */
-                 (c->sys->n_difchan & 2); /* definition: 0 -- 25Mbps, 2 -- 50Mbps */
-        buf[4] = (1 << 7) | /* emphasis: 1 -- off */
-                 (0 << 6) | /* emphasis time constant: 0 -- reserved */
-                 (0 << 3) | /* frequency: 0 -- 48kHz, 1 -- 44,1kHz, 2 -- 32kHz */
-                  0;        /* quantization: 0 -- 16bit linear, 1 -- 12bit nonlinear */
-        va_end(ap);
-        break;
-    case dv_audio_control:
-        buf[1] = (0 << 6) | /* copy protection: 0 -- unrestricted */
-                 (1 << 4) | /* input source: 1 -- digital input */
-                 (3 << 2) | /* compression: 3 -- no information */
-                  0;        /* misc. info/SMPTE emphasis off */
-        buf[2] = (1 << 7) | /* recording start point: 1 -- no */
-                 (1 << 6) | /* recording end point: 1 -- no */
-                 (1 << 3) | /* recording mode: 1 -- original */
-                  7;
-        buf[3] = (1 << 7) | /* direction: 1 -- forward */
-                 (c->sys->pix_fmt == PIX_FMT_YUV420P ? 0x20 : /* speed */
-                                                       c->sys->ltc_divisor * 4);
-        buf[4] = (1 << 7) | /* reserved -- always 1 */
-                  0x7f;     /* genre category */
-        break;
-    case dv_audio_recdate:
-    case dv_video_recdate:  /* VAUX recording date */
-        ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
-                                            c->sys->time_base.den, AV_ROUND_DOWN);
-        brktimegm(ct, &tc);
-        buf[1] = 0xff; /* ds, tm, tens of time zone, units of time zone */
-                       /* 0xff is very likely to be "unknown" */
-        buf[2] = (3 << 6) | /* reserved -- always 1 */
-                 ((tc.tm_mday / 10) << 4) | /* Tens of day */
-                 (tc.tm_mday % 10);         /* Units of day */
-        buf[3] = /* we set high 4 bits to 0, shouldn't we set them to week? */
-                 ((tc.tm_mon / 10) << 4) |    /* Tens of month */
-                 (tc.tm_mon  % 10);           /* Units of month */
-        buf[4] = (((tc.tm_year % 100) / 10) << 4) | /* Tens of year */
-                 (tc.tm_year % 10);                 /* Units of year */
-        break;
-    case dv_audio_rectime:  /* AAUX recording time */
-    case dv_video_rectime:  /* VAUX recording time */
-        ct = c->start_time + av_rescale_rnd(c->frames, c->sys->time_base.num,
-                                                       c->sys->time_base.den, AV_ROUND_DOWN);
-        brktimegm(ct, &tc);
-        buf[1] = (3 << 6) | /* reserved -- always 1 */
-                 0x3f; /* tens of frame, units of frame: 0x3f - "unknown" ? */
-        buf[2] = (1 << 7) | /* reserved -- always 1 */
-                 ((tc.tm_sec / 10) << 4) | /* Tens of seconds */
-                 (tc.tm_sec % 10);         /* Units of seconds */
-        buf[3] = (1 << 7) | /* reserved -- always 1 */
-                 ((tc.tm_min / 10) << 4) | /* Tens of minutes */
-                 (tc.tm_min % 10);         /* Units of minutes */
-        buf[4] = (3 << 6) | /* reserved -- always 1 */
-                 ((tc.tm_hour / 10) << 4) | /* Tens of hours */
-                 (tc.tm_hour % 10);         /* Units of hours */
-        break;
-    default:
-        buf[1] = buf[2] = buf[3] = buf[4] = 0xff;
-    }
-    return 5;
-}
-
-static void dv_inject_audio(DVMuxContext *c, int channel, uint8_t* frame_ptr)
-{
-    int i, j, d, of, size;
-    size = 4 * dv_audio_frame_size(c->sys, c->frames);
-    frame_ptr += channel * c->sys->difseg_size * 150 * 80;
-    for (i = 0; i < c->sys->difseg_size; i++) {
-        frame_ptr += 6 * 80; /* skip DIF segment header */
-        for (j = 0; j < 9; j++) {
-            dv_write_pack(dv_aaux_packs_dist[i][j], c, &frame_ptr[3], i >= c->sys->difseg_size/2);
-            for (d = 8; d < 80; d+=2) {
-                of = c->sys->audio_shuffle[i][j] + (d - 8)/2 * c->sys->audio_stride;
-                if (of*2 >= size)
-                    continue;
-
-                frame_ptr[d]   = av_fifo_peek(c->audio_data[channel], of*2+1); // FIXME: maybe we have to admit
-                frame_ptr[d+1] = av_fifo_peek(c->audio_data[channel], of*2);   //        that DV is a big-endian PCM
-            }
-            frame_ptr += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */
-        }
-    }
-}
-
-static void dv_inject_metadata(DVMuxContext *c, uint8_t* frame)
-{
-    int j, k;
-    uint8_t* buf;
-
-    for (buf = frame; buf < frame + c->sys->frame_size; buf += 150 * 80) {
-        /* DV subcode: 2nd and 3d DIFs */
-        for (j = 80; j < 80 * 3; j += 80) {
-            for (k = 6; k < 6 * 8; k += 8)
-                dv_write_pack(dv_timecode, c, &buf[j+k]);
-
-            if (((long)(buf-frame)/(c->sys->frame_size/(c->sys->difseg_size*c->sys->n_difchan))%c->sys->difseg_size) > 5) { /* FIXME: is this really needed ? */
-                dv_write_pack(dv_video_recdate, c, &buf[j+14]);
-                dv_write_pack(dv_video_rectime, c, &buf[j+22]);
-                dv_write_pack(dv_video_recdate, c, &buf[j+38]);
-                dv_write_pack(dv_video_rectime, c, &buf[j+46]);
-            }
-        }
-
-        /* DV VAUX: 4th, 5th and 6th 3DIFs */
-        for (j = 80*3 + 3; j < 80*6; j += 80) {
-            dv_write_pack(dv_video_recdate, c, &buf[j+5*2]);
-            dv_write_pack(dv_video_rectime, c, &buf[j+5*3]);
-            dv_write_pack(dv_video_recdate, c, &buf[j+5*11]);
-            dv_write_pack(dv_video_rectime, c, &buf[j+5*12]);
-        }
-    }
-}
-
-/*
- * The following 3 functions constitute our interface to the world
- */
-
-int dv_assemble_frame(DVMuxContext *c, AVStream* st,
-                      uint8_t* data, int data_size, uint8_t** frame)
-{
-    int i, reqasize;
-
-    *frame = &c->frame_buf[0];
-    reqasize = 4 * dv_audio_frame_size(c->sys, c->frames);
-
-    switch (st->codec->codec_type) {
-    case AVMEDIA_TYPE_VIDEO:
-        /* FIXME: we have to have more sensible approach than this one */
-        if (c->has_video)
-            av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient audio data or severe sync problem.\n", c->frames);
-
-        memcpy(*frame, data, c->sys->frame_size);
-        c->has_video = 1;
-        break;
-    case AVMEDIA_TYPE_AUDIO:
-        for (i = 0; i < c->n_ast && st != c->ast[i]; i++);
-
-          /* FIXME: we have to have more sensible approach than this one */
-        if (av_fifo_size(c->audio_data[i]) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
-            av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
-        av_fifo_generic_write(c->audio_data[i], data, data_size, NULL);
-
-        /* Let us see if we've got enough audio for one DV frame. */
-        c->has_audio |= ((reqasize <= av_fifo_size(c->audio_data[i])) << i);
-
-        break;
-    default:
-        break;
-    }
-
-    /* Let us see if we have enough data to construct one DV frame. */
-    if (c->has_video == 1 && c->has_audio + 1 == 1 << c->n_ast) {
-        dv_inject_metadata(c, *frame);
-        c->has_audio = 0;
-        for (i=0; i < c->n_ast; i++) {
-            dv_inject_audio(c, i, *frame);
-            av_fifo_drain(c->audio_data[i], reqasize);
-            c->has_audio |= ((reqasize <= av_fifo_size(c->audio_data[i])) << i);
-        }
-
-        c->has_video = 0;
-
-        c->frames++;
-
-        return c->sys->frame_size;
-    }
-
-    return 0;
-}
-
-DVMuxContext* dv_init_mux(AVFormatContext* s)
-{
-    DVMuxContext *c = s->priv_data;
-    AVStream *vst = NULL;
-    int i;
-
-    /* we support at most 1 video and 2 audio streams */
-    if (s->nb_streams > 3)
-        return NULL;
-
-    c->n_ast  = 0;
-    c->ast[0] = c->ast[1] = NULL;
-
-    /* We have to sort out where audio and where video stream is */
-    for (i=0; i<s->nb_streams; i++) {
-        switch (s->streams[i]->codec->codec_type) {
-        case AVMEDIA_TYPE_VIDEO:
-            if (vst) return NULL;
-            vst = s->streams[i];
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            if (c->n_ast > 1) return NULL;
-            c->ast[c->n_ast++] = s->streams[i];
-            break;
-        default:
-            goto bail_out;
-        }
-    }
-
-    /* Some checks -- DV format is very picky about its incoming streams */
-    if (!vst || vst->codec->codec_id != CODEC_ID_DVVIDEO)
-        goto bail_out;
-    for (i=0; i<c->n_ast; i++) {
-        if (c->ast[i] && (c->ast[i]->codec->codec_id    != CODEC_ID_PCM_S16LE ||
-                          c->ast[i]->codec->sample_rate != 48000 ||
-                          c->ast[i]->codec->channels    != 2))
-            goto bail_out;
-    }
-    c->sys = ff_dv_codec_profile(vst->codec);
-    if (!c->sys)
-        goto bail_out;
-
-    if ((c->n_ast > 1) && (c->sys->n_difchan < 2)) {
-        /* only 1 stereo pair is allowed in 25Mbps mode */
-        goto bail_out;
-    }
-
-    /* Ok, everything seems to be in working order */
-    c->frames     = 0;
-    c->has_audio  = 0;
-    c->has_video  = 0;
-    c->start_time = (time_t)s->timestamp;
-
-    for (i=0; i < c->n_ast; i++) {
-        if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) {
-            while (i > 0) {
-                i--;
-                av_fifo_free(c->audio_data[i]);
-            }
-            goto bail_out;
-        }
-    }
-
-    return c;
-
-bail_out:
-    return NULL;
-}
-
-void dv_delete_mux(DVMuxContext *c)
-{
-    int i;
-    for (i=0; i < c->n_ast; i++)
-        av_fifo_free(c->audio_data[i]);
-}
-
-#if CONFIG_DV_MUXER
-static int dv_write_header(AVFormatContext *s)
-{
-    if (!dv_init_mux(s)) {
-        av_log(s, AV_LOG_ERROR, "Can't initialize DV format!\n"
-                    "Make sure that you supply exactly two streams:\n"
-                    "     video: 25fps or 29.97fps, audio: 2ch/48kHz/PCM\n"
-                    "     (50Mbps allows an optional second audio stream)\n");
-        return -1;
-    }
-    return 0;
-}
-
-static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    uint8_t* frame;
-    int fsize;
-
-    fsize = dv_assemble_frame(s->priv_data, s->streams[pkt->stream_index],
-                              pkt->data, pkt->size, &frame);
-    if (fsize > 0) {
-        put_buffer(s->pb, frame, fsize);
-        put_flush_packet(s->pb);
-    }
-    return 0;
-}
-
-/*
- * We might end up with some extra A/V data without matching counterpart.
- * E.g. video data without enough audio to write the complete frame.
- * Currently we simply drop the last frame. I don't know whether this
- * is the best strategy of all
- */
-static int dv_write_trailer(struct AVFormatContext *s)
-{
-    dv_delete_mux(s->priv_data);
-    return 0;
-}
-
-AVOutputFormat dv_muxer = {
-    "dv",
-    NULL_IF_CONFIG_SMALL("DV video format"),
-    NULL,
-    "dv",
-    sizeof(DVMuxContext),
-    CODEC_ID_PCM_S16LE,
-    CODEC_ID_DVVIDEO,
-    dv_write_header,
-    dv_write_packet,
-    dv_write_trailer,
-};
-#endif /* CONFIG_DV_MUXER */
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
deleted file mode 100644
index c00c917..0000000
--- a/libavformat/dxa.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * DXA demuxer
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "riff.h"
-
-#define DXA_EXTRA_SIZE  9
-
-typedef struct{
-    int frames;
-    int has_sound;
-    int bpc;
-    uint32_t bytes_left;
-    int64_t wavpos, vidpos;
-    int readvid;
-}DXAContext;
-
-static int dxa_probe(AVProbeData *p)
-{
-    int w, h;
-    if (p->buf_size < 15)
-        return 0;
-    w = AV_RB16(p->buf + 11);
-    h = AV_RB16(p->buf + 13);
-    /* check file header */
-    if (p->buf[0] == 'D' && p->buf[1] == 'E' &&
-        p->buf[2] == 'X' && p->buf[3] == 'A' &&
-        w && w <= 2048 && h && h <= 2048)
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    DXAContext *c = s->priv_data;
-    AVStream *st, *ast;
-    uint32_t tag;
-    int32_t fps;
-    int w, h;
-    int num, den;
-    int flags;
-
-    tag = get_le32(pb);
-    if (tag != MKTAG('D', 'E', 'X', 'A'))
-        return -1;
-    flags = get_byte(pb);
-    c->frames = get_be16(pb);
-    if(!c->frames){
-        av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
-        return -1;
-    }
-
-    fps = get_be32(pb);
-    if(fps > 0){
-        den = 1000;
-        num = fps;
-    }else if (fps < 0){
-        den = 100000;
-        num = -fps;
-    }else{
-        den = 10;
-        num = 1;
-    }
-    w = get_be16(pb);
-    h = get_be16(pb);
-    c->has_sound = 0;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-
-    // Parse WAV data header
-    if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){
-        uint32_t size, fsize;
-        c->has_sound = 1;
-        size = get_be32(pb);
-        c->vidpos = url_ftell(pb) + size;
-        url_fskip(pb, 16);
-        fsize = get_le32(pb);
-
-        ast = av_new_stream(s, 0);
-        if (!ast)
-            return -1;
-        ff_get_wav_header(pb, ast->codec, fsize);
-        // find 'data' chunk
-        while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
-            tag = get_le32(pb);
-            fsize = get_le32(pb);
-            if(tag == MKTAG('d', 'a', 't', 'a')) break;
-            url_fskip(pb, fsize);
-        }
-        c->bpc = (fsize + c->frames - 1) / c->frames;
-        if(ast->codec->block_align)
-            c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align;
-        c->bytes_left = fsize;
-        c->wavpos = url_ftell(pb);
-        url_fseek(pb, c->vidpos, SEEK_SET);
-    }
-
-    /* now we are ready: build format streams */
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_DXA;
-    st->codec->width      = w;
-    st->codec->height     = h;
-    av_reduce(&den, &num, den, num, (1UL<<31)-1);
-    av_set_pts_info(st, 33, num, den);
-    /* flags & 0x80 means that image is interlaced,
-     * flags & 0x40 means that image has double height
-     * either way set true height
-     */
-    if(flags & 0xC0){
-        st->codec->height >>= 1;
-    }
-    c->readvid = !c->has_sound;
-    c->vidpos  = url_ftell(pb);
-    s->start_time = 0;
-    s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
-    av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames);
-
-    return 0;
-}
-
-static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    DXAContext *c = s->priv_data;
-    int ret;
-    uint32_t size;
-    uint8_t buf[DXA_EXTRA_SIZE], pal[768+4];
-    int pal_size = 0;
-
-    if(!c->readvid && c->has_sound && c->bytes_left){
-        c->readvid = 1;
-        url_fseek(s->pb, c->wavpos, SEEK_SET);
-        size = FFMIN(c->bytes_left, c->bpc);
-        ret = av_get_packet(s->pb, pkt, size);
-        pkt->stream_index = 1;
-        if(ret != size)
-            return AVERROR(EIO);
-        c->bytes_left -= size;
-        c->wavpos = url_ftell(s->pb);
-        return 0;
-    }
-    url_fseek(s->pb, c->vidpos, SEEK_SET);
-    while(!url_feof(s->pb) && c->frames){
-        get_buffer(s->pb, buf, 4);
-        switch(AV_RL32(buf)){
-        case MKTAG('N', 'U', 'L', 'L'):
-            if(av_new_packet(pkt, 4 + pal_size) < 0)
-                return AVERROR(ENOMEM);
-            pkt->stream_index = 0;
-            if(pal_size) memcpy(pkt->data, pal, pal_size);
-            memcpy(pkt->data + pal_size, buf, 4);
-            c->frames--;
-            c->vidpos = url_ftell(s->pb);
-            c->readvid = 0;
-            return 0;
-        case MKTAG('C', 'M', 'A', 'P'):
-            pal_size = 768+4;
-            memcpy(pal, buf, 4);
-            get_buffer(s->pb, pal + 4, 768);
-            break;
-        case MKTAG('F', 'R', 'A', 'M'):
-            get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
-            size = AV_RB32(buf + 5);
-            if(size > 0xFFFFFF){
-                av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
-                return -1;
-            }
-            if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
-                return AVERROR(ENOMEM);
-            memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
-            ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
-            if(ret != size){
-                av_free_packet(pkt);
-                return AVERROR(EIO);
-            }
-            if(pal_size) memcpy(pkt->data, pal, pal_size);
-            pkt->stream_index = 0;
-            c->frames--;
-            c->vidpos = url_ftell(s->pb);
-            c->readvid = 0;
-            return 0;
-        default:
-            av_log(s, AV_LOG_ERROR, "Unknown tag %c%c%c%c\n", buf[0], buf[1], buf[2], buf[3]);
-            return -1;
-        }
-    }
-    return AVERROR(EIO);
-}
-
-AVInputFormat dxa_demuxer = {
-    "dxa",
-    NULL_IF_CONFIG_SMALL("DXA"),
-    sizeof(DXAContext),
-    dxa_probe,
-    dxa_read_header,
-    dxa_read_packet,
-};
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
deleted file mode 100644
index 32c3343..0000000
--- a/libavformat/eacdata.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Electronic Arts .cdata file Demuxer
- * Copyright (c) 2007 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Electronic Arts cdata Format Demuxer
- * by Peter Ross (pross at xvid.org)
- *
- * Technical details here:
- *  http://wiki.multimedia.cx/index.php?title=EA_Command_And_Conquer_3_Audio_Codec
- */
-
-#include "avformat.h"
-
-typedef struct {
-  unsigned int channels;
-  unsigned int audio_pts;
-} CdataDemuxContext;
-
-static int cdata_probe(AVProbeData *p)
-{
-    const uint8_t *b = p->buf;
-
-    if (b[0] == 0x04 && (b[1] == 0x00 || b[1] == 0x04 || b[1] == 0x0C))
-        return AVPROBE_SCORE_MAX/8;
-    return 0;
-}
-
-static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    CdataDemuxContext *cdata = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned int sample_rate, header;
-    AVStream *st;
-
-    header = get_be16(pb);
-    switch (header) {
-        case 0x0400: cdata->channels = 1; break;
-        case 0x0404: cdata->channels = 2; break;
-        case 0x040C: cdata->channels = 4; break;
-        default:
-            av_log(s, AV_LOG_INFO, "unknown header 0x%04x\n", header);
-            return -1;
-    };
-
-    sample_rate = get_be16(pb);
-    url_fskip(pb, 12);
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_tag = 0; /* no fourcc */
-    st->codec->codec_id = CODEC_ID_ADPCM_EA_XAS;
-    st->codec->channels = cdata->channels;
-    st->codec->sample_rate = sample_rate;
-    av_set_pts_info(st, 64, 1, sample_rate);
-
-    cdata->audio_pts = 0;
-    return 0;
-}
-
-static int cdata_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    CdataDemuxContext *cdata = s->priv_data;
-    int packet_size = 76*cdata->channels;
-
-    int ret = av_get_packet(s->pb, pkt, packet_size);
-    if (ret < 0)
-        return ret;
-    pkt->pts = cdata->audio_pts++;
-    return 0;
-}
-
-AVInputFormat ea_cdata_demuxer = {
-    "ea_cdata",
-    NULL_IF_CONFIG_SMALL("Electronic Arts cdata"),
-    sizeof(CdataDemuxContext),
-    cdata_probe,
-    cdata_read_header,
-    cdata_read_packet,
-    .extensions = "cdata",
-};
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
deleted file mode 100644
index 86d7f91..0000000
--- a/libavformat/electronicarts.c
+++ /dev/null
@@ -1,567 +0,0 @@
-/* Electronic Arts Multimedia File Demuxer
- * Copyright (c) 2004  The ffmpeg Project
- * Copyright (c) 2006-2008 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Electronic Arts Multimedia file demuxer (WVE/UV2/etc.)
- * by Robin Kay (komadori at gekkou.co.uk)
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define SCHl_TAG MKTAG('S', 'C', 'H', 'l')
-#define SEAD_TAG MKTAG('S', 'E', 'A', 'D')    /* Sxxx header */
-#define SNDC_TAG MKTAG('S', 'N', 'D', 'C')    /* Sxxx data */
-#define SEND_TAG MKTAG('S', 'E', 'N', 'D')    /* Sxxx end */
-#define SHEN_TAG MKTAG('S', 'H', 'E', 'N')    /* SxEN header */
-#define SDEN_TAG MKTAG('S', 'D', 'E', 'N')    /* SxEN data */
-#define SEEN_TAG MKTAG('S', 'E', 'E', 'N')    /* SxEN end */
-#define ISNh_TAG MKTAG('1', 'S', 'N', 'h')    /* 1SNx header */
-#define EACS_TAG MKTAG('E', 'A', 'C', 'S')
-#define ISNd_TAG MKTAG('1', 'S', 'N', 'd')    /* 1SNx data */
-#define ISNe_TAG MKTAG('1', 'S', 'N', 'e')    /* 1SNx end */
-#define PT00_TAG MKTAG('P', 'T', 0x0, 0x0)
-#define GSTR_TAG MKTAG('G', 'S', 'T', 'R')
-#define SCDl_TAG MKTAG('S', 'C', 'D', 'l')
-#define SCEl_TAG MKTAG('S', 'C', 'E', 'l')
-#define kVGT_TAG MKTAG('k', 'V', 'G', 'T')    /* TGV i-frame */
-#define fVGT_TAG MKTAG('f', 'V', 'G', 'T')    /* TGV p-frame */
-#define mTCD_TAG MKTAG('m', 'T', 'C', 'D')    /* MDEC */
-#define MADk_TAG MKTAG('M', 'A', 'D', 'k')    /* MAD i-frame */
-#define MADm_TAG MKTAG('M', 'A', 'D', 'm')    /* MAD p-frame */
-#define MADe_TAG MKTAG('M', 'A', 'D', 'e')    /* MAD lqp-frame */
-#define MPCh_TAG MKTAG('M', 'P', 'C', 'h')    /* MPEG2 */
-#define TGQs_TAG MKTAG('T', 'G', 'Q', 's')    /* TGQ i-frame (appears in .TGQ files) */
-#define pQGT_TAG MKTAG('p', 'Q', 'G', 'T')    /* TGQ i-frame (appears in .UV files) */
-#define pIQT_TAG MKTAG('p', 'I', 'Q', 'T')    /* TQI/UV2 i-frame (.UV2/.WVE) */
-#define MVhd_TAG MKTAG('M', 'V', 'h', 'd')
-#define MV0K_TAG MKTAG('M', 'V', '0', 'K')
-#define MV0F_TAG MKTAG('M', 'V', '0', 'F')
-#define MVIh_TAG MKTAG('M', 'V', 'I', 'h')    /* CMV header */
-#define MVIf_TAG MKTAG('M', 'V', 'I', 'f')    /* CMV i-frame */
-
-typedef struct EaDemuxContext {
-    int big_endian;
-
-    enum CodecID video_codec;
-    AVRational time_base;
-    int width, height;
-    int video_stream_index;
-
-    enum CodecID audio_codec;
-    int audio_stream_index;
-    int audio_frame_counter;
-
-    int bytes;
-    int sample_rate;
-    int num_channels;
-    int num_samples;
-} EaDemuxContext;
-
-static uint32_t read_arbitary(ByteIOContext *pb) {
-    uint8_t size, byte;
-    int i;
-    uint32_t word;
-
-    size = get_byte(pb);
-
-    word = 0;
-    for (i = 0; i < size; i++) {
-        byte = get_byte(pb);
-        word <<= 8;
-        word |= byte;
-    }
-
-    return word;
-}
-
-/*
- * Process PT/GSTR sound header
- * return 1 if success, 0 if invalid format, otherwise AVERROR_xxx
- */
-static int process_audio_header_elements(AVFormatContext *s)
-{
-    int inHeader = 1;
-    EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int compression_type = -1, revision = -1, revision2 = -1;
-
-    ea->bytes = 2;
-    ea->sample_rate = -1;
-    ea->num_channels = 1;
-
-    while (inHeader) {
-        int inSubheader;
-        uint8_t byte;
-        byte = get_byte(pb);
-
-        switch (byte) {
-        case 0xFD:
-            av_log (s, AV_LOG_DEBUG, "entered audio subheader\n");
-            inSubheader = 1;
-            while (inSubheader) {
-                uint8_t subbyte;
-                subbyte = get_byte(pb);
-
-                switch (subbyte) {
-                case 0x80:
-                    revision = read_arbitary(pb);
-                    av_log (s, AV_LOG_DEBUG, "revision (element 0x80) set to 0x%08x\n", revision);
-                    break;
-                case 0x82:
-                    ea->num_channels = read_arbitary(pb);
-                    av_log (s, AV_LOG_DEBUG, "num_channels (element 0x82) set to 0x%08x\n", ea->num_channels);
-                    break;
-                case 0x83:
-                    compression_type = read_arbitary(pb);
-                    av_log (s, AV_LOG_DEBUG, "compression_type (element 0x83) set to 0x%08x\n", compression_type);
-                    break;
-                case 0x84:
-                    ea->sample_rate = read_arbitary(pb);
-                    av_log (s, AV_LOG_DEBUG, "sample_rate (element 0x84) set to %i\n", ea->sample_rate);
-                    break;
-                case 0x85:
-                    ea->num_samples = read_arbitary(pb);
-                    av_log (s, AV_LOG_DEBUG, "num_samples (element 0x85) set to 0x%08x\n", ea->num_samples);
-                    break;
-                case 0x8A:
-                    av_log (s, AV_LOG_DEBUG, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
-                    av_log (s, AV_LOG_DEBUG, "exited audio subheader\n");
-                    inSubheader = 0;
-                    break;
-                case 0xA0:
-                    revision2 = read_arbitary(pb);
-                    av_log (s, AV_LOG_DEBUG, "revision2 (element 0xA0) set to 0x%08x\n", revision2);
-                    break;
-                case 0xFF:
-                    av_log (s, AV_LOG_DEBUG, "end of header block reached (within audio subheader)\n");
-                    inSubheader = 0;
-                    inHeader = 0;
-                    break;
-                default:
-                    av_log (s, AV_LOG_DEBUG, "element 0x%02x set to 0x%08x\n", subbyte, read_arbitary(pb));
-                    break;
-                }
-            }
-            break;
-        case 0xFF:
-            av_log (s, AV_LOG_DEBUG, "end of header block reached\n");
-            inHeader = 0;
-            break;
-        default:
-            av_log (s, AV_LOG_DEBUG, "header element 0x%02x set to 0x%08x\n", byte, read_arbitary(pb));
-            break;
-        }
-    }
-
-    switch (compression_type) {
-    case  0: ea->audio_codec = CODEC_ID_PCM_S16LE; break;
-    case  7: ea->audio_codec = CODEC_ID_ADPCM_EA; break;
-    case -1:
-        switch (revision) {
-        case  1: ea->audio_codec = CODEC_ID_ADPCM_EA_R1; break;
-        case  2: ea->audio_codec = CODEC_ID_ADPCM_EA_R2; break;
-        case  3: ea->audio_codec = CODEC_ID_ADPCM_EA_R3; break;
-        case -1: break;
-        default:
-            av_log(s, AV_LOG_ERROR, "unsupported stream type; revision=%i\n", revision);
-            return 0;
-        }
-        switch (revision2) {
-        case  8: ea->audio_codec = CODEC_ID_PCM_S16LE_PLANAR; break;
-        case 10: ea->audio_codec = CODEC_ID_ADPCM_EA_R2; break;
-        case 16: ea->audio_codec = CODEC_ID_MP3; break;
-        case -1: break;
-        default:
-            ea->audio_codec = CODEC_ID_NONE;
-            av_log(s, AV_LOG_ERROR, "unsupported stream type; revision2=%i\n", revision2);
-            return 0;
-        }
-        break;
-    default:
-        av_log(s, AV_LOG_ERROR, "unsupported stream type; compression_type=%i\n", compression_type);
-        return 0;
-    }
-
-    if (ea->sample_rate == -1)
-        ea->sample_rate = revision==3 ? 48000 : 22050;
-
-    return 1;
-}
-
-/*
- * Process EACS sound header
- * return 1 if success, 0 if invalid format, otherwise AVERROR_xxx
- */
-static int process_audio_header_eacs(AVFormatContext *s)
-{
-    EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int compression_type;
-
-    ea->sample_rate  = ea->big_endian ? get_be32(pb) : get_le32(pb);
-    ea->bytes        = get_byte(pb);   /* 1=8-bit, 2=16-bit */
-    ea->num_channels = get_byte(pb);
-    compression_type = get_byte(pb);
-    url_fskip(pb, 13);
-
-    switch (compression_type) {
-    case 0:
-        switch (ea->bytes) {
-        case 1: ea->audio_codec = CODEC_ID_PCM_S8;    break;
-        case 2: ea->audio_codec = CODEC_ID_PCM_S16LE; break;
-        }
-        break;
-    case 1: ea->audio_codec = CODEC_ID_PCM_MULAW; ea->bytes = 1; break;
-    case 2: ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_EACS; break;
-    default:
-        av_log (s, AV_LOG_ERROR, "unsupported stream type; audio compression_type=%i\n", compression_type);
-    }
-
-    return 1;
-}
-
-/*
- * Process SEAD sound header
- * return 1 if success, 0 if invalid format, otherwise AVERROR_xxx
- */
-static int process_audio_header_sead(AVFormatContext *s)
-{
-    EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    ea->sample_rate  = get_le32(pb);
-    ea->bytes        = get_le32(pb);  /* 1=8-bit, 2=16-bit */
-    ea->num_channels = get_le32(pb);
-    ea->audio_codec  = CODEC_ID_ADPCM_IMA_EA_SEAD;
-
-    return 1;
-}
-
-static int process_video_header_mdec(AVFormatContext *s)
-{
-    EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    url_fskip(pb, 4);
-    ea->width  = get_le16(pb);
-    ea->height = get_le16(pb);
-    ea->time_base = (AVRational){1,15};
-    ea->video_codec = CODEC_ID_MDEC;
-    return 1;
-}
-
-static int process_video_header_vp6(AVFormatContext *s)
-{
-    EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    url_fskip(pb, 16);
-    ea->time_base.den = get_le32(pb);
-    ea->time_base.num = get_le32(pb);
-    ea->video_codec = CODEC_ID_VP6;
-
-    return 1;
-}
-
-/*
- * Process EA file header
- * Returns 1 if the EA file is valid and successfully opened, 0 otherwise
- */
-static int process_ea_header(AVFormatContext *s) {
-    uint32_t blockid, size = 0;
-    EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int i;
-
-    for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
-        unsigned int startpos = url_ftell(pb);
-        int err = 0;
-
-        blockid = get_le32(pb);
-        size = get_le32(pb);
-        if (i == 0)
-            ea->big_endian = size > 0x000FFFFF;
-        if (ea->big_endian)
-            size = bswap_32(size);
-
-        switch (blockid) {
-            case ISNh_TAG:
-                if (get_le32(pb) != EACS_TAG) {
-                    av_log (s, AV_LOG_ERROR, "unknown 1SNh headerid\n");
-                    return 0;
-                }
-                err = process_audio_header_eacs(s);
-                break;
-
-            case SCHl_TAG :
-            case SHEN_TAG :
-                blockid = get_le32(pb);
-                if (blockid == GSTR_TAG) {
-                    url_fskip(pb, 4);
-                } else if ((blockid & 0xFFFF)!=PT00_TAG) {
-                    av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n");
-                    return 0;
-                }
-                err = process_audio_header_elements(s);
-                break;
-
-            case SEAD_TAG:
-                err = process_audio_header_sead(s);
-                break;
-
-            case MVIh_TAG :
-                ea->video_codec = CODEC_ID_CMV;
-                ea->time_base = (AVRational){0,0};
-                break;
-
-            case kVGT_TAG:
-                ea->video_codec = CODEC_ID_TGV;
-                ea->time_base = (AVRational){0,0};
-                break;
-
-            case mTCD_TAG :
-                err = process_video_header_mdec(s);
-                break;
-
-            case MPCh_TAG:
-                ea->video_codec = CODEC_ID_MPEG2VIDEO;
-                break;
-
-            case pQGT_TAG:
-            case TGQs_TAG:
-                ea->video_codec = CODEC_ID_TGQ;
-                break;
-
-            case pIQT_TAG:
-                ea->video_codec = CODEC_ID_TQI;
-                break;
-
-            case MADk_TAG :
-                ea->video_codec = CODEC_ID_MAD;
-                break;
-
-            case MVhd_TAG :
-                err = process_video_header_vp6(s);
-                break;
-        }
-
-        if (err < 0) {
-            av_log(s, AV_LOG_ERROR, "error parsing header: %i\n", err);
-            return err;
-        }
-
-        url_fseek(pb, startpos + size, SEEK_SET);
-    }
-
-    url_fseek(pb, 0, SEEK_SET);
-
-    return 1;
-}
-
-
-static int ea_probe(AVProbeData *p)
-{
-    switch (AV_RL32(&p->buf[0])) {
-    case ISNh_TAG:
-    case SCHl_TAG:
-    case SEAD_TAG:
-    case SHEN_TAG:
-    case kVGT_TAG:
-    case MADk_TAG:
-    case MPCh_TAG:
-    case MVhd_TAG:
-    case MVIh_TAG:
-        break;
-    default:
-        return 0;
-    }
-    if (AV_RL32(&p->buf[4]) > 0xfffff && AV_RB32(&p->buf[4]) > 0xfffff)
-        return 0;
-    return AVPROBE_SCORE_MAX;
-}
-
-static int ea_read_header(AVFormatContext *s,
-                          AVFormatParameters *ap)
-{
-    EaDemuxContext *ea = s->priv_data;
-    AVStream *st;
-
-    if (!process_ea_header(s))
-        return AVERROR(EIO);
-
-    if (ea->video_codec) {
-        /* initialize the video decoder stream */
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        ea->video_stream_index = st->index;
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        st->codec->codec_id = ea->video_codec;
-        st->codec->codec_tag = 0;  /* no fourcc */
-        st->codec->time_base = ea->time_base;
-        st->codec->width = ea->width;
-        st->codec->height = ea->height;
-    }
-
-    if (ea->audio_codec) {
-        /* initialize the audio decoder stream */
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        av_set_pts_info(st, 33, 1, ea->sample_rate);
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = ea->audio_codec;
-        st->codec->codec_tag = 0;  /* no tag */
-        st->codec->channels = ea->num_channels;
-        st->codec->sample_rate = ea->sample_rate;
-        st->codec->bits_per_coded_sample = ea->bytes * 8;
-        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-            st->codec->bits_per_coded_sample / 4;
-        st->codec->block_align = st->codec->channels*st->codec->bits_per_coded_sample;
-        ea->audio_stream_index = st->index;
-        ea->audio_frame_counter = 0;
-    }
-
-    return 1;
-}
-
-static int ea_read_packet(AVFormatContext *s,
-                          AVPacket *pkt)
-{
-    EaDemuxContext *ea = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret = 0;
-    int packet_read = 0;
-    unsigned int chunk_type, chunk_size;
-    int key = 0;
-    int av_uninit(num_samples);
-
-    while (!packet_read) {
-        chunk_type = get_le32(pb);
-        chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8;
-
-        switch (chunk_type) {
-        /* audio data */
-        case ISNh_TAG:
-            /* header chunk also contains data; skip over the header portion*/
-            url_fskip(pb, 32);
-            chunk_size -= 32;
-        case ISNd_TAG:
-        case SCDl_TAG:
-        case SNDC_TAG:
-        case SDEN_TAG:
-            if (!ea->audio_codec) {
-                url_fskip(pb, chunk_size);
-                break;
-            } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
-                       ea->audio_codec == CODEC_ID_MP3) {
-                num_samples = get_le32(pb);
-                url_fskip(pb, 8);
-                chunk_size -= 12;
-            }
-            ret = av_get_packet(pb, pkt, chunk_size);
-            if (ret < 0)
-                return ret;
-            pkt->stream_index = ea->audio_stream_index;
-            pkt->pts = 90000;
-            pkt->pts *= ea->audio_frame_counter;
-            pkt->pts /= ea->sample_rate;
-
-            switch (ea->audio_codec) {
-            case CODEC_ID_ADPCM_EA:
-                /* 2 samples/byte, 1 or 2 samples per frame depending
-                 * on stereo; chunk also has 12-byte header */
-                ea->audio_frame_counter += ((chunk_size - 12) * 2) /
-                    ea->num_channels;
-                break;
-            case CODEC_ID_PCM_S16LE_PLANAR:
-            case CODEC_ID_MP3:
-                ea->audio_frame_counter += num_samples;
-                break;
-            default:
-                ea->audio_frame_counter += chunk_size /
-                    (ea->bytes * ea->num_channels);
-            }
-
-            packet_read = 1;
-            break;
-
-        /* ending tag */
-        case 0:
-        case ISNe_TAG:
-        case SCEl_TAG:
-        case SEND_TAG:
-        case SEEN_TAG:
-            ret = AVERROR(EIO);
-            packet_read = 1;
-            break;
-
-        case MVIh_TAG:
-        case kVGT_TAG:
-        case pQGT_TAG:
-        case TGQs_TAG:
-        case MADk_TAG:
-            key = AV_PKT_FLAG_KEY;
-        case MVIf_TAG:
-        case fVGT_TAG:
-        case MADm_TAG:
-        case MADe_TAG:
-            url_fseek(pb, -8, SEEK_CUR);     // include chunk preamble
-            chunk_size += 8;
-            goto get_video_packet;
-
-        case mTCD_TAG:
-            url_fseek(pb, 8, SEEK_CUR);  // skip ea dct header
-            chunk_size -= 8;
-            goto get_video_packet;
-
-        case MV0K_TAG:
-        case MPCh_TAG:
-        case pIQT_TAG:
-            key = AV_PKT_FLAG_KEY;
-        case MV0F_TAG:
-get_video_packet:
-            ret = av_get_packet(pb, pkt, chunk_size);
-            if (ret < 0)
-                return ret;
-            pkt->stream_index = ea->video_stream_index;
-            pkt->flags |= key;
-            packet_read = 1;
-            break;
-
-        default:
-            url_fseek(pb, chunk_size, SEEK_CUR);
-            break;
-        }
-    }
-
-    return ret;
-}
-
-AVInputFormat ea_demuxer = {
-    "ea",
-    NULL_IF_CONFIG_SMALL("Electronic Arts Multimedia Format"),
-    sizeof(EaDemuxContext),
-    ea_probe,
-    ea_read_header,
-    ea_read_packet,
-};
diff --git a/libavformat/ffm.h b/libavformat/ffm.h
deleted file mode 100644
index 05d6eb1..0000000
--- a/libavformat/ffm.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * FFM (ffserver live feed) common header
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_FFM_H
-#define AVFORMAT_FFM_H
-
-#include <stdint.h>
-#include "avformat.h"
-#include "avio.h"
-
-/* The FFM file is made of blocks of fixed size */
-#define FFM_HEADER_SIZE 14
-#define PACKET_ID       0x666d
-
-/* each packet contains frames (which can span several packets */
-#define FRAME_HEADER_SIZE    16
-#define FLAG_KEY_FRAME       0x01
-#define FLAG_DTS             0x02
-
-enum {
-    READ_HEADER,
-    READ_DATA,
-};
-
-typedef struct FFMContext {
-    /* only reading mode */
-    int64_t write_index, file_size;
-    int read_state;
-    uint8_t header[FRAME_HEADER_SIZE+4];
-
-    /* read and write */
-    int first_packet; /* true if first packet, needed to set the discontinuity tag */
-    int packet_size;
-    int frame_offset;
-    int64_t dts;
-    uint8_t *packet_ptr, *packet_end;
-    uint8_t packet[FFM_PACKET_SIZE];
-} FFMContext;
-
-#endif /* AVFORMAT_FFM_H */
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
deleted file mode 100644
index b2a4bc2..0000000
--- a/libavformat/ffmdec.c
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- * FFM (ffserver live feed) demuxer
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "ffm.h"
-#if CONFIG_FFSERVER
-#include <unistd.h>
-
-int64_t ffm_read_write_index(int fd)
-{
-    uint8_t buf[8];
-
-    lseek(fd, 8, SEEK_SET);
-    if (read(fd, buf, 8) != 8)
-        return AVERROR(EIO);
-    return AV_RB64(buf);
-}
-
-int ffm_write_write_index(int fd, int64_t pos)
-{
-    uint8_t buf[8];
-    int i;
-
-    for(i=0;i<8;i++)
-        buf[i] = (pos >> (56 - i * 8)) & 0xff;
-    lseek(fd, 8, SEEK_SET);
-    if (write(fd, buf, 8) != 8)
-        return AVERROR(EIO);
-    return 8;
-}
-
-void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size)
-{
-    FFMContext *ffm = s->priv_data;
-    ffm->write_index = pos;
-    ffm->file_size = file_size;
-}
-#endif // CONFIG_FFSERVER
-
-static int ffm_is_avail_data(AVFormatContext *s, int size)
-{
-    FFMContext *ffm = s->priv_data;
-    int64_t pos, avail_size;
-    int len;
-
-    len = ffm->packet_end - ffm->packet_ptr;
-    if (size <= len)
-        return 1;
-    pos = url_ftell(s->pb);
-    if (!ffm->write_index) {
-        if (pos == ffm->file_size)
-            return AVERROR_EOF;
-        avail_size = ffm->file_size - pos;
-    } else {
-    if (pos == ffm->write_index) {
-        /* exactly at the end of stream */
-        return AVERROR(EAGAIN);
-    } else if (pos < ffm->write_index) {
-        avail_size = ffm->write_index - pos;
-    } else {
-        avail_size = (ffm->file_size - pos) + (ffm->write_index - FFM_PACKET_SIZE);
-    }
-    }
-    avail_size = (avail_size / ffm->packet_size) * (ffm->packet_size - FFM_HEADER_SIZE) + len;
-    if (size <= avail_size)
-        return 1;
-    else
-        return AVERROR(EAGAIN);
-}
-
-static int ffm_resync(AVFormatContext *s, int state)
-{
-    av_log(s, AV_LOG_ERROR, "resyncing\n");
-    while (state != PACKET_ID) {
-        if (url_feof(s->pb)) {
-            av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
-            return -1;
-        }
-        state = (state << 8) | get_byte(s->pb);
-    }
-    return 0;
-}
-
-/* first is true if we read the frame header */
-static int ffm_read_data(AVFormatContext *s,
-                         uint8_t *buf, int size, int header)
-{
-    FFMContext *ffm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int len, fill_size, size1, frame_offset, id;
-
-    size1 = size;
-    while (size > 0) {
-    redo:
-        len = ffm->packet_end - ffm->packet_ptr;
-        if (len < 0)
-            return -1;
-        if (len > size)
-            len = size;
-        if (len == 0) {
-            if (url_ftell(pb) == ffm->file_size)
-                url_fseek(pb, ffm->packet_size, SEEK_SET);
-    retry_read:
-            id = get_be16(pb); /* PACKET_ID */
-            if (id != PACKET_ID)
-                if (ffm_resync(s, id) < 0)
-                    return -1;
-            fill_size = get_be16(pb);
-            ffm->dts = get_be64(pb);
-            frame_offset = get_be16(pb);
-            get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
-            ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
-            if (ffm->packet_end < ffm->packet || frame_offset < 0)
-                return -1;
-            /* if first packet or resynchronization packet, we must
-               handle it specifically */
-            if (ffm->first_packet || (frame_offset & 0x8000)) {
-                if (!frame_offset) {
-                    /* This packet has no frame headers in it */
-                    if (url_ftell(pb) >= ffm->packet_size * 3) {
-                        url_fseek(pb, -ffm->packet_size * 2, SEEK_CUR);
-                        goto retry_read;
-                    }
-                    /* This is bad, we cannot find a valid frame header */
-                    return 0;
-                }
-                ffm->first_packet = 0;
-                if ((frame_offset & 0x7fff) < FFM_HEADER_SIZE)
-                    return -1;
-                ffm->packet_ptr = ffm->packet + (frame_offset & 0x7fff) - FFM_HEADER_SIZE;
-                if (!header)
-                    break;
-            } else {
-                ffm->packet_ptr = ffm->packet;
-            }
-            goto redo;
-        }
-        memcpy(buf, ffm->packet_ptr, len);
-        buf += len;
-        ffm->packet_ptr += len;
-        size -= len;
-        header = 0;
-    }
-    return size1 - size;
-}
-
-//#define DEBUG_SEEK
-
-/* ensure that acutal seeking happens between FFM_PACKET_SIZE
-   and file_size - FFM_PACKET_SIZE */
-static void ffm_seek1(AVFormatContext *s, int64_t pos1)
-{
-    FFMContext *ffm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos;
-
-    pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE);
-    pos = FFMAX(pos, FFM_PACKET_SIZE);
-#ifdef DEBUG_SEEK
-    av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
-#endif
-    url_fseek(pb, pos, SEEK_SET);
-}
-
-static int64_t get_dts(AVFormatContext *s, int64_t pos)
-{
-    ByteIOContext *pb = s->pb;
-    int64_t dts;
-
-    ffm_seek1(s, pos);
-    url_fskip(pb, 4);
-    dts = get_be64(pb);
-#ifdef DEBUG_SEEK
-    av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
-#endif
-    return dts;
-}
-
-static void adjust_write_index(AVFormatContext *s)
-{
-    FFMContext *ffm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pts;
-    //int64_t orig_write_index = ffm->write_index;
-    int64_t pos_min, pos_max;
-    int64_t pts_start;
-    int64_t ptr = url_ftell(pb);
-
-
-    pos_min = 0;
-    pos_max = ffm->file_size - 2 * FFM_PACKET_SIZE;
-
-    pts_start = get_dts(s, pos_min);
-
-    pts = get_dts(s, pos_max);
-
-    if (pts - 100000 > pts_start)
-        goto end;
-
-    ffm->write_index = FFM_PACKET_SIZE;
-
-    pts_start = get_dts(s, pos_min);
-
-    pts = get_dts(s, pos_max);
-
-    if (pts - 100000 <= pts_start) {
-        while (1) {
-            int64_t newpos;
-            int64_t newpts;
-
-            newpos = ((pos_max + pos_min) / (2 * FFM_PACKET_SIZE)) * FFM_PACKET_SIZE;
-
-            if (newpos == pos_min)
-                break;
-
-            newpts = get_dts(s, newpos);
-
-            if (newpts - 100000 <= pts) {
-                pos_max = newpos;
-                pts = newpts;
-            } else {
-                pos_min = newpos;
-            }
-        }
-        ffm->write_index += pos_max;
-    }
-
-    //printf("Adjusted write index from %"PRId64" to %"PRId64": pts=%0.6f\n", orig_write_index, ffm->write_index, pts / 1000000.);
-    //printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
-
- end:
-    url_fseek(pb, ptr, SEEK_SET);
-}
-
-
-static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    FFMContext *ffm = s->priv_data;
-    AVStream *st;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *codec;
-    int i, nb_streams;
-    uint32_t tag;
-
-    /* header */
-    tag = get_le32(pb);
-    if (tag != MKTAG('F', 'F', 'M', '1'))
-        goto fail;
-    ffm->packet_size = get_be32(pb);
-    if (ffm->packet_size != FFM_PACKET_SIZE)
-        goto fail;
-    ffm->write_index = get_be64(pb);
-    /* get also filesize */
-    if (!url_is_streamed(pb)) {
-        ffm->file_size = url_fsize(pb);
-        if (ffm->write_index)
-            adjust_write_index(s);
-    } else {
-        ffm->file_size = (UINT64_C(1) << 63) - 1;
-    }
-
-    nb_streams = get_be32(pb);
-    get_be32(pb); /* total bitrate */
-    /* read each stream */
-    for(i=0;i<nb_streams;i++) {
-        char rc_eq_buf[128];
-
-        st = av_new_stream(s, 0);
-        if (!st)
-            goto fail;
-
-        av_set_pts_info(st, 64, 1, 1000000);
-
-        codec = st->codec;
-        /* generic info */
-        codec->codec_id = get_be32(pb);
-        codec->codec_type = get_byte(pb); /* codec_type */
-        codec->bit_rate = get_be32(pb);
-        st->quality = get_be32(pb);
-        codec->flags = get_be32(pb);
-        codec->flags2 = get_be32(pb);
-        codec->debug = get_be32(pb);
-        /* specific info */
-        switch(codec->codec_type) {
-        case AVMEDIA_TYPE_VIDEO:
-            codec->time_base.num = get_be32(pb);
-            codec->time_base.den = get_be32(pb);
-            codec->width = get_be16(pb);
-            codec->height = get_be16(pb);
-            codec->gop_size = get_be16(pb);
-            codec->pix_fmt = get_be32(pb);
-            codec->qmin = get_byte(pb);
-            codec->qmax = get_byte(pb);
-            codec->max_qdiff = get_byte(pb);
-            codec->qcompress = get_be16(pb) / 10000.0;
-            codec->qblur = get_be16(pb) / 10000.0;
-            codec->bit_rate_tolerance = get_be32(pb);
-            codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf)));
-            codec->rc_max_rate = get_be32(pb);
-            codec->rc_min_rate = get_be32(pb);
-            codec->rc_buffer_size = get_be32(pb);
-            codec->i_quant_factor = av_int2dbl(get_be64(pb));
-            codec->b_quant_factor = av_int2dbl(get_be64(pb));
-            codec->i_quant_offset = av_int2dbl(get_be64(pb));
-            codec->b_quant_offset = av_int2dbl(get_be64(pb));
-            codec->dct_algo = get_be32(pb);
-            codec->strict_std_compliance = get_be32(pb);
-            codec->max_b_frames = get_be32(pb);
-            codec->luma_elim_threshold = get_be32(pb);
-            codec->chroma_elim_threshold = get_be32(pb);
-            codec->mpeg_quant = get_be32(pb);
-            codec->intra_dc_precision = get_be32(pb);
-            codec->me_method = get_be32(pb);
-            codec->mb_decision = get_be32(pb);
-            codec->nsse_weight = get_be32(pb);
-            codec->frame_skip_cmp = get_be32(pb);
-            codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb));
-            codec->codec_tag = get_be32(pb);
-            codec->thread_count = get_byte(pb);
-            codec->coder_type = get_be32(pb);
-            codec->me_cmp = get_be32(pb);
-            codec->partitions = get_be32(pb);
-            codec->me_subpel_quality = get_be32(pb);
-            codec->me_range = get_be32(pb);
-            codec->keyint_min = get_be32(pb);
-            codec->scenechange_threshold = get_be32(pb);
-            codec->b_frame_strategy = get_be32(pb);
-            codec->qcompress = av_int2dbl(get_be64(pb));
-            codec->qblur = av_int2dbl(get_be64(pb));
-            codec->max_qdiff = get_be32(pb);
-            codec->refs = get_be32(pb);
-            codec->directpred = get_be32(pb);
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            codec->sample_rate = get_be32(pb);
-            codec->channels = get_le16(pb);
-            codec->frame_size = get_le16(pb);
-            codec->sample_fmt = (int16_t) get_le16(pb);
-            break;
-        default:
-            goto fail;
-        }
-        if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
-            codec->extradata_size = get_be32(pb);
-            codec->extradata = av_malloc(codec->extradata_size);
-            if (!codec->extradata)
-                return AVERROR(ENOMEM);
-            get_buffer(pb, codec->extradata, codec->extradata_size);
-        }
-    }
-
-    /* get until end of block reached */
-    while ((url_ftell(pb) % ffm->packet_size) != 0)
-        get_byte(pb);
-
-    /* init packet demux */
-    ffm->packet_ptr = ffm->packet;
-    ffm->packet_end = ffm->packet;
-    ffm->frame_offset = 0;
-    ffm->dts = 0;
-    ffm->read_state = READ_HEADER;
-    ffm->first_packet = 1;
-    return 0;
- fail:
-    for(i=0;i<s->nb_streams;i++) {
-        st = s->streams[i];
-        if (st) {
-            av_free(st);
-        }
-    }
-    return -1;
-}
-
-/* return < 0 if eof */
-static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int size;
-    FFMContext *ffm = s->priv_data;
-    int duration, ret;
-
-    switch(ffm->read_state) {
-    case READ_HEADER:
-        if ((ret = ffm_is_avail_data(s, FRAME_HEADER_SIZE+4)) < 0)
-            return ret;
-
-        dprintf(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
-               url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
-        if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
-            FRAME_HEADER_SIZE)
-            return -1;
-        if (ffm->header[1] & FLAG_DTS)
-            if (ffm_read_data(s, ffm->header+16, 4, 1) != 4)
-                return -1;
-#if 0
-        av_hexdump_log(s, AV_LOG_DEBUG, ffm->header, FRAME_HEADER_SIZE);
-#endif
-        ffm->read_state = READ_DATA;
-        /* fall thru */
-    case READ_DATA:
-        size = AV_RB24(ffm->header + 2);
-        if ((ret = ffm_is_avail_data(s, size)) < 0)
-            return ret;
-
-        duration = AV_RB24(ffm->header + 5);
-
-        av_new_packet(pkt, size);
-        pkt->stream_index = ffm->header[0];
-        if ((unsigned)pkt->stream_index >= s->nb_streams) {
-            av_log(s, AV_LOG_ERROR, "invalid stream index %d\n", pkt->stream_index);
-            av_free_packet(pkt);
-            ffm->read_state = READ_HEADER;
-            return -1;
-        }
-        pkt->pos = url_ftell(s->pb);
-        if (ffm->header[1] & FLAG_KEY_FRAME)
-            pkt->flags |= AV_PKT_FLAG_KEY;
-
-        ffm->read_state = READ_HEADER;
-        if (ffm_read_data(s, pkt->data, size, 0) != size) {
-            /* bad case: desynchronized packet. we cancel all the packet loading */
-            av_free_packet(pkt);
-            return -1;
-        }
-        pkt->pts = AV_RB64(ffm->header+8);
-        if (ffm->header[1] & FLAG_DTS)
-            pkt->dts = pkt->pts - AV_RB32(ffm->header+16);
-        else
-            pkt->dts = pkt->pts;
-        pkt->duration = duration;
-        break;
-    }
-    return 0;
-}
-
-/* seek to a given time in the file. The file read pointer is
-   positioned at or before pts. XXX: the following code is quite
-   approximative */
-static int ffm_seek(AVFormatContext *s, int stream_index, int64_t wanted_pts, int flags)
-{
-    FFMContext *ffm = s->priv_data;
-    int64_t pos_min, pos_max, pos;
-    int64_t pts_min, pts_max, pts;
-    double pos1;
-
-#ifdef DEBUG_SEEK
-    av_log(s, AV_LOG_DEBUG, "wanted_pts=%0.6f\n", wanted_pts / 1000000.0);
-#endif
-    /* find the position using linear interpolation (better than
-       dichotomy in typical cases) */
-    pos_min = FFM_PACKET_SIZE;
-    pos_max = ffm->file_size - FFM_PACKET_SIZE;
-    while (pos_min <= pos_max) {
-        pts_min = get_dts(s, pos_min);
-        pts_max = get_dts(s, pos_max);
-        /* linear interpolation */
-        pos1 = (double)(pos_max - pos_min) * (double)(wanted_pts - pts_min) /
-            (double)(pts_max - pts_min);
-        pos = (((int64_t)pos1) / FFM_PACKET_SIZE) * FFM_PACKET_SIZE;
-        if (pos <= pos_min)
-            pos = pos_min;
-        else if (pos >= pos_max)
-            pos = pos_max;
-        pts = get_dts(s, pos);
-        /* check if we are lucky */
-        if (pts == wanted_pts) {
-            goto found;
-        } else if (pts > wanted_pts) {
-            pos_max = pos - FFM_PACKET_SIZE;
-        } else {
-            pos_min = pos + FFM_PACKET_SIZE;
-        }
-    }
-    pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
-
- found:
-    ffm_seek1(s, pos);
-
-    /* reset read state */
-    ffm->read_state = READ_HEADER;
-    ffm->packet_ptr = ffm->packet;
-    ffm->packet_end = ffm->packet;
-    ffm->first_packet = 1;
-
-    return 0;
-}
-
-static int ffm_probe(AVProbeData *p)
-{
-    if (
-        p->buf[0] == 'F' && p->buf[1] == 'F' && p->buf[2] == 'M' &&
-        p->buf[3] == '1')
-        return AVPROBE_SCORE_MAX + 1;
-    return 0;
-}
-
-static int ffm_close(AVFormatContext *s)
-{
-    int i;
-
-    for (i = 0; i < s->nb_streams; i++)
-        av_freep(&s->streams[i]->codec->rc_eq);
-
-    return 0;
-}
-
-AVInputFormat ffm_demuxer = {
-    "ffm",
-    NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"),
-    sizeof(FFMContext),
-    ffm_probe,
-    ffm_read_header,
-    ffm_read_packet,
-    ffm_close,
-    ffm_seek,
-};
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
deleted file mode 100644
index c5c59db..0000000
--- a/libavformat/ffmenc.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * FFM (ffserver live feed) muxer
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "ffm.h"
-
-static void flush_packet(AVFormatContext *s)
-{
-    FFMContext *ffm = s->priv_data;
-    int fill_size, h;
-    ByteIOContext *pb = s->pb;
-
-    fill_size = ffm->packet_end - ffm->packet_ptr;
-    memset(ffm->packet_ptr, 0, fill_size);
-
-    if (url_ftell(pb) % ffm->packet_size)
-        av_abort();
-
-    /* put header */
-    put_be16(pb, PACKET_ID);
-    put_be16(pb, fill_size);
-    put_be64(pb, ffm->dts);
-    h = ffm->frame_offset;
-    if (ffm->first_packet)
-        h |= 0x8000;
-    put_be16(pb, h);
-    put_buffer(pb, ffm->packet, ffm->packet_end - ffm->packet);
-    put_flush_packet(pb);
-
-    /* prepare next packet */
-    ffm->frame_offset = 0; /* no key frame */
-    ffm->packet_ptr = ffm->packet;
-    ffm->first_packet = 0;
-}
-
-/* 'first' is true if first data of a frame */
-static void ffm_write_data(AVFormatContext *s,
-                           const uint8_t *buf, int size,
-                           int64_t dts, int header)
-{
-    FFMContext *ffm = s->priv_data;
-    int len;
-
-    if (header && ffm->frame_offset == 0) {
-        ffm->frame_offset = ffm->packet_ptr - ffm->packet + FFM_HEADER_SIZE;
-        ffm->dts = dts;
-    }
-
-    /* write as many packets as needed */
-    while (size > 0) {
-        len = ffm->packet_end - ffm->packet_ptr;
-        if (len > size)
-            len = size;
-        memcpy(ffm->packet_ptr, buf, len);
-
-        ffm->packet_ptr += len;
-        buf += len;
-        size -= len;
-        if (ffm->packet_ptr >= ffm->packet_end)
-            flush_packet(s);
-    }
-}
-
-static int ffm_write_header(AVFormatContext *s)
-{
-    FFMContext *ffm = s->priv_data;
-    AVStream *st;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *codec;
-    int bit_rate, i;
-
-    ffm->packet_size = FFM_PACKET_SIZE;
-
-    /* header */
-    put_le32(pb, MKTAG('F', 'F', 'M', '1'));
-    put_be32(pb, ffm->packet_size);
-    put_be64(pb, 0); /* current write position */
-
-    put_be32(pb, s->nb_streams);
-    bit_rate = 0;
-    for(i=0;i<s->nb_streams;i++) {
-        st = s->streams[i];
-        bit_rate += st->codec->bit_rate;
-    }
-    put_be32(pb, bit_rate);
-
-    /* list of streams */
-    for(i=0;i<s->nb_streams;i++) {
-        st = s->streams[i];
-        av_set_pts_info(st, 64, 1, 1000000);
-
-        codec = st->codec;
-        /* generic info */
-        put_be32(pb, codec->codec_id);
-        put_byte(pb, codec->codec_type);
-        put_be32(pb, codec->bit_rate);
-        put_be32(pb, st->quality);
-        put_be32(pb, codec->flags);
-        put_be32(pb, codec->flags2);
-        put_be32(pb, codec->debug);
-        /* specific info */
-        switch(codec->codec_type) {
-        case AVMEDIA_TYPE_VIDEO:
-            put_be32(pb, codec->time_base.num);
-            put_be32(pb, codec->time_base.den);
-            put_be16(pb, codec->width);
-            put_be16(pb, codec->height);
-            put_be16(pb, codec->gop_size);
-            put_be32(pb, codec->pix_fmt);
-            put_byte(pb, codec->qmin);
-            put_byte(pb, codec->qmax);
-            put_byte(pb, codec->max_qdiff);
-            put_be16(pb, (int) (codec->qcompress * 10000.0));
-            put_be16(pb, (int) (codec->qblur * 10000.0));
-            put_be32(pb, codec->bit_rate_tolerance);
-            put_strz(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp");
-            put_be32(pb, codec->rc_max_rate);
-            put_be32(pb, codec->rc_min_rate);
-            put_be32(pb, codec->rc_buffer_size);
-            put_be64(pb, av_dbl2int(codec->i_quant_factor));
-            put_be64(pb, av_dbl2int(codec->b_quant_factor));
-            put_be64(pb, av_dbl2int(codec->i_quant_offset));
-            put_be64(pb, av_dbl2int(codec->b_quant_offset));
-            put_be32(pb, codec->dct_algo);
-            put_be32(pb, codec->strict_std_compliance);
-            put_be32(pb, codec->max_b_frames);
-            put_be32(pb, codec->luma_elim_threshold);
-            put_be32(pb, codec->chroma_elim_threshold);
-            put_be32(pb, codec->mpeg_quant);
-            put_be32(pb, codec->intra_dc_precision);
-            put_be32(pb, codec->me_method);
-            put_be32(pb, codec->mb_decision);
-            put_be32(pb, codec->nsse_weight);
-            put_be32(pb, codec->frame_skip_cmp);
-            put_be64(pb, av_dbl2int(codec->rc_buffer_aggressivity));
-            put_be32(pb, codec->codec_tag);
-            put_byte(pb, codec->thread_count);
-            put_be32(pb, codec->coder_type);
-            put_be32(pb, codec->me_cmp);
-            put_be32(pb, codec->partitions);
-            put_be32(pb, codec->me_subpel_quality);
-            put_be32(pb, codec->me_range);
-            put_be32(pb, codec->keyint_min);
-            put_be32(pb, codec->scenechange_threshold);
-            put_be32(pb, codec->b_frame_strategy);
-            put_be64(pb, av_dbl2int(codec->qcompress));
-            put_be64(pb, av_dbl2int(codec->qblur));
-            put_be32(pb, codec->max_qdiff);
-            put_be32(pb, codec->refs);
-            put_be32(pb, codec->directpred);
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            put_be32(pb, codec->sample_rate);
-            put_le16(pb, codec->channels);
-            put_le16(pb, codec->frame_size);
-            put_le16(pb, codec->sample_fmt);
-            break;
-        default:
-            return -1;
-        }
-        if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
-            put_be32(pb, codec->extradata_size);
-            put_buffer(pb, codec->extradata, codec->extradata_size);
-        }
-    }
-
-    /* flush until end of block reached */
-    while ((url_ftell(pb) % ffm->packet_size) != 0)
-        put_byte(pb, 0);
-
-    put_flush_packet(pb);
-
-    /* init packet mux */
-    ffm->packet_ptr = ffm->packet;
-    ffm->packet_end = ffm->packet + ffm->packet_size - FFM_HEADER_SIZE;
-    assert(ffm->packet_end >= ffm->packet);
-    ffm->frame_offset = 0;
-    ffm->dts = 0;
-    ffm->first_packet = 1;
-
-    return 0;
-}
-
-static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int64_t dts;
-    uint8_t header[FRAME_HEADER_SIZE+4];
-    int header_size = FRAME_HEADER_SIZE;
-
-    dts = s->timestamp + pkt->dts;
-    /* packet size & key_frame */
-    header[0] = pkt->stream_index;
-    header[1] = 0;
-    if (pkt->flags & AV_PKT_FLAG_KEY)
-        header[1] |= FLAG_KEY_FRAME;
-    AV_WB24(header+2, pkt->size);
-    AV_WB24(header+5, pkt->duration);
-    AV_WB64(header+8, s->timestamp + pkt->pts);
-    if (pkt->pts != pkt->dts) {
-        header[1] |= FLAG_DTS;
-        AV_WB32(header+16, pkt->pts - pkt->dts);
-        header_size += 4;
-    }
-    ffm_write_data(s, header, header_size, dts, 1);
-    ffm_write_data(s, pkt->data, pkt->size, dts, 0);
-
-    return 0;
-}
-
-static int ffm_write_trailer(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    FFMContext *ffm = s->priv_data;
-
-    /* flush packets */
-    if (ffm->packet_ptr > ffm->packet)
-        flush_packet(s);
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-AVOutputFormat ffm_muxer = {
-    "ffm",
-    NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"),
-    "",
-    "ffm",
-    sizeof(FFMContext),
-    /* not really used */
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG1VIDEO,
-    ffm_write_header,
-    ffm_write_packet,
-    ffm_write_trailer,
-};
diff --git a/libavformat/file.c b/libavformat/file.c
deleted file mode 100644
index 8873d5f..0000000
--- a/libavformat/file.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Buffered file io for ffmpeg system
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include <fcntl.h>
-#if HAVE_SETMODE
-#include <io.h>
-#endif
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include "os_support.h"
-
-
-/* standard file protocol */
-
-static int file_open(URLContext *h, const char *filename, int flags)
-{
-    int access;
-    int fd;
-
-    av_strstart(filename, "file:", &filename);
-
-    if (flags & URL_RDWR) {
-        access = O_CREAT | O_TRUNC | O_RDWR;
-    } else if (flags & URL_WRONLY) {
-        access = O_CREAT | O_TRUNC | O_WRONLY;
-    } else {
-        access = O_RDONLY;
-    }
-#ifdef O_BINARY
-    access |= O_BINARY;
-#endif
-    fd = open(filename, access, 0666);
-    if (fd == -1)
-        return AVERROR(errno);
-    h->priv_data = (void *) (intptr_t) fd;
-    return 0;
-}
-
-static int file_read(URLContext *h, unsigned char *buf, int size)
-{
-    int fd = (intptr_t) h->priv_data;
-    return read(fd, buf, size);
-}
-
-static int file_write(URLContext *h, unsigned char *buf, int size)
-{
-    int fd = (intptr_t) h->priv_data;
-    return write(fd, buf, size);
-}
-
-/* XXX: use llseek */
-static int64_t file_seek(URLContext *h, int64_t pos, int whence)
-{
-    int fd = (intptr_t) h->priv_data;
-    if (whence == AVSEEK_SIZE) {
-        struct stat st;
-        int ret = fstat(fd, &st);
-        return ret < 0 ? AVERROR(errno) : st.st_size;
-    }
-    return lseek(fd, pos, whence);
-}
-
-static int file_close(URLContext *h)
-{
-    int fd = (intptr_t) h->priv_data;
-    return close(fd);
-}
-
-static int file_get_handle(URLContext *h)
-{
-    return (intptr_t) h->priv_data;
-}
-
-URLProtocol file_protocol = {
-    "file",
-    file_open,
-    file_read,
-    file_write,
-    file_seek,
-    file_close,
-    .url_get_file_handle = file_get_handle,
-};
-
-/* pipe protocol */
-
-static int pipe_open(URLContext *h, const char *filename, int flags)
-{
-    int fd;
-    char *final;
-    av_strstart(filename, "pipe:", &filename);
-
-    fd = strtol(filename, &final, 10);
-    if((filename == final) || *final ) {/* No digits found, or something like 10ab */
-        if (flags & URL_WRONLY) {
-            fd = 1;
-        } else {
-            fd = 0;
-        }
-    }
-#if HAVE_SETMODE
-    setmode(fd, O_BINARY);
-#endif
-    h->priv_data = (void *) (intptr_t) fd;
-    h->is_streamed = 1;
-    return 0;
-}
-
-URLProtocol pipe_protocol = {
-    "pipe",
-    pipe_open,
-    file_read,
-    file_write,
-    .url_get_file_handle = file_get_handle,
-};
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
deleted file mode 100644
index 0442fc3..0000000
--- a/libavformat/filmstripdec.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Adobe Filmstrip demuxer
- * Copyright (c) 2010 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Adobe Filmstrip demuxer
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define RAND_TAG MKBETAG('R','a','n','d')
-
-typedef struct {
-    int leading;
-} FilmstripDemuxContext;
-
-static int read_header(AVFormatContext *s,
-                       AVFormatParameters *ap)
-{
-    FilmstripDemuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-
-    if (url_is_streamed(s->pb))
-        return AVERROR(EIO);
-
-    url_fseek(pb, url_fsize(pb) - 36, SEEK_SET);
-    if (get_be32(pb) != RAND_TAG) {
-        av_log(s, AV_LOG_ERROR, "magic number not found");
-        return AVERROR_INVALIDDATA;
-    }
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->nb_frames = get_be32(pb);
-    if (get_be16(pb) != 0) {
-        av_log_ask_for_sample(s, "unsupported packing method\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    url_fskip(pb, 2);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_RAWVIDEO;
-    st->codec->pix_fmt    = PIX_FMT_RGBA;
-    st->codec->codec_tag  = 0; /* no fourcc */
-    st->codec->width      = get_be16(pb);
-    st->codec->height     = get_be16(pb);
-    film->leading         = get_be16(pb);
-    av_set_pts_info(st, 64, 1, get_be16(pb));
-
-    url_fseek(pb, 0, SEEK_SET);
-
-    return 0;
-}
-
-static int read_packet(AVFormatContext *s,
-                       AVPacket *pkt)
-{
-    FilmstripDemuxContext *film = s->priv_data;
-    AVStream *st = s->streams[0];
-
-    if (url_feof(s->pb))
-        return AVERROR(EIO);
-    pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
-    pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
-    url_fskip(s->pb, st->codec->width * film->leading * 4);
-    if (pkt->size < 0)
-        return pkt->size;
-    pkt->flags |= AV_PKT_FLAG_KEY;
-    return 0;
-}
-
-static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st = s->streams[stream_index];
-    url_fseek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET);
-    return 0;
-}
-
-AVInputFormat filmstrip_demuxer = {
-    "filmstrip",
-    NULL_IF_CONFIG_SMALL("Adobe Filmstrip"),
-    sizeof(FilmstripDemuxContext),
-    NULL,
-    read_header,
-    read_packet,
-    NULL,
-    read_seek,
-    .extensions = "flm",
-};
diff --git a/libavformat/filmstripenc.c b/libavformat/filmstripenc.c
deleted file mode 100644
index 4e10c28..0000000
--- a/libavformat/filmstripenc.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Adobe Filmstrip muxer
- * Copyright (c) 2010 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Adobe Filmstrip muxer
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define RAND_TAG MKBETAG('R','a','n','d')
-
-typedef struct {
-    int nb_frames;
-} FilmstripMuxContext;
-
-static int write_header(AVFormatContext *s)
-{
-    if (s->streams[0]->codec->pix_fmt != PIX_FMT_RGBA) {
-        av_log(s, AV_LOG_ERROR, "only PIX_FMT_RGBA is supported\n");
-        return AVERROR_INVALIDDATA;
-    }
-    return 0;
-}
-
-static int write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    FilmstripMuxContext *film = s->priv_data;
-    put_buffer(s->pb, pkt->data, pkt->size);
-    film->nb_frames++;
-    return 0;
-}
-
-static int write_trailer(AVFormatContext *s)
-{
-    FilmstripMuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st = s->streams[0];
-    int i;
-
-    put_be32(pb, RAND_TAG);
-    put_be32(pb, film->nb_frames);
-    put_be16(pb, 0);  // packing method
-    put_be16(pb, 0);  // reserved
-    put_be16(pb, st->codec->width);
-    put_be16(pb, st->codec->height);
-    put_be16(pb, 0);  // leading
-    put_be16(pb, 1/av_q2d(st->codec->time_base));
-    for (i = 0; i < 16; i++)
-        put_byte(pb, 0x00);  // reserved
-    put_flush_packet(pb);
-    return 0;
-}
-
-AVOutputFormat filmstrip_muxer = {
-    "filmstrip",
-    NULL_IF_CONFIG_SMALL("Adobe Filmstrip"),
-    NULL,
-    "flm",
-    sizeof(FilmstripMuxContext),
-    CODEC_ID_NONE,
-    CODEC_ID_RAWVIDEO,
-    write_header,
-    write_packet,
-    write_trailer,
-};
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
deleted file mode 100644
index 2ceef96..0000000
--- a/libavformat/flacdec.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Raw FLAC demuxer
- * Copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/flac.h"
-#include "avformat.h"
-#include "raw.h"
-#include "id3v2.h"
-#include "oggdec.h"
-#include "vorbiscomment.h"
-
-static int flac_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
-{
-    uint8_t buf[ID3v2_HEADER_SIZE];
-    int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
-    uint8_t header[4];
-    uint8_t *buffer=NULL;
-    AVStream *st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_FLAC;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-    /* the parameters will be extracted from the compressed bitstream */
-
-    /* skip ID3v2 header if found */
-    ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
-    if (ret == ID3v2_HEADER_SIZE && ff_id3v2_match(buf)) {
-        int len = ff_id3v2_tag_len(buf);
-        url_fseek(s->pb, len - ID3v2_HEADER_SIZE, SEEK_CUR);
-    } else {
-        url_fseek(s->pb, 0, SEEK_SET);
-    }
-
-    /* if fLaC marker is not found, assume there is no header */
-    if (get_le32(s->pb) != MKTAG('f','L','a','C')) {
-        url_fseek(s->pb, -4, SEEK_CUR);
-        return 0;
-    }
-
-    /* process metadata blocks */
-    while (!url_feof(s->pb) && !metadata_last) {
-        get_buffer(s->pb, header, 4);
-        ff_flac_parse_block_header(header, &metadata_last, &metadata_type,
-                                   &metadata_size);
-        switch (metadata_type) {
-        /* allocate and read metadata block for supported types */
-        case FLAC_METADATA_TYPE_STREAMINFO:
-        case FLAC_METADATA_TYPE_VORBIS_COMMENT:
-            buffer = av_mallocz(metadata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (!buffer) {
-                return AVERROR(ENOMEM);
-            }
-            if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) {
-                av_freep(&buffer);
-                return AVERROR(EIO);
-            }
-            break;
-        /* skip metadata block for unsupported types */
-        default:
-            ret = url_fseek(s->pb, metadata_size, SEEK_CUR);
-            if (ret < 0)
-                return ret;
-        }
-
-        if (metadata_type == FLAC_METADATA_TYPE_STREAMINFO) {
-            FLACStreaminfo si;
-            /* STREAMINFO can only occur once */
-            if (found_streaminfo) {
-                av_freep(&buffer);
-                return AVERROR_INVALIDDATA;
-            }
-            if (metadata_size != FLAC_STREAMINFO_SIZE) {
-                av_freep(&buffer);
-                return AVERROR_INVALIDDATA;
-            }
-            found_streaminfo = 1;
-            st->codec->extradata      = buffer;
-            st->codec->extradata_size = metadata_size;
-            buffer = NULL;
-
-            /* get codec params from STREAMINFO header */
-            ff_flac_parse_streaminfo(st->codec, &si, st->codec->extradata);
-
-            /* set time base and duration */
-            if (si.samplerate > 0) {
-                av_set_pts_info(st, 64, 1, si.samplerate);
-                if (si.samples > 0)
-                    st->duration = si.samples;
-            }
-        } else {
-            /* STREAMINFO must be the first block */
-            if (!found_streaminfo) {
-                av_freep(&buffer);
-                return AVERROR_INVALIDDATA;
-            }
-            /* process supported blocks other than STREAMINFO */
-            if (metadata_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
-                if (ff_vorbis_comment(s, &s->metadata, buffer, metadata_size)) {
-                    av_log(s, AV_LOG_WARNING, "error parsing VorbisComment metadata\n");
-                }
-            }
-            av_freep(&buffer);
-        }
-    }
-
-    return 0;
-}
-
-static int flac_probe(AVProbeData *p)
-{
-    uint8_t *bufptr = p->buf;
-    uint8_t *end    = p->buf + p->buf_size;
-
-    if(ff_id3v2_match(bufptr))
-        bufptr += ff_id3v2_tag_len(bufptr);
-
-    if(bufptr > end-4 || memcmp(bufptr, "fLaC", 4)) return 0;
-    else                                            return AVPROBE_SCORE_MAX/2;
-}
-
-AVInputFormat flac_demuxer = {
-    "flac",
-    NULL_IF_CONFIG_SMALL("raw FLAC"),
-    0,
-    flac_probe,
-    flac_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "flac",
-    .value = CODEC_ID_FLAC,
-    .metadata_conv = ff_vorbiscomment_metadata_conv,
-};
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
deleted file mode 100644
index 91a080f..0000000
--- a/libavformat/flacenc.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * raw FLAC muxer
- * Copyright (c) 2006-2009 Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/flac.h"
-#include "avformat.h"
-#include "flacenc.h"
-#include "metadata.h"
-#include "vorbiscomment.h"
-#include "libavcodec/bytestream.h"
-
-
-static int flac_write_block_padding(ByteIOContext *pb, unsigned int n_padding_bytes,
-                                    int last_block)
-{
-    put_byte(pb, last_block ? 0x81 : 0x01);
-    put_be24(pb, n_padding_bytes);
-    while (n_padding_bytes > 0) {
-        put_byte(pb, 0);
-        n_padding_bytes--;
-    }
-    return 0;
-}
-
-static int flac_write_block_comment(ByteIOContext *pb, AVMetadata *m,
-                                    int last_block, int bitexact)
-{
-    const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
-    unsigned int len, count;
-    uint8_t *p, *p0;
-
-    len = ff_vorbiscomment_length(m, vendor, &count);
-    p0 = av_malloc(len+4);
-    if (!p0)
-        return AVERROR(ENOMEM);
-    p = p0;
-
-    bytestream_put_byte(&p, last_block ? 0x84 : 0x04);
-    bytestream_put_be24(&p, len);
-    ff_vorbiscomment_write(&p, m, vendor, count);
-
-    put_buffer(pb, p0, len+4);
-    av_freep(&p0);
-    p = NULL;
-
-    return 0;
-}
-
-static int flac_write_header(struct AVFormatContext *s)
-{
-    int ret;
-    AVCodecContext *codec = s->streams[0]->codec;
-
-    ret = ff_flac_write_header(s->pb, codec, 0);
-    if (ret)
-        return ret;
-
-    ret = flac_write_block_comment(s->pb, s->metadata, 0,
-                                   codec->flags & CODEC_FLAG_BITEXACT);
-    if (ret)
-        return ret;
-
-    /* The command line flac encoder defaults to placing a seekpoint
-     * every 10s.  So one might add padding to allow that later
-     * but there seems to be no simple way to get the duration here.
-     * So let's try the flac default of 8192 bytes */
-    flac_write_block_padding(s->pb, 8192, 1);
-
-    return ret;
-}
-
-static int flac_write_trailer(struct AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    uint8_t *streaminfo;
-    enum FLACExtradataFormat format;
-    int64_t file_size;
-
-    if (!ff_flac_is_extradata_valid(s->streams[0]->codec, &format, &streaminfo))
-        return -1;
-
-    if (!url_is_streamed(pb)) {
-        /* rewrite the STREAMINFO header block data */
-        file_size = url_ftell(pb);
-        url_fseek(pb, 8, SEEK_SET);
-        put_buffer(pb, streaminfo, FLAC_STREAMINFO_SIZE);
-        url_fseek(pb, file_size, SEEK_SET);
-        put_flush_packet(pb);
-    } else {
-        av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n");
-    }
-    return 0;
-}
-
-static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-AVOutputFormat flac_muxer = {
-    "flac",
-    NULL_IF_CONFIG_SMALL("raw FLAC"),
-    "audio/x-flac",
-    "flac",
-    0,
-    CODEC_ID_FLAC,
-    CODEC_ID_NONE,
-    flac_write_header,
-    flac_write_packet,
-    flac_write_trailer,
-    .flags= AVFMT_NOTIMESTAMPS,
-    .metadata_conv = ff_vorbiscomment_metadata_conv,
-};
diff --git a/libavformat/flacenc.h b/libavformat/flacenc.h
deleted file mode 100644
index 8ad1c26..0000000
--- a/libavformat/flacenc.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * raw FLAC muxer
- * Copyright (C) 2009 Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_FLACENC_H
-#define AVFORMAT_FLACENC_H
-
-#include "libavcodec/flac.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-
-int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
-                         int last_block);
-
-#endif /* AVFORMAT_FLACENC_H */
diff --git a/libavformat/flacenc_header.c b/libavformat/flacenc_header.c
deleted file mode 100644
index 92a129a..0000000
--- a/libavformat/flacenc_header.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * raw FLAC muxer
- * Copyright (C) 2009 Justin Ruggles
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/flac.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "flacenc.h"
-
-int ff_flac_write_header(ByteIOContext *pb, AVCodecContext *codec,
-                         int last_block)
-{
-    uint8_t header[8] = {
-        0x66, 0x4C, 0x61, 0x43, 0x00, 0x00, 0x00, 0x22
-    };
-    uint8_t *streaminfo;
-    enum FLACExtradataFormat format;
-
-    header[4] = last_block ? 0x80 : 0x00;
-    if (!ff_flac_is_extradata_valid(codec, &format, &streaminfo))
-        return -1;
-
-    /* write "fLaC" stream marker and first metadata block header if needed */
-    if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) {
-        put_buffer(pb, header, 8);
-    }
-
-    /* write STREAMINFO or full header */
-    put_buffer(pb, codec->extradata, codec->extradata_size);
-
-    return 0;
-}
diff --git a/libavformat/flic.c b/libavformat/flic.c
deleted file mode 100644
index 27145db..0000000
--- a/libavformat/flic.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * FLI/FLC Animation File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * FLI/FLC file demuxer
- * by Mike Melanson (melanson at pcisys.net)
- * for more information on the .fli/.flc file format and all of its many
- * variations, visit:
- *   http://www.compuphase.com/flic.htm
- *
- * This demuxer handles standard 0xAF11- and 0xAF12-type FLIs. It also handles
- * special FLIs from the PC games "Magic Carpet" and "X-COM: Terror from the Deep".
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define FLIC_FILE_MAGIC_1 0xAF11
-#define FLIC_FILE_MAGIC_2 0xAF12
-#define FLIC_FILE_MAGIC_3 0xAF44  /* Flic Type for Extended FLX Format which
-                                     originated in Dave's Targa Animator (DTA) */
-#define FLIC_CHUNK_MAGIC_1 0xF1FA
-#define FLIC_CHUNK_MAGIC_2 0xF5FA
-#define FLIC_MC_SPEED 5  /* speed for Magic Carpet game FLIs */
-#define FLIC_DEFAULT_SPEED 5  /* for FLIs that have 0 speed */
-#define FLIC_TFTD_CHUNK_AUDIO 0xAAAA /* Audio chunk. Used in Terror from the Deep.
-                                        Has 10 B extra header not accounted for in the chunk header */
-#define FLIC_TFTD_SAMPLE_RATE 22050
-
-#define FLIC_HEADER_SIZE 128
-#define FLIC_PREAMBLE_SIZE 6
-
-typedef struct FlicDemuxContext {
-    int video_stream_index;
-    int audio_stream_index;
-    int frame_number;
-} FlicDemuxContext;
-
-static int flic_probe(AVProbeData *p)
-{
-    int magic_number;
-
-    if(p->buf_size < FLIC_HEADER_SIZE)
-        return 0;
-
-    magic_number = AV_RL16(&p->buf[4]);
-    if ((magic_number != FLIC_FILE_MAGIC_1) &&
-        (magic_number != FLIC_FILE_MAGIC_2) &&
-        (magic_number != FLIC_FILE_MAGIC_3))
-        return 0;
-
-    if(AV_RL16(&p->buf[0x10]) != FLIC_CHUNK_MAGIC_1){
-        if(AV_RL32(&p->buf[0x10]) > 2000)
-            return 0;
-    }
-
-    if(   AV_RL16(&p->buf[0x08]) > 4096
-       || AV_RL16(&p->buf[0x0A]) > 4096)
-        return 0;
-
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int flic_read_header(AVFormatContext *s,
-                            AVFormatParameters *ap)
-{
-    FlicDemuxContext *flic = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned char header[FLIC_HEADER_SIZE];
-    AVStream *st, *ast;
-    int speed;
-    int magic_number;
-    unsigned char preamble[FLIC_PREAMBLE_SIZE];
-
-    flic->frame_number = 0;
-
-    /* load the whole header and pull out the width and height */
-    if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
-        return AVERROR(EIO);
-
-    magic_number = AV_RL16(&header[4]);
-    speed = AV_RL32(&header[0x10]);
-    if (speed == 0)
-        speed = FLIC_DEFAULT_SPEED;
-
-    /* initialize the decoder streams */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    flic->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_FLIC;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = AV_RL16(&header[0x08]);
-    st->codec->height = AV_RL16(&header[0x0A]);
-
-    if (!st->codec->width || !st->codec->height) {
-        /* Ugly hack needed for the following sample: */
-        /* http://samples.mplayerhq.hu/fli-flc/fli-bugs/specular.flc */
-        av_log(s, AV_LOG_WARNING,
-               "File with no specified width/height. Trying 640x480.\n");
-        st->codec->width  = 640;
-        st->codec->height = 480;
-    }
-
-    /* send over the whole 128-byte FLIC header */
-    st->codec->extradata_size = FLIC_HEADER_SIZE;
-    st->codec->extradata = av_malloc(FLIC_HEADER_SIZE);
-    memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE);
-
-    /* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */
-    if (get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) {
-        av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n");
-        return AVERROR(EIO);
-    }
-
-    url_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR);
-
-    /* Time to figure out the framerate:
-     * If the first preamble's magic number is 0xAAAA then this file is from
-     * X-COM: Terror from the Deep. If on the other hand there is a FLIC chunk
-     * magic number at offset 0x10 assume this file is from Magic Carpet instead.
-     * If neither of the above is true then this is a normal FLIC file.
-     */
-    if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) {
-        /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */
-        ast = av_new_stream(s, 1);
-        if (!ast)
-            return AVERROR(ENOMEM);
-
-        flic->audio_stream_index = ast->index;
-
-        /* all audio frames are the same size, so use the size of the first chunk for block_align */
-        ast->codec->block_align = AV_RL32(&preamble[0]);
-        ast->codec->codec_type = CODEC_TYPE_AUDIO;
-        ast->codec->codec_id = CODEC_ID_PCM_U8;
-        ast->codec->codec_tag = 0;
-        ast->codec->sample_rate = FLIC_TFTD_SAMPLE_RATE;
-        ast->codec->channels = 1;
-        ast->codec->sample_fmt = SAMPLE_FMT_U8;
-        ast->codec->bit_rate = st->codec->sample_rate * 8;
-        ast->codec->bits_per_coded_sample = 8;
-        ast->codec->channel_layout = CH_LAYOUT_MONO;
-        ast->codec->extradata_size = 0;
-
-        /* Since the header information is incorrect we have to figure out the
-         * framerate using block_align and the fact that the audio is 22050 Hz.
-         * We usually have two cases: 2205 -> 10 fps and 1470 -> 15 fps */
-        av_set_pts_info(st, 64, ast->codec->block_align, FLIC_TFTD_SAMPLE_RATE);
-        av_set_pts_info(ast, 64, 1, FLIC_TFTD_SAMPLE_RATE);
-    } else if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) {
-        av_set_pts_info(st, 64, FLIC_MC_SPEED, 70);
-
-        /* rewind the stream since the first chunk is at offset 12 */
-        url_fseek(pb, 12, SEEK_SET);
-
-        /* send over abbreviated FLIC header chunk */
-        av_free(st->codec->extradata);
-        st->codec->extradata_size = 12;
-        st->codec->extradata = av_malloc(12);
-        memcpy(st->codec->extradata, header, 12);
-
-    } else if (magic_number == FLIC_FILE_MAGIC_1) {
-        av_set_pts_info(st, 64, speed, 70);
-    } else if ((magic_number == FLIC_FILE_MAGIC_2) ||
-               (magic_number == FLIC_FILE_MAGIC_3)) {
-        av_set_pts_info(st, 64, speed, 1000);
-    } else {
-        av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    return 0;
-}
-
-static int flic_read_packet(AVFormatContext *s,
-                            AVPacket *pkt)
-{
-    FlicDemuxContext *flic = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int packet_read = 0;
-    unsigned int size;
-    int magic;
-    int ret = 0;
-    unsigned char preamble[FLIC_PREAMBLE_SIZE];
-
-    while (!packet_read) {
-
-        if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
-            FLIC_PREAMBLE_SIZE) {
-            ret = AVERROR(EIO);
-            break;
-        }
-
-        size = AV_RL32(&preamble[0]);
-        magic = AV_RL16(&preamble[4]);
-
-        if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) && size > FLIC_PREAMBLE_SIZE) {
-            if (av_new_packet(pkt, size)) {
-                ret = AVERROR(EIO);
-                break;
-            }
-            pkt->stream_index = flic->video_stream_index;
-            pkt->pts = flic->frame_number++;
-            pkt->pos = url_ftell(pb);
-            memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
-            ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE,
-                size - FLIC_PREAMBLE_SIZE);
-            if (ret != size - FLIC_PREAMBLE_SIZE) {
-                av_free_packet(pkt);
-                ret = AVERROR(EIO);
-            }
-            packet_read = 1;
-        } else if (magic == FLIC_TFTD_CHUNK_AUDIO) {
-            if (av_new_packet(pkt, size)) {
-                ret = AVERROR(EIO);
-                break;
-            }
-
-            /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */
-            url_fseek(pb, 10, SEEK_CUR);
-
-            pkt->stream_index = flic->audio_stream_index;
-            pkt->pos = url_ftell(pb);
-            ret = get_buffer(pb, pkt->data, size);
-
-            if (ret != size) {
-                av_free_packet(pkt);
-                ret = AVERROR(EIO);
-            }
-
-            packet_read = 1;
-        } else {
-            /* not interested in this chunk */
-            url_fseek(pb, size - 6, SEEK_CUR);
-        }
-    }
-
-    return ret;
-}
-
-AVInputFormat flic_demuxer = {
-    "flic",
-    NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"),
-    sizeof(FlicDemuxContext),
-    flic_probe,
-    flic_read_header,
-    flic_read_packet,
-};
diff --git a/libavformat/flv.h b/libavformat/flv.h
deleted file mode 100644
index 55266a1..0000000
--- a/libavformat/flv.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * @file
- * FLV common header
- *
- * Copyright (c) 2006 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_FLV_H
-#define AVFORMAT_FLV_H
-
-/* offsets for packed values */
-#define FLV_AUDIO_SAMPLESSIZE_OFFSET 1
-#define FLV_AUDIO_SAMPLERATE_OFFSET  2
-#define FLV_AUDIO_CODECID_OFFSET     4
-
-#define FLV_VIDEO_FRAMETYPE_OFFSET   4
-
-/* bitmasks to isolate specific values */
-#define FLV_AUDIO_CHANNEL_MASK    0x01
-#define FLV_AUDIO_SAMPLESIZE_MASK 0x02
-#define FLV_AUDIO_SAMPLERATE_MASK 0x0c
-#define FLV_AUDIO_CODECID_MASK    0xf0
-
-#define FLV_VIDEO_CODECID_MASK    0x0f
-#define FLV_VIDEO_FRAMETYPE_MASK  0xf0
-
-#define AMF_END_OF_OBJECT         0x09
-
-enum {
-    FLV_HEADER_FLAG_HASVIDEO = 1,
-    FLV_HEADER_FLAG_HASAUDIO = 4,
-};
-
-enum {
-    FLV_TAG_TYPE_AUDIO = 0x08,
-    FLV_TAG_TYPE_VIDEO = 0x09,
-    FLV_TAG_TYPE_META  = 0x12,
-};
-
-enum {
-    FLV_MONO   = 0,
-    FLV_STEREO = 1,
-};
-
-enum {
-    FLV_SAMPLESSIZE_8BIT  = 0,
-    FLV_SAMPLESSIZE_16BIT = 1 << FLV_AUDIO_SAMPLESSIZE_OFFSET,
-};
-
-enum {
-    FLV_SAMPLERATE_SPECIAL = 0, /**< signifies 5512Hz and 8000Hz in the case of NELLYMOSER */
-    FLV_SAMPLERATE_11025HZ = 1 << FLV_AUDIO_SAMPLERATE_OFFSET,
-    FLV_SAMPLERATE_22050HZ = 2 << FLV_AUDIO_SAMPLERATE_OFFSET,
-    FLV_SAMPLERATE_44100HZ = 3 << FLV_AUDIO_SAMPLERATE_OFFSET,
-};
-
-enum {
-    FLV_CODECID_PCM                  = 0,
-    FLV_CODECID_ADPCM                = 1 << FLV_AUDIO_CODECID_OFFSET,
-    FLV_CODECID_MP3                  = 2 << FLV_AUDIO_CODECID_OFFSET,
-    FLV_CODECID_PCM_LE               = 3 << FLV_AUDIO_CODECID_OFFSET,
-    FLV_CODECID_NELLYMOSER_8KHZ_MONO = 5 << FLV_AUDIO_CODECID_OFFSET,
-    FLV_CODECID_NELLYMOSER           = 6 << FLV_AUDIO_CODECID_OFFSET,
-    FLV_CODECID_AAC                  = 10<< FLV_AUDIO_CODECID_OFFSET,
-    FLV_CODECID_SPEEX                = 11<< FLV_AUDIO_CODECID_OFFSET,
-};
-
-enum {
-    FLV_CODECID_H263    = 2,
-    FLV_CODECID_SCREEN  = 3,
-    FLV_CODECID_VP6     = 4,
-    FLV_CODECID_VP6A    = 5,
-    FLV_CODECID_SCREEN2 = 6,
-    FLV_CODECID_H264    = 7,
-};
-
-enum {
-    FLV_FRAME_KEY        = 1 << FLV_VIDEO_FRAMETYPE_OFFSET,
-    FLV_FRAME_INTER      = 2 << FLV_VIDEO_FRAMETYPE_OFFSET,
-    FLV_FRAME_DISP_INTER = 3 << FLV_VIDEO_FRAMETYPE_OFFSET,
-};
-
-typedef enum {
-    AMF_DATA_TYPE_NUMBER      = 0x00,
-    AMF_DATA_TYPE_BOOL        = 0x01,
-    AMF_DATA_TYPE_STRING      = 0x02,
-    AMF_DATA_TYPE_OBJECT      = 0x03,
-    AMF_DATA_TYPE_NULL        = 0x05,
-    AMF_DATA_TYPE_UNDEFINED   = 0x06,
-    AMF_DATA_TYPE_REFERENCE   = 0x07,
-    AMF_DATA_TYPE_MIXEDARRAY  = 0x08,
-    AMF_DATA_TYPE_OBJECT_END  = 0x09,
-    AMF_DATA_TYPE_ARRAY       = 0x0a,
-    AMF_DATA_TYPE_DATE        = 0x0b,
-    AMF_DATA_TYPE_LONG_STRING = 0x0c,
-    AMF_DATA_TYPE_UNSUPPORTED = 0x0d,
-} AMFDataType;
-
-#endif /* AVFORMAT_FLV_H */
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
deleted file mode 100644
index fcdf214..0000000
--- a/libavformat/flvdec.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * FLV demuxer
- * Copyright (c) 2003 The FFmpeg Project
- *
- * This demuxer will generate a 1 byte extradata for VP6F content.
- * It is composed of:
- *  - upper 4bits: difference between encoded width and visible width
- *  - lower 4bits: difference between encoded height and visible height
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avstring.h"
-#include "libavcodec/bytestream.h"
-#include "libavcodec/mpeg4audio.h"
-#include "avformat.h"
-#include "flv.h"
-
-typedef struct {
-    int wrong_dts; ///< wrong dts due to negative cts
-} FLVContext;
-
-static int flv_probe(AVProbeData *p)
-{
-    const uint8_t *d;
-
-    d = p->buf;
-    if (d[0] == 'F' && d[1] == 'L' && d[2] == 'V' && d[3] < 5 && d[5]==0 && AV_RB32(d+5)>8) {
-        return AVPROBE_SCORE_MAX;
-    }
-    return 0;
-}
-
-static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, int flv_codecid) {
-    AVCodecContext *acodec = astream->codec;
-    switch(flv_codecid) {
-        //no distinction between S16 and S8 PCM codec flags
-        case FLV_CODECID_PCM:
-            acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 :
-#if HAVE_BIGENDIAN
-                                CODEC_ID_PCM_S16BE;
-#else
-                                CODEC_ID_PCM_S16LE;
-#endif
-            break;
-        case FLV_CODECID_PCM_LE:
-            acodec->codec_id = acodec->bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 : CODEC_ID_PCM_S16LE; break;
-        case FLV_CODECID_AAC  : acodec->codec_id = CODEC_ID_AAC;                                    break;
-        case FLV_CODECID_ADPCM: acodec->codec_id = CODEC_ID_ADPCM_SWF;                              break;
-        case FLV_CODECID_SPEEX:
-            acodec->codec_id = CODEC_ID_SPEEX;
-            acodec->sample_rate = 16000;
-            break;
-        case FLV_CODECID_MP3  : acodec->codec_id = CODEC_ID_MP3      ; astream->need_parsing = AVSTREAM_PARSE_FULL; break;
-        case FLV_CODECID_NELLYMOSER_8KHZ_MONO:
-            acodec->sample_rate = 8000; //in case metadata does not otherwise declare samplerate
-        case FLV_CODECID_NELLYMOSER:
-            acodec->codec_id = CODEC_ID_NELLYMOSER;
-            break;
-        default:
-            av_log(s, AV_LOG_INFO, "Unsupported audio codec (%x)\n", flv_codecid >> FLV_AUDIO_CODECID_OFFSET);
-            acodec->codec_tag = flv_codecid >> FLV_AUDIO_CODECID_OFFSET;
-    }
-}
-
-static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) {
-    AVCodecContext *vcodec = vstream->codec;
-    switch(flv_codecid) {
-        case FLV_CODECID_H263  : vcodec->codec_id = CODEC_ID_FLV1   ; break;
-        case FLV_CODECID_SCREEN: vcodec->codec_id = CODEC_ID_FLASHSV; break;
-        case FLV_CODECID_SCREEN2: vcodec->codec_id = CODEC_ID_FLASHSV2; break;
-        case FLV_CODECID_VP6   : vcodec->codec_id = CODEC_ID_VP6F   ;
-        case FLV_CODECID_VP6A  :
-            if(flv_codecid == FLV_CODECID_VP6A)
-                vcodec->codec_id = CODEC_ID_VP6A;
-            if(vcodec->extradata_size != 1) {
-                vcodec->extradata_size = 1;
-                vcodec->extradata = av_malloc(1);
-            }
-            vcodec->extradata[0] = get_byte(s->pb);
-            return 1; // 1 byte body size adjustment for flv_read_packet()
-        case FLV_CODECID_H264:
-            vcodec->codec_id = CODEC_ID_H264;
-            return 3; // not 4, reading packet type will consume one byte
-        default:
-            av_log(s, AV_LOG_INFO, "Unsupported video codec (%x)\n", flv_codecid);
-            vcodec->codec_tag = flv_codecid;
-    }
-
-    return 0;
-}
-
-static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) {
-    int length = get_be16(ioc);
-    if(length >= buffsize) {
-        url_fskip(ioc, length);
-        return -1;
-    }
-
-    get_buffer(ioc, buffer, length);
-
-    buffer[length] = '\0';
-
-    return length;
-}
-
-static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) {
-    AVCodecContext *acodec, *vcodec;
-    ByteIOContext *ioc;
-    AMFDataType amf_type;
-    char str_val[256];
-    double num_val;
-
-    num_val = 0;
-    ioc = s->pb;
-
-    amf_type = get_byte(ioc);
-
-    switch(amf_type) {
-        case AMF_DATA_TYPE_NUMBER:
-            num_val = av_int2dbl(get_be64(ioc)); break;
-        case AMF_DATA_TYPE_BOOL:
-            num_val = get_byte(ioc); break;
-        case AMF_DATA_TYPE_STRING:
-            if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0)
-                return -1;
-            break;
-        case AMF_DATA_TYPE_OBJECT: {
-            unsigned int keylen;
-
-            while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) {
-                url_fskip(ioc, keylen); //skip key string
-                if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
-                    return -1; //if we couldn't skip, bomb out.
-            }
-            if(get_byte(ioc) != AMF_END_OF_OBJECT)
-                return -1;
-        }
-            break;
-        case AMF_DATA_TYPE_NULL:
-        case AMF_DATA_TYPE_UNDEFINED:
-        case AMF_DATA_TYPE_UNSUPPORTED:
-            break; //these take up no additional space
-        case AMF_DATA_TYPE_MIXEDARRAY:
-            url_fskip(ioc, 4); //skip 32-bit max array index
-            while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
-                //this is the only case in which we would want a nested parse to not skip over the object
-                if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
-                    return -1;
-            }
-            if(get_byte(ioc) != AMF_END_OF_OBJECT)
-                return -1;
-            break;
-        case AMF_DATA_TYPE_ARRAY: {
-            unsigned int arraylen, i;
-
-            arraylen = get_be32(ioc);
-            for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
-                if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
-                    return -1; //if we couldn't skip, bomb out.
-            }
-        }
-            break;
-        case AMF_DATA_TYPE_DATE:
-            url_fskip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16)
-            break;
-        default: //unsupported type, we couldn't skip
-            return -1;
-    }
-
-    if(depth == 1 && key) { //only look for metadata values when we are not nested and key != NULL
-        acodec = astream ? astream->codec : NULL;
-        vcodec = vstream ? vstream->codec : NULL;
-
-        if(amf_type == AMF_DATA_TYPE_BOOL) {
-            av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val));
-            av_metadata_set2(&s->metadata, key, str_val, 0);
-        } else if(amf_type == AMF_DATA_TYPE_NUMBER) {
-            snprintf(str_val, sizeof(str_val), "%.f", num_val);
-            av_metadata_set2(&s->metadata, key, str_val, 0);
-            if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE;
-            else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0))
-                vcodec->bit_rate = num_val * 1024.0;
-            else if(!strcmp(key, "audiodatarate") && acodec && 0 <= (int)(num_val * 1024.0))
-                acodec->bit_rate = num_val * 1024.0;
-        } else if (amf_type == AMF_DATA_TYPE_STRING)
-            av_metadata_set2(&s->metadata, key, str_val, 0);
-    }
-
-    return 0;
-}
-
-static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
-    AMFDataType type;
-    AVStream *stream, *astream, *vstream;
-    ByteIOContext *ioc;
-    int i;
-    char buffer[11]; //only needs to hold the string "onMetaData". Anything longer is something we don't want.
-
-    astream = NULL;
-    vstream = NULL;
-    ioc = s->pb;
-
-    //first object needs to be "onMetaData" string
-    type = get_byte(ioc);
-    if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData"))
-        return -1;
-
-    //find the streams now so that amf_parse_object doesn't need to do the lookup every time it is called.
-    for(i = 0; i < s->nb_streams; i++) {
-        stream = s->streams[i];
-        if     (stream->codec->codec_type == AVMEDIA_TYPE_AUDIO) astream = stream;
-        else if(stream->codec->codec_type == AVMEDIA_TYPE_VIDEO) vstream = stream;
-    }
-
-    //parse the second object (we want a mixed array)
-    if(amf_parse_object(s, astream, vstream, buffer, next_pos, 0) < 0)
-        return -1;
-
-    return 0;
-}
-
-static AVStream *create_stream(AVFormatContext *s, int is_audio){
-    AVStream *st = av_new_stream(s, is_audio);
-    if (!st)
-        return NULL;
-    st->codec->codec_type = is_audio ? AVMEDIA_TYPE_AUDIO : AVMEDIA_TYPE_VIDEO;
-    av_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
-    return st;
-}
-
-static int flv_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    int offset, flags;
-
-    url_fskip(s->pb, 4);
-    flags = get_byte(s->pb);
-    /* old flvtool cleared this field */
-    /* FIXME: better fix needed */
-    if (!flags) {
-        flags = FLV_HEADER_FLAG_HASVIDEO | FLV_HEADER_FLAG_HASAUDIO;
-        av_log(s, AV_LOG_WARNING, "Broken FLV file, which says no streams present, this might fail\n");
-    }
-
-    if((flags & (FLV_HEADER_FLAG_HASVIDEO|FLV_HEADER_FLAG_HASAUDIO))
-             != (FLV_HEADER_FLAG_HASVIDEO|FLV_HEADER_FLAG_HASAUDIO))
-        s->ctx_flags |= AVFMTCTX_NOHEADER;
-
-    if(flags & FLV_HEADER_FLAG_HASVIDEO){
-        if(!create_stream(s, 0))
-            return AVERROR(ENOMEM);
-    }
-    if(flags & FLV_HEADER_FLAG_HASAUDIO){
-        if(!create_stream(s, 1))
-            return AVERROR(ENOMEM);
-    }
-
-    offset = get_be32(s->pb);
-    url_fseek(s->pb, offset, SEEK_SET);
-    url_fskip(s->pb, 4);
-
-    s->start_time = 0;
-
-    return 0;
-}
-
-static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
-{
-    av_free(st->codec->extradata);
-    st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata)
-        return AVERROR(ENOMEM);
-    st->codec->extradata_size = size;
-    get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
-    return 0;
-}
-
-static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    FLVContext *flv = s->priv_data;
-    int ret, i, type, size, flags, is_audio;
-    int64_t next, pos;
-    int64_t dts, pts = AV_NOPTS_VALUE;
-    AVStream *st = NULL;
-
- for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */
-    pos = url_ftell(s->pb);
-    type = get_byte(s->pb);
-    size = get_be24(s->pb);
-    dts = get_be24(s->pb);
-    dts |= get_byte(s->pb) << 24;
-//    av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts);
-    if (url_feof(s->pb))
-        return AVERROR_EOF;
-    url_fskip(s->pb, 3); /* stream id, always 0 */
-    flags = 0;
-
-    if(size == 0)
-        continue;
-
-    next= size + url_ftell(s->pb);
-
-    if (type == FLV_TAG_TYPE_AUDIO) {
-        is_audio=1;
-        flags = get_byte(s->pb);
-        size--;
-    } else if (type == FLV_TAG_TYPE_VIDEO) {
-        is_audio=0;
-        flags = get_byte(s->pb);
-        size--;
-        if ((flags & 0xf0) == 0x50) /* video info / command frame */
-            goto skip;
-    } else {
-        if (type == FLV_TAG_TYPE_META && size > 13+1+4)
-            flv_read_metabody(s, next);
-        else /* skip packet */
-            av_log(s, AV_LOG_DEBUG, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
-    skip:
-        url_fseek(s->pb, next, SEEK_SET);
-        continue;
-    }
-
-    /* skip empty data packets */
-    if (!size)
-        continue;
-
-    /* now find stream */
-    for(i=0;i<s->nb_streams;i++) {
-        st = s->streams[i];
-        if (st->id == is_audio)
-            break;
-    }
-    if(i == s->nb_streams){
-        av_log(s, AV_LOG_ERROR, "invalid stream\n");
-        st= create_stream(s, is_audio);
-        s->ctx_flags &= ~AVFMTCTX_NOHEADER;
-    }
-//    av_log(s, AV_LOG_DEBUG, "%d %X %d \n", is_audio, flags, st->discard);
-    if(  (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY ||         is_audio))
-       ||(st->discard >= AVDISCARD_BIDIR  &&  ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
-       || st->discard >= AVDISCARD_ALL
-       ){
-        url_fseek(s->pb, next, SEEK_SET);
-        continue;
-    }
-    if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
-        av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
-    break;
- }
-
-    // if not streamed and no duration from metadata then seek to end to find the duration from the timestamps
-    if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){
-        int size;
-        const int64_t pos= url_ftell(s->pb);
-        const int64_t fsize= url_fsize(s->pb);
-        url_fseek(s->pb, fsize-4, SEEK_SET);
-        size= get_be32(s->pb);
-        url_fseek(s->pb, fsize-3-size, SEEK_SET);
-        if(size == get_be24(s->pb) + 11){
-            uint32_t ts = get_be24(s->pb);
-            ts |= get_byte(s->pb) << 24;
-            s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
-        }
-        url_fseek(s->pb, pos, SEEK_SET);
-    }
-
-    if(is_audio){
-        if(!st->codec->channels || !st->codec->sample_rate || !st->codec->bits_per_coded_sample) {
-            st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
-            st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
-            st->codec->bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
-        }
-        if(!st->codec->codec_id){
-            flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK);
-        }
-    }else{
-        size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
-    }
-
-    if (st->codec->codec_id == CODEC_ID_AAC ||
-        st->codec->codec_id == CODEC_ID_H264) {
-        int type = get_byte(s->pb);
-        size--;
-        if (st->codec->codec_id == CODEC_ID_H264) {
-            int32_t cts = (get_be24(s->pb)+0xff800000)^0xff800000; // sign extension
-            pts = dts + cts;
-            if (cts < 0) { // dts are wrong
-                flv->wrong_dts = 1;
-                av_log(s, AV_LOG_WARNING, "negative cts, previous timestamps might be wrong\n");
-            }
-            if (flv->wrong_dts)
-                dts = AV_NOPTS_VALUE;
-        }
-        if (type == 0) {
-            if ((ret = flv_get_extradata(s, st, size)) < 0)
-                return ret;
-            if (st->codec->codec_id == CODEC_ID_AAC) {
-                MPEG4AudioConfig cfg;
-                ff_mpeg4audio_get_config(&cfg, st->codec->extradata,
-                                         st->codec->extradata_size);
-                st->codec->channels = cfg.channels;
-                st->codec->sample_rate = cfg.sample_rate;
-                dprintf(s, "mp4a config channels %d sample rate %d\n",
-                        st->codec->channels, st->codec->sample_rate);
-            }
-
-            ret = AVERROR(EAGAIN);
-            goto leave;
-        }
-    }
-
-    /* skip empty data packets */
-    if (!size) {
-        ret = AVERROR(EAGAIN);
-        goto leave;
-    }
-
-    ret= av_get_packet(s->pb, pkt, size);
-    if (ret < 0) {
-        return AVERROR(EIO);
-    }
-    /* note: we need to modify the packet size here to handle the last
-       packet */
-    pkt->size = ret;
-    pkt->dts = dts;
-    pkt->pts = pts == AV_NOPTS_VALUE ? dts : pts;
-    pkt->stream_index = st->index;
-
-    if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY))
-        pkt->flags |= AV_PKT_FLAG_KEY;
-
-leave:
-    url_fskip(s->pb, 4);
-    return ret;
-}
-
-static int flv_read_seek(AVFormatContext *s, int stream_index,
-    int64_t ts, int flags)
-{
-    return av_url_read_fseek(s->pb, stream_index, ts, flags);
-}
-
-#if 0 /* don't know enough to implement this */
-static int flv_read_seek2(AVFormatContext *s, int stream_index,
-    int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
-{
-    int ret = AVERROR(ENOSYS);
-
-    if (ts - min_ts > (uint64_t)(max_ts - ts)) flags |= AVSEEK_FLAG_BACKWARD;
-
-    if (url_is_streamed(s->pb)) {
-        if (stream_index < 0) {
-            stream_index = av_find_default_stream_index(s);
-            if (stream_index < 0)
-                return -1;
-
-            /* timestamp for default must be expressed in AV_TIME_BASE units */
-            ts = av_rescale_rnd(ts, 1000, AV_TIME_BASE,
-                flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
-        }
-        ret = av_url_read_fseek(s->pb, stream_index, ts, flags);
-    }
-
-    if (ret == AVERROR(ENOSYS))
-        ret = av_seek_frame(s, stream_index, ts, flags);
-    return ret;
-}
-#endif
-
-AVInputFormat flv_demuxer = {
-    "flv",
-    NULL_IF_CONFIG_SMALL("FLV format"),
-    sizeof(FLVContext),
-    flv_probe,
-    flv_read_header,
-    flv_read_packet,
-    .read_seek = flv_read_seek,
-#if 0
-    .read_seek2 = flv_read_seek2,
-#endif
-    .extensions = "flv",
-    .value = CODEC_ID_FLV1,
-};
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
deleted file mode 100644
index c351117..0000000
--- a/libavformat/flvenc.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * FLV muxer
- * Copyright (c) 2003 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "flv.h"
-#include "riff.h"
-#include "avc.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-static const AVCodecTag flv_video_codec_ids[] = {
-    {CODEC_ID_FLV1,    FLV_CODECID_H263  },
-    {CODEC_ID_FLASHSV, FLV_CODECID_SCREEN},
-    {CODEC_ID_FLASHSV2, FLV_CODECID_SCREEN2},
-    {CODEC_ID_VP6F,    FLV_CODECID_VP6   },
-    {CODEC_ID_VP6,     FLV_CODECID_VP6   },
-    {CODEC_ID_H264,    FLV_CODECID_H264  },
-    {CODEC_ID_NONE,    0}
-};
-
-static const AVCodecTag flv_audio_codec_ids[] = {
-    {CODEC_ID_MP3,       FLV_CODECID_MP3    >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_PCM_U8,    FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_PCM_S16BE, FLV_CODECID_PCM    >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_PCM_S16LE, FLV_CODECID_PCM_LE >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_ADPCM_SWF, FLV_CODECID_ADPCM  >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_AAC,       FLV_CODECID_AAC    >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_NELLYMOSER, FLV_CODECID_NELLYMOSER >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_SPEEX,     FLV_CODECID_SPEEX  >> FLV_AUDIO_CODECID_OFFSET},
-    {CODEC_ID_NONE,      0}
-};
-
-typedef struct FLVContext {
-    int reserved;
-    int64_t duration_offset;
-    int64_t filesize_offset;
-    int64_t duration;
-    int delay; ///< first dts delay for AVC
-} FLVContext;
-
-static int get_audio_flags(AVCodecContext *enc){
-    int flags = (enc->bits_per_coded_sample == 16) ? FLV_SAMPLESSIZE_16BIT : FLV_SAMPLESSIZE_8BIT;
-
-    if (enc->codec_id == CODEC_ID_AAC) // specs force these parameters
-        return FLV_CODECID_AAC | FLV_SAMPLERATE_44100HZ | FLV_SAMPLESSIZE_16BIT | FLV_STEREO;
-    else if (enc->codec_id == CODEC_ID_SPEEX) {
-        if (enc->sample_rate != 16000) {
-            av_log(enc, AV_LOG_ERROR, "flv only supports wideband (16kHz) Speex audio\n");
-            return -1;
-        }
-        if (enc->channels != 1) {
-            av_log(enc, AV_LOG_ERROR, "flv only supports mono Speex audio\n");
-            return -1;
-        }
-        if (enc->frame_size / 320 > 8) {
-            av_log(enc, AV_LOG_WARNING, "Warning: Speex stream has more than "
-                                        "8 frames per packet. Adobe Flash "
-                                        "Player cannot handle this!\n");
-        }
-        return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | FLV_SAMPLESSIZE_16BIT;
-    } else {
-    switch (enc->sample_rate) {
-        case    44100:
-            flags |= FLV_SAMPLERATE_44100HZ;
-            break;
-        case    22050:
-            flags |= FLV_SAMPLERATE_22050HZ;
-            break;
-        case    11025:
-            flags |= FLV_SAMPLERATE_11025HZ;
-            break;
-        case     8000: //nellymoser only
-        case     5512: //not mp3
-            if(enc->codec_id != CODEC_ID_MP3){
-                flags |= FLV_SAMPLERATE_SPECIAL;
-                break;
-            }
-        default:
-            av_log(enc, AV_LOG_ERROR, "flv does not support that sample rate, choose from (44100, 22050, 11025).\n");
-            return -1;
-    }
-    }
-
-    if (enc->channels > 1) {
-        flags |= FLV_STEREO;
-    }
-
-    switch(enc->codec_id){
-    case CODEC_ID_MP3:
-        flags |= FLV_CODECID_MP3    | FLV_SAMPLESSIZE_16BIT;
-        break;
-    case CODEC_ID_PCM_U8:
-        flags |= FLV_CODECID_PCM    | FLV_SAMPLESSIZE_8BIT;
-        break;
-    case CODEC_ID_PCM_S16BE:
-        flags |= FLV_CODECID_PCM    | FLV_SAMPLESSIZE_16BIT;
-        break;
-    case CODEC_ID_PCM_S16LE:
-        flags |= FLV_CODECID_PCM_LE | FLV_SAMPLESSIZE_16BIT;
-        break;
-    case CODEC_ID_ADPCM_SWF:
-        flags |= FLV_CODECID_ADPCM | FLV_SAMPLESSIZE_16BIT;
-        break;
-    case CODEC_ID_NELLYMOSER:
-        if (enc->sample_rate == 8000) {
-            flags |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT;
-        } else {
-            flags |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT;
-        }
-        break;
-    case 0:
-        flags |= enc->codec_tag<<4;
-        break;
-    default:
-        av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n");
-        return -1;
-    }
-
-    return flags;
-}
-
-static void put_amf_string(ByteIOContext *pb, const char *str)
-{
-    size_t len = strlen(str);
-    put_be16(pb, len);
-    put_buffer(pb, str, len);
-}
-
-static void put_amf_double(ByteIOContext *pb, double d)
-{
-    put_byte(pb, AMF_DATA_TYPE_NUMBER);
-    put_be64(pb, av_dbl2int(d));
-}
-
-static void put_amf_bool(ByteIOContext *pb, int b) {
-    put_byte(pb, AMF_DATA_TYPE_BOOL);
-    put_byte(pb, !!b);
-}
-
-static int flv_write_header(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    FLVContext *flv = s->priv_data;
-    AVCodecContext *audio_enc = NULL, *video_enc = NULL;
-    int i;
-    double framerate = 0.0;
-    int metadata_size_pos, data_size;
-
-    for(i=0; i<s->nb_streams; i++){
-        AVCodecContext *enc = s->streams[i]->codec;
-        if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-            if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) {
-                framerate = av_q2d(s->streams[i]->r_frame_rate);
-            } else {
-                framerate = 1/av_q2d(s->streams[i]->codec->time_base);
-            }
-            video_enc = enc;
-            if(enc->codec_tag == 0) {
-                av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n");
-                return -1;
-            }
-        } else {
-            audio_enc = enc;
-            if(get_audio_flags(enc)<0)
-                return -1;
-        }
-        av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
-    }
-    put_tag(pb,"FLV");
-    put_byte(pb,1);
-    put_byte(pb,   FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
-                 + FLV_HEADER_FLAG_HASVIDEO * !!video_enc);
-    put_be32(pb,9);
-    put_be32(pb,0);
-
-    for(i=0; i<s->nb_streams; i++){
-        if(s->streams[i]->codec->codec_tag == 5){
-            put_byte(pb,8); // message type
-            put_be24(pb,0); // include flags
-            put_be24(pb,0); // time stamp
-            put_be32(pb,0); // reserved
-            put_be32(pb,11); // size
-            flv->reserved=5;
-        }
-    }
-
-    /* write meta_tag */
-    put_byte(pb, 18);         // tag type META
-    metadata_size_pos= url_ftell(pb);
-    put_be24(pb, 0);          // size of data part (sum of all parts below)
-    put_be24(pb, 0);          // time stamp
-    put_be32(pb, 0);          // reserved
-
-    /* now data of data_size size */
-
-    /* first event name as a string */
-    put_byte(pb, AMF_DATA_TYPE_STRING);
-    put_amf_string(pb, "onMetaData"); // 12 bytes
-
-    /* mixed array (hash) with size and string/type/data tuples */
-    put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY);
-    put_be32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
-
-    put_amf_string(pb, "duration");
-    flv->duration_offset= url_ftell(pb);
-    put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect
-
-    if(video_enc){
-        put_amf_string(pb, "width");
-        put_amf_double(pb, video_enc->width);
-
-        put_amf_string(pb, "height");
-        put_amf_double(pb, video_enc->height);
-
-        put_amf_string(pb, "videodatarate");
-        put_amf_double(pb, video_enc->bit_rate / 1024.0);
-
-        put_amf_string(pb, "framerate");
-        put_amf_double(pb, framerate);
-
-        put_amf_string(pb, "videocodecid");
-        put_amf_double(pb, video_enc->codec_tag);
-    }
-
-    if(audio_enc){
-        put_amf_string(pb, "audiodatarate");
-        put_amf_double(pb, audio_enc->bit_rate / 1024.0);
-
-        put_amf_string(pb, "audiosamplerate");
-        put_amf_double(pb, audio_enc->sample_rate);
-
-        put_amf_string(pb, "audiosamplesize");
-        put_amf_double(pb, audio_enc->codec_id == CODEC_ID_PCM_U8 ? 8 : 16);
-
-        put_amf_string(pb, "stereo");
-        put_amf_bool(pb, audio_enc->channels == 2);
-
-        put_amf_string(pb, "audiocodecid");
-        put_amf_double(pb, audio_enc->codec_tag);
-    }
-
-    put_amf_string(pb, "filesize");
-    flv->filesize_offset= url_ftell(pb);
-    put_amf_double(pb, 0); // delayed write
-
-    put_amf_string(pb, "");
-    put_byte(pb, AMF_END_OF_OBJECT);
-
-    /* write total size of tag */
-    data_size= url_ftell(pb) - metadata_size_pos - 10;
-    url_fseek(pb, metadata_size_pos, SEEK_SET);
-    put_be24(pb, data_size);
-    url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
-    put_be32(pb, data_size + 11);
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVCodecContext *enc = s->streams[i]->codec;
-        if (enc->codec_id == CODEC_ID_AAC || enc->codec_id == CODEC_ID_H264) {
-            int64_t pos;
-            put_byte(pb, enc->codec_type == AVMEDIA_TYPE_VIDEO ?
-                     FLV_TAG_TYPE_VIDEO : FLV_TAG_TYPE_AUDIO);
-            put_be24(pb, 0); // size patched later
-            put_be24(pb, 0); // ts
-            put_byte(pb, 0); // ts ext
-            put_be24(pb, 0); // streamid
-            pos = url_ftell(pb);
-            if (enc->codec_id == CODEC_ID_AAC) {
-                put_byte(pb, get_audio_flags(enc));
-                put_byte(pb, 0); // AAC sequence header
-                put_buffer(pb, enc->extradata, enc->extradata_size);
-            } else {
-                put_byte(pb, enc->codec_tag | FLV_FRAME_KEY); // flags
-                put_byte(pb, 0); // AVC sequence header
-                put_be24(pb, 0); // composition time
-                ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size);
-            }
-            data_size = url_ftell(pb) - pos;
-            url_fseek(pb, -data_size - 10, SEEK_CUR);
-            put_be24(pb, data_size);
-            url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
-            put_be32(pb, data_size + 11); // previous tag size
-        }
-    }
-
-    return 0;
-}
-
-static int flv_write_trailer(AVFormatContext *s)
-{
-    int64_t file_size;
-
-    ByteIOContext *pb = s->pb;
-    FLVContext *flv = s->priv_data;
-
-    file_size = url_ftell(pb);
-
-    /* update informations */
-    url_fseek(pb, flv->duration_offset, SEEK_SET);
-    put_amf_double(pb, flv->duration / (double)1000);
-    url_fseek(pb, flv->filesize_offset, SEEK_SET);
-    put_amf_double(pb, file_size);
-
-    url_fseek(pb, file_size, SEEK_SET);
-    return 0;
-}
-
-static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
-    FLVContext *flv = s->priv_data;
-    unsigned ts;
-    int size= pkt->size;
-    uint8_t *data= NULL;
-    int flags, flags_size;
-
-//    av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", enc->codec_type, timestamp, size);
-
-    if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F ||
-       enc->codec_id == CODEC_ID_AAC)
-        flags_size= 2;
-    else if(enc->codec_id == CODEC_ID_H264)
-        flags_size= 5;
-    else
-        flags_size= 1;
-
-    if (enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-        put_byte(pb, FLV_TAG_TYPE_VIDEO);
-
-        flags = enc->codec_tag;
-        if(flags == 0) {
-            av_log(enc, AV_LOG_ERROR, "video codec %X not compatible with flv\n",enc->codec_id);
-            return -1;
-        }
-
-        flags |= pkt->flags & AV_PKT_FLAG_KEY ? FLV_FRAME_KEY : FLV_FRAME_INTER;
-    } else {
-        assert(enc->codec_type == AVMEDIA_TYPE_AUDIO);
-        flags = get_audio_flags(enc);
-
-        assert(size);
-
-        put_byte(pb, FLV_TAG_TYPE_AUDIO);
-    }
-
-    if (enc->codec_id == CODEC_ID_H264) {
-        /* check if extradata looks like mp4 formated */
-        if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) {
-            if (ff_avc_parse_nal_units_buf(pkt->data, &data, &size) < 0)
-                return -1;
-        }
-        if (!flv->delay && pkt->dts < 0)
-            flv->delay = -pkt->dts;
-    }
-
-    ts = pkt->dts + flv->delay; // add delay to force positive dts
-    put_be24(pb,size + flags_size);
-    put_be24(pb,ts);
-    put_byte(pb,(ts >> 24) & 0x7F); // timestamps are 32bits _signed_
-    put_be24(pb,flv->reserved);
-    put_byte(pb,flags);
-    if (enc->codec_id == CODEC_ID_VP6)
-        put_byte(pb,0);
-    if (enc->codec_id == CODEC_ID_VP6F)
-        put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
-    else if (enc->codec_id == CODEC_ID_AAC)
-        put_byte(pb,1); // AAC raw
-    else if (enc->codec_id == CODEC_ID_H264) {
-        put_byte(pb,1); // AVC NALU
-        put_be24(pb,pkt->pts - pkt->dts);
-    }
-
-    put_buffer(pb, data ? data : pkt->data, size);
-
-    put_be32(pb,size+flags_size+11); // previous tag size
-    flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration);
-
-    put_flush_packet(pb);
-
-    av_free(data);
-
-    return 0;
-}
-
-AVOutputFormat flv_muxer = {
-    "flv",
-    NULL_IF_CONFIG_SMALL("FLV format"),
-    "video/x-flv",
-    "flv",
-    sizeof(FLVContext),
-#if CONFIG_LIBMP3LAME
-    CODEC_ID_MP3,
-#else // CONFIG_LIBMP3LAME
-    CODEC_ID_ADPCM_SWF,
-#endif // CONFIG_LIBMP3LAME
-    CODEC_ID_FLV1,
-    flv_write_header,
-    flv_write_packet,
-    flv_write_trailer,
-    .codec_tag= (const AVCodecTag* const []){flv_video_codec_ids, flv_audio_codec_ids, 0},
-    .flags= AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
-};
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
deleted file mode 100644
index f59a0c8..0000000
--- a/libavformat/framecrcenc.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * frame CRC encoder (for codec/format testing)
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/adler32.h"
-#include "avformat.h"
-
-static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    uint32_t crc = av_adler32_update(0, pkt->data, pkt->size);
-    char buf[256];
-
-    snprintf(buf, sizeof(buf), "%d, %"PRId64", %d, 0x%08x\n", pkt->stream_index, pkt->dts, pkt->size, crc);
-    put_buffer(s->pb, buf, strlen(buf));
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-AVOutputFormat framecrc_muxer = {
-    "framecrc",
-    NULL_IF_CONFIG_SMALL("framecrc testing format"),
-    NULL,
-    "",
-    0,
-    CODEC_ID_PCM_S16LE,
-    CODEC_ID_RAWVIDEO,
-    NULL,
-    framecrc_write_packet,
-    NULL,
-};
diff --git a/libavformat/gif.c b/libavformat/gif.c
deleted file mode 100644
index 4741915..0000000
--- a/libavformat/gif.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Animated GIF muxer
- * Copyright (c) 2000 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * First version by Francois Revol revol at free.fr
- *
- * Features and limitations:
- * - currently no compression is performed,
- *   in fact the size of the data is 9/8 the size of the image in 8bpp
- * - uses only a global standard palette
- * - tested with IE 5.0, Opera for BeOS, NetPositive (BeOS), and Mozilla (BeOS).
- *
- * Reference documents:
- * http://www.goice.co.jp/member/mo/formats/gif.html
- * http://astronomy.swin.edu.au/pbourke/dataformats/gif/
- * http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/GIF89a.txt
- *
- * this url claims to have an LZW algorithm not covered by Unisys patent:
- * http://www.msg.net/utility/whirlgif/gifencod.html
- * could help reduce the size of the files _a lot_...
- * some sites mentions an RLE type compression also.
- */
-
-#include "avformat.h"
-
-/* The GIF format uses reversed order for bitstreams... */
-/* at least they don't use PDP_ENDIAN :) */
-#define BITSTREAM_WRITER_LE
-
-#include "libavcodec/put_bits.h"
-
-/* bitstream minipacket size */
-#define GIF_CHUNKS 100
-
-/* slows down the decoding (and some browsers don't like it) */
-/* update on the 'some browsers don't like it issue from above: this was probably due to missing 'Data Sub-block Terminator' (byte 19) in the app_header */
-#define GIF_ADD_APP_HEADER // required to enable looping of animated gif
-
-typedef struct {
-    unsigned char r;
-    unsigned char g;
-    unsigned char b;
-} rgb_triplet;
-
-/* we use the standard 216 color palette */
-
-/* this script was used to create the palette:
- * for r in 00 33 66 99 cc ff; do for g in 00 33 66 99 cc ff; do echo -n "    "; for b in 00 33 66 99 cc ff; do
- *   echo -n "{ 0x$r, 0x$g, 0x$b }, "; done; echo ""; done; done
- */
-
-static const rgb_triplet gif_clut[216] = {
-    { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x33 }, { 0x00, 0x00, 0x66 }, { 0x00, 0x00, 0x99 }, { 0x00, 0x00, 0xcc }, { 0x00, 0x00, 0xff },
-    { 0x00, 0x33, 0x00 }, { 0x00, 0x33, 0x33 }, { 0x00, 0x33, 0x66 }, { 0x00, 0x33, 0x99 }, { 0x00, 0x33, 0xcc }, { 0x00, 0x33, 0xff },
-    { 0x00, 0x66, 0x00 }, { 0x00, 0x66, 0x33 }, { 0x00, 0x66, 0x66 }, { 0x00, 0x66, 0x99 }, { 0x00, 0x66, 0xcc }, { 0x00, 0x66, 0xff },
-    { 0x00, 0x99, 0x00 }, { 0x00, 0x99, 0x33 }, { 0x00, 0x99, 0x66 }, { 0x00, 0x99, 0x99 }, { 0x00, 0x99, 0xcc }, { 0x00, 0x99, 0xff },
-    { 0x00, 0xcc, 0x00 }, { 0x00, 0xcc, 0x33 }, { 0x00, 0xcc, 0x66 }, { 0x00, 0xcc, 0x99 }, { 0x00, 0xcc, 0xcc }, { 0x00, 0xcc, 0xff },
-    { 0x00, 0xff, 0x00 }, { 0x00, 0xff, 0x33 }, { 0x00, 0xff, 0x66 }, { 0x00, 0xff, 0x99 }, { 0x00, 0xff, 0xcc }, { 0x00, 0xff, 0xff },
-    { 0x33, 0x00, 0x00 }, { 0x33, 0x00, 0x33 }, { 0x33, 0x00, 0x66 }, { 0x33, 0x00, 0x99 }, { 0x33, 0x00, 0xcc }, { 0x33, 0x00, 0xff },
-    { 0x33, 0x33, 0x00 }, { 0x33, 0x33, 0x33 }, { 0x33, 0x33, 0x66 }, { 0x33, 0x33, 0x99 }, { 0x33, 0x33, 0xcc }, { 0x33, 0x33, 0xff },
-    { 0x33, 0x66, 0x00 }, { 0x33, 0x66, 0x33 }, { 0x33, 0x66, 0x66 }, { 0x33, 0x66, 0x99 }, { 0x33, 0x66, 0xcc }, { 0x33, 0x66, 0xff },
-    { 0x33, 0x99, 0x00 }, { 0x33, 0x99, 0x33 }, { 0x33, 0x99, 0x66 }, { 0x33, 0x99, 0x99 }, { 0x33, 0x99, 0xcc }, { 0x33, 0x99, 0xff },
-    { 0x33, 0xcc, 0x00 }, { 0x33, 0xcc, 0x33 }, { 0x33, 0xcc, 0x66 }, { 0x33, 0xcc, 0x99 }, { 0x33, 0xcc, 0xcc }, { 0x33, 0xcc, 0xff },
-    { 0x33, 0xff, 0x00 }, { 0x33, 0xff, 0x33 }, { 0x33, 0xff, 0x66 }, { 0x33, 0xff, 0x99 }, { 0x33, 0xff, 0xcc }, { 0x33, 0xff, 0xff },
-    { 0x66, 0x00, 0x00 }, { 0x66, 0x00, 0x33 }, { 0x66, 0x00, 0x66 }, { 0x66, 0x00, 0x99 }, { 0x66, 0x00, 0xcc }, { 0x66, 0x00, 0xff },
-    { 0x66, 0x33, 0x00 }, { 0x66, 0x33, 0x33 }, { 0x66, 0x33, 0x66 }, { 0x66, 0x33, 0x99 }, { 0x66, 0x33, 0xcc }, { 0x66, 0x33, 0xff },
-    { 0x66, 0x66, 0x00 }, { 0x66, 0x66, 0x33 }, { 0x66, 0x66, 0x66 }, { 0x66, 0x66, 0x99 }, { 0x66, 0x66, 0xcc }, { 0x66, 0x66, 0xff },
-    { 0x66, 0x99, 0x00 }, { 0x66, 0x99, 0x33 }, { 0x66, 0x99, 0x66 }, { 0x66, 0x99, 0x99 }, { 0x66, 0x99, 0xcc }, { 0x66, 0x99, 0xff },
-    { 0x66, 0xcc, 0x00 }, { 0x66, 0xcc, 0x33 }, { 0x66, 0xcc, 0x66 }, { 0x66, 0xcc, 0x99 }, { 0x66, 0xcc, 0xcc }, { 0x66, 0xcc, 0xff },
-    { 0x66, 0xff, 0x00 }, { 0x66, 0xff, 0x33 }, { 0x66, 0xff, 0x66 }, { 0x66, 0xff, 0x99 }, { 0x66, 0xff, 0xcc }, { 0x66, 0xff, 0xff },
-    { 0x99, 0x00, 0x00 }, { 0x99, 0x00, 0x33 }, { 0x99, 0x00, 0x66 }, { 0x99, 0x00, 0x99 }, { 0x99, 0x00, 0xcc }, { 0x99, 0x00, 0xff },
-    { 0x99, 0x33, 0x00 }, { 0x99, 0x33, 0x33 }, { 0x99, 0x33, 0x66 }, { 0x99, 0x33, 0x99 }, { 0x99, 0x33, 0xcc }, { 0x99, 0x33, 0xff },
-    { 0x99, 0x66, 0x00 }, { 0x99, 0x66, 0x33 }, { 0x99, 0x66, 0x66 }, { 0x99, 0x66, 0x99 }, { 0x99, 0x66, 0xcc }, { 0x99, 0x66, 0xff },
-    { 0x99, 0x99, 0x00 }, { 0x99, 0x99, 0x33 }, { 0x99, 0x99, 0x66 }, { 0x99, 0x99, 0x99 }, { 0x99, 0x99, 0xcc }, { 0x99, 0x99, 0xff },
-    { 0x99, 0xcc, 0x00 }, { 0x99, 0xcc, 0x33 }, { 0x99, 0xcc, 0x66 }, { 0x99, 0xcc, 0x99 }, { 0x99, 0xcc, 0xcc }, { 0x99, 0xcc, 0xff },
-    { 0x99, 0xff, 0x00 }, { 0x99, 0xff, 0x33 }, { 0x99, 0xff, 0x66 }, { 0x99, 0xff, 0x99 }, { 0x99, 0xff, 0xcc }, { 0x99, 0xff, 0xff },
-    { 0xcc, 0x00, 0x00 }, { 0xcc, 0x00, 0x33 }, { 0xcc, 0x00, 0x66 }, { 0xcc, 0x00, 0x99 }, { 0xcc, 0x00, 0xcc }, { 0xcc, 0x00, 0xff },
-    { 0xcc, 0x33, 0x00 }, { 0xcc, 0x33, 0x33 }, { 0xcc, 0x33, 0x66 }, { 0xcc, 0x33, 0x99 }, { 0xcc, 0x33, 0xcc }, { 0xcc, 0x33, 0xff },
-    { 0xcc, 0x66, 0x00 }, { 0xcc, 0x66, 0x33 }, { 0xcc, 0x66, 0x66 }, { 0xcc, 0x66, 0x99 }, { 0xcc, 0x66, 0xcc }, { 0xcc, 0x66, 0xff },
-    { 0xcc, 0x99, 0x00 }, { 0xcc, 0x99, 0x33 }, { 0xcc, 0x99, 0x66 }, { 0xcc, 0x99, 0x99 }, { 0xcc, 0x99, 0xcc }, { 0xcc, 0x99, 0xff },
-    { 0xcc, 0xcc, 0x00 }, { 0xcc, 0xcc, 0x33 }, { 0xcc, 0xcc, 0x66 }, { 0xcc, 0xcc, 0x99 }, { 0xcc, 0xcc, 0xcc }, { 0xcc, 0xcc, 0xff },
-    { 0xcc, 0xff, 0x00 }, { 0xcc, 0xff, 0x33 }, { 0xcc, 0xff, 0x66 }, { 0xcc, 0xff, 0x99 }, { 0xcc, 0xff, 0xcc }, { 0xcc, 0xff, 0xff },
-    { 0xff, 0x00, 0x00 }, { 0xff, 0x00, 0x33 }, { 0xff, 0x00, 0x66 }, { 0xff, 0x00, 0x99 }, { 0xff, 0x00, 0xcc }, { 0xff, 0x00, 0xff },
-    { 0xff, 0x33, 0x00 }, { 0xff, 0x33, 0x33 }, { 0xff, 0x33, 0x66 }, { 0xff, 0x33, 0x99 }, { 0xff, 0x33, 0xcc }, { 0xff, 0x33, 0xff },
-    { 0xff, 0x66, 0x00 }, { 0xff, 0x66, 0x33 }, { 0xff, 0x66, 0x66 }, { 0xff, 0x66, 0x99 }, { 0xff, 0x66, 0xcc }, { 0xff, 0x66, 0xff },
-    { 0xff, 0x99, 0x00 }, { 0xff, 0x99, 0x33 }, { 0xff, 0x99, 0x66 }, { 0xff, 0x99, 0x99 }, { 0xff, 0x99, 0xcc }, { 0xff, 0x99, 0xff },
-    { 0xff, 0xcc, 0x00 }, { 0xff, 0xcc, 0x33 }, { 0xff, 0xcc, 0x66 }, { 0xff, 0xcc, 0x99 }, { 0xff, 0xcc, 0xcc }, { 0xff, 0xcc, 0xff },
-    { 0xff, 0xff, 0x00 }, { 0xff, 0xff, 0x33 }, { 0xff, 0xff, 0x66 }, { 0xff, 0xff, 0x99 }, { 0xff, 0xff, 0xcc }, { 0xff, 0xff, 0xff },
-};
-
-/* GIF header */
-static int gif_image_write_header(ByteIOContext *pb,
-                                  int width, int height, int loop_count,
-                                  uint32_t *palette)
-{
-    int i;
-    unsigned int v;
-
-    put_tag(pb, "GIF");
-    put_tag(pb, "89a");
-    put_le16(pb, width);
-    put_le16(pb, height);
-
-    put_byte(pb, 0xf7); /* flags: global clut, 256 entries */
-    put_byte(pb, 0x1f); /* background color index */
-    put_byte(pb, 0); /* aspect ratio */
-
-    /* the global palette */
-    if (!palette) {
-        put_buffer(pb, (const unsigned char *)gif_clut, 216*3);
-        for(i=0;i<((256-216)*3);i++)
-            put_byte(pb, 0);
-    } else {
-        for(i=0;i<256;i++) {
-            v = palette[i];
-            put_byte(pb, (v >> 16) & 0xff);
-            put_byte(pb, (v >> 8) & 0xff);
-            put_byte(pb, (v) & 0xff);
-        }
-    }
-
-        /*        update: this is the 'NETSCAPE EXTENSION' that allows for looped animated gif
-                see http://members.aol.com/royalef/gifabout.htm#net-extension
-
-                byte   1       : 33 (hex 0x21) GIF Extension code
-                byte   2       : 255 (hex 0xFF) Application Extension Label
-                byte   3       : 11 (hex (0x0B) Length of Application Block
-                                         (eleven bytes of data to follow)
-                bytes  4 to 11 : "NETSCAPE"
-                bytes 12 to 14 : "2.0"
-                byte  15       : 3 (hex 0x03) Length of Data Sub-Block
-                                         (three bytes of data to follow)
-                byte  16       : 1 (hex 0x01)
-                bytes 17 to 18 : 0 to 65535, an unsigned integer in
-                                         lo-hi byte format. This indicate the
-                                         number of iterations the loop should
-                                         be executed.
-                bytes 19       : 0 (hex 0x00) a Data Sub-block Terminator
-        */
-
-    /* application extension header */
-#ifdef GIF_ADD_APP_HEADER
-    if (loop_count >= 0 && loop_count <= 65535) {
-    put_byte(pb, 0x21);
-    put_byte(pb, 0xff);
-    put_byte(pb, 0x0b);
-        put_tag(pb, "NETSCAPE2.0");  // bytes 4 to 14
-        put_byte(pb, 0x03); // byte 15
-        put_byte(pb, 0x01); // byte 16
-        put_le16(pb, (uint16_t)loop_count);
-        put_byte(pb, 0x00); // byte 19
-    }
-#endif
-    return 0;
-}
-
-/* this is maybe slow, but allows for extensions */
-static inline unsigned char gif_clut_index(uint8_t r, uint8_t g, uint8_t b)
-{
-    return (((r) / 47) % 6) * 6 * 6 + (((g) / 47) % 6) * 6 + (((b) / 47) % 6);
-}
-
-
-static int gif_image_write_image(ByteIOContext *pb,
-                                 int x1, int y1, int width, int height,
-                                 const uint8_t *buf, int linesize, int pix_fmt)
-{
-    PutBitContext p;
-    uint8_t buffer[200]; /* 100 * 9 / 8 = 113 */
-    int i, left, w, v;
-    const uint8_t *ptr;
-    /* image block */
-
-    put_byte(pb, 0x2c);
-    put_le16(pb, x1);
-    put_le16(pb, y1);
-    put_le16(pb, width);
-    put_le16(pb, height);
-    put_byte(pb, 0x00); /* flags */
-    /* no local clut */
-
-    put_byte(pb, 0x08);
-
-    left= width * height;
-
-    init_put_bits(&p, buffer, 130);
-
-/*
- * the thing here is the bitstream is written as little packets, with a size byte before
- * but it's still the same bitstream between packets (no flush !)
- */
-    ptr = buf;
-    w = width;
-    while(left>0) {
-
-        put_bits(&p, 9, 0x0100); /* clear code */
-
-        for(i=(left<GIF_CHUNKS)?left:GIF_CHUNKS;i;i--) {
-            if (pix_fmt == PIX_FMT_RGB24) {
-                v = gif_clut_index(ptr[0], ptr[1], ptr[2]);
-                ptr+=3;
-            } else {
-                v = *ptr++;
-            }
-            put_bits(&p, 9, v);
-            if (--w == 0) {
-                w = width;
-                buf += linesize;
-                ptr = buf;
-            }
-        }
-
-        if(left<=GIF_CHUNKS) {
-            put_bits(&p, 9, 0x101); /* end of stream */
-            flush_put_bits(&p);
-        }
-        if(put_bits_ptr(&p) - p.buf > 0) {
-            put_byte(pb, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
-            put_buffer(pb, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
-            p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
-        }
-        left-=GIF_CHUNKS;
-    }
-    put_byte(pb, 0x00); /* end of image block */
-
-    return 0;
-}
-
-typedef struct {
-    int64_t time, file_time;
-    uint8_t buffer[100]; /* data chunks */
-} GIFContext;
-
-static int gif_write_header(AVFormatContext *s)
-{
-    GIFContext *gif = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *enc, *video_enc;
-    int i, width, height, loop_count /*, rate*/;
-
-/* XXX: do we reject audio streams or just ignore them ?
-    if(s->nb_streams > 1)
-        return -1;
-*/
-    gif->time = 0;
-    gif->file_time = 0;
-
-    video_enc = NULL;
-    for(i=0;i<s->nb_streams;i++) {
-        enc = s->streams[i]->codec;
-        if (enc->codec_type != AVMEDIA_TYPE_AUDIO)
-            video_enc = enc;
-    }
-
-    if (!video_enc) {
-        av_free(gif);
-        return -1;
-    } else {
-        width = video_enc->width;
-        height = video_enc->height;
-        loop_count = s->loop_output;
-//        rate = video_enc->time_base.den;
-    }
-
-    if (video_enc->pix_fmt != PIX_FMT_RGB24) {
-        av_log(s, AV_LOG_ERROR, "ERROR: gif only handles the rgb24 pixel format. Use -pix_fmt rgb24.\n");
-        return AVERROR(EIO);
-    }
-
-    gif_image_write_header(pb, width, height, loop_count, NULL);
-
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int gif_write_video(AVFormatContext *s,
-                           AVCodecContext *enc, const uint8_t *buf, int size)
-{
-    ByteIOContext *pb = s->pb;
-    GIFContext *gif = s->priv_data;
-    int jiffies;
-    int64_t delay;
-
-    /* graphic control extension block */
-    put_byte(pb, 0x21);
-    put_byte(pb, 0xf9);
-    put_byte(pb, 0x04); /* block size */
-    put_byte(pb, 0x04); /* flags */
-
-    /* 1 jiffy is 1/70 s */
-    /* the delay_time field indicates the number of jiffies - 1 */
-    delay = gif->file_time - gif->time;
-
-    /* XXX: should use delay, in order to be more accurate */
-    /* instead of using the same rounded value each time */
-    /* XXX: don't even remember if I really use it for now */
-    jiffies = (70*enc->time_base.num/enc->time_base.den) - 1;
-
-    put_le16(pb, jiffies);
-
-    put_byte(pb, 0x1f); /* transparent color index */
-    put_byte(pb, 0x00);
-
-    gif_image_write_image(pb, 0, 0, enc->width, enc->height,
-                          buf, enc->width * 3, PIX_FMT_RGB24);
-
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
-    if (codec->codec_type == AVMEDIA_TYPE_AUDIO)
-        return 0; /* just ignore audio */
-    else
-        return gif_write_video(s, codec, pkt->data, pkt->size);
-}
-
-static int gif_write_trailer(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-
-    put_byte(pb, 0x3b);
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-AVOutputFormat gif_muxer = {
-    "gif",
-    NULL_IF_CONFIG_SMALL("GIF Animation"),
-    "image/gif",
-    "gif",
-    sizeof(GIFContext),
-    CODEC_ID_NONE,
-    CODEC_ID_RAWVIDEO,
-    gif_write_header,
-    gif_write_packet,
-    gif_write_trailer,
-};
diff --git a/libavformat/gopher.c b/libavformat/gopher.c
deleted file mode 100644
index f5bb4a3..0000000
--- a/libavformat/gopher.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Gopher protocol
- *
- * Copyright (c) 2009 Toshimitsu Kimura
- *
- * based on libavformat/http.c, Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include "internal.h"
-#include "network.h"
-
-typedef struct {
-    URLContext *hd;
-} GopherContext;
-
-static int gopher_write(URLContext *h, uint8_t *buf, int size)
-{
-    GopherContext *s = h->priv_data;
-    return url_write(s->hd, buf, size);
-}
-
-static int gopher_connect(URLContext *h, const char *path)
-{
-    char buffer[1024];
-
-    if (!*path) return AVERROR(EINVAL);
-    switch (*++path) {
-        case '5':
-        case '9':
-            path = strchr(path, '/');
-            if (!path) return AVERROR(EINVAL);
-            break;
-        default:
-            av_log(NULL, AV_LOG_WARNING,
-                   "Gopher protocol type '%c' not supported yet!\n",
-                   *path);
-            return AVERROR(EINVAL);
-    }
-
-    /* send gopher sector */
-    snprintf(buffer, sizeof(buffer), "%s\r\n", path);
-
-    if (gopher_write(h, buffer, strlen(buffer)) < 0)
-        return AVERROR(EIO);
-
-    return 0;
-}
-
-static int gopher_close(URLContext *h)
-{
-    GopherContext *s = h->priv_data;
-    if (s->hd) {
-        url_close(s->hd);
-        s->hd = NULL;
-    }
-    av_freep(&h->priv_data);
-    return 0;
-}
-
-static int gopher_open(URLContext *h, const char *uri, int flags)
-{
-    GopherContext *s;
-    char hostname[1024], auth[1024], path[1024], buf[1024];
-    int port, err;
-
-    h->is_streamed = 1;
-
-    s = av_malloc(sizeof(GopherContext));
-    if (!s) {
-        return AVERROR(ENOMEM);
-    }
-    h->priv_data = s;
-
-    /* needed in any case to build the host string */
-    ff_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
-                 path, sizeof(path), uri);
-
-    if (port < 0)
-        port = 70;
-
-    ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
-
-    s->hd = NULL;
-    err = url_open(&s->hd, buf, URL_RDWR);
-    if (err < 0)
-        goto fail;
-
-    if ((err = gopher_connect(h, path)) < 0)
-        goto fail;
-    return 0;
- fail:
-    gopher_close(h);
-    return err;
-}
-
-static int gopher_read(URLContext *h, uint8_t *buf, int size)
-{
-    GopherContext *s = h->priv_data;
-    int len = url_read(s->hd, buf, size);
-    return len;
-}
-
-
-URLProtocol gopher_protocol = {
-    "gopher",
-    gopher_open,
-    gopher_read,
-    gopher_write,
-    NULL, /*seek*/
-    gopher_close,
-};
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
deleted file mode 100644
index ea8a2ff..0000000
--- a/libavformat/gxf.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * GXF demuxer.
- * Copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/common.h"
-#include "avformat.h"
-#include "gxf.h"
-
-struct gxf_stream_info {
-    int64_t first_field;
-    int64_t last_field;
-    AVRational frames_per_second;
-    int32_t fields_per_frame;
-};
-
-/**
- * \brief parses a packet header, extracting type and length
- * \param pb ByteIOContext to read header from
- * \param type detected packet type is stored here
- * \param length detected packet length, excluding header is stored here
- * \return 0 if header not found or contains invalid data, 1 otherwise
- */
-static int parse_packet_header(ByteIOContext *pb, GXFPktType *type, int *length) {
-    if (get_be32(pb))
-        return 0;
-    if (get_byte(pb) != 1)
-        return 0;
-    *type = get_byte(pb);
-    *length = get_be32(pb);
-    if ((*length >> 24) || *length < 16)
-        return 0;
-    *length -= 16;
-    if (get_be32(pb))
-        return 0;
-    if (get_byte(pb) != 0xe1)
-        return 0;
-    if (get_byte(pb) != 0xe2)
-        return 0;
-    return 1;
-}
-
-/**
- * \brief check if file starts with a PKT_MAP header
- */
-static int gxf_probe(AVProbeData *p) {
-    static const uint8_t startcode[] = {0, 0, 0, 0, 1, 0xbc}; // start with map packet
-    static const uint8_t endcode[] = {0, 0, 0, 0, 0xe1, 0xe2};
-    if (!memcmp(p->buf, startcode, sizeof(startcode)) &&
-        !memcmp(&p->buf[16 - sizeof(endcode)], endcode, sizeof(endcode)))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-/**
- * \brief gets the stream index for the track with the specified id, creates new
- *        stream if not found
- * \param stream id of stream to find / add
- * \param format stream format identifier
- */
-static int get_sindex(AVFormatContext *s, int id, int format) {
-    int i;
-    AVStream *st = NULL;
-    for (i = 0; i < s->nb_streams; i++) {
-        if (s->streams[i]->id == id)
-            return i;
-    }
-    st = av_new_stream(s, id);
-    if (!st)
-        return AVERROR(ENOMEM);
-    switch (format) {
-        case 3:
-        case 4:
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_MJPEG;
-            break;
-        case 13:
-        case 15:
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_DVVIDEO;
-            break;
-        case 14:
-        case 16:
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_DVVIDEO;
-            break;
-        case 11:
-        case 12:
-        case 20:
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
-            st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
-            break;
-        case 22:
-        case 23:
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_MPEG1VIDEO;
-            st->need_parsing = AVSTREAM_PARSE_HEADERS; //get keyframe flag etc.
-            break;
-        case 9:
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_id = CODEC_ID_PCM_S24LE;
-            st->codec->channels = 1;
-            st->codec->sample_rate = 48000;
-            st->codec->bit_rate = 3 * 1 * 48000 * 8;
-            st->codec->block_align = 3 * 1;
-            st->codec->bits_per_coded_sample = 24;
-            break;
-        case 10:
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_id = CODEC_ID_PCM_S16LE;
-            st->codec->channels = 1;
-            st->codec->sample_rate = 48000;
-            st->codec->bit_rate = 2 * 1 * 48000 * 8;
-            st->codec->block_align = 2 * 1;
-            st->codec->bits_per_coded_sample = 16;
-            break;
-        case 17:
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_id = CODEC_ID_AC3;
-            st->codec->channels = 2;
-            st->codec->sample_rate = 48000;
-            break;
-        // timecode tracks:
-        case 7:
-        case 8:
-        case 24:
-            st->codec->codec_type = AVMEDIA_TYPE_DATA;
-            st->codec->codec_id = CODEC_ID_NONE;
-            break;
-        default:
-            st->codec->codec_type = AVMEDIA_TYPE_UNKNOWN;
-            st->codec->codec_id = CODEC_ID_NONE;
-            break;
-    }
-    return s->nb_streams - 1;
-}
-
-/**
- * \brief filters out interesting tags from material information.
- * \param len length of tag section, will be adjusted to contain remaining bytes
- * \param si struct to store collected information into
- */
-static void gxf_material_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) {
-    si->first_field = AV_NOPTS_VALUE;
-    si->last_field = AV_NOPTS_VALUE;
-    while (*len >= 2) {
-        GXFMatTag tag = get_byte(pb);
-        int tlen = get_byte(pb);
-        *len -= 2;
-        if (tlen > *len)
-            return;
-        *len -= tlen;
-        if (tlen == 4) {
-            uint32_t value = get_be32(pb);
-            if (tag == MAT_FIRST_FIELD)
-                si->first_field = value;
-            else if (tag == MAT_LAST_FIELD)
-                si->last_field = value;
-        } else
-            url_fskip(pb, tlen);
-    }
-}
-
-/**
- * \brief convert fps tag value to AVRational fps
- * \param fps fps value from tag
- * \return fps as AVRational, or 0 / 0 if unknown
- */
-static AVRational fps_tag2avr(int32_t fps) {
-    extern const AVRational ff_frame_rate_tab[];
-    if (fps < 1 || fps > 9) fps = 9;
-    return ff_frame_rate_tab[9 - fps]; // values have opposite order
-}
-
-/**
- * \brief convert UMF attributes flags to AVRational fps
- * \param fps fps value from flags
- * \return fps as AVRational, or 0 / 0 if unknown
- */
-static AVRational fps_umf2avr(uint32_t flags) {
-    static const AVRational map[] = {{50, 1}, {60000, 1001}, {24, 1},
-        {25, 1}, {30000, 1001}};
-    int idx =  av_log2((flags & 0x7c0) >> 6);
-    return map[idx];
-}
-
-/**
- * \brief filters out interesting tags from track information.
- * \param len length of tag section, will be adjusted to contain remaining bytes
- * \param si struct to store collected information into
- */
-static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *si) {
-    si->frames_per_second = (AVRational){0, 0};
-    si->fields_per_frame = 0;
-    while (*len >= 2) {
-        GXFTrackTag tag = get_byte(pb);
-        int tlen = get_byte(pb);
-        *len -= 2;
-        if (tlen > *len)
-            return;
-        *len -= tlen;
-        if (tlen == 4) {
-            uint32_t value = get_be32(pb);
-            if (tag == TRACK_FPS)
-                si->frames_per_second = fps_tag2avr(value);
-            else if (tag == TRACK_FPF && (value == 1 || value == 2))
-                si->fields_per_frame = value;
-        } else
-            url_fskip(pb, tlen);
-    }
-}
-
-/**
- * \brief read index from FLT packet into stream 0 av_index
- */
-static void gxf_read_index(AVFormatContext *s, int pkt_len) {
-    ByteIOContext *pb = s->pb;
-    AVStream *st = s->streams[0];
-    uint32_t fields_per_map = get_le32(pb);
-    uint32_t map_cnt = get_le32(pb);
-    int i;
-    pkt_len -= 8;
-    if (map_cnt > 1000) {
-        av_log(s, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt);
-        map_cnt = 1000;
-    }
-    if (pkt_len < 4 * map_cnt) {
-        av_log(s, AV_LOG_ERROR, "invalid index length\n");
-        url_fskip(pb, pkt_len);
-        return;
-    }
-    pkt_len -= 4 * map_cnt;
-    av_add_index_entry(st, 0, 0, 0, 0, 0);
-    for (i = 0; i < map_cnt; i++)
-        av_add_index_entry(st, (uint64_t)get_le32(pb) * 1024,
-                           i * (uint64_t)fields_per_map + 1, 0, 0, 0);
-    url_fskip(pb, pkt_len);
-}
-
-static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
-    ByteIOContext *pb = s->pb;
-    GXFPktType pkt_type;
-    int map_len;
-    int len;
-    AVRational main_timebase = {0, 0};
-    struct gxf_stream_info si;
-    int i;
-    if (!parse_packet_header(pb, &pkt_type, &map_len) || pkt_type != PKT_MAP) {
-        av_log(s, AV_LOG_ERROR, "map packet not found\n");
-        return 0;
-    }
-    map_len -= 2;
-    if (get_byte(pb) != 0x0e0 || get_byte(pb) != 0xff) {
-        av_log(s, AV_LOG_ERROR, "unknown version or invalid map preamble\n");
-        return 0;
-    }
-    map_len -= 2;
-    len = get_be16(pb); // length of material data section
-    if (len > map_len) {
-        av_log(s, AV_LOG_ERROR, "material data longer than map data\n");
-        return 0;
-    }
-    map_len -= len;
-    gxf_material_tags(pb, &len, &si);
-    url_fskip(pb, len);
-    map_len -= 2;
-    len = get_be16(pb); // length of track description
-    if (len > map_len) {
-        av_log(s, AV_LOG_ERROR, "track description longer than map data\n");
-        return 0;
-    }
-    map_len -= len;
-    while (len > 0) {
-        int track_type, track_id, track_len;
-        AVStream *st;
-        int idx;
-        len -= 4;
-        track_type = get_byte(pb);
-        track_id = get_byte(pb);
-        track_len = get_be16(pb);
-        len -= track_len;
-        gxf_track_tags(pb, &track_len, &si);
-        url_fskip(pb, track_len);
-        if (!(track_type & 0x80)) {
-           av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type);
-           continue;
-        }
-        track_type &= 0x7f;
-        if ((track_id & 0xc0) != 0xc0) {
-           av_log(s, AV_LOG_ERROR, "invalid track id %x\n", track_id);
-           continue;
-        }
-        track_id &= 0x3f;
-        idx = get_sindex(s, track_id, track_type);
-        if (idx < 0) continue;
-        st = s->streams[idx];
-        if (!main_timebase.num || !main_timebase.den) {
-            main_timebase.num = si.frames_per_second.den;
-            main_timebase.den = si.frames_per_second.num * 2;
-        }
-        st->start_time = si.first_field;
-        if (si.first_field != AV_NOPTS_VALUE && si.last_field != AV_NOPTS_VALUE)
-            st->duration = si.last_field - si.first_field;
-    }
-    if (len < 0)
-        av_log(s, AV_LOG_ERROR, "invalid track description length specified\n");
-    if (map_len)
-        url_fskip(pb, map_len);
-    if (!parse_packet_header(pb, &pkt_type, &len)) {
-        av_log(s, AV_LOG_ERROR, "sync lost in header\n");
-        return -1;
-    }
-    if (pkt_type == PKT_FLT) {
-        gxf_read_index(s, len);
-        if (!parse_packet_header(pb, &pkt_type, &len)) {
-            av_log(s, AV_LOG_ERROR, "sync lost in header\n");
-            return -1;
-        }
-    }
-    if (pkt_type == PKT_UMF) {
-        if (len >= 0x39) {
-            AVRational fps;
-            len -= 0x39;
-            url_fskip(pb, 5); // preamble
-            url_fskip(pb, 0x30); // payload description
-            fps = fps_umf2avr(get_le32(pb));
-            if (!main_timebase.num || !main_timebase.den) {
-                // this may not always be correct, but simply the best we can get
-                main_timebase.num = fps.den;
-                main_timebase.den = fps.num * 2;
-            }
-        } else
-            av_log(s, AV_LOG_INFO, "UMF packet too short\n");
-    } else
-        av_log(s, AV_LOG_INFO, "UMF packet missing\n");
-    url_fskip(pb, len);
-    // set a fallback value, 60000/1001 is specified for audio-only files
-    // so use that regardless of why we do not know the video frame rate.
-    if (!main_timebase.num || !main_timebase.den)
-        main_timebase = (AVRational){1001, 60000};
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        av_set_pts_info(st, 32, main_timebase.num, main_timebase.den);
-    }
-    return 0;
-}
-
-#define READ_ONE() \
-    { \
-        if (!max_interval-- || url_feof(pb)) \
-            goto out; \
-        tmp = tmp << 8 | get_byte(pb); \
-    }
-
-/**
- * \brief resync the stream on the next media packet with specified properties
- * \param max_interval how many bytes to search for matching packet at most
- * \param track track id the media packet must belong to, -1 for any
- * \param timestamp minimum timestamp (== field number) the packet must have, -1 for any
- * \return timestamp of packet found
- */
-static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int track, int timestamp) {
-    uint32_t tmp;
-    uint64_t last_pos;
-    uint64_t last_found_pos = 0;
-    int cur_track;
-    int64_t cur_timestamp = AV_NOPTS_VALUE;
-    int len;
-    ByteIOContext *pb = s->pb;
-    GXFPktType type;
-    tmp = get_be32(pb);
-start:
-    while (tmp)
-        READ_ONE();
-    READ_ONE();
-    if (tmp != 1)
-        goto start;
-    last_pos = url_ftell(pb);
-    url_fseek(pb, -5, SEEK_CUR);
-    if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) {
-        url_fseek(pb, last_pos, SEEK_SET);
-        goto start;
-    }
-    get_byte(pb);
-    cur_track = get_byte(pb);
-    cur_timestamp = get_be32(pb);
-    last_found_pos = url_ftell(pb) - 16 - 6;
-    if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
-        url_fseek(pb, last_pos, SEEK_SET);
-        goto start;
-    }
-out:
-    if (last_found_pos)
-        url_fseek(pb, last_found_pos, SEEK_SET);
-    return cur_timestamp;
-}
-
-static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
-    GXFPktType pkt_type;
-    int pkt_len;
-    while (!url_feof(pb)) {
-        AVStream *st;
-        int track_type, track_id, ret;
-        int field_nr, field_info, skip = 0;
-        int stream_index;
-        if (!parse_packet_header(pb, &pkt_type, &pkt_len)) {
-            if (!url_feof(pb))
-                av_log(s, AV_LOG_ERROR, "sync lost\n");
-            return -1;
-        }
-        if (pkt_type == PKT_FLT) {
-            gxf_read_index(s, pkt_len);
-            continue;
-        }
-        if (pkt_type != PKT_MEDIA) {
-            url_fskip(pb, pkt_len);
-            continue;
-        }
-        if (pkt_len < 16) {
-            av_log(s, AV_LOG_ERROR, "invalid media packet length\n");
-            continue;
-        }
-        pkt_len -= 16;
-        track_type = get_byte(pb);
-        track_id = get_byte(pb);
-        stream_index = get_sindex(s, track_id, track_type);
-        if (stream_index < 0)
-            return stream_index;
-        st = s->streams[stream_index];
-        field_nr = get_be32(pb);
-        field_info = get_be32(pb);
-        get_be32(pb); // "timeline" field number
-        get_byte(pb); // flags
-        get_byte(pb); // reserved
-        if (st->codec->codec_id == CODEC_ID_PCM_S24LE ||
-            st->codec->codec_id == CODEC_ID_PCM_S16LE) {
-            int first = field_info >> 16;
-            int last  = field_info & 0xffff; // last is exclusive
-            int bps = av_get_bits_per_sample(st->codec->codec_id)>>3;
-            if (first <= last && last*bps <= pkt_len) {
-                url_fskip(pb, first*bps);
-                skip = pkt_len - last*bps;
-                pkt_len = (last-first)*bps;
-            } else
-                av_log(s, AV_LOG_ERROR, "invalid first and last sample values\n");
-        }
-        ret = av_get_packet(pb, pkt, pkt_len);
-        if (skip)
-            url_fskip(pb, skip);
-        pkt->stream_index = stream_index;
-        pkt->dts = field_nr;
-        return ret;
-    }
-    return AVERROR(EIO);
-}
-
-static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) {
-    uint64_t pos;
-    uint64_t maxlen = 100 * 1024 * 1024;
-    AVStream *st = s->streams[0];
-    int64_t start_time = s->streams[stream_index]->start_time;
-    int64_t found;
-    int idx;
-    if (timestamp < start_time) timestamp = start_time;
-    idx = av_index_search_timestamp(st, timestamp - start_time,
-                                    AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD);
-    if (idx < 0)
-        return -1;
-    pos = st->index_entries[idx].pos;
-    if (idx < st->nb_index_entries - 2)
-        maxlen = st->index_entries[idx + 2].pos - pos;
-    maxlen = FFMAX(maxlen, 200 * 1024);
-    url_fseek(s->pb, pos, SEEK_SET);
-    found = gxf_resync_media(s, maxlen, -1, timestamp);
-    if (FFABS(found - timestamp) > 4)
-        return -1;
-    return 0;
-}
-
-static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
-                                  int64_t *pos, int64_t pos_limit) {
-    ByteIOContext *pb = s->pb;
-    int64_t res;
-    url_fseek(pb, *pos, SEEK_SET);
-    res = gxf_resync_media(s, pos_limit - *pos, -1, -1);
-    *pos = url_ftell(pb);
-    return res;
-}
-
-AVInputFormat gxf_demuxer = {
-    "gxf",
-    NULL_IF_CONFIG_SMALL("GXF format"),
-    0,
-    gxf_probe,
-    gxf_header,
-    gxf_packet,
-    NULL,
-    gxf_seek,
-    gxf_read_timestamp,
-};
diff --git a/libavformat/gxf.h b/libavformat/gxf.h
deleted file mode 100644
index dcdcdef..0000000
--- a/libavformat/gxf.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * GXF demuxer
- * copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_GXF_H
-#define AVFORMAT_GXF_H
-
-typedef enum {
-    PKT_MAP         = 0xbc,
-    PKT_MEDIA       = 0xbf,
-    PKT_EOS         = 0xfb,
-    PKT_FLT         = 0xfc,
-    PKT_UMF         = 0xfd,
-} GXFPktType;
-
-typedef enum {
-    MAT_NAME        = 0x40,
-    MAT_FIRST_FIELD = 0x41,
-    MAT_LAST_FIELD  = 0x42,
-    MAT_MARK_IN     = 0x43,
-    MAT_MARK_OUT    = 0x44,
-    MAT_SIZE        = 0x45,
-} GXFMatTag;
-
-typedef enum {
-    TRACK_NAME      = 0x4c,
-    TRACK_AUX       = 0x4d,
-    TRACK_VER       = 0x4e,
-    TRACK_MPG_AUX   = 0x4f,
-    TRACK_FPS       = 0x50,
-    TRACK_LINES     = 0x51,
-    TRACK_FPF       = 0x52,
-} GXFTrackTag;
-
-#endif /* AVFORMAT_GXF_H */
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
deleted file mode 100644
index a6f4b72..0000000
--- a/libavformat/gxfenc.c
+++ /dev/null
@@ -1,938 +0,0 @@
-/*
- * GXF muxer.
- * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "gxf.h"
-#include "riff.h"
-#include "audiointerleave.h"
-
-#define GXF_AUDIO_PACKET_SIZE 65536
-
-typedef struct GXFStreamContext {
-    AudioInterleaveContext aic;
-    uint32_t track_type;
-    uint32_t sample_size;
-    uint32_t sample_rate;
-    uint16_t media_type;
-    uint16_t media_info;
-    int frame_rate_index;
-    int lines_index;
-    int fields;
-    int iframes;
-    int pframes;
-    int bframes;
-    int p_per_gop;
-    int b_per_i_or_p; ///< number of B frames per I frame or P frame
-    int first_gop_closed;
-    unsigned order;   ///< interleaving order
-} GXFStreamContext;
-
-typedef struct GXFContext {
-    uint32_t nb_fields;
-    uint16_t audio_tracks;
-    uint16_t mpeg_tracks;
-    int64_t creation_time;
-    uint32_t umf_start_offset;
-    uint32_t umf_track_offset;
-    uint32_t umf_media_offset;
-    uint32_t umf_length;
-    uint16_t umf_track_size;
-    uint16_t umf_media_size;
-    AVRational time_base;
-    int flags;
-    GXFStreamContext timecode_track;
-    unsigned *flt_entries;    ///< offsets of packets /1024, starts after 2nd video field
-    unsigned flt_entries_nb;
-    uint64_t *map_offsets;    ///< offset of map packets
-    unsigned map_offsets_nb;
-    unsigned packet_count;
-} GXFContext;
-
-static const struct {
-    int height, index;
-} gxf_lines_tab[] = {
-    { 480,  1 }, /* NTSC */
-    { 512,  1 }, /* NTSC + VBI */
-    { 576,  2 }, /* PAL */
-    { 608,  2 }, /* PAL + VBI */
-    { 1080, 4 },
-    { 720,  6 },
-};
-
-static const AVCodecTag gxf_media_types[] = {
-    { CODEC_ID_MJPEG     ,   3 }, /* NTSC */
-    { CODEC_ID_MJPEG     ,   4 }, /* PAL */
-    { CODEC_ID_PCM_S24LE ,   9 },
-    { CODEC_ID_PCM_S16LE ,  10 },
-    { CODEC_ID_MPEG2VIDEO,  11 }, /* NTSC */
-    { CODEC_ID_MPEG2VIDEO,  12 }, /* PAL */
-    { CODEC_ID_DVVIDEO   ,  13 }, /* NTSC */
-    { CODEC_ID_DVVIDEO   ,  14 }, /* PAL */
-    { CODEC_ID_DVVIDEO   ,  15 }, /* 50M NTSC */
-    { CODEC_ID_DVVIDEO   ,  16 }, /* 50M PAL */
-    { CODEC_ID_AC3       ,  17 },
-    //{ CODEC_ID_NONE,  ,   18 }, /* Non compressed 24 bit audio */
-    { CODEC_ID_MPEG2VIDEO,  20 }, /* MPEG HD */
-    { CODEC_ID_MPEG1VIDEO,  22 }, /* NTSC */
-    { CODEC_ID_MPEG1VIDEO,  23 }, /* PAL */
-    { CODEC_ID_NONE,         0 },
-};
-
-#define SERVER_PATH "EXT:/PDR/default/"
-#define ES_NAME_PATTERN "EXT:/PDR/default/ES."
-
-static int gxf_find_lines_index(AVStream *st)
-{
-    GXFStreamContext *sc = st->priv_data;
-    int i;
-
-    for (i = 0; i < 6; ++i) {
-        if (st->codec->height == gxf_lines_tab[i].height) {
-            sc->lines_index = gxf_lines_tab[i].index;
-            return 0;
-        }
-    }
-    return -1;
-}
-
-static void gxf_write_padding(ByteIOContext *pb, int64_t to_pad)
-{
-    for (; to_pad > 0; to_pad--) {
-        put_byte(pb, 0);
-    }
-}
-
-static int64_t updatePacketSize(ByteIOContext *pb, int64_t pos)
-{
-    int64_t curpos;
-    int size;
-
-    size = url_ftell(pb) - pos;
-    if (size % 4) {
-        gxf_write_padding(pb, 4 - size % 4);
-        size = url_ftell(pb) - pos;
-    }
-    curpos = url_ftell(pb);
-    url_fseek(pb, pos + 6, SEEK_SET);
-    put_be32(pb, size);
-    url_fseek(pb, curpos, SEEK_SET);
-    return curpos - pos;
-}
-
-static int64_t updateSize(ByteIOContext *pb, int64_t pos)
-{
-    int64_t curpos;
-
-    curpos = url_ftell(pb);
-    url_fseek(pb, pos, SEEK_SET);
-    put_be16(pb, curpos - pos - 2);
-    url_fseek(pb, curpos, SEEK_SET);
-    return curpos - pos;
-}
-
-static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type)
-{
-    put_be32(pb, 0); /* packet leader for synchro */
-    put_byte(pb, 1);
-    put_byte(pb, type); /* map packet */
-    put_be32(pb, 0); /* size */
-    put_be32(pb, 0); /* reserved */
-    put_byte(pb, 0xE1); /* trailer 1 */
-    put_byte(pb, 0xE2); /* trailer 2 */
-}
-
-static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, AVStream *st)
-{
-    GXFStreamContext *sc = st->priv_data;
-    char buffer[1024];
-    int size, starting_line;
-
-    if (sc->iframes) {
-        sc->p_per_gop = sc->pframes / sc->iframes;
-        if (sc->pframes % sc->iframes)
-            sc->p_per_gop++;
-        if (sc->pframes) {
-            sc->b_per_i_or_p = sc->bframes / sc->pframes;
-            if (sc->bframes % sc->pframes)
-                sc->b_per_i_or_p++;
-        }
-        if (sc->p_per_gop > 9)
-            sc->p_per_gop = 9; /* ensure value won't take more than one char */
-        if (sc->b_per_i_or_p > 9)
-            sc->b_per_i_or_p = 9; /* ensure value won't take more than one char */
-    }
-    if (st->codec->height == 512 || st->codec->height == 608)
-        starting_line = 7; // VBI
-    else if (st->codec->height == 480)
-        starting_line = 20;
-    else
-        starting_line = 23; // default PAL
-
-    size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
-                    "Pix 0\nCf %d\nCg %d\nSl %d\nnl16 %d\nVi 1\nf1 1\n",
-                    (float)st->codec->bit_rate, sc->p_per_gop, sc->b_per_i_or_p,
-                    st->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, sc->first_gop_closed == 1,
-                    starting_line, st->codec->height / 16);
-    put_byte(pb, TRACK_MPG_AUX);
-    put_byte(pb, size + 1);
-    put_buffer(pb, (uint8_t *)buffer, size + 1);
-    return size + 3;
-}
-
-static int gxf_write_timecode_auxiliary(ByteIOContext *pb, GXFStreamContext *sc)
-{
-    put_byte(pb, 0); /* fields */
-    put_byte(pb, 0);  /* seconds */
-    put_byte(pb, 0); /* minutes */
-    put_byte(pb, 0); /* flags + hours */
-    /* reserved */
-    put_be32(pb, 0);
-    return 8;
-}
-
-static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
-{
-    ByteIOContext *pb = s->pb;
-    int64_t pos;
-    int mpeg = sc->track_type == 4 || sc->track_type == 9;
-
-    /* track description section */
-    put_byte(pb, sc->media_type + 0x80);
-    put_byte(pb, index + 0xC0);
-
-    pos = url_ftell(pb);
-    put_be16(pb, 0); /* size */
-
-    /* media file name */
-    put_byte(pb, TRACK_NAME);
-    put_byte(pb, strlen(ES_NAME_PATTERN) + 3);
-    put_tag(pb, ES_NAME_PATTERN);
-    put_be16(pb, sc->media_info);
-    put_byte(pb, 0);
-
-    if (!mpeg) {
-        /* auxiliary information */
-        put_byte(pb, TRACK_AUX);
-        put_byte(pb, 8);
-        if (sc->track_type == 3)
-            gxf_write_timecode_auxiliary(pb, sc);
-        else
-            put_le64(pb, 0);
-    }
-
-    /* file system version */
-    put_byte(pb, TRACK_VER);
-    put_byte(pb, 4);
-    put_be32(pb, 0);
-
-    if (mpeg)
-        gxf_write_mpeg_auxiliary(pb, s->streams[index]);
-
-    /* frame rate */
-    put_byte(pb, TRACK_FPS);
-    put_byte(pb, 4);
-    put_be32(pb, sc->frame_rate_index);
-
-    /* lines per frame */
-    put_byte(pb, TRACK_LINES);
-    put_byte(pb, 4);
-    put_be32(pb, sc->lines_index);
-
-    /* fields per frame */
-    put_byte(pb, TRACK_FPF);
-    put_byte(pb, 4);
-    put_be32(pb, sc->fields);
-
-    return updateSize(pb, pos);
-}
-
-static int gxf_write_material_data_section(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos;
-    const char *filename = strrchr(s->filename, '/');
-
-    pos = url_ftell(pb);
-    put_be16(pb, 0); /* size */
-
-    /* name */
-    if (filename)
-        filename++;
-    else
-        filename = s->filename;
-    put_byte(pb, MAT_NAME);
-    put_byte(pb, strlen(SERVER_PATH) + strlen(filename) + 1);
-    put_tag(pb, SERVER_PATH);
-    put_tag(pb, filename);
-    put_byte(pb, 0);
-
-    /* first field */
-    put_byte(pb, MAT_FIRST_FIELD);
-    put_byte(pb, 4);
-    put_be32(pb, 0);
-
-    /* last field */
-    put_byte(pb, MAT_LAST_FIELD);
-    put_byte(pb, 4);
-    put_be32(pb, gxf->nb_fields);
-
-    /* reserved */
-    put_byte(pb, MAT_MARK_IN);
-    put_byte(pb, 4);
-    put_be32(pb, 0);
-
-    put_byte(pb, MAT_MARK_OUT);
-    put_byte(pb, 4);
-    put_be32(pb, gxf->nb_fields);
-
-    /* estimated size */
-    put_byte(pb, MAT_SIZE);
-    put_byte(pb, 4);
-    put_be32(pb, url_fsize(pb) / 1024);
-
-    return updateSize(pb, pos);
-}
-
-static int gxf_write_track_description_section(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos;
-    int i;
-
-    pos = url_ftell(pb);
-    put_be16(pb, 0); /* size */
-    for (i = 0; i < s->nb_streams; ++i)
-        gxf_write_track_description(s, s->streams[i]->priv_data, i);
-
-    gxf_write_track_description(s, &gxf->timecode_track, s->nb_streams);
-
-    return updateSize(pb, pos);
-}
-
-static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos = url_ftell(pb);
-
-    if (!rewrite) {
-        if (!(gxf->map_offsets_nb % 30)) {
-            gxf->map_offsets = av_realloc(gxf->map_offsets,
-                                          (gxf->map_offsets_nb+30)*sizeof(*gxf->map_offsets));
-            if (!gxf->map_offsets) {
-                av_log(s, AV_LOG_ERROR, "could not realloc map offsets\n");
-                return -1;
-            }
-        }
-        gxf->map_offsets[gxf->map_offsets_nb++] = pos; // do not increment here
-    }
-
-    gxf_write_packet_header(pb, PKT_MAP);
-
-    /* preamble */
-    put_byte(pb, 0xE0); /* version */
-    put_byte(pb, 0xFF); /* reserved */
-
-    gxf_write_material_data_section(s);
-    gxf_write_track_description_section(s);
-
-    return updatePacketSize(pb, pos);
-}
-
-static int gxf_write_flt_packet(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos = url_ftell(pb);
-    int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1;
-    int flt_entries = gxf->nb_fields / fields_per_flt - 1;
-    int i = 0;
-
-    gxf_write_packet_header(pb, PKT_FLT);
-
-    put_le32(pb, fields_per_flt); /* number of fields */
-    put_le32(pb, flt_entries); /* number of active flt entries */
-
-    if (gxf->flt_entries) {
-        for (i = 0; i < flt_entries; i++)
-            put_le32(pb, gxf->flt_entries[(i*fields_per_flt)>>1]);
-    }
-
-    for (; i < 1000; i++)
-        put_le32(pb, 0);
-
-    return updatePacketSize(pb, pos);
-}
-
-static int gxf_write_umf_material_description(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int timecode_base = gxf->time_base.den == 60000 ? 60 : 50;
-
-    // XXX drop frame
-    uint32_t timecode =
-        gxf->nb_fields / (timecode_base * 3600) % 24 << 24 | // hours
-        gxf->nb_fields / (timecode_base * 60) % 60   << 16 | // minutes
-        gxf->nb_fields /  timecode_base % 60         <<  8 | // seconds
-        gxf->nb_fields %  timecode_base;                     // fields
-
-    put_le32(pb, gxf->flags);
-    put_le32(pb, gxf->nb_fields); /* length of the longest track */
-    put_le32(pb, gxf->nb_fields); /* length of the shortest track */
-    put_le32(pb, 0); /* mark in */
-    put_le32(pb, gxf->nb_fields); /* mark out */
-    put_le32(pb, 0); /* timecode mark in */
-    put_le32(pb, timecode); /* timecode mark out */
-    put_le64(pb, s->timestamp); /* modification time */
-    put_le64(pb, s->timestamp); /* creation time */
-    put_le16(pb, 0); /* reserved */
-    put_le16(pb, 0); /* reserved */
-    put_le16(pb, gxf->audio_tracks);
-    put_le16(pb, 1); /* timecode track count */
-    put_le16(pb, 0); /* reserved */
-    put_le16(pb, gxf->mpeg_tracks);
-    return 48;
-}
-
-static int gxf_write_umf_payload(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    put_le32(pb, gxf->umf_length); /* total length of the umf data */
-    put_le32(pb, 3); /* version */
-    put_le32(pb, s->nb_streams+1);
-    put_le32(pb, gxf->umf_track_offset); /* umf track section offset */
-    put_le32(pb, gxf->umf_track_size);
-    put_le32(pb, s->nb_streams+1);
-    put_le32(pb, gxf->umf_media_offset);
-    put_le32(pb, gxf->umf_media_size);
-    put_le32(pb, gxf->umf_length); /* user data offset */
-    put_le32(pb, 0); /* user data size */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    return 48;
-}
-
-static int gxf_write_umf_track_description(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    GXFContext *gxf = s->priv_data;
-    int64_t pos = url_ftell(pb);
-    int i;
-
-    gxf->umf_track_offset = pos - gxf->umf_start_offset;
-    for (i = 0; i < s->nb_streams; ++i) {
-        GXFStreamContext *sc = s->streams[i]->priv_data;
-        put_le16(pb, sc->media_info);
-        put_le16(pb, 1);
-    }
-
-    put_le16(pb, gxf->timecode_track.media_info);
-    put_le16(pb, 1);
-
-    return url_ftell(pb) - pos;
-}
-
-static int gxf_write_umf_media_mpeg(ByteIOContext *pb, AVStream *st)
-{
-    GXFStreamContext *sc = st->priv_data;
-
-    if (st->codec->pix_fmt == PIX_FMT_YUV422P)
-        put_le32(pb, 2);
-    else
-        put_le32(pb, 1); /* default to 420 */
-    put_le32(pb, sc->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */
-    put_le32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */
-    put_le32(pb, 1); /* I picture per GOP */
-    put_le32(pb, sc->p_per_gop);
-    put_le32(pb, sc->b_per_i_or_p);
-    if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO)
-        put_le32(pb, 2);
-    else if (st->codec->codec_id == CODEC_ID_MPEG1VIDEO)
-        put_le32(pb, 1);
-    else
-        put_le32(pb, 0);
-    put_le32(pb, 0); /* reserved */
-    return 32;
-}
-
-static int gxf_write_umf_media_timecode(ByteIOContext *pb, GXFStreamContext *sc)
-{
-    put_le32(pb, 1); /* non drop frame */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    return 32;
-}
-
-static int gxf_write_umf_media_dv(ByteIOContext *pb, GXFStreamContext *sc)
-{
-    int i;
-
-    for (i = 0; i < 8; i++) {
-        put_be32(pb, 0);
-    }
-    return 32;
-}
-
-static int gxf_write_umf_media_audio(ByteIOContext *pb, GXFStreamContext *sc)
-{
-    put_le64(pb, av_dbl2int(1)); /* sound level to begin to */
-    put_le64(pb, av_dbl2int(1)); /* sound level to begin to */
-    put_le32(pb, 0); /* number of fields over which to ramp up sound level */
-    put_le32(pb, 0); /* number of fields over which to ramp down sound level */
-    put_le32(pb, 0); /* reserved */
-    put_le32(pb, 0); /* reserved */
-    return 32;
-}
-
-#if 0
-static int gxf_write_umf_media_mjpeg(ByteIOContext *pb, GXFStreamContext *sc)
-{
-    put_be64(pb, 0); /* FIXME FLOAT max chroma quant level */
-    put_be64(pb, 0); /* FIXME FLOAT max luma quant level */
-    put_be64(pb, 0); /* FIXME FLOAT min chroma quant level */
-    put_be64(pb, 0); /* FIXME FLOAT min luma quant level */
-    return 32;
-}
-#endif
-
-static int gxf_write_umf_media_description(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos;
-    int i, j;
-
-    pos = url_ftell(pb);
-    gxf->umf_media_offset = pos - gxf->umf_start_offset;
-    for (i = 0; i <= s->nb_streams; ++i) {
-        GXFStreamContext *sc;
-        int64_t startpos, curpos;
-
-        if (i == s->nb_streams)
-            sc = &gxf->timecode_track;
-        else
-            sc = s->streams[i]->priv_data;
-
-        startpos = url_ftell(pb);
-        put_le16(pb, 0); /* length */
-        put_le16(pb, sc->media_info);
-        put_le16(pb, 0); /* reserved */
-        put_le16(pb, 0); /* reserved */
-        put_le32(pb, gxf->nb_fields);
-        put_le32(pb, 0); /* attributes rw, ro */
-        put_le32(pb, 0); /* mark in */
-        put_le32(pb, gxf->nb_fields); /* mark out */
-        put_buffer(pb, ES_NAME_PATTERN, sizeof(ES_NAME_PATTERN));
-        put_be16(pb, sc->media_info);
-        for (j = sizeof(ES_NAME_PATTERN)+2; j < 88; j++)
-            put_byte(pb, 0);
-        put_le32(pb, sc->track_type);
-        put_le32(pb, sc->sample_rate);
-        put_le32(pb, sc->sample_size);
-        put_le32(pb, 0); /* reserved */
-
-        if (sc == &gxf->timecode_track)
-            gxf_write_umf_media_timecode(pb, sc); /* 8 0bytes */
-        else {
-            AVStream *st = s->streams[i];
-            switch (st->codec->codec_id) {
-            case CODEC_ID_MPEG2VIDEO:
-                gxf_write_umf_media_mpeg(pb, st);
-                break;
-            case CODEC_ID_PCM_S16LE:
-                gxf_write_umf_media_audio(pb, sc);
-                break;
-            case CODEC_ID_DVVIDEO:
-                gxf_write_umf_media_dv(pb, sc);
-                break;
-            }
-        }
-
-        curpos = url_ftell(pb);
-        url_fseek(pb, startpos, SEEK_SET);
-        put_le16(pb, curpos - startpos);
-        url_fseek(pb, curpos, SEEK_SET);
-    }
-    return url_ftell(pb) - pos;
-}
-
-static int gxf_write_umf_packet(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos = url_ftell(pb);
-
-    gxf_write_packet_header(pb, PKT_UMF);
-
-    /* preamble */
-    put_byte(pb, 3); /* first and last (only) packet */
-    put_be32(pb, gxf->umf_length); /* data length */
-
-    gxf->umf_start_offset = url_ftell(pb);
-    gxf_write_umf_payload(s);
-    gxf_write_umf_material_description(s);
-    gxf->umf_track_size = gxf_write_umf_track_description(s);
-    gxf->umf_media_size = gxf_write_umf_media_description(s);
-    gxf->umf_length = url_ftell(pb) - gxf->umf_start_offset;
-    return updatePacketSize(pb, pos);
-}
-
-static const int GXF_samples_per_frame[] = { 32768, 0 };
-
-static void gxf_init_timecode_track(GXFStreamContext *sc, GXFStreamContext *vsc)
-{
-    if (!vsc)
-        return;
-
-    sc->media_type = vsc->sample_rate == 60 ? 7 : 8;
-    sc->sample_rate = vsc->sample_rate;
-    sc->media_info = ('T'<<8) | '0';
-    sc->track_type = 3;
-    sc->frame_rate_index = vsc->frame_rate_index;
-    sc->lines_index = vsc->lines_index;
-    sc->sample_size = 16;
-    sc->fields = vsc->fields;
-}
-
-static int gxf_write_header(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    GXFContext *gxf = s->priv_data;
-    GXFStreamContext *vsc = NULL;
-    uint8_t tracks[255] = {0};
-    int i, media_info = 0;
-
-    if (url_is_streamed(pb)) {
-        av_log(s, AV_LOG_ERROR, "gxf muxer does not support streamed output, patch welcome");
-        return -1;
-    }
-
-    gxf->flags |= 0x00080000; /* material is simple clip */
-    for (i = 0; i < s->nb_streams; ++i) {
-        AVStream *st = s->streams[i];
-        GXFStreamContext *sc = av_mallocz(sizeof(*sc));
-        if (!sc)
-            return AVERROR(ENOMEM);
-        st->priv_data = sc;
-
-        sc->media_type = ff_codec_get_tag(gxf_media_types, st->codec->codec_id);
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if (st->codec->codec_id != CODEC_ID_PCM_S16LE) {
-                av_log(s, AV_LOG_ERROR, "only 16 BIT PCM LE allowed for now\n");
-                return -1;
-            }
-            if (st->codec->sample_rate != 48000) {
-                av_log(s, AV_LOG_ERROR, "only 48000hz sampling rate is allowed\n");
-                return -1;
-            }
-            if (st->codec->channels != 1) {
-                av_log(s, AV_LOG_ERROR, "only mono tracks are allowed\n");
-                return -1;
-            }
-            sc->track_type = 2;
-            sc->sample_rate = st->codec->sample_rate;
-            av_set_pts_info(st, 64, 1, sc->sample_rate);
-            sc->sample_size = 16;
-            sc->frame_rate_index = -2;
-            sc->lines_index = -2;
-            sc->fields = -2;
-            gxf->audio_tracks++;
-            gxf->flags |= 0x04000000; /* audio is 16 bit pcm */
-            media_info = 'A';
-        } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            if (i != 0) {
-                av_log(s, AV_LOG_ERROR, "video stream must be the first track\n");
-                return -1;
-            }
-            /* FIXME check from time_base ? */
-            if (st->codec->height == 480 || st->codec->height == 512) { /* NTSC or NTSC+VBI */
-                sc->frame_rate_index = 5;
-                sc->sample_rate = 60;
-                gxf->flags |= 0x00000080;
-                gxf->time_base = (AVRational){ 1001, 60000 };
-            } else { /* assume PAL */
-                sc->frame_rate_index = 6;
-                sc->media_type++;
-                sc->sample_rate = 50;
-                gxf->flags |= 0x00000040;
-                gxf->time_base = (AVRational){ 1, 50 };
-            }
-            av_set_pts_info(st, 64, gxf->time_base.num, gxf->time_base.den);
-            if (gxf_find_lines_index(st) < 0)
-                sc->lines_index = -1;
-            sc->sample_size = st->codec->bit_rate;
-            sc->fields = 2; /* interlaced */
-
-            vsc = sc;
-
-            switch (st->codec->codec_id) {
-            case CODEC_ID_MJPEG:
-                sc->track_type = 1;
-                gxf->flags |= 0x00004000;
-                media_info = 'J';
-                break;
-            case CODEC_ID_MPEG1VIDEO:
-                sc->track_type = 9;
-                gxf->mpeg_tracks++;
-                media_info = 'L';
-                break;
-            case CODEC_ID_MPEG2VIDEO:
-                sc->first_gop_closed = -1;
-                sc->track_type = 4;
-                gxf->mpeg_tracks++;
-                gxf->flags |= 0x00008000;
-                media_info = 'M';
-                break;
-            case CODEC_ID_DVVIDEO:
-                if (st->codec->pix_fmt == PIX_FMT_YUV422P) {
-                    sc->media_type += 2;
-                    sc->track_type = 6;
-                    gxf->flags |= 0x00002000;
-                    media_info = 'E';
-                } else {
-                    sc->track_type = 5;
-                    gxf->flags |= 0x00001000;
-                    media_info = 'D';
-                }
-                break;
-            default:
-                av_log(s, AV_LOG_ERROR, "video codec not supported\n");
-                return -1;
-            }
-        }
-        /* FIXME first 10 audio tracks are 0 to 9 next 22 are A to V */
-        sc->media_info = media_info<<8 | ('0'+tracks[media_info]++);
-        sc->order = s->nb_streams - st->index;
-    }
-
-    if (ff_audio_interleave_init(s, GXF_samples_per_frame, (AVRational){ 1, 48000 }) < 0)
-        return -1;
-
-    gxf_init_timecode_track(&gxf->timecode_track, vsc);
-    gxf->flags |= 0x200000; // time code track is non-drop frame
-
-    gxf_write_map_packet(s, 0);
-    gxf_write_flt_packet(s);
-    gxf_write_umf_packet(s);
-
-    gxf->packet_count = 3;
-
-    put_flush_packet(pb);
-    return 0;
-}
-
-static int gxf_write_eos_packet(ByteIOContext *pb)
-{
-    int64_t pos = url_ftell(pb);
-
-    gxf_write_packet_header(pb, PKT_EOS);
-    return updatePacketSize(pb, pos);
-}
-
-static int gxf_write_trailer(AVFormatContext *s)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t end;
-    int i;
-
-    ff_audio_interleave_close(s);
-
-    gxf_write_eos_packet(pb);
-    end = url_ftell(pb);
-    url_fseek(pb, 0, SEEK_SET);
-    /* overwrite map, flt and umf packets with new values */
-    gxf_write_map_packet(s, 1);
-    gxf_write_flt_packet(s);
-    gxf_write_umf_packet(s);
-    put_flush_packet(pb);
-    /* update duration in all map packets */
-    for (i = 1; i < gxf->map_offsets_nb; i++) {
-        url_fseek(pb, gxf->map_offsets[i], SEEK_SET);
-        gxf_write_map_packet(s, 1);
-        put_flush_packet(pb);
-    }
-
-    url_fseek(pb, end, SEEK_SET);
-
-    av_freep(&gxf->flt_entries);
-    av_freep(&gxf->map_offsets);
-
-    return 0;
-}
-
-static int gxf_parse_mpeg_frame(GXFStreamContext *sc, const uint8_t *buf, int size)
-{
-    uint32_t c=-1;
-    int i;
-    for(i=0; i<size-4 && c!=0x100; i++){
-        c = (c<<8) + buf[i];
-        if(c == 0x1B8 && sc->first_gop_closed == -1) /* GOP start code */
-            sc->first_gop_closed= (buf[i+4]>>6)&1;
-    }
-    return (buf[i+1]>>3)&7;
-}
-
-static int gxf_write_media_preamble(AVFormatContext *s, AVPacket *pkt, int size)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st = s->streams[pkt->stream_index];
-    GXFStreamContext *sc = st->priv_data;
-    unsigned field_nb;
-    /* If the video is frame-encoded, the frame numbers shall be represented by
-     * even field numbers.
-     * see SMPTE360M-2004  6.4.2.1.3 Media field number */
-    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        field_nb = gxf->nb_fields;
-    } else {
-        field_nb = av_rescale_rnd(pkt->dts, gxf->time_base.den,
-                                  (int64_t)48000*gxf->time_base.num, AV_ROUND_UP);
-    }
-
-    put_byte(pb, sc->media_type);
-    put_byte(pb, st->index);
-    put_be32(pb, field_nb);
-    if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-        put_be16(pb, 0);
-        put_be16(pb, size / 2);
-    } else if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
-        int frame_type = gxf_parse_mpeg_frame(sc, pkt->data, pkt->size);
-        if (frame_type == FF_I_TYPE) {
-            put_byte(pb, 0x0d);
-            sc->iframes++;
-        } else if (frame_type == FF_B_TYPE) {
-            put_byte(pb, 0x0f);
-            sc->bframes++;
-        } else {
-            put_byte(pb, 0x0e);
-            sc->pframes++;
-        }
-        put_be24(pb, size);
-    } else if (st->codec->codec_id == CODEC_ID_DVVIDEO) {
-        put_byte(pb, size / 4096);
-        put_be24(pb, 0);
-    } else
-        put_be32(pb, size);
-    put_be32(pb, field_nb);
-    put_byte(pb, 1); /* flags */
-    put_byte(pb, 0); /* reserved */
-    return 16;
-}
-
-static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    GXFContext *gxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st = s->streams[pkt->stream_index];
-    int64_t pos = url_ftell(pb);
-    int padding = 0;
-
-    gxf_write_packet_header(pb, PKT_MEDIA);
-    if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */
-        padding = 4 - pkt->size % 4;
-    else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
-        padding = GXF_AUDIO_PACKET_SIZE - pkt->size;
-    gxf_write_media_preamble(s, pkt, pkt->size + padding);
-    put_buffer(pb, pkt->data, pkt->size);
-    gxf_write_padding(pb, padding);
-
-    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        if (!(gxf->flt_entries_nb % 500)) {
-            gxf->flt_entries = av_realloc(gxf->flt_entries,
-                                          (gxf->flt_entries_nb+500)*sizeof(*gxf->flt_entries));
-            if (!gxf->flt_entries) {
-                av_log(s, AV_LOG_ERROR, "could not reallocate flt entries\n");
-                return -1;
-            }
-        }
-        gxf->flt_entries[gxf->flt_entries_nb++] = url_ftell(pb) / 1024;
-        gxf->nb_fields += 2; // count fields
-    }
-
-    updatePacketSize(pb, pos);
-
-    gxf->packet_count++;
-    if (gxf->packet_count == 100) {
-        gxf_write_map_packet(s, 0);
-        gxf->packet_count = 0;
-    }
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static int gxf_compare_field_nb(AVFormatContext *s, AVPacket *next, AVPacket *cur)
-{
-    GXFContext *gxf = s->priv_data;
-    AVPacket *pkt[2] = { cur, next };
-    int i, field_nb[2];
-    GXFStreamContext *sc[2];
-
-    for (i = 0; i < 2; i++) {
-        AVStream *st = s->streams[pkt[i]->stream_index];
-        sc[i] = st->priv_data;
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            field_nb[i] = av_rescale_rnd(pkt[i]->dts, gxf->time_base.den,
-                                         (int64_t)48000*gxf->time_base.num, AV_ROUND_UP);
-            field_nb[i] &= ~1; // compare against even field number because audio must be before video
-        } else
-            field_nb[i] = pkt[i]->dts; // dts are field based
-    }
-
-    return field_nb[1] > field_nb[0] ||
-        (field_nb[1] == field_nb[0] && sc[1]->order > sc[0]->order);
-}
-
-static int gxf_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
-{
-    if (pkt && s->streams[pkt->stream_index]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-        pkt->duration = 2; // enforce 2 fields
-    return ff_audio_rechunk_interleave(s, out, pkt, flush,
-                               av_interleave_packet_per_dts, gxf_compare_field_nb);
-}
-
-AVOutputFormat gxf_muxer = {
-    "gxf",
-    NULL_IF_CONFIG_SMALL("GXF format"),
-    NULL,
-    "gxf",
-    sizeof(GXFContext),
-    CODEC_ID_PCM_S16LE,
-    CODEC_ID_MPEG2VIDEO,
-    gxf_write_header,
-    gxf_write_packet,
-    gxf_write_trailer,
-    0,
-    NULL,
-    gxf_interleave_packet,
-};
diff --git a/libavformat/http.c b/libavformat/http.c
deleted file mode 100644
index e697578..0000000
--- a/libavformat/http.c
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * HTTP protocol for ffmpeg client
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include <unistd.h>
-#include <strings.h>
-#include "internal.h"
-#include "network.h"
-#include "os_support.h"
-#include "httpauth.h"
-
-/* XXX: POST protocol is not completely implemented because ffmpeg uses
-   only a subset of it. */
-
-/* used for protocol handling */
-#define BUFFER_SIZE 1024
-#define URL_SIZE    4096
-#define MAX_REDIRECTS 8
-
-typedef struct {
-    URLContext *hd;
-    unsigned char buffer[BUFFER_SIZE], *buf_ptr, *buf_end;
-    int line_count;
-    int http_code;
-    int64_t chunksize;      /**< Used if "Transfer-Encoding: chunked" otherwise -1. */
-    int64_t off, filesize;
-    char location[URL_SIZE];
-    HTTPAuthState auth_state;
-} HTTPContext;
-
-static int http_connect(URLContext *h, const char *path, const char *hoststr,
-                        const char *auth, int *new_location);
-static int http_write(URLContext *h, uint8_t *buf, int size);
-
-
-/* return non zero if error */
-static int http_open_cnx(URLContext *h)
-{
-    const char *path, *proxy_path;
-    char hostname[1024], hoststr[1024];
-    char auth[1024];
-    char path1[1024];
-    char buf[1024];
-    int port, use_proxy, err, location_changed = 0, redirects = 0;
-    HTTPAuthType cur_auth_type;
-    HTTPContext *s = h->priv_data;
-    URLContext *hd = NULL;
-
-    proxy_path = getenv("http_proxy");
-    use_proxy = (proxy_path != NULL) && !getenv("no_proxy") &&
-        av_strstart(proxy_path, "http://", NULL);
-
-    /* fill the dest addr */
- redo:
-    /* needed in any case to build the host string */
-    ff_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
-                 path1, sizeof(path1), s->location);
-    ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
-
-    if (use_proxy) {
-        ff_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
-                     NULL, 0, proxy_path);
-        path = s->location;
-    } else {
-        if (path1[0] == '\0')
-            path = "/";
-        else
-            path = path1;
-    }
-    if (port < 0)
-        port = 80;
-
-    ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
-    err = url_open(&hd, buf, URL_RDWR);
-    if (err < 0)
-        goto fail;
-
-    s->hd = hd;
-    cur_auth_type = s->auth_state.auth_type;
-    if (http_connect(h, path, hoststr, auth, &location_changed) < 0)
-        goto fail;
-    if (s->http_code == 401) {
-        if (cur_auth_type == HTTP_AUTH_NONE && s->auth_state.auth_type != HTTP_AUTH_NONE) {
-            url_close(hd);
-            goto redo;
-        } else
-            goto fail;
-    }
-    if ((s->http_code == 302 || s->http_code == 303) && location_changed == 1) {
-        /* url moved, get next */
-        url_close(hd);
-        if (redirects++ >= MAX_REDIRECTS)
-            return AVERROR(EIO);
-        location_changed = 0;
-        goto redo;
-    }
-    return 0;
- fail:
-    if (hd)
-        url_close(hd);
-    return AVERROR(EIO);
-}
-
-static int http_open(URLContext *h, const char *uri, int flags)
-{
-    HTTPContext *s;
-    int ret;
-
-    h->is_streamed = 1;
-
-    s = av_malloc(sizeof(HTTPContext));
-    if (!s) {
-        return AVERROR(ENOMEM);
-    }
-    h->priv_data = s;
-    s->filesize = -1;
-    s->chunksize = -1;
-    s->off = 0;
-    memset(&s->auth_state, 0, sizeof(s->auth_state));
-    av_strlcpy(s->location, uri, URL_SIZE);
-
-    ret = http_open_cnx(h);
-    if (ret != 0)
-        av_free (s);
-    return ret;
-}
-static int http_getc(HTTPContext *s)
-{
-    int len;
-    if (s->buf_ptr >= s->buf_end) {
-        len = url_read(s->hd, s->buffer, BUFFER_SIZE);
-        if (len < 0) {
-            return AVERROR(EIO);
-        } else if (len == 0) {
-            return -1;
-        } else {
-            s->buf_ptr = s->buffer;
-            s->buf_end = s->buffer + len;
-        }
-    }
-    return *s->buf_ptr++;
-}
-
-static int http_get_line(HTTPContext *s, char *line, int line_size)
-{
-    int ch;
-    char *q;
-
-    q = line;
-    for(;;) {
-        ch = http_getc(s);
-        if (ch < 0)
-            return AVERROR(EIO);
-        if (ch == '\n') {
-            /* process line */
-            if (q > line && q[-1] == '\r')
-                q--;
-            *q = '\0';
-
-            return 0;
-        } else {
-            if ((q - line) < line_size - 1)
-                *q++ = ch;
-        }
-    }
-}
-
-static int process_line(URLContext *h, char *line, int line_count,
-                        int *new_location)
-{
-    HTTPContext *s = h->priv_data;
-    char *tag, *p;
-
-    /* end of header */
-    if (line[0] == '\0')
-        return 0;
-
-    p = line;
-    if (line_count == 0) {
-        while (!isspace(*p) && *p != '\0')
-            p++;
-        while (isspace(*p))
-            p++;
-        s->http_code = strtol(p, NULL, 10);
-
-        dprintf(NULL, "http_code=%d\n", s->http_code);
-
-        /* error codes are 4xx and 5xx, but regard 401 as a success, so we
-         * don't abort until all headers have been parsed. */
-        if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 401)
-            return -1;
-    } else {
-        while (*p != '\0' && *p != ':')
-            p++;
-        if (*p != ':')
-            return 1;
-
-        *p = '\0';
-        tag = line;
-        p++;
-        while (isspace(*p))
-            p++;
-        if (!strcmp(tag, "Location")) {
-            strcpy(s->location, p);
-            *new_location = 1;
-        } else if (!strcmp (tag, "Content-Length") && s->filesize == -1) {
-            s->filesize = atoll(p);
-        } else if (!strcmp (tag, "Content-Range")) {
-            /* "bytes $from-$to/$document_size" */
-            const char *slash;
-            if (!strncmp (p, "bytes ", 6)) {
-                p += 6;
-                s->off = atoll(p);
-                if ((slash = strchr(p, '/')) && strlen(slash) > 0)
-                    s->filesize = atoll(slash+1);
-            }
-            h->is_streamed = 0; /* we _can_ in fact seek */
-        } else if (!strcmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
-            s->filesize = -1;
-            s->chunksize = 0;
-        } else if (!strcmp (tag, "WWW-Authenticate")) {
-            ff_http_auth_handle_header(&s->auth_state, tag, p);
-        } else if (!strcmp (tag, "Authentication-Info")) {
-            ff_http_auth_handle_header(&s->auth_state, tag, p);
-        }
-    }
-    return 1;
-}
-
-static int http_connect(URLContext *h, const char *path, const char *hoststr,
-                        const char *auth, int *new_location)
-{
-    HTTPContext *s = h->priv_data;
-    int post, err;
-    char line[1024];
-    char *authstr = NULL;
-    int64_t off = s->off;
-
-
-    /* send http header */
-    post = h->flags & URL_WRONLY;
-    authstr = ff_http_auth_create_response(&s->auth_state, auth, path,
-                                        post ? "POST" : "GET");
-    snprintf(s->buffer, sizeof(s->buffer),
-             "%s %s HTTP/1.1\r\n"
-             "User-Agent: %s\r\n"
-             "Accept: */*\r\n"
-             "Range: bytes=%"PRId64"-\r\n"
-             "Host: %s\r\n"
-             "%s"
-             "Connection: close\r\n"
-             "%s"
-             "\r\n",
-             post ? "POST" : "GET",
-             path,
-             LIBAVFORMAT_IDENT,
-             s->off,
-             hoststr,
-             authstr ? authstr : "",
-             post ? "Transfer-Encoding: chunked\r\n" : "");
-
-    av_freep(&authstr);
-    if (http_write(h, s->buffer, strlen(s->buffer)) < 0)
-        return AVERROR(EIO);
-
-    /* init input buffer */
-    s->buf_ptr = s->buffer;
-    s->buf_end = s->buffer;
-    s->line_count = 0;
-    s->off = 0;
-    s->filesize = -1;
-    if (post) {
-        /* always use chunked encoding for upload data */
-        s->chunksize = 0;
-        return 0;
-    }
-
-    /* wait for header */
-    for(;;) {
-        if (http_get_line(s, line, sizeof(line)) < 0)
-            return AVERROR(EIO);
-
-        dprintf(NULL, "header='%s'\n", line);
-
-        err = process_line(h, line, s->line_count, new_location);
-        if (err < 0)
-            return err;
-        if (err == 0)
-            break;
-        s->line_count++;
-    }
-
-    return (off == s->off) ? 0 : -1;
-}
-
-
-static int http_read(URLContext *h, uint8_t *buf, int size)
-{
-    HTTPContext *s = h->priv_data;
-    int len;
-
-    if (s->chunksize >= 0) {
-        if (!s->chunksize) {
-            char line[32];
-
-            for(;;) {
-                do {
-                    if (http_get_line(s, line, sizeof(line)) < 0)
-                        return AVERROR(EIO);
-                } while (!*line);    /* skip CR LF from last chunk */
-
-                s->chunksize = strtoll(line, NULL, 16);
-
-                dprintf(NULL, "Chunked encoding data size: %"PRId64"'\n", s->chunksize);
-
-                if (!s->chunksize)
-                    return 0;
-                break;
-            }
-        }
-        size = FFMIN(size, s->chunksize);
-    }
-    /* read bytes from input buffer first */
-    len = s->buf_end - s->buf_ptr;
-    if (len > 0) {
-        if (len > size)
-            len = size;
-        memcpy(buf, s->buf_ptr, len);
-        s->buf_ptr += len;
-    } else {
-        len = url_read(s->hd, buf, size);
-    }
-    if (len > 0) {
-        s->off += len;
-        if (s->chunksize > 0)
-            s->chunksize -= len;
-    }
-    return len;
-}
-
-/* used only when posting data */
-static int http_write(URLContext *h, uint8_t *buf, int size)
-{
-    char temp[11];  /* 32-bit hex + CRLF + nul */
-    int ret;
-    char crlf[] = "\r\n";
-    HTTPContext *s = h->priv_data;
-
-    if (s->chunksize == -1) {
-        /* headers are sent without any special encoding */
-        return url_write(s->hd, buf, size);
-    }
-
-    /* silently ignore zero-size data since chunk encoding that would
-     * signal EOF */
-    if (size > 0) {
-        /* upload data using chunked encoding */
-        snprintf(temp, sizeof(temp), "%x\r\n", size);
-
-        if ((ret = url_write(s->hd, temp, strlen(temp))) < 0 ||
-            (ret = url_write(s->hd, buf, size)) < 0 ||
-            (ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
-            return ret;
-    }
-    return size;
-}
-
-static int http_close(URLContext *h)
-{
-    int ret = 0;
-    char footer[] = "0\r\n\r\n";
-    HTTPContext *s = h->priv_data;
-
-    /* signal end of chunked encoding if used */
-    if ((h->flags & URL_WRONLY) && s->chunksize != -1) {
-        ret = url_write(s->hd, footer, sizeof(footer) - 1);
-        ret = ret > 0 ? 0 : ret;
-    }
-
-    url_close(s->hd);
-    av_free(s);
-    return ret;
-}
-
-static int64_t http_seek(URLContext *h, int64_t off, int whence)
-{
-    HTTPContext *s = h->priv_data;
-    URLContext *old_hd = s->hd;
-    int64_t old_off = s->off;
-    uint8_t old_buf[BUFFER_SIZE];
-    int old_buf_size;
-
-    if (whence == AVSEEK_SIZE)
-        return s->filesize;
-    else if ((s->filesize == -1 && whence == SEEK_END) || h->is_streamed)
-        return -1;
-
-    /* we save the old context in case the seek fails */
-    old_buf_size = s->buf_end - s->buf_ptr;
-    memcpy(old_buf, s->buf_ptr, old_buf_size);
-    s->hd = NULL;
-    if (whence == SEEK_CUR)
-        off += s->off;
-    else if (whence == SEEK_END)
-        off += s->filesize;
-    s->off = off;
-
-    /* if it fails, continue on old connection */
-    if (http_open_cnx(h) < 0) {
-        memcpy(s->buffer, old_buf, old_buf_size);
-        s->buf_ptr = s->buffer;
-        s->buf_end = s->buffer + old_buf_size;
-        s->hd = old_hd;
-        s->off = old_off;
-        return -1;
-    }
-    url_close(old_hd);
-    return off;
-}
-
-static int
-http_get_file_handle(URLContext *h)
-{
-    HTTPContext *s = h->priv_data;
-    return url_get_file_handle(s->hd);
-}
-
-URLProtocol http_protocol = {
-    "http",
-    http_open,
-    http_read,
-    http_write,
-    http_seek,
-    http_close,
-    .url_get_file_handle = http_get_file_handle,
-};
diff --git a/libavformat/httpauth.c b/libavformat/httpauth.c
deleted file mode 100644
index cef2756..0000000
--- a/libavformat/httpauth.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * HTTP authentication
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "httpauth.h"
-#include "libavutil/base64.h"
-#include "libavutil/avstring.h"
-#include "internal.h"
-#include "libavutil/random_seed.h"
-#include "libavutil/md5.h"
-#include "avformat.h"
-#include <ctype.h>
-
-static void parse_key_value(const char *params,
-                            void (*callback_get_buf)(HTTPAuthState *state,
-                            const char *key, int key_len,
-                            char **dest, int *dest_len), HTTPAuthState *state)
-{
-    const char *ptr = params;
-
-    /* Parse key=value pairs. */
-    for (;;) {
-        const char *key;
-        char *dest = NULL, *dest_end;
-        int key_len, dest_len = 0;
-
-        /* Skip whitespace and potential commas. */
-        while (*ptr && (isspace(*ptr) || *ptr == ','))
-            ptr++;
-        if (!*ptr)
-            break;
-
-        key = ptr;
-
-        if (!(ptr = strchr(key, '=')))
-            break;
-        ptr++;
-        key_len = ptr - key;
-
-        callback_get_buf(state, key, key_len, &dest, &dest_len);
-        dest_end = dest + dest_len - 1;
-
-        if (*ptr == '\"') {
-            ptr++;
-            while (*ptr && *ptr != '\"') {
-                if (*ptr == '\\') {
-                    if (!ptr[1])
-                        break;
-                    if (dest && dest < dest_end)
-                        *dest++ = ptr[1];
-                    ptr += 2;
-                } else {
-                    if (dest && dest < dest_end)
-                        *dest++ = *ptr;
-                    ptr++;
-                }
-            }
-            if (*ptr == '\"')
-                ptr++;
-        } else {
-            for (; *ptr && !(isspace(*ptr) || *ptr == ','); ptr++)
-                if (dest && dest < dest_end)
-                    *dest++ = *ptr;
-        }
-        if (dest)
-            *dest = 0;
-    }
-}
-
-static void handle_basic_params(HTTPAuthState *state, const char *key,
-                                int key_len, char **dest, int *dest_len)
-{
-    if (!strncmp(key, "realm=", key_len)) {
-        *dest     =        state->realm;
-        *dest_len = sizeof(state->realm);
-    }
-}
-
-static void handle_digest_params(HTTPAuthState *state, const char *key,
-                                 int key_len, char **dest, int *dest_len)
-{
-    DigestParams *digest = &state->digest_params;
-
-    if (!strncmp(key, "realm=", key_len)) {
-        *dest     =        state->realm;
-        *dest_len = sizeof(state->realm);
-    } else if (!strncmp(key, "nonce=", key_len)) {
-        *dest     =        digest->nonce;
-        *dest_len = sizeof(digest->nonce);
-    } else if (!strncmp(key, "opaque=", key_len)) {
-        *dest     =        digest->opaque;
-        *dest_len = sizeof(digest->opaque);
-    } else if (!strncmp(key, "algorithm=", key_len)) {
-        *dest     =        digest->algorithm;
-        *dest_len = sizeof(digest->algorithm);
-    } else if (!strncmp(key, "qop=", key_len)) {
-        *dest     =        digest->qop;
-        *dest_len = sizeof(digest->qop);
-    }
-}
-
-static void handle_digest_update(HTTPAuthState *state, const char *key,
-                                 int key_len, char **dest, int *dest_len)
-{
-    DigestParams *digest = &state->digest_params;
-
-    if (!strncmp(key, "nextnonce=", key_len)) {
-        *dest     =        digest->nonce;
-        *dest_len = sizeof(digest->nonce);
-    }
-}
-
-static void choose_qop(char *qop, int size)
-{
-    char *ptr = strstr(qop, "auth");
-    char *end = ptr + strlen("auth");
-
-    if (ptr && (!*end || isspace(*end) || *end == ',') &&
-        (ptr == qop || isspace(ptr[-1]) || ptr[-1] == ',')) {
-        av_strlcpy(qop, "auth", size);
-    } else {
-        qop[0] = 0;
-    }
-}
-
-void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
-                                const char *value)
-{
-    if (!strcmp(key, "WWW-Authenticate")) {
-        const char *p;
-        if (av_stristart(value, "Basic ", &p) &&
-            state->auth_type <= HTTP_AUTH_BASIC) {
-            state->auth_type = HTTP_AUTH_BASIC;
-            state->realm[0] = 0;
-            parse_key_value(p, handle_basic_params, state);
-        } else if (av_stristart(value, "Digest ", &p) &&
-                   state->auth_type <= HTTP_AUTH_DIGEST) {
-            state->auth_type = HTTP_AUTH_DIGEST;
-            memset(&state->digest_params, 0, sizeof(DigestParams));
-            state->realm[0] = 0;
-            parse_key_value(p, handle_digest_params, state);
-            choose_qop(state->digest_params.qop,
-                       sizeof(state->digest_params.qop));
-        }
-    } else if (!strcmp(key, "Authentication-Info")) {
-        parse_key_value(value, handle_digest_update, state);
-    }
-}
-
-
-static void update_md5_strings(struct AVMD5 *md5ctx, ...)
-{
-    va_list vl;
-
-    va_start(vl, md5ctx);
-    while (1) {
-        const char* str = va_arg(vl, const char*);
-        if (!str)
-            break;
-        av_md5_update(md5ctx, str, strlen(str));
-    }
-    va_end(vl);
-}
-
-/* Generate a digest reply, according to RFC 2617. */
-static char *make_digest_auth(HTTPAuthState *state, const char *username,
-                              const char *password, const char *uri,
-                              const char *method)
-{
-    DigestParams *digest = &state->digest_params;
-    int len;
-    uint32_t cnonce_buf[2];
-    char cnonce[17];
-    char nc[9];
-    int i;
-    char A1hash[33], A2hash[33], response[33];
-    struct AVMD5 *md5ctx;
-    uint8_t hash[16];
-    char *authstr;
-
-    digest->nc++;
-    snprintf(nc, sizeof(nc), "%08x", digest->nc);
-
-    /* Generate a client nonce. */
-    for (i = 0; i < 2; i++)
-        cnonce_buf[i] = ff_random_get_seed();
-    ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
-    cnonce[2*sizeof(cnonce_buf)] = 0;
-
-    md5ctx = av_malloc(av_md5_size);
-    if (!md5ctx)
-        return NULL;
-
-    av_md5_init(md5ctx);
-    update_md5_strings(md5ctx, username, ":", state->realm, ":", password, NULL);
-    av_md5_final(md5ctx, hash);
-    ff_data_to_hex(A1hash, hash, 16, 1);
-    A1hash[32] = 0;
-
-    if (!strcmp(digest->algorithm, "") || !strcmp(digest->algorithm, "MD5")) {
-    } else if (!strcmp(digest->algorithm, "MD5-sess")) {
-        av_md5_init(md5ctx);
-        update_md5_strings(md5ctx, A1hash, ":", digest->nonce, ":", cnonce, NULL);
-        av_md5_final(md5ctx, hash);
-        ff_data_to_hex(A1hash, hash, 16, 1);
-        A1hash[32] = 0;
-    } else {
-        /* Unsupported algorithm */
-        av_free(md5ctx);
-        return NULL;
-    }
-
-    av_md5_init(md5ctx);
-    update_md5_strings(md5ctx, method, ":", uri, NULL);
-    av_md5_final(md5ctx, hash);
-    ff_data_to_hex(A2hash, hash, 16, 1);
-    A2hash[32] = 0;
-
-    av_md5_init(md5ctx);
-    update_md5_strings(md5ctx, A1hash, ":", digest->nonce, NULL);
-    if (!strcmp(digest->qop, "auth") || !strcmp(digest->qop, "auth-int")) {
-        update_md5_strings(md5ctx, ":", nc, ":", cnonce, ":", digest->qop, NULL);
-    }
-    update_md5_strings(md5ctx, ":", A2hash, NULL);
-    av_md5_final(md5ctx, hash);
-    ff_data_to_hex(response, hash, 16, 1);
-    response[32] = 0;
-
-    av_free(md5ctx);
-
-    if (!strcmp(digest->qop, "") || !strcmp(digest->qop, "auth")) {
-    } else if (!strcmp(digest->qop, "auth-int")) {
-        /* qop=auth-int not supported */
-        return NULL;
-    } else {
-        /* Unsupported qop value. */
-        return NULL;
-    }
-
-    len = strlen(username) + strlen(state->realm) + strlen(digest->nonce) +
-              strlen(uri) + strlen(response) + strlen(digest->algorithm) +
-              strlen(digest->opaque) + strlen(digest->qop) + strlen(cnonce) +
-              strlen(nc) + 150;
-
-    authstr = av_malloc(len);
-    if (!authstr)
-        return NULL;
-    snprintf(authstr, len, "Authorization: Digest ");
-
-    /* TODO: Escape the quoted strings properly. */
-    av_strlcatf(authstr, len, "username=\"%s\"",   username);
-    av_strlcatf(authstr, len, ",realm=\"%s\"",     state->realm);
-    av_strlcatf(authstr, len, ",nonce=\"%s\"",     digest->nonce);
-    av_strlcatf(authstr, len, ",uri=\"%s\"",       uri);
-    av_strlcatf(authstr, len, ",response=\"%s\"",  response);
-    if (digest->algorithm[0])
-        av_strlcatf(authstr, len, ",algorithm=%s",  digest->algorithm);
-    if (digest->opaque[0])
-        av_strlcatf(authstr, len, ",opaque=\"%s\"", digest->opaque);
-    if (digest->qop[0]) {
-        av_strlcatf(authstr, len, ",qop=\"%s\"",    digest->qop);
-        av_strlcatf(authstr, len, ",cnonce=\"%s\"", cnonce);
-        av_strlcatf(authstr, len, ",nc=%s",         nc);
-    }
-
-    av_strlcatf(authstr, len, "\r\n");
-
-    return authstr;
-}
-
-char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
-                                   const char *path, const char *method)
-{
-    char *authstr = NULL;
-
-    if (!auth || !strchr(auth, ':'))
-        return NULL;
-
-    if (state->auth_type == HTTP_AUTH_BASIC) {
-        int auth_b64_len = (strlen(auth) + 2) / 3 * 4 + 1;
-        int len = auth_b64_len + 30;
-        char *ptr;
-        authstr = av_malloc(len);
-        if (!authstr)
-            return NULL;
-        snprintf(authstr, len, "Authorization: Basic ");
-        ptr = authstr + strlen(authstr);
-        av_base64_encode(ptr, auth_b64_len, auth, strlen(auth));
-        av_strlcat(ptr, "\r\n", len);
-    } else if (state->auth_type == HTTP_AUTH_DIGEST) {
-        char *username = av_strdup(auth), *password;
-
-        if (!username)
-            return NULL;
-
-        if ((password = strchr(username, ':'))) {
-            *password++ = 0;
-            authstr = make_digest_auth(state, username, password, path, method);
-        }
-        av_free(username);
-    }
-    return authstr;
-}
-
diff --git a/libavformat/httpauth.h b/libavformat/httpauth.h
deleted file mode 100644
index ebab3fc..0000000
--- a/libavformat/httpauth.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * HTTP authentication
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_HTTPAUTH_H
-#define AVFORMAT_HTTPAUTH_H
-
-/**
- * Authentication types, ordered from weakest to strongest.
- */
-typedef enum HTTPAuthType {
-    HTTP_AUTH_NONE = 0,    /**< No authentication specified */
-    HTTP_AUTH_BASIC,       /**< HTTP 1.0 Basic auth from RFC 1945
-                             *  (also in RFC 2617) */
-    HTTP_AUTH_DIGEST,      /**< HTTP 1.1 Digest auth from RFC 2617 */
-} HTTPAuthType;
-
-typedef struct {
-    char nonce[300];       /**< Server specified nonce */
-    char algorithm[10];    /**< Server specified digest algorithm */
-    char qop[30];          /**< Quality of protection, containing the one
-                             *  that we've chosen to use, from the
-                             *  alternatives that the server offered. */
-    char opaque[300];      /**< A server-specified string that should be
-                             *  included in authentication responses, not
-                             *  included in the actual digest calculation. */
-    int nc;                /**< Nonce count, the number of earlier replies
-                             *  where this particular nonce has been used. */
-} DigestParams;
-
-/**
- * HTTP Authentication state structure. Must be zero-initialized
- * before used with the functions below.
- */
-typedef struct {
-    /**
-     * The currently chosen auth type.
-     */
-    HTTPAuthType auth_type;
-    /**
-     * Authentication realm
-     */
-    char realm[200];
-    /**
-     * The parameters specifiec to digest authentication.
-     */
-    DigestParams digest_params;
-} HTTPAuthState;
-
-void ff_http_auth_handle_header(HTTPAuthState *state, const char *key,
-                                const char *value);
-char *ff_http_auth_create_response(HTTPAuthState *state, const char *auth,
-                                   const char *path, const char *method);
-
-#endif /* AVFORMAT_HTTPAUTH_H */
diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c
deleted file mode 100644
index c72fca4..0000000
--- a/libavformat/id3v1.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * ID3v1 header parser
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "id3v1.h"
-#include "libavcodec/avcodec.h"
-#include "libavutil/avstring.h"
-
-const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = {
-      [0] = "Blues",
-      [1] = "Classic Rock",
-      [2] = "Country",
-      [3] = "Dance",
-      [4] = "Disco",
-      [5] = "Funk",
-      [6] = "Grunge",
-      [7] = "Hip-Hop",
-      [8] = "Jazz",
-      [9] = "Metal",
-     [10] = "New Age",
-     [11] = "Oldies",
-     [12] = "Other",
-     [13] = "Pop",
-     [14] = "R&B",
-     [15] = "Rap",
-     [16] = "Reggae",
-     [17] = "Rock",
-     [18] = "Techno",
-     [19] = "Industrial",
-     [20] = "Alternative",
-     [21] = "Ska",
-     [22] = "Death Metal",
-     [23] = "Pranks",
-     [24] = "Soundtrack",
-     [25] = "Euro-Techno",
-     [26] = "Ambient",
-     [27] = "Trip-Hop",
-     [28] = "Vocal",
-     [29] = "Jazz+Funk",
-     [30] = "Fusion",
-     [31] = "Trance",
-     [32] = "Classical",
-     [33] = "Instrumental",
-     [34] = "Acid",
-     [35] = "House",
-     [36] = "Game",
-     [37] = "Sound Clip",
-     [38] = "Gospel",
-     [39] = "Noise",
-     [40] = "AlternRock",
-     [41] = "Bass",
-     [42] = "Soul",
-     [43] = "Punk",
-     [44] = "Space",
-     [45] = "Meditative",
-     [46] = "Instrumental Pop",
-     [47] = "Instrumental Rock",
-     [48] = "Ethnic",
-     [49] = "Gothic",
-     [50] = "Darkwave",
-     [51] = "Techno-Industrial",
-     [52] = "Electronic",
-     [53] = "Pop-Folk",
-     [54] = "Eurodance",
-     [55] = "Dream",
-     [56] = "Southern Rock",
-     [57] = "Comedy",
-     [58] = "Cult",
-     [59] = "Gangsta",
-     [60] = "Top 40",
-     [61] = "Christian Rap",
-     [62] = "Pop/Funk",
-     [63] = "Jungle",
-     [64] = "Native American",
-     [65] = "Cabaret",
-     [66] = "New Wave",
-     [67] = "Psychadelic",
-     [68] = "Rave",
-     [69] = "Showtunes",
-     [70] = "Trailer",
-     [71] = "Lo-Fi",
-     [72] = "Tribal",
-     [73] = "Acid Punk",
-     [74] = "Acid Jazz",
-     [75] = "Polka",
-     [76] = "Retro",
-     [77] = "Musical",
-     [78] = "Rock & Roll",
-     [79] = "Hard Rock",
-     [80] = "Folk",
-     [81] = "Folk-Rock",
-     [82] = "National Folk",
-     [83] = "Swing",
-     [84] = "Fast Fusion",
-     [85] = "Bebob",
-     [86] = "Latin",
-     [87] = "Revival",
-     [88] = "Celtic",
-     [89] = "Bluegrass",
-     [90] = "Avantgarde",
-     [91] = "Gothic Rock",
-     [92] = "Progressive Rock",
-     [93] = "Psychedelic Rock",
-     [94] = "Symphonic Rock",
-     [95] = "Slow Rock",
-     [96] = "Big Band",
-     [97] = "Chorus",
-     [98] = "Easy Listening",
-     [99] = "Acoustic",
-    [100] = "Humour",
-    [101] = "Speech",
-    [102] = "Chanson",
-    [103] = "Opera",
-    [104] = "Chamber Music",
-    [105] = "Sonata",
-    [106] = "Symphony",
-    [107] = "Booty Bass",
-    [108] = "Primus",
-    [109] = "Porn Groove",
-    [110] = "Satire",
-    [111] = "Slow Jam",
-    [112] = "Club",
-    [113] = "Tango",
-    [114] = "Samba",
-    [115] = "Folklore",
-    [116] = "Ballad",
-    [117] = "Power Ballad",
-    [118] = "Rhythmic Soul",
-    [119] = "Freestyle",
-    [120] = "Duet",
-    [121] = "Punk Rock",
-    [122] = "Drum Solo",
-    [123] = "A capella",
-    [124] = "Euro-House",
-    [125] = "Dance Hall",
-    [126] = "Goa",
-    [127] = "Drum & Bass",
-    [128] = "Club-House",
-    [129] = "Hardcore",
-    [130] = "Terror",
-    [131] = "Indie",
-    [132] = "BritPop",
-    [133] = "Negerpunk",
-    [134] = "Polsk Punk",
-    [135] = "Beat",
-    [136] = "Christian Gangsta",
-    [137] = "Heavy Metal",
-    [138] = "Black Metal",
-    [139] = "Crossover",
-    [140] = "Contemporary Christian",
-    [141] = "Christian Rock",
-    [142] = "Merengue",
-    [143] = "Salsa",
-    [144] = "Thrash Metal",
-    [145] = "Anime",
-    [146] = "JPop",
-    [147] = "SynthPop",
-};
-
-static void get_string(AVFormatContext *s, const char *key,
-                       const uint8_t *buf, int buf_size)
-{
-    int i, c;
-    char *q, str[512];
-
-    q = str;
-    for(i = 0; i < buf_size; i++) {
-        c = buf[i];
-        if (c == '\0')
-            break;
-        if ((q - str) >= sizeof(str) - 1)
-            break;
-        *q++ = c;
-    }
-    *q = '\0';
-
-    if (*str)
-        av_metadata_set2(&s->metadata, key, str, 0);
-}
-
-/**
- * Parse an ID3v1 tag
- *
- * @param buf ID3v1_TAG_SIZE long buffer containing the tag
- */
-static int parse_tag(AVFormatContext *s, const uint8_t *buf)
-{
-    int genre;
-
-    if (!(buf[0] == 'T' &&
-          buf[1] == 'A' &&
-          buf[2] == 'G'))
-        return -1;
-    get_string(s, "title",   buf +  3, 30);
-    get_string(s, "artist",  buf + 33, 30);
-    get_string(s, "album",   buf + 63, 30);
-    get_string(s, "date",    buf + 93,  4);
-    get_string(s, "comment", buf + 97, 30);
-    if (buf[125] == 0 && buf[126] != 0)
-        av_metadata_set2(&s->metadata, "track", av_d2str(buf[126]), AV_METADATA_DONT_STRDUP_VAL);
-    genre = buf[127];
-    if (genre <= ID3v1_GENRE_MAX)
-        av_metadata_set2(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0);
-    return 0;
-}
-
-void ff_id3v1_read(AVFormatContext *s)
-{
-    int ret, filesize;
-    uint8_t buf[ID3v1_TAG_SIZE];
-
-    if (!url_is_streamed(s->pb)) {
-        /* XXX: change that */
-        filesize = url_fsize(s->pb);
-        if (filesize > 128) {
-            url_fseek(s->pb, filesize - 128, SEEK_SET);
-            ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
-            if (ret == ID3v1_TAG_SIZE) {
-                parse_tag(s, buf);
-            }
-            url_fseek(s->pb, 0, SEEK_SET);
-        }
-    }
-}
diff --git a/libavformat/id3v1.h b/libavformat/id3v1.h
deleted file mode 100644
index 8eb58be..0000000
--- a/libavformat/id3v1.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * ID3v1 header parser
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_ID3V1_H
-#define AVFORMAT_ID3V1_H
-
-#include "avformat.h"
-
-#define ID3v1_TAG_SIZE 128
-
-#define ID3v1_GENRE_MAX 147
-
-/**
- * ID3v1 genres
- */
-extern const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1];
-
-/**
- * Read an ID3v1 tag
- */
-void ff_id3v1_read(AVFormatContext *s);
-
-#endif /* AVFORMAT_ID3V1_H */
-
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
deleted file mode 100644
index 6fa11db..0000000
--- a/libavformat/id3v2.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * ID3v2 header parser
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "id3v2.h"
-#include "id3v1.h"
-#include "libavutil/avstring.h"
-
-int ff_id3v2_match(const uint8_t *buf)
-{
-    return  buf[0]         ==  'I' &&
-            buf[1]         ==  'D' &&
-            buf[2]         ==  '3' &&
-            buf[3]         != 0xff &&
-            buf[4]         != 0xff &&
-           (buf[6] & 0x80) ==    0 &&
-           (buf[7] & 0x80) ==    0 &&
-           (buf[8] & 0x80) ==    0 &&
-           (buf[9] & 0x80) ==    0;
-}
-
-int ff_id3v2_tag_len(const uint8_t * buf)
-{
-    int len = ((buf[6] & 0x7f) << 21) +
-              ((buf[7] & 0x7f) << 14) +
-              ((buf[8] & 0x7f) << 7) +
-               (buf[9] & 0x7f) +
-              ID3v2_HEADER_SIZE;
-    if (buf[5] & 0x10)
-        len += ID3v2_HEADER_SIZE;
-    return len;
-}
-
-void ff_id3v2_read(AVFormatContext *s)
-{
-    int len, ret;
-    uint8_t buf[ID3v2_HEADER_SIZE];
-
-    ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
-    if (ret != ID3v2_HEADER_SIZE)
-        return;
-    if (ff_id3v2_match(buf)) {
-        /* parse ID3v2 header */
-        len = ((buf[6] & 0x7f) << 21) |
-            ((buf[7] & 0x7f) << 14) |
-            ((buf[8] & 0x7f) << 7) |
-            (buf[9] & 0x7f);
-        ff_id3v2_parse(s, len, buf[3], buf[5]);
-    } else {
-        url_fseek(s->pb, 0, SEEK_SET);
-    }
-}
-
-static unsigned int get_size(ByteIOContext *s, int len)
-{
-    int v = 0;
-    while (len--)
-        v = (v << 7) + (get_byte(s) & 0x7F);
-    return v;
-}
-
-static void read_ttag(AVFormatContext *s, int taglen, const char *key)
-{
-    char *q, dst[512];
-    const char *val = NULL;
-    int len, dstlen = sizeof(dst) - 1;
-    unsigned genre;
-    unsigned int (*get)(ByteIOContext*) = get_be16;
-
-    dst[0] = 0;
-    if (taglen < 1)
-        return;
-
-    taglen--; /* account for encoding type byte */
-
-    switch (get_byte(s->pb)) { /* encoding type */
-
-    case 0:  /* ISO-8859-1 (0 - 255 maps directly into unicode) */
-        q = dst;
-        while (taglen-- && q - dst < dstlen - 7) {
-            uint8_t tmp;
-            PUT_UTF8(get_byte(s->pb), tmp, *q++ = tmp;)
-        }
-        *q = 0;
-        break;
-
-    case 1:  /* UTF-16 with BOM */
-        taglen -= 2;
-        switch (get_be16(s->pb)) {
-        case 0xfffe:
-            get = get_le16;
-        case 0xfeff:
-            break;
-        default:
-            av_log(s, AV_LOG_ERROR, "Incorrect BOM value in tag %s.\n", key);
-            return;
-        }
-        // fall-through
-
-    case 2:  /* UTF-16BE without BOM */
-        q = dst;
-        while (taglen > 1 && q - dst < dstlen - 7) {
-            uint32_t ch;
-            uint8_t tmp;
-
-            GET_UTF16(ch, ((taglen -= 2) >= 0 ? get(s->pb) : 0), break;)
-            PUT_UTF8(ch, tmp, *q++ = tmp;)
-        }
-        *q = 0;
-        break;
-
-    case 3:  /* UTF-8 */
-        len = FFMIN(taglen, dstlen);
-        get_buffer(s->pb, dst, len);
-        dst[len] = 0;
-        break;
-    default:
-        av_log(s, AV_LOG_WARNING, "Unknown encoding in tag %s\n.", key);
-    }
-
-    if (!(strcmp(key, "TCON") && strcmp(key, "TCO"))
-        && (sscanf(dst, "(%d)", &genre) == 1 || sscanf(dst, "%d", &genre) == 1)
-        && genre <= ID3v1_GENRE_MAX)
-        val = ff_id3v1_genre_str[genre];
-    else if (!(strcmp(key, "TXXX") && strcmp(key, "TXX"))) {
-        /* dst now contains two 0-terminated strings */
-        dst[dstlen] = 0;
-        len = strlen(dst);
-        key = dst;
-        val = dst + FFMIN(len + 1, dstlen);
-    }
-    else if (*dst)
-        val = dst;
-
-    if (val)
-        av_metadata_set2(&s->metadata, key, val, 0);
-}
-
-void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags)
-{
-    int isv34, tlen;
-    char tag[5];
-    int64_t next;
-    int taghdrlen;
-    const char *reason;
-
-    switch (version) {
-    case 2:
-        if (flags & 0x40) {
-            reason = "compression";
-            goto error;
-        }
-        isv34 = 0;
-        taghdrlen = 6;
-        break;
-
-    case 3:
-    case 4:
-        isv34 = 1;
-        taghdrlen = 10;
-        break;
-
-    default:
-        reason = "version";
-        goto error;
-    }
-
-    if (flags & 0x80) {
-        reason = "unsynchronization";
-        goto error;
-    }
-
-    if (isv34 && flags & 0x40) /* Extended header present, just skip over it */
-        url_fskip(s->pb, get_size(s->pb, 4));
-
-    while (len >= taghdrlen) {
-        if (isv34) {
-            get_buffer(s->pb, tag, 4);
-            tag[4] = 0;
-            if(version==3){
-                tlen = get_be32(s->pb);
-            }else
-                tlen = get_size(s->pb, 4);
-            get_be16(s->pb); /* flags */
-        } else {
-            get_buffer(s->pb, tag, 3);
-            tag[3] = 0;
-            tlen = get_be24(s->pb);
-        }
-        len -= taghdrlen + tlen;
-
-        if (len < 0)
-            break;
-
-        next = url_ftell(s->pb) + tlen;
-
-        if (tag[0] == 'T')
-            read_ttag(s, tlen, tag);
-        else if (!tag[0]) {
-            if (tag[1])
-                av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding");
-            url_fskip(s->pb, len);
-            break;
-        }
-        /* Skip to end of tag */
-        url_fseek(s->pb, next, SEEK_SET);
-    }
-
-    if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
-        url_fskip(s->pb, 10);
-    return;
-
-  error:
-    av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
-    url_fskip(s->pb, len);
-}
-
-const AVMetadataConv ff_id3v2_metadata_conv[] = {
-    { "TALB", "album"},
-    { "TAL",  "album"},
-    { "TCOM", "composer"},
-    { "TCON", "genre"},
-    { "TCO",  "genre"},
-    { "TCOP", "copyright"},
-    { "TDRL", "date"},
-    { "TDRC", "date"},
-    { "TENC", "encoded_by"},
-    { "TEN",  "encoded_by"},
-    { "TIT2", "title"},
-    { "TT2",  "title"},
-    { "TLAN", "language"},
-    { "TPE1", "artist"},
-    { "TP1",  "artist"},
-    { "TPE2", "album_artist"},
-    { "TP2",  "album_artist"},
-    { "TPE3", "performer"},
-    { "TP3",  "performer"},
-    { "TPOS", "disc"},
-    { "TPUB", "publisher"},
-    { "TRCK", "track"},
-    { "TRK",  "track"},
-    { "TSOA", "album-sort"},
-    { "TSOP", "artist-sort"},
-    { "TSOT", "title-sort"},
-    { "TSSE", "encoder"},
-    { 0 }
-};
-
-const char ff_id3v2_tags[][4] = {
-   "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDEN", "TDLY", "TDOR", "TDRC",
-   "TDRL", "TDTG", "TENC", "TEXT", "TFLT", "TIPL", "TIT1", "TIT2", "TIT3",
-   "TKEY", "TLAN", "TLEN", "TMCL", "TMED", "TMOO", "TOAL", "TOFN", "TOLY",
-   "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", "TPE4", "TPOS", "TPRO", "TPUB",
-   "TRCK", "TRSN", "TRSO", "TSOA", "TSOP", "TSOT", "TSRC", "TSSE", "TSST",
-   { 0 },
-};
diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h
deleted file mode 100644
index 70030d2..0000000
--- a/libavformat/id3v2.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * ID3v2 header parser
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_ID3V2_H
-#define AVFORMAT_ID3V2_H
-
-#include <stdint.h>
-#include "avformat.h"
-#include "metadata.h"
-
-#define ID3v2_HEADER_SIZE 10
-
-/**
- * Detects ID3v2 Header.
- * @buf must be ID3v2_HEADER_SIZE byte long
- */
-int ff_id3v2_match(const uint8_t *buf);
-
-/**
- * Gets the length of an ID3v2 tag.
- * @buf must be ID3v2_HEADER_SIZE bytes long and point to the start of an
- * already detected ID3v2 tag
- */
-int ff_id3v2_tag_len(const uint8_t *buf);
-
-/**
- * ID3v2 parser
- * Handles ID3v2.2, 2.3 and 2.4.
- */
-void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags);
-
-/**
- * Read an ID3v2 tag
- */
-void ff_id3v2_read(AVFormatContext *s);
-
-extern const AVMetadataConv ff_id3v2_metadata_conv[];
-
-/**
- * A list of ID3v2.4 text information frames.
- * http://www.id3.org/id3v2.4.0-frames
- */
-extern const char ff_id3v2_tags[][4];
-
-#endif /* AVFORMAT_ID3V2_H */
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
deleted file mode 100644
index cd4ebf8..0000000
--- a/libavformat/idcin.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * id Quake II CIN File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * id Quake II CIN file demuxer by Mike Melanson (melanson at pcisys.net)
- * For more information about the id CIN format, visit:
- *   http://www.csse.monash.edu.au/~timf/
- *
- * CIN is a somewhat quirky and ill-defined format. Here are some notes
- * for anyone trying to understand the technical details of this format:
- *
- * The format has no definite file signature. This is problematic for a
- * general-purpose media player that wants to automatically detect file
- * types. However, a CIN file does start with 5 32-bit numbers that
- * specify audio and video parameters. This demuxer gets around the lack
- * of file signature by performing sanity checks on those parameters.
- * Probabalistically, this is a reasonable solution since the number of
- * valid combinations of the 5 parameters is a very small subset of the
- * total 160-bit number space.
- *
- * Refer to the function idcin_probe() for the precise A/V parameters
- * that this demuxer allows.
- *
- * Next, each audio and video frame has a duration of 1/14 sec. If the
- * audio sample rate is a multiple of the common frequency 22050 Hz it will
- * divide evenly by 14. However, if the sample rate is 11025 Hz:
- *   11025 (samples/sec) / 14 (frames/sec) = 787.5 (samples/frame)
- * The way the CIN stores audio in this case is by storing 787 sample
- * frames in the first audio frame and 788 sample frames in the second
- * audio frame. Therefore, the total number of bytes in an audio frame
- * is given as:
- *   audio frame #0: 787 * (bytes/sample) * (# channels) bytes in frame
- *   audio frame #1: 788 * (bytes/sample) * (# channels) bytes in frame
- *   audio frame #2: 787 * (bytes/sample) * (# channels) bytes in frame
- *   audio frame #3: 788 * (bytes/sample) * (# channels) bytes in frame
- *
- * Finally, not all id CIN creation tools agree on the resolution of the
- * color palette, apparently. Some creation tools specify red, green, and
- * blue palette components in terms of 6-bit VGA color DAC values which
- * range from 0..63. Other tools specify the RGB components as full 8-bit
- * values that range from 0..255. Since there are no markers in the file to
- * differentiate between the two variants, this demuxer uses the following
- * heuristic:
- *   - load the 768 palette bytes from disk
- *   - assume that they will need to be shifted left by 2 bits to
- *     transform them from 6-bit values to 8-bit values
- *   - scan through all 768 palette bytes
- *     - if any bytes exceed 63, do not shift the bytes at all before
- *       transmitting them to the video decoder
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define HUFFMAN_TABLE_SIZE (64 * 1024)
-#define IDCIN_FPS 14
-
-typedef struct IdcinDemuxContext {
-    int video_stream_index;
-    int audio_stream_index;
-    int audio_chunk_size1;
-    int audio_chunk_size2;
-
-    /* demux state variables */
-    int current_audio_chunk;
-    int next_chunk_is_video;
-    int audio_present;
-
-    int64_t pts;
-
-    AVPaletteControl palctrl;
-} IdcinDemuxContext;
-
-static int idcin_probe(AVProbeData *p)
-{
-    unsigned int number;
-
-    /*
-     * This is what you could call a "probabilistic" file check: id CIN
-     * files don't have a definite file signature. In lieu of such a marker,
-     * perform sanity checks on the 5 32-bit header fields:
-     *  width, height: greater than 0, less than or equal to 1024
-     * audio sample rate: greater than or equal to 8000, less than or
-     *  equal to 48000, or 0 for no audio
-     * audio sample width (bytes/sample): 0 for no audio, or 1 or 2
-     * audio channels: 0 for no audio, or 1 or 2
-     */
-
-    /* check we have enough data to do all checks, otherwise the
-       0-padding may cause a wrong recognition */
-    if (p->buf_size < 20)
-        return 0;
-
-    /* check the video width */
-    number = AV_RL32(&p->buf[0]);
-    if ((number == 0) || (number > 1024))
-       return 0;
-
-    /* check the video height */
-    number = AV_RL32(&p->buf[4]);
-    if ((number == 0) || (number > 1024))
-       return 0;
-
-    /* check the audio sample rate */
-    number = AV_RL32(&p->buf[8]);
-    if ((number != 0) && ((number < 8000) | (number > 48000)))
-        return 0;
-
-    /* check the audio bytes/sample */
-    number = AV_RL32(&p->buf[12]);
-    if (number > 2)
-        return 0;
-
-    /* check the audio channels */
-    number = AV_RL32(&p->buf[16]);
-    if (number > 2)
-        return 0;
-
-    /* return half certainly since this check is a bit sketchy */
-    return AVPROBE_SCORE_MAX / 2;
-}
-
-static int idcin_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    IdcinDemuxContext *idcin = s->priv_data;
-    AVStream *st;
-    unsigned int width, height;
-    unsigned int sample_rate, bytes_per_sample, channels;
-
-    /* get the 5 header parameters */
-    width = get_le32(pb);
-    height = get_le32(pb);
-    sample_rate = get_le32(pb);
-    bytes_per_sample = get_le32(pb);
-    channels = get_le32(pb);
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 33, 1, IDCIN_FPS);
-    idcin->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_IDCIN;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = width;
-    st->codec->height = height;
-
-    /* load up the Huffman tables into extradata */
-    st->codec->extradata_size = HUFFMAN_TABLE_SIZE;
-    st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
-    if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
-        HUFFMAN_TABLE_SIZE)
-        return AVERROR(EIO);
-    /* save a reference in order to transport the palette */
-    st->codec->palctrl = &idcin->palctrl;
-
-    /* if sample rate is 0, assume no audio */
-    if (sample_rate) {
-        idcin->audio_present = 1;
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        av_set_pts_info(st, 33, 1, IDCIN_FPS);
-        idcin->audio_stream_index = st->index;
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_tag = 1;
-        st->codec->channels = channels;
-        st->codec->sample_rate = sample_rate;
-        st->codec->bits_per_coded_sample = bytes_per_sample * 8;
-        st->codec->bit_rate = sample_rate * bytes_per_sample * 8 * channels;
-        st->codec->block_align = bytes_per_sample * channels;
-        if (bytes_per_sample == 1)
-            st->codec->codec_id = CODEC_ID_PCM_U8;
-        else
-            st->codec->codec_id = CODEC_ID_PCM_S16LE;
-
-        if (sample_rate % 14 != 0) {
-            idcin->audio_chunk_size1 = (sample_rate / 14) *
-            bytes_per_sample * channels;
-            idcin->audio_chunk_size2 = (sample_rate / 14 + 1) *
-                bytes_per_sample * channels;
-        } else {
-            idcin->audio_chunk_size1 = idcin->audio_chunk_size2 =
-                (sample_rate / 14) * bytes_per_sample * channels;
-        }
-        idcin->current_audio_chunk = 0;
-    } else
-        idcin->audio_present = 1;
-
-    idcin->next_chunk_is_video = 1;
-    idcin->pts = 0;
-
-    return 0;
-}
-
-static int idcin_read_packet(AVFormatContext *s,
-                             AVPacket *pkt)
-{
-    int ret;
-    unsigned int command;
-    unsigned int chunk_size;
-    IdcinDemuxContext *idcin = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int i;
-    int palette_scale;
-    unsigned char r, g, b;
-    unsigned char palette_buffer[768];
-
-    if (url_feof(s->pb))
-        return AVERROR(EIO);
-
-    if (idcin->next_chunk_is_video) {
-        command = get_le32(pb);
-        if (command == 2) {
-            return AVERROR(EIO);
-        } else if (command == 1) {
-            /* trigger a palette change */
-            idcin->palctrl.palette_changed = 1;
-            if (get_buffer(pb, palette_buffer, 768) != 768)
-                return AVERROR(EIO);
-            /* scale the palette as necessary */
-            palette_scale = 2;
-            for (i = 0; i < 768; i++)
-                if (palette_buffer[i] > 63) {
-                    palette_scale = 0;
-                    break;
-                }
-
-            for (i = 0; i < 256; i++) {
-                r = palette_buffer[i * 3    ] << palette_scale;
-                g = palette_buffer[i * 3 + 1] << palette_scale;
-                b = palette_buffer[i * 3 + 2] << palette_scale;
-                idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b);
-            }
-        }
-
-        chunk_size = get_le32(pb);
-        /* skip the number of decoded bytes (always equal to width * height) */
-        url_fseek(pb, 4, SEEK_CUR);
-        chunk_size -= 4;
-        ret= av_get_packet(pb, pkt, chunk_size);
-        if (ret < 0)
-            return ret;
-        pkt->stream_index = idcin->video_stream_index;
-        pkt->pts = idcin->pts;
-    } else {
-        /* send out the audio chunk */
-        if (idcin->current_audio_chunk)
-            chunk_size = idcin->audio_chunk_size2;
-        else
-            chunk_size = idcin->audio_chunk_size1;
-        ret= av_get_packet(pb, pkt, chunk_size);
-        if (ret < 0)
-            return ret;
-        pkt->stream_index = idcin->audio_stream_index;
-        pkt->pts = idcin->pts;
-
-        idcin->current_audio_chunk ^= 1;
-        idcin->pts++;
-    }
-
-    if (idcin->audio_present)
-        idcin->next_chunk_is_video ^= 1;
-
-    return ret;
-}
-
-AVInputFormat idcin_demuxer = {
-    "idcin",
-    NULL_IF_CONFIG_SMALL("id Cinematic format"),
-    sizeof(IdcinDemuxContext),
-    idcin_probe,
-    idcin_read_header,
-    idcin_read_packet,
-};
diff --git a/libavformat/idroq.c b/libavformat/idroq.c
deleted file mode 100644
index 6b036d9..0000000
--- a/libavformat/idroq.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * id RoQ (.roq) File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * id RoQ format file demuxer
- * by Mike Melanson (melanson at pcisys.net)
- * for more information on the .roq file format, visit:
- *   http://www.csse.monash.edu.au/~timf/
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define RoQ_MAGIC_NUMBER 0x1084
-#define RoQ_CHUNK_PREAMBLE_SIZE 8
-#define RoQ_AUDIO_SAMPLE_RATE 22050
-#define RoQ_CHUNKS_TO_SCAN 30
-
-#define RoQ_INFO           0x1001
-#define RoQ_QUAD_CODEBOOK  0x1002
-#define RoQ_QUAD_VQ        0x1011
-#define RoQ_SOUND_MONO     0x1020
-#define RoQ_SOUND_STEREO   0x1021
-
-typedef struct RoqDemuxContext {
-
-    int width;
-    int height;
-    int audio_channels;
-
-    int video_stream_index;
-    int audio_stream_index;
-
-    int64_t video_pts;
-    unsigned int audio_frame_count;
-
-} RoqDemuxContext;
-
-static int roq_probe(AVProbeData *p)
-{
-    if ((AV_RL16(&p->buf[0]) != RoQ_MAGIC_NUMBER) ||
-        (AV_RL32(&p->buf[2]) != 0xFFFFFFFF))
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int roq_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    RoqDemuxContext *roq = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int framerate;
-    AVStream *st;
-    unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
-
-    /* get the main header */
-    if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
-        RoQ_CHUNK_PREAMBLE_SIZE)
-        return AVERROR(EIO);
-    framerate = AV_RL16(&preamble[6]);
-
-    /* init private context parameters */
-    roq->width = roq->height = roq->audio_channels = roq->video_pts =
-    roq->audio_frame_count = 0;
-    roq->audio_stream_index = -1;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 63, 1, framerate);
-    roq->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_ROQ;
-    st->codec->codec_tag = 0;  /* no fourcc */
-
-    return 0;
-}
-
-static int roq_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    RoqDemuxContext *roq = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret = 0;
-    unsigned int chunk_size;
-    unsigned int chunk_type;
-    unsigned int codebook_size;
-    unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
-    int packet_read = 0;
-    int64_t codebook_offset;
-
-    while (!packet_read) {
-
-        if (url_feof(s->pb))
-            return AVERROR(EIO);
-
-        /* get the next chunk preamble */
-        if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
-            RoQ_CHUNK_PREAMBLE_SIZE)
-            return AVERROR(EIO);
-
-        chunk_type = AV_RL16(&preamble[0]);
-        chunk_size = AV_RL32(&preamble[2]);
-        if(chunk_size > INT_MAX)
-            return AVERROR_INVALIDDATA;
-
-        switch (chunk_type) {
-
-        case RoQ_INFO:
-            if (!roq->width || !roq->height) {
-                AVStream *st = s->streams[roq->video_stream_index];
-                if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
-                    return AVERROR(EIO);
-                st->codec->width  = roq->width  = AV_RL16(preamble);
-                st->codec->height = roq->height = AV_RL16(preamble + 2);
-                break;
-            }
-            /* don't care about this chunk anymore */
-            url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR);
-            break;
-
-        case RoQ_QUAD_CODEBOOK:
-            /* packet needs to contain both this codebook and next VQ chunk */
-            codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
-            codebook_size = chunk_size;
-            url_fseek(pb, codebook_size, SEEK_CUR);
-            if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
-                RoQ_CHUNK_PREAMBLE_SIZE)
-                return AVERROR(EIO);
-            chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
-                codebook_size;
-
-            /* rewind */
-            url_fseek(pb, codebook_offset, SEEK_SET);
-
-            /* load up the packet */
-            ret= av_get_packet(pb, pkt, chunk_size);
-            if (ret != chunk_size)
-                return AVERROR(EIO);
-            pkt->stream_index = roq->video_stream_index;
-            pkt->pts = roq->video_pts++;
-
-            packet_read = 1;
-            break;
-
-        case RoQ_SOUND_MONO:
-        case RoQ_SOUND_STEREO:
-            if (roq->audio_stream_index == -1) {
-                AVStream *st = av_new_stream(s, 1);
-                if (!st)
-                    return AVERROR(ENOMEM);
-                av_set_pts_info(st, 32, 1, RoQ_AUDIO_SAMPLE_RATE);
-                roq->audio_stream_index = st->index;
-                st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-                st->codec->codec_id = CODEC_ID_ROQ_DPCM;
-                st->codec->codec_tag = 0;  /* no tag */
-                st->codec->channels = roq->audio_channels = chunk_type == RoQ_SOUND_STEREO ? 2 : 1;
-                st->codec->sample_rate = RoQ_AUDIO_SAMPLE_RATE;
-                st->codec->bits_per_coded_sample = 16;
-                st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-                    st->codec->bits_per_coded_sample;
-                st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-            }
-        case RoQ_QUAD_VQ:
-            /* load up the packet */
-            if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
-                return AVERROR(EIO);
-            /* copy over preamble */
-            memcpy(pkt->data, preamble, RoQ_CHUNK_PREAMBLE_SIZE);
-
-            if (chunk_type == RoQ_QUAD_VQ) {
-                pkt->stream_index = roq->video_stream_index;
-                pkt->pts = roq->video_pts++;
-            } else {
-                pkt->stream_index = roq->audio_stream_index;
-                pkt->pts = roq->audio_frame_count;
-                roq->audio_frame_count += (chunk_size / roq->audio_channels);
-            }
-
-            pkt->pos= url_ftell(pb);
-            ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
-                chunk_size);
-            if (ret != chunk_size)
-                ret = AVERROR(EIO);
-
-            packet_read = 1;
-            break;
-
-        default:
-            av_log(s, AV_LOG_ERROR, "  unknown RoQ chunk (%04X)\n", chunk_type);
-            return AVERROR_INVALIDDATA;
-            break;
-        }
-    }
-
-    return ret;
-}
-
-AVInputFormat roq_demuxer = {
-    "RoQ",
-    NULL_IF_CONFIG_SMALL("id RoQ format"),
-    sizeof(RoqDemuxContext),
-    roq_probe,
-    roq_read_header,
-    roq_read_packet,
-};
diff --git a/libavformat/iff.c b/libavformat/iff.c
deleted file mode 100644
index db74b8d..0000000
--- a/libavformat/iff.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * IFF (.iff) file demuxer
- * Copyright (c) 2008 Jaikrishnan Menon <realityman at gmx.net>
- * Copyright (c) 2010 Peter Ross <pross at xvid.org>
- * Copyright (c) 2010 Sebastian Vater <cdgs.basty at googlemail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * IFF file demuxer
- * by Jaikrishnan Menon
- * for more information on the .iff file format, visit:
- * http://wiki.multimedia.cx/index.php?title=IFF
- */
-
-#include "libavutil/intreadwrite.h"
-#include "libavcodec/iff.h"
-#include "avformat.h"
-
-#define ID_8SVX       MKTAG('8','S','V','X')
-#define ID_VHDR       MKTAG('V','H','D','R')
-#define ID_ATAK       MKTAG('A','T','A','K')
-#define ID_RLSE       MKTAG('R','L','S','E')
-#define ID_CHAN       MKTAG('C','H','A','N')
-#define ID_PBM        MKTAG('P','B','M',' ')
-#define ID_ILBM       MKTAG('I','L','B','M')
-#define ID_BMHD       MKTAG('B','M','H','D')
-#define ID_CMAP       MKTAG('C','M','A','P')
-
-#define ID_FORM       MKTAG('F','O','R','M')
-#define ID_ANNO       MKTAG('A','N','N','O')
-#define ID_AUTH       MKTAG('A','U','T','H')
-#define ID_CHRS       MKTAG('C','H','R','S')
-#define ID_COPYRIGHT  MKTAG('(','c',')',' ')
-#define ID_CSET       MKTAG('C','S','E','T')
-#define ID_FVER       MKTAG('F','V','E','R')
-#define ID_NAME       MKTAG('N','A','M','E')
-#define ID_TEXT       MKTAG('T','E','X','T')
-#define ID_BODY       MKTAG('B','O','D','Y')
-#define ID_ANNO       MKTAG('A','N','N','O')
-
-#define LEFT    2
-#define RIGHT   4
-#define STEREO  6
-
-#define PACKET_SIZE 1024
-
-typedef enum {
-    COMP_NONE,
-    COMP_FIB,
-    COMP_EXP
-} svx8_compression_type;
-
-typedef enum {
-    BITMAP_RAW,
-    BITMAP_BYTERUN1
-} bitmap_compression_type;
-
-typedef struct {
-    uint64_t  body_pos;
-    uint32_t  body_size;
-    uint32_t  sent_bytes;
-    uint32_t  audio_frame_count;
-} IffDemuxContext;
-
-
-static void interleave_stereo(const uint8_t *src, uint8_t *dest, int size)
-{
-    uint8_t *end = dest + size;
-    size = size>>1;
-
-    while(dest < end) {
-        *dest++ = *src;
-        *dest++ = *(src+size);
-        src++;
-    }
-}
-
-static int iff_probe(AVProbeData *p)
-{
-    const uint8_t *d = p->buf;
-
-    if ( AV_RL32(d)   == ID_FORM &&
-         (AV_RL32(d+8) == ID_8SVX || AV_RL32(d+8) == ID_PBM || AV_RL32(d+8) == ID_ILBM) )
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static int iff_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    IffDemuxContext *iff = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    uint32_t chunk_id, data_size;
-    int compression = -1;
-    char *buf;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->channels = 1;
-    url_fskip(pb, 8);
-    // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
-    st->codec->codec_tag = get_le32(pb);
-
-    while(!url_feof(pb)) {
-        uint64_t orig_pos;
-        chunk_id = get_le32(pb);
-        data_size = get_be32(pb);
-        orig_pos = url_ftell(pb);
-
-        switch(chunk_id) {
-        case ID_VHDR:
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-
-            if (data_size < 14)
-                return AVERROR_INVALIDDATA;
-            url_fskip(pb, 12);
-            st->codec->sample_rate = get_be16(pb);
-            if (data_size >= 16) {
-                url_fskip(pb, 1);
-                compression        = get_byte(pb);
-            }
-            break;
-
-        case ID_BODY:
-            iff->body_pos = url_ftell(pb);
-            iff->body_size = data_size;
-            break;
-
-        case ID_CHAN:
-            if (data_size < 4)
-                return AVERROR_INVALIDDATA;
-            st->codec->channels = (get_be32(pb) < 6) ? 1 : 2;
-            break;
-
-        case ID_CMAP:
-            st->codec->extradata_size = data_size;
-            st->codec->extradata      = av_malloc(data_size);
-            if (!st->codec->extradata)
-                return AVERROR(ENOMEM);
-            if (get_buffer(pb, st->codec->extradata, data_size) < 0)
-                return AVERROR(EIO);
-            break;
-
-        case ID_BMHD:
-            st->codec->codec_type            = AVMEDIA_TYPE_VIDEO;
-            if (data_size <= 8)
-                return AVERROR_INVALIDDATA;
-            st->codec->width                 = get_be16(pb);
-            st->codec->height                = get_be16(pb);
-            url_fskip(pb, 4); // x, y offset
-            st->codec->bits_per_coded_sample = get_byte(pb);
-            if (data_size >= 11) {
-                url_fskip(pb, 1); // masking
-                compression                  = get_byte(pb);
-            }
-            if (data_size >= 16) {
-                url_fskip(pb, 3); // paddding, transparent
-                st->sample_aspect_ratio.num  = get_byte(pb);
-                st->sample_aspect_ratio.den  = get_byte(pb);
-            }
-            break;
-
-        case ID_ANNO:
-            buf = av_malloc(data_size + 1);
-            if (!buf)
-                break;
-            get_buffer(pb, buf, data_size);
-            buf[data_size] = 0;
-            av_metadata_set2(&s->metadata, "comment", buf, AV_METADATA_DONT_STRDUP_VAL);
-            break;
-        }
-
-        url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1));
-    }
-
-    url_fseek(pb, iff->body_pos, SEEK_SET);
-
-    switch(st->codec->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        av_set_pts_info(st, 32, 1, st->codec->sample_rate);
-
-        switch(compression) {
-        case COMP_NONE:
-            st->codec->codec_id = CODEC_ID_PCM_S8;
-            break;
-        case COMP_FIB:
-            st->codec->codec_id = CODEC_ID_8SVX_FIB;
-            break;
-        case COMP_EXP:
-            st->codec->codec_id = CODEC_ID_8SVX_EXP;
-            break;
-        default:
-            av_log(s, AV_LOG_ERROR, "iff: unknown compression method\n");
-            return -1;
-        }
-
-        st->codec->bits_per_coded_sample = 8;
-        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * st->codec->bits_per_coded_sample;
-        st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-        break;
-
-    case AVMEDIA_TYPE_VIDEO:
-        switch (compression) {
-        case BITMAP_RAW:
-            if (st->codec->codec_tag == ID_ILBM) {
-                st->codec->codec_id = CODEC_ID_IFF_ILBM;
-            } else {
-                st->codec->codec_id = CODEC_ID_RAWVIDEO;
-                st->codec->pix_fmt  = PIX_FMT_PAL8;
-                st->codec->codec_tag = 0;
-            }
-            break;
-        case BITMAP_BYTERUN1:
-            st->codec->codec_id = CODEC_ID_IFF_BYTERUN1;
-            break;
-        default:
-            av_log(s, AV_LOG_ERROR, "unknown compression method\n");
-            return AVERROR_INVALIDDATA;
-        }
-        break;
-    default:
-        return -1;
-    }
-
-    return 0;
-}
-
-static int iff_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    IffDemuxContext *iff = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st = s->streams[0];
-    int ret;
-
-    if(iff->sent_bytes >= iff->body_size)
-        return AVERROR(EIO);
-
-    if(s->streams[0]->codec->channels == 2) {
-        uint8_t sample_buffer[PACKET_SIZE];
-
-        ret = get_buffer(pb, sample_buffer, PACKET_SIZE);
-        if(av_new_packet(pkt, PACKET_SIZE) < 0) {
-            av_log(s, AV_LOG_ERROR, "iff: cannot allocate packet \n");
-            return AVERROR(ENOMEM);
-        }
-        interleave_stereo(sample_buffer, pkt->data, PACKET_SIZE);
-    } else if (s->streams[0]->codec->codec_id == CODEC_ID_RAWVIDEO) {
-        if(av_new_packet(pkt, iff->body_size + AVPALETTE_SIZE) < 0) {
-            return AVERROR(ENOMEM);
-        }
-
-        ret = ff_cmap_read_palette(st->codec, (uint32_t*)(pkt->data + iff->body_size));
-        if (ret < 0)
-            return ret;
-        av_freep(&st->codec->extradata);
-        st->codec->extradata_size = 0;
-
-        ret = get_buffer(pb, pkt->data, iff->body_size);
-    } else if (s->streams[0]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        ret = av_get_packet(pb, pkt, iff->body_size);
-    } else {
-        ret = av_get_packet(pb, pkt, PACKET_SIZE);
-    }
-
-    if(iff->sent_bytes == 0)
-        pkt->flags |= AV_PKT_FLAG_KEY;
-
-    if(s->streams[0]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-        iff->sent_bytes += PACKET_SIZE;
-    } else {
-        iff->sent_bytes = iff->body_size;
-    }
-    pkt->stream_index = 0;
-    if(s->streams[0]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-        pkt->pts = iff->audio_frame_count;
-        iff->audio_frame_count += ret / s->streams[0]->codec->channels;
-    }
-    return ret;
-}
-
-AVInputFormat iff_demuxer = {
-    "IFF",
-    NULL_IF_CONFIG_SMALL("IFF format"),
-    sizeof(IffDemuxContext),
-    iff_probe,
-    iff_read_header,
-    iff_read_packet,
-};
diff --git a/libavformat/img2.c b/libavformat/img2.c
deleted file mode 100644
index 85bee97..0000000
--- a/libavformat/img2.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Image format
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * Copyright (c) 2004 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include <strings.h>
-
-typedef struct {
-    int img_first;
-    int img_last;
-    int img_number;
-    int img_count;
-    int is_pipe;
-    char path[1024];
-} VideoData;
-
-typedef struct {
-    enum CodecID id;
-    const char *str;
-} IdStrMap;
-
-static const IdStrMap img_tags[] = {
-    { CODEC_ID_MJPEG     , "jpeg"},
-    { CODEC_ID_MJPEG     , "jpg"},
-    { CODEC_ID_LJPEG     , "ljpg"},
-    { CODEC_ID_PNG       , "png"},
-    { CODEC_ID_PNG       , "mng"},
-    { CODEC_ID_PPM       , "ppm"},
-    { CODEC_ID_PPM       , "pnm"},
-    { CODEC_ID_PGM       , "pgm"},
-    { CODEC_ID_PGMYUV    , "pgmyuv"},
-    { CODEC_ID_PBM       , "pbm"},
-    { CODEC_ID_PAM       , "pam"},
-    { CODEC_ID_MPEG1VIDEO, "mpg1-img"},
-    { CODEC_ID_MPEG2VIDEO, "mpg2-img"},
-    { CODEC_ID_MPEG4     , "mpg4-img"},
-    { CODEC_ID_FFV1      , "ffv1-img"},
-    { CODEC_ID_RAWVIDEO  , "y"},
-    { CODEC_ID_BMP       , "bmp"},
-    { CODEC_ID_GIF       , "gif"},
-    { CODEC_ID_TARGA     , "tga"},
-    { CODEC_ID_TIFF      , "tiff"},
-    { CODEC_ID_TIFF      , "tif"},
-    { CODEC_ID_SGI       , "sgi"},
-    { CODEC_ID_PTX       , "ptx"},
-    { CODEC_ID_PCX       , "pcx"},
-    { CODEC_ID_SUNRAST   , "sun"},
-    { CODEC_ID_SUNRAST   , "ras"},
-    { CODEC_ID_SUNRAST   , "rs"},
-    { CODEC_ID_SUNRAST   , "im1"},
-    { CODEC_ID_SUNRAST   , "im8"},
-    { CODEC_ID_SUNRAST   , "im24"},
-    { CODEC_ID_SUNRAST   , "sunras"},
-    { CODEC_ID_JPEG2000  , "jp2"},
-    { CODEC_ID_DPX       , "dpx"},
-    { CODEC_ID_NONE      , NULL}
-};
-
-static const int sizes[][2] = {
-    { 640, 480 },
-    { 720, 480 },
-    { 720, 576 },
-    { 352, 288 },
-    { 352, 240 },
-    { 160, 128 },
-    { 512, 384 },
-    { 640, 352 },
-    { 640, 240 },
-};
-
-static int infer_size(int *width_ptr, int *height_ptr, int size)
-{
-    int i;
-
-    for(i=0;i<FF_ARRAY_ELEMS(sizes);i++) {
-        if ((sizes[i][0] * sizes[i][1]) == size) {
-            *width_ptr = sizes[i][0];
-            *height_ptr = sizes[i][1];
-            return 0;
-        }
-    }
-    return -1;
-}
-static enum CodecID av_str2id(const IdStrMap *tags, const char *str)
-{
-    str= strrchr(str, '.');
-    if(!str) return CODEC_ID_NONE;
-    str++;
-
-    while (tags->id) {
-        if (!strcasecmp(str, tags->str))
-            return tags->id;
-
-        tags++;
-    }
-    return CODEC_ID_NONE;
-}
-
-/* return -1 if no image found */
-static int find_image_range(int *pfirst_index, int *plast_index,
-                            const char *path)
-{
-    char buf[1024];
-    int range, last_index, range1, first_index;
-
-    /* find the first image */
-    for(first_index = 0; first_index < 5; first_index++) {
-        if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
-            *pfirst_index =
-            *plast_index = 1;
-            if(url_exist(buf))
-                return 0;
-            return -1;
-        }
-        if (url_exist(buf))
-            break;
-    }
-    if (first_index == 5)
-        goto fail;
-
-    /* find the last image */
-    last_index = first_index;
-    for(;;) {
-        range = 0;
-        for(;;) {
-            if (!range)
-                range1 = 1;
-            else
-                range1 = 2 * range;
-            if (av_get_frame_filename(buf, sizeof(buf), path,
-                                      last_index + range1) < 0)
-                goto fail;
-            if (!url_exist(buf))
-                break;
-            range = range1;
-            /* just in case... */
-            if (range >= (1 << 30))
-                goto fail;
-        }
-        /* we are sure than image last_index + range exists */
-        if (!range)
-            break;
-        last_index += range;
-    }
-    *pfirst_index = first_index;
-    *plast_index = last_index;
-    return 0;
- fail:
-    return -1;
-}
-
-
-static int image_probe(AVProbeData *p)
-{
-    if (p->filename && av_str2id(img_tags, p->filename)) {
-        if (av_filename_number_test(p->filename))
-            return AVPROBE_SCORE_MAX;
-        else
-            return AVPROBE_SCORE_MAX/2;
-    }
-    return 0;
-}
-
-enum CodecID av_guess_image2_codec(const char *filename){
-    return av_str2id(img_tags, filename);
-}
-
-static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    VideoData *s = s1->priv_data;
-    int first_index, last_index;
-    AVStream *st;
-
-    s1->ctx_flags |= AVFMTCTX_NOHEADER;
-
-    st = av_new_stream(s1, 0);
-    if (!st) {
-        return AVERROR(ENOMEM);
-    }
-
-    av_strlcpy(s->path, s1->filename, sizeof(s->path));
-    s->img_number = 0;
-    s->img_count = 0;
-
-    /* find format */
-    if (s1->iformat->flags & AVFMT_NOFILE)
-        s->is_pipe = 0;
-    else{
-        s->is_pipe = 1;
-        st->need_parsing = AVSTREAM_PARSE_FULL;
-    }
-
-    if (!ap->time_base.num) {
-        av_set_pts_info(st, 60, 1, 25);
-    } else {
-        av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
-    }
-
-    if(ap->width && ap->height){
-        st->codec->width = ap->width;
-        st->codec->height= ap->height;
-    }
-
-    if (!s->is_pipe) {
-        if (find_image_range(&first_index, &last_index, s->path) < 0)
-            return AVERROR(ENOENT);
-        s->img_first = first_index;
-        s->img_last = last_index;
-        s->img_number = first_index;
-        /* compute duration */
-        st->start_time = 0;
-        st->duration = last_index - first_index + 1;
-    }
-
-    if(s1->video_codec_id){
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        st->codec->codec_id = s1->video_codec_id;
-    }else if(s1->audio_codec_id){
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = s1->audio_codec_id;
-    }else{
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        st->codec->codec_id = av_str2id(img_tags, s->path);
-    }
-    if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE)
-        st->codec->pix_fmt = ap->pix_fmt;
-
-    return 0;
-}
-
-static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    VideoData *s = s1->priv_data;
-    char filename[1024];
-    int i;
-    int size[3]={0}, ret[3]={0};
-    ByteIOContext *f[3];
-    AVCodecContext *codec= s1->streams[0]->codec;
-
-    if (!s->is_pipe) {
-        /* loop over input */
-        if (s1->loop_input && s->img_number > s->img_last) {
-            s->img_number = s->img_first;
-        }
-        if (s->img_number > s->img_last)
-            return AVERROR_EOF;
-        if (av_get_frame_filename(filename, sizeof(filename),
-                                  s->path, s->img_number)<0 && s->img_number > 1)
-            return AVERROR(EIO);
-        for(i=0; i<3; i++){
-            if (url_fopen(&f[i], filename, URL_RDONLY) < 0) {
-                if(i==1)
-                    break;
-                av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
-                return AVERROR(EIO);
-            }
-            size[i]= url_fsize(f[i]);
-
-            if(codec->codec_id != CODEC_ID_RAWVIDEO)
-                break;
-            filename[ strlen(filename) - 1 ]= 'U' + i;
-        }
-
-        if(codec->codec_id == CODEC_ID_RAWVIDEO && !codec->width)
-            infer_size(&codec->width, &codec->height, size[0]);
-    } else {
-        f[0] = s1->pb;
-        if (url_feof(f[0]))
-            return AVERROR(EIO);
-        size[0]= 4096;
-    }
-
-    av_new_packet(pkt, size[0] + size[1] + size[2]);
-    pkt->stream_index = 0;
-    pkt->flags |= AV_PKT_FLAG_KEY;
-
-    pkt->size= 0;
-    for(i=0; i<3; i++){
-        if(size[i]){
-            ret[i]= get_buffer(f[i], pkt->data + pkt->size, size[i]);
-            if (!s->is_pipe)
-                url_fclose(f[i]);
-            if(ret[i]>0)
-                pkt->size += ret[i];
-        }
-    }
-
-    if (ret[0] <= 0 || ret[1]<0 || ret[2]<0) {
-        av_free_packet(pkt);
-        return AVERROR(EIO); /* signal EOF */
-    } else {
-        s->img_count++;
-        s->img_number++;
-        return 0;
-    }
-}
-
-#if CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER
-/******************************************************/
-/* image output */
-
-static int img_write_header(AVFormatContext *s)
-{
-    VideoData *img = s->priv_data;
-
-    img->img_number = 1;
-    av_strlcpy(img->path, s->filename, sizeof(img->path));
-
-    /* find format */
-    if (s->oformat->flags & AVFMT_NOFILE)
-        img->is_pipe = 0;
-    else
-        img->is_pipe = 1;
-
-    return 0;
-}
-
-static int img_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    VideoData *img = s->priv_data;
-    ByteIOContext *pb[3];
-    char filename[1024];
-    AVCodecContext *codec= s->streams[ pkt->stream_index ]->codec;
-    int i;
-
-    if (!img->is_pipe) {
-        if (av_get_frame_filename(filename, sizeof(filename),
-                                  img->path, img->img_number) < 0 && img->img_number>1) {
-            av_log(s, AV_LOG_ERROR, "Could not get frame filename from pattern\n");
-            return AVERROR(EIO);
-        }
-        for(i=0; i<3; i++){
-            if (url_fopen(&pb[i], filename, URL_WRONLY) < 0) {
-                av_log(s, AV_LOG_ERROR, "Could not open file : %s\n",filename);
-                return AVERROR(EIO);
-            }
-
-            if(codec->codec_id != CODEC_ID_RAWVIDEO)
-                break;
-            filename[ strlen(filename) - 1 ]= 'U' + i;
-        }
-    } else {
-        pb[0] = s->pb;
-    }
-
-    if(codec->codec_id == CODEC_ID_RAWVIDEO){
-        int ysize = codec->width * codec->height;
-        put_buffer(pb[0], pkt->data        , ysize);
-        put_buffer(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
-        put_buffer(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
-        put_flush_packet(pb[1]);
-        put_flush_packet(pb[2]);
-        url_fclose(pb[1]);
-        url_fclose(pb[2]);
-    }else{
-        if(av_str2id(img_tags, s->filename) == CODEC_ID_JPEG2000){
-            AVStream *st = s->streams[0];
-            if(st->codec->extradata_size > 8 &&
-               AV_RL32(st->codec->extradata+4) == MKTAG('j','p','2','h')){
-                if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c'))
-                    goto error;
-                put_be32(pb[0], 12);
-                put_tag (pb[0], "jP  ");
-                put_be32(pb[0], 0x0D0A870A); // signature
-                put_be32(pb[0], 20);
-                put_tag (pb[0], "ftyp");
-                put_tag (pb[0], "jp2 ");
-                put_be32(pb[0], 0);
-                put_tag (pb[0], "jp2 ");
-                put_buffer(pb[0], st->codec->extradata, st->codec->extradata_size);
-            }else if(pkt->size < 8 ||
-                     (!st->codec->extradata_size &&
-                      AV_RL32(pkt->data+4) != MKTAG('j','P',' ',' '))){ // signature
-            error:
-                av_log(s, AV_LOG_ERROR, "malformated jpeg2000 codestream\n");
-                return -1;
-            }
-        }
-        put_buffer(pb[0], pkt->data, pkt->size);
-    }
-    put_flush_packet(pb[0]);
-    if (!img->is_pipe) {
-        url_fclose(pb[0]);
-    }
-
-    img->img_number++;
-    return 0;
-}
-
-#endif /* CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER */
-
-/* input */
-#if CONFIG_IMAGE2_DEMUXER
-AVInputFormat image2_demuxer = {
-    "image2",
-    NULL_IF_CONFIG_SMALL("image2 sequence"),
-    sizeof(VideoData),
-    image_probe,
-    img_read_header,
-    img_read_packet,
-    NULL,
-    NULL,
-    NULL,
-    AVFMT_NOFILE,
-};
-#endif
-#if CONFIG_IMAGE2PIPE_DEMUXER
-AVInputFormat image2pipe_demuxer = {
-    "image2pipe",
-    NULL_IF_CONFIG_SMALL("piped image2 sequence"),
-    sizeof(VideoData),
-    NULL, /* no probe */
-    img_read_header,
-    img_read_packet,
-};
-#endif
-
-/* output */
-#if CONFIG_IMAGE2_MUXER
-AVOutputFormat image2_muxer = {
-    "image2",
-    NULL_IF_CONFIG_SMALL("image2 sequence"),
-    "",
-    "bmp,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,ppm,sgi,tif,tiff,jp2",
-    sizeof(VideoData),
-    CODEC_ID_NONE,
-    CODEC_ID_MJPEG,
-    img_write_header,
-    img_write_packet,
-    NULL,
-    .flags= AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS | AVFMT_NOFILE
-};
-#endif
-#if CONFIG_IMAGE2PIPE_MUXER
-AVOutputFormat image2pipe_muxer = {
-    "image2pipe",
-    NULL_IF_CONFIG_SMALL("piped image2 sequence"),
-    "",
-    "",
-    sizeof(VideoData),
-    CODEC_ID_NONE,
-    CODEC_ID_MJPEG,
-    img_write_header,
-    img_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS | AVFMT_NODIMENSIONS
-};
-#endif
diff --git a/libavformat/internal.h b/libavformat/internal.h
deleted file mode 100644
index a395c2f..0000000
--- a/libavformat/internal.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * copyright (c) 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_INTERNAL_H
-#define AVFORMAT_INTERNAL_H
-
-#include <stdint.h>
-#include "avformat.h"
-
-void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
-
-#ifdef __GNUC__
-#define dynarray_add(tab, nb_ptr, elem)\
-do {\
-    __typeof__(tab) _tab = (tab);\
-    __typeof__(elem) _elem = (elem);\
-    (void)sizeof(**_tab == _elem); /* check that types are compatible */\
-    ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\
-} while(0)
-#else
-#define dynarray_add(tab, nb_ptr, elem)\
-do {\
-    ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\
-} while(0)
-#endif
-
-time_t mktimegm(struct tm *tm);
-struct tm *brktimegm(time_t secs, struct tm *tm);
-const char *small_strptime(const char *p, const char *fmt,
-                           struct tm *dt);
-
-char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
-
-void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
-
-/**
- * Add packet to AVFormatContext->packet_buffer list, determining its
- * interleaved position using compare() function argument.
- */
-void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
-                              int (*compare)(AVFormatContext *, AVPacket *, AVPacket *));
-
-void ff_read_frame_flush(AVFormatContext *s);
-
-#define NTP_OFFSET 2208988800ULL
-#define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL)
-
-/** Gets the current time since NTP epoch in microseconds. */
-uint64_t ff_ntp_time(void);
-
-/**
- * Probes a bytestream to determine the input format. Each time a probe returns
- * with a score that is too low, the probe buffer size is increased and another
- * attempt is made. When the maximum probe size is reached, the input format
- * with the highest score is returned.
- *
- * @param pb the bytestream to probe, it may be closed and opened again
- * @param fmt the input format is put here
- * @param filename the filename of the stream
- * @param logctx the log context
- * @param offset the offset within the bytestream to probe from
- * @param max_probe_size the maximum probe buffer size (zero for default)
- * @return 0 in case of success, a negative value corresponding to an
- * AVERROR code otherwise
- */
-int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
-                          const char *filename, void *logctx,
-                          unsigned int offset, unsigned int max_probe_size);
-
-/**
- * Splits a URL string into components. To reassemble components back into
- * a URL, use ff_url_join instead of using snprintf directly.
- *
- * The pointers to buffers for storing individual components may be null,
- * in order to ignore that component. Buffers for components not found are
- * set to empty strings. If the port isn't found, it is set to a negative
- * value.
- *
- * @see ff_url_join
- *
- * @param proto the buffer for the protocol
- * @param proto_size the size of the proto buffer
- * @param authorization the buffer for the authorization
- * @param authorization_size the size of the authorization buffer
- * @param hostname the buffer for the host name
- * @param hostname_size the size of the hostname buffer
- * @param port_ptr a pointer to store the port number in
- * @param path the buffer for the path
- * @param path_size the size of the path buffer
- * @param url the URL to split
- */
-void ff_url_split(char *proto, int proto_size,
-                  char *authorization, int authorization_size,
-                  char *hostname, int hostname_size,
-                  int *port_ptr,
-                  char *path, int path_size,
-                  const char *url);
-
-/**
- * Assembles a URL string from components. This is the reverse operation
- * of ff_url_split.
- *
- * Note, this requires networking to be initialized, so the caller must
- * ensure ff_network_init has been called.
- *
- * @see ff_url_split
- *
- * @param str the buffer to fill with the url
- * @param size the size of the str buffer
- * @param proto the protocol identifier, if null, the separator
- *              after the identifier is left out, too
- * @param authorization an optional authorization string, may be null
- * @param hostname the host name string
- * @param port the port number, left out from the string if negative
- * @param fmt a generic format string for everything to add after the
- *            host/port, may be null
- * @return the number of characters written to the destination buffer
- */
-int ff_url_join(char *str, int size, const char *proto,
-                const char *authorization, const char *hostname,
-                int port, const char *fmt, ...);
-
-/**
- * Appends the media-specific SDP fragment for the media stream c
- * to the buffer buff.
- *
- * Note, the buffer needs to be initialized, since it is appended to
- * existing content.
- *
- * @param buff the buffer to append the SDP fragment to
- * @param size the size of the buff buffer
- * @param c the AVCodecContext of the media to describe
- * @param dest_addr the destination address of the media stream, may be NULL
- * @param port the destination port of the media stream, 0 if unknown
- * @param ttl the time to live of the stream, 0 if not multicast
- */
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
-                        const char *dest_addr, int port, int ttl);
-
-#endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
deleted file mode 100644
index 372a926..0000000
--- a/libavformat/ipmovie.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- * Interplay MVE File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Interplay MVE file demuxer
- * by Mike Melanson (melanson at pcisys.net)
- * For more information regarding the Interplay MVE file format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- * The aforementioned site also contains a command line utility for parsing
- * IP MVE files so that you can get a good idea of the typical structure of
- * such files. This demuxer is not the best example to use if you are trying
- * to write your own as it uses a rather roundabout approach for splitting
- * up and sending out the chunks.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-/* debugging support: #define DEBUG_IPMOVIE as non-zero to see extremely
- * verbose information about the demux process */
-#define DEBUG_IPMOVIE 0
-
-#if DEBUG_IPMOVIE
-#undef printf
-#define debug_ipmovie printf
-#else
-static inline void debug_ipmovie(const char *format, ...) { }
-#endif
-
-#define CHUNK_PREAMBLE_SIZE 4
-#define OPCODE_PREAMBLE_SIZE 4
-
-#define CHUNK_INIT_AUDIO   0x0000
-#define CHUNK_AUDIO_ONLY   0x0001
-#define CHUNK_INIT_VIDEO   0x0002
-#define CHUNK_VIDEO        0x0003
-#define CHUNK_SHUTDOWN     0x0004
-#define CHUNK_END          0x0005
-/* these last types are used internally */
-#define CHUNK_DONE         0xFFFC
-#define CHUNK_NOMEM        0xFFFD
-#define CHUNK_EOF          0xFFFE
-#define CHUNK_BAD          0xFFFF
-
-#define OPCODE_END_OF_STREAM           0x00
-#define OPCODE_END_OF_CHUNK            0x01
-#define OPCODE_CREATE_TIMER            0x02
-#define OPCODE_INIT_AUDIO_BUFFERS      0x03
-#define OPCODE_START_STOP_AUDIO        0x04
-#define OPCODE_INIT_VIDEO_BUFFERS      0x05
-#define OPCODE_UNKNOWN_06              0x06
-#define OPCODE_SEND_BUFFER             0x07
-#define OPCODE_AUDIO_FRAME             0x08
-#define OPCODE_SILENCE_FRAME           0x09
-#define OPCODE_INIT_VIDEO_MODE         0x0A
-#define OPCODE_CREATE_GRADIENT         0x0B
-#define OPCODE_SET_PALETTE             0x0C
-#define OPCODE_SET_PALETTE_COMPRESSED  0x0D
-#define OPCODE_UNKNOWN_0E              0x0E
-#define OPCODE_SET_DECODING_MAP        0x0F
-#define OPCODE_UNKNOWN_10              0x10
-#define OPCODE_VIDEO_DATA              0x11
-#define OPCODE_UNKNOWN_12              0x12
-#define OPCODE_UNKNOWN_13              0x13
-#define OPCODE_UNKNOWN_14              0x14
-#define OPCODE_UNKNOWN_15              0x15
-
-#define PALETTE_COUNT 256
-
-typedef struct IPMVEContext {
-
-    unsigned char *buf;
-    int buf_size;
-
-    uint64_t frame_pts_inc;
-
-    unsigned int video_bpp;
-    unsigned int video_width;
-    unsigned int video_height;
-    int64_t video_pts;
-
-    unsigned int audio_bits;
-    unsigned int audio_channels;
-    unsigned int audio_sample_rate;
-    enum CodecID audio_type;
-    unsigned int audio_frame_count;
-
-    int video_stream_index;
-    int audio_stream_index;
-
-    int64_t audio_chunk_offset;
-    int audio_chunk_size;
-    int64_t video_chunk_offset;
-    int video_chunk_size;
-    int64_t decode_map_chunk_offset;
-    int decode_map_chunk_size;
-
-    int64_t next_chunk_offset;
-
-    AVPaletteControl palette_control;
-
-} IPMVEContext;
-
-static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
-    AVPacket *pkt) {
-
-    int chunk_type;
-
-    if (s->audio_chunk_offset) {
-
-        /* adjust for PCM audio by skipping chunk header */
-        if (s->audio_type != CODEC_ID_INTERPLAY_DPCM) {
-            s->audio_chunk_offset += 6;
-            s->audio_chunk_size -= 6;
-        }
-
-        url_fseek(pb, s->audio_chunk_offset, SEEK_SET);
-        s->audio_chunk_offset = 0;
-
-        if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size))
-            return CHUNK_EOF;
-
-        pkt->stream_index = s->audio_stream_index;
-        pkt->pts = s->audio_frame_count;
-
-        /* audio frame maintenance */
-        if (s->audio_type != CODEC_ID_INTERPLAY_DPCM)
-            s->audio_frame_count +=
-            (s->audio_chunk_size / s->audio_channels / (s->audio_bits / 8));
-        else
-            s->audio_frame_count +=
-                (s->audio_chunk_size - 6) / s->audio_channels;
-
-        debug_ipmovie("sending audio frame with pts %"PRId64" (%d audio frames)\n",
-            pkt->pts, s->audio_frame_count);
-
-        chunk_type = CHUNK_VIDEO;
-
-    } else if (s->decode_map_chunk_offset) {
-
-        /* send both the decode map and the video data together */
-
-        if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size))
-            return CHUNK_NOMEM;
-
-        pkt->pos= s->decode_map_chunk_offset;
-        url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET);
-        s->decode_map_chunk_offset = 0;
-
-        if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) !=
-            s->decode_map_chunk_size) {
-            av_free_packet(pkt);
-            return CHUNK_EOF;
-        }
-
-        url_fseek(pb, s->video_chunk_offset, SEEK_SET);
-        s->video_chunk_offset = 0;
-
-        if (get_buffer(pb, pkt->data + s->decode_map_chunk_size,
-            s->video_chunk_size) != s->video_chunk_size) {
-            av_free_packet(pkt);
-            return CHUNK_EOF;
-        }
-
-        pkt->stream_index = s->video_stream_index;
-        pkt->pts = s->video_pts;
-
-        debug_ipmovie("sending video frame with pts %"PRId64"\n",
-            pkt->pts);
-
-        s->video_pts += s->frame_pts_inc;
-
-        chunk_type = CHUNK_VIDEO;
-
-    } else {
-
-        url_fseek(pb, s->next_chunk_offset, SEEK_SET);
-        chunk_type = CHUNK_DONE;
-
-    }
-
-    return chunk_type;
-}
-
-/* This function loads and processes a single chunk in an IP movie file.
- * It returns the type of chunk that was processed. */
-static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
-    AVPacket *pkt)
-{
-    unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
-    int chunk_type;
-    int chunk_size;
-    unsigned char opcode_preamble[OPCODE_PREAMBLE_SIZE];
-    unsigned char opcode_type;
-    unsigned char opcode_version;
-    int opcode_size;
-    unsigned char scratch[1024];
-    int i, j;
-    int first_color, last_color;
-    int audio_flags;
-    unsigned char r, g, b;
-
-    /* see if there are any pending packets */
-    chunk_type = load_ipmovie_packet(s, pb, pkt);
-    if (chunk_type != CHUNK_DONE)
-        return chunk_type;
-
-    /* read the next chunk, wherever the file happens to be pointing */
-    if (url_feof(pb))
-        return CHUNK_EOF;
-    if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
-        CHUNK_PREAMBLE_SIZE)
-        return CHUNK_BAD;
-    chunk_size = AV_RL16(&chunk_preamble[0]);
-    chunk_type = AV_RL16(&chunk_preamble[2]);
-
-    debug_ipmovie("chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size);
-
-    switch (chunk_type) {
-
-    case CHUNK_INIT_AUDIO:
-        debug_ipmovie("initialize audio\n");
-        break;
-
-    case CHUNK_AUDIO_ONLY:
-        debug_ipmovie("audio only\n");
-        break;
-
-    case CHUNK_INIT_VIDEO:
-        debug_ipmovie("initialize video\n");
-        break;
-
-    case CHUNK_VIDEO:
-        debug_ipmovie("video (and audio)\n");
-        break;
-
-    case CHUNK_SHUTDOWN:
-        debug_ipmovie("shutdown\n");
-        break;
-
-    case CHUNK_END:
-        debug_ipmovie("end\n");
-        break;
-
-    default:
-        debug_ipmovie("invalid chunk\n");
-        chunk_type = CHUNK_BAD;
-        break;
-
-    }
-
-    while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) {
-
-        /* read the next chunk, wherever the file happens to be pointing */
-       if (url_feof(pb)) {
-            chunk_type = CHUNK_EOF;
-            break;
-        }
-        if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
-            CHUNK_PREAMBLE_SIZE) {
-            chunk_type = CHUNK_BAD;
-            break;
-        }
-
-        opcode_size = AV_RL16(&opcode_preamble[0]);
-        opcode_type = opcode_preamble[2];
-        opcode_version = opcode_preamble[3];
-
-        chunk_size -= OPCODE_PREAMBLE_SIZE;
-        chunk_size -= opcode_size;
-        if (chunk_size < 0) {
-            debug_ipmovie("chunk_size countdown just went negative\n");
-            chunk_type = CHUNK_BAD;
-            break;
-        }
-
-        debug_ipmovie("  opcode type %02X, version %d, 0x%04X bytes: ",
-            opcode_type, opcode_version, opcode_size);
-        switch (opcode_type) {
-
-        case OPCODE_END_OF_STREAM:
-            debug_ipmovie("end of stream\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_END_OF_CHUNK:
-            debug_ipmovie("end of chunk\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_CREATE_TIMER:
-            debug_ipmovie("create timer\n");
-            if ((opcode_version > 0) || (opcode_size > 6)) {
-                debug_ipmovie("bad create_timer opcode\n");
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            if (get_buffer(pb, scratch, opcode_size) !=
-                opcode_size) {
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            s->frame_pts_inc = ((uint64_t)AV_RL32(&scratch[0])) * AV_RL16(&scratch[4]);
-            debug_ipmovie("  %.2f frames/second (timer div = %d, subdiv = %d)\n",
-                1000000.0/s->frame_pts_inc, AV_RL32(&scratch[0]), AV_RL16(&scratch[4]));
-            break;
-
-        case OPCODE_INIT_AUDIO_BUFFERS:
-            debug_ipmovie("initialize audio buffers\n");
-            if ((opcode_version > 1) || (opcode_size > 10)) {
-                debug_ipmovie("bad init_audio_buffers opcode\n");
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            if (get_buffer(pb, scratch, opcode_size) !=
-                opcode_size) {
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            s->audio_sample_rate = AV_RL16(&scratch[4]);
-            audio_flags = AV_RL16(&scratch[2]);
-            /* bit 0 of the flags: 0 = mono, 1 = stereo */
-            s->audio_channels = (audio_flags & 1) + 1;
-            /* bit 1 of the flags: 0 = 8 bit, 1 = 16 bit */
-            s->audio_bits = (((audio_flags >> 1) & 1) + 1) * 8;
-            /* bit 2 indicates compressed audio in version 1 opcode */
-            if ((opcode_version == 1) && (audio_flags & 0x4))
-                s->audio_type = CODEC_ID_INTERPLAY_DPCM;
-            else if (s->audio_bits == 16)
-                s->audio_type = CODEC_ID_PCM_S16LE;
-            else
-                s->audio_type = CODEC_ID_PCM_U8;
-            debug_ipmovie("audio: %d bits, %d Hz, %s, %s format\n",
-                s->audio_bits,
-                s->audio_sample_rate,
-                (s->audio_channels == 2) ? "stereo" : "mono",
-                (s->audio_type == CODEC_ID_INTERPLAY_DPCM) ?
-                "Interplay audio" : "PCM");
-            break;
-
-        case OPCODE_START_STOP_AUDIO:
-            debug_ipmovie("start/stop audio\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_INIT_VIDEO_BUFFERS:
-            debug_ipmovie("initialize video buffers\n");
-            if ((opcode_version > 2) || (opcode_size > 8)) {
-                debug_ipmovie("bad init_video_buffers opcode\n");
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            if (get_buffer(pb, scratch, opcode_size) !=
-                opcode_size) {
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            s->video_width = AV_RL16(&scratch[0]) * 8;
-            s->video_height = AV_RL16(&scratch[2]) * 8;
-            if (opcode_version < 2 || !AV_RL16(&scratch[6])) {
-                s->video_bpp = 8;
-            } else {
-                s->video_bpp = 16;
-            }
-            debug_ipmovie("video resolution: %d x %d\n",
-                s->video_width, s->video_height);
-            break;
-
-        case OPCODE_UNKNOWN_06:
-        case OPCODE_UNKNOWN_0E:
-        case OPCODE_UNKNOWN_10:
-        case OPCODE_UNKNOWN_12:
-        case OPCODE_UNKNOWN_13:
-        case OPCODE_UNKNOWN_14:
-        case OPCODE_UNKNOWN_15:
-            debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type);
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_SEND_BUFFER:
-            debug_ipmovie("send buffer\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_AUDIO_FRAME:
-            debug_ipmovie("audio frame\n");
-
-            /* log position and move on for now */
-            s->audio_chunk_offset = url_ftell(pb);
-            s->audio_chunk_size = opcode_size;
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_SILENCE_FRAME:
-            debug_ipmovie("silence frame\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_INIT_VIDEO_MODE:
-            debug_ipmovie("initialize video mode\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_CREATE_GRADIENT:
-            debug_ipmovie("create gradient\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_SET_PALETTE:
-            debug_ipmovie("set palette\n");
-            /* check for the logical maximum palette size
-             * (3 * 256 + 4 bytes) */
-            if (opcode_size > 0x304) {
-                debug_ipmovie("demux_ipmovie: set_palette opcode too large\n");
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            if (get_buffer(pb, scratch, opcode_size) != opcode_size) {
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-
-            /* load the palette into internal data structure */
-            first_color = AV_RL16(&scratch[0]);
-            last_color = first_color + AV_RL16(&scratch[2]) - 1;
-            /* sanity check (since they are 16 bit values) */
-            if ((first_color > 0xFF) || (last_color > 0xFF)) {
-                debug_ipmovie("demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
-                    first_color, last_color);
-                chunk_type = CHUNK_BAD;
-                break;
-            }
-            j = 4;  /* offset of first palette data */
-            for (i = first_color; i <= last_color; i++) {
-                /* the palette is stored as a 6-bit VGA palette, thus each
-                 * component is shifted up to a 8-bit range */
-                r = scratch[j++] * 4;
-                g = scratch[j++] * 4;
-                b = scratch[j++] * 4;
-                s->palette_control.palette[i] = (r << 16) | (g << 8) | (b);
-            }
-            /* indicate a palette change */
-            s->palette_control.palette_changed = 1;
-            break;
-
-        case OPCODE_SET_PALETTE_COMPRESSED:
-            debug_ipmovie("set palette compressed\n");
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_SET_DECODING_MAP:
-            debug_ipmovie("set decoding map\n");
-
-            /* log position and move on for now */
-            s->decode_map_chunk_offset = url_ftell(pb);
-            s->decode_map_chunk_size = opcode_size;
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        case OPCODE_VIDEO_DATA:
-            debug_ipmovie("set video data\n");
-
-            /* log position and move on for now */
-            s->video_chunk_offset = url_ftell(pb);
-            s->video_chunk_size = opcode_size;
-            url_fseek(pb, opcode_size, SEEK_CUR);
-            break;
-
-        default:
-            debug_ipmovie("*** unknown opcode type\n");
-            chunk_type = CHUNK_BAD;
-            break;
-
-        }
-    }
-
-    /* make a note of where the stream is sitting */
-    s->next_chunk_offset = url_ftell(pb);
-
-    /* dispatch the first of any pending packets */
-    if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY))
-        chunk_type = load_ipmovie_packet(s, pb, pkt);
-
-    return chunk_type;
-}
-
-static const char signature[] = "Interplay MVE File\x1A\0\x1A";
-
-static int ipmovie_probe(AVProbeData *p)
-{
-    uint8_t *b = p->buf;
-    uint8_t *b_end = p->buf + p->buf_size - sizeof(signature);
-    do {
-        if (memcmp(b++, signature, sizeof(signature)) == 0)
-            return AVPROBE_SCORE_MAX;
-    } while (b < b_end);
-
-    return 0;
-}
-
-static int ipmovie_read_header(AVFormatContext *s,
-                               AVFormatParameters *ap)
-{
-    IPMVEContext *ipmovie = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVPacket pkt;
-    AVStream *st;
-    unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE];
-    int chunk_type;
-    uint8_t signature_buffer[sizeof(signature)];
-
-    get_buffer(pb, signature_buffer, sizeof(signature_buffer));
-    while (memcmp(signature_buffer, signature, sizeof(signature))) {
-        memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
-        signature_buffer[sizeof(signature_buffer) - 1] = get_byte(pb);
-        if (url_feof(pb))
-            return AVERROR_EOF;
-    }
-    /* initialize private context members */
-    ipmovie->video_pts = ipmovie->audio_frame_count = 0;
-    ipmovie->audio_chunk_offset = ipmovie->video_chunk_offset =
-    ipmovie->decode_map_chunk_offset = 0;
-
-    /* on the first read, this will position the stream at the first chunk */
-    ipmovie->next_chunk_offset = url_ftell(pb) + 4;
-
-    /* process the first chunk which should be CHUNK_INIT_VIDEO */
-    if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO)
-        return AVERROR_INVALIDDATA;
-
-    /* peek ahead to the next chunk-- if it is an init audio chunk, process
-     * it; if it is the first video chunk, this is a silent file */
-    if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
-        CHUNK_PREAMBLE_SIZE)
-        return AVERROR(EIO);
-    chunk_type = AV_RL16(&chunk_preamble[2]);
-    url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
-
-    if (chunk_type == CHUNK_VIDEO)
-        ipmovie->audio_type = CODEC_ID_NONE;  /* no audio */
-    else if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_AUDIO)
-        return AVERROR_INVALIDDATA;
-
-    /* initialize the stream decoders */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 63, 1, 1000000);
-    ipmovie->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = ipmovie->video_width;
-    st->codec->height = ipmovie->video_height;
-    st->codec->bits_per_coded_sample = ipmovie->video_bpp;
-
-    /* palette considerations */
-    st->codec->palctrl = &ipmovie->palette_control;
-
-    if (ipmovie->audio_type) {
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
-        ipmovie->audio_stream_index = st->index;
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = ipmovie->audio_type;
-        st->codec->codec_tag = 0;  /* no tag */
-        st->codec->channels = ipmovie->audio_channels;
-        st->codec->sample_rate = ipmovie->audio_sample_rate;
-        st->codec->bits_per_coded_sample = ipmovie->audio_bits;
-        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-            st->codec->bits_per_coded_sample;
-        if (st->codec->codec_id == CODEC_ID_INTERPLAY_DPCM)
-            st->codec->bit_rate /= 2;
-        st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-    }
-
-    return 0;
-}
-
-static int ipmovie_read_packet(AVFormatContext *s,
-                               AVPacket *pkt)
-{
-    IPMVEContext *ipmovie = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret;
-
-    ret = process_ipmovie_chunk(ipmovie, pb, pkt);
-    if (ret == CHUNK_BAD)
-        ret = AVERROR_INVALIDDATA;
-    else if (ret == CHUNK_EOF)
-        ret = AVERROR(EIO);
-    else if (ret == CHUNK_NOMEM)
-        ret = AVERROR(ENOMEM);
-    else if (ret == CHUNK_VIDEO)
-        ret = 0;
-    else
-        ret = -1;
-
-    return ret;
-}
-
-AVInputFormat ipmovie_demuxer = {
-    "ipmovie",
-    NULL_IF_CONFIG_SMALL("Interplay MVE format"),
-    sizeof(IPMVEContext),
-    ipmovie_probe,
-    ipmovie_read_header,
-    ipmovie_read_packet,
-};
diff --git a/libavformat/isom.c b/libavformat/isom.c
deleted file mode 100644
index a6e67e2..0000000
--- a/libavformat/isom.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * ISO Media common code
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002 Francois Revol <revol at free.fr>
- * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at free.fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "riff.h"
-#include "isom.h"
-
-/* http://www.mp4ra.org */
-/* ordered by muxing preference */
-const AVCodecTag ff_mp4_obj_type[] = {
-    { CODEC_ID_MOV_TEXT  , 0x08 },
-    { CODEC_ID_MPEG4     , 0x20 },
-    { CODEC_ID_H264      , 0x21 },
-    { CODEC_ID_AAC       , 0x40 },
-    { CODEC_ID_MP4ALS    , 0x40 }, /* 14496-3 ALS */
-    { CODEC_ID_MPEG2VIDEO, 0x61 }, /* MPEG2 Main */
-    { CODEC_ID_MPEG2VIDEO, 0x60 }, /* MPEG2 Simple */
-    { CODEC_ID_MPEG2VIDEO, 0x62 }, /* MPEG2 SNR */
-    { CODEC_ID_MPEG2VIDEO, 0x63 }, /* MPEG2 Spatial */
-    { CODEC_ID_MPEG2VIDEO, 0x64 }, /* MPEG2 High */
-    { CODEC_ID_MPEG2VIDEO, 0x65 }, /* MPEG2 422 */
-    { CODEC_ID_AAC       , 0x66 }, /* MPEG2 AAC Main */
-    { CODEC_ID_AAC       , 0x67 }, /* MPEG2 AAC Low */
-    { CODEC_ID_AAC       , 0x68 }, /* MPEG2 AAC SSR */
-    { CODEC_ID_MP3       , 0x69 }, /* 13818-3 */
-    { CODEC_ID_MP2       , 0x69 }, /* 11172-3 */
-    { CODEC_ID_MPEG1VIDEO, 0x6A }, /* 11172-2 */
-    { CODEC_ID_MP3       , 0x6B }, /* 11172-3 */
-    { CODEC_ID_MJPEG     , 0x6C }, /* 10918-1 */
-    { CODEC_ID_PNG       , 0x6D },
-    { CODEC_ID_JPEG2000  , 0x6E }, /* 15444-1 */
-    { CODEC_ID_VC1       , 0xA3 },
-    { CODEC_ID_DIRAC     , 0xA4 },
-    { CODEC_ID_AC3       , 0xA5 },
-    { CODEC_ID_VORBIS    , 0xDD }, /* non standard, gpac uses it */
-    { CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* non standard, see unsupported-embedded-subs-2.mp4 */
-    { CODEC_ID_QCELP     , 0xE1 },
-    { CODEC_ID_NONE      ,    0 },
-};
-
-const AVCodecTag codec_movvideo_tags[] = {
-/*  { CODEC_ID_, MKTAG('I', 'V', '5', '0') }, *//* Indeo 5.0 */
-
-    { CODEC_ID_RAWVIDEO, MKTAG('r', 'a', 'w', ' ') }, /* Uncompressed RGB */
-    { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') }, /* Uncompressed YUV422 */
-    { CODEC_ID_RAWVIDEO, MKTAG('A', 'V', 'U', 'I') }, /* YUV with alpha-channel (AVID Uncompressed) */
-    { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* UNCOMPRESSED 8BIT 4:2:2 */
-    { CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2vuy but byte swapped */
-
-    { CODEC_ID_R210,   MKTAG('r', '2', '1', '0') }, /* UNCOMPRESSED 10BIT RGB */
-    { CODEC_ID_V210,   MKTAG('v', '2', '1', '0') }, /* UNCOMPRESSED 10BIT 4:2:2 */
-
-    { CODEC_ID_MJPEG,  MKTAG('j', 'p', 'e', 'g') }, /* PhotoJPEG */
-    { CODEC_ID_MJPEG,  MKTAG('m', 'j', 'p', 'a') }, /* Motion-JPEG (format A) */
-    { CODEC_ID_MJPEG,  MKTAG('A', 'V', 'D', 'J') }, /* MJPEG with alpha-channel (AVID JFIF meridien compressed) */
-/*  { CODEC_ID_MJPEG,  MKTAG('A', 'V', 'R', 'n') }, *//* MJPEG with alpha-channel (AVID ABVB/Truevision NuVista) */
-    { CODEC_ID_MJPEG,  MKTAG('d', 'm', 'b', '1') }, /* Motion JPEG OpenDML */
-    { CODEC_ID_MJPEGB, MKTAG('m', 'j', 'p', 'b') }, /* Motion-JPEG (format B) */
-
-    { CODEC_ID_SVQ1, MKTAG('S', 'V', 'Q', '1') }, /* Sorenson Video v1 */
-    { CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') }, /* Sorenson Video v1 */
-    { CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', 'i') }, /* Sorenson Video v1 (from QT specs)*/
-    { CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3') }, /* Sorenson Video v3 */
-
-    { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
-    { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') }, /* OpenDiVX *//* sample files at http://heroinewarrior.com/xmovie.php3 use this tag */
-    { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
-    { CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') }, /* experimental: 3IVX files before ivx D4 4.5.1 */
-
-    { CODEC_ID_H263, MKTAG('h', '2', '6', '3') }, /* H263 */
-    { CODEC_ID_H263, MKTAG('s', '2', '6', '3') }, /* H263 ?? works */
-
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 'p') }, /* DV PAL */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') }, /* DV NTSC */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'p', 'p') }, /* DVCPRO PAL produced by FCP */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'p') }, /* DVCPRO50 PAL produced by FCP */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'n') }, /* DVCPRO50 NTSC produced by FCP */
-    { CODEC_ID_DVVIDEO, MKTAG('A', 'V', 'd', 'v') }, /* AVID DV */
-    { CODEC_ID_DVVIDEO, MKTAG('A', 'V', 'd', '1') }, /* AVID DV100 */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'q') }, /* DVCPRO HD 720p50 */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'p') }, /* DVCPRO HD 720p60 */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '2') },
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '4') },
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '5') }, /* DVCPRO HD 50i produced by FCP */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '6') }, /* DVCPRO HD 60i produced by FCP */
-    { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '3') }, /* DVCPRO HD 30p produced by FCP */
-
-    { CODEC_ID_VP3,     MKTAG('V', 'P', '3', '1') }, /* On2 VP3 */
-    { CODEC_ID_RPZA,    MKTAG('r', 'p', 'z', 'a') }, /* Apple Video (RPZA) */
-    { CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') }, /* Cinepak */
-    { CODEC_ID_8BPS,    MKTAG('8', 'B', 'P', 'S') }, /* Planar RGB (8BPS) */
-    { CODEC_ID_SMC,     MKTAG('s', 'm', 'c', ' ') }, /* Apple Graphics (SMC) */
-    { CODEC_ID_QTRLE,   MKTAG('r', 'l', 'e', ' ') }, /* Apple Animation (RLE) */
-    { CODEC_ID_MSRLE,   MKTAG('W', 'R', 'L', 'E') },
-    { CODEC_ID_QDRAW,   MKTAG('q', 'd', 'r', 'w') }, /* QuickDraw */
-
-    { CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') },
-
-    { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
-
-    { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */
-    { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') },
-    { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '1') }, /* MPEG2 HDV 720p30 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '2') }, /* MPEG2 HDV 1080i60 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '3') }, /* MPEG2 HDV 1080i50 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '5') }, /* MPEG2 HDV 720p25 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '6') }, /* MPEG2 HDV 1080p24 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '7') }, /* MPEG2 HDV 1080p25 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('h', 'd', 'v', '8') }, /* MPEG2 HDV 1080p30 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '5', 'n') }, /* MPEG2 IMX NTSC 525/60 50mb/s produced by FCP */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '5', 'p') }, /* MPEG2 IMX PAL 625/50 50mb/s produced by FCP */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '4', 'n') }, /* MPEG2 IMX NTSC 525/60 40mb/s produced by FCP */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '4', 'p') }, /* MPEG2 IMX PAL 625/50 40mb/s produced by FCP */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'n') }, /* MPEG2 IMX NTSC 525/60 30mb/s produced by FCP */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'x', '3', 'p') }, /* MPEG2 IMX PAL 625/50 30mb/s produced by FCP */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', '9') }, /* XDCAM HD422 720p60 CBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'a') }, /* XDCAM HD422 720p50 CBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'b') }, /* XDCAM HD422 1080i60 CBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'c') }, /* XDCAM HD422 1080i50 CBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'd') }, /* XDCAM HD422 1080p24 CBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'e') }, /* XDCAM HD422 1080p25 CBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', '5', 'f') }, /* XDCAM HD422 1080p30 CBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '1') }, /* XDCAM EX 720p30 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '2') }, /* XDCAM HD 1080i60 */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '3') }, /* XDCAM HD 1080i50 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '4') }, /* XDCAM EX 720p24 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '5') }, /* XDCAM EX 720p25 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '6') }, /* XDCAM HD 1080p24 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '7') }, /* XDCAM HD 1080p25 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '8') }, /* XDCAM HD 1080p30 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', '9') }, /* XDCAM EX 720p60 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'a') }, /* XDCAM EX 720p50 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'b') }, /* XDCAM EX 1080i60 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'c') }, /* XDCAM EX 1080i50 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'd') }, /* XDCAM EX 1080p24 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'e') }, /* XDCAM EX 1080p25 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('x', 'd', 'v', 'f') }, /* XDCAM EX 1080p30 VBR */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('A', 'V', 'm', 'p') }, /* AVID IMX PAL */
-    { CODEC_ID_MPEG2VIDEO, MKTAG('m', '2', 'v', '1') },
-
-    { CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') }, /* JPEG 2000 produced by FCP */
-
-    { CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') }, /* Truevision Targa */
-    { CODEC_ID_TIFF,  MKTAG('t', 'i', 'f', 'f') }, /* TIFF embedded in MOV */
-    { CODEC_ID_GIF,   MKTAG('g', 'i', 'f', ' ') }, /* embedded gif files as frames (usually one "click to play movie" frame) */
-    { CODEC_ID_PNG,   MKTAG('p', 'n', 'g', ' ') },
-
-    { CODEC_ID_VC1, MKTAG('v', 'c', '-', '1') }, /* SMPTE RP 2025 */
-    { CODEC_ID_CAVS, MKTAG('a', 'v', 's', '2') },
-
-    { CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
-    { CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n') }, /* AVID DNxHD */
-    { CODEC_ID_RAWVIDEO, MKTAG('A', 'V', '1', 'x') }, /* AVID 1:1x */
-    { CODEC_ID_RAWVIDEO, MKTAG('A', 'V', 'u', 'p') },
-    { CODEC_ID_SGI,   MKTAG('s', 'g', 'i', ' ') }, /* SGI  */
-    { CODEC_ID_DPX,   MKTAG('d', 'p', 'x', ' ') }, /* DPX */
-
-    { CODEC_ID_NONE, 0 },
-};
-
-const AVCodecTag codec_movaudio_tags[] = {
-    { CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2') },
-    { CODEC_ID_PCM_S32LE, MKTAG('i', 'n', '3', '2') },
-    { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4') },
-    { CODEC_ID_PCM_S24LE, MKTAG('i', 'n', '2', '4') },
-    { CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's') }, /* 16 bits */
-    { CODEC_ID_PCM_S16LE, MKTAG('s', 'o', 'w', 't') }, /*  */
-    { CODEC_ID_PCM_S16LE, MKTAG('l', 'p', 'c', 'm') },
-    { CODEC_ID_PCM_F32BE, MKTAG('f', 'l', '3', '2') },
-    { CODEC_ID_PCM_F32LE, MKTAG('f', 'l', '3', '2') },
-    { CODEC_ID_PCM_F64BE, MKTAG('f', 'l', '6', '4') },
-    { CODEC_ID_PCM_F64LE, MKTAG('f', 'l', '6', '4') },
-    { CODEC_ID_PCM_S8,    MKTAG('s', 'o', 'w', 't') },
-    { CODEC_ID_PCM_U8,    MKTAG('r', 'a', 'w', ' ') }, /* 8 bits unsigned */
-    { CODEC_ID_PCM_U8,    MKTAG('N', 'O', 'N', 'E') }, /* uncompressed */
-    { CODEC_ID_PCM_MULAW, MKTAG('u', 'l', 'a', 'w') }, /*  */
-    { CODEC_ID_PCM_ALAW,  MKTAG('a', 'l', 'a', 'w') }, /*  */
-
-    { CODEC_ID_ADPCM_IMA_QT, MKTAG('i', 'm', 'a', '4') }, /* IMA-4 ADPCM */
-
-    { CODEC_ID_MACE3, MKTAG('M', 'A', 'C', '3') }, /* Macintosh Audio Compression and Expansion 3:1 */
-    { CODEC_ID_MACE6, MKTAG('M', 'A', 'C', '6') }, /* Macintosh Audio Compression and Expansion 6:1 */
-
-    { CODEC_ID_MP1, MKTAG('.', 'm', 'p', '1') }, /* MPEG layer 1 */
-    { CODEC_ID_MP2, MKTAG('.', 'm', 'p', '2') }, /* MPEG layer 2 */
-
-    { CODEC_ID_MP3, MKTAG('.', 'm', 'p', '3') }, /* MPEG layer 3 */ /* sample files at http://www.3ivx.com/showcase.html use this tag */
-    { CODEC_ID_MP3, 0x6D730055 }, /* MPEG layer 3 */
-
-/*  { CODEC_ID_OGG_VORBIS, MKTAG('O', 'g', 'g', 'S') }, *//* sample files at http://heroinewarrior.com/xmovie.php3 use this tag */
-
-    { CODEC_ID_AAC, MKTAG('m', 'p', '4', 'a') }, /* MPEG-4 AAC */
-    { CODEC_ID_AC3, MKTAG('a', 'c', '-', '3') }, /* ETSI TS 102 366 Annex F */
-    { CODEC_ID_AC3, MKTAG('s', 'a', 'c', '3') }, /* Nero Recode */
-
-    { CODEC_ID_AMR_NB, MKTAG('s', 'a', 'm', 'r') }, /* AMR-NB 3gp */
-    { CODEC_ID_AMR_WB, MKTAG('s', 'a', 'w', 'b') }, /* AMR-WB 3gp */
-
-    { CODEC_ID_GSM,  MKTAG('a', 'g', 's', 'm') },
-    { CODEC_ID_ALAC, MKTAG('a', 'l', 'a', 'c') }, /* Apple Lossless */
-
-    { CODEC_ID_QCELP, MKTAG('Q','c','l','p') },
-    { CODEC_ID_QCELP, MKTAG('Q','c','l','q') },
-    { CODEC_ID_QCELP, MKTAG('s','q','c','p') }, /* ISO Media fourcc */
-
-    { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2') }, /* QDM2 */
-
-    { CODEC_ID_DVAUDIO, MKTAG('v', 'd', 'v', 'a') },
-    { CODEC_ID_DVAUDIO, MKTAG('d', 'v', 'c', 'a') },
-
-    { CODEC_ID_WMAV2, MKTAG('W', 'M', 'A', '2') },
-
-    { CODEC_ID_NONE, 0 },
-};
-
-const AVCodecTag ff_codec_movsubtitle_tags[] = {
-    { CODEC_ID_MOV_TEXT, MKTAG('t', 'e', 'x', 't') },
-    { CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
-    { CODEC_ID_NONE, 0 },
-};
-
-/* map numeric codes from mdhd atom to ISO 639 */
-/* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
-/* http://developer.apple.com/documentation/mac/Text/Text-368.html */
-/* deprecated by putting the code as 3*5bit ascii */
-static const char mov_mdhd_language_map[][4] = {
-    /* 0-9 */
-    "eng", "fra", "ger", "ita", "dut", "sve", "spa", "dan", "por", "nor",
-    "heb", "jpn", "ara", "fin", "gre", "ice", "mlt", "tur", "hr "/*scr*/, "chi"/*ace?*/,
-    "urd", "hin", "tha", "kor", "lit", "pol", "hun", "est", "lav",    "",
-    "fo ",    "", "rus", "chi",    "", "iri", "alb", "ron", "ces", "slk",
-    "slv", "yid", "sr ", "mac", "bul", "ukr", "bel", "uzb", "kaz", "aze",
-    /*?*/
-    "aze", "arm", "geo", "mol", "kir", "tgk", "tuk", "mon",    "", "pus",
-    "kur", "kas", "snd", "tib", "nep", "san", "mar", "ben", "asm", "guj",
-    "pa ", "ori", "mal", "kan", "tam", "tel",    "", "bur", "khm", "lao",
-    /*                   roman? arabic? */
-    "vie", "ind", "tgl", "may", "may", "amh", "tir", "orm", "som", "swa",
-    /*==rundi?*/
-       "", "run",    "", "mlg", "epo",    "",    "",    "",    "",    "",
-    /* 100 */
-       "",    "",    "",    "",    "",    "",    "",    "",    "",    "",
-       "",    "",    "",    "",    "",    "",    "",    "",    "",    "",
-       "",    "",    "",    "",    "",    "",    "",    "", "wel", "baq",
-    "cat", "lat", "que", "grn", "aym", "tat", "uig", "dzo", "jav"
-};
-
-int ff_mov_iso639_to_lang(const char lang[4], int mp4)
-{
-    int i, code = 0;
-
-    /* old way, only for QT? */
-    for (i = 0; lang[0] && !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
-        if (!strcmp(lang, mov_mdhd_language_map[i]))
-            return i;
-    }
-    /* XXX:can we do that in mov too? */
-    if (!mp4)
-        return -1;
-    /* handle undefined as such */
-    if (lang[0] == '\0')
-        lang = "und";
-    /* 5bit ascii */
-    for (i = 0; i < 3; i++) {
-        uint8_t c = lang[i];
-        c -= 0x60;
-        if (c > 0x1f)
-            return -1;
-        code <<= 5;
-        code |= c;
-    }
-    return code;
-}
-
-int ff_mov_lang_to_iso639(unsigned code, char to[4])
-{
-    int i;
-    memset(to, 0, 4);
-    /* is it the mangled iso code? */
-    /* see http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt */
-    if (code > 138) {
-        for (i = 2; i >= 0; i--) {
-            to[i] = 0x60 + (code & 0x1f);
-            code >>= 5;
-        }
-        return 1;
-    }
-    /* old fashion apple lang code */
-    if (code >= FF_ARRAY_ELEMS(mov_mdhd_language_map))
-        return 0;
-    if (!mov_mdhd_language_map[code][0])
-        return 0;
-    memcpy(to, mov_mdhd_language_map[code], 4);
-    return 1;
-}
diff --git a/libavformat/isom.h b/libavformat/isom.h
deleted file mode 100644
index 92997a7..0000000
--- a/libavformat/isom.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * ISO Media common code
- * copyright (c) 2001 Fabrice Bellard
- * copyright (c) 2002 Francois Revol <revol at free.fr>
- * copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier at free.fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_ISOM_H
-#define AVFORMAT_ISOM_H
-
-#include "avio.h"
-#include "riff.h"
-#include "dv.h"
-
-/* isom.c */
-extern const AVCodecTag ff_mp4_obj_type[];
-extern const AVCodecTag codec_movvideo_tags[];
-extern const AVCodecTag codec_movaudio_tags[];
-extern const AVCodecTag ff_codec_movsubtitle_tags[];
-
-int ff_mov_iso639_to_lang(const char lang[4], int mp4);
-int ff_mov_lang_to_iso639(unsigned code, char to[4]);
-
-/* the QuickTime file format is quite convoluted...
- * it has lots of index tables, each indexing something in another one...
- * Here we just use what is needed to read the chunks
- */
-
-typedef struct {
-    int count;
-    int duration;
-} MOVStts;
-
-typedef struct {
-    int first;
-    int count;
-    int id;
-} MOVStsc;
-
-typedef struct {
-    uint32_t type;
-    char *path;
-    char *dir;
-    char volume[28];
-    char filename[64];
-    int16_t nlvl_to, nlvl_from;
-} MOVDref;
-
-typedef struct {
-    uint32_t type;
-    int64_t size; /* total size (excluding the size and type fields) */
-} MOVAtom;
-
-struct MOVParseTableEntry;
-
-typedef struct {
-    unsigned track_id;
-    uint64_t base_data_offset;
-    uint64_t moof_offset;
-    unsigned stsd_id;
-    unsigned duration;
-    unsigned size;
-    unsigned flags;
-} MOVFragment;
-
-typedef struct {
-    unsigned track_id;
-    unsigned stsd_id;
-    unsigned duration;
-    unsigned size;
-    unsigned flags;
-} MOVTrackExt;
-
-typedef struct MOVStreamContext {
-    ByteIOContext *pb;
-    int ffindex;          ///< AVStream index
-    int next_chunk;
-    unsigned int chunk_count;
-    int64_t *chunk_offsets;
-    unsigned int stts_count;
-    MOVStts *stts_data;
-    unsigned int ctts_count;
-    MOVStts *ctts_data;
-    unsigned int stsc_count;
-    MOVStsc *stsc_data;
-    unsigned int stps_count;
-    unsigned *stps_data;  ///< partial sync sample for mpeg-2 open gop
-    int ctts_index;
-    int ctts_sample;
-    unsigned int sample_size;
-    unsigned int sample_count;
-    int *sample_sizes;
-    unsigned int keyframe_count;
-    int *keyframes;
-    int time_scale;
-    int time_offset;      ///< time offset of the first edit list entry
-    int current_sample;
-    unsigned int bytes_per_frame;
-    unsigned int samples_per_frame;
-    int dv_audio_container;
-    int pseudo_stream_id; ///< -1 means demux all ids
-    int16_t audio_cid;    ///< stsd audio compression id
-    unsigned drefs_count;
-    MOVDref *drefs;
-    int dref_id;
-    int wrong_dts;        ///< dts are wrong due to huge ctts offset (iMovie files)
-    int width;            ///< tkhd width
-    int height;           ///< tkhd height
-    int dts_shift;        ///< dts shift when ctts is negative
-} MOVStreamContext;
-
-typedef struct MOVContext {
-    AVFormatContext *fc;
-    int time_scale;
-    int64_t duration;     ///< duration of the longest track
-    int found_moov;       ///< 'moov' atom has been found
-    int found_mdat;       ///< 'mdat' atom has been found
-    DVDemuxContext *dv_demux;
-    AVFormatContext *dv_fctx;
-    int isom;             ///< 1 if file is ISO Media (mp4/3gp)
-    MOVFragment fragment; ///< current fragment in moof atom
-    MOVTrackExt *trex_data;
-    unsigned trex_count;
-    int itunes_metadata;  ///< metadata are itunes style
-    int chapter_track;
-} MOVContext;
-
-int ff_mp4_read_descr_len(ByteIOContext *pb);
-int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom);
-enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags);
-
-#endif /* AVFORMAT_ISOM_H */
diff --git a/libavformat/iss.c b/libavformat/iss.c
deleted file mode 100644
index 156af97..0000000
--- a/libavformat/iss.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * ISS (.iss) file demuxer
- * Copyright (c) 2008 Jaikrishnan Menon <realityman at gmx.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Funcom ISS file demuxer
- * @author Jaikrishnan Menon
- * for more information on the .iss file format, visit:
- * http://wiki.multimedia.cx/index.php?title=FunCom_ISS
- */
-
-#include "avformat.h"
-#include "libavutil/avstring.h"
-
-#define ISS_SIG "IMA_ADPCM_Sound"
-#define ISS_SIG_LEN 15
-#define MAX_TOKEN_SIZE 20
-
-typedef struct {
-    int packet_size;
-    int sample_start_pos;
-} IssDemuxContext;
-
-static void get_token(ByteIOContext *s, char *buf, int maxlen)
-{
-    int i = 0;
-    char c;
-
-    while ((c = get_byte(s))) {
-        if(c == ' ')
-            break;
-        if (i < maxlen-1)
-            buf[i++] = c;
-    }
-
-    if(!c)
-        get_byte(s);
-
-    buf[i] = 0; /* Ensure null terminated, but may be truncated */
-}
-
-static int iss_probe(AVProbeData *p)
-{
-    if (strncmp(p->buf, ISS_SIG, ISS_SIG_LEN))
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    IssDemuxContext *iss = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    char token[MAX_TOKEN_SIZE];
-    int stereo, rate_divisor;
-
-    get_token(pb, token, sizeof(token)); //"IMA_ADPCM_Sound"
-    get_token(pb, token, sizeof(token)); //packet size
-    sscanf(token, "%d", &iss->packet_size);
-    get_token(pb, token, sizeof(token)); //File ID
-    get_token(pb, token, sizeof(token)); //out size
-    get_token(pb, token, sizeof(token)); //stereo
-    sscanf(token, "%d", &stereo);
-    get_token(pb, token, sizeof(token)); //Unknown1
-    get_token(pb, token, sizeof(token)); //RateDivisor
-    sscanf(token, "%d", &rate_divisor);
-    get_token(pb, token, sizeof(token)); //Unknown2
-    get_token(pb, token, sizeof(token)); //Version ID
-    get_token(pb, token, sizeof(token)); //Size
-
-    iss->sample_start_pos = url_ftell(pb);
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_ADPCM_IMA_ISS;
-    st->codec->channels = stereo ? 2 : 1;
-    st->codec->sample_rate = 44100;
-    if(rate_divisor > 0)
-         st->codec->sample_rate /= rate_divisor;
-    st->codec->bits_per_coded_sample = 4;
-    st->codec->bit_rate = st->codec->channels * st->codec->sample_rate
-                                      * st->codec->bits_per_coded_sample;
-    st->codec->block_align = iss->packet_size;
-    av_set_pts_info(st, 32, 1, st->codec->sample_rate);
-
-    return 0;
-}
-
-static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    IssDemuxContext *iss = s->priv_data;
-    int ret = av_get_packet(s->pb, pkt, iss->packet_size);
-
-    if(ret != iss->packet_size)
-        return AVERROR(EIO);
-
-    pkt->stream_index = 0;
-    pkt->pts = url_ftell(s->pb) - iss->sample_start_pos;
-    if(s->streams[0]->codec->channels > 0)
-        pkt->pts /= s->streams[0]->codec->channels*2;
-    return 0;
-}
-
-AVInputFormat iss_demuxer = {
-    "ISS",
-    NULL_IF_CONFIG_SMALL("Funcom ISS format"),
-    sizeof(IssDemuxContext),
-    iss_probe,
-    iss_read_header,
-    iss_read_packet,
-};
-
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
deleted file mode 100644
index 00ddcd4..0000000
--- a/libavformat/iv8.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2009 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-
-static int probe(AVProbeData *p)
-{
-    // the single file i have starts with that, i dont know if others do too
-    if(   p->buf[0] == 1
-       && p->buf[1] == 1
-       && p->buf[2] == 3
-       && p->buf[3] == 0xB8
-       && p->buf[4] == 0x80
-       && p->buf[5] == 0x60
-      )
-        return AVPROBE_SCORE_MAX-2;
-
-    return 0;
-}
-
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    AVStream *st;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_MPEG4;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-    av_set_pts_info(st, 64, 1, 90000);
-
-    return 0;
-
-}
-
-static int read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, size, pts, type;
-retry:
-    type= get_be16(s->pb); // 257 or 258
-    size= get_be16(s->pb);
-
-    get_be16(s->pb); //some flags, 0x80 indicates end of frame
-    get_be16(s->pb); //packet number
-    pts=get_be32(s->pb);
-    get_be32(s->pb); //6A 13 E3 88
-
-    size -= 12;
-    if(size<1)
-        return -1;
-
-    if(type==258){
-        url_fskip(s->pb, size);
-        goto retry;
-    }
-
-    ret= av_get_packet(s->pb, pkt, size);
-
-    pkt->pts= pts;
-    pkt->pos-=16;
-
-    pkt->stream_index = 0;
-
-    return ret;
-}
-
-AVInputFormat iv8_demuxer = {
-    "iv8",
-    NULL_IF_CONFIG_SMALL("A format generated by IndigoVision 8000 video server"),
-    0,
-    probe,
-    read_header,
-    read_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .value = CODEC_ID_MPEG4,
-};
diff --git a/libavformat/libavformat.v b/libavformat/libavformat.v
deleted file mode 100644
index da2311e..0000000
--- a/libavformat/libavformat.v
+++ /dev/null
@@ -1,3 +0,0 @@
-LIBAVFORMAT_$MAJOR {
-        global: *;
-};
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
deleted file mode 100644
index 4543df7..0000000
--- a/libavformat/libnut.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * NUT (de)muxing via libnut
- * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * NUT demuxing and muxing via libnut.
- * @author Oded Shimon <ods15 at ods15.dyndns.org>
- */
-
-#include "avformat.h"
-#include "riff.h"
-#include <libnut.h>
-
-#define ID_STRING "nut/multimedia container"
-#define ID_LENGTH (strlen(ID_STRING) + 1)
-
-typedef struct {
-    nut_context_tt * nut;
-    nut_stream_header_tt * s;
-} NUTContext;
-
-static const AVCodecTag nut_tags[] = {
-    { CODEC_ID_MPEG4,  MKTAG('m', 'p', '4', 'v') },
-    { CODEC_ID_MP3,    MKTAG('m', 'p', '3', ' ') },
-    { CODEC_ID_VORBIS, MKTAG('v', 'r', 'b', 's') },
-    { 0, 0 },
-};
-
-#if CONFIG_LIBNUT_MUXER
-static int av_write(void * h, size_t len, const uint8_t * buf) {
-    ByteIOContext * bc = h;
-    put_buffer(bc, buf, len);
-    //put_flush_packet(bc);
-    return len;
-}
-
-static int nut_write_header(AVFormatContext * avf) {
-    NUTContext * priv = avf->priv_data;
-    ByteIOContext * bc = avf->pb;
-    nut_muxer_opts_tt mopts = {
-        .output = {
-            .priv = bc,
-            .write = av_write,
-        },
-        .alloc = { av_malloc, av_realloc, av_free },
-        .write_index = 1,
-        .realtime_stream = 0,
-        .max_distance = 32768,
-        .fti = NULL,
-    };
-    nut_stream_header_tt * s;
-    int i;
-
-    priv->s = s = av_mallocz((avf->nb_streams + 1) * sizeof*s);
-
-    for (i = 0; i < avf->nb_streams; i++) {
-        AVCodecContext * codec = avf->streams[i]->codec;
-        int j;
-        int fourcc = 0;
-        int num, denom, ssize;
-
-        s[i].type = codec->codec_type == AVMEDIA_TYPE_VIDEO ? NUT_VIDEO_CLASS : NUT_AUDIO_CLASS;
-
-        if (codec->codec_tag) fourcc = codec->codec_tag;
-        else fourcc = ff_codec_get_tag(nut_tags, codec->codec_id);
-
-        if (!fourcc) {
-            if (codec->codec_type == AVMEDIA_TYPE_VIDEO) fourcc = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id);
-            if (codec->codec_type == AVMEDIA_TYPE_AUDIO) fourcc = ff_codec_get_tag(ff_codec_wav_tags, codec->codec_id);
-        }
-
-        s[i].fourcc_len = 4;
-        s[i].fourcc = av_malloc(s[i].fourcc_len);
-        for (j = 0; j < s[i].fourcc_len; j++) s[i].fourcc[j] = (fourcc >> (j*8)) & 0xFF;
-
-        ff_parse_specific_params(codec, &num, &ssize, &denom);
-        av_set_pts_info(avf->streams[i], 60, denom, num);
-
-        s[i].time_base.num = denom;
-        s[i].time_base.den = num;
-
-        s[i].fixed_fps = 0;
-        s[i].decode_delay = codec->has_b_frames;
-        s[i].codec_specific_len = codec->extradata_size;
-        s[i].codec_specific = codec->extradata;
-
-        if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            s[i].width = codec->width;
-            s[i].height = codec->height;
-            s[i].sample_width = 0;
-            s[i].sample_height = 0;
-            s[i].colorspace_type = 0;
-        } else {
-            s[i].samplerate_num = codec->sample_rate;
-            s[i].samplerate_denom = 1;
-            s[i].channel_count = codec->channels;
-        }
-    }
-
-    s[avf->nb_streams].type = -1;
-    priv->nut = nut_muxer_init(&mopts, s, NULL);
-
-    return 0;
-}
-
-static int nut_write_packet(AVFormatContext * avf, AVPacket * pkt) {
-    NUTContext * priv = avf->priv_data;
-    nut_packet_tt p;
-
-    p.len = pkt->size;
-    p.stream = pkt->stream_index;
-    p.pts = pkt->pts;
-    p.flags = pkt->flags & AV_PKT_FLAG_KEY ? NUT_FLAG_KEY : 0;
-    p.next_pts = 0;
-
-    nut_write_frame_reorder(priv->nut, &p, pkt->data);
-
-    return 0;
-}
-
-static int nut_write_trailer(AVFormatContext * avf) {
-    ByteIOContext * bc = avf->pb;
-    NUTContext * priv = avf->priv_data;
-    int i;
-
-    nut_muxer_uninit_reorder(priv->nut);
-    put_flush_packet(bc);
-
-    for(i = 0; priv->s[i].type != -1; i++ ) av_freep(&priv->s[i].fourcc);
-    av_freep(&priv->s);
-
-    return 0;
-}
-
-AVOutputFormat libnut_muxer = {
-    "libnut",
-    "nut format",
-    "video/x-nut",
-    "nut",
-    sizeof(NUTContext),
-    CODEC_ID_VORBIS,
-    CODEC_ID_MPEG4,
-    nut_write_header,
-    nut_write_packet,
-    nut_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-};
-#endif /* CONFIG_LIBNUT_MUXER */
-
-static int nut_probe(AVProbeData *p) {
-    if (!memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
-
-    return 0;
-}
-
-static size_t av_read(void * h, size_t len, uint8_t * buf) {
-    ByteIOContext * bc = h;
-    return get_buffer(bc, buf, len);
-}
-
-static off_t av_seek(void * h, long long pos, int whence) {
-    ByteIOContext * bc = h;
-    if (whence == SEEK_END) {
-        pos = url_fsize(bc) + pos;
-        whence = SEEK_SET;
-    }
-    return url_fseek(bc, pos, whence);
-}
-
-static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
-    NUTContext * priv = avf->priv_data;
-    ByteIOContext * bc = avf->pb;
-    nut_demuxer_opts_tt dopts = {
-        .input = {
-            .priv = bc,
-            .seek = av_seek,
-            .read = av_read,
-            .eof = NULL,
-            .file_pos = 0,
-        },
-        .alloc = { av_malloc, av_realloc, av_free },
-        .read_index = 1,
-        .cache_syncpoints = 1,
-    };
-    nut_context_tt * nut = priv->nut = nut_demuxer_init(&dopts);
-    nut_stream_header_tt * s;
-    int ret, i;
-
-    if ((ret = nut_read_headers(nut, &s, NULL))) {
-        av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(ret));
-        nut_demuxer_uninit(nut);
-        return -1;
-    }
-
-    priv->s = s;
-
-    for (i = 0; s[i].type != -1 && i < 2; i++) {
-        AVStream * st = av_new_stream(avf, i);
-        int j;
-
-        for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->codec->codec_tag |= s[i].fourcc[j]<<(j*8);
-
-        st->codec->has_b_frames = s[i].decode_delay;
-
-        st->codec->extradata_size = s[i].codec_specific_len;
-        if (st->codec->extradata_size) {
-            st->codec->extradata = av_mallocz(st->codec->extradata_size);
-            memcpy(st->codec->extradata, s[i].codec_specific, st->codec->extradata_size);
-        }
-
-        av_set_pts_info(avf->streams[i], 60, s[i].time_base.num, s[i].time_base.den);
-        st->start_time = 0;
-        st->duration = s[i].max_pts;
-
-        st->codec->codec_id = ff_codec_get_id(nut_tags, st->codec->codec_tag);
-
-        switch(s[i].type) {
-        case NUT_AUDIO_CLASS:
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, st->codec->codec_tag);
-
-            st->codec->channels = s[i].channel_count;
-            st->codec->sample_rate = s[i].samplerate_num / s[i].samplerate_denom;
-            break;
-        case NUT_VIDEO_CLASS:
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag);
-
-            st->codec->width = s[i].width;
-            st->codec->height = s[i].height;
-            st->sample_aspect_ratio.num = s[i].sample_width;
-            st->sample_aspect_ratio.den = s[i].sample_height;
-            break;
-        }
-        if (st->codec->codec_id == CODEC_ID_NONE) av_log(avf, AV_LOG_ERROR, "Unknown codec?!\n");
-    }
-
-    return 0;
-}
-
-static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
-    NUTContext * priv = avf->priv_data;
-    nut_packet_tt pd;
-    int ret;
-
-    ret = nut_read_next_packet(priv->nut, &pd);
-
-    if (ret || av_new_packet(pkt, pd.len) < 0) {
-        if (ret != NUT_ERR_EOF)
-            av_log(avf, AV_LOG_ERROR, " NUT error: %s\n", nut_error(ret));
-        return -1;
-    }
-
-    if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY;
-    pkt->pts = pd.pts;
-    pkt->stream_index = pd.stream;
-    pkt->pos = url_ftell(avf->pb);
-
-    ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
-
-    return ret;
-}
-
-static int nut_read_seek(AVFormatContext * avf, int stream_index, int64_t target_ts, int flags) {
-    NUTContext * priv = avf->priv_data;
-    int active_streams[] = { stream_index, -1 };
-    double time_pos = target_ts * priv->s[stream_index].time_base.num / (double)priv->s[stream_index].time_base.den;
-
-    if (nut_seek(priv->nut, time_pos, 2*!(flags & AVSEEK_FLAG_BACKWARD), active_streams)) return -1;
-
-    return 0;
-}
-
-static int nut_read_close(AVFormatContext *s) {
-    NUTContext * priv = s->priv_data;
-
-    nut_demuxer_uninit(priv->nut);
-
-    return 0;
-}
-
-AVInputFormat libnut_demuxer = {
-    "libnut",
-    NULL_IF_CONFIG_SMALL("NUT format"),
-    sizeof(NUTContext),
-    nut_probe,
-    nut_read_header,
-    nut_read_packet,
-    nut_read_close,
-    nut_read_seek,
-    .extensions = "nut",
-};
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
deleted file mode 100644
index d765102..0000000
--- a/libavformat/librtmp.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * RTMP network protocol
- * Copyright (c) 2010 Howard Chu
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RTMP protocol based on http://rtmpdump.mplayerhq.hu/ librtmp
- */
-
-#include "avformat.h"
-
-#include <librtmp/rtmp.h>
-#include <librtmp/log.h>
-
-static void rtmp_log(int level, const char *fmt, va_list args)
-{
-    switch (level) {
-    default:
-    case RTMP_LOGCRIT:    level = AV_LOG_FATAL;   break;
-    case RTMP_LOGERROR:   level = AV_LOG_ERROR;   break;
-    case RTMP_LOGWARNING: level = AV_LOG_WARNING; break;
-    case RTMP_LOGINFO:    level = AV_LOG_INFO;    break;
-    case RTMP_LOGDEBUG:   level = AV_LOG_VERBOSE; break;
-    case RTMP_LOGDEBUG2:  level = AV_LOG_DEBUG;   break;
-    }
-
-    av_vlog(NULL, level, fmt, args);
-    av_log(NULL, level, "\n");
-}
-
-static int rtmp_close(URLContext *s)
-{
-    RTMP *r = s->priv_data;
-
-    RTMP_Close(r);
-    av_free(r);
-    return 0;
-}
-
-/**
- * Opens RTMP connection and verifies that the stream can be played.
- *
- * URL syntax: rtmp://server[:port][/app][/playpath][ keyword=value]...
- *             where 'app' is first one or two directories in the path
- *             (e.g. /ondemand/, /flash/live/, etc.)
- *             and 'playpath' is a file name (the rest of the path,
- *             may be prefixed with "mp4:")
- *
- *             Additional RTMP library options may be appended as
- *             space-separated key-value pairs.
- */
-static int rtmp_open(URLContext *s, const char *uri, int flags)
-{
-    RTMP *r;
-    int rc;
-
-    r = av_mallocz(sizeof(RTMP));
-    if (!r)
-        return AVERROR(ENOMEM);
-
-    switch (av_log_get_level()) {
-    default:
-    case AV_LOG_FATAL:   rc = RTMP_LOGCRIT;    break;
-    case AV_LOG_ERROR:   rc = RTMP_LOGERROR;   break;
-    case AV_LOG_WARNING: rc = RTMP_LOGWARNING; break;
-    case AV_LOG_INFO:    rc = RTMP_LOGINFO;    break;
-    case AV_LOG_VERBOSE: rc = RTMP_LOGDEBUG;   break;
-    case AV_LOG_DEBUG:   rc = RTMP_LOGDEBUG2;  break;
-    }
-    RTMP_LogSetLevel(rc);
-    RTMP_LogSetCallback(rtmp_log);
-
-    RTMP_Init(r);
-    if (!RTMP_SetupURL(r, s->filename)) {
-        rc = -1;
-        goto fail;
-    }
-
-    if (flags & URL_WRONLY)
-        r->Link.protocol |= RTMP_FEATURE_WRITE;
-
-    if (!RTMP_Connect(r, NULL) || !RTMP_ConnectStream(r, 0)) {
-        rc = -1;
-        goto fail;
-    }
-
-    s->priv_data   = r;
-    s->is_streamed = 1;
-    return 0;
-fail:
-    av_free(r);
-    return rc;
-}
-
-static int rtmp_write(URLContext *s, uint8_t *buf, int size)
-{
-    RTMP *r = s->priv_data;
-
-    return RTMP_Write(r, buf, size);
-}
-
-static int rtmp_read(URLContext *s, uint8_t *buf, int size)
-{
-    RTMP *r = s->priv_data;
-
-    return RTMP_Read(r, buf, size);
-}
-
-static int rtmp_read_pause(URLContext *s, int pause)
-{
-    RTMP *r = s->priv_data;
-
-    if (pause)
-        r->m_pauseStamp =
-            r->m_channelTimestamp[r->m_mediaChannel];
-    if (!RTMP_SendPause(r, pause, r->m_pauseStamp))
-        return -1;
-    return 0;
-}
-
-static int64_t rtmp_read_seek(URLContext *s, int stream_index,
-                              int64_t timestamp, int flags)
-{
-    RTMP *r = s->priv_data;
-
-    if (flags & AVSEEK_FLAG_BYTE)
-        return AVERROR(ENOSYS);
-
-    /* seeks are in milliseconds */
-    if (stream_index < 0)
-        timestamp = av_rescale_rnd(timestamp, 1000, AV_TIME_BASE,
-            flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP);
-
-    if (!RTMP_SendSeek(r, timestamp))
-        return -1;
-    return timestamp;
-}
-
-static int rtmp_get_file_handle(URLContext *s)
-{
-    RTMP *r = s->priv_data;
-
-    return r->m_sb.sb_socket;
-}
-
-URLProtocol rtmp_protocol = {
-    "rtmp",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
-};
-
-URLProtocol rtmpt_protocol = {
-    "rtmpt",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
-};
-
-URLProtocol rtmpe_protocol = {
-    "rtmpe",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
-};
-
-URLProtocol rtmpte_protocol = {
-    "rtmpte",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
-};
-
-URLProtocol rtmps_protocol = {
-    "rtmps",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL,                   /* seek */
-    rtmp_close,
-    NULL,                   /* next */
-    rtmp_read_pause,
-    rtmp_read_seek,
-    rtmp_get_file_handle
-};
diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
deleted file mode 100644
index c1397fb..0000000
--- a/libavformat/lmlm4.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Linux Media Labs MPEG-4 demuxer
- * Copyright (c) 2008 Ivo van Poorten
- *
- * Due to a lack of sample files, only files with one channel are supported.
- * u-law and ADPCM audio are unsupported for the same reason.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define LMLM4_I_FRAME   0x00
-#define LMLM4_P_FRAME   0x01
-#define LMLM4_B_FRAME   0x02
-#define LMLM4_INVALID   0x03
-#define LMLM4_MPEG1L2   0x04
-
-#define LMLM4_MAX_PACKET_SIZE   1024 * 1024
-
-static int lmlm4_probe(AVProbeData * pd) {
-    unsigned char *buf = pd->buf;
-    unsigned int frame_type, packet_size;
-
-    frame_type  = AV_RB16(buf+2);
-    packet_size = AV_RB32(buf+4);
-
-    if (!AV_RB16(buf) && frame_type <= LMLM4_MPEG1L2 && packet_size &&
-        frame_type != LMLM4_INVALID && packet_size <= LMLM4_MAX_PACKET_SIZE) {
-
-        if (frame_type == LMLM4_MPEG1L2) {
-            if ((AV_RB16(buf+8) & 0xfffe) != 0xfffc)
-                return 0;
-            /* I could calculate the audio framesize and compare with
-             * packet_size-8, but that seems overkill */
-            return AVPROBE_SCORE_MAX / 3;
-        } else if (AV_RB24(buf+8) == 0x000001) {    /* PES Signal */
-            return AVPROBE_SCORE_MAX / 5;
-        }
-    }
-
-    return 0;
-}
-
-static int lmlm4_read_header(AVFormatContext *s, AVFormatParameters *ap) {
-    AVStream *st;
-
-    if (!(st = av_new_stream(s, 0)))
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_MPEG4;
-    st->need_parsing      = AVSTREAM_PARSE_HEADERS;
-    av_set_pts_info(st, 64, 1001, 30000);
-
-    if (!(st = av_new_stream(s, 1)))
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id   = CODEC_ID_MP2;
-    st->need_parsing      = AVSTREAM_PARSE_HEADERS;
-
-    /* the parameters will be extracted from the compressed bitstream */
-    return 0;
-}
-
-static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
-    int ret;
-    unsigned int frame_type, packet_size, padding, frame_size;
-
-    get_be16(pb);                       /* channel number */
-    frame_type  = get_be16(pb);
-    packet_size = get_be32(pb);
-    padding     = -packet_size & 511;
-    frame_size  = packet_size - 8;
-
-    if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) {
-        av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n");
-        return AVERROR(EIO);
-    }
-    if (packet_size > LMLM4_MAX_PACKET_SIZE) {
-        av_log(s, AV_LOG_ERROR, "packet size exceeds maximum\n");
-        return AVERROR(EIO);
-    }
-
-    if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
-        return AVERROR(EIO);
-
-    url_fskip(pb, padding);
-
-    switch (frame_type) {
-        case LMLM4_I_FRAME:
-            pkt->flags = AV_PKT_FLAG_KEY;
-        case LMLM4_P_FRAME:
-        case LMLM4_B_FRAME:
-            pkt->stream_index = 0;
-            break;
-        case LMLM4_MPEG1L2:
-            pkt->stream_index = 1;
-            break;
-    }
-
-    return ret;
-}
-
-AVInputFormat lmlm4_demuxer = {
-    "lmlm4",
-    NULL_IF_CONFIG_SMALL("lmlm4 raw format"),
-    0,
-    lmlm4_probe,
-    lmlm4_read_header,
-    lmlm4_read_packet,
-};
diff --git a/libavformat/matroska.c b/libavformat/matroska.c
deleted file mode 100644
index dac4735..0000000
--- a/libavformat/matroska.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Matroska common data
- * Copyright (c) 2003-2004 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "matroska.h"
-
-const CodecTags ff_mkv_codec_tags[]={
-    {"A_AAC"            , CODEC_ID_AAC},
-    {"A_AC3"            , CODEC_ID_AC3},
-    {"A_DTS"            , CODEC_ID_DTS},
-    {"A_EAC3"           , CODEC_ID_EAC3},
-    {"A_FLAC"           , CODEC_ID_FLAC},
-    {"A_MLP"            , CODEC_ID_MLP},
-    {"A_MPEG/L2"        , CODEC_ID_MP2},
-    {"A_MPEG/L1"        , CODEC_ID_MP2},
-    {"A_MPEG/L3"        , CODEC_ID_MP3},
-    {"A_PCM/FLOAT/IEEE" , CODEC_ID_PCM_F32LE},
-    {"A_PCM/FLOAT/IEEE" , CODEC_ID_PCM_F64LE},
-    {"A_PCM/INT/BIG"    , CODEC_ID_PCM_S16BE},
-    {"A_PCM/INT/BIG"    , CODEC_ID_PCM_S24BE},
-    {"A_PCM/INT/BIG"    , CODEC_ID_PCM_S32BE},
-    {"A_PCM/INT/LIT"    , CODEC_ID_PCM_S16LE},
-    {"A_PCM/INT/LIT"    , CODEC_ID_PCM_S24LE},
-    {"A_PCM/INT/LIT"    , CODEC_ID_PCM_S32LE},
-    {"A_PCM/INT/LIT"    , CODEC_ID_PCM_U8},
-    {"A_QUICKTIME/QDM2" , CODEC_ID_QDM2},
-    {"A_REAL/14_4"      , CODEC_ID_RA_144},
-    {"A_REAL/28_8"      , CODEC_ID_RA_288},
-    {"A_REAL/ATRC"      , CODEC_ID_ATRAC3},
-    {"A_REAL/COOK"      , CODEC_ID_COOK},
-    {"A_REAL/SIPR"      , CODEC_ID_SIPR},
-    {"A_TRUEHD"         , CODEC_ID_TRUEHD},
-    {"A_TTA1"           , CODEC_ID_TTA},
-    {"A_VORBIS"         , CODEC_ID_VORBIS},
-    {"A_WAVPACK4"       , CODEC_ID_WAVPACK},
-
-    {"S_TEXT/UTF8"      , CODEC_ID_TEXT},
-    {"S_TEXT/ASCII"     , CODEC_ID_TEXT},
-    {"S_TEXT/ASS"       , CODEC_ID_SSA},
-    {"S_TEXT/SSA"       , CODEC_ID_SSA},
-    {"S_ASS"            , CODEC_ID_SSA},
-    {"S_SSA"            , CODEC_ID_SSA},
-    {"S_VOBSUB"         , CODEC_ID_DVD_SUBTITLE},
-    {"S_HDMV/PGS"       , CODEC_ID_HDMV_PGS_SUBTITLE},
-
-    {"V_DIRAC"          , CODEC_ID_DIRAC},
-    {"V_MJPEG"          , CODEC_ID_MJPEG},
-    {"V_MPEG1"          , CODEC_ID_MPEG1VIDEO},
-    {"V_MPEG2"          , CODEC_ID_MPEG2VIDEO},
-    {"V_MPEG4/ISO/ASP"  , CODEC_ID_MPEG4},
-    {"V_MPEG4/ISO/AP"   , CODEC_ID_MPEG4},
-    {"V_MPEG4/ISO/SP"   , CODEC_ID_MPEG4},
-    {"V_MPEG4/ISO/AVC"  , CODEC_ID_H264},
-    {"V_MPEG4/MS/V3"    , CODEC_ID_MSMPEG4V3},
-    {"V_REAL/RV10"      , CODEC_ID_RV10},
-    {"V_REAL/RV20"      , CODEC_ID_RV20},
-    {"V_REAL/RV30"      , CODEC_ID_RV30},
-    {"V_REAL/RV40"      , CODEC_ID_RV40},
-    {"V_SNOW"           , CODEC_ID_SNOW},
-    {"V_THEORA"         , CODEC_ID_THEORA},
-    {"V_UNCOMPRESSED"   , CODEC_ID_RAWVIDEO},
-    {"V_VP8"            , CODEC_ID_VP8},
-
-    {""                 , CODEC_ID_NONE}
-};
-
-const CodecMime ff_mkv_mime_tags[] = {
-    {"text/plain"                 , CODEC_ID_TEXT},
-    {"image/gif"                  , CODEC_ID_GIF},
-    {"image/jpeg"                 , CODEC_ID_MJPEG},
-    {"image/png"                  , CODEC_ID_PNG},
-    {"image/tiff"                 , CODEC_ID_TIFF},
-    {"application/x-truetype-font", CODEC_ID_TTF},
-    {"application/x-font"         , CODEC_ID_TTF},
-
-    {""                           , CODEC_ID_NONE}
-};
-
-const AVMetadataConv ff_mkv_metadata_conv[] = {
-    { "LEAD_PERFORMER", "performer" },
-    { "PART_NUMBER"   , "track"  },
-    { 0 }
-};
diff --git a/libavformat/matroska.h b/libavformat/matroska.h
deleted file mode 100644
index 40ab3a7..0000000
--- a/libavformat/matroska.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Matroska constants
- * Copyright (c) 2003-2004 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_MATROSKA_H
-#define AVFORMAT_MATROSKA_H
-
-#include "libavcodec/avcodec.h"
-#include "metadata.h"
-
-/* EBML version supported */
-#define EBML_VERSION 1
-
-/* top-level master-IDs */
-#define EBML_ID_HEADER             0x1A45DFA3
-
-/* IDs in the HEADER master */
-#define EBML_ID_EBMLVERSION        0x4286
-#define EBML_ID_EBMLREADVERSION    0x42F7
-#define EBML_ID_EBMLMAXIDLENGTH    0x42F2
-#define EBML_ID_EBMLMAXSIZELENGTH  0x42F3
-#define EBML_ID_DOCTYPE            0x4282
-#define EBML_ID_DOCTYPEVERSION     0x4287
-#define EBML_ID_DOCTYPEREADVERSION 0x4285
-
-/* general EBML types */
-#define EBML_ID_VOID               0xEC
-#define EBML_ID_CRC32              0xBF
-
-/*
- * Matroska element IDs, max. 32 bits
- */
-
-/* toplevel segment */
-#define MATROSKA_ID_SEGMENT    0x18538067
-
-/* Matroska top-level master IDs */
-#define MATROSKA_ID_INFO       0x1549A966
-#define MATROSKA_ID_TRACKS     0x1654AE6B
-#define MATROSKA_ID_CUES       0x1C53BB6B
-#define MATROSKA_ID_TAGS       0x1254C367
-#define MATROSKA_ID_SEEKHEAD   0x114D9B74
-#define MATROSKA_ID_ATTACHMENTS 0x1941A469
-#define MATROSKA_ID_CLUSTER    0x1F43B675
-#define MATROSKA_ID_CHAPTERS   0x1043A770
-
-/* IDs in the info master */
-#define MATROSKA_ID_TIMECODESCALE 0x2AD7B1
-#define MATROSKA_ID_DURATION   0x4489
-#define MATROSKA_ID_TITLE      0x7BA9
-#define MATROSKA_ID_WRITINGAPP 0x5741
-#define MATROSKA_ID_MUXINGAPP  0x4D80
-#define MATROSKA_ID_DATEUTC    0x4461
-#define MATROSKA_ID_SEGMENTUID 0x73A4
-
-/* ID in the tracks master */
-#define MATROSKA_ID_TRACKENTRY 0xAE
-
-/* IDs in the trackentry master */
-#define MATROSKA_ID_TRACKNUMBER 0xD7
-#define MATROSKA_ID_TRACKUID   0x73C5
-#define MATROSKA_ID_TRACKTYPE  0x83
-#define MATROSKA_ID_TRACKAUDIO 0xE1
-#define MATROSKA_ID_TRACKVIDEO 0xE0
-#define MATROSKA_ID_CODECID    0x86
-#define MATROSKA_ID_CODECPRIVATE 0x63A2
-#define MATROSKA_ID_CODECNAME  0x258688
-#define MATROSKA_ID_CODECINFOURL 0x3B4040
-#define MATROSKA_ID_CODECDOWNLOADURL 0x26B240
-#define MATROSKA_ID_CODECDECODEALL 0xAA
-#define MATROSKA_ID_TRACKNAME  0x536E
-#define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
-#define MATROSKA_ID_TRACKFLAGENABLED 0xB9
-#define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
-#define MATROSKA_ID_TRACKFLAGFORCED 0x55AA
-#define MATROSKA_ID_TRACKFLAGLACING 0x9C
-#define MATROSKA_ID_TRACKMINCACHE 0x6DE7
-#define MATROSKA_ID_TRACKMAXCACHE 0x6DF8
-#define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
-#define MATROSKA_ID_TRACKCONTENTENCODINGS 0x6D80
-#define MATROSKA_ID_TRACKCONTENTENCODING 0x6240
-#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
-#define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
-
-/* IDs in the trackvideo master */
-#define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
-#define MATROSKA_ID_VIDEODISPLAYWIDTH 0x54B0
-#define MATROSKA_ID_VIDEODISPLAYHEIGHT 0x54BA
-#define MATROSKA_ID_VIDEOPIXELWIDTH 0xB0
-#define MATROSKA_ID_VIDEOPIXELHEIGHT 0xBA
-#define MATROSKA_ID_VIDEOPIXELCROPB 0x54AA
-#define MATROSKA_ID_VIDEOPIXELCROPT 0x54BB
-#define MATROSKA_ID_VIDEOPIXELCROPL 0x54CC
-#define MATROSKA_ID_VIDEOPIXELCROPR 0x54DD
-#define MATROSKA_ID_VIDEODISPLAYUNIT 0x54B2
-#define MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
-#define MATROSKA_ID_VIDEOSTEREOMODE 0x53B9
-#define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
-#define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
-
-/* IDs in the trackaudio master */
-#define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
-#define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ 0x78B5
-
-#define MATROSKA_ID_AUDIOBITDEPTH 0x6264
-#define MATROSKA_ID_AUDIOCHANNELS 0x9F
-
-/* IDs in the content encoding master */
-#define MATROSKA_ID_ENCODINGORDER 0x5031
-#define MATROSKA_ID_ENCODINGSCOPE 0x5032
-#define MATROSKA_ID_ENCODINGTYPE 0x5033
-#define MATROSKA_ID_ENCODINGCOMPRESSION 0x5034
-#define MATROSKA_ID_ENCODINGCOMPALGO 0x4254
-#define MATROSKA_ID_ENCODINGCOMPSETTINGS 0x4255
-
-/* ID in the cues master */
-#define MATROSKA_ID_POINTENTRY 0xBB
-
-/* IDs in the pointentry master */
-#define MATROSKA_ID_CUETIME    0xB3
-#define MATROSKA_ID_CUETRACKPOSITION 0xB7
-
-/* IDs in the cuetrackposition master */
-#define MATROSKA_ID_CUETRACK   0xF7
-#define MATROSKA_ID_CUECLUSTERPOSITION 0xF1
-#define MATROSKA_ID_CUEBLOCKNUMBER 0x5378
-
-/* IDs in the tags master */
-#define MATROSKA_ID_TAG                 0x7373
-#define MATROSKA_ID_SIMPLETAG           0x67C8
-#define MATROSKA_ID_TAGNAME             0x45A3
-#define MATROSKA_ID_TAGSTRING           0x4487
-#define MATROSKA_ID_TAGLANG             0x447A
-#define MATROSKA_ID_TAGDEFAULT          0x44B4
-#define MATROSKA_ID_TAGTARGETS          0x63C0
-#define MATROSKA_ID_TAGTARGETS_TYPE       0x63CA
-#define MATROSKA_ID_TAGTARGETS_TYPEVALUE  0x68CA
-#define MATROSKA_ID_TAGTARGETS_TRACKUID   0x63C5
-#define MATROSKA_ID_TAGTARGETS_CHAPTERUID 0x63C4
-#define MATROSKA_ID_TAGTARGETS_ATTACHUID  0x63C6
-
-/* IDs in the seekhead master */
-#define MATROSKA_ID_SEEKENTRY  0x4DBB
-
-/* IDs in the seekpoint master */
-#define MATROSKA_ID_SEEKID     0x53AB
-#define MATROSKA_ID_SEEKPOSITION 0x53AC
-
-/* IDs in the cluster master */
-#define MATROSKA_ID_CLUSTERTIMECODE 0xE7
-#define MATROSKA_ID_CLUSTERPOSITION 0xA7
-#define MATROSKA_ID_CLUSTERPREVSIZE 0xAB
-#define MATROSKA_ID_BLOCKGROUP 0xA0
-#define MATROSKA_ID_SIMPLEBLOCK 0xA3
-
-/* IDs in the blockgroup master */
-#define MATROSKA_ID_BLOCK      0xA1
-#define MATROSKA_ID_BLOCKDURATION 0x9B
-#define MATROSKA_ID_BLOCKREFERENCE 0xFB
-
-/* IDs in the attachments master */
-#define MATROSKA_ID_ATTACHEDFILE        0x61A7
-#define MATROSKA_ID_FILEDESC            0x467E
-#define MATROSKA_ID_FILENAME            0x466E
-#define MATROSKA_ID_FILEMIMETYPE        0x4660
-#define MATROSKA_ID_FILEDATA            0x465C
-#define MATROSKA_ID_FILEUID             0x46AE
-
-/* IDs in the chapters master */
-#define MATROSKA_ID_EDITIONENTRY        0x45B9
-#define MATROSKA_ID_CHAPTERATOM         0xB6
-#define MATROSKA_ID_CHAPTERTIMESTART    0x91
-#define MATROSKA_ID_CHAPTERTIMEEND      0x92
-#define MATROSKA_ID_CHAPTERDISPLAY      0x80
-#define MATROSKA_ID_CHAPSTRING          0x85
-#define MATROSKA_ID_CHAPLANG            0x437C
-#define MATROSKA_ID_EDITIONUID          0x45BC
-#define MATROSKA_ID_EDITIONFLAGHIDDEN   0x45BD
-#define MATROSKA_ID_EDITIONFLAGDEFAULT  0x45DB
-#define MATROSKA_ID_EDITIONFLAGORDERED  0x45DD
-#define MATROSKA_ID_CHAPTERUID          0x73C4
-#define MATROSKA_ID_CHAPTERFLAGHIDDEN   0x98
-#define MATROSKA_ID_CHAPTERFLAGENABLED  0x4598
-#define MATROSKA_ID_CHAPTERPHYSEQUIV    0x63C3
-
-typedef enum {
-  MATROSKA_TRACK_TYPE_NONE     = 0x0,
-  MATROSKA_TRACK_TYPE_VIDEO    = 0x1,
-  MATROSKA_TRACK_TYPE_AUDIO    = 0x2,
-  MATROSKA_TRACK_TYPE_COMPLEX  = 0x3,
-  MATROSKA_TRACK_TYPE_LOGO     = 0x10,
-  MATROSKA_TRACK_TYPE_SUBTITLE = 0x11,
-  MATROSKA_TRACK_TYPE_CONTROL  = 0x20,
-} MatroskaTrackType;
-
-typedef enum {
-  MATROSKA_TRACK_ENCODING_COMP_ZLIB        = 0,
-  MATROSKA_TRACK_ENCODING_COMP_BZLIB       = 1,
-  MATROSKA_TRACK_ENCODING_COMP_LZO         = 2,
-  MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP = 3,
-} MatroskaTrackEncodingCompAlgo;
-
-/*
- * Matroska Codec IDs, strings
- */
-
-typedef struct CodecTags{
-    char str[20];
-    enum CodecID id;
-}CodecTags;
-
-typedef struct CodecMime{
-    char str[32];
-    enum CodecID id;
-}CodecMime;
-
-/* max. depth in the EBML tree structure */
-#define EBML_MAX_DEPTH 16
-
-extern const CodecTags ff_mkv_codec_tags[];
-extern const CodecMime ff_mkv_mime_tags[];
-extern const AVMetadataConv ff_mkv_metadata_conv[];
-
-#endif /* AVFORMAT_MATROSKA_H */
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
deleted file mode 100644
index e254a31..0000000
--- a/libavformat/matroskadec.c
+++ /dev/null
@@ -1,1891 +0,0 @@
-/*
- * Matroska file demuxer
- * Copyright (c) 2003-2008 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Matroska file demuxer
- * by Ronald Bultje <rbultje at ronald.bitfreak.net>
- * with a little help from Moritz Bunkus <moritz at bunkus.org>
- * totally reworked by Aurelien Jacobs <aurel at gnuage.org>
- * Specs available on the Matroska project page: http://www.matroska.org/.
- */
-
-#include <stdio.h>
-#include "avformat.h"
-#include "internal.h"
-/* For ff_codec_get_id(). */
-#include "riff.h"
-#include "isom.h"
-#include "rm.h"
-#include "matroska.h"
-#include "libavcodec/mpeg4audio.h"
-#include "libavutil/intfloat_readwrite.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/avstring.h"
-#include "libavutil/lzo.h"
-#if CONFIG_ZLIB
-#include <zlib.h>
-#endif
-#if CONFIG_BZLIB
-#include <bzlib.h>
-#endif
-
-typedef enum {
-    EBML_NONE,
-    EBML_UINT,
-    EBML_FLOAT,
-    EBML_STR,
-    EBML_UTF8,
-    EBML_BIN,
-    EBML_NEST,
-    EBML_PASS,
-    EBML_STOP,
-} EbmlType;
-
-typedef const struct EbmlSyntax {
-    uint32_t id;
-    EbmlType type;
-    int list_elem_size;
-    int data_offset;
-    union {
-        uint64_t    u;
-        double      f;
-        const char *s;
-        const struct EbmlSyntax *n;
-    } def;
-} EbmlSyntax;
-
-typedef struct {
-    int nb_elem;
-    void *elem;
-} EbmlList;
-
-typedef struct {
-    int      size;
-    uint8_t *data;
-    int64_t  pos;
-} EbmlBin;
-
-typedef struct {
-    uint64_t version;
-    uint64_t max_size;
-    uint64_t id_length;
-    char    *doctype;
-    uint64_t doctype_version;
-} Ebml;
-
-typedef struct {
-    uint64_t algo;
-    EbmlBin  settings;
-} MatroskaTrackCompression;
-
-typedef struct {
-    uint64_t scope;
-    uint64_t type;
-    MatroskaTrackCompression compression;
-} MatroskaTrackEncoding;
-
-typedef struct {
-    double   frame_rate;
-    uint64_t display_width;
-    uint64_t display_height;
-    uint64_t pixel_width;
-    uint64_t pixel_height;
-    uint64_t fourcc;
-} MatroskaTrackVideo;
-
-typedef struct {
-    double   samplerate;
-    double   out_samplerate;
-    uint64_t bitdepth;
-    uint64_t channels;
-
-    /* real audio header (extracted from extradata) */
-    int      coded_framesize;
-    int      sub_packet_h;
-    int      frame_size;
-    int      sub_packet_size;
-    int      sub_packet_cnt;
-    int      pkt_cnt;
-    uint8_t *buf;
-} MatroskaTrackAudio;
-
-typedef struct {
-    uint64_t num;
-    uint64_t uid;
-    uint64_t type;
-    char    *name;
-    char    *codec_id;
-    EbmlBin  codec_priv;
-    char    *language;
-    double time_scale;
-    uint64_t default_duration;
-    uint64_t flag_default;
-    MatroskaTrackVideo video;
-    MatroskaTrackAudio audio;
-    EbmlList encodings;
-
-    AVStream *stream;
-    int64_t end_timecode;
-    int ms_compat;
-} MatroskaTrack;
-
-typedef struct {
-    uint64_t uid;
-    char *filename;
-    char *mime;
-    EbmlBin bin;
-
-    AVStream *stream;
-} MatroskaAttachement;
-
-typedef struct {
-    uint64_t start;
-    uint64_t end;
-    uint64_t uid;
-    char    *title;
-
-    AVChapter *chapter;
-} MatroskaChapter;
-
-typedef struct {
-    uint64_t track;
-    uint64_t pos;
-} MatroskaIndexPos;
-
-typedef struct {
-    uint64_t time;
-    EbmlList pos;
-} MatroskaIndex;
-
-typedef struct {
-    char *name;
-    char *string;
-    char *lang;
-    uint64_t def;
-    EbmlList sub;
-} MatroskaTag;
-
-typedef struct {
-    char    *type;
-    uint64_t typevalue;
-    uint64_t trackuid;
-    uint64_t chapteruid;
-    uint64_t attachuid;
-} MatroskaTagTarget;
-
-typedef struct {
-    MatroskaTagTarget target;
-    EbmlList tag;
-} MatroskaTags;
-
-typedef struct {
-    uint64_t id;
-    uint64_t pos;
-} MatroskaSeekhead;
-
-typedef struct {
-    uint64_t start;
-    uint64_t length;
-} MatroskaLevel;
-
-typedef struct {
-    AVFormatContext *ctx;
-
-    /* EBML stuff */
-    int num_levels;
-    MatroskaLevel levels[EBML_MAX_DEPTH];
-    int level_up;
-
-    uint64_t time_scale;
-    double   duration;
-    char    *title;
-    EbmlList tracks;
-    EbmlList attachments;
-    EbmlList chapters;
-    EbmlList index;
-    EbmlList tags;
-    EbmlList seekhead;
-
-    /* byte position of the segment inside the stream */
-    int64_t segment_start;
-
-    /* the packet queue */
-    AVPacket **packets;
-    int num_packets;
-    AVPacket *prev_pkt;
-
-    int done;
-    int has_cluster_id;
-
-    /* What to skip before effectively reading a packet. */
-    int skip_to_keyframe;
-    uint64_t skip_to_timecode;
-} MatroskaDemuxContext;
-
-typedef struct {
-    uint64_t duration;
-    int64_t  reference;
-    uint64_t non_simple;
-    EbmlBin  bin;
-} MatroskaBlock;
-
-typedef struct {
-    uint64_t timecode;
-    EbmlList blocks;
-} MatroskaCluster;
-
-static EbmlSyntax ebml_header[] = {
-    { EBML_ID_EBMLREADVERSION,        EBML_UINT, 0, offsetof(Ebml,version), {.u=EBML_VERSION} },
-    { EBML_ID_EBMLMAXSIZELENGTH,      EBML_UINT, 0, offsetof(Ebml,max_size), {.u=8} },
-    { EBML_ID_EBMLMAXIDLENGTH,        EBML_UINT, 0, offsetof(Ebml,id_length), {.u=4} },
-    { EBML_ID_DOCTYPE,                EBML_STR,  0, offsetof(Ebml,doctype), {.s="(none)"} },
-    { EBML_ID_DOCTYPEREADVERSION,     EBML_UINT, 0, offsetof(Ebml,doctype_version), {.u=1} },
-    { EBML_ID_EBMLVERSION,            EBML_NONE },
-    { EBML_ID_DOCTYPEVERSION,         EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax ebml_syntax[] = {
-    { EBML_ID_HEADER,                 EBML_NEST, 0, 0, {.n=ebml_header} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_info[] = {
-    { MATROSKA_ID_TIMECODESCALE,      EBML_UINT,  0, offsetof(MatroskaDemuxContext,time_scale), {.u=1000000} },
-    { MATROSKA_ID_DURATION,           EBML_FLOAT, 0, offsetof(MatroskaDemuxContext,duration) },
-    { MATROSKA_ID_TITLE,              EBML_UTF8,  0, offsetof(MatroskaDemuxContext,title) },
-    { MATROSKA_ID_WRITINGAPP,         EBML_NONE },
-    { MATROSKA_ID_MUXINGAPP,          EBML_NONE },
-    { MATROSKA_ID_DATEUTC,            EBML_NONE },
-    { MATROSKA_ID_SEGMENTUID,         EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_track_video[] = {
-    { MATROSKA_ID_VIDEOFRAMERATE,     EBML_FLOAT,0, offsetof(MatroskaTrackVideo,frame_rate) },
-    { MATROSKA_ID_VIDEODISPLAYWIDTH,  EBML_UINT, 0, offsetof(MatroskaTrackVideo,display_width) },
-    { MATROSKA_ID_VIDEODISPLAYHEIGHT, EBML_UINT, 0, offsetof(MatroskaTrackVideo,display_height) },
-    { MATROSKA_ID_VIDEOPIXELWIDTH,    EBML_UINT, 0, offsetof(MatroskaTrackVideo,pixel_width) },
-    { MATROSKA_ID_VIDEOPIXELHEIGHT,   EBML_UINT, 0, offsetof(MatroskaTrackVideo,pixel_height) },
-    { MATROSKA_ID_VIDEOCOLORSPACE,    EBML_UINT, 0, offsetof(MatroskaTrackVideo,fourcc) },
-    { MATROSKA_ID_VIDEOPIXELCROPB,    EBML_NONE },
-    { MATROSKA_ID_VIDEOPIXELCROPT,    EBML_NONE },
-    { MATROSKA_ID_VIDEOPIXELCROPL,    EBML_NONE },
-    { MATROSKA_ID_VIDEOPIXELCROPR,    EBML_NONE },
-    { MATROSKA_ID_VIDEODISPLAYUNIT,   EBML_NONE },
-    { MATROSKA_ID_VIDEOFLAGINTERLACED,EBML_NONE },
-    { MATROSKA_ID_VIDEOSTEREOMODE,    EBML_NONE },
-    { MATROSKA_ID_VIDEOASPECTRATIO,   EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_track_audio[] = {
-    { MATROSKA_ID_AUDIOSAMPLINGFREQ,  EBML_FLOAT,0, offsetof(MatroskaTrackAudio,samplerate), {.f=8000.0} },
-    { MATROSKA_ID_AUDIOOUTSAMPLINGFREQ,EBML_FLOAT,0,offsetof(MatroskaTrackAudio,out_samplerate) },
-    { MATROSKA_ID_AUDIOBITDEPTH,      EBML_UINT, 0, offsetof(MatroskaTrackAudio,bitdepth) },
-    { MATROSKA_ID_AUDIOCHANNELS,      EBML_UINT, 0, offsetof(MatroskaTrackAudio,channels), {.u=1} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_track_encoding_compression[] = {
-    { MATROSKA_ID_ENCODINGCOMPALGO,   EBML_UINT, 0, offsetof(MatroskaTrackCompression,algo), {.u=0} },
-    { MATROSKA_ID_ENCODINGCOMPSETTINGS,EBML_BIN, 0, offsetof(MatroskaTrackCompression,settings) },
-    { 0 }
-};
-
-static EbmlSyntax matroska_track_encoding[] = {
-    { MATROSKA_ID_ENCODINGSCOPE,      EBML_UINT, 0, offsetof(MatroskaTrackEncoding,scope), {.u=1} },
-    { MATROSKA_ID_ENCODINGTYPE,       EBML_UINT, 0, offsetof(MatroskaTrackEncoding,type), {.u=0} },
-    { MATROSKA_ID_ENCODINGCOMPRESSION,EBML_NEST, 0, offsetof(MatroskaTrackEncoding,compression), {.n=matroska_track_encoding_compression} },
-    { MATROSKA_ID_ENCODINGORDER,      EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_track_encodings[] = {
-    { MATROSKA_ID_TRACKCONTENTENCODING, EBML_NEST, sizeof(MatroskaTrackEncoding), offsetof(MatroskaTrack,encodings), {.n=matroska_track_encoding} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_track[] = {
-    { MATROSKA_ID_TRACKNUMBER,          EBML_UINT, 0, offsetof(MatroskaTrack,num) },
-    { MATROSKA_ID_TRACKNAME,            EBML_UTF8, 0, offsetof(MatroskaTrack,name) },
-    { MATROSKA_ID_TRACKUID,             EBML_UINT, 0, offsetof(MatroskaTrack,uid) },
-    { MATROSKA_ID_TRACKTYPE,            EBML_UINT, 0, offsetof(MatroskaTrack,type) },
-    { MATROSKA_ID_CODECID,              EBML_STR,  0, offsetof(MatroskaTrack,codec_id) },
-    { MATROSKA_ID_CODECPRIVATE,         EBML_BIN,  0, offsetof(MatroskaTrack,codec_priv) },
-    { MATROSKA_ID_TRACKLANGUAGE,        EBML_UTF8, 0, offsetof(MatroskaTrack,language), {.s="eng"} },
-    { MATROSKA_ID_TRACKDEFAULTDURATION, EBML_UINT, 0, offsetof(MatroskaTrack,default_duration) },
-    { MATROSKA_ID_TRACKTIMECODESCALE,   EBML_FLOAT,0, offsetof(MatroskaTrack,time_scale), {.f=1.0} },
-    { MATROSKA_ID_TRACKFLAGDEFAULT,     EBML_UINT, 0, offsetof(MatroskaTrack,flag_default), {.u=1} },
-    { MATROSKA_ID_TRACKVIDEO,           EBML_NEST, 0, offsetof(MatroskaTrack,video), {.n=matroska_track_video} },
-    { MATROSKA_ID_TRACKAUDIO,           EBML_NEST, 0, offsetof(MatroskaTrack,audio), {.n=matroska_track_audio} },
-    { MATROSKA_ID_TRACKCONTENTENCODINGS,EBML_NEST, 0, 0, {.n=matroska_track_encodings} },
-    { MATROSKA_ID_TRACKFLAGENABLED,     EBML_NONE },
-    { MATROSKA_ID_TRACKFLAGFORCED,      EBML_NONE },
-    { MATROSKA_ID_TRACKFLAGLACING,      EBML_NONE },
-    { MATROSKA_ID_CODECNAME,            EBML_NONE },
-    { MATROSKA_ID_CODECDECODEALL,       EBML_NONE },
-    { MATROSKA_ID_CODECINFOURL,         EBML_NONE },
-    { MATROSKA_ID_CODECDOWNLOADURL,     EBML_NONE },
-    { MATROSKA_ID_TRACKMINCACHE,        EBML_NONE },
-    { MATROSKA_ID_TRACKMAXCACHE,        EBML_NONE },
-    { MATROSKA_ID_TRACKMAXBLKADDID,     EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_tracks[] = {
-    { MATROSKA_ID_TRACKENTRY,         EBML_NEST, sizeof(MatroskaTrack), offsetof(MatroskaDemuxContext,tracks), {.n=matroska_track} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_attachment[] = {
-    { MATROSKA_ID_FILEUID,            EBML_UINT, 0, offsetof(MatroskaAttachement,uid) },
-    { MATROSKA_ID_FILENAME,           EBML_UTF8, 0, offsetof(MatroskaAttachement,filename) },
-    { MATROSKA_ID_FILEMIMETYPE,       EBML_STR,  0, offsetof(MatroskaAttachement,mime) },
-    { MATROSKA_ID_FILEDATA,           EBML_BIN,  0, offsetof(MatroskaAttachement,bin) },
-    { MATROSKA_ID_FILEDESC,           EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_attachments[] = {
-    { MATROSKA_ID_ATTACHEDFILE,       EBML_NEST, sizeof(MatroskaAttachement), offsetof(MatroskaDemuxContext,attachments), {.n=matroska_attachment} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_chapter_display[] = {
-    { MATROSKA_ID_CHAPSTRING,         EBML_UTF8, 0, offsetof(MatroskaChapter,title) },
-    { MATROSKA_ID_CHAPLANG,           EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_chapter_entry[] = {
-    { MATROSKA_ID_CHAPTERTIMESTART,   EBML_UINT, 0, offsetof(MatroskaChapter,start), {.u=AV_NOPTS_VALUE} },
-    { MATROSKA_ID_CHAPTERTIMEEND,     EBML_UINT, 0, offsetof(MatroskaChapter,end), {.u=AV_NOPTS_VALUE} },
-    { MATROSKA_ID_CHAPTERUID,         EBML_UINT, 0, offsetof(MatroskaChapter,uid) },
-    { MATROSKA_ID_CHAPTERDISPLAY,     EBML_NEST, 0, 0, {.n=matroska_chapter_display} },
-    { MATROSKA_ID_CHAPTERFLAGHIDDEN,  EBML_NONE },
-    { MATROSKA_ID_CHAPTERFLAGENABLED, EBML_NONE },
-    { MATROSKA_ID_CHAPTERPHYSEQUIV,   EBML_NONE },
-    { MATROSKA_ID_CHAPTERATOM,        EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_chapter[] = {
-    { MATROSKA_ID_CHAPTERATOM,        EBML_NEST, sizeof(MatroskaChapter), offsetof(MatroskaDemuxContext,chapters), {.n=matroska_chapter_entry} },
-    { MATROSKA_ID_EDITIONUID,         EBML_NONE },
-    { MATROSKA_ID_EDITIONFLAGHIDDEN,  EBML_NONE },
-    { MATROSKA_ID_EDITIONFLAGDEFAULT, EBML_NONE },
-    { MATROSKA_ID_EDITIONFLAGORDERED, EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_chapters[] = {
-    { MATROSKA_ID_EDITIONENTRY,       EBML_NEST, 0, 0, {.n=matroska_chapter} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_index_pos[] = {
-    { MATROSKA_ID_CUETRACK,           EBML_UINT, 0, offsetof(MatroskaIndexPos,track) },
-    { MATROSKA_ID_CUECLUSTERPOSITION, EBML_UINT, 0, offsetof(MatroskaIndexPos,pos)   },
-    { MATROSKA_ID_CUEBLOCKNUMBER,     EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_index_entry[] = {
-    { MATROSKA_ID_CUETIME,            EBML_UINT, 0, offsetof(MatroskaIndex,time) },
-    { MATROSKA_ID_CUETRACKPOSITION,   EBML_NEST, sizeof(MatroskaIndexPos), offsetof(MatroskaIndex,pos), {.n=matroska_index_pos} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_index[] = {
-    { MATROSKA_ID_POINTENTRY,         EBML_NEST, sizeof(MatroskaIndex), offsetof(MatroskaDemuxContext,index), {.n=matroska_index_entry} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_simpletag[] = {
-    { MATROSKA_ID_TAGNAME,            EBML_UTF8, 0, offsetof(MatroskaTag,name) },
-    { MATROSKA_ID_TAGSTRING,          EBML_UTF8, 0, offsetof(MatroskaTag,string) },
-    { MATROSKA_ID_TAGLANG,            EBML_STR,  0, offsetof(MatroskaTag,lang), {.s="und"} },
-    { MATROSKA_ID_TAGDEFAULT,         EBML_UINT, 0, offsetof(MatroskaTag,def) },
-    { MATROSKA_ID_SIMPLETAG,          EBML_NEST, sizeof(MatroskaTag), offsetof(MatroskaTag,sub), {.n=matroska_simpletag} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_tagtargets[] = {
-    { MATROSKA_ID_TAGTARGETS_TYPE,      EBML_STR,  0, offsetof(MatroskaTagTarget,type) },
-    { MATROSKA_ID_TAGTARGETS_TYPEVALUE, EBML_UINT, 0, offsetof(MatroskaTagTarget,typevalue), {.u=50} },
-    { MATROSKA_ID_TAGTARGETS_TRACKUID,  EBML_UINT, 0, offsetof(MatroskaTagTarget,trackuid) },
-    { MATROSKA_ID_TAGTARGETS_CHAPTERUID,EBML_UINT, 0, offsetof(MatroskaTagTarget,chapteruid) },
-    { MATROSKA_ID_TAGTARGETS_ATTACHUID, EBML_UINT, 0, offsetof(MatroskaTagTarget,attachuid) },
-    { 0 }
-};
-
-static EbmlSyntax matroska_tag[] = {
-    { MATROSKA_ID_SIMPLETAG,          EBML_NEST, sizeof(MatroskaTag), offsetof(MatroskaTags,tag), {.n=matroska_simpletag} },
-    { MATROSKA_ID_TAGTARGETS,         EBML_NEST, 0, offsetof(MatroskaTags,target), {.n=matroska_tagtargets} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_tags[] = {
-    { MATROSKA_ID_TAG,                EBML_NEST, sizeof(MatroskaTags), offsetof(MatroskaDemuxContext,tags), {.n=matroska_tag} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_seekhead_entry[] = {
-    { MATROSKA_ID_SEEKID,             EBML_UINT, 0, offsetof(MatroskaSeekhead,id) },
-    { MATROSKA_ID_SEEKPOSITION,       EBML_UINT, 0, offsetof(MatroskaSeekhead,pos), {.u=-1} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_seekhead[] = {
-    { MATROSKA_ID_SEEKENTRY,          EBML_NEST, sizeof(MatroskaSeekhead), offsetof(MatroskaDemuxContext,seekhead), {.n=matroska_seekhead_entry} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_segment[] = {
-    { MATROSKA_ID_INFO,           EBML_NEST, 0, 0, {.n=matroska_info       } },
-    { MATROSKA_ID_TRACKS,         EBML_NEST, 0, 0, {.n=matroska_tracks     } },
-    { MATROSKA_ID_ATTACHMENTS,    EBML_NEST, 0, 0, {.n=matroska_attachments} },
-    { MATROSKA_ID_CHAPTERS,       EBML_NEST, 0, 0, {.n=matroska_chapters   } },
-    { MATROSKA_ID_CUES,           EBML_NEST, 0, 0, {.n=matroska_index      } },
-    { MATROSKA_ID_TAGS,           EBML_NEST, 0, 0, {.n=matroska_tags       } },
-    { MATROSKA_ID_SEEKHEAD,       EBML_NEST, 0, 0, {.n=matroska_seekhead   } },
-    { MATROSKA_ID_CLUSTER,        EBML_STOP, 0, offsetof(MatroskaDemuxContext,has_cluster_id) },
-    { 0 }
-};
-
-static EbmlSyntax matroska_segments[] = {
-    { MATROSKA_ID_SEGMENT,        EBML_NEST, 0, 0, {.n=matroska_segment    } },
-    { 0 }
-};
-
-static EbmlSyntax matroska_blockgroup[] = {
-    { MATROSKA_ID_BLOCK,          EBML_BIN,  0, offsetof(MatroskaBlock,bin) },
-    { MATROSKA_ID_SIMPLEBLOCK,    EBML_BIN,  0, offsetof(MatroskaBlock,bin) },
-    { MATROSKA_ID_BLOCKDURATION,  EBML_UINT, 0, offsetof(MatroskaBlock,duration), {.u=AV_NOPTS_VALUE} },
-    { MATROSKA_ID_BLOCKREFERENCE, EBML_UINT, 0, offsetof(MatroskaBlock,reference) },
-    { 1,                          EBML_UINT, 0, offsetof(MatroskaBlock,non_simple), {.u=1} },
-    { 0 }
-};
-
-static EbmlSyntax matroska_cluster[] = {
-    { MATROSKA_ID_CLUSTERTIMECODE,EBML_UINT,0, offsetof(MatroskaCluster,timecode) },
-    { MATROSKA_ID_BLOCKGROUP,     EBML_NEST, sizeof(MatroskaBlock), offsetof(MatroskaCluster,blocks), {.n=matroska_blockgroup} },
-    { MATROSKA_ID_SIMPLEBLOCK,    EBML_PASS, sizeof(MatroskaBlock), offsetof(MatroskaCluster,blocks), {.n=matroska_blockgroup} },
-    { MATROSKA_ID_CLUSTERPOSITION,EBML_NONE },
-    { MATROSKA_ID_CLUSTERPREVSIZE,EBML_NONE },
-    { 0 }
-};
-
-static EbmlSyntax matroska_clusters[] = {
-    { MATROSKA_ID_CLUSTER,        EBML_NEST, 0, 0, {.n=matroska_cluster} },
-    { MATROSKA_ID_INFO,           EBML_NONE },
-    { MATROSKA_ID_CUES,           EBML_NONE },
-    { MATROSKA_ID_TAGS,           EBML_NONE },
-    { MATROSKA_ID_SEEKHEAD,       EBML_NONE },
-    { 0 }
-};
-
-static const char *matroska_doctypes[] = { "matroska", "webm" };
-
-/*
- * Return: Whether we reached the end of a level in the hierarchy or not.
- */
-static int ebml_level_end(MatroskaDemuxContext *matroska)
-{
-    ByteIOContext *pb = matroska->ctx->pb;
-    int64_t pos = url_ftell(pb);
-
-    if (matroska->num_levels > 0) {
-        MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
-        if (pos - level->start >= level->length) {
-            matroska->num_levels--;
-            return 1;
-        }
-    }
-    return 0;
-}
-
-/*
- * Read: an "EBML number", which is defined as a variable-length
- * array of bytes. The first byte indicates the length by giving a
- * number of 0-bits followed by a one. The position of the first
- * "one" bit inside the first byte indicates the length of this
- * number.
- * Returns: number of bytes read, < 0 on error
- */
-static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
-                         int max_size, uint64_t *number)
-{
-    int len_mask = 0x80, read = 1, n = 1;
-    int64_t total = 0;
-
-    /* The first byte tells us the length in bytes - get_byte() can normally
-     * return 0, but since that's not a valid first ebmlID byte, we can
-     * use it safely here to catch EOS. */
-    if (!(total = get_byte(pb))) {
-        /* we might encounter EOS here */
-        if (!url_feof(pb)) {
-            int64_t pos = url_ftell(pb);
-            av_log(matroska->ctx, AV_LOG_ERROR,
-                   "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
-                   pos, pos);
-        }
-        return AVERROR(EIO); /* EOS or actual I/O error */
-    }
-
-    /* get the length of the EBML number */
-    while (read <= max_size && !(total & len_mask)) {
-        read++;
-        len_mask >>= 1;
-    }
-    if (read > max_size) {
-        int64_t pos = url_ftell(pb) - 1;
-        av_log(matroska->ctx, AV_LOG_ERROR,
-               "Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
-               (uint8_t) total, pos, pos);
-        return AVERROR_INVALIDDATA;
-    }
-
-    /* read out length */
-    total &= ~len_mask;
-    while (n++ < read)
-        total = (total << 8) | get_byte(pb);
-
-    *number = total;
-
-    return read;
-}
-
-/*
- * Read the next element as an unsigned int.
- * 0 is success, < 0 is failure.
- */
-static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
-{
-    int n = 0;
-
-    if (size < 1 || size > 8)
-        return AVERROR_INVALIDDATA;
-
-    /* big-endian ordering; build up number */
-    *num = 0;
-    while (n++ < size)
-        *num = (*num << 8) | get_byte(pb);
-
-    return 0;
-}
-
-/*
- * Read the next element as a float.
- * 0 is success, < 0 is failure.
- */
-static int ebml_read_float(ByteIOContext *pb, int size, double *num)
-{
-    if (size == 4) {
-        *num= av_int2flt(get_be32(pb));
-    } else if(size==8){
-        *num= av_int2dbl(get_be64(pb));
-    } else
-        return AVERROR_INVALIDDATA;
-
-    return 0;
-}
-
-/*
- * Read the next element as an ASCII string.
- * 0 is success, < 0 is failure.
- */
-static int ebml_read_ascii(ByteIOContext *pb, int size, char **str)
-{
-    av_free(*str);
-    /* EBML strings are usually not 0-terminated, so we allocate one
-     * byte more, read the string and NULL-terminate it ourselves. */
-    if (!(*str = av_malloc(size + 1)))
-        return AVERROR(ENOMEM);
-    if (get_buffer(pb, (uint8_t *) *str, size) != size) {
-        av_free(*str);
-        return AVERROR(EIO);
-    }
-    (*str)[size] = '\0';
-
-    return 0;
-}
-
-/*
- * Read the next element as binary data.
- * 0 is success, < 0 is failure.
- */
-static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
-{
-    av_free(bin->data);
-    if (!(bin->data = av_malloc(length)))
-        return AVERROR(ENOMEM);
-
-    bin->size = length;
-    bin->pos  = url_ftell(pb);
-    if (get_buffer(pb, bin->data, length) != length)
-        return AVERROR(EIO);
-
-    return 0;
-}
-
-/*
- * Read the next element, but only the header. The contents
- * are supposed to be sub-elements which can be read separately.
- * 0 is success, < 0 is failure.
- */
-static int ebml_read_master(MatroskaDemuxContext *matroska, int length)
-{
-    ByteIOContext *pb = matroska->ctx->pb;
-    MatroskaLevel *level;
-
-    if (matroska->num_levels >= EBML_MAX_DEPTH) {
-        av_log(matroska->ctx, AV_LOG_ERROR,
-               "File moves beyond max. allowed depth (%d)\n", EBML_MAX_DEPTH);
-        return AVERROR(ENOSYS);
-    }
-
-    level = &matroska->levels[matroska->num_levels++];
-    level->start = url_ftell(pb);
-    level->length = length;
-
-    return 0;
-}
-
-/*
- * Read signed/unsigned "EBML" numbers.
- * Return: number of bytes processed, < 0 on error
- */
-static int matroska_ebmlnum_uint(MatroskaDemuxContext *matroska,
-                                 uint8_t *data, uint32_t size, uint64_t *num)
-{
-    ByteIOContext pb;
-    init_put_byte(&pb, data, size, 0, NULL, NULL, NULL, NULL);
-    return ebml_read_num(matroska, &pb, 8, num);
-}
-
-/*
- * Same as above, but signed.
- */
-static int matroska_ebmlnum_sint(MatroskaDemuxContext *matroska,
-                                 uint8_t *data, uint32_t size, int64_t *num)
-{
-    uint64_t unum;
-    int res;
-
-    /* read as unsigned number first */
-    if ((res = matroska_ebmlnum_uint(matroska, data, size, &unum)) < 0)
-        return res;
-
-    /* make signed (weird way) */
-    *num = unum - ((1LL << (7*res - 1)) - 1);
-
-    return res;
-}
-
-static int ebml_parse_elem(MatroskaDemuxContext *matroska,
-                           EbmlSyntax *syntax, void *data);
-
-static int ebml_parse_id(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
-                         uint32_t id, void *data)
-{
-    int i;
-    for (i=0; syntax[i].id; i++)
-        if (id == syntax[i].id)
-            break;
-    if (!syntax[i].id && id != EBML_ID_VOID && id != EBML_ID_CRC32)
-        av_log(matroska->ctx, AV_LOG_INFO, "Unknown entry 0x%X\n", id);
-    return ebml_parse_elem(matroska, &syntax[i], data);
-}
-
-static int ebml_parse(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
-                      void *data)
-{
-    uint64_t id;
-    int res = ebml_read_num(matroska, matroska->ctx->pb, 4, &id);
-    id |= 1 << 7*res;
-    return res < 0 ? res : ebml_parse_id(matroska, syntax, id, data);
-}
-
-static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
-                           void *data)
-{
-    int i, res = 0;
-
-    for (i=0; syntax[i].id; i++)
-        switch (syntax[i].type) {
-        case EBML_UINT:
-            *(uint64_t *)((char *)data+syntax[i].data_offset) = syntax[i].def.u;
-            break;
-        case EBML_FLOAT:
-            *(double   *)((char *)data+syntax[i].data_offset) = syntax[i].def.f;
-            break;
-        case EBML_STR:
-        case EBML_UTF8:
-            *(char    **)((char *)data+syntax[i].data_offset) = av_strdup(syntax[i].def.s);
-            break;
-        }
-
-    while (!res && !ebml_level_end(matroska))
-        res = ebml_parse(matroska, syntax, data);
-
-    return res;
-}
-
-static int ebml_parse_elem(MatroskaDemuxContext *matroska,
-                           EbmlSyntax *syntax, void *data)
-{
-    ByteIOContext *pb = matroska->ctx->pb;
-    uint32_t id = syntax->id;
-    uint64_t length;
-    int res;
-
-    data = (char *)data + syntax->data_offset;
-    if (syntax->list_elem_size) {
-        EbmlList *list = data;
-        list->elem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size);
-        data = (char*)list->elem + list->nb_elem*syntax->list_elem_size;
-        memset(data, 0, syntax->list_elem_size);
-        list->nb_elem++;
-    }
-
-    if (syntax->type != EBML_PASS && syntax->type != EBML_STOP)
-        if ((res = ebml_read_num(matroska, pb, 8, &length)) < 0)
-            return res;
-
-    switch (syntax->type) {
-    case EBML_UINT:  res = ebml_read_uint  (pb, length, data);  break;
-    case EBML_FLOAT: res = ebml_read_float (pb, length, data);  break;
-    case EBML_STR:
-    case EBML_UTF8:  res = ebml_read_ascii (pb, length, data);  break;
-    case EBML_BIN:   res = ebml_read_binary(pb, length, data);  break;
-    case EBML_NEST:  if ((res=ebml_read_master(matroska, length)) < 0)
-                         return res;
-                     if (id == MATROSKA_ID_SEGMENT)
-                         matroska->segment_start = url_ftell(matroska->ctx->pb);
-                     return ebml_parse_nest(matroska, syntax->def.n, data);
-    case EBML_PASS:  return ebml_parse_id(matroska, syntax->def.n, id, data);
-    case EBML_STOP:  *(int *)data = 1;      return 1;
-    default:         return url_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0;
-    }
-    if (res == AVERROR_INVALIDDATA)
-        av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n");
-    else if (res == AVERROR(EIO))
-        av_log(matroska->ctx, AV_LOG_ERROR, "Read error\n");
-    return res;
-}
-
-static void ebml_free(EbmlSyntax *syntax, void *data)
-{
-    int i, j;
-    for (i=0; syntax[i].id; i++) {
-        void *data_off = (char *)data + syntax[i].data_offset;
-        switch (syntax[i].type) {
-        case EBML_STR:
-        case EBML_UTF8:  av_freep(data_off);                      break;
-        case EBML_BIN:   av_freep(&((EbmlBin *)data_off)->data);  break;
-        case EBML_NEST:
-            if (syntax[i].list_elem_size) {
-                EbmlList *list = data_off;
-                char *ptr = list->elem;
-                for (j=0; j<list->nb_elem; j++, ptr+=syntax[i].list_elem_size)
-                    ebml_free(syntax[i].def.n, ptr);
-                av_free(list->elem);
-            } else
-                ebml_free(syntax[i].def.n, data_off);
-        default:  break;
-        }
-    }
-}
-
-
-/*
- * Autodetecting...
- */
-static int matroska_probe(AVProbeData *p)
-{
-    uint64_t total = 0;
-    int len_mask = 0x80, size = 1, n = 1, i;
-
-    /* EBML header? */
-    if (AV_RB32(p->buf) != EBML_ID_HEADER)
-        return 0;
-
-    /* length of header */
-    total = p->buf[4];
-    while (size <= 8 && !(total & len_mask)) {
-        size++;
-        len_mask >>= 1;
-    }
-    if (size > 8)
-      return 0;
-    total &= (len_mask - 1);
-    while (n < size)
-        total = (total << 8) | p->buf[4 + n++];
-
-    /* Does the probe data contain the whole header? */
-    if (p->buf_size < 4 + size + total)
-      return 0;
-
-    /* The header should contain a known document type. For now,
-     * we don't parse the whole header but simply check for the
-     * availability of that array of characters inside the header.
-     * Not fully fool-proof, but good enough. */
-    for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++) {
-        int probelen = strlen(matroska_doctypes[i]);
-        for (n = 4+size; n <= 4+size+total-probelen; n++)
-            if (!memcmp(p->buf+n, matroska_doctypes[i], probelen))
-                return AVPROBE_SCORE_MAX;
-    }
-
-    // probably valid EBML header but no recognized doctype
-    return AVPROBE_SCORE_MAX/2;
-}
-
-static MatroskaTrack *matroska_find_track_by_num(MatroskaDemuxContext *matroska,
-                                                 int num)
-{
-    MatroskaTrack *tracks = matroska->tracks.elem;
-    int i;
-
-    for (i=0; i < matroska->tracks.nb_elem; i++)
-        if (tracks[i].num == num)
-            return &tracks[i];
-
-    av_log(matroska->ctx, AV_LOG_ERROR, "Invalid track number %d\n", num);
-    return NULL;
-}
-
-static int matroska_decode_buffer(uint8_t** buf, int* buf_size,
-                                  MatroskaTrack *track)
-{
-    MatroskaTrackEncoding *encodings = track->encodings.elem;
-    uint8_t* data = *buf;
-    int isize = *buf_size;
-    uint8_t* pkt_data = NULL;
-    int pkt_size = isize;
-    int result = 0;
-    int olen;
-
-    switch (encodings[0].compression.algo) {
-    case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP:
-        return encodings[0].compression.settings.size;
-    case MATROSKA_TRACK_ENCODING_COMP_LZO:
-        do {
-            olen = pkt_size *= 3;
-            pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING);
-            result = av_lzo1x_decode(pkt_data, &olen, data, &isize);
-        } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000);
-        if (result)
-            goto failed;
-        pkt_size -= olen;
-        break;
-#if CONFIG_ZLIB
-    case MATROSKA_TRACK_ENCODING_COMP_ZLIB: {
-        z_stream zstream = {0};
-        if (inflateInit(&zstream) != Z_OK)
-            return -1;
-        zstream.next_in = data;
-        zstream.avail_in = isize;
-        do {
-            pkt_size *= 3;
-            pkt_data = av_realloc(pkt_data, pkt_size);
-            zstream.avail_out = pkt_size - zstream.total_out;
-            zstream.next_out = pkt_data + zstream.total_out;
-            result = inflate(&zstream, Z_NO_FLUSH);
-        } while (result==Z_OK && pkt_size<10000000);
-        pkt_size = zstream.total_out;
-        inflateEnd(&zstream);
-        if (result != Z_STREAM_END)
-            goto failed;
-        break;
-    }
-#endif
-#if CONFIG_BZLIB
-    case MATROSKA_TRACK_ENCODING_COMP_BZLIB: {
-        bz_stream bzstream = {0};
-        if (BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK)
-            return -1;
-        bzstream.next_in = data;
-        bzstream.avail_in = isize;
-        do {
-            pkt_size *= 3;
-            pkt_data = av_realloc(pkt_data, pkt_size);
-            bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
-            bzstream.next_out = pkt_data + bzstream.total_out_lo32;
-            result = BZ2_bzDecompress(&bzstream);
-        } while (result==BZ_OK && pkt_size<10000000);
-        pkt_size = bzstream.total_out_lo32;
-        BZ2_bzDecompressEnd(&bzstream);
-        if (result != BZ_STREAM_END)
-            goto failed;
-        break;
-    }
-#endif
-    default:
-        return -1;
-    }
-
-    *buf = pkt_data;
-    *buf_size = pkt_size;
-    return 0;
- failed:
-    av_free(pkt_data);
-    return -1;
-}
-
-static void matroska_fix_ass_packet(MatroskaDemuxContext *matroska,
-                                    AVPacket *pkt, uint64_t display_duration)
-{
-    char *line, *layer, *ptr = pkt->data, *end = ptr+pkt->size;
-    for (; *ptr!=',' && ptr<end-1; ptr++);
-    if (*ptr == ',')
-        layer = ++ptr;
-    for (; *ptr!=',' && ptr<end-1; ptr++);
-    if (*ptr == ',') {
-        int64_t end_pts = pkt->pts + display_duration;
-        int sc = matroska->time_scale * pkt->pts / 10000000;
-        int ec = matroska->time_scale * end_pts  / 10000000;
-        int sh, sm, ss, eh, em, es, len;
-        sh = sc/360000;  sc -= 360000*sh;
-        sm = sc/  6000;  sc -=   6000*sm;
-        ss = sc/   100;  sc -=    100*ss;
-        eh = ec/360000;  ec -= 360000*eh;
-        em = ec/  6000;  ec -=   6000*em;
-        es = ec/   100;  ec -=    100*es;
-        *ptr++ = '\0';
-        len = 50 + end-ptr + FF_INPUT_BUFFER_PADDING_SIZE;
-        if (!(line = av_malloc(len)))
-            return;
-        snprintf(line,len,"Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s\r\n",
-                 layer, sh, sm, ss, sc, eh, em, es, ec, ptr);
-        av_free(pkt->data);
-        pkt->data = line;
-        pkt->size = strlen(line);
-    }
-}
-
-static void matroska_merge_packets(AVPacket *out, AVPacket *in)
-{
-    out->data = av_realloc(out->data, out->size+in->size);
-    memcpy(out->data+out->size, in->data, in->size);
-    out->size += in->size;
-    av_destruct_packet(in);
-    av_free(in);
-}
-
-static void matroska_convert_tag(AVFormatContext *s, EbmlList *list,
-                                 AVMetadata **metadata, char *prefix)
-{
-    MatroskaTag *tags = list->elem;
-    char key[1024];
-    int i;
-
-    for (i=0; i < list->nb_elem; i++) {
-        const char *lang = strcmp(tags[i].lang, "und") ? tags[i].lang : NULL;
-        if (prefix)  snprintf(key, sizeof(key), "%s/%s", prefix, tags[i].name);
-        else         av_strlcpy(key, tags[i].name, sizeof(key));
-        if (tags[i].def || !lang) {
-        av_metadata_set2(metadata, key, tags[i].string, 0);
-        if (tags[i].sub.nb_elem)
-            matroska_convert_tag(s, &tags[i].sub, metadata, key);
-        }
-        if (lang) {
-            av_strlcat(key, "-", sizeof(key));
-            av_strlcat(key, lang, sizeof(key));
-            av_metadata_set2(metadata, key, tags[i].string, 0);
-            if (tags[i].sub.nb_elem)
-                matroska_convert_tag(s, &tags[i].sub, metadata, key);
-        }
-    }
-}
-
-static void matroska_convert_tags(AVFormatContext *s)
-{
-    MatroskaDemuxContext *matroska = s->priv_data;
-    MatroskaTags *tags = matroska->tags.elem;
-    int i, j;
-
-    for (i=0; i < matroska->tags.nb_elem; i++) {
-        if (tags[i].target.attachuid) {
-            MatroskaAttachement *attachment = matroska->attachments.elem;
-            for (j=0; j<matroska->attachments.nb_elem; j++)
-                if (attachment[j].uid == tags[i].target.attachuid)
-                    matroska_convert_tag(s, &tags[i].tag,
-                                         &attachment[j].stream->metadata, NULL);
-        } else if (tags[i].target.chapteruid) {
-            MatroskaChapter *chapter = matroska->chapters.elem;
-            for (j=0; j<matroska->chapters.nb_elem; j++)
-                if (chapter[j].uid == tags[i].target.chapteruid)
-                    matroska_convert_tag(s, &tags[i].tag,
-                                         &chapter[j].chapter->metadata, NULL);
-        } else if (tags[i].target.trackuid) {
-            MatroskaTrack *track = matroska->tracks.elem;
-            for (j=0; j<matroska->tracks.nb_elem; j++)
-                if (track[j].uid == tags[i].target.trackuid)
-                    matroska_convert_tag(s, &tags[i].tag,
-                                         &track[j].stream->metadata, NULL);
-        } else {
-            matroska_convert_tag(s, &tags[i].tag, &s->metadata,
-                                 tags[i].target.type);
-        }
-    }
-}
-
-static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
-{
-    EbmlList *seekhead_list = &matroska->seekhead;
-    MatroskaSeekhead *seekhead = seekhead_list->elem;
-    uint32_t level_up = matroska->level_up;
-    int64_t before_pos = url_ftell(matroska->ctx->pb);
-    MatroskaLevel level;
-    int i;
-
-    for (i=0; i<seekhead_list->nb_elem; i++) {
-        int64_t offset = seekhead[i].pos + matroska->segment_start;
-
-        if (seekhead[i].pos <= before_pos
-            || seekhead[i].id == MATROSKA_ID_SEEKHEAD
-            || seekhead[i].id == MATROSKA_ID_CLUSTER)
-            continue;
-
-        /* seek */
-        if (url_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset)
-            continue;
-
-        /* We don't want to lose our seekhead level, so we add
-         * a dummy. This is a crude hack. */
-        if (matroska->num_levels == EBML_MAX_DEPTH) {
-            av_log(matroska->ctx, AV_LOG_INFO,
-                   "Max EBML element depth (%d) reached, "
-                   "cannot parse further.\n", EBML_MAX_DEPTH);
-            break;
-        }
-
-        level.start = 0;
-        level.length = (uint64_t)-1;
-        matroska->levels[matroska->num_levels] = level;
-        matroska->num_levels++;
-
-        ebml_parse(matroska, matroska_segment, matroska);
-
-        /* remove dummy level */
-        while (matroska->num_levels) {
-            uint64_t length = matroska->levels[--matroska->num_levels].length;
-            if (length == (uint64_t)-1)
-                break;
-        }
-    }
-
-    /* seek back */
-    url_fseek(matroska->ctx->pb, before_pos, SEEK_SET);
-    matroska->level_up = level_up;
-}
-
-static int matroska_aac_profile(char *codec_id)
-{
-    static const char * const aac_profiles[] = { "MAIN", "LC", "SSR" };
-    int profile;
-
-    for (profile=0; profile<FF_ARRAY_ELEMS(aac_profiles); profile++)
-        if (strstr(codec_id, aac_profiles[profile]))
-            break;
-    return profile + 1;
-}
-
-static int matroska_aac_sri(int samplerate)
-{
-    int sri;
-
-    for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++)
-        if (ff_mpeg4audio_sample_rates[sri] == samplerate)
-            break;
-    return sri;
-}
-
-static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    MatroskaDemuxContext *matroska = s->priv_data;
-    EbmlList *attachements_list = &matroska->attachments;
-    MatroskaAttachement *attachements;
-    EbmlList *chapters_list = &matroska->chapters;
-    MatroskaChapter *chapters;
-    MatroskaTrack *tracks;
-    EbmlList *index_list;
-    MatroskaIndex *index;
-    int index_scale = 1;
-    uint64_t max_start = 0;
-    Ebml ebml = { 0 };
-    AVStream *st;
-    int i, j;
-
-    matroska->ctx = s;
-
-    /* First read the EBML header. */
-    if (ebml_parse(matroska, ebml_syntax, &ebml)
-        || ebml.version > EBML_VERSION       || ebml.max_size > sizeof(uint64_t)
-        || ebml.id_length > sizeof(uint32_t) || ebml.doctype_version > 2) {
-        av_log(matroska->ctx, AV_LOG_ERROR,
-               "EBML header using unsupported features\n"
-               "(EBML version %"PRIu64", doctype %s, doc version %"PRIu64")\n",
-               ebml.version, ebml.doctype, ebml.doctype_version);
-        ebml_free(ebml_syntax, &ebml);
-        return AVERROR_PATCHWELCOME;
-    }
-    for (i = 0; i < FF_ARRAY_ELEMS(matroska_doctypes); i++)
-        if (!strcmp(ebml.doctype, matroska_doctypes[i]))
-            break;
-    if (i >= FF_ARRAY_ELEMS(matroska_doctypes)) {
-        av_log(s, AV_LOG_WARNING, "Unknown EBML doctype '%s'\n", ebml.doctype);
-    }
-    av_metadata_set2(&s->metadata, "doctype", ebml.doctype, 0);
-    ebml_free(ebml_syntax, &ebml);
-
-    /* The next thing is a segment. */
-    if (ebml_parse(matroska, matroska_segments, matroska) < 0)
-        return -1;
-    matroska_execute_seekhead(matroska);
-
-    if (matroska->duration)
-        matroska->ctx->duration = matroska->duration * matroska->time_scale
-                                  * 1000 / AV_TIME_BASE;
-    av_metadata_set2(&s->metadata, "title", matroska->title, 0);
-
-    tracks = matroska->tracks.elem;
-    for (i=0; i < matroska->tracks.nb_elem; i++) {
-        MatroskaTrack *track = &tracks[i];
-        enum CodecID codec_id = CODEC_ID_NONE;
-        EbmlList *encodings_list = &tracks->encodings;
-        MatroskaTrackEncoding *encodings = encodings_list->elem;
-        uint8_t *extradata = NULL;
-        int extradata_size = 0;
-        int extradata_offset = 0;
-        ByteIOContext b;
-
-        /* Apply some sanity checks. */
-        if (track->type != MATROSKA_TRACK_TYPE_VIDEO &&
-            track->type != MATROSKA_TRACK_TYPE_AUDIO &&
-            track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
-            av_log(matroska->ctx, AV_LOG_INFO,
-                   "Unknown or unsupported track type %"PRIu64"\n",
-                   track->type);
-            continue;
-        }
-        if (track->codec_id == NULL)
-            continue;
-
-        if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
-            if (!track->default_duration)
-                track->default_duration = 1000000000/track->video.frame_rate;
-            if (!track->video.display_width)
-                track->video.display_width = track->video.pixel_width;
-            if (!track->video.display_height)
-                track->video.display_height = track->video.pixel_height;
-        } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
-            if (!track->audio.out_samplerate)
-                track->audio.out_samplerate = track->audio.samplerate;
-        }
-        if (encodings_list->nb_elem > 1) {
-            av_log(matroska->ctx, AV_LOG_ERROR,
-                   "Multiple combined encodings no supported");
-        } else if (encodings_list->nb_elem == 1) {
-            if (encodings[0].type ||
-                (encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP &&
-#if CONFIG_ZLIB
-                 encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_ZLIB &&
-#endif
-#if CONFIG_BZLIB
-                 encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_BZLIB &&
-#endif
-                 encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_LZO)) {
-                encodings[0].scope = 0;
-                av_log(matroska->ctx, AV_LOG_ERROR,
-                       "Unsupported encoding type");
-            } else if (track->codec_priv.size && encodings[0].scope&2) {
-                uint8_t *codec_priv = track->codec_priv.data;
-                int offset = matroska_decode_buffer(&track->codec_priv.data,
-                                                    &track->codec_priv.size,
-                                                    track);
-                if (offset < 0) {
-                    track->codec_priv.data = NULL;
-                    track->codec_priv.size = 0;
-                    av_log(matroska->ctx, AV_LOG_ERROR,
-                           "Failed to decode codec private data\n");
-                } else if (offset > 0) {
-                    track->codec_priv.data = av_malloc(track->codec_priv.size + offset);
-                    memcpy(track->codec_priv.data,
-                           encodings[0].compression.settings.data, offset);
-                    memcpy(track->codec_priv.data+offset, codec_priv,
-                           track->codec_priv.size);
-                    track->codec_priv.size += offset;
-                }
-                if (codec_priv != track->codec_priv.data)
-                    av_free(codec_priv);
-            }
-        }
-
-        for(j=0; ff_mkv_codec_tags[j].id != CODEC_ID_NONE; j++){
-            if(!strncmp(ff_mkv_codec_tags[j].str, track->codec_id,
-                        strlen(ff_mkv_codec_tags[j].str))){
-                codec_id= ff_mkv_codec_tags[j].id;
-                break;
-            }
-        }
-
-        st = track->stream = av_new_stream(s, 0);
-        if (st == NULL)
-            return AVERROR(ENOMEM);
-
-        if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC")
-            && track->codec_priv.size >= 40
-            && track->codec_priv.data != NULL) {
-            track->ms_compat = 1;
-            track->video.fourcc = AV_RL32(track->codec_priv.data + 16);
-            codec_id = ff_codec_get_id(ff_codec_bmp_tags, track->video.fourcc);
-            extradata_offset = 40;
-        } else if (!strcmp(track->codec_id, "A_MS/ACM")
-                   && track->codec_priv.size >= 14
-                   && track->codec_priv.data != NULL) {
-            init_put_byte(&b, track->codec_priv.data, track->codec_priv.size,
-                          URL_RDONLY, NULL, NULL, NULL, NULL);
-            ff_get_wav_header(&b, st->codec, track->codec_priv.size);
-            codec_id = st->codec->codec_id;
-            extradata_offset = FFMIN(track->codec_priv.size, 18);
-        } else if (!strcmp(track->codec_id, "V_QUICKTIME")
-                   && (track->codec_priv.size >= 86)
-                   && (track->codec_priv.data != NULL)) {
-            track->video.fourcc = AV_RL32(track->codec_priv.data);
-            codec_id=ff_codec_get_id(codec_movvideo_tags, track->video.fourcc);
-        } else if (codec_id == CODEC_ID_PCM_S16BE) {
-            switch (track->audio.bitdepth) {
-            case  8:  codec_id = CODEC_ID_PCM_U8;     break;
-            case 24:  codec_id = CODEC_ID_PCM_S24BE;  break;
-            case 32:  codec_id = CODEC_ID_PCM_S32BE;  break;
-            }
-        } else if (codec_id == CODEC_ID_PCM_S16LE) {
-            switch (track->audio.bitdepth) {
-            case  8:  codec_id = CODEC_ID_PCM_U8;     break;
-            case 24:  codec_id = CODEC_ID_PCM_S24LE;  break;
-            case 32:  codec_id = CODEC_ID_PCM_S32LE;  break;
-            }
-        } else if (codec_id==CODEC_ID_PCM_F32LE && track->audio.bitdepth==64) {
-            codec_id = CODEC_ID_PCM_F64LE;
-        } else if (codec_id == CODEC_ID_AAC && !track->codec_priv.size) {
-            int profile = matroska_aac_profile(track->codec_id);
-            int sri = matroska_aac_sri(track->audio.samplerate);
-            extradata = av_malloc(5);
-            if (extradata == NULL)
-                return AVERROR(ENOMEM);
-            extradata[0] = (profile << 3) | ((sri&0x0E) >> 1);
-            extradata[1] = ((sri&0x01) << 7) | (track->audio.channels<<3);
-            if (strstr(track->codec_id, "SBR")) {
-                sri = matroska_aac_sri(track->audio.out_samplerate);
-                extradata[2] = 0x56;
-                extradata[3] = 0xE5;
-                extradata[4] = 0x80 | (sri<<3);
-                extradata_size = 5;
-            } else
-                extradata_size = 2;
-        } else if (codec_id == CODEC_ID_TTA) {
-            extradata_size = 30;
-            extradata = av_mallocz(extradata_size);
-            if (extradata == NULL)
-                return AVERROR(ENOMEM);
-            init_put_byte(&b, extradata, extradata_size, 1,
-                          NULL, NULL, NULL, NULL);
-            put_buffer(&b, "TTA1", 4);
-            put_le16(&b, 1);
-            put_le16(&b, track->audio.channels);
-            put_le16(&b, track->audio.bitdepth);
-            put_le32(&b, track->audio.out_samplerate);
-            put_le32(&b, matroska->ctx->duration * track->audio.out_samplerate);
-        } else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 ||
-                   codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) {
-            extradata_offset = 26;
-        } else if (codec_id == CODEC_ID_RA_144) {
-            track->audio.out_samplerate = 8000;
-            track->audio.channels = 1;
-        } else if (codec_id == CODEC_ID_RA_288 || codec_id == CODEC_ID_COOK ||
-                   codec_id == CODEC_ID_ATRAC3 || codec_id == CODEC_ID_SIPR) {
-            int flavor;
-            init_put_byte(&b, track->codec_priv.data,track->codec_priv.size,
-                          0, NULL, NULL, NULL, NULL);
-            url_fskip(&b, 22);
-            flavor                       = get_be16(&b);
-            track->audio.coded_framesize = get_be32(&b);
-            url_fskip(&b, 12);
-            track->audio.sub_packet_h    = get_be16(&b);
-            track->audio.frame_size      = get_be16(&b);
-            track->audio.sub_packet_size = get_be16(&b);
-            track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h);
-            if (codec_id == CODEC_ID_RA_288) {
-                st->codec->block_align = track->audio.coded_framesize;
-                track->codec_priv.size = 0;
-            } else {
-                if (codec_id == CODEC_ID_SIPR && flavor < 4) {
-                    const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
-                    track->audio.sub_packet_size = ff_sipr_subpk_size[flavor];
-                    st->codec->bit_rate = sipr_bit_rate[flavor];
-                }
-                st->codec->block_align = track->audio.sub_packet_size;
-                extradata_offset = 78;
-            }
-        }
-        track->codec_priv.size -= extradata_offset;
-
-        if (codec_id == CODEC_ID_NONE)
-            av_log(matroska->ctx, AV_LOG_INFO,
-                   "Unknown/unsupported CodecID %s.\n", track->codec_id);
-
-        if (track->time_scale < 0.01)
-            track->time_scale = 1.0;
-        av_set_pts_info(st, 64, matroska->time_scale*track->time_scale, 1000*1000*1000); /* 64 bit pts in ns */
-
-        st->codec->codec_id = codec_id;
-        st->start_time = 0;
-        if (strcmp(track->language, "und"))
-            av_metadata_set2(&st->metadata, "language", track->language, 0);
-        av_metadata_set2(&st->metadata, "title", track->name, 0);
-
-        if (track->flag_default)
-            st->disposition |= AV_DISPOSITION_DEFAULT;
-
-        if (track->default_duration)
-            av_reduce(&st->codec->time_base.num, &st->codec->time_base.den,
-                      track->default_duration, 1000000000, 30000);
-
-        if (!st->codec->extradata) {
-            if(extradata){
-                st->codec->extradata = extradata;
-                st->codec->extradata_size = extradata_size;
-            } else if(track->codec_priv.data && track->codec_priv.size > 0){
-                st->codec->extradata = av_mallocz(track->codec_priv.size +
-                                                  FF_INPUT_BUFFER_PADDING_SIZE);
-                if(st->codec->extradata == NULL)
-                    return AVERROR(ENOMEM);
-                st->codec->extradata_size = track->codec_priv.size;
-                memcpy(st->codec->extradata,
-                       track->codec_priv.data + extradata_offset,
-                       track->codec_priv.size);
-            }
-        }
-
-        if (track->type == MATROSKA_TRACK_TYPE_VIDEO) {
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_tag  = track->video.fourcc;
-            st->codec->width  = track->video.pixel_width;
-            st->codec->height = track->video.pixel_height;
-            av_reduce(&st->sample_aspect_ratio.num,
-                      &st->sample_aspect_ratio.den,
-                      st->codec->height * track->video.display_width,
-                      st->codec-> width * track->video.display_height,
-                      255);
-            if (st->codec->codec_id != CODEC_ID_H264)
-            st->need_parsing = AVSTREAM_PARSE_HEADERS;
-            if (track->default_duration)
-                st->avg_frame_rate = av_d2q(1000000000.0/track->default_duration, INT_MAX);
-        } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->sample_rate = track->audio.out_samplerate;
-            st->codec->channels = track->audio.channels;
-            if (st->codec->codec_id != CODEC_ID_AAC)
-            st->need_parsing = AVSTREAM_PARSE_HEADERS;
-        } else if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE) {
-            st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-        }
-    }
-
-    attachements = attachements_list->elem;
-    for (j=0; j<attachements_list->nb_elem; j++) {
-        if (!(attachements[j].filename && attachements[j].mime &&
-              attachements[j].bin.data && attachements[j].bin.size > 0)) {
-            av_log(matroska->ctx, AV_LOG_ERROR, "incomplete attachment\n");
-        } else {
-            AVStream *st = av_new_stream(s, 0);
-            if (st == NULL)
-                break;
-            av_metadata_set2(&st->metadata, "filename",attachements[j].filename, 0);
-            st->codec->codec_id = CODEC_ID_NONE;
-            st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
-            st->codec->extradata  = av_malloc(attachements[j].bin.size);
-            if(st->codec->extradata == NULL)
-                break;
-            st->codec->extradata_size = attachements[j].bin.size;
-            memcpy(st->codec->extradata, attachements[j].bin.data, attachements[j].bin.size);
-
-            for (i=0; ff_mkv_mime_tags[i].id != CODEC_ID_NONE; i++) {
-                if (!strncmp(ff_mkv_mime_tags[i].str, attachements[j].mime,
-                             strlen(ff_mkv_mime_tags[i].str))) {
-                    st->codec->codec_id = ff_mkv_mime_tags[i].id;
-                    break;
-                }
-            }
-            attachements[j].stream = st;
-        }
-    }
-
-    chapters = chapters_list->elem;
-    for (i=0; i<chapters_list->nb_elem; i++)
-        if (chapters[i].start != AV_NOPTS_VALUE && chapters[i].uid
-            && (max_start==0 || chapters[i].start > max_start)) {
-            chapters[i].chapter =
-            ff_new_chapter(s, chapters[i].uid, (AVRational){1, 1000000000},
-                           chapters[i].start, chapters[i].end,
-                           chapters[i].title);
-            av_metadata_set2(&chapters[i].chapter->metadata,
-                             "title", chapters[i].title, 0);
-            max_start = chapters[i].start;
-        }
-
-    index_list = &matroska->index;
-    index = index_list->elem;
-    if (index_list->nb_elem
-        && index[0].time > 100000000000000/matroska->time_scale) {
-        av_log(matroska->ctx, AV_LOG_WARNING, "Working around broken index.\n");
-        index_scale = matroska->time_scale;
-    }
-    for (i=0; i<index_list->nb_elem; i++) {
-        EbmlList *pos_list = &index[i].pos;
-        MatroskaIndexPos *pos = pos_list->elem;
-        for (j=0; j<pos_list->nb_elem; j++) {
-            MatroskaTrack *track = matroska_find_track_by_num(matroska,
-                                                              pos[j].track);
-            if (track && track->stream)
-                av_add_index_entry(track->stream,
-                                   pos[j].pos + matroska->segment_start,
-                                   index[i].time/index_scale, 0, 0,
-                                   AVINDEX_KEYFRAME);
-        }
-    }
-
-    matroska_convert_tags(s);
-
-    return 0;
-}
-
-/*
- * Put one packet in an application-supplied AVPacket struct.
- * Returns 0 on success or -1 on failure.
- */
-static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
-                                   AVPacket *pkt)
-{
-    if (matroska->num_packets > 0) {
-        memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
-        av_free(matroska->packets[0]);
-        if (matroska->num_packets > 1) {
-            memmove(&matroska->packets[0], &matroska->packets[1],
-                    (matroska->num_packets - 1) * sizeof(AVPacket *));
-            matroska->packets =
-                av_realloc(matroska->packets, (matroska->num_packets - 1) *
-                           sizeof(AVPacket *));
-        } else {
-            av_freep(&matroska->packets);
-        }
-        matroska->num_packets--;
-        return 0;
-    }
-
-    return -1;
-}
-
-/*
- * Free all packets in our internal queue.
- */
-static void matroska_clear_queue(MatroskaDemuxContext *matroska)
-{
-    if (matroska->packets) {
-        int n;
-        for (n = 0; n < matroska->num_packets; n++) {
-            av_free_packet(matroska->packets[n]);
-            av_free(matroska->packets[n]);
-        }
-        av_freep(&matroska->packets);
-        matroska->num_packets = 0;
-    }
-}
-
-static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
-                                int size, int64_t pos, uint64_t cluster_time,
-                                uint64_t duration, int is_keyframe,
-                                int64_t cluster_pos)
-{
-    uint64_t timecode = AV_NOPTS_VALUE;
-    MatroskaTrack *track;
-    int res = 0;
-    AVStream *st;
-    AVPacket *pkt;
-    int16_t block_time;
-    uint32_t *lace_size = NULL;
-    int n, flags, laces = 0;
-    uint64_t num;
-
-    if ((n = matroska_ebmlnum_uint(matroska, data, size, &num)) < 0) {
-        av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
-        return res;
-    }
-    data += n;
-    size -= n;
-
-    track = matroska_find_track_by_num(matroska, num);
-    if (size <= 3 || !track || !track->stream) {
-        av_log(matroska->ctx, AV_LOG_INFO,
-               "Invalid stream %"PRIu64" or size %u\n", num, size);
-        return res;
-    }
-    st = track->stream;
-    if (st->discard >= AVDISCARD_ALL)
-        return res;
-    if (duration == AV_NOPTS_VALUE)
-        duration = track->default_duration / matroska->time_scale;
-
-    block_time = AV_RB16(data);
-    data += 2;
-    flags = *data++;
-    size -= 3;
-    if (is_keyframe == -1)
-        is_keyframe = flags & 0x80 ? AV_PKT_FLAG_KEY : 0;
-
-    if (cluster_time != (uint64_t)-1
-        && (block_time >= 0 || cluster_time >= -block_time)) {
-        timecode = cluster_time + block_time;
-        if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE
-            && timecode < track->end_timecode)
-            is_keyframe = 0;  /* overlapping subtitles are not key frame */
-        if (is_keyframe)
-            av_add_index_entry(st, cluster_pos, timecode, 0,0,AVINDEX_KEYFRAME);
-        track->end_timecode = FFMAX(track->end_timecode, timecode+duration);
-    }
-
-    if (matroska->skip_to_keyframe && track->type != MATROSKA_TRACK_TYPE_SUBTITLE) {
-        if (!is_keyframe || timecode < matroska->skip_to_timecode)
-            return res;
-        matroska->skip_to_keyframe = 0;
-    }
-
-    switch ((flags & 0x06) >> 1) {
-        case 0x0: /* no lacing */
-            laces = 1;
-            lace_size = av_mallocz(sizeof(int));
-            lace_size[0] = size;
-            break;
-
-        case 0x1: /* Xiph lacing */
-        case 0x2: /* fixed-size lacing */
-        case 0x3: /* EBML lacing */
-            assert(size>0); // size <=3 is checked before size-=3 above
-            laces = (*data) + 1;
-            data += 1;
-            size -= 1;
-            lace_size = av_mallocz(laces * sizeof(int));
-
-            switch ((flags & 0x06) >> 1) {
-                case 0x1: /* Xiph lacing */ {
-                    uint8_t temp;
-                    uint32_t total = 0;
-                    for (n = 0; res == 0 && n < laces - 1; n++) {
-                        while (1) {
-                            if (size == 0) {
-                                res = -1;
-                                break;
-                            }
-                            temp = *data;
-                            lace_size[n] += temp;
-                            data += 1;
-                            size -= 1;
-                            if (temp != 0xff)
-                                break;
-                        }
-                        total += lace_size[n];
-                    }
-                    lace_size[n] = size - total;
-                    break;
-                }
-
-                case 0x2: /* fixed-size lacing */
-                    for (n = 0; n < laces; n++)
-                        lace_size[n] = size / laces;
-                    break;
-
-                case 0x3: /* EBML lacing */ {
-                    uint32_t total;
-                    n = matroska_ebmlnum_uint(matroska, data, size, &num);
-                    if (n < 0) {
-                        av_log(matroska->ctx, AV_LOG_INFO,
-                               "EBML block data error\n");
-                        break;
-                    }
-                    data += n;
-                    size -= n;
-                    total = lace_size[0] = num;
-                    for (n = 1; res == 0 && n < laces - 1; n++) {
-                        int64_t snum;
-                        int r;
-                        r = matroska_ebmlnum_sint(matroska, data, size, &snum);
-                        if (r < 0) {
-                            av_log(matroska->ctx, AV_LOG_INFO,
-                                   "EBML block data error\n");
-                            break;
-                        }
-                        data += r;
-                        size -= r;
-                        lace_size[n] = lace_size[n - 1] + snum;
-                        total += lace_size[n];
-                    }
-                    lace_size[n] = size - total;
-                    break;
-                }
-            }
-            break;
-    }
-
-    if (res == 0) {
-        for (n = 0; n < laces; n++) {
-            if ((st->codec->codec_id == CODEC_ID_RA_288 ||
-                 st->codec->codec_id == CODEC_ID_COOK ||
-                 st->codec->codec_id == CODEC_ID_SIPR ||
-                 st->codec->codec_id == CODEC_ID_ATRAC3) &&
-                 st->codec->block_align && track->audio.sub_packet_size) {
-                int a = st->codec->block_align;
-                int sps = track->audio.sub_packet_size;
-                int cfs = track->audio.coded_framesize;
-                int h = track->audio.sub_packet_h;
-                int y = track->audio.sub_packet_cnt;
-                int w = track->audio.frame_size;
-                int x;
-
-                if (!track->audio.pkt_cnt) {
-                    if (st->codec->codec_id == CODEC_ID_RA_288)
-                        for (x=0; x<h/2; x++)
-                            memcpy(track->audio.buf+x*2*w+y*cfs,
-                                   data+x*cfs, cfs);
-                    else if (st->codec->codec_id == CODEC_ID_SIPR)
-                        memcpy(track->audio.buf + y*w, data, w);
-                    else
-                        for (x=0; x<w/sps; x++)
-                            memcpy(track->audio.buf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), data+x*sps, sps);
-
-                    if (++track->audio.sub_packet_cnt >= h) {
-                        if (st->codec->codec_id == CODEC_ID_SIPR)
-                            ff_rm_reorder_sipr_data(track->audio.buf, h, w);
-                        track->audio.sub_packet_cnt = 0;
-                        track->audio.pkt_cnt = h*w / a;
-                    }
-                }
-                while (track->audio.pkt_cnt) {
-                    pkt = av_mallocz(sizeof(AVPacket));
-                    av_new_packet(pkt, a);
-                    memcpy(pkt->data, track->audio.buf
-                           + a * (h*w / a - track->audio.pkt_cnt--), a);
-                    pkt->pos = pos;
-                    pkt->stream_index = st->index;
-                    dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
-                }
-            } else {
-                MatroskaTrackEncoding *encodings = track->encodings.elem;
-                int offset = 0, pkt_size = lace_size[n];
-                uint8_t *pkt_data = data;
-
-                if (lace_size[n] > size) {
-                    av_log(matroska->ctx, AV_LOG_ERROR, "Invalid packet size\n");
-                    break;
-                }
-
-                if (encodings && encodings->scope & 1) {
-                    offset = matroska_decode_buffer(&pkt_data,&pkt_size, track);
-                    if (offset < 0)
-                        continue;
-                }
-
-                pkt = av_mallocz(sizeof(AVPacket));
-                /* XXX: prevent data copy... */
-                if (av_new_packet(pkt, pkt_size+offset) < 0) {
-                    av_free(pkt);
-                    res = AVERROR(ENOMEM);
-                    break;
-                }
-                if (offset)
-                    memcpy (pkt->data, encodings->compression.settings.data, offset);
-                memcpy (pkt->data+offset, pkt_data, pkt_size);
-
-                if (pkt_data != data)
-                    av_free(pkt_data);
-
-                if (n == 0)
-                    pkt->flags = is_keyframe;
-                pkt->stream_index = st->index;
-
-                if (track->ms_compat)
-                    pkt->dts = timecode;
-                else
-                    pkt->pts = timecode;
-                pkt->pos = pos;
-                if (st->codec->codec_id == CODEC_ID_TEXT)
-                    pkt->convergence_duration = duration;
-                else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE)
-                    pkt->duration = duration;
-
-                if (st->codec->codec_id == CODEC_ID_SSA)
-                    matroska_fix_ass_packet(matroska, pkt, duration);
-
-                if (matroska->prev_pkt &&
-                    timecode != AV_NOPTS_VALUE &&
-                    matroska->prev_pkt->pts == timecode &&
-                    matroska->prev_pkt->stream_index == st->index)
-                    matroska_merge_packets(matroska->prev_pkt, pkt);
-                else {
-                    dynarray_add(&matroska->packets,&matroska->num_packets,pkt);
-                    matroska->prev_pkt = pkt;
-                }
-            }
-
-            if (timecode != AV_NOPTS_VALUE)
-                timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
-            data += lace_size[n];
-            size -= lace_size[n];
-        }
-    }
-
-    av_free(lace_size);
-    return res;
-}
-
-static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
-{
-    MatroskaCluster cluster = { 0 };
-    EbmlList *blocks_list;
-    MatroskaBlock *blocks;
-    int i, res;
-    int64_t pos = url_ftell(matroska->ctx->pb);
-    matroska->prev_pkt = NULL;
-    if (matroska->has_cluster_id){
-        /* For the first cluster we parse, its ID was already read as
-           part of matroska_read_header(), so don't read it again */
-        res = ebml_parse_id(matroska, matroska_clusters,
-                            MATROSKA_ID_CLUSTER, &cluster);
-        pos -= 4;  /* sizeof the ID which was already read */
-        matroska->has_cluster_id = 0;
-    } else
-        res = ebml_parse(matroska, matroska_clusters, &cluster);
-    blocks_list = &cluster.blocks;
-    blocks = blocks_list->elem;
-    for (i=0; i<blocks_list->nb_elem; i++)
-        if (blocks[i].bin.size > 0) {
-            int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
-            res=matroska_parse_block(matroska,
-                                     blocks[i].bin.data, blocks[i].bin.size,
-                                     blocks[i].bin.pos,  cluster.timecode,
-                                     blocks[i].duration, is_keyframe,
-                                     pos);
-        }
-    ebml_free(matroska_cluster, &cluster);
-    if (res < 0)  matroska->done = 1;
-    return res;
-}
-
-static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MatroskaDemuxContext *matroska = s->priv_data;
-
-    while (matroska_deliver_packet(matroska, pkt)) {
-        if (matroska->done)
-            return AVERROR_EOF;
-        matroska_parse_cluster(matroska);
-    }
-
-    return 0;
-}
-
-static int matroska_read_seek(AVFormatContext *s, int stream_index,
-                              int64_t timestamp, int flags)
-{
-    MatroskaDemuxContext *matroska = s->priv_data;
-    MatroskaTrack *tracks = matroska->tracks.elem;
-    AVStream *st = s->streams[stream_index];
-    int i, index, index_sub, index_min;
-
-    if (!st->nb_index_entries)
-        return 0;
-    timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
-
-    if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
-        url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
-        while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
-            matroska_clear_queue(matroska);
-            if (matroska_parse_cluster(matroska) < 0)
-                break;
-        }
-    }
-
-    matroska_clear_queue(matroska);
-    if (index < 0)
-        return 0;
-
-    index_min = index;
-    for (i=0; i < matroska->tracks.nb_elem; i++) {
-        tracks[i].end_timecode = 0;
-        if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE
-            && !tracks[i].stream->discard != AVDISCARD_ALL) {
-            index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD);
-            if (index_sub >= 0
-                && st->index_entries[index_sub].pos < st->index_entries[index_min].pos
-                && st->index_entries[index].timestamp - st->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale)
-                index_min = index_sub;
-        }
-    }
-
-    url_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
-    matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
-    matroska->skip_to_timecode = st->index_entries[index].timestamp;
-    matroska->done = 0;
-    av_update_cur_dts(s, st, st->index_entries[index].timestamp);
-    return 0;
-}
-
-static int matroska_read_close(AVFormatContext *s)
-{
-    MatroskaDemuxContext *matroska = s->priv_data;
-    MatroskaTrack *tracks = matroska->tracks.elem;
-    int n;
-
-    matroska_clear_queue(matroska);
-
-    for (n=0; n < matroska->tracks.nb_elem; n++)
-        if (tracks[n].type == MATROSKA_TRACK_TYPE_AUDIO)
-            av_free(tracks[n].audio.buf);
-    ebml_free(matroska_segment, matroska);
-
-    return 0;
-}
-
-AVInputFormat matroska_demuxer = {
-    "matroska",
-    NULL_IF_CONFIG_SMALL("Matroska file format"),
-    sizeof(MatroskaDemuxContext),
-    matroska_probe,
-    matroska_read_header,
-    matroska_read_packet,
-    matroska_read_close,
-    matroska_read_seek,
-    .metadata_conv = ff_mkv_metadata_conv,
-};
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
deleted file mode 100644
index c004bd6..0000000
--- a/libavformat/matroskaenc.c
+++ /dev/null
@@ -1,1042 +0,0 @@
-/*
- * Matroska muxer
- * Copyright (c) 2007 David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "riff.h"
-#include "isom.h"
-#include "matroska.h"
-#include "avc.h"
-#include "flacenc.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/md5.h"
-#include "libavcodec/xiph.h"
-#include "libavcodec/mpeg4audio.h"
-
-typedef struct ebml_master {
-    int64_t         pos;                ///< absolute offset in the file where the master's elements start
-    int             sizebytes;          ///< how many bytes were reserved for the size
-} ebml_master;
-
-typedef struct mkv_seekhead_entry {
-    unsigned int    elementid;
-    uint64_t        segmentpos;
-} mkv_seekhead_entry;
-
-typedef struct mkv_seekhead {
-    int64_t                 filepos;
-    int64_t                 segment_offset;     ///< the file offset to the beginning of the segment
-    int                     reserved_size;      ///< -1 if appending to file
-    int                     max_entries;
-    mkv_seekhead_entry      *entries;
-    int                     num_entries;
-} mkv_seekhead;
-
-typedef struct {
-    uint64_t        pts;
-    int             tracknum;
-    int64_t         cluster_pos;        ///< file offset of the cluster containing the block
-} mkv_cuepoint;
-
-typedef struct {
-    int64_t         segment_offset;
-    mkv_cuepoint    *entries;
-    int             num_entries;
-} mkv_cues;
-
-typedef struct {
-    int             write_dts;
-} mkv_track;
-
-#define MODE_MATROSKAv2 0x01
-#define MODE_WEBM       0x02
-
-typedef struct MatroskaMuxContext {
-    int             mode;
-    ByteIOContext   *dyn_bc;
-    ebml_master     segment;
-    int64_t         segment_offset;
-    int64_t         segment_uid;
-    ebml_master     cluster;
-    int64_t         cluster_pos;        ///< file offset of the current cluster
-    int64_t         cluster_pts;
-    int64_t         duration_offset;
-    int64_t         duration;
-    mkv_seekhead    *main_seekhead;
-    mkv_seekhead    *cluster_seekhead;
-    mkv_cues        *cues;
-    mkv_track       *tracks;
-
-    struct AVMD5    *md5_ctx;
-} MatroskaMuxContext;
-
-
-/** 2 bytes * 3 for EBML IDs, 3 1-byte EBML lengths, 8 bytes for 64 bit
- * offset, 4 bytes for target EBML ID */
-#define MAX_SEEKENTRY_SIZE 21
-
-/** per-cuepoint-track - 3 1-byte EBML IDs, 3 1-byte EBML sizes, 2
- * 8-byte uint max */
-#define MAX_CUETRACKPOS_SIZE 22
-
-/** per-cuepoint - 2 1-byte EBML IDs, 2 1-byte EBML sizes, 8-byte uint max */
-#define MAX_CUEPOINT_SIZE(num_tracks) 12 + MAX_CUETRACKPOS_SIZE*num_tracks
-
-
-static int ebml_id_size(unsigned int id)
-{
-    return (av_log2(id+1)-1)/7+1;
-}
-
-static void put_ebml_id(ByteIOContext *pb, unsigned int id)
-{
-    int i = ebml_id_size(id);
-    while (i--)
-        put_byte(pb, id >> (i*8));
-}
-
-/**
- * Write an EBML size meaning "unknown size".
- *
- * @param bytes The number of bytes the size should occupy (maximum: 8).
- */
-static void put_ebml_size_unknown(ByteIOContext *pb, int bytes)
-{
-    assert(bytes <= 8);
-    put_byte(pb, 0x1ff >> bytes);
-    while (--bytes)
-        put_byte(pb, 0xff);
-}
-
-/**
- * Calculate how many bytes are needed to represent a given number in EBML.
- */
-static int ebml_num_size(uint64_t num)
-{
-    int bytes = 1;
-    while ((num+1) >> bytes*7) bytes++;
-    return bytes;
-}
-
-/**
- * Write a number in EBML variable length format.
- *
- * @param bytes The number of bytes that need to be used to write the number.
- *              If zero, any number of bytes can be used.
- */
-static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes)
-{
-    int i, needed_bytes = ebml_num_size(num);
-
-    // sizes larger than this are currently undefined in EBML
-    assert(num < (1ULL<<56)-1);
-
-    if (bytes == 0)
-        // don't care how many bytes are used, so use the min
-        bytes = needed_bytes;
-    // the bytes needed to write the given size would exceed the bytes
-    // that we need to use, so write unknown size. This shouldn't happen.
-    assert(bytes >= needed_bytes);
-
-    num |= 1ULL << bytes*7;
-    for (i = bytes - 1; i >= 0; i--)
-        put_byte(pb, num >> i*8);
-}
-
-static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val)
-{
-    int i, bytes = 1;
-    uint64_t tmp = val;
-    while (tmp>>=8) bytes++;
-
-    put_ebml_id(pb, elementid);
-    put_ebml_num(pb, bytes, 0);
-    for (i = bytes - 1; i >= 0; i--)
-        put_byte(pb, val >> i*8);
-}
-
-static void put_ebml_float(ByteIOContext *pb, unsigned int elementid, double val)
-{
-    put_ebml_id(pb, elementid);
-    put_ebml_num(pb, 8, 0);
-    put_be64(pb, av_dbl2int(val));
-}
-
-static void put_ebml_binary(ByteIOContext *pb, unsigned int elementid,
-                            const uint8_t *buf, int size)
-{
-    put_ebml_id(pb, elementid);
-    put_ebml_num(pb, size, 0);
-    put_buffer(pb, buf, size);
-}
-
-static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const char *str)
-{
-    put_ebml_binary(pb, elementid, str, strlen(str));
-}
-
-/**
- * Writes a void element of a given size. Useful for reserving space in
- * the file to be written to later.
- *
- * @param size The number of bytes to reserve, which must be at least 2.
- */
-static void put_ebml_void(ByteIOContext *pb, uint64_t size)
-{
-    int64_t currentpos = url_ftell(pb);
-
-    assert(size >= 2);
-
-    put_ebml_id(pb, EBML_ID_VOID);
-    // we need to subtract the length needed to store the size from the
-    // size we need to reserve so 2 cases, we use 8 bytes to store the
-    // size if possible, 1 byte otherwise
-    if (size < 10)
-        put_ebml_num(pb, size-1, 0);
-    else
-        put_ebml_num(pb, size-9, 8);
-    while(url_ftell(pb) < currentpos + size)
-        put_byte(pb, 0);
-}
-
-static ebml_master start_ebml_master(ByteIOContext *pb, unsigned int elementid, uint64_t expectedsize)
-{
-    int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
-    put_ebml_id(pb, elementid);
-    put_ebml_size_unknown(pb, bytes);
-    return (ebml_master){ url_ftell(pb), bytes };
-}
-
-static void end_ebml_master(ByteIOContext *pb, ebml_master master)
-{
-    int64_t pos = url_ftell(pb);
-
-    if (url_fseek(pb, master.pos - master.sizebytes, SEEK_SET) < 0)
-        return;
-    put_ebml_num(pb, pos - master.pos, master.sizebytes);
-    url_fseek(pb, pos, SEEK_SET);
-}
-
-static void put_xiph_size(ByteIOContext *pb, int size)
-{
-    int i;
-    for (i = 0; i < size / 255; i++)
-        put_byte(pb, 255);
-    put_byte(pb, size % 255);
-}
-
-/**
- * Initialize a mkv_seekhead element to be ready to index level 1 Matroska
- * elements. If a maximum number of elements is specified, enough space
- * will be reserved at the current file location to write a seek head of
- * that size.
- *
- * @param segment_offset The absolute offset to the position in the file
- *                       where the segment begins.
- * @param numelements The maximum number of elements that will be indexed
- *                    by this seek head, 0 if unlimited.
- */
-static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, int64_t segment_offset, int numelements)
-{
-    mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead));
-    if (new_seekhead == NULL)
-        return NULL;
-
-    new_seekhead->segment_offset = segment_offset;
-
-    if (numelements > 0) {
-        new_seekhead->filepos = url_ftell(pb);
-        // 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID
-        // and size, and 3 bytes to guarantee that an EBML void element
-        // will fit afterwards
-        new_seekhead->reserved_size = numelements * MAX_SEEKENTRY_SIZE + 13;
-        new_seekhead->max_entries = numelements;
-        put_ebml_void(pb, new_seekhead->reserved_size);
-    }
-    return new_seekhead;
-}
-
-static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid, uint64_t filepos)
-{
-    mkv_seekhead_entry *entries = seekhead->entries;
-
-    // don't store more elements than we reserved space for
-    if (seekhead->max_entries > 0 && seekhead->max_entries <= seekhead->num_entries)
-        return -1;
-
-    entries = av_realloc(entries, (seekhead->num_entries + 1) * sizeof(mkv_seekhead_entry));
-    if (entries == NULL)
-        return AVERROR(ENOMEM);
-
-    entries[seekhead->num_entries  ].elementid = elementid;
-    entries[seekhead->num_entries++].segmentpos = filepos - seekhead->segment_offset;
-
-    seekhead->entries = entries;
-    return 0;
-}
-
-/**
- * Write the seek head to the file and free it. If a maximum number of
- * elements was specified to mkv_start_seekhead(), the seek head will
- * be written at the location reserved for it. Otherwise, it is written
- * at the current location in the file.
- *
- * @return The file offset where the seekhead was written,
- * -1 if an error occurred.
- */
-static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead)
-{
-    ebml_master metaseek, seekentry;
-    int64_t currentpos;
-    int i;
-
-    currentpos = url_ftell(pb);
-
-    if (seekhead->reserved_size > 0)
-        if (url_fseek(pb, seekhead->filepos, SEEK_SET) < 0)
-            return -1;
-
-    metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size);
-    for (i = 0; i < seekhead->num_entries; i++) {
-        mkv_seekhead_entry *entry = &seekhead->entries[i];
-
-        seekentry = start_ebml_master(pb, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE);
-
-        put_ebml_id(pb, MATROSKA_ID_SEEKID);
-        put_ebml_num(pb, ebml_id_size(entry->elementid), 0);
-        put_ebml_id(pb, entry->elementid);
-
-        put_ebml_uint(pb, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);
-        end_ebml_master(pb, seekentry);
-    }
-    end_ebml_master(pb, metaseek);
-
-    if (seekhead->reserved_size > 0) {
-        uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb);
-        put_ebml_void(pb, remaining);
-        url_fseek(pb, currentpos, SEEK_SET);
-
-        currentpos = seekhead->filepos;
-    }
-    av_free(seekhead->entries);
-    av_free(seekhead);
-
-    return currentpos;
-}
-
-static mkv_cues * mkv_start_cues(int64_t segment_offset)
-{
-    mkv_cues *cues = av_mallocz(sizeof(mkv_cues));
-    if (cues == NULL)
-        return NULL;
-
-    cues->segment_offset = segment_offset;
-    return cues;
-}
-
-static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos)
-{
-    mkv_cuepoint *entries = cues->entries;
-
-    entries = av_realloc(entries, (cues->num_entries + 1) * sizeof(mkv_cuepoint));
-    if (entries == NULL)
-        return AVERROR(ENOMEM);
-
-    if (ts < 0)
-        return 0;
-
-    entries[cues->num_entries  ].pts = ts;
-    entries[cues->num_entries  ].tracknum = stream + 1;
-    entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
-
-    cues->entries = entries;
-    return 0;
-}
-
-static int64_t mkv_write_cues(ByteIOContext *pb, mkv_cues *cues, int num_tracks)
-{
-    ebml_master cues_element;
-    int64_t currentpos;
-    int i, j;
-
-    currentpos = url_ftell(pb);
-    cues_element = start_ebml_master(pb, MATROSKA_ID_CUES, 0);
-
-    for (i = 0; i < cues->num_entries; i++) {
-        ebml_master cuepoint, track_positions;
-        mkv_cuepoint *entry = &cues->entries[i];
-        uint64_t pts = entry->pts;
-
-        cuepoint = start_ebml_master(pb, MATROSKA_ID_POINTENTRY, MAX_CUEPOINT_SIZE(num_tracks));
-        put_ebml_uint(pb, MATROSKA_ID_CUETIME, pts);
-
-        // put all the entries from different tracks that have the exact same
-        // timestamp into the same CuePoint
-        for (j = 0; j < cues->num_entries - i && entry[j].pts == pts; j++) {
-            track_positions = start_ebml_master(pb, MATROSKA_ID_CUETRACKPOSITION, MAX_CUETRACKPOS_SIZE);
-            put_ebml_uint(pb, MATROSKA_ID_CUETRACK          , entry[j].tracknum   );
-            put_ebml_uint(pb, MATROSKA_ID_CUECLUSTERPOSITION, entry[j].cluster_pos);
-            end_ebml_master(pb, track_positions);
-        }
-        i += j - 1;
-        end_ebml_master(pb, cuepoint);
-    }
-    end_ebml_master(pb, cues_element);
-
-    av_free(cues->entries);
-    av_free(cues);
-    return currentpos;
-}
-
-static int put_xiph_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec)
-{
-    uint8_t *header_start[3];
-    int header_len[3];
-    int first_header_size;
-    int j;
-
-    if (codec->codec_id == CODEC_ID_VORBIS)
-        first_header_size = 30;
-    else
-        first_header_size = 42;
-
-    if (ff_split_xiph_headers(codec->extradata, codec->extradata_size,
-                              first_header_size, header_start, header_len) < 0) {
-        av_log(s, AV_LOG_ERROR, "Extradata corrupt.\n");
-        return -1;
-    }
-
-    put_byte(pb, 2);                    // number packets - 1
-    for (j = 0; j < 2; j++) {
-        put_xiph_size(pb, header_len[j]);
-    }
-    for (j = 0; j < 3; j++)
-        put_buffer(pb, header_start[j], header_len[j]);
-
-    return 0;
-}
-
-static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int *sample_rate, int *output_sample_rate)
-{
-    int sri;
-
-    if (codec->extradata_size < 2) {
-        av_log(s, AV_LOG_WARNING, "No AAC extradata, unable to determine samplerate.\n");
-        return;
-    }
-
-    sri = ((codec->extradata[0] << 1) & 0xE) | (codec->extradata[1] >> 7);
-    if (sri > 12) {
-        av_log(s, AV_LOG_WARNING, "AAC samplerate index out of bounds\n");
-        return;
-    }
-    *sample_rate = ff_mpeg4audio_sample_rates[sri];
-
-    // if sbr, get output sample rate as well
-    if (codec->extradata_size == 5) {
-        sri = (codec->extradata[4] >> 3) & 0xF;
-        if (sri > 12) {
-            av_log(s, AV_LOG_WARNING, "AAC output samplerate index out of bounds\n");
-            return;
-        }
-        *output_sample_rate = ff_mpeg4audio_sample_rates[sri];
-    }
-}
-
-static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id, int qt_id)
-{
-    ByteIOContext *dyn_cp;
-    uint8_t *codecpriv;
-    int ret, codecpriv_size;
-
-    ret = url_open_dyn_buf(&dyn_cp);
-    if(ret < 0)
-        return ret;
-
-    if (native_id) {
-        if (codec->codec_id == CODEC_ID_VORBIS || codec->codec_id == CODEC_ID_THEORA)
-            ret = put_xiph_codecpriv(s, dyn_cp, codec);
-        else if (codec->codec_id == CODEC_ID_FLAC)
-            ret = ff_flac_write_header(dyn_cp, codec, 1);
-        else if (codec->codec_id == CODEC_ID_H264)
-            ret = ff_isom_write_avcc(dyn_cp, codec->extradata, codec->extradata_size);
-        else if (codec->extradata_size)
-            put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
-    } else if (codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        if (qt_id) {
-            if (!codec->codec_tag)
-                codec->codec_tag = ff_codec_get_tag(codec_movvideo_tags, codec->codec_id);
-            if (codec->extradata_size)
-                put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
-        } else {
-            if (!codec->codec_tag)
-                codec->codec_tag = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id);
-            if (!codec->codec_tag) {
-                av_log(s, AV_LOG_ERROR, "No bmp codec ID found.\n");
-                ret = -1;
-            }
-
-            ff_put_bmp_header(dyn_cp, codec, ff_codec_bmp_tags, 0);
-        }
-
-    } else if (codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-        unsigned int tag;
-        tag = ff_codec_get_tag(ff_codec_wav_tags, codec->codec_id);
-        if (!tag) {
-            av_log(s, AV_LOG_ERROR, "No wav codec ID found.\n");
-            ret = -1;
-        }
-        if (!codec->codec_tag)
-            codec->codec_tag = tag;
-
-        ff_put_wav_header(dyn_cp, codec);
-    }
-
-    codecpriv_size = url_close_dyn_buf(dyn_cp, &codecpriv);
-    if (codecpriv_size)
-        put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv, codecpriv_size);
-    av_free(codecpriv);
-    return ret;
-}
-
-static int mkv_write_tracks(AVFormatContext *s)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    ebml_master tracks;
-    int i, j, ret;
-
-    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, url_ftell(pb));
-    if (ret < 0) return ret;
-
-    tracks = start_ebml_master(pb, MATROSKA_ID_TRACKS, 0);
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        AVCodecContext *codec = st->codec;
-        ebml_master subinfo, track;
-        int native_id = 0;
-        int qt_id = 0;
-        int bit_depth = av_get_bits_per_sample(codec->codec_id);
-        int sample_rate = codec->sample_rate;
-        int output_sample_rate = 0;
-        AVMetadataTag *tag;
-
-        if (!bit_depth)
-            bit_depth = av_get_bits_per_sample_format(codec->sample_fmt);
-
-        if (codec->codec_id == CODEC_ID_AAC)
-            get_aac_sample_rates(s, codec, &sample_rate, &output_sample_rate);
-
-        track = start_ebml_master(pb, MATROSKA_ID_TRACKENTRY, 0);
-        put_ebml_uint (pb, MATROSKA_ID_TRACKNUMBER     , i + 1);
-        put_ebml_uint (pb, MATROSKA_ID_TRACKUID        , i + 1);
-        put_ebml_uint (pb, MATROSKA_ID_TRACKFLAGLACING , 0);    // no lacing (yet)
-
-        if ((tag = av_metadata_get(st->metadata, "title", NULL, 0)))
-            put_ebml_string(pb, MATROSKA_ID_TRACKNAME, tag->value);
-        tag = av_metadata_get(st->metadata, "language", NULL, 0);
-        put_ebml_string(pb, MATROSKA_ID_TRACKLANGUAGE, tag ? tag->value:"und");
-
-        if (st->disposition)
-            put_ebml_uint(pb, MATROSKA_ID_TRACKFLAGDEFAULT, !!(st->disposition & AV_DISPOSITION_DEFAULT));
-
-        // look for a codec ID string specific to mkv to use,
-        // if none are found, use AVI codes
-        for (j = 0; ff_mkv_codec_tags[j].id != CODEC_ID_NONE; j++) {
-            if (ff_mkv_codec_tags[j].id == codec->codec_id) {
-                put_ebml_string(pb, MATROSKA_ID_CODECID, ff_mkv_codec_tags[j].str);
-                native_id = 1;
-                break;
-            }
-        }
-
-        if (mkv->mode == MODE_WEBM && !(codec->codec_id == CODEC_ID_VP8 ||
-                                        codec->codec_id == CODEC_ID_VORBIS)) {
-            av_log(s, AV_LOG_ERROR,
-                   "Only VP8 video and Vorbis audio are supported for WebM.\n");
-            return AVERROR(EINVAL);
-        }
-
-        switch (codec->codec_type) {
-            case AVMEDIA_TYPE_VIDEO:
-                put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
-                put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, av_q2d(codec->time_base)*1E9);
-
-                if (!native_id &&
-                      ff_codec_get_tag(codec_movvideo_tags, codec->codec_id) &&
-                    (!ff_codec_get_tag(ff_codec_bmp_tags,   codec->codec_id)
-                     || codec->codec_id == CODEC_ID_SVQ1
-                     || codec->codec_id == CODEC_ID_SVQ3
-                     || codec->codec_id == CODEC_ID_CINEPAK))
-                    qt_id = 1;
-
-                if (qt_id)
-                    put_ebml_string(pb, MATROSKA_ID_CODECID, "V_QUICKTIME");
-                else if (!native_id) {
-                    // if there is no mkv-specific codec ID, use VFW mode
-                    put_ebml_string(pb, MATROSKA_ID_CODECID, "V_MS/VFW/FOURCC");
-                    mkv->tracks[i].write_dts = 1;
-                }
-
-                subinfo = start_ebml_master(pb, MATROSKA_ID_TRACKVIDEO, 0);
-                // XXX: interlace flag?
-                put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELWIDTH , codec->width);
-                put_ebml_uint (pb, MATROSKA_ID_VIDEOPIXELHEIGHT, codec->height);
-                if (st->sample_aspect_ratio.num) {
-                    int d_width = codec->width*av_q2d(st->sample_aspect_ratio);
-                    put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYWIDTH , d_width);
-                    put_ebml_uint(pb, MATROSKA_ID_VIDEODISPLAYHEIGHT, codec->height);
-                }
-                end_ebml_master(pb, subinfo);
-                break;
-
-            case AVMEDIA_TYPE_AUDIO:
-                put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_AUDIO);
-
-                if (!native_id)
-                    // no mkv-specific ID, use ACM mode
-                    put_ebml_string(pb, MATROSKA_ID_CODECID, "A_MS/ACM");
-
-                subinfo = start_ebml_master(pb, MATROSKA_ID_TRACKAUDIO, 0);
-                put_ebml_uint  (pb, MATROSKA_ID_AUDIOCHANNELS    , codec->channels);
-                put_ebml_float (pb, MATROSKA_ID_AUDIOSAMPLINGFREQ, sample_rate);
-                if (output_sample_rate)
-                    put_ebml_float(pb, MATROSKA_ID_AUDIOOUTSAMPLINGFREQ, output_sample_rate);
-                if (bit_depth)
-                    put_ebml_uint(pb, MATROSKA_ID_AUDIOBITDEPTH, bit_depth);
-                end_ebml_master(pb, subinfo);
-                break;
-
-            case AVMEDIA_TYPE_SUBTITLE:
-                put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_SUBTITLE);
-                break;
-            default:
-                av_log(s, AV_LOG_ERROR, "Only audio, video, and subtitles are supported for Matroska.");
-                break;
-        }
-        ret = mkv_write_codecprivate(s, pb, codec, native_id, qt_id);
-        if (ret < 0) return ret;
-
-        end_ebml_master(pb, track);
-
-        // ms precision is the de-facto standard timescale for mkv files
-        av_set_pts_info(st, 64, 1, 1000);
-    }
-    end_ebml_master(pb, tracks);
-    return 0;
-}
-
-static int mkv_write_chapters(AVFormatContext *s)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    ebml_master chapters, editionentry;
-    AVRational scale = {1, 1E9};
-    int i, ret;
-
-    if (!s->nb_chapters)
-        return 0;
-
-    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, url_ftell(pb));
-    if (ret < 0) return ret;
-
-    chapters     = start_ebml_master(pb, MATROSKA_ID_CHAPTERS    , 0);
-    editionentry = start_ebml_master(pb, MATROSKA_ID_EDITIONENTRY, 0);
-    put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGDEFAULT, 1);
-    put_ebml_uint(pb, MATROSKA_ID_EDITIONFLAGHIDDEN , 0);
-    for (i = 0; i < s->nb_chapters; i++) {
-        ebml_master chapteratom, chapterdisplay;
-        AVChapter *c     = s->chapters[i];
-        AVMetadataTag *t = NULL;
-
-        chapteratom = start_ebml_master(pb, MATROSKA_ID_CHAPTERATOM, 0);
-        put_ebml_uint(pb, MATROSKA_ID_CHAPTERUID, c->id);
-        put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMESTART,
-                      av_rescale_q(c->start, c->time_base, scale));
-        put_ebml_uint(pb, MATROSKA_ID_CHAPTERTIMEEND,
-                      av_rescale_q(c->end,   c->time_base, scale));
-        put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGHIDDEN , 0);
-        put_ebml_uint(pb, MATROSKA_ID_CHAPTERFLAGENABLED, 1);
-        if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) {
-            chapterdisplay = start_ebml_master(pb, MATROSKA_ID_CHAPTERDISPLAY, 0);
-            put_ebml_string(pb, MATROSKA_ID_CHAPSTRING, t->value);
-            put_ebml_string(pb, MATROSKA_ID_CHAPLANG  , "und");
-            end_ebml_master(pb, chapterdisplay);
-        }
-        end_ebml_master(pb, chapteratom);
-    }
-    end_ebml_master(pb, editionentry);
-    end_ebml_master(pb, chapters);
-    return 0;
-}
-
-static int mkv_write_header(AVFormatContext *s)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    ebml_master ebml_header, segment_info;
-    AVMetadataTag *tag;
-    int ret;
-
-    if (!strcmp(s->oformat->name, "webm")) mkv->mode = MODE_WEBM;
-    else                                   mkv->mode = MODE_MATROSKAv2;
-
-    mkv->md5_ctx = av_mallocz(av_md5_size);
-    av_md5_init(mkv->md5_ctx);
-    mkv->tracks = av_mallocz(s->nb_streams * sizeof(*mkv->tracks));
-
-    ebml_header = start_ebml_master(pb, EBML_ID_HEADER, 0);
-    put_ebml_uint   (pb, EBML_ID_EBMLVERSION        ,           1);
-    put_ebml_uint   (pb, EBML_ID_EBMLREADVERSION    ,           1);
-    put_ebml_uint   (pb, EBML_ID_EBMLMAXIDLENGTH    ,           4);
-    put_ebml_uint   (pb, EBML_ID_EBMLMAXSIZELENGTH  ,           8);
-    put_ebml_string (pb, EBML_ID_DOCTYPE            , s->oformat->name);
-    put_ebml_uint   (pb, EBML_ID_DOCTYPEVERSION     ,           2);
-    put_ebml_uint   (pb, EBML_ID_DOCTYPEREADVERSION ,           2);
-    end_ebml_master(pb, ebml_header);
-
-    mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0);
-    mkv->segment_offset = url_ftell(pb);
-
-    // we write 2 seek heads - one at the end of the file to point to each
-    // cluster, and one at the beginning to point to all other level one
-    // elements (including the seek head at the end of the file), which
-    // isn't more than 10 elements if we only write one of each other
-    // currently defined level 1 element
-    mkv->main_seekhead    = mkv_start_seekhead(pb, mkv->segment_offset, 10);
-    mkv->cluster_seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 0);
-    if (mkv->main_seekhead == NULL || mkv->cluster_seekhead == NULL)
-        return AVERROR(ENOMEM);
-
-    ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));
-    if (ret < 0) return ret;
-
-    segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0);
-    put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000);
-    if ((tag = av_metadata_get(s->metadata, "title", NULL, 0)))
-        put_ebml_string(pb, MATROSKA_ID_TITLE, tag->value);
-    if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
-        put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , LIBAVFORMAT_IDENT);
-        put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT);
-
-        // reserve space to write the segment UID later
-        mkv->segment_uid = url_ftell(pb);
-        put_ebml_void(pb, 19);
-    }
-
-    // reserve space for the duration
-    mkv->duration = 0;
-    mkv->duration_offset = url_ftell(pb);
-    put_ebml_void(pb, 11);                  // assumes double-precision float to be written
-    end_ebml_master(pb, segment_info);
-
-    ret = mkv_write_tracks(s);
-    if (ret < 0) return ret;
-
-    if (mkv->mode != MODE_WEBM) {
-        ret = mkv_write_chapters(s);
-        if (ret < 0) return ret;
-    }
-
-    if (url_is_streamed(s->pb))
-        mkv_write_seekhead(pb, mkv->main_seekhead);
-
-    mkv->cues = mkv_start_cues(mkv->segment_offset);
-    if (mkv->cues == NULL)
-        return AVERROR(ENOMEM);
-
-    put_flush_packet(pb);
-    return 0;
-}
-
-static int mkv_blockgroup_size(int pkt_size)
-{
-    int size = pkt_size + 4;
-    size += ebml_num_size(size);
-    size += 2;              // EBML ID for block and block duration
-    size += 8;              // max size of block duration
-    size += ebml_num_size(size);
-    size += 1;              // blockgroup EBML ID
-    return size;
-}
-
-static int ass_get_duration(const uint8_t *p)
-{
-    int sh, sm, ss, sc, eh, em, es, ec;
-    uint64_t start, end;
-
-    if (sscanf(p, "%*[^,],%d:%d:%d%*c%d,%d:%d:%d%*c%d",
-               &sh, &sm, &ss, &sc, &eh, &em, &es, &ec) != 8)
-        return 0;
-    start = 3600000*sh + 60000*sm + 1000*ss + 10*sc;
-    end   = 3600000*eh + 60000*em + 1000*es + 10*ec;
-    return end - start;
-}
-
-static int mkv_write_ass_blocks(AVFormatContext *s, ByteIOContext *pb, AVPacket *pkt)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    int i, layer = 0, max_duration = 0, size, line_size, data_size = pkt->size;
-    uint8_t *start, *end, *data = pkt->data;
-    ebml_master blockgroup;
-    char buffer[2048];
-
-    while (data_size) {
-        int duration = ass_get_duration(data);
-        max_duration = FFMAX(duration, max_duration);
-        end = memchr(data, '\n', data_size);
-        size = line_size = end ? end-data+1 : data_size;
-        size -= end ? (end[-1]=='\r')+1 : 0;
-        start = data;
-        for (i=0; i<3; i++, start++)
-            if (!(start = memchr(start, ',', size-(start-data))))
-                return max_duration;
-        size -= start - data;
-        sscanf(data, "Dialogue: %d,", &layer);
-        i = snprintf(buffer, sizeof(buffer), "%"PRId64",%d,",
-                     s->streams[pkt->stream_index]->nb_frames++, layer);
-        size = FFMIN(i+size, sizeof(buffer));
-        memcpy(buffer+i, start, size-i);
-
-        av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
-               "pts %" PRId64 ", duration %d\n",
-               url_ftell(pb), size, pkt->pts, duration);
-        blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size));
-        put_ebml_id(pb, MATROSKA_ID_BLOCK);
-        put_ebml_num(pb, size+4, 0);
-        put_byte(pb, 0x80 | (pkt->stream_index + 1));     // this assumes stream_index is less than 126
-        put_be16(pb, pkt->pts - mkv->cluster_pts);
-        put_byte(pb, 0);
-        put_buffer(pb, buffer, size);
-        put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
-        end_ebml_master(pb, blockgroup);
-
-        data += line_size;
-        data_size -= line_size;
-    }
-
-    return max_duration;
-}
-
-static void mkv_write_block(AVFormatContext *s, ByteIOContext *pb,
-                            unsigned int blockid, AVPacket *pkt, int flags)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
-    uint8_t *data = NULL;
-    int size = pkt->size;
-    int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
-
-    av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
-           "pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
-           url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
-    if (codec->codec_id == CODEC_ID_H264 && codec->extradata_size > 0 &&
-        (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
-        ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
-    else
-        data = pkt->data;
-    put_ebml_id(pb, blockid);
-    put_ebml_num(pb, size+4, 0);
-    put_byte(pb, 0x80 | (pkt->stream_index + 1));     // this assumes stream_index is less than 126
-    put_be16(pb, ts - mkv->cluster_pts);
-    put_byte(pb, flags);
-    put_buffer(pb, data, size);
-    if (data != pkt->data)
-        av_free(data);
-}
-
-static void mkv_flush_dynbuf(AVFormatContext *s)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    int bufsize;
-    uint8_t *dyn_buf;
-
-    if (!mkv->dyn_bc)
-        return;
-
-    bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
-    put_buffer(s->pb, dyn_buf, bufsize);
-    av_free(dyn_buf);
-    mkv->dyn_bc = NULL;
-}
-
-static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
-    int keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
-    int duration = pkt->duration;
-    int ret;
-    int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
-
-    if (ts == AV_NOPTS_VALUE) {
-        av_log(s, AV_LOG_ERROR, "Can't write packet with unknown timestamp\n");
-        return AVERROR(EINVAL);
-    }
-
-    if (url_is_streamed(s->pb)) {
-        if (!mkv->dyn_bc)
-            url_open_dyn_buf(&mkv->dyn_bc);
-        pb = mkv->dyn_bc;
-    }
-
-    if (!mkv->cluster_pos) {
-        ret = mkv_add_seekhead_entry(mkv->cluster_seekhead, MATROSKA_ID_CLUSTER, url_ftell(pb));
-        if (ret < 0) return ret;
-
-        mkv->cluster_pos = url_ftell(s->pb);
-        mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
-        put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
-        mkv->cluster_pts = FFMAX(0, ts);
-        av_md5_update(mkv->md5_ctx, pkt->data, FFMIN(200, pkt->size));
-    }
-
-    if (codec->codec_type != AVMEDIA_TYPE_SUBTITLE) {
-        mkv_write_block(s, pb, MATROSKA_ID_SIMPLEBLOCK, pkt, keyframe << 7);
-    } else if (codec->codec_id == CODEC_ID_SSA) {
-        duration = mkv_write_ass_blocks(s, pb, pkt);
-    } else {
-        ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt->size));
-        duration = pkt->convergence_duration;
-        mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 0);
-        put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
-        end_ebml_master(pb, blockgroup);
-    }
-
-    if (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe) {
-        ret = mkv_add_cuepoint(mkv->cues, pkt->stream_index, ts, mkv->cluster_pos);
-        if (ret < 0) return ret;
-    }
-
-    // start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming
-    if ((url_is_streamed(s->pb) && (url_ftell(pb) > 32*1024 || ts > mkv->cluster_pts + 1000))
-        ||  url_ftell(pb) > mkv->cluster_pos + 5*1024*1024 || ts > mkv->cluster_pts + 5000) {
-        av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64
-               " bytes, pts %" PRIu64 "\n", url_ftell(pb), ts);
-        end_ebml_master(pb, mkv->cluster);
-        mkv->cluster_pos = 0;
-        if (mkv->dyn_bc)
-            mkv_flush_dynbuf(s);
-    }
-
-    mkv->duration = FFMAX(mkv->duration, ts + duration);
-    return 0;
-}
-
-static int mkv_write_trailer(AVFormatContext *s)
-{
-    MatroskaMuxContext *mkv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t currentpos, second_seekhead, cuespos;
-    int ret;
-
-    if (mkv->dyn_bc) {
-        end_ebml_master(mkv->dyn_bc, mkv->cluster);
-        mkv_flush_dynbuf(s);
-    } else if (mkv->cluster_pos) {
-        end_ebml_master(pb, mkv->cluster);
-    }
-
-    if (!url_is_streamed(pb)) {
-        cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);
-        second_seekhead = mkv_write_seekhead(pb, mkv->cluster_seekhead);
-
-        ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES    , cuespos);
-        if (ret < 0) return ret;
-        if (second_seekhead >= 0) {
-            ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_SEEKHEAD, second_seekhead);
-            if (ret < 0) return ret;
-        }
-        mkv_write_seekhead(pb, mkv->main_seekhead);
-
-        // update the duration
-        av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration);
-        currentpos = url_ftell(pb);
-        url_fseek(pb, mkv->duration_offset, SEEK_SET);
-        put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration);
-
-        // write the md5sum of some frames as the segment UID
-        if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
-            uint8_t segment_uid[16];
-            av_md5_final(mkv->md5_ctx, segment_uid);
-            url_fseek(pb, mkv->segment_uid, SEEK_SET);
-            put_ebml_binary(pb, MATROSKA_ID_SEGMENTUID, segment_uid, 16);
-        }
-        url_fseek(pb, currentpos, SEEK_SET);
-    }
-
-    end_ebml_master(pb, mkv->segment);
-    av_free(mkv->md5_ctx);
-    av_free(mkv->tracks);
-    put_flush_packet(pb);
-    return 0;
-}
-
-#if CONFIG_MATROSKA_MUXER
-AVOutputFormat matroska_muxer = {
-    "matroska",
-    NULL_IF_CONFIG_SMALL("Matroska file format"),
-    "video/x-matroska",
-    "mkv",
-    sizeof(MatroskaMuxContext),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG4,
-    mkv_write_header,
-    mkv_write_packet,
-    mkv_write_trailer,
-    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
-    .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
-    .subtitle_codec = CODEC_ID_TEXT,
-};
-#endif
-
-#if CONFIG_WEBM_MUXER
-AVOutputFormat webm_muxer = {
-    "webm",
-    NULL_IF_CONFIG_SMALL("WebM file format"),
-    "video/webm",
-    "webm",
-    sizeof(MatroskaMuxContext),
-    CODEC_ID_VORBIS,
-    CODEC_ID_VP8,
-    mkv_write_header,
-    mkv_write_packet,
-    mkv_write_trailer,
-    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
-};
-#endif
-
-#if CONFIG_MATROSKA_AUDIO_MUXER
-AVOutputFormat matroska_audio_muxer = {
-    "matroska",
-    NULL_IF_CONFIG_SMALL("Matroska file format"),
-    "audio/x-matroska",
-    "mka",
-    sizeof(MatroskaMuxContext),
-    CODEC_ID_MP2,
-    CODEC_ID_NONE,
-    mkv_write_header,
-    mkv_write_packet,
-    mkv_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-    .codec_tag = (const AVCodecTag* const []){ff_codec_wav_tags, 0},
-};
-#endif
diff --git a/libavformat/metadata.c b/libavformat/metadata.c
deleted file mode 100644
index ff7ffe9..0000000
--- a/libavformat/metadata.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * copyright (c) 2009 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <strings.h>
-#include "avformat.h"
-#include "metadata.h"
-
-AVMetadataTag *
-av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags)
-{
-    unsigned int i, j;
-
-    if(!m)
-        return NULL;
-
-    if(prev) i= prev - m->elems + 1;
-    else     i= 0;
-
-    for(; i<m->count; i++){
-        const char *s= m->elems[i].key;
-        if(flags & AV_METADATA_MATCH_CASE) for(j=0;         s[j]  ==         key[j]  && key[j]; j++);
-        else                               for(j=0; toupper(s[j]) == toupper(key[j]) && key[j]; j++);
-        if(key[j])
-            continue;
-        if(s[j] && !(flags & AV_METADATA_IGNORE_SUFFIX))
-            continue;
-        return &m->elems[i];
-    }
-    return NULL;
-}
-
-int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags)
-{
-    AVMetadata *m= *pm;
-    AVMetadataTag *tag= av_metadata_get(m, key, NULL, AV_METADATA_MATCH_CASE);
-
-    if(!m)
-        m=*pm= av_mallocz(sizeof(*m));
-
-    if(tag){
-        if (flags & AV_METADATA_DONT_OVERWRITE)
-            return 0;
-        av_free(tag->value);
-        av_free(tag->key);
-        *tag= m->elems[--m->count];
-    }else{
-        AVMetadataTag *tmp= av_realloc(m->elems, (m->count+1) * sizeof(*m->elems));
-        if(tmp){
-            m->elems= tmp;
-        }else
-            return AVERROR(ENOMEM);
-    }
-    if(value){
-        if(flags & AV_METADATA_DONT_STRDUP_KEY){
-            m->elems[m->count].key  = key;
-        }else
-        m->elems[m->count].key  = av_strdup(key  );
-        if(flags & AV_METADATA_DONT_STRDUP_VAL){
-            m->elems[m->count].value= value;
-        }else
-        m->elems[m->count].value= av_strdup(value);
-        m->count++;
-    }
-    if(!m->count) {
-        av_free(m->elems);
-        av_freep(pm);
-    }
-
-    return 0;
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR == 52
-int av_metadata_set(AVMetadata **pm, const char *key, const char *value)
-{
-    return av_metadata_set2(pm, key, value, 0);
-}
-#endif
-
-void av_metadata_free(AVMetadata **pm)
-{
-    AVMetadata *m= *pm;
-
-    if(m){
-        while(m->count--){
-            av_free(m->elems[m->count].key);
-            av_free(m->elems[m->count].value);
-        }
-        av_free(m->elems);
-    }
-    av_freep(pm);
-}
-
-void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv,
-                                           const AVMetadataConv *s_conv)
-{
-    /* TODO: use binary search to look up the two conversion tables
-       if the tables are getting big enough that it would matter speed wise */
-    const AVMetadataConv *sc, *dc;
-    AVMetadataTag *mtag = NULL;
-    AVMetadata *dst = NULL;
-    const char *key;
-
-    while((mtag=av_metadata_get(*pm, "", mtag, AV_METADATA_IGNORE_SUFFIX))) {
-        key = mtag->key;
-        if (s_conv != d_conv) {
-            if (s_conv)
-                for (sc=s_conv; sc->native; sc++)
-                    if (!strcasecmp(key, sc->native)) {
-                        key = sc->generic;
-                        break;
-                    }
-            if (d_conv)
-                for (dc=d_conv; dc->native; dc++)
-                    if (!strcasecmp(key, dc->generic)) {
-                        key = dc->native;
-                        break;
-                    }
-        }
-        av_metadata_set2(&dst, key, mtag->value, 0);
-    }
-    av_metadata_free(pm);
-    *pm = dst;
-}
-
-void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv,
-                                            const AVMetadataConv *s_conv)
-{
-    int i;
-    metadata_conv(&ctx->metadata, d_conv, s_conv);
-    for (i=0; i<ctx->nb_streams ; i++)
-        metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv);
-    for (i=0; i<ctx->nb_chapters; i++)
-        metadata_conv(&ctx->chapters[i]->metadata, d_conv, s_conv);
-    for (i=0; i<ctx->nb_programs; i++)
-        metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv);
-}
diff --git a/libavformat/metadata.h b/libavformat/metadata.h
deleted file mode 100644
index fe7130e..0000000
--- a/libavformat/metadata.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * copyright (c) 2009 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_METADATA_H
-#define AVFORMAT_METADATA_H
-
-/**
- * @file
- * internal metadata API header
- * see avformat.h or the public API!
- */
-
-
-#include "avformat.h"
-
-struct AVMetadata{
-    int count;
-    AVMetadataTag *elems;
-};
-
-struct AVMetadataConv{
-    const char *native;
-    const char *generic;
-};
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-void ff_metadata_demux_compat(AVFormatContext *s);
-void ff_metadata_mux_compat(AVFormatContext *s);
-#endif
-
-void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv,
-                                    const AVMetadataConv *s_conv);
-
-#endif /* AVFORMAT_METADATA_H */
diff --git a/libavformat/metadata_compat.c b/libavformat/metadata_compat.c
deleted file mode 100644
index ac99c05..0000000
--- a/libavformat/metadata_compat.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2009  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <strings.h>
-#include "avformat.h"
-#include "metadata.h"
-#include "libavutil/avstring.h"
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-
-#define SIZE_OFFSET(x) sizeof(((AVFormatContext*)0)->x),offsetof(AVFormatContext,x)
-
-static const struct {
-    const char name[16];
-    int   size;
-    int   offset;
-} compat_tab[] = {
-    { "title",           SIZE_OFFSET(title)     },
-    { "author",          SIZE_OFFSET(author)    },
-    { "copyright",       SIZE_OFFSET(copyright) },
-    { "comment",         SIZE_OFFSET(comment)   },
-    { "album",           SIZE_OFFSET(album)     },
-    { "year",            SIZE_OFFSET(year)      },
-    { "track",           SIZE_OFFSET(track)     },
-    { "genre",           SIZE_OFFSET(genre)     },
-
-    { "artist",          SIZE_OFFSET(author)    },
-    { "creator",         SIZE_OFFSET(author)    },
-    { "written_by",      SIZE_OFFSET(author)    },
-    { "lead_performer",  SIZE_OFFSET(author)    },
-    { "composer",        SIZE_OFFSET(author)    },
-    { "performer",       SIZE_OFFSET(author)    },
-    { "description",     SIZE_OFFSET(comment)   },
-    { "albumtitle",      SIZE_OFFSET(album)     },
-    { "date",            SIZE_OFFSET(year)      },
-    { "date_written",    SIZE_OFFSET(year)      },
-    { "date_released",   SIZE_OFFSET(year)      },
-    { "tracknumber",     SIZE_OFFSET(track)     },
-    { "part_number",     SIZE_OFFSET(track)     },
-};
-
-void ff_metadata_demux_compat(AVFormatContext *ctx)
-{
-    AVMetadata *m;
-    int i, j;
-
-    if ((m = ctx->metadata))
-        for (j=0; j<m->count; j++)
-            for (i=0; i<FF_ARRAY_ELEMS(compat_tab); i++)
-                if (!strcasecmp(m->elems[j].key, compat_tab[i].name)) {
-                    int *ptr = (int *)((char *)ctx+compat_tab[i].offset);
-                    if (*ptr)  continue;
-                    if (compat_tab[i].size > sizeof(int))
-                        av_strlcpy((char *)ptr, m->elems[j].value, compat_tab[i].size);
-                    else
-                        *ptr = atoi(m->elems[j].value);
-                }
-
-    for (i=0; i<ctx->nb_chapters; i++)
-        if ((m = ctx->chapters[i]->metadata))
-            for (j=0; j<m->count; j++)
-                if (!strcasecmp(m->elems[j].key, "title")) {
-                    av_free(ctx->chapters[i]->title);
-                    ctx->chapters[i]->title = av_strdup(m->elems[j].value);
-                }
-
-    for (i=0; i<ctx->nb_programs; i++)
-        if ((m = ctx->programs[i]->metadata))
-            for (j=0; j<m->count; j++) {
-                if (!strcasecmp(m->elems[j].key, "name")) {
-                    av_free(ctx->programs[i]->name);
-                    ctx->programs[i]->name = av_strdup(m->elems[j].value);
-                }
-                if (!strcasecmp(m->elems[j].key, "provider_name")) {
-                    av_free(ctx->programs[i]->provider_name);
-                    ctx->programs[i]->provider_name = av_strdup(m->elems[j].value);
-                }
-            }
-
-    for (i=0; i<ctx->nb_streams; i++)
-        if ((m = ctx->streams[i]->metadata))
-            for (j=0; j<m->count; j++) {
-                if (!strcasecmp(m->elems[j].key, "language"))
-                    av_strlcpy(ctx->streams[i]->language, m->elems[j].value, 4);
-                if (!strcasecmp(m->elems[j].key, "filename")) {
-                    av_free(ctx->streams[i]->filename);
-                    ctx->streams[i]->filename= av_strdup(m->elems[j].value);
-                }
-            }
-}
-
-
-#define FILL_METADATA(s, key, value) {                                        \
-    if (value && *value && !av_metadata_get(s->metadata, #key, NULL, 0))      \
-        av_metadata_set2(&s->metadata, #key, value, 0);                       \
-    }
-#define FILL_METADATA_STR(s, key)  FILL_METADATA(s, key, s->key)
-#define FILL_METADATA_INT(s, key) {                                           \
-    char number[10];                                                          \
-    snprintf(number, sizeof(number), "%d", s->key);                           \
-    if(s->key)  FILL_METADATA(s, key, number) }
-
-void ff_metadata_mux_compat(AVFormatContext *ctx)
-{
-    int i;
-
-    if (ctx->metadata && ctx->metadata->count > 0)
-        return;
-
-    FILL_METADATA_STR(ctx, title);
-    FILL_METADATA_STR(ctx, author);
-    FILL_METADATA_STR(ctx, copyright);
-    FILL_METADATA_STR(ctx, comment);
-    FILL_METADATA_STR(ctx, album);
-    FILL_METADATA_INT(ctx, year);
-    FILL_METADATA_INT(ctx, track);
-    FILL_METADATA_STR(ctx, genre);
-    for (i=0; i<ctx->nb_chapters; i++)
-        FILL_METADATA_STR(ctx->chapters[i], title);
-    for (i=0; i<ctx->nb_programs; i++) {
-        FILL_METADATA_STR(ctx->programs[i], name);
-        FILL_METADATA_STR(ctx->programs[i], provider_name);
-    }
-    for (i=0; i<ctx->nb_streams; i++) {
-        FILL_METADATA_STR(ctx->streams[i], language);
-        FILL_METADATA_STR(ctx->streams[i], filename);
-    }
-}
-
-#endif /* LIBAVFORMAT_VERSION_MAJOR < 53 */
diff --git a/libavformat/mm.c b/libavformat/mm.c
deleted file mode 100644
index cb0917a..0000000
--- a/libavformat/mm.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * American Laser Games MM Format Demuxer
- * Copyright (c) 2006 Peter Ross
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * American Laser Games MM Format Demuxer
- * by Peter Ross (pross at xvid.org)
- *
- * The MM format was used by IBM-PC ports of ALG's "arcade shooter" games,
- * including Mad Dog McCree and Crime Patrol.
- *
- * Technical details here:
- *  http://wiki.multimedia.cx/index.php?title=American_Laser_Games_MM
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define MM_PREAMBLE_SIZE    6
-
-#define MM_TYPE_HEADER      0x0
-#define MM_TYPE_INTER       0x5
-#define MM_TYPE_INTRA       0x8
-#define MM_TYPE_INTRA_HH    0xc
-#define MM_TYPE_INTER_HH    0xd
-#define MM_TYPE_INTRA_HHV   0xe
-#define MM_TYPE_INTER_HHV   0xf
-#define MM_TYPE_AUDIO       0x15
-#define MM_TYPE_PALETTE     0x31
-
-#define MM_HEADER_LEN_V     0x16    /* video only */
-#define MM_HEADER_LEN_AV    0x18    /* video + audio */
-
-#define MM_PALETTE_COUNT    128
-#define MM_PALETTE_SIZE     (MM_PALETTE_COUNT*3)
-
-typedef struct {
-  unsigned int audio_pts, video_pts;
-} MmDemuxContext;
-
-static int probe(AVProbeData *p)
-{
-    int len, type, fps, w, h;
-    if (p->buf_size < MM_HEADER_LEN_AV + MM_PREAMBLE_SIZE)
-        return 0;
-    /* the first chunk is always the header */
-    if (AV_RL16(&p->buf[0]) != MM_TYPE_HEADER)
-        return 0;
-    len = AV_RL32(&p->buf[2]);
-    if (len != MM_HEADER_LEN_V && len != MM_HEADER_LEN_AV)
-        return 0;
-    fps = AV_RL16(&p->buf[8]);
-    w = AV_RL16(&p->buf[12]);
-    h = AV_RL16(&p->buf[14]);
-    if (!fps || fps > 60 || !w || w > 2048 || !h || h > 2048)
-        return 0;
-    type = AV_RL16(&p->buf[len]);
-    if (!type || type > 0x31)
-        return 0;
-
-    /* only return half certainty since this check is a bit sketchy */
-    return AVPROBE_SCORE_MAX / 2;
-}
-
-static int read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    MmDemuxContext *mm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-
-    unsigned int type, length;
-    unsigned int frame_rate, width, height;
-
-    type = get_le16(pb);
-    length = get_le32(pb);
-
-    if (type != MM_TYPE_HEADER)
-        return AVERROR_INVALIDDATA;
-
-    /* read header */
-    get_le16(pb);   /* total number of chunks */
-    frame_rate = get_le16(pb);
-    get_le16(pb);   /* ibm-pc video bios mode */
-    width = get_le16(pb);
-    height = get_le16(pb);
-    url_fseek(pb, length - 10, SEEK_CUR);  /* unknown data */
-
-    /* video stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_MMVIDEO;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = width;
-    st->codec->height = height;
-    av_set_pts_info(st, 64, 1, frame_rate);
-
-    /* audio stream */
-    if (length == MM_HEADER_LEN_AV) {
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_tag = 0; /* no fourcc */
-        st->codec->codec_id = CODEC_ID_PCM_U8;
-        st->codec->channels = 1;
-        st->codec->sample_rate = 8000;
-        av_set_pts_info(st, 64, 1, 8000); /* 8000 hz */
-    }
-
-    mm->audio_pts = 0;
-    mm->video_pts = 0;
-    return 0;
-}
-
-static int read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    MmDemuxContext *mm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned char preamble[MM_PREAMBLE_SIZE];
-    unsigned int type, length;
-
-    while(1) {
-
-        if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
-            return AVERROR(EIO);
-        }
-
-        type = AV_RL16(&preamble[0]);
-        length = AV_RL16(&preamble[2]);
-
-        switch(type) {
-        case MM_TYPE_PALETTE :
-        case MM_TYPE_INTER :
-        case MM_TYPE_INTRA :
-        case MM_TYPE_INTRA_HH :
-        case MM_TYPE_INTER_HH :
-        case MM_TYPE_INTRA_HHV :
-        case MM_TYPE_INTER_HHV :
-            /* output preamble + data */
-            if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE))
-                return AVERROR(ENOMEM);
-            memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
-            if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
-                return AVERROR(EIO);
-            pkt->size = length + MM_PREAMBLE_SIZE;
-            pkt->stream_index = 0;
-            pkt->pts = mm->video_pts;
-            if (type!=MM_TYPE_PALETTE)
-                mm->video_pts++;
-            return 0;
-
-        case MM_TYPE_AUDIO :
-            if (av_get_packet(s->pb, pkt, length)<0)
-                return AVERROR(ENOMEM);
-            pkt->size = length;
-            pkt->stream_index = 1;
-            pkt->pts = mm->audio_pts++;
-            return 0;
-
-        default :
-            av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type);
-            url_fseek(pb, length, SEEK_CUR);
-        }
-    }
-
-    return 0;
-}
-
-AVInputFormat mm_demuxer = {
-    "mm",
-    NULL_IF_CONFIG_SMALL("American Laser Games MM format"),
-    sizeof(MmDemuxContext),
-    probe,
-    read_header,
-    read_packet,
-};
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
deleted file mode 100644
index 540407f..0000000
--- a/libavformat/mmf.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Yamaha SMAF format
- * Copyright (c) 2005 Vidar Madsen
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "raw.h"
-#include "riff.h"
-
-typedef struct {
-    int64_t atrpos, atsqpos, awapos;
-    int64_t data_size;
-} MMFContext;
-
-static const int mmf_rates[] = { 4000, 8000, 11025, 22050, 44100 };
-
-static int mmf_rate(int code)
-{
-    if((code < 0) || (code > 4))
-        return -1;
-    return mmf_rates[code];
-}
-
-#if CONFIG_MMF_MUXER
-static int mmf_rate_code(int rate)
-{
-    int i;
-    for(i = 0; i < 5; i++)
-        if(mmf_rates[i] == rate)
-            return i;
-    return -1;
-}
-
-/* Copy of end_tag() from avienc.c, but for big-endian chunk size */
-static void end_tag_be(ByteIOContext *pb, int64_t start)
-{
-    int64_t pos;
-
-    pos = url_ftell(pb);
-    url_fseek(pb, start - 4, SEEK_SET);
-    put_be32(pb, (uint32_t)(pos - start));
-    url_fseek(pb, pos, SEEK_SET);
-}
-
-static int mmf_write_header(AVFormatContext *s)
-{
-    MMFContext *mmf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos;
-    int rate;
-
-    rate = mmf_rate_code(s->streams[0]->codec->sample_rate);
-    if(rate < 0) {
-        av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec->sample_rate);
-        return -1;
-    }
-
-    put_tag(pb, "MMMD");
-    put_be32(pb, 0);
-    pos = ff_start_tag(pb, "CNTI");
-    put_byte(pb, 0); /* class */
-    put_byte(pb, 0); /* type */
-    put_byte(pb, 0); /* code type */
-    put_byte(pb, 0); /* status */
-    put_byte(pb, 0); /* counts */
-    put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */
-    end_tag_be(pb, pos);
-
-    put_buffer(pb, "ATR\x00", 4);
-    put_be32(pb, 0);
-    mmf->atrpos = url_ftell(pb);
-    put_byte(pb, 0); /* format type */
-    put_byte(pb, 0); /* sequence type */
-    put_byte(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
-    put_byte(pb, 0); /* wave base bit */
-    put_byte(pb, 2); /* time base d */
-    put_byte(pb, 2); /* time base g */
-
-    put_tag(pb, "Atsq");
-    put_be32(pb, 16);
-    mmf->atsqpos = url_ftell(pb);
-    /* Will be filled on close */
-    put_buffer(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
-
-    mmf->awapos = ff_start_tag(pb, "Awa\x01");
-
-    av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static int mmf_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
-    return 0;
-}
-
-/* Write a variable-length symbol */
-static void put_varlength(ByteIOContext *pb, int val)
-{
-    if(val < 128)
-        put_byte(pb, val);
-    else {
-        val -= 128;
-        put_byte(pb, 0x80 | val >> 7);
-        put_byte(pb, 0x7f & val);
-    }
-}
-
-static int mmf_write_trailer(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    MMFContext *mmf = s->priv_data;
-    int64_t pos, size;
-    int gatetime;
-
-    if (!url_is_streamed(s->pb)) {
-        /* Fill in length fields */
-        end_tag_be(pb, mmf->awapos);
-        end_tag_be(pb, mmf->atrpos);
-        end_tag_be(pb, 8);
-
-        pos = url_ftell(pb);
-        size = pos - mmf->awapos;
-
-        /* Fill Atsq chunk */
-        url_fseek(pb, mmf->atsqpos, SEEK_SET);
-
-        /* "play wav" */
-        put_byte(pb, 0); /* start time */
-        put_byte(pb, 1); /* (channel << 6) | wavenum */
-        gatetime = size * 500 / s->streams[0]->codec->sample_rate;
-        put_varlength(pb, gatetime); /* duration */
-
-        /* "nop" */
-        put_varlength(pb, gatetime); /* start time */
-        put_buffer(pb, "\xff\x00", 2); /* nop */
-
-        /* "end of sequence" */
-        put_buffer(pb, "\x00\x00\x00\x00", 4);
-
-        url_fseek(pb, pos, SEEK_SET);
-
-        put_flush_packet(pb);
-    }
-    return 0;
-}
-#endif /* CONFIG_MMF_MUXER */
-
-static int mmf_probe(AVProbeData *p)
-{
-    /* check file header */
-    if (p->buf[0] == 'M' && p->buf[1] == 'M' &&
-        p->buf[2] == 'M' && p->buf[3] == 'D' &&
-        p->buf[8] == 'C' && p->buf[9] == 'N' &&
-        p->buf[10] == 'T' && p->buf[11] == 'I')
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-/* mmf input */
-static int mmf_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    MMFContext *mmf = s->priv_data;
-    unsigned int tag;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    int64_t file_size, size;
-    int rate, params;
-
-    tag = get_le32(pb);
-    if (tag != MKTAG('M', 'M', 'M', 'D'))
-        return -1;
-    file_size = get_be32(pb);
-
-    /* Skip some unused chunks that may or may not be present */
-    for(;; url_fseek(pb, size, SEEK_CUR)) {
-        tag = get_le32(pb);
-        size = get_be32(pb);
-        if(tag == MKTAG('C','N','T','I')) continue;
-        if(tag == MKTAG('O','P','D','A')) continue;
-        break;
-    }
-
-    /* Tag = "ATRx", where "x" = track number */
-    if ((tag & 0xffffff) == MKTAG('M', 'T', 'R', 0)) {
-        av_log(s, AV_LOG_ERROR, "MIDI like format found, unsupported\n");
-        return -1;
-    }
-    if ((tag & 0xffffff) != MKTAG('A', 'T', 'R', 0)) {
-        av_log(s, AV_LOG_ERROR, "Unsupported SMAF chunk %08x\n", tag);
-        return -1;
-    }
-
-    get_byte(pb); /* format type */
-    get_byte(pb); /* sequence type */
-    params = get_byte(pb); /* (channel << 7) | (format << 4) | rate */
-    rate = mmf_rate(params & 0x0f);
-    if(rate  < 0) {
-        av_log(s, AV_LOG_ERROR, "Invalid sample rate\n");
-        return -1;
-    }
-    get_byte(pb); /* wave base bit */
-    get_byte(pb); /* time base d */
-    get_byte(pb); /* time base g */
-
-    /* Skip some unused chunks that may or may not be present */
-    for(;; url_fseek(pb, size, SEEK_CUR)) {
-        tag = get_le32(pb);
-        size = get_be32(pb);
-        if(tag == MKTAG('A','t','s','q')) continue;
-        if(tag == MKTAG('A','s','p','I')) continue;
-        break;
-    }
-
-    /* Make sure it's followed by an Awa chunk, aka wave data */
-    if ((tag & 0xffffff) != MKTAG('A', 'w', 'a', 0)) {
-        av_log(s, AV_LOG_ERROR, "Unexpected SMAF chunk %08x\n", tag);
-        return -1;
-    }
-    mmf->data_size = size;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_ADPCM_YAMAHA;
-    st->codec->sample_rate = rate;
-    st->codec->channels = 1;
-    st->codec->bits_per_coded_sample = 4;
-    st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample;
-
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-    return 0;
-}
-
-#define MAX_SIZE 4096
-
-static int mmf_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    MMFContext *mmf = s->priv_data;
-    AVStream *st;
-    int ret, size;
-
-    if (url_feof(s->pb))
-        return AVERROR(EIO);
-    st = s->streams[0];
-
-    size = MAX_SIZE;
-    if(size > mmf->data_size)
-        size = mmf->data_size;
-
-    if(!size)
-        return AVERROR(EIO);
-
-    if (av_new_packet(pkt, size))
-        return AVERROR(EIO);
-    pkt->stream_index = 0;
-
-    ret = get_buffer(s->pb, pkt->data, pkt->size);
-    if (ret < 0)
-        av_free_packet(pkt);
-
-    mmf->data_size -= ret;
-
-    pkt->size = ret;
-    return ret;
-}
-
-#if CONFIG_MMF_DEMUXER
-AVInputFormat mmf_demuxer = {
-    "mmf",
-    NULL_IF_CONFIG_SMALL("Yamaha SMAF"),
-    sizeof(MMFContext),
-    mmf_probe,
-    mmf_read_header,
-    mmf_read_packet,
-    NULL,
-    pcm_read_seek,
-};
-#endif
-#if CONFIG_MMF_MUXER
-AVOutputFormat mmf_muxer = {
-    "mmf",
-    NULL_IF_CONFIG_SMALL("Yamaha SMAF"),
-    "application/vnd.smaf",
-    "mmf",
-    sizeof(MMFContext),
-    CODEC_ID_ADPCM_YAMAHA,
-    CODEC_ID_NONE,
-    mmf_write_header,
-    mmf_write_packet,
-    mmf_write_trailer,
-};
-#endif
diff --git a/libavformat/mov.c b/libavformat/mov.c
deleted file mode 100644
index 2edd27e..0000000
--- a/libavformat/mov.c
+++ /dev/null
@@ -1,2595 +0,0 @@
-/*
- * MOV demuxer
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <limits.h>
-
-//#define DEBUG
-//#define DEBUG_METADATA
-//#define MOV_EXPORT_ALL_METADATA
-
-#include "libavutil/intreadwrite.h"
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include "riff.h"
-#include "isom.h"
-#include "libavcodec/mpeg4audio.h"
-#include "libavcodec/mpegaudiodata.h"
-#include "libavcodec/get_bits.h"
-
-#if CONFIG_ZLIB
-#include <zlib.h>
-#endif
-
-/*
- * First version by Francois Revol revol at free.fr
- * Seek function by Gael Chardon gael.dev at 4now.net
- *
- * Features and limitations:
- * - reads most of the QT files I have (at least the structure),
- *   Sample QuickTime files with mp3 audio can be found at: http://www.3ivx.com/showcase.html
- * - the code is quite ugly... maybe I won't do it recursive next time :-)
- *
- * Funny I didn't know about http://sourceforge.net/projects/qt-ffmpeg/
- * when coding this :) (it's a writer anyway)
- *
- * Reference documents:
- * http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt
- * Apple:
- *  http://developer.apple.com/documentation/QuickTime/QTFF/
- *  http://developer.apple.com/documentation/QuickTime/QTFF/qtff.pdf
- * QuickTime is a trademark of Apple (AFAIK :))
- */
-
-#include "qtpalette.h"
-
-
-#undef NDEBUG
-#include <assert.h>
-
-/* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */
-
-/* those functions parse an atom */
-/* return code:
-  0: continue to parse next atom
- <0: error occurred, exit
-*/
-/* links atom IDs to parse functions */
-typedef struct MOVParseTableEntry {
-    uint32_t type;
-    int (*parse)(MOVContext *ctx, ByteIOContext *pb, MOVAtom atom);
-} MOVParseTableEntry;
-
-static const MOVParseTableEntry mov_default_parse_table[];
-
-static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len)
-{
-    char buf[16];
-
-    get_be16(pb); // unknown
-    snprintf(buf, sizeof(buf), "%d", get_be16(pb));
-    av_metadata_set2(&c->fc->metadata, "track", buf, 0);
-
-    get_be16(pb); // total tracks
-
-    return 0;
-}
-
-static const uint32_t mac_to_unicode[128] = {
-    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,0x03A9,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 int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len,
-                               char *dst, int dstlen)
-{
-    char *p = dst;
-    char *end = dst+dstlen-1;
-    int i;
-
-    for (i = 0; i < len; i++) {
-        uint8_t t, c = get_byte(pb);
-        if (c < 0x80 && p < end)
-            *p++ = c;
-        else
-            PUT_UTF8(mac_to_unicode[c-0x80], t, if (p < end) *p++ = t;);
-    }
-    *p = 0;
-    return p - dst;
-}
-
-static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-#ifdef MOV_EXPORT_ALL_METADATA
-    char tmp_key[5];
-#endif
-    char str[1024], key2[16], language[4] = {0};
-    const char *key = NULL;
-    uint16_t str_size, langcode = 0;
-    uint32_t data_type = 0;
-    int (*parse)(MOVContext*, ByteIOContext*, unsigned) = NULL;
-
-    switch (atom.type) {
-    case MKTAG(0xa9,'n','a','m'): key = "title";     break;
-    case MKTAG(0xa9,'a','u','t'):
-    case MKTAG(0xa9,'A','R','T'): key = "artist";    break;
-    case MKTAG(0xa9,'w','r','t'): key = "composer";  break;
-    case MKTAG( 'c','p','r','t'):
-    case MKTAG(0xa9,'c','p','y'): key = "copyright"; break;
-    case MKTAG(0xa9,'c','m','t'):
-    case MKTAG(0xa9,'i','n','f'): key = "comment";   break;
-    case MKTAG(0xa9,'a','l','b'): key = "album";     break;
-    case MKTAG(0xa9,'d','a','y'): key = "date";      break;
-    case MKTAG(0xa9,'g','e','n'): key = "genre";     break;
-    case MKTAG(0xa9,'t','o','o'):
-    case MKTAG(0xa9,'e','n','c'): key = "encoder";   break;
-    case MKTAG( 'd','e','s','c'): key = "description";break;
-    case MKTAG( 'l','d','e','s'): key = "synopsis";  break;
-    case MKTAG( 't','v','s','h'): key = "show";      break;
-    case MKTAG( 't','v','e','n'): key = "episode_id";break;
-    case MKTAG( 't','v','n','n'): key = "network";   break;
-    case MKTAG( 't','r','k','n'): key = "track";
-        parse = mov_metadata_trkn; break;
-    }
-
-    if (c->itunes_metadata && atom.size > 8) {
-        int data_size = get_be32(pb);
-        int tag = get_le32(pb);
-        if (tag == MKTAG('d','a','t','a')) {
-            data_type = get_be32(pb); // type
-            get_be32(pb); // unknown
-            str_size = data_size - 16;
-            atom.size -= 16;
-        } else return 0;
-    } else if (atom.size > 4 && key && !c->itunes_metadata) {
-        str_size = get_be16(pb); // string length
-        langcode = get_be16(pb);
-        ff_mov_lang_to_iso639(langcode, language);
-        atom.size -= 4;
-    } else
-        str_size = atom.size;
-
-#ifdef MOV_EXPORT_ALL_METADATA
-    if (!key) {
-        snprintf(tmp_key, 5, "%.4s", (char*)&atom.type);
-        key = tmp_key;
-    }
-#endif
-
-    if (!key)
-        return 0;
-    if (atom.size < 0)
-        return -1;
-
-    str_size = FFMIN3(sizeof(str)-1, str_size, atom.size);
-
-    if (parse)
-        parse(c, pb, str_size);
-    else {
-        if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded
-            mov_read_mac_string(c, pb, str_size, str, sizeof(str));
-        } else {
-            get_buffer(pb, str, str_size);
-            str[str_size] = 0;
-        }
-        av_metadata_set2(&c->fc->metadata, key, str, 0);
-        if (*language && strcmp(language, "und")) {
-            snprintf(key2, sizeof(key2), "%s-%s", key, language);
-            av_metadata_set2(&c->fc->metadata, key2, str, 0);
-        }
-    }
-#ifdef DEBUG_METADATA
-    av_log(c->fc, AV_LOG_DEBUG, "lang \"%3s\" ", language);
-    av_log(c->fc, AV_LOG_DEBUG, "tag \"%s\" value \"%s\" atom \"%.4s\" %d %lld\n",
-           key, str, (char*)&atom.type, str_size, atom.size);
-#endif
-
-    return 0;
-}
-
-static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    int64_t start;
-    int i, nb_chapters, str_len;
-    char str[256+1];
-
-    if ((atom.size -= 5) < 0)
-        return 0;
-
-    get_be32(pb); // version + flags
-    get_be32(pb); // ???
-    nb_chapters = get_byte(pb);
-
-    for (i = 0; i < nb_chapters; i++) {
-        if (atom.size < 9)
-            return 0;
-
-        start = get_be64(pb);
-        str_len = get_byte(pb);
-
-        if ((atom.size -= 9+str_len) < 0)
-            return 0;
-
-        get_buffer(pb, str, str_len);
-        str[str_len] = 0;
-        ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str);
-    }
-    return 0;
-}
-
-static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    int64_t total_size = 0;
-    MOVAtom a;
-    int i;
-
-    if (atom.size < 0)
-        atom.size = INT64_MAX;
-    while (total_size + 8 < atom.size && !url_feof(pb)) {
-        int (*parse)(MOVContext*, ByteIOContext*, MOVAtom) = NULL;
-        a.size = atom.size;
-        a.type=0;
-        if(atom.size >= 8) {
-            a.size = get_be32(pb);
-            a.type = get_le32(pb);
-        }
-        total_size += 8;
-        dprintf(c->fc, "type: %08x  %.4s  sz: %"PRIx64"  %"PRIx64"   %"PRIx64"\n",
-                a.type, (char*)&a.type, a.size, atom.size, total_size);
-        if (a.size == 1) { /* 64 bit extended size */
-            a.size = get_be64(pb) - 8;
-            total_size += 8;
-        }
-        if (a.size == 0) {
-            a.size = atom.size - total_size;
-            if (a.size <= 8)
-                break;
-        }
-        a.size -= 8;
-        if(a.size < 0)
-            break;
-        a.size = FFMIN(a.size, atom.size - total_size);
-
-        for (i = 0; mov_default_parse_table[i].type; i++)
-            if (mov_default_parse_table[i].type == a.type) {
-                parse = mov_default_parse_table[i].parse;
-                break;
-            }
-
-        // container is user data
-        if (!parse && (atom.type == MKTAG('u','d','t','a') ||
-                       atom.type == MKTAG('i','l','s','t')))
-            parse = mov_read_udta_string;
-
-        if (!parse) { /* skip leaf atoms data */
-            url_fskip(pb, a.size);
-        } else {
-            int64_t start_pos = url_ftell(pb);
-            int64_t left;
-            int err = parse(c, pb, a);
-            if (err < 0)
-                return err;
-            if (c->found_moov && c->found_mdat &&
-                (url_is_streamed(pb) || start_pos + a.size == url_fsize(pb)))
-                return 0;
-            left = a.size - url_ftell(pb) + start_pos;
-            if (left > 0) /* skip garbage at atom end */
-                url_fskip(pb, left);
-        }
-
-        total_size += a.size;
-    }
-
-    if (total_size < atom.size && atom.size < 0x7ffff)
-        url_fskip(pb, atom.size - total_size);
-
-    return 0;
-}
-
-static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    int entries, i, j;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_be32(pb); // version + flags
-    entries = get_be32(pb);
-    if (entries >= UINT_MAX / sizeof(*sc->drefs))
-        return -1;
-    sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
-    if (!sc->drefs)
-        return AVERROR(ENOMEM);
-    sc->drefs_count = entries;
-
-    for (i = 0; i < sc->drefs_count; i++) {
-        MOVDref *dref = &sc->drefs[i];
-        uint32_t size = get_be32(pb);
-        int64_t next = url_ftell(pb) + size - 4;
-
-        dref->type = get_le32(pb);
-        get_be32(pb); // version + flags
-        dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
-
-        if (dref->type == MKTAG('a','l','i','s') && size > 150) {
-            /* macintosh alias record */
-            uint16_t volume_len, len;
-            int16_t type;
-
-            url_fskip(pb, 10);
-
-            volume_len = get_byte(pb);
-            volume_len = FFMIN(volume_len, 27);
-            get_buffer(pb, dref->volume, 27);
-            dref->volume[volume_len] = 0;
-            av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len);
-
-            url_fskip(pb, 12);
-
-            len = get_byte(pb);
-            len = FFMIN(len, 63);
-            get_buffer(pb, dref->filename, 63);
-            dref->filename[len] = 0;
-            av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len);
-
-            url_fskip(pb, 16);
-
-            /* read next level up_from_alias/down_to_target */
-            dref->nlvl_from = get_be16(pb);
-            dref->nlvl_to   = get_be16(pb);
-            av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n",
-                   dref->nlvl_from, dref->nlvl_to);
-
-            url_fskip(pb, 16);
-
-            for (type = 0; type != -1 && url_ftell(pb) < next; ) {
-                type = get_be16(pb);
-                len = get_be16(pb);
-                av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
-                if (len&1)
-                    len += 1;
-                if (type == 2) { // absolute path
-                    av_free(dref->path);
-                    dref->path = av_mallocz(len+1);
-                    if (!dref->path)
-                        return AVERROR(ENOMEM);
-                    get_buffer(pb, dref->path, len);
-                    if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) {
-                        len -= volume_len;
-                        memmove(dref->path, dref->path+volume_len, len);
-                        dref->path[len] = 0;
-                    }
-                    for (j = 0; j < len; j++)
-                        if (dref->path[j] == ':')
-                            dref->path[j] = '/';
-                    av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path);
-                } else if (type == 0) { // directory name
-                    av_free(dref->dir);
-                    dref->dir = av_malloc(len+1);
-                    if (!dref->dir)
-                        return AVERROR(ENOMEM);
-                    get_buffer(pb, dref->dir, len);
-                    dref->dir[len] = 0;
-                    for (j = 0; j < len; j++)
-                        if (dref->dir[j] == ':')
-                            dref->dir[j] = '/';
-                    av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir);
-                } else
-                    url_fskip(pb, len);
-            }
-        }
-        url_fseek(pb, next, SEEK_SET);
-    }
-    return 0;
-}
-
-static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    uint32_t type;
-    uint32_t ctype;
-
-    if (c->fc->nb_streams < 1) // meta before first trak
-        return 0;
-
-    st = c->fc->streams[c->fc->nb_streams-1];
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    /* component type */
-    ctype = get_le32(pb);
-    type = get_le32(pb); /* component subtype */
-
-    dprintf(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
-    dprintf(c->fc, "stype= %.4s\n", (char*)&type);
-
-    if     (type == MKTAG('v','i','d','e'))
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    else if(type == MKTAG('s','o','u','n'))
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    else if(type == MKTAG('m','1','a',' '))
-        st->codec->codec_id = CODEC_ID_MP2;
-    else if(type == MKTAG('s','u','b','p'))
-        st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-
-    get_be32(pb); /* component  manufacture */
-    get_be32(pb); /* component flags */
-    get_be32(pb); /* component flags mask */
-
-    return 0;
-}
-
-int ff_mp4_read_descr_len(ByteIOContext *pb)
-{
-    int len = 0;
-    int count = 4;
-    while (count--) {
-        int c = get_byte(pb);
-        len = (len << 7) | (c & 0x7f);
-        if (!(c & 0x80))
-            break;
-    }
-    return len;
-}
-
-static int mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag)
-{
-    int len;
-    *tag = get_byte(pb);
-    len = ff_mp4_read_descr_len(pb);
-    dprintf(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len);
-    return len;
-}
-
-#define MP4ESDescrTag                   0x03
-#define MP4DecConfigDescrTag            0x04
-#define MP4DecSpecificDescrTag          0x05
-
-static const AVCodecTag mp4_audio_types[] = {
-    { CODEC_ID_MP3ON4, AOT_PS   }, /* old mp3on4 draft */
-    { CODEC_ID_MP3ON4, AOT_L1   }, /* layer 1 */
-    { CODEC_ID_MP3ON4, AOT_L2   }, /* layer 2 */
-    { CODEC_ID_MP3ON4, AOT_L3   }, /* layer 3 */
-    { CODEC_ID_MP4ALS, AOT_ALS  }, /* MPEG-4 ALS */
-    { CODEC_ID_NONE,   AOT_NULL },
-};
-
-int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    int tag, len;
-
-    if (fc->nb_streams < 1)
-        return 0;
-    st = fc->streams[fc->nb_streams-1];
-
-    get_be32(pb); /* version + flags */
-    len = mp4_read_descr(fc, pb, &tag);
-    if (tag == MP4ESDescrTag) {
-        get_be16(pb); /* ID */
-        get_byte(pb); /* priority */
-    } else
-        get_be16(pb); /* ID */
-
-    len = mp4_read_descr(fc, pb, &tag);
-    if (tag == MP4DecConfigDescrTag) {
-        int object_type_id = get_byte(pb);
-        get_byte(pb); /* stream type */
-        get_be24(pb); /* buffer size db */
-        get_be32(pb); /* max bitrate */
-        get_be32(pb); /* avg bitrate */
-
-        st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id);
-        dprintf(fc, "esds object type id 0x%02x\n", object_type_id);
-        len = mp4_read_descr(fc, pb, &tag);
-        if (tag == MP4DecSpecificDescrTag) {
-            dprintf(fc, "Specific MPEG4 header len=%d\n", len);
-            if((uint64_t)len > (1<<30))
-                return -1;
-            st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (!st->codec->extradata)
-                return AVERROR(ENOMEM);
-            get_buffer(pb, st->codec->extradata, len);
-            st->codec->extradata_size = len;
-            if (st->codec->codec_id == CODEC_ID_AAC) {
-                MPEG4AudioConfig cfg;
-                ff_mpeg4audio_get_config(&cfg, st->codec->extradata,
-                                         st->codec->extradata_size);
-                st->codec->channels = cfg.channels;
-                if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
-                    st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
-                else
-                    st->codec->sample_rate = cfg.sample_rate; // ext sample rate ?
-                dprintf(fc, "mp4a config channels %d obj %d ext obj %d "
-                        "sample rate %d ext sample rate %d\n", st->codec->channels,
-                        cfg.object_type, cfg.ext_object_type,
-                        cfg.sample_rate, cfg.ext_sample_rate);
-                if (!(st->codec->codec_id = ff_codec_get_id(mp4_audio_types,
-                                                            cfg.object_type)))
-                    st->codec->codec_id = CODEC_ID_AAC;
-            }
-        }
-    }
-    return 0;
-}
-
-static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    return ff_mov_read_esds(c->fc, pb, atom);
-}
-
-static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    const int num = get_be32(pb);
-    const int den = get_be32(pb);
-    AVStream *st;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-
-    if (den != 0) {
-        if ((st->sample_aspect_ratio.den != 1 || st->sample_aspect_ratio.num) && // default
-            (den != st->sample_aspect_ratio.den || num != st->sample_aspect_ratio.num))
-            av_log(c->fc, AV_LOG_WARNING,
-                   "sample aspect ratio already set to %d:%d, overriding by 'pasp' atom\n",
-                   st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
-        st->sample_aspect_ratio.num = num;
-        st->sample_aspect_ratio.den = den;
-    }
-    return 0;
-}
-
-/* this atom contains actual media data */
-static int mov_read_mdat(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    if(atom.size == 0) /* wrong one (MP4) */
-        return 0;
-    c->found_mdat=1;
-    return 0; /* now go for moov */
-}
-
-/* read major brand, minor version and compatible brands and store them as metadata */
-static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    uint32_t minor_ver;
-    int comp_brand_size;
-    char minor_ver_str[11]; /* 32 bit integer -> 10 digits + null */
-    char* comp_brands_str;
-    uint8_t type[5] = {0};
-
-    get_buffer(pb, type, 4);
-    if (strcmp(type, "qt  "))
-        c->isom = 1;
-    av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type);
-    av_metadata_set2(&c->fc->metadata, "major_brand", type, 0);
-    minor_ver = get_be32(pb); /* minor version */
-    snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver);
-    av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0);
-
-    comp_brand_size = atom.size - 8;
-    if (comp_brand_size < 0)
-        return -1;
-    comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null terminator */
-    if (!comp_brands_str)
-        return AVERROR(ENOMEM);
-    get_buffer(pb, comp_brands_str, comp_brand_size);
-    comp_brands_str[comp_brand_size] = 0;
-    av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0);
-    av_freep(&comp_brands_str);
-
-    return 0;
-}
-
-/* this atom should contain all header atoms */
-static int mov_read_moov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    if (mov_read_default(c, pb, atom) < 0)
-        return -1;
-    /* we parsed the 'moov' atom, we can terminate the parsing as soon as we find the 'mdat' */
-    /* so we don't parse the whole file if over a network */
-    c->found_moov=1;
-    return 0; /* now go for mdat */
-}
-
-static int mov_read_moof(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    c->fragment.moof_offset = url_ftell(pb) - 8;
-    dprintf(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
-    return mov_read_default(c, pb, atom);
-}
-
-static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    int version;
-    char language[4] = {0};
-    unsigned lang;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    version = get_byte(pb);
-    if (version > 1)
-        return -1; /* unsupported */
-
-    get_be24(pb); /* flags */
-    if (version == 1) {
-        get_be64(pb);
-        get_be64(pb);
-    } else {
-        get_be32(pb); /* creation time */
-        get_be32(pb); /* modification time */
-    }
-
-    sc->time_scale = get_be32(pb);
-    st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
-
-    lang = get_be16(pb); /* language */
-    if (ff_mov_lang_to_iso639(lang, language))
-        av_metadata_set2(&st->metadata, "language", language, 0);
-    get_be16(pb); /* quality */
-
-    return 0;
-}
-
-static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    int version = get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    if (version == 1) {
-        get_be64(pb);
-        get_be64(pb);
-    } else {
-        get_be32(pb); /* creation time */
-        get_be32(pb); /* modification time */
-    }
-    c->time_scale = get_be32(pb); /* time scale */
-
-    dprintf(c->fc, "time scale = %i\n", c->time_scale);
-
-    c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
-    get_be32(pb); /* preferred scale */
-
-    get_be16(pb); /* preferred volume */
-
-    url_fskip(pb, 10); /* reserved */
-
-    url_fskip(pb, 36); /* display matrix */
-
-    get_be32(pb); /* preview time */
-    get_be32(pb); /* preview duration */
-    get_be32(pb); /* poster time */
-    get_be32(pb); /* selection time */
-    get_be32(pb); /* selection duration */
-    get_be32(pb); /* current time */
-    get_be32(pb); /* next track ID */
-
-    return 0;
-}
-
-static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-
-    if((uint64_t)atom.size > (1<<30))
-        return -1;
-
-    // currently SVQ3 decoder expect full STSD header - so let's fake it
-    // this should be fixed and just SMI header should be passed
-    av_free(st->codec->extradata);
-    st->codec->extradata = av_mallocz(atom.size + 0x5a + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata)
-        return AVERROR(ENOMEM);
-    st->codec->extradata_size = 0x5a + atom.size;
-    memcpy(st->codec->extradata, "SVQ3", 4); // fake
-    get_buffer(pb, st->codec->extradata + 0x5a, atom.size);
-    dprintf(c->fc, "Reading SMI %"PRId64"  %s\n", atom.size, st->codec->extradata + 0x5a);
-    return 0;
-}
-
-static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    int little_endian;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-
-    little_endian = get_be16(pb);
-    dprintf(c->fc, "enda %d\n", little_endian);
-    if (little_endian == 1) {
-        switch (st->codec->codec_id) {
-        case CODEC_ID_PCM_S24BE:
-            st->codec->codec_id = CODEC_ID_PCM_S24LE;
-            break;
-        case CODEC_ID_PCM_S32BE:
-            st->codec->codec_id = CODEC_ID_PCM_S32LE;
-            break;
-        case CODEC_ID_PCM_F32BE:
-            st->codec->codec_id = CODEC_ID_PCM_F32LE;
-            break;
-        case CODEC_ID_PCM_F64BE:
-            st->codec->codec_id = CODEC_ID_PCM_F64LE;
-            break;
-        default:
-            break;
-        }
-    }
-    return 0;
-}
-
-/* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */
-static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    uint64_t size;
-    uint8_t *buf;
-
-    if (c->fc->nb_streams < 1) // will happen with jp2 files
-        return 0;
-    st= c->fc->streams[c->fc->nb_streams-1];
-    size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE;
-    if(size > INT_MAX || (uint64_t)atom.size > INT_MAX)
-        return -1;
-    buf= av_realloc(st->codec->extradata, size);
-    if(!buf)
-        return -1;
-    st->codec->extradata= buf;
-    buf+= st->codec->extradata_size;
-    st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;
-    AV_WB32(       buf    , atom.size + 8);
-    AV_WL32(       buf + 4, atom.type);
-    get_buffer(pb, buf + 8, atom.size);
-    return 0;
-}
-
-static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-
-    if((uint64_t)atom.size > (1<<30))
-        return -1;
-
-    if (st->codec->codec_id == CODEC_ID_QDM2) {
-        // pass all frma atom to codec, needed at least for QDM2
-        av_free(st->codec->extradata);
-        st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);
-        if (!st->codec->extradata)
-            return AVERROR(ENOMEM);
-        st->codec->extradata_size = atom.size;
-        get_buffer(pb, st->codec->extradata, atom.size);
-    } else if (atom.size > 8) { /* to read frma, esds atoms */
-        if (mov_read_default(c, pb, atom) < 0)
-            return -1;
-    } else
-        url_fskip(pb, atom.size);
-    return 0;
-}
-
-/**
- * This function reads atom content and puts data in extradata without tag
- * nor size unlike mov_read_extradata.
- */
-static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-
-    if((uint64_t)atom.size > (1<<30))
-        return -1;
-
-    av_free(st->codec->extradata);
-    st->codec->extradata = av_mallocz(atom.size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata)
-        return AVERROR(ENOMEM);
-    st->codec->extradata_size = atom.size;
-    get_buffer(pb, st->codec->extradata, atom.size);
-    return 0;
-}
-
-/**
- * An strf atom is a BITMAPINFOHEADER struct. This struct is 40 bytes itself,
- * but can have extradata appended at the end after the 40 bytes belonging
- * to the struct.
- */
-static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    if (atom.size <= 40)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-
-    if((uint64_t)atom.size > (1<<30))
-        return -1;
-
-    av_free(st->codec->extradata);
-    st->codec->extradata = av_mallocz(atom.size - 40 + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!st->codec->extradata)
-        return AVERROR(ENOMEM);
-    st->codec->extradata_size = atom.size - 40;
-    url_fskip(pb, 40);
-    get_buffer(pb, st->codec->extradata, atom.size - 40);
-    return 0;
-}
-
-static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    unsigned int i, entries;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    entries = get_be32(pb);
-
-    if(entries >= UINT_MAX/sizeof(int64_t))
-        return -1;
-
-    sc->chunk_offsets = av_malloc(entries * sizeof(int64_t));
-    if (!sc->chunk_offsets)
-        return AVERROR(ENOMEM);
-    sc->chunk_count = entries;
-
-    if      (atom.type == MKTAG('s','t','c','o'))
-        for(i=0; i<entries; i++)
-            sc->chunk_offsets[i] = get_be32(pb);
-    else if (atom.type == MKTAG('c','o','6','4'))
-        for(i=0; i<entries; i++)
-            sc->chunk_offsets[i] = get_be64(pb);
-    else
-        return -1;
-
-    return 0;
-}
-
-/**
- * Compute codec id for 'lpcm' tag.
- * See CoreAudioTypes and AudioStreamBasicDescription at Apple.
- */
-enum CodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
-{
-    if (flags & 1) { // floating point
-        if (flags & 2) { // big endian
-            if      (bps == 32) return CODEC_ID_PCM_F32BE;
-            else if (bps == 64) return CODEC_ID_PCM_F64BE;
-        } else {
-            if      (bps == 32) return CODEC_ID_PCM_F32LE;
-            else if (bps == 64) return CODEC_ID_PCM_F64LE;
-        }
-    } else {
-        if (flags & 2) {
-            if      (bps == 8)
-                // signed integer
-                if (flags & 4)  return CODEC_ID_PCM_S8;
-                else            return CODEC_ID_PCM_U8;
-            else if (bps == 16) return CODEC_ID_PCM_S16BE;
-            else if (bps == 24) return CODEC_ID_PCM_S24BE;
-            else if (bps == 32) return CODEC_ID_PCM_S32BE;
-        } else {
-            if      (bps == 8)
-                if (flags & 4)  return CODEC_ID_PCM_S8;
-                else            return CODEC_ID_PCM_U8;
-            else if (bps == 16) return CODEC_ID_PCM_S16LE;
-            else if (bps == 24) return CODEC_ID_PCM_S24LE;
-            else if (bps == 32) return CODEC_ID_PCM_S32LE;
-        }
-    }
-    return CODEC_ID_NONE;
-}
-
-static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    int j, entries, pseudo_stream_id;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    entries = get_be32(pb);
-
-    for(pseudo_stream_id=0; pseudo_stream_id<entries; pseudo_stream_id++) {
-        //Parsing Sample description table
-        enum CodecID id;
-        int dref_id = 1;
-        MOVAtom a = { 0 };
-        int64_t start_pos = url_ftell(pb);
-        int size = get_be32(pb); /* size */
-        uint32_t format = get_le32(pb); /* data format */
-
-        if (size >= 16) {
-            get_be32(pb); /* reserved */
-            get_be16(pb); /* reserved */
-            dref_id = get_be16(pb);
-        }
-
-        if (st->codec->codec_tag &&
-            st->codec->codec_tag != format &&
-            (c->fc->video_codec_id ? ff_codec_get_id(codec_movvideo_tags, format) != c->fc->video_codec_id
-                                   : st->codec->codec_tag != MKTAG('j','p','e','g'))
-           ){
-            /* Multiple fourcc, we skip JPEG. This is not correct, we should
-             * export it as a separate AVStream but this needs a few changes
-             * in the MOV demuxer, patch welcome. */
-            av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");
-            url_fskip(pb, size - (url_ftell(pb) - start_pos));
-            continue;
-        }
-        sc->pseudo_stream_id = st->codec->codec_tag ? -1 : pseudo_stream_id;
-        sc->dref_id= dref_id;
-
-        st->codec->codec_tag = format;
-        id = ff_codec_get_id(codec_movaudio_tags, format);
-        if (id<=0 && ((format&0xFFFF) == 'm'+('s'<<8) || (format&0xFFFF) == 'T'+('S'<<8)))
-            id = ff_codec_get_id(ff_codec_wav_tags, bswap_32(format)&0xFFFF);
-
-        if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO && id > 0) {
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        } else if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO && /* do not overwrite codec type */
-                   format && format != MKTAG('m','p','4','s')) { /* skip old asf mpeg4 tag */
-            id = ff_codec_get_id(codec_movvideo_tags, format);
-            if (id <= 0)
-                id = ff_codec_get_id(ff_codec_bmp_tags, format);
-            if (id > 0)
-                st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            else if(st->codec->codec_type == AVMEDIA_TYPE_DATA){
-                id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
-                if(id > 0)
-                    st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-            }
-        }
-
-        dprintf(c->fc, "size=%d 4CC= %c%c%c%c codec_type=%d\n", size,
-                (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
-                (format >> 24) & 0xff, st->codec->codec_type);
-
-        if(st->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
-            unsigned int color_depth, len;
-            int color_greyscale;
-
-            st->codec->codec_id = id;
-            get_be16(pb); /* version */
-            get_be16(pb); /* revision level */
-            get_be32(pb); /* vendor */
-            get_be32(pb); /* temporal quality */
-            get_be32(pb); /* spatial quality */
-
-            st->codec->width = get_be16(pb); /* width */
-            st->codec->height = get_be16(pb); /* height */
-
-            get_be32(pb); /* horiz resolution */
-            get_be32(pb); /* vert resolution */
-            get_be32(pb); /* data size, always 0 */
-            get_be16(pb); /* frames per samples */
-
-            len = get_byte(pb); /* codec name, pascal string */
-            if (len > 31)
-                len = 31;
-            mov_read_mac_string(c, pb, len, st->codec->codec_name, 32);
-            if (len < 31)
-                url_fskip(pb, 31 - len);
-            /* codec_tag YV12 triggers an UV swap in rawdec.c */
-            if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
-                st->codec->codec_tag=MKTAG('I', '4', '2', '0');
-
-            st->codec->bits_per_coded_sample = get_be16(pb); /* depth */
-            st->codec->color_table_id = get_be16(pb); /* colortable id */
-            dprintf(c->fc, "depth %d, ctab id %d\n",
-                   st->codec->bits_per_coded_sample, st->codec->color_table_id);
-            /* figure out the palette situation */
-            color_depth = st->codec->bits_per_coded_sample & 0x1F;
-            color_greyscale = st->codec->bits_per_coded_sample & 0x20;
-
-            /* if the depth is 2, 4, or 8 bpp, file is palettized */
-            if ((color_depth == 2) || (color_depth == 4) ||
-                (color_depth == 8)) {
-                /* for palette traversal */
-                unsigned int color_start, color_count, color_end;
-                unsigned char r, g, b;
-
-                st->codec->palctrl = av_malloc(sizeof(*st->codec->palctrl));
-                if (color_greyscale) {
-                    int color_index, color_dec;
-                    /* compute the greyscale palette */
-                    st->codec->bits_per_coded_sample = color_depth;
-                    color_count = 1 << color_depth;
-                    color_index = 255;
-                    color_dec = 256 / (color_count - 1);
-                    for (j = 0; j < color_count; j++) {
-                        r = g = b = color_index;
-                        st->codec->palctrl->palette[j] =
-                            (r << 16) | (g << 8) | (b);
-                        color_index -= color_dec;
-                        if (color_index < 0)
-                            color_index = 0;
-                    }
-                } else if (st->codec->color_table_id) {
-                    const uint8_t *color_table;
-                    /* if flag bit 3 is set, use the default palette */
-                    color_count = 1 << color_depth;
-                    if (color_depth == 2)
-                        color_table = ff_qt_default_palette_4;
-                    else if (color_depth == 4)
-                        color_table = ff_qt_default_palette_16;
-                    else
-                        color_table = ff_qt_default_palette_256;
-
-                    for (j = 0; j < color_count; j++) {
-                        r = color_table[j * 3 + 0];
-                        g = color_table[j * 3 + 1];
-                        b = color_table[j * 3 + 2];
-                        st->codec->palctrl->palette[j] =
-                            (r << 16) | (g << 8) | (b);
-                    }
-                } else {
-                    /* load the palette from the file */
-                    color_start = get_be32(pb);
-                    color_count = get_be16(pb);
-                    color_end = get_be16(pb);
-                    if ((color_start <= 255) &&
-                        (color_end <= 255)) {
-                        for (j = color_start; j <= color_end; j++) {
-                            /* each R, G, or B component is 16 bits;
-                             * only use the top 8 bits; skip alpha bytes
-                             * up front */
-                            get_byte(pb);
-                            get_byte(pb);
-                            r = get_byte(pb);
-                            get_byte(pb);
-                            g = get_byte(pb);
-                            get_byte(pb);
-                            b = get_byte(pb);
-                            get_byte(pb);
-                            st->codec->palctrl->palette[j] =
-                                (r << 16) | (g << 8) | (b);
-                        }
-                    }
-                }
-                st->codec->palctrl->palette_changed = 1;
-            }
-        } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
-            int bits_per_sample, flags;
-            uint16_t version = get_be16(pb);
-
-            st->codec->codec_id = id;
-            get_be16(pb); /* revision level */
-            get_be32(pb); /* vendor */
-
-            st->codec->channels = get_be16(pb);             /* channel count */
-            dprintf(c->fc, "audio channels %d\n", st->codec->channels);
-            st->codec->bits_per_coded_sample = get_be16(pb);      /* sample size */
-
-            sc->audio_cid = get_be16(pb);
-            get_be16(pb); /* packet size = 0 */
-
-            st->codec->sample_rate = ((get_be32(pb) >> 16));
-
-            //Read QT version 1 fields. In version 0 these do not exist.
-            dprintf(c->fc, "version =%d, isom =%d\n",version,c->isom);
-            if(!c->isom) {
-                if(version==1) {
-                    sc->samples_per_frame = get_be32(pb);
-                    get_be32(pb); /* bytes per packet */
-                    sc->bytes_per_frame = get_be32(pb);
-                    get_be32(pb); /* bytes per sample */
-                } else if(version==2) {
-                    get_be32(pb); /* sizeof struct only */
-                    st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */
-                    st->codec->channels = get_be32(pb);
-                    get_be32(pb); /* always 0x7F000000 */
-                    st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */
-                    flags = get_be32(pb); /* lpcm format specific flag */
-                    sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */
-                    sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */
-                    if (format == MKTAG('l','p','c','m'))
-                        st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
-                }
-            }
-
-            switch (st->codec->codec_id) {
-            case CODEC_ID_PCM_S8:
-            case CODEC_ID_PCM_U8:
-                if (st->codec->bits_per_coded_sample == 16)
-                    st->codec->codec_id = CODEC_ID_PCM_S16BE;
-                break;
-            case CODEC_ID_PCM_S16LE:
-            case CODEC_ID_PCM_S16BE:
-                if (st->codec->bits_per_coded_sample == 8)
-                    st->codec->codec_id = CODEC_ID_PCM_S8;
-                else if (st->codec->bits_per_coded_sample == 24)
-                    st->codec->codec_id =
-                        st->codec->codec_id == CODEC_ID_PCM_S16BE ?
-                        CODEC_ID_PCM_S24BE : CODEC_ID_PCM_S24LE;
-                break;
-            /* set values for old format before stsd version 1 appeared */
-            case CODEC_ID_MACE3:
-                sc->samples_per_frame = 6;
-                sc->bytes_per_frame = 2*st->codec->channels;
-                break;
-            case CODEC_ID_MACE6:
-                sc->samples_per_frame = 6;
-                sc->bytes_per_frame = 1*st->codec->channels;
-                break;
-            case CODEC_ID_ADPCM_IMA_QT:
-                sc->samples_per_frame = 64;
-                sc->bytes_per_frame = 34*st->codec->channels;
-                break;
-            case CODEC_ID_GSM:
-                sc->samples_per_frame = 160;
-                sc->bytes_per_frame = 33;
-                break;
-            default:
-                break;
-            }
-
-            bits_per_sample = av_get_bits_per_sample(st->codec->codec_id);
-            if (bits_per_sample) {
-                st->codec->bits_per_coded_sample = bits_per_sample;
-                sc->sample_size = (bits_per_sample >> 3) * st->codec->channels;
-            }
-        } else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
-            // ttxt stsd contains display flags, justification, background
-            // color, fonts, and default styles, so fake an atom to read it
-            MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
-            if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom
-                mov_read_glbl(c, pb, fake_atom);
-            st->codec->codec_id= id;
-            st->codec->width = sc->width;
-            st->codec->height = sc->height;
-        } else {
-            /* other codec type, just skip (rtp, mp4s, tmcd ...) */
-            url_fskip(pb, size - (url_ftell(pb) - start_pos));
-        }
-        /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */
-        a.size = size - (url_ftell(pb) - start_pos);
-        if (a.size > 8) {
-            if (mov_read_default(c, pb, a) < 0)
-                return -1;
-        } else if (a.size > 0)
-            url_fskip(pb, a.size);
-    }
-
-    if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
-        st->codec->sample_rate= sc->time_scale;
-
-    /* special codec parameters handling */
-    switch (st->codec->codec_id) {
-#if CONFIG_DV_DEMUXER
-    case CODEC_ID_DVAUDIO:
-        c->dv_fctx = avformat_alloc_context();
-        c->dv_demux = dv_init_demux(c->dv_fctx);
-        if (!c->dv_demux) {
-            av_log(c->fc, AV_LOG_ERROR, "dv demux context init error\n");
-            return -1;
-        }
-        sc->dv_audio_container = 1;
-        st->codec->codec_id = CODEC_ID_PCM_S16LE;
-        break;
-#endif
-    /* no ifdef since parameters are always those */
-    case CODEC_ID_QCELP:
-        // force sample rate for qcelp when not stored in mov
-        if (st->codec->codec_tag != MKTAG('Q','c','l','p'))
-            st->codec->sample_rate = 8000;
-        st->codec->frame_size= 160;
-        st->codec->channels= 1; /* really needed */
-        break;
-    case CODEC_ID_AMR_NB:
-    case CODEC_ID_AMR_WB:
-        st->codec->frame_size= sc->samples_per_frame;
-        st->codec->channels= 1; /* really needed */
-        /* force sample rate for amr, stsd in 3gp does not store sample rate */
-        if (st->codec->codec_id == CODEC_ID_AMR_NB)
-            st->codec->sample_rate = 8000;
-        else if (st->codec->codec_id == CODEC_ID_AMR_WB)
-            st->codec->sample_rate = 16000;
-        break;
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO; /* force type after stsd for m1a hdlr */
-        st->need_parsing = AVSTREAM_PARSE_FULL;
-        break;
-    case CODEC_ID_GSM:
-    case CODEC_ID_ADPCM_MS:
-    case CODEC_ID_ADPCM_IMA_WAV:
-        st->codec->block_align = sc->bytes_per_frame;
-        break;
-    case CODEC_ID_ALAC:
-        if (st->codec->extradata_size == 36) {
-            st->codec->frame_size = AV_RB32(st->codec->extradata+12);
-            st->codec->channels   = AV_RB8 (st->codec->extradata+21);
-        }
-        break;
-    default:
-        break;
-    }
-
-    return 0;
-}
-
-static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    unsigned int i, entries;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    entries = get_be32(pb);
-
-    dprintf(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
-
-    if(entries >= UINT_MAX / sizeof(*sc->stsc_data))
-        return -1;
-    sc->stsc_data = av_malloc(entries * sizeof(*sc->stsc_data));
-    if (!sc->stsc_data)
-        return AVERROR(ENOMEM);
-    sc->stsc_count = entries;
-
-    for(i=0; i<entries; i++) {
-        sc->stsc_data[i].first = get_be32(pb);
-        sc->stsc_data[i].count = get_be32(pb);
-        sc->stsc_data[i].id = get_be32(pb);
-    }
-    return 0;
-}
-
-static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    unsigned i, entries;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_be32(pb); // version + flags
-
-    entries = get_be32(pb);
-    if (entries >= UINT_MAX / sizeof(*sc->stps_data))
-        return -1;
-    sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data));
-    if (!sc->stps_data)
-        return AVERROR(ENOMEM);
-    sc->stps_count = entries;
-
-    for (i = 0; i < entries; i++) {
-        sc->stps_data[i] = get_be32(pb);
-        //dprintf(c->fc, "stps %d\n", sc->stps_data[i]);
-    }
-
-    return 0;
-}
-
-static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    unsigned int i, entries;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    entries = get_be32(pb);
-
-    dprintf(c->fc, "keyframe_count = %d\n", entries);
-
-    if(entries >= UINT_MAX / sizeof(int))
-        return -1;
-    sc->keyframes = av_malloc(entries * sizeof(int));
-    if (!sc->keyframes)
-        return AVERROR(ENOMEM);
-    sc->keyframe_count = entries;
-
-    for(i=0; i<entries; i++) {
-        sc->keyframes[i] = get_be32(pb);
-        //dprintf(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
-    }
-    return 0;
-}
-
-static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    unsigned int i, entries, sample_size, field_size, num_bytes;
-    GetBitContext gb;
-    unsigned char* buf;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-
-    if (atom.type == MKTAG('s','t','s','z')) {
-        sample_size = get_be32(pb);
-        if (!sc->sample_size) /* do not overwrite value computed in stsd */
-            sc->sample_size = sample_size;
-        field_size = 32;
-    } else {
-        sample_size = 0;
-        get_be24(pb); /* reserved */
-        field_size = get_byte(pb);
-    }
-    entries = get_be32(pb);
-
-    dprintf(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries);
-
-    sc->sample_count = entries;
-    if (sample_size)
-        return 0;
-
-    if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) {
-        av_log(c->fc, AV_LOG_ERROR, "Invalid sample field size %d\n", field_size);
-        return -1;
-    }
-
-    if (entries >= UINT_MAX / sizeof(int) || entries >= (UINT_MAX - 4) / field_size)
-        return -1;
-    sc->sample_sizes = av_malloc(entries * sizeof(int));
-    if (!sc->sample_sizes)
-        return AVERROR(ENOMEM);
-
-    num_bytes = (entries*field_size+4)>>3;
-
-    buf = av_malloc(num_bytes+FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!buf) {
-        av_freep(&sc->sample_sizes);
-        return AVERROR(ENOMEM);
-    }
-
-    if (get_buffer(pb, buf, num_bytes) < num_bytes) {
-        av_freep(&sc->sample_sizes);
-        av_free(buf);
-        return -1;
-    }
-
-    init_get_bits(&gb, buf, 8*num_bytes);
-
-    for(i=0; i<entries; i++)
-        sc->sample_sizes[i] = get_bits_long(&gb, field_size);
-
-    av_free(buf);
-    return 0;
-}
-
-static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    unsigned int i, entries;
-    int64_t duration=0;
-    int64_t total_sample_count=0;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    entries = get_be32(pb);
-
-    dprintf(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
-
-    if(entries >= UINT_MAX / sizeof(*sc->stts_data))
-        return -1;
-    sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
-    if (!sc->stts_data)
-        return AVERROR(ENOMEM);
-    sc->stts_count = entries;
-
-    for(i=0; i<entries; i++) {
-        int sample_duration;
-        int sample_count;
-
-        sample_count=get_be32(pb);
-        sample_duration = get_be32(pb);
-        sc->stts_data[i].count= sample_count;
-        sc->stts_data[i].duration= sample_duration;
-
-        dprintf(c->fc, "sample_count=%d, sample_duration=%d\n",sample_count,sample_duration);
-
-        duration+=(int64_t)sample_duration*sample_count;
-        total_sample_count+=sample_count;
-    }
-
-    st->nb_frames= total_sample_count;
-    if(duration)
-        st->duration= duration;
-    return 0;
-}
-
-static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    unsigned int i, entries;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    entries = get_be32(pb);
-
-    dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
-
-    if(entries >= UINT_MAX / sizeof(*sc->ctts_data))
-        return -1;
-    sc->ctts_data = av_malloc(entries * sizeof(*sc->ctts_data));
-    if (!sc->ctts_data)
-        return AVERROR(ENOMEM);
-    sc->ctts_count = entries;
-
-    for(i=0; i<entries; i++) {
-        int count    =get_be32(pb);
-        int duration =get_be32(pb);
-
-        sc->ctts_data[i].count   = count;
-        sc->ctts_data[i].duration= duration;
-        if (duration < 0)
-            sc->dts_shift = FFMAX(sc->dts_shift, -duration);
-    }
-
-    dprintf(c->fc, "dts shift %d\n", sc->dts_shift);
-
-    return 0;
-}
-
-static void mov_build_index(MOVContext *mov, AVStream *st)
-{
-    MOVStreamContext *sc = st->priv_data;
-    int64_t current_offset;
-    int64_t current_dts = 0;
-    unsigned int stts_index = 0;
-    unsigned int stsc_index = 0;
-    unsigned int stss_index = 0;
-    unsigned int stps_index = 0;
-    unsigned int i, j;
-    uint64_t stream_size = 0;
-
-    /* adjust first dts according to edit list */
-    if (sc->time_offset) {
-        int rescaled = sc->time_offset < 0 ? av_rescale(sc->time_offset, sc->time_scale, mov->time_scale) : sc->time_offset;
-        current_dts = -rescaled;
-        if (sc->ctts_data && sc->ctts_data[0].duration / sc->stts_data[0].duration > 16) {
-            /* more than 16 frames delay, dts are likely wrong
-               this happens with files created by iMovie */
-            sc->wrong_dts = 1;
-            st->codec->has_b_frames = 1;
-        }
-    }
-
-    /* only use old uncompressed audio chunk demuxing when stts specifies it */
-    if (!(st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
-          sc->stts_count == 1 && sc->stts_data[0].duration == 1)) {
-        unsigned int current_sample = 0;
-        unsigned int stts_sample = 0;
-        unsigned int sample_size;
-        unsigned int distance = 0;
-        int key_off = sc->keyframes && sc->keyframes[0] == 1;
-
-        current_dts -= sc->dts_shift;
-
-        if (sc->sample_count >= UINT_MAX / sizeof(*st->index_entries))
-            return;
-        st->index_entries = av_malloc(sc->sample_count*sizeof(*st->index_entries));
-        if (!st->index_entries)
-            return;
-        st->index_entries_allocated_size = sc->sample_count*sizeof(*st->index_entries);
-
-        for (i = 0; i < sc->chunk_count; i++) {
-            current_offset = sc->chunk_offsets[i];
-            if (stsc_index + 1 < sc->stsc_count &&
-                i + 1 == sc->stsc_data[stsc_index + 1].first)
-                stsc_index++;
-            for (j = 0; j < sc->stsc_data[stsc_index].count; j++) {
-                int keyframe = 0;
-                if (current_sample >= sc->sample_count) {
-                    av_log(mov->fc, AV_LOG_ERROR, "wrong sample count\n");
-                    return;
-                }
-
-                if (!sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index]) {
-                    keyframe = 1;
-                    if (stss_index + 1 < sc->keyframe_count)
-                        stss_index++;
-                } else if (sc->stps_count && current_sample+key_off == sc->stps_data[stps_index]) {
-                    keyframe = 1;
-                    if (stps_index + 1 < sc->stps_count)
-                        stps_index++;
-                }
-                if (keyframe)
-                    distance = 0;
-                sample_size = sc->sample_size > 0 ? sc->sample_size : sc->sample_sizes[current_sample];
-                if(sc->pseudo_stream_id == -1 ||
-                   sc->stsc_data[stsc_index].id - 1 == sc->pseudo_stream_id) {
-                    AVIndexEntry *e = &st->index_entries[st->nb_index_entries++];
-                    e->pos = current_offset;
-                    e->timestamp = current_dts;
-                    e->size = sample_size;
-                    e->min_distance = distance;
-                    e->flags = keyframe ? AVINDEX_KEYFRAME : 0;
-                    dprintf(mov->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
-                            "size %d, distance %d, keyframe %d\n", st->index, current_sample,
-                            current_offset, current_dts, sample_size, distance, keyframe);
-                }
-
-                current_offset += sample_size;
-                stream_size += sample_size;
-                current_dts += sc->stts_data[stts_index].duration;
-                distance++;
-                stts_sample++;
-                current_sample++;
-                if (stts_index + 1 < sc->stts_count && stts_sample == sc->stts_data[stts_index].count) {
-                    stts_sample = 0;
-                    stts_index++;
-                }
-            }
-        }
-        if (st->duration > 0)
-            st->codec->bit_rate = stream_size*8*sc->time_scale/st->duration;
-    } else {
-        unsigned chunk_samples, total = 0;
-
-        // compute total chunk count
-        for (i = 0; i < sc->stsc_count; i++) {
-            unsigned count, chunk_count;
-
-            chunk_samples = sc->stsc_data[i].count;
-            if (sc->samples_per_frame && chunk_samples % sc->samples_per_frame) {
-                av_log(mov->fc, AV_LOG_ERROR, "error unaligned chunk\n");
-                return;
-            }
-
-            if (sc->samples_per_frame >= 160) { // gsm
-                count = chunk_samples / sc->samples_per_frame;
-            } else if (sc->samples_per_frame > 1) {
-                unsigned samples = (1024/sc->samples_per_frame)*sc->samples_per_frame;
-                count = (chunk_samples+samples-1) / samples;
-            } else {
-                count = (chunk_samples+1023) / 1024;
-            }
-
-            if (i < sc->stsc_count - 1)
-                chunk_count = sc->stsc_data[i+1].first - sc->stsc_data[i].first;
-            else
-                chunk_count = sc->chunk_count - (sc->stsc_data[i].first - 1);
-            total += chunk_count * count;
-        }
-
-        dprintf(mov->fc, "chunk count %d\n", total);
-        if (total >= UINT_MAX / sizeof(*st->index_entries))
-            return;
-        st->index_entries = av_malloc(total*sizeof(*st->index_entries));
-        if (!st->index_entries)
-            return;
-        st->index_entries_allocated_size = total*sizeof(*st->index_entries);
-
-        // populate index
-        for (i = 0; i < sc->chunk_count; i++) {
-            current_offset = sc->chunk_offsets[i];
-            if (stsc_index + 1 < sc->stsc_count &&
-                i + 1 == sc->stsc_data[stsc_index + 1].first)
-                stsc_index++;
-            chunk_samples = sc->stsc_data[stsc_index].count;
-
-            while (chunk_samples > 0) {
-                AVIndexEntry *e;
-                unsigned size, samples;
-
-                if (sc->samples_per_frame >= 160) { // gsm
-                    samples = sc->samples_per_frame;
-                    size = sc->bytes_per_frame;
-                } else {
-                    if (sc->samples_per_frame > 1) {
-                        samples = FFMIN((1024 / sc->samples_per_frame)*
-                                        sc->samples_per_frame, chunk_samples);
-                        size = (samples / sc->samples_per_frame) * sc->bytes_per_frame;
-                    } else {
-                        samples = FFMIN(1024, chunk_samples);
-                        size = samples * sc->sample_size;
-                    }
-                }
-
-                if (st->nb_index_entries >= total) {
-                    av_log(mov->fc, AV_LOG_ERROR, "wrong chunk count %d\n", total);
-                    return;
-                }
-                e = &st->index_entries[st->nb_index_entries++];
-                e->pos = current_offset;
-                e->timestamp = current_dts;
-                e->size = size;
-                e->min_distance = 0;
-                e->flags = AVINDEX_KEYFRAME;
-                dprintf(mov->fc, "AVIndex stream %d, chunk %d, offset %"PRIx64", dts %"PRId64", "
-                        "size %d, duration %d\n", st->index, i, current_offset, current_dts,
-                        size, samples);
-
-                current_offset += size;
-                current_dts += samples;
-                chunk_samples -= samples;
-            }
-        }
-    }
-}
-
-static int mov_open_dref(ByteIOContext **pb, char *src, MOVDref *ref)
-{
-    /* try relative path, we do not try the absolute because it can leak information about our
-       system to an attacker */
-    if (ref->nlvl_to > 0 && ref->nlvl_from > 0) {
-        char filename[1024];
-        char *src_path;
-        int i, l;
-
-        /* find a source dir */
-        src_path = strrchr(src, '/');
-        if (src_path)
-            src_path++;
-        else
-            src_path = src;
-
-        /* find a next level down to target */
-        for (i = 0, l = strlen(ref->path) - 1; l >= 0; l--)
-            if (ref->path[l] == '/') {
-                if (i == ref->nlvl_to - 1)
-                    break;
-                else
-                    i++;
-            }
-
-        /* compose filename if next level down to target was found */
-        if (i == ref->nlvl_to - 1 && src_path - src  < sizeof(filename)) {
-            memcpy(filename, src, src_path - src);
-            filename[src_path - src] = 0;
-
-            for (i = 1; i < ref->nlvl_from; i++)
-                av_strlcat(filename, "../", 1024);
-
-            av_strlcat(filename, ref->path + l + 1, 1024);
-
-            if (!url_fopen(pb, filename, URL_RDONLY))
-                return 0;
-        }
-    }
-
-    return AVERROR(ENOENT);
-};
-
-static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    AVStream *st;
-    MOVStreamContext *sc;
-    int ret;
-
-    st = av_new_stream(c->fc, c->fc->nb_streams);
-    if (!st) return AVERROR(ENOMEM);
-    sc = av_mallocz(sizeof(MOVStreamContext));
-    if (!sc) return AVERROR(ENOMEM);
-
-    st->priv_data = sc;
-    st->codec->codec_type = AVMEDIA_TYPE_DATA;
-    sc->ffindex = st->index;
-
-    if ((ret = mov_read_default(c, pb, atom)) < 0)
-        return ret;
-
-    /* sanity checks */
-    if (sc->chunk_count && (!sc->stts_count || !sc->stsc_count ||
-                            (!sc->sample_size && !sc->sample_count))) {
-        av_log(c->fc, AV_LOG_ERROR, "stream %d, missing mandatory atoms, broken header\n",
-               st->index);
-        return 0;
-    }
-
-    if (!sc->time_scale) {
-        av_log(c->fc, AV_LOG_WARNING, "stream %d, timescale not set\n", st->index);
-        sc->time_scale = c->time_scale;
-        if (!sc->time_scale)
-            sc->time_scale = 1;
-    }
-
-    av_set_pts_info(st, 64, 1, sc->time_scale);
-
-    if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
-        !st->codec->frame_size && sc->stts_count == 1) {
-        st->codec->frame_size = av_rescale(sc->stts_data[0].duration,
-                                           st->codec->sample_rate, sc->time_scale);
-        dprintf(c->fc, "frame size %d\n", st->codec->frame_size);
-    }
-
-    mov_build_index(c, st);
-
-    if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
-        MOVDref *dref = &sc->drefs[sc->dref_id - 1];
-        if (mov_open_dref(&sc->pb, c->fc->filename, dref) < 0)
-            av_log(c->fc, AV_LOG_ERROR,
-                   "stream %d, error opening alias: path='%s', dir='%s', "
-                   "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
-                   st->index, dref->path, dref->dir, dref->filename,
-                   dref->volume, dref->nlvl_from, dref->nlvl_to);
-    } else
-        sc->pb = c->fc->pb;
-
-    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        if (st->codec->width != sc->width || st->codec->height != sc->height) {
-            AVRational r = av_d2q(((double)st->codec->height * sc->width) /
-                                  ((double)st->codec->width * sc->height), INT_MAX);
-            if (st->sample_aspect_ratio.num)
-                st->sample_aspect_ratio = av_mul_q(st->sample_aspect_ratio, r);
-            else
-                st->sample_aspect_ratio = r;
-        }
-
-        av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
-                  sc->time_scale*st->nb_frames, st->duration, INT_MAX);
-    }
-
-    switch (st->codec->codec_id) {
-#if CONFIG_H261_DECODER
-    case CODEC_ID_H261:
-#endif
-#if CONFIG_H263_DECODER
-    case CODEC_ID_H263:
-#endif
-#if CONFIG_H264_DECODER
-    case CODEC_ID_H264:
-#endif
-#if CONFIG_MPEG4_DECODER
-    case CODEC_ID_MPEG4:
-#endif
-        st->codec->width = 0; /* let decoder init width/height */
-        st->codec->height= 0;
-        break;
-    }
-
-    /* Do not need those anymore. */
-    av_freep(&sc->chunk_offsets);
-    av_freep(&sc->stsc_data);
-    av_freep(&sc->sample_sizes);
-    av_freep(&sc->keyframes);
-    av_freep(&sc->stts_data);
-    av_freep(&sc->stps_data);
-
-    return 0;
-}
-
-static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    int ret;
-    c->itunes_metadata = 1;
-    ret = mov_read_default(c, pb, atom);
-    c->itunes_metadata = 0;
-    return ret;
-}
-
-static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    while (atom.size > 8) {
-        uint32_t tag = get_le32(pb);
-        atom.size -= 4;
-        if (tag == MKTAG('h','d','l','r')) {
-            url_fseek(pb, -8, SEEK_CUR);
-            atom.size += 8;
-            return mov_read_default(c, pb, atom);
-        }
-    }
-    return 0;
-}
-
-static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    int i;
-    int width;
-    int height;
-    int64_t disp_transform[2];
-    int display_matrix[3][2];
-    AVStream *st;
-    MOVStreamContext *sc;
-    int version;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    st = c->fc->streams[c->fc->nb_streams-1];
-    sc = st->priv_data;
-
-    version = get_byte(pb);
-    get_be24(pb); /* flags */
-    /*
-    MOV_TRACK_ENABLED 0x0001
-    MOV_TRACK_IN_MOVIE 0x0002
-    MOV_TRACK_IN_PREVIEW 0x0004
-    MOV_TRACK_IN_POSTER 0x0008
-    */
-
-    if (version == 1) {
-        get_be64(pb);
-        get_be64(pb);
-    } else {
-        get_be32(pb); /* creation time */
-        get_be32(pb); /* modification time */
-    }
-    st->id = (int)get_be32(pb); /* track id (NOT 0 !)*/
-    get_be32(pb); /* reserved */
-
-    /* highlevel (considering edits) duration in movie timebase */
-    (version == 1) ? get_be64(pb) : get_be32(pb);
-    get_be32(pb); /* reserved */
-    get_be32(pb); /* reserved */
-
-    get_be16(pb); /* layer */
-    get_be16(pb); /* alternate group */
-    get_be16(pb); /* volume */
-    get_be16(pb); /* reserved */
-
-    //read in the display matrix (outlined in ISO 14496-12, Section 6.2.2)
-    // they're kept in fixed point format through all calculations
-    // ignore u,v,z b/c we don't need the scale factor to calc aspect ratio
-    for (i = 0; i < 3; i++) {
-        display_matrix[i][0] = get_be32(pb);   // 16.16 fixed point
-        display_matrix[i][1] = get_be32(pb);   // 16.16 fixed point
-        get_be32(pb);           // 2.30 fixed point (not used)
-    }
-
-    width = get_be32(pb);       // 16.16 fixed point track width
-    height = get_be32(pb);      // 16.16 fixed point track height
-    sc->width = width >> 16;
-    sc->height = height >> 16;
-
-    // transform the display width/height according to the matrix
-    // skip this if the display matrix is the default identity matrix
-    // or if it is rotating the picture, ex iPhone 3GS
-    // to keep the same scale, use [width height 1<<16]
-    if (width && height &&
-        ((display_matrix[0][0] != 65536  ||
-          display_matrix[1][1] != 65536) &&
-         !display_matrix[0][1] &&
-         !display_matrix[1][0] &&
-         !display_matrix[2][0] && !display_matrix[2][1])) {
-        for (i = 0; i < 2; i++)
-            disp_transform[i] =
-                (int64_t)  width  * display_matrix[0][i] +
-                (int64_t)  height * display_matrix[1][i] +
-                ((int64_t) display_matrix[2][i] << 16);
-
-        //sample aspect ratio is new width/height divided by old width/height
-        st->sample_aspect_ratio = av_d2q(
-            ((double) disp_transform[0] * height) /
-            ((double) disp_transform[1] * width), INT_MAX);
-    }
-    return 0;
-}
-
-static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    MOVFragment *frag = &c->fragment;
-    MOVTrackExt *trex = NULL;
-    int flags, track_id, i;
-
-    get_byte(pb); /* version */
-    flags = get_be24(pb);
-
-    track_id = get_be32(pb);
-    if (!track_id)
-        return -1;
-    frag->track_id = track_id;
-    for (i = 0; i < c->trex_count; i++)
-        if (c->trex_data[i].track_id == frag->track_id) {
-            trex = &c->trex_data[i];
-            break;
-        }
-    if (!trex) {
-        av_log(c->fc, AV_LOG_ERROR, "could not find corresponding trex\n");
-        return -1;
-    }
-
-    if (flags & 0x01) frag->base_data_offset = get_be64(pb);
-    else              frag->base_data_offset = frag->moof_offset;
-    if (flags & 0x02) frag->stsd_id          = get_be32(pb);
-    else              frag->stsd_id          = trex->stsd_id;
-
-    frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration;
-    frag->size     = flags & 0x10 ? get_be32(pb) : trex->size;
-    frag->flags    = flags & 0x20 ? get_be32(pb) : trex->flags;
-    dprintf(c->fc, "frag flags 0x%x\n", frag->flags);
-    return 0;
-}
-
-static int mov_read_chap(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    c->chapter_track = get_be32(pb);
-    return 0;
-}
-
-static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    MOVTrackExt *trex;
-
-    if ((uint64_t)c->trex_count+1 >= UINT_MAX / sizeof(*c->trex_data))
-        return -1;
-    trex = av_realloc(c->trex_data, (c->trex_count+1)*sizeof(*c->trex_data));
-    if (!trex)
-        return AVERROR(ENOMEM);
-    c->trex_data = trex;
-    trex = &c->trex_data[c->trex_count++];
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    trex->track_id = get_be32(pb);
-    trex->stsd_id  = get_be32(pb);
-    trex->duration = get_be32(pb);
-    trex->size     = get_be32(pb);
-    trex->flags    = get_be32(pb);
-    return 0;
-}
-
-static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    MOVFragment *frag = &c->fragment;
-    AVStream *st = NULL;
-    MOVStreamContext *sc;
-    uint64_t offset;
-    int64_t dts;
-    int data_offset = 0;
-    unsigned entries, first_sample_flags = frag->flags;
-    int flags, distance, i;
-
-    for (i = 0; i < c->fc->nb_streams; i++) {
-        if (c->fc->streams[i]->id == frag->track_id) {
-            st = c->fc->streams[i];
-            break;
-        }
-    }
-    if (!st) {
-        av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", frag->track_id);
-        return -1;
-    }
-    sc = st->priv_data;
-    if (sc->pseudo_stream_id+1 != frag->stsd_id)
-        return 0;
-    get_byte(pb); /* version */
-    flags = get_be24(pb);
-    entries = get_be32(pb);
-    dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries);
-    if (flags & 0x001) data_offset        = get_be32(pb);
-    if (flags & 0x004) first_sample_flags = get_be32(pb);
-    if (flags & 0x800) {
-        MOVStts *ctts_data;
-        if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
-            return -1;
-        ctts_data = av_realloc(sc->ctts_data,
-                               (entries+sc->ctts_count)*sizeof(*sc->ctts_data));
-        if (!ctts_data)
-            return AVERROR(ENOMEM);
-        sc->ctts_data = ctts_data;
-    }
-    dts = st->duration;
-    offset = frag->base_data_offset + data_offset;
-    distance = 0;
-    dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags);
-    for (i = 0; i < entries; i++) {
-        unsigned sample_size = frag->size;
-        int sample_flags = i ? frag->flags : first_sample_flags;
-        unsigned sample_duration = frag->duration;
-        int keyframe;
-
-        if (flags & 0x100) sample_duration = get_be32(pb);
-        if (flags & 0x200) sample_size     = get_be32(pb);
-        if (flags & 0x400) sample_flags    = get_be32(pb);
-        if (flags & 0x800) {
-            sc->ctts_data[sc->ctts_count].count = 1;
-            sc->ctts_data[sc->ctts_count].duration = get_be32(pb);
-            sc->ctts_count++;
-        }
-        if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
-             (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000))
-            distance = 0;
-        av_add_index_entry(st, offset, dts, sample_size, distance,
-                           keyframe ? AVINDEX_KEYFRAME : 0);
-        dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", "
-                "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i,
-                offset, dts, sample_size, distance, keyframe);
-        distance++;
-        dts += sample_duration;
-        offset += sample_size;
-    }
-    frag->moof_offset = offset;
-    st->duration = dts;
-    return 0;
-}
-
-/* this atom should be null (from specs), but some buggy files put the 'moov' atom inside it... */
-/* like the files created with Adobe Premiere 5.0, for samples see */
-/* http://graphics.tudelft.nl/~wouter/publications/soundtests/ */
-static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    int err;
-
-    if (atom.size < 8)
-        return 0; /* continue */
-    if (get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
-        url_fskip(pb, atom.size - 4);
-        return 0;
-    }
-    atom.type = get_le32(pb);
-    atom.size -= 8;
-    if (atom.type != MKTAG('m','d','a','t')) {
-        url_fskip(pb, atom.size);
-        return 0;
-    }
-    err = mov_read_mdat(c, pb, atom);
-    return err;
-}
-
-static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-#if CONFIG_ZLIB
-    ByteIOContext ctx;
-    uint8_t *cmov_data;
-    uint8_t *moov_data; /* uncompressed data */
-    long cmov_len, moov_len;
-    int ret = -1;
-
-    get_be32(pb); /* dcom atom */
-    if (get_le32(pb) != MKTAG('d','c','o','m'))
-        return -1;
-    if (get_le32(pb) != MKTAG('z','l','i','b')) {
-        av_log(c->fc, AV_LOG_ERROR, "unknown compression for cmov atom !");
-        return -1;
-    }
-    get_be32(pb); /* cmvd atom */
-    if (get_le32(pb) != MKTAG('c','m','v','d'))
-        return -1;
-    moov_len = get_be32(pb); /* uncompressed size */
-    cmov_len = atom.size - 6 * 4;
-
-    cmov_data = av_malloc(cmov_len);
-    if (!cmov_data)
-        return AVERROR(ENOMEM);
-    moov_data = av_malloc(moov_len);
-    if (!moov_data) {
-        av_free(cmov_data);
-        return AVERROR(ENOMEM);
-    }
-    get_buffer(pb, cmov_data, cmov_len);
-    if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK)
-        goto free_and_return;
-    if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
-        goto free_and_return;
-    atom.type = MKTAG('m','o','o','v');
-    atom.size = moov_len;
-#ifdef DEBUG
-//    { int fd = open("/tmp/uncompheader.mov", O_WRONLY | O_CREAT); write(fd, moov_data, moov_len); close(fd); }
-#endif
-    ret = mov_read_default(c, &ctx, atom);
-free_and_return:
-    av_free(moov_data);
-    av_free(cmov_data);
-    return ret;
-#else
-    av_log(c->fc, AV_LOG_ERROR, "this file requires zlib support compiled in\n");
-    return -1;
-#endif
-}
-
-/* edit list atom */
-static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
-{
-    MOVStreamContext *sc;
-    int i, edit_count;
-
-    if (c->fc->nb_streams < 1)
-        return 0;
-    sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
-
-    get_byte(pb); /* version */
-    get_be24(pb); /* flags */
-    edit_count = get_be32(pb); /* entries */
-
-    if((uint64_t)edit_count*12+8 > atom.size)
-        return -1;
-
-    for(i=0; i<edit_count; i++){
-        int time;
-        int duration = get_be32(pb); /* Track duration */
-        time = get_be32(pb); /* Media time */
-        get_be32(pb); /* Media rate */
-        if (i == 0 && time >= -1) {
-            sc->time_offset = time != -1 ? time : -duration;
-        }
-    }
-
-    if(edit_count > 1)
-        av_log(c->fc, AV_LOG_WARNING, "multiple edit list entries, "
-               "a/v desync might occur, patch welcome\n");
-
-    dprintf(c->fc, "track[%i].edit_count = %i\n", c->fc->nb_streams-1, edit_count);
-    return 0;
-}
-
-static const MOVParseTableEntry mov_default_parse_table[] = {
-{ MKTAG('a','v','s','s'), mov_read_extradata },
-{ MKTAG('c','h','p','l'), mov_read_chpl },
-{ MKTAG('c','o','6','4'), mov_read_stco },
-{ MKTAG('c','t','t','s'), mov_read_ctts }, /* composition time to sample */
-{ MKTAG('d','i','n','f'), mov_read_default },
-{ MKTAG('d','r','e','f'), mov_read_dref },
-{ MKTAG('e','d','t','s'), mov_read_default },
-{ MKTAG('e','l','s','t'), mov_read_elst },
-{ MKTAG('e','n','d','a'), mov_read_enda },
-{ MKTAG('f','i','e','l'), mov_read_extradata },
-{ MKTAG('f','t','y','p'), mov_read_ftyp },
-{ MKTAG('g','l','b','l'), mov_read_glbl },
-{ MKTAG('h','d','l','r'), mov_read_hdlr },
-{ MKTAG('i','l','s','t'), mov_read_ilst },
-{ MKTAG('j','p','2','h'), mov_read_extradata },
-{ MKTAG('m','d','a','t'), mov_read_mdat },
-{ MKTAG('m','d','h','d'), mov_read_mdhd },
-{ MKTAG('m','d','i','a'), mov_read_default },
-{ MKTAG('m','e','t','a'), mov_read_meta },
-{ MKTAG('m','i','n','f'), mov_read_default },
-{ MKTAG('m','o','o','f'), mov_read_moof },
-{ MKTAG('m','o','o','v'), mov_read_moov },
-{ MKTAG('m','v','e','x'), mov_read_default },
-{ MKTAG('m','v','h','d'), mov_read_mvhd },
-{ MKTAG('S','M','I',' '), mov_read_smi }, /* Sorenson extension ??? */
-{ MKTAG('a','l','a','c'), mov_read_extradata }, /* alac specific atom */
-{ MKTAG('a','v','c','C'), mov_read_glbl },
-{ MKTAG('p','a','s','p'), mov_read_pasp },
-{ MKTAG('s','t','b','l'), mov_read_default },
-{ MKTAG('s','t','c','o'), mov_read_stco },
-{ MKTAG('s','t','p','s'), mov_read_stps },
-{ MKTAG('s','t','r','f'), mov_read_strf },
-{ MKTAG('s','t','s','c'), mov_read_stsc },
-{ MKTAG('s','t','s','d'), mov_read_stsd }, /* sample description */
-{ MKTAG('s','t','s','s'), mov_read_stss }, /* sync sample */
-{ MKTAG('s','t','s','z'), mov_read_stsz }, /* sample size */
-{ MKTAG('s','t','t','s'), mov_read_stts },
-{ MKTAG('s','t','z','2'), mov_read_stsz }, /* compact sample size */
-{ MKTAG('t','k','h','d'), mov_read_tkhd }, /* track header */
-{ MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */
-{ MKTAG('t','r','a','k'), mov_read_trak },
-{ MKTAG('t','r','a','f'), mov_read_default },
-{ MKTAG('t','r','e','f'), mov_read_default },
-{ MKTAG('c','h','a','p'), mov_read_chap },
-{ MKTAG('t','r','e','x'), mov_read_trex },
-{ MKTAG('t','r','u','n'), mov_read_trun },
-{ MKTAG('u','d','t','a'), mov_read_default },
-{ MKTAG('w','a','v','e'), mov_read_wave },
-{ MKTAG('e','s','d','s'), mov_read_esds },
-{ MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */
-{ MKTAG('c','m','o','v'), mov_read_cmov },
-{ 0, NULL }
-};
-
-static int mov_probe(AVProbeData *p)
-{
-    unsigned int offset;
-    uint32_t tag;
-    int score = 0;
-
-    /* check file header */
-    offset = 0;
-    for(;;) {
-        /* ignore invalid offset */
-        if ((offset + 8) > (unsigned int)p->buf_size)
-            return score;
-        tag = AV_RL32(p->buf + offset + 4);
-        switch(tag) {
-        /* check for obvious tags */
-        case MKTAG('j','P',' ',' '): /* jpeg 2000 signature */
-        case MKTAG('m','o','o','v'):
-        case MKTAG('m','d','a','t'):
-        case MKTAG('p','n','o','t'): /* detect movs with preview pics like ew.mov and april.mov */
-        case MKTAG('u','d','t','a'): /* Packet Video PVAuthor adds this and a lot of more junk */
-        case MKTAG('f','t','y','p'):
-            return AVPROBE_SCORE_MAX;
-        /* those are more common words, so rate then a bit less */
-        case MKTAG('e','d','i','w'): /* xdcam files have reverted first tags */
-        case MKTAG('w','i','d','e'):
-        case MKTAG('f','r','e','e'):
-        case MKTAG('j','u','n','k'):
-        case MKTAG('p','i','c','t'):
-            return AVPROBE_SCORE_MAX - 5;
-        case MKTAG(0x82,0x82,0x7f,0x7d):
-        case MKTAG('s','k','i','p'):
-        case MKTAG('u','u','i','d'):
-        case MKTAG('p','r','f','l'):
-            offset = AV_RB32(p->buf+offset) + offset;
-            /* if we only find those cause probedata is too small at least rate them */
-            score = AVPROBE_SCORE_MAX - 50;
-            break;
-        default:
-            /* unrecognized tag */
-            return score;
-        }
-    }
-    return score;
-}
-
-// must be done after parsing all trak because there's no order requirement
-static void mov_read_chapters(AVFormatContext *s)
-{
-    MOVContext *mov = s->priv_data;
-    AVStream *st = NULL;
-    MOVStreamContext *sc;
-    int64_t cur_pos;
-    uint8_t *title = NULL;
-    int i, len, i8, i16;
-
-    for (i = 0; i < s->nb_streams; i++)
-        if (s->streams[i]->id == mov->chapter_track) {
-            st = s->streams[i];
-            break;
-        }
-    if (!st) {
-        av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n");
-        return;
-    }
-
-    st->discard = AVDISCARD_ALL;
-    sc = st->priv_data;
-    cur_pos = url_ftell(sc->pb);
-
-    for (i = 0; i < st->nb_index_entries; i++) {
-        AVIndexEntry *sample = &st->index_entries[i];
-        int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration;
-
-        if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
-            av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i);
-            goto finish;
-        }
-
-        title = av_malloc(sample->size+2);
-        get_buffer(sc->pb, title, sample->size);
-
-        // the first two bytes are the length of the title
-        len = AV_RB16(title);
-        if (len > sample->size-2)
-            continue;
-
-        // The samples could theoretically be in any encoding if there's an encd
-        // atom following, but in practice are only utf-8 or utf-16, distinguished
-        // instead by the presence of a BOM
-        if (AV_RB16(title+2) == 0xfeff) {
-            uint8_t *utf8 = av_malloc(2*len+3);
-
-            i8 = i16 = 0;
-            while (i16 < len) {
-                uint32_t ch;
-                uint8_t tmp;
-                GET_UTF16(ch, i16 < len ? AV_RB16(title + (i16+=2)) : 0, break;)
-                PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;)
-            }
-            utf8[2+i8] = 0;
-            av_freep(&title);
-            title = utf8;
-        }
-
-        ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2);
-        av_freep(&title);
-    }
-finish:
-    av_free(title);
-    url_fseek(sc->pb, cur_pos, SEEK_SET);
-}
-
-static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    MOVContext *mov = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int err;
-    MOVAtom atom = { 0 };
-
-    mov->fc = s;
-    /* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
-    if(!url_is_streamed(pb))
-        atom.size = url_fsize(pb);
-    else
-        atom.size = INT64_MAX;
-
-    /* check MOV header */
-    if ((err = mov_read_default(mov, pb, atom)) < 0) {
-        av_log(s, AV_LOG_ERROR, "error reading header: %d\n", err);
-        return err;
-    }
-    if (!mov->found_moov) {
-        av_log(s, AV_LOG_ERROR, "moov atom not found\n");
-        return -1;
-    }
-    dprintf(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb));
-
-    if (!url_is_streamed(pb) && mov->chapter_track > 0)
-        mov_read_chapters(s);
-
-    return 0;
-}
-
-static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
-{
-    AVIndexEntry *sample = NULL;
-    int64_t best_dts = INT64_MAX;
-    int i;
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *avst = s->streams[i];
-        MOVStreamContext *msc = avst->priv_data;
-        if (msc->pb && msc->current_sample < avst->nb_index_entries) {
-            AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample];
-            int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale);
-            dprintf(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts);
-            if (!sample || (url_is_streamed(s->pb) && current_sample->pos < sample->pos) ||
-                (!url_is_streamed(s->pb) &&
-                 ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb &&
-                 ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) ||
-                  (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) {
-                sample = current_sample;
-                best_dts = dts;
-                *st = avst;
-            }
-        }
-    }
-    return sample;
-}
-
-static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MOVContext *mov = s->priv_data;
-    MOVStreamContext *sc;
-    AVIndexEntry *sample;
-    AVStream *st = NULL;
-    int ret;
- retry:
-    sample = mov_find_next_sample(s, &st);
-    if (!sample) {
-        mov->found_mdat = 0;
-        if (!url_is_streamed(s->pb) ||
-            mov_read_default(mov, s->pb, (MOVAtom){ 0, INT64_MAX }) < 0 ||
-            url_feof(s->pb))
-            return AVERROR_EOF;
-        dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
-        goto retry;
-    }
-    sc = st->priv_data;
-    /* must be done just before reading, to avoid infinite loop on sample */
-    sc->current_sample++;
-
-    if (st->discard != AVDISCARD_ALL) {
-        if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
-            av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n",
-                   sc->ffindex, sample->pos);
-            return -1;
-        }
-        ret = av_get_packet(sc->pb, pkt, sample->size);
-        if (ret < 0)
-            return ret;
-#if CONFIG_DV_DEMUXER
-        if (mov->dv_demux && sc->dv_audio_container) {
-            dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size);
-            av_free(pkt->data);
-            pkt->size = 0;
-            ret = dv_get_packet(mov->dv_demux, pkt);
-            if (ret < 0)
-                return ret;
-        }
-#endif
-    }
-
-    pkt->stream_index = sc->ffindex;
-    pkt->dts = sample->timestamp;
-    if (sc->ctts_data) {
-        pkt->pts = pkt->dts + sc->dts_shift + sc->ctts_data[sc->ctts_index].duration;
-        /* update ctts context */
-        sc->ctts_sample++;
-        if (sc->ctts_index < sc->ctts_count &&
-            sc->ctts_data[sc->ctts_index].count == sc->ctts_sample) {
-            sc->ctts_index++;
-            sc->ctts_sample = 0;
-        }
-        if (sc->wrong_dts)
-            pkt->dts = AV_NOPTS_VALUE;
-    } else {
-        int64_t next_dts = (sc->current_sample < st->nb_index_entries) ?
-            st->index_entries[sc->current_sample].timestamp : st->duration;
-        pkt->duration = next_dts - pkt->dts;
-        pkt->pts = pkt->dts;
-    }
-    if (st->discard == AVDISCARD_ALL)
-        goto retry;
-    pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0;
-    pkt->pos = sample->pos;
-    dprintf(s, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n",
-            pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration);
-    return 0;
-}
-
-static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags)
-{
-    MOVStreamContext *sc = st->priv_data;
-    int sample, time_sample;
-    int i;
-
-    sample = av_index_search_timestamp(st, timestamp, flags);
-    dprintf(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample);
-    if (sample < 0) /* not sure what to do */
-        return -1;
-    sc->current_sample = sample;
-    dprintf(s, "stream %d, found sample %d\n", st->index, sc->current_sample);
-    /* adjust ctts index */
-    if (sc->ctts_data) {
-        time_sample = 0;
-        for (i = 0; i < sc->ctts_count; i++) {
-            int next = time_sample + sc->ctts_data[i].count;
-            if (next > sc->current_sample) {
-                sc->ctts_index = i;
-                sc->ctts_sample = sc->current_sample - time_sample;
-                break;
-            }
-            time_sample = next;
-        }
-    }
-    return sample;
-}
-
-static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
-{
-    AVStream *st;
-    int64_t seek_timestamp, timestamp;
-    int sample;
-    int i;
-
-    if (stream_index >= s->nb_streams)
-        return -1;
-    if (sample_time < 0)
-        sample_time = 0;
-
-    st = s->streams[stream_index];
-    sample = mov_seek_stream(s, st, sample_time, flags);
-    if (sample < 0)
-        return -1;
-
-    /* adjust seek timestamp to found sample timestamp */
-    seek_timestamp = st->index_entries[sample].timestamp;
-
-    for (i = 0; i < s->nb_streams; i++) {
-        st = s->streams[i];
-        if (stream_index == i)
-            continue;
-
-        timestamp = av_rescale_q(seek_timestamp, s->streams[stream_index]->time_base, st->time_base);
-        mov_seek_stream(s, st, timestamp, flags);
-    }
-    return 0;
-}
-
-static int mov_read_close(AVFormatContext *s)
-{
-    MOVContext *mov = s->priv_data;
-    int i, j;
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        MOVStreamContext *sc = st->priv_data;
-
-        av_freep(&sc->ctts_data);
-        for (j = 0; j < sc->drefs_count; j++) {
-            av_freep(&sc->drefs[j].path);
-            av_freep(&sc->drefs[j].dir);
-        }
-        av_freep(&sc->drefs);
-        if (sc->pb && sc->pb != s->pb)
-            url_fclose(sc->pb);
-
-        av_freep(&st->codec->palctrl);
-    }
-
-    if (mov->dv_demux) {
-        for(i = 0; i < mov->dv_fctx->nb_streams; i++) {
-            av_freep(&mov->dv_fctx->streams[i]->codec);
-            av_freep(&mov->dv_fctx->streams[i]);
-        }
-        av_freep(&mov->dv_fctx);
-        av_freep(&mov->dv_demux);
-    }
-
-    av_freep(&mov->trex_data);
-
-    return 0;
-}
-
-AVInputFormat mov_demuxer = {
-    "mov,mp4,m4a,3gp,3g2,mj2",
-    NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"),
-    sizeof(MOVContext),
-    mov_probe,
-    mov_read_header,
-    mov_read_packet,
-    mov_read_close,
-    mov_read_seek,
-};
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
deleted file mode 100644
index 00f6990..0000000
--- a/libavformat/movenc.c
+++ /dev/null
@@ -1,2278 +0,0 @@
-/*
- * MOV, 3GP, MP4 muxer
- * Copyright (c) 2003 Thomas Raivio
- * Copyright (c) 2004 Gildas Bazin <gbazin at videolan dot org>
- * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "movenc.h"
-#include "avformat.h"
-#include "riff.h"
-#include "avio.h"
-#include "isom.h"
-#include "avc.h"
-#include "libavcodec/get_bits.h"
-#include "libavcodec/put_bits.h"
-#include "internal.h"
-#include "libavutil/avstring.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-//FIXME support 64 bit variant with wide placeholders
-static int64_t updateSize(ByteIOContext *pb, int64_t pos)
-{
-    int64_t curpos = url_ftell(pb);
-    url_fseek(pb, pos, SEEK_SET);
-    put_be32(pb, curpos - pos); /* rewrite size */
-    url_fseek(pb, curpos, SEEK_SET);
-
-    return curpos - pos;
-}
-
-/* Chunk offset atom */
-static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int i;
-    int mode64 = 0; //   use 32 bit size variant if possible
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    if (pos > UINT32_MAX) {
-        mode64 = 1;
-        put_tag(pb, "co64");
-    } else
-        put_tag(pb, "stco");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, track->entry); /* entry count */
-    for (i=0; i<track->entry; i++) {
-        if(mode64 == 1)
-            put_be64(pb, track->cluster[i].pos);
-        else
-            put_be32(pb, track->cluster[i].pos);
-    }
-    return updateSize(pb, pos);
-}
-
-/* Sample size atom */
-static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int equalChunks = 1;
-    int i, j, entries = 0, tst = -1, oldtst = -1;
-
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stsz");
-    put_be32(pb, 0); /* version & flags */
-
-    for (i=0; i<track->entry; i++) {
-        tst = track->cluster[i].size/track->cluster[i].entries;
-        if(oldtst != -1 && tst != oldtst) {
-            equalChunks = 0;
-        }
-        oldtst = tst;
-        entries += track->cluster[i].entries;
-    }
-    if (equalChunks) {
-        int sSize = track->cluster[0].size/track->cluster[0].entries;
-        put_be32(pb, sSize); // sample size
-        put_be32(pb, entries); // sample count
-    }
-    else {
-        put_be32(pb, 0); // sample size
-        put_be32(pb, entries); // sample count
-        for (i=0; i<track->entry; i++) {
-            for (j=0; j<track->cluster[i].entries; j++) {
-                put_be32(pb, track->cluster[i].size /
-                         track->cluster[i].entries);
-            }
-        }
-    }
-    return updateSize(pb, pos);
-}
-
-/* Sample to chunk atom */
-static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int index = 0, oldval = -1, i;
-    int64_t entryPos, curpos;
-
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stsc");
-    put_be32(pb, 0); // version & flags
-    entryPos = url_ftell(pb);
-    put_be32(pb, track->entry); // entry count
-    for (i=0; i<track->entry; i++) {
-        if(oldval != track->cluster[i].samplesInChunk)
-        {
-            put_be32(pb, i+1); // first chunk
-            put_be32(pb, track->cluster[i].samplesInChunk); // samples per chunk
-            put_be32(pb, 0x1); // sample description index
-            oldval = track->cluster[i].samplesInChunk;
-            index++;
-        }
-    }
-    curpos = url_ftell(pb);
-    url_fseek(pb, entryPos, SEEK_SET);
-    put_be32(pb, index); // rewrite size
-    url_fseek(pb, curpos, SEEK_SET);
-
-    return updateSize(pb, pos);
-}
-
-/* Sync sample atom */
-static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag)
-{
-    int64_t curpos, entryPos;
-    int i, index = 0;
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); // size
-    put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
-    put_be32(pb, 0); // version & flags
-    entryPos = url_ftell(pb);
-    put_be32(pb, track->entry); // entry count
-    for (i=0; i<track->entry; i++) {
-        if (track->cluster[i].flags & flag) {
-            put_be32(pb, i+1);
-            index++;
-        }
-    }
-    curpos = url_ftell(pb);
-    url_fseek(pb, entryPos, SEEK_SET);
-    put_be32(pb, index); // rewrite size
-    url_fseek(pb, curpos, SEEK_SET);
-    return updateSize(pb, pos);
-}
-
-static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    put_be32(pb, 0x11); /* size */
-    if (track->mode == MODE_MOV) put_tag(pb, "samr");
-    else                         put_tag(pb, "damr");
-    put_tag(pb, "FFMP");
-    put_byte(pb, 0); /* decoder version */
-
-    put_be16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */
-    put_byte(pb, 0x00); /* Mode change period (no restriction) */
-    put_byte(pb, 0x01); /* Frames per sample */
-    return 0x11;
-}
-
-static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    GetBitContext gbc;
-    PutBitContext pbc;
-    uint8_t buf[3];
-    int fscod, bsid, bsmod, acmod, lfeon, frmsizecod;
-
-    if (track->vosLen < 7)
-        return -1;
-
-    put_be32(pb, 11);
-    put_tag(pb, "dac3");
-
-    init_get_bits(&gbc, track->vosData+4, track->vosLen-4);
-    fscod      = get_bits(&gbc, 2);
-    frmsizecod = get_bits(&gbc, 6);
-    bsid       = get_bits(&gbc, 5);
-    bsmod      = get_bits(&gbc, 3);
-    acmod      = get_bits(&gbc, 3);
-    if (acmod == 2) {
-        skip_bits(&gbc, 2); // dsurmod
-    } else {
-        if ((acmod & 1) && acmod != 1)
-            skip_bits(&gbc, 2); // cmixlev
-        if (acmod & 4)
-            skip_bits(&gbc, 2); // surmixlev
-    }
-    lfeon = get_bits1(&gbc);
-
-    init_put_bits(&pbc, buf, sizeof(buf));
-    put_bits(&pbc, 2, fscod);
-    put_bits(&pbc, 5, bsid);
-    put_bits(&pbc, 3, bsmod);
-    put_bits(&pbc, 3, acmod);
-    put_bits(&pbc, 1, lfeon);
-    put_bits(&pbc, 5, frmsizecod>>1); // bit_rate_code
-    put_bits(&pbc, 5, 0); // reserved
-
-    flush_put_bits(&pbc);
-    put_buffer(pb, buf, sizeof(buf));
-
-    return 11;
-}
-
-/**
- * This function writes extradata "as is".
- * Extradata must be formated like a valid atom (with size and tag)
- */
-static int mov_write_extradata_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    put_buffer(pb, track->enc->extradata, track->enc->extradata_size);
-    return track->enc->extradata_size;
-}
-
-static int mov_write_enda_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 10);
-    put_tag(pb, "enda");
-    put_be16(pb, 1); /* little endian */
-    return 10;
-}
-
-static unsigned int descrLength(unsigned int len)
-{
-    int i;
-    for(i=1; len>>(7*i); i++);
-    return len + 1 + i;
-}
-
-static void putDescr(ByteIOContext *pb, int tag, unsigned int size)
-{
-    int i= descrLength(size) - size - 2;
-    put_byte(pb, tag);
-    for(; i>0; i--)
-        put_byte(pb, (size>>(7*i)) | 0x80);
-    put_byte(pb, size & 0x7F);
-}
-
-static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic
-{
-    int64_t pos = url_ftell(pb);
-    int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
-
-    put_be32(pb, 0); // size
-    put_tag(pb, "esds");
-    put_be32(pb, 0); // Version
-
-    // ES descriptor
-    putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) +
-             descrLength(1));
-    put_be16(pb, track->trackID);
-    put_byte(pb, 0x00); // flags (= no flags)
-
-    // DecoderConfig descriptor
-    putDescr(pb, 0x04, 13 + decoderSpecificInfoLen);
-
-    // Object type indication
-    if ((track->enc->codec_id == CODEC_ID_MP2 ||
-         track->enc->codec_id == CODEC_ID_MP3) &&
-        track->enc->sample_rate > 24000)
-        put_byte(pb, 0x6B); // 11172-3
-    else
-        put_byte(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id));
-
-    // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio)
-    // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved)
-    if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
-        put_byte(pb, 0x15); // flags (= Audiostream)
-    else
-        put_byte(pb, 0x11); // flags (= Visualstream)
-
-    put_byte(pb,  track->enc->rc_buffer_size>>(3+16));    // Buffersize DB (24 bits)
-    put_be16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB
-
-    put_be32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window)
-    if(track->enc->rc_max_rate != track->enc->rc_min_rate || track->enc->rc_min_rate==0)
-        put_be32(pb, 0); // vbr
-    else
-        put_be32(pb, track->enc->rc_max_rate); // avg bitrate
-
-    if (track->vosLen) {
-        // DecoderSpecific info descriptor
-        putDescr(pb, 0x05, track->vosLen);
-        put_buffer(pb, track->vosData, track->vosLen);
-    }
-
-    // SL descriptor
-    putDescr(pb, 0x06, 1);
-    put_byte(pb, 0x02);
-    return updateSize(pb, pos);
-}
-
-static int mov_pcm_le_gt16(enum CodecID codec_id)
-{
-    return codec_id == CODEC_ID_PCM_S24LE ||
-           codec_id == CODEC_ID_PCM_S32LE ||
-           codec_id == CODEC_ID_PCM_F32LE ||
-           codec_id == CODEC_ID_PCM_F64LE;
-}
-
-static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-
-    put_be32(pb, 0);     /* size */
-    put_tag(pb, "wave");
-
-    put_be32(pb, 12);    /* size */
-    put_tag(pb, "frma");
-    put_le32(pb, track->tag);
-
-    if (track->enc->codec_id == CODEC_ID_AAC) {
-        /* useless atom needed by mplayer, ipod, not needed by quicktime */
-        put_be32(pb, 12); /* size */
-        put_tag(pb, "mp4a");
-        put_be32(pb, 0);
-        mov_write_esds_tag(pb, track);
-    } else if (mov_pcm_le_gt16(track->enc->codec_id)) {
-        mov_write_enda_tag(pb);
-    } else if (track->enc->codec_id == CODEC_ID_AMR_NB) {
-        mov_write_amr_tag(pb, track);
-    } else if (track->enc->codec_id == CODEC_ID_AC3) {
-        mov_write_ac3_tag(pb, track);
-    } else if (track->enc->codec_id == CODEC_ID_ALAC) {
-        mov_write_extradata_tag(pb, track);
-    }
-
-    put_be32(pb, 8);     /* size */
-    put_be32(pb, 0);     /* null tag */
-
-    return updateSize(pb, pos);
-}
-
-static int mov_write_glbl_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    put_be32(pb, track->vosLen+8);
-    put_tag(pb, "glbl");
-    put_buffer(pb, track->vosData, track->vosLen);
-    return 8+track->vosLen;
-}
-
-/**
- * Compute flags for 'lpcm' tag.
- * See CoreAudioTypes and AudioStreamBasicDescription at Apple.
- */
-static int mov_get_lpcm_flags(enum CodecID codec_id)
-{
-    switch (codec_id) {
-    case CODEC_ID_PCM_F32BE:
-    case CODEC_ID_PCM_F64BE:
-        return 11;
-    case CODEC_ID_PCM_F32LE:
-    case CODEC_ID_PCM_F64LE:
-        return 9;
-    case CODEC_ID_PCM_U8:
-        return 10;
-    case CODEC_ID_PCM_S16BE:
-    case CODEC_ID_PCM_S24BE:
-    case CODEC_ID_PCM_S32BE:
-        return 14;
-    case CODEC_ID_PCM_S8:
-    case CODEC_ID_PCM_S16LE:
-    case CODEC_ID_PCM_S24LE:
-    case CODEC_ID_PCM_S32LE:
-        return 12;
-    default:
-        return 0;
-    }
-}
-
-static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    int version = 0;
-    uint32_t tag = track->tag;
-
-    if (track->mode == MODE_MOV) {
-        if (track->timescale > UINT16_MAX) {
-            if (mov_get_lpcm_flags(track->enc->codec_id))
-                tag = AV_RL32("lpcm");
-            version = 2;
-        } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id)) {
-            version = 1;
-        }
-    }
-
-    put_be32(pb, 0); /* size */
-    put_le32(pb, tag); // store it byteswapped
-    put_be32(pb, 0); /* Reserved */
-    put_be16(pb, 0); /* Reserved */
-    put_be16(pb, 1); /* Data-reference index, XXX  == 1 */
-
-    /* SoundDescription */
-    put_be16(pb, version); /* Version */
-    put_be16(pb, 0); /* Revision level */
-    put_be32(pb, 0); /* Reserved */
-
-    if (version == 2) {
-        put_be16(pb, 3);
-        put_be16(pb, 16);
-        put_be16(pb, 0xfffe);
-        put_be16(pb, 0);
-        put_be32(pb, 0x00010000);
-        put_be32(pb, 72);
-        put_be64(pb, av_dbl2int(track->timescale));
-        put_be32(pb, track->enc->channels);
-        put_be32(pb, 0x7F000000);
-        put_be32(pb, av_get_bits_per_sample(track->enc->codec_id));
-        put_be32(pb, mov_get_lpcm_flags(track->enc->codec_id));
-        put_be32(pb, track->sampleSize);
-        put_be32(pb, track->enc->frame_size);
-    } else {
-        if (track->mode == MODE_MOV) {
-            put_be16(pb, track->enc->channels);
-            if (track->enc->codec_id == CODEC_ID_PCM_U8 ||
-                track->enc->codec_id == CODEC_ID_PCM_S8)
-                put_be16(pb, 8); /* bits per sample */
-            else
-                put_be16(pb, 16);
-            put_be16(pb, track->audio_vbr ? -2 : 0); /* compression ID */
-        } else { /* reserved for mp4/3gp */
-            put_be16(pb, 2);
-            put_be16(pb, 16);
-            put_be16(pb, 0);
-        }
-
-        put_be16(pb, 0); /* packet size (= 0) */
-        put_be16(pb, track->timescale); /* Time scale */
-        put_be16(pb, 0); /* Reserved */
-    }
-
-    if(version == 1) { /* SoundDescription V1 extended info */
-        put_be32(pb, track->enc->frame_size); /* Samples per packet */
-        put_be32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */
-        put_be32(pb, track->sampleSize); /* Bytes per frame */
-        put_be32(pb, 2); /* Bytes per sample */
-    }
-
-    if(track->mode == MODE_MOV &&
-       (track->enc->codec_id == CODEC_ID_AAC ||
-        track->enc->codec_id == CODEC_ID_AC3 ||
-        track->enc->codec_id == CODEC_ID_AMR_NB ||
-        track->enc->codec_id == CODEC_ID_ALAC ||
-        mov_pcm_le_gt16(track->enc->codec_id)))
-        mov_write_wave_tag(pb, track);
-    else if(track->tag == MKTAG('m','p','4','a'))
-        mov_write_esds_tag(pb, track);
-    else if(track->enc->codec_id == CODEC_ID_AMR_NB)
-        mov_write_amr_tag(pb, track);
-    else if(track->enc->codec_id == CODEC_ID_AC3)
-        mov_write_ac3_tag(pb, track);
-    else if(track->enc->codec_id == CODEC_ID_ALAC)
-        mov_write_extradata_tag(pb, track);
-    else if(track->vosLen > 0)
-        mov_write_glbl_tag(pb, track);
-
-    return updateSize(pb, pos);
-}
-
-static int mov_write_d263_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 0xf); /* size */
-    put_tag(pb, "d263");
-    put_tag(pb, "FFMP");
-    put_byte(pb, 0); /* decoder version */
-    /* FIXME use AVCodecContext level/profile, when encoder will set values */
-    put_byte(pb, 0xa); /* level */
-    put_byte(pb, 0); /* profile */
-    return 0xf;
-}
-
-/* TODO: No idea about these values */
-static int mov_write_svq3_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 0x15);
-    put_tag(pb, "SMI ");
-    put_tag(pb, "SEQH");
-    put_be32(pb, 0x5);
-    put_be32(pb, 0xe2c0211d);
-    put_be32(pb, 0xc0000000);
-    put_byte(pb, 0);
-    return 0x15;
-}
-
-static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-
-    put_be32(pb, 0);
-    put_tag(pb, "avcC");
-    ff_isom_write_avcc(pb, track->vosData, track->vosLen);
-    return updateSize(pb, pos);
-}
-
-/* also used by all avid codecs (dv, imx, meridien) and their variants */
-static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int i;
-    put_be32(pb, 24); /* size */
-    put_tag(pb, "ACLR");
-    put_tag(pb, "ACLR");
-    put_tag(pb, "0001");
-    put_be32(pb, 1); /* yuv 1 / rgb 2 ? */
-    put_be32(pb, 0); /* unknown */
-
-    put_be32(pb, 24); /* size */
-    put_tag(pb, "APRG");
-    put_tag(pb, "APRG");
-    put_tag(pb, "0001");
-    put_be32(pb, 1); /* unknown */
-    put_be32(pb, 0); /* unknown */
-
-    put_be32(pb, 120); /* size */
-    put_tag(pb, "ARES");
-    put_tag(pb, "ARES");
-    put_tag(pb, "0001");
-    put_be32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */
-    put_be32(pb, track->enc->width);
-    /* values below are based on samples created with quicktime and avid codecs */
-    if (track->vosData[5] & 2) { // interlaced
-        put_be32(pb, track->enc->height/2);
-        put_be32(pb, 2); /* unknown */
-        put_be32(pb, 0); /* unknown */
-        put_be32(pb, 4); /* unknown */
-    } else {
-        put_be32(pb, track->enc->height);
-        put_be32(pb, 1); /* unknown */
-        put_be32(pb, 0); /* unknown */
-        if (track->enc->height == 1080)
-            put_be32(pb, 5); /* unknown */
-        else
-            put_be32(pb, 6); /* unknown */
-    }
-    /* padding */
-    for (i = 0; i < 10; i++)
-        put_be64(pb, 0);
-
-    /* extra padding for stsd needed */
-    put_be32(pb, 0);
-    return 0;
-}
-
-static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
-{
-    int tag = track->enc->codec_tag;
-
-    if (!ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id))
-        return 0;
-
-    if      (track->enc->codec_id == CODEC_ID_H264)      tag = MKTAG('a','v','c','1');
-    else if (track->enc->codec_id == CODEC_ID_AC3)       tag = MKTAG('a','c','-','3');
-    else if (track->enc->codec_id == CODEC_ID_DIRAC)     tag = MKTAG('d','r','a','c');
-    else if (track->enc->codec_id == CODEC_ID_MOV_TEXT)  tag = MKTAG('t','x','3','g');
-    else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
-    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
-
-    return tag;
-}
-
-static const AVCodecTag codec_ipod_tags[] = {
-    { CODEC_ID_H264,   MKTAG('a','v','c','1') },
-    { CODEC_ID_MPEG4,  MKTAG('m','p','4','v') },
-    { CODEC_ID_AAC,    MKTAG('m','p','4','a') },
-    { CODEC_ID_ALAC,   MKTAG('a','l','a','c') },
-    { CODEC_ID_AC3,    MKTAG('a','c','-','3') },
-    { CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') },
-    { CODEC_ID_MOV_TEXT, MKTAG('t','e','x','t') },
-    { CODEC_ID_NONE, 0 },
-};
-
-static int ipod_get_codec_tag(AVFormatContext *s, MOVTrack *track)
-{
-    int tag = track->enc->codec_tag;
-
-    // keep original tag for subs, ipod supports both formats
-    if (!(track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE &&
-        (tag == MKTAG('t','x','3','g') ||
-         tag == MKTAG('t','e','x','t'))))
-        tag = ff_codec_get_tag(codec_ipod_tags, track->enc->codec_id);
-
-    if (!av_match_ext(s->filename, "m4a") && !av_match_ext(s->filename, "m4v"))
-        av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v "
-               "Quicktime/Ipod might not play the file\n");
-
-    return tag;
-}
-
-static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track)
-{
-    int tag;
-
-    if (track->enc->height == 480) /* NTSC */
-        if  (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n');
-        else                                         tag = MKTAG('d','v','c',' ');
-    else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p');
-    else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p');
-    else                                             tag = MKTAG('d','v','p','p');
-
-    return tag;
-}
-
-static const struct {
-    enum PixelFormat pix_fmt;
-    uint32_t tag;
-    unsigned bps;
-} mov_pix_fmt_tags[] = {
-    { PIX_FMT_YUYV422, MKTAG('y','u','v','s'),  0 },
-    { PIX_FMT_UYVY422, MKTAG('2','v','u','y'),  0 },
-    { PIX_FMT_BGR555,  MKTAG('r','a','w',' '), 16 },
-    { PIX_FMT_RGB555LE,MKTAG('L','5','5','5'), 16 },
-    { PIX_FMT_RGB565LE,MKTAG('L','5','6','5'), 16 },
-    { PIX_FMT_RGB565BE,MKTAG('B','5','6','5'), 16 },
-    { PIX_FMT_RGB24,   MKTAG('r','a','w',' '), 24 },
-    { PIX_FMT_BGR24,   MKTAG('2','4','B','G'), 24 },
-    { PIX_FMT_ARGB,    MKTAG('r','a','w',' '), 32 },
-    { PIX_FMT_BGRA,    MKTAG('B','G','R','A'), 32 },
-    { PIX_FMT_RGBA,    MKTAG('R','G','B','A'), 32 },
-};
-
-static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
-{
-    int tag = track->enc->codec_tag;
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) {
-        if (track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) {
-            tag = mov_pix_fmt_tags[i].tag;
-            track->enc->bits_per_coded_sample = mov_pix_fmt_tags[i].bps;
-            break;
-        }
-    }
-
-    return tag;
-}
-
-static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
-{
-    int tag = track->enc->codec_tag;
-
-    if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&
-                 (tag == MKTAG('d','v','c','p') ||
-                  track->enc->codec_id == CODEC_ID_RAWVIDEO ||
-                  av_get_bits_per_sample(track->enc->codec_id)))) { // pcm audio
-        if (track->enc->codec_id == CODEC_ID_DVVIDEO)
-            tag = mov_get_dv_codec_tag(s, track);
-        else if (track->enc->codec_id == CODEC_ID_RAWVIDEO)
-            tag = mov_get_rawvideo_codec_tag(s, track);
-        else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-            tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
-            if (!tag) { // if no mac fcc found, try with Microsoft tags
-                tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id);
-                if (tag)
-                    av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, "
-                           "the file may be unplayable!\n");
-            }
-        } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id);
-            if (!tag) { // if no mac fcc found, try with Microsoft tags
-                int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id);
-                if (ms_tag) {
-                    tag = MKTAG('m', 's', ((ms_tag >> 8) & 0xff), (ms_tag & 0xff));
-                    av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, "
-                           "the file may be unplayable!\n");
-                }
-            }
-        } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)
-            tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->enc->codec_id);
-    }
-
-    return tag;
-}
-
-static const AVCodecTag codec_3gp_tags[] = {
-    { CODEC_ID_H263,   MKTAG('s','2','6','3') },
-    { CODEC_ID_H264,   MKTAG('a','v','c','1') },
-    { CODEC_ID_MPEG4,  MKTAG('m','p','4','v') },
-    { CODEC_ID_AAC,    MKTAG('m','p','4','a') },
-    { CODEC_ID_AMR_NB, MKTAG('s','a','m','r') },
-    { CODEC_ID_AMR_WB, MKTAG('s','a','w','b') },
-    { CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') },
-    { CODEC_ID_NONE, 0 },
-};
-
-static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track)
-{
-    int tag = track->enc->codec_tag;
-
-    if (track->mode == MODE_MP4 || track->mode == MODE_PSP)
-        tag = mp4_get_codec_tag(s, track);
-    else if (track->mode == MODE_IPOD)
-        tag = ipod_get_codec_tag(s, track);
-    else if (track->mode & MODE_3GP)
-        tag = ff_codec_get_tag(codec_3gp_tags, track->enc->codec_id);
-    else
-        tag = mov_get_codec_tag(s, track);
-
-    return tag;
-}
-
-/** Write uuid atom.
- * Needed to make file play in iPods running newest firmware
- * goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1
- */
-static int mov_write_uuid_tag_ipod(ByteIOContext *pb)
-{
-    put_be32(pb, 28);
-    put_tag(pb, "uuid");
-    put_be32(pb, 0x6b6840f2);
-    put_be32(pb, 0x5f244fc5);
-    put_be32(pb, 0xba39a51b);
-    put_be32(pb, 0xcf0323f3);
-    put_be32(pb, 0x0);
-    return 28;
-}
-
-static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0);    /* size */
-    put_le32(pb, track->tag); // store it byteswapped
-    put_be32(pb, 0);    /* Reserved */
-    put_be16(pb, 0);    /* Reserved */
-    put_be16(pb, 1);    /* Data-reference index */
-
-    if (track->enc->extradata_size)
-        put_buffer(pb, track->enc->extradata, track->enc->extradata_size);
-
-    return updateSize(pb, pos);
-}
-
-static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    char compressor_name[32];
-
-    put_be32(pb, 0); /* size */
-    put_le32(pb, track->tag); // store it byteswapped
-    put_be32(pb, 0); /* Reserved */
-    put_be16(pb, 0); /* Reserved */
-    put_be16(pb, 1); /* Data-reference index */
-
-    put_be16(pb, 0); /* Codec stream version */
-    put_be16(pb, 0); /* Codec stream revision (=0) */
-    if (track->mode == MODE_MOV) {
-        put_tag(pb, "FFMP"); /* Vendor */
-        if(track->enc->codec_id == CODEC_ID_RAWVIDEO) {
-            put_be32(pb, 0); /* Temporal Quality */
-            put_be32(pb, 0x400); /* Spatial Quality = lossless*/
-        } else {
-            put_be32(pb, 0x200); /* Temporal Quality = normal */
-            put_be32(pb, 0x200); /* Spatial Quality = normal */
-        }
-    } else {
-        put_be32(pb, 0); /* Reserved */
-        put_be32(pb, 0); /* Reserved */
-        put_be32(pb, 0); /* Reserved */
-    }
-    put_be16(pb, track->enc->width); /* Video width */
-    put_be16(pb, track->height); /* Video height */
-    put_be32(pb, 0x00480000); /* Horizontal resolution 72dpi */
-    put_be32(pb, 0x00480000); /* Vertical resolution 72dpi */
-    put_be32(pb, 0); /* Data size (= 0) */
-    put_be16(pb, 1); /* Frame count (= 1) */
-
-    memset(compressor_name,0,32);
-    /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */
-    if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name)
-        strncpy(compressor_name,track->enc->codec->name,31);
-    put_byte(pb, strlen(compressor_name));
-    put_buffer(pb, compressor_name, 31);
-
-    if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample)
-        put_be16(pb, track->enc->bits_per_coded_sample);
-    else
-        put_be16(pb, 0x18); /* Reserved */
-    put_be16(pb, 0xffff); /* Reserved */
-    if(track->tag == MKTAG('m','p','4','v'))
-        mov_write_esds_tag(pb, track);
-    else if(track->enc->codec_id == CODEC_ID_H263)
-        mov_write_d263_tag(pb);
-    else if(track->enc->codec_id == CODEC_ID_SVQ3)
-        mov_write_svq3_tag(pb);
-    else if(track->enc->codec_id == CODEC_ID_DNXHD)
-        mov_write_avid_tag(pb, track);
-    else if(track->enc->codec_id == CODEC_ID_H264) {
-        mov_write_avcc_tag(pb, track);
-        if(track->mode == MODE_IPOD)
-            mov_write_uuid_tag_ipod(pb);
-    } else if(track->vosLen > 0)
-        mov_write_glbl_tag(pb, track);
-
-    return updateSize(pb, pos);
-}
-
-static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "rtp ");
-    put_be32(pb, 0); /* Reserved */
-    put_be16(pb, 0); /* Reserved */
-    put_be16(pb, 1); /* Data-reference index */
-
-    put_be16(pb, 1); /* Hint track version */
-    put_be16(pb, 1); /* Highest compatible version */
-    put_be32(pb, track->max_packet_size); /* Max packet size */
-
-    put_be32(pb, 12); /* size */
-    put_tag(pb, "tims");
-    put_be32(pb, track->timescale);
-
-    return updateSize(pb, pos);
-}
-
-static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stsd");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, 1); /* entry count */
-    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
-        mov_write_video_tag(pb, track);
-    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
-        mov_write_audio_tag(pb, track);
-    else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)
-        mov_write_subtitle_tag(pb, track);
-    else if (track->enc->codec_tag == MKTAG('r','t','p',' '))
-        mov_write_rtp_tag(pb, track);
-    return updateSize(pb, pos);
-}
-
-static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    MOVStts *ctts_entries;
-    uint32_t entries = 0;
-    uint32_t atom_size;
-    int i;
-
-    ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */
-    ctts_entries[0].count = 1;
-    ctts_entries[0].duration = track->cluster[0].cts;
-    for (i=1; i<track->entry; i++) {
-        if (track->cluster[i].cts == ctts_entries[entries].duration) {
-            ctts_entries[entries].count++; /* compress */
-        } else {
-            entries++;
-            ctts_entries[entries].duration = track->cluster[i].cts;
-            ctts_entries[entries].count = 1;
-        }
-    }
-    entries++; /* last one */
-    atom_size = 16 + (entries * 8);
-    put_be32(pb, atom_size); /* size */
-    put_tag(pb, "ctts");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, entries); /* entry count */
-    for (i=0; i<entries; i++) {
-        put_be32(pb, ctts_entries[i].count);
-        put_be32(pb, ctts_entries[i].duration);
-    }
-    av_free(ctts_entries);
-    return atom_size;
-}
-
-/* Time to sample atom */
-static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    MOVStts *stts_entries;
-    uint32_t entries = -1;
-    uint32_t atom_size;
-    int i;
-
-    if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO && !track->audio_vbr) {
-        stts_entries = av_malloc(sizeof(*stts_entries)); /* one entry */
-        stts_entries[0].count = track->sampleCount;
-        stts_entries[0].duration = 1;
-        entries = 1;
-    } else {
-        stts_entries = av_malloc(track->entry * sizeof(*stts_entries)); /* worst case */
-        for (i=0; i<track->entry; i++) {
-            int64_t duration = i + 1 == track->entry ?
-                track->trackDuration - track->cluster[i].dts + track->cluster[0].dts : /* readjusting */
-                track->cluster[i+1].dts - track->cluster[i].dts;
-            if (i && duration == stts_entries[entries].duration) {
-                stts_entries[entries].count++; /* compress */
-            } else {
-                entries++;
-                stts_entries[entries].duration = duration;
-                stts_entries[entries].count = 1;
-            }
-        }
-        entries++; /* last one */
-    }
-    atom_size = 16 + (entries * 8);
-    put_be32(pb, atom_size); /* size */
-    put_tag(pb, "stts");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, entries); /* entry count */
-    for (i=0; i<entries; i++) {
-        put_be32(pb, stts_entries[i].count);
-        put_be32(pb, stts_entries[i].duration);
-    }
-    av_free(stts_entries);
-    return atom_size;
-}
-
-static int mov_write_dref_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 28); /* size */
-    put_tag(pb, "dref");
-    put_be32(pb, 0); /* version & flags */
-    put_be32(pb, 1); /* entry count */
-
-    put_be32(pb, 0xc); /* size */
-    put_tag(pb, "url ");
-    put_be32(pb, 1); /* version & flags */
-
-    return 28;
-}
-
-static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "stbl");
-    mov_write_stsd_tag(pb, track);
-    mov_write_stts_tag(pb, track);
-    if ((track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
-         track->enc->codec_tag == MKTAG('r','t','p',' ')) &&
-        track->hasKeyframes && track->hasKeyframes < track->entry)
-        mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
-    if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)
-        mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);
-    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO &&
-        track->flags & MOV_TRACK_CTTS)
-        mov_write_ctts_tag(pb, track);
-    mov_write_stsc_tag(pb, track);
-    mov_write_stsz_tag(pb, track);
-    mov_write_stco_tag(pb, track);
-    return updateSize(pb, pos);
-}
-
-static int mov_write_dinf_tag(ByteIOContext *pb)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "dinf");
-    mov_write_dref_tag(pb);
-    return updateSize(pb, pos);
-}
-
-static int mov_write_nmhd_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 12);
-    put_tag(pb, "nmhd");
-    put_be32(pb, 0);
-    return 12;
-}
-
-static int mov_write_gmhd_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 0x20);   /* size */
-    put_tag(pb, "gmhd");
-    put_be32(pb, 0x18);   /* gmin size */
-    put_tag(pb, "gmin");  /* generic media info */
-    put_be32(pb, 0);      /* version & flags */
-    put_be16(pb, 0x40);   /* graphics mode = */
-    put_be16(pb, 0x8000); /* opColor (r?) */
-    put_be16(pb, 0x8000); /* opColor (g?) */
-    put_be16(pb, 0x8000); /* opColor (b?) */
-    put_be16(pb, 0);      /* balance */
-    put_be16(pb, 0);      /* reserved */
-    return 0x20;
-}
-
-static int mov_write_smhd_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 16); /* size */
-    put_tag(pb, "smhd");
-    put_be32(pb, 0); /* version & flags */
-    put_be16(pb, 0); /* reserved (balance, normally = 0) */
-    put_be16(pb, 0); /* reserved */
-    return 16;
-}
-
-static int mov_write_vmhd_tag(ByteIOContext *pb)
-{
-    put_be32(pb, 0x14); /* size (always 0x14) */
-    put_tag(pb, "vmhd");
-    put_be32(pb, 0x01); /* version & flags */
-    put_be64(pb, 0); /* reserved (graphics mode = copy) */
-    return 0x14;
-}
-
-static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    const char *hdlr, *descr = NULL, *hdlr_type = NULL;
-    int64_t pos = url_ftell(pb);
-
-    if (!track) { /* no media --> data handler */
-        hdlr = "dhlr";
-        hdlr_type = "url ";
-        descr = "DataHandler";
-    } else {
-        hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0";
-        if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
-            hdlr_type = "vide";
-            descr = "VideoHandler";
-        } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            hdlr_type = "soun";
-            descr = "SoundHandler";
-        } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-            if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl";
-            else                                      hdlr_type = "text";
-            descr = "SubtitleHandler";
-        } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) {
-            hdlr_type = "hint";
-            descr = "HintHandler";
-        }
-    }
-
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "hdlr");
-    put_be32(pb, 0); /* Version & flags */
-    put_buffer(pb, hdlr, 4); /* handler */
-    put_tag(pb, hdlr_type); /* handler type */
-    put_be32(pb ,0); /* reserved */
-    put_be32(pb ,0); /* reserved */
-    put_be32(pb ,0); /* reserved */
-    if (!track || track->mode == MODE_MOV)
-        put_byte(pb, strlen(descr)); /* pascal string */
-    put_buffer(pb, descr, strlen(descr)); /* handler description */
-    if (track && track->mode != MODE_MOV)
-        put_byte(pb, 0); /* c string */
-    return updateSize(pb, pos);
-}
-
-static int mov_write_hmhd_tag(ByteIOContext *pb)
-{
-    /* This atom must be present, but leaving the values at zero
-     * seems harmless. */
-    put_be32(pb, 28); /* size */
-    put_tag(pb, "hmhd");
-    put_be32(pb, 0); /* version, flags */
-    put_be16(pb, 0); /* maxPDUsize */
-    put_be16(pb, 0); /* avgPDUsize */
-    put_be32(pb, 0); /* maxbitrate */
-    put_be32(pb, 0); /* avgbitrate */
-    put_be32(pb, 0); /* reserved */
-    return 28;
-}
-
-static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "minf");
-    if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
-        mov_write_vmhd_tag(pb);
-    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
-        mov_write_smhd_tag(pb);
-    else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-        if (track->tag == MKTAG('t','e','x','t')) mov_write_gmhd_tag(pb);
-        else                                      mov_write_nmhd_tag(pb);
-    } else if (track->tag == MKTAG('r','t','p',' ')) {
-        mov_write_hmhd_tag(pb);
-    }
-    if (track->mode == MODE_MOV) /* FIXME: Why do it for MODE_MOV only ? */
-        mov_write_hdlr_tag(pb, NULL);
-    mov_write_dinf_tag(pb);
-    mov_write_stbl_tag(pb, track);
-    return updateSize(pb, pos);
-}
-
-static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int version = track->trackDuration < INT32_MAX ? 0 : 1;
-
-    (version == 1) ? put_be32(pb, 44) : put_be32(pb, 32); /* size */
-    put_tag(pb, "mdhd");
-    put_byte(pb, version);
-    put_be24(pb, 0); /* flags */
-    if (version == 1) {
-        put_be64(pb, track->time);
-        put_be64(pb, track->time);
-    } else {
-        put_be32(pb, track->time); /* creation time */
-        put_be32(pb, track->time); /* modification time */
-    }
-    put_be32(pb, track->timescale); /* time scale (sample rate for audio) */
-    (version == 1) ? put_be64(pb, track->trackDuration) : put_be32(pb, track->trackDuration); /* duration */
-    put_be16(pb, track->language); /* language */
-    put_be16(pb, 0); /* reserved (quality) */
-
-    if(version!=0 && track->mode == MODE_MOV){
-        av_log(NULL, AV_LOG_ERROR,
-            "FATAL error, file duration too long for timebase, this file will not be\n"
-            "playable with quicktime. Choose a different timebase or a different\n"
-            "container format\n");
-    }
-
-    return 32;
-}
-
-static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "mdia");
-    mov_write_mdhd_tag(pb, track);
-    mov_write_hdlr_tag(pb, track);
-    mov_write_minf_tag(pb, track);
-    return updateSize(pb, pos);
-}
-
-static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
-{
-    int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
-                                      track->timescale, AV_ROUND_UP);
-    int version = duration < INT32_MAX ? 0 : 1;
-
-    (version == 1) ? put_be32(pb, 104) : put_be32(pb, 92); /* size */
-    put_tag(pb, "tkhd");
-    put_byte(pb, version);
-    put_be24(pb, 0xf); /* flags (track enabled) */
-    if (version == 1) {
-        put_be64(pb, track->time);
-        put_be64(pb, track->time);
-    } else {
-        put_be32(pb, track->time); /* creation time */
-        put_be32(pb, track->time); /* modification time */
-    }
-    put_be32(pb, track->trackID); /* track-id */
-    put_be32(pb, 0); /* reserved */
-    (version == 1) ? put_be64(pb, duration) : put_be32(pb, duration);
-
-    put_be32(pb, 0); /* reserved */
-    put_be32(pb, 0); /* reserved */
-    put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */
-    /* Volume, only for audio */
-    if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
-        put_be16(pb, 0x0100);
-    else
-        put_be16(pb, 0);
-    put_be16(pb, 0); /* reserved */
-
-    /* Matrix structure */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x40000000); /* reserved */
-
-    /* Track width and height, for visual only */
-    if(st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
-              track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) {
-        double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
-        if(!sample_aspect_ratio || track->height != track->enc->height)
-            sample_aspect_ratio = 1;
-        put_be32(pb, sample_aspect_ratio * track->enc->width*0x10000);
-        put_be32(pb, track->height*0x10000);
-    }
-    else {
-        put_be32(pb, 0);
-        put_be32(pb, 0);
-    }
-    return 0x5c;
-}
-
-// This box seems important for the psp playback ... without it the movie seems to hang
-static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    put_be32(pb, 0x24); /* size  */
-    put_tag(pb, "edts");
-    put_be32(pb, 0x1c); /* size  */
-    put_tag(pb, "elst");
-    put_be32(pb, 0x0);
-    put_be32(pb, 0x1);
-
-    /* duration   ... doesn't seem to effect psp */
-    put_be32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE,
-                                track->timescale, AV_ROUND_UP));
-
-    put_be32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */
-    put_be32(pb, 0x00010000);
-    return 0x24;
-}
-
-static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track)
-{
-    put_be32(pb, 20);   // size
-    put_tag(pb, "tref");
-    put_be32(pb, 12);   // size (subatom)
-    put_le32(pb, track->tref_tag);
-    put_be32(pb, track->tref_id);
-    return 20;
-}
-
-// goes at the end of each track!  ... Critical for PSP playback ("Incompatible data" without it)
-static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov)
-{
-    put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */
-    put_tag(pb, "uuid");
-    put_tag(pb, "USMT");
-    put_be32(pb, 0x21d24fce);
-    put_be32(pb, 0xbb88695c);
-    put_be32(pb, 0xfac9c740);
-    put_be32(pb, 0x1c);     // another size here!
-    put_tag(pb, "MTDT");
-    put_be32(pb, 0x00010012);
-    put_be32(pb, 0x0a);
-    put_be32(pb, 0x55c40000);
-    put_be32(pb, 0x1);
-    put_be32(pb, 0x0);
-    return 0x34;
-}
-
-static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index)
-{
-    char buf[1000] = "";
-    int len;
-
-    ff_sdp_write_media(buf, sizeof(buf), ctx, NULL, 0, 0);
-    av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index);
-    len = strlen(buf);
-
-    put_be32(pb, len + 24);
-    put_tag (pb, "udta");
-    put_be32(pb, len + 16);
-    put_tag (pb, "hnti");
-    put_be32(pb, len + 8);
-    put_tag (pb, "sdp ");
-    put_buffer(pb, buf, len);
-    return len + 24;
-}
-
-static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "trak");
-    mov_write_tkhd_tag(pb, track, st);
-    if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS)
-        mov_write_edts_tag(pb, track);  // PSP Movies require edts box
-    if (track->tref_tag)
-        mov_write_tref_tag(pb, track);
-    mov_write_mdia_tag(pb, track);
-    if (track->mode == MODE_PSP)
-        mov_write_uuid_tag_psp(pb,track);  // PSP Movies require this uuid box
-    if (track->tag == MKTAG('r','t','p',' '))
-        mov_write_udta_sdp(pb, track->rtp_ctx->streams[0]->codec, track->trackID);
-    return updateSize(pb, pos);
-}
-
-#if 0
-/* TODO: Not sorted out, but not necessary either */
-static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov)
-{
-    put_be32(pb, 0x15); /* size */
-    put_tag(pb, "iods");
-    put_be32(pb, 0);    /* version & flags */
-    put_be16(pb, 0x1007);
-    put_byte(pb, 0);
-    put_be16(pb, 0x4fff);
-    put_be16(pb, 0xfffe);
-    put_be16(pb, 0x01ff);
-    return 0x15;
-}
-#endif
-
-static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov)
-{
-    int maxTrackID = 1, i;
-    int64_t maxTrackLenTemp, maxTrackLen = 0;
-    int version;
-
-    for (i=0; i<mov->nb_streams; i++) {
-        if(mov->tracks[i].entry > 0) {
-            maxTrackLenTemp = av_rescale_rnd(mov->tracks[i].trackDuration,
-                                             MOV_TIMESCALE,
-                                             mov->tracks[i].timescale,
-                                             AV_ROUND_UP);
-            if(maxTrackLen < maxTrackLenTemp)
-                maxTrackLen = maxTrackLenTemp;
-            if(maxTrackID < mov->tracks[i].trackID)
-                maxTrackID = mov->tracks[i].trackID;
-        }
-    }
-
-    version = maxTrackLen < UINT32_MAX ? 0 : 1;
-    (version == 1) ? put_be32(pb, 120) : put_be32(pb, 108); /* size */
-    put_tag(pb, "mvhd");
-    put_byte(pb, version);
-    put_be24(pb, 0); /* flags */
-    if (version == 1) {
-        put_be64(pb, mov->time);
-        put_be64(pb, mov->time);
-    } else {
-        put_be32(pb, mov->time); /* creation time */
-        put_be32(pb, mov->time); /* modification time */
-    }
-    put_be32(pb, MOV_TIMESCALE);
-    (version == 1) ? put_be64(pb, maxTrackLen) : put_be32(pb, maxTrackLen); /* duration of longest track */
-
-    put_be32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */
-    put_be16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */
-    put_be16(pb, 0); /* reserved */
-    put_be32(pb, 0); /* reserved */
-    put_be32(pb, 0); /* reserved */
-
-    /* Matrix structure */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x00010000); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x0); /* reserved */
-    put_be32(pb, 0x40000000); /* reserved */
-
-    put_be32(pb, 0); /* reserved (preview time) */
-    put_be32(pb, 0); /* reserved (preview duration) */
-    put_be32(pb, 0); /* reserved (poster time) */
-    put_be32(pb, 0); /* reserved (selection time) */
-    put_be32(pb, 0); /* reserved (selection duration) */
-    put_be32(pb, 0); /* reserved (current time) */
-    put_be32(pb, maxTrackID+1); /* Next track id */
-    return 0x6c;
-}
-
-static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov,
-                                     AVFormatContext *s)
-{
-    put_be32(pb, 33); /* size */
-    put_tag(pb, "hdlr");
-    put_be32(pb, 0);
-    put_be32(pb, 0);
-    put_tag(pb, "mdir");
-    put_tag(pb, "appl");
-    put_be32(pb, 0);
-    put_be32(pb, 0);
-    put_byte(pb, 0);
-    return 33;
-}
-
-/* helper function to write a data tag with the specified string as data */
-static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lang, int long_style)
-{
-    if(long_style){
-        int size = 16 + strlen(data);
-        put_be32(pb, size); /* size */
-        put_tag(pb, "data");
-        put_be32(pb, 1);
-        put_be32(pb, 0);
-        put_buffer(pb, data, strlen(data));
-        return size;
-    }else{
-        if (!lang)
-            lang = ff_mov_iso639_to_lang("und", 1);
-        put_be16(pb, strlen(data)); /* string length */
-        put_be16(pb, lang);
-        put_buffer(pb, data, strlen(data));
-        return strlen(data) + 4;
-    }
-}
-
-static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int lang, int long_style){
-    int size = 0;
-    if (value && value[0]) {
-        int64_t pos = url_ftell(pb);
-        put_be32(pb, 0); /* size */
-        put_tag(pb, name);
-        mov_write_string_data_tag(pb, value, lang, long_style);
-        size= updateSize(pb, pos);
-    }
-    return size;
-}
-
-static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb,
-                                     const char *name, const char *tag,
-                                     int long_style)
-{
-    int l, lang = 0, len, len2;
-    AVMetadataTag *t, *t2 = NULL;
-    char tag2[16];
-
-    if (!(t = av_metadata_get(s->metadata, tag, NULL, 0)))
-        return 0;
-
-    len = strlen(t->key);
-    snprintf(tag2, sizeof(tag2), "%s-", tag);
-    while ((t2 = av_metadata_get(s->metadata, tag2, t2, AV_METADATA_IGNORE_SUFFIX))) {
-        len2 = strlen(t2->key);
-        if (len2 == len+4 && !strcmp(t->value, t2->value)
-            && (l=ff_mov_iso639_to_lang(&t2->key[len2-3], 1)) >= 0) {
-            lang = l;
-            break;
-        }
-    }
-    return mov_write_string_tag(pb, name, t->value, lang, long_style);
-}
-
-/* iTunes track number */
-static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov,
-                              AVFormatContext *s)
-{
-    AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0);
-    int size = 0, track = t ? atoi(t->value) : 0;
-    if (track) {
-        put_be32(pb, 32); /* size */
-        put_tag(pb, "trkn");
-            put_be32(pb, 24); /* size */
-            put_tag(pb, "data");
-            put_be32(pb, 0);        // 8 bytes empty
-            put_be32(pb, 0);
-            put_be16(pb, 0);        // empty
-            put_be16(pb, track);    // track number
-            put_be16(pb, 0);        // total track number
-            put_be16(pb, 0);        // empty
-        size = 32;
-    }
-    return size;
-}
-
-/* iTunes meta data list */
-static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov,
-                              AVFormatContext *s)
-{
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "ilst");
-    mov_write_string_metadata(s, pb, "\251nam", "title"    , 1);
-    mov_write_string_metadata(s, pb, "\251ART", "artist"   , 1);
-    mov_write_string_metadata(s, pb, "aART", "album_artist", 1);
-    mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1);
-    mov_write_string_metadata(s, pb, "\251alb", "album"    , 1);
-    mov_write_string_metadata(s, pb, "\251day", "date"     , 1);
-    mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1);
-    mov_write_string_metadata(s, pb, "\251cmt", "comment"  , 1);
-    mov_write_string_metadata(s, pb, "\251gen", "genre"    , 1);
-    mov_write_string_metadata(s, pb, "\251cpy", "copyright", 1);
-    mov_write_string_metadata(s, pb, "\251grp", "grouping" , 1);
-    mov_write_string_metadata(s, pb, "\251lyr", "lyrics"   , 1);
-    mov_write_string_metadata(s, pb, "desc",    "description",1);
-    mov_write_string_metadata(s, pb, "ldes",    "synopsis" , 1);
-    mov_write_string_metadata(s, pb, "tvsh",    "show"     , 1);
-    mov_write_string_metadata(s, pb, "tven",    "episode_id",1);
-    mov_write_string_metadata(s, pb, "tvnn",    "network"  , 1);
-    mov_write_trkn_tag(pb, mov, s);
-    return updateSize(pb, pos);
-}
-
-/* iTunes meta data tag */
-static int mov_write_meta_tag(ByteIOContext *pb, MOVMuxContext *mov,
-                              AVFormatContext *s)
-{
-    int size = 0;
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "meta");
-    put_be32(pb, 0);
-    mov_write_itunes_hdlr_tag(pb, mov, s);
-    mov_write_ilst_tag(pb, mov, s);
-    size = updateSize(pb, pos);
-    return size;
-}
-
-static int utf8len(const uint8_t *b)
-{
-    int len=0;
-    int val;
-    while(*b){
-        GET_UTF8(val, *b++, return -1;)
-        len++;
-    }
-    return len;
-}
-
-static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b)
-{
-    int val;
-    while(*b){
-        GET_UTF8(val, *b++, return -1;)
-        put_be16(pb, val);
-    }
-    put_be16(pb, 0x00);
-    return 0;
-}
-
-static uint16_t language_code(const char *str)
-{
-    return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F);
-}
-
-static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s,
-                                  const char *tag, const char *str)
-{
-    int64_t pos = url_ftell(pb);
-    AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0);
-    if (!t || !utf8len(t->value))
-        return 0;
-    put_be32(pb, 0);   /* size */
-    put_tag (pb, tag); /* type */
-    put_be32(pb, 0);   /* version + flags */
-    if (!strcmp(tag, "yrrc"))
-        put_be16(pb, atoi(t->value));
-    else {
-        put_be16(pb, language_code("eng")); /* language */
-        put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */
-        if (!strcmp(tag, "albm") &&
-            (t = av_metadata_get(s->metadata, "date", NULL, 0)))
-            put_byte(pb, atoi(t->value));
-    }
-    return updateSize(pb, pos);
-}
-
-static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s)
-{
-    int64_t pos = url_ftell(pb);
-    int i, nb_chapters = FFMIN(s->nb_chapters, 255);
-
-    put_be32(pb, 0);            // size
-    put_tag (pb, "chpl");
-    put_be32(pb, 0x01000000);   // version + flags
-    put_be32(pb, 0);            // unknown
-    put_byte(pb, nb_chapters);
-
-    for (i = 0; i < nb_chapters; i++) {
-        AVChapter *c = s->chapters[i];
-        AVMetadataTag *t;
-        put_be64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000}));
-
-        if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) {
-            int len = FFMIN(strlen(t->value), 255);
-            put_byte(pb, len);
-            put_buffer(pb, t->value, len);
-        } else
-            put_byte(pb, 0);
-    }
-    return updateSize(pb, pos);
-}
-
-static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov,
-                              AVFormatContext *s)
-{
-    ByteIOContext *pb_buf;
-    int i, ret, size;
-    uint8_t *buf;
-
-    for (i = 0; i < s->nb_streams; i++)
-        if (mov->tracks[i].enc->flags & CODEC_FLAG_BITEXACT) {
-            return 0;
-        }
-
-    ret = url_open_dyn_buf(&pb_buf);
-    if(ret < 0)
-        return ret;
-
-        if (mov->mode & MODE_3GP) {
-            mov_write_3gp_udta_tag(pb_buf, s, "perf", "artist");
-            mov_write_3gp_udta_tag(pb_buf, s, "titl", "title");
-            mov_write_3gp_udta_tag(pb_buf, s, "auth", "author");
-            mov_write_3gp_udta_tag(pb_buf, s, "gnre", "genre");
-            mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment");
-            mov_write_3gp_udta_tag(pb_buf, s, "albm", "album");
-            mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright");
-            mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "date");
-        } else if (mov->mode == MODE_MOV) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4
-            mov_write_string_metadata(s, pb_buf, "\251nam", "title"      , 0);
-            mov_write_string_metadata(s, pb_buf, "\251aut", "author"     , 0);
-            mov_write_string_metadata(s, pb_buf, "\251alb", "album"      , 0);
-            mov_write_string_metadata(s, pb_buf, "\251day", "date"       , 0);
-            mov_write_string_tag(pb_buf, "\251enc", LIBAVFORMAT_IDENT, 0, 0);
-            mov_write_string_metadata(s, pb_buf, "\251des", "comment"    , 0);
-            mov_write_string_metadata(s, pb_buf, "\251gen", "genre"      , 0);
-            mov_write_string_metadata(s, pb_buf, "\251cpy", "copyright"  , 0);
-        } else {
-            /* iTunes meta data */
-            mov_write_meta_tag(pb_buf, mov, s);
-        }
-
-        if (s->nb_chapters)
-            mov_write_chpl_tag(pb_buf, s);
-
-    if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) {
-        put_be32(pb, size+8);
-        put_tag(pb, "udta");
-        put_buffer(pb, buf, size);
-        av_free(buf);
-    }
-
-    return 0;
-}
-
-static void mov_write_psp_udta_tag(ByteIOContext *pb,
-                                  const char *str, const char *lang, int type)
-{
-    int len = utf8len(str)+1;
-    if(len<=0)
-        return;
-    put_be16(pb, len*2+10);            /* size */
-    put_be32(pb, type);                /* type */
-    put_be16(pb, language_code(lang)); /* language */
-    put_be16(pb, 0x01);                /* ? */
-    ascii_to_wc(pb, str);
-}
-
-static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s)
-{
-    AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0);
-    int64_t pos, pos2;
-
-    if (title) {
-        pos = url_ftell(pb);
-        put_be32(pb, 0); /* size placeholder*/
-        put_tag(pb, "uuid");
-        put_tag(pb, "USMT");
-        put_be32(pb, 0x21d24fce); /* 96 bit UUID */
-        put_be32(pb, 0xbb88695c);
-        put_be32(pb, 0xfac9c740);
-
-        pos2 = url_ftell(pb);
-        put_be32(pb, 0); /* size placeholder*/
-        put_tag(pb, "MTDT");
-        put_be16(pb, 4);
-
-        // ?
-        put_be16(pb, 0x0C);                 /* size */
-        put_be32(pb, 0x0B);                 /* type */
-        put_be16(pb, language_code("und")); /* language */
-        put_be16(pb, 0x0);                  /* ? */
-        put_be16(pb, 0x021C);               /* data */
-
-        mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT,      "eng", 0x04);
-        mov_write_psp_udta_tag(pb, title->value,          "eng", 0x01);
-//        snprintf(dt,32,"%04d/%02d/%02d %02d:%02d:%02d",t_st->tm_year+1900,t_st->tm_mon+1,t_st->tm_mday,t_st->tm_hour,t_st->tm_min,t_st->tm_sec);
-        mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03);
-
-        updateSize(pb, pos2);
-        return updateSize(pb, pos);
-    }
-
-    return 0;
-}
-
-static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov,
-                              AVFormatContext *s)
-{
-    int i;
-    int64_t pos = url_ftell(pb);
-    put_be32(pb, 0); /* size placeholder*/
-    put_tag(pb, "moov");
-
-    for (i=0; i<mov->nb_streams; i++) {
-        if(mov->tracks[i].entry <= 0) continue;
-
-        mov->tracks[i].time = mov->time;
-        mov->tracks[i].trackID = i+1;
-    }
-
-    if (mov->chapter_track)
-        for (i=0; i<s->nb_streams; i++) {
-            mov->tracks[i].tref_tag = MKTAG('c','h','a','p');
-            mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].trackID;
-        }
-    for (i = 0; i < mov->nb_streams; i++) {
-        if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) {
-            mov->tracks[i].tref_tag = MKTAG('h','i','n','t');
-            mov->tracks[i].tref_id =
-                mov->tracks[mov->tracks[i].src_track].trackID;
-        }
-    }
-
-    mov_write_mvhd_tag(pb, mov);
-    //mov_write_iods_tag(pb, mov);
-    for (i=0; i<mov->nb_streams; i++) {
-        if(mov->tracks[i].entry > 0) {
-            mov_write_trak_tag(pb, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);
-        }
-    }
-
-    if (mov->mode == MODE_PSP)
-        mov_write_uuidusmt_tag(pb, s);
-    else
-        mov_write_udta_tag(pb, mov, s);
-
-    return updateSize(pb, pos);
-}
-
-static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov)
-{
-    put_be32(pb, 8);    // placeholder for extended size field (64 bit)
-    put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free");
-
-    mov->mdat_pos = url_ftell(pb);
-    put_be32(pb, 0); /* size placeholder*/
-    put_tag(pb, "mdat");
-    return 0;
-}
-
-/* TODO: This needs to be more general */
-static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s)
-{
-    MOVMuxContext *mov = s->priv_data;
-    int64_t pos = url_ftell(pb);
-    int has_h264 = 0, has_video = 0;
-    int minor = 0x200;
-    int i;
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-            has_video = 1;
-        if (st->codec->codec_id == CODEC_ID_H264)
-            has_h264 = 1;
-    }
-
-    put_be32(pb, 0); /* size */
-    put_tag(pb, "ftyp");
-
-    if (mov->mode == MODE_3GP) {
-        put_tag(pb, has_h264 ? "3gp6"  : "3gp4");
-        minor =     has_h264 ?   0x100 :   0x200;
-    } else if (mov->mode & MODE_3G2) {
-        put_tag(pb, has_h264 ? "3g2b"  : "3g2a");
-        minor =     has_h264 ? 0x20000 : 0x10000;
-    }else if (mov->mode == MODE_PSP)
-        put_tag(pb, "MSNV");
-    else if (mov->mode == MODE_MP4)
-        put_tag(pb, "isom");
-    else if (mov->mode == MODE_IPOD)
-        put_tag(pb, has_video ? "M4V ":"M4A ");
-    else
-        put_tag(pb, "qt  ");
-
-    put_be32(pb, minor);
-
-    if(mov->mode == MODE_MOV)
-        put_tag(pb, "qt  ");
-    else{
-        put_tag(pb, "isom");
-        put_tag(pb, "iso2");
-        if(has_h264)
-            put_tag(pb, "avc1");
-    }
-
-    if (mov->mode == MODE_3GP)
-        put_tag(pb, has_h264 ? "3gp6":"3gp4");
-    else if (mov->mode & MODE_3G2)
-        put_tag(pb, has_h264 ? "3g2b":"3g2a");
-    else if (mov->mode == MODE_PSP)
-        put_tag(pb, "MSNV");
-    else if (mov->mode == MODE_MP4)
-        put_tag(pb, "mp41");
-    return updateSize(pb, pos);
-}
-
-static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s)
-{
-    AVCodecContext *VideoCodec = s->streams[0]->codec;
-    AVCodecContext *AudioCodec = s->streams[1]->codec;
-    int AudioRate = AudioCodec->sample_rate;
-    int FrameRate = ((VideoCodec->time_base.den) * (0x10000))/ (VideoCodec->time_base.num);
-    int audio_kbitrate= AudioCodec->bit_rate / 1000;
-    int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate);
-
-    put_be32(pb, 0x94); /* size */
-    put_tag(pb, "uuid");
-    put_tag(pb, "PROF");
-
-    put_be32(pb, 0x21d24fce); /* 96 bit UUID */
-    put_be32(pb, 0xbb88695c);
-    put_be32(pb, 0xfac9c740);
-
-    put_be32(pb, 0x0);  /* ? */
-    put_be32(pb, 0x3);  /* 3 sections ? */
-
-    put_be32(pb, 0x14); /* size */
-    put_tag(pb, "FPRF");
-    put_be32(pb, 0x0);  /* ? */
-    put_be32(pb, 0x0);  /* ? */
-    put_be32(pb, 0x0);  /* ? */
-
-    put_be32(pb, 0x2c);  /* size */
-    put_tag(pb, "APRF");   /* audio */
-    put_be32(pb, 0x0);
-    put_be32(pb, 0x2);   /* TrackID */
-    put_tag(pb, "mp4a");
-    put_be32(pb, 0x20f);
-    put_be32(pb, 0x0);
-    put_be32(pb, audio_kbitrate);
-    put_be32(pb, audio_kbitrate);
-    put_be32(pb, AudioRate);
-    put_be32(pb, AudioCodec->channels);
-
-    put_be32(pb, 0x34);  /* size */
-    put_tag(pb, "VPRF");   /* video */
-    put_be32(pb, 0x0);
-    put_be32(pb, 0x1);    /* TrackID */
-    if (VideoCodec->codec_id == CODEC_ID_H264) {
-        put_tag(pb, "avc1");
-        put_be16(pb, 0x014D);
-        put_be16(pb, 0x0015);
-    } else {
-        put_tag(pb, "mp4v");
-        put_be16(pb, 0x0000);
-        put_be16(pb, 0x0103);
-    }
-    put_be32(pb, 0x0);
-    put_be32(pb, video_kbitrate);
-    put_be32(pb, video_kbitrate);
-    put_be32(pb, FrameRate);
-    put_be32(pb, FrameRate);
-    put_be16(pb, VideoCodec->width);
-    put_be16(pb, VideoCodec->height);
-    put_be32(pb, 0x010001); /* ? */
-}
-
-static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags)
-{
-    uint32_t c = -1;
-    int i, closed_gop = 0;
-
-    for (i = 0; i < pkt->size - 4; i++) {
-        c = (c<<8) + pkt->data[i];
-        if (c == 0x1b8) { // gop
-            closed_gop = pkt->data[i+4]>>6 & 0x01;
-        } else if (c == 0x100) { // pic
-            int temp_ref = (pkt->data[i+1]<<2) | (pkt->data[i+2]>>6);
-            if (!temp_ref || closed_gop) // I picture is not reordered
-                *flags = MOV_SYNC_SAMPLE;
-            else
-                *flags = MOV_PARTIAL_SYNC_SAMPLE;
-            break;
-        }
-    }
-    return 0;
-}
-
-int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MOVMuxContext *mov = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    MOVTrack *trk = &mov->tracks[pkt->stream_index];
-    AVCodecContext *enc = trk->enc;
-    unsigned int samplesInChunk = 0;
-    int size= pkt->size;
-
-    if (url_is_streamed(s->pb)) return 0; /* Can't handle that */
-    if (!size) return 0; /* Discard 0 sized packets */
-
-    if (enc->codec_id == CODEC_ID_AMR_NB) {
-        /* We must find out how many AMR blocks there are in one packet */
-        static uint16_t packed_size[16] =
-            {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0};
-        int len = 0;
-
-        while (len < size && samplesInChunk < 100) {
-            len += packed_size[(pkt->data[len] >> 3) & 0x0F];
-            samplesInChunk++;
-        }
-        if(samplesInChunk > 1){
-            av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n");
-            return -1;
-        }
-    } else if (trk->sampleSize)
-        samplesInChunk = size/trk->sampleSize;
-    else
-        samplesInChunk = 1;
-
-    /* copy extradata if it exists */
-    if (trk->vosLen == 0 && enc->extradata_size > 0) {
-        trk->vosLen = enc->extradata_size;
-        trk->vosData = av_malloc(trk->vosLen);
-        memcpy(trk->vosData, enc->extradata, trk->vosLen);
-    }
-
-    if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) {
-        /* from x264 or from bytestream h264 */
-        /* nal reformating needed */
-        size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size);
-    } else {
-        put_buffer(pb, pkt->data, size);
-    }
-
-    if ((enc->codec_id == CODEC_ID_DNXHD ||
-         enc->codec_id == CODEC_ID_AC3) && !trk->vosLen) {
-        /* copy frame to create needed atoms */
-        trk->vosLen = size;
-        trk->vosData = av_malloc(size);
-        if (!trk->vosData)
-            return AVERROR(ENOMEM);
-        memcpy(trk->vosData, pkt->data, size);
-    }
-
-    if (!(trk->entry % MOV_INDEX_CLUSTER_SIZE)) {
-        trk->cluster = av_realloc(trk->cluster, (trk->entry + MOV_INDEX_CLUSTER_SIZE) * sizeof(*trk->cluster));
-        if (!trk->cluster)
-            return -1;
-    }
-
-    trk->cluster[trk->entry].pos = url_ftell(pb) - size;
-    trk->cluster[trk->entry].samplesInChunk = samplesInChunk;
-    trk->cluster[trk->entry].size = size;
-    trk->cluster[trk->entry].entries = samplesInChunk;
-    trk->cluster[trk->entry].dts = pkt->dts;
-    trk->trackDuration = pkt->dts - trk->cluster[0].dts + pkt->duration;
-
-    if (pkt->pts == AV_NOPTS_VALUE) {
-        av_log(s, AV_LOG_WARNING, "pts has no value\n");
-        pkt->pts = pkt->dts;
-    }
-    if (pkt->dts != pkt->pts)
-        trk->flags |= MOV_TRACK_CTTS;
-    trk->cluster[trk->entry].cts = pkt->pts - pkt->dts;
-    trk->cluster[trk->entry].flags = 0;
-    if (pkt->flags & AV_PKT_FLAG_KEY) {
-        if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO) {
-            mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags);
-            if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE)
-                trk->flags |= MOV_TRACK_STPS;
-        } else {
-            trk->cluster[trk->entry].flags = MOV_SYNC_SAMPLE;
-        }
-        if (trk->cluster[trk->entry].flags & MOV_SYNC_SAMPLE)
-            trk->hasKeyframes++;
-    }
-    trk->entry++;
-    trk->sampleCount += samplesInChunk;
-    mov->mdat_size += size;
-
-    put_flush_packet(pb);
-
-    if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams)
-        ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry);
-    return 0;
-}
-
-// QuickTime chapters involve an additional text track with the chapter names
-// as samples, and a tref pointing from the other tracks to the chapter one.
-static void mov_create_chapter_track(AVFormatContext *s, int tracknum)
-{
-    MOVMuxContext *mov = s->priv_data;
-    MOVTrack *track = &mov->tracks[tracknum];
-    AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY };
-    int i, len;
-
-    track->mode = mov->mode;
-    track->tag = MKTAG('t','e','x','t');
-    track->timescale = MOV_TIMESCALE;
-    track->enc = avcodec_alloc_context();
-    track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
-
-    for (i = 0; i < s->nb_chapters; i++) {
-        AVChapter *c = s->chapters[i];
-        AVMetadataTag *t;
-
-        int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE});
-        pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE});
-        pkt.duration = end - pkt.dts;
-
-        if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) {
-            len = strlen(t->value);
-            pkt.size = len+2;
-            pkt.data = av_malloc(pkt.size);
-            AV_WB16(pkt.data, len);
-            memcpy(pkt.data+2, t->value, len);
-            ff_mov_write_packet(s, &pkt);
-            av_freep(&pkt.data);
-        }
-    }
-}
-
-static int mov_write_header(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    MOVMuxContext *mov = s->priv_data;
-    int i, hint_track = 0;
-
-    if (url_is_streamed(s->pb)) {
-        av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n");
-        return -1;
-    }
-
-    /* Default mode == MP4 */
-    mov->mode = MODE_MP4;
-
-    if (s->oformat != NULL) {
-        if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP;
-        else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2;
-        else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV;
-        else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
-        else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD;
-
-        mov_write_ftyp_tag(pb,s);
-        if (mov->mode == MODE_PSP) {
-            if (s->nb_streams != 2) {
-                av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n");
-                return -1;
-            }
-            mov_write_uuidprof_tag(pb,s);
-        }
-    }
-
-    mov->nb_streams = s->nb_streams;
-    if (mov->mode & (MODE_MOV|MODE_IPOD) && s->nb_chapters)
-        mov->chapter_track = mov->nb_streams++;
-
-    if (s->flags & AVFMT_FLAG_RTP_HINT) {
-        /* Add hint tracks for each audio and video stream */
-        hint_track = mov->nb_streams;
-        for (i = 0; i < s->nb_streams; i++) {
-            AVStream *st = s->streams[i];
-            if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
-                st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-                mov->nb_streams++;
-            }
-        }
-    }
-
-    mov->tracks = av_mallocz(mov->nb_streams*sizeof(*mov->tracks));
-    if (!mov->tracks)
-        return AVERROR(ENOMEM);
-
-    for(i=0; i<s->nb_streams; i++){
-        AVStream *st= s->streams[i];
-        MOVTrack *track= &mov->tracks[i];
-        AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0);
-
-        track->enc = st->codec;
-        track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV);
-        if (track->language < 0)
-            track->language = 0;
-        track->mode = mov->mode;
-        track->tag = mov_find_codec_tag(s, track);
-        if (!track->tag) {
-            av_log(s, AV_LOG_ERROR, "track %d: could not find tag, "
-                   "codec not currently supported in container\n", i);
-            goto error;
-        }
-        /* If hinting of this track is enabled by a later hint track,
-         * this is updated. */
-        track->hint_track = -1;
-        if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
-            if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') ||
-                track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') ||
-                track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) {
-                if (st->codec->width != 720 || (st->codec->height != 608 && st->codec->height != 512)) {
-                    av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 720x512 video resolution\n");
-                    goto error;
-                }
-                track->height = track->tag>>24 == 'n' ? 486 : 576;
-            }
-            track->timescale = st->codec->time_base.den;
-            if (track->mode == MODE_MOV && track->timescale > 100000)
-                av_log(s, AV_LOG_WARNING,
-                       "WARNING codec timebase is very high. If duration is too long,\n"
-                       "file may not be playable by quicktime. Specify a shorter timebase\n"
-                       "or choose different container.\n");
-        }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO){
-            track->timescale = st->codec->sample_rate;
-            if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) {
-                av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i);
-                goto error;
-            }else if(st->codec->frame_size > 1){ /* assume compressed audio */
-                track->audio_vbr = 1;
-            }else{
-                st->codec->frame_size = 1;
-                track->sampleSize = (av_get_bits_per_sample(st->codec->codec_id) >> 3) * st->codec->channels;
-            }
-            if (track->mode != MODE_MOV) {
-                if (track->timescale > UINT16_MAX) {
-                    av_log(s, AV_LOG_ERROR, "track %d: output format does not support "
-                           "sample rate %dhz\n", i, track->timescale);
-                    goto error;
-                }
-                if (track->enc->codec_id == CODEC_ID_MP3 && track->timescale < 16000) {
-                    av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n",
-                           i, track->enc->sample_rate);
-                    goto error;
-                }
-            }
-        }else if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE){
-            track->timescale = st->codec->time_base.den;
-        }
-        if (!track->height)
-            track->height = st->codec->height;
-
-        av_set_pts_info(st, 64, 1, track->timescale);
-    }
-
-    mov_write_mdat_tag(pb, mov);
-    mov->time = s->timestamp + 0x7C25B080; //1970 based -> 1904 based
-
-    if (mov->chapter_track)
-        mov_create_chapter_track(s, mov->chapter_track);
-
-    if (s->flags & AVFMT_FLAG_RTP_HINT) {
-        /* Initialize the hint tracks for each audio and video stream */
-        for (i = 0; i < s->nb_streams; i++) {
-            AVStream *st = s->streams[i];
-            if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
-                st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-                ff_mov_init_hinting(s, hint_track, i);
-                hint_track++;
-            }
-        }
-    }
-
-    put_flush_packet(pb);
-
-    return 0;
- error:
-    av_freep(&mov->tracks);
-    return -1;
-}
-
-static int mov_write_trailer(AVFormatContext *s)
-{
-    MOVMuxContext *mov = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int res = 0;
-    int i;
-
-    int64_t moov_pos = url_ftell(pb);
-
-    /* Write size of mdat tag */
-    if (mov->mdat_size+8 <= UINT32_MAX) {
-        url_fseek(pb, mov->mdat_pos, SEEK_SET);
-        put_be32(pb, mov->mdat_size+8);
-    } else {
-        /* overwrite 'wide' placeholder atom */
-        url_fseek(pb, mov->mdat_pos - 8, SEEK_SET);
-        put_be32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */
-        put_tag(pb, "mdat");
-        put_be64(pb, mov->mdat_size+16);
-    }
-    url_fseek(pb, moov_pos, SEEK_SET);
-
-    mov_write_moov_tag(pb, mov, s);
-
-    if (mov->chapter_track)
-        av_freep(&mov->tracks[mov->chapter_track].enc);
-
-    for (i=0; i<mov->nb_streams; i++) {
-        if (mov->tracks[i].tag == MKTAG('r','t','p',' '))
-            ff_mov_close_hinting(&mov->tracks[i]);
-        av_freep(&mov->tracks[i].cluster);
-
-        if(mov->tracks[i].vosLen) av_free(mov->tracks[i].vosData);
-
-    }
-
-    put_flush_packet(pb);
-
-    av_freep(&mov->tracks);
-
-    return res;
-}
-
-#if CONFIG_MOV_MUXER
-AVOutputFormat mov_muxer = {
-    "mov",
-    NULL_IF_CONFIG_SMALL("MOV format"),
-    NULL,
-    "mov",
-    sizeof(MOVMuxContext),
-    CODEC_ID_AAC,
-    CODEC_ID_MPEG4,
-    mov_write_header,
-    ff_mov_write_packet,
-    mov_write_trailer,
-    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
-    .codec_tag = (const AVCodecTag* const []){codec_movvideo_tags, codec_movaudio_tags, 0},
-};
-#endif
-#if CONFIG_TGP_MUXER
-AVOutputFormat tgp_muxer = {
-    "3gp",
-    NULL_IF_CONFIG_SMALL("3GP format"),
-    NULL,
-    "3gp",
-    sizeof(MOVMuxContext),
-    CODEC_ID_AMR_NB,
-    CODEC_ID_H263,
-    mov_write_header,
-    ff_mov_write_packet,
-    mov_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-    .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0},
-};
-#endif
-#if CONFIG_MP4_MUXER
-AVOutputFormat mp4_muxer = {
-    "mp4",
-    NULL_IF_CONFIG_SMALL("MP4 format"),
-    "application/mp4",
-    "mp4",
-    sizeof(MOVMuxContext),
-    CODEC_ID_AAC,
-    CODEC_ID_MPEG4,
-    mov_write_header,
-    ff_mov_write_packet,
-    mov_write_trailer,
-    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
-    .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0},
-};
-#endif
-#if CONFIG_PSP_MUXER
-AVOutputFormat psp_muxer = {
-    "psp",
-    NULL_IF_CONFIG_SMALL("PSP MP4 format"),
-    NULL,
-    "mp4,psp",
-    sizeof(MOVMuxContext),
-    CODEC_ID_AAC,
-    CODEC_ID_MPEG4,
-    mov_write_header,
-    ff_mov_write_packet,
-    mov_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-    .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0},
-};
-#endif
-#if CONFIG_TG2_MUXER
-AVOutputFormat tg2_muxer = {
-    "3g2",
-    NULL_IF_CONFIG_SMALL("3GP2 format"),
-    NULL,
-    "3g2",
-    sizeof(MOVMuxContext),
-    CODEC_ID_AMR_NB,
-    CODEC_ID_H263,
-    mov_write_header,
-    ff_mov_write_packet,
-    mov_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-    .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0},
-};
-#endif
-#if CONFIG_IPOD_MUXER
-AVOutputFormat ipod_muxer = {
-    "ipod",
-    NULL_IF_CONFIG_SMALL("iPod H.264 MP4 format"),
-    "application/mp4",
-    "m4v,m4a",
-    sizeof(MOVMuxContext),
-    CODEC_ID_AAC,
-    CODEC_ID_H264,
-    mov_write_header,
-    ff_mov_write_packet,
-    mov_write_trailer,
-    .flags = AVFMT_GLOBALHEADER,
-    .codec_tag = (const AVCodecTag* const []){codec_ipod_tags, 0},
-};
-#endif
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
deleted file mode 100644
index 182c5ed..0000000
--- a/libavformat/movenc.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * MOV, 3GP, MP4 muxer
- * Copyright (c) 2003 Thomas Raivio
- * Copyright (c) 2004 Gildas Bazin <gbazin at videolan dot org>
- * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_MOVENC_H
-#define AVFORMAT_MOVENC_H
-
-#include "avformat.h"
-
-#define MOV_INDEX_CLUSTER_SIZE 16384
-#define MOV_TIMESCALE 1000
-
-#define RTP_MAX_PACKET_SIZE 1450
-
-#define MODE_MP4  0x01
-#define MODE_MOV  0x02
-#define MODE_3GP  0x04
-#define MODE_PSP  0x08 // example working PSP command line:
-// ffmpeg -i testinput.avi  -f psp -r 14.985 -s 320x240 -b 768 -ar 24000 -ab 32 M4V00001.MP4
-#define MODE_3G2  0x10
-#define MODE_IPOD 0x20
-
-typedef struct MOVIentry {
-    unsigned int size;
-    uint64_t     pos;
-    unsigned int samplesInChunk;
-    unsigned int entries;
-    int          cts;
-    int64_t      dts;
-#define MOV_SYNC_SAMPLE         0x0001
-#define MOV_PARTIAL_SYNC_SAMPLE 0x0002
-    uint32_t     flags;
-} MOVIentry;
-
-typedef struct HintSample {
-    uint8_t *data;
-    int size;
-    int sample_number;
-    int offset;
-    int own_data;
-} HintSample;
-
-typedef struct {
-    int size;
-    int len;
-    HintSample *samples;
-} HintSampleQueue;
-
-typedef struct MOVIndex {
-    int         mode;
-    int         entry;
-    unsigned    timescale;
-    uint64_t    time;
-    int64_t     trackDuration;
-    long        sampleCount;
-    long        sampleSize;
-    int         hasKeyframes;
-#define MOV_TRACK_CTTS         0x0001
-#define MOV_TRACK_STPS         0x0002
-    uint32_t    flags;
-    int         language;
-    int         trackID;
-    int         tag; ///< stsd fourcc
-    AVCodecContext *enc;
-
-    int         vosLen;
-    uint8_t     *vosData;
-    MOVIentry   *cluster;
-    int         audio_vbr;
-    int         height; ///< active picture (w/o VBI) height for D-10/IMX
-    uint32_t    tref_tag;
-    int         tref_id; ///< trackID of the referenced track
-
-    int         hint_track;   ///< the track that hints this track, -1 if no hint track is set
-    int         src_track;    ///< the track that this hint track describes
-    AVFormatContext *rtp_ctx; ///< the format context for the hinting rtp muxer
-    uint32_t    prev_rtp_ts;
-    int64_t     cur_rtp_ts_unwrapped;
-    uint32_t    max_packet_size;
-
-    HintSampleQueue sample_queue;
-} MOVTrack;
-
-typedef struct MOVMuxContext {
-    int     mode;
-    int64_t time;
-    int     nb_streams;
-    int     chapter_track; ///< qt chapter track number
-    int64_t mdat_pos;
-    uint64_t mdat_size;
-    MOVTrack *tracks;
-} MOVMuxContext;
-
-int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);
-
-int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index);
-int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
-                             int track_index, int sample);
-void ff_mov_close_hinting(MOVTrack *track);
-
-#endif /* AVFORMAT_MOVENC_H */
diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c
deleted file mode 100644
index d90ac67..0000000
--- a/libavformat/movenchint.c
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * MOV, 3GP, MP4 muxer RTP hinting
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "movenc.h"
-#include "libavutil/intreadwrite.h"
-
-int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
-{
-    MOVMuxContext *mov  = s->priv_data;
-    MOVTrack *track     = &mov->tracks[index];
-    MOVTrack *src_track = &mov->tracks[src_index];
-    AVStream *src_st    = s->streams[src_index];
-    int ret = AVERROR(ENOMEM);
-    AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
-
-    track->tag = MKTAG('r','t','p',' ');
-    track->src_track = src_index;
-
-    if (!rtp_format) {
-        ret = AVERROR(ENOENT);
-        goto fail;
-    }
-
-    track->enc = avcodec_alloc_context();
-    if (!track->enc)
-        goto fail;
-    track->enc->codec_type = AVMEDIA_TYPE_DATA;
-    track->enc->codec_tag  = track->tag;
-
-    track->rtp_ctx = avformat_alloc_context();
-    if (!track->rtp_ctx)
-        goto fail;
-    track->rtp_ctx->oformat = rtp_format;
-    if (!av_new_stream(track->rtp_ctx, 0))
-        goto fail;
-
-    /* Copy stream parameters */
-    track->rtp_ctx->streams[0]->sample_aspect_ratio =
-                        src_st->sample_aspect_ratio;
-
-    /* Remove the allocated codec context, link to the original one
-     * instead, to give the rtp muxer access to codec parameters. */
-    av_free(track->rtp_ctx->streams[0]->codec);
-    track->rtp_ctx->streams[0]->codec = src_st->codec;
-
-    if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb,
-                                       RTP_MAX_PACKET_SIZE)) < 0)
-        goto fail;
-    ret = av_write_header(track->rtp_ctx);
-    if (ret)
-        goto fail;
-
-    /* Copy the RTP AVStream timebase back to the hint AVStream */
-    track->timescale = track->rtp_ctx->streams[0]->time_base.den;
-
-    /* Mark the hinted track that packets written to it should be
-     * sent to this track for hinting. */
-    src_track->hint_track = index;
-    return 0;
-fail:
-    av_log(s, AV_LOG_WARNING,
-           "Unable to initialize hinting of stream %d\n", src_index);
-    if (track->rtp_ctx && track->rtp_ctx->pb) {
-        uint8_t *buf;
-        url_close_dyn_buf(track->rtp_ctx->pb, &buf);
-        av_free(buf);
-    }
-    if (track->rtp_ctx && track->rtp_ctx->streams[0]) {
-        av_metadata_free(&track->rtp_ctx->streams[0]->metadata);
-        av_free(track->rtp_ctx->streams[0]);
-    }
-    if (track->rtp_ctx) {
-        av_metadata_free(&track->rtp_ctx->metadata);
-        av_free(track->rtp_ctx->priv_data);
-        av_freep(&track->rtp_ctx);
-    }
-    av_freep(&track->enc);
-    /* Set a default timescale, to avoid crashes in dump_format */
-    track->timescale = 90000;
-    return ret;
-}
-
-/**
- * Remove the first sample from the sample queue.
- */
-static void sample_queue_pop(HintSampleQueue *queue)
-{
-    if (queue->len <= 0)
-        return;
-    if (queue->samples[0].own_data)
-        av_free(queue->samples[0].data);
-    queue->len--;
-    memmove(queue->samples, queue->samples + 1, sizeof(HintSample)*queue->len);
-}
-
-/**
- * Empty the sample queue, releasing all memory.
- */
-static void sample_queue_free(HintSampleQueue *queue)
-{
-    int i;
-    for (i = 0; i < queue->len; i++)
-        if (queue->samples[i].own_data)
-            av_free(queue->samples[i].data);
-    av_freep(&queue->samples);
-    queue->len = 0;
-    queue->size = 0;
-}
-
-/**
- * Add a reference to the sample data to the sample queue. The data is
- * not copied. sample_queue_retain should be called before pkt->data
- * is reused/freed.
- */
-static void sample_queue_push(HintSampleQueue *queue, AVPacket *pkt, int sample)
-{
-    /* No need to keep track of smaller samples, since describing them
-     * with immediates is more efficient. */
-    if (pkt->size <= 14)
-        return;
-    if (!queue->samples || queue->len >= queue->size) {
-        HintSample* samples;
-        queue->size += 10;
-        samples = av_realloc(queue->samples, sizeof(HintSample)*queue->size);
-        if (!samples)
-            return;
-        queue->samples = samples;
-    }
-    queue->samples[queue->len].data = pkt->data;
-    queue->samples[queue->len].size = pkt->size;
-    queue->samples[queue->len].sample_number = sample;
-    queue->samples[queue->len].offset = 0;
-    queue->samples[queue->len].own_data = 0;
-    queue->len++;
-}
-
-/**
- * Make local copies of all referenced sample data in the queue.
- */
-static void sample_queue_retain(HintSampleQueue *queue)
-{
-    int i;
-    for (i = 0; i < queue->len; ) {
-        HintSample *sample = &queue->samples[i];
-        if (!sample->own_data) {
-            uint8_t* ptr = av_malloc(sample->size);
-            if (!ptr) {
-                /* Unable to allocate memory for this one, remove it */
-                memmove(queue->samples + i, queue->samples + i + 1,
-                        sizeof(HintSample)*(queue->len - i - 1));
-                queue->len--;
-                continue;
-            }
-            memcpy(ptr, sample->data, sample->size);
-            sample->data = ptr;
-            sample->own_data = 1;
-        }
-        i++;
-    }
-}
-
-/**
- * Find matches of needle[n_pos ->] within haystack. If a sufficiently
- * large match is found, matching bytes before n_pos are included
- * in the match, too (within the limits of the arrays).
- *
- * @param haystack buffer that may contain parts of needle
- * @param h_len length of the haystack buffer
- * @param needle buffer containing source data that have been used to
- *               construct haystack
- * @param n_pos start position in needle used for looking for matches
- * @param n_len length of the needle buffer
- * @param match_h_offset_ptr offset of the first matching byte within haystack
- * @param match_n_offset_ptr offset of the first matching byte within needle
- * @param match_len_ptr length of the matched segment
- * @return 0 if a match was found, < 0 if no match was found
- */
-static int match_segments(const uint8_t *haystack, int h_len,
-                          const uint8_t *needle, int n_pos, int n_len,
-                          int *match_h_offset_ptr, int *match_n_offset_ptr,
-                          int *match_len_ptr)
-{
-    int h_pos;
-    for (h_pos = 0; h_pos < h_len; h_pos++) {
-        int match_len = 0;
-        int match_h_pos, match_n_pos;
-
-        /* Check how many bytes match at needle[n_pos] and haystack[h_pos] */
-        while (h_pos + match_len < h_len && n_pos + match_len < n_len &&
-               needle[n_pos + match_len] == haystack[h_pos + match_len])
-            match_len++;
-        if (match_len <= 8)
-            continue;
-
-        /* If a sufficiently large match was found, try to expand
-         * the matched segment backwards. */
-        match_h_pos = h_pos;
-        match_n_pos = n_pos;
-        while (match_n_pos > 0 && match_h_pos > 0 &&
-               needle[match_n_pos - 1] == haystack[match_h_pos - 1]) {
-            match_n_pos--;
-            match_h_pos--;
-            match_len++;
-        }
-        if (match_len <= 14)
-            continue;
-        *match_h_offset_ptr = match_h_pos;
-        *match_n_offset_ptr = match_n_pos;
-        *match_len_ptr = match_len;
-        return 0;
-    }
-    return -1;
-}
-
-/**
- * Look for segments in samples in the sample queue matching the data
- * in ptr. Samples not matching are removed from the queue. If a match
- * is found, the next time it will look for matches starting from the
- * end of the previous matched segment.
- *
- * @param data data to find matches for in the sample queue
- * @param len length of the data buffer
- * @param queue samples used for looking for matching segments
- * @param pos the offset in data of the matched segment
- * @param match_sample the number of the sample that contained the match
- * @param match_offset the offset of the matched segment within the sample
- * @param match_len the length of the matched segment
- * @return 0 if a match was found, < 0 if no match was found
- */
-static int find_sample_match(const uint8_t *data, int len,
-                             HintSampleQueue *queue, int *pos,
-                             int *match_sample, int *match_offset,
-                             int *match_len)
-{
-    while (queue->len > 0) {
-        HintSample *sample = &queue->samples[0];
-        /* If looking for matches in a new sample, skip the first 5 bytes,
-         * since they often may be modified/removed in the output packet. */
-        if (sample->offset == 0 && sample->size > 5)
-            sample->offset = 5;
-
-        if (match_segments(data, len, sample->data, sample->offset,
-                           sample->size, pos, match_offset, match_len) == 0) {
-            *match_sample = sample->sample_number;
-            /* Next time, look for matches at this offset, with a little
-             * margin to this match. */
-            sample->offset = *match_offset + *match_len + 5;
-            if (sample->offset + 10 >= sample->size)
-                sample_queue_pop(queue); /* Not enough useful data left */
-            return 0;
-        }
-
-        if (sample->offset < 10 && sample->size > 20) {
-            /* No match found from the start of the sample,
-             * try from the middle of the sample instead. */
-            sample->offset = sample->size/2;
-        } else {
-            /* No match for this sample, remove it */
-            sample_queue_pop(queue);
-        }
-    }
-    return -1;
-}
-
-static void output_immediate(const uint8_t *data, int size,
-                             ByteIOContext *out, int *entries)
-{
-    while (size > 0) {
-        int len = size;
-        if (len > 14)
-            len = 14;
-        put_byte(out, 1); /* immediate constructor */
-        put_byte(out, len); /* amount of valid data */
-        put_buffer(out, data, len);
-        data += len;
-        size -= len;
-
-        for (; len < 14; len++)
-            put_byte(out, 0);
-
-        (*entries)++;
-    }
-}
-
-static void output_match(ByteIOContext *out, int match_sample,
-                         int match_offset, int match_len, int *entries)
-{
-    put_byte(out, 2); /* sample constructor */
-    put_byte(out, 0); /* track reference */
-    put_be16(out, match_len);
-    put_be32(out, match_sample);
-    put_be32(out, match_offset);
-    put_be16(out, 1); /* bytes per block */
-    put_be16(out, 1); /* samples per block */
-    (*entries)++;
-}
-
-static void describe_payload(const uint8_t *data, int size,
-                             ByteIOContext *out, int *entries,
-                             HintSampleQueue *queue)
-{
-    /* Describe the payload using different constructors */
-    while (size > 0) {
-        int match_sample, match_offset, match_len, pos;
-        if (find_sample_match(data, size, queue, &pos, &match_sample,
-                              &match_offset, &match_len) < 0)
-            break;
-        output_immediate(data, pos, out, entries);
-        data += pos;
-        size -= pos;
-        output_match(out, match_sample, match_offset, match_len, entries);
-        data += match_len;
-        size -= match_len;
-    }
-    output_immediate(data, size, out, entries);
-}
-
-/**
- * Write an RTP hint (that may contain one or more RTP packets)
- * for the packets in data. data contains one or more packets with a
- * BE32 size header.
- *
- * @param out buffer where the hints are written
- * @param data buffer containing RTP packets
- * @param size the size of the data buffer
- * @param trk the MOVTrack for the hint track
- * @param pts pointer where the timestamp for the written RTP hint is stored
- * @return the number of RTP packets in the written hint
- */
-static int write_hint_packets(ByteIOContext *out, const uint8_t *data,
-                              int size, MOVTrack *trk, int64_t *pts)
-{
-    int64_t curpos;
-    int64_t count_pos, entries_pos;
-    int count = 0, entries;
-
-    count_pos = url_ftell(out);
-    /* RTPsample header */
-    put_be16(out, 0); /* packet count */
-    put_be16(out, 0); /* reserved */
-
-    while (size > 4) {
-        uint32_t packet_len = AV_RB32(data);
-        uint16_t seq;
-        uint32_t ts;
-
-        data += 4;
-        size -= 4;
-        if (packet_len > size || packet_len <= 12)
-            break;
-        if (data[1] >= 200 && data[1] <= 204) {
-            /* RTCP packet, just skip */
-            data += packet_len;
-            size -= packet_len;
-            continue;
-        }
-
-        if (packet_len > trk->max_packet_size)
-            trk->max_packet_size = packet_len;
-
-        seq = AV_RB16(&data[2]);
-        ts = AV_RB32(&data[4]);
-
-        if (trk->prev_rtp_ts == 0)
-            trk->prev_rtp_ts = ts;
-        /* Unwrap the 32-bit RTP timestamp that wraps around often
-         * into a not (as often) wrapping 64-bit timestamp. */
-        trk->cur_rtp_ts_unwrapped += (int32_t) (ts - trk->prev_rtp_ts);
-        trk->prev_rtp_ts = ts;
-        if (*pts == AV_NOPTS_VALUE)
-            *pts = trk->cur_rtp_ts_unwrapped;
-
-        count++;
-        /* RTPpacket header */
-        put_be32(out, 0); /* relative_time */
-        put_buffer(out, data, 2); /* RTP header */
-        put_be16(out, seq); /* RTPsequenceseed */
-        put_be16(out, 0); /* reserved + flags */
-        entries_pos = url_ftell(out);
-        put_be16(out, 0); /* entry count */
-
-        data += 12;
-        size -= 12;
-        packet_len -= 12;
-
-        entries = 0;
-        /* Write one or more constructors describing the payload data */
-        describe_payload(data, packet_len, out, &entries, &trk->sample_queue);
-        data += packet_len;
-        size -= packet_len;
-
-        curpos = url_ftell(out);
-        url_fseek(out, entries_pos, SEEK_SET);
-        put_be16(out, entries);
-        url_fseek(out, curpos, SEEK_SET);
-    }
-
-    curpos = url_ftell(out);
-    url_fseek(out, count_pos, SEEK_SET);
-    put_be16(out, count);
-    url_fseek(out, curpos, SEEK_SET);
-    return count;
-}
-
-int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
-                             int track_index, int sample)
-{
-    MOVMuxContext *mov = s->priv_data;
-    MOVTrack *trk = &mov->tracks[track_index];
-    AVFormatContext *rtp_ctx = trk->rtp_ctx;
-    uint8_t *buf = NULL;
-    int size;
-    ByteIOContext *hintbuf = NULL;
-    AVPacket hint_pkt;
-    AVPacket local_pkt;
-    int ret = 0, count;
-
-    if (!rtp_ctx)
-        return AVERROR(ENOENT);
-    if (!rtp_ctx->pb)
-        return AVERROR(ENOMEM);
-
-    sample_queue_push(&trk->sample_queue, pkt, sample);
-
-    /* Feed the packet to the RTP muxer */
-    local_pkt = *pkt;
-    local_pkt.stream_index = 0;
-    local_pkt.pts = av_rescale_q(pkt->pts,
-        s->streams[pkt->stream_index]->time_base,
-        rtp_ctx->streams[0]->time_base);
-    local_pkt.dts = av_rescale_q(pkt->dts,
-        s->streams[pkt->stream_index]->time_base,
-        rtp_ctx->streams[0]->time_base);
-    av_write_frame(rtp_ctx, &local_pkt);
-
-    /* Fetch the output from the RTP muxer, open a new output buffer
-     * for next time. */
-    size = url_close_dyn_buf(rtp_ctx->pb, &buf);
-    if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb,
-                                       RTP_MAX_PACKET_SIZE)) < 0)
-        goto done;
-
-    if (size <= 0)
-        goto done;
-
-    /* Open a buffer for writing the hint */
-    if ((ret = url_open_dyn_buf(&hintbuf)) < 0)
-        goto done;
-    av_init_packet(&hint_pkt);
-    count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts);
-    av_freep(&buf);
-
-    /* Write the hint data into the hint track */
-    hint_pkt.size = size = url_close_dyn_buf(hintbuf, &buf);
-    hint_pkt.data = buf;
-    hint_pkt.pts  = hint_pkt.dts;
-    hint_pkt.stream_index = track_index;
-    if (pkt->flags & AV_PKT_FLAG_KEY)
-        hint_pkt.flags |= AV_PKT_FLAG_KEY;
-    if (count > 0)
-        ff_mov_write_packet(s, &hint_pkt);
-done:
-    av_free(buf);
-    sample_queue_retain(&trk->sample_queue);
-    return ret;
-}
-
-void ff_mov_close_hinting(MOVTrack *track) {
-    AVFormatContext* rtp_ctx = track->rtp_ctx;
-    uint8_t *ptr;
-
-    av_freep(&track->enc);
-    sample_queue_free(&track->sample_queue);
-    if (!rtp_ctx)
-        return;
-    if (rtp_ctx->pb) {
-        av_write_trailer(rtp_ctx);
-        url_close_dyn_buf(rtp_ctx->pb, &ptr);
-        av_free(ptr);
-    }
-    av_metadata_free(&rtp_ctx->streams[0]->metadata);
-    av_metadata_free(&rtp_ctx->metadata);
-    av_free(rtp_ctx->streams[0]);
-    av_freep(&rtp_ctx);
-}
-
diff --git a/libavformat/mp3.c b/libavformat/mp3.c
deleted file mode 100644
index dcb59e8..0000000
--- a/libavformat/mp3.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * MP3 muxer and demuxer
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <strings.h>
-#include "libavutil/avstring.h"
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "id3v2.h"
-#include "id3v1.h"
-
-#if CONFIG_MP3_DEMUXER
-
-#include "libavcodec/mpegaudio.h"
-#include "libavcodec/mpegaudiodecheader.h"
-
-/* mp3 read */
-
-static int mp3_read_probe(AVProbeData *p)
-{
-    int max_frames, first_frames = 0;
-    int fsize, frames, sample_rate;
-    uint32_t header;
-    uint8_t *buf, *buf0, *buf2, *end;
-    AVCodecContext avctx;
-
-    buf0 = p->buf;
-    if(ff_id3v2_match(buf0)) {
-        buf0 += ff_id3v2_tag_len(buf0);
-    }
-    end = p->buf + p->buf_size - sizeof(uint32_t);
-    while(buf0 < end && !*buf0)
-        buf0++;
-
-    max_frames = 0;
-    buf = buf0;
-
-    for(; buf < end; buf= buf2+1) {
-        buf2 = buf;
-
-        for(frames = 0; buf2 < end; frames++) {
-            header = AV_RB32(buf2);
-            fsize = ff_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate);
-            if(fsize < 0)
-                break;
-            buf2 += fsize;
-        }
-        max_frames = FFMAX(max_frames, frames);
-        if(buf == buf0)
-            first_frames= frames;
-    }
-    // keep this in sync with ac3 probe, both need to avoid
-    // issues with MPEG-files!
-    if   (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
-    else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
-    else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
-    else if(buf0!=p->buf)  return AVPROBE_SCORE_MAX/4-1;
-    else if(max_frames>=1) return 1;
-    else                   return 0;
-//mpegps_mp3_unrecognized_format.mpg has max_frames=3
-}
-
-/**
- * Try to find Xing/Info/VBRI tags and compute duration from info therein
- */
-static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
-{
-    uint32_t v, spf;
-    int frames = -1; /* Total number of frames in file */
-    const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
-    MPADecodeHeader c;
-    int vbrtag_size = 0;
-
-    v = get_be32(s->pb);
-    if(ff_mpa_check_header(v) < 0)
-      return -1;
-
-    if (ff_mpegaudio_decode_header(&c, v) == 0)
-        vbrtag_size = c.frame_size;
-    if(c.layer != 3)
-        return -1;
-
-    /* Check for Xing / Info tag */
-    url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
-    v = get_be32(s->pb);
-    if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
-        v = get_be32(s->pb);
-        if(v & 0x1)
-            frames = get_be32(s->pb);
-    }
-
-    /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
-    url_fseek(s->pb, base + 4 + 32, SEEK_SET);
-    v = get_be32(s->pb);
-    if(v == MKBETAG('V', 'B', 'R', 'I')) {
-        /* Check tag version */
-        if(get_be16(s->pb) == 1) {
-            /* skip delay, quality and total bytes */
-            url_fseek(s->pb, 8, SEEK_CUR);
-            frames = get_be32(s->pb);
-        }
-    }
-
-    if(frames < 0)
-        return -1;
-
-    /* Skip the vbr tag frame */
-    url_fseek(s->pb, base + vbrtag_size, SEEK_SET);
-
-    spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
-    st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate},
-                                st->time_base);
-    return 0;
-}
-
-static int mp3_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    AVStream *st;
-    int64_t off;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_MP3;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-    st->start_time = 0;
-
-    // lcm of all mp3 sample rates
-    av_set_pts_info(st, 64, 1, 14112000);
-
-    ff_id3v2_read(s);
-    off = url_ftell(s->pb);
-
-    if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
-        ff_id3v1_read(s);
-
-    if (mp3_parse_vbr_tags(s, st, off) < 0)
-        url_fseek(s->pb, off, SEEK_SET);
-
-    /* the parameters will be extracted from the compressed bitstream */
-    return 0;
-}
-
-#define MP3_PACKET_SIZE 1024
-
-static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, size;
-    //    AVStream *st = s->streams[0];
-
-    size= MP3_PACKET_SIZE;
-
-    ret= av_get_packet(s->pb, pkt, size);
-
-    pkt->stream_index = 0;
-    if (ret <= 0) {
-        return AVERROR(EIO);
-    }
-    /* note: we need to modify the packet size here to handle the last
-       packet */
-    pkt->size = ret;
-    return ret;
-}
-
-AVInputFormat mp3_demuxer = {
-    "mp3",
-    NULL_IF_CONFIG_SMALL("MPEG audio layer 2/3"),
-    0,
-    mp3_read_probe,
-    mp3_read_header,
-    mp3_read_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "mp2,mp3,m2a", /* XXX: use probe */
-    .metadata_conv = ff_id3v2_metadata_conv,
-};
-#endif
-
-#if CONFIG_MP2_MUXER || CONFIG_MP3_MUXER
-static int id3v1_set_string(AVFormatContext *s, const char *key,
-                            uint8_t *buf, int buf_size)
-{
-    AVMetadataTag *tag;
-    if ((tag = av_metadata_get(s->metadata, key, NULL, 0)))
-        strncpy(buf, tag->value, buf_size);
-    return !!tag;
-}
-
-static int id3v1_create_tag(AVFormatContext *s, uint8_t *buf)
-{
-    AVMetadataTag *tag;
-    int i, count = 0;
-
-    memset(buf, 0, ID3v1_TAG_SIZE); /* fail safe */
-    buf[0] = 'T';
-    buf[1] = 'A';
-    buf[2] = 'G';
-    count += id3v1_set_string(s, "title",   buf +  3, 30);
-    count += id3v1_set_string(s, "author",  buf + 33, 30);
-    count += id3v1_set_string(s, "album",   buf + 63, 30);
-    count += id3v1_set_string(s, "date",    buf + 93,  4);
-    count += id3v1_set_string(s, "comment", buf + 97, 30);
-    if ((tag = av_metadata_get(s->metadata, "track", NULL, 0))) {
-        buf[125] = 0;
-        buf[126] = atoi(tag->value);
-        count++;
-    }
-    buf[127] = 0xFF; /* default to unknown genre */
-    if ((tag = av_metadata_get(s->metadata, "genre", NULL, 0))) {
-        for(i = 0; i <= ID3v1_GENRE_MAX; i++) {
-            if (!strcasecmp(tag->value, ff_id3v1_genre_str[i])) {
-                buf[127] = i;
-                count++;
-                break;
-            }
-        }
-    }
-    return count;
-}
-
-/* simple formats */
-
-static void id3v2_put_size(AVFormatContext *s, int size)
-{
-    put_byte(s->pb, size >> 21 & 0x7f);
-    put_byte(s->pb, size >> 14 & 0x7f);
-    put_byte(s->pb, size >> 7  & 0x7f);
-    put_byte(s->pb, size       & 0x7f);
-}
-
-static void id3v2_put_ttag(AVFormatContext *s, const char *buf, int len,
-                           uint32_t tag)
-{
-    put_be32(s->pb, tag);
-    id3v2_put_size(s, len + 1);
-    put_be16(s->pb, 0);
-    put_byte(s->pb, 3); /* UTF-8 */
-    put_buffer(s->pb, buf, len);
-}
-
-
-static int mp3_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int mp3_write_trailer(struct AVFormatContext *s)
-{
-    uint8_t buf[ID3v1_TAG_SIZE];
-
-    /* write the id3v1 tag */
-    if (id3v1_create_tag(s, buf) > 0) {
-        put_buffer(s->pb, buf, ID3v1_TAG_SIZE);
-        put_flush_packet(s->pb);
-    }
-    return 0;
-}
-#endif /* CONFIG_MP2_MUXER || CONFIG_MP3_MUXER */
-
-#if CONFIG_MP2_MUXER
-AVOutputFormat mp2_muxer = {
-    "mp2",
-    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
-    "audio/x-mpeg",
-    "mp2,m2a",
-    0,
-    CODEC_ID_MP2,
-    CODEC_ID_NONE,
-    NULL,
-    mp3_write_packet,
-    mp3_write_trailer,
-};
-#endif
-
-#if CONFIG_MP3_MUXER
-/**
- * Write an ID3v2.4 header at beginning of stream
- */
-
-static int mp3_write_header(struct AVFormatContext *s)
-{
-    AVMetadataTag *t = NULL;
-    int totlen = 0;
-    int64_t size_pos, cur_pos;
-
-    put_be32(s->pb, MKBETAG('I', 'D', '3', 0x04)); /* ID3v2.4 */
-    put_byte(s->pb, 0);
-    put_byte(s->pb, 0); /* flags */
-
-    /* reserve space for size */
-    size_pos = url_ftell(s->pb);
-    put_be32(s->pb, 0);
-
-    while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
-        uint32_t tag = 0;
-
-        if (t->key[0] == 'T' && strlen(t->key) == 4) {
-            int i;
-            for (i = 0; *ff_id3v2_tags[i]; i++)
-                if (AV_RB32(t->key) == AV_RB32(ff_id3v2_tags[i])) {
-                    int len = strlen(t->value);
-                    tag = AV_RB32(t->key);
-                    totlen += len + ID3v2_HEADER_SIZE + 2;
-                    id3v2_put_ttag(s, t->value, len + 1, tag);
-                    break;
-                }
-        }
-
-        if (!tag) { /* unknown tag, write as TXXX frame */
-            int   len = strlen(t->key), len1 = strlen(t->value);
-            char *buf = av_malloc(len + len1 + 2);
-            if (!buf)
-                return AVERROR(ENOMEM);
-            tag = MKBETAG('T', 'X', 'X', 'X');
-            strcpy(buf,           t->key);
-            strcpy(buf + len + 1, t->value);
-            id3v2_put_ttag(s, buf, len + len1 + 2, tag);
-            totlen += len + len1 + ID3v2_HEADER_SIZE + 3;
-            av_free(buf);
-        }
-    }
-
-    cur_pos = url_ftell(s->pb);
-    url_fseek(s->pb, size_pos, SEEK_SET);
-    id3v2_put_size(s, totlen);
-    url_fseek(s->pb, cur_pos, SEEK_SET);
-
-    return 0;
-}
-
-AVOutputFormat mp3_muxer = {
-    "mp3",
-    NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),
-    "audio/x-mpeg",
-    "mp3",
-    0,
-    CODEC_ID_MP3,
-    CODEC_ID_NONE,
-    mp3_write_header,
-    mp3_write_packet,
-    mp3_write_trailer,
-    AVFMT_NOTIMESTAMPS,
-    .metadata_conv = ff_id3v2_metadata_conv,
-};
-#endif
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
deleted file mode 100644
index 4dda65d..0000000
--- a/libavformat/mpc.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Musepack demuxer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/get_bits.h"
-#include "avformat.h"
-#include "id3v2.h"
-#include "apetag.h"
-
-#define MPC_FRAMESIZE  1152
-#define DELAY_FRAMES   32
-
-static const int mpc_rate[4] = { 44100, 48000, 37800, 32000 };
-typedef struct {
-    int64_t pos;
-    int size, skip;
-}MPCFrame;
-
-typedef struct {
-    int ver;
-    uint32_t curframe, lastframe;
-    uint32_t fcount;
-    MPCFrame *frames;
-    int curbits;
-    int frames_noted;
-} MPCContext;
-
-static int mpc_probe(AVProbeData *p)
-{
-    const uint8_t *d = p->buf;
-    if (ff_id3v2_match(d)) {
-        d += ff_id3v2_tag_len(d);
-    }
-    if (d+3 < p->buf+p->buf_size)
-    if (d[0] == 'M' && d[1] == 'P' && d[2] == '+' && (d[3] == 0x17 || d[3] == 0x7))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    MPCContext *c = s->priv_data;
-    AVStream *st;
-    int t, ret;
-    int64_t pos = url_ftell(s->pb);
-
-    t = get_le24(s->pb);
-    if(t != MKTAG('M', 'P', '+', 0)){
-        uint8_t buf[ID3v2_HEADER_SIZE];
-        if (url_fseek(s->pb, pos, SEEK_SET) < 0)
-            return -1;
-        ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
-        if (ret != ID3v2_HEADER_SIZE || !ff_id3v2_match(buf)) {
-            av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
-            return -1;
-        }
-        /* skip ID3 tags and try again */
-        t = ff_id3v2_tag_len(buf) - ID3v2_HEADER_SIZE;
-        av_log(s, AV_LOG_DEBUG, "Skipping %d(%X) bytes of ID3 data\n", t, t);
-        url_fskip(s->pb, t);
-        if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
-            av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
-            return -1;
-        }
-        /* read ID3 tags */
-        if (url_fseek(s->pb, pos, SEEK_SET) < 0)
-            return -1;
-        ff_id3v2_read(s);
-        get_le24(s->pb);
-    }
-    c->ver = get_byte(s->pb);
-    if(c->ver != 0x07 && c->ver != 0x17){
-        av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver);
-        return -1;
-    }
-    c->fcount = get_le32(s->pb);
-    if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){
-        av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n");
-        return -1;
-    }
-    c->frames = av_malloc(c->fcount * sizeof(MPCFrame));
-    c->curframe = 0;
-    c->lastframe = -1;
-    c->curbits = 8;
-    c->frames_noted = 0;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_MUSEPACK7;
-    st->codec->channels = 2;
-    st->codec->bits_per_coded_sample = 16;
-
-    st->codec->extradata_size = 16;
-    st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
-    get_buffer(s->pb, st->codec->extradata, 16);
-    st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
-    av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
-    /* scan for seekpoints */
-    st->start_time = 0;
-    st->duration = c->fcount;
-
-    /* try to read APE tags */
-    if (!url_is_streamed(s->pb)) {
-        int64_t pos = url_ftell(s->pb);
-        ff_ape_parse_tag(s);
-        url_fseek(s->pb, pos, SEEK_SET);
-    }
-
-    return 0;
-}
-
-static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MPCContext *c = s->priv_data;
-    int ret, size, size2, curbits, cur = c->curframe;
-    int64_t tmp, pos;
-
-    if (c->curframe >= c->fcount)
-        return -1;
-
-    if(c->curframe != c->lastframe + 1){
-        url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
-        c->curbits = c->frames[c->curframe].skip;
-    }
-    c->lastframe = c->curframe;
-    c->curframe++;
-    curbits = c->curbits;
-    pos = url_ftell(s->pb);
-    tmp = get_le32(s->pb);
-    if(curbits <= 12){
-        size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
-    }else{
-        tmp = (tmp << 32) | get_le32(s->pb);
-        size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
-    }
-    curbits += 20;
-    url_fseek(s->pb, pos, SEEK_SET);
-
-    size = ((size2 + curbits + 31) & ~31) >> 3;
-    if(cur == c->frames_noted){
-        c->frames[cur].pos = pos;
-        c->frames[cur].size = size;
-        c->frames[cur].skip = curbits - 20;
-        av_add_index_entry(s->streams[0], cur, cur, size, 0, AVINDEX_KEYFRAME);
-        c->frames_noted++;
-    }
-    c->curbits = (curbits + size2) & 0x1F;
-
-    if (av_new_packet(pkt, size) < 0)
-        return AVERROR(EIO);
-
-    pkt->data[0] = curbits;
-    pkt->data[1] = (c->curframe > c->fcount);
-    pkt->data[2] = 0;
-    pkt->data[3] = 0;
-
-    pkt->stream_index = 0;
-    pkt->pts = cur;
-    ret = get_buffer(s->pb, pkt->data + 4, size);
-    if(c->curbits)
-        url_fseek(s->pb, -4, SEEK_CUR);
-    if(ret < size){
-        av_free_packet(pkt);
-        return AVERROR(EIO);
-    }
-    pkt->size = ret + 4;
-
-    return 0;
-}
-
-static int mpc_read_close(AVFormatContext *s)
-{
-    MPCContext *c = s->priv_data;
-
-    av_freep(&c->frames);
-    return 0;
-}
-
-/**
- * Seek to the given position
- * If position is unknown but is within the limits of file
- * then packets are skipped unless desired position is reached
- *
- * Also this function makes use of the fact that timestamp == frameno
- */
-static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st = s->streams[stream_index];
-    MPCContext *c = s->priv_data;
-    AVPacket pkt1, *pkt = &pkt1;
-    int ret;
-    int index = av_index_search_timestamp(st, timestamp - DELAY_FRAMES, flags);
-    uint32_t lastframe;
-
-    /* if found, seek there */
-    if (index >= 0){
-        c->curframe = st->index_entries[index].pos;
-        return 0;
-    }
-    /* if timestamp is out of bounds, return error */
-    if(timestamp < 0 || timestamp >= c->fcount)
-        return -1;
-    timestamp -= DELAY_FRAMES;
-    /* seek to the furthest known position and read packets until
-       we reach desired position */
-    lastframe = c->curframe;
-    if(c->frames_noted) c->curframe = c->frames_noted - 1;
-    while(c->curframe < timestamp){
-        ret = av_read_frame(s, pkt);
-        if (ret < 0){
-            c->curframe = lastframe;
-            return -1;
-        }
-        av_free_packet(pkt);
-    }
-    return 0;
-}
-
-
-AVInputFormat mpc_demuxer = {
-    "mpc",
-    NULL_IF_CONFIG_SMALL("Musepack"),
-    sizeof(MPCContext),
-    mpc_probe,
-    mpc_read_header,
-    mpc_read_packet,
-    mpc_read_close,
-    mpc_read_seek,
-    .extensions = "mpc",
-};
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
deleted file mode 100644
index 92e996c..0000000
--- a/libavformat/mpc8.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Musepack SV8 demuxer
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/get_bits.h"
-#include "libavcodec/unary.h"
-#include "avformat.h"
-
-/// Two-byte MPC tag
-#define MKMPCTAG(a, b) (a | (b << 8))
-
-#define TAG_MPCK MKTAG('M','P','C','K')
-
-/// Reserved MPC tags
-enum MPCPacketTags{
-    TAG_STREAMHDR   = MKMPCTAG('S','H'),
-    TAG_STREAMEND   = MKMPCTAG('S','E'),
-
-    TAG_AUDIOPACKET = MKMPCTAG('A','P'),
-
-    TAG_SEEKTBLOFF  = MKMPCTAG('S','O'),
-    TAG_SEEKTABLE   = MKMPCTAG('S','T'),
-
-    TAG_REPLAYGAIN  = MKMPCTAG('R','G'),
-    TAG_ENCINFO     = MKMPCTAG('E','I'),
-};
-
-static const int mpc8_rate[8] = { 44100, 48000, 37800, 32000, -1, -1, -1, -1 };
-
-typedef struct {
-    int ver;
-    int frame;
-    int64_t header_pos;
-    int64_t samples;
-} MPCContext;
-
-static inline int64_t bs_get_v(uint8_t **bs)
-{
-    int64_t v = 0;
-    int br = 0;
-    int c;
-
-    do {
-        c = **bs; (*bs)++;
-        v <<= 7;
-        v |= c & 0x7F;
-        br++;
-        if (br > 10)
-            return -1;
-    } while (c & 0x80);
-
-    return v - br;
-}
-
-static int mpc8_probe(AVProbeData *p)
-{
-    uint8_t *bs = p->buf + 4;
-    uint8_t *bs_end = bs + p->buf_size;
-    int64_t size;
-
-    if (p->buf_size < 16)
-        return 0;
-    if (AV_RL32(p->buf) != TAG_MPCK)
-        return 0;
-    while (bs < bs_end + 3) {
-        int header_found = (bs[0] == 'S' && bs[1] == 'H');
-        if (bs[0] < 'A' || bs[0] > 'Z' || bs[1] < 'A' || bs[1] > 'Z')
-            return 0;
-        bs += 2;
-        size = bs_get_v(&bs);
-        if (size < 2)
-            return 0;
-        if (bs + size - 2 >= bs_end)
-            return AVPROBE_SCORE_MAX / 4 - 1; //seems to be valid MPC but no header yet
-        if (header_found) {
-            if (size < 11 || size > 28)
-                return 0;
-            if (!AV_RL32(bs)) //zero CRC is invalid
-                return 0;
-            return AVPROBE_SCORE_MAX;
-        } else {
-            bs += size - 2;
-        }
-    }
-    return 0;
-}
-
-static inline int64_t gb_get_v(GetBitContext *gb)
-{
-    int64_t v = 0;
-    int bits = 0;
-    while(get_bits1(gb) && bits < 64-7){
-        v <<= 7;
-        v |= get_bits(gb, 7);
-        bits += 7;
-    }
-    v <<= 7;
-    v |= get_bits(gb, 7);
-
-    return v;
-}
-
-static void mpc8_get_chunk_header(ByteIOContext *pb, int *tag, int64_t *size)
-{
-    int64_t pos;
-    pos = url_ftell(pb);
-    *tag = get_le16(pb);
-    *size = ff_get_v(pb);
-    *size -= url_ftell(pb) - pos;
-}
-
-static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
-{
-    MPCContext *c = s->priv_data;
-    int tag;
-    int64_t size, pos, ppos[2];
-    uint8_t *buf;
-    int i, t, seekd;
-    GetBitContext gb;
-
-    url_fseek(s->pb, off, SEEK_SET);
-    mpc8_get_chunk_header(s->pb, &tag, &size);
-    if(tag != TAG_SEEKTABLE){
-        av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
-        return;
-    }
-    if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
-        return;
-    get_buffer(s->pb, buf, size);
-    init_get_bits(&gb, buf, size * 8);
-    size = gb_get_v(&gb);
-    if(size > UINT_MAX/4 || size > c->samples/1152){
-        av_log(s, AV_LOG_ERROR, "Seek table is too big\n");
-        return;
-    }
-    seekd = get_bits(&gb, 4);
-    for(i = 0; i < 2; i++){
-        pos = gb_get_v(&gb) + c->header_pos;
-        ppos[1 - i] = pos;
-        av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME);
-    }
-    for(; i < size; i++){
-        t = get_unary(&gb, 1, 33) << 12;
-        t += get_bits(&gb, 12);
-        if(t & 1)
-            t = -(t & ~1);
-        pos = (t >> 1) + ppos[0]*2 - ppos[1];
-        av_add_index_entry(s->streams[0], pos, i << seekd, 0, 0, AVINDEX_KEYFRAME);
-        ppos[1] = ppos[0];
-        ppos[0] = pos;
-    }
-    av_free(buf);
-}
-
-static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, int64_t size)
-{
-    ByteIOContext *pb = s->pb;
-    int64_t pos, off;
-
-    switch(tag){
-    case TAG_SEEKTBLOFF:
-        pos = url_ftell(pb) + size;
-        off = ff_get_v(pb);
-        mpc8_parse_seektable(s, chunk_pos + off);
-        url_fseek(pb, pos, SEEK_SET);
-        break;
-    default:
-        url_fskip(pb, size);
-    }
-}
-
-static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    MPCContext *c = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    int tag = 0;
-    int64_t size, pos;
-
-    c->header_pos = url_ftell(pb);
-    if(get_le32(pb) != TAG_MPCK){
-        av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
-        return -1;
-    }
-
-    while(!url_feof(pb)){
-        pos = url_ftell(pb);
-        mpc8_get_chunk_header(pb, &tag, &size);
-        if(tag == TAG_STREAMHDR)
-            break;
-        mpc8_handle_chunk(s, tag, pos, size);
-    }
-    if(tag != TAG_STREAMHDR){
-        av_log(s, AV_LOG_ERROR, "Stream header not found\n");
-        return -1;
-    }
-    pos = url_ftell(pb);
-    url_fskip(pb, 4); //CRC
-    c->ver = get_byte(pb);
-    if(c->ver != 8){
-        av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
-        return -1;
-    }
-    c->samples = ff_get_v(pb);
-    ff_get_v(pb); //silence samples at the beginning
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_MUSEPACK8;
-    st->codec->bits_per_coded_sample = 16;
-
-    st->codec->extradata_size = 2;
-    st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-    get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
-
-    st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
-    st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
-    av_set_pts_info(st, 32, 1152  << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
-    st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
-    size -= url_ftell(pb) - pos;
-
-    return 0;
-}
-
-static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MPCContext *c = s->priv_data;
-    int tag;
-    int64_t pos, size;
-
-    while(!url_feof(s->pb)){
-        pos = url_ftell(s->pb);
-        mpc8_get_chunk_header(s->pb, &tag, &size);
-        if (size < 0)
-            return -1;
-        if(tag == TAG_AUDIOPACKET){
-            if(av_get_packet(s->pb, pkt, size) < 0)
-                return AVERROR(ENOMEM);
-            pkt->stream_index = 0;
-            pkt->pts = c->frame;
-            return 0;
-        }
-        if(tag == TAG_STREAMEND)
-            return AVERROR(EIO);
-        mpc8_handle_chunk(s, tag, pos, size);
-    }
-    return 0;
-}
-
-static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st = s->streams[stream_index];
-    MPCContext *c = s->priv_data;
-    int index = av_index_search_timestamp(st, timestamp, flags);
-
-    if(index < 0) return -1;
-    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
-    c->frame = st->index_entries[index].timestamp;
-    return 0;
-}
-
-
-AVInputFormat mpc8_demuxer = {
-    "mpc8",
-    NULL_IF_CONFIG_SMALL("Musepack SV8"),
-    sizeof(MPCContext),
-    mpc8_probe,
-    mpc8_read_header,
-    mpc8_read_packet,
-    NULL,
-    mpc8_read_seek,
-};
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
deleted file mode 100644
index 4224a04..0000000
--- a/libavformat/mpeg.c
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- * MPEG1/2 demuxer
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "mpeg.h"
-
-//#define DEBUG_SEEK
-
-#undef NDEBUG
-#include <assert.h>
-
-/*********************************************/
-/* demux code */
-
-#define MAX_SYNC_SIZE 100000
-
-static int check_pes(uint8_t *p, uint8_t *end){
-    int pes1;
-    int pes2=      (p[3] & 0xC0) == 0x80
-                && (p[4] & 0xC0) != 0x40
-                &&((p[4] & 0xC0) == 0x00 || (p[4]&0xC0)>>2 == (p[6]&0xF0));
-
-    for(p+=3; p<end && *p == 0xFF; p++);
-    if((*p&0xC0) == 0x40) p+=2;
-    if((*p&0xF0) == 0x20){
-        pes1= p[0]&p[2]&p[4]&1;
-    }else if((*p&0xF0) == 0x30){
-        pes1= p[0]&p[2]&p[4]&p[5]&p[7]&p[9]&1;
-    }else
-        pes1 = *p == 0x0F;
-
-    return pes1||pes2;
-}
-
-static int mpegps_probe(AVProbeData *p)
-{
-    uint32_t code= -1;
-    int sys=0, pspack=0, priv1=0, vid=0, audio=0, invalid=0;
-    int i;
-    int score=0;
-
-    for(i=0; i<p->buf_size; i++){
-        code = (code<<8) + p->buf[i];
-        if ((code & 0xffffff00) == 0x100) {
-            int pes= check_pes(p->buf+i, p->buf+p->buf_size);
-
-            if(code == SYSTEM_HEADER_START_CODE) sys++;
-            else if(code == PRIVATE_STREAM_1)    priv1++;
-            else if(code == PACK_START_CODE)     pspack++;
-            else if((code & 0xf0) == VIDEO_ID &&  pes) vid++;
-            else if((code & 0xe0) == AUDIO_ID &&  pes) audio++;
-
-            else if((code & 0xf0) == VIDEO_ID && !pes) invalid++;
-            else if((code & 0xe0) == AUDIO_ID && !pes) invalid++;
-        }
-    }
-
-    if(vid+audio > invalid)     /* invalid VDR files nd short PES streams */
-        score= AVPROBE_SCORE_MAX/4;
-
-//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d %d %d len:%d\n", sys, priv1, pspack,vid, audio, invalid, p->buf_size);
-    if(sys>invalid && sys*9 <= pspack*10)
-        return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
-    if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9)
-        return pspack > 2 ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
-    if((!!vid ^ !!audio) && (audio > 4 || vid > 1) && !sys && !pspack && p->buf_size>2048 && vid + audio > invalid) /* PES stream */
-        return (audio > 12 || vid > 3) ? AVPROBE_SCORE_MAX/2+2 : AVPROBE_SCORE_MAX/4;
-
-    //02-Penguin.flac has sys:0 priv1:0 pspack:0 vid:0 audio:1
-    //mp3_misidentified_2.mp3 has sys:0 priv1:0 pspack:0 vid:0 audio:6
-    return score;
-}
-
-
-typedef struct MpegDemuxContext {
-    int32_t header_state;
-    unsigned char psm_es_type[256];
-    int sofdec;
-} MpegDemuxContext;
-
-static int mpegps_read_header(AVFormatContext *s,
-                              AVFormatParameters *ap)
-{
-    MpegDemuxContext *m = s->priv_data;
-    const char *sofdec = "Sofdec";
-    int v, i = 0;
-
-    m->header_state = 0xff;
-    s->ctx_flags |= AVFMTCTX_NOHEADER;
-
-    m->sofdec = -1;
-    do {
-        v = get_byte(s->pb);
-        m->header_state = m->header_state << 8 | v;
-        m->sofdec++;
-    } while (v == sofdec[i] && i++ < 6);
-
-    m->sofdec = (m->sofdec == 6) ? 1 : 0;
-
-    /* no need to do more */
-    return 0;
-}
-
-static int64_t get_pts(ByteIOContext *pb, int c)
-{
-    uint8_t buf[5];
-
-    buf[0] = c<0 ? get_byte(pb) : c;
-    get_buffer(pb, buf+1, 4);
-
-    return ff_parse_pes_pts(buf);
-}
-
-static int find_next_start_code(ByteIOContext *pb, int *size_ptr,
-                                int32_t *header_state)
-{
-    unsigned int state, v;
-    int val, n;
-
-    state = *header_state;
-    n = *size_ptr;
-    while (n > 0) {
-        if (url_feof(pb))
-            break;
-        v = get_byte(pb);
-        n--;
-        if (state == 0x000001) {
-            state = ((state << 8) | v) & 0xffffff;
-            val = state;
-            goto found;
-        }
-        state = ((state << 8) | v) & 0xffffff;
-    }
-    val = -1;
- found:
-    *header_state = state;
-    *size_ptr = n;
-    return val;
-}
-
-#if 0 /* unused, remove? */
-/* XXX: optimize */
-static int find_prev_start_code(ByteIOContext *pb, int *size_ptr)
-{
-    int64_t pos, pos_start;
-    int max_size, start_code;
-
-    max_size = *size_ptr;
-    pos_start = url_ftell(pb);
-
-    /* in order to go faster, we fill the buffer */
-    pos = pos_start - 16386;
-    if (pos < 0)
-        pos = 0;
-    url_fseek(pb, pos, SEEK_SET);
-    get_byte(pb);
-
-    pos = pos_start;
-    for(;;) {
-        pos--;
-        if (pos < 0 || (pos_start - pos) >= max_size) {
-            start_code = -1;
-            goto the_end;
-        }
-        url_fseek(pb, pos, SEEK_SET);
-        start_code = get_be32(pb);
-        if ((start_code & 0xffffff00) == 0x100)
-            break;
-    }
- the_end:
-    *size_ptr = pos_start - pos;
-    return start_code;
-}
-#endif
-
-/**
- * Extracts stream types from a program stream map
- * According to ISO/IEC 13818-1 ('MPEG-2 Systems') table 2-35
- *
- * @return number of bytes occupied by PSM in the bitstream
- */
-static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb)
-{
-    int psm_length, ps_info_length, es_map_length;
-
-    psm_length = get_be16(pb);
-    get_byte(pb);
-    get_byte(pb);
-    ps_info_length = get_be16(pb);
-
-    /* skip program_stream_info */
-    url_fskip(pb, ps_info_length);
-    es_map_length = get_be16(pb);
-
-    /* at least one es available? */
-    while (es_map_length >= 4){
-        unsigned char type      = get_byte(pb);
-        unsigned char es_id     = get_byte(pb);
-        uint16_t es_info_length = get_be16(pb);
-        /* remember mapping from stream id to stream type */
-        m->psm_es_type[es_id] = type;
-        /* skip program_stream_info */
-        url_fskip(pb, es_info_length);
-        es_map_length -= 4 + es_info_length;
-    }
-    get_be32(pb); /* crc32 */
-    return 2 + psm_length;
-}
-
-/* read the next PES header. Return its position in ppos
-   (if not NULL), and its start code, pts and dts.
- */
-static int mpegps_read_pes_header(AVFormatContext *s,
-                                  int64_t *ppos, int *pstart_code,
-                                  int64_t *ppts, int64_t *pdts)
-{
-    MpegDemuxContext *m = s->priv_data;
-    int len, size, startcode, c, flags, header_len;
-    int pes_ext, ext2_len, id_ext, skip;
-    int64_t pts, dts;
-    int64_t last_sync= url_ftell(s->pb);
-
- error_redo:
-        url_fseek(s->pb, last_sync, SEEK_SET);
- redo:
-        /* next start code (should be immediately after) */
-        m->header_state = 0xff;
-        size = MAX_SYNC_SIZE;
-        startcode = find_next_start_code(s->pb, &size, &m->header_state);
-        last_sync = url_ftell(s->pb);
-    //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
-    if (startcode < 0){
-        if(url_feof(s->pb))
-            return AVERROR_EOF;
-        //FIXME we should remember header_state
-        return AVERROR(EAGAIN);
-    }
-
-    if (startcode == PACK_START_CODE)
-        goto redo;
-    if (startcode == SYSTEM_HEADER_START_CODE)
-        goto redo;
-    if (startcode == PADDING_STREAM) {
-        url_fskip(s->pb, get_be16(s->pb));
-        goto redo;
-    }
-    if (startcode == PRIVATE_STREAM_2) {
-        len = get_be16(s->pb);
-        if (!m->sofdec) {
-            while (len-- >= 6) {
-                if (get_byte(s->pb) == 'S') {
-                    uint8_t buf[5];
-                    get_buffer(s->pb, buf, sizeof(buf));
-                    m->sofdec = !memcmp(buf, "ofdec", 5);
-                    len -= sizeof(buf);
-                    break;
-                }
-            }
-            m->sofdec -= !m->sofdec;
-        }
-        url_fskip(s->pb, len);
-        goto redo;
-    }
-    if (startcode == PROGRAM_STREAM_MAP) {
-        mpegps_psm_parse(m, s->pb);
-        goto redo;
-    }
-
-    /* find matching stream */
-    if (!((startcode >= 0x1c0 && startcode <= 0x1df) ||
-          (startcode >= 0x1e0 && startcode <= 0x1ef) ||
-          (startcode == 0x1bd) || (startcode == 0x1fd)))
-        goto redo;
-    if (ppos) {
-        *ppos = url_ftell(s->pb) - 4;
-    }
-    len = get_be16(s->pb);
-    pts =
-    dts = AV_NOPTS_VALUE;
-    /* stuffing */
-    for(;;) {
-        if (len < 1)
-            goto error_redo;
-        c = get_byte(s->pb);
-        len--;
-        /* XXX: for mpeg1, should test only bit 7 */
-        if (c != 0xff)
-            break;
-    }
-    if ((c & 0xc0) == 0x40) {
-        /* buffer scale & size */
-        get_byte(s->pb);
-        c = get_byte(s->pb);
-        len -= 2;
-    }
-    if ((c & 0xe0) == 0x20) {
-        dts = pts = get_pts(s->pb, c);
-        len -= 4;
-        if (c & 0x10){
-            dts = get_pts(s->pb, -1);
-            len -= 5;
-        }
-    } else if ((c & 0xc0) == 0x80) {
-        /* mpeg 2 PES */
-#if 0 /* some streams have this field set for no apparent reason */
-        if ((c & 0x30) != 0) {
-            /* Encrypted multiplex not handled */
-            goto redo;
-        }
-#endif
-        flags = get_byte(s->pb);
-        header_len = get_byte(s->pb);
-        len -= 2;
-        if (header_len > len)
-            goto error_redo;
-        len -= header_len;
-        if (flags & 0x80) {
-            dts = pts = get_pts(s->pb, -1);
-            header_len -= 5;
-            if (flags & 0x40) {
-                dts = get_pts(s->pb, -1);
-                header_len -= 5;
-            }
-        }
-        if (flags & 0x3f && header_len == 0){
-            flags &= 0xC0;
-            av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n");
-        }
-        if (flags & 0x01) { /* PES extension */
-            pes_ext = get_byte(s->pb);
-            header_len--;
-            /* Skip PES private data, program packet sequence counter and P-STD buffer */
-            skip = (pes_ext >> 4) & 0xb;
-            skip += skip & 0x9;
-            if (pes_ext & 0x40 || skip > header_len){
-                av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext);
-                pes_ext=skip=0;
-            }
-            url_fskip(s->pb, skip);
-            header_len -= skip;
-
-            if (pes_ext & 0x01) { /* PES extension 2 */
-                ext2_len = get_byte(s->pb);
-                header_len--;
-                if ((ext2_len & 0x7f) > 0) {
-                    id_ext = get_byte(s->pb);
-                    if ((id_ext & 0x80) == 0)
-                        startcode = ((startcode & 0xff) << 8) | id_ext;
-                    header_len--;
-                }
-            }
-        }
-        if(header_len < 0)
-            goto error_redo;
-        url_fskip(s->pb, header_len);
-    }
-    else if( c!= 0xf )
-        goto redo;
-
-    if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
-        startcode = get_byte(s->pb);
-        len--;
-        if (startcode >= 0x80 && startcode <= 0xcf) {
-            /* audio: skip header */
-            get_byte(s->pb);
-            get_byte(s->pb);
-            get_byte(s->pb);
-            len -= 3;
-            if (startcode >= 0xb0 && startcode <= 0xbf) {
-                /* MLP/TrueHD audio has a 4-byte header */
-                get_byte(s->pb);
-                len--;
-            }
-        }
-    }
-    if(len<0)
-        goto error_redo;
-    if(dts != AV_NOPTS_VALUE && ppos){
-        int i;
-        for(i=0; i<s->nb_streams; i++){
-            if(startcode == s->streams[i]->id &&
-               !url_is_streamed(s->pb) /* index useless on streams anyway */) {
-                ff_reduce_index(s, i);
-                av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */);
-            }
-        }
-    }
-
-    *pstart_code = startcode;
-    *ppts = pts;
-    *pdts = dts;
-    return len;
-}
-
-static int mpegps_read_packet(AVFormatContext *s,
-                              AVPacket *pkt)
-{
-    MpegDemuxContext *m = s->priv_data;
-    AVStream *st;
-    int len, startcode, i, es_type;
-    enum CodecID codec_id = CODEC_ID_NONE;
-    enum AVMediaType type;
-    int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
-    uint8_t av_uninit(dvdaudio_substream_type);
-
- redo:
-    len = mpegps_read_pes_header(s, &dummy_pos, &startcode, &pts, &dts);
-    if (len < 0)
-        return len;
-
-    if(startcode == 0x1bd) {
-        dvdaudio_substream_type = get_byte(s->pb);
-        url_fskip(s->pb, 3);
-        len -= 4;
-    }
-
-    /* now find stream */
-    for(i=0;i<s->nb_streams;i++) {
-        st = s->streams[i];
-        if (st->id == startcode)
-            goto found;
-    }
-
-    es_type = m->psm_es_type[startcode & 0xff];
-    if(es_type > 0 && es_type != STREAM_TYPE_PRIVATE_DATA){
-        if(es_type == STREAM_TYPE_VIDEO_MPEG1){
-            codec_id = CODEC_ID_MPEG2VIDEO;
-            type = AVMEDIA_TYPE_VIDEO;
-        } else if(es_type == STREAM_TYPE_VIDEO_MPEG2){
-            codec_id = CODEC_ID_MPEG2VIDEO;
-            type = AVMEDIA_TYPE_VIDEO;
-        } else if(es_type == STREAM_TYPE_AUDIO_MPEG1 ||
-                  es_type == STREAM_TYPE_AUDIO_MPEG2){
-            codec_id = CODEC_ID_MP3;
-            type = AVMEDIA_TYPE_AUDIO;
-        } else if(es_type == STREAM_TYPE_AUDIO_AAC){
-            codec_id = CODEC_ID_AAC;
-            type = AVMEDIA_TYPE_AUDIO;
-        } else if(es_type == STREAM_TYPE_VIDEO_MPEG4){
-            codec_id = CODEC_ID_MPEG4;
-            type = AVMEDIA_TYPE_VIDEO;
-        } else if(es_type == STREAM_TYPE_VIDEO_H264){
-            codec_id = CODEC_ID_H264;
-            type = AVMEDIA_TYPE_VIDEO;
-        } else if(es_type == STREAM_TYPE_AUDIO_AC3){
-            codec_id = CODEC_ID_AC3;
-            type = AVMEDIA_TYPE_AUDIO;
-        } else {
-            goto skip;
-        }
-    } else if (startcode >= 0x1e0 && startcode <= 0x1ef) {
-        static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
-        unsigned char buf[8];
-        get_buffer(s->pb, buf, 8);
-        url_fseek(s->pb, -8, SEEK_CUR);
-        if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
-            codec_id = CODEC_ID_CAVS;
-        else
-            codec_id = CODEC_ID_PROBE;
-        type = AVMEDIA_TYPE_VIDEO;
-    } else if (startcode >= 0x1c0 && startcode <= 0x1df) {
-        type = AVMEDIA_TYPE_AUDIO;
-        codec_id = m->sofdec > 0 ? CODEC_ID_ADPCM_ADX : CODEC_ID_MP2;
-    } else if (startcode >= 0x80 && startcode <= 0x87) {
-        type = AVMEDIA_TYPE_AUDIO;
-        codec_id = CODEC_ID_AC3;
-    } else if (  ( startcode >= 0x88 && startcode <= 0x8f)
-               ||( startcode >= 0x98 && startcode <= 0x9f)) {
-        /* 0x90 - 0x97 is reserved for SDDS in DVD specs */
-        type = AVMEDIA_TYPE_AUDIO;
-        codec_id = CODEC_ID_DTS;
-    } else if (startcode >= 0xa0 && startcode <= 0xaf) {
-        type = AVMEDIA_TYPE_AUDIO;
-        /* 16 bit form will be handled as CODEC_ID_PCM_S16BE */
-        codec_id = CODEC_ID_PCM_DVD;
-    } else if (startcode >= 0xb0 && startcode <= 0xbf) {
-        type = AVMEDIA_TYPE_AUDIO;
-        codec_id = CODEC_ID_TRUEHD;
-    } else if (startcode >= 0xc0 && startcode <= 0xcf) {
-        /* Used for both AC-3 and E-AC-3 in EVOB files */
-        type = AVMEDIA_TYPE_AUDIO;
-        codec_id = CODEC_ID_AC3;
-    } else if (startcode >= 0x20 && startcode <= 0x3f) {
-        type = AVMEDIA_TYPE_SUBTITLE;
-        codec_id = CODEC_ID_DVD_SUBTITLE;
-    } else if (startcode >= 0xfd55 && startcode <= 0xfd5f) {
-        type = AVMEDIA_TYPE_VIDEO;
-        codec_id = CODEC_ID_VC1;
-    } else if (startcode == 0x1bd) {
-        // check dvd audio substream type
-        type = AVMEDIA_TYPE_AUDIO;
-        switch(dvdaudio_substream_type & 0xe0) {
-        case 0xa0:  codec_id = CODEC_ID_PCM_DVD;
-                    break;
-        case 0x80:  if((dvdaudio_substream_type & 0xf8) == 0x88)
-                         codec_id = CODEC_ID_DTS;
-                    else codec_id = CODEC_ID_AC3;
-                    break;
-        default:    av_log(s, AV_LOG_ERROR, "Unknown 0x1bd sub-stream\n");
-                    goto skip;
-        }
-    } else {
-    skip:
-        /* skip packet */
-        url_fskip(s->pb, len);
-        goto redo;
-    }
-    /* no stream found: add a new stream */
-    st = av_new_stream(s, startcode);
-    if (!st)
-        goto skip;
-    st->codec->codec_type = type;
-    st->codec->codec_id = codec_id;
-    if (codec_id != CODEC_ID_PCM_S16BE)
-        st->need_parsing = AVSTREAM_PARSE_FULL;
- found:
-    if(st->discard >= AVDISCARD_ALL)
-        goto skip;
-    if ((startcode >= 0xa0 && startcode <= 0xaf) ||
-        (startcode == 0x1bd && ((dvdaudio_substream_type & 0xe0) == 0xa0))) {
-        int b1, freq;
-
-        /* for LPCM, we just skip the header and consider it is raw
-           audio data */
-        if (len <= 3)
-            goto skip;
-        get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
-        b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
-        get_byte(s->pb); /* dynamic range control (0x80 = off) */
-        len -= 3;
-        freq = (b1 >> 4) & 3;
-        st->codec->sample_rate = lpcm_freq_tab[freq];
-        st->codec->channels = 1 + (b1 & 7);
-        st->codec->bits_per_coded_sample = 16 + ((b1 >> 6) & 3) * 4;
-        st->codec->bit_rate = st->codec->channels *
-                              st->codec->sample_rate *
-                              st->codec->bits_per_coded_sample;
-        if (st->codec->bits_per_coded_sample == 16)
-            st->codec->codec_id = CODEC_ID_PCM_S16BE;
-        else if (st->codec->bits_per_coded_sample == 28)
-            return AVERROR(EINVAL);
-    }
-    av_new_packet(pkt, len);
-    get_buffer(s->pb, pkt->data, pkt->size);
-    pkt->pts = pts;
-    pkt->dts = dts;
-    pkt->pos = dummy_pos;
-    pkt->stream_index = st->index;
-#if 0
-    av_log(s, AV_LOG_DEBUG, "%d: pts=%0.3f dts=%0.3f size=%d\n",
-           pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, pkt->size);
-#endif
-
-    return 0;
-}
-
-static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
-                               int64_t *ppos, int64_t pos_limit)
-{
-    int len, startcode;
-    int64_t pos, pts, dts;
-
-    pos = *ppos;
-#ifdef DEBUG_SEEK
-    printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next);
-#endif
-    if (url_fseek(s->pb, pos, SEEK_SET) < 0)
-        return AV_NOPTS_VALUE;
-
-    for(;;) {
-        len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts);
-        if (len < 0) {
-#ifdef DEBUG_SEEK
-            printf("none (ret=%d)\n", len);
-#endif
-            return AV_NOPTS_VALUE;
-        }
-        if (startcode == s->streams[stream_index]->id &&
-            dts != AV_NOPTS_VALUE) {
-            break;
-        }
-        url_fskip(s->pb, len);
-    }
-#ifdef DEBUG_SEEK
-    printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0);
-#endif
-    *ppos = pos;
-    return dts;
-}
-
-AVInputFormat mpegps_demuxer = {
-    "mpeg",
-    NULL_IF_CONFIG_SMALL("MPEG-PS format"),
-    sizeof(MpegDemuxContext),
-    mpegps_probe,
-    mpegps_read_header,
-    mpegps_read_packet,
-    NULL,
-    NULL, //mpegps_read_seek,
-    mpegps_read_dts,
-    .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
-};
diff --git a/libavformat/mpeg.h b/libavformat/mpeg.h
deleted file mode 100644
index d09b2e8..0000000
--- a/libavformat/mpeg.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * MPEG1/2 muxer and demuxer common defines
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_MPEG_H
-#define AVFORMAT_MPEG_H
-
-#include <stdint.h>
-#include "libavutil/intreadwrite.h"
-
-#define PACK_START_CODE             ((unsigned int)0x000001ba)
-#define SYSTEM_HEADER_START_CODE    ((unsigned int)0x000001bb)
-#define SEQUENCE_END_CODE           ((unsigned int)0x000001b7)
-#define PACKET_START_CODE_MASK      ((unsigned int)0xffffff00)
-#define PACKET_START_CODE_PREFIX    ((unsigned int)0x00000100)
-#define ISO_11172_END_CODE          ((unsigned int)0x000001b9)
-
-/* mpeg2 */
-#define PROGRAM_STREAM_MAP 0x1bc
-#define PRIVATE_STREAM_1   0x1bd
-#define PADDING_STREAM     0x1be
-#define PRIVATE_STREAM_2   0x1bf
-
-#define AUDIO_ID 0xc0
-#define VIDEO_ID 0xe0
-#define AC3_ID   0x80
-#define DTS_ID   0x8a
-#define LPCM_ID  0xa0
-#define SUB_ID   0x20
-
-#define STREAM_TYPE_VIDEO_MPEG1     0x01
-#define STREAM_TYPE_VIDEO_MPEG2     0x02
-#define STREAM_TYPE_AUDIO_MPEG1     0x03
-#define STREAM_TYPE_AUDIO_MPEG2     0x04
-#define STREAM_TYPE_PRIVATE_SECTION 0x05
-#define STREAM_TYPE_PRIVATE_DATA    0x06
-#define STREAM_TYPE_AUDIO_AAC       0x0f
-#define STREAM_TYPE_VIDEO_MPEG4     0x10
-#define STREAM_TYPE_VIDEO_H264      0x1b
-
-#define STREAM_TYPE_AUDIO_AC3       0x81
-#define STREAM_TYPE_AUDIO_DTS       0x8a
-
-static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
-
-/**
- * Parse MPEG-PES five-byte timestamp
- */
-static inline int64_t ff_parse_pes_pts(uint8_t *buf) {
-    return (int64_t)(*buf & 0x0e) << 29 |
-            (AV_RB16(buf+1) >> 1) << 15 |
-             AV_RB16(buf+3) >> 1;
-}
-
-#endif /* AVFORMAT_MPEG_H */
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
deleted file mode 100644
index b37a774..0000000
--- a/libavformat/mpegenc.c
+++ /dev/null
@@ -1,1302 +0,0 @@
-/*
- * MPEG1/2 muxer
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/fifo.h"
-#include "libavcodec/put_bits.h"
-#include "avformat.h"
-#include "mpeg.h"
-
-#define MAX_PAYLOAD_SIZE 4096
-//#define DEBUG_SEEK
-
-#undef NDEBUG
-#include <assert.h>
-
-typedef struct PacketDesc {
-    int64_t pts;
-    int64_t dts;
-    int size;
-    int unwritten_size;
-    int flags;
-    struct PacketDesc *next;
-} PacketDesc;
-
-typedef struct {
-    AVFifoBuffer *fifo;
-    uint8_t id;
-    int max_buffer_size; /* in bytes */
-    int buffer_index;
-    PacketDesc *predecode_packet;
-    PacketDesc *premux_packet;
-    PacketDesc **next_packet;
-    int packet_number;
-    uint8_t lpcm_header[3];
-    int lpcm_align;
-    int bytes_to_iframe;
-    int align_iframe;
-    int64_t vobu_start_pts;
-} StreamInfo;
-
-typedef struct {
-    int packet_size; /* required packet size */
-    int packet_number;
-    int pack_header_freq;     /* frequency (in packets^-1) at which we send pack headers */
-    int system_header_freq;
-    int system_header_size;
-    int mux_rate; /* bitrate in units of 50 bytes/s */
-    /* stream info */
-    int audio_bound;
-    int video_bound;
-    int is_mpeg2;
-    int is_vcd;
-    int is_svcd;
-    int is_dvd;
-    int64_t last_scr; /* current system clock */
-
-    double vcd_padding_bitrate; //FIXME floats
-    int64_t vcd_padding_bytes_written;
-
-} MpegMuxContext;
-
-extern AVOutputFormat mpeg1vcd_muxer;
-extern AVOutputFormat mpeg2dvd_muxer;
-extern AVOutputFormat mpeg2svcd_muxer;
-extern AVOutputFormat mpeg2vob_muxer;
-
-static int put_pack_header(AVFormatContext *ctx,
-                           uint8_t *buf, int64_t timestamp)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    PutBitContext pb;
-
-    init_put_bits(&pb, buf, 128);
-
-    put_bits32(&pb, PACK_START_CODE);
-    if (s->is_mpeg2) {
-        put_bits(&pb, 2, 0x1);
-    } else {
-        put_bits(&pb, 4, 0x2);
-    }
-    put_bits(&pb, 3,  (uint32_t)((timestamp >> 30) & 0x07));
-    put_bits(&pb, 1, 1);
-    put_bits(&pb, 15, (uint32_t)((timestamp >> 15) & 0x7fff));
-    put_bits(&pb, 1, 1);
-    put_bits(&pb, 15, (uint32_t)((timestamp      ) & 0x7fff));
-    put_bits(&pb, 1, 1);
-    if (s->is_mpeg2) {
-        /* clock extension */
-        put_bits(&pb, 9, 0);
-    }
-    put_bits(&pb, 1, 1);
-    put_bits(&pb, 22, s->mux_rate);
-    put_bits(&pb, 1, 1);
-    if (s->is_mpeg2) {
-        put_bits(&pb, 1, 1);
-        put_bits(&pb, 5, 0x1f); /* reserved */
-        put_bits(&pb, 3, 0); /* stuffing length */
-    }
-    flush_put_bits(&pb);
-    return put_bits_ptr(&pb) - pb.buf;
-}
-
-static int put_system_header(AVFormatContext *ctx, uint8_t *buf,int only_for_stream_id)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    int size, i, private_stream_coded, id;
-    PutBitContext pb;
-
-    init_put_bits(&pb, buf, 128);
-
-    put_bits32(&pb, SYSTEM_HEADER_START_CODE);
-    put_bits(&pb, 16, 0);
-    put_bits(&pb, 1, 1);
-
-    put_bits(&pb, 22, s->mux_rate); /* maximum bit rate of the multiplexed stream */
-    put_bits(&pb, 1, 1); /* marker */
-    if (s->is_vcd && only_for_stream_id==VIDEO_ID) {
-        /* This header applies only to the video stream (see VCD standard p. IV-7)*/
-        put_bits(&pb, 6, 0);
-    } else
-        put_bits(&pb, 6, s->audio_bound);
-
-    if (s->is_vcd) {
-        /* see VCD standard, p. IV-7*/
-        put_bits(&pb, 1, 0);
-        put_bits(&pb, 1, 1);
-    } else {
-        put_bits(&pb, 1, 0); /* variable bitrate*/
-        put_bits(&pb, 1, 0); /* non constrainted bit stream */
-    }
-
-    if (s->is_vcd || s->is_dvd) {
-        /* see VCD standard p IV-7 */
-        put_bits(&pb, 1, 1); /* audio locked */
-        put_bits(&pb, 1, 1); /* video locked */
-    } else {
-        put_bits(&pb, 1, 0); /* audio locked */
-        put_bits(&pb, 1, 0); /* video locked */
-    }
-
-    put_bits(&pb, 1, 1); /* marker */
-
-    if (s->is_vcd && (only_for_stream_id & 0xe0) == AUDIO_ID) {
-        /* This header applies only to the audio stream (see VCD standard p. IV-7)*/
-        put_bits(&pb, 5, 0);
-    } else
-        put_bits(&pb, 5, s->video_bound);
-
-    if (s->is_dvd) {
-        put_bits(&pb, 1, 0);    /* packet_rate_restriction_flag */
-        put_bits(&pb, 7, 0x7f); /* reserved byte */
-    } else
-        put_bits(&pb, 8, 0xff); /* reserved byte */
-
-    /* DVD-Video Stream_bound entries
-    id (0xB9) video, maximum P-STD for stream 0xE0. (P-STD_buffer_bound_scale = 1)
-    id (0xB8) audio, maximum P-STD for any MPEG audio (0xC0 to 0xC7) streams. If there are none set to 4096 (32x128). (P-STD_buffer_bound_scale = 0)
-    id (0xBD) private stream 1 (audio other than MPEG and subpictures). (P-STD_buffer_bound_scale = 1)
-    id (0xBF) private stream 2, NAV packs, set to 2x1024. */
-    if (s->is_dvd) {
-
-        int P_STD_max_video = 0;
-        int P_STD_max_mpeg_audio = 0;
-        int P_STD_max_mpeg_PS1 = 0;
-
-        for(i=0;i<ctx->nb_streams;i++) {
-            StreamInfo *stream = ctx->streams[i]->priv_data;
-
-            id = stream->id;
-            if (id == 0xbd && stream->max_buffer_size > P_STD_max_mpeg_PS1) {
-                P_STD_max_mpeg_PS1 = stream->max_buffer_size;
-            } else if (id >= 0xc0 && id <= 0xc7 && stream->max_buffer_size > P_STD_max_mpeg_audio) {
-                P_STD_max_mpeg_audio = stream->max_buffer_size;
-            } else if (id == 0xe0 && stream->max_buffer_size > P_STD_max_video) {
-                P_STD_max_video = stream->max_buffer_size;
-            }
-        }
-
-        /* video */
-        put_bits(&pb, 8, 0xb9); /* stream ID */
-        put_bits(&pb, 2, 3);
-        put_bits(&pb, 1, 1);
-        put_bits(&pb, 13, P_STD_max_video / 1024);
-
-        /* audio */
-        if (P_STD_max_mpeg_audio == 0)
-            P_STD_max_mpeg_audio = 4096;
-        put_bits(&pb, 8, 0xb8); /* stream ID */
-        put_bits(&pb, 2, 3);
-        put_bits(&pb, 1, 0);
-        put_bits(&pb, 13, P_STD_max_mpeg_audio / 128);
-
-        /* private stream 1 */
-        put_bits(&pb, 8, 0xbd); /* stream ID */
-        put_bits(&pb, 2, 3);
-        put_bits(&pb, 1, 0);
-        put_bits(&pb, 13, P_STD_max_mpeg_PS1 / 128);
-
-        /* private stream 2 */
-        put_bits(&pb, 8, 0xbf); /* stream ID */
-        put_bits(&pb, 2, 3);
-        put_bits(&pb, 1, 1);
-        put_bits(&pb, 13, 2);
-    }
-    else {
-        /* audio stream info */
-        private_stream_coded = 0;
-        for(i=0;i<ctx->nb_streams;i++) {
-            StreamInfo *stream = ctx->streams[i]->priv_data;
-
-
-            /* For VCDs, only include the stream info for the stream
-            that the pack which contains this system belongs to.
-            (see VCD standard p. IV-7) */
-            if ( !s->is_vcd || stream->id==only_for_stream_id
-                || only_for_stream_id==0) {
-
-                id = stream->id;
-                if (id < 0xc0) {
-                    /* special case for private streams (AC-3 uses that) */
-                    if (private_stream_coded)
-                        continue;
-                    private_stream_coded = 1;
-                    id = 0xbd;
-                }
-                put_bits(&pb, 8, id); /* stream ID */
-                put_bits(&pb, 2, 3);
-                if (id < 0xe0) {
-                    /* audio */
-                    put_bits(&pb, 1, 0);
-                    put_bits(&pb, 13, stream->max_buffer_size / 128);
-                } else {
-                    /* video */
-                    put_bits(&pb, 1, 1);
-                    put_bits(&pb, 13, stream->max_buffer_size / 1024);
-                }
-            }
-        }
-    }
-
-    flush_put_bits(&pb);
-    size = put_bits_ptr(&pb) - pb.buf;
-    /* patch packet size */
-    buf[4] = (size - 6) >> 8;
-    buf[5] = (size - 6) & 0xff;
-
-    return size;
-}
-
-static int get_system_header_size(AVFormatContext *ctx)
-{
-    int buf_index, i, private_stream_coded;
-    StreamInfo *stream;
-    MpegMuxContext *s = ctx->priv_data;
-
-    if (s->is_dvd)
-       return 18; // DVD-Video system headers are 18 bytes fixed length.
-
-    buf_index = 12;
-    private_stream_coded = 0;
-    for(i=0;i<ctx->nb_streams;i++) {
-        stream = ctx->streams[i]->priv_data;
-        if (stream->id < 0xc0) {
-            if (private_stream_coded)
-                continue;
-            private_stream_coded = 1;
-        }
-        buf_index += 3;
-    }
-    return buf_index;
-}
-
-static int mpeg_mux_init(AVFormatContext *ctx)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    int bitrate, i, mpa_id, mpv_id, mps_id, ac3_id, dts_id, lpcm_id, j;
-    AVStream *st;
-    StreamInfo *stream;
-    int audio_bitrate;
-    int video_bitrate;
-
-    s->packet_number = 0;
-    s->is_vcd =    (CONFIG_MPEG1VCD_MUXER  && ctx->oformat == &mpeg1vcd_muxer);
-    s->is_svcd =   (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer);
-    s->is_mpeg2 = ((CONFIG_MPEG2VOB_MUXER  && ctx->oformat == &mpeg2vob_muxer) ||
-                   (CONFIG_MPEG2DVD_MUXER  && ctx->oformat == &mpeg2dvd_muxer) ||
-                   (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer));
-    s->is_dvd =    (CONFIG_MPEG2DVD_MUXER  && ctx->oformat == &mpeg2dvd_muxer);
-
-    if(ctx->packet_size) {
-        if (ctx->packet_size < 20 || ctx->packet_size > (1 << 23) + 10) {
-            av_log(ctx, AV_LOG_ERROR, "Invalid packet size %d\n",
-                   ctx->packet_size);
-            goto fail;
-        }
-        s->packet_size = ctx->packet_size;
-    } else
-        s->packet_size = 2048;
-
-    s->vcd_padding_bytes_written = 0;
-    s->vcd_padding_bitrate=0;
-
-    s->audio_bound = 0;
-    s->video_bound = 0;
-    mpa_id = AUDIO_ID;
-    ac3_id = AC3_ID;
-    dts_id = DTS_ID;
-    mpv_id = VIDEO_ID;
-    mps_id = SUB_ID;
-    lpcm_id = LPCM_ID;
-    for(i=0;i<ctx->nb_streams;i++) {
-        st = ctx->streams[i];
-        stream = av_mallocz(sizeof(StreamInfo));
-        if (!stream)
-            goto fail;
-        st->priv_data = stream;
-
-        av_set_pts_info(st, 64, 1, 90000);
-
-        switch(st->codec->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            if        (st->codec->codec_id == CODEC_ID_AC3) {
-                stream->id = ac3_id++;
-            } else if (st->codec->codec_id == CODEC_ID_DTS) {
-                stream->id = dts_id++;
-            } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
-                stream->id = lpcm_id++;
-                for(j = 0; j < 4; j++) {
-                    if (lpcm_freq_tab[j] == st->codec->sample_rate)
-                        break;
-                }
-                if (j == 4)
-                    goto fail;
-                if (st->codec->channels > 8)
-                    return -1;
-                stream->lpcm_header[0] = 0x0c;
-                stream->lpcm_header[1] = (st->codec->channels - 1) | (j << 4);
-                stream->lpcm_header[2] = 0x80;
-                stream->lpcm_align = st->codec->channels * 2;
-            } else {
-                stream->id = mpa_id++;
-            }
-
-            /* This value HAS to be used for VCD (see VCD standard, p. IV-7).
-               Right now it is also used for everything else.*/
-            stream->max_buffer_size = 4 * 1024;
-            s->audio_bound++;
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-            stream->id = mpv_id++;
-            if (st->codec->rc_buffer_size)
-                stream->max_buffer_size = 6*1024 + st->codec->rc_buffer_size/8;
-            else
-                stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default
-#if 0
-                /* see VCD standard, p. IV-7*/
-                stream->max_buffer_size = 46 * 1024;
-            else
-                /* This value HAS to be used for SVCD (see SVCD standard, p. 26 V.2.3.2).
-                   Right now it is also used for everything else.*/
-                stream->max_buffer_size = 230 * 1024;
-#endif
-            s->video_bound++;
-            break;
-        case AVMEDIA_TYPE_SUBTITLE:
-            stream->id = mps_id++;
-            stream->max_buffer_size = 16 * 1024;
-            break;
-        default:
-            return -1;
-        }
-        stream->fifo= av_fifo_alloc(16);
-        if (!stream->fifo)
-            goto fail;
-    }
-    bitrate = 0;
-    audio_bitrate = 0;
-    video_bitrate = 0;
-    for(i=0;i<ctx->nb_streams;i++) {
-        int codec_rate;
-        st = ctx->streams[i];
-        stream = (StreamInfo*) st->priv_data;
-
-        if(st->codec->rc_max_rate || stream->id==VIDEO_ID)
-            codec_rate= st->codec->rc_max_rate;
-        else
-            codec_rate= st->codec->bit_rate;
-
-        if(!codec_rate)
-            codec_rate= (1<<21)*8*50/ctx->nb_streams;
-
-        bitrate += codec_rate;
-
-        if ((stream->id & 0xe0) == AUDIO_ID)
-            audio_bitrate += codec_rate;
-        else if (stream->id==VIDEO_ID)
-            video_bitrate += codec_rate;
-    }
-
-    if(ctx->mux_rate){
-        s->mux_rate= (ctx->mux_rate + (8 * 50) - 1) / (8 * 50);
-    } else {
-        /* we increase slightly the bitrate to take into account the
-           headers. XXX: compute it exactly */
-        bitrate += bitrate*5/100;
-        bitrate += 10000;
-        s->mux_rate = (bitrate + (8 * 50) - 1) / (8 * 50);
-    }
-
-    if (s->is_vcd) {
-        double overhead_rate;
-
-        /* The VCD standard mandates that the mux_rate field is 3528
-           (see standard p. IV-6).
-           The value is actually "wrong", i.e. if you calculate
-           it using the normal formula and the 75 sectors per second transfer
-           rate you get a different value because the real pack size is 2324,
-           not 2352. But the standard explicitly specifies that the mux_rate
-           field in the header must have this value.*/
-//        s->mux_rate=2352 * 75 / 50;    /* = 3528*/
-
-        /* The VCD standard states that the muxed stream must be
-           exactly 75 packs / second (the data rate of a single speed cdrom).
-           Since the video bitrate (probably 1150000 bits/sec) will be below
-           the theoretical maximum we have to add some padding packets
-           to make up for the lower data rate.
-           (cf. VCD standard p. IV-6 )*/
-
-        /* Add the header overhead to the data rate.
-           2279 data bytes per audio pack, 2294 data bytes per video pack*/
-        overhead_rate  = ((audio_bitrate / 8.0) / 2279) * (2324 - 2279);
-        overhead_rate += ((video_bitrate / 8.0) / 2294) * (2324 - 2294);
-        overhead_rate *= 8;
-
-        /* Add padding so that the full bitrate is 2324*75 bytes/sec */
-        s->vcd_padding_bitrate = 2324 * 75 * 8 - (bitrate + overhead_rate);
-    }
-
-    if (s->is_vcd || s->is_mpeg2)
-        /* every packet */
-        s->pack_header_freq = 1;
-    else
-        /* every 2 seconds */
-        s->pack_header_freq = 2 * bitrate / s->packet_size / 8;
-
-    /* the above seems to make pack_header_freq zero sometimes */
-    if (s->pack_header_freq == 0)
-       s->pack_header_freq = 1;
-
-    if (s->is_mpeg2)
-        /* every 200 packets. Need to look at the spec.  */
-        s->system_header_freq = s->pack_header_freq * 40;
-    else if (s->is_vcd)
-        /* the standard mandates that there are only two system headers
-           in the whole file: one in the first packet of each stream.
-           (see standard p. IV-7 and IV-8) */
-        s->system_header_freq = 0x7fffffff;
-    else
-        s->system_header_freq = s->pack_header_freq * 5;
-
-    for(i=0;i<ctx->nb_streams;i++) {
-        stream = ctx->streams[i]->priv_data;
-        stream->packet_number = 0;
-    }
-    s->system_header_size = get_system_header_size(ctx);
-    s->last_scr = 0;
-    return 0;
- fail:
-    for(i=0;i<ctx->nb_streams;i++) {
-        av_free(ctx->streams[i]->priv_data);
-    }
-    return AVERROR(ENOMEM);
-}
-
-static inline void put_timestamp(ByteIOContext *pb, int id, int64_t timestamp)
-{
-    put_byte(pb,
-             (id << 4) |
-             (((timestamp >> 30) & 0x07) << 1) |
-             1);
-    put_be16(pb, (uint16_t)((((timestamp >> 15) & 0x7fff) << 1) | 1));
-    put_be16(pb, (uint16_t)((((timestamp      ) & 0x7fff) << 1) | 1));
-}
-
-
-/* return the number of padding bytes that should be inserted into
-   the multiplexed stream.*/
-static int get_vcd_padding_size(AVFormatContext *ctx, int64_t pts)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    int pad_bytes = 0;
-
-    if (s->vcd_padding_bitrate > 0 && pts!=AV_NOPTS_VALUE)
-    {
-        int64_t full_pad_bytes;
-
-        full_pad_bytes = (int64_t)((s->vcd_padding_bitrate * (pts / 90000.0)) / 8.0); //FIXME this is wrong
-        pad_bytes = (int) (full_pad_bytes - s->vcd_padding_bytes_written);
-
-        if (pad_bytes<0)
-            /* might happen if we have already padded to a later timestamp. This
-               can occur if another stream has already advanced further.*/
-            pad_bytes=0;
-    }
-
-    return pad_bytes;
-}
-
-
-#if 0 /* unused, remove? */
-/* return the exact available payload size for the next packet for
-   stream 'stream_index'. 'pts' and 'dts' are only used to know if
-   timestamps are needed in the packet header. */
-static int get_packet_payload_size(AVFormatContext *ctx, int stream_index,
-                                   int64_t pts, int64_t dts)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    int buf_index;
-    StreamInfo *stream;
-
-    stream = ctx->streams[stream_index]->priv_data;
-
-    buf_index = 0;
-    if (((s->packet_number % s->pack_header_freq) == 0)) {
-        /* pack header size */
-        if (s->is_mpeg2)
-            buf_index += 14;
-        else
-            buf_index += 12;
-
-        if (s->is_vcd) {
-            /* there is exactly one system header for each stream in a VCD MPEG,
-               One in the very first video packet and one in the very first
-               audio packet (see VCD standard p. IV-7 and IV-8).*/
-
-            if (stream->packet_number==0)
-                /* The system headers refer only to the stream they occur in,
-                   so they have a constant size.*/
-                buf_index += 15;
-
-        } else {
-            if ((s->packet_number % s->system_header_freq) == 0)
-                buf_index += s->system_header_size;
-        }
-    }
-
-    if ((s->is_vcd && stream->packet_number==0)
-        || (s->is_svcd && s->packet_number==0))
-        /* the first pack of each stream contains only the pack header,
-           the system header and some padding (see VCD standard p. IV-6)
-           Add the padding size, so that the actual payload becomes 0.*/
-        buf_index += s->packet_size - buf_index;
-    else {
-        /* packet header size */
-        buf_index += 6;
-        if (s->is_mpeg2) {
-            buf_index += 3;
-            if (stream->packet_number==0)
-                buf_index += 3; /* PES extension */
-            buf_index += 1;    /* obligatory stuffing byte */
-        }
-        if (pts != AV_NOPTS_VALUE) {
-            if (dts != pts)
-                buf_index += 5 + 5;
-            else
-                buf_index += 5;
-
-        } else {
-            if (!s->is_mpeg2)
-                buf_index++;
-        }
-
-        if (stream->id < 0xc0) {
-            /* AC-3/LPCM private data header */
-            buf_index += 4;
-            if (stream->id >= 0xa0) {
-                int n;
-                buf_index += 3;
-                /* NOTE: we round the payload size to an integer number of
-                   LPCM samples */
-                n = (s->packet_size - buf_index) % stream->lpcm_align;
-                if (n)
-                    buf_index += (stream->lpcm_align - n);
-            }
-        }
-
-        if (s->is_vcd && (stream->id & 0xe0) == AUDIO_ID)
-            /* The VCD standard demands that 20 zero bytes follow
-               each audio packet (see standard p. IV-8).*/
-            buf_index+=20;
-    }
-    return s->packet_size - buf_index;
-}
-#endif
-
-/* Write an MPEG padding packet header. */
-static void put_padding_packet(AVFormatContext *ctx, ByteIOContext *pb,int packet_bytes)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    int i;
-
-    put_be32(pb, PADDING_STREAM);
-    put_be16(pb, packet_bytes - 6);
-    if (!s->is_mpeg2) {
-        put_byte(pb, 0x0f);
-        packet_bytes -= 7;
-    } else
-        packet_bytes -= 6;
-
-    for(i=0;i<packet_bytes;i++)
-        put_byte(pb, 0xff);
-}
-
-static int get_nb_frames(AVFormatContext *ctx, StreamInfo *stream, int len){
-    int nb_frames=0;
-    PacketDesc *pkt_desc= stream->premux_packet;
-
-    while(len>0){
-        if(pkt_desc->size == pkt_desc->unwritten_size)
-            nb_frames++;
-        len -= pkt_desc->unwritten_size;
-        pkt_desc= pkt_desc->next;
-    }
-
-    return nb_frames;
-}
-
-/* flush the packet on stream stream_index */
-static int flush_packet(AVFormatContext *ctx, int stream_index,
-                         int64_t pts, int64_t dts, int64_t scr, int trailer_size)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    StreamInfo *stream = ctx->streams[stream_index]->priv_data;
-    uint8_t *buf_ptr;
-    int size, payload_size, startcode, id, stuffing_size, i, header_len;
-    int packet_size;
-    uint8_t buffer[128];
-    int zero_trail_bytes = 0;
-    int pad_packet_bytes = 0;
-    int pes_flags;
-    int general_pack = 0;  /*"general" pack without data specific to one stream?*/
-    int nb_frames;
-
-    id = stream->id;
-
-#if 0
-    printf("packet ID=%2x PTS=%0.3f\n",
-           id, pts / 90000.0);
-#endif
-
-    buf_ptr = buffer;
-
-    if ((s->packet_number % s->pack_header_freq) == 0 || s->last_scr != scr) {
-        /* output pack and systems header if needed */
-        size = put_pack_header(ctx, buf_ptr, scr);
-        buf_ptr += size;
-        s->last_scr= scr;
-
-        if (s->is_vcd) {
-            /* there is exactly one system header for each stream in a VCD MPEG,
-               One in the very first video packet and one in the very first
-               audio packet (see VCD standard p. IV-7 and IV-8).*/
-
-            if (stream->packet_number==0) {
-                size = put_system_header(ctx, buf_ptr, id);
-                buf_ptr += size;
-            }
-        } else if (s->is_dvd) {
-            if (stream->align_iframe || s->packet_number == 0){
-                int PES_bytes_to_fill = s->packet_size - size - 10;
-
-                if (pts != AV_NOPTS_VALUE) {
-                    if (dts != pts)
-                        PES_bytes_to_fill -= 5 + 5;
-                    else
-                        PES_bytes_to_fill -= 5;
-                }
-
-                if (stream->bytes_to_iframe == 0 || s->packet_number == 0) {
-                    size = put_system_header(ctx, buf_ptr, 0);
-                    buf_ptr += size;
-                    size = buf_ptr - buffer;
-                    put_buffer(ctx->pb, buffer, size);
-
-                    put_be32(ctx->pb, PRIVATE_STREAM_2);
-                    put_be16(ctx->pb, 0x03d4);         // length
-                    put_byte(ctx->pb, 0x00);           // substream ID, 00=PCI
-                    for (i = 0; i < 979; i++)
-                        put_byte(ctx->pb, 0x00);
-
-                    put_be32(ctx->pb, PRIVATE_STREAM_2);
-                    put_be16(ctx->pb, 0x03fa);         // length
-                    put_byte(ctx->pb, 0x01);           // substream ID, 01=DSI
-                    for (i = 0; i < 1017; i++)
-                        put_byte(ctx->pb, 0x00);
-
-                    memset(buffer, 0, 128);
-                    buf_ptr = buffer;
-                    s->packet_number++;
-                    stream->align_iframe = 0;
-                    scr += s->packet_size*90000LL / (s->mux_rate*50LL); //FIXME rounding and first few bytes of each packet
-                    size = put_pack_header(ctx, buf_ptr, scr);
-                    s->last_scr= scr;
-                    buf_ptr += size;
-                    /* GOP Start */
-                } else if (stream->bytes_to_iframe < PES_bytes_to_fill) {
-                    pad_packet_bytes = PES_bytes_to_fill - stream->bytes_to_iframe;
-                }
-            }
-        } else {
-            if ((s->packet_number % s->system_header_freq) == 0) {
-                size = put_system_header(ctx, buf_ptr, 0);
-                buf_ptr += size;
-            }
-        }
-    }
-    size = buf_ptr - buffer;
-    put_buffer(ctx->pb, buffer, size);
-
-    packet_size = s->packet_size - size;
-
-    if (s->is_vcd && (id & 0xe0) == AUDIO_ID)
-        /* The VCD standard demands that 20 zero bytes follow
-           each audio pack (see standard p. IV-8).*/
-        zero_trail_bytes += 20;
-
-    if ((s->is_vcd && stream->packet_number==0)
-        || (s->is_svcd && s->packet_number==0)) {
-        /* for VCD the first pack of each stream contains only the pack header,
-           the system header and lots of padding (see VCD standard p. IV-6).
-           In the case of an audio pack, 20 zero bytes are also added at
-           the end.*/
-        /* For SVCD we fill the very first pack to increase compatibility with
-           some DVD players. Not mandated by the standard.*/
-        if (s->is_svcd)
-            general_pack = 1;    /* the system header refers to both streams and no stream data*/
-        pad_packet_bytes = packet_size - zero_trail_bytes;
-    }
-
-    packet_size -= pad_packet_bytes + zero_trail_bytes;
-
-    if (packet_size > 0) {
-
-        /* packet header size */
-        packet_size -= 6;
-
-        /* packet header */
-        if (s->is_mpeg2) {
-            header_len = 3;
-            if (stream->packet_number==0)
-                header_len += 3; /* PES extension */
-            header_len += 1; /* obligatory stuffing byte */
-        } else {
-            header_len = 0;
-        }
-        if (pts != AV_NOPTS_VALUE) {
-            if (dts != pts)
-                header_len += 5 + 5;
-            else
-                header_len += 5;
-        } else {
-            if (!s->is_mpeg2)
-                header_len++;
-        }
-
-        payload_size = packet_size - header_len;
-        if (id < 0xc0) {
-            startcode = PRIVATE_STREAM_1;
-            payload_size -= 1;
-            if (id >= 0x40) {
-                payload_size -= 3;
-                if (id >= 0xa0)
-                    payload_size -= 3;
-            }
-        } else {
-            startcode = 0x100 + id;
-        }
-
-        stuffing_size = payload_size - av_fifo_size(stream->fifo);
-
-        // first byte does not fit -> reset pts/dts + stuffing
-        if(payload_size <= trailer_size && pts != AV_NOPTS_VALUE){
-            int timestamp_len=0;
-            if(dts != pts)
-                timestamp_len += 5;
-            if(pts != AV_NOPTS_VALUE)
-                timestamp_len += s->is_mpeg2 ? 5 : 4;
-            pts=dts= AV_NOPTS_VALUE;
-            header_len -= timestamp_len;
-            if (s->is_dvd && stream->align_iframe) {
-                pad_packet_bytes += timestamp_len;
-                packet_size  -= timestamp_len;
-            } else {
-                payload_size += timestamp_len;
-            }
-            stuffing_size += timestamp_len;
-            if(payload_size > trailer_size)
-                stuffing_size += payload_size - trailer_size;
-        }
-
-        if (pad_packet_bytes > 0 && pad_packet_bytes <= 7) { // can't use padding, so use stuffing
-            packet_size += pad_packet_bytes;
-            payload_size += pad_packet_bytes; // undo the previous adjustment
-            if (stuffing_size < 0) {
-                stuffing_size  = pad_packet_bytes;
-            } else {
-                stuffing_size += pad_packet_bytes;
-            }
-            pad_packet_bytes = 0;
-        }
-
-        if (stuffing_size < 0)
-            stuffing_size = 0;
-        if (stuffing_size > 16) {    /*<=16 for MPEG-1, <=32 for MPEG-2*/
-            pad_packet_bytes += stuffing_size;
-            packet_size      -= stuffing_size;
-            payload_size     -= stuffing_size;
-            stuffing_size = 0;
-        }
-
-        nb_frames= get_nb_frames(ctx, stream, payload_size - stuffing_size);
-
-        put_be32(ctx->pb, startcode);
-
-        put_be16(ctx->pb, packet_size);
-
-        if (!s->is_mpeg2)
-            for(i=0;i<stuffing_size;i++)
-                put_byte(ctx->pb, 0xff);
-
-        if (s->is_mpeg2) {
-            put_byte(ctx->pb, 0x80); /* mpeg2 id */
-
-            pes_flags=0;
-
-            if (pts != AV_NOPTS_VALUE) {
-                pes_flags |= 0x80;
-                if (dts != pts)
-                    pes_flags |= 0x40;
-            }
-
-            /* Both the MPEG-2 and the SVCD standards demand that the
-               P-STD_buffer_size field be included in the first packet of
-               every stream. (see SVCD standard p. 26 V.2.3.1 and V.2.3.2
-               and MPEG-2 standard 2.7.7) */
-            if (stream->packet_number == 0)
-                pes_flags |= 0x01;
-
-            put_byte(ctx->pb, pes_flags); /* flags */
-            put_byte(ctx->pb, header_len - 3 + stuffing_size);
-
-            if (pes_flags & 0x80)  /*write pts*/
-                put_timestamp(ctx->pb, (pes_flags & 0x40) ? 0x03 : 0x02, pts);
-            if (pes_flags & 0x40)  /*write dts*/
-                put_timestamp(ctx->pb, 0x01, dts);
-
-            if (pes_flags & 0x01) {  /*write pes extension*/
-                put_byte(ctx->pb, 0x10); /* flags */
-
-                /* P-STD buffer info */
-                if ((id & 0xe0) == AUDIO_ID)
-                    put_be16(ctx->pb, 0x4000 | stream->max_buffer_size/ 128);
-                else
-                    put_be16(ctx->pb, 0x6000 | stream->max_buffer_size/1024);
-            }
-
-        } else {
-            if (pts != AV_NOPTS_VALUE) {
-                if (dts != pts) {
-                    put_timestamp(ctx->pb, 0x03, pts);
-                    put_timestamp(ctx->pb, 0x01, dts);
-                } else {
-                    put_timestamp(ctx->pb, 0x02, pts);
-                }
-            } else {
-                put_byte(ctx->pb, 0x0f);
-            }
-        }
-
-        if (s->is_mpeg2) {
-            /* special stuffing byte that is always written
-               to prevent accidental generation of start codes. */
-            put_byte(ctx->pb, 0xff);
-
-            for(i=0;i<stuffing_size;i++)
-                put_byte(ctx->pb, 0xff);
-        }
-
-        if (startcode == PRIVATE_STREAM_1) {
-            put_byte(ctx->pb, id);
-            if (id >= 0xa0) {
-                /* LPCM (XXX: check nb_frames) */
-                put_byte(ctx->pb, 7);
-                put_be16(ctx->pb, 4); /* skip 3 header bytes */
-                put_byte(ctx->pb, stream->lpcm_header[0]);
-                put_byte(ctx->pb, stream->lpcm_header[1]);
-                put_byte(ctx->pb, stream->lpcm_header[2]);
-            } else if (id >= 0x40) {
-                /* AC-3 */
-                put_byte(ctx->pb, nb_frames);
-                put_be16(ctx->pb, trailer_size+1);
-            }
-        }
-
-        /* output data */
-        assert(payload_size - stuffing_size <= av_fifo_size(stream->fifo));
-        av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &put_buffer);
-        stream->bytes_to_iframe -= payload_size - stuffing_size;
-    }else{
-        payload_size=
-        stuffing_size= 0;
-    }
-
-    if (pad_packet_bytes > 0)
-        put_padding_packet(ctx,ctx->pb, pad_packet_bytes);
-
-    for(i=0;i<zero_trail_bytes;i++)
-        put_byte(ctx->pb, 0x00);
-
-    put_flush_packet(ctx->pb);
-
-    s->packet_number++;
-
-    /* only increase the stream packet number if this pack actually contains
-       something that is specific to this stream! I.e. a dedicated header
-       or some data.*/
-    if (!general_pack)
-        stream->packet_number++;
-
-    return payload_size - stuffing_size;
-}
-
-static void put_vcd_padding_sector(AVFormatContext *ctx)
-{
-    /* There are two ways to do this padding: writing a sector/pack
-       of 0 values, or writing an MPEG padding pack. Both seem to
-       work with most decoders, BUT the VCD standard only allows a 0-sector
-       (see standard p. IV-4, IV-5).
-       So a 0-sector it is...*/
-
-    MpegMuxContext *s = ctx->priv_data;
-    int i;
-
-    for(i=0;i<s->packet_size;i++)
-        put_byte(ctx->pb, 0);
-
-    s->vcd_padding_bytes_written += s->packet_size;
-
-    put_flush_packet(ctx->pb);
-
-    /* increasing the packet number is correct. The SCR of the following packs
-       is calculated from the packet_number and it has to include the padding
-       sector (it represents the sector index, not the MPEG pack index)
-       (see VCD standard p. IV-6)*/
-    s->packet_number++;
-}
-
-#if 0 /* unused, remove? */
-static int64_t get_vcd_scr(AVFormatContext *ctx,int stream_index,int64_t pts)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    int64_t scr;
-
-        /* Since the data delivery rate is constant, SCR is computed
-           using the formula C + i * 1200 where C is the start constant
-           and i is the pack index.
-           It is recommended that SCR 0 is at the beginning of the VCD front
-           margin (a sequence of empty Form 2 sectors on the CD).
-           It is recommended that the front margin is 30 sectors long, so
-           we use C = 30*1200 = 36000
-           (Note that even if the front margin is not 30 sectors the file
-           will still be correct according to the standard. It just won't have
-           the "recommended" value).*/
-        scr = 36000 + s->packet_number * 1200;
-
-    return scr;
-}
-#endif
-
-static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){
-//    MpegMuxContext *s = ctx->priv_data;
-    int i;
-
-    for(i=0; i<ctx->nb_streams; i++){
-        AVStream *st = ctx->streams[i];
-        StreamInfo *stream = st->priv_data;
-        PacketDesc *pkt_desc;
-
-        while((pkt_desc= stream->predecode_packet)
-              && scr > pkt_desc->dts){ //FIXME > vs >=
-            if(stream->buffer_index < pkt_desc->size ||
-               stream->predecode_packet == stream->premux_packet){
-                av_log(ctx, AV_LOG_ERROR,
-                       "buffer underflow i=%d bufi=%d size=%d\n",
-                       i, stream->buffer_index, pkt_desc->size);
-                break;
-            }
-            stream->buffer_index -= pkt_desc->size;
-
-            stream->predecode_packet= pkt_desc->next;
-            av_freep(&pkt_desc);
-        }
-    }
-
-    return 0;
-}
-
-static int output_packet(AVFormatContext *ctx, int flush){
-    MpegMuxContext *s = ctx->priv_data;
-    AVStream *st;
-    StreamInfo *stream;
-    int i, avail_space=0, es_size, trailer_size;
-    int best_i= -1;
-    int best_score= INT_MIN;
-    int ignore_constraints=0;
-    int64_t scr= s->last_scr;
-    PacketDesc *timestamp_packet;
-    const int64_t max_delay= av_rescale(ctx->max_delay, 90000, AV_TIME_BASE);
-
-retry:
-    for(i=0; i<ctx->nb_streams; i++){
-        AVStream *st = ctx->streams[i];
-        StreamInfo *stream = st->priv_data;
-        const int avail_data=  av_fifo_size(stream->fifo);
-        const int space= stream->max_buffer_size - stream->buffer_index;
-        int rel_space= 1024*space / stream->max_buffer_size;
-        PacketDesc *next_pkt= stream->premux_packet;
-
-        /* for subtitle, a single PES packet must be generated,
-           so we flush after every single subtitle packet */
-        if(s->packet_size > avail_data && !flush
-           && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE)
-            return 0;
-        if(avail_data==0)
-            continue;
-        assert(avail_data>0);
-
-        if(space < s->packet_size && !ignore_constraints)
-            continue;
-
-        if(next_pkt && next_pkt->dts - scr > max_delay)
-            continue;
-
-        if(rel_space > best_score){
-            best_score= rel_space;
-            best_i = i;
-            avail_space= space;
-        }
-    }
-
-    if(best_i < 0){
-        int64_t best_dts= INT64_MAX;
-
-        for(i=0; i<ctx->nb_streams; i++){
-            AVStream *st = ctx->streams[i];
-            StreamInfo *stream = st->priv_data;
-            PacketDesc *pkt_desc= stream->predecode_packet;
-            if(pkt_desc && pkt_desc->dts < best_dts)
-                best_dts= pkt_desc->dts;
-        }
-
-#if 0
-        av_log(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n",
-               scr/90000.0, best_dts/90000.0);
-#endif
-        if(best_dts == INT64_MAX)
-            return 0;
-
-        if(scr >= best_dts+1 && !ignore_constraints){
-            av_log(ctx, AV_LOG_ERROR, "packet too large, ignoring buffer limits to mux it\n");
-            ignore_constraints= 1;
-        }
-        scr= FFMAX(best_dts+1, scr);
-        if(remove_decoded_packets(ctx, scr) < 0)
-            return -1;
-        goto retry;
-    }
-
-    assert(best_i >= 0);
-
-    st = ctx->streams[best_i];
-    stream = st->priv_data;
-
-    assert(av_fifo_size(stream->fifo) > 0);
-
-    assert(avail_space >= s->packet_size || ignore_constraints);
-
-    timestamp_packet= stream->premux_packet;
-    if(timestamp_packet->unwritten_size == timestamp_packet->size){
-        trailer_size= 0;
-    }else{
-        trailer_size= timestamp_packet->unwritten_size;
-        timestamp_packet= timestamp_packet->next;
-    }
-
-    if(timestamp_packet){
-//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f scr:%f stream:%d\n", timestamp_packet->dts/90000.0, timestamp_packet->pts/90000.0, scr/90000.0, best_i);
-        es_size= flush_packet(ctx, best_i, timestamp_packet->pts, timestamp_packet->dts, scr, trailer_size);
-    }else{
-        assert(av_fifo_size(stream->fifo) == trailer_size);
-        es_size= flush_packet(ctx, best_i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, scr, trailer_size);
-    }
-
-    if (s->is_vcd) {
-        /* Write one or more padding sectors, if necessary, to reach
-           the constant overall bitrate.*/
-        int vcd_pad_bytes;
-
-        while((vcd_pad_bytes = get_vcd_padding_size(ctx,stream->premux_packet->pts) ) >= s->packet_size){ //FIXME pts cannot be correct here
-            put_vcd_padding_sector(ctx);
-            s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); //FIXME rounding and first few bytes of each packet
-        }
-    }
-
-    stream->buffer_index += es_size;
-    s->last_scr += s->packet_size*90000LL / (s->mux_rate*50LL); //FIXME rounding and first few bytes of each packet
-
-    while(stream->premux_packet && stream->premux_packet->unwritten_size <= es_size){
-        es_size -= stream->premux_packet->unwritten_size;
-        stream->premux_packet= stream->premux_packet->next;
-    }
-    if(es_size)
-        stream->premux_packet->unwritten_size -= es_size;
-
-    if(remove_decoded_packets(ctx, s->last_scr) < 0)
-        return -1;
-
-    return 1;
-}
-
-static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
-{
-    MpegMuxContext *s = ctx->priv_data;
-    int stream_index= pkt->stream_index;
-    int size= pkt->size;
-    uint8_t *buf= pkt->data;
-    AVStream *st = ctx->streams[stream_index];
-    StreamInfo *stream = st->priv_data;
-    int64_t pts, dts;
-    PacketDesc *pkt_desc;
-    const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE);
-    const int is_iframe = st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY);
-
-    pts= pkt->pts;
-    dts= pkt->dts;
-
-    if(pts != AV_NOPTS_VALUE) pts += preload;
-    if(dts != AV_NOPTS_VALUE) dts += preload;
-
-//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
-    if (!stream->premux_packet)
-        stream->next_packet = &stream->premux_packet;
-    *stream->next_packet=
-    pkt_desc= av_mallocz(sizeof(PacketDesc));
-    pkt_desc->pts= pts;
-    pkt_desc->dts= dts;
-    pkt_desc->unwritten_size=
-    pkt_desc->size= size;
-    if(!stream->predecode_packet)
-        stream->predecode_packet= pkt_desc;
-    stream->next_packet= &pkt_desc->next;
-
-    if (av_fifo_realloc2(stream->fifo, av_fifo_size(stream->fifo) + size) < 0)
-        return -1;
-
-    if (s->is_dvd){
-        if (is_iframe && (s->packet_number == 0 || (pts - stream->vobu_start_pts >= 36000))) { // min VOBU length 0.4 seconds (mpucoder)
-            stream->bytes_to_iframe = av_fifo_size(stream->fifo);
-            stream->align_iframe = 1;
-            stream->vobu_start_pts = pts;
-        }
-    }
-
-    av_fifo_generic_write(stream->fifo, buf, size, NULL);
-
-    for(;;){
-        int ret= output_packet(ctx, 0);
-        if(ret<=0)
-            return ret;
-    }
-}
-
-static int mpeg_mux_end(AVFormatContext *ctx)
-{
-//    MpegMuxContext *s = ctx->priv_data;
-    StreamInfo *stream;
-    int i;
-
-    for(;;){
-        int ret= output_packet(ctx, 1);
-        if(ret<0)
-            return ret;
-        else if(ret==0)
-            break;
-    }
-
-    /* End header according to MPEG1 systems standard. We do not write
-       it as it is usually not needed by decoders and because it
-       complicates MPEG stream concatenation. */
-    //put_be32(ctx->pb, ISO_11172_END_CODE);
-    //put_flush_packet(ctx->pb);
-
-    for(i=0;i<ctx->nb_streams;i++) {
-        stream = ctx->streams[i]->priv_data;
-
-        assert(av_fifo_size(stream->fifo) == 0);
-        av_fifo_free(stream->fifo);
-    }
-    return 0;
-}
-
-#if CONFIG_MPEG1SYSTEM_MUXER
-AVOutputFormat mpeg1system_muxer = {
-    "mpeg",
-    NULL_IF_CONFIG_SMALL("MPEG-1 System format"),
-    "video/mpeg",
-    "mpg,mpeg",
-    sizeof(MpegMuxContext),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG1VIDEO,
-    mpeg_mux_init,
-    mpeg_mux_write_packet,
-    mpeg_mux_end,
-};
-#endif
-#if CONFIG_MPEG1VCD_MUXER
-AVOutputFormat mpeg1vcd_muxer = {
-    "vcd",
-    NULL_IF_CONFIG_SMALL("MPEG-1 System format (VCD)"),
-    "video/mpeg",
-    NULL,
-    sizeof(MpegMuxContext),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG1VIDEO,
-    mpeg_mux_init,
-    mpeg_mux_write_packet,
-    mpeg_mux_end,
-};
-#endif
-#if CONFIG_MPEG2VOB_MUXER
-AVOutputFormat mpeg2vob_muxer = {
-    "vob",
-    NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"),
-    "video/mpeg",
-    "vob",
-    sizeof(MpegMuxContext),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG2VIDEO,
-    mpeg_mux_init,
-    mpeg_mux_write_packet,
-    mpeg_mux_end,
-};
-#endif
-
-/* Same as mpeg2vob_mux except that the pack size is 2324 */
-#if CONFIG_MPEG2SVCD_MUXER
-AVOutputFormat mpeg2svcd_muxer = {
-    "svcd",
-    NULL_IF_CONFIG_SMALL("MPEG-2 PS format (VOB)"),
-    "video/mpeg",
-    "vob",
-    sizeof(MpegMuxContext),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG2VIDEO,
-    mpeg_mux_init,
-    mpeg_mux_write_packet,
-    mpeg_mux_end,
-};
-#endif
-
-/*  Same as mpeg2vob_mux except the 'is_dvd' flag is set to produce NAV pkts */
-#if CONFIG_MPEG2DVD_MUXER
-AVOutputFormat mpeg2dvd_muxer = {
-    "dvd",
-    NULL_IF_CONFIG_SMALL("MPEG-2 PS format (DVD VOB)"),
-    "video/mpeg",
-    "dvd",
-    sizeof(MpegMuxContext),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG2VIDEO,
-    mpeg_mux_init,
-    mpeg_mux_write_packet,
-    mpeg_mux_end,
-};
-#endif
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
deleted file mode 100644
index 5960338..0000000
--- a/libavformat/mpegts.c
+++ /dev/null
@@ -1,1785 +0,0 @@
-/*
- * MPEG2 transport stream (aka DVB) demuxer
- * Copyright (c) 2002-2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define DEBUG
-//#define DEBUG_SEEK
-//#define USE_SYNCPOINT_SEARCH
-
-#include "libavutil/crc.h"
-#include "libavutil/intreadwrite.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "mpegts.h"
-#include "internal.h"
-#include "seek.h"
-
-/* 1.0 second at 24Mbit/s */
-#define MAX_SCAN_PACKETS 32000
-
-/* maximum size in which we look for synchronisation if
-   synchronisation is lost */
-#define MAX_RESYNC_SIZE 65536
-
-#define MAX_PES_PAYLOAD 200*1024
-
-enum MpegTSFilterType {
-    MPEGTS_PES,
-    MPEGTS_SECTION,
-};
-
-typedef struct MpegTSFilter MpegTSFilter;
-
-typedef int PESCallback(MpegTSFilter *f, const uint8_t *buf, int len, int is_start, int64_t pos);
-
-typedef struct MpegTSPESFilter {
-    PESCallback *pes_cb;
-    void *opaque;
-} MpegTSPESFilter;
-
-typedef void SectionCallback(MpegTSFilter *f, const uint8_t *buf, int len);
-
-typedef void SetServiceCallback(void *opaque, int ret);
-
-typedef struct MpegTSSectionFilter {
-    int section_index;
-    int section_h_size;
-    uint8_t *section_buf;
-    unsigned int check_crc:1;
-    unsigned int end_of_section_reached:1;
-    SectionCallback *section_cb;
-    void *opaque;
-} MpegTSSectionFilter;
-
-struct MpegTSFilter {
-    int pid;
-    int last_cc; /* last cc code (-1 if first packet) */
-    enum MpegTSFilterType type;
-    union {
-        MpegTSPESFilter pes_filter;
-        MpegTSSectionFilter section_filter;
-    } u;
-};
-
-#define MAX_PIDS_PER_PROGRAM 64
-struct Program {
-    unsigned int id; //program id/service id
-    unsigned int nb_pids;
-    unsigned int pids[MAX_PIDS_PER_PROGRAM];
-};
-
-struct MpegTSContext {
-    /* user data */
-    AVFormatContext *stream;
-    /** raw packet size, including FEC if present            */
-    int raw_packet_size;
-
-    int pos47;
-
-    /** if true, all pids are analyzed to find streams       */
-    int auto_guess;
-
-    /** compute exact PCR for each transport stream packet   */
-    int mpeg2ts_compute_pcr;
-
-    int64_t cur_pcr;    /**< used to estimate the exact PCR  */
-    int pcr_incr;       /**< used to estimate the exact PCR  */
-
-    /* data needed to handle file based ts */
-    /** stop parsing loop                                    */
-    int stop_parse;
-    /** packet containing Audio/Video data                   */
-    AVPacket *pkt;
-    /** to detect seek                                       */
-    int64_t last_pos;
-
-    /******************************************/
-    /* private mpegts data */
-    /* scan context */
-    /** structure to keep track of Program->pids mapping     */
-    unsigned int nb_prg;
-    struct Program *prg;
-
-
-    /** filters for various streams specified by PMT + for the PAT and PMT */
-    MpegTSFilter *pids[NB_PID_MAX];
-};
-
-/* TS stream handling */
-
-enum MpegTSState {
-    MPEGTS_HEADER = 0,
-    MPEGTS_PESHEADER,
-    MPEGTS_PESHEADER_FILL,
-    MPEGTS_PAYLOAD,
-    MPEGTS_SKIP,
-};
-
-/* enough for PES header + length */
-#define PES_START_SIZE  6
-#define PES_HEADER_SIZE 9
-#define MAX_PES_HEADER_SIZE (9 + 255)
-
-typedef struct PESContext {
-    int pid;
-    int pcr_pid; /**< if -1 then all packets containing PCR are considered */
-    int stream_type;
-    MpegTSContext *ts;
-    AVFormatContext *stream;
-    AVStream *st;
-    AVStream *sub_st; /**< stream for the embedded AC3 stream in HDMV TrueHD */
-    enum MpegTSState state;
-    /* used to get the format */
-    int data_index;
-    int total_size;
-    int pes_header_size;
-    int extended_stream_id;
-    int64_t pts, dts;
-    int64_t ts_packet_pos; /**< position of first TS packet of this PES packet */
-    uint8_t header[MAX_PES_HEADER_SIZE];
-    uint8_t *buffer;
-} PESContext;
-
-extern AVInputFormat mpegts_demuxer;
-
-static void clear_program(MpegTSContext *ts, unsigned int programid)
-{
-    int i;
-
-    for(i=0; i<ts->nb_prg; i++)
-        if(ts->prg[i].id == programid)
-            ts->prg[i].nb_pids = 0;
-}
-
-static void clear_programs(MpegTSContext *ts)
-{
-    av_freep(&ts->prg);
-    ts->nb_prg=0;
-}
-
-static void add_pat_entry(MpegTSContext *ts, unsigned int programid)
-{
-    struct Program *p;
-    void *tmp = av_realloc(ts->prg, (ts->nb_prg+1)*sizeof(struct Program));
-    if(!tmp)
-        return;
-    ts->prg = tmp;
-    p = &ts->prg[ts->nb_prg];
-    p->id = programid;
-    p->nb_pids = 0;
-    ts->nb_prg++;
-}
-
-static void add_pid_to_pmt(MpegTSContext *ts, unsigned int programid, unsigned int pid)
-{
-    int i;
-    struct Program *p = NULL;
-    for(i=0; i<ts->nb_prg; i++) {
-        if(ts->prg[i].id == programid) {
-            p = &ts->prg[i];
-            break;
-        }
-    }
-    if(!p)
-        return;
-
-    if(p->nb_pids >= MAX_PIDS_PER_PROGRAM)
-        return;
-    p->pids[p->nb_pids++] = pid;
-}
-
-/**
- * \brief discard_pid() decides if the pid is to be discarded according
- *                      to caller's programs selection
- * \param ts    : - TS context
- * \param pid   : - pid
- * \return 1 if the pid is only comprised in programs that have .discard=AVDISCARD_ALL
- *         0 otherwise
- */
-static int discard_pid(MpegTSContext *ts, unsigned int pid)
-{
-    int i, j, k;
-    int used = 0, discarded = 0;
-    struct Program *p;
-    for(i=0; i<ts->nb_prg; i++) {
-        p = &ts->prg[i];
-        for(j=0; j<p->nb_pids; j++) {
-            if(p->pids[j] != pid)
-                continue;
-            //is program with id p->id set to be discarded?
-            for(k=0; k<ts->stream->nb_programs; k++) {
-                if(ts->stream->programs[k]->id == p->id) {
-                    if(ts->stream->programs[k]->discard == AVDISCARD_ALL)
-                        discarded++;
-                    else
-                        used++;
-                }
-            }
-        }
-    }
-
-    return !used && discarded;
-}
-
-/**
- *  Assembles PES packets out of TS packets, and then calls the "section_cb"
- *  function when they are complete.
- */
-static void write_section_data(AVFormatContext *s, MpegTSFilter *tss1,
-                               const uint8_t *buf, int buf_size, int is_start)
-{
-    MpegTSSectionFilter *tss = &tss1->u.section_filter;
-    int len;
-
-    if (is_start) {
-        memcpy(tss->section_buf, buf, buf_size);
-        tss->section_index = buf_size;
-        tss->section_h_size = -1;
-        tss->end_of_section_reached = 0;
-    } else {
-        if (tss->end_of_section_reached)
-            return;
-        len = 4096 - tss->section_index;
-        if (buf_size < len)
-            len = buf_size;
-        memcpy(tss->section_buf + tss->section_index, buf, len);
-        tss->section_index += len;
-    }
-
-    /* compute section length if possible */
-    if (tss->section_h_size == -1 && tss->section_index >= 3) {
-        len = (AV_RB16(tss->section_buf + 1) & 0xfff) + 3;
-        if (len > 4096)
-            return;
-        tss->section_h_size = len;
-    }
-
-    if (tss->section_h_size != -1 && tss->section_index >= tss->section_h_size) {
-        tss->end_of_section_reached = 1;
-        if (!tss->check_crc ||
-            av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1,
-                   tss->section_buf, tss->section_h_size) == 0)
-            tss->section_cb(tss1, tss->section_buf, tss->section_h_size);
-    }
-}
-
-static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int pid,
-                                         SectionCallback *section_cb, void *opaque,
-                                         int check_crc)
-
-{
-    MpegTSFilter *filter;
-    MpegTSSectionFilter *sec;
-
-    dprintf(ts->stream, "Filter: pid=0x%x\n", pid);
-
-    if (pid >= NB_PID_MAX || ts->pids[pid])
-        return NULL;
-    filter = av_mallocz(sizeof(MpegTSFilter));
-    if (!filter)
-        return NULL;
-    ts->pids[pid] = filter;
-    filter->type = MPEGTS_SECTION;
-    filter->pid = pid;
-    filter->last_cc = -1;
-    sec = &filter->u.section_filter;
-    sec->section_cb = section_cb;
-    sec->opaque = opaque;
-    sec->section_buf = av_malloc(MAX_SECTION_SIZE);
-    sec->check_crc = check_crc;
-    if (!sec->section_buf) {
-        av_free(filter);
-        return NULL;
-    }
-    return filter;
-}
-
-static MpegTSFilter *mpegts_open_pes_filter(MpegTSContext *ts, unsigned int pid,
-                                     PESCallback *pes_cb,
-                                     void *opaque)
-{
-    MpegTSFilter *filter;
-    MpegTSPESFilter *pes;
-
-    if (pid >= NB_PID_MAX || ts->pids[pid])
-        return NULL;
-    filter = av_mallocz(sizeof(MpegTSFilter));
-    if (!filter)
-        return NULL;
-    ts->pids[pid] = filter;
-    filter->type = MPEGTS_PES;
-    filter->pid = pid;
-    filter->last_cc = -1;
-    pes = &filter->u.pes_filter;
-    pes->pes_cb = pes_cb;
-    pes->opaque = opaque;
-    return filter;
-}
-
-static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
-{
-    int pid;
-
-    pid = filter->pid;
-    if (filter->type == MPEGTS_SECTION)
-        av_freep(&filter->u.section_filter.section_buf);
-    else if (filter->type == MPEGTS_PES) {
-        PESContext *pes = filter->u.pes_filter.opaque;
-        av_freep(&pes->buffer);
-        /* referenced private data will be freed later in
-         * av_close_input_stream */
-        if (!((PESContext *)filter->u.pes_filter.opaque)->st) {
-            av_freep(&filter->u.pes_filter.opaque);
-        }
-    }
-
-    av_free(filter);
-    ts->pids[pid] = NULL;
-}
-
-static int analyze(const uint8_t *buf, int size, int packet_size, int *index){
-    int stat[TS_MAX_PACKET_SIZE];
-    int i;
-    int x=0;
-    int best_score=0;
-
-    memset(stat, 0, packet_size*sizeof(int));
-
-    for(x=i=0; i<size-3; i++){
-        if(buf[i] == 0x47 && !(buf[i+1] & 0x80) && (buf[i+3] & 0x30)){
-            stat[x]++;
-            if(stat[x] > best_score){
-                best_score= stat[x];
-                if(index) *index= x;
-            }
-        }
-
-        x++;
-        if(x == packet_size) x= 0;
-    }
-
-    return best_score;
-}
-
-/* autodetect fec presence. Must have at least 1024 bytes  */
-static int get_packet_size(const uint8_t *buf, int size)
-{
-    int score, fec_score, dvhs_score;
-
-    if (size < (TS_FEC_PACKET_SIZE * 5 + 1))
-        return -1;
-
-    score    = analyze(buf, size, TS_PACKET_SIZE, NULL);
-    dvhs_score    = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL);
-    fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL);
-//    av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
-
-    if     (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE;
-    else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE;
-    else if(score < fec_score && dvhs_score < fec_score) return TS_FEC_PACKET_SIZE;
-    else                       return -1;
-}
-
-typedef struct SectionHeader {
-    uint8_t tid;
-    uint16_t id;
-    uint8_t version;
-    uint8_t sec_num;
-    uint8_t last_sec_num;
-} SectionHeader;
-
-static inline int get8(const uint8_t **pp, const uint8_t *p_end)
-{
-    const uint8_t *p;
-    int c;
-
-    p = *pp;
-    if (p >= p_end)
-        return -1;
-    c = *p++;
-    *pp = p;
-    return c;
-}
-
-static inline int get16(const uint8_t **pp, const uint8_t *p_end)
-{
-    const uint8_t *p;
-    int c;
-
-    p = *pp;
-    if ((p + 1) >= p_end)
-        return -1;
-    c = AV_RB16(p);
-    p += 2;
-    *pp = p;
-    return c;
-}
-
-/* read and allocate a DVB string preceeded by its length */
-static char *getstr8(const uint8_t **pp, const uint8_t *p_end)
-{
-    int len;
-    const uint8_t *p;
-    char *str;
-
-    p = *pp;
-    len = get8(&p, p_end);
-    if (len < 0)
-        return NULL;
-    if ((p + len) > p_end)
-        return NULL;
-    str = av_malloc(len + 1);
-    if (!str)
-        return NULL;
-    memcpy(str, p, len);
-    str[len] = '\0';
-    p += len;
-    *pp = p;
-    return str;
-}
-
-static int parse_section_header(SectionHeader *h,
-                                const uint8_t **pp, const uint8_t *p_end)
-{
-    int val;
-
-    val = get8(pp, p_end);
-    if (val < 0)
-        return -1;
-    h->tid = val;
-    *pp += 2;
-    val = get16(pp, p_end);
-    if (val < 0)
-        return -1;
-    h->id = val;
-    val = get8(pp, p_end);
-    if (val < 0)
-        return -1;
-    h->version = (val >> 1) & 0x1f;
-    val = get8(pp, p_end);
-    if (val < 0)
-        return -1;
-    h->sec_num = val;
-    val = get8(pp, p_end);
-    if (val < 0)
-        return -1;
-    h->last_sec_num = val;
-    return 0;
-}
-
-typedef struct {
-    uint32_t stream_type;
-    enum AVMediaType codec_type;
-    enum CodecID codec_id;
-} StreamType;
-
-static const StreamType ISO_types[] = {
-    { 0x01, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO },
-    { 0x02, AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO },
-    { 0x03, AVMEDIA_TYPE_AUDIO,        CODEC_ID_MP3 },
-    { 0x04, AVMEDIA_TYPE_AUDIO,        CODEC_ID_MP3 },
-    { 0x0f, AVMEDIA_TYPE_AUDIO,        CODEC_ID_AAC },
-    { 0x10, AVMEDIA_TYPE_VIDEO,      CODEC_ID_MPEG4 },
-  //{ 0x11, AVMEDIA_TYPE_AUDIO,        CODEC_ID_AAC }, /* LATM syntax */
-    { 0x1b, AVMEDIA_TYPE_VIDEO,       CODEC_ID_H264 },
-    { 0xd1, AVMEDIA_TYPE_VIDEO,      CODEC_ID_DIRAC },
-    { 0xea, AVMEDIA_TYPE_VIDEO,        CODEC_ID_VC1 },
-    { 0 },
-};
-
-static const StreamType HDMV_types[] = {
-    { 0x80, AVMEDIA_TYPE_AUDIO, CODEC_ID_PCM_BLURAY },
-    { 0x81, AVMEDIA_TYPE_AUDIO, CODEC_ID_AC3 },
-    { 0x82, AVMEDIA_TYPE_AUDIO, CODEC_ID_DTS },
-    { 0x83, AVMEDIA_TYPE_AUDIO, CODEC_ID_TRUEHD },
-    { 0x84, AVMEDIA_TYPE_AUDIO, CODEC_ID_EAC3 },
-    { 0x90, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_HDMV_PGS_SUBTITLE },
-    { 0 },
-};
-
-/* ATSC ? */
-static const StreamType MISC_types[] = {
-    { 0x81, AVMEDIA_TYPE_AUDIO,   CODEC_ID_AC3 },
-    { 0x8a, AVMEDIA_TYPE_AUDIO,   CODEC_ID_DTS },
-    { 0 },
-};
-
-static const StreamType REGD_types[] = {
-    { MKTAG('d','r','a','c'), AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC },
-    { MKTAG('A','C','-','3'), AVMEDIA_TYPE_AUDIO,   CODEC_ID_AC3 },
-    { 0 },
-};
-
-/* descriptor present */
-static const StreamType DESC_types[] = {
-    { 0x6a, AVMEDIA_TYPE_AUDIO,             CODEC_ID_AC3 }, /* AC-3 descriptor */
-    { 0x7a, AVMEDIA_TYPE_AUDIO,            CODEC_ID_EAC3 }, /* E-AC-3 descriptor */
-    { 0x7b, AVMEDIA_TYPE_AUDIO,             CODEC_ID_DTS },
-    { 0x56, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_TELETEXT },
-    { 0x59, AVMEDIA_TYPE_SUBTITLE, CODEC_ID_DVB_SUBTITLE }, /* subtitling descriptor */
-    { 0 },
-};
-
-static void mpegts_find_stream_type(AVStream *st,
-                                    uint32_t stream_type, const StreamType *types)
-{
-    for (; types->stream_type; types++) {
-        if (stream_type == types->stream_type) {
-            st->codec->codec_type = types->codec_type;
-            st->codec->codec_id   = types->codec_id;
-            return;
-        }
-    }
-}
-
-static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
-                                  uint32_t stream_type, uint32_t prog_reg_desc)
-{
-    av_set_pts_info(st, 33, 1, 90000);
-    st->priv_data = pes;
-    st->codec->codec_type = AVMEDIA_TYPE_DATA;
-    st->codec->codec_id   = CODEC_ID_NONE;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-    pes->st = st;
-    pes->stream_type = stream_type;
-
-    av_log(pes->stream, AV_LOG_DEBUG,
-           "stream=%d stream_type=%x pid=%x prog_reg_desc=%.4s\n",
-           st->index, pes->stream_type, pes->pid, (char*)&prog_reg_desc);
-
-    st->codec->codec_tag = pes->stream_type;
-
-    mpegts_find_stream_type(st, pes->stream_type, ISO_types);
-    if (prog_reg_desc == AV_RL32("HDMV") &&
-        st->codec->codec_id == CODEC_ID_NONE) {
-        mpegts_find_stream_type(st, pes->stream_type, HDMV_types);
-        if (pes->stream_type == 0x83) {
-            // HDMV TrueHD streams also contain an AC3 coded version of the
-            // audio track - add a second stream for this
-            AVStream *sub_st;
-            // priv_data cannot be shared between streams
-            PESContext *sub_pes = av_malloc(sizeof(*sub_pes));
-            if (!sub_pes)
-                return AVERROR(ENOMEM);
-            memcpy(sub_pes, pes, sizeof(*sub_pes));
-
-            sub_st = av_new_stream(pes->stream, pes->pid);
-            if (!sub_st) {
-                av_free(sub_pes);
-                return AVERROR(ENOMEM);
-            }
-
-            av_set_pts_info(sub_st, 33, 1, 90000);
-            sub_st->priv_data = sub_pes;
-            sub_st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            sub_st->codec->codec_id   = CODEC_ID_AC3;
-            sub_st->need_parsing = AVSTREAM_PARSE_FULL;
-            sub_pes->sub_st = pes->sub_st = sub_st;
-        }
-    }
-    if (pes->stream_type == 0x11)
-        av_log(pes->stream, AV_LOG_WARNING,
-               "AAC LATM not currently supported, patch welcome\n");
-    if (st->codec->codec_id == CODEC_ID_NONE)
-        mpegts_find_stream_type(st, pes->stream_type, MISC_types);
-
-    return 0;
-}
-
-static int64_t get_pts(const uint8_t *p)
-{
-    int64_t pts = (int64_t)((p[0] >> 1) & 0x07) << 30;
-    pts |= (AV_RB16(p + 1) >> 1) << 15;
-    pts |=  AV_RB16(p + 3) >> 1;
-    return pts;
-}
-
-static void new_pes_packet(PESContext *pes, AVPacket *pkt)
-{
-    av_init_packet(pkt);
-
-    pkt->destruct = av_destruct_packet;
-    pkt->data = pes->buffer;
-    pkt->size = pes->data_index;
-    memset(pkt->data+pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
-    // Separate out the AC3 substream from an HDMV combined TrueHD/AC3 PID
-    if (pes->sub_st && pes->stream_type == 0x83 && pes->extended_stream_id == 0x76)
-        pkt->stream_index = pes->sub_st->index;
-    else
-        pkt->stream_index = pes->st->index;
-    pkt->pts = pes->pts;
-    pkt->dts = pes->dts;
-    /* store position of first TS packet of this PES packet */
-    pkt->pos = pes->ts_packet_pos;
-
-    /* reset pts values */
-    pes->pts = AV_NOPTS_VALUE;
-    pes->dts = AV_NOPTS_VALUE;
-    pes->buffer = NULL;
-    pes->data_index = 0;
-}
-
-/* return non zero if a packet could be constructed */
-static int mpegts_push_data(MpegTSFilter *filter,
-                            const uint8_t *buf, int buf_size, int is_start,
-                            int64_t pos)
-{
-    PESContext *pes = filter->u.pes_filter.opaque;
-    MpegTSContext *ts = pes->ts;
-    const uint8_t *p;
-    int len, code;
-
-    if(!ts->pkt)
-        return 0;
-
-    if (is_start) {
-        if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
-            new_pes_packet(pes, ts->pkt);
-            ts->stop_parse = 1;
-        }
-        pes->state = MPEGTS_HEADER;
-        pes->data_index = 0;
-        pes->ts_packet_pos = pos;
-    }
-    p = buf;
-    while (buf_size > 0) {
-        switch(pes->state) {
-        case MPEGTS_HEADER:
-            len = PES_START_SIZE - pes->data_index;
-            if (len > buf_size)
-                len = buf_size;
-            memcpy(pes->header + pes->data_index, p, len);
-            pes->data_index += len;
-            p += len;
-            buf_size -= len;
-            if (pes->data_index == PES_START_SIZE) {
-                /* we got all the PES or section header. We can now
-                   decide */
-#if 0
-                av_hex_dump_log(pes->stream, AV_LOG_DEBUG, pes->header, pes->data_index);
-#endif
-                if (pes->header[0] == 0x00 && pes->header[1] == 0x00 &&
-                    pes->header[2] == 0x01) {
-                    /* it must be an mpeg2 PES stream */
-                    code = pes->header[3] | 0x100;
-                    dprintf(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
-
-                    if ((!pes->st && pes->stream->nb_streams == MAX_STREAMS) ||
-                        (pes->st && pes->st->discard == AVDISCARD_ALL) ||
-                        code == 0x1be) /* padding_stream */
-                        goto skip;
-
-                    /* stream not present in PMT */
-                    if (!pes->st) {
-                        pes->st = av_new_stream(ts->stream, pes->pid);
-                        if (!pes->st)
-                            return AVERROR(ENOMEM);
-                        mpegts_set_stream_info(pes->st, pes, 0, 0);
-                    }
-
-                    pes->total_size = AV_RB16(pes->header + 4);
-                    /* NOTE: a zero total size means the PES size is
-                       unbounded */
-                    if (!pes->total_size)
-                        pes->total_size = MAX_PES_PAYLOAD;
-
-                    /* allocate pes buffer */
-                    pes->buffer = av_malloc(pes->total_size+FF_INPUT_BUFFER_PADDING_SIZE);
-                    if (!pes->buffer)
-                        return AVERROR(ENOMEM);
-
-                    if (code != 0x1bc && code != 0x1bf && /* program_stream_map, private_stream_2 */
-                        code != 0x1f0 && code != 0x1f1 && /* ECM, EMM */
-                        code != 0x1ff && code != 0x1f2 && /* program_stream_directory, DSMCC_stream */
-                        code != 0x1f8) {                  /* ITU-T Rec. H.222.1 type E stream */
-                        pes->state = MPEGTS_PESHEADER;
-                        if (pes->st->codec->codec_id == CODEC_ID_NONE) {
-                            dprintf(pes->stream, "pid=%x stream_type=%x probing\n",
-                                    pes->pid, pes->stream_type);
-                            pes->st->codec->codec_id = CODEC_ID_PROBE;
-                        }
-                    } else {
-                        pes->state = MPEGTS_PAYLOAD;
-                        pes->data_index = 0;
-                    }
-                } else {
-                    /* otherwise, it should be a table */
-                    /* skip packet */
-                skip:
-                    pes->state = MPEGTS_SKIP;
-                    continue;
-                }
-            }
-            break;
-            /**********************************************/
-            /* PES packing parsing */
-        case MPEGTS_PESHEADER:
-            len = PES_HEADER_SIZE - pes->data_index;
-            if (len < 0)
-                return -1;
-            if (len > buf_size)
-                len = buf_size;
-            memcpy(pes->header + pes->data_index, p, len);
-            pes->data_index += len;
-            p += len;
-            buf_size -= len;
-            if (pes->data_index == PES_HEADER_SIZE) {
-                pes->pes_header_size = pes->header[8] + 9;
-                pes->state = MPEGTS_PESHEADER_FILL;
-            }
-            break;
-        case MPEGTS_PESHEADER_FILL:
-            len = pes->pes_header_size - pes->data_index;
-            if (len < 0)
-                return -1;
-            if (len > buf_size)
-                len = buf_size;
-            memcpy(pes->header + pes->data_index, p, len);
-            pes->data_index += len;
-            p += len;
-            buf_size -= len;
-            if (pes->data_index == pes->pes_header_size) {
-                const uint8_t *r;
-                unsigned int flags, pes_ext, skip;
-
-                flags = pes->header[7];
-                r = pes->header + 9;
-                pes->pts = AV_NOPTS_VALUE;
-                pes->dts = AV_NOPTS_VALUE;
-                if ((flags & 0xc0) == 0x80) {
-                    pes->dts = pes->pts = get_pts(r);
-                    r += 5;
-                } else if ((flags & 0xc0) == 0xc0) {
-                    pes->pts = get_pts(r);
-                    r += 5;
-                    pes->dts = get_pts(r);
-                    r += 5;
-                }
-                pes->extended_stream_id = -1;
-                if (flags & 0x01) { /* PES extension */
-                    pes_ext = *r++;
-                    /* Skip PES private data, program packet sequence counter and P-STD buffer */
-                    skip = (pes_ext >> 4) & 0xb;
-                    skip += skip & 0x9;
-                    r += skip;
-                    if ((pes_ext & 0x41) == 0x01 &&
-                        (r + 2) <= (pes->header + pes->pes_header_size)) {
-                        /* PES extension 2 */
-                        if ((r[0] & 0x7f) > 0 && (r[1] & 0x80) == 0)
-                            pes->extended_stream_id = r[1];
-                    }
-                }
-
-                /* we got the full header. We parse it and get the payload */
-                pes->state = MPEGTS_PAYLOAD;
-                pes->data_index = 0;
-            }
-            break;
-        case MPEGTS_PAYLOAD:
-            if (buf_size > 0 && pes->buffer) {
-                if (pes->data_index+buf_size > pes->total_size) {
-                    new_pes_packet(pes, ts->pkt);
-                    pes->total_size = MAX_PES_PAYLOAD;
-                    pes->buffer = av_malloc(pes->total_size+FF_INPUT_BUFFER_PADDING_SIZE);
-                    if (!pes->buffer)
-                        return AVERROR(ENOMEM);
-                    ts->stop_parse = 1;
-                }
-                memcpy(pes->buffer+pes->data_index, p, buf_size);
-                pes->data_index += buf_size;
-            }
-            buf_size = 0;
-            /* emit complete packets with known packet size
-             * decreases demuxer delay for infrequent packets like subtitles from
-             * a couple of seconds to milliseconds for properly muxed files.
-             * total_size is the number of bytes following pes_packet_length
-             * in the pes header, i.e. not counting the first 6 bytes */
-            if (pes->total_size < MAX_PES_PAYLOAD &&
-                pes->pes_header_size + pes->data_index == pes->total_size + 6) {
-                ts->stop_parse = 1;
-                new_pes_packet(pes, ts->pkt);
-            }
-            break;
-        case MPEGTS_SKIP:
-            buf_size = 0;
-            break;
-        }
-    }
-
-    return 0;
-}
-
-static PESContext *add_pes_stream(MpegTSContext *ts, int pid, int pcr_pid)
-{
-    MpegTSFilter *tss;
-    PESContext *pes;
-
-    /* if no pid found, then add a pid context */
-    pes = av_mallocz(sizeof(PESContext));
-    if (!pes)
-        return 0;
-    pes->ts = ts;
-    pes->stream = ts->stream;
-    pes->pid = pid;
-    pes->pcr_pid = pcr_pid;
-    pes->state = MPEGTS_SKIP;
-    pes->pts = AV_NOPTS_VALUE;
-    pes->dts = AV_NOPTS_VALUE;
-    tss = mpegts_open_pes_filter(ts, pid, mpegts_push_data, pes);
-    if (!tss) {
-        av_free(pes);
-        return 0;
-    }
-    return pes;
-}
-
-static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
-{
-    MpegTSContext *ts = filter->u.section_filter.opaque;
-    SectionHeader h1, *h = &h1;
-    PESContext *pes;
-    AVStream *st;
-    const uint8_t *p, *p_end, *desc_list_end, *desc_end;
-    int program_info_length, pcr_pid, pid, stream_type;
-    int desc_list_len, desc_len, desc_tag;
-    int comp_page, anc_page;
-    char language[4];
-    uint32_t prog_reg_desc = 0; /* registration descriptor */
-
-#ifdef DEBUG
-    dprintf(ts->stream, "PMT: len %i\n", section_len);
-    av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
-#endif
-
-    p_end = section + section_len - 4;
-    p = section;
-    if (parse_section_header(h, &p, p_end) < 0)
-        return;
-
-    dprintf(ts->stream, "sid=0x%x sec_num=%d/%d\n",
-           h->id, h->sec_num, h->last_sec_num);
-
-    if (h->tid != PMT_TID)
-        return;
-
-    clear_program(ts, h->id);
-    pcr_pid = get16(&p, p_end) & 0x1fff;
-    if (pcr_pid < 0)
-        return;
-    add_pid_to_pmt(ts, h->id, pcr_pid);
-
-    dprintf(ts->stream, "pcr_pid=0x%x\n", pcr_pid);
-
-    program_info_length = get16(&p, p_end) & 0xfff;
-    if (program_info_length < 0)
-        return;
-    while(program_info_length >= 2) {
-        uint8_t tag, len;
-        tag = get8(&p, p_end);
-        len = get8(&p, p_end);
-        if(len > program_info_length - 2)
-            //something else is broken, exit the program_descriptors_loop
-            break;
-        program_info_length -= len + 2;
-        if(tag == 0x05 && len >= 4) { // registration descriptor
-            prog_reg_desc = bytestream_get_le32(&p);
-            len -= 4;
-        }
-        p += len;
-    }
-    p += program_info_length;
-    if (p >= p_end)
-        return;
-
-    // stop parsing after pmt, we found header
-    if (!ts->stream->nb_streams)
-        ts->stop_parse = 1;
-
-    for(;;) {
-        st = 0;
-        stream_type = get8(&p, p_end);
-        if (stream_type < 0)
-            break;
-        pid = get16(&p, p_end) & 0x1fff;
-        if (pid < 0)
-            break;
-
-        /* now create ffmpeg stream */
-        if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) {
-            pes = ts->pids[pid]->u.pes_filter.opaque;
-            st = pes->st;
-        } else {
-            if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); //wrongly added sdt filter probably
-            pes = add_pes_stream(ts, pid, pcr_pid);
-            if (pes)
-                st = av_new_stream(pes->stream, pes->pid);
-        }
-
-        if (!st)
-            return;
-
-        if (!pes->stream_type)
-            mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
-
-        add_pid_to_pmt(ts, h->id, pid);
-
-        ff_program_add_stream_index(ts->stream, h->id, st->index);
-
-        desc_list_len = get16(&p, p_end) & 0xfff;
-        if (desc_list_len < 0)
-            break;
-        desc_list_end = p + desc_list_len;
-        if (desc_list_end > p_end)
-            break;
-        for(;;) {
-            desc_tag = get8(&p, desc_list_end);
-            if (desc_tag < 0)
-                break;
-            desc_len = get8(&p, desc_list_end);
-            if (desc_len < 0)
-                break;
-            desc_end = p + desc_len;
-            if (desc_end > desc_list_end)
-                break;
-
-            dprintf(ts->stream, "tag: 0x%02x len=%d\n",
-                   desc_tag, desc_len);
-
-            if (st->codec->codec_id == CODEC_ID_NONE &&
-                stream_type == STREAM_TYPE_PRIVATE_DATA)
-                mpegts_find_stream_type(st, desc_tag, DESC_types);
-
-            switch(desc_tag) {
-            case 0x56: /* DVB teletext descriptor */
-                language[0] = get8(&p, desc_end);
-                language[1] = get8(&p, desc_end);
-                language[2] = get8(&p, desc_end);
-                language[3] = 0;
-                av_metadata_set2(&st->metadata, "language", language, 0);
-                break;
-            case 0x59: /* subtitling descriptor */
-                language[0] = get8(&p, desc_end);
-                language[1] = get8(&p, desc_end);
-                language[2] = get8(&p, desc_end);
-                language[3] = 0;
-                get8(&p, desc_end);
-                comp_page = get16(&p, desc_end);
-                anc_page = get16(&p, desc_end);
-                st->codec->sub_id = (anc_page << 16) | comp_page;
-                av_metadata_set2(&st->metadata, "language", language, 0);
-                break;
-            case 0x0a: /* ISO 639 language descriptor */
-                language[0] = get8(&p, desc_end);
-                language[1] = get8(&p, desc_end);
-                language[2] = get8(&p, desc_end);
-                language[3] = 0;
-                av_metadata_set2(&st->metadata, "language", language, 0);
-                break;
-            case 0x05: /* registration descriptor */
-                st->codec->codec_tag = bytestream_get_le32(&p);
-                dprintf(ts->stream, "reg_desc=%.4s\n", (char*)&st->codec->codec_tag);
-                if (st->codec->codec_id == CODEC_ID_NONE &&
-                    stream_type == STREAM_TYPE_PRIVATE_DATA)
-                    mpegts_find_stream_type(st, st->codec->codec_tag, REGD_types);
-                break;
-            default:
-                break;
-            }
-            p = desc_end;
-
-            if (prog_reg_desc == AV_RL32("HDMV") && stream_type == 0x83 && pes->sub_st) {
-                ff_program_add_stream_index(ts->stream, h->id, pes->sub_st->index);
-                pes->sub_st->codec->codec_tag = st->codec->codec_tag;
-            }
-        }
-        p = desc_list_end;
-    }
-    /* all parameters are there */
-    mpegts_close_filter(ts, filter);
-}
-
-static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
-{
-    MpegTSContext *ts = filter->u.section_filter.opaque;
-    SectionHeader h1, *h = &h1;
-    const uint8_t *p, *p_end;
-    int sid, pmt_pid;
-
-#ifdef DEBUG
-    dprintf(ts->stream, "PAT:\n");
-    av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
-#endif
-    p_end = section + section_len - 4;
-    p = section;
-    if (parse_section_header(h, &p, p_end) < 0)
-        return;
-    if (h->tid != PAT_TID)
-        return;
-
-    clear_programs(ts);
-    for(;;) {
-        sid = get16(&p, p_end);
-        if (sid < 0)
-            break;
-        pmt_pid = get16(&p, p_end) & 0x1fff;
-        if (pmt_pid < 0)
-            break;
-
-        dprintf(ts->stream, "sid=0x%x pid=0x%x\n", sid, pmt_pid);
-
-        if (sid == 0x0000) {
-            /* NIT info */
-        } else {
-            av_new_program(ts->stream, sid);
-            mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1);
-            add_pat_entry(ts, sid);
-            add_pid_to_pmt(ts, sid, 0); //add pat pid to program
-            add_pid_to_pmt(ts, sid, pmt_pid);
-        }
-    }
-}
-
-static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
-{
-    MpegTSContext *ts = filter->u.section_filter.opaque;
-    SectionHeader h1, *h = &h1;
-    const uint8_t *p, *p_end, *desc_list_end, *desc_end;
-    int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;
-    char *name, *provider_name;
-
-#ifdef DEBUG
-    dprintf(ts->stream, "SDT:\n");
-    av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);
-#endif
-
-    p_end = section + section_len - 4;
-    p = section;
-    if (parse_section_header(h, &p, p_end) < 0)
-        return;
-    if (h->tid != SDT_TID)
-        return;
-    onid = get16(&p, p_end);
-    if (onid < 0)
-        return;
-    val = get8(&p, p_end);
-    if (val < 0)
-        return;
-    for(;;) {
-        sid = get16(&p, p_end);
-        if (sid < 0)
-            break;
-        val = get8(&p, p_end);
-        if (val < 0)
-            break;
-        desc_list_len = get16(&p, p_end) & 0xfff;
-        if (desc_list_len < 0)
-            break;
-        desc_list_end = p + desc_list_len;
-        if (desc_list_end > p_end)
-            break;
-        for(;;) {
-            desc_tag = get8(&p, desc_list_end);
-            if (desc_tag < 0)
-                break;
-            desc_len = get8(&p, desc_list_end);
-            desc_end = p + desc_len;
-            if (desc_end > desc_list_end)
-                break;
-
-            dprintf(ts->stream, "tag: 0x%02x len=%d\n",
-                   desc_tag, desc_len);
-
-            switch(desc_tag) {
-            case 0x48:
-                service_type = get8(&p, p_end);
-                if (service_type < 0)
-                    break;
-                provider_name = getstr8(&p, p_end);
-                if (!provider_name)
-                    break;
-                name = getstr8(&p, p_end);
-                if (name) {
-                    AVProgram *program = av_new_program(ts->stream, sid);
-                    if(program) {
-                        av_metadata_set2(&program->metadata, "name", name, 0);
-                        av_metadata_set2(&program->metadata, "provider_name", provider_name, 0);
-                    }
-                }
-                av_free(name);
-                av_free(provider_name);
-                break;
-            default:
-                break;
-            }
-            p = desc_end;
-        }
-        p = desc_list_end;
-    }
-}
-
-/* handle one TS packet */
-static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
-{
-    AVFormatContext *s = ts->stream;
-    MpegTSFilter *tss;
-    int len, pid, cc, cc_ok, afc, is_start;
-    const uint8_t *p, *p_end;
-    int64_t pos;
-
-    pid = AV_RB16(packet + 1) & 0x1fff;
-    if(pid && discard_pid(ts, pid))
-        return 0;
-    is_start = packet[1] & 0x40;
-    tss = ts->pids[pid];
-    if (ts->auto_guess && tss == NULL && is_start) {
-        add_pes_stream(ts, pid, -1);
-        tss = ts->pids[pid];
-    }
-    if (!tss)
-        return 0;
-
-    /* continuity check (currently not used) */
-    cc = (packet[3] & 0xf);
-    cc_ok = (tss->last_cc < 0) || ((((tss->last_cc + 1) & 0x0f) == cc));
-    tss->last_cc = cc;
-
-    /* skip adaptation field */
-    afc = (packet[3] >> 4) & 3;
-    p = packet + 4;
-    if (afc == 0) /* reserved value */
-        return 0;
-    if (afc == 2) /* adaptation field only */
-        return 0;
-    if (afc == 3) {
-        /* skip adapation field */
-        p += p[0] + 1;
-    }
-    /* if past the end of packet, ignore */
-    p_end = packet + TS_PACKET_SIZE;
-    if (p >= p_end)
-        return 0;
-
-    pos = url_ftell(ts->stream->pb);
-    ts->pos47= pos % ts->raw_packet_size;
-
-    if (tss->type == MPEGTS_SECTION) {
-        if (is_start) {
-            /* pointer field present */
-            len = *p++;
-            if (p + len > p_end)
-                return 0;
-            if (len && cc_ok) {
-                /* write remaining section bytes */
-                write_section_data(s, tss,
-                                   p, len, 0);
-                /* check whether filter has been closed */
-                if (!ts->pids[pid])
-                    return 0;
-            }
-            p += len;
-            if (p < p_end) {
-                write_section_data(s, tss,
-                                   p, p_end - p, 1);
-            }
-        } else {
-            if (cc_ok) {
-                write_section_data(s, tss,
-                                   p, p_end - p, 0);
-            }
-        }
-    } else {
-        int ret;
-        // Note: The position here points actually behind the current packet.
-        if ((ret = tss->u.pes_filter.pes_cb(tss, p, p_end - p, is_start,
-                                            pos - ts->raw_packet_size)) < 0)
-            return ret;
-    }
-
-    return 0;
-}
-
-/* XXX: try to find a better synchro over several packets (use
-   get_packet_size() ?) */
-static int mpegts_resync(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    int c, i;
-
-    for(i = 0;i < MAX_RESYNC_SIZE; i++) {
-        c = url_fgetc(pb);
-        if (c < 0)
-            return -1;
-        if (c == 0x47) {
-            url_fseek(pb, -1, SEEK_CUR);
-            return 0;
-        }
-    }
-    av_log(s, AV_LOG_ERROR, "max resync size reached, could not find sync byte\n");
-    /* no sync found */
-    return -1;
-}
-
-/* return -1 if error or EOF. Return 0 if OK. */
-static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
-{
-    ByteIOContext *pb = s->pb;
-    int skip, len;
-
-    for(;;) {
-        len = get_buffer(pb, buf, TS_PACKET_SIZE);
-        if (len != TS_PACKET_SIZE)
-            return AVERROR(EIO);
-        /* check paquet sync byte */
-        if (buf[0] != 0x47) {
-            /* find a new packet start */
-            url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR);
-            if (mpegts_resync(s) < 0)
-                return AVERROR(EAGAIN);
-            else
-                continue;
-        } else {
-            skip = raw_packet_size - TS_PACKET_SIZE;
-            if (skip > 0)
-                url_fskip(pb, skip);
-            break;
-        }
-    }
-    return 0;
-}
-
-static int handle_packets(MpegTSContext *ts, int nb_packets)
-{
-    AVFormatContext *s = ts->stream;
-    uint8_t packet[TS_PACKET_SIZE];
-    int packet_num, ret;
-
-    ts->stop_parse = 0;
-    packet_num = 0;
-    for(;;) {
-        if (ts->stop_parse>0)
-            break;
-        packet_num++;
-        if (nb_packets != 0 && packet_num >= nb_packets)
-            break;
-        ret = read_packet(s, packet, ts->raw_packet_size);
-        if (ret != 0)
-            return ret;
-        ret = handle_packet(ts, packet);
-        if (ret != 0)
-            return ret;
-    }
-    return 0;
-}
-
-static int mpegts_probe(AVProbeData *p)
-{
-#if 1
-    const int size= p->buf_size;
-    int score, fec_score, dvhs_score;
-    int check_count= size / TS_FEC_PACKET_SIZE;
-#define CHECK_COUNT 10
-
-    if (check_count < CHECK_COUNT)
-        return -1;
-
-    score     = analyze(p->buf, TS_PACKET_SIZE     *check_count, TS_PACKET_SIZE     , NULL)*CHECK_COUNT/check_count;
-    dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count;
-    fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
-//    av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
-
-// we need a clear definition for the returned score otherwise things will become messy sooner or later
-    if     (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score     - CHECK_COUNT;
-    else if(dvhs_score > score && dvhs_score > fec_score && dvhs_score > 6) return AVPROBE_SCORE_MAX + dvhs_score  - CHECK_COUNT;
-    else if(                 fec_score > 6) return AVPROBE_SCORE_MAX + fec_score - CHECK_COUNT;
-    else                                    return -1;
-#else
-    /* only use the extension for safer guess */
-    if (av_match_ext(p->filename, "ts"))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-#endif
-}
-
-/* return the 90kHz PCR and the extension for the 27MHz PCR. return
-   (-1) if not available */
-static int parse_pcr(int64_t *ppcr_high, int *ppcr_low,
-                     const uint8_t *packet)
-{
-    int afc, len, flags;
-    const uint8_t *p;
-    unsigned int v;
-
-    afc = (packet[3] >> 4) & 3;
-    if (afc <= 1)
-        return -1;
-    p = packet + 4;
-    len = p[0];
-    p++;
-    if (len == 0)
-        return -1;
-    flags = *p++;
-    len--;
-    if (!(flags & 0x10))
-        return -1;
-    if (len < 6)
-        return -1;
-    v = AV_RB32(p);
-    *ppcr_high = ((int64_t)v << 1) | (p[4] >> 7);
-    *ppcr_low = ((p[4] & 1) << 8) | p[5];
-    return 0;
-}
-
-static int mpegts_read_header(AVFormatContext *s,
-                              AVFormatParameters *ap)
-{
-    MpegTSContext *ts = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint8_t buf[5*1024];
-    int len;
-    int64_t pos;
-
-    if (ap) {
-        ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr;
-        if(ap->mpeg2ts_raw){
-            av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n");
-            return -1;
-        }
-    }
-
-    /* read the first 1024 bytes to get packet size */
-    pos = url_ftell(pb);
-    len = get_buffer(pb, buf, sizeof(buf));
-    if (len != sizeof(buf))
-        goto fail;
-    ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
-    if (ts->raw_packet_size <= 0)
-        goto fail;
-    ts->stream = s;
-    ts->auto_guess = 0;
-
-    if (s->iformat == &mpegts_demuxer) {
-        /* normal demux */
-
-        /* first do a scaning to get all the services */
-        url_fseek(pb, pos, SEEK_SET);
-
-        mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1);
-
-        mpegts_open_section_filter(ts, PAT_PID, pat_cb, ts, 1);
-
-        handle_packets(ts, s->probesize / ts->raw_packet_size);
-        /* if could not find service, enable auto_guess */
-
-        ts->auto_guess = 1;
-
-        dprintf(ts->stream, "tuning done\n");
-
-        s->ctx_flags |= AVFMTCTX_NOHEADER;
-    } else {
-        AVStream *st;
-        int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l;
-        int64_t pcrs[2], pcr_h;
-        int packet_count[2];
-        uint8_t packet[TS_PACKET_SIZE];
-
-        /* only read packets */
-
-        st = av_new_stream(s, 0);
-        if (!st)
-            goto fail;
-        av_set_pts_info(st, 60, 1, 27000000);
-        st->codec->codec_type = AVMEDIA_TYPE_DATA;
-        st->codec->codec_id = CODEC_ID_MPEG2TS;
-
-        /* we iterate until we find two PCRs to estimate the bitrate */
-        pcr_pid = -1;
-        nb_pcrs = 0;
-        nb_packets = 0;
-        for(;;) {
-            ret = read_packet(s, packet, ts->raw_packet_size);
-            if (ret < 0)
-                return -1;
-            pid = AV_RB16(packet + 1) & 0x1fff;
-            if ((pcr_pid == -1 || pcr_pid == pid) &&
-                parse_pcr(&pcr_h, &pcr_l, packet) == 0) {
-                pcr_pid = pid;
-                packet_count[nb_pcrs] = nb_packets;
-                pcrs[nb_pcrs] = pcr_h * 300 + pcr_l;
-                nb_pcrs++;
-                if (nb_pcrs >= 2)
-                    break;
-            }
-            nb_packets++;
-        }
-
-        /* NOTE1: the bitrate is computed without the FEC */
-        /* NOTE2: it is only the bitrate of the start of the stream */
-        ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]);
-        ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0];
-        s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr;
-        st->codec->bit_rate = s->bit_rate;
-        st->start_time = ts->cur_pcr;
-#if 0
-        av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n",
-               st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr);
-#endif
-    }
-
-    url_fseek(pb, pos, SEEK_SET);
-    return 0;
- fail:
-    return -1;
-}
-
-#define MAX_PACKET_READAHEAD ((128 * 1024) / 188)
-
-static int mpegts_raw_read_packet(AVFormatContext *s,
-                                  AVPacket *pkt)
-{
-    MpegTSContext *ts = s->priv_data;
-    int ret, i;
-    int64_t pcr_h, next_pcr_h, pos;
-    int pcr_l, next_pcr_l;
-    uint8_t pcr_buf[12];
-
-    if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
-        return AVERROR(ENOMEM);
-    pkt->pos= url_ftell(s->pb);
-    ret = read_packet(s, pkt->data, ts->raw_packet_size);
-    if (ret < 0) {
-        av_free_packet(pkt);
-        return ret;
-    }
-    if (ts->mpeg2ts_compute_pcr) {
-        /* compute exact PCR for each packet */
-        if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
-            /* we read the next PCR (XXX: optimize it by using a bigger buffer */
-            pos = url_ftell(s->pb);
-            for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
-                url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
-                get_buffer(s->pb, pcr_buf, 12);
-                if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
-                    /* XXX: not precise enough */
-                    ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) /
-                        (i + 1);
-                    break;
-                }
-            }
-            url_fseek(s->pb, pos, SEEK_SET);
-            /* no next PCR found: we use previous increment */
-            ts->cur_pcr = pcr_h * 300 + pcr_l;
-        }
-        pkt->pts = ts->cur_pcr;
-        pkt->duration = ts->pcr_incr;
-        ts->cur_pcr += ts->pcr_incr;
-    }
-    pkt->stream_index = 0;
-    return 0;
-}
-
-static int mpegts_read_packet(AVFormatContext *s,
-                              AVPacket *pkt)
-{
-    MpegTSContext *ts = s->priv_data;
-    int ret, i;
-
-    if (url_ftell(s->pb) != ts->last_pos) {
-        /* seek detected, flush pes buffer */
-        for (i = 0; i < NB_PID_MAX; i++) {
-            if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
-                PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
-                av_freep(&pes->buffer);
-                pes->data_index = 0;
-                pes->state = MPEGTS_SKIP; /* skip until pes header */
-            }
-        }
-    }
-
-    ts->pkt = pkt;
-    ret = handle_packets(ts, 0);
-    if (ret < 0) {
-        /* flush pes data left */
-        for (i = 0; i < NB_PID_MAX; i++) {
-            if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
-                PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
-                if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
-                    new_pes_packet(pes, pkt);
-                    pes->state = MPEGTS_SKIP;
-                    ret = 0;
-                    break;
-                }
-            }
-        }
-    }
-
-    ts->last_pos = url_ftell(s->pb);
-
-    return ret;
-}
-
-static int mpegts_read_close(AVFormatContext *s)
-{
-    MpegTSContext *ts = s->priv_data;
-    int i;
-
-    clear_programs(ts);
-
-    for(i=0;i<NB_PID_MAX;i++)
-        if (ts->pids[i]) mpegts_close_filter(ts, ts->pids[i]);
-
-    return 0;
-}
-
-static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
-                              int64_t *ppos, int64_t pos_limit)
-{
-    MpegTSContext *ts = s->priv_data;
-    int64_t pos, timestamp;
-    uint8_t buf[TS_PACKET_SIZE];
-    int pcr_l, pcr_pid = ((PESContext*)s->streams[stream_index]->priv_data)->pcr_pid;
-    const int find_next= 1;
-    pos = ((*ppos  + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47;
-    if (find_next) {
-        for(;;) {
-            url_fseek(s->pb, pos, SEEK_SET);
-            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
-                return AV_NOPTS_VALUE;
-            if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
-                parse_pcr(&timestamp, &pcr_l, buf) == 0) {
-                break;
-            }
-            pos += ts->raw_packet_size;
-        }
-    } else {
-        for(;;) {
-            pos -= ts->raw_packet_size;
-            if (pos < 0)
-                return AV_NOPTS_VALUE;
-            url_fseek(s->pb, pos, SEEK_SET);
-            if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
-                return AV_NOPTS_VALUE;
-            if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
-                parse_pcr(&timestamp, &pcr_l, buf) == 0) {
-                break;
-            }
-        }
-    }
-    *ppos = pos;
-
-    return timestamp;
-}
-
-#ifdef USE_SYNCPOINT_SEARCH
-
-static int read_seek2(AVFormatContext *s,
-                      int stream_index,
-                      int64_t min_ts,
-                      int64_t target_ts,
-                      int64_t max_ts,
-                      int flags)
-{
-    int64_t pos;
-
-    int64_t ts_ret, ts_adj;
-    int stream_index_gen_search;
-    AVStream *st;
-    AVParserState *backup;
-
-    backup = ff_store_parser_state(s);
-
-    // detect direction of seeking for search purposes
-    flags |= (target_ts - min_ts > (uint64_t)(max_ts - target_ts)) ?
-             AVSEEK_FLAG_BACKWARD : 0;
-
-    if (flags & AVSEEK_FLAG_BYTE) {
-        // use position directly, we will search starting from it
-        pos = target_ts;
-    } else {
-        // search for some position with good timestamp match
-        if (stream_index < 0) {
-            stream_index_gen_search = av_find_default_stream_index(s);
-            if (stream_index_gen_search < 0) {
-                ff_restore_parser_state(s, backup);
-                return -1;
-            }
-
-            st = s->streams[stream_index_gen_search];
-            // timestamp for default must be expressed in AV_TIME_BASE units
-            ts_adj = av_rescale(target_ts,
-                                st->time_base.den,
-                                AV_TIME_BASE * (int64_t)st->time_base.num);
-        } else {
-            ts_adj = target_ts;
-            stream_index_gen_search = stream_index;
-        }
-        pos = av_gen_search(s, stream_index_gen_search, ts_adj,
-                            0, INT64_MAX, -1,
-                            AV_NOPTS_VALUE,
-                            AV_NOPTS_VALUE,
-                            flags, &ts_ret, mpegts_get_pcr);
-        if (pos < 0) {
-            ff_restore_parser_state(s, backup);
-            return -1;
-        }
-    }
-
-    // search for actual matching keyframe/starting position for all streams
-    if (ff_gen_syncpoint_search(s, stream_index, pos,
-                                min_ts, target_ts, max_ts,
-                                flags) < 0) {
-        ff_restore_parser_state(s, backup);
-        return -1;
-    }
-
-    ff_free_parser_state(s, backup);
-    return 0;
-}
-
-static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, int flags)
-{
-    int ret;
-    if (flags & AVSEEK_FLAG_BACKWARD) {
-        flags &= ~AVSEEK_FLAG_BACKWARD;
-        ret = read_seek2(s, stream_index, INT64_MIN, target_ts, target_ts, flags);
-        if (ret < 0)
-            // for compatibility reasons, seek to the best-fitting timestamp
-            ret = read_seek2(s, stream_index, INT64_MIN, target_ts, INT64_MAX, flags);
-    } else {
-        ret = read_seek2(s, stream_index, target_ts, target_ts, INT64_MAX, flags);
-        if (ret < 0)
-            // for compatibility reasons, seek to the best-fitting timestamp
-            ret = read_seek2(s, stream_index, INT64_MIN, target_ts, INT64_MAX, flags);
-    }
-    return ret;
-}
-
-#else
-
-static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
-    MpegTSContext *ts = s->priv_data;
-    uint8_t buf[TS_PACKET_SIZE];
-    int64_t pos;
-
-    if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
-        return -1;
-
-    pos= url_ftell(s->pb);
-
-    for(;;) {
-        url_fseek(s->pb, pos, SEEK_SET);
-        if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
-            return -1;
-//        pid = AV_RB16(buf + 1) & 0x1fff;
-        if(buf[1] & 0x40) break;
-        pos += ts->raw_packet_size;
-    }
-    url_fseek(s->pb, pos, SEEK_SET);
-
-    return 0;
-}
-
-#endif
-
-/**************************************************************/
-/* parsing functions - called from other demuxers such as RTP */
-
-MpegTSContext *ff_mpegts_parse_open(AVFormatContext *s)
-{
-    MpegTSContext *ts;
-
-    ts = av_mallocz(sizeof(MpegTSContext));
-    if (!ts)
-        return NULL;
-    /* no stream case, currently used by RTP */
-    ts->raw_packet_size = TS_PACKET_SIZE;
-    ts->stream = s;
-    ts->auto_guess = 1;
-    return ts;
-}
-
-/* return the consumed length if a packet was output, or -1 if no
-   packet is output */
-int ff_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt,
-                        const uint8_t *buf, int len)
-{
-    int len1;
-
-    len1 = len;
-    ts->pkt = pkt;
-    ts->stop_parse = 0;
-    for(;;) {
-        if (ts->stop_parse>0)
-            break;
-        if (len < TS_PACKET_SIZE)
-            return -1;
-        if (buf[0] != 0x47) {
-            buf++;
-            len--;
-        } else {
-            handle_packet(ts, buf);
-            buf += TS_PACKET_SIZE;
-            len -= TS_PACKET_SIZE;
-        }
-    }
-    return len1 - len;
-}
-
-void ff_mpegts_parse_close(MpegTSContext *ts)
-{
-    int i;
-
-    for(i=0;i<NB_PID_MAX;i++)
-        av_free(ts->pids[i]);
-    av_free(ts);
-}
-
-AVInputFormat mpegts_demuxer = {
-    "mpegts",
-    NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"),
-    sizeof(MpegTSContext),
-    mpegts_probe,
-    mpegts_read_header,
-    mpegts_read_packet,
-    mpegts_read_close,
-    read_seek,
-    mpegts_get_pcr,
-    .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
-#ifdef USE_SYNCPOINT_SEARCH
-    .read_seek2 = read_seek2,
-#endif
-};
-
-AVInputFormat mpegtsraw_demuxer = {
-    "mpegtsraw",
-    NULL_IF_CONFIG_SMALL("MPEG-2 raw transport stream format"),
-    sizeof(MpegTSContext),
-    NULL,
-    mpegts_read_header,
-    mpegts_raw_read_packet,
-    mpegts_read_close,
-    read_seek,
-    mpegts_get_pcr,
-    .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
-#ifdef USE_SYNCPOINT_SEARCH
-    .read_seek2 = read_seek2,
-#endif
-};
diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
deleted file mode 100644
index 6be9b73..0000000
--- a/libavformat/mpegts.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * MPEG2 transport stream defines
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_MPEGTS_H
-#define AVFORMAT_MPEGTS_H
-
-#include "avformat.h"
-
-#define TS_FEC_PACKET_SIZE 204
-#define TS_DVHS_PACKET_SIZE 192
-#define TS_PACKET_SIZE 188
-#define TS_MAX_PACKET_SIZE 204
-
-#define NB_PID_MAX 8192
-#define MAX_SECTION_SIZE 4096
-
-/* pids */
-#define PAT_PID                 0x0000
-#define SDT_PID                 0x0011
-
-/* table ids */
-#define PAT_TID   0x00
-#define PMT_TID   0x02
-#define SDT_TID   0x42
-
-#define STREAM_TYPE_VIDEO_MPEG1     0x01
-#define STREAM_TYPE_VIDEO_MPEG2     0x02
-#define STREAM_TYPE_AUDIO_MPEG1     0x03
-#define STREAM_TYPE_AUDIO_MPEG2     0x04
-#define STREAM_TYPE_PRIVATE_SECTION 0x05
-#define STREAM_TYPE_PRIVATE_DATA    0x06
-#define STREAM_TYPE_AUDIO_AAC       0x0f
-#define STREAM_TYPE_VIDEO_MPEG4     0x10
-#define STREAM_TYPE_VIDEO_H264      0x1b
-#define STREAM_TYPE_VIDEO_VC1       0xea
-#define STREAM_TYPE_VIDEO_DIRAC     0xd1
-
-#define STREAM_TYPE_AUDIO_AC3       0x81
-#define STREAM_TYPE_AUDIO_DTS       0x8a
-
-typedef struct MpegTSContext MpegTSContext;
-
-MpegTSContext *ff_mpegts_parse_open(AVFormatContext *s);
-int ff_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt,
-                           const uint8_t *buf, int len);
-void ff_mpegts_parse_close(MpegTSContext *ts);
-
-#endif /* AVFORMAT_MPEGTS_H */
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
deleted file mode 100644
index 3fc6dc1..0000000
--- a/libavformat/mpegtsenc.c
+++ /dev/null
@@ -1,920 +0,0 @@
-/*
- * MPEG2 transport stream (aka DVB) muxer
- * Copyright (c) 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/bswap.h"
-#include "libavutil/crc.h"
-#include "libavcodec/mpegvideo.h"
-#include "avformat.h"
-#include "internal.h"
-#include "mpegts.h"
-#include "adts.h"
-
-/* write DVB SI sections */
-
-/*********************************************/
-/* mpegts section writer */
-
-typedef struct MpegTSSection {
-    int pid;
-    int cc;
-    void (*write_packet)(struct MpegTSSection *s, const uint8_t *packet);
-    void *opaque;
-} MpegTSSection;
-
-typedef struct MpegTSService {
-    MpegTSSection pmt; /* MPEG2 pmt table context */
-    int sid;           /* service ID */
-    char *name;
-    char *provider_name;
-    int pcr_pid;
-    int pcr_packet_count;
-    int pcr_packet_period;
-} MpegTSService;
-
-typedef struct MpegTSWrite {
-    MpegTSSection pat; /* MPEG2 pat table */
-    MpegTSSection sdt; /* MPEG2 sdt table context */
-    MpegTSService **services;
-    int sdt_packet_count;
-    int sdt_packet_period;
-    int pat_packet_count;
-    int pat_packet_period;
-    int nb_services;
-    int onid;
-    int tsid;
-    uint64_t cur_pcr;
-    int mux_rate; ///< set to 1 when VBR
-} MpegTSWrite;
-
-/* NOTE: 4 bytes must be left at the end for the crc32 */
-static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
-{
-    MpegTSWrite *ts = ((AVFormatContext*)s->opaque)->priv_data;
-    unsigned int crc;
-    unsigned char packet[TS_PACKET_SIZE];
-    const unsigned char *buf_ptr;
-    unsigned char *q;
-    int first, b, len1, left;
-
-    crc = bswap_32(av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1, buf, len - 4));
-    buf[len - 4] = (crc >> 24) & 0xff;
-    buf[len - 3] = (crc >> 16) & 0xff;
-    buf[len - 2] = (crc >> 8) & 0xff;
-    buf[len - 1] = (crc) & 0xff;
-
-    /* send each packet */
-    buf_ptr = buf;
-    while (len > 0) {
-        first = (buf == buf_ptr);
-        q = packet;
-        *q++ = 0x47;
-        b = (s->pid >> 8);
-        if (first)
-            b |= 0x40;
-        *q++ = b;
-        *q++ = s->pid;
-        s->cc = (s->cc + 1) & 0xf;
-        *q++ = 0x10 | s->cc;
-        if (first)
-            *q++ = 0; /* 0 offset */
-        len1 = TS_PACKET_SIZE - (q - packet);
-        if (len1 > len)
-            len1 = len;
-        memcpy(q, buf_ptr, len1);
-        q += len1;
-        /* add known padding data */
-        left = TS_PACKET_SIZE - (q - packet);
-        if (left > 0)
-            memset(q, 0xff, left);
-
-        s->write_packet(s, packet);
-
-        buf_ptr += len1;
-        len -= len1;
-
-        ts->cur_pcr += TS_PACKET_SIZE*8*90000LL/ts->mux_rate;
-    }
-}
-
-static inline void put16(uint8_t **q_ptr, int val)
-{
-    uint8_t *q;
-    q = *q_ptr;
-    *q++ = val >> 8;
-    *q++ = val;
-    *q_ptr = q;
-}
-
-static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
-                          int version, int sec_num, int last_sec_num,
-                          uint8_t *buf, int len)
-{
-    uint8_t section[1024], *q;
-    unsigned int tot_len;
-
-    tot_len = 3 + 5 + len + 4;
-    /* check if not too big */
-    if (tot_len > 1024)
-        return -1;
-
-    q = section;
-    *q++ = tid;
-    put16(&q, 0xb000 | (len + 5 + 4)); /* 5 byte header + 4 byte CRC */
-    put16(&q, id);
-    *q++ = 0xc1 | (version << 1); /* current_next_indicator = 1 */
-    *q++ = sec_num;
-    *q++ = last_sec_num;
-    memcpy(q, buf, len);
-
-    mpegts_write_section(s, section, tot_len);
-    return 0;
-}
-
-/*********************************************/
-/* mpegts writer */
-
-#define DEFAULT_PMT_START_PID   0x1000
-#define DEFAULT_START_PID       0x0100
-#define DEFAULT_PROVIDER_NAME   "FFmpeg"
-#define DEFAULT_SERVICE_NAME    "Service01"
-
-/* default network id, transport stream and service identifiers */
-#define DEFAULT_ONID            0x0001
-#define DEFAULT_TSID            0x0001
-#define DEFAULT_SID             0x0001
-
-/* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */
-#define DEFAULT_PES_HEADER_FREQ 16
-#define DEFAULT_PES_PAYLOAD_SIZE ((DEFAULT_PES_HEADER_FREQ - 1) * 184 + 170)
-
-/* we retransmit the SI info at this rate */
-#define SDT_RETRANS_TIME 500
-#define PAT_RETRANS_TIME 100
-#define PCR_RETRANS_TIME 20
-
-typedef struct MpegTSWriteStream {
-    struct MpegTSService *service;
-    int pid; /* stream associated pid */
-    int cc;
-    int payload_index;
-    int first_pts_check; ///< first pts check needed
-    int64_t payload_pts;
-    int64_t payload_dts;
-    uint8_t payload[DEFAULT_PES_PAYLOAD_SIZE];
-    ADTSContext *adts;
-} MpegTSWriteStream;
-
-static void mpegts_write_pat(AVFormatContext *s)
-{
-    MpegTSWrite *ts = s->priv_data;
-    MpegTSService *service;
-    uint8_t data[1012], *q;
-    int i;
-
-    q = data;
-    for(i = 0; i < ts->nb_services; i++) {
-        service = ts->services[i];
-        put16(&q, service->sid);
-        put16(&q, 0xe000 | service->pmt.pid);
-    }
-    mpegts_write_section1(&ts->pat, PAT_TID, ts->tsid, 0, 0, 0,
-                          data, q - data);
-}
-
-static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
-{
-    //    MpegTSWrite *ts = s->priv_data;
-    uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr;
-    int val, stream_type, i;
-
-    q = data;
-    put16(&q, 0xe000 | service->pcr_pid);
-
-    program_info_length_ptr = q;
-    q += 2; /* patched after */
-
-    /* put program info here */
-
-    val = 0xf000 | (q - program_info_length_ptr - 2);
-    program_info_length_ptr[0] = val >> 8;
-    program_info_length_ptr[1] = val;
-
-    for(i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        MpegTSWriteStream *ts_st = st->priv_data;
-        AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0);
-        switch(st->codec->codec_id) {
-        case CODEC_ID_MPEG1VIDEO:
-        case CODEC_ID_MPEG2VIDEO:
-            stream_type = STREAM_TYPE_VIDEO_MPEG2;
-            break;
-        case CODEC_ID_MPEG4:
-            stream_type = STREAM_TYPE_VIDEO_MPEG4;
-            break;
-        case CODEC_ID_H264:
-            stream_type = STREAM_TYPE_VIDEO_H264;
-            break;
-        case CODEC_ID_DIRAC:
-            stream_type = STREAM_TYPE_VIDEO_DIRAC;
-            break;
-        case CODEC_ID_MP2:
-        case CODEC_ID_MP3:
-            stream_type = STREAM_TYPE_AUDIO_MPEG1;
-            break;
-        case CODEC_ID_AAC:
-            stream_type = STREAM_TYPE_AUDIO_AAC;
-            break;
-        case CODEC_ID_AC3:
-            stream_type = STREAM_TYPE_AUDIO_AC3;
-            break;
-        default:
-            stream_type = STREAM_TYPE_PRIVATE_DATA;
-            break;
-        }
-        *q++ = stream_type;
-        put16(&q, 0xe000 | ts_st->pid);
-        desc_length_ptr = q;
-        q += 2; /* patched after */
-
-        /* write optional descriptors here */
-        switch(st->codec->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            if (lang && strlen(lang->value) == 3) {
-                *q++ = 0x0a; /* ISO 639 language descriptor */
-                *q++ = 4;
-                *q++ = lang->value[0];
-                *q++ = lang->value[1];
-                *q++ = lang->value[2];
-                *q++ = 0; /* undefined type */
-            }
-            break;
-        case AVMEDIA_TYPE_SUBTITLE:
-            {
-                const char *language;
-                language = lang && strlen(lang->value)==3 ? lang->value : "eng";
-                *q++ = 0x59;
-                *q++ = 8;
-                *q++ = language[0];
-                *q++ = language[1];
-                *q++ = language[2];
-                *q++ = 0x10; /* normal subtitles (0x20 = if hearing pb) */
-                put16(&q, 1); /* page id */
-                put16(&q, 1); /* ancillary page id */
-            }
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-            if (stream_type == STREAM_TYPE_VIDEO_DIRAC) {
-                *q++ = 0x05; /*MPEG-2 registration descriptor*/
-                *q++ = 4;
-                *q++ = 'd';
-                *q++ = 'r';
-                *q++ = 'a';
-                *q++ = 'c';
-            }
-            break;
-        }
-
-        val = 0xf000 | (q - desc_length_ptr - 2);
-        desc_length_ptr[0] = val >> 8;
-        desc_length_ptr[1] = val;
-    }
-    mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0,
-                          data, q - data);
-}
-
-/* NOTE: str == NULL is accepted for an empty string */
-static void putstr8(uint8_t **q_ptr, const char *str)
-{
-    uint8_t *q;
-    int len;
-
-    q = *q_ptr;
-    if (!str)
-        len = 0;
-    else
-        len = strlen(str);
-    *q++ = len;
-    memcpy(q, str, len);
-    q += len;
-    *q_ptr = q;
-}
-
-static void mpegts_write_sdt(AVFormatContext *s)
-{
-    MpegTSWrite *ts = s->priv_data;
-    MpegTSService *service;
-    uint8_t data[1012], *q, *desc_list_len_ptr, *desc_len_ptr;
-    int i, running_status, free_ca_mode, val;
-
-    q = data;
-    put16(&q, ts->onid);
-    *q++ = 0xff;
-    for(i = 0; i < ts->nb_services; i++) {
-        service = ts->services[i];
-        put16(&q, service->sid);
-        *q++ = 0xfc | 0x00; /* currently no EIT info */
-        desc_list_len_ptr = q;
-        q += 2;
-        running_status = 4; /* running */
-        free_ca_mode = 0;
-
-        /* write only one descriptor for the service name and provider */
-        *q++ = 0x48;
-        desc_len_ptr = q;
-        q++;
-        *q++ = 0x01; /* digital television service */
-        putstr8(&q, service->provider_name);
-        putstr8(&q, service->name);
-        desc_len_ptr[0] = q - desc_len_ptr - 1;
-
-        /* fill descriptor length */
-        val = (running_status << 13) | (free_ca_mode << 12) |
-            (q - desc_list_len_ptr - 2);
-        desc_list_len_ptr[0] = val >> 8;
-        desc_list_len_ptr[1] = val;
-    }
-    mpegts_write_section1(&ts->sdt, SDT_TID, ts->tsid, 0, 0, 0,
-                          data, q - data);
-}
-
-static MpegTSService *mpegts_add_service(MpegTSWrite *ts,
-                                         int sid,
-                                         const char *provider_name,
-                                         const char *name)
-{
-    MpegTSService *service;
-
-    service = av_mallocz(sizeof(MpegTSService));
-    if (!service)
-        return NULL;
-    service->pmt.pid = DEFAULT_PMT_START_PID + ts->nb_services - 1;
-    service->sid = sid;
-    service->provider_name = av_strdup(provider_name);
-    service->name = av_strdup(name);
-    service->pcr_pid = 0x1fff;
-    dynarray_add(&ts->services, &ts->nb_services, service);
-    return service;
-}
-
-static void section_write_packet(MpegTSSection *s, const uint8_t *packet)
-{
-    AVFormatContext *ctx = s->opaque;
-    put_buffer(ctx->pb, packet, TS_PACKET_SIZE);
-}
-
-static int mpegts_write_header(AVFormatContext *s)
-{
-    MpegTSWrite *ts = s->priv_data;
-    MpegTSWriteStream *ts_st;
-    MpegTSService *service;
-    AVStream *st, *pcr_st = NULL;
-    AVMetadataTag *title;
-    int i;
-    const char *service_name;
-
-    ts->tsid = DEFAULT_TSID;
-    ts->onid = DEFAULT_ONID;
-    /* allocate a single DVB service */
-    title = av_metadata_get(s->metadata, "title", NULL, 0);
-    service_name = title ? title->value : DEFAULT_SERVICE_NAME;
-    service = mpegts_add_service(ts, DEFAULT_SID,
-                                 DEFAULT_PROVIDER_NAME, service_name);
-    service->pmt.write_packet = section_write_packet;
-    service->pmt.opaque = s;
-    service->pmt.cc = 15;
-
-    ts->pat.pid = PAT_PID;
-    ts->pat.cc = 15; // Initialize at 15 so that it wraps and be equal to 0 for the first packet we write
-    ts->pat.write_packet = section_write_packet;
-    ts->pat.opaque = s;
-
-    ts->sdt.pid = SDT_PID;
-    ts->sdt.cc = 15;
-    ts->sdt.write_packet = section_write_packet;
-    ts->sdt.opaque = s;
-
-    /* assign pids to each stream */
-    for(i = 0;i < s->nb_streams; i++) {
-        st = s->streams[i];
-        ts_st = av_mallocz(sizeof(MpegTSWriteStream));
-        if (!ts_st)
-            goto fail;
-        st->priv_data = ts_st;
-        ts_st->service = service;
-        ts_st->pid = DEFAULT_START_PID + i;
-        ts_st->payload_pts = AV_NOPTS_VALUE;
-        ts_st->payload_dts = AV_NOPTS_VALUE;
-        ts_st->first_pts_check = 1;
-        ts_st->cc = 15;
-        /* update PCR pid by using the first video stream */
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
-            service->pcr_pid == 0x1fff) {
-            service->pcr_pid = ts_st->pid;
-            pcr_st = st;
-        }
-        if (st->codec->codec_id == CODEC_ID_AAC &&
-            st->codec->extradata_size > 0) {
-            ts_st->adts = av_mallocz(sizeof(*ts_st->adts));
-            if (!ts_st->adts)
-                return AVERROR(ENOMEM);
-            if (ff_adts_decode_extradata(s, ts_st->adts, st->codec->extradata,
-                                         st->codec->extradata_size) < 0)
-                return -1;
-        }
-    }
-
-    /* if no video stream, use the first stream as PCR */
-    if (service->pcr_pid == 0x1fff && s->nb_streams > 0) {
-        pcr_st = s->streams[0];
-        ts_st = pcr_st->priv_data;
-        service->pcr_pid = ts_st->pid;
-    }
-
-    ts->mux_rate = s->mux_rate ? s->mux_rate : 1;
-
-    if (ts->mux_rate > 1) {
-        service->pcr_packet_period = (ts->mux_rate * PCR_RETRANS_TIME) /
-            (TS_PACKET_SIZE * 8 * 1000);
-        ts->sdt_packet_period      = (ts->mux_rate * SDT_RETRANS_TIME) /
-            (TS_PACKET_SIZE * 8 * 1000);
-        ts->pat_packet_period      = (ts->mux_rate * PAT_RETRANS_TIME) /
-            (TS_PACKET_SIZE * 8 * 1000);
-
-        ts->cur_pcr = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
-    } else {
-        /* Arbitrary values, PAT/PMT could be written on key frames */
-        ts->sdt_packet_period = 200;
-        ts->pat_packet_period = 40;
-        if (pcr_st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if (!pcr_st->codec->frame_size) {
-                av_log(s, AV_LOG_WARNING, "frame size not set\n");
-                service->pcr_packet_period =
-                    pcr_st->codec->sample_rate/(10*512);
-            } else {
-                service->pcr_packet_period =
-                    pcr_st->codec->sample_rate/(10*pcr_st->codec->frame_size);
-            }
-        } else {
-            // max delta PCR 0.1s
-            service->pcr_packet_period =
-                pcr_st->codec->time_base.den/(10*pcr_st->codec->time_base.num);
-        }
-    }
-
-    // output a PCR as soon as possible
-    service->pcr_packet_count = service->pcr_packet_period;
-    ts->pat_packet_count = ts->pat_packet_period-1;
-    ts->sdt_packet_count = ts->sdt_packet_period-1;
-
-    av_log(s, AV_LOG_INFO,
-           "muxrate %d bps, pcr every %d pkts, "
-           "sdt every %d, pat/pmt every %d pkts\n",
-           ts->mux_rate, service->pcr_packet_period,
-           ts->sdt_packet_period, ts->pat_packet_period);
-
-
-    put_flush_packet(s->pb);
-
-    return 0;
-
- fail:
-    for(i = 0;i < s->nb_streams; i++) {
-        st = s->streams[i];
-        av_free(st->priv_data);
-    }
-    return -1;
-}
-
-/* send SDT, PAT and PMT tables regulary */
-static void retransmit_si_info(AVFormatContext *s)
-{
-    MpegTSWrite *ts = s->priv_data;
-    int i;
-
-    if (++ts->sdt_packet_count == ts->sdt_packet_period) {
-        ts->sdt_packet_count = 0;
-        mpegts_write_sdt(s);
-    }
-    if (++ts->pat_packet_count == ts->pat_packet_period) {
-        ts->pat_packet_count = 0;
-        mpegts_write_pat(s);
-        for(i = 0; i < ts->nb_services; i++) {
-            mpegts_write_pmt(s, ts->services[i]);
-        }
-    }
-}
-
-/* Write a single null transport stream packet */
-static void mpegts_insert_null_packet(AVFormatContext *s)
-{
-    MpegTSWrite *ts = s->priv_data;
-    uint8_t *q;
-    uint8_t buf[TS_PACKET_SIZE];
-
-    q = buf;
-    *q++ = 0x47;
-    *q++ = 0x00 | 0x1f;
-    *q++ = 0xff;
-    *q++ = 0x10;
-    memset(q, 0x0FF, TS_PACKET_SIZE - (q - buf));
-    put_buffer(s->pb, buf, TS_PACKET_SIZE);
-    ts->cur_pcr += TS_PACKET_SIZE*8*90000LL/ts->mux_rate;
-}
-
-/* Write a single transport stream packet with a PCR and no payload */
-static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st)
-{
-    MpegTSWrite *ts = s->priv_data;
-    MpegTSWriteStream *ts_st = st->priv_data;
-    uint8_t *q;
-    uint64_t pcr = ts->cur_pcr;
-    uint8_t buf[TS_PACKET_SIZE];
-
-    q = buf;
-    *q++ = 0x47;
-    *q++ = ts_st->pid >> 8;
-    *q++ = ts_st->pid;
-    *q++ = 0x20 | ts_st->cc;   /* Adaptation only */
-    /* Continuity Count field does not increment (see 13818-1 section 2.4.3.3) */
-    *q++ = TS_PACKET_SIZE - 5; /* Adaptation Field Length */
-    *q++ = 0x10;               /* Adaptation flags: PCR present */
-
-    /* PCR coded into 6 bytes */
-    *q++ = pcr >> 25;
-    *q++ = pcr >> 17;
-    *q++ = pcr >> 9;
-    *q++ = pcr >> 1;
-    *q++ = (pcr & 1) << 7;
-    *q++ = 0;
-
-    /* stuffing bytes */
-    memset(q, 0xFF, TS_PACKET_SIZE - (q - buf));
-    put_buffer(s->pb, buf, TS_PACKET_SIZE);
-    ts->cur_pcr += TS_PACKET_SIZE*8*90000LL/ts->mux_rate;
-}
-
-static void write_pts(uint8_t *q, int fourbits, int64_t pts)
-{
-    int val;
-
-    val = fourbits << 4 | (((pts >> 30) & 0x07) << 1) | 1;
-    *q++ = val;
-    val = (((pts >> 15) & 0x7fff) << 1) | 1;
-    *q++ = val >> 8;
-    *q++ = val;
-    val = (((pts) & 0x7fff) << 1) | 1;
-    *q++ = val >> 8;
-    *q++ = val;
-}
-
-/* Add a pes header to the front of payload, and segment into an integer number of
- * ts packets. The final ts packet is padded using an over-sized adaptation header
- * to exactly fill the last ts packet.
- * NOTE: 'payload' contains a complete PES payload.
- */
-static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
-                             const uint8_t *payload, int payload_size,
-                             int64_t pts, int64_t dts)
-{
-    MpegTSWriteStream *ts_st = st->priv_data;
-    MpegTSWrite *ts = s->priv_data;
-    uint8_t buf[TS_PACKET_SIZE];
-    uint8_t *q;
-    int val, is_start, len, header_len, write_pcr, private_code, flags;
-    int afc_len, stuffing_len;
-    int64_t pcr = -1; /* avoid warning */
-    int64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE);
-
-    is_start = 1;
-    while (payload_size > 0) {
-        retransmit_si_info(s);
-
-        write_pcr = 0;
-        if (ts_st->pid == ts_st->service->pcr_pid) {
-            if (ts->mux_rate > 1 || is_start) // VBR pcr period is based on frames
-                ts_st->service->pcr_packet_count++;
-            if (ts_st->service->pcr_packet_count >=
-                ts_st->service->pcr_packet_period) {
-                ts_st->service->pcr_packet_count = 0;
-                write_pcr = 1;
-            }
-        }
-
-        if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE &&
-            (dts - (int64_t)ts->cur_pcr) > delay) {
-            /* pcr insert gets priority over null packet insert */
-            if (write_pcr)
-                mpegts_insert_pcr_only(s, st);
-            else
-                mpegts_insert_null_packet(s);
-            continue; /* recalculate write_pcr and possibly retransmit si_info */
-        }
-
-        /* prepare packet header */
-        q = buf;
-        *q++ = 0x47;
-        val = (ts_st->pid >> 8);
-        if (is_start)
-            val |= 0x40;
-        *q++ = val;
-        *q++ = ts_st->pid;
-        ts_st->cc = (ts_st->cc + 1) & 0xf;
-        *q++ = 0x10 | ts_st->cc | (write_pcr ? 0x20 : 0);
-        if (write_pcr) {
-            // add 11, pcr references the last byte of program clock reference base
-            if (ts->mux_rate > 1)
-                pcr = ts->cur_pcr + (4+7)*8*90000LL / ts->mux_rate;
-            else
-                pcr = dts - delay;
-            if (dts != AV_NOPTS_VALUE && dts < pcr)
-                av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n");
-            *q++ = 7; /* AFC length */
-            *q++ = 0x10; /* flags: PCR present */
-            *q++ = pcr >> 25;
-            *q++ = pcr >> 17;
-            *q++ = pcr >> 9;
-            *q++ = pcr >> 1;
-            *q++ = (pcr & 1) << 7;
-            *q++ = 0;
-        }
-        if (is_start) {
-            int pes_extension = 0;
-            /* write PES header */
-            *q++ = 0x00;
-            *q++ = 0x00;
-            *q++ = 0x01;
-            private_code = 0;
-            if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-                if (st->codec->codec_id == CODEC_ID_DIRAC) {
-                    *q++ = 0xfd;
-                } else
-                    *q++ = 0xe0;
-            } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
-                       (st->codec->codec_id == CODEC_ID_MP2 ||
-                        st->codec->codec_id == CODEC_ID_MP3)) {
-                *q++ = 0xc0;
-            } else {
-                *q++ = 0xbd;
-                if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
-                    private_code = 0x20;
-                }
-            }
-            header_len = 0;
-            flags = 0;
-            if (pts != AV_NOPTS_VALUE) {
-                header_len += 5;
-                flags |= 0x80;
-            }
-            if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) {
-                header_len += 5;
-                flags |= 0x40;
-            }
-            if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
-                st->codec->codec_id == CODEC_ID_DIRAC) {
-                /* set PES_extension_flag */
-                pes_extension = 1;
-                flags |= 0x01;
-
-                /*
-                * One byte for PES2 extension flag +
-                * one byte for extension length +
-                * one byte for extension id
-                */
-                header_len += 3;
-            }
-            len = payload_size + header_len + 3;
-            if (private_code != 0)
-                len++;
-            if (len > 0xffff)
-                len = 0;
-            *q++ = len >> 8;
-            *q++ = len;
-            val = 0x80;
-            /* data alignment indicator is required for subtitle data */
-            if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE)
-                val |= 0x04;
-            *q++ = val;
-            *q++ = flags;
-            *q++ = header_len;
-            if (pts != AV_NOPTS_VALUE) {
-                write_pts(q, flags >> 6, pts);
-                q += 5;
-            }
-            if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) {
-                write_pts(q, 1, dts);
-                q += 5;
-            }
-            if (pes_extension && st->codec->codec_id == CODEC_ID_DIRAC) {
-                flags = 0x01;  /* set PES_extension_flag_2 */
-                *q++ = flags;
-                *q++ = 0x80 | 0x01;  /* marker bit + extension length */
-                /*
-                * Set the stream id extension flag bit to 0 and
-                * write the extended stream id
-                */
-                *q++ = 0x00 | 0x60;
-            }
-            if (private_code != 0)
-                *q++ = private_code;
-            is_start = 0;
-        }
-        /* header size */
-        header_len = q - buf;
-        /* data len */
-        len = TS_PACKET_SIZE - header_len;
-        if (len > payload_size)
-            len = payload_size;
-        stuffing_len = TS_PACKET_SIZE - header_len - len;
-        if (stuffing_len > 0) {
-            /* add stuffing with AFC */
-            if (buf[3] & 0x20) {
-                /* stuffing already present: increase its size */
-                afc_len = buf[4] + 1;
-                memmove(buf + 4 + afc_len + stuffing_len,
-                        buf + 4 + afc_len,
-                        header_len - (4 + afc_len));
-                buf[4] += stuffing_len;
-                memset(buf + 4 + afc_len, 0xff, stuffing_len);
-            } else {
-                /* add stuffing */
-                memmove(buf + 4 + stuffing_len, buf + 4, header_len - 4);
-                buf[3] |= 0x20;
-                buf[4] = stuffing_len - 1;
-                if (stuffing_len >= 2) {
-                    buf[5] = 0x00;
-                    memset(buf + 6, 0xff, stuffing_len - 2);
-                }
-            }
-        }
-        memcpy(buf + TS_PACKET_SIZE - len, payload, len);
-        payload += len;
-        payload_size -= len;
-        put_buffer(s->pb, buf, TS_PACKET_SIZE);
-        ts->cur_pcr += TS_PACKET_SIZE*8*90000LL/ts->mux_rate;
-    }
-    put_flush_packet(s->pb);
-}
-
-static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    AVStream *st = s->streams[pkt->stream_index];
-    int size = pkt->size;
-    uint8_t *buf= pkt->data;
-    uint8_t *data= NULL;
-    MpegTSWriteStream *ts_st = st->priv_data;
-    const uint64_t delay = av_rescale(s->max_delay, 90000, AV_TIME_BASE)*2;
-    int64_t dts = AV_NOPTS_VALUE, pts = AV_NOPTS_VALUE;
-
-    if (pkt->pts != AV_NOPTS_VALUE)
-        pts = pkt->pts + delay;
-    if (pkt->dts != AV_NOPTS_VALUE)
-        dts = pkt->dts + delay;
-
-    if (ts_st->first_pts_check && pts == AV_NOPTS_VALUE) {
-        av_log(s, AV_LOG_ERROR, "first pts value must set\n");
-        return -1;
-    }
-    ts_st->first_pts_check = 0;
-
-    if (st->codec->codec_id == CODEC_ID_H264) {
-        const uint8_t *p = buf, *buf_end = p+size;
-        uint32_t state = -1;
-
-        if (pkt->size < 5 || AV_RB32(pkt->data) != 0x0000001) {
-            av_log(s, AV_LOG_ERROR, "h264 bitstream malformated, "
-                   "no startcode found, use -vbsf h264_mp4toannexb\n");
-            return -1;
-        }
-
-        do {
-            p = ff_find_start_code(p, buf_end, &state);
-            //av_log(s, AV_LOG_INFO, "nal %d\n", state & 0x1f);
-        } while (p < buf_end && (state & 0x1f) != 9 &&
-                 (state & 0x1f) != 5 && (state & 0x1f) != 1);
-
-        if ((state & 0x1f) != 9) { // AUD NAL
-            data = av_malloc(pkt->size+6);
-            if (!data)
-                return -1;
-            memcpy(data+6, pkt->data, pkt->size);
-            AV_WB32(data, 0x00000001);
-            data[4] = 0x09;
-            data[5] = 0xe0; // any slice type
-            buf  = data;
-            size = pkt->size+6;
-        }
-    } else if (st->codec->codec_id == CODEC_ID_AAC) {
-        if (pkt->size < 2)
-            return -1;
-        if ((AV_RB16(pkt->data) & 0xfff0) != 0xfff0) {
-            ADTSContext *adts = ts_st->adts;
-            int new_size;
-            if (!adts) {
-                av_log(s, AV_LOG_ERROR, "aac bitstream not in adts format "
-                       "and extradata missing\n");
-                return -1;
-            }
-            new_size = ADTS_HEADER_SIZE+adts->pce_size+pkt->size;
-            if ((unsigned)new_size >= INT_MAX)
-                return -1;
-            data = av_malloc(new_size);
-            if (!data)
-                return AVERROR(ENOMEM);
-            ff_adts_write_frame_header(adts, data, pkt->size, adts->pce_size);
-            if (adts->pce_size) {
-                memcpy(data+ADTS_HEADER_SIZE, adts->pce_data, adts->pce_size);
-                adts->pce_size = 0;
-            }
-            memcpy(data+ADTS_HEADER_SIZE+adts->pce_size, pkt->data, pkt->size);
-            buf = data;
-            size = new_size;
-        }
-    }
-
-    if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO) {
-        // for video and subtitle, write a single pes packet
-        mpegts_write_pes(s, st, buf, size, pts, dts);
-        av_free(data);
-        return 0;
-    }
-
-    if (ts_st->payload_index + size > DEFAULT_PES_PAYLOAD_SIZE) {
-        mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,
-                         ts_st->payload_pts, ts_st->payload_dts);
-        ts_st->payload_index = 0;
-    }
-
-    if (!ts_st->payload_index) {
-        ts_st->payload_pts = pts;
-        ts_st->payload_dts = dts;
-    }
-
-    memcpy(ts_st->payload + ts_st->payload_index, buf, size);
-    ts_st->payload_index += size;
-
-    av_free(data);
-
-    return 0;
-}
-
-static int mpegts_write_end(AVFormatContext *s)
-{
-    MpegTSWrite *ts = s->priv_data;
-    MpegTSWriteStream *ts_st;
-    MpegTSService *service;
-    AVStream *st;
-    int i;
-
-    /* flush current packets */
-    for(i = 0; i < s->nb_streams; i++) {
-        st = s->streams[i];
-        ts_st = st->priv_data;
-        if (ts_st->payload_index > 0) {
-            mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_index,
-                             ts_st->payload_pts, ts_st->payload_dts);
-        }
-        av_freep(&ts_st->adts);
-    }
-    put_flush_packet(s->pb);
-
-    for(i = 0; i < ts->nb_services; i++) {
-        service = ts->services[i];
-        av_freep(&service->provider_name);
-        av_freep(&service->name);
-        av_free(service);
-    }
-    av_free(ts->services);
-
-    return 0;
-}
-
-AVOutputFormat mpegts_muxer = {
-    "mpegts",
-    NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"),
-    "video/x-mpegts",
-    "ts,m2t",
-    sizeof(MpegTSWrite),
-    CODEC_ID_MP2,
-    CODEC_ID_MPEG2VIDEO,
-    mpegts_write_header,
-    mpegts_write_packet,
-    mpegts_write_end,
-};
diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
deleted file mode 100644
index 8973877..0000000
--- a/libavformat/mpjpeg.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Multipart JPEG format
- * Copyright (c) 2000, 2001, 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-
-/* Multipart JPEG */
-
-#define BOUNDARY_TAG "ffserver"
-
-static int mpjpeg_write_header(AVFormatContext *s)
-{
-    uint8_t buf1[256];
-
-    snprintf(buf1, sizeof(buf1), "--%s\n", BOUNDARY_TAG);
-    put_buffer(s->pb, buf1, strlen(buf1));
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    uint8_t buf1[256];
-
-    snprintf(buf1, sizeof(buf1), "Content-type: image/jpeg\n\n");
-    put_buffer(s->pb, buf1, strlen(buf1));
-    put_buffer(s->pb, pkt->data, pkt->size);
-
-    snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG);
-    put_buffer(s->pb, buf1, strlen(buf1));
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int mpjpeg_write_trailer(AVFormatContext *s)
-{
-    return 0;
-}
-
-AVOutputFormat mpjpeg_muxer = {
-    "mpjpeg",
-    NULL_IF_CONFIG_SMALL("MIME multipart JPEG format"),
-    "multipart/x-mixed-replace;boundary=" BOUNDARY_TAG,
-    "mjpg",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_MJPEG,
-    mpjpeg_write_header,
-    mpjpeg_write_packet,
-    mpjpeg_write_trailer,
-};
diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
deleted file mode 100644
index e548871..0000000
--- a/libavformat/msnwc_tcp.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2008  Ramiro Polla <ramiro at lisha.ufsc.br>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-
-#define HEADER_SIZE         24
-
-/*
- * Header structure:
- *  uint16_t    ss;     // struct size
- *  uint16_t    width;  // frame width
- *  uint16_t    height; // frame height
- *  uint16_t    ff;     // keyframe + some other info(???)
- *  uint32_t    size;   // size of data
- *  uint32_t    fourcc; // ML20
- *  uint32_t    u3;     // ?
- *  uint32_t    ts;     // time
- */
-
-static int msnwc_tcp_probe(AVProbeData *p)
-{
-    int i;
-
-    for(i = 0 ; i + HEADER_SIZE <= p->buf_size ; i++) {
-        uint16_t width, height;
-        uint32_t fourcc;
-        const uint8_t *bytestream = p->buf+i;
-
-        if(bytestream_get_le16(&bytestream) != HEADER_SIZE)
-            continue;
-        width  = bytestream_get_le16(&bytestream);
-        height = bytestream_get_le16(&bytestream);
-        if(!(width==320 && height==240) && !(width==160 && height==120))
-            continue;
-        bytestream += 2; // keyframe
-        bytestream += 4; // size
-        fourcc = bytestream_get_le32(&bytestream);
-        if(fourcc != MKTAG('M', 'L', '2', '0'))
-            continue;
-
-        if(i) {
-            if(i < 14)  /* starts with SwitchBoard connection info */
-                return AVPROBE_SCORE_MAX / 2;
-            else        /* starts in the middle of stream */
-                return AVPROBE_SCORE_MAX / 3;
-        } else {
-            return AVPROBE_SCORE_MAX;
-        }
-    }
-
-    return -1;
-}
-
-static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
-{
-    ByteIOContext *pb = ctx->pb;
-    AVCodecContext *codec;
-    AVStream *st;
-
-    st = av_new_stream(ctx, 0);
-    if(!st)
-        return AVERROR(ENOMEM);
-
-    codec = st->codec;
-    codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    codec->codec_id = CODEC_ID_MIMIC;
-    codec->codec_tag = MKTAG('M', 'L', '2', '0');
-
-    av_set_pts_info(st, 32, 1, 1000);
-
-    /* Some files start with "connected\r\n\r\n".
-     * So skip until we find the first byte of struct size */
-    while(get_byte(pb) != HEADER_SIZE && !url_feof(pb));
-
-    if(url_feof(pb)) {
-        av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
-        return -1;
-    }
-
-    return 0;
-}
-
-static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
-{
-    ByteIOContext *pb = ctx->pb;
-    uint16_t keyframe;
-    uint32_t size, timestamp;
-
-    url_fskip(pb, 1); /* one byte has been read ahead */
-    url_fskip(pb, 2);
-    url_fskip(pb, 2);
-    keyframe = get_le16(pb);
-    size = get_le32(pb);
-    url_fskip(pb, 4);
-    url_fskip(pb, 4);
-    timestamp = get_le32(pb);
-
-    if(!size || av_get_packet(pb, pkt, size) != size)
-        return -1;
-
-    url_fskip(pb, 1); /* Read ahead one byte of struct size like read_header */
-
-    pkt->pts = timestamp;
-    pkt->dts = timestamp;
-    pkt->stream_index = 0;
-
-    /* Some aMsn generated videos (or was it Mercury Messenger?) don't set
-     * this bit and rely on the codec to get keyframe information */
-    if(keyframe&1)
-        pkt->flags |= AV_PKT_FLAG_KEY;
-
-    return HEADER_SIZE + size;
-}
-
-AVInputFormat msnwc_tcp_demuxer = {
-    "msnwctcp",
-    NULL_IF_CONFIG_SMALL("MSN TCP Webcam stream"),
-    0,
-    msnwc_tcp_probe,
-    msnwc_tcp_read_header,
-    msnwc_tcp_read_packet,
-};
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
deleted file mode 100644
index 4eae1a1..0000000
--- a/libavformat/mtv.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * mtv demuxer
- * Copyright (c) 2006 Reynaldo H. Verdejo Pinochet
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * MTV demuxer.
- */
-
-#include "libavutil/bswap.h"
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define MTV_ASUBCHUNK_DATA_SIZE 500
-#define MTV_HEADER_SIZE 512
-#define MTV_AUDIO_PADDING_SIZE 12
-#define AUDIO_SAMPLING_RATE 44100
-#define VIDEO_SID 0
-#define AUDIO_SID 1
-
-typedef struct MTVDemuxContext {
-
-    unsigned int file_size;         ///< filesize, not always right
-    unsigned int segments;          ///< number of 512 byte segments
-    unsigned int audio_identifier;  ///< 'MP3' on all files I have seen
-    unsigned int audio_br;          ///< bitrate of audio channel (mp3)
-    unsigned int img_colorfmt;      ///< frame colorfmt rgb 565/555
-    unsigned int img_bpp;           ///< frame bits per pixel
-    unsigned int img_width;         //
-    unsigned int img_height;        //
-    unsigned int img_segment_size;  ///< size of image segment
-    unsigned int video_fps;         //
-    unsigned int full_segment_size;
-
-} MTVDemuxContext;
-
-static int mtv_probe(AVProbeData *p)
-{
-    /* Magic is 'AMV' */
-    if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V')
-        return 0;
-
-    /* Check for nonzero in bpp and (width|height) header fields */
-    if(!(p->buf[51] && AV_RL16(&p->buf[52]) | AV_RL16(&p->buf[54])))
-        return 0;
-
-    /* If width or height are 0 then imagesize header field should not */
-    if(!AV_RL16(&p->buf[52]) || !AV_RL16(&p->buf[54]))
-    {
-        if(!!AV_RL16(&p->buf[56]))
-            return AVPROBE_SCORE_MAX/2;
-        else
-            return 0;
-    }
-
-    if(p->buf[51] != 16)
-        return AVPROBE_SCORE_MAX/4; // But we are going to assume 16bpp anyway ..
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    MTVDemuxContext *mtv = s->priv_data;
-    ByteIOContext   *pb  = s->pb;
-    AVStream        *st;
-    unsigned int    audio_subsegments;
-
-    url_fskip(pb, 3);
-    mtv->file_size         = get_le32(pb);
-    mtv->segments          = get_le32(pb);
-    url_fskip(pb, 32);
-    mtv->audio_identifier  = get_le24(pb);
-    mtv->audio_br          = get_le16(pb);
-    mtv->img_colorfmt      = get_le24(pb);
-    mtv->img_bpp           = get_byte(pb);
-    mtv->img_width         = get_le16(pb);
-    mtv->img_height        = get_le16(pb);
-    mtv->img_segment_size  = get_le16(pb);
-
-    /* Calculate width and height if missing from header */
-
-    if(!mtv->img_width)
-        mtv->img_width=mtv->img_segment_size / (mtv->img_bpp>>3)
-                        / mtv->img_height;
-
-    if(!mtv->img_height)
-        mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3)
-                        / mtv->img_width;
-
-    url_fskip(pb, 4);
-    audio_subsegments = get_le16(pb);
-    mtv->full_segment_size =
-        audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
-        mtv->img_segment_size;
-    mtv->video_fps         = (mtv->audio_br / 4) / audio_subsegments;
-
-    // FIXME Add sanity check here
-
-    // all systems go! init decoders
-
-    // video - raw rgb565
-
-    st = av_new_stream(s, VIDEO_SID);
-    if(!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 64, 1, mtv->video_fps);
-    st->codec->codec_type      = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id        = CODEC_ID_RAWVIDEO;
-    st->codec->pix_fmt         = PIX_FMT_RGB565;
-    st->codec->width           = mtv->img_width;
-    st->codec->height          = mtv->img_height;
-    st->codec->sample_rate     = mtv->video_fps;
-    st->codec->extradata       = av_strdup("BottomUp");
-    st->codec->extradata_size  = 9;
-
-    // audio - mp3
-
-    st = av_new_stream(s, AUDIO_SID);
-    if(!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 64, 1, AUDIO_SAMPLING_RATE);
-    st->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id        = CODEC_ID_MP3;
-    st->codec->bit_rate        = mtv->audio_br;
-    st->need_parsing           = AVSTREAM_PARSE_FULL;
-
-    // Jump over header
-
-    if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
-        return AVERROR(EIO);
-
-    return 0;
-
-}
-
-static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MTVDemuxContext *mtv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret;
-#if !HAVE_BIGENDIAN
-    int i;
-#endif
-
-    if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
-    {
-        url_fskip(pb, MTV_AUDIO_PADDING_SIZE);
-
-        ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE);
-        if(ret < 0)
-            return ret;
-
-        pkt->pos -= MTV_AUDIO_PADDING_SIZE;
-        pkt->stream_index = AUDIO_SID;
-
-    }else
-    {
-        ret = av_get_packet(pb, pkt, mtv->img_segment_size);
-        if(ret < 0)
-            return ret;
-
-#if !HAVE_BIGENDIAN
-
-        /* pkt->data is GGGRRRR BBBBBGGG
-         * and we need RRRRRGGG GGGBBBBB
-         * for PIX_FMT_RGB565 so here we
-         * just swap bytes as they come
-         */
-
-        for(i=0;i<mtv->img_segment_size/2;i++)
-            *((uint16_t *)pkt->data+i) = bswap_16(*((uint16_t *)pkt->data+i));
-#endif
-        pkt->stream_index = VIDEO_SID;
-    }
-
-    return ret;
-}
-
-AVInputFormat mtv_demuxer = {
-    "MTV",
-    NULL_IF_CONFIG_SMALL("MTV format"),
-    sizeof(MTVDemuxContext),
-    mtv_probe,
-    mtv_read_header,
-    mtv_read_packet,
-};
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
deleted file mode 100644
index 506976d..0000000
--- a/libavformat/mvi.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Motion Pixels MVI Demuxer
- * Copyright (c) 2008 Gregory Montoir (cyx at users.sourceforge.net)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-#define MVI_FRAC_BITS 10
-
-#define MVI_AUDIO_STREAM_INDEX 0
-#define MVI_VIDEO_STREAM_INDEX 1
-
-typedef struct MviDemuxContext {
-    unsigned int (*get_int)(ByteIOContext *);
-    uint32_t audio_data_size;
-    uint64_t audio_size_counter;
-    uint64_t audio_frame_size;
-    int audio_size_left;
-    int video_frame_size;
-} MviDemuxContext;
-
-static int read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    MviDemuxContext *mvi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *ast, *vst;
-    unsigned int version, frames_count, msecs_per_frame, player_version;
-
-    ast = av_new_stream(s, 0);
-    if (!ast)
-        return AVERROR(ENOMEM);
-
-    vst = av_new_stream(s, 0);
-    if (!vst)
-        return AVERROR(ENOMEM);
-
-    vst->codec->extradata_size = 2;
-    vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE);
-
-    version                  = get_byte(pb);
-    vst->codec->extradata[0] = get_byte(pb);
-    vst->codec->extradata[1] = get_byte(pb);
-    frames_count             = get_le32(pb);
-    msecs_per_frame          = get_le32(pb);
-    vst->codec->width        = get_le16(pb);
-    vst->codec->height       = get_le16(pb);
-    get_byte(pb);
-    ast->codec->sample_rate  = get_le16(pb);
-    mvi->audio_data_size     = get_le32(pb);
-    get_byte(pb);
-    player_version           = get_le32(pb);
-    get_le16(pb);
-    get_byte(pb);
-
-    if (frames_count == 0 || mvi->audio_data_size == 0)
-        return AVERROR_INVALIDDATA;
-
-    if (version != 7 || player_version > 213) {
-        av_log(s, AV_LOG_ERROR, "unhandled version (%d,%d)\n", version, player_version);
-        return AVERROR_INVALIDDATA;
-    }
-
-    av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
-    ast->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
-    ast->codec->codec_id        = CODEC_ID_PCM_U8;
-    ast->codec->channels        = 1;
-    ast->codec->bits_per_coded_sample = 8;
-    ast->codec->bit_rate        = ast->codec->sample_rate * 8;
-
-    av_set_pts_info(vst, 64, msecs_per_frame, 1000000);
-    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id   = CODEC_ID_MOTIONPIXELS;
-
-    mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? get_le16 : get_le24;
-
-    mvi->audio_frame_size   = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
-    mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size;
-    mvi->audio_size_left    = mvi->audio_data_size;
-
-    return 0;
-}
-
-static int read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, count;
-    MviDemuxContext *mvi = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    if (mvi->video_frame_size == 0) {
-        mvi->video_frame_size = (mvi->get_int)(pb);
-        if (mvi->audio_size_left == 0)
-            return AVERROR(EIO);
-        count = (mvi->audio_size_counter + mvi->audio_frame_size + 512) >> MVI_FRAC_BITS;
-        if (count > mvi->audio_size_left)
-            count = mvi->audio_size_left;
-        if ((ret = av_get_packet(pb, pkt, count)) < 0)
-            return ret;
-        pkt->stream_index = MVI_AUDIO_STREAM_INDEX;
-        mvi->audio_size_left -= count;
-        mvi->audio_size_counter += mvi->audio_frame_size - (count << MVI_FRAC_BITS);
-    } else {
-        if ((ret = av_get_packet(pb, pkt, mvi->video_frame_size)) < 0)
-            return ret;
-        pkt->stream_index = MVI_VIDEO_STREAM_INDEX;
-        mvi->video_frame_size = 0;
-    }
-    return 0;
-}
-
-AVInputFormat mvi_demuxer = {
-    "mvi",
-    NULL_IF_CONFIG_SMALL("Motion Pixels MVI format"),
-    sizeof(MviDemuxContext),
-    NULL,
-    read_header,
-    read_packet,
-    .extensions = "mvi"
-};
diff --git a/libavformat/mxf.c b/libavformat/mxf.c
deleted file mode 100644
index 452ee6d..0000000
--- a/libavformat/mxf.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * MXF
- * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mxf.h"
-
-/**
- * SMPTE RP224 http://www.smpte-ra.org/mdd/index.html
- */
-const MXFCodecUL ff_mxf_data_definition_uls[] = {
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x01,0x00,0x00,0x00 }, 13, AVMEDIA_TYPE_VIDEO },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x02,0x02,0x00,0x00,0x00 }, 13, AVMEDIA_TYPE_AUDIO },
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,  AVMEDIA_TYPE_DATA },
-};
-
-const MXFCodecUL ff_mxf_codec_uls[] = {
-    /* PictureEssenceCoding */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x01,0x11,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, /* MP at ML Long GoP */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* D-10 50Mbps PAL */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x03,0x03,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, /* MP at HL Long GoP */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x02,0x00 }, 14, CODEC_ID_MPEG2VIDEO }, /* 422P at HL I-Frame */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x20,0x02,0x03 }, 14,      CODEC_ID_MPEG4 }, /* XDCAM proxy_pal030926.mxf */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x02,0x01,0x02,0x00 }, 13,    CODEC_ID_DVVIDEO }, /* DV25 IEC PAL */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x01,0x02,0x02,0x03,0x01,0x01,0x00 }, 14,   CODEC_ID_JPEG2000 }, /* JPEG2000 Codestream */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13,   CODEC_ID_RAWVIDEO }, /* Uncompressed */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x03,0x02,0x00,0x00 }, 14,      CODEC_ID_DNXHD }, /* SMPTE VC-3/DNxHD */
-    /* SoundEssenceCompression */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 }, 13,  CODEC_ID_PCM_S16LE }, /* Uncompressed */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x7F,0x00,0x00,0x00 }, 13,  CODEC_ID_PCM_S16LE },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x07,0x04,0x02,0x02,0x01,0x7E,0x00,0x00,0x00 }, 13,  CODEC_ID_PCM_S16BE }, /* From Omneon MXF file */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x04,0x04,0x02,0x02,0x02,0x03,0x01,0x01,0x00 }, 15,   CODEC_ID_PCM_ALAW }, /* XDCAM Proxy C0023S01.mxf */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x01,0x00 }, 15,        CODEC_ID_AC3 },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x05,0x00 }, 15,        CODEC_ID_MP2 }, /* MP2 or MP3 */
-  //{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x1C,0x00 }, 15,    CODEC_ID_DOLBY_E }, /* Dolby-E */
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,       CODEC_ID_NONE },
-};
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
deleted file mode 100644
index 99553a5..0000000
--- a/libavformat/mxf.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * MXF
- * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVFORMAT_MXF_H
-#define AVFORMAT_MXF_H
-
-#include "libavcodec/avcodec.h"
-#include <stdint.h>
-
-typedef uint8_t UID[16];
-
-enum MXFMetadataSetType {
-    AnyType,
-    MaterialPackage,
-    SourcePackage,
-    SourceClip,
-    TimecodeComponent,
-    Sequence,
-    MultipleDescriptor,
-    Descriptor,
-    Track,
-    CryptoContext,
-    Preface,
-    Identification,
-    ContentStorage,
-    SubDescriptor,
-    IndexTableSegment,
-    EssenceContainerData,
-    TypeBottom,// add metadata type before this
-};
-
-typedef struct {
-    UID key;
-    int64_t offset;
-    uint64_t length;
-} KLVPacket;
-
-typedef struct {
-    UID uid;
-    unsigned matching_len;
-    int id;
-} MXFCodecUL;
-
-extern const MXFCodecUL ff_mxf_data_definition_uls[];
-extern const MXFCodecUL ff_mxf_codec_uls[];
-
-#ifdef DEBUG
-#define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \
-                             (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])
-#else
-#define PRINT_KEY(pc, s, x)
-#endif
-
-#endif /* AVFORMAT_MXF_H */
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
deleted file mode 100644
index 168fd8d..0000000
--- a/libavformat/mxfdec.c
+++ /dev/null
@@ -1,1014 +0,0 @@
-/*
- * MXF demuxer.
- * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * References
- * SMPTE 336M KLV Data Encoding Protocol Using Key-Length-Value
- * SMPTE 377M MXF File Format Specifications
- * SMPTE 378M Operational Pattern 1a
- * SMPTE 379M MXF Generic Container
- * SMPTE 381M Mapping MPEG Streams into the MXF Generic Container
- * SMPTE 382M Mapping AES3 and Broadcast Wave Audio into the MXF Generic Container
- * SMPTE 383M Mapping DV-DIF Data to the MXF Generic Container
- *
- * Principle
- * Search for Track numbers which will identify essence element KLV packets.
- * Search for SourcePackage which define tracks which contains Track numbers.
- * Material Package contains tracks with reference to SourcePackage tracks.
- * Search for Descriptors (Picture, Sound) which contains codec info and parameters.
- * Assign Descriptors to correct Tracks.
- *
- * Metadata reading functions read Local Tags, get InstanceUID(0x3C0A) then add MetaDataSet to MXFContext.
- * Metadata parsing resolves Strong References to objects.
- *
- * Simple demuxer, only OP1A supported and some files might not work at all.
- * Only tracks with associated descriptors will be decoded. "Highly Desirable" SMPTE 377M D.1
- */
-
-//#define DEBUG
-
-#include "libavutil/aes.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "mxf.h"
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-    UID source_container_ul;
-} MXFCryptoContext;
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-    UID source_package_uid;
-    UID data_definition_ul;
-    int64_t duration;
-    int64_t start_position;
-    int source_track_id;
-} MXFStructuralComponent;
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-    UID data_definition_ul;
-    UID *structural_components_refs;
-    int structural_components_count;
-    int64_t duration;
-} MXFSequence;
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-    MXFSequence *sequence; /* mandatory, and only one */
-    UID sequence_ref;
-    int track_id;
-    uint8_t track_number[4];
-    AVRational edit_rate;
-} MXFTrack;
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-    UID essence_container_ul;
-    UID essence_codec_ul;
-    AVRational sample_rate;
-    AVRational aspect_ratio;
-    int width;
-    int height;
-    int channels;
-    int bits_per_sample;
-    UID *sub_descriptors_refs;
-    int sub_descriptors_count;
-    int linked_track_id;
-    uint8_t *extradata;
-    int extradata_size;
-} MXFDescriptor;
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-} MXFIndexTableSegment;
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-    UID package_uid;
-    UID *tracks_refs;
-    int tracks_count;
-    MXFDescriptor *descriptor; /* only one */
-    UID descriptor_ref;
-} MXFPackage;
-
-typedef struct {
-    UID uid;
-    enum MXFMetadataSetType type;
-} MXFMetadataSet;
-
-typedef struct {
-    UID *packages_refs;
-    int packages_count;
-    MXFMetadataSet **metadata_sets;
-    int metadata_sets_count;
-    AVFormatContext *fc;
-    struct AVAES *aesc;
-    uint8_t *local_tags;
-    int local_tags_count;
-} MXFContext;
-
-enum MXFWrappingScheme {
-    Frame,
-    Clip,
-};
-
-typedef struct {
-    const UID key;
-    int (*read)();
-    int ctx_size;
-    enum MXFMetadataSetType type;
-} MXFMetadataReadTableEntry;
-
-/* partial keys to match */
-static const uint8_t mxf_header_partition_pack_key[]       = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
-static const uint8_t mxf_essence_element_key[]             = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
-static const uint8_t mxf_klv_key[]                         = { 0x06,0x0e,0x2b,0x34 };
-/* complete keys to match */
-static const uint8_t mxf_crypto_source_container_ul[]      = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 };
-static const uint8_t mxf_encrypted_triplet_key[]           = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 };
-static const uint8_t mxf_encrypted_essence_container[]     = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 };
-static const uint8_t mxf_sony_mpeg4_extradata[]            = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 };
-
-#define IS_KLV_KEY(x, y) (!memcmp(x, y, sizeof(y)))
-
-static int64_t klv_decode_ber_length(ByteIOContext *pb)
-{
-    uint64_t size = get_byte(pb);
-    if (size & 0x80) { /* long form */
-        int bytes_num = size & 0x7f;
-        /* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */
-        if (bytes_num > 8)
-            return -1;
-        size = 0;
-        while (bytes_num--)
-            size = size << 8 | get_byte(pb);
-    }
-    return size;
-}
-
-static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size)
-{
-    int i, b;
-    for (i = 0; i < size && !url_feof(pb); i++) {
-        b = get_byte(pb);
-        if (b == key[0])
-            i = 0;
-        else if (b != key[i])
-            i = -1;
-    }
-    return i == size;
-}
-
-static int klv_read_packet(KLVPacket *klv, ByteIOContext *pb)
-{
-    if (!mxf_read_sync(pb, mxf_klv_key, 4))
-        return -1;
-    klv->offset = url_ftell(pb) - 4;
-    memcpy(klv->key, mxf_klv_key, 4);
-    get_buffer(pb, klv->key + 4, 12);
-    klv->length = klv_decode_ber_length(pb);
-    return klv->length == -1 ? -1 : 0;
-}
-
-static int mxf_get_stream_index(AVFormatContext *s, KLVPacket *klv)
-{
-    int i;
-
-    for (i = 0; i < s->nb_streams; i++) {
-        MXFTrack *track = s->streams[i]->priv_data;
-        /* SMPTE 379M 7.3 */
-        if (!memcmp(klv->key + sizeof(mxf_essence_element_key), track->track_number, sizeof(track->track_number)))
-            return i;
-    }
-    /* return 0 if only one stream, for OP Atom files with 0 as track number */
-    return s->nb_streams == 1 ? 0 : -1;
-}
-
-/* XXX: use AVBitStreamFilter */
-static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pkt, int64_t length)
-{
-    const uint8_t *buf_ptr, *end_ptr;
-    uint8_t *data_ptr;
-    int i;
-
-    if (length > 61444) /* worst case PAL 1920 samples 8 channels */
-        return -1;
-    av_new_packet(pkt, length);
-    get_buffer(pb, pkt->data, length);
-    data_ptr = pkt->data;
-    end_ptr = pkt->data + length;
-    buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */
-    for (; buf_ptr < end_ptr; ) {
-        for (i = 0; i < st->codec->channels; i++) {
-            uint32_t sample = bytestream_get_le32(&buf_ptr);
-            if (st->codec->bits_per_coded_sample == 24)
-                bytestream_put_le24(&data_ptr, (sample >> 4) & 0xffffff);
-            else
-                bytestream_put_le16(&data_ptr, (sample >> 12) & 0xffff);
-        }
-        buf_ptr += 32 - st->codec->channels*4; // always 8 channels stored SMPTE 331M
-    }
-    pkt->size = data_ptr - pkt->data;
-    return 0;
-}
-
-static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv)
-{
-    static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t end = url_ftell(pb) + klv->length;
-    uint64_t size;
-    uint64_t orig_size;
-    uint64_t plaintext_size;
-    uint8_t ivec[16];
-    uint8_t tmpbuf[16];
-    int index;
-
-    if (!mxf->aesc && s->key && s->keylen == 16) {
-        mxf->aesc = av_malloc(av_aes_size);
-        if (!mxf->aesc)
-            return -1;
-        av_aes_init(mxf->aesc, s->key, 128, 1);
-    }
-    // crypto context
-    url_fskip(pb, klv_decode_ber_length(pb));
-    // plaintext offset
-    klv_decode_ber_length(pb);
-    plaintext_size = get_be64(pb);
-    // source klv key
-    klv_decode_ber_length(pb);
-    get_buffer(pb, klv->key, 16);
-    if (!IS_KLV_KEY(klv, mxf_essence_element_key))
-        return -1;
-    index = mxf_get_stream_index(s, klv);
-    if (index < 0)
-        return -1;
-    // source size
-    klv_decode_ber_length(pb);
-    orig_size = get_be64(pb);
-    if (orig_size < plaintext_size)
-        return -1;
-    // enc. code
-    size = klv_decode_ber_length(pb);
-    if (size < 32 || size - 32 < orig_size)
-        return -1;
-    get_buffer(pb, ivec, 16);
-    get_buffer(pb, tmpbuf, 16);
-    if (mxf->aesc)
-        av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1);
-    if (memcmp(tmpbuf, checkv, 16))
-        av_log(s, AV_LOG_ERROR, "probably incorrect decryption key\n");
-    size -= 32;
-    av_get_packet(pb, pkt, size);
-    size -= plaintext_size;
-    if (mxf->aesc)
-        av_aes_crypt(mxf->aesc, &pkt->data[plaintext_size],
-                     &pkt->data[plaintext_size], size >> 4, ivec, 1);
-    pkt->size = orig_size;
-    pkt->stream_index = index;
-    url_fskip(pb, end - url_ftell(pb));
-    return 0;
-}
-
-static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    KLVPacket klv;
-
-    while (!url_feof(s->pb)) {
-        if (klv_read_packet(&klv, s->pb) < 0)
-            return -1;
-        PRINT_KEY(s, "read packet", klv.key);
-        dprintf(s, "size %lld offset %#llx\n", klv.length, klv.offset);
-        if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key)) {
-            int res = mxf_decrypt_triplet(s, pkt, &klv);
-            if (res < 0) {
-                av_log(s, AV_LOG_ERROR, "invalid encoded triplet\n");
-                return -1;
-            }
-            return 0;
-        }
-        if (IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
-            int index = mxf_get_stream_index(s, &klv);
-            if (index < 0) {
-                av_log(s, AV_LOG_ERROR, "error getting stream index %d\n", AV_RB32(klv.key+12));
-                goto skip;
-            }
-            if (s->streams[index]->discard == AVDISCARD_ALL)
-                goto skip;
-            /* check for 8 channels AES3 element */
-            if (klv.key[12] == 0x06 && klv.key[13] == 0x01 && klv.key[14] == 0x10) {
-                if (mxf_get_d10_aes3_packet(s->pb, s->streams[index], pkt, klv.length) < 0) {
-                    av_log(s, AV_LOG_ERROR, "error reading D-10 aes3 frame\n");
-                    return -1;
-                }
-            } else
-                av_get_packet(s->pb, pkt, klv.length);
-            pkt->stream_index = index;
-            pkt->pos = klv.offset;
-            return 0;
-        } else
-        skip:
-            url_fskip(s->pb, klv.length);
-    }
-    return AVERROR_EOF;
-}
-
-static int mxf_read_primer_pack(MXFContext *mxf)
-{
-    ByteIOContext *pb = mxf->fc->pb;
-    int item_num = get_be32(pb);
-    int item_len = get_be32(pb);
-
-    if (item_len != 18) {
-        av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n");
-        return -1;
-    }
-    if (item_num > UINT_MAX / item_len)
-        return -1;
-    mxf->local_tags_count = item_num;
-    mxf->local_tags = av_malloc(item_num*item_len);
-    if (!mxf->local_tags)
-        return -1;
-    get_buffer(pb, mxf->local_tags, item_num*item_len);
-    return 0;
-}
-
-static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
-{
-    if (mxf->metadata_sets_count+1 >= UINT_MAX / sizeof(*mxf->metadata_sets))
-        return AVERROR(ENOMEM);
-    mxf->metadata_sets = av_realloc(mxf->metadata_sets, (mxf->metadata_sets_count + 1) * sizeof(*mxf->metadata_sets));
-    if (!mxf->metadata_sets)
-        return -1;
-    mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set;
-    mxf->metadata_sets_count++;
-    return 0;
-}
-
-static int mxf_read_cryptographic_context(MXFCryptoContext *cryptocontext, ByteIOContext *pb, int tag, int size, UID uid)
-{
-    if (size != 16)
-        return -1;
-    if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul))
-        get_buffer(pb, cryptocontext->source_container_ul, 16);
-    return 0;
-}
-
-static int mxf_read_content_storage(MXFContext *mxf, ByteIOContext *pb, int tag)
-{
-    switch (tag) {
-    case 0x1901:
-        mxf->packages_count = get_be32(pb);
-        if (mxf->packages_count >= UINT_MAX / sizeof(UID))
-            return -1;
-        mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID));
-        if (!mxf->packages_refs)
-            return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
-        break;
-    }
-    return 0;
-}
-
-static int mxf_read_source_clip(MXFStructuralComponent *source_clip, ByteIOContext *pb, int tag)
-{
-    switch(tag) {
-    case 0x0202:
-        source_clip->duration = get_be64(pb);
-        break;
-    case 0x1201:
-        source_clip->start_position = get_be64(pb);
-        break;
-    case 0x1101:
-        /* UMID, only get last 16 bytes */
-        url_fskip(pb, 16);
-        get_buffer(pb, source_clip->source_package_uid, 16);
-        break;
-    case 0x1102:
-        source_clip->source_track_id = get_be32(pb);
-        break;
-    }
-    return 0;
-}
-
-static int mxf_read_material_package(MXFPackage *package, ByteIOContext *pb, int tag)
-{
-    switch(tag) {
-    case 0x4403:
-        package->tracks_count = get_be32(pb);
-        if (package->tracks_count >= UINT_MAX / sizeof(UID))
-            return -1;
-        package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
-        if (!package->tracks_refs)
-            return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
-        break;
-    }
-    return 0;
-}
-
-static int mxf_read_track(MXFTrack *track, ByteIOContext *pb, int tag)
-{
-    switch(tag) {
-    case 0x4801:
-        track->track_id = get_be32(pb);
-        break;
-    case 0x4804:
-        get_buffer(pb, track->track_number, 4);
-        break;
-    case 0x4B01:
-        track->edit_rate.den = get_be32(pb);
-        track->edit_rate.num = get_be32(pb);
-        break;
-    case 0x4803:
-        get_buffer(pb, track->sequence_ref, 16);
-        break;
-    }
-    return 0;
-}
-
-static int mxf_read_sequence(MXFSequence *sequence, ByteIOContext *pb, int tag)
-{
-    switch(tag) {
-    case 0x0202:
-        sequence->duration = get_be64(pb);
-        break;
-    case 0x0201:
-        get_buffer(pb, sequence->data_definition_ul, 16);
-        break;
-    case 0x1001:
-        sequence->structural_components_count = get_be32(pb);
-        if (sequence->structural_components_count >= UINT_MAX / sizeof(UID))
-            return -1;
-        sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID));
-        if (!sequence->structural_components_refs)
-            return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
-        break;
-    }
-    return 0;
-}
-
-static int mxf_read_source_package(MXFPackage *package, ByteIOContext *pb, int tag)
-{
-    switch(tag) {
-    case 0x4403:
-        package->tracks_count = get_be32(pb);
-        if (package->tracks_count >= UINT_MAX / sizeof(UID))
-            return -1;
-        package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
-        if (!package->tracks_refs)
-            return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
-        break;
-    case 0x4401:
-        /* UMID, only get last 16 bytes */
-        url_fskip(pb, 16);
-        get_buffer(pb, package->package_uid, 16);
-        break;
-    case 0x4701:
-        get_buffer(pb, package->descriptor_ref, 16);
-        break;
-    }
-    return 0;
-}
-
-static int mxf_read_index_table_segment(MXFIndexTableSegment *segment, ByteIOContext *pb, int tag)
-{
-    switch(tag) {
-    case 0x3F05: dprintf(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break;
-    case 0x3F06: dprintf(NULL, "IndexSID %d\n", get_be32(pb)); break;
-    case 0x3F07: dprintf(NULL, "BodySID %d\n", get_be32(pb)); break;
-    case 0x3F0B: dprintf(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break;
-    case 0x3F0C: dprintf(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break;
-    case 0x3F0D: dprintf(NULL, "IndexDuration %lld\n", get_be64(pb)); break;
-    }
-    return 0;
-}
-
-static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor)
-{
-    int code;
-
-    do {
-        code = get_byte(pb);
-        dprintf(NULL, "pixel layout: code %#x\n", code);
-        switch (code) {
-        case 0x52: /* R */
-            descriptor->bits_per_sample += get_byte(pb);
-            break;
-        case 0x47: /* G */
-            descriptor->bits_per_sample += get_byte(pb);
-            break;
-        case 0x42: /* B */
-            descriptor->bits_per_sample += get_byte(pb);
-            break;
-        default:
-            get_byte(pb);
-        }
-    } while (code != 0); /* SMPTE 377M E.2.46 */
-}
-
-static int mxf_read_generic_descriptor(MXFDescriptor *descriptor, ByteIOContext *pb, int tag, int size, UID uid)
-{
-    switch(tag) {
-    case 0x3F01:
-        descriptor->sub_descriptors_count = get_be32(pb);
-        if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID))
-            return -1;
-        descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID));
-        if (!descriptor->sub_descriptors_refs)
-            return -1;
-        url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
-        get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
-        break;
-    case 0x3004:
-        get_buffer(pb, descriptor->essence_container_ul, 16);
-        break;
-    case 0x3006:
-        descriptor->linked_track_id = get_be32(pb);
-        break;
-    case 0x3201: /* PictureEssenceCoding */
-        get_buffer(pb, descriptor->essence_codec_ul, 16);
-        break;
-    case 0x3203:
-        descriptor->width = get_be32(pb);
-        break;
-    case 0x3202:
-        descriptor->height = get_be32(pb);
-        break;
-    case 0x320E:
-        descriptor->aspect_ratio.num = get_be32(pb);
-        descriptor->aspect_ratio.den = get_be32(pb);
-        break;
-    case 0x3D03:
-        descriptor->sample_rate.num = get_be32(pb);
-        descriptor->sample_rate.den = get_be32(pb);
-        break;
-    case 0x3D06: /* SoundEssenceCompression */
-        get_buffer(pb, descriptor->essence_codec_ul, 16);
-        break;
-    case 0x3D07:
-        descriptor->channels = get_be32(pb);
-        break;
-    case 0x3D01:
-        descriptor->bits_per_sample = get_be32(pb);
-        break;
-    case 0x3401:
-        mxf_read_pixel_layout(pb, descriptor);
-        break;
-    default:
-        /* Private uid used by SONY C0023S01.mxf */
-        if (IS_KLV_KEY(uid, mxf_sony_mpeg4_extradata)) {
-            descriptor->extradata = av_malloc(size);
-            if (!descriptor->extradata)
-                return -1;
-            descriptor->extradata_size = size;
-            get_buffer(pb, descriptor->extradata, size);
-        }
-        break;
-    }
-    return 0;
-}
-
-/*
- * Match an uid independently of the version byte and up to len common bytes
- * Returns: boolean
- */
-static int mxf_match_uid(const UID key, const UID uid, int len)
-{
-    int i;
-    for (i = 0; i < len; i++) {
-        if (i != 7 && key[i] != uid[i])
-            return 0;
-    }
-    return 1;
-}
-
-static const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid)
-{
-    while (uls->uid[0]) {
-        if(mxf_match_uid(uls->uid, *uid, uls->matching_len))
-            break;
-        uls++;
-    }
-    return uls;
-}
-
-static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type)
-{
-    int i;
-
-    if (!strong_ref)
-        return NULL;
-    for (i = 0; i < mxf->metadata_sets_count; i++) {
-        if (!memcmp(*strong_ref, mxf->metadata_sets[i]->uid, 16) &&
-            (type == AnyType || mxf->metadata_sets[i]->type == type)) {
-            return mxf->metadata_sets[i];
-        }
-    }
-    return NULL;
-}
-
-static const MXFCodecUL mxf_essence_container_uls[] = {
-    // video essence container uls
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14,    CODEC_ID_DVVIDEO }, /* DV 625 25mbps */
-    // sound essence container uls
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14,       CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, 14, CODEC_ID_PCM_S16LE }, /* D-10 Mapping 50Mbps PAL Extended Template */
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,      CODEC_ID_NONE },
-};
-
-static int mxf_parse_structural_metadata(MXFContext *mxf)
-{
-    MXFPackage *material_package = NULL;
-    MXFPackage *temp_package = NULL;
-    int i, j, k;
-
-    dprintf(mxf->fc, "metadata sets count %d\n", mxf->metadata_sets_count);
-    /* TODO: handle multiple material packages (OP3x) */
-    for (i = 0; i < mxf->packages_count; i++) {
-        material_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[i], MaterialPackage);
-        if (material_package) break;
-    }
-    if (!material_package) {
-        av_log(mxf->fc, AV_LOG_ERROR, "no material package found\n");
-        return -1;
-    }
-
-    for (i = 0; i < material_package->tracks_count; i++) {
-        MXFPackage *source_package = NULL;
-        MXFTrack *material_track = NULL;
-        MXFTrack *source_track = NULL;
-        MXFTrack *temp_track = NULL;
-        MXFDescriptor *descriptor = NULL;
-        MXFStructuralComponent *component = NULL;
-        UID *essence_container_ul = NULL;
-        const MXFCodecUL *codec_ul = NULL;
-        const MXFCodecUL *container_ul = NULL;
-        AVStream *st;
-
-        if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {
-            av_log(mxf->fc, AV_LOG_ERROR, "could not resolve material track strong ref\n");
-            continue;
-        }
-
-        if (!(material_track->sequence = mxf_resolve_strong_ref(mxf, &material_track->sequence_ref, Sequence))) {
-            av_log(mxf->fc, AV_LOG_ERROR, "could not resolve material track sequence strong ref\n");
-            continue;
-        }
-
-        /* TODO: handle multiple source clips */
-        for (j = 0; j < material_track->sequence->structural_components_count; j++) {
-            /* TODO: handle timecode component */
-            component = mxf_resolve_strong_ref(mxf, &material_track->sequence->structural_components_refs[j], SourceClip);
-            if (!component)
-                continue;
-
-            for (k = 0; k < mxf->packages_count; k++) {
-                temp_package = mxf_resolve_strong_ref(mxf, &mxf->packages_refs[k], SourcePackage);
-                if (!temp_package)
-                    continue;
-                if (!memcmp(temp_package->package_uid, component->source_package_uid, 16)) {
-                    source_package = temp_package;
-                    break;
-                }
-            }
-            if (!source_package) {
-                av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no corresponding source package found\n", material_track->track_id);
-                break;
-            }
-            for (k = 0; k < source_package->tracks_count; k++) {
-                if (!(temp_track = mxf_resolve_strong_ref(mxf, &source_package->tracks_refs[k], Track))) {
-                    av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track strong ref\n");
-                    return -1;
-                }
-                if (temp_track->track_id == component->source_track_id) {
-                    source_track = temp_track;
-                    break;
-                }
-            }
-            if (!source_track) {
-                av_log(mxf->fc, AV_LOG_ERROR, "material track %d: no corresponding source track found\n", material_track->track_id);
-                break;
-            }
-        }
-        if (!source_track)
-            continue;
-
-        st = av_new_stream(mxf->fc, source_track->track_id);
-        if (!st) {
-            av_log(mxf->fc, AV_LOG_ERROR, "could not allocate stream\n");
-            return -1;
-        }
-        st->priv_data = source_track;
-        st->duration = component->duration;
-        if (st->duration == -1)
-            st->duration = AV_NOPTS_VALUE;
-        st->start_time = component->start_position;
-        av_set_pts_info(st, 64, material_track->edit_rate.num, material_track->edit_rate.den);
-
-        if (!(source_track->sequence = mxf_resolve_strong_ref(mxf, &source_track->sequence_ref, Sequence))) {
-            av_log(mxf->fc, AV_LOG_ERROR, "could not resolve source track sequence strong ref\n");
-            return -1;
-        }
-
-        PRINT_KEY(mxf->fc, "data definition   ul", source_track->sequence->data_definition_ul);
-        codec_ul = mxf_get_codec_ul(ff_mxf_data_definition_uls, &source_track->sequence->data_definition_ul);
-        st->codec->codec_type = codec_ul->id;
-
-        source_package->descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor_ref, AnyType);
-        if (source_package->descriptor) {
-            if (source_package->descriptor->type == MultipleDescriptor) {
-                for (j = 0; j < source_package->descriptor->sub_descriptors_count; j++) {
-                    MXFDescriptor *sub_descriptor = mxf_resolve_strong_ref(mxf, &source_package->descriptor->sub_descriptors_refs[j], Descriptor);
-
-                    if (!sub_descriptor) {
-                        av_log(mxf->fc, AV_LOG_ERROR, "could not resolve sub descriptor strong ref\n");
-                        continue;
-                    }
-                    if (sub_descriptor->linked_track_id == source_track->track_id) {
-                        descriptor = sub_descriptor;
-                        break;
-                    }
-                }
-            } else if (source_package->descriptor->type == Descriptor)
-                descriptor = source_package->descriptor;
-        }
-        if (!descriptor) {
-            av_log(mxf->fc, AV_LOG_INFO, "source track %d: stream %d, no descriptor found\n", source_track->track_id, st->index);
-            continue;
-        }
-        PRINT_KEY(mxf->fc, "essence codec     ul", descriptor->essence_codec_ul);
-        PRINT_KEY(mxf->fc, "essence container ul", descriptor->essence_container_ul);
-        essence_container_ul = &descriptor->essence_container_ul;
-        /* HACK: replacing the original key with mxf_encrypted_essence_container
-         * is not allowed according to s429-6, try to find correct information anyway */
-        if (IS_KLV_KEY(essence_container_ul, mxf_encrypted_essence_container)) {
-            av_log(mxf->fc, AV_LOG_INFO, "broken encrypted mxf file\n");
-            for (k = 0; k < mxf->metadata_sets_count; k++) {
-                MXFMetadataSet *metadata = mxf->metadata_sets[k];
-                if (metadata->type == CryptoContext) {
-                    essence_container_ul = &((MXFCryptoContext *)metadata)->source_container_ul;
-                    break;
-                }
-            }
-        }
-        /* TODO: drop PictureEssenceCoding and SoundEssenceCompression, only check EssenceContainer */
-        codec_ul = mxf_get_codec_ul(ff_mxf_codec_uls, &descriptor->essence_codec_ul);
-        st->codec->codec_id = codec_ul->id;
-        if (descriptor->extradata) {
-            st->codec->extradata = descriptor->extradata;
-            st->codec->extradata_size = descriptor->extradata_size;
-        }
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul);
-            if (st->codec->codec_id == CODEC_ID_NONE)
-                st->codec->codec_id = container_ul->id;
-            st->codec->width = descriptor->width;
-            st->codec->height = descriptor->height;
-            st->codec->bits_per_coded_sample = descriptor->bits_per_sample; /* Uncompressed */
-            st->need_parsing = AVSTREAM_PARSE_HEADERS;
-        } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul);
-            if (st->codec->codec_id == CODEC_ID_NONE)
-                st->codec->codec_id = container_ul->id;
-            st->codec->channels = descriptor->channels;
-            st->codec->bits_per_coded_sample = descriptor->bits_per_sample;
-            st->codec->sample_rate = descriptor->sample_rate.num / descriptor->sample_rate.den;
-            /* TODO: implement CODEC_ID_RAWAUDIO */
-            if (st->codec->codec_id == CODEC_ID_PCM_S16LE) {
-                if (descriptor->bits_per_sample == 24)
-                    st->codec->codec_id = CODEC_ID_PCM_S24LE;
-                else if (descriptor->bits_per_sample == 32)
-                    st->codec->codec_id = CODEC_ID_PCM_S32LE;
-            } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
-                if (descriptor->bits_per_sample == 24)
-                    st->codec->codec_id = CODEC_ID_PCM_S24BE;
-                else if (descriptor->bits_per_sample == 32)
-                    st->codec->codec_id = CODEC_ID_PCM_S32BE;
-            } else if (st->codec->codec_id == CODEC_ID_MP2) {
-                st->need_parsing = AVSTREAM_PARSE_FULL;
-            }
-        }
-        if (st->codec->codec_type != AVMEDIA_TYPE_DATA && (*essence_container_ul)[15] > 0x01) {
-            av_log(mxf->fc, AV_LOG_WARNING, "only frame wrapped mappings are correctly supported\n");
-            st->need_parsing = AVSTREAM_PARSE_FULL;
-        }
-    }
-    return 0;
-}
-
-static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = {
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x05,0x01,0x00 }, mxf_read_primer_pack },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x18,0x00 }, mxf_read_content_storage, 0, AnyType },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x37,0x00 }, mxf_read_source_package, sizeof(MXFPackage), SourcePackage },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x36,0x00 }, mxf_read_material_package, sizeof(MXFPackage), MaterialPackage },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x0F,0x00 }, mxf_read_sequence, sizeof(MXFSequence), Sequence },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x11,0x00 }, mxf_read_source_clip, sizeof(MXFStructuralComponent), SourceClip },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x44,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), MultipleDescriptor },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x42,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* Generic Sound */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x28,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* CDCI */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x29,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* RGBA */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* MPEG 2 Video */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x48,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* Wave */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x47,0x00 }, mxf_read_generic_descriptor, sizeof(MXFDescriptor), Descriptor }, /* AES3 */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3A,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, /* Static Track */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x3B,0x00 }, mxf_read_track, sizeof(MXFTrack), Track }, /* Generic Track */
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext },
-    { { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 }, mxf_read_index_table_segment, sizeof(MXFIndexTableSegment), IndexTableSegment },
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL, 0, AnyType },
-};
-
-static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, int (*read_child)(), int ctx_size, enum MXFMetadataSetType type)
-{
-    ByteIOContext *pb = mxf->fc->pb;
-    MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
-    uint64_t klv_end = url_ftell(pb) + klv->length;
-
-    if (!ctx)
-        return -1;
-    while (url_ftell(pb) + 4 < klv_end) {
-        int tag = get_be16(pb);
-        int size = get_be16(pb); /* KLV specified by 0x53 */
-        uint64_t next = url_ftell(pb) + size;
-        UID uid = {0};
-
-        dprintf(mxf->fc, "local tag %#04x size %d\n", tag, size);
-        if (!size) { /* ignore empty tag, needed for some files with empty UMID tag */
-            av_log(mxf->fc, AV_LOG_ERROR, "local tag %#04x with 0 size\n", tag);
-            continue;
-        }
-        if (tag > 0x7FFF) { /* dynamic tag */
-            int i;
-            for (i = 0; i < mxf->local_tags_count; i++) {
-                int local_tag = AV_RB16(mxf->local_tags+i*18);
-                if (local_tag == tag) {
-                    memcpy(uid, mxf->local_tags+i*18+2, 16);
-                    dprintf(mxf->fc, "local tag %#04x\n", local_tag);
-                    PRINT_KEY(mxf->fc, "uid", uid);
-                }
-            }
-        }
-        if (ctx_size && tag == 0x3C0A)
-            get_buffer(pb, ctx->uid, 16);
-        else if (read_child(ctx, pb, tag, size, uid) < 0)
-            return -1;
-
-        url_fseek(pb, next, SEEK_SET);
-    }
-    if (ctx_size) ctx->type = type;
-    return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0;
-}
-
-static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    MXFContext *mxf = s->priv_data;
-    KLVPacket klv;
-
-    if (!mxf_read_sync(s->pb, mxf_header_partition_pack_key, 14)) {
-        av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n");
-        return -1;
-    }
-    url_fseek(s->pb, -14, SEEK_CUR);
-    mxf->fc = s;
-    while (!url_feof(s->pb)) {
-        const MXFMetadataReadTableEntry *metadata;
-
-        if (klv_read_packet(&klv, s->pb) < 0)
-            return -1;
-        PRINT_KEY(s, "read header", klv.key);
-        dprintf(s, "size %lld offset %#llx\n", klv.length, klv.offset);
-        if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) ||
-            IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
-            /* FIXME avoid seek */
-            url_fseek(s->pb, klv.offset, SEEK_SET);
-            break;
-        }
-
-        for (metadata = mxf_metadata_read_table; metadata->read; metadata++) {
-            if (IS_KLV_KEY(klv.key, metadata->key)) {
-                int (*read)() = klv.key[5] == 0x53 ? mxf_read_local_tags : metadata->read;
-                if (read(mxf, &klv, metadata->read, metadata->ctx_size, metadata->type) < 0) {
-                    av_log(s, AV_LOG_ERROR, "error reading header metadata\n");
-                    return -1;
-                }
-                break;
-            }
-        }
-        if (!metadata->read)
-            url_fskip(s->pb, klv.length);
-    }
-    return mxf_parse_structural_metadata(mxf);
-}
-
-static int mxf_read_close(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    int i;
-
-    av_freep(&mxf->packages_refs);
-
-    for (i = 0; i < s->nb_streams; i++)
-        s->streams[i]->priv_data = NULL;
-
-    for (i = 0; i < mxf->metadata_sets_count; i++) {
-        switch (mxf->metadata_sets[i]->type) {
-        case MultipleDescriptor:
-            av_freep(&((MXFDescriptor *)mxf->metadata_sets[i])->sub_descriptors_refs);
-            break;
-        case Sequence:
-            av_freep(&((MXFSequence *)mxf->metadata_sets[i])->structural_components_refs);
-            break;
-        case SourcePackage:
-        case MaterialPackage:
-            av_freep(&((MXFPackage *)mxf->metadata_sets[i])->tracks_refs);
-            break;
-        default:
-            break;
-        }
-        av_freep(&mxf->metadata_sets[i]);
-    }
-    av_freep(&mxf->metadata_sets);
-    av_freep(&mxf->aesc);
-    av_freep(&mxf->local_tags);
-    return 0;
-}
-
-static int mxf_probe(AVProbeData *p) {
-    uint8_t *bufp = p->buf;
-    uint8_t *end = p->buf + p->buf_size;
-
-    if (p->buf_size < sizeof(mxf_header_partition_pack_key))
-        return 0;
-
-    /* Must skip Run-In Sequence and search for MXF header partition pack key SMPTE 377M 5.5 */
-    end -= sizeof(mxf_header_partition_pack_key);
-    for (; bufp < end; bufp++) {
-        if (IS_KLV_KEY(bufp, mxf_header_partition_pack_key))
-            return AVPROBE_SCORE_MAX;
-    }
-    return 0;
-}
-
-/* rudimentary byte seek */
-/* XXX: use MXF Index */
-static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
-{
-    AVStream *st = s->streams[stream_index];
-    int64_t seconds;
-
-    if (!s->bit_rate)
-        return -1;
-    if (sample_time < 0)
-        sample_time = 0;
-    seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
-    url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
-    av_update_cur_dts(s, st, sample_time);
-    return 0;
-}
-
-AVInputFormat mxf_demuxer = {
-    "mxf",
-    NULL_IF_CONFIG_SMALL("Material eXchange Format"),
-    sizeof(MXFContext),
-    mxf_probe,
-    mxf_read_header,
-    mxf_read_packet,
-    mxf_read_close,
-    mxf_read_seek,
-};
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
deleted file mode 100644
index ab38118..0000000
--- a/libavformat/mxfenc.c
+++ /dev/null
@@ -1,1908 +0,0 @@
-/*
- * MXF muxer
- * Copyright (c) 2008 GUCAS, Zhentan Feng <spyfeng at gmail dot com>
- * Copyright (c) 2008 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * References
- * SMPTE 336M KLV Data Encoding Protocol Using Key-Length-Value
- * SMPTE 377M MXF File Format Specifications
- * SMPTE 379M MXF Generic Container
- * SMPTE 381M Mapping MPEG Streams into the MXF Generic Container
- * SMPTE RP210: SMPTE Metadata Dictionary
- * SMPTE RP224: Registry of SMPTE Universal Labels
- */
-
-//#define DEBUG
-
-#include <math.h>
-#include <time.h>
-
-#include "libavutil/random_seed.h"
-#include "libavcodec/bytestream.h"
-#include "audiointerleave.h"
-#include "avformat.h"
-#include "mxf.h"
-
-static const int NTSC_samples_per_frame[] = { 1602, 1601, 1602, 1601, 1602, 0 };
-static const int PAL_samples_per_frame[]  = { 1920, 0 };
-
-AVOutputFormat mxf_d10_muxer;
-
-#define EDIT_UNITS_PER_BODY 250
-#define KAG_SIZE 512
-
-typedef struct {
-    int local_tag;
-    UID uid;
-} MXFLocalTagPair;
-
-typedef struct {
-    uint8_t flags;
-    uint64_t offset;
-    unsigned slice_offset; ///< offset of audio slice
-} MXFIndexEntry;
-
-typedef struct {
-    AudioInterleaveContext aic;
-    UID track_essence_element_key;
-    int index;               ///< index in mxf_essence_container_uls table
-    const UID *codec_ul;
-    int order;               ///< interleaving order if dts are equal
-    int interlaced;          ///< wether picture is interlaced
-    int temporal_reordering;
-    AVRational aspect_ratio; ///< display aspect ratio
-    int closed_gop;          ///< gop is closed, used in mpeg-2 frame parsing
-} MXFStreamContext;
-
-typedef struct {
-    UID container_ul;
-    UID element_ul;
-    UID codec_ul;
-    void (*write_desc)();
-} MXFContainerEssenceEntry;
-
-static const struct {
-    enum CodecID id;
-    int index;
-} mxf_essence_mappings[] = {
-    { CODEC_ID_MPEG2VIDEO, 0 },
-    { CODEC_ID_PCM_S24LE,  1 },
-    { CODEC_ID_PCM_S16LE,  1 },
-    { CODEC_ID_NONE }
-};
-
-static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st);
-static void mxf_write_aes3_desc(AVFormatContext *s, AVStream *st);
-static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st);
-static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st);
-static void mxf_write_generic_sound_desc(AVFormatContext *s, AVStream *st);
-
-static const MXFContainerEssenceEntry mxf_essence_container_uls[] = {
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x05,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x00,0x00,0x00 },
-      mxf_write_mpegvideo_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x03,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x03,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_aes3_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_wav_desc },
-    // D-10 625/50 PAL 50mb/s
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x01 },
-      mxf_write_cdci_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_generic_sound_desc },
-    // D-10 525/60 NTSC 50mb/s
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x02,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x02 },
-      mxf_write_cdci_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x02,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_generic_sound_desc },
-    // D-10 625/50 PAL 40mb/s
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x03,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x03 },
-      mxf_write_cdci_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x03,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_generic_sound_desc },
-    // D-10 525/60 NTSC 40mb/s
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x04,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x04 },
-      mxf_write_cdci_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x04,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_generic_sound_desc },
-    // D-10 625/50 PAL 30mb/s
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x05,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x05 },
-      mxf_write_cdci_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x05,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_generic_sound_desc },
-    // D-10 525/60 NTSC 30mb/s
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x06,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x05,0x01,0x01,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x02,0x02,0x01,0x02,0x01,0x06 },
-      mxf_write_cdci_desc },
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x06,0x01 },
-      { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x06,0x01,0x10,0x00 },
-      { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      mxf_write_generic_sound_desc },
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
-      { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
-      { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
-      NULL },
-};
-
-typedef struct MXFContext {
-    int64_t footer_partition_offset;
-    int essence_container_count;
-    AVRational time_base;
-    int header_written;
-    MXFIndexEntry *index_entries;
-    unsigned edit_units_count;
-    uint64_t timestamp;   ///< timestamp, as year(16),month(8),day(8),hour(8),minutes(8),msec/4(8)
-    uint8_t slice_count;  ///< index slice count minus 1 (1 if no audio, 0 otherwise)
-    int last_indexed_edit_unit;
-    uint64_t *body_partition_offset;
-    unsigned body_partitions_count;
-    int last_key_index;  ///< index of last key frame
-    uint64_t duration;
-    AVStream *timecode_track;
-    int timecode_base;       ///< rounded time code base (25 or 30)
-    int timecode_start;      ///< frame number computed from mpeg-2 gop header timecode
-    int timecode_drop_frame; ///< time code use drop frame method frop mpeg-2 essence gop header
-    int edit_unit_byte_count; ///< fixed edit unit byte count
-    uint64_t body_offset;
-    uint32_t instance_number;
-    uint8_t umid[16];        ///< unique material identifier
-} MXFContext;
-
-static const uint8_t uuid_base[]            = { 0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd };
-static const uint8_t umid_ul[]              = { 0x06,0x0A,0x2B,0x34,0x01,0x01,0x01,0x05,0x01,0x01,0x0D,0x00,0x13 };
-
-/**
- * complete key for operation pattern, partitions, and primer pack
- */
-static const uint8_t op1a_ul[]                     = { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x01,0x09,0x00 };
-static const uint8_t footer_partition_key[]        = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x04,0x04,0x00 }; // ClosedComplete
-static const uint8_t primer_pack_key[]             = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x05,0x01,0x00 };
-static const uint8_t index_table_segment_key[]     = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 };
-static const uint8_t random_index_pack_key[]       = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x11,0x01,0x00 };
-static const uint8_t header_open_partition_key[]   = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x02,0x01,0x00 }; // OpenIncomplete
-static const uint8_t header_closed_partition_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x02,0x04,0x00 }; // ClosedComplete
-static const uint8_t klv_fill_key[]                = { 0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x03,0x01,0x02,0x10,0x01,0x00,0x00,0x00 };
-static const uint8_t body_partition_key[]          = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x03,0x04,0x00 }; // ClosedComplete
-
-/**
- * partial key for header metadata
- */
-static const uint8_t header_metadata_key[]  = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0D,0x01,0x01,0x01,0x01 };
-static const uint8_t multiple_desc_ul[]     = { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x0D,0x01,0x03,0x01,0x02,0x7F,0x01,0x00 };
-
-/**
- * SMPTE RP210 http://www.smpte-ra.org/mdd/index.html
- */
-static const MXFLocalTagPair mxf_local_tag_batch[] = {
-    // preface set
-    { 0x3C0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x01,0x01,0x15,0x02,0x00,0x00,0x00,0x00}}, /* Instance UID */
-    { 0x3B02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x10,0x02,0x04,0x00,0x00}}, /* Last Modified Date */
-    { 0x3B05, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x01,0x02,0x01,0x05,0x00,0x00,0x00}}, /* Version */
-    { 0x3B06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x06,0x04,0x00,0x00}}, /* Identifications reference */
-    { 0x3B03, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x02,0x01,0x00,0x00}}, /* Content Storage reference */
-    { 0x3B09, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x01,0x02,0x02,0x03,0x00,0x00,0x00,0x00}}, /* Operational Pattern UL */
-    { 0x3B0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x01,0x02,0x02,0x10,0x02,0x01,0x00,0x00}}, /* Essence Containers UL batch */
-    { 0x3B0B, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x01,0x02,0x02,0x10,0x02,0x02,0x00,0x00}}, /* DM Schemes UL batch */
-    // Identification
-    { 0x3C09, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x01,0x00,0x00,0x00}}, /* This Generation UID */
-    { 0x3C01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x02,0x01,0x00,0x00}}, /* Company Name */
-    { 0x3C02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x03,0x01,0x00,0x00}}, /* Product Name */
-    { 0x3C04, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x05,0x01,0x00,0x00}}, /* Version String */
-    { 0x3C05, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x20,0x07,0x01,0x07,0x00,0x00,0x00}}, /* Product ID */
-    { 0x3C06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x10,0x02,0x03,0x00,0x00}}, /* Modification Date */
-    // Content Storage
-    { 0x1901, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x05,0x01,0x00,0x00}}, /* Package strong reference batch */
-    { 0x1902, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x05,0x02,0x00,0x00}}, /* Package strong reference batch */
-    // Essence Container Data
-    { 0x2701, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x06,0x01,0x00,0x00,0x00}}, /* Linked Package UID */
-    { 0x3F07, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x01,0x03,0x04,0x04,0x00,0x00,0x00,0x00}}, /* BodySID */
-    // Package
-    { 0x4401, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x01,0x01,0x15,0x10,0x00,0x00,0x00,0x00}}, /* Package UID */
-    { 0x4405, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x10,0x01,0x03,0x00,0x00}}, /* Package Creation Date */
-    { 0x4404, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x10,0x02,0x05,0x00,0x00}}, /* Package Modified Date */
-    { 0x4403, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x06,0x05,0x00,0x00}}, /* Tracks Strong reference array */
-    { 0x4701, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x02,0x03,0x00,0x00}}, /* Descriptor */
-    // Track
-    { 0x4801, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x01,0x07,0x01,0x01,0x00,0x00,0x00,0x00}}, /* Track ID */
-    { 0x4804, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x01,0x04,0x01,0x03,0x00,0x00,0x00,0x00}}, /* Track Number */
-    { 0x4B01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x05,0x30,0x04,0x05,0x00,0x00,0x00,0x00}}, /* Edit Rate */
-    { 0x4B02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x03,0x01,0x03,0x00,0x00}}, /* Origin */
-    { 0x4803, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x02,0x04,0x00,0x00}}, /* Sequence reference */
-    // Sequence
-    { 0x0201, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x07,0x01,0x00,0x00,0x00,0x00,0x00}}, /* Data Definition UL */
-    { 0x0202, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x02,0x01,0x01,0x03,0x00,0x00}}, /* Duration */
-    { 0x1001, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x06,0x09,0x00,0x00}}, /* Structural Components reference array */
-    // Source Clip
-    { 0x1201, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x03,0x01,0x04,0x00,0x00}}, /* Start position */
-    { 0x1101, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x03,0x01,0x00,0x00,0x00}}, /* SourcePackageID */
-    { 0x1102, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x03,0x02,0x00,0x00,0x00}}, /* SourceTrackID */
-    // Timecode Component
-    { 0x1501, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x07,0x02,0x01,0x03,0x01,0x05,0x00,0x00}}, /* Start Time Code */
-    { 0x1502, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x04,0x01,0x01,0x02,0x06,0x00,0x00}}, /* Rounded Time Code Base */
-    { 0x1503, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x04,0x01,0x01,0x05,0x00,0x00,0x00}}, /* Drop Frame */
-    // File Descriptor
-    { 0x3F01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x06,0x01,0x01,0x04,0x06,0x0B,0x00,0x00}}, /* Sub Descriptors reference array */
-    { 0x3006, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x06,0x01,0x01,0x03,0x05,0x00,0x00,0x00}}, /* Linked Track ID */
-    { 0x3001, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x06,0x01,0x01,0x00,0x00,0x00,0x00}}, /* SampleRate */
-    { 0x3004, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x06,0x01,0x01,0x04,0x01,0x02,0x00,0x00}}, /* Essence Container */
-    // Generic Picture Essence Descriptor
-    { 0x320C, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x03,0x01,0x04,0x00,0x00,0x00}}, /* Frame Layout */
-    { 0x320D, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x03,0x02,0x05,0x00,0x00,0x00}}, /* Video Line Map */
-    { 0x3203, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x02,0x02,0x00,0x00,0x00}}, /* Stored Width */
-    { 0x3202, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x02,0x01,0x00,0x00,0x00}}, /* Stored Height */
-    { 0x3209, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0C,0x00,0x00,0x00}}, /* Display Width */
-    { 0x3208, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x0B,0x00,0x00,0x00}}, /* Display Height */
-    { 0x320E, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x00,0x00,0x00}}, /* Aspect Ratio */
-    { 0x3201, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x06,0x01,0x00,0x00,0x00,0x00}}, /* Picture Essence Coding */
-    // CDCI Picture Essence Descriptor
-    { 0x3301, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x01,0x05,0x03,0x0A,0x00,0x00,0x00}}, /* Component Depth */
-    { 0x3302, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x01,0x04,0x01,0x05,0x01,0x05,0x00,0x00,0x00}}, /* Horizontal Subsampling */
-    // Generic Sound Essence Descriptor
-    { 0x3D02, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x01,0x04,0x00,0x00,0x00}}, /* Locked/Unlocked */
-    { 0x3D03, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x01,0x01,0x01,0x00,0x00}}, /* Audio sampling rate */
-    { 0x3D07, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x01,0x01,0x04,0x00,0x00,0x00}}, /* ChannelCount */
-    { 0x3D01, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x02,0x03,0x03,0x04,0x00,0x00,0x00}}, /* Quantization bits */
-    { 0x3D06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x04,0x02,0x04,0x02,0x00,0x00,0x00,0x00}}, /* Sound Essence Compression */
-    // Index Table Segment
-    { 0x3F0B, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x05,0x30,0x04,0x06,0x00,0x00,0x00,0x00}}, /* Index Edit Rate */
-    { 0x3F0C, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x07,0x02,0x01,0x03,0x01,0x0A,0x00,0x00}}, /* Index Start Position */
-    { 0x3F0D, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x07,0x02,0x02,0x01,0x01,0x02,0x00,0x00}}, /* Index Duration */
-    { 0x3F05, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x06,0x02,0x01,0x00,0x00,0x00,0x00}}, /* Edit Unit Byte Count */
-    { 0x3F06, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x01,0x03,0x04,0x05,0x00,0x00,0x00,0x00}}, /* IndexSID */
-    { 0x3F08, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x04,0x04,0x04,0x04,0x01,0x01,0x00,0x00,0x00}}, /* Slice Count */
-    { 0x3F09, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x04,0x04,0x01,0x06,0x00,0x00,0x00}}, /* Delta Entry Array */
-    { 0x3F0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x04,0x04,0x02,0x05,0x00,0x00,0x00}}, /* Index Entry Array */
-    // MPEG video Descriptor
-    { 0x8000, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x01,0x06,0x02,0x01,0x0B,0x00,0x00}}, /* BitRate */
-    { 0x8007, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x01,0x06,0x02,0x01,0x0A,0x00,0x00}}, /* ProfileAndLevel */
-    // Wave Audio Essence Descriptor
-    { 0x3D09, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x03,0x05,0x00,0x00,0x00}}, /* Average Bytes Per Second */
-    { 0x3D0A, {0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x05,0x04,0x02,0x03,0x02,0x01,0x00,0x00,0x00}}, /* Block Align */
-};
-
-static void mxf_write_uuid(ByteIOContext *pb, enum MXFMetadataSetType type, int value)
-{
-    put_buffer(pb, uuid_base, 12);
-    put_be16(pb, type);
-    put_be16(pb, value);
-}
-
-static void mxf_write_umid(AVFormatContext *s, int type)
-{
-    MXFContext *mxf = s->priv_data;
-    put_buffer(s->pb, umid_ul, 13);
-    put_be24(s->pb, mxf->instance_number);
-    put_buffer(s->pb, mxf->umid, 15);
-    put_byte(s->pb, type);
-}
-
-static void mxf_write_refs_count(ByteIOContext *pb, int ref_count)
-{
-    put_be32(pb, ref_count);
-    put_be32(pb, 16);
-}
-
-static int klv_ber_length(uint64_t len)
-{
-    if (len < 128)
-        return 1;
-    else
-        return (av_log2(len) >> 3) + 2;
-}
-
-static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len)
-{
-    // Determine the best BER size
-    int size;
-    if (len < 128) {
-        //short form
-        put_byte(pb, len);
-        return 1;
-    }
-
-    size = (av_log2(len) >> 3) + 1;
-
-    // long form
-    put_byte(pb, 0x80 + size);
-    while(size) {
-        size--;
-        put_byte(pb, len >> 8 * size & 0xff);
-    }
-    return 0;
-}
-
-static void klv_encode_ber4_length(ByteIOContext *pb, int len)
-{
-    put_byte(pb, 0x80 + 3);
-    put_be24(pb, len);
-}
-
-/*
- * Get essence container ul index
- */
-static int mxf_get_essence_container_ul_index(enum CodecID id)
-{
-    int i;
-    for (i = 0; mxf_essence_mappings[i].id; i++)
-        if (mxf_essence_mappings[i].id == id)
-            return mxf_essence_mappings[i].index;
-    return -1;
-}
-
-static void mxf_write_primer_pack(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    int local_tag_number, i = 0;
-
-    local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch);
-
-    put_buffer(pb, primer_pack_key, 16);
-    klv_encode_ber_length(pb, local_tag_number * 18 + 8);
-
-    put_be32(pb, local_tag_number); // local_tag num
-    put_be32(pb, 18); // item size, always 18 according to the specs
-
-    for (i = 0; i < local_tag_number; i++) {
-        put_be16(pb, mxf_local_tag_batch[i].local_tag);
-        put_buffer(pb, mxf_local_tag_batch[i].uid, 16);
-    }
-}
-
-static void mxf_write_local_tag(ByteIOContext *pb, int size, int tag)
-{
-    put_be16(pb, tag);
-    put_be16(pb, size);
-}
-
-static void mxf_write_metadata_key(ByteIOContext *pb, unsigned int value)
-{
-    put_buffer(pb, header_metadata_key, 13);
-    put_be24(pb, value);
-}
-
-static void mxf_free(AVFormatContext *s)
-{
-    int i;
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        av_freep(&st->priv_data);
-    }
-}
-
-static const MXFCodecUL *mxf_get_data_definition_ul(int type)
-{
-    const MXFCodecUL *uls = ff_mxf_data_definition_uls;
-    while (uls->uid[0]) {
-        if (type == uls->id)
-            break;
-        uls++;
-    }
-    return uls;
-}
-
-static void mxf_write_essence_container_refs(AVFormatContext *s)
-{
-    MXFContext *c = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int i;
-
-    mxf_write_refs_count(pb, c->essence_container_count);
-    av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", c->essence_container_count);
-    for (i = 0; i < c->essence_container_count; i++) {
-        MXFStreamContext *sc = s->streams[i]->priv_data;
-        put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
-    }
-}
-
-static void mxf_write_preface(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    mxf_write_metadata_key(pb, 0x012f00);
-    PRINT_KEY(s, "preface key", pb->buf_ptr - 16);
-    klv_encode_ber_length(pb, 130 + 16 * mxf->essence_container_count);
-
-    // write preface set uid
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, Preface, 0);
-    PRINT_KEY(s, "preface uid", pb->buf_ptr - 16);
-
-    // last modified date
-    mxf_write_local_tag(pb, 8, 0x3B02);
-    put_be64(pb, mxf->timestamp);
-
-    // write version
-    mxf_write_local_tag(pb, 2, 0x3B05);
-    put_be16(pb, 258); // v1.2
-
-    // write identification_refs
-    mxf_write_local_tag(pb, 16 + 8, 0x3B06);
-    mxf_write_refs_count(pb, 1);
-    mxf_write_uuid(pb, Identification, 0);
-
-    // write content_storage_refs
-    mxf_write_local_tag(pb, 16, 0x3B03);
-    mxf_write_uuid(pb, ContentStorage, 0);
-
-    // operational pattern
-    mxf_write_local_tag(pb, 16, 0x3B09);
-    put_buffer(pb, op1a_ul, 16);
-
-    // write essence_container_refs
-    mxf_write_local_tag(pb, 8 + 16 * mxf->essence_container_count, 0x3B0A);
-    mxf_write_essence_container_refs(s);
-
-    // write dm_scheme_refs
-    mxf_write_local_tag(pb, 8, 0x3B0B);
-    put_be64(pb, 0);
-}
-
-/*
- * Write a local tag containing an ascii string as utf-16
- */
-static void mxf_write_local_tag_utf16(ByteIOContext *pb, int tag, const char *value)
-{
-    int i, size = strlen(value);
-    mxf_write_local_tag(pb, size*2, tag);
-    for (i = 0; i < size; i++)
-        put_be16(pb, value[i]);
-}
-
-static void mxf_write_identification(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    const char *company = "FFmpeg";
-    const char *product = "OP1a Muxer";
-    const char *version;
-    int length;
-
-    mxf_write_metadata_key(pb, 0x013000);
-    PRINT_KEY(s, "identification key", pb->buf_ptr - 16);
-
-    version = s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT ?
-        "0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
-    length = 84 + (strlen(company)+strlen(product)+strlen(version))*2; // utf-16
-    klv_encode_ber_length(pb, length);
-
-    // write uid
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, Identification, 0);
-    PRINT_KEY(s, "identification uid", pb->buf_ptr - 16);
-
-    // write generation uid
-    mxf_write_local_tag(pb, 16, 0x3C09);
-    mxf_write_uuid(pb, Identification, 1);
-
-    mxf_write_local_tag_utf16(pb, 0x3C01, company); // Company Name
-    mxf_write_local_tag_utf16(pb, 0x3C02, product); // Product Name
-    mxf_write_local_tag_utf16(pb, 0x3C04, version); // Version String
-
-    // write product uid
-    mxf_write_local_tag(pb, 16, 0x3C05);
-    mxf_write_uuid(pb, Identification, 2);
-
-    // modification date
-    mxf_write_local_tag(pb, 8, 0x3C06);
-    put_be64(pb, mxf->timestamp);
-}
-
-static void mxf_write_content_storage(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-
-    mxf_write_metadata_key(pb, 0x011800);
-    PRINT_KEY(s, "content storage key", pb->buf_ptr - 16);
-    klv_encode_ber_length(pb, 92);
-
-    // write uid
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, ContentStorage, 0);
-    PRINT_KEY(s, "content storage uid", pb->buf_ptr - 16);
-
-    // write package reference
-    mxf_write_local_tag(pb, 16 * 2 + 8, 0x1901);
-    mxf_write_refs_count(pb, 2);
-    mxf_write_uuid(pb, MaterialPackage, 0);
-    mxf_write_uuid(pb, SourcePackage, 0);
-
-    // write essence container data
-    mxf_write_local_tag(pb, 8 + 16, 0x1902);
-    mxf_write_refs_count(pb, 1);
-    mxf_write_uuid(pb, EssenceContainerData, 0);
-}
-
-static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    MXFStreamContext *sc = st->priv_data;
-
-    mxf_write_metadata_key(pb, 0x013b00);
-    PRINT_KEY(s, "track key", pb->buf_ptr - 16);
-    klv_encode_ber_length(pb, 80);
-
-    // write track uid
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, type == MaterialPackage ? Track : Track + TypeBottom, st->index);
-    PRINT_KEY(s, "track uid", pb->buf_ptr - 16);
-
-    // write track id
-    mxf_write_local_tag(pb, 4, 0x4801);
-    put_be32(pb, st->index+2);
-
-    // write track number
-    mxf_write_local_tag(pb, 4, 0x4804);
-    if (type == MaterialPackage)
-        put_be32(pb, 0); // track number of material package is 0
-    else
-        put_buffer(pb, sc->track_essence_element_key + 12, 4);
-
-    mxf_write_local_tag(pb, 8, 0x4B01);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
-
-    // write origin
-    mxf_write_local_tag(pb, 8, 0x4B02);
-    put_be64(pb, 0);
-
-    // write sequence refs
-    mxf_write_local_tag(pb, 16, 0x4803);
-    mxf_write_uuid(pb, type == MaterialPackage ? Sequence: Sequence + TypeBottom, st->index);
-}
-
-static const uint8_t smpte_12m_timecode_track_data_ul[] = { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x01,0x03,0x02,0x01,0x01,0x00,0x00,0x00 };
-
-static void mxf_write_common_fields(AVFormatContext *s, AVStream *st)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    // find data define uls
-    mxf_write_local_tag(pb, 16, 0x0201);
-    if (st == mxf->timecode_track)
-        put_buffer(pb, smpte_12m_timecode_track_data_ul, 16);
-    else {
-        const MXFCodecUL *data_def_ul = mxf_get_data_definition_ul(st->codec->codec_type);
-        put_buffer(pb, data_def_ul->uid, 16);
-    }
-
-    // write duration
-    mxf_write_local_tag(pb, 8, 0x0202);
-    put_be64(pb, mxf->duration);
-}
-
-static void mxf_write_sequence(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    enum MXFMetadataSetType component;
-
-    mxf_write_metadata_key(pb, 0x010f00);
-    PRINT_KEY(s, "sequence key", pb->buf_ptr - 16);
-    klv_encode_ber_length(pb, 80);
-
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, type == MaterialPackage ? Sequence: Sequence + TypeBottom, st->index);
-
-    PRINT_KEY(s, "sequence uid", pb->buf_ptr - 16);
-    mxf_write_common_fields(s, st);
-
-    // write structural component
-    mxf_write_local_tag(pb, 16 + 8, 0x1001);
-    mxf_write_refs_count(pb, 1);
-    if (st == mxf->timecode_track)
-        component = TimecodeComponent;
-    else
-        component = SourceClip;
-    if (type == SourcePackage)
-        component += TypeBottom;
-    mxf_write_uuid(pb, component, st->index);
-}
-
-static void mxf_write_timecode_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    mxf_write_metadata_key(pb, 0x011400);
-    klv_encode_ber_length(pb, 75);
-
-    // UID
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, type == MaterialPackage ? TimecodeComponent :
-                   TimecodeComponent + TypeBottom, st->index);
-
-    mxf_write_common_fields(s, st);
-
-    // Start Time Code
-    mxf_write_local_tag(pb, 8, 0x1501);
-    put_be64(pb, mxf->timecode_start);
-
-    // Rounded Time Code Base
-    mxf_write_local_tag(pb, 2, 0x1502);
-    put_be16(pb, mxf->timecode_base);
-
-    // Drop Frame
-    mxf_write_local_tag(pb, 1, 0x1503);
-    put_byte(pb, mxf->timecode_drop_frame);
-}
-
-static void mxf_write_structural_component(AVFormatContext *s, AVStream *st, enum MXFMetadataSetType type)
-{
-    ByteIOContext *pb = s->pb;
-    int i;
-
-    mxf_write_metadata_key(pb, 0x011100);
-    PRINT_KEY(s, "sturctural component key", pb->buf_ptr - 16);
-    klv_encode_ber_length(pb, 108);
-
-    // write uid
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, type == MaterialPackage ? SourceClip: SourceClip + TypeBottom, st->index);
-
-    PRINT_KEY(s, "structural component uid", pb->buf_ptr - 16);
-    mxf_write_common_fields(s, st);
-
-    // write start_position
-    mxf_write_local_tag(pb, 8, 0x1201);
-    put_be64(pb, 0);
-
-    // write source package uid, end of the reference
-    mxf_write_local_tag(pb, 32, 0x1101);
-    if (type == SourcePackage) {
-        for (i = 0; i < 4; i++)
-            put_be64(pb, 0);
-    } else
-        mxf_write_umid(s, 1);
-
-    // write source track id
-    mxf_write_local_tag(pb, 4, 0x1102);
-    if (type == SourcePackage)
-        put_be32(pb, 0);
-    else
-        put_be32(pb, st->index+2);
-}
-
-static void mxf_write_multi_descriptor(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    const uint8_t *ul;
-    int i;
-
-    mxf_write_metadata_key(pb, 0x014400);
-    PRINT_KEY(s, "multiple descriptor key", pb->buf_ptr - 16);
-    klv_encode_ber_length(pb, 64 + 16 * s->nb_streams);
-
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, MultipleDescriptor, 0);
-    PRINT_KEY(s, "multi_desc uid", pb->buf_ptr - 16);
-
-    // write sample rate
-    mxf_write_local_tag(pb, 8, 0x3001);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
-
-    // write essence container ul
-    mxf_write_local_tag(pb, 16, 0x3004);
-    if (mxf->essence_container_count > 1)
-        ul = multiple_desc_ul;
-    else {
-        MXFStreamContext *sc = s->streams[0]->priv_data;
-        ul = mxf_essence_container_uls[sc->index].container_ul;
-    }
-    put_buffer(pb, ul, 16);
-
-    // write sub descriptor refs
-    mxf_write_local_tag(pb, s->nb_streams * 16 + 8, 0x3F01);
-    mxf_write_refs_count(pb, s->nb_streams);
-    for (i = 0; i < s->nb_streams; i++)
-        mxf_write_uuid(pb, SubDescriptor, i);
-}
-
-static void mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
-{
-    MXFContext *mxf = s->priv_data;
-    MXFStreamContext *sc = st->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    put_buffer(pb, key, 16);
-    klv_encode_ber4_length(pb, size+20+8+12+20);
-
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, SubDescriptor, st->index);
-
-    mxf_write_local_tag(pb, 4, 0x3006);
-    put_be32(pb, st->index+2);
-
-    mxf_write_local_tag(pb, 8, 0x3001);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
-
-    mxf_write_local_tag(pb, 16, 0x3004);
-    put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
-}
-
-static const UID mxf_mpegvideo_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x51,0x00 };
-static const UID mxf_wav_descriptor_key       = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x48,0x00 };
-static const UID mxf_aes3_descriptor_key      = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x47,0x00 };
-static const UID mxf_cdci_descriptor_key      = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0D,0x01,0x01,0x01,0x01,0x01,0x28,0x00 };
-static const UID mxf_generic_sound_descriptor_key = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0D,0x01,0x01,0x01,0x01,0x01,0x42,0x00 };
-
-static void mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
-{
-    MXFStreamContext *sc = st->priv_data;
-    ByteIOContext *pb = s->pb;
-    int stored_height = (st->codec->height+15)/16*16;
-    int display_height;
-    int f1, f2;
-
-    mxf_write_generic_desc(s, st, key, size+8+8+8+8+8+8+5+16+sc->interlaced*4+12+20);
-
-    mxf_write_local_tag(pb, 4, 0x3203);
-    put_be32(pb, st->codec->width);
-
-    mxf_write_local_tag(pb, 4, 0x3202);
-    put_be32(pb, stored_height>>sc->interlaced);
-
-    mxf_write_local_tag(pb, 4, 0x3209);
-    put_be32(pb, st->codec->width);
-
-    if (st->codec->height == 608) // PAL + VBI
-        display_height = 576;
-    else if (st->codec->height == 512)  // NTSC + VBI
-        display_height = 486;
-    else
-        display_height = st->codec->height;
-
-    mxf_write_local_tag(pb, 4, 0x3208);
-    put_be32(pb, display_height>>sc->interlaced);
-
-    // component depth
-    mxf_write_local_tag(pb, 4, 0x3301);
-    put_be32(pb, 8);
-
-    // horizontal subsampling
-    mxf_write_local_tag(pb, 4, 0x3302);
-    put_be32(pb, 2);
-
-    // frame layout
-    mxf_write_local_tag(pb, 1, 0x320C);
-    put_byte(pb, sc->interlaced);
-
-    // video line map
-    switch (st->codec->height) {
-    case  576: f1 = 23; f2 = 336; break;
-    case  608: f1 =  7; f2 = 320; break;
-    case  480: f1 = 20; f2 = 283; break;
-    case  512: f1 =  7; f2 = 270; break;
-    case  720: f1 = 26; f2 =   0; break; // progressive
-    case 1080: f1 = 21; f2 = 584; break;
-    default:   f1 =  0; f2 =   0; break;
-    }
-
-    if (!sc->interlaced) {
-        f2  = 0;
-        f1 *= 2;
-    }
-
-    mxf_write_local_tag(pb, 12+sc->interlaced*4, 0x320D);
-    put_be32(pb, sc->interlaced ? 2 : 1);
-    put_be32(pb, 4);
-    put_be32(pb, f1);
-    if (sc->interlaced)
-        put_be32(pb, f2);
-
-    mxf_write_local_tag(pb, 8, 0x320E);
-    put_be32(pb, sc->aspect_ratio.num);
-    put_be32(pb, sc->aspect_ratio.den);
-
-    mxf_write_local_tag(pb, 16, 0x3201);
-    put_buffer(pb, *sc->codec_ul, 16);
-}
-
-static void mxf_write_cdci_desc(AVFormatContext *s, AVStream *st)
-{
-    mxf_write_cdci_common(s, st, mxf_cdci_descriptor_key, 0);
-}
-
-static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st)
-{
-    ByteIOContext *pb = s->pb;
-    int profile_and_level = (st->codec->profile<<4) | st->codec->level;
-
-    mxf_write_cdci_common(s, st, mxf_mpegvideo_descriptor_key, 8+5);
-
-    // bit rate
-    mxf_write_local_tag(pb, 4, 0x8000);
-    put_be32(pb, st->codec->bit_rate);
-
-    // profile and level
-    mxf_write_local_tag(pb, 1, 0x8007);
-    if (!st->codec->profile)
-        profile_and_level |= 0x80; // escape bit
-    put_byte(pb, profile_and_level);
-}
-
-static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
-{
-    ByteIOContext *pb = s->pb;
-
-    mxf_write_generic_desc(s, st, key, size+5+12+8+8);
-
-    // audio locked
-    mxf_write_local_tag(pb, 1, 0x3D02);
-    put_byte(pb, 1);
-
-    // write audio sampling rate
-    mxf_write_local_tag(pb, 8, 0x3D03);
-    put_be32(pb, st->codec->sample_rate);
-    put_be32(pb, 1);
-
-    mxf_write_local_tag(pb, 4, 0x3D07);
-    put_be32(pb, st->codec->channels);
-
-    mxf_write_local_tag(pb, 4, 0x3D01);
-    put_be32(pb, av_get_bits_per_sample(st->codec->codec_id));
-}
-
-static void mxf_write_wav_common(AVFormatContext *s, AVStream *st, const UID key, unsigned size)
-{
-    ByteIOContext *pb = s->pb;
-
-    mxf_write_generic_sound_common(s, st, key, size+6+8);
-
-    mxf_write_local_tag(pb, 2, 0x3D0A);
-    put_be16(pb, st->codec->block_align);
-
-    // avg bytes per sec
-    mxf_write_local_tag(pb, 4, 0x3D09);
-    put_be32(pb, st->codec->block_align*st->codec->sample_rate);
-}
-
-static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st)
-{
-    mxf_write_wav_common(s, st, mxf_wav_descriptor_key, 0);
-}
-
-static void mxf_write_aes3_desc(AVFormatContext *s, AVStream *st)
-{
-    mxf_write_wav_common(s, st, mxf_aes3_descriptor_key, 0);
-}
-
-static void mxf_write_generic_sound_desc(AVFormatContext *s, AVStream *st)
-{
-    mxf_write_generic_sound_common(s, st, mxf_generic_sound_descriptor_key, 0);
-}
-
-static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int i, track_count = s->nb_streams+1;
-
-    if (type == MaterialPackage) {
-        mxf_write_metadata_key(pb, 0x013600);
-        PRINT_KEY(s, "Material Package key", pb->buf_ptr - 16);
-        klv_encode_ber_length(pb, 92 + 16*track_count);
-    } else {
-        mxf_write_metadata_key(pb, 0x013700);
-        PRINT_KEY(s, "Source Package key", pb->buf_ptr - 16);
-        klv_encode_ber_length(pb, 112 + 16*track_count); // 20 bytes length for descriptor reference
-    }
-
-    // write uid
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, type, 0);
-    av_log(s,AV_LOG_DEBUG, "package type:%d\n", type);
-    PRINT_KEY(s, "package uid", pb->buf_ptr - 16);
-
-    // write package umid
-    mxf_write_local_tag(pb, 32, 0x4401);
-    mxf_write_umid(s, type == SourcePackage);
-    PRINT_KEY(s, "package umid second part", pb->buf_ptr - 16);
-
-    // package creation date
-    mxf_write_local_tag(pb, 8, 0x4405);
-    put_be64(pb, mxf->timestamp);
-
-    // package modified date
-    mxf_write_local_tag(pb, 8, 0x4404);
-    put_be64(pb, mxf->timestamp);
-
-    // write track refs
-    mxf_write_local_tag(pb, track_count*16 + 8, 0x4403);
-    mxf_write_refs_count(pb, track_count);
-    mxf_write_uuid(pb, type == MaterialPackage ? Track :
-                   Track + TypeBottom, -1); // timecode track
-    for (i = 0; i < s->nb_streams; i++)
-        mxf_write_uuid(pb, type == MaterialPackage ? Track : Track + TypeBottom, i);
-
-    // write multiple descriptor reference
-    if (type == SourcePackage) {
-        mxf_write_local_tag(pb, 16, 0x4701);
-        if (s->nb_streams > 1) {
-            mxf_write_uuid(pb, MultipleDescriptor, 0);
-            mxf_write_multi_descriptor(s);
-        } else
-            mxf_write_uuid(pb, SubDescriptor, 0);
-    }
-
-    // write timecode track
-    mxf_write_track(s, mxf->timecode_track, type);
-    mxf_write_sequence(s, mxf->timecode_track, type);
-    mxf_write_timecode_component(s, mxf->timecode_track, type);
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        mxf_write_track(s, st, type);
-        mxf_write_sequence(s, st, type);
-        mxf_write_structural_component(s, st, type);
-
-        if (type == SourcePackage) {
-            MXFStreamContext *sc = st->priv_data;
-            mxf_essence_container_uls[sc->index].write_desc(s, st);
-        }
-    }
-}
-
-static int mxf_write_essence_container_data(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-
-    mxf_write_metadata_key(pb, 0x012300);
-    klv_encode_ber_length(pb, 72);
-
-    mxf_write_local_tag(pb, 16, 0x3C0A); // Instance UID
-    mxf_write_uuid(pb, EssenceContainerData, 0);
-
-    mxf_write_local_tag(pb, 32, 0x2701); // Linked Package UID
-    mxf_write_umid(s, 1);
-
-    mxf_write_local_tag(pb, 4, 0x3F07); // BodySID
-    put_be32(pb, 1);
-
-    mxf_write_local_tag(pb, 4, 0x3F06); // IndexSID
-    put_be32(pb, 2);
-
-    return 0;
-}
-
-static int mxf_write_header_metadata_sets(AVFormatContext *s)
-{
-    mxf_write_preface(s);
-    mxf_write_identification(s);
-    mxf_write_content_storage(s);
-    mxf_write_package(s, MaterialPackage);
-    mxf_write_package(s, SourcePackage);
-    mxf_write_essence_container_data(s);
-    return 0;
-}
-
-static unsigned klv_fill_size(uint64_t size)
-{
-    unsigned pad = KAG_SIZE - (size & (KAG_SIZE-1));
-    if (pad < 20) // smallest fill item possible
-        return pad + KAG_SIZE;
-    else
-        return pad & (KAG_SIZE-1);
-}
-
-static void mxf_write_index_table_segment(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int i, j;
-    int temporal_reordering = 0;
-    int key_index = mxf->last_key_index;
-
-    av_log(s, AV_LOG_DEBUG, "edit units count %d\n", mxf->edit_units_count);
-
-    if (!mxf->edit_units_count && !mxf->edit_unit_byte_count)
-        return;
-
-    put_buffer(pb, index_table_segment_key, 16);
-
-    if (mxf->edit_unit_byte_count) {
-        klv_encode_ber_length(pb, 80);
-    } else {
-        klv_encode_ber_length(pb, 85 + 12+(s->nb_streams+1)*6 +
-                              12+mxf->edit_units_count*(11+mxf->slice_count*4));
-    }
-
-    // instance id
-    mxf_write_local_tag(pb, 16, 0x3C0A);
-    mxf_write_uuid(pb, IndexTableSegment, 0);
-
-    // index edit rate
-    mxf_write_local_tag(pb, 8, 0x3F0B);
-    put_be32(pb, mxf->time_base.den);
-    put_be32(pb, mxf->time_base.num);
-
-    // index start position
-    mxf_write_local_tag(pb, 8, 0x3F0C);
-    put_be64(pb, mxf->last_indexed_edit_unit);
-
-    // index duration
-    mxf_write_local_tag(pb, 8, 0x3F0D);
-    if (mxf->edit_unit_byte_count)
-        put_be64(pb, 0); // index table covers whole container
-    else
-        put_be64(pb, mxf->edit_units_count);
-
-    // edit unit byte count
-    mxf_write_local_tag(pb, 4, 0x3F05);
-    put_be32(pb, mxf->edit_unit_byte_count);
-
-    // index sid
-    mxf_write_local_tag(pb, 4, 0x3F06);
-    put_be32(pb, 2);
-
-    // body sid
-    mxf_write_local_tag(pb, 4, 0x3F07);
-    put_be32(pb, 1);
-
-    if (!mxf->edit_unit_byte_count) {
-        // real slice count - 1
-        mxf_write_local_tag(pb, 1, 0x3F08);
-        put_byte(pb, mxf->slice_count);
-
-        // delta entry array
-        mxf_write_local_tag(pb, 8 + (s->nb_streams+1)*6, 0x3F09);
-        put_be32(pb, s->nb_streams+1); // num of entries
-        put_be32(pb, 6);               // size of one entry
-        // write system item delta entry
-        put_byte(pb, 0);
-        put_byte(pb, 0); // slice entry
-        put_be32(pb, 0); // element delta
-        for (i = 0; i < s->nb_streams; i++) {
-            AVStream *st = s->streams[i];
-            MXFStreamContext *sc = st->priv_data;
-            put_byte(pb, sc->temporal_reordering);
-            if (sc->temporal_reordering)
-                temporal_reordering = 1;
-            if (i == 0) { // video track
-                put_byte(pb, 0); // slice number
-                put_be32(pb, KAG_SIZE); // system item size including klv fill
-            } else { // audio track
-                unsigned audio_frame_size = sc->aic.samples[0]*sc->aic.sample_size;
-                audio_frame_size += klv_fill_size(audio_frame_size);
-                put_byte(pb, 1);
-                put_be32(pb, (i-1)*audio_frame_size); // element delta
-            }
-        }
-
-        mxf_write_local_tag(pb, 8 + mxf->edit_units_count*(11+mxf->slice_count*4), 0x3F0A);
-        put_be32(pb, mxf->edit_units_count);  // num of entries
-        put_be32(pb, 11+mxf->slice_count*4);  // size of one entry
-        for (i = 0; i < mxf->edit_units_count; i++) {
-            int temporal_offset = 0;
-            if (temporal_reordering) {
-                for (j = i+1; j < mxf->edit_units_count; j++) {
-                    temporal_offset++;
-                    if (mxf->index_entries[j].flags & 0x10) { // backward prediction
-                        // next is not b, so is reordered
-                        if (!(mxf->index_entries[i+1].flags & 0x10)) {
-                            if ((mxf->index_entries[i].flags & 0x11) == 0) // I frame
-                                temporal_offset = 0;
-                            else
-                                temporal_offset = -temporal_offset;
-                        }
-                        break;
-                    }
-                }
-            }
-            put_byte(pb, temporal_offset);
-
-            if (!(mxf->index_entries[i].flags & 0x33)) { // I frame
-                if (mxf->index_entries[i].flags & 0x40 && // seq header
-                    (!temporal_reordering || !temporal_offset))
-                    mxf->index_entries[i].flags |= 0x80; // random access
-                mxf->last_key_index = key_index;
-                key_index = i;
-            }
-            if ((mxf->index_entries[i].flags & 0x30) == 0x30) { // back and forward prediction
-                put_byte(pb, mxf->last_key_index - i);
-            } else {
-                put_byte(pb, key_index - i); // key frame offset
-                if ((mxf->index_entries[i].flags & 0x20) == 0x20) // only forward
-                    mxf->last_key_index = key_index;
-            }
-            put_byte(pb, mxf->index_entries[i].flags);
-            // stream offset
-            put_be64(pb, mxf->index_entries[i].offset);
-            if (s->nb_streams > 1)
-                put_be32(pb, mxf->index_entries[i].slice_offset);
-        }
-
-        mxf->last_key_index = key_index - mxf->edit_units_count;
-        mxf->last_indexed_edit_unit += mxf->edit_units_count;
-        mxf->edit_units_count = 0;
-    }
-}
-
-static void mxf_write_klv_fill(AVFormatContext *s)
-{
-    unsigned pad = klv_fill_size(url_ftell(s->pb));
-    if (pad) {
-        put_buffer(s->pb, klv_fill_key, 16);
-        pad -= 16 + 4;
-        klv_encode_ber4_length(s->pb, pad);
-        for (; pad; pad--)
-            put_byte(s->pb, 0);
-        assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
-    }
-}
-
-static void mxf_write_partition(AVFormatContext *s, int bodysid,
-                                int indexsid,
-                                const uint8_t *key, int write_metadata)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t header_byte_count_offset;
-    unsigned index_byte_count = 0;
-    uint64_t partition_offset = url_ftell(pb);
-
-    if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
-        index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
-            12+mxf->edit_units_count*(11+mxf->slice_count*4);
-    else if (mxf->edit_unit_byte_count && indexsid)
-        index_byte_count = 80;
-
-    if (index_byte_count) {
-        // add encoded ber length
-        index_byte_count += 16 + klv_ber_length(index_byte_count);
-        index_byte_count += klv_fill_size(index_byte_count);
-    }
-
-    if (!memcmp(key, body_partition_key, 16)) {
-        mxf->body_partition_offset =
-            av_realloc(mxf->body_partition_offset,
-                       (mxf->body_partitions_count+1)*
-                       sizeof(*mxf->body_partition_offset));
-        mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset;
-    }
-
-    // write klv
-    put_buffer(pb, key, 16);
-    klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count);
-
-    // write partition value
-    put_be16(pb, 1); // majorVersion
-    put_be16(pb, 2); // minorVersion
-    put_be32(pb, KAG_SIZE); // KAGSize
-
-    put_be64(pb, partition_offset); // ThisPartition
-
-    if (!memcmp(key, body_partition_key, 16) && mxf->body_partitions_count > 1)
-        put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition
-    else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count)
-        put_be64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition
-    else
-        put_be64(pb, 0);
-
-    put_be64(pb, mxf->footer_partition_offset); // footerPartition
-
-    // set offset
-    header_byte_count_offset = url_ftell(pb);
-    put_be64(pb, 0); // headerByteCount, update later
-
-    // indexTable
-    put_be64(pb, index_byte_count); // indexByteCount
-    put_be32(pb, index_byte_count ? indexsid : 0); // indexSID
-
-    // BodyOffset
-    if (bodysid && mxf->edit_units_count && mxf->body_partitions_count) {
-        put_be64(pb, mxf->body_offset);
-    } else
-        put_be64(pb, 0);
-
-    put_be32(pb, bodysid); // bodySID
-
-    // operational pattern
-    put_buffer(pb, op1a_ul, 16);
-
-    // essence container
-    mxf_write_essence_container_refs(s);
-
-    if (write_metadata) {
-        // mark the start of the headermetadata and calculate metadata size
-        int64_t pos, start;
-        unsigned header_byte_count;
-
-        mxf_write_klv_fill(s);
-        start = url_ftell(s->pb);
-        mxf_write_primer_pack(s);
-        mxf_write_header_metadata_sets(s);
-        pos = url_ftell(s->pb);
-        header_byte_count = pos - start + klv_fill_size(pos);
-
-        // update header_byte_count
-        url_fseek(pb, header_byte_count_offset, SEEK_SET);
-        put_be64(pb, header_byte_count);
-        url_fseek(pb, pos, SEEK_SET);
-    }
-
-    put_flush_packet(pb);
-}
-
-static const UID mxf_mpeg2_codec_uls[] = {
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x01,0x10,0x00 }, // MP-ML I-Frame
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x01,0x11,0x00 }, // MP-ML Long GOP
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x02,0x02,0x00 }, // 422P-ML I-Frame
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x02,0x03,0x00 }, // 422P-ML Long GOP
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x03,0x02,0x00 }, // MP-HL I-Frame
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x03,0x03,0x00 }, // MP-HL Long GOP
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x02,0x00 }, // 422P-HL I-Frame
-    { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x04,0x03,0x00 }, // 422P-HL Long GOP
-};
-
-static const UID *mxf_get_mpeg2_codec_ul(AVCodecContext *avctx)
-{
-    int long_gop = avctx->gop_size > 1 || avctx->has_b_frames;
-
-    if (avctx->profile == 4) { // Main
-        if (avctx->level == 8) // Main
-            return &mxf_mpeg2_codec_uls[0+long_gop];
-        else if (avctx->level == 4) // High
-            return &mxf_mpeg2_codec_uls[4+long_gop];
-    } else if (avctx->profile == 0) { // 422
-        if (avctx->level == 5) // Main
-            return &mxf_mpeg2_codec_uls[2+long_gop];
-        else if (avctx->level == 2) // High
-            return &mxf_mpeg2_codec_uls[6+long_gop];
-    }
-    return NULL;
-}
-
-static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt, int *flags)
-{
-    MXFStreamContext *sc = st->priv_data;
-    MXFContext *mxf = s->priv_data;
-    uint32_t c = -1;
-    int i;
-
-    *flags = 0;
-
-    for(i = 0; i < pkt->size - 4; i++) {
-        c = (c<<8) + pkt->data[i];
-        if (c == 0x1b5) {
-            if ((pkt->data[i+1] & 0xf0) == 0x10) { // seq ext
-                st->codec->profile = pkt->data[i+1] & 0x07;
-                st->codec->level   = pkt->data[i+2] >> 4;
-            } else if (i + 5 < pkt->size && (pkt->data[i+1] & 0xf0) == 0x80) { // pict coding ext
-                sc->interlaced = !(pkt->data[i+5] & 0x80); // progressive frame
-                break;
-            }
-        } else if (c == 0x1b8) { // gop
-            if (pkt->data[i+4]>>6 & 0x01) { // closed
-                sc->closed_gop = 1;
-                if (*flags & 0x40) // sequence header present
-                    *flags |= 0x80; // random access
-            }
-            if (!mxf->header_written) {
-                unsigned hours   =  (pkt->data[i+1]>>2) & 0x1f;
-                unsigned minutes = ((pkt->data[i+1] & 0x03) << 4) | (pkt->data[i+2]>>4);
-                unsigned seconds = ((pkt->data[i+2] & 0x07) << 3) | (pkt->data[i+3]>>5);
-                unsigned frames  = ((pkt->data[i+3] & 0x1f) << 1) | (pkt->data[i+4]>>7);
-                mxf->timecode_drop_frame = !!(pkt->data[i+1] & 0x80);
-                mxf->timecode_start = (hours*3600 + minutes*60 + seconds) *
-                    mxf->timecode_base + frames;
-                if (mxf->timecode_drop_frame) {
-                    unsigned tminutes = 60 * hours + minutes;
-                    mxf->timecode_start -= 2 * (tminutes - tminutes / 10);
-                }
-                av_log(s, AV_LOG_DEBUG, "frame %d %d:%d:%d%c%d\n", mxf->timecode_start,
-                       hours, minutes, seconds, mxf->timecode_drop_frame ? ';':':', frames);
-            }
-        } else if (c == 0x1b3) { // seq
-            *flags |= 0x40;
-            switch ((pkt->data[i+4]>>4) & 0xf) {
-            case 2:  sc->aspect_ratio = (AVRational){  4,  3}; break;
-            case 3:  sc->aspect_ratio = (AVRational){ 16,  9}; break;
-            case 4:  sc->aspect_ratio = (AVRational){221,100}; break;
-            default:
-                av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
-                          st->codec->width, st->codec->height, 1024*1024);
-            }
-        } else if (c == 0x100) { // pic
-            int pict_type = (pkt->data[i+2]>>3) & 0x07;
-            if (pict_type == 2) { // P frame
-                *flags |= 0x22;
-                sc->closed_gop = 0; // reset closed gop, don't matter anymore
-            } else if (pict_type == 3) { // B frame
-                if (sc->closed_gop)
-                    *flags |= 0x13; // only backward prediction
-                else
-                    *flags |= 0x33;
-                sc->temporal_reordering = -1;
-            } else if (!pict_type) {
-                av_log(s, AV_LOG_ERROR, "error parsing mpeg2 frame\n");
-                return 0;
-            }
-        }
-    }
-    if (s->oformat != &mxf_d10_muxer)
-        sc->codec_ul = mxf_get_mpeg2_codec_ul(st->codec);
-    return !!sc->codec_ul;
-}
-
-static uint64_t mxf_parse_timestamp(time_t timestamp)
-{
-    struct tm *time = gmtime(&timestamp);
-    return (uint64_t)(time->tm_year+1900) << 48 |
-           (uint64_t)(time->tm_mon+1)     << 40 |
-           (uint64_t) time->tm_mday       << 32 |
-                      time->tm_hour       << 24 |
-                      time->tm_min        << 16 |
-                      time->tm_sec        << 8;
-}
-
-static void mxf_gen_umid(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    uint32_t seed = ff_random_get_seed();
-    uint64_t umid = seed + 0x5294713400000000LL;
-
-    AV_WB64(mxf->umid  , umid);
-    AV_WB64(mxf->umid+8, umid>>8);
-
-    mxf->instance_number = seed;
-}
-
-static int mxf_write_header(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    int i;
-    uint8_t present[FF_ARRAY_ELEMS(mxf_essence_container_uls)] = {0};
-    const int *samples_per_frame = NULL;
-
-    if (!s->nb_streams)
-        return -1;
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        MXFStreamContext *sc = av_mallocz(sizeof(*sc));
-        if (!sc)
-            return AVERROR(ENOMEM);
-        st->priv_data = sc;
-
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            if (i != 0) {
-                av_log(s, AV_LOG_ERROR, "video stream must be first track\n");
-                return -1;
-            }
-            if (fabs(av_q2d(st->codec->time_base) - 1/25.0) < 0.0001) {
-                samples_per_frame = PAL_samples_per_frame;
-                mxf->time_base = (AVRational){ 1, 25 };
-                mxf->timecode_base = 25;
-            } else if (fabs(av_q2d(st->codec->time_base) - 1001/30000.0) < 0.0001) {
-                samples_per_frame = NTSC_samples_per_frame;
-                mxf->time_base = (AVRational){ 1001, 30000 };
-                mxf->timecode_base = 30;
-            } else {
-                av_log(s, AV_LOG_ERROR, "unsupported video frame rate\n");
-                return -1;
-            }
-            av_set_pts_info(st, 64, mxf->time_base.num, mxf->time_base.den);
-            if (s->oformat == &mxf_d10_muxer) {
-                if (st->codec->bit_rate == 50000000)
-                    if (mxf->time_base.den == 25) sc->index = 3;
-                    else                          sc->index = 5;
-                else if (st->codec->bit_rate == 40000000)
-                    if (mxf->time_base.den == 25) sc->index = 7;
-                    else                          sc->index = 9;
-                else if (st->codec->bit_rate == 30000000)
-                    if (mxf->time_base.den == 25) sc->index = 11;
-                    else                          sc->index = 13;
-                else {
-                    av_log(s, AV_LOG_ERROR, "error MXF D-10 only support 30/40/50 mbit/s\n");
-                    return -1;
-                }
-
-                mxf->edit_unit_byte_count = KAG_SIZE; // system element
-                mxf->edit_unit_byte_count += 16 + 4 + (uint64_t)st->codec->bit_rate *
-                    mxf->time_base.num / (8*mxf->time_base.den);
-                mxf->edit_unit_byte_count += klv_fill_size(mxf->edit_unit_byte_count);
-                mxf->edit_unit_byte_count += 16 + 4 + 4 + samples_per_frame[0]*8*4;
-                mxf->edit_unit_byte_count += klv_fill_size(mxf->edit_unit_byte_count);
-            }
-        } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if (st->codec->sample_rate != 48000) {
-                av_log(s, AV_LOG_ERROR, "only 48khz is implemented\n");
-                return -1;
-            }
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-            if (s->oformat == &mxf_d10_muxer) {
-                if (st->index != 1) {
-                    av_log(s, AV_LOG_ERROR, "MXF D-10 only support one audio track\n");
-                    return -1;
-                }
-                if (st->codec->codec_id != CODEC_ID_PCM_S16LE &&
-                    st->codec->codec_id != CODEC_ID_PCM_S24LE) {
-                    av_log(s, AV_LOG_ERROR, "MXF D-10 only support 16 or 24 bits le audio\n");
-                }
-                sc->index = ((MXFStreamContext*)s->streams[0]->priv_data)->index + 1;
-            } else
-            mxf->slice_count = 1;
-        }
-
-        if (!sc->index) {
-            sc->index = mxf_get_essence_container_ul_index(st->codec->codec_id);
-            if (sc->index == -1) {
-                av_log(s, AV_LOG_ERROR, "track %d: could not find essence container ul, "
-                       "codec not currently supported in container\n", i);
-                return -1;
-            }
-        }
-
-        sc->codec_ul = &mxf_essence_container_uls[sc->index].codec_ul;
-
-        memcpy(sc->track_essence_element_key, mxf_essence_container_uls[sc->index].element_ul, 15);
-        sc->track_essence_element_key[15] = present[sc->index];
-        PRINT_KEY(s, "track essence element key", sc->track_essence_element_key);
-
-        if (!present[sc->index])
-            mxf->essence_container_count++;
-        present[sc->index]++;
-    }
-
-    if (s->oformat == &mxf_d10_muxer) {
-        mxf->essence_container_count = 1;
-    }
-
-    if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
-        mxf_gen_umid(s);
-
-    for (i = 0; i < s->nb_streams; i++) {
-        MXFStreamContext *sc = s->streams[i]->priv_data;
-        // update element count
-        sc->track_essence_element_key[13] = present[sc->index];
-        sc->order = AV_RB32(sc->track_essence_element_key+12);
-    }
-
-    if (s->timestamp)
-        mxf->timestamp = mxf_parse_timestamp(s->timestamp);
-    mxf->duration = -1;
-
-    mxf->timecode_track = av_mallocz(sizeof(*mxf->timecode_track));
-    if (!mxf->timecode_track)
-        return AVERROR(ENOMEM);
-    mxf->timecode_track->priv_data = av_mallocz(sizeof(MXFStreamContext));
-    if (!mxf->timecode_track->priv_data)
-        return AVERROR(ENOMEM);
-    mxf->timecode_track->index = -1;
-
-    if (!samples_per_frame)
-        samples_per_frame = PAL_samples_per_frame;
-
-    if (ff_audio_interleave_init(s, samples_per_frame, mxf->time_base) < 0)
-        return -1;
-
-    return 0;
-}
-
-static const uint8_t system_metadata_pack_key[]        = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x03,0x01,0x04,0x01,0x01,0x00 };
-static const uint8_t system_metadata_package_set_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x43,0x01,0x01,0x0D,0x01,0x03,0x01,0x04,0x01,0x02,0x01 };
-
-static uint32_t ff_framenum_to_12m_time_code(unsigned frame, int drop, int fps)
-{
-    return (0                                    << 31) | // color frame flag
-           (0                                    << 30) | // drop  frame flag
-           ( ((frame % fps) / 10)                << 28) | // tens  of frames
-           ( ((frame % fps) % 10)                << 24) | // units of frames
-           (0                                    << 23) | // field phase (NTSC), b0 (PAL)
-           ((((frame / fps) % 60) / 10)          << 20) | // tens  of seconds
-           ((((frame / fps) % 60) % 10)          << 16) | // units of seconds
-           (0                                    << 15) | // b0 (NTSC), b2 (PAL)
-           ((((frame / (fps * 60)) % 60) / 10)   << 12) | // tens  of minutes
-           ((((frame / (fps * 60)) % 60) % 10)   <<  8) | // units of minutes
-           (0                                    <<  7) | // b1
-           (0                                    <<  6) | // b2 (NSC), field phase (PAL)
-           ((((frame / (fps * 3600) % 24)) / 10) <<  4) | // tens  of hours
-           (  (frame / (fps * 3600) % 24)) % 10;          // units of hours
-}
-
-static void mxf_write_system_item(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned frame;
-    uint32_t time_code;
-
-    frame = mxf->timecode_start + mxf->last_indexed_edit_unit + mxf->edit_units_count;
-
-    // write system metadata pack
-    put_buffer(pb, system_metadata_pack_key, 16);
-    klv_encode_ber4_length(pb, 57);
-    put_byte(pb, 0x5c); // UL, user date/time stamp, picture and sound item present
-    put_byte(pb, 0x04); // content package rate
-    put_byte(pb, 0x00); // content package type
-    put_be16(pb, 0x00); // channel handle
-    put_be16(pb, frame); // continuity count
-    if (mxf->essence_container_count > 1)
-        put_buffer(pb, multiple_desc_ul, 16);
-    else {
-        MXFStreamContext *sc = s->streams[0]->priv_data;
-        put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
-    }
-    put_byte(pb, 0);
-    put_be64(pb, 0);
-    put_be64(pb, 0); // creation date/time stamp
-
-    put_byte(pb, 0x81); // SMPTE 12M time code
-    time_code = ff_framenum_to_12m_time_code(frame, mxf->timecode_drop_frame, mxf->timecode_base);
-    put_be32(pb, time_code);
-    put_be32(pb, 0); // binary group data
-    put_be64(pb, 0);
-
-    // write system metadata package set
-    put_buffer(pb, system_metadata_package_set_key, 16);
-    klv_encode_ber4_length(pb, 35);
-    put_byte(pb, 0x83); // UMID
-    put_be16(pb, 0x20);
-    mxf_write_umid(s, 1);
-}
-
-static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int packet_size = (uint64_t)st->codec->bit_rate*mxf->time_base.num /
-        (8*mxf->time_base.den); // frame size
-    int pad;
-
-    packet_size += 16 + 4;
-    packet_size += klv_fill_size(packet_size);
-
-    klv_encode_ber4_length(pb, pkt->size);
-    put_buffer(pb, pkt->data, pkt->size);
-
-    // ensure CBR muxing by padding to correct video frame size
-    pad = packet_size - pkt->size - 16 - 4;
-    if (pad > 20) {
-        put_buffer(s->pb, klv_fill_key, 16);
-        pad -= 16 + 4;
-        klv_encode_ber4_length(s->pb, pad);
-        for (; pad; pad--)
-            put_byte(s->pb, 0);
-        assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
-    } else {
-        av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n");
-        for (; pad > 0; pad--)
-            put_byte(s->pb, 0);
-    }
-}
-
-static void mxf_write_d10_audio_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int frame_size = pkt->size / st->codec->block_align;
-    uint8_t *samples = pkt->data;
-    uint8_t *end = pkt->data + pkt->size;
-    int i;
-
-    klv_encode_ber4_length(pb, 4 + frame_size*4*8);
-
-    put_byte(pb, (frame_size == 1920 ? 0 : (mxf->edit_units_count-1) % 5 + 1));
-    put_le16(pb, frame_size);
-    put_byte(pb, (1<<st->codec->channels)-1);
-
-    while (samples < end) {
-        for (i = 0; i < st->codec->channels; i++) {
-            uint32_t sample;
-            if (st->codec->codec_id == CODEC_ID_PCM_S24LE) {
-                sample = AV_RL24(samples)<< 4;
-                samples += 3;
-            } else {
-                sample = AV_RL16(samples)<<12;
-                samples += 2;
-            }
-            put_le32(pb, sample | i);
-        }
-        for (; i < 8; i++)
-            put_le32(pb, i);
-    }
-}
-
-static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st = s->streams[pkt->stream_index];
-    MXFStreamContext *sc = st->priv_data;
-    int flags = 0;
-
-    if (!mxf->edit_unit_byte_count && !(mxf->edit_units_count % EDIT_UNITS_PER_BODY)) {
-        mxf->index_entries = av_realloc(mxf->index_entries,
-            (mxf->edit_units_count + EDIT_UNITS_PER_BODY)*sizeof(*mxf->index_entries));
-        if (!mxf->index_entries) {
-            av_log(s, AV_LOG_ERROR, "could not allocate index entries\n");
-            return -1;
-        }
-    }
-
-    if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
-        if (!mxf_parse_mpeg2_frame(s, st, pkt, &flags)) {
-            av_log(s, AV_LOG_ERROR, "could not get mpeg2 profile and level\n");
-            return -1;
-        }
-    }
-
-    if (!mxf->header_written) {
-        if (mxf->edit_unit_byte_count) {
-            mxf_write_partition(s, 1, 2, header_open_partition_key, 1);
-            mxf_write_klv_fill(s);
-            mxf_write_index_table_segment(s);
-        } else {
-            mxf_write_partition(s, 0, 0, header_open_partition_key, 1);
-        }
-        mxf->header_written = 1;
-    }
-
-    if (st->index == 0) {
-        if (!mxf->edit_unit_byte_count &&
-            (!mxf->edit_units_count || mxf->edit_units_count > EDIT_UNITS_PER_BODY) &&
-            !(flags & 0x33)) { // I frame, Gop start
-            mxf_write_klv_fill(s);
-            mxf_write_partition(s, 1, 2, body_partition_key, 0);
-
-            mxf_write_klv_fill(s);
-            mxf_write_index_table_segment(s);
-        }
-
-        mxf_write_klv_fill(s);
-        mxf_write_system_item(s);
-
-        if (!mxf->edit_unit_byte_count) {
-            mxf->index_entries[mxf->edit_units_count].offset = mxf->body_offset;
-            mxf->index_entries[mxf->edit_units_count].flags = flags;
-            mxf->body_offset += KAG_SIZE; // size of system element
-        }
-        mxf->edit_units_count++;
-    } else if (!mxf->edit_unit_byte_count && st->index == 1) {
-        mxf->index_entries[mxf->edit_units_count-1].slice_offset =
-            mxf->body_offset - mxf->index_entries[mxf->edit_units_count-1].offset;
-    }
-
-    mxf_write_klv_fill(s);
-    put_buffer(pb, sc->track_essence_element_key, 16); // write key
-    if (s->oformat == &mxf_d10_muxer) {
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-            mxf_write_d10_video_packet(s, st, pkt);
-        else
-            mxf_write_d10_audio_packet(s, st, pkt);
-    } else {
-        klv_encode_ber4_length(pb, pkt->size); // write length
-        put_buffer(pb, pkt->data, pkt->size);
-        mxf->body_offset += 16+4+pkt->size + klv_fill_size(16+4+pkt->size);
-    }
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static void mxf_write_random_index_pack(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint64_t pos = url_ftell(pb);
-    int i;
-
-    put_buffer(pb, random_index_pack_key, 16);
-    klv_encode_ber_length(pb, 28 + 12*mxf->body_partitions_count);
-
-    if (mxf->edit_unit_byte_count)
-        put_be32(pb, 1); // BodySID of header partition
-    else
-        put_be32(pb, 0);
-    put_be64(pb, 0); // offset of header partition
-
-    for (i = 0; i < mxf->body_partitions_count; i++) {
-        put_be32(pb, 1); // BodySID
-        put_be64(pb, mxf->body_partition_offset[i]);
-    }
-
-    put_be32(pb, 0); // BodySID of footer partition
-    put_be64(pb, mxf->footer_partition_offset);
-
-    put_be32(pb, url_ftell(pb) - pos + 4);
-}
-
-static int mxf_write_footer(AVFormatContext *s)
-{
-    MXFContext *mxf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;
-
-    mxf_write_klv_fill(s);
-    mxf->footer_partition_offset = url_ftell(pb);
-    if (mxf->edit_unit_byte_count) { // no need to repeat index
-        mxf_write_partition(s, 0, 0, footer_partition_key, 0);
-    } else {
-        mxf_write_partition(s, 0, 2, footer_partition_key, 0);
-
-        mxf_write_klv_fill(s);
-        mxf_write_index_table_segment(s);
-    }
-
-    mxf_write_klv_fill(s);
-    mxf_write_random_index_pack(s);
-
-    if (!url_is_streamed(s->pb)) {
-        url_fseek(pb, 0, SEEK_SET);
-        if (mxf->edit_unit_byte_count) {
-            mxf_write_partition(s, 1, 2, header_closed_partition_key, 1);
-            mxf_write_klv_fill(s);
-            mxf_write_index_table_segment(s);
-        } else {
-            mxf_write_partition(s, 0, 0, header_closed_partition_key, 1);
-        }
-    }
-
-    put_flush_packet(pb);
-
-    ff_audio_interleave_close(s);
-
-    av_freep(&mxf->index_entries);
-    av_freep(&mxf->body_partition_offset);
-    av_freep(&mxf->timecode_track->priv_data);
-    av_freep(&mxf->timecode_track);
-
-    mxf_free(s);
-
-    return 0;
-}
-
-static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
-{
-    int i, stream_count = 0;
-
-    for (i = 0; i < s->nb_streams; i++)
-        stream_count += !!s->streams[i]->last_in_packet_buffer;
-
-    if (stream_count && (s->nb_streams == stream_count || flush)) {
-        AVPacketList *pktl = s->packet_buffer;
-        if (s->nb_streams != stream_count) {
-            AVPacketList *last = NULL;
-            // find last packet in edit unit
-            while (pktl) {
-                if (!stream_count || pktl->pkt.stream_index == 0)
-                    break;
-                last = pktl;
-                pktl = pktl->next;
-                stream_count--;
-            }
-            // purge packet queue
-            while (pktl) {
-                AVPacketList *next = pktl->next;
-
-                if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
-                    s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
-                av_free_packet(&pktl->pkt);
-                av_freep(&pktl);
-                pktl = next;
-            }
-            if (last)
-                last->next = NULL;
-            else {
-                s->packet_buffer = NULL;
-                s->packet_buffer_end= NULL;
-                goto out;
-            }
-            pktl = s->packet_buffer;
-        }
-
-        *out = pktl->pkt;
-        //av_log(s, AV_LOG_DEBUG, "out st:%d dts:%lld\n", (*out).stream_index, (*out).dts);
-        s->packet_buffer = pktl->next;
-        if(s->streams[pktl->pkt.stream_index]->last_in_packet_buffer == pktl)
-            s->streams[pktl->pkt.stream_index]->last_in_packet_buffer= NULL;
-        if(!s->packet_buffer)
-            s->packet_buffer_end= NULL;
-        av_freep(&pktl);
-        return 1;
-    } else {
-    out:
-        av_init_packet(out);
-        return 0;
-    }
-}
-
-static int mxf_compare_timestamps(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
-{
-    MXFStreamContext *sc  = s->streams[pkt ->stream_index]->priv_data;
-    MXFStreamContext *sc2 = s->streams[next->stream_index]->priv_data;
-
-    return next->dts > pkt->dts ||
-        (next->dts == pkt->dts && sc->order < sc2->order);
-}
-
-static int mxf_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush)
-{
-    return ff_audio_rechunk_interleave(s, out, pkt, flush,
-                               mxf_interleave_get_packet, mxf_compare_timestamps);
-}
-
-AVOutputFormat mxf_muxer = {
-    "mxf",
-    NULL_IF_CONFIG_SMALL("Material eXchange Format"),
-    "application/mxf",
-    "mxf",
-    sizeof(MXFContext),
-    CODEC_ID_PCM_S16LE,
-    CODEC_ID_MPEG2VIDEO,
-    mxf_write_header,
-    mxf_write_packet,
-    mxf_write_footer,
-    AVFMT_NOTIMESTAMPS,
-    NULL,
-    mxf_interleave,
-};
-
-AVOutputFormat mxf_d10_muxer = {
-    "mxf_d10",
-    NULL_IF_CONFIG_SMALL("Material eXchange Format, D-10 Mapping"),
-    "application/mxf",
-    NULL,
-    sizeof(MXFContext),
-    CODEC_ID_PCM_S16LE,
-    CODEC_ID_MPEG2VIDEO,
-    mxf_write_header,
-    mxf_write_packet,
-    mxf_write_footer,
-    AVFMT_NOTIMESTAMPS,
-    NULL,
-    mxf_interleave,
-};
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
deleted file mode 100644
index 6d99a04..0000000
--- a/libavformat/ncdec.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * NC camera feed demuxer
- * Copyright (c) 2009  Nicolas Martin (martinic at iro dot umontreal dot ca)
- *                     Edouard Auvinet
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define NC_VIDEO_FLAG 0x1A5
-
-static int nc_probe(AVProbeData *probe_packet)
-{
-    int size;
-
-    if (AV_RB32(probe_packet->buf) != NC_VIDEO_FLAG)
-        return 0;
-
-    size = AV_RL16(probe_packet->buf + 5);
-
-    if (size + 20 > probe_packet->buf_size)
-        return AVPROBE_SCORE_MAX/4;
-
-    if (AV_RB32(probe_packet->buf+16+size) == NC_VIDEO_FLAG)
-        return AVPROBE_SCORE_MAX;
-
-    return 0;
-}
-
-static int nc_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    AVStream *st = av_new_stream(s, 0);
-
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_MPEG4;
-    st->need_parsing      = AVSTREAM_PARSE_FULL;
-
-    av_set_pts_info(st, 64, 1, 100);
-
-    return 0;
-}
-
-static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int size;
-    int ret;
-
-    uint32_t state=-1;
-    while (state != NC_VIDEO_FLAG) {
-        if (url_feof(s->pb))
-            return AVERROR(EIO);
-        state = (state<<8) + get_byte(s->pb);
-    }
-
-    get_byte(s->pb);
-    size = get_le16(s->pb);
-    url_fskip(s->pb, 9);
-
-    if (size == 0) {
-        av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n");
-        return AVERROR(EAGAIN);
-    }
-
-    ret = av_get_packet(s->pb, pkt, size);
-    if (ret != size) {
-        if (ret > 0) av_free_packet(pkt);
-        return AVERROR(EIO);
-    }
-
-    pkt->stream_index = 0;
-    return size;
-}
-
-AVInputFormat nc_demuxer = {
-    "nc",
-    NULL_IF_CONFIG_SMALL("NC camera feed format"),
-    0,
-    nc_probe,
-    nc_read_header,
-    nc_read_packet,
-    .extensions = "v",
-};
diff --git a/libavformat/network.h b/libavformat/network.h
deleted file mode 100644
index 0fbcbbb..0000000
--- a/libavformat/network.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2007 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_NETWORK_H
-#define AVFORMAT_NETWORK_H
-
-#include "config.h"
-
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#include <ws2tcpip.h>
-
-#define ff_neterrno() (-WSAGetLastError())
-#define FF_NETERROR(err) (-WSA##err)
-#define WSAEAGAIN WSAEWOULDBLOCK
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-#define ff_neterrno() AVERROR(errno)
-#define FF_NETERROR(err) AVERROR(err)
-#endif
-
-#if HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-int ff_socket_nonblock(int socket, int enable);
-
-static inline int ff_network_init(void)
-{
-#if HAVE_WINSOCK2_H
-    WSADATA wsaData;
-    if (WSAStartup(MAKEWORD(1,1), &wsaData))
-        return 0;
-#endif
-    return 1;
-}
-
-static inline void ff_network_close(void)
-{
-#if HAVE_WINSOCK2_H
-    WSACleanup();
-#endif
-}
-
-int ff_inet_aton (const char * str, struct in_addr * add);
-
-#if !HAVE_STRUCT_SOCKADDR_STORAGE
-struct sockaddr_storage {
-#if HAVE_STRUCT_SOCKADDR_SA_LEN
-    uint8_t ss_len;
-    uint8_t ss_family;
-#else
-    uint16_t ss_family;
-#endif
-    char ss_pad1[6];
-    int64_t ss_align;
-    char ss_pad2[112];
-};
-#endif
-
-#if !HAVE_STRUCT_ADDRINFO
-struct addrinfo {
-    int ai_flags;
-    int ai_family;
-    int ai_socktype;
-    int ai_protocol;
-    int ai_addrlen;
-    struct sockaddr *ai_addr;
-    char *ai_canonname;
-    struct addrinfo *ai_next;
-};
-#endif
-
-/* getaddrinfo constants */
-#ifndef EAI_FAIL
-#define EAI_FAIL 4
-#endif
-
-#ifndef EAI_FAMILY
-#define EAI_FAMILY 5
-#endif
-
-#ifndef EAI_NONAME
-#define EAI_NONAME 8
-#endif
-
-#ifndef AI_PASSIVE
-#define AI_PASSIVE 1
-#endif
-
-#ifndef AI_CANONNAME
-#define AI_CANONNAME 2
-#endif
-
-#ifndef AI_NUMERICHOST
-#define AI_NUMERICHOST 4
-#endif
-
-#ifndef NI_NOFQDN
-#define NI_NOFQDN 1
-#endif
-
-#ifndef NI_NUMERICHOST
-#define NI_NUMERICHOST 2
-#endif
-
-#ifndef NI_NAMERQD
-#define NI_NAMERQD 4
-#endif
-
-#ifndef NI_NUMERICSERV
-#define NI_NUMERICSERV 8
-#endif
-
-#ifndef NI_DGRAM
-#define NI_DGRAM 16
-#endif
-
-#if !HAVE_GETADDRINFO
-int ff_getaddrinfo(const char *node, const char *service,
-                   const struct addrinfo *hints, struct addrinfo **res);
-void ff_freeaddrinfo(struct addrinfo *res);
-int ff_getnameinfo(const struct sockaddr *sa, int salen,
-                   char *host, int hostlen,
-                   char *serv, int servlen, int flags);
-const char *ff_gai_strerror(int ecode);
-#define getaddrinfo ff_getaddrinfo
-#define freeaddrinfo ff_freeaddrinfo
-#define getnameinfo ff_getnameinfo
-#define gai_strerror ff_gai_strerror
-#endif
-
-#endif /* AVFORMAT_NETWORK_H */
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
deleted file mode 100644
index 44e5097..0000000
--- a/libavformat/nsvdec.c
+++ /dev/null
@@ -1,786 +0,0 @@
-/*
- * NSV demuxer
- * Copyright (c) 2004 The FFmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "riff.h"
-
-//#define DEBUG
-//#define DEBUG_DUMP_INDEX // XXX dumbdriving-271.nsv breaks with it commented!!
-//#define DEBUG_SEEK
-#define CHECK_SUBSEQUENT_NSVS
-//#define DISABLE_AUDIO
-
-/* max bytes to crawl for trying to resync
- * stupid streaming servers don't start at chunk boundaries...
- */
-#define NSV_MAX_RESYNC (500*1024)
-#define NSV_MAX_RESYNC_TRIES 300
-
-/*
- * First version by Francois Revol - revol at free.fr
- * References:
- * (1) http://www.multimedia.cx/nsv-format.txt
- * seems someone came to the same conclusions as me, and updated it:
- * (2) http://www.stud.ktu.lt/~vitslav/nsv/nsv-format.txt
- *     http://www.stud.ktu.lt/~vitslav/nsv/
- * official docs
- * (3) http://ultravox.aol.com/NSVFormat.rtf
- * Sample files:
- * (S1) http://www.nullsoft.com/nsv/samples/
- * http://www.nullsoft.com/nsv/samples/faster.nsv
- * http://streamripper.sourceforge.net/openbb/read.php?TID=492&page=4
- */
-
-/*
- * notes on the header (Francois Revol):
- *
- * It is followed by strings, then a table, but nothing tells
- * where the table begins according to (1). After checking faster.nsv,
- * I believe NVSf[16-19] gives the size of the strings data
- * (that is the offset of the data table after the header).
- * After checking all samples from (S1) all confirms this.
- *
- * Then, about NSVf[12-15], faster.nsf has 179700. When veiwing it in VLC,
- * I noticed there was about 1 NVSs chunk/s, so I ran
- * strings faster.nsv | grep NSVs | wc -l
- * which gave me 180. That leads me to think that NSVf[12-15] might be the
- * file length in milliseconds.
- * Let's try that:
- * for f in *.nsv; do HTIME="$(od -t x4 "$f" | head -1 | sed 's/.* //')"; echo "'$f' $((0x$HTIME))s = $((0x$HTIME/1000/60)):$((0x$HTIME/1000%60))"; done
- * except for nstrailer (which doesn't have an NSVf header), it repports correct time.
- *
- * nsvtrailer.nsv (S1) does not have any NSVf header, only NSVs chunks,
- * so the header seems to not be mandatory. (for streaming).
- *
- * index slice duration check (excepts nsvtrailer.nsv):
- * for f in [^n]*.nsv; do DUR="$(ffmpeg -i "$f" 2>/dev/null | grep 'NSVf duration' | cut -d ' ' -f 4)"; IC="$(ffmpeg -i "$f" 2>/dev/null | grep 'INDEX ENTRIES' | cut -d ' ' -f 2)"; echo "duration $DUR, slite time $(($DUR/$IC))"; done
- */
-
-/*
- * TODO:
- * - handle timestamps !!!
- * - use index
- * - mime-type in probe()
- * - seek
- */
-
-#ifdef DEBUG
-#define PRINT(_v) printf _v
-#else
-#define PRINT(_v)
-#endif
-
-#if 0
-struct NSVf_header {
-    uint32_t chunk_tag; /* 'NSVf' */
-    uint32_t chunk_size;
-    uint32_t file_size; /* max 4GB ??? no one learns anything it seems :^) */
-    uint32_t file_length; //unknown1;  /* what about MSB of file_size ? */
-    uint32_t info_strings_size; /* size of the info strings */ //unknown2;
-    uint32_t table_entries;
-    uint32_t table_entries_used; /* the left ones should be -1 */
-};
-
-struct NSVs_header {
-    uint32_t chunk_tag; /* 'NSVs' */
-    uint32_t v4cc;      /* or 'NONE' */
-    uint32_t a4cc;      /* or 'NONE' */
-    uint16_t vwidth;    /* assert(vwidth%16==0) */
-    uint16_t vheight;   /* assert(vheight%16==0) */
-    uint8_t framerate;  /* value = (framerate&0x80)?frtable[frameratex0x7f]:framerate */
-    uint16_t unknown;
-};
-
-struct nsv_avchunk_header {
-    uint8_t vchunk_size_lsb;
-    uint16_t vchunk_size_msb; /* value = (vchunk_size_msb << 4) | (vchunk_size_lsb >> 4) */
-    uint16_t achunk_size;
-};
-
-struct nsv_pcm_header {
-    uint8_t bits_per_sample;
-    uint8_t channel_count;
-    uint16_t sample_rate;
-};
-#endif
-
-/* variation from avi.h */
-/*typedef struct CodecTag {
-    int id;
-    unsigned int tag;
-} CodecTag;*/
-
-/* tags */
-
-#define T_NSVF MKTAG('N', 'S', 'V', 'f') /* file header */
-#define T_NSVS MKTAG('N', 'S', 'V', 's') /* chunk header */
-#define T_TOC2 MKTAG('T', 'O', 'C', '2') /* extra index marker */
-#define T_NONE MKTAG('N', 'O', 'N', 'E') /* null a/v 4CC */
-#define T_SUBT MKTAG('S', 'U', 'B', 'T') /* subtitle aux data */
-#define T_ASYN MKTAG('A', 'S', 'Y', 'N') /* async a/v aux marker */
-#define T_KEYF MKTAG('K', 'E', 'Y', 'F') /* video keyframe aux marker (addition) */
-
-#define TB_NSVF MKBETAG('N', 'S', 'V', 'f')
-#define TB_NSVS MKBETAG('N', 'S', 'V', 's')
-
-/* hardcoded stream indexes */
-#define NSV_ST_VIDEO 0
-#define NSV_ST_AUDIO 1
-#define NSV_ST_SUBT 2
-
-enum NSVStatus {
-    NSV_UNSYNC,
-    NSV_FOUND_NSVF,
-    NSV_HAS_READ_NSVF,
-    NSV_FOUND_NSVS,
-    NSV_HAS_READ_NSVS,
-    NSV_FOUND_BEEF,
-    NSV_GOT_VIDEO,
-    NSV_GOT_AUDIO,
-};
-
-typedef struct NSVStream {
-    int frame_offset; /* current frame (video) or byte (audio) counter
-                         (used to compute the pts) */
-    int scale;
-    int rate;
-    int sample_size; /* audio only data */
-    int start;
-
-    int new_frame_offset; /* temporary storage (used during seek) */
-    int cum_len; /* temporary storage (used during seek) */
-} NSVStream;
-
-typedef struct {
-    int  base_offset;
-    int  NSVf_end;
-    uint32_t *nsvs_file_offset;
-    int index_entries;
-    enum NSVStatus state;
-    AVPacket ahead[2]; /* [v, a] if .data is !NULL there is something */
-    /* cached */
-    int64_t duration;
-    uint32_t vtag, atag;
-    uint16_t vwidth, vheight;
-    int16_t avsync;
-    AVRational framerate;
-    uint32_t *nsvs_timestamps;
-    //DVDemuxContext* dv_demux;
-} NSVContext;
-
-static const AVCodecTag nsv_codec_video_tags[] = {
-    { CODEC_ID_VP3, MKTAG('V', 'P', '3', ' ') },
-    { CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
-    { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
-    { CODEC_ID_VP5, MKTAG('V', 'P', '5', ' ') },
-    { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
-    { CODEC_ID_VP6, MKTAG('V', 'P', '6', ' ') },
-    { CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
-    { CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
-    { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
-/*
-    { CODEC_ID_VP4, MKTAG('V', 'P', '4', ' ') },
-    { CODEC_ID_VP4, MKTAG('V', 'P', '4', '0') },
-*/
-    { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') }, /* cf sample xvid decoder from nsv_codec_sdk.zip */
-    { CODEC_ID_RAWVIDEO, MKTAG('R', 'G', 'B', '3') },
-    { CODEC_ID_NONE, 0 },
-};
-
-static const AVCodecTag nsv_codec_audio_tags[] = {
-    { CODEC_ID_MP3,       MKTAG('M', 'P', '3', ' ') },
-    { CODEC_ID_AAC,       MKTAG('A', 'A', 'C', ' ') },
-    { CODEC_ID_AAC,       MKTAG('A', 'A', 'C', 'P') },
-    { CODEC_ID_SPEEX,     MKTAG('S', 'P', 'X', ' ') },
-    { CODEC_ID_PCM_U16LE, MKTAG('P', 'C', 'M', ' ') },
-    { CODEC_ID_NONE,      0 },
-};
-
-//static int nsv_load_index(AVFormatContext *s);
-static int nsv_read_chunk(AVFormatContext *s, int fill_header);
-
-#ifdef DEBUG
-static void print_tag(const char *str, unsigned int tag, int size)
-{
-    printf("%s: tag=%c%c%c%c\n",
-           str, tag & 0xff,
-           (tag >> 8) & 0xff,
-           (tag >> 16) & 0xff,
-           (tag >> 24) & 0xff);
-}
-#endif
-
-/* try to find something we recognize, and set the state accordingly */
-static int nsv_resync(AVFormatContext *s)
-{
-    NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint32_t v = 0;
-    int i;
-
-    PRINT(("%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state));
-
-    //nsv->state = NSV_UNSYNC;
-
-    for (i = 0; i < NSV_MAX_RESYNC; i++) {
-        if (url_feof(pb)) {
-            PRINT(("NSV EOF\n"));
-            nsv->state = NSV_UNSYNC;
-            return -1;
-        }
-        v <<= 8;
-        v |= get_byte(pb);
-/*
-        if (i < 8) {
-            PRINT(("NSV resync: [%d] = %02x\n", i, v & 0x0FF));
-        }
-*/
-
-        if ((v & 0x0000ffff) == 0xefbe) { /* BEEF */
-            PRINT(("NSV resynced on BEEF after %d bytes\n", i+1));
-            nsv->state = NSV_FOUND_BEEF;
-            return 0;
-        }
-        /* we read as big endian, thus the MK*BE* */
-        if (v == TB_NSVF) { /* NSVf */
-            PRINT(("NSV resynced on NSVf after %d bytes\n", i+1));
-            nsv->state = NSV_FOUND_NSVF;
-            return 0;
-        }
-        if (v == MKBETAG('N', 'S', 'V', 's')) { /* NSVs */
-            PRINT(("NSV resynced on NSVs after %d bytes\n", i+1));
-            nsv->state = NSV_FOUND_NSVS;
-            return 0;
-        }
-
-    }
-    PRINT(("NSV sync lost\n"));
-    return -1;
-}
-
-static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned int file_size, size;
-    int64_t duration;
-    int strings_size;
-    int table_entries;
-    int table_entries_used;
-
-    PRINT(("%s()\n", __FUNCTION__));
-
-    nsv->state = NSV_UNSYNC; /* in case we fail */
-
-    size = get_le32(pb);
-    if (size < 28)
-        return -1;
-    nsv->NSVf_end = size;
-
-    //s->file_size = (uint32_t)get_le32(pb);
-    file_size = (uint32_t)get_le32(pb);
-    PRINT(("NSV NSVf chunk_size %u\n", size));
-    PRINT(("NSV NSVf file_size %u\n", file_size));
-
-    nsv->duration = duration = get_le32(pb); /* in ms */
-    PRINT(("NSV NSVf duration %"PRId64" ms\n", duration));
-    // XXX: store it in AVStreams
-
-    strings_size = get_le32(pb);
-    table_entries = get_le32(pb);
-    table_entries_used = get_le32(pb);
-    PRINT(("NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
-            strings_size, table_entries, table_entries_used));
-    if (url_feof(pb))
-        return -1;
-
-    PRINT(("NSV got header; filepos %"PRId64"\n", url_ftell(pb)));
-
-    if (strings_size > 0) {
-        char *strings; /* last byte will be '\0' to play safe with str*() */
-        char *p, *endp;
-        char *token, *value;
-        char quote;
-
-        p = strings = av_mallocz(strings_size + 1);
-        endp = strings + strings_size;
-        get_buffer(pb, strings, strings_size);
-        while (p < endp) {
-            while (*p == ' ')
-                p++; /* strip out spaces */
-            if (p >= endp-2)
-                break;
-            token = p;
-            p = strchr(p, '=');
-            if (!p || p >= endp-2)
-                break;
-            *p++ = '\0';
-            quote = *p++;
-            value = p;
-            p = strchr(p, quote);
-            if (!p || p >= endp)
-                break;
-            *p++ = '\0';
-            PRINT(("NSV NSVf INFO: %s='%s'\n", token, value));
-            av_metadata_set2(&s->metadata, token, value, 0);
-        }
-        av_free(strings);
-    }
-    if (url_feof(pb))
-        return -1;
-
-    PRINT(("NSV got infos; filepos %"PRId64"\n", url_ftell(pb)));
-
-    if (table_entries_used > 0) {
-        int i;
-        nsv->index_entries = table_entries_used;
-        if((unsigned)table_entries_used >= UINT_MAX / sizeof(uint32_t))
-            return -1;
-        nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t));
-
-        for(i=0;i<table_entries_used;i++)
-            nsv->nsvs_file_offset[i] = get_le32(pb) + size;
-
-        if(table_entries > table_entries_used &&
-           get_le32(pb) == MKTAG('T','O','C','2')) {
-            nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t));
-            for(i=0;i<table_entries_used;i++) {
-                nsv->nsvs_timestamps[i] = get_le32(pb);
-            }
-        }
-    }
-
-    PRINT(("NSV got index; filepos %"PRId64"\n", url_ftell(pb)));
-
-#ifdef DEBUG_DUMP_INDEX
-#define V(v) ((v<0x20 || v > 127)?'.':v)
-    /* dump index */
-    PRINT(("NSV %d INDEX ENTRIES:\n", table_entries));
-    PRINT(("NSV [dataoffset][fileoffset]\n", table_entries));
-    for (i = 0; i < table_entries; i++) {
-        unsigned char b[8];
-        url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
-        get_buffer(pb, b, 8);
-        PRINT(("NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
-           "%c%c%c%c%c%c%c%c\n",
-           nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i],
-           b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
-           V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ));
-    }
-    //url_fseek(pb, size, SEEK_SET); /* go back to end of header */
-#undef V
-#endif
-
-    url_fseek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */
-
-    if (url_feof(pb))
-        return -1;
-    nsv->state = NSV_HAS_READ_NSVF;
-    return 0;
-}
-
-static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint32_t vtag, atag;
-    uint16_t vwidth, vheight;
-    AVRational framerate;
-    int i;
-    AVStream *st;
-    NSVStream *nst;
-    PRINT(("%s()\n", __FUNCTION__));
-
-    vtag = get_le32(pb);
-    atag = get_le32(pb);
-    vwidth = get_le16(pb);
-    vheight = get_le16(pb);
-    i = get_byte(pb);
-
-    PRINT(("NSV NSVs framerate code %2x\n", i));
-    if(i&0x80) { /* odd way of giving native framerates from docs */
-        int t=(i & 0x7F)>>2;
-        if(t<16) framerate = (AVRational){1, t+1};
-        else     framerate = (AVRational){t-15, 1};
-
-        if(i&1){
-            framerate.num *= 1000;
-            framerate.den *= 1001;
-        }
-
-        if((i&3)==3)      framerate.num *= 24;
-        else if((i&3)==2) framerate.num *= 25;
-        else              framerate.num *= 30;
-    }
-    else
-        framerate= (AVRational){i, 1};
-
-    nsv->avsync = get_le16(pb);
-    nsv->framerate = framerate;
-#ifdef DEBUG
-    print_tag("NSV NSVs vtag", vtag, 0);
-    print_tag("NSV NSVs atag", atag, 0);
-    PRINT(("NSV NSVs vsize %dx%d\n", vwidth, vheight));
-#endif
-
-    /* XXX change to ap != NULL ? */
-    if (s->nb_streams == 0) { /* streams not yet published, let's do that */
-        nsv->vtag = vtag;
-        nsv->atag = atag;
-        nsv->vwidth = vwidth;
-        nsv->vheight = vwidth;
-        if (vtag != T_NONE) {
-            int i;
-            st = av_new_stream(s, NSV_ST_VIDEO);
-            if (!st)
-                goto fail;
-
-            nst = av_mallocz(sizeof(NSVStream));
-            if (!nst)
-                goto fail;
-            st->priv_data = nst;
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_tag = vtag;
-            st->codec->codec_id = ff_codec_get_id(nsv_codec_video_tags, vtag);
-            st->codec->width = vwidth;
-            st->codec->height = vheight;
-            st->codec->bits_per_coded_sample = 24; /* depth XXX */
-
-            av_set_pts_info(st, 64, framerate.den, framerate.num);
-            st->start_time = 0;
-            st->duration = av_rescale(nsv->duration, framerate.num, 1000*framerate.den);
-
-            for(i=0;i<nsv->index_entries;i++) {
-                if(nsv->nsvs_timestamps) {
-                    av_add_index_entry(st, nsv->nsvs_file_offset[i], nsv->nsvs_timestamps[i],
-                                       0, 0, AVINDEX_KEYFRAME);
-                } else {
-                    int64_t ts = av_rescale(i*nsv->duration/nsv->index_entries, framerate.num, 1000*framerate.den);
-                    av_add_index_entry(st, nsv->nsvs_file_offset[i], ts, 0, 0, AVINDEX_KEYFRAME);
-                }
-            }
-        }
-        if (atag != T_NONE) {
-#ifndef DISABLE_AUDIO
-            st = av_new_stream(s, NSV_ST_AUDIO);
-            if (!st)
-                goto fail;
-
-            nst = av_mallocz(sizeof(NSVStream));
-            if (!nst)
-                goto fail;
-            st->priv_data = nst;
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_tag = atag;
-            st->codec->codec_id = ff_codec_get_id(nsv_codec_audio_tags, atag);
-
-            st->need_parsing = AVSTREAM_PARSE_FULL; /* for PCM we will read a chunk later and put correct info */
-
-            /* set timebase to common denominator of ms and framerate */
-            av_set_pts_info(st, 64, 1, framerate.num*1000);
-            st->start_time = 0;
-            st->duration = (int64_t)nsv->duration * framerate.num;
-#endif
-        }
-#ifdef CHECK_SUBSEQUENT_NSVS
-    } else {
-        if (nsv->vtag != vtag || nsv->atag != atag || nsv->vwidth != vwidth || nsv->vheight != vwidth) {
-            PRINT(("NSV NSVs header values differ from the first one!!!\n"));
-            //return -1;
-        }
-#endif /* CHECK_SUBSEQUENT_NSVS */
-    }
-
-    nsv->state = NSV_HAS_READ_NSVS;
-    return 0;
-fail:
-    /* XXX */
-    nsv->state = NSV_UNSYNC;
-    return -1;
-}
-
-static int nsv_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    NSVContext *nsv = s->priv_data;
-    int i, err;
-
-    PRINT(("%s()\n", __FUNCTION__));
-    PRINT(("filename '%s'\n", s->filename));
-
-    nsv->state = NSV_UNSYNC;
-    nsv->ahead[0].data = nsv->ahead[1].data = NULL;
-
-    for (i = 0; i < NSV_MAX_RESYNC_TRIES; i++) {
-        if (nsv_resync(s) < 0)
-            return -1;
-        if (nsv->state == NSV_FOUND_NSVF)
-            err = nsv_parse_NSVf_header(s, ap);
-            /* we need the first NSVs also... */
-        if (nsv->state == NSV_FOUND_NSVS) {
-            err = nsv_parse_NSVs_header(s, ap);
-            break; /* we just want the first one */
-        }
-    }
-    if (s->nb_streams < 1) /* no luck so far */
-        return -1;
-    /* now read the first chunk, so we can attempt to decode more info */
-    err = nsv_read_chunk(s, 1);
-
-    PRINT(("parsed header\n"));
-    return 0;
-}
-
-static int nsv_read_chunk(AVFormatContext *s, int fill_header)
-{
-    NSVContext *nsv = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st[2] = {NULL, NULL};
-    NSVStream *nst;
-    AVPacket *pkt;
-    int i, err = 0;
-    uint8_t auxcount; /* number of aux metadata, also 4 bits of vsize */
-    uint32_t vsize;
-    uint16_t asize;
-    uint16_t auxsize;
-    uint32_t auxtag;
-
-    PRINT(("%s(%d)\n", __FUNCTION__, fill_header));
-
-    if (nsv->ahead[0].data || nsv->ahead[1].data)
-        return 0; //-1; /* hey! eat what you've in your plate first! */
-
-null_chunk_retry:
-    if (url_feof(pb))
-        return -1;
-
-    for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)
-        err = nsv_resync(s);
-    if (err < 0)
-        return err;
-    if (nsv->state == NSV_FOUND_NSVS)
-        err = nsv_parse_NSVs_header(s, NULL);
-    if (err < 0)
-        return err;
-    if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)
-        return -1;
-
-    auxcount = get_byte(pb);
-    vsize = get_le16(pb);
-    asize = get_le16(pb);
-    vsize = (vsize << 4) | (auxcount >> 4);
-    auxcount &= 0x0f;
-    PRINT(("NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize));
-    /* skip aux stuff */
-    for (i = 0; i < auxcount; i++) {
-        auxsize = get_le16(pb);
-        auxtag = get_le32(pb);
-        PRINT(("NSV aux data: '%c%c%c%c', %d bytes\n",
-              (auxtag & 0x0ff),
-              ((auxtag >> 8) & 0x0ff),
-              ((auxtag >> 16) & 0x0ff),
-              ((auxtag >> 24) & 0x0ff),
-              auxsize));
-        url_fskip(pb, auxsize);
-        vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */
-    }
-
-    if (url_feof(pb))
-        return -1;
-    if (!vsize && !asize) {
-        nsv->state = NSV_UNSYNC;
-        goto null_chunk_retry;
-    }
-
-    /* map back streams to v,a */
-    if (s->streams[0])
-        st[s->streams[0]->id] = s->streams[0];
-    if (s->streams[1])
-        st[s->streams[1]->id] = s->streams[1];
-
-    if (vsize/* && st[NSV_ST_VIDEO]*/) {
-        nst = st[NSV_ST_VIDEO]->priv_data;
-        pkt = &nsv->ahead[NSV_ST_VIDEO];
-        av_get_packet(pb, pkt, vsize);
-        pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO;
-        pkt->dts = nst->frame_offset;
-        pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */
-/*
-        for (i = 0; i < MIN(8, vsize); i++)
-            PRINT(("NSV video: [%d] = %02x\n", i, pkt->data[i]));
-*/
-    }
-    if(st[NSV_ST_VIDEO])
-        ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++;
-
-    if (asize/*st[NSV_ST_AUDIO]*/) {
-        nst = st[NSV_ST_AUDIO]->priv_data;
-        pkt = &nsv->ahead[NSV_ST_AUDIO];
-        /* read raw audio specific header on the first audio chunk... */
-        /* on ALL audio chunks ?? seems so! */
-        if (asize && st[NSV_ST_AUDIO]->codec->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {
-            uint8_t bps;
-            uint8_t channels;
-            uint16_t samplerate;
-            bps = get_byte(pb);
-            channels = get_byte(pb);
-            samplerate = get_le16(pb);
-            asize-=4;
-            PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate));
-            if (fill_header) {
-                st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */
-                if (bps != 16) {
-                    PRINT(("NSV AUDIO bit/sample != 16 (%d)!!!\n", bps));
-                }
-                bps /= channels; // ???
-                if (bps == 8)
-                    st[NSV_ST_AUDIO]->codec->codec_id = CODEC_ID_PCM_U8;
-                samplerate /= 4;/* UGH ??? XXX */
-                channels = 1;
-                st[NSV_ST_AUDIO]->codec->channels = channels;
-                st[NSV_ST_AUDIO]->codec->sample_rate = samplerate;
-                PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate));
-            }
-        }
-        av_get_packet(pb, pkt, asize);
-        pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO;
-        pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */
-        if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) {
-            /* on a nsvs frame we have new information on a/v sync */
-            pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1);
-            pkt->dts *= (int64_t)1000        * nsv->framerate.den;
-            pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num;
-            PRINT(("NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts));
-        }
-        nst->frame_offset++;
-    }
-
-    nsv->state = NSV_UNSYNC;
-    return 0;
-}
-
-
-static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    NSVContext *nsv = s->priv_data;
-    int i, err = 0;
-
-    PRINT(("%s()\n", __FUNCTION__));
-
-    /* in case we don't already have something to eat ... */
-    if (nsv->ahead[0].data == NULL && nsv->ahead[1].data == NULL)
-        err = nsv_read_chunk(s, 0);
-    if (err < 0)
-        return err;
-
-    /* now pick one of the plates */
-    for (i = 0; i < 2; i++) {
-        if (nsv->ahead[i].data) {
-                PRINT(("%s: using cached packet[%d]\n", __FUNCTION__, i));
-            /* avoid the cost of new_packet + memcpy(->data) */
-            memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket));
-            nsv->ahead[i].data = NULL; /* we ate that one */
-            return pkt->size;
-        }
-    }
-
-    /* this restaurant is not approvisionned :^] */
-    return -1;
-}
-
-static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    NSVContext *nsv = s->priv_data;
-    AVStream *st = s->streams[stream_index];
-    NSVStream *nst = st->priv_data;
-    int index;
-
-    index = av_index_search_timestamp(st, timestamp, flags);
-    if(index < 0)
-        return -1;
-
-    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
-    nst->frame_offset = st->index_entries[index].timestamp;
-    nsv->state = NSV_UNSYNC;
-    return 0;
-}
-
-static int nsv_read_close(AVFormatContext *s)
-{
-/*     int i; */
-    NSVContext *nsv = s->priv_data;
-
-    av_freep(&nsv->nsvs_file_offset);
-    av_freep(&nsv->nsvs_timestamps);
-    if (nsv->ahead[0].data)
-        av_free_packet(&nsv->ahead[0]);
-    if (nsv->ahead[1].data)
-        av_free_packet(&nsv->ahead[1]);
-
-#if 0
-
-    for(i=0;i<s->nb_streams;i++) {
-        AVStream *st = s->streams[i];
-        NSVStream *ast = st->priv_data;
-        if(ast){
-            av_free(ast->index_entries);
-            av_free(ast);
-        }
-        av_free(st->codec->palctrl);
-    }
-
-#endif
-    return 0;
-}
-
-static int nsv_probe(AVProbeData *p)
-{
-    int i;
-//    PRINT(("nsv_probe(), buf_size %d\n", p->buf_size));
-    /* check file header */
-    /* streamed files might not have any header */
-    if (p->buf[0] == 'N' && p->buf[1] == 'S' &&
-        p->buf[2] == 'V' && (p->buf[3] == 'f' || p->buf[3] == 's'))
-        return AVPROBE_SCORE_MAX;
-    /* XXX: do streamed files always start at chunk boundary ?? */
-    /* or do we need to search NSVs in the byte stream ? */
-    /* seems the servers don't bother starting clean chunks... */
-    /* sometimes even the first header is at 9KB or something :^) */
-    for (i = 1; i < p->buf_size - 3; i++) {
-        if (p->buf[i+0] == 'N' && p->buf[i+1] == 'S' &&
-            p->buf[i+2] == 'V' && p->buf[i+3] == 's')
-            return AVPROBE_SCORE_MAX-20;
-    }
-    /* so we'll have more luck on extension... */
-    if (av_match_ext(p->filename, "nsv"))
-        return AVPROBE_SCORE_MAX/2;
-    /* FIXME: add mime-type check */
-    return 0;
-}
-
-AVInputFormat nsv_demuxer = {
-    "nsv",
-    NULL_IF_CONFIG_SMALL("Nullsoft Streaming Video"),
-    sizeof(NSVContext),
-    nsv_probe,
-    nsv_read_header,
-    nsv_read_packet,
-    nsv_read_close,
-    nsv_read_seek,
-};
diff --git a/libavformat/nut.c b/libavformat/nut.c
deleted file mode 100644
index 9a6a41b..0000000
--- a/libavformat/nut.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * nut
- * Copyright (c) 2004-2007 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/tree.h"
-#include "nut.h"
-
-const AVCodecTag ff_nut_subtitle_tags[] = {
-    { CODEC_ID_TEXT        , MKTAG('U', 'T', 'F', '8') },
-    { CODEC_ID_SSA         , MKTAG('S', 'S', 'A',  0 ) },
-    { CODEC_ID_DVD_SUBTITLE, MKTAG('D', 'V', 'D', 'S') },
-    { CODEC_ID_DVB_SUBTITLE, MKTAG('D', 'V', 'B', 'S') },
-    { CODEC_ID_NONE        , 0                         }
-};
-
-void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){
-    int i;
-    for(i=0; i<nut->avf->nb_streams; i++){
-        nut->stream[i].last_pts= av_rescale_rnd(
-            val,
-            time_base.num * (int64_t)nut->stream[i].time_base->den,
-            time_base.den * (int64_t)nut->stream[i].time_base->num,
-            AV_ROUND_DOWN);
-    }
-}
-
-int64_t ff_lsb2full(StreamContext *stream, int64_t lsb){
-    int64_t mask = (1<<stream->msb_pts_shift)-1;
-    int64_t delta= stream->last_pts - mask/2;
-    return  ((lsb - delta)&mask) + delta;
-}
-
-int ff_nut_sp_pos_cmp(const Syncpoint *a, const Syncpoint *b){
-    return ((a->pos - b->pos) >> 32) - ((b->pos - a->pos) >> 32);
-}
-
-int ff_nut_sp_pts_cmp(const Syncpoint *a, const Syncpoint *b){
-    return ((a->ts - b->ts) >> 32) - ((b->ts - a->ts) >> 32);
-}
-
-void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts){
-    Syncpoint *sp= av_mallocz(sizeof(Syncpoint));
-    struct AVTreeNode *node= av_mallocz(av_tree_node_size);
-
-    sp->pos= pos;
-    sp->back_ptr= back_ptr;
-    sp->ts= ts;
-    av_tree_insert(&nut->syncpoints, sp, (void *) ff_nut_sp_pos_cmp, &node);
-    if(node){
-        av_free(sp);
-        av_free(node);
-    }
-}
-
-static int enu_free(void *opaque, void *elem)
-{
-    av_free(elem);
-    return 0;
-}
-
-void ff_nut_free_sp(NUTContext *nut)
-{
-    av_tree_enumerate(nut->syncpoints, NULL, NULL, enu_free);
-    av_tree_destroy(nut->syncpoints);
-}
-
-const Dispositions ff_nut_dispositions[] = {
-    {"default"     , AV_DISPOSITION_DEFAULT},
-    {"dub"         , AV_DISPOSITION_DUB},
-    {"original"    , AV_DISPOSITION_ORIGINAL},
-    {"comment"     , AV_DISPOSITION_COMMENT},
-    {"lyrics"      , AV_DISPOSITION_LYRICS},
-    {"karaoke"     , AV_DISPOSITION_KARAOKE},
-    {""            , 0}
-};
-
-const AVMetadataConv ff_nut_metadata_conv[] = {
-    { "Author",         "artist"      },
-    { "X-CreationTime", "date"        },
-    { "CreationTime",   "date"        },
-    { "SourceFilename", "filename"    },
-    { "X-Language",     "language"    },
-    { "X-Disposition",  "disposition" },
-    { "X-Replaces",     "replaces"    },
-    { "X-Depends",      "depends"     },
-    { "X-Uses",         "uses"        },
-    { "X-UsesFont",     "usesfont"    },
-    { 0 },
-};
diff --git a/libavformat/nut.h b/libavformat/nut.h
deleted file mode 100644
index ce052df..0000000
--- a/libavformat/nut.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * "NUT" Container Format (de)muxer
- * Copyright (c) 2006 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_NUT_H
-#define AVFORMAT_NUT_H
-
-//#include <limits.h>
-//#include "libavutil/adler32.h"
-//#include "libavcodec/mpegaudio.h"
-#include "avformat.h"
-#include "riff.h"
-#include "metadata.h"
-
-#define      MAIN_STARTCODE (0x7A561F5F04ADULL + (((uint64_t)('N'<<8) + 'M')<<48))
-#define    STREAM_STARTCODE (0x11405BF2F9DBULL + (((uint64_t)('N'<<8) + 'S')<<48))
-#define SYNCPOINT_STARTCODE (0xE4ADEECA4569ULL + (((uint64_t)('N'<<8) + 'K')<<48))
-#define     INDEX_STARTCODE (0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48))
-#define      INFO_STARTCODE (0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48))
-
-#define ID_STRING "nut/multimedia container\0"
-
-#define MAX_DISTANCE (1024*32-1)
-
-typedef enum{
-    FLAG_KEY        =   1, ///<if set, frame is keyframe
-    FLAG_EOR        =   2, ///<if set, stream has no relevance on presentation. (EOR)
-    FLAG_CODED_PTS  =   8, ///<if set, coded_pts is in the frame header
-    FLAG_STREAM_ID  =  16, ///<if set, stream_id is coded in the frame header
-    FLAG_SIZE_MSB   =  32, ///<if set, data_size_msb is at frame header, otherwise data_size_msb is 0
-    FLAG_CHECKSUM   =  64, ///<if set, the frame header contains a checksum
-    FLAG_RESERVED   = 128, ///<if set, reserved_count is coded in the frame header
-    FLAG_HEADER_IDX =1024, ///<If set, header_idx is coded in the frame header.
-    FLAG_MATCH_TIME =2048, ///<If set, match_time_delta is coded in the frame header
-    FLAG_CODED      =4096, ///<if set, coded_flags are stored in the frame header
-    FLAG_INVALID    =8192, ///<if set, frame_code is invalid
-} Flag;
-
-typedef struct {
-    uint64_t pos;
-    uint64_t back_ptr;
-//    uint64_t global_key_pts;
-    int64_t ts;
-} Syncpoint;
-
-typedef struct {
-    uint16_t flags;
-    uint8_t  stream_id;
-    uint16_t size_mul;
-    uint16_t size_lsb;
-    int16_t  pts_delta;
-    uint8_t  reserved_count;
-    uint8_t  header_idx;
-} FrameCode;
-
-typedef struct {
-    int last_flags;
-    int skip_until_key_frame;
-    int64_t last_pts;
-    int time_base_id;
-    AVRational *time_base;
-    int msb_pts_shift;
-    int max_pts_distance;
-    int decode_delay; //FIXME duplicate of has_b_frames
-} StreamContext;
-
-typedef struct {
-    AVFormatContext *avf;
-//    int written_packet_size;
-//    int64_t packet_start;
-    FrameCode frame_code[256];
-    uint8_t header_len[128];
-    const uint8_t *header[128];
-    uint64_t next_startcode;     ///< stores the next startcode if it has already been parsed but the stream is not seekable
-    StreamContext *stream;
-    unsigned int max_distance;
-    unsigned int time_base_count;
-    int64_t last_syncpoint_pos;
-    int header_count;
-    AVRational *time_base;
-    struct AVTreeNode *syncpoints;
-} NUTContext;
-
-extern const AVCodecTag ff_nut_subtitle_tags[];
-
-typedef struct {
-    char str[9];
-    int flag;
-} Dispositions;
-
-void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val);
-int64_t ff_lsb2full(StreamContext *stream, int64_t lsb);
-int ff_nut_sp_pos_cmp(const Syncpoint *a, const Syncpoint *b);
-int ff_nut_sp_pts_cmp(const Syncpoint *a, const Syncpoint *b);
-void ff_nut_add_sp(NUTContext *nut, int64_t pos, int64_t back_ptr, int64_t ts);
-void ff_nut_free_sp(NUTContext *nut);
-
-extern const Dispositions ff_nut_dispositions[];
-
-extern const AVMetadataConv ff_nut_metadata_conv[];
-
-#endif /* AVFORMAT_NUT_H */
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
deleted file mode 100644
index 5d5cd55..0000000
--- a/libavformat/nutdec.c
+++ /dev/null
@@ -1,928 +0,0 @@
-/*
- * "NUT" Container Format demuxer
- * Copyright (c) 2004-2006 Michael Niedermayer
- * Copyright (c) 2003 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <strings.h>
-#include "libavutil/avstring.h"
-#include "libavutil/bswap.h"
-#include "libavutil/tree.h"
-#include "nut.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){
-    unsigned int len= ff_get_v(bc);
-
-    if(len && maxlen)
-        get_buffer(bc, string, FFMIN(len, maxlen));
-    while(len > maxlen){
-        get_byte(bc);
-        len--;
-    }
-
-    if(maxlen)
-        string[FFMIN(len, maxlen-1)]= 0;
-
-    if(maxlen == len)
-        return -1;
-    else
-        return 0;
-}
-
-static int64_t get_s(ByteIOContext *bc){
-    int64_t v = ff_get_v(bc) + 1;
-
-    if (v&1) return -(v>>1);
-    else     return  (v>>1);
-}
-
-static uint64_t get_fourcc(ByteIOContext *bc){
-    unsigned int len= ff_get_v(bc);
-
-    if     (len==2) return get_le16(bc);
-    else if(len==4) return get_le32(bc);
-    else            return -1;
-}
-
-#ifdef TRACE
-static inline uint64_t get_v_trace(ByteIOContext *bc, char *file, char *func, int line){
-    uint64_t v= ff_get_v(bc);
-
-    av_log(NULL, AV_LOG_DEBUG, "get_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
-    return v;
-}
-
-static inline int64_t get_s_trace(ByteIOContext *bc, char *file, char *func, int line){
-    int64_t v= get_s(bc);
-
-    av_log(NULL, AV_LOG_DEBUG, "get_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
-    return v;
-}
-
-static inline uint64_t get_vb_trace(ByteIOContext *bc, char *file, char *func, int line){
-    uint64_t v= get_vb(bc);
-
-    av_log(NULL, AV_LOG_DEBUG, "get_vb %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
-    return v;
-}
-#define ff_get_v(bc)  get_v_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_s(bc)  get_s_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_vb(bc)  get_vb_trace(bc, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#endif
-
-static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_checksum, uint64_t startcode)
-{
-    int64_t size;
-//    start= url_ftell(bc) - 8;
-
-    startcode= be2me_64(startcode);
-    startcode= ff_crc04C11DB7_update(0, &startcode, 8);
-
-    init_checksum(bc, ff_crc04C11DB7_update, startcode);
-    size= ff_get_v(bc);
-    if(size > 4096)
-        get_be32(bc);
-    if(get_checksum(bc) && size > 4096)
-        return -1;
-
-    init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
-
-    return size;
-}
-
-static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){
-    uint64_t state=0;
-
-    if(pos >= 0)
-        url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
-
-    while(!url_feof(bc)){
-        state= (state<<8) | get_byte(bc);
-        if((state>>56) != 'N')
-            continue;
-        switch(state){
-        case MAIN_STARTCODE:
-        case STREAM_STARTCODE:
-        case SYNCPOINT_STARTCODE:
-        case INFO_STARTCODE:
-        case INDEX_STARTCODE:
-            return state;
-        }
-    }
-
-    return 0;
-}
-
-/**
- * Find the given startcode.
- * @param code the startcode
- * @param pos the start position of the search, or -1 if the current position
- * @return the position of the startcode or -1 if not found
- */
-static int64_t find_startcode(ByteIOContext *bc, uint64_t code, int64_t pos){
-    for(;;){
-        uint64_t startcode= find_any_startcode(bc, pos);
-        if(startcode == code)
-            return url_ftell(bc) - 8;
-        else if(startcode == 0)
-            return -1;
-        pos=-1;
-    }
-}
-
-static int nut_probe(AVProbeData *p){
-    int i;
-    uint64_t code= 0;
-
-    for (i = 0; i < p->buf_size; i++) {
-        code = (code << 8) | p->buf[i];
-        if (code == MAIN_STARTCODE)
-            return AVPROBE_SCORE_MAX;
-    }
-    return 0;
-}
-
-#define GET_V(dst, check) \
-    tmp= ff_get_v(bc);\
-    if(!(check)){\
-        av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp);\
-        return -1;\
-    }\
-    dst= tmp;
-
-static int skip_reserved(ByteIOContext *bc, int64_t pos){
-    pos -= url_ftell(bc);
-    if(pos<0){
-        url_fseek(bc, pos, SEEK_CUR);
-        return -1;
-    }else{
-        while(pos--)
-            get_byte(bc);
-        return 0;
-    }
-}
-
-static int decode_main_header(NUTContext *nut){
-    AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
-    uint64_t tmp, end;
-    unsigned int stream_count;
-    int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res, tmp_head_idx;
-    int64_t tmp_match;
-
-    end= get_packetheader(nut, bc, 1, MAIN_STARTCODE);
-    end += url_ftell(bc);
-
-    GET_V(tmp              , tmp >=2 && tmp <= 3)
-    GET_V(stream_count     , tmp > 0 && tmp <=MAX_STREAMS)
-
-    nut->max_distance = ff_get_v(bc);
-    if(nut->max_distance > 65536){
-        av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance);
-        nut->max_distance= 65536;
-    }
-
-    GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational))
-    nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational));
-
-    for(i=0; i<nut->time_base_count; i++){
-        GET_V(nut->time_base[i].num, tmp>0 && tmp<(1ULL<<31))
-        GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31))
-        if(av_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){
-            av_log(s, AV_LOG_ERROR, "time base invalid\n");
-            return -1;
-        }
-    }
-    tmp_pts=0;
-    tmp_mul=1;
-    tmp_stream=0;
-    tmp_match= 1-(1LL<<62);
-    tmp_head_idx= 0;
-    for(i=0; i<256;){
-        int tmp_flags = ff_get_v(bc);
-        int tmp_fields= ff_get_v(bc);
-        if(tmp_fields>0) tmp_pts   = get_s(bc);
-        if(tmp_fields>1) tmp_mul   = ff_get_v(bc);
-        if(tmp_fields>2) tmp_stream= ff_get_v(bc);
-        if(tmp_fields>3) tmp_size  = ff_get_v(bc);
-        else             tmp_size  = 0;
-        if(tmp_fields>4) tmp_res   = ff_get_v(bc);
-        else             tmp_res   = 0;
-        if(tmp_fields>5) count     = ff_get_v(bc);
-        else             count     = tmp_mul - tmp_size;
-        if(tmp_fields>6) tmp_match = get_s(bc);
-        if(tmp_fields>7) tmp_head_idx= ff_get_v(bc);
-
-        while(tmp_fields-- > 8)
-           ff_get_v(bc);
-
-        if(count == 0 || i+count > 256){
-            av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i);
-            return -1;
-        }
-        if(tmp_stream >= stream_count){
-            av_log(s, AV_LOG_ERROR, "illegal stream number\n");
-            return -1;
-        }
-
-        for(j=0; j<count; j++,i++){
-            if (i == 'N') {
-                nut->frame_code[i].flags= FLAG_INVALID;
-                j--;
-                continue;
-            }
-            nut->frame_code[i].flags           = tmp_flags ;
-            nut->frame_code[i].pts_delta       = tmp_pts   ;
-            nut->frame_code[i].stream_id       = tmp_stream;
-            nut->frame_code[i].size_mul        = tmp_mul   ;
-            nut->frame_code[i].size_lsb        = tmp_size+j;
-            nut->frame_code[i].reserved_count  = tmp_res   ;
-            nut->frame_code[i].header_idx      = tmp_head_idx;
-        }
-    }
-    assert(nut->frame_code['N'].flags == FLAG_INVALID);
-
-    if(end > url_ftell(bc) + 4){
-        int rem= 1024;
-        GET_V(nut->header_count, tmp<128U)
-        nut->header_count++;
-        for(i=1; i<nut->header_count; i++){
-            GET_V(nut->header_len[i], tmp>0 && tmp<256);
-            rem -= nut->header_len[i];
-            if(rem < 0){
-                av_log(s, AV_LOG_ERROR, "invalid elision header\n");
-                return -1;
-            }
-            nut->header[i]= av_malloc(nut->header_len[i]);
-            get_buffer(bc, nut->header[i], nut->header_len[i]);
-        }
-        assert(nut->header_len[0]==0);
-    }
-
-    if(skip_reserved(bc, end) || get_checksum(bc)){
-        av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n");
-        return -1;
-    }
-
-    nut->stream = av_mallocz(sizeof(StreamContext)*stream_count);
-    for(i=0; i<stream_count; i++){
-        av_new_stream(s, i);
-    }
-
-    return 0;
-}
-
-static int decode_stream_header(NUTContext *nut){
-    AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
-    StreamContext *stc;
-    int class, stream_id;
-    uint64_t tmp, end;
-    AVStream *st;
-
-    end= get_packetheader(nut, bc, 1, STREAM_STARTCODE);
-    end += url_ftell(bc);
-
-    GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base);
-    stc= &nut->stream[stream_id];
-
-    st = s->streams[stream_id];
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    class = ff_get_v(bc);
-    tmp = get_fourcc(bc);
-    st->codec->codec_tag= tmp;
-    switch(class)
-    {
-        case 0:
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tmp);
-            break;
-        case 1:
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, tmp);
-            break;
-        case 2:
-            st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-            st->codec->codec_id = ff_codec_get_id(ff_nut_subtitle_tags, tmp);
-            break;
-        case 3:
-            st->codec->codec_type = AVMEDIA_TYPE_DATA;
-            break;
-        default:
-            av_log(s, AV_LOG_ERROR, "unknown stream class (%d)\n", class);
-            return -1;
-    }
-    if(class<3 && st->codec->codec_id == CODEC_ID_NONE)
-        av_log(s, AV_LOG_ERROR, "Unknown codec tag '0x%04x' for stream number %d\n",
-               (unsigned int)tmp, stream_id);
-
-    GET_V(stc->time_base_id    , tmp < nut->time_base_count);
-    GET_V(stc->msb_pts_shift   , tmp < 16);
-    stc->max_pts_distance= ff_get_v(bc);
-    GET_V(stc->decode_delay    , tmp < 1000); //sanity limit, raise this if Moore's law is true
-    st->codec->has_b_frames= stc->decode_delay;
-    ff_get_v(bc); //stream flags
-
-    GET_V(st->codec->extradata_size, tmp < (1<<30));
-    if(st->codec->extradata_size){
-        st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-        get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
-    }
-
-    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
-        GET_V(st->codec->width , tmp > 0)
-        GET_V(st->codec->height, tmp > 0)
-        st->sample_aspect_ratio.num= ff_get_v(bc);
-        st->sample_aspect_ratio.den= ff_get_v(bc);
-        if((!st->sample_aspect_ratio.num) != (!st->sample_aspect_ratio.den)){
-            av_log(s, AV_LOG_ERROR, "invalid aspect ratio %d/%d\n", st->sample_aspect_ratio.num, st->sample_aspect_ratio.den);
-            return -1;
-        }
-        ff_get_v(bc); /* csp type */
-    }else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO){
-        GET_V(st->codec->sample_rate , tmp > 0)
-        ff_get_v(bc); // samplerate_den
-        GET_V(st->codec->channels, tmp > 0)
-    }
-    if(skip_reserved(bc, end) || get_checksum(bc)){
-        av_log(s, AV_LOG_ERROR, "stream header %d checksum mismatch\n", stream_id);
-        return -1;
-    }
-    stc->time_base= &nut->time_base[stc->time_base_id];
-    av_set_pts_info(s->streams[stream_id], 63, stc->time_base->num, stc->time_base->den);
-    return 0;
-}
-
-static void set_disposition_bits(AVFormatContext* avf, char* value, int stream_id){
-    int flag = 0, i;
-    for (i=0; ff_nut_dispositions[i].flag; ++i) {
-        if (!strcmp(ff_nut_dispositions[i].str, value))
-            flag = ff_nut_dispositions[i].flag;
-    }
-    if (!flag)
-        av_log(avf, AV_LOG_INFO, "unknown disposition type '%s'\n", value);
-    for (i = 0; i < avf->nb_streams; ++i)
-        if (stream_id == i || stream_id == -1)
-            avf->streams[i]->disposition |= flag;
-}
-
-static int decode_info_header(NUTContext *nut){
-    AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
-    uint64_t tmp, chapter_start, chapter_len;
-    unsigned int stream_id_plus1, count;
-    int chapter_id, i;
-    int64_t value, end;
-    char name[256], str_value[1024], type_str[256];
-    const char *type;
-    AVChapter *chapter= NULL;
-    AVStream *st= NULL;
-
-    end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
-    end += url_ftell(bc);
-
-    GET_V(stream_id_plus1, tmp <= s->nb_streams)
-    chapter_id   = get_s(bc);
-    chapter_start= ff_get_v(bc);
-    chapter_len  = ff_get_v(bc);
-    count        = ff_get_v(bc);
-
-    if(chapter_id && !stream_id_plus1){
-        int64_t start= chapter_start / nut->time_base_count;
-        chapter= ff_new_chapter(s, chapter_id,
-                                nut->time_base[chapter_start % nut->time_base_count],
-                                start, start + chapter_len, NULL);
-    } else if(stream_id_plus1)
-        st= s->streams[stream_id_plus1 - 1];
-
-    for(i=0; i<count; i++){
-        get_str(bc, name, sizeof(name));
-        value= get_s(bc);
-        if(value == -1){
-            type= "UTF-8";
-            get_str(bc, str_value, sizeof(str_value));
-        }else if(value == -2){
-            get_str(bc, type_str, sizeof(type_str));
-            type= type_str;
-            get_str(bc, str_value, sizeof(str_value));
-        }else if(value == -3){
-            type= "s";
-            value= get_s(bc);
-        }else if(value == -4){
-            type= "t";
-            value= ff_get_v(bc);
-        }else if(value < -4){
-            type= "r";
-            get_s(bc);
-        }else{
-            type= "v";
-        }
-
-        if (stream_id_plus1 > s->nb_streams) {
-            av_log(s, AV_LOG_ERROR, "invalid stream id for info packet\n");
-            continue;
-        }
-
-        if(!strcmp(type, "UTF-8")){
-            AVMetadata **metadata = NULL;
-            if(chapter_id==0 && !strcmp(name, "Disposition"))
-                set_disposition_bits(s, str_value, stream_id_plus1 - 1);
-            else if(chapter)          metadata= &chapter->metadata;
-            else if(stream_id_plus1)  metadata= &st->metadata;
-            else                      metadata= &s->metadata;
-            if(metadata && strcasecmp(name,"Uses")
-               && strcasecmp(name,"Depends") && strcasecmp(name,"Replaces"))
-                av_metadata_set2(metadata, name, str_value, 0);
-        }
-    }
-
-    if(skip_reserved(bc, end) || get_checksum(bc)){
-        av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
-        return -1;
-    }
-    return 0;
-}
-
-static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
-    AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
-    int64_t end, tmp;
-
-    nut->last_syncpoint_pos= url_ftell(bc)-8;
-
-    end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
-    end += url_ftell(bc);
-
-    tmp= ff_get_v(bc);
-    *back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc);
-    if(*back_ptr < 0)
-        return -1;
-
-    ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count);
-
-    if(skip_reserved(bc, end) || get_checksum(bc)){
-        av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
-        return -1;
-    }
-
-    *ts= tmp / s->nb_streams * av_q2d(nut->time_base[tmp % s->nb_streams])*AV_TIME_BASE;
-    ff_nut_add_sp(nut, nut->last_syncpoint_pos, *back_ptr, *ts);
-
-    return 0;
-}
-
-static int find_and_decode_index(NUTContext *nut){
-    AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
-    uint64_t tmp, end;
-    int i, j, syncpoint_count;
-    int64_t filesize= url_fsize(bc);
-    int64_t *syncpoints;
-    int8_t *has_keyframe;
-    int ret= -1;
-
-    url_fseek(bc, filesize-12, SEEK_SET);
-    url_fseek(bc, filesize-get_be64(bc), SEEK_SET);
-    if(get_be64(bc) != INDEX_STARTCODE){
-        av_log(s, AV_LOG_ERROR, "no index at the end\n");
-        return -1;
-    }
-
-    end= get_packetheader(nut, bc, 1, INDEX_STARTCODE);
-    end += url_ftell(bc);
-
-    ff_get_v(bc); //max_pts
-    GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0)
-    syncpoints= av_malloc(sizeof(int64_t)*syncpoint_count);
-    has_keyframe= av_malloc(sizeof(int8_t)*(syncpoint_count+1));
-    for(i=0; i<syncpoint_count; i++){
-        syncpoints[i] = ff_get_v(bc);
-        if(syncpoints[i] <= 0)
-            goto fail;
-        if(i)
-            syncpoints[i] += syncpoints[i-1];
-    }
-
-    for(i=0; i<s->nb_streams; i++){
-        int64_t last_pts= -1;
-        for(j=0; j<syncpoint_count;){
-            uint64_t x= ff_get_v(bc);
-            int type= x&1;
-            int n= j;
-            x>>=1;
-            if(type){
-                int flag= x&1;
-                x>>=1;
-                if(n+x >= syncpoint_count + 1){
-                    av_log(s, AV_LOG_ERROR, "index overflow A\n");
-                    goto fail;
-                }
-                while(x--)
-                    has_keyframe[n++]= flag;
-                has_keyframe[n++]= !flag;
-            }else{
-                while(x != 1){
-                    if(n>=syncpoint_count + 1){
-                        av_log(s, AV_LOG_ERROR, "index overflow B\n");
-                        goto fail;
-                    }
-                    has_keyframe[n++]= x&1;
-                    x>>=1;
-                }
-            }
-            if(has_keyframe[0]){
-                av_log(s, AV_LOG_ERROR, "keyframe before first syncpoint in index\n");
-                goto fail;
-            }
-            assert(n<=syncpoint_count+1);
-            for(; j<n && j<syncpoint_count; j++){
-                if(has_keyframe[j]){
-                    uint64_t B, A= ff_get_v(bc);
-                    if(!A){
-                        A= ff_get_v(bc);
-                        B= ff_get_v(bc);
-                        //eor_pts[j][i] = last_pts + A + B
-                    }else
-                        B= 0;
-                    av_add_index_entry(
-                        s->streams[i],
-                        16*syncpoints[j-1],
-                        last_pts + A,
-                        0,
-                        0,
-                        AVINDEX_KEYFRAME);
-                    last_pts += A + B;
-                }
-            }
-        }
-    }
-
-    if(skip_reserved(bc, end) || get_checksum(bc)){
-        av_log(s, AV_LOG_ERROR, "index checksum mismatch\n");
-        goto fail;
-    }
-    ret= 0;
-fail:
-    av_free(syncpoints);
-    av_free(has_keyframe);
-    return ret;
-}
-
-static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
-    int64_t pos;
-    int initialized_stream_count;
-
-    nut->avf= s;
-
-    /* main header */
-    pos=0;
-    do{
-        pos= find_startcode(bc, MAIN_STARTCODE, pos)+1;
-        if (pos<0+1){
-            av_log(s, AV_LOG_ERROR, "No main startcode found.\n");
-            return -1;
-        }
-    }while(decode_main_header(nut) < 0);
-
-    /* stream headers */
-    pos=0;
-    for(initialized_stream_count=0; initialized_stream_count < s->nb_streams;){
-        pos= find_startcode(bc, STREAM_STARTCODE, pos)+1;
-        if (pos<0+1){
-            av_log(s, AV_LOG_ERROR, "Not all stream headers found.\n");
-            return -1;
-        }
-        if(decode_stream_header(nut) >= 0)
-            initialized_stream_count++;
-    }
-
-    /* info headers */
-    pos=0;
-    for(;;){
-        uint64_t startcode= find_any_startcode(bc, pos);
-        pos= url_ftell(bc);
-
-        if(startcode==0){
-            av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
-            return -1;
-        }else if(startcode == SYNCPOINT_STARTCODE){
-            nut->next_startcode= startcode;
-            break;
-        }else if(startcode != INFO_STARTCODE){
-            continue;
-        }
-
-        decode_info_header(nut);
-    }
-
-    s->data_offset= pos-8;
-
-    if(!url_is_streamed(bc)){
-        int64_t orig_pos= url_ftell(bc);
-        find_and_decode_index(nut);
-        url_fseek(bc, orig_pos, SEEK_SET);
-    }
-    assert(nut->next_startcode == SYNCPOINT_STARTCODE);
-
-    return 0;
-}
-
-static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code){
-    AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
-    StreamContext *stc;
-    int size, flags, size_mul, pts_delta, i, reserved_count;
-    uint64_t tmp;
-
-    if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
-        av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut->last_syncpoint_pos, nut->max_distance);
-        return -1;
-    }
-
-    flags          = nut->frame_code[frame_code].flags;
-    size_mul       = nut->frame_code[frame_code].size_mul;
-    size           = nut->frame_code[frame_code].size_lsb;
-    *stream_id     = nut->frame_code[frame_code].stream_id;
-    pts_delta      = nut->frame_code[frame_code].pts_delta;
-    reserved_count = nut->frame_code[frame_code].reserved_count;
-    *header_idx    = nut->frame_code[frame_code].header_idx;
-
-    if(flags & FLAG_INVALID)
-        return -1;
-    if(flags & FLAG_CODED)
-        flags ^= ff_get_v(bc);
-    if(flags & FLAG_STREAM_ID){
-        GET_V(*stream_id, tmp < s->nb_streams)
-    }
-    stc= &nut->stream[*stream_id];
-    if(flags&FLAG_CODED_PTS){
-        int coded_pts= ff_get_v(bc);
-//FIXME check last_pts validity?
-        if(coded_pts < (1<<stc->msb_pts_shift)){
-            *pts=ff_lsb2full(stc, coded_pts);
-        }else
-            *pts=coded_pts - (1<<stc->msb_pts_shift);
-    }else
-        *pts= stc->last_pts + pts_delta;
-    if(flags&FLAG_SIZE_MSB){
-        size += size_mul*ff_get_v(bc);
-    }
-    if(flags&FLAG_MATCH_TIME)
-        get_s(bc);
-    if(flags&FLAG_HEADER_IDX)
-        *header_idx= ff_get_v(bc);
-    if(flags&FLAG_RESERVED)
-        reserved_count= ff_get_v(bc);
-    for(i=0; i<reserved_count; i++)
-        ff_get_v(bc);
-
-    if(*header_idx >= (unsigned)nut->header_count){
-        av_log(s, AV_LOG_ERROR, "header_idx invalid\n");
-        return -1;
-    }
-    if(size > 4096)
-        *header_idx=0;
-    size -= nut->header_len[*header_idx];
-
-    if(flags&FLAG_CHECKSUM){
-        get_be32(bc); //FIXME check this
-    }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
-        av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n");
-        return -1;
-    }
-
-    stc->last_pts= *pts;
-    stc->last_flags= flags;
-
-    return size;
-}
-
-static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
-    AVFormatContext *s= nut->avf;
-    ByteIOContext *bc = s->pb;
-    int size, stream_id, discard;
-    int64_t pts, last_IP_pts;
-    StreamContext *stc;
-    uint8_t header_idx;
-
-    size= decode_frame_header(nut, &pts, &stream_id, &header_idx, frame_code);
-    if(size < 0)
-        return -1;
-
-    stc= &nut->stream[stream_id];
-
-    if (stc->last_flags & FLAG_KEY)
-        stc->skip_until_key_frame=0;
-
-    discard= s->streams[ stream_id ]->discard;
-    last_IP_pts= s->streams[ stream_id ]->last_IP_pts;
-    if(  (discard >= AVDISCARD_NONKEY && !(stc->last_flags & FLAG_KEY))
-       ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
-       || discard >= AVDISCARD_ALL
-       || stc->skip_until_key_frame){
-        url_fskip(bc, size);
-        return 1;
-    }
-
-    av_new_packet(pkt, size + nut->header_len[header_idx]);
-    memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
-    pkt->pos= url_ftell(bc); //FIXME
-    get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
-
-    pkt->stream_index = stream_id;
-    if (stc->last_flags & FLAG_KEY)
-        pkt->flags |= AV_PKT_FLAG_KEY;
-    pkt->pts = pts;
-
-    return 0;
-}
-
-static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
-    int i, frame_code=0, ret, skip;
-    int64_t ts, back_ptr;
-
-    for(;;){
-        int64_t pos= url_ftell(bc);
-        uint64_t tmp= nut->next_startcode;
-        nut->next_startcode=0;
-
-        if(tmp){
-            pos-=8;
-        }else{
-            frame_code = get_byte(bc);
-            if(url_feof(bc))
-                return -1;
-            if(frame_code == 'N'){
-                tmp= frame_code;
-                for(i=1; i<8; i++)
-                    tmp = (tmp<<8) + get_byte(bc);
-            }
-        }
-        switch(tmp){
-        case MAIN_STARTCODE:
-        case STREAM_STARTCODE:
-        case INDEX_STARTCODE:
-            skip= get_packetheader(nut, bc, 0, tmp);
-            url_fseek(bc, skip, SEEK_CUR);
-            break;
-        case INFO_STARTCODE:
-            if(decode_info_header(nut)<0)
-                goto resync;
-            break;
-        case SYNCPOINT_STARTCODE:
-            if(decode_syncpoint(nut, &ts, &back_ptr)<0)
-                goto resync;
-            frame_code = get_byte(bc);
-        case 0:
-            ret= decode_frame(nut, pkt, frame_code);
-            if(ret==0)
-                return 0;
-            else if(ret==1) //ok but discard packet
-                break;
-        default:
-resync:
-av_log(s, AV_LOG_DEBUG, "syncing from %"PRId64"\n", pos);
-            tmp= find_any_startcode(bc, nut->last_syncpoint_pos+1);
-            if(tmp==0)
-                return -1;
-av_log(s, AV_LOG_DEBUG, "sync\n");
-            nut->next_startcode= tmp;
-        }
-    }
-}
-
-static int64_t nut_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit){
-    NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
-    int64_t pos, pts, back_ptr;
-av_log(s, AV_LOG_DEBUG, "read_timestamp(X,%d,%"PRId64",%"PRId64")\n", stream_index, *pos_arg, pos_limit);
-
-    pos= *pos_arg;
-    do{
-        pos= find_startcode(bc, SYNCPOINT_STARTCODE, pos)+1;
-        if(pos < 1){
-            assert(nut->next_startcode == 0);
-            av_log(s, AV_LOG_ERROR, "read_timestamp failed.\n");
-            return AV_NOPTS_VALUE;
-        }
-    }while(decode_syncpoint(nut, &pts, &back_ptr) < 0);
-    *pos_arg = pos-1;
-    assert(nut->last_syncpoint_pos == *pos_arg);
-
-    av_log(s, AV_LOG_DEBUG, "return %"PRId64" %"PRId64"\n", pts,back_ptr );
-    if     (stream_index == -1) return pts;
-    else if(stream_index == -2) return back_ptr;
-
-assert(0);
-}
-
-static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags){
-    NUTContext *nut = s->priv_data;
-    AVStream *st= s->streams[stream_index];
-    Syncpoint dummy={.ts= pts*av_q2d(st->time_base)*AV_TIME_BASE};
-    Syncpoint nopts_sp= {.ts= AV_NOPTS_VALUE, .back_ptr= AV_NOPTS_VALUE};
-    Syncpoint *sp, *next_node[2]= {&nopts_sp, &nopts_sp};
-    int64_t pos, pos2, ts;
-    int i;
-
-    if(st->index_entries){
-        int index= av_index_search_timestamp(st, pts, flags);
-        if(index<0)
-            return -1;
-
-        pos2= st->index_entries[index].pos;
-        ts  = st->index_entries[index].timestamp;
-    }else{
-        av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pts_cmp,
-                     (void **) next_node);
-        av_log(s, AV_LOG_DEBUG, "%"PRIu64"-%"PRIu64" %"PRId64"-%"PRId64"\n", next_node[0]->pos, next_node[1]->pos,
-                                                    next_node[0]->ts , next_node[1]->ts);
-        pos= av_gen_search(s, -1, dummy.ts, next_node[0]->pos, next_node[1]->pos, next_node[1]->pos,
-                                            next_node[0]->ts , next_node[1]->ts, AVSEEK_FLAG_BACKWARD, &ts, nut_read_timestamp);
-
-        if(!(flags & AVSEEK_FLAG_BACKWARD)){
-            dummy.pos= pos+16;
-            next_node[1]= &nopts_sp;
-            av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
-                         (void **) next_node);
-            pos2= av_gen_search(s, -2, dummy.pos, next_node[0]->pos     , next_node[1]->pos, next_node[1]->pos,
-                                                next_node[0]->back_ptr, next_node[1]->back_ptr, flags, &ts, nut_read_timestamp);
-            if(pos2>=0)
-                pos= pos2;
-            //FIXME dir but I think it does not matter
-        }
-        dummy.pos= pos;
-        sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
-                         NULL);
-
-        assert(sp);
-        pos2= sp->back_ptr  - 15;
-    }
-    av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
-    pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
-    url_fseek(s->pb, pos, SEEK_SET);
-    av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
-    if(pos2 > pos || pos2 + 15 < pos){
-        av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
-    }
-    for(i=0; i<s->nb_streams; i++)
-        nut->stream[i].skip_until_key_frame=1;
-
-    return 0;
-}
-
-static int nut_read_close(AVFormatContext *s)
-{
-    NUTContext *nut = s->priv_data;
-    int i;
-
-    av_freep(&nut->time_base);
-    av_freep(&nut->stream);
-    ff_nut_free_sp(nut);
-    for(i = 1; i < nut->header_count; i++)
-        av_freep(&nut->header[i]);
-
-    return 0;
-}
-
-#if CONFIG_NUT_DEMUXER
-AVInputFormat nut_demuxer = {
-    "nut",
-    NULL_IF_CONFIG_SMALL("NUT format"),
-    sizeof(NUTContext),
-    nut_probe,
-    nut_read_header,
-    nut_read_packet,
-    nut_read_close,
-    read_seek,
-    .extensions = "nut",
-    .metadata_conv = ff_nut_metadata_conv,
-};
-#endif
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
deleted file mode 100644
index dfda3ca..0000000
--- a/libavformat/nutenc.c
+++ /dev/null
@@ -1,828 +0,0 @@
-/*
- * nut muxer
- * Copyright (c) 2004-2007 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "libavutil/tree.h"
-#include "libavcodec/mpegaudiodata.h"
-#include "nut.h"
-
-static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){
-    int sample_rate= c->sample_rate;
-
-    if(size>4096)
-        return 0;
-
-    AV_WB24(out, 1);
-
-    if(c->codec_id == CODEC_ID_MPEG4){
-        if(key_frame){
-            return 3;
-        }else{
-            out[3]= 0xB6;
-            return 4;
-        }
-    }else if(c->codec_id == CODEC_ID_MPEG1VIDEO || c->codec_id == CODEC_ID_MPEG2VIDEO){
-        return 3;
-    }else if(c->codec_id == CODEC_ID_H264){
-        return 3;
-    }else if(c->codec_id == CODEC_ID_MP3 || c->codec_id == CODEC_ID_MP2){
-        int lsf, mpeg25, sample_rate_index, bitrate_index, frame_size;
-        int layer= c->codec_id == CODEC_ID_MP3 ? 3 : 2;
-        unsigned int header= 0xFFF00000;
-
-        lsf     = sample_rate < (24000+32000)/2;
-        mpeg25  = sample_rate < (12000+16000)/2;
-        sample_rate <<= lsf + mpeg25;
-        if     (sample_rate < (32000 + 44100)/2) sample_rate_index=2;
-        else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0;
-        else                                     sample_rate_index=1;
-
-        sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
-
-        for(bitrate_index=2; bitrate_index<30; bitrate_index++){
-            frame_size = ff_mpa_bitrate_tab[lsf][layer-1][bitrate_index>>1];
-            frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
-
-            if(frame_size == size)
-                break;
-        }
-
-        header |= (!lsf)<<19;
-        header |= (4-layer)<<17;
-        header |= 1<<16; //no crc
-        AV_WB32(out, header);
-        if(size <= 0)
-            return 2; //we guess there is no crc, if there is one the user clearly does not care about overhead
-        if(bitrate_index == 30)
-            return -1; //something is wrong ...
-
-        header |= (bitrate_index>>1)<<12;
-        header |= sample_rate_index<<10;
-        header |= (bitrate_index&1)<<9;
-
-        return 2; //FIXME actually put the needed ones in build_elision_headers()
-        return 3; //we guess that the private bit is not set
-//FIXME the above assumptions should be checked, if these turn out false too often something should be done
-    }
-    return 0;
-}
-
-static int find_header_idx(AVFormatContext *s, AVCodecContext *c, int size, int frame_type){
-    NUTContext *nut = s->priv_data;
-    uint8_t out[64];
-    int i;
-    int len= find_expected_header(c, size, frame_type, out);
-
-//av_log(NULL, AV_LOG_ERROR, "expected_h len=%d size=%d codec_id=%d\n", len, size, c->codec_id);
-
-    for(i=1; i<nut->header_count; i++){
-        if(   len == nut->header_len[i]
-           && !memcmp(out, nut->header[i], len)){
-//    av_log(NULL, AV_LOG_ERROR, "found %d\n", i);
-            return i;
-        }
-    }
-//    av_log(NULL, AV_LOG_ERROR, "nothing found\n");
-    return 0;
-}
-
-static void build_elision_headers(AVFormatContext *s){
-    NUTContext *nut = s->priv_data;
-    int i;
-    //FIXME this is lame
-    //FIXME write a 2pass mode to find the maximal headers
-    static const uint8_t headers[][5]={
-        {3, 0x00, 0x00, 0x01},
-        {4, 0x00, 0x00, 0x01, 0xB6},
-        {2, 0xFF, 0xFA}, //mp3+crc
-        {2, 0xFF, 0xFB}, //mp3
-        {2, 0xFF, 0xFC}, //mp2+crc
-        {2, 0xFF, 0xFD}, //mp2
-    };
-
-    nut->header_count= 7;
-    for(i=1; i<nut->header_count; i++){
-        nut->header_len[i]=  headers[i-1][0];
-        nut->header    [i]= &headers[i-1][1];
-    }
-}
-
-static void build_frame_code(AVFormatContext *s){
-    NUTContext *nut = s->priv_data;
-    int key_frame, index, pred, stream_id;
-    int start=1;
-    int end= 254;
-    int keyframe_0_esc= s->nb_streams > 2;
-    int pred_table[10];
-    FrameCode *ft;
-
-    ft= &nut->frame_code[start];
-    ft->flags= FLAG_CODED;
-    ft->size_mul=1;
-    ft->pts_delta=1;
-    start++;
-
-    if(keyframe_0_esc){
-        /* keyframe = 0 escape */
-        FrameCode *ft= &nut->frame_code[start];
-        ft->flags= FLAG_STREAM_ID | FLAG_SIZE_MSB | FLAG_CODED_PTS;
-        ft->size_mul=1;
-        start++;
-    }
-
-    for(stream_id= 0; stream_id<s->nb_streams; stream_id++){
-        int start2= start + (end-start)*stream_id / s->nb_streams;
-        int end2  = start + (end-start)*(stream_id+1) / s->nb_streams;
-        AVCodecContext *codec = s->streams[stream_id]->codec;
-        int is_audio= codec->codec_type == AVMEDIA_TYPE_AUDIO;
-        int intra_only= /*codec->intra_only || */is_audio;
-        int pred_count;
-
-        for(key_frame=0; key_frame<2; key_frame++){
-            if(intra_only && keyframe_0_esc && key_frame==0)
-                continue;
-
-            {
-                FrameCode *ft= &nut->frame_code[start2];
-                ft->flags= FLAG_KEY*key_frame;
-                ft->flags|= FLAG_SIZE_MSB | FLAG_CODED_PTS;
-                ft->stream_id= stream_id;
-                ft->size_mul=1;
-                if(is_audio)
-                    ft->header_idx= find_header_idx(s, codec, -1, key_frame);
-                start2++;
-            }
-        }
-
-        key_frame= intra_only;
-#if 1
-        if(is_audio){
-            int frame_bytes= codec->frame_size*(int64_t)codec->bit_rate / (8*codec->sample_rate);
-            int pts;
-            for(pts=0; pts<2; pts++){
-                for(pred=0; pred<2; pred++){
-                    FrameCode *ft= &nut->frame_code[start2];
-                    ft->flags= FLAG_KEY*key_frame;
-                    ft->stream_id= stream_id;
-                    ft->size_mul=frame_bytes + 2;
-                    ft->size_lsb=frame_bytes + pred;
-                    ft->pts_delta=pts;
-                    ft->header_idx= find_header_idx(s, codec, frame_bytes + pred, key_frame);
-                    start2++;
-                }
-            }
-        }else{
-            FrameCode *ft= &nut->frame_code[start2];
-            ft->flags= FLAG_KEY | FLAG_SIZE_MSB;
-            ft->stream_id= stream_id;
-            ft->size_mul=1;
-            ft->pts_delta=1;
-            start2++;
-        }
-#endif
-
-        if(codec->has_b_frames){
-            pred_count=5;
-            pred_table[0]=-2;
-            pred_table[1]=-1;
-            pred_table[2]=1;
-            pred_table[3]=3;
-            pred_table[4]=4;
-        }else if(codec->codec_id == CODEC_ID_VORBIS){
-            pred_count=3;
-            pred_table[0]=2;
-            pred_table[1]=9;
-            pred_table[2]=16;
-        }else{
-            pred_count=1;
-            pred_table[0]=1;
-        }
-
-        for(pred=0; pred<pred_count; pred++){
-            int start3= start2 + (end2-start2)*pred / pred_count;
-            int end3  = start2 + (end2-start2)*(pred+1) / pred_count;
-
-            for(index=start3; index<end3; index++){
-                FrameCode *ft= &nut->frame_code[index];
-                ft->flags= FLAG_KEY*key_frame;
-                ft->flags|= FLAG_SIZE_MSB;
-                ft->stream_id= stream_id;
-//FIXME use single byte size and pred from last
-                ft->size_mul= end3-start3;
-                ft->size_lsb= index - start3;
-                ft->pts_delta= pred_table[pred];
-                if(is_audio)
-                    ft->header_idx= find_header_idx(s, codec, -1, key_frame);
-            }
-        }
-    }
-    memmove(&nut->frame_code['N'+1], &nut->frame_code['N'], sizeof(FrameCode)*(255-'N'));
-    nut->frame_code[  0].flags=
-    nut->frame_code[255].flags=
-    nut->frame_code['N'].flags= FLAG_INVALID;
-}
-
-/**
- * Gets the length in bytes which is needed to store val as v.
- */
-static int get_length(uint64_t val){
-    int i=1;
-
-    while(val>>=7)
-        i++;
-
-    return i;
-}
-
-static void put_v(ByteIOContext *bc, uint64_t val){
-    int i= get_length(val);
-
-    while(--i>0)
-        put_byte(bc, 128 | (val>>(7*i)));
-
-    put_byte(bc, val&127);
-}
-
-static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){
-    val *= nut->time_base_count;
-    val += nus->time_base - nut->time_base;
-    put_v(bc, val);
-}
-
-/**
- * Stores a string as vb.
- */
-static void put_str(ByteIOContext *bc, const char *string){
-    int len= strlen(string);
-
-    put_v(bc, len);
-    put_buffer(bc, string, len);
-}
-
-static void put_s(ByteIOContext *bc, int64_t val){
-    put_v(bc, 2*FFABS(val) - (val>0));
-}
-
-#ifdef TRACE
-static inline void put_v_trace(ByteIOContext *bc, uint64_t v, char *file, char *func, int line){
-    av_log(NULL, AV_LOG_DEBUG, "put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
-
-    put_v(bc, v);
-}
-
-static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *func, int line){
-    av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line);
-
-    put_s(bc, v);
-}
-#define put_v(bc, v)  put_v_trace(bc, v, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define put_s(bc, v)  put_s_trace(bc, v, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#endif
-
-//FIXME remove calculate_checksum
-static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){
-    uint8_t *dyn_buf=NULL;
-    int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
-    int forw_ptr= dyn_size + 4*calculate_checksum;
-
-    if(forw_ptr > 4096)
-        init_checksum(bc, ff_crc04C11DB7_update, 0);
-    put_be64(bc, startcode);
-    put_v(bc, forw_ptr);
-    if(forw_ptr > 4096)
-        put_le32(bc, get_checksum(bc));
-
-    if(calculate_checksum)
-        init_checksum(bc, ff_crc04C11DB7_update, 0);
-    put_buffer(bc, dyn_buf, dyn_size);
-    if(calculate_checksum)
-        put_le32(bc, get_checksum(bc));
-
-    av_free(dyn_buf);
-}
-
-static void write_mainheader(NUTContext *nut, ByteIOContext *bc){
-    int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx;
-    int64_t tmp_match;
-
-    put_v(bc, 3); /* version */
-    put_v(bc, nut->avf->nb_streams);
-    put_v(bc, nut->max_distance);
-    put_v(bc, nut->time_base_count);
-
-    for(i=0; i<nut->time_base_count; i++){
-        put_v(bc, nut->time_base[i].num);
-        put_v(bc, nut->time_base[i].den);
-    }
-
-    tmp_pts=0;
-    tmp_mul=1;
-    tmp_stream=0;
-    tmp_match= 1-(1LL<<62);
-    tmp_head_idx= 0;
-    for(i=0; i<256;){
-        tmp_fields=0;
-        tmp_size=0;
-//        tmp_res=0;
-        if(tmp_pts    != nut->frame_code[i].pts_delta) tmp_fields=1;
-        if(tmp_mul    != nut->frame_code[i].size_mul ) tmp_fields=2;
-        if(tmp_stream != nut->frame_code[i].stream_id) tmp_fields=3;
-        if(tmp_size   != nut->frame_code[i].size_lsb ) tmp_fields=4;
-//        if(tmp_res    != nut->frame_code[i].res            ) tmp_fields=5;
-        if(tmp_head_idx!=nut->frame_code[i].header_idx)tmp_fields=8;
-
-        tmp_pts   = nut->frame_code[i].pts_delta;
-        tmp_flags = nut->frame_code[i].flags;
-        tmp_stream= nut->frame_code[i].stream_id;
-        tmp_mul   = nut->frame_code[i].size_mul;
-        tmp_size  = nut->frame_code[i].size_lsb;
-//        tmp_res   = nut->frame_code[i].res;
-        tmp_head_idx= nut->frame_code[i].header_idx;
-
-        for(j=0; i<256; j++,i++){
-            if(i == 'N'){
-                j--;
-                continue;
-            }
-            if(nut->frame_code[i].pts_delta != tmp_pts   ) break;
-            if(nut->frame_code[i].flags     != tmp_flags ) break;
-            if(nut->frame_code[i].stream_id != tmp_stream) break;
-            if(nut->frame_code[i].size_mul  != tmp_mul   ) break;
-            if(nut->frame_code[i].size_lsb  != tmp_size+j) break;
-//            if(nut->frame_code[i].res       != tmp_res   ) break;
-            if(nut->frame_code[i].header_idx!= tmp_head_idx) break;
-        }
-        if(j != tmp_mul - tmp_size) tmp_fields=6;
-
-        put_v(bc, tmp_flags);
-        put_v(bc, tmp_fields);
-        if(tmp_fields>0) put_s(bc, tmp_pts);
-        if(tmp_fields>1) put_v(bc, tmp_mul);
-        if(tmp_fields>2) put_v(bc, tmp_stream);
-        if(tmp_fields>3) put_v(bc, tmp_size);
-        if(tmp_fields>4) put_v(bc, 0 /*tmp_res*/);
-        if(tmp_fields>5) put_v(bc, j);
-        if(tmp_fields>6) put_v(bc, tmp_match);
-        if(tmp_fields>7) put_v(bc, tmp_head_idx);
-    }
-    put_v(bc, nut->header_count-1);
-    for(i=1; i<nut->header_count; i++){
-        put_v(bc, nut->header_len[i]);
-        put_buffer(bc, nut->header[i], nut->header_len[i]);
-    }
-}
-
-static int write_streamheader(NUTContext *nut, ByteIOContext *bc, AVStream *st, int i){
-    AVCodecContext *codec = st->codec;
-    put_v(bc, i);
-    switch(codec->codec_type){
-    case AVMEDIA_TYPE_VIDEO: put_v(bc, 0); break;
-    case AVMEDIA_TYPE_AUDIO: put_v(bc, 1); break;
-    case AVMEDIA_TYPE_SUBTITLE: put_v(bc, 2); break;
-    default              : put_v(bc, 3); break;
-    }
-    put_v(bc, 4);
-    if (codec->codec_tag){
-        put_le32(bc, codec->codec_tag);
-    }else
-        return -1;
-
-    put_v(bc, nut->stream[i].time_base - nut->time_base);
-    put_v(bc, nut->stream[i].msb_pts_shift);
-    put_v(bc, nut->stream[i].max_pts_distance);
-    put_v(bc, codec->has_b_frames);
-    put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */
-
-    put_v(bc, codec->extradata_size);
-    put_buffer(bc, codec->extradata, codec->extradata_size);
-
-    switch(codec->codec_type){
-    case AVMEDIA_TYPE_AUDIO:
-        put_v(bc, codec->sample_rate);
-        put_v(bc, 1);
-        put_v(bc, codec->channels);
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        put_v(bc, codec->width);
-        put_v(bc, codec->height);
-
-        if(st->sample_aspect_ratio.num<=0 || st->sample_aspect_ratio.den<=0){
-            put_v(bc, 0);
-            put_v(bc, 0);
-        }else{
-            put_v(bc, st->sample_aspect_ratio.num);
-            put_v(bc, st->sample_aspect_ratio.den);
-        }
-        put_v(bc, 0); /* csp type -- unknown */
-        break;
-    default:
-        break;
-    }
-    return 0;
-}
-
-static int add_info(ByteIOContext *bc, const char *type, const char *value){
-    put_str(bc, type);
-    put_s(bc, -1);
-    put_str(bc, value);
-    return 1;
-}
-
-static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){
-    AVFormatContext *s= nut->avf;
-    AVMetadataTag *t = NULL;
-    ByteIOContext *dyn_bc;
-    uint8_t *dyn_buf=NULL;
-    int count=0, dyn_size;
-    int ret = url_open_dyn_buf(&dyn_bc);
-    if(ret < 0)
-        return ret;
-
-    while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX)))
-        count += add_info(dyn_bc, t->key, t->value);
-
-    put_v(bc, 0); //stream_if_plus1
-    put_v(bc, 0); //chapter_id
-    put_v(bc, 0); //timestamp_start
-    put_v(bc, 0); //length
-
-    put_v(bc, count);
-
-    dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
-    put_buffer(bc, dyn_buf, dyn_size);
-    av_free(dyn_buf);
-    return 0;
-}
-
-static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){
-    AVFormatContext *s= nut->avf;
-    AVStream* st = s->streams[stream_id];
-    ByteIOContext *dyn_bc;
-    uint8_t *dyn_buf=NULL;
-    int count=0, dyn_size, i;
-    int ret = url_open_dyn_buf(&dyn_bc);
-    if(ret < 0)
-        return ret;
-
-    for (i=0; ff_nut_dispositions[i].flag; ++i) {
-        if (st->disposition & ff_nut_dispositions[i].flag)
-            count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str);
-    }
-    dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf);
-
-    if (count) {
-        put_v(bc, stream_id + 1); //stream_id_plus1
-        put_v(bc, 0); //chapter_id
-        put_v(bc, 0); //timestamp_start
-        put_v(bc, 0); //length
-
-        put_v(bc, count);
-
-        put_buffer(bc, dyn_buf, dyn_size);
-    }
-
-    av_free(dyn_buf);
-    return count;
-}
-
-static int write_headers(NUTContext *nut, ByteIOContext *bc){
-    ByteIOContext *dyn_bc;
-    int i, ret;
-
-    ret = url_open_dyn_buf(&dyn_bc);
-    if(ret < 0)
-        return ret;
-    write_mainheader(nut, dyn_bc);
-    put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
-
-    for (i=0; i < nut->avf->nb_streams; i++){
-        ret = url_open_dyn_buf(&dyn_bc);
-        if(ret < 0)
-            return ret;
-        write_streamheader(nut, dyn_bc, nut->avf->streams[i], i);
-        put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
-    }
-
-    ret = url_open_dyn_buf(&dyn_bc);
-    if(ret < 0)
-        return ret;
-    write_globalinfo(nut, dyn_bc);
-    put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
-
-    for (i = 0; i < nut->avf->nb_streams; i++) {
-        ret = url_open_dyn_buf(&dyn_bc);
-        if(ret < 0)
-            return ret;
-        ret = write_streaminfo(nut, dyn_bc, i);
-        if (ret < 0)
-            return ret;
-        if (ret > 0)
-            put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
-        else {
-            uint8_t* buf;
-            url_close_dyn_buf(dyn_bc, &buf);
-            av_free(buf);
-        }
-    }
-
-    nut->last_syncpoint_pos= INT_MIN;
-    nut->header_count++;
-    return 0;
-}
-
-static int write_header(AVFormatContext *s){
-    NUTContext *nut = s->priv_data;
-    ByteIOContext *bc = s->pb;
-    int i, j;
-
-    nut->avf= s;
-
-    nut->stream   = av_mallocz(sizeof(StreamContext)*s->nb_streams);
-    nut->time_base= av_mallocz(sizeof(AVRational   )*s->nb_streams);
-
-    for(i=0; i<s->nb_streams; i++){
-        AVStream *st= s->streams[i];
-        int ssize;
-        AVRational time_base;
-        ff_parse_specific_params(st->codec, &time_base.den, &ssize, &time_base.num);
-
-        av_set_pts_info(st, 64, time_base.num, time_base.den);
-
-        for(j=0; j<nut->time_base_count; j++){
-            if(!memcmp(&time_base, &nut->time_base[j], sizeof(AVRational))){
-                break;
-            }
-        }
-        nut->time_base[j]= time_base;
-        nut->stream[i].time_base= &nut->time_base[j];
-        if(j==nut->time_base_count)
-            nut->time_base_count++;
-
-        if(av_q2d(time_base) >= 0.001)
-            nut->stream[i].msb_pts_shift = 7;
-        else
-            nut->stream[i].msb_pts_shift = 14;
-        nut->stream[i].max_pts_distance= FFMAX(1/av_q2d(time_base), 1);
-    }
-
-    nut->max_distance = MAX_DISTANCE;
-    build_elision_headers(s);
-    build_frame_code(s);
-    assert(nut->frame_code['N'].flags == FLAG_INVALID);
-
-    put_buffer(bc, ID_STRING, strlen(ID_STRING));
-    put_byte(bc, 0);
-
-    write_headers(nut, bc);
-
-    put_flush_packet(bc);
-
-    //FIXME index
-
-    return 0;
-}
-
-static int get_needed_flags(NUTContext *nut, StreamContext *nus, FrameCode *fc, AVPacket *pkt){
-    int flags= 0;
-
-    if(pkt->flags & AV_PKT_FLAG_KEY             ) flags |= FLAG_KEY;
-    if(pkt->stream_index != fc->stream_id       ) flags |= FLAG_STREAM_ID;
-    if(pkt->size / fc->size_mul                 ) flags |= FLAG_SIZE_MSB;
-    if(pkt->pts - nus->last_pts != fc->pts_delta) flags |= FLAG_CODED_PTS;
-    if(pkt->size > 2*nut->max_distance          ) flags |= FLAG_CHECKSUM;
-    if(FFABS(pkt->pts - nus->last_pts)
-                         > nus->max_pts_distance) flags |= FLAG_CHECKSUM;
-    if(   pkt->size < nut->header_len[fc->header_idx]
-       || (pkt->size > 4096 && fc->header_idx)
-       || memcmp(pkt->data, nut->header[fc->header_idx], nut->header_len[fc->header_idx]))
-                                                  flags |= FLAG_HEADER_IDX;
-
-    return flags | (fc->flags & FLAG_CODED);
-}
-
-static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){
-    int i;
-    int best_i  = 0;
-    int best_len= 0;
-
-    if(pkt->size > 4096)
-        return 0;
-
-    for(i=1; i<nut->header_count; i++){
-        if(   pkt->size >= nut->header_len[i]
-           &&  nut->header_len[i] > best_len
-           && !memcmp(pkt->data, nut->header[i], nut->header_len[i])){
-            best_i= i;
-            best_len= nut->header_len[i];
-        }
-    }
-    return best_i;
-}
-
-static int write_packet(AVFormatContext *s, AVPacket *pkt){
-    NUTContext *nut = s->priv_data;
-    StreamContext *nus= &nut->stream[pkt->stream_index];
-    ByteIOContext *bc = s->pb, *dyn_bc;
-    FrameCode *fc;
-    int64_t coded_pts;
-    int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx;
-    int key_frame = !!(pkt->flags & AV_PKT_FLAG_KEY);
-    int store_sp=0;
-    int ret;
-
-    if(pkt->pts < 0)
-        return -1;
-
-    if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
-        write_headers(nut, bc);
-
-    if(key_frame && !(nus->last_flags & FLAG_KEY))
-        store_sp= 1;
-
-    if(pkt->size + 30/*FIXME check*/ + url_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
-        store_sp= 1;
-
-//FIXME: Ensure store_sp is 1 in the first place.
-
-    if(store_sp){
-        Syncpoint *sp, dummy= {.pos= INT64_MAX};
-
-        ff_nut_reset_ts(nut, *nus->time_base, pkt->dts);
-        for(i=0; i<s->nb_streams; i++){
-            AVStream *st= s->streams[i];
-            int64_t dts_tb = av_rescale_rnd(pkt->dts,
-                nus->time_base->num * (int64_t)nut->stream[i].time_base->den,
-                nus->time_base->den * (int64_t)nut->stream[i].time_base->num,
-                AV_ROUND_DOWN);
-            int index= av_index_search_timestamp(st, dts_tb, AVSEEK_FLAG_BACKWARD);
-            if(index>=0) dummy.pos= FFMIN(dummy.pos, st->index_entries[index].pos);
-        }
-        if(dummy.pos == INT64_MAX)
-            dummy.pos= 0;
-        sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
-                         NULL);
-
-        nut->last_syncpoint_pos= url_ftell(bc);
-        ret = url_open_dyn_buf(&dyn_bc);
-        if(ret < 0)
-            return ret;
-        put_tt(nut, nus, dyn_bc, pkt->dts);
-        put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0);
-        put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE);
-
-        ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0/*unused*/, pkt->dts);
-    }
-    assert(nus->last_pts != AV_NOPTS_VALUE);
-
-    coded_pts = pkt->pts & ((1<<nus->msb_pts_shift)-1);
-    if(ff_lsb2full(nus, coded_pts) != pkt->pts)
-        coded_pts= pkt->pts + (1<<nus->msb_pts_shift);
-
-    best_header_idx= find_best_header_idx(nut, pkt);
-
-    best_length=INT_MAX;
-    frame_code= -1;
-    for(i=0; i<256; i++){
-        int length= 0;
-        FrameCode *fc= &nut->frame_code[i];
-        int flags= fc->flags;
-
-        if(flags & FLAG_INVALID)
-            continue;
-        needed_flags= get_needed_flags(nut, nus, fc, pkt);
-
-        if(flags & FLAG_CODED){
-            length++;
-            flags = needed_flags;
-        }
-
-        if((flags & needed_flags) != needed_flags)
-            continue;
-
-        if((flags ^ needed_flags) & FLAG_KEY)
-            continue;
-
-        if(flags & FLAG_STREAM_ID)
-            length+= get_length(pkt->stream_index);
-
-        if(pkt->size % fc->size_mul != fc->size_lsb)
-            continue;
-        if(flags & FLAG_SIZE_MSB)
-            length += get_length(pkt->size / fc->size_mul);
-
-        if(flags & FLAG_CHECKSUM)
-            length+=4;
-
-        if(flags & FLAG_CODED_PTS)
-            length += get_length(coded_pts);
-
-        if(   (flags & FLAG_CODED)
-           && nut->header_len[best_header_idx] > nut->header_len[fc->header_idx]+1){
-            flags |= FLAG_HEADER_IDX;
-        }
-
-        if(flags & FLAG_HEADER_IDX){
-            length += 1 - nut->header_len[best_header_idx];
-        }else{
-            length -= nut->header_len[fc->header_idx];
-        }
-
-        length*=4;
-        length+= !(flags & FLAG_CODED_PTS);
-        length+= !(flags & FLAG_CHECKSUM);
-
-        if(length < best_length){
-            best_length= length;
-            frame_code=i;
-        }
-    }
-    assert(frame_code != -1);
-    fc= &nut->frame_code[frame_code];
-    flags= fc->flags;
-    needed_flags= get_needed_flags(nut, nus, fc, pkt);
-    header_idx= fc->header_idx;
-
-    init_checksum(bc, ff_crc04C11DB7_update, 0);
-    put_byte(bc, frame_code);
-    if(flags & FLAG_CODED){
-        put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));
-        flags = needed_flags;
-    }
-    if(flags & FLAG_STREAM_ID)  put_v(bc, pkt->stream_index);
-    if(flags & FLAG_CODED_PTS)  put_v(bc, coded_pts);
-    if(flags & FLAG_SIZE_MSB)   put_v(bc, pkt->size / fc->size_mul);
-    if(flags & FLAG_HEADER_IDX) put_v(bc, header_idx= best_header_idx);
-
-    if(flags & FLAG_CHECKSUM)   put_le32(bc, get_checksum(bc));
-    else                        get_checksum(bc);
-
-    put_buffer(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
-    nus->last_flags= flags;
-    nus->last_pts= pkt->pts;
-
-    //FIXME just store one per syncpoint
-    if(flags & FLAG_KEY)
-        av_add_index_entry(
-            s->streams[pkt->stream_index],
-            nut->last_syncpoint_pos,
-            pkt->pts,
-            0,
-            0,
-            AVINDEX_KEYFRAME);
-
-    return 0;
-}
-
-static int write_trailer(AVFormatContext *s){
-    NUTContext *nut= s->priv_data;
-    ByteIOContext *bc= s->pb;
-
-    while(nut->header_count<3)
-        write_headers(nut, bc);
-    put_flush_packet(bc);
-    ff_nut_free_sp(nut);
-    av_freep(&nut->stream);
-    av_freep(&nut->time_base);
-
-    return 0;
-}
-
-AVOutputFormat nut_muxer = {
-    "nut",
-    NULL_IF_CONFIG_SMALL("NUT format"),
-    "video/x-nut",
-    "nut",
-    sizeof(NUTContext),
-#if   CONFIG_LIBVORBIS
-    CODEC_ID_VORBIS,
-#elif CONFIG_LIBMP3LAME
-    CODEC_ID_MP3,
-#else
-    CODEC_ID_MP2,
-#endif
-    CODEC_ID_MPEG4,
-    write_header,
-    write_packet,
-    write_trailer,
-    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
-    .codec_tag= (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0},
-    .metadata_conv = ff_nut_metadata_conv,
-};
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
deleted file mode 100644
index f0eacd5..0000000
--- a/libavformat/nuv.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * NuppelVideo demuxer.
- * Copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "riff.h"
-
-typedef struct {
-    int v_id;
-    int a_id;
-    int rtjpg_video;
-} NUVContext;
-
-typedef enum {
-    NUV_VIDEO = 'V',
-    NUV_EXTRADATA = 'D',
-    NUV_AUDIO = 'A',
-    NUV_SEEKP = 'R',
-    NUV_MYTHEXT = 'X'
-} nuv_frametype;
-
-static int nuv_probe(AVProbeData *p) {
-    if (!memcmp(p->buf, "NuppelVideo", 12))
-        return AVPROBE_SCORE_MAX;
-    if (!memcmp(p->buf, "MythTVVideo", 12))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-//! little macro to sanitize packet size
-#define PKTSIZE(s) (s &  0xffffff)
-
-/**
- * \brief read until we found all data needed for decoding
- * \param vst video stream of which to change parameters
- * \param ast video stream of which to change parameters
- * \param myth set if this is a MythTVVideo format file
- * \return 1 if all required codec data was found
- */
-static int get_codec_data(ByteIOContext *pb, AVStream *vst,
-                          AVStream *ast, int myth) {
-    nuv_frametype frametype;
-    if (!vst && !myth)
-        return 1; // no codec data needed
-    while (!url_feof(pb)) {
-        int size, subtype;
-        frametype = get_byte(pb);
-        switch (frametype) {
-            case NUV_EXTRADATA:
-                subtype = get_byte(pb);
-                url_fskip(pb, 6);
-                size = PKTSIZE(get_le32(pb));
-                if (vst && subtype == 'R') {
-                    vst->codec->extradata_size = size;
-                    vst->codec->extradata = av_malloc(size);
-                    get_buffer(pb, vst->codec->extradata, size);
-                    size = 0;
-                    if (!myth)
-                        return 1;
-                }
-                break;
-            case NUV_MYTHEXT:
-                url_fskip(pb, 7);
-                size = PKTSIZE(get_le32(pb));
-                if (size != 128 * 4)
-                    break;
-                get_le32(pb); // version
-                if (vst) {
-                    vst->codec->codec_tag = get_le32(pb);
-                    vst->codec->codec_id =
-                        ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag);
-                    if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
-                        vst->codec->codec_id = CODEC_ID_NUV;
-                } else
-                    url_fskip(pb, 4);
-
-                if (ast) {
-                    ast->codec->codec_tag = get_le32(pb);
-                    ast->codec->sample_rate = get_le32(pb);
-                    ast->codec->bits_per_coded_sample = get_le32(pb);
-                    ast->codec->channels = get_le32(pb);
-                    ast->codec->codec_id =
-                        ff_wav_codec_get_id(ast->codec->codec_tag,
-                                         ast->codec->bits_per_coded_sample);
-                    ast->need_parsing = AVSTREAM_PARSE_FULL;
-                } else
-                    url_fskip(pb, 4 * 4);
-
-                size -= 6 * 4;
-                url_fskip(pb, size);
-                return 1;
-            case NUV_SEEKP:
-                size = 11;
-                break;
-            default:
-                url_fskip(pb, 7);
-                size = PKTSIZE(get_le32(pb));
-                break;
-        }
-        url_fskip(pb, size);
-    }
-    return 0;
-}
-
-static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
-    NUVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    char id_string[12];
-    double aspect, fps;
-    int is_mythtv, width, height, v_packs, a_packs;
-    int stream_nr = 0;
-    AVStream *vst = NULL, *ast = NULL;
-    get_buffer(pb, id_string, 12);
-    is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
-    url_fskip(pb, 5); // version string
-    url_fskip(pb, 3); // padding
-    width = get_le32(pb);
-    height = get_le32(pb);
-    get_le32(pb); // unused, "desiredwidth"
-    get_le32(pb); // unused, "desiredheight"
-    get_byte(pb); // 'P' == progressive, 'I' == interlaced
-    url_fskip(pb, 3); // padding
-    aspect = av_int2dbl(get_le64(pb));
-    if (aspect > 0.9999 && aspect < 1.0001)
-        aspect = 4.0 / 3.0;
-    fps = av_int2dbl(get_le64(pb));
-
-    // number of packets per stream type, -1 means unknown, e.g. streaming
-    v_packs = get_le32(pb);
-    a_packs = get_le32(pb);
-    get_le32(pb); // text
-
-    get_le32(pb); // keyframe distance (?)
-
-    if (v_packs) {
-        ctx->v_id = stream_nr++;
-        vst = av_new_stream(s, ctx->v_id);
-        if (!vst)
-            return AVERROR(ENOMEM);
-        vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        vst->codec->codec_id = CODEC_ID_NUV;
-        vst->codec->width = width;
-        vst->codec->height = height;
-        vst->codec->bits_per_coded_sample = 10;
-        vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000);
-        vst->r_frame_rate = av_d2q(fps, 60000);
-        av_set_pts_info(vst, 32, 1, 1000);
-    } else
-        ctx->v_id = -1;
-
-    if (a_packs) {
-        ctx->a_id = stream_nr++;
-        ast = av_new_stream(s, ctx->a_id);
-        if (!ast)
-            return AVERROR(ENOMEM);
-        ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        ast->codec->codec_id = CODEC_ID_PCM_S16LE;
-        ast->codec->channels = 2;
-        ast->codec->sample_rate = 44100;
-        ast->codec->bit_rate = 2 * 2 * 44100 * 8;
-        ast->codec->block_align = 2 * 2;
-        ast->codec->bits_per_coded_sample = 16;
-        av_set_pts_info(ast, 32, 1, 1000);
-    } else
-        ctx->a_id = -1;
-
-    get_codec_data(pb, vst, ast, is_mythtv);
-    ctx->rtjpg_video = vst && vst->codec->codec_id == CODEC_ID_NUV;
-    return 0;
-}
-
-#define HDRSIZE 12
-
-static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
-    NUVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    uint8_t hdr[HDRSIZE];
-    nuv_frametype frametype;
-    int ret, size;
-    while (!url_feof(pb)) {
-        int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
-        uint64_t pos = url_ftell(pb);
-        ret = get_buffer(pb, hdr, HDRSIZE);
-        if (ret < HDRSIZE)
-            return ret < 0 ? ret : AVERROR(EIO);
-        frametype = hdr[0];
-        size = PKTSIZE(AV_RL32(&hdr[8]));
-        switch (frametype) {
-            case NUV_EXTRADATA:
-                if (!ctx->rtjpg_video) {
-                    url_fskip(pb, size);
-                    break;
-                }
-            case NUV_VIDEO:
-                if (ctx->v_id < 0) {
-                    av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n");
-                    url_fskip(pb, size);
-                    break;
-                }
-                ret = av_new_packet(pkt, copyhdrsize + size);
-                if (ret < 0)
-                    return ret;
-                // HACK: we have no idea if it is a keyframe,
-                // but if we mark none seeking will not work at all.
-                pkt->flags |= AV_PKT_FLAG_KEY;
-                pkt->pos = pos;
-                pkt->pts = AV_RL32(&hdr[4]);
-                pkt->stream_index = ctx->v_id;
-                memcpy(pkt->data, hdr, copyhdrsize);
-                ret = get_buffer(pb, pkt->data + copyhdrsize, size);
-                if (ret < 0) {
-                    av_free_packet(pkt);
-                    return ret;
-                }
-                if (ret < size)
-                    av_shrink_packet(pkt, copyhdrsize + ret);
-                return 0;
-            case NUV_AUDIO:
-                if (ctx->a_id < 0) {
-                    av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n");
-                    url_fskip(pb, size);
-                    break;
-                }
-                ret = av_get_packet(pb, pkt, size);
-                pkt->flags |= AV_PKT_FLAG_KEY;
-                pkt->pos = pos;
-                pkt->pts = AV_RL32(&hdr[4]);
-                pkt->stream_index = ctx->a_id;
-                if (ret < 0) return ret;
-                return 0;
-            case NUV_SEEKP:
-                // contains no data, size value is invalid
-                break;
-            default:
-                url_fskip(pb, size);
-                break;
-        }
-    }
-    return AVERROR(EIO);
-}
-
-AVInputFormat nuv_demuxer = {
-    "nuv",
-    NULL_IF_CONFIG_SMALL("NuppelVideo format"),
-    sizeof(NUVContext),
-    nuv_probe,
-    nuv_header,
-    nuv_packet,
-    NULL,
-    NULL,
-    .flags = AVFMT_GENERIC_INDEX,
-};
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
deleted file mode 100644
index 3161e68..0000000
--- a/libavformat/oggdec.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/*
- * Ogg bitstream support
- * Luca Barbato <lu_zero at gentoo.org>
- * Based on tcvp implementation
- *
- */
-
-/**
-    Copyright (C) 2005  Michael Ahlberg, Måns Rullgård
-
-    Permission is hereby granted, free of charge, to any person
-    obtaining a copy of this software and associated documentation
-    files (the "Software"), to deal in the Software without
-    restriction, including without limitation the rights to use, copy,
-    modify, merge, publish, distribute, sublicense, and/or sell copies
-    of the Software, and to permit persons to whom the Software is
-    furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be
-    included in all copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-    DEALINGS IN THE SOFTWARE.
-**/
-
-
-#include <stdio.h>
-#include "oggdec.h"
-#include "avformat.h"
-#include "vorbiscomment.h"
-
-#define MAX_PAGE_SIZE 65307
-#define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
-
-static const struct ogg_codec * const ogg_codecs[] = {
-    &ff_skeleton_codec,
-    &ff_dirac_codec,
-    &ff_speex_codec,
-    &ff_vorbis_codec,
-    &ff_theora_codec,
-    &ff_flac_codec,
-    &ff_old_dirac_codec,
-    &ff_old_flac_codec,
-    &ff_ogm_video_codec,
-    &ff_ogm_audio_codec,
-    &ff_ogm_text_codec,
-    &ff_ogm_old_codec,
-    NULL
-};
-
-//FIXME We could avoid some structure duplication
-static int
-ogg_save (AVFormatContext * s)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_state *ost =
-        av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
-    int i;
-    ost->pos = url_ftell (s->pb);
-    ost->curidx = ogg->curidx;
-    ost->next = ogg->state;
-    ost->nstreams = ogg->nstreams;
-    memcpy(ost->streams, ogg->streams, ogg->nstreams * sizeof(*ogg->streams));
-
-    for (i = 0; i < ogg->nstreams; i++){
-        struct ogg_stream *os = ogg->streams + i;
-        os->buf = av_malloc (os->bufsize);
-        memset (os->buf, 0, os->bufsize);
-        memcpy (os->buf, ost->streams[i].buf, os->bufpos);
-    }
-
-    ogg->state = ost;
-
-    return 0;
-}
-
-static int
-ogg_restore (AVFormatContext * s, int discard)
-{
-    struct ogg *ogg = s->priv_data;
-    ByteIOContext *bc = s->pb;
-    struct ogg_state *ost = ogg->state;
-    int i;
-
-    if (!ost)
-        return 0;
-
-    ogg->state = ost->next;
-
-    if (!discard){
-        for (i = 0; i < ogg->nstreams; i++)
-            av_free (ogg->streams[i].buf);
-
-        url_fseek (bc, ost->pos, SEEK_SET);
-        ogg->curidx = ost->curidx;
-        ogg->nstreams = ost->nstreams;
-        memcpy(ogg->streams, ost->streams,
-               ost->nstreams * sizeof(*ogg->streams));
-    }
-
-    av_free (ost);
-
-    return 0;
-}
-
-static int
-ogg_reset (struct ogg * ogg)
-{
-    int i;
-
-    for (i = 0; i < ogg->nstreams; i++){
-        struct ogg_stream *os = ogg->streams + i;
-        os->bufpos = 0;
-        os->pstart = 0;
-        os->psize = 0;
-        os->granule = -1;
-        os->lastpts = AV_NOPTS_VALUE;
-        os->lastdts = AV_NOPTS_VALUE;
-        os->sync_pos = -1;
-        os->page_pos = 0;
-        os->nsegs = 0;
-        os->segp = 0;
-        os->incomplete = 0;
-    }
-
-    ogg->curidx = -1;
-
-    return 0;
-}
-
-static const struct ogg_codec *
-ogg_find_codec (uint8_t * buf, int size)
-{
-    int i;
-
-    for (i = 0; ogg_codecs[i]; i++)
-        if (size >= ogg_codecs[i]->magicsize &&
-            !memcmp (buf, ogg_codecs[i]->magic, ogg_codecs[i]->magicsize))
-            return ogg_codecs[i];
-
-    return NULL;
-}
-
-static int
-ogg_new_stream (AVFormatContext * s, uint32_t serial)
-{
-
-    struct ogg *ogg = s->priv_data;
-    int idx = ogg->nstreams++;
-    AVStream *st;
-    struct ogg_stream *os;
-
-    ogg->streams = av_realloc (ogg->streams,
-                               ogg->nstreams * sizeof (*ogg->streams));
-    memset (ogg->streams + idx, 0, sizeof (*ogg->streams));
-    os = ogg->streams + idx;
-    os->serial = serial;
-    os->bufsize = DECODER_BUFFER_SIZE;
-    os->buf = av_malloc(os->bufsize);
-    os->header = -1;
-
-    st = av_new_stream (s, idx);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 64, 1, 1000000);
-
-    return idx;
-}
-
-static int
-ogg_new_buf(struct ogg *ogg, int idx)
-{
-    struct ogg_stream *os = ogg->streams + idx;
-    uint8_t *nb = av_malloc(os->bufsize);
-    int size = os->bufpos - os->pstart;
-    if(os->buf){
-        memcpy(nb, os->buf + os->pstart, size);
-        av_free(os->buf);
-    }
-    os->buf = nb;
-    os->bufpos = size;
-    os->pstart = 0;
-
-    return 0;
-}
-
-static int
-ogg_read_page (AVFormatContext * s, int *str)
-{
-    ByteIOContext *bc = s->pb;
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os;
-    int i = 0;
-    int flags, nsegs;
-    uint64_t gp;
-    uint32_t serial;
-    uint32_t seq;
-    uint32_t crc;
-    int size, idx;
-    uint8_t sync[4];
-    int sp = 0;
-
-    if (get_buffer (bc, sync, 4) < 4)
-        return -1;
-
-    do{
-        int c;
-
-        if (sync[sp & 3] == 'O' &&
-            sync[(sp + 1) & 3] == 'g' &&
-            sync[(sp + 2) & 3] == 'g' && sync[(sp + 3) & 3] == 'S')
-            break;
-
-        c = url_fgetc (bc);
-        if (c < 0)
-            return -1;
-        sync[sp++ & 3] = c;
-    }while (i++ < MAX_PAGE_SIZE);
-
-    if (i >= MAX_PAGE_SIZE){
-        av_log (s, AV_LOG_INFO, "ogg, can't find sync word\n");
-        return -1;
-    }
-
-    if (url_fgetc (bc) != 0)      /* version */
-        return -1;
-
-    flags = url_fgetc (bc);
-    gp = get_le64 (bc);
-    serial = get_le32 (bc);
-    seq = get_le32 (bc);
-    crc = get_le32 (bc);
-    nsegs = url_fgetc (bc);
-
-    idx = ogg_find_stream (ogg, serial);
-    if (idx < 0){
-        idx = ogg_new_stream (s, serial);
-        if (idx < 0)
-            return -1;
-    }
-
-    os = ogg->streams + idx;
-    os->page_pos = url_ftell(bc) - 27;
-
-    if(os->psize > 0)
-        ogg_new_buf(ogg, idx);
-
-    if (get_buffer (bc, os->segments, nsegs) < nsegs)
-        return -1;
-
-    os->nsegs = nsegs;
-    os->segp = 0;
-
-    size = 0;
-    for (i = 0; i < nsegs; i++)
-        size += os->segments[i];
-
-    if (flags & OGG_FLAG_CONT || os->incomplete){
-        if (!os->psize){
-            while (os->segp < os->nsegs){
-                int seg = os->segments[os->segp++];
-                os->pstart += seg;
-                if (seg < 255)
-                    break;
-            }
-            os->sync_pos = os->page_pos;
-        }
-    }else{
-        os->psize = 0;
-        os->sync_pos = os->page_pos;
-    }
-
-    if (os->bufsize - os->bufpos < size){
-        uint8_t *nb = av_malloc (os->bufsize *= 2);
-        memcpy (nb, os->buf, os->bufpos);
-        av_free (os->buf);
-        os->buf = nb;
-    }
-
-    if (get_buffer (bc, os->buf + os->bufpos, size) < size)
-        return -1;
-
-    os->bufpos += size;
-    os->granule = gp;
-    os->flags = flags;
-
-    if (str)
-        *str = idx;
-
-    return 0;
-}
-
-static int
-ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpos)
-{
-    struct ogg *ogg = s->priv_data;
-    int idx, i;
-    struct ogg_stream *os;
-    int complete = 0;
-    int segp = 0, psize = 0;
-
-#if 0
-    av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx);
-#endif
-
-    do{
-        idx = ogg->curidx;
-
-        while (idx < 0){
-            if (ogg_read_page (s, &idx) < 0)
-                return -1;
-        }
-
-        os = ogg->streams + idx;
-
-#if 0
-        av_log (s, AV_LOG_DEBUG,
-                "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n",
-                idx, os->pstart, os->psize, os->segp, os->nsegs);
-#endif
-
-        if (!os->codec){
-            if (os->header < 0){
-                os->codec = ogg_find_codec (os->buf, os->bufpos);
-                if (!os->codec){
-                    os->header = 0;
-                    return 0;
-                }
-            }else{
-                return 0;
-            }
-        }
-
-        segp = os->segp;
-        psize = os->psize;
-
-        while (os->segp < os->nsegs){
-            int ss = os->segments[os->segp++];
-            os->psize += ss;
-            if (ss < 255){
-                complete = 1;
-                break;
-            }
-        }
-
-        if (!complete && os->segp == os->nsegs){
-            ogg->curidx = -1;
-            os->incomplete = 1;
-        }
-    }while (!complete);
-
-#if 0
-    av_log (s, AV_LOG_DEBUG,
-            "ogg_packet: idx %i, frame size %i, start %i\n",
-            idx, os->psize, os->pstart);
-#endif
-
-    if (os->granule == -1)
-        av_log(s, AV_LOG_WARNING, "Page at %lld is missing granule\n", os->page_pos);
-
-    ogg->curidx = idx;
-    os->incomplete = 0;
-
-    if (os->header) {
-        os->header = os->codec->header (s, idx);
-        if (!os->header){
-            os->segp = segp;
-            os->psize = psize;
-            if (!ogg->headers)
-                s->data_offset = os->sync_pos;
-            ogg->headers = 1;
-        }else{
-            os->pstart += os->psize;
-            os->psize = 0;
-        }
-    } else {
-        os->pflags = 0;
-        os->pduration = 0;
-        if (os->codec && os->codec->packet)
-            os->codec->packet (s, idx);
-        if (str)
-            *str = idx;
-        if (dstart)
-            *dstart = os->pstart;
-        if (dsize)
-            *dsize = os->psize;
-        if (fpos)
-            *fpos = os->sync_pos;
-        os->pstart += os->psize;
-        os->psize = 0;
-        os->sync_pos = os->page_pos;
-    }
-
-    // determine whether there are more complete packets in this page
-    // if not, the page's granule will apply to this packet
-    os->page_end = 1;
-    for (i = os->segp; i < os->nsegs; i++)
-        if (os->segments[i] < 255) {
-            os->page_end = 0;
-            break;
-        }
-
-    if (os->segp == os->nsegs)
-        ogg->curidx = -1;
-
-    return 0;
-}
-
-static int
-ogg_get_headers (AVFormatContext * s)
-{
-    struct ogg *ogg = s->priv_data;
-
-    do{
-        if (ogg_packet (s, NULL, NULL, NULL, NULL) < 0)
-            return -1;
-    }while (!ogg->headers);
-
-#if 0
-    av_log (s, AV_LOG_DEBUG, "found headers\n");
-#endif
-
-    return 0;
-}
-
-static int
-ogg_get_length (AVFormatContext * s)
-{
-    struct ogg *ogg = s->priv_data;
-    int i;
-    int64_t size, end;
-
-    if(url_is_streamed(s->pb))
-        return 0;
-
-// already set
-    if (s->duration != AV_NOPTS_VALUE)
-        return 0;
-
-    size = url_fsize(s->pb);
-    if(size < 0)
-        return 0;
-    end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0;
-
-    ogg_save (s);
-    url_fseek (s->pb, end, SEEK_SET);
-
-    while (!ogg_read_page (s, &i)){
-        if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
-            ogg->streams[i].codec) {
-            s->streams[i]->duration =
-                ogg_gptopts (s, i, ogg->streams[i].granule, NULL);
-            if (s->streams[i]->start_time != AV_NOPTS_VALUE)
-                s->streams[i]->duration -= s->streams[i]->start_time;
-        }
-    }
-
-    ogg_restore (s, 0);
-
-    return 0;
-}
-
-
-static int
-ogg_read_header (AVFormatContext * s, AVFormatParameters * ap)
-{
-    struct ogg *ogg = s->priv_data;
-    int i;
-    ogg->curidx = -1;
-    //linear headers seek from start
-    if (ogg_get_headers (s) < 0){
-        return -1;
-    }
-
-    for (i = 0; i < ogg->nstreams; i++)
-        if (ogg->streams[i].header < 0)
-            ogg->streams[i].codec = NULL;
-
-    //linear granulepos seek from end
-    ogg_get_length (s);
-
-    //fill the extradata in the per codec callbacks
-    return 0;
-}
-
-static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    int64_t pts = AV_NOPTS_VALUE;
-
-    if (dts)
-        *dts = AV_NOPTS_VALUE;
-
-    if (os->lastpts != AV_NOPTS_VALUE) {
-        pts = os->lastpts;
-        os->lastpts = AV_NOPTS_VALUE;
-    }
-    if (os->lastdts != AV_NOPTS_VALUE) {
-        if (dts)
-            *dts = os->lastdts;
-        os->lastdts = AV_NOPTS_VALUE;
-    }
-    if (os->page_end) {
-        if (os->granule != -1LL) {
-            if (os->codec && os->codec->granule_is_start)
-                pts = ogg_gptopts(s, idx, os->granule, dts);
-            else
-                os->lastpts = ogg_gptopts(s, idx, os->granule, &os->lastdts);
-            os->granule = -1LL;
-        }
-    }
-    return pts;
-}
-
-static int
-ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
-{
-    struct ogg *ogg;
-    struct ogg_stream *os;
-    int idx = -1;
-    int pstart, psize;
-    int64_t fpos, pts, dts;
-
-    //Get an ogg packet
-retry:
-    do{
-        if (ogg_packet (s, &idx, &pstart, &psize, &fpos) < 0)
-            return AVERROR(EIO);
-    }while (idx < 0 || !s->streams[idx]);
-
-    ogg = s->priv_data;
-    os = ogg->streams + idx;
-
-    // pflags might not be set until after this
-    pts = ogg_calc_pts(s, idx, &dts);
-
-    if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
-        goto retry;
-    os->keyframe_seek = 0;
-
-    //Alloc a pkt
-    if (av_new_packet (pkt, psize) < 0)
-        return AVERROR(EIO);
-    pkt->stream_index = idx;
-    memcpy (pkt->data, os->buf + pstart, psize);
-
-    pkt->pts = pts;
-    pkt->dts = dts;
-    pkt->flags = os->pflags;
-    pkt->duration = os->pduration;
-    pkt->pos = fpos;
-
-    return psize;
-}
-
-
-static int
-ogg_read_close (AVFormatContext * s)
-{
-    struct ogg *ogg = s->priv_data;
-    int i;
-
-    for (i = 0; i < ogg->nstreams; i++){
-        av_free (ogg->streams[i].buf);
-        av_free (ogg->streams[i].private);
-    }
-    av_free (ogg->streams);
-    return 0;
-}
-
-
-static int64_t
-ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
-                    int64_t pos_limit)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + stream_index;
-    ByteIOContext *bc = s->pb;
-    int64_t pts = AV_NOPTS_VALUE;
-    int i;
-    url_fseek(bc, *pos_arg, SEEK_SET);
-    ogg_reset(ogg);
-
-    while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
-        if (i == stream_index) {
-            pts = ogg_calc_pts(s, i, NULL);
-            if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
-                pts = AV_NOPTS_VALUE;
-        }
-        if (pts != AV_NOPTS_VALUE)
-            break;
-    }
-    ogg_reset(ogg);
-    return pts;
-}
-
-static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + stream_index;
-    int ret;
-
-    // Try seeking to a keyframe first. If this fails (very possible),
-    // av_seek_frame will fall back to ignoring keyframes
-    if (s->streams[stream_index]->codec->codec_type == AVMEDIA_TYPE_VIDEO
-        && !(flags & AVSEEK_FLAG_ANY))
-        os->keyframe_seek = 1;
-
-    ret = av_seek_frame_binary(s, stream_index, timestamp, flags);
-    if (ret < 0)
-        os->keyframe_seek = 0;
-    return ret;
-}
-
-static int ogg_probe(AVProbeData *p)
-{
-    if (p->buf[0] == 'O' && p->buf[1] == 'g' &&
-        p->buf[2] == 'g' && p->buf[3] == 'S' &&
-        p->buf[4] == 0x0 && p->buf[5] <= 0x7 )
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-AVInputFormat ogg_demuxer = {
-    "ogg",
-    NULL_IF_CONFIG_SMALL("Ogg"),
-    sizeof (struct ogg),
-    ogg_probe,
-    ogg_read_header,
-    ogg_read_packet,
-    ogg_read_close,
-    ogg_read_seek,
-    ogg_read_timestamp,
-    .extensions = "ogg",
-    .metadata_conv = ff_vorbiscomment_metadata_conv,
-    .flags = AVFMT_GENERIC_INDEX,
-};
diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
deleted file mode 100644
index 7d66cd5..0000000
--- a/libavformat/oggdec.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
-    Copyright (C) 2005  Michael Ahlberg, Måns Rullgård
-
-    Permission is hereby granted, free of charge, to any person
-    obtaining a copy of this software and associated documentation
-    files (the "Software"), to deal in the Software without
-    restriction, including without limitation the rights to use, copy,
-    modify, merge, publish, distribute, sublicense, and/or sell copies
-    of the Software, and to permit persons to whom the Software is
-    furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be
-    included in all copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-    DEALINGS IN THE SOFTWARE.
-**/
-
-#ifndef AVFORMAT_OGGDEC_H
-#define AVFORMAT_OGGDEC_H
-
-#include "avformat.h"
-#include "metadata.h"
-
-struct ogg_codec {
-    const int8_t *magic;
-    uint8_t magicsize;
-    const int8_t *name;
-    /**
-     * Attempt to process a packet as a header
-     * @return 1 if the packet was a valid header,
-     *         0 if the packet was not a header (was a data packet)
-     *         -1 if an error occurred or for unsupported stream
-     */
-    int (*header)(AVFormatContext *, int);
-    int (*packet)(AVFormatContext *, int);
-    /**
-     * Translate a granule into a timestamp.
-     * Will set dts if non-null and known.
-     * @return pts
-     */
-    uint64_t (*gptopts)(AVFormatContext *, int, uint64_t, int64_t *dts);
-    /**
-     * 1 if granule is the start time of the associated packet.
-     * 0 if granule is the end time of the associated packet.
-     */
-    int granule_is_start;
-};
-
-struct ogg_stream {
-    uint8_t *buf;
-    unsigned int bufsize;
-    unsigned int bufpos;
-    unsigned int pstart;
-    unsigned int psize;
-    unsigned int pflags;
-    unsigned int pduration;
-    uint32_t serial;
-    uint64_t granule;
-    int64_t lastpts;
-    int64_t lastdts;
-    int64_t sync_pos;   ///< file offset of the first page needed to reconstruct the current packet
-    int64_t page_pos;   ///< file offset of the current page
-    int flags;
-    const struct ogg_codec *codec;
-    int header;
-    int nsegs, segp;
-    uint8_t segments[255];
-    int incomplete; ///< whether we're expecting a continuation in the next page
-    int page_end;   ///< current packet is the last one completed in the page
-    int keyframe_seek;
-    void *private;
-};
-
-struct ogg_state {
-    uint64_t pos;
-    int curidx;
-    struct ogg_state *next;
-    int nstreams;
-    struct ogg_stream streams[1];
-};
-
-struct ogg {
-    struct ogg_stream *streams;
-    int nstreams;
-    int headers;
-    int curidx;
-    struct ogg_state *state;
-};
-
-#define OGG_FLAG_CONT 1
-#define OGG_FLAG_BOS  2
-#define OGG_FLAG_EOS  4
-
-extern const struct ogg_codec ff_dirac_codec;
-extern const struct ogg_codec ff_flac_codec;
-extern const struct ogg_codec ff_ogm_audio_codec;
-extern const struct ogg_codec ff_ogm_old_codec;
-extern const struct ogg_codec ff_ogm_text_codec;
-extern const struct ogg_codec ff_ogm_video_codec;
-extern const struct ogg_codec ff_old_dirac_codec;
-extern const struct ogg_codec ff_old_flac_codec;
-extern const struct ogg_codec ff_skeleton_codec;
-extern const struct ogg_codec ff_speex_codec;
-extern const struct ogg_codec ff_theora_codec;
-extern const struct ogg_codec ff_vorbis_codec;
-
-int ff_vorbis_comment(AVFormatContext *ms, AVMetadata **m, const uint8_t *buf, int size);
-
-static inline int
-ogg_find_stream (struct ogg * ogg, int serial)
-{
-    int i;
-
-    for (i = 0; i < ogg->nstreams; i++)
-        if (ogg->streams[i].serial == serial)
-            return i;
-
-    return -1;
-}
-
-static inline uint64_t
-ogg_gptopts (AVFormatContext * s, int i, uint64_t gp, int64_t *dts)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + i;
-    uint64_t pts = AV_NOPTS_VALUE;
-
-    if(os->codec && os->codec->gptopts){
-        pts = os->codec->gptopts(s, i, gp, dts);
-    } else {
-        pts = gp;
-        if (dts)
-            *dts = pts;
-    }
-
-    return pts;
-}
-
-#endif /* AVFORMAT_OGGDEC_H */
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
deleted file mode 100644
index 70264a4..0000000
--- a/libavformat/oggenc.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Ogg muxer
- * Copyright (c) 2007 Baptiste Coudurier <baptiste dot coudurier at free dot fr>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/crc.h"
-#include "libavcodec/xiph.h"
-#include "libavcodec/bytestream.h"
-#include "libavcodec/flac.h"
-#include "avformat.h"
-#include "internal.h"
-#include "vorbiscomment.h"
-
-#define MAX_PAGE_SIZE 65025
-
-typedef struct {
-    int64_t granule;
-    int stream_index;
-    uint8_t flags;
-    uint8_t segments_count;
-    uint8_t segments[255];
-    uint8_t data[MAX_PAGE_SIZE];
-    uint16_t size;
-} OGGPage;
-
-typedef struct {
-    int64_t duration;
-    unsigned page_counter;
-    uint8_t *header[3];
-    int header_len[3];
-    /** for theora granule */
-    int kfgshift;
-    int64_t last_kf_pts;
-    int vrev;
-    int eos;
-    unsigned page_count; ///< number of page buffered
-    OGGPage page; ///< current page
-} OGGStreamContext;
-
-typedef struct OGGPageList {
-    OGGPage page;
-    struct OGGPageList *next;
-} OGGPageList;
-
-typedef struct {
-    OGGPageList *page_list;
-} OGGContext;
-
-static void ogg_update_checksum(AVFormatContext *s, int64_t crc_offset)
-{
-    int64_t pos = url_ftell(s->pb);
-    uint32_t checksum = get_checksum(s->pb);
-    url_fseek(s->pb, crc_offset, SEEK_SET);
-    put_be32(s->pb, checksum);
-    url_fseek(s->pb, pos, SEEK_SET);
-}
-
-static void ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
-{
-    OGGStreamContext *oggstream = s->streams[page->stream_index]->priv_data;
-    int64_t crc_offset;
-
-    init_checksum(s->pb, ff_crc04C11DB7_update, 0);
-    put_tag(s->pb, "OggS");
-    put_byte(s->pb, 0);
-    put_byte(s->pb, page->flags | extra_flags);
-    put_le64(s->pb, page->granule);
-    put_le32(s->pb, page->stream_index);
-    put_le32(s->pb, oggstream->page_counter++);
-    crc_offset = url_ftell(s->pb);
-    put_le32(s->pb, 0); // crc
-    put_byte(s->pb, page->segments_count);
-    put_buffer(s->pb, page->segments, page->segments_count);
-    put_buffer(s->pb, page->data, page->size);
-
-    ogg_update_checksum(s, crc_offset);
-    put_flush_packet(s->pb);
-    oggstream->page_count--;
-}
-
-static int64_t ogg_granule_to_timestamp(OGGStreamContext *oggstream, OGGPage *page)
-{
-    if (oggstream->kfgshift)
-        return (page->granule>>oggstream->kfgshift) +
-            (page->granule & ((1<<oggstream->kfgshift)-1));
-    else
-        return page->granule;
-}
-
-static int ogg_compare_granule(AVFormatContext *s, OGGPage *next, OGGPage *page)
-{
-    AVStream *st2 = s->streams[next->stream_index];
-    AVStream *st  = s->streams[page->stream_index];
-    int64_t next_granule, cur_granule;
-
-    if (next->granule == -1 || page->granule == -1)
-        return 0;
-
-    next_granule = av_rescale_q(ogg_granule_to_timestamp(st2->priv_data, next),
-                                st2->time_base, AV_TIME_BASE_Q);
-    cur_granule  = av_rescale_q(ogg_granule_to_timestamp(st->priv_data, page),
-                                st ->time_base, AV_TIME_BASE_Q);
-    return next_granule > cur_granule;
-}
-
-static int ogg_reset_cur_page(OGGStreamContext *oggstream)
-{
-    oggstream->page.granule = -1;
-    oggstream->page.flags = 0;
-    oggstream->page.segments_count = 0;
-    oggstream->page.size = 0;
-    return 0;
-}
-
-static int ogg_buffer_page(AVFormatContext *s, OGGStreamContext *oggstream)
-{
-    OGGContext *ogg = s->priv_data;
-    OGGPageList **p = &ogg->page_list;
-    OGGPageList *l = av_mallocz(sizeof(*l));
-
-    if (!l)
-        return AVERROR(ENOMEM);
-    l->page = oggstream->page;
-
-    oggstream->page_count++;
-    ogg_reset_cur_page(oggstream);
-
-    while (*p) {
-        if (ogg_compare_granule(s, &(*p)->page, &l->page))
-            break;
-        p = &(*p)->next;
-    }
-    l->next = *p;
-    *p = l;
-
-    return 0;
-}
-
-static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
-                           uint8_t *data, unsigned size, int64_t granule)
-{
-    OGGStreamContext *oggstream = st->priv_data;
-    int total_segments = size / 255 + 1;
-    uint8_t *p = data;
-    int i, segments, len;
-
-    for (i = 0; i < total_segments; ) {
-        OGGPage *page = &oggstream->page;
-
-        segments = FFMIN(total_segments - i, 255 - page->segments_count);
-
-        if (i && !page->segments_count)
-            page->flags |= 1; // continued packet
-
-        memset(page->segments+page->segments_count, 255, segments - 1);
-        page->segments_count += segments - 1;
-
-        len = FFMIN(size, segments*255);
-        page->segments[page->segments_count++] = len - (segments-1)*255;
-        memcpy(page->data+page->size, p, len);
-        p += len;
-        size -= len;
-        i += segments;
-        page->size += len;
-
-        if (i == total_segments)
-            page->granule = granule;
-
-        if (page->segments_count == 255) {
-            ogg_buffer_page(s, oggstream);
-        }
-    }
-    return 0;
-}
-
-static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,
-                                        int *header_len, AVMetadata *m)
-{
-    const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
-    int size;
-    uint8_t *p, *p0;
-    unsigned int count;
-
-    size = offset + ff_vorbiscomment_length(m, vendor, &count);
-    p = av_mallocz(size);
-    if (!p)
-        return NULL;
-    p0 = p;
-
-    p += offset;
-    ff_vorbiscomment_write(&p, m, vendor, count);
-
-    *header_len = size;
-    return p0;
-}
-
-static int ogg_build_flac_headers(AVCodecContext *avctx,
-                                  OGGStreamContext *oggstream, int bitexact,
-                                  AVMetadata *m)
-{
-    enum FLACExtradataFormat format;
-    uint8_t *streaminfo;
-    uint8_t *p;
-
-    if (!ff_flac_is_extradata_valid(avctx, &format, &streaminfo))
-        return -1;
-
-    // first packet: STREAMINFO
-    oggstream->header_len[0] = 51;
-    oggstream->header[0] = av_mallocz(51); // per ogg flac specs
-    p = oggstream->header[0];
-    if (!p)
-        return AVERROR(ENOMEM);
-    bytestream_put_byte(&p, 0x7F);
-    bytestream_put_buffer(&p, "FLAC", 4);
-    bytestream_put_byte(&p, 1); // major version
-    bytestream_put_byte(&p, 0); // minor version
-    bytestream_put_be16(&p, 1); // headers packets without this one
-    bytestream_put_buffer(&p, "fLaC", 4);
-    bytestream_put_byte(&p, 0x00); // streaminfo
-    bytestream_put_be24(&p, 34);
-    bytestream_put_buffer(&p, streaminfo, FLAC_STREAMINFO_SIZE);
-
-    // second packet: VorbisComment
-    p = ogg_write_vorbiscomment(4, bitexact, &oggstream->header_len[1], m);
-    if (!p)
-        return AVERROR(ENOMEM);
-    oggstream->header[1] = p;
-    bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment
-    bytestream_put_be24(&p, oggstream->header_len[1] - 4);
-
-    return 0;
-}
-
-#define SPEEX_HEADER_SIZE 80
-
-static int ogg_build_speex_headers(AVCodecContext *avctx,
-                                   OGGStreamContext *oggstream, int bitexact,
-                                   AVMetadata *m)
-{
-    uint8_t *p;
-
-    if (avctx->extradata_size < SPEEX_HEADER_SIZE)
-        return -1;
-
-    // first packet: Speex header
-    p = av_mallocz(SPEEX_HEADER_SIZE);
-    if (!p)
-        return AVERROR(ENOMEM);
-    oggstream->header[0] = p;
-    oggstream->header_len[0] = SPEEX_HEADER_SIZE;
-    bytestream_put_buffer(&p, avctx->extradata, SPEEX_HEADER_SIZE);
-    AV_WL32(&oggstream->header[0][68], 0);  // set extra_headers to 0
-
-    // second packet: VorbisComment
-    p = ogg_write_vorbiscomment(0, bitexact, &oggstream->header_len[1], m);
-    if (!p)
-        return AVERROR(ENOMEM);
-    oggstream->header[1] = p;
-
-    return 0;
-}
-
-static int ogg_write_header(AVFormatContext *s)
-{
-    OGGStreamContext *oggstream;
-    int i, j;
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-        else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-            av_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den);
-        if (st->codec->codec_id != CODEC_ID_VORBIS &&
-            st->codec->codec_id != CODEC_ID_THEORA &&
-            st->codec->codec_id != CODEC_ID_SPEEX  &&
-            st->codec->codec_id != CODEC_ID_FLAC) {
-            av_log(s, AV_LOG_ERROR, "Unsupported codec id in stream %d\n", i);
-            return -1;
-        }
-
-        if (!st->codec->extradata || !st->codec->extradata_size) {
-            av_log(s, AV_LOG_ERROR, "No extradata present\n");
-            return -1;
-        }
-        oggstream = av_mallocz(sizeof(*oggstream));
-        oggstream->page.stream_index = i;
-        st->priv_data = oggstream;
-        if (st->codec->codec_id == CODEC_ID_FLAC) {
-            int err = ogg_build_flac_headers(st->codec, oggstream,
-                                             st->codec->flags & CODEC_FLAG_BITEXACT,
-                                             s->metadata);
-            if (err) {
-                av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n");
-                av_freep(&st->priv_data);
-                return err;
-            }
-        } else if (st->codec->codec_id == CODEC_ID_SPEEX) {
-            int err = ogg_build_speex_headers(st->codec, oggstream,
-                                              st->codec->flags & CODEC_FLAG_BITEXACT,
-                                              s->metadata);
-            if (err) {
-                av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n");
-                av_freep(&st->priv_data);
-                return err;
-            }
-        } else {
-            if (ff_split_xiph_headers(st->codec->extradata, st->codec->extradata_size,
-                                      st->codec->codec_id == CODEC_ID_VORBIS ? 30 : 42,
-                                      oggstream->header, oggstream->header_len) < 0) {
-                av_log(s, AV_LOG_ERROR, "Extradata corrupted\n");
-                av_freep(&st->priv_data);
-                return -1;
-            }
-            if (st->codec->codec_id == CODEC_ID_THEORA) {
-                /** KFGSHIFT is the width of the less significant section of the granule position
-                    The less significant section is the frame count since the last keyframe */
-                oggstream->kfgshift = ((oggstream->header[0][40]&3)<<3)|(oggstream->header[0][41]>>5);
-                oggstream->vrev = oggstream->header[0][9];
-                av_log(s, AV_LOG_DEBUG, "theora kfgshift %d, vrev %d\n",
-                       oggstream->kfgshift, oggstream->vrev);
-            }
-        }
-    }
-
-    for (j = 0; j < s->nb_streams; j++) {
-        OGGStreamContext *oggstream = s->streams[j]->priv_data;
-        ogg_buffer_data(s, s->streams[j], oggstream->header[0],
-                        oggstream->header_len[0], 0);
-        oggstream->page.flags |= 2; // bos
-        ogg_buffer_page(s, oggstream);
-    }
-    for (j = 0; j < s->nb_streams; j++) {
-        AVStream *st = s->streams[j];
-        OGGStreamContext *oggstream = st->priv_data;
-        for (i = 1; i < 3; i++) {
-            if (oggstream && oggstream->header_len[i])
-                ogg_buffer_data(s, st, oggstream->header[i],
-                                oggstream->header_len[i], 0);
-        }
-        ogg_buffer_page(s, oggstream);
-    }
-    return 0;
-}
-
-static void ogg_write_pages(AVFormatContext *s, int flush)
-{
-    OGGContext *ogg = s->priv_data;
-    OGGPageList *next, *p;
-
-    if (!ogg->page_list)
-        return;
-
-    for (p = ogg->page_list; p; ) {
-        OGGStreamContext *oggstream =
-            s->streams[p->page.stream_index]->priv_data;
-        if (oggstream->page_count < 2 && !flush)
-            break;
-        ogg_write_page(s, &p->page,
-                       flush && oggstream->page_count == 1 ? 4 : 0); // eos
-        next = p->next;
-        av_freep(&p);
-        p = next;
-    }
-    ogg->page_list = p;
-}
-
-static int ogg_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    AVStream *st = s->streams[pkt->stream_index];
-    OGGStreamContext *oggstream = st->priv_data;
-    int ret;
-    int64_t granule;
-
-    if (st->codec->codec_id == CODEC_ID_THEORA) {
-        int64_t pts = oggstream->vrev < 1 ? pkt->pts : pkt->pts + pkt->duration;
-        int pframe_count;
-        if (pkt->flags & AV_PKT_FLAG_KEY)
-            oggstream->last_kf_pts = pts;
-        pframe_count = pts - oggstream->last_kf_pts;
-        // prevent frame count from overflow if key frame flag is not set
-        if (pframe_count >= (1<<oggstream->kfgshift)) {
-            oggstream->last_kf_pts += pframe_count;
-            pframe_count = 0;
-        }
-        granule = (oggstream->last_kf_pts<<oggstream->kfgshift) | pframe_count;
-    } else
-        granule = pkt->pts + pkt->duration;
-    oggstream->duration = granule;
-
-    ret = ogg_buffer_data(s, st, pkt->data, pkt->size, granule);
-    if (ret < 0)
-        return ret;
-
-    ogg_write_pages(s, 0);
-
-    return 0;
-}
-
-static int ogg_write_trailer(AVFormatContext *s)
-{
-    int i;
-
-    /* flush current page */
-    for (i = 0; i < s->nb_streams; i++)
-        ogg_buffer_page(s, s->streams[i]->priv_data);
-
-    ogg_write_pages(s, 1);
-
-    for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        OGGStreamContext *oggstream = st->priv_data;
-        if (st->codec->codec_id == CODEC_ID_FLAC ||
-            st->codec->codec_id == CODEC_ID_SPEEX) {
-            av_free(oggstream->header[0]);
-            av_free(oggstream->header[1]);
-        }
-        av_freep(&st->priv_data);
-    }
-    return 0;
-}
-
-AVOutputFormat ogg_muxer = {
-    "ogg",
-    NULL_IF_CONFIG_SMALL("Ogg"),
-    "application/ogg",
-    "ogg,ogv,spx",
-    sizeof(OGGContext),
-    CODEC_ID_FLAC,
-    CODEC_ID_THEORA,
-    ogg_write_header,
-    ogg_write_packet,
-    ogg_write_trailer,
-    .metadata_conv = ff_vorbiscomment_metadata_conv,
-};
diff --git a/libavformat/oggparsedirac.c b/libavformat/oggparsedirac.c
deleted file mode 100644
index a7f0401..0000000
--- a/libavformat/oggparsedirac.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2008  David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/get_bits.h"
-#include "libavcodec/dirac.h"
-#include "avformat.h"
-#include "oggdec.h"
-
-static int dirac_header(AVFormatContext *s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    dirac_source_params source;
-    GetBitContext gb;
-
-    // already parsed the header
-    if (st->codec->codec_id == CODEC_ID_DIRAC)
-        return 0;
-
-    init_get_bits(&gb, os->buf + os->pstart + 13, (os->psize - 13) * 8);
-    if (ff_dirac_parse_sequence_header(st->codec, &gb, &source) < 0)
-        return -1;
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_DIRAC;
-    // dirac in ogg always stores timestamps as though the video were interlaced
-    st->time_base = (AVRational){st->codec->time_base.num, 2*st->codec->time_base.den};
-    return 1;
-}
-
-// various undocument things: granule is signed (only for dirac!)
-static uint64_t dirac_gptopts(AVFormatContext *s, int idx, uint64_t granule,
-                              int64_t *dts_out)
-{
-    int64_t gp = granule;
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-
-    unsigned dist  = ((gp >> 14) & 0xff00) | (gp & 0xff);
-    int64_t  dts   = (gp >> 31);
-    int64_t  pts   = dts + ((gp >> 9) & 0x1fff);
-
-    if (!dist)
-        os->pflags |= AV_PKT_FLAG_KEY;
-
-    if (dts_out)
-        *dts_out = dts;
-
-    return pts;
-}
-
-static int old_dirac_header(AVFormatContext *s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    uint8_t *buf = os->buf + os->pstart;
-
-    if (buf[0] != 'K')
-        return 0;
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_DIRAC;
-    st->time_base.den = AV_RB32(buf+8);
-    st->time_base.num = AV_RB32(buf+12);
-    return 1;
-}
-
-static uint64_t old_dirac_gptopts(AVFormatContext *s, int idx, uint64_t gp,
-                                  int64_t *dts)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    uint64_t iframe = gp >> 30;
-    uint64_t pframe = gp & 0x3fffffff;
-
-    if (!pframe)
-        os->pflags |= AV_PKT_FLAG_KEY;
-
-    return iframe + pframe;
-}
-
-const struct ogg_codec ff_dirac_codec = {
-    .magic = "BBCD\0",
-    .magicsize = 5,
-    .header = dirac_header,
-    .gptopts = dirac_gptopts,
-    .granule_is_start = 1,
-};
-
-const struct ogg_codec ff_old_dirac_codec = {
-    .magic = "KW-DIRAC",
-    .magicsize = 8,
-    .header = old_dirac_header,
-    .gptopts = old_dirac_gptopts,
-    .granule_is_start = 1,
-};
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
deleted file mode 100644
index e5034af..0000000
--- a/libavformat/oggparseflac.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *    Copyright (C) 2005  Matthieu CASTET
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include "libavcodec/get_bits.h"
-#include "libavcodec/flac.h"
-#include "avformat.h"
-#include "oggdec.h"
-
-#define OGG_FLAC_METADATA_TYPE_STREAMINFO 0x7F
-
-static int
-flac_header (AVFormatContext * s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    GetBitContext gb;
-    FLACStreaminfo si;
-    int mdt;
-
-    if (os->buf[os->pstart] == 0xff)
-        return 0;
-
-    init_get_bits(&gb, os->buf + os->pstart, os->psize*8);
-    skip_bits1(&gb); /* metadata_last */
-    mdt = get_bits(&gb, 7);
-
-    if (mdt == OGG_FLAC_METADATA_TYPE_STREAMINFO) {
-        uint8_t *streaminfo_start = os->buf + os->pstart + 5 + 4 + 4 + 4;
-        skip_bits_long(&gb, 4*8); /* "FLAC" */
-        if(get_bits(&gb, 8) != 1) /* unsupported major version */
-            return -1;
-        skip_bits_long(&gb, 8 + 16); /* minor version + header count */
-        skip_bits_long(&gb, 4*8); /* "fLaC" */
-
-        /* METADATA_BLOCK_HEADER */
-        if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE)
-            return -1;
-
-        ff_flac_parse_streaminfo(st->codec, &si, streaminfo_start);
-
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = CODEC_ID_FLAC;
-
-        st->codec->extradata =
-            av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
-        memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE);
-        st->codec->extradata_size = FLAC_STREAMINFO_SIZE;
-
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
-    } else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT) {
-        ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 4, os->psize - 4);
-    }
-
-    return 1;
-}
-
-static int
-old_flac_header (AVFormatContext * s, int idx)
-{
-    AVStream *st = s->streams[idx];
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_FLAC;
-
-    return 0;
-}
-
-const struct ogg_codec ff_flac_codec = {
-    .magic = "\177FLAC",
-    .magicsize = 5,
-    .header = flac_header
-};
-
-const struct ogg_codec ff_old_flac_codec = {
-    .magic = "fLaC",
-    .magicsize = 4,
-    .header = old_flac_header
-};
diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c
deleted file mode 100644
index e1d046f..0000000
--- a/libavformat/oggparseogm.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/**
-    Copyright (C) 2005  Michael Ahlberg, Måns Rullgård
-
-    Permission is hereby granted, free of charge, to any person
-    obtaining a copy of this software and associated documentation
-    files (the "Software"), to deal in the Software without
-    restriction, including without limitation the rights to use, copy,
-    modify, merge, publish, distribute, sublicense, and/or sell copies
-    of the Software, and to permit persons to whom the Software is
-    furnished to do so, subject to the following conditions:
-
-    The above copyright notice and this permission notice shall be
-    included in all copies or substantial portions of the Software.
-
-    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-    DEALINGS IN THE SOFTWARE.
-**/
-
-#include <stdlib.h>
-#include "libavutil/intreadwrite.h"
-#include "libavcodec/get_bits.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "oggdec.h"
-#include "riff.h"
-
-static int
-ogm_header(AVFormatContext *s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    const uint8_t *p = os->buf + os->pstart;
-    uint64_t time_unit;
-    uint64_t spu;
-    uint32_t default_len;
-
-    if(!(*p & 1))
-        return 0;
-
-    if(*p == 1) {
-        p++;
-
-        if(*p == 'v'){
-            int tag;
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            p += 8;
-            tag = bytestream_get_le32(&p);
-            st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag);
-            st->codec->codec_tag = tag;
-        } else if (*p == 't') {
-            st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
-            st->codec->codec_id = CODEC_ID_TEXT;
-            p += 12;
-        } else {
-            uint8_t acid[5];
-            int cid;
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            p += 8;
-            bytestream_get_buffer(&p, acid, 4);
-            acid[4] = 0;
-            cid = strtol(acid, NULL, 16);
-            st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, cid);
-            st->need_parsing = AVSTREAM_PARSE_FULL;
-        }
-
-        p += 4;                     /* useless size field */
-
-        time_unit   = bytestream_get_le64(&p);
-        spu         = bytestream_get_le64(&p);
-        default_len = bytestream_get_le32(&p);
-
-        p += 8;                     /* buffersize + bits_per_sample */
-
-        if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
-            st->codec->width = bytestream_get_le32(&p);
-            st->codec->height = bytestream_get_le32(&p);
-            st->codec->time_base.den = spu * 10000000;
-            st->codec->time_base.num = time_unit;
-            st->time_base = st->codec->time_base;
-        } else {
-            st->codec->channels = bytestream_get_le16(&p);
-            p += 2;                 /* block_align */
-            st->codec->bit_rate = bytestream_get_le32(&p) * 8;
-            st->codec->sample_rate = spu * 10000000 / time_unit;
-            st->time_base.num = 1;
-            st->time_base.den = st->codec->sample_rate;
-        }
-    } else if (*p == 3) {
-        if (os->psize > 8)
-            ff_vorbis_comment(s, &st->metadata, p+7, os->psize-8);
-    }
-
-    return 1;
-}
-
-static int
-ogm_dshow_header(AVFormatContext *s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    uint8_t *p = os->buf + os->pstart;
-    uint32_t t;
-
-    if(!(*p & 1))
-        return 0;
-    if(*p != 1)
-        return 1;
-
-    t = AV_RL32(p + 96);
-
-    if(t == 0x05589f80){
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, AV_RL32(p + 68));
-        st->codec->time_base.den = 10000000;
-        st->codec->time_base.num = AV_RL64(p + 164);
-        st->codec->width = AV_RL32(p + 176);
-        st->codec->height = AV_RL32(p + 180);
-    } else if(t == 0x05589f81){
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = ff_codec_get_id(ff_codec_wav_tags, AV_RL16(p + 124));
-        st->codec->channels = AV_RL16(p + 126);
-        st->codec->sample_rate = AV_RL32(p + 128);
-        st->codec->bit_rate = AV_RL32(p + 132) * 8;
-    }
-
-    return 1;
-}
-
-static int
-ogm_packet(AVFormatContext *s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    uint8_t *p = os->buf + os->pstart;
-    int lb;
-
-    if(*p & 8)
-        os->pflags |= AV_PKT_FLAG_KEY;
-
-    lb = ((*p & 2) << 1) | ((*p >> 6) & 3);
-    os->pstart += lb + 1;
-    os->psize -= lb + 1;
-
-    while (lb--)
-        os->pduration += p[lb+1] << (lb*8);
-
-    return 0;
-}
-
-const struct ogg_codec ff_ogm_video_codec = {
-    .magic = "\001video",
-    .magicsize = 6,
-    .header = ogm_header,
-    .packet = ogm_packet,
-    .granule_is_start = 1,
-};
-
-const struct ogg_codec ff_ogm_audio_codec = {
-    .magic = "\001audio",
-    .magicsize = 6,
-    .header = ogm_header,
-    .packet = ogm_packet,
-    .granule_is_start = 1,
-};
-
-const struct ogg_codec ff_ogm_text_codec = {
-    .magic = "\001text",
-    .magicsize = 5,
-    .header = ogm_header,
-    .packet = ogm_packet,
-    .granule_is_start = 1,
-};
-
-const struct ogg_codec ff_ogm_old_codec = {
-    .magic = "\001Direct Show Samples embedded in Ogg",
-    .magicsize = 35,
-    .header = ogm_dshow_header,
-    .packet = ogm_packet,
-    .granule_is_start = 1,
-};
diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c
deleted file mode 100644
index ad0dded..0000000
--- a/libavformat/oggparseskeleton.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2010 David Conrad
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "oggdec.h"
-
-static int skeleton_header(AVFormatContext *s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    uint8_t *buf = os->buf + os->pstart;
-    int version_major, version_minor;
-    int64_t start_num, start_den, start_granule;
-    int target_idx, start_time;
-
-    strcpy(st->codec->codec_name, "skeleton");
-    st->codec->codec_type = AVMEDIA_TYPE_DATA;
-
-    if (os->psize < 8)
-        return -1;
-
-    if (!strncmp(buf, "fishead", 8)) {
-        if (os->psize < 64)
-            return -1;
-
-        version_major = AV_RL16(buf+8);
-        version_minor = AV_RL16(buf+10);
-
-        if (version_major != 3) {
-            av_log(s, AV_LOG_WARNING, "Unknown skeleton version %d.%d\n",
-                   version_major, version_minor);
-            return -1;
-        }
-
-        // This is the overall start time. We use it for the start time of
-        // of the skeleton stream since if left unset lavf assumes 0,
-        // which we don't want since skeleton is timeless
-        // FIXME: the real meaning of this field is "start playback at
-        // this time which can be in the middle of a packet
-        start_num = AV_RL64(buf+12);
-        start_den = AV_RL64(buf+20);
-
-        if (start_den) {
-            av_reduce(&start_time, &st->time_base.den, start_num, start_den, INT_MAX);
-            st->time_base.num = 1;
-            os->lastpts =
-            st->start_time = start_time;
-        }
-    } else if (!strncmp(buf, "fisbone", 8)) {
-        if (os->psize < 52)
-            return -1;
-
-        target_idx = ogg_find_stream(ogg, AV_RL32(buf+12));
-        start_granule = AV_RL64(buf+36);
-        if (target_idx >= 0 && start_granule != -1) {
-            ogg->streams[target_idx].lastpts =
-            s->streams[target_idx]->start_time = ogg_gptopts(s, target_idx, start_granule, NULL);
-        }
-    }
-
-    return 1;
-}
-
-const struct ogg_codec ff_skeleton_codec = {
-    .magic = "fishead",
-    .magicsize = 8,
-    .header = skeleton_header,
-};
diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c
deleted file mode 100644
index 936b37e..0000000
--- a/libavformat/oggparsespeex.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-      Copyright (C) 2008  Reimar Döffinger
-
-      Permission is hereby granted, free of charge, to any person
-      obtaining a copy of this software and associated documentation
-      files (the "Software"), to deal in the Software without
-      restriction, including without limitation the rights to use, copy,
-      modify, merge, publish, distribute, sublicense, and/or sell copies
-      of the Software, and to permit persons to whom the Software is
-      furnished to do so, subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be
-      included in all copies or substantial portions of the Software.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-      HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-      WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-      DEALINGS IN THE SOFTWARE.
-**/
-
-#include <stdlib.h>
-#include "libavutil/bswap.h"
-#include "libavutil/avstring.h"
-#include "libavcodec/get_bits.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "oggdec.h"
-
-struct speex_params {
-    int final_packet_duration;
-    int seq;
-};
-
-static int speex_header(AVFormatContext *s, int idx) {
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    struct speex_params *spxp = os->private;
-    AVStream *st = s->streams[idx];
-    uint8_t *p = os->buf + os->pstart;
-
-    if (!spxp) {
-        spxp = av_mallocz(sizeof(*spxp));
-        os->private = spxp;
-    }
-
-    if (spxp->seq > 1)
-        return 0;
-
-    if (spxp->seq == 0) {
-        int frames_per_packet;
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = CODEC_ID_SPEEX;
-
-        st->codec->sample_rate = AV_RL32(p + 36);
-        st->codec->channels = AV_RL32(p + 48);
-
-        /* We treat the whole Speex packet as a single frame everywhere Speex
-           is handled in FFmpeg.  This avoids the complexities of splitting
-           and joining individual Speex frames, which are not always
-           byte-aligned. */
-        st->codec->frame_size = AV_RL32(p + 56);
-        frames_per_packet     = AV_RL32(p + 64);
-        if (frames_per_packet)
-            st->codec->frame_size *= frames_per_packet;
-
-        st->codec->extradata_size = os->psize;
-        st->codec->extradata = av_malloc(st->codec->extradata_size
-                                         + FF_INPUT_BUFFER_PADDING_SIZE);
-        memcpy(st->codec->extradata, p, st->codec->extradata_size);
-
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
-    } else
-        ff_vorbis_comment(s, &st->metadata, p, os->psize);
-
-    spxp->seq++;
-    return 1;
-}
-
-static int ogg_page_packets(struct ogg_stream *os)
-{
-    int i;
-    int packets = 0;
-    for (i = 0; i < os->nsegs; i++)
-        if (os->segments[i] < 255)
-            packets++;
-    return packets;
-}
-
-static int speex_packet(AVFormatContext *s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    struct speex_params *spxp = os->private;
-    int packet_size = s->streams[idx]->codec->frame_size;
-
-    if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE &&
-        os->granule > 0) {
-        /* first packet of final page. we have to calculate the final packet
-           duration here because it is the only place we know the next-to-last
-           granule position. */
-        spxp->final_packet_duration = os->granule - os->lastpts -
-                                      packet_size * (ogg_page_packets(os) - 1);
-    }
-
-    if (!os->lastpts && os->granule > 0)
-        /* first packet */
-        os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1);
-    else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs &&
-             spxp->final_packet_duration)
-        /* final packet */
-        os->pduration = spxp->final_packet_duration;
-    else
-        os->pduration = packet_size;
-
-    return 0;
-}
-
-const struct ogg_codec ff_speex_codec = {
-    .magic = "Speex   ",
-    .magicsize = 8,
-    .header = speex_header,
-    .packet = speex_packet
-};
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
deleted file mode 100644
index 2299f55..0000000
--- a/libavformat/oggparsetheora.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
-      Copyright (C) 2005  Matthieu CASTET, Alex Beregszaszi
-
-      Permission is hereby granted, free of charge, to any person
-      obtaining a copy of this software and associated documentation
-      files (the "Software"), to deal in the Software without
-      restriction, including without limitation the rights to use, copy,
-      modify, merge, publish, distribute, sublicense, and/or sell copies
-      of the Software, and to permit persons to whom the Software is
-      furnished to do so, subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be
-      included in all copies or substantial portions of the Software.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-      HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-      WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-      DEALINGS IN THE SOFTWARE.
-**/
-
-#include <stdlib.h>
-#include "libavutil/bswap.h"
-#include "libavcodec/get_bits.h"
-#include "avformat.h"
-#include "oggdec.h"
-
-struct theora_params {
-    int gpshift;
-    int gpmask;
-    unsigned version;
-};
-
-static int
-theora_header (AVFormatContext * s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    struct theora_params *thp = os->private;
-    int cds = st->codec->extradata_size + os->psize + 2;
-    uint8_t *cdp;
-
-    if(!(os->buf[os->pstart] & 0x80))
-        return 0;
-
-    if(!thp){
-        thp = av_mallocz(sizeof(*thp));
-        os->private = thp;
-    }
-
-    if (os->buf[os->pstart] == 0x80) {
-        GetBitContext gb;
-        int width, height;
-
-        init_get_bits(&gb, os->buf + os->pstart, os->psize*8);
-
-        skip_bits_long(&gb, 7*8); /* 0x80"theora" */
-
-        thp->version = get_bits_long(&gb, 24);
-        if (thp->version < 0x030100)
-        {
-            av_log(s, AV_LOG_ERROR,
-                "Too old or unsupported Theora (%x)\n", thp->version);
-            return -1;
-        }
-
-        width  = get_bits(&gb, 16) << 4;
-        height = get_bits(&gb, 16) << 4;
-        avcodec_set_dimensions(st->codec, width, height);
-
-        if (thp->version >= 0x030400)
-            skip_bits(&gb, 100);
-
-        if (thp->version >= 0x030200) {
-            width  = get_bits_long(&gb, 24);
-            height = get_bits_long(&gb, 24);
-            if (   width  <= st->codec->width  && width  > st->codec->width-16
-                && height <= st->codec->height && height > st->codec->height-16)
-                avcodec_set_dimensions(st->codec, width, height);
-
-            skip_bits(&gb, 16);
-        }
-        st->codec->time_base.den = get_bits_long(&gb, 32);
-        st->codec->time_base.num = get_bits_long(&gb, 32);
-        if (!(st->codec->time_base.num > 0 && st->codec->time_base.den > 0)) {
-            av_log(s, AV_LOG_WARNING, "Invalid time base in theora stream, assuming 25 FPS\n");
-            st->codec->time_base.num = 1;
-            st->codec->time_base.den = 25;
-        }
-        st->time_base = st->codec->time_base;
-
-        st->sample_aspect_ratio.num = get_bits_long(&gb, 24);
-        st->sample_aspect_ratio.den = get_bits_long(&gb, 24);
-
-        if (thp->version >= 0x030200)
-            skip_bits_long(&gb, 38);
-        if (thp->version >= 0x304000)
-            skip_bits(&gb, 2);
-
-        thp->gpshift = get_bits(&gb, 5);
-        thp->gpmask = (1 << thp->gpshift) - 1;
-
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        st->codec->codec_id = CODEC_ID_THEORA;
-        st->need_parsing = AVSTREAM_PARSE_HEADERS;
-
-    } else if (os->buf[os->pstart] == 0x83) {
-        ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
-    }
-
-    st->codec->extradata = av_realloc (st->codec->extradata,
-                                       cds + FF_INPUT_BUFFER_PADDING_SIZE);
-    cdp = st->codec->extradata + st->codec->extradata_size;
-    *cdp++ = os->psize >> 8;
-    *cdp++ = os->psize & 0xff;
-    memcpy (cdp, os->buf + os->pstart, os->psize);
-    st->codec->extradata_size = cds;
-
-    return 1;
-}
-
-static uint64_t
-theora_gptopts(AVFormatContext *ctx, int idx, uint64_t gp, int64_t *dts)
-{
-    struct ogg *ogg = ctx->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    struct theora_params *thp = os->private;
-    uint64_t iframe = gp >> thp->gpshift;
-    uint64_t pframe = gp & thp->gpmask;
-
-    if (thp->version < 0x030201)
-        iframe++;
-
-    if(!pframe)
-        os->pflags |= AV_PKT_FLAG_KEY;
-
-    if (dts)
-        *dts = iframe + pframe;
-
-    return iframe + pframe;
-}
-
-const struct ogg_codec ff_theora_codec = {
-    .magic = "\200theora",
-    .magicsize = 7,
-    .header = theora_header,
-    .gptopts = theora_gptopts
-};
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
deleted file mode 100644
index 886ef52..0000000
--- a/libavformat/oggparsevorbis.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/**
-      Copyright (C) 2005  Michael Ahlberg, Måns Rullgård
-
-      Permission is hereby granted, free of charge, to any person
-      obtaining a copy of this software and associated documentation
-      files (the "Software"), to deal in the Software without
-      restriction, including without limitation the rights to use, copy,
-      modify, merge, publish, distribute, sublicense, and/or sell copies
-      of the Software, and to permit persons to whom the Software is
-      furnished to do so, subject to the following conditions:
-
-      The above copyright notice and this permission notice shall be
-      included in all copies or substantial portions of the Software.
-
-      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-      EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-      MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-      NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-      HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-      WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-      DEALINGS IN THE SOFTWARE.
-**/
-
-#include <stdlib.h>
-#include "libavutil/avstring.h"
-#include "libavutil/bswap.h"
-#include "libavcodec/get_bits.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "oggdec.h"
-
-static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val)
-{
-    int i, cnum, h, m, s, ms, keylen = strlen(key);
-    AVChapter *chapter = NULL;
-
-    if (keylen < 9 || sscanf(key, "CHAPTER%02d", &cnum) != 1)
-        return 0;
-
-    if (keylen == 9) {
-        if (sscanf(val, "%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)
-            return 0;
-
-        ff_new_chapter(as, cnum, (AVRational){1,1000},
-                       ms + 1000*(s + 60*(m + 60*h)),
-                       AV_NOPTS_VALUE, NULL);
-        av_free(val);
-    } else if (!strcmp(key+9, "NAME")) {
-        for(i = 0; i < as->nb_chapters; i++)
-            if (as->chapters[i]->id == cnum) {
-                chapter = as->chapters[i];
-                break;
-            }
-        if (!chapter)
-            return 0;
-
-        av_metadata_set2(&chapter->metadata, "title", val,
-                         AV_METADATA_DONT_STRDUP_VAL);
-    } else
-        return 0;
-
-    av_free(key);
-    return 1;
-}
-
-int
-ff_vorbis_comment(AVFormatContext * as, AVMetadata **m, const uint8_t *buf, int size)
-{
-    const uint8_t *p = buf;
-    const uint8_t *end = buf + size;
-    unsigned n, j;
-    int s;
-
-    if (size < 8) /* must have vendor_length and user_comment_list_length */
-        return -1;
-
-    s = bytestream_get_le32(&p);
-
-    if (end - p - 4 < s || s < 0)
-        return -1;
-
-    p += s;
-
-    n = bytestream_get_le32(&p);
-
-    while (end - p >= 4 && n > 0) {
-        const char *t, *v;
-        int tl, vl;
-
-        s = bytestream_get_le32(&p);
-
-        if (end - p < s || s < 0)
-            break;
-
-        t = p;
-        p += s;
-        n--;
-
-        v = memchr(t, '=', s);
-        if (!v)
-            continue;
-
-        tl = v - t;
-        vl = s - tl - 1;
-        v++;
-
-        if (tl && vl) {
-            char *tt, *ct;
-
-            tt = av_malloc(tl + 1);
-            ct = av_malloc(vl + 1);
-            if (!tt || !ct) {
-                av_freep(&tt);
-                av_freep(&ct);
-                av_log(as, AV_LOG_WARNING, "out-of-memory error. skipping VorbisComment tag.\n");
-                continue;
-            }
-
-            for (j = 0; j < tl; j++)
-                tt[j] = toupper(t[j]);
-            tt[tl] = 0;
-
-            memcpy(ct, v, vl);
-            ct[vl] = 0;
-
-            if (!ogm_chapter(as, tt, ct))
-                av_metadata_set2(m, tt, ct,
-                                   AV_METADATA_DONT_STRDUP_KEY |
-                                   AV_METADATA_DONT_STRDUP_VAL);
-        }
-    }
-
-    if (p != end)
-        av_log(as, AV_LOG_INFO, "%ti bytes of comment header remain\n", end-p);
-    if (n > 0)
-        av_log(as, AV_LOG_INFO,
-               "truncated comment header, %i comments not found\n", n);
-
-    return 0;
-}
-
-
-/** Parse the vorbis header
- * Vorbis Identification header from Vorbis_I_spec.html#vorbis-spec-codec
- * [vorbis_version] = read 32 bits as unsigned integer | Not used
- * [audio_channels] = read 8 bit integer as unsigned | Used
- * [audio_sample_rate] = read 32 bits as unsigned integer | Used
- * [bitrate_maximum] = read 32 bits as signed integer | Not used yet
- * [bitrate_nominal] = read 32 bits as signed integer | Not used yet
- * [bitrate_minimum] = read 32 bits as signed integer | Used as bitrate
- * [blocksize_0] = read 4 bits as unsigned integer | Not Used
- * [blocksize_1] = read 4 bits as unsigned integer | Not Used
- * [framing_flag] = read one bit | Not Used
- *    */
-
-struct oggvorbis_private {
-    unsigned int len[3];
-    unsigned char *packet[3];
-};
-
-
-static unsigned int
-fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv,
-                     uint8_t **buf)
-{
-    int i,offset, len;
-    unsigned char *ptr;
-
-    len = priv->len[0] + priv->len[1] + priv->len[2];
-    ptr = *buf = av_mallocz(len + len/255 + 64);
-
-    ptr[0] = 2;
-    offset = 1;
-    offset += av_xiphlacing(&ptr[offset], priv->len[0]);
-    offset += av_xiphlacing(&ptr[offset], priv->len[1]);
-    for (i = 0; i < 3; i++) {
-        memcpy(&ptr[offset], priv->packet[i], priv->len[i]);
-        offset += priv->len[i];
-        av_freep(&priv->packet[i]);
-    }
-    *buf = av_realloc(*buf, offset + FF_INPUT_BUFFER_PADDING_SIZE);
-    return offset;
-}
-
-
-static int
-vorbis_header (AVFormatContext * s, int idx)
-{
-    struct ogg *ogg = s->priv_data;
-    struct ogg_stream *os = ogg->streams + idx;
-    AVStream *st = s->streams[idx];
-    struct oggvorbis_private *priv;
-    int pkt_type = os->buf[os->pstart];
-
-    if (!(pkt_type & 1))
-        return 0;
-
-    if (!os->private) {
-        os->private = av_mallocz(sizeof(struct oggvorbis_private));
-        if (!os->private)
-            return 0;
-    }
-
-    if (os->psize < 1 || pkt_type > 5)
-        return -1;
-
-    priv = os->private;
-    priv->len[pkt_type >> 1] = os->psize;
-    priv->packet[pkt_type >> 1] = av_mallocz(os->psize);
-    memcpy(priv->packet[pkt_type >> 1], os->buf + os->pstart, os->psize);
-    if (os->buf[os->pstart] == 1) {
-        const uint8_t *p = os->buf + os->pstart + 7; /* skip "\001vorbis" tag */
-        unsigned blocksize, bs0, bs1;
-
-        if (os->psize != 30)
-            return -1;
-
-        if (bytestream_get_le32(&p) != 0) /* vorbis_version */
-            return -1;
-
-        st->codec->channels = bytestream_get_byte(&p);
-        st->codec->sample_rate = bytestream_get_le32(&p);
-        p += 4; // skip maximum bitrate
-        st->codec->bit_rate = bytestream_get_le32(&p); // nominal bitrate
-        p += 4; // skip minimum bitrate
-
-        blocksize = bytestream_get_byte(&p);
-        bs0 = blocksize & 15;
-        bs1 = blocksize >> 4;
-
-        if (bs0 > bs1)
-            return -1;
-        if (bs0 < 6 || bs1 > 13)
-            return -1;
-
-        if (bytestream_get_byte(&p) != 1) /* framing_flag */
-            return -1;
-
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = CODEC_ID_VORBIS;
-
-        st->time_base.num = 1;
-        st->time_base.den = st->codec->sample_rate;
-    } else if (os->buf[os->pstart] == 3) {
-        if (os->psize > 8)
-            ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 7, os->psize - 8);
-    } else {
-        st->codec->extradata_size =
-            fixup_vorbis_headers(s, priv, &st->codec->extradata);
-    }
-
-    return 1;
-}
-
-const struct ogg_codec ff_vorbis_codec = {
-    .magic = "\001vorbis",
-    .magicsize = 7,
-    .header = vorbis_header
-};
diff --git a/libavformat/oma.c b/libavformat/oma.c
deleted file mode 100644
index c12365e..0000000
--- a/libavformat/oma.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Sony OpenMG (OMA) demuxer
- *
- * Copyright (c) 2008 Maxim Poliakovski
- *               2008 Benjamin Larsson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * This is a demuxer for Sony OpenMG Music files
- *
- * Known file extensions: ".oma", "aa3"
- * The format of such files consists of three parts:
- * - "ea3" header carrying overall info and metadata.
- * - "EA3" header is a Sony-specific header containing information about
- *   the OpenMG file: codec type (usually ATRAC, can also be MP3 or WMA),
- *   codec specific info (packet size, sample rate, channels and so on)
- *   and DRM related info (file encryption, content id).
- * - Sound data organized in packets follow the EA3 header
- *   (can be encrypted using the Sony DRM!).
- *
- * LIMITATIONS: This version supports only plain (unencrypted) OMA files.
- * If any DRM-protected (encrypted) file is encountered you will get the
- * corresponding error message. Try to remove the encryption using any
- * Sony software (for example SonicStage).
- * CODEC SUPPORT: Only ATRAC3 codec is currently supported!
- */
-
-#include "avformat.h"
-#include "libavutil/intreadwrite.h"
-#include "raw.h"
-#include "riff.h"
-
-#define EA3_HEADER_SIZE 96
-
-enum {
-    OMA_CODECID_ATRAC3  = 0,
-    OMA_CODECID_ATRAC3P = 1,
-    OMA_CODECID_MP3     = 3,
-    OMA_CODECID_LPCM    = 4,
-    OMA_CODECID_WMA     = 5,
-};
-
-static const AVCodecTag codec_oma_tags[] = {
-    { CODEC_ID_ATRAC3,  OMA_CODECID_ATRAC3 },
-    { CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P },
-    { CODEC_ID_MP3,     OMA_CODECID_MP3 },
-};
-
-static int oma_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    static const uint16_t srate_tab[6] = {320,441,480,882,960,0};
-    int     ret, ea3_taglen, EA3_pos, framesize, jsflag, samplerate;
-    uint32_t codec_params;
-    int16_t eid;
-    uint8_t buf[EA3_HEADER_SIZE];
-    uint8_t *edata;
-    AVStream *st;
-
-    ret = get_buffer(s->pb, buf, 10);
-    if (ret != 10)
-        return -1;
-
-    if(!memcmp(buf, "ea3", 3)) {
-        ea3_taglen = ((buf[6] & 0x7f) << 21) | ((buf[7] & 0x7f) << 14) | ((buf[8] & 0x7f) << 7) | (buf[9] & 0x7f);
-
-        EA3_pos = ea3_taglen + 10;
-        if (buf[5] & 0x10)
-            EA3_pos += 10;
-
-        url_fseek(s->pb, EA3_pos, SEEK_SET);
-        ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
-        if (ret != EA3_HEADER_SIZE)
-            return -1;
-    } else {
-        ret = get_buffer(s->pb, buf + 10, EA3_HEADER_SIZE - 10);
-        EA3_pos = 0;
-    }
-
-    if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
-        av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
-        return -1;
-    }
-
-    eid = AV_RB16(&buf[6]);
-    if (eid != -1 && eid != -128) {
-        av_log(s, AV_LOG_ERROR, "Encrypted file! Eid: %d\n", eid);
-        return -1;
-    }
-
-    codec_params = AV_RB24(&buf[33]);
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->start_time = 0;
-    st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_tag   = buf[32];
-    st->codec->codec_id    = ff_codec_get_id(codec_oma_tags, st->codec->codec_tag);
-
-    switch (buf[32]) {
-        case OMA_CODECID_ATRAC3:
-            samplerate = srate_tab[(codec_params >> 13) & 7]*100;
-            if (samplerate != 44100)
-                av_log(s, AV_LOG_ERROR, "Unsupported sample rate, send sample file to developers: %d\n", samplerate);
-
-            framesize = (codec_params & 0x3FF) * 8;
-            jsflag = (codec_params >> 17) & 1; /* get stereo coding mode, 1 for joint-stereo */
-            st->codec->channels    = 2;
-            st->codec->sample_rate = samplerate;
-            st->codec->bit_rate    = st->codec->sample_rate * framesize * 8 / 1024;
-
-            /* fake the atrac3 extradata (wav format, makes stream copy to wav work) */
-            st->codec->extradata_size = 14;
-            edata = av_mallocz(14 + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (!edata)
-                return AVERROR(ENOMEM);
-
-            st->codec->extradata = edata;
-            AV_WL16(&edata[0],  1);             // always 1
-            AV_WL32(&edata[2],  samplerate);    // samples rate
-            AV_WL16(&edata[6],  jsflag);        // coding mode
-            AV_WL16(&edata[8],  jsflag);        // coding mode
-            AV_WL16(&edata[10], 1);             // always 1
-            // AV_WL16(&edata[12], 0);          // always 0
-
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-            break;
-        case OMA_CODECID_ATRAC3P:
-            st->codec->channels = (codec_params >> 10) & 7;
-            framesize = ((codec_params & 0x3FF) * 8) + 8;
-            st->codec->sample_rate = srate_tab[(codec_params >> 13) & 7]*100;
-            st->codec->bit_rate    = st->codec->sample_rate * framesize * 8 / 1024;
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-            av_log(s, AV_LOG_ERROR, "Unsupported codec ATRAC3+!\n");
-            break;
-        case OMA_CODECID_MP3:
-            st->need_parsing = AVSTREAM_PARSE_FULL;
-            framesize = 1024;
-            break;
-        default:
-            av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n",buf[32]);
-            return -1;
-            break;
-    }
-
-    st->codec->block_align = framesize;
-    url_fseek(s->pb, EA3_pos + EA3_HEADER_SIZE, SEEK_SET);
-
-    return 0;
-}
-
-
-static int oma_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret = av_get_packet(s->pb, pkt, s->streams[0]->codec->block_align);
-
-    pkt->stream_index = 0;
-    if (ret <= 0)
-        return AVERROR(EIO);
-
-    return ret;
-}
-
-static int oma_read_probe(AVProbeData *p)
-{
-    if (!memcmp(p->buf, ((const uint8_t[]){'e', 'a', '3', 3, 0}), 5) ||
-        (!memcmp(p->buf, "EA3", 3) &&
-         !p->buf[4] && p->buf[5] == EA3_HEADER_SIZE))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-
-AVInputFormat oma_demuxer = {
-    "oma",
-    NULL_IF_CONFIG_SMALL("Sony OpenMG audio"),
-    0,
-    oma_read_probe,
-    oma_read_header,
-    oma_read_packet,
-    0,
-    pcm_read_seek,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "oma,aa3",
-    .codec_tag= (const AVCodecTag* const []){codec_oma_tags, 0},
-};
-
diff --git a/libavformat/options.c b/libavformat/options.c
deleted file mode 100644
index 0c1ac2d..0000000
--- a/libavformat/options.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "libavcodec/opt.h"
-
-/**
- * @file
- * Options definition for AVFormatContext.
- */
-
-static const char* format_to_name(void* ptr)
-{
-    AVFormatContext* fc = (AVFormatContext*) ptr;
-    if(fc->iformat) return fc->iformat->name;
-    else if(fc->oformat) return fc->oformat->name;
-    else return "NULL";
-}
-
-#define OFFSET(x) offsetof(AVFormatContext,x)
-#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
-//these names are too long to be readable
-#define E AV_OPT_FLAG_ENCODING_PARAM
-#define D AV_OPT_FLAG_DECODING_PARAM
-
-static const AVOption options[]={
-{"probesize", "set probing size", OFFSET(probesize), FF_OPT_TYPE_INT, 5000000, 32, INT_MAX, D},
-{"muxrate", "set mux rate", OFFSET(mux_rate), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
-{"packetsize", "set packet size", OFFSET(packet_size), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
-{"fflags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, INT_MIN, INT_MAX, D|E, "fflags"},
-{"ignidx", "ignore index", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNIDX, INT_MIN, INT_MAX, D, "fflags"},
-{"genpts", "generate pts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_GENPTS, INT_MIN, INT_MAX, D, "fflags"},
-{"nofillin", "do not fill in missing values that can be exactly calculated", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOFILLIN, INT_MIN, INT_MAX, D, "fflags"},
-{"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOPARSE, INT_MIN, INT_MAX, D, "fflags"},
-{"igndts", "ingore dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNDTS, INT_MIN, INT_MAX, D, "fflags"},
-{"rtphint", "add rtp hinting", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_RTP_HINT, INT_MIN, INT_MAX, E, "fflags"},
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-{"track", " set the track number", OFFSET(track), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, E},
-{"year", "set the year", OFFSET(year), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, E},
-#endif
-{"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, 5*AV_TIME_BASE, 0, INT_MAX, D},
-{"cryptokey", "decryption key", OFFSET(key), FF_OPT_TYPE_BINARY, 0, 0, 0, D},
-{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), FF_OPT_TYPE_INT, 1<<20, 0, INT_MAX, D},
-{"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), FF_OPT_TYPE_INT, 3041280, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */
-{"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, DEFAULT, 0, INT_MAX, E|D, "fdebug"},
-{"ts", NULL, 0, FF_OPT_TYPE_CONST, FF_FDEBUG_TS, INT_MIN, INT_MAX, E|D, "fdebug"},
-{NULL},
-};
-
-#undef E
-#undef D
-#undef DEFAULT
-
-static const AVClass av_format_context_class = { "AVFormatContext", format_to_name, options, LIBAVUTIL_VERSION_INT };
-
-static void avformat_get_context_defaults(AVFormatContext *s)
-{
-    memset(s, 0, sizeof(AVFormatContext));
-
-    s->av_class = &av_format_context_class;
-
-    av_opt_set_defaults(s);
-}
-
-AVFormatContext *avformat_alloc_context(void)
-{
-    AVFormatContext *ic;
-    ic = av_malloc(sizeof(AVFormatContext));
-    if (!ic) return ic;
-    avformat_get_context_defaults(ic);
-    ic->av_class = &av_format_context_class;
-    return ic;
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-AVFormatContext *av_alloc_format_context(void)
-{
-    return avformat_alloc_context();
-}
-#endif
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
deleted file mode 100644
index 2786303..0000000
--- a/libavformat/os_support.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Various utilities for ffmpeg system
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * copyright (c) 2002 Francois Revol
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* needed by inet_aton() */
-#define _SVID_SOURCE
-#define _DARWIN_C_SOURCE
-
-#include "config.h"
-#include "avformat.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include "os_support.h"
-
-#if CONFIG_NETWORK
-#if !HAVE_POLL_H
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#elif HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#endif
-
-#include "network.h"
-
-#if !HAVE_INET_ATON
-#include <stdlib.h>
-#include <strings.h>
-
-int ff_inet_aton (const char * str, struct in_addr * add)
-{
-    unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
-
-    if (sscanf(str, "%d.%d.%d.%d", &add1, &add2, &add3, &add4) != 4)
-        return 0;
-
-    if (!add1 || (add1|add2|add3|add4) > 255) return 0;
-
-    add->s_addr = htonl((add1 << 24) + (add2 << 16) + (add3 << 8) + add4);
-
-    return 1;
-}
-#else
-int ff_inet_aton (const char * str, struct in_addr * add)
-{
-    return inet_aton(str, add);
-}
-#endif /* !HAVE_INET_ATON */
-
-#if !HAVE_GETADDRINFO
-int ff_getaddrinfo(const char *node, const char *service,
-                const struct addrinfo *hints, struct addrinfo **res)
-{
-    struct hostent *h = NULL;
-    struct addrinfo *ai;
-    struct sockaddr_in *sin;
-
-#if HAVE_WINSOCK2_H
-    int (WSAAPI *win_getaddrinfo)(const char *node, const char *service,
-                                  const struct addrinfo *hints,
-                                  struct addrinfo **res);
-    HMODULE ws2mod = GetModuleHandle("ws2_32.dll");
-    win_getaddrinfo = GetProcAddress(ws2mod, "getaddrinfo");
-    if (win_getaddrinfo)
-        return win_getaddrinfo(node, service, hints, res);
-#endif
-
-    *res = NULL;
-    sin = av_mallocz(sizeof(struct sockaddr_in));
-    if (!sin)
-        return EAI_FAIL;
-    sin->sin_family = AF_INET;
-
-    if (node) {
-        if (!ff_inet_aton(node, &sin->sin_addr)) {
-            if (hints && (hints->ai_flags & AI_NUMERICHOST)) {
-                av_free(sin);
-                return EAI_FAIL;
-            }
-            h = gethostbyname(node);
-            if (!h) {
-                av_free(sin);
-                return EAI_FAIL;
-            }
-            memcpy(&sin->sin_addr, h->h_addr_list[0], sizeof(struct in_addr));
-        }
-    } else {
-        if (hints && (hints->ai_flags & AI_PASSIVE)) {
-            sin->sin_addr.s_addr = INADDR_ANY;
-        } else
-            sin->sin_addr.s_addr = INADDR_LOOPBACK;
-    }
-
-    /* Note: getaddrinfo allows service to be a string, which
-     * should be looked up using getservbyname. */
-    if (service)
-        sin->sin_port = htons(atoi(service));
-
-    ai = av_mallocz(sizeof(struct addrinfo));
-    if (!ai) {
-        av_free(sin);
-        return EAI_FAIL;
-    }
-
-    *res = ai;
-    ai->ai_family = AF_INET;
-    ai->ai_socktype = hints ? hints->ai_socktype : 0;
-    switch (ai->ai_socktype) {
-    case SOCK_STREAM: ai->ai_protocol = IPPROTO_TCP; break;
-    case SOCK_DGRAM:  ai->ai_protocol = IPPROTO_UDP; break;
-    default:          ai->ai_protocol = 0;           break;
-    }
-
-    ai->ai_addr = (struct sockaddr *)sin;
-    ai->ai_addrlen = sizeof(struct sockaddr_in);
-    if (hints && (hints->ai_flags & AI_CANONNAME))
-        ai->ai_canonname = h ? av_strdup(h->h_name) : NULL;
-
-    ai->ai_next = NULL;
-    return 0;
-}
-
-void ff_freeaddrinfo(struct addrinfo *res)
-{
-#if HAVE_WINSOCK2_H
-    void (WSAAPI *win_freeaddrinfo)(struct addrinfo *res);
-    HMODULE ws2mod = GetModuleHandle("ws2_32.dll");
-    win_freeaddrinfo = (void (WSAAPI *)(struct addrinfo *res))
-                       GetProcAddress(ws2mod, "freeaddrinfo");
-    if (win_freeaddrinfo) {
-        win_freeaddrinfo(res);
-        return;
-    }
-#endif
-
-    av_free(res->ai_canonname);
-    av_free(res->ai_addr);
-    av_free(res);
-}
-
-int ff_getnameinfo(const struct sockaddr *sa, int salen,
-                   char *host, int hostlen,
-                   char *serv, int servlen, int flags)
-{
-    const struct sockaddr_in *sin = (const struct sockaddr_in *)sa;
-
-#if HAVE_WINSOCK2_H
-    int (WSAAPI *win_getnameinfo)(const struct sockaddr *sa, socklen_t salen,
-                                  char *host, DWORD hostlen,
-                                  char *serv, DWORD servlen, int flags);
-    HMODULE ws2mod = GetModuleHandle("ws2_32.dll");
-    win_getnameinfo = GetProcAddress(ws2mod, "getnameinfo");
-    if (win_getnameinfo)
-        return win_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags);
-#endif
-
-    if (sa->sa_family != AF_INET)
-        return EAI_FAMILY;
-    if (!host && !serv)
-        return EAI_NONAME;
-
-    if (host && hostlen > 0) {
-        struct hostent *ent = NULL;
-        uint32_t a;
-        if (!(flags & NI_NUMERICHOST))
-            ent = gethostbyaddr((const char *)&sin->sin_addr,
-                                sizeof(sin->sin_addr), AF_INET);
-
-        if (ent) {
-            snprintf(host, hostlen, "%s", ent->h_name);
-        } else if (flags & NI_NAMERQD) {
-            return EAI_NONAME;
-        } else {
-            a = ntohl(sin->sin_addr.s_addr);
-            snprintf(host, hostlen, "%d.%d.%d.%d",
-                     ((a >> 24) & 0xff), ((a >> 16) & 0xff),
-                     ((a >>  8) & 0xff), ( a        & 0xff));
-        }
-    }
-
-    if (serv && servlen > 0) {
-        struct servent *ent = NULL;
-        if (!(flags & NI_NUMERICSERV))
-            ent = getservbyport(sin->sin_port, flags & NI_DGRAM ? "udp" : "tcp");
-
-        if (ent) {
-            snprintf(serv, servlen, "%s", ent->s_name);
-        } else
-            snprintf(serv, servlen, "%d", ntohs(sin->sin_port));
-    }
-
-    return 0;
-}
-
-const char *ff_gai_strerror(int ecode)
-{
-    switch(ecode) {
-    case EAI_FAIL   : return "A non-recoverable error occurred";
-    case EAI_FAMILY : return "The address family was not recognized or the address length was invalid for the specified family";
-    case EAI_NONAME : return "The name does not resolve for the supplied parameters";
-    }
-
-    return "Unknown error";
-}
-#endif
-
-int ff_socket_nonblock(int socket, int enable)
-{
-#if HAVE_WINSOCK2_H
-   return ioctlsocket(socket, FIONBIO, &enable);
-#else
-   if (enable)
-      return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK);
-   else
-      return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK);
-#endif
-}
-#endif /* CONFIG_NETWORK */
-
-#if CONFIG_FFSERVER
-#if !HAVE_POLL_H
-int poll(struct pollfd *fds, nfds_t numfds, int timeout)
-{
-    fd_set read_set;
-    fd_set write_set;
-    fd_set exception_set;
-    nfds_t i;
-    int n;
-    int rc;
-
-#if HAVE_WINSOCK2_H
-    if (numfds >= FD_SETSIZE) {
-        errno = EINVAL;
-        return -1;
-    }
-#endif
-
-    FD_ZERO(&read_set);
-    FD_ZERO(&write_set);
-    FD_ZERO(&exception_set);
-
-    n = -1;
-    for(i = 0; i < numfds; i++) {
-        if (fds[i].fd < 0)
-            continue;
-#if !HAVE_WINSOCK2_H
-        if (fds[i].fd >= FD_SETSIZE) {
-            errno = EINVAL;
-            return -1;
-        }
-#endif
-
-        if (fds[i].events & POLLIN)  FD_SET(fds[i].fd, &read_set);
-        if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set);
-        if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set);
-
-        if (fds[i].fd > n)
-            n = fds[i].fd;
-    };
-
-    if (n == -1)
-        /* Hey!? Nothing to poll, in fact!!! */
-        return 0;
-
-    if (timeout < 0)
-        rc = select(n+1, &read_set, &write_set, &exception_set, NULL);
-    else {
-        struct timeval    tv;
-
-        tv.tv_sec = timeout / 1000;
-        tv.tv_usec = 1000 * (timeout % 1000);
-        rc = select(n+1, &read_set, &write_set, &exception_set, &tv);
-    };
-
-    if (rc < 0)
-        return rc;
-
-    for(i = 0; i < (nfds_t) n; i++) {
-        fds[i].revents = 0;
-
-        if (FD_ISSET(fds[i].fd, &read_set))      fds[i].revents |= POLLIN;
-        if (FD_ISSET(fds[i].fd, &write_set))     fds[i].revents |= POLLOUT;
-        if (FD_ISSET(fds[i].fd, &exception_set)) fds[i].revents |= POLLERR;
-    };
-
-    return rc;
-}
-#endif /* HAVE_POLL_H */
-#endif /* CONFIG_FFSERVER */
-
diff --git a/libavformat/os_support.h b/libavformat/os_support.h
deleted file mode 100644
index e90f2c2..0000000
--- a/libavformat/os_support.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * various utilities for ffmpeg system
- * copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_OS_SUPPORT_H
-#define AVFORMAT_OS_SUPPORT_H
-
-/**
- * @file
- * miscellaneous OS support macros and functions.
- */
-
-#include "config.h"
-
-#if defined(__MINGW32__) && !defined(__MINGW32CE__)
-#  include <fcntl.h>
-#  define lseek(f,p,w) _lseeki64((f), (p), (w))
-#endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */
-
-static inline int is_dos_path(const char *path)
-{
-#if HAVE_DOS_PATHS
-    if (path[0] && path[1] == ':')
-        return 1;
-#endif
-    return 0;
-}
-
-#ifdef __BEOS__
-#  include <sys/socket.h>
-#  include <netinet/in.h>
-   /* not net_server ? */
-#  include <BeBuild.h>
-   /* R5 didn't have usleep, fake it. Haiku and Zeta has it now. */
-#  if B_BEOS_VERSION <= B_BEOS_VERSION_5
-#    include <OS.h>
-     /* doesn't set errno but that's enough */
-#    define usleep(t)  snooze((bigtime_t)(t))
-#  endif
-#  ifndef SA_RESTART
-#    warning SA_RESTART not implemented; ffserver might misbehave.
-#    define SA_RESTART 0
-#  endif
-#endif
-
-#if CONFIG_NETWORK
-#if !HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
-
-/* most of the time closing a socket is just closing an fd */
-#if !HAVE_CLOSESOCKET
-#define closesocket close
-#endif
-
-#if CONFIG_FFSERVER
-#if !HAVE_POLL_H
-typedef unsigned long nfds_t;
-
-struct pollfd {
-    int fd;
-    short events;  /* events to look for */
-    short revents; /* events that occurred */
-};
-
-/* events & revents */
-#define POLLIN     0x0001  /* any readable data available */
-#define POLLOUT    0x0002  /* file descriptor is writeable */
-#define POLLRDNORM POLLIN
-#define POLLWRNORM POLLOUT
-#define POLLRDBAND 0x0008  /* priority readable data */
-#define POLLWRBAND 0x0010  /* priority data can be written */
-#define POLLPRI    0x0020  /* high priority readable data */
-
-/* revents only */
-#define POLLERR    0x0004  /* errors pending */
-#define POLLHUP    0x0080  /* disconnected */
-#define POLLNVAL   0x1000  /* invalid file descriptor */
-
-
-int poll(struct pollfd *fds, nfds_t numfds, int timeout);
-#endif /* HAVE_POLL_H */
-#endif /* CONFIG_FFSERVER */
-#endif /* CONFIG_NETWORK */
-
-#endif /* AVFORMAT_OS_SUPPORT_H */
diff --git a/libavformat/output-example.c b/libavformat/output-example.c
deleted file mode 100644
index dd61cfe..0000000
--- a/libavformat/output-example.c
+++ /dev/null
@@ -1,554 +0,0 @@
-/*
- * Libavformat API example: Output a media file in any supported
- * libavformat format. The default codecs are used.
- *
- * Copyright (c) 2003 Fabrice Bellard
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include "libavformat/avformat.h"
-#include "libswscale/swscale.h"
-
-#undef exit
-
-/* 5 seconds stream duration */
-#define STREAM_DURATION   5.0
-#define STREAM_FRAME_RATE 25 /* 25 images/s */
-#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))
-#define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */
-
-static int sws_flags = SWS_BICUBIC;
-
-/**************************************************************/
-/* audio output */
-
-float t, tincr, tincr2;
-int16_t *samples;
-uint8_t *audio_outbuf;
-int audio_outbuf_size;
-int audio_input_frame_size;
-
-/*
- * add an audio output stream
- */
-static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
-{
-    AVCodecContext *c;
-    AVStream *st;
-
-    st = av_new_stream(oc, 1);
-    if (!st) {
-        fprintf(stderr, "Could not alloc stream\n");
-        exit(1);
-    }
-
-    c = st->codec;
-    c->codec_id = codec_id;
-    c->codec_type = AVMEDIA_TYPE_AUDIO;
-
-    /* put sample parameters */
-    c->bit_rate = 64000;
-    c->sample_rate = 44100;
-    c->channels = 2;
-
-    // some formats want stream headers to be separate
-    if(oc->oformat->flags & AVFMT_GLOBALHEADER)
-        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-
-    return st;
-}
-
-static void open_audio(AVFormatContext *oc, AVStream *st)
-{
-    AVCodecContext *c;
-    AVCodec *codec;
-
-    c = st->codec;
-
-    /* find the audio encoder */
-    codec = avcodec_find_encoder(c->codec_id);
-    if (!codec) {
-        fprintf(stderr, "codec not found\n");
-        exit(1);
-    }
-
-    /* open it */
-    if (avcodec_open(c, codec) < 0) {
-        fprintf(stderr, "could not open codec\n");
-        exit(1);
-    }
-
-    /* init signal generator */
-    t = 0;
-    tincr = 2 * M_PI * 110.0 / c->sample_rate;
-    /* increment frequency by 110 Hz per second */
-    tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate;
-
-    audio_outbuf_size = 10000;
-    audio_outbuf = av_malloc(audio_outbuf_size);
-
-    /* ugly hack for PCM codecs (will be removed ASAP with new PCM
-       support to compute the input frame size in samples */
-    if (c->frame_size <= 1) {
-        audio_input_frame_size = audio_outbuf_size / c->channels;
-        switch(st->codec->codec_id) {
-        case CODEC_ID_PCM_S16LE:
-        case CODEC_ID_PCM_S16BE:
-        case CODEC_ID_PCM_U16LE:
-        case CODEC_ID_PCM_U16BE:
-            audio_input_frame_size >>= 1;
-            break;
-        default:
-            break;
-        }
-    } else {
-        audio_input_frame_size = c->frame_size;
-    }
-    samples = av_malloc(audio_input_frame_size * 2 * c->channels);
-}
-
-/* prepare a 16 bit dummy audio frame of 'frame_size' samples and
-   'nb_channels' channels */
-static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
-{
-    int j, i, v;
-    int16_t *q;
-
-    q = samples;
-    for(j=0;j<frame_size;j++) {
-        v = (int)(sin(t) * 10000);
-        for(i = 0; i < nb_channels; i++)
-            *q++ = v;
-        t += tincr;
-        tincr += tincr2;
-    }
-}
-
-static void write_audio_frame(AVFormatContext *oc, AVStream *st)
-{
-    AVCodecContext *c;
-    AVPacket pkt;
-    av_init_packet(&pkt);
-
-    c = st->codec;
-
-    get_audio_frame(samples, audio_input_frame_size, c->channels);
-
-    pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples);
-
-    if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
-        pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
-    pkt.flags |= AV_PKT_FLAG_KEY;
-    pkt.stream_index= st->index;
-    pkt.data= audio_outbuf;
-
-    /* write the compressed frame in the media file */
-    if (av_interleaved_write_frame(oc, &pkt) != 0) {
-        fprintf(stderr, "Error while writing audio frame\n");
-        exit(1);
-    }
-}
-
-static void close_audio(AVFormatContext *oc, AVStream *st)
-{
-    avcodec_close(st->codec);
-
-    av_free(samples);
-    av_free(audio_outbuf);
-}
-
-/**************************************************************/
-/* video output */
-
-AVFrame *picture, *tmp_picture;
-uint8_t *video_outbuf;
-int frame_count, video_outbuf_size;
-
-/* add a video output stream */
-static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
-{
-    AVCodecContext *c;
-    AVStream *st;
-
-    st = av_new_stream(oc, 0);
-    if (!st) {
-        fprintf(stderr, "Could not alloc stream\n");
-        exit(1);
-    }
-
-    c = st->codec;
-    c->codec_id = codec_id;
-    c->codec_type = AVMEDIA_TYPE_VIDEO;
-
-    /* put sample parameters */
-    c->bit_rate = 400000;
-    /* resolution must be a multiple of two */
-    c->width = 352;
-    c->height = 288;
-    /* time base: this is the fundamental unit of time (in seconds) in terms
-       of which frame timestamps are represented. for fixed-fps content,
-       timebase should be 1/framerate and timestamp increments should be
-       identically 1. */
-    c->time_base.den = STREAM_FRAME_RATE;
-    c->time_base.num = 1;
-    c->gop_size = 12; /* emit one intra frame every twelve frames at most */
-    c->pix_fmt = STREAM_PIX_FMT;
-    if (c->codec_id == CODEC_ID_MPEG2VIDEO) {
-        /* just for testing, we also add B frames */
-        c->max_b_frames = 2;
-    }
-    if (c->codec_id == CODEC_ID_MPEG1VIDEO){
-        /* Needed to avoid using macroblocks in which some coeffs overflow.
-           This does not happen with normal video, it just happens here as
-           the motion of the chroma plane does not match the luma plane. */
-        c->mb_decision=2;
-    }
-    // some formats want stream headers to be separate
-    if(oc->oformat->flags & AVFMT_GLOBALHEADER)
-        c->flags |= CODEC_FLAG_GLOBAL_HEADER;
-
-    return st;
-}
-
-static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height)
-{
-    AVFrame *picture;
-    uint8_t *picture_buf;
-    int size;
-
-    picture = avcodec_alloc_frame();
-    if (!picture)
-        return NULL;
-    size = avpicture_get_size(pix_fmt, width, height);
-    picture_buf = av_malloc(size);
-    if (!picture_buf) {
-        av_free(picture);
-        return NULL;
-    }
-    avpicture_fill((AVPicture *)picture, picture_buf,
-                   pix_fmt, width, height);
-    return picture;
-}
-
-static void open_video(AVFormatContext *oc, AVStream *st)
-{
-    AVCodec *codec;
-    AVCodecContext *c;
-
-    c = st->codec;
-
-    /* find the video encoder */
-    codec = avcodec_find_encoder(c->codec_id);
-    if (!codec) {
-        fprintf(stderr, "codec not found\n");
-        exit(1);
-    }
-
-    /* open the codec */
-    if (avcodec_open(c, codec) < 0) {
-        fprintf(stderr, "could not open codec\n");
-        exit(1);
-    }
-
-    video_outbuf = NULL;
-    if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
-        /* allocate output buffer */
-        /* XXX: API change will be done */
-        /* buffers passed into lav* can be allocated any way you prefer,
-           as long as they're aligned enough for the architecture, and
-           they're freed appropriately (such as using av_free for buffers
-           allocated with av_malloc) */
-        video_outbuf_size = 200000;
-        video_outbuf = av_malloc(video_outbuf_size);
-    }
-
-    /* allocate the encoded raw picture */
-    picture = alloc_picture(c->pix_fmt, c->width, c->height);
-    if (!picture) {
-        fprintf(stderr, "Could not allocate picture\n");
-        exit(1);
-    }
-
-    /* if the output format is not YUV420P, then a temporary YUV420P
-       picture is needed too. It is then converted to the required
-       output format */
-    tmp_picture = NULL;
-    if (c->pix_fmt != PIX_FMT_YUV420P) {
-        tmp_picture = alloc_picture(PIX_FMT_YUV420P, c->width, c->height);
-        if (!tmp_picture) {
-            fprintf(stderr, "Could not allocate temporary picture\n");
-            exit(1);
-        }
-    }
-}
-
-/* prepare a dummy image */
-static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height)
-{
-    int x, y, i;
-
-    i = frame_index;
-
-    /* Y */
-    for(y=0;y<height;y++) {
-        for(x=0;x<width;x++) {
-            pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3;
-        }
-    }
-
-    /* Cb and Cr */
-    for(y=0;y<height/2;y++) {
-        for(x=0;x<width/2;x++) {
-            pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2;
-            pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5;
-        }
-    }
-}
-
-static void write_video_frame(AVFormatContext *oc, AVStream *st)
-{
-    int out_size, ret;
-    AVCodecContext *c;
-    static struct SwsContext *img_convert_ctx;
-
-    c = st->codec;
-
-    if (frame_count >= STREAM_NB_FRAMES) {
-        /* no more frame to compress. The codec has a latency of a few
-           frames if using B frames, so we get the last frames by
-           passing the same picture again */
-    } else {
-        if (c->pix_fmt != PIX_FMT_YUV420P) {
-            /* as we only generate a YUV420P picture, we must convert it
-               to the codec pixel format if needed */
-            if (img_convert_ctx == NULL) {
-                img_convert_ctx = sws_getContext(c->width, c->height,
-                                                 PIX_FMT_YUV420P,
-                                                 c->width, c->height,
-                                                 c->pix_fmt,
-                                                 sws_flags, NULL, NULL, NULL);
-                if (img_convert_ctx == NULL) {
-                    fprintf(stderr, "Cannot initialize the conversion context\n");
-                    exit(1);
-                }
-            }
-            fill_yuv_image(tmp_picture, frame_count, c->width, c->height);
-            sws_scale(img_convert_ctx, tmp_picture->data, tmp_picture->linesize,
-                      0, c->height, picture->data, picture->linesize);
-        } else {
-            fill_yuv_image(picture, frame_count, c->width, c->height);
-        }
-    }
-
-
-    if (oc->oformat->flags & AVFMT_RAWPICTURE) {
-        /* raw video case. The API will change slightly in the near
-           futur for that */
-        AVPacket pkt;
-        av_init_packet(&pkt);
-
-        pkt.flags |= AV_PKT_FLAG_KEY;
-        pkt.stream_index= st->index;
-        pkt.data= (uint8_t *)picture;
-        pkt.size= sizeof(AVPicture);
-
-        ret = av_interleaved_write_frame(oc, &pkt);
-    } else {
-        /* encode the image */
-        out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture);
-        /* if zero size, it means the image was buffered */
-        if (out_size > 0) {
-            AVPacket pkt;
-            av_init_packet(&pkt);
-
-            if (c->coded_frame->pts != AV_NOPTS_VALUE)
-                pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
-            if(c->coded_frame->key_frame)
-                pkt.flags |= AV_PKT_FLAG_KEY;
-            pkt.stream_index= st->index;
-            pkt.data= video_outbuf;
-            pkt.size= out_size;
-
-            /* write the compressed frame in the media file */
-            ret = av_interleaved_write_frame(oc, &pkt);
-        } else {
-            ret = 0;
-        }
-    }
-    if (ret != 0) {
-        fprintf(stderr, "Error while writing video frame\n");
-        exit(1);
-    }
-    frame_count++;
-}
-
-static void close_video(AVFormatContext *oc, AVStream *st)
-{
-    avcodec_close(st->codec);
-    av_free(picture->data[0]);
-    av_free(picture);
-    if (tmp_picture) {
-        av_free(tmp_picture->data[0]);
-        av_free(tmp_picture);
-    }
-    av_free(video_outbuf);
-}
-
-/**************************************************************/
-/* media file output */
-
-int main(int argc, char **argv)
-{
-    const char *filename;
-    AVOutputFormat *fmt;
-    AVFormatContext *oc;
-    AVStream *audio_st, *video_st;
-    double audio_pts, video_pts;
-    int i;
-
-    /* initialize libavcodec, and register all codecs and formats */
-    av_register_all();
-
-    if (argc != 2) {
-        printf("usage: %s output_file\n"
-               "API example program to output a media file with libavformat.\n"
-               "The output format is automatically guessed according to the file extension.\n"
-               "Raw images can also be output by using '%%d' in the filename\n"
-               "\n", argv[0]);
-        exit(1);
-    }
-
-    filename = argv[1];
-
-    /* auto detect the output format from the name. default is
-       mpeg. */
-    fmt = av_guess_format(NULL, filename, NULL);
-    if (!fmt) {
-        printf("Could not deduce output format from file extension: using MPEG.\n");
-        fmt = av_guess_format("mpeg", NULL, NULL);
-    }
-    if (!fmt) {
-        fprintf(stderr, "Could not find suitable output format\n");
-        exit(1);
-    }
-
-    /* allocate the output media context */
-    oc = avformat_alloc_context();
-    if (!oc) {
-        fprintf(stderr, "Memory error\n");
-        exit(1);
-    }
-    oc->oformat = fmt;
-    snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
-
-    /* add the audio and video streams using the default format codecs
-       and initialize the codecs */
-    video_st = NULL;
-    audio_st = NULL;
-    if (fmt->video_codec != CODEC_ID_NONE) {
-        video_st = add_video_stream(oc, fmt->video_codec);
-    }
-    if (fmt->audio_codec != CODEC_ID_NONE) {
-        audio_st = add_audio_stream(oc, fmt->audio_codec);
-    }
-
-    /* set the output parameters (must be done even if no
-       parameters). */
-    if (av_set_parameters(oc, NULL) < 0) {
-        fprintf(stderr, "Invalid output format parameters\n");
-        exit(1);
-    }
-
-    dump_format(oc, 0, filename, 1);
-
-    /* now that all the parameters are set, we can open the audio and
-       video codecs and allocate the necessary encode buffers */
-    if (video_st)
-        open_video(oc, video_st);
-    if (audio_st)
-        open_audio(oc, audio_st);
-
-    /* open the output file, if needed */
-    if (!(fmt->flags & AVFMT_NOFILE)) {
-        if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) {
-            fprintf(stderr, "Could not open '%s'\n", filename);
-            exit(1);
-        }
-    }
-
-    /* write the stream header, if any */
-    av_write_header(oc);
-
-    for(;;) {
-        /* compute current audio and video time */
-        if (audio_st)
-            audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
-        else
-            audio_pts = 0.0;
-
-        if (video_st)
-            video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
-        else
-            video_pts = 0.0;
-
-        if ((!audio_st || audio_pts >= STREAM_DURATION) &&
-            (!video_st || video_pts >= STREAM_DURATION))
-            break;
-
-        /* write interleaved audio and video frames */
-        if (!video_st || (video_st && audio_st && audio_pts < video_pts)) {
-            write_audio_frame(oc, audio_st);
-        } else {
-            write_video_frame(oc, video_st);
-        }
-    }
-
-    /* write the trailer, if any.  the trailer must be written
-     * before you close the CodecContexts open when you wrote the
-     * header; otherwise write_trailer may try to use memory that
-     * was freed on av_codec_close() */
-    av_write_trailer(oc);
-
-    /* close each codec */
-    if (video_st)
-        close_video(oc, video_st);
-    if (audio_st)
-        close_audio(oc, audio_st);
-
-    /* free the streams */
-    for(i = 0; i < oc->nb_streams; i++) {
-        av_freep(&oc->streams[i]->codec);
-        av_freep(&oc->streams[i]);
-    }
-
-    if (!(fmt->flags & AVFMT_NOFILE)) {
-        /* close the output file */
-        url_fclose(oc->pb);
-    }
-
-    /* free the stream */
-    av_free(oc);
-
-    return 0;
-}
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
deleted file mode 100644
index 347c26e..0000000
--- a/libavformat/psxstr.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Sony Playstation (PSX) STR File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * PSX STR file demuxer
- * by Mike Melanson (melanson at pcisys.net)
- * This module handles streams that have been ripped from Sony Playstation
- * CD games. This demuxer can handle either raw STR files (which are just
- * concatenations of raw compact disc sectors) or STR files with 0x2C-byte
- * RIFF headers, followed by CD sectors.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
-#define CDXA_TAG MKTAG('C', 'D', 'X', 'A')
-
-#define RAW_CD_SECTOR_SIZE      2352
-#define RAW_CD_SECTOR_DATA_SIZE 2304
-#define VIDEO_DATA_CHUNK_SIZE   0x7E0
-#define VIDEO_DATA_HEADER_SIZE  0x38
-#define RIFF_HEADER_SIZE        0x2C
-
-#define CDXA_TYPE_MASK     0x0E
-#define CDXA_TYPE_DATA     0x08
-#define CDXA_TYPE_AUDIO    0x04
-#define CDXA_TYPE_VIDEO    0x02
-
-#define STR_MAGIC (0x80010160)
-
-typedef struct StrChannel {
-    /* video parameters */
-    int video_stream_index;
-    AVPacket tmp_pkt;
-
-    /* audio parameters */
-    int audio_stream_index;
-} StrChannel;
-
-typedef struct StrDemuxContext {
-
-    /* a STR file can contain up to 32 channels of data */
-    StrChannel channels[32];
-} StrDemuxContext;
-
-static const char sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00};
-
-static int str_probe(AVProbeData *p)
-{
-    uint8_t *sector= p->buf;
-
-    if (p->buf_size < RAW_CD_SECTOR_SIZE)
-        return 0;
-
-    if ((AV_RL32(&p->buf[0]) == RIFF_TAG) &&
-        (AV_RL32(&p->buf[8]) == CDXA_TAG)) {
-
-        /* RIFF header seen; skip 0x2C bytes */
-        sector += RIFF_HEADER_SIZE;
-    }
-
-    /* look for CD sync header (00, 0xFF x 10, 00) */
-    if (memcmp(sector,sync_header,sizeof(sync_header)))
-        return 0;
-
-    if(sector[0x11] >= 32)
-        return 0;
-    if(   (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_VIDEO
-       && (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_AUDIO
-       && (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_DATA)
-        return 0;
-
-    /* MPEG files (like those ripped from VCDs) can also look like this;
-     * only return half certainty */
-    return 50;
-}
-
-static int str_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    StrDemuxContext *str = s->priv_data;
-    unsigned char sector[RAW_CD_SECTOR_SIZE];
-    int start;
-    int i;
-
-    /* skip over any RIFF header */
-    if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
-        return AVERROR(EIO);
-    if (AV_RL32(&sector[0]) == RIFF_TAG)
-        start = RIFF_HEADER_SIZE;
-    else
-        start = 0;
-
-    url_fseek(pb, start, SEEK_SET);
-
-    for(i=0; i<32; i++){
-        str->channels[i].video_stream_index=
-        str->channels[i].audio_stream_index= -1;
-    }
-
-    s->ctx_flags |= AVFMTCTX_NOHEADER;
-
-    return 0;
-}
-
-static int str_read_packet(AVFormatContext *s,
-                           AVPacket *ret_pkt)
-{
-    ByteIOContext *pb = s->pb;
-    StrDemuxContext *str = s->priv_data;
-    unsigned char sector[RAW_CD_SECTOR_SIZE];
-    int channel;
-    AVPacket *pkt;
-    AVStream *st;
-
-    while (1) {
-
-        if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
-            return AVERROR(EIO);
-
-        channel = sector[0x11];
-        if (channel >= 32)
-            return AVERROR_INVALIDDATA;
-
-        switch (sector[0x12] & CDXA_TYPE_MASK) {
-
-        case CDXA_TYPE_DATA:
-        case CDXA_TYPE_VIDEO:
-            {
-
-                int current_sector = AV_RL16(&sector[0x1C]);
-                int sector_count   = AV_RL16(&sector[0x1E]);
-                int frame_size = AV_RL32(&sector[0x24]);
-
-                if(!(   frame_size>=0
-                     && current_sector < sector_count
-                     && sector_count*VIDEO_DATA_CHUNK_SIZE >=frame_size)){
-                    av_log(s, AV_LOG_ERROR, "Invalid parameters %d %d %d\n", current_sector, sector_count, frame_size);
-                    break;
-                }
-
-                if(str->channels[channel].video_stream_index < 0){
-                    /* allocate a new AVStream */
-                    st = av_new_stream(s, 0);
-                    if (!st)
-                        return AVERROR(ENOMEM);
-                    av_set_pts_info(st, 64, 1, 15);
-
-                    str->channels[channel].video_stream_index = st->index;
-
-                    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-                    st->codec->codec_id   = CODEC_ID_MDEC;
-                    st->codec->codec_tag  = 0;  /* no fourcc */
-                    st->codec->width      = AV_RL16(&sector[0x28]);
-                    st->codec->height     = AV_RL16(&sector[0x2A]);
-                }
-
-                /* if this is the first sector of the frame, allocate a pkt */
-                pkt = &str->channels[channel].tmp_pkt;
-
-                if(pkt->size != sector_count*VIDEO_DATA_CHUNK_SIZE){
-                    if(pkt->data)
-                        av_log(s, AV_LOG_ERROR, "missmatching sector_count\n");
-                    av_free_packet(pkt);
-                    if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
-                        return AVERROR(EIO);
-
-                    pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE;
-                    pkt->stream_index =
-                        str->channels[channel].video_stream_index;
-                }
-
-                memcpy(pkt->data + current_sector*VIDEO_DATA_CHUNK_SIZE,
-                       sector + VIDEO_DATA_HEADER_SIZE,
-                       VIDEO_DATA_CHUNK_SIZE);
-
-                if (current_sector == sector_count-1) {
-                    pkt->size= frame_size;
-                    *ret_pkt = *pkt;
-                    pkt->data= NULL;
-                    pkt->size= -1;
-                    return 0;
-                }
-
-            }
-            break;
-
-        case CDXA_TYPE_AUDIO:
-            if(str->channels[channel].audio_stream_index < 0){
-                int fmt = sector[0x13];
-                /* allocate a new AVStream */
-                st = av_new_stream(s, 0);
-                if (!st)
-                    return AVERROR(ENOMEM);
-
-                str->channels[channel].audio_stream_index = st->index;
-
-                st->codec->codec_type  = AVMEDIA_TYPE_AUDIO;
-                st->codec->codec_id    = CODEC_ID_ADPCM_XA;
-                st->codec->codec_tag   = 0;  /* no fourcc */
-                st->codec->channels    = (fmt&1)?2:1;
-                st->codec->sample_rate = (fmt&4)?18900:37800;
-            //    st->codec->bit_rate = 0; //FIXME;
-                st->codec->block_align = 128;
-
-                av_set_pts_info(st, 64, 128, st->codec->sample_rate);
-            }
-            pkt = ret_pkt;
-            if (av_new_packet(pkt, 2304))
-                return AVERROR(EIO);
-            memcpy(pkt->data,sector+24,2304);
-
-            pkt->stream_index =
-                str->channels[channel].audio_stream_index;
-            return 0;
-            break;
-        default:
-            av_log(s, AV_LOG_WARNING, "Unknown sector type %02X\n", sector[0x12]);
-            /* drop the sector and move on */
-            break;
-        }
-
-        if (url_feof(pb))
-            return AVERROR(EIO);
-    }
-}
-
-static int str_read_close(AVFormatContext *s)
-{
-    StrDemuxContext *str = s->priv_data;
-    int i;
-    for(i=0; i<32; i++){
-        if(str->channels[i].tmp_pkt.data)
-            av_free_packet(&str->channels[i].tmp_pkt);
-    }
-
-    return 0;
-}
-
-AVInputFormat str_demuxer = {
-    "psxstr",
-    NULL_IF_CONFIG_SMALL("Sony Playstation STR format"),
-    sizeof(StrDemuxContext),
-    str_probe,
-    str_read_header,
-    str_read_packet,
-    str_read_close,
-};
diff --git a/libavformat/pva.c b/libavformat/pva.c
deleted file mode 100644
index abbc6f1..0000000
--- a/libavformat/pva.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * TechnoTrend PVA (.pva) demuxer
- * Copyright (c) 2007, 2008 Ivo van Poorten
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "mpeg.h"
-
-#define PVA_MAX_PAYLOAD_LENGTH  0x17f8
-#define PVA_VIDEO_PAYLOAD       0x01
-#define PVA_AUDIO_PAYLOAD       0x02
-#define PVA_MAGIC               (('A' << 8) + 'V')
-
-typedef struct {
-    int continue_pes;
-} PVAContext;
-
-static int pva_probe(AVProbeData * pd) {
-    unsigned char *buf = pd->buf;
-
-    if (AV_RB16(buf) == PVA_MAGIC && buf[2] && buf[2] < 3 && buf[4] == 0x55)
-        return AVPROBE_SCORE_MAX / 2;
-
-    return 0;
-}
-
-static int pva_read_header(AVFormatContext *s, AVFormatParameters *ap) {
-    AVStream *st;
-
-    if (!(st = av_new_stream(s, 0)))
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_MPEG2VIDEO;
-    st->need_parsing      = AVSTREAM_PARSE_FULL;
-    av_set_pts_info(st, 32, 1, 90000);
-    av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
-
-    if (!(st = av_new_stream(s, 1)))
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id   = CODEC_ID_MP2;
-    st->need_parsing      = AVSTREAM_PARSE_FULL;
-    av_set_pts_info(st, 33, 1, 90000);
-    av_add_index_entry(st, 0, 0, 0, 0, AVINDEX_KEYFRAME);
-
-    /* the parameters will be extracted from the compressed bitstream */
-    return 0;
-}
-
-#define pva_log if (read_packet) av_log
-
-static int read_part_of_packet(AVFormatContext *s, int64_t *pts,
-                               int *len, int *strid, int read_packet) {
-    ByteIOContext *pb = s->pb;
-    PVAContext *pvactx = s->priv_data;
-    int syncword, streamid, reserved, flags, length, pts_flag;
-    int64_t pva_pts = AV_NOPTS_VALUE, startpos;
-
-recover:
-    startpos = url_ftell(pb);
-
-    syncword = get_be16(pb);
-    streamid = get_byte(pb);
-    get_byte(pb);               /* counter not used */
-    reserved = get_byte(pb);
-    flags    = get_byte(pb);
-    length   = get_be16(pb);
-
-    pts_flag = flags & 0x10;
-
-    if (syncword != PVA_MAGIC) {
-        pva_log(s, AV_LOG_ERROR, "invalid syncword\n");
-        return AVERROR(EIO);
-    }
-    if (streamid != PVA_VIDEO_PAYLOAD && streamid != PVA_AUDIO_PAYLOAD) {
-        pva_log(s, AV_LOG_ERROR, "invalid streamid\n");
-        return AVERROR(EIO);
-    }
-    if (reserved != 0x55) {
-        pva_log(s, AV_LOG_WARNING, "expected reserved byte to be 0x55\n");
-    }
-    if (length > PVA_MAX_PAYLOAD_LENGTH) {
-        pva_log(s, AV_LOG_ERROR, "invalid payload length %u\n", length);
-        return AVERROR(EIO);
-    }
-
-    if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) {
-        pva_pts = get_be32(pb);
-        length -= 4;
-    } else if (streamid == PVA_AUDIO_PAYLOAD) {
-        /* PVA Audio Packets either start with a signaled PES packet or
-         * are a continuation of the previous PES packet. New PES packets
-         * always start at the beginning of a PVA Packet, never somewhere in
-         * the middle. */
-        if (!pvactx->continue_pes) {
-            int pes_signal, pes_header_data_length, pes_packet_length,
-                pes_flags;
-            unsigned char pes_header_data[256];
-
-            pes_signal             = get_be24(pb);
-            get_byte(pb);
-            pes_packet_length      = get_be16(pb);
-            pes_flags              = get_be16(pb);
-            pes_header_data_length = get_byte(pb);
-
-            if (pes_signal != 1) {
-                pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, "
-                                          "trying to recover\n");
-                url_fskip(pb, length - 9);
-                if (!read_packet)
-                    return AVERROR(EIO);
-                goto recover;
-            }
-
-            get_buffer(pb, pes_header_data, pes_header_data_length);
-            length -= 9 + pes_header_data_length;
-
-            pes_packet_length -= 3 + pes_header_data_length;
-
-            pvactx->continue_pes = pes_packet_length;
-
-            if (pes_flags & 0x80 && (pes_header_data[0] & 0xf0) == 0x20)
-                pva_pts = ff_parse_pes_pts(pes_header_data);
-        }
-
-        pvactx->continue_pes -= length;
-
-        if (pvactx->continue_pes < 0) {
-            pva_log(s, AV_LOG_WARNING, "audio data corruption\n");
-            pvactx->continue_pes = 0;
-        }
-    }
-
-    if (pva_pts != AV_NOPTS_VALUE)
-        av_add_index_entry(s->streams[streamid-1], startpos, pva_pts, 0, 0, AVINDEX_KEYFRAME);
-
-    *pts   = pva_pts;
-    *len   = length;
-    *strid = streamid;
-    return 0;
-}
-
-static int pva_read_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
-    int64_t pva_pts;
-    int ret, length, streamid;
-
-    if (read_part_of_packet(s, &pva_pts, &length, &streamid, 1) < 0 ||
-       (ret = av_get_packet(pb, pkt, length)) <= 0)
-        return AVERROR(EIO);
-
-    pkt->stream_index = streamid - 1;
-    pkt->pts = pva_pts;
-
-    return ret;
-}
-
-static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
-                                          int64_t *pos, int64_t pos_limit) {
-    ByteIOContext *pb = s->pb;
-    PVAContext *pvactx = s->priv_data;
-    int length, streamid;
-    int64_t res = AV_NOPTS_VALUE;
-
-    pos_limit = FFMIN(*pos+PVA_MAX_PAYLOAD_LENGTH*8, (uint64_t)*pos+pos_limit);
-
-    while (*pos < pos_limit) {
-        res = AV_NOPTS_VALUE;
-        url_fseek(pb, *pos, SEEK_SET);
-
-        pvactx->continue_pes = 0;
-        if (read_part_of_packet(s, &res, &length, &streamid, 0)) {
-            (*pos)++;
-            continue;
-        }
-        if (streamid - 1 != stream_index || res == AV_NOPTS_VALUE) {
-            *pos = url_ftell(pb) + length;
-            continue;
-        }
-        break;
-    }
-
-    pvactx->continue_pes = 0;
-    return res;
-}
-
-AVInputFormat pva_demuxer = {
-    "pva",
-    NULL_IF_CONFIG_SMALL("TechnoTrend PVA file and stream format"),
-    sizeof(PVAContext),
-    pva_probe,
-    pva_read_header,
-    pva_read_packet,
-    .read_timestamp = pva_read_timestamp
-};
diff --git a/libavformat/qcp.c b/libavformat/qcp.c
deleted file mode 100644
index 676e9c7..0000000
--- a/libavformat/qcp.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * QCP format (.qcp) demuxer
- * Copyright (c) 2009 Kenan Gillet
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * QCP format (.qcp) demuxer
- * @author Kenan Gillet
- * @sa RFC 3625: "The QCP File Format and Media Types for Speech Data"
- *     http://tools.ietf.org/html/rfc3625
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-typedef struct {
-    uint32_t data_size;                     ///< size of data chunk
-
-#define QCP_MAX_MODE 4
-    int16_t rates_per_mode[QCP_MAX_MODE+1]; ///< contains the packet size corresponding
-                                            ///< to each mode, -1 if no size.
-} QCPContext;
-
-/**
- * Last 15 out of 16 bytes of QCELP-13K GUID, as stored in the file;
- * the first byte of the GUID can be either 0x41 or 0x42.
- */
-static const uint8_t guid_qcelp_13k_part[15] = {
-    0x6d, 0x7f, 0x5e, 0x15, 0xb1, 0xd0, 0x11, 0xba,
-    0x91, 0x00, 0x80, 0x5f, 0xb4, 0xb9, 0x7e
-};
-
-/**
- * EVRC GUID as stored in the file
- */
-static const uint8_t guid_evrc[16] = {
-    0x8d, 0xd4, 0x89, 0xe6, 0x76, 0x90, 0xb5, 0x46,
-    0x91, 0xef, 0x73, 0x6a, 0x51, 0x00, 0xce, 0xb4
-};
-
-/**
- * SMV GUID as stored in the file
- */
-static const uint8_t guid_smv[16] = {
-    0x75, 0x2b, 0x7c, 0x8d, 0x97, 0xa7, 0x49, 0xed,
-    0x98, 0x5e, 0xd5, 0x3c, 0x8c, 0xc7, 0x5f, 0x84
-};
-
-/**
- * @param guid contains at least 16 bytes
- * @return 1 if the guid is a qcelp_13k guid, 0 otherwise
- */
-static int is_qcelp_13k_guid(const uint8_t *guid) {
-    return (guid[0] == 0x41 || guid[0] == 0x42)
-        && !memcmp(guid+1, guid_qcelp_13k_part, sizeof(guid_qcelp_13k_part));
-}
-
-static int qcp_probe(AVProbeData *pd)
-{
-    if (AV_RL32(pd->buf  ) == AV_RL32("RIFF") &&
-        AV_RL64(pd->buf+8) == AV_RL64("QLCMfmt "))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    QCPContext    *c  = s->priv_data;
-    AVStream      *st = av_new_stream(s, 0);
-    uint8_t       buf[16];
-    int           i, nb_rates;
-
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    get_be32(pb);                    // "RIFF"
-    s->file_size = get_le32(pb) + 8;
-    url_fskip(pb, 8 + 4 + 1 + 1);    // "QLCMfmt " + chunk-size + major-version + minor-version
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->channels   = 1;
-    get_buffer(pb, buf, 16);
-    if (is_qcelp_13k_guid(buf)) {
-        st->codec->codec_id = CODEC_ID_QCELP;
-    } else if (!memcmp(buf, guid_evrc, 16)) {
-        av_log(s, AV_LOG_ERROR, "EVRC codec is not supported.\n");
-        return AVERROR_PATCHWELCOME;
-    } else if (!memcmp(buf, guid_smv, 16)) {
-        av_log(s, AV_LOG_ERROR, "SMV codec is not supported.\n");
-        return AVERROR_PATCHWELCOME;
-    } else {
-        av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n");
-        return AVERROR_INVALIDDATA;
-    }
-    url_fskip(pb, 2 + 80); // codec-version + codec-name
-    st->codec->bit_rate = get_le16(pb);
-
-    s->packet_size = get_le16(pb);
-    url_fskip(pb, 2); // block-size
-    st->codec->sample_rate = get_le16(pb);
-    url_fskip(pb, 2); // sample-size
-
-    memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode));
-    nb_rates = get_le32(pb);
-    nb_rates = FFMIN(nb_rates, 8);
-    for (i=0; i<nb_rates; i++) {
-        int size = get_byte(pb);
-        int mode = get_byte(pb);
-        if (mode > QCP_MAX_MODE) {
-            av_log(s, AV_LOG_WARNING, "Unknown entry %d=>%d in rate-map-table.\n ", mode, size);
-        } else
-            c->rates_per_mode[mode] = size;
-    }
-    url_fskip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved
-
-    return 0;
-}
-
-static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    QCPContext    *c  = s->priv_data;
-    unsigned int  chunk_size, tag;
-
-    while(!url_feof(pb)) {
-        if (c->data_size) {
-            int pkt_size, ret, mode = get_byte(pb);
-
-            if (s->packet_size) {
-                pkt_size = s->packet_size - 1;
-            } else if (mode > QCP_MAX_MODE || (pkt_size = c->rates_per_mode[mode]) < 0) {
-                c->data_size--;
-                continue;
-            }
-
-            if (c->data_size <= pkt_size) {
-                av_log(s, AV_LOG_WARNING, "Data chunk is too small.\n");
-                pkt_size = c->data_size - 1;
-            }
-
-            if ((ret = av_get_packet(pb, pkt, pkt_size)) >= 0) {
-                if (pkt_size != ret)
-                    av_log(s, AV_LOG_ERROR, "Packet size is too small.\n");
-
-                c->data_size -= pkt_size + 1;
-            }
-            return ret;
-        }
-
-        if (url_ftell(pb) & 1 && get_byte(pb))
-            av_log(s, AV_LOG_WARNING, "Padding should be 0.\n");
-
-        tag        = get_le32(pb);
-        chunk_size = get_le32(pb);
-        switch (tag) {
-        case MKTAG('v', 'r', 'a', 't'):
-            if (get_le32(pb)) // var-rate-flag
-                s->packet_size = 0;
-            url_fskip(pb, 4); // size-in-packets
-            break;
-        case MKTAG('d', 'a', 't', 'a'):
-            c->data_size = chunk_size;
-            break;
-
-        default:
-            url_fskip(pb, chunk_size);
-        }
-    }
-    return AVERROR_EOF;
-}
-
-AVInputFormat qcp_demuxer = {
-    .name           = "qcp",
-    .long_name      = NULL_IF_CONFIG_SMALL("QCP format"),
-    .priv_data_size = sizeof(QCPContext),
-    .read_probe     = qcp_probe,
-    .read_header    = qcp_read_header,
-    .read_packet    = qcp_read_packet,
-};
diff --git a/libavformat/qtpalette.h b/libavformat/qtpalette.h
deleted file mode 100644
index 7d6802f..0000000
--- a/libavformat/qtpalette.h
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Default Palettes for Quicktime Files
- *  Automatically generated from a utility derived from XAnim:
- *  http://xanim.va.pubnix.com/home.html
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_QTPALETTE_H
-#define AVFORMAT_QTPALETTE_H
-
-#include <inttypes.h>
-
-static const uint8_t ff_qt_default_palette_4[4 * 3] = {
-  0x93, 0x65, 0x5E,
-  0xFF, 0xFF, 0xFF,
-  0xDF, 0xD0, 0xAB,
-  0x00, 0x00, 0x00
-};
-
-static const uint8_t ff_qt_default_palette_16[16 * 3] = {
-  0xFF, 0xFB, 0xFF,
-  0xEF, 0xD9, 0xBB,
-  0xE8, 0xC9, 0xB1,
-  0x93, 0x65, 0x5E,
-  0xFC, 0xDE, 0xE8,
-  0x9D, 0x88, 0x91,
-  0xFF, 0xFF, 0xFF,
-  0xFF, 0xFF, 0xFF,
-  0xFF, 0xFF, 0xFF,
-  0x47, 0x48, 0x37,
-  0x7A, 0x5E, 0x55,
-  0xDF, 0xD0, 0xAB,
-  0xFF, 0xFB, 0xF9,
-  0xE8, 0xCA, 0xC5,
-  0x8A, 0x7C, 0x77,
-  0x00, 0x00, 0x00
-};
-
-static const uint8_t ff_qt_default_palette_256[256 * 3] = {
-  /*   0, 0x00 */  0xFF, 0xFF, 0xFF,
-  /*   1, 0x01 */  0xFF, 0xFF, 0xCC,
-  /*   2, 0x02 */  0xFF, 0xFF, 0x99,
-  /*   3, 0x03 */  0xFF, 0xFF, 0x66,
-  /*   4, 0x04 */  0xFF, 0xFF, 0x33,
-  /*   5, 0x05 */  0xFF, 0xFF, 0x00,
-  /*   6, 0x06 */  0xFF, 0xCC, 0xFF,
-  /*   7, 0x07 */  0xFF, 0xCC, 0xCC,
-  /*   8, 0x08 */  0xFF, 0xCC, 0x99,
-  /*   9, 0x09 */  0xFF, 0xCC, 0x66,
-  /*  10, 0x0A */  0xFF, 0xCC, 0x33,
-  /*  11, 0x0B */  0xFF, 0xCC, 0x00,
-  /*  12, 0x0C */  0xFF, 0x99, 0xFF,
-  /*  13, 0x0D */  0xFF, 0x99, 0xCC,
-  /*  14, 0x0E */  0xFF, 0x99, 0x99,
-  /*  15, 0x0F */  0xFF, 0x99, 0x66,
-  /*  16, 0x10 */  0xFF, 0x99, 0x33,
-  /*  17, 0x11 */  0xFF, 0x99, 0x00,
-  /*  18, 0x12 */  0xFF, 0x66, 0xFF,
-  /*  19, 0x13 */  0xFF, 0x66, 0xCC,
-  /*  20, 0x14 */  0xFF, 0x66, 0x99,
-  /*  21, 0x15 */  0xFF, 0x66, 0x66,
-  /*  22, 0x16 */  0xFF, 0x66, 0x33,
-  /*  23, 0x17 */  0xFF, 0x66, 0x00,
-  /*  24, 0x18 */  0xFF, 0x33, 0xFF,
-  /*  25, 0x19 */  0xFF, 0x33, 0xCC,
-  /*  26, 0x1A */  0xFF, 0x33, 0x99,
-  /*  27, 0x1B */  0xFF, 0x33, 0x66,
-  /*  28, 0x1C */  0xFF, 0x33, 0x33,
-  /*  29, 0x1D */  0xFF, 0x33, 0x00,
-  /*  30, 0x1E */  0xFF, 0x00, 0xFF,
-  /*  31, 0x1F */  0xFF, 0x00, 0xCC,
-  /*  32, 0x20 */  0xFF, 0x00, 0x99,
-  /*  33, 0x21 */  0xFF, 0x00, 0x66,
-  /*  34, 0x22 */  0xFF, 0x00, 0x33,
-  /*  35, 0x23 */  0xFF, 0x00, 0x00,
-  /*  36, 0x24 */  0xCC, 0xFF, 0xFF,
-  /*  37, 0x25 */  0xCC, 0xFF, 0xCC,
-  /*  38, 0x26 */  0xCC, 0xFF, 0x99,
-  /*  39, 0x27 */  0xCC, 0xFF, 0x66,
-  /*  40, 0x28 */  0xCC, 0xFF, 0x33,
-  /*  41, 0x29 */  0xCC, 0xFF, 0x00,
-  /*  42, 0x2A */  0xCC, 0xCC, 0xFF,
-  /*  43, 0x2B */  0xCC, 0xCC, 0xCC,
-  /*  44, 0x2C */  0xCC, 0xCC, 0x99,
-  /*  45, 0x2D */  0xCC, 0xCC, 0x66,
-  /*  46, 0x2E */  0xCC, 0xCC, 0x33,
-  /*  47, 0x2F */  0xCC, 0xCC, 0x00,
-  /*  48, 0x30 */  0xCC, 0x99, 0xFF,
-  /*  49, 0x31 */  0xCC, 0x99, 0xCC,
-  /*  50, 0x32 */  0xCC, 0x99, 0x99,
-  /*  51, 0x33 */  0xCC, 0x99, 0x66,
-  /*  52, 0x34 */  0xCC, 0x99, 0x33,
-  /*  53, 0x35 */  0xCC, 0x99, 0x00,
-  /*  54, 0x36 */  0xCC, 0x66, 0xFF,
-  /*  55, 0x37 */  0xCC, 0x66, 0xCC,
-  /*  56, 0x38 */  0xCC, 0x66, 0x99,
-  /*  57, 0x39 */  0xCC, 0x66, 0x66,
-  /*  58, 0x3A */  0xCC, 0x66, 0x33,
-  /*  59, 0x3B */  0xCC, 0x66, 0x00,
-  /*  60, 0x3C */  0xCC, 0x33, 0xFF,
-  /*  61, 0x3D */  0xCC, 0x33, 0xCC,
-  /*  62, 0x3E */  0xCC, 0x33, 0x99,
-  /*  63, 0x3F */  0xCC, 0x33, 0x66,
-  /*  64, 0x40 */  0xCC, 0x33, 0x33,
-  /*  65, 0x41 */  0xCC, 0x33, 0x00,
-  /*  66, 0x42 */  0xCC, 0x00, 0xFF,
-  /*  67, 0x43 */  0xCC, 0x00, 0xCC,
-  /*  68, 0x44 */  0xCC, 0x00, 0x99,
-  /*  69, 0x45 */  0xCC, 0x00, 0x66,
-  /*  70, 0x46 */  0xCC, 0x00, 0x33,
-  /*  71, 0x47 */  0xCC, 0x00, 0x00,
-  /*  72, 0x48 */  0x99, 0xFF, 0xFF,
-  /*  73, 0x49 */  0x99, 0xFF, 0xCC,
-  /*  74, 0x4A */  0x99, 0xFF, 0x99,
-  /*  75, 0x4B */  0x99, 0xFF, 0x66,
-  /*  76, 0x4C */  0x99, 0xFF, 0x33,
-  /*  77, 0x4D */  0x99, 0xFF, 0x00,
-  /*  78, 0x4E */  0x99, 0xCC, 0xFF,
-  /*  79, 0x4F */  0x99, 0xCC, 0xCC,
-  /*  80, 0x50 */  0x99, 0xCC, 0x99,
-  /*  81, 0x51 */  0x99, 0xCC, 0x66,
-  /*  82, 0x52 */  0x99, 0xCC, 0x33,
-  /*  83, 0x53 */  0x99, 0xCC, 0x00,
-  /*  84, 0x54 */  0x99, 0x99, 0xFF,
-  /*  85, 0x55 */  0x99, 0x99, 0xCC,
-  /*  86, 0x56 */  0x99, 0x99, 0x99,
-  /*  87, 0x57 */  0x99, 0x99, 0x66,
-  /*  88, 0x58 */  0x99, 0x99, 0x33,
-  /*  89, 0x59 */  0x99, 0x99, 0x00,
-  /*  90, 0x5A */  0x99, 0x66, 0xFF,
-  /*  91, 0x5B */  0x99, 0x66, 0xCC,
-  /*  92, 0x5C */  0x99, 0x66, 0x99,
-  /*  93, 0x5D */  0x99, 0x66, 0x66,
-  /*  94, 0x5E */  0x99, 0x66, 0x33,
-  /*  95, 0x5F */  0x99, 0x66, 0x00,
-  /*  96, 0x60 */  0x99, 0x33, 0xFF,
-  /*  97, 0x61 */  0x99, 0x33, 0xCC,
-  /*  98, 0x62 */  0x99, 0x33, 0x99,
-  /*  99, 0x63 */  0x99, 0x33, 0x66,
-  /* 100, 0x64 */  0x99, 0x33, 0x33,
-  /* 101, 0x65 */  0x99, 0x33, 0x00,
-  /* 102, 0x66 */  0x99, 0x00, 0xFF,
-  /* 103, 0x67 */  0x99, 0x00, 0xCC,
-  /* 104, 0x68 */  0x99, 0x00, 0x99,
-  /* 105, 0x69 */  0x99, 0x00, 0x66,
-  /* 106, 0x6A */  0x99, 0x00, 0x33,
-  /* 107, 0x6B */  0x99, 0x00, 0x00,
-  /* 108, 0x6C */  0x66, 0xFF, 0xFF,
-  /* 109, 0x6D */  0x66, 0xFF, 0xCC,
-  /* 110, 0x6E */  0x66, 0xFF, 0x99,
-  /* 111, 0x6F */  0x66, 0xFF, 0x66,
-  /* 112, 0x70 */  0x66, 0xFF, 0x33,
-  /* 113, 0x71 */  0x66, 0xFF, 0x00,
-  /* 114, 0x72 */  0x66, 0xCC, 0xFF,
-  /* 115, 0x73 */  0x66, 0xCC, 0xCC,
-  /* 116, 0x74 */  0x66, 0xCC, 0x99,
-  /* 117, 0x75 */  0x66, 0xCC, 0x66,
-  /* 118, 0x76 */  0x66, 0xCC, 0x33,
-  /* 119, 0x77 */  0x66, 0xCC, 0x00,
-  /* 120, 0x78 */  0x66, 0x99, 0xFF,
-  /* 121, 0x79 */  0x66, 0x99, 0xCC,
-  /* 122, 0x7A */  0x66, 0x99, 0x99,
-  /* 123, 0x7B */  0x66, 0x99, 0x66,
-  /* 124, 0x7C */  0x66, 0x99, 0x33,
-  /* 125, 0x7D */  0x66, 0x99, 0x00,
-  /* 126, 0x7E */  0x66, 0x66, 0xFF,
-  /* 127, 0x7F */  0x66, 0x66, 0xCC,
-  /* 128, 0x80 */  0x66, 0x66, 0x99,
-  /* 129, 0x81 */  0x66, 0x66, 0x66,
-  /* 130, 0x82 */  0x66, 0x66, 0x33,
-  /* 131, 0x83 */  0x66, 0x66, 0x00,
-  /* 132, 0x84 */  0x66, 0x33, 0xFF,
-  /* 133, 0x85 */  0x66, 0x33, 0xCC,
-  /* 134, 0x86 */  0x66, 0x33, 0x99,
-  /* 135, 0x87 */  0x66, 0x33, 0x66,
-  /* 136, 0x88 */  0x66, 0x33, 0x33,
-  /* 137, 0x89 */  0x66, 0x33, 0x00,
-  /* 138, 0x8A */  0x66, 0x00, 0xFF,
-  /* 139, 0x8B */  0x66, 0x00, 0xCC,
-  /* 140, 0x8C */  0x66, 0x00, 0x99,
-  /* 141, 0x8D */  0x66, 0x00, 0x66,
-  /* 142, 0x8E */  0x66, 0x00, 0x33,
-  /* 143, 0x8F */  0x66, 0x00, 0x00,
-  /* 144, 0x90 */  0x33, 0xFF, 0xFF,
-  /* 145, 0x91 */  0x33, 0xFF, 0xCC,
-  /* 146, 0x92 */  0x33, 0xFF, 0x99,
-  /* 147, 0x93 */  0x33, 0xFF, 0x66,
-  /* 148, 0x94 */  0x33, 0xFF, 0x33,
-  /* 149, 0x95 */  0x33, 0xFF, 0x00,
-  /* 150, 0x96 */  0x33, 0xCC, 0xFF,
-  /* 151, 0x97 */  0x33, 0xCC, 0xCC,
-  /* 152, 0x98 */  0x33, 0xCC, 0x99,
-  /* 153, 0x99 */  0x33, 0xCC, 0x66,
-  /* 154, 0x9A */  0x33, 0xCC, 0x33,
-  /* 155, 0x9B */  0x33, 0xCC, 0x00,
-  /* 156, 0x9C */  0x33, 0x99, 0xFF,
-  /* 157, 0x9D */  0x33, 0x99, 0xCC,
-  /* 158, 0x9E */  0x33, 0x99, 0x99,
-  /* 159, 0x9F */  0x33, 0x99, 0x66,
-  /* 160, 0xA0 */  0x33, 0x99, 0x33,
-  /* 161, 0xA1 */  0x33, 0x99, 0x00,
-  /* 162, 0xA2 */  0x33, 0x66, 0xFF,
-  /* 163, 0xA3 */  0x33, 0x66, 0xCC,
-  /* 164, 0xA4 */  0x33, 0x66, 0x99,
-  /* 165, 0xA5 */  0x33, 0x66, 0x66,
-  /* 166, 0xA6 */  0x33, 0x66, 0x33,
-  /* 167, 0xA7 */  0x33, 0x66, 0x00,
-  /* 168, 0xA8 */  0x33, 0x33, 0xFF,
-  /* 169, 0xA9 */  0x33, 0x33, 0xCC,
-  /* 170, 0xAA */  0x33, 0x33, 0x99,
-  /* 171, 0xAB */  0x33, 0x33, 0x66,
-  /* 172, 0xAC */  0x33, 0x33, 0x33,
-  /* 173, 0xAD */  0x33, 0x33, 0x00,
-  /* 174, 0xAE */  0x33, 0x00, 0xFF,
-  /* 175, 0xAF */  0x33, 0x00, 0xCC,
-  /* 176, 0xB0 */  0x33, 0x00, 0x99,
-  /* 177, 0xB1 */  0x33, 0x00, 0x66,
-  /* 178, 0xB2 */  0x33, 0x00, 0x33,
-  /* 179, 0xB3 */  0x33, 0x00, 0x00,
-  /* 180, 0xB4 */  0x00, 0xFF, 0xFF,
-  /* 181, 0xB5 */  0x00, 0xFF, 0xCC,
-  /* 182, 0xB6 */  0x00, 0xFF, 0x99,
-  /* 183, 0xB7 */  0x00, 0xFF, 0x66,
-  /* 184, 0xB8 */  0x00, 0xFF, 0x33,
-  /* 185, 0xB9 */  0x00, 0xFF, 0x00,
-  /* 186, 0xBA */  0x00, 0xCC, 0xFF,
-  /* 187, 0xBB */  0x00, 0xCC, 0xCC,
-  /* 188, 0xBC */  0x00, 0xCC, 0x99,
-  /* 189, 0xBD */  0x00, 0xCC, 0x66,
-  /* 190, 0xBE */  0x00, 0xCC, 0x33,
-  /* 191, 0xBF */  0x00, 0xCC, 0x00,
-  /* 192, 0xC0 */  0x00, 0x99, 0xFF,
-  /* 193, 0xC1 */  0x00, 0x99, 0xCC,
-  /* 194, 0xC2 */  0x00, 0x99, 0x99,
-  /* 195, 0xC3 */  0x00, 0x99, 0x66,
-  /* 196, 0xC4 */  0x00, 0x99, 0x33,
-  /* 197, 0xC5 */  0x00, 0x99, 0x00,
-  /* 198, 0xC6 */  0x00, 0x66, 0xFF,
-  /* 199, 0xC7 */  0x00, 0x66, 0xCC,
-  /* 200, 0xC8 */  0x00, 0x66, 0x99,
-  /* 201, 0xC9 */  0x00, 0x66, 0x66,
-  /* 202, 0xCA */  0x00, 0x66, 0x33,
-  /* 203, 0xCB */  0x00, 0x66, 0x00,
-  /* 204, 0xCC */  0x00, 0x33, 0xFF,
-  /* 205, 0xCD */  0x00, 0x33, 0xCC,
-  /* 206, 0xCE */  0x00, 0x33, 0x99,
-  /* 207, 0xCF */  0x00, 0x33, 0x66,
-  /* 208, 0xD0 */  0x00, 0x33, 0x33,
-  /* 209, 0xD1 */  0x00, 0x33, 0x00,
-  /* 210, 0xD2 */  0x00, 0x00, 0xFF,
-  /* 211, 0xD3 */  0x00, 0x00, 0xCC,
-  /* 212, 0xD4 */  0x00, 0x00, 0x99,
-  /* 213, 0xD5 */  0x00, 0x00, 0x66,
-  /* 214, 0xD6 */  0x00, 0x00, 0x33,
-  /* 215, 0xD7 */  0xEE, 0x00, 0x00,
-  /* 216, 0xD8 */  0xDD, 0x00, 0x00,
-  /* 217, 0xD9 */  0xBB, 0x00, 0x00,
-  /* 218, 0xDA */  0xAA, 0x00, 0x00,
-  /* 219, 0xDB */  0x88, 0x00, 0x00,
-  /* 220, 0xDC */  0x77, 0x00, 0x00,
-  /* 221, 0xDD */  0x55, 0x00, 0x00,
-  /* 222, 0xDE */  0x44, 0x00, 0x00,
-  /* 223, 0xDF */  0x22, 0x00, 0x00,
-  /* 224, 0xE0 */  0x11, 0x00, 0x00,
-  /* 225, 0xE1 */  0x00, 0xEE, 0x00,
-  /* 226, 0xE2 */  0x00, 0xDD, 0x00,
-  /* 227, 0xE3 */  0x00, 0xBB, 0x00,
-  /* 228, 0xE4 */  0x00, 0xAA, 0x00,
-  /* 229, 0xE5 */  0x00, 0x88, 0x00,
-  /* 230, 0xE6 */  0x00, 0x77, 0x00,
-  /* 231, 0xE7 */  0x00, 0x55, 0x00,
-  /* 232, 0xE8 */  0x00, 0x44, 0x00,
-  /* 233, 0xE9 */  0x00, 0x22, 0x00,
-  /* 234, 0xEA */  0x00, 0x11, 0x00,
-  /* 235, 0xEB */  0x00, 0x00, 0xEE,
-  /* 236, 0xEC */  0x00, 0x00, 0xDD,
-  /* 237, 0xED */  0x00, 0x00, 0xBB,
-  /* 238, 0xEE */  0x00, 0x00, 0xAA,
-  /* 239, 0xEF */  0x00, 0x00, 0x88,
-  /* 240, 0xF0 */  0x00, 0x00, 0x77,
-  /* 241, 0xF1 */  0x00, 0x00, 0x55,
-  /* 242, 0xF2 */  0x00, 0x00, 0x44,
-  /* 243, 0xF3 */  0x00, 0x00, 0x22,
-  /* 244, 0xF4 */  0x00, 0x00, 0x11,
-  /* 245, 0xF5 */  0xEE, 0xEE, 0xEE,
-  /* 246, 0xF6 */  0xDD, 0xDD, 0xDD,
-  /* 247, 0xF7 */  0xBB, 0xBB, 0xBB,
-  /* 248, 0xF8 */  0xAA, 0xAA, 0xAA,
-  /* 249, 0xF9 */  0x88, 0x88, 0x88,
-  /* 250, 0xFA */  0x77, 0x77, 0x77,
-  /* 251, 0xFB */  0x55, 0x55, 0x55,
-  /* 252, 0xFC */  0x44, 0x44, 0x44,
-  /* 253, 0xFD */  0x22, 0x22, 0x22,
-  /* 254, 0xFE */  0x11, 0x11, 0x11,
-  /* 255, 0xFF */  0x00, 0x00, 0x00
-};
-
-#endif /* AVFORMAT_QTPALETTE_H */
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
deleted file mode 100644
index 556a32b..0000000
--- a/libavformat/r3d.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * R3D REDCODE demuxer
- * Copyright (c) 2008 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-//#define DEBUG
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-typedef struct {
-    unsigned video_offsets_count;
-    unsigned *video_offsets;
-    unsigned rdvo_offset;
-} R3DContext;
-
-typedef struct {
-    unsigned size;
-    uint32_t tag;
-    uint64_t offset;
-} Atom;
-
-static int read_atom(AVFormatContext *s, Atom *atom)
-{
-    atom->offset = url_ftell(s->pb);
-    atom->size = get_be32(s->pb);
-    if (atom->size < 8)
-        return -1;
-    atom->tag = get_le32(s->pb);
-    dprintf(s, "atom %d %.4s offset %#llx\n",
-            atom->size, (char*)&atom->tag, atom->offset);
-    return atom->size;
-}
-
-static int r3d_read_red1(AVFormatContext *s)
-{
-    AVStream *st = av_new_stream(s, 0);
-    char filename[258];
-    int tmp, tmp2;
-
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_JPEG2000;
-
-    tmp  = get_byte(s->pb); // major version
-    tmp2 = get_byte(s->pb); // minor version
-    dprintf(s, "version %d.%d\n", tmp, tmp2);
-
-    tmp = get_be16(s->pb); // unknown
-    dprintf(s, "unknown1 %d\n", tmp);
-
-    tmp = get_be32(s->pb);
-    av_set_pts_info(st, 32, 1, tmp);
-
-    tmp = get_be32(s->pb); // filenum
-    dprintf(s, "filenum %d\n", tmp);
-
-    url_fskip(s->pb, 32); // unknown
-
-    st->codec->width  = get_be32(s->pb);
-    st->codec->height = get_be32(s->pb);
-
-    tmp = get_be16(s->pb); // unknown
-    dprintf(s, "unknown2 %d\n", tmp);
-
-    st->codec->time_base.den = get_be16(s->pb);
-    st->codec->time_base.num = get_be16(s->pb);
-
-    tmp = get_byte(s->pb); // audio channels
-    dprintf(s, "audio channels %d\n", tmp);
-    if (tmp > 0) {
-        AVStream *ast = av_new_stream(s, 1);
-        if (!ast)
-            return AVERROR(ENOMEM);
-        ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        ast->codec->codec_id = CODEC_ID_PCM_S32BE;
-        ast->codec->channels = tmp;
-        av_set_pts_info(ast, 32, 1, st->time_base.den);
-    }
-
-    get_buffer(s->pb, filename, 257);
-    filename[sizeof(filename)-1] = 0;
-    av_metadata_set2(&st->metadata, "filename", filename, 0);
-
-    dprintf(s, "filename %s\n", filename);
-    dprintf(s, "resolution %dx%d\n", st->codec->width, st->codec->height);
-    dprintf(s, "timescale %d\n", st->time_base.den);
-    dprintf(s, "frame rate %d/%d\n",
-            st->codec->time_base.num, st->codec->time_base.den);
-
-    return 0;
-}
-
-static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
-{
-    R3DContext *r3d = s->priv_data;
-    AVStream *st = s->streams[0];
-    int i;
-
-    r3d->video_offsets_count = (atom->size - 8) / 4;
-    r3d->video_offsets = av_malloc(atom->size);
-    if (!r3d->video_offsets)
-        return AVERROR(ENOMEM);
-
-    for (i = 0; i < r3d->video_offsets_count; i++) {
-        r3d->video_offsets[i] = get_be32(s->pb);
-        if (!r3d->video_offsets[i]) {
-            r3d->video_offsets_count = i;
-            break;
-        }
-        dprintf(s, "video offset %d: %#x\n", i, r3d->video_offsets[i]);
-    }
-
-    if (st->codec->time_base.den)
-        st->duration = (uint64_t)r3d->video_offsets_count*
-            st->time_base.den*st->codec->time_base.num/st->codec->time_base.den;
-    dprintf(s, "duration %lld\n", st->duration);
-
-    return 0;
-}
-
-static void r3d_read_reos(AVFormatContext *s)
-{
-    R3DContext *r3d = s->priv_data;
-    int tmp;
-
-    r3d->rdvo_offset = get_be32(s->pb);
-    get_be32(s->pb); // rdvs offset
-    get_be32(s->pb); // rdao offset
-    get_be32(s->pb); // rdas offset
-
-    tmp = get_be32(s->pb);
-    dprintf(s, "num video chunks %d\n", tmp);
-
-    tmp = get_be32(s->pb);
-    dprintf(s, "num audio chunks %d\n", tmp);
-
-    url_fskip(s->pb, 6*4);
-}
-
-static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    R3DContext *r3d = s->priv_data;
-    Atom atom;
-    int ret;
-
-    if (read_atom(s, &atom) < 0) {
-        av_log(s, AV_LOG_ERROR, "error reading atom\n");
-        return -1;
-    }
-    if (atom.tag == MKTAG('R','E','D','1')) {
-        if ((ret = r3d_read_red1(s)) < 0) {
-            av_log(s, AV_LOG_ERROR, "error parsing 'red1' atom\n");
-            return ret;
-        }
-    } else {
-        av_log(s, AV_LOG_ERROR, "could not find 'red1' atom\n");
-        return -1;
-    }
-
-    s->data_offset = url_ftell(s->pb);
-    dprintf(s, "data offset %#llx\n", s->data_offset);
-    if (url_is_streamed(s->pb))
-        return 0;
-    // find REOB/REOF/REOS to load index
-    url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET);
-    if (read_atom(s, &atom) < 0)
-        av_log(s, AV_LOG_ERROR, "error reading end atom\n");
-
-    if (atom.tag != MKTAG('R','E','O','B') &&
-        atom.tag != MKTAG('R','E','O','F') &&
-        atom.tag != MKTAG('R','E','O','S'))
-        goto out;
-
-    r3d_read_reos(s);
-
-    if (r3d->rdvo_offset) {
-        url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET);
-        if (read_atom(s, &atom) < 0)
-            av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n");
-        if (atom.tag == MKTAG('R','D','V','O')) {
-            if (r3d_read_rdvo(s, &atom) < 0)
-                av_log(s, AV_LOG_ERROR, "error parsing 'rdvo' atom\n");
-        }
-    }
-
- out:
-    url_fseek(s->pb, s->data_offset, SEEK_SET);
-    return 0;
-}
-
-static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
-{
-    AVStream *st = s->streams[0];
-    int tmp, tmp2;
-    uint64_t pos = url_ftell(s->pb);
-    unsigned dts;
-    int ret;
-
-    dts = get_be32(s->pb);
-
-    tmp = get_be32(s->pb);
-    dprintf(s, "frame num %d\n", tmp);
-
-    tmp  = get_byte(s->pb); // major version
-    tmp2 = get_byte(s->pb); // minor version
-    dprintf(s, "version %d.%d\n", tmp, tmp2);
-
-    tmp = get_be16(s->pb); // unknown
-    dprintf(s, "unknown %d\n", tmp);
-
-    if (tmp > 4) {
-        tmp = get_be16(s->pb); // unknown
-        dprintf(s, "unknown %d\n", tmp);
-
-        tmp = get_be16(s->pb); // unknown
-        dprintf(s, "unknown %d\n", tmp);
-
-        tmp = get_be32(s->pb);
-        dprintf(s, "width %d\n", tmp);
-        tmp = get_be32(s->pb);
-        dprintf(s, "height %d\n", tmp);
-
-        tmp = get_be32(s->pb);
-        dprintf(s, "metadata len %d\n", tmp);
-    }
-    tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
-    if (tmp < 0)
-        return -1;
-    ret = av_get_packet(s->pb, pkt, tmp);
-    if (ret < 0) {
-        av_log(s, AV_LOG_ERROR, "error reading video packet\n");
-        return -1;
-    }
-
-    pkt->stream_index = 0;
-    pkt->dts = dts;
-    if (st->codec->time_base.den)
-        pkt->duration = (uint64_t)st->time_base.den*
-            st->codec->time_base.num/st->codec->time_base.den;
-    dprintf(s, "pkt dts %lld duration %d\n", pkt->dts, pkt->duration);
-
-    return 0;
-}
-
-static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
-{
-    AVStream *st = s->streams[1];
-    int tmp, tmp2, samples, size;
-    uint64_t pos = url_ftell(s->pb);
-    unsigned dts;
-    int ret;
-
-    dts = get_be32(s->pb);
-
-    st->codec->sample_rate = get_be32(s->pb);
-
-    samples = get_be32(s->pb);
-
-    tmp = get_be32(s->pb);
-    dprintf(s, "packet num %d\n", tmp);
-
-    tmp = get_be16(s->pb); // unkown
-    dprintf(s, "unknown %d\n", tmp);
-
-    tmp  = get_byte(s->pb); // major version
-    tmp2 = get_byte(s->pb); // minor version
-    dprintf(s, "version %d.%d\n", tmp, tmp2);
-
-    tmp = get_be32(s->pb); // unknown
-    dprintf(s, "unknown %d\n", tmp);
-
-    size = atom->size - 8 - (url_ftell(s->pb) - pos);
-    if (size < 0)
-        return -1;
-    ret = av_get_packet(s->pb, pkt, size);
-    if (ret < 0) {
-        av_log(s, AV_LOG_ERROR, "error reading audio packet\n");
-        return ret;
-    }
-
-    pkt->stream_index = 1;
-    pkt->dts = dts;
-    pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate);
-    dprintf(s, "pkt dts %lld duration %d samples %d sample rate %d\n",
-            pkt->dts, pkt->duration, samples, st->codec->sample_rate);
-
-    return 0;
-}
-
-static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    Atom atom;
-    int err = 0;
-
-    while (!err) {
-        if (read_atom(s, &atom) < 0) {
-            err = -1;
-            break;
-        }
-        switch (atom.tag) {
-        case MKTAG('R','E','D','V'):
-            if (s->streams[0]->discard == AVDISCARD_ALL)
-                goto skip;
-            if (!(err = r3d_read_redv(s, pkt, &atom)))
-                return 0;
-            break;
-        case MKTAG('R','E','D','A'):
-            if (s->nb_streams < 2)
-                return -1;
-            if (s->streams[1]->discard == AVDISCARD_ALL)
-                goto skip;
-            if (!(err = r3d_read_reda(s, pkt, &atom)))
-                return 0;
-            break;
-        default:
-        skip:
-            url_fskip(s->pb, atom.size-8);
-        }
-    }
-    return err;
-}
-
-static int r3d_probe(AVProbeData *p)
-{
-    if (AV_RL32(p->buf + 4) == MKTAG('R','E','D','1'))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
-{
-    AVStream *st = s->streams[0]; // video stream
-    R3DContext *r3d = s->priv_data;
-    int frame_num;
-
-    if (!st->codec->time_base.num || !st->time_base.den)
-        return -1;
-
-    frame_num = sample_time*st->codec->time_base.den/
-        ((int64_t)st->codec->time_base.num*st->time_base.den);
-    dprintf(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time);
-
-    if (frame_num < r3d->video_offsets_count) {
-        url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET);
-    } else {
-        av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);
-        return -1;
-    }
-
-    return 0;
-}
-
-static int r3d_close(AVFormatContext *s)
-{
-    R3DContext *r3d = s->priv_data;
-
-    av_freep(&r3d->video_offsets);
-
-    return 0;
-}
-
-AVInputFormat r3d_demuxer = {
-    "r3d",
-    NULL_IF_CONFIG_SMALL("REDCODE R3D format"),
-    sizeof(R3DContext),
-    r3d_probe,
-    r3d_read_header,
-    r3d_read_packet,
-    r3d_close,
-    r3d_seek,
-};
diff --git a/libavformat/raw.c b/libavformat/raw.c
deleted file mode 100644
index 7837de8..0000000
--- a/libavformat/raw.c
+++ /dev/null
@@ -1,1363 +0,0 @@
-/*
- * RAW muxer and demuxer
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2005 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/crc.h"
-#include "libavcodec/ac3_parser.h"
-#include "libavcodec/get_bits.h"
-#include "libavcodec/bytestream.h"
-#include "avformat.h"
-#include "raw.h"
-#include "id3v2.h"
-#include "id3v1.h"
-
-/* simple formats */
-
-#if CONFIG_ROQ_MUXER
-static int roq_write_header(struct AVFormatContext *s)
-{
-    static const uint8_t header[] = {
-        0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
-    };
-
-    put_buffer(s->pb, header, 8);
-    put_flush_packet(s->pb);
-
-    return 0;
-}
-#endif
-
-#if CONFIG_NULL_MUXER
-static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    return 0;
-}
-#endif
-
-#if CONFIG_MUXERS
-static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    put_buffer(s->pb, pkt->data, pkt->size);
-    put_flush_packet(s->pb);
-    return 0;
-}
-#endif
-
-#if CONFIG_DEMUXERS
-/* raw input */
-static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    AVStream *st;
-    enum CodecID id;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-        id = s->iformat->value;
-        if (id == CODEC_ID_RAWVIDEO) {
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        } else {
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        }
-        st->codec->codec_id = id;
-
-        switch(st->codec->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            st->codec->sample_rate = ap->sample_rate;
-            if(ap->channels) st->codec->channels = ap->channels;
-            else             st->codec->channels = 1;
-            st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
-            assert(st->codec->bits_per_coded_sample > 0);
-            st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8;
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-            if(ap->time_base.num)
-                av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
-            else
-                av_set_pts_info(st, 64, 1, 25);
-            st->codec->width = ap->width;
-            st->codec->height = ap->height;
-            st->codec->pix_fmt = ap->pix_fmt;
-            if(st->codec->pix_fmt == PIX_FMT_NONE)
-                st->codec->pix_fmt= PIX_FMT_YUV420P;
-            break;
-        default:
-            return -1;
-        }
-    return 0;
-}
-
-#define RAW_PACKET_SIZE 1024
-#define RAW_SAMPLES     1024
-
-static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, size, bps;
-    //    AVStream *st = s->streams[0];
-
-    size= RAW_SAMPLES*s->streams[0]->codec->block_align;
-
-    ret= av_get_packet(s->pb, pkt, size);
-
-    pkt->stream_index = 0;
-    if (ret < 0)
-        return ret;
-
-    bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
-    assert(bps); // if false there IS a bug elsewhere (NOT in this function)
-    pkt->dts=
-    pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels);
-
-    return ret;
-}
-
-int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, size;
-
-    size = RAW_PACKET_SIZE;
-
-    if (av_new_packet(pkt, size) < 0)
-        return AVERROR(ENOMEM);
-
-    pkt->pos= url_ftell(s->pb);
-    pkt->stream_index = 0;
-    ret = get_partial_buffer(s->pb, pkt->data, size);
-    if (ret < 0) {
-        av_free_packet(pkt);
-        return ret;
-    }
-    pkt->size = ret;
-    return ret;
-}
-#endif
-
-#if CONFIG_RAWVIDEO_DEMUXER
-static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int packet_size, ret, width, height;
-    AVStream *st = s->streams[0];
-
-    width = st->codec->width;
-    height = st->codec->height;
-
-    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
-    if (packet_size < 0)
-        return -1;
-
-    ret= av_get_packet(s->pb, pkt, packet_size);
-    pkt->pts=
-    pkt->dts= pkt->pos / packet_size;
-
-    pkt->stream_index = 0;
-    if (ret < 0)
-        return ret;
-    return 0;
-}
-#endif
-
-#if CONFIG_INGENIENT_DEMUXER
-// http://www.artificis.hu/files/texts/ingenient.txt
-static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, size, w, h, unk1, unk2;
-
-    if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
-        return AVERROR(EIO); // FIXME
-
-    size = get_le32(s->pb);
-
-    w = get_le16(s->pb);
-    h = get_le16(s->pb);
-
-    url_fskip(s->pb, 8); // zero + size (padded?)
-    url_fskip(s->pb, 2);
-    unk1 = get_le16(s->pb);
-    unk2 = get_le16(s->pb);
-    url_fskip(s->pb, 22); // ASCII timestamp
-
-    av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
-        size, w, h, unk1, unk2);
-
-    if (av_new_packet(pkt, size) < 0)
-        return AVERROR(ENOMEM);
-
-    pkt->pos = url_ftell(s->pb);
-    pkt->stream_index = 0;
-    ret = get_buffer(s->pb, pkt->data, size);
-    if (ret < 0) {
-        av_free_packet(pkt);
-        return ret;
-    }
-    pkt->size = ret;
-    return ret;
-}
-#endif
-
-#if CONFIG_DEMUXERS
-int pcm_read_seek(AVFormatContext *s,
-                  int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st;
-    int block_align, byte_rate;
-    int64_t pos, ret;
-
-    st = s->streams[0];
-
-    block_align = st->codec->block_align ? st->codec->block_align :
-        (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3;
-    byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 :
-        block_align * st->codec->sample_rate;
-
-    if (block_align <= 0 || byte_rate <= 0)
-        return -1;
-    if (timestamp < 0) timestamp = 0;
-
-    /* compute the position by aligning it to block_align */
-    pos = av_rescale_rnd(timestamp * byte_rate,
-                         st->time_base.num,
-                         st->time_base.den * (int64_t)block_align,
-                         (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
-    pos *= block_align;
-
-    /* recompute exact position */
-    st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
-    if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
-        return ret;
-    return 0;
-}
-
-static int audio_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
-{
-    AVStream *st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = s->iformat->value;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-    /* the parameters will be extracted from the compressed bitstream */
-
-    return 0;
-}
-
-/* MPEG-1/H.263 input */
-static int video_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
-{
-    AVStream *st;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = s->iformat->value;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-
-    /* for MJPEG, specify frame rate */
-    /* for MPEG-4 specify it, too (most MPEG-4 streams do not have the fixed_vop_rate set ...)*/
-    if (ap->time_base.num) {
-        st->codec->time_base= ap->time_base;
-    } else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
-                st->codec->codec_id == CODEC_ID_MPEG4 ||
-                st->codec->codec_id == CODEC_ID_DIRAC ||
-                st->codec->codec_id == CODEC_ID_DNXHD ||
-                st->codec->codec_id == CODEC_ID_H264) {
-        st->codec->time_base= (AVRational){1,25};
-    }
-    av_set_pts_info(st, 64, 1, 1200000);
-
-    return 0;
-}
-#endif
-
-#if CONFIG_MPEGVIDEO_DEMUXER
-#define SEQ_START_CODE          0x000001b3
-#define GOP_START_CODE          0x000001b8
-#define PICTURE_START_CODE      0x00000100
-#define SLICE_START_CODE        0x00000101
-#define PACK_START_CODE         0x000001ba
-#define VIDEO_ID                0x000001e0
-#define AUDIO_ID                0x000001c0
-
-static int mpegvideo_probe(AVProbeData *p)
-{
-    uint32_t code= -1;
-    int pic=0, seq=0, slice=0, pspack=0, pes=0;
-    int i;
-
-    for(i=0; i<p->buf_size; i++){
-        code = (code<<8) + p->buf[i];
-        if ((code & 0xffffff00) == 0x100) {
-            switch(code){
-            case     SEQ_START_CODE:   seq++; break;
-            case PICTURE_START_CODE:   pic++; break;
-            case   SLICE_START_CODE: slice++; break;
-            case    PACK_START_CODE: pspack++; break;
-            }
-            if     ((code & 0x1f0) == VIDEO_ID)   pes++;
-            else if((code & 0x1e0) == AUDIO_ID)   pes++;
-        }
-    }
-    if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !pes)
-        return pic>1 ? AVPROBE_SCORE_MAX/2+1 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
-    return 0;
-}
-#endif
-
-#if CONFIG_CAVSVIDEO_DEMUXER
-#define CAVS_SEQ_START_CODE       0x000001b0
-#define CAVS_PIC_I_START_CODE     0x000001b3
-#define CAVS_UNDEF_START_CODE     0x000001b4
-#define CAVS_PIC_PB_START_CODE    0x000001b6
-#define CAVS_VIDEO_EDIT_CODE      0x000001b7
-#define CAVS_PROFILE_JIZHUN       0x20
-
-static int cavsvideo_probe(AVProbeData *p)
-{
-    uint32_t code= -1;
-    int pic=0, seq=0, slice_pos = 0;
-    int i;
-
-    for(i=0; i<p->buf_size; i++){
-        code = (code<<8) + p->buf[i];
-        if ((code & 0xffffff00) == 0x100) {
-            if(code < CAVS_SEQ_START_CODE) {
-                /* slices have to be consecutive */
-                if(code < slice_pos)
-                    return 0;
-                slice_pos = code;
-            } else {
-                slice_pos = 0;
-            }
-            if (code == CAVS_SEQ_START_CODE) {
-                seq++;
-                /* check for the only currently supported profile */
-                if(p->buf[i+1] != CAVS_PROFILE_JIZHUN)
-                    return 0;
-            } else if ((code == CAVS_PIC_I_START_CODE) ||
-                       (code == CAVS_PIC_PB_START_CODE)) {
-                pic++;
-            } else if ((code == CAVS_UNDEF_START_CODE) ||
-                       (code >  CAVS_VIDEO_EDIT_CODE)) {
-                return 0;
-            }
-        }
-    }
-    if(seq && seq*9<=pic*10)
-        return AVPROBE_SCORE_MAX/2;
-    return 0;
-}
-#endif
-
-#if CONFIG_M4V_DEMUXER
-#define VISUAL_OBJECT_START_CODE       0x000001b5
-#define VOP_START_CODE                 0x000001b6
-
-static int mpeg4video_probe(AVProbeData *probe_packet)
-{
-    uint32_t temp_buffer= -1;
-    int VO=0, VOL=0, VOP = 0, VISO = 0, res=0;
-    int i;
-
-    for(i=0; i<probe_packet->buf_size; i++){
-        temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
-        if ((temp_buffer & 0xffffff00) != 0x100)
-            continue;
-
-        if (temp_buffer == VOP_START_CODE)                         VOP++;
-        else if (temp_buffer == VISUAL_OBJECT_START_CODE)          VISO++;
-        else if (temp_buffer < 0x120)                              VO++;
-        else if (temp_buffer < 0x130)                              VOL++;
-        else if (   !(0x1AF < temp_buffer && temp_buffer < 0x1B7)
-                 && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++;
-    }
-
-    if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0)
-        return AVPROBE_SCORE_MAX/2;
-    return 0;
-}
-#endif
-
-#if CONFIG_H264_DEMUXER
-static int h264_probe(AVProbeData *p)
-{
-    uint32_t code= -1;
-    int sps=0, pps=0, idr=0, res=0, sli=0;
-    int i;
-
-    for(i=0; i<p->buf_size; i++){
-        code = (code<<8) + p->buf[i];
-        if ((code & 0xffffff00) == 0x100) {
-            int ref_idc= (code>>5)&3;
-            int type   = code & 0x1F;
-            static const int8_t ref_zero[32]={
-                2, 0, 0, 0, 0,-1, 1,-1,
-               -1, 1, 1, 1, 1,-1, 2, 2,
-                2, 2, 2, 0, 2, 2, 2, 2,
-                2, 2, 2, 2, 2, 2, 2, 2
-            };
-
-            if(code & 0x80) //forbidden bit
-                return 0;
-
-            if(ref_zero[type] == 1 && ref_idc)
-                return 0;
-            if(ref_zero[type] ==-1 && !ref_idc)
-                return 0;
-            if(ref_zero[type] == 2)
-                res++;
-
-            switch(type){
-            case     1:   sli++; break;
-            case     5:   idr++; break;
-            case     7:
-                if(p->buf[i+2]&0x0F)
-                    return 0;
-                sps++;
-                break;
-            case     8:   pps++; break;
-            }
-        }
-    }
-    if(sps && pps && (idr||sli>3) && res<(sps+pps+idr))
-        return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg
-    return 0;
-}
-#endif
-
-#if CONFIG_H263_DEMUXER
-static int h263_probe(AVProbeData *p)
-{
-    uint64_t code= -1;
-    int i;
-    int valid_psc=0;
-    int invalid_psc=0;
-    int res_change=0;
-    int src_fmt, last_src_fmt=-1;
-
-    for(i=0; i<p->buf_size; i++){
-        code = (code<<8) + p->buf[i];
-        if ((code & 0xfffffc0000) == 0x800000) {
-            src_fmt= (code>>2)&3;
-            if(   src_fmt != last_src_fmt
-               && last_src_fmt>0 && last_src_fmt<6
-               && src_fmt<6)
-                res_change++;
-
-            if((code&0x300)==0x200 && src_fmt){
-                valid_psc++;
-            }else
-                invalid_psc++;
-            last_src_fmt= src_fmt;
-        }
-    }
-//av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change);
-//h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg)
-    if(valid_psc > 2*invalid_psc + 2*res_change + 3){
-        return 50;
-    }else if(valid_psc > 2*invalid_psc)
-        return 25;
-    return 0;
-}
-#endif
-
-#if CONFIG_H261_DEMUXER
-static int h261_probe(AVProbeData *p)
-{
-    uint32_t code= -1;
-    int i;
-    int valid_psc=0;
-    int invalid_psc=0;
-    int next_gn=0;
-    int src_fmt=0;
-    GetBitContext gb;
-
-    init_get_bits(&gb, p->buf, p->buf_size*8);
-
-    for(i=0; i<p->buf_size*8; i++){
-        if ((code & 0x01ff0000) || !(code & 0xff00)) {
-            code = (code<<8) + get_bits(&gb, 8);
-            i += 7;
-        } else
-            code = (code<<1) + get_bits1(&gb);
-        if ((code & 0xffff0000) == 0x10000) {
-            int gn= (code>>12)&0xf;
-            if(!gn)
-                src_fmt= code&8;
-            if(gn != next_gn) invalid_psc++;
-            else              valid_psc++;
-
-            if(src_fmt){ // CIF
-                next_gn= (gn+1     )%13;
-            }else{       //QCIF
-                next_gn= (gn+1+!!gn)% 7;
-            }
-        }
-    }
-    if(valid_psc > 2*invalid_psc + 6){
-        return 50;
-    }else if(valid_psc > 2*invalid_psc + 2)
-        return 25;
-    return 0;
-}
-#endif
-
-#if CONFIG_DTS_DEMUXER
-#define DCA_MARKER_14B_BE 0x1FFFE800
-#define DCA_MARKER_14B_LE 0xFF1F00E8
-#define DCA_MARKER_RAW_BE 0x7FFE8001
-#define DCA_MARKER_RAW_LE 0xFE7F0180
-static int dts_probe(AVProbeData *p)
-{
-    const uint8_t *buf, *bufp;
-    uint32_t state = -1;
-    int markers[3] = {0};
-    int sum, max;
-
-    buf = p->buf;
-
-    for(; buf < (p->buf+p->buf_size)-2; buf+=2) {
-        bufp = buf;
-        state = (state << 16) | bytestream_get_be16(&bufp);
-
-        /* regular bitstream */
-        if (state == DCA_MARKER_RAW_BE || state == DCA_MARKER_RAW_LE)
-            markers[0]++;
-
-        /* 14 bits big-endian bitstream */
-        if (state == DCA_MARKER_14B_BE)
-            if ((bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0)
-                markers[1]++;
-
-        /* 14 bits little-endian bitstream */
-        if (state == DCA_MARKER_14B_LE)
-            if ((bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007)
-                markers[2]++;
-    }
-    sum = markers[0] + markers[1] + markers[2];
-    max = markers[1] > markers[0];
-    max = markers[2] > markers[max] ? 2 : max;
-    if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 &&
-        markers[max] * 4 > sum * 3)
-        return AVPROBE_SCORE_MAX/2+1;
-
-    return 0;
-}
-#endif
-
-#if CONFIG_DIRAC_DEMUXER
-static int dirac_probe(AVProbeData *p)
-{
-    if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D'))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-#endif
-
-#if CONFIG_DNXHD_DEMUXER
-static int dnxhd_probe(AVProbeData *p)
-{
-    static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01};
-    int w, h, compression_id;
-    if (p->buf_size < 0x2c)
-        return 0;
-    if (memcmp(p->buf, header, 5))
-        return 0;
-    h = AV_RB16(p->buf + 0x18);
-    w = AV_RB16(p->buf + 0x1a);
-    if (!w || !h)
-        return 0;
-    compression_id = AV_RB32(p->buf + 0x28);
-    if (compression_id < 1237 || compression_id > 1253)
-        return 0;
-    return AVPROBE_SCORE_MAX;
-}
-#endif
-
-#if CONFIG_AC3_DEMUXER || CONFIG_EAC3_DEMUXER
-static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
-{
-    int max_frames, first_frames = 0, frames;
-    uint8_t *buf, *buf2, *end;
-    AC3HeaderInfo hdr;
-    GetBitContext gbc;
-    enum CodecID codec_id = CODEC_ID_AC3;
-
-    max_frames = 0;
-    buf = p->buf;
-    end = buf + p->buf_size;
-
-    for(; buf < end; buf++) {
-        buf2 = buf;
-
-        for(frames = 0; buf2 < end; frames++) {
-            init_get_bits(&gbc, buf2, 54);
-            if(ff_ac3_parse_header(&gbc, &hdr) < 0)
-                break;
-            if(buf2 + hdr.frame_size > end ||
-               av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
-                break;
-            if (hdr.bitstream_id > 10)
-                codec_id = CODEC_ID_EAC3;
-            buf2 += hdr.frame_size;
-        }
-        max_frames = FFMAX(max_frames, frames);
-        if(buf == p->buf)
-            first_frames = frames;
-    }
-    if(codec_id != expected_codec_id) return 0;
-    // keep this in sync with mp3 probe, both need to avoid
-    // issues with MPEG-files!
-    if   (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
-    else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
-    else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
-    else if(max_frames>=1) return 1;
-    else                   return 0;
-}
-#endif
-
-#if CONFIG_AC3_DEMUXER
-static int ac3_probe(AVProbeData *p)
-{
-    return ac3_eac3_probe(p, CODEC_ID_AC3);
-}
-#endif
-
-#if CONFIG_EAC3_DEMUXER
-static int eac3_probe(AVProbeData *p)
-{
-    return ac3_eac3_probe(p, CODEC_ID_EAC3);
-}
-#endif
-
-#if CONFIG_AAC_DEMUXER
-static int adts_aac_probe(AVProbeData *p)
-{
-    int max_frames = 0, first_frames = 0;
-    int fsize, frames;
-    uint8_t *buf0 = p->buf;
-    uint8_t *buf2;
-    uint8_t *buf;
-    uint8_t *end = buf0 + p->buf_size - 7;
-
-    if (ff_id3v2_match(buf0)) {
-        buf0 += ff_id3v2_tag_len(buf0);
-    }
-    buf = buf0;
-
-    for(; buf < end; buf= buf2+1) {
-        buf2 = buf;
-
-        for(frames = 0; buf2 < end; frames++) {
-            uint32_t header = AV_RB16(buf2);
-            if((header&0xFFF6) != 0xFFF0)
-                break;
-            fsize = (AV_RB32(buf2+3)>>13) & 0x8FFF;
-            if(fsize < 7)
-                break;
-            buf2 += fsize;
-        }
-        max_frames = FFMAX(max_frames, frames);
-        if(buf == buf0)
-            first_frames= frames;
-    }
-    if   (first_frames>=3) return AVPROBE_SCORE_MAX/2+1;
-    else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
-    else if(max_frames>=3) return AVPROBE_SCORE_MAX/4;
-    else if(max_frames>=1) return 1;
-    else                   return 0;
-}
-
-static int adts_aac_read_header(AVFormatContext *s,
-                                AVFormatParameters *ap)
-{
-    AVStream *st;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = s->iformat->value;
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-
-    ff_id3v1_read(s);
-    ff_id3v2_read(s);
-
-    return 0;
-}
-
-#endif
-
-/* Note: Do not forget to add new entries to the Makefile as well. */
-
-#if CONFIG_AAC_DEMUXER
-AVInputFormat aac_demuxer = {
-    "aac",
-    NULL_IF_CONFIG_SMALL("raw ADTS AAC"),
-    0,
-    adts_aac_probe,
-    adts_aac_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "aac",
-    .value = CODEC_ID_AAC,
-};
-#endif
-
-#if CONFIG_AC3_DEMUXER
-AVInputFormat ac3_demuxer = {
-    "ac3",
-    NULL_IF_CONFIG_SMALL("raw AC-3"),
-    0,
-    ac3_probe,
-    audio_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "ac3",
-    .value = CODEC_ID_AC3,
-};
-#endif
-
-#if CONFIG_AC3_MUXER
-AVOutputFormat ac3_muxer = {
-    "ac3",
-    NULL_IF_CONFIG_SMALL("raw AC-3"),
-    "audio/x-ac3",
-    "ac3",
-    0,
-    CODEC_ID_AC3,
-    CODEC_ID_NONE,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_DIRAC_DEMUXER
-AVInputFormat dirac_demuxer = {
-    "dirac",
-    NULL_IF_CONFIG_SMALL("raw Dirac"),
-    0,
-    dirac_probe,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .value = CODEC_ID_DIRAC,
-};
-#endif
-
-#if CONFIG_DIRAC_MUXER
-AVOutputFormat dirac_muxer = {
-    "dirac",
-    NULL_IF_CONFIG_SMALL("raw Dirac"),
-    NULL,
-    "drc",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_DIRAC,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_DNXHD_DEMUXER
-AVInputFormat dnxhd_demuxer = {
-    "dnxhd",
-    NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
-    0,
-    dnxhd_probe,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .value = CODEC_ID_DNXHD,
-};
-#endif
-
-#if CONFIG_DNXHD_MUXER
-AVOutputFormat dnxhd_muxer = {
-    "dnxhd",
-    NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
-    NULL,
-    "dnxhd",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_DNXHD,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_DTS_DEMUXER
-AVInputFormat dts_demuxer = {
-    "dts",
-    NULL_IF_CONFIG_SMALL("raw DTS"),
-    0,
-    dts_probe,
-    audio_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "dts",
-    .value = CODEC_ID_DTS,
-};
-#endif
-
-#if CONFIG_DTS_MUXER
-AVOutputFormat dts_muxer = {
-    "dts",
-    NULL_IF_CONFIG_SMALL("raw DTS"),
-    "audio/x-dca",
-    "dts",
-    0,
-    CODEC_ID_DTS,
-    CODEC_ID_NONE,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_EAC3_DEMUXER
-AVInputFormat eac3_demuxer = {
-    "eac3",
-    NULL_IF_CONFIG_SMALL("raw E-AC-3"),
-    0,
-    eac3_probe,
-    audio_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "eac3",
-    .value = CODEC_ID_EAC3,
-};
-#endif
-
-#if CONFIG_EAC3_MUXER
-AVOutputFormat eac3_muxer = {
-    "eac3",
-    NULL_IF_CONFIG_SMALL("raw E-AC-3"),
-    "audio/x-eac3",
-    "eac3",
-    0,
-    CODEC_ID_EAC3,
-    CODEC_ID_NONE,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_GSM_DEMUXER
-AVInputFormat gsm_demuxer = {
-    "gsm",
-    NULL_IF_CONFIG_SMALL("raw GSM"),
-    0,
-    NULL,
-    audio_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "gsm",
-    .value = CODEC_ID_GSM,
-};
-#endif
-
-#if CONFIG_H261_DEMUXER
-AVInputFormat h261_demuxer = {
-    "h261",
-    NULL_IF_CONFIG_SMALL("raw H.261"),
-    0,
-    h261_probe,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "h261",
-    .value = CODEC_ID_H261,
-};
-#endif
-
-#if CONFIG_H261_MUXER
-AVOutputFormat h261_muxer = {
-    "h261",
-    NULL_IF_CONFIG_SMALL("raw H.261"),
-    "video/x-h261",
-    "h261",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_H261,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_H263_DEMUXER
-AVInputFormat h263_demuxer = {
-    "h263",
-    NULL_IF_CONFIG_SMALL("raw H.263"),
-    0,
-    h263_probe,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-//    .extensions = "h263", //FIXME remove after writing mpeg4_probe
-    .value = CODEC_ID_H263,
-};
-#endif
-
-#if CONFIG_H263_MUXER
-AVOutputFormat h263_muxer = {
-    "h263",
-    NULL_IF_CONFIG_SMALL("raw H.263"),
-    "video/x-h263",
-    "h263",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_H263,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_H264_DEMUXER
-AVInputFormat h264_demuxer = {
-    "h264",
-    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
-    0,
-    h264_probe,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe
-    .value = CODEC_ID_H264,
-};
-#endif
-
-#if CONFIG_H264_MUXER
-AVOutputFormat h264_muxer = {
-    "h264",
-    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
-    NULL,
-    "h264",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_H264,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_INGENIENT_DEMUXER
-AVInputFormat ingenient_demuxer = {
-    "ingenient",
-    NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"),
-    0,
-    NULL,
-    video_read_header,
-    ingenient_read_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "cgi", // FIXME
-    .value = CODEC_ID_MJPEG,
-};
-#endif
-
-#if CONFIG_M4V_DEMUXER
-AVInputFormat m4v_demuxer = {
-    "m4v",
-    NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
-    0,
-    mpeg4video_probe, /** probing for MPEG-4 data */
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "m4v",
-    .value = CODEC_ID_MPEG4,
-};
-#endif
-
-#if CONFIG_M4V_MUXER
-AVOutputFormat m4v_muxer = {
-    "m4v",
-    NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
-    NULL,
-    "m4v",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_MPEG4,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_MJPEG_DEMUXER
-AVInputFormat mjpeg_demuxer = {
-    "mjpeg",
-    NULL_IF_CONFIG_SMALL("raw MJPEG video"),
-    0,
-    NULL,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "mjpg,mjpeg",
-    .value = CODEC_ID_MJPEG,
-};
-#endif
-
-#if CONFIG_MJPEG_MUXER
-AVOutputFormat mjpeg_muxer = {
-    "mjpeg",
-    NULL_IF_CONFIG_SMALL("raw MJPEG video"),
-    "video/x-mjpeg",
-    "mjpg,mjpeg",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_MJPEG,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_MLP_DEMUXER
-AVInputFormat mlp_demuxer = {
-    "mlp",
-    NULL_IF_CONFIG_SMALL("raw MLP"),
-    0,
-    NULL,
-    audio_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "mlp",
-    .value = CODEC_ID_MLP,
-};
-#endif
-
-#if CONFIG_MLP_MUXER
-AVOutputFormat mlp_muxer = {
-    "mlp",
-    NULL_IF_CONFIG_SMALL("raw MLP"),
-    NULL,
-    "mlp",
-    0,
-    CODEC_ID_MLP,
-    CODEC_ID_NONE,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_TRUEHD_DEMUXER
-AVInputFormat truehd_demuxer = {
-    "truehd",
-    NULL_IF_CONFIG_SMALL("raw TrueHD"),
-    0,
-    NULL,
-    audio_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "thd",
-    .value = CODEC_ID_TRUEHD,
-};
-#endif
-
-#if CONFIG_TRUEHD_MUXER
-AVOutputFormat truehd_muxer = {
-    "truehd",
-    NULL_IF_CONFIG_SMALL("raw TrueHD"),
-    NULL,
-    "thd",
-    0,
-    CODEC_ID_TRUEHD,
-    CODEC_ID_NONE,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_MPEG1VIDEO_MUXER
-AVOutputFormat mpeg1video_muxer = {
-    "mpeg1video",
-    NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
-    "video/x-mpeg",
-    "mpg,mpeg,m1v",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_MPEG1VIDEO,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_MPEG2VIDEO_MUXER
-AVOutputFormat mpeg2video_muxer = {
-    "mpeg2video",
-    NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
-    NULL,
-    "m2v",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_MPEG2VIDEO,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_MPEGVIDEO_DEMUXER
-AVInputFormat mpegvideo_demuxer = {
-    "mpegvideo",
-    NULL_IF_CONFIG_SMALL("raw MPEG video"),
-    0,
-    mpegvideo_probe,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .value = CODEC_ID_MPEG1VIDEO,
-};
-#endif
-
-#if CONFIG_CAVSVIDEO_DEMUXER
-AVInputFormat cavsvideo_demuxer = {
-    "cavsvideo",
-    NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
-    0,
-    cavsvideo_probe,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .value = CODEC_ID_CAVS,
-};
-#endif
-
-#if CONFIG_NULL_MUXER
-AVOutputFormat null_muxer = {
-    "null",
-    NULL_IF_CONFIG_SMALL("raw null video format"),
-    NULL,
-    NULL,
-    0,
-#if HAVE_BIGENDIAN
-    CODEC_ID_PCM_S16BE,
-#else
-    CODEC_ID_PCM_S16LE,
-#endif
-    CODEC_ID_RAWVIDEO,
-    NULL,
-    null_write_packet,
-    .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_RAWVIDEO_DEMUXER
-AVInputFormat rawvideo_demuxer = {
-    "rawvideo",
-    NULL_IF_CONFIG_SMALL("raw video format"),
-    0,
-    NULL,
-    raw_read_header,
-    rawvideo_read_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "yuv,cif,qcif,rgb",
-    .value = CODEC_ID_RAWVIDEO,
-};
-#endif
-
-#if CONFIG_RAWVIDEO_MUXER
-AVOutputFormat rawvideo_muxer = {
-    "rawvideo",
-    NULL_IF_CONFIG_SMALL("raw video format"),
-    NULL,
-    "yuv,rgb",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_RAWVIDEO,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif
-
-#if CONFIG_ROQ_MUXER
-AVOutputFormat roq_muxer =
-{
-    "RoQ",
-    NULL_IF_CONFIG_SMALL("raw id RoQ format"),
-    NULL,
-    "roq",
-    0,
-    CODEC_ID_ROQ_DPCM,
-    CODEC_ID_ROQ,
-    roq_write_header,
-    raw_write_packet,
-};
-#endif
-
-#if CONFIG_SHORTEN_DEMUXER
-AVInputFormat shorten_demuxer = {
-    "shn",
-    NULL_IF_CONFIG_SMALL("raw Shorten"),
-    0,
-    NULL,
-    audio_read_header,
-    ff_raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "shn",
-    .value = CODEC_ID_SHORTEN,
-};
-#endif
-
-#if CONFIG_VC1_DEMUXER
-AVInputFormat vc1_demuxer = {
-    "vc1",
-    NULL_IF_CONFIG_SMALL("raw VC-1"),
-    0,
-    NULL /* vc1_probe */,
-    video_read_header,
-    ff_raw_read_partial_packet,
-    .extensions = "vc1",
-    .value = CODEC_ID_VC1,
-};
-#endif
-
-/* PCM formats */
-
-#define PCMINPUTDEF(name, long_name, ext, codec) \
-AVInputFormat pcm_ ## name ## _demuxer = {\
-    #name,\
-    NULL_IF_CONFIG_SMALL(long_name),\
-    0,\
-    NULL,\
-    raw_read_header,\
-    raw_read_packet,\
-    NULL,\
-    pcm_read_seek,\
-    .flags= AVFMT_GENERIC_INDEX,\
-    .extensions = ext,\
-    .value = codec,\
-};
-
-#define PCMOUTPUTDEF(name, long_name, ext, codec) \
-AVOutputFormat pcm_ ## name ## _muxer = {\
-    #name,\
-    NULL_IF_CONFIG_SMALL(long_name),\
-    NULL,\
-    ext,\
-    0,\
-    codec,\
-    CODEC_ID_NONE,\
-    NULL,\
-    raw_write_packet,\
-    .flags= AVFMT_NOTIMESTAMPS,\
-};
-
-
-#if  !CONFIG_MUXERS && CONFIG_DEMUXERS
-#define PCMDEF(name, long_name, ext, codec) \
-        PCMINPUTDEF(name, long_name, ext, codec)
-#elif CONFIG_MUXERS && !CONFIG_DEMUXERS
-#define PCMDEF(name, long_name, ext, codec) \
-        PCMOUTPUTDEF(name, long_name, ext, codec)
-#elif CONFIG_MUXERS && CONFIG_DEMUXERS
-#define PCMDEF(name, long_name, ext, codec) \
-        PCMINPUTDEF(name, long_name, ext, codec)\
-        PCMOUTPUTDEF(name, long_name, ext, codec)
-#else
-#define PCMDEF(name, long_name, ext, codec)
-#endif
-
-#if HAVE_BIGENDIAN
-#define BE_DEF(s) s
-#define LE_DEF(s) NULL
-#else
-#define BE_DEF(s) NULL
-#define LE_DEF(s) s
-#endif
-
-PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
-       NULL, CODEC_ID_PCM_F64BE)
-
-PCMDEF(f64le, "PCM 64 bit floating-point little-endian format",
-       NULL, CODEC_ID_PCM_F64LE)
-
-PCMDEF(f32be, "PCM 32 bit floating-point big-endian format",
-       NULL, CODEC_ID_PCM_F32BE)
-
-PCMDEF(f32le, "PCM 32 bit floating-point little-endian format",
-       NULL, CODEC_ID_PCM_F32LE)
-
-PCMDEF(s32be, "PCM signed 32 bit big-endian format",
-       NULL, CODEC_ID_PCM_S32BE)
-
-PCMDEF(s32le, "PCM signed 32 bit little-endian format",
-       NULL, CODEC_ID_PCM_S32LE)
-
-PCMDEF(s24be, "PCM signed 24 bit big-endian format",
-       NULL, CODEC_ID_PCM_S24BE)
-
-PCMDEF(s24le, "PCM signed 24 bit little-endian format",
-       NULL, CODEC_ID_PCM_S24LE)
-
-PCMDEF(s16be, "PCM signed 16 bit big-endian format",
-       BE_DEF("sw"), CODEC_ID_PCM_S16BE)
-
-PCMDEF(s16le, "PCM signed 16 bit little-endian format",
-       LE_DEF("sw"), CODEC_ID_PCM_S16LE)
-
-PCMDEF(s8, "PCM signed 8 bit format",
-       "sb", CODEC_ID_PCM_S8)
-
-PCMDEF(u32be, "PCM unsigned 32 bit big-endian format",
-       NULL, CODEC_ID_PCM_U32BE)
-
-PCMDEF(u32le, "PCM unsigned 32 bit little-endian format",
-       NULL, CODEC_ID_PCM_U32LE)
-
-PCMDEF(u24be, "PCM unsigned 24 bit big-endian format",
-       NULL, CODEC_ID_PCM_U24BE)
-
-PCMDEF(u24le, "PCM unsigned 24 bit little-endian format",
-       NULL, CODEC_ID_PCM_U24LE)
-
-PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
-       BE_DEF("uw"), CODEC_ID_PCM_U16BE)
-
-PCMDEF(u16le, "PCM unsigned 16 bit little-endian format",
-       LE_DEF("uw"), CODEC_ID_PCM_U16LE)
-
-PCMDEF(u8, "PCM unsigned 8 bit format",
-       "ub", CODEC_ID_PCM_U8)
-
-PCMDEF(alaw, "PCM A-law format",
-       "al", CODEC_ID_PCM_ALAW)
-
-PCMDEF(mulaw, "PCM mu-law format",
-       "ul", CODEC_ID_PCM_MULAW)
diff --git a/libavformat/raw.h b/libavformat/raw.h
deleted file mode 100644
index 497c8be..0000000
--- a/libavformat/raw.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * RAW muxer and demuxer
- * Copyright (C) 2007  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RAW_H
-#define AVFORMAT_RAW_H
-
-#include "avformat.h"
-
-int pcm_read_seek(AVFormatContext *s,
-                  int stream_index, int64_t timestamp, int flags);
-
-int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt);
-
-#endif /* AVFORMAT_RAW_H */
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
deleted file mode 100644
index 7dda3f3..0000000
--- a/libavformat/rdt.c
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * Realmedia RTSP protocol (RDT) support.
- * Copyright (c) 2007 Ronald S. Bultje
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Realmedia RTSP protocol (RDT) support
- * @author Ronald S. Bultje <rbultje at ronald.bitfreak.net>
- */
-
-#include "avformat.h"
-#include "libavutil/avstring.h"
-#include "rtpdec.h"
-#include "rdt.h"
-#include "libavutil/base64.h"
-#include "libavutil/md5.h"
-#include "rm.h"
-#include "internal.h"
-#include "libavcodec/get_bits.h"
-
-struct RDTDemuxContext {
-    AVFormatContext *ic; /**< the containing (RTSP) demux context */
-    /** Each RDT stream-set (represented by one RTSPStream) can contain
-     * multiple streams (of the same content, but with possibly different
-     * codecs/bitrates). Each such stream is represented by one AVStream
-     * in the AVFormatContext, and this variable points to the offset in
-     * that array such that the first is the first stream of this set. */
-    AVStream **streams;
-    int n_streams; /**< streams with identifical content in this set */
-    void *dynamic_protocol_context;
-    DynamicPayloadPacketHandlerProc parse_packet;
-    uint32_t prev_timestamp;
-    int prev_set_id, prev_stream_id;
-};
-
-RDTDemuxContext *
-ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx,
-                  void *priv_data, RTPDynamicProtocolHandler *handler)
-{
-    RDTDemuxContext *s = av_mallocz(sizeof(RDTDemuxContext));
-    if (!s)
-        return NULL;
-
-    s->ic = ic;
-    s->streams = &ic->streams[first_stream_of_set_idx];
-    do {
-        s->n_streams++;
-    } while (first_stream_of_set_idx + s->n_streams < ic->nb_streams &&
-             s->streams[s->n_streams]->priv_data == s->streams[0]->priv_data);
-    s->prev_set_id    = -1;
-    s->prev_stream_id = -1;
-    s->prev_timestamp = -1;
-    s->parse_packet = handler ? handler->parse_packet : NULL;
-    s->dynamic_protocol_context = priv_data;
-
-    return s;
-}
-
-void
-ff_rdt_parse_close(RDTDemuxContext *s)
-{
-    int i;
-
-    for (i = 1; i < s->n_streams; i++)
-        s->streams[i]->priv_data = NULL;
-
-    av_free(s);
-}
-
-struct PayloadContext {
-    AVFormatContext *rmctx;
-    RMStream *rmst[MAX_STREAMS];
-    uint8_t *mlti_data;
-    unsigned int mlti_data_size;
-    char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE];
-    int audio_pkt_cnt; /**< remaining audio packets in rmdec */
-};
-
-void
-ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
-                                  const char *challenge)
-{
-    int ch_len = strlen (challenge), i;
-    unsigned char zres[16],
-        buf[64] = { 0xa1, 0xe9, 0x14, 0x9d, 0x0e, 0x6b, 0x3b, 0x59 };
-#define XOR_TABLE_SIZE 37
-    const unsigned char xor_table[XOR_TABLE_SIZE] = {
-        0x05, 0x18, 0x74, 0xd0, 0x0d, 0x09, 0x02, 0x53,
-        0xc0, 0x01, 0x05, 0x05, 0x67, 0x03, 0x19, 0x70,
-        0x08, 0x27, 0x66, 0x10, 0x10, 0x72, 0x08, 0x09,
-        0x63, 0x11, 0x03, 0x71, 0x08, 0x08, 0x70, 0x02,
-        0x10, 0x57, 0x05, 0x18, 0x54 };
-
-    /* some (length) checks */
-    if (ch_len == 40) /* what a hack... */
-        ch_len = 32;
-    else if (ch_len > 56)
-        ch_len = 56;
-    memcpy(buf + 8, challenge, ch_len);
-
-    /* xor challenge bytewise with xor_table */
-    for (i = 0; i < XOR_TABLE_SIZE; i++)
-        buf[8 + i] ^= xor_table[i];
-
-    av_md5_sum(zres, buf, 64);
-    ff_data_to_hex(response, zres, 16, 1);
-
-    /* add tail */
-    strcpy (response + 32, "01d0a8e3");
-
-    /* calculate checksum */
-    for (i = 0; i < 8; i++)
-        chksum[i] = response[i * 4];
-    chksum[8] = 0;
-}
-
-static int
-rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
-{
-    ByteIOContext pb;
-    int size;
-    uint32_t tag;
-
-    /**
-     * Layout of the MLTI chunk:
-     * 4:MLTI
-     * 2:<number of streams>
-     * Then for each stream ([number_of_streams] times):
-     *     2:<mdpr index>
-     * 2:<number of mdpr chunks>
-     * Then for each mdpr chunk ([number_of_mdpr_chunks] times):
-     *     4:<size>
-     *     [size]:<data>
-     * we skip MDPR chunks until we reach the one of the stream
-     * we're interested in, and forward that ([size]+[data]) to
-     * the RM demuxer to parse the stream-specific header data.
-     */
-    if (!rdt->mlti_data)
-        return -1;
-    init_put_byte(&pb, rdt->mlti_data, rdt->mlti_data_size, 0,
-                  NULL, NULL, NULL, NULL);
-    tag = get_le32(&pb);
-    if (tag == MKTAG('M', 'L', 'T', 'I')) {
-        int num, chunk_nr;
-
-        /* read index of MDPR chunk numbers */
-        num = get_be16(&pb);
-        if (rule_nr < 0 || rule_nr >= num)
-            return -1;
-        url_fskip(&pb, rule_nr * 2);
-        chunk_nr = get_be16(&pb);
-        url_fskip(&pb, (num - 1 - rule_nr) * 2);
-
-        /* read MDPR chunks */
-        num = get_be16(&pb);
-        if (chunk_nr >= num)
-            return -1;
-        while (chunk_nr--)
-            url_fskip(&pb, get_be32(&pb));
-        size = get_be32(&pb);
-    } else {
-        size = rdt->mlti_data_size;
-        url_fseek(&pb, 0, SEEK_SET);
-    }
-    if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[st->index], size) < 0)
-        return -1;
-
-    return 0;
-}
-
-/**
- * Actual data handling.
- */
-
-int
-ff_rdt_parse_header(const uint8_t *buf, int len,
-                    int *pset_id, int *pseq_no, int *pstream_id,
-                    int *pis_keyframe, uint32_t *ptimestamp)
-{
-    GetBitContext gb;
-    int consumed = 0, set_id, seq_no, stream_id, is_keyframe,
-        len_included, need_reliable;
-    uint32_t timestamp;
-
-    /* skip status packets */
-    while (len >= 5 && buf[1] == 0xFF /* status packet */) {
-        int pkt_len;
-
-        if (!(buf[0] & 0x80))
-            return -1; /* not followed by a data packet */
-
-        pkt_len = AV_RB16(buf+3);
-        buf += pkt_len;
-        len -= pkt_len;
-        consumed += pkt_len;
-    }
-    if (len < 16)
-        return -1;
-    /**
-     * Layout of the header (in bits):
-     * 1:  len_included
-     *     Flag indicating whether this header includes a length field;
-     *     this can be used to concatenate multiple RDT packets in a
-     *     single UDP/TCP data frame and is used to precede RDT data
-     *     by stream status packets
-     * 1:  need_reliable
-     *     Flag indicating whether this header includes a "reliable
-     *     sequence number"; these are apparently sequence numbers of
-     *     data packets alone. For data packets, this flag is always
-     *     set, according to the Real documentation [1]
-     * 5:  set_id
-     *     ID of a set of streams of identical content, possibly with
-     *     different codecs or bitrates
-     * 1:  is_reliable
-     *     Flag set for certain streams deemed less tolerable for packet
-     *     loss
-     * 16: seq_no
-     *     Packet sequence number; if >=0xFF00, this is a non-data packet
-     *     containing stream status info, the second byte indicates the
-     *     type of status packet (see wireshark docs / source code [2])
-     * if (len_included) {
-     *     16: packet_len
-     * } else {
-     *     packet_len = remainder of UDP/TCP frame
-     * }
-     * 1:  is_back_to_back
-     *     Back-to-Back flag; used for timing, set for one in every 10
-     *     packets, according to the Real documentation [1]
-     * 1:  is_slow_data
-     *     Slow-data flag; currently unused, according to Real docs [1]
-     * 5:  stream_id
-     *     ID of the stream within this particular set of streams
-     * 1:  is_no_keyframe
-     *     Non-keyframe flag (unset if packet belongs to a keyframe)
-     * 32: timestamp (PTS)
-     * if (set_id == 0x1F) {
-     *     16: set_id (extended set-of-streams ID; see set_id)
-     * }
-     * if (need_reliable) {
-     *     16: reliable_seq_no
-     *         Reliable sequence number (see need_reliable)
-     * }
-     * if (stream_id == 0x3F) {
-     *     16: stream_id (extended stream ID; see stream_id)
-     * }
-     * [1] https://protocol.helixcommunity.org/files/2005/devdocs/RDT_Feature_Level_20.txt
-     * [2] http://www.wireshark.org/docs/dfref/r/rdt.html and
-     *     http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c
-     */
-    init_get_bits(&gb, buf, len << 3);
-    len_included  = get_bits1(&gb);
-    need_reliable = get_bits1(&gb);
-    set_id        = get_bits(&gb, 5);
-    skip_bits(&gb, 1);
-    seq_no        = get_bits(&gb, 16);
-    if (len_included)
-        skip_bits(&gb, 16);
-    skip_bits(&gb, 2);
-    stream_id     = get_bits(&gb, 5);
-    is_keyframe   = !get_bits1(&gb);
-    timestamp     = get_bits_long(&gb, 32);
-    if (set_id == 0x1f)
-        set_id    = get_bits(&gb, 16);
-    if (need_reliable)
-        skip_bits(&gb, 16);
-    if (stream_id == 0x1f)
-        stream_id = get_bits(&gb, 16);
-
-    if (pset_id)      *pset_id      = set_id;
-    if (pseq_no)      *pseq_no      = seq_no;
-    if (pstream_id)   *pstream_id   = stream_id;
-    if (pis_keyframe) *pis_keyframe = is_keyframe;
-    if (ptimestamp)   *ptimestamp   = timestamp;
-
-    return consumed + (get_bits_count(&gb) >> 3);
-}
-
-/**< return 0 on packet, no more left, 1 on packet, 1 on partial packet... */
-static int
-rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
-                  AVPacket *pkt, uint32_t *timestamp,
-                  const uint8_t *buf, int len, int flags)
-{
-    int seq = 1, res;
-    ByteIOContext pb;
-
-    if (rdt->audio_pkt_cnt == 0) {
-        int pos;
-
-        init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
-        flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
-        res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
-                                  &seq, flags, *timestamp);
-        pos = url_ftell(&pb);
-        if (res < 0)
-            return res;
-        if (res > 0) {
-            if (st->codec->codec_id == CODEC_ID_AAC) {
-                memcpy (rdt->buffer, buf + pos, len - pos);
-                rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0,
-                                                    NULL, NULL, NULL, NULL);
-            }
-            goto get_cache;
-        }
-    } else {
-get_cache:
-        rdt->audio_pkt_cnt =
-            ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb,
-                                  st, rdt->rmst[st->index], pkt);
-        if (rdt->audio_pkt_cnt == 0 &&
-            st->codec->codec_id == CODEC_ID_AAC)
-            av_freep(&rdt->rmctx->pb);
-    }
-    pkt->stream_index = st->index;
-    pkt->pts = *timestamp;
-
-    return rdt->audio_pkt_cnt > 0;
-}
-
-int
-ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
-                    const uint8_t *buf, int len)
-{
-    int seq_no, flags = 0, stream_id, set_id, is_keyframe;
-    uint32_t timestamp;
-    int rv= 0;
-
-    if (!s->parse_packet)
-        return -1;
-
-    if (!buf && s->prev_stream_id != -1) {
-        /* return the next packets, if any */
-        timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned....
-        rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
-                            s->streams[s->prev_stream_id],
-                            pkt, &timestamp, NULL, 0, flags);
-        return rv;
-    }
-
-    if (len < 12)
-        return -1;
-    rv = ff_rdt_parse_header(buf, len, &set_id, &seq_no, &stream_id, &is_keyframe, &timestamp);
-    if (rv < 0)
-        return rv;
-    if (is_keyframe &&
-        (set_id != s->prev_set_id || timestamp != s->prev_timestamp ||
-         stream_id != s->prev_stream_id)) {
-        flags |= RTP_FLAG_KEY;
-        s->prev_set_id    = set_id;
-        s->prev_timestamp = timestamp;
-    }
-    s->prev_stream_id = stream_id;
-    buf += rv;
-    len -= rv;
-
-     if (s->prev_stream_id >= s->n_streams) {
-         s->prev_stream_id = -1;
-         return -1;
-     }
-
-    rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
-                         s->streams[s->prev_stream_id],
-                         pkt, &timestamp, buf, len, flags);
-
-    return rv;
-}
-
-void
-ff_rdt_subscribe_rule (char *cmd, int size,
-                       int stream_nr, int rule_nr)
-{
-    av_strlcatf(cmd, size, "stream=%d;rule=%d,stream=%d;rule=%d",
-                stream_nr, rule_nr * 2, stream_nr, rule_nr * 2 + 1);
-}
-
-static unsigned char *
-rdt_parse_b64buf (unsigned int *target_len, const char *p)
-{
-    unsigned char *target;
-    int len = strlen(p);
-    if (*p == '\"') {
-        p++;
-        len -= 2; /* skip embracing " at start/end */
-    }
-    *target_len = len * 3 / 4;
-    target = av_mallocz(*target_len + FF_INPUT_BUFFER_PADDING_SIZE);
-    av_base64_decode(target, p, *target_len);
-    return target;
-}
-
-static int
-rdt_parse_sdp_line (AVFormatContext *s, int st_index,
-                    PayloadContext *rdt, const char *line)
-{
-    AVStream *stream = s->streams[st_index];
-    const char *p = line;
-
-    if (av_strstart(p, "OpaqueData:buffer;", &p)) {
-        rdt->mlti_data = rdt_parse_b64buf(&rdt->mlti_data_size, p);
-    } else if (av_strstart(p, "StartTime:integer;", &p))
-        stream->first_dts = atoi(p);
-    else if (av_strstart(p, "ASMRuleBook:string;", &p)) {
-        int n, first = -1;
-
-        for (n = 0; n < s->nb_streams; n++)
-            if (s->streams[n]->priv_data == stream->priv_data) {
-                if (first == -1) first = n;
-                rdt->rmst[s->streams[n]->index] = ff_rm_alloc_rmstream();
-                rdt_load_mdpr(rdt, s->streams[n], (n - first) * 2);
-
-                if (s->streams[n]->codec->codec_id == CODEC_ID_AAC)
-                    s->streams[n]->codec->frame_size = 1; // FIXME
-           }
-    }
-
-    return 0;
-}
-
-static void
-real_parse_asm_rule(AVStream *st, const char *p, const char *end)
-{
-    do {
-        /* can be either averagebandwidth= or AverageBandwidth= */
-        if (sscanf(p, " %*1[Aa]verage%*1[Bb]andwidth=%d", &st->codec->bit_rate) == 1)
-            break;
-        if (!(p = strchr(p, ',')) || p > end)
-            p = end;
-        p++;
-    } while (p < end);
-}
-
-static AVStream *
-add_dstream(AVFormatContext *s, AVStream *orig_st)
-{
-    AVStream *st;
-
-    if (!(st = av_new_stream(s, 0)))
-        return NULL;
-    st->codec->codec_type = orig_st->codec->codec_type;
-    st->priv_data         = orig_st->priv_data;
-    st->first_dts         = orig_st->first_dts;
-
-    return st;
-}
-
-static void
-real_parse_asm_rulebook(AVFormatContext *s, AVStream *orig_st,
-                        const char *p)
-{
-    const char *end;
-    int n_rules, odd = 0;
-    AVStream *st;
-
-    /**
-     * The ASMRuleBook contains a list of comma-separated strings per rule,
-     * and each rule is separated by a ;. The last one also has a ; at the
-     * end so we can use it as delimiter.
-     * Every rule occurs twice, once for when the RTSP packet header marker
-     * is set and once for if it isn't. We only read the first because we
-     * don't care much (that's what the "odd" variable is for).
-     * Each rule contains a set of one or more statements, optionally
-     * preceeded by a single condition. If there's a condition, the rule
-     * starts with a '#'. Multiple conditions are merged between brackets,
-     * so there are never multiple conditions spread out over separate
-     * statements. Generally, these conditions are bitrate limits (min/max)
-     * for multi-bitrate streams.
-     */
-    if (*p == '\"') p++;
-    for (n_rules = 0; s->nb_streams < MAX_STREAMS;) {
-        if (!(end = strchr(p, ';')))
-            break;
-        if (!odd && end != p) {
-            if (n_rules > 0)
-                st = add_dstream(s, orig_st);
-            else
-                st = orig_st;
-            real_parse_asm_rule(st, p, end);
-            n_rules++;
-        }
-        p = end + 1;
-        odd ^= 1;
-    }
-}
-
-void
-ff_real_parse_sdp_a_line (AVFormatContext *s, int stream_index,
-                          const char *line)
-{
-    const char *p = line;
-
-    if (av_strstart(p, "ASMRuleBook:string;", &p))
-        real_parse_asm_rulebook(s, s->streams[stream_index], p);
-}
-
-static PayloadContext *
-rdt_new_context (void)
-{
-    PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
-
-    av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL);
-
-    return rdt;
-}
-
-static void
-rdt_free_context (PayloadContext *rdt)
-{
-    int i;
-
-    for (i = 0; i < MAX_STREAMS; i++)
-        if (rdt->rmst[i]) {
-            ff_rm_free_rmstream(rdt->rmst[i]);
-            av_freep(&rdt->rmst[i]);
-        }
-    if (rdt->rmctx)
-        av_close_input_stream(rdt->rmctx);
-    av_freep(&rdt->mlti_data);
-    av_free(rdt);
-}
-
-#define RDT_HANDLER(n, s, t) \
-static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \
-    .enc_name         = s, \
-    .codec_type       = t, \
-    .codec_id         = CODEC_ID_NONE, \
-    .parse_sdp_a_line = rdt_parse_sdp_line, \
-    .open             = rdt_new_context, \
-    .close            = rdt_free_context, \
-    .parse_packet     = rdt_parse_packet \
-};
-
-RDT_HANDLER(live_video, "x-pn-multirate-realvideo-live", AVMEDIA_TYPE_VIDEO);
-RDT_HANDLER(live_audio, "x-pn-multirate-realaudio-live", AVMEDIA_TYPE_AUDIO);
-RDT_HANDLER(video,      "x-pn-realvideo",                AVMEDIA_TYPE_VIDEO);
-RDT_HANDLER(audio,      "x-pn-realaudio",                AVMEDIA_TYPE_AUDIO);
-
-void av_register_rdt_dynamic_payload_handlers(void)
-{
-    ff_register_dynamic_payload_handler(&ff_rdt_video_handler);
-    ff_register_dynamic_payload_handler(&ff_rdt_audio_handler);
-    ff_register_dynamic_payload_handler(&ff_rdt_live_video_handler);
-    ff_register_dynamic_payload_handler(&ff_rdt_live_audio_handler);
-}
diff --git a/libavformat/rdt.h b/libavformat/rdt.h
deleted file mode 100644
index 1592c2f..0000000
--- a/libavformat/rdt.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Realmedia RTSP (RDT) definitions
- * Copyright (c) 2007 Ronald S. Bultje <rbultje at ronald.bitfreak.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RDT_H
-#define AVFORMAT_RDT_H
-
-#include <stdint.h>
-#include "avformat.h"
-#include "rtpdec.h"
-
-typedef struct RDTDemuxContext RDTDemuxContext;
-
-/**
- * Allocate and init the RDT parsing context.
- * @param ic the containing RTSP demuxer context
- * @param first_stream_of_set_idx index to the first AVStream in the RTSP
- *              demuxer context's ic->streams array that is part of this
- *              particular stream's set of streams (with identical content)
- * @param priv_data private data of the payload data handler context
- * @param handler pointer to the parse_packet() payload parsing function
- * @return a newly allocated RDTDemuxContext. Free with ff_rdt_parse_close().
- */
-RDTDemuxContext *ff_rdt_parse_open(AVFormatContext *ic,
-                                   int first_stream_of_set_idx,
-                                   void *priv_data,
-                                   RTPDynamicProtocolHandler *handler);
-void ff_rdt_parse_close(RDTDemuxContext *s);
-
-/**
- * Calculate the response (RealChallenge2 in the RTSP header) to the
- * challenge (RealChallenge1 in the RTSP header from the Real/Helix
- * server), which is used as some sort of client validation.
- *
- * @param response pointer to response buffer, it should be at least 41 bytes
- *                 (40 data + 1 zero) bytes long.
- * @param chksum pointer to buffer containing a checksum of the response,
- *               it should be at least 9 (8 data + 1 zero) bytes long.
- * @param challenge pointer to the RealChallenge1 value provided by the
- *                  server.
- */
-void ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
-                                       const char *challenge);
-
-/**
- * Register RDT-related dynamic payload handlers with our cache.
- */
-void av_register_rdt_dynamic_payload_handlers(void);
-
-/**
- * Add subscription information to Subscribe parameter string.
- *
- * @param cmd string to write the subscription information into.
- * @param size size of cmd.
- * @param stream_nr stream number.
- * @param rule_nr rule number to conform to.
- */
-void ff_rdt_subscribe_rule(char *cmd, int size,
-                           int stream_nr, int rule_nr);
-
-/**
- * Parse RDT-style packet header.
- *
- * @param buf input buffer
- * @param len length of input buffer
- * @param set_id will be set to the set ID this packet belongs to
- * @param seq_no will be set to the sequence number of the packet
- * @param stream_id will be set to the stream ID this packet belongs to
- * @param is_keyframe will be whether this packet belongs to a keyframe
- * @param timestamp will be set to the timestamp of the packet
- * @return the amount of bytes consumed, or <0 on error
- */
-int ff_rdt_parse_header(const uint8_t *buf, int len,
-                        int *set_id, int *seq_no, int *stream_id,
-                        int *is_keyframe, uint32_t *timestamp);
-
-/**
- * Parse RDT-style packet data (header + media data).
- * Usage similar to rtp_parse_packet().
- */
-int ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
-                        const uint8_t *buf, int len);
-
-/**
- * Parse a server-related SDP line.
- *
- * @param s the RTSP AVFormatContext
- * @param stream_index the index of the first stream in the set represented
- *               by the SDP m= line (in s->streams)
- * @param buf the SDP line
- */
-void ff_real_parse_sdp_a_line(AVFormatContext *s, int stream_index,
-                              const char *buf);
-
-#endif /* AVFORMAT_RDT_H */
diff --git a/libavformat/riff.c b/libavformat/riff.c
deleted file mode 100644
index 64464ca..0000000
--- a/libavformat/riff.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * RIFF codec tags
- * Copyright (c) 2000 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/avcodec.h"
-#include "avformat.h"
-#include "riff.h"
-#include "libavcodec/bytestream.h"
-
-/* Note: when encoding, the first matching tag is used, so order is
-   important if multiple tags possible for a given codec. */
-const AVCodecTag ff_codec_bmp_tags[] = {
-    { CODEC_ID_H264,         MKTAG('H', '2', '6', '4') },
-    { CODEC_ID_H264,         MKTAG('h', '2', '6', '4') },
-    { CODEC_ID_H264,         MKTAG('X', '2', '6', '4') },
-    { CODEC_ID_H264,         MKTAG('x', '2', '6', '4') },
-    { CODEC_ID_H264,         MKTAG('a', 'v', 'c', '1') },
-    { CODEC_ID_H264,         MKTAG('V', 'S', 'S', 'H') },
-    { CODEC_ID_H263,         MKTAG('H', '2', '6', '3') },
-    { CODEC_ID_H263,         MKTAG('X', '2', '6', '3') },
-    { CODEC_ID_H263,         MKTAG('T', '2', '6', '3') },
-    { CODEC_ID_H263,         MKTAG('L', '2', '6', '3') },
-    { CODEC_ID_H263,         MKTAG('V', 'X', '1', 'K') },
-    { CODEC_ID_H263,         MKTAG('Z', 'y', 'G', 'o') },
-    { CODEC_ID_H263P,        MKTAG('H', '2', '6', '3') },
-    { CODEC_ID_H263I,        MKTAG('I', '2', '6', '3') }, /* intel h263 */
-    { CODEC_ID_H261,         MKTAG('H', '2', '6', '1') },
-    { CODEC_ID_H263P,        MKTAG('U', '2', '6', '3') },
-    { CODEC_ID_H263P,        MKTAG('v', 'i', 'v', '1') },
-    { CODEC_ID_MPEG4,        MKTAG('F', 'M', 'P', '4') },
-    { CODEC_ID_MPEG4,        MKTAG('D', 'I', 'V', 'X') },
-    { CODEC_ID_MPEG4,        MKTAG('D', 'X', '5', '0') },
-    { CODEC_ID_MPEG4,        MKTAG('X', 'V', 'I', 'D') },
-    { CODEC_ID_MPEG4,        MKTAG('M', 'P', '4', 'S') },
-    { CODEC_ID_MPEG4,        MKTAG('M', '4', 'S', '2') },
-    { CODEC_ID_MPEG4,        MKTAG( 4 ,  0 ,  0 ,  0 ) }, /* some broken avi use this */
-    { CODEC_ID_MPEG4,        MKTAG('D', 'I', 'V', '1') },
-    { CODEC_ID_MPEG4,        MKTAG('B', 'L', 'Z', '0') },
-    { CODEC_ID_MPEG4,        MKTAG('m', 'p', '4', 'v') },
-    { CODEC_ID_MPEG4,        MKTAG('U', 'M', 'P', '4') },
-    { CODEC_ID_MPEG4,        MKTAG('W', 'V', '1', 'F') },
-    { CODEC_ID_MPEG4,        MKTAG('S', 'E', 'D', 'G') },
-    { CODEC_ID_MPEG4,        MKTAG('R', 'M', 'P', '4') },
-    { CODEC_ID_MPEG4,        MKTAG('3', 'I', 'V', '2') },
-    { CODEC_ID_MPEG4,        MKTAG('F', 'F', 'D', 'S') },
-    { CODEC_ID_MPEG4,        MKTAG('F', 'V', 'F', 'W') },
-    { CODEC_ID_MPEG4,        MKTAG('D', 'C', 'O', 'D') },
-    { CODEC_ID_MPEG4,        MKTAG('M', 'V', 'X', 'M') },
-    { CODEC_ID_MPEG4,        MKTAG('P', 'M', '4', 'V') },
-    { CODEC_ID_MPEG4,        MKTAG('S', 'M', 'P', '4') },
-    { CODEC_ID_MPEG4,        MKTAG('D', 'X', 'G', 'M') },
-    { CODEC_ID_MPEG4,        MKTAG('V', 'I', 'D', 'M') },
-    { CODEC_ID_MPEG4,        MKTAG('M', '4', 'T', '3') },
-    { CODEC_ID_MPEG4,        MKTAG('G', 'E', 'O', 'X') },
-    { CODEC_ID_MPEG4,        MKTAG('H', 'D', 'X', '4') }, /* flipped video */
-    { CODEC_ID_MPEG4,        MKTAG('D', 'M', 'K', '2') },
-    { CODEC_ID_MPEG4,        MKTAG('D', 'I', 'G', 'I') },
-    { CODEC_ID_MPEG4,        MKTAG('I', 'N', 'M', 'C') },
-    { CODEC_ID_MPEG4,        MKTAG('E', 'P', 'H', 'V') }, /* Ephv MPEG-4 */
-    { CODEC_ID_MPEG4,        MKTAG('E', 'M', '4', 'A') },
-    { CODEC_ID_MPEG4,        MKTAG('M', '4', 'C', 'C') }, /* Divio MPEG-4 */
-    { CODEC_ID_MPEG4,        MKTAG('S', 'N', '4', '0') },
-    { CODEC_ID_MPEG4,        MKTAG('V', 'S', 'P', 'X') },
-    { CODEC_ID_MPEG4,        MKTAG('U', 'L', 'D', 'X') },
-    { CODEC_ID_MPEG4,        MKTAG('G', 'E', 'O', 'V') },
-    { CODEC_ID_MPEG4,        MKTAG('S', 'I', 'P', 'P') }, /* Samsung SHR-6040 */
-    { CODEC_ID_MSMPEG4V3,    MKTAG('D', 'I', 'V', '3') }, /* default signature when using MSMPEG4 */
-    { CODEC_ID_MSMPEG4V3,    MKTAG('M', 'P', '4', '3') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('M', 'P', 'G', '3') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('D', 'I', 'V', '5') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('D', 'I', 'V', '6') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('D', 'I', 'V', '4') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('D', 'V', 'X', '3') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('A', 'P', '4', '1') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('C', 'O', 'L', '1') },
-    { CODEC_ID_MSMPEG4V3,    MKTAG('C', 'O', 'L', '0') },
-    { CODEC_ID_MSMPEG4V2,    MKTAG('M', 'P', '4', '2') },
-    { CODEC_ID_MSMPEG4V2,    MKTAG('D', 'I', 'V', '2') },
-    { CODEC_ID_MSMPEG4V1,    MKTAG('M', 'P', 'G', '4') },
-    { CODEC_ID_MSMPEG4V1,    MKTAG('M', 'P', '4', '1') },
-    { CODEC_ID_WMV1,         MKTAG('W', 'M', 'V', '1') },
-    { CODEC_ID_WMV2,         MKTAG('W', 'M', 'V', '2') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', 's', 'd') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', 'h', 'd') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', 'h', '1') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', 's', 'l') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', '2', '5') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', '5', '0') },
-    { CODEC_ID_DVVIDEO,      MKTAG('c', 'd', 'v', 'c') }, /* Canopus DV */
-    { CODEC_ID_DVVIDEO,      MKTAG('C', 'D', 'V', 'H') }, /* Canopus DV */
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', 'c', ' ') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', 'c', 's') },
-    { CODEC_ID_DVVIDEO,      MKTAG('d', 'v', 'h', '1') },
-    { CODEC_ID_MPEG1VIDEO,   MKTAG('m', 'p', 'g', '1') },
-    { CODEC_ID_MPEG1VIDEO,   MKTAG('m', 'p', 'g', '2') },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('m', 'p', 'g', '2') },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('M', 'P', 'E', 'G') },
-    { CODEC_ID_MPEG1VIDEO,   MKTAG('P', 'I', 'M', '1') },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('P', 'I', 'M', '2') },
-    { CODEC_ID_MPEG1VIDEO,   MKTAG('V', 'C', 'R', '2') },
-    { CODEC_ID_MPEG1VIDEO,   MKTAG( 1 ,  0 ,  0 ,  16) },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG( 2 ,  0 ,  0 ,  16) },
-    { CODEC_ID_MPEG4,        MKTAG( 4 ,  0 ,  0 ,  16) },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('D', 'V', 'R', ' ') },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('M', 'M', 'E', 'S') },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('L', 'M', 'P', '2') }, /* Lead MPEG2 in avi */
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('s', 'l', 'i', 'f') },
-    { CODEC_ID_MPEG2VIDEO,   MKTAG('E', 'M', '2', 'V') },
-    { CODEC_ID_MJPEG,        MKTAG('M', 'J', 'P', 'G') },
-    { CODEC_ID_MJPEG,        MKTAG('L', 'J', 'P', 'G') },
-    { CODEC_ID_MJPEG,        MKTAG('d', 'm', 'b', '1') },
-    { CODEC_ID_MJPEG,        MKTAG('m', 'j', 'p', 'a') },
-    { CODEC_ID_LJPEG,        MKTAG('L', 'J', 'P', 'G') },
-    { CODEC_ID_MJPEG,        MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */
-    { CODEC_ID_JPEGLS,       MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */
-    { CODEC_ID_MJPEG,        MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */
-    { CODEC_ID_MJPEG,        MKTAG('j', 'p', 'e', 'g') },
-    { CODEC_ID_MJPEG,        MKTAG('I', 'J', 'P', 'G') },
-    { CODEC_ID_MJPEG,        MKTAG('A', 'V', 'R', 'n') },
-    { CODEC_ID_MJPEG,        MKTAG('A', 'C', 'D', 'V') },
-    { CODEC_ID_MJPEG,        MKTAG('Q', 'I', 'V', 'G') },
-    { CODEC_ID_MJPEG,        MKTAG('S', 'L', 'M', 'J') }, /* SL M-JPEG */
-    { CODEC_ID_MJPEG,        MKTAG('C', 'J', 'P', 'G') }, /* Creative Webcam JPEG */
-    { CODEC_ID_MJPEG,        MKTAG('I', 'J', 'L', 'V') }, /* Intel JPEG Library Video Codec */
-    { CODEC_ID_MJPEG,        MKTAG('M', 'V', 'J', 'P') }, /* Midvid JPEG Video Codec */
-    { CODEC_ID_MJPEG,        MKTAG('A', 'V', 'I', '1') },
-    { CODEC_ID_MJPEG,        MKTAG('A', 'V', 'I', '2') },
-    { CODEC_ID_MJPEG,        MKTAG('M', 'T', 'S', 'J') },
-    { CODEC_ID_MJPEG,        MKTAG('Z', 'J', 'P', 'G') }, /* Paradigm Matrix M-JPEG Codec */
-    { CODEC_ID_HUFFYUV,      MKTAG('H', 'F', 'Y', 'U') },
-    { CODEC_ID_FFVHUFF,      MKTAG('F', 'F', 'V', 'H') },
-    { CODEC_ID_CYUV,         MKTAG('C', 'Y', 'U', 'V') },
-    { CODEC_ID_RAWVIDEO,     MKTAG( 0 ,  0 ,  0 ,  0 ) },
-    { CODEC_ID_RAWVIDEO,     MKTAG( 3 ,  0 ,  0 ,  0 ) },
-    { CODEC_ID_RAWVIDEO,     MKTAG('I', '4', '2', '0') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('Y', 'U', 'Y', '2') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('Y', '4', '2', '2') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('V', '4', '2', '2') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('Y', 'U', 'N', 'V') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('U', 'Y', 'N', 'V') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('U', 'Y', 'N', 'Y') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('u', 'y', 'v', '1') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('2', 'V', 'u', '1') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('2', 'v', 'u', 'y') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('P', '4', '2', '2') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('Y', 'V', '1', '2') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('U', 'Y', 'V', 'Y') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('V', 'Y', 'U', 'Y') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('I', 'Y', 'U', 'V') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('Y', '8', '0', '0') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('H', 'D', 'Y', 'C') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('Y', 'V', 'U', '9') },
-    { CODEC_ID_RAWVIDEO,     MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */
-    { CODEC_ID_FRWU,         MKTAG('F', 'R', 'W', 'U') },
-    { CODEC_ID_R210,         MKTAG('r', '2', '1', '0') },
-    { CODEC_ID_V210,         MKTAG('v', '2', '1', '0') },
-    { CODEC_ID_INDEO3,       MKTAG('I', 'V', '3', '1') },
-    { CODEC_ID_INDEO3,       MKTAG('I', 'V', '3', '2') },
-    { CODEC_ID_INDEO4,       MKTAG('I', 'V', '4', '1') },
-    { CODEC_ID_INDEO5,       MKTAG('I', 'V', '5', '0') },
-    { CODEC_ID_VP3,          MKTAG('V', 'P', '3', '1') },
-    { CODEC_ID_VP3,          MKTAG('V', 'P', '3', '0') },
-    { CODEC_ID_VP5,          MKTAG('V', 'P', '5', '0') },
-    { CODEC_ID_VP6,          MKTAG('V', 'P', '6', '0') },
-    { CODEC_ID_VP6,          MKTAG('V', 'P', '6', '1') },
-    { CODEC_ID_VP6,          MKTAG('V', 'P', '6', '2') },
-    { CODEC_ID_VP6F,         MKTAG('V', 'P', '6', 'F') },
-    { CODEC_ID_VP6F,         MKTAG('F', 'L', 'V', '4') },
-    { CODEC_ID_VP8,          MKTAG('V', 'P', '8', '0') },
-    { CODEC_ID_ASV1,         MKTAG('A', 'S', 'V', '1') },
-    { CODEC_ID_ASV2,         MKTAG('A', 'S', 'V', '2') },
-    { CODEC_ID_VCR1,         MKTAG('V', 'C', 'R', '1') },
-    { CODEC_ID_FFV1,         MKTAG('F', 'F', 'V', '1') },
-    { CODEC_ID_XAN_WC4,      MKTAG('X', 'x', 'a', 'n') },
-    { CODEC_ID_MIMIC,        MKTAG('L', 'M', '2', '0') },
-    { CODEC_ID_MSRLE,        MKTAG('m', 'r', 'l', 'e') },
-    { CODEC_ID_MSRLE,        MKTAG( 1 ,  0 ,  0 ,  0 ) },
-    { CODEC_ID_MSRLE,        MKTAG( 2 ,  0 ,  0 ,  0 ) },
-    { CODEC_ID_MSVIDEO1,     MKTAG('M', 'S', 'V', 'C') },
-    { CODEC_ID_MSVIDEO1,     MKTAG('m', 's', 'v', 'c') },
-    { CODEC_ID_MSVIDEO1,     MKTAG('C', 'R', 'A', 'M') },
-    { CODEC_ID_MSVIDEO1,     MKTAG('c', 'r', 'a', 'm') },
-    { CODEC_ID_MSVIDEO1,     MKTAG('W', 'H', 'A', 'M') },
-    { CODEC_ID_MSVIDEO1,     MKTAG('w', 'h', 'a', 'm') },
-    { CODEC_ID_CINEPAK,      MKTAG('c', 'v', 'i', 'd') },
-    { CODEC_ID_TRUEMOTION1,  MKTAG('D', 'U', 'C', 'K') },
-    { CODEC_ID_TRUEMOTION1,  MKTAG('P', 'V', 'E', 'Z') },
-    { CODEC_ID_MSZH,         MKTAG('M', 'S', 'Z', 'H') },
-    { CODEC_ID_ZLIB,         MKTAG('Z', 'L', 'I', 'B') },
-    { CODEC_ID_SNOW,         MKTAG('S', 'N', 'O', 'W') },
-    { CODEC_ID_4XM,          MKTAG('4', 'X', 'M', 'V') },
-    { CODEC_ID_FLV1,         MKTAG('F', 'L', 'V', '1') },
-    { CODEC_ID_FLASHSV,      MKTAG('F', 'S', 'V', '1') },
-    { CODEC_ID_SVQ1,         MKTAG('s', 'v', 'q', '1') },
-    { CODEC_ID_TSCC,         MKTAG('t', 's', 'c', 'c') },
-    { CODEC_ID_ULTI,         MKTAG('U', 'L', 'T', 'I') },
-    { CODEC_ID_VIXL,         MKTAG('V', 'I', 'X', 'L') },
-    { CODEC_ID_QPEG,         MKTAG('Q', 'P', 'E', 'G') },
-    { CODEC_ID_QPEG,         MKTAG('Q', '1', '.', '0') },
-    { CODEC_ID_QPEG,         MKTAG('Q', '1', '.', '1') },
-    { CODEC_ID_WMV3,         MKTAG('W', 'M', 'V', '3') },
-    { CODEC_ID_VC1,          MKTAG('W', 'V', 'C', '1') },
-    { CODEC_ID_VC1,          MKTAG('W', 'M', 'V', 'A') },
-    { CODEC_ID_LOCO,         MKTAG('L', 'O', 'C', 'O') },
-    { CODEC_ID_WNV1,         MKTAG('W', 'N', 'V', '1') },
-    { CODEC_ID_AASC,         MKTAG('A', 'A', 'S', 'C') },
-    { CODEC_ID_INDEO2,       MKTAG('R', 'T', '2', '1') },
-    { CODEC_ID_FRAPS,        MKTAG('F', 'P', 'S', '1') },
-    { CODEC_ID_THEORA,       MKTAG('t', 'h', 'e', 'o') },
-    { CODEC_ID_TRUEMOTION2,  MKTAG('T', 'M', '2', '0') },
-    { CODEC_ID_CSCD,         MKTAG('C', 'S', 'C', 'D') },
-    { CODEC_ID_ZMBV,         MKTAG('Z', 'M', 'B', 'V') },
-    { CODEC_ID_KMVC,         MKTAG('K', 'M', 'V', 'C') },
-    { CODEC_ID_CAVS,         MKTAG('C', 'A', 'V', 'S') },
-    { CODEC_ID_JPEG2000,     MKTAG('M', 'J', '2', 'C') },
-    { CODEC_ID_VMNC,         MKTAG('V', 'M', 'n', 'c') },
-    { CODEC_ID_TARGA,        MKTAG('t', 'g', 'a', ' ') },
-    { CODEC_ID_PNG,          MKTAG('M', 'P', 'N', 'G') },
-    { CODEC_ID_PNG,          MKTAG('P', 'N', 'G', '1') },
-    { CODEC_ID_CLJR,         MKTAG('c', 'l', 'j', 'r') },
-    { CODEC_ID_DIRAC,        MKTAG('d', 'r', 'a', 'c') },
-    { CODEC_ID_RPZA,         MKTAG('a', 'z', 'p', 'r') },
-    { CODEC_ID_RPZA,         MKTAG('R', 'P', 'Z', 'A') },
-    { CODEC_ID_RPZA,         MKTAG('r', 'p', 'z', 'a') },
-    { CODEC_ID_SP5X,         MKTAG('S', 'P', '5', '4') },
-    { CODEC_ID_AURA,         MKTAG('A', 'U', 'R', 'A') },
-    { CODEC_ID_AURA2,        MKTAG('A', 'U', 'R', '2') },
-    { CODEC_ID_DPX,          MKTAG('d', 'p', 'x', ' ') },
-    { CODEC_ID_KGV1,         MKTAG('K', 'G', 'V', '1') },
-    { CODEC_ID_NONE,         0 }
-};
-
-const AVCodecTag ff_codec_wav_tags[] = {
-    { CODEC_ID_PCM_S16LE,       0x0001 },
-    { CODEC_ID_PCM_U8,          0x0001 }, /* must come after s16le in this list */
-    { CODEC_ID_PCM_S24LE,       0x0001 },
-    { CODEC_ID_PCM_S32LE,       0x0001 },
-    { CODEC_ID_ADPCM_MS,        0x0002 },
-    { CODEC_ID_PCM_F32LE,       0x0003 },
-    { CODEC_ID_PCM_F64LE,       0x0003 }, /* must come after f32le in this list */
-    { CODEC_ID_PCM_ALAW,        0x0006 },
-    { CODEC_ID_PCM_MULAW,       0x0007 },
-    { CODEC_ID_WMAVOICE,        0x000A },
-    { CODEC_ID_ADPCM_IMA_WAV,   0x0011 },
-    { CODEC_ID_PCM_ZORK,        0x0011 }, /* must come after adpcm_ima_wav in this list */
-    { CODEC_ID_ADPCM_YAMAHA,    0x0020 },
-    { CODEC_ID_TRUESPEECH,      0x0022 },
-    { CODEC_ID_GSM_MS,          0x0031 },
-    { CODEC_ID_ADPCM_G726,      0x0045 },
-    { CODEC_ID_MP2,             0x0050 },
-    { CODEC_ID_MP3,             0x0055 },
-    { CODEC_ID_AMR_NB,          0x0057 },
-    { CODEC_ID_AMR_WB,          0x0058 },
-    { CODEC_ID_ADPCM_IMA_DK4,   0x0061 },  /* rogue format number */
-    { CODEC_ID_ADPCM_IMA_DK3,   0x0062 },  /* rogue format number */
-    { CODEC_ID_ADPCM_IMA_WAV,   0x0069 },
-    { CODEC_ID_VOXWARE,         0x0075 },
-    { CODEC_ID_AAC,             0x00ff },
-    { CODEC_ID_SIPR,            0x0130 },
-    { CODEC_ID_WMAV1,           0x0160 },
-    { CODEC_ID_WMAV2,           0x0161 },
-    { CODEC_ID_WMAPRO,          0x0162 },
-    { CODEC_ID_WMALOSSLESS,     0x0163 },
-    { CODEC_ID_ADPCM_CT,        0x0200 },
-    { CODEC_ID_ATRAC3,          0x0270 },
-    { CODEC_ID_IMC,             0x0401 },
-    { CODEC_ID_GSM_MS,          0x1500 },
-    { CODEC_ID_TRUESPEECH,      0x1501 },
-    { CODEC_ID_AC3,             0x2000 },
-    { CODEC_ID_DTS,             0x2001 },
-    { CODEC_ID_SONIC,           0x2048 },
-    { CODEC_ID_SONIC_LS,        0x2048 },
-    { CODEC_ID_PCM_MULAW,       0x6c75 },
-    { CODEC_ID_AAC,             0x706d },
-    { CODEC_ID_AAC,             0x4143 },
-    { CODEC_ID_FLAC,            0xF1AC },
-    { CODEC_ID_ADPCM_SWF,       ('S'<<8)+'F' },
-    { CODEC_ID_VORBIS,          ('V'<<8)+'o' }, //HACK/FIXME, does vorbis in WAV/AVI have an (in)official id?
-
-    /* FIXME: All of the IDs below are not 16 bit and thus illegal. */
-    // for NuppelVideo (nuv.c)
-    { CODEC_ID_PCM_S16LE, MKTAG('R', 'A', 'W', 'A') },
-    { CODEC_ID_MP3,       MKTAG('L', 'A', 'M', 'E') },
-    { CODEC_ID_MP3,       MKTAG('M', 'P', '3', ' ') },
-    { CODEC_ID_NONE,      0 },
-};
-
-#if CONFIG_MUXERS
-int64_t ff_start_tag(ByteIOContext *pb, const char *tag)
-{
-    put_tag(pb, tag);
-    put_le32(pb, 0);
-    return url_ftell(pb);
-}
-
-void ff_end_tag(ByteIOContext *pb, int64_t start)
-{
-    int64_t pos;
-
-    pos = url_ftell(pb);
-    url_fseek(pb, start - 4, SEEK_SET);
-    put_le32(pb, (uint32_t)(pos - start));
-    url_fseek(pb, pos, SEEK_SET);
-}
-
-/* WAVEFORMATEX header */
-/* returns the size or -1 on error */
-int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc)
-{
-    int bps, blkalign, bytespersec;
-    int hdrsize = 18;
-    int waveformatextensible;
-    uint8_t temp[256];
-    uint8_t *riff_extradata= temp;
-    uint8_t *riff_extradata_start= temp;
-
-    if(!enc->codec_tag || enc->codec_tag > 0xffff)
-        return -1;
-    waveformatextensible =   (enc->channels > 2 && enc->channel_layout)
-                          || enc->sample_rate > 48000
-                          || av_get_bits_per_sample(enc->codec_id) > 16;
-
-    if (waveformatextensible) {
-        put_le16(pb, 0xfffe);
-    } else {
-        put_le16(pb, enc->codec_tag);
-    }
-    put_le16(pb, enc->channels);
-    put_le32(pb, enc->sample_rate);
-    if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_GSM_MS) {
-        bps = 0;
-    } else if (enc->codec_id == CODEC_ID_ADPCM_G726) {
-        bps = 4;
-    } else {
-        if (!(bps = av_get_bits_per_sample(enc->codec_id)))
-            bps = 16; // default to 16
-    }
-    if(bps != enc->bits_per_coded_sample && enc->bits_per_coded_sample){
-        av_log(enc, AV_LOG_WARNING, "requested bits_per_coded_sample (%d) and actually stored (%d) differ\n", enc->bits_per_coded_sample, bps);
-    }
-
-    if (enc->codec_id == CODEC_ID_MP2 || enc->codec_id == CODEC_ID_MP3 || enc->codec_id == CODEC_ID_AC3) {
-        blkalign = enc->frame_size; //this is wrong, but it seems many demuxers do not work if this is set correctly
-        //blkalign = 144 * enc->bit_rate/enc->sample_rate;
-    } else if (enc->codec_id == CODEC_ID_ADPCM_G726) { //
-        blkalign = 1;
-    } else if (enc->block_align != 0) { /* specified by the codec */
-        blkalign = enc->block_align;
-    } else
-        blkalign = enc->channels*bps >> 3;
-    if (enc->codec_id == CODEC_ID_PCM_U8 ||
-        enc->codec_id == CODEC_ID_PCM_S24LE ||
-        enc->codec_id == CODEC_ID_PCM_S32LE ||
-        enc->codec_id == CODEC_ID_PCM_F32LE ||
-        enc->codec_id == CODEC_ID_PCM_F64LE ||
-        enc->codec_id == CODEC_ID_PCM_S16LE) {
-        bytespersec = enc->sample_rate * blkalign;
-    } else {
-        bytespersec = enc->bit_rate / 8;
-    }
-    put_le32(pb, bytespersec); /* bytes per second */
-    put_le16(pb, blkalign); /* block align */
-    put_le16(pb, bps); /* bits per sample */
-    if (enc->codec_id == CODEC_ID_MP3) {
-        hdrsize += 12;
-        bytestream_put_le16(&riff_extradata, 1);    /* wID */
-        bytestream_put_le32(&riff_extradata, 2);    /* fdwFlags */
-        bytestream_put_le16(&riff_extradata, 1152); /* nBlockSize */
-        bytestream_put_le16(&riff_extradata, 1);    /* nFramesPerBlock */
-        bytestream_put_le16(&riff_extradata, 1393); /* nCodecDelay */
-    } else if (enc->codec_id == CODEC_ID_MP2) {
-        hdrsize += 22;
-        bytestream_put_le16(&riff_extradata, 2);                          /* fwHeadLayer */
-        bytestream_put_le32(&riff_extradata, enc->bit_rate);              /* dwHeadBitrate */
-        bytestream_put_le16(&riff_extradata, enc->channels == 2 ? 1 : 8); /* fwHeadMode */
-        bytestream_put_le16(&riff_extradata, 0);                          /* fwHeadModeExt */
-        bytestream_put_le16(&riff_extradata, 1);                          /* wHeadEmphasis */
-        bytestream_put_le16(&riff_extradata, 16);                         /* fwHeadFlags */
-        bytestream_put_le32(&riff_extradata, 0);                          /* dwPTSLow */
-        bytestream_put_le32(&riff_extradata, 0);                          /* dwPTSHigh */
-    } else if (enc->codec_id == CODEC_ID_GSM_MS || enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
-        hdrsize += 2;
-        bytestream_put_le16(&riff_extradata, enc->frame_size); /* wSamplesPerBlock */
-    } else if(enc->extradata_size){
-        riff_extradata_start= enc->extradata;
-        riff_extradata= enc->extradata + enc->extradata_size;
-        hdrsize += enc->extradata_size;
-    } else if (!waveformatextensible){
-        hdrsize -= 2;
-    }
-    if(waveformatextensible) {                                    /* write WAVEFORMATEXTENSIBLE extensions */
-        hdrsize += 22;
-        put_le16(pb, riff_extradata - riff_extradata_start + 22); /* 22 is WAVEFORMATEXTENSIBLE size */
-        put_le16(pb, enc->bits_per_coded_sample);                 /* ValidBitsPerSample || SamplesPerBlock || Reserved */
-        put_le32(pb, enc->channel_layout);                        /* dwChannelMask */
-        put_le32(pb, enc->codec_tag);                             /* GUID + next 3 */
-        put_le32(pb, 0x00100000);
-        put_le32(pb, 0xAA000080);
-        put_le32(pb, 0x719B3800);
-    } else if(riff_extradata - riff_extradata_start) {
-        put_le16(pb, riff_extradata - riff_extradata_start);
-    }
-    put_buffer(pb, riff_extradata_start, riff_extradata - riff_extradata_start);
-    if(hdrsize&1){
-        hdrsize++;
-        put_byte(pb, 0);
-    }
-
-    return hdrsize;
-}
-
-/* BITMAPINFOHEADER header */
-void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf)
-{
-    put_le32(pb, 40 + enc->extradata_size); /* size */
-    put_le32(pb, enc->width);
-    //We always store RGB TopDown
-    put_le32(pb, enc->codec_tag ? enc->height : -enc->height);
-    put_le16(pb, 1); /* planes */
-
-    put_le16(pb, enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24); /* depth */
-    /* compression type */
-    put_le32(pb, enc->codec_tag);
-    put_le32(pb, enc->width * enc->height * 3);
-    put_le32(pb, 0);
-    put_le32(pb, 0);
-    put_le32(pb, 0);
-    put_le32(pb, 0);
-
-    put_buffer(pb, enc->extradata, enc->extradata_size);
-
-    if (!for_asf && enc->extradata_size & 1)
-        put_byte(pb, 0);
-}
-#endif //CONFIG_MUXERS
-
-#if CONFIG_DEMUXERS
-/* We could be given one of the three possible structures here:
- * WAVEFORMAT, PCMWAVEFORMAT or WAVEFORMATEX. Each structure
- * is an expansion of the previous one with the fields added
- * at the bottom. PCMWAVEFORMAT adds 'WORD wBitsPerSample' and
- * WAVEFORMATEX adds 'WORD  cbSize' and basically makes itself
- * an openended structure.
- */
-void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
-{
-    int id;
-
-    id = get_le16(pb);
-    codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    codec->codec_tag = id;
-    codec->channels = get_le16(pb);
-    codec->sample_rate = get_le32(pb);
-    codec->bit_rate = get_le32(pb) * 8;
-    codec->block_align = get_le16(pb);
-    if (size == 14) {  /* We're dealing with plain vanilla WAVEFORMAT */
-        codec->bits_per_coded_sample = 8;
-    }else
-        codec->bits_per_coded_sample = get_le16(pb);
-    if (size >= 18) {  /* We're obviously dealing with WAVEFORMATEX */
-        int cbSize = get_le16(pb); /* cbSize */
-        size -= 18;
-        cbSize = FFMIN(size, cbSize);
-        if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
-            codec->bits_per_coded_sample = get_le16(pb);
-            codec->channel_layout = get_le32(pb); /* dwChannelMask */
-            id = get_le32(pb); /* 4 first bytes of GUID */
-            url_fskip(pb, 12); /* skip end of GUID */
-            cbSize -= 22;
-            size -= 22;
-        }
-        codec->extradata_size = cbSize;
-        if (cbSize > 0) {
-            codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-            get_buffer(pb, codec->extradata, codec->extradata_size);
-            size -= cbSize;
-        }
-
-        /* It is possible for the chunk to contain garbage at the end */
-        if (size > 0)
-            url_fskip(pb, size);
-    }
-    codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample);
-}
-
-
-enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps)
-{
-    enum CodecID id;
-    id = ff_codec_get_id(ff_codec_wav_tags, tag);
-    if (id <= 0)
-        return id;
-    /* handle specific u8 codec */
-    if (id == CODEC_ID_PCM_S16LE && bps == 8)
-        id = CODEC_ID_PCM_U8;
-    if (id == CODEC_ID_PCM_S16LE && bps == 24)
-        id = CODEC_ID_PCM_S24LE;
-    if (id == CODEC_ID_PCM_S16LE && bps == 32)
-        id = CODEC_ID_PCM_S32LE;
-    if (id == CODEC_ID_PCM_F32LE && bps == 64)
-        id = CODEC_ID_PCM_F64LE;
-    if (id == CODEC_ID_ADPCM_IMA_WAV && bps == 8)
-        id = CODEC_ID_PCM_ZORK;
-    return id;
-}
-#endif // CONFIG_DEMUXERS
-
-void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale)
-{
-    int gcd;
-
-    *au_ssize= stream->block_align;
-    if(stream->frame_size && stream->sample_rate){
-        *au_scale=stream->frame_size;
-        *au_rate= stream->sample_rate;
-    }else if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
-             stream->codec_type == AVMEDIA_TYPE_SUBTITLE){
-        *au_scale= stream->time_base.num;
-        *au_rate = stream->time_base.den;
-    }else{
-        *au_scale= stream->block_align ? stream->block_align*8 : 8;
-        *au_rate = stream->bit_rate ? stream->bit_rate : 8*stream->sample_rate;
-    }
-    gcd= av_gcd(*au_scale, *au_rate);
-    *au_scale /= gcd;
-    *au_rate /= gcd;
-}
diff --git a/libavformat/riff.h b/libavformat/riff.h
deleted file mode 100644
index 2696a0b..0000000
--- a/libavformat/riff.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * RIFF codec tags
- * copyright (c) 2000 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * internal header for RIFF based (de)muxers
- * do NOT include this in end user applications
- */
-
-#ifndef AVFORMAT_RIFF_H
-#define AVFORMAT_RIFF_H
-
-#include "libavcodec/avcodec.h"
-#include "avio.h"
-
-int64_t ff_start_tag(ByteIOContext *pb, const char *tag);
-void ff_end_tag(ByteIOContext *pb, int64_t start);
-
-typedef struct AVCodecTag {
-    enum CodecID id;
-    unsigned int tag;
-} AVCodecTag;
-
-void ff_put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf);
-int ff_put_wav_header(ByteIOContext *pb, AVCodecContext *enc);
-enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps);
-void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size);
-
-extern const AVCodecTag ff_codec_bmp_tags[];
-extern const AVCodecTag ff_codec_wav_tags[];
-
-unsigned int ff_codec_get_tag(const AVCodecTag *tags, int id);
-enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
-void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale);
-
-#endif /* AVFORMAT_RIFF_H */
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
deleted file mode 100644
index 1b7edce..0000000
--- a/libavformat/rl2.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * RL2 Format Demuxer
- * Copyright (c) 2008 Sascha Sommer (saschasommer at freenet.de)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * RL2 file demuxer
- * @file
- * @author Sascha Sommer (saschasommer at freenet.de)
- * For more information regarding the RL2 file format, visit:
- *   http://wiki.multimedia.cx/index.php?title=RL2
- *
- * extradata:
- * 2 byte le initial drawing offset within 320x200 viewport
- * 4 byte le number of used colors
- * 256 * 3 bytes rgb palette
- * optional background_frame
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr, palette
-
-#define FORM_TAG MKBETAG('F', 'O', 'R', 'M')
-#define RLV2_TAG MKBETAG('R', 'L', 'V', '2')
-#define RLV3_TAG MKBETAG('R', 'L', 'V', '3')
-
-typedef struct Rl2DemuxContext {
-    unsigned int index_pos[2];   ///< indexes in the sample tables
-} Rl2DemuxContext;
-
-
-/**
- * check if the file is in rl2 format
- * @param p probe buffer
- * @return 0 when the probe buffer does not contain rl2 data, > 0 otherwise
- */
-static int rl2_probe(AVProbeData *p)
-{
-
-    if(AV_RB32(&p->buf[0]) != FORM_TAG)
-        return 0;
-
-    if(AV_RB32(&p->buf[8]) != RLV2_TAG &&
-        AV_RB32(&p->buf[8]) != RLV3_TAG)
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-/**
- * read rl2 header data and setup the avstreams
- * @param s demuxer context
- * @param ap format parameters
- * @return 0 on success, AVERROR otherwise
- */
-static av_cold int rl2_read_header(AVFormatContext *s,
-                            AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    unsigned int frame_count;
-    unsigned int audio_frame_counter = 0;
-    unsigned int video_frame_counter = 0;
-    unsigned int back_size;
-    int data_size;
-    unsigned short encoding_method;
-    unsigned short sound_rate;
-    unsigned short rate;
-    unsigned short channels;
-    unsigned short def_sound_size;
-    unsigned int signature;
-    unsigned int pts_den = 11025; /* video only case */
-    unsigned int pts_num = 1103;
-    unsigned int* chunk_offset = NULL;
-    int* chunk_size = NULL;
-    int* audio_size = NULL;
-    int i;
-    int ret = 0;
-
-    url_fskip(pb,4);          /* skip FORM tag */
-    back_size = get_le32(pb); /** get size of the background frame */
-    signature = get_be32(pb);
-    data_size = get_be32(pb);
-    frame_count = get_le32(pb);
-
-    /* disallow back_sizes and frame_counts that may lead to overflows later */
-    if(back_size > INT_MAX/2  || frame_count > INT_MAX / sizeof(uint32_t))
-        return AVERROR_INVALIDDATA;
-
-    encoding_method = get_le16(pb);
-    sound_rate = get_le16(pb);
-    rate = get_le16(pb);
-    channels = get_le16(pb);
-    def_sound_size = get_le16(pb);
-
-    /** setup video stream */
-    st = av_new_stream(s, 0);
-    if(!st)
-         return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_RL2;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = 320;
-    st->codec->height = 200;
-
-    /** allocate and fill extradata */
-    st->codec->extradata_size = EXTRADATA1_SIZE;
-
-    if(signature == RLV3_TAG && back_size > 0)
-        st->codec->extradata_size += back_size;
-
-    st->codec->extradata = av_mallocz(st->codec->extradata_size +
-                                          FF_INPUT_BUFFER_PADDING_SIZE);
-    if(!st->codec->extradata)
-        return AVERROR(ENOMEM);
-
-    if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) !=
-                      st->codec->extradata_size)
-        return AVERROR(EIO);
-
-    /** setup audio stream if present */
-    if(sound_rate){
-        pts_num = def_sound_size;
-        pts_den = rate;
-
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = CODEC_ID_PCM_U8;
-        st->codec->codec_tag = 1;
-        st->codec->channels = channels;
-        st->codec->bits_per_coded_sample = 8;
-        st->codec->sample_rate = rate;
-        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-            st->codec->bits_per_coded_sample;
-        st->codec->block_align = st->codec->channels *
-            st->codec->bits_per_coded_sample / 8;
-        av_set_pts_info(st,32,1,rate);
-    }
-
-    av_set_pts_info(s->streams[0], 32, pts_num, pts_den);
-
-    chunk_size =   av_malloc(frame_count * sizeof(uint32_t));
-    audio_size =   av_malloc(frame_count * sizeof(uint32_t));
-    chunk_offset = av_malloc(frame_count * sizeof(uint32_t));
-
-    if(!chunk_size || !audio_size || !chunk_offset){
-        av_free(chunk_size);
-        av_free(audio_size);
-        av_free(chunk_offset);
-        return AVERROR(ENOMEM);
-    }
-
-    /** read offset and size tables */
-    for(i=0; i < frame_count;i++)
-        chunk_size[i] = get_le32(pb);
-    for(i=0; i < frame_count;i++)
-        chunk_offset[i] = get_le32(pb);
-    for(i=0; i < frame_count;i++)
-        audio_size[i] = get_le32(pb) & 0xFFFF;
-
-    /** build the sample index */
-    for(i=0;i<frame_count;i++){
-        if(chunk_size[i] < 0 || audio_size[i] > chunk_size[i]){
-            ret = AVERROR_INVALIDDATA;
-            break;
-        }
-
-        if(sound_rate && audio_size[i]){
-            av_add_index_entry(s->streams[1], chunk_offset[i],
-                audio_frame_counter,audio_size[i], 0, AVINDEX_KEYFRAME);
-            audio_frame_counter += audio_size[i] / channels;
-        }
-        av_add_index_entry(s->streams[0], chunk_offset[i] + audio_size[i],
-            video_frame_counter,chunk_size[i]-audio_size[i],0,AVINDEX_KEYFRAME);
-        ++video_frame_counter;
-    }
-
-
-    av_free(chunk_size);
-    av_free(audio_size);
-    av_free(chunk_offset);
-
-    return ret;
-}
-
-/**
- * read a single audio or video packet
- * @param s demuxer context
- * @param pkt the packet to be filled
- * @return 0 on success, AVERROR otherwise
- */
-static int rl2_read_packet(AVFormatContext *s,
-                            AVPacket *pkt)
-{
-    Rl2DemuxContext *rl2 = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVIndexEntry *sample = NULL;
-    int i;
-    int ret = 0;
-    int stream_id = -1;
-    int64_t pos = INT64_MAX;
-
-    /** check if there is a valid video or audio entry that can be used */
-    for(i=0; i<s->nb_streams; i++){
-        if(rl2->index_pos[i] < s->streams[i]->nb_index_entries
-              && s->streams[i]->index_entries[ rl2->index_pos[i] ].pos < pos){
-            sample = &s->streams[i]->index_entries[ rl2->index_pos[i] ];
-            pos= sample->pos;
-            stream_id= i;
-        }
-    }
-
-    if(stream_id == -1)
-        return AVERROR(EIO);
-
-    ++rl2->index_pos[stream_id];
-
-    /** position the stream (will probably be there anyway) */
-    url_fseek(pb, sample->pos, SEEK_SET);
-
-    /** fill the packet */
-    ret = av_get_packet(pb, pkt, sample->size);
-    if(ret != sample->size){
-        av_free_packet(pkt);
-        return AVERROR(EIO);
-    }
-
-    pkt->stream_index = stream_id;
-    pkt->pts = sample->timestamp;
-
-    return ret;
-}
-
-/**
- * seek to a new timestamp
- * @param s demuxer context
- * @param stream_index index of the stream that should be seeked
- * @param timestamp wanted timestamp
- * @param flags direction and seeking mode
- * @return 0 on success, -1 otherwise
- */
-static int rl2_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st = s->streams[stream_index];
-    Rl2DemuxContext *rl2 = s->priv_data;
-    int i;
-    int index = av_index_search_timestamp(st, timestamp, flags);
-    if(index < 0)
-        return -1;
-
-    rl2->index_pos[stream_index] = index;
-    timestamp = st->index_entries[index].timestamp;
-
-    for(i=0; i < s->nb_streams; i++){
-        AVStream *st2 = s->streams[i];
-        index = av_index_search_timestamp(st2,
-                    av_rescale_q(timestamp, st->time_base, st2->time_base),
-                    flags | AVSEEK_FLAG_BACKWARD);
-
-        if(index < 0)
-            index = 0;
-
-        rl2->index_pos[i] = index;
-    }
-
-    return 0;
-}
-
-AVInputFormat rl2_demuxer = {
-    "rl2",
-    NULL_IF_CONFIG_SMALL("RL2 format"),
-    sizeof(Rl2DemuxContext),
-    rl2_probe,
-    rl2_read_header,
-    rl2_read_packet,
-    NULL,
-    rl2_read_seek,
-};
-
diff --git a/libavformat/rm.c b/libavformat/rm.c
deleted file mode 100644
index 29a6e40..0000000
--- a/libavformat/rm.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * "Real" compatible muxer and demuxer common code.
- * Copyright (c) 2009  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "rm.h"
-
-const char * const ff_rm_metadata[4] = {
-    "title",
-    "author",
-    "copyright",
-    "comment"
-};
diff --git a/libavformat/rm.h b/libavformat/rm.h
deleted file mode 100644
index 4e63114..0000000
--- a/libavformat/rm.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * "Real" compatible muxer and demuxer.
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RM_H
-#define AVFORMAT_RM_H
-
-#include "avformat.h"
-
-extern const char * const ff_rm_metadata[4];
-extern const unsigned char ff_sipr_subpk_size[4];
-
-typedef struct RMStream RMStream;
-
-RMStream *ff_rm_alloc_rmstream (void);
-void      ff_rm_free_rmstream  (RMStream *rms);
-
-/*< input format for Realmedia-style RTSP streams */
-extern AVInputFormat rdt_demuxer;
-
-/**
- * Read the MDPR chunk, which contains stream-specific codec initialization
- * parameters.
- *
- * @param s context containing RMContext and ByteIOContext for stream reading
- * @param pb context to read the data from
- * @param st the stream that the MDPR chunk belongs to and where to store the
- *           parameters read from the chunk into
- * @param rst real-specific stream information
- * @param codec_data_size size of the MDPR chunk
- * @return 0 on success, errno codes on error
- */
-int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
-                               AVStream *st, RMStream *rst,
-                               int codec_data_size);
-
-/**
- * Parse one rm-stream packet from the input bytestream.
- *
- * @param s context containing RMContext and ByteIOContext for stream reading
- * @param pb context to read the data from
- * @param st stream to which the packet to be read belongs
- * @param rst Real-specific stream information
- * @param len packet length to read from the input
- * @param pkt packet location to store the parsed packet data
- * @param seq pointer to an integer containing the sequence number, may be
- *            updated
- * @param flags the packet flags
- * @param ts timestamp of the current packet
- * @return <0 on error, 0 if a packet was placed in the pkt pointer. A
- *         value >0 means that no data was placed in pkt, but that cached
- *         data is available by calling ff_rm_retrieve_cache().
- */
-int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
-                        AVStream *st, RMStream *rst, int len,
-                        AVPacket *pkt, int *seq, int flags, int64_t ts);
-
-/**
- * Retrieve one cached packet from the rm-context. The real container can
- * store several packets (as interpreted by the codec) in a single container
- * packet, which means the demuxer holds some back when the first container
- * packet is parsed and returned. The result is that rm->audio_pkt_cnt is
- * a positive number, the amount of cached packets. Using this function, each
- * of those packets can be retrieved sequentially.
- *
- * @param s context containing RMContext and ByteIOContext for stream reading
- * @param pb context to read the data from
- * @param st stream that this packet belongs to
- * @param rst Real-specific stream information
- * @param pkt location to store the packet data
- * @return the number of samples left for subsequent calls to this same
- *          function, or 0 if all samples have been retrieved.
- */
-int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
-                          AVStream *st, RMStream *rst, AVPacket *pkt);
-
-/**
- * Perform 4-bit block reordering for SIPR data.
- *
- * @param buf SIPR data
- */
-void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize);
-
-#endif /* AVFORMAT_RM_H */
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
deleted file mode 100644
index f4603bf..0000000
--- a/libavformat/rmdec.c
+++ /dev/null
@@ -1,977 +0,0 @@
-/*
- * "Real" compatible demuxer.
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avstring.h"
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "riff.h"
-#include "rm.h"
-
-struct RMStream {
-    AVPacket pkt;      ///< place to store merged video frame / reordered audio data
-    int videobufsize;  ///< current assembled frame size
-    int videobufpos;   ///< position for the next slice in the video buffer
-    int curpic_num;    ///< picture number of current frame
-    int cur_slice, slices;
-    int64_t pktpos;    ///< first slice position in file
-    /// Audio descrambling matrix parameters
-    int64_t audiotimestamp; ///< Audio packet timestamp
-    int sub_packet_cnt; // Subpacket counter, used while reading
-    int sub_packet_size, sub_packet_h, coded_framesize; ///< Descrambling parameters from container
-    int audio_framesize; /// Audio frame size from container
-    int sub_packet_lengths[16]; /// Length of each subpacket
-};
-
-typedef struct {
-    int nb_packets;
-    int old_format;
-    int current_stream;
-    int remaining_len;
-    int audio_stream_num; ///< Stream number for audio packets
-    int audio_pkt_cnt; ///< Output packet counter
-} RMDemuxContext;
-
-static const AVCodecTag rm_codec_tags[] = {
-    { CODEC_ID_RV10,   MKTAG('R','V','1','0') },
-    { CODEC_ID_RV20,   MKTAG('R','V','2','0') },
-    { CODEC_ID_RV20,   MKTAG('R','V','T','R') },
-    { CODEC_ID_RV30,   MKTAG('R','V','3','0') },
-    { CODEC_ID_RV40,   MKTAG('R','V','4','0') },
-    { CODEC_ID_AC3,    MKTAG('d','n','e','t') },
-    { CODEC_ID_RA_144, MKTAG('l','p','c','J') },
-    { CODEC_ID_RA_288, MKTAG('2','8','_','8') },
-    { CODEC_ID_COOK,   MKTAG('c','o','o','k') },
-    { CODEC_ID_ATRAC3, MKTAG('a','t','r','c') },
-    { CODEC_ID_SIPR,   MKTAG('s','i','p','r') },
-    { CODEC_ID_AAC,    MKTAG('r','a','a','c') },
-    { CODEC_ID_AAC,    MKTAG('r','a','c','p') },
-    { CODEC_ID_NONE },
-};
-
-static const unsigned char sipr_swaps[38][2] = {
-    {  0, 63 }, {  1, 22 }, {  2, 44 }, {  3, 90 },
-    {  5, 81 }, {  7, 31 }, {  8, 86 }, {  9, 58 },
-    { 10, 36 }, { 12, 68 }, { 13, 39 }, { 14, 73 },
-    { 15, 53 }, { 16, 69 }, { 17, 57 }, { 19, 88 },
-    { 20, 34 }, { 21, 71 }, { 24, 46 }, { 25, 94 },
-    { 26, 54 }, { 28, 75 }, { 29, 50 }, { 32, 70 },
-    { 33, 92 }, { 35, 74 }, { 38, 85 }, { 40, 56 },
-    { 42, 87 }, { 43, 65 }, { 45, 59 }, { 48, 79 },
-    { 49, 93 }, { 51, 89 }, { 55, 95 }, { 61, 76 },
-    { 67, 83 }, { 77, 80 }
-};
-
-const unsigned char ff_sipr_subpk_size[4] = { 29, 19, 37, 20 };
-
-static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len)
-{
-    int i;
-    char *q, r;
-
-    q = buf;
-    for(i=0;i<len;i++) {
-        r = get_byte(pb);
-        if (i < buf_size - 1)
-            *q++ = r;
-    }
-    if (buf_size > 0) *q = '\0';
-}
-
-static void get_str8(ByteIOContext *pb, char *buf, int buf_size)
-{
-    get_strl(pb, buf, buf_size, get_byte(pb));
-}
-
-static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned size)
-{
-    if (size >= 1<<24)
-        return -1;
-    avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!avctx->extradata)
-        return AVERROR(ENOMEM);
-    avctx->extradata_size = get_buffer(pb, avctx->extradata, size);
-    memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-    if (avctx->extradata_size != size)
-        return AVERROR(EIO);
-    return 0;
-}
-
-static void rm_read_metadata(AVFormatContext *s, int wide)
-{
-    char buf[1024];
-    int i;
-    for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
-        int len = wide ? get_be16(s->pb) : get_byte(s->pb);
-        get_strl(s->pb, buf, sizeof(buf), len);
-        av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0);
-    }
-}
-
-RMStream *ff_rm_alloc_rmstream (void)
-{
-    RMStream *rms = av_mallocz(sizeof(RMStream));
-    rms->curpic_num = -1;
-    return rms;
-}
-
-void ff_rm_free_rmstream (RMStream *rms)
-{
-    av_free_packet(&rms->pkt);
-}
-
-static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
-                                     AVStream *st, RMStream *ast, int read_all)
-{
-    char buf[256];
-    uint32_t version;
-    int ret;
-
-    /* ra type header */
-    version = get_be16(pb); /* version */
-    if (version == 3) {
-        int header_size = get_be16(pb);
-        int64_t startpos = url_ftell(pb);
-        url_fskip(pb, 14);
-        rm_read_metadata(s, 0);
-        if ((startpos + header_size) >= url_ftell(pb) + 2) {
-            // fourcc (should always be "lpcJ")
-            get_byte(pb);
-            get_str8(pb, buf, sizeof(buf));
-        }
-        // Skip extra header crap (this should never happen)
-        if ((startpos + header_size) > url_ftell(pb))
-            url_fskip(pb, header_size + startpos - url_ftell(pb));
-        st->codec->sample_rate = 8000;
-        st->codec->channels = 1;
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = CODEC_ID_RA_144;
-    } else {
-        int flavor, sub_packet_h, coded_framesize, sub_packet_size;
-        int codecdata_length;
-        /* old version (4) */
-        url_fskip(pb, 2); /* unused */
-        get_be32(pb); /* .ra4 */
-        get_be32(pb); /* data size */
-        get_be16(pb); /* version2 */
-        get_be32(pb); /* header size */
-        flavor= get_be16(pb); /* add codec info / flavor */
-        ast->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */
-        get_be32(pb); /* ??? */
-        get_be32(pb); /* ??? */
-        get_be32(pb); /* ??? */
-        ast->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */
-        st->codec->block_align= get_be16(pb); /* frame size */
-        ast->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */
-        get_be16(pb); /* ??? */
-        if (version == 5) {
-            get_be16(pb); get_be16(pb); get_be16(pb);
-        }
-        st->codec->sample_rate = get_be16(pb);
-        get_be32(pb);
-        st->codec->channels = get_be16(pb);
-        if (version == 5) {
-            get_be32(pb);
-            get_buffer(pb, buf, 4);
-            buf[4] = 0;
-        } else {
-            get_str8(pb, buf, sizeof(buf)); /* desc */
-            get_str8(pb, buf, sizeof(buf)); /* desc */
-        }
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_tag  = AV_RL32(buf);
-        st->codec->codec_id   = ff_codec_get_id(rm_codec_tags, st->codec->codec_tag);
-        switch (st->codec->codec_id) {
-        case CODEC_ID_AC3:
-            st->need_parsing = AVSTREAM_PARSE_FULL;
-            break;
-        case CODEC_ID_RA_288:
-            st->codec->extradata_size= 0;
-            ast->audio_framesize = st->codec->block_align;
-            st->codec->block_align = coded_framesize;
-
-            if(ast->audio_framesize >= UINT_MAX / sub_packet_h){
-                av_log(s, AV_LOG_ERROR, "ast->audio_framesize * sub_packet_h too large\n");
-                return -1;
-            }
-
-            av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h);
-            break;
-        case CODEC_ID_COOK:
-        case CODEC_ID_ATRAC3:
-        case CODEC_ID_SIPR:
-            get_be16(pb); get_byte(pb);
-            if (version == 5)
-                get_byte(pb);
-            codecdata_length = get_be32(pb);
-            if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
-                av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
-                return -1;
-            }
-
-            if (!strcmp(buf, "cook")) st->codec->codec_id = CODEC_ID_COOK;
-            else if (!strcmp(buf, "sipr")) st->codec->codec_id = CODEC_ID_SIPR;
-            else st->codec->codec_id = CODEC_ID_ATRAC3;
-
-            ast->audio_framesize = st->codec->block_align;
-            if (st->codec->codec_id == CODEC_ID_SIPR) {
-                if (flavor > 3) {
-                    av_log(s, AV_LOG_ERROR, "bad SIPR file flavor %d\n",
-                           flavor);
-                    return -1;
-                }
-                st->codec->block_align = ff_sipr_subpk_size[flavor];
-            } else {
-                if(sub_packet_size <= 0){
-                    av_log(s, AV_LOG_ERROR, "sub_packet_size is invalid\n");
-                    return -1;
-                }
-                st->codec->block_align = ast->sub_packet_size;
-            }
-            if ((ret = rm_read_extradata(pb, st->codec, codecdata_length)) < 0)
-                return ret;
-
-            if(ast->audio_framesize >= UINT_MAX / sub_packet_h){
-                av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n");
-                return -1;
-            }
-
-            av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h);
-            break;
-        case CODEC_ID_AAC:
-            get_be16(pb); get_byte(pb);
-            if (version == 5)
-                get_byte(pb);
-            st->codec->codec_id = CODEC_ID_AAC;
-            codecdata_length = get_be32(pb);
-            if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
-                av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
-                return -1;
-            }
-            if (codecdata_length >= 1) {
-                get_byte(pb);
-                if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0)
-                    return ret;
-            }
-            break;
-        default:
-            av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name));
-        }
-        if (read_all) {
-            get_byte(pb);
-            get_byte(pb);
-            get_byte(pb);
-            rm_read_metadata(s, 0);
-        }
-    }
-    return 0;
-}
-
-int
-ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
-                           AVStream *st, RMStream *rst, int codec_data_size)
-{
-    unsigned int v;
-    int size;
-    int64_t codec_pos;
-    int ret;
-
-    av_set_pts_info(st, 64, 1, 1000);
-    codec_pos = url_ftell(pb);
-    v = get_be32(pb);
-    if (v == MKTAG(0xfd, 'a', 'r', '.')) {
-        /* ra type header */
-        if (rm_read_audio_stream_info(s, pb, st, rst, 0))
-            return -1;
-    } else {
-        int fps, fps2;
-        if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
-        fail1:
-            av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
-            goto skip;
-        }
-        st->codec->codec_tag = get_le32(pb);
-        st->codec->codec_id  = ff_codec_get_id(rm_codec_tags, st->codec->codec_tag);
-//        av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
-        if (st->codec->codec_id == CODEC_ID_NONE)
-            goto fail1;
-        st->codec->width = get_be16(pb);
-        st->codec->height = get_be16(pb);
-        st->codec->time_base.num= 1;
-        fps= get_be16(pb);
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        get_be32(pb);
-        fps2= get_be16(pb);
-        get_be16(pb);
-
-        if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0)
-            return ret;
-
-//        av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
-        st->codec->time_base.den = fps * st->codec->time_base.num;
-        //XXX: do we really need that?
-        switch(st->codec->extradata[4]>>4){
-        case 1: st->codec->codec_id = CODEC_ID_RV10; break;
-        case 2: st->codec->codec_id = CODEC_ID_RV20; break;
-        case 3: st->codec->codec_id = CODEC_ID_RV30; break;
-        case 4: st->codec->codec_id = CODEC_ID_RV40; break;
-        default:
-            av_log(st->codec, AV_LOG_ERROR, "extra:%02X %02X %02X %02X %02X\n", st->codec->extradata[0], st->codec->extradata[1], st->codec->extradata[2], st->codec->extradata[3], st->codec->extradata[4]);
-            goto fail1;
-        }
-    }
-
-skip:
-    /* skip codec info */
-    size = url_ftell(pb) - codec_pos;
-    url_fskip(pb, codec_data_size - size);
-
-    return 0;
-}
-
-/** this function assumes that the demuxer has already seeked to the start
- * of the INDX chunk, and will bail out if not. */
-static int rm_read_index(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    unsigned int size, n_pkts, str_id, next_off, n, pos, pts;
-    AVStream *st;
-
-    do {
-        if (get_le32(pb) != MKTAG('I','N','D','X'))
-            return -1;
-        size     = get_be32(pb);
-        if (size < 20)
-            return -1;
-        url_fskip(pb, 2);
-        n_pkts   = get_be32(pb);
-        str_id   = get_be16(pb);
-        next_off = get_be32(pb);
-        for (n = 0; n < s->nb_streams; n++)
-            if (s->streams[n]->id == str_id) {
-                st = s->streams[n];
-                break;
-            }
-        if (n == s->nb_streams)
-            goto skip;
-
-        for (n = 0; n < n_pkts; n++) {
-            url_fskip(pb, 2);
-            pts = get_be32(pb);
-            pos = get_be32(pb);
-            url_fskip(pb, 4); /* packet no. */
-
-            av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME);
-        }
-
-skip:
-        if (next_off && url_ftell(pb) != next_off &&
-            url_fseek(pb, next_off, SEEK_SET) < 0)
-            return -1;
-    } while (next_off);
-
-    return 0;
-}
-
-static int rm_read_header_old(AVFormatContext *s, AVFormatParameters *ap)
-{
-    RMDemuxContext *rm = s->priv_data;
-    AVStream *st;
-
-    rm->old_format = 1;
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-    st->priv_data = ff_rm_alloc_rmstream();
-    return rm_read_audio_stream_info(s, s->pb, st, st->priv_data, 1);
-}
-
-static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    RMDemuxContext *rm = s->priv_data;
-    AVStream *st;
-    ByteIOContext *pb = s->pb;
-    unsigned int tag;
-    int tag_size;
-    unsigned int start_time, duration;
-    unsigned int data_off = 0, indx_off = 0;
-    char buf[128];
-    int flags = 0;
-
-    tag = get_le32(pb);
-    if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
-        /* very old .ra format */
-        return rm_read_header_old(s, ap);
-    } else if (tag != MKTAG('.', 'R', 'M', 'F')) {
-        return AVERROR(EIO);
-    }
-
-    get_be32(pb); /* header size */
-    get_be16(pb);
-    get_be32(pb);
-    get_be32(pb); /* number of headers */
-
-    for(;;) {
-        if (url_feof(pb))
-            return -1;
-        tag = get_le32(pb);
-        tag_size = get_be32(pb);
-        get_be16(pb);
-#if 0
-        printf("tag=%c%c%c%c (%08x) size=%d\n",
-               (tag) & 0xff,
-               (tag >> 8) & 0xff,
-               (tag >> 16) & 0xff,
-               (tag >> 24) & 0xff,
-               tag,
-               tag_size);
-#endif
-        if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A'))
-            return -1;
-        switch(tag) {
-        case MKTAG('P', 'R', 'O', 'P'):
-            /* file header */
-            get_be32(pb); /* max bit rate */
-            get_be32(pb); /* avg bit rate */
-            get_be32(pb); /* max packet size */
-            get_be32(pb); /* avg packet size */
-            get_be32(pb); /* nb packets */
-            get_be32(pb); /* duration */
-            get_be32(pb); /* preroll */
-            indx_off = get_be32(pb); /* index offset */
-            data_off = get_be32(pb); /* data offset */
-            get_be16(pb); /* nb streams */
-            flags = get_be16(pb); /* flags */
-            break;
-        case MKTAG('C', 'O', 'N', 'T'):
-            rm_read_metadata(s, 1);
-            break;
-        case MKTAG('M', 'D', 'P', 'R'):
-            st = av_new_stream(s, 0);
-            if (!st)
-                return AVERROR(ENOMEM);
-            st->id = get_be16(pb);
-            get_be32(pb); /* max bit rate */
-            st->codec->bit_rate = get_be32(pb); /* bit rate */
-            get_be32(pb); /* max packet size */
-            get_be32(pb); /* avg packet size */
-            start_time = get_be32(pb); /* start time */
-            get_be32(pb); /* preroll */
-            duration = get_be32(pb); /* duration */
-            st->start_time = start_time;
-            st->duration = duration;
-            get_str8(pb, buf, sizeof(buf)); /* desc */
-            get_str8(pb, buf, sizeof(buf)); /* mimetype */
-            st->codec->codec_type = AVMEDIA_TYPE_DATA;
-            st->priv_data = ff_rm_alloc_rmstream();
-            if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
-                                          get_be32(pb)) < 0)
-                return -1;
-            break;
-        case MKTAG('D', 'A', 'T', 'A'):
-            goto header_end;
-        default:
-            /* unknown tag: skip it */
-            url_fskip(pb, tag_size - 10);
-            break;
-        }
-    }
- header_end:
-    rm->nb_packets = get_be32(pb); /* number of packets */
-    if (!rm->nb_packets && (flags & 4))
-        rm->nb_packets = 3600 * 25;
-    get_be32(pb); /* next data header */
-
-    if (!data_off)
-        data_off = url_ftell(pb) - 18;
-    if (indx_off && url_fseek(pb, indx_off, SEEK_SET) >= 0) {
-        rm_read_index(s);
-        url_fseek(pb, data_off + 18, SEEK_SET);
-    }
-
-    return 0;
-}
-
-static int get_num(ByteIOContext *pb, int *len)
-{
-    int n, n1;
-
-    n = get_be16(pb);
-    (*len)-=2;
-    n &= 0x7FFF;
-    if (n >= 0x4000) {
-        return n - 0x4000;
-    } else {
-        n1 = get_be16(pb);
-        (*len)-=2;
-        return (n << 16) | n1;
-    }
-}
-
-/* multiple of 20 bytes for ra144 (ugly) */
-#define RAW_PACKET_SIZE 1000
-
-static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){
-    RMDemuxContext *rm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    uint32_t state=0xFFFFFFFF;
-
-    while(!url_feof(pb)){
-        int len, num, i;
-        *pos= url_ftell(pb) - 3;
-        if(rm->remaining_len > 0){
-            num= rm->current_stream;
-            len= rm->remaining_len;
-            *timestamp = AV_NOPTS_VALUE;
-            *flags= 0;
-        }else{
-            state= (state<<8) + get_byte(pb);
-
-            if(state == MKBETAG('I', 'N', 'D', 'X')){
-                int n_pkts, expected_len;
-                len = get_be32(pb);
-                url_fskip(pb, 2);
-                n_pkts = get_be32(pb);
-                expected_len = 20 + n_pkts * 14;
-                if (len == 20)
-                    /* some files don't add index entries to chunk size... */
-                    len = expected_len;
-                else if (len != expected_len)
-                    av_log(s, AV_LOG_WARNING,
-                           "Index size %d (%d pkts) is wrong, should be %d.\n",
-                           len, n_pkts, expected_len);
-                len -= 14; // we already read part of the index header
-                if(len<0)
-                    continue;
-                goto skip;
-            } else if (state == MKBETAG('D','A','T','A')) {
-                av_log(s, AV_LOG_WARNING,
-                       "DATA tag in middle of chunk, file may be broken.\n");
-            }
-
-            if(state > (unsigned)0xFFFF || state <= 12)
-                continue;
-            len=state - 12;
-            state= 0xFFFFFFFF;
-
-            num = get_be16(pb);
-            *timestamp = get_be32(pb);
-            get_byte(pb); /* reserved */
-            *flags = get_byte(pb); /* flags */
-        }
-        for(i=0;i<s->nb_streams;i++) {
-            st = s->streams[i];
-            if (num == st->id)
-                break;
-        }
-        if (i == s->nb_streams) {
-skip:
-            /* skip packet if unknown number */
-            url_fskip(pb, len);
-            rm->remaining_len = 0;
-            continue;
-        }
-        *stream_index= i;
-
-        return len;
-    }
-    return -1;
-}
-
-static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
-                                   RMDemuxContext *rm, RMStream *vst,
-                                   AVPacket *pkt, int len, int *pseq)
-{
-    int hdr, seq, pic_num, len2, pos;
-    int type;
-
-    hdr = get_byte(pb); len--;
-    type = hdr >> 6;
-
-    if(type != 3){  // not frame as a part of packet
-        seq = get_byte(pb); len--;
-    }
-    if(type != 1){  // not whole frame
-        len2 = get_num(pb, &len);
-        pos  = get_num(pb, &len);
-        pic_num = get_byte(pb); len--;
-    }
-    if(len<0)
-        return -1;
-    rm->remaining_len = len;
-    if(type&1){     // frame, not slice
-        if(type == 3)  // frame as a part of packet
-            len= len2;
-        if(rm->remaining_len < len)
-            return -1;
-        rm->remaining_len -= len;
-        if(av_new_packet(pkt, len + 9) < 0)
-            return AVERROR(EIO);
-        pkt->data[0] = 0;
-        AV_WL32(pkt->data + 1, 1);
-        AV_WL32(pkt->data + 5, 0);
-        get_buffer(pb, pkt->data + 9, len);
-        return 0;
-    }
-    //now we have to deal with single slice
-
-    *pseq = seq;
-    if((seq & 0x7F) == 1 || vst->curpic_num != pic_num){
-        vst->slices = ((hdr & 0x3F) << 1) + 1;
-        vst->videobufsize = len2 + 8*vst->slices + 1;
-        av_free_packet(&vst->pkt); //FIXME this should be output.
-        if(av_new_packet(&vst->pkt, vst->videobufsize) < 0)
-            return AVERROR(ENOMEM);
-        vst->videobufpos = 8*vst->slices + 1;
-        vst->cur_slice = 0;
-        vst->curpic_num = pic_num;
-        vst->pktpos = url_ftell(pb);
-    }
-    if(type == 2)
-        len = FFMIN(len, pos);
-
-    if(++vst->cur_slice > vst->slices)
-        return 1;
-    AV_WL32(vst->pkt.data - 7 + 8*vst->cur_slice, 1);
-    AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1);
-    if(vst->videobufpos + len > vst->videobufsize)
-        return 1;
-    if (get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len)
-        return AVERROR(EIO);
-    vst->videobufpos += len;
-    rm->remaining_len-= len;
-
-    if(type == 2 || (vst->videobufpos) == vst->videobufsize){
-        vst->pkt.data[0] = vst->cur_slice-1;
-        *pkt= vst->pkt;
-        vst->pkt.data= NULL;
-        vst->pkt.size= 0;
-        if(vst->slices != vst->cur_slice) //FIXME find out how to set slices correct from the begin
-            memmove(pkt->data + 1 + 8*vst->cur_slice, pkt->data + 1 + 8*vst->slices,
-                vst->videobufpos - 1 - 8*vst->slices);
-        pkt->size = vst->videobufpos + 8*(vst->cur_slice - vst->slices);
-        pkt->pts = AV_NOPTS_VALUE;
-        pkt->pos = vst->pktpos;
-        vst->slices = 0;
-        return 0;
-    }
-
-    return 1;
-}
-
-static inline void
-rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt)
-{
-    uint8_t *ptr;
-    int j;
-
-    if (st->codec->codec_id == CODEC_ID_AC3) {
-        ptr = pkt->data;
-        for (j=0;j<pkt->size;j+=2) {
-            FFSWAP(int, ptr[0], ptr[1]);
-            ptr += 2;
-        }
-    }
-}
-
-/**
- * Perform 4-bit block reordering for SIPR data.
- * @todo This can be optimized, e.g. use memcpy() if data blocks are aligned
- */
-void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
-{
-    int n, bs = sub_packet_h * framesize * 2 / 96; // nibbles per subpacket
-
-    for (n = 0; n < 38; n++) {
-        int j;
-        int i = bs * sipr_swaps[n][0];
-        int o = bs * sipr_swaps[n][1];
-
-        /* swap 4bit-nibbles of block 'i' with 'o' */
-        for (j = 0; j < bs; j++, i++, o++) {
-            int x = (buf[i >> 1] >> (4 * (i & 1))) & 0xF,
-                y = (buf[o >> 1] >> (4 * (o & 1))) & 0xF;
-
-            buf[o >> 1] = (x << (4 * (o & 1))) |
-                (buf[o >> 1] & (0xF << (4 * !(o & 1))));
-            buf[i >> 1] = (y << (4 * (i & 1))) |
-                (buf[i >> 1] & (0xF << (4 * !(i & 1))));
-        }
-    }
-}
-
-int
-ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
-                    AVStream *st, RMStream *ast, int len, AVPacket *pkt,
-                    int *seq, int flags, int64_t timestamp)
-{
-    RMDemuxContext *rm = s->priv_data;
-
-    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        rm->current_stream= st->id;
-        if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq))
-            return -1; //got partial frame
-    } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-        if ((st->codec->codec_id == CODEC_ID_RA_288) ||
-            (st->codec->codec_id == CODEC_ID_COOK) ||
-            (st->codec->codec_id == CODEC_ID_ATRAC3) ||
-            (st->codec->codec_id == CODEC_ID_SIPR)) {
-            int x;
-            int sps = ast->sub_packet_size;
-            int cfs = ast->coded_framesize;
-            int h = ast->sub_packet_h;
-            int y = ast->sub_packet_cnt;
-            int w = ast->audio_framesize;
-
-            if (flags & 2)
-                y = ast->sub_packet_cnt = 0;
-            if (!y)
-                ast->audiotimestamp = timestamp;
-
-            switch(st->codec->codec_id) {
-                case CODEC_ID_RA_288:
-                    for (x = 0; x < h/2; x++)
-                        get_buffer(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
-                    break;
-                case CODEC_ID_ATRAC3:
-                case CODEC_ID_COOK:
-                    for (x = 0; x < w/sps; x++)
-                        get_buffer(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
-                    break;
-                case CODEC_ID_SIPR:
-                    get_buffer(pb, ast->pkt.data + y * w, w);
-                    break;
-            }
-
-            if (++(ast->sub_packet_cnt) < h)
-                return -1;
-            if (st->codec->codec_id == CODEC_ID_SIPR)
-                ff_rm_reorder_sipr_data(ast->pkt.data, h, w);
-
-             ast->sub_packet_cnt = 0;
-             rm->audio_stream_num = st->index;
-             rm->audio_pkt_cnt = h * w / st->codec->block_align;
-        } else if (st->codec->codec_id == CODEC_ID_AAC) {
-            int x;
-            rm->audio_stream_num = st->index;
-            ast->sub_packet_cnt = (get_be16(pb) & 0xf0) >> 4;
-            if (ast->sub_packet_cnt) {
-                for (x = 0; x < ast->sub_packet_cnt; x++)
-                    ast->sub_packet_lengths[x] = get_be16(pb);
-                rm->audio_pkt_cnt = ast->sub_packet_cnt;
-                ast->audiotimestamp = timestamp;
-            } else
-                return -1;
-        } else {
-            av_get_packet(pb, pkt, len);
-            rm_ac3_swap_bytes(st, pkt);
-        }
-    } else
-        av_get_packet(pb, pkt, len);
-
-    pkt->stream_index = st->index;
-
-#if 0
-    if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-        if(st->codec->codec_id == CODEC_ID_RV20){
-            int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1);
-            av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq);
-
-            seq |= (timestamp&~0x3FFF);
-            if(seq - timestamp >  0x2000) seq -= 0x4000;
-            if(seq - timestamp < -0x2000) seq += 0x4000;
-        }
-    }
-#endif
-
-    pkt->pts= timestamp;
-    if (flags & 2)
-        pkt->flags |= AV_PKT_FLAG_KEY;
-
-    return st->codec->codec_type == AVMEDIA_TYPE_AUDIO ? rm->audio_pkt_cnt : 0;
-}
-
-int
-ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
-                      AVStream *st, RMStream *ast, AVPacket *pkt)
-{
-    RMDemuxContext *rm = s->priv_data;
-
-    assert (rm->audio_pkt_cnt > 0);
-
-    if (st->codec->codec_id == CODEC_ID_AAC)
-        av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]);
-    else {
-        av_new_packet(pkt, st->codec->block_align);
-        memcpy(pkt->data, ast->pkt.data + st->codec->block_align * //FIXME avoid this
-               (ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - rm->audio_pkt_cnt),
-               st->codec->block_align);
-    }
-    rm->audio_pkt_cnt--;
-    if ((pkt->pts = ast->audiotimestamp) != AV_NOPTS_VALUE) {
-        ast->audiotimestamp = AV_NOPTS_VALUE;
-        pkt->flags = AV_PKT_FLAG_KEY;
-    } else
-        pkt->flags = 0;
-    pkt->stream_index = st->index;
-
-    return rm->audio_pkt_cnt;
-}
-
-static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    RMDemuxContext *rm = s->priv_data;
-    AVStream *st;
-    int i, len, res, seq = 1;
-    int64_t timestamp, pos;
-    int flags;
-
-    for (;;) {
-        if (rm->audio_pkt_cnt) {
-            // If there are queued audio packet return them first
-            st = s->streams[rm->audio_stream_num];
-            ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
-            flags = 0;
-        } else {
-            if (rm->old_format) {
-                RMStream *ast;
-
-                st = s->streams[0];
-                ast = st->priv_data;
-                timestamp = AV_NOPTS_VALUE;
-                len = !ast->audio_framesize ? RAW_PACKET_SIZE :
-                    ast->coded_framesize * ast->sub_packet_h / 2;
-                flags = (seq++ == 1) ? 2 : 0;
-                pos = url_ftell(s->pb);
-            } else {
-                len=sync(s, &timestamp, &flags, &i, &pos);
-                if (len > 0)
-                    st = s->streams[i];
-            }
-
-            if(len<0 || url_feof(s->pb))
-                return AVERROR(EIO);
-
-            res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
-                                      &seq, flags, timestamp);
-            if((flags&2) && (seq&0x7F) == 1)
-                av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
-            if (res)
-                continue;
-        }
-
-        if(  (st->discard >= AVDISCARD_NONKEY && !(flags&2))
-           || st->discard >= AVDISCARD_ALL){
-            av_free_packet(pkt);
-        } else
-            break;
-    }
-
-    return 0;
-}
-
-static int rm_read_close(AVFormatContext *s)
-{
-    int i;
-
-    for (i=0;i<s->nb_streams;i++)
-        ff_rm_free_rmstream(s->streams[i]->priv_data);
-
-    return 0;
-}
-
-static int rm_probe(AVProbeData *p)
-{
-    /* check file header */
-    if ((p->buf[0] == '.' && p->buf[1] == 'R' &&
-         p->buf[2] == 'M' && p->buf[3] == 'F' &&
-         p->buf[4] == 0 && p->buf[5] == 0) ||
-        (p->buf[0] == '.' && p->buf[1] == 'r' &&
-         p->buf[2] == 'a' && p->buf[3] == 0xfd))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
-                               int64_t *ppos, int64_t pos_limit)
-{
-    RMDemuxContext *rm = s->priv_data;
-    int64_t pos, dts;
-    int stream_index2, flags, len, h;
-
-    pos = *ppos;
-
-    if(rm->old_format)
-        return AV_NOPTS_VALUE;
-
-    url_fseek(s->pb, pos, SEEK_SET);
-    rm->remaining_len=0;
-    for(;;){
-        int seq=1;
-        AVStream *st;
-
-        len=sync(s, &dts, &flags, &stream_index2, &pos);
-        if(len<0)
-            return AV_NOPTS_VALUE;
-
-        st = s->streams[stream_index2];
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            h= get_byte(s->pb); len--;
-            if(!(h & 0x40)){
-                seq = get_byte(s->pb); len--;
-            }
-        }
-
-        if((flags&2) && (seq&0x7F) == 1){
-//            av_log(s, AV_LOG_DEBUG, "%d %d-%d %"PRId64" %d\n", flags, stream_index2, stream_index, dts, seq);
-            av_add_index_entry(st, pos, dts, 0, 0, AVINDEX_KEYFRAME);
-            if(stream_index2 == stream_index)
-                break;
-        }
-
-        url_fskip(s->pb, len);
-    }
-    *ppos = pos;
-    return dts;
-}
-
-AVInputFormat rm_demuxer = {
-    "rm",
-    NULL_IF_CONFIG_SMALL("RealMedia format"),
-    sizeof(RMDemuxContext),
-    rm_probe,
-    rm_read_header,
-    rm_read_packet,
-    rm_read_close,
-    NULL,
-    rm_read_dts,
-};
-
-AVInputFormat rdt_demuxer = {
-    "rdt",
-    NULL_IF_CONFIG_SMALL("RDT demuxer"),
-    sizeof(RMDemuxContext),
-    NULL,
-    NULL,
-    NULL,
-    rm_read_close,
-};
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
deleted file mode 100644
index 03db3ce..0000000
--- a/libavformat/rmenc.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * "Real" compatible muxer.
- * Copyright (c) 2000, 2001 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "rm.h"
-
-typedef struct {
-    int nb_packets;
-    int packet_total_size;
-    int packet_max_size;
-    /* codec related output */
-    int bit_rate;
-    float frame_rate;
-    int nb_frames;    /* current frame number */
-    int total_frames; /* total number of frames */
-    int num;
-    AVCodecContext *enc;
-} StreamInfo;
-
-typedef struct {
-    StreamInfo streams[2];
-    StreamInfo *audio_stream, *video_stream;
-    int data_pos; /* position of the data after the header */
-} RMMuxContext;
-
-/* in ms */
-#define BUFFER_DURATION 0
-
-
-static void put_str(ByteIOContext *s, const char *tag)
-{
-    put_be16(s,strlen(tag));
-    while (*tag) {
-        put_byte(s, *tag++);
-    }
-}
-
-static void put_str8(ByteIOContext *s, const char *tag)
-{
-    put_byte(s, strlen(tag));
-    while (*tag) {
-        put_byte(s, *tag++);
-    }
-}
-
-static void rv10_write_header(AVFormatContext *ctx,
-                              int data_size, int index_pos)
-{
-    RMMuxContext *rm = ctx->priv_data;
-    ByteIOContext *s = ctx->pb;
-    StreamInfo *stream;
-    unsigned char *data_offset_ptr, *start_ptr;
-    const char *desc, *mimetype;
-    int nb_packets, packet_total_size, packet_max_size, size, packet_avg_size, i;
-    int bit_rate, v, duration, flags, data_pos;
-    AVMetadataTag *tag;
-
-    start_ptr = s->buf_ptr;
-
-    put_tag(s, ".RMF");
-    put_be32(s,18); /* header size */
-    put_be16(s,0);
-    put_be32(s,0);
-    put_be32(s,4 + ctx->nb_streams); /* num headers */
-
-    put_tag(s,"PROP");
-    put_be32(s, 50);
-    put_be16(s, 0);
-    packet_max_size = 0;
-    packet_total_size = 0;
-    nb_packets = 0;
-    bit_rate = 0;
-    duration = 0;
-    for(i=0;i<ctx->nb_streams;i++) {
-        StreamInfo *stream = &rm->streams[i];
-        bit_rate += stream->bit_rate;
-        if (stream->packet_max_size > packet_max_size)
-            packet_max_size = stream->packet_max_size;
-        nb_packets += stream->nb_packets;
-        packet_total_size += stream->packet_total_size;
-        /* select maximum duration */
-        v = (int) (1000.0 * (float)stream->total_frames / stream->frame_rate);
-        if (v > duration)
-            duration = v;
-    }
-    put_be32(s, bit_rate); /* max bit rate */
-    put_be32(s, bit_rate); /* avg bit rate */
-    put_be32(s, packet_max_size);        /* max packet size */
-    if (nb_packets > 0)
-        packet_avg_size = packet_total_size / nb_packets;
-    else
-        packet_avg_size = 0;
-    put_be32(s, packet_avg_size);        /* avg packet size */
-    put_be32(s, nb_packets);  /* num packets */
-    put_be32(s, duration); /* duration */
-    put_be32(s, BUFFER_DURATION);           /* preroll */
-    put_be32(s, index_pos);           /* index offset */
-    /* computation of data the data offset */
-    data_offset_ptr = s->buf_ptr;
-    put_be32(s, 0);           /* data offset : will be patched after */
-    put_be16(s, ctx->nb_streams);    /* num streams */
-    flags = 1 | 2; /* save allowed & perfect play */
-    if (url_is_streamed(s))
-        flags |= 4; /* live broadcast */
-    put_be16(s, flags);
-
-    /* comments */
-
-    put_tag(s,"CONT");
-    size =  4 * 2 + 10;
-    for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
-        tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0);
-        if(tag) size += strlen(tag->value);
-    }
-    put_be32(s,size);
-    put_be16(s,0);
-    for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
-        tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0);
-        put_str(s, tag ? tag->value : "");
-    }
-
-    for(i=0;i<ctx->nb_streams;i++) {
-        int codec_data_size;
-
-        stream = &rm->streams[i];
-
-        if (stream->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            desc = "The Audio Stream";
-            mimetype = "audio/x-pn-realaudio";
-            codec_data_size = 73;
-        } else {
-            desc = "The Video Stream";
-            mimetype = "video/x-pn-realvideo";
-            codec_data_size = 34;
-        }
-
-        put_tag(s,"MDPR");
-        size = 10 + 9 * 4 + strlen(desc) + strlen(mimetype) + codec_data_size;
-        put_be32(s, size);
-        put_be16(s, 0);
-
-        put_be16(s, i); /* stream number */
-        put_be32(s, stream->bit_rate); /* max bit rate */
-        put_be32(s, stream->bit_rate); /* avg bit rate */
-        put_be32(s, stream->packet_max_size);        /* max packet size */
-        if (stream->nb_packets > 0)
-            packet_avg_size = stream->packet_total_size /
-                stream->nb_packets;
-        else
-            packet_avg_size = 0;
-        put_be32(s, packet_avg_size);        /* avg packet size */
-        put_be32(s, 0);           /* start time */
-        put_be32(s, BUFFER_DURATION);           /* preroll */
-        /* duration */
-        if (url_is_streamed(s) || !stream->total_frames)
-            put_be32(s, (int)(3600 * 1000));
-        else
-            put_be32(s, (int)(stream->total_frames * 1000 / stream->frame_rate));
-        put_str8(s, desc);
-        put_str8(s, mimetype);
-        put_be32(s, codec_data_size);
-
-        if (stream->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            int coded_frame_size, fscode, sample_rate;
-            sample_rate = stream->enc->sample_rate;
-            coded_frame_size = (stream->enc->bit_rate *
-                                stream->enc->frame_size) / (8 * sample_rate);
-            /* audio codec info */
-            put_tag(s, ".ra");
-            put_byte(s, 0xfd);
-            put_be32(s, 0x00040000); /* version */
-            put_tag(s, ".ra4");
-            put_be32(s, 0x01b53530); /* stream length */
-            put_be16(s, 4); /* unknown */
-            put_be32(s, 0x39); /* header size */
-
-            switch(sample_rate) {
-            case 48000:
-            case 24000:
-            case 12000:
-                fscode = 1;
-                break;
-            default:
-            case 44100:
-            case 22050:
-            case 11025:
-                fscode = 2;
-                break;
-            case 32000:
-            case 16000:
-            case 8000:
-                fscode = 3;
-            }
-            put_be16(s, fscode); /* codec additional info, for AC-3, seems
-                                     to be a frequency code */
-            /* special hack to compensate rounding errors... */
-            if (coded_frame_size == 557)
-                coded_frame_size--;
-            put_be32(s, coded_frame_size); /* frame length */
-            put_be32(s, 0x51540); /* unknown */
-            put_be32(s, 0x249f0); /* unknown */
-            put_be32(s, 0x249f0); /* unknown */
-            put_be16(s, 0x01);
-            /* frame length : seems to be very important */
-            put_be16(s, coded_frame_size);
-            put_be32(s, 0); /* unknown */
-            put_be16(s, stream->enc->sample_rate); /* sample rate */
-            put_be32(s, 0x10); /* unknown */
-            put_be16(s, stream->enc->channels);
-            put_str8(s, "Int0"); /* codec name */
-            put_str8(s, "dnet"); /* codec name */
-            put_be16(s, 0); /* title length */
-            put_be16(s, 0); /* author length */
-            put_be16(s, 0); /* copyright length */
-            put_byte(s, 0); /* end of header */
-        } else {
-            /* video codec info */
-            put_be32(s,34); /* size */
-            if(stream->enc->codec_id == CODEC_ID_RV10)
-                put_tag(s,"VIDORV10");
-            else
-                put_tag(s,"VIDORV20");
-            put_be16(s, stream->enc->width);
-            put_be16(s, stream->enc->height);
-            put_be16(s, (int) stream->frame_rate); /* frames per seconds ? */
-            put_be32(s,0);     /* unknown meaning */
-            put_be16(s, (int) stream->frame_rate);  /* unknown meaning */
-            put_be32(s,0);     /* unknown meaning */
-            put_be16(s, 8);    /* unknown meaning */
-            /* Seems to be the codec version: only use basic H263. The next
-               versions seems to add a diffential DC coding as in
-               MPEG... nothing new under the sun */
-            if(stream->enc->codec_id == CODEC_ID_RV10)
-                put_be32(s,0x10000000);
-            else
-                put_be32(s,0x20103001);
-            //put_be32(s,0x10003000);
-        }
-    }
-
-    /* patch data offset field */
-    data_pos = s->buf_ptr - start_ptr;
-    rm->data_pos = data_pos;
-    data_offset_ptr[0] = data_pos >> 24;
-    data_offset_ptr[1] = data_pos >> 16;
-    data_offset_ptr[2] = data_pos >> 8;
-    data_offset_ptr[3] = data_pos;
-
-    /* data stream */
-    put_tag(s,"DATA");
-    put_be32(s,data_size + 10 + 8);
-    put_be16(s,0);
-
-    put_be32(s, nb_packets); /* number of packets */
-    put_be32(s,0); /* next data header */
-}
-
-static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream,
-                                int length, int key_frame)
-{
-    int timestamp;
-    ByteIOContext *s = ctx->pb;
-
-    stream->nb_packets++;
-    stream->packet_total_size += length;
-    if (length > stream->packet_max_size)
-        stream->packet_max_size =  length;
-
-    put_be16(s,0); /* version */
-    put_be16(s,length + 12);
-    put_be16(s, stream->num); /* stream number */
-    timestamp = (1000 * (float)stream->nb_frames) / stream->frame_rate;
-    put_be32(s, timestamp); /* timestamp */
-    put_byte(s, 0); /* reserved */
-    put_byte(s, key_frame ? 2 : 0); /* flags */
-}
-
-static int rm_write_header(AVFormatContext *s)
-{
-    RMMuxContext *rm = s->priv_data;
-    StreamInfo *stream;
-    int n;
-    AVCodecContext *codec;
-
-    for(n=0;n<s->nb_streams;n++) {
-        s->streams[n]->id = n;
-        codec = s->streams[n]->codec;
-        stream = &rm->streams[n];
-        memset(stream, 0, sizeof(StreamInfo));
-        stream->num = n;
-        stream->bit_rate = codec->bit_rate;
-        stream->enc = codec;
-
-        switch(codec->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            rm->audio_stream = stream;
-            stream->frame_rate = (float)codec->sample_rate / (float)codec->frame_size;
-            /* XXX: dummy values */
-            stream->packet_max_size = 1024;
-            stream->nb_packets = 0;
-            stream->total_frames = stream->nb_packets;
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-            rm->video_stream = stream;
-            stream->frame_rate = (float)codec->time_base.den / (float)codec->time_base.num;
-            /* XXX: dummy values */
-            stream->packet_max_size = 4096;
-            stream->nb_packets = 0;
-            stream->total_frames = stream->nb_packets;
-            break;
-        default:
-            return -1;
-        }
-    }
-
-    rv10_write_header(s, 0, 0);
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags)
-{
-    uint8_t *buf1;
-    RMMuxContext *rm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    StreamInfo *stream = rm->audio_stream;
-    int i;
-
-    /* XXX: suppress this malloc */
-    buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
-
-    write_packet_header(s, stream, size, !!(flags & AV_PKT_FLAG_KEY));
-
-    /* for AC-3, the words seem to be reversed */
-    for(i=0;i<size;i+=2) {
-        buf1[i] = buf[i+1];
-        buf1[i+1] = buf[i];
-    }
-    put_buffer(pb, buf1, size);
-    put_flush_packet(pb);
-    stream->nb_frames++;
-    av_free(buf1);
-    return 0;
-}
-
-static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags)
-{
-    RMMuxContext *rm = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    StreamInfo *stream = rm->video_stream;
-    int key_frame = !!(flags & AV_PKT_FLAG_KEY);
-
-    /* XXX: this is incorrect: should be a parameter */
-
-    /* Well, I spent some time finding the meaning of these bits. I am
-       not sure I understood everything, but it works !! */
-#if 1
-    write_packet_header(s, stream, size + 7 + (size >= 0x4000)*4, key_frame);
-    /* bit 7: '1' if final packet of a frame converted in several packets */
-    put_byte(pb, 0x81);
-    /* bit 7: '1' if I frame. bits 6..0 : sequence number in current
-       frame starting from 1 */
-    if (key_frame) {
-        put_byte(pb, 0x81);
-    } else {
-        put_byte(pb, 0x01);
-    }
-    if(size >= 0x4000){
-        put_be32(pb, size); /* total frame size */
-        put_be32(pb, size); /* offset from the start or the end */
-    }else{
-        put_be16(pb, 0x4000 | size); /* total frame size */
-        put_be16(pb, 0x4000 | size); /* offset from the start or the end */
-    }
-#else
-    /* full frame */
-    write_packet_header(s, size + 6);
-    put_byte(pb, 0xc0);
-    put_be16(pb, 0x4000 + size); /* total frame size */
-    put_be16(pb, 0x4000 + packet_number * 126); /* position in stream */
-#endif
-    put_byte(pb, stream->nb_frames & 0xff);
-
-    put_buffer(pb, buf, size);
-    put_flush_packet(pb);
-
-    stream->nb_frames++;
-    return 0;
-}
-
-static int rm_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    if (s->streams[pkt->stream_index]->codec->codec_type ==
-        AVMEDIA_TYPE_AUDIO)
-        return rm_write_audio(s, pkt->data, pkt->size, pkt->flags);
-    else
-        return rm_write_video(s, pkt->data, pkt->size, pkt->flags);
-}
-
-static int rm_write_trailer(AVFormatContext *s)
-{
-    RMMuxContext *rm = s->priv_data;
-    int data_size, index_pos, i;
-    ByteIOContext *pb = s->pb;
-
-    if (!url_is_streamed(s->pb)) {
-        /* end of file: finish to write header */
-        index_pos = url_fseek(pb, 0, SEEK_CUR);
-        data_size = index_pos - rm->data_pos;
-
-        /* FIXME: write index */
-
-        /* undocumented end header */
-        put_be32(pb, 0);
-        put_be32(pb, 0);
-
-        url_fseek(pb, 0, SEEK_SET);
-        for(i=0;i<s->nb_streams;i++)
-            rm->streams[i].total_frames = rm->streams[i].nb_frames;
-        rv10_write_header(s, data_size, 0);
-    } else {
-        /* undocumented end header */
-        put_be32(pb, 0);
-        put_be32(pb, 0);
-    }
-    put_flush_packet(pb);
-    return 0;
-}
-
-
-AVOutputFormat rm_muxer = {
-    "rm",
-    NULL_IF_CONFIG_SMALL("RealMedia format"),
-    "application/vnd.rn-realmedia",
-    "rm,ra",
-    sizeof(RMMuxContext),
-    CODEC_ID_AC3,
-    CODEC_ID_RV10,
-    rm_write_header,
-    rm_write_packet,
-    rm_write_trailer,
-};
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
deleted file mode 100644
index f0fba3e..0000000
--- a/libavformat/rpl.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * ARMovie/RPL demuxer
- * Copyright (c) 2007 Christian Ohm, 2008 Eli Friedman
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include <stdlib.h>
-
-#define RPL_SIGNATURE "ARMovie\x0A"
-#define RPL_SIGNATURE_SIZE 8
-
-/** 256 is arbitrary, but should be big enough for any reasonable file. */
-#define RPL_LINE_LENGTH 256
-
-static int rpl_probe(AVProbeData *p)
-{
-    if (memcmp(p->buf, RPL_SIGNATURE, RPL_SIGNATURE_SIZE))
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-typedef struct RPLContext {
-    // RPL header data
-    int32_t frames_per_chunk;
-
-    // Stream position data
-    uint32_t chunk_number;
-    uint32_t chunk_part;
-    uint32_t frame_in_part;
-} RPLContext;
-
-static int read_line(ByteIOContext * pb, char* line, int bufsize)
-{
-    int i;
-    for (i = 0; i < bufsize - 1; i++) {
-        int b = get_byte(pb);
-        if (b == 0)
-            break;
-        if (b == '\n') {
-            line[i] = '\0';
-            return 0;
-        }
-        line[i] = b;
-    }
-    line[i] = '\0';
-    return -1;
-}
-
-static int32_t read_int(const char* line, const char** endptr, int* error)
-{
-    unsigned long result = 0;
-    for (; *line>='0' && *line<='9'; line++) {
-        if (result > (0x7FFFFFFF - 9) / 10)
-            *error = -1;
-        result = 10 * result + *line - '0';
-    }
-    *endptr = line;
-    return result;
-}
-
-static int32_t read_line_and_int(ByteIOContext * pb, int* error)
-{
-    char line[RPL_LINE_LENGTH];
-    const char *endptr;
-    *error |= read_line(pb, line, sizeof(line));
-    return read_int(line, &endptr, error);
-}
-
-/** Parsing for fps, which can be a fraction. Unfortunately,
-  * the spec for the header leaves out a lot of details,
-  * so this is mostly guessing.
-  */
-static AVRational read_fps(const char* line, int* error)
-{
-    int64_t num, den = 1;
-    AVRational result;
-    num = read_int(line, &line, error);
-    if (*line == '.')
-        line++;
-    for (; *line>='0' && *line<='9'; line++) {
-        // Truncate any numerator too large to fit into an int64_t
-        if (num > (INT64_MAX - 9) / 10 || den > INT64_MAX / 10)
-            break;
-        num  = 10 * num + *line - '0';
-        den *= 10;
-    }
-    if (!num)
-        *error = -1;
-    av_reduce(&result.num, &result.den, num, den, 0x7FFFFFFF);
-    return result;
-}
-
-static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    RPLContext *rpl = s->priv_data;
-    AVStream *vst = NULL, *ast = NULL;
-    int total_audio_size;
-    int error = 0;
-
-    uint32_t i;
-
-    int32_t audio_format, chunk_catalog_offset, number_of_chunks;
-    AVRational fps;
-
-    char line[RPL_LINE_LENGTH];
-
-    // The header for RPL/ARMovie files is 21 lines of text
-    // containing the various header fields.  The fields are always
-    // in the same order, and other text besides the first
-    // number usually isn't important.
-    // (The spec says that there exists some significance
-    // for the text in a few cases; samples needed.)
-    error |= read_line(pb, line, sizeof(line));      // ARMovie
-    error |= read_line(pb, line, sizeof(line));      // movie name
-    av_metadata_set2(&s->metadata, "title"    , line, 0);
-    error |= read_line(pb, line, sizeof(line));      // date/copyright
-    av_metadata_set2(&s->metadata, "copyright", line, 0);
-    error |= read_line(pb, line, sizeof(line));      // author and other
-    av_metadata_set2(&s->metadata, "author"   , line, 0);
-
-    // video headers
-    vst = av_new_stream(s, 0);
-    if (!vst)
-        return AVERROR(ENOMEM);
-    vst->codec->codec_type      = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_tag       = read_line_and_int(pb, &error);  // video format
-    vst->codec->width           = read_line_and_int(pb, &error);  // video width
-    vst->codec->height          = read_line_and_int(pb, &error);  // video height
-    vst->codec->bits_per_coded_sample = read_line_and_int(pb, &error);  // video bits per sample
-    error |= read_line(pb, line, sizeof(line));                   // video frames per second
-    fps = read_fps(line, &error);
-    av_set_pts_info(vst, 32, fps.den, fps.num);
-
-    // Figure out the video codec
-    switch (vst->codec->codec_tag) {
-#if 0
-        case 122:
-            vst->codec->codec_id = CODEC_ID_ESCAPE122;
-            break;
-#endif
-        case 124:
-            vst->codec->codec_id = CODEC_ID_ESCAPE124;
-            // The header is wrong here, at least sometimes
-            vst->codec->bits_per_coded_sample = 16;
-            break;
-#if 0
-        case 130:
-            vst->codec->codec_id = CODEC_ID_ESCAPE130;
-            break;
-#endif
-        default:
-            av_log(s, AV_LOG_WARNING,
-                   "RPL video format %i not supported yet!\n",
-                   vst->codec->codec_tag);
-            vst->codec->codec_id = CODEC_ID_NONE;
-    }
-
-    // Audio headers
-
-    // ARMovie supports multiple audio tracks; I don't have any
-    // samples, though. This code will ignore additional tracks.
-    audio_format = read_line_and_int(pb, &error);  // audio format ID
-    if (audio_format) {
-        ast = av_new_stream(s, 0);
-        if (!ast)
-            return AVERROR(ENOMEM);
-        ast->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
-        ast->codec->codec_tag       = audio_format;
-        ast->codec->sample_rate     = read_line_and_int(pb, &error);  // audio bitrate
-        ast->codec->channels        = read_line_and_int(pb, &error);  // number of audio channels
-        ast->codec->bits_per_coded_sample = read_line_and_int(pb, &error);  // audio bits per sample
-        // At least one sample uses 0 for ADPCM, which is really 4 bits
-        // per sample.
-        if (ast->codec->bits_per_coded_sample == 0)
-            ast->codec->bits_per_coded_sample = 4;
-
-        ast->codec->bit_rate = ast->codec->sample_rate *
-                               ast->codec->bits_per_coded_sample *
-                               ast->codec->channels;
-
-        ast->codec->codec_id = CODEC_ID_NONE;
-        switch (audio_format) {
-            case 1:
-                if (ast->codec->bits_per_coded_sample == 16) {
-                    // 16-bit audio is always signed
-                    ast->codec->codec_id = CODEC_ID_PCM_S16LE;
-                    break;
-                }
-                // There are some other formats listed as legal per the spec;
-                // samples needed.
-                break;
-            case 101:
-                if (ast->codec->bits_per_coded_sample == 8) {
-                    // The samples with this kind of audio that I have
-                    // are all unsigned.
-                    ast->codec->codec_id = CODEC_ID_PCM_U8;
-                    break;
-                } else if (ast->codec->bits_per_coded_sample == 4) {
-                    ast->codec->codec_id = CODEC_ID_ADPCM_IMA_EA_SEAD;
-                    break;
-                }
-                break;
-        }
-        if (ast->codec->codec_id == CODEC_ID_NONE) {
-            av_log(s, AV_LOG_WARNING,
-                   "RPL audio format %i not supported yet!\n",
-                   audio_format);
-        }
-        av_set_pts_info(ast, 32, 1, ast->codec->bit_rate);
-    } else {
-        for (i = 0; i < 3; i++)
-            error |= read_line(pb, line, sizeof(line));
-    }
-
-    rpl->frames_per_chunk = read_line_and_int(pb, &error);  // video frames per chunk
-    if (rpl->frames_per_chunk > 1 && vst->codec->codec_tag != 124)
-        av_log(s, AV_LOG_WARNING,
-               "Don't know how to split frames for video format %i. "
-               "Video stream will be broken!\n", vst->codec->codec_tag);
-
-    number_of_chunks = read_line_and_int(pb, &error);  // number of chunks in the file
-    // The number in the header is actually the index of the last chunk.
-    number_of_chunks++;
-
-    error |= read_line(pb, line, sizeof(line));  // "even" chunk size in bytes
-    error |= read_line(pb, line, sizeof(line));  // "odd" chunk size in bytes
-    chunk_catalog_offset =                       // offset of the "chunk catalog"
-        read_line_and_int(pb, &error);           //   (file index)
-    error |= read_line(pb, line, sizeof(line));  // offset to "helpful" sprite
-    error |= read_line(pb, line, sizeof(line));  // size of "helpful" sprite
-    error |= read_line(pb, line, sizeof(line));  // offset to key frame list
-
-    // Read the index
-    url_fseek(pb, chunk_catalog_offset, SEEK_SET);
-    total_audio_size = 0;
-    for (i = 0; i < number_of_chunks; i++) {
-        int64_t offset, video_size, audio_size;
-        error |= read_line(pb, line, sizeof(line));
-        if (3 != sscanf(line, "%"PRId64" , %"PRId64" ; %"PRId64,
-                        &offset, &video_size, &audio_size))
-            error = -1;
-        av_add_index_entry(vst, offset, i * rpl->frames_per_chunk,
-                           video_size, rpl->frames_per_chunk, 0);
-        if (ast)
-            av_add_index_entry(ast, offset + video_size, total_audio_size,
-                               audio_size, audio_size * 8, 0);
-        total_audio_size += audio_size * 8;
-    }
-
-    if (error) return AVERROR(EIO);
-
-    return 0;
-}
-
-static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    RPLContext *rpl = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream* stream;
-    AVIndexEntry* index_entry;
-    uint32_t ret;
-
-    if (rpl->chunk_part == s->nb_streams) {
-        rpl->chunk_number++;
-        rpl->chunk_part = 0;
-    }
-
-    stream = s->streams[rpl->chunk_part];
-
-    if (rpl->chunk_number >= stream->nb_index_entries)
-        return -1;
-
-    index_entry = &stream->index_entries[rpl->chunk_number];
-
-    if (rpl->frame_in_part == 0)
-        if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0)
-            return AVERROR(EIO);
-
-    if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
-        stream->codec->codec_tag == 124) {
-        // We have to split Escape 124 frames because there are
-        // multiple frames per chunk in Escape 124 samples.
-        uint32_t frame_size, frame_flags;
-
-        frame_flags = get_le32(pb);
-        frame_size = get_le32(pb);
-        if (url_fseek(pb, -8, SEEK_CUR) < 0)
-            return AVERROR(EIO);
-
-        ret = av_get_packet(pb, pkt, frame_size);
-        if (ret != frame_size) {
-            av_free_packet(pkt);
-            return AVERROR(EIO);
-        }
-        pkt->duration = 1;
-        pkt->pts = index_entry->timestamp + rpl->frame_in_part;
-        pkt->stream_index = rpl->chunk_part;
-
-        rpl->frame_in_part++;
-        if (rpl->frame_in_part == rpl->frames_per_chunk) {
-            rpl->frame_in_part = 0;
-            rpl->chunk_part++;
-        }
-    } else {
-        ret = av_get_packet(pb, pkt, index_entry->size);
-        if (ret != index_entry->size) {
-            av_free_packet(pkt);
-            return AVERROR(EIO);
-        }
-
-        if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            // frames_per_chunk should always be one here; the header
-            // parsing will warn if it isn't.
-            pkt->duration = rpl->frames_per_chunk;
-        } else {
-            // All the audio codecs supported in this container
-            // (at least so far) are constant-bitrate.
-            pkt->duration = ret * 8;
-        }
-        pkt->pts = index_entry->timestamp;
-        pkt->stream_index = rpl->chunk_part;
-        rpl->chunk_part++;
-    }
-
-    // None of the Escape formats have keyframes, and the ADPCM
-    // format used doesn't have keyframes.
-    if (rpl->chunk_number == 0 && rpl->frame_in_part == 0)
-        pkt->flags |= AV_PKT_FLAG_KEY;
-
-    return ret;
-}
-
-AVInputFormat rpl_demuxer = {
-    "rpl",
-    NULL_IF_CONFIG_SMALL("RPL/ARMovie format"),
-    sizeof(RPLContext),
-    rpl_probe,
-    rpl_read_header,
-    rpl_read_packet,
-};
diff --git a/libavformat/rtmp.h b/libavformat/rtmp.h
deleted file mode 100644
index b0436c0..0000000
--- a/libavformat/rtmp.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * RTMP definitions
- * Copyright (c) 2009 Kostya Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTMP_H
-#define AVFORMAT_RTMP_H
-
-#include "avformat.h"
-
-#define RTMP_DEFAULT_PORT 1935
-
-#define RTMP_HANDSHAKE_PACKET_SIZE 1536
-
-/**
- * emulated Flash client version - 9.0.124.2 on Linux
- * @{
- */
-#define RTMP_CLIENT_PLATFORM "LNX"
-#define RTMP_CLIENT_VER1    9
-#define RTMP_CLIENT_VER2    0
-#define RTMP_CLIENT_VER3  124
-#define RTMP_CLIENT_VER4    2
-/** @} */ //version defines
-
-#endif /* AVFORMAT_RTMP_H */
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
deleted file mode 100644
index 58c3abe..0000000
--- a/libavformat/rtmppkt.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * RTMP input format
- * Copyright (c) 2009 Kostya Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/bytestream.h"
-#include "libavutil/avstring.h"
-#include "avformat.h"
-
-#include "rtmppkt.h"
-#include "flv.h"
-
-void ff_amf_write_bool(uint8_t **dst, int val)
-{
-    bytestream_put_byte(dst, AMF_DATA_TYPE_BOOL);
-    bytestream_put_byte(dst, val);
-}
-
-void ff_amf_write_number(uint8_t **dst, double val)
-{
-    bytestream_put_byte(dst, AMF_DATA_TYPE_NUMBER);
-    bytestream_put_be64(dst, av_dbl2int(val));
-}
-
-void ff_amf_write_string(uint8_t **dst, const char *str)
-{
-    bytestream_put_byte(dst, AMF_DATA_TYPE_STRING);
-    bytestream_put_be16(dst, strlen(str));
-    bytestream_put_buffer(dst, str, strlen(str));
-}
-
-void ff_amf_write_null(uint8_t **dst)
-{
-    bytestream_put_byte(dst, AMF_DATA_TYPE_NULL);
-}
-
-void ff_amf_write_object_start(uint8_t **dst)
-{
-    bytestream_put_byte(dst, AMF_DATA_TYPE_OBJECT);
-}
-
-void ff_amf_write_field_name(uint8_t **dst, const char *str)
-{
-    bytestream_put_be16(dst, strlen(str));
-    bytestream_put_buffer(dst, str, strlen(str));
-}
-
-void ff_amf_write_object_end(uint8_t **dst)
-{
-    /* first two bytes are field name length = 0,
-     * AMF object should end with it and end marker
-     */
-    bytestream_put_be24(dst, AMF_DATA_TYPE_OBJECT_END);
-}
-
-int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
-                        int chunk_size, RTMPPacket *prev_pkt)
-{
-    uint8_t hdr, t, buf[16];
-    int channel_id, timestamp, data_size, offset = 0;
-    uint32_t extra = 0;
-    enum RTMPPacketType type;
-    int size = 0;
-
-    if (url_read(h, &hdr, 1) != 1)
-        return AVERROR(EIO);
-    size++;
-    channel_id = hdr & 0x3F;
-
-    if (channel_id < 2) { //special case for channel number >= 64
-        buf[1] = 0;
-        if (url_read_complete(h, buf, channel_id + 1) != channel_id + 1)
-            return AVERROR(EIO);
-        size += channel_id + 1;
-        channel_id = AV_RL16(buf) + 64;
-    }
-    data_size = prev_pkt[channel_id].data_size;
-    type      = prev_pkt[channel_id].type;
-    extra     = prev_pkt[channel_id].extra;
-
-    hdr >>= 6;
-    if (hdr == RTMP_PS_ONEBYTE) {
-        timestamp = prev_pkt[channel_id].ts_delta;
-    } else {
-        if (url_read_complete(h, buf, 3) != 3)
-            return AVERROR(EIO);
-        size += 3;
-        timestamp = AV_RB24(buf);
-        if (hdr != RTMP_PS_FOURBYTES) {
-            if (url_read_complete(h, buf, 3) != 3)
-                return AVERROR(EIO);
-            size += 3;
-            data_size = AV_RB24(buf);
-            if (url_read_complete(h, buf, 1) != 1)
-                return AVERROR(EIO);
-            size++;
-            type = buf[0];
-            if (hdr == RTMP_PS_TWELVEBYTES) {
-                if (url_read_complete(h, buf, 4) != 4)
-                    return AVERROR(EIO);
-                size += 4;
-                extra = AV_RL32(buf);
-            }
-        }
-        if (timestamp == 0xFFFFFF) {
-            if (url_read_complete(h, buf, 4) != 4)
-                return AVERROR(EIO);
-            timestamp = AV_RB32(buf);
-        }
-    }
-    if (hdr != RTMP_PS_TWELVEBYTES)
-        timestamp += prev_pkt[channel_id].timestamp;
-
-    if (ff_rtmp_packet_create(p, channel_id, type, timestamp, data_size))
-        return -1;
-    p->extra = extra;
-    // save history
-    prev_pkt[channel_id].channel_id = channel_id;
-    prev_pkt[channel_id].type       = type;
-    prev_pkt[channel_id].data_size  = data_size;
-    prev_pkt[channel_id].ts_delta   = timestamp - prev_pkt[channel_id].timestamp;
-    prev_pkt[channel_id].timestamp  = timestamp;
-    prev_pkt[channel_id].extra      = extra;
-    while (data_size > 0) {
-        int toread = FFMIN(data_size, chunk_size);
-        if (url_read_complete(h, p->data + offset, toread) != toread) {
-            ff_rtmp_packet_destroy(p);
-            return AVERROR(EIO);
-        }
-        data_size -= chunk_size;
-        offset    += chunk_size;
-        size      += chunk_size;
-        if (data_size > 0) {
-            url_read_complete(h, &t, 1); //marker
-            size++;
-            if (t != (0xC0 + channel_id))
-                return -1;
-        }
-    }
-    return size;
-}
-
-int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
-                         int chunk_size, RTMPPacket *prev_pkt)
-{
-    uint8_t pkt_hdr[16], *p = pkt_hdr;
-    int mode = RTMP_PS_TWELVEBYTES;
-    int off = 0;
-    int size = 0;
-
-    pkt->ts_delta = pkt->timestamp - prev_pkt[pkt->channel_id].timestamp;
-
-    //if channel_id = 0, this is first presentation of prev_pkt, send full hdr.
-    if (prev_pkt[pkt->channel_id].channel_id &&
-        pkt->extra == prev_pkt[pkt->channel_id].extra) {
-        if (pkt->type == prev_pkt[pkt->channel_id].type &&
-            pkt->data_size == prev_pkt[pkt->channel_id].data_size) {
-            mode = RTMP_PS_FOURBYTES;
-            if (pkt->ts_delta == prev_pkt[pkt->channel_id].ts_delta)
-                mode = RTMP_PS_ONEBYTE;
-        } else {
-            mode = RTMP_PS_EIGHTBYTES;
-        }
-    }
-
-    if (pkt->channel_id < 64) {
-        bytestream_put_byte(&p, pkt->channel_id | (mode << 6));
-    } else if (pkt->channel_id < 64 + 256) {
-        bytestream_put_byte(&p, 0               | (mode << 6));
-        bytestream_put_byte(&p, pkt->channel_id - 64);
-    } else {
-        bytestream_put_byte(&p, 1               | (mode << 6));
-        bytestream_put_le16(&p, pkt->channel_id - 64);
-    }
-    if (mode != RTMP_PS_ONEBYTE) {
-        uint32_t timestamp = pkt->timestamp;
-        if (mode != RTMP_PS_TWELVEBYTES)
-            timestamp = pkt->ts_delta;
-        bytestream_put_be24(&p, timestamp >= 0xFFFFFF ? 0xFFFFFF : timestamp);
-        if (mode != RTMP_PS_FOURBYTES) {
-            bytestream_put_be24(&p, pkt->data_size);
-            bytestream_put_byte(&p, pkt->type);
-            if (mode == RTMP_PS_TWELVEBYTES)
-                bytestream_put_le32(&p, pkt->extra);
-        }
-        if (timestamp >= 0xFFFFFF)
-            bytestream_put_be32(&p, timestamp);
-    }
-    // save history
-    prev_pkt[pkt->channel_id].channel_id = pkt->channel_id;
-    prev_pkt[pkt->channel_id].type       = pkt->type;
-    prev_pkt[pkt->channel_id].data_size  = pkt->data_size;
-    prev_pkt[pkt->channel_id].timestamp  = pkt->timestamp;
-    if (mode != RTMP_PS_TWELVEBYTES) {
-        prev_pkt[pkt->channel_id].ts_delta   = pkt->ts_delta;
-    } else {
-        prev_pkt[pkt->channel_id].ts_delta   = pkt->timestamp;
-    }
-    prev_pkt[pkt->channel_id].extra      = pkt->extra;
-
-    url_write(h, pkt_hdr, p-pkt_hdr);
-    size = p - pkt_hdr + pkt->data_size;
-    while (off < pkt->data_size) {
-        int towrite = FFMIN(chunk_size, pkt->data_size - off);
-        url_write(h, pkt->data + off, towrite);
-        off += towrite;
-        if (off < pkt->data_size) {
-            uint8_t marker = 0xC0 | pkt->channel_id;
-            url_write(h, &marker, 1);
-            size++;
-        }
-    }
-    return size;
-}
-
-int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
-                          int timestamp, int size)
-{
-    pkt->data = av_malloc(size);
-    if (!pkt->data)
-        return AVERROR(ENOMEM);
-    pkt->data_size  = size;
-    pkt->channel_id = channel_id;
-    pkt->type       = type;
-    pkt->timestamp  = timestamp;
-    pkt->extra      = 0;
-    pkt->ts_delta   = 0;
-
-    return 0;
-}
-
-void ff_rtmp_packet_destroy(RTMPPacket *pkt)
-{
-    if (!pkt)
-        return;
-    av_freep(&pkt->data);
-    pkt->data_size = 0;
-}
-
-int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)
-{
-    const uint8_t *base = data;
-
-    if (data >= data_end)
-        return -1;
-    switch (*data++) {
-    case AMF_DATA_TYPE_NUMBER:      return 9;
-    case AMF_DATA_TYPE_BOOL:        return 2;
-    case AMF_DATA_TYPE_STRING:      return 3 + AV_RB16(data);
-    case AMF_DATA_TYPE_LONG_STRING: return 5 + AV_RB32(data);
-    case AMF_DATA_TYPE_NULL:        return 1;
-    case AMF_DATA_TYPE_ARRAY:
-        data += 4;
-    case AMF_DATA_TYPE_OBJECT:
-        for (;;) {
-            int size = bytestream_get_be16(&data);
-            int t;
-            if (!size) {
-                data++;
-                break;
-            }
-            if (data + size >= data_end || data + size < data)
-                return -1;
-            data += size;
-            t = ff_amf_tag_size(data, data_end);
-            if (t < 0 || data + t >= data_end)
-                return -1;
-            data += t;
-        }
-        return data - base;
-    case AMF_DATA_TYPE_OBJECT_END:  return 1;
-    default:                        return -1;
-    }
-}
-
-int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
-                           const uint8_t *name, uint8_t *dst, int dst_size)
-{
-    int namelen = strlen(name);
-    int len;
-
-    while (*data != AMF_DATA_TYPE_OBJECT && data < data_end) {
-        len = ff_amf_tag_size(data, data_end);
-        if (len < 0)
-            len = data_end - data;
-        data += len;
-    }
-    if (data_end - data < 3)
-        return -1;
-    data++;
-    for (;;) {
-        int size = bytestream_get_be16(&data);
-        if (!size)
-            break;
-        if (data + size >= data_end || data + size < data)
-            return -1;
-        data += size;
-        if (size == namelen && !memcmp(data-size, name, namelen)) {
-            switch (*data++) {
-            case AMF_DATA_TYPE_NUMBER:
-                snprintf(dst, dst_size, "%g", av_int2dbl(AV_RB64(data)));
-                break;
-            case AMF_DATA_TYPE_BOOL:
-                snprintf(dst, dst_size, "%s", *data ? "true" : "false");
-                break;
-            case AMF_DATA_TYPE_STRING:
-                len = bytestream_get_be16(&data);
-                av_strlcpy(dst, data, FFMIN(len+1, dst_size));
-                break;
-            default:
-                return -1;
-            }
-            return 0;
-        }
-        len = ff_amf_tag_size(data, data_end);
-        if (len < 0 || data + len >= data_end || data + len < data)
-            return -1;
-        data += len;
-    }
-    return -1;
-}
-
-static const char* rtmp_packet_type(int type)
-{
-    switch (type) {
-    case RTMP_PT_CHUNK_SIZE:     return "chunk size";
-    case RTMP_PT_BYTES_READ:     return "bytes read";
-    case RTMP_PT_PING:           return "ping";
-    case RTMP_PT_SERVER_BW:      return "server bandwidth";
-    case RTMP_PT_CLIENT_BW:      return "client bandwidth";
-    case RTMP_PT_AUDIO:          return "audio packet";
-    case RTMP_PT_VIDEO:          return "video packet";
-    case RTMP_PT_FLEX_STREAM:    return "Flex shared stream";
-    case RTMP_PT_FLEX_OBJECT:    return "Flex shared object";
-    case RTMP_PT_FLEX_MESSAGE:   return "Flex shared message";
-    case RTMP_PT_NOTIFY:         return "notification";
-    case RTMP_PT_SHARED_OBJ:     return "shared object";
-    case RTMP_PT_INVOKE:         return "invoke";
-    case RTMP_PT_METADATA:       return "metadata";
-    default:                     return "unknown";
-    }
-}
-
-static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *data_end)
-{
-    int size;
-    char buf[1024];
-
-    if (data >= data_end)
-        return;
-    switch (*data++) {
-    case AMF_DATA_TYPE_NUMBER:
-        av_log(ctx, AV_LOG_DEBUG, " number %g\n", av_int2dbl(AV_RB64(data)));
-        return;
-    case AMF_DATA_TYPE_BOOL:
-        av_log(ctx, AV_LOG_DEBUG, " bool %d\n", *data);
-        return;
-    case AMF_DATA_TYPE_STRING:
-    case AMF_DATA_TYPE_LONG_STRING:
-        if (data[-1] == AMF_DATA_TYPE_STRING) {
-            size = bytestream_get_be16(&data);
-        } else {
-            size = bytestream_get_be32(&data);
-        }
-        size = FFMIN(size, 1023);
-        memcpy(buf, data, size);
-        buf[size] = 0;
-        av_log(ctx, AV_LOG_DEBUG, " string '%s'\n", buf);
-        return;
-    case AMF_DATA_TYPE_NULL:
-        av_log(ctx, AV_LOG_DEBUG, " NULL\n");
-        return;
-    case AMF_DATA_TYPE_ARRAY:
-        data += 4;
-    case AMF_DATA_TYPE_OBJECT:
-        av_log(ctx, AV_LOG_DEBUG, " {\n");
-        for (;;) {
-            int size = bytestream_get_be16(&data);
-            int t;
-            memcpy(buf, data, size);
-            buf[size] = 0;
-            if (!size) {
-                av_log(ctx, AV_LOG_DEBUG, " }\n");
-                data++;
-                break;
-            }
-            if (data + size >= data_end || data + size < data)
-                return;
-            data += size;
-            av_log(ctx, AV_LOG_DEBUG, "  %s: ", buf);
-            ff_amf_tag_contents(ctx, data, data_end);
-            t = ff_amf_tag_size(data, data_end);
-            if (t < 0 || data + t >= data_end)
-                return;
-            data += t;
-        }
-        return;
-    case AMF_DATA_TYPE_OBJECT_END:
-        av_log(ctx, AV_LOG_DEBUG, " }\n");
-        return;
-    default:
-        return;
-    }
-}
-
-void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p)
-{
-    av_log(ctx, AV_LOG_DEBUG, "RTMP packet type '%s'(%d) for channel %d, timestamp %d, extra field %d size %d\n",
-           rtmp_packet_type(p->type), p->type, p->channel_id, p->timestamp, p->extra, p->data_size);
-    if (p->type == RTMP_PT_INVOKE || p->type == RTMP_PT_NOTIFY) {
-        uint8_t *src = p->data, *src_end = p->data + p->data_size;
-        while (src < src_end) {
-            int sz;
-            ff_amf_tag_contents(ctx, src, src_end);
-            sz = ff_amf_tag_size(src, src_end);
-            if (sz < 0)
-                break;
-            src += sz;
-        }
-    } else if (p->type == RTMP_PT_SERVER_BW){
-        av_log(ctx, AV_LOG_DEBUG, "Server BW = %d\n", AV_RB32(p->data));
-    } else if (p->type == RTMP_PT_CLIENT_BW){
-        av_log(ctx, AV_LOG_DEBUG, "Client BW = %d\n", AV_RB32(p->data));
-    } else if (p->type != RTMP_PT_AUDIO && p->type != RTMP_PT_VIDEO && p->type != RTMP_PT_METADATA) {
-        int i;
-        for (i = 0; i < p->data_size; i++)
-            av_log(ctx, AV_LOG_DEBUG, " %02X", p->data[i]);
-        av_log(ctx, AV_LOG_DEBUG, "\n");
-    }
-}
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
deleted file mode 100644
index 23d4ebc..0000000
--- a/libavformat/rtmppkt.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * RTMP packet utilities
- * Copyright (c) 2009 Kostya Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTMPPKT_H
-#define AVFORMAT_RTMPPKT_H
-
-#include "avformat.h"
-
-/** maximum possible number of different RTMP channels */
-#define RTMP_CHANNELS 65599
-
-/**
- * channels used to for RTMP packets with different purposes (i.e. data, network
- * control, remote procedure calls, etc.)
- */
-enum RTMPChannel {
-    RTMP_NETWORK_CHANNEL = 2,   ///< channel for network-related messages (bandwidth report, ping, etc)
-    RTMP_SYSTEM_CHANNEL,        ///< channel for sending server control messages
-    RTMP_SOURCE_CHANNEL,        ///< channel for sending a/v to server
-    RTMP_VIDEO_CHANNEL = 8,     ///< channel for video data
-    RTMP_AUDIO_CHANNEL,         ///< channel for audio data
-};
-
-/**
- * known RTMP packet types
- */
-typedef enum RTMPPacketType {
-    RTMP_PT_CHUNK_SIZE   =  1,  ///< chunk size change
-    RTMP_PT_BYTES_READ   =  3,  ///< number of bytes read
-    RTMP_PT_PING,               ///< ping
-    RTMP_PT_SERVER_BW,          ///< server bandwidth
-    RTMP_PT_CLIENT_BW,          ///< client bandwidth
-    RTMP_PT_AUDIO        =  8,  ///< audio packet
-    RTMP_PT_VIDEO,              ///< video packet
-    RTMP_PT_FLEX_STREAM  = 15,  ///< Flex shared stream
-    RTMP_PT_FLEX_OBJECT,        ///< Flex shared object
-    RTMP_PT_FLEX_MESSAGE,       ///< Flex shared message
-    RTMP_PT_NOTIFY,             ///< some notification
-    RTMP_PT_SHARED_OBJ,         ///< shared object
-    RTMP_PT_INVOKE,             ///< invoke some stream action
-    RTMP_PT_METADATA     = 22,  ///< FLV metadata
-} RTMPPacketType;
-
-/**
- * possible RTMP packet header sizes
- */
-enum RTMPPacketSize {
-    RTMP_PS_TWELVEBYTES = 0, ///< packet has 12-byte header
-    RTMP_PS_EIGHTBYTES,      ///< packet has 8-byte header
-    RTMP_PS_FOURBYTES,       ///< packet has 4-byte header
-    RTMP_PS_ONEBYTE          ///< packet is really a next chunk of a packet
-};
-
-/**
- * structure for holding RTMP packets
- */
-typedef struct RTMPPacket {
-    int            channel_id; ///< RTMP channel ID (nothing to do with audio/video channels though)
-    RTMPPacketType type;       ///< packet payload type
-    uint32_t       timestamp;  ///< packet full timestamp
-    uint32_t       ts_delta;   ///< timestamp increment to the previous one in milliseconds (latter only for media packets)
-    uint32_t       extra;      ///< probably an additional channel ID used during streaming data
-    uint8_t        *data;      ///< packet payload
-    int            data_size;  ///< packet payload size
-} RTMPPacket;
-
-/**
- * Creates new RTMP packet with given attributes.
- *
- * @param pkt        packet
- * @param channel_id packet channel ID
- * @param type       packet type
- * @param timestamp  packet timestamp
- * @param size       packet size
- * @return zero on success, negative value otherwise
- */
-int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
-                          int timestamp, int size);
-
-/**
- * Frees RTMP packet.
- *
- * @param pkt packet
- */
-void ff_rtmp_packet_destroy(RTMPPacket *pkt);
-
-/**
- * Reads RTMP packet sent by the server.
- *
- * @param h          reader context
- * @param p          packet
- * @param chunk_size current chunk size
- * @param prev_pkt   previously read packet headers for all channels
- *                   (may be needed for restoring incomplete packet header)
- * @return number of bytes read on success, negative value otherwise
- */
-int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
-                        int chunk_size, RTMPPacket *prev_pkt);
-
-/**
- * Sends RTMP packet to the server.
- *
- * @param h          reader context
- * @param p          packet to send
- * @param chunk_size current chunk size
- * @param prev_pkt   previously sent packet headers for all channels
- *                   (may be used for packet header compressing)
- * @return number of bytes written on success, negative value otherwise
- */
-int ff_rtmp_packet_write(URLContext *h, RTMPPacket *p,
-                         int chunk_size, RTMPPacket *prev_pkt);
-
-/**
- * Prints information and contents of RTMP packet.
- *
- * @param h          output context
- * @param p          packet to dump
- */
-void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p);
-
-/**
- * @defgroup amffuncs functions used to work with AMF format (which is also used in .flv)
- * @see amf_* funcs in libavformat/flvdec.c
- * @{
- */
-
-/**
- * Calculates number of bytes taken by first AMF entry in data.
- *
- * @param data input data
- * @param data_end input buffer end
- * @return number of bytes used by first AMF entry
- */
-int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end);
-
-/**
- * Retrieves value of given AMF object field in string form.
- *
- * @param data     AMF object data
- * @param data_end input buffer end
- * @param name     name of field to retrieve
- * @param dst      buffer for storing result
- * @param dst_size output buffer size
- * @return 0 if search and retrieval succeeded, negative value otherwise
- */
-int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
-                           const uint8_t *name, uint8_t *dst, int dst_size);
-
-/**
- * Writes boolean value in AMF format to buffer.
- *
- * @param dst pointer to the input buffer (will be modified)
- * @param val value to write
- */
-void ff_amf_write_bool(uint8_t **dst, int val);
-
-/**
- * Writes number in AMF format to buffer.
- *
- * @param dst pointer to the input buffer (will be modified)
- * @param num value to write
- */
-void ff_amf_write_number(uint8_t **dst, double num);
-
-/**
- * Writes string in AMF format to buffer.
- *
- * @param dst pointer to the input buffer (will be modified)
- * @param str string to write
- */
-void ff_amf_write_string(uint8_t **dst, const char *str);
-
-/**
- * Writes AMF NULL value to buffer.
- *
- * @param dst pointer to the input buffer (will be modified)
- */
-void ff_amf_write_null(uint8_t **dst);
-
-/**
- * Writes marker for AMF object to buffer.
- *
- * @param dst pointer to the input buffer (will be modified)
- */
-void ff_amf_write_object_start(uint8_t **dst);
-
-/**
- * Writes string used as field name in AMF object to buffer.
- *
- * @param dst pointer to the input buffer (will be modified)
- * @param str string to write
- */
-void ff_amf_write_field_name(uint8_t **dst, const char *str);
-
-/**
- * Writes marker for end of AMF object to buffer.
- *
- * @param dst pointer to the input buffer (will be modified)
- */
-void ff_amf_write_object_end(uint8_t **dst);
-
-/** @} */ // AMF funcs
-
-#endif /* AVFORMAT_RTMPPKT_H */
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
deleted file mode 100644
index 4edbffa..0000000
--- a/libavformat/rtmpproto.c
+++ /dev/null
@@ -1,998 +0,0 @@
-/*
- * RTMP network protocol
- * Copyright (c) 2009 Kostya Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RTMP protocol
- */
-
-#include "libavcodec/bytestream.h"
-#include "libavutil/avstring.h"
-#include "libavutil/lfg.h"
-#include "libavutil/sha.h"
-#include "avformat.h"
-#include "internal.h"
-
-#include "network.h"
-
-#include "flv.h"
-#include "rtmp.h"
-#include "rtmppkt.h"
-
-/* we can't use av_log() with URLContext yet... */
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-#define LOG_CONTEXT NULL
-#else
-#define LOG_CONTEXT s
-#endif
-
-//#define DEBUG
-
-/** RTMP protocol handler state */
-typedef enum {
-    STATE_START,      ///< client has not done anything yet
-    STATE_HANDSHAKED, ///< client has performed handshake
-    STATE_RELEASING,  ///< client releasing stream before publish it (for output)
-    STATE_FCPUBLISH,  ///< client FCPublishing stream (for output)
-    STATE_CONNECTING, ///< client connected to server successfully
-    STATE_READY,      ///< client has sent all needed commands and waits for server reply
-    STATE_PLAYING,    ///< client has started receiving multimedia data from server
-    STATE_PUBLISHING, ///< client has started sending multimedia data to server (for output)
-    STATE_STOPPED,    ///< the broadcast has been stopped
-} ClientState;
-
-/** protocol handler context */
-typedef struct RTMPContext {
-    URLContext*   stream;                     ///< TCP stream used in interactions with RTMP server
-    RTMPPacket    prev_pkt[2][RTMP_CHANNELS]; ///< packet history used when reading and sending packets
-    int           chunk_size;                 ///< size of the chunks RTMP packets are divided into
-    int           is_input;                   ///< input/output flag
-    char          playpath[256];              ///< path to filename to play (with possible "mp4:" prefix)
-    char          app[128];                   ///< application
-    ClientState   state;                      ///< current state
-    int           main_channel_id;            ///< an additional channel ID which is used for some invocations
-    uint8_t*      flv_data;                   ///< buffer with data for demuxer
-    int           flv_size;                   ///< current buffer size
-    int           flv_off;                    ///< number of bytes read from current buffer
-    RTMPPacket    out_pkt;                    ///< rtmp packet, created from flv a/v or metadata (for output)
-    uint32_t      client_report_size;         ///< number of bytes after which client should report to server
-    uint32_t      bytes_read;                 ///< number of bytes read from server
-    uint32_t      last_bytes_read;            ///< number of bytes read last reported to server
-} RTMPContext;
-
-#define PLAYER_KEY_OPEN_PART_LEN 30   ///< length of partial key used for first client digest signing
-/** Client key used for digest signing */
-static const uint8_t rtmp_player_key[] = {
-    'G', 'e', 'n', 'u', 'i', 'n', 'e', ' ', 'A', 'd', 'o', 'b', 'e', ' ',
-    'F', 'l', 'a', 's', 'h', ' ', 'P', 'l', 'a', 'y', 'e', 'r', ' ', '0', '0', '1',
-
-    0xF0, 0xEE, 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8, 0x2E, 0x00, 0xD0, 0xD1, 0x02,
-    0x9E, 0x7E, 0x57, 0x6E, 0xEC, 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB, 0x93, 0xB8,
-    0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
-};
-
-#define SERVER_KEY_OPEN_PART_LEN 36   ///< length of partial key used for first server digest signing
-/** Key used for RTMP server digest signing */
-static const uint8_t rtmp_server_key[] = {
-    'G', 'e', 'n', 'u', 'i', 'n', 'e', ' ', 'A', 'd', 'o', 'b', 'e', ' ',
-    'F', 'l', 'a', 's', 'h', ' ', 'M', 'e', 'd', 'i', 'a', ' ',
-    'S', 'e', 'r', 'v', 'e', 'r', ' ', '0', '0', '1',
-
-    0xF0, 0xEE, 0xC2, 0x4A, 0x80, 0x68, 0xBE, 0xE8, 0x2E, 0x00, 0xD0, 0xD1, 0x02,
-    0x9E, 0x7E, 0x57, 0x6E, 0xEC, 0x5D, 0x2D, 0x29, 0x80, 0x6F, 0xAB, 0x93, 0xB8,
-    0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE
-};
-
-/**
- * Generates 'connect' call and sends it to the server.
- */
-static void gen_connect(URLContext *s, RTMPContext *rt, const char *proto,
-                        const char *host, int port)
-{
-    RTMPPacket pkt;
-    uint8_t ver[64], *p;
-    char tcurl[512];
-
-    ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 4096);
-    p = pkt.data;
-
-    ff_url_join(tcurl, sizeof(tcurl), proto, NULL, host, port, "/%s", rt->app);
-    ff_amf_write_string(&p, "connect");
-    ff_amf_write_number(&p, 1.0);
-    ff_amf_write_object_start(&p);
-    ff_amf_write_field_name(&p, "app");
-    ff_amf_write_string(&p, rt->app);
-
-    if (rt->is_input) {
-        snprintf(ver, sizeof(ver), "%s %d,%d,%d,%d", RTMP_CLIENT_PLATFORM, RTMP_CLIENT_VER1,
-                 RTMP_CLIENT_VER2, RTMP_CLIENT_VER3, RTMP_CLIENT_VER4);
-    } else {
-        snprintf(ver, sizeof(ver), "FMLE/3.0 (compatible; %s)", LIBAVFORMAT_IDENT);
-        ff_amf_write_field_name(&p, "type");
-        ff_amf_write_string(&p, "nonprivate");
-    }
-    ff_amf_write_field_name(&p, "flashVer");
-    ff_amf_write_string(&p, ver);
-    ff_amf_write_field_name(&p, "tcUrl");
-    ff_amf_write_string(&p, tcurl);
-    if (rt->is_input) {
-        ff_amf_write_field_name(&p, "fpad");
-        ff_amf_write_bool(&p, 0);
-        ff_amf_write_field_name(&p, "capabilities");
-        ff_amf_write_number(&p, 15.0);
-        ff_amf_write_field_name(&p, "audioCodecs");
-        ff_amf_write_number(&p, 1639.0);
-        ff_amf_write_field_name(&p, "videoCodecs");
-        ff_amf_write_number(&p, 252.0);
-        ff_amf_write_field_name(&p, "videoFunction");
-        ff_amf_write_number(&p, 1.0);
-    }
-    ff_amf_write_object_end(&p);
-
-    pkt.data_size = p - pkt.data;
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates 'releaseStream' call and sends it to the server. It should make
- * the server release some channel for media streams.
- */
-static void gen_release_stream(URLContext *s, RTMPContext *rt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
-                          29 + strlen(rt->playpath));
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Releasing stream...\n");
-    p = pkt.data;
-    ff_amf_write_string(&p, "releaseStream");
-    ff_amf_write_number(&p, 2.0);
-    ff_amf_write_null(&p);
-    ff_amf_write_string(&p, rt->playpath);
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates 'FCPublish' call and sends it to the server. It should make
- * the server preapare for receiving media streams.
- */
-static void gen_fcpublish_stream(URLContext *s, RTMPContext *rt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
-                          25 + strlen(rt->playpath));
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "FCPublish stream...\n");
-    p = pkt.data;
-    ff_amf_write_string(&p, "FCPublish");
-    ff_amf_write_number(&p, 3.0);
-    ff_amf_write_null(&p);
-    ff_amf_write_string(&p, rt->playpath);
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates 'FCUnpublish' call and sends it to the server. It should make
- * the server destroy stream.
- */
-static void gen_fcunpublish_stream(URLContext *s, RTMPContext *rt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0,
-                          27 + strlen(rt->playpath));
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "UnPublishing stream...\n");
-    p = pkt.data;
-    ff_amf_write_string(&p, "FCUnpublish");
-    ff_amf_write_number(&p, 5.0);
-    ff_amf_write_null(&p);
-    ff_amf_write_string(&p, rt->playpath);
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates 'createStream' call and sends it to the server. It should make
- * the server allocate some channel for media streams.
- */
-static void gen_create_stream(URLContext *s, RTMPContext *rt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Creating stream...\n");
-    ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 25);
-
-    p = pkt.data;
-    ff_amf_write_string(&p, "createStream");
-    ff_amf_write_number(&p, rt->is_input ? 3.0 : 4.0);
-    ff_amf_write_null(&p);
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-
-/**
- * Generates 'deleteStream' call and sends it to the server. It should make
- * the server remove some channel for media streams.
- */
-static void gen_delete_stream(URLContext *s, RTMPContext *rt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Deleting stream...\n");
-    ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, 0, 34);
-
-    p = pkt.data;
-    ff_amf_write_string(&p, "deleteStream");
-    ff_amf_write_number(&p, 0.0);
-    ff_amf_write_null(&p);
-    ff_amf_write_number(&p, rt->main_channel_id);
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates 'play' call and sends it to the server, then pings the server
- * to start actual playing.
- */
-static void gen_play(URLContext *s, RTMPContext *rt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending play command for '%s'\n", rt->playpath);
-    ff_rtmp_packet_create(&pkt, RTMP_VIDEO_CHANNEL, RTMP_PT_INVOKE, 0,
-                          20 + strlen(rt->playpath));
-    pkt.extra = rt->main_channel_id;
-
-    p = pkt.data;
-    ff_amf_write_string(&p, "play");
-    ff_amf_write_number(&p, 0.0);
-    ff_amf_write_null(&p);
-    ff_amf_write_string(&p, rt->playpath);
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-
-    // set client buffer time disguised in ping packet
-    ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, 1, 10);
-
-    p = pkt.data;
-    bytestream_put_be16(&p, 3);
-    bytestream_put_be32(&p, 1);
-    bytestream_put_be32(&p, 256); //TODO: what is a good value here?
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates 'publish' call and sends it to the server.
- */
-static void gen_publish(URLContext *s, RTMPContext *rt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath);
-    ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE, 0,
-                          30 + strlen(rt->playpath));
-    pkt.extra = rt->main_channel_id;
-
-    p = pkt.data;
-    ff_amf_write_string(&p, "publish");
-    ff_amf_write_number(&p, 0.0);
-    ff_amf_write_null(&p);
-    ff_amf_write_string(&p, rt->playpath);
-    ff_amf_write_string(&p, "live");
-
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates ping reply and sends it to the server.
- */
-static void gen_pong(URLContext *s, RTMPContext *rt, RTMPPacket *ppkt)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, ppkt->timestamp + 1, 6);
-    p = pkt.data;
-    bytestream_put_be16(&p, 7);
-    bytestream_put_be32(&p, AV_RB32(ppkt->data+2));
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-/**
- * Generates report on bytes read so far and sends it to the server.
- */
-static void gen_bytes_read(URLContext *s, RTMPContext *rt, uint32_t ts)
-{
-    RTMPPacket pkt;
-    uint8_t *p;
-
-    ff_rtmp_packet_create(&pkt, RTMP_NETWORK_CHANNEL, RTMP_PT_BYTES_READ, ts, 4);
-    p = pkt.data;
-    bytestream_put_be32(&p, rt->bytes_read);
-    ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
-    ff_rtmp_packet_destroy(&pkt);
-}
-
-//TODO: Move HMAC code somewhere. Eventually.
-#define HMAC_IPAD_VAL 0x36
-#define HMAC_OPAD_VAL 0x5C
-
-/**
- * Calculates HMAC-SHA2 digest for RTMP handshake packets.
- *
- * @param src    input buffer
- * @param len    input buffer length (should be 1536)
- * @param gap    offset in buffer where 32 bytes should not be taken into account
- *               when calculating digest (since it will be used to store that digest)
- * @param key    digest key
- * @param keylen digest key length
- * @param dst    buffer where calculated digest will be stored (32 bytes)
- */
-static void rtmp_calc_digest(const uint8_t *src, int len, int gap,
-                             const uint8_t *key, int keylen, uint8_t *dst)
-{
-    struct AVSHA *sha;
-    uint8_t hmac_buf[64+32] = {0};
-    int i;
-
-    sha = av_mallocz(av_sha_size);
-
-    if (keylen < 64) {
-        memcpy(hmac_buf, key, keylen);
-    } else {
-        av_sha_init(sha, 256);
-        av_sha_update(sha,key, keylen);
-        av_sha_final(sha, hmac_buf);
-    }
-    for (i = 0; i < 64; i++)
-        hmac_buf[i] ^= HMAC_IPAD_VAL;
-
-    av_sha_init(sha, 256);
-    av_sha_update(sha, hmac_buf, 64);
-    if (gap <= 0) {
-        av_sha_update(sha, src, len);
-    } else { //skip 32 bytes used for storing digest
-        av_sha_update(sha, src, gap);
-        av_sha_update(sha, src + gap + 32, len - gap - 32);
-    }
-    av_sha_final(sha, hmac_buf + 64);
-
-    for (i = 0; i < 64; i++)
-        hmac_buf[i] ^= HMAC_IPAD_VAL ^ HMAC_OPAD_VAL; //reuse XORed key for opad
-    av_sha_init(sha, 256);
-    av_sha_update(sha, hmac_buf, 64+32);
-    av_sha_final(sha, dst);
-
-    av_free(sha);
-}
-
-/**
- * Puts HMAC-SHA2 digest of packet data (except for the bytes where this digest
- * will be stored) into that packet.
- *
- * @param buf handshake data (1536 bytes)
- * @return offset to the digest inside input data
- */
-static int rtmp_handshake_imprint_with_digest(uint8_t *buf)
-{
-    int i, digest_pos = 0;
-
-    for (i = 8; i < 12; i++)
-        digest_pos += buf[i];
-    digest_pos = (digest_pos % 728) + 12;
-
-    rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
-                     rtmp_player_key, PLAYER_KEY_OPEN_PART_LEN,
-                     buf + digest_pos);
-    return digest_pos;
-}
-
-/**
- * Verifies that the received server response has the expected digest value.
- *
- * @param buf handshake data received from the server (1536 bytes)
- * @param off position to search digest offset from
- * @return 0 if digest is valid, digest position otherwise
- */
-static int rtmp_validate_digest(uint8_t *buf, int off)
-{
-    int i, digest_pos = 0;
-    uint8_t digest[32];
-
-    for (i = 0; i < 4; i++)
-        digest_pos += buf[i + off];
-    digest_pos = (digest_pos % 728) + off + 4;
-
-    rtmp_calc_digest(buf, RTMP_HANDSHAKE_PACKET_SIZE, digest_pos,
-                     rtmp_server_key, SERVER_KEY_OPEN_PART_LEN,
-                     digest);
-    if (!memcmp(digest, buf + digest_pos, 32))
-        return digest_pos;
-    return 0;
-}
-
-/**
- * Performs handshake with the server by means of exchanging pseudorandom data
- * signed with HMAC-SHA2 digest.
- *
- * @return 0 if handshake succeeds, negative value otherwise
- */
-static int rtmp_handshake(URLContext *s, RTMPContext *rt)
-{
-    AVLFG rnd;
-    uint8_t tosend    [RTMP_HANDSHAKE_PACKET_SIZE+1] = {
-        3,                // unencrypted data
-        0, 0, 0, 0,       // client uptime
-        RTMP_CLIENT_VER1,
-        RTMP_CLIENT_VER2,
-        RTMP_CLIENT_VER3,
-        RTMP_CLIENT_VER4,
-    };
-    uint8_t clientdata[RTMP_HANDSHAKE_PACKET_SIZE];
-    uint8_t serverdata[RTMP_HANDSHAKE_PACKET_SIZE+1];
-    int i;
-    int server_pos, client_pos;
-    uint8_t digest[32];
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Handshaking...\n");
-
-    av_lfg_init(&rnd, 0xDEADC0DE);
-    // generate handshake packet - 1536 bytes of pseudorandom data
-    for (i = 9; i <= RTMP_HANDSHAKE_PACKET_SIZE; i++)
-        tosend[i] = av_lfg_get(&rnd) >> 24;
-    client_pos = rtmp_handshake_imprint_with_digest(tosend + 1);
-
-    url_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
-    i = url_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
-    if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) {
-        av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
-        return -1;
-    }
-    i = url_read_complete(rt->stream, clientdata, RTMP_HANDSHAKE_PACKET_SIZE);
-    if (i != RTMP_HANDSHAKE_PACKET_SIZE) {
-        av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
-        return -1;
-    }
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Server version %d.%d.%d.%d\n",
-           serverdata[5], serverdata[6], serverdata[7], serverdata[8]);
-
-    if (rt->is_input && serverdata[5] >= 3) {
-        server_pos = rtmp_validate_digest(serverdata + 1, 772);
-        if (!server_pos) {
-            server_pos = rtmp_validate_digest(serverdata + 1, 8);
-            if (!server_pos) {
-                av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server response validating failed\n");
-                return -1;
-            }
-        }
-
-        rtmp_calc_digest(tosend + 1 + client_pos, 32, 0,
-                         rtmp_server_key, sizeof(rtmp_server_key),
-                         digest);
-        rtmp_calc_digest(clientdata, RTMP_HANDSHAKE_PACKET_SIZE-32, 0,
-                         digest, 32,
-                         digest);
-        if (memcmp(digest, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) {
-            av_log(LOG_CONTEXT, AV_LOG_ERROR, "Signature mismatch\n");
-            return -1;
-        }
-
-        for (i = 0; i < RTMP_HANDSHAKE_PACKET_SIZE; i++)
-            tosend[i] = av_lfg_get(&rnd) >> 24;
-        rtmp_calc_digest(serverdata + 1 + server_pos, 32, 0,
-                         rtmp_player_key, sizeof(rtmp_player_key),
-                         digest);
-        rtmp_calc_digest(tosend,  RTMP_HANDSHAKE_PACKET_SIZE - 32, 0,
-                         digest, 32,
-                         tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32);
-
-        // write reply back to the server
-        url_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE);
-    } else {
-        url_write(rt->stream, serverdata+1, RTMP_HANDSHAKE_PACKET_SIZE);
-    }
-
-    return 0;
-}
-
-/**
- * Parses received packet and may perform some action depending on
- * the packet contents.
- * @return 0 for no errors, negative values for serious errors which prevent
- *         further communications, positive values for uncritical errors
- */
-static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
-{
-    int i, t;
-    const uint8_t *data_end = pkt->data + pkt->data_size;
-
-#ifdef DEBUG
-    ff_rtmp_packet_dump(LOG_CONTEXT, pkt);
-#endif
-
-    switch (pkt->type) {
-    case RTMP_PT_CHUNK_SIZE:
-        if (pkt->data_size != 4) {
-            av_log(LOG_CONTEXT, AV_LOG_ERROR,
-                   "Chunk size change packet is not 4 bytes long (%d)\n", pkt->data_size);
-            return -1;
-        }
-        if (!rt->is_input)
-            ff_rtmp_packet_write(rt->stream, pkt, rt->chunk_size, rt->prev_pkt[1]);
-        rt->chunk_size = AV_RB32(pkt->data);
-        if (rt->chunk_size <= 0) {
-            av_log(LOG_CONTEXT, AV_LOG_ERROR, "Incorrect chunk size %d\n", rt->chunk_size);
-            return -1;
-        }
-        av_log(LOG_CONTEXT, AV_LOG_DEBUG, "New chunk size = %d\n", rt->chunk_size);
-        break;
-    case RTMP_PT_PING:
-        t = AV_RB16(pkt->data);
-        if (t == 6)
-            gen_pong(s, rt, pkt);
-        break;
-    case RTMP_PT_CLIENT_BW:
-        if (pkt->data_size < 4) {
-            av_log(LOG_CONTEXT, AV_LOG_ERROR,
-                   "Client bandwidth report packet is less than 4 bytes long (%d)\n",
-                   pkt->data_size);
-            return -1;
-        }
-        av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data));
-        rt->client_report_size = AV_RB32(pkt->data) >> 1;
-        break;
-    case RTMP_PT_INVOKE:
-        //TODO: check for the messages sent for wrong state?
-        if (!memcmp(pkt->data, "\002\000\006_error", 9)) {
-            uint8_t tmpstr[256];
-
-            if (!ff_amf_get_field_value(pkt->data + 9, data_end,
-                                        "description", tmpstr, sizeof(tmpstr)))
-                av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
-            return -1;
-        } else if (!memcmp(pkt->data, "\002\000\007_result", 10)) {
-            switch (rt->state) {
-            case STATE_HANDSHAKED:
-                if (!rt->is_input) {
-                    gen_release_stream(s, rt);
-                    gen_fcpublish_stream(s, rt);
-                    rt->state = STATE_RELEASING;
-                } else {
-                    rt->state = STATE_CONNECTING;
-                }
-                gen_create_stream(s, rt);
-                break;
-            case STATE_FCPUBLISH:
-                rt->state = STATE_CONNECTING;
-                break;
-            case STATE_RELEASING:
-                rt->state = STATE_FCPUBLISH;
-                /* hack for Wowza Media Server, it does not send result for
-                 * releaseStream and FCPublish calls */
-                if (!pkt->data[10]) {
-                    int pkt_id = (int) av_int2dbl(AV_RB64(pkt->data + 11));
-                    if (pkt_id == 4)
-                        rt->state = STATE_CONNECTING;
-                }
-                if (rt->state != STATE_CONNECTING)
-                    break;
-            case STATE_CONNECTING:
-                //extract a number from the result
-                if (pkt->data[10] || pkt->data[19] != 5 || pkt->data[20]) {
-                    av_log(LOG_CONTEXT, AV_LOG_WARNING, "Unexpected reply on connect()\n");
-                } else {
-                    rt->main_channel_id = (int) av_int2dbl(AV_RB64(pkt->data + 21));
-                }
-                if (rt->is_input) {
-                    gen_play(s, rt);
-                } else {
-                    gen_publish(s, rt);
-                }
-                rt->state = STATE_READY;
-                break;
-            }
-        } else if (!memcmp(pkt->data, "\002\000\010onStatus", 11)) {
-            const uint8_t* ptr = pkt->data + 11;
-            uint8_t tmpstr[256];
-
-            for (i = 0; i < 2; i++) {
-                t = ff_amf_tag_size(ptr, data_end);
-                if (t < 0)
-                    return 1;
-                ptr += t;
-            }
-            t = ff_amf_get_field_value(ptr, data_end,
-                                       "level", tmpstr, sizeof(tmpstr));
-            if (!t && !strcmp(tmpstr, "error")) {
-                if (!ff_amf_get_field_value(ptr, data_end,
-                                            "description", tmpstr, sizeof(tmpstr)))
-                    av_log(LOG_CONTEXT, AV_LOG_ERROR, "Server error: %s\n",tmpstr);
-                return -1;
-            }
-            t = ff_amf_get_field_value(ptr, data_end,
-                                       "code", tmpstr, sizeof(tmpstr));
-            if (!t && !strcmp(tmpstr, "NetStream.Play.Start")) rt->state = STATE_PLAYING;
-            if (!t && !strcmp(tmpstr, "NetStream.Play.Stop")) rt->state = STATE_STOPPED;
-            if (!t && !strcmp(tmpstr, "NetStream.Play.UnpublishNotify")) rt->state = STATE_STOPPED;
-            if (!t && !strcmp(tmpstr, "NetStream.Publish.Start")) rt->state = STATE_PUBLISHING;
-        }
-        break;
-    }
-    return 0;
-}
-
-/**
- * Interacts with the server by receiving and sending RTMP packets until
- * there is some significant data (media data or expected status notification).
- *
- * @param s          reading context
- * @param for_header non-zero value tells function to work until it
- * gets notification from the server that playing has been started,
- * otherwise function will work until some media data is received (or
- * an error happens)
- * @return 0 for successful operation, negative value in case of error
- */
-static int get_packet(URLContext *s, int for_header)
-{
-    RTMPContext *rt = s->priv_data;
-    int ret;
-    uint8_t *p;
-    const uint8_t *next;
-    uint32_t data_size;
-    uint32_t ts, cts, pts=0;
-
-    if (rt->state == STATE_STOPPED)
-        return AVERROR_EOF;
-
-    for (;;) {
-        RTMPPacket rpkt;
-        if ((ret = ff_rtmp_packet_read(rt->stream, &rpkt,
-                                       rt->chunk_size, rt->prev_pkt[0])) <= 0) {
-            if (ret == 0) {
-                return AVERROR(EAGAIN);
-            } else {
-                return AVERROR(EIO);
-            }
-        }
-        rt->bytes_read += ret;
-        if (rt->bytes_read > rt->last_bytes_read + rt->client_report_size) {
-            av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Sending bytes read report\n");
-            gen_bytes_read(s, rt, rpkt.timestamp + 1);
-            rt->last_bytes_read = rt->bytes_read;
-        }
-
-        ret = rtmp_parse_result(s, rt, &rpkt);
-        if (ret < 0) {//serious error in current packet
-            ff_rtmp_packet_destroy(&rpkt);
-            return -1;
-        }
-        if (rt->state == STATE_STOPPED) {
-            ff_rtmp_packet_destroy(&rpkt);
-            return AVERROR_EOF;
-        }
-        if (for_header && (rt->state == STATE_PLAYING || rt->state == STATE_PUBLISHING)) {
-            ff_rtmp_packet_destroy(&rpkt);
-            return 0;
-        }
-        if (!rpkt.data_size || !rt->is_input) {
-            ff_rtmp_packet_destroy(&rpkt);
-            continue;
-        }
-        if (rpkt.type == RTMP_PT_VIDEO || rpkt.type == RTMP_PT_AUDIO ||
-           (rpkt.type == RTMP_PT_NOTIFY && !memcmp("\002\000\012onMetaData", rpkt.data, 13))) {
-            ts = rpkt.timestamp;
-
-            // generate packet header and put data into buffer for FLV demuxer
-            rt->flv_off  = 0;
-            rt->flv_size = rpkt.data_size + 15;
-            rt->flv_data = p = av_realloc(rt->flv_data, rt->flv_size);
-            bytestream_put_byte(&p, rpkt.type);
-            bytestream_put_be24(&p, rpkt.data_size);
-            bytestream_put_be24(&p, ts);
-            bytestream_put_byte(&p, ts >> 24);
-            bytestream_put_be24(&p, 0);
-            bytestream_put_buffer(&p, rpkt.data, rpkt.data_size);
-            bytestream_put_be32(&p, 0);
-            ff_rtmp_packet_destroy(&rpkt);
-            return 0;
-        } else if (rpkt.type == RTMP_PT_METADATA) {
-            // we got raw FLV data, make it available for FLV demuxer
-            rt->flv_off  = 0;
-            rt->flv_size = rpkt.data_size;
-            rt->flv_data = av_realloc(rt->flv_data, rt->flv_size);
-            /* rewrite timestamps */
-            next = rpkt.data;
-            ts = rpkt.timestamp;
-            while (next - rpkt.data < rpkt.data_size - 11) {
-                next++;
-                data_size = bytestream_get_be24(&next);
-                p=next;
-                cts = bytestream_get_be24(&next);
-                cts |= bytestream_get_byte(&next);
-                if (pts==0)
-                    pts=cts;
-                ts += cts - pts;
-                pts = cts;
-                bytestream_put_be24(&p, ts);
-                bytestream_put_byte(&p, ts >> 24);
-                next += data_size + 3 + 4;
-            }
-            memcpy(rt->flv_data, rpkt.data, rpkt.data_size);
-            ff_rtmp_packet_destroy(&rpkt);
-            return 0;
-        }
-        ff_rtmp_packet_destroy(&rpkt);
-    }
-    return 0;
-}
-
-static int rtmp_close(URLContext *h)
-{
-    RTMPContext *rt = h->priv_data;
-
-    if (!rt->is_input) {
-        rt->flv_data = NULL;
-        if (rt->out_pkt.data_size)
-            ff_rtmp_packet_destroy(&rt->out_pkt);
-        if (rt->state > STATE_FCPUBLISH)
-            gen_fcunpublish_stream(h, rt);
-    }
-    if (rt->state > STATE_HANDSHAKED)
-        gen_delete_stream(h, rt);
-
-    av_freep(&rt->flv_data);
-    url_close(rt->stream);
-    av_free(rt);
-    return 0;
-}
-
-/**
- * Opens RTMP connection and verifies that the stream can be played.
- *
- * URL syntax: rtmp://server[:port][/app][/playpath]
- *             where 'app' is first one or two directories in the path
- *             (e.g. /ondemand/, /flash/live/, etc.)
- *             and 'playpath' is a file name (the rest of the path,
- *             may be prefixed with "mp4:")
- */
-static int rtmp_open(URLContext *s, const char *uri, int flags)
-{
-    RTMPContext *rt;
-    char proto[8], hostname[256], path[1024], *fname;
-    uint8_t buf[2048];
-    int port;
-    int ret;
-
-    rt = av_mallocz(sizeof(RTMPContext));
-    if (!rt)
-        return AVERROR(ENOMEM);
-    s->priv_data = rt;
-    rt->is_input = !(flags & URL_WRONLY);
-
-    ff_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
-                 path, sizeof(path), s->filename);
-
-    if (port < 0)
-        port = RTMP_DEFAULT_PORT;
-    ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
-
-    if (url_open(&rt->stream, buf, URL_RDWR) < 0) {
-        av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot open connection %s\n", buf);
-        goto fail;
-    }
-
-    rt->state = STATE_START;
-    if (rtmp_handshake(s, rt))
-        return -1;
-
-    rt->chunk_size = 128;
-    rt->state = STATE_HANDSHAKED;
-    //extract "app" part from path
-    if (!strncmp(path, "/ondemand/", 10)) {
-        fname = path + 10;
-        memcpy(rt->app, "ondemand", 9);
-    } else {
-        char *p = strchr(path + 1, '/');
-        if (!p) {
-            fname = path + 1;
-            rt->app[0] = '\0';
-        } else {
-            char *c = strchr(p + 1, ':');
-            fname = strchr(p + 1, '/');
-            if (!fname || c < fname) {
-                fname = p + 1;
-                av_strlcpy(rt->app, path + 1, p - path);
-            } else {
-                fname++;
-                av_strlcpy(rt->app, path + 1, fname - path - 1);
-            }
-        }
-    }
-    if (!strchr(fname, ':') &&
-        (!strcmp(fname + strlen(fname) - 4, ".f4v") ||
-         !strcmp(fname + strlen(fname) - 4, ".mp4"))) {
-        memcpy(rt->playpath, "mp4:", 5);
-    } else {
-        rt->playpath[0] = 0;
-    }
-    strncat(rt->playpath, fname, sizeof(rt->playpath) - 5);
-
-    rt->client_report_size = 1048576;
-    rt->bytes_read = 0;
-    rt->last_bytes_read = 0;
-
-    av_log(LOG_CONTEXT, AV_LOG_DEBUG, "Proto = %s, path = %s, app = %s, fname = %s\n",
-           proto, path, rt->app, rt->playpath);
-    gen_connect(s, rt, proto, hostname, port);
-
-    do {
-        ret = get_packet(s, 1);
-    } while (ret == EAGAIN);
-    if (ret < 0)
-        goto fail;
-
-    if (rt->is_input) {
-        // generate FLV header for demuxer
-        rt->flv_size = 13;
-        rt->flv_data = av_realloc(rt->flv_data, rt->flv_size);
-        rt->flv_off  = 0;
-        memcpy(rt->flv_data, "FLV\1\5\0\0\0\011\0\0\0\0", rt->flv_size);
-    } else {
-        rt->flv_size = 0;
-        rt->flv_data = NULL;
-        rt->flv_off  = 0;
-    }
-
-    s->max_packet_size = url_get_max_packet_size(rt->stream);
-    s->is_streamed     = 1;
-    return 0;
-
-fail:
-    rtmp_close(s);
-    return AVERROR(EIO);
-}
-
-static int rtmp_read(URLContext *s, uint8_t *buf, int size)
-{
-    RTMPContext *rt = s->priv_data;
-    int orig_size = size;
-    int ret;
-
-    while (size > 0) {
-        int data_left = rt->flv_size - rt->flv_off;
-
-        if (data_left >= size) {
-            memcpy(buf, rt->flv_data + rt->flv_off, size);
-            rt->flv_off += size;
-            return orig_size;
-        }
-        if (data_left > 0) {
-            memcpy(buf, rt->flv_data + rt->flv_off, data_left);
-            buf  += data_left;
-            size -= data_left;
-            rt->flv_off = rt->flv_size;
-        }
-        if ((ret = get_packet(s, 0)) < 0)
-           return ret;
-    }
-    return orig_size;
-}
-
-static int rtmp_write(URLContext *h, uint8_t *buf, int size)
-{
-    RTMPContext *rt = h->priv_data;
-    int size_temp = size;
-    int pktsize, pkttype;
-    uint32_t ts;
-    const uint8_t *buf_temp = buf;
-
-    if (size < 11) {
-        av_log(LOG_CONTEXT, AV_LOG_DEBUG, "FLV packet too small %d\n", size);
-        return 0;
-    }
-
-    do {
-        if (!rt->flv_off) {
-            //skip flv header
-            if (buf_temp[0] == 'F' && buf_temp[1] == 'L' && buf_temp[2] == 'V') {
-                buf_temp += 9 + 4;
-                size_temp -= 9 + 4;
-            }
-
-            pkttype = bytestream_get_byte(&buf_temp);
-            pktsize = bytestream_get_be24(&buf_temp);
-            ts = bytestream_get_be24(&buf_temp);
-            ts |= bytestream_get_byte(&buf_temp) << 24;
-            bytestream_get_be24(&buf_temp);
-            size_temp -= 11;
-            rt->flv_size = pktsize;
-
-            //force 12bytes header
-            if (((pkttype == RTMP_PT_VIDEO || pkttype == RTMP_PT_AUDIO) && ts == 0) ||
-                pkttype == RTMP_PT_NOTIFY) {
-                if (pkttype == RTMP_PT_NOTIFY)
-                    pktsize += 16;
-                rt->prev_pkt[1][RTMP_SOURCE_CHANNEL].channel_id = 0;
-            }
-
-            //this can be a big packet, it's better to send it right here
-            ff_rtmp_packet_create(&rt->out_pkt, RTMP_SOURCE_CHANNEL, pkttype, ts, pktsize);
-            rt->out_pkt.extra = rt->main_channel_id;
-            rt->flv_data = rt->out_pkt.data;
-
-            if (pkttype == RTMP_PT_NOTIFY)
-                ff_amf_write_string(&rt->flv_data, "@setDataFrame");
-        }
-
-        if (rt->flv_size - rt->flv_off > size_temp) {
-            bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, size_temp);
-            rt->flv_off += size_temp;
-        } else {
-            bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, rt->flv_size - rt->flv_off);
-            rt->flv_off += rt->flv_size - rt->flv_off;
-        }
-
-        if (rt->flv_off == rt->flv_size) {
-            bytestream_get_be32(&buf_temp);
-
-            ff_rtmp_packet_write(rt->stream, &rt->out_pkt, rt->chunk_size, rt->prev_pkt[1]);
-            ff_rtmp_packet_destroy(&rt->out_pkt);
-            rt->flv_size = 0;
-            rt->flv_off = 0;
-        }
-    } while (buf_temp - buf < size_temp);
-    return size;
-}
-
-URLProtocol rtmp_protocol = {
-    "rtmp",
-    rtmp_open,
-    rtmp_read,
-    rtmp_write,
-    NULL, /* seek */
-    rtmp_close,
-};
diff --git a/libavformat/rtp.c b/libavformat/rtp.c
deleted file mode 100644
index a8dcfd7..0000000
--- a/libavformat/rtp.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * RTP input/output format
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-#include "rtp.h"
-
-//#define DEBUG
-
-/* from http://www.iana.org/assignments/rtp-parameters last updated 05 January 2005 */
-/* payload types >= 96 are dynamic;
- * payload types between 72 and 76 are reserved for RTCP conflict avoidance;
- * all the other payload types not present in the table are unassigned or
- * reserved
- */
-static const struct
-{
-    int pt;
-    const char enc_name[6];
-    enum AVMediaType codec_type;
-    enum CodecID codec_id;
-    int clock_rate;
-    int audio_channels;
-} AVRtpPayloadTypes[]=
-{
-  {0, "PCMU",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_PCM_MULAW, 8000, 1},
-  {3, "GSM",         AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {4, "G723",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {5, "DVI4",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {6, "DVI4",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 16000, 1},
-  {7, "LPC",         AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {8, "PCMA",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_PCM_ALAW, 8000, 1},
-  {9, "G722",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {10, "L16",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_PCM_S16BE, 44100, 2},
-  {11, "L16",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_PCM_S16BE, 44100, 1},
-  {12, "QCELP",      AVMEDIA_TYPE_AUDIO,   CODEC_ID_QCELP, 8000, 1},
-  {13, "CN",         AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {14, "MPA",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_MP2, -1, -1},
-  {14, "MPA",        AVMEDIA_TYPE_AUDIO,   CODEC_ID_MP3, -1, -1},
-  {15, "G728",       AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {16, "DVI4",       AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 11025, 1},
-  {17, "DVI4",       AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 22050, 1},
-  {18, "G729",       AVMEDIA_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {25, "CelB",       AVMEDIA_TYPE_VIDEO,   CODEC_ID_NONE, 90000, -1},
-  {26, "JPEG",       AVMEDIA_TYPE_VIDEO,   CODEC_ID_MJPEG, 90000, -1},
-  {28, "nv",         AVMEDIA_TYPE_VIDEO,   CODEC_ID_NONE, 90000, -1},
-  {31, "H261",       AVMEDIA_TYPE_VIDEO,   CODEC_ID_H261, 90000, -1},
-  {32, "MPV",        AVMEDIA_TYPE_VIDEO,   CODEC_ID_MPEG1VIDEO, 90000, -1},
-  {32, "MPV",        AVMEDIA_TYPE_VIDEO,   CODEC_ID_MPEG2VIDEO, 90000, -1},
-  {33, "MP2T",       AVMEDIA_TYPE_DATA,    CODEC_ID_MPEG2TS, 90000, -1},
-  {34, "H263",       AVMEDIA_TYPE_VIDEO,   CODEC_ID_H263, 90000, -1},
-  {-1, "",           AVMEDIA_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}
-};
-
-int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type)
-{
-    int i = 0;
-
-    for (i = 0; AVRtpPayloadTypes[i].pt >= 0; i++)
-        if (AVRtpPayloadTypes[i].pt == payload_type) {
-            if (AVRtpPayloadTypes[i].codec_id != CODEC_ID_NONE) {
-                codec->codec_type = AVRtpPayloadTypes[i].codec_type;
-                codec->codec_id = AVRtpPayloadTypes[i].codec_id;
-                if (AVRtpPayloadTypes[i].audio_channels > 0)
-                    codec->channels = AVRtpPayloadTypes[i].audio_channels;
-                if (AVRtpPayloadTypes[i].clock_rate > 0)
-                    codec->sample_rate = AVRtpPayloadTypes[i].clock_rate;
-                return 0;
-            }
-        }
-    return -1;
-}
-
-int ff_rtp_get_payload_type(AVCodecContext *codec)
-{
-    int i, payload_type;
-
-    /* compute the payload type */
-    for (payload_type = -1, i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i)
-        if (AVRtpPayloadTypes[i].codec_id == codec->codec_id) {
-            if (codec->codec_id == CODEC_ID_H263)
-                continue;
-            if (codec->codec_id == CODEC_ID_PCM_S16BE)
-                if (codec->channels != AVRtpPayloadTypes[i].audio_channels)
-                    continue;
-            payload_type = AVRtpPayloadTypes[i].pt;
-        }
-    return payload_type;
-}
-
-const char *ff_rtp_enc_name(int payload_type)
-{
-    int i;
-
-    for (i = 0; AVRtpPayloadTypes[i].pt >= 0; i++)
-        if (AVRtpPayloadTypes[i].pt == payload_type) {
-            return AVRtpPayloadTypes[i].enc_name;
-        }
-
-    return "";
-}
-
-enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type)
-{
-    int i;
-
-    for (i = 0; AVRtpPayloadTypes[i].pt >= 0; i++)
-        if (!strcmp(buf, AVRtpPayloadTypes[i].enc_name) && (codec_type == AVRtpPayloadTypes[i].codec_type)){
-            return AVRtpPayloadTypes[i].codec_id;
-        }
-
-    return CODEC_ID_NONE;
-}
diff --git a/libavformat/rtp.h b/libavformat/rtp.h
deleted file mode 100644
index 7834f9d..0000000
--- a/libavformat/rtp.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * RTP definitions
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVFORMAT_RTP_H
-#define AVFORMAT_RTP_H
-
-#include "libavcodec/avcodec.h"
-
-/**
- * Return the payload type for a given codec.
- *
- * @param codec The context of the codec
- * @return In case of unknown payload type or dynamic payload type, a
- * negative value is returned; otherwise, the payload type (the 'PT' field
- * in the RTP header) is returned.
- */
-int ff_rtp_get_payload_type(AVCodecContext *codec);
-
-/**
- * Initialize a codec context based on the payload type.
- *
- * Fill the codec_type and codec_id fields of a codec context with
- * information depending on the payload type; for audio codecs, the
- * channels and sample_rate fields are also filled.
- *
- * @param codec The context of the codec
- * @param payload_type The payload type (the 'PT' field in the RTP header)
- * @return In case of unknown payload type or dynamic payload type, a
- * negative value is returned; otherwise, 0 is returned
- */
-int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type);
-
-/**
- * Return the encoding name (as defined in
- * http://www.iana.org/assignments/rtp-parameters) for a given payload type.
- *
- * @param payload_type The payload type (the 'PT' field in the RTP header)
- * @return In case of unknown payload type or dynamic payload type, a pointer
- * to an empty string is returned; otherwise, a pointer to a string containing
- * the encoding name is returned
- */
-const char *ff_rtp_enc_name(int payload_type);
-
-/**
- * Return the codec id for the given encoding name and codec type.
- *
- * @param buf A pointer to the string containing the encoding name
- * @param codec_type The codec type
- * @return In case of unknown encoding name, CODEC_ID_NONE is returned;
- * otherwise, the codec id is returned
- */
-enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type);
-
-#define RTP_PT_PRIVATE 96
-#define RTP_VERSION 2
-#define RTP_MAX_SDES 256   /**< maximum text length for SDES */
-
-/* RTCP paquets use 0.5 % of the bandwidth */
-#define RTCP_TX_RATIO_NUM 5
-#define RTCP_TX_RATIO_DEN 1000
-
-#endif /* AVFORMAT_RTP_H */
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
deleted file mode 100644
index 0d2df59..0000000
--- a/libavformat/rtpdec.c
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- * RTP input format
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* needed for gethostname() */
-#define _XOPEN_SOURCE 600
-
-#include "libavcodec/get_bits.h"
-#include "avformat.h"
-#include "mpegts.h"
-
-#include <unistd.h>
-#include "network.h"
-
-#include "rtpdec.h"
-#include "rtpdec_amr.h"
-#include "rtpdec_asf.h"
-#include "rtpdec_h263.h"
-#include "rtpdec_h264.h"
-#include "rtpdec_xiph.h"
-
-//#define DEBUG
-
-/* TODO: - add RTCP statistics reporting (should be optional).
-
-         - add support for h263/mpeg4 packetized output : IDEA: send a
-         buffer to 'rtp_write_packet' contains all the packets for ONE
-         frame. Each packet should have a four byte header containing
-         the length in big endian format (same trick as
-         'url_open_dyn_packet_buf')
-*/
-
-/* statistics functions */
-RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler= NULL;
-
-static RTPDynamicProtocolHandler mp4v_es_handler= {"MP4V-ES", AVMEDIA_TYPE_VIDEO, CODEC_ID_MPEG4};
-static RTPDynamicProtocolHandler mpeg4_generic_handler= {"mpeg4-generic", AVMEDIA_TYPE_AUDIO, CODEC_ID_AAC};
-
-void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler)
-{
-    handler->next= RTPFirstDynamicPayloadHandler;
-    RTPFirstDynamicPayloadHandler= handler;
-}
-
-void av_register_rtp_dynamic_payload_handlers(void)
-{
-    ff_register_dynamic_payload_handler(&mp4v_es_handler);
-    ff_register_dynamic_payload_handler(&mpeg4_generic_handler);
-    ff_register_dynamic_payload_handler(&ff_amr_nb_dynamic_handler);
-    ff_register_dynamic_payload_handler(&ff_amr_wb_dynamic_handler);
-    ff_register_dynamic_payload_handler(&ff_h263_1998_dynamic_handler);
-    ff_register_dynamic_payload_handler(&ff_h263_2000_dynamic_handler);
-    ff_register_dynamic_payload_handler(&ff_h264_dynamic_handler);
-    ff_register_dynamic_payload_handler(&ff_vorbis_dynamic_handler);
-    ff_register_dynamic_payload_handler(&ff_theora_dynamic_handler);
-
-    ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfv_handler);
-    ff_register_dynamic_payload_handler(&ff_ms_rtp_asf_pfa_handler);
-}
-
-static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
-{
-    if (buf[1] != 200)
-        return -1;
-    s->last_rtcp_ntp_time = AV_RB64(buf + 8);
-    if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE)
-        s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
-    s->last_rtcp_timestamp = AV_RB32(buf + 16);
-    return 0;
-}
-
-#define RTP_SEQ_MOD (1<<16)
-
-/**
-* called on parse open packet
-*/
-static void rtp_init_statistics(RTPStatistics *s, uint16_t base_sequence) // called on parse open packet.
-{
-    memset(s, 0, sizeof(RTPStatistics));
-    s->max_seq= base_sequence;
-    s->probation= 1;
-}
-
-/**
-* called whenever there is a large jump in sequence numbers, or when they get out of probation...
-*/
-static void rtp_init_sequence(RTPStatistics *s, uint16_t seq)
-{
-    s->max_seq= seq;
-    s->cycles= 0;
-    s->base_seq= seq -1;
-    s->bad_seq= RTP_SEQ_MOD + 1;
-    s->received= 0;
-    s->expected_prior= 0;
-    s->received_prior= 0;
-    s->jitter= 0;
-    s->transit= 0;
-}
-
-/**
-* returns 1 if we should handle this packet.
-*/
-static int rtp_valid_packet_in_sequence(RTPStatistics *s, uint16_t seq)
-{
-    uint16_t udelta= seq - s->max_seq;
-    const int MAX_DROPOUT= 3000;
-    const int MAX_MISORDER = 100;
-    const int MIN_SEQUENTIAL = 2;
-
-    /* source not valid until MIN_SEQUENTIAL packets with sequence seq. numbers have been received */
-    if(s->probation)
-    {
-        if(seq==s->max_seq + 1) {
-            s->probation--;
-            s->max_seq= seq;
-            if(s->probation==0) {
-                rtp_init_sequence(s, seq);
-                s->received++;
-                return 1;
-            }
-        } else {
-            s->probation= MIN_SEQUENTIAL - 1;
-            s->max_seq = seq;
-        }
-    } else if (udelta < MAX_DROPOUT) {
-        // in order, with permissible gap
-        if(seq < s->max_seq) {
-            //sequence number wrapped; count antother 64k cycles
-            s->cycles += RTP_SEQ_MOD;
-        }
-        s->max_seq= seq;
-    } else if (udelta <= RTP_SEQ_MOD - MAX_MISORDER) {
-        // sequence made a large jump...
-        if(seq==s->bad_seq) {
-            // two sequential packets-- assume that the other side restarted without telling us; just resync.
-            rtp_init_sequence(s, seq);
-        } else {
-            s->bad_seq= (seq + 1) & (RTP_SEQ_MOD-1);
-            return 0;
-        }
-    } else {
-        // duplicate or reordered packet...
-    }
-    s->received++;
-    return 1;
-}
-
-#if 0
-/**
-* This function is currently unused; without a valid local ntp time, I don't see how we could calculate the
-* difference between the arrival and sent timestamp.  As a result, the jitter and transit statistics values
-* never change.  I left this in in case someone else can see a way. (rdm)
-*/
-static void rtcp_update_jitter(RTPStatistics *s, uint32_t sent_timestamp, uint32_t arrival_timestamp)
-{
-    uint32_t transit= arrival_timestamp - sent_timestamp;
-    int d;
-    s->transit= transit;
-    d= FFABS(transit - s->transit);
-    s->jitter += d - ((s->jitter + 8)>>4);
-}
-#endif
-
-int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
-{
-    ByteIOContext *pb;
-    uint8_t *buf;
-    int len;
-    int rtcp_bytes;
-    RTPStatistics *stats= &s->statistics;
-    uint32_t lost;
-    uint32_t extended_max;
-    uint32_t expected_interval;
-    uint32_t received_interval;
-    uint32_t lost_interval;
-    uint32_t expected;
-    uint32_t fraction;
-    uint64_t ntp_time= s->last_rtcp_ntp_time; // TODO: Get local ntp time?
-
-    if (!s->rtp_ctx || (count < 1))
-        return -1;
-
-    /* TODO: I think this is way too often; RFC 1889 has algorithm for this */
-    /* XXX: mpeg pts hardcoded. RTCP send every 0.5 seconds */
-    s->octet_count += count;
-    rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) /
-        RTCP_TX_RATIO_DEN;
-    rtcp_bytes /= 50; // mmu_man: that's enough for me... VLC sends much less btw !?
-    if (rtcp_bytes < 28)
-        return -1;
-    s->last_octet_count = s->octet_count;
-
-    if (url_open_dyn_buf(&pb) < 0)
-        return -1;
-
-    // Receiver Report
-    put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
-    put_byte(pb, 201);
-    put_be16(pb, 7); /* length in words - 1 */
-    put_be32(pb, s->ssrc); // our own SSRC
-    put_be32(pb, s->ssrc); // XXX: should be the server's here!
-    // some placeholders we should really fill...
-    // RFC 1889/p64
-    extended_max= stats->cycles + stats->max_seq;
-    expected= extended_max - stats->base_seq + 1;
-    lost= expected - stats->received;
-    lost= FFMIN(lost, 0xffffff); // clamp it since it's only 24 bits...
-    expected_interval= expected - stats->expected_prior;
-    stats->expected_prior= expected;
-    received_interval= stats->received - stats->received_prior;
-    stats->received_prior= stats->received;
-    lost_interval= expected_interval - received_interval;
-    if (expected_interval==0 || lost_interval<=0) fraction= 0;
-    else fraction = (lost_interval<<8)/expected_interval;
-
-    fraction= (fraction<<24) | lost;
-
-    put_be32(pb, fraction); /* 8 bits of fraction, 24 bits of total packets lost */
-    put_be32(pb, extended_max); /* max sequence received */
-    put_be32(pb, stats->jitter>>4); /* jitter */
-
-    if(s->last_rtcp_ntp_time==AV_NOPTS_VALUE)
-    {
-        put_be32(pb, 0); /* last SR timestamp */
-        put_be32(pb, 0); /* delay since last SR */
-    } else {
-        uint32_t middle_32_bits= s->last_rtcp_ntp_time>>16; // this is valid, right? do we need to handle 64 bit values special?
-        uint32_t delay_since_last= ntp_time - s->last_rtcp_ntp_time;
-
-        put_be32(pb, middle_32_bits); /* last SR timestamp */
-        put_be32(pb, delay_since_last); /* delay since last SR */
-    }
-
-    // CNAME
-    put_byte(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
-    put_byte(pb, 202);
-    len = strlen(s->hostname);
-    put_be16(pb, (6 + len + 3) / 4); /* length in words - 1 */
-    put_be32(pb, s->ssrc);
-    put_byte(pb, 0x01);
-    put_byte(pb, len);
-    put_buffer(pb, s->hostname, len);
-    // padding
-    for (len = (6 + len) % 4; len % 4; len++) {
-        put_byte(pb, 0);
-    }
-
-    put_flush_packet(pb);
-    len = url_close_dyn_buf(pb, &buf);
-    if ((len > 0) && buf) {
-        int result;
-        dprintf(s->ic, "sending %d bytes of RR\n", len);
-        result= url_write(s->rtp_ctx, buf, len);
-        dprintf(s->ic, "result from url_write: %d\n", result);
-        av_free(buf);
-    }
-    return 0;
-}
-
-void rtp_send_punch_packets(URLContext* rtp_handle)
-{
-    ByteIOContext *pb;
-    uint8_t *buf;
-    int len;
-
-    /* Send a small RTP packet */
-    if (url_open_dyn_buf(&pb) < 0)
-        return;
-
-    put_byte(pb, (RTP_VERSION << 6));
-    put_byte(pb, 0); /* Payload type */
-    put_be16(pb, 0); /* Seq */
-    put_be32(pb, 0); /* Timestamp */
-    put_be32(pb, 0); /* SSRC */
-
-    put_flush_packet(pb);
-    len = url_close_dyn_buf(pb, &buf);
-    if ((len > 0) && buf)
-        url_write(rtp_handle, buf, len);
-    av_free(buf);
-
-    /* Send a minimal RTCP RR */
-    if (url_open_dyn_buf(&pb) < 0)
-        return;
-
-    put_byte(pb, (RTP_VERSION << 6));
-    put_byte(pb, 201); /* receiver report */
-    put_be16(pb, 1); /* length in words - 1 */
-    put_be32(pb, 0); /* our own SSRC */
-
-    put_flush_packet(pb);
-    len = url_close_dyn_buf(pb, &buf);
-    if ((len > 0) && buf)
-        url_write(rtp_handle, buf, len);
-    av_free(buf);
-}
-
-
-/**
- * open a new RTP parse context for stream 'st'. 'st' can be NULL for
- * MPEG2TS streams to indicate that they should be demuxed inside the
- * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned)
- * TODO: change this to not take rtp_payload data, and use the new dynamic payload system.
- */
-RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, RTPPayloadData *rtp_payload_data)
-{
-    RTPDemuxContext *s;
-
-    s = av_mallocz(sizeof(RTPDemuxContext));
-    if (!s)
-        return NULL;
-    s->payload_type = payload_type;
-    s->last_rtcp_ntp_time = AV_NOPTS_VALUE;
-    s->first_rtcp_ntp_time = AV_NOPTS_VALUE;
-    s->ic = s1;
-    s->st = st;
-    s->rtp_payload_data = rtp_payload_data;
-    rtp_init_statistics(&s->statistics, 0); // do we know the initial sequence from sdp?
-    if (!strcmp(ff_rtp_enc_name(payload_type), "MP2T")) {
-        s->ts = ff_mpegts_parse_open(s->ic);
-        if (s->ts == NULL) {
-            av_free(s);
-            return NULL;
-        }
-    } else {
-        av_set_pts_info(st, 32, 1, 90000);
-        switch(st->codec->codec_id) {
-        case CODEC_ID_MPEG1VIDEO:
-        case CODEC_ID_MPEG2VIDEO:
-        case CODEC_ID_MP2:
-        case CODEC_ID_MP3:
-        case CODEC_ID_MPEG4:
-        case CODEC_ID_H263:
-        case CODEC_ID_H264:
-            st->need_parsing = AVSTREAM_PARSE_FULL;
-            break;
-        default:
-            if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-                av_set_pts_info(st, 32, 1, st->codec->sample_rate);
-            }
-            break;
-        }
-    }
-    // needed to send back RTCP RR in RTSP sessions
-    s->rtp_ctx = rtpc;
-    gethostname(s->hostname, sizeof(s->hostname));
-    return s;
-}
-
-void
-rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
-                               RTPDynamicProtocolHandler *handler)
-{
-    s->dynamic_protocol_context = ctx;
-    s->parse_packet = handler->parse_packet;
-}
-
-static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
-{
-    int au_headers_length, au_header_size, i;
-    GetBitContext getbitcontext;
-    RTPPayloadData *infos;
-
-    infos = s->rtp_payload_data;
-
-    if (infos == NULL)
-        return -1;
-
-    /* decode the first 2 bytes where the AUHeader sections are stored
-       length in bits */
-    au_headers_length = AV_RB16(buf);
-
-    if (au_headers_length > RTP_MAX_PACKET_LENGTH)
-      return -1;
-
-    infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
-
-    /* skip AU headers length section (2 bytes) */
-    buf += 2;
-
-    init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
-
-    /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
-    au_header_size = infos->sizelength + infos->indexlength;
-    if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
-        return -1;
-
-    infos->nb_au_headers = au_headers_length / au_header_size;
-    if (!infos->au_headers || infos->au_headers_allocated < infos->nb_au_headers) {
-        av_free(infos->au_headers);
-        infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
-        infos->au_headers_allocated = infos->nb_au_headers;
-    }
-
-    /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)
-       In my test, the FAAD decoder does not behave correctly when sending each AU one by one
-       but does when sending the whole as one big packet...  */
-    infos->au_headers[0].size = 0;
-    infos->au_headers[0].index = 0;
-    for (i = 0; i < infos->nb_au_headers; ++i) {
-        infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength);
-        infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength);
-    }
-
-    infos->nb_au_headers = 1;
-
-    return 0;
-}
-
-/**
- * This was the second switch in rtp_parse packet.  Normalizes time, if required, sets stream_index, etc.
- */
-static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp)
-{
-    if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {
-        int64_t addend;
-        int delta_timestamp;
-
-        /* compute pts from timestamp with received ntp_time */
-        delta_timestamp = timestamp - s->last_rtcp_timestamp;
-        /* convert to the PTS timebase */
-        addend = av_rescale(s->last_rtcp_ntp_time - s->first_rtcp_ntp_time, s->st->time_base.den, (uint64_t)s->st->time_base.num << 32);
-        pkt->pts = s->range_start_offset + addend + delta_timestamp;
-    }
-}
-
-/**
- * Parse an RTP or RTCP packet directly sent as a buffer.
- * @param s RTP parse context.
- * @param pkt returned packet
- * @param buf input buffer or NULL to read the next packets
- * @param len buffer len
- * @return 0 if a packet is returned, 1 if a packet is returned and more can follow
- * (use buf as NULL to read the next). -1 if no packet (error or no more packet).
- */
-int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
-                     const uint8_t *buf, int len)
-{
-    unsigned int ssrc, h;
-    int payload_type, seq, ret, flags = 0;
-    AVStream *st;
-    uint32_t timestamp;
-    int rv= 0;
-
-    if (!buf) {
-        /* return the next packets, if any */
-        if(s->st && s->parse_packet) {
-            timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned....
-            rv= s->parse_packet(s->ic, s->dynamic_protocol_context,
-                                s->st, pkt, &timestamp, NULL, 0, flags);
-            finalize_packet(s, pkt, timestamp);
-            return rv;
-        } else {
-            // TODO: Move to a dynamic packet handler (like above)
-            if (s->read_buf_index >= s->read_buf_size)
-                return -1;
-            ret = ff_mpegts_parse_packet(s->ts, pkt, s->buf + s->read_buf_index,
-                                      s->read_buf_size - s->read_buf_index);
-            if (ret < 0)
-                return -1;
-            s->read_buf_index += ret;
-            if (s->read_buf_index < s->read_buf_size)
-                return 1;
-            else
-                return 0;
-        }
-    }
-
-    if (len < 12)
-        return -1;
-
-    if ((buf[0] & 0xc0) != (RTP_VERSION << 6))
-        return -1;
-    if (buf[1] >= 200 && buf[1] <= 204) {
-        rtcp_parse_packet(s, buf, len);
-        return -1;
-    }
-    payload_type = buf[1] & 0x7f;
-    if (buf[1] & 0x80)
-        flags |= RTP_FLAG_MARKER;
-    seq  = AV_RB16(buf + 2);
-    timestamp = AV_RB32(buf + 4);
-    ssrc = AV_RB32(buf + 8);
-    /* store the ssrc in the RTPDemuxContext */
-    s->ssrc = ssrc;
-
-    /* NOTE: we can handle only one payload type */
-    if (s->payload_type != payload_type)
-        return -1;
-
-    st = s->st;
-    // only do something with this if all the rtp checks pass...
-    if(!rtp_valid_packet_in_sequence(&s->statistics, seq))
-    {
-        av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n",
-               payload_type, seq, ((s->seq + 1) & 0xffff));
-        return -1;
-    }
-
-    s->seq = seq;
-    len -= 12;
-    buf += 12;
-
-    if (!st) {
-        /* specific MPEG2TS demux support */
-        ret = ff_mpegts_parse_packet(s->ts, pkt, buf, len);
-        if (ret < 0)
-            return -1;
-        if (ret < len) {
-            s->read_buf_size = len - ret;
-            memcpy(s->buf, buf + ret, s->read_buf_size);
-            s->read_buf_index = 0;
-            return 1;
-        }
-        return 0;
-    } else if (s->parse_packet) {
-        rv = s->parse_packet(s->ic, s->dynamic_protocol_context,
-                             s->st, pkt, &timestamp, buf, len, flags);
-    } else {
-        // at this point, the RTP header has been stripped;  This is ASSUMING that there is only 1 CSRC, which in't wise.
-        switch(st->codec->codec_id) {
-        case CODEC_ID_MP2:
-        case CODEC_ID_MP3:
-            /* better than nothing: skip mpeg audio RTP header */
-            if (len <= 4)
-                return -1;
-            h = AV_RB32(buf);
-            len -= 4;
-            buf += 4;
-            av_new_packet(pkt, len);
-            memcpy(pkt->data, buf, len);
-            break;
-        case CODEC_ID_MPEG1VIDEO:
-        case CODEC_ID_MPEG2VIDEO:
-            /* better than nothing: skip mpeg video RTP header */
-            if (len <= 4)
-                return -1;
-            h = AV_RB32(buf);
-            buf += 4;
-            len -= 4;
-            if (h & (1 << 26)) {
-                /* mpeg2 */
-                if (len <= 4)
-                    return -1;
-                buf += 4;
-                len -= 4;
-            }
-            av_new_packet(pkt, len);
-            memcpy(pkt->data, buf, len);
-            break;
-            // moved from below, verbatim.  this is because this section handles packets, and the lower switch handles
-            // timestamps.
-            // TODO: Put this into a dynamic packet handler...
-        case CODEC_ID_AAC:
-            if (rtp_parse_mp4_au(s, buf))
-                return -1;
-            {
-                RTPPayloadData *infos = s->rtp_payload_data;
-                if (infos == NULL)
-                    return -1;
-                buf += infos->au_headers_length_bytes + 2;
-                len -= infos->au_headers_length_bytes + 2;
-
-                /* XXX: Fixme we only handle the case where rtp_parse_mp4_au define
-                    one au_header */
-                av_new_packet(pkt, infos->au_headers[0].size);
-                memcpy(pkt->data, buf, infos->au_headers[0].size);
-                buf += infos->au_headers[0].size;
-                len -= infos->au_headers[0].size;
-            }
-            s->read_buf_size = len;
-            rv= 0;
-            break;
-        default:
-            av_new_packet(pkt, len);
-            memcpy(pkt->data, buf, len);
-            break;
-        }
-
-        pkt->stream_index = st->index;
-    }
-
-    // now perform timestamp things....
-    finalize_packet(s, pkt, timestamp);
-
-    return rv;
-}
-
-void rtp_parse_close(RTPDemuxContext *s)
-{
-    // TODO: fold this into the protocol specific data fields.
-    av_free(s->rtp_payload_data->mode);
-    av_free(s->rtp_payload_data->au_headers);
-    if (!strcmp(ff_rtp_enc_name(s->payload_type), "MP2T")) {
-        ff_mpegts_parse_close(s->ts);
-    }
-    av_free(s);
-}
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
deleted file mode 100644
index 477ab72..0000000
--- a/libavformat/rtpdec.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * RTP demuxer definitions
- * Copyright (c) 2002 Fabrice Bellard
- * Copyright (c) 2006 Ryan Martell <rdm4 at martellventures.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVFORMAT_RTPDEC_H
-#define AVFORMAT_RTPDEC_H
-
-#include "libavcodec/avcodec.h"
-#include "avformat.h"
-#include "rtp.h"
-
-/** Structure listing useful vars to parse RTP packet payload*/
-typedef struct rtp_payload_data
-{
-    int sizelength;
-    int indexlength;
-    int indexdeltalength;
-    int profile_level_id;
-    int streamtype;
-    int objecttype;
-    char *mode;
-
-    /** mpeg 4 AU headers */
-    struct AUHeaders {
-        int size;
-        int index;
-        int cts_flag;
-        int cts;
-        int dts_flag;
-        int dts;
-        int rap_flag;
-        int streamstate;
-    } *au_headers;
-    int au_headers_allocated;
-    int nb_au_headers;
-    int au_headers_length_bytes;
-    int cur_au_index;
-} RTPPayloadData;
-
-typedef struct PayloadContext PayloadContext;
-typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
-
-#define RTP_MIN_PACKET_LENGTH 12
-#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
-
-typedef struct RTPDemuxContext RTPDemuxContext;
-RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, RTPPayloadData *rtp_payload_data);
-void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
-                                    RTPDynamicProtocolHandler *handler);
-int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
-                     const uint8_t *buf, int len);
-void rtp_parse_close(RTPDemuxContext *s);
-#if (LIBAVFORMAT_VERSION_MAJOR <= 53)
-int rtp_get_local_port(URLContext *h);
-#endif
-int rtp_get_local_rtp_port(URLContext *h);
-int rtp_get_local_rtcp_port(URLContext *h);
-
-int rtp_set_remote_url(URLContext *h, const char *uri);
-#if (LIBAVFORMAT_VERSION_MAJOR <= 52)
-void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
-#endif
-
-/**
- * Send a dummy packet on both port pairs to set up the connection
- * state in potential NAT routers, so that we're able to receive
- * packets.
- *
- * Note, this only works if the NAT router doesn't remap ports. This
- * isn't a standardized procedure, but it works in many cases in practice.
- *
- * The same routine is used with RDT too, even if RDT doesn't use normal
- * RTP packets otherwise.
- */
-void rtp_send_punch_packets(URLContext* rtp_handle);
-
-/**
- * some rtp servers assume client is dead if they don't hear from them...
- * so we send a Receiver Report to the provided ByteIO context
- * (we don't have access to the rtcp handle from here)
- */
-int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
-
-// these statistics are used for rtcp receiver reports...
-typedef struct {
-    uint16_t max_seq;           ///< highest sequence number seen
-    uint32_t cycles;            ///< shifted count of sequence number cycles
-    uint32_t base_seq;          ///< base sequence number
-    uint32_t bad_seq;           ///< last bad sequence number + 1
-    int probation;              ///< sequence packets till source is valid
-    int received;               ///< packets received
-    int expected_prior;         ///< packets expected in last interval
-    int received_prior;         ///< packets received in last interval
-    uint32_t transit;           ///< relative transit time for previous packet
-    uint32_t jitter;            ///< estimated jitter.
-} RTPStatistics;
-
-#define RTP_FLAG_KEY    0x1 ///< RTP packet contains a keyframe
-#define RTP_FLAG_MARKER 0x2 ///< RTP marker bit was set for this packet
-/**
- * Packet parsing for "private" payloads in the RTP specs.
- *
- * @param ctx RTSP demuxer context
- * @param s stream context
- * @param st stream that this packet belongs to
- * @param pkt packet in which to write the parsed data
- * @param timestamp pointer in which to write the timestamp of this RTP packet
- * @param buf pointer to raw RTP packet data
- * @param len length of buf
- * @param flags flags from the RTP packet header (RTP_FLAG_*)
- */
-typedef int (*DynamicPayloadPacketHandlerProc) (AVFormatContext *ctx,
-                                                PayloadContext *s,
-                                                AVStream *st,
-                                                AVPacket * pkt,
-                                                uint32_t *timestamp,
-                                                const uint8_t * buf,
-                                                int len, int flags);
-
-struct RTPDynamicProtocolHandler_s {
-    // fields from AVRtpDynamicPayloadType_s
-    const char enc_name[50];    /* XXX: still why 50 ? ;-) */
-    enum AVMediaType codec_type;
-    enum CodecID codec_id;
-
-    // may be null
-    int (*parse_sdp_a_line) (AVFormatContext *s,
-                             int st_index,
-                             PayloadContext *priv_data,
-                             const char *line); ///< Parse the a= line from the sdp field
-    PayloadContext *(*open) (void); ///< allocate any data needed by the rtp parsing for this dynamic data.
-    void (*close)(PayloadContext *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data.
-    DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet.
-
-    struct RTPDynamicProtocolHandler_s *next;
-};
-
-// moved out of rtp.c, because the h264 decoder needs to know about this structure..
-struct RTPDemuxContext {
-    AVFormatContext *ic;
-    AVStream *st;
-    int payload_type;
-    uint32_t ssrc;
-    uint16_t seq;
-    uint32_t timestamp;
-    uint32_t base_timestamp;
-    uint32_t cur_timestamp;
-    int64_t  range_start_offset;
-    int max_payload_size;
-    struct MpegTSContext *ts;   /* only used for MP2T payloads */
-    int read_buf_index;
-    int read_buf_size;
-    /* used to send back RTCP RR */
-    URLContext *rtp_ctx;
-    char hostname[256];
-
-    RTPStatistics statistics; ///< Statistics for this stream (used by RTCP receiver reports)
-
-    /* rtcp sender statistics receive */
-    int64_t last_rtcp_ntp_time;    // TODO: move into statistics
-    int64_t first_rtcp_ntp_time;   // TODO: move into statistics
-    uint32_t last_rtcp_timestamp;  // TODO: move into statistics
-
-    /* rtcp sender statistics */
-    unsigned int packet_count;     // TODO: move into statistics (outgoing)
-    unsigned int octet_count;      // TODO: move into statistics (outgoing)
-    unsigned int last_octet_count; // TODO: move into statistics (outgoing)
-    int first_packet;
-    /* buffer for output */
-    uint8_t buf[RTP_MAX_PACKET_LENGTH];
-    uint8_t *buf_ptr;
-
-    /* special infos for au headers parsing */
-    RTPPayloadData *rtp_payload_data; // TODO: Move into dynamic payload handlers
-
-    /* dynamic payload stuff */
-    DynamicPayloadPacketHandlerProc parse_packet;     ///< This is also copied from the dynamic protocol handler structure
-    PayloadContext *dynamic_protocol_context;        ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me.
-    int max_frames_per_packet;
-};
-
-extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
-void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler);
-
-int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size); ///< from rtsp.c, but used by rtp dynamic protocol handlers.
-
-void av_register_rtp_dynamic_payload_handlers(void);
-
-#endif /* AVFORMAT_RTPDEC_H */
diff --git a/libavformat/rtpdec_amr.c b/libavformat/rtpdec_amr.c
deleted file mode 100644
index a7b36c7..0000000
--- a/libavformat/rtpdec_amr.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * RTP AMR Depacketizer, RFC 3267
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "rtpdec_amr.h"
-#include "libavutil/avstring.h"
-
-static const uint8_t frame_sizes_nb[16] = {
-    12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0
-};
-static const uint8_t frame_sizes_wb[16] = {
-    17, 23, 32, 36, 40, 46, 50, 58, 60, 5, 5, 0, 0, 0, 0, 0
-};
-
-static int amr_handle_packet(AVFormatContext *ctx,
-                             PayloadContext *data,
-                             AVStream *st,
-                             AVPacket * pkt,
-                             uint32_t * timestamp,
-                             const uint8_t * buf,
-                             int len, int flags)
-{
-    const uint8_t *frame_sizes = NULL;
-    int frames;
-    int i;
-    const uint8_t *speech_data;
-    uint8_t *ptr;
-
-    if (st->codec->codec_id == CODEC_ID_AMR_NB) {
-        frame_sizes = frame_sizes_nb;
-    } else if (st->codec->codec_id == CODEC_ID_AMR_WB) {
-        frame_sizes = frame_sizes_wb;
-    } else {
-        av_log(ctx, AV_LOG_ERROR, "Bad codec ID\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    if (st->codec->channels != 1) {
-        av_log(ctx, AV_LOG_ERROR, "Only mono AMR is supported\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    /* The AMR RTP packet consists of one header byte, followed
-     * by one TOC byte for each AMR frame in the packet, followed
-     * by the speech data for all the AMR frames.
-     *
-     * The header byte contains only a codec mode request, for
-     * requesting what kind of AMR data the sender wants to
-     * receive. Not used at the moment.
-     */
-
-    /* Count the number of frames in the packet. The highest bit
-     * is set in a TOC byte if there are more frames following.
-     */
-    for (frames = 1; frames < len && (buf[frames] & 0x80); frames++) ;
-
-    if (1 + frames >= len) {
-        /* We hit the end of the packet while counting frames. */
-        av_log(ctx, AV_LOG_ERROR, "No speech data found\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    speech_data = buf + 1 + frames;
-
-    /* Everything except the codec mode request byte should be output. */
-    if (av_new_packet(pkt, len - 1)) {
-        av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
-        return AVERROR(ENOMEM);
-    }
-    pkt->stream_index = st->index;
-    ptr = pkt->data;
-
-    for (i = 0; i < frames; i++) {
-        uint8_t toc = buf[1 + i];
-        int frame_size = frame_sizes[(toc >> 3) & 0x0f];
-
-        if (speech_data + frame_size > buf + len) {
-            /* Too little speech data */
-            av_log(ctx, AV_LOG_WARNING, "Too little speech data in the RTP packet\n");
-            /* Set the unwritten part of the packet to zero. */
-            memset(ptr, 0, pkt->data + pkt->size - ptr);
-            pkt->size = ptr - pkt->data;
-            return 0;
-        }
-
-        /* Extract the AMR frame mode from the TOC byte */
-        *ptr++ = toc & 0x7C;
-
-        /* Copy the speech data */
-        memcpy(ptr, speech_data, frame_size);
-        speech_data += frame_size;
-        ptr += frame_size;
-    }
-
-    if (speech_data < buf + len) {
-        av_log(ctx, AV_LOG_WARNING, "Too much speech data in the RTP packet?\n");
-        /* Set the unwritten part of the packet to zero. */
-        memset(ptr, 0, pkt->data + pkt->size - ptr);
-        pkt->size = ptr - pkt->data;
-    }
-
-    return 0;
-}
-
-static int amr_parse_sdp_line(AVFormatContext *s, int st_index,
-                              PayloadContext *data, const char *line)
-{
-    const char *p;
-    char attr[25], value[25];
-
-    /* Parse an fmtp line this one:
-     * a=fmtp:97 octet-align=1; interleaving=0
-     * That is, a normal fmtp: line followed by semicolon & space
-     * separated key/value pairs.
-     */
-    if (av_strstart(line, "fmtp:", &p)) {
-        int octet_align = 0;
-        int crc = 0;
-        int interleaving = 0;
-        int channels = 1;
-
-        while (*p && *p == ' ') p++; /* strip spaces */
-        while (*p && *p != ' ') p++; /* eat protocol identifier */
-        while (*p && *p == ' ') p++; /* strip trailing spaces */
-
-        while (ff_rtsp_next_attr_and_value(&p, attr, sizeof(attr), value, sizeof(value))) {
-            /* Some AMR SDP configurations contain "octet-align", without
-             * the trailing =1. Therefore, if the value is empty,
-             * interpret it as "1".
-             */
-            if (!strcmp(value, "")) {
-                av_log(s, AV_LOG_WARNING, "AMR fmtp attribute %s had "
-                                          "nonstandard empty value\n", attr);
-                strcpy(value, "1");
-            }
-            if (!strcmp(attr, "octet-align"))
-                octet_align = atoi(value);
-            else if (!strcmp(attr, "crc"))
-                crc = atoi(value);
-            else if (!strcmp(attr, "interleaving"))
-                interleaving = atoi(value);
-            else if (!strcmp(attr, "channels"))
-                channels = atoi(value);
-        }
-        if (!octet_align || crc || interleaving || channels != 1) {
-            av_log(s, AV_LOG_ERROR, "Unsupported RTP/AMR configuration!\n");
-            return -1;
-        }
-    }
-    return 0;
-}
-
-RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler = {
-    .enc_name         = "AMR",
-    .codec_type       = AVMEDIA_TYPE_AUDIO,
-    .codec_id         = CODEC_ID_AMR_NB,
-    .parse_sdp_a_line = amr_parse_sdp_line,
-    .parse_packet     = amr_handle_packet,
-};
-
-RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler = {
-    .enc_name         = "AMR-WB",
-    .codec_type       = AVMEDIA_TYPE_AUDIO,
-    .codec_id         = CODEC_ID_AMR_WB,
-    .parse_sdp_a_line = amr_parse_sdp_line,
-    .parse_packet     = amr_handle_packet,
-};
-
diff --git a/libavformat/rtpdec_amr.h b/libavformat/rtpdec_amr.h
deleted file mode 100644
index 3cd9dd1..0000000
--- a/libavformat/rtpdec_amr.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * RTP AMR Depacketizer, RFC 3267
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTPDEC_AMR_H
-#define AVFORMAT_RTPDEC_AMR_H
-
-#include "rtpdec.h"
-
-extern RTPDynamicProtocolHandler ff_amr_nb_dynamic_handler;
-extern RTPDynamicProtocolHandler ff_amr_wb_dynamic_handler;
-
-#endif /* AVFORMAT_RTPDEC_AMR_H */
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
deleted file mode 100644
index 7ca15f0..0000000
--- a/libavformat/rtpdec_asf.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Microsoft RTP/ASF support.
- * Copyright (c) 2008 Ronald S. Bultje
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Microsoft RTP/ASF support
- * @author Ronald S. Bultje <rbultje at ronald.bitfreak.net>
- */
-
-#include <libavutil/base64.h>
-#include <libavutil/avstring.h>
-#include <libavutil/intreadwrite.h>
-#include "rtp.h"
-#include "rtpdec_asf.h"
-#include "rtsp.h"
-#include "asf.h"
-
-/**
- * From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not
- * contain any padding. Unfortunately, the header min/max_pktsize are not
- * updated (thus making min_pktsize invalid). Here, we "fix" these faulty
- * min_pktsize values in the ASF file header.
- * @return 0 on success, <0 on failure (currently -1).
- */
-static int rtp_asf_fix_header(uint8_t *buf, int len)
-{
-    uint8_t *p = buf, *end = buf + len;
-
-    if (len < sizeof(ff_asf_guid) * 2 + 22 ||
-        memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) {
-        return -1;
-    }
-    p += sizeof(ff_asf_guid) + 14;
-    do {
-        uint64_t chunksize = AV_RL64(p + sizeof(ff_asf_guid));
-        if (memcmp(p, ff_asf_file_header, sizeof(ff_asf_guid))) {
-            if (chunksize > end - p)
-                return -1;
-            p += chunksize;
-            continue;
-        }
-
-        /* skip most of the file header, to min_pktsize */
-        p += 6 * 8 + 3 * 4 + sizeof(ff_asf_guid) * 2;
-        if (p + 8 <= end && AV_RL32(p) == AV_RL32(p + 4)) {
-            /* and set that to zero */
-            AV_WL32(p, 0);
-            return 0;
-        }
-        break;
-    } while (end - p >= sizeof(ff_asf_guid) + 8);
-
-    return -1;
-}
-
-/**
- * The following code is basically a buffered ByteIOContext,
- * with the added benefit of returning -EAGAIN (instead of 0)
- * on packet boundaries, such that the ASF demuxer can return
- * safely and resume business at the next packet.
- */
-static int packetizer_read(void *opaque, uint8_t *buf, int buf_size)
-{
-    return AVERROR(EAGAIN);
-}
-
-static void init_packetizer(ByteIOContext *pb, uint8_t *buf, int len)
-{
-    init_put_byte(pb, buf, len, 0, NULL, packetizer_read, NULL, NULL);
-
-    /* this "fills" the buffer with its current content */
-    pb->pos     = len;
-    pb->buf_end = buf + len;
-}
-
-void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
-{
-    if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
-        ByteIOContext pb;
-        RTSPState *rt = s->priv_data;
-        int len = strlen(p) * 6 / 8;
-        char *buf = av_mallocz(len);
-        av_base64_decode(buf, p, len);
-
-        if (rtp_asf_fix_header(buf, len) < 0)
-            av_log(s, AV_LOG_ERROR,
-                   "Failed to fix invalid RTSP-MS/ASF min_pktsize\n");
-        init_packetizer(&pb, buf, len);
-        if (rt->asf_ctx) {
-            av_close_input_stream(rt->asf_ctx);
-            rt->asf_ctx = NULL;
-        }
-        av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL);
-        rt->asf_pb_pos = url_ftell(&pb);
-        av_free(buf);
-        rt->asf_ctx->pb = NULL;
-    }
-}
-
-static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index,
-                                 PayloadContext *asf, const char *line)
-{
-    if (av_strstart(line, "stream:", &line)) {
-        RTSPState *rt = s->priv_data;
-
-        s->streams[stream_index]->id = strtol(line, NULL, 10);
-
-        if (rt->asf_ctx) {
-            int i;
-
-            for (i = 0; i < rt->asf_ctx->nb_streams; i++) {
-                if (s->streams[stream_index]->id == rt->asf_ctx->streams[i]->id) {
-                    *s->streams[stream_index]->codec =
-                        *rt->asf_ctx->streams[i]->codec;
-                    rt->asf_ctx->streams[i]->codec->extradata_size = 0;
-                    rt->asf_ctx->streams[i]->codec->extradata = NULL;
-                    av_set_pts_info(s->streams[stream_index], 32, 1, 1000);
-                }
-           }
-        }
-    }
-
-    return 0;
-}
-
-struct PayloadContext {
-    ByteIOContext *pktbuf, pb;
-    char *buf;
-};
-
-/**
- * @return 0 when a packet was written into /p pkt, and no more data is left;
- *         1 when a packet was written into /p pkt, and more packets might be left;
- *        <0 when not enough data was provided to return a full packet, or on error.
- */
-static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
-                               AVStream *st, AVPacket *pkt,
-                               uint32_t *timestamp,
-                               const uint8_t *buf, int len, int flags)
-{
-    ByteIOContext *pb = &asf->pb;
-    int res, mflags, len_off;
-    RTSPState *rt = s->priv_data;
-
-    if (!rt->asf_ctx)
-        return -1;
-
-    if (len > 0) {
-        int off, out_len;
-
-        if (len < 4)
-            return -1;
-
-        init_put_byte(pb, buf, len, 0, NULL, NULL, NULL, NULL);
-        mflags = get_byte(pb);
-        if (mflags & 0x80)
-            flags |= RTP_FLAG_KEY;
-        len_off = get_be24(pb);
-        if (mflags & 0x20)   /**< relative timestamp */
-            url_fskip(pb, 4);
-        if (mflags & 0x10)   /**< has duration */
-            url_fskip(pb, 4);
-        if (mflags & 0x8)    /**< has location ID */
-            url_fskip(pb, 4);
-        off = url_ftell(pb);
-
-        av_freep(&asf->buf);
-        if (!(mflags & 0x40)) {
-            /**
-             * If 0x40 is not set, the len_off field specifies an offset of this
-             * packet's payload data in the complete (reassembled) ASF packet.
-             * This is used to spread one ASF packet over multiple RTP packets.
-             */
-            if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) {
-                uint8_t *p;
-                url_close_dyn_buf(asf->pktbuf, &p);
-                asf->pktbuf = NULL;
-                av_free(p);
-            }
-            if (!len_off && !asf->pktbuf &&
-                (res = url_open_dyn_buf(&asf->pktbuf)) < 0)
-                return res;
-            if (!asf->pktbuf)
-                return AVERROR(EIO);
-
-            put_buffer(asf->pktbuf, buf + off, len - off);
-            if (!(flags & RTP_FLAG_MARKER))
-                return -1;
-            out_len     = url_close_dyn_buf(asf->pktbuf, &asf->buf);
-            asf->pktbuf = NULL;
-        } else {
-            /**
-             * If 0x40 is set, the len_off field specifies the length of the
-             * next ASF packet that can be read from this payload data alone.
-             * This is commonly the same as the payload size, but could be
-             * less in case of packet splitting (i.e. multiple ASF packets in
-             * one RTP packet).
-             */
-            if (len_off != len) {
-                av_log_missing_feature(s,
-                    "RTSP-MS packet splitting", 1);
-                return -1;
-            }
-            asf->buf = av_malloc(len - off);
-            out_len  = len - off;
-            memcpy(asf->buf, buf + off, len - off);
-        }
-
-        init_packetizer(pb, asf->buf, out_len);
-        pb->pos += rt->asf_pb_pos;
-        pb->eof_reached = 0;
-        rt->asf_ctx->pb = pb;
-    }
-
-    for (;;) {
-        int i;
-
-        res = av_read_packet(rt->asf_ctx, pkt);
-        rt->asf_pb_pos = url_ftell(pb);
-        if (res != 0)
-            break;
-        for (i = 0; i < s->nb_streams; i++) {
-            if (s->streams[i]->id == rt->asf_ctx->streams[pkt->stream_index]->id) {
-                pkt->stream_index = i;
-                return 1; // FIXME: return 0 if last packet
-            }
-        }
-        av_free_packet(pkt);
-    }
-
-    return res == 1 ? -1 : res;
-}
-
-static PayloadContext *asfrtp_new_context(void)
-{
-    return av_mallocz(sizeof(PayloadContext));
-}
-
-static void asfrtp_free_context(PayloadContext *asf)
-{
-    if (asf->pktbuf) {
-        uint8_t *p = NULL;
-        url_close_dyn_buf(asf->pktbuf, &p);
-        asf->pktbuf = NULL;
-        av_free(p);
-    }
-    av_freep(&asf->buf);
-    av_free(asf);
-}
-
-#define RTP_ASF_HANDLER(n, s, t) \
-RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
-    .enc_name         = s, \
-    .codec_type       = t, \
-    .codec_id         = CODEC_ID_NONE, \
-    .parse_sdp_a_line = asfrtp_parse_sdp_line, \
-    .open             = asfrtp_new_context, \
-    .close            = asfrtp_free_context, \
-    .parse_packet     = asfrtp_parse_packet,   \
-};
-
-RTP_ASF_HANDLER(asf_pfv, "x-asf-pf",  AVMEDIA_TYPE_VIDEO);
-RTP_ASF_HANDLER(asf_pfa, "x-asf-pf",  AVMEDIA_TYPE_AUDIO);
diff --git a/libavformat/rtpdec_asf.h b/libavformat/rtpdec_asf.h
deleted file mode 100644
index 5d60a14..0000000
--- a/libavformat/rtpdec_asf.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Microsoft RTP/ASF support.
- * Copyright (c) 2008 Ronald S. Bultje
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTPDEC_ASF_H
-#define AVFORMAT_RTPDEC_ASF_H
-
-#include "avformat.h"
-#include "rtpdec.h"
-
-/**
- * Parse a Windows Media Server-specific SDP line
- *
- * @param s RTSP demux context
- * @param line the SDP line to be parsed
- */
-void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p);
-
-/**
- * Handlers for the x-asf-pf payloads (the payload ID for RTP/ASF).
- * Defined and implemented in rtp_asf.c, registered in rtpdec.c.
- */
-extern RTPDynamicProtocolHandler ff_ms_rtp_asf_pfv_handler,
-                                 ff_ms_rtp_asf_pfa_handler;
-
-#endif /* AVFORMAT_RTPDEC_ASF_H */
diff --git a/libavformat/rtpdec_h263.c b/libavformat/rtpdec_h263.c
deleted file mode 100644
index 19de6ec..0000000
--- a/libavformat/rtpdec_h263.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * RTP H.263 Depacketizer, RFC 4629
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "rtpdec_h263.h"
-#include "libavutil/intreadwrite.h"
-
-static int h263_handle_packet(AVFormatContext *ctx,
-                              PayloadContext *data,
-                              AVStream *st,
-                              AVPacket * pkt,
-                              uint32_t * timestamp,
-                              const uint8_t * buf,
-                              int len, int flags)
-{
-    uint8_t *ptr;
-    uint16_t header;
-    int startcode, vrc, picture_header;
-
-    if (len < 2) {
-        av_log(ctx, AV_LOG_ERROR, "Too short H.263 RTP packet\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    /* Decode the 16 bit H.263+ payload header, as described in section
-     * 5.1 of RFC 4629. The fields of this header are:
-     * - 5 reserved bits, should be ignored.
-     * - One bit (P, startcode), indicating a picture start, picture segment
-     *   start or video sequence end. If set, two zero bytes should be
-     *   prepended to the payload.
-     * - One bit (V, vrc), indicating the presence of an 8 bit Video
-     *   Redundancy Coding field after this 16 bit header.
-     * - 6 bits (PLEN, picture_header), the length (in bytes) of an extra
-     *   picture header, following the VRC field.
-     * - 3 bits (PEBIT), the number of bits to ignore of the last byte
-     *   of the extra picture header. (Not used at the moment.)
-     */
-    header = AV_RB16(buf);
-    startcode      = (header & 0x0400) >> 9;
-    vrc            =  header & 0x0200;
-    picture_header = (header & 0x01f8) >> 3;
-    buf += 2;
-    len -= 2;
-
-    if (vrc) {
-        /* Skip VRC header if present, not used at the moment. */
-        buf += 1;
-        len -= 1;
-    }
-    if (picture_header) {
-        /* Skip extra picture header if present, not used at the moment. */
-        buf += picture_header;
-        len -= picture_header;
-    }
-
-    if (len < 0) {
-        av_log(ctx, AV_LOG_ERROR, "Too short H.263 RTP packet\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    if (av_new_packet(pkt, len + startcode)) {
-        av_log(ctx, AV_LOG_ERROR, "Out of memory\n");
-        return AVERROR(ENOMEM);
-    }
-    pkt->stream_index = st->index;
-    ptr = pkt->data;
-
-    if (startcode) {
-        *ptr++ = 0;
-        *ptr++ = 0;
-    }
-    memcpy(ptr, buf, len);
-
-    return 0;
-}
-
-RTPDynamicProtocolHandler ff_h263_1998_dynamic_handler = {
-    .enc_name         = "H263-1998",
-    .codec_type       = AVMEDIA_TYPE_VIDEO,
-    .codec_id         = CODEC_ID_H263,
-    .parse_packet     = h263_handle_packet,
-};
-
-RTPDynamicProtocolHandler ff_h263_2000_dynamic_handler = {
-    .enc_name         = "H263-2000",
-    .codec_type       = AVMEDIA_TYPE_VIDEO,
-    .codec_id         = CODEC_ID_H263,
-    .parse_packet     = h263_handle_packet,
-};
-
diff --git a/libavformat/rtpdec_h263.h b/libavformat/rtpdec_h263.h
deleted file mode 100644
index 5b51128..0000000
--- a/libavformat/rtpdec_h263.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * RTP H.263 Depacketizer, RFC 4629
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTPDEC_H263_H
-#define AVFORMAT_RTPDEC_H263_H
-
-#include "rtpdec.h"
-
-extern RTPDynamicProtocolHandler ff_h263_1998_dynamic_handler;
-extern RTPDynamicProtocolHandler ff_h263_2000_dynamic_handler;
-
-#endif /* AVFORMAT_RTPDEC_H263_H */
diff --git a/libavformat/rtpdec_h264.c b/libavformat/rtpdec_h264.c
deleted file mode 100644
index d690173..0000000
--- a/libavformat/rtpdec_h264.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * RTP H264 Protocol (RFC3984)
- * Copyright (c) 2006 Ryan Martell
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
-* @file
- * @brief H.264 / RTP Code (RFC3984)
- * @author Ryan Martell <rdm4 at martellventures.com>
- *
- * @note Notes:
- * Notes:
- * This currently supports packetization mode:
- * Single Nal Unit Mode (0), or
- * Non-Interleaved Mode (1).  It currently does not support
- * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types)
- *
- * @note TODO:
- * 1) RTCP sender reports for udp streams are required..
- *
- */
-
-#include "libavutil/base64.h"
-#include "libavutil/avstring.h"
-#include "libavcodec/get_bits.h"
-#include "avformat.h"
-#include "mpegts.h"
-
-#include <unistd.h>
-#include "network.h"
-#include <assert.h>
-
-#include "rtpdec.h"
-#include "rtpdec_h264.h"
-
-/**
-    RTP/H264 specific private data.
-*/
-struct PayloadContext {
-    unsigned long cookie;       ///< sanity check, to make sure we get the pointer we're expecting.
-
-    //sdp setup parameters
-    uint8_t profile_idc;        ///< from the sdp setup parameters.
-    uint8_t profile_iop;        ///< from the sdp setup parameters.
-    uint8_t level_idc;          ///< from the sdp setup parameters.
-    int packetization_mode;     ///< from the sdp setup parameters.
-#ifdef DEBUG
-    int packet_types_received[32];
-#endif
-};
-
-#define MAGIC_COOKIE (0xdeadbeef)       ///< Cookie for the extradata; to verify we are what we think we are, and that we haven't been freed.
-#define DEAD_COOKIE (0xdeaddead)        ///< Cookie for the extradata; once it is freed.
-
-/* ---------------- private code */
-static void sdp_parse_fmtp_config_h264(AVStream * stream,
-                                       PayloadContext * h264_data,
-                                       char *attr, char *value)
-{
-    AVCodecContext *codec = stream->codec;
-    assert(codec->codec_id == CODEC_ID_H264);
-    assert(h264_data != NULL);
-
-    if (!strcmp(attr, "packetization-mode")) {
-        av_log(codec, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value));
-        h264_data->packetization_mode = atoi(value);
-        /*
-           Packetization Mode:
-           0 or not present: Single NAL mode (Only nals from 1-23 are allowed)
-           1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.
-           2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed.
-         */
-        if (h264_data->packetization_mode > 1)
-            av_log(codec, AV_LOG_ERROR,
-                   "Interleaved RTP mode is not supported yet.");
-    } else if (!strcmp(attr, "profile-level-id")) {
-        if (strlen(value) == 6) {
-            char buffer[3];
-            // 6 characters=3 bytes, in hex.
-            uint8_t profile_idc;
-            uint8_t profile_iop;
-            uint8_t level_idc;
-
-            buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0';
-            profile_idc = strtol(buffer, NULL, 16);
-            buffer[0] = value[2]; buffer[1] = value[3];
-            profile_iop = strtol(buffer, NULL, 16);
-            buffer[0] = value[4]; buffer[1] = value[5];
-            level_idc = strtol(buffer, NULL, 16);
-
-            // set the parameters...
-            av_log(codec, AV_LOG_DEBUG,
-                   "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
-                   profile_idc, profile_iop, level_idc);
-            h264_data->profile_idc = profile_idc;
-            h264_data->profile_iop = profile_iop;
-            h264_data->level_idc = level_idc;
-        }
-    } else  if (!strcmp(attr, "sprop-parameter-sets")) {
-        uint8_t start_sequence[]= { 0, 0, 1 };
-        codec->extradata_size= 0;
-        codec->extradata= NULL;
-
-        while (*value) {
-            char base64packet[1024];
-            uint8_t decoded_packet[1024];
-            uint32_t packet_size;
-            char *dst = base64packet;
-
-            while (*value && *value != ','
-                   && (dst - base64packet) < sizeof(base64packet) - 1) {
-                *dst++ = *value++;
-            }
-            *dst++ = '\0';
-
-            if (*value == ',')
-                value++;
-
-            packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));
-            if (packet_size) {
-                uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +
-                                         codec->extradata_size +
-                                         FF_INPUT_BUFFER_PADDING_SIZE);
-                if(dest)
-                {
-                    if(codec->extradata_size)
-                    {
-                        // av_realloc?
-                        memcpy(dest, codec->extradata, codec->extradata_size);
-                        av_free(codec->extradata);
-                    }
-
-                    memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));
-                    memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
-                    memset(dest+codec->extradata_size+sizeof(start_sequence)+
-                           packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
-                    codec->extradata= dest;
-                    codec->extradata_size+= sizeof(start_sequence)+packet_size;
-                } else {
-                    av_log(codec, AV_LOG_ERROR, "Unable to allocate memory for extradata!");
-                }
-            }
-        }
-        av_log(codec, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size);
-    }
-}
-
-// return 0 on packet, no more left, 1 on packet, 1 on partial packet...
-static int h264_handle_packet(AVFormatContext *ctx,
-                              PayloadContext *data,
-                              AVStream *st,
-                              AVPacket * pkt,
-                              uint32_t * timestamp,
-                              const uint8_t * buf,
-                              int len, int flags)
-{
-    uint8_t nal = buf[0];
-    uint8_t type = (nal & 0x1f);
-    int result= 0;
-    uint8_t start_sequence[]= {0, 0, 1};
-
-#ifdef DEBUG
-    assert(data);
-    assert(data->cookie == MAGIC_COOKIE);
-#endif
-    assert(buf);
-
-    if (type >= 1 && type <= 23)
-        type = 1;              // simplify the case. (these are all the nal types used internally by the h264 codec)
-    switch (type) {
-    case 0:                    // undefined;
-        result= -1;
-        break;
-
-    case 1:
-        av_new_packet(pkt, len+sizeof(start_sequence));
-        memcpy(pkt->data, start_sequence, sizeof(start_sequence));
-        memcpy(pkt->data+sizeof(start_sequence), buf, len);
-#ifdef DEBUG
-        data->packet_types_received[nal & 0x1f]++;
-#endif
-        break;
-
-    case 24:                   // STAP-A (one packet, multiple nals)
-        // consume the STAP-A NAL
-        buf++;
-        len--;
-        // first we are going to figure out the total size....
-        {
-            int pass= 0;
-            int total_length= 0;
-            uint8_t *dst= NULL;
-
-            for(pass= 0; pass<2; pass++) {
-                const uint8_t *src= buf;
-                int src_len= len;
-
-                do {
-                    uint16_t nal_size = AV_RB16(src); // this going to be a problem if unaligned (can it be?)
-
-                    // consume the length of the aggregate...
-                    src += 2;
-                    src_len -= 2;
-
-                    if (nal_size <= src_len) {
-                        if(pass==0) {
-                            // counting...
-                            total_length+= sizeof(start_sequence)+nal_size;
-                        } else {
-                            // copying
-                            assert(dst);
-                            memcpy(dst, start_sequence, sizeof(start_sequence));
-                            dst+= sizeof(start_sequence);
-                            memcpy(dst, src, nal_size);
-#ifdef DEBUG
-                            data->packet_types_received[*src & 0x1f]++;
-#endif
-                            dst+= nal_size;
-                        }
-                    } else {
-                        av_log(ctx, AV_LOG_ERROR,
-                               "nal size exceeds length: %d %d\n", nal_size, src_len);
-                    }
-
-                    // eat what we handled...
-                    src += nal_size;
-                    src_len -= nal_size;
-
-                    if (src_len < 0)
-                        av_log(ctx, AV_LOG_ERROR,
-                               "Consumed more bytes than we got! (%d)\n", src_len);
-                } while (src_len > 2);      // because there could be rtp padding..
-
-                if(pass==0) {
-                    // now we know the total size of the packet (with the start sequences added)
-                    av_new_packet(pkt, total_length);
-                    dst= pkt->data;
-                } else {
-                    assert(dst-pkt->data==total_length);
-                }
-            }
-        }
-        break;
-
-    case 25:                   // STAP-B
-    case 26:                   // MTAP-16
-    case 27:                   // MTAP-24
-    case 29:                   // FU-B
-        av_log(ctx, AV_LOG_ERROR,
-               "Unhandled type (%d) (See RFC for implementation details\n",
-               type);
-        result= -1;
-        break;
-
-    case 28:                   // FU-A (fragmented nal)
-        buf++;
-        len--;                  // skip the fu_indicator
-        {
-            // these are the same as above, we just redo them here for clarity...
-            uint8_t fu_indicator = nal;
-            uint8_t fu_header = *buf;   // read the fu_header.
-            uint8_t start_bit = fu_header >> 7;
-//            uint8_t end_bit = (fu_header & 0x40) >> 6;
-            uint8_t nal_type = (fu_header & 0x1f);
-            uint8_t reconstructed_nal;
-
-            // reconstruct this packet's true nal; only the data follows..
-            reconstructed_nal = fu_indicator & (0xe0);  // the original nal forbidden bit and NRI are stored in this packet's nal;
-            reconstructed_nal |= nal_type;
-
-            // skip the fu_header...
-            buf++;
-            len--;
-
-#ifdef DEBUG
-            if (start_bit)
-                data->packet_types_received[nal_type]++;
-#endif
-            if(start_bit) {
-                // copy in the start sequence, and the reconstructed nal....
-                av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len);
-                memcpy(pkt->data, start_sequence, sizeof(start_sequence));
-                pkt->data[sizeof(start_sequence)]= reconstructed_nal;
-                memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len);
-            } else {
-                av_new_packet(pkt, len);
-                memcpy(pkt->data, buf, len);
-            }
-        }
-        break;
-
-    case 30:                   // undefined
-    case 31:                   // undefined
-    default:
-        av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)", type);
-        result= -1;
-        break;
-    }
-
-    pkt->stream_index = st->index;
-
-    return result;
-}
-
-/* ---------------- public code */
-static PayloadContext *h264_new_context(void)
-{
-    PayloadContext *data =
-        av_mallocz(sizeof(PayloadContext) +
-                   FF_INPUT_BUFFER_PADDING_SIZE);
-
-    if (data) {
-        data->cookie = MAGIC_COOKIE;
-    }
-
-    return data;
-}
-
-static void h264_free_context(PayloadContext *data)
-{
-#ifdef DEBUG
-    int ii;
-
-    for (ii = 0; ii < 32; ii++) {
-        if (data->packet_types_received[ii])
-            av_log(NULL, AV_LOG_DEBUG, "Received %d packets of type %d\n",
-                   data->packet_types_received[ii], ii);
-    }
-#endif
-
-    assert(data);
-    assert(data->cookie == MAGIC_COOKIE);
-
-    // avoid stale pointers (assert)
-    data->cookie = DEAD_COOKIE;
-
-    // and clear out this...
-    av_free(data);
-}
-
-static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
-                               PayloadContext *h264_data, const char *line)
-{
-    AVStream *stream = s->streams[st_index];
-    AVCodecContext *codec = stream->codec;
-    const char *p = line;
-
-    assert(h264_data->cookie == MAGIC_COOKIE);
-
-    if (av_strstart(p, "framesize:", &p)) {
-        char buf1[50];
-        char *dst = buf1;
-
-        // remove the protocol identifier..
-        while (*p && *p == ' ') p++; // strip spaces.
-        while (*p && *p != ' ') p++; // eat protocol identifier
-        while (*p && *p == ' ') p++; // strip trailing spaces.
-        while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) {
-            *dst++ = *p++;
-        }
-        *dst = '\0';
-
-        // a='framesize:96 320-240'
-        // set our parameters..
-        codec->width = atoi(buf1);
-        codec->height = atoi(p + 1); // skip the -
-        codec->pix_fmt = PIX_FMT_YUV420P;
-    } else if (av_strstart(p, "fmtp:", &p)) {
-        char attr[256];
-        char value[4096];
-
-        // remove the protocol identifier..
-        while (*p && *p == ' ') p++; // strip spaces.
-        while (*p && *p != ' ') p++; // eat protocol identifier
-        while (*p && *p == ' ') p++; // strip trailing spaces.
-
-        /* loop on each attribute */
-        while (ff_rtsp_next_attr_and_value
-               (&p, attr, sizeof(attr), value, sizeof(value))) {
-            /* grab the codec extra_data from the config parameter of the fmtp line */
-            sdp_parse_fmtp_config_h264(stream, h264_data, attr, value);
-        }
-    } else if (av_strstart(p, "cliprect:", &p)) {
-        // could use this if we wanted.
-    }
-
-    av_set_pts_info(stream, 33, 1, 90000);      // 33 should be right, because the pts is 64 bit? (done elsewhere; this is a one time thing)
-
-    return 0;                   // keep processing it the normal way...
-}
-
-/**
-This is the structure for expanding on the dynamic rtp protocols (makes everything static. yay!)
-*/
-RTPDynamicProtocolHandler ff_h264_dynamic_handler = {
-    .enc_name         = "H264",
-    .codec_type       = AVMEDIA_TYPE_VIDEO,
-    .codec_id         = CODEC_ID_H264,
-    .parse_sdp_a_line = parse_h264_sdp_line,
-    .open             = h264_new_context,
-    .close            = h264_free_context,
-    .parse_packet     = h264_handle_packet
-};
diff --git a/libavformat/rtpdec_h264.h b/libavformat/rtpdec_h264.h
deleted file mode 100644
index b4d54de..0000000
--- a/libavformat/rtpdec_h264.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * RTP H264 Protocol (RFC3984)
- * Copyright (c) 2006 Ryan Martell
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTPDEC_H264_H
-#define AVFORMAT_RTPDEC_H264_H
-
-#include "rtpdec.h"
-
-extern RTPDynamicProtocolHandler ff_h264_dynamic_handler;
-
-#endif /* AVFORMAT_RTPDEC_H264_H */
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
deleted file mode 100644
index 9a1f33d..0000000
--- a/libavformat/rtpdec_xiph.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * Xiph RTP Protocols
- * Copyright (c) 2009 Colin McQuillian
- * Copyright (c) 2010 Josh Allmann
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Xiph / RTP Code
- * @author Colin McQuillan <m.niloc at gmail.com>
- * @author Josh Allmann <joshua.allmann at gmail.com>
- */
-
-#include "libavutil/avstring.h"
-#include "libavutil/base64.h"
-#include "libavcodec/bytestream.h"
-
-#include <assert.h>
-
-#include "rtpdec.h"
-#include "rtpdec_xiph.h"
-
-/**
- * RTP/Xiph specific private data.
- */
-struct PayloadContext {
-    unsigned ident;             ///< 24-bit stream configuration identifier
-    uint32_t timestamp;
-    ByteIOContext* fragment;    ///< buffer for split payloads
-};
-
-static PayloadContext *xiph_new_context(void)
-{
-    return av_mallocz(sizeof(PayloadContext));
-}
-
-static inline void free_fragment_if_needed(PayloadContext * data)
-{
-    if (data->fragment) {
-        uint8_t* p;
-        url_close_dyn_buf(data->fragment, &p);
-        av_free(p);
-        data->fragment = NULL;
-    }
-}
-
-static void xiph_free_context(PayloadContext * data)
-{
-    free_fragment_if_needed(data);
-    av_free(data);
-}
-
-static int xiph_handle_packet(AVFormatContext * ctx,
-                              PayloadContext * data,
-                              AVStream * st,
-                              AVPacket * pkt,
-                              uint32_t * timestamp,
-                              const uint8_t * buf, int len, int flags)
-{
-
-    int ident, fragmented, tdt, num_pkts, pkt_len;
-
-    if (len < 6) {
-        av_log(ctx, AV_LOG_ERROR, "Invalid %d byte packet\n", len);
-        return AVERROR_INVALIDDATA;
-    }
-
-    // read xiph rtp headers
-    ident       = AV_RB24(buf);
-    fragmented  = buf[3] >> 6;
-    tdt         = (buf[3] >> 4) & 3;
-    num_pkts    = buf[3] & 7;
-    pkt_len     = AV_RB16(buf + 4);
-
-    if (pkt_len > len - 6) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Invalid packet length %d in %d byte packet\n", pkt_len,
-               len);
-        return AVERROR_INVALIDDATA;
-    }
-
-    if (ident != data->ident) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Unimplemented Xiph SDP configuration change detected\n");
-        return AVERROR_PATCHWELCOME;
-    }
-
-    if (tdt) {
-        av_log(ctx, AV_LOG_ERROR,
-               "Unimplemented RTP Xiph packet settings (%d,%d,%d)\n",
-               fragmented, tdt, num_pkts);
-        return AVERROR_PATCHWELCOME;
-    }
-
-    buf += 6; // move past header bits
-    len -= 6;
-
-    if (fragmented == 0) {
-        // whole frame(s)
-        int i, data_len, write_len;
-        buf -= 2;
-        len += 2;
-
-        // fast first pass to calculate total length
-        for (i = 0, data_len = 0;  (i < num_pkts) && (len >= 2);  i++) {
-            int off   = data_len + (i << 1);
-            pkt_len   = AV_RB16(buf + off);
-            data_len += pkt_len;
-            len      -= pkt_len + 2;
-        }
-
-        if (len < 0 || i < num_pkts) {
-            av_log(ctx, AV_LOG_ERROR,
-                   "Bad packet: %d bytes left at frame %d of %d\n",
-                   len, i, num_pkts);
-            return AVERROR_INVALIDDATA;
-        }
-
-        if (av_new_packet(pkt, data_len)) {
-            av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
-            return AVERROR(ENOMEM);
-        }
-        pkt->stream_index = st->index;
-
-        // concatenate frames
-        for (i = 0, write_len = 0; write_len < data_len; i++) {
-            pkt_len = AV_RB16(buf);
-            buf += 2;
-            memcpy(pkt->data + write_len, buf, pkt_len);
-            write_len += pkt_len;
-            buf += pkt_len;
-        }
-        assert(write_len == data_len);
-
-        return 0;
-
-    } else if (fragmented == 1) {
-        // start of xiph data fragment
-        int res;
-
-        // end packet has been lost somewhere, so drop buffered data
-        free_fragment_if_needed(data);
-
-        if((res = url_open_dyn_buf(&data->fragment)) < 0)
-            return res;
-
-        put_buffer(data->fragment, buf, pkt_len);
-        data->timestamp = *timestamp;
-
-    } else {
-        assert(fragmented < 4);
-        if (data->timestamp != *timestamp) {
-            // skip if fragmented timestamp is incorrect;
-            // a start packet has been lost somewhere
-            free_fragment_if_needed(data);
-            av_log(ctx, AV_LOG_ERROR, "RTP timestamps don't match!\n");
-            return AVERROR_INVALIDDATA;
-        }
-
-        // copy data to fragment buffer
-        put_buffer(data->fragment, buf, pkt_len);
-
-        if (fragmented == 3) {
-            // end of xiph data packet
-            uint8_t* xiph_data;
-            int frame_size = url_close_dyn_buf(data->fragment, &xiph_data);
-
-            if (frame_size < 0) {
-                av_log(ctx, AV_LOG_ERROR,
-                       "Error occurred when getting fragment buffer.");
-                return frame_size;
-            }
-
-            if (av_new_packet(pkt, frame_size)) {
-                av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
-                return AVERROR(ENOMEM);
-            }
-
-            memcpy(pkt->data, xiph_data, frame_size);
-            pkt->stream_index = st->index;
-
-            av_free(xiph_data);
-            data->fragment = NULL;
-
-            return 0;
-        }
-    }
-
-   return AVERROR(EAGAIN);
-}
-
-/**
- * Length encoding described in RFC5215 section 3.1.1.
- */
-static int get_base128(const uint8_t ** buf, const uint8_t * buf_end)
-{
-    int n = 0;
-    for (; *buf < buf_end; ++*buf) {
-        n <<= 7;
-        n += **buf & 0x7f;
-        if (!(**buf & 0x80)) {
-            ++*buf;
-            return n;
-        }
-    }
-    return 0;
-}
-
-/**
- * Based off parse_packed_headers in Vorbis RTP
- */
-static unsigned int
-parse_packed_headers(const uint8_t * packed_headers,
-                     const uint8_t * packed_headers_end,
-                     AVCodecContext * codec, PayloadContext * xiph_data)
-{
-
-    unsigned num_packed, num_headers, length, length1, length2, extradata_alloc;
-    uint8_t *ptr;
-
-    if (packed_headers_end - packed_headers < 9) {
-        av_log(codec, AV_LOG_ERROR,
-               "Invalid %d byte packed header.",
-               packed_headers_end - packed_headers);
-        return AVERROR_INVALIDDATA;
-    }
-
-    num_packed         = bytestream_get_be32(&packed_headers);
-    xiph_data->ident   = bytestream_get_be24(&packed_headers);
-    length             = bytestream_get_be16(&packed_headers);
-    num_headers        = get_base128(&packed_headers, packed_headers_end);
-    length1            = get_base128(&packed_headers, packed_headers_end);
-    length2            = get_base128(&packed_headers, packed_headers_end);
-
-    if (num_packed != 1 || num_headers > 3) {
-        av_log(codec, AV_LOG_ERROR,
-               "Unimplemented number of headers: %d packed headers, %d headers\n",
-               num_packed, num_headers);
-        return AVERROR_PATCHWELCOME;
-    }
-
-    if (packed_headers_end - packed_headers != length ||
-        length1 > length || length2 > length - length1) {
-        av_log(codec, AV_LOG_ERROR,
-               "Bad packed header lengths (%d,%d,%d,%d)\n", length1,
-               length2, packed_headers_end - packed_headers, length);
-        return AVERROR_INVALIDDATA;
-    }
-
-    /* allocate extra space:
-     * -- length/255 +2 for xiphlacing
-     * -- one for the '2' marker
-     * -- FF_INPUT_BUFFER_PADDING_SIZE required */
-    extradata_alloc = length + length/255 + 3 + FF_INPUT_BUFFER_PADDING_SIZE;
-
-    ptr = codec->extradata = av_malloc(extradata_alloc);
-    if (!ptr) {
-        av_log(codec, AV_LOG_ERROR, "Out of memory\n");
-        return AVERROR(ENOMEM);
-    }
-    *ptr++ = 2;
-    ptr += av_xiphlacing(ptr, length1);
-    ptr += av_xiphlacing(ptr, length2);
-    memcpy(ptr, packed_headers, length);
-    ptr += length;
-    codec->extradata_size = ptr - codec->extradata;
-    // clear out remaining parts of the buffer
-    memset(ptr, 0, extradata_alloc - codec->extradata_size);
-
-    return 0;
-}
-
-static int xiph_parse_fmtp_pair(AVCodecContext * codec,
-                                PayloadContext *xiph_data,
-                                char *attr, char *value)
-{
-    int result = 0;
-
-    if (!strcmp(attr, "sampling")) {
-        return AVERROR_PATCHWELCOME;
-    } else if (!strcmp(attr, "width")) {
-        /* This is an integer between 1 and 1048561
-         * and MUST be in multiples of 16. */
-        codec->width = atoi(value);
-        return 0;
-    } else if (!strcmp(attr, "height")) {
-        /* This is an integer between 1 and 1048561
-         * and MUST be in multiples of 16. */
-        codec->height = atoi(value);
-        return 0;
-    } else if (!strcmp(attr, "delivery-method")) {
-        /* Possible values are: inline, in_band, out_band/specific_name. */
-        return AVERROR_PATCHWELCOME;
-    } else if (!strcmp(attr, "configuration-uri")) {
-        /* NOTE: configuration-uri is supported only under 2 conditions:
-         *--after the delivery-method tag
-         * --with a delivery-method value of out_band */
-        return AVERROR_PATCHWELCOME;
-    } else if (!strcmp(attr, "configuration")) {
-        /* NOTE: configuration is supported only AFTER the delivery-method tag
-         * The configuration value is a base64 encoded packed header */
-        uint8_t *decoded_packet = NULL;
-        int packet_size;
-        size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
-
-        if (decoded_alloc <= INT_MAX) {
-            decoded_packet = av_malloc(decoded_alloc);
-            if (decoded_packet) {
-                packet_size =
-                    av_base64_decode(decoded_packet, value, decoded_alloc);
-
-                result = parse_packed_headers
-                    (decoded_packet, decoded_packet + packet_size, codec,
-                    xiph_data);
-            } else {
-                av_log(codec, AV_LOG_ERROR,
-                       "Out of memory while decoding SDP configuration.\n");
-                result = AVERROR(ENOMEM);
-            }
-        } else {
-            av_log(codec, AV_LOG_ERROR, "Packet too large\n");
-            result = AVERROR_INVALIDDATA;
-        }
-        av_free(decoded_packet);
-    }
-    return result;
-}
-
-static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
-                                 PayloadContext *data, const char *line)
-{
-    const char *p;
-    char *value;
-    char attr[25];
-    int value_size = strlen(line), attr_size = sizeof(attr), res = 0;
-    AVCodecContext* codec = s->streams[st_index]->codec;
-
-    assert(data);
-
-    if (!(value = av_malloc(value_size))) {
-        av_log(codec, AV_LOG_ERROR, "Out of memory\n");
-        return AVERROR(ENOMEM);
-    }
-
-    if (av_strstart(line, "fmtp:", &p)) {
-        // remove protocol identifier
-        while (*p && *p == ' ') p++; // strip spaces
-        while (*p && *p != ' ') p++; // eat protocol identifier
-        while (*p && *p == ' ') p++; // strip trailing spaces
-
-        while (ff_rtsp_next_attr_and_value(&p,
-                                           attr, attr_size,
-                                           value, value_size)) {
-            res = xiph_parse_fmtp_pair(codec, data, attr, value);
-            if (res < 0 && res != AVERROR_PATCHWELCOME)
-                return res;
-        }
-    }
-
-    av_free(value);
-    return 0;
-}
-
-RTPDynamicProtocolHandler ff_theora_dynamic_handler = {
-    .enc_name         = "theora",
-    .codec_type       = AVMEDIA_TYPE_VIDEO,
-    .codec_id         = CODEC_ID_THEORA,
-    .parse_sdp_a_line = xiph_parse_sdp_line,
-    .open             = xiph_new_context,
-    .close            = xiph_free_context,
-    .parse_packet     = xiph_handle_packet
-};
-
-RTPDynamicProtocolHandler ff_vorbis_dynamic_handler = {
-    .enc_name         = "vorbis",
-    .codec_type       = AVMEDIA_TYPE_AUDIO,
-    .codec_id         = CODEC_ID_VORBIS,
-    .parse_sdp_a_line = xiph_parse_sdp_line,
-    .open             = xiph_new_context,
-    .close            = xiph_free_context,
-    .parse_packet     = xiph_handle_packet
-};
diff --git a/libavformat/rtpdec_xiph.h b/libavformat/rtpdec_xiph.h
deleted file mode 100644
index 50aa77f..0000000
--- a/libavformat/rtpdec_xiph.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Xiph RTP Protocols
- * Based off RFC 5215 (Vorbis RTP) and the Theora RTP draft.
- * Copyright (c) 2009 Colin McQuillian
- * Copyright (c) 2010 Josh Allmann
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTPDEC_XIPH_H
-#define AVFORMAT_RTPDEC_XIPH_H
-
-#include "libavcodec/avcodec.h"
-#include "rtpdec.h"
-
-/**
- * Theora RTP callbacks.
- */
-extern RTPDynamicProtocolHandler ff_theora_dynamic_handler;
-
-/**
- * Vorbis RTP callbacks.
- */
-extern RTPDynamicProtocolHandler ff_vorbis_dynamic_handler;
-
-#endif /* AVFORMAT_RTPDEC_XIPH_H */
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
deleted file mode 100644
index 5df101e..0000000
--- a/libavformat/rtpenc.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * RTP output format
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "mpegts.h"
-#include "internal.h"
-#include "libavutil/random_seed.h"
-
-#include <unistd.h>
-
-#include "rtpenc.h"
-
-//#define DEBUG
-
-#define RTCP_SR_SIZE 28
-
-static int is_supported(enum CodecID id)
-{
-    switch(id) {
-    case CODEC_ID_H263:
-    case CODEC_ID_H263P:
-    case CODEC_ID_H264:
-    case CODEC_ID_MPEG1VIDEO:
-    case CODEC_ID_MPEG2VIDEO:
-    case CODEC_ID_MPEG4:
-    case CODEC_ID_AAC:
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-    case CODEC_ID_PCM_ALAW:
-    case CODEC_ID_PCM_MULAW:
-    case CODEC_ID_PCM_S8:
-    case CODEC_ID_PCM_S16BE:
-    case CODEC_ID_PCM_S16LE:
-    case CODEC_ID_PCM_U16BE:
-    case CODEC_ID_PCM_U16LE:
-    case CODEC_ID_PCM_U8:
-    case CODEC_ID_MPEG2TS:
-    case CODEC_ID_AMR_NB:
-    case CODEC_ID_AMR_WB:
-        return 1;
-    default:
-        return 0;
-    }
-}
-
-static int rtp_write_header(AVFormatContext *s1)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int max_packet_size, n;
-    AVStream *st;
-
-    if (s1->nb_streams != 1)
-        return -1;
-    st = s1->streams[0];
-    if (!is_supported(st->codec->codec_id)) {
-        av_log(s1, AV_LOG_ERROR, "Unsupported codec %x\n", st->codec->codec_id);
-
-        return -1;
-    }
-
-    s->payload_type = ff_rtp_get_payload_type(st->codec);
-    if (s->payload_type < 0)
-        s->payload_type = RTP_PT_PRIVATE + (st->codec->codec_type == AVMEDIA_TYPE_AUDIO);
-
-    s->base_timestamp = ff_random_get_seed();
-    s->timestamp = s->base_timestamp;
-    s->cur_timestamp = 0;
-    s->ssrc = ff_random_get_seed();
-    s->first_packet = 1;
-    s->first_rtcp_ntp_time = ff_ntp_time();
-    if (s1->start_time_realtime)
-        /* Round the NTP time to whole milliseconds. */
-        s->first_rtcp_ntp_time = (s1->start_time_realtime / 1000) * 1000 +
-                                 NTP_OFFSET_US;
-
-    max_packet_size = url_fget_max_packet_size(s1->pb);
-    if (max_packet_size <= 12)
-        return AVERROR(EIO);
-    s->buf = av_malloc(max_packet_size);
-    if (s->buf == NULL) {
-        return AVERROR(ENOMEM);
-    }
-    s->max_payload_size = max_packet_size - 12;
-
-    s->max_frames_per_packet = 0;
-    if (s1->max_delay) {
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if (st->codec->frame_size == 0) {
-                av_log(s1, AV_LOG_ERROR, "Cannot respect max delay: frame size = 0\n");
-            } else {
-                s->max_frames_per_packet = av_rescale_rnd(s1->max_delay, st->codec->sample_rate, AV_TIME_BASE * st->codec->frame_size, AV_ROUND_DOWN);
-            }
-        }
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            /* FIXME: We should round down here... */
-            s->max_frames_per_packet = av_rescale_q(s1->max_delay, (AVRational){1, 1000000}, st->codec->time_base);
-        }
-    }
-
-    av_set_pts_info(st, 32, 1, 90000);
-    switch(st->codec->codec_id) {
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-        s->buf_ptr = s->buf + 4;
-        break;
-    case CODEC_ID_MPEG1VIDEO:
-    case CODEC_ID_MPEG2VIDEO:
-        break;
-    case CODEC_ID_MPEG2TS:
-        n = s->max_payload_size / TS_PACKET_SIZE;
-        if (n < 1)
-            n = 1;
-        s->max_payload_size = n * TS_PACKET_SIZE;
-        s->buf_ptr = s->buf;
-        break;
-    case CODEC_ID_AMR_NB:
-    case CODEC_ID_AMR_WB:
-        if (!s->max_frames_per_packet)
-            s->max_frames_per_packet = 12;
-        if (st->codec->codec_id == CODEC_ID_AMR_NB)
-            n = 31;
-        else
-            n = 61;
-        /* max_header_toc_size + the largest AMR payload must fit */
-        if (1 + s->max_frames_per_packet + n > s->max_payload_size) {
-            av_log(s1, AV_LOG_ERROR, "RTP max payload size too small for AMR\n");
-            return -1;
-        }
-        if (st->codec->channels != 1) {
-            av_log(s1, AV_LOG_ERROR, "Only mono is supported\n");
-            return -1;
-        }
-    case CODEC_ID_AAC:
-        s->num_frames = 0;
-    default:
-        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            av_set_pts_info(st, 32, 1, st->codec->sample_rate);
-        }
-        s->buf_ptr = s->buf;
-        break;
-    }
-
-    return 0;
-}
-
-/* send an rtcp sender report packet */
-static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
-{
-    RTPMuxContext *s = s1->priv_data;
-    uint32_t rtp_ts;
-
-    dprintf(s1, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp);
-
-    s->last_rtcp_ntp_time = ntp_time;
-    rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000},
-                          s1->streams[0]->time_base) + s->base_timestamp;
-    put_byte(s1->pb, (RTP_VERSION << 6));
-    put_byte(s1->pb, 200);
-    put_be16(s1->pb, 6); /* length in words - 1 */
-    put_be32(s1->pb, s->ssrc);
-    put_be32(s1->pb, ntp_time / 1000000);
-    put_be32(s1->pb, ((ntp_time % 1000000) << 32) / 1000000);
-    put_be32(s1->pb, rtp_ts);
-    put_be32(s1->pb, s->packet_count);
-    put_be32(s1->pb, s->octet_count);
-    put_flush_packet(s1->pb);
-}
-
-/* send an rtp packet. sequence number is incremented, but the caller
-   must update the timestamp itself */
-void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
-{
-    RTPMuxContext *s = s1->priv_data;
-
-    dprintf(s1, "rtp_send_data size=%d\n", len);
-
-    /* build the RTP header */
-    put_byte(s1->pb, (RTP_VERSION << 6));
-    put_byte(s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
-    put_be16(s1->pb, s->seq);
-    put_be32(s1->pb, s->timestamp);
-    put_be32(s1->pb, s->ssrc);
-
-    put_buffer(s1->pb, buf1, len);
-    put_flush_packet(s1->pb);
-
-    s->seq++;
-    s->octet_count += len;
-    s->packet_count++;
-}
-
-/* send an integer number of samples and compute time stamp and fill
-   the rtp send buffer before sending. */
-static void rtp_send_samples(AVFormatContext *s1,
-                             const uint8_t *buf1, int size, int sample_size)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int len, max_packet_size, n;
-
-    max_packet_size = (s->max_payload_size / sample_size) * sample_size;
-    /* not needed, but who nows */
-    if ((size % sample_size) != 0)
-        av_abort();
-    n = 0;
-    while (size > 0) {
-        s->buf_ptr = s->buf;
-        len = FFMIN(max_packet_size, size);
-
-        /* copy data */
-        memcpy(s->buf_ptr, buf1, len);
-        s->buf_ptr += len;
-        buf1 += len;
-        size -= len;
-        s->timestamp = s->cur_timestamp + n / sample_size;
-        ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 0);
-        n += (s->buf_ptr - s->buf);
-    }
-}
-
-static void rtp_send_mpegaudio(AVFormatContext *s1,
-                               const uint8_t *buf1, int size)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int len, count, max_packet_size;
-
-    max_packet_size = s->max_payload_size;
-
-    /* test if we must flush because not enough space */
-    len = (s->buf_ptr - s->buf);
-    if ((len + size) > max_packet_size) {
-        if (len > 4) {
-            ff_rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 0);
-            s->buf_ptr = s->buf + 4;
-        }
-    }
-    if (s->buf_ptr == s->buf + 4) {
-        s->timestamp = s->cur_timestamp;
-    }
-
-    /* add the packet */
-    if (size > max_packet_size) {
-        /* big packet: fragment */
-        count = 0;
-        while (size > 0) {
-            len = max_packet_size - 4;
-            if (len > size)
-                len = size;
-            /* build fragmented packet */
-            s->buf[0] = 0;
-            s->buf[1] = 0;
-            s->buf[2] = count >> 8;
-            s->buf[3] = count;
-            memcpy(s->buf + 4, buf1, len);
-            ff_rtp_send_data(s1, s->buf, len + 4, 0);
-            size -= len;
-            buf1 += len;
-            count += len;
-        }
-    } else {
-        if (s->buf_ptr == s->buf + 4) {
-            /* no fragmentation possible */
-            s->buf[0] = 0;
-            s->buf[1] = 0;
-            s->buf[2] = 0;
-            s->buf[3] = 0;
-        }
-        memcpy(s->buf_ptr, buf1, size);
-        s->buf_ptr += size;
-    }
-}
-
-static void rtp_send_raw(AVFormatContext *s1,
-                         const uint8_t *buf1, int size)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int len, max_packet_size;
-
-    max_packet_size = s->max_payload_size;
-
-    while (size > 0) {
-        len = max_packet_size;
-        if (len > size)
-            len = size;
-
-        s->timestamp = s->cur_timestamp;
-        ff_rtp_send_data(s1, buf1, len, (len == size));
-
-        buf1 += len;
-        size -= len;
-    }
-}
-
-/* NOTE: size is assumed to be an integer multiple of TS_PACKET_SIZE */
-static void rtp_send_mpegts_raw(AVFormatContext *s1,
-                                const uint8_t *buf1, int size)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int len, out_len;
-
-    while (size >= TS_PACKET_SIZE) {
-        len = s->max_payload_size - (s->buf_ptr - s->buf);
-        if (len > size)
-            len = size;
-        memcpy(s->buf_ptr, buf1, len);
-        buf1 += len;
-        size -= len;
-        s->buf_ptr += len;
-
-        out_len = s->buf_ptr - s->buf;
-        if (out_len >= s->max_payload_size) {
-            ff_rtp_send_data(s1, s->buf, out_len, 0);
-            s->buf_ptr = s->buf;
-        }
-    }
-}
-
-static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    RTPMuxContext *s = s1->priv_data;
-    AVStream *st = s1->streams[0];
-    int rtcp_bytes;
-    int size= pkt->size;
-
-    dprintf(s1, "%d: write len=%d\n", pkt->stream_index, size);
-
-    rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) /
-        RTCP_TX_RATIO_DEN;
-    if (s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) &&
-                           (ff_ntp_time() - s->last_rtcp_ntp_time > 5000000))) {
-        rtcp_send_sr(s1, ff_ntp_time());
-        s->last_octet_count = s->octet_count;
-        s->first_packet = 0;
-    }
-    s->cur_timestamp = s->base_timestamp + pkt->pts;
-
-    switch(st->codec->codec_id) {
-    case CODEC_ID_PCM_MULAW:
-    case CODEC_ID_PCM_ALAW:
-    case CODEC_ID_PCM_U8:
-    case CODEC_ID_PCM_S8:
-        rtp_send_samples(s1, pkt->data, size, 1 * st->codec->channels);
-        break;
-    case CODEC_ID_PCM_U16BE:
-    case CODEC_ID_PCM_U16LE:
-    case CODEC_ID_PCM_S16BE:
-    case CODEC_ID_PCM_S16LE:
-        rtp_send_samples(s1, pkt->data, size, 2 * st->codec->channels);
-        break;
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-        rtp_send_mpegaudio(s1, pkt->data, size);
-        break;
-    case CODEC_ID_MPEG1VIDEO:
-    case CODEC_ID_MPEG2VIDEO:
-        ff_rtp_send_mpegvideo(s1, pkt->data, size);
-        break;
-    case CODEC_ID_AAC:
-        ff_rtp_send_aac(s1, pkt->data, size);
-        break;
-    case CODEC_ID_AMR_NB:
-    case CODEC_ID_AMR_WB:
-        ff_rtp_send_amr(s1, pkt->data, size);
-        break;
-    case CODEC_ID_MPEG2TS:
-        rtp_send_mpegts_raw(s1, pkt->data, size);
-        break;
-    case CODEC_ID_H264:
-        ff_rtp_send_h264(s1, pkt->data, size);
-        break;
-    case CODEC_ID_H263:
-    case CODEC_ID_H263P:
-        ff_rtp_send_h263(s1, pkt->data, size);
-        break;
-    default:
-        /* better than nothing : send the codec raw data */
-        rtp_send_raw(s1, pkt->data, size);
-        break;
-    }
-    return 0;
-}
-
-static int rtp_write_trailer(AVFormatContext *s1)
-{
-    RTPMuxContext *s = s1->priv_data;
-
-    av_freep(&s->buf);
-
-    return 0;
-}
-
-AVOutputFormat rtp_muxer = {
-    "rtp",
-    NULL_IF_CONFIG_SMALL("RTP output format"),
-    NULL,
-    NULL,
-    sizeof(RTPMuxContext),
-    CODEC_ID_PCM_MULAW,
-    CODEC_ID_NONE,
-    rtp_write_header,
-    rtp_write_packet,
-    rtp_write_trailer,
-};
diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h
deleted file mode 100644
index 5710160..0000000
--- a/libavformat/rtpenc.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * RTP muxer definitions
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVFORMAT_RTPENC_H
-#define AVFORMAT_RTPENC_H
-
-#include "avformat.h"
-#include "rtp.h"
-
-struct RTPMuxContext {
-    AVFormatContext *ic;
-    AVStream *st;
-    int payload_type;
-    uint32_t ssrc;
-    uint16_t seq;
-    uint32_t timestamp;
-    uint32_t base_timestamp;
-    uint32_t cur_timestamp;
-    int max_payload_size;
-    int num_frames;
-
-    /* rtcp sender statistics receive */
-    int64_t last_rtcp_ntp_time;    // TODO: move into statistics
-    int64_t first_rtcp_ntp_time;   // TODO: move into statistics
-
-    /* rtcp sender statistics */
-    unsigned int packet_count;     // TODO: move into statistics (outgoing)
-    unsigned int octet_count;      // TODO: move into statistics (outgoing)
-    unsigned int last_octet_count; // TODO: move into statistics (outgoing)
-    int first_packet;
-    /* buffer for output */
-    uint8_t *buf;
-    uint8_t *buf_ptr;
-
-    int max_frames_per_packet;
-};
-
-typedef struct RTPMuxContext RTPMuxContext;
-
-void ff_rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m);
-
-void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size);
-void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size);
-void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size);
-void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size);
-void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size);
-
-#endif /* AVFORMAT_RTPENC_H */
diff --git a/libavformat/rtpenc_aac.c b/libavformat/rtpenc_aac.c
deleted file mode 100644
index e19b286..0000000
--- a/libavformat/rtpenc_aac.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * copyright (c) 2007 Luca Abeni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "rtpenc.h"
-
-
-void ff_rtp_send_aac(AVFormatContext *s1, const uint8_t *buff, int size)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int len, max_packet_size;
-    uint8_t *p;
-    const int max_frames_per_packet = s->max_frames_per_packet ? s->max_frames_per_packet : 5;
-    const int max_au_headers_size = 2 + 2 * max_frames_per_packet;
-
-    /* skip ADTS header, if present */
-    if ((s1->streams[0]->codec->extradata_size) == 0) {
-        size -= 7;
-        buff += 7;
-    }
-    max_packet_size = s->max_payload_size - max_au_headers_size;
-
-    /* test if the packet must be sent */
-    len = (s->buf_ptr - s->buf);
-    if ((s->num_frames == max_frames_per_packet) || (len && (len + size) > s->max_payload_size)) {
-        int au_size = s->num_frames * 2;
-
-        p = s->buf + max_au_headers_size - au_size - 2;
-        if (p != s->buf) {
-            memmove(p + 2, s->buf + 2, au_size);
-        }
-        /* Write the AU header size */
-        p[0] = ((au_size * 8) & 0xFF) >> 8;
-        p[1] = (au_size * 8) & 0xFF;
-
-        ff_rtp_send_data(s1, p, s->buf_ptr - p, 1);
-
-        s->num_frames = 0;
-    }
-    if (s->num_frames == 0) {
-        s->buf_ptr = s->buf + max_au_headers_size;
-        s->timestamp = s->cur_timestamp;
-    }
-
-    if (size <= max_packet_size) {
-        p = s->buf + s->num_frames++ * 2 + 2;
-        *p++ = size >> 5;
-        *p = (size & 0x1F) << 3;
-        memcpy(s->buf_ptr, buff, size);
-        s->buf_ptr += size;
-    } else {
-        int au_size = size;
-
-        max_packet_size = s->max_payload_size - 4;
-        p = s->buf;
-        p[0] = 0;
-        p[1] = 16;
-        while (size > 0) {
-            len = FFMIN(size, max_packet_size);
-            p[2] = au_size >> 5;
-            p[3] = (au_size & 0x1F) << 3;
-            memcpy(p + 4, buff, len);
-            ff_rtp_send_data(s1, p, len + 4, len == size);
-            size -= len;
-            buff += len;
-        }
-    }
-}
diff --git a/libavformat/rtpenc_amr.c b/libavformat/rtpenc_amr.c
deleted file mode 100644
index 367789f..0000000
--- a/libavformat/rtpenc_amr.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * RTP packetization for AMR audio
- * Copyright (c) 2007 Luca Abeni
- * Copyright (c) 2009 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "rtpenc.h"
-
-/**
- * Packetize AMR frames into RTP packets according to RFC 3267,
- * in octet-aligned mode.
- */
-void ff_rtp_send_amr(AVFormatContext *s1, const uint8_t *buff, int size)
-{
-    RTPMuxContext *s          = s1->priv_data;
-    int max_header_toc_size   = 1 + s->max_frames_per_packet;
-    uint8_t *p;
-    int len;
-
-    /* Test if the packet must be sent. */
-    len = s->buf_ptr - s->buf;
-    if (s->num_frames == s->max_frames_per_packet || (len && len + size - 1 > s->max_payload_size)) {
-        int header_size = s->num_frames + 1;
-        p = s->buf + max_header_toc_size - header_size;
-        if (p != s->buf)
-            memmove(p, s->buf, header_size);
-
-        ff_rtp_send_data(s1, p, s->buf_ptr - p, 1);
-
-        s->num_frames = 0;
-    }
-
-    if (!s->num_frames) {
-        s->buf[0]    = 0xf0;
-        s->buf_ptr   = s->buf + max_header_toc_size;
-        s->timestamp = s->cur_timestamp;
-    } else {
-        /* Mark the previous TOC entry as having more entries following. */
-        s->buf[1 + s->num_frames - 1] |= 0x80;
-    }
-
-    /* Copy the frame type and quality bits. */
-    s->buf[1 + s->num_frames++] = buff[0] & 0x7C;
-    buff++;
-    size--;
-    memcpy(s->buf_ptr, buff, size);
-    s->buf_ptr += size;
-}
-
diff --git a/libavformat/rtpenc_h263.c b/libavformat/rtpenc_h263.c
deleted file mode 100644
index 84403a1..0000000
--- a/libavformat/rtpenc_h263.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * RTP packetization for H.263 video
- * Copyright (c) 2009 Luca Abeni
- * Copyright (c) 2009 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "rtpenc.h"
-
-static const uint8_t *find_resync_marker_reverse(const uint8_t *restrict start,
-                                                 const uint8_t *restrict end)
-{
-    const uint8_t *p = end - 1;
-    start += 1; /* Make sure we never return the original start. */
-    for (; p > start; p -= 2) {
-        if (!*p) {
-            if      (!p[ 1] && p[2]) return p;
-            else if (!p[-1] && p[1]) return p - 1;
-        }
-    }
-    return end;
-}
-
-/**
- * Packetize H.263 frames into RTP packets according to RFC 4629
- */
-void ff_rtp_send_h263(AVFormatContext *s1, const uint8_t *buf1, int size)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int len, max_packet_size;
-    uint8_t *q;
-
-    max_packet_size = s->max_payload_size;
-
-    while (size > 0) {
-        q = s->buf;
-        if (size >= 2 && (buf1[0] == 0) && (buf1[1] == 0)) {
-            *q++ = 0x04;
-            buf1 += 2;
-            size -= 2;
-        } else {
-            *q++ = 0;
-        }
-        *q++ = 0;
-
-        len = FFMIN(max_packet_size - 2, size);
-
-        /* Look for a better place to split the frame into packets. */
-        if (len < size) {
-            const uint8_t *end = find_resync_marker_reverse(buf1, buf1 + len);
-            len = end - buf1;
-        }
-
-        memcpy(q, buf1, len);
-        q += len;
-
-        /* 90 KHz time stamp */
-        s->timestamp = s->cur_timestamp;
-        ff_rtp_send_data(s1, s->buf, q - s->buf, (len == size));
-
-        buf1 += len;
-        size -= len;
-    }
-}
diff --git a/libavformat/rtpenc_h264.c b/libavformat/rtpenc_h264.c
deleted file mode 100644
index 697def6..0000000
--- a/libavformat/rtpenc_h264.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * RTP packetization for H.264 (RFC3984)
- * Copyright (c) 2008 Luca Abeni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief H.264 packetization
- * @author Luca Abeni <lucabe72 at email.it>
- */
-
-#include "avformat.h"
-#include "avc.h"
-#include "rtpenc.h"
-
-static void nal_send(AVFormatContext *s1, const uint8_t *buf, int size, int last)
-{
-    RTPMuxContext *s = s1->priv_data;
-
-    av_log(s1, AV_LOG_DEBUG, "Sending NAL %x of len %d M=%d\n", buf[0] & 0x1F, size, last);
-    if (size <= s->max_payload_size) {
-        ff_rtp_send_data(s1, buf, size, last);
-    } else {
-        uint8_t type = buf[0] & 0x1F;
-        uint8_t nri = buf[0] & 0x60;
-
-        av_log(s1, AV_LOG_DEBUG, "NAL size %d > %d\n", size, s->max_payload_size);
-        s->buf[0] = 28;        /* FU Indicator; Type = 28 ---> FU-A */
-        s->buf[0] |= nri;
-        s->buf[1] = type;
-        s->buf[1] |= 1 << 7;
-        buf += 1;
-        size -= 1;
-        while (size + 2 > s->max_payload_size) {
-            memcpy(&s->buf[2], buf, s->max_payload_size - 2);
-            ff_rtp_send_data(s1, s->buf, s->max_payload_size, 0);
-            buf += s->max_payload_size - 2;
-            size -= s->max_payload_size - 2;
-            s->buf[1] &= ~(1 << 7);
-        }
-        s->buf[1] |= 1 << 6;
-        memcpy(&s->buf[2], buf, size);
-        ff_rtp_send_data(s1, s->buf, size + 2, last);
-    }
-}
-
-void ff_rtp_send_h264(AVFormatContext *s1, const uint8_t *buf1, int size)
-{
-    const uint8_t *r;
-    RTPMuxContext *s = s1->priv_data;
-
-    s->timestamp = s->cur_timestamp;
-    r = ff_avc_find_startcode(buf1, buf1 + size);
-    while (r < buf1 + size) {
-        const uint8_t *r1;
-
-        while(!*(r++));
-        r1 = ff_avc_find_startcode(r, buf1 + size);
-        nal_send(s1, r, r1 - r, (r1 == buf1 + size));
-        r = r1;
-    }
-}
diff --git a/libavformat/rtpenc_mpv.c b/libavformat/rtpenc_mpv.c
deleted file mode 100644
index b23c8f8..0000000
--- a/libavformat/rtpenc_mpv.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * RTP packetization for MPEG video
- * Copyright (c) 2002 Fabrice Bellard
- * Copyright (c) 2007 Luca Abeni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/mpegvideo.h"
-#include "avformat.h"
-#include "rtpenc.h"
-
-/* NOTE: a single frame must be passed with sequence header if
-   needed. XXX: use slices. */
-void ff_rtp_send_mpegvideo(AVFormatContext *s1, const uint8_t *buf1, int size)
-{
-    RTPMuxContext *s = s1->priv_data;
-    int len, h, max_packet_size;
-    uint8_t *q;
-    const uint8_t *end = buf1 + size;
-    int begin_of_slice, end_of_slice, frame_type, temporal_reference;
-
-    max_packet_size = s->max_payload_size;
-    begin_of_slice = 1;
-    end_of_slice = 0;
-    frame_type = 0;
-    temporal_reference = 0;
-
-    while (size > 0) {
-        int begin_of_sequence;
-
-        begin_of_sequence = 0;
-        len = max_packet_size - 4;
-
-        if (len >= size) {
-            len = size;
-            end_of_slice = 1;
-        } else {
-            const uint8_t *r, *r1;
-            int start_code;
-
-            r1 = buf1;
-            while (1) {
-                start_code = -1;
-                r = ff_find_start_code(r1, end, &start_code);
-                if((start_code & 0xFFFFFF00) == 0x100) {
-                    /* New start code found */
-                    if (start_code == 0x100) {
-                        frame_type = (r[1] & 0x38) >> 3;
-                        temporal_reference = (int)r[0] << 2 | r[1] >> 6;
-                    }
-                    if (start_code == 0x1B8) {
-                        begin_of_sequence = 1;
-                    }
-
-                    if (r - buf1 - 4 <= len) {
-                        /* The current slice fits in the packet */
-                        if (begin_of_slice == 0) {
-                            /* no slice at the beginning of the packet... */
-                            end_of_slice = 1;
-                            len = r - buf1 - 4;
-                            break;
-                        }
-                        r1 = r;
-                    } else {
-                        if ((r1 - buf1 > 4) && (r - r1 < max_packet_size)) {
-                            len = r1 - buf1 - 4;
-                            end_of_slice = 1;
-                        }
-                        break;
-                    }
-                } else {
-                    break;
-                }
-            }
-        }
-
-        h = 0;
-        h |= temporal_reference << 16;
-        h |= begin_of_sequence << 13;
-        h |= begin_of_slice << 12;
-        h |= end_of_slice << 11;
-        h |= frame_type << 8;
-
-        q = s->buf;
-        *q++ = h >> 24;
-        *q++ = h >> 16;
-        *q++ = h >> 8;
-        *q++ = h;
-
-        memcpy(q, buf1, len);
-        q += len;
-
-        /* 90kHz time stamp */
-        s->timestamp = s->cur_timestamp;
-        ff_rtp_send_data(s1, s->buf, q - s->buf, (len == size));
-
-        buf1 += len;
-        size -= len;
-        begin_of_slice = end_of_slice;
-        end_of_slice = 0;
-    }
-}
-
-
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
deleted file mode 100644
index 754908c..0000000
--- a/libavformat/rtpproto.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * RTP network protocol
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * RTP protocol
- */
-
-#include "libavutil/avstring.h"
-#include "avformat.h"
-#include "rtpdec.h"
-
-#include <unistd.h>
-#include <stdarg.h>
-#include "internal.h"
-#include "network.h"
-#include "os_support.h"
-#include <fcntl.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#include <sys/time.h>
-
-#define RTP_TX_BUF_SIZE  (64 * 1024)
-#define RTP_RX_BUF_SIZE  (128 * 1024)
-
-typedef struct RTPContext {
-    URLContext *rtp_hd, *rtcp_hd;
-    int rtp_fd, rtcp_fd;
-} RTPContext;
-
-/**
- * If no filename is given to av_open_input_file because you want to
- * get the local port first, then you must call this function to set
- * the remote server address.
- *
- * @param s1 media file context
- * @param uri of the remote server
- * @return zero if no error.
- */
-
-int rtp_set_remote_url(URLContext *h, const char *uri)
-{
-    RTPContext *s = h->priv_data;
-    char hostname[256];
-    int port;
-
-    char buf[1024];
-    char path[1024];
-
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
-                 path, sizeof(path), uri);
-
-    ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
-    udp_set_remote_url(s->rtp_hd, buf);
-
-    ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port + 1, "%s", path);
-    udp_set_remote_url(s->rtcp_hd, buf);
-    return 0;
-}
-
-
-/**
- * add option to url of the form:
- * "http://host:port/path?option1=val1&option2=val2...
- */
-
-static void url_add_option(char *buf, int buf_size, const char *fmt, ...)
-{
-    char buf1[1024];
-    va_list ap;
-
-    va_start(ap, fmt);
-    if (strchr(buf, '?'))
-        av_strlcat(buf, "&", buf_size);
-    else
-        av_strlcat(buf, "?", buf_size);
-    vsnprintf(buf1, sizeof(buf1), fmt, ap);
-    av_strlcat(buf, buf1, buf_size);
-    va_end(ap);
-}
-
-static void build_udp_url(char *buf, int buf_size,
-                          const char *hostname, int port,
-                          int local_port, int ttl,
-                          int max_packet_size)
-{
-    ff_url_join(buf, buf_size, "udp", NULL, hostname, port, NULL);
-    if (local_port >= 0)
-        url_add_option(buf, buf_size, "localport=%d", local_port);
-    if (ttl >= 0)
-        url_add_option(buf, buf_size, "ttl=%d", ttl);
-    if (max_packet_size >=0)
-        url_add_option(buf, buf_size, "pkt_size=%d", max_packet_size);
-}
-
-/**
- * url syntax: rtp://host:port[?option=val...]
- * option: 'ttl=n'            : set the ttl value (for multicast only)
- *         'rtcpport=n'       : set the remote rtcp port to n
- *         'localrtpport=n'   : set the local rtp port to n
- *         'localrtcpport=n'  : set the local rtcp port to n
- *         'pkt_size=n'       : set max packet size
- * deprecated option:
- *         'localport=n'      : set the local port to n
- *
- * if rtcpport isn't set the rtcp port will be the rtp port + 1
- * if local rtp port isn't set any available port will be used for the local
- * rtp and rtcp ports
- * if the local rtcp port is not set it will be the local rtp port + 1
- */
-
-static int rtp_open(URLContext *h, const char *uri, int flags)
-{
-    RTPContext *s;
-    int rtp_port, rtcp_port,
-        is_output, ttl,
-        local_rtp_port, local_rtcp_port, max_packet_size;
-    char hostname[256];
-    char buf[1024];
-    char path[1024];
-    const char *p;
-
-    is_output = (flags & URL_WRONLY);
-
-    s = av_mallocz(sizeof(RTPContext));
-    if (!s)
-        return AVERROR(ENOMEM);
-    h->priv_data = s;
-
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
-                 path, sizeof(path), uri);
-    /* extract parameters */
-    ttl = -1;
-    rtcp_port = rtp_port+1;
-    local_rtp_port = -1;
-    local_rtcp_port = -1;
-    max_packet_size = -1;
-
-    p = strchr(uri, '?');
-    if (p) {
-        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
-            ttl = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
-            rtcp_port = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "localport", p)) {
-            local_rtp_port = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
-            local_rtp_port = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
-            local_rtcp_port = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
-            max_packet_size = strtol(buf, NULL, 10);
-        }
-    }
-
-    build_udp_url(buf, sizeof(buf),
-                  hostname, rtp_port, local_rtp_port, ttl, max_packet_size);
-    if (url_open(&s->rtp_hd, buf, flags) < 0)
-        goto fail;
-    if (local_rtp_port>=0 && local_rtcp_port<0)
-        local_rtcp_port = udp_get_local_port(s->rtp_hd) + 1;
-
-    build_udp_url(buf, sizeof(buf),
-                  hostname, rtcp_port, local_rtcp_port, ttl, max_packet_size);
-    if (url_open(&s->rtcp_hd, buf, flags) < 0)
-        goto fail;
-
-    /* just to ease handle access. XXX: need to suppress direct handle
-       access */
-    s->rtp_fd = url_get_file_handle(s->rtp_hd);
-    s->rtcp_fd = url_get_file_handle(s->rtcp_hd);
-
-    h->max_packet_size = url_get_max_packet_size(s->rtp_hd);
-    h->is_streamed = 1;
-    return 0;
-
- fail:
-    if (s->rtp_hd)
-        url_close(s->rtp_hd);
-    if (s->rtcp_hd)
-        url_close(s->rtcp_hd);
-    av_free(s);
-    return AVERROR(EIO);
-}
-
-static int rtp_read(URLContext *h, uint8_t *buf, int size)
-{
-    RTPContext *s = h->priv_data;
-    struct sockaddr_in from;
-    socklen_t from_len;
-    int len, fd_max, n;
-    fd_set rfds;
-    struct timeval tv;
-#if 0
-    for(;;) {
-        from_len = sizeof(from);
-        len = recvfrom (s->rtp_fd, buf, size, 0,
-                        (struct sockaddr *)&from, &from_len);
-        if (len < 0) {
-            if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
-                ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return AVERROR(EIO);
-        }
-        break;
-    }
-#else
-    for(;;) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        /* build fdset to listen to RTP and RTCP packets */
-        FD_ZERO(&rfds);
-        fd_max = s->rtp_fd;
-        FD_SET(s->rtp_fd, &rfds);
-        if (s->rtcp_fd > fd_max)
-            fd_max = s->rtcp_fd;
-        FD_SET(s->rtcp_fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        n = select(fd_max + 1, &rfds, NULL, NULL, &tv);
-        if (n > 0) {
-            /* first try RTCP */
-            if (FD_ISSET(s->rtcp_fd, &rfds)) {
-                from_len = sizeof(from);
-                len = recvfrom (s->rtcp_fd, buf, size, 0,
-                                (struct sockaddr *)&from, &from_len);
-                if (len < 0) {
-                    if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
-                        ff_neterrno() == FF_NETERROR(EINTR))
-                        continue;
-                    return AVERROR(EIO);
-                }
-                break;
-            }
-            /* then RTP */
-            if (FD_ISSET(s->rtp_fd, &rfds)) {
-                from_len = sizeof(from);
-                len = recvfrom (s->rtp_fd, buf, size, 0,
-                                (struct sockaddr *)&from, &from_len);
-                if (len < 0) {
-                    if (ff_neterrno() == FF_NETERROR(EAGAIN) ||
-                        ff_neterrno() == FF_NETERROR(EINTR))
-                        continue;
-                    return AVERROR(EIO);
-                }
-                break;
-            }
-        } else if (n < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return AVERROR(EIO);
-        }
-    }
-#endif
-    return len;
-}
-
-static int rtp_write(URLContext *h, uint8_t *buf, int size)
-{
-    RTPContext *s = h->priv_data;
-    int ret;
-    URLContext *hd;
-
-    if (buf[1] >= 200 && buf[1] <= 204) {
-        /* RTCP payload type */
-        hd = s->rtcp_hd;
-    } else {
-        /* RTP payload type */
-        hd = s->rtp_hd;
-    }
-
-    ret = url_write(hd, buf, size);
-#if 0
-    {
-        struct timespec ts;
-        ts.tv_sec = 0;
-        ts.tv_nsec = 10 * 1000000;
-        nanosleep(&ts, NULL);
-    }
-#endif
-    return ret;
-}
-
-static int rtp_close(URLContext *h)
-{
-    RTPContext *s = h->priv_data;
-
-    url_close(s->rtp_hd);
-    url_close(s->rtcp_hd);
-    av_free(s);
-    return 0;
-}
-
-/**
- * Return the local rtp port used by the RTP connection
- * @param s1 media file context
- * @return the local port number
- */
-
-int rtp_get_local_rtp_port(URLContext *h)
-{
-    RTPContext *s = h->priv_data;
-    return udp_get_local_port(s->rtp_hd);
-}
-
-/**
- * Return the local rtp port used by the RTP connection
- * @param s1 media file context
- * @return the local port number
- */
-
-int rtp_get_local_port(URLContext *h)
-{
-    RTPContext *s = h->priv_data;
-    return udp_get_local_port(s->rtp_hd);
-}
-
-/**
- * Return the local rtcp port used by the RTP connection
- * @param s1 media file context
- * @return the local port number
- */
-
-int rtp_get_local_rtcp_port(URLContext *h)
-{
-    RTPContext *s = h->priv_data;
-    return udp_get_local_port(s->rtcp_hd);
-}
-
-#if (LIBAVFORMAT_VERSION_MAJOR <= 52)
-/**
- * Return the rtp and rtcp file handles for select() usage to wait for
- * several RTP streams at the same time.
- * @param h media file context
- */
-
-void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd)
-{
-    RTPContext *s = h->priv_data;
-
-    *prtp_fd = s->rtp_fd;
-    *prtcp_fd = s->rtcp_fd;
-}
-#endif
-
-static int rtp_get_file_handle(URLContext *h)
-{
-    RTPContext *s = h->priv_data;
-    return s->rtp_fd;
-}
-
-URLProtocol rtp_protocol = {
-    "rtp",
-    rtp_open,
-    rtp_read,
-    rtp_write,
-    NULL, /* seek */
-    rtp_close,
-    .url_get_file_handle = rtp_get_file_handle,
-};
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
deleted file mode 100644
index 6dbd796..0000000
--- a/libavformat/rtsp.c
+++ /dev/null
@@ -1,2091 +0,0 @@
-/*
- * RTSP/SDP client
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/base64.h"
-#include "libavutil/avstring.h"
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#include <strings.h>
-#include "internal.h"
-#include "network.h"
-#include "os_support.h"
-#include "rtsp.h"
-
-#include "rtpdec.h"
-#include "rdt.h"
-#include "rtpdec_asf.h"
-
-//#define DEBUG
-//#define DEBUG_RTP_TCP
-
-#if LIBAVFORMAT_VERSION_INT < (53 << 16)
-int rtsp_default_protocols = (1 << RTSP_LOWER_TRANSPORT_UDP);
-#endif
-
-/* Timeout values for socket select, in ms,
- * and read_packet(), in seconds  */
-#define SELECT_TIMEOUT_MS 100
-#define READ_PACKET_TIMEOUT_S 10
-#define MAX_TIMEOUTS READ_PACKET_TIMEOUT_S * 1000 / SELECT_TIMEOUT_MS
-
-#define SPACE_CHARS " \t\r\n"
-/* we use memchr() instead of strchr() here because strchr() will return
- * the terminating '\0' of SPACE_CHARS instead of NULL if c is '\0'. */
-#define redir_isspace(c) memchr(SPACE_CHARS, c, 4)
-static void skip_spaces(const char **pp)
-{
-    const char *p;
-    p = *pp;
-    while (redir_isspace(*p))
-        p++;
-    *pp = p;
-}
-
-static void get_word_until_chars(char *buf, int buf_size,
-                                 const char *sep, const char **pp)
-{
-    const char *p;
-    char *q;
-
-    p = *pp;
-    skip_spaces(&p);
-    q = buf;
-    while (!strchr(sep, *p) && *p != '\0') {
-        if ((q - buf) < buf_size - 1)
-            *q++ = *p;
-        p++;
-    }
-    if (buf_size > 0)
-        *q = '\0';
-    *pp = p;
-}
-
-static void get_word_sep(char *buf, int buf_size, const char *sep,
-                         const char **pp)
-{
-    if (**pp == '/') (*pp)++;
-    get_word_until_chars(buf, buf_size, sep, pp);
-}
-
-static void get_word(char *buf, int buf_size, const char **pp)
-{
-    get_word_until_chars(buf, buf_size, SPACE_CHARS, pp);
-}
-
-/* parse the rtpmap description: <codec_name>/<clock_rate>[/<other params>] */
-static int sdp_parse_rtpmap(AVFormatContext *s,
-                            AVCodecContext *codec, RTSPStream *rtsp_st,
-                            int payload_type, const char *p)
-{
-    char buf[256];
-    int i;
-    AVCodec *c;
-    const char *c_name;
-
-    /* Loop into AVRtpDynamicPayloadTypes[] and AVRtpPayloadTypes[] and
-     * see if we can handle this kind of payload.
-     * The space should normally not be there but some Real streams or
-     * particular servers ("RealServer Version 6.1.3.970", see issue 1658)
-     * have a trailing space. */
-    get_word_sep(buf, sizeof(buf), "/ ", &p);
-    if (payload_type >= RTP_PT_PRIVATE) {
-        RTPDynamicProtocolHandler *handler;
-        for (handler = RTPFirstDynamicPayloadHandler;
-             handler; handler = handler->next) {
-            if (!strcasecmp(buf, handler->enc_name) &&
-                codec->codec_type == handler->codec_type) {
-                codec->codec_id          = handler->codec_id;
-                rtsp_st->dynamic_handler = handler;
-                if (handler->open)
-                    rtsp_st->dynamic_protocol_context = handler->open();
-                break;
-            }
-        }
-    } else {
-        /* We are in a standard case
-         * (from http://www.iana.org/assignments/rtp-parameters). */
-        /* search into AVRtpPayloadTypes[] */
-        codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
-    }
-
-    c = avcodec_find_decoder(codec->codec_id);
-    if (c && c->name)
-        c_name = c->name;
-    else
-        c_name = "(null)";
-
-    get_word_sep(buf, sizeof(buf), "/", &p);
-    i = atoi(buf);
-    switch (codec->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        av_log(s, AV_LOG_DEBUG, "audio codec set to: %s\n", c_name);
-        codec->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE;
-        codec->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS;
-        if (i > 0) {
-            codec->sample_rate = i;
-            get_word_sep(buf, sizeof(buf), "/", &p);
-            i = atoi(buf);
-            if (i > 0)
-                codec->channels = i;
-            // TODO: there is a bug here; if it is a mono stream, and
-            // less than 22000Hz, faad upconverts to stereo and twice
-            // the frequency.  No problem, but the sample rate is being
-            // set here by the sdp line. Patch on its way. (rdm)
-        }
-        av_log(s, AV_LOG_DEBUG, "audio samplerate set to: %i\n",
-               codec->sample_rate);
-        av_log(s, AV_LOG_DEBUG, "audio channels set to: %i\n",
-               codec->channels);
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        av_log(s, AV_LOG_DEBUG, "video codec set to: %s\n", c_name);
-        break;
-    default:
-        break;
-    }
-    return 0;
-}
-
-/* return the length and optionally the data */
-static int hex_to_data(uint8_t *data, const char *p)
-{
-    int c, len, v;
-
-    len = 0;
-    v = 1;
-    for (;;) {
-        skip_spaces(&p);
-        if (*p == '\0')
-            break;
-        c = toupper((unsigned char) *p++);
-        if (c >= '0' && c <= '9')
-            c = c - '0';
-        else if (c >= 'A' && c <= 'F')
-            c = c - 'A' + 10;
-        else
-            break;
-        v = (v << 4) | c;
-        if (v & 0x100) {
-            if (data)
-                data[len] = v;
-            len++;
-            v = 1;
-        }
-    }
-    return len;
-}
-
-static void sdp_parse_fmtp_config(AVCodecContext * codec, void *ctx,
-                                  char *attr, char *value)
-{
-    switch (codec->codec_id) {
-    case CODEC_ID_MPEG4:
-    case CODEC_ID_AAC:
-        if (!strcmp(attr, "config")) {
-            /* decode the hexa encoded parameter */
-            int len = hex_to_data(NULL, value);
-            if (codec->extradata)
-                av_free(codec->extradata);
-            codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
-            if (!codec->extradata)
-                return;
-            codec->extradata_size = len;
-            hex_to_data(codec->extradata, value);
-        }
-        break;
-    default:
-        break;
-    }
-    return;
-}
-
-typedef struct {
-    const char *str;
-    uint16_t    type;
-    uint32_t    offset;
-} AttrNameMap;
-
-/* All known fmtp parameters and the corresponding RTPAttrTypeEnum */
-#define ATTR_NAME_TYPE_INT 0
-#define ATTR_NAME_TYPE_STR 1
-static const AttrNameMap attr_names[]=
-{
-    { "SizeLength",       ATTR_NAME_TYPE_INT,
-      offsetof(RTPPayloadData, sizelength) },
-    { "IndexLength",      ATTR_NAME_TYPE_INT,
-      offsetof(RTPPayloadData, indexlength) },
-    { "IndexDeltaLength", ATTR_NAME_TYPE_INT,
-      offsetof(RTPPayloadData, indexdeltalength) },
-    { "profile-level-id", ATTR_NAME_TYPE_INT,
-      offsetof(RTPPayloadData, profile_level_id) },
-    { "StreamType",       ATTR_NAME_TYPE_INT,
-      offsetof(RTPPayloadData, streamtype) },
-    { "mode",             ATTR_NAME_TYPE_STR,
-      offsetof(RTPPayloadData, mode) },
-    { NULL, -1, -1 },
-};
-
-/* parse the attribute line from the fmtp a line of an sdp response. This
- * is broken out as a function because it is used in rtp_h264.c, which is
- * forthcoming. */
-int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size,
-                                char *value, int value_size)
-{
-    skip_spaces(p);
-    if (**p) {
-        get_word_sep(attr, attr_size, "=", p);
-        if (**p == '=')
-            (*p)++;
-        get_word_sep(value, value_size, ";", p);
-        if (**p == ';')
-            (*p)++;
-        return 1;
-    }
-    return 0;
-}
-
-/* parse a SDP line and save stream attributes */
-static void sdp_parse_fmtp(AVStream *st, const char *p)
-{
-    char attr[256];
-    /* Vorbis setup headers can be up to 12KB and are sent base64
-     * encoded, giving a 12KB * (4/3) = 16KB FMTP line. */
-    char value[16384];
-    int i;
-    RTSPStream *rtsp_st = st->priv_data;
-    AVCodecContext *codec = st->codec;
-    RTPPayloadData *rtp_payload_data = &rtsp_st->rtp_payload_data;
-
-    /* loop on each attribute */
-    while (ff_rtsp_next_attr_and_value(&p, attr, sizeof(attr),
-                                       value, sizeof(value))) {
-        /* grab the codec extra_data from the config parameter of the fmtp
-         * line */
-        sdp_parse_fmtp_config(codec, rtsp_st->dynamic_protocol_context,
-                              attr, value);
-        /* Looking for a known attribute */
-        for (i = 0; attr_names[i].str; ++i) {
-            if (!strcasecmp(attr, attr_names[i].str)) {
-                if (attr_names[i].type == ATTR_NAME_TYPE_INT) {
-                    *(int *)((char *)rtp_payload_data +
-                        attr_names[i].offset) = atoi(value);
-                } else if (attr_names[i].type == ATTR_NAME_TYPE_STR)
-                    *(char **)((char *)rtp_payload_data +
-                        attr_names[i].offset) = av_strdup(value);
-            }
-        }
-    }
-}
-
-/** Parse a string p in the form of Range:npt=xx-xx, and determine the start
- *  and end time.
- *  Used for seeking in the rtp stream.
- */
-static void rtsp_parse_range_npt(const char *p, int64_t *start, int64_t *end)
-{
-    char buf[256];
-
-    skip_spaces(&p);
-    if (!av_stristart(p, "npt=", &p))
-        return;
-
-    *start = AV_NOPTS_VALUE;
-    *end = AV_NOPTS_VALUE;
-
-    get_word_sep(buf, sizeof(buf), "-", &p);
-    *start = parse_date(buf, 1);
-    if (*p == '-') {
-        p++;
-        get_word_sep(buf, sizeof(buf), "-", &p);
-        *end = parse_date(buf, 1);
-    }
-//    av_log(NULL, AV_LOG_DEBUG, "Range Start: %lld\n", *start);
-//    av_log(NULL, AV_LOG_DEBUG, "Range End: %lld\n", *end);
-}
-
-typedef struct SDPParseState {
-    /* SDP only */
-    struct in_addr default_ip;
-    int            default_ttl;
-    int            skip_media;  ///< set if an unknown m= line occurs
-} SDPParseState;
-
-static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
-                           int letter, const char *buf)
-{
-    RTSPState *rt = s->priv_data;
-    char buf1[64], st_type[64];
-    const char *p;
-    enum AVMediaType codec_type;
-    int payload_type, i;
-    AVStream *st;
-    RTSPStream *rtsp_st;
-    struct in_addr sdp_ip;
-    int ttl;
-
-    dprintf(s, "sdp: %c='%s'\n", letter, buf);
-
-    p = buf;
-    if (s1->skip_media && letter != 'm')
-        return;
-    switch (letter) {
-    case 'c':
-        get_word(buf1, sizeof(buf1), &p);
-        if (strcmp(buf1, "IN") != 0)
-            return;
-        get_word(buf1, sizeof(buf1), &p);
-        if (strcmp(buf1, "IP4") != 0)
-            return;
-        get_word_sep(buf1, sizeof(buf1), "/", &p);
-        if (ff_inet_aton(buf1, &sdp_ip) == 0)
-            return;
-        ttl = 16;
-        if (*p == '/') {
-            p++;
-            get_word_sep(buf1, sizeof(buf1), "/", &p);
-            ttl = atoi(buf1);
-        }
-        if (s->nb_streams == 0) {
-            s1->default_ip = sdp_ip;
-            s1->default_ttl = ttl;
-        } else {
-            st = s->streams[s->nb_streams - 1];
-            rtsp_st = st->priv_data;
-            rtsp_st->sdp_ip = sdp_ip;
-            rtsp_st->sdp_ttl = ttl;
-        }
-        break;
-    case 's':
-        av_metadata_set2(&s->metadata, "title", p, 0);
-        break;
-    case 'i':
-        if (s->nb_streams == 0) {
-            av_metadata_set2(&s->metadata, "comment", p, 0);
-            break;
-        }
-        break;
-    case 'm':
-        /* new stream */
-        s1->skip_media = 0;
-        get_word(st_type, sizeof(st_type), &p);
-        if (!strcmp(st_type, "audio")) {
-            codec_type = AVMEDIA_TYPE_AUDIO;
-        } else if (!strcmp(st_type, "video")) {
-            codec_type = AVMEDIA_TYPE_VIDEO;
-        } else if (!strcmp(st_type, "application")) {
-            codec_type = AVMEDIA_TYPE_DATA;
-        } else {
-            s1->skip_media = 1;
-            return;
-        }
-        rtsp_st = av_mallocz(sizeof(RTSPStream));
-        if (!rtsp_st)
-            return;
-        rtsp_st->stream_index = -1;
-        dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st);
-
-        rtsp_st->sdp_ip = s1->default_ip;
-        rtsp_st->sdp_ttl = s1->default_ttl;
-
-        get_word(buf1, sizeof(buf1), &p); /* port */
-        rtsp_st->sdp_port = atoi(buf1);
-
-        get_word(buf1, sizeof(buf1), &p); /* protocol (ignored) */
-
-        /* XXX: handle list of formats */
-        get_word(buf1, sizeof(buf1), &p); /* format list */
-        rtsp_st->sdp_payload_type = atoi(buf1);
-
-        if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
-            /* no corresponding stream */
-        } else {
-            st = av_new_stream(s, 0);
-            if (!st)
-                return;
-            st->priv_data = rtsp_st;
-            rtsp_st->stream_index = st->index;
-            st->codec->codec_type = codec_type;
-            if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) {
-                /* if standard payload type, we can find the codec right now */
-                ff_rtp_get_codec_info(st->codec, rtsp_st->sdp_payload_type);
-            }
-        }
-        /* put a default control url */
-        av_strlcpy(rtsp_st->control_url, rt->control_uri,
-                   sizeof(rtsp_st->control_url));
-        break;
-    case 'a':
-        if (av_strstart(p, "control:", &p)) {
-            if (s->nb_streams == 0) {
-                if (!strncmp(p, "rtsp://", 7))
-                    av_strlcpy(rt->control_uri, p,
-                               sizeof(rt->control_uri));
-            } else {
-            char proto[32];
-            /* get the control url */
-            st = s->streams[s->nb_streams - 1];
-            rtsp_st = st->priv_data;
-
-            /* XXX: may need to add full url resolution */
-            ff_url_split(proto, sizeof(proto), NULL, 0, NULL, 0,
-                         NULL, NULL, 0, p);
-            if (proto[0] == '\0') {
-                /* relative control URL */
-                if (rtsp_st->control_url[strlen(rtsp_st->control_url)-1]!='/')
-                av_strlcat(rtsp_st->control_url, "/",
-                           sizeof(rtsp_st->control_url));
-                av_strlcat(rtsp_st->control_url, p,
-                           sizeof(rtsp_st->control_url));
-            } else
-                av_strlcpy(rtsp_st->control_url, p,
-                           sizeof(rtsp_st->control_url));
-            }
-        } else if (av_strstart(p, "rtpmap:", &p) && s->nb_streams > 0) {
-            /* NOTE: rtpmap is only supported AFTER the 'm=' tag */
-            get_word(buf1, sizeof(buf1), &p);
-            payload_type = atoi(buf1);
-            st = s->streams[s->nb_streams - 1];
-            rtsp_st = st->priv_data;
-            sdp_parse_rtpmap(s, st->codec, rtsp_st, payload_type, p);
-        } else if (av_strstart(p, "fmtp:", &p)) {
-            /* NOTE: fmtp is only supported AFTER the 'a=rtpmap:xxx' tag */
-            get_word(buf1, sizeof(buf1), &p);
-            payload_type = atoi(buf1);
-            for (i = 0; i < s->nb_streams; i++) {
-                st      = s->streams[i];
-                rtsp_st = st->priv_data;
-                if (rtsp_st->sdp_payload_type == payload_type) {
-                    if (!(rtsp_st->dynamic_handler &&
-                          rtsp_st->dynamic_handler->parse_sdp_a_line &&
-                          rtsp_st->dynamic_handler->parse_sdp_a_line(s,
-                              i, rtsp_st->dynamic_protocol_context, buf)))
-                        sdp_parse_fmtp(st, p);
-                }
-            }
-        } else if (av_strstart(p, "framesize:", &p)) {
-            // let dynamic protocol handlers have a stab at the line.
-            get_word(buf1, sizeof(buf1), &p);
-            payload_type = atoi(buf1);
-            for (i = 0; i < s->nb_streams; i++) {
-                st      = s->streams[i];
-                rtsp_st = st->priv_data;
-                if (rtsp_st->sdp_payload_type == payload_type &&
-                    rtsp_st->dynamic_handler &&
-                    rtsp_st->dynamic_handler->parse_sdp_a_line)
-                    rtsp_st->dynamic_handler->parse_sdp_a_line(s, i,
-                        rtsp_st->dynamic_protocol_context, buf);
-            }
-        } else if (av_strstart(p, "range:", &p)) {
-            int64_t start, end;
-
-            // this is so that seeking on a streamed file can work.
-            rtsp_parse_range_npt(p, &start, &end);
-            s->start_time = start;
-            /* AV_NOPTS_VALUE means live broadcast (and can't seek) */
-            s->duration   = (end == AV_NOPTS_VALUE) ?
-                            AV_NOPTS_VALUE : end - start;
-        } else if (av_strstart(p, "IsRealDataType:integer;",&p)) {
-            if (atoi(p) == 1)
-                rt->transport = RTSP_TRANSPORT_RDT;
-        } else {
-            if (rt->server_type == RTSP_SERVER_WMS)
-                ff_wms_parse_sdp_a_line(s, p);
-            if (s->nb_streams > 0) {
-                if (rt->server_type == RTSP_SERVER_REAL)
-                    ff_real_parse_sdp_a_line(s, s->nb_streams - 1, p);
-
-                rtsp_st = s->streams[s->nb_streams - 1]->priv_data;
-                if (rtsp_st->dynamic_handler &&
-                    rtsp_st->dynamic_handler->parse_sdp_a_line)
-                    rtsp_st->dynamic_handler->parse_sdp_a_line(s,
-                        s->nb_streams - 1,
-                        rtsp_st->dynamic_protocol_context, buf);
-            }
-        }
-        break;
-    }
-}
-
-static int sdp_parse(AVFormatContext *s, const char *content)
-{
-    const char *p;
-    int letter;
-    /* Some SDP lines, particularly for Realmedia or ASF RTSP streams,
-     * contain long SDP lines containing complete ASF Headers (several
-     * kB) or arrays of MDPR (RM stream descriptor) headers plus
-     * "rulebooks" describing their properties. Therefore, the SDP line
-     * buffer is large.
-     *
-     * The Vorbis FMTP line can be up to 16KB - see sdp_parse_fmtp. */
-    char buf[16384], *q;
-    SDPParseState sdp_parse_state, *s1 = &sdp_parse_state;
-
-    memset(s1, 0, sizeof(SDPParseState));
-    p = content;
-    for (;;) {
-        skip_spaces(&p);
-        letter = *p;
-        if (letter == '\0')
-            break;
-        p++;
-        if (*p != '=')
-            goto next_line;
-        p++;
-        /* get the content */
-        q = buf;
-        while (*p != '\n' && *p != '\r' && *p != '\0') {
-            if ((q - buf) < sizeof(buf) - 1)
-                *q++ = *p;
-            p++;
-        }
-        *q = '\0';
-        sdp_parse_line(s, s1, letter, buf);
-    next_line:
-        while (*p != '\n' && *p != '\0')
-            p++;
-        if (*p == '\n')
-            p++;
-    }
-    return 0;
-}
-
-/* close and free RTSP streams */
-void ff_rtsp_close_streams(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    int i;
-    RTSPStream *rtsp_st;
-
-    for (i = 0; i < rt->nb_rtsp_streams; i++) {
-        rtsp_st = rt->rtsp_streams[i];
-        if (rtsp_st) {
-            if (rtsp_st->transport_priv) {
-                if (s->oformat) {
-                    AVFormatContext *rtpctx = rtsp_st->transport_priv;
-                    av_write_trailer(rtpctx);
-                    if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
-                        uint8_t *ptr;
-                        url_close_dyn_buf(rtpctx->pb, &ptr);
-                        av_free(ptr);
-                    } else {
-                        url_fclose(rtpctx->pb);
-                    }
-                    av_metadata_free(&rtpctx->streams[0]->metadata);
-                    av_metadata_free(&rtpctx->metadata);
-                    av_free(rtpctx->streams[0]);
-                    av_free(rtpctx);
-                } else if (rt->transport == RTSP_TRANSPORT_RDT)
-                    ff_rdt_parse_close(rtsp_st->transport_priv);
-                else
-                    rtp_parse_close(rtsp_st->transport_priv);
-            }
-            if (rtsp_st->rtp_handle)
-                url_close(rtsp_st->rtp_handle);
-            if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)
-                rtsp_st->dynamic_handler->close(
-                    rtsp_st->dynamic_protocol_context);
-        }
-    }
-    av_free(rt->rtsp_streams);
-    if (rt->asf_ctx) {
-        av_close_input_stream (rt->asf_ctx);
-        rt->asf_ctx = NULL;
-    }
-}
-
-static void *rtsp_rtp_mux_open(AVFormatContext *s, AVStream *st,
-                               URLContext *handle)
-{
-    RTSPState *rt = s->priv_data;
-    AVFormatContext *rtpctx;
-    int ret;
-    AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
-
-    if (!rtp_format)
-        return NULL;
-
-    /* Allocate an AVFormatContext for each output stream */
-    rtpctx = avformat_alloc_context();
-    if (!rtpctx)
-        return NULL;
-
-    rtpctx->oformat = rtp_format;
-    if (!av_new_stream(rtpctx, 0)) {
-        av_free(rtpctx);
-        return NULL;
-    }
-    /* Copy the max delay setting; the rtp muxer reads this. */
-    rtpctx->max_delay = s->max_delay;
-    /* Copy other stream parameters. */
-    rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;
-
-    /* Set the synchronized start time. */
-    rtpctx->start_time_realtime = rt->start_time;
-
-    /* Remove the local codec, link to the original codec
-     * context instead, to give the rtp muxer access to
-     * codec parameters. */
-    av_free(rtpctx->streams[0]->codec);
-    rtpctx->streams[0]->codec = st->codec;
-
-    if (handle) {
-        url_fdopen(&rtpctx->pb, handle);
-    } else
-        url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
-    ret = av_write_header(rtpctx);
-
-    if (ret) {
-        if (handle) {
-            url_fclose(rtpctx->pb);
-        } else {
-            uint8_t *ptr;
-            url_close_dyn_buf(rtpctx->pb, &ptr);
-            av_free(ptr);
-        }
-        av_free(rtpctx->streams[0]);
-        av_free(rtpctx);
-        return NULL;
-    }
-
-    /* Copy the RTP AVStream timebase back to the original AVStream */
-    st->time_base = rtpctx->streams[0]->time_base;
-    return rtpctx;
-}
-
-static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
-{
-    RTSPState *rt = s->priv_data;
-    AVStream *st = NULL;
-
-    /* open the RTP context */
-    if (rtsp_st->stream_index >= 0)
-        st = s->streams[rtsp_st->stream_index];
-    if (!st)
-        s->ctx_flags |= AVFMTCTX_NOHEADER;
-
-    if (s->oformat) {
-        rtsp_st->transport_priv = rtsp_rtp_mux_open(s, st, rtsp_st->rtp_handle);
-        /* Ownership of rtp_handle is passed to the rtp mux context */
-        rtsp_st->rtp_handle = NULL;
-    } else if (rt->transport == RTSP_TRANSPORT_RDT)
-        rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index,
-                                            rtsp_st->dynamic_protocol_context,
-                                            rtsp_st->dynamic_handler);
-    else
-        rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle,
-                                         rtsp_st->sdp_payload_type,
-                                         &rtsp_st->rtp_payload_data);
-
-    if (!rtsp_st->transport_priv) {
-         return AVERROR(ENOMEM);
-    } else if (rt->transport != RTSP_TRANSPORT_RDT) {
-        if (rtsp_st->dynamic_handler) {
-            rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv,
-                                           rtsp_st->dynamic_protocol_context,
-                                           rtsp_st->dynamic_handler);
-        }
-    }
-
-    return 0;
-}
-
-#if CONFIG_RTSP_DEMUXER || CONFIG_RTSP_MUXER
-static int rtsp_probe(AVProbeData *p)
-{
-    if (av_strstart(p->filename, "rtsp:", NULL))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static void rtsp_parse_range(int *min_ptr, int *max_ptr, const char **pp)
-{
-    const char *p;
-    int v;
-
-    p = *pp;
-    skip_spaces(&p);
-    v = strtol(p, (char **)&p, 10);
-    if (*p == '-') {
-        p++;
-        *min_ptr = v;
-        v = strtol(p, (char **)&p, 10);
-        *max_ptr = v;
-    } else {
-        *min_ptr = v;
-        *max_ptr = v;
-    }
-    *pp = p;
-}
-
-/* XXX: only one transport specification is parsed */
-static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
-{
-    char transport_protocol[16];
-    char profile[16];
-    char lower_transport[16];
-    char parameter[16];
-    RTSPTransportField *th;
-    char buf[256];
-
-    reply->nb_transports = 0;
-
-    for (;;) {
-        skip_spaces(&p);
-        if (*p == '\0')
-            break;
-
-        th = &reply->transports[reply->nb_transports];
-
-        get_word_sep(transport_protocol, sizeof(transport_protocol),
-                     "/", &p);
-        if (!strcasecmp (transport_protocol, "rtp")) {
-            get_word_sep(profile, sizeof(profile), "/;,", &p);
-            lower_transport[0] = '\0';
-            /* rtp/avp/<protocol> */
-            if (*p == '/') {
-                get_word_sep(lower_transport, sizeof(lower_transport),
-                             ";,", &p);
-            }
-            th->transport = RTSP_TRANSPORT_RTP;
-        } else if (!strcasecmp (transport_protocol, "x-pn-tng") ||
-                   !strcasecmp (transport_protocol, "x-real-rdt")) {
-            /* x-pn-tng/<protocol> */
-            get_word_sep(lower_transport, sizeof(lower_transport), "/;,", &p);
-            profile[0] = '\0';
-            th->transport = RTSP_TRANSPORT_RDT;
-        }
-        if (!strcasecmp(lower_transport, "TCP"))
-            th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
-        else
-            th->lower_transport = RTSP_LOWER_TRANSPORT_UDP;
-
-        if (*p == ';')
-            p++;
-        /* get each parameter */
-        while (*p != '\0' && *p != ',') {
-            get_word_sep(parameter, sizeof(parameter), "=;,", &p);
-            if (!strcmp(parameter, "port")) {
-                if (*p == '=') {
-                    p++;
-                    rtsp_parse_range(&th->port_min, &th->port_max, &p);
-                }
-            } else if (!strcmp(parameter, "client_port")) {
-                if (*p == '=') {
-                    p++;
-                    rtsp_parse_range(&th->client_port_min,
-                                     &th->client_port_max, &p);
-                }
-            } else if (!strcmp(parameter, "server_port")) {
-                if (*p == '=') {
-                    p++;
-                    rtsp_parse_range(&th->server_port_min,
-                                     &th->server_port_max, &p);
-                }
-            } else if (!strcmp(parameter, "interleaved")) {
-                if (*p == '=') {
-                    p++;
-                    rtsp_parse_range(&th->interleaved_min,
-                                     &th->interleaved_max, &p);
-                }
-            } else if (!strcmp(parameter, "multicast")) {
-                if (th->lower_transport == RTSP_LOWER_TRANSPORT_UDP)
-                    th->lower_transport = RTSP_LOWER_TRANSPORT_UDP_MULTICAST;
-            } else if (!strcmp(parameter, "ttl")) {
-                if (*p == '=') {
-                    p++;
-                    th->ttl = strtol(p, (char **)&p, 10);
-                }
-            } else if (!strcmp(parameter, "destination")) {
-                struct in_addr ipaddr;
-
-                if (*p == '=') {
-                    p++;
-                    get_word_sep(buf, sizeof(buf), ";,", &p);
-                    if (ff_inet_aton(buf, &ipaddr))
-                        th->destination = ntohl(ipaddr.s_addr);
-                }
-            }
-            while (*p != ';' && *p != '\0' && *p != ',')
-                p++;
-            if (*p == ';')
-                p++;
-        }
-        if (*p == ',')
-            p++;
-
-        reply->nb_transports++;
-    }
-}
-
-void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
-                        HTTPAuthState *auth_state)
-{
-    const char *p;
-
-    /* NOTE: we do case independent match for broken servers */
-    p = buf;
-    if (av_stristart(p, "Session:", &p)) {
-        int t;
-        get_word_sep(reply->session_id, sizeof(reply->session_id), ";", &p);
-        if (av_stristart(p, ";timeout=", &p) &&
-            (t = strtol(p, NULL, 10)) > 0) {
-            reply->timeout = t;
-        }
-    } else if (av_stristart(p, "Content-Length:", &p)) {
-        reply->content_length = strtol(p, NULL, 10);
-    } else if (av_stristart(p, "Transport:", &p)) {
-        rtsp_parse_transport(reply, p);
-    } else if (av_stristart(p, "CSeq:", &p)) {
-        reply->seq = strtol(p, NULL, 10);
-    } else if (av_stristart(p, "Range:", &p)) {
-        rtsp_parse_range_npt(p, &reply->range_start, &reply->range_end);
-    } else if (av_stristart(p, "RealChallenge1:", &p)) {
-        skip_spaces(&p);
-        av_strlcpy(reply->real_challenge, p, sizeof(reply->real_challenge));
-    } else if (av_stristart(p, "Server:", &p)) {
-        skip_spaces(&p);
-        av_strlcpy(reply->server, p, sizeof(reply->server));
-    } else if (av_stristart(p, "Notice:", &p) ||
-               av_stristart(p, "X-Notice:", &p)) {
-        reply->notice = strtol(p, NULL, 10);
-    } else if (av_stristart(p, "Location:", &p)) {
-        skip_spaces(&p);
-        av_strlcpy(reply->location, p , sizeof(reply->location));
-    } else if (av_stristart(p, "WWW-Authenticate:", &p) && auth_state) {
-        skip_spaces(&p);
-        ff_http_auth_handle_header(auth_state, "WWW-Authenticate", p);
-    } else if (av_stristart(p, "Authentication-Info:", &p) && auth_state) {
-        skip_spaces(&p);
-        ff_http_auth_handle_header(auth_state, "Authentication-Info", p);
-    }
-}
-
-/* skip a RTP/TCP interleaved packet */
-void ff_rtsp_skip_packet(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    int ret, len, len1;
-    uint8_t buf[1024];
-
-    ret = url_read_complete(rt->rtsp_hd, buf, 3);
-    if (ret != 3)
-        return;
-    len = AV_RB16(buf + 1);
-
-    dprintf(s, "skipping RTP packet len=%d\n", len);
-
-    /* skip payload */
-    while (len > 0) {
-        len1 = len;
-        if (len1 > sizeof(buf))
-            len1 = sizeof(buf);
-        ret = url_read_complete(rt->rtsp_hd, buf, len1);
-        if (ret != len1)
-            return;
-        len -= len1;
-    }
-}
-
-int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
-                       unsigned char **content_ptr,
-                       int return_on_interleaved_data)
-{
-    RTSPState *rt = s->priv_data;
-    char buf[4096], buf1[1024], *q;
-    unsigned char ch;
-    const char *p;
-    int ret, content_length, line_count = 0;
-    unsigned char *content = NULL;
-
-    memset(reply, 0, sizeof(*reply));
-
-    /* parse reply (XXX: use buffers) */
-    rt->last_reply[0] = '\0';
-    for (;;) {
-        q = buf;
-        for (;;) {
-            ret = url_read_complete(rt->rtsp_hd, &ch, 1);
-#ifdef DEBUG_RTP_TCP
-            dprintf(s, "ret=%d c=%02x [%c]\n", ret, ch, ch);
-#endif
-            if (ret != 1)
-                return -1;
-            if (ch == '\n')
-                break;
-            if (ch == '$') {
-                /* XXX: only parse it if first char on line ? */
-                if (return_on_interleaved_data) {
-                    return 1;
-                } else
-                    ff_rtsp_skip_packet(s);
-            } else if (ch != '\r') {
-                if ((q - buf) < sizeof(buf) - 1)
-                    *q++ = ch;
-            }
-        }
-        *q = '\0';
-
-        dprintf(s, "line='%s'\n", buf);
-
-        /* test if last line */
-        if (buf[0] == '\0')
-            break;
-        p = buf;
-        if (line_count == 0) {
-            /* get reply code */
-            get_word(buf1, sizeof(buf1), &p);
-            get_word(buf1, sizeof(buf1), &p);
-            reply->status_code = atoi(buf1);
-        } else {
-            ff_rtsp_parse_line(reply, p, &rt->auth_state);
-            av_strlcat(rt->last_reply, p,    sizeof(rt->last_reply));
-            av_strlcat(rt->last_reply, "\n", sizeof(rt->last_reply));
-        }
-        line_count++;
-    }
-
-    if (rt->session_id[0] == '\0' && reply->session_id[0] != '\0')
-        av_strlcpy(rt->session_id, reply->session_id, sizeof(rt->session_id));
-
-    content_length = reply->content_length;
-    if (content_length > 0) {
-        /* leave some room for a trailing '\0' (useful for simple parsing) */
-        content = av_malloc(content_length + 1);
-        (void)url_read_complete(rt->rtsp_hd, content, content_length);
-        content[content_length] = '\0';
-    }
-    if (content_ptr)
-        *content_ptr = content;
-    else
-        av_free(content);
-
-    if (rt->seq != reply->seq) {
-        av_log(s, AV_LOG_WARNING, "CSeq %d expected, %d received.\n",
-            rt->seq, reply->seq);
-    }
-
-    /* EOS */
-    if (reply->notice == 2101 /* End-of-Stream Reached */      ||
-        reply->notice == 2104 /* Start-of-Stream Reached */    ||
-        reply->notice == 2306 /* Continuous Feed Terminated */) {
-        rt->state = RTSP_STATE_IDLE;
-    } else if (reply->notice >= 4400 && reply->notice < 5500) {
-        return AVERROR(EIO); /* data or server error */
-    } else if (reply->notice == 2401 /* Ticket Expired */ ||
-             (reply->notice >= 5500 && reply->notice < 5600) /* end of term */ )
-        return AVERROR(EPERM);
-
-    return 0;
-}
-
-void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
-                                         const char *method, const char *url,
-                                         const char *headers,
-                                         const unsigned char *send_content,
-                                         int send_content_length)
-{
-    RTSPState *rt = s->priv_data;
-    char buf[4096];
-
-    rt->seq++;
-    snprintf(buf, sizeof(buf), "%s %s RTSP/1.0\r\n", method, url);
-    if (headers)
-        av_strlcat(buf, headers, sizeof(buf));
-    av_strlcatf(buf, sizeof(buf), "CSeq: %d\r\n", rt->seq);
-    if (rt->session_id[0] != '\0' && (!headers ||
-        !strstr(headers, "\nIf-Match:"))) {
-        av_strlcatf(buf, sizeof(buf), "Session: %s\r\n", rt->session_id);
-    }
-    if (rt->auth[0]) {
-        char *str = ff_http_auth_create_response(&rt->auth_state,
-                                                 rt->auth, url, method);
-        if (str)
-            av_strlcat(buf, str, sizeof(buf));
-        av_free(str);
-    }
-    if (send_content_length > 0 && send_content)
-        av_strlcatf(buf, sizeof(buf), "Content-Length: %d\r\n", send_content_length);
-    av_strlcat(buf, "\r\n", sizeof(buf));
-
-    dprintf(s, "Sending:\n%s--\n", buf);
-
-    url_write(rt->rtsp_hd, buf, strlen(buf));
-    if (send_content_length > 0 && send_content)
-        url_write(rt->rtsp_hd, send_content, send_content_length);
-    rt->last_cmd_time = av_gettime();
-}
-
-void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method,
-                            const char *url, const char *headers)
-{
-    ff_rtsp_send_cmd_with_content_async(s, method, url, headers, NULL, 0);
-}
-
-void ff_rtsp_send_cmd(AVFormatContext *s, const char *method, const char *url,
-                      const char *headers, RTSPMessageHeader *reply,
-                      unsigned char **content_ptr)
-{
-    ff_rtsp_send_cmd_with_content(s, method, url, headers, reply,
-                                  content_ptr, NULL, 0);
-}
-
-void ff_rtsp_send_cmd_with_content(AVFormatContext *s,
-                                   const char *method, const char *url,
-                                   const char *header,
-                                   RTSPMessageHeader *reply,
-                                   unsigned char **content_ptr,
-                                   const unsigned char *send_content,
-                                   int send_content_length)
-{
-    RTSPState *rt = s->priv_data;
-    HTTPAuthType cur_auth_type;
-
-retry:
-    cur_auth_type = rt->auth_state.auth_type;
-    ff_rtsp_send_cmd_with_content_async(s, method, url, header,
-                                        send_content, send_content_length);
-
-    ff_rtsp_read_reply(s, reply, content_ptr, 0);
-
-    if (reply->status_code == 401 && cur_auth_type == HTTP_AUTH_NONE &&
-        rt->auth_state.auth_type != HTTP_AUTH_NONE)
-        goto retry;
-}
-
-/**
- * @return 0 on success, <0 on error, 1 if protocol is unavailable.
- */
-static int make_setup_request(AVFormatContext *s, const char *host, int port,
-                              int lower_transport, const char *real_challenge)
-{
-    RTSPState *rt = s->priv_data;
-    int rtx, j, i, err, interleave = 0;
-    RTSPStream *rtsp_st;
-    RTSPMessageHeader reply1, *reply = &reply1;
-    char cmd[2048];
-    const char *trans_pref;
-
-    if (rt->transport == RTSP_TRANSPORT_RDT)
-        trans_pref = "x-pn-tng";
-    else
-        trans_pref = "RTP/AVP";
-
-    /* default timeout: 1 minute */
-    rt->timeout = 60;
-
-    /* for each stream, make the setup request */
-    /* XXX: we assume the same server is used for the control of each
-     * RTSP stream */
-
-    for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) {
-        char transport[2048];
-
-        /**
-         * WMS serves all UDP data over a single connection, the RTX, which
-         * isn't necessarily the first in the SDP but has to be the first
-         * to be set up, else the second/third SETUP will fail with a 461.
-         */
-        if (lower_transport == RTSP_LOWER_TRANSPORT_UDP &&
-             rt->server_type == RTSP_SERVER_WMS) {
-            if (i == 0) {
-                /* rtx first */
-                for (rtx = 0; rtx < rt->nb_rtsp_streams; rtx++) {
-                    int len = strlen(rt->rtsp_streams[rtx]->control_url);
-                    if (len >= 4 &&
-                        !strcmp(rt->rtsp_streams[rtx]->control_url + len - 4,
-                                "/rtx"))
-                        break;
-                }
-                if (rtx == rt->nb_rtsp_streams)
-                    return -1; /* no RTX found */
-                rtsp_st = rt->rtsp_streams[rtx];
-            } else
-                rtsp_st = rt->rtsp_streams[i > rtx ? i : i - 1];
-        } else
-            rtsp_st = rt->rtsp_streams[i];
-
-        /* RTP/UDP */
-        if (lower_transport == RTSP_LOWER_TRANSPORT_UDP) {
-            char buf[256];
-
-            if (rt->server_type == RTSP_SERVER_WMS && i > 1) {
-                port = reply->transports[0].client_port_min;
-                goto have_port;
-            }
-
-            /* first try in specified port range */
-            if (RTSP_RTP_PORT_MIN != 0) {
-                while (j <= RTSP_RTP_PORT_MAX) {
-                    ff_url_join(buf, sizeof(buf), "rtp", NULL, host, -1,
-                                "?localport=%d", j);
-                    /* we will use two ports per rtp stream (rtp and rtcp) */
-                    j += 2;
-                    if (url_open(&rtsp_st->rtp_handle, buf, URL_RDWR) == 0)
-                        goto rtp_opened;
-                }
-            }
-
-#if 0
-            /* then try on any port */
-            if (url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
-                err = AVERROR_INVALIDDATA;
-                goto fail;
-            }
-#endif
-
-        rtp_opened:
-            port = rtp_get_local_port(rtsp_st->rtp_handle);
-        have_port:
-            snprintf(transport, sizeof(transport) - 1,
-                     "%s/UDP;", trans_pref);
-            if (rt->server_type != RTSP_SERVER_REAL)
-                av_strlcat(transport, "unicast;", sizeof(transport));
-            av_strlcatf(transport, sizeof(transport),
-                     "client_port=%d", port);
-            if (rt->transport == RTSP_TRANSPORT_RTP &&
-                !(rt->server_type == RTSP_SERVER_WMS && i > 0))
-                av_strlcatf(transport, sizeof(transport), "-%d", port + 1);
-        }
-
-        /* RTP/TCP */
-        else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
-            /** For WMS streams, the application streams are only used for
-             * UDP. When trying to set it up for TCP streams, the server
-             * will return an error. Therefore, we skip those streams. */
-            if (rt->server_type == RTSP_SERVER_WMS &&
-                s->streams[rtsp_st->stream_index]->codec->codec_type ==
-                    AVMEDIA_TYPE_DATA)
-                continue;
-            snprintf(transport, sizeof(transport) - 1,
-                     "%s/TCP;", trans_pref);
-            if (rt->server_type == RTSP_SERVER_WMS)
-                av_strlcat(transport, "unicast;", sizeof(transport));
-            av_strlcatf(transport, sizeof(transport),
-                        "interleaved=%d-%d",
-                        interleave, interleave + 1);
-            interleave += 2;
-        }
-
-        else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {
-            snprintf(transport, sizeof(transport) - 1,
-                     "%s/UDP;multicast", trans_pref);
-        }
-        if (s->oformat) {
-            av_strlcat(transport, ";mode=receive", sizeof(transport));
-        } else if (rt->server_type == RTSP_SERVER_REAL ||
-                   rt->server_type == RTSP_SERVER_WMS)
-            av_strlcat(transport, ";mode=play", sizeof(transport));
-        snprintf(cmd, sizeof(cmd),
-                 "Transport: %s\r\n",
-                 transport);
-        if (i == 0 && rt->server_type == RTSP_SERVER_REAL) {
-            char real_res[41], real_csum[9];
-            ff_rdt_calc_response_and_checksum(real_res, real_csum,
-                                              real_challenge);
-            av_strlcatf(cmd, sizeof(cmd),
-                        "If-Match: %s\r\n"
-                        "RealChallenge2: %s, sd=%s\r\n",
-                        rt->session_id, real_res, real_csum);
-        }
-        ff_rtsp_send_cmd(s, "SETUP", rtsp_st->control_url, cmd, reply, NULL);
-        if (reply->status_code == 461 /* Unsupported protocol */ && i == 0) {
-            err = 1;
-            goto fail;
-        } else if (reply->status_code != RTSP_STATUS_OK ||
-                   reply->nb_transports != 1) {
-            err = AVERROR_INVALIDDATA;
-            goto fail;
-        }
-
-        /* XXX: same protocol for all streams is required */
-        if (i > 0) {
-            if (reply->transports[0].lower_transport != rt->lower_transport ||
-                reply->transports[0].transport != rt->transport) {
-                err = AVERROR_INVALIDDATA;
-                goto fail;
-            }
-        } else {
-            rt->lower_transport = reply->transports[0].lower_transport;
-            rt->transport = reply->transports[0].transport;
-        }
-
-        /* close RTP connection if not choosen */
-        if (reply->transports[0].lower_transport != RTSP_LOWER_TRANSPORT_UDP &&
-            (lower_transport == RTSP_LOWER_TRANSPORT_UDP)) {
-            url_close(rtsp_st->rtp_handle);
-            rtsp_st->rtp_handle = NULL;
-        }
-
-        switch(reply->transports[0].lower_transport) {
-        case RTSP_LOWER_TRANSPORT_TCP:
-            rtsp_st->interleaved_min = reply->transports[0].interleaved_min;
-            rtsp_st->interleaved_max = reply->transports[0].interleaved_max;
-            break;
-
-        case RTSP_LOWER_TRANSPORT_UDP: {
-            char url[1024];
-
-            /* XXX: also use address if specified */
-            ff_url_join(url, sizeof(url), "rtp", NULL, host,
-                        reply->transports[0].server_port_min, NULL);
-            if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) &&
-                rtp_set_remote_url(rtsp_st->rtp_handle, url) < 0) {
-                err = AVERROR_INVALIDDATA;
-                goto fail;
-            }
-            /* Try to initialize the connection state in a
-             * potential NAT router by sending dummy packets.
-             * RTP/RTCP dummy packets are used for RDT, too.
-             */
-            if (!(rt->server_type == RTSP_SERVER_WMS && i > 1) && s->iformat)
-                rtp_send_punch_packets(rtsp_st->rtp_handle);
-            break;
-        }
-        case RTSP_LOWER_TRANSPORT_UDP_MULTICAST: {
-            char url[1024];
-            struct in_addr in;
-            int port, ttl;
-
-            if (reply->transports[0].destination) {
-                in.s_addr = htonl(reply->transports[0].destination);
-                port      = reply->transports[0].port_min;
-                ttl       = reply->transports[0].ttl;
-            } else {
-                in        = rtsp_st->sdp_ip;
-                port      = rtsp_st->sdp_port;
-                ttl       = rtsp_st->sdp_ttl;
-            }
-            ff_url_join(url, sizeof(url), "rtp", NULL, inet_ntoa(in),
-                        port, "?ttl=%d", ttl);
-            if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
-                err = AVERROR_INVALIDDATA;
-                goto fail;
-            }
-            break;
-        }
-        }
-
-        if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
-            goto fail;
-    }
-
-    if (reply->timeout > 0)
-        rt->timeout = reply->timeout;
-
-    if (rt->server_type == RTSP_SERVER_REAL)
-        rt->need_subscription = 1;
-
-    return 0;
-
-fail:
-    for (i = 0; i < rt->nb_rtsp_streams; i++) {
-        if (rt->rtsp_streams[i]->rtp_handle) {
-            url_close(rt->rtsp_streams[i]->rtp_handle);
-            rt->rtsp_streams[i]->rtp_handle = NULL;
-        }
-    }
-    return err;
-}
-
-static int rtsp_read_play(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPMessageHeader reply1, *reply = &reply1;
-    int i;
-    char cmd[1024];
-
-    av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state);
-
-    if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
-        if (rt->state == RTSP_STATE_PAUSED) {
-            cmd[0] = 0;
-        } else {
-            snprintf(cmd, sizeof(cmd),
-                     "Range: npt=%0.3f-\r\n",
-                     (double)rt->seek_timestamp / AV_TIME_BASE);
-        }
-        ff_rtsp_send_cmd(s, "PLAY", rt->control_uri, cmd, reply, NULL);
-        if (reply->status_code != RTSP_STATUS_OK) {
-            return -1;
-        }
-        if (reply->range_start != AV_NOPTS_VALUE &&
-            rt->transport == RTSP_TRANSPORT_RTP) {
-            for (i = 0; i < rt->nb_rtsp_streams; i++) {
-                RTSPStream *rtsp_st = rt->rtsp_streams[i];
-                RTPDemuxContext *rtpctx = rtsp_st->transport_priv;
-                AVStream *st = NULL;
-                if (!rtpctx)
-                    continue;
-                if (rtsp_st->stream_index >= 0)
-                    st = s->streams[rtsp_st->stream_index];
-                rtpctx->last_rtcp_ntp_time  = AV_NOPTS_VALUE;
-                rtpctx->first_rtcp_ntp_time = AV_NOPTS_VALUE;
-                if (st)
-                    rtpctx->range_start_offset = av_rescale_q(reply->range_start,
-                                                              AV_TIME_BASE_Q,
-                                                              st->time_base);
-            }
-        }
-    }
-    rt->state = RTSP_STATE_STREAMING;
-    return 0;
-}
-
-static int rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply)
-{
-    RTSPState *rt = s->priv_data;
-    char cmd[1024];
-    unsigned char *content = NULL;
-    int ret;
-
-    /* describe the stream */
-    snprintf(cmd, sizeof(cmd),
-             "Accept: application/sdp\r\n");
-    if (rt->server_type == RTSP_SERVER_REAL) {
-        /**
-         * The Require: attribute is needed for proper streaming from
-         * Realmedia servers.
-         */
-        av_strlcat(cmd,
-                   "Require: com.real.retain-entity-for-setup\r\n",
-                   sizeof(cmd));
-    }
-    ff_rtsp_send_cmd(s, "DESCRIBE", rt->control_uri, cmd, reply, &content);
-    if (!content)
-        return AVERROR_INVALIDDATA;
-    if (reply->status_code != RTSP_STATUS_OK) {
-        av_freep(&content);
-        return AVERROR_INVALIDDATA;
-    }
-
-    /* now we got the SDP description, we parse it */
-    ret = sdp_parse(s, (const char *)content);
-    av_freep(&content);
-    if (ret < 0)
-        return AVERROR_INVALIDDATA;
-
-    return 0;
-}
-
-static int rtsp_setup_output_streams(AVFormatContext *s, const char *addr)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPMessageHeader reply1, *reply = &reply1;
-    int i;
-    char *sdp;
-    AVFormatContext sdp_ctx, *ctx_array[1];
-
-    rt->start_time = av_gettime();
-
-    /* Announce the stream */
-    sdp = av_mallocz(8192);
-    if (sdp == NULL)
-        return AVERROR(ENOMEM);
-    /* We create the SDP based on the RTSP AVFormatContext where we
-     * aren't allowed to change the filename field. (We create the SDP
-     * based on the RTSP context since the contexts for the RTP streams
-     * don't exist yet.) In order to specify a custom URL with the actual
-     * peer IP instead of the originally specified hostname, we create
-     * a temporary copy of the AVFormatContext, where the custom URL is set.
-     *
-     * FIXME: Create the SDP without copying the AVFormatContext.
-     * This either requires setting up the RTP stream AVFormatContexts
-     * already here (complicating things immensely) or getting a more
-     * flexible SDP creation interface.
-     */
-    sdp_ctx = *s;
-    ff_url_join(sdp_ctx.filename, sizeof(sdp_ctx.filename),
-                "rtsp", NULL, addr, -1, NULL);
-    ctx_array[0] = &sdp_ctx;
-    if (avf_sdp_create(ctx_array, 1, sdp, 8192)) {
-        av_free(sdp);
-        return AVERROR_INVALIDDATA;
-    }
-    av_log(s, AV_LOG_INFO, "SDP:\n%s\n", sdp);
-    ff_rtsp_send_cmd_with_content(s, "ANNOUNCE", rt->control_uri,
-                                  "Content-Type: application/sdp\r\n",
-                                  reply, NULL, sdp, strlen(sdp));
-    av_free(sdp);
-    if (reply->status_code != RTSP_STATUS_OK)
-        return AVERROR_INVALIDDATA;
-
-    /* Set up the RTSPStreams for each AVStream */
-    for (i = 0; i < s->nb_streams; i++) {
-        RTSPStream *rtsp_st;
-        AVStream *st = s->streams[i];
-
-        rtsp_st = av_mallocz(sizeof(RTSPStream));
-        if (!rtsp_st)
-            return AVERROR(ENOMEM);
-        dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st);
-
-        st->priv_data = rtsp_st;
-        rtsp_st->stream_index = i;
-
-        av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url));
-        /* Note, this must match the relative uri set in the sdp content */
-        av_strlcatf(rtsp_st->control_url, sizeof(rtsp_st->control_url),
-                    "/streamid=%d", i);
-    }
-
-    return 0;
-}
-
-int ff_rtsp_connect(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128];
-    char *option_list, *option, *filename;
-    URLContext *rtsp_hd;
-    int port, err, tcp_fd;
-    RTSPMessageHeader reply1 = {}, *reply = &reply1;
-    int lower_transport_mask = 0;
-    char real_challenge[64];
-    struct sockaddr_storage peer;
-    socklen_t peer_len = sizeof(peer);
-
-    if (!ff_network_init())
-        return AVERROR(EIO);
-redirect:
-    /* extract hostname and port */
-    ff_url_split(NULL, 0, auth, sizeof(auth),
-                 host, sizeof(host), &port, path, sizeof(path), s->filename);
-    if (*auth) {
-        av_strlcpy(rt->auth, auth, sizeof(rt->auth));
-    }
-    if (port < 0)
-        port = RTSP_DEFAULT_PORT;
-
-    /* search for options */
-    option_list = strrchr(path, '?');
-    if (option_list) {
-        /* Strip out the RTSP specific options, write out the rest of
-         * the options back into the same string. */
-        filename = option_list;
-        while (option_list) {
-            /* move the option pointer */
-            option = ++option_list;
-            option_list = strchr(option_list, '&');
-            if (option_list)
-                *option_list = 0;
-
-            /* handle the options */
-            if (!strcmp(option, "udp")) {
-                lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_UDP);
-            } else if (!strcmp(option, "multicast")) {
-                lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_UDP_MULTICAST);
-            } else if (!strcmp(option, "tcp")) {
-                lower_transport_mask |= (1<< RTSP_LOWER_TRANSPORT_TCP);
-            } else {
-                /* Write options back into the buffer, using memmove instead
-                 * of strcpy since the strings may overlap. */
-                int len = strlen(option);
-                memmove(++filename, option, len);
-                filename += len;
-                if (option_list) *filename = '&';
-            }
-        }
-        *filename = 0;
-    }
-
-    if (!lower_transport_mask)
-        lower_transport_mask = (1 << RTSP_LOWER_TRANSPORT_NB) - 1;
-
-    if (s->oformat) {
-        /* Only UDP or TCP - UDP multicast isn't supported. */
-        lower_transport_mask &= (1 << RTSP_LOWER_TRANSPORT_UDP) |
-                                (1 << RTSP_LOWER_TRANSPORT_TCP);
-        if (!lower_transport_mask) {
-            av_log(s, AV_LOG_ERROR, "Unsupported lower transport method, "
-                                    "only UDP and TCP are supported for output.\n");
-            err = AVERROR(EINVAL);
-            goto fail;
-        }
-    }
-
-    /* Construct the URI used in request; this is similar to s->filename,
-     * but with authentication credentials removed and RTSP specific options
-     * stripped out. */
-    ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL,
-                host, port, "%s", path);
-
-    /* open the tcp connexion */
-    ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL);
-    if (url_open(&rtsp_hd, tcpname, URL_RDWR) < 0) {
-        err = AVERROR(EIO);
-        goto fail;
-    }
-    rt->rtsp_hd = rtsp_hd;
-    rt->seq = 0;
-
-    tcp_fd = url_get_file_handle(rtsp_hd);
-    if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) {
-        getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host),
-                    NULL, 0, NI_NUMERICHOST);
-    }
-
-    /* request options supported by the server; this also detects server
-     * type */
-    for (rt->server_type = RTSP_SERVER_RTP;;) {
-        cmd[0] = 0;
-        if (rt->server_type == RTSP_SERVER_REAL)
-            av_strlcat(cmd,
-                       /**
-                        * The following entries are required for proper
-                        * streaming from a Realmedia server. They are
-                        * interdependent in some way although we currently
-                        * don't quite understand how. Values were copied
-                        * from mplayer SVN r23589.
-                        * @param CompanyID is a 16-byte ID in base64
-                        * @param ClientChallenge is a 16-byte ID in hex
-                        */
-                       "ClientChallenge: 9e26d33f2984236010ef6253fb1887f7\r\n"
-                       "PlayerStarttime: [28/03/2003:22:50:23 00:00]\r\n"
-                       "CompanyID: KnKV4M4I/B2FjJ1TToLycw==\r\n"
-                       "GUID: 00000000-0000-0000-0000-000000000000\r\n",
-                       sizeof(cmd));
-        ff_rtsp_send_cmd(s, "OPTIONS", rt->control_uri, cmd, reply, NULL);
-        if (reply->status_code != RTSP_STATUS_OK) {
-            err = AVERROR_INVALIDDATA;
-            goto fail;
-        }
-
-        /* detect server type if not standard-compliant RTP */
-        if (rt->server_type != RTSP_SERVER_REAL && reply->real_challenge[0]) {
-            rt->server_type = RTSP_SERVER_REAL;
-            continue;
-        } else if (!strncasecmp(reply->server, "WMServer/", 9)) {
-            rt->server_type = RTSP_SERVER_WMS;
-        } else if (rt->server_type == RTSP_SERVER_REAL)
-            strcpy(real_challenge, reply->real_challenge);
-        break;
-    }
-
-    if (s->iformat)
-        err = rtsp_setup_input_streams(s, reply);
-    else
-        err = rtsp_setup_output_streams(s, host);
-    if (err)
-        goto fail;
-
-    do {
-        int lower_transport = ff_log2_tab[lower_transport_mask &
-                                  ~(lower_transport_mask - 1)];
-
-        err = make_setup_request(s, host, port, lower_transport,
-                                 rt->server_type == RTSP_SERVER_REAL ?
-                                     real_challenge : NULL);
-        if (err < 0)
-            goto fail;
-        lower_transport_mask &= ~(1 << lower_transport);
-        if (lower_transport_mask == 0 && err == 1) {
-            err = FF_NETERROR(EPROTONOSUPPORT);
-            goto fail;
-        }
-    } while (err);
-
-    rt->state = RTSP_STATE_IDLE;
-    rt->seek_timestamp = 0; /* default is to start stream at position zero */
-    return 0;
- fail:
-    ff_rtsp_close_streams(s);
-    url_close(rt->rtsp_hd);
-    if (reply->status_code >=300 && reply->status_code < 400 && s->iformat) {
-        av_strlcpy(s->filename, reply->location, sizeof(s->filename));
-        av_log(s, AV_LOG_INFO, "Status %d: Redirecting to %s\n",
-               reply->status_code,
-               s->filename);
-        goto redirect;
-    }
-    ff_network_close();
-    return err;
-}
-#endif
-
-#if CONFIG_RTSP_DEMUXER
-static int rtsp_read_header(AVFormatContext *s,
-                            AVFormatParameters *ap)
-{
-    RTSPState *rt = s->priv_data;
-    int ret;
-
-    ret = ff_rtsp_connect(s);
-    if (ret)
-        return ret;
-
-    if (ap->initial_pause) {
-         /* do not start immediately */
-    } else {
-         if (rtsp_read_play(s) < 0) {
-            ff_rtsp_close_streams(s);
-            url_close(rt->rtsp_hd);
-            return AVERROR_INVALIDDATA;
-        }
-    }
-
-    return 0;
-}
-
-static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
-                           uint8_t *buf, int buf_size)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPStream *rtsp_st;
-    fd_set rfds;
-    int fd, fd_max, n, i, ret, tcp_fd, timeout_cnt = 0;
-    struct timeval tv;
-
-    for (;;) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        FD_ZERO(&rfds);
-        if (rt->rtsp_hd) {
-            tcp_fd = fd_max = url_get_file_handle(rt->rtsp_hd);
-            FD_SET(tcp_fd, &rfds);
-        } else {
-            fd_max = 0;
-            tcp_fd = -1;
-        }
-        for (i = 0; i < rt->nb_rtsp_streams; i++) {
-            rtsp_st = rt->rtsp_streams[i];
-            if (rtsp_st->rtp_handle) {
-                /* currently, we cannot probe RTCP handle because of
-                 * blocking restrictions */
-                fd = url_get_file_handle(rtsp_st->rtp_handle);
-                if (fd > fd_max)
-                    fd_max = fd;
-                FD_SET(fd, &rfds);
-            }
-        }
-        tv.tv_sec = 0;
-        tv.tv_usec = SELECT_TIMEOUT_MS * 1000;
-        n = select(fd_max + 1, &rfds, NULL, NULL, &tv);
-        if (n > 0) {
-            timeout_cnt = 0;
-            for (i = 0; i < rt->nb_rtsp_streams; i++) {
-                rtsp_st = rt->rtsp_streams[i];
-                if (rtsp_st->rtp_handle) {
-                    fd = url_get_file_handle(rtsp_st->rtp_handle);
-                    if (FD_ISSET(fd, &rfds)) {
-                        ret = url_read(rtsp_st->rtp_handle, buf, buf_size);
-                        if (ret > 0) {
-                            *prtsp_st = rtsp_st;
-                            return ret;
-                        }
-                    }
-                }
-            }
-#if CONFIG_RTSP_DEMUXER
-            if (tcp_fd != -1 && FD_ISSET(tcp_fd, &rfds)) {
-                RTSPMessageHeader reply;
-
-                ret = ff_rtsp_read_reply(s, &reply, NULL, 0);
-                if (ret < 0)
-                    return ret;
-                /* XXX: parse message */
-                if (rt->state != RTSP_STATE_STREAMING)
-                    return 0;
-            }
-#endif
-        } else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {
-            return FF_NETERROR(ETIMEDOUT);
-        } else if (n < 0 && errno != EINTR)
-            return AVERROR(errno);
-    }
-}
-
-static int tcp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
-                           uint8_t *buf, int buf_size)
-{
-    RTSPState *rt = s->priv_data;
-    int id, len, i, ret;
-    RTSPStream *rtsp_st;
-
-#ifdef DEBUG_RTP_TCP
-    dprintf(s, "tcp_read_packet:\n");
-#endif
-redo:
-    for (;;) {
-        RTSPMessageHeader reply;
-
-        ret = ff_rtsp_read_reply(s, &reply, NULL, 1);
-        if (ret == -1)
-            return -1;
-        if (ret == 1) /* received '$' */
-            break;
-        /* XXX: parse message */
-        if (rt->state != RTSP_STATE_STREAMING)
-            return 0;
-    }
-    ret = url_read_complete(rt->rtsp_hd, buf, 3);
-    if (ret != 3)
-        return -1;
-    id  = buf[0];
-    len = AV_RB16(buf + 1);
-#ifdef DEBUG_RTP_TCP
-    dprintf(s, "id=%d len=%d\n", id, len);
-#endif
-    if (len > buf_size || len < 12)
-        goto redo;
-    /* get the data */
-    ret = url_read_complete(rt->rtsp_hd, buf, len);
-    if (ret != len)
-        return -1;
-    if (rt->transport == RTSP_TRANSPORT_RDT &&
-        ff_rdt_parse_header(buf, len, &id, NULL, NULL, NULL, NULL) < 0)
-        return -1;
-
-    /* find the matching stream */
-    for (i = 0; i < rt->nb_rtsp_streams; i++) {
-        rtsp_st = rt->rtsp_streams[i];
-        if (id >= rtsp_st->interleaved_min &&
-            id <= rtsp_st->interleaved_max)
-            goto found;
-    }
-    goto redo;
-found:
-    *prtsp_st = rtsp_st;
-    return len;
-}
-
-static int rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    RTSPState *rt = s->priv_data;
-    int ret, len;
-    uint8_t buf[10 * RTP_MAX_PACKET_LENGTH];
-    RTSPStream *rtsp_st;
-
-    /* get next frames from the same RTP packet */
-    if (rt->cur_transport_priv) {
-        if (rt->transport == RTSP_TRANSPORT_RDT) {
-            ret = ff_rdt_parse_packet(rt->cur_transport_priv, pkt, NULL, 0);
-        } else
-            ret = rtp_parse_packet(rt->cur_transport_priv, pkt, NULL, 0);
-        if (ret == 0) {
-            rt->cur_transport_priv = NULL;
-            return 0;
-        } else if (ret == 1) {
-            return 0;
-        } else
-            rt->cur_transport_priv = NULL;
-    }
-
-    /* read next RTP packet */
- redo:
-    switch(rt->lower_transport) {
-    default:
-#if CONFIG_RTSP_DEMUXER
-    case RTSP_LOWER_TRANSPORT_TCP:
-        len = tcp_read_packet(s, &rtsp_st, buf, sizeof(buf));
-        break;
-#endif
-    case RTSP_LOWER_TRANSPORT_UDP:
-    case RTSP_LOWER_TRANSPORT_UDP_MULTICAST:
-        len = udp_read_packet(s, &rtsp_st, buf, sizeof(buf));
-        if (len >=0 && rtsp_st->transport_priv && rt->transport == RTSP_TRANSPORT_RTP)
-            rtp_check_and_send_back_rr(rtsp_st->transport_priv, len);
-        break;
-    }
-    if (len < 0)
-        return len;
-    if (len == 0)
-        return AVERROR_EOF;
-    if (rt->transport == RTSP_TRANSPORT_RDT) {
-        ret = ff_rdt_parse_packet(rtsp_st->transport_priv, pkt, buf, len);
-    } else {
-        ret = rtp_parse_packet(rtsp_st->transport_priv, pkt, buf, len);
-        if (ret < 0) {
-            /* Either bad packet, or a RTCP packet. Check if the
-             * first_rtcp_ntp_time field was initialized. */
-            RTPDemuxContext *rtpctx = rtsp_st->transport_priv;
-            if (rtpctx->first_rtcp_ntp_time != AV_NOPTS_VALUE) {
-                /* first_rtcp_ntp_time has been initialized for this stream,
-                 * copy the same value to all other uninitialized streams,
-                 * in order to map their timestamp origin to the same ntp time
-                 * as this one. */
-                int i;
-                for (i = 0; i < rt->nb_rtsp_streams; i++) {
-                    RTPDemuxContext *rtpctx2 = rtsp_st->transport_priv;
-                    if (rtpctx2 &&
-                        rtpctx2->first_rtcp_ntp_time == AV_NOPTS_VALUE)
-                        rtpctx2->first_rtcp_ntp_time = rtpctx->first_rtcp_ntp_time;
-                }
-            }
-        }
-    }
-    if (ret < 0)
-        goto redo;
-    if (ret == 1)
-        /* more packets may follow, so we save the RTP context */
-        rt->cur_transport_priv = rtsp_st->transport_priv;
-
-    return ret;
-}
-
-static int rtsp_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    RTSPState *rt = s->priv_data;
-    int ret;
-    RTSPMessageHeader reply1, *reply = &reply1;
-    char cmd[1024];
-
-    if (rt->server_type == RTSP_SERVER_REAL) {
-        int i;
-        enum AVDiscard cache[MAX_STREAMS];
-
-        for (i = 0; i < s->nb_streams; i++)
-            cache[i] = s->streams[i]->discard;
-
-        if (!rt->need_subscription) {
-            if (memcmp (cache, rt->real_setup_cache,
-                        sizeof(enum AVDiscard) * s->nb_streams)) {
-                snprintf(cmd, sizeof(cmd),
-                         "Unsubscribe: %s\r\n",
-                         rt->last_subscription);
-                ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
-                                 cmd, reply, NULL);
-                if (reply->status_code != RTSP_STATUS_OK)
-                    return AVERROR_INVALIDDATA;
-                rt->need_subscription = 1;
-            }
-        }
-
-        if (rt->need_subscription) {
-            int r, rule_nr, first = 1;
-
-            memcpy(rt->real_setup_cache, cache,
-                   sizeof(enum AVDiscard) * s->nb_streams);
-            rt->last_subscription[0] = 0;
-
-            snprintf(cmd, sizeof(cmd),
-                     "Subscribe: ");
-            for (i = 0; i < rt->nb_rtsp_streams; i++) {
-                rule_nr = 0;
-                for (r = 0; r < s->nb_streams; r++) {
-                    if (s->streams[r]->priv_data == rt->rtsp_streams[i]) {
-                        if (s->streams[r]->discard != AVDISCARD_ALL) {
-                            if (!first)
-                                av_strlcat(rt->last_subscription, ",",
-                                           sizeof(rt->last_subscription));
-                            ff_rdt_subscribe_rule(
-                                rt->last_subscription,
-                                sizeof(rt->last_subscription), i, rule_nr);
-                            first = 0;
-                        }
-                        rule_nr++;
-                    }
-                }
-            }
-            av_strlcatf(cmd, sizeof(cmd), "%s\r\n", rt->last_subscription);
-            ff_rtsp_send_cmd(s, "SET_PARAMETER", rt->control_uri,
-                             cmd, reply, NULL);
-            if (reply->status_code != RTSP_STATUS_OK)
-                return AVERROR_INVALIDDATA;
-            rt->need_subscription = 0;
-
-            if (rt->state == RTSP_STATE_STREAMING)
-                rtsp_read_play (s);
-        }
-    }
-
-    ret = rtsp_fetch_packet(s, pkt);
-    if (ret < 0)
-        return ret;
-
-    /* send dummy request to keep TCP connection alive */
-    if ((rt->server_type == RTSP_SERVER_WMS ||
-         rt->server_type == RTSP_SERVER_REAL) &&
-        (av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) {
-        if (rt->server_type == RTSP_SERVER_WMS) {
-            ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
-        } else {
-            ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);
-        }
-    }
-
-    return 0;
-}
-
-/* pause the stream */
-static int rtsp_read_pause(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPMessageHeader reply1, *reply = &reply1;
-
-    if (rt->state != RTSP_STATE_STREAMING)
-        return 0;
-    else if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
-        ff_rtsp_send_cmd(s, "PAUSE", rt->control_uri, NULL, reply, NULL);
-        if (reply->status_code != RTSP_STATUS_OK) {
-            return -1;
-        }
-    }
-    rt->state = RTSP_STATE_PAUSED;
-    return 0;
-}
-
-static int rtsp_read_seek(AVFormatContext *s, int stream_index,
-                          int64_t timestamp, int flags)
-{
-    RTSPState *rt = s->priv_data;
-
-    rt->seek_timestamp = av_rescale_q(timestamp,
-                                      s->streams[stream_index]->time_base,
-                                      AV_TIME_BASE_Q);
-    switch(rt->state) {
-    default:
-    case RTSP_STATE_IDLE:
-        break;
-    case RTSP_STATE_STREAMING:
-        if (rtsp_read_pause(s) != 0)
-            return -1;
-        rt->state = RTSP_STATE_SEEKING;
-        if (rtsp_read_play(s) != 0)
-            return -1;
-        break;
-    case RTSP_STATE_PAUSED:
-        rt->state = RTSP_STATE_IDLE;
-        break;
-    }
-    return 0;
-}
-
-static int rtsp_read_close(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-
-#if 0
-    /* NOTE: it is valid to flush the buffer here */
-    if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
-        url_fclose(&rt->rtsp_gb);
-    }
-#endif
-    ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
-
-    ff_rtsp_close_streams(s);
-    url_close(rt->rtsp_hd);
-    ff_network_close();
-    return 0;
-}
-
-AVInputFormat rtsp_demuxer = {
-    "rtsp",
-    NULL_IF_CONFIG_SMALL("RTSP input format"),
-    sizeof(RTSPState),
-    rtsp_probe,
-    rtsp_read_header,
-    rtsp_read_packet,
-    rtsp_read_close,
-    rtsp_read_seek,
-    .flags = AVFMT_NOFILE,
-    .read_play = rtsp_read_play,
-    .read_pause = rtsp_read_pause,
-};
-#endif
-
-static int sdp_probe(AVProbeData *p1)
-{
-    const char *p = p1->buf, *p_end = p1->buf + p1->buf_size;
-
-    /* we look for a line beginning "c=IN IP4" */
-    while (p < p_end && *p != '\0') {
-        if (p + sizeof("c=IN IP4") - 1 < p_end &&
-            av_strstart(p, "c=IN IP4", NULL))
-            return AVPROBE_SCORE_MAX / 2;
-
-        while (p < p_end - 1 && *p != '\n') p++;
-        if (++p >= p_end)
-            break;
-        if (*p == '\r')
-            p++;
-    }
-    return 0;
-}
-
-#define SDP_MAX_SIZE 8192
-
-static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPStream *rtsp_st;
-    int size, i, err;
-    char *content;
-    char url[1024];
-
-    if (!ff_network_init())
-        return AVERROR(EIO);
-
-    /* read the whole sdp file */
-    /* XXX: better loading */
-    content = av_malloc(SDP_MAX_SIZE);
-    size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
-    if (size <= 0) {
-        av_free(content);
-        return AVERROR_INVALIDDATA;
-    }
-    content[size] ='\0';
-
-    sdp_parse(s, content);
-    av_free(content);
-
-    /* open each RTP stream */
-    for (i = 0; i < rt->nb_rtsp_streams; i++) {
-        rtsp_st = rt->rtsp_streams[i];
-
-        ff_url_join(url, sizeof(url), "rtp", NULL,
-                    inet_ntoa(rtsp_st->sdp_ip), rtsp_st->sdp_port,
-                    "?localport=%d&ttl=%d", rtsp_st->sdp_port,
-                    rtsp_st->sdp_ttl);
-        if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
-            err = AVERROR_INVALIDDATA;
-            goto fail;
-        }
-        if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
-            goto fail;
-    }
-    return 0;
-fail:
-    ff_rtsp_close_streams(s);
-    ff_network_close();
-    return err;
-}
-
-static int sdp_read_close(AVFormatContext *s)
-{
-    ff_rtsp_close_streams(s);
-    ff_network_close();
-    return 0;
-}
-
-AVInputFormat sdp_demuxer = {
-    "sdp",
-    NULL_IF_CONFIG_SMALL("SDP"),
-    sizeof(RTSPState),
-    sdp_probe,
-    sdp_read_header,
-    rtsp_fetch_packet,
-    sdp_read_close,
-};
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
deleted file mode 100644
index 357d3bf..0000000
--- a/libavformat/rtsp.h
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * RTSP definitions
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef AVFORMAT_RTSP_H
-#define AVFORMAT_RTSP_H
-
-#include <stdint.h>
-#include "avformat.h"
-#include "rtspcodes.h"
-#include "rtpdec.h"
-#include "network.h"
-#include "httpauth.h"
-
-/**
- * Network layer over which RTP/etc packet data will be transported.
- */
-enum RTSPLowerTransport {
-    RTSP_LOWER_TRANSPORT_UDP = 0,           /**< UDP/unicast */
-    RTSP_LOWER_TRANSPORT_TCP = 1,           /**< TCP; interleaved in RTSP */
-    RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, /**< UDP/multicast */
-    RTSP_LOWER_TRANSPORT_NB
-};
-
-/**
- * Packet profile of the data that we will be receiving. Real servers
- * commonly send RDT (although they can sometimes send RTP as well),
- * whereas most others will send RTP.
- */
-enum RTSPTransport {
-    RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP */
-    RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport */
-    RTSP_TRANSPORT_NB
-};
-
-#define RTSP_DEFAULT_PORT   554
-#define RTSP_MAX_TRANSPORTS 8
-#define RTSP_TCP_MAX_PACKET_SIZE 1472
-#define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2
-#define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100
-#define RTSP_RTP_PORT_MIN 5000
-#define RTSP_RTP_PORT_MAX 10000
-
-/**
- * This describes a single item in the "Transport:" line of one stream as
- * negotiated by the SETUP RTSP command. Multiple transports are comma-
- * separated ("Transport: x-read-rdt/tcp;interleaved=0-1,rtp/avp/udp;
- * client_port=1000-1001;server_port=1800-1801") and described in separate
- * RTSPTransportFields.
- */
-typedef struct RTSPTransportField {
-    /** interleave ids, if TCP transport; each TCP/RTSP data packet starts
-     * with a '$', stream length and stream ID. If the stream ID is within
-     * the range of this interleaved_min-max, then the packet belongs to
-     * this stream. */
-    int interleaved_min, interleaved_max;
-
-    /** UDP multicast port range; the ports to which we should connect to
-     * receive multicast UDP data. */
-    int port_min, port_max;
-
-    /** UDP client ports; these should be the local ports of the UDP RTP
-     * (and RTCP) sockets over which we receive RTP/RTCP data. */
-    int client_port_min, client_port_max;
-
-    /** UDP unicast server port range; the ports to which we should connect
-     * to receive unicast UDP RTP/RTCP data. */
-    int server_port_min, server_port_max;
-
-    /** time-to-live value (required for multicast); the amount of HOPs that
-     * packets will be allowed to make before being discarded. */
-    int ttl;
-
-    uint32_t destination; /**< destination IP address */
-
-    /** data/packet transport protocol; e.g. RTP or RDT */
-    enum RTSPTransport transport;
-
-    /** network layer transport protocol; e.g. TCP or UDP uni-/multicast */
-    enum RTSPLowerTransport lower_transport;
-} RTSPTransportField;
-
-/**
- * This describes the server response to each RTSP command.
- */
-typedef struct RTSPMessageHeader {
-    /** length of the data following this header */
-    int content_length;
-
-    enum RTSPStatusCode status_code; /**< response code from server */
-
-    /** number of items in the 'transports' variable below */
-    int nb_transports;
-
-    /** Time range of the streams that the server will stream. In
-     * AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */
-    int64_t range_start, range_end;
-
-    /** describes the complete "Transport:" line of the server in response
-     * to a SETUP RTSP command by the client */
-    RTSPTransportField transports[RTSP_MAX_TRANSPORTS];
-
-    int seq;                         /**< sequence number */
-
-    /** the "Session:" field. This value is initially set by the server and
-     * should be re-transmitted by the client in every RTSP command. */
-    char session_id[512];
-
-    /** the "Location:" field. This value is used to handle redirection.
-     */
-    char location[4096];
-
-    /** the "RealChallenge1:" field from the server */
-    char real_challenge[64];
-
-    /** the "Server: field, which can be used to identify some special-case
-     * servers that are not 100% standards-compliant. We use this to identify
-     * Windows Media Server, which has a value "WMServer/v.e.r.sion", where
-     * version is a sequence of digits (e.g. 9.0.0.3372). Helix/Real servers
-     * use something like "Helix [..] Server Version v.e.r.sion (platform)
-     * (RealServer compatible)" or "RealServer Version v.e.r.sion (platform)",
-     * where platform is the output of $uname -msr | sed 's/ /-/g'. */
-    char server[64];
-
-    /** The "timeout" comes as part of the server response to the "SETUP"
-     * command, in the "Session: <xyz>[;timeout=<value>]" line. It is the
-     * time, in seconds, that the server will go without traffic over the
-     * RTSP/TCP connection before it closes the connection. To prevent
-     * this, sent dummy requests (e.g. OPTIONS) with intervals smaller
-     * than this value. */
-    int timeout;
-
-    /** The "Notice" or "X-Notice" field value. See
-     * http://tools.ietf.org/html/draft-stiemerling-rtsp-announce-00
-     * for a complete list of supported values. */
-    int notice;
-} RTSPMessageHeader;
-
-/**
- * Client state, i.e. whether we are currently receiving data (PLAYING) or
- * setup-but-not-receiving (PAUSED). State can be changed in applications
- * by calling av_read_play/pause().
- */
-enum RTSPClientState {
-    RTSP_STATE_IDLE,    /**< not initialized */
-    RTSP_STATE_STREAMING, /**< initialized and sending/receiving data */
-    RTSP_STATE_PAUSED,  /**< initialized, but not receiving data */
-    RTSP_STATE_SEEKING, /**< initialized, requesting a seek */
-};
-
-/**
- * Identifies particular servers that require special handling, such as
- * standards-incompliant "Transport:" lines in the SETUP request.
- */
-enum RTSPServerType {
-    RTSP_SERVER_RTP,  /**< Standards-compliant RTP-server */
-    RTSP_SERVER_REAL, /**< Realmedia-style server */
-    RTSP_SERVER_WMS,  /**< Windows Media server */
-    RTSP_SERVER_NB
-};
-
-/**
- * Private data for the RTSP demuxer.
- *
- * @todo Use ByteIOContext instead of URLContext
- */
-typedef struct RTSPState {
-    URLContext *rtsp_hd; /* RTSP TCP connexion handle */
-
-    /** number of items in the 'rtsp_streams' variable */
-    int nb_rtsp_streams;
-
-    struct RTSPStream **rtsp_streams; /**< streams in this session */
-
-    /** indicator of whether we are currently receiving data from the
-     * server. Basically this isn't more than a simple cache of the
-     * last PLAY/PAUSE command sent to the server, to make sure we don't
-     * send 2x the same unexpectedly or commands in the wrong state. */
-    enum RTSPClientState state;
-
-    /** the seek value requested when calling av_seek_frame(). This value
-     * is subsequently used as part of the "Range" parameter when emitting
-     * the RTSP PLAY command. If we are currently playing, this command is
-     * called instantly. If we are currently paused, this command is called
-     * whenever we resume playback. Either way, the value is only used once,
-     * see rtsp_read_play() and rtsp_read_seek(). */
-    int64_t seek_timestamp;
-
-    /* XXX: currently we use unbuffered input */
-    //    ByteIOContext rtsp_gb;
-
-    int seq;                          /**< RTSP command sequence number */
-
-    /** copy of RTSPMessageHeader->session_id, i.e. the server-provided session
-     * identifier that the client should re-transmit in each RTSP command */
-    char session_id[512];
-
-    /** copy of RTSPMessageHeader->timeout, i.e. the time (in seconds) that
-     * the server will go without traffic on the RTSP/TCP line before it
-     * closes the connection. */
-    int timeout;
-
-    /** timestamp of the last RTSP command that we sent to the RTSP server.
-     * This is used to calculate when to send dummy commands to keep the
-     * connection alive, in conjunction with timeout. */
-    int64_t last_cmd_time;
-
-    /** the negotiated data/packet transport protocol; e.g. RTP or RDT */
-    enum RTSPTransport transport;
-
-    /** the negotiated network layer transport protocol; e.g. TCP or UDP
-     * uni-/multicast */
-    enum RTSPLowerTransport lower_transport;
-
-    /** brand of server that we're talking to; e.g. WMS, REAL or other.
-     * Detected based on the value of RTSPMessageHeader->server or the presence
-     * of RTSPMessageHeader->real_challenge */
-    enum RTSPServerType server_type;
-
-    /** plaintext authorization line (username:password) */
-    char auth[128];
-
-    /** authentication state */
-    HTTPAuthState auth_state;
-
-    /** The last reply of the server to a RTSP command */
-    char last_reply[2048]; /* XXX: allocate ? */
-
-    /** RTSPStream->transport_priv of the last stream that we read a
-     * packet from */
-    void *cur_transport_priv;
-
-    /** The following are used for Real stream selection */
-    //@{
-    /** whether we need to send a "SET_PARAMETER Subscribe:" command */
-    int need_subscription;
-
-    /** stream setup during the last frame read. This is used to detect if
-     * we need to subscribe or unsubscribe to any new streams. */
-    enum AVDiscard real_setup_cache[MAX_STREAMS];
-
-    /** the last value of the "SET_PARAMETER Subscribe:" RTSP command.
-     * this is used to send the same "Unsubscribe:" if stream setup changed,
-     * before sending a new "Subscribe:" command. */
-    char last_subscription[1024];
-    //@}
-
-    /** The following are used for RTP/ASF streams */
-    //@{
-    /** ASF demuxer context for the embedded ASF stream from WMS servers */
-    AVFormatContext *asf_ctx;
-
-    /** cache for position of the asf demuxer, since we load a new
-     * data packet in the bytecontext for each incoming RTSP packet. */
-    uint64_t asf_pb_pos;
-    //@}
-
-    /** some MS RTSP streams contain a URL in the SDP that we need to use
-     * for all subsequent RTSP requests, rather than the input URI; in
-     * other cases, this is a copy of AVFormatContext->filename. */
-    char control_uri[1024];
-
-    /** The synchronized start time of the output streams. */
-    int64_t start_time;
-} RTSPState;
-
-/**
- * Describes a single stream, as identified by a single m= line block in the
- * SDP content. In the case of RDT, one RTSPStream can represent multiple
- * AVStreams. In this case, each AVStream in this set has similar content
- * (but different codec/bitrate).
- */
-typedef struct RTSPStream {
-    URLContext *rtp_handle;   /**< RTP stream handle (if UDP) */
-    void *transport_priv; /**< RTP/RDT parse context if input, RTP AVFormatContext if output */
-
-    /** corresponding stream index, if any. -1 if none (MPEG2TS case) */
-    int stream_index;
-
-    /** interleave IDs; copies of RTSPTransportField->interleaved_min/max
-     * for the selected transport. Only used for TCP. */
-    int interleaved_min, interleaved_max;
-
-    char control_url[1024];   /**< url for this stream (from SDP) */
-
-    /** The following are used only in SDP, not RTSP */
-    //@{
-    int sdp_port;             /**< port (from SDP content) */
-    struct in_addr sdp_ip;    /**< IP address (from SDP content) */
-    int sdp_ttl;              /**< IP Time-To-Live (from SDP content) */
-    int sdp_payload_type;     /**< payload type */
-    //@}
-
-    /** rtp payload parsing infos from SDP (i.e. mapping between private
-     * payload IDs and media-types (string), so that we can derive what
-     * type of payload we're dealing with (and how to parse it). */
-    RTPPayloadData rtp_payload_data;
-
-    /** The following are used for dynamic protocols (rtp_*.c/rdt.c) */
-    //@{
-    /** handler structure */
-    RTPDynamicProtocolHandler *dynamic_handler;
-
-    /** private data associated with the dynamic protocol */
-    PayloadContext *dynamic_protocol_context;
-    //@}
-} RTSPStream;
-
-void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
-                        HTTPAuthState *auth_state);
-
-#if LIBAVFORMAT_VERSION_INT < (53 << 16)
-extern int rtsp_default_protocols;
-#endif
-extern int rtsp_rtp_port_min;
-extern int rtsp_rtp_port_max;
-
-/**
- * Send a command to the RTSP server without waiting for the reply.
- *
- * @param s RTSP (de)muxer context
- * @param method the method for the request
- * @param url the target url for the request
- * @param headers extra header lines to include in the request
- * @param send_content if non-null, the data to send as request body content
- * @param send_content_length the length of the send_content data, or 0 if
- *                            send_content is null
- */
-void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
-                                         const char *method, const char *url,
-                                         const char *headers,
-                                         const unsigned char *send_content,
-                                         int send_content_length);
-/**
- * Send a command to the RTSP server without waiting for the reply.
- *
- * @see rtsp_send_cmd_with_content_async
- */
-void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method,
-                            const char *url, const char *headers);
-
-/**
- * Send a command to the RTSP server and wait for the reply.
- *
- * @param s RTSP (de)muxer context
- * @param method the method for the request
- * @param url the target url for the request
- * @param headers extra header lines to include in the request
- * @param reply pointer where the RTSP message header will be stored
- * @param content_ptr pointer where the RTSP message body, if any, will
- *                    be stored (length is in reply)
- * @param send_content if non-null, the data to send as request body content
- * @param send_content_length the length of the send_content data, or 0 if
- *                            send_content is null
- */
-void ff_rtsp_send_cmd_with_content(AVFormatContext *s,
-                                   const char *method, const char *url,
-                                   const char *headers,
-                                   RTSPMessageHeader *reply,
-                                   unsigned char **content_ptr,
-                                   const unsigned char *send_content,
-                                   int send_content_length);
-
-/**
- * Send a command to the RTSP server and wait for the reply.
- *
- * @see rtsp_send_cmd_with_content
- */
-void ff_rtsp_send_cmd(AVFormatContext *s, const char *method,
-                      const char *url, const char *headers,
-                      RTSPMessageHeader *reply, unsigned char **content_ptr);
-
-/**
- * Read a RTSP message from the server, or prepare to read data
- * packets if we're reading data interleaved over the TCP/RTSP
- * connection as well.
- *
- * @param s RTSP (de)muxer context
- * @param reply pointer where the RTSP message header will be stored
- * @param content_ptr pointer where the RTSP message body, if any, will
- *                    be stored (length is in reply)
- * @param return_on_interleaved_data whether the function may return if we
- *                   encounter a data marker ('$'), which precedes data
- *                   packets over interleaved TCP/RTSP connections. If this
- *                   is set, this function will return 1 after encountering
- *                   a '$'. If it is not set, the function will skip any
- *                   data packets (if they are encountered), until a reply
- *                   has been fully parsed. If no more data is available
- *                   without parsing a reply, it will return an error.
- *
- * @return 1 if a data packets is ready to be received, -1 on error,
- *          and 0 on success.
- */
-int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply,
-                       unsigned char **content_ptr,
-                       int return_on_interleaved_data);
-
-/**
- * Skip a RTP/TCP interleaved packet.
- */
-void ff_rtsp_skip_packet(AVFormatContext *s);
-
-/**
- * Connect to the RTSP server and set up the individual media streams.
- * This can be used for both muxers and demuxers.
- *
- * @param s RTSP (de)muxer context
- *
- * @return 0 on success, < 0 on error. Cleans up all allocations done
- *          within the function on error.
- */
-int ff_rtsp_connect(AVFormatContext *s);
-
-/**
- * Close and free all streams within the RTSP (de)muxer
- *
- * @param s RTSP (de)muxer context
- */
-void ff_rtsp_close_streams(AVFormatContext *s);
-
-#endif /* AVFORMAT_RTSP_H */
diff --git a/libavformat/rtspcodes.h b/libavformat/rtspcodes.h
deleted file mode 100644
index 9ee96bf..0000000
--- a/libavformat/rtspcodes.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * RTSP definitions
- * copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_RTSPCODES_H
-#define AVFORMAT_RTSPCODES_H
-
-/** RTSP handling */
-enum RTSPStatusCode {
-RTSP_STATUS_OK              =200, /**< OK */
-RTSP_STATUS_METHOD          =405, /**< Method Not Allowed */
-RTSP_STATUS_BANDWIDTH       =453, /**< Not Enough Bandwidth */
-RTSP_STATUS_SESSION         =454, /**< Session Not Found */
-RTSP_STATUS_STATE           =455, /**< Method Not Valid in This State */
-RTSP_STATUS_AGGREGATE       =459, /**< Aggregate operation not allowed */
-RTSP_STATUS_ONLY_AGGREGATE  =460, /**< Only aggregate operation allowed */
-RTSP_STATUS_TRANSPORT       =461, /**< Unsupported transport */
-RTSP_STATUS_INTERNAL        =500, /**< Internal Server Error */
-RTSP_STATUS_SERVICE         =503, /**< Service Unavailable */
-RTSP_STATUS_VERSION         =505, /**< RTSP Version not supported */
-};
-
-#endif /* AVFORMAT_RTSPCODES_H */
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
deleted file mode 100644
index f7aadd6..0000000
--- a/libavformat/rtspenc.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * RTSP muxer
- * Copyright (c) 2010 Martin Storsjo
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-#include <sys/time.h>
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#include "network.h"
-#include "rtsp.h"
-#include <libavutil/intreadwrite.h>
-
-static int rtsp_write_record(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPMessageHeader reply1, *reply = &reply1;
-    char cmd[1024];
-
-    snprintf(cmd, sizeof(cmd),
-             "Range: npt=%0.3f-\r\n",
-             (double) 0);
-    ff_rtsp_send_cmd(s, "RECORD", rt->control_uri, cmd, reply, NULL);
-    if (reply->status_code != RTSP_STATUS_OK)
-        return -1;
-    rt->state = RTSP_STATE_STREAMING;
-    return 0;
-}
-
-static int rtsp_write_header(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-    int ret;
-
-    ret = ff_rtsp_connect(s);
-    if (ret)
-        return ret;
-
-    if (rtsp_write_record(s) < 0) {
-        ff_rtsp_close_streams(s);
-        url_close(rt->rtsp_hd);
-        return AVERROR_INVALIDDATA;
-    }
-    return 0;
-}
-
-static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
-{
-    RTSPState *rt = s->priv_data;
-    AVFormatContext *rtpctx = rtsp_st->transport_priv;
-    uint8_t *buf, *ptr;
-    int size;
-    uint8_t interleave_header[4];
-
-    size = url_close_dyn_buf(rtpctx->pb, &buf);
-    ptr = buf;
-    while (size > 4) {
-        uint32_t packet_len = AV_RB32(ptr);
-        int id;
-        ptr += 4;
-        size -= 4;
-        if (packet_len > size || packet_len < 2)
-            break;
-        if (ptr[1] >= 200 && ptr[1] <= 204)
-            id = rtsp_st->interleaved_max; /* RTCP */
-        else
-            id = rtsp_st->interleaved_min; /* RTP */
-        interleave_header[0] = '$';
-        interleave_header[1] = id;
-        AV_WB16(interleave_header + 2, packet_len);
-        url_write(rt->rtsp_hd, interleave_header, 4);
-        url_write(rt->rtsp_hd, ptr, packet_len);
-        ptr += packet_len;
-        size -= packet_len;
-    }
-    av_free(buf);
-    url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
-    return 0;
-}
-
-static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    RTSPState *rt = s->priv_data;
-    RTSPStream *rtsp_st;
-    fd_set rfds;
-    int n, tcp_fd;
-    struct timeval tv;
-    AVFormatContext *rtpctx;
-    AVPacket local_pkt;
-    int ret;
-
-    tcp_fd = url_get_file_handle(rt->rtsp_hd);
-
-    while (1) {
-        FD_ZERO(&rfds);
-        FD_SET(tcp_fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 0;
-        n = select(tcp_fd + 1, &rfds, NULL, NULL, &tv);
-        if (n <= 0)
-            break;
-        if (FD_ISSET(tcp_fd, &rfds)) {
-            RTSPMessageHeader reply;
-
-            /* Don't let ff_rtsp_read_reply handle interleaved packets,
-             * since it would block and wait for an RTSP reply on the socket
-             * (which may not be coming any time soon) if it handles
-             * interleaved packets internally. */
-            ret = ff_rtsp_read_reply(s, &reply, NULL, 1);
-            if (ret < 0)
-                return AVERROR(EPIPE);
-            if (ret == 1)
-                ff_rtsp_skip_packet(s);
-            /* XXX: parse message */
-            if (rt->state != RTSP_STATE_STREAMING)
-                return AVERROR(EPIPE);
-        }
-    }
-
-    if (pkt->stream_index < 0 || pkt->stream_index >= rt->nb_rtsp_streams)
-        return AVERROR_INVALIDDATA;
-    rtsp_st = rt->rtsp_streams[pkt->stream_index];
-    rtpctx = rtsp_st->transport_priv;
-
-    /* Use a local packet for writing to the chained muxer, otherwise
-     * the internal stream_index = 0 becomes visible to the muxer user. */
-    local_pkt = *pkt;
-    local_pkt.stream_index = 0;
-    ret = av_write_frame(rtpctx, &local_pkt);
-    /* av_write_frame does all the RTP packetization. If using TCP as
-     * transport, rtpctx->pb is only a dyn_packet_buf that queues up the
-     * packets, so we need to send them out on the TCP connection separately.
-     */
-    if (!ret && rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP)
-        ret = tcp_write_packet(s, rtsp_st);
-    return ret;
-}
-
-static int rtsp_write_close(AVFormatContext *s)
-{
-    RTSPState *rt = s->priv_data;
-
-    ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
-
-    ff_rtsp_close_streams(s);
-    url_close(rt->rtsp_hd);
-    ff_network_close();
-    return 0;
-}
-
-AVOutputFormat rtsp_muxer = {
-    "rtsp",
-    NULL_IF_CONFIG_SMALL("RTSP output format"),
-    NULL,
-    NULL,
-    sizeof(RTSPState),
-    CODEC_ID_PCM_MULAW,
-    CODEC_ID_NONE,
-    rtsp_write_header,
-    rtsp_write_packet,
-    rtsp_write_close,
-    .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
-};
-
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
deleted file mode 100644
index 6bf05db..0000000
--- a/libavformat/sdp.c
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * copyright (c) 2007 Luca Abeni
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-#include "libavutil/avstring.h"
-#include "libavutil/base64.h"
-#include "avformat.h"
-#include "internal.h"
-#include "avc.h"
-#include "rtp.h"
-#if CONFIG_NETWORK
-#include "network.h"
-#endif
-
-#if CONFIG_RTP_MUXER
-#define MAX_EXTRADATA_SIZE ((INT_MAX - 10) / 2)
-
-struct sdp_session_level {
-    int sdp_version;      /**< protocol version (currently 0) */
-    int id;               /**< session ID */
-    int version;          /**< session version */
-    int start_time;       /**< session start time (NTP time, in seconds),
-                               or 0 in case of permanent session */
-    int end_time;         /**< session end time (NTP time, in seconds),
-                               or 0 if the session is not bounded */
-    int ttl;              /**< TTL, in case of multicast stream */
-    const char *user;     /**< username of the session's creator */
-    const char *src_addr; /**< IP address of the machine from which the session was created */
-    const char *dst_addr; /**< destination IP address (can be multicast) */
-    const char *name;     /**< session name (can be an empty string) */
-};
-
-static void sdp_write_address(char *buff, int size, const char *dest_addr, int ttl)
-{
-    if (dest_addr) {
-        if (ttl > 0) {
-            av_strlcatf(buff, size, "c=IN IP4 %s/%d\r\n", dest_addr, ttl);
-        } else {
-            av_strlcatf(buff, size, "c=IN IP4 %s\r\n", dest_addr);
-        }
-    }
-}
-
-static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
-{
-    av_strlcatf(buff, size, "v=%d\r\n"
-                            "o=- %d %d IN IP4 %s\r\n"
-                            "s=%s\r\n",
-                            s->sdp_version,
-                            s->id, s->version, s->src_addr,
-                            s->name);
-    sdp_write_address(buff, size, s->dst_addr, s->ttl);
-    av_strlcatf(buff, size, "t=%d %d\r\n"
-                            "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\r\n",
-                            s->start_time, s->end_time);
-}
-
-#if CONFIG_NETWORK
-static void resolve_destination(char *dest_addr, int size)
-{
-    struct addrinfo hints, *ai, *cur;
-
-    if (!dest_addr[0])
-        return;
-
-    /* Resolve the destination, since it must be written
-     * as a numeric IP address in the SDP. */
-
-    memset(&hints, 0, sizeof(hints));
-    /* We only support IPv4 addresses in the SDP at the moment. */
-    hints.ai_family = AF_INET;
-    if (getaddrinfo(dest_addr, NULL, &hints, &ai))
-        return;
-    for (cur = ai; cur; cur = cur->ai_next) {
-        if (cur->ai_family == AF_INET) {
-            getnameinfo(cur->ai_addr, cur->ai_addrlen, dest_addr, size,
-                        NULL, 0, NI_NUMERICHOST);
-            break;
-        }
-    }
-    freeaddrinfo(ai);
-}
-#else
-static void resolve_destination(char *dest_addr, int size)
-{
-}
-#endif
-
-static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
-{
-    int port;
-    const char *p;
-    char proto[32];
-
-    ff_url_split(proto, sizeof(proto), NULL, 0, dest_addr, size, &port, NULL, 0, url);
-
-    *ttl = 0;
-
-    if (strcmp(proto, "rtp")) {
-        /* The url isn't for the actual rtp sessions,
-         * don't parse out anything else than the destination.
-         */
-        return 0;
-    }
-
-    p = strchr(url, '?');
-    if (p) {
-        char buff[64];
-        int is_multicast = find_info_tag(buff, sizeof(buff), "multicast", p);
-
-        if (is_multicast) {
-            if (find_info_tag(buff, sizeof(buff), "ttl", p)) {
-                *ttl = strtol(buff, NULL, 10);
-            } else {
-                *ttl = 5;
-            }
-        }
-    }
-
-    return port;
-}
-
-#define MAX_PSET_SIZE 1024
-static char *extradata2psets(AVCodecContext *c)
-{
-    char *psets, *p;
-    const uint8_t *r;
-    const char *pset_string = "; sprop-parameter-sets=";
-
-    if (c->extradata_size > MAX_EXTRADATA_SIZE) {
-        av_log(c, AV_LOG_ERROR, "Too much extradata!\n");
-
-        return NULL;
-    }
-
-    psets = av_mallocz(MAX_PSET_SIZE);
-    if (psets == NULL) {
-        av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the parameter sets.\n");
-        return NULL;
-    }
-    memcpy(psets, pset_string, strlen(pset_string));
-    p = psets + strlen(pset_string);
-    r = ff_avc_find_startcode(c->extradata, c->extradata + c->extradata_size);
-    while (r < c->extradata + c->extradata_size) {
-        const uint8_t *r1;
-        uint8_t nal_type;
-
-        while (!*(r++));
-        nal_type = *r & 0x1f;
-        r1 = ff_avc_find_startcode(r, c->extradata + c->extradata_size);
-        if (nal_type != 7 && nal_type != 8) { /* Only output SPS and PPS */
-            r = r1;
-            continue;
-        }
-        if (p != (psets + strlen(pset_string))) {
-            *p = ',';
-            p++;
-        }
-        if (av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r) == NULL) {
-            av_log(c, AV_LOG_ERROR, "Cannot Base64-encode %td %td!\n", MAX_PSET_SIZE - (p - psets), r1 - r);
-            av_free(psets);
-
-            return NULL;
-        }
-        p += strlen(p);
-        r = r1;
-    }
-
-    return psets;
-}
-
-static char *extradata2config(AVCodecContext *c)
-{
-    char *config;
-
-    if (c->extradata_size > MAX_EXTRADATA_SIZE) {
-        av_log(c, AV_LOG_ERROR, "Too much extradata!\n");
-
-        return NULL;
-    }
-    config = av_malloc(10 + c->extradata_size * 2);
-    if (config == NULL) {
-        av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the config info.\n");
-        return NULL;
-    }
-    memcpy(config, "; config=", 9);
-    ff_data_to_hex(config + 9, c->extradata, c->extradata_size, 0);
-    config[9 + c->extradata_size * 2] = 0;
-
-    return config;
-}
-
-static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type)
-{
-    char *config = NULL;
-
-    switch (c->codec_id) {
-        case CODEC_ID_H264:
-            if (c->extradata_size) {
-                config = extradata2psets(c);
-            }
-            av_strlcatf(buff, size, "a=rtpmap:%d H264/90000\r\n"
-                                    "a=fmtp:%d packetization-mode=1%s\r\n",
-                                     payload_type,
-                                     payload_type, config ? config : "");
-            break;
-        case CODEC_ID_H263:
-        case CODEC_ID_H263P:
-            av_strlcatf(buff, size, "a=rtpmap:%d H263-2000/90000\r\n", payload_type);
-            break;
-        case CODEC_ID_MPEG4:
-            if (c->extradata_size) {
-                config = extradata2config(c);
-            }
-            av_strlcatf(buff, size, "a=rtpmap:%d MP4V-ES/90000\r\n"
-                                    "a=fmtp:%d profile-level-id=1%s\r\n",
-                                     payload_type,
-                                     payload_type, config ? config : "");
-            break;
-        case CODEC_ID_AAC:
-            if (c->extradata_size) {
-                config = extradata2config(c);
-            } else {
-                /* FIXME: maybe we can forge config information based on the
-                 *        codec parameters...
-                 */
-                av_log(c, AV_LOG_ERROR, "AAC with no global headers is currently not supported.\n");
-                return NULL;
-            }
-            if (config == NULL) {
-                return NULL;
-            }
-            av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n"
-                                    "a=fmtp:%d profile-level-id=1;"
-                                    "mode=AAC-hbr;sizelength=13;indexlength=3;"
-                                    "indexdeltalength=3%s\r\n",
-                                     payload_type, c->sample_rate, c->channels,
-                                     payload_type, config);
-            break;
-        case CODEC_ID_PCM_S16BE:
-            if (payload_type >= RTP_PT_PRIVATE)
-                av_strlcatf(buff, size, "a=rtpmap:%d L16/%d/%d\r\n",
-                                         payload_type,
-                                         c->sample_rate, c->channels);
-            break;
-        case CODEC_ID_PCM_MULAW:
-            if (payload_type >= RTP_PT_PRIVATE)
-                av_strlcatf(buff, size, "a=rtpmap:%d PCMU/%d/%d\r\n",
-                                         payload_type,
-                                         c->sample_rate, c->channels);
-            break;
-        case CODEC_ID_PCM_ALAW:
-            if (payload_type >= RTP_PT_PRIVATE)
-                av_strlcatf(buff, size, "a=rtpmap:%d PCMA/%d/%d\r\n",
-                                         payload_type,
-                                         c->sample_rate, c->channels);
-            break;
-        case CODEC_ID_AMR_NB:
-            av_strlcatf(buff, size, "a=rtpmap:%d AMR/%d/%d\r\n"
-                                    "a=fmtp:%d octet-align=1\r\n",
-                                     payload_type, c->sample_rate, c->channels,
-                                     payload_type);
-            break;
-        case CODEC_ID_AMR_WB:
-            av_strlcatf(buff, size, "a=rtpmap:%d AMR-WB/%d/%d\r\n"
-                                    "a=fmtp:%d octet-align=1\r\n",
-                                     payload_type, c->sample_rate, c->channels,
-                                     payload_type);
-            break;
-        default:
-            /* Nothing special to do here... */
-            break;
-    }
-
-    av_free(config);
-
-    return buff;
-}
-
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c, const char *dest_addr, int port, int ttl)
-{
-    const char *type;
-    int payload_type;
-
-    payload_type = ff_rtp_get_payload_type(c);
-    if (payload_type < 0) {
-        payload_type = RTP_PT_PRIVATE + (c->codec_type == AVMEDIA_TYPE_AUDIO);
-    }
-
-    switch (c->codec_type) {
-        case AVMEDIA_TYPE_VIDEO   : type = "video"      ; break;
-        case AVMEDIA_TYPE_AUDIO   : type = "audio"      ; break;
-        case AVMEDIA_TYPE_SUBTITLE: type = "text"       ; break;
-        default                 : type = "application"; break;
-    }
-
-    av_strlcatf(buff, size, "m=%s %d RTP/AVP %d\r\n", type, port, payload_type);
-    sdp_write_address(buff, size, dest_addr, ttl);
-    if (c->bit_rate) {
-        av_strlcatf(buff, size, "b=AS:%d\r\n", c->bit_rate / 1000);
-    }
-
-    sdp_write_media_attributes(buff, size, c, payload_type);
-}
-
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
-{
-    AVMetadataTag *title = av_metadata_get(ac[0]->metadata, "title", NULL, 0);
-    struct sdp_session_level s;
-    int i, j, port, ttl;
-    char dst[32];
-
-    memset(buff, 0, size);
-    memset(&s, 0, sizeof(struct sdp_session_level));
-    s.user = "-";
-    s.src_addr = "127.0.0.1";    /* FIXME: Properly set this */
-    s.name = title ? title->value : "No Name";
-
-    port = 0;
-    ttl = 0;
-    if (n_files == 1) {
-        port = sdp_get_address(dst, sizeof(dst), &ttl, ac[0]->filename);
-        resolve_destination(dst, sizeof(dst));
-        if (dst[0]) {
-            s.dst_addr = dst;
-            s.ttl = ttl;
-        }
-    }
-    sdp_write_header(buff, size, &s);
-
-    dst[0] = 0;
-    for (i = 0; i < n_files; i++) {
-        if (n_files != 1) {
-            port = sdp_get_address(dst, sizeof(dst), &ttl, ac[i]->filename);
-            resolve_destination(dst, sizeof(dst));
-        }
-        for (j = 0; j < ac[i]->nb_streams; j++) {
-            ff_sdp_write_media(buff, size,
-                                  ac[i]->streams[j]->codec, dst[0] ? dst : NULL,
-                                  (port > 0) ? port + j * 2 : 0, ttl);
-            if (port <= 0) {
-                av_strlcatf(buff, size,
-                                   "a=control:streamid=%d\r\n", i + j);
-            }
-        }
-    }
-
-    return 0;
-}
-#else
-int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size)
-{
-    return AVERROR(ENOSYS);
-}
-
-void ff_sdp_write_media(char *buff, int size, AVCodecContext *c,
-                        const char *dest_addr, int port, int ttl)
-{
-}
-#endif
diff --git a/libavformat/seek.c b/libavformat/seek.c
deleted file mode 100644
index 26b622f..0000000
--- a/libavformat/seek.c
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * seek utility functions for use within format handlers
- *
- * Copyright (c) 2009 Ivan Schreter
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "seek.h"
-#include "libavutil/mem.h"
-#include "internal.h"
-
-// NOTE: implementation should be moved here in another patch, to keep patches
-// separated.
-
-/**
- * helper structure describing keyframe search state of one stream
- */
-typedef struct {
-    int64_t     pos_lo;      ///< position of the frame with low timestamp in file or INT64_MAX if not found (yet)
-    int64_t     ts_lo;       ///< frame presentation timestamp or same as pos_lo for byte seeking
-
-    int64_t     pos_hi;      ///< position of the frame with high timestamp in file or INT64_MAX if not found (yet)
-    int64_t     ts_hi;       ///< frame presentation timestamp or same as pos_hi for byte seeking
-
-    int64_t     last_pos;    ///< last known position of a frame, for multi-frame packets
-
-    int64_t     term_ts;     ///< termination timestamp (which TS we already read)
-    AVRational  term_ts_tb;  ///< timebase for term_ts
-    int64_t     first_ts;    ///< first packet timestamp in this iteration (to fill term_ts later)
-    AVRational  first_ts_tb; ///< timebase for first_ts
-
-    int         terminated;  ///< termination flag for the current iteration
-} AVSyncPoint;
-
-/**
- * Compute a distance between timestamps.
- *
- * Distances are only comparable, if same time bases are used for computing
- * distances.
- *
- * @param ts_hi high timestamp
- * @param tb_hi high timestamp time base
- * @param ts_lo low timestamp
- * @param tb_lo low timestamp time base
- * @return representation of distance between high and low timestamps
- */
-static int64_t ts_distance(int64_t ts_hi,
-                           AVRational tb_hi,
-                           int64_t ts_lo,
-                           AVRational tb_lo)
-{
-    int64_t hi, lo;
-
-    hi = ts_hi * tb_hi.num * tb_lo.den;
-    lo = ts_lo * tb_lo.num * tb_hi.den;
-
-    return hi - lo;
-}
-
-/**
- * Partial search for keyframes in multiple streams.
- *
- * This routine searches in each stream for the next lower and the next higher
- * timestamp compared to the given target timestamp. The search starts at the current
- * file position and ends at the file position, where all streams have already been
- * examined (or when all higher key frames are found in the first iteration).
- *
- * This routine is called iteratively with an exponential backoff to find the lower
- * timestamp.
- *
- * @param s                 format context
- * @param timestamp         target timestamp (or position, if AVSEEK_FLAG_BYTE)
- * @param timebase          time base for timestamps
- * @param flags             seeking flags
- * @param sync              array with information per stream
- * @param keyframes_to_find count of keyframes to find in total
- * @param found_lo          ptr to the count of already found low timestamp keyframes
- * @param found_hi          ptr to the count of already found high timestamp keyframes
- * @param first_iter        flag for first iteration
- */
-static void search_hi_lo_keyframes(AVFormatContext *s,
-                                   int64_t timestamp,
-                                   AVRational timebase,
-                                   int flags,
-                                   AVSyncPoint *sync,
-                                   int keyframes_to_find,
-                                   int *found_lo,
-                                   int *found_hi,
-                                   int first_iter)
-{
-    AVPacket pkt;
-    AVSyncPoint *sp;
-    AVStream *st;
-    int idx;
-    int flg;
-    int terminated_count = 0;
-    int64_t pos;
-    int64_t pts, dts;   // PTS/DTS from stream
-    int64_t ts;         // PTS in stream-local time base or position for byte seeking
-    AVRational ts_tb;   // Time base of the stream or 1:1 for byte seeking
-
-    for (;;) {
-        if (av_read_frame(s, &pkt) < 0) {
-            // EOF or error, make sure high flags are set
-            for (idx = 0; idx < s->nb_streams; ++idx) {
-                if (s->streams[idx]->discard < AVDISCARD_ALL) {
-                    sp = &sync[idx];
-                    if (sp->pos_hi == INT64_MAX) {
-                        // no high frame exists for this stream
-                        (*found_hi)++;
-                        sp->ts_hi  = INT64_MAX;
-                        sp->pos_hi = INT64_MAX - 1;
-                    }
-                }
-            }
-            break;
-        }
-
-        idx = pkt.stream_index;
-        st = s->streams[idx];
-        if (st->discard >= AVDISCARD_ALL)
-            // this stream is not active, skip packet
-            continue;
-
-        sp = &sync[idx];
-
-        flg = pkt.flags;
-        pos = pkt.pos;
-        pts = pkt.pts;
-        dts = pkt.dts;
-        if (pts == AV_NOPTS_VALUE)
-            // some formats don't provide PTS, only DTS
-            pts = dts;
-
-        av_free_packet(&pkt);
-
-        // Multi-frame packets only return position for the very first frame.
-        // Other frames are read with position == -1. Therefore, we note down
-        // last known position of a frame and use it if a frame without
-        // position arrives. In this way, it's possible to seek to proper
-        // position. Additionally, for parsers not providing position at all,
-        // an approximation will be used (starting position of this iteration).
-        if (pos < 0)
-            pos = sp->last_pos;
-        else
-            sp->last_pos = pos;
-
-        // Evaluate key frames with known TS (or any frames, if AVSEEK_FLAG_ANY set).
-        if (pts != AV_NOPTS_VALUE &&
-            ((flg & AV_PKT_FLAG_KEY) || (flags & AVSEEK_FLAG_ANY))) {
-            if (flags & AVSEEK_FLAG_BYTE) {
-                // for byte seeking, use position as timestamp
-                ts        = pos;
-                ts_tb.num = 1;
-                ts_tb.den = 1;
-            } else {
-                // otherwise, get stream time_base
-                ts    = pts;
-                ts_tb = st->time_base;
-            }
-
-            if (sp->first_ts == AV_NOPTS_VALUE) {
-                // Note down termination timestamp for the next iteration - when
-                // we encounter a packet with the same timestamp, we will ignore
-                // any further packets for this stream in next iteration (as they
-                // are already evaluated).
-                sp->first_ts    = ts;
-                sp->first_ts_tb = ts_tb;
-            }
-
-            if (sp->term_ts != AV_NOPTS_VALUE &&
-                av_compare_ts(ts, ts_tb, sp->term_ts, sp->term_ts_tb) > 0) {
-                // past the end position from last iteration, ignore packet
-                if (!sp->terminated) {
-                    sp->terminated = 1;
-                    ++terminated_count;
-                    if (sp->pos_hi == INT64_MAX) {
-                        // no high frame exists for this stream
-                        (*found_hi)++;
-                        sp->ts_hi  = INT64_MAX;
-                        sp->pos_hi = INT64_MAX - 1;
-                    }
-                    if (terminated_count == keyframes_to_find)
-                        break;  // all terminated, iteration done
-                }
-                continue;
-            }
-
-            if (av_compare_ts(ts, ts_tb, timestamp, timebase) <= 0) {
-                // keyframe found before target timestamp
-                if (sp->pos_lo == INT64_MAX) {
-                    // found first keyframe lower than target timestamp
-                    (*found_lo)++;
-                    sp->ts_lo  = ts;
-                    sp->pos_lo = pos;
-                } else if (sp->ts_lo < ts) {
-                    // found a better match (closer to target timestamp)
-                    sp->ts_lo  = ts;
-                    sp->pos_lo = pos;
-                }
-            }
-            if (av_compare_ts(ts, ts_tb, timestamp, timebase) >= 0) {
-                // keyframe found after target timestamp
-                if (sp->pos_hi == INT64_MAX) {
-                    // found first keyframe higher than target timestamp
-                    (*found_hi)++;
-                    sp->ts_hi  = ts;
-                    sp->pos_hi = pos;
-                    if (*found_hi >= keyframes_to_find && first_iter) {
-                        // We found high frame for all. They may get updated
-                        // to TS closer to target TS in later iterations (which
-                        // will stop at start position of previous iteration).
-                        break;
-                    }
-                } else if (sp->ts_hi > ts) {
-                    // found a better match (actually, shouldn't happen)
-                    sp->ts_hi  = ts;
-                    sp->pos_hi = pos;
-                }
-            }
-        }
-    }
-
-    // Clean up the parser.
-    ff_read_frame_flush(s);
-}
-
-int64_t ff_gen_syncpoint_search(AVFormatContext *s,
-                                int stream_index,
-                                int64_t pos,
-                                int64_t ts_min,
-                                int64_t ts,
-                                int64_t ts_max,
-                                int flags)
-{
-    AVSyncPoint *sync, *sp;
-    AVStream *st;
-    int i;
-    int keyframes_to_find = 0;
-    int64_t curpos;
-    int64_t step;
-    int found_lo = 0, found_hi = 0;
-    int64_t min_distance, distance;
-    int64_t min_pos = 0;
-    int first_iter = 1;
-    AVRational time_base;
-
-    if (flags & AVSEEK_FLAG_BYTE) {
-        // for byte seeking, we have exact 1:1 "timestamps" - positions
-        time_base.num = 1;
-        time_base.den = 1;
-    } else {
-        if (stream_index >= 0) {
-            // we have a reference stream, which time base we use
-            st = s->streams[stream_index];
-            time_base = st->time_base;
-        } else {
-            // no reference stream, use AV_TIME_BASE as reference time base
-            time_base.num = 1;
-            time_base.den = AV_TIME_BASE;
-        }
-    }
-
-    // Initialize syncpoint structures for each stream.
-    sync = av_malloc(s->nb_streams * sizeof(AVSyncPoint));
-    if (!sync)
-        // cannot allocate helper structure
-        return -1;
-
-    for (i = 0; i < s->nb_streams; ++i) {
-        st = s->streams[i];
-        sp = &sync[i];
-
-        sp->pos_lo     = INT64_MAX;
-        sp->ts_lo      = INT64_MAX;
-        sp->pos_hi     = INT64_MAX;
-        sp->ts_hi      = INT64_MAX;
-        sp->terminated = 0;
-        sp->first_ts   = AV_NOPTS_VALUE;
-        sp->term_ts    = ts_max;
-        sp->term_ts_tb = time_base;
-        sp->last_pos   = pos;
-
-        st->cur_dts    = AV_NOPTS_VALUE;
-
-        if (st->discard < AVDISCARD_ALL)
-            ++keyframes_to_find;
-    }
-
-    if (!keyframes_to_find) {
-        // no stream active, error
-        av_free(sync);
-        return -1;
-    }
-
-    // Find keyframes in all active streams with timestamp/position just before
-    // and just after requested timestamp/position.
-    step = s->pb->buffer_size;
-    curpos = FFMAX(pos - step / 2, 0);
-    for (;;) {
-        url_fseek(s->pb, curpos, SEEK_SET);
-        search_hi_lo_keyframes(s,
-                               ts, time_base,
-                               flags,
-                               sync,
-                               keyframes_to_find,
-                               &found_lo, &found_hi,
-                               first_iter);
-        if (found_lo == keyframes_to_find && found_hi == keyframes_to_find)
-            break;  // have all keyframes we wanted
-        if (!curpos)
-            break;  // cannot go back anymore
-
-        curpos = pos - step;
-        if (curpos < 0)
-            curpos = 0;
-        step *= 2;
-
-        // switch termination positions
-        for (i = 0; i < s->nb_streams; ++i) {
-            st = s->streams[i];
-            st->cur_dts = AV_NOPTS_VALUE;
-
-            sp = &sync[i];
-            if (sp->first_ts != AV_NOPTS_VALUE) {
-                sp->term_ts    = sp->first_ts;
-                sp->term_ts_tb = sp->first_ts_tb;
-                sp->first_ts   = AV_NOPTS_VALUE;
-            }
-            sp->terminated = 0;
-            sp->last_pos = curpos;
-        }
-        first_iter = 0;
-    }
-
-    // Find actual position to start decoding so that decoder synchronizes
-    // closest to ts and between ts_min and ts_max.
-    pos = INT64_MAX;
-
-    for (i = 0; i < s->nb_streams; ++i) {
-        st = s->streams[i];
-        if (st->discard < AVDISCARD_ALL) {
-            sp = &sync[i];
-            min_distance = INT64_MAX;
-            // Find timestamp closest to requested timestamp within min/max limits.
-            if (sp->pos_lo != INT64_MAX
-                && av_compare_ts(ts_min, time_base, sp->ts_lo, st->time_base) <= 0
-                && av_compare_ts(sp->ts_lo, st->time_base, ts_max, time_base) <= 0) {
-                // low timestamp is in range
-                min_distance = ts_distance(ts, time_base, sp->ts_lo, st->time_base);
-                min_pos = sp->pos_lo;
-            }
-            if (sp->pos_hi != INT64_MAX
-                && av_compare_ts(ts_min, time_base, sp->ts_hi, st->time_base) <= 0
-                && av_compare_ts(sp->ts_hi, st->time_base, ts_max, time_base) <= 0) {
-                // high timestamp is in range, check distance
-                distance = ts_distance(sp->ts_hi, st->time_base, ts, time_base);
-                if (distance < min_distance) {
-                    min_distance = distance;
-                    min_pos = sp->pos_hi;
-                }
-            }
-            if (min_distance == INT64_MAX) {
-                // no timestamp is in range, cannot seek
-                av_free(sync);
-                return -1;
-            }
-            if (min_pos < pos)
-                pos = min_pos;
-        }
-    }
-
-    url_fseek(s->pb, pos, SEEK_SET);
-    av_free(sync);
-    return pos;
-}
-
-AVParserState *ff_store_parser_state(AVFormatContext *s)
-{
-    int i;
-    AVStream *st;
-    AVParserStreamState *ss;
-    AVParserState *state = av_malloc(sizeof(AVParserState));
-    if (!state)
-        return NULL;
-
-    state->stream_states = av_malloc(sizeof(AVParserStreamState) * s->nb_streams);
-    if (!state->stream_states) {
-        av_free(state);
-        return NULL;
-    }
-
-    state->fpos = url_ftell(s->pb);
-
-    // copy context structures
-    state->cur_st                           = s->cur_st;
-    state->packet_buffer                    = s->packet_buffer;
-    state->raw_packet_buffer                = s->raw_packet_buffer;
-    state->raw_packet_buffer_remaining_size = s->raw_packet_buffer_remaining_size;
-
-    s->cur_st                               = NULL;
-    s->packet_buffer                        = NULL;
-    s->raw_packet_buffer                    = NULL;
-    s->raw_packet_buffer_remaining_size     = RAW_PACKET_BUFFER_SIZE;
-
-    // copy stream structures
-    state->nb_streams = s->nb_streams;
-    for (i = 0; i < s->nb_streams; i++) {
-        st = s->streams[i];
-        ss = &state->stream_states[i];
-
-        ss->parser        = st->parser;
-        ss->last_IP_pts   = st->last_IP_pts;
-        ss->cur_dts       = st->cur_dts;
-        ss->reference_dts = st->reference_dts;
-        ss->cur_ptr       = st->cur_ptr;
-        ss->cur_len       = st->cur_len;
-        ss->probe_packets = st->probe_packets;
-        ss->cur_pkt       = st->cur_pkt;
-
-        st->parser        = NULL;
-        st->last_IP_pts   = AV_NOPTS_VALUE;
-        st->cur_dts       = AV_NOPTS_VALUE;
-        st->reference_dts = AV_NOPTS_VALUE;
-        st->cur_ptr       = NULL;
-        st->cur_len       = 0;
-        st->probe_packets = MAX_PROBE_PACKETS;
-        av_init_packet(&st->cur_pkt);
-    }
-
-    return state;
-}
-
-void ff_restore_parser_state(AVFormatContext *s, AVParserState *state)
-{
-    int i;
-    AVStream *st;
-    AVParserStreamState *ss;
-    ff_read_frame_flush(s);
-
-    if (!state)
-        return;
-
-    url_fseek(s->pb, state->fpos, SEEK_SET);
-
-    // copy context structures
-    s->cur_st                           = state->cur_st;
-    s->packet_buffer                    = state->packet_buffer;
-    s->raw_packet_buffer                = state->raw_packet_buffer;
-    s->raw_packet_buffer_remaining_size = state->raw_packet_buffer_remaining_size;
-
-    // copy stream structures
-    for (i = 0; i < state->nb_streams; i++) {
-        st = s->streams[i];
-        ss = &state->stream_states[i];
-
-        st->parser        = ss->parser;
-        st->last_IP_pts   = ss->last_IP_pts;
-        st->cur_dts       = ss->cur_dts;
-        st->reference_dts = ss->reference_dts;
-        st->cur_ptr       = ss->cur_ptr;
-        st->cur_len       = ss->cur_len;
-        st->probe_packets = ss->probe_packets;
-        st->cur_pkt       = ss->cur_pkt;
-    }
-
-    av_free(state->stream_states);
-    av_free(state);
-}
-
-static void free_packet_list(AVPacketList *pktl)
-{
-    AVPacketList *cur;
-    while (pktl) {
-        cur = pktl;
-        pktl = cur->next;
-        av_free_packet(&cur->pkt);
-        av_free(cur);
-    }
-}
-
-void ff_free_parser_state(AVFormatContext *s, AVParserState *state)
-{
-    int i;
-    AVParserStreamState *ss;
-
-    if (!state)
-        return;
-
-    for (i = 0; i < state->nb_streams; i++) {
-        ss = &state->stream_states[i];
-        if (ss->parser)
-            av_parser_close(ss->parser);
-        av_free_packet(&ss->cur_pkt);
-    }
-
-    free_packet_list(state->packet_buffer);
-    free_packet_list(state->raw_packet_buffer);
-
-    av_free(state->stream_states);
-    av_free(state);
-}
-
diff --git a/libavformat/seek.h b/libavformat/seek.h
deleted file mode 100644
index 408f7d6..0000000
--- a/libavformat/seek.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * seek utility functions for use within format handlers
- *
- * Copyright (c) 2009 Ivan Schreter
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_SEEK_H
-#define AVFORMAT_SEEK_H
-
-#include "avformat.h"
-
-/**
- * structure to store parser state of one AVStream
- */
-typedef struct AVParserStreamState {
-    // saved members of AVStream
-    AVCodecParserContext   *parser;
-    AVPacket                cur_pkt;
-    int64_t                 last_IP_pts;
-    int64_t                 cur_dts;
-    int64_t                 reference_dts;
-    const uint8_t          *cur_ptr;
-    int                     cur_len;
-    int                     probe_packets;
-} AVParserStreamState;
-
-/**
- * structure to store parser state of AVFormat
- */
-typedef struct AVParserState {
-    int64_t         fpos;                   ///< file position at the time of call
-
-    // saved members of AVFormatContext
-    AVStream       *cur_st;                 ///< current stream.
-    AVPacketList   *packet_buffer;          ///< packet buffer of original state
-    AVPacketList   *raw_packet_buffer;      ///< raw packet buffer of original state
-    int raw_packet_buffer_remaining_size;   ///< remaining space in raw_packet_buffer
-
-    // saved info for streams
-    int                  nb_streams;        ///< number of streams with stored state
-    AVParserStreamState *stream_states;     ///< states of individual streams (array)
-} AVParserState;
-
-/**
- * Search for the sync point of all active streams.
- *
- * This routine is not supposed to be called directly by a user application,
- * but by demuxers.
- *
- * A sync point is defined as a point in stream, such that, when decoding start
- * from this point, the decoded output of all streams synchronizes closest
- * to the given timestamp ts. This routine also takes timestamp limits into account.
- * Thus, the output will synchronize no sooner than ts_min and no later than ts_max.
- *
- * @param stream_index stream index for time base reference of timestamps
- * @param pos          approximate position where to start searching for key frames
- * @param min_ts       minimum allowed timestamp (position, if AVSEEK_FLAG_BYTE set)
- * @param ts           target timestamp (or position, if AVSEEK_FLAG_BYTE set in flags)
- * @param max_ts       maximum allowed timestamp (position, if AVSEEK_FLAG_BYTE set)
- * @param flags        if AVSEEK_FLAG_ANY is set, seek to any frame, otherwise only
- *                     to a keyframe. If AVSEEK_FLAG_BYTE is set, search by
- *                     position, not by timestamp.
- * @return -1 if no such sync point could be found, otherwise stream position
- *                     (stream is repositioned to this position)
- */
-int64_t ff_gen_syncpoint_search(AVFormatContext *s,
-                                int stream_index,
-                                int64_t pos,
-                                int64_t min_ts,
-                                int64_t ts,
-                                int64_t max_ts,
-                                int flags);
-
-/**
- * Store current parser state and file position.
- *
- * This function can be used by demuxers before a destructive seeking algorithm
- * to store the parser state. Depending on the outcome of the seek, either the original
- * state can be restored or the new state kept and the original state freed.
- *
- * @note As a side effect, the original parser state is reset, since structures
- *       are relinked to the stored state instead of being deeply-copied (for
- *       performance reasons and to keep the code simple).
- *
- * @param s context from which to save state
- * @return parser state object or NULL if memory could not be allocated
- */
-AVParserState *ff_store_parser_state(AVFormatContext *s);
-
-/**
- * Restore previously saved parser state and file position.
- *
- * Saved state will be invalidated and freed by this call, since internal
- * structures will be relinked back to the stored state instead of being
- * deeply-copied.
- *
- * @param s     context to which to restore state (same as used for storing state)
- * @param state state to restore
- */
-void ff_restore_parser_state(AVFormatContext *s, AVParserState *state);
-
-/**
- * Free previously saved parser state.
- *
- * @param s     context to which the state belongs (same as used for storing state)
- * @param state state to free
- */
-void ff_free_parser_state(AVFormatContext *s, AVParserState *state);
-
-#endif /* AVFORMAT_SEEK_H */
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
deleted file mode 100644
index 6274041..0000000
--- a/libavformat/segafilm.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Sega FILM Format (CPK) Demuxer
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sega FILM (.cpk) file demuxer
- * by Mike Melanson (melanson at pcisys.net)
- * For more information regarding the Sega FILM file format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define FILM_TAG MKBETAG('F', 'I', 'L', 'M')
-#define FDSC_TAG MKBETAG('F', 'D', 'S', 'C')
-#define STAB_TAG MKBETAG('S', 'T', 'A', 'B')
-#define CVID_TAG MKBETAG('c', 'v', 'i', 'd')
-
-typedef struct {
-  int stream;
-  int64_t sample_offset;
-  unsigned int sample_size;
-  int64_t pts;
-  int keyframe;
-} film_sample;
-
-typedef struct FilmDemuxContext {
-    int video_stream_index;
-    int audio_stream_index;
-
-    enum CodecID audio_type;
-    unsigned int audio_samplerate;
-    unsigned int audio_bits;
-    unsigned int audio_channels;
-
-    enum CodecID video_type;
-    unsigned int sample_count;
-    film_sample *sample_table;
-    unsigned int current_sample;
-
-    unsigned int base_clock;
-    unsigned int version;
-
-    /* buffer used for interleaving stereo PCM data */
-    unsigned char *stereo_buffer;
-    int stereo_buffer_size;
-} FilmDemuxContext;
-
-static int film_probe(AVProbeData *p)
-{
-    if (AV_RB32(&p->buf[0]) != FILM_TAG)
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int film_read_header(AVFormatContext *s,
-                            AVFormatParameters *ap)
-{
-    FilmDemuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    unsigned char scratch[256];
-    int i;
-    unsigned int data_offset;
-    unsigned int audio_frame_counter;
-
-    film->sample_table = NULL;
-    film->stereo_buffer = NULL;
-    film->stereo_buffer_size = 0;
-
-    /* load the main FILM header */
-    if (get_buffer(pb, scratch, 16) != 16)
-        return AVERROR(EIO);
-    data_offset = AV_RB32(&scratch[4]);
-    film->version = AV_RB32(&scratch[8]);
-
-    /* load the FDSC chunk */
-    if (film->version == 0) {
-        /* special case for Lemmings .film files; 20-byte header */
-        if (get_buffer(pb, scratch, 20) != 20)
-            return AVERROR(EIO);
-        /* make some assumptions about the audio parameters */
-        film->audio_type = CODEC_ID_PCM_S8;
-        film->audio_samplerate = 22050;
-        film->audio_channels = 1;
-        film->audio_bits = 8;
-    } else {
-        /* normal Saturn .cpk files; 32-byte header */
-        if (get_buffer(pb, scratch, 32) != 32)
-            return AVERROR(EIO);
-        film->audio_samplerate = AV_RB16(&scratch[24]);
-        film->audio_channels = scratch[21];
-        film->audio_bits = scratch[22];
-        if (film->audio_bits == 8)
-            film->audio_type = CODEC_ID_PCM_S8;
-        else if (film->audio_bits == 16)
-            film->audio_type = CODEC_ID_PCM_S16BE;
-        else
-            film->audio_type = CODEC_ID_NONE;
-    }
-
-    if (AV_RB32(&scratch[0]) != FDSC_TAG)
-        return AVERROR_INVALIDDATA;
-
-    if (AV_RB32(&scratch[8]) == CVID_TAG) {
-        film->video_type = CODEC_ID_CINEPAK;
-    } else
-        film->video_type = CODEC_ID_NONE;
-
-    /* initialize the decoder streams */
-    if (film->video_type) {
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        film->video_stream_index = st->index;
-        st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        st->codec->codec_id = film->video_type;
-        st->codec->codec_tag = 0;  /* no fourcc */
-        st->codec->width = AV_RB32(&scratch[16]);
-        st->codec->height = AV_RB32(&scratch[12]);
-    }
-
-    if (film->audio_type) {
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        film->audio_stream_index = st->index;
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = film->audio_type;
-        st->codec->codec_tag = 1;
-        st->codec->channels = film->audio_channels;
-        st->codec->bits_per_coded_sample = film->audio_bits;
-        st->codec->sample_rate = film->audio_samplerate;
-        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-            st->codec->bits_per_coded_sample;
-        st->codec->block_align = st->codec->channels *
-            st->codec->bits_per_coded_sample / 8;
-    }
-
-    /* load the sample table */
-    if (get_buffer(pb, scratch, 16) != 16)
-        return AVERROR(EIO);
-    if (AV_RB32(&scratch[0]) != STAB_TAG)
-        return AVERROR_INVALIDDATA;
-    film->base_clock = AV_RB32(&scratch[8]);
-    film->sample_count = AV_RB32(&scratch[12]);
-    if(film->sample_count >= UINT_MAX / sizeof(film_sample))
-        return -1;
-    film->sample_table = av_malloc(film->sample_count * sizeof(film_sample));
-
-    for(i=0; i<s->nb_streams; i++)
-        av_set_pts_info(s->streams[i], 33, 1, film->base_clock);
-
-    audio_frame_counter = 0;
-    for (i = 0; i < film->sample_count; i++) {
-        /* load the next sample record and transfer it to an internal struct */
-        if (get_buffer(pb, scratch, 16) != 16) {
-            av_free(film->sample_table);
-            return AVERROR(EIO);
-        }
-        film->sample_table[i].sample_offset =
-            data_offset + AV_RB32(&scratch[0]);
-        film->sample_table[i].sample_size = AV_RB32(&scratch[4]);
-        if (AV_RB32(&scratch[8]) == 0xFFFFFFFF) {
-            film->sample_table[i].stream = film->audio_stream_index;
-            film->sample_table[i].pts = audio_frame_counter;
-            film->sample_table[i].pts *= film->base_clock;
-            film->sample_table[i].pts /= film->audio_samplerate;
-
-            audio_frame_counter += (film->sample_table[i].sample_size /
-                (film->audio_channels * film->audio_bits / 8));
-        } else {
-            film->sample_table[i].stream = film->video_stream_index;
-            film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
-            film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1;
-        }
-    }
-
-    film->current_sample = 0;
-
-    return 0;
-}
-
-static int film_read_packet(AVFormatContext *s,
-                            AVPacket *pkt)
-{
-    FilmDemuxContext *film = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    film_sample *sample;
-    int ret = 0;
-    int i;
-    int left, right;
-
-    if (film->current_sample >= film->sample_count)
-        return AVERROR(EIO);
-
-    sample = &film->sample_table[film->current_sample];
-
-    /* position the stream (will probably be there anyway) */
-    url_fseek(pb, sample->sample_offset, SEEK_SET);
-
-    /* do a special song and dance when loading FILM Cinepak chunks */
-    if ((sample->stream == film->video_stream_index) &&
-        (film->video_type == CODEC_ID_CINEPAK)) {
-        pkt->pos= url_ftell(pb);
-        if (av_new_packet(pkt, sample->sample_size))
-            return AVERROR(ENOMEM);
-        get_buffer(pb, pkt->data, sample->sample_size);
-    } else if ((sample->stream == film->audio_stream_index) &&
-        (film->audio_channels == 2)) {
-        /* stereo PCM needs to be interleaved */
-
-        if (av_new_packet(pkt, sample->sample_size))
-            return AVERROR(ENOMEM);
-
-        /* make sure the interleave buffer is large enough */
-        if (sample->sample_size > film->stereo_buffer_size) {
-            av_free(film->stereo_buffer);
-            film->stereo_buffer_size = sample->sample_size;
-            film->stereo_buffer = av_malloc(film->stereo_buffer_size);
-        }
-
-        pkt->pos= url_ftell(pb);
-        ret = get_buffer(pb, film->stereo_buffer, sample->sample_size);
-        if (ret != sample->sample_size)
-            ret = AVERROR(EIO);
-
-        left = 0;
-        right = sample->sample_size / 2;
-        for (i = 0; i < sample->sample_size; ) {
-            if (film->audio_bits == 8) {
-                pkt->data[i++] = film->stereo_buffer[left++];
-                pkt->data[i++] = film->stereo_buffer[right++];
-            } else {
-                pkt->data[i++] = film->stereo_buffer[left++];
-                pkt->data[i++] = film->stereo_buffer[left++];
-                pkt->data[i++] = film->stereo_buffer[right++];
-                pkt->data[i++] = film->stereo_buffer[right++];
-            }
-        }
-    } else {
-        ret= av_get_packet(pb, pkt, sample->sample_size);
-        if (ret != sample->sample_size)
-            ret = AVERROR(EIO);
-    }
-
-    pkt->stream_index = sample->stream;
-    pkt->pts = sample->pts;
-
-    film->current_sample++;
-
-    return ret;
-}
-
-static int film_read_close(AVFormatContext *s)
-{
-    FilmDemuxContext *film = s->priv_data;
-
-    av_free(film->sample_table);
-    av_free(film->stereo_buffer);
-
-    return 0;
-}
-
-AVInputFormat segafilm_demuxer = {
-    "film_cpk",
-    NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"),
-    sizeof(FilmDemuxContext),
-    film_probe,
-    film_read_header,
-    film_read_packet,
-    film_read_close,
-};
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
deleted file mode 100644
index c239f5c..0000000
--- a/libavformat/sierravmd.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Sierra VMD Format Demuxer
- * Copyright (c) 2004 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Sierra VMD file demuxer
- * by Vladimir "VAG" Gneushev (vagsoft at mail.ru)
- * for more information on the Sierra VMD file format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define VMD_HEADER_SIZE 0x0330
-#define BYTES_PER_FRAME_RECORD 16
-
-typedef struct {
-  int stream_index;
-  int64_t frame_offset;
-  unsigned int frame_size;
-  int64_t pts;
-  int keyframe;
-  unsigned char frame_record[BYTES_PER_FRAME_RECORD];
-} vmd_frame;
-
-typedef struct VmdDemuxContext {
-    int video_stream_index;
-    int audio_stream_index;
-
-    unsigned int frame_count;
-    unsigned int frames_per_block;
-    vmd_frame *frame_table;
-    unsigned int current_frame;
-    int is_indeo3;
-
-    int sample_rate;
-    int64_t audio_sample_counter;
-    int skiphdr;
-
-    unsigned char vmd_header[VMD_HEADER_SIZE];
-} VmdDemuxContext;
-
-static int vmd_probe(AVProbeData *p)
-{
-    int w, h;
-    if (p->buf_size < 16)
-        return 0;
-    /* check if the first 2 bytes of the file contain the appropriate size
-     * of a VMD header chunk */
-    if (AV_RL16(&p->buf[0]) != VMD_HEADER_SIZE - 2)
-        return 0;
-    w = AV_RL16(&p->buf[12]);
-    h = AV_RL16(&p->buf[14]);
-    if (!w || w > 2048 || !h || h > 2048)
-        return 0;
-
-    /* only return half certainty since this check is a bit sketchy */
-    return AVPROBE_SCORE_MAX / 2;
-}
-
-static int vmd_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    VmdDemuxContext *vmd = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st = NULL, *vst;
-    unsigned int toc_offset;
-    unsigned char *raw_frame_table;
-    int raw_frame_table_size;
-    int64_t current_offset;
-    int i, j;
-    unsigned int total_frames;
-    int64_t current_audio_pts = 0;
-    unsigned char chunk[BYTES_PER_FRAME_RECORD];
-    int num, den;
-    int sound_buffers;
-
-    /* fetch the main header, including the 2 header length bytes */
-    url_fseek(pb, 0, SEEK_SET);
-    if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
-        return AVERROR(EIO);
-
-    if(vmd->vmd_header[16] == 'i' && vmd->vmd_header[17] == 'v' && vmd->vmd_header[18] == '3')
-        vmd->is_indeo3 = 1;
-    else
-        vmd->is_indeo3 = 0;
-    /* start up the decoders */
-    vst = av_new_stream(s, 0);
-    if (!vst)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(vst, 33, 1, 10);
-    vmd->video_stream_index = vst->index;
-    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id = vmd->is_indeo3 ? CODEC_ID_INDEO3 : CODEC_ID_VMDVIDEO;
-    vst->codec->codec_tag = 0;  /* no fourcc */
-    vst->codec->width = AV_RL16(&vmd->vmd_header[12]);
-    vst->codec->height = AV_RL16(&vmd->vmd_header[14]);
-    if(vmd->is_indeo3 && vst->codec->width > 320){
-        vst->codec->width >>= 1;
-        vst->codec->height >>= 1;
-    }
-    vst->codec->extradata_size = VMD_HEADER_SIZE;
-    vst->codec->extradata = av_mallocz(VMD_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
-    memcpy(vst->codec->extradata, vmd->vmd_header, VMD_HEADER_SIZE);
-
-    /* if sample rate is 0, assume no audio */
-    vmd->sample_rate = AV_RL16(&vmd->vmd_header[804]);
-    if (vmd->sample_rate) {
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        vmd->audio_stream_index = st->index;
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        st->codec->codec_id = CODEC_ID_VMDAUDIO;
-        st->codec->codec_tag = 0;  /* no fourcc */
-        st->codec->channels = (vmd->vmd_header[811] & 0x80) ? 2 : 1;
-        st->codec->sample_rate = vmd->sample_rate;
-        st->codec->block_align = AV_RL16(&vmd->vmd_header[806]);
-        if (st->codec->block_align & 0x8000) {
-            st->codec->bits_per_coded_sample = 16;
-            st->codec->block_align = -(st->codec->block_align - 0x10000);
-        } else {
-            st->codec->bits_per_coded_sample = 8;
-        }
-        st->codec->bit_rate = st->codec->sample_rate *
-            st->codec->bits_per_coded_sample * st->codec->channels;
-
-        /* calculate pts */
-        num = st->codec->block_align;
-        den = st->codec->sample_rate * st->codec->channels;
-        av_reduce(&den, &num, den, num, (1UL<<31)-1);
-        av_set_pts_info(vst, 33, num, den);
-        av_set_pts_info(st, 33, num, den);
-    }
-
-    toc_offset = AV_RL32(&vmd->vmd_header[812]);
-    vmd->frame_count = AV_RL16(&vmd->vmd_header[6]);
-    vmd->frames_per_block = AV_RL16(&vmd->vmd_header[18]);
-    url_fseek(pb, toc_offset, SEEK_SET);
-
-    raw_frame_table = NULL;
-    vmd->frame_table = NULL;
-    sound_buffers = AV_RL16(&vmd->vmd_header[808]);
-    raw_frame_table_size = vmd->frame_count * 6;
-    if(vmd->frame_count * vmd->frames_per_block >= UINT_MAX / sizeof(vmd_frame) - sound_buffers){
-        av_log(s, AV_LOG_ERROR, "vmd->frame_count * vmd->frames_per_block too large\n");
-        return -1;
-    }
-    raw_frame_table = av_malloc(raw_frame_table_size);
-    vmd->frame_table = av_malloc((vmd->frame_count * vmd->frames_per_block + sound_buffers) * sizeof(vmd_frame));
-    if (!raw_frame_table || !vmd->frame_table) {
-        av_free(raw_frame_table);
-        av_free(vmd->frame_table);
-        return AVERROR(ENOMEM);
-    }
-    if (get_buffer(pb, raw_frame_table, raw_frame_table_size) !=
-        raw_frame_table_size) {
-        av_free(raw_frame_table);
-        av_free(vmd->frame_table);
-        return AVERROR(EIO);
-    }
-
-    total_frames = 0;
-    for (i = 0; i < vmd->frame_count; i++) {
-
-        current_offset = AV_RL32(&raw_frame_table[6 * i + 2]);
-
-        /* handle each entry in index block */
-        for (j = 0; j < vmd->frames_per_block; j++) {
-            int type;
-            uint32_t size;
-
-            get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD);
-            type = chunk[0];
-            size = AV_RL32(&chunk[2]);
-            if(!size && type != 1)
-                continue;
-            switch(type) {
-            case 1: /* Audio Chunk */
-                if (!st) break;
-                /* first audio chunk contains several audio buffers */
-                vmd->frame_table[total_frames].frame_offset = current_offset;
-                vmd->frame_table[total_frames].stream_index = vmd->audio_stream_index;
-                vmd->frame_table[total_frames].frame_size = size;
-                memcpy(vmd->frame_table[total_frames].frame_record, chunk, BYTES_PER_FRAME_RECORD);
-                vmd->frame_table[total_frames].pts = current_audio_pts;
-                total_frames++;
-                if(!current_audio_pts)
-                    current_audio_pts += sound_buffers;
-                else
-                    current_audio_pts++;
-                break;
-            case 2: /* Video Chunk */
-                vmd->frame_table[total_frames].frame_offset = current_offset;
-                vmd->frame_table[total_frames].stream_index = vmd->video_stream_index;
-                vmd->frame_table[total_frames].frame_size = size;
-                memcpy(vmd->frame_table[total_frames].frame_record, chunk, BYTES_PER_FRAME_RECORD);
-                vmd->frame_table[total_frames].pts = i;
-                total_frames++;
-                break;
-            }
-            current_offset += size;
-        }
-    }
-
-    av_free(raw_frame_table);
-
-    vmd->current_frame = 0;
-    vmd->frame_count = total_frames;
-
-    return 0;
-}
-
-static int vmd_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    VmdDemuxContext *vmd = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret = 0;
-    vmd_frame *frame;
-
-    if (vmd->current_frame >= vmd->frame_count)
-        return AVERROR(EIO);
-
-    frame = &vmd->frame_table[vmd->current_frame];
-    /* position the stream (will probably be there already) */
-    url_fseek(pb, frame->frame_offset, SEEK_SET);
-
-    if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
-        return AVERROR(ENOMEM);
-    pkt->pos= url_ftell(pb);
-    memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
-    if(vmd->is_indeo3)
-        ret = get_buffer(pb, pkt->data, frame->frame_size);
-    else
-        ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD,
-            frame->frame_size);
-
-    if (ret != frame->frame_size) {
-        av_free_packet(pkt);
-        ret = AVERROR(EIO);
-    }
-    pkt->stream_index = frame->stream_index;
-    pkt->pts = frame->pts;
-    av_log(s, AV_LOG_DEBUG, " dispatching %s frame with %d bytes and pts %"PRId64"\n",
-            (frame->frame_record[0] == 0x02) ? "video" : "audio",
-            frame->frame_size + BYTES_PER_FRAME_RECORD,
-            pkt->pts);
-
-    vmd->current_frame++;
-
-    return ret;
-}
-
-static int vmd_read_close(AVFormatContext *s)
-{
-    VmdDemuxContext *vmd = s->priv_data;
-
-    av_free(vmd->frame_table);
-
-    return 0;
-}
-
-AVInputFormat vmd_demuxer = {
-    "vmd",
-    NULL_IF_CONFIG_SMALL("Sierra VMD format"),
-    sizeof(VmdDemuxContext),
-    vmd_probe,
-    vmd_read_header,
-    vmd_read_packet,
-    vmd_read_close,
-};
diff --git a/libavformat/siff.c b/libavformat/siff.c
deleted file mode 100644
index 3a0b9bb..0000000
--- a/libavformat/siff.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Beam Software SIFF demuxer
- * Copyright (c) 2007 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-enum SIFFTags{
-    TAG_SIFF = MKTAG('S', 'I', 'F', 'F'),
-    TAG_BODY = MKTAG('B', 'O', 'D', 'Y'),
-    TAG_VBHD = MKTAG('V', 'B', 'H', 'D'),
-    TAG_SHDR = MKTAG('S', 'H', 'D', 'R'),
-    TAG_VBV1 = MKTAG('V', 'B', 'V', '1'),
-    TAG_SOUN = MKTAG('S', 'O', 'U', 'N'),
-};
-
-enum VBFlags{
-    VB_HAS_GMC     = 0x01,
-    VB_HAS_AUDIO   = 0x04,
-    VB_HAS_VIDEO   = 0x08,
-    VB_HAS_PALETTE = 0x10,
-    VB_HAS_LENGTH  = 0x20
-};
-
-typedef struct SIFFContext{
-    int frames;
-    int cur_frame;
-    int rate;
-    int bits;
-    int block_align;
-
-    int has_video;
-    int has_audio;
-
-    int curstrm;
-    int pktsize;
-    int gmcsize;
-    int sndsize;
-
-    int flags;
-    uint8_t gmc[4];
-}SIFFContext;
-
-static int siff_probe(AVProbeData *p)
-{
-    uint32_t tag = AV_RL32(p->buf + 8);
-    /* check file header */
-    if (AV_RL32(p->buf) != TAG_SIFF ||
-        (tag != TAG_VBV1 && tag != TAG_SOUN))
-        return 0;
-    return AVPROBE_SCORE_MAX;
-}
-
-static int create_audio_stream(AVFormatContext *s, SIFFContext *c)
-{
-    AVStream *ast;
-    ast = av_new_stream(s, 0);
-    if (!ast)
-        return -1;
-    ast->codec->codec_type      = AVMEDIA_TYPE_AUDIO;
-    ast->codec->codec_id        = CODEC_ID_PCM_U8;
-    ast->codec->channels        = 1;
-    ast->codec->bits_per_coded_sample = c->bits;
-    ast->codec->sample_rate     = c->rate;
-    ast->codec->frame_size      = c->block_align;
-    av_set_pts_info(ast, 16, 1, c->rate);
-    return 0;
-}
-
-static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb)
-{
-    AVStream *st;
-    int width, height;
-
-    if (get_le32(pb) != TAG_VBHD){
-        av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
-        return -1;
-    }
-    if(get_be32(pb) != 32){
-        av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
-        return -1;
-    }
-    if(get_le16(pb) != 1){
-        av_log(s, AV_LOG_ERROR, "Incorrect header version\n");
-        return -1;
-    }
-    width = get_le16(pb);
-    height = get_le16(pb);
-    url_fskip(pb, 4);
-    c->frames = get_le16(pb);
-    if(!c->frames){
-        av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
-        return -1;
-    }
-    c->bits = get_le16(pb);
-    c->rate = get_le16(pb);
-    c->block_align = c->rate * (c->bits >> 3);
-
-    url_fskip(pb, 16); //zeroes
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id   = CODEC_ID_VB;
-    st->codec->codec_tag  = MKTAG('V', 'B', 'V', '1');
-    st->codec->width      = width;
-    st->codec->height     = height;
-    st->codec->pix_fmt    = PIX_FMT_PAL8;
-    av_set_pts_info(st, 16, 1, 12);
-
-    c->cur_frame = 0;
-    c->has_video = 1;
-    c->has_audio = !!c->rate;
-    c->curstrm = -1;
-    if (c->has_audio && create_audio_stream(s, c) < 0)
-        return -1;
-    return 0;
-}
-
-static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb)
-{
-    if (get_le32(pb) != TAG_SHDR){
-        av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
-        return -1;
-    }
-    if(get_be32(pb) != 8){
-        av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
-        return -1;
-    }
-    url_fskip(pb, 4); //unknown value
-    c->rate = get_le16(pb);
-    c->bits = get_le16(pb);
-    c->block_align = c->rate * (c->bits >> 3);
-    return create_audio_stream(s, c);
-}
-
-static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    SIFFContext *c = s->priv_data;
-    uint32_t tag;
-
-    if (get_le32(pb) != TAG_SIFF)
-        return -1;
-    url_fskip(pb, 4); //ignore size
-    tag = get_le32(pb);
-
-    if (tag != TAG_VBV1 && tag != TAG_SOUN){
-        av_log(s, AV_LOG_ERROR, "Not a VBV file\n");
-        return -1;
-    }
-
-    if (tag == TAG_VBV1 && siff_parse_vbv1(s, c, pb) < 0)
-        return -1;
-    if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0)
-        return -1;
-    if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){
-        av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
-        return -1;
-    }
-    url_fskip(pb, 4); //ignore size
-
-    return 0;
-}
-
-static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    SIFFContext *c = s->priv_data;
-    int size;
-
-    if (c->has_video){
-        if (c->cur_frame >= c->frames)
-            return AVERROR(EIO);
-        if (c->curstrm == -1){
-            c->pktsize = get_le32(s->pb) - 4;
-            c->flags = get_le16(s->pb);
-            c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
-            if (c->gmcsize)
-                get_buffer(s->pb, c->gmc, c->gmcsize);
-            c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
-            c->curstrm = !!(c->flags & VB_HAS_AUDIO);
-        }
-
-        if (!c->curstrm){
-            size = c->pktsize - c->sndsize;
-            if (av_new_packet(pkt, size) < 0)
-                return AVERROR(ENOMEM);
-            AV_WL16(pkt->data, c->flags);
-            if (c->gmcsize)
-                memcpy(pkt->data + 2, c->gmc, c->gmcsize);
-            get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
-            pkt->stream_index = 0;
-            c->curstrm = -1;
-        }else{
-            if (av_get_packet(s->pb, pkt, c->sndsize - 4) < 0)
-                return AVERROR(EIO);
-            pkt->stream_index = 1;
-            c->curstrm = 0;
-        }
-        if(!c->cur_frame || c->curstrm)
-            pkt->flags |= AV_PKT_FLAG_KEY;
-        if (c->curstrm == -1)
-            c->cur_frame++;
-    }else{
-        size = av_get_packet(s->pb, pkt, c->block_align);
-        if(size <= 0)
-            return AVERROR(EIO);
-    }
-    return pkt->size;
-}
-
-AVInputFormat siff_demuxer = {
-    "siff",
-    NULL_IF_CONFIG_SMALL("Beam Software SIFF"),
-    sizeof(SIFFContext),
-    siff_probe,
-    siff_read_header,
-    siff_read_packet,
-    .extensions = "vb,son"
-};
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
deleted file mode 100644
index 0dcc286..0000000
--- a/libavformat/smacker.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Smacker demuxer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Based on http://wiki.multimedia.cx/index.php?title=Smacker
- */
-
-#include "libavutil/bswap.h"
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define SMACKER_PAL 0x01
-#define SMACKER_FLAG_RING_FRAME 0x01
-
-enum SAudFlags {
-    SMK_AUD_PACKED  = 0x80000000,
-    SMK_AUD_16BITS  = 0x20000000,
-    SMK_AUD_STEREO  = 0x10000000,
-    SMK_AUD_BINKAUD = 0x08000000,
-    SMK_AUD_USEDCT  = 0x04000000
-};
-
-typedef struct SmackerContext {
-    /* Smacker file header */
-    uint32_t magic;
-    uint32_t width, height;
-    uint32_t frames;
-    int      pts_inc;
-    uint32_t flags;
-    uint32_t audio[7];
-    uint32_t treesize;
-    uint32_t mmap_size, mclr_size, full_size, type_size;
-    uint32_t rates[7];
-    uint32_t pad;
-    /* frame info */
-    uint32_t *frm_size;
-    uint8_t  *frm_flags;
-    /* internal variables */
-    int cur_frame;
-    int is_ver4;
-    int64_t cur_pts;
-    /* current frame for demuxing */
-    uint8_t pal[768];
-    int indexes[7];
-    int videoindex;
-    uint8_t *bufs[7];
-    int buf_sizes[7];
-    int stream_id[7];
-    int curstream;
-    int64_t nextpos;
-    int64_t aud_pts[7];
-} SmackerContext;
-
-typedef struct SmackerFrame {
-    int64_t pts;
-    int stream;
-} SmackerFrame;
-
-/* palette used in Smacker */
-static const uint8_t smk_pal[64] = {
-    0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C,
-    0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C,
-    0x41, 0x45, 0x49, 0x4D, 0x51, 0x55, 0x59, 0x5D,
-    0x61, 0x65, 0x69, 0x6D, 0x71, 0x75, 0x79, 0x7D,
-    0x82, 0x86, 0x8A, 0x8E, 0x92, 0x96, 0x9A, 0x9E,
-    0xA2, 0xA6, 0xAA, 0xAE, 0xB2, 0xB6, 0xBA, 0xBE,
-    0xC3, 0xC7, 0xCB, 0xCF, 0xD3, 0xD7, 0xDB, 0xDF,
-    0xE3, 0xE7, 0xEB, 0xEF, 0xF3, 0xF7, 0xFB, 0xFF
-};
-
-
-static int smacker_probe(AVProbeData *p)
-{
-    if(p->buf[0] == 'S' && p->buf[1] == 'M' && p->buf[2] == 'K'
-        && (p->buf[3] == '2' || p->buf[3] == '4'))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    SmackerContext *smk = s->priv_data;
-    AVStream *st, *ast[7];
-    int i, ret;
-    int tbase;
-
-    /* read and check header */
-    smk->magic = get_le32(pb);
-    if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4'))
-        return -1;
-    smk->width = get_le32(pb);
-    smk->height = get_le32(pb);
-    smk->frames = get_le32(pb);
-    smk->pts_inc = (int32_t)get_le32(pb);
-    smk->flags = get_le32(pb);
-    if(smk->flags & SMACKER_FLAG_RING_FRAME)
-        smk->frames++;
-    for(i = 0; i < 7; i++)
-        smk->audio[i] = get_le32(pb);
-    smk->treesize = get_le32(pb);
-
-    if(smk->treesize >= UINT_MAX/4){ // smk->treesize + 16 must not overflow (this check is probably redundant)
-        av_log(s, AV_LOG_ERROR, "treesize too large\n");
-        return -1;
-    }
-
-//FIXME remove extradata "rebuilding"
-    smk->mmap_size = get_le32(pb);
-    smk->mclr_size = get_le32(pb);
-    smk->full_size = get_le32(pb);
-    smk->type_size = get_le32(pb);
-    for(i = 0; i < 7; i++)
-        smk->rates[i] = get_le32(pb);
-    smk->pad = get_le32(pb);
-    /* setup data */
-    if(smk->frames > 0xFFFFFF) {
-        av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames);
-        return -1;
-    }
-    smk->frm_size = av_malloc(smk->frames * 4);
-    smk->frm_flags = av_malloc(smk->frames);
-
-    smk->is_ver4 = (smk->magic != MKTAG('S', 'M', 'K', '2'));
-
-    /* read frame info */
-    for(i = 0; i < smk->frames; i++) {
-        smk->frm_size[i] = get_le32(pb);
-    }
-    for(i = 0; i < smk->frames; i++) {
-        smk->frm_flags[i] = get_byte(pb);
-    }
-
-    /* init video codec */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-    smk->videoindex = st->index;
-    st->codec->width = smk->width;
-    st->codec->height = smk->height;
-    st->codec->pix_fmt = PIX_FMT_PAL8;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_SMACKVIDEO;
-    st->codec->codec_tag = smk->magic;
-    /* Smacker uses 100000 as internal timebase */
-    if(smk->pts_inc < 0)
-        smk->pts_inc = -smk->pts_inc;
-    else
-        smk->pts_inc *= 100;
-    tbase = 100000;
-    av_reduce(&tbase, &smk->pts_inc, tbase, smk->pts_inc, (1UL<<31)-1);
-    av_set_pts_info(st, 33, smk->pts_inc, tbase);
-    st->duration = smk->frames;
-    /* handle possible audio streams */
-    for(i = 0; i < 7; i++) {
-        smk->indexes[i] = -1;
-        if(smk->rates[i] & 0xFFFFFF){
-            ast[i] = av_new_stream(s, 0);
-            smk->indexes[i] = ast[i]->index;
-            ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            if (smk->rates[i] & SMK_AUD_BINKAUD) {
-                ast[i]->codec->codec_id = CODEC_ID_BINKAUDIO_RDFT;
-            } else if (smk->rates[i] & SMK_AUD_USEDCT) {
-                ast[i]->codec->codec_id = CODEC_ID_BINKAUDIO_DCT;
-            } else if (smk->rates[i] & SMK_AUD_PACKED){
-                ast[i]->codec->codec_id = CODEC_ID_SMACKAUDIO;
-                ast[i]->codec->codec_tag = MKTAG('S', 'M', 'K', 'A');
-            } else {
-                ast[i]->codec->codec_id = CODEC_ID_PCM_U8;
-            }
-            ast[i]->codec->channels = (smk->rates[i] & SMK_AUD_STEREO) ? 2 : 1;
-            ast[i]->codec->sample_rate = smk->rates[i] & 0xFFFFFF;
-            ast[i]->codec->bits_per_coded_sample = (smk->rates[i] & SMK_AUD_16BITS) ? 16 : 8;
-            if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == CODEC_ID_PCM_U8)
-                ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE;
-            av_set_pts_info(ast[i], 64, 1, ast[i]->codec->sample_rate
-                    * ast[i]->codec->channels * ast[i]->codec->bits_per_coded_sample / 8);
-        }
-    }
-
-
-    /* load trees to extradata, they will be unpacked by decoder */
-    st->codec->extradata = av_malloc(smk->treesize + 16);
-    st->codec->extradata_size = smk->treesize + 16;
-    if(!st->codec->extradata){
-        av_log(s, AV_LOG_ERROR, "Cannot allocate %i bytes of extradata\n", smk->treesize + 16);
-        av_free(smk->frm_size);
-        av_free(smk->frm_flags);
-        return -1;
-    }
-    ret = get_buffer(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
-    if(ret != st->codec->extradata_size - 16){
-        av_free(smk->frm_size);
-        av_free(smk->frm_flags);
-        return AVERROR(EIO);
-    }
-    ((int32_t*)st->codec->extradata)[0] = le2me_32(smk->mmap_size);
-    ((int32_t*)st->codec->extradata)[1] = le2me_32(smk->mclr_size);
-    ((int32_t*)st->codec->extradata)[2] = le2me_32(smk->full_size);
-    ((int32_t*)st->codec->extradata)[3] = le2me_32(smk->type_size);
-
-    smk->curstream = -1;
-    smk->nextpos = url_ftell(pb);
-
-    return 0;
-}
-
-
-static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    SmackerContext *smk = s->priv_data;
-    int flags;
-    int ret;
-    int i;
-    int frame_size = 0;
-    int palchange = 0;
-    int pos;
-
-    if (url_feof(s->pb) || smk->cur_frame >= smk->frames)
-        return AVERROR(EIO);
-
-    /* if we demuxed all streams, pass another frame */
-    if(smk->curstream < 0) {
-        url_fseek(s->pb, smk->nextpos, 0);
-        frame_size = smk->frm_size[smk->cur_frame] & (~3);
-        flags = smk->frm_flags[smk->cur_frame];
-        /* handle palette change event */
-        pos = url_ftell(s->pb);
-        if(flags & SMACKER_PAL){
-            int size, sz, t, off, j, pos;
-            uint8_t *pal = smk->pal;
-            uint8_t oldpal[768];
-
-            memcpy(oldpal, pal, 768);
-            size = get_byte(s->pb);
-            size = size * 4 - 1;
-            frame_size -= size;
-            frame_size--;
-            sz = 0;
-            pos = url_ftell(s->pb) + size;
-            while(sz < 256){
-                t = get_byte(s->pb);
-                if(t & 0x80){ /* skip palette entries */
-                    sz += (t & 0x7F) + 1;
-                    pal += ((t & 0x7F) + 1) * 3;
-                } else if(t & 0x40){ /* copy with offset */
-                    off = get_byte(s->pb) * 3;
-                    j = (t & 0x3F) + 1;
-                    while(j-- && sz < 256) {
-                        *pal++ = oldpal[off + 0];
-                        *pal++ = oldpal[off + 1];
-                        *pal++ = oldpal[off + 2];
-                        sz++;
-                        off += 3;
-                    }
-                } else { /* new entries */
-                    *pal++ = smk_pal[t];
-                    *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
-                    *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
-                    sz++;
-                }
-            }
-            url_fseek(s->pb, pos, 0);
-            palchange |= 1;
-        }
-        flags >>= 1;
-        smk->curstream = -1;
-        /* if audio chunks are present, put them to stack and retrieve later */
-        for(i = 0; i < 7; i++) {
-            if(flags & 1) {
-                int size;
-                size = get_le32(s->pb) - 4;
-                frame_size -= size;
-                frame_size -= 4;
-                smk->curstream++;
-                smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
-                smk->buf_sizes[smk->curstream] = size;
-                ret = get_buffer(s->pb, smk->bufs[smk->curstream], size);
-                if(ret != size)
-                    return AVERROR(EIO);
-                smk->stream_id[smk->curstream] = smk->indexes[i];
-            }
-            flags >>= 1;
-        }
-        if (av_new_packet(pkt, frame_size + 768))
-            return AVERROR(ENOMEM);
-        if(smk->frm_size[smk->cur_frame] & 1)
-            palchange |= 2;
-        pkt->data[0] = palchange;
-        memcpy(pkt->data + 1, smk->pal, 768);
-        ret = get_buffer(s->pb, pkt->data + 769, frame_size);
-        if(ret != frame_size)
-            return AVERROR(EIO);
-        pkt->stream_index = smk->videoindex;
-        pkt->size = ret + 769;
-        smk->cur_frame++;
-        smk->nextpos = url_ftell(s->pb);
-    } else {
-        if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
-            return AVERROR(ENOMEM);
-        memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]);
-        pkt->size = smk->buf_sizes[smk->curstream];
-        pkt->stream_index = smk->stream_id[smk->curstream];
-        pkt->pts = smk->aud_pts[smk->curstream];
-        smk->aud_pts[smk->curstream] += AV_RL32(pkt->data);
-        smk->curstream--;
-    }
-
-    return 0;
-}
-
-static int smacker_read_close(AVFormatContext *s)
-{
-    SmackerContext *smk = s->priv_data;
-    int i;
-
-    for(i = 0; i < 7; i++)
-        if(smk->bufs[i])
-            av_free(smk->bufs[i]);
-    if(smk->frm_size)
-        av_free(smk->frm_size);
-    if(smk->frm_flags)
-        av_free(smk->frm_flags);
-
-    return 0;
-}
-
-AVInputFormat smacker_demuxer = {
-    "smk",
-    NULL_IF_CONFIG_SMALL("Smacker video"),
-    sizeof(SmackerContext),
-    smacker_probe,
-    smacker_read_header,
-    smacker_read_packet,
-    smacker_read_close,
-};
diff --git a/libavformat/sol.c b/libavformat/sol.c
deleted file mode 100644
index 3ae2d04..0000000
--- a/libavformat/sol.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Sierra SOL demuxer
- * Copyright Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Based on documents from Game Audio Player and own research
- */
-
-#include "libavutil/bswap.h"
-#include "avformat.h"
-#include "raw.h"
-
-/* if we don't know the size in advance */
-#define AU_UNKNOWN_SIZE ((uint32_t)(~0))
-
-static int sol_probe(AVProbeData *p)
-{
-    /* check file header */
-    uint16_t magic;
-    magic=le2me_16(*((uint16_t*)p->buf));
-    if ((magic == 0x0B8D || magic == 0x0C0D || magic == 0x0C8D) &&
-        p->buf[2] == 'S' && p->buf[3] == 'O' &&
-        p->buf[4] == 'L' && p->buf[5] == 0)
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-#define SOL_DPCM    1
-#define SOL_16BIT   4
-#define SOL_STEREO 16
-
-static enum CodecID sol_codec_id(int magic, int type)
-{
-    if (magic == 0x0B8D)
-    {
-        if (type & SOL_DPCM) return CODEC_ID_SOL_DPCM;
-        else return CODEC_ID_PCM_U8;
-    }
-    if (type & SOL_DPCM)
-    {
-        if (type & SOL_16BIT) return CODEC_ID_SOL_DPCM;
-        else if (magic == 0x0C8D) return CODEC_ID_SOL_DPCM;
-        else return CODEC_ID_SOL_DPCM;
-    }
-    if (type & SOL_16BIT) return CODEC_ID_PCM_S16LE;
-    return CODEC_ID_PCM_U8;
-}
-
-static int sol_codec_type(int magic, int type)
-{
-    if (magic == 0x0B8D) return 1;//SOL_DPCM_OLD;
-    if (type & SOL_DPCM)
-    {
-        if (type & SOL_16BIT) return 3;//SOL_DPCM_NEW16;
-        else if (magic == 0x0C8D) return 1;//SOL_DPCM_OLD;
-        else return 2;//SOL_DPCM_NEW8;
-    }
-    return -1;
-}
-
-static int sol_channels(int magic, int type)
-{
-    if (magic == 0x0B8D || !(type & SOL_STEREO)) return 1;
-    return 2;
-}
-
-static int sol_read_header(AVFormatContext *s,
-                          AVFormatParameters *ap)
-{
-    int size;
-    unsigned int magic,tag;
-    ByteIOContext *pb = s->pb;
-    unsigned int id, channels, rate, type;
-    enum CodecID codec;
-    AVStream *st;
-
-    /* check ".snd" header */
-    magic = get_le16(pb);
-    tag = get_le32(pb);
-    if (tag != MKTAG('S', 'O', 'L', 0))
-        return -1;
-    rate = get_le16(pb);
-    type = get_byte(pb);
-    size = get_le32(pb);
-    if (magic != 0x0B8D)
-        get_byte(pb); /* newer SOLs contain padding byte */
-
-    codec = sol_codec_id(magic, type);
-    channels = sol_channels(magic, type);
-
-    if (codec == CODEC_ID_SOL_DPCM)
-        id = sol_codec_type(magic, type);
-    else id = 0;
-
-    /* now we are ready: build format streams */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_tag = id;
-    st->codec->codec_id = codec;
-    st->codec->channels = channels;
-    st->codec->sample_rate = rate;
-    av_set_pts_info(st, 64, 1, rate);
-    return 0;
-}
-
-#define MAX_SIZE 4096
-
-static int sol_read_packet(AVFormatContext *s,
-                          AVPacket *pkt)
-{
-    int ret;
-
-    if (url_feof(s->pb))
-        return AVERROR(EIO);
-    ret= av_get_packet(s->pb, pkt, MAX_SIZE);
-    pkt->stream_index = 0;
-
-    /* note: we need to modify the packet size here to handle the last
-       packet */
-    pkt->size = ret;
-    return 0;
-}
-
-AVInputFormat sol_demuxer = {
-    "sol",
-    NULL_IF_CONFIG_SMALL("Sierra SOL format"),
-    0,
-    sol_probe,
-    sol_read_header,
-    sol_read_packet,
-    NULL,
-    pcm_read_seek,
-};
diff --git a/libavformat/sox.h b/libavformat/sox.h
deleted file mode 100644
index f4a12e9..0000000
--- a/libavformat/sox.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * SoX native format common data
- * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_SOX_H
-#define AVFORMAT_SOX_H
-
-#define SOX_FIXED_HDR (4 + 8 + 8 + 4 + 4) /**< Size of fixed header without magic */
-
-#define SOX_TAG MKTAG('.', 'S', 'o', 'X')
-
-#endif /* AVFORMAT_SOX_H */
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
deleted file mode 100644
index 42fa53e..0000000
--- a/libavformat/soxdec.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * SoX native format demuxer
- * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
- *
- * Based on libSoX sox-fmt.c
- * Copyright (c) 2008 robs at users.sourceforge.net
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SoX native format demuxer
- * @file
- * @author Daniel Verkamp
- * @sa http://wiki.multimedia.cx/index.php?title=SoX_native_intermediate_format
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "raw.h"
-#include "sox.h"
-
-static int sox_probe(AVProbeData *p)
-{
-    if (AV_RL32(p->buf) == SOX_TAG || AV_RB32(p->buf) == SOX_TAG)
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static int sox_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    unsigned header_size, comment_size;
-    double sample_rate, sample_rate_frac;
-    AVStream *st;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-
-    if (get_le32(pb) == SOX_TAG) {
-        st->codec->codec_id = CODEC_ID_PCM_S32LE;
-        header_size         = get_le32(pb);
-        url_fskip(pb, 8); /* sample count */
-        sample_rate         = av_int2dbl(get_le64(pb));
-        st->codec->channels = get_le32(pb);
-        comment_size        = get_le32(pb);
-    } else {
-        st->codec->codec_id = CODEC_ID_PCM_S32BE;
-        header_size         = get_be32(pb);
-        url_fskip(pb, 8); /* sample count */
-        sample_rate         = av_int2dbl(get_be64(pb));
-        st->codec->channels = get_be32(pb);
-        comment_size        = get_be32(pb);
-    }
-
-    if (comment_size > 0xFFFFFFFFU - SOX_FIXED_HDR - 4U) {
-        av_log(s, AV_LOG_ERROR, "invalid comment size (%u)\n", comment_size);
-        return -1;
-    }
-
-    if (sample_rate <= 0 || sample_rate > INT_MAX) {
-        av_log(s, AV_LOG_ERROR, "invalid sample rate (%f)\n", sample_rate);
-        return -1;
-    }
-
-    sample_rate_frac = sample_rate - floor(sample_rate);
-    if (sample_rate_frac)
-        av_log(s, AV_LOG_WARNING,
-               "truncating fractional part of sample rate (%f)\n",
-               sample_rate_frac);
-
-    if ((header_size + 4) & 7 || header_size < SOX_FIXED_HDR + comment_size
-        || st->codec->channels > 65535) /* Reserve top 16 bits */ {
-        av_log(s, AV_LOG_ERROR, "invalid header\n");
-        return -1;
-    }
-
-    if (comment_size && comment_size < UINT_MAX) {
-        char *comment = av_malloc(comment_size+1);
-        if (get_buffer(pb, comment, comment_size) != comment_size) {
-            av_freep(&comment);
-            return AVERROR(EIO);
-        }
-        comment[comment_size] = 0;
-
-        av_metadata_set2(&s->metadata, "comment", comment,
-                               AV_METADATA_DONT_STRDUP_VAL);
-    }
-
-    url_fskip(pb, header_size - SOX_FIXED_HDR - comment_size);
-
-    st->codec->sample_rate           = sample_rate;
-    st->codec->bits_per_coded_sample = 32;
-    st->codec->bit_rate              = st->codec->sample_rate *
-                                       st->codec->bits_per_coded_sample *
-                                       st->codec->channels;
-    st->codec->block_align           = st->codec->bits_per_coded_sample *
-                                       st->codec->channels / 8;
-
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-    return 0;
-}
-
-#define SOX_SAMPLES 1024
-
-static int sox_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    int ret, size;
-
-    if (url_feof(s->pb))
-        return AVERROR_EOF;
-
-    size = SOX_SAMPLES*s->streams[0]->codec->block_align;
-    ret = av_get_packet(s->pb, pkt, size);
-    if (ret < 0)
-        return AVERROR(EIO);
-    pkt->stream_index = 0;
-    pkt->size = ret;
-
-    return 0;
-}
-
-AVInputFormat sox_demuxer = {
-    "sox",
-    NULL_IF_CONFIG_SMALL("SoX native format"),
-    0,
-    sox_probe,
-    sox_read_header,
-    sox_read_packet,
-    NULL,
-    pcm_read_seek,
-};
diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c
deleted file mode 100644
index 918bfad..0000000
--- a/libavformat/soxenc.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * SoX native format muxer
- * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
- *
- * Based on libSoX sox-fmt.c
- * Copyright (c) 2008 robs at users.sourceforge.net
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * SoX native format muxer
- * @file
- * @author Daniel Verkamp
- * @sa http://wiki.multimedia.cx/index.php?title=SoX_native_intermediate_format
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "sox.h"
-
-typedef struct {
-    int64_t header_size;
-} SoXContext;
-
-static int sox_write_header(AVFormatContext *s)
-{
-    SoXContext *sox = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *enc = s->streams[0]->codec;
-    AVMetadataTag *comment;
-    size_t comment_len = 0, comment_size;
-
-    comment = av_metadata_get(s->metadata, "comment", NULL, 0);
-    if (comment)
-        comment_len = strlen(comment->value);
-    comment_size = (comment_len + 7) & ~7;
-
-    sox->header_size = SOX_FIXED_HDR + comment_size;
-
-    if (enc->codec_id == CODEC_ID_PCM_S32LE) {
-        put_tag(pb, ".SoX");
-        put_le32(pb, sox->header_size);
-        put_le64(pb, 0); /* number of samples */
-        put_le64(pb, av_dbl2int(enc->sample_rate));
-        put_le32(pb, enc->channels);
-        put_le32(pb, comment_size);
-    } else if (enc->codec_id == CODEC_ID_PCM_S32BE) {
-        put_tag(pb, "XoS.");
-        put_be32(pb, sox->header_size);
-        put_be64(pb, 0); /* number of samples */
-        put_be64(pb, av_dbl2int(enc->sample_rate));
-        put_be32(pb, enc->channels);
-        put_be32(pb, comment_size);
-    } else {
-        av_log(s, AV_LOG_ERROR, "invalid codec; use pcm_s32le or pcm_s32be\n");
-        return -1;
-    }
-
-    if (comment_len)
-        put_buffer(pb, comment->value, comment_len);
-
-    for ( ; comment_size > comment_len; comment_len++)
-        put_byte(pb, 0);
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static int sox_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    put_buffer(pb, pkt->data, pkt->size);
-    return 0;
-}
-
-static int sox_write_trailer(AVFormatContext *s)
-{
-    SoXContext *sox = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *enc = s->streams[0]->codec;
-
-    if (!url_is_streamed(s->pb)) {
-        /* update number of samples */
-        int64_t file_size = url_ftell(pb);
-        int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL;
-        url_fseek(pb, 8, SEEK_SET);
-        if (enc->codec_id == CODEC_ID_PCM_S32LE) {
-            put_le64(pb, num_samples);
-        } else
-            put_be64(pb, num_samples);
-        url_fseek(pb, file_size, SEEK_SET);
-
-        put_flush_packet(pb);
-    }
-
-    return 0;
-}
-
-AVOutputFormat sox_muxer = {
-    "sox",
-    NULL_IF_CONFIG_SMALL("SoX native format"),
-    NULL,
-    "sox",
-    sizeof(SoXContext),
-    CODEC_ID_PCM_S32LE,
-    CODEC_ID_NONE,
-    sox_write_header,
-    sox_write_packet,
-    sox_write_trailer,
-};
diff --git a/libavformat/spdif.c b/libavformat/spdif.c
deleted file mode 100644
index 1c53f73..0000000
--- a/libavformat/spdif.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * IEC958 muxer
- * Copyright (c) 2009 Bartlomiej Wolowiec
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * IEC-61937 encapsulation of various formats, used by S/PDIF
- * @author Bartlomiej Wolowiec
- */
-
-/*
- * Terminology used in specification:
- * data-burst - IEC958 frame, contains header and encapsuled frame
- * burst-preambule - IEC958 frame header, contains 16-bits words named Pa, Pb, Pc and Pd
- * burst-payload - encapsuled frame
- * Pa, Pb - syncword - 0xF872, 0x4E1F
- * Pc - burst-info, contains data-type (bits 0-6), error flag (bit 7), data-type-dependent info (bits 8-12)
- *      and bitstream number (bits 13-15)
- * data-type - determines type of encapsuled frames
- * Pd - length code (number of bits or bytes of encapsuled frame - according to data_type)
- *
- * IEC958 frames at normal usage start every specific count of bytes,
- *      dependent from data-type (spaces between packets are filled by zeros)
- */
-
-#include "avformat.h"
-#include "libavcodec/ac3.h"
-#include "libavcodec/dca.h"
-#include "libavcodec/aac_parser.h"
-
-#define SYNCWORD1 0xF872
-#define SYNCWORD2 0x4E1F
-#define BURST_HEADER_SIZE 0x8
-
-enum IEC958DataType {
-    IEC958_AC3                = 0x01,          ///< AC-3 data
-    IEC958_MPEG1_LAYER1       = 0x04,          ///< MPEG-1 layer 1
-    IEC958_MPEG1_LAYER23      = 0x05,          ///< MPEG-1 layer 2 or 3 data or MPEG-2 without extension
-    IEC958_MPEG2_EXT          = 0x06,          ///< MPEG-2 data with extension
-    IEC958_MPEG2_AAC          = 0x07,          ///< MPEG-2 AAC ADTS
-    IEC958_MPEG2_LAYER1_LSF   = 0x08,          ///< MPEG-2, layer-1 low sampling frequency
-    IEC958_MPEG2_LAYER2_LSF   = 0x09,          ///< MPEG-2, layer-2 low sampling frequency
-    IEC958_MPEG2_LAYER3_LSF   = 0x0A,          ///< MPEG-2, layer-3 low sampling frequency
-    IEC958_DTS1               = 0x0B,          ///< DTS type I   (512 samples)
-    IEC958_DTS2               = 0x0C,          ///< DTS type II  (1024 samples)
-    IEC958_DTS3               = 0x0D,          ///< DTS type III (2048 samples)
-    IEC958_MPEG2_AAC_LSF_2048 = 0x13,          ///< MPEG-2 AAC ADTS half-rate low sampling frequency
-    IEC958_MPEG2_AAC_LSF_4096 = 0x13 | 0x20,   ///< MPEG-2 AAC ADTS quarter-rate low sampling frequency
-};
-
-typedef struct IEC958Context {
-    enum IEC958DataType data_type;  ///< burst info - reference to type of payload of the data-burst
-    int pkt_size;                   ///< length code in bits
-    int pkt_offset;                 ///< data burst repetition period in bytes
-    uint8_t *buffer;                ///< allocated buffer, used for swap bytes
-    int buffer_size;                ///< size of allocated buffer
-
-    /// function, which generates codec dependent header information.
-    /// Sets data_type and data_offset
-    int (*header_info) (AVFormatContext *s, AVPacket *pkt);
-} IEC958Context;
-
-//TODO move to DSP
-static void bswap_buf16(uint16_t *dst, const uint16_t *src, int w)
-{
-    int i;
-
-    for (i = 0; i + 8 <= w; i += 8) {
-        dst[i + 0] = bswap_16(src[i + 0]);
-        dst[i + 1] = bswap_16(src[i + 1]);
-        dst[i + 2] = bswap_16(src[i + 2]);
-        dst[i + 3] = bswap_16(src[i + 3]);
-        dst[i + 4] = bswap_16(src[i + 4]);
-        dst[i + 5] = bswap_16(src[i + 5]);
-        dst[i + 6] = bswap_16(src[i + 6]);
-        dst[i + 7] = bswap_16(src[i + 7]);
-    }
-    for (; i < w; i++)
-        dst[i + 0] = bswap_16(src[i + 0]);
-}
-
-static int spdif_header_ac3(AVFormatContext *s, AVPacket *pkt)
-{
-    IEC958Context *ctx = s->priv_data;
-    int bitstream_mode = pkt->data[6] & 0x7;
-
-    ctx->data_type  = IEC958_AC3 | (bitstream_mode << 8);
-    ctx->pkt_offset = AC3_FRAME_SIZE << 2;
-    return 0;
-}
-
-static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
-{
-    IEC958Context *ctx = s->priv_data;
-    uint32_t syncword_dts = AV_RB32(pkt->data);
-    int blocks;
-
-    switch (syncword_dts) {
-    case DCA_MARKER_RAW_BE:
-        blocks = (AV_RB16(pkt->data + 4) >> 2) & 0x7f;
-        break;
-    case DCA_MARKER_RAW_LE:
-        blocks = (AV_RL16(pkt->data + 4) >> 2) & 0x7f;
-        break;
-    case DCA_MARKER_14B_BE:
-        blocks =
-            (((pkt->data[5] & 0x07) << 4) | ((pkt->data[6] & 0x3f) >> 2));
-        break;
-    case DCA_MARKER_14B_LE:
-        blocks =
-            (((pkt->data[4] & 0x07) << 4) | ((pkt->data[7] & 0x3f) >> 2));
-        break;
-    default:
-        av_log(s, AV_LOG_ERROR, "bad DTS syncword 0x%x\n", syncword_dts);
-        return -1;
-    }
-    blocks++;
-    switch (blocks) {
-    case  512 >> 5: ctx->data_type = IEC958_DTS1; break;
-    case 1024 >> 5: ctx->data_type = IEC958_DTS2; break;
-    case 2048 >> 5: ctx->data_type = IEC958_DTS3; break;
-    default:
-        av_log(s, AV_LOG_ERROR, "%i samples in DTS frame not supported\n",
-               blocks << 5);
-        return -1;
-    }
-    ctx->pkt_offset = blocks << 7;
-
-    return 0;
-}
-
-static const enum IEC958DataType mpeg_data_type[2][3] = {
-    //     LAYER1                      LAYER2                  LAYER3
-    { IEC958_MPEG2_LAYER1_LSF, IEC958_MPEG2_LAYER2_LSF, IEC958_MPEG2_LAYER3_LSF },  //MPEG2 LSF
-    { IEC958_MPEG1_LAYER1,     IEC958_MPEG1_LAYER23,    IEC958_MPEG1_LAYER23 },     //MPEG1
-};
-
-static const uint16_t mpeg_pkt_offset[2][3] = {
-    //LAYER1  LAYER2  LAYER3
-    { 3072,    9216,   4608 }, // MPEG2 LSF
-    { 1536,    4608,   4608 }, // MPEG1
-};
-
-static int spdif_header_mpeg(AVFormatContext *s, AVPacket *pkt)
-{
-    IEC958Context *ctx = s->priv_data;
-    int version =      (pkt->data[1] >> 3) & 3;
-    int layer   = 3 - ((pkt->data[1] >> 1) & 3);
-    int extension = pkt->data[2] & 1;
-
-    if (layer == 3 || version == 1) {
-        av_log(s, AV_LOG_ERROR, "Wrong MPEG file format\n");
-        return -1;
-    }
-    av_log(s, AV_LOG_DEBUG, "version: %i layer: %i extension: %i\n", version, layer, extension);
-    if (version == 2 && extension) {
-        ctx->data_type  = IEC958_MPEG2_EXT;
-        ctx->pkt_offset = 4608;
-    } else {
-        ctx->data_type  = mpeg_data_type [version & 1][layer];
-        ctx->pkt_offset = mpeg_pkt_offset[version & 1][layer];
-    }
-    // TODO Data type dependant info (normal/karaoke, dynamic range control)
-    return 0;
-}
-
-static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
-{
-    IEC958Context *ctx = s->priv_data;
-    AACADTSHeaderInfo hdr;
-    GetBitContext gbc;
-    int ret;
-
-    init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);
-    ret = ff_aac_parse_header(&gbc, &hdr);
-    if (ret < 0) {
-        av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
-        return -1;
-    }
-
-    ctx->pkt_offset = hdr.samples << 2;
-    switch (hdr.num_aac_frames) {
-    case 1:
-        ctx->data_type = IEC958_MPEG2_AAC;
-        break;
-    case 2:
-        ctx->data_type = IEC958_MPEG2_AAC_LSF_2048;
-        break;
-    case 4:
-        ctx->data_type = IEC958_MPEG2_AAC_LSF_4096;
-        break;
-    default:
-        av_log(s, AV_LOG_ERROR, "%i samples in AAC frame not supported\n",
-               hdr.samples);
-        return -1;
-    }
-    //TODO Data type dependent info (LC profile/SBR)
-    return 0;
-}
-
-static int spdif_write_header(AVFormatContext *s)
-{
-    IEC958Context *ctx = s->priv_data;
-
-    switch (s->streams[0]->codec->codec_id) {
-    case CODEC_ID_AC3:
-        ctx->header_info = spdif_header_ac3;
-        break;
-    case CODEC_ID_MP1:
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-        ctx->header_info = spdif_header_mpeg;
-        break;
-    case CODEC_ID_DTS:
-        ctx->header_info = spdif_header_dts;
-        break;
-    case CODEC_ID_AAC:
-        ctx->header_info = spdif_header_aac;
-        break;
-    default:
-        av_log(s, AV_LOG_ERROR, "codec not supported\n");
-        return -1;
-    }
-    return 0;
-}
-
-static int spdif_write_trailer(AVFormatContext *s)
-{
-    IEC958Context *ctx = s->priv_data;
-    av_freep(&ctx->buffer);
-    return 0;
-}
-
-static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    IEC958Context *ctx = s->priv_data;
-    int ret, padding;
-
-    ctx->pkt_size = FFALIGN(pkt->size, 2) << 3;
-    ret = ctx->header_info(s, pkt);
-    if (ret < 0)
-        return -1;
-
-    padding = (ctx->pkt_offset - BURST_HEADER_SIZE - pkt->size) >> 1;
-    if (padding < 0) {
-        av_log(s, AV_LOG_ERROR, "bitrate is too high\n");
-        return -1;
-    }
-
-    put_le16(s->pb, SYNCWORD1);      //Pa
-    put_le16(s->pb, SYNCWORD2);      //Pb
-    put_le16(s->pb, ctx->data_type); //Pc
-    put_le16(s->pb, ctx->pkt_size);  //Pd
-
-#if HAVE_BIGENDIAN
-    put_buffer(s->pb, pkt->data, pkt->size & ~1);
-#else
-    av_fast_malloc(&ctx->buffer, &ctx->buffer_size, pkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
-    if (!ctx->buffer)
-        return AVERROR(ENOMEM);
-    bswap_buf16((uint16_t *)ctx->buffer, (uint16_t *)pkt->data, pkt->size >> 1);
-    put_buffer(s->pb, ctx->buffer, pkt->size & ~1);
-#endif
-
-    if (pkt->size & 1)
-        put_be16(s->pb, pkt->data[pkt->size - 1]);
-
-    for (; padding > 0; padding--)
-        put_be16(s->pb, 0);
-
-    av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n",
-           ctx->data_type, pkt->size, ctx->pkt_offset);
-
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-AVOutputFormat spdif_muxer = {
-    "spdif",
-    NULL_IF_CONFIG_SMALL("IEC958 - S/PDIF (IEC-61937)"),
-    NULL,
-    "spdif",
-    sizeof(IEC958Context),
-    CODEC_ID_AC3,
-    CODEC_ID_NONE,
-    spdif_write_header,
-    spdif_write_packet,
-    spdif_write_trailer,
-};
diff --git a/libavformat/swf.h b/libavformat/swf.h
deleted file mode 100644
index affebe9..0000000
--- a/libavformat/swf.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Flash Compatible Streaming Format common header.
- * Copyright (c) 2000 Fabrice Bellard
- * Copyright (c) 2003 Tinic Uro
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_SWF_H
-#define AVFORMAT_SWF_H
-
-#include "libavutil/fifo.h"
-#include "avformat.h"
-#include "avio.h"
-#include "riff.h"    /* for CodecTag */
-
-/* should have a generic way to indicate probable size */
-#define DUMMY_FILE_SIZE   (100 * 1024 * 1024)
-#define DUMMY_DURATION    600 /* in seconds */
-
-#define TAG_END           0
-#define TAG_SHOWFRAME     1
-#define TAG_DEFINESHAPE   2
-#define TAG_FREECHARACTER 3
-#define TAG_PLACEOBJECT   4
-#define TAG_REMOVEOBJECT  5
-#define TAG_STREAMHEAD    18
-#define TAG_STREAMBLOCK   19
-#define TAG_JPEG2         21
-#define TAG_PLACEOBJECT2  26
-#define TAG_STREAMHEAD2   45
-#define TAG_VIDEOSTREAM   60
-#define TAG_VIDEOFRAME    61
-#define TAG_FILEATTRIBUTES 69
-
-#define TAG_LONG         0x100
-
-/* flags for shape definition */
-#define FLAG_MOVETO      0x01
-#define FLAG_SETFILL0    0x02
-#define FLAG_SETFILL1    0x04
-
-#define AUDIO_FIFO_SIZE 65536
-
-/* character id used */
-#define BITMAP_ID 0
-#define VIDEO_ID 0
-#define SHAPE_ID  1
-
-#undef NDEBUG
-#include <assert.h>
-
-typedef struct {
-    int64_t duration_pos;
-    int64_t tag_pos;
-    int64_t vframes_pos;
-    int samples_per_frame;
-    int sound_samples;
-    int swf_frame_number;
-    int video_frame_number;
-    int frame_rate;
-    int tag;
-    AVFifoBuffer *audio_fifo;
-    AVCodecContext *audio_enc, *video_enc;
-} SWFContext;
-
-static const AVCodecTag swf_codec_tags[] = {
-    {CODEC_ID_FLV1, 0x02},
-    {CODEC_ID_VP6F, 0x04},
-    {CODEC_ID_NONE,    0},
-};
-
-static const AVCodecTag swf_audio_codec_tags[] = {
-    {CODEC_ID_PCM_S16LE,  0x00},
-    {CODEC_ID_ADPCM_SWF,  0x01},
-    {CODEC_ID_MP3,        0x02},
-    {CODEC_ID_PCM_S16LE,  0x03},
-  //{CODEC_ID_NELLYMOSER, 0x06},
-    {CODEC_ID_NONE,          0},
-};
-
-#endif /* AVFORMAT_SWF_H */
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
deleted file mode 100644
index 64f775f..0000000
--- a/libavformat/swfdec.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Flash Compatible Streaming Format demuxer
- * Copyright (c) 2000 Fabrice Bellard
- * Copyright (c) 2003 Tinic Uro
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "swf.h"
-
-static int get_swf_tag(ByteIOContext *pb, int *len_ptr)
-{
-    int tag, len;
-
-    if (url_feof(pb))
-        return -1;
-
-    tag = get_le16(pb);
-    len = tag & 0x3f;
-    tag = tag >> 6;
-    if (len == 0x3f) {
-        len = get_le32(pb);
-    }
-//    av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
-    *len_ptr = len;
-    return tag;
-}
-
-
-static int swf_probe(AVProbeData *p)
-{
-    /* check file header */
-    if ((p->buf[0] == 'F' || p->buf[0] == 'C') && p->buf[1] == 'W' &&
-        p->buf[2] == 'S')
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int nbits, len, tag;
-
-    tag = get_be32(pb) & 0xffffff00;
-
-    if (tag == MKBETAG('C', 'W', 'S', 0)) {
-        av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n");
-        return AVERROR(EIO);
-    }
-    if (tag != MKBETAG('F', 'W', 'S', 0))
-        return AVERROR(EIO);
-    get_le32(pb);
-    /* skip rectangle size */
-    nbits = get_byte(pb) >> 3;
-    len = (4 * nbits - 3 + 7) / 8;
-    url_fskip(pb, len);
-    swf->frame_rate = get_le16(pb); /* 8.8 fixed */
-    get_le16(pb); /* frame count */
-
-    swf->samples_per_frame = 0;
-    s->ctx_flags |= AVFMTCTX_NOHEADER;
-    return 0;
-}
-
-static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *vst = NULL, *ast = NULL, *st = 0;
-    int tag, len, i, frame, v;
-
-    for(;;) {
-        uint64_t pos = url_ftell(pb);
-        tag = get_swf_tag(pb, &len);
-        if (tag < 0)
-            return AVERROR(EIO);
-        if (tag == TAG_VIDEOSTREAM) {
-            int ch_id = get_le16(pb);
-            len -= 2;
-
-            for (i=0; i<s->nb_streams; i++) {
-                st = s->streams[i];
-                if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id)
-                    goto skip;
-            }
-
-            get_le16(pb);
-            get_le16(pb);
-            get_le16(pb);
-            get_byte(pb);
-            /* Check for FLV1 */
-            vst = av_new_stream(s, ch_id);
-            if (!vst)
-                return -1;
-            vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb));
-            av_set_pts_info(vst, 16, 256, swf->frame_rate);
-            vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
-            len -= 8;
-        } else if (tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2) {
-            /* streaming found */
-            int sample_rate_code;
-
-            for (i=0; i<s->nb_streams; i++) {
-                st = s->streams[i];
-                if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1)
-                    goto skip;
-            }
-
-            get_byte(pb);
-            v = get_byte(pb);
-            swf->samples_per_frame = get_le16(pb);
-            ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
-            if (!ast)
-                return -1;
-            ast->codec->channels = 1 + (v&1);
-            ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15);
-            ast->need_parsing = AVSTREAM_PARSE_FULL;
-            sample_rate_code= (v>>2) & 3;
-            if (!sample_rate_code)
-                return AVERROR(EIO);
-            ast->codec->sample_rate = 11025 << (sample_rate_code-1);
-            av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
-            len -= 4;
-        } else if (tag == TAG_VIDEOFRAME) {
-            int ch_id = get_le16(pb);
-            len -= 2;
-            for(i=0; i<s->nb_streams; i++) {
-                st = s->streams[i];
-                if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
-                    frame = get_le16(pb);
-                    av_get_packet(pb, pkt, len-2);
-                    pkt->pos = pos;
-                    pkt->pts = frame;
-                    pkt->stream_index = st->index;
-                    return pkt->size;
-                }
-            }
-        } else if (tag == TAG_STREAMBLOCK) {
-            for (i = 0; i < s->nb_streams; i++) {
-                st = s->streams[i];
-                if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
-            if (st->codec->codec_id == CODEC_ID_MP3) {
-                url_fskip(pb, 4);
-                av_get_packet(pb, pkt, len-4);
-            } else { // ADPCM, PCM
-                av_get_packet(pb, pkt, len);
-            }
-            pkt->pos = pos;
-            pkt->stream_index = st->index;
-            return pkt->size;
-                }
-            }
-        } else if (tag == TAG_JPEG2) {
-            for (i=0; i<s->nb_streams; i++) {
-                st = s->streams[i];
-                if (st->codec->codec_id == CODEC_ID_MJPEG && st->id == -2)
-                    break;
-            }
-            if (i == s->nb_streams) {
-                vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */
-                if (!vst)
-                    return -1;
-                vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-                vst->codec->codec_id = CODEC_ID_MJPEG;
-                av_set_pts_info(vst, 64, 256, swf->frame_rate);
-                vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
-                st = vst;
-            }
-            get_le16(pb); /* BITMAP_ID */
-            av_new_packet(pkt, len-2);
-            get_buffer(pb, pkt->data, 4);
-            if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
-                AV_RB32(pkt->data) == 0xffd9ffd8) {
-                /* old SWF files containing SOI/EOI as data start */
-                /* files created by swink have reversed tag */
-                pkt->size -= 4;
-                get_buffer(pb, pkt->data, pkt->size);
-            } else {
-                get_buffer(pb, pkt->data + 4, pkt->size - 4);
-            }
-            pkt->pos = pos;
-            pkt->stream_index = st->index;
-            return pkt->size;
-        }
-    skip:
-        url_fskip(pb, len);
-    }
-    return 0;
-}
-
-AVInputFormat swf_demuxer = {
-    "swf",
-    NULL_IF_CONFIG_SMALL("Flash format"),
-    sizeof(SWFContext),
-    swf_probe,
-    swf_read_header,
-    swf_read_packet,
-};
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
deleted file mode 100644
index 1a1a9ab..0000000
--- a/libavformat/swfenc.c
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * Flash Compatible Streaming Format muxer
- * Copyright (c) 2000 Fabrice Bellard
- * Copyright (c) 2003 Tinic Uro
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/put_bits.h"
-#include "avformat.h"
-#include "swf.h"
-
-static void put_swf_tag(AVFormatContext *s, int tag)
-{
-    SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    swf->tag_pos = url_ftell(pb);
-    swf->tag = tag;
-    /* reserve some room for the tag */
-    if (tag & TAG_LONG) {
-        put_le16(pb, 0);
-        put_le32(pb, 0);
-    } else {
-        put_le16(pb, 0);
-    }
-}
-
-static void put_swf_end_tag(AVFormatContext *s)
-{
-    SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t pos;
-    int tag_len, tag;
-
-    pos = url_ftell(pb);
-    tag_len = pos - swf->tag_pos - 2;
-    tag = swf->tag;
-    url_fseek(pb, swf->tag_pos, SEEK_SET);
-    if (tag & TAG_LONG) {
-        tag &= ~TAG_LONG;
-        put_le16(pb, (tag << 6) | 0x3f);
-        put_le32(pb, tag_len - 4);
-    } else {
-        assert(tag_len < 0x3f);
-        put_le16(pb, (tag << 6) | tag_len);
-    }
-    url_fseek(pb, pos, SEEK_SET);
-}
-
-static inline void max_nbits(int *nbits_ptr, int val)
-{
-    int n;
-
-    if (val == 0)
-        return;
-    val = abs(val);
-    n = 1;
-    while (val != 0) {
-        n++;
-        val >>= 1;
-    }
-    if (n > *nbits_ptr)
-        *nbits_ptr = n;
-}
-
-static void put_swf_rect(ByteIOContext *pb,
-                         int xmin, int xmax, int ymin, int ymax)
-{
-    PutBitContext p;
-    uint8_t buf[256];
-    int nbits, mask;
-
-    init_put_bits(&p, buf, sizeof(buf));
-
-    nbits = 0;
-    max_nbits(&nbits, xmin);
-    max_nbits(&nbits, xmax);
-    max_nbits(&nbits, ymin);
-    max_nbits(&nbits, ymax);
-    mask = (1 << nbits) - 1;
-
-    /* rectangle info */
-    put_bits(&p, 5, nbits);
-    put_bits(&p, nbits, xmin & mask);
-    put_bits(&p, nbits, xmax & mask);
-    put_bits(&p, nbits, ymin & mask);
-    put_bits(&p, nbits, ymax & mask);
-
-    flush_put_bits(&p);
-    put_buffer(pb, buf, put_bits_ptr(&p) - p.buf);
-}
-
-static void put_swf_line_edge(PutBitContext *pb, int dx, int dy)
-{
-    int nbits, mask;
-
-    put_bits(pb, 1, 1); /* edge */
-    put_bits(pb, 1, 1); /* line select */
-    nbits = 2;
-    max_nbits(&nbits, dx);
-    max_nbits(&nbits, dy);
-
-    mask = (1 << nbits) - 1;
-    put_bits(pb, 4, nbits - 2); /* 16 bits precision */
-    if (dx == 0) {
-        put_bits(pb, 1, 0);
-        put_bits(pb, 1, 1);
-        put_bits(pb, nbits, dy & mask);
-    } else if (dy == 0) {
-        put_bits(pb, 1, 0);
-        put_bits(pb, 1, 0);
-        put_bits(pb, nbits, dx & mask);
-    } else {
-        put_bits(pb, 1, 1);
-        put_bits(pb, nbits, dx & mask);
-        put_bits(pb, nbits, dy & mask);
-    }
-}
-
-#define FRAC_BITS 16
-
-static void put_swf_matrix(ByteIOContext *pb,
-                           int a, int b, int c, int d, int tx, int ty)
-{
-    PutBitContext p;
-    uint8_t buf[256];
-    int nbits;
-
-    init_put_bits(&p, buf, sizeof(buf));
-
-    put_bits(&p, 1, 1); /* a, d present */
-    nbits = 1;
-    max_nbits(&nbits, a);
-    max_nbits(&nbits, d);
-    put_bits(&p, 5, nbits); /* nb bits */
-    put_bits(&p, nbits, a);
-    put_bits(&p, nbits, d);
-
-    put_bits(&p, 1, 1); /* b, c present */
-    nbits = 1;
-    max_nbits(&nbits, c);
-    max_nbits(&nbits, b);
-    put_bits(&p, 5, nbits); /* nb bits */
-    put_bits(&p, nbits, c);
-    put_bits(&p, nbits, b);
-
-    nbits = 1;
-    max_nbits(&nbits, tx);
-    max_nbits(&nbits, ty);
-    put_bits(&p, 5, nbits); /* nb bits */
-    put_bits(&p, nbits, tx);
-    put_bits(&p, nbits, ty);
-
-    flush_put_bits(&p);
-    put_buffer(pb, buf, put_bits_ptr(&p) - p.buf);
-}
-
-static int swf_write_header(AVFormatContext *s)
-{
-    SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    PutBitContext p;
-    uint8_t buf1[256];
-    int i, width, height, rate, rate_base;
-    int version;
-
-    swf->sound_samples = 0;
-    swf->swf_frame_number = 0;
-    swf->video_frame_number = 0;
-
-    for(i=0;i<s->nb_streams;i++) {
-        AVCodecContext *enc = s->streams[i]->codec;
-        if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if (enc->codec_id == CODEC_ID_MP3) {
-                if (!enc->frame_size) {
-                    av_log(s, AV_LOG_ERROR, "audio frame size not set\n");
-                    return -1;
-                }
-                swf->audio_enc = enc;
-                swf->audio_fifo= av_fifo_alloc(AUDIO_FIFO_SIZE);
-                if (!swf->audio_fifo)
-                    return AVERROR(ENOMEM);
-            } else {
-                av_log(s, AV_LOG_ERROR, "SWF muxer only supports MP3\n");
-                return -1;
-            }
-        } else {
-            if (enc->codec_id == CODEC_ID_VP6F ||
-                enc->codec_id == CODEC_ID_FLV1 ||
-                enc->codec_id == CODEC_ID_MJPEG) {
-                swf->video_enc = enc;
-            } else {
-                av_log(s, AV_LOG_ERROR, "SWF muxer only supports VP6, FLV1 and MJPEG\n");
-                return -1;
-            }
-        }
-    }
-
-    if (!swf->video_enc) {
-        /* currently, cannot work correctly if audio only */
-        width = 320;
-        height = 200;
-        rate = 10;
-        rate_base= 1;
-    } else {
-        width = swf->video_enc->width;
-        height = swf->video_enc->height;
-        rate = swf->video_enc->time_base.den;
-        rate_base = swf->video_enc->time_base.num;
-    }
-
-    if (!swf->audio_enc)
-        swf->samples_per_frame = (44100. * rate_base) / rate;
-    else
-        swf->samples_per_frame = (swf->audio_enc->sample_rate * rate_base) / rate;
-
-    put_tag(pb, "FWS");
-
-    if (!strcmp("avm2", s->oformat->name))
-        version = 9;
-    else if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_VP6F)
-        version = 8; /* version 8 and above support VP6 codec */
-    else if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_FLV1)
-        version = 6; /* version 6 and above support FLV1 codec */
-    else
-        version = 4; /* version 4 for mpeg audio support */
-    put_byte(pb, version);
-
-    put_le32(pb, DUMMY_FILE_SIZE); /* dummy size
-                                      (will be patched if not streamed) */
-
-    put_swf_rect(pb, 0, width * 20, 0, height * 20);
-    put_le16(pb, (rate * 256) / rate_base); /* frame rate */
-    swf->duration_pos = url_ftell(pb);
-    put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
-
-    /* avm2/swf v9 (also v8?) files require a file attribute tag */
-    if (version == 9) {
-        put_swf_tag(s, TAG_FILEATTRIBUTES);
-        put_le32(pb, 1<<3); /* set ActionScript v3/AVM2 flag */
-        put_swf_end_tag(s);
-    }
-
-    /* define a shape with the jpeg inside */
-    if (swf->video_enc && swf->video_enc->codec_id == CODEC_ID_MJPEG) {
-        put_swf_tag(s, TAG_DEFINESHAPE);
-
-        put_le16(pb, SHAPE_ID); /* ID of shape */
-        /* bounding rectangle */
-        put_swf_rect(pb, 0, width, 0, height);
-        /* style info */
-        put_byte(pb, 1); /* one fill style */
-        put_byte(pb, 0x41); /* clipped bitmap fill */
-        put_le16(pb, BITMAP_ID); /* bitmap ID */
-        /* position of the bitmap */
-        put_swf_matrix(pb, (int)(1.0 * (1 << FRAC_BITS)), 0,
-                       0, (int)(1.0 * (1 << FRAC_BITS)), 0, 0);
-        put_byte(pb, 0); /* no line style */
-
-        /* shape drawing */
-        init_put_bits(&p, buf1, sizeof(buf1));
-        put_bits(&p, 4, 1); /* one fill bit */
-        put_bits(&p, 4, 0); /* zero line bit */
-
-        put_bits(&p, 1, 0); /* not an edge */
-        put_bits(&p, 5, FLAG_MOVETO | FLAG_SETFILL0);
-        put_bits(&p, 5, 1); /* nbits */
-        put_bits(&p, 1, 0); /* X */
-        put_bits(&p, 1, 0); /* Y */
-        put_bits(&p, 1, 1); /* set fill style 1 */
-
-        /* draw the rectangle ! */
-        put_swf_line_edge(&p, width, 0);
-        put_swf_line_edge(&p, 0, height);
-        put_swf_line_edge(&p, -width, 0);
-        put_swf_line_edge(&p, 0, -height);
-
-        /* end of shape */
-        put_bits(&p, 1, 0); /* not an edge */
-        put_bits(&p, 5, 0);
-
-        flush_put_bits(&p);
-        put_buffer(pb, buf1, put_bits_ptr(&p) - p.buf);
-
-        put_swf_end_tag(s);
-    }
-
-    if (swf->audio_enc && swf->audio_enc->codec_id == CODEC_ID_MP3) {
-        int v = 0;
-
-        /* start sound */
-        put_swf_tag(s, TAG_STREAMHEAD2);
-        switch(swf->audio_enc->sample_rate) {
-        case 11025: v |= 1 << 2; break;
-        case 22050: v |= 2 << 2; break;
-        case 44100: v |= 3 << 2; break;
-        default:
-            /* not supported */
-            av_log(s, AV_LOG_ERROR, "swf does not support that sample rate, choose from (44100, 22050, 11025).\n");
-            return -1;
-        }
-        v |= 0x02; /* 16 bit playback */
-        if (swf->audio_enc->channels == 2)
-            v |= 0x01; /* stereo playback */
-        put_byte(s->pb, v);
-        v |= 0x20; /* mp3 compressed */
-        put_byte(s->pb, v);
-        put_le16(s->pb, swf->samples_per_frame);  /* avg samples per frame */
-        put_le16(s->pb, 0);
-
-        put_swf_end_tag(s);
-    }
-
-    put_flush_packet(s->pb);
-    return 0;
-}
-
-static int swf_write_video(AVFormatContext *s,
-                           AVCodecContext *enc, const uint8_t *buf, int size)
-{
-    SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    /* Flash Player limit */
-    if (swf->swf_frame_number == 16000)
-        av_log(enc, AV_LOG_INFO, "warning: Flash Player limit of 16000 frames reached\n");
-
-    if (enc->codec_id == CODEC_ID_VP6F ||
-        enc->codec_id == CODEC_ID_FLV1) {
-        if (swf->video_frame_number == 0) {
-            /* create a new video object */
-            put_swf_tag(s, TAG_VIDEOSTREAM);
-            put_le16(pb, VIDEO_ID);
-            swf->vframes_pos = url_ftell(pb);
-            put_le16(pb, 15000); /* hard flash player limit */
-            put_le16(pb, enc->width);
-            put_le16(pb, enc->height);
-            put_byte(pb, 0);
-            put_byte(pb,ff_codec_get_tag(swf_codec_tags,enc->codec_id));
-            put_swf_end_tag(s);
-
-            /* place the video object for the first time */
-            put_swf_tag(s, TAG_PLACEOBJECT2);
-            put_byte(pb, 0x36);
-            put_le16(pb, 1);
-            put_le16(pb, VIDEO_ID);
-            put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0);
-            put_le16(pb, swf->video_frame_number);
-            put_tag(pb, "video");
-            put_byte(pb, 0x00);
-            put_swf_end_tag(s);
-        } else {
-            /* mark the character for update */
-            put_swf_tag(s, TAG_PLACEOBJECT2);
-            put_byte(pb, 0x11);
-            put_le16(pb, 1);
-            put_le16(pb, swf->video_frame_number);
-            put_swf_end_tag(s);
-        }
-
-        /* set video frame data */
-        put_swf_tag(s, TAG_VIDEOFRAME | TAG_LONG);
-        put_le16(pb, VIDEO_ID);
-        put_le16(pb, swf->video_frame_number++);
-        put_buffer(pb, buf, size);
-        put_swf_end_tag(s);
-    } else if (enc->codec_id == CODEC_ID_MJPEG) {
-        if (swf->swf_frame_number > 0) {
-            /* remove the shape */
-            put_swf_tag(s, TAG_REMOVEOBJECT);
-            put_le16(pb, SHAPE_ID); /* shape ID */
-            put_le16(pb, 1); /* depth */
-            put_swf_end_tag(s);
-
-            /* free the bitmap */
-            put_swf_tag(s, TAG_FREECHARACTER);
-            put_le16(pb, BITMAP_ID);
-            put_swf_end_tag(s);
-        }
-
-        put_swf_tag(s, TAG_JPEG2 | TAG_LONG);
-
-        put_le16(pb, BITMAP_ID); /* ID of the image */
-
-        /* a dummy jpeg header seems to be required */
-        put_be32(pb, 0xffd8ffd9);
-        /* write the jpeg image */
-        put_buffer(pb, buf, size);
-
-        put_swf_end_tag(s);
-
-        /* draw the shape */
-
-        put_swf_tag(s, TAG_PLACEOBJECT);
-        put_le16(pb, SHAPE_ID); /* shape ID */
-        put_le16(pb, 1); /* depth */
-        put_swf_matrix(pb, 20 << FRAC_BITS, 0, 0, 20 << FRAC_BITS, 0, 0);
-        put_swf_end_tag(s);
-    }
-
-    swf->swf_frame_number++;
-
-    /* streaming sound always should be placed just before showframe tags */
-    if (swf->audio_enc && av_fifo_size(swf->audio_fifo)) {
-        int frame_size = av_fifo_size(swf->audio_fifo);
-        put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);
-        put_le16(pb, swf->sound_samples);
-        put_le16(pb, 0); // seek samples
-        av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &put_buffer);
-        put_swf_end_tag(s);
-
-        /* update FIFO */
-        swf->sound_samples = 0;
-    }
-
-    /* output the frame */
-    put_swf_tag(s, TAG_SHOWFRAME);
-    put_swf_end_tag(s);
-
-    put_flush_packet(s->pb);
-
-    return 0;
-}
-
-static int swf_write_audio(AVFormatContext *s,
-                           AVCodecContext *enc, uint8_t *buf, int size)
-{
-    SWFContext *swf = s->priv_data;
-
-    /* Flash Player limit */
-    if (swf->swf_frame_number == 16000)
-        av_log(enc, AV_LOG_INFO, "warning: Flash Player limit of 16000 frames reached\n");
-
-    if (av_fifo_size(swf->audio_fifo) + size > AUDIO_FIFO_SIZE) {
-        av_log(s, AV_LOG_ERROR, "audio fifo too small to mux audio essence\n");
-        return -1;
-    }
-
-    av_fifo_generic_write(swf->audio_fifo, buf, size, NULL);
-    swf->sound_samples += enc->frame_size;
-
-    /* if audio only stream make sure we add swf frames */
-    if (!swf->video_enc)
-        swf_write_video(s, enc, 0, 0);
-
-    return 0;
-}
-
-static int swf_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
-    if (codec->codec_type == AVMEDIA_TYPE_AUDIO)
-        return swf_write_audio(s, codec, pkt->data, pkt->size);
-    else
-        return swf_write_video(s, codec, pkt->data, pkt->size);
-}
-
-static int swf_write_trailer(AVFormatContext *s)
-{
-    SWFContext *swf = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVCodecContext *enc, *video_enc;
-    int file_size, i;
-
-    video_enc = NULL;
-    for(i=0;i<s->nb_streams;i++) {
-        enc = s->streams[i]->codec;
-        if (enc->codec_type == AVMEDIA_TYPE_VIDEO)
-            video_enc = enc;
-        else
-            av_fifo_free(swf->audio_fifo);
-    }
-
-    put_swf_tag(s, TAG_END);
-    put_swf_end_tag(s);
-
-    put_flush_packet(s->pb);
-
-    /* patch file size and number of frames if not streamed */
-    if (!url_is_streamed(s->pb) && video_enc) {
-        file_size = url_ftell(pb);
-        url_fseek(pb, 4, SEEK_SET);
-        put_le32(pb, file_size);
-        url_fseek(pb, swf->duration_pos, SEEK_SET);
-        put_le16(pb, swf->video_frame_number);
-        url_fseek(pb, swf->vframes_pos, SEEK_SET);
-        put_le16(pb, swf->video_frame_number);
-        url_fseek(pb, file_size, SEEK_SET);
-    }
-    return 0;
-}
-
-#if CONFIG_SWF_MUXER
-AVOutputFormat swf_muxer = {
-    "swf",
-    NULL_IF_CONFIG_SMALL("Flash format"),
-    "application/x-shockwave-flash",
-    "swf",
-    sizeof(SWFContext),
-    CODEC_ID_MP3,
-    CODEC_ID_FLV1,
-    swf_write_header,
-    swf_write_packet,
-    swf_write_trailer,
-};
-#endif
-#if CONFIG_AVM2_MUXER
-AVOutputFormat avm2_muxer = {
-    "avm2",
-    NULL_IF_CONFIG_SMALL("Flash 9 (AVM2) format"),
-    "application/x-shockwave-flash",
-    NULL,
-    sizeof(SWFContext),
-    CODEC_ID_MP3,
-    CODEC_ID_FLV1,
-    swf_write_header,
-    swf_write_packet,
-    swf_write_trailer,
-};
-#endif
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
deleted file mode 100644
index 79cabdf..0000000
--- a/libavformat/tcp.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * TCP protocol
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include <unistd.h>
-#include "internal.h"
-#include "network.h"
-#include "os_support.h"
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#include <sys/time.h>
-
-typedef struct TCPContext {
-    int fd;
-} TCPContext;
-
-/* return non zero if error */
-static int tcp_open(URLContext *h, const char *uri, int flags)
-{
-    struct addrinfo hints, *ai, *cur_ai;
-    int port, fd = -1;
-    TCPContext *s = NULL;
-    fd_set wfds;
-    int fd_max, ret;
-    struct timeval tv;
-    socklen_t optlen;
-    char hostname[1024],proto[1024],path[1024];
-    char portstr[10];
-
-    ff_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
-        &port, path, sizeof(path), uri);
-    if (strcmp(proto,"tcp") || port <= 0 || port >= 65536)
-        return AVERROR(EINVAL);
-
-    memset(&hints, 0, sizeof(hints));
-    hints.ai_family = AF_UNSPEC;
-    hints.ai_socktype = SOCK_STREAM;
-    snprintf(portstr, sizeof(portstr), "%d", port);
-    if (getaddrinfo(hostname, portstr, &hints, &ai))
-        return AVERROR(EIO);
-
-    cur_ai = ai;
-
- restart:
-    fd = socket(cur_ai->ai_family, cur_ai->ai_socktype, cur_ai->ai_protocol);
-    if (fd < 0)
-        goto fail;
-    ff_socket_nonblock(fd, 1);
-
- redo:
-    ret = connect(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
-    if (ret < 0) {
-        if (ff_neterrno() == FF_NETERROR(EINTR))
-            goto redo;
-        if (ff_neterrno() != FF_NETERROR(EINPROGRESS) &&
-            ff_neterrno() != FF_NETERROR(EAGAIN))
-            goto fail;
-
-        /* wait until we are connected or until abort */
-        for(;;) {
-            if (url_interrupt_cb()) {
-                ret = AVERROR(EINTR);
-                goto fail1;
-            }
-            fd_max = fd;
-            FD_ZERO(&wfds);
-            FD_SET(fd, &wfds);
-            tv.tv_sec = 0;
-            tv.tv_usec = 100 * 1000;
-            ret = select(fd_max + 1, NULL, &wfds, NULL, &tv);
-            if (ret > 0 && FD_ISSET(fd, &wfds))
-                break;
-        }
-
-        /* test error */
-        optlen = sizeof(ret);
-        getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
-        if (ret != 0)
-            goto fail;
-    }
-    s = av_malloc(sizeof(TCPContext));
-    if (!s) {
-        freeaddrinfo(ai);
-        return AVERROR(ENOMEM);
-    }
-    h->priv_data = s;
-    h->is_streamed = 1;
-    s->fd = fd;
-    freeaddrinfo(ai);
-    return 0;
-
- fail:
-    if (cur_ai->ai_next) {
-        /* Retry with the next sockaddr */
-        cur_ai = cur_ai->ai_next;
-        if (fd >= 0)
-            closesocket(fd);
-        goto restart;
-    }
-    ret = AVERROR(EIO);
- fail1:
-    if (fd >= 0)
-        closesocket(fd);
-    freeaddrinfo(ai);
-    return ret;
-}
-
-static int tcp_read(URLContext *h, uint8_t *buf, int size)
-{
-    TCPContext *s = h->priv_data;
-    int len, fd_max, ret;
-    fd_set rfds;
-    struct timeval tv;
-
-    for (;;) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        fd_max = s->fd;
-        FD_ZERO(&rfds);
-        FD_SET(s->fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(fd_max + 1, &rfds, NULL, NULL, &tv);
-        if (ret > 0 && FD_ISSET(s->fd, &rfds)) {
-            len = recv(s->fd, buf, size, 0);
-            if (len < 0) {
-                if (ff_neterrno() != FF_NETERROR(EINTR) &&
-                    ff_neterrno() != FF_NETERROR(EAGAIN))
-                    return AVERROR(ff_neterrno());
-            } else return len;
-        } else if (ret < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return -1;
-        }
-    }
-}
-
-static int tcp_write(URLContext *h, uint8_t *buf, int size)
-{
-    TCPContext *s = h->priv_data;
-    int ret, size1, fd_max, len;
-    fd_set wfds;
-    struct timeval tv;
-
-    size1 = size;
-    while (size > 0) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        fd_max = s->fd;
-        FD_ZERO(&wfds);
-        FD_SET(s->fd, &wfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(fd_max + 1, NULL, &wfds, NULL, &tv);
-        if (ret > 0 && FD_ISSET(s->fd, &wfds)) {
-            len = send(s->fd, buf, size, 0);
-            if (len < 0) {
-                if (ff_neterrno() != FF_NETERROR(EINTR) &&
-                    ff_neterrno() != FF_NETERROR(EAGAIN))
-                    return AVERROR(ff_neterrno());
-                continue;
-            }
-            size -= len;
-            buf += len;
-        } else if (ret < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return -1;
-        }
-    }
-    return size1 - size;
-}
-
-static int tcp_close(URLContext *h)
-{
-    TCPContext *s = h->priv_data;
-    closesocket(s->fd);
-    av_free(s);
-    return 0;
-}
-
-static int tcp_get_file_handle(URLContext *h)
-{
-    TCPContext *s = h->priv_data;
-    return s->fd;
-}
-
-URLProtocol tcp_protocol = {
-    "tcp",
-    tcp_open,
-    tcp_read,
-    tcp_write,
-    NULL, /* seek */
-    tcp_close,
-    .url_get_file_handle = tcp_get_file_handle,
-};
diff --git a/libavformat/thp.c b/libavformat/thp.c
deleted file mode 100644
index 82966dd..0000000
--- a/libavformat/thp.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * THP Demuxer
- * Copyright (c) 2007 Marco Gerards
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-typedef struct ThpDemuxContext {
-    int              version;
-    int              first_frame;
-    int              first_framesz;
-    int              last_frame;
-    int              compoff;
-    int              framecnt;
-    AVRational       fps;
-    int              frame;
-    int              next_frame;
-    int              next_framesz;
-    int              video_stream_index;
-    int              audio_stream_index;
-    int              compcount;
-    unsigned char    components[16];
-    AVStream*        vst;
-    int              has_audio;
-    int              audiosize;
-} ThpDemuxContext;
-
-
-static int thp_probe(AVProbeData *p)
-{
-    /* check file header */
-    if (AV_RL32(p->buf) == MKTAG('T', 'H', 'P', '\0'))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int thp_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    ThpDemuxContext *thp = s->priv_data;
-    AVStream *st;
-    ByteIOContext *pb = s->pb;
-    int i;
-
-    /* Read the file header.  */
-                           get_be32(pb); /* Skip Magic.  */
-    thp->version         = get_be32(pb);
-
-                           get_be32(pb); /* Max buf size.  */
-                           get_be32(pb); /* Max samples.  */
-
-    thp->fps             = av_d2q(av_int2flt(get_be32(pb)), INT_MAX);
-    thp->framecnt        = get_be32(pb);
-    thp->first_framesz   = get_be32(pb);
-                           get_be32(pb); /* Data size.  */
-
-    thp->compoff         = get_be32(pb);
-                           get_be32(pb); /* offsetDataOffset.  */
-    thp->first_frame     = get_be32(pb);
-    thp->last_frame      = get_be32(pb);
-
-    thp->next_framesz    = thp->first_framesz;
-    thp->next_frame      = thp->first_frame;
-
-    /* Read the component structure.  */
-    url_fseek (pb, thp->compoff, SEEK_SET);
-    thp->compcount       = get_be32(pb);
-
-    /* Read the list of component types.  */
-    get_buffer(pb, thp->components, 16);
-
-    for (i = 0; i < thp->compcount; i++) {
-        if (thp->components[i] == 0) {
-            if (thp->vst != 0)
-                break;
-
-            /* Video component.  */
-            st = av_new_stream(s, 0);
-            if (!st)
-                return AVERROR(ENOMEM);
-
-            /* The denominator and numerator are switched because 1/fps
-               is required.  */
-            av_set_pts_info(st, 64, thp->fps.den, thp->fps.num);
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-            st->codec->codec_id = CODEC_ID_THP;
-            st->codec->codec_tag = 0;  /* no fourcc */
-            st->codec->width = get_be32(pb);
-            st->codec->height = get_be32(pb);
-            st->codec->sample_rate = av_q2d(thp->fps);
-            thp->vst = st;
-            thp->video_stream_index = st->index;
-
-            if (thp->version == 0x11000)
-                get_be32(pb); /* Unknown.  */
-        } else if (thp->components[i] == 1) {
-            if (thp->has_audio != 0)
-                break;
-
-            /* Audio component.  */
-            st = av_new_stream(s, 0);
-            if (!st)
-                return AVERROR(ENOMEM);
-
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-            st->codec->codec_id = CODEC_ID_ADPCM_THP;
-            st->codec->codec_tag = 0;  /* no fourcc */
-            st->codec->channels    = get_be32(pb); /* numChannels.  */
-            st->codec->sample_rate = get_be32(pb); /* Frequency.  */
-
-            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-            thp->audio_stream_index = st->index;
-            thp->has_audio = 1;
-        }
-    }
-
-    return 0;
-}
-
-static int thp_read_packet(AVFormatContext *s,
-                            AVPacket *pkt)
-{
-    ThpDemuxContext *thp = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int size;
-    int ret;
-
-    if (thp->audiosize == 0) {
-        /* Terminate when last frame is reached.  */
-        if (thp->frame >= thp->framecnt)
-            return AVERROR(EIO);
-
-        url_fseek(pb, thp->next_frame, SEEK_SET);
-
-        /* Locate the next frame and read out its size.  */
-        thp->next_frame += thp->next_framesz;
-        thp->next_framesz = get_be32(pb);
-
-                        get_be32(pb); /* Previous total size.  */
-        size          = get_be32(pb); /* Total size of this frame.  */
-
-        /* Store the audiosize so the next time this function is called,
-           the audio can be read.  */
-        if (thp->has_audio)
-            thp->audiosize = get_be32(pb); /* Audio size.  */
-        else
-            thp->frame++;
-
-        ret = av_get_packet(pb, pkt, size);
-        if (ret != size) {
-            av_free_packet(pkt);
-            return AVERROR(EIO);
-        }
-
-        pkt->stream_index = thp->video_stream_index;
-    } else {
-        ret = av_get_packet(pb, pkt, thp->audiosize);
-        if (ret != thp->audiosize) {
-            av_free_packet(pkt);
-            return AVERROR(EIO);
-        }
-
-        pkt->stream_index = thp->audio_stream_index;
-        thp->audiosize = 0;
-        thp->frame++;
-    }
-
-    return 0;
-}
-
-AVInputFormat thp_demuxer = {
-    "thp",
-    NULL_IF_CONFIG_SMALL("THP"),
-    sizeof(ThpDemuxContext),
-    thp_probe,
-    thp_read_header,
-    thp_read_packet
-};
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
deleted file mode 100644
index 938eea5..0000000
--- a/libavformat/tiertexseq.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Tiertex Limited SEQ File Demuxer
- * Copyright (c) 2006 Gregory Montoir (cyx at users.sourceforge.net)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Tiertex Limited SEQ file demuxer
- */
-
-#include "avformat.h"
-
-#define SEQ_FRAME_SIZE         6144
-#define SEQ_FRAME_W            256
-#define SEQ_FRAME_H            128
-#define SEQ_NUM_FRAME_BUFFERS  30
-#define SEQ_AUDIO_BUFFER_SIZE  882
-#define SEQ_SAMPLE_RATE        22050
-#define SEQ_FRAME_RATE         25
-
-
-typedef struct TiertexSeqFrameBuffer {
-    int fill_size;
-    int data_size;
-    unsigned char *data;
-} TiertexSeqFrameBuffer;
-
-typedef struct SeqDemuxContext {
-    int audio_stream_index;
-    int video_stream_index;
-    int current_frame_pts;
-    int current_frame_offs;
-    TiertexSeqFrameBuffer frame_buffers[SEQ_NUM_FRAME_BUFFERS];
-    int frame_buffers_count;
-    unsigned int current_audio_data_size;
-    unsigned int current_audio_data_offs;
-    unsigned int current_pal_data_size;
-    unsigned int current_pal_data_offs;
-    unsigned int current_video_data_size;
-    unsigned char *current_video_data_ptr;
-    int audio_buffer_full;
-} SeqDemuxContext;
-
-
-static int seq_probe(AVProbeData *p)
-{
-    int i;
-
-    if (p->buf_size < 258)
-        return 0;
-
-    /* there's no real header in a .seq file, the only thing they have in common */
-    /* is the first 256 bytes of the file which are always filled with 0 */
-    for (i = 0; i < 256; i++)
-        if (p->buf[i])
-            return 0;
-
-    if(p->buf[256]==0 && p->buf[257]==0)
-        return 0;
-
-    /* only one fourth of the score since the previous check is too naive */
-    return AVPROBE_SCORE_MAX / 4;
-}
-
-static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb)
-{
-    int i, sz;
-    TiertexSeqFrameBuffer *seq_buffer;
-
-    url_fseek(pb, 256, SEEK_SET);
-
-    for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) {
-        sz = get_le16(pb);
-        if (sz == 0)
-            break;
-        else {
-            seq_buffer = &seq->frame_buffers[i];
-            seq_buffer->fill_size = 0;
-            seq_buffer->data_size = sz;
-            seq_buffer->data = av_malloc(sz);
-            if (!seq_buffer->data)
-                return AVERROR(ENOMEM);
-        }
-    }
-    seq->frame_buffers_count = i;
-    return 0;
-}
-
-static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_num, unsigned int data_offs, int data_size)
-{
-    TiertexSeqFrameBuffer *seq_buffer;
-
-    if (buffer_num >= SEQ_NUM_FRAME_BUFFERS)
-        return AVERROR_INVALIDDATA;
-
-    seq_buffer = &seq->frame_buffers[buffer_num];
-    if (seq_buffer->fill_size + data_size > seq_buffer->data_size || data_size <= 0)
-        return AVERROR_INVALIDDATA;
-
-    url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
-    if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
-        return AVERROR(EIO);
-
-    seq_buffer->fill_size += data_size;
-    return 0;
-}
-
-static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb)
-{
-    unsigned int offset_table[4], buffer_num[4];
-    TiertexSeqFrameBuffer *seq_buffer;
-    int i, e, err;
-
-    seq->current_frame_offs += SEQ_FRAME_SIZE;
-    url_fseek(pb, seq->current_frame_offs, SEEK_SET);
-
-    /* sound data */
-    seq->current_audio_data_offs = get_le16(pb);
-    if (seq->current_audio_data_offs) {
-        seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2;
-    } else {
-        seq->current_audio_data_size = 0;
-    }
-
-    /* palette data */
-    seq->current_pal_data_offs = get_le16(pb);
-    if (seq->current_pal_data_offs) {
-        seq->current_pal_data_size = 768;
-    } else {
-        seq->current_pal_data_size = 0;
-    }
-
-    /* video data */
-    for (i = 0; i < 4; i++)
-        buffer_num[i] = get_byte(pb);
-
-    for (i = 0; i < 4; i++)
-        offset_table[i] = get_le16(pb);
-
-    for (i = 0; i < 3; i++) {
-        if (offset_table[i]) {
-            for (e = i + 1; e < 3 && offset_table[e] == 0; e++);
-            err = seq_fill_buffer(seq, pb, buffer_num[1 + i],
-              offset_table[i],
-              offset_table[e] - offset_table[i]);
-            if (err)
-                return err;
-        }
-    }
-
-    if (buffer_num[0] != 255) {
-        if (buffer_num[0] >= SEQ_NUM_FRAME_BUFFERS)
-            return AVERROR_INVALIDDATA;
-
-        seq_buffer = &seq->frame_buffers[buffer_num[0]];
-        seq->current_video_data_size = seq_buffer->fill_size;
-        seq->current_video_data_ptr  = seq_buffer->data;
-        seq_buffer->fill_size = 0;
-    } else {
-        seq->current_video_data_size = 0;
-        seq->current_video_data_ptr  = 0;
-    }
-
-    return 0;
-}
-
-static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    int i, rc;
-    SeqDemuxContext *seq = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-
-    /* init internal buffers */
-    rc = seq_init_frame_buffers(seq, pb);
-    if (rc)
-        return rc;
-
-    seq->current_frame_offs = 0;
-
-    /* preload (no audio data, just buffer operations related data) */
-    for (i = 1; i <= 100; i++) {
-        rc = seq_parse_frame_data(seq, pb);
-        if (rc)
-            return rc;
-    }
-
-    seq->current_frame_pts = 0;
-
-    seq->audio_buffer_full = 0;
-
-    /* initialize the video decoder stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 32, 1, SEQ_FRAME_RATE);
-    seq->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_TIERTEXSEQVIDEO;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = SEQ_FRAME_W;
-    st->codec->height = SEQ_FRAME_H;
-
-    /* initialize the audio decoder stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE);
-    seq->audio_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_PCM_S16BE;
-    st->codec->codec_tag = 0;  /* no tag */
-    st->codec->channels = 1;
-    st->codec->sample_rate = SEQ_SAMPLE_RATE;
-    st->codec->bits_per_coded_sample = 16;
-    st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels;
-    st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-
-    return 0;
-}
-
-static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int rc;
-    SeqDemuxContext *seq = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    if (!seq->audio_buffer_full) {
-        rc = seq_parse_frame_data(seq, pb);
-        if (rc)
-            return rc;
-
-        /* video packet */
-        if (seq->current_pal_data_size + seq->current_video_data_size != 0) {
-            if (av_new_packet(pkt, 1 + seq->current_pal_data_size + seq->current_video_data_size))
-                return AVERROR(ENOMEM);
-
-            pkt->data[0] = 0;
-            if (seq->current_pal_data_size) {
-                pkt->data[0] |= 1;
-                url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
-                if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
-                    return AVERROR(EIO);
-            }
-            if (seq->current_video_data_size) {
-                pkt->data[0] |= 2;
-                memcpy(&pkt->data[1 + seq->current_pal_data_size],
-                  seq->current_video_data_ptr,
-                  seq->current_video_data_size);
-            }
-            pkt->stream_index = seq->video_stream_index;
-            pkt->pts = seq->current_frame_pts;
-
-            /* sound buffer will be processed on next read_packet() call */
-            seq->audio_buffer_full = 1;
-            return 0;
-       }
-    }
-
-    /* audio packet */
-    if (seq->current_audio_data_offs == 0) /* end of data reached */
-        return AVERROR(EIO);
-
-    url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET);
-    rc = av_get_packet(pb, pkt, seq->current_audio_data_size);
-    if (rc < 0)
-        return rc;
-
-    pkt->stream_index = seq->audio_stream_index;
-    seq->current_frame_pts++;
-
-    seq->audio_buffer_full = 0;
-    return 0;
-}
-
-static int seq_read_close(AVFormatContext *s)
-{
-    int i;
-    SeqDemuxContext *seq = s->priv_data;
-
-    for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++)
-        av_free(seq->frame_buffers[i].data);
-
-    return 0;
-}
-
-AVInputFormat tiertexseq_demuxer = {
-    "tiertexseq",
-    NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ format"),
-    sizeof(SeqDemuxContext),
-    seq_probe,
-    seq_read_header,
-    seq_read_packet,
-    seq_read_close,
-};
diff --git a/libavformat/timefilter.c b/libavformat/timefilter.c
deleted file mode 100644
index 4a58224..0000000
--- a/libavformat/timefilter.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Delay Locked Loop based time filter
- * Copyright (c) 2009 Samalyse
- * Copyright (c) 2009 Michael Niedermayer
- * Author: Olivier Guilyardi <olivier samalyse com>
- *         Michael Niedermayer <michaelni gmx at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "config.h"
-#include "avformat.h"
-#include "timefilter.h"
-
-struct TimeFilter {
-    /// Delay Locked Loop data. These variables refer to mathematical
-    /// concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf
-    double cycle_time;
-    double feedback2_factor;
-    double feedback3_factor;
-    double clock_period;
-    int count;
-};
-
-TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, double feedback3_factor)
-{
-    TimeFilter *self        = av_mallocz(sizeof(TimeFilter));
-    self->clock_period      = clock_period;
-    self->feedback2_factor  = feedback2_factor;
-    self->feedback3_factor  = feedback3_factor;
-    return self;
-}
-
-void ff_timefilter_destroy(TimeFilter *self)
-{
-    av_freep(&self);
-}
-
-void ff_timefilter_reset(TimeFilter *self)
-{
-    self->count      = 0;
-}
-
-double ff_timefilter_update(TimeFilter *self, double system_time, double period)
-{
-    self->count++;
-    if (self->count==1) {
-        /// init loop
-        self->cycle_time    = system_time;
-    } else {
-        double loop_error;
-        self->cycle_time   += self->clock_period * period;
-        /// calculate loop error
-        loop_error          = system_time - self->cycle_time;
-
-        /// update loop
-        self->cycle_time   += FFMAX(self->feedback2_factor, 1.0/(self->count)) * loop_error;
-        self->clock_period += self->feedback3_factor * loop_error / period;
-    }
-    return self->cycle_time;
-}
-
-#ifdef TEST
-#include "libavutil/lfg.h"
-#define LFG_MAX ((1LL << 32) - 1)
-
-int main(void)
-{
-    AVLFG prng;
-    double n0,n1;
-#define SAMPLES 1000
-    double ideal[SAMPLES];
-    double samples[SAMPLES];
-#if 1
-    for(n0= 0; n0<40; n0=2*n0+1){
-        for(n1= 0; n1<10; n1=2*n1+1){
-#else
-    {{
-        n0=7;
-        n1=1;
-#endif
-            double best_error= 1000000000;
-            double bestpar0=1;
-            double bestpar1=0.001;
-            int better, i;
-
-            av_lfg_init(&prng, 123);
-            for(i=0; i<SAMPLES; i++){
-                ideal[i]  = 10 + i + n1*i/(1000);
-                samples[i] = ideal[i] + n0 * (av_lfg_get(&prng) - LFG_MAX / 2)
-                                           / (LFG_MAX * 10LL);
-            }
-
-            do{
-                double par0, par1;
-                better=0;
-                for(par0= bestpar0*0.8; par0<=bestpar0*1.21; par0+=bestpar0*0.05){
-                    for(par1= bestpar1*0.8; par1<=bestpar1*1.21; par1+=bestpar1*0.05){
-                        double error=0;
-                        TimeFilter *tf= ff_timefilter_new(1, par0, par1);
-                        for(i=0; i<SAMPLES; i++){
-                            double filtered;
-                            filtered=  ff_timefilter_update(tf, samples[i], 1);
-                            error += (filtered - ideal[i]) * (filtered - ideal[i]);
-                        }
-                        ff_timefilter_destroy(tf);
-                        if(error < best_error){
-                            best_error= error;
-                            bestpar0= par0;
-                            bestpar1= par1;
-                            better=1;
-                        }
-                    }
-                }
-            }while(better);
-#if 0
-            double lastfil=9;
-            TimeFilter *tf= ff_timefilter_new(1, bestpar0, bestpar1);
-            for(i=0; i<SAMPLES; i++){
-                double filtered;
-                filtered=  ff_timefilter_update(tf, samples[i], 1);
-                printf("%f %f %f %f\n", i - samples[i] + 10, filtered - samples[i], samples[FFMAX(i, 1)] - samples[FFMAX(i-1, 0)], filtered - lastfil);
-                lastfil= filtered;
-            }
-            ff_timefilter_destroy(tf);
-#else
-            printf(" [%f %f %9f]", bestpar0, bestpar1, best_error);
-#endif
-        }
-        printf("\n");
-    }
-    return 0;
-}
-#endif
diff --git a/libavformat/timefilter.h b/libavformat/timefilter.h
deleted file mode 100644
index ded8ec7..0000000
--- a/libavformat/timefilter.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Delay Locked Loop based time filter prototypes and declarations
- * Copyright (c) 2009 Samalyse
- * Copyright (c) 2009 Michael Niedermayer
- * Author: Olivier Guilyardi <olivier samalyse com>
- *         Michael Niedermayer <michaelni gmx at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_TIMEFILTER_H
-#define AVFORMAT_TIMEFILTER_H
-
-/**
- * Opaque type representing a time filter state
- *
- * The purpose of this filter is to provide a way to compute accurate time
- * stamps that can be compared to wall clock time, especially when dealing
- * with two clocks: the system clock and a hardware device clock, such as
- * a soundcard.
- */
-typedef struct TimeFilter TimeFilter;
-
-
-/**
- * Create a new Delay Locked Loop time filter
- *
- * feedback2_factor and feedback3_factor are the factors used for the
- * multiplications that are respectively performed in the second and third
- * feedback paths of the loop.
- *
- * Unless you know what you are doing, you should set these as follow:
- *
- * o = 2 * M_PI * bandwidth * period
- * feedback2_factor = sqrt(2 * o)
- * feedback3_factor = o * o
- *
- * Where bandwidth is up to you to choose. Smaller values will filter out more
- * of the jitter, but also take a longer time for the loop to settle. A good
- * starting point is something between 0.3 and 3 Hz.
- *
- * @param clock_period period of the hardware clock in seconds
- *        (for example 1.0/44100)
- *
- * For more details about these parameters and background concepts please see:
- * http://www.kokkinizita.net/papers/usingdll.pdf
- */
-TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, double feedback3_factor);
-
-/**
- * Update the filter
- *
- * This function must be called in real time, at each process cycle.
- *
- * @param period the device cycle duration in clock_periods. For example, at
- * 44.1kHz and a buffer size of 512 frames, period = 512 when clock_period
- * was 1.0/44100, or 512/44100 if clock_period was 1.
- *
- * system_time, in seconds, should be the value of the system clock time,
- * at (or as close as possible to) the moment the device hardware interrupt
- * occured (or any other event the device clock raises at the beginning of a
- * cycle).
- *
- * @return the filtered time, in seconds
- */
-double ff_timefilter_update(TimeFilter *self, double system_time, double period);
-
-/**
- * Reset the filter
- *
- * This function should mainly be called in case of XRUN.
- *
- * Warning: after calling this, the filter is in an undetermined state until
- * the next call to ff_timefilter_update()
- */
-void ff_timefilter_reset(TimeFilter *);
-
-/**
- * Free all resources associated with the filter
- */
-void ff_timefilter_destroy(TimeFilter *);
-
-#endif /* AVFORMAT_TIMEFILTER_H */
diff --git a/libavformat/tmv.c b/libavformat/tmv.c
deleted file mode 100644
index 4be2f32..0000000
--- a/libavformat/tmv.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 8088flex TMV file demuxer
- * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * 8088flex TMV file demuxer
- * @file
- * @author Daniel Verkamp
- * @sa http://www.oldskool.org/pc/8088_Corruption
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-enum {
-    TMV_PADDING = 0x01,
-    TMV_STEREO  = 0x02,
-};
-
-#define TMV_TAG MKTAG('T', 'M', 'A', 'V')
-
-typedef struct TMVContext {
-    unsigned audio_chunk_size;
-    unsigned video_chunk_size;
-    unsigned padding;
-    unsigned stream_index;
-} TMVContext;
-
-#define TMV_HEADER_SIZE       12
-
-#define PROBE_MIN_SAMPLE_RATE 5000
-#define PROBE_MAX_FPS         120
-#define PROBE_MIN_AUDIO_SIZE  (PROBE_MIN_SAMPLE_RATE / PROBE_MAX_FPS)
-
-static int tmv_probe(AVProbeData *p)
-{
-    if (AV_RL32(p->buf)   == TMV_TAG &&
-        AV_RL16(p->buf+4) >= PROBE_MIN_SAMPLE_RATE &&
-        AV_RL16(p->buf+6) >= PROBE_MIN_AUDIO_SIZE  &&
-               !p->buf[8] && // compression method
-                p->buf[9] && // char cols
-                p->buf[10])  // char rows
-        return AVPROBE_SCORE_MAX /
-            ((p->buf[9] == 40 && p->buf[10] == 25) ? 1 : 4);
-    return 0;
-}
-
-static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    TMVContext *tmv   = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *vst, *ast;
-    AVRational fps;
-    unsigned comp_method, char_cols, char_rows, features;
-
-    if (get_le32(pb) != TMV_TAG)
-        return -1;
-
-    if (!(vst = av_new_stream(s, 0)))
-        return AVERROR(ENOMEM);
-
-    if (!(ast = av_new_stream(s, 0)))
-        return AVERROR(ENOMEM);
-
-    ast->codec->sample_rate = get_le16(pb);
-    if (!ast->codec->sample_rate) {
-        av_log(s, AV_LOG_ERROR, "invalid sample rate\n");
-        return -1;
-    }
-
-    tmv->audio_chunk_size   = get_le16(pb);
-    if (!tmv->audio_chunk_size) {
-        av_log(s, AV_LOG_ERROR, "invalid audio chunk size\n");
-        return -1;
-    }
-
-    comp_method             = get_byte(pb);
-    if (comp_method) {
-        av_log(s, AV_LOG_ERROR, "unsupported compression method %d\n",
-               comp_method);
-        return -1;
-    }
-
-    char_cols = get_byte(pb);
-    char_rows = get_byte(pb);
-    tmv->video_chunk_size = char_cols * char_rows * 2;
-
-    features  = get_byte(pb);
-    if (features & ~(TMV_PADDING | TMV_STEREO)) {
-        av_log(s, AV_LOG_ERROR, "unsupported features 0x%02x\n",
-               features & ~(TMV_PADDING | TMV_STEREO));
-        return -1;
-    }
-
-    ast->codec->codec_type            = AVMEDIA_TYPE_AUDIO;
-    ast->codec->codec_id              = CODEC_ID_PCM_U8;
-    ast->codec->channels              = features & TMV_STEREO ? 2 : 1;
-    ast->codec->bits_per_coded_sample = 8;
-    ast->codec->bit_rate              = ast->codec->sample_rate *
-                                        ast->codec->bits_per_coded_sample;
-    av_set_pts_info(ast, 32, 1, ast->codec->sample_rate);
-
-    fps.num = ast->codec->sample_rate * ast->codec->channels;
-    fps.den = tmv->audio_chunk_size;
-    av_reduce(&fps.num, &fps.den, fps.num, fps.den, 0xFFFFFFFFLL);
-
-    vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    vst->codec->codec_id   = CODEC_ID_TMV;
-    vst->codec->pix_fmt    = PIX_FMT_PAL8;
-    vst->codec->width      = char_cols * 8;
-    vst->codec->height     = char_rows * 8;
-    av_set_pts_info(vst, 32, fps.den, fps.num);
-
-    if (features & TMV_PADDING)
-        tmv->padding =
-            ((tmv->video_chunk_size + tmv->audio_chunk_size + 511) & ~511) -
-             (tmv->video_chunk_size + tmv->audio_chunk_size);
-
-    vst->codec->bit_rate = ((tmv->video_chunk_size + tmv->padding) *
-                            fps.num * 8) / fps.den;
-
-    return 0;
-}
-
-static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    TMVContext *tmv   = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret, pkt_size = tmv->stream_index ?
-                        tmv->audio_chunk_size : tmv->video_chunk_size;
-
-    if (url_feof(pb))
-        return AVERROR_EOF;
-
-    ret = av_get_packet(pb, pkt, pkt_size);
-
-    if (tmv->stream_index)
-        url_fskip(pb, tmv->padding);
-
-    pkt->stream_index  = tmv->stream_index;
-    tmv->stream_index ^= 1;
-    pkt->flags        |= AV_PKT_FLAG_KEY;
-
-    return ret;
-}
-
-static int tmv_read_seek(AVFormatContext *s, int stream_index,
-                         int64_t timestamp, int flags)
-{
-    TMVContext *tmv = s->priv_data;
-    int64_t pos;
-
-    if (stream_index)
-        return -1;
-
-    pos = timestamp *
-          (tmv->audio_chunk_size + tmv->video_chunk_size + tmv->padding);
-
-    url_fseek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET);
-    tmv->stream_index = 0;
-    return 0;
-}
-
-AVInputFormat tmv_demuxer = {
-    "tmv",
-    NULL_IF_CONFIG_SMALL("8088flex TMV"),
-    sizeof(TMVContext),
-    tmv_probe,
-    tmv_read_header,
-    tmv_read_packet,
-    NULL,
-    tmv_read_seek,
-    .flags = AVFMT_GENERIC_INDEX,
-};
diff --git a/libavformat/tta.c b/libavformat/tta.c
deleted file mode 100644
index 66d3bad..0000000
--- a/libavformat/tta.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * TTA demuxer
- * Copyright (c) 2006 Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavcodec/get_bits.h"
-#include "avformat.h"
-#include "id3v2.h"
-#include "id3v1.h"
-
-typedef struct {
-    int totalframes, currentframe;
-} TTAContext;
-
-static int tta_probe(AVProbeData *p)
-{
-    const uint8_t *d = p->buf;
-
-    if (ff_id3v2_match(d))
-        d += ff_id3v2_tag_len(d);
-
-    if (d - p->buf >= p->buf_size)
-        return 0;
-
-    if (d[0] == 'T' && d[1] == 'T' && d[2] == 'A' && d[3] == '1')
-        return 80;
-    return 0;
-}
-
-static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    TTAContext *c = s->priv_data;
-    AVStream *st;
-    int i, channels, bps, samplerate, datalen, framelen;
-    uint64_t framepos, start_offset;
-
-    ff_id3v2_read(s);
-    if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
-        ff_id3v1_read(s);
-
-    start_offset = url_ftell(s->pb);
-    if (get_le32(s->pb) != AV_RL32("TTA1"))
-        return -1; // not tta file
-
-    url_fskip(s->pb, 2); // FIXME: flags
-    channels = get_le16(s->pb);
-    bps = get_le16(s->pb);
-    samplerate = get_le32(s->pb);
-    if(samplerate <= 0 || samplerate > 1000000){
-        av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
-        return -1;
-    }
-
-    datalen = get_le32(s->pb);
-    if(datalen < 0){
-        av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
-        return -1;
-    }
-
-    url_fskip(s->pb, 4); // header crc
-
-    framelen = samplerate*256/245;
-    c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
-    c->currentframe = 0;
-
-    if(c->totalframes >= UINT_MAX/sizeof(uint32_t)){
-        av_log(s, AV_LOG_ERROR, "totalframes too large\n");
-        return -1;
-    }
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    av_set_pts_info(st, 64, 1, samplerate);
-    st->start_time = 0;
-    st->duration = datalen;
-
-    framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
-
-    for (i = 0; i < c->totalframes; i++) {
-        uint32_t size = get_le32(s->pb);
-        av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
-        framepos += size;
-    }
-    url_fskip(s->pb, 4); // seektable crc
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_TTA;
-    st->codec->channels = channels;
-    st->codec->sample_rate = samplerate;
-    st->codec->bits_per_coded_sample = bps;
-
-    st->codec->extradata_size = url_ftell(s->pb) - start_offset;
-    if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
-        //this check is redundant as get_buffer should fail
-        av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
-        return -1;
-    }
-    st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
-    url_fseek(s->pb, start_offset, SEEK_SET);
-    get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
-
-    return 0;
-}
-
-static int tta_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    TTAContext *c = s->priv_data;
-    AVStream *st = s->streams[0];
-    int size, ret;
-
-    // FIXME!
-    if (c->currentframe > c->totalframes)
-        return -1;
-
-    size = st->index_entries[c->currentframe].size;
-
-    ret = av_get_packet(s->pb, pkt, size);
-    pkt->dts = st->index_entries[c->currentframe++].timestamp;
-    return ret;
-}
-
-static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    TTAContext *c = s->priv_data;
-    AVStream *st = s->streams[stream_index];
-    int index = av_index_search_timestamp(st, timestamp, flags);
-    if (index < 0)
-        return -1;
-
-    c->currentframe = index;
-    url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
-
-    return 0;
-}
-
-AVInputFormat tta_demuxer = {
-    "tta",
-    NULL_IF_CONFIG_SMALL("True Audio"),
-    sizeof(TTAContext),
-    tta_probe,
-    tta_read_header,
-    tta_read_packet,
-    NULL,
-    tta_read_seek,
-    .extensions = "tta",
-};
diff --git a/libavformat/txd.c b/libavformat/txd.c
deleted file mode 100644
index 38bdb1b..0000000
--- a/libavformat/txd.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Renderware TeXture Dictionary (.txd) demuxer
- * Copyright (c) 2007 Ivo van Poorten
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define TXD_FILE            0x16
-#define TXD_INFO            0x01
-#define TXD_EXTRA           0x03
-#define TXD_TEXTURE         0x15
-#define TXD_TEXTURE_DATA    0x01
-#define TXD_MARKER          0x1803ffff
-#define TXD_MARKER2         0x1003ffff
-
-static int txd_probe(AVProbeData * pd) {
-    if (AV_RL32(pd->buf  ) == TXD_FILE &&
-       (AV_RL32(pd->buf+8) == TXD_MARKER || AV_RL32(pd->buf+8) == TXD_MARKER2))
-        return AVPROBE_SCORE_MAX;
-    return 0;
-}
-
-static int txd_read_header(AVFormatContext *s, AVFormatParameters *ap) {
-    AVStream *st;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_TXD;
-    st->codec->time_base.den = 5;
-    st->codec->time_base.num = 1;
-    /* the parameters will be extracted from the compressed bitstream */
-    return 0;
-}
-
-static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) {
-    ByteIOContext *pb = s->pb;
-    unsigned int id, chunk_size, marker;
-    int ret;
-
-next_chunk:
-    id         = get_le32(pb);
-    chunk_size = get_le32(pb);
-    marker     = get_le32(pb);
-
-    if (url_feof(s->pb))
-        return AVERROR_EOF;
-    if (marker != TXD_MARKER && marker != TXD_MARKER2) {
-        av_log(s, AV_LOG_ERROR, "marker does not match\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    switch (id) {
-        case TXD_INFO:
-            if (chunk_size > 100)
-                break;
-        case TXD_EXTRA:
-            url_fskip(s->pb, chunk_size);
-        case TXD_FILE:
-        case TXD_TEXTURE:
-            goto next_chunk;
-        default:
-            av_log(s, AV_LOG_ERROR, "unknown chunk id %i\n", id);
-            return AVERROR_INVALIDDATA;
-    }
-
-    ret = av_get_packet(s->pb, pkt, chunk_size);
-    if (ret < 0)
-        return ret;
-    pkt->stream_index = 0;
-
-    return 0;
-}
-
-AVInputFormat txd_demuxer =
-{
-    "txd",
-    NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
-    0,
-    txd_probe,
-    txd_read_header,
-    txd_read_packet,
-};
diff --git a/libavformat/udp.c b/libavformat/udp.c
deleted file mode 100644
index a11f4c3..0000000
--- a/libavformat/udp.c
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * UDP prototype streaming system
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * UDP protocol
- */
-
-#define _BSD_SOURCE     /* Needed for using struct ip_mreq with recent glibc */
-#include "avformat.h"
-#include <unistd.h>
-#include "internal.h"
-#include "network.h"
-#include "os_support.h"
-#if HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#include <sys/time.h>
-
-#ifndef IPV6_ADD_MEMBERSHIP
-#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
-#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
-#endif
-#ifndef IN_MULTICAST
-#define IN_MULTICAST(a) ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000)
-#endif
-#ifndef IN6_IS_ADDR_MULTICAST
-#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
-#endif
-
-typedef struct {
-    int udp_fd;
-    int ttl;
-    int buffer_size;
-    int is_multicast;
-    int local_port;
-    int reuse_socket;
-    struct sockaddr_storage dest_addr;
-    int dest_addr_len;
-} UDPContext;
-
-#define UDP_TX_BUF_SIZE 32768
-#define UDP_MAX_PKT_SIZE 65536
-
-static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
-                                 struct sockaddr *addr)
-{
-#ifdef IP_MULTICAST_TTL
-    if (addr->sa_family == AF_INET) {
-        if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) {
-            av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL): %s\n", strerror(errno));
-            return -1;
-        }
-    }
-#endif
-#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS)
-    if (addr->sa_family == AF_INET6) {
-        if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) {
-            av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS): %s\n", strerror(errno));
-            return -1;
-        }
-    }
-#endif
-    return 0;
-}
-
-static int udp_join_multicast_group(int sockfd, struct sockaddr *addr)
-{
-#ifdef IP_ADD_MEMBERSHIP
-    if (addr->sa_family == AF_INET) {
-        struct ip_mreq mreq;
-
-        mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
-        mreq.imr_interface.s_addr= INADDR_ANY;
-        if (setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
-            av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_ADD_MEMBERSHIP): %s\n", strerror(errno));
-            return -1;
-        }
-    }
-#endif
-#if HAVE_STRUCT_IPV6_MREQ
-    if (addr->sa_family == AF_INET6) {
-        struct ipv6_mreq mreq6;
-
-        memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
-        mreq6.ipv6mr_interface= 0;
-        if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
-            av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_ADD_MEMBERSHIP): %s\n", strerror(errno));
-            return -1;
-        }
-    }
-#endif
-    return 0;
-}
-
-static int udp_leave_multicast_group(int sockfd, struct sockaddr *addr)
-{
-#ifdef IP_DROP_MEMBERSHIP
-    if (addr->sa_family == AF_INET) {
-        struct ip_mreq mreq;
-
-        mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
-        mreq.imr_interface.s_addr= INADDR_ANY;
-        if (setsockopt(sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
-            av_log(NULL, AV_LOG_ERROR, "setsockopt(IP_DROP_MEMBERSHIP): %s\n", strerror(errno));
-            return -1;
-        }
-    }
-#endif
-#if HAVE_STRUCT_IPV6_MREQ
-    if (addr->sa_family == AF_INET6) {
-        struct ipv6_mreq mreq6;
-
-        memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
-        mreq6.ipv6mr_interface= 0;
-        if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
-            av_log(NULL, AV_LOG_ERROR, "setsockopt(IPV6_DROP_MEMBERSHIP): %s\n", strerror(errno));
-            return -1;
-        }
-    }
-#endif
-    return 0;
-}
-
-static struct addrinfo* udp_resolve_host(const char *hostname, int port,
-                                         int type, int family, int flags)
-{
-    struct addrinfo hints, *res = 0;
-    int error;
-    char sport[16];
-    const char *node = 0, *service = "0";
-
-    if (port > 0) {
-        snprintf(sport, sizeof(sport), "%d", port);
-        service = sport;
-    }
-    if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
-        node = hostname;
-    }
-    memset(&hints, 0, sizeof(hints));
-    hints.ai_socktype = type;
-    hints.ai_family   = family;
-    hints.ai_flags = flags;
-    if ((error = getaddrinfo(node, service, &hints, &res))) {
-        res = NULL;
-        av_log(NULL, AV_LOG_ERROR, "udp_resolve_host: %s\n", gai_strerror(error));
-    }
-
-    return res;
-}
-
-static int udp_set_url(struct sockaddr_storage *addr,
-                       const char *hostname, int port)
-{
-    struct addrinfo *res0;
-    int addr_len;
-
-    res0 = udp_resolve_host(hostname, port, SOCK_DGRAM, AF_UNSPEC, 0);
-    if (res0 == 0) return AVERROR(EIO);
-    memcpy(addr, res0->ai_addr, res0->ai_addrlen);
-    addr_len = res0->ai_addrlen;
-    freeaddrinfo(res0);
-
-    return addr_len;
-}
-
-static int is_multicast_address(struct sockaddr_storage *addr)
-{
-    if (addr->ss_family == AF_INET) {
-        return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
-    }
-#if HAVE_STRUCT_SOCKADDR_IN6
-    if (addr->ss_family == AF_INET6) {
-        return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr);
-    }
-#endif
-
-    return 0;
-}
-
-static int udp_socket_create(UDPContext *s,
-                             struct sockaddr_storage *addr, int *addr_len)
-{
-    int udp_fd = -1;
-    struct addrinfo *res0 = NULL, *res = NULL;
-    int family = AF_UNSPEC;
-
-    if (((struct sockaddr *) &s->dest_addr)->sa_family)
-        family = ((struct sockaddr *) &s->dest_addr)->sa_family;
-    res0 = udp_resolve_host(0, s->local_port, SOCK_DGRAM, family, AI_PASSIVE);
-    if (res0 == 0)
-        goto fail;
-    for (res = res0; res; res=res->ai_next) {
-        udp_fd = socket(res->ai_family, SOCK_DGRAM, 0);
-        if (udp_fd > 0) break;
-        av_log(NULL, AV_LOG_ERROR, "socket: %s\n", strerror(errno));
-    }
-
-    if (udp_fd < 0)
-        goto fail;
-
-    memcpy(addr, res->ai_addr, res->ai_addrlen);
-    *addr_len = res->ai_addrlen;
-
-    freeaddrinfo(res0);
-
-    return udp_fd;
-
- fail:
-    if (udp_fd >= 0)
-        closesocket(udp_fd);
-    if(res0)
-        freeaddrinfo(res0);
-    return -1;
-}
-
-static int udp_port(struct sockaddr_storage *addr, int addr_len)
-{
-    char sbuf[sizeof(int)*3+1];
-
-    if (getnameinfo((struct sockaddr *)addr, addr_len, NULL, 0,  sbuf, sizeof(sbuf), NI_NUMERICSERV) != 0) {
-        av_log(NULL, AV_LOG_ERROR, "getnameinfo: %s\n", strerror(errno));
-        return -1;
-    }
-
-    return strtol(sbuf, NULL, 10);
-}
-
-
-/**
- * If no filename is given to av_open_input_file because you want to
- * get the local port first, then you must call this function to set
- * the remote server address.
- *
- * url syntax: udp://host:port[?option=val...]
- * option: 'ttl=n'       : set the ttl value (for multicast only)
- *         'localport=n' : set the local port
- *         'pkt_size=n'  : set max packet size
- *         'reuse=1'     : enable reusing the socket
- *
- * @param s1 media file context
- * @param uri of the remote server
- * @return zero if no error.
- */
-int udp_set_remote_url(URLContext *h, const char *uri)
-{
-    UDPContext *s = h->priv_data;
-    char hostname[256];
-    int port;
-
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
-
-    /* set the destination address */
-    s->dest_addr_len = udp_set_url(&s->dest_addr, hostname, port);
-    if (s->dest_addr_len < 0) {
-        return AVERROR(EIO);
-    }
-    s->is_multicast = is_multicast_address(&s->dest_addr);
-
-    return 0;
-}
-
-/**
- * Return the local port used by the UDP connexion
- * @param s1 media file context
- * @return the local port number
- */
-int udp_get_local_port(URLContext *h)
-{
-    UDPContext *s = h->priv_data;
-    return s->local_port;
-}
-
-/**
- * Return the udp file handle for select() usage to wait for several RTP
- * streams at the same time.
- * @param h media file context
- */
-#if (LIBAVFORMAT_VERSION_MAJOR >= 53)
-static
-#endif
-int udp_get_file_handle(URLContext *h)
-{
-    UDPContext *s = h->priv_data;
-    return s->udp_fd;
-}
-
-/* put it in UDP context */
-/* return non zero if error */
-static int udp_open(URLContext *h, const char *uri, int flags)
-{
-    char hostname[1024];
-    int port, udp_fd = -1, tmp, bind_ret = -1;
-    UDPContext *s = NULL;
-    int is_output;
-    const char *p;
-    char buf[256];
-    struct sockaddr_storage my_addr;
-    int len;
-
-    h->is_streamed = 1;
-    h->max_packet_size = 1472;
-
-    is_output = (flags & URL_WRONLY);
-
-    s = av_mallocz(sizeof(UDPContext));
-    if (!s)
-        return AVERROR(ENOMEM);
-
-    h->priv_data = s;
-    s->ttl = 16;
-    s->buffer_size = is_output ? UDP_TX_BUF_SIZE : UDP_MAX_PKT_SIZE;
-
-    p = strchr(uri, '?');
-    if (p) {
-        s->reuse_socket = find_info_tag(buf, sizeof(buf), "reuse", p);
-        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
-            s->ttl = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "localport", p)) {
-            s->local_port = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
-            h->max_packet_size = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "buffer_size", p)) {
-            s->buffer_size = strtol(buf, NULL, 10);
-        }
-    }
-
-    /* fill the dest addr */
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
-
-    /* XXX: fix ff_url_split */
-    if (hostname[0] == '\0' || hostname[0] == '?') {
-        /* only accepts null hostname if input */
-        if (flags & URL_WRONLY)
-            goto fail;
-    } else {
-        udp_set_remote_url(h, uri);
-    }
-
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
-        s->local_port = port;
-    udp_fd = udp_socket_create(s, &my_addr, &len);
-    if (udp_fd < 0)
-        goto fail;
-
-    if (s->reuse_socket)
-        if (setsockopt (udp_fd, SOL_SOCKET, SO_REUSEADDR, &(s->reuse_socket), sizeof(s->reuse_socket)) != 0)
-            goto fail;
-
-    /* the bind is needed to give a port to the socket now */
-    /* if multicast, try the multicast address bind first */
-    if (s->is_multicast && !(h->flags & URL_WRONLY)) {
-        bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
-    }
-    /* bind to the local address if not multicast or if the multicast
-     * bind failed */
-    if (bind_ret < 0 && bind(udp_fd,(struct sockaddr *)&my_addr, len) < 0)
-        goto fail;
-
-    len = sizeof(my_addr);
-    getsockname(udp_fd, (struct sockaddr *)&my_addr, &len);
-    s->local_port = udp_port(&my_addr, len);
-
-    if (s->is_multicast) {
-        if (h->flags & URL_WRONLY) {
-            /* output */
-            if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
-                goto fail;
-        } else {
-            /* input */
-            if (udp_join_multicast_group(udp_fd, (struct sockaddr *)&s->dest_addr) < 0)
-                goto fail;
-        }
-    }
-
-    if (is_output) {
-        /* limit the tx buf size to limit latency */
-        tmp = s->buffer_size;
-        if (setsockopt(udp_fd, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp)) < 0) {
-            av_log(NULL, AV_LOG_ERROR, "setsockopt(SO_SNDBUF): %s\n", strerror(errno));
-            goto fail;
-        }
-    } else {
-        /* set udp recv buffer size to the largest possible udp packet size to
-         * avoid losing data on OSes that set this too low by default. */
-        tmp = s->buffer_size;
-        if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
-            av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno));
-        }
-        /* make the socket non-blocking */
-        ff_socket_nonblock(udp_fd, 1);
-    }
-
-    s->udp_fd = udp_fd;
-    return 0;
- fail:
-    if (udp_fd >= 0)
-        closesocket(udp_fd);
-    av_free(s);
-    return AVERROR(EIO);
-}
-
-static int udp_read(URLContext *h, uint8_t *buf, int size)
-{
-    UDPContext *s = h->priv_data;
-    int len;
-    fd_set rfds;
-    int ret;
-    struct timeval tv;
-
-    for(;;) {
-        if (url_interrupt_cb())
-            return AVERROR(EINTR);
-        FD_ZERO(&rfds);
-        FD_SET(s->udp_fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(s->udp_fd + 1, &rfds, NULL, NULL, &tv);
-        if (ret < 0) {
-            if (ff_neterrno() == FF_NETERROR(EINTR))
-                continue;
-            return AVERROR(EIO);
-        }
-        if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds)))
-            continue;
-        len = recv(s->udp_fd, buf, size, 0);
-        if (len < 0) {
-            if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
-                ff_neterrno() != FF_NETERROR(EINTR))
-                return AVERROR(EIO);
-        } else {
-            break;
-        }
-    }
-    return len;
-}
-
-static int udp_write(URLContext *h, uint8_t *buf, int size)
-{
-    UDPContext *s = h->priv_data;
-    int ret;
-
-    for(;;) {
-        ret = sendto (s->udp_fd, buf, size, 0,
-                      (struct sockaddr *) &s->dest_addr,
-                      s->dest_addr_len);
-        if (ret < 0) {
-            if (ff_neterrno() != FF_NETERROR(EINTR) &&
-                ff_neterrno() != FF_NETERROR(EAGAIN))
-                return AVERROR(EIO);
-        } else {
-            break;
-        }
-    }
-    return size;
-}
-
-static int udp_close(URLContext *h)
-{
-    UDPContext *s = h->priv_data;
-
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
-        udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
-    closesocket(s->udp_fd);
-    av_free(s);
-    return 0;
-}
-
-URLProtocol udp_protocol = {
-    "udp",
-    udp_open,
-    udp_read,
-    udp_write,
-    NULL, /* seek */
-    udp_close,
-    .url_get_file_handle = udp_get_file_handle,
-};
diff --git a/libavformat/utils.c b/libavformat/utils.c
deleted file mode 100644
index 6224a35..0000000
--- a/libavformat/utils.c
+++ /dev/null
@@ -1,3591 +0,0 @@
-/*
- * various utility functions for use within FFmpeg
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "internal.h"
-#include "libavcodec/opt.h"
-#include "metadata.h"
-#include "libavutil/avstring.h"
-#include "riff.h"
-#include "audiointerleave.h"
-#include <sys/time.h>
-#include <time.h>
-#include <strings.h>
-#include <stdarg.h>
-#if CONFIG_NETWORK
-#include "network.h"
-#endif
-
-#undef NDEBUG
-#include <assert.h>
-
-/**
- * @file
- * various utility functions for use within FFmpeg
- */
-
-unsigned avformat_version(void)
-{
-    return LIBAVFORMAT_VERSION_INT;
-}
-
-const char *avformat_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char *avformat_license(void)
-{
-#define LICENSE_PREFIX "libavformat license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
-
-/* fraction handling */
-
-/**
- * f = val + (num / den) + 0.5.
- *
- * 'num' is normalized so that it is such as 0 <= num < den.
- *
- * @param f fractional number
- * @param val integer value
- * @param num must be >= 0
- * @param den must be >= 1
- */
-static void av_frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den)
-{
-    num += (den >> 1);
-    if (num >= den) {
-        val += num / den;
-        num = num % den;
-    }
-    f->val = val;
-    f->num = num;
-    f->den = den;
-}
-
-/**
- * Fractional addition to f: f = f + (incr / f->den).
- *
- * @param f fractional number
- * @param incr increment, can be positive or negative
- */
-static void av_frac_add(AVFrac *f, int64_t incr)
-{
-    int64_t num, den;
-
-    num = f->num + incr;
-    den = f->den;
-    if (num < 0) {
-        f->val += num / den;
-        num = num % den;
-        if (num < 0) {
-            num += den;
-            f->val--;
-        }
-    } else if (num >= den) {
-        f->val += num / den;
-        num = num % den;
-    }
-    f->num = num;
-}
-
-/** head of registered input format linked list */
-AVInputFormat *first_iformat = NULL;
-/** head of registered output format linked list */
-AVOutputFormat *first_oformat = NULL;
-
-AVInputFormat  *av_iformat_next(AVInputFormat  *f)
-{
-    if(f) return f->next;
-    else  return first_iformat;
-}
-
-AVOutputFormat *av_oformat_next(AVOutputFormat *f)
-{
-    if(f) return f->next;
-    else  return first_oformat;
-}
-
-void av_register_input_format(AVInputFormat *format)
-{
-    AVInputFormat **p;
-    p = &first_iformat;
-    while (*p != NULL) p = &(*p)->next;
-    *p = format;
-    format->next = NULL;
-}
-
-void av_register_output_format(AVOutputFormat *format)
-{
-    AVOutputFormat **p;
-    p = &first_oformat;
-    while (*p != NULL) p = &(*p)->next;
-    *p = format;
-    format->next = NULL;
-}
-
-int av_match_ext(const char *filename, const char *extensions)
-{
-    const char *ext, *p;
-    char ext1[32], *q;
-
-    if(!filename)
-        return 0;
-
-    ext = strrchr(filename, '.');
-    if (ext) {
-        ext++;
-        p = extensions;
-        for(;;) {
-            q = ext1;
-            while (*p != '\0' && *p != ',' && q-ext1<sizeof(ext1)-1)
-                *q++ = *p++;
-            *q = '\0';
-            if (!strcasecmp(ext1, ext))
-                return 1;
-            if (*p == '\0')
-                break;
-            p++;
-        }
-    }
-    return 0;
-}
-
-static int match_format(const char *name, const char *names)
-{
-    const char *p;
-    int len, namelen;
-
-    if (!name || !names)
-        return 0;
-
-    namelen = strlen(name);
-    while ((p = strchr(names, ','))) {
-        len = FFMAX(p - names, namelen);
-        if (!strncasecmp(name, names, len))
-            return 1;
-        names = p+1;
-    }
-    return !strcasecmp(name, names);
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-AVOutputFormat *guess_format(const char *short_name, const char *filename,
-                             const char *mime_type)
-{
-    return av_guess_format(short_name, filename, mime_type);
-}
-#endif
-
-AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
-                                const char *mime_type)
-{
-    AVOutputFormat *fmt, *fmt_found;
-    int score_max, score;
-
-    /* specific test for image sequences */
-#if CONFIG_IMAGE2_MUXER
-    if (!short_name && filename &&
-        av_filename_number_test(filename) &&
-        av_guess_image2_codec(filename) != CODEC_ID_NONE) {
-        return av_guess_format("image2", NULL, NULL);
-    }
-#endif
-    /* Find the proper file type. */
-    fmt_found = NULL;
-    score_max = 0;
-    fmt = first_oformat;
-    while (fmt != NULL) {
-        score = 0;
-        if (fmt->name && short_name && !strcmp(fmt->name, short_name))
-            score += 100;
-        if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type))
-            score += 10;
-        if (filename && fmt->extensions &&
-            av_match_ext(filename, fmt->extensions)) {
-            score += 5;
-        }
-        if (score > score_max) {
-            score_max = score;
-            fmt_found = fmt;
-        }
-        fmt = fmt->next;
-    }
-    return fmt_found;
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-AVOutputFormat *guess_stream_format(const char *short_name, const char *filename,
-                             const char *mime_type)
-{
-    AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type);
-
-    if (fmt) {
-        AVOutputFormat *stream_fmt;
-        char stream_format_name[64];
-
-        snprintf(stream_format_name, sizeof(stream_format_name), "%s_stream", fmt->name);
-        stream_fmt = av_guess_format(stream_format_name, NULL, NULL);
-
-        if (stream_fmt)
-            fmt = stream_fmt;
-    }
-
-    return fmt;
-}
-#endif
-
-enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
-                            const char *filename, const char *mime_type, enum AVMediaType type){
-    if(type == AVMEDIA_TYPE_VIDEO){
-        enum CodecID codec_id= CODEC_ID_NONE;
-
-#if CONFIG_IMAGE2_MUXER
-        if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){
-            codec_id= av_guess_image2_codec(filename);
-        }
-#endif
-        if(codec_id == CODEC_ID_NONE)
-            codec_id= fmt->video_codec;
-        return codec_id;
-    }else if(type == AVMEDIA_TYPE_AUDIO)
-        return fmt->audio_codec;
-    else
-        return CODEC_ID_NONE;
-}
-
-AVInputFormat *av_find_input_format(const char *short_name)
-{
-    AVInputFormat *fmt;
-    for(fmt = first_iformat; fmt != NULL; fmt = fmt->next) {
-        if (match_format(short_name, fmt->name))
-            return fmt;
-    }
-    return NULL;
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53 && CONFIG_SHARED && HAVE_SYMVER
-FF_SYMVER(void, av_destruct_packet_nofree, (AVPacket *pkt), "LIBAVFORMAT_52")
-{
-    av_destruct_packet_nofree(pkt);
-}
-
-FF_SYMVER(void, av_destruct_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
-{
-    av_destruct_packet(pkt);
-}
-
-FF_SYMVER(int, av_new_packet, (AVPacket *pkt, int size), "LIBAVFORMAT_52")
-{
-    return av_new_packet(pkt, size);
-}
-
-FF_SYMVER(int, av_dup_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
-{
-    return av_dup_packet(pkt);
-}
-
-FF_SYMVER(void, av_free_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
-{
-    av_free_packet(pkt);
-}
-
-FF_SYMVER(void, av_init_packet, (AVPacket *pkt), "LIBAVFORMAT_52")
-{
-    av_log(NULL, AV_LOG_WARNING, "Diverting av_*_packet function calls to libavcodec. Recompile to improve performance\n");
-    av_init_packet(pkt);
-}
-#endif
-
-int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
-{
-    int ret= av_new_packet(pkt, size);
-
-    if(ret<0)
-        return ret;
-
-    pkt->pos= url_ftell(s);
-
-    ret= get_buffer(s, pkt->data, size);
-    if(ret<=0)
-        av_free_packet(pkt);
-    else
-        av_shrink_packet(pkt, ret);
-
-    return ret;
-}
-
-
-int av_filename_number_test(const char *filename)
-{
-    char buf[1024];
-    return filename && (av_get_frame_filename(buf, sizeof(buf), filename, 1)>=0);
-}
-
-AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)
-{
-    AVInputFormat *fmt1, *fmt;
-    int score;
-
-    fmt = NULL;
-    for(fmt1 = first_iformat; fmt1 != NULL; fmt1 = fmt1->next) {
-        if (!is_opened == !(fmt1->flags & AVFMT_NOFILE))
-            continue;
-        score = 0;
-        if (fmt1->read_probe) {
-            score = fmt1->read_probe(pd);
-        } else if (fmt1->extensions) {
-            if (av_match_ext(pd->filename, fmt1->extensions)) {
-                score = 50;
-            }
-        }
-        if (score > *score_max) {
-            *score_max = score;
-            fmt = fmt1;
-        }else if (score == *score_max)
-            fmt = NULL;
-    }
-    return fmt;
-}
-
-AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened){
-    int score=0;
-    return av_probe_input_format2(pd, is_opened, &score);
-}
-
-static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeData *pd, int score)
-{
-    AVInputFormat *fmt;
-    fmt = av_probe_input_format2(pd, 1, &score);
-
-    if (fmt) {
-        av_log(s, AV_LOG_DEBUG, "Probe with size=%d, packets=%d detected %s with score=%d\n",
-               pd->buf_size, MAX_PROBE_PACKETS - st->probe_packets, fmt->name, score);
-        if (!strcmp(fmt->name, "mp3")) {
-            st->codec->codec_id = CODEC_ID_MP3;
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        } else if (!strcmp(fmt->name, "ac3")) {
-            st->codec->codec_id = CODEC_ID_AC3;
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        } else if (!strcmp(fmt->name, "eac3")) {
-            st->codec->codec_id = CODEC_ID_EAC3;
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        } else if (!strcmp(fmt->name, "mpegvideo")) {
-            st->codec->codec_id = CODEC_ID_MPEG2VIDEO;
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        } else if (!strcmp(fmt->name, "m4v")) {
-            st->codec->codec_id = CODEC_ID_MPEG4;
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        } else if (!strcmp(fmt->name, "h264")) {
-            st->codec->codec_id = CODEC_ID_H264;
-            st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-        } else if (!strcmp(fmt->name, "dts")) {
-            st->codec->codec_id = CODEC_ID_DTS;
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        } else if (!strcmp(fmt->name, "aac")) {
-            st->codec->codec_id = CODEC_ID_AAC;
-            st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        }
-    }
-    return !!fmt;
-}
-
-/************************************************************/
-/* input media file */
-
-/**
- * Open a media file from an IO stream. 'fmt' must be specified.
- */
-int av_open_input_stream(AVFormatContext **ic_ptr,
-                         ByteIOContext *pb, const char *filename,
-                         AVInputFormat *fmt, AVFormatParameters *ap)
-{
-    int err;
-    AVFormatContext *ic;
-    AVFormatParameters default_ap;
-
-    if(!ap){
-        ap=&default_ap;
-        memset(ap, 0, sizeof(default_ap));
-    }
-
-    if(!ap->prealloced_context)
-        ic = avformat_alloc_context();
-    else
-        ic = *ic_ptr;
-    if (!ic) {
-        err = AVERROR(ENOMEM);
-        goto fail;
-    }
-    ic->iformat = fmt;
-    ic->pb = pb;
-    ic->duration = AV_NOPTS_VALUE;
-    ic->start_time = AV_NOPTS_VALUE;
-    av_strlcpy(ic->filename, filename, sizeof(ic->filename));
-
-    /* allocate private data */
-    if (fmt->priv_data_size > 0) {
-        ic->priv_data = av_mallocz(fmt->priv_data_size);
-        if (!ic->priv_data) {
-            err = AVERROR(ENOMEM);
-            goto fail;
-        }
-    } else {
-        ic->priv_data = NULL;
-    }
-
-    if (ic->iformat->read_header) {
-        err = ic->iformat->read_header(ic, ap);
-        if (err < 0)
-            goto fail;
-    }
-
-    if (pb && !ic->data_offset)
-        ic->data_offset = url_ftell(ic->pb);
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-    ff_metadata_demux_compat(ic);
-#endif
-
-    ic->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
-
-    *ic_ptr = ic;
-    return 0;
- fail:
-    if (ic) {
-        int i;
-        av_freep(&ic->priv_data);
-        for(i=0;i<ic->nb_streams;i++) {
-            AVStream *st = ic->streams[i];
-            if (st) {
-                av_free(st->priv_data);
-                av_free(st->codec->extradata);
-            }
-            av_free(st);
-        }
-    }
-    av_free(ic);
-    *ic_ptr = NULL;
-    return err;
-}
-
-/** size of probe buffer, for guessing file type from file contents */
-#define PROBE_BUF_MIN 2048
-#define PROBE_BUF_MAX (1<<20)
-
-int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
-                          const char *filename, void *logctx,
-                          unsigned int offset, unsigned int max_probe_size)
-{
-    AVProbeData pd = { filename ? filename : "", NULL, -offset };
-    unsigned char *buf = NULL;
-    int ret = 0, probe_size;
-
-    if (!max_probe_size) {
-        max_probe_size = PROBE_BUF_MAX;
-    } else if (max_probe_size > PROBE_BUF_MAX) {
-        max_probe_size = PROBE_BUF_MAX;
-    } else if (max_probe_size < PROBE_BUF_MIN) {
-        return AVERROR(EINVAL);
-    }
-
-    if (offset >= max_probe_size) {
-        return AVERROR(EINVAL);
-    }
-
-    for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt && ret >= 0;
-        probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) {
-        int ret, score = probe_size < max_probe_size ? AVPROBE_SCORE_MAX/4 : 0;
-        int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1;
-
-        if (probe_size < offset) {
-            continue;
-        }
-
-        /* read probe data */
-        buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE);
-        if ((ret = get_buffer(*pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
-            /* fail if error was not end of file, otherwise, lower score */
-            if (ret != AVERROR_EOF) {
-                av_free(buf);
-                return ret;
-            }
-            score = 0;
-            ret = 0;            /* error was end of file, nothing read */
-        }
-        pd.buf_size += ret;
-        pd.buf = &buf[offset];
-
-        memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE);
-
-        /* guess file format */
-        *fmt = av_probe_input_format2(&pd, 1, &score);
-        if(*fmt){
-            if(score <= AVPROBE_SCORE_MAX/4){ //this can only be true in the last iteration
-                av_log(logctx, AV_LOG_WARNING, "Format detected only with low score of %d, misdetection possible!\n", score);
-            }else
-                av_log(logctx, AV_LOG_DEBUG, "Probed with size=%d and score=%d\n", probe_size, score);
-        }
-    }
-
-    if (!*fmt) {
-        av_free(buf);
-        return AVERROR_INVALIDDATA;
-    }
-
-    /* rewind. reuse probe buffer to avoid seeking */
-    if ((ret = ff_rewind_with_probe_data(*pb, buf, pd.buf_size)) < 0)
-        av_free(buf);
-
-    return ret;
-}
-
-int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
-                       AVInputFormat *fmt,
-                       int buf_size,
-                       AVFormatParameters *ap)
-{
-    int err;
-    AVProbeData probe_data, *pd = &probe_data;
-    ByteIOContext *pb = NULL;
-    void *logctx= ap && ap->prealloced_context ? *ic_ptr : NULL;
-
-    pd->filename = "";
-    if (filename)
-        pd->filename = filename;
-    pd->buf = NULL;
-    pd->buf_size = 0;
-
-    if (!fmt) {
-        /* guess format if no file can be opened */
-        fmt = av_probe_input_format(pd, 0);
-    }
-
-    /* Do not open file if the format does not need it. XXX: specific
-       hack needed to handle RTSP/TCP */
-    if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
-        /* if no file needed do not try to open one */
-        if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
-            goto fail;
-        }
-        if (buf_size > 0) {
-            url_setbufsize(pb, buf_size);
-        }
-        if (!fmt && (err = ff_probe_input_buffer(&pb, &fmt, filename, logctx, 0, logctx ? (*ic_ptr)->probesize : 0)) < 0) {
-            goto fail;
-        }
-    }
-
-    /* if still no format found, error */
-    if (!fmt) {
-        err = AVERROR_INVALIDDATA;
-        goto fail;
-    }
-
-    /* check filename in case an image number is expected */
-    if (fmt->flags & AVFMT_NEEDNUMBER) {
-        if (!av_filename_number_test(filename)) {
-            err = AVERROR_NUMEXPECTED;
-            goto fail;
-        }
-    }
-    err = av_open_input_stream(ic_ptr, pb, filename, fmt, ap);
-    if (err)
-        goto fail;
-    return 0;
- fail:
-    av_freep(&pd->buf);
-    if (pb)
-        url_fclose(pb);
-    if (ap && ap->prealloced_context)
-        av_free(*ic_ptr);
-    *ic_ptr = NULL;
-    return err;
-
-}
-
-/*******************************************************/
-
-static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt,
-                               AVPacketList **plast_pktl){
-    AVPacketList *pktl = av_mallocz(sizeof(AVPacketList));
-    if (!pktl)
-        return NULL;
-
-    if (*packet_buffer)
-        (*plast_pktl)->next = pktl;
-    else
-        *packet_buffer = pktl;
-
-    /* add the packet in the buffered packet list */
-    *plast_pktl = pktl;
-    pktl->pkt= *pkt;
-    return &pktl->pkt;
-}
-
-int av_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret, i;
-    AVStream *st;
-
-    for(;;){
-        AVPacketList *pktl = s->raw_packet_buffer;
-
-        if (pktl) {
-            *pkt = pktl->pkt;
-            if(s->streams[pkt->stream_index]->codec->codec_id != CODEC_ID_PROBE ||
-               !s->streams[pkt->stream_index]->probe_packets ||
-               s->raw_packet_buffer_remaining_size < pkt->size){
-                AVProbeData *pd = &s->streams[pkt->stream_index]->probe_data;
-                av_freep(&pd->buf);
-                pd->buf_size = 0;
-                s->raw_packet_buffer = pktl->next;
-                s->raw_packet_buffer_remaining_size += pkt->size;
-                av_free(pktl);
-                return 0;
-            }
-        }
-
-        av_init_packet(pkt);
-        ret= s->iformat->read_packet(s, pkt);
-        if (ret < 0) {
-            if (!pktl || ret == AVERROR(EAGAIN))
-                return ret;
-            for (i = 0; i < s->nb_streams; i++)
-                s->streams[i]->probe_packets = 0;
-            continue;
-        }
-        st= s->streams[pkt->stream_index];
-
-        switch(st->codec->codec_type){
-        case AVMEDIA_TYPE_VIDEO:
-            if(s->video_codec_id)   st->codec->codec_id= s->video_codec_id;
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            if(s->audio_codec_id)   st->codec->codec_id= s->audio_codec_id;
-            break;
-        case AVMEDIA_TYPE_SUBTITLE:
-            if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id;
-            break;
-        }
-
-        if(!pktl && (st->codec->codec_id != CODEC_ID_PROBE ||
-                     !st->probe_packets))
-            return ret;
-
-        add_to_pktbuf(&s->raw_packet_buffer, pkt, &s->raw_packet_buffer_end);
-        s->raw_packet_buffer_remaining_size -= pkt->size;
-
-        if(st->codec->codec_id == CODEC_ID_PROBE){
-            AVProbeData *pd = &st->probe_data;
-            av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
-            --st->probe_packets;
-
-            pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
-            memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
-            pd->buf_size += pkt->size;
-            memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
-
-            if(av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){
-                //FIXME we dont reduce score to 0 for the case of running out of buffer space in bytes
-                set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
-                if(st->codec->codec_id != CODEC_ID_PROBE){
-                    pd->buf_size=0;
-                    av_freep(&pd->buf);
-                    av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index);
-                }
-            }
-        }
-    }
-}
-
-/**********************************************************/
-
-/**
- * Get the number of samples of an audio frame. Return -1 on error.
- */
-static int get_audio_frame_size(AVCodecContext *enc, int size)
-{
-    int frame_size;
-
-    if(enc->codec_id == CODEC_ID_VORBIS)
-        return -1;
-
-    if (enc->frame_size <= 1) {
-        int bits_per_sample = av_get_bits_per_sample(enc->codec_id);
-
-        if (bits_per_sample) {
-            if (enc->channels == 0)
-                return -1;
-            frame_size = (size << 3) / (bits_per_sample * enc->channels);
-        } else {
-            /* used for example by ADPCM codecs */
-            if (enc->bit_rate == 0)
-                return -1;
-            frame_size = ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate;
-        }
-    } else {
-        frame_size = enc->frame_size;
-    }
-    return frame_size;
-}
-
-
-/**
- * Return the frame duration in seconds. Return 0 if not available.
- */
-static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
-                                   AVCodecParserContext *pc, AVPacket *pkt)
-{
-    int frame_size;
-
-    *pnum = 0;
-    *pden = 0;
-    switch(st->codec->codec_type) {
-    case AVMEDIA_TYPE_VIDEO:
-        if(st->time_base.num*1000LL > st->time_base.den){
-            *pnum = st->time_base.num;
-            *pden = st->time_base.den;
-        }else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){
-            *pnum = st->codec->time_base.num;
-            *pden = st->codec->time_base.den;
-            if (pc && pc->repeat_pict) {
-                *pnum = (*pnum) * (1 + pc->repeat_pict);
-            }
-            //If this codec can be interlaced or progressive then we need a parser to compute duration of a packet
-            //Thus if we have no parser in such case leave duration undefined.
-            if(st->codec->ticks_per_frame>1 && !pc){
-                *pnum = *pden = 0;
-            }
-        }
-        break;
-    case AVMEDIA_TYPE_AUDIO:
-        frame_size = get_audio_frame_size(st->codec, pkt->size);
-        if (frame_size < 0)
-            break;
-        *pnum = frame_size;
-        *pden = st->codec->sample_rate;
-        break;
-    default:
-        break;
-    }
-}
-
-static int is_intra_only(AVCodecContext *enc){
-    if(enc->codec_type == AVMEDIA_TYPE_AUDIO){
-        return 1;
-    }else if(enc->codec_type == AVMEDIA_TYPE_VIDEO){
-        switch(enc->codec_id){
-        case CODEC_ID_MJPEG:
-        case CODEC_ID_MJPEGB:
-        case CODEC_ID_LJPEG:
-        case CODEC_ID_RAWVIDEO:
-        case CODEC_ID_DVVIDEO:
-        case CODEC_ID_HUFFYUV:
-        case CODEC_ID_FFVHUFF:
-        case CODEC_ID_ASV1:
-        case CODEC_ID_ASV2:
-        case CODEC_ID_VCR1:
-        case CODEC_ID_DNXHD:
-        case CODEC_ID_JPEG2000:
-            return 1;
-        default: break;
-        }
-    }
-    return 0;
-}
-
-static void update_initial_timestamps(AVFormatContext *s, int stream_index,
-                                      int64_t dts, int64_t pts)
-{
-    AVStream *st= s->streams[stream_index];
-    AVPacketList *pktl= s->packet_buffer;
-
-    if(st->first_dts != AV_NOPTS_VALUE || dts == AV_NOPTS_VALUE || st->cur_dts == AV_NOPTS_VALUE)
-        return;
-
-    st->first_dts= dts - st->cur_dts;
-    st->cur_dts= dts;
-
-    for(; pktl; pktl= pktl->next){
-        if(pktl->pkt.stream_index != stream_index)
-            continue;
-        //FIXME think more about this check
-        if(pktl->pkt.pts != AV_NOPTS_VALUE && pktl->pkt.pts == pktl->pkt.dts)
-            pktl->pkt.pts += st->first_dts;
-
-        if(pktl->pkt.dts != AV_NOPTS_VALUE)
-            pktl->pkt.dts += st->first_dts;
-
-        if(st->start_time == AV_NOPTS_VALUE && pktl->pkt.pts != AV_NOPTS_VALUE)
-            st->start_time= pktl->pkt.pts;
-    }
-    if (st->start_time == AV_NOPTS_VALUE)
-        st->start_time = pts;
-}
-
-static void update_initial_durations(AVFormatContext *s, AVStream *st, AVPacket *pkt)
-{
-    AVPacketList *pktl= s->packet_buffer;
-    int64_t cur_dts= 0;
-
-    if(st->first_dts != AV_NOPTS_VALUE){
-        cur_dts= st->first_dts;
-        for(; pktl; pktl= pktl->next){
-            if(pktl->pkt.stream_index == pkt->stream_index){
-                if(pktl->pkt.pts != pktl->pkt.dts || pktl->pkt.dts != AV_NOPTS_VALUE || pktl->pkt.duration)
-                    break;
-                cur_dts -= pkt->duration;
-            }
-        }
-        pktl= s->packet_buffer;
-        st->first_dts = cur_dts;
-    }else if(st->cur_dts)
-        return;
-
-    for(; pktl; pktl= pktl->next){
-        if(pktl->pkt.stream_index != pkt->stream_index)
-            continue;
-        if(pktl->pkt.pts == pktl->pkt.dts && pktl->pkt.dts == AV_NOPTS_VALUE
-           && !pktl->pkt.duration){
-            pktl->pkt.dts= cur_dts;
-            if(!st->codec->has_b_frames)
-                pktl->pkt.pts= cur_dts;
-            cur_dts += pkt->duration;
-            pktl->pkt.duration= pkt->duration;
-        }else
-            break;
-    }
-    if(st->first_dts == AV_NOPTS_VALUE)
-        st->cur_dts= cur_dts;
-}
-
-static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
-                               AVCodecParserContext *pc, AVPacket *pkt)
-{
-    int num, den, presentation_delayed, delay, i;
-    int64_t offset;
-
-    if (s->flags & AVFMT_FLAG_NOFILLIN)
-        return;
-
-    if((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE)
-        pkt->dts= AV_NOPTS_VALUE;
-
-    if (st->codec->codec_id != CODEC_ID_H264 && pc && pc->pict_type == FF_B_TYPE)
-        //FIXME Set low_delay = 0 when has_b_frames = 1
-        st->codec->has_b_frames = 1;
-
-    /* do we have a video B-frame ? */
-    delay= st->codec->has_b_frames;
-    presentation_delayed = 0;
-    /* XXX: need has_b_frame, but cannot get it if the codec is
-        not initialized */
-    if (delay &&
-        pc && pc->pict_type != FF_B_TYPE)
-        presentation_delayed = 1;
-
-    if(pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && pkt->dts > pkt->pts && st->pts_wrap_bits<63
-       /*&& pkt->dts-(1LL<<st->pts_wrap_bits) < pkt->pts*/){
-        pkt->dts -= 1LL<<st->pts_wrap_bits;
-    }
-
-    // some mpeg2 in mpeg-ps lack dts (issue171 / input_file.mpg)
-    // we take the conservative approach and discard both
-    // Note, if this is misbehaving for a H.264 file then possibly presentation_delayed is not set correctly.
-    if(delay==1 && pkt->dts == pkt->pts && pkt->dts != AV_NOPTS_VALUE && presentation_delayed){
-        av_log(s, AV_LOG_WARNING, "invalid dts/pts combination\n");
-        pkt->dts= pkt->pts= AV_NOPTS_VALUE;
-    }
-
-    if (pkt->duration == 0) {
-        compute_frame_duration(&num, &den, st, pc, pkt);
-        if (den && num) {
-            pkt->duration = av_rescale_rnd(1, num * (int64_t)st->time_base.den, den * (int64_t)st->time_base.num, AV_ROUND_DOWN);
-
-            if(pkt->duration != 0 && s->packet_buffer)
-                update_initial_durations(s, st, pkt);
-        }
-    }
-
-    /* correct timestamps with byte offset if demuxers only have timestamps
-       on packet boundaries */
-    if(pc && st->need_parsing == AVSTREAM_PARSE_TIMESTAMPS && pkt->size){
-        /* this will estimate bitrate based on this frame's duration and size */
-        offset = av_rescale(pc->offset, pkt->duration, pkt->size);
-        if(pkt->pts != AV_NOPTS_VALUE)
-            pkt->pts += offset;
-        if(pkt->dts != AV_NOPTS_VALUE)
-            pkt->dts += offset;
-    }
-
-    if (pc && pc->dts_sync_point >= 0) {
-        // we have synchronization info from the parser
-        int64_t den = st->codec->time_base.den * (int64_t) st->time_base.num;
-        if (den > 0) {
-            int64_t num = st->codec->time_base.num * (int64_t) st->time_base.den;
-            if (pkt->dts != AV_NOPTS_VALUE) {
-                // got DTS from the stream, update reference timestamp
-                st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den;
-                pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
-            } else if (st->reference_dts != AV_NOPTS_VALUE) {
-                // compute DTS based on reference timestamp
-                pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den;
-                pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
-            }
-            if (pc->dts_sync_point > 0)
-                st->reference_dts = pkt->dts; // new reference
-        }
-    }
-
-    /* This may be redundant, but it should not hurt. */
-    if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > pkt->dts)
-        presentation_delayed = 1;
-
-//    av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc);
-    /* interpolate PTS and DTS if they are not present */
-    //We skip H264 currently because delay and has_b_frames are not reliably set
-    if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != CODEC_ID_H264){
-        if (presentation_delayed) {
-            /* DTS = decompression timestamp */
-            /* PTS = presentation timestamp */
-            if (pkt->dts == AV_NOPTS_VALUE)
-                pkt->dts = st->last_IP_pts;
-            update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts);
-            if (pkt->dts == AV_NOPTS_VALUE)
-                pkt->dts = st->cur_dts;
-
-            /* this is tricky: the dts must be incremented by the duration
-            of the frame we are displaying, i.e. the last I- or P-frame */
-            if (st->last_IP_duration == 0)
-                st->last_IP_duration = pkt->duration;
-            if(pkt->dts != AV_NOPTS_VALUE)
-                st->cur_dts = pkt->dts + st->last_IP_duration;
-            st->last_IP_duration  = pkt->duration;
-            st->last_IP_pts= pkt->pts;
-            /* cannot compute PTS if not present (we can compute it only
-            by knowing the future */
-        } else if(pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE || pkt->duration){
-            if(pkt->pts != AV_NOPTS_VALUE && pkt->duration){
-                int64_t old_diff= FFABS(st->cur_dts - pkt->duration - pkt->pts);
-                int64_t new_diff= FFABS(st->cur_dts - pkt->pts);
-                if(old_diff < new_diff && old_diff < (pkt->duration>>3)){
-                    pkt->pts += pkt->duration;
-    //                av_log(NULL, AV_LOG_DEBUG, "id:%d old:%"PRId64" new:%"PRId64" dur:%d cur:%"PRId64" size:%d\n", pkt->stream_index, old_diff, new_diff, pkt->duration, st->cur_dts, pkt->size);
-                }
-            }
-
-            /* presentation is not delayed : PTS and DTS are the same */
-            if(pkt->pts == AV_NOPTS_VALUE)
-                pkt->pts = pkt->dts;
-            update_initial_timestamps(s, pkt->stream_index, pkt->pts, pkt->pts);
-            if(pkt->pts == AV_NOPTS_VALUE)
-                pkt->pts = st->cur_dts;
-            pkt->dts = pkt->pts;
-            if(pkt->pts != AV_NOPTS_VALUE)
-                st->cur_dts = pkt->pts + pkt->duration;
-        }
-    }
-
-    if(pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){
-        st->pts_buffer[0]= pkt->pts;
-        for(i=0; i<delay && st->pts_buffer[i] > st->pts_buffer[i+1]; i++)
-            FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
-        if(pkt->dts == AV_NOPTS_VALUE)
-            pkt->dts= st->pts_buffer[0];
-        if(st->codec->codec_id == CODEC_ID_H264){ //we skiped it above so we try here
-            update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); // this should happen on the first packet
-        }
-        if(pkt->dts > st->cur_dts)
-            st->cur_dts = pkt->dts;
-    }
-
-//    av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts);
-
-    /* update flags */
-    if(is_intra_only(st->codec))
-        pkt->flags |= AV_PKT_FLAG_KEY;
-    else if (pc) {
-        pkt->flags = 0;
-        /* keyframe computation */
-        if (pc->key_frame == 1)
-            pkt->flags |= AV_PKT_FLAG_KEY;
-        else if (pc->key_frame == -1 && pc->pict_type == FF_I_TYPE)
-            pkt->flags |= AV_PKT_FLAG_KEY;
-    }
-    if (pc)
-        pkt->convergence_duration = pc->convergence_duration;
-}
-
-
-static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt)
-{
-    AVStream *st;
-    int len, ret, i;
-
-    av_init_packet(pkt);
-
-    for(;;) {
-        /* select current input stream component */
-        st = s->cur_st;
-        if (st) {
-            if (!st->need_parsing || !st->parser) {
-                /* no parsing needed: we just output the packet as is */
-                /* raw data support */
-                *pkt = st->cur_pkt; st->cur_pkt.data= NULL;
-                compute_pkt_fields(s, st, NULL, pkt);
-                s->cur_st = NULL;
-                if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
-                    (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) {
-                    ff_reduce_index(s, st->index);
-                    av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME);
-                }
-                break;
-            } else if (st->cur_len > 0 && st->discard < AVDISCARD_ALL) {
-                len = av_parser_parse2(st->parser, st->codec, &pkt->data, &pkt->size,
-                                       st->cur_ptr, st->cur_len,
-                                       st->cur_pkt.pts, st->cur_pkt.dts,
-                                       st->cur_pkt.pos);
-                st->cur_pkt.pts = AV_NOPTS_VALUE;
-                st->cur_pkt.dts = AV_NOPTS_VALUE;
-                /* increment read pointer */
-                st->cur_ptr += len;
-                st->cur_len -= len;
-
-                /* return packet if any */
-                if (pkt->size) {
-                got_packet:
-                    pkt->duration = 0;
-                    pkt->stream_index = st->index;
-                    pkt->pts = st->parser->pts;
-                    pkt->dts = st->parser->dts;
-                    pkt->pos = st->parser->pos;
-                    pkt->destruct = NULL;
-                    compute_pkt_fields(s, st, st->parser, pkt);
-
-                    if((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY){
-                        ff_reduce_index(s, st->index);
-                        av_add_index_entry(st, st->parser->frame_offset, pkt->dts,
-                                           0, 0, AVINDEX_KEYFRAME);
-                    }
-
-                    break;
-                }
-            } else {
-                /* free packet */
-                av_free_packet(&st->cur_pkt);
-                s->cur_st = NULL;
-            }
-        } else {
-            AVPacket cur_pkt;
-            /* read next packet */
-            ret = av_read_packet(s, &cur_pkt);
-            if (ret < 0) {
-                if (ret == AVERROR(EAGAIN))
-                    return ret;
-                /* return the last frames, if any */
-                for(i = 0; i < s->nb_streams; i++) {
-                    st = s->streams[i];
-                    if (st->parser && st->need_parsing) {
-                        av_parser_parse2(st->parser, st->codec,
-                                        &pkt->data, &pkt->size,
-                                        NULL, 0,
-                                        AV_NOPTS_VALUE, AV_NOPTS_VALUE,
-                                        AV_NOPTS_VALUE);
-                        if (pkt->size)
-                            goto got_packet;
-                    }
-                }
-                /* no more packets: really terminate parsing */
-                return ret;
-            }
-            st = s->streams[cur_pkt.stream_index];
-            st->cur_pkt= cur_pkt;
-
-            if(st->cur_pkt.pts != AV_NOPTS_VALUE &&
-               st->cur_pkt.dts != AV_NOPTS_VALUE &&
-               st->cur_pkt.pts < st->cur_pkt.dts){
-                av_log(s, AV_LOG_WARNING, "Invalid timestamps stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d\n",
-                    st->cur_pkt.stream_index,
-                    st->cur_pkt.pts,
-                    st->cur_pkt.dts,
-                    st->cur_pkt.size);
-//                av_free_packet(&st->cur_pkt);
-//                return -1;
-            }
-
-            if(s->debug & FF_FDEBUG_TS)
-                av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
-                    st->cur_pkt.stream_index,
-                    st->cur_pkt.pts,
-                    st->cur_pkt.dts,
-                    st->cur_pkt.size,
-                    st->cur_pkt.duration,
-                    st->cur_pkt.flags);
-
-            s->cur_st = st;
-            st->cur_ptr = st->cur_pkt.data;
-            st->cur_len = st->cur_pkt.size;
-            if (st->need_parsing && !st->parser && !(s->flags & AVFMT_FLAG_NOPARSE)) {
-                st->parser = av_parser_init(st->codec->codec_id);
-                if (!st->parser) {
-                    /* no parser available: just output the raw packets */
-                    st->need_parsing = AVSTREAM_PARSE_NONE;
-                }else if(st->need_parsing == AVSTREAM_PARSE_HEADERS){
-                    st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
-                }
-                if(st->parser && (s->iformat->flags & AVFMT_GENERIC_INDEX)){
-                    st->parser->next_frame_offset=
-                    st->parser->cur_offset= st->cur_pkt.pos;
-                }
-            }
-        }
-    }
-    if(s->debug & FF_FDEBUG_TS)
-        av_log(s, AV_LOG_DEBUG, "av_read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
-            pkt->stream_index,
-            pkt->pts,
-            pkt->dts,
-            pkt->size,
-            pkt->duration,
-            pkt->flags);
-
-    return 0;
-}
-
-int av_read_frame(AVFormatContext *s, AVPacket *pkt)
-{
-    AVPacketList *pktl;
-    int eof=0;
-    const int genpts= s->flags & AVFMT_FLAG_GENPTS;
-
-    for(;;){
-        pktl = s->packet_buffer;
-        if (pktl) {
-            AVPacket *next_pkt= &pktl->pkt;
-
-            if(genpts && next_pkt->dts != AV_NOPTS_VALUE){
-                while(pktl && next_pkt->pts == AV_NOPTS_VALUE){
-                    if(   pktl->pkt.stream_index == next_pkt->stream_index
-                       && next_pkt->dts < pktl->pkt.dts
-                       && pktl->pkt.pts != pktl->pkt.dts //not b frame
-                       /*&& pktl->pkt.dts != AV_NOPTS_VALUE*/){
-                        next_pkt->pts= pktl->pkt.dts;
-                    }
-                    pktl= pktl->next;
-                }
-                pktl = s->packet_buffer;
-            }
-
-            if(   next_pkt->pts != AV_NOPTS_VALUE
-               || next_pkt->dts == AV_NOPTS_VALUE
-               || !genpts || eof){
-                /* read packet from packet buffer, if there is data */
-                *pkt = *next_pkt;
-                s->packet_buffer = pktl->next;
-                av_free(pktl);
-                return 0;
-            }
-        }
-        if(genpts){
-            int ret= av_read_frame_internal(s, pkt);
-            if(ret<0){
-                if(pktl && ret != AVERROR(EAGAIN)){
-                    eof=1;
-                    continue;
-                }else
-                    return ret;
-            }
-
-            if(av_dup_packet(add_to_pktbuf(&s->packet_buffer, pkt,
-                                           &s->packet_buffer_end)) < 0)
-                return AVERROR(ENOMEM);
-        }else{
-            assert(!s->packet_buffer);
-            return av_read_frame_internal(s, pkt);
-        }
-    }
-}
-
-/* XXX: suppress the packet queue */
-static void flush_packet_queue(AVFormatContext *s)
-{
-    AVPacketList *pktl;
-
-    for(;;) {
-        pktl = s->packet_buffer;
-        if (!pktl)
-            break;
-        s->packet_buffer = pktl->next;
-        av_free_packet(&pktl->pkt);
-        av_free(pktl);
-    }
-    while(s->raw_packet_buffer){
-        pktl = s->raw_packet_buffer;
-        s->raw_packet_buffer = pktl->next;
-        av_free_packet(&pktl->pkt);
-        av_free(pktl);
-    }
-    s->packet_buffer_end=
-    s->raw_packet_buffer_end= NULL;
-    s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
-}
-
-/*******************************************************/
-/* seek support */
-
-int av_find_default_stream_index(AVFormatContext *s)
-{
-    int first_audio_index = -1;
-    int i;
-    AVStream *st;
-
-    if (s->nb_streams <= 0)
-        return -1;
-    for(i = 0; i < s->nb_streams; i++) {
-        st = s->streams[i];
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            return i;
-        }
-        if (first_audio_index < 0 && st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
-            first_audio_index = i;
-    }
-    return first_audio_index >= 0 ? first_audio_index : 0;
-}
-
-/**
- * Flush the frame reader.
- */
-void ff_read_frame_flush(AVFormatContext *s)
-{
-    AVStream *st;
-    int i, j;
-
-    flush_packet_queue(s);
-
-    s->cur_st = NULL;
-
-    /* for each stream, reset read state */
-    for(i = 0; i < s->nb_streams; i++) {
-        st = s->streams[i];
-
-        if (st->parser) {
-            av_parser_close(st->parser);
-            st->parser = NULL;
-            av_free_packet(&st->cur_pkt);
-        }
-        st->last_IP_pts = AV_NOPTS_VALUE;
-        st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an unspecified origin */
-        st->reference_dts = AV_NOPTS_VALUE;
-        /* fail safe */
-        st->cur_ptr = NULL;
-        st->cur_len = 0;
-
-        st->probe_packets = MAX_PROBE_PACKETS;
-
-        for(j=0; j<MAX_REORDER_DELAY+1; j++)
-            st->pts_buffer[j]= AV_NOPTS_VALUE;
-    }
-}
-
-void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp){
-    int i;
-
-    for(i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-
-        st->cur_dts = av_rescale(timestamp,
-                                 st->time_base.den * (int64_t)ref_st->time_base.num,
-                                 st->time_base.num * (int64_t)ref_st->time_base.den);
-    }
-}
-
-void ff_reduce_index(AVFormatContext *s, int stream_index)
-{
-    AVStream *st= s->streams[stream_index];
-    unsigned int max_entries= s->max_index_size / sizeof(AVIndexEntry);
-
-    if((unsigned)st->nb_index_entries >= max_entries){
-        int i;
-        for(i=0; 2*i<st->nb_index_entries; i++)
-            st->index_entries[i]= st->index_entries[2*i];
-        st->nb_index_entries= i;
-    }
-}
-
-int av_add_index_entry(AVStream *st,
-                            int64_t pos, int64_t timestamp, int size, int distance, int flags)
-{
-    AVIndexEntry *entries, *ie;
-    int index;
-
-    if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))
-        return -1;
-
-    entries = av_fast_realloc(st->index_entries,
-                              &st->index_entries_allocated_size,
-                              (st->nb_index_entries + 1) *
-                              sizeof(AVIndexEntry));
-    if(!entries)
-        return -1;
-
-    st->index_entries= entries;
-
-    index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY);
-
-    if(index<0){
-        index= st->nb_index_entries++;
-        ie= &entries[index];
-        assert(index==0 || ie[-1].timestamp < timestamp);
-    }else{
-        ie= &entries[index];
-        if(ie->timestamp != timestamp){
-            if(ie->timestamp <= timestamp)
-                return -1;
-            memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));
-            st->nb_index_entries++;
-        }else if(ie->pos == pos && distance < ie->min_distance) //do not reduce the distance
-            distance= ie->min_distance;
-    }
-
-    ie->pos = pos;
-    ie->timestamp = timestamp;
-    ie->min_distance= distance;
-    ie->size= size;
-    ie->flags = flags;
-
-    return index;
-}
-
-int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
-                              int flags)
-{
-    AVIndexEntry *entries= st->index_entries;
-    int nb_entries= st->nb_index_entries;
-    int a, b, m;
-    int64_t timestamp;
-
-    a = - 1;
-    b = nb_entries;
-
-    //optimize appending index entries at the end
-    if(b && entries[b-1].timestamp < wanted_timestamp)
-        a= b-1;
-
-    while (b - a > 1) {
-        m = (a + b) >> 1;
-        timestamp = entries[m].timestamp;
-        if(timestamp >= wanted_timestamp)
-            b = m;
-        if(timestamp <= wanted_timestamp)
-            a = m;
-    }
-    m= (flags & AVSEEK_FLAG_BACKWARD) ? a : b;
-
-    if(!(flags & AVSEEK_FLAG_ANY)){
-        while(m>=0 && m<nb_entries && !(entries[m].flags & AVINDEX_KEYFRAME)){
-            m += (flags & AVSEEK_FLAG_BACKWARD) ? -1 : 1;
-        }
-    }
-
-    if(m == nb_entries)
-        return -1;
-    return  m;
-}
-
-#define DEBUG_SEEK
-
-int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
-    AVInputFormat *avif= s->iformat;
-    int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
-    int64_t ts_min, ts_max, ts;
-    int index;
-    int64_t ret;
-    AVStream *st;
-
-    if (stream_index < 0)
-        return -1;
-
-#ifdef DEBUG_SEEK
-    av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
-#endif
-
-    ts_max=
-    ts_min= AV_NOPTS_VALUE;
-    pos_limit= -1; //gcc falsely says it may be uninitialized
-
-    st= s->streams[stream_index];
-    if(st->index_entries){
-        AVIndexEntry *e;
-
-        index= av_index_search_timestamp(st, target_ts, flags | AVSEEK_FLAG_BACKWARD); //FIXME whole func must be checked for non-keyframe entries in index case, especially read_timestamp()
-        index= FFMAX(index, 0);
-        e= &st->index_entries[index];
-
-        if(e->timestamp <= target_ts || e->pos == e->min_distance){
-            pos_min= e->pos;
-            ts_min= e->timestamp;
-#ifdef DEBUG_SEEK
-            av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
-                   pos_min,ts_min);
-#endif
-        }else{
-            assert(index==0);
-        }
-
-        index= av_index_search_timestamp(st, target_ts, flags & ~AVSEEK_FLAG_BACKWARD);
-        assert(index < st->nb_index_entries);
-        if(index >= 0){
-            e= &st->index_entries[index];
-            assert(e->timestamp >= target_ts);
-            pos_max= e->pos;
-            ts_max= e->timestamp;
-            pos_limit= pos_max - e->min_distance;
-#ifdef DEBUG_SEEK
-            av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
-                   pos_max,pos_limit, ts_max);
-#endif
-        }
-    }
-
-    pos= av_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, ts_min, ts_max, flags, &ts, avif->read_timestamp);
-    if(pos<0)
-        return -1;
-
-    /* do the seek */
-    if ((ret = url_fseek(s->pb, pos, SEEK_SET)) < 0)
-        return ret;
-
-    av_update_cur_dts(s, st, ts);
-
-    return 0;
-}
-
-int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )){
-    int64_t pos, ts;
-    int64_t start_pos, filesize;
-    int no_change;
-
-#ifdef DEBUG_SEEK
-    av_log(s, AV_LOG_DEBUG, "gen_seek: %d %"PRId64"\n", stream_index, target_ts);
-#endif
-
-    if(ts_min == AV_NOPTS_VALUE){
-        pos_min = s->data_offset;
-        ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
-        if (ts_min == AV_NOPTS_VALUE)
-            return -1;
-    }
-
-    if(ts_max == AV_NOPTS_VALUE){
-        int step= 1024;
-        filesize = url_fsize(s->pb);
-        pos_max = filesize - 1;
-        do{
-            pos_max -= step;
-            ts_max = read_timestamp(s, stream_index, &pos_max, pos_max + step);
-            step += step;
-        }while(ts_max == AV_NOPTS_VALUE && pos_max >= step);
-        if (ts_max == AV_NOPTS_VALUE)
-            return -1;
-
-        for(;;){
-            int64_t tmp_pos= pos_max + 1;
-            int64_t tmp_ts= read_timestamp(s, stream_index, &tmp_pos, INT64_MAX);
-            if(tmp_ts == AV_NOPTS_VALUE)
-                break;
-            ts_max= tmp_ts;
-            pos_max= tmp_pos;
-            if(tmp_pos >= filesize)
-                break;
-        }
-        pos_limit= pos_max;
-    }
-
-    if(ts_min > ts_max){
-        return -1;
-    }else if(ts_min == ts_max){
-        pos_limit= pos_min;
-    }
-
-    no_change=0;
-    while (pos_min < pos_limit) {
-#ifdef DEBUG_SEEK
-        av_log(s, AV_LOG_DEBUG, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n",
-               pos_min, pos_max,
-               ts_min, ts_max);
-#endif
-        assert(pos_limit <= pos_max);
-
-        if(no_change==0){
-            int64_t approximate_keyframe_distance= pos_max - pos_limit;
-            // interpolate position (better than dichotomy)
-            pos = av_rescale(target_ts - ts_min, pos_max - pos_min, ts_max - ts_min)
-                + pos_min - approximate_keyframe_distance;
-        }else if(no_change==1){
-            // bisection, if interpolation failed to change min or max pos last time
-            pos = (pos_min + pos_limit)>>1;
-        }else{
-            /* linear search if bisection failed, can only happen if there
-               are very few or no keyframes between min/max */
-            pos=pos_min;
-        }
-        if(pos <= pos_min)
-            pos= pos_min + 1;
-        else if(pos > pos_limit)
-            pos= pos_limit;
-        start_pos= pos;
-
-        ts = read_timestamp(s, stream_index, &pos, INT64_MAX); //may pass pos_limit instead of -1
-        if(pos == pos_max)
-            no_change++;
-        else
-            no_change=0;
-#ifdef DEBUG_SEEK
-        av_log(s, AV_LOG_DEBUG, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n",
-               pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit,
-               start_pos, no_change);
-#endif
-        if(ts == AV_NOPTS_VALUE){
-            av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n");
-            return -1;
-        }
-        assert(ts != AV_NOPTS_VALUE);
-        if (target_ts <= ts) {
-            pos_limit = start_pos - 1;
-            pos_max = pos;
-            ts_max = ts;
-        }
-        if (target_ts >= ts) {
-            pos_min = pos;
-            ts_min = ts;
-        }
-    }
-
-    pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max;
-    ts  = (flags & AVSEEK_FLAG_BACKWARD) ?  ts_min :  ts_max;
-#ifdef DEBUG_SEEK
-    pos_min = pos;
-    ts_min = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
-    pos_min++;
-    ts_max = read_timestamp(s, stream_index, &pos_min, INT64_MAX);
-    av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n",
-           pos, ts_min, target_ts, ts_max);
-#endif
-    *ts_ret= ts;
-    return pos;
-}
-
-static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, int flags){
-    int64_t pos_min, pos_max;
-#if 0
-    AVStream *st;
-
-    if (stream_index < 0)
-        return -1;
-
-    st= s->streams[stream_index];
-#endif
-
-    pos_min = s->data_offset;
-    pos_max = url_fsize(s->pb) - 1;
-
-    if     (pos < pos_min) pos= pos_min;
-    else if(pos > pos_max) pos= pos_max;
-
-    url_fseek(s->pb, pos, SEEK_SET);
-
-#if 0
-    av_update_cur_dts(s, st, ts);
-#endif
-    return 0;
-}
-
-static int av_seek_frame_generic(AVFormatContext *s,
-                                 int stream_index, int64_t timestamp, int flags)
-{
-    int index;
-    int64_t ret;
-    AVStream *st;
-    AVIndexEntry *ie;
-
-    st = s->streams[stream_index];
-
-    index = av_index_search_timestamp(st, timestamp, flags);
-
-    if(index < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
-        return -1;
-
-    if(index < 0 || index==st->nb_index_entries-1){
-        int i;
-        AVPacket pkt;
-
-        if(st->nb_index_entries){
-            assert(st->index_entries);
-            ie= &st->index_entries[st->nb_index_entries-1];
-            if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
-                return ret;
-            av_update_cur_dts(s, st, ie->timestamp);
-        }else{
-            if ((ret = url_fseek(s->pb, s->data_offset, SEEK_SET)) < 0)
-                return ret;
-        }
-        for(i=0;; i++) {
-            int ret;
-            do{
-                ret = av_read_frame(s, &pkt);
-            }while(ret == AVERROR(EAGAIN));
-            if(ret<0)
-                break;
-            av_free_packet(&pkt);
-            if(stream_index == pkt.stream_index){
-                if((pkt.flags & AV_PKT_FLAG_KEY) && pkt.dts > timestamp)
-                    break;
-            }
-        }
-        index = av_index_search_timestamp(st, timestamp, flags);
-    }
-    if (index < 0)
-        return -1;
-
-    ff_read_frame_flush(s);
-    if (s->iformat->read_seek){
-        if(s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0)
-            return 0;
-    }
-    ie = &st->index_entries[index];
-    if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
-        return ret;
-    av_update_cur_dts(s, st, ie->timestamp);
-
-    return 0;
-}
-
-int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    int ret;
-    AVStream *st;
-
-    ff_read_frame_flush(s);
-
-    if(flags & AVSEEK_FLAG_BYTE)
-        return av_seek_frame_byte(s, stream_index, timestamp, flags);
-
-    if(stream_index < 0){
-        stream_index= av_find_default_stream_index(s);
-        if(stream_index < 0)
-            return -1;
-
-        st= s->streams[stream_index];
-       /* timestamp for default must be expressed in AV_TIME_BASE units */
-        timestamp = av_rescale(timestamp, st->time_base.den, AV_TIME_BASE * (int64_t)st->time_base.num);
-    }
-
-    /* first, we try the format specific seek */
-    if (s->iformat->read_seek)
-        ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
-    else
-        ret = -1;
-    if (ret >= 0) {
-        return 0;
-    }
-
-    if(s->iformat->read_timestamp)
-        return av_seek_frame_binary(s, stream_index, timestamp, flags);
-    else
-        return av_seek_frame_generic(s, stream_index, timestamp, flags);
-}
-
-int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
-{
-    if(min_ts > ts || max_ts < ts)
-        return -1;
-
-    ff_read_frame_flush(s);
-
-    if (s->iformat->read_seek2)
-        return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags);
-
-    if(s->iformat->read_timestamp){
-        //try to seek via read_timestamp()
-    }
-
-    //Fallback to old API if new is not implemented but old is
-    //Note the old has somewat different sematics
-    if(s->iformat->read_seek || 1)
-        return av_seek_frame(s, stream_index, ts, flags | (ts - min_ts > (uint64_t)(max_ts - ts) ? AVSEEK_FLAG_BACKWARD : 0));
-
-    // try some generic seek like av_seek_frame_generic() but with new ts semantics
-}
-
-/*******************************************************/
-
-/**
- * Returns TRUE if the stream has accurate duration in any stream.
- *
- * @return TRUE if the stream has accurate duration for at least one component.
- */
-static int av_has_duration(AVFormatContext *ic)
-{
-    int i;
-    AVStream *st;
-
-    for(i = 0;i < ic->nb_streams; i++) {
-        st = ic->streams[i];
-        if (st->duration != AV_NOPTS_VALUE)
-            return 1;
-    }
-    return 0;
-}
-
-/**
- * Estimate the stream timings from the one of each components.
- *
- * Also computes the global bitrate if possible.
- */
-static void av_update_stream_timings(AVFormatContext *ic)
-{
-    int64_t start_time, start_time1, end_time, end_time1;
-    int64_t duration, duration1;
-    int i;
-    AVStream *st;
-
-    start_time = INT64_MAX;
-    end_time = INT64_MIN;
-    duration = INT64_MIN;
-    for(i = 0;i < ic->nb_streams; i++) {
-        st = ic->streams[i];
-        if (st->start_time != AV_NOPTS_VALUE && st->time_base.den) {
-            start_time1= av_rescale_q(st->start_time, st->time_base, AV_TIME_BASE_Q);
-            if (start_time1 < start_time)
-                start_time = start_time1;
-            if (st->duration != AV_NOPTS_VALUE) {
-                end_time1 = start_time1
-                          + av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q);
-                if (end_time1 > end_time)
-                    end_time = end_time1;
-            }
-        }
-        if (st->duration != AV_NOPTS_VALUE) {
-            duration1 = av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q);
-            if (duration1 > duration)
-                duration = duration1;
-        }
-    }
-    if (start_time != INT64_MAX) {
-        ic->start_time = start_time;
-        if (end_time != INT64_MIN) {
-            if (end_time - start_time > duration)
-                duration = end_time - start_time;
-        }
-    }
-    if (duration != INT64_MIN) {
-        ic->duration = duration;
-        if (ic->file_size > 0) {
-            /* compute the bitrate */
-            ic->bit_rate = (double)ic->file_size * 8.0 * AV_TIME_BASE /
-                (double)ic->duration;
-        }
-    }
-}
-
-static void fill_all_stream_timings(AVFormatContext *ic)
-{
-    int i;
-    AVStream *st;
-
-    av_update_stream_timings(ic);
-    for(i = 0;i < ic->nb_streams; i++) {
-        st = ic->streams[i];
-        if (st->start_time == AV_NOPTS_VALUE) {
-            if(ic->start_time != AV_NOPTS_VALUE)
-                st->start_time = av_rescale_q(ic->start_time, AV_TIME_BASE_Q, st->time_base);
-            if(ic->duration != AV_NOPTS_VALUE)
-                st->duration = av_rescale_q(ic->duration, AV_TIME_BASE_Q, st->time_base);
-        }
-    }
-}
-
-static void av_estimate_timings_from_bit_rate(AVFormatContext *ic)
-{
-    int64_t filesize, duration;
-    int bit_rate, i;
-    AVStream *st;
-
-    /* if bit_rate is already set, we believe it */
-    if (ic->bit_rate == 0) {
-        bit_rate = 0;
-        for(i=0;i<ic->nb_streams;i++) {
-            st = ic->streams[i];
-            bit_rate += st->codec->bit_rate;
-        }
-        ic->bit_rate = bit_rate;
-    }
-
-    /* if duration is already set, we believe it */
-    if (ic->duration == AV_NOPTS_VALUE &&
-        ic->bit_rate != 0 &&
-        ic->file_size != 0)  {
-        filesize = ic->file_size;
-        if (filesize > 0) {
-            for(i = 0; i < ic->nb_streams; i++) {
-                st = ic->streams[i];
-                duration= av_rescale(8*filesize, st->time_base.den, ic->bit_rate*(int64_t)st->time_base.num);
-                if (st->duration == AV_NOPTS_VALUE)
-                    st->duration = duration;
-            }
-        }
-    }
-}
-
-#define DURATION_MAX_READ_SIZE 250000
-#define DURATION_MAX_RETRY 3
-
-/* only usable for MPEG-PS streams */
-static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
-{
-    AVPacket pkt1, *pkt = &pkt1;
-    AVStream *st;
-    int read_size, i, ret;
-    int64_t end_time, start_time[MAX_STREAMS];
-    int64_t filesize, offset, duration;
-    int retry=0;
-
-    ic->cur_st = NULL;
-
-    /* flush packet queue */
-    flush_packet_queue(ic);
-
-    for(i=0;i<ic->nb_streams;i++) {
-        st = ic->streams[i];
-        if(st->start_time != AV_NOPTS_VALUE){
-            start_time[i]= st->start_time;
-        }else if(st->first_dts != AV_NOPTS_VALUE){
-            start_time[i]= st->first_dts;
-        }else
-            av_log(st->codec, AV_LOG_WARNING, "start time is not set in av_estimate_timings_from_pts\n");
-
-        if (st->parser) {
-            av_parser_close(st->parser);
-            st->parser= NULL;
-            av_free_packet(&st->cur_pkt);
-        }
-    }
-
-    /* estimate the end time (duration) */
-    /* XXX: may need to support wrapping */
-    filesize = ic->file_size;
-    end_time = AV_NOPTS_VALUE;
-    do{
-    offset = filesize - (DURATION_MAX_READ_SIZE<<retry);
-    if (offset < 0)
-        offset = 0;
-
-    url_fseek(ic->pb, offset, SEEK_SET);
-    read_size = 0;
-    for(;;) {
-        if (read_size >= DURATION_MAX_READ_SIZE<<(FFMAX(retry-1,0)))
-            break;
-
-        do{
-            ret = av_read_packet(ic, pkt);
-        }while(ret == AVERROR(EAGAIN));
-        if (ret != 0)
-            break;
-        read_size += pkt->size;
-        st = ic->streams[pkt->stream_index];
-        if (pkt->pts != AV_NOPTS_VALUE &&
-            start_time[pkt->stream_index] != AV_NOPTS_VALUE) {
-            end_time = pkt->pts;
-            duration = end_time - start_time[pkt->stream_index];
-            if (duration < 0)
-                duration += 1LL<<st->pts_wrap_bits;
-            if (duration > 0) {
-                if (st->duration == AV_NOPTS_VALUE ||
-                    st->duration < duration)
-                    st->duration = duration;
-            }
-        }
-        av_free_packet(pkt);
-    }
-    }while(   end_time==AV_NOPTS_VALUE
-           && filesize > (DURATION_MAX_READ_SIZE<<retry)
-           && ++retry <= DURATION_MAX_RETRY);
-
-    fill_all_stream_timings(ic);
-
-    url_fseek(ic->pb, old_offset, SEEK_SET);
-    for(i=0; i<ic->nb_streams; i++){
-        st= ic->streams[i];
-        st->cur_dts= st->first_dts;
-        st->last_IP_pts = AV_NOPTS_VALUE;
-    }
-}
-
-static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
-{
-    int64_t file_size;
-
-    /* get the file size, if possible */
-    if (ic->iformat->flags & AVFMT_NOFILE) {
-        file_size = 0;
-    } else {
-        file_size = url_fsize(ic->pb);
-        if (file_size < 0)
-            file_size = 0;
-    }
-    ic->file_size = file_size;
-
-    if ((!strcmp(ic->iformat->name, "mpeg") ||
-         !strcmp(ic->iformat->name, "mpegts")) &&
-        file_size && !url_is_streamed(ic->pb)) {
-        /* get accurate estimate from the PTSes */
-        av_estimate_timings_from_pts(ic, old_offset);
-    } else if (av_has_duration(ic)) {
-        /* at least one component has timings - we use them for all
-           the components */
-        fill_all_stream_timings(ic);
-    } else {
-        av_log(ic, AV_LOG_WARNING, "Estimating duration from bitrate, this may be inaccurate\n");
-        /* less precise: use bitrate info */
-        av_estimate_timings_from_bit_rate(ic);
-    }
-    av_update_stream_timings(ic);
-
-#if 0
-    {
-        int i;
-        AVStream *st;
-        for(i = 0;i < ic->nb_streams; i++) {
-            st = ic->streams[i];
-        printf("%d: start_time: %0.3f duration: %0.3f\n",
-               i, (double)st->start_time / AV_TIME_BASE,
-               (double)st->duration / AV_TIME_BASE);
-        }
-        printf("stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n",
-               (double)ic->start_time / AV_TIME_BASE,
-               (double)ic->duration / AV_TIME_BASE,
-               ic->bit_rate / 1000);
-    }
-#endif
-}
-
-static int has_codec_parameters(AVCodecContext *enc)
-{
-    int val;
-    switch(enc->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        val = enc->sample_rate && enc->channels && enc->sample_fmt != SAMPLE_FMT_NONE;
-        if(!enc->frame_size &&
-           (enc->codec_id == CODEC_ID_VORBIS ||
-            enc->codec_id == CODEC_ID_AAC ||
-            enc->codec_id == CODEC_ID_MP1 ||
-            enc->codec_id == CODEC_ID_MP2 ||
-            enc->codec_id == CODEC_ID_MP3 ||
-            enc->codec_id == CODEC_ID_SPEEX))
-            return 0;
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        val = enc->width && enc->pix_fmt != PIX_FMT_NONE;
-        break;
-    default:
-        val = 1;
-        break;
-    }
-    return enc->codec_id != CODEC_ID_NONE && val != 0;
-}
-
-static int try_decode_frame(AVStream *st, AVPacket *avpkt)
-{
-    int16_t *samples;
-    AVCodec *codec;
-    int got_picture, data_size, ret=0;
-    AVFrame picture;
-
-    if(!st->codec->codec){
-        codec = avcodec_find_decoder(st->codec->codec_id);
-        if (!codec)
-            return -1;
-        ret = avcodec_open(st->codec, codec);
-        if (ret < 0)
-            return ret;
-    }
-
-    if(!has_codec_parameters(st->codec)){
-        switch(st->codec->codec_type) {
-        case AVMEDIA_TYPE_VIDEO:
-            avcodec_get_frame_defaults(&picture);
-            ret = avcodec_decode_video2(st->codec, &picture,
-                                        &got_picture, avpkt);
-            break;
-        case AVMEDIA_TYPE_AUDIO:
-            data_size = FFMAX(avpkt->size, AVCODEC_MAX_AUDIO_FRAME_SIZE);
-            samples = av_malloc(data_size);
-            if (!samples)
-                goto fail;
-            ret = avcodec_decode_audio3(st->codec, samples,
-                                        &data_size, avpkt);
-            av_free(samples);
-            break;
-        default:
-            break;
-        }
-    }
- fail:
-    return ret;
-}
-
-unsigned int ff_codec_get_tag(const AVCodecTag *tags, int id)
-{
-    while (tags->id != CODEC_ID_NONE) {
-        if (tags->id == id)
-            return tags->tag;
-        tags++;
-    }
-    return 0;
-}
-
-enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
-{
-    int i;
-    for(i=0; tags[i].id != CODEC_ID_NONE;i++) {
-        if(tag == tags[i].tag)
-            return tags[i].id;
-    }
-    for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
-        if(   toupper((tag >> 0)&0xFF) == toupper((tags[i].tag >> 0)&0xFF)
-           && toupper((tag >> 8)&0xFF) == toupper((tags[i].tag >> 8)&0xFF)
-           && toupper((tag >>16)&0xFF) == toupper((tags[i].tag >>16)&0xFF)
-           && toupper((tag >>24)&0xFF) == toupper((tags[i].tag >>24)&0xFF))
-            return tags[i].id;
-    }
-    return CODEC_ID_NONE;
-}
-
-unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum CodecID id)
-{
-    int i;
-    for(i=0; tags && tags[i]; i++){
-        int tag= ff_codec_get_tag(tags[i], id);
-        if(tag) return tag;
-    }
-    return 0;
-}
-
-enum CodecID av_codec_get_id(const AVCodecTag * const *tags, unsigned int tag)
-{
-    int i;
-    for(i=0; tags && tags[i]; i++){
-        enum CodecID id= ff_codec_get_id(tags[i], tag);
-        if(id!=CODEC_ID_NONE) return id;
-    }
-    return CODEC_ID_NONE;
-}
-
-static void compute_chapters_end(AVFormatContext *s)
-{
-    unsigned int i;
-
-    for (i=0; i+1<s->nb_chapters; i++)
-        if (s->chapters[i]->end == AV_NOPTS_VALUE) {
-            assert(s->chapters[i]->start <= s->chapters[i+1]->start);
-            assert(!av_cmp_q(s->chapters[i]->time_base, s->chapters[i+1]->time_base));
-            s->chapters[i]->end = s->chapters[i+1]->start;
-        }
-
-    if (s->nb_chapters && s->chapters[i]->end == AV_NOPTS_VALUE) {
-        assert(s->start_time != AV_NOPTS_VALUE);
-        assert(s->duration > 0);
-        s->chapters[i]->end = av_rescale_q(s->start_time + s->duration,
-                                           AV_TIME_BASE_Q,
-                                           s->chapters[i]->time_base);
-    }
-}
-
-#define MAX_STD_TIMEBASES (60*12+5)
-static int get_std_framerate(int i){
-    if(i<60*12) return i*1001;
-    else        return ((const int[]){24,30,60,12,15})[i-60*12]*1000*12;
-}
-
-/*
- * Is the time base unreliable.
- * This is a heuristic to balance between quick acceptance of the values in
- * the headers vs. some extra checks.
- * Old DivX and Xvid often have nonsense timebases like 1fps or 2fps.
- * MPEG-2 commonly misuses field repeat flags to store different framerates.
- * And there are "variable" fps files this needs to detect as well.
- */
-static int tb_unreliable(AVCodecContext *c){
-    if(   c->time_base.den >= 101L*c->time_base.num
-       || c->time_base.den <    5L*c->time_base.num
-/*       || c->codec_tag == AV_RL32("DIVX")
-       || c->codec_tag == AV_RL32("XVID")*/
-       || c->codec_id == CODEC_ID_MPEG2VIDEO
-       || c->codec_id == CODEC_ID_H264
-       )
-        return 1;
-    return 0;
-}
-
-int av_find_stream_info(AVFormatContext *ic)
-{
-    int i, count, ret, read_size, j;
-    AVStream *st;
-    AVPacket pkt1, *pkt;
-    int64_t last_dts[MAX_STREAMS];
-    int64_t duration_gcd[MAX_STREAMS]={0};
-    int duration_count[MAX_STREAMS]={0};
-    double (*duration_error)[MAX_STD_TIMEBASES];
-    int64_t old_offset = url_ftell(ic->pb);
-    int64_t codec_info_duration[MAX_STREAMS]={0};
-
-    duration_error = av_mallocz(MAX_STREAMS * sizeof(*duration_error));
-    if (!duration_error) return AVERROR(ENOMEM);
-
-    for(i=0;i<ic->nb_streams;i++) {
-        st = ic->streams[i];
-        if (st->codec->codec_id == CODEC_ID_AAC) {
-            st->codec->sample_rate = 0;
-            st->codec->frame_size = 0;
-            st->codec->channels = 0;
-        }
-        if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
-/*            if(!st->time_base.num)
-                st->time_base= */
-            if(!st->codec->time_base.num)
-                st->codec->time_base= st->time_base;
-        }
-        //only for the split stuff
-        if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) {
-            st->parser = av_parser_init(st->codec->codec_id);
-            if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){
-                st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
-            }
-        }
-        assert(!st->codec->codec);
-        //try to just open decoders, in case this is enough to get parameters
-        if(!has_codec_parameters(st->codec)){
-            AVCodec *codec = avcodec_find_decoder(st->codec->codec_id);
-            if (codec)
-                avcodec_open(st->codec, codec);
-        }
-    }
-
-    for(i=0;i<MAX_STREAMS;i++){
-        last_dts[i]= AV_NOPTS_VALUE;
-    }
-
-    count = 0;
-    read_size = 0;
-    for(;;) {
-        if(url_interrupt_cb()){
-            ret= AVERROR(EINTR);
-            av_log(ic, AV_LOG_DEBUG, "interrupted\n");
-            break;
-        }
-
-        /* check if one codec still needs to be handled */
-        for(i=0;i<ic->nb_streams;i++) {
-            st = ic->streams[i];
-            if (!has_codec_parameters(st->codec))
-                break;
-            /* variable fps and no guess at the real fps */
-            if(   tb_unreliable(st->codec) && !(st->r_frame_rate.num && st->avg_frame_rate.num)
-               && duration_count[i]<20 && st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-                break;
-            if(st->parser && st->parser->parser->split && !st->codec->extradata)
-                break;
-            if(st->first_dts == AV_NOPTS_VALUE)
-                break;
-        }
-        if (i == ic->nb_streams) {
-            /* NOTE: if the format has no header, then we need to read
-               some packets to get most of the streams, so we cannot
-               stop here */
-            if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
-                /* if we found the info for all the codecs, we can stop */
-                ret = count;
-                av_log(ic, AV_LOG_DEBUG, "All info found\n");
-                break;
-            }
-        }
-        /* we did not get all the codec info, but we read too much data */
-        if (read_size >= ic->probesize) {
-            ret = count;
-            av_log(ic, AV_LOG_DEBUG, "Probe buffer size limit %d reached\n", ic->probesize);
-            break;
-        }
-
-        /* NOTE: a new stream can be added there if no header in file
-           (AVFMTCTX_NOHEADER) */
-        ret = av_read_frame_internal(ic, &pkt1);
-        if(ret == AVERROR(EAGAIN))
-            continue;
-        if (ret < 0) {
-            /* EOF or error */
-            ret = -1; /* we could not have all the codec parameters before EOF */
-            for(i=0;i<ic->nb_streams;i++) {
-                st = ic->streams[i];
-                if (!has_codec_parameters(st->codec)){
-                    char buf[256];
-                    avcodec_string(buf, sizeof(buf), st->codec, 0);
-                    av_log(ic, AV_LOG_WARNING, "Could not find codec parameters (%s)\n", buf);
-                } else {
-                    ret = 0;
-                }
-            }
-            break;
-        }
-
-        pkt= add_to_pktbuf(&ic->packet_buffer, &pkt1, &ic->packet_buffer_end);
-        if(av_dup_packet(pkt) < 0) {
-            av_free(duration_error);
-            return AVERROR(ENOMEM);
-        }
-
-        read_size += pkt->size;
-
-        st = ic->streams[pkt->stream_index];
-        if(st->codec_info_nb_frames>1) {
-            if (st->time_base.den > 0 && av_rescale_q(codec_info_duration[st->index], st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration){
-                av_log(ic, AV_LOG_WARNING, "max_analyze_duration reached\n");
-                break;
-            }
-            codec_info_duration[st->index] += pkt->duration;
-        }
-            st->codec_info_nb_frames++;
-
-        {
-            int index= pkt->stream_index;
-            int64_t last= last_dts[index];
-            int64_t duration= pkt->dts - last;
-
-            if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && duration>0){
-                double dur= duration * av_q2d(st->time_base);
-
-//                if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-//                    av_log(NULL, AV_LOG_ERROR, "%f\n", dur);
-                if(duration_count[index] < 2)
-                    memset(duration_error[index], 0, sizeof(*duration_error));
-                for(i=1; i<MAX_STD_TIMEBASES; i++){
-                    int framerate= get_std_framerate(i);
-                    int ticks= lrintf(dur*framerate/(1001*12));
-                    double error= dur - ticks*1001*12/(double)framerate;
-                    duration_error[index][i] += error*error;
-                }
-                duration_count[index]++;
-                // ignore the first 4 values, they might have some random jitter
-                if (duration_count[index] > 3)
-                    duration_gcd[index] = av_gcd(duration_gcd[index], duration);
-            }
-            if(last == AV_NOPTS_VALUE || duration_count[index]<=1)
-                last_dts[pkt->stream_index]= pkt->dts;
-        }
-        if(st->parser && st->parser->parser->split && !st->codec->extradata){
-            int i= st->parser->parser->split(st->codec, pkt->data, pkt->size);
-            if(i){
-                st->codec->extradata_size= i;
-                st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-                memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);
-                memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-            }
-        }
-
-        /* if still no information, we try to open the codec and to
-           decompress the frame. We try to avoid that in most cases as
-           it takes longer and uses more memory. For MPEG-4, we need to
-           decompress for QuickTime. */
-        if (!has_codec_parameters(st->codec))
-            try_decode_frame(st, pkt);
-
-        count++;
-    }
-
-    // close codecs which were opened in try_decode_frame()
-    for(i=0;i<ic->nb_streams;i++) {
-        st = ic->streams[i];
-        if(st->codec->codec)
-            avcodec_close(st->codec);
-    }
-    for(i=0;i<ic->nb_streams;i++) {
-        st = ic->streams[i];
-        if(st->codec_info_nb_frames>2 && !st->avg_frame_rate.num && codec_info_duration[i])
-            av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
-                     (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den,
-                      codec_info_duration[i]    *(int64_t)st->time_base.num, 60000);
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample)
-                st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
-
-            // the check for tb_unreliable() is not completely correct, since this is not about handling
-            // a unreliable/inexact time base, but a time base that is finer than necessary, as e.g.
-            // ipmovie.c produces.
-            if (tb_unreliable(st->codec) && duration_count[i] > 15 && duration_gcd[i] > 1 && !st->r_frame_rate.num)
-                av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * duration_gcd[i], INT_MAX);
-            if(duration_count[i] && !st->r_frame_rate.num
-               && tb_unreliable(st->codec) /*&&
-               //FIXME we should not special-case MPEG-2, but this needs testing with non-MPEG-2 ...
-               st->time_base.num*duration_sum[i]/duration_count[i]*101LL > st->time_base.den*/){
-                int num = 0;
-                double best_error= 2*av_q2d(st->time_base);
-                best_error= best_error*best_error*duration_count[i]*1000*12*30;
-
-                for(j=1; j<MAX_STD_TIMEBASES; j++){
-                    double error= duration_error[i][j] * get_std_framerate(j);
-//                    if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
-//                        av_log(NULL, AV_LOG_ERROR, "%f %f\n", get_std_framerate(j) / 12.0/1001, error);
-                    if(error < best_error){
-                        best_error= error;
-                        num = get_std_framerate(j);
-                    }
-                }
-                // do not increase frame rate by more than 1 % in order to match a standard rate.
-                if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate)))
-                    av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX);
-            }
-
-            if (!st->r_frame_rate.num){
-                if(    st->codec->time_base.den * (int64_t)st->time_base.num
-                    <= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t)st->time_base.den){
-                    st->r_frame_rate.num = st->codec->time_base.den;
-                    st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame;
-                }else{
-                    st->r_frame_rate.num = st->time_base.den;
-                    st->r_frame_rate.den = st->time_base.num;
-                }
-            }
-        }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            if(!st->codec->bits_per_coded_sample)
-                st->codec->bits_per_coded_sample= av_get_bits_per_sample(st->codec->codec_id);
-        }
-    }
-
-    av_estimate_timings(ic, old_offset);
-
-    compute_chapters_end(ic);
-
-#if 0
-    /* correct DTS for B-frame streams with no timestamps */
-    for(i=0;i<ic->nb_streams;i++) {
-        st = ic->streams[i];
-        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            if(b-frames){
-                ppktl = &ic->packet_buffer;
-                while(ppkt1){
-                    if(ppkt1->stream_index != i)
-                        continue;
-                    if(ppkt1->pkt->dts < 0)
-                        break;
-                    if(ppkt1->pkt->pts != AV_NOPTS_VALUE)
-                        break;
-                    ppkt1->pkt->dts -= delta;
-                    ppkt1= ppkt1->next;
-                }
-                if(ppkt1)
-                    continue;
-                st->cur_dts -= delta;
-            }
-        }
-    }
-#endif
-
-    av_free(duration_error);
-
-    return ret;
-}
-
-/*******************************************************/
-
-int av_read_play(AVFormatContext *s)
-{
-    if (s->iformat->read_play)
-        return s->iformat->read_play(s);
-    if (s->pb)
-        return av_url_read_fpause(s->pb, 0);
-    return AVERROR(ENOSYS);
-}
-
-int av_read_pause(AVFormatContext *s)
-{
-    if (s->iformat->read_pause)
-        return s->iformat->read_pause(s);
-    if (s->pb)
-        return av_url_read_fpause(s->pb, 1);
-    return AVERROR(ENOSYS);
-}
-
-void av_close_input_stream(AVFormatContext *s)
-{
-    int i;
-    AVStream *st;
-
-    if (s->iformat->read_close)
-        s->iformat->read_close(s);
-    for(i=0;i<s->nb_streams;i++) {
-        /* free all data in a stream component */
-        st = s->streams[i];
-        if (st->parser) {
-            av_parser_close(st->parser);
-            av_free_packet(&st->cur_pkt);
-        }
-        av_metadata_free(&st->metadata);
-        av_free(st->index_entries);
-        av_free(st->codec->extradata);
-        av_free(st->codec);
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-        av_free(st->filename);
-#endif
-        av_free(st->priv_data);
-        av_free(st);
-    }
-    for(i=s->nb_programs-1; i>=0; i--) {
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-        av_freep(&s->programs[i]->provider_name);
-        av_freep(&s->programs[i]->name);
-#endif
-        av_metadata_free(&s->programs[i]->metadata);
-        av_freep(&s->programs[i]->stream_index);
-        av_freep(&s->programs[i]);
-    }
-    av_freep(&s->programs);
-    flush_packet_queue(s);
-    av_freep(&s->priv_data);
-    while(s->nb_chapters--) {
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-        av_free(s->chapters[s->nb_chapters]->title);
-#endif
-        av_metadata_free(&s->chapters[s->nb_chapters]->metadata);
-        av_free(s->chapters[s->nb_chapters]);
-    }
-    av_freep(&s->chapters);
-    av_metadata_free(&s->metadata);
-    av_free(s);
-}
-
-void av_close_input_file(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
-    av_close_input_stream(s);
-    if (pb)
-        url_fclose(pb);
-}
-
-AVStream *av_new_stream(AVFormatContext *s, int id)
-{
-    AVStream *st;
-    int i;
-
-    if (s->nb_streams >= MAX_STREAMS)
-        return NULL;
-
-    st = av_mallocz(sizeof(AVStream));
-    if (!st)
-        return NULL;
-
-    st->codec= avcodec_alloc_context();
-    if (s->iformat) {
-        /* no default bitrate if decoding */
-        st->codec->bit_rate = 0;
-    }
-    st->index = s->nb_streams;
-    st->id = id;
-    st->start_time = AV_NOPTS_VALUE;
-    st->duration = AV_NOPTS_VALUE;
-        /* we set the current DTS to 0 so that formats without any timestamps
-           but durations get some timestamps, formats with some unknown
-           timestamps have their first few packets buffered and the
-           timestamps corrected before they are returned to the user */
-    st->cur_dts = 0;
-    st->first_dts = AV_NOPTS_VALUE;
-    st->probe_packets = MAX_PROBE_PACKETS;
-
-    /* default pts setting is MPEG-like */
-    av_set_pts_info(st, 33, 1, 90000);
-    st->last_IP_pts = AV_NOPTS_VALUE;
-    for(i=0; i<MAX_REORDER_DELAY+1; i++)
-        st->pts_buffer[i]= AV_NOPTS_VALUE;
-    st->reference_dts = AV_NOPTS_VALUE;
-
-    st->sample_aspect_ratio = (AVRational){0,1};
-
-    s->streams[s->nb_streams++] = st;
-    return st;
-}
-
-AVProgram *av_new_program(AVFormatContext *ac, int id)
-{
-    AVProgram *program=NULL;
-    int i;
-
-#ifdef DEBUG_SI
-    av_log(ac, AV_LOG_DEBUG, "new_program: id=0x%04x\n", id);
-#endif
-
-    for(i=0; i<ac->nb_programs; i++)
-        if(ac->programs[i]->id == id)
-            program = ac->programs[i];
-
-    if(!program){
-        program = av_mallocz(sizeof(AVProgram));
-        if (!program)
-            return NULL;
-        dynarray_add(&ac->programs, &ac->nb_programs, program);
-        program->discard = AVDISCARD_NONE;
-    }
-    program->id = id;
-
-    return program;
-}
-
-AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title)
-{
-    AVChapter *chapter = NULL;
-    int i;
-
-    for(i=0; i<s->nb_chapters; i++)
-        if(s->chapters[i]->id == id)
-            chapter = s->chapters[i];
-
-    if(!chapter){
-        chapter= av_mallocz(sizeof(AVChapter));
-        if(!chapter)
-            return NULL;
-        dynarray_add(&s->chapters, &s->nb_chapters, chapter);
-    }
-#if LIBAVFORMAT_VERSION_INT < (53<<16)
-    av_free(chapter->title);
-#endif
-    av_metadata_set2(&chapter->metadata, "title", title, 0);
-    chapter->id    = id;
-    chapter->time_base= time_base;
-    chapter->start = start;
-    chapter->end   = end;
-
-    return chapter;
-}
-
-/************************************************************/
-/* output media file */
-
-int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)
-{
-    int ret;
-
-    if (s->oformat->priv_data_size > 0) {
-        s->priv_data = av_mallocz(s->oformat->priv_data_size);
-        if (!s->priv_data)
-            return AVERROR(ENOMEM);
-    } else
-        s->priv_data = NULL;
-
-    if (s->oformat->set_parameters) {
-        ret = s->oformat->set_parameters(s, ap);
-        if (ret < 0)
-            return ret;
-    }
-    return 0;
-}
-
-int av_write_header(AVFormatContext *s)
-{
-    int ret, i;
-    AVStream *st;
-
-    // some sanity checks
-    if (s->nb_streams == 0) {
-        av_log(s, AV_LOG_ERROR, "no streams\n");
-        return -1;
-    }
-
-    for(i=0;i<s->nb_streams;i++) {
-        st = s->streams[i];
-
-        switch (st->codec->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            if(st->codec->sample_rate<=0){
-                av_log(s, AV_LOG_ERROR, "sample rate not set\n");
-                return -1;
-            }
-            if(!st->codec->block_align)
-                st->codec->block_align = st->codec->channels *
-                    av_get_bits_per_sample(st->codec->codec_id) >> 3;
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-            if(st->codec->time_base.num<=0 || st->codec->time_base.den<=0){ //FIXME audio too?
-                av_log(s, AV_LOG_ERROR, "time base not set\n");
-                return -1;
-            }
-            if((st->codec->width<=0 || st->codec->height<=0) && !(s->oformat->flags & AVFMT_NODIMENSIONS)){
-                av_log(s, AV_LOG_ERROR, "dimensions not set\n");
-                return -1;
-            }
-            if(av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)){
-                av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between encoder and muxer layer\n");
-                return -1;
-            }
-            break;
-        }
-
-        if(s->oformat->codec_tag){
-            if(st->codec->codec_tag){
-                //FIXME
-                //check that tag + id is in the table
-                //if neither is in the table -> OK
-                //if tag is in the table with another id -> FAIL
-                //if id is in the table with another tag -> FAIL unless strict < ?
-            }else
-                st->codec->codec_tag= av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id);
-        }
-
-        if(s->oformat->flags & AVFMT_GLOBALHEADER &&
-            !(st->codec->flags & CODEC_FLAG_GLOBAL_HEADER))
-          av_log(s, AV_LOG_WARNING, "Codec for stream %d does not use global headers but container format requires global headers\n", i);
-    }
-
-    if (!s->priv_data && s->oformat->priv_data_size > 0) {
-        s->priv_data = av_mallocz(s->oformat->priv_data_size);
-        if (!s->priv_data)
-            return AVERROR(ENOMEM);
-    }
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-    ff_metadata_mux_compat(s);
-#endif
-
-    /* set muxer identification string */
-    if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
-        AVMetadata *m;
-        AVMetadataTag *t;
-
-        if (!(m = av_mallocz(sizeof(AVMetadata))))
-            return AVERROR(ENOMEM);
-        av_metadata_set2(&m, "encoder", LIBAVFORMAT_IDENT, 0);
-        metadata_conv(&m, s->oformat->metadata_conv, NULL);
-        if ((t = av_metadata_get(m, "", NULL, AV_METADATA_IGNORE_SUFFIX)))
-            av_metadata_set2(&s->metadata, t->key, t->value, 0);
-        av_metadata_free(&m);
-    }
-
-    if(s->oformat->write_header){
-        ret = s->oformat->write_header(s);
-        if (ret < 0)
-            return ret;
-    }
-
-    /* init PTS generation */
-    for(i=0;i<s->nb_streams;i++) {
-        int64_t den = AV_NOPTS_VALUE;
-        st = s->streams[i];
-
-        switch (st->codec->codec_type) {
-        case AVMEDIA_TYPE_AUDIO:
-            den = (int64_t)st->time_base.num * st->codec->sample_rate;
-            break;
-        case AVMEDIA_TYPE_VIDEO:
-            den = (int64_t)st->time_base.num * st->codec->time_base.den;
-            break;
-        default:
-            break;
-        }
-        if (den != AV_NOPTS_VALUE) {
-            if (den <= 0)
-                return AVERROR_INVALIDDATA;
-            av_frac_init(&st->pts, 0, 0, den);
-        }
-    }
-    return 0;
-}
-
-//FIXME merge with compute_pkt_fields
-static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
-    int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
-    int num, den, frame_size, i;
-
-//    av_log(s, AV_LOG_DEBUG, "av_write_frame: pts:%"PRId64" dts:%"PRId64" cur_dts:%"PRId64" b:%d size:%d st:%d\n", pkt->pts, pkt->dts, st->cur_dts, delay, pkt->size, pkt->stream_index);
-
-/*    if(pkt->pts == AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE)
-        return -1;*/
-
-    /* duration field */
-    if (pkt->duration == 0) {
-        compute_frame_duration(&num, &den, st, NULL, pkt);
-        if (den && num) {
-            pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den * st->codec->ticks_per_frame, den * (int64_t)st->time_base.num);
-        }
-    }
-
-    if(pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay==0)
-        pkt->pts= pkt->dts;
-
-    //XXX/FIXME this is a temporary hack until all encoders output pts
-    if((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay){
-        pkt->dts=
-//        pkt->pts= st->cur_dts;
-        pkt->pts= st->pts.val;
-    }
-
-    //calculate dts from pts
-    if(pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY){
-        st->pts_buffer[0]= pkt->pts;
-        for(i=1; i<delay+1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
-            st->pts_buffer[i]= pkt->pts + (i-delay-1) * pkt->duration;
-        for(i=0; i<delay && st->pts_buffer[i] > st->pts_buffer[i+1]; i++)
-            FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
-
-        pkt->dts= st->pts_buffer[0];
-    }
-
-    if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){
-        av_log(s, AV_LOG_ERROR,
-               "st:%d error, non monotone timestamps %"PRId64" >= %"PRId64"\n",
-               st->index, st->cur_dts, pkt->dts);
-        return -1;
-    }
-    if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){
-        av_log(s, AV_LOG_ERROR, "st:%d error, pts < dts\n", st->index);
-        return -1;
-    }
-
-//    av_log(s, AV_LOG_DEBUG, "av_write_frame: pts2:%"PRId64" dts2:%"PRId64"\n", pkt->pts, pkt->dts);
-    st->cur_dts= pkt->dts;
-    st->pts.val= pkt->dts;
-
-    /* update pts */
-    switch (st->codec->codec_type) {
-    case AVMEDIA_TYPE_AUDIO:
-        frame_size = get_audio_frame_size(st->codec, pkt->size);
-
-        /* HACK/FIXME, we skip the initial 0 size packets as they are most
-           likely equal to the encoder delay, but it would be better if we
-           had the real timestamps from the encoder */
-        if (frame_size >= 0 && (pkt->size || st->pts.num!=st->pts.den>>1 || st->pts.val)) {
-            av_frac_add(&st->pts, (int64_t)st->time_base.den * frame_size);
-        }
-        break;
-    case AVMEDIA_TYPE_VIDEO:
-        av_frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num);
-        break;
-    default:
-        break;
-    }
-    return 0;
-}
-
-int av_write_frame(AVFormatContext *s, AVPacket *pkt)
-{
-    int ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
-
-    if(ret<0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return ret;
-
-    ret= s->oformat->write_packet(s, pkt);
-    if(!ret)
-        ret= url_ferror(s->pb);
-    return ret;
-}
-
-void ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
-                              int (*compare)(AVFormatContext *, AVPacket *, AVPacket *))
-{
-    AVPacketList **next_point, *this_pktl;
-
-    this_pktl = av_mallocz(sizeof(AVPacketList));
-    this_pktl->pkt= *pkt;
-    pkt->destruct= NULL;             // do not free original but only the copy
-    av_dup_packet(&this_pktl->pkt);  // duplicate the packet if it uses non-alloced memory
-
-    if(s->streams[pkt->stream_index]->last_in_packet_buffer){
-        next_point = &(s->streams[pkt->stream_index]->last_in_packet_buffer->next);
-    }else
-        next_point = &s->packet_buffer;
-
-    if(*next_point){
-        if(compare(s, &s->packet_buffer_end->pkt, pkt)){
-            while(!compare(s, &(*next_point)->pkt, pkt)){
-                next_point= &(*next_point)->next;
-            }
-            goto next_non_null;
-        }else{
-            next_point = &(s->packet_buffer_end->next);
-        }
-    }
-    assert(!*next_point);
-
-    s->packet_buffer_end= this_pktl;
-next_non_null:
-
-    this_pktl->next= *next_point;
-
-    s->streams[pkt->stream_index]->last_in_packet_buffer=
-    *next_point= this_pktl;
-}
-
-int ff_interleave_compare_dts(AVFormatContext *s, AVPacket *next, AVPacket *pkt)
-{
-    AVStream *st = s->streams[ pkt ->stream_index];
-    AVStream *st2= s->streams[ next->stream_index];
-    int64_t a= st2->time_base.num * (int64_t)st ->time_base.den;
-    int64_t b= st ->time_base.num * (int64_t)st2->time_base.den;
-    return av_rescale_rnd(pkt->dts, b, a, AV_ROUND_DOWN) < next->dts;
-}
-
-int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){
-    AVPacketList *pktl;
-    int stream_count=0;
-    int i;
-
-    if(pkt){
-        ff_interleave_add_packet(s, pkt, ff_interleave_compare_dts);
-    }
-
-    for(i=0; i < s->nb_streams; i++)
-        stream_count+= !!s->streams[i]->last_in_packet_buffer;
-
-    if(stream_count && (s->nb_streams == stream_count || flush)){
-        pktl= s->packet_buffer;
-        *out= pktl->pkt;
-
-        s->packet_buffer= pktl->next;
-        if(!s->packet_buffer)
-            s->packet_buffer_end= NULL;
-
-        if(s->streams[out->stream_index]->last_in_packet_buffer == pktl)
-            s->streams[out->stream_index]->last_in_packet_buffer= NULL;
-        av_freep(&pktl);
-        return 1;
-    }else{
-        av_init_packet(out);
-        return 0;
-    }
-}
-
-/**
- * Interleaves an AVPacket correctly so it can be muxed.
- * @param out the interleaved packet will be output here
- * @param in the input packet
- * @param flush 1 if no further packets are available as input and all
- *              remaining packets should be output
- * @return 1 if a packet was output, 0 if no packet could be output,
- *         < 0 if an error occurred
- */
-static int av_interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush){
-    if(s->oformat->interleave_packet)
-        return s->oformat->interleave_packet(s, out, in, flush);
-    else
-        return av_interleave_packet_per_dts(s, out, in, flush);
-}
-
-int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
-    AVStream *st= s->streams[ pkt->stream_index];
-
-    //FIXME/XXX/HACK drop zero sized packets
-    if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size==0)
-        return 0;
-
-//av_log(NULL, AV_LOG_DEBUG, "av_interleaved_write_frame %d %"PRId64" %"PRId64"\n", pkt->size, pkt->dts, pkt->pts);
-    if(compute_pkt_fields2(s, st, pkt) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return -1;
-
-    if(pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
-        return -1;
-
-    for(;;){
-        AVPacket opkt;
-        int ret= av_interleave_packet(s, &opkt, pkt, 0);
-        if(ret<=0) //FIXME cleanup needed for ret<0 ?
-            return ret;
-
-        ret= s->oformat->write_packet(s, &opkt);
-
-        av_free_packet(&opkt);
-        pkt= NULL;
-
-        if(ret<0)
-            return ret;
-        if(url_ferror(s->pb))
-            return url_ferror(s->pb);
-    }
-}
-
-int av_write_trailer(AVFormatContext *s)
-{
-    int ret, i;
-
-    for(;;){
-        AVPacket pkt;
-        ret= av_interleave_packet(s, &pkt, NULL, 1);
-        if(ret<0) //FIXME cleanup needed for ret<0 ?
-            goto fail;
-        if(!ret)
-            break;
-
-        ret= s->oformat->write_packet(s, &pkt);
-
-        av_free_packet(&pkt);
-
-        if(ret<0)
-            goto fail;
-        if(url_ferror(s->pb))
-            goto fail;
-    }
-
-    if(s->oformat->write_trailer)
-        ret = s->oformat->write_trailer(s);
-fail:
-    if(ret == 0)
-       ret=url_ferror(s->pb);
-    for(i=0;i<s->nb_streams;i++) {
-        av_freep(&s->streams[i]->priv_data);
-        av_freep(&s->streams[i]->index_entries);
-    }
-    av_freep(&s->priv_data);
-    return ret;
-}
-
-void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
-{
-    int i, j;
-    AVProgram *program=NULL;
-    void *tmp;
-
-    if (idx >= ac->nb_streams) {
-        av_log(ac, AV_LOG_ERROR, "stream index %d is not valid\n", idx);
-        return;
-    }
-
-    for(i=0; i<ac->nb_programs; i++){
-        if(ac->programs[i]->id != progid)
-            continue;
-        program = ac->programs[i];
-        for(j=0; j<program->nb_stream_indexes; j++)
-            if(program->stream_index[j] == idx)
-                return;
-
-        tmp = av_realloc(program->stream_index, sizeof(unsigned int)*(program->nb_stream_indexes+1));
-        if(!tmp)
-            return;
-        program->stream_index = tmp;
-        program->stream_index[program->nb_stream_indexes++] = idx;
-        return;
-    }
-}
-
-static void print_fps(double d, const char *postfix){
-    uint64_t v= lrintf(d*100);
-    if     (v% 100      ) av_log(NULL, AV_LOG_INFO, ", %3.2f %s", d, postfix);
-    else if(v%(100*1000)) av_log(NULL, AV_LOG_INFO, ", %1.0f %s", d, postfix);
-    else                  av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix);
-}
-
-static void dump_metadata(void *ctx, AVMetadata *m, const char *indent)
-{
-    if(m && !(m->count == 1 && av_metadata_get(m, "language", NULL, 0))){
-        AVMetadataTag *tag=NULL;
-
-        av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
-        while((tag=av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
-            if(strcmp("language", tag->key))
-                av_log(ctx, AV_LOG_INFO, "%s  %-16s: %s\n", indent, tag->key, tag->value);
-        }
-    }
-}
-
-/* "user interface" functions */
-static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
-{
-    char buf[256];
-    int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
-    AVStream *st = ic->streams[i];
-    int g = av_gcd(st->time_base.num, st->time_base.den);
-    AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL, 0);
-    avcodec_string(buf, sizeof(buf), st->codec, is_output);
-    av_log(NULL, AV_LOG_INFO, "    Stream #%d.%d", index, i);
-    /* the pid is an important information, so we display it */
-    /* XXX: add a generic system */
-    if (flags & AVFMT_SHOW_IDS)
-        av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id);
-    if (lang)
-        av_log(NULL, AV_LOG_INFO, "(%s)", lang->value);
-    av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num/g, st->time_base.den/g);
-    av_log(NULL, AV_LOG_INFO, ": %s", buf);
-    if (st->sample_aspect_ratio.num && // default
-        av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) {
-        AVRational display_aspect_ratio;
-        av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den,
-                  st->codec->width*st->sample_aspect_ratio.num,
-                  st->codec->height*st->sample_aspect_ratio.den,
-                  1024*1024);
-        av_log(NULL, AV_LOG_INFO, ", PAR %d:%d DAR %d:%d",
-                 st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
-                 display_aspect_ratio.num, display_aspect_ratio.den);
-    }
-    if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
-        if(st->avg_frame_rate.den && st->avg_frame_rate.num)
-            print_fps(av_q2d(st->avg_frame_rate), "fps");
-        if(st->r_frame_rate.den && st->r_frame_rate.num)
-            print_fps(av_q2d(st->r_frame_rate), "tbr");
-        if(st->time_base.den && st->time_base.num)
-            print_fps(1/av_q2d(st->time_base), "tbn");
-        if(st->codec->time_base.den && st->codec->time_base.num)
-            print_fps(1/av_q2d(st->codec->time_base), "tbc");
-    }
-    av_log(NULL, AV_LOG_INFO, "\n");
-    dump_metadata(NULL, st->metadata, "    ");
-}
-
-void dump_format(AVFormatContext *ic,
-                 int index,
-                 const char *url,
-                 int is_output)
-{
-    int i;
-    uint8_t *printed = av_mallocz(ic->nb_streams);
-    if (ic->nb_streams && !printed)
-        return;
-
-    av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n",
-            is_output ? "Output" : "Input",
-            index,
-            is_output ? ic->oformat->name : ic->iformat->name,
-            is_output ? "to" : "from", url);
-    dump_metadata(NULL, ic->metadata, "  ");
-    if (!is_output) {
-        av_log(NULL, AV_LOG_INFO, "  Duration: ");
-        if (ic->duration != AV_NOPTS_VALUE) {
-            int hours, mins, secs, us;
-            secs = ic->duration / AV_TIME_BASE;
-            us = ic->duration % AV_TIME_BASE;
-            mins = secs / 60;
-            secs %= 60;
-            hours = mins / 60;
-            mins %= 60;
-            av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs,
-                   (100 * us) / AV_TIME_BASE);
-        } else {
-            av_log(NULL, AV_LOG_INFO, "N/A");
-        }
-        if (ic->start_time != AV_NOPTS_VALUE) {
-            int secs, us;
-            av_log(NULL, AV_LOG_INFO, ", start: ");
-            secs = ic->start_time / AV_TIME_BASE;
-            us = ic->start_time % AV_TIME_BASE;
-            av_log(NULL, AV_LOG_INFO, "%d.%06d",
-                   secs, (int)av_rescale(us, 1000000, AV_TIME_BASE));
-        }
-        av_log(NULL, AV_LOG_INFO, ", bitrate: ");
-        if (ic->bit_rate) {
-            av_log(NULL, AV_LOG_INFO,"%d kb/s", ic->bit_rate / 1000);
-        } else {
-            av_log(NULL, AV_LOG_INFO, "N/A");
-        }
-        av_log(NULL, AV_LOG_INFO, "\n");
-    }
-    for (i = 0; i < ic->nb_chapters; i++) {
-        AVChapter *ch = ic->chapters[i];
-        av_log(NULL, AV_LOG_INFO, "    Chapter #%d.%d: ", index, i);
-        av_log(NULL, AV_LOG_INFO, "start %f, ", ch->start * av_q2d(ch->time_base));
-        av_log(NULL, AV_LOG_INFO, "end %f\n",   ch->end   * av_q2d(ch->time_base));
-
-        dump_metadata(NULL, ch->metadata, "    ");
-    }
-    if(ic->nb_programs) {
-        int j, k, total = 0;
-        for(j=0; j<ic->nb_programs; j++) {
-            AVMetadataTag *name = av_metadata_get(ic->programs[j]->metadata,
-                                                  "name", NULL, 0);
-            av_log(NULL, AV_LOG_INFO, "  Program %d %s\n", ic->programs[j]->id,
-                   name ? name->value : "");
-            dump_metadata(NULL, ic->programs[j]->metadata, "    ");
-            for(k=0; k<ic->programs[j]->nb_stream_indexes; k++) {
-                dump_stream_format(ic, ic->programs[j]->stream_index[k], index, is_output);
-                printed[ic->programs[j]->stream_index[k]] = 1;
-            }
-            total += ic->programs[j]->nb_stream_indexes;
-        }
-        if (total < ic->nb_streams)
-            av_log(NULL, AV_LOG_INFO, "  No Program\n");
-    }
-    for(i=0;i<ic->nb_streams;i++)
-        if (!printed[i])
-            dump_stream_format(ic, i, index, is_output);
-
-    av_free(printed);
-}
-
-#if LIBAVFORMAT_VERSION_MAJOR < 53
-int parse_image_size(int *width_ptr, int *height_ptr, const char *str)
-{
-    return av_parse_video_frame_size(width_ptr, height_ptr, str);
-}
-
-int parse_frame_rate(int *frame_rate_num, int *frame_rate_den, const char *arg)
-{
-    AVRational frame_rate;
-    int ret = av_parse_video_frame_rate(&frame_rate, arg);
-    *frame_rate_num= frame_rate.num;
-    *frame_rate_den= frame_rate.den;
-    return ret;
-}
-#endif
-
-int64_t av_gettime(void)
-{
-    struct timeval tv;
-    gettimeofday(&tv,NULL);
-    return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-uint64_t ff_ntp_time(void)
-{
-  return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;
-}
-
-int64_t parse_date(const char *datestr, int duration)
-{
-    const char *p;
-    int64_t t;
-    struct tm dt;
-    int i;
-    static const char * const date_fmt[] = {
-        "%Y-%m-%d",
-        "%Y%m%d",
-    };
-    static const char * const time_fmt[] = {
-        "%H:%M:%S",
-        "%H%M%S",
-    };
-    const char *q;
-    int is_utc, len;
-    char lastch;
-    int negative = 0;
-
-#undef time
-    time_t now = time(0);
-
-    len = strlen(datestr);
-    if (len > 0)
-        lastch = datestr[len - 1];
-    else
-        lastch = '\0';
-    is_utc = (lastch == 'z' || lastch == 'Z');
-
-    memset(&dt, 0, sizeof(dt));
-
-    p = datestr;
-    q = NULL;
-    if (!duration) {
-        if (!strncasecmp(datestr, "now", len))
-            return (int64_t) now * 1000000;
-
-        /* parse the year-month-day part */
-        for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) {
-            q = small_strptime(p, date_fmt[i], &dt);
-            if (q) {
-                break;
-            }
-        }
-
-        /* if the year-month-day part is missing, then take the
-         * current year-month-day time */
-        if (!q) {
-            if (is_utc) {
-                dt = *gmtime(&now);
-            } else {
-                dt = *localtime(&now);
-            }
-            dt.tm_hour = dt.tm_min = dt.tm_sec = 0;
-        } else {
-            p = q;
-        }
-
-        if (*p == 'T' || *p == 't' || *p == ' ')
-            p++;
-
-        /* parse the hour-minute-second part */
-        for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) {
-            q = small_strptime(p, time_fmt[i], &dt);
-            if (q) {
-                break;
-            }
-        }
-    } else {
-        /* parse datestr as a duration */
-        if (p[0] == '-') {
-            negative = 1;
-            ++p;
-        }
-        /* parse datestr as HH:MM:SS */
-        q = small_strptime(p, time_fmt[0], &dt);
-        if (!q) {
-            /* parse datestr as S+ */
-            dt.tm_sec = strtol(p, (char **)&q, 10);
-            if (q == p)
-                /* the parsing didn't succeed */
-                return INT64_MIN;
-            dt.tm_min = 0;
-            dt.tm_hour = 0;
-        }
-    }
-
-    /* Now we have all the fields that we can get */
-    if (!q) {
-        return INT64_MIN;
-    }
-
-    if (duration) {
-        t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec;
-    } else {
-        dt.tm_isdst = -1;       /* unknown */
-        if (is_utc) {
-            t = mktimegm(&dt);
-        } else {
-            t = mktime(&dt);
-        }
-    }
-
-    t *= 1000000;
-
-    /* parse the .m... part */
-    if (*q == '.') {
-        int val, n;
-        q++;
-        for (val = 0, n = 100000; n >= 1; n /= 10, q++) {
-            if (!isdigit(*q))
-                break;
-            val += n * (*q - '0');
-        }
-        t += val;
-    }
-    return negative ? -t : t;
-}
-
-int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
-{
-    const char *p;
-    char tag[128], *q;
-
-    p = info;
-    if (*p == '?')
-        p++;
-    for(;;) {
-        q = tag;
-        while (*p != '\0' && *p != '=' && *p != '&') {
-            if ((q - tag) < sizeof(tag) - 1)
-                *q++ = *p;
-            p++;
-        }
-        *q = '\0';
-        q = arg;
-        if (*p == '=') {
-            p++;
-            while (*p != '&' && *p != '\0') {
-                if ((q - arg) < arg_size - 1) {
-                    if (*p == '+')
-                        *q++ = ' ';
-                    else
-                        *q++ = *p;
-                }
-                p++;
-            }
-            *q = '\0';
-        }
-        if (!strcmp(tag, tag1))
-            return 1;
-        if (*p != '&')
-            break;
-        p++;
-    }
-    return 0;
-}
-
-int av_get_frame_filename(char *buf, int buf_size,
-                          const char *path, int number)
-{
-    const char *p;
-    char *q, buf1[20], c;
-    int nd, len, percentd_found;
-
-    q = buf;
-    p = path;
-    percentd_found = 0;
-    for(;;) {
-        c = *p++;
-        if (c == '\0')
-            break;
-        if (c == '%') {
-            do {
-                nd = 0;
-                while (isdigit(*p)) {
-                    nd = nd * 10 + *p++ - '0';
-                }
-                c = *p++;
-            } while (isdigit(c));
-
-            switch(c) {
-            case '%':
-                goto addchar;
-            case 'd':
-                if (percentd_found)
-                    goto fail;
-                percentd_found = 1;
-                snprintf(buf1, sizeof(buf1), "%0*d", nd, number);
-                len = strlen(buf1);
-                if ((q - buf + len) > buf_size - 1)
-                    goto fail;
-                memcpy(q, buf1, len);
-                q += len;
-                break;
-            default:
-                goto fail;
-            }
-        } else {
-        addchar:
-            if ((q - buf) < buf_size - 1)
-                *q++ = c;
-        }
-    }
-    if (!percentd_found)
-        goto fail;
-    *q = '\0';
-    return 0;
- fail:
-    *q = '\0';
-    return -1;
-}
-
-static void hex_dump_internal(void *avcl, FILE *f, int level, uint8_t *buf, int size)
-{
-    int len, i, j, c;
-#undef fprintf
-#define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
-
-    for(i=0;i<size;i+=16) {
-        len = size - i;
-        if (len > 16)
-            len = 16;
-        PRINT("%08x ", i);
-        for(j=0;j<16;j++) {
-            if (j < len)
-                PRINT(" %02x", buf[i+j]);
-            else
-                PRINT("   ");
-        }
-        PRINT(" ");
-        for(j=0;j<len;j++) {
-            c = buf[i+j];
-            if (c < ' ' || c > '~')
-                c = '.';
-            PRINT("%c", c);
-        }
-        PRINT("\n");
-    }
-#undef PRINT
-}
-
-void av_hex_dump(FILE *f, uint8_t *buf, int size)
-{
-    hex_dump_internal(NULL, f, 0, buf, size);
-}
-
-void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size)
-{
-    hex_dump_internal(avcl, NULL, level, buf, size);
-}
-
- //FIXME needs to know the time_base
-static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, int dump_payload)
-{
-#undef fprintf
-#define PRINT(...) do { if (!f) av_log(avcl, level, __VA_ARGS__); else fprintf(f, __VA_ARGS__); } while(0)
-    PRINT("stream #%d:\n", pkt->stream_index);
-    PRINT("  keyframe=%d\n", ((pkt->flags & AV_PKT_FLAG_KEY) != 0));
-    PRINT("  duration=%0.3f\n", (double)pkt->duration / AV_TIME_BASE);
-    /* DTS is _always_ valid after av_read_frame() */
-    PRINT("  dts=");
-    if (pkt->dts == AV_NOPTS_VALUE)
-        PRINT("N/A");
-    else
-        PRINT("%0.3f", (double)pkt->dts / AV_TIME_BASE);
-    /* PTS may not be known if B-frames are present. */
-    PRINT("  pts=");
-    if (pkt->pts == AV_NOPTS_VALUE)
-        PRINT("N/A");
-    else
-        PRINT("%0.3f", (double)pkt->pts / AV_TIME_BASE);
-    PRINT("\n");
-    PRINT("  size=%d\n", pkt->size);
-#undef PRINT
-    if (dump_payload)
-        av_hex_dump(f, pkt->data, pkt->size);
-}
-
-void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload)
-{
-    pkt_dump_internal(NULL, f, 0, pkt, dump_payload);
-}
-
-void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload)
-{
-    pkt_dump_internal(avcl, NULL, level, pkt, dump_payload);
-}
-
-void ff_url_split(char *proto, int proto_size,
-                  char *authorization, int authorization_size,
-                  char *hostname, int hostname_size,
-                  int *port_ptr,
-                  char *path, int path_size,
-                  const char *url)
-{
-    const char *p, *ls, *at, *col, *brk;
-
-    if (port_ptr)               *port_ptr = -1;
-    if (proto_size > 0)         proto[0] = 0;
-    if (authorization_size > 0) authorization[0] = 0;
-    if (hostname_size > 0)      hostname[0] = 0;
-    if (path_size > 0)          path[0] = 0;
-
-    /* parse protocol */
-    if ((p = strchr(url, ':'))) {
-        av_strlcpy(proto, url, FFMIN(proto_size, p + 1 - url));
-        p++; /* skip ':' */
-        if (*p == '/') p++;
-        if (*p == '/') p++;
-    } else {
-        /* no protocol means plain filename */
-        av_strlcpy(path, url, path_size);
-        return;
-    }
-
-    /* separate path from hostname */
-    ls = strchr(p, '/');
-    if(!ls)
-        ls = strchr(p, '?');
-    if(ls)
-        av_strlcpy(path, ls, path_size);
-    else
-        ls = &p[strlen(p)]; // XXX
-
-    /* the rest is hostname, use that to parse auth/port */
-    if (ls != p) {
-        /* authorization (user[:pass]@hostname) */
-        if ((at = strchr(p, '@')) && at < ls) {
-            av_strlcpy(authorization, p,
-                       FFMIN(authorization_size, at + 1 - p));
-            p = at + 1; /* skip '@' */
-        }
-
-        if (*p == '[' && (brk = strchr(p, ']')) && brk < ls) {
-            /* [host]:port */
-            av_strlcpy(hostname, p + 1,
-                       FFMIN(hostname_size, brk - p));
-            if (brk[1] == ':' && port_ptr)
-                *port_ptr = atoi(brk + 2);
-        } else if ((col = strchr(p, ':')) && col < ls) {
-            av_strlcpy(hostname, p,
-                       FFMIN(col + 1 - p, hostname_size));
-            if (port_ptr) *port_ptr = atoi(col + 1);
-        } else
-            av_strlcpy(hostname, p,
-                       FFMIN(ls + 1 - p, hostname_size));
-    }
-}
-
-char *ff_data_to_hex(char *buff, const uint8_t *src, int s, int lowercase)
-{
-    int i;
-    static const char hex_table_uc[16] = { '0', '1', '2', '3',
-                                           '4', '5', '6', '7',
-                                           '8', '9', 'A', 'B',
-                                           'C', 'D', 'E', 'F' };
-    static const char hex_table_lc[16] = { '0', '1', '2', '3',
-                                           '4', '5', '6', '7',
-                                           '8', '9', 'a', 'b',
-                                           'c', 'd', 'e', 'f' };
-    const char *hex_table = lowercase ? hex_table_lc : hex_table_uc;
-
-    for(i = 0; i < s; i++) {
-        buff[i * 2]     = hex_table[src[i] >> 4];
-        buff[i * 2 + 1] = hex_table[src[i] & 0xF];
-    }
-
-    return buff;
-}
-
-void av_set_pts_info(AVStream *s, int pts_wrap_bits,
-                     unsigned int pts_num, unsigned int pts_den)
-{
-    s->pts_wrap_bits = pts_wrap_bits;
-
-    if(av_reduce(&s->time_base.num, &s->time_base.den, pts_num, pts_den, INT_MAX)){
-        if(s->time_base.num != pts_num)
-            av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, pts_num/s->time_base.num);
-    }else
-        av_log(NULL, AV_LOG_WARNING, "st:%d has too large timebase, reducing\n", s->index);
-
-    if(!s->time_base.num || !s->time_base.den)
-        s->time_base.num= s->time_base.den= 0;
-}
-
-int ff_url_join(char *str, int size, const char *proto,
-                const char *authorization, const char *hostname,
-                int port, const char *fmt, ...)
-{
-#if CONFIG_NETWORK
-    struct addrinfo hints, *ai;
-#endif
-
-    str[0] = '\0';
-    if (proto)
-        av_strlcatf(str, size, "%s://", proto);
-    if (authorization)
-        av_strlcatf(str, size, "%s@", authorization);
-#if CONFIG_NETWORK && defined(AF_INET6)
-    /* Determine if hostname is a numerical IPv6 address,
-     * properly escape it within [] in that case. */
-    memset(&hints, 0, sizeof(hints));
-    hints.ai_flags = AI_NUMERICHOST;
-    if (!getaddrinfo(hostname, NULL, &hints, &ai)) {
-        if (ai->ai_family == AF_INET6) {
-            av_strlcat(str, "[", size);
-            av_strlcat(str, hostname, size);
-            av_strlcat(str, "]", size);
-        } else {
-            av_strlcat(str, hostname, size);
-        }
-        freeaddrinfo(ai);
-    } else
-#endif
-        /* Not an IPv6 address, just output the plain string. */
-        av_strlcat(str, hostname, size);
-
-    if (port >= 0)
-        av_strlcatf(str, size, ":%d", port);
-    if (fmt) {
-        va_list vl;
-        int len = strlen(str);
-
-        va_start(vl, fmt);
-        vsnprintf(str + len, size > len ? size - len : 0, fmt, vl);
-        va_end(vl);
-    }
-    return strlen(str);
-}
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
deleted file mode 100644
index 7a006f2..0000000
--- a/libavformat/vc1test.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * VC1 Test Bitstreams Format Demuxer
- * Copyright (c) 2006, 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * VC1 test bitstream file demuxer
- * by Konstantin Shishkov
- * Format specified in SMPTE standard 421 Annex L
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define VC1_EXTRADATA_SIZE 4
-
-static int vc1t_probe(AVProbeData *p)
-{
-    if (p->buf_size < 24)
-        return 0;
-    if (p->buf[3] != 0xC5 || AV_RL32(&p->buf[4]) != 4 || AV_RL32(&p->buf[20]) != 0xC)
-        return 0;
-
-    return AVPROBE_SCORE_MAX/2;
-}
-
-static int vc1t_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    int frames;
-    uint32_t fps;
-
-    frames = get_le24(pb);
-    if(get_byte(pb) != 0xC5 || get_le32(pb) != 4)
-        return -1;
-
-    /* init video codec */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_WMV3;
-
-    st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
-    st->codec->extradata_size = VC1_EXTRADATA_SIZE;
-    get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
-    st->codec->height = get_le32(pb);
-    st->codec->width = get_le32(pb);
-    if(get_le32(pb) != 0xC)
-        return -1;
-    url_fskip(pb, 8);
-    fps = get_le32(pb);
-    if(fps == 0xFFFFFFFF)
-        av_set_pts_info(st, 32, 1, 1000);
-    else{
-        if (!fps) {
-            av_log(s, AV_LOG_ERROR, "Zero FPS specified, defaulting to 1 FPS\n");
-            fps = 1;
-        }
-        av_set_pts_info(st, 24, 1, fps);
-        st->duration = frames;
-    }
-
-    return 0;
-}
-
-static int vc1t_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    ByteIOContext *pb = s->pb;
-    int frame_size;
-    int keyframe = 0;
-    uint32_t pts;
-
-    if(url_feof(pb))
-        return AVERROR(EIO);
-
-    frame_size = get_le24(pb);
-    if(get_byte(pb) & 0x80)
-        keyframe = 1;
-    pts = get_le32(pb);
-    if(av_get_packet(pb, pkt, frame_size) < 0)
-        return AVERROR(EIO);
-    if(s->streams[0]->time_base.den == 1000)
-        pkt->pts = pts;
-    pkt->flags |= keyframe ? AV_PKT_FLAG_KEY : 0;
-    pkt->pos -= 8;
-
-    return pkt->size;
-}
-
-AVInputFormat vc1t_demuxer = {
-    "vc1test",
-    NULL_IF_CONFIG_SMALL("VC-1 test bitstream format"),
-    0,
-    vc1t_probe,
-    vc1t_read_header,
-    vc1t_read_packet,
-    .flags = AVFMT_GENERIC_INDEX,
-};
diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c
deleted file mode 100644
index b4b1e02..0000000
--- a/libavformat/vc1testenc.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * VC-1 test bitstreams format muxer.
- * Copyright (c) 2008 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-
-typedef struct RCVContext {
-    int frames;
-} RCVContext;
-
-static int vc1test_write_header(AVFormatContext *s)
-{
-    AVCodecContext *avc = s->streams[0]->codec;
-    ByteIOContext *pb = s->pb;
-
-    if (avc->codec_id != CODEC_ID_WMV3) {
-        av_log(s, AV_LOG_ERROR, "Only WMV3 is accepted!\n");
-        return -1;
-    }
-    put_le24(pb, 0); //frames count will be here
-    put_byte(pb, 0xC5);
-    put_le32(pb, 4);
-    put_buffer(pb, avc->extradata, 4);
-    put_le32(pb, avc->height);
-    put_le32(pb, avc->width);
-    put_le32(pb, 0xC);
-    put_le24(pb, 0); // hrd_buffer
-    put_byte(pb, 0x80); // level|cbr|res1
-    put_le32(pb, 0); // hrd_rate
-    if (s->streams[0]->r_frame_rate.den && s->streams[0]->r_frame_rate.num == 1)
-        put_le32(pb, s->streams[0]->r_frame_rate.den);
-    else
-        put_le32(pb, 0xFFFFFFFF); //variable framerate
-
-    return 0;
-}
-
-static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    RCVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    if (!pkt->size)
-        return 0;
-    put_le32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0));
-    put_le32(pb, pkt->pts);
-    put_buffer(pb, pkt->data, pkt->size);
-    put_flush_packet(pb);
-    ctx->frames++;
-
-    return 0;
-}
-
-static int vc1test_write_trailer(AVFormatContext *s)
-{
-    RCVContext *ctx = s->priv_data;
-    ByteIOContext *pb = s->pb;
-
-    if (!url_is_streamed(s->pb)) {
-        url_fseek(pb, 0, SEEK_SET);
-        put_le24(pb, ctx->frames);
-        put_flush_packet(pb);
-    }
-    return 0;
-}
-
-AVOutputFormat vc1t_muxer = {
-    "rcv",
-    NULL_IF_CONFIG_SMALL("VC-1 test bitstream"),
-    "",
-    "rcv",
-    sizeof(RCVContext),
-    CODEC_ID_NONE,
-    CODEC_ID_WMV3,
-    vc1test_write_header,
-    vc1test_write_packet,
-    vc1test_write_trailer,
-};
diff --git a/libavformat/voc.c b/libavformat/voc.c
deleted file mode 100644
index eed8db8..0000000
--- a/libavformat/voc.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Creative Voice File common data.
- * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "voc.h"
-
-const unsigned char ff_voc_magic[21] = "Creative Voice File\x1A";
-
-const AVCodecTag ff_voc_codec_tags[] = {
-    {CODEC_ID_PCM_U8,        0x00},
-    {CODEC_ID_ADPCM_SBPRO_4, 0x01},
-    {CODEC_ID_ADPCM_SBPRO_3, 0x02},
-    {CODEC_ID_ADPCM_SBPRO_2, 0x03},
-    {CODEC_ID_PCM_S16LE,     0x04},
-    {CODEC_ID_PCM_ALAW,      0x06},
-    {CODEC_ID_PCM_MULAW,     0x07},
-    {CODEC_ID_ADPCM_CT,    0x0200},
-    {CODEC_ID_NONE,             0},
-};
diff --git a/libavformat/voc.h b/libavformat/voc.h
deleted file mode 100644
index 3f995ad..0000000
--- a/libavformat/voc.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Creative Voice File demuxer.
- * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_VOC_H
-#define AVFORMAT_VOC_H
-
-#include "avformat.h"
-#include "riff.h"    /* for CodecTag */
-
-typedef struct voc_dec_context {
-    int64_t remaining_size;
-} VocDecContext;
-
-typedef enum voc_type {
-    VOC_TYPE_EOF              = 0x00,
-    VOC_TYPE_VOICE_DATA       = 0x01,
-    VOC_TYPE_VOICE_DATA_CONT  = 0x02,
-    VOC_TYPE_SILENCE          = 0x03,
-    VOC_TYPE_MARKER           = 0x04,
-    VOC_TYPE_ASCII            = 0x05,
-    VOC_TYPE_REPETITION_START = 0x06,
-    VOC_TYPE_REPETITION_END   = 0x07,
-    VOC_TYPE_EXTENDED         = 0x08,
-    VOC_TYPE_NEW_VOICE_DATA   = 0x09,
-} VocType;
-
-extern const unsigned char ff_voc_magic[21];
-extern const AVCodecTag ff_voc_codec_tags[];
-
-int voc_get_packet(AVFormatContext *s, AVPacket *pkt,
-                   AVStream *st, int max_size);
-
-#endif /* AVFORMAT_VOC_H */
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
deleted file mode 100644
index 13d48f7..0000000
--- a/libavformat/vocdec.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Creative Voice File demuxer.
- * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "voc.h"
-
-
-static int voc_probe(AVProbeData *p)
-{
-    int version, check;
-
-    if (memcmp(p->buf, ff_voc_magic, sizeof(ff_voc_magic) - 1))
-        return 0;
-    version = AV_RL16(p->buf + 22);
-    check = AV_RL16(p->buf + 24);
-    if (~version + 0x1234 != check)
-        return 10;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    VocDecContext *voc = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int header_size;
-    AVStream *st;
-
-    url_fskip(pb, 20);
-    header_size = get_le16(pb) - 22;
-    if (header_size != 4) {
-        av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size);
-        return AVERROR(ENOSYS);
-    }
-    url_fskip(pb, header_size);
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-
-    voc->remaining_size = 0;
-    return 0;
-}
-
-int
-voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
-{
-    VocDecContext *voc = s->priv_data;
-    AVCodecContext *dec = st->codec;
-    ByteIOContext *pb = s->pb;
-    VocType type;
-    int size;
-    int sample_rate = 0;
-    int channels = 1;
-
-    while (!voc->remaining_size) {
-        type = get_byte(pb);
-        if (type == VOC_TYPE_EOF)
-            return AVERROR(EIO);
-        voc->remaining_size = get_le24(pb);
-        if (!voc->remaining_size) {
-            if (url_is_streamed(s->pb))
-                return AVERROR(EIO);
-            voc->remaining_size = url_fsize(pb) - url_ftell(pb);
-        }
-        max_size -= 4;
-
-        switch (type) {
-        case VOC_TYPE_VOICE_DATA:
-            dec->sample_rate = 1000000 / (256 - get_byte(pb));
-            if (sample_rate)
-                dec->sample_rate = sample_rate;
-            dec->channels = channels;
-            dec->codec_id = ff_codec_get_id(ff_voc_codec_tags, get_byte(pb));
-            dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);
-            voc->remaining_size -= 2;
-            max_size -= 2;
-            channels = 1;
-            break;
-
-        case VOC_TYPE_VOICE_DATA_CONT:
-            break;
-
-        case VOC_TYPE_EXTENDED:
-            sample_rate = get_le16(pb);
-            get_byte(pb);
-            channels = get_byte(pb) + 1;
-            sample_rate = 256000000 / (channels * (65536 - sample_rate));
-            voc->remaining_size = 0;
-            max_size -= 4;
-            break;
-
-        case VOC_TYPE_NEW_VOICE_DATA:
-            dec->sample_rate = get_le32(pb);
-            dec->bits_per_coded_sample = get_byte(pb);
-            dec->channels = get_byte(pb);
-            dec->codec_id = ff_codec_get_id(ff_voc_codec_tags, get_le16(pb));
-            url_fskip(pb, 4);
-            voc->remaining_size -= 12;
-            max_size -= 12;
-            break;
-
-        default:
-            url_fskip(pb, voc->remaining_size);
-            max_size -= voc->remaining_size;
-            voc->remaining_size = 0;
-            break;
-        }
-    }
-
-    dec->bit_rate = dec->sample_rate * dec->bits_per_coded_sample;
-
-    if (max_size <= 0)
-        max_size = 2048;
-    size = FFMIN(voc->remaining_size, max_size);
-    voc->remaining_size -= size;
-    return av_get_packet(pb, pkt, size);
-}
-
-static int voc_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    return voc_get_packet(s, pkt, s->streams[0], 0);
-}
-
-AVInputFormat voc_demuxer = {
-    "voc",
-    NULL_IF_CONFIG_SMALL("Creative Voice file format"),
-    sizeof(VocDecContext),
-    voc_probe,
-    voc_read_header,
-    voc_read_packet,
-    .codec_tag=(const AVCodecTag* const []){ff_voc_codec_tags, 0},
-};
diff --git a/libavformat/vocenc.c b/libavformat/vocenc.c
deleted file mode 100644
index f127c7e..0000000
--- a/libavformat/vocenc.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Creative Voice File muxer.
- * Copyright (c) 2006  Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "voc.h"
-
-
-typedef struct voc_enc_context {
-    int param_written;
-} VocEncContext;
-
-static int voc_write_header(AVFormatContext *s)
-{
-    ByteIOContext *pb = s->pb;
-    const int header_size = 26;
-    const int version = 0x0114;
-
-    if (s->nb_streams != 1
-        || s->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
-        return AVERROR_PATCHWELCOME;
-
-    put_buffer(pb, ff_voc_magic, sizeof(ff_voc_magic) - 1);
-    put_le16(pb, header_size);
-    put_le16(pb, version);
-    put_le16(pb, ~version + 0x1234);
-
-    return 0;
-}
-
-static int voc_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    VocEncContext *voc = s->priv_data;
-    AVCodecContext *enc = s->streams[0]->codec;
-    ByteIOContext *pb = s->pb;
-
-    if (!voc->param_written) {
-        if (enc->codec_tag > 0xFF) {
-            put_byte(pb, VOC_TYPE_NEW_VOICE_DATA);
-            put_le24(pb, pkt->size + 12);
-            put_le32(pb, enc->sample_rate);
-            put_byte(pb, enc->bits_per_coded_sample);
-            put_byte(pb, enc->channels);
-            put_le16(pb, enc->codec_tag);
-            put_le32(pb, 0);
-        } else {
-            if (s->streams[0]->codec->channels > 1) {
-                put_byte(pb, VOC_TYPE_EXTENDED);
-                put_le24(pb, 4);
-                put_le16(pb, 65536-256000000/(enc->sample_rate*enc->channels));
-                put_byte(pb, enc->codec_tag);
-                put_byte(pb, enc->channels - 1);
-            }
-            put_byte(pb, VOC_TYPE_VOICE_DATA);
-            put_le24(pb, pkt->size + 2);
-            put_byte(pb, 256 - 1000000 / enc->sample_rate);
-            put_byte(pb, enc->codec_tag);
-        }
-        voc->param_written = 1;
-    } else {
-        put_byte(pb, VOC_TYPE_VOICE_DATA_CONT);
-        put_le24(pb, pkt->size);
-    }
-
-    put_buffer(pb, pkt->data, pkt->size);
-    return 0;
-}
-
-static int voc_write_trailer(AVFormatContext *s)
-{
-    put_byte(s->pb, 0);
-    return 0;
-}
-
-AVOutputFormat voc_muxer = {
-    "voc",
-    NULL_IF_CONFIG_SMALL("Creative Voice file format"),
-    "audio/x-voc",
-    "voc",
-    sizeof(VocEncContext),
-    CODEC_ID_PCM_U8,
-    CODEC_ID_NONE,
-    voc_write_header,
-    voc_write_packet,
-    voc_write_trailer,
-    .codec_tag=(const AVCodecTag* const []){ff_voc_codec_tags, 0},
-};
diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
deleted file mode 100644
index d23c66d..0000000
--- a/libavformat/vorbiscomment.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * VorbisComment writer
- * Copyright (c) 2009 James Darnley
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "metadata.h"
-#include "vorbiscomment.h"
-#include "libavcodec/bytestream.h"
-
-/**
- * VorbisComment metadata conversion mapping.
- * from Ogg Vorbis I format specification: comment field and header specification
- * http://xiph.org/vorbis/doc/v-comment.html
- */
-const AVMetadataConv ff_vorbiscomment_metadata_conv[] = {
-    { "ALBUMARTIST", "album_artist"},
-    { "TRACKNUMBER", "track"  },
-    { 0 }
-};
-
-int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string,
-                            unsigned *count)
-{
-    int len = 8;
-    len += strlen(vendor_string);
-    *count = 0;
-    if (m) {
-        AVMetadataTag *tag = NULL;
-        while ( (tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX) ) ) {
-            len += 4 +strlen(tag->key) + 1 + strlen(tag->value);
-            (*count)++;
-        }
-    }
-    return len;
-}
-
-int ff_vorbiscomment_write(uint8_t **p, AVMetadata *m,
-                           const char *vendor_string, const unsigned count)
-{
-    bytestream_put_le32(p, strlen(vendor_string));
-    bytestream_put_buffer(p, vendor_string, strlen(vendor_string));
-    if (m) {
-        AVMetadataTag *tag = NULL;
-        bytestream_put_le32(p, count);
-        while ( (tag = av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX) ) ) {
-            unsigned int len1 = strlen(tag->key);
-            unsigned int len2 = strlen(tag->value);
-            bytestream_put_le32(p, len1+1+len2);
-            bytestream_put_buffer(p, tag->key, len1);
-            bytestream_put_byte(p, '=');
-            bytestream_put_buffer(p, tag->value, len2);
-        }
-    } else
-        bytestream_put_le32(p, 0);
-    return 0;
-}
diff --git a/libavformat/vorbiscomment.h b/libavformat/vorbiscomment.h
deleted file mode 100644
index 714f1f2..0000000
--- a/libavformat/vorbiscomment.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * VorbisComment writer
- * Copyright (c) 2009 James Darnley
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVFORMAT_VORBISCOMMENT_H
-#define AVFORMAT_VORBISCOMMENT_H
-
-#include "avformat.h"
-#include "metadata.h"
-
-/**
- * Calculates the length in bytes of a VorbisComment. This is the minimum
- * size required by ff_vorbiscomment_write().
- *
- * @param m The metadata structure to be parsed. For no metadata, set to NULL.
- * @param vendor_string The vendor string to be added into the VorbisComment.
- * For no string, set to an empty string.
- * @param count Pointer to store the number of tags in m because m->count is "not allowed"
- * @return The length in bytes.
- */
-int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string,
-                            unsigned *count);
-
-/**
- * Writes a VorbisComment into a buffer. The buffer, p, must have enough
- * data to hold the whole VorbisComment. The minimum size required can be
- * obtained by passing the same AVMetadata and vendor_string to
- * ff_vorbiscomment_length()
- *
- * @param p The buffer in which to write.
- * @param m The metadata struct to write.
- * @param vendor_string The vendor string to write.
- * @param count The number of tags in m because m->count is "not allowed"
- */
-int ff_vorbiscomment_write(uint8_t **p, AVMetadata *m,
-                           const char *vendor_string, const unsigned count);
-
-extern const AVMetadataConv ff_vorbiscomment_metadata_conv[];
-
-#endif /* AVFORMAT_VORBISCOMMENT_H */
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
deleted file mode 100644
index b0ec020..0000000
--- a/libavformat/vqf.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * VQF demuxer
- * Copyright (c) 2009 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "libavutil/intreadwrite.h"
-
-typedef struct VqfContext {
-    int frame_bit_len;
-    uint8_t last_frame_bits;
-    int remaining_bits;
-} VqfContext;
-
-static int vqf_probe(AVProbeData *probe_packet)
-{
-    if (AV_RL32(probe_packet->buf) != MKTAG('T','W','I','N'))
-        return 0;
-
-    if (!memcmp(probe_packet->buf + 4, "97012000", 8))
-        return AVPROBE_SCORE_MAX;
-
-    if (!memcmp(probe_packet->buf + 4, "00052200", 8))
-        return AVPROBE_SCORE_MAX;
-
-    return AVPROBE_SCORE_MAX/2;
-}
-
-static void add_metadata(AVFormatContext *s, const char *tag,
-                         unsigned int tag_len, unsigned int remaining)
-{
-    int len = FFMIN(tag_len, remaining);
-    char *buf;
-
-    if (len == UINT_MAX)
-        return;
-
-    buf = av_malloc(len+1);
-    if (!buf)
-        return;
-    get_buffer(s->pb, buf, len);
-    buf[len] = 0;
-    av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL);
-}
-
-static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    VqfContext *c = s->priv_data;
-    AVStream *st  = av_new_stream(s, 0);
-    int chunk_tag;
-    int rate_flag = -1;
-    int header_size;
-    int read_bitrate = 0;
-    int size;
-
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    url_fskip(s->pb, 12);
-
-    header_size = get_be32(s->pb);
-
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id   = CODEC_ID_TWINVQ;
-    st->start_time = 0;
-
-    do {
-        int len;
-        chunk_tag = get_le32(s->pb);
-
-        if (chunk_tag == MKTAG('D','A','T','A'))
-            break;
-
-        len = get_be32(s->pb);
-
-        if ((unsigned) len > INT_MAX/2) {
-            av_log(s, AV_LOG_ERROR, "Malformed header\n");
-            return -1;
-        }
-
-        header_size -= 8;
-
-        switch(chunk_tag){
-        case MKTAG('C','O','M','M'):
-            st->codec->channels = get_be32(s->pb) + 1;
-            read_bitrate        = get_be32(s->pb);
-            rate_flag           = get_be32(s->pb);
-            url_fskip(s->pb, len-12);
-
-            st->codec->bit_rate              = read_bitrate*1000;
-            st->codec->bits_per_coded_sample = 16;
-            break;
-        case MKTAG('N','A','M','E'):
-            add_metadata(s, "title"    , len, header_size);
-            break;
-        case MKTAG('(','c',')',' '):
-            add_metadata(s, "copyright", len, header_size);
-            break;
-        case MKTAG('A','U','T','H'):
-            add_metadata(s, "author"   , len, header_size);
-            break;
-        case MKTAG('A','L','B','M'):
-            add_metadata(s, "album"    , len, header_size);
-            break;
-        case MKTAG('T','R','C','K'):
-            add_metadata(s, "track"    , len, header_size);
-            break;
-        case MKTAG('C','O','M','T'):
-            add_metadata(s, "comment"  , len, header_size);
-            break;
-        case MKTAG('F','I','L','E'):
-            add_metadata(s, "filename" , len, header_size);
-            break;
-        case MKTAG('D','S','I','Z'):
-            add_metadata(s, "size"     , len, header_size);
-            break;
-        case MKTAG('D','A','T','E'):
-            add_metadata(s, "date"     , len, header_size);
-            break;
-        case MKTAG('G','E','N','R'):
-            add_metadata(s, "genre"    , len, header_size);
-            break;
-        default:
-            av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n",
-                   ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1],
-                   ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]);
-            url_fskip(s->pb, FFMIN(len, header_size));
-            break;
-        }
-
-        header_size -= len;
-
-    } while (header_size >= 0);
-
-    switch (rate_flag) {
-    case -1:
-        av_log(s, AV_LOG_ERROR, "COMM tag not found!\n");
-        return -1;
-    case 44:
-        st->codec->sample_rate = 44100;
-        break;
-    case 22:
-        st->codec->sample_rate = 22050;
-        break;
-    case 11:
-        st->codec->sample_rate = 11025;
-        break;
-    default:
-        st->codec->sample_rate = rate_flag*1000;
-        break;
-    }
-
-    switch (((st->codec->sample_rate/1000) << 8) +
-            read_bitrate/st->codec->channels) {
-    case (11<<8) + 8 :
-    case (8 <<8) + 8 :
-    case (11<<8) + 10:
-    case (22<<8) + 32:
-        size = 512;
-        break;
-    case (16<<8) + 16:
-    case (22<<8) + 20:
-    case (22<<8) + 24:
-        size = 1024;
-        break;
-    case (44<<8) + 40:
-    case (44<<8) + 48:
-        size = 2048;
-        break;
-    default:
-        av_log(s, AV_LOG_ERROR, "Mode not suported: %d Hz, %d kb/s.\n",
-               st->codec->sample_rate, st->codec->bit_rate);
-        return -1;
-    }
-    c->frame_bit_len = st->codec->bit_rate*size/st->codec->sample_rate;
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-    return 0;
-}
-
-static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    VqfContext *c = s->priv_data;
-    int ret;
-    int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;
-
-    pkt->pos          = url_ftell(s->pb);
-    pkt->stream_index = 0;
-
-    if (av_new_packet(pkt, size+2) < 0)
-        return AVERROR(EIO);
-
-    pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip
-    pkt->data[1] = c->last_frame_bits;
-    ret = get_buffer(s->pb, pkt->data+2, size);
-
-    if (ret<=0) {
-        av_free_packet(pkt);
-        return AVERROR(EIO);
-    }
-
-    c->last_frame_bits = pkt->data[size+1];
-    c->remaining_bits  = (size << 3) - c->frame_bit_len + c->remaining_bits;
-
-    return size+2;
-}
-
-static int vqf_read_seek(AVFormatContext *s,
-                         int stream_index, int64_t timestamp, int flags)
-{
-    VqfContext *c = s->priv_data;
-    AVStream *st;
-    int ret;
-    int64_t pos;
-
-    st = s->streams[stream_index];
-    pos = av_rescale_rnd(timestamp * st->codec->bit_rate,
-                         st->time_base.num,
-                         st->time_base.den * (int64_t)c->frame_bit_len,
-                         (flags & AVSEEK_FLAG_BACKWARD) ?
-                                                   AV_ROUND_DOWN : AV_ROUND_UP);
-    pos *= c->frame_bit_len;
-
-    st->cur_dts = av_rescale(pos, st->time_base.den,
-                             st->codec->bit_rate * (int64_t)st->time_base.num);
-
-    if ((ret = url_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
-        return ret;
-
-    c->remaining_bits = -7 - ((pos-7)&7);
-    return 0;
-}
-
-AVInputFormat vqf_demuxer = {
-    "vqf",
-    NULL_IF_CONFIG_SMALL("Nippon Telegraph and Telephone Corporation (NTT) TwinVQ"),
-    sizeof(VqfContext),
-    vqf_probe,
-    vqf_read_header,
-    vqf_read_packet,
-    NULL,
-    vqf_read_seek,
-    .extensions = "vqf",
-};
diff --git a/libavformat/wav.c b/libavformat/wav.c
deleted file mode 100644
index da08558..0000000
--- a/libavformat/wav.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * WAV muxer and demuxer
- * Copyright (c) 2001, 2002 Fabrice Bellard
- *
- * Sony Wave64 demuxer
- * RF64 demuxer
- * Copyright (c) 2009 Daniel Verkamp
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "raw.h"
-#include "riff.h"
-
-typedef struct {
-    int64_t data;
-    int64_t data_end;
-    int64_t minpts;
-    int64_t maxpts;
-    int last_duration;
-    int w64;
-} WAVContext;
-
-#if CONFIG_WAV_MUXER
-static int wav_write_header(AVFormatContext *s)
-{
-    WAVContext *wav = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int64_t fmt, fact;
-
-    put_tag(pb, "RIFF");
-    put_le32(pb, 0); /* file length */
-    put_tag(pb, "WAVE");
-
-    /* format header */
-    fmt = ff_start_tag(pb, "fmt ");
-    if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) {
-        av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n",
-               s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE");
-        av_free(wav);
-        return -1;
-    }
-    ff_end_tag(pb, fmt);
-
-    if (s->streams[0]->codec->codec_tag != 0x01 /* hence for all other than PCM */
-        && !url_is_streamed(s->pb)) {
-        fact = ff_start_tag(pb, "fact");
-        put_le32(pb, 0);
-        ff_end_tag(pb, fact);
-    }
-
-    av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
-    wav->maxpts = wav->last_duration = 0;
-    wav->minpts = INT64_MAX;
-
-    /* data header */
-    wav->data = ff_start_tag(pb, "data");
-
-    put_flush_packet(pb);
-
-    return 0;
-}
-
-static int wav_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    ByteIOContext *pb  = s->pb;
-    WAVContext    *wav = s->priv_data;
-    put_buffer(pb, pkt->data, pkt->size);
-    if(pkt->pts != AV_NOPTS_VALUE) {
-        wav->minpts        = FFMIN(wav->minpts, pkt->pts);
-        wav->maxpts        = FFMAX(wav->maxpts, pkt->pts);
-        wav->last_duration = pkt->duration;
-    } else
-        av_log(s, AV_LOG_ERROR, "wav_write_packet: NOPTS\n");
-    return 0;
-}
-
-static int wav_write_trailer(AVFormatContext *s)
-{
-    ByteIOContext *pb  = s->pb;
-    WAVContext    *wav = s->priv_data;
-    int64_t file_size;
-
-    if (!url_is_streamed(s->pb)) {
-        ff_end_tag(pb, wav->data);
-
-        /* update file size */
-        file_size = url_ftell(pb);
-        url_fseek(pb, 4, SEEK_SET);
-        put_le32(pb, (uint32_t)(file_size - 8));
-        url_fseek(pb, file_size, SEEK_SET);
-
-        put_flush_packet(pb);
-
-        if(s->streams[0]->codec->codec_tag != 0x01) {
-            /* Update num_samps in fact chunk */
-            int number_of_samples;
-            number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration,
-                                           s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num,
-                                           s->streams[0]->time_base.den);
-            url_fseek(pb, wav->data-12, SEEK_SET);
-            put_le32(pb, number_of_samples);
-            url_fseek(pb, file_size, SEEK_SET);
-            put_flush_packet(pb);
-        }
-    }
-    return 0;
-}
-
-AVOutputFormat wav_muxer = {
-    "wav",
-    NULL_IF_CONFIG_SMALL("WAV format"),
-    "audio/x-wav",
-    "wav",
-    sizeof(WAVContext),
-    CODEC_ID_PCM_S16LE,
-    CODEC_ID_NONE,
-    wav_write_header,
-    wav_write_packet,
-    wav_write_trailer,
-    .codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
-};
-#endif /* CONFIG_WAV_MUXER */
-
-
-#if CONFIG_WAV_DEMUXER
-/* return the size of the found tag */
-static int64_t find_tag(ByteIOContext *pb, uint32_t tag1)
-{
-    unsigned int tag;
-    int64_t size;
-
-    for (;;) {
-        if (url_feof(pb))
-            return -1;
-        tag  = get_le32(pb);
-        size = get_le32(pb);
-        if (tag == tag1)
-            break;
-        url_fseek(pb, size, SEEK_CUR);
-    }
-    return size;
-}
-
-static int wav_probe(AVProbeData *p)
-{
-    /* check file header */
-    if (p->buf_size <= 32)
-        return 0;
-    if (!memcmp(p->buf + 8, "WAVE", 4)) {
-        if (!memcmp(p->buf, "RIFF", 4))
-            /*
-              Since ACT demuxer has standard WAV header at top of it's own,
-              returning score is decreased to avoid probe conflict
-              between ACT and WAV.
-            */
-            return AVPROBE_SCORE_MAX - 1;
-        else if (!memcmp(p->buf,      "RF64", 4) &&
-                 !memcmp(p->buf + 12, "ds64", 4))
-            return AVPROBE_SCORE_MAX;
-    }
-    return 0;
-}
-
-/* wav input */
-static int wav_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    int64_t size, av_uninit(data_size);
-    int rf64;
-    unsigned int tag;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    WAVContext *wav = s->priv_data;
-
-    /* check RIFF header */
-    tag = get_le32(pb);
-
-    rf64 = tag == MKTAG('R', 'F', '6', '4');
-    if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
-        return -1;
-    get_le32(pb); /* file size */
-    tag = get_le32(pb);
-    if (tag != MKTAG('W', 'A', 'V', 'E'))
-        return -1;
-
-    if (rf64) {
-        if (get_le32(pb) != MKTAG('d', 's', '6', '4'))
-            return -1;
-        size = get_le32(pb);
-        if (size < 16)
-            return -1;
-        get_le64(pb); /* RIFF size */
-        data_size = get_le64(pb);
-        url_fskip(pb, size - 16); /* skip rest of ds64 chunk */
-    }
-
-    /* parse fmt header */
-    size = find_tag(pb, MKTAG('f', 'm', 't', ' '));
-    if (size < 0)
-        return -1;
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    ff_get_wav_header(pb, st->codec, size);
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-    size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));
-    if (rf64)
-        size = data_size;
-    if (size < 0)
-        return -1;
-    if (!size) {
-        wav->data_end = INT64_MAX;
-    } else
-        wav->data_end= url_ftell(pb) + size;
-    return 0;
-}
-
-/** Find chunk with w64 GUID by skipping over other chunks
- * @return the size of the found chunk
- */
-static int64_t find_guid(ByteIOContext *pb, const uint8_t guid1[16])
-{
-    uint8_t guid[16];
-    int64_t size;
-
-    while (!url_feof(pb)) {
-        get_buffer(pb, guid, 16);
-        size = get_le64(pb);
-        if (size <= 24)
-            return -1;
-        if (!memcmp(guid, guid1, 16))
-            return size;
-        url_fskip(pb, FFALIGN(size, INT64_C(8)) - 24);
-    }
-    return -1;
-}
-
-static const uint8_t guid_data[16] = { 'd', 'a', 't', 'a',
-    0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
-
-#define MAX_SIZE 4096
-
-static int wav_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    int ret, size;
-    int64_t left;
-    AVStream *st;
-    WAVContext *wav = s->priv_data;
-
-    st = s->streams[0];
-
-    left = wav->data_end - url_ftell(s->pb);
-    if (left <= 0){
-        if (CONFIG_W64_DEMUXER && wav->w64)
-            left = find_guid(s->pb, guid_data) - 24;
-        else
-            left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
-        if (left < 0)
-            return AVERROR_EOF;
-        wav->data_end= url_ftell(s->pb) + left;
-    }
-
-    size = MAX_SIZE;
-    if (st->codec->block_align > 1) {
-        if (size < st->codec->block_align)
-            size = st->codec->block_align;
-        size = (size / st->codec->block_align) * st->codec->block_align;
-    }
-    size = FFMIN(size, left);
-    ret  = av_get_packet(s->pb, pkt, size);
-    if (ret < 0)
-        return ret;
-    pkt->stream_index = 0;
-
-    return ret;
-}
-
-static int wav_read_seek(AVFormatContext *s,
-                         int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st;
-
-    st = s->streams[0];
-    switch (st->codec->codec_id) {
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-    case CODEC_ID_AC3:
-    case CODEC_ID_DTS:
-        /* use generic seeking with dynamically generated indexes */
-        return -1;
-    default:
-        break;
-    }
-    return pcm_read_seek(s, stream_index, timestamp, flags);
-}
-
-AVInputFormat wav_demuxer = {
-    "wav",
-    NULL_IF_CONFIG_SMALL("WAV format"),
-    sizeof(WAVContext),
-    wav_probe,
-    wav_read_header,
-    wav_read_packet,
-    NULL,
-    wav_read_seek,
-    .flags= AVFMT_GENERIC_INDEX,
-    .codec_tag= (const AVCodecTag* const []){ff_codec_wav_tags, 0},
-};
-#endif /* CONFIG_WAV_DEMUXER */
-
-
-#if CONFIG_W64_DEMUXER
-static const uint8_t guid_riff[16] = { 'r', 'i', 'f', 'f',
-    0x2E, 0x91, 0xCF, 0x11, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 };
-
-static const uint8_t guid_wave[16] = { 'w', 'a', 'v', 'e',
-    0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
-
-static const uint8_t guid_fmt [16] = { 'f', 'm', 't', ' ',
-    0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A };
-
-static int w64_probe(AVProbeData *p)
-{
-    if (p->buf_size <= 40)
-        return 0;
-    if (!memcmp(p->buf,      guid_riff, 16) &&
-        !memcmp(p->buf + 24, guid_wave, 16))
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    int64_t size;
-    ByteIOContext *pb  = s->pb;
-    WAVContext    *wav = s->priv_data;
-    AVStream *st;
-    uint8_t guid[16];
-
-    get_buffer(pb, guid, 16);
-    if (memcmp(guid, guid_riff, 16))
-        return -1;
-
-    if (get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
-        return -1;
-
-    get_buffer(pb, guid, 16);
-    if (memcmp(guid, guid_wave, 16)) {
-        av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
-        return -1;
-    }
-
-    size = find_guid(pb, guid_fmt);
-    if (size < 0) {
-        av_log(s, AV_LOG_ERROR, "could not find fmt guid\n");
-        return -1;
-    }
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    /* subtract chunk header size - normal wav file doesn't count it */
-    ff_get_wav_header(pb, st->codec, size - 24);
-    url_fskip(pb, FFALIGN(size, INT64_C(8)) - size);
-
-    st->need_parsing = AVSTREAM_PARSE_FULL;
-
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-    size = find_guid(pb, guid_data);
-    if (size < 0) {
-        av_log(s, AV_LOG_ERROR, "could not find data guid\n");
-        return -1;
-    }
-    wav->data_end = url_ftell(pb) + size - 24;
-    wav->w64      = 1;
-
-    return 0;
-}
-
-AVInputFormat w64_demuxer = {
-    "w64",
-    NULL_IF_CONFIG_SMALL("Sony Wave64 format"),
-    sizeof(WAVContext),
-    w64_probe,
-    w64_read_header,
-    wav_read_packet,
-    NULL,
-    wav_read_seek,
-    .flags = AVFMT_GENERIC_INDEX,
-    .codec_tag = (const AVCodecTag* const []){ff_codec_wav_tags, 0},
-};
-#endif /* CONFIG_W64_DEMUXER */
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
deleted file mode 100644
index d5f0863..0000000
--- a/libavformat/wc3movie.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Wing Commander III Movie (.mve) File Demuxer
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Wing Commander III Movie file demuxer
- * by Mike Melanson (melanson at pcisys.net)
- * for more information on the WC3 .mve file format, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define FORM_TAG MKTAG('F', 'O', 'R', 'M')
-#define MOVE_TAG MKTAG('M', 'O', 'V', 'E')
-#define  PC__TAG MKTAG('_', 'P', 'C', '_')
-#define SOND_TAG MKTAG('S', 'O', 'N', 'D')
-#define BNAM_TAG MKTAG('B', 'N', 'A', 'M')
-#define SIZE_TAG MKTAG('S', 'I', 'Z', 'E')
-#define PALT_TAG MKTAG('P', 'A', 'L', 'T')
-#define INDX_TAG MKTAG('I', 'N', 'D', 'X')
-#define BRCH_TAG MKTAG('B', 'R', 'C', 'H')
-#define SHOT_TAG MKTAG('S', 'H', 'O', 'T')
-#define VGA__TAG MKTAG('V', 'G', 'A', ' ')
-#define TEXT_TAG MKTAG('T', 'E', 'X', 'T')
-#define AUDI_TAG MKTAG('A', 'U', 'D', 'I')
-
-/* video resolution unless otherwise specified */
-#define WC3_DEFAULT_WIDTH 320
-#define WC3_DEFAULT_HEIGHT 165
-
-/* always use the same PCM audio parameters */
-#define WC3_SAMPLE_RATE 22050
-#define WC3_AUDIO_CHANNELS 1
-#define WC3_AUDIO_BITS 16
-
-/* nice, constant framerate */
-#define WC3_FRAME_FPS 15
-
-#define PALETTE_SIZE (256 * 3)
-#define PALETTE_COUNT 256
-
-typedef struct Wc3DemuxContext {
-    int width;
-    int height;
-    unsigned char *palettes;
-    int palette_count;
-    int64_t pts;
-    int video_stream_index;
-    int audio_stream_index;
-
-    AVPaletteControl palette_control;
-
-} Wc3DemuxContext;
-
-/**
- * palette lookup table that does gamma correction
- *
- * can be calculated by this formula:
- * for i between 0 and 251 inclusive:
- * wc3_pal_lookup[i] = round(pow(i / 256.0, 0.8) * 256);
- * values 252, 253, 254 and 255 are all 0xFD
- * calculating this at runtime should not cause any
- * rounding issues, the maximum difference between
- * the table values and the calculated doubles is
- * about 0.497527
- */
-static const unsigned char wc3_pal_lookup[] = {
-  0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0E,
-  0x10, 0x12, 0x13, 0x15, 0x16, 0x18, 0x19, 0x1A,
-  0x1C, 0x1D, 0x1F, 0x20, 0x21, 0x23, 0x24, 0x25,
-  0x27, 0x28, 0x29, 0x2A, 0x2C, 0x2D, 0x2E, 0x2F,
-  0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38, 0x39,
-  0x3A, 0x3B, 0x3C, 0x3D, 0x3F, 0x40, 0x41, 0x42,
-  0x43, 0x44, 0x45, 0x46, 0x48, 0x49, 0x4A, 0x4B,
-  0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53,
-  0x54, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C,
-  0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64,
-  0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
-  0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
-  0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
-  0x7D, 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83,
-  0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B,
-  0x8C, 0x8D, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92,
-  0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x99,
-  0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA1,
-  0xA2, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8,
-  0xA9, 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
-  0xB0, 0xB1, 0xB2, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6,
-  0xB7, 0xB8, 0xB9, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD,
-  0xBE, 0xBF, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4,
-  0xC5, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB,
-  0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD0, 0xD1,
-  0xD2, 0xD3, 0xD4, 0xD5, 0xD5, 0xD6, 0xD7, 0xD8,
-  0xD9, 0xDA, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
-  0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE4, 0xE5,
-  0xE6, 0xE7, 0xE8, 0xE9, 0xE9, 0xEA, 0xEB, 0xEC,
-  0xED, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF1, 0xF2,
-  0xF3, 0xF4, 0xF5, 0xF6, 0xF6, 0xF7, 0xF8, 0xF9,
-  0xFA, 0xFA, 0xFB, 0xFC, 0xFD, 0xFD, 0xFD, 0xFD
-};
-
-
-static int wc3_probe(AVProbeData *p)
-{
-    if (p->buf_size < 12)
-        return 0;
-
-    if ((AV_RL32(&p->buf[0]) != FORM_TAG) ||
-        (AV_RL32(&p->buf[8]) != MOVE_TAG))
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int wc3_read_header(AVFormatContext *s,
-                           AVFormatParameters *ap)
-{
-    Wc3DemuxContext *wc3 = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned int fourcc_tag;
-    unsigned int size;
-    AVStream *st;
-    int ret = 0;
-    int current_palette = 0;
-    char *buffer;
-    int i;
-    unsigned char rotate;
-
-    /* default context members */
-    wc3->width = WC3_DEFAULT_WIDTH;
-    wc3->height = WC3_DEFAULT_HEIGHT;
-    wc3->palettes = NULL;
-    wc3->palette_count = 0;
-    wc3->pts = 0;
-    wc3->video_stream_index = wc3->audio_stream_index = 0;
-
-    /* skip the first 3 32-bit numbers */
-    url_fseek(pb, 12, SEEK_CUR);
-
-    /* traverse through the chunks and load the header information before
-     * the first BRCH tag */
-    fourcc_tag = get_le32(pb);
-    size = (get_be32(pb) + 1) & (~1);
-
-    do {
-        switch (fourcc_tag) {
-
-        case SOND_TAG:
-        case INDX_TAG:
-            /* SOND unknown, INDX unnecessary; ignore both */
-            url_fseek(pb, size, SEEK_CUR);
-            break;
-
-        case PC__TAG:
-            /* need the number of palettes */
-            url_fseek(pb, 8, SEEK_CUR);
-            wc3->palette_count = get_le32(pb);
-            if((unsigned)wc3->palette_count >= UINT_MAX / PALETTE_SIZE){
-                wc3->palette_count= 0;
-                return -1;
-            }
-            wc3->palettes = av_malloc(wc3->palette_count * PALETTE_SIZE);
-            break;
-
-        case BNAM_TAG:
-            /* load up the name */
-            buffer = av_malloc(size+1);
-            if (!buffer)
-                return AVERROR(ENOMEM);
-            if ((ret = get_buffer(pb, buffer, size)) != size)
-                return AVERROR(EIO);
-            buffer[size] = 0;
-            av_metadata_set2(&s->metadata, "title", buffer,
-                                   AV_METADATA_DONT_STRDUP_VAL);
-            break;
-
-        case SIZE_TAG:
-            /* video resolution override */
-            wc3->width  = get_le32(pb);
-            wc3->height = get_le32(pb);
-            break;
-
-        case PALT_TAG:
-            /* one of several palettes */
-            if ((unsigned)current_palette >= wc3->palette_count)
-                return AVERROR_INVALIDDATA;
-            if ((ret = get_buffer(pb,
-                &wc3->palettes[current_palette * PALETTE_SIZE],
-                PALETTE_SIZE)) != PALETTE_SIZE)
-                return AVERROR(EIO);
-
-            /* transform the current palette in place */
-            for (i = current_palette * PALETTE_SIZE;
-                 i < (current_palette + 1) * PALETTE_SIZE; i++) {
-                /* rotate each palette component left by 2 and use the result
-                 * as an index into the color component table */
-                rotate = ((wc3->palettes[i] << 2) & 0xFF) |
-                         ((wc3->palettes[i] >> 6) & 0xFF);
-                wc3->palettes[i] = wc3_pal_lookup[rotate];
-            }
-            current_palette++;
-            break;
-
-        default:
-            av_log(s, AV_LOG_ERROR, "  unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n",
-                (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24),
-                (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24));
-            return AVERROR_INVALIDDATA;
-            break;
-        }
-
-        fourcc_tag = get_le32(pb);
-        /* chunk sizes are 16-bit aligned */
-        size = (get_be32(pb) + 1) & (~1);
-        if (url_feof(pb))
-            return AVERROR(EIO);
-
-    } while (fourcc_tag != BRCH_TAG);
-
-    /* initialize the decoder streams */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
-    wc3->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_XAN_WC3;
-    st->codec->codec_tag = 0;  /* no fourcc */
-    st->codec->width = wc3->width;
-    st->codec->height = wc3->height;
-
-    /* palette considerations */
-    st->codec->palctrl = &wc3->palette_control;
-
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 33, 1, WC3_FRAME_FPS);
-    wc3->audio_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_PCM_S16LE;
-    st->codec->codec_tag = 1;
-    st->codec->channels = WC3_AUDIO_CHANNELS;
-    st->codec->bits_per_coded_sample = WC3_AUDIO_BITS;
-    st->codec->sample_rate = WC3_SAMPLE_RATE;
-    st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-        st->codec->bits_per_coded_sample;
-    st->codec->block_align = WC3_AUDIO_BITS * WC3_AUDIO_CHANNELS;
-
-    return 0;
-}
-
-static int wc3_read_packet(AVFormatContext *s,
-                           AVPacket *pkt)
-{
-    Wc3DemuxContext *wc3 = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned int fourcc_tag;
-    unsigned int size;
-    int packet_read = 0;
-    int ret = 0;
-    unsigned char text[1024];
-    unsigned int palette_number;
-    int i;
-    unsigned char r, g, b;
-    int base_palette_index;
-
-    while (!packet_read) {
-
-        fourcc_tag = get_le32(pb);
-        /* chunk sizes are 16-bit aligned */
-        size = (get_be32(pb) + 1) & (~1);
-        if (url_feof(pb))
-            return AVERROR(EIO);
-
-        switch (fourcc_tag) {
-
-        case BRCH_TAG:
-            /* no-op */
-            break;
-
-        case SHOT_TAG:
-            /* load up new palette */
-            palette_number = get_le32(pb);
-            if (palette_number >= wc3->palette_count)
-                return AVERROR_INVALIDDATA;
-            base_palette_index = palette_number * PALETTE_COUNT * 3;
-            for (i = 0; i < PALETTE_COUNT; i++) {
-                r = wc3->palettes[base_palette_index + i * 3 + 0];
-                g = wc3->palettes[base_palette_index + i * 3 + 1];
-                b = wc3->palettes[base_palette_index + i * 3 + 2];
-                wc3->palette_control.palette[i] = (r << 16) | (g << 8) | (b);
-            }
-            wc3->palette_control.palette_changed = 1;
-            break;
-
-        case VGA__TAG:
-            /* send out video chunk */
-            ret= av_get_packet(pb, pkt, size);
-            pkt->stream_index = wc3->video_stream_index;
-            pkt->pts = wc3->pts;
-            packet_read = 1;
-            break;
-
-        case TEXT_TAG:
-            /* subtitle chunk */
-#if 0
-            url_fseek(pb, size, SEEK_CUR);
-#else
-            if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size)
-                ret = AVERROR(EIO);
-            else {
-                int i = 0;
-                av_log (s, AV_LOG_DEBUG, "Subtitle time!\n");
-                av_log (s, AV_LOG_DEBUG, "  inglish: %s\n", &text[i + 1]);
-                i += text[i] + 1;
-                av_log (s, AV_LOG_DEBUG, "  doytsch: %s\n", &text[i + 1]);
-                i += text[i] + 1;
-                av_log (s, AV_LOG_DEBUG, "  fronsay: %s\n", &text[i + 1]);
-            }
-#endif
-            break;
-
-        case AUDI_TAG:
-            /* send out audio chunk */
-            ret= av_get_packet(pb, pkt, size);
-            pkt->stream_index = wc3->audio_stream_index;
-            pkt->pts = wc3->pts;
-
-            /* time to advance pts */
-            wc3->pts++;
-
-            packet_read = 1;
-            break;
-
-        default:
-            av_log (s, AV_LOG_ERROR, "  unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n",
-                (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24),
-                (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24));
-            ret = AVERROR_INVALIDDATA;
-            packet_read = 1;
-            break;
-        }
-    }
-
-    return ret;
-}
-
-static int wc3_read_close(AVFormatContext *s)
-{
-    Wc3DemuxContext *wc3 = s->priv_data;
-
-    av_free(wc3->palettes);
-
-    return 0;
-}
-
-AVInputFormat wc3_demuxer = {
-    "wc3movie",
-    NULL_IF_CONFIG_SMALL("Wing Commander III movie format"),
-    sizeof(Wc3DemuxContext),
-    wc3_probe,
-    wc3_read_header,
-    wc3_read_packet,
-    wc3_read_close,
-};
diff --git a/libavformat/westwood.c b/libavformat/westwood.c
deleted file mode 100644
index 10d5798..0000000
--- a/libavformat/westwood.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * Westwood Studios Multimedia Formats Demuxer (VQA, AUD)
- * Copyright (c) 2003 The ffmpeg Project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Westwood Studios VQA & AUD file demuxers
- * by Mike Melanson (melanson at pcisys.net)
- * for more information on the Westwood file formats, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- *   http://www.geocities.com/SiliconValley/8682/aud3.txt
- *
- * Implementation note: There is no definite file signature for AUD files.
- * The demuxer uses a probabilistic strategy for content detection. This
- * entails performing sanity checks on certain header values in order to
- * qualify a file. Refer to wsaud_probe() for the precise parameters.
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define AUD_HEADER_SIZE 12
-#define AUD_CHUNK_PREAMBLE_SIZE 8
-#define AUD_CHUNK_SIGNATURE 0x0000DEAF
-
-#define FORM_TAG MKBETAG('F', 'O', 'R', 'M')
-#define WVQA_TAG MKBETAG('W', 'V', 'Q', 'A')
-#define VQHD_TAG MKBETAG('V', 'Q', 'H', 'D')
-#define FINF_TAG MKBETAG('F', 'I', 'N', 'F')
-#define SND0_TAG MKBETAG('S', 'N', 'D', '0')
-#define SND1_TAG MKBETAG('S', 'N', 'D', '1')
-#define SND2_TAG MKBETAG('S', 'N', 'D', '2')
-#define VQFR_TAG MKBETAG('V', 'Q', 'F', 'R')
-
-/* don't know what these tags are for, but acknowledge their existence */
-#define CINF_TAG MKBETAG('C', 'I', 'N', 'F')
-#define CINH_TAG MKBETAG('C', 'I', 'N', 'H')
-#define CIND_TAG MKBETAG('C', 'I', 'N', 'D')
-#define PINF_TAG MKBETAG('P', 'I', 'N', 'F')
-#define PINH_TAG MKBETAG('P', 'I', 'N', 'H')
-#define PIND_TAG MKBETAG('P', 'I', 'N', 'D')
-#define CMDS_TAG MKBETAG('C', 'M', 'D', 'S')
-
-#define VQA_HEADER_SIZE 0x2A
-#define VQA_FRAMERATE 15
-#define VQA_PREAMBLE_SIZE 8
-
-typedef struct WsAudDemuxContext {
-    int audio_samplerate;
-    int audio_channels;
-    int audio_bits;
-    enum CodecID audio_type;
-    int audio_stream_index;
-    int64_t audio_frame_counter;
-} WsAudDemuxContext;
-
-typedef struct WsVqaDemuxContext {
-    int audio_samplerate;
-    int audio_channels;
-    int audio_bits;
-
-    int audio_stream_index;
-    int video_stream_index;
-
-    int64_t audio_frame_counter;
-} WsVqaDemuxContext;
-
-static int wsaud_probe(AVProbeData *p)
-{
-    int field;
-
-    /* Probabilistic content detection strategy: There is no file signature
-     * so perform sanity checks on various header parameters:
-     *   8000 <= sample rate (16 bits) <= 48000  ==> 40001 acceptable numbers
-     *   flags <= 0x03 (2 LSBs are used)         ==> 4 acceptable numbers
-     *   compression type (8 bits) = 1 or 99     ==> 2 acceptable numbers
-     *   first audio chunk signature (32 bits)   ==> 1 acceptable number
-     * The number space contains 2^64 numbers. There are 40001 * 4 * 2 * 1 =
-     * 320008 acceptable number combinations.
-     */
-
-    if (p->buf_size < AUD_HEADER_SIZE + AUD_CHUNK_PREAMBLE_SIZE)
-        return 0;
-
-    /* check sample rate */
-    field = AV_RL16(&p->buf[0]);
-    if ((field < 8000) || (field > 48000))
-        return 0;
-
-    /* enforce the rule that the top 6 bits of this flags field are reserved (0);
-     * this might not be true, but enforce it until deemed unnecessary */
-    if (p->buf[10] & 0xFC)
-        return 0;
-
-    /* note: only check for WS IMA (type 99) right now since there is no
-     * support for type 1 */
-    if (p->buf[11] != 99)
-        return 0;
-
-    /* read ahead to the first audio chunk and validate the first header signature */
-    if (AV_RL32(&p->buf[16]) != AUD_CHUNK_SIGNATURE)
-        return 0;
-
-    /* return 1/2 certainty since this file check is a little sketchy */
-    return AVPROBE_SCORE_MAX / 2;
-}
-
-static int wsaud_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
-{
-    WsAudDemuxContext *wsaud = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    unsigned char header[AUD_HEADER_SIZE];
-
-    if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
-        return AVERROR(EIO);
-    wsaud->audio_samplerate = AV_RL16(&header[0]);
-    if (header[11] == 99)
-        wsaud->audio_type = CODEC_ID_ADPCM_IMA_WS;
-    else
-        return AVERROR_INVALIDDATA;
-
-    /* flag 0 indicates stereo */
-    wsaud->audio_channels = (header[10] & 0x1) + 1;
-    /* flag 1 indicates 16 bit audio */
-    wsaud->audio_bits = (((header[10] & 0x2) >> 1) + 1) * 8;
-
-    /* initialize the audio decoder stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = wsaud->audio_type;
-    st->codec->codec_tag = 0;  /* no tag */
-    st->codec->channels = wsaud->audio_channels;
-    st->codec->sample_rate = wsaud->audio_samplerate;
-    st->codec->bits_per_coded_sample = wsaud->audio_bits;
-    st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-        st->codec->bits_per_coded_sample / 4;
-    st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-
-    wsaud->audio_stream_index = st->index;
-    wsaud->audio_frame_counter = 0;
-
-    return 0;
-}
-
-static int wsaud_read_packet(AVFormatContext *s,
-                             AVPacket *pkt)
-{
-    WsAudDemuxContext *wsaud = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    unsigned char preamble[AUD_CHUNK_PREAMBLE_SIZE];
-    unsigned int chunk_size;
-    int ret = 0;
-
-    if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
-        AUD_CHUNK_PREAMBLE_SIZE)
-        return AVERROR(EIO);
-
-    /* validate the chunk */
-    if (AV_RL32(&preamble[4]) != AUD_CHUNK_SIGNATURE)
-        return AVERROR_INVALIDDATA;
-
-    chunk_size = AV_RL16(&preamble[0]);
-    ret= av_get_packet(pb, pkt, chunk_size);
-    if (ret != chunk_size)
-        return AVERROR(EIO);
-    pkt->stream_index = wsaud->audio_stream_index;
-    pkt->pts = wsaud->audio_frame_counter;
-    pkt->pts /= wsaud->audio_samplerate;
-
-    /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
-    wsaud->audio_frame_counter += (chunk_size * 2) / wsaud->audio_channels;
-
-    return ret;
-}
-
-static int wsvqa_probe(AVProbeData *p)
-{
-    /* need 12 bytes to qualify */
-    if (p->buf_size < 12)
-        return 0;
-
-    /* check for the VQA signatures */
-    if ((AV_RB32(&p->buf[0]) != FORM_TAG) ||
-        (AV_RB32(&p->buf[8]) != WVQA_TAG))
-        return 0;
-
-    return AVPROBE_SCORE_MAX;
-}
-
-static int wsvqa_read_header(AVFormatContext *s,
-                             AVFormatParameters *ap)
-{
-    WsVqaDemuxContext *wsvqa = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-    unsigned char *header;
-    unsigned char scratch[VQA_PREAMBLE_SIZE];
-    unsigned int chunk_tag;
-    unsigned int chunk_size;
-
-    /* initialize the video decoder stream */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-    av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
-    wsvqa->video_stream_index = st->index;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_WS_VQA;
-    st->codec->codec_tag = 0;  /* no fourcc */
-
-    /* skip to the start of the VQA header */
-    url_fseek(pb, 20, SEEK_SET);
-
-    /* the VQA header needs to go to the decoder */
-    st->codec->extradata_size = VQA_HEADER_SIZE;
-    st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
-    header = (unsigned char *)st->codec->extradata;
-    if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
-        VQA_HEADER_SIZE) {
-        av_free(st->codec->extradata);
-        return AVERROR(EIO);
-    }
-    st->codec->width = AV_RL16(&header[6]);
-    st->codec->height = AV_RL16(&header[8]);
-
-    /* initialize the audio decoder stream for VQA v1 or nonzero samplerate */
-    if (AV_RL16(&header[24]) || (AV_RL16(&header[0]) == 1 && AV_RL16(&header[2]) == 1)) {
-        st = av_new_stream(s, 0);
-        if (!st)
-            return AVERROR(ENOMEM);
-        av_set_pts_info(st, 33, 1, VQA_FRAMERATE);
-        st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-        if (AV_RL16(&header[0]) == 1)
-            st->codec->codec_id = CODEC_ID_WESTWOOD_SND1;
-        else
-            st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
-        st->codec->codec_tag = 0;  /* no tag */
-        st->codec->sample_rate = AV_RL16(&header[24]);
-        if (!st->codec->sample_rate)
-            st->codec->sample_rate = 22050;
-        st->codec->channels = header[26];
-        if (!st->codec->channels)
-            st->codec->channels = 1;
-        st->codec->bits_per_coded_sample = 16;
-        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
-            st->codec->bits_per_coded_sample / 4;
-        st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
-
-        wsvqa->audio_stream_index = st->index;
-        wsvqa->audio_samplerate = st->codec->sample_rate;
-        wsvqa->audio_channels = st->codec->channels;
-        wsvqa->audio_frame_counter = 0;
-    }
-
-    /* there are 0 or more chunks before the FINF chunk; iterate until
-     * FINF has been skipped and the file will be ready to be demuxed */
-    do {
-        if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
-            av_free(st->codec->extradata);
-            return AVERROR(EIO);
-        }
-        chunk_tag = AV_RB32(&scratch[0]);
-        chunk_size = AV_RB32(&scratch[4]);
-
-        /* catch any unknown header tags, for curiousity */
-        switch (chunk_tag) {
-        case CINF_TAG:
-        case CINH_TAG:
-        case CIND_TAG:
-        case PINF_TAG:
-        case PINH_TAG:
-        case PIND_TAG:
-        case FINF_TAG:
-        case CMDS_TAG:
-            break;
-
-        default:
-            av_log (s, AV_LOG_ERROR, " note: unknown chunk seen (%c%c%c%c)\n",
-                scratch[0], scratch[1],
-                scratch[2], scratch[3]);
-            break;
-        }
-
-        url_fseek(pb, chunk_size, SEEK_CUR);
-    } while (chunk_tag != FINF_TAG);
-
-    return 0;
-}
-
-static int wsvqa_read_packet(AVFormatContext *s,
-                             AVPacket *pkt)
-{
-    WsVqaDemuxContext *wsvqa = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    int ret = -1;
-    unsigned char preamble[VQA_PREAMBLE_SIZE];
-    unsigned int chunk_type;
-    unsigned int chunk_size;
-    int skip_byte;
-
-    while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
-        chunk_type = AV_RB32(&preamble[0]);
-        chunk_size = AV_RB32(&preamble[4]);
-        skip_byte = chunk_size & 0x01;
-
-        if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
-
-            if (av_new_packet(pkt, chunk_size))
-                return AVERROR(EIO);
-            ret = get_buffer(pb, pkt->data, chunk_size);
-            if (ret != chunk_size) {
-                av_free_packet(pkt);
-                return AVERROR(EIO);
-            }
-
-            if (chunk_type == SND2_TAG) {
-                pkt->stream_index = wsvqa->audio_stream_index;
-                /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
-                wsvqa->audio_frame_counter += (chunk_size * 2) / wsvqa->audio_channels;
-            } else if(chunk_type == SND1_TAG) {
-                pkt->stream_index = wsvqa->audio_stream_index;
-                /* unpacked size is stored in header */
-                wsvqa->audio_frame_counter += AV_RL16(pkt->data) / wsvqa->audio_channels;
-            } else {
-                pkt->stream_index = wsvqa->video_stream_index;
-            }
-            /* stay on 16-bit alignment */
-            if (skip_byte)
-                url_fseek(pb, 1, SEEK_CUR);
-
-            return ret;
-        } else {
-            switch(chunk_type){
-            case CMDS_TAG:
-            case SND0_TAG:
-                break;
-            default:
-                av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type);
-            }
-            url_fseek(pb, chunk_size + skip_byte, SEEK_CUR);
-        }
-    }
-
-    return ret;
-}
-
-#if CONFIG_WSAUD_DEMUXER
-AVInputFormat wsaud_demuxer = {
-    "wsaud",
-    NULL_IF_CONFIG_SMALL("Westwood Studios audio format"),
-    sizeof(WsAudDemuxContext),
-    wsaud_probe,
-    wsaud_read_header,
-    wsaud_read_packet,
-};
-#endif
-#if CONFIG_WSVQA_DEMUXER
-AVInputFormat wsvqa_demuxer = {
-    "wsvqa",
-    NULL_IF_CONFIG_SMALL("Westwood Studios VQA format"),
-    sizeof(WsVqaDemuxContext),
-    wsvqa_probe,
-    wsvqa_read_header,
-    wsvqa_read_packet,
-};
-#endif
diff --git a/libavformat/wv.c b/libavformat/wv.c
deleted file mode 100644
index 03b864b..0000000
--- a/libavformat/wv.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * WavPack demuxer
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-#include "apetag.h"
-#include "id3v1.h"
-
-// specs say that maximum block size is 1Mb
-#define WV_BLOCK_LIMIT 1047576
-
-#define WV_EXTRA_SIZE 12
-
-enum WV_FLAGS{
-    WV_MONO   = 0x0004,
-    WV_HYBRID = 0x0008,
-    WV_JOINT  = 0x0010,
-    WV_CROSSD = 0x0020,
-    WV_HSHAPE = 0x0040,
-    WV_FLOAT  = 0x0080,
-    WV_INT32  = 0x0100,
-    WV_HBR    = 0x0200,
-    WV_HBAL   = 0x0400,
-    WV_MCINIT = 0x0800,
-    WV_MCEND  = 0x1000,
-};
-
-static const int wv_rates[16] = {
-     6000,  8000,  9600, 11025, 12000, 16000, 22050, 24000,
-    32000, 44100, 48000, 64000, 88200, 96000, 192000, -1
-};
-
-typedef struct{
-    uint32_t blksize, flags;
-    int rate, chan, bpp;
-    uint32_t samples, soff;
-    int block_parsed;
-    uint8_t extra[WV_EXTRA_SIZE];
-    int64_t pos;
-}WVContext;
-
-static int wv_probe(AVProbeData *p)
-{
-    /* check file header */
-    if (p->buf_size <= 32)
-        return 0;
-    if (p->buf[0] == 'w' && p->buf[1] == 'v' &&
-        p->buf[2] == 'p' && p->buf[3] == 'k')
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb)
-{
-    WVContext *wc = ctx->priv_data;
-    uint32_t tag, ver;
-    int size;
-    int rate, bpp, chan;
-
-    wc->pos = url_ftell(pb);
-    tag = get_le32(pb);
-    if (tag != MKTAG('w', 'v', 'p', 'k'))
-        return -1;
-    size = get_le32(pb);
-    if(size < 24 || size > WV_BLOCK_LIMIT){
-        av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
-        return -1;
-    }
-    wc->blksize = size;
-    ver = get_le16(pb);
-    if(ver < 0x402 || ver > 0x410){
-        av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
-        return -1;
-    }
-    get_byte(pb); // track no
-    get_byte(pb); // track sub index
-    wc->samples = get_le32(pb); // total samples in file
-    wc->soff = get_le32(pb); // offset in samples of current block
-    get_buffer(pb, wc->extra, WV_EXTRA_SIZE);
-    wc->flags = AV_RL32(wc->extra + 4);
-    //parse flags
-    bpp = ((wc->flags & 3) + 1) << 3;
-    chan = 1 + !(wc->flags & WV_MONO);
-    rate = wv_rates[(wc->flags >> 23) & 0xF];
-    if(rate == -1 && !wc->block_parsed){
-        int64_t block_end = url_ftell(pb) + wc->blksize - 24;
-        if(url_is_streamed(pb)){
-            av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
-            return -1;
-        }
-        while(url_ftell(pb) < block_end){
-            int id, size;
-            id = get_byte(pb);
-            size = (id & 0x80) ? get_le24(pb) : get_byte(pb);
-            size <<= 1;
-            if(id&0x40)
-                size--;
-            if((id&0x3F) == 0x27){
-                rate = get_le24(pb);
-                break;
-            }else{
-                url_fskip(pb, size);
-            }
-        }
-        if(rate == -1){
-            av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
-            return -1;
-        }
-        url_fseek(pb, block_end - wc->blksize + 24, SEEK_SET);
-    }
-    if(!wc->bpp) wc->bpp = bpp;
-    if(!wc->chan) wc->chan = chan;
-    if(!wc->rate) wc->rate = rate;
-
-    if(wc->flags && bpp != wc->bpp){
-        av_log(ctx, AV_LOG_ERROR, "Bits per sample differ, this block: %i, header block: %i\n", bpp, wc->bpp);
-        return -1;
-    }
-    if(wc->flags && chan != wc->chan){
-        av_log(ctx, AV_LOG_ERROR, "Channels differ, this block: %i, header block: %i\n", chan, wc->chan);
-        return -1;
-    }
-    if(wc->flags && rate != -1 && rate != wc->rate){
-        av_log(ctx, AV_LOG_ERROR, "Sampling rate differ, this block: %i, header block: %i\n", rate, wc->rate);
-        return -1;
-    }
-    wc->blksize = size - 24;
-    return 0;
-}
-
-static int wv_read_header(AVFormatContext *s,
-                          AVFormatParameters *ap)
-{
-    ByteIOContext *pb = s->pb;
-    WVContext *wc = s->priv_data;
-    AVStream *st;
-
-    wc->block_parsed = 0;
-    if(wv_read_block_header(s, pb) < 0)
-        return -1;
-
-    /* now we are ready: build format streams */
-    st = av_new_stream(s, 0);
-    if (!st)
-        return -1;
-    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id = CODEC_ID_WAVPACK;
-    st->codec->channels = wc->chan;
-    st->codec->sample_rate = wc->rate;
-    st->codec->bits_per_coded_sample = wc->bpp;
-    av_set_pts_info(st, 64, 1, wc->rate);
-    st->start_time = 0;
-    st->duration = wc->samples;
-
-    if(!url_is_streamed(s->pb)) {
-        int64_t cur = url_ftell(s->pb);
-        ff_ape_parse_tag(s);
-        if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
-            ff_id3v1_read(s);
-        url_fseek(s->pb, cur, SEEK_SET);
-    }
-
-    return 0;
-}
-
-static int wv_read_packet(AVFormatContext *s,
-                          AVPacket *pkt)
-{
-    WVContext *wc = s->priv_data;
-    int ret;
-
-    if (url_feof(s->pb))
-        return AVERROR(EIO);
-    if(wc->block_parsed){
-        if(wv_read_block_header(s, s->pb) < 0)
-            return -1;
-    }
-
-    if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0)
-        return AVERROR(ENOMEM);
-    memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE);
-    ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize);
-    if(ret != wc->blksize){
-        av_free_packet(pkt);
-        return AVERROR(EIO);
-    }
-    pkt->stream_index = 0;
-    wc->block_parsed = 1;
-    pkt->size = ret + WV_EXTRA_SIZE;
-    pkt->pts = wc->soff;
-    av_add_index_entry(s->streams[0], wc->pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
-    return 0;
-}
-
-static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
-{
-    AVStream *st = s->streams[stream_index];
-    WVContext *wc = s->priv_data;
-    AVPacket pkt1, *pkt = &pkt1;
-    int ret;
-    int index = av_index_search_timestamp(st, timestamp, flags);
-    int64_t pos, pts;
-
-    /* if found, seek there */
-    if (index >= 0){
-        wc->block_parsed = 1;
-        url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
-        return 0;
-    }
-    /* if timestamp is out of bounds, return error */
-    if(timestamp < 0 || timestamp >= s->duration)
-        return -1;
-
-    pos = url_ftell(s->pb);
-    do{
-        ret = av_read_frame(s, pkt);
-        if (ret < 0){
-            url_fseek(s->pb, pos, SEEK_SET);
-            return -1;
-        }
-        pts = pkt->pts;
-        av_free_packet(pkt);
-    }while(pts < timestamp);
-    return 0;
-}
-
-AVInputFormat wv_demuxer = {
-    "wv",
-    NULL_IF_CONFIG_SMALL("WavPack"),
-    sizeof(WVContext),
-    wv_probe,
-    wv_read_header,
-    wv_read_packet,
-    NULL,
-    wv_read_seek,
-};
diff --git a/libavformat/xa.c b/libavformat/xa.c
deleted file mode 100644
index 3a866b9..0000000
--- a/libavformat/xa.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Maxis XA (.xa) File Demuxer
- * Copyright (c) 2008 Robert Marston
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Maxis XA File Demuxer
- * by Robert Marston (rmarston at gmail.com)
- * for more information on the XA audio format see
- *   http://wiki.multimedia.cx/index.php?title=Maxis_XA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-#define XA00_TAG MKTAG('X', 'A', 0, 0)
-#define XAI0_TAG MKTAG('X', 'A', 'I', 0)
-#define XAJ0_TAG MKTAG('X', 'A', 'J', 0)
-
-typedef struct MaxisXADemuxContext {
-    uint32_t out_size;
-    uint32_t sent_bytes;
-    uint32_t audio_frame_counter;
-} MaxisXADemuxContext;
-
-static int xa_probe(AVProbeData *p)
-{
-    int channels, srate, bits_per_sample;
-    if (p->buf_size < 24)
-        return 0;
-    switch(AV_RL32(p->buf)) {
-    case XA00_TAG:
-    case XAI0_TAG:
-    case XAJ0_TAG:
-        break;
-    default:
-        return 0;
-    }
-    channels        = AV_RL16(p->buf + 10);
-    srate           = AV_RL32(p->buf + 12);
-    bits_per_sample = AV_RL16(p->buf + 22);
-    if (!channels || channels > 8 || !srate || srate > 192000 ||
-        bits_per_sample < 4 || bits_per_sample > 32)
-        return 0;
-    return AVPROBE_SCORE_MAX/2;
-}
-
-static int xa_read_header(AVFormatContext *s,
-               AVFormatParameters *ap)
-{
-    MaxisXADemuxContext *xa = s->priv_data;
-    ByteIOContext *pb = s->pb;
-    AVStream *st;
-
-    /*Set up the XA Audio Decoder*/
-    st = av_new_stream(s, 0);
-    if (!st)
-        return AVERROR(ENOMEM);
-
-    st->codec->codec_type   = AVMEDIA_TYPE_AUDIO;
-    st->codec->codec_id     = CODEC_ID_ADPCM_EA_MAXIS_XA;
-    url_fskip(pb, 4);       /* Skip the XA ID */
-    xa->out_size            =  get_le32(pb);
-    url_fskip(pb, 2);       /* Skip the tag */
-    st->codec->channels     = get_le16(pb);
-    st->codec->sample_rate  = get_le32(pb);
-    /* Value in file is average byte rate*/
-    st->codec->bit_rate     = get_le32(pb) * 8;
-    st->codec->block_align  = get_le16(pb);
-    st->codec->bits_per_coded_sample = get_le16(pb);
-
-    av_set_pts_info(st, 64, 1, st->codec->sample_rate);
-
-    return 0;
-}
-
-static int xa_read_packet(AVFormatContext *s,
-                          AVPacket *pkt)
-{
-    MaxisXADemuxContext *xa = s->priv_data;
-    AVStream *st = s->streams[0];
-    ByteIOContext *pb = s->pb;
-    unsigned int packet_size;
-    int ret;
-
-    if(xa->sent_bytes > xa->out_size)
-        return AVERROR(EIO);
-    /* 1 byte header and 14 bytes worth of samples * number channels per block */
-    packet_size = 15*st->codec->channels;
-
-    ret = av_get_packet(pb, pkt, packet_size);
-    if(ret < 0)
-        return ret;
-
-    pkt->stream_index = st->index;
-    xa->sent_bytes += packet_size;
-    pkt->pts = xa->audio_frame_counter;
-    /* 14 bytes Samples per channel with 2 samples per byte */
-    xa->audio_frame_counter += 28 * st->codec->channels;
-
-    return ret;
-}
-
-AVInputFormat xa_demuxer = {
-    "xa",
-    NULL_IF_CONFIG_SMALL("Maxis XA File Format"),
-    sizeof(MaxisXADemuxContext),
-    xa_probe,
-    xa_read_header,
-    xa_read_packet,
-};
diff --git a/libavformat/yop.c b/libavformat/yop.c
deleted file mode 100644
index 54d3845..0000000
--- a/libavformat/yop.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * @file
- * Psygnosis YOP demuxer
- *
- * Copyright (C) 2010 Mohamed Naufal Basheer <naufal11 at gmail.com>
- * derived from the code by
- * Copyright (C) 2009 Thomas P. Higdon <thomas.p.higdon at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/intreadwrite.h"
-#include "avformat.h"
-
-typedef struct yop_dec_context {
-    AVPacket video_packet;
-
-    int odd_frame;
-    int frame_size;
-    int audio_block_length;
-    int palette_size;
-} YopDecContext;
-
-static int yop_probe(AVProbeData *probe_packet)
-{
-    if (AV_RB16(probe_packet->buf) == AV_RB16("YO")  &&
-        probe_packet->buf[6]                         &&
-        probe_packet->buf[7]                         &&
-        !(probe_packet->buf[8] & 1)                  &&
-        !(probe_packet->buf[10] & 1))
-        return AVPROBE_SCORE_MAX * 3 / 4;
-
-    return 0;
-}
-
-static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    YopDecContext *yop = s->priv_data;
-    ByteIOContext *pb  = s->pb;
-
-    AVCodecContext *audio_dec, *video_dec;
-    AVStream *audio_stream, *video_stream;
-
-    int frame_rate, ret;
-
-    audio_stream = av_new_stream(s, 0);
-    video_stream = av_new_stream(s, 1);
-
-    // Extra data that will be passed to the decoder
-    video_stream->codec->extradata_size = 8;
-
-    video_stream->codec->extradata = av_mallocz(video_stream->codec->extradata_size +
-                                                FF_INPUT_BUFFER_PADDING_SIZE);
-
-    if (!video_stream->codec->extradata)
-        return AVERROR(ENOMEM);
-
-    // Audio
-    audio_dec               = audio_stream->codec;
-    audio_dec->codec_type   = AVMEDIA_TYPE_AUDIO;
-    audio_dec->codec_id     = CODEC_ID_ADPCM_IMA_WS;
-    audio_dec->channels     = 1;
-    audio_dec->sample_rate  = 22050;
-
-    // Video
-    video_dec               = video_stream->codec;
-    video_dec->codec_type   = AVMEDIA_TYPE_VIDEO;
-    video_dec->codec_id     = CODEC_ID_YOP;
-
-    url_fskip(pb, 6);
-
-    frame_rate              = get_byte(pb);
-    yop->frame_size         = get_byte(pb) * 2048;
-    video_dec->width        = get_le16(pb);
-    video_dec->height       = get_le16(pb);
-
-    video_stream->sample_aspect_ratio = (AVRational){1, 2};
-
-    ret = get_buffer(pb, video_dec->extradata, 8);
-    if (ret < 8)
-        return ret < 0 ? ret : AVERROR_EOF;
-
-    yop->palette_size       = video_dec->extradata[0] * 3 + 4;
-    yop->audio_block_length = AV_RL16(video_dec->extradata + 6);
-
-    // 1840 samples per frame, 1 nibble per sample; hence 1840/2 = 920
-    if (yop->audio_block_length < 920 ||
-        yop->audio_block_length + yop->palette_size >= yop->frame_size) {
-        av_log(s, AV_LOG_ERROR, "YOP has invalid header\n");
-        return AVERROR_INVALIDDATA;
-    }
-
-    url_fseek(pb, 2048, SEEK_SET);
-
-    av_set_pts_info(video_stream, 32, 1, frame_rate);
-
-    return 0;
-}
-
-static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    YopDecContext *yop = s->priv_data;
-    ByteIOContext *pb  = s->pb;
-
-    int ret;
-    int actual_video_data_size = yop->frame_size -
-                                 yop->audio_block_length - yop->palette_size;
-
-    yop->video_packet.stream_index = 1;
-
-    if (yop->video_packet.data) {
-        *pkt                   =  yop->video_packet;
-        yop->video_packet.data =  NULL;
-        yop->video_packet.size =  0;
-        pkt->data[0]           =  yop->odd_frame;
-        pkt->flags             |= AV_PKT_FLAG_KEY;
-        yop->odd_frame         ^= 1;
-        return pkt->size;
-    }
-    ret = av_new_packet(&yop->video_packet,
-                        yop->frame_size - yop->audio_block_length);
-    if (ret < 0)
-        return ret;
-
-    yop->video_packet.pos = url_ftell(pb);
-
-    ret = get_buffer(pb, yop->video_packet.data, yop->palette_size);
-    if (ret < 0) {
-        goto err_out;
-    }else if (ret < yop->palette_size) {
-        ret = AVERROR_EOF;
-        goto err_out;
-    }
-
-    ret = av_get_packet(pb, pkt, 920);
-    if (ret < 0)
-        goto err_out;
-
-    // Set position to the start of the frame
-    pkt->pos = yop->video_packet.pos;
-
-    url_fskip(pb, yop->audio_block_length - ret);
-
-    ret = get_buffer(pb, yop->video_packet.data + yop->palette_size,
-                     actual_video_data_size);
-    if (ret < 0)
-        goto err_out;
-    else if (ret < actual_video_data_size)
-        av_shrink_packet(&yop->video_packet, yop->palette_size + ret);
-
-    // Arbitrarily return the audio data first
-    return yop->audio_block_length;
-
-err_out:
-    av_free_packet(&yop->video_packet);
-    return ret;
-}
-
-static int yop_read_close(AVFormatContext *s)
-{
-    YopDecContext *yop = s->priv_data;
-    av_free_packet(&yop->video_packet);
-    return 0;
-}
-
-static int yop_read_seek(AVFormatContext *s, int stream_index,
-                         int64_t timestamp, int flags)
-{
-    YopDecContext *yop = s->priv_data;
-    int64_t frame_pos, pos_min, pos_max;
-    int frame_count;
-
-    av_free_packet(&yop->video_packet);
-
-    if (!stream_index)
-        return -1;
-
-    pos_min        = s->data_offset;
-    pos_max        = url_fsize(s->pb) - yop->frame_size;
-    frame_count    = (pos_max - pos_min) / yop->frame_size;
-
-    timestamp      = FFMAX(0, FFMIN(frame_count, timestamp));
-
-    frame_pos      = timestamp * yop->frame_size + pos_min;
-    yop->odd_frame = timestamp & 1;
-
-    url_fseek(s->pb, frame_pos, SEEK_SET);
-    return 0;
-}
-
-AVInputFormat yop_demuxer = {
-    "yop",
-    NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"),
-    sizeof(YopDecContext),
-    yop_probe,
-    yop_read_header,
-    yop_read_packet,
-    yop_read_close,
-    yop_read_seek,
-    .extensions = "yop",
-    .flags = AVFMT_GENERIC_INDEX,
-};
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
deleted file mode 100644
index 99a1ce2..0000000
--- a/libavformat/yuv4mpeg.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * YUV4MPEG format
- * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-
-#define Y4M_MAGIC "YUV4MPEG2"
-#define Y4M_FRAME_MAGIC "FRAME"
-#define Y4M_LINE_MAX 256
-
-struct frame_attributes {
-    int interlaced_frame;
-    int top_field_first;
-};
-
-#if CONFIG_YUV4MPEGPIPE_MUXER
-static int yuv4_generate_header(AVFormatContext *s, char* buf)
-{
-    AVStream *st;
-    int width, height;
-    int raten, rated, aspectn, aspectd, n;
-    char inter;
-    const char *colorspace = "";
-
-    st = s->streams[0];
-    width = st->codec->width;
-    height = st->codec->height;
-
-    av_reduce(&raten, &rated, st->codec->time_base.den, st->codec->time_base.num, (1UL<<31)-1);
-
-    aspectn = st->sample_aspect_ratio.num;
-    aspectd = st->sample_aspect_ratio.den;
-
-    if ( aspectn == 0 && aspectd == 1 ) aspectd = 0;  // 0:0 means unknown
-
-    inter = 'p'; /* progressive is the default */
-    if (st->codec->coded_frame && st->codec->coded_frame->interlaced_frame) {
-        inter = st->codec->coded_frame->top_field_first ? 't' : 'b';
-    }
-
-    switch(st->codec->pix_fmt) {
-    case PIX_FMT_GRAY8:
-        colorspace = " Cmono";
-        break;
-    case PIX_FMT_YUV411P:
-        colorspace = " C411 XYSCSS=411";
-        break;
-    case PIX_FMT_YUV420P:
-        colorspace = (st->codec->chroma_sample_location == AVCHROMA_LOC_TOPLEFT)?" C420paldv XYSCSS=420PALDV":
-                     (st->codec->chroma_sample_location == AVCHROMA_LOC_LEFT)   ?" C420mpeg2 XYSCSS=420MPEG2":
-                     " C420jpeg XYSCSS=420JPEG";
-        break;
-    case PIX_FMT_YUV422P:
-        colorspace = " C422 XYSCSS=422";
-        break;
-    case PIX_FMT_YUV444P:
-        colorspace = " C444 XYSCSS=444";
-        break;
-    }
-
-    /* construct stream header, if this is the first frame */
-    n = snprintf(buf, Y4M_LINE_MAX, "%s W%d H%d F%d:%d I%c A%d:%d%s\n",
-                 Y4M_MAGIC,
-                 width,
-                 height,
-                 raten, rated,
-                 inter,
-                 aspectn, aspectd,
-                 colorspace);
-
-    return n;
-}
-
-static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    AVStream *st = s->streams[pkt->stream_index];
-    ByteIOContext *pb = s->pb;
-    AVPicture *picture;
-    int* first_pkt = s->priv_data;
-    int width, height, h_chroma_shift, v_chroma_shift;
-    int i, m;
-    char buf2[Y4M_LINE_MAX+1];
-    char buf1[20];
-    uint8_t *ptr, *ptr1, *ptr2;
-
-    picture = (AVPicture *)pkt->data;
-
-    /* for the first packet we have to output the header as well */
-    if (*first_pkt) {
-        *first_pkt = 0;
-        if (yuv4_generate_header(s, buf2) < 0) {
-            av_log(s, AV_LOG_ERROR, "Error. YUV4MPEG stream header write failed.\n");
-            return AVERROR(EIO);
-        } else {
-            put_buffer(pb, buf2, strlen(buf2));
-        }
-    }
-
-    /* construct frame header */
-
-    m = snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC);
-    put_buffer(pb, buf1, strlen(buf1));
-
-    width = st->codec->width;
-    height = st->codec->height;
-
-    ptr = picture->data[0];
-    for(i=0;i<height;i++) {
-        put_buffer(pb, ptr, width);
-        ptr += picture->linesize[0];
-    }
-
-    if (st->codec->pix_fmt != PIX_FMT_GRAY8){
-    // Adjust for smaller Cb and Cr planes
-    avcodec_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-    width >>= h_chroma_shift;
-    height >>= v_chroma_shift;
-
-    ptr1 = picture->data[1];
-    ptr2 = picture->data[2];
-    for(i=0;i<height;i++) {     /* Cb */
-        put_buffer(pb, ptr1, width);
-        ptr1 += picture->linesize[1];
-    }
-    for(i=0;i<height;i++) {     /* Cr */
-        put_buffer(pb, ptr2, width);
-            ptr2 += picture->linesize[2];
-    }
-    }
-    put_flush_packet(pb);
-    return 0;
-}
-
-static int yuv4_write_header(AVFormatContext *s)
-{
-    int* first_pkt = s->priv_data;
-
-    if (s->nb_streams != 1)
-        return AVERROR(EIO);
-
-    if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) {
-        av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n");
-    }
-    else if ((s->streams[0]->codec->pix_fmt != PIX_FMT_YUV420P) &&
-             (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV422P) &&
-             (s->streams[0]->codec->pix_fmt != PIX_FMT_GRAY8) &&
-             (s->streams[0]->codec->pix_fmt != PIX_FMT_YUV444P)) {
-        av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg only handles yuv444p, yuv422p, yuv420p, yuv411p and gray pixel formats. Use -pix_fmt to select one.\n");
-        return AVERROR(EIO);
-    }
-
-    *first_pkt = 1;
-    return 0;
-}
-
-AVOutputFormat yuv4mpegpipe_muxer = {
-    "yuv4mpegpipe",
-    NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
-    "",
-    "y4m",
-    sizeof(int),
-    CODEC_ID_NONE,
-    CODEC_ID_RAWVIDEO,
-    yuv4_write_header,
-    yuv4_write_packet,
-    .flags = AVFMT_RAWPICTURE,
-};
-#endif
-
-/* Header size increased to allow room for optional flags */
-#define MAX_YUV4_HEADER 80
-#define MAX_FRAME_HEADER 80
-
-static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-    char header[MAX_YUV4_HEADER+10];  // Include headroom for the longest option
-    char *tokstart,*tokend,*header_end;
-    int i;
-    ByteIOContext *pb = s->pb;
-    int width=-1, height=-1, raten=0, rated=0, aspectn=0, aspectd=0;
-    enum PixelFormat pix_fmt=PIX_FMT_NONE,alt_pix_fmt=PIX_FMT_NONE;
-    enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
-    AVStream *st;
-    struct frame_attributes *s1 = s->priv_data;
-
-    for (i=0; i<MAX_YUV4_HEADER; i++) {
-        header[i] = get_byte(pb);
-        if (header[i] == '\n') {
-            header[i+1] = 0x20;  // Add a space after last option. Makes parsing "444" vs "444alpha" easier.
-            header[i+2] = 0;
-            break;
-        }
-    }
-    if (i == MAX_YUV4_HEADER) return -1;
-    if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC))) return -1;
-
-    s1->interlaced_frame = 0;
-    s1->top_field_first = 0;
-    header_end = &header[i+1]; // Include space
-    for(tokstart = &header[strlen(Y4M_MAGIC) + 1]; tokstart < header_end; tokstart++) {
-        if (*tokstart==0x20) continue;
-        switch (*tokstart++) {
-        case 'W': // Width. Required.
-            width = strtol(tokstart, &tokend, 10);
-            tokstart=tokend;
-            break;
-        case 'H': // Height. Required.
-            height = strtol(tokstart, &tokend, 10);
-            tokstart=tokend;
-            break;
-        case 'C': // Color space
-            if (strncmp("420jpeg",tokstart,7)==0) {
-                pix_fmt = PIX_FMT_YUV420P;
-                chroma_sample_location = AVCHROMA_LOC_CENTER;
-            } else if (strncmp("420mpeg2",tokstart,8)==0) {
-                pix_fmt = PIX_FMT_YUV420P;
-                chroma_sample_location = AVCHROMA_LOC_LEFT;
-            } else if (strncmp("420paldv", tokstart, 8)==0) {
-                pix_fmt = PIX_FMT_YUV420P;
-                chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
-            } else if (strncmp("411", tokstart, 3)==0)
-                pix_fmt = PIX_FMT_YUV411P;
-            else if (strncmp("422", tokstart, 3)==0)
-                pix_fmt = PIX_FMT_YUV422P;
-            else if (strncmp("444alpha", tokstart, 8)==0) {
-                av_log(s, AV_LOG_ERROR, "Cannot handle 4:4:4:4 YUV4MPEG stream.\n");
-                return -1;
-            } else if (strncmp("444", tokstart, 3)==0)
-                pix_fmt = PIX_FMT_YUV444P;
-            else if (strncmp("mono",tokstart, 4)==0) {
-                pix_fmt = PIX_FMT_GRAY8;
-            } else {
-                av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains an unknown pixel format.\n");
-                return -1;
-            }
-            while(tokstart<header_end&&*tokstart!=0x20) tokstart++;
-            break;
-        case 'I': // Interlace type
-            switch (*tokstart++){
-            case '?':
-                break;
-            case 'p':
-                s1->interlaced_frame=0;
-                break;
-            case 't':
-                s1->interlaced_frame=1;
-                s1->top_field_first=1;
-                break;
-            case 'b':
-                s1->interlaced_frame=1;
-                s1->top_field_first=0;
-                break;
-            case 'm':
-                av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains mixed interlaced and non-interlaced frames.\n");
-                return -1;
-            default:
-                av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
-                return -1;
-            }
-            break;
-        case 'F': // Frame rate
-            sscanf(tokstart,"%d:%d",&raten,&rated); // 0:0 if unknown
-            while(tokstart<header_end&&*tokstart!=0x20) tokstart++;
-            break;
-        case 'A': // Pixel aspect
-            sscanf(tokstart,"%d:%d",&aspectn,&aspectd); // 0:0 if unknown
-            while(tokstart<header_end&&*tokstart!=0x20) tokstart++;
-            break;
-        case 'X': // Vendor extensions
-            if (strncmp("YSCSS=",tokstart,6)==0) {
-                // Older nonstandard pixel format representation
-                tokstart+=6;
-                if (strncmp("420JPEG",tokstart,7)==0)
-                    alt_pix_fmt=PIX_FMT_YUV420P;
-                else if (strncmp("420MPEG2",tokstart,8)==0)
-                    alt_pix_fmt=PIX_FMT_YUV420P;
-                else if (strncmp("420PALDV",tokstart,8)==0)
-                    alt_pix_fmt=PIX_FMT_YUV420P;
-                else if (strncmp("411",tokstart,3)==0)
-                    alt_pix_fmt=PIX_FMT_YUV411P;
-                else if (strncmp("422",tokstart,3)==0)
-                    alt_pix_fmt=PIX_FMT_YUV422P;
-                else if (strncmp("444",tokstart,3)==0)
-                    alt_pix_fmt=PIX_FMT_YUV444P;
-            }
-            while(tokstart<header_end&&*tokstart!=0x20) tokstart++;
-            break;
-        }
-    }
-
-    if ((width == -1) || (height == -1)) {
-        av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
-        return -1;
-    }
-
-    if (pix_fmt == PIX_FMT_NONE) {
-        if (alt_pix_fmt == PIX_FMT_NONE)
-            pix_fmt = PIX_FMT_YUV420P;
-        else
-            pix_fmt = alt_pix_fmt;
-    }
-
-    if (raten == 0 && rated == 0) {
-        // Frame rate unknown
-        raten = 25;
-        rated = 1;
-    }
-
-    if (aspectn == 0 && aspectd == 0) {
-        // Pixel aspect unknown
-        aspectd = 1;
-    }
-
-    st = av_new_stream(s, 0);
-    if(!st)
-        return AVERROR(ENOMEM);
-    st->codec->width = width;
-    st->codec->height = height;
-    av_reduce(&raten, &rated, raten, rated, (1UL<<31)-1);
-    av_set_pts_info(st, 64, rated, raten);
-    st->codec->pix_fmt = pix_fmt;
-    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
-    st->codec->codec_id = CODEC_ID_RAWVIDEO;
-    st->sample_aspect_ratio= (AVRational){aspectn, aspectd};
-    st->codec->chroma_sample_location = chroma_sample_location;
-
-    return 0;
-}
-
-static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int i;
-    char header[MAX_FRAME_HEADER+1];
-    int packet_size, width, height;
-    AVStream *st = s->streams[0];
-    struct frame_attributes *s1 = s->priv_data;
-
-    for (i=0; i<MAX_FRAME_HEADER; i++) {
-        header[i] = get_byte(s->pb);
-        if (header[i] == '\n') {
-            header[i+1] = 0;
-            break;
-        }
-    }
-    if (i == MAX_FRAME_HEADER) return -1;
-    if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC))) return -1;
-
-    width = st->codec->width;
-    height = st->codec->height;
-
-    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
-    if (packet_size < 0)
-        return -1;
-
-    if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
-        return AVERROR(EIO);
-
-    if (s->streams[0]->codec->coded_frame) {
-        s->streams[0]->codec->coded_frame->interlaced_frame = s1->interlaced_frame;
-        s->streams[0]->codec->coded_frame->top_field_first = s1->top_field_first;
-    }
-
-    pkt->stream_index = 0;
-    return 0;
-}
-
-static int yuv4_probe(AVProbeData *pd)
-{
-    /* check file header */
-    if (strncmp(pd->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC)-1)==0)
-        return AVPROBE_SCORE_MAX;
-    else
-        return 0;
-}
-
-#if CONFIG_YUV4MPEGPIPE_DEMUXER
-AVInputFormat yuv4mpegpipe_demuxer = {
-    "yuv4mpegpipe",
-    NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
-    sizeof(struct frame_attributes),
-    yuv4_probe,
-    yuv4_read_header,
-    yuv4_read_packet,
-    .extensions = "y4m"
-};
-#endif
diff --git a/libavutil/Makefile b/libavutil/Makefile
deleted file mode 100644
index 79506c0..0000000
--- a/libavutil/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = avutil
-
-HEADERS = adler32.h                                                     \
-          attributes.h                                                  \
-          avstring.h                                                    \
-          avutil.h                                                      \
-          base64.h                                                      \
-          common.h                                                      \
-          crc.h                                                         \
-          error.h                                                       \
-          fifo.h                                                        \
-          intfloat_readwrite.h                                          \
-          log.h                                                         \
-          lzo.h                                                         \
-          mathematics.h                                                 \
-          md5.h                                                         \
-          mem.h                                                         \
-          pixdesc.h                                                     \
-          pixfmt.h                                                      \
-          rational.h                                                    \
-          sha1.h                                                        \
-
-BUILT_HEADERS = avconfig.h
-
-OBJS = adler32.o                                                        \
-       aes.o                                                            \
-       avstring.o                                                       \
-       base64.o                                                         \
-       crc.o                                                            \
-       des.o                                                            \
-       error.o                                                          \
-       fifo.o                                                           \
-       intfloat_readwrite.o                                             \
-       lfg.o                                                            \
-       lls.o                                                            \
-       log.o                                                            \
-       lzo.o                                                            \
-       mathematics.o                                                    \
-       md5.o                                                            \
-       mem.o                                                            \
-       pixdesc.o                                                        \
-       random_seed.o                                                    \
-       rational.o                                                       \
-       rc4.o                                                            \
-       sha.o                                                            \
-       tree.o                                                           \
-       utils.o                                                          \
-
-TESTPROGS = adler32 aes base64 crc des lls md5 pca sha softfloat tree
-TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
-
-DIRS = arm bfin sh4 x86
-
-ARCH_HEADERS = bswap.h intmath.h intreadwrite.h timer.h
-
-include $(SUBDIR)../subdir.mak
-
-$(SUBDIR)lzo-test$(EXESUF): ELIBS = -llzo2
diff --git a/libavutil/adler32.c b/libavutil/adler32.c
deleted file mode 100644
index 4f20010..0000000
--- a/libavutil/adler32.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Compute the Adler-32 checksum of a data stream.
- * This is a modified version based on adler32.c from the zlib library.
- *
- * Copyright (C) 1995 Mark Adler
- *
- * This software is provided 'as-is', without any express or implied
- * warranty.  In no event will the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- *
- * 1. The origin of this software must not be misrepresented; you must not
- *    claim that you wrote the original software. If you use this software
- *    in a product, an acknowledgment in the product documentation would be
- *    appreciated but is not required.
- * 2. Altered source versions must be plainly marked as such, and must not be
- *    misrepresented as being the original software.
- * 3. This notice may not be removed or altered from any source distribution.
- */
-
-#include "config.h"
-#include "adler32.h"
-
-#define BASE 65521L /* largest prime smaller than 65536 */
-
-#define DO1(buf)  {s1 += *buf++; s2 += s1;}
-#define DO4(buf)  DO1(buf); DO1(buf); DO1(buf); DO1(buf);
-#define DO16(buf) DO4(buf); DO4(buf); DO4(buf); DO4(buf);
-
-unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len)
-{
-    unsigned long s1 = adler & 0xffff;
-    unsigned long s2 = adler >> 16;
-
-    while (len>0) {
-#if CONFIG_SMALL
-        while(len>4 && s2 < (1U<<31)){
-            DO4(buf); len-=4;
-#else
-        while(len>16 && s2 < (1U<<31)){
-            DO16(buf); len-=16;
-#endif
-        }
-        DO1(buf); len--;
-        s1 %= BASE;
-        s2 %= BASE;
-    }
-    return (s2 << 16) | s1;
-}
-
-#ifdef TEST
-#include "log.h"
-#include "timer.h"
-#define LEN 7001
-volatile int checksum;
-int main(void){
-    int i;
-    char data[LEN];
-    av_log_set_level(AV_LOG_DEBUG);
-    for(i=0; i<LEN; i++)
-        data[i]= ((i*i)>>3) + 123*i;
-    for(i=0; i<1000; i++){
-        START_TIMER
-        checksum= av_adler32_update(1, data, LEN);
-        STOP_TIMER("adler")
-    }
-    av_log(NULL, AV_LOG_DEBUG, "%X == 50E6E508\n", checksum);
-    return 0;
-}
-#endif
diff --git a/libavutil/adler32.h b/libavutil/adler32.h
deleted file mode 100644
index 9626c80..0000000
--- a/libavutil/adler32.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * copyright (c) 2006 Mans Rullgard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_ADLER32_H
-#define AVUTIL_ADLER32_H
-
-#include <stdint.h>
-#include "attributes.h"
-
-unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
-                                unsigned int len) av_pure;
-
-#endif /* AVUTIL_ADLER32_H */
diff --git a/libavutil/aes.c b/libavutil/aes.c
deleted file mode 100644
index d3a271c..0000000
--- a/libavutil/aes.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * copyright (c) 2007 Michael Niedermayer <michaelni at gmx.at>
- *
- * some optimization ideas from aes128.c by Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "common.h"
-#include "aes.h"
-
-typedef struct AVAES{
-    // Note: round_key[16] is accessed in the init code, but this only
-    // overwrites state, which does not matter (see also r7471).
-    uint8_t round_key[15][4][4];
-    uint8_t state[2][4][4];
-    int rounds;
-}AVAES;
-
-const int av_aes_size= sizeof(AVAES);
-
-static const uint8_t rcon[10] = {
-  0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36
-};
-
-static uint8_t     sbox[256];
-static uint8_t inv_sbox[256];
-#if CONFIG_SMALL
-static uint32_t enc_multbl[1][256];
-static uint32_t dec_multbl[1][256];
-#else
-static uint32_t enc_multbl[4][256];
-static uint32_t dec_multbl[4][256];
-#endif
-
-static inline void addkey(uint64_t dst[2], const uint64_t src[2], const uint64_t round_key[2]){
-    dst[0] = src[0] ^ round_key[0];
-    dst[1] = src[1] ^ round_key[1];
-}
-
-static void subshift(uint8_t s0[2][16], int s, const uint8_t *box){
-    uint8_t (*s1)[16]= s0[0] - s;
-    uint8_t (*s3)[16]= s0[0] + s;
-    s0[0][0]=box[s0[1][ 0]]; s0[0][ 4]=box[s0[1][ 4]]; s0[0][ 8]=box[s0[1][ 8]]; s0[0][12]=box[s0[1][12]];
-    s1[0][3]=box[s1[1][ 7]]; s1[0][ 7]=box[s1[1][11]]; s1[0][11]=box[s1[1][15]]; s1[0][15]=box[s1[1][ 3]];
-    s0[0][2]=box[s0[1][10]]; s0[0][10]=box[s0[1][ 2]]; s0[0][ 6]=box[s0[1][14]]; s0[0][14]=box[s0[1][ 6]];
-    s3[0][1]=box[s3[1][13]]; s3[0][13]=box[s3[1][ 9]]; s3[0][ 9]=box[s3[1][ 5]]; s3[0][ 5]=box[s3[1][ 1]];
-}
-
-static inline int mix_core(uint32_t multbl[4][256], int a, int b, int c, int d){
-#if CONFIG_SMALL
-#define ROT(x,s) ((x<<s)|(x>>(32-s)))
-    return multbl[0][a] ^ ROT(multbl[0][b], 8) ^ ROT(multbl[0][c], 16) ^ ROT(multbl[0][d], 24);
-#else
-    return multbl[0][a] ^ multbl[1][b] ^ multbl[2][c] ^ multbl[3][d];
-#endif
-}
-
-static inline void mix(uint8_t state[2][4][4], uint32_t multbl[4][256], int s1, int s3){
-    ((uint32_t *)(state))[0] = mix_core(multbl, state[1][0][0], state[1][s1  ][1], state[1][2][2], state[1][s3  ][3]);
-    ((uint32_t *)(state))[1] = mix_core(multbl, state[1][1][0], state[1][s3-1][1], state[1][3][2], state[1][s1-1][3]);
-    ((uint32_t *)(state))[2] = mix_core(multbl, state[1][2][0], state[1][s3  ][1], state[1][0][2], state[1][s1  ][3]);
-    ((uint32_t *)(state))[3] = mix_core(multbl, state[1][3][0], state[1][s1-1][1], state[1][1][2], state[1][s3-1][3]);
-}
-
-static inline void crypt(AVAES *a, int s, const uint8_t *sbox, const uint32_t *multbl){
-    int r;
-
-    for(r=a->rounds-1; r>0; r--){
-        mix(a->state, multbl, 3-s, 1+s);
-        addkey(a->state[1], a->state[0], a->round_key[r]);
-    }
-    subshift(a->state[0][0], s, sbox);
-}
-
-void av_aes_crypt(AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt){
-    while(count--){
-        addkey(a->state[1], src, a->round_key[a->rounds]);
-        if(decrypt) {
-            crypt(a, 0, inv_sbox, dec_multbl);
-            if(iv){
-                addkey(a->state[0], a->state[0], iv);
-                memcpy(iv, src, 16);
-            }
-            addkey(dst, a->state[0], a->round_key[0]);
-        }else{
-            if(iv) addkey(a->state[1], a->state[1], iv);
-            crypt(a, 2,     sbox, enc_multbl);
-            addkey(dst, a->state[0], a->round_key[0]);
-            if(iv) memcpy(iv, dst, 16);
-        }
-        src+=16;
-        dst+=16;
-    }
-}
-
-static void init_multbl2(uint8_t tbl[1024], const int c[4], const uint8_t *log8, const uint8_t *alog8, const uint8_t *sbox){
-    int i, j;
-    for(i=0; i<1024; i++){
-        int x= sbox[i>>2];
-        if(x) tbl[i]= alog8[ log8[x] + log8[c[i&3]] ];
-    }
-#if !CONFIG_SMALL
-    for(j=256; j<1024; j++)
-        for(i=0; i<4; i++)
-            tbl[4*j+i]= tbl[4*j + ((i-1)&3) - 1024];
-#endif
-}
-
-// this is based on the reference AES code by Paulo Barreto and Vincent Rijmen
-int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) {
-    int i, j, t, rconpointer = 0;
-    uint8_t tk[8][4];
-    int KC= key_bits>>5;
-    int rounds= KC + 6;
-    uint8_t  log8[256];
-    uint8_t alog8[512];
-
-    if(!enc_multbl[0][sizeof(enc_multbl)/sizeof(enc_multbl[0][0])-1]){
-        j=1;
-        for(i=0; i<255; i++){
-            alog8[i]=
-            alog8[i+255]= j;
-            log8[j]= i;
-            j^= j+j;
-            if(j>255) j^= 0x11B;
-        }
-        for(i=0; i<256; i++){
-            j= i ? alog8[255-log8[i]] : 0;
-            j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4);
-            j = (j ^ (j>>8) ^ 99) & 255;
-            inv_sbox[j]= i;
-            sbox    [i]= j;
-        }
-        init_multbl2(dec_multbl[0], (const int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox);
-        init_multbl2(enc_multbl[0], (const int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox);
-    }
-
-    if(key_bits!=128 && key_bits!=192 && key_bits!=256)
-        return -1;
-
-    a->rounds= rounds;
-
-    memcpy(tk, key, KC*4);
-
-    for(t= 0; t < (rounds+1)*16;) {
-        memcpy(a->round_key[0][0]+t, tk, KC*4);
-        t+= KC*4;
-
-        for(i = 0; i < 4; i++)
-            tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]];
-        tk[0][0] ^= rcon[rconpointer++];
-
-        for(j = 1; j < KC; j++){
-            if(KC != 8 || j != KC>>1)
-                for(i = 0; i < 4; i++) tk[j][i] ^=      tk[j-1][i];
-            else
-                for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]];
-        }
-    }
-
-    if(decrypt){
-        for(i=1; i<rounds; i++){
-            uint8_t tmp[3][16];
-            memcpy(tmp[2], a->round_key[i][0], 16);
-            subshift(tmp[1], 0, sbox);
-            mix(tmp, dec_multbl, 1, 3);
-            memcpy(a->round_key[i][0], tmp[0], 16);
-        }
-    }else{
-        for(i=0; i<(rounds+1)>>1; i++){
-            for(j=0; j<16; j++)
-                FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]);
-        }
-    }
-
-    return 0;
-}
-
-#ifdef TEST
-#include "lfg.h"
-#include "log.h"
-
-int main(void){
-    int i,j;
-    AVAES ae, ad, b;
-    uint8_t rkey[2][16]= {
-        {0},
-        {0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3, 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59}};
-    uint8_t pt[16], rpt[2][16]= {
-        {0x6a, 0x84, 0x86, 0x7c, 0xd7, 0x7e, 0x12, 0xad, 0x07, 0xea, 0x1b, 0xe8, 0x95, 0xc5, 0x3f, 0xa3},
-        {0}};
-    uint8_t rct[2][16]= {
-        {0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7, 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf},
-        {0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65}};
-    uint8_t temp[16];
-    AVLFG prng;
-
-    av_aes_init(&ae, "PI=3.141592654..", 128, 0);
-    av_aes_init(&ad, "PI=3.141592654..", 128, 1);
-    av_log_set_level(AV_LOG_DEBUG);
-    av_lfg_init(&prng, 1);
-
-    for(i=0; i<2; i++){
-        av_aes_init(&b, rkey[i], 128, 1);
-        av_aes_crypt(&b, temp, rct[i], 1, NULL, 1);
-        for(j=0; j<16; j++)
-            if(rpt[i][j] != temp[j])
-                av_log(NULL, AV_LOG_ERROR, "%d %02X %02X\n", j, rpt[i][j], temp[j]);
-    }
-
-    for(i=0; i<10000; i++){
-        for(j=0; j<16; j++){
-            pt[j] = av_lfg_get(&prng);
-        }
-{START_TIMER
-        av_aes_crypt(&ae, temp, pt, 1, NULL, 0);
-        if(!(i&(i-1)))
-            av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", temp[0], temp[5], temp[10], temp[15]);
-        av_aes_crypt(&ad, temp, temp, 1, NULL, 1);
-STOP_TIMER("aes")}
-        for(j=0; j<16; j++){
-            if(pt[j] != temp[j]){
-                av_log(NULL, AV_LOG_ERROR, "%d %d %02X %02X\n", i,j, pt[j], temp[j]);
-            }
-        }
-    }
-    return 0;
-}
-#endif
diff --git a/libavutil/aes.h b/libavutil/aes.h
deleted file mode 100644
index 1ca853d..0000000
--- a/libavutil/aes.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * copyright (c) 2007 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_AES_H
-#define AVUTIL_AES_H
-
-#include <stdint.h>
-
-extern const int av_aes_size;
-
-struct AVAES;
-
-/**
- * Initializes an AVAES context.
- * @param key_bits 128, 192 or 256
- * @param decrypt 0 for encryption, 1 for decryption
- */
-int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt);
-
-/**
- * Encrypts / decrypts.
- * @param count number of 16 byte blocks
- * @param dst destination array, can be equal to src
- * @param src source array, can be equal to dst
- * @param iv initialization vector for CBC mode, if NULL then ECB will be used
- * @param decrypt 0 for encryption, 1 for decryption
- */
-void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
-
-#endif /* AVUTIL_AES_H */
diff --git a/libavutil/arm/bswap.h b/libavutil/arm/bswap.h
deleted file mode 100644
index 9126350..0000000
--- a/libavutil/arm/bswap.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_ARM_BSWAP_H
-#define AVUTIL_ARM_BSWAP_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/attributes.h"
-
-#ifdef __ARMCC_VERSION
-
-#if HAVE_ARMV6
-#define bswap_16 bswap_16
-static av_always_inline av_const unsigned bswap_16(unsigned x)
-{
-    __asm { rev16 x, x }
-    return x;
-}
-
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
-{
-    return __rev(x);
-}
-#endif /* HAVE_ARMV6 */
-
-#elif HAVE_INLINE_ASM
-
-#if HAVE_ARMV6
-#define bswap_16 bswap_16
-static av_always_inline av_const unsigned bswap_16(unsigned x)
-{
-    __asm__("rev16 %0, %0" : "+r"(x));
-    return x;
-}
-#endif
-
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
-{
-#if HAVE_ARMV6
-    __asm__("rev %0, %0" : "+r"(x));
-#else
-    uint32_t t;
-    __asm__ ("eor %1, %0, %0, ror #16 \n\t"
-             "bic %1, %1, #0xFF0000   \n\t"
-             "mov %0, %0, ror #8      \n\t"
-             "eor %0, %0, %1, lsr #8  \n\t"
-             : "+r"(x), "=&r"(t));
-#endif /* HAVE_ARMV6 */
-    return x;
-}
-
-#endif /* __ARMCC_VERSION */
-
-#endif /* AVUTIL_ARM_BSWAP_H */
diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h
deleted file mode 100644
index 48a05ea..0000000
--- a/libavutil/arm/intmath.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_ARM_INTMATH_H
-#define AVUTIL_ARM_INTMATH_H
-
-#include "config.h"
-#include "libavutil/attributes.h"
-
-#if HAVE_INLINE_ASM
-
-#if HAVE_ARMV6
-static inline av_const int FASTDIV(int a, int b)
-{
-    int r, t;
-    __asm__ volatile("cmp     %3, #2               \n\t"
-                     "ldr     %1, [%4, %3, lsl #2] \n\t"
-                     "lsrle   %0, %2, #1           \n\t"
-                     "smmulgt %0, %1, %2           \n\t"
-                     : "=&r"(r), "=&r"(t) : "r"(a), "r"(b), "r"(ff_inverse));
-    return r;
-}
-#else
-static inline av_const int FASTDIV(int a, int b)
-{
-    int r, t;
-    __asm__ volatile("umull %1, %0, %2, %3"
-                     : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b]));
-    return r;
-}
-#endif
-
-#define FASTDIV FASTDIV
-
-#endif /* HAVE_INLINE_ASM */
-
-#endif /* AVUTIL_ARM_INTMATH_H */
diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h
deleted file mode 100644
index 011694d..0000000
--- a/libavutil/arm/intreadwrite.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_ARM_INTREADWRITE_H
-#define AVUTIL_ARM_INTREADWRITE_H
-
-#include <stdint.h>
-#include "config.h"
-
-#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM
-
-#define AV_RN16 AV_RN16
-static av_always_inline uint16_t AV_RN16(const void *p)
-{
-    uint16_t v;
-    __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p));
-    return v;
-}
-
-#define AV_WN16 AV_WN16
-static av_always_inline void AV_WN16(void *p, uint16_t v)
-{
-    __asm__ ("strh %1, %0" : "=m"(*(uint16_t *)p) : "r"(v));
-}
-
-#define AV_RN32 AV_RN32
-static av_always_inline uint32_t AV_RN32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("ldr  %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p));
-    return v;
-}
-
-#define AV_WN32 AV_WN32
-static av_always_inline void AV_WN32(void *p, uint32_t v)
-{
-    __asm__ ("str  %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
-}
-
-#define AV_RN64 AV_RN64
-static av_always_inline uint64_t AV_RN64(const void *p)
-{
-    union { uint64_t v; uint32_t hl[2]; } v;
-    __asm__ ("ldr   %0, %2  \n\t"
-             "ldr   %1, %3  \n\t"
-             : "=&r"(v.hl[0]), "=r"(v.hl[1])
-             : "m"(*(const uint32_t*)p), "m"(*((const uint32_t*)p+1)));
-    return v.v;
-}
-
-#define AV_WN64 AV_WN64
-static av_always_inline void AV_WN64(void *p, uint64_t v)
-{
-    union { uint64_t v; uint32_t hl[2]; } vv = { v };
-    __asm__ ("str  %2, %0  \n\t"
-             "str  %3, %1  \n\t"
-             : "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1))
-             : "r"(vv.hl[0]), "r"(vv.hl[1]));
-}
-
-#endif /* HAVE_INLINE_ASM */
-
-#endif /* AVUTIL_ARM_INTREADWRITE_H */
diff --git a/libavutil/arm/timer.h b/libavutil/arm/timer.h
deleted file mode 100644
index 5e8bc8e..0000000
--- a/libavutil/arm/timer.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_ARM_TIMER_H
-#define AVUTIL_ARM_TIMER_H
-
-#include <stdint.h>
-#include "config.h"
-
-#if HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__)
-
-#define AV_READ_TIME read_time
-
-static inline uint64_t read_time(void)
-{
-    unsigned cc;
-    __asm__ volatile ("mrc p15, 0, %0, c9, c13, 0" : "=r"(cc));
-    return cc;
-}
-
-#endif /* HAVE_INLINE_ASM && __ARM_ARCH_7A__ */
-
-#endif /* AVUTIL_ARM_TIMER_H */
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
deleted file mode 100644
index da45234..0000000
--- a/libavutil/attributes.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Macro definitions for various function/variable attributes
- */
-
-#ifndef AVUTIL_ATTRIBUTES_H
-#define AVUTIL_ATTRIBUTES_H
-
-#ifdef __GNUC__
-#    define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
-#else
-#    define AV_GCC_VERSION_AT_LEAST(x,y) 0
-#endif
-
-#ifndef av_always_inline
-#if AV_GCC_VERSION_AT_LEAST(3,1)
-#    define av_always_inline __attribute__((always_inline)) inline
-#else
-#    define av_always_inline inline
-#endif
-#endif
-
-#ifndef av_noinline
-#if AV_GCC_VERSION_AT_LEAST(3,1)
-#    define av_noinline __attribute__((noinline))
-#else
-#    define av_noinline
-#endif
-#endif
-
-#ifndef av_pure
-#if AV_GCC_VERSION_AT_LEAST(3,1)
-#    define av_pure __attribute__((pure))
-#else
-#    define av_pure
-#endif
-#endif
-
-#ifndef av_const
-#if AV_GCC_VERSION_AT_LEAST(2,6)
-#    define av_const __attribute__((const))
-#else
-#    define av_const
-#endif
-#endif
-
-#ifndef av_cold
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
-#    define av_cold __attribute__((cold))
-#else
-#    define av_cold
-#endif
-#endif
-
-#ifndef av_flatten
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1)
-#    define av_flatten __attribute__((flatten))
-#else
-#    define av_flatten
-#endif
-#endif
-
-#ifndef attribute_deprecated
-#if AV_GCC_VERSION_AT_LEAST(3,1)
-#    define attribute_deprecated __attribute__((deprecated))
-#else
-#    define attribute_deprecated
-#endif
-#endif
-
-#ifndef av_unused
-#if defined(__GNUC__)
-#    define av_unused __attribute__((unused))
-#else
-#    define av_unused
-#endif
-#endif
-
-#ifndef av_uninit
-#if defined(__GNUC__) && !defined(__ICC)
-#    define av_uninit(x) x=x
-#else
-#    define av_uninit(x) x
-#endif
-#endif
-
-#ifdef __GNUC__
-#    define av_builtin_constant_p __builtin_constant_p
-#else
-#    define av_builtin_constant_p(x) 0
-#endif
-
-#endif /* AVUTIL_ATTRIBUTES_H */
diff --git a/libavutil/avr32/bswap.h b/libavutil/avr32/bswap.h
deleted file mode 100644
index e8c8ddc..0000000
--- a/libavutil/avr32/bswap.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_AVR32_BSWAP_H
-#define AVUTIL_AVR32_BSWAP_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/attributes.h"
-
-#if HAVE_INLINE_ASM
-
-#define bswap_16 bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
-{
-    __asm__ ("swap.bh %0" : "+r"(x));
-    return x;
-}
-
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
-{
-    __asm__ ("swap.b  %0" : "+r"(x));
-    return x;
-}
-
-#endif /* HAVE_INLINE_ASM */
-
-#endif /* AVUTIL_AVR32_BSWAP_H */
diff --git a/libavutil/avr32/intreadwrite.h b/libavutil/avr32/intreadwrite.h
deleted file mode 100644
index 3e468b4..0000000
--- a/libavutil/avr32/intreadwrite.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_AVR32_INTREADWRITE_H
-#define AVUTIL_AVR32_INTREADWRITE_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/bswap.h"
-
-/*
- * AVR32 does not support unaligned memory accesses, except for the AP
- * series which suppports unaligned 32-bit loads and stores.  16-bit
- * and 64-bit accesses must be aligned to 16 and 32 bits, respectively.
- * This means we cannot use the byte-swapping load/store instructions
- * here.
- *
- * For 16-bit, 24-bit, and (on UC series) 32-bit loads, we instead use
- * the LDINS.B instruction, which gcc fails to utilise with the
- * generic code.  GCC also fails to use plain LD.W and ST.W even for
- * AP processors, so we override the generic code.  The 64-bit
- * versions are improved by using our optimised 32-bit functions.
- */
-
-#define AV_RL16 AV_RL16
-static av_always_inline uint16_t AV_RL16(const void *p)
-{
-    uint16_t v;
-    __asm__ ("ld.ub    %0,   %1  \n\t"
-             "ldins.b  %0:l, %2  \n\t"
-             : "=&r"(v)
-             : "m"(*(const uint8_t*)p), "RKs12"(*((const uint8_t*)p+1)));
-    return v;
-}
-
-#define AV_RB16 AV_RB16
-static av_always_inline uint16_t AV_RB16(const void *p)
-{
-    uint16_t v;
-    __asm__ ("ld.ub    %0,   %2  \n\t"
-             "ldins.b  %0:l, %1  \n\t"
-             : "=&r"(v)
-             : "RKs12"(*(const uint8_t*)p), "m"(*((const uint8_t*)p+1)));
-    return v;
-}
-
-#define AV_RB24 AV_RB24
-static av_always_inline uint32_t AV_RB24(const void *p)
-{
-    uint32_t v;
-    __asm__ ("ld.ub    %0,   %3  \n\t"
-             "ldins.b  %0:l, %2  \n\t"
-             "ldins.b  %0:u, %1  \n\t"
-             : "=&r"(v)
-             : "RKs12"(* (const uint8_t*)p),
-               "RKs12"(*((const uint8_t*)p+1)),
-               "m"    (*((const uint8_t*)p+2)));
-    return v;
-}
-
-#define AV_RL24 AV_RL24
-static av_always_inline uint32_t AV_RL24(const void *p)
-{
-    uint32_t v;
-    __asm__ ("ld.ub    %0,   %1  \n\t"
-             "ldins.b  %0:l, %2  \n\t"
-             "ldins.b  %0:u, %3  \n\t"
-             : "=&r"(v)
-             : "m"    (* (const uint8_t*)p),
-               "RKs12"(*((const uint8_t*)p+1)),
-               "RKs12"(*((const uint8_t*)p+2)));
-    return v;
-}
-
-#if ARCH_AVR32_AP
-
-#define AV_RB32 AV_RB32
-static av_always_inline uint32_t AV_RB32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("ld.w %0, %1" : "=r"(v) : "m"(*(const uint32_t*)p));
-    return v;
-}
-
-#define AV_WB32 AV_WB32
-static av_always_inline void AV_WB32(void *p, uint32_t v)
-{
-    __asm__ ("st.w %0, %1" : "=m"(*(uint32_t*)p) : "r"(v));
-}
-
-/* These two would be defined by generic code, but we need them sooner. */
-#define AV_RL32(p)    bswap_32(AV_RB32(p))
-#define AV_WL32(p, v) AV_WB32(p, bswap_32(v))
-
-#define AV_WB64 AV_WB64
-static av_always_inline void AV_WB64(void *p, uint64_t v)
-{
-    union { uint64_t v; uint32_t hl[2]; } vv = { v };
-    AV_WB32(p, vv.hl[0]);
-    AV_WB32((uint32_t*)p+1, vv.hl[1]);
-}
-
-#define AV_WL64 AV_WL64
-static av_always_inline void AV_WL64(void *p, uint64_t v)
-{
-    union { uint64_t v; uint32_t hl[2]; } vv = { v };
-    AV_WL32(p, vv.hl[1]);
-    AV_WL32((uint32_t*)p+1, vv.hl[0]);
-}
-
-#else /* ARCH_AVR32_AP */
-
-#define AV_RB32 AV_RB32
-static av_always_inline uint32_t AV_RB32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("ld.ub    %0,   %4  \n\t"
-             "ldins.b  %0:l, %3  \n\t"
-             "ldins.b  %0:u, %2  \n\t"
-             "ldins.b  %0:t, %1  \n\t"
-             : "=&r"(v)
-             : "RKs12"(* (const uint8_t*)p),
-               "RKs12"(*((const uint8_t*)p+1)),
-               "RKs12"(*((const uint8_t*)p+2)),
-               "m"    (*((const uint8_t*)p+3)));
-    return v;
-}
-
-#define AV_RL32 AV_RL32
-static av_always_inline uint32_t AV_RL32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("ld.ub    %0,   %1  \n\t"
-             "ldins.b  %0:l, %2  \n\t"
-             "ldins.b  %0:u, %3  \n\t"
-             "ldins.b  %0:t, %4  \n\t"
-             : "=&r"(v)
-             : "m"    (* (const uint8_t*)p),
-               "RKs12"(*((const uint8_t*)p+1)),
-               "RKs12"(*((const uint8_t*)p+2)),
-               "RKs12"(*((const uint8_t*)p+3)));
-    return v;
-}
-
-#endif /* ARCH_AVR32_AP */
-
-#define AV_RB64 AV_RB64
-static av_always_inline uint64_t AV_RB64(const void *p)
-{
-    union { uint64_t v; uint32_t hl[2]; } v;
-    v.hl[0] = AV_RB32(p);
-    v.hl[1] = AV_RB32((const uint32_t*)p+1);
-    return v.v;
-}
-
-#define AV_RL64 AV_RL64
-static av_always_inline uint64_t AV_RL64(const void *p)
-{
-    union { uint64_t v; uint32_t hl[2]; } v;
-    v.hl[1] = AV_RL32(p);
-    v.hl[0] = AV_RL32((const uint32_t*)p+1);
-    return v.v;
-}
-
-#endif /* AVUTIL_AVR32_INTREADWRITE_H */
diff --git a/libavutil/avstring.c b/libavutil/avstring.c
deleted file mode 100644
index 4844e28..0000000
--- a/libavutil/avstring.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * Copyright (c) 2007 Mans Rullgard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include "avstring.h"
-#include "mem.h"
-
-int av_strstart(const char *str, const char *pfx, const char **ptr)
-{
-    while (*pfx && *pfx == *str) {
-        pfx++;
-        str++;
-    }
-    if (!*pfx && ptr)
-        *ptr = str;
-    return !*pfx;
-}
-
-int av_stristart(const char *str, const char *pfx, const char **ptr)
-{
-    while (*pfx && toupper((unsigned)*pfx) == toupper((unsigned)*str)) {
-        pfx++;
-        str++;
-    }
-    if (!*pfx && ptr)
-        *ptr = str;
-    return !*pfx;
-}
-
-char *av_stristr(const char *s1, const char *s2)
-{
-    if (!*s2)
-        return s1;
-
-    do {
-        if (av_stristart(s1, s2, NULL))
-            return s1;
-    } while (*s1++);
-
-    return NULL;
-}
-
-size_t av_strlcpy(char *dst, const char *src, size_t size)
-{
-    size_t len = 0;
-    while (++len < size && *src)
-        *dst++ = *src++;
-    if (len <= size)
-        *dst = 0;
-    return len + strlen(src) - 1;
-}
-
-size_t av_strlcat(char *dst, const char *src, size_t size)
-{
-    size_t len = strlen(dst);
-    if (size <= len + 1)
-        return len + strlen(src);
-    return len + av_strlcpy(dst + len, src, size - len);
-}
-
-size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
-{
-    int len = strlen(dst);
-    va_list vl;
-
-    va_start(vl, fmt);
-    len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
-    va_end(vl);
-
-    return len;
-}
-
-char *av_d2str(double d)
-{
-    char *str= av_malloc(16);
-    if(str) snprintf(str, 16, "%f", d);
-    return str;
-}
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
deleted file mode 100644
index 01c2391..0000000
--- a/libavutil/avstring.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2007 Mans Rullgard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_AVSTRING_H
-#define AVUTIL_AVSTRING_H
-
-#include <stddef.h>
-
-/**
- * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to
- * the address of the first character in str after the prefix.
- *
- * @param str input string
- * @param pfx prefix to test
- * @param ptr updated if the prefix is matched inside str
- * @return non-zero if the prefix matches, zero otherwise
- */
-int av_strstart(const char *str, const char *pfx, const char **ptr);
-
-/**
- * Return non-zero if pfx is a prefix of str independent of case. If
- * it is, *ptr is set to the address of the first character in str
- * after the prefix.
- *
- * @param str input string
- * @param pfx prefix to test
- * @param ptr updated if the prefix is matched inside str
- * @return non-zero if the prefix matches, zero otherwise
- */
-int av_stristart(const char *str, const char *pfx, const char **ptr);
-
-/**
- * Locate the first case-independent occurrence in the string haystack
- * of the string needle.  A zero-length string needle is considered to
- * match at the start of haystack.
- *
- * This function is a case-insensitive version of the standard strstr().
- *
- * @param haystack string to search in
- * @param needle   string to search for
- * @return         pointer to the located match within haystack
- *                 or a null pointer if no match
- */
-char *av_stristr(const char *haystack, const char *needle);
-
-/**
- * Copy the string src to dst, but no more than size - 1 bytes, and
- * null-terminate dst.
- *
- * This function is the same as BSD strlcpy().
- *
- * @param dst destination buffer
- * @param src source string
- * @param size size of destination buffer
- * @return the length of src
- *
- * WARNING: since the return value is the length of src, src absolutely
- * _must_ be a properly 0-terminated string, otherwise this will read beyond
- * the end of the buffer and possibly crash.
- */
-size_t av_strlcpy(char *dst, const char *src, size_t size);
-
-/**
- * Append the string src to the string dst, but to a total length of
- * no more than size - 1 bytes, and null-terminate dst.
- *
- * This function is similar to BSD strlcat(), but differs when
- * size <= strlen(dst).
- *
- * @param dst destination buffer
- * @param src source string
- * @param size size of destination buffer
- * @return the total length of src and dst
- *
- * WARNING: since the return value use the length of src and dst, these absolutely
- * _must_ be a properly 0-terminated strings, otherwise this will read beyond
- * the end of the buffer and possibly crash.
- */
-size_t av_strlcat(char *dst, const char *src, size_t size);
-
-/**
- * Append output to a string, according to a format. Never write out of
- * the destination buffer, and always put a terminating 0 within
- * the buffer.
- * @param dst destination buffer (string to which the output is
- *  appended)
- * @param size total size of the destination buffer
- * @param fmt printf-compatible format string, specifying how the
- *  following parameters are used
- * @return the length of the string that would have been generated
- *  if enough space had been available
- */
-size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...);
-
-/**
- * Convert a number to a av_malloced string.
- */
-char *av_d2str(double d);
-
-#endif /* AVUTIL_AVSTRING_H */
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
deleted file mode 100644
index e9e07b9..0000000
--- a/libavutil/avutil.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_AVUTIL_H
-#define AVUTIL_AVUTIL_H
-
-/**
- * @file
- * external API header
- */
-
-
-#define AV_STRINGIFY(s)         AV_TOSTRING(s)
-#define AV_TOSTRING(s) #s
-
-#define AV_GLUE(a, b) a ## b
-#define AV_JOIN(a, b) AV_GLUE(a, b)
-
-#define AV_PRAGMA(s) _Pragma(#s)
-
-#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
-#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
-#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
-
-#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 15
-#define LIBAVUTIL_VERSION_MICRO  1
-
-#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-                                               LIBAVUTIL_VERSION_MINOR, \
-                                               LIBAVUTIL_VERSION_MICRO)
-#define LIBAVUTIL_VERSION       AV_VERSION(LIBAVUTIL_VERSION_MAJOR,     \
-                                           LIBAVUTIL_VERSION_MINOR,     \
-                                           LIBAVUTIL_VERSION_MICRO)
-#define LIBAVUTIL_BUILD         LIBAVUTIL_VERSION_INT
-
-#define LIBAVUTIL_IDENT         "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
-
-/**
- * Returns the LIBAVUTIL_VERSION_INT constant.
- */
-unsigned avutil_version(void);
-
-/**
- * Returns the libavutil build-time configuration.
- */
-const char *avutil_configuration(void);
-
-/**
- * Returns the libavutil license.
- */
-const char *avutil_license(void);
-
-enum AVMediaType {
-    AVMEDIA_TYPE_UNKNOWN = -1,
-    AVMEDIA_TYPE_VIDEO,
-    AVMEDIA_TYPE_AUDIO,
-    AVMEDIA_TYPE_DATA,
-    AVMEDIA_TYPE_SUBTITLE,
-    AVMEDIA_TYPE_ATTACHMENT,
-    AVMEDIA_TYPE_NB
-};
-
-#include "common.h"
-#include "error.h"
-#include "mathematics.h"
-#include "rational.h"
-#include "intfloat_readwrite.h"
-#include "log.h"
-#include "pixfmt.h"
-
-#endif /* AVUTIL_AVUTIL_H */
diff --git a/libavutil/base64.c b/libavutil/base64.c
deleted file mode 100644
index d84ca36..0000000
--- a/libavutil/base64.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2006 Ryan Martell. (rdm4 at martellventures.com)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * @brief Base64 encode/decode
- * @author Ryan Martell <rdm4 at martellventures.com> (with lots of Michael)
- */
-
-#include "common.h"
-#include "base64.h"
-
-/* ---------------- private code */
-static const uint8_t map2[] =
-{
-    0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36,
-    0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff,
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01,
-    0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
-    0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
-    0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
-    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b,
-    0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
-    0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b,
-    0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33
-};
-
-int av_base64_decode(uint8_t *out, const char *in, int out_size)
-{
-    int i, v;
-    uint8_t *dst = out;
-
-    v = 0;
-    for (i = 0; in[i] && in[i] != '='; i++) {
-        unsigned int index= in[i]-43;
-        if (index>=FF_ARRAY_ELEMS(map2) || map2[index] == 0xff)
-            return -1;
-        v = (v << 6) + map2[index];
-        if (i & 3) {
-            if (dst - out < out_size) {
-                *dst++ = v >> (6 - 2 * (i & 3));
-            }
-        }
-    }
-
-    return dst - out;
-}
-
-/*****************************************************************************
-* b64_encode: Stolen from VLC's http.c.
-* Simplified by Michael.
-* Fixed edge cases and made it work from data (vs. strings) by Ryan.
-*****************************************************************************/
-
-char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
-{
-    static const char b64[] =
-        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-    char *ret, *dst;
-    unsigned i_bits = 0;
-    int i_shift = 0;
-    int bytes_remaining = in_size;
-
-    if (in_size >= UINT_MAX / 4 ||
-        out_size < (in_size+2) / 3 * 4 + 1)
-        return NULL;
-    ret = dst = out;
-    while (bytes_remaining) {
-        i_bits = (i_bits << 8) + *in++;
-        bytes_remaining--;
-        i_shift += 8;
-
-        do {
-            *dst++ = b64[(i_bits << 6 >> i_shift) & 0x3f];
-            i_shift -= 6;
-        } while (i_shift > 6 || (bytes_remaining == 0 && i_shift > 0));
-    }
-    while ((dst - ret) & 3)
-        *dst++ = '=';
-    *dst = '\0';
-
-    return ret;
-}
-
-#ifdef TEST
-
-#undef printf
-
-#define MAX_DATA_SIZE    1024
-#define MAX_ENCODED_SIZE 2048
-
-static int test_encode_decode(const uint8_t *data, unsigned int data_size,
-                              const char *encoded_ref)
-{
-    char  encoded[MAX_ENCODED_SIZE];
-    uint8_t data2[MAX_DATA_SIZE];
-    int data2_size, max_data2_size = MAX_DATA_SIZE;
-
-    if (!av_base64_encode(encoded, MAX_ENCODED_SIZE, data, data_size)) {
-        printf("Failed: cannot encode the input data\n");
-        return 1;
-    }
-    if (encoded_ref && strcmp(encoded, encoded_ref)) {
-        printf("Failed: encoded string differs from reference\n"
-               "Encoded:\n%s\nReference:\n%s\n", encoded, encoded_ref);
-        return 1;
-    }
-
-    if ((data2_size = av_base64_decode(data2, encoded, max_data2_size)) < 0) {
-        printf("Failed: cannot decode the encoded string\n"
-               "Encoded:\n%s\n", encoded);
-        return 1;
-    }
-    if (memcmp(data2, data, data_size)) {
-        printf("Failed: encoded/decoded data differs from original data\n");
-        return 1;
-    }
-
-    printf("Passed!\n");
-    return 0;
-}
-
-int main(void)
-{
-    int i, error_count = 0;
-    struct test {
-        const uint8_t *data;
-        const char *encoded_ref;
-    } tests[] = {
-        { "",        ""},
-        { "1",       "MQ=="},
-        { "22",      "MjI="},
-        { "333",     "MzMz"},
-        { "4444",    "NDQ0NA=="},
-        { "55555",   "NTU1NTU="},
-        { "666666",  "NjY2NjY2"},
-        { "abc:def", "YWJjOmRlZg=="},
-    };
-
-    printf("Encoding/decoding tests\n");
-    for (i = 0; i < FF_ARRAY_ELEMS(tests); i++)
-        error_count += test_encode_decode(tests[i].data, strlen(tests[i].data), tests[i].encoded_ref);
-
-    return error_count;
-}
-
-#endif
diff --git a/libavutil/base64.h b/libavutil/base64.h
deleted file mode 100644
index 103860e..0000000
--- a/libavutil/base64.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2006 Ryan Martell. (rdm4 at martellventures.com)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_BASE64_H
-#define AVUTIL_BASE64_H
-
-#include <stdint.h>
-
-/**
- * Decodes the base64-encoded string in in and puts the decoded
- * data in out.
- *
- * @param out_size size in bytes of the out buffer, it should be at
- * least 3/4 of the length of in
- * @return the number of bytes written, or a negative value in case of
- * error
- */
-int av_base64_decode(uint8_t *out, const char *in, int out_size);
-
-/**
- * Encodes in base64 the data in in and puts the resulting string
- * in out.
- *
- * @param out_size size in bytes of the out string, it should be at
- * least ((in_size + 2) / 3) * 4 + 1
- * @param in_size size in bytes of the in buffer
- * @return the string containing the encoded data, or NULL in case of
- * error
- */
-char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size);
-
-#endif /* AVUTIL_BASE64_H */
diff --git a/libavutil/bfin/bswap.h b/libavutil/bfin/bswap.h
deleted file mode 100644
index ccdfeb7..0000000
--- a/libavutil/bfin/bswap.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * byte swapping routines
- */
-
-#ifndef AVUTIL_BFIN_BSWAP_H
-#define AVUTIL_BFIN_BSWAP_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/attributes.h"
-
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
-{
-    unsigned tmp;
-    __asm__("%1 = %0 >> 8 (V);      \n\t"
-            "%0 = %0 << 8 (V);      \n\t"
-            "%0 = %0 | %1;          \n\t"
-            "%0 = PACK(%0.L, %0.H); \n\t"
-            : "+d"(x), "=&d"(tmp));
-    return x;
-}
-
-#endif /* AVUTIL_BFIN_BSWAP_H */
diff --git a/libavutil/bfin/timer.h b/libavutil/bfin/timer.h
deleted file mode 100644
index 644573d..0000000
--- a/libavutil/bfin/timer.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_BFIN_TIMER_H
-#define AVUTIL_BFIN_TIMER_H
-
-#include <stdint.h>
-
-#define AV_READ_TIME read_time
-
-static inline uint64_t read_time(void)
-{
-    union {
-        struct {
-            unsigned lo;
-            unsigned hi;
-        } p;
-        unsigned long long c;
-    } t;
-    __asm__ volatile ("%0=cycles; %1=cycles2;" : "=d" (t.p.lo), "=d" (t.p.hi));
-    return t.c;
-}
-
-#endif /* AVUTIL_BFIN_TIMER_H */
diff --git a/libavutil/bswap.h b/libavutil/bswap.h
deleted file mode 100644
index 6dd2a35..0000000
--- a/libavutil/bswap.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * byte swapping routines
- */
-
-#ifndef AVUTIL_BSWAP_H
-#define AVUTIL_BSWAP_H
-
-#include <stdint.h>
-#include "config.h"
-#include "attributes.h"
-
-#if   ARCH_ARM
-#   include "arm/bswap.h"
-#elif ARCH_AVR32
-#   include "avr32/bswap.h"
-#elif ARCH_BFIN
-#   include "bfin/bswap.h"
-#elif ARCH_SH4
-#   include "sh4/bswap.h"
-#elif ARCH_X86
-#   include "x86/bswap.h"
-#endif
-
-#define AV_BSWAP16C(x) (((x) << 8 & 0xff00)  | ((x) >> 8 & 0x00ff))
-#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16))
-#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32))
-
-#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x)
-
-#ifndef bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
-{
-    x= (x>>8) | (x<<8);
-    return x;
-}
-#endif
-
-#ifndef bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
-{
-    x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
-    x= (x>>16) | (x<<16);
-    return x;
-}
-#endif
-
-#ifndef bswap_64
-static inline uint64_t av_const bswap_64(uint64_t x)
-{
-#if 0
-    x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);
-    x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL);
-    return (x>>32) | (x<<32);
-#else
-    union {
-        uint64_t ll;
-        uint32_t l[2];
-    } w, r;
-    w.ll = x;
-    r.l[0] = bswap_32 (w.l[1]);
-    r.l[1] = bswap_32 (w.l[0]);
-    return r.ll;
-#endif
-}
-#endif
-
-// be2me ... big-endian to machine-endian
-// le2me ... little-endian to machine-endian
-
-#if HAVE_BIGENDIAN
-#define be2me_16(x) (x)
-#define be2me_32(x) (x)
-#define be2me_64(x) (x)
-#define le2me_16(x) bswap_16(x)
-#define le2me_32(x) bswap_32(x)
-#define le2me_64(x) bswap_64(x)
-#define AV_BE2MEC(s, x) (x)
-#define AV_LE2MEC(s, x) AV_BSWAPC(s, x)
-#else
-#define be2me_16(x) bswap_16(x)
-#define be2me_32(x) bswap_32(x)
-#define be2me_64(x) bswap_64(x)
-#define le2me_16(x) (x)
-#define le2me_32(x) (x)
-#define le2me_64(x) (x)
-#define AV_BE2MEC(s, x) AV_BSWAPC(s, x)
-#define AV_LE2MEC(s, x) (x)
-#endif
-
-#define AV_BE2ME16C(x) AV_BE2MEC(16, x)
-#define AV_BE2ME32C(x) AV_BE2MEC(32, x)
-#define AV_BE2ME64C(x) AV_BE2MEC(64, x)
-#define AV_LE2ME16C(x) AV_LE2MEC(16, x)
-#define AV_LE2ME32C(x) AV_LE2MEC(32, x)
-#define AV_LE2ME64C(x) AV_LE2MEC(64, x)
-
-#endif /* AVUTIL_BSWAP_H */
diff --git a/libavutil/common.h b/libavutil/common.h
deleted file mode 100644
index 4aa00a9..0000000
--- a/libavutil/common.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * common internal and external API header
- */
-
-#ifndef AVUTIL_COMMON_H
-#define AVUTIL_COMMON_H
-
-#include <ctype.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "attributes.h"
-
-//rounded division & shift
-#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
-/* assume b>0 */
-#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
-#define FFABS(a) ((a) >= 0 ? (a) : (-(a)))
-#define FFSIGN(a) ((a) > 0 ? 1 : -1)
-
-#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
-#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c)
-#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
-#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c)
-
-#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
-#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
-#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
-
-/* misc math functions */
-extern const uint8_t ff_log2_tab[256];
-
-extern const uint8_t av_reverse[256];
-
-static inline av_const int av_log2_c(unsigned int v)
-{
-    int n = 0;
-    if (v & 0xffff0000) {
-        v >>= 16;
-        n += 16;
-    }
-    if (v & 0xff00) {
-        v >>= 8;
-        n += 8;
-    }
-    n += ff_log2_tab[v];
-
-    return n;
-}
-
-static inline av_const int av_log2_16bit_c(unsigned int v)
-{
-    int n = 0;
-    if (v & 0xff00) {
-        v >>= 8;
-        n += 8;
-    }
-    n += ff_log2_tab[v];
-
-    return n;
-}
-
-#ifdef HAVE_AV_CONFIG_H
-#   include "config.h"
-#   include "intmath.h"
-#endif
-
-#ifndef av_log2
-#   define av_log2       av_log2_c
-#endif
-#ifndef av_log2_16bit
-#   define av_log2_16bit av_log2_16bit_c
-#endif
-
-/**
- * Clips a signed integer value into the amin-amax range.
- * @param a value to clip
- * @param amin minimum value of the clip range
- * @param amax maximum value of the clip range
- * @return clipped value
- */
-static inline av_const int av_clip(int a, int amin, int amax)
-{
-    if      (a < amin) return amin;
-    else if (a > amax) return amax;
-    else               return a;
-}
-
-/**
- * Clips a signed integer value into the 0-255 range.
- * @param a value to clip
- * @return clipped value
- */
-static inline av_const uint8_t av_clip_uint8(int a)
-{
-    if (a&(~0xFF)) return (-a)>>31;
-    else           return a;
-}
-
-/**
- * Clips a signed integer value into the 0-65535 range.
- * @param a value to clip
- * @return clipped value
- */
-static inline av_const uint16_t av_clip_uint16(int a)
-{
-    if (a&(~0xFFFF)) return (-a)>>31;
-    else             return a;
-}
-
-/**
- * Clips a signed integer value into the -32768,32767 range.
- * @param a value to clip
- * @return clipped value
- */
-static inline av_const int16_t av_clip_int16(int a)
-{
-    if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
-    else                      return a;
-}
-
-/**
- * Clips a signed 64-bit integer value into the -2147483648,2147483647 range.
- * @param a value to clip
- * @return clipped value
- */
-static inline av_const int32_t av_clipl_int32(int64_t a)
-{
-    if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
-    else                                         return a;
-}
-
-/**
- * Clips a float value into the amin-amax range.
- * @param a value to clip
- * @param amin minimum value of the clip range
- * @param amax maximum value of the clip range
- * @return clipped value
- */
-static inline av_const float av_clipf(float a, float amin, float amax)
-{
-    if      (a < amin) return amin;
-    else if (a > amax) return amax;
-    else               return a;
-}
-
-/** Computes ceil(log2(x)).
- * @param x value used to compute ceil(log2(x))
- * @return computed ceiling of log2(x)
- */
-static inline av_const int av_ceil_log2(int x)
-{
-    return av_log2((x - 1) << 1);
-}
-
-#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
-#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))
-
-/*!
- * \def GET_UTF8(val, GET_BYTE, ERROR)
- * Converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form
- * \param val is the output and should be of type uint32_t. It holds the converted
- * UCS-4 character and should be a left value.
- * \param GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be
- * a function or a statement whose return value or evaluated value is of type
- * uint8_t. It will be executed up to 4 times for values in the valid UTF-8 range,
- * and up to 7 times in the general case.
- * \param ERROR action that should be taken when an invalid UTF-8 byte is returned
- * from GET_BYTE. It should be a statement that jumps out of the macro,
- * like exit(), goto, return, break, or continue.
- */
-#define GET_UTF8(val, GET_BYTE, ERROR)\
-    val= GET_BYTE;\
-    {\
-        int ones= 7 - av_log2(val ^ 255);\
-        if(ones==1)\
-            ERROR\
-        val&= 127>>ones;\
-        while(--ones > 0){\
-            int tmp= GET_BYTE - 128;\
-            if(tmp>>6)\
-                ERROR\
-            val= (val<<6) + tmp;\
-        }\
-    }
-
-/*!
- * \def GET_UTF16(val, GET_16BIT, ERROR)
- * Converts a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form
- * \param val is the output and should be of type uint32_t. It holds the converted
- * UCS-4 character and should be a left value.
- * \param GET_16BIT gets two bytes of UTF-16 encoded data converted to native endianness.
- * It can be a function or a statement whose return value or evaluated value is of type
- * uint16_t. It will be executed up to 2 times.
- * \param ERROR action that should be taken when an invalid UTF-16 surrogate is
- * returned from GET_BYTE. It should be a statement that jumps out of the macro,
- * like exit(), goto, return, break, or continue.
- */
-#define GET_UTF16(val, GET_16BIT, ERROR)\
-    val = GET_16BIT;\
-    {\
-        unsigned int hi = val - 0xD800;\
-        if (hi < 0x800) {\
-            val = GET_16BIT - 0xDC00;\
-            if (val > 0x3FFU || hi > 0x3FFU)\
-                ERROR\
-            val += (hi<<10) + 0x10000;\
-        }\
-    }\
-
-/*!
- * \def PUT_UTF8(val, tmp, PUT_BYTE)
- * Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
- * \param val is an input-only argument and should be of type uint32_t. It holds
- * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If
- * val is given as a function it is executed only once.
- * \param tmp is a temporary variable and should be of type uint8_t. It
- * represents an intermediate value during conversion that is to be
- * output by PUT_BYTE.
- * \param PUT_BYTE writes the converted UTF-8 bytes to any proper destination.
- * It could be a function or a statement, and uses tmp as the input byte.
- * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be
- * executed up to 4 times for values in the valid UTF-8 range and up to
- * 7 times in the general case, depending on the length of the converted
- * Unicode character.
- */
-#define PUT_UTF8(val, tmp, PUT_BYTE)\
-    {\
-        int bytes, shift;\
-        uint32_t in = val;\
-        if (in < 0x80) {\
-            tmp = in;\
-            PUT_BYTE\
-        } else {\
-            bytes = (av_log2(in) + 4) / 5;\
-            shift = (bytes - 1) * 6;\
-            tmp = (256 - (256 >> bytes)) | (in >> shift);\
-            PUT_BYTE\
-            while (shift >= 6) {\
-                shift -= 6;\
-                tmp = 0x80 | ((in >> shift) & 0x3f);\
-                PUT_BYTE\
-            }\
-        }\
-    }
-
-/*!
- * \def PUT_UTF16(val, tmp, PUT_16BIT)
- * Converts a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
- * \param val is an input-only argument and should be of type uint32_t. It holds
- * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
- * val is given as a function it is executed only once.
- * \param tmp is a temporary variable and should be of type uint16_t. It
- * represents an intermediate value during conversion that is to be
- * output by PUT_16BIT.
- * \param PUT_16BIT writes the converted UTF-16 data to any proper destination
- * in desired endianness. It could be a function or a statement, and uses tmp
- * as the input byte.  For example, PUT_BYTE could be "*output++ = tmp;"
- * PUT_BYTE will be executed 1 or 2 times depending on input character.
- */
-#define PUT_UTF16(val, tmp, PUT_16BIT)\
-    {\
-        uint32_t in = val;\
-        if (in < 0x10000) {\
-            tmp = in;\
-            PUT_16BIT\
-        } else {\
-            tmp = 0xD800 | ((in - 0x10000) >> 10);\
-            PUT_16BIT\
-            tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
-            PUT_16BIT\
-        }\
-    }\
-
-
-
-#include "mem.h"
-
-#ifdef HAVE_AV_CONFIG_H
-#    include "internal.h"
-#endif /* HAVE_AV_CONFIG_H */
-
-#endif /* AVUTIL_COMMON_H */
diff --git a/libavutil/crc.c b/libavutil/crc.c
deleted file mode 100644
index 2719bae..0000000
--- a/libavutil/crc.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "common.h"
-#include "bswap.h"
-#include "crc.h"
-
-#if CONFIG_HARDCODED_TABLES
-#include "crc_data.h"
-#else
-static struct {
-    uint8_t  le;
-    uint8_t  bits;
-    uint32_t poly;
-} av_crc_table_params[AV_CRC_MAX] = {
-    [AV_CRC_8_ATM]      = { 0,  8,       0x07 },
-    [AV_CRC_16_ANSI]    = { 0, 16,     0x8005 },
-    [AV_CRC_16_CCITT]   = { 0, 16,     0x1021 },
-    [AV_CRC_32_IEEE]    = { 0, 32, 0x04C11DB7 },
-    [AV_CRC_32_IEEE_LE] = { 1, 32, 0xEDB88320 },
-};
-static AVCRC av_crc_table[AV_CRC_MAX][257];
-#endif
-
-/**
- * Initializes a CRC table.
- * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
- * @param cts_size size of ctx in bytes
- * @param le If 1, the lowest bit represents the coefficient for the highest
- *           exponent of the corresponding polynomial (both for poly and
- *           actual CRC).
- *           If 0, you must swap the CRC parameter and the result of av_crc
- *           if you need the standard representation (can be simplified in
- *           most cases to e.g. bswap16):
- *           bswap_32(crc << (32-bits))
- * @param bits number of bits for the CRC
- * @param poly generator polynomial without the x**bits coefficient, in the
- *             representation as specified by le
- * @return <0 on failure
- */
-int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
-    int i, j;
-    uint32_t c;
-
-    if (bits < 8 || bits > 32 || poly >= (1LL<<bits))
-        return -1;
-    if (ctx_size != sizeof(AVCRC)*257 && ctx_size != sizeof(AVCRC)*1024)
-        return -1;
-
-    for (i = 0; i < 256; i++) {
-        if (le) {
-            for (c = i, j = 0; j < 8; j++)
-                c = (c>>1)^(poly & (-(c&1)));
-            ctx[i] = c;
-        } else {
-            for (c = i << 24, j = 0; j < 8; j++)
-                c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) );
-            ctx[i] = bswap_32(c);
-        }
-    }
-    ctx[256]=1;
-#if !CONFIG_SMALL
-    if(ctx_size >= sizeof(AVCRC)*1024)
-        for (i = 0; i < 256; i++)
-            for(j=0; j<3; j++)
-                ctx[256*(j+1) + i]= (ctx[256*j + i]>>8) ^ ctx[ ctx[256*j + i]&0xFF ];
-#endif
-
-    return 0;
-}
-
-/**
- * Gets an initialized standard CRC table.
- * @param crc_id ID of a standard CRC
- * @return a pointer to the CRC table or NULL on failure
- */
-const AVCRC *av_crc_get_table(AVCRCId crc_id){
-#if !CONFIG_HARDCODED_TABLES
-    if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id])-1])
-        if (av_crc_init(av_crc_table[crc_id],
-                        av_crc_table_params[crc_id].le,
-                        av_crc_table_params[crc_id].bits,
-                        av_crc_table_params[crc_id].poly,
-                        sizeof(av_crc_table[crc_id])) < 0)
-            return NULL;
-#endif
-    return av_crc_table[crc_id];
-}
-
-/**
- * Calculates the CRC of a block.
- * @param crc CRC of previous blocks if any or initial value for CRC
- * @return CRC updated with the data from the given block
- *
- * @see av_crc_init() "le" parameter
- */
-uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){
-    const uint8_t *end= buffer+length;
-
-#if !CONFIG_SMALL
-    if(!ctx[256]) {
-        while(((intptr_t) buffer & 3) && buffer < end)
-            crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
-
-        while(buffer<end-3){
-            crc ^= le2me_32(*(const uint32_t*)buffer); buffer+=4;
-            crc =  ctx[3*256 + ( crc     &0xFF)]
-                  ^ctx[2*256 + ((crc>>8 )&0xFF)]
-                  ^ctx[1*256 + ((crc>>16)&0xFF)]
-                  ^ctx[0*256 + ((crc>>24)     )];
-        }
-    }
-#endif
-    while(buffer<end)
-        crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
-
-    return crc;
-}
-
-#ifdef TEST
-#undef printf
-int main(void){
-    uint8_t buf[1999];
-    int i;
-    int p[4][3]={{AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04},
-                 {AV_CRC_32_IEEE   , 0x04C11DB7, 0xC0F5BAE0},
-                 {AV_CRC_16_ANSI   , 0x8005,     0x1FBB    },
-                 {AV_CRC_8_ATM     , 0x07,       0xE3      },};
-    const AVCRC *ctx;
-
-    for(i=0; i<sizeof(buf); i++)
-        buf[i]= i+i*i;
-
-    for(i=0; i<4; i++){
-        ctx = av_crc_get_table(p[i][0]);
-        printf("crc %08X =%X\n", p[i][1], av_crc(ctx, 0, buf, sizeof(buf)));
-    }
-    return 0;
-}
-#endif
diff --git a/libavutil/crc.h b/libavutil/crc.h
deleted file mode 100644
index 6c0baab..0000000
--- a/libavutil/crc.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_CRC_H
-#define AVUTIL_CRC_H
-
-#include <stdint.h>
-#include <stddef.h>
-#include "attributes.h"
-
-typedef uint32_t AVCRC;
-
-typedef enum {
-    AV_CRC_8_ATM,
-    AV_CRC_16_ANSI,
-    AV_CRC_16_CCITT,
-    AV_CRC_32_IEEE,
-    AV_CRC_32_IEEE_LE,  /*< reversed bitorder version of AV_CRC_32_IEEE */
-    AV_CRC_MAX,         /*< Not part of public API! Do not use outside libavutil. */
-}AVCRCId;
-
-int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
-const AVCRC *av_crc_get_table(AVCRCId crc_id);
-uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure;
-
-#endif /* AVUTIL_CRC_H */
-
diff --git a/libavutil/crc_data.h b/libavutil/crc_data.h
deleted file mode 100644
index afa25e7..0000000
--- a/libavutil/crc_data.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * copyright (c) 2008 Aurelien Jacobs <aurel at gnuage.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_CRC_DATA_H
-#define AVUTIL_CRC_DATA_H
-
-#include "crc.h"
-
-static const AVCRC av_crc_table[AV_CRC_MAX][257] = {
-    [AV_CRC_8_ATM] = {
-        0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31,
-        0x24, 0x23, 0x2A, 0x2D, 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65,
-        0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, 0xE0, 0xE7, 0xEE, 0xE9,
-        0xFC, 0xFB, 0xF2, 0xF5, 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD,
-        0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, 0xA8, 0xAF, 0xA6, 0xA1,
-        0xB4, 0xB3, 0xBA, 0xBD, 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2,
-        0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, 0xB7, 0xB0, 0xB9, 0xBE,
-        0xAB, 0xAC, 0xA5, 0xA2, 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A,
-        0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, 0x1F, 0x18, 0x11, 0x16,
-        0x03, 0x04, 0x0D, 0x0A, 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42,
-        0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, 0x89, 0x8E, 0x87, 0x80,
-        0x95, 0x92, 0x9B, 0x9C, 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4,
-        0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, 0xC1, 0xC6, 0xCF, 0xC8,
-        0xDD, 0xDA, 0xD3, 0xD4, 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C,
-        0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, 0x19, 0x1E, 0x17, 0x10,
-        0x05, 0x02, 0x0B, 0x0C, 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34,
-        0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, 0x76, 0x71, 0x78, 0x7F,
-        0x6A, 0x6D, 0x64, 0x63, 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B,
-        0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, 0xAE, 0xA9, 0xA0, 0xA7,
-        0xB2, 0xB5, 0xBC, 0xBB, 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83,
-        0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, 0xE6, 0xE1, 0xE8, 0xEF,
-        0xFA, 0xFD, 0xF4, 0xF3, 0x01
-    },
-    [AV_CRC_16_ANSI] = {
-        0x0000, 0x0580, 0x0F80, 0x0A00, 0x1B80, 0x1E00, 0x1400, 0x1180,
-        0x3380, 0x3600, 0x3C00, 0x3980, 0x2800, 0x2D80, 0x2780, 0x2200,
-        0x6380, 0x6600, 0x6C00, 0x6980, 0x7800, 0x7D80, 0x7780, 0x7200,
-        0x5000, 0x5580, 0x5F80, 0x5A00, 0x4B80, 0x4E00, 0x4400, 0x4180,
-        0xC380, 0xC600, 0xCC00, 0xC980, 0xD800, 0xDD80, 0xD780, 0xD200,
-        0xF000, 0xF580, 0xFF80, 0xFA00, 0xEB80, 0xEE00, 0xE400, 0xE180,
-        0xA000, 0xA580, 0xAF80, 0xAA00, 0xBB80, 0xBE00, 0xB400, 0xB180,
-        0x9380, 0x9600, 0x9C00, 0x9980, 0x8800, 0x8D80, 0x8780, 0x8200,
-        0x8381, 0x8601, 0x8C01, 0x8981, 0x9801, 0x9D81, 0x9781, 0x9201,
-        0xB001, 0xB581, 0xBF81, 0xBA01, 0xAB81, 0xAE01, 0xA401, 0xA181,
-        0xE001, 0xE581, 0xEF81, 0xEA01, 0xFB81, 0xFE01, 0xF401, 0xF181,
-        0xD381, 0xD601, 0xDC01, 0xD981, 0xC801, 0xCD81, 0xC781, 0xC201,
-        0x4001, 0x4581, 0x4F81, 0x4A01, 0x5B81, 0x5E01, 0x5401, 0x5181,
-        0x7381, 0x7601, 0x7C01, 0x7981, 0x6801, 0x6D81, 0x6781, 0x6201,
-        0x2381, 0x2601, 0x2C01, 0x2981, 0x3801, 0x3D81, 0x3781, 0x3201,
-        0x1001, 0x1581, 0x1F81, 0x1A01, 0x0B81, 0x0E01, 0x0401, 0x0181,
-        0x0383, 0x0603, 0x0C03, 0x0983, 0x1803, 0x1D83, 0x1783, 0x1203,
-        0x3003, 0x3583, 0x3F83, 0x3A03, 0x2B83, 0x2E03, 0x2403, 0x2183,
-        0x6003, 0x6583, 0x6F83, 0x6A03, 0x7B83, 0x7E03, 0x7403, 0x7183,
-        0x5383, 0x5603, 0x5C03, 0x5983, 0x4803, 0x4D83, 0x4783, 0x4203,
-        0xC003, 0xC583, 0xCF83, 0xCA03, 0xDB83, 0xDE03, 0xD403, 0xD183,
-        0xF383, 0xF603, 0xFC03, 0xF983, 0xE803, 0xED83, 0xE783, 0xE203,
-        0xA383, 0xA603, 0xAC03, 0xA983, 0xB803, 0xBD83, 0xB783, 0xB203,
-        0x9003, 0x9583, 0x9F83, 0x9A03, 0x8B83, 0x8E03, 0x8403, 0x8183,
-        0x8002, 0x8582, 0x8F82, 0x8A02, 0x9B82, 0x9E02, 0x9402, 0x9182,
-        0xB382, 0xB602, 0xBC02, 0xB982, 0xA802, 0xAD82, 0xA782, 0xA202,
-        0xE382, 0xE602, 0xEC02, 0xE982, 0xF802, 0xFD82, 0xF782, 0xF202,
-        0xD002, 0xD582, 0xDF82, 0xDA02, 0xCB82, 0xCE02, 0xC402, 0xC182,
-        0x4382, 0x4602, 0x4C02, 0x4982, 0x5802, 0x5D82, 0x5782, 0x5202,
-        0x7002, 0x7582, 0x7F82, 0x7A02, 0x6B82, 0x6E02, 0x6402, 0x6182,
-        0x2002, 0x2582, 0x2F82, 0x2A02, 0x3B82, 0x3E02, 0x3402, 0x3182,
-        0x1382, 0x1602, 0x1C02, 0x1982, 0x0802, 0x0D82, 0x0782, 0x0202,
-        0x0001
-    },
-    [AV_CRC_16_CCITT] = {
-        0x0000, 0x2110, 0x4220, 0x6330, 0x8440, 0xA550, 0xC660, 0xE770,
-        0x0881, 0x2991, 0x4AA1, 0x6BB1, 0x8CC1, 0xADD1, 0xCEE1, 0xEFF1,
-        0x3112, 0x1002, 0x7332, 0x5222, 0xB552, 0x9442, 0xF772, 0xD662,
-        0x3993, 0x1883, 0x7BB3, 0x5AA3, 0xBDD3, 0x9CC3, 0xFFF3, 0xDEE3,
-        0x6224, 0x4334, 0x2004, 0x0114, 0xE664, 0xC774, 0xA444, 0x8554,
-        0x6AA5, 0x4BB5, 0x2885, 0x0995, 0xEEE5, 0xCFF5, 0xACC5, 0x8DD5,
-        0x5336, 0x7226, 0x1116, 0x3006, 0xD776, 0xF666, 0x9556, 0xB446,
-        0x5BB7, 0x7AA7, 0x1997, 0x3887, 0xDFF7, 0xFEE7, 0x9DD7, 0xBCC7,
-        0xC448, 0xE558, 0x8668, 0xA778, 0x4008, 0x6118, 0x0228, 0x2338,
-        0xCCC9, 0xEDD9, 0x8EE9, 0xAFF9, 0x4889, 0x6999, 0x0AA9, 0x2BB9,
-        0xF55A, 0xD44A, 0xB77A, 0x966A, 0x711A, 0x500A, 0x333A, 0x122A,
-        0xFDDB, 0xDCCB, 0xBFFB, 0x9EEB, 0x799B, 0x588B, 0x3BBB, 0x1AAB,
-        0xA66C, 0x877C, 0xE44C, 0xC55C, 0x222C, 0x033C, 0x600C, 0x411C,
-        0xAEED, 0x8FFD, 0xECCD, 0xCDDD, 0x2AAD, 0x0BBD, 0x688D, 0x499D,
-        0x977E, 0xB66E, 0xD55E, 0xF44E, 0x133E, 0x322E, 0x511E, 0x700E,
-        0x9FFF, 0xBEEF, 0xDDDF, 0xFCCF, 0x1BBF, 0x3AAF, 0x599F, 0x788F,
-        0x8891, 0xA981, 0xCAB1, 0xEBA1, 0x0CD1, 0x2DC1, 0x4EF1, 0x6FE1,
-        0x8010, 0xA100, 0xC230, 0xE320, 0x0450, 0x2540, 0x4670, 0x6760,
-        0xB983, 0x9893, 0xFBA3, 0xDAB3, 0x3DC3, 0x1CD3, 0x7FE3, 0x5EF3,
-        0xB102, 0x9012, 0xF322, 0xD232, 0x3542, 0x1452, 0x7762, 0x5672,
-        0xEAB5, 0xCBA5, 0xA895, 0x8985, 0x6EF5, 0x4FE5, 0x2CD5, 0x0DC5,
-        0xE234, 0xC324, 0xA014, 0x8104, 0x6674, 0x4764, 0x2454, 0x0544,
-        0xDBA7, 0xFAB7, 0x9987, 0xB897, 0x5FE7, 0x7EF7, 0x1DC7, 0x3CD7,
-        0xD326, 0xF236, 0x9106, 0xB016, 0x5766, 0x7676, 0x1546, 0x3456,
-        0x4CD9, 0x6DC9, 0x0EF9, 0x2FE9, 0xC899, 0xE989, 0x8AB9, 0xABA9,
-        0x4458, 0x6548, 0x0678, 0x2768, 0xC018, 0xE108, 0x8238, 0xA328,
-        0x7DCB, 0x5CDB, 0x3FEB, 0x1EFB, 0xF98B, 0xD89B, 0xBBAB, 0x9ABB,
-        0x754A, 0x545A, 0x376A, 0x167A, 0xF10A, 0xD01A, 0xB32A, 0x923A,
-        0x2EFD, 0x0FED, 0x6CDD, 0x4DCD, 0xAABD, 0x8BAD, 0xE89D, 0xC98D,
-        0x267C, 0x076C, 0x645C, 0x454C, 0xA23C, 0x832C, 0xE01C, 0xC10C,
-        0x1FEF, 0x3EFF, 0x5DCF, 0x7CDF, 0x9BAF, 0xBABF, 0xD98F, 0xF89F,
-        0x176E, 0x367E, 0x554E, 0x745E, 0x932E, 0xB23E, 0xD10E, 0xF01E,
-        0x0001
-    },
-    [AV_CRC_32_IEEE] = {
-        0x00000000, 0xB71DC104, 0x6E3B8209, 0xD926430D, 0xDC760413, 0x6B6BC517,
-        0xB24D861A, 0x0550471E, 0xB8ED0826, 0x0FF0C922, 0xD6D68A2F, 0x61CB4B2B,
-        0x649B0C35, 0xD386CD31, 0x0AA08E3C, 0xBDBD4F38, 0x70DB114C, 0xC7C6D048,
-        0x1EE09345, 0xA9FD5241, 0xACAD155F, 0x1BB0D45B, 0xC2969756, 0x758B5652,
-        0xC836196A, 0x7F2BD86E, 0xA60D9B63, 0x11105A67, 0x14401D79, 0xA35DDC7D,
-        0x7A7B9F70, 0xCD665E74, 0xE0B62398, 0x57ABE29C, 0x8E8DA191, 0x39906095,
-        0x3CC0278B, 0x8BDDE68F, 0x52FBA582, 0xE5E66486, 0x585B2BBE, 0xEF46EABA,
-        0x3660A9B7, 0x817D68B3, 0x842D2FAD, 0x3330EEA9, 0xEA16ADA4, 0x5D0B6CA0,
-        0x906D32D4, 0x2770F3D0, 0xFE56B0DD, 0x494B71D9, 0x4C1B36C7, 0xFB06F7C3,
-        0x2220B4CE, 0x953D75CA, 0x28803AF2, 0x9F9DFBF6, 0x46BBB8FB, 0xF1A679FF,
-        0xF4F63EE1, 0x43EBFFE5, 0x9ACDBCE8, 0x2DD07DEC, 0x77708634, 0xC06D4730,
-        0x194B043D, 0xAE56C539, 0xAB068227, 0x1C1B4323, 0xC53D002E, 0x7220C12A,
-        0xCF9D8E12, 0x78804F16, 0xA1A60C1B, 0x16BBCD1F, 0x13EB8A01, 0xA4F64B05,
-        0x7DD00808, 0xCACDC90C, 0x07AB9778, 0xB0B6567C, 0x69901571, 0xDE8DD475,
-        0xDBDD936B, 0x6CC0526F, 0xB5E61162, 0x02FBD066, 0xBF469F5E, 0x085B5E5A,
-        0xD17D1D57, 0x6660DC53, 0x63309B4D, 0xD42D5A49, 0x0D0B1944, 0xBA16D840,
-        0x97C6A5AC, 0x20DB64A8, 0xF9FD27A5, 0x4EE0E6A1, 0x4BB0A1BF, 0xFCAD60BB,
-        0x258B23B6, 0x9296E2B2, 0x2F2BAD8A, 0x98366C8E, 0x41102F83, 0xF60DEE87,
-        0xF35DA999, 0x4440689D, 0x9D662B90, 0x2A7BEA94, 0xE71DB4E0, 0x500075E4,
-        0x892636E9, 0x3E3BF7ED, 0x3B6BB0F3, 0x8C7671F7, 0x555032FA, 0xE24DF3FE,
-        0x5FF0BCC6, 0xE8ED7DC2, 0x31CB3ECF, 0x86D6FFCB, 0x8386B8D5, 0x349B79D1,
-        0xEDBD3ADC, 0x5AA0FBD8, 0xEEE00C69, 0x59FDCD6D, 0x80DB8E60, 0x37C64F64,
-        0x3296087A, 0x858BC97E, 0x5CAD8A73, 0xEBB04B77, 0x560D044F, 0xE110C54B,
-        0x38368646, 0x8F2B4742, 0x8A7B005C, 0x3D66C158, 0xE4408255, 0x535D4351,
-        0x9E3B1D25, 0x2926DC21, 0xF0009F2C, 0x471D5E28, 0x424D1936, 0xF550D832,
-        0x2C769B3F, 0x9B6B5A3B, 0x26D61503, 0x91CBD407, 0x48ED970A, 0xFFF0560E,
-        0xFAA01110, 0x4DBDD014, 0x949B9319, 0x2386521D, 0x0E562FF1, 0xB94BEEF5,
-        0x606DADF8, 0xD7706CFC, 0xD2202BE2, 0x653DEAE6, 0xBC1BA9EB, 0x0B0668EF,
-        0xB6BB27D7, 0x01A6E6D3, 0xD880A5DE, 0x6F9D64DA, 0x6ACD23C4, 0xDDD0E2C0,
-        0x04F6A1CD, 0xB3EB60C9, 0x7E8D3EBD, 0xC990FFB9, 0x10B6BCB4, 0xA7AB7DB0,
-        0xA2FB3AAE, 0x15E6FBAA, 0xCCC0B8A7, 0x7BDD79A3, 0xC660369B, 0x717DF79F,
-        0xA85BB492, 0x1F467596, 0x1A163288, 0xAD0BF38C, 0x742DB081, 0xC3307185,
-        0x99908A5D, 0x2E8D4B59, 0xF7AB0854, 0x40B6C950, 0x45E68E4E, 0xF2FB4F4A,
-        0x2BDD0C47, 0x9CC0CD43, 0x217D827B, 0x9660437F, 0x4F460072, 0xF85BC176,
-        0xFD0B8668, 0x4A16476C, 0x93300461, 0x242DC565, 0xE94B9B11, 0x5E565A15,
-        0x87701918, 0x306DD81C, 0x353D9F02, 0x82205E06, 0x5B061D0B, 0xEC1BDC0F,
-        0x51A69337, 0xE6BB5233, 0x3F9D113E, 0x8880D03A, 0x8DD09724, 0x3ACD5620,
-        0xE3EB152D, 0x54F6D429, 0x7926A9C5, 0xCE3B68C1, 0x171D2BCC, 0xA000EAC8,
-        0xA550ADD6, 0x124D6CD2, 0xCB6B2FDF, 0x7C76EEDB, 0xC1CBA1E3, 0x76D660E7,
-        0xAFF023EA, 0x18EDE2EE, 0x1DBDA5F0, 0xAAA064F4, 0x738627F9, 0xC49BE6FD,
-        0x09FDB889, 0xBEE0798D, 0x67C63A80, 0xD0DBFB84, 0xD58BBC9A, 0x62967D9E,
-        0xBBB03E93, 0x0CADFF97, 0xB110B0AF, 0x060D71AB, 0xDF2B32A6, 0x6836F3A2,
-        0x6D66B4BC, 0xDA7B75B8, 0x035D36B5, 0xB440F7B1, 0x00000001
-    },
-    [AV_CRC_32_IEEE_LE] = {
-        0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F,
-        0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
-        0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2,
-        0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
-        0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
-        0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
-        0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C,
-        0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
-        0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423,
-        0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
-        0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106,
-        0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
-        0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D,
-        0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
-        0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
-        0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
-        0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7,
-        0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
-        0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA,
-        0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
-        0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81,
-        0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
-        0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84,
-        0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
-        0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
-        0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
-        0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E,
-        0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
-        0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55,
-        0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
-        0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28,
-        0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
-        0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F,
-        0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
-        0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
-        0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
-        0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69,
-        0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
-        0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC,
-        0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
-        0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693,
-        0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
-        0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, 0x00000001
-    },
-};
-
-#endif /* AVUTIL_CRC_DATA_H */
diff --git a/libavutil/des.c b/libavutil/des.c
deleted file mode 100644
index ab66a0b..0000000
--- a/libavutil/des.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * DES encryption/decryption
- * Copyright (c) 2007 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <inttypes.h>
-#include "avutil.h"
-#include "common.h"
-#include "intreadwrite.h"
-#include "des.h"
-
-typedef struct AVDES AVDES;
-
-#define T(a, b, c, d, e, f, g, h) 64-a,64-b,64-c,64-d,64-e,64-f,64-g,64-h
-static const uint8_t IP_shuffle[] = {
-    T(58, 50, 42, 34, 26, 18, 10, 2),
-    T(60, 52, 44, 36, 28, 20, 12, 4),
-    T(62, 54, 46, 38, 30, 22, 14, 6),
-    T(64, 56, 48, 40, 32, 24, 16, 8),
-    T(57, 49, 41, 33, 25, 17,  9, 1),
-    T(59, 51, 43, 35, 27, 19, 11, 3),
-    T(61, 53, 45, 37, 29, 21, 13, 5),
-    T(63, 55, 47, 39, 31, 23, 15, 7)
-};
-#undef T
-
-#define T(a, b, c, d) 32-a,32-b,32-c,32-d
-static const uint8_t P_shuffle[] = {
-    T(16,  7, 20, 21),
-    T(29, 12, 28, 17),
-    T( 1, 15, 23, 26),
-    T( 5, 18, 31, 10),
-    T( 2,  8, 24, 14),
-    T(32, 27,  3,  9),
-    T(19, 13, 30,  6),
-    T(22, 11,  4, 25)
-};
-#undef T
-
-#define T(a, b, c, d, e, f, g) 64-a,64-b,64-c,64-d,64-e,64-f,64-g
-static const uint8_t PC1_shuffle[] = {
-    T(57, 49, 41, 33, 25, 17,  9),
-    T( 1, 58, 50, 42, 34, 26, 18),
-    T(10,  2, 59, 51, 43, 35, 27),
-    T(19, 11,  3, 60, 52, 44, 36),
-    T(63, 55, 47, 39, 31, 23, 15),
-    T( 7, 62, 54, 46, 38, 30, 22),
-    T(14,  6, 61, 53, 45, 37, 29),
-    T(21, 13,  5, 28, 20, 12,  4)
-};
-#undef T
-
-#define T(a, b, c, d, e, f) 56-a,56-b,56-c,56-d,56-e,56-f
-static const uint8_t PC2_shuffle[] = {
-    T(14, 17, 11, 24,  1,  5),
-    T( 3, 28, 15,  6, 21, 10),
-    T(23, 19, 12,  4, 26,  8),
-    T(16,  7, 27, 20, 13,  2),
-    T(41, 52, 31, 37, 47, 55),
-    T(30, 40, 51, 45, 33, 48),
-    T(44, 49, 39, 56, 34, 53),
-    T(46, 42, 50, 36, 29, 32)
-};
-#undef T
-
-#if CONFIG_SMALL
-static const uint8_t S_boxes[8][32] = {
-    {
-    0x0e, 0xf4, 0x7d, 0x41, 0xe2, 0x2f, 0xdb, 0x18, 0xa3, 0x6a, 0xc6, 0xbc, 0x95, 0x59, 0x30, 0x87,
-    0xf4, 0xc1, 0x8e, 0x28, 0x4d, 0x96, 0x12, 0x7b, 0x5f, 0xbc, 0x39, 0xe7, 0xa3, 0x0a, 0x65, 0xd0,
-    }, {
-    0x3f, 0xd1, 0x48, 0x7e, 0xf6, 0x2b, 0x83, 0xe4, 0xc9, 0x07, 0x12, 0xad, 0x6c, 0x90, 0xb5, 0x5a,
-    0xd0, 0x8e, 0xa7, 0x1b, 0x3a, 0xf4, 0x4d, 0x21, 0xb5, 0x68, 0x7c, 0xc6, 0x09, 0x53, 0xe2, 0x9f,
-    }, {
-    0xda, 0x70, 0x09, 0x9e, 0x36, 0x43, 0x6f, 0xa5, 0x21, 0x8d, 0x5c, 0xe7, 0xcb, 0xb4, 0xf2, 0x18,
-    0x1d, 0xa6, 0xd4, 0x09, 0x68, 0x9f, 0x83, 0x70, 0x4b, 0xf1, 0xe2, 0x3c, 0xb5, 0x5a, 0x2e, 0xc7,
-    }, {
-    0xd7, 0x8d, 0xbe, 0x53, 0x60, 0xf6, 0x09, 0x3a, 0x41, 0x72, 0x28, 0xc5, 0x1b, 0xac, 0xe4, 0x9f,
-    0x3a, 0xf6, 0x09, 0x60, 0xac, 0x1b, 0xd7, 0x8d, 0x9f, 0x41, 0x53, 0xbe, 0xc5, 0x72, 0x28, 0xe4,
-    }, {
-    0xe2, 0xbc, 0x24, 0xc1, 0x47, 0x7a, 0xdb, 0x16, 0x58, 0x05, 0xf3, 0xaf, 0x3d, 0x90, 0x8e, 0x69,
-    0xb4, 0x82, 0xc1, 0x7b, 0x1a, 0xed, 0x27, 0xd8, 0x6f, 0xf9, 0x0c, 0x95, 0xa6, 0x43, 0x50, 0x3e,
-    }, {
-    0xac, 0xf1, 0x4a, 0x2f, 0x79, 0xc2, 0x96, 0x58, 0x60, 0x1d, 0xd3, 0xe4, 0x0e, 0xb7, 0x35, 0x8b,
-    0x49, 0x3e, 0x2f, 0xc5, 0x92, 0x58, 0xfc, 0xa3, 0xb7, 0xe0, 0x14, 0x7a, 0x61, 0x0d, 0x8b, 0xd6,
-    }, {
-    0xd4, 0x0b, 0xb2, 0x7e, 0x4f, 0x90, 0x18, 0xad, 0xe3, 0x3c, 0x59, 0xc7, 0x25, 0xfa, 0x86, 0x61,
-    0x61, 0xb4, 0xdb, 0x8d, 0x1c, 0x43, 0xa7, 0x7e, 0x9a, 0x5f, 0x06, 0xf8, 0xe0, 0x25, 0x39, 0xc2,
-    }, {
-    0x1d, 0xf2, 0xd8, 0x84, 0xa6, 0x3f, 0x7b, 0x41, 0xca, 0x59, 0x63, 0xbe, 0x05, 0xe0, 0x9c, 0x27,
-    0x27, 0x1b, 0xe4, 0x71, 0x49, 0xac, 0x8e, 0xd2, 0xf0, 0xc6, 0x9a, 0x0d, 0x3f, 0x53, 0x65, 0xb8,
-    }
-};
-#else
-/**
- * This table contains the results of applying both the S-box and P-shuffle.
- * It can be regenerated by compiling this file with -DCONFIG_SMALL -DTEST -DGENTABLES
- */
-static const uint32_t S_boxes_P_shuffle[8][64] = {
-    {
-    0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000,
-    0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002,
-    0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202,
-    0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000,
-    0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200,
-    0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202,
-    0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200,
-    0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002,
-    },
-    {
-    0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010,
-    0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010,
-    0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000,
-    0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010,
-    0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000,
-    0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000,
-    0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010,
-    0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000,
-    },
-    {
-    0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100,
-    0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104,
-    0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104,
-    0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000,
-    0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000,
-    0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004,
-    0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004,
-    0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100,
-    },
-    {
-    0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000,
-    0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000,
-    0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040,
-    0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040,
-    0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000,
-    0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040,
-    0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040,
-    0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040,
-    },
-    {
-    0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000,
-    0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000,
-    0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080,
-    0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080,
-    0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080,
-    0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000,
-    0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000,
-    0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080,
-    },
-    {
-    0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000,
-    0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008,
-    0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008,
-    0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000,
-    0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008,
-    0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000,
-    0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008,
-    0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008,
-    },
-    {
-    0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400,
-    0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401,
-    0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001,
-    0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400,
-    0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001,
-    0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400,
-    0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401,
-    0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001,
-    },
-    {
-    0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000,
-    0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020,
-    0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800,
-    0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000,
-    0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820,
-    0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820,
-    0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000,
-    0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800,
-    },
-};
-#endif
-
-static uint64_t shuffle(uint64_t in, const uint8_t *shuffle, int shuffle_len) {
-    int i;
-    uint64_t res = 0;
-    for (i = 0; i < shuffle_len; i++)
-        res += res + ((in >> *shuffle++) & 1);
-    return res;
-}
-
-static uint64_t shuffle_inv(uint64_t in, const uint8_t *shuffle, int shuffle_len) {
-    int i;
-    uint64_t res = 0;
-    shuffle += shuffle_len - 1;
-    for (i = 0; i < shuffle_len; i++) {
-        res |= (in & 1) << *shuffle--;
-        in >>= 1;
-    }
-    return res;
-}
-
-static uint32_t f_func(uint32_t r, uint64_t k) {
-    int i;
-    uint32_t out = 0;
-    // rotate to get first part of E-shuffle in the lowest 6 bits
-    r = (r << 1) | (r >> 31);
-    // apply S-boxes, those compress the data again from 8 * 6 to 8 * 4 bits
-    for (i = 7; i >= 0; i--) {
-        uint8_t tmp = (r ^ k) & 0x3f;
-#if CONFIG_SMALL
-        uint8_t v = S_boxes[i][tmp >> 1];
-        if (tmp & 1) v >>= 4;
-        out = (out >> 4) | (v << 28);
-#else
-        out |= S_boxes_P_shuffle[i][tmp];
-#endif
-        // get next 6 bits of E-shuffle and round key k into the lowest bits
-        r = (r >> 4) | (r << 28);
-        k >>= 6;
-    }
-#if CONFIG_SMALL
-    out = shuffle(out, P_shuffle, sizeof(P_shuffle));
-#endif
-    return out;
-}
-
-/**
- * \brief rotate the two halves of the expanded 56 bit key each 1 bit left
- *
- * Note: the specification calls this "shift", so I kept it although
- * it is confusing.
- */
-static uint64_t key_shift_left(uint64_t CDn) {
-    uint64_t carries = (CDn >> 27) & 0x10000001;
-    CDn <<= 1;
-    CDn &= ~0x10000001;
-    CDn |= carries;
-    return CDn;
-}
-
-static void gen_roundkeys(uint64_t K[16], uint64_t key) {
-    int i;
-    // discard parity bits from key and shuffle it into C and D parts
-    uint64_t CDn = shuffle(key, PC1_shuffle, sizeof(PC1_shuffle));
-    // generate round keys
-    for (i = 0; i < 16; i++) {
-        CDn = key_shift_left(CDn);
-        if (i > 1 && i != 8 && i != 15)
-            CDn = key_shift_left(CDn);
-        K[i] = shuffle(CDn, PC2_shuffle, sizeof(PC2_shuffle));
-    }
-}
-
-static uint64_t des_encdec(uint64_t in, uint64_t K[16], int decrypt) {
-    int i;
-    // used to apply round keys in reverse order for decryption
-    decrypt = decrypt ? 15 : 0;
-    // shuffle irrelevant to security but to ease hardware implementations
-    in = shuffle(in, IP_shuffle, sizeof(IP_shuffle));
-    for (i = 0; i < 16; i++) {
-        uint32_t f_res;
-        f_res = f_func(in, K[decrypt ^ i]);
-        in = (in << 32) | (in >> 32);
-        in ^= f_res;
-    }
-    in = (in << 32) | (in >> 32);
-    // reverse shuffle used to ease hardware implementations
-    in = shuffle_inv(in, IP_shuffle, sizeof(IP_shuffle));
-    return in;
-}
-
-int av_des_init(AVDES *d, const uint8_t *key, int key_bits, int decrypt) {
-    if (key_bits != 64 && key_bits != 192)
-        return -1;
-    d->triple_des = key_bits > 64;
-    gen_roundkeys(d->round_keys[0], AV_RB64(key));
-    if (d->triple_des) {
-        gen_roundkeys(d->round_keys[1], AV_RB64(key +  8));
-        gen_roundkeys(d->round_keys[2], AV_RB64(key + 16));
-    }
-    return 0;
-}
-
-void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) {
-    uint64_t iv_val = iv ? be2me_64(*(uint64_t *)iv) : 0;
-    while (count-- > 0) {
-        uint64_t dst_val;
-        uint64_t src_val = src ? be2me_64(*(const uint64_t *)src) : 0;
-        if (decrypt) {
-            uint64_t tmp = src_val;
-            if (d->triple_des) {
-                src_val = des_encdec(src_val, d->round_keys[2], 1);
-                src_val = des_encdec(src_val, d->round_keys[1], 0);
-            }
-            dst_val = des_encdec(src_val, d->round_keys[0], 1) ^ iv_val;
-            iv_val = iv ? tmp : 0;
-        } else {
-            dst_val = des_encdec(src_val ^ iv_val, d->round_keys[0], 0);
-            if (d->triple_des) {
-                dst_val = des_encdec(dst_val, d->round_keys[1], 1);
-                dst_val = des_encdec(dst_val, d->round_keys[2], 0);
-            }
-            iv_val = iv ? dst_val : 0;
-        }
-        *(uint64_t *)dst = be2me_64(dst_val);
-        src += 8;
-        dst += 8;
-    }
-    if (iv)
-        *(uint64_t *)iv = be2me_64(iv_val);
-}
-
-#ifdef TEST
-#undef printf
-#undef rand
-#undef srand
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/time.h>
-static uint64_t rand64(void) {
-    uint64_t r = rand();
-    r = (r << 32) | rand();
-    return r;
-}
-
-static const uint8_t test_key[] = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0};
-static const DECLARE_ALIGNED(8, uint8_t, plain)[] = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
-static const DECLARE_ALIGNED(8, uint8_t, crypt)[] = {0x4a, 0xb6, 0x5b, 0x3d, 0x4b, 0x06, 0x15, 0x18};
-static DECLARE_ALIGNED(8, uint8_t, tmp)[8];
-static DECLARE_ALIGNED(8, uint8_t, large_buffer)[10002][8];
-static const uint8_t cbc_key[] = {
-    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-    0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01,
-    0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23
-};
-
-static int run_test(int cbc, int decrypt) {
-    AVDES d;
-    int delay = cbc && !decrypt ? 2 : 1;
-    uint64_t res;
-    AV_WB64(large_buffer[0], 0x4e6f772069732074ULL);
-    AV_WB64(large_buffer[1], 0x1234567890abcdefULL);
-    AV_WB64(tmp,             0x1234567890abcdefULL);
-    av_des_init(&d, cbc_key, 192, decrypt);
-    av_des_crypt(&d, large_buffer[delay], large_buffer[0], 10000, cbc ? tmp : NULL, decrypt);
-    res = AV_RB64(large_buffer[9999 + delay]);
-    if (cbc) {
-        if (decrypt)
-            return res == 0xc5cecf63ecec514cULL;
-        else
-            return res == 0xcb191f85d1ed8439ULL;
-    } else {
-        if (decrypt)
-            return res == 0x8325397644091a0aULL;
-        else
-            return res == 0xdd17e8b8b437d232ULL;
-    }
-}
-
-int main(void) {
-    AVDES d;
-    int i;
-#ifdef GENTABLES
-    int j;
-#endif
-    struct timeval tv;
-    uint64_t key[3];
-    uint64_t data;
-    uint64_t ct;
-    uint64_t roundkeys[16];
-    gettimeofday(&tv, NULL);
-    srand(tv.tv_sec * 1000 * 1000 + tv.tv_usec);
-    key[0] = AV_RB64(test_key);
-    data = AV_RB64(plain);
-    gen_roundkeys(roundkeys, key[0]);
-    if (des_encdec(data, roundkeys, 0) != AV_RB64(crypt)) {
-        printf("Test 1 failed\n");
-        return 1;
-    }
-    av_des_init(&d, test_key, 64, 0);
-    av_des_crypt(&d, tmp, plain, 1, NULL, 0);
-    if (memcmp(tmp, crypt, sizeof(crypt))) {
-        printf("Public API decryption failed\n");
-        return 1;
-    }
-    if (!run_test(0, 0) || !run_test(0, 1) || !run_test(1, 0) || !run_test(1, 1)) {
-        printf("Partial Monte-Carlo test failed\n");
-        return 1;
-    }
-    for (i = 0; i < 1000000; i++) {
-        key[0] = rand64(); key[1] = rand64(); key[2] = rand64();
-        data = rand64();
-        av_des_init(&d, key, 192, 0);
-        av_des_crypt(&d, &ct, &data, 1, NULL, 0);
-        av_des_init(&d, key, 192, 1);
-        av_des_crypt(&d, &ct, &ct, 1, NULL, 1);
-        if (ct != data) {
-            printf("Test 2 failed\n");
-            return 1;
-        }
-    }
-#ifdef GENTABLES
-    printf("static const uint32_t S_boxes_P_shuffle[8][64] = {\n");
-    for (i = 0; i < 8; i++) {
-        printf("    {");
-        for (j = 0; j < 64; j++) {
-            uint32_t v = S_boxes[i][j >> 1];
-            v = j & 1 ? v >> 4 : v & 0xf;
-            v <<= 28 - 4 * i;
-            v = shuffle(v, P_shuffle, sizeof(P_shuffle));
-            printf((j & 7) == 0 ? "\n    " : " ");
-            printf("0x%08X,", v);
-        }
-        printf("\n    },\n");
-    }
-    printf("};\n");
-#endif
-    return 0;
-}
-#endif
diff --git a/libavutil/des.h b/libavutil/des.h
deleted file mode 100644
index e80bdd3..0000000
--- a/libavutil/des.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * DES encryption/decryption
- * Copyright (c) 2007 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_DES_H
-#define AVUTIL_DES_H
-
-#include <stdint.h>
-
-struct AVDES {
-    uint64_t round_keys[3][16];
-    int triple_des;
-};
-
-/**
- * \brief Initializes an AVDES context.
- *
- * \param key_bits must be 64 or 192
- * \param decrypt 0 for encryption, 1 for decryption
- */
-int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt);
-
-/**
- * \brief Encrypts / decrypts using the DES algorithm.
- *
- * \param count number of 8 byte blocks
- * \param dst destination array, can be equal to src, must be 8-byte aligned
- * \param src source array, can be equal to dst, must be 8-byte aligned, may be NULL
- * \param iv initialization vector for CBC mode, if NULL then ECB will be used,
- *           must be 8-byte aligned
- * \param decrypt 0 for encryption, 1 for decryption
- */
-void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
-
-#endif /* AVUTIL_DES_H */
diff --git a/libavutil/error.c b/libavutil/error.c
deleted file mode 100644
index b6d6019..0000000
--- a/libavutil/error.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avutil.h"
-#include "avstring.h"
-
-int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
-{
-    int ret = 0;
-    const char *errstr = NULL;
-
-    switch (errnum) {
-    case AVERROR_EOF:               errstr = "End of file"; break;
-    case AVERROR_INVALIDDATA:       errstr = "Invalid data found when processing input"; break;
-    case AVERROR_NUMEXPECTED:       errstr = "Number syntax expected in filename"; break;
-    case AVERROR_PATCHWELCOME:      errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
-    }
-
-    if (errstr) {
-        av_strlcpy(errbuf, errstr, errbuf_size);
-    } else {
-#if HAVE_STRERROR_R
-        ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
-#else
-        ret = -1;
-#endif
-        if (ret < 0)
-            snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
-    }
-
-    return ret;
-}
diff --git a/libavutil/error.h b/libavutil/error.h
deleted file mode 100644
index 13a9a35..0000000
--- a/libavutil/error.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * error code definitions
- */
-
-#ifndef AVUTIL_ERROR_H
-#define AVUTIL_ERROR_H
-
-#include <errno.h>
-#include "avutil.h"
-
-/* error handling */
-#if EDOM > 0
-#define AVERROR(e) (-(e))   ///< Returns a negative error code from a POSIX error code, to return from library functions.
-#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
-#else
-/* Some platforms have E* and errno already negated. */
-#define AVERROR(e) (e)
-#define AVUNERROR(e) (e)
-#endif
-
-#if LIBAVUTIL_VERSION_MAJOR < 51
-#define AVERROR_INVALIDDATA AVERROR(EINVAL)  ///< Invalid data found when processing input
-#define AVERROR_IO          AVERROR(EIO)     ///< I/O error
-#define AVERROR_NOENT       AVERROR(ENOENT)  ///< No such file or directory
-#define AVERROR_NOFMT       AVERROR(EILSEQ)  ///< Unknown format
-#define AVERROR_NOMEM       AVERROR(ENOMEM)  ///< Not enough memory
-#define AVERROR_NOTSUPP     AVERROR(ENOSYS)  ///< Operation not supported
-#define AVERROR_NUMEXPECTED AVERROR(EDOM)    ///< Number syntax expected in filename
-#define AVERROR_UNKNOWN     AVERROR(EINVAL)  ///< Unknown error
-#endif
-
-#define AVERROR_EOF         AVERROR(EPIPE)   ///< End of file
-
-#define AVERROR_PATCHWELCOME    (-MKTAG('P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome
-
-#if LIBAVUTIL_VERSION_MAJOR > 50
-#define AVERROR_INVALIDDATA     (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input
-#define AVERROR_NUMEXPECTED     (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename
-#endif
-
-/**
- * Puts a description of the AVERROR code errnum in errbuf.
- * In case of failure the global variable errno is set to indicate the
- * error. Even in case of failure av_strerror() will print a generic
- * error message indicating the errnum provided to errbuf.
- *
- * @param errbuf_size the size in bytes of errbuf
- * @return 0 on success, a negative value if a description for errnum
- * cannot be found
- */
-int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
-
-#endif /* AVUTIL_ERROR_H */
diff --git a/libavutil/fifo.c b/libavutil/fifo.c
deleted file mode 100644
index cfb716e..0000000
--- a/libavutil/fifo.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * a very simple circular buffer FIFO implementation
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
- * Copyright (c) 2006 Roman Shaposhnik
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "common.h"
-#include "fifo.h"
-
-AVFifoBuffer *av_fifo_alloc(unsigned int size)
-{
-    AVFifoBuffer *f= av_mallocz(sizeof(AVFifoBuffer));
-    if(!f)
-        return NULL;
-    f->buffer = av_malloc(size);
-    f->end = f->buffer + size;
-    av_fifo_reset(f);
-    if (!f->buffer)
-        av_freep(&f);
-    return f;
-}
-
-void av_fifo_free(AVFifoBuffer *f)
-{
-    if(f){
-        av_free(f->buffer);
-        av_free(f);
-    }
-}
-
-void av_fifo_reset(AVFifoBuffer *f)
-{
-    f->wptr = f->rptr = f->buffer;
-    f->wndx = f->rndx = 0;
-}
-
-int av_fifo_size(AVFifoBuffer *f)
-{
-    return (uint32_t)(f->wndx - f->rndx);
-}
-
-int av_fifo_space(AVFifoBuffer *f)
-{
-    return f->end - f->buffer - av_fifo_size(f);
-}
-
-int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) {
-    unsigned int old_size= f->end - f->buffer;
-
-    if(old_size < new_size){
-        int len= av_fifo_size(f);
-        AVFifoBuffer *f2= av_fifo_alloc(new_size);
-
-        if (!f2)
-            return -1;
-        av_fifo_generic_read(f, f2->buffer, len, NULL);
-        f2->wptr += len;
-        f2->wndx += len;
-        av_free(f->buffer);
-        *f= *f2;
-        av_free(f2);
-    }
-    return 0;
-}
-
-// src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter)
-int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int))
-{
-    int total = size;
-    do {
-        int len = FFMIN(f->end - f->wptr, size);
-        if(func) {
-            if(func(src, f->wptr, len) <= 0)
-                break;
-        } else {
-            memcpy(f->wptr, src, len);
-            src = (uint8_t*)src + len;
-        }
-// Write memory barrier needed for SMP here in theory
-        f->wptr += len;
-        if (f->wptr >= f->end)
-            f->wptr = f->buffer;
-        f->wndx += len;
-        size -= len;
-    } while (size > 0);
-    return total - size;
-}
-
-
-int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int))
-{
-// Read memory barrier needed for SMP here in theory
-    do {
-        int len = FFMIN(f->end - f->rptr, buf_size);
-        if(func) func(dest, f->rptr, len);
-        else{
-            memcpy(dest, f->rptr, len);
-            dest = (uint8_t*)dest + len;
-        }
-// memory barrier needed for SMP here in theory
-        av_fifo_drain(f, len);
-        buf_size -= len;
-    } while (buf_size > 0);
-    return 0;
-}
-
-/** Discard data from the FIFO. */
-void av_fifo_drain(AVFifoBuffer *f, int size)
-{
-    f->rptr += size;
-    if (f->rptr >= f->end)
-        f->rptr -= f->end - f->buffer;
-    f->rndx += size;
-}
diff --git a/libavutil/fifo.h b/libavutil/fifo.h
deleted file mode 100644
index fb1ed47..0000000
--- a/libavutil/fifo.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * a very simple circular buffer FIFO implementation
- */
-
-#ifndef AVUTIL_FIFO_H
-#define AVUTIL_FIFO_H
-
-#include <stdint.h>
-
-typedef struct AVFifoBuffer {
-    uint8_t *buffer;
-    uint8_t *rptr, *wptr, *end;
-    uint32_t rndx, wndx;
-} AVFifoBuffer;
-
-/**
- * Initializes an AVFifoBuffer.
- * @param size of FIFO
- * @return AVFifoBuffer or NULL in case of memory allocation failure
- */
-AVFifoBuffer *av_fifo_alloc(unsigned int size);
-
-/**
- * Frees an AVFifoBuffer.
- * @param *f AVFifoBuffer to free
- */
-void av_fifo_free(AVFifoBuffer *f);
-
-/**
- * Resets the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
- * @param *f AVFifoBuffer to reset
- */
-void av_fifo_reset(AVFifoBuffer *f);
-
-/**
- * Returns the amount of data in bytes in the AVFifoBuffer, that is the
- * amount of data you can read from it.
- * @param *f AVFifoBuffer to read from
- * @return size
- */
-int av_fifo_size(AVFifoBuffer *f);
-
-/**
- * Returns the amount of space in bytes in the AVFifoBuffer, that is the
- * amount of data you can write into it.
- * @param *f AVFifoBuffer to write into
- * @return size
- */
-int av_fifo_space(AVFifoBuffer *f);
-
-/**
- * Feeds data from an AVFifoBuffer to a user-supplied callback.
- * @param *f AVFifoBuffer to read from
- * @param buf_size number of bytes to read
- * @param *func generic read function
- * @param *dest data destination
- */
-int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
-
-/**
- * Feeds data from a user-supplied callback to an AVFifoBuffer.
- * @param *f AVFifoBuffer to write to
- * @param *src data source; non-const since it may be used as a
- * modifiable context by the function defined in func
- * @param size number of bytes to write
- * @param *func generic write function; the first parameter is src,
- * the second is dest_buf, the third is dest_buf_size.
- * func must return the number of bytes written to dest_buf, or <= 0 to
- * indicate no more data available to write.
- * If func is NULL, src is interpreted as a simple byte array for source data.
- * @return the number of bytes written to the FIFO
- */
-int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
-
-/**
- * Resizes an AVFifoBuffer.
- * @param *f AVFifoBuffer to resize
- * @param size new AVFifoBuffer size in bytes
- * @return <0 for failure, >=0 otherwise
- */
-int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size);
-
-/**
- * Reads and discards the specified amount of data from an AVFifoBuffer.
- * @param *f AVFifoBuffer to read from
- * @param size amount of data to read in bytes
- */
-void av_fifo_drain(AVFifoBuffer *f, int size);
-
-static inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs)
-{
-    uint8_t *ptr = f->rptr + offs;
-    if (ptr >= f->end)
-        ptr -= f->end - f->buffer;
-    return *ptr;
-}
-#endif /* AVUTIL_FIFO_H */
diff --git a/libavutil/integer.c b/libavutil/integer.c
deleted file mode 100644
index 4f9b66c..0000000
--- a/libavutil/integer.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * arbitrary precision integers
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * arbitrary precision integers
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include "common.h"
-#include "integer.h"
-
-AVInteger av_add_i(AVInteger a, AVInteger b){
-    int i, carry=0;
-
-    for(i=0; i<AV_INTEGER_SIZE; i++){
-        carry= (carry>>16) + a.v[i] + b.v[i];
-        a.v[i]= carry;
-    }
-    return a;
-}
-
-AVInteger av_sub_i(AVInteger a, AVInteger b){
-    int i, carry=0;
-
-    for(i=0; i<AV_INTEGER_SIZE; i++){
-        carry= (carry>>16) + a.v[i] - b.v[i];
-        a.v[i]= carry;
-    }
-    return a;
-}
-
-int av_log2_i(AVInteger a){
-    int i;
-
-    for(i=AV_INTEGER_SIZE-1; i>=0; i--){
-        if(a.v[i])
-            return av_log2_16bit(a.v[i]) + 16*i;
-    }
-    return -1;
-}
-
-AVInteger av_mul_i(AVInteger a, AVInteger b){
-    AVInteger out;
-    int i, j;
-    int na= (av_log2_i(a)+16) >> 4;
-    int nb= (av_log2_i(b)+16) >> 4;
-
-    memset(&out, 0, sizeof(out));
-
-    for(i=0; i<na; i++){
-        unsigned int carry=0;
-
-        if(a.v[i])
-            for(j=i; j<AV_INTEGER_SIZE && j-i<=nb; j++){
-                carry= (carry>>16) + out.v[j] + a.v[i]*b.v[j-i];
-                out.v[j]= carry;
-            }
-    }
-
-    return out;
-}
-
-int av_cmp_i(AVInteger a, AVInteger b){
-    int i;
-    int v= (int16_t)a.v[AV_INTEGER_SIZE-1] - (int16_t)b.v[AV_INTEGER_SIZE-1];
-    if(v) return (v>>16)|1;
-
-    for(i=AV_INTEGER_SIZE-2; i>=0; i--){
-        int v= a.v[i] - b.v[i];
-        if(v) return (v>>16)|1;
-    }
-    return 0;
-}
-
-AVInteger av_shr_i(AVInteger a, int s){
-    AVInteger out;
-    int i;
-
-    for(i=0; i<AV_INTEGER_SIZE; i++){
-        unsigned int index= i + (s>>4);
-        unsigned int v=0;
-        if(index+1<AV_INTEGER_SIZE) v = a.v[index+1]<<16;
-        if(index  <AV_INTEGER_SIZE) v+= a.v[index  ];
-        out.v[i]= v >> (s&15);
-    }
-    return out;
-}
-
-AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b){
-    int i= av_log2_i(a) - av_log2_i(b);
-    AVInteger quot_temp;
-    if(!quot) quot = &quot_temp;
-
-    assert((int16_t)a[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b[AV_INTEGER_SIZE-1] >= 0);
-    assert(av_log2(b)>=0);
-
-    if(i > 0)
-        b= av_shr_i(b, -i);
-
-    memset(quot, 0, sizeof(AVInteger));
-
-    while(i-- >= 0){
-        *quot= av_shr_i(*quot, -1);
-        if(av_cmp_i(a, b) >= 0){
-            a= av_sub_i(a, b);
-            quot->v[0] += 1;
-        }
-        b= av_shr_i(b, 1);
-    }
-    return a;
-}
-
-AVInteger av_div_i(AVInteger a, AVInteger b){
-    AVInteger quot;
-    av_mod_i(&quot, a, b);
-    return quot;
-}
-
-AVInteger av_int2i(int64_t a){
-    AVInteger out;
-    int i;
-
-    for(i=0; i<AV_INTEGER_SIZE; i++){
-        out.v[i]= a;
-        a>>=16;
-    }
-    return out;
-}
-
-int64_t av_i2int(AVInteger a){
-    int i;
-    int64_t out=(int8_t)a.v[AV_INTEGER_SIZE-1];
-
-    for(i= AV_INTEGER_SIZE-2; i>=0; i--){
-        out = (out<<16) + a.v[i];
-    }
-    return out;
-}
-
-#ifdef TEST
-#undef NDEBUG
-#include <assert.h>
-
-const uint8_t ff_log2_tab[256]={
-        0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-        5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-        6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-        6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
-};
-
-int main(void){
-    int64_t a,b;
-
-    for(a=7; a<256*256*256; a+=13215){
-        for(b=3; b<256*256*256; b+=27118){
-            AVInteger ai= av_int2i(a);
-            AVInteger bi= av_int2i(b);
-
-            assert(av_i2int(ai) == a);
-            assert(av_i2int(bi) == b);
-            assert(av_i2int(av_add_i(ai,bi)) == a+b);
-            assert(av_i2int(av_sub_i(ai,bi)) == a-b);
-            assert(av_i2int(av_mul_i(ai,bi)) == a*b);
-            assert(av_i2int(av_shr_i(ai, 9)) == a>>9);
-            assert(av_i2int(av_shr_i(ai,-9)) == a<<9);
-            assert(av_i2int(av_shr_i(ai, 17)) == a>>17);
-            assert(av_i2int(av_shr_i(ai,-17)) == a<<17);
-            assert(av_log2_i(ai) == av_log2(a));
-            assert(av_i2int(av_div_i(ai,bi)) == a/b);
-        }
-    }
-    return 0;
-}
-#endif
diff --git a/libavutil/integer.h b/libavutil/integer.h
deleted file mode 100644
index fb46acb..0000000
--- a/libavutil/integer.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * arbitrary precision integers
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * arbitrary precision integers
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVUTIL_INTEGER_H
-#define AVUTIL_INTEGER_H
-
-#include <stdint.h>
-#include "common.h"
-
-#define AV_INTEGER_SIZE 8
-
-typedef struct AVInteger{
-    uint16_t v[AV_INTEGER_SIZE];
-} AVInteger;
-
-AVInteger av_add_i(AVInteger a, AVInteger b) av_const;
-AVInteger av_sub_i(AVInteger a, AVInteger b) av_const;
-
-/**
- * Returns the rounded-down value of the base 2 logarithm of the given
- * AVInteger. This is simply the index of the most significant bit
- * which is 1, or 0 if all bits are 0.
- */
-int av_log2_i(AVInteger a) av_const;
-AVInteger av_mul_i(AVInteger a, AVInteger b) av_const;
-
-/**
- * Returns 0 if a==b, 1 if a>b and -1 if a<b.
- */
-int av_cmp_i(AVInteger a, AVInteger b) av_const;
-
-/**
- * bitwise shift
- * @param s the number of bits by which the value should be shifted right,
-            may be negative for shifting left
- */
-AVInteger av_shr_i(AVInteger a, int s) av_const;
-
-/**
- * Returns a % b.
- * @param quot a/b will be stored here.
- */
-AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b);
-
-/**
- * Returns a/b.
- */
-AVInteger av_div_i(AVInteger a, AVInteger b) av_const;
-
-/**
- * Converts the given int64_t to an AVInteger.
- */
-AVInteger av_int2i(int64_t a) av_const;
-
-/**
- * Converts the given AVInteger to an int64_t.
- * If the AVInteger is too large to fit into an int64_t,
- * then only the least significant 64 bits will be used.
- */
-int64_t av_i2int(AVInteger a) av_const;
-
-#endif /* AVUTIL_INTEGER_H */
diff --git a/libavutil/internal.h b/libavutil/internal.h
deleted file mode 100644
index fe8a6fa..0000000
--- a/libavutil/internal.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * common internal API header
- */
-
-#ifndef AVUTIL_INTERNAL_H
-#define AVUTIL_INTERNAL_H
-
-#if !defined(DEBUG) && !defined(NDEBUG)
-#    define NDEBUG
-#endif
-
-#include <limits.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <assert.h>
-#include "config.h"
-#include "attributes.h"
-#include "timer.h"
-
-#ifndef attribute_align_arg
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,2)
-#    define attribute_align_arg __attribute__((force_align_arg_pointer))
-#else
-#    define attribute_align_arg
-#endif
-#endif
-
-#ifndef attribute_used
-#if AV_GCC_VERSION_AT_LEAST(3,1)
-#    define attribute_used __attribute__((used))
-#else
-#    define attribute_used
-#endif
-#endif
-
-#ifndef av_alias
-#if HAVE_ATTRIBUTE_MAY_ALIAS && (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(3,3)
-#   define av_alias __attribute__((may_alias))
-#else
-#   define av_alias
-#endif
-#endif
-
-#ifndef INT16_MIN
-#define INT16_MIN       (-0x7fff - 1)
-#endif
-
-#ifndef INT16_MAX
-#define INT16_MAX       0x7fff
-#endif
-
-#ifndef INT32_MIN
-#define INT32_MIN       (-0x7fffffff - 1)
-#endif
-
-#ifndef INT32_MAX
-#define INT32_MAX       0x7fffffff
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX      0xffffffff
-#endif
-
-#ifndef INT64_MIN
-#define INT64_MIN       (-0x7fffffffffffffffLL - 1)
-#endif
-
-#ifndef INT64_MAX
-#define INT64_MAX INT64_C(9223372036854775807)
-#endif
-
-#ifndef UINT64_MAX
-#define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF)
-#endif
-
-#ifndef INT_BIT
-#    define INT_BIT (CHAR_BIT * sizeof(int))
-#endif
-
-#ifndef offsetof
-#    define offsetof(T, F) ((unsigned int)((char *)&((T *)0)->F))
-#endif
-
-/* Use to export labels from asm. */
-#define LABEL_MANGLE(a) EXTERN_PREFIX #a
-
-// Use rip-relative addressing if compiling PIC code on x86-64.
-#if ARCH_X86_64 && defined(PIC)
-#    define LOCAL_MANGLE(a) #a "(%%rip)"
-#else
-#    define LOCAL_MANGLE(a) #a
-#endif
-
-#define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a)
-
-/* debug stuff */
-
-/* dprintf macros */
-#ifdef DEBUG
-#    define dprintf(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
-#else
-#    define dprintf(pctx, ...)
-#endif
-
-#define av_abort()      do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
-
-/* math */
-
-#if ARCH_X86
-#define MASK_ABS(mask, level)\
-            __asm__ volatile(\
-                "cltd                   \n\t"\
-                "xorl %1, %0            \n\t"\
-                "subl %1, %0            \n\t"\
-                : "+a" (level), "=&d" (mask)\
-            );
-#else
-#define MASK_ABS(mask, level)\
-            mask  = level >> 31;\
-            level = (level ^ mask) - mask;
-#endif
-
-/* avoid usage of dangerous/inappropriate system functions */
-#undef  malloc
-#define malloc please_use_av_malloc
-#undef  free
-#define free please_use_av_free
-#undef  realloc
-#define realloc please_use_av_realloc
-#undef  time
-#define time time_is_forbidden_due_to_security_issues
-#undef  rand
-#define rand rand_is_forbidden_due_to_state_trashing_use_av_lfg_get
-#undef  srand
-#define srand srand_is_forbidden_due_to_state_trashing_use_av_lfg_init
-#undef  random
-#define random random_is_forbidden_due_to_state_trashing_use_av_lfg_get
-#undef  sprintf
-#define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf
-#undef  strcat
-#define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat
-#undef  exit
-#define exit exit_is_forbidden
-#ifndef LIBAVFORMAT_BUILD
-#undef  printf
-#define printf please_use_av_log_instead_of_printf
-#undef  fprintf
-#define fprintf please_use_av_log_instead_of_fprintf
-#undef  puts
-#define puts please_use_av_log_instead_of_puts
-#undef  perror
-#define perror please_use_av_log_instead_of_perror
-#endif
-
-#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
-{\
-    p = av_malloc(size);\
-    if (p == NULL && (size) != 0) {\
-        av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
-        goto label;\
-    }\
-}
-
-#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\
-{\
-    p = av_mallocz(size);\
-    if (p == NULL && (size) != 0) {\
-        av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
-        goto label;\
-    }\
-}
-
-#include "libm.h"
-
-/**
- * Returns NULL if CONFIG_SMALL is true, otherwise the argument
- * without modification. Used to disable the definition of strings
- * (for example AVCodec long_names).
- */
-#if CONFIG_SMALL
-#   define NULL_IF_CONFIG_SMALL(x) NULL
-#else
-#   define NULL_IF_CONFIG_SMALL(x) x
-#endif
-
-#if HAVE_SYMVER_ASM_LABEL
-#   define FF_SYMVER(type, name, args, ver)                     \
-    type ff_##name args __asm__ (EXTERN_PREFIX #name "@" ver);  \
-    type ff_##name args
-#elif HAVE_SYMVER_GNU_ASM
-#   define FF_SYMVER(type, name, args, ver)                             \
-    __asm__ (".symver ff_" #name "," EXTERN_PREFIX #name "@" ver);      \
-    type ff_##name args;                                                \
-    type ff_##name args
-#endif
-
-#endif /* AVUTIL_INTERNAL_H */
diff --git a/libavutil/intfloat_readwrite.c b/libavutil/intfloat_readwrite.c
deleted file mode 100644
index 79fe186..0000000
--- a/libavutil/intfloat_readwrite.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * portable IEEE float/double read/write functions
- *
- * Copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * portable IEEE float/double read/write functions
- */
-
-#include <stdint.h>
-#include <math.h>
-#include "intfloat_readwrite.h"
-
-double av_int2dbl(int64_t v){
-    if(v+v > 0xFFEULL<<52)
-        return 0.0/0.0;
-    return ldexp(((v&((1LL<<52)-1)) + (1LL<<52)) * (v>>63|1), (v>>52&0x7FF)-1075);
-}
-
-float av_int2flt(int32_t v){
-    if(v+v > 0xFF000000U)
-        return 0.0/0.0;
-    return ldexp(((v&0x7FFFFF) + (1<<23)) * (v>>31|1), (v>>23&0xFF)-150);
-}
-
-double av_ext2dbl(const AVExtFloat ext){
-    uint64_t m = 0;
-    int e, i;
-
-    for (i = 0; i < 8; i++)
-        m = (m<<8) + ext.mantissa[i];
-    e = (((int)ext.exponent[0]&0x7f)<<8) | ext.exponent[1];
-    if (e == 0x7fff && m)
-        return 0.0/0.0;
-    e -= 16383 + 63;        /* In IEEE 80 bits, the whole (i.e. 1.xxxx)
-                             * mantissa bit is written as opposed to the
-                             * single and double precision formats. */
-    if (ext.exponent[0]&0x80)
-        m= -m;
-    return ldexp(m, e);
-}
-
-int64_t av_dbl2int(double d){
-    int e;
-    if     ( !d) return 0;
-    else if(d-d) return 0x7FF0000000000000LL + ((int64_t)(d<0)<<63) + (d!=d);
-    d= frexp(d, &e);
-    return (int64_t)(d<0)<<63 | (e+1022LL)<<52 | (int64_t)((fabs(d)-0.5)*(1LL<<53));
-}
-
-int32_t av_flt2int(float d){
-    int e;
-    if     ( !d) return 0;
-    else if(d-d) return 0x7F800000 + ((d<0)<<31) + (d!=d);
-    d= frexp(d, &e);
-    return (d<0)<<31 | (e+126)<<23 | (int64_t)((fabs(d)-0.5)*(1<<24));
-}
-
-AVExtFloat av_dbl2ext(double d){
-    struct AVExtFloat ext= {{0}};
-    int e, i; double f; uint64_t m;
-
-    f = fabs(frexp(d, &e));
-    if (f >= 0.5 && f < 1) {
-        e += 16382;
-        ext.exponent[0] = e>>8;
-        ext.exponent[1] = e;
-        m = (uint64_t)ldexp(f, 64);
-        for (i=0; i < 8; i++)
-            ext.mantissa[i] = m>>(56-(i<<3));
-    } else if (f != 0.0) {
-        ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
-        if (f != 1/0.0)
-            ext.mantissa[0] = ~0;
-    }
-    if (d < 0)
-        ext.exponent[0] |= 0x80;
-    return ext;
-}
-
diff --git a/libavutil/intfloat_readwrite.h b/libavutil/intfloat_readwrite.h
deleted file mode 100644
index 1b80fc6..0000000
--- a/libavutil/intfloat_readwrite.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_INTFLOAT_READWRITE_H
-#define AVUTIL_INTFLOAT_READWRITE_H
-
-#include <stdint.h>
-#include "attributes.h"
-
-/* IEEE 80 bits extended float */
-typedef struct AVExtFloat  {
-    uint8_t exponent[2];
-    uint8_t mantissa[8];
-} AVExtFloat;
-
-double av_int2dbl(int64_t v) av_const;
-float av_int2flt(int32_t v) av_const;
-double av_ext2dbl(const AVExtFloat ext) av_const;
-int64_t av_dbl2int(double d) av_const;
-int32_t av_flt2int(float d) av_const;
-AVExtFloat av_dbl2ext(double d) av_const;
-
-#endif /* AVUTIL_INTFLOAT_READWRITE_H */
diff --git a/libavutil/intmath.h b/libavutil/intmath.h
deleted file mode 100644
index 95ee1ff..0000000
--- a/libavutil/intmath.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_INTMATH_H
-#define AVUTIL_INTMATH_H
-
-#include <stdint.h>
-#include "config.h"
-#include "attributes.h"
-
-extern const uint32_t ff_inverse[257];
-
-#if   ARCH_ARM
-#   include "arm/intmath.h"
-#elif ARCH_X86
-#   include "x86/intmath.h"
-#endif
-
-#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4)
-
-#ifndef av_log2
-
-#define av_log2(x) (31 - __builtin_clz((x)|1))
-
-#ifndef av_log2_16bit
-#define av_log2_16bit av_log2
-#endif
-
-#endif /* av_log2 */
-
-#endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
-
-#ifndef FASTDIV
-
-#if CONFIG_FASTDIV
-#    define FASTDIV(a,b)   ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32))
-#else
-#    define FASTDIV(a,b)   ((a) / (b))
-#endif
-
-#endif /* FASTDIV */
-
-/*
- * Get definition of av_log2_c from common.h.  In the event we got
- * here through common.h including this file, including it again will
- * be a no-op due to multi-inclusion guards, so we must duplicate the
- * fallback defines here.
- */
-
-#include "common.h"
-
-#ifndef av_log2
-#   define av_log2       av_log2_c
-#endif
-#ifndef av_log2_16bit
-#   define av_log2_16bit av_log2_16bit_c
-#endif
-
-extern const uint8_t ff_sqrt_tab[256];
-
-static inline av_const unsigned int ff_sqrt(unsigned int a)
-{
-    unsigned int b;
-
-    if (a < 255) return (ff_sqrt_tab[a + 1] - 1) >> 4;
-    else if (a < (1 << 12)) b = ff_sqrt_tab[a >> 4] >> 2;
-#if !CONFIG_SMALL
-    else if (a < (1 << 14)) b = ff_sqrt_tab[a >> 6] >> 1;
-    else if (a < (1 << 16)) b = ff_sqrt_tab[a >> 8]   ;
-#endif
-    else {
-        int s = av_log2_16bit(a >> 16) >> 1;
-        unsigned int c = a >> (s + 2);
-        b = ff_sqrt_tab[c >> (s + 8)];
-        b = FASTDIV(c,b) + (b << s);
-    }
-
-    return b - (a < b * b);
-}
-
-#endif /* AVUTIL_INTMATH_H */
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
deleted file mode 100644
index c8026f0..0000000
--- a/libavutil/intreadwrite.h
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_INTREADWRITE_H
-#define AVUTIL_INTREADWRITE_H
-
-#include <stdint.h>
-#include "config.h"
-#include "bswap.h"
-#include "common.h"
-
-typedef union {
-    uint64_t u64;
-    uint32_t u32[2];
-    uint16_t u16[4];
-    uint8_t  u8 [8];
-    double   f64;
-    float    f32[2];
-} av_alias av_alias64;
-
-typedef union {
-    uint32_t u32;
-    uint16_t u16[2];
-    uint8_t  u8 [4];
-    float    f32;
-} av_alias av_alias32;
-
-typedef union {
-    uint16_t u16;
-    uint8_t  u8 [2];
-} av_alias av_alias16;
-
-/*
- * Arch-specific headers can provide any combination of
- * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros.
- * Preprocessor symbols must be defined, even if these are implemented
- * as inline functions.
- */
-
-#if   ARCH_ARM
-#   include "arm/intreadwrite.h"
-#elif ARCH_AVR32
-#   include "avr32/intreadwrite.h"
-#elif ARCH_MIPS
-#   include "mips/intreadwrite.h"
-#elif ARCH_PPC
-#   include "ppc/intreadwrite.h"
-#elif ARCH_TOMI
-#   include "tomi/intreadwrite.h"
-#elif ARCH_X86
-#   include "x86/intreadwrite.h"
-#endif
-
-/*
- * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers.
- */
-
-#if HAVE_BIGENDIAN
-
-#   if    defined(AV_RN16) && !defined(AV_RB16)
-#       define AV_RB16(p) AV_RN16(p)
-#   elif !defined(AV_RN16) &&  defined(AV_RB16)
-#       define AV_RN16(p) AV_RB16(p)
-#   endif
-
-#   if    defined(AV_WN16) && !defined(AV_WB16)
-#       define AV_WB16(p, v) AV_WN16(p, v)
-#   elif !defined(AV_WN16) &&  defined(AV_WB16)
-#       define AV_WN16(p, v) AV_WB16(p, v)
-#   endif
-
-#   if    defined(AV_RN24) && !defined(AV_RB24)
-#       define AV_RB24(p) AV_RN24(p)
-#   elif !defined(AV_RN24) &&  defined(AV_RB24)
-#       define AV_RN24(p) AV_RB24(p)
-#   endif
-
-#   if    defined(AV_WN24) && !defined(AV_WB24)
-#       define AV_WB24(p, v) AV_WN24(p, v)
-#   elif !defined(AV_WN24) &&  defined(AV_WB24)
-#       define AV_WN24(p, v) AV_WB24(p, v)
-#   endif
-
-#   if    defined(AV_RN32) && !defined(AV_RB32)
-#       define AV_RB32(p) AV_RN32(p)
-#   elif !defined(AV_RN32) &&  defined(AV_RB32)
-#       define AV_RN32(p) AV_RB32(p)
-#   endif
-
-#   if    defined(AV_WN32) && !defined(AV_WB32)
-#       define AV_WB32(p, v) AV_WN32(p, v)
-#   elif !defined(AV_WN32) &&  defined(AV_WB32)
-#       define AV_WN32(p, v) AV_WB32(p, v)
-#   endif
-
-#   if    defined(AV_RN64) && !defined(AV_RB64)
-#       define AV_RB64(p) AV_RN64(p)
-#   elif !defined(AV_RN64) &&  defined(AV_RB64)
-#       define AV_RN64(p) AV_RB64(p)
-#   endif
-
-#   if    defined(AV_WN64) && !defined(AV_WB64)
-#       define AV_WB64(p, v) AV_WN64(p, v)
-#   elif !defined(AV_WN64) &&  defined(AV_WB64)
-#       define AV_WN64(p, v) AV_WB64(p, v)
-#   endif
-
-#else /* HAVE_BIGENDIAN */
-
-#   if    defined(AV_RN16) && !defined(AV_RL16)
-#       define AV_RL16(p) AV_RN16(p)
-#   elif !defined(AV_RN16) &&  defined(AV_RL16)
-#       define AV_RN16(p) AV_RL16(p)
-#   endif
-
-#   if    defined(AV_WN16) && !defined(AV_WL16)
-#       define AV_WL16(p, v) AV_WN16(p, v)
-#   elif !defined(AV_WN16) &&  defined(AV_WL16)
-#       define AV_WN16(p, v) AV_WL16(p, v)
-#   endif
-
-#   if    defined(AV_RN24) && !defined(AV_RL24)
-#       define AV_RL24(p) AV_RN24(p)
-#   elif !defined(AV_RN24) &&  defined(AV_RL24)
-#       define AV_RN24(p) AV_RL24(p)
-#   endif
-
-#   if    defined(AV_WN24) && !defined(AV_WL24)
-#       define AV_WL24(p, v) AV_WN24(p, v)
-#   elif !defined(AV_WN24) &&  defined(AV_WL24)
-#       define AV_WN24(p, v) AV_WL24(p, v)
-#   endif
-
-#   if    defined(AV_RN32) && !defined(AV_RL32)
-#       define AV_RL32(p) AV_RN32(p)
-#   elif !defined(AV_RN32) &&  defined(AV_RL32)
-#       define AV_RN32(p) AV_RL32(p)
-#   endif
-
-#   if    defined(AV_WN32) && !defined(AV_WL32)
-#       define AV_WL32(p, v) AV_WN32(p, v)
-#   elif !defined(AV_WN32) &&  defined(AV_WL32)
-#       define AV_WN32(p, v) AV_WL32(p, v)
-#   endif
-
-#   if    defined(AV_RN64) && !defined(AV_RL64)
-#       define AV_RL64(p) AV_RN64(p)
-#   elif !defined(AV_RN64) &&  defined(AV_RL64)
-#       define AV_RN64(p) AV_RL64(p)
-#   endif
-
-#   if    defined(AV_WN64) && !defined(AV_WL64)
-#       define AV_WL64(p, v) AV_WN64(p, v)
-#   elif !defined(AV_WN64) &&  defined(AV_WL64)
-#       define AV_WN64(p, v) AV_WL64(p, v)
-#   endif
-
-#endif /* !HAVE_BIGENDIAN */
-
-/*
- * Define AV_[RW]N helper macros to simplify definitions not provided
- * by per-arch headers.
- */
-
-#if   HAVE_ATTRIBUTE_PACKED
-
-union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias;
-union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias;
-union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
-
-#   define AV_RN(s, p) (((const union unaligned_##s *) (p))->l)
-#   define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v))
-
-#elif defined(__DECC)
-
-#   define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
-#   define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v))
-
-#elif HAVE_FAST_UNALIGNED
-
-#   define AV_RN(s, p) (((const av_alias##s*)(p))->u##s)
-#   define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v))
-
-#else
-
-#ifndef AV_RB16
-#   define AV_RB16(x)                           \
-    ((((const uint8_t*)(x))[0] << 8) |          \
-      ((const uint8_t*)(x))[1])
-#endif
-#ifndef AV_WB16
-#   define AV_WB16(p, d) do {                   \
-        ((uint8_t*)(p))[1] = (d);               \
-        ((uint8_t*)(p))[0] = (d)>>8;            \
-    } while(0)
-#endif
-
-#ifndef AV_RL16
-#   define AV_RL16(x)                           \
-    ((((const uint8_t*)(x))[1] << 8) |          \
-      ((const uint8_t*)(x))[0])
-#endif
-#ifndef AV_WL16
-#   define AV_WL16(p, d) do {                   \
-        ((uint8_t*)(p))[0] = (d);               \
-        ((uint8_t*)(p))[1] = (d)>>8;            \
-    } while(0)
-#endif
-
-#ifndef AV_RB32
-#   define AV_RB32(x)                           \
-    ((((const uint8_t*)(x))[0] << 24) |         \
-     (((const uint8_t*)(x))[1] << 16) |         \
-     (((const uint8_t*)(x))[2] <<  8) |         \
-      ((const uint8_t*)(x))[3])
-#endif
-#ifndef AV_WB32
-#   define AV_WB32(p, d) do {                   \
-        ((uint8_t*)(p))[3] = (d);               \
-        ((uint8_t*)(p))[2] = (d)>>8;            \
-        ((uint8_t*)(p))[1] = (d)>>16;           \
-        ((uint8_t*)(p))[0] = (d)>>24;           \
-    } while(0)
-#endif
-
-#ifndef AV_RL32
-#   define AV_RL32(x)                           \
-    ((((const uint8_t*)(x))[3] << 24) |         \
-     (((const uint8_t*)(x))[2] << 16) |         \
-     (((const uint8_t*)(x))[1] <<  8) |         \
-      ((const uint8_t*)(x))[0])
-#endif
-#ifndef AV_WL32
-#   define AV_WL32(p, d) do {                   \
-        ((uint8_t*)(p))[0] = (d);               \
-        ((uint8_t*)(p))[1] = (d)>>8;            \
-        ((uint8_t*)(p))[2] = (d)>>16;           \
-        ((uint8_t*)(p))[3] = (d)>>24;           \
-    } while(0)
-#endif
-
-#ifndef AV_RB64
-#   define AV_RB64(x)                                   \
-    (((uint64_t)((const uint8_t*)(x))[0] << 56) |       \
-     ((uint64_t)((const uint8_t*)(x))[1] << 48) |       \
-     ((uint64_t)((const uint8_t*)(x))[2] << 40) |       \
-     ((uint64_t)((const uint8_t*)(x))[3] << 32) |       \
-     ((uint64_t)((const uint8_t*)(x))[4] << 24) |       \
-     ((uint64_t)((const uint8_t*)(x))[5] << 16) |       \
-     ((uint64_t)((const uint8_t*)(x))[6] <<  8) |       \
-      (uint64_t)((const uint8_t*)(x))[7])
-#endif
-#ifndef AV_WB64
-#   define AV_WB64(p, d) do {                   \
-        ((uint8_t*)(p))[7] = (d);               \
-        ((uint8_t*)(p))[6] = (d)>>8;            \
-        ((uint8_t*)(p))[5] = (d)>>16;           \
-        ((uint8_t*)(p))[4] = (d)>>24;           \
-        ((uint8_t*)(p))[3] = (d)>>32;           \
-        ((uint8_t*)(p))[2] = (d)>>40;           \
-        ((uint8_t*)(p))[1] = (d)>>48;           \
-        ((uint8_t*)(p))[0] = (d)>>56;           \
-    } while(0)
-#endif
-
-#ifndef AV_RL64
-#   define AV_RL64(x)                                   \
-    (((uint64_t)((const uint8_t*)(x))[7] << 56) |       \
-     ((uint64_t)((const uint8_t*)(x))[6] << 48) |       \
-     ((uint64_t)((const uint8_t*)(x))[5] << 40) |       \
-     ((uint64_t)((const uint8_t*)(x))[4] << 32) |       \
-     ((uint64_t)((const uint8_t*)(x))[3] << 24) |       \
-     ((uint64_t)((const uint8_t*)(x))[2] << 16) |       \
-     ((uint64_t)((const uint8_t*)(x))[1] <<  8) |       \
-      (uint64_t)((const uint8_t*)(x))[0])
-#endif
-#ifndef AV_WL64
-#   define AV_WL64(p, d) do {                   \
-        ((uint8_t*)(p))[0] = (d);               \
-        ((uint8_t*)(p))[1] = (d)>>8;            \
-        ((uint8_t*)(p))[2] = (d)>>16;           \
-        ((uint8_t*)(p))[3] = (d)>>24;           \
-        ((uint8_t*)(p))[4] = (d)>>32;           \
-        ((uint8_t*)(p))[5] = (d)>>40;           \
-        ((uint8_t*)(p))[6] = (d)>>48;           \
-        ((uint8_t*)(p))[7] = (d)>>56;           \
-    } while(0)
-#endif
-
-#if HAVE_BIGENDIAN
-#   define AV_RN(s, p)    AV_RB##s(p)
-#   define AV_WN(s, p, v) AV_WB##s(p, v)
-#else
-#   define AV_RN(s, p)    AV_RL##s(p)
-#   define AV_WN(s, p, v) AV_WL##s(p, v)
-#endif
-
-#endif /* HAVE_FAST_UNALIGNED */
-
-#ifndef AV_RN16
-#   define AV_RN16(p) AV_RN(16, p)
-#endif
-
-#ifndef AV_RN32
-#   define AV_RN32(p) AV_RN(32, p)
-#endif
-
-#ifndef AV_RN64
-#   define AV_RN64(p) AV_RN(64, p)
-#endif
-
-#ifndef AV_WN16
-#   define AV_WN16(p, v) AV_WN(16, p, v)
-#endif
-
-#ifndef AV_WN32
-#   define AV_WN32(p, v) AV_WN(32, p, v)
-#endif
-
-#ifndef AV_WN64
-#   define AV_WN64(p, v) AV_WN(64, p, v)
-#endif
-
-#if HAVE_BIGENDIAN
-#   define AV_RB(s, p)    AV_RN##s(p)
-#   define AV_WB(s, p, v) AV_WN##s(p, v)
-#   define AV_RL(s, p)    bswap_##s(AV_RN##s(p))
-#   define AV_WL(s, p, v) AV_WN##s(p, bswap_##s(v))
-#else
-#   define AV_RB(s, p)    bswap_##s(AV_RN##s(p))
-#   define AV_WB(s, p, v) AV_WN##s(p, bswap_##s(v))
-#   define AV_RL(s, p)    AV_RN##s(p)
-#   define AV_WL(s, p, v) AV_WN##s(p, v)
-#endif
-
-#define AV_RB8(x)     (((const uint8_t*)(x))[0])
-#define AV_WB8(p, d)  do { ((uint8_t*)(p))[0] = (d); } while(0)
-
-#define AV_RL8(x)     AV_RB8(x)
-#define AV_WL8(p, d)  AV_WB8(p, d)
-
-#ifndef AV_RB16
-#   define AV_RB16(p)    AV_RB(16, p)
-#endif
-#ifndef AV_WB16
-#   define AV_WB16(p, v) AV_WB(16, p, v)
-#endif
-
-#ifndef AV_RL16
-#   define AV_RL16(p)    AV_RL(16, p)
-#endif
-#ifndef AV_WL16
-#   define AV_WL16(p, v) AV_WL(16, p, v)
-#endif
-
-#ifndef AV_RB32
-#   define AV_RB32(p)    AV_RB(32, p)
-#endif
-#ifndef AV_WB32
-#   define AV_WB32(p, v) AV_WB(32, p, v)
-#endif
-
-#ifndef AV_RL32
-#   define AV_RL32(p)    AV_RL(32, p)
-#endif
-#ifndef AV_WL32
-#   define AV_WL32(p, v) AV_WL(32, p, v)
-#endif
-
-#ifndef AV_RB64
-#   define AV_RB64(p)    AV_RB(64, p)
-#endif
-#ifndef AV_WB64
-#   define AV_WB64(p, v) AV_WB(64, p, v)
-#endif
-
-#ifndef AV_RL64
-#   define AV_RL64(p)    AV_RL(64, p)
-#endif
-#ifndef AV_WL64
-#   define AV_WL64(p, v) AV_WL(64, p, v)
-#endif
-
-#ifndef AV_RB24
-#   define AV_RB24(x)                           \
-    ((((const uint8_t*)(x))[0] << 16) |         \
-     (((const uint8_t*)(x))[1] <<  8) |         \
-      ((const uint8_t*)(x))[2])
-#endif
-#ifndef AV_WB24
-#   define AV_WB24(p, d) do {                   \
-        ((uint8_t*)(p))[2] = (d);               \
-        ((uint8_t*)(p))[1] = (d)>>8;            \
-        ((uint8_t*)(p))[0] = (d)>>16;           \
-    } while(0)
-#endif
-
-#ifndef AV_RL24
-#   define AV_RL24(x)                           \
-    ((((const uint8_t*)(x))[2] << 16) |         \
-     (((const uint8_t*)(x))[1] <<  8) |         \
-      ((const uint8_t*)(x))[0])
-#endif
-#ifndef AV_WL24
-#   define AV_WL24(p, d) do {                   \
-        ((uint8_t*)(p))[0] = (d);               \
-        ((uint8_t*)(p))[1] = (d)>>8;            \
-        ((uint8_t*)(p))[2] = (d)>>16;           \
-    } while(0)
-#endif
-
-/*
- * The AV_[RW]NA macros access naturally aligned data
- * in a type-safe way.
- */
-
-#define AV_RNA(s, p)    (((const av_alias##s*)(p))->u##s)
-#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v))
-
-#ifndef AV_RN16A
-#   define AV_RN16A(p) AV_RNA(16, p)
-#endif
-
-#ifndef AV_RN32A
-#   define AV_RN32A(p) AV_RNA(32, p)
-#endif
-
-#ifndef AV_RN64A
-#   define AV_RN64A(p) AV_RNA(64, p)
-#endif
-
-#ifndef AV_WN16A
-#   define AV_WN16A(p, v) AV_WNA(16, p, v)
-#endif
-
-#ifndef AV_WN32A
-#   define AV_WN32A(p, v) AV_WNA(32, p, v)
-#endif
-
-#ifndef AV_WN64A
-#   define AV_WN64A(p, v) AV_WNA(64, p, v)
-#endif
-
-/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
- * naturally aligned. They may be implemented using MMX,
- * so emms_c() must be called before using any float code
- * afterwards.
- */
-
-#define AV_COPY(n, d, s) \
-    (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n)
-
-#ifndef AV_COPY16
-#   define AV_COPY16(d, s) AV_COPY(16, d, s)
-#endif
-
-#ifndef AV_COPY32
-#   define AV_COPY32(d, s) AV_COPY(32, d, s)
-#endif
-
-#ifndef AV_COPY64
-#   define AV_COPY64(d, s) AV_COPY(64, d, s)
-#endif
-
-#ifndef AV_COPY128
-#   define AV_COPY128(d, s)                    \
-    do {                                       \
-        AV_COPY64(d, s);                       \
-        AV_COPY64((char*)(d)+8, (char*)(s)+8); \
-    } while(0)
-#endif
-
-#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b))
-
-#ifndef AV_SWAP64
-#   define AV_SWAP64(a, b) AV_SWAP(64, a, b)
-#endif
-
-#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0)
-
-#ifndef AV_ZERO16
-#   define AV_ZERO16(d) AV_ZERO(16, d)
-#endif
-
-#ifndef AV_ZERO32
-#   define AV_ZERO32(d) AV_ZERO(32, d)
-#endif
-
-#ifndef AV_ZERO64
-#   define AV_ZERO64(d) AV_ZERO(64, d)
-#endif
-
-#ifndef AV_ZERO128
-#   define AV_ZERO128(d)         \
-    do {                         \
-        AV_ZERO64(d);            \
-        AV_ZERO64((char*)(d)+8); \
-    } while(0)
-#endif
-
-#endif /* AVUTIL_INTREADWRITE_H */
diff --git a/libavutil/lfg.c b/libavutil/lfg.c
deleted file mode 100644
index 1dad4e4..0000000
--- a/libavutil/lfg.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Lagged Fibonacci PRNG
- * Copyright (c) 2008 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-#include "lfg.h"
-#include "md5.h"
-#include "intreadwrite.h"
-#include "attributes.h"
-
-void av_cold av_lfg_init(AVLFG *c, unsigned int seed){
-    uint8_t tmp[16]={0};
-    int i;
-
-    for(i=8; i<64; i+=4){
-        AV_WL32(tmp, seed); tmp[4]=i;
-        av_md5_sum(tmp, tmp,  16);
-        c->state[i  ]= AV_RL32(tmp);
-        c->state[i+1]= AV_RL32(tmp+4);
-        c->state[i+2]= AV_RL32(tmp+8);
-        c->state[i+3]= AV_RL32(tmp+12);
-    }
-    c->index=0;
-}
-
-void av_bmg_get(AVLFG *lfg, double out[2])
-{
-    double x1, x2, w;
-
-    do {
-        x1 = 2.0/UINT_MAX*av_lfg_get(lfg) - 1.0;
-        x2 = 2.0/UINT_MAX*av_lfg_get(lfg) - 1.0;
-        w = x1*x1 + x2*x2;
-    } while (w >= 1.0);
-
-    w = sqrt((-2.0 * log(w)) / w);
-    out[0] = x1 * w;
-    out[1] = x2 * w;
-}
-
-#ifdef TEST
-#include "log.h"
-#include "timer.h"
-
-int main(void)
-{
-    int x=0;
-    int i, j;
-    AVLFG state;
-
-    av_lfg_init(&state, 0xdeadbeef);
-    for (j = 0; j < 10000; j++) {
-        START_TIMER
-        for (i = 0; i < 624; i++) {
-//            av_log(NULL,AV_LOG_ERROR, "%X\n", av_lfg_get(&state));
-            x+=av_lfg_get(&state);
-        }
-        STOP_TIMER("624 calls of av_lfg_get");
-    }
-    av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x);
-
-    /* BMG usage example */
-    {
-        double mean   = 1000;
-        double stddev = 53;
-
-        av_lfg_init(&state, 42);
-
-        for (i = 0; i < 1000; i += 2) {
-            double bmg_out[2];
-            av_bmg_get(&state, bmg_out);
-            av_log(NULL, AV_LOG_INFO,
-                   "%f\n%f\n",
-                   bmg_out[0] * stddev + mean,
-                   bmg_out[1] * stddev + mean);
-        }
-    }
-
-    return 0;
-}
-#endif
diff --git a/libavutil/lfg.h b/libavutil/lfg.h
deleted file mode 100644
index ac89d12..0000000
--- a/libavutil/lfg.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Lagged Fibonacci PRNG
- * Copyright (c) 2008 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_LFG_H
-#define AVUTIL_LFG_H
-
-typedef struct {
-    unsigned int state[64];
-    int index;
-} AVLFG;
-
-void av_lfg_init(AVLFG *c, unsigned int seed);
-
-/**
- * Gets the next random unsigned 32-bit number using an ALFG.
- *
- * Please also consider a simple LCG like state= state*1664525+1013904223,
- * it may be good enough and faster for your specific use case.
- */
-static inline unsigned int av_lfg_get(AVLFG *c){
-    c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63];
-    return c->state[c->index++ & 63];
-}
-
-/**
- * Gets the next random unsigned 32-bit number using a MLFG.
- *
- * Please also consider av_lfg_get() above, it is faster.
- */
-static inline unsigned int av_mlfg_get(AVLFG *c){
-    unsigned int a= c->state[(c->index-55) & 63];
-    unsigned int b= c->state[(c->index-24) & 63];
-    return c->state[c->index++ & 63] = 2*a*b+a+b;
-}
-
-/**
- * Gets the next two numbers generated by a Box-Muller Gaussian
- * generator using the random numbers issued by lfg.
- *
- * @param out[2] array where are placed the two generated numbers
- */
-void av_bmg_get(AVLFG *lfg, double out[2]);
-
-#endif /* AVUTIL_LFG_H */
diff --git a/libavutil/libavutil.v b/libavutil/libavutil.v
deleted file mode 100644
index ec52f2b..0000000
--- a/libavutil/libavutil.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBAVUTIL_$MAJOR {
-        global: av_*; ff_*; avutil_*;
-        local: *;
-};
diff --git a/libavutil/libm.h b/libavutil/libm.h
deleted file mode 100644
index c7c28ac..0000000
--- a/libavutil/libm.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * Replacements for frequently missing libm functions
- */
-
-#ifndef AVUTIL_LIBM_H
-#define AVUTIL_LIBM_H
-
-#include <math.h>
-#include "config.h"
-#include "attributes.h"
-
-#if !HAVE_EXP2
-#undef exp2
-#define exp2(x) exp((x) * 0.693147180559945)
-#endif /* HAVE_EXP2 */
-
-#if !HAVE_EXP2F
-#undef exp2f
-#define exp2f(x) ((float)exp2(x))
-#endif /* HAVE_EXP2F */
-
-#if !HAVE_LLRINT
-#undef llrint
-#define llrint(x) ((long long)rint(x))
-#endif /* HAVE_LLRINT */
-
-#if !HAVE_LLRINTF
-#undef llrintf
-#define llrintf(x) ((long long)rint(x))
-#endif /* HAVE_LLRINT */
-
-#if !HAVE_LOG2
-#undef log2
-#define log2(x) (log(x) * 1.44269504088896340736)
-#endif /* HAVE_LOG2 */
-
-#if !HAVE_LOG2F
-#undef log2f
-#define log2f(x) ((float)log2(x))
-#endif /* HAVE_LOG2F */
-
-#if !HAVE_LRINT
-static av_always_inline av_const long int lrint(double x)
-{
-    return rint(x);
-}
-#endif /* HAVE_LRINT */
-
-#if !HAVE_LRINTF
-static av_always_inline av_const long int lrintf(float x)
-{
-    return (int)(rint(x));
-}
-#endif /* HAVE_LRINTF */
-
-#if !HAVE_ROUND
-static av_always_inline av_const double round(double x)
-{
-    return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
-}
-#endif /* HAVE_ROUND */
-
-#if !HAVE_ROUNDF
-static av_always_inline av_const float roundf(float x)
-{
-    return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
-}
-#endif /* HAVE_ROUNDF */
-
-#if !HAVE_TRUNCF
-static av_always_inline av_const float truncf(float x)
-{
-    return (x > 0) ? floor(x) : ceil(x);
-}
-#endif /* HAVE_TRUNCF */
-
-#endif /* AVUTIL_LIBM_H */
diff --git a/libavutil/lls.c b/libavutil/lls.c
deleted file mode 100644
index 3855792..0000000
--- a/libavutil/lls.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * linear least squares model
- *
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * linear least squares model
- */
-
-#include <math.h>
-#include <string.h>
-
-#include "lls.h"
-
-void av_init_lls(LLSModel *m, int indep_count){
-    memset(m, 0, sizeof(LLSModel));
-
-    m->indep_count= indep_count;
-}
-
-void av_update_lls(LLSModel *m, double *var, double decay){
-    int i,j;
-
-    for(i=0; i<=m->indep_count; i++){
-        for(j=i; j<=m->indep_count; j++){
-            m->covariance[i][j] *= decay;
-            m->covariance[i][j] += var[i]*var[j];
-        }
-    }
-}
-
-void av_solve_lls(LLSModel *m, double threshold, int min_order){
-    int i,j,k;
-    double (*factor)[MAX_VARS+1]= (void*)&m->covariance[1][0];
-    double (*covar )[MAX_VARS+1]= (void*)&m->covariance[1][1];
-    double  *covar_y            =  m->covariance[0];
-    int count= m->indep_count;
-
-    for(i=0; i<count; i++){
-        for(j=i; j<count; j++){
-            double sum= covar[i][j];
-
-            for(k=i-1; k>=0; k--)
-                sum -= factor[i][k]*factor[j][k];
-
-            if(i==j){
-                if(sum < threshold)
-                    sum= 1.0;
-                factor[i][i]= sqrt(sum);
-            }else
-                factor[j][i]= sum / factor[i][i];
-        }
-    }
-    for(i=0; i<count; i++){
-        double sum= covar_y[i+1];
-        for(k=i-1; k>=0; k--)
-            sum -= factor[i][k]*m->coeff[0][k];
-        m->coeff[0][i]= sum / factor[i][i];
-    }
-
-    for(j=count-1; j>=min_order; j--){
-        for(i=j; i>=0; i--){
-            double sum= m->coeff[0][i];
-            for(k=i+1; k<=j; k++)
-                sum -= factor[k][i]*m->coeff[j][k];
-            m->coeff[j][i]= sum / factor[i][i];
-        }
-
-        m->variance[j]= covar_y[0];
-        for(i=0; i<=j; i++){
-            double sum= m->coeff[j][i]*covar[i][i] - 2*covar_y[i+1];
-            for(k=0; k<i; k++)
-                sum += 2*m->coeff[j][k]*covar[k][i];
-            m->variance[j] += m->coeff[j][i]*sum;
-        }
-    }
-}
-
-double av_evaluate_lls(LLSModel *m, double *param, int order){
-    int i;
-    double out= 0;
-
-    for(i=0; i<=order; i++)
-        out+= param[i]*m->coeff[order][i];
-
-    return out;
-}
-
-#ifdef TEST
-
-#include <stdlib.h>
-#include <stdio.h>
-
-int main(void){
-    LLSModel m;
-    int i, order;
-
-    av_init_lls(&m, 3);
-
-    for(i=0; i<100; i++){
-        double var[4];
-        double eval;
-        var[0] = (rand() / (double)RAND_MAX - 0.5)*2;
-        var[1] = var[0] + rand() / (double)RAND_MAX - 0.5;
-        var[2] = var[1] + rand() / (double)RAND_MAX - 0.5;
-        var[3] = var[2] + rand() / (double)RAND_MAX - 0.5;
-        av_update_lls(&m, var, 0.99);
-        av_solve_lls(&m, 0.001, 0);
-        for(order=0; order<3; order++){
-            eval= av_evaluate_lls(&m, var+1, order);
-            printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
-                var[0], order, eval, sqrt(m.variance[order] / (i+1)),
-                m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]);
-        }
-    }
-    return 0;
-}
-
-#endif
diff --git a/libavutil/lls.h b/libavutil/lls.h
deleted file mode 100644
index d168e59..0000000
--- a/libavutil/lls.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * linear least squares model
- *
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_LLS_H
-#define AVUTIL_LLS_H
-
-#define MAX_VARS 32
-
-//FIXME avoid direct access to LLSModel from outside
-
-/**
- * Linear least squares model.
- */
-typedef struct LLSModel{
-    double covariance[MAX_VARS+1][MAX_VARS+1];
-    double coeff[MAX_VARS][MAX_VARS];
-    double variance[MAX_VARS];
-    int indep_count;
-}LLSModel;
-
-void av_init_lls(LLSModel *m, int indep_count);
-void av_update_lls(LLSModel *m, double *param, double decay);
-void av_solve_lls(LLSModel *m, double threshold, int min_order);
-double av_evaluate_lls(LLSModel *m, double *param, int order);
-
-#endif /* AVUTIL_LLS_H */
diff --git a/libavutil/log.c b/libavutil/log.c
deleted file mode 100644
index 9a8b66e..0000000
--- a/libavutil/log.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * log functions
- * Copyright (c) 2003 Michel Bardiaux
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * logging functions
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include "avutil.h"
-#include "log.h"
-
-#if LIBAVUTIL_VERSION_MAJOR > 50
-static
-#endif
-int av_log_level = AV_LOG_INFO;
-
-static int use_ansi_color=-1;
-
-#undef fprintf
-static void colored_fputs(int color, const char *str){
-    if(use_ansi_color<0){
-#if HAVE_ISATTY && !defined(_WIN32)
-        use_ansi_color= getenv("TERM") && !getenv("NO_COLOR") && isatty(2);
-#else
-        use_ansi_color= 0;
-#endif
-    }
-
-    if(use_ansi_color){
-        fprintf(stderr, "\033[%d;3%dm", color>>4, color&15);
-    }
-    fputs(str, stderr);
-    if(use_ansi_color){
-        fprintf(stderr, "\033[0m");
-    }
-}
-
-void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
-{
-    static int print_prefix=1;
-    static int count;
-    static char line[1024], prev[1024];
-    static const uint8_t color[]={0x41,0x41,0x11,0x03,9,9,9};
-    AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
-    if(level>av_log_level)
-        return;
-#undef fprintf
-    if(print_prefix && avc) {
-        snprintf(line, sizeof(line), "[%s @ %p]", avc->item_name(ptr), ptr);
-    }else
-        line[0]=0;
-
-    vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
-
-    print_prefix= line[strlen(line)-1] == '\n';
-    if(print_prefix && !strcmp(line, prev)){
-        count++;
-        return;
-    }
-    if(count>0){
-        fprintf(stderr, "    Last message repeated %d times\n", count);
-        count=0;
-    }
-    colored_fputs(color[av_clip(level>>3, 0, 6)], line);
-    strcpy(prev, line);
-}
-
-static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;
-
-void av_log(void* avcl, int level, const char *fmt, ...)
-{
-    va_list vl;
-    va_start(vl, fmt);
-    av_vlog(avcl, level, fmt, vl);
-    va_end(vl);
-}
-
-void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
-{
-    av_log_callback(avcl, level, fmt, vl);
-}
-
-int av_log_get_level(void)
-{
-    return av_log_level;
-}
-
-void av_log_set_level(int level)
-{
-    av_log_level = level;
-}
-
-void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
-{
-    av_log_callback = callback;
-}
diff --git a/libavutil/log.h b/libavutil/log.h
deleted file mode 100644
index 1c3e490..0000000
--- a/libavutil/log.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_LOG_H
-#define AVUTIL_LOG_H
-
-#include <stdarg.h>
-#include "avutil.h"
-
-/**
- * Describes the class of an AVClass context structure. That is an
- * arbitrary struct of which the first field is a pointer to an
- * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
- */
-typedef struct {
-    /**
-     * The name of the class; usually it is the same name as the
-     * context structure type to which the AVClass is associated.
-     */
-    const char* class_name;
-
-    /**
-     * A pointer to a function which returns the name of a context
-     * instance ctx associated with the class.
-     */
-    const char* (*item_name)(void* ctx);
-
-    /**
-     * a pointer to the first option specified in the class if any or NULL
-     *
-     * @see av_set_default_options()
-     */
-    const struct AVOption *option;
-
-    /**
-     * LIBAVUTIL_VERSION with which this structure was created.
-     * This is used to allow fields to be added without requiring major
-     * version bumps everywhere.
-     */
-
-    int version;
-} AVClass;
-
-/* av_log API */
-
-#define AV_LOG_QUIET    -8
-
-/**
- * Something went really wrong and we will crash now.
- */
-#define AV_LOG_PANIC     0
-
-/**
- * Something went wrong and recovery is not possible.
- * For example, no header was found for a format which depends
- * on headers or an illegal combination of parameters is used.
- */
-#define AV_LOG_FATAL     8
-
-/**
- * Something went wrong and cannot losslessly be recovered.
- * However, not all future data is affected.
- */
-#define AV_LOG_ERROR    16
-
-/**
- * Something somehow does not look correct. This may or may not
- * lead to problems. An example would be the use of '-vstrict -2'.
- */
-#define AV_LOG_WARNING  24
-
-#define AV_LOG_INFO     32
-#define AV_LOG_VERBOSE  40
-
-/**
- * Stuff which is only useful for libav* developers.
- */
-#define AV_LOG_DEBUG    48
-
-/**
- * Sends the specified message to the log if the level is less than or equal
- * to the current av_log_level. By default, all logging messages are sent to
- * stderr. This behavior can be altered by setting a different av_vlog callback
- * function.
- *
- * @param avcl A pointer to an arbitrary struct of which the first field is a
- * pointer to an AVClass struct.
- * @param level The importance level of the message, lower values signifying
- * higher importance.
- * @param fmt The format string (printf-compatible) that specifies how
- * subsequent arguments are converted to output.
- * @see av_vlog
- */
-#ifdef __GNUC__
-void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-#else
-void av_log(void*, int level, const char *fmt, ...);
-#endif
-
-void av_vlog(void*, int level, const char *fmt, va_list);
-int av_log_get_level(void);
-void av_log_set_level(int);
-void av_log_set_callback(void (*)(void*, int, const char*, va_list));
-void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
-
-#endif /* AVUTIL_LOG_H */
diff --git a/libavutil/lzo.c b/libavutil/lzo.c
deleted file mode 100644
index a876fc7..0000000
--- a/libavutil/lzo.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * LZO 1x decompression
- * Copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avutil.h"
-#include "common.h"
-//! Avoid e.g. MPlayers fast_memcpy, it slows things down here.
-#undef memcpy
-#include <string.h>
-#include "lzo.h"
-
-//! Define if we may write up to 12 bytes beyond the output buffer.
-#define OUTBUF_PADDED 1
-//! Define if we may read up to 8 bytes beyond the input buffer.
-#define INBUF_PADDED 1
-typedef struct LZOContext {
-    const uint8_t *in, *in_end;
-    uint8_t *out_start, *out, *out_end;
-    int error;
-} LZOContext;
-
-/**
- * \brief Reads one byte from the input buffer, avoiding an overrun.
- * \return byte read
- */
-static inline int get_byte(LZOContext *c) {
-    if (c->in < c->in_end)
-        return *c->in++;
-    c->error |= AV_LZO_INPUT_DEPLETED;
-    return 1;
-}
-
-#ifdef INBUF_PADDED
-#define GETB(c) (*(c).in++)
-#else
-#define GETB(c) get_byte(&(c))
-#endif
-
-/**
- * \brief Decodes a length value in the coding used by lzo.
- * \param x previous byte value
- * \param mask bits used from x
- * \return decoded length value
- */
-static inline int get_len(LZOContext *c, int x, int mask) {
-    int cnt = x & mask;
-    if (!cnt) {
-        while (!(x = get_byte(c))) cnt += 255;
-        cnt += mask + x;
-    }
-    return cnt;
-}
-
-//#define UNALIGNED_LOADSTORE
-#define BUILTIN_MEMCPY
-#ifdef UNALIGNED_LOADSTORE
-#define COPY2(d, s) *(uint16_t *)(d) = *(uint16_t *)(s);
-#define COPY4(d, s) *(uint32_t *)(d) = *(uint32_t *)(s);
-#elif defined(BUILTIN_MEMCPY)
-#define COPY2(d, s) memcpy(d, s, 2);
-#define COPY4(d, s) memcpy(d, s, 4);
-#else
-#define COPY2(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1];
-#define COPY4(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1]; (d)[2] = (s)[2]; (d)[3] = (s)[3];
-#endif
-
-/**
- * \brief Copies bytes from input to output buffer with checking.
- * \param cnt number of bytes to copy, must be >= 0
- */
-static inline void copy(LZOContext *c, int cnt) {
-    register const uint8_t *src = c->in;
-    register uint8_t *dst = c->out;
-    if (cnt > c->in_end - src) {
-        cnt = FFMAX(c->in_end - src, 0);
-        c->error |= AV_LZO_INPUT_DEPLETED;
-    }
-    if (cnt > c->out_end - dst) {
-        cnt = FFMAX(c->out_end - dst, 0);
-        c->error |= AV_LZO_OUTPUT_FULL;
-    }
-#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
-    COPY4(dst, src);
-    src += 4;
-    dst += 4;
-    cnt -= 4;
-    if (cnt > 0)
-#endif
-        memcpy(dst, src, cnt);
-    c->in = src + cnt;
-    c->out = dst + cnt;
-}
-
-static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);
-
-/**
- * \brief Copies previously decoded bytes to current position.
- * \param back how many bytes back we start
- * \param cnt number of bytes to copy, must be >= 0
- *
- * cnt > back is valid, this will copy the bytes we just copied,
- * thus creating a repeating pattern with a period length of back.
- */
-static inline void copy_backptr(LZOContext *c, int back, int cnt) {
-    register const uint8_t *src = &c->out[-back];
-    register uint8_t *dst = c->out;
-    if (src < c->out_start || src > dst) {
-        c->error |= AV_LZO_INVALID_BACKPTR;
-        return;
-    }
-    if (cnt > c->out_end - dst) {
-        cnt = FFMAX(c->out_end - dst, 0);
-        c->error |= AV_LZO_OUTPUT_FULL;
-    }
-    memcpy_backptr(dst, back, cnt);
-    c->out = dst + cnt;
-}
-
-static inline void memcpy_backptr(uint8_t *dst, int back, int cnt) {
-    const uint8_t *src = &dst[-back];
-    if (back == 1) {
-        memset(dst, *src, cnt);
-    } else {
-#ifdef OUTBUF_PADDED
-        COPY2(dst, src);
-        COPY2(dst + 2, src + 2);
-        src += 4;
-        dst += 4;
-        cnt -= 4;
-        if (cnt > 0) {
-            COPY2(dst, src);
-            COPY2(dst + 2, src + 2);
-            COPY2(dst + 4, src + 4);
-            COPY2(dst + 6, src + 6);
-            src += 8;
-            dst += 8;
-            cnt -= 8;
-        }
-#endif
-        if (cnt > 0) {
-            int blocklen = back;
-            while (cnt > blocklen) {
-                memcpy(dst, src, blocklen);
-                dst += blocklen;
-                cnt -= blocklen;
-                blocklen <<= 1;
-            }
-            memcpy(dst, src, cnt);
-        }
-    }
-}
-
-void av_memcpy_backptr(uint8_t *dst, int back, int cnt) {
-    memcpy_backptr(dst, back, cnt);
-}
-
-int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
-    int state= 0;
-    int x;
-    LZOContext c;
-    c.in = in;
-    c.in_end = (const uint8_t *)in + *inlen;
-    c.out = c.out_start = out;
-    c.out_end = (uint8_t *)out + * outlen;
-    c.error = 0;
-    x = GETB(c);
-    if (x > 17) {
-        copy(&c, x - 17);
-        x = GETB(c);
-        if (x < 16) c.error |= AV_LZO_ERROR;
-    }
-    if (c.in > c.in_end)
-        c.error |= AV_LZO_INPUT_DEPLETED;
-    while (!c.error) {
-        int cnt, back;
-        if (x > 15) {
-            if (x > 63) {
-                cnt = (x >> 5) - 1;
-                back = (GETB(c) << 3) + ((x >> 2) & 7) + 1;
-            } else if (x > 31) {
-                cnt = get_len(&c, x, 31);
-                x = GETB(c);
-                back = (GETB(c) << 6) + (x >> 2) + 1;
-            } else {
-                cnt = get_len(&c, x, 7);
-                back = (1 << 14) + ((x & 8) << 11);
-                x = GETB(c);
-                back += (GETB(c) << 6) + (x >> 2);
-                if (back == (1 << 14)) {
-                    if (cnt != 1)
-                        c.error |= AV_LZO_ERROR;
-                    break;
-                }
-            }
-        } else if(!state){
-                cnt = get_len(&c, x, 15);
-                copy(&c, cnt + 3);
-                x = GETB(c);
-                if (x > 15)
-                    continue;
-                cnt = 1;
-                back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1;
-        } else {
-                cnt = 0;
-                back = (GETB(c) << 2) + (x >> 2) + 1;
-        }
-        copy_backptr(&c, back, cnt + 2);
-        state=
-        cnt = x & 3;
-        copy(&c, cnt);
-        x = GETB(c);
-    }
-    *inlen = c.in_end - c.in;
-    if (c.in > c.in_end)
-        *inlen = 0;
-    *outlen = c.out_end - c.out;
-    return c.error;
-}
-
-#ifdef TEST
-#include <stdio.h>
-#include <lzo/lzo1x.h>
-#include "log.h"
-#define MAXSZ (10*1024*1024)
-
-/* Define one of these to 1 if you wish to benchmark liblzo
- * instead of our native implementation. */
-#define BENCHMARK_LIBLZO_SAFE   0
-#define BENCHMARK_LIBLZO_UNSAFE 0
-
-int main(int argc, char *argv[]) {
-    FILE *in = fopen(argv[1], "rb");
-    uint8_t *orig = av_malloc(MAXSZ + 16);
-    uint8_t *comp = av_malloc(2*MAXSZ + 16);
-    uint8_t *decomp = av_malloc(MAXSZ + 16);
-    size_t s = fread(orig, 1, MAXSZ, in);
-    lzo_uint clen = 0;
-    long tmp[LZO1X_MEM_COMPRESS];
-    int inlen, outlen;
-    int i;
-    av_log_set_level(AV_LOG_DEBUG);
-    lzo1x_999_compress(orig, s, comp, &clen, tmp);
-    for (i = 0; i < 300; i++) {
-START_TIMER
-        inlen = clen; outlen = MAXSZ;
-#if BENCHMARK_LIBLZO_SAFE
-        if (lzo1x_decompress_safe(comp, inlen, decomp, &outlen, NULL))
-#elif BENCHMARK_LIBLZO_UNSAFE
-        if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL))
-#else
-        if (av_lzo1x_decode(decomp, &outlen, comp, &inlen))
-#endif
-            av_log(NULL, AV_LOG_ERROR, "decompression error\n");
-STOP_TIMER("lzod")
-    }
-    if (memcmp(orig, decomp, s))
-        av_log(NULL, AV_LOG_ERROR, "decompression incorrect\n");
-    else
-        av_log(NULL, AV_LOG_ERROR, "decompression OK\n");
-    return 0;
-}
-#endif
diff --git a/libavutil/lzo.h b/libavutil/lzo.h
deleted file mode 100644
index 6788054..0000000
--- a/libavutil/lzo.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * LZO 1x decompression
- * copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_LZO_H
-#define AVUTIL_LZO_H
-
-#include <stdint.h>
-
-/** \defgroup errflags Error flags returned by av_lzo1x_decode
-  * \{ */
-//! end of the input buffer reached before decoding finished
-#define AV_LZO_INPUT_DEPLETED 1
-//! decoded data did not fit into output buffer
-#define AV_LZO_OUTPUT_FULL 2
-//! a reference to previously decoded data was wrong
-#define AV_LZO_INVALID_BACKPTR 4
-//! a non-specific error in the compressed bitstream
-#define AV_LZO_ERROR 8
-/** \} */
-
-#define AV_LZO_INPUT_PADDING 8
-#define AV_LZO_OUTPUT_PADDING 12
-
-/**
- * \brief Decodes LZO 1x compressed data.
- * \param out output buffer
- * \param outlen size of output buffer, number of bytes left are returned here
- * \param in input buffer
- * \param inlen size of input buffer, number of bytes left are returned here
- * \return 0 on success, otherwise a combination of the error flags above
- *
- * Make sure all buffers are appropriately padded, in must provide
- * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
- */
-int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
-
-/**
- * \brief deliberately overlapping memcpy implementation
- * \param dst destination buffer; must be padded with 12 additional bytes
- * \param back how many bytes back we start (the initial size of the overlapping window)
- * \param cnt number of bytes to copy, must be >= 0
- *
- * cnt > back is valid, this will copy the bytes we just copied,
- * thus creating a repeating pattern with a period length of back.
- */
-void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
-
-#endif /* AVUTIL_LZO_H */
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
deleted file mode 100644
index c06cb16..0000000
--- a/libavutil/mathematics.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * miscellaneous math routines and tables
- */
-
-#include <assert.h>
-#include <stdint.h>
-#include <limits.h>
-#include "mathematics.h"
-
-const uint8_t ff_sqrt_tab[256]={
-  0, 16, 23, 28, 32, 36, 40, 43, 46, 48, 51, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90,
- 91, 92, 94, 95, 96, 98, 99,100,102,103,104,105,107,108,109,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,151,152,153,154,155,156,156,
-157,158,159,160,160,161,162,163,164,164,165,166,167,168,168,169,170,171,171,172,173,174,174,175,176,176,177,178,179,179,180,181,
-182,182,183,184,184,185,186,186,187,188,188,189,190,190,191,192,192,193,194,194,195,196,196,197,198,198,199,200,200,201,202,202,
-203,204,204,205,205,206,207,207,208,208,209,210,210,211,212,212,213,213,214,215,215,216,216,217,218,218,219,219,220,220,221,222,
-222,223,223,224,224,225,226,226,227,227,228,228,229,230,230,231,231,232,232,233,233,234,235,235,236,236,237,237,238,238,239,239,
-240,240,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,255,255
-};
-
-const uint8_t ff_log2_tab[256]={
-        0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
-        5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-        6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-        6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
-};
-
-const uint8_t av_reverse[256]={
-0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
-0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8,
-0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4,
-0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC,
-0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2,
-0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA,
-0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6,
-0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE,
-0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1,
-0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9,
-0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5,
-0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD,
-0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3,
-0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB,
-0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7,
-0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF,
-};
-
-int64_t av_gcd(int64_t a, int64_t b){
-    if(b) return av_gcd(b, a%b);
-    else  return a;
-}
-
-int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){
-    int64_t r=0;
-    assert(c > 0);
-    assert(b >=0);
-    assert(rnd >=0 && rnd<=5 && rnd!=4);
-
-    if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1));
-
-    if(rnd==AV_ROUND_NEAR_INF) r= c/2;
-    else if(rnd&1)             r= c-1;
-
-    if(b<=INT_MAX && c<=INT_MAX){
-        if(a<=INT_MAX)
-            return (a * b + r)/c;
-        else
-            return a/c*b + (a%c*b + r)/c;
-    }else{
-#if 1
-        uint64_t a0= a&0xFFFFFFFF;
-        uint64_t a1= a>>32;
-        uint64_t b0= b&0xFFFFFFFF;
-        uint64_t b1= b>>32;
-        uint64_t t1= a0*b1 + a1*b0;
-        uint64_t t1a= t1<<32;
-        int i;
-
-        a0 = a0*b0 + t1a;
-        a1 = a1*b1 + (t1>>32) + (a0<t1a);
-        a0 += r;
-        a1 += a0<r;
-
-        for(i=63; i>=0; i--){
-//            int o= a1 & 0x8000000000000000ULL;
-            a1+= a1 + ((a0>>i)&1);
-            t1+=t1;
-            if(/*o || */c <= a1){
-                a1 -= c;
-                t1++;
-            }
-        }
-        return t1;
-    }
-#else
-        AVInteger ai;
-        ai= av_mul_i(av_int2i(a), av_int2i(b));
-        ai= av_add_i(ai, av_int2i(r));
-
-        return av_i2int(av_div_i(ai, av_int2i(c)));
-    }
-#endif
-}
-
-int64_t av_rescale(int64_t a, int64_t b, int64_t c){
-    return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
-}
-
-int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
-    int64_t b= bq.num * (int64_t)cq.den;
-    int64_t c= cq.num * (int64_t)bq.den;
-    return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
-}
-
-int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
-    int64_t a= tb_a.num * (int64_t)tb_b.den;
-    int64_t b= tb_b.num * (int64_t)tb_a.den;
-    if (av_rescale_rnd(ts_a, a, b, AV_ROUND_DOWN) < ts_b) return -1;
-    if (av_rescale_rnd(ts_b, b, a, AV_ROUND_DOWN) < ts_a) return  1;
-    return 0;
-}
-
-#ifdef TEST
-#include "integer.h"
-#undef printf
-int main(void){
-    int64_t a,b,c,d,e;
-
-    for(a=7; a<(1LL<<62); a+=a/3+1){
-        for(b=3; b<(1LL<<62); b+=b/4+1){
-            for(c=9; c<(1LL<<62); c+=(c*2)/5+3){
-                int64_t r= c/2;
-                AVInteger ai;
-                ai= av_mul_i(av_int2i(a), av_int2i(b));
-                ai= av_add_i(ai, av_int2i(r));
-
-                d= av_i2int(av_div_i(ai, av_int2i(c)));
-
-                e= av_rescale(a,b,c);
-
-                if((double)a * (double)b / (double)c > (1LL<<63))
-                    continue;
-
-                if(d!=e) printf("%"PRId64"*%"PRId64"/%"PRId64"= %"PRId64"=%"PRId64"\n", a, b, c, d, e);
-            }
-        }
-    }
-    return 0;
-}
-#endif
diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h
deleted file mode 100644
index e198aef..0000000
--- a/libavutil/mathematics.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_MATHEMATICS_H
-#define AVUTIL_MATHEMATICS_H
-
-#include <stdint.h>
-#include <math.h>
-#include "attributes.h"
-#include "rational.h"
-
-#ifndef M_E
-#define M_E            2.7182818284590452354   /* e */
-#endif
-#ifndef M_LN2
-#define M_LN2          0.69314718055994530942  /* log_e 2 */
-#endif
-#ifndef M_LN10
-#define M_LN10         2.30258509299404568402  /* log_e 10 */
-#endif
-#ifndef M_LOG2_10
-#define M_LOG2_10      3.32192809488736234787  /* log_2 10 */
-#endif
-#ifndef M_PI
-#define M_PI           3.14159265358979323846  /* pi */
-#endif
-#ifndef M_SQRT1_2
-#define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2) */
-#endif
-#ifndef M_SQRT2
-#define M_SQRT2        1.41421356237309504880  /* sqrt(2) */
-#endif
-#ifndef NAN
-#define NAN            (0.0/0.0)
-#endif
-#ifndef INFINITY
-#define INFINITY       (1.0/0.0)
-#endif
-
-enum AVRounding {
-    AV_ROUND_ZERO     = 0, ///< Round toward zero.
-    AV_ROUND_INF      = 1, ///< Round away from zero.
-    AV_ROUND_DOWN     = 2, ///< Round toward -infinity.
-    AV_ROUND_UP       = 3, ///< Round toward +infinity.
-    AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
-};
-
-/**
- * Returns the greatest common divisor of a and b.
- * If both a and b are 0 or either or both are <0 then behavior is
- * undefined.
- */
-int64_t av_const av_gcd(int64_t a, int64_t b);
-
-/**
- * Rescales a 64-bit integer with rounding to nearest.
- * A simple a*b/c isn't possible as it can overflow.
- */
-int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
-
-/**
- * Rescales a 64-bit integer with specified rounding.
- * A simple a*b/c isn't possible as it can overflow.
- */
-int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
-
-/**
- * Rescales a 64-bit integer by 2 rational numbers.
- */
-int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
-
-/**
- * Compares 2 timestamps each in its own timebases.
- * The result of the function is undefined if one of the timestamps
- * is outside the int64_t range when represented in the others timebase.
- * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
- */
-int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
-
-
-#endif /* AVUTIL_MATHEMATICS_H */
diff --git a/libavutil/md5.c b/libavutil/md5.c
deleted file mode 100644
index 39ee624..0000000
--- a/libavutil/md5.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2006 Michael Niedermayer (michaelni at gmx.at)
- * Copyright (C) 2003-2005 by Christopher R. Hertel (crh at ubiqx.mn.org)
- *
- * References:
- *  IETF RFC 1321: The MD5 Message-Digest Algorithm
- *       Ron Rivest. IETF, April, 1992
- *
- * based on http://ubiqx.org/libcifs/source/Auth/MD5.c
- *          from Christopher R. Hertel (crh at ubiqx.mn.org)
- * Simplified, cleaned and IMO redundant comments removed by michael.
- *
- * If you use gcc, then version 4.1 or later and -fomit-frame-pointer is
- * strongly recommended.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-#include "bswap.h"
-#include "md5.h"
-
-typedef struct AVMD5{
-    uint64_t len;
-    uint8_t  block[64];
-    uint32_t ABCD[4];
-} AVMD5;
-
-const int av_md5_size= sizeof(AVMD5);
-
-static const uint8_t S[4][4] = {
-    { 7, 12, 17, 22 },  /* round 1 */
-    { 5,  9, 14, 20 },  /* round 2 */
-    { 4, 11, 16, 23 },  /* round 3 */
-    { 6, 10, 15, 21 }   /* round 4 */
-};
-
-static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
-    0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,   /* round 1 */
-    0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
-    0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
-    0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
-
-    0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,   /* round 2 */
-    0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
-    0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
-    0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
-
-    0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,   /* round 3 */
-    0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
-    0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
-    0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
-
-    0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,   /* round 4 */
-    0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
-    0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
-    0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
-};
-
-#define CORE(i, a, b, c, d) \
-        t = S[i>>4][i&3];\
-        a += T[i];\
-\
-        if(i<32){\
-            if(i<16) a += (d ^ (b&(c^d))) + X[      i &15 ];\
-            else     a += (c ^ (d&(c^b))) + X[ (1+5*i)&15 ];\
-        }else{\
-            if(i<48) a += (b^c^d)         + X[ (5+3*i)&15 ];\
-            else     a += (c^(b|~d))      + X[ (  7*i)&15 ];\
-        }\
-        a = b + (( a << t ) | ( a >> (32 - t) ));
-
-static void body(uint32_t ABCD[4], uint32_t X[16]){
-
-    int t;
-    int i av_unused;
-    unsigned int a= ABCD[3];
-    unsigned int b= ABCD[2];
-    unsigned int c= ABCD[1];
-    unsigned int d= ABCD[0];
-
-#if HAVE_BIGENDIAN
-    for(i=0; i<16; i++)
-        X[i]= bswap_32(X[i]);
-#endif
-
-#if CONFIG_SMALL
-    for( i = 0; i < 64; i++ ){
-        CORE(i,a,b,c,d)
-        t=d; d=c; c=b; b=a; a=t;
-    }
-#else
-#define CORE2(i) CORE(i,a,b,c,d) CORE((i+1),d,a,b,c) CORE((i+2),c,d,a,b) CORE((i+3),b,c,d,a)
-#define CORE4(i) CORE2(i) CORE2((i+4)) CORE2((i+8)) CORE2((i+12))
-CORE4(0) CORE4(16) CORE4(32) CORE4(48)
-#endif
-
-    ABCD[0] += d;
-    ABCD[1] += c;
-    ABCD[2] += b;
-    ABCD[3] += a;
-}
-
-void av_md5_init(AVMD5 *ctx){
-    ctx->len    = 0;
-
-    ctx->ABCD[0] = 0x10325476;
-    ctx->ABCD[1] = 0x98badcfe;
-    ctx->ABCD[2] = 0xefcdab89;
-    ctx->ABCD[3] = 0x67452301;
-}
-
-void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){
-    int i, j;
-
-    j= ctx->len & 63;
-    ctx->len += len;
-
-    for( i = 0; i < len; i++ ){
-        ctx->block[j++] = src[i];
-        if( 64 == j ){
-            body(ctx->ABCD, (uint32_t*) ctx->block);
-            j = 0;
-        }
-    }
-}
-
-void av_md5_final(AVMD5 *ctx, uint8_t *dst){
-    int i;
-    uint64_t finalcount= le2me_64(ctx->len<<3);
-
-    av_md5_update(ctx, "\200", 1);
-    while((ctx->len & 63)!=56)
-        av_md5_update(ctx, "", 1);
-
-    av_md5_update(ctx, (uint8_t*)&finalcount, 8);
-
-    for(i=0; i<4; i++)
-        ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]);
-}
-
-void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){
-    AVMD5 ctx[1];
-
-    av_md5_init(ctx);
-    av_md5_update(ctx, src, len);
-    av_md5_final(ctx, dst);
-}
-
-#ifdef TEST
-#include <stdio.h>
-#include <inttypes.h>
-#undef printf
-int main(void){
-    uint64_t md5val;
-    int i;
-    uint8_t in[1000];
-
-    for(i=0; i<1000; i++) in[i]= i*i;
-    av_md5_sum( (uint8_t*)&md5val, in,  1000); printf("%"PRId64"\n", md5val);
-    av_md5_sum( (uint8_t*)&md5val, in,  63); printf("%"PRId64"\n", md5val);
-    av_md5_sum( (uint8_t*)&md5val, in,  64); printf("%"PRId64"\n", md5val);
-    av_md5_sum( (uint8_t*)&md5val, in,  65); printf("%"PRId64"\n", md5val);
-    for(i=0; i<1000; i++) in[i]= i % 127;
-    av_md5_sum( (uint8_t*)&md5val, in,  999); printf("%"PRId64"\n", md5val);
-
-    return 0;
-}
-#endif
diff --git a/libavutil/md5.h b/libavutil/md5.h
deleted file mode 100644
index 969202a..0000000
--- a/libavutil/md5.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_MD5_H
-#define AVUTIL_MD5_H
-
-#include <stdint.h>
-
-extern const int av_md5_size;
-
-struct AVMD5;
-
-void av_md5_init(struct AVMD5 *ctx);
-void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len);
-void av_md5_final(struct AVMD5 *ctx, uint8_t *dst);
-void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len);
-
-#endif /* AVUTIL_MD5_H */
-
diff --git a/libavutil/mem.c b/libavutil/mem.c
deleted file mode 100644
index 8cad089..0000000
--- a/libavutil/mem.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * default memory allocator for libavutil
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * default memory allocator for libavutil
- */
-
-#include "config.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
-#include "avutil.h"
-#include "mem.h"
-
-/* here we can use OS-dependent allocation functions */
-#undef free
-#undef malloc
-#undef realloc
-
-#ifdef MALLOC_PREFIX
-
-#define malloc         AV_JOIN(MALLOC_PREFIX, malloc)
-#define memalign       AV_JOIN(MALLOC_PREFIX, memalign)
-#define posix_memalign AV_JOIN(MALLOC_PREFIX, posix_memalign)
-#define realloc        AV_JOIN(MALLOC_PREFIX, realloc)
-#define free           AV_JOIN(MALLOC_PREFIX, free)
-
-void *malloc(size_t size);
-void *memalign(size_t align, size_t size);
-int   posix_memalign(void **ptr, size_t align, size_t size);
-void *realloc(void *ptr, size_t size);
-void  free(void *ptr);
-
-#endif /* MALLOC_PREFIX */
-
-/* You can redefine av_malloc and av_free in your project to use your
-   memory allocator. You do not need to suppress this file because the
-   linker will do it automatically. */
-
-void *av_malloc(unsigned int size)
-{
-    void *ptr = NULL;
-#if CONFIG_MEMALIGN_HACK
-    long diff;
-#endif
-
-    /* let's disallow possible ambiguous cases */
-    if(size > (INT_MAX-16) )
-        return NULL;
-
-#if CONFIG_MEMALIGN_HACK
-    ptr = malloc(size+16);
-    if(!ptr)
-        return ptr;
-    diff= ((-(long)ptr - 1)&15) + 1;
-    ptr = (char*)ptr + diff;
-    ((char*)ptr)[-1]= diff;
-#elif HAVE_POSIX_MEMALIGN
-    if (posix_memalign(&ptr,16,size))
-        ptr = NULL;
-#elif HAVE_MEMALIGN
-    ptr = memalign(16,size);
-    /* Why 64?
-       Indeed, we should align it:
-         on 4 for 386
-         on 16 for 486
-         on 32 for 586, PPro - K6-III
-         on 64 for K7 (maybe for P3 too).
-       Because L1 and L2 caches are aligned on those values.
-       But I don't want to code such logic here!
-     */
-     /* Why 16?
-        Because some CPUs need alignment, for example SSE2 on P4, & most RISC CPUs
-        it will just trigger an exception and the unaligned load will be done in the
-        exception handler or it will just segfault (SSE2 on P4).
-        Why not larger? Because I did not see a difference in benchmarks ...
-     */
-     /* benchmarks with P3
-        memalign(64)+1          3071,3051,3032
-        memalign(64)+2          3051,3032,3041
-        memalign(64)+4          2911,2896,2915
-        memalign(64)+8          2545,2554,2550
-        memalign(64)+16         2543,2572,2563
-        memalign(64)+32         2546,2545,2571
-        memalign(64)+64         2570,2533,2558
-
-        BTW, malloc seems to do 8-byte alignment by default here.
-     */
-#else
-    ptr = malloc(size);
-#endif
-    return ptr;
-}
-
-void *av_realloc(void *ptr, unsigned int size)
-{
-#if CONFIG_MEMALIGN_HACK
-    int diff;
-#endif
-
-    /* let's disallow possible ambiguous cases */
-    if(size > (INT_MAX-16) )
-        return NULL;
-
-#if CONFIG_MEMALIGN_HACK
-    //FIXME this isn't aligned correctly, though it probably isn't needed
-    if(!ptr) return av_malloc(size);
-    diff= ((char*)ptr)[-1];
-    return (char*)realloc((char*)ptr - diff, size + diff) + diff;
-#else
-    return realloc(ptr, size);
-#endif
-}
-
-void av_free(void *ptr)
-{
-    /* XXX: this test should not be needed on most libcs */
-    if (ptr)
-#if CONFIG_MEMALIGN_HACK
-        free((char*)ptr - ((char*)ptr)[-1]);
-#else
-        free(ptr);
-#endif
-}
-
-void av_freep(void *arg)
-{
-    void **ptr= (void**)arg;
-    av_free(*ptr);
-    *ptr = NULL;
-}
-
-void *av_mallocz(unsigned int size)
-{
-    void *ptr = av_malloc(size);
-    if (ptr)
-        memset(ptr, 0, size);
-    return ptr;
-}
-
-char *av_strdup(const char *s)
-{
-    char *ptr= NULL;
-    if(s){
-        int len = strlen(s) + 1;
-        ptr = av_malloc(len);
-        if (ptr)
-            memcpy(ptr, s, len);
-    }
-    return ptr;
-}
-
diff --git a/libavutil/mem.h b/libavutil/mem.h
deleted file mode 100644
index 1488792..0000000
--- a/libavutil/mem.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * memory handling functions
- */
-
-#ifndef AVUTIL_MEM_H
-#define AVUTIL_MEM_H
-
-#include "attributes.h"
-
-#if defined(__ICC) || defined(__SUNPRO_C)
-    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
-    #define DECLARE_ASM_CONST(n,t,v)    const t __attribute__ ((aligned (n))) v
-#elif defined(__TI_COMPILER_VERSION__)
-    #define DECLARE_ALIGNED(n,t,v)                      \
-        AV_PRAGMA(DATA_ALIGN(v,n))                      \
-        t __attribute__((aligned(n))) v
-    #define DECLARE_ASM_CONST(n,t,v)                    \
-        AV_PRAGMA(DATA_ALIGN(v,n))                      \
-        static const t __attribute__((aligned(n))) v
-#elif defined(__GNUC__)
-    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
-    #define DECLARE_ASM_CONST(n,t,v)    static const t attribute_used __attribute__ ((aligned (n))) v
-#elif defined(_MSC_VER)
-    #define DECLARE_ALIGNED(n,t,v)      __declspec(align(n)) t v
-    #define DECLARE_ASM_CONST(n,t,v)    __declspec(align(n)) static const t v
-#else
-    #define DECLARE_ALIGNED(n,t,v)      t v
-    #define DECLARE_ASM_CONST(n,t,v)    static const t v
-#endif
-
-#if AV_GCC_VERSION_AT_LEAST(3,1)
-    #define av_malloc_attrib __attribute__((__malloc__))
-#else
-    #define av_malloc_attrib
-#endif
-
-#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
-    #define av_alloc_size(n) __attribute__((alloc_size(n)))
-#else
-    #define av_alloc_size(n)
-#endif
-
-/**
- * Allocates a block of size bytes with alignment suitable for all
- * memory accesses (including vectors if available on the CPU).
- * @param size Size in bytes for the memory block to be allocated.
- * @return Pointer to the allocated block, NULL if the block cannot
- * be allocated.
- * @see av_mallocz()
- */
-void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1);
-
-/**
- * Allocates or reallocates a block of memory.
- * If ptr is NULL and size > 0, allocates a new block. If
- * size is zero, frees the memory block pointed to by ptr.
- * @param size Size in bytes for the memory block to be allocated or
- * reallocated.
- * @param ptr Pointer to a memory block already allocated with
- * av_malloc(z)() or av_realloc() or NULL.
- * @return Pointer to a newly reallocated block or NULL if the block
- * cannot be reallocated or the function is used to free the memory block.
- * @see av_fast_realloc()
- */
-void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2);
-
-/**
- * Frees a memory block which has been allocated with av_malloc(z)() or
- * av_realloc().
- * @param ptr Pointer to the memory block which should be freed.
- * @note ptr = NULL is explicitly allowed.
- * @note It is recommended that you use av_freep() instead.
- * @see av_freep()
- */
-void av_free(void *ptr);
-
-/**
- * Allocates a block of size bytes with alignment suitable for all
- * memory accesses (including vectors if available on the CPU) and
- * zeroes all the bytes of the block.
- * @param size Size in bytes for the memory block to be allocated.
- * @return Pointer to the allocated block, NULL if it cannot be allocated.
- * @see av_malloc()
- */
-void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1);
-
-/**
- * Duplicates the string s.
- * @param s string to be duplicated
- * @return Pointer to a newly allocated string containing a
- * copy of s or NULL if the string cannot be allocated.
- */
-char *av_strdup(const char *s) av_malloc_attrib;
-
-/**
- * Frees a memory block which has been allocated with av_malloc(z)() or
- * av_realloc() and set the pointer pointing to it to NULL.
- * @param ptr Pointer to the pointer to the memory block which should
- * be freed.
- * @see av_free()
- */
-void av_freep(void *ptr);
-
-#endif /* AVUTIL_MEM_H */
diff --git a/libavutil/mips/intreadwrite.h b/libavutil/mips/intreadwrite.h
deleted file mode 100644
index b7479d3..0000000
--- a/libavutil/mips/intreadwrite.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_MIPS_INTREADWRITE_H
-#define AVUTIL_MIPS_INTREADWRITE_H
-
-#include <stdint.h>
-#include "config.h"
-
-#define AV_RN32 AV_RN32
-static av_always_inline uint32_t AV_RN32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("lwl %0, %1  \n\t"
-             "lwr %0, %2  \n\t"
-             : "=&r"(v)
-             : "m"(*(const uint32_t *)((const uint8_t *)p+3*!HAVE_BIGENDIAN)),
-               "m"(*(const uint32_t *)((const uint8_t *)p+3*HAVE_BIGENDIAN)));
-    return v;
-}
-
-#define AV_WN32 AV_WN32
-static av_always_inline void AV_WN32(void *p, uint32_t v)
-{
-    __asm__ ("swl %2, %0  \n\t"
-             "swr %2, %1  \n\t"
-             : "=m"(*(uint32_t *)((uint8_t *)p+3*!HAVE_BIGENDIAN)),
-               "=m"(*(uint32_t *)((uint8_t *)p+3*HAVE_BIGENDIAN))
-             : "r"(v));
-}
-
-#if ARCH_MIPS64
-
-#define AV_RN64 AV_RN64
-static av_always_inline uint64_t AV_RN64(const void *p)
-{
-    uint64_t v;
-    __asm__ ("ldl %0, %1  \n\t"
-             "ldr %0, %2  \n\t"
-             : "=&r"(v)
-             : "m"(*(const uint64_t *)((const uint8_t *)p+7*!HAVE_BIGENDIAN)),
-               "m"(*(const uint64_t *)((const uint8_t *)p+7*HAVE_BIGENDIAN)));
-    return v;
-}
-
-#define AV_WN64 AV_WN64
-static av_always_inline void AV_WN64(void *p, uint64_t v)
-{
-    __asm__ ("sdl %2, %0  \n\t"
-             "sdr %2, %1  \n\t"
-             : "=m"(*(uint64_t *)((uint8_t *)p+7*!HAVE_BIGENDIAN)),
-               "=m"(*(uint64_t *)((uint8_t *)p+7*HAVE_BIGENDIAN))
-             : "r"(v));
-}
-
-#else
-
-#define AV_RN64 AV_RN64
-static av_always_inline uint64_t AV_RN64(const void *p)
-{
-    union { uint64_t v; uint32_t hl[2]; } v;
-    v.hl[0] = AV_RN32(p);
-    v.hl[1] = AV_RN32((const uint8_t *)p + 4);
-    return v.v;
-}
-
-#define AV_WN64 AV_WN64
-static av_always_inline void AV_WN64(void *p, uint64_t v)
-{
-    union { uint64_t v; uint32_t hl[2]; } vv = { v };
-    AV_WN32(p, vv.hl[0]);
-    AV_WN32((uint8_t *)p + 4, vv.hl[1]);
-}
-
-#endif /* ARCH_MIPS64 */
-
-#endif /* AVUTIL_MIPS_INTREADWRITE_H */
diff --git a/libavutil/pca.c b/libavutil/pca.c
deleted file mode 100644
index ce08e9c..0000000
--- a/libavutil/pca.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * principal component analysis (PCA)
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * principal component analysis (PCA)
- */
-
-#include "common.h"
-#include "pca.h"
-
-typedef struct PCA{
-    int count;
-    int n;
-    double *covariance;
-    double *mean;
-}PCA;
-
-PCA *ff_pca_init(int n){
-    PCA *pca;
-    if(n<=0)
-        return NULL;
-
-    pca= av_mallocz(sizeof(PCA));
-    pca->n= n;
-    pca->count=0;
-    pca->covariance= av_mallocz(sizeof(double)*n*n);
-    pca->mean= av_mallocz(sizeof(double)*n);
-
-    return pca;
-}
-
-void ff_pca_free(PCA *pca){
-    av_freep(&pca->covariance);
-    av_freep(&pca->mean);
-    av_free(pca);
-}
-
-void ff_pca_add(PCA *pca, double *v){
-    int i, j;
-    const int n= pca->n;
-
-    for(i=0; i<n; i++){
-        pca->mean[i] += v[i];
-        for(j=i; j<n; j++)
-            pca->covariance[j + i*n] += v[i]*v[j];
-    }
-    pca->count++;
-}
-
-int ff_pca(PCA *pca, double *eigenvector, double *eigenvalue){
-    int i, j, pass;
-    int k=0;
-    const int n= pca->n;
-    double z[n];
-
-    memset(eigenvector, 0, sizeof(double)*n*n);
-
-    for(j=0; j<n; j++){
-        pca->mean[j] /= pca->count;
-        eigenvector[j + j*n] = 1.0;
-        for(i=0; i<=j; i++){
-            pca->covariance[j + i*n] /= pca->count;
-            pca->covariance[j + i*n] -= pca->mean[i] * pca->mean[j];
-            pca->covariance[i + j*n] = pca->covariance[j + i*n];
-        }
-        eigenvalue[j]= pca->covariance[j + j*n];
-        z[j]= 0;
-    }
-
-    for(pass=0; pass < 50; pass++){
-        double sum=0;
-
-        for(i=0; i<n; i++)
-            for(j=i+1; j<n; j++)
-                sum += fabs(pca->covariance[j + i*n]);
-
-        if(sum == 0){
-            for(i=0; i<n; i++){
-                double maxvalue= -1;
-                for(j=i; j<n; j++){
-                    if(eigenvalue[j] > maxvalue){
-                        maxvalue= eigenvalue[j];
-                        k= j;
-                    }
-                }
-                eigenvalue[k]= eigenvalue[i];
-                eigenvalue[i]= maxvalue;
-                for(j=0; j<n; j++){
-                    double tmp= eigenvector[k + j*n];
-                    eigenvector[k + j*n]= eigenvector[i + j*n];
-                    eigenvector[i + j*n]= tmp;
-                }
-            }
-            return pass;
-        }
-
-        for(i=0; i<n; i++){
-            for(j=i+1; j<n; j++){
-                double covar= pca->covariance[j + i*n];
-                double t,c,s,tau,theta, h;
-
-                if(pass < 3 && fabs(covar) < sum / (5*n*n)) //FIXME why pass < 3
-                    continue;
-                if(fabs(covar) == 0.0) //FIXME should not be needed
-                    continue;
-                if(pass >=3 && fabs((eigenvalue[j]+z[j])/covar) > (1LL<<32) && fabs((eigenvalue[i]+z[i])/covar) > (1LL<<32)){
-                    pca->covariance[j + i*n]=0.0;
-                    continue;
-                }
-
-                h= (eigenvalue[j]+z[j]) - (eigenvalue[i]+z[i]);
-                theta=0.5*h/covar;
-                t=1.0/(fabs(theta)+sqrt(1.0+theta*theta));
-                if(theta < 0.0) t = -t;
-
-                c=1.0/sqrt(1+t*t);
-                s=t*c;
-                tau=s/(1.0+c);
-                z[i] -= t*covar;
-                z[j] += t*covar;
-
-#define ROTATE(a,i,j,k,l) {\
-    double g=a[j + i*n];\
-    double h=a[l + k*n];\
-    a[j + i*n]=g-s*(h+g*tau);\
-    a[l + k*n]=h+s*(g-h*tau); }
-                for(k=0; k<n; k++) {
-                    if(k!=i && k!=j){
-                        ROTATE(pca->covariance,FFMIN(k,i),FFMAX(k,i),FFMIN(k,j),FFMAX(k,j))
-                    }
-                    ROTATE(eigenvector,k,i,k,j)
-                }
-                pca->covariance[j + i*n]=0.0;
-            }
-        }
-        for (i=0; i<n; i++) {
-            eigenvalue[i] += z[i];
-            z[i]=0.0;
-        }
-    }
-
-    return -1;
-}
-
-#ifdef TEST
-
-#undef printf
-#include <stdio.h>
-#include <stdlib.h>
-#include "lfg.h"
-
-int main(void){
-    PCA *pca;
-    int i, j, k;
-#define LEN 8
-    double eigenvector[LEN*LEN];
-    double eigenvalue[LEN];
-    AVLFG prng;
-
-    av_lfg_init(&prng, 1);
-
-    pca= ff_pca_init(LEN);
-
-    for(i=0; i<9000000; i++){
-        double v[2*LEN+100];
-        double sum=0;
-        int pos = av_lfg_get(&prng) % LEN;
-        int v2  = av_lfg_get(&prng) % 101 - 50;
-        v[0]    = av_lfg_get(&prng) % 101 - 50;
-        for(j=1; j<8; j++){
-            if(j<=pos) v[j]= v[0];
-            else       v[j]= v2;
-            sum += v[j];
-        }
-/*        for(j=0; j<LEN; j++){
-            v[j] -= v[pos];
-        }*/
-//        sum += av_lfg_get(&prng) % 10;
-/*        for(j=0; j<LEN; j++){
-            v[j] -= sum/LEN;
-        }*/
-//        lbt1(v+100,v+100,LEN);
-        ff_pca_add(pca, v);
-    }
-
-
-    ff_pca(pca, eigenvector, eigenvalue);
-    for(i=0; i<LEN; i++){
-        pca->count= 1;
-        pca->mean[i]= 0;
-
-//        (0.5^|x|)^2 = 0.5^2|x| = 0.25^|x|
-
-
-//        pca.covariance[i + i*LEN]= pow(0.5, fabs
-        for(j=i; j<LEN; j++){
-            printf("%f ", pca->covariance[i + j*LEN]);
-        }
-        printf("\n");
-    }
-
-#if 1
-    for(i=0; i<LEN; i++){
-        double v[LEN];
-        double error=0;
-        memset(v, 0, sizeof(v));
-        for(j=0; j<LEN; j++){
-            for(k=0; k<LEN; k++){
-                v[j] += pca->covariance[FFMIN(k,j) + FFMAX(k,j)*LEN] * eigenvector[i + k*LEN];
-            }
-            v[j] /= eigenvalue[i];
-            error += fabs(v[j] - eigenvector[i + j*LEN]);
-        }
-        printf("%f ", error);
-    }
-    printf("\n");
-#endif
-    for(i=0; i<LEN; i++){
-        for(j=0; j<LEN; j++){
-            printf("%9.6f ", eigenvector[i + j*LEN]);
-        }
-        printf("  %9.1f %f\n", eigenvalue[i], eigenvalue[i]/eigenvalue[0]);
-    }
-
-    return 0;
-}
-#endif
diff --git a/libavutil/pca.h b/libavutil/pca.h
deleted file mode 100644
index 00ddd60..0000000
--- a/libavutil/pca.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * principal component analysis (PCA)
- * Copyright (c) 2004 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * principal component analysis (PCA)
- */
-
-#ifndef AVUTIL_PCA_H
-#define AVUTIL_PCA_H
-
-struct PCA *ff_pca_init(int n);
-void ff_pca_free(struct PCA *pca);
-void ff_pca_add(struct PCA *pca, double *v);
-int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue);
-
-#endif /* AVUTIL_PCA_H */
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
deleted file mode 100644
index 82b3631..0000000
--- a/libavutil/pixdesc.c
+++ /dev/null
@@ -1,840 +0,0 @@
-/*
- * pixel format descriptor
- * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "pixfmt.h"
-#include "pixdesc.h"
-
-#include "intreadwrite.h"
-
-void read_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
-               const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component)
-{
-    AVComponentDescriptor comp= desc->comp[c];
-    int plane= comp.plane;
-    int depth= comp.depth_minus1+1;
-    int mask = (1<<depth)-1;
-    int shift= comp.shift;
-    int step = comp.step_minus1+1;
-    int flags= desc->flags;
-
-    if (flags & PIX_FMT_BITSTREAM){
-        int skip = x*step + comp.offset_plus1-1;
-        const uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3);
-        int shift = 8 - depth - (skip&7);
-
-        while(w--){
-            int val = (*p >> shift) & mask;
-            if(read_pal_component)
-                val= data[1][4*val + c];
-            shift -= step;
-            p -= shift>>3;
-            shift &= 7;
-            *dst++= val;
-        }
-    } else {
-        const uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1;
-
-        while(w--){
-            int val;
-            if(flags & PIX_FMT_BE) val= AV_RB16(p);
-            else                   val= AV_RL16(p);
-            val = (val>>shift) & mask;
-            if(read_pal_component)
-                val= data[1][4*val + c];
-            p+= step;
-            *dst++= val;
-        }
-    }
-}
-
-void write_line(const uint16_t *src, uint8_t *data[4], const int linesize[4],
-                const AVPixFmtDescriptor *desc, int x, int y, int c, int w)
-{
-    AVComponentDescriptor comp = desc->comp[c];
-    int plane = comp.plane;
-    int depth = comp.depth_minus1+1;
-    int step  = comp.step_minus1+1;
-    int flags = desc->flags;
-
-    if (flags & PIX_FMT_BITSTREAM) {
-        int skip = x*step + comp.offset_plus1-1;
-        uint8_t *p = data[plane] + y*linesize[plane] + (skip>>3);
-        int shift = 8 - depth - (skip&7);
-
-        while (w--) {
-            *p |= *src++ << shift;
-            shift -= step;
-            p -= shift>>3;
-            shift &= 7;
-        }
-    } else {
-        int shift = comp.shift;
-        uint8_t *p = data[plane]+ y*linesize[plane] + x*step + comp.offset_plus1-1;
-
-        while (w--) {
-            if (flags & PIX_FMT_BE) {
-                uint16_t val = AV_RB16(p) | (*src++<<shift);
-                AV_WB16(p, val);
-            } else {
-                uint16_t val = AV_RL16(p) | (*src++<<shift);
-                AV_WL16(p, val);
-            }
-            p+= step;
-        }
-    }
-}
-
-const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
-    [PIX_FMT_YUV420P] = {
-        .name = "yuv420p",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUYV422] = {
-        .name = "yuyv422",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,1,0,7},        /* Y */
-            {0,3,2,0,7},        /* U */
-            {0,3,4,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_RGB24] = {
-        .name = "rgb24",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,2,1,0,7},        /* R */
-            {0,2,2,0,7},        /* G */
-            {0,2,3,0,7},        /* B */
-        },
-    },
-    [PIX_FMT_BGR24] = {
-        .name = "bgr24",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,2,1,0,7},        /* B */
-            {0,2,2,0,7},        /* G */
-            {0,2,3,0,7},        /* R */
-        },
-    },
-    [PIX_FMT_YUV422P] = {
-        .name = "yuv422p",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUV444P] = {
-        .name = "yuv444p",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUV410P] = {
-        .name = "yuv410p",
-        .nb_components= 3,
-        .log2_chroma_w= 2,
-        .log2_chroma_h= 2,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUV411P] = {
-        .name = "yuv411p",
-        .nb_components= 3,
-        .log2_chroma_w= 2,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_GRAY8] = {
-        .name = "gray",
-        .nb_components= 1,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-        },
-        .flags = PIX_FMT_PAL,
-    },
-    [PIX_FMT_MONOWHITE] = {
-        .name = "monow",
-        .nb_components= 1,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,0},        /* Y */
-        },
-        .flags = PIX_FMT_BITSTREAM,
-    },
-    [PIX_FMT_MONOBLACK] = {
-        .name = "monob",
-        .nb_components= 1,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,7,0},        /* Y */
-        },
-        .flags = PIX_FMT_BITSTREAM,
-    },
-    [PIX_FMT_PAL8] = {
-        .name = "pal8",
-        .nb_components= 1,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,7},
-        },
-        .flags = PIX_FMT_PAL,
-    },
-    [PIX_FMT_YUVJ420P] = {
-        .name = "yuvj420p",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUVJ422P] = {
-        .name = "yuvj422p",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUVJ444P] = {
-        .name = "yuvj444p",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_XVMC_MPEG2_MC] = {
-        .name = "xvmcmc",
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_XVMC_MPEG2_IDCT] = {
-        .name = "xvmcidct",
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_UYVY422] = {
-        .name = "uyvy422",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,2,0,7},        /* Y */
-            {0,3,1,0,7},        /* U */
-            {0,3,3,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_UYYVYY411] = {
-        .name = "uyyvyy411",
-        .nb_components= 3,
-        .log2_chroma_w= 2,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,3,2,0,7},        /* Y */
-            {0,5,1,0,7},        /* U */
-            {0,5,4,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_BGR8] = {
-        .name = "bgr8",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,6,1},        /* B */
-            {0,0,1,3,2},        /* G */
-            {0,0,1,0,2},        /* R */
-        },
-        .flags = PIX_FMT_PAL,
-    },
-    [PIX_FMT_BGR4] = {
-        .name = "bgr4",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,3,1,0,0},        /* B */
-            {0,3,2,0,1},        /* G */
-            {0,3,4,0,0},        /* R */
-        },
-        .flags = PIX_FMT_BITSTREAM,
-    },
-    [PIX_FMT_BGR4_BYTE] = {
-        .name = "bgr4_byte",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,3,0},        /* B */
-            {0,0,1,1,1},        /* G */
-            {0,0,1,0,0},        /* R */
-        },
-        .flags = PIX_FMT_PAL,
-    },
-    [PIX_FMT_RGB8] = {
-        .name = "rgb8",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,6,1},        /* R */
-            {0,0,1,3,2},        /* G */
-            {0,0,1,0,2},        /* B */
-        },
-        .flags = PIX_FMT_PAL,
-    },
-    [PIX_FMT_RGB4] = {
-        .name = "rgb4",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,3,1,0,0},       /* R */
-            {0,3,2,0,1},       /* G */
-            {0,3,4,0,0},       /* B */
-        },
-        .flags = PIX_FMT_BITSTREAM,
-    },
-    [PIX_FMT_RGB4_BYTE] = {
-        .name = "rgb4_byte",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,0,1,3,0},        /* R */
-            {0,0,1,1,1},        /* G */
-            {0,0,1,0,0},        /* B */
-        },
-        .flags = PIX_FMT_PAL,
-    },
-    [PIX_FMT_NV12] = {
-        .name = "nv12",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,1,1,0,7},        /* U */
-            {1,1,2,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_NV21] = {
-        .name = "nv21",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,1,1,0,7},        /* V */
-            {1,1,2,0,7},        /* U */
-        },
-    },
-    [PIX_FMT_ARGB] = {
-        .name = "argb",
-        .nb_components= 4,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,3,1,0,7},        /* A */
-            {0,3,2,0,7},        /* R */
-            {0,3,3,0,7},        /* G */
-            {0,3,4,0,7},        /* B */
-        },
-    },
-    [PIX_FMT_RGBA] = {
-        .name = "rgba",
-        .nb_components= 4,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,3,1,0,7},        /* R */
-            {0,3,2,0,7},        /* G */
-            {0,3,3,0,7},        /* B */
-            {0,3,4,0,7},        /* A */
-        },
-    },
-    [PIX_FMT_ABGR] = {
-        .name = "abgr",
-        .nb_components= 4,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,3,1,0,7},        /* A */
-            {0,3,2,0,7},        /* B */
-            {0,3,3,0,7},        /* G */
-            {0,3,4,0,7},        /* R */
-        },
-    },
-    [PIX_FMT_BGRA] = {
-        .name = "bgra",
-        .nb_components= 4,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,3,1,0,7},        /* B */
-            {0,3,2,0,7},        /* G */
-            {0,3,3,0,7},        /* R */
-            {0,3,4,0,7},        /* A */
-        },
-    },
-    [PIX_FMT_GRAY16BE] = {
-        .name = "gray16be",
-        .nb_components= 1,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,1,0,15},       /* Y */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_GRAY16LE] = {
-        .name = "gray16le",
-        .nb_components= 1,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,1,0,15},       /* Y */
-        },
-    },
-    [PIX_FMT_YUV440P] = {
-        .name = "yuv440p",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUVJ440P] = {
-        .name = "yuvj440p",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-        },
-    },
-    [PIX_FMT_YUVA420P] = {
-        .name = "yuva420p",
-        .nb_components= 4,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,0,1,0,7},        /* Y */
-            {1,0,1,0,7},        /* U */
-            {2,0,1,0,7},        /* V */
-            {3,0,1,0,7},        /* A */
-        },
-    },
-    [PIX_FMT_VDPAU_H264] = {
-        .name = "vdpau_h264",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_VDPAU_MPEG1] = {
-        .name = "vdpau_mpeg1",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_VDPAU_MPEG2] = {
-        .name = "vdpau_mpeg2",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_VDPAU_WMV3] = {
-        .name = "vdpau_wmv3",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_VDPAU_VC1] = {
-        .name = "vdpau_vc1",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_VDPAU_MPEG4] = {
-        .name = "vdpau_mpeg4",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_RGB48BE] = {
-        .name = "rgb48be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,5,1,0,15},       /* R */
-            {0,5,3,0,15},       /* G */
-            {0,5,5,0,15},       /* B */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_RGB48LE] = {
-        .name = "rgb48le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,5,1,0,15},       /* R */
-            {0,5,3,0,15},       /* G */
-            {0,5,5,0,15},       /* B */
-        },
-    },
-    [PIX_FMT_RGB565BE] = {
-        .name = "rgb565be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,0,3,4},        /* R */
-            {0,1,1,5,5},        /* G */
-            {0,1,1,0,4},        /* B */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_RGB565LE] = {
-        .name = "rgb565le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,2,3,4},        /* R */
-            {0,1,1,5,5},        /* G */
-            {0,1,1,0,4},        /* B */
-        },
-    },
-    [PIX_FMT_RGB555BE] = {
-        .name = "rgb555be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,0,2,4},        /* R */
-            {0,1,1,5,4},        /* G */
-            {0,1,1,0,4},        /* B */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_RGB555LE] = {
-        .name = "rgb555le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,2,2,4},        /* R */
-            {0,1,1,5,4},        /* G */
-            {0,1,1,0,4},        /* B */
-        },
-    },
-    [PIX_FMT_RGB444BE] = {
-        .name = "rgb444be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,0,0,3},        /* R */
-            {0,1,1,4,3},        /* G */
-            {0,1,1,0,3},        /* B */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_RGB444LE] = {
-        .name = "rgb444le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,2,0,3},        /* R */
-            {0,1,1,4,3},        /* G */
-            {0,1,1,0,3},        /* B */
-        },
-    },
-    [PIX_FMT_BGR565BE] = {
-        .name = "bgr565be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,0,3,4},        /* B */
-            {0,1,1,5,5},        /* G */
-            {0,1,1,0,4},        /* R */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_BGR565LE] = {
-        .name = "bgr565le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,2,3,4},        /* B */
-            {0,1,1,5,5},        /* G */
-            {0,1,1,0,4},        /* R */
-        },
-    },
-    [PIX_FMT_BGR555BE] = {
-        .name = "bgr555be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,0,2,4},       /* B */
-            {0,1,1,5,4},       /* G */
-            {0,1,1,0,4},       /* R */
-        },
-        .flags = PIX_FMT_BE,
-     },
-    [PIX_FMT_BGR555LE] = {
-        .name = "bgr555le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,2,2,4},        /* B */
-            {0,1,1,5,4},        /* G */
-            {0,1,1,0,4},        /* R */
-        },
-    },
-    [PIX_FMT_BGR444BE] = {
-        .name = "bgr444be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,0,0,3},       /* B */
-            {0,1,1,4,3},       /* G */
-            {0,1,1,0,3},       /* R */
-        },
-        .flags = PIX_FMT_BE,
-     },
-    [PIX_FMT_BGR444LE] = {
-        .name = "bgr444le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,2,0,3},        /* B */
-            {0,1,1,4,3},        /* G */
-            {0,1,1,0,3},        /* R */
-        },
-    },
-    [PIX_FMT_VAAPI_MOCO] = {
-        .name = "vaapi_moco",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_VAAPI_IDCT] = {
-        .name = "vaapi_idct",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_VAAPI_VLD] = {
-        .name = "vaapi_vld",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_YUV420P16LE] = {
-        .name = "yuv420p16le",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,1,1,0,15},        /* Y */
-            {1,1,1,0,15},        /* U */
-            {2,1,1,0,15},        /* V */
-        },
-    },
-    [PIX_FMT_YUV420P16BE] = {
-        .name = "yuv420p16be",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 1,
-        .comp = {
-            {0,1,1,0,15},        /* Y */
-            {1,1,1,0,15},        /* U */
-            {2,1,1,0,15},        /* V */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_YUV422P16LE] = {
-        .name = "yuv422p16le",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,1,0,15},        /* Y */
-            {1,1,1,0,15},        /* U */
-            {2,1,1,0,15},        /* V */
-        },
-    },
-    [PIX_FMT_YUV422P16BE] = {
-        .name = "yuv422p16be",
-        .nb_components= 3,
-        .log2_chroma_w= 1,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,1,0,15},        /* Y */
-            {1,1,1,0,15},        /* U */
-            {2,1,1,0,15},        /* V */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_YUV444P16LE] = {
-        .name = "yuv444p16le",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,1,0,15},        /* Y */
-            {1,1,1,0,15},        /* U */
-            {2,1,1,0,15},        /* V */
-        },
-    },
-    [PIX_FMT_YUV444P16BE] = {
-        .name = "yuv444p16be",
-        .nb_components= 3,
-        .log2_chroma_w= 0,
-        .log2_chroma_h= 0,
-        .comp = {
-            {0,1,1,0,15},        /* Y */
-            {1,1,1,0,15},        /* U */
-            {2,1,1,0,15},        /* V */
-        },
-        .flags = PIX_FMT_BE,
-    },
-    [PIX_FMT_DXVA2_VLD] = {
-        .name = "dxva2_vld",
-        .log2_chroma_w = 1,
-        .log2_chroma_h = 1,
-        .flags = PIX_FMT_HWACCEL,
-    },
-    [PIX_FMT_Y400A] = {
-        .name = "y400a",
-        .nb_components= 2,
-        .comp = {
-            {0,1,1,0,7},        /* Y */
-            {0,1,2,0,7},        /* A */
-        },
-    },
-};
-
-static enum PixelFormat get_pix_fmt_internal(const char *name)
-{
-    enum PixelFormat pix_fmt;
-
-    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
-        if (av_pix_fmt_descriptors[pix_fmt].name &&
-            !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
-            return pix_fmt;
-
-    return PIX_FMT_NONE;
-}
-
-#if HAVE_BIGENDIAN
-#   define X_NE(be, le) be
-#else
-#   define X_NE(be, le) le
-#endif
-
-enum PixelFormat av_get_pix_fmt(const char *name)
-{
-    enum PixelFormat pix_fmt;
-
-    if (!strcmp(name, "rgb32"))
-        name = X_NE("argb", "bgra");
-    else if (!strcmp(name, "bgr32"))
-        name = X_NE("abgr", "rgba");
-
-    pix_fmt = get_pix_fmt_internal(name);
-    if (pix_fmt == PIX_FMT_NONE) {
-        char name2[32];
-
-        snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
-        pix_fmt = get_pix_fmt_internal(name2);
-    }
-    return pix_fmt;
-}
-
-int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
-{
-    int c, bits = 0;
-    int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
-
-    for (c = 0; c < pixdesc->nb_components; c++) {
-        int s = c==1 || c==2 ? 0 : log2_pixels;
-        bits += (pixdesc->comp[c].depth_minus1+1) << s;
-    }
-
-    return bits >> log2_pixels;
-}
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
deleted file mode 100644
index 8e4c85d..0000000
--- a/libavutil/pixdesc.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * pixel format descriptor
- * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_PIXDESC_H
-#define AVUTIL_PIXDESC_H
-
-#include <inttypes.h>
-
-typedef struct AVComponentDescriptor{
-    uint16_t plane        :2;            ///< which of the 4 planes contains the component
-
-    /**
-     * Number of elements between 2 horizontally consecutive pixels minus 1.
-     * Elements are bits for bitstream formats, bytes otherwise.
-     */
-    uint16_t step_minus1  :3;
-
-    /**
-     * Number of elements before the component of the first pixel plus 1.
-     * Elements are bits for bitstream formats, bytes otherwise.
-     */
-    uint16_t offset_plus1 :3;
-    uint16_t shift        :3;            ///< number of least significant bits that must be shifted away to get the value
-    uint16_t depth_minus1 :4;            ///< number of bits in the component minus 1
-}AVComponentDescriptor;
-
-/**
- * Descriptor that unambiguously describes how the bits of a pixel are
- * stored in the up to 4 data planes of an image. It also stores the
- * subsampling factors and number of components.
- *
- * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV
- *       and all the YUV variants) AVPixFmtDescriptor just stores how values
- *       are stored not what these values represent.
- */
-typedef struct AVPixFmtDescriptor{
-    const char *name;
-    uint8_t nb_components;      ///< The number of components each pixel has, (1-4)
-
-    /**
-     * Amount to shift the luma width right to find the chroma width.
-     * For YV12 this is 1 for example.
-     * chroma_width = -((-luma_width) >> log2_chroma_w)
-     * The note above is needed to ensure rounding up.
-     * This value only refers to the chroma components.
-     */
-    uint8_t log2_chroma_w;      ///< chroma_width = -((-luma_width )>>log2_chroma_w)
-
-    /**
-     * Amount to shift the luma height right to find the chroma height.
-     * For YV12 this is 1 for example.
-     * chroma_height= -((-luma_height) >> log2_chroma_h)
-     * The note above is needed to ensure rounding up.
-     * This value only refers to the chroma components.
-     */
-    uint8_t log2_chroma_h;
-    uint8_t flags;
-
-    /**
-     * Parameters that describe how pixels are packed. If the format
-     * has chroma components, they must be stored in comp[1] and
-     * comp[2].
-     */
-    AVComponentDescriptor comp[4];
-}AVPixFmtDescriptor;
-
-#define PIX_FMT_BE        1 ///< Pixel format is big-endian.
-#define PIX_FMT_PAL       2 ///< Pixel format has a palette in data[1], values are indexes in this palette.
-#define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end.
-#define PIX_FMT_HWACCEL   8 ///< Pixel format is an HW accelerated format.
-
-/**
- * The array of all the pixel format descriptors.
- */
-extern const AVPixFmtDescriptor av_pix_fmt_descriptors[];
-
-/**
- * Reads a line from an image, and writes the values of the
- * pixel format component c to dst.
- *
- * @param data the array containing the pointers to the planes of the image
- * @param linesizes the array containing the linesizes of the image
- * @param desc the pixel format descriptor for the image
- * @param x the horizontal coordinate of the first pixel to read
- * @param y the vertical coordinate of the first pixel to read
- * @param w the width of the line to read, that is the number of
- * values to write to dst
- * @param read_pal_component if not zero and the format is a paletted
- * format writes the values corresponding to the palette
- * component c in data[1] to dst, rather than the palette indexes in
- * data[0]. The behavior is undefined if the format is not paletted.
- */
-void read_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
-               const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component);
-
-/**
- * Writes the values from src to the pixel format component c of an
- * image line.
- *
- * @param src array containing the values to write
- * @param data the array containing the pointers to the planes of the
- * image to write into. It is supposed to be zeroed.
- * @param linesizes the array containing the linesizes of the image
- * @param desc the pixel format descriptor for the image
- * @param x the horizontal coordinate of the first pixel to write
- * @param y the vertical coordinate of the first pixel to write
- * @param w the width of the line to write, that is the number of
- * values to write to the image line
- */
-void write_line(const uint16_t *src, uint8_t *data[4], const int linesize[4],
-                const AVPixFmtDescriptor *desc, int x, int y, int c, int w);
-
-/**
- * Returns the pixel format corresponding to name.
- *
- * If there is no pixel format with name name, then looks for a
- * pixel format with the name corresponding to the native endian
- * format of name.
- * For example in a little-endian system, first looks for "gray16",
- * then for "gray16le".
- *
- * Finally if no pixel format has been found, returns PIX_FMT_NONE.
- */
-enum PixelFormat av_get_pix_fmt(const char *name);
-
-/**
- * Returns the number of bits per pixel used by the pixel format
- * described by pixdesc.
- *
- * The returned number of bits refers to the number of bits actually
- * used for storing the pixel information, that is padding bits are
- * not counted.
- */
-int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
-
-#endif /* AVUTIL_PIXDESC_H */
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
deleted file mode 100644
index d976f34..0000000
--- a/libavutil/pixfmt.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_PIXFMT_H
-#define AVUTIL_PIXFMT_H
-
-/**
- * @file
- * pixel format definitions
- *
- * @warning This file has to be considered an internal but installed
- * header, so it should not be directly included in your projects.
- */
-
-#include "libavutil/avconfig.h"
-
-/**
- * Pixel format. Notes:
- *
- * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA
- * color is put together as:
- *  (A << 24) | (R << 16) | (G << 8) | B
- * This is stored as BGRA on little-endian CPU architectures and ARGB on
- * big-endian CPUs.
- *
- * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized
- * image data is stored in AVFrame.data[0]. The palette is transported in
- * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is
- * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is
- * also endian-specific). Note also that the individual RGB palette
- * components stored in AVFrame.data[1] should be in the range 0..255.
- * This is important as many custom PAL8 video codecs that were designed
- * to run on the IBM VGA graphics adapter use 6-bit palette components.
- *
- * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like
- * for pal8. This palette is filled in automatically by the function
- * allocating the picture.
- *
- * Note, make sure that all newly added big endian formats have pix_fmt&1==1
- *       and that all newly added little endian formats have pix_fmt&1==0
- *       this allows simpler detection of big vs little endian.
- */
-enum PixelFormat {
-    PIX_FMT_NONE= -1,
-    PIX_FMT_YUV420P,   ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
-    PIX_FMT_YUYV422,   ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
-    PIX_FMT_RGB24,     ///< packed RGB 8:8:8, 24bpp, RGBRGB...
-    PIX_FMT_BGR24,     ///< packed RGB 8:8:8, 24bpp, BGRBGR...
-    PIX_FMT_YUV422P,   ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
-    PIX_FMT_YUV444P,   ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
-    PIX_FMT_YUV410P,   ///< planar YUV 4:1:0,  9bpp, (1 Cr & Cb sample per 4x4 Y samples)
-    PIX_FMT_YUV411P,   ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
-    PIX_FMT_GRAY8,     ///<        Y        ,  8bpp
-    PIX_FMT_MONOWHITE, ///<        Y        ,  1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
-    PIX_FMT_MONOBLACK, ///<        Y        ,  1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
-    PIX_FMT_PAL8,      ///< 8 bit with PIX_FMT_RGB32 palette
-    PIX_FMT_YUVJ420P,  ///< planar YUV 4:2:0, 12bpp, full scale (JPEG)
-    PIX_FMT_YUVJ422P,  ///< planar YUV 4:2:2, 16bpp, full scale (JPEG)
-    PIX_FMT_YUVJ444P,  ///< planar YUV 4:4:4, 24bpp, full scale (JPEG)
-    PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
-    PIX_FMT_XVMC_MPEG2_IDCT,
-    PIX_FMT_UYVY422,   ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
-    PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
-    PIX_FMT_BGR8,      ///< packed RGB 3:3:2,  8bpp, (msb)2B 3G 3R(lsb)
-    PIX_FMT_BGR4,      ///< packed RGB 1:2:1 bitstream,  4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
-    PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1,  8bpp, (msb)1B 2G 1R(lsb)
-    PIX_FMT_RGB8,      ///< packed RGB 3:3:2,  8bpp, (msb)2R 3G 3B(lsb)
-    PIX_FMT_RGB4,      ///< packed RGB 1:2:1 bitstream,  4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
-    PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1,  8bpp, (msb)1R 2G 1B(lsb)
-    PIX_FMT_NV12,      ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
-    PIX_FMT_NV21,      ///< as above, but U and V bytes are swapped
-
-    PIX_FMT_ARGB,      ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
-    PIX_FMT_RGBA,      ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
-    PIX_FMT_ABGR,      ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
-    PIX_FMT_BGRA,      ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
-
-    PIX_FMT_GRAY16BE,  ///<        Y        , 16bpp, big-endian
-    PIX_FMT_GRAY16LE,  ///<        Y        , 16bpp, little-endian
-    PIX_FMT_YUV440P,   ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
-    PIX_FMT_YUVJ440P,  ///< planar YUV 4:4:0 full scale (JPEG)
-    PIX_FMT_YUVA420P,  ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
-    PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-    PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-    PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-    PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-    PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-    PIX_FMT_RGB48BE,   ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
-    PIX_FMT_RGB48LE,   ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
-
-    PIX_FMT_RGB565BE,  ///< packed RGB 5:6:5, 16bpp, (msb)   5R 6G 5B(lsb), big-endian
-    PIX_FMT_RGB565LE,  ///< packed RGB 5:6:5, 16bpp, (msb)   5R 6G 5B(lsb), little-endian
-    PIX_FMT_RGB555BE,  ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
-    PIX_FMT_RGB555LE,  ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
-
-    PIX_FMT_BGR565BE,  ///< packed BGR 5:6:5, 16bpp, (msb)   5B 6G 5R(lsb), big-endian
-    PIX_FMT_BGR565LE,  ///< packed BGR 5:6:5, 16bpp, (msb)   5B 6G 5R(lsb), little-endian
-    PIX_FMT_BGR555BE,  ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
-    PIX_FMT_BGR555LE,  ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
-
-    PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
-    PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
-    PIX_FMT_VAAPI_VLD,  ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-
-    PIX_FMT_YUV420P16LE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
-    PIX_FMT_YUV420P16BE,  ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
-    PIX_FMT_YUV422P16LE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
-    PIX_FMT_YUV422P16BE,  ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
-    PIX_FMT_YUV444P16LE,  ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
-    PIX_FMT_YUV444P16BE,  ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
-    PIX_FMT_VDPAU_MPEG4,  ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
-    PIX_FMT_DXVA2_VLD,    ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
-
-    PIX_FMT_RGB444BE,  ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
-    PIX_FMT_RGB444LE,  ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
-    PIX_FMT_BGR444BE,  ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
-    PIX_FMT_BGR444LE,  ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
-    PIX_FMT_Y400A,     ///< 8bit gray, 8bit alpha
-    PIX_FMT_NB,        ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
-};
-
-#if AV_HAVE_BIGENDIAN
-#   define PIX_FMT_NE(be, le) PIX_FMT_##be
-#else
-#   define PIX_FMT_NE(be, le) PIX_FMT_##le
-#endif
-
-#define PIX_FMT_RGB32   PIX_FMT_NE(ARGB, BGRA)
-#define PIX_FMT_RGB32_1 PIX_FMT_NE(RGBA, ABGR)
-#define PIX_FMT_BGR32   PIX_FMT_NE(ABGR, RGBA)
-#define PIX_FMT_BGR32_1 PIX_FMT_NE(BGRA, ARGB)
-
-#define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16BE, GRAY16LE)
-#define PIX_FMT_RGB48  PIX_FMT_NE(RGB48BE,  RGB48LE)
-#define PIX_FMT_RGB565 PIX_FMT_NE(RGB565BE, RGB565LE)
-#define PIX_FMT_RGB555 PIX_FMT_NE(RGB555BE, RGB555LE)
-#define PIX_FMT_RGB444 PIX_FMT_NE(RGB444BE, RGB444LE)
-#define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
-#define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
-#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
-
-#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
-#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
-#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
-
-#endif /* AVUTIL_PIXFMT_H */
diff --git a/libavutil/ppc/intreadwrite.h b/libavutil/ppc/intreadwrite.h
deleted file mode 100644
index 3667703..0000000
--- a/libavutil/ppc/intreadwrite.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2008 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_PPC_INTREADWRITE_H
-#define AVUTIL_PPC_INTREADWRITE_H
-
-#include <stdint.h>
-#include "config.h"
-
-#if HAVE_XFORM_ASM
-
-#define AV_RL16 AV_RL16
-static av_always_inline uint16_t AV_RL16(const void *p)
-{
-    uint16_t v;
-    __asm__ ("lhbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint16_t*)p));
-    return v;
-}
-
-#define AV_WL16 AV_WL16
-static av_always_inline void AV_WL16(void *p, uint16_t v)
-{
-    __asm__ ("sthbrx  %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v));
-}
-
-#define AV_RL32 AV_RL32
-static av_always_inline uint32_t AV_RL32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
-    return v;
-}
-
-#define AV_WL32 AV_WL32
-static av_always_inline void AV_WL32(void *p, uint32_t v)
-{
-    __asm__ ("stwbrx  %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v));
-}
-
-#if HAVE_LDBRX
-
-#define AV_RL64 AV_RL64
-static av_always_inline uint64_t AV_RL64(const void *p)
-{
-    uint64_t v;
-    __asm__ ("ldbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint64_t*)p));
-    return v;
-}
-
-#define AV_WL64 AV_WL64
-static av_always_inline void AV_WL64(void *p, uint64_t v)
-{
-    __asm__ ("stdbrx  %1, %y0" : "=Z"(*(uint64_t*)p) : "r"(v));
-}
-
-#else
-
-#define AV_RL64 AV_RL64
-static av_always_inline uint64_t AV_RL64(const void *p)
-{
-    union { uint64_t v; uint32_t hl[2]; } v;
-    __asm__ ("lwbrx   %0, %y2  \n\t"
-             "lwbrx   %1, %y3  \n\t"
-             : "=&r"(v.hl[1]), "=r"(v.hl[0])
-             : "Z"(*(const uint32_t*)p), "Z"(*((const uint32_t*)p+1)));
-    return v.v;
-}
-
-#define AV_WL64 AV_WL64
-static av_always_inline void AV_WL64(void *p, uint64_t v)
-{
-    union { uint64_t v; uint32_t hl[2]; } vv = { v };
-    __asm__ ("stwbrx  %2, %y0  \n\t"
-             "stwbrx  %3, %y1  \n\t"
-             : "=Z"(*(uint32_t*)p), "=Z"(*((uint32_t*)p+1))
-             : "r"(vv.hl[1]), "r"(vv.hl[0]));
-}
-
-#endif /* HAVE_LDBRX */
-
-#endif /* HAVE_XFORM_ASM */
-
-/*
- * GCC fails miserably on the packed struct version which is used by
- * default, so we override it here.
- */
-
-#define AV_RB64(p) (*(const uint64_t *)(p))
-#define AV_WB64(p, v) (*(uint64_t *)(p) = (v))
-
-#endif /* AVUTIL_PPC_INTREADWRITE_H */
diff --git a/libavutil/ppc/timer.h b/libavutil/ppc/timer.h
deleted file mode 100644
index 155fc01..0000000
--- a/libavutil/ppc/timer.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2005 Luca Barbato <lu_zero at gentoo.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_PPC_TIMER_H
-#define AVUTIL_PPC_TIMER_H
-
-#include <stdint.h>
-
-#define AV_READ_TIME read_time
-
-static inline uint64_t read_time(void)
-{
-    uint32_t tbu, tbl, temp;
-
-     /* from section 2.2.1 of the 32-bit PowerPC PEM */
-     __asm__ volatile(
-         "1:\n"
-         "mftbu  %2\n"
-         "mftb   %0\n"
-         "mftbu  %1\n"
-         "cmpw   %2,%1\n"
-         "bne    1b\n"
-     : "=r"(tbl), "=r"(tbu), "=r"(temp)
-     :
-     : "cc");
-
-     return (((uint64_t)tbu)<<32) | (uint64_t)tbl;
-}
-
-#endif /* AVUTIL_PPC_TIMER_H */
diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
deleted file mode 100644
index 236cadd..0000000
--- a/libavutil/random_seed.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <unistd.h>
-#include <fcntl.h>
-#include "timer.h"
-#include "random_seed.h"
-
-uint32_t ff_random_get_seed(void)
-{
-    uint32_t seed;
-    int fd;
-
-    if ((fd = open("/dev/random", O_RDONLY)) == -1)
-        fd = open("/dev/urandom", O_RDONLY);
-    if (fd != -1){
-        int err = read(fd, &seed, 4);
-        close(fd);
-        if (err == 4)
-            return seed;
-    }
-#ifdef AV_READ_TIME
-    seed = AV_READ_TIME();
-#endif
-    // XXX what to do ?
-    return seed;
-}
diff --git a/libavutil/random_seed.h b/libavutil/random_seed.h
deleted file mode 100644
index a954381..0000000
--- a/libavutil/random_seed.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier at gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_RANDOM_SEED_H
-#define AVUTIL_RANDOM_SEED_H
-
-#include <stdint.h>
-
-/**
- * Gets a seed to use in conjunction with random functions.
- */
-uint32_t ff_random_get_seed(void);
-
-#endif /* AVUTIL_RANDOM_SEED_H */
diff --git a/libavutil/rational.c b/libavutil/rational.c
deleted file mode 100644
index 3e8b885..0000000
--- a/libavutil/rational.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * rational numbers
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * rational numbers
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#include <assert.h>
-//#include <math.h>
-#include <limits.h>
-
-#include "common.h"
-#include "mathematics.h"
-#include "rational.h"
-
-int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max){
-    AVRational a0={0,1}, a1={1,0};
-    int sign= (num<0) ^ (den<0);
-    int64_t gcd= av_gcd(FFABS(num), FFABS(den));
-
-    if(gcd){
-        num = FFABS(num)/gcd;
-        den = FFABS(den)/gcd;
-    }
-    if(num<=max && den<=max){
-        a1= (AVRational){num, den};
-        den=0;
-    }
-
-    while(den){
-        uint64_t x      = num / den;
-        int64_t next_den= num - den*x;
-        int64_t a2n= x*a1.num + a0.num;
-        int64_t a2d= x*a1.den + a0.den;
-
-        if(a2n > max || a2d > max){
-            if(a1.num) x= (max - a0.num) / a1.num;
-            if(a1.den) x= FFMIN(x, (max - a0.den) / a1.den);
-
-            if (den*(2*x*a1.den + a0.den) > num*a1.den)
-                a1 = (AVRational){x*a1.num + a0.num, x*a1.den + a0.den};
-            break;
-        }
-
-        a0= a1;
-        a1= (AVRational){a2n, a2d};
-        num= den;
-        den= next_den;
-    }
-    assert(av_gcd(a1.num, a1.den) <= 1U);
-
-    *dst_num = sign ? -a1.num : a1.num;
-    *dst_den = a1.den;
-
-    return den==0;
-}
-
-AVRational av_mul_q(AVRational b, AVRational c){
-    av_reduce(&b.num, &b.den, b.num * (int64_t)c.num, b.den * (int64_t)c.den, INT_MAX);
-    return b;
-}
-
-AVRational av_div_q(AVRational b, AVRational c){
-    return av_mul_q(b, (AVRational){c.den, c.num});
-}
-
-AVRational av_add_q(AVRational b, AVRational c){
-    av_reduce(&b.num, &b.den, b.num * (int64_t)c.den + c.num * (int64_t)b.den, b.den * (int64_t)c.den, INT_MAX);
-    return b;
-}
-
-AVRational av_sub_q(AVRational b, AVRational c){
-    return av_add_q(b, (AVRational){-c.num, c.den});
-}
-
-AVRational av_d2q(double d, int max){
-    AVRational a;
-#define LOG2  0.69314718055994530941723212145817656807550013436025
-    int exponent= FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0);
-    int64_t den= 1LL << (61 - exponent);
-    if (isnan(d))
-        return (AVRational){0,0};
-    av_reduce(&a.num, &a.den, (int64_t)(d * den + 0.5), den, max);
-
-    return a;
-}
-
-int av_nearer_q(AVRational q, AVRational q1, AVRational q2)
-{
-    /* n/d is q, a/b is the median between q1 and q2 */
-    int64_t a = q1.num * (int64_t)q2.den + q2.num * (int64_t)q1.den;
-    int64_t b = 2 * (int64_t)q1.den * q2.den;
-
-    /* rnd_up(a*d/b) > n => a*d/b > n */
-    int64_t x_up = av_rescale_rnd(a, q.den, b, AV_ROUND_UP);
-
-    /* rnd_down(a*d/b) < n => a*d/b < n */
-    int64_t x_down = av_rescale_rnd(a, q.den, b, AV_ROUND_DOWN);
-
-    return ((x_up > q.num) - (x_down < q.num)) * av_cmp_q(q2, q1);
-}
-
-int av_find_nearest_q_idx(AVRational q, const AVRational* q_list)
-{
-    int i, nearest_q_idx = 0;
-    for(i=0; q_list[i].den; i++)
-        if (av_nearer_q(q, q_list[i], q_list[nearest_q_idx]) > 0)
-            nearest_q_idx = i;
-
-    return nearest_q_idx;
-}
diff --git a/libavutil/rational.h b/libavutil/rational.h
deleted file mode 100644
index 4d91f7b..0000000
--- a/libavutil/rational.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * rational numbers
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * rational numbers
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVUTIL_RATIONAL_H
-#define AVUTIL_RATIONAL_H
-
-#include <stdint.h>
-#include "attributes.h"
-
-/**
- * rational number numerator/denominator
- */
-typedef struct AVRational{
-    int num; ///< numerator
-    int den; ///< denominator
-} AVRational;
-
-/**
- * Compares two rationals.
- * @param a first rational
- * @param b second rational
- * @return 0 if a==b, 1 if a>b and -1 if a<b
- */
-static inline int av_cmp_q(AVRational a, AVRational b){
-    const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
-
-    if(tmp) return (tmp>>63)|1;
-    else    return 0;
-}
-
-/**
- * Converts rational to double.
- * @param a rational to convert
- * @return (double) a
- */
-static inline double av_q2d(AVRational a){
-    return a.num / (double) a.den;
-}
-
-/**
- * Reduces a fraction.
- * This is useful for framerate calculations.
- * @param dst_num destination numerator
- * @param dst_den destination denominator
- * @param num source numerator
- * @param den source denominator
- * @param max the maximum allowed for dst_num & dst_den
- * @return 1 if exact, 0 otherwise
- */
-int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max);
-
-/**
- * Multiplies two rationals.
- * @param b first rational
- * @param c second rational
- * @return b*c
- */
-AVRational av_mul_q(AVRational b, AVRational c) av_const;
-
-/**
- * Divides one rational by another.
- * @param b first rational
- * @param c second rational
- * @return b/c
- */
-AVRational av_div_q(AVRational b, AVRational c) av_const;
-
-/**
- * Adds two rationals.
- * @param b first rational
- * @param c second rational
- * @return b+c
- */
-AVRational av_add_q(AVRational b, AVRational c) av_const;
-
-/**
- * Subtracts one rational from another.
- * @param b first rational
- * @param c second rational
- * @return b-c
- */
-AVRational av_sub_q(AVRational b, AVRational c) av_const;
-
-/**
- * Converts a double precision floating point number to a rational.
- * @param d double to convert
- * @param max the maximum allowed numerator and denominator
- * @return (AVRational) d
- */
-AVRational av_d2q(double d, int max) av_const;
-
-/**
- * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
- * than q1, 0 if they have the same distance.
- */
-int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
-
-/**
- * Finds the nearest value in q_list to q.
- * @param q_list an array of rationals terminated by {0, 0}
- * @return the index of the nearest value found in the array
- */
-int av_find_nearest_q_idx(AVRational q, const AVRational* q_list);
-
-#endif /* AVUTIL_RATIONAL_H */
diff --git a/libavutil/rc4.c b/libavutil/rc4.c
deleted file mode 100644
index 4e52ba5..0000000
--- a/libavutil/rc4.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * RC4 encryption/decryption/pseudo-random number generator
- * Copyright (c) 2007 Reimar Doeffinger
- *
- * loosely based on LibTomCrypt by Tom St Denis
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avutil.h"
-#include "common.h"
-#include "rc4.h"
-
-typedef struct AVRC4 AVRC4;
-
-int av_rc4_init(AVRC4 *r, const uint8_t *key, int key_bits, int decrypt) {
-    int i, j;
-    uint8_t y;
-    uint8_t *state = r->state;
-    int keylen = key_bits >> 3;
-    if (key_bits & 7)
-        return -1;
-    for (i = 0; i < 256; i++)
-        state[i] = i;
-    y = 0;
-    // j is i % keylen
-    for (j = 0, i = 0; i < 256; i++, j++) {
-        if (j == keylen) j = 0;
-        y += state[i] + key[j];
-        FFSWAP(uint8_t, state[i], state[y]);
-    }
-    r->x = 1;
-    r->y = state[1];
-    return 0;
-}
-
-void av_rc4_crypt(AVRC4 *r, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) {
-    uint8_t x = r->x, y = r->y;
-    uint8_t *state = r->state;
-    while (count-- > 0) {
-        uint8_t sum = state[x] + state[y];
-        FFSWAP(uint8_t, state[x], state[y]);
-        *dst++ = src ? *src++ ^ state[sum] : state[sum];
-        x++;
-        y += state[x];
-    }
-    r->x = x; r->y = y;
-}
diff --git a/libavutil/rc4.h b/libavutil/rc4.h
deleted file mode 100644
index 07223a5..0000000
--- a/libavutil/rc4.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * RC4 encryption/decryption/pseudo-random number generator
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_RC4_H
-#define AVUTIL_RC4_H
-
-#include <stdint.h>
-
-struct AVRC4 {
-    uint8_t state[256];
-    int x, y;
-};
-
-/**
- * \brief Initializes an AVRC4 context.
- *
- * \param key_bits must be a multiple of 8
- * \param decrypt 0 for encryption, 1 for decryption, currently has no effect
- */
-int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt);
-
-/**
- * \brief Encrypts / decrypts using the RC4 algorithm.
- *
- * \param count number of bytes
- * \param dst destination array, can be equal to src
- * \param src source array, can be equal to dst, may be NULL
- * \param iv not (yet) used for RC4, should be NULL
- * \param decrypt 0 for encryption, 1 for decryption, not (yet) used
- */
-void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt);
-
-#endif /* AVUTIL_RC4_H */
diff --git a/libavutil/sh4/bswap.h b/libavutil/sh4/bswap.h
deleted file mode 100644
index 6d237c5..0000000
--- a/libavutil/sh4/bswap.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * byte swapping routines
- */
-
-#ifndef AVUTIL_SH4_BSWAP_H
-#define AVUTIL_SH4_BSWAP_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/attributes.h"
-
-#define bswap_16 bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
-{
-    __asm__("swap.b %0,%0" : "+r"(x));
-    return x;
-}
-
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
-{
-    __asm__("swap.b %0,%0\n"
-            "swap.w %0,%0\n"
-            "swap.b %0,%0\n"
-            : "+r"(x));
-    return x;
-}
-
-#endif /* AVUTIL_SH4_BSWAP_H */
diff --git a/libavutil/sha.c b/libavutil/sha.c
deleted file mode 100644
index 5a3b575..0000000
--- a/libavutil/sha.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Niedermayer <michaelni at gmx.at>
- * Copyright (C) 2009 Konstantin Shishkov
- * based on public domain SHA-1 code by Steve Reid <steve at edmweb.com>
- * and on BSD-licensed SHA-2 code by Aaron D. Gifford
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-#include "avutil.h"
-#include "bswap.h"
-#include "sha.h"
-#include "sha1.h"
-#include "intreadwrite.h"
-
-/** hash context */
-typedef struct AVSHA {
-    uint8_t  digest_len;  ///< digest length in 32-bit words
-    uint64_t count;       ///< number of bytes in buffer
-    uint8_t  buffer[64];  ///< 512-bit buffer of input values used in hash updating
-    uint32_t state[8];    ///< current hash value
-    /** function used to update hash for 512-bit input block */
-    void     (*transform)(uint32_t *state, const uint8_t buffer[64]);
-} AVSHA;
-
-const int av_sha_size = sizeof(AVSHA);
-
-#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
-
-/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
-#define blk0(i) (block[i] = be2me_32(((const uint32_t*)buffer)[i]))
-#define blk(i)  (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1))
-
-#define R0(v,w,x,y,z,i) z += ((w&(x^y))^y)     + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
-#define R1(v,w,x,y,z,i) z += ((w&(x^y))^y)     + blk (i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
-#define R2(v,w,x,y,z,i) z += ( w^x     ^y)     + blk (i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
-#define R3(v,w,x,y,z,i) z += (((w|x)&y)|(w&x)) + blk (i) + 0x8F1BBCDC + rol(v, 5); w = rol(w, 30);
-#define R4(v,w,x,y,z,i) z += ( w^x     ^y)     + blk (i) + 0xCA62C1D6 + rol(v, 5); w = rol(w, 30);
-
-/* Hash a single 512-bit block. This is the core of the algorithm. */
-
-static void sha1_transform(uint32_t state[5], const uint8_t buffer[64])
-{
-    uint32_t block[80];
-    unsigned int i, a, b, c, d, e;
-
-    a = state[0];
-    b = state[1];
-    c = state[2];
-    d = state[3];
-    e = state[4];
-#if CONFIG_SMALL
-    for (i = 0; i < 80; i++) {
-        int t;
-        if (i < 16)
-            t = be2me_32(((uint32_t*)buffer)[i]);
-        else
-            t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1);
-        block[i] = t;
-        t += e + rol(a, 5);
-        if (i < 40) {
-            if (i < 20)
-                t += ((b&(c^d))^d)     + 0x5A827999;
-            else
-                t += ( b^c     ^d)     + 0x6ED9EBA1;
-        } else {
-            if (i < 60)
-                t += (((b|c)&d)|(b&c)) + 0x8F1BBCDC;
-            else
-                t += ( b^c     ^d)     + 0xCA62C1D6;
-        }
-        e = d;
-        d = c;
-        c = rol(b, 30);
-        b = a;
-        a = t;
-    }
-#else
-    for (i = 0; i < 15; i += 5) {
-        R0(a, b, c, d, e, 0 + i);
-        R0(e, a, b, c, d, 1 + i);
-        R0(d, e, a, b, c, 2 + i);
-        R0(c, d, e, a, b, 3 + i);
-        R0(b, c, d, e, a, 4 + i);
-    }
-    R0(a, b, c, d, e, 15);
-    R1(e, a, b, c, d, 16);
-    R1(d, e, a, b, c, 17);
-    R1(c, d, e, a, b, 18);
-    R1(b, c, d, e, a, 19);
-    for (i = 20; i < 40; i += 5) {
-        R2(a, b, c, d, e, 0 + i);
-        R2(e, a, b, c, d, 1 + i);
-        R2(d, e, a, b, c, 2 + i);
-        R2(c, d, e, a, b, 3 + i);
-        R2(b, c, d, e, a, 4 + i);
-    }
-    for (; i < 60; i += 5) {
-        R3(a, b, c, d, e, 0 + i);
-        R3(e, a, b, c, d, 1 + i);
-        R3(d, e, a, b, c, 2 + i);
-        R3(c, d, e, a, b, 3 + i);
-        R3(b, c, d, e, a, 4 + i);
-    }
-    for (; i < 80; i += 5) {
-        R4(a, b, c, d, e, 0 + i);
-        R4(e, a, b, c, d, 1 + i);
-        R4(d, e, a, b, c, 2 + i);
-        R4(c, d, e, a, b, 3 + i);
-        R4(b, c, d, e, a, 4 + i);
-    }
-#endif
-    state[0] += a;
-    state[1] += b;
-    state[2] += c;
-    state[3] += d;
-    state[4] += e;
-}
-
-static const uint32_t K256[64] = {
-    0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
-    0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
-    0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
-    0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
-    0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
-    0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
-    0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
-    0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
-    0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
-    0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
-    0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
-    0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
-    0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
-    0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
-    0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
-    0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
-};
-
-
-#define Ch(x,y,z)   (((x) & ((y) ^ (z))) ^ (z))
-#define Maj(x,y,z)  ((((x) | (y)) & (z)) | ((x) & (y)))
-
-#define Sigma0_256(x)   (rol((x), 30) ^ rol((x), 19) ^ rol((x), 10))
-#define Sigma1_256(x)   (rol((x), 26) ^ rol((x), 21) ^ rol((x),  7))
-#define sigma0_256(x)   (rol((x), 25) ^ rol((x), 14) ^ ((x) >> 3))
-#define sigma1_256(x)   (rol((x), 15) ^ rol((x), 13) ^ ((x) >> 10))
-
-#undef blk
-#define blk(i)  (block[i] = block[i - 16] + sigma0_256(block[i - 15]) + \
-                            sigma1_256(block[i - 2]) + block[i - 7])
-
-#define ROUND256(a,b,c,d,e,f,g,h)   \
-    T1 += (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[i]; \
-    (d) += T1; \
-    (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
-    i++
-
-#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h)   \
-    T1 = blk0(i); \
-    ROUND256(a,b,c,d,e,f,g,h)
-
-#define ROUND256_16_TO_63(a,b,c,d,e,f,g,h)   \
-    T1 = blk(i); \
-    ROUND256(a,b,c,d,e,f,g,h)
-
-static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
-{
-    unsigned int i, a, b, c, d, e, f, g, h;
-    uint32_t block[64];
-    uint32_t T1, av_unused(T2);
-
-    a = state[0];
-    b = state[1];
-    c = state[2];
-    d = state[3];
-    e = state[4];
-    f = state[5];
-    g = state[6];
-    h = state[7];
-#if CONFIG_SMALL
-    for (i = 0; i < 64; i++) {
-        if (i < 16)
-            T1 = blk0(i);
-        else
-            T1 = blk(i);
-        T1 += h + Sigma1_256(e) + Ch(e, f, g) + K256[i];
-        T2 = Sigma0_256(a) + Maj(a, b, c);
-        h = g;
-        g = f;
-        f = e;
-        e = d + T1;
-        d = c;
-        c = b;
-        b = a;
-        a = T1 + T2;
-    }
-#else
-    for (i = 0; i < 16;) {
-        ROUND256_0_TO_15(a, b, c, d, e, f, g, h);
-        ROUND256_0_TO_15(h, a, b, c, d, e, f, g);
-        ROUND256_0_TO_15(g, h, a, b, c, d, e, f);
-        ROUND256_0_TO_15(f, g, h, a, b, c, d, e);
-        ROUND256_0_TO_15(e, f, g, h, a, b, c, d);
-        ROUND256_0_TO_15(d, e, f, g, h, a, b, c);
-        ROUND256_0_TO_15(c, d, e, f, g, h, a, b);
-        ROUND256_0_TO_15(b, c, d, e, f, g, h, a);
-    }
-
-    for (; i < 64;) {
-        ROUND256_16_TO_63(a, b, c, d, e, f, g, h);
-        ROUND256_16_TO_63(h, a, b, c, d, e, f, g);
-        ROUND256_16_TO_63(g, h, a, b, c, d, e, f);
-        ROUND256_16_TO_63(f, g, h, a, b, c, d, e);
-        ROUND256_16_TO_63(e, f, g, h, a, b, c, d);
-        ROUND256_16_TO_63(d, e, f, g, h, a, b, c);
-        ROUND256_16_TO_63(c, d, e, f, g, h, a, b);
-        ROUND256_16_TO_63(b, c, d, e, f, g, h, a);
-    }
-#endif
-    state[0] += a;
-    state[1] += b;
-    state[2] += c;
-    state[3] += d;
-    state[4] += e;
-    state[5] += f;
-    state[6] += g;
-    state[7] += h;
-}
-
-
-int av_sha_init(AVSHA* ctx, int bits)
-{
-    ctx->digest_len = bits >> 5;
-    switch (bits) {
-    case 160: // SHA-1
-        ctx->state[0] = 0x67452301;
-        ctx->state[1] = 0xEFCDAB89;
-        ctx->state[2] = 0x98BADCFE;
-        ctx->state[3] = 0x10325476;
-        ctx->state[4] = 0xC3D2E1F0;
-        ctx->transform = sha1_transform;
-        break;
-    case 224: // SHA-224
-        ctx->state[0] = 0xC1059ED8;
-        ctx->state[1] = 0x367CD507;
-        ctx->state[2] = 0x3070DD17;
-        ctx->state[3] = 0xF70E5939;
-        ctx->state[4] = 0xFFC00B31;
-        ctx->state[5] = 0x68581511;
-        ctx->state[6] = 0x64F98FA7;
-        ctx->state[7] = 0xBEFA4FA4;
-        ctx->transform = sha256_transform;
-        break;
-    case 256: // SHA-256
-        ctx->state[0] = 0x6A09E667;
-        ctx->state[1] = 0xBB67AE85;
-        ctx->state[2] = 0x3C6EF372;
-        ctx->state[3] = 0xA54FF53A;
-        ctx->state[4] = 0x510E527F;
-        ctx->state[5] = 0x9B05688C;
-        ctx->state[6] = 0x1F83D9AB;
-        ctx->state[7] = 0x5BE0CD19;
-        ctx->transform = sha256_transform;
-        break;
-    default:
-        return -1;
-    }
-    ctx->count = 0;
-    return 0;
-}
-
-void av_sha_update(AVSHA* ctx, const uint8_t* data, unsigned int len)
-{
-    unsigned int i, j;
-
-    j = ctx->count & 63;
-    ctx->count += len;
-#if CONFIG_SMALL
-    for (i = 0; i < len; i++) {
-        ctx->buffer[j++] = data[i];
-        if (64 == j) {
-            ctx->transform(ctx->state, ctx->buffer);
-            j = 0;
-        }
-    }
-#else
-    if ((j + len) > 63) {
-        memcpy(&ctx->buffer[j], data, (i = 64 - j));
-        ctx->transform(ctx->state, ctx->buffer);
-        for (; i + 63 < len; i += 64)
-            ctx->transform(ctx->state, &data[i]);
-        j = 0;
-    } else
-        i = 0;
-    memcpy(&ctx->buffer[j], &data[i], len - i);
-#endif
-}
-
-void av_sha_final(AVSHA* ctx, uint8_t *digest)
-{
-    int i;
-    uint64_t finalcount = be2me_64(ctx->count << 3);
-
-    av_sha_update(ctx, "\200", 1);
-    while ((ctx->count & 63) != 56)
-        av_sha_update(ctx, "", 1);
-    av_sha_update(ctx, (uint8_t *)&finalcount, 8); /* Should cause a transform() */
-    for (i = 0; i < ctx->digest_len; i++)
-        AV_WB32(digest + i*4, ctx->state[i]);
-}
-
-#if LIBAVUTIL_VERSION_MAJOR < 51
-struct AVSHA1 {
-    AVSHA sha;
-};
-
-const int av_sha1_size = sizeof(struct AVSHA1);
-
-void av_sha1_init(struct AVSHA1* context)
-{
-    av_sha_init(&context->sha, 160);
-}
-
-void av_sha1_update(struct AVSHA1* context, const uint8_t* data, unsigned int len)
-{
-    av_sha_update(&context->sha, data, len);
-}
-
-void av_sha1_final(struct AVSHA1* context, uint8_t digest[20])
-{
-    av_sha_final(&context->sha, digest);
-}
-#endif
-
-#ifdef TEST
-#include <stdio.h>
-#undef printf
-
-int main(void)
-{
-    int i, j, k;
-    AVSHA ctx;
-    unsigned char digest[32];
-    const int lengths[3] = { 160, 224, 256 };
-
-    for (j = 0; j < 3; j++) {
-        printf("Testing SHA-%d\n", lengths[j]);
-        for (k = 0; k < 3; k++) {
-            av_sha_init(&ctx, lengths[j]);
-            if (k == 0)
-                av_sha_update(&ctx, "abc", 3);
-            else if (k == 1)
-                av_sha_update(&ctx, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56);
-            else
-                for (i = 0; i < 1000*1000; i++)
-                    av_sha_update(&ctx, "a", 1);
-            av_sha_final(&ctx, digest);
-            for (i = 0; i < lengths[j] >> 3; i++)
-                printf("%02X", digest[i]);
-            putchar('\n');
-        }
-        switch (j) {
-        case 0:
-            //test vectors (from FIPS PUB 180-1)
-            printf("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D\n"
-                   "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1\n"
-                   "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F\n");
-            break;
-        case 1:
-            //test vectors (from FIPS PUB 180-2 Appendix A)
-            printf("23097d22 3405d822 8642a477 bda255b3 2aadbce4 bda0b3f7 e36c9da7\n"
-                   "75388b16 512776cc 5dba5da1 fd890150 b0c6455c b4f58b19 52522525\n"
-                   "20794655 980c91d8 bbb4c1ea 97618a4b f03f4258 1948b2ee 4ee7ad67\n");
-            break;
-        case 2:
-            //test vectors (from FIPS PUB 180-2)
-            printf("ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad\n"
-                   "248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1\n"
-                   "cdc76e5c 9914fb92 81a1c7e2 84d73e67 f1809a48 a497200e 046d39cc c7112cd0\n");
-            break;
-        }
-    }
-
-    return 0;
-}
-#endif
diff --git a/libavutil/sha.h b/libavutil/sha.h
deleted file mode 100644
index 5a20230..0000000
--- a/libavutil/sha.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_SHA_H
-#define AVUTIL_SHA_H
-
-#include <stdint.h>
-
-extern const int av_sha_size;
-
-struct AVSHA;
-
-/**
- * Initializes SHA-1 or SHA-2 hashing.
- *
- * @param context pointer to the function context (of size av_sha_size)
- * @param bits    number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits)
- * @return        zero if initialization succeeded, -1 otherwise
- */
-int av_sha_init(struct AVSHA* context, int bits);
-
-/**
- * Updates hash value.
- *
- * @param context hash function context
- * @param data    input data to update hash with
- * @param len     input data length
- */
-void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len);
-
-/**
- * Finishes hashing and output digest value.
- *
- * @param context hash function context
- * @param digest  buffer where output digest value is stored
- */
-void av_sha_final(struct AVSHA* context, uint8_t *digest);
-
-#endif /* AVUTIL_SHA_H */
diff --git a/libavutil/sha1.h b/libavutil/sha1.h
deleted file mode 100644
index cf7c4a6..0000000
--- a/libavutil/sha1.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2007 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_SHA1_H
-#define AVUTIL_SHA1_H
-
-#include <stdint.h>
-
-extern const int av_sha1_size;
-
-struct AVSHA1;
-
-/**
- * Initializes SHA-1 hashing.
- *
- * @param context pointer to the function context (of size av_sha_size)
- * @deprecated use av_sha_init() instead
- */
-void av_sha1_init(struct AVSHA1* context);
-
-/**
- * Updates hash value.
- *
- * @param context hash function context
- * @param data    input data to update hash with
- * @param len     input data length
- * @deprecated use av_sha_update() instead
- */
-void av_sha1_update(struct AVSHA1* context, const uint8_t* data, unsigned int len);
-
-/**
- * Finishes hashing and output digest value.
- *
- * @param context hash function context
- * @param digest  buffer where output digest value is stored
- * @deprecated use av_sha_final() instead
- */
-void av_sha1_final(struct AVSHA1* context, uint8_t digest[20]);
-
-#endif /* AVUTIL_SHA1_H */
diff --git a/libavutil/softfloat.c b/libavutil/softfloat.c
deleted file mode 100644
index efa0420..0000000
--- a/libavutil/softfloat.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <assert.h>
-#include "softfloat.h"
-#include "common.h"
-#include "log.h"
-
-#undef printf
-
-int main(void){
-    SoftFloat one= av_int2sf(1, 0);
-    SoftFloat sf1, sf2;
-    double d1, d2;
-    int i, j;
-    av_log_set_level(AV_LOG_DEBUG);
-
-    d1= 1;
-    for(i= 0; i<10; i++){
-        d1= 1/(d1+1);
-    }
-    printf("test1 double=%d\n", (int)(d1 * (1<<24)));
-
-    sf1= one;
-    for(i= 0; i<10; i++){
-        sf1= av_div_sf(one, av_normalize_sf(av_add_sf(one, sf1)));
-    }
-    printf("test1 sf    =%d\n", av_sf2int(sf1, 24));
-
-
-    for(i= 0; i<100; i++){
-        START_TIMER
-        d1= i;
-        d2= i/100.0;
-        for(j= 0; j<1000; j++){
-            d1= (d1+1)*d2;
-        }
-        STOP_TIMER("float add mul")
-    }
-    printf("test2 double=%d\n", (int)(d1 * (1<<24)));
-
-    for(i= 0; i<100; i++){
-        START_TIMER
-        sf1= av_int2sf(i, 0);
-        sf2= av_div_sf(av_int2sf(i, 2), av_int2sf(200, 3));
-        for(j= 0; j<1000; j++){
-            sf1= av_mul_sf(av_add_sf(sf1, one),sf2);
-        }
-        STOP_TIMER("softfloat add mul")
-    }
-    printf("test2 sf    =%d (%d %d)\n", av_sf2int(sf1, 24), sf1.exp, sf1.mant);
-    return 0;
-}
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
deleted file mode 100644
index 97e09ea..0000000
--- a/libavutil/softfloat.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_SOFTFLOAT_H
-#define AVUTIL_SOFTFLOAT_H
-
-#include <stdint.h>
-#include "common.h"
-
-#define MIN_EXP -126
-#define MAX_EXP  126
-#define ONE_BITS 29
-
-typedef struct SoftFloat{
-    int32_t  exp;
-    int32_t mant;
-}SoftFloat;
-
-static av_const SoftFloat av_normalize_sf(SoftFloat a){
-    if(a.mant){
-#if 1
-        while((a.mant + 0x20000000U)<0x40000000U){
-            a.mant += a.mant;
-            a.exp  -= 1;
-        }
-#else
-        int s=ONE_BITS + 1 - av_log2(a.mant ^ (a.mant<<1));
-        a.exp   -= s;
-        a.mant <<= s;
-#endif
-        if(a.exp < MIN_EXP){
-            a.exp = MIN_EXP;
-            a.mant= 0;
-        }
-    }else{
-        a.exp= MIN_EXP;
-    }
-    return a;
-}
-
-static inline av_const SoftFloat av_normalize1_sf(SoftFloat a){
-#if 1
-    if(a.mant + 0x40000000 < 0){
-        a.exp++;
-        a.mant>>=1;
-    }
-    return a;
-#elif 1
-    int t= a.mant + 0x40000000 < 0;
-    return (SoftFloat){a.exp+t, a.mant>>t};
-#else
-    int t= (a.mant + 0x40000000U)>>31;
-    return (SoftFloat){a.exp+t, a.mant>>t};
-#endif
-}
-
-/**
- * @return Will not be more denormalized than a+b. So if either input is
- *         normalized, then the output will not be worse then the other input.
- *         If both are normalized, then the output will be normalized.
- */
-static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){
-    a.exp += b.exp;
-    a.mant = (a.mant * (int64_t)b.mant) >> ONE_BITS;
-    return av_normalize1_sf(a);
-}
-
-/**
- * b has to be normalized and not zero.
- * @return Will not be more denormalized than a.
- */
-static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
-    a.exp -= b.exp+1;
-    a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant;
-    return av_normalize1_sf(a);
-}
-
-static inline av_const int av_cmp_sf(SoftFloat a, SoftFloat b){
-    int t= a.exp - b.exp;
-    if(t<0) return (a.mant >> (-t)) -  b.mant      ;
-    else    return  a.mant          - (b.mant >> t);
-}
-
-static inline av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b){
-    int t= a.exp - b.exp;
-    if(t<0) return av_normalize1_sf((SoftFloat){b.exp, b.mant + (a.mant >> (-t))});
-    else    return av_normalize1_sf((SoftFloat){a.exp, a.mant + (b.mant >>   t )});
-}
-
-static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){
-    return av_add_sf(a, (SoftFloat){b.exp, -b.mant});
-}
-
-//FIXME sqrt, log, exp, pow, sin, cos
-
-static inline av_const SoftFloat av_int2sf(int v, int frac_bits){
-    return av_normalize_sf((SoftFloat){ONE_BITS-frac_bits, v});
-}
-
-/**
- * Rounding is to -inf.
- */
-static inline av_const int av_sf2int(SoftFloat v, int frac_bits){
-    v.exp += frac_bits - ONE_BITS;
-    if(v.exp >= 0) return v.mant <<  v.exp ;
-    else           return v.mant >>(-v.exp);
-}
-
-#endif /* AVUTIL_SOFTFLOAT_H */
diff --git a/libavutil/timer.h b/libavutil/timer.h
deleted file mode 100644
index cd8fba8..0000000
--- a/libavutil/timer.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * @file
- * high precision timer, useful to profile code
- *
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_TIMER_H
-#define AVUTIL_TIMER_H
-
-#include <stdlib.h>
-#include <stdint.h>
-#include "config.h"
-
-#if   ARCH_ARM
-#   include "arm/timer.h"
-#elif ARCH_BFIN
-#   include "bfin/timer.h"
-#elif ARCH_PPC
-#   include "ppc/timer.h"
-#elif ARCH_X86
-#   include "x86/timer.h"
-#endif
-
-#if !defined(AV_READ_TIME) && HAVE_GETHRTIME
-#   define AV_READ_TIME gethrtime
-#endif
-
-#ifdef AV_READ_TIME
-#define START_TIMER \
-uint64_t tend;\
-uint64_t tstart= AV_READ_TIME();\
-
-#define STOP_TIMER(id) \
-tend= AV_READ_TIME();\
-{\
-    static uint64_t tsum=0;\
-    static int tcount=0;\
-    static int tskip_count=0;\
-    if(tcount<2 || tend - tstart < 8*tsum/tcount || tend - tstart < 2000){\
-        tsum+= tend - tstart;\
-        tcount++;\
-    }else\
-        tskip_count++;\
-    if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\
-        av_log(NULL, AV_LOG_ERROR, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n",\
-               tsum*10/tcount, id, tcount, tskip_count);\
-    }\
-}
-#else
-#define START_TIMER
-#define STOP_TIMER(id) {}
-#endif
-
-#endif /* AVUTIL_TIMER_H */
diff --git a/libavutil/tomi/intreadwrite.h b/libavutil/tomi/intreadwrite.h
deleted file mode 100644
index 778b804..0000000
--- a/libavutil/tomi/intreadwrite.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_TOMI_INTREADWRITE_H
-#define AVUTIL_TOMI_INTREADWRITE_H
-
-#include <stdint.h>
-#include "config.h"
-
-#define AV_RB16 AV_RB16
-static av_always_inline uint16_t AV_RB16(const void *p)
-{
-    uint16_t v;
-    __asm__ ("loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "storeacc,  %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "add,       %0    \n\t"
-             : "=r"(v), "+a"(p));
-    return v;
-}
-
-#define AV_WB16 AV_WB16
-static av_always_inline void AV_WB16(void *p, uint16_t v)
-{
-    __asm__ volatile ("loadacc,   %1    \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      "loadacc,   %1    \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      : "+&a"(p) : "r"(v));
-}
-
-#define AV_RL16 AV_RL16
-static av_always_inline uint16_t AV_RL16(const void *p)
-{
-    uint16_t v;
-    __asm__ ("loadacc,   (%1+) \n\t"
-             "storeacc,  %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "add,       %0    \n\t"
-             : "=r"(v), "+a"(p));
-    return v;
-}
-
-#define AV_WL16 AV_WL16
-static av_always_inline void AV_WL16(void *p, uint16_t v)
-{
-    __asm__ volatile ("loadacc,   %1    \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      : "+&a"(p) : "r"(v));
-}
-
-#define AV_RB32 AV_RB32
-static av_always_inline uint32_t AV_RB32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "rol8             \n\t"
-             "rol8             \n\t"
-             "storeacc,  %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "rol8             \n\t"
-             "add,       %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "add,       %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "add,       %0    \n\t"
-             : "=r"(v), "+a"(p));
-    return v;
-}
-
-#define AV_WB32 AV_WB32
-static av_always_inline void AV_WB32(void *p, uint32_t v)
-{
-    __asm__ volatile ("loadacc,   #4    \n\t"
-                      "add,       %0    \n\t"
-                      "loadacc,   %1    \n\t"
-                      "storeacc,  (-%0) \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (-%0) \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (-%0) \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (-%0) \n\t"
-                      : "+&a"(p) : "r"(v));
-}
-
-#define AV_RL32 AV_RL32
-static av_always_inline uint32_t AV_RL32(const void *p)
-{
-    uint32_t v;
-    __asm__ ("loadacc,   (%1+) \n\t"
-             "storeacc,  %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "add,       %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "rol8             \n\t"
-             "add,       %0    \n\t"
-             "loadacc,   (%1+) \n\t"
-             "rol8             \n\t"
-             "rol8             \n\t"
-             "rol8             \n\t"
-             "add,       %0    \n\t"
-             : "=r"(v), "+a"(p));
-    return v;
-}
-
-#define AV_WL32 AV_WL32
-static av_always_inline void AV_WL32(void *p, uint32_t v)
-{
-    __asm__ volatile ("loadacc,   %1    \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      "lsr8             \n\t"
-                      "storeacc,  (%0+) \n\t"
-                      : "+&a"(p) : "r"(v));
-}
-
-#endif /* AVUTIL_TOMI_INTREADWRITE_H */
diff --git a/libavutil/tree.c b/libavutil/tree.c
deleted file mode 100644
index 8769c76..0000000
--- a/libavutil/tree.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "log.h"
-#include "tree.h"
-
-typedef struct AVTreeNode{
-    struct AVTreeNode *child[2];
-    void *elem;
-    int state;
-}AVTreeNode;
-
-const int av_tree_node_size = sizeof(AVTreeNode);
-
-void *av_tree_find(const AVTreeNode *t, void *key, int (*cmp)(void *key, const void *b), void *next[2]){
-    if(t){
-        unsigned int v= cmp(key, t->elem);
-        if(v){
-            if(next) next[v>>31]= t->elem;
-            return av_tree_find(t->child[(v>>31)^1], key, cmp, next);
-        }else{
-            if(next){
-                av_tree_find(t->child[0], key, cmp, next);
-                av_tree_find(t->child[1], key, cmp, next);
-            }
-            return t->elem;
-        }
-    }
-    return NULL;
-}
-
-void *av_tree_insert(AVTreeNode **tp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){
-    AVTreeNode *t= *tp;
-    if(t){
-        unsigned int v= cmp(t->elem, key);
-        void *ret;
-        if(!v){
-            if(*next)
-                return t->elem;
-            else if(t->child[0]||t->child[1]){
-                int i= !t->child[0];
-                void *next_elem[2];
-                av_tree_find(t->child[i], key, cmp, next_elem);
-                key= t->elem= next_elem[i];
-                v= -i;
-            }else{
-                *next= t;
-                *tp=NULL;
-                return NULL;
-            }
-        }
-        ret= av_tree_insert(&t->child[v>>31], key, cmp, next);
-        if(!ret){
-            int i= (v>>31) ^ !!*next;
-            AVTreeNode **child= &t->child[i];
-            t->state += 2*i - 1;
-
-            if(!(t->state&1)){
-                if(t->state){
-                    /* The following code is equivalent to
-                    if((*child)->state*2 == -t->state)
-                        rotate(child, i^1);
-                    rotate(tp, i);
-
-                    with rotate():
-                    static void rotate(AVTreeNode **tp, int i){
-                        AVTreeNode *t= *tp;
-
-                        *tp= t->child[i];
-                        t->child[i]= t->child[i]->child[i^1];
-                        (*tp)->child[i^1]= t;
-                        i= 4*t->state + 2*(*tp)->state + 12;
-                          t  ->state=                     ((0x614586 >> i) & 3)-1;
-                        (*tp)->state= ((*tp)->state>>1) + ((0x400EEA >> i) & 3)-1;
-                    }
-                    but such a rotate function is both bigger and slower
-                    */
-                    if((*child)->state*2 == -t->state){
-                        *tp= (*child)->child[i^1];
-                        (*child)->child[i^1]= (*tp)->child[i];
-                        (*tp)->child[i]= *child;
-                        *child= (*tp)->child[i^1];
-                        (*tp)->child[i^1]= t;
-
-                        (*tp)->child[0]->state= -((*tp)->state>0);
-                        (*tp)->child[1]->state=   (*tp)->state<0 ;
-                        (*tp)->state=0;
-                    }else{
-                        *tp= *child;
-                        *child= (*child)->child[i^1];
-                        (*tp)->child[i^1]= t;
-                        if((*tp)->state) t->state  = 0;
-                        else             t->state>>= 1;
-                        (*tp)->state= -t->state;
-                    }
-                }
-            }
-            if(!(*tp)->state ^ !!*next)
-                return key;
-        }
-        return ret;
-    }else{
-        *tp= *next; *next= NULL;
-        if(*tp){
-            (*tp)->elem= key;
-            return NULL;
-        }else
-            return key;
-    }
-}
-
-void av_tree_destroy(AVTreeNode *t){
-    if(t){
-        av_tree_destroy(t->child[0]);
-        av_tree_destroy(t->child[1]);
-        av_free(t);
-    }
-}
-
-void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, void *elem), int (*enu)(void *opaque, void *elem)){
-    if(t){
-        int v= cmp ? cmp(opaque, t->elem) : 0;
-        if(v>=0) av_tree_enumerate(t->child[0], opaque, cmp, enu);
-        if(v==0) enu(opaque, t->elem);
-        if(v<=0) av_tree_enumerate(t->child[1], opaque, cmp, enu);
-    }
-}
-
-#ifdef TEST
-
-#include "lfg.h"
-
-static int check(AVTreeNode *t){
-    if(t){
-        int left= check(t->child[0]);
-        int right= check(t->child[1]);
-
-        if(left>999 || right>999)
-            return 1000;
-        if(right - left != t->state)
-            return 1000;
-        if(t->state>1 || t->state<-1)
-            return 1000;
-        return FFMAX(left, right)+1;
-    }
-    return 0;
-}
-
-static void print(AVTreeNode *t, int depth){
-    int i;
-    for(i=0; i<depth*4; i++) av_log(NULL, AV_LOG_ERROR, " ");
-    if(t){
-        av_log(NULL, AV_LOG_ERROR, "Node %p %2d %p\n", t, t->state, t->elem);
-        print(t->child[0], depth+1);
-        print(t->child[1], depth+1);
-    }else
-        av_log(NULL, AV_LOG_ERROR, "NULL\n");
-}
-
-static int cmp(void *a, const void *b){
-    return (uint8_t*)a-(const uint8_t*)b;
-}
-
-int main(void){
-    int i;
-    void *k;
-    AVTreeNode *root= NULL, *node=NULL;
-    AVLFG prng;
-
-    av_lfg_init(&prng, 1);
-
-    for(i=0; i<10000; i++){
-        int j = av_lfg_get(&prng) % 86294;
-        if(check(root) > 999){
-            av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i);
-        print(root, 0);
-            return -1;
-        }
-        av_log(NULL, AV_LOG_ERROR, "inserting %4d\n", j);
-        if(!node)
-            node= av_mallocz(av_tree_node_size);
-        av_tree_insert(&root, (void*)(j+1), cmp, &node);
-
-        j = av_lfg_get(&prng) % 86294;
-        {
-            AVTreeNode *node2=NULL;
-            av_log(NULL, AV_LOG_ERROR, "removing %4d\n", j);
-            av_tree_insert(&root, (void*)(j+1), cmp, &node2);
-            k= av_tree_find(root, (void*)(j+1), cmp, NULL);
-            if(k)
-                av_log(NULL, AV_LOG_ERROR, "removal failure %d\n", i);
-        }
-    }
-    return 0;
-}
-#endif
diff --git a/libavutil/tree.h b/libavutil/tree.h
deleted file mode 100644
index dde2f10..0000000
--- a/libavutil/tree.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * A tree container.
- * Insertion, removal, finding equal, largest which is smaller than and
- * smallest which is larger than, all have O(log n) worst case complexity.
- * @author Michael Niedermayer <michaelni at gmx.at>
- */
-
-#ifndef AVUTIL_TREE_H
-#define AVUTIL_TREE_H
-
-struct AVTreeNode;
-extern const int av_tree_node_size;
-
-/**
- * Finds an element.
- * @param root a pointer to the root node of the tree
- * @param next If next is not NULL, then next[0] will contain the previous
- *             element and next[1] the next element. If either does not exist,
- *             then the corresponding entry in next is unchanged.
- * @return An element with cmp(key, elem)==0 or NULL if no such element exists in
- *         the tree.
- */
-void *av_tree_find(const struct AVTreeNode *root, void *key, int (*cmp)(void *key, const void *b), void *next[2]);
-
-/**
- * Inserts or removes an element.
- * If *next is NULL, then the supplied element will be removed if it exists.
- * If *next is not NULL, then the supplied element will be inserted, unless
- * it already exists in the tree.
- * @param rootp A pointer to a pointer to the root node of the tree; note that
- *              the root node can change during insertions, this is required
- *              to keep the tree balanced.
- * @param next Used to allocate and free AVTreeNodes. For insertion the user
- *             must set it to an allocated and zeroed object of at least
- *             av_tree_node_size bytes size. av_tree_insert() will set it to
- *             NULL if it has been consumed.
- *             For deleting elements *next is set to NULL by the user and
- *             av_tree_node_size() will set it to the AVTreeNode which was
- *             used for the removed element.
- *             This allows the use of flat arrays, which have
- *             lower overhead compared to many malloced elements.
- *             You might want to define a function like:
- *             @code
- *             void *tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){
- *                 if(!*next) *next= av_mallocz(av_tree_node_size);
- *                 return av_tree_insert(rootp, key, cmp, next);
- *             }
- *             void *tree_remove(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b, AVTreeNode **next)){
- *                 if(*next) av_freep(next);
- *                 return av_tree_insert(rootp, key, cmp, next);
- *             }
- *             @endcode
- * @return If no insertion happened, the found element; if an insertion or
- *         removal happened, then either key or NULL will be returned.
- *         Which one it is depends on the tree state and the implementation. You
- *         should make no assumptions that it's one or the other in the code.
- */
-void *av_tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b), struct AVTreeNode **next);
-void av_tree_destroy(struct AVTreeNode *t);
-
-/**
- * Applies enu(opaque, &elem) to all the elements in the tree in a given range.
- *
- * @param cmp a comparison function that returns < 0 for a element below the
- *            range, > 0 for a element above the range and == 0 for a
- *            element inside the range
- *
- * @note The cmp function should use the same ordering used to construct the
- *       tree.
- */
-void av_tree_enumerate(struct AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, void *elem), int (*enu)(void *opaque, void *elem));
-
-
-#endif /* AVUTIL_TREE_H */
diff --git a/libavutil/utils.c b/libavutil/utils.c
deleted file mode 100644
index 8a1d32e..0000000
--- a/libavutil/utils.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "avutil.h"
-
-/**
- * @file
- * various utility functions
- */
-
-unsigned avutil_version(void)
-{
-    return LIBAVUTIL_VERSION_INT;
-}
-
-const char *avutil_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char *avutil_license(void)
-{
-#define LICENSE_PREFIX "libavutil license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h
deleted file mode 100644
index 26dc4e2..0000000
--- a/libavutil/x86/bswap.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * byte swapping routines
- */
-
-#ifndef AVUTIL_X86_BSWAP_H
-#define AVUTIL_X86_BSWAP_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/attributes.h"
-
-#define bswap_16 bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
-{
-    __asm__("rorw $8, %0" : "+r"(x));
-    return x;
-}
-
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
-{
-#if HAVE_BSWAP
-    __asm__("bswap   %0" : "+r" (x));
-#else
-    __asm__("rorw    $8,  %w0 \n\t"
-            "rorl    $16, %0  \n\t"
-            "rorw    $8,  %w0"
-            : "+r"(x));
-#endif
-    return x;
-}
-
-#if ARCH_X86_64
-#define bswap_64 bswap_64
-static inline uint64_t av_const bswap_64(uint64_t x)
-{
-    __asm__("bswap  %0": "=r" (x) : "0" (x));
-    return x;
-}
-#endif
-
-#endif /* AVUTIL_X86_BSWAP_H */
diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h
deleted file mode 100644
index f3acddc..0000000
--- a/libavutil/x86/intmath.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 Mans Rullgard <mans at mansr.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_X86_INTMATH_H
-#define AVUTIL_X86_INTMATH_H
-
-#define FASTDIV(a,b) \
-    ({\
-        int ret, dmy;\
-        __asm__ volatile(\
-            "mull %3"\
-            :"=d"(ret), "=a"(dmy)\
-            :"1"(a), "g"(ff_inverse[b])\
-            );\
-        ret;\
-    })
-
-#endif /* AVUTIL_X86_INTMATH_H */
diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h
deleted file mode 100644
index 4061d19..0000000
--- a/libavutil/x86/intreadwrite.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2010 Alexander Strange <astrange at ithinksw.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_X86_INTREADWRITE_H
-#define AVUTIL_X86_INTREADWRITE_H
-
-#include <stdint.h>
-#include "config.h"
-#include "libavutil/attributes.h"
-
-#if HAVE_MMX
-
-#if !HAVE_FAST_64BIT && defined(__MMX__)
-
-#define AV_COPY64 AV_COPY64
-static av_always_inline void AV_COPY64(void *d, const void *s)
-{
-    __asm__("movq   %1, %%mm0  \n\t"
-            "movq   %%mm0, %0  \n\t"
-            : "=m"(*(uint64_t*)d)
-            : "m" (*(const uint64_t*)s)
-            : "mm0");
-}
-
-#define AV_SWAP64 AV_SWAP64
-static av_always_inline void AV_SWAP64(void *a, void *b)
-{
-    __asm__("movq   %1, %%mm0  \n\t"
-            "movq   %0, %%mm1  \n\t"
-            "movq   %%mm0, %0  \n\t"
-            "movq   %%mm1, %1  \n\t"
-            : "+m"(*(uint64_t*)a), "+m"(*(uint64_t*)b)
-            ::"mm0", "mm1");
-}
-
-#define AV_ZERO64 AV_ZERO64
-static av_always_inline void AV_ZERO64(void *d)
-{
-    __asm__("pxor %%mm0, %%mm0  \n\t"
-            "movq %%mm0, %0     \n\t"
-            : "=m"(*(uint64_t*)d)
-            :: "mm0");
-}
-
-#endif /* !HAVE_FAST_64BIT && defined(__MMX__) */
-
-#ifdef __SSE__
-
-#define AV_COPY128 AV_COPY128
-static av_always_inline void AV_COPY128(void *d, const void *s)
-{
-    struct v {uint64_t v[2];};
-
-    __asm__("movaps   %1, %%xmm0  \n\t"
-            "movaps   %%xmm0, %0  \n\t"
-            : "=m"(*(struct v*)d)
-            : "m" (*(const struct v*)s)
-            : "xmm0");
-}
-
-#endif /* __SSE__ */
-
-#ifdef __SSE2__
-
-#define AV_ZERO128 AV_ZERO128
-static av_always_inline void AV_ZERO128(void *d)
-{
-    struct v {uint64_t v[2];};
-
-    __asm__("pxor %%xmm0, %%xmm0  \n\t"
-            "movdqa   %%xmm0, %0  \n\t"
-            : "=m"(*(struct v*)d)
-            :: "xmm0");
-}
-
-#endif /* __SSE2__ */
-
-#endif /* HAVE_MMX */
-
-#endif /* AVUTIL_X86_INTREADWRITE_H */
diff --git a/libavutil/x86/timer.h b/libavutil/x86/timer.h
deleted file mode 100644
index 62a111f..0000000
--- a/libavutil/x86/timer.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_X86_TIMER_H
-#define AVUTIL_X86_TIMER_H
-
-#include <stdint.h>
-
-#define AV_READ_TIME read_time
-
-static inline uint64_t read_time(void)
-{
-    uint32_t a, d;
-    __asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
-    return ((uint64_t)d << 32) + a;
-}
-
-#endif /* AVUTIL_X86_TIMER_H */
diff --git a/libavutil/x86_cpu.h b/libavutil/x86_cpu.h
deleted file mode 100644
index 08d3146..0000000
--- a/libavutil/x86_cpu.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_X86_CPU_H
-#define AVUTIL_X86_CPU_H
-
-#include <stdint.h>
-#include "config.h"
-
-#if ARCH_X86_64
-#    define REG_a "rax"
-#    define REG_b "rbx"
-#    define REG_c "rcx"
-#    define REG_d "rdx"
-#    define REG_D "rdi"
-#    define REG_S "rsi"
-#    define PTR_SIZE "8"
-typedef int64_t x86_reg;
-
-#    define REG_SP "rsp"
-#    define REG_BP "rbp"
-#    define REGBP   rbp
-#    define REGa    rax
-#    define REGb    rbx
-#    define REGc    rcx
-#    define REGd    rdx
-#    define REGSP   rsp
-
-#elif ARCH_X86_32
-
-#    define REG_a "eax"
-#    define REG_b "ebx"
-#    define REG_c "ecx"
-#    define REG_d "edx"
-#    define REG_D "edi"
-#    define REG_S "esi"
-#    define PTR_SIZE "4"
-typedef int32_t x86_reg;
-
-#    define REG_SP "esp"
-#    define REG_BP "ebp"
-#    define REGBP   ebp
-#    define REGa    eax
-#    define REGb    ebx
-#    define REGc    ecx
-#    define REGd    edx
-#    define REGSP   esp
-#else
-typedef int x86_reg;
-#endif
-
-#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))
-#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))
-
-#if ARCH_X86_64 && defined(PIC)
-#    define BROKEN_RELOCATIONS 1
-#endif
-
-#endif /* AVUTIL_X86_CPU_H */
diff --git a/libpostproc/Makefile b/libpostproc/Makefile
deleted file mode 100644
index bd0b71e..0000000
--- a/libpostproc/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = postproc
-FFLIBS = avutil
-
-HEADERS = postprocess.h
-
-OBJS = postprocess.o
-
-include $(SUBDIR)../subdir.mak
diff --git a/libpostproc/libpostproc.v b/libpostproc/libpostproc.v
deleted file mode 100644
index e65d76f..0000000
--- a/libpostproc/libpostproc.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBPOSTPROC_$MAJOR {
-        global: postproc_*; pp_*;
-        local: *;
-};
diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
deleted file mode 100644
index 92c822b..0000000
--- a/libpostproc/postprocess.c
+++ /dev/null
@@ -1,1106 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer (michaelni at gmx.at)
- *
- * AltiVec optimizations (C) 2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * postprocessing.
- */
-
-/*
-                        C       MMX     MMX2    3DNow   AltiVec
-isVertDC                Ec      Ec                      Ec
-isVertMinMaxOk          Ec      Ec                      Ec
-doVertLowPass           E               e       e       Ec
-doVertDefFilter         Ec      Ec      e       e       Ec
-isHorizDC               Ec      Ec                      Ec
-isHorizMinMaxOk         a       E                       Ec
-doHorizLowPass          E               e       e       Ec
-doHorizDefFilter        Ec      Ec      e       e       Ec
-do_a_deblock            Ec      E       Ec      E
-deRing                  E               e       e*      Ecp
-Vertical RKAlgo1        E               a       a
-Horizontal RKAlgo1                      a       a
-Vertical X1#            a               E       E
-Horizontal X1#          a               E       E
-LinIpolDeinterlace      e               E       E*
-CubicIpolDeinterlace    a               e       e*
-LinBlendDeinterlace     e               E       E*
-MedianDeinterlace#      E       Ec      Ec
-TempDeNoiser#           E               e       e       Ec
-
-* I do not have a 3DNow! CPU -> it is untested, but no one said it does not work so it seems to work
-# more or less selfinvented filters so the exactness is not too meaningful
-E = Exact implementation
-e = almost exact implementation (slightly different rounding,...)
-a = alternative / approximate impl
-c = checked against the other implementations (-vo md5)
-p = partially optimized, still some work to do
-*/
-
-/*
-TODO:
-reduce the time wasted on the mem transfer
-unroll stuff if instructions depend too much on the prior one
-move YScale thing to the end instead of fixing QP
-write a faster and higher quality deblocking filter :)
-make the mainloop more flexible (variable number of blocks at once
-        (the if/else stuff per block is slowing things down)
-compare the quality & speed of all filters
-split this huge file
-optimize c versions
-try to unroll inner for(x=0 ... loop to avoid these damn if(x ... checks
-...
-*/
-
-//Changelog: use the Subversion log
-
-#include "config.h"
-#include "libavutil/avutil.h"
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-//#undef HAVE_MMX2
-//#define HAVE_AMD3DNOW
-//#undef HAVE_MMX
-//#undef ARCH_X86
-//#define DEBUG_BRIGHTNESS
-#include "postprocess.h"
-#include "postprocess_internal.h"
-
-unsigned postproc_version(void)
-{
-    return LIBPOSTPROC_VERSION_INT;
-}
-
-const char *postproc_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char *postproc_license(void)
-{
-#define LICENSE_PREFIX "libpostproc license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
-
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-#define GET_MODE_BUFFER_SIZE 500
-#define OPTIONS_ARRAY_SIZE 10
-#define BLOCK_SIZE 8
-#define TEMP_STRIDE 8
-//#define NUM_BLOCKS_AT_ONCE 16 //not used yet
-
-#if ARCH_X86
-DECLARE_ASM_CONST(8, uint64_t, w05)= 0x0005000500050005LL;
-DECLARE_ASM_CONST(8, uint64_t, w04)= 0x0004000400040004LL;
-DECLARE_ASM_CONST(8, uint64_t, w20)= 0x0020002000200020LL;
-DECLARE_ASM_CONST(8, uint64_t, b00)= 0x0000000000000000LL;
-DECLARE_ASM_CONST(8, uint64_t, b01)= 0x0101010101010101LL;
-DECLARE_ASM_CONST(8, uint64_t, b02)= 0x0202020202020202LL;
-DECLARE_ASM_CONST(8, uint64_t, b08)= 0x0808080808080808LL;
-DECLARE_ASM_CONST(8, uint64_t, b80)= 0x8080808080808080LL;
-#endif
-
-DECLARE_ASM_CONST(8, int, deringThreshold)= 20;
-
-
-static struct PPFilter filters[]=
-{
-    {"hb", "hdeblock",              1, 1, 3, H_DEBLOCK},
-    {"vb", "vdeblock",              1, 2, 4, V_DEBLOCK},
-/*  {"hr", "rkhdeblock",            1, 1, 3, H_RK1_FILTER},
-    {"vr", "rkvdeblock",            1, 2, 4, V_RK1_FILTER},*/
-    {"h1", "x1hdeblock",            1, 1, 3, H_X1_FILTER},
-    {"v1", "x1vdeblock",            1, 2, 4, V_X1_FILTER},
-    {"ha", "ahdeblock",             1, 1, 3, H_A_DEBLOCK},
-    {"va", "avdeblock",             1, 2, 4, V_A_DEBLOCK},
-    {"dr", "dering",                1, 5, 6, DERING},
-    {"al", "autolevels",            0, 1, 2, LEVEL_FIX},
-    {"lb", "linblenddeint",         1, 1, 4, LINEAR_BLEND_DEINT_FILTER},
-    {"li", "linipoldeint",          1, 1, 4, LINEAR_IPOL_DEINT_FILTER},
-    {"ci", "cubicipoldeint",        1, 1, 4, CUBIC_IPOL_DEINT_FILTER},
-    {"md", "mediandeint",           1, 1, 4, MEDIAN_DEINT_FILTER},
-    {"fd", "ffmpegdeint",           1, 1, 4, FFMPEG_DEINT_FILTER},
-    {"l5", "lowpass5",              1, 1, 4, LOWPASS5_DEINT_FILTER},
-    {"tn", "tmpnoise",              1, 7, 8, TEMP_NOISE_FILTER},
-    {"fq", "forcequant",            1, 0, 0, FORCE_QUANT},
-    {NULL, NULL,0,0,0,0} //End Marker
-};
-
-static const char *replaceTable[]=
-{
-    "default",      "hb:a,vb:a,dr:a",
-    "de",           "hb:a,vb:a,dr:a",
-    "fast",         "h1:a,v1:a,dr:a",
-    "fa",           "h1:a,v1:a,dr:a",
-    "ac",           "ha:a:128:7,va:a,dr:a",
-    NULL //End Marker
-};
-
-
-#if ARCH_X86
-static inline void prefetchnta(void *p)
-{
-    __asm__ volatile(   "prefetchnta (%0)\n\t"
-        : : "r" (p)
-    );
-}
-
-static inline void prefetcht0(void *p)
-{
-    __asm__ volatile(   "prefetcht0 (%0)\n\t"
-        : : "r" (p)
-    );
-}
-
-static inline void prefetcht1(void *p)
-{
-    __asm__ volatile(   "prefetcht1 (%0)\n\t"
-        : : "r" (p)
-    );
-}
-
-static inline void prefetcht2(void *p)
-{
-    __asm__ volatile(   "prefetcht2 (%0)\n\t"
-        : : "r" (p)
-    );
-}
-#endif
-
-/* The horizontal functions exist only in C because the MMX
- * code is faster with vertical filters and transposing. */
-
-/**
- * Check if the given 8x8 Block is mostly "flat"
- */
-static inline int isHorizDC_C(uint8_t src[], int stride, PPContext *c)
-{
-    int numEq= 0;
-    int y;
-    const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
-    const int dcThreshold= dcOffset*2 + 1;
-
-    for(y=0; y<BLOCK_SIZE; y++){
-        if(((unsigned)(src[0] - src[1] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[1] - src[2] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[2] - src[3] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[3] - src[4] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[4] - src[5] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[5] - src[6] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[6] - src[7] + dcOffset)) < dcThreshold) numEq++;
-        src+= stride;
-    }
-    return numEq > c->ppMode.flatnessThreshold;
-}
-
-/**
- * Check if the middle 8x8 Block in the given 8x16 block is flat
- */
-static inline int isVertDC_C(uint8_t src[], int stride, PPContext *c)
-{
-    int numEq= 0;
-    int y;
-    const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
-    const int dcThreshold= dcOffset*2 + 1;
-
-    src+= stride*4; // src points to begin of the 8x8 Block
-    for(y=0; y<BLOCK_SIZE-1; y++){
-        if(((unsigned)(src[0] - src[0+stride] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[1] - src[1+stride] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[2] - src[2+stride] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[3] - src[3+stride] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[4] - src[4+stride] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[5] - src[5+stride] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[6] - src[6+stride] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[7] - src[7+stride] + dcOffset)) < dcThreshold) numEq++;
-        src+= stride;
-    }
-    return numEq > c->ppMode.flatnessThreshold;
-}
-
-static inline int isHorizMinMaxOk_C(uint8_t src[], int stride, int QP)
-{
-    int i;
-#if 1
-    for(i=0; i<2; i++){
-        if((unsigned)(src[0] - src[5] + 2*QP) > 4*QP) return 0;
-        src += stride;
-        if((unsigned)(src[2] - src[7] + 2*QP) > 4*QP) return 0;
-        src += stride;
-        if((unsigned)(src[4] - src[1] + 2*QP) > 4*QP) return 0;
-        src += stride;
-        if((unsigned)(src[6] - src[3] + 2*QP) > 4*QP) return 0;
-        src += stride;
-    }
-#else
-    for(i=0; i<8; i++){
-        if((unsigned)(src[0] - src[7] + 2*QP) > 4*QP) return 0;
-        src += stride;
-    }
-#endif
-    return 1;
-}
-
-static inline int isVertMinMaxOk_C(uint8_t src[], int stride, int QP)
-{
-#if 1
-#if 1
-    int x;
-    src+= stride*4;
-    for(x=0; x<BLOCK_SIZE; x+=4){
-        if((unsigned)(src[  x + 0*stride] - src[  x + 5*stride] + 2*QP) > 4*QP) return 0;
-        if((unsigned)(src[1+x + 2*stride] - src[1+x + 7*stride] + 2*QP) > 4*QP) return 0;
-        if((unsigned)(src[2+x + 4*stride] - src[2+x + 1*stride] + 2*QP) > 4*QP) return 0;
-        if((unsigned)(src[3+x + 6*stride] - src[3+x + 3*stride] + 2*QP) > 4*QP) return 0;
-    }
-#else
-    int x;
-    src+= stride*3;
-    for(x=0; x<BLOCK_SIZE; x++){
-        if((unsigned)(src[x + stride] - src[x + (stride<<3)] + 2*QP) > 4*QP) return 0;
-    }
-#endif
-    return 1;
-#else
-    int x;
-    src+= stride*4;
-    for(x=0; x<BLOCK_SIZE; x++){
-        int min=255;
-        int max=0;
-        int y;
-        for(y=0; y<8; y++){
-            int v= src[x + y*stride];
-            if(v>max) max=v;
-            if(v<min) min=v;
-        }
-        if(max-min > 2*QP) return 0;
-    }
-    return 1;
-#endif
-}
-
-static inline int horizClassify_C(uint8_t src[], int stride, PPContext *c)
-{
-    if( isHorizDC_C(src, stride, c) ){
-        if( isHorizMinMaxOk_C(src, stride, c->QP) )
-            return 1;
-        else
-            return 0;
-    }else{
-        return 2;
-    }
-}
-
-static inline int vertClassify_C(uint8_t src[], int stride, PPContext *c)
-{
-    if( isVertDC_C(src, stride, c) ){
-        if( isVertMinMaxOk_C(src, stride, c->QP) )
-            return 1;
-        else
-            return 0;
-    }else{
-        return 2;
-    }
-}
-
-static inline void doHorizDefFilter_C(uint8_t dst[], int stride, PPContext *c)
-{
-    int y;
-    for(y=0; y<BLOCK_SIZE; y++){
-        const int middleEnergy= 5*(dst[4] - dst[3]) + 2*(dst[2] - dst[5]);
-
-        if(FFABS(middleEnergy) < 8*c->QP){
-            const int q=(dst[3] - dst[4])/2;
-            const int leftEnergy=  5*(dst[2] - dst[1]) + 2*(dst[0] - dst[3]);
-            const int rightEnergy= 5*(dst[6] - dst[5]) + 2*(dst[4] - dst[7]);
-
-            int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
-            d= FFMAX(d, 0);
-
-            d= (5*d + 32) >> 6;
-            d*= FFSIGN(-middleEnergy);
-
-            if(q>0)
-            {
-                d= d<0 ? 0 : d;
-                d= d>q ? q : d;
-            }
-            else
-            {
-                d= d>0 ? 0 : d;
-                d= d<q ? q : d;
-            }
-
-            dst[3]-= d;
-            dst[4]+= d;
-        }
-        dst+= stride;
-    }
-}
-
-/**
- * Do a horizontal low pass filter on the 10x8 block (dst points to middle 8x8 Block)
- * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16 (C version)
- */
-static inline void doHorizLowPass_C(uint8_t dst[], int stride, PPContext *c)
-{
-    int y;
-    for(y=0; y<BLOCK_SIZE; y++){
-        const int first= FFABS(dst[-1] - dst[0]) < c->QP ? dst[-1] : dst[0];
-        const int last= FFABS(dst[8] - dst[7]) < c->QP ? dst[8] : dst[7];
-
-        int sums[10];
-        sums[0] = 4*first + dst[0] + dst[1] + dst[2] + 4;
-        sums[1] = sums[0] - first  + dst[3];
-        sums[2] = sums[1] - first  + dst[4];
-        sums[3] = sums[2] - first  + dst[5];
-        sums[4] = sums[3] - first  + dst[6];
-        sums[5] = sums[4] - dst[0] + dst[7];
-        sums[6] = sums[5] - dst[1] + last;
-        sums[7] = sums[6] - dst[2] + last;
-        sums[8] = sums[7] - dst[3] + last;
-        sums[9] = sums[8] - dst[4] + last;
-
-        dst[0]= (sums[0] + sums[2] + 2*dst[0])>>4;
-        dst[1]= (sums[1] + sums[3] + 2*dst[1])>>4;
-        dst[2]= (sums[2] + sums[4] + 2*dst[2])>>4;
-        dst[3]= (sums[3] + sums[5] + 2*dst[3])>>4;
-        dst[4]= (sums[4] + sums[6] + 2*dst[4])>>4;
-        dst[5]= (sums[5] + sums[7] + 2*dst[5])>>4;
-        dst[6]= (sums[6] + sums[8] + 2*dst[6])>>4;
-        dst[7]= (sums[7] + sums[9] + 2*dst[7])>>4;
-
-        dst+= stride;
-    }
-}
-
-/**
- * Experimental Filter 1 (Horizontal)
- * will not damage linear gradients
- * Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
- * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
- * MMX2 version does correct clipping C version does not
- * not identical with the vertical one
- */
-static inline void horizX1Filter(uint8_t *src, int stride, int QP)
-{
-    int y;
-    static uint64_t *lut= NULL;
-    if(lut==NULL)
-    {
-        int i;
-        lut = av_malloc(256*8);
-        for(i=0; i<256; i++)
-        {
-            int v= i < 128 ? 2*i : 2*(i-256);
-/*
-//Simulate 112242211 9-Tap filter
-            uint64_t a= (v/16)  & 0xFF;
-            uint64_t b= (v/8)   & 0xFF;
-            uint64_t c= (v/4)   & 0xFF;
-            uint64_t d= (3*v/8) & 0xFF;
-*/
-//Simulate piecewise linear interpolation
-            uint64_t a= (v/16)   & 0xFF;
-            uint64_t b= (v*3/16) & 0xFF;
-            uint64_t c= (v*5/16) & 0xFF;
-            uint64_t d= (7*v/16) & 0xFF;
-            uint64_t A= (0x100 - a)&0xFF;
-            uint64_t B= (0x100 - b)&0xFF;
-            uint64_t C= (0x100 - c)&0xFF;
-            uint64_t D= (0x100 - c)&0xFF;
-
-            lut[i]   = (a<<56) | (b<<48) | (c<<40) | (d<<32) |
-                       (D<<24) | (C<<16) | (B<<8)  | (A);
-            //lut[i] = (v<<32) | (v<<24);
-        }
-    }
-
-    for(y=0; y<BLOCK_SIZE; y++){
-        int a= src[1] - src[2];
-        int b= src[3] - src[4];
-        int c= src[5] - src[6];
-
-        int d= FFMAX(FFABS(b) - (FFABS(a) + FFABS(c))/2, 0);
-
-        if(d < QP){
-            int v = d * FFSIGN(-b);
-
-            src[1] +=v/8;
-            src[2] +=v/4;
-            src[3] +=3*v/8;
-            src[4] -=3*v/8;
-            src[5] -=v/4;
-            src[6] -=v/8;
-        }
-        src+=stride;
-    }
-}
-
-/**
- * accurate deblock filter
- */
-static av_always_inline void do_a_deblock_C(uint8_t *src, int step, int stride, PPContext *c){
-    int y;
-    const int QP= c->QP;
-    const int dcOffset= ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1;
-    const int dcThreshold= dcOffset*2 + 1;
-//START_TIMER
-    src+= step*4; // src points to begin of the 8x8 Block
-    for(y=0; y<8; y++){
-        int numEq= 0;
-
-        if(((unsigned)(src[-1*step] - src[0*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 0*step] - src[1*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 1*step] - src[2*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 2*step] - src[3*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 3*step] - src[4*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 4*step] - src[5*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 5*step] - src[6*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 6*step] - src[7*step] + dcOffset)) < dcThreshold) numEq++;
-        if(((unsigned)(src[ 7*step] - src[8*step] + dcOffset)) < dcThreshold) numEq++;
-        if(numEq > c->ppMode.flatnessThreshold){
-            int min, max, x;
-
-            if(src[0] > src[step]){
-                max= src[0];
-                min= src[step];
-            }else{
-                max= src[step];
-                min= src[0];
-            }
-            for(x=2; x<8; x+=2){
-                if(src[x*step] > src[(x+1)*step]){
-                        if(src[x    *step] > max) max= src[ x   *step];
-                        if(src[(x+1)*step] < min) min= src[(x+1)*step];
-                }else{
-                        if(src[(x+1)*step] > max) max= src[(x+1)*step];
-                        if(src[ x   *step] < min) min= src[ x   *step];
-                }
-            }
-            if(max-min < 2*QP){
-                const int first= FFABS(src[-1*step] - src[0]) < QP ? src[-1*step] : src[0];
-                const int last= FFABS(src[8*step] - src[7*step]) < QP ? src[8*step] : src[7*step];
-
-                int sums[10];
-                sums[0] = 4*first + src[0*step] + src[1*step] + src[2*step] + 4;
-                sums[1] = sums[0] - first       + src[3*step];
-                sums[2] = sums[1] - first       + src[4*step];
-                sums[3] = sums[2] - first       + src[5*step];
-                sums[4] = sums[3] - first       + src[6*step];
-                sums[5] = sums[4] - src[0*step] + src[7*step];
-                sums[6] = sums[5] - src[1*step] + last;
-                sums[7] = sums[6] - src[2*step] + last;
-                sums[8] = sums[7] - src[3*step] + last;
-                sums[9] = sums[8] - src[4*step] + last;
-
-                src[0*step]= (sums[0] + sums[2] + 2*src[0*step])>>4;
-                src[1*step]= (sums[1] + sums[3] + 2*src[1*step])>>4;
-                src[2*step]= (sums[2] + sums[4] + 2*src[2*step])>>4;
-                src[3*step]= (sums[3] + sums[5] + 2*src[3*step])>>4;
-                src[4*step]= (sums[4] + sums[6] + 2*src[4*step])>>4;
-                src[5*step]= (sums[5] + sums[7] + 2*src[5*step])>>4;
-                src[6*step]= (sums[6] + sums[8] + 2*src[6*step])>>4;
-                src[7*step]= (sums[7] + sums[9] + 2*src[7*step])>>4;
-            }
-        }else{
-            const int middleEnergy= 5*(src[4*step] - src[3*step]) + 2*(src[2*step] - src[5*step]);
-
-            if(FFABS(middleEnergy) < 8*QP){
-                const int q=(src[3*step] - src[4*step])/2;
-                const int leftEnergy=  5*(src[2*step] - src[1*step]) + 2*(src[0*step] - src[3*step]);
-                const int rightEnergy= 5*(src[6*step] - src[5*step]) + 2*(src[4*step] - src[7*step]);
-
-                int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
-                d= FFMAX(d, 0);
-
-                d= (5*d + 32) >> 6;
-                d*= FFSIGN(-middleEnergy);
-
-                if(q>0){
-                    d= d<0 ? 0 : d;
-                    d= d>q ? q : d;
-                }else{
-                    d= d>0 ? 0 : d;
-                    d= d<q ? q : d;
-                }
-
-                src[3*step]-= d;
-                src[4*step]+= d;
-            }
-        }
-
-        src += stride;
-    }
-/*if(step==16){
-    STOP_TIMER("step16")
-}else{
-    STOP_TIMER("stepX")
-}*/
-}
-
-//Note: we have C, MMX, MMX2, 3DNOW version there is no 3DNOW+MMX2 one
-//Plain C versions
-#if !(HAVE_MMX || HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_C
-#endif
-
-#if HAVE_ALTIVEC
-#define COMPILE_ALTIVEC
-#endif //HAVE_ALTIVEC
-
-#if ARCH_X86
-
-#if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_MMX
-#endif
-
-#if HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_MMX2
-#endif
-
-#if (HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_3DNOW
-#endif
-#endif /* ARCH_X86 */
-
-#undef HAVE_MMX
-#define HAVE_MMX 0
-#undef HAVE_MMX2
-#define HAVE_MMX2 0
-#undef HAVE_AMD3DNOW
-#define HAVE_AMD3DNOW 0
-#undef HAVE_ALTIVEC
-#define HAVE_ALTIVEC 0
-
-#ifdef COMPILE_C
-#define RENAME(a) a ## _C
-#include "postprocess_template.c"
-#endif
-
-#ifdef COMPILE_ALTIVEC
-#undef RENAME
-#undef HAVE_ALTIVEC
-#define HAVE_ALTIVEC 1
-#define RENAME(a) a ## _altivec
-#include "postprocess_altivec_template.c"
-#include "postprocess_template.c"
-#endif
-
-//MMX versions
-#ifdef COMPILE_MMX
-#undef RENAME
-#undef HAVE_MMX
-#define HAVE_MMX 1
-#define RENAME(a) a ## _MMX
-#include "postprocess_template.c"
-#endif
-
-//MMX2 versions
-#ifdef COMPILE_MMX2
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_MMX 1
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "postprocess_template.c"
-#endif
-
-//3DNOW versions
-#ifdef COMPILE_3DNOW
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#define HAVE_MMX 1
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 1
-#define RENAME(a) a ## _3DNow
-#include "postprocess_template.c"
-#endif
-
-// minor note: the HAVE_xyz is messed up after that line so do not use it.
-
-static inline void postProcess(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
-        const QP_STORE_T QPs[], int QPStride, int isColor, pp_mode *vm, pp_context *vc)
-{
-    PPContext *c= (PPContext *)vc;
-    PPMode *ppMode= (PPMode *)vm;
-    c->ppMode= *ppMode; //FIXME
-
-    // Using ifs here as they are faster than function pointers although the
-    // difference would not be measurable here but it is much better because
-    // someone might exchange the CPU whithout restarting MPlayer ;)
-#if CONFIG_RUNTIME_CPUDETECT
-#if ARCH_X86
-    // ordered per speed fastest first
-    if(c->cpuCaps & PP_CPU_CAPS_MMX2)
-        postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-    else if(c->cpuCaps & PP_CPU_CAPS_3DNOW)
-        postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-    else if(c->cpuCaps & PP_CPU_CAPS_MMX)
-        postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-    else
-        postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#else
-#if HAVE_ALTIVEC
-    if(c->cpuCaps & PP_CPU_CAPS_ALTIVEC)
-            postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-    else
-#endif
-            postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#endif
-#else //CONFIG_RUNTIME_CPUDETECT
-#if   HAVE_MMX2
-            postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#elif HAVE_AMD3DNOW
-            postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#elif HAVE_MMX
-            postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#elif HAVE_ALTIVEC
-            postProcess_altivec(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#else
-            postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
-#endif
-#endif //!CONFIG_RUNTIME_CPUDETECT
-}
-
-//static void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
-//        QP_STORE_T QPs[], int QPStride, int isColor, struct PPMode *ppMode);
-
-/* -pp Command line Help
-*/
-#if LIBPOSTPROC_VERSION_INT < (52<<16)
-const char *const pp_help=
-#else
-const char pp_help[] =
-#endif
-"Available postprocessing filters:\n"
-"Filters                        Options\n"
-"short  long name       short   long option     Description\n"
-"*      *               a       autoq           CPU power dependent enabler\n"
-"                       c       chrom           chrominance filtering enabled\n"
-"                       y       nochrom         chrominance filtering disabled\n"
-"                       n       noluma          luma filtering disabled\n"
-"hb     hdeblock        (2 threshold)           horizontal deblocking filter\n"
-"       1. difference factor: default=32, higher -> more deblocking\n"
-"       2. flatness threshold: default=39, lower -> more deblocking\n"
-"                       the h & v deblocking filters share these\n"
-"                       so you can't set different thresholds for h / v\n"
-"vb     vdeblock        (2 threshold)           vertical deblocking filter\n"
-"ha     hadeblock       (2 threshold)           horizontal deblocking filter\n"
-"va     vadeblock       (2 threshold)           vertical deblocking filter\n"
-"h1     x1hdeblock                              experimental h deblock filter 1\n"
-"v1     x1vdeblock                              experimental v deblock filter 1\n"
-"dr     dering                                  deringing filter\n"
-"al     autolevels                              automatic brightness / contrast\n"
-"                       f        fullyrange     stretch luminance to (0..255)\n"
-"lb     linblenddeint                           linear blend deinterlacer\n"
-"li     linipoldeint                            linear interpolating deinterlace\n"
-"ci     cubicipoldeint                          cubic interpolating deinterlacer\n"
-"md     mediandeint                             median deinterlacer\n"
-"fd     ffmpegdeint                             ffmpeg deinterlacer\n"
-"l5     lowpass5                                FIR lowpass deinterlacer\n"
-"de     default                                 hb:a,vb:a,dr:a\n"
-"fa     fast                                    h1:a,v1:a,dr:a\n"
-"ac                                             ha:a:128:7,va:a,dr:a\n"
-"tn     tmpnoise        (3 threshold)           temporal noise reducer\n"
-"                     1. <= 2. <= 3.            larger -> stronger filtering\n"
-"fq     forceQuant      <quantizer>             force quantizer\n"
-"Usage:\n"
-"<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n"
-"long form example:\n"
-"vdeblock:autoq/hdeblock:autoq/linblenddeint    default,-vdeblock\n"
-"short form example:\n"
-"vb:a/hb:a/lb                                   de,-vb\n"
-"more examples:\n"
-"tn:64:128:256\n"
-"\n"
-;
-
-pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
-{
-    char temp[GET_MODE_BUFFER_SIZE];
-    char *p= temp;
-    static const char filterDelimiters[] = ",/";
-    static const char optionDelimiters[] = ":";
-    struct PPMode *ppMode;
-    char *filterToken;
-
-    ppMode= av_malloc(sizeof(PPMode));
-
-    ppMode->lumMode= 0;
-    ppMode->chromMode= 0;
-    ppMode->maxTmpNoise[0]= 700;
-    ppMode->maxTmpNoise[1]= 1500;
-    ppMode->maxTmpNoise[2]= 3000;
-    ppMode->maxAllowedY= 234;
-    ppMode->minAllowedY= 16;
-    ppMode->baseDcDiff= 256/8;
-    ppMode->flatnessThreshold= 56-16-1;
-    ppMode->maxClippedThreshold= 0.01;
-    ppMode->error=0;
-
-    strncpy(temp, name, GET_MODE_BUFFER_SIZE);
-
-    av_log(NULL, AV_LOG_DEBUG, "pp: %s\n", name);
-
-    for(;;){
-        char *filterName;
-        int q= 1000000; //PP_QUALITY_MAX;
-        int chrom=-1;
-        int luma=-1;
-        char *option;
-        char *options[OPTIONS_ARRAY_SIZE];
-        int i;
-        int filterNameOk=0;
-        int numOfUnknownOptions=0;
-        int enable=1; //does the user want us to enabled or disabled the filter
-
-        filterToken= strtok(p, filterDelimiters);
-        if(filterToken == NULL) break;
-        p+= strlen(filterToken) + 1; // p points to next filterToken
-        filterName= strtok(filterToken, optionDelimiters);
-        av_log(NULL, AV_LOG_DEBUG, "pp: %s::%s\n", filterToken, filterName);
-
-        if(*filterName == '-'){
-            enable=0;
-            filterName++;
-        }
-
-        for(;;){ //for all options
-            option= strtok(NULL, optionDelimiters);
-            if(option == NULL) break;
-
-            av_log(NULL, AV_LOG_DEBUG, "pp: option: %s\n", option);
-            if(!strcmp("autoq", option) || !strcmp("a", option)) q= quality;
-            else if(!strcmp("nochrom", option) || !strcmp("y", option)) chrom=0;
-            else if(!strcmp("chrom", option) || !strcmp("c", option)) chrom=1;
-            else if(!strcmp("noluma", option) || !strcmp("n", option)) luma=0;
-            else{
-                options[numOfUnknownOptions] = option;
-                numOfUnknownOptions++;
-            }
-            if(numOfUnknownOptions >= OPTIONS_ARRAY_SIZE-1) break;
-        }
-        options[numOfUnknownOptions] = NULL;
-
-        /* replace stuff from the replace Table */
-        for(i=0; replaceTable[2*i]!=NULL; i++){
-            if(!strcmp(replaceTable[2*i], filterName)){
-                int newlen= strlen(replaceTable[2*i + 1]);
-                int plen;
-                int spaceLeft;
-
-                if(p==NULL) p= temp, *p=0;      //last filter
-                else p--, *p=',';               //not last filter
-
-                plen= strlen(p);
-                spaceLeft= p - temp + plen;
-                if(spaceLeft + newlen  >= GET_MODE_BUFFER_SIZE){
-                    ppMode->error++;
-                    break;
-                }
-                memmove(p + newlen, p, plen+1);
-                memcpy(p, replaceTable[2*i + 1], newlen);
-                filterNameOk=1;
-            }
-        }
-
-        for(i=0; filters[i].shortName!=NULL; i++){
-            if(   !strcmp(filters[i].longName, filterName)
-               || !strcmp(filters[i].shortName, filterName)){
-                ppMode->lumMode &= ~filters[i].mask;
-                ppMode->chromMode &= ~filters[i].mask;
-
-                filterNameOk=1;
-                if(!enable) break; // user wants to disable it
-
-                if(q >= filters[i].minLumQuality && luma)
-                    ppMode->lumMode|= filters[i].mask;
-                if(chrom==1 || (chrom==-1 && filters[i].chromDefault))
-                    if(q >= filters[i].minChromQuality)
-                            ppMode->chromMode|= filters[i].mask;
-
-                if(filters[i].mask == LEVEL_FIX){
-                    int o;
-                    ppMode->minAllowedY= 16;
-                    ppMode->maxAllowedY= 234;
-                    for(o=0; options[o]!=NULL; o++){
-                        if(  !strcmp(options[o],"fullyrange")
-                           ||!strcmp(options[o],"f")){
-                            ppMode->minAllowedY= 0;
-                            ppMode->maxAllowedY= 255;
-                            numOfUnknownOptions--;
-                        }
-                    }
-                }
-                else if(filters[i].mask == TEMP_NOISE_FILTER)
-                {
-                    int o;
-                    int numOfNoises=0;
-
-                    for(o=0; options[o]!=NULL; o++){
-                        char *tail;
-                        ppMode->maxTmpNoise[numOfNoises]=
-                            strtol(options[o], &tail, 0);
-                        if(tail!=options[o]){
-                            numOfNoises++;
-                            numOfUnknownOptions--;
-                            if(numOfNoises >= 3) break;
-                        }
-                    }
-                }
-                else if(filters[i].mask == V_DEBLOCK   || filters[i].mask == H_DEBLOCK
-                     || filters[i].mask == V_A_DEBLOCK || filters[i].mask == H_A_DEBLOCK){
-                    int o;
-
-                    for(o=0; options[o]!=NULL && o<2; o++){
-                        char *tail;
-                        int val= strtol(options[o], &tail, 0);
-                        if(tail==options[o]) break;
-
-                        numOfUnknownOptions--;
-                        if(o==0) ppMode->baseDcDiff= val;
-                        else ppMode->flatnessThreshold= val;
-                    }
-                }
-                else if(filters[i].mask == FORCE_QUANT){
-                    int o;
-                    ppMode->forcedQuant= 15;
-
-                    for(o=0; options[o]!=NULL && o<1; o++){
-                        char *tail;
-                        int val= strtol(options[o], &tail, 0);
-                        if(tail==options[o]) break;
-
-                        numOfUnknownOptions--;
-                        ppMode->forcedQuant= val;
-                    }
-                }
-            }
-        }
-        if(!filterNameOk) ppMode->error++;
-        ppMode->error += numOfUnknownOptions;
-    }
-
-    av_log(NULL, AV_LOG_DEBUG, "pp: lumMode=%X, chromMode=%X\n", ppMode->lumMode, ppMode->chromMode);
-    if(ppMode->error){
-        av_log(NULL, AV_LOG_ERROR, "%d errors in postprocess string \"%s\"\n", ppMode->error, name);
-        av_free(ppMode);
-        return NULL;
-    }
-    return ppMode;
-}
-
-void pp_free_mode(pp_mode *mode){
-    av_free(mode);
-}
-
-static void reallocAlign(void **p, int alignment, int size){
-    av_free(*p);
-    *p= av_mallocz(size);
-}
-
-static void reallocBuffers(PPContext *c, int width, int height, int stride, int qpStride){
-    int mbWidth = (width+15)>>4;
-    int mbHeight= (height+15)>>4;
-    int i;
-
-    c->stride= stride;
-    c->qpStride= qpStride;
-
-    reallocAlign((void **)&c->tempDst, 8, stride*24);
-    reallocAlign((void **)&c->tempSrc, 8, stride*24);
-    reallocAlign((void **)&c->tempBlocks, 8, 2*16*8);
-    reallocAlign((void **)&c->yHistogram, 8, 256*sizeof(uint64_t));
-    for(i=0; i<256; i++)
-            c->yHistogram[i]= width*height/64*15/256;
-
-    for(i=0; i<3; i++){
-        //Note: The +17*1024 is just there so i do not have to worry about r/w over the end.
-        reallocAlign((void **)&c->tempBlurred[i], 8, stride*mbHeight*16 + 17*1024);
-        reallocAlign((void **)&c->tempBlurredPast[i], 8, 256*((height+7)&(~7))/2 + 17*1024);//FIXME size
-    }
-
-    reallocAlign((void **)&c->deintTemp, 8, 2*width+32);
-    reallocAlign((void **)&c->nonBQPTable, 8, qpStride*mbHeight*sizeof(QP_STORE_T));
-    reallocAlign((void **)&c->stdQPTable, 8, qpStride*mbHeight*sizeof(QP_STORE_T));
-    reallocAlign((void **)&c->forcedQPTable, 8, mbWidth*sizeof(QP_STORE_T));
-}
-
-static const char * context_to_name(void * ptr) {
-    return "postproc";
-}
-
-static const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL };
-
-pp_context *pp_get_context(int width, int height, int cpuCaps){
-    PPContext *c= av_malloc(sizeof(PPContext));
-    int stride= FFALIGN(width, 16);  //assumed / will realloc if needed
-    int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
-
-    memset(c, 0, sizeof(PPContext));
-    c->av_class = &av_codec_context_class;
-    c->cpuCaps= cpuCaps;
-    if(cpuCaps&PP_FORMAT){
-        c->hChromaSubSample= cpuCaps&0x3;
-        c->vChromaSubSample= (cpuCaps>>4)&0x3;
-    }else{
-        c->hChromaSubSample= 1;
-        c->vChromaSubSample= 1;
-    }
-
-    reallocBuffers(c, width, height, stride, qpStride);
-
-    c->frameNum=-1;
-
-    return c;
-}
-
-void pp_free_context(void *vc){
-    PPContext *c = (PPContext*)vc;
-    int i;
-
-    for(i=0; i<3; i++) av_free(c->tempBlurred[i]);
-    for(i=0; i<3; i++) av_free(c->tempBlurredPast[i]);
-
-    av_free(c->tempBlocks);
-    av_free(c->yHistogram);
-    av_free(c->tempDst);
-    av_free(c->tempSrc);
-    av_free(c->deintTemp);
-    av_free(c->stdQPTable);
-    av_free(c->nonBQPTable);
-    av_free(c->forcedQPTable);
-
-    memset(c, 0, sizeof(PPContext));
-
-    av_free(c);
-}
-
-void  pp_postprocess(const uint8_t * src[3], const int srcStride[3],
-                     uint8_t * dst[3], const int dstStride[3],
-                     int width, int height,
-                     const QP_STORE_T *QP_store,  int QPStride,
-                     pp_mode *vm,  void *vc, int pict_type)
-{
-    int mbWidth = (width+15)>>4;
-    int mbHeight= (height+15)>>4;
-    PPMode *mode = (PPMode*)vm;
-    PPContext *c = (PPContext*)vc;
-    int minStride= FFMAX(FFABS(srcStride[0]), FFABS(dstStride[0]));
-    int absQPStride = FFABS(QPStride);
-
-    // c->stride and c->QPStride are always positive
-    if(c->stride < minStride || c->qpStride < absQPStride)
-        reallocBuffers(c, width, height,
-                       FFMAX(minStride, c->stride),
-                       FFMAX(c->qpStride, absQPStride));
-
-    if(QP_store==NULL || (mode->lumMode & FORCE_QUANT)){
-        int i;
-        QP_store= c->forcedQPTable;
-        absQPStride = QPStride = 0;
-        if(mode->lumMode & FORCE_QUANT)
-            for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= mode->forcedQuant;
-        else
-            for(i=0; i<mbWidth; i++) c->forcedQPTable[i]= 1;
-    }
-
-    if(pict_type & PP_PICT_TYPE_QP2){
-        int i;
-        const int count= mbHeight * absQPStride;
-        for(i=0; i<(count>>2); i++){
-            ((uint32_t*)c->stdQPTable)[i] = (((const uint32_t*)QP_store)[i]>>1) & 0x7F7F7F7F;
-        }
-        for(i<<=2; i<count; i++){
-            c->stdQPTable[i] = QP_store[i]>>1;
-        }
-        QP_store= c->stdQPTable;
-        QPStride= absQPStride;
-    }
-
-    if(0){
-        int x,y;
-        for(y=0; y<mbHeight; y++){
-            for(x=0; x<mbWidth; x++){
-                av_log(c, AV_LOG_INFO, "%2d ", QP_store[x + y*QPStride]);
-            }
-            av_log(c, AV_LOG_INFO, "\n");
-        }
-        av_log(c, AV_LOG_INFO, "\n");
-    }
-
-    if((pict_type&7)!=3){
-        if (QPStride >= 0){
-            int i;
-            const int count= mbHeight * QPStride;
-            for(i=0; i<(count>>2); i++){
-                ((uint32_t*)c->nonBQPTable)[i] = ((const uint32_t*)QP_store)[i] & 0x3F3F3F3F;
-            }
-            for(i<<=2; i<count; i++){
-                c->nonBQPTable[i] = QP_store[i] & 0x3F;
-            }
-        } else {
-            int i,j;
-            for(i=0; i<mbHeight; i++) {
-                for(j=0; j<absQPStride; j++) {
-                    c->nonBQPTable[i*absQPStride+j] = QP_store[i*QPStride+j] & 0x3F;
-                }
-            }
-        }
-    }
-
-    av_log(c, AV_LOG_DEBUG, "using npp filters 0x%X/0x%X\n",
-           mode->lumMode, mode->chromMode);
-
-    postProcess(src[0], srcStride[0], dst[0], dstStride[0],
-                width, height, QP_store, QPStride, 0, mode, c);
-
-    width  = (width )>>c->hChromaSubSample;
-    height = (height)>>c->vChromaSubSample;
-
-    if(mode->chromMode){
-        postProcess(src[1], srcStride[1], dst[1], dstStride[1],
-                    width, height, QP_store, QPStride, 1, mode, c);
-        postProcess(src[2], srcStride[2], dst[2], dstStride[2],
-                    width, height, QP_store, QPStride, 2, mode, c);
-    }
-    else if(srcStride[1] == dstStride[1] && srcStride[2] == dstStride[2]){
-        linecpy(dst[1], src[1], height, srcStride[1]);
-        linecpy(dst[2], src[2], height, srcStride[2]);
-    }else{
-        int y;
-        for(y=0; y<height; y++){
-            memcpy(&(dst[1][y*dstStride[1]]), &(src[1][y*srcStride[1]]), width);
-            memcpy(&(dst[2][y*dstStride[2]]), &(src[2][y*srcStride[2]]), width);
-        }
-    }
-}
-
diff --git a/libpostproc/postprocess.h b/libpostproc/postprocess.h
deleted file mode 100644
index 4cfcf7c..0000000
--- a/libpostproc/postprocess.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef POSTPROC_POSTPROCESS_H
-#define POSTPROC_POSTPROCESS_H
-
-/**
- * @file
- * @brief
- *     external postprocessing API
- */
-
-#include "libavutil/avutil.h"
-
-#define LIBPOSTPROC_VERSION_MAJOR 51
-#define LIBPOSTPROC_VERSION_MINOR  2
-#define LIBPOSTPROC_VERSION_MICRO  0
-
-#define LIBPOSTPROC_VERSION_INT AV_VERSION_INT(LIBPOSTPROC_VERSION_MAJOR, \
-                                               LIBPOSTPROC_VERSION_MINOR, \
-                                               LIBPOSTPROC_VERSION_MICRO)
-#define LIBPOSTPROC_VERSION     AV_VERSION(LIBPOSTPROC_VERSION_MAJOR, \
-                                           LIBPOSTPROC_VERSION_MINOR, \
-                                           LIBPOSTPROC_VERSION_MICRO)
-#define LIBPOSTPROC_BUILD       LIBPOSTPROC_VERSION_INT
-
-#define LIBPOSTPROC_IDENT       "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION)
-
-/**
- * Returns the LIBPOSTPROC_VERSION_INT constant.
- */
-unsigned postproc_version(void);
-
-/**
- * Returns the libpostproc build-time configuration.
- */
-const char *postproc_configuration(void);
-
-/**
- * Returns the libpostproc license.
- */
-const char *postproc_license(void);
-
-#define PP_QUALITY_MAX 6
-
-#define QP_STORE_T int8_t
-
-#include <inttypes.h>
-
-typedef void pp_context;
-typedef void pp_mode;
-
-#if LIBPOSTPROC_VERSION_INT < (52<<16)
-typedef pp_context pp_context_t;
-typedef pp_mode pp_mode_t;
-extern const char *const pp_help; ///< a simple help text
-#else
-extern const char pp_help[]; ///< a simple help text
-#endif
-
-void  pp_postprocess(const uint8_t * src[3], const int srcStride[3],
-                     uint8_t * dst[3], const int dstStride[3],
-                     int horizontalSize, int verticalSize,
-                     const QP_STORE_T *QP_store,  int QP_stride,
-                     pp_mode *mode, pp_context *ppContext, int pict_type);
-
-
-/**
- * returns a pp_mode or NULL if an error occurred
- * name is the string after "-pp" on the command line
- * quality is a number from 0 to PP_QUALITY_MAX
- */
-pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality);
-void pp_free_mode(pp_mode *mode);
-
-pp_context *pp_get_context(int width, int height, int flags);
-void pp_free_context(pp_context *ppContext);
-
-#define PP_CPU_CAPS_MMX   0x80000000
-#define PP_CPU_CAPS_MMX2  0x20000000
-#define PP_CPU_CAPS_3DNOW 0x40000000
-#define PP_CPU_CAPS_ALTIVEC 0x10000000
-
-#define PP_FORMAT         0x00000008
-#define PP_FORMAT_420    (0x00000011|PP_FORMAT)
-#define PP_FORMAT_422    (0x00000001|PP_FORMAT)
-#define PP_FORMAT_411    (0x00000002|PP_FORMAT)
-#define PP_FORMAT_444    (0x00000000|PP_FORMAT)
-
-#define PP_PICT_TYPE_QP2  0x00000010 ///< MPEG2 style QScale
-
-#endif /* POSTPROC_POSTPROCESS_H */
diff --git a/libpostproc/postprocess_altivec_template.c b/libpostproc/postprocess_altivec_template.c
deleted file mode 100644
index c5851d9..0000000
--- a/libpostproc/postprocess_altivec_template.c
+++ /dev/null
@@ -1,1214 +0,0 @@
-/*
- * AltiVec optimizations (C) 2004 Romain Dolbeau <romain at dolbeau.org>
- *
- * based on code by Copyright (C) 2001-2003 Michael Niedermayer (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avutil.h"
-
-#define ALTIVEC_TRANSPOSE_8x8_SHORT(src_a,src_b,src_c,src_d,src_e,src_f,src_g,src_h) \
-    do {                                                          \
-        __typeof__(src_a) tempA1, tempB1, tempC1, tempD1;         \
-        __typeof__(src_a) tempE1, tempF1, tempG1, tempH1;         \
-        __typeof__(src_a) tempA2, tempB2, tempC2, tempD2;         \
-        __typeof__(src_a) tempE2, tempF2, tempG2, tempH2;         \
-        tempA1 = vec_mergeh (src_a, src_e);                       \
-        tempB1 = vec_mergel (src_a, src_e);                       \
-        tempC1 = vec_mergeh (src_b, src_f);                       \
-        tempD1 = vec_mergel (src_b, src_f);                       \
-        tempE1 = vec_mergeh (src_c, src_g);                       \
-        tempF1 = vec_mergel (src_c, src_g);                       \
-        tempG1 = vec_mergeh (src_d, src_h);                       \
-        tempH1 = vec_mergel (src_d, src_h);                       \
-        tempA2 = vec_mergeh (tempA1, tempE1);                     \
-        tempB2 = vec_mergel (tempA1, tempE1);                     \
-        tempC2 = vec_mergeh (tempB1, tempF1);                     \
-        tempD2 = vec_mergel (tempB1, tempF1);                     \
-        tempE2 = vec_mergeh (tempC1, tempG1);                     \
-        tempF2 = vec_mergel (tempC1, tempG1);                     \
-        tempG2 = vec_mergeh (tempD1, tempH1);                     \
-        tempH2 = vec_mergel (tempD1, tempH1);                     \
-        src_a = vec_mergeh (tempA2, tempE2);                      \
-        src_b = vec_mergel (tempA2, tempE2);                      \
-        src_c = vec_mergeh (tempB2, tempF2);                      \
-        src_d = vec_mergel (tempB2, tempF2);                      \
-        src_e = vec_mergeh (tempC2, tempG2);                      \
-        src_f = vec_mergel (tempC2, tempG2);                      \
-        src_g = vec_mergeh (tempD2, tempH2);                      \
-        src_h = vec_mergel (tempD2, tempH2);                      \
-    } while (0)
-
-
-static inline int vertClassify_altivec(uint8_t src[], int stride, PPContext *c) {
-    /*
-    this code makes no assumption on src or stride.
-    One could remove the recomputation of the perm
-    vector by assuming (stride % 16) == 0, unfortunately
-    this is not always true.
-    */
-    DECLARE_ALIGNED(16, short, data)[8] =
-                    {
-                        ((c->nonBQP*c->ppMode.baseDcDiff)>>8) + 1,
-                        data[0] * 2 + 1,
-                        c->QP * 2,
-                        c->QP * 4
-                    };
-    int numEq;
-    uint8_t *src2 = src;
-    vector signed short v_dcOffset;
-    vector signed short v2QP;
-    vector unsigned short v4QP;
-    vector unsigned short v_dcThreshold;
-    const int properStride = (stride % 16);
-    const int srcAlign = ((unsigned long)src2 % 16);
-    const int two_vectors = ((srcAlign > 8) || properStride) ? 1 : 0;
-    const vector signed int zero = vec_splat_s32(0);
-    const vector signed short mask = vec_splat_s16(1);
-    vector signed int v_numEq = vec_splat_s32(0);
-    vector signed short v_data = vec_ld(0, data);
-    vector signed short v_srcAss0, v_srcAss1, v_srcAss2, v_srcAss3,
-                        v_srcAss4, v_srcAss5, v_srcAss6, v_srcAss7;
-//FIXME avoid this mess if possible
-    register int j0 = 0,
-                 j1 = stride,
-                 j2 = 2 * stride,
-                 j3 = 3 * stride,
-                 j4 = 4 * stride,
-                 j5 = 5 * stride,
-                 j6 = 6 * stride,
-                 j7 = 7 * stride;
-    vector unsigned char v_srcA0, v_srcA1, v_srcA2, v_srcA3,
-                         v_srcA4, v_srcA5, v_srcA6, v_srcA7;
-
-    v_dcOffset = vec_splat(v_data, 0);
-    v_dcThreshold = (vector unsigned short)vec_splat(v_data, 1);
-    v2QP = vec_splat(v_data, 2);
-    v4QP = (vector unsigned short)vec_splat(v_data, 3);
-
-    src2 += stride * 4;
-
-#define LOAD_LINE(i)                                                    \
-    {                                                                   \
-    vector unsigned char perm##i = vec_lvsl(j##i, src2);                \
-    vector unsigned char v_srcA2##i;                                    \
-    vector unsigned char v_srcA1##i = vec_ld(j##i, src2);               \
-    if (two_vectors)                                                    \
-        v_srcA2##i = vec_ld(j##i + 16, src2);                           \
-    v_srcA##i =                                                         \
-        vec_perm(v_srcA1##i, v_srcA2##i, perm##i);                      \
-    v_srcAss##i =                                                       \
-        (vector signed short)vec_mergeh((vector signed char)zero,       \
-                                        (vector signed char)v_srcA##i); }
-
-#define LOAD_LINE_ALIGNED(i)                                            \
-    v_srcA##i = vec_ld(j##i, src2);                                     \
-    v_srcAss##i =                                                       \
-        (vector signed short)vec_mergeh((vector signed char)zero,       \
-                                        (vector signed char)v_srcA##i)
-
-    /* Special-casing the aligned case is worthwhile, as all calls from
-     * the (transposed) horizontable deblocks will be aligned, in addition
-     * to the naturally aligned vertical deblocks. */
-    if (properStride && srcAlign) {
-        LOAD_LINE_ALIGNED(0);
-        LOAD_LINE_ALIGNED(1);
-        LOAD_LINE_ALIGNED(2);
-        LOAD_LINE_ALIGNED(3);
-        LOAD_LINE_ALIGNED(4);
-        LOAD_LINE_ALIGNED(5);
-        LOAD_LINE_ALIGNED(6);
-        LOAD_LINE_ALIGNED(7);
-    } else {
-        LOAD_LINE(0);
-        LOAD_LINE(1);
-        LOAD_LINE(2);
-        LOAD_LINE(3);
-        LOAD_LINE(4);
-        LOAD_LINE(5);
-        LOAD_LINE(6);
-        LOAD_LINE(7);
-    }
-#undef LOAD_LINE
-#undef LOAD_LINE_ALIGNED
-
-#define ITER(i, j)                                                      \
-    const vector signed short v_diff##i =                               \
-        vec_sub(v_srcAss##i, v_srcAss##j);                              \
-    const vector signed short v_sum##i =                                \
-        vec_add(v_diff##i, v_dcOffset);                                 \
-    const vector signed short v_comp##i =                               \
-        (vector signed short)vec_cmplt((vector unsigned short)v_sum##i, \
-                                       v_dcThreshold);                  \
-    const vector signed short v_part##i = vec_and(mask, v_comp##i);
-
-    {
-        ITER(0, 1)
-        ITER(1, 2)
-        ITER(2, 3)
-        ITER(3, 4)
-        ITER(4, 5)
-        ITER(5, 6)
-        ITER(6, 7)
-
-        v_numEq = vec_sum4s(v_part0, v_numEq);
-        v_numEq = vec_sum4s(v_part1, v_numEq);
-        v_numEq = vec_sum4s(v_part2, v_numEq);
-        v_numEq = vec_sum4s(v_part3, v_numEq);
-        v_numEq = vec_sum4s(v_part4, v_numEq);
-        v_numEq = vec_sum4s(v_part5, v_numEq);
-        v_numEq = vec_sum4s(v_part6, v_numEq);
-    }
-
-#undef ITER
-
-    v_numEq = vec_sums(v_numEq, zero);
-
-    v_numEq = vec_splat(v_numEq, 3);
-    vec_ste(v_numEq, 0, &numEq);
-
-    if (numEq > c->ppMode.flatnessThreshold){
-        const vector unsigned char mmoP1 = (const vector unsigned char)
-            {0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f,
-             0x00, 0x01, 0x12, 0x13, 0x08, 0x09, 0x1A, 0x1B};
-        const vector unsigned char mmoP2 = (const vector unsigned char)
-            {0x04, 0x05, 0x16, 0x17, 0x0C, 0x0D, 0x1E, 0x1F,
-             0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f};
-        const vector unsigned char mmoP = (const vector unsigned char)
-            vec_lvsl(8, (unsigned char*)0);
-
-        vector signed short mmoL1 = vec_perm(v_srcAss0, v_srcAss2, mmoP1);
-        vector signed short mmoL2 = vec_perm(v_srcAss4, v_srcAss6, mmoP2);
-        vector signed short mmoL = vec_perm(mmoL1, mmoL2, mmoP);
-        vector signed short mmoR1 = vec_perm(v_srcAss5, v_srcAss7, mmoP1);
-        vector signed short mmoR2 = vec_perm(v_srcAss1, v_srcAss3, mmoP2);
-        vector signed short mmoR = vec_perm(mmoR1, mmoR2, mmoP);
-        vector signed short mmoDiff = vec_sub(mmoL, mmoR);
-        vector unsigned short mmoSum = (vector unsigned short)vec_add(mmoDiff, v2QP);
-
-        if (vec_any_gt(mmoSum, v4QP))
-            return 0;
-        else
-            return 1;
-    }
-    else return 2;
-}
-
-static inline void doVertLowPass_altivec(uint8_t *src, int stride, PPContext *c) {
-    /*
-    this code makes no assumption on src or stride.
-    One could remove the recomputation of the perm
-    vector by assuming (stride % 16) == 0, unfortunately
-    this is not always true. Quite a lot of load/stores
-    can be removed by assuming proper alignment of
-    src & stride :-(
-    */
-    uint8_t *src2 = src;
-    const vector signed int zero = vec_splat_s32(0);
-    const int properStride = (stride % 16);
-    const int srcAlign = ((unsigned long)src2 % 16);
-    DECLARE_ALIGNED(16, short, qp)[8] = {c->QP};
-    vector signed short vqp = vec_ld(0, qp);
-    vector signed short vb0, vb1, vb2, vb3, vb4, vb5, vb6, vb7, vb8, vb9;
-    vector unsigned char vbA0, av_uninit(vbA1), av_uninit(vbA2), av_uninit(vbA3), av_uninit(vbA4), av_uninit(vbA5), av_uninit(vbA6), av_uninit(vbA7), av_uninit(vbA8), vbA9;
-    vector unsigned char vbB0, av_uninit(vbB1), av_uninit(vbB2), av_uninit(vbB3), av_uninit(vbB4), av_uninit(vbB5), av_uninit(vbB6), av_uninit(vbB7), av_uninit(vbB8), vbB9;
-    vector unsigned char vbT0, vbT1, vbT2, vbT3, vbT4, vbT5, vbT6, vbT7, vbT8, vbT9;
-    vector unsigned char perml0, perml1, perml2, perml3, perml4,
-                         perml5, perml6, perml7, perml8, perml9;
-    register int j0 = 0,
-                 j1 = stride,
-                 j2 = 2 * stride,
-                 j3 = 3 * stride,
-                 j4 = 4 * stride,
-                 j5 = 5 * stride,
-                 j6 = 6 * stride,
-                 j7 = 7 * stride,
-                 j8 = 8 * stride,
-                 j9 = 9 * stride;
-
-    vqp = vec_splat(vqp, 0);
-
-    src2 += stride*3;
-
-#define LOAD_LINE(i)                                                    \
-    perml##i = vec_lvsl(i * stride, src2);                              \
-    vbA##i = vec_ld(i * stride, src2);                                  \
-    vbB##i = vec_ld(i * stride + 16, src2);                             \
-    vbT##i = vec_perm(vbA##i, vbB##i, perml##i);                        \
-    vb##i =                                                             \
-        (vector signed short)vec_mergeh((vector unsigned char)zero,     \
-                                        (vector unsigned char)vbT##i)
-
-#define LOAD_LINE_ALIGNED(i)                                            \
-    vbT##i = vec_ld(j##i, src2);                                        \
-    vb##i =                                                             \
-        (vector signed short)vec_mergeh((vector signed char)zero,       \
-                                        (vector signed char)vbT##i)
-
-      /* Special-casing the aligned case is worthwhile, as all calls from
-       * the (transposed) horizontable deblocks will be aligned, in addition
-       * to the naturally aligned vertical deblocks. */
-    if (properStride && srcAlign) {
-          LOAD_LINE_ALIGNED(0);
-          LOAD_LINE_ALIGNED(1);
-          LOAD_LINE_ALIGNED(2);
-          LOAD_LINE_ALIGNED(3);
-          LOAD_LINE_ALIGNED(4);
-          LOAD_LINE_ALIGNED(5);
-          LOAD_LINE_ALIGNED(6);
-          LOAD_LINE_ALIGNED(7);
-          LOAD_LINE_ALIGNED(8);
-          LOAD_LINE_ALIGNED(9);
-    } else {
-          LOAD_LINE(0);
-          LOAD_LINE(1);
-          LOAD_LINE(2);
-          LOAD_LINE(3);
-          LOAD_LINE(4);
-          LOAD_LINE(5);
-          LOAD_LINE(6);
-          LOAD_LINE(7);
-          LOAD_LINE(8);
-          LOAD_LINE(9);
-    }
-#undef LOAD_LINE
-#undef LOAD_LINE_ALIGNED
-    {
-        const vector unsigned short v_2 = vec_splat_u16(2);
-        const vector unsigned short v_4 = vec_splat_u16(4);
-
-        const vector signed short v_diff01 = vec_sub(vb0, vb1);
-        const vector unsigned short v_cmp01 =
-            (const vector unsigned short) vec_cmplt(vec_abs(v_diff01), vqp);
-        const vector signed short v_first = vec_sel(vb1, vb0, v_cmp01);
-        const vector signed short v_diff89 = vec_sub(vb8, vb9);
-        const vector unsigned short v_cmp89 =
-            (const vector unsigned short) vec_cmplt(vec_abs(v_diff89), vqp);
-        const vector signed short v_last = vec_sel(vb8, vb9, v_cmp89);
-
-        const vector signed short temp01 = vec_mladd(v_first, (vector signed short)v_4, vb1);
-        const vector signed short temp02 = vec_add(vb2, vb3);
-        const vector signed short temp03 = vec_add(temp01, (vector signed short)v_4);
-        const vector signed short v_sumsB0 = vec_add(temp02, temp03);
-
-        const vector signed short temp11 = vec_sub(v_sumsB0, v_first);
-        const vector signed short v_sumsB1 = vec_add(temp11, vb4);
-
-        const vector signed short temp21 = vec_sub(v_sumsB1, v_first);
-        const vector signed short v_sumsB2 = vec_add(temp21, vb5);
-
-        const vector signed short temp31 = vec_sub(v_sumsB2, v_first);
-        const vector signed short v_sumsB3 = vec_add(temp31, vb6);
-
-        const vector signed short temp41 = vec_sub(v_sumsB3, v_first);
-        const vector signed short v_sumsB4 = vec_add(temp41, vb7);
-
-        const vector signed short temp51 = vec_sub(v_sumsB4, vb1);
-        const vector signed short v_sumsB5 = vec_add(temp51, vb8);
-
-        const vector signed short temp61 = vec_sub(v_sumsB5, vb2);
-        const vector signed short v_sumsB6 = vec_add(temp61, v_last);
-
-        const vector signed short temp71 = vec_sub(v_sumsB6, vb3);
-        const vector signed short v_sumsB7 = vec_add(temp71, v_last);
-
-        const vector signed short temp81 = vec_sub(v_sumsB7, vb4);
-        const vector signed short v_sumsB8 = vec_add(temp81, v_last);
-
-        const vector signed short temp91 = vec_sub(v_sumsB8, vb5);
-        const vector signed short v_sumsB9 = vec_add(temp91, v_last);
-
-    #define COMPUTE_VR(i, j, k)                                             \
-        const vector signed short temps1##i =                               \
-            vec_add(v_sumsB##i, v_sumsB##k);                                \
-        const vector signed short temps2##i =                               \
-            vec_mladd(vb##j, (vector signed short)v_2, temps1##i);          \
-        const vector signed short  vr##j = vec_sra(temps2##i, v_4)
-
-        COMPUTE_VR(0, 1, 2);
-        COMPUTE_VR(1, 2, 3);
-        COMPUTE_VR(2, 3, 4);
-        COMPUTE_VR(3, 4, 5);
-        COMPUTE_VR(4, 5, 6);
-        COMPUTE_VR(5, 6, 7);
-        COMPUTE_VR(6, 7, 8);
-        COMPUTE_VR(7, 8, 9);
-
-        const vector signed char neg1 = vec_splat_s8(-1);
-        const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                                                                         0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
-
-#define PACK_AND_STORE(i)                                       \
-{   const vector unsigned char perms##i =                       \
-        vec_lvsr(i * stride, src2);                             \
-    const vector unsigned char vf##i =                          \
-        vec_packsu(vr##i, (vector signed short)zero);           \
-    const vector unsigned char vg##i =                          \
-        vec_perm(vf##i, vbT##i, permHH);                        \
-    const vector unsigned char mask##i =                        \
-        vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms##i); \
-    const vector unsigned char vg2##i =                         \
-        vec_perm(vg##i, vg##i, perms##i);                       \
-    const vector unsigned char svA##i =                         \
-        vec_sel(vbA##i, vg2##i, mask##i);                       \
-    const vector unsigned char svB##i =                         \
-        vec_sel(vg2##i, vbB##i, mask##i);                       \
-    vec_st(svA##i, i * stride, src2);                           \
-    vec_st(svB##i, i * stride + 16, src2);}
-
-#define PACK_AND_STORE_ALIGNED(i)                               \
-{   const vector unsigned char vf##i =                          \
-        vec_packsu(vr##i, (vector signed short)zero);           \
-    const vector unsigned char vg##i =                          \
-        vec_perm(vf##i, vbT##i, permHH);                        \
-    vec_st(vg##i, i * stride, src2);}
-
-        /* Special-casing the aligned case is worthwhile, as all calls from
-         * the (transposed) horizontable deblocks will be aligned, in addition
-         * to the naturally aligned vertical deblocks. */
-        if (properStride && srcAlign) {
-            PACK_AND_STORE_ALIGNED(1)
-            PACK_AND_STORE_ALIGNED(2)
-            PACK_AND_STORE_ALIGNED(3)
-            PACK_AND_STORE_ALIGNED(4)
-            PACK_AND_STORE_ALIGNED(5)
-            PACK_AND_STORE_ALIGNED(6)
-            PACK_AND_STORE_ALIGNED(7)
-            PACK_AND_STORE_ALIGNED(8)
-        } else {
-            PACK_AND_STORE(1)
-            PACK_AND_STORE(2)
-            PACK_AND_STORE(3)
-            PACK_AND_STORE(4)
-            PACK_AND_STORE(5)
-            PACK_AND_STORE(6)
-            PACK_AND_STORE(7)
-            PACK_AND_STORE(8)
-        }
-    #undef PACK_AND_STORE
-    #undef PACK_AND_STORE_ALIGNED
-    }
-}
-
-
-
-static inline void doVertDefFilter_altivec(uint8_t src[], int stride, PPContext *c) {
-    /*
-    this code makes no assumption on src or stride.
-    One could remove the recomputation of the perm
-    vector by assuming (stride % 16) == 0, unfortunately
-    this is not always true. Quite a lot of load/stores
-    can be removed by assuming proper alignment of
-    src & stride :-(
-    */
-    uint8_t *src2 = src + stride*3;
-    const vector signed int zero = vec_splat_s32(0);
-    DECLARE_ALIGNED(16, short, qp)[8] = {8*c->QP};
-    vector signed short vqp = vec_splat(
-                                (vector signed short)vec_ld(0, qp), 0);
-
-#define LOAD_LINE(i)                                                    \
-    const vector unsigned char perm##i =                                \
-        vec_lvsl(i * stride, src2);                                     \
-    const vector unsigned char vbA##i =                                 \
-        vec_ld(i * stride, src2);                                       \
-    const vector unsigned char vbB##i =                                 \
-        vec_ld(i * stride + 16, src2);                                  \
-    const vector unsigned char vbT##i =                                 \
-        vec_perm(vbA##i, vbB##i, perm##i);                              \
-    const vector signed short vb##i =                                   \
-        (vector signed short)vec_mergeh((vector unsigned char)zero,     \
-                                        (vector unsigned char)vbT##i)
-
-     LOAD_LINE(1);
-     LOAD_LINE(2);
-     LOAD_LINE(3);
-     LOAD_LINE(4);
-     LOAD_LINE(5);
-     LOAD_LINE(6);
-     LOAD_LINE(7);
-     LOAD_LINE(8);
-#undef LOAD_LINE
-
-     const vector signed short v_1 = vec_splat_s16(1);
-     const vector signed short v_2 = vec_splat_s16(2);
-     const vector signed short v_5 = vec_splat_s16(5);
-     const vector signed short v_32 = vec_sl(v_1,
-                                             (vector unsigned short)v_5);
-     /* middle energy */
-     const vector signed short l3minusl6 = vec_sub(vb3, vb6);
-     const vector signed short l5minusl4 = vec_sub(vb5, vb4);
-     const vector signed short twotimes_l3minusl6 = vec_mladd(v_2, l3minusl6, (vector signed short)zero);
-     const vector signed short mE = vec_mladd(v_5, l5minusl4, twotimes_l3minusl6);
-     const vector signed short absmE = vec_abs(mE);
-     /* left & right energy */
-     const vector signed short l1minusl4 = vec_sub(vb1, vb4);
-     const vector signed short l3minusl2 = vec_sub(vb3, vb2);
-     const vector signed short l5minusl8 = vec_sub(vb5, vb8);
-     const vector signed short l7minusl6 = vec_sub(vb7, vb6);
-     const vector signed short twotimes_l1minusl4 = vec_mladd(v_2, l1minusl4, (vector signed short)zero);
-     const vector signed short twotimes_l5minusl8 = vec_mladd(v_2, l5minusl8, (vector signed short)zero);
-     const vector signed short lE = vec_mladd(v_5, l3minusl2, twotimes_l1minusl4);
-     const vector signed short rE = vec_mladd(v_5, l7minusl6, twotimes_l5minusl8);
-     /* d */
-     const vector signed short ddiff = vec_sub(absmE,
-                                               vec_min(vec_abs(lE),
-                                                       vec_abs(rE)));
-     const vector signed short ddiffclamp = vec_max(ddiff, (vector signed short)zero);
-     const vector signed short dtimes64 = vec_mladd(v_5, ddiffclamp, v_32);
-     const vector signed short d = vec_sra(dtimes64, vec_splat_u16(6));
-     const vector signed short minusd = vec_sub((vector signed short)zero, d);
-     const vector signed short finald = vec_sel(minusd,
-                                                d,
-                                                vec_cmpgt(vec_sub((vector signed short)zero, mE),
-                                                          (vector signed short)zero));
-     /* q */
-     const vector signed short qtimes2 = vec_sub(vb4, vb5);
-     /* for a shift right to behave like /2, we need to add one
-        to all negative integer */
-     const vector signed short rounddown = vec_sel((vector signed short)zero,
-                                                   v_1,
-                                                   vec_cmplt(qtimes2, (vector signed short)zero));
-     const vector signed short q = vec_sra(vec_add(qtimes2, rounddown), vec_splat_u16(1));
-     /* clamp */
-     const vector signed short dclamp_P1 = vec_max((vector signed short)zero, finald);
-     const vector signed short dclamp_P = vec_min(dclamp_P1, q);
-     const vector signed short dclamp_N1 = vec_min((vector signed short)zero, finald);
-     const vector signed short dclamp_N = vec_max(dclamp_N1, q);
-
-     const vector signed short dclampedfinal = vec_sel(dclamp_N,
-                                                       dclamp_P,
-                                                       vec_cmpgt(q, (vector signed short)zero));
-     const vector signed short dornotd = vec_sel((vector signed short)zero,
-                                                 dclampedfinal,
-                                                 vec_cmplt(absmE, vqp));
-     /* add/subtract to l4 and l5 */
-     const vector signed short vb4minusd = vec_sub(vb4, dornotd);
-     const vector signed short vb5plusd  = vec_add(vb5, dornotd);
-     /* finally, stores */
-     const vector unsigned char st4 = vec_packsu(vb4minusd, (vector signed short)zero);
-     const vector unsigned char st5 = vec_packsu(vb5plusd,  (vector signed short)zero);
-
-     const vector signed char neg1 = vec_splat_s8(-1);
-     const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                                                                      0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
-
-#define STORE(i)                                                \
-{    const vector unsigned char perms##i =                      \
-         vec_lvsr(i * stride, src2);                            \
-     const vector unsigned char vg##i =                         \
-         vec_perm(st##i, vbT##i, permHH);                       \
-     const vector unsigned char mask##i =                       \
-         vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms##i); \
-     const vector unsigned char vg2##i =                        \
-         vec_perm(vg##i, vg##i, perms##i);                      \
-     const vector unsigned char svA##i =                        \
-         vec_sel(vbA##i, vg2##i, mask##i);                      \
-     const vector unsigned char svB##i =                        \
-         vec_sel(vg2##i, vbB##i, mask##i);                      \
-     vec_st(svA##i, i * stride, src2);                          \
-     vec_st(svB##i, i * stride + 16, src2);}
-
-     STORE(4)
-     STORE(5)
-}
-
-static inline void dering_altivec(uint8_t src[], int stride, PPContext *c) {
-    /*
-    this code makes no assumption on src or stride.
-    One could remove the recomputation of the perm
-    vector by assuming (stride % 16) == 0, unfortunately
-    this is not always true. Quite a lot of load/stores
-    can be removed by assuming proper alignment of
-    src & stride :-(
-    */
-    uint8_t *srcCopy = src;
-    DECLARE_ALIGNED(16, uint8_t, dt)[16];
-    const vector signed int zero = vec_splat_s32(0);
-    vector unsigned char v_dt;
-    dt[0] = deringThreshold;
-    v_dt = vec_splat(vec_ld(0, dt), 0);
-
-#define LOAD_LINE(i)                                                  \
-    const vector unsigned char perm##i =                              \
-        vec_lvsl(i * stride, srcCopy);                                \
-    vector unsigned char sA##i = vec_ld(i * stride, srcCopy);         \
-    vector unsigned char sB##i = vec_ld(i * stride + 16, srcCopy);    \
-    vector unsigned char src##i = vec_perm(sA##i, sB##i, perm##i)
-
-    LOAD_LINE(0);
-    LOAD_LINE(1);
-    LOAD_LINE(2);
-    LOAD_LINE(3);
-    LOAD_LINE(4);
-    LOAD_LINE(5);
-    LOAD_LINE(6);
-    LOAD_LINE(7);
-    LOAD_LINE(8);
-    LOAD_LINE(9);
-#undef LOAD_LINE
-
-    vector unsigned char v_avg;
-    {
-    const vector unsigned char trunc_perm = (vector unsigned char)
-        {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
-         0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
-    const vector unsigned char trunc_src12 = vec_perm(src1, src2, trunc_perm);
-    const vector unsigned char trunc_src34 = vec_perm(src3, src4, trunc_perm);
-    const vector unsigned char trunc_src56 = vec_perm(src5, src6, trunc_perm);
-    const vector unsigned char trunc_src78 = vec_perm(src7, src8, trunc_perm);
-
-#define EXTRACT(op) do {                                                \
-    const vector unsigned char s##op##_1   = vec_##op(trunc_src12, trunc_src34); \
-    const vector unsigned char s##op##_2   = vec_##op(trunc_src56, trunc_src78); \
-    const vector unsigned char s##op##_6   = vec_##op(s##op##_1, s##op##_2);     \
-    const vector unsigned char s##op##_8h  = vec_mergeh(s##op##_6, s##op##_6);   \
-    const vector unsigned char s##op##_8l  = vec_mergel(s##op##_6, s##op##_6);   \
-    const vector unsigned char s##op##_9   = vec_##op(s##op##_8h, s##op##_8l);   \
-    const vector unsigned char s##op##_9h  = vec_mergeh(s##op##_9, s##op##_9);   \
-    const vector unsigned char s##op##_9l  = vec_mergel(s##op##_9, s##op##_9);   \
-    const vector unsigned char s##op##_10  = vec_##op(s##op##_9h, s##op##_9l);   \
-    const vector unsigned char s##op##_10h = vec_mergeh(s##op##_10, s##op##_10); \
-    const vector unsigned char s##op##_10l = vec_mergel(s##op##_10, s##op##_10); \
-    const vector unsigned char s##op##_11  = vec_##op(s##op##_10h, s##op##_10l); \
-    const vector unsigned char s##op##_11h = vec_mergeh(s##op##_11, s##op##_11); \
-    const vector unsigned char s##op##_11l = vec_mergel(s##op##_11, s##op##_11); \
-    v_##op = vec_##op(s##op##_11h, s##op##_11l); } while (0)
-
-    vector unsigned char v_min;
-    vector unsigned char v_max;
-    EXTRACT(min);
-    EXTRACT(max);
-#undef EXTRACT
-
-    if (vec_all_lt(vec_sub(v_max, v_min), v_dt))
-        return;
-
-    v_avg = vec_avg(v_min, v_max);
-    }
-
-    DECLARE_ALIGNED(16, signed int, S)[8];
-    {
-    const vector unsigned short mask1 = (vector unsigned short)
-                                        {0x0001, 0x0002, 0x0004, 0x0008,
-                                         0x0010, 0x0020, 0x0040, 0x0080};
-    const vector unsigned short mask2 = (vector unsigned short)
-                                        {0x0100, 0x0200, 0x0000, 0x0000,
-                                         0x0000, 0x0000, 0x0000, 0x0000};
-
-    const vector unsigned int vuint32_16 = vec_sl(vec_splat_u32(1), vec_splat_u32(4));
-    const vector unsigned int vuint32_1 = vec_splat_u32(1);
-
-#define COMPARE(i)                                                      \
-    vector signed int sum##i;                                           \
-    do {                                                                \
-        const vector unsigned char cmp##i =                             \
-            (vector unsigned char)vec_cmpgt(src##i, v_avg);             \
-        const vector unsigned short cmpHi##i =                          \
-            (vector unsigned short)vec_mergeh(cmp##i, cmp##i);          \
-        const vector unsigned short cmpLi##i =                          \
-            (vector unsigned short)vec_mergel(cmp##i, cmp##i);          \
-        const vector signed short cmpHf##i =                            \
-            (vector signed short)vec_and(cmpHi##i, mask1);              \
-        const vector signed short cmpLf##i =                            \
-            (vector signed short)vec_and(cmpLi##i, mask2);              \
-        const vector signed int sump##i = vec_sum4s(cmpHf##i, zero);    \
-        const vector signed int sumq##i = vec_sum4s(cmpLf##i, sump##i); \
-        sum##i  = vec_sums(sumq##i, zero); } while (0)
-
-    COMPARE(0);
-    COMPARE(1);
-    COMPARE(2);
-    COMPARE(3);
-    COMPARE(4);
-    COMPARE(5);
-    COMPARE(6);
-    COMPARE(7);
-    COMPARE(8);
-    COMPARE(9);
-#undef COMPARE
-
-    vector signed int sumA2;
-    vector signed int sumB2;
-    {
-    const vector signed int sump02 = vec_mergel(sum0, sum2);
-    const vector signed int sump13 = vec_mergel(sum1, sum3);
-    const vector signed int sumA = vec_mergel(sump02, sump13);
-
-    const vector signed int sump46 = vec_mergel(sum4, sum6);
-    const vector signed int sump57 = vec_mergel(sum5, sum7);
-    const vector signed int sumB = vec_mergel(sump46, sump57);
-
-    const vector signed int sump8A = vec_mergel(sum8, zero);
-    const vector signed int sump9B = vec_mergel(sum9, zero);
-    const vector signed int sumC = vec_mergel(sump8A, sump9B);
-
-    const vector signed int tA = vec_sl(vec_nor(zero, sumA), vuint32_16);
-    const vector signed int tB = vec_sl(vec_nor(zero, sumB), vuint32_16);
-    const vector signed int tC = vec_sl(vec_nor(zero, sumC), vuint32_16);
-    const vector signed int t2A = vec_or(sumA, tA);
-    const vector signed int t2B = vec_or(sumB, tB);
-    const vector signed int t2C = vec_or(sumC, tC);
-    const vector signed int t3A = vec_and(vec_sra(t2A, vuint32_1),
-                                          vec_sl(t2A, vuint32_1));
-    const vector signed int t3B = vec_and(vec_sra(t2B, vuint32_1),
-                                          vec_sl(t2B, vuint32_1));
-    const vector signed int t3C = vec_and(vec_sra(t2C, vuint32_1),
-                                          vec_sl(t2C, vuint32_1));
-    const vector signed int yA = vec_and(t2A, t3A);
-    const vector signed int yB = vec_and(t2B, t3B);
-    const vector signed int yC = vec_and(t2C, t3C);
-
-    const vector unsigned char strangeperm1 = vec_lvsl(4, (unsigned char*)0);
-    const vector unsigned char strangeperm2 = vec_lvsl(8, (unsigned char*)0);
-    const vector signed int sumAd4 = vec_perm(yA, yB, strangeperm1);
-    const vector signed int sumAd8 = vec_perm(yA, yB, strangeperm2);
-    const vector signed int sumBd4 = vec_perm(yB, yC, strangeperm1);
-    const vector signed int sumBd8 = vec_perm(yB, yC, strangeperm2);
-    const vector signed int sumAp = vec_and(yA,
-                                            vec_and(sumAd4,sumAd8));
-    const vector signed int sumBp = vec_and(yB,
-                                            vec_and(sumBd4,sumBd8));
-    sumA2 = vec_or(sumAp,
-                   vec_sra(sumAp,
-                           vuint32_16));
-    sumB2  = vec_or(sumBp,
-                    vec_sra(sumBp,
-                            vuint32_16));
-    }
-    vec_st(sumA2, 0, S);
-    vec_st(sumB2, 16, S);
-    }
-
-    /* I'm not sure the following is actually faster
-       than straight, unvectorized C code :-( */
-
-    DECLARE_ALIGNED(16, int, tQP2)[4];
-    tQP2[0]= c->QP/2 + 1;
-    vector signed int vQP2 = vec_ld(0, tQP2);
-    vQP2 = vec_splat(vQP2, 0);
-    const vector signed int vsint32_8 = vec_splat_s32(8);
-    const vector unsigned int vuint32_4 = vec_splat_u32(4);
-
-    const vector unsigned char permA1 = (vector unsigned char)
-        {0x00, 0x01, 0x02, 0x10, 0x11, 0x12, 0x1F, 0x1F,
-         0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F};
-    const vector unsigned char permA2 = (vector unsigned char)
-        {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x10, 0x11,
-         0x12, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F};
-    const vector unsigned char permA1inc = (vector unsigned char)
-        {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
-         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-    const vector unsigned char permA2inc = (vector unsigned char)
-        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-    const vector unsigned char magic = (vector unsigned char)
-        {0x01, 0x02, 0x01, 0x02, 0x04, 0x02, 0x01, 0x02,
-         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-    const vector unsigned char extractPerm = (vector unsigned char)
-        {0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01,
-         0x10, 0x10, 0x10, 0x01, 0x10, 0x10, 0x10, 0x01};
-    const vector unsigned char extractPermInc = (vector unsigned char)
-        {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
-         0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01};
-    const vector unsigned char identity = vec_lvsl(0,(unsigned char *)0);
-    const vector unsigned char tenRight = (vector unsigned char)
-        {0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-    const vector unsigned char eightLeft = (vector unsigned char)
-        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08};
-
-
-#define F_INIT(i)                                       \
-    vector unsigned char tenRightM##i = tenRight;       \
-    vector unsigned char permA1M##i = permA1;           \
-    vector unsigned char permA2M##i = permA2;           \
-    vector unsigned char extractPermM##i = extractPerm
-
-#define F2(i, j, k, l)                                                  \
-    if (S[i] & (1 << (l+1))) {                                          \
-        const vector unsigned char a_##j##_A##l =                       \
-            vec_perm(src##i, src##j, permA1M##i);                       \
-        const vector unsigned char a_##j##_B##l =                       \
-            vec_perm(a_##j##_A##l, src##k, permA2M##i);                 \
-        const vector signed int a_##j##_sump##l =                       \
-            (vector signed int)vec_msum(a_##j##_B##l, magic,            \
-                                        (vector unsigned int)zero);     \
-        vector signed int F_##j##_##l =                                 \
-            vec_sr(vec_sums(a_##j##_sump##l, vsint32_8), vuint32_4);    \
-        F_##j##_##l = vec_splat(F_##j##_##l, 3);                        \
-        const vector signed int p_##j##_##l =                           \
-            (vector signed int)vec_perm(src##j,                         \
-                                        (vector unsigned char)zero,     \
-                                        extractPermM##i);               \
-        const vector signed int sum_##j##_##l  = vec_add( p_##j##_##l, vQP2);\
-        const vector signed int diff_##j##_##l = vec_sub( p_##j##_##l, vQP2);\
-        vector signed int newpm_##j##_##l;                              \
-        if (vec_all_lt(sum_##j##_##l, F_##j##_##l))                     \
-            newpm_##j##_##l = sum_##j##_##l;                            \
-        else if (vec_all_gt(diff_##j##_##l, F_##j##_##l))               \
-            newpm_##j##_##l = diff_##j##_##l;                           \
-        else newpm_##j##_##l = F_##j##_##l;                             \
-        const vector unsigned char newpm2_##j##_##l =                   \
-            vec_splat((vector unsigned char)newpm_##j##_##l, 15);       \
-        const vector unsigned char mask##j##l = vec_add(identity,       \
-                                                        tenRightM##i);  \
-        src##j = vec_perm(src##j, newpm2_##j##_##l, mask##j##l);        \
-    }                                                                   \
-    permA1M##i = vec_add(permA1M##i, permA1inc);                        \
-    permA2M##i = vec_add(permA2M##i, permA2inc);                        \
-    tenRightM##i = vec_sro(tenRightM##i, eightLeft);                    \
-    extractPermM##i = vec_add(extractPermM##i, extractPermInc)
-
-#define ITER(i, j, k)                           \
-    F_INIT(i);                                  \
-    F2(i, j, k, 0);                             \
-    F2(i, j, k, 1);                             \
-    F2(i, j, k, 2);                             \
-    F2(i, j, k, 3);                             \
-    F2(i, j, k, 4);                             \
-    F2(i, j, k, 5);                             \
-    F2(i, j, k, 6);                             \
-    F2(i, j, k, 7)
-
-    ITER(0, 1, 2);
-    ITER(1, 2, 3);
-    ITER(2, 3, 4);
-    ITER(3, 4, 5);
-    ITER(4, 5, 6);
-    ITER(5, 6, 7);
-    ITER(6, 7, 8);
-    ITER(7, 8, 9);
-
-    const vector signed char neg1 = vec_splat_s8(-1);
-
-#define STORE_LINE(i)                                   \
-    const vector unsigned char permST##i =              \
-        vec_lvsr(i * stride, srcCopy);                  \
-    const vector unsigned char maskST##i =              \
-        vec_perm((vector unsigned char)zero,            \
-                 (vector unsigned char)neg1, permST##i);\
-    src##i = vec_perm(src##i ,src##i, permST##i);       \
-    sA##i= vec_sel(sA##i, src##i, maskST##i);           \
-    sB##i= vec_sel(src##i, sB##i, maskST##i);           \
-    vec_st(sA##i, i * stride, srcCopy);                 \
-    vec_st(sB##i, i * stride + 16, srcCopy)
-
-    STORE_LINE(1);
-    STORE_LINE(2);
-    STORE_LINE(3);
-    STORE_LINE(4);
-    STORE_LINE(5);
-    STORE_LINE(6);
-    STORE_LINE(7);
-    STORE_LINE(8);
-
-#undef STORE_LINE
-#undef ITER
-#undef F2
-}
-
-#define doHorizLowPass_altivec(a...) doHorizLowPass_C(a)
-#define doHorizDefFilter_altivec(a...) doHorizDefFilter_C(a)
-#define do_a_deblock_altivec(a...) do_a_deblock_C(a)
-
-static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
-                                            uint8_t *tempBlurred, uint32_t *tempBlurredPast, int *maxNoise)
-{
-    const vector signed int zero = vec_splat_s32(0);
-    const vector signed short vsint16_1 = vec_splat_s16(1);
-    vector signed int v_dp = zero;
-    vector signed int v_sysdp = zero;
-    int d, sysd, i;
-
-    tempBlurredPast[127]= maxNoise[0];
-    tempBlurredPast[128]= maxNoise[1];
-    tempBlurredPast[129]= maxNoise[2];
-
-#define LOAD_LINE(src, i)                                               \
-    register int j##src##i = i * stride;                                \
-    vector unsigned char perm##src##i = vec_lvsl(j##src##i, src);       \
-    const vector unsigned char v_##src##A1##i = vec_ld(j##src##i, src); \
-    const vector unsigned char v_##src##A2##i = vec_ld(j##src##i + 16, src); \
-    const vector unsigned char v_##src##A##i =                          \
-        vec_perm(v_##src##A1##i, v_##src##A2##i, perm##src##i);         \
-    vector signed short v_##src##Ass##i =                               \
-        (vector signed short)vec_mergeh((vector signed char)zero,       \
-                                        (vector signed char)v_##src##A##i)
-
-    LOAD_LINE(src, 0);
-    LOAD_LINE(src, 1);
-    LOAD_LINE(src, 2);
-    LOAD_LINE(src, 3);
-    LOAD_LINE(src, 4);
-    LOAD_LINE(src, 5);
-    LOAD_LINE(src, 6);
-    LOAD_LINE(src, 7);
-
-    LOAD_LINE(tempBlurred, 0);
-    LOAD_LINE(tempBlurred, 1);
-    LOAD_LINE(tempBlurred, 2);
-    LOAD_LINE(tempBlurred, 3);
-    LOAD_LINE(tempBlurred, 4);
-    LOAD_LINE(tempBlurred, 5);
-    LOAD_LINE(tempBlurred, 6);
-    LOAD_LINE(tempBlurred, 7);
-#undef LOAD_LINE
-
-#define ACCUMULATE_DIFFS(i)                                     \
-    vector signed short v_d##i = vec_sub(v_tempBlurredAss##i,   \
-                                         v_srcAss##i);          \
-    v_dp = vec_msums(v_d##i, v_d##i, v_dp);                     \
-    v_sysdp = vec_msums(v_d##i, vsint16_1, v_sysdp)
-
-    ACCUMULATE_DIFFS(0);
-    ACCUMULATE_DIFFS(1);
-    ACCUMULATE_DIFFS(2);
-    ACCUMULATE_DIFFS(3);
-    ACCUMULATE_DIFFS(4);
-    ACCUMULATE_DIFFS(5);
-    ACCUMULATE_DIFFS(6);
-    ACCUMULATE_DIFFS(7);
-#undef ACCUMULATE_DIFFS
-
-    v_dp = vec_sums(v_dp, zero);
-    v_sysdp = vec_sums(v_sysdp, zero);
-
-    v_dp = vec_splat(v_dp, 3);
-    v_sysdp = vec_splat(v_sysdp, 3);
-
-    vec_ste(v_dp, 0, &d);
-    vec_ste(v_sysdp, 0, &sysd);
-
-    i = d;
-    d = (4*d
-         +(*(tempBlurredPast-256))
-         +(*(tempBlurredPast-1))+ (*(tempBlurredPast+1))
-         +(*(tempBlurredPast+256))
-         +4)>>3;
-
-    *tempBlurredPast=i;
-
-    if (d > maxNoise[1]) {
-        if (d < maxNoise[2]) {
-#define OP(i) v_tempBlurredAss##i = vec_avg(v_tempBlurredAss##i, v_srcAss##i);
-
-            OP(0);
-            OP(1);
-            OP(2);
-            OP(3);
-            OP(4);
-            OP(5);
-            OP(6);
-            OP(7);
-#undef OP
-        } else {
-#define OP(i) v_tempBlurredAss##i = v_srcAss##i;
-
-            OP(0);
-            OP(1);
-            OP(2);
-            OP(3);
-            OP(4);
-            OP(5);
-            OP(6);
-            OP(7);
-#undef OP
-        }
-    } else {
-        if (d < maxNoise[0]) {
-            const vector signed short vsint16_7 = vec_splat_s16(7);
-            const vector signed short vsint16_4 = vec_splat_s16(4);
-            const vector unsigned short vuint16_3 = vec_splat_u16(3);
-
-#define OP(i)                                                   \
-            const vector signed short v_temp##i =               \
-                vec_mladd(v_tempBlurredAss##i,                  \
-                          vsint16_7, v_srcAss##i);              \
-            const vector signed short v_temp2##i =              \
-                vec_add(v_temp##i, vsint16_4);                  \
-            v_tempBlurredAss##i = vec_sr(v_temp2##i, vuint16_3)
-
-            OP(0);
-            OP(1);
-            OP(2);
-            OP(3);
-            OP(4);
-            OP(5);
-            OP(6);
-            OP(7);
-#undef OP
-        } else {
-            const vector signed short vsint16_3 = vec_splat_s16(3);
-            const vector signed short vsint16_2 = vec_splat_s16(2);
-
-#define OP(i)                                                   \
-            const vector signed short v_temp##i =               \
-                vec_mladd(v_tempBlurredAss##i,                  \
-                          vsint16_3, v_srcAss##i);              \
-            const vector signed short v_temp2##i =              \
-                vec_add(v_temp##i, vsint16_2);                  \
-            v_tempBlurredAss##i = vec_sr(v_temp2##i, (vector unsigned short)vsint16_2)
-
-            OP(0);
-            OP(1);
-            OP(2);
-            OP(3);
-            OP(4);
-            OP(5);
-            OP(6);
-            OP(7);
-#undef OP
-        }
-    }
-
-    const vector signed char neg1 = vec_splat_s8(-1);
-    const vector unsigned char permHH = (const vector unsigned char){0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                                                                     0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
-
-#define PACK_AND_STORE(src, i)                                  \
-    const vector unsigned char perms##src##i =                  \
-        vec_lvsr(i * stride, src);                              \
-    const vector unsigned char vf##src##i =                     \
-        vec_packsu(v_tempBlurredAss##i, (vector signed short)zero); \
-    const vector unsigned char vg##src##i =                     \
-        vec_perm(vf##src##i, v_##src##A##i, permHH);            \
-    const vector unsigned char mask##src##i =                   \
-        vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms##src##i); \
-    const vector unsigned char vg2##src##i =                    \
-        vec_perm(vg##src##i, vg##src##i, perms##src##i);        \
-    const vector unsigned char svA##src##i =                    \
-        vec_sel(v_##src##A1##i, vg2##src##i, mask##src##i);     \
-    const vector unsigned char svB##src##i =                    \
-        vec_sel(vg2##src##i, v_##src##A2##i, mask##src##i);     \
-    vec_st(svA##src##i, i * stride, src);                       \
-    vec_st(svB##src##i, i * stride + 16, src)
-
-    PACK_AND_STORE(src, 0);
-    PACK_AND_STORE(src, 1);
-    PACK_AND_STORE(src, 2);
-    PACK_AND_STORE(src, 3);
-    PACK_AND_STORE(src, 4);
-    PACK_AND_STORE(src, 5);
-    PACK_AND_STORE(src, 6);
-    PACK_AND_STORE(src, 7);
-    PACK_AND_STORE(tempBlurred, 0);
-    PACK_AND_STORE(tempBlurred, 1);
-    PACK_AND_STORE(tempBlurred, 2);
-    PACK_AND_STORE(tempBlurred, 3);
-    PACK_AND_STORE(tempBlurred, 4);
-    PACK_AND_STORE(tempBlurred, 5);
-    PACK_AND_STORE(tempBlurred, 6);
-    PACK_AND_STORE(tempBlurred, 7);
-#undef PACK_AND_STORE
-}
-
-static inline void transpose_16x8_char_toPackedAlign_altivec(unsigned char* dst, unsigned char* src, int stride) {
-    const vector unsigned char zero = vec_splat_u8(0);
-
-#define LOAD_DOUBLE_LINE(i, j)                                          \
-    vector unsigned char perm1##i = vec_lvsl(i * stride, src);          \
-    vector unsigned char perm2##i = vec_lvsl(j * stride, src);          \
-    vector unsigned char srcA##i = vec_ld(i * stride, src);             \
-    vector unsigned char srcB##i = vec_ld(i * stride + 16, src);        \
-    vector unsigned char srcC##i = vec_ld(j * stride, src);             \
-    vector unsigned char srcD##i = vec_ld(j * stride+ 16, src);         \
-    vector unsigned char src##i = vec_perm(srcA##i, srcB##i, perm1##i); \
-    vector unsigned char src##j = vec_perm(srcC##i, srcD##i, perm2##i)
-
-    LOAD_DOUBLE_LINE(0, 1);
-    LOAD_DOUBLE_LINE(2, 3);
-    LOAD_DOUBLE_LINE(4, 5);
-    LOAD_DOUBLE_LINE(6, 7);
-#undef LOAD_DOUBLE_LINE
-
-    vector unsigned char tempA = vec_mergeh(src0, zero);
-    vector unsigned char tempB = vec_mergel(src0, zero);
-    vector unsigned char tempC = vec_mergeh(src1, zero);
-    vector unsigned char tempD = vec_mergel(src1, zero);
-    vector unsigned char tempE = vec_mergeh(src2, zero);
-    vector unsigned char tempF = vec_mergel(src2, zero);
-    vector unsigned char tempG = vec_mergeh(src3, zero);
-    vector unsigned char tempH = vec_mergel(src3, zero);
-    vector unsigned char tempI = vec_mergeh(src4, zero);
-    vector unsigned char tempJ = vec_mergel(src4, zero);
-    vector unsigned char tempK = vec_mergeh(src5, zero);
-    vector unsigned char tempL = vec_mergel(src5, zero);
-    vector unsigned char tempM = vec_mergeh(src6, zero);
-    vector unsigned char tempN = vec_mergel(src6, zero);
-    vector unsigned char tempO = vec_mergeh(src7, zero);
-    vector unsigned char tempP = vec_mergel(src7, zero);
-
-    vector unsigned char temp0  = vec_mergeh(tempA, tempI);
-    vector unsigned char temp1  = vec_mergel(tempA, tempI);
-    vector unsigned char temp2  = vec_mergeh(tempB, tempJ);
-    vector unsigned char temp3  = vec_mergel(tempB, tempJ);
-    vector unsigned char temp4  = vec_mergeh(tempC, tempK);
-    vector unsigned char temp5  = vec_mergel(tempC, tempK);
-    vector unsigned char temp6  = vec_mergeh(tempD, tempL);
-    vector unsigned char temp7  = vec_mergel(tempD, tempL);
-    vector unsigned char temp8  = vec_mergeh(tempE, tempM);
-    vector unsigned char temp9  = vec_mergel(tempE, tempM);
-    vector unsigned char temp10 = vec_mergeh(tempF, tempN);
-    vector unsigned char temp11 = vec_mergel(tempF, tempN);
-    vector unsigned char temp12 = vec_mergeh(tempG, tempO);
-    vector unsigned char temp13 = vec_mergel(tempG, tempO);
-    vector unsigned char temp14 = vec_mergeh(tempH, tempP);
-    vector unsigned char temp15 = vec_mergel(tempH, tempP);
-
-    tempA = vec_mergeh(temp0, temp8);
-    tempB = vec_mergel(temp0, temp8);
-    tempC = vec_mergeh(temp1, temp9);
-    tempD = vec_mergel(temp1, temp9);
-    tempE = vec_mergeh(temp2, temp10);
-    tempF = vec_mergel(temp2, temp10);
-    tempG = vec_mergeh(temp3, temp11);
-    tempH = vec_mergel(temp3, temp11);
-    tempI = vec_mergeh(temp4, temp12);
-    tempJ = vec_mergel(temp4, temp12);
-    tempK = vec_mergeh(temp5, temp13);
-    tempL = vec_mergel(temp5, temp13);
-    tempM = vec_mergeh(temp6, temp14);
-    tempN = vec_mergel(temp6, temp14);
-    tempO = vec_mergeh(temp7, temp15);
-    tempP = vec_mergel(temp7, temp15);
-
-    temp0  = vec_mergeh(tempA, tempI);
-    temp1  = vec_mergel(tempA, tempI);
-    temp2  = vec_mergeh(tempB, tempJ);
-    temp3  = vec_mergel(tempB, tempJ);
-    temp4  = vec_mergeh(tempC, tempK);
-    temp5  = vec_mergel(tempC, tempK);
-    temp6  = vec_mergeh(tempD, tempL);
-    temp7  = vec_mergel(tempD, tempL);
-    temp8  = vec_mergeh(tempE, tempM);
-    temp9  = vec_mergel(tempE, tempM);
-    temp10 = vec_mergeh(tempF, tempN);
-    temp11 = vec_mergel(tempF, tempN);
-    temp12 = vec_mergeh(tempG, tempO);
-    temp13 = vec_mergel(tempG, tempO);
-    temp14 = vec_mergeh(tempH, tempP);
-    temp15 = vec_mergel(tempH, tempP);
-
-    vec_st(temp0,    0, dst);
-    vec_st(temp1,   16, dst);
-    vec_st(temp2,   32, dst);
-    vec_st(temp3,   48, dst);
-    vec_st(temp4,   64, dst);
-    vec_st(temp5,   80, dst);
-    vec_st(temp6,   96, dst);
-    vec_st(temp7,  112, dst);
-    vec_st(temp8,  128, dst);
-    vec_st(temp9,  144, dst);
-    vec_st(temp10, 160, dst);
-    vec_st(temp11, 176, dst);
-    vec_st(temp12, 192, dst);
-    vec_st(temp13, 208, dst);
-    vec_st(temp14, 224, dst);
-    vec_st(temp15, 240, dst);
-}
-
-static inline void transpose_8x16_char_fromPackedAlign_altivec(unsigned char* dst, unsigned char* src, int stride) {
-    const vector unsigned char zero = vec_splat_u8(0);
-
-#define LOAD_DOUBLE_LINE(i, j)                                  \
-    vector unsigned char src##i = vec_ld(i * 16, src);            \
-    vector unsigned char src##j = vec_ld(j * 16, src)
-
-    LOAD_DOUBLE_LINE(0, 1);
-    LOAD_DOUBLE_LINE(2, 3);
-    LOAD_DOUBLE_LINE(4, 5);
-    LOAD_DOUBLE_LINE(6, 7);
-    LOAD_DOUBLE_LINE(8, 9);
-    LOAD_DOUBLE_LINE(10, 11);
-    LOAD_DOUBLE_LINE(12, 13);
-    LOAD_DOUBLE_LINE(14, 15);
-#undef LOAD_DOUBLE_LINE
-
-    vector unsigned char tempA = vec_mergeh(src0, src8);
-    vector unsigned char tempB;
-    vector unsigned char tempC = vec_mergeh(src1, src9);
-    vector unsigned char tempD;
-    vector unsigned char tempE = vec_mergeh(src2, src10);
-    vector unsigned char tempG = vec_mergeh(src3, src11);
-    vector unsigned char tempI = vec_mergeh(src4, src12);
-    vector unsigned char tempJ;
-    vector unsigned char tempK = vec_mergeh(src5, src13);
-    vector unsigned char tempL;
-    vector unsigned char tempM = vec_mergeh(src6, src14);
-    vector unsigned char tempO = vec_mergeh(src7, src15);
-
-    vector unsigned char temp0 = vec_mergeh(tempA, tempI);
-    vector unsigned char temp1 = vec_mergel(tempA, tempI);
-    vector unsigned char temp2;
-    vector unsigned char temp3;
-    vector unsigned char temp4 = vec_mergeh(tempC, tempK);
-    vector unsigned char temp5 = vec_mergel(tempC, tempK);
-    vector unsigned char temp6;
-    vector unsigned char temp7;
-    vector unsigned char temp8 = vec_mergeh(tempE, tempM);
-    vector unsigned char temp9 = vec_mergel(tempE, tempM);
-    vector unsigned char temp12 = vec_mergeh(tempG, tempO);
-    vector unsigned char temp13 = vec_mergel(tempG, tempO);
-
-    tempA = vec_mergeh(temp0, temp8);
-    tempB = vec_mergel(temp0, temp8);
-    tempC = vec_mergeh(temp1, temp9);
-    tempD = vec_mergel(temp1, temp9);
-    tempI = vec_mergeh(temp4, temp12);
-    tempJ = vec_mergel(temp4, temp12);
-    tempK = vec_mergeh(temp5, temp13);
-    tempL = vec_mergel(temp5, temp13);
-
-    temp0 = vec_mergeh(tempA, tempI);
-    temp1 = vec_mergel(tempA, tempI);
-    temp2 = vec_mergeh(tempB, tempJ);
-    temp3 = vec_mergel(tempB, tempJ);
-    temp4 = vec_mergeh(tempC, tempK);
-    temp5 = vec_mergel(tempC, tempK);
-    temp6 = vec_mergeh(tempD, tempL);
-    temp7 = vec_mergel(tempD, tempL);
-
-
-    const vector signed char neg1 = vec_splat_s8(-1);
-#define STORE_DOUBLE_LINE(i, j)                                         \
-    vector unsigned char dstA##i = vec_ld(i * stride, dst);             \
-    vector unsigned char dstB##i = vec_ld(i * stride + 16, dst);        \
-    vector unsigned char dstA##j = vec_ld(j * stride, dst);             \
-    vector unsigned char dstB##j = vec_ld(j * stride+ 16, dst);         \
-    vector unsigned char align##i = vec_lvsr(i * stride, dst);          \
-    vector unsigned char align##j = vec_lvsr(j * stride, dst);          \
-    vector unsigned char mask##i = vec_perm(zero, (vector unsigned char)neg1, align##i); \
-    vector unsigned char mask##j = vec_perm(zero, (vector unsigned char)neg1, align##j); \
-    vector unsigned char dstR##i = vec_perm(temp##i, temp##i, align##i);\
-    vector unsigned char dstR##j = vec_perm(temp##j, temp##j, align##j);\
-    vector unsigned char dstAF##i = vec_sel(dstA##i, dstR##i, mask##i); \
-    vector unsigned char dstBF##i = vec_sel(dstR##i, dstB##i, mask##i); \
-    vector unsigned char dstAF##j = vec_sel(dstA##j, dstR##j, mask##j); \
-    vector unsigned char dstBF##j = vec_sel(dstR##j, dstB##j, mask##j); \
-    vec_st(dstAF##i, i * stride, dst);                                  \
-    vec_st(dstBF##i, i * stride + 16, dst);                             \
-    vec_st(dstAF##j, j * stride, dst);                                  \
-    vec_st(dstBF##j, j * stride + 16, dst)
-
-    STORE_DOUBLE_LINE(0,1);
-    STORE_DOUBLE_LINE(2,3);
-    STORE_DOUBLE_LINE(4,5);
-    STORE_DOUBLE_LINE(6,7);
-}
diff --git a/libpostproc/postprocess_internal.h b/libpostproc/postprocess_internal.h
deleted file mode 100644
index 3bc51c4..0000000
--- a/libpostproc/postprocess_internal.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2001-2002 Michael Niedermayer (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * internal api header.
- */
-
-#ifndef POSTPROC_POSTPROCESS_INTERNAL_H
-#define POSTPROC_POSTPROCESS_INTERNAL_H
-
-#include <string.h>
-#include "libavutil/avutil.h"
-#include "postprocess.h"
-
-#define V_DEBLOCK       0x01
-#define H_DEBLOCK       0x02
-#define DERING          0x04
-#define LEVEL_FIX       0x08 ///< Brightness & Contrast
-
-#define LUM_V_DEBLOCK   V_DEBLOCK               //   1
-#define LUM_H_DEBLOCK   H_DEBLOCK               //   2
-#define CHROM_V_DEBLOCK (V_DEBLOCK<<4)          //  16
-#define CHROM_H_DEBLOCK (H_DEBLOCK<<4)          //  32
-#define LUM_DERING      DERING                  //   4
-#define CHROM_DERING    (DERING<<4)             //  64
-#define LUM_LEVEL_FIX   LEVEL_FIX               //   8
-#define CHROM_LEVEL_FIX (LEVEL_FIX<<4)          // 128 (not implemented yet)
-
-// Experimental vertical filters
-#define V_X1_FILTER     0x0200                  // 512
-#define V_A_DEBLOCK     0x0400
-
-// Experimental horizontal filters
-#define H_X1_FILTER     0x2000                  // 8192
-#define H_A_DEBLOCK     0x4000
-
-/// select between full y range (255-0) or standart one (234-16)
-#define FULL_Y_RANGE    0x8000                  // 32768
-
-//Deinterlacing Filters
-#define LINEAR_IPOL_DEINT_FILTER        0x10000 // 65536
-#define LINEAR_BLEND_DEINT_FILTER       0x20000 // 131072
-#define CUBIC_BLEND_DEINT_FILTER        0x8000  // (not implemented yet)
-#define CUBIC_IPOL_DEINT_FILTER         0x40000 // 262144
-#define MEDIAN_DEINT_FILTER             0x80000 // 524288
-#define FFMPEG_DEINT_FILTER             0x400000
-#define LOWPASS5_DEINT_FILTER           0x800000
-
-#define TEMP_NOISE_FILTER               0x100000
-#define FORCE_QUANT                     0x200000
-
-//use if you want a faster postprocessing code
-//cannot differentiate between chroma & luma filters (both on or both off)
-//obviously the -pp option on the command line has no effect except turning the here selected
-//filters on
-//#define COMPILE_TIME_MODE 0x77
-
-static inline int CLIP(int a){
-    if(a&256) return ((a)>>31)^(-1);
-    else      return a;
-}
-/**
- * Postprocessng filter.
- */
-struct PPFilter{
-    const char *shortName;
-    const char *longName;
-    int chromDefault;       ///< is chrominance filtering on by default if this filter is manually activated
-    int minLumQuality;      ///< minimum quality to turn luminance filtering on
-    int minChromQuality;    ///< minimum quality to turn chrominance filtering on
-    int mask;               ///< Bitmask to turn this filter on
-};
-
-/**
- * Postprocessng mode.
- */
-typedef struct PPMode{
-    int lumMode;                    ///< acivates filters for luminance
-    int chromMode;                  ///< acivates filters for chrominance
-    int error;                      ///< non zero on error
-
-    int minAllowedY;                ///< for brigtness correction
-    int maxAllowedY;                ///< for brihtness correction
-    float maxClippedThreshold;      ///< amount of "black" u r willing to loose to get a brightness corrected picture
-
-    int maxTmpNoise[3];             ///< for Temporal Noise Reducing filter (Maximal sum of abs differences)
-
-    int baseDcDiff;
-    int flatnessThreshold;
-
-    int forcedQuant;                ///< quantizer if FORCE_QUANT is used
-} PPMode;
-
-/**
- * postprocess context.
- */
-typedef struct PPContext{
-    /**
-     * info on struct for av_log
-     */
-    const AVClass *av_class;
-
-    uint8_t *tempBlocks; ///<used for the horizontal code
-
-    /**
-     * luma histogram.
-     * we need 64bit here otherwise we'll going to have a problem
-     * after watching a black picture for 5 hours
-     */
-    uint64_t *yHistogram;
-
-    DECLARE_ALIGNED(8, uint64_t, packedYOffset);
-    DECLARE_ALIGNED(8, uint64_t, packedYScale);
-
-    /** Temporal noise reducing buffers */
-    uint8_t *tempBlurred[3];
-    int32_t *tempBlurredPast[3];
-
-    /** Temporary buffers for handling the last row(s) */
-    uint8_t *tempDst;
-    uint8_t *tempSrc;
-
-    uint8_t *deintTemp;
-
-    DECLARE_ALIGNED(8, uint64_t, pQPb);
-    DECLARE_ALIGNED(8, uint64_t, pQPb2);
-
-    DECLARE_ALIGNED(8, uint64_t, mmxDcOffset)[64];
-    DECLARE_ALIGNED(8, uint64_t, mmxDcThreshold)[64];
-
-    QP_STORE_T *stdQPTable;       ///< used to fix MPEG2 style qscale
-    QP_STORE_T *nonBQPTable;
-    QP_STORE_T *forcedQPTable;
-
-    int QP;
-    int nonBQP;
-
-    int frameNum;
-
-    int cpuCaps;
-
-    int qpStride; ///<size of qp buffers (needed to realloc them if needed)
-    int stride;   ///<size of some buffers (needed to realloc them if needed)
-
-    int hChromaSubSample;
-    int vChromaSubSample;
-
-    PPMode ppMode;
-} PPContext;
-
-
-static inline void linecpy(void *dest, const void *src, int lines, int stride) {
-    if (stride > 0) {
-        memcpy(dest, src, lines*stride);
-    } else {
-        memcpy((uint8_t*)dest+(lines-1)*stride, (const uint8_t*)src+(lines-1)*stride, -lines*stride);
-    }
-}
-
-#endif /* POSTPROC_POSTPROCESS_INTERNAL_H */
diff --git a/libpostproc/postprocess_template.c b/libpostproc/postprocess_template.c
deleted file mode 100644
index 637ebc6..0000000
--- a/libpostproc/postprocess_template.c
+++ /dev/null
@@ -1,3632 +0,0 @@
-/*
- * Copyright (C) 2001-2002 Michael Niedermayer (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * mmx/mmx2/3dnow postprocess code.
- */
-
-#include "libavutil/x86_cpu.h"
-
-#define ALIGN_MASK "$-8"
-
-#undef REAL_PAVGB
-#undef PAVGB
-#undef PMINUB
-#undef PMAXUB
-
-#if   HAVE_MMX2
-#define REAL_PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
-#elif HAVE_AMD3DNOW
-#define REAL_PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
-#endif
-#define PAVGB(a,b)  REAL_PAVGB(a,b)
-
-#if   HAVE_MMX2
-#define PMINUB(a,b,t) "pminub " #a ", " #b " \n\t"
-#elif HAVE_MMX
-#define PMINUB(b,a,t) \
-    "movq " #a ", " #t " \n\t"\
-    "psubusb " #b ", " #t " \n\t"\
-    "psubb " #t ", " #a " \n\t"
-#endif
-
-#if   HAVE_MMX2
-#define PMAXUB(a,b) "pmaxub " #a ", " #b " \n\t"
-#elif HAVE_MMX
-#define PMAXUB(a,b) \
-    "psubusb " #a ", " #b " \n\t"\
-    "paddb " #a ", " #b " \n\t"
-#endif
-
-//FIXME? |255-0| = 1 (should not be a problem ...)
-#if HAVE_MMX
-/**
- * Check if the middle 8x8 Block in the given 8x16 block is flat
- */
-static inline int RENAME(vertClassify)(uint8_t src[], int stride, PPContext *c){
-    int numEq= 0, dcOk;
-    src+= stride*4; // src points to begin of the 8x8 Block
-    __asm__ volatile(
-        "movq %0, %%mm7                         \n\t"
-        "movq %1, %%mm6                         \n\t"
-        : : "m" (c->mmxDcOffset[c->nonBQP]),  "m" (c->mmxDcThreshold[c->nonBQP])
-        );
-
-    __asm__ volatile(
-        "lea (%2, %3), %%"REG_a"                \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %1      eax     eax+%2  eax+2%2 %1+4%2  ecx     ecx+%2  ecx+2%2 %1+8%2  ecx+4%2
-
-        "movq (%2), %%mm0                       \n\t"
-        "movq (%%"REG_a"), %%mm1                \n\t"
-        "movq %%mm0, %%mm3                      \n\t"
-        "movq %%mm0, %%mm4                      \n\t"
-        PMAXUB(%%mm1, %%mm4)
-        PMINUB(%%mm1, %%mm3, %%mm5)
-        "psubb %%mm1, %%mm0                     \n\t" // mm0 = differnece
-        "paddb %%mm7, %%mm0                     \n\t"
-        "pcmpgtb %%mm6, %%mm0                   \n\t"
-
-        "movq (%%"REG_a",%3), %%mm2             \n\t"
-        PMAXUB(%%mm2, %%mm4)
-        PMINUB(%%mm2, %%mm3, %%mm5)
-        "psubb %%mm2, %%mm1                     \n\t"
-        "paddb %%mm7, %%mm1                     \n\t"
-        "pcmpgtb %%mm6, %%mm1                   \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-
-        "movq (%%"REG_a", %3, 2), %%mm1         \n\t"
-        PMAXUB(%%mm1, %%mm4)
-        PMINUB(%%mm1, %%mm3, %%mm5)
-        "psubb %%mm1, %%mm2                     \n\t"
-        "paddb %%mm7, %%mm2                     \n\t"
-        "pcmpgtb %%mm6, %%mm2                   \n\t"
-        "paddb %%mm2, %%mm0                     \n\t"
-
-        "lea (%%"REG_a", %3, 4), %%"REG_a"      \n\t"
-
-        "movq (%2, %3, 4), %%mm2                \n\t"
-        PMAXUB(%%mm2, %%mm4)
-        PMINUB(%%mm2, %%mm3, %%mm5)
-        "psubb %%mm2, %%mm1                     \n\t"
-        "paddb %%mm7, %%mm1                     \n\t"
-        "pcmpgtb %%mm6, %%mm1                   \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-
-        "movq (%%"REG_a"), %%mm1                \n\t"
-        PMAXUB(%%mm1, %%mm4)
-        PMINUB(%%mm1, %%mm3, %%mm5)
-        "psubb %%mm1, %%mm2                     \n\t"
-        "paddb %%mm7, %%mm2                     \n\t"
-        "pcmpgtb %%mm6, %%mm2                   \n\t"
-        "paddb %%mm2, %%mm0                     \n\t"
-
-        "movq (%%"REG_a", %3), %%mm2            \n\t"
-        PMAXUB(%%mm2, %%mm4)
-        PMINUB(%%mm2, %%mm3, %%mm5)
-        "psubb %%mm2, %%mm1                     \n\t"
-        "paddb %%mm7, %%mm1                     \n\t"
-        "pcmpgtb %%mm6, %%mm1                   \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-
-        "movq (%%"REG_a", %3, 2), %%mm1         \n\t"
-        PMAXUB(%%mm1, %%mm4)
-        PMINUB(%%mm1, %%mm3, %%mm5)
-        "psubb %%mm1, %%mm2                     \n\t"
-        "paddb %%mm7, %%mm2                     \n\t"
-        "pcmpgtb %%mm6, %%mm2                   \n\t"
-        "paddb %%mm2, %%mm0                     \n\t"
-        "psubusb %%mm3, %%mm4                   \n\t"
-
-        "                                       \n\t"
-#if HAVE_MMX2
-        "pxor %%mm7, %%mm7                      \n\t"
-        "psadbw %%mm7, %%mm0                    \n\t"
-#else
-        "movq %%mm0, %%mm1                      \n\t"
-        "psrlw $8, %%mm0                        \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-        "movq %%mm0, %%mm1                      \n\t"
-        "psrlq $16, %%mm0                       \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-        "movq %%mm0, %%mm1                      \n\t"
-        "psrlq $32, %%mm0                       \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-#endif
-        "movq %4, %%mm7                         \n\t" // QP,..., QP
-        "paddusb %%mm7, %%mm7                   \n\t" // 2QP ... 2QP
-        "psubusb %%mm7, %%mm4                   \n\t" // Diff <= 2QP -> 0
-        "packssdw %%mm4, %%mm4                  \n\t"
-        "movd %%mm0, %0                         \n\t"
-        "movd %%mm4, %1                         \n\t"
-
-        : "=r" (numEq), "=r" (dcOk)
-        : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb)
-        : "%"REG_a
-        );
-
-    numEq= (-numEq) &0xFF;
-    if(numEq > c->ppMode.flatnessThreshold){
-        if(dcOk) return 0;
-        else     return 1;
-    }else{
-        return 2;
-    }
-}
-#endif //HAVE_MMX
-
-/**
- * Do a vertical low pass filter on the 8x16 block (only write to the 8x8 block in the middle)
- * using the 9-Tap Filter (1,1,2,2,4,2,2,1,1)/16
- */
-#if !HAVE_ALTIVEC
-static inline void RENAME(doVertLowPass)(uint8_t *src, int stride, PPContext *c)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    src+= stride*3;
-    __asm__ volatile(        //"movv %0 %1 %2\n\t"
-        "movq %2, %%mm0                         \n\t"  // QP,..., QP
-        "pxor %%mm4, %%mm4                      \n\t"
-
-        "movq (%0), %%mm6                       \n\t"
-        "movq (%0, %1), %%mm5                   \n\t"
-        "movq %%mm5, %%mm1                      \n\t"
-        "movq %%mm6, %%mm2                      \n\t"
-        "psubusb %%mm6, %%mm5                   \n\t"
-        "psubusb %%mm1, %%mm2                   \n\t"
-        "por %%mm5, %%mm2                       \n\t" // ABS Diff of lines
-        "psubusb %%mm0, %%mm2                   \n\t" // diff <= QP -> 0
-        "pcmpeqb %%mm4, %%mm2                   \n\t" // diff <= QP -> FF
-
-        "pand %%mm2, %%mm6                      \n\t"
-        "pandn %%mm1, %%mm2                     \n\t"
-        "por %%mm2, %%mm6                       \n\t"// First Line to Filter
-
-        "movq (%0, %1, 8), %%mm5                \n\t"
-        "lea (%0, %1, 4), %%"REG_a"             \n\t"
-        "lea (%0, %1, 8), %%"REG_c"             \n\t"
-        "sub %1, %%"REG_c"                      \n\t"
-        "add %1, %0                             \n\t" // %0 points to line 1 not 0
-        "movq (%0, %1, 8), %%mm7                \n\t"
-        "movq %%mm5, %%mm1                      \n\t"
-        "movq %%mm7, %%mm2                      \n\t"
-        "psubusb %%mm7, %%mm5                   \n\t"
-        "psubusb %%mm1, %%mm2                   \n\t"
-        "por %%mm5, %%mm2                       \n\t" // ABS Diff of lines
-        "psubusb %%mm0, %%mm2                   \n\t" // diff <= QP -> 0
-        "pcmpeqb %%mm4, %%mm2                   \n\t" // diff <= QP -> FF
-
-        "pand %%mm2, %%mm7                      \n\t"
-        "pandn %%mm1, %%mm2                     \n\t"
-        "por %%mm2, %%mm7                       \n\t" // First Line to Filter
-
-
-        //      1       2       3       4       5       6       7       8
-        //      %0      %0+%1   %0+2%1  eax     %0+4%1  eax+2%1 ecx     eax+4%1
-        // 6 4 2 2 1 1
-        // 6 4 4 2
-        // 6 8 2
-
-        "movq (%0, %1), %%mm0                   \n\t" //  1
-        "movq %%mm0, %%mm1                      \n\t" //  1
-        PAVGB(%%mm6, %%mm0)                           //1 1        /2
-        PAVGB(%%mm6, %%mm0)                           //3 1        /4
-
-        "movq (%0, %1, 4), %%mm2                \n\t" //     1
-        "movq %%mm2, %%mm5                      \n\t" //     1
-        PAVGB((%%REGa), %%mm2)                        //    11        /2
-        PAVGB((%0, %1, 2), %%mm2)                     //   211        /4
-        "movq %%mm2, %%mm3                      \n\t" //   211        /4
-        "movq (%0), %%mm4                       \n\t" // 1
-        PAVGB(%%mm4, %%mm3)                           // 4 211        /8
-        PAVGB(%%mm0, %%mm3)                           //642211        /16
-        "movq %%mm3, (%0)                       \n\t" // X
-        // mm1=2 mm2=3(211) mm4=1 mm5=5 mm6=0 mm7=9
-        "movq %%mm1, %%mm0                      \n\t" //  1
-        PAVGB(%%mm6, %%mm0)                           //1 1        /2
-        "movq %%mm4, %%mm3                      \n\t" // 1
-        PAVGB((%0,%1,2), %%mm3)                       // 1 1        /2
-        PAVGB((%%REGa,%1,2), %%mm5)                   //     11        /2
-        PAVGB((%%REGa), %%mm5)                        //    211 /4
-        PAVGB(%%mm5, %%mm3)                           // 2 2211 /8
-        PAVGB(%%mm0, %%mm3)                           //4242211 /16
-        "movq %%mm3, (%0,%1)                    \n\t" //  X
-        // mm1=2 mm2=3(211) mm4=1 mm5=4(211) mm6=0 mm7=9
-        PAVGB(%%mm4, %%mm6)                                   //11        /2
-        "movq (%%"REG_c"), %%mm0                \n\t" //       1
-        PAVGB((%%REGa, %1, 2), %%mm0)                 //      11/2
-        "movq %%mm0, %%mm3                      \n\t" //      11/2
-        PAVGB(%%mm1, %%mm0)                           //  2   11/4
-        PAVGB(%%mm6, %%mm0)                           //222   11/8
-        PAVGB(%%mm2, %%mm0)                           //22242211/16
-        "movq (%0, %1, 2), %%mm2                \n\t" //   1
-        "movq %%mm0, (%0, %1, 2)                \n\t" //   X
-        // mm1=2 mm2=3 mm3=6(11) mm4=1 mm5=4(211) mm6=0(11) mm7=9
-        "movq (%%"REG_a", %1, 4), %%mm0         \n\t" //        1
-        PAVGB((%%REGc), %%mm0)                        //       11        /2
-        PAVGB(%%mm0, %%mm6)                           //11     11        /4
-        PAVGB(%%mm1, %%mm4)                           // 11                /2
-        PAVGB(%%mm2, %%mm1)                           //  11                /2
-        PAVGB(%%mm1, %%mm6)                           //1122   11        /8
-        PAVGB(%%mm5, %%mm6)                           //112242211        /16
-        "movq (%%"REG_a"), %%mm5                \n\t" //    1
-        "movq %%mm6, (%%"REG_a")                \n\t" //    X
-        // mm0=7(11) mm1=2(11) mm2=3 mm3=6(11) mm4=1(11) mm5=4 mm7=9
-        "movq (%%"REG_a", %1, 4), %%mm6         \n\t" //        1
-        PAVGB(%%mm7, %%mm6)                           //        11        /2
-        PAVGB(%%mm4, %%mm6)                           // 11     11        /4
-        PAVGB(%%mm3, %%mm6)                           // 11   2211        /8
-        PAVGB(%%mm5, %%mm2)                           //   11                /2
-        "movq (%0, %1, 4), %%mm4                \n\t" //     1
-        PAVGB(%%mm4, %%mm2)                           //   112                /4
-        PAVGB(%%mm2, %%mm6)                           // 112242211        /16
-        "movq %%mm6, (%0, %1, 4)                \n\t" //     X
-        // mm0=7(11) mm1=2(11) mm2=3(112) mm3=6(11) mm4=5 mm5=4 mm7=9
-        PAVGB(%%mm7, %%mm1)                           //  11     2        /4
-        PAVGB(%%mm4, %%mm5)                           //    11                /2
-        PAVGB(%%mm5, %%mm0)                           //    11 11        /4
-        "movq (%%"REG_a", %1, 2), %%mm6         \n\t" //      1
-        PAVGB(%%mm6, %%mm1)                           //  11  4  2        /8
-        PAVGB(%%mm0, %%mm1)                           //  11224222        /16
-        "movq %%mm1, (%%"REG_a", %1, 2)         \n\t" //      X
-        // mm2=3(112) mm3=6(11) mm4=5 mm5=4(11) mm6=6 mm7=9
-        PAVGB((%%REGc), %%mm2)                        //   112 4        /8
-        "movq (%%"REG_a", %1, 4), %%mm0         \n\t" //        1
-        PAVGB(%%mm0, %%mm6)                           //      1 1        /2
-        PAVGB(%%mm7, %%mm6)                           //      1 12        /4
-        PAVGB(%%mm2, %%mm6)                           //   1122424        /4
-        "movq %%mm6, (%%"REG_c")                \n\t" //       X
-        // mm0=8 mm3=6(11) mm4=5 mm5=4(11) mm7=9
-        PAVGB(%%mm7, %%mm5)                           //    11   2        /4
-        PAVGB(%%mm7, %%mm5)                           //    11   6        /8
-
-        PAVGB(%%mm3, %%mm0)                           //      112        /4
-        PAVGB(%%mm0, %%mm5)                           //    112246        /16
-        "movq %%mm5, (%%"REG_a", %1, 4)         \n\t" //        X
-        "sub %1, %0                             \n\t"
-
-        :
-        : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb)
-        : "%"REG_a, "%"REG_c
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-    const int l1= stride;
-    const int l2= stride + l1;
-    const int l3= stride + l2;
-    const int l4= stride + l3;
-    const int l5= stride + l4;
-    const int l6= stride + l5;
-    const int l7= stride + l6;
-    const int l8= stride + l7;
-    const int l9= stride + l8;
-    int x;
-    src+= stride*3;
-    for(x=0; x<BLOCK_SIZE; x++){
-        const int first= FFABS(src[0] - src[l1]) < c->QP ? src[0] : src[l1];
-        const int last= FFABS(src[l8] - src[l9]) < c->QP ? src[l9] : src[l8];
-
-        int sums[10];
-        sums[0] = 4*first + src[l1] + src[l2] + src[l3] + 4;
-        sums[1] = sums[0] - first  + src[l4];
-        sums[2] = sums[1] - first  + src[l5];
-        sums[3] = sums[2] - first  + src[l6];
-        sums[4] = sums[3] - first  + src[l7];
-        sums[5] = sums[4] - src[l1] + src[l8];
-        sums[6] = sums[5] - src[l2] + last;
-        sums[7] = sums[6] - src[l3] + last;
-        sums[8] = sums[7] - src[l4] + last;
-        sums[9] = sums[8] - src[l5] + last;
-
-        src[l1]= (sums[0] + sums[2] + 2*src[l1])>>4;
-        src[l2]= (sums[1] + sums[3] + 2*src[l2])>>4;
-        src[l3]= (sums[2] + sums[4] + 2*src[l3])>>4;
-        src[l4]= (sums[3] + sums[5] + 2*src[l4])>>4;
-        src[l5]= (sums[4] + sums[6] + 2*src[l5])>>4;
-        src[l6]= (sums[5] + sums[7] + 2*src[l6])>>4;
-        src[l7]= (sums[6] + sums[8] + 2*src[l7])>>4;
-        src[l8]= (sums[7] + sums[9] + 2*src[l8])>>4;
-
-        src++;
-    }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-/**
- * Experimental Filter 1
- * will not damage linear gradients
- * Flat blocks should look like they were passed through the (1,1,2,2,4,2,2,1,1) 9-Tap filter
- * can only smooth blocks at the expected locations (it cannot smooth them if they did move)
- * MMX2 version does correct clipping C version does not
- */
-static inline void RENAME(vertX1Filter)(uint8_t *src, int stride, PPContext *co)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    src+= stride*3;
-
-    __asm__ volatile(
-        "pxor %%mm7, %%mm7                      \n\t" // 0
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_c"      \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  ecx     ecx+%1  ecx+2%1 %0+8%1  ecx+4%1
-        "movq (%%"REG_a", %1, 2), %%mm0         \n\t" // line 3
-        "movq (%0, %1, 4), %%mm1                \n\t" // line 4
-        "movq %%mm1, %%mm2                      \n\t" // line 4
-        "psubusb %%mm0, %%mm1                   \n\t"
-        "psubusb %%mm2, %%mm0                   \n\t"
-        "por %%mm1, %%mm0                       \n\t" // |l2 - l3|
-        "movq (%%"REG_c"), %%mm3                \n\t" // line 5
-        "movq (%%"REG_c", %1), %%mm4            \n\t" // line 6
-        "movq %%mm3, %%mm5                      \n\t" // line 5
-        "psubusb %%mm4, %%mm3                   \n\t"
-        "psubusb %%mm5, %%mm4                   \n\t"
-        "por %%mm4, %%mm3                       \n\t" // |l5 - l6|
-        PAVGB(%%mm3, %%mm0)                           // (|l2 - l3| + |l5 - l6|)/2
-        "movq %%mm2, %%mm1                      \n\t" // line 4
-        "psubusb %%mm5, %%mm2                   \n\t"
-        "movq %%mm2, %%mm4                      \n\t"
-        "pcmpeqb %%mm7, %%mm2                   \n\t" // (l4 - l5) <= 0 ? -1 : 0
-        "psubusb %%mm1, %%mm5                   \n\t"
-        "por %%mm5, %%mm4                       \n\t" // |l4 - l5|
-        "psubusb %%mm0, %%mm4                   \n\t" //d = MAX(0, |l4-l5| - (|l2-l3| + |l5-l6|)/2)
-        "movq %%mm4, %%mm3                      \n\t" // d
-        "movq %2, %%mm0                         \n\t"
-        "paddusb %%mm0, %%mm0                   \n\t"
-        "psubusb %%mm0, %%mm4                   \n\t"
-        "pcmpeqb %%mm7, %%mm4                   \n\t" // d <= QP ? -1 : 0
-        "psubusb "MANGLE(b01)", %%mm3           \n\t"
-        "pand %%mm4, %%mm3                      \n\t" // d <= QP ? d : 0
-
-        PAVGB(%%mm7, %%mm3)                           // d/2
-        "movq %%mm3, %%mm1                      \n\t" // d/2
-        PAVGB(%%mm7, %%mm3)                           // d/4
-        PAVGB(%%mm1, %%mm3)                           // 3*d/8
-
-        "movq (%0, %1, 4), %%mm0                \n\t" // line 4
-        "pxor %%mm2, %%mm0                      \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
-        "psubusb %%mm3, %%mm0                   \n\t"
-        "pxor %%mm2, %%mm0                      \n\t"
-        "movq %%mm0, (%0, %1, 4)                \n\t" // line 4
-
-        "movq (%%"REG_c"), %%mm0                \n\t" // line 5
-        "pxor %%mm2, %%mm0                      \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
-        "paddusb %%mm3, %%mm0                   \n\t"
-        "pxor %%mm2, %%mm0                      \n\t"
-        "movq %%mm0, (%%"REG_c")                \n\t" // line 5
-
-        PAVGB(%%mm7, %%mm1)                           // d/4
-
-        "movq (%%"REG_a", %1, 2), %%mm0         \n\t" // line 3
-        "pxor %%mm2, %%mm0                      \n\t" //(l4 - l5) <= 0 ? -l4-1 : l4
-        "psubusb %%mm1, %%mm0                   \n\t"
-        "pxor %%mm2, %%mm0                      \n\t"
-        "movq %%mm0, (%%"REG_a", %1, 2)         \n\t" // line 3
-
-        "movq (%%"REG_c", %1), %%mm0            \n\t" // line 6
-        "pxor %%mm2, %%mm0                      \n\t" //(l4 - l5) <= 0 ? -l5-1 : l5
-        "paddusb %%mm1, %%mm0                   \n\t"
-        "pxor %%mm2, %%mm0                      \n\t"
-        "movq %%mm0, (%%"REG_c", %1)            \n\t" // line 6
-
-        PAVGB(%%mm7, %%mm1)                           // d/8
-
-        "movq (%%"REG_a", %1), %%mm0            \n\t" // line 2
-        "pxor %%mm2, %%mm0                      \n\t" //(l4 - l5) <= 0 ? -l2-1 : l2
-        "psubusb %%mm1, %%mm0                   \n\t"
-        "pxor %%mm2, %%mm0                      \n\t"
-        "movq %%mm0, (%%"REG_a", %1)            \n\t" // line 2
-
-        "movq (%%"REG_c", %1, 2), %%mm0         \n\t" // line 7
-        "pxor %%mm2, %%mm0                      \n\t" //(l4 - l5) <= 0 ? -l7-1 : l7
-        "paddusb %%mm1, %%mm0                   \n\t"
-        "pxor %%mm2, %%mm0                      \n\t"
-        "movq %%mm0, (%%"REG_c", %1, 2)         \n\t" // line 7
-
-        :
-        : "r" (src), "r" ((x86_reg)stride), "m" (co->pQPb)
-        : "%"REG_a, "%"REG_c
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-
-    const int l1= stride;
-    const int l2= stride + l1;
-    const int l3= stride + l2;
-    const int l4= stride + l3;
-    const int l5= stride + l4;
-    const int l6= stride + l5;
-    const int l7= stride + l6;
-//    const int l8= stride + l7;
-//    const int l9= stride + l8;
-    int x;
-
-    src+= stride*3;
-    for(x=0; x<BLOCK_SIZE; x++){
-        int a= src[l3] - src[l4];
-        int b= src[l4] - src[l5];
-        int c= src[l5] - src[l6];
-
-        int d= FFABS(b) - ((FFABS(a) + FFABS(c))>>1);
-        d= FFMAX(d, 0);
-
-        if(d < co->QP*2){
-            int v = d * FFSIGN(-b);
-
-            src[l2] +=v>>3;
-            src[l3] +=v>>2;
-            src[l4] +=(3*v)>>3;
-            src[l5] -=(3*v)>>3;
-            src[l6] -=v>>2;
-            src[l7] -=v>>3;
-        }
-        src++;
-    }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-#if !HAVE_ALTIVEC
-static inline void RENAME(doVertDefFilter)(uint8_t src[], int stride, PPContext *c)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-/*
-    uint8_t tmp[16];
-    const int l1= stride;
-    const int l2= stride + l1;
-    const int l3= stride + l2;
-    const int l4= (int)tmp - (int)src - stride*3;
-    const int l5= (int)tmp - (int)src - stride*3 + 8;
-    const int l6= stride*3 + l3;
-    const int l7= stride + l6;
-    const int l8= stride + l7;
-
-    memcpy(tmp, src+stride*7, 8);
-    memcpy(tmp+8, src+stride*8, 8);
-*/
-    src+= stride*4;
-    __asm__ volatile(
-
-#if 0 //slightly more accurate and slightly slower
-        "pxor %%mm7, %%mm7                      \n\t" // 0
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_c"      \n\t"
-//      0       1       2       3       4       5       6       7
-//      %0      %0+%1   %0+2%1  eax+2%1 %0+4%1  eax+4%1 ecx+%1  ecx+2%1
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  ecx     ecx+%1  ecx+2%1
-
-
-        "movq (%0, %1, 2), %%mm0                \n\t" // l2
-        "movq (%0), %%mm1                       \n\t" // l0
-        "movq %%mm0, %%mm2                      \n\t" // l2
-        PAVGB(%%mm7, %%mm0)                           // ~l2/2
-        PAVGB(%%mm1, %%mm0)                           // ~(l2 + 2l0)/4
-        PAVGB(%%mm2, %%mm0)                           // ~(5l2 + 2l0)/8
-
-        "movq (%%"REG_a"), %%mm1                \n\t" // l1
-        "movq (%%"REG_a", %1, 2), %%mm3         \n\t" // l3
-        "movq %%mm1, %%mm4                      \n\t" // l1
-        PAVGB(%%mm7, %%mm1)                           // ~l1/2
-        PAVGB(%%mm3, %%mm1)                           // ~(l1 + 2l3)/4
-        PAVGB(%%mm4, %%mm1)                           // ~(5l1 + 2l3)/8
-
-        "movq %%mm0, %%mm4                      \n\t" // ~(5l2 + 2l0)/8
-        "psubusb %%mm1, %%mm0                   \n\t"
-        "psubusb %%mm4, %%mm1                   \n\t"
-        "por %%mm0, %%mm1                       \n\t" // ~|2l0 - 5l1 + 5l2 - 2l3|/8
-// mm1= |lenergy|, mm2= l2, mm3= l3, mm7=0
-
-        "movq (%0, %1, 4), %%mm0                \n\t" // l4
-        "movq %%mm0, %%mm4                      \n\t" // l4
-        PAVGB(%%mm7, %%mm0)                           // ~l4/2
-        PAVGB(%%mm2, %%mm0)                           // ~(l4 + 2l2)/4
-        PAVGB(%%mm4, %%mm0)                           // ~(5l4 + 2l2)/8
-
-        "movq (%%"REG_c"), %%mm2                \n\t" // l5
-        "movq %%mm3, %%mm5                      \n\t" // l3
-        PAVGB(%%mm7, %%mm3)                           // ~l3/2
-        PAVGB(%%mm2, %%mm3)                           // ~(l3 + 2l5)/4
-        PAVGB(%%mm5, %%mm3)                           // ~(5l3 + 2l5)/8
-
-        "movq %%mm0, %%mm6                      \n\t" // ~(5l4 + 2l2)/8
-        "psubusb %%mm3, %%mm0                   \n\t"
-        "psubusb %%mm6, %%mm3                   \n\t"
-        "por %%mm0, %%mm3                       \n\t" // ~|2l2 - 5l3 + 5l4 - 2l5|/8
-        "pcmpeqb %%mm7, %%mm0                   \n\t" // SIGN(2l2 - 5l3 + 5l4 - 2l5)
-// mm0= SIGN(menergy), mm1= |lenergy|, mm2= l5, mm3= |menergy|, mm4=l4, mm5= l3, mm7=0
-
-        "movq (%%"REG_c", %1), %%mm6            \n\t" // l6
-        "movq %%mm6, %%mm5                      \n\t" // l6
-        PAVGB(%%mm7, %%mm6)                           // ~l6/2
-        PAVGB(%%mm4, %%mm6)                           // ~(l6 + 2l4)/4
-        PAVGB(%%mm5, %%mm6)                           // ~(5l6 + 2l4)/8
-
-        "movq (%%"REG_c", %1, 2), %%mm5         \n\t" // l7
-        "movq %%mm2, %%mm4                      \n\t" // l5
-        PAVGB(%%mm7, %%mm2)                           // ~l5/2
-        PAVGB(%%mm5, %%mm2)                           // ~(l5 + 2l7)/4
-        PAVGB(%%mm4, %%mm2)                           // ~(5l5 + 2l7)/8
-
-        "movq %%mm6, %%mm4                      \n\t" // ~(5l6 + 2l4)/8
-        "psubusb %%mm2, %%mm6                   \n\t"
-        "psubusb %%mm4, %%mm2                   \n\t"
-        "por %%mm6, %%mm2                       \n\t" // ~|2l4 - 5l5 + 5l6 - 2l7|/8
-// mm0= SIGN(menergy), mm1= |lenergy|/8, mm2= |renergy|/8, mm3= |menergy|/8, mm7=0
-
-
-        PMINUB(%%mm2, %%mm1, %%mm4)                   // MIN(|lenergy|,|renergy|)/8
-        "movq %2, %%mm4                         \n\t" // QP //FIXME QP+1 ?
-        "paddusb "MANGLE(b01)", %%mm4           \n\t"
-        "pcmpgtb %%mm3, %%mm4                   \n\t" // |menergy|/8 < QP
-        "psubusb %%mm1, %%mm3                   \n\t" // d=|menergy|/8-MIN(|lenergy|,|renergy|)/8
-        "pand %%mm4, %%mm3                      \n\t"
-
-        "movq %%mm3, %%mm1                      \n\t"
-//        "psubusb "MANGLE(b01)", %%mm3           \n\t"
-        PAVGB(%%mm7, %%mm3)
-        PAVGB(%%mm7, %%mm3)
-        "paddusb %%mm1, %%mm3                   \n\t"
-//        "paddusb "MANGLE(b01)", %%mm3           \n\t"
-
-        "movq (%%"REG_a", %1, 2), %%mm6         \n\t" //l3
-        "movq (%0, %1, 4), %%mm5                \n\t" //l4
-        "movq (%0, %1, 4), %%mm4                \n\t" //l4
-        "psubusb %%mm6, %%mm5                   \n\t"
-        "psubusb %%mm4, %%mm6                   \n\t"
-        "por %%mm6, %%mm5                       \n\t" // |l3-l4|
-        "pcmpeqb %%mm7, %%mm6                   \n\t" // SIGN(l3-l4)
-        "pxor %%mm6, %%mm0                      \n\t"
-        "pand %%mm0, %%mm3                      \n\t"
-        PMINUB(%%mm5, %%mm3, %%mm0)
-
-        "psubusb "MANGLE(b01)", %%mm3           \n\t"
-        PAVGB(%%mm7, %%mm3)
-
-        "movq (%%"REG_a", %1, 2), %%mm0         \n\t"
-        "movq (%0, %1, 4), %%mm2                \n\t"
-        "pxor %%mm6, %%mm0                      \n\t"
-        "pxor %%mm6, %%mm2                      \n\t"
-        "psubb %%mm3, %%mm0                     \n\t"
-        "paddb %%mm3, %%mm2                     \n\t"
-        "pxor %%mm6, %%mm0                      \n\t"
-        "pxor %%mm6, %%mm2                      \n\t"
-        "movq %%mm0, (%%"REG_a", %1, 2)         \n\t"
-        "movq %%mm2, (%0, %1, 4)                \n\t"
-#endif //0
-
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "pcmpeqb %%mm6, %%mm6                   \n\t" // -1
-//      0       1       2       3       4       5       6       7
-//      %0      %0+%1   %0+2%1  eax+2%1 %0+4%1  eax+4%1 ecx+%1  ecx+2%1
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  ecx     ecx+%1  ecx+2%1
-
-
-        "movq (%%"REG_a", %1, 2), %%mm1         \n\t" // l3
-        "movq (%0, %1, 4), %%mm0                \n\t" // l4
-        "pxor %%mm6, %%mm1                      \n\t" // -l3-1
-        PAVGB(%%mm1, %%mm0)                           // -q+128 = (l4-l3+256)/2
-// mm1=-l3-1, mm0=128-q
-
-        "movq (%%"REG_a", %1, 4), %%mm2         \n\t" // l5
-        "movq (%%"REG_a", %1), %%mm3            \n\t" // l2
-        "pxor %%mm6, %%mm2                      \n\t" // -l5-1
-        "movq %%mm2, %%mm5                      \n\t" // -l5-1
-        "movq "MANGLE(b80)", %%mm4              \n\t" // 128
-        "lea (%%"REG_a", %1, 4), %%"REG_c"      \n\t"
-        PAVGB(%%mm3, %%mm2)                           // (l2-l5+256)/2
-        PAVGB(%%mm0, %%mm4)                           // ~(l4-l3)/4 + 128
-        PAVGB(%%mm2, %%mm4)                           // ~(l2-l5)/4 +(l4-l3)/8 + 128
-        PAVGB(%%mm0, %%mm4)                           // ~(l2-l5)/8 +5(l4-l3)/16 + 128
-// mm1=-l3-1, mm0=128-q, mm3=l2, mm4=menergy/16 + 128, mm5= -l5-1
-
-        "movq (%%"REG_a"), %%mm2                \n\t" // l1
-        "pxor %%mm6, %%mm2                      \n\t" // -l1-1
-        PAVGB(%%mm3, %%mm2)                           // (l2-l1+256)/2
-        PAVGB((%0), %%mm1)                            // (l0-l3+256)/2
-        "movq "MANGLE(b80)", %%mm3              \n\t" // 128
-        PAVGB(%%mm2, %%mm3)                           // ~(l2-l1)/4 + 128
-        PAVGB(%%mm1, %%mm3)                           // ~(l0-l3)/4 +(l2-l1)/8 + 128
-        PAVGB(%%mm2, %%mm3)                           // ~(l0-l3)/8 +5(l2-l1)/16 + 128
-// mm0=128-q, mm3=lenergy/16 + 128, mm4= menergy/16 + 128, mm5= -l5-1
-
-        PAVGB((%%REGc, %1), %%mm5)                    // (l6-l5+256)/2
-        "movq (%%"REG_c", %1, 2), %%mm1         \n\t" // l7
-        "pxor %%mm6, %%mm1                      \n\t" // -l7-1
-        PAVGB((%0, %1, 4), %%mm1)                     // (l4-l7+256)/2
-        "movq "MANGLE(b80)", %%mm2              \n\t" // 128
-        PAVGB(%%mm5, %%mm2)                           // ~(l6-l5)/4 + 128
-        PAVGB(%%mm1, %%mm2)                           // ~(l4-l7)/4 +(l6-l5)/8 + 128
-        PAVGB(%%mm5, %%mm2)                           // ~(l4-l7)/8 +5(l6-l5)/16 + 128
-// mm0=128-q, mm2=renergy/16 + 128, mm3=lenergy/16 + 128, mm4= menergy/16 + 128
-
-        "movq "MANGLE(b00)", %%mm1              \n\t" // 0
-        "movq "MANGLE(b00)", %%mm5              \n\t" // 0
-        "psubb %%mm2, %%mm1                     \n\t" // 128 - renergy/16
-        "psubb %%mm3, %%mm5                     \n\t" // 128 - lenergy/16
-        PMAXUB(%%mm1, %%mm2)                          // 128 + |renergy/16|
-        PMAXUB(%%mm5, %%mm3)                          // 128 + |lenergy/16|
-        PMINUB(%%mm2, %%mm3, %%mm1)                   // 128 + MIN(|lenergy|,|renergy|)/16
-
-// mm0=128-q, mm3=128 + MIN(|lenergy|,|renergy|)/16, mm4= menergy/16 + 128
-
-        "movq "MANGLE(b00)", %%mm7              \n\t" // 0
-        "movq %2, %%mm2                         \n\t" // QP
-        PAVGB(%%mm6, %%mm2)                           // 128 + QP/2
-        "psubb %%mm6, %%mm2                     \n\t"
-
-        "movq %%mm4, %%mm1                      \n\t"
-        "pcmpgtb %%mm7, %%mm1                   \n\t" // SIGN(menergy)
-        "pxor %%mm1, %%mm4                      \n\t"
-        "psubb %%mm1, %%mm4                     \n\t" // 128 + |menergy|/16
-        "pcmpgtb %%mm4, %%mm2                   \n\t" // |menergy|/16 < QP/2
-        "psubusb %%mm3, %%mm4                   \n\t" //d=|menergy|/16 - MIN(|lenergy|,|renergy|)/16
-// mm0=128-q, mm1= SIGN(menergy), mm2= |menergy|/16 < QP/2, mm4= d/16
-
-        "movq %%mm4, %%mm3                      \n\t" // d
-        "psubusb "MANGLE(b01)", %%mm4           \n\t"
-        PAVGB(%%mm7, %%mm4)                           // d/32
-        PAVGB(%%mm7, %%mm4)                           // (d + 32)/64
-        "paddb %%mm3, %%mm4                     \n\t" // 5d/64
-        "pand %%mm2, %%mm4                      \n\t"
-
-        "movq "MANGLE(b80)", %%mm5              \n\t" // 128
-        "psubb %%mm0, %%mm5                     \n\t" // q
-        "paddsb %%mm6, %%mm5                    \n\t" // fix bad rounding
-        "pcmpgtb %%mm5, %%mm7                   \n\t" // SIGN(q)
-        "pxor %%mm7, %%mm5                      \n\t"
-
-        PMINUB(%%mm5, %%mm4, %%mm3)                   // MIN(|q|, 5d/64)
-        "pxor %%mm1, %%mm7                      \n\t" // SIGN(d*q)
-
-        "pand %%mm7, %%mm4                      \n\t"
-        "movq (%%"REG_a", %1, 2), %%mm0         \n\t"
-        "movq (%0, %1, 4), %%mm2                \n\t"
-        "pxor %%mm1, %%mm0                      \n\t"
-        "pxor %%mm1, %%mm2                      \n\t"
-        "paddb %%mm4, %%mm0                     \n\t"
-        "psubb %%mm4, %%mm2                     \n\t"
-        "pxor %%mm1, %%mm0                      \n\t"
-        "pxor %%mm1, %%mm2                      \n\t"
-        "movq %%mm0, (%%"REG_a", %1, 2)         \n\t"
-        "movq %%mm2, (%0, %1, 4)                \n\t"
-
-        :
-        : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb)
-        : "%"REG_a, "%"REG_c
-    );
-
-/*
-    {
-    int x;
-    src-= stride;
-    for(x=0; x<BLOCK_SIZE; x++){
-        const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
-        if(FFABS(middleEnergy)< 8*QP){
-            const int q=(src[l4] - src[l5])/2;
-            const int leftEnergy=  5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
-            const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
-
-            int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
-            d= FFMAX(d, 0);
-
-            d= (5*d + 32) >> 6;
-            d*= FFSIGN(-middleEnergy);
-
-            if(q>0){
-                d= d<0 ? 0 : d;
-                d= d>q ? q : d;
-            }else{
-                d= d>0 ? 0 : d;
-                d= d<q ? q : d;
-            }
-
-            src[l4]-= d;
-            src[l5]+= d;
-        }
-        src++;
-    }
-    src-=8;
-    for(x=0; x<8; x++){
-        int y;
-        for(y=4; y<6; y++){
-            int d= src[x+y*stride] - tmp[x+(y-4)*8];
-            int ad= FFABS(d);
-            static int max=0;
-            static int sum=0;
-            static int num=0;
-            static int bias=0;
-
-            if(max<ad) max=ad;
-            sum+= ad>3 ? 1 : 0;
-            if(ad>3){
-                src[0] = src[7] = src[stride*7] = src[(stride+1)*7]=255;
-            }
-            if(y==4) bias+=d;
-            num++;
-            if(num%1000000 == 0){
-                av_log(c, AV_LOG_INFO, " %d %d %d %d\n", num, sum, max, bias);
-            }
-        }
-    }
-}
-*/
-#elif HAVE_MMX
-    src+= stride*4;
-    __asm__ volatile(
-        "pxor %%mm7, %%mm7                      \n\t"
-        "lea -40(%%"REG_SP"), %%"REG_c"         \n\t" // make space for 4 8-byte vars
-        "and "ALIGN_MASK", %%"REG_c"            \n\t" // align
-//      0       1       2       3       4       5       6       7
-//      %0      %0+%1   %0+2%1  eax+2%1 %0+4%1  eax+4%1 edx+%1  edx+2%1
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1
-
-        "movq (%0), %%mm0                       \n\t"
-        "movq %%mm0, %%mm1                      \n\t"
-        "punpcklbw %%mm7, %%mm0                 \n\t" // low part of line 0
-        "punpckhbw %%mm7, %%mm1                 \n\t" // high part of line 0
-
-        "movq (%0, %1), %%mm2                   \n\t"
-        "lea (%0, %1, 2), %%"REG_a"             \n\t"
-        "movq %%mm2, %%mm3                      \n\t"
-        "punpcklbw %%mm7, %%mm2                 \n\t" // low part of line 1
-        "punpckhbw %%mm7, %%mm3                 \n\t" // high part of line 1
-
-        "movq (%%"REG_a"), %%mm4                \n\t"
-        "movq %%mm4, %%mm5                      \n\t"
-        "punpcklbw %%mm7, %%mm4                 \n\t" // low part of line 2
-        "punpckhbw %%mm7, %%mm5                 \n\t" // high part of line 2
-
-        "paddw %%mm0, %%mm0                     \n\t" // 2L0
-        "paddw %%mm1, %%mm1                     \n\t" // 2H0
-        "psubw %%mm4, %%mm2                     \n\t" // L1 - L2
-        "psubw %%mm5, %%mm3                     \n\t" // H1 - H2
-        "psubw %%mm2, %%mm0                     \n\t" // 2L0 - L1 + L2
-        "psubw %%mm3, %%mm1                     \n\t" // 2H0 - H1 + H2
-
-        "psllw $2, %%mm2                        \n\t" // 4L1 - 4L2
-        "psllw $2, %%mm3                        \n\t" // 4H1 - 4H2
-        "psubw %%mm2, %%mm0                     \n\t" // 2L0 - 5L1 + 5L2
-        "psubw %%mm3, %%mm1                     \n\t" // 2H0 - 5H1 + 5H2
-
-        "movq (%%"REG_a", %1), %%mm2            \n\t"
-        "movq %%mm2, %%mm3                      \n\t"
-        "punpcklbw %%mm7, %%mm2                 \n\t" // L3
-        "punpckhbw %%mm7, %%mm3                 \n\t" // H3
-
-        "psubw %%mm2, %%mm0                     \n\t" // 2L0 - 5L1 + 5L2 - L3
-        "psubw %%mm3, %%mm1                     \n\t" // 2H0 - 5H1 + 5H2 - H3
-        "psubw %%mm2, %%mm0                     \n\t" // 2L0 - 5L1 + 5L2 - 2L3
-        "psubw %%mm3, %%mm1                     \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-        "movq %%mm0, (%%"REG_c")                \n\t" // 2L0 - 5L1 + 5L2 - 2L3
-        "movq %%mm1, 8(%%"REG_c")               \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
-        "movq (%%"REG_a", %1, 2), %%mm0         \n\t"
-        "movq %%mm0, %%mm1                      \n\t"
-        "punpcklbw %%mm7, %%mm0                 \n\t" // L4
-        "punpckhbw %%mm7, %%mm1                 \n\t" // H4
-
-        "psubw %%mm0, %%mm2                     \n\t" // L3 - L4
-        "psubw %%mm1, %%mm3                     \n\t" // H3 - H4
-        "movq %%mm2, 16(%%"REG_c")              \n\t" // L3 - L4
-        "movq %%mm3, 24(%%"REG_c")              \n\t" // H3 - H4
-        "paddw %%mm4, %%mm4                     \n\t" // 2L2
-        "paddw %%mm5, %%mm5                     \n\t" // 2H2
-        "psubw %%mm2, %%mm4                     \n\t" // 2L2 - L3 + L4
-        "psubw %%mm3, %%mm5                     \n\t" // 2H2 - H3 + H4
-
-        "lea (%%"REG_a", %1), %0                \n\t"
-        "psllw $2, %%mm2                        \n\t" // 4L3 - 4L4
-        "psllw $2, %%mm3                        \n\t" // 4H3 - 4H4
-        "psubw %%mm2, %%mm4                     \n\t" // 2L2 - 5L3 + 5L4
-        "psubw %%mm3, %%mm5                     \n\t" // 2H2 - 5H3 + 5H4
-//50 opcodes so far
-        "movq (%0, %1, 2), %%mm2                \n\t"
-        "movq %%mm2, %%mm3                      \n\t"
-        "punpcklbw %%mm7, %%mm2                 \n\t" // L5
-        "punpckhbw %%mm7, %%mm3                 \n\t" // H5
-        "psubw %%mm2, %%mm4                     \n\t" // 2L2 - 5L3 + 5L4 - L5
-        "psubw %%mm3, %%mm5                     \n\t" // 2H2 - 5H3 + 5H4 - H5
-        "psubw %%mm2, %%mm4                     \n\t" // 2L2 - 5L3 + 5L4 - 2L5
-        "psubw %%mm3, %%mm5                     \n\t" // 2H2 - 5H3 + 5H4 - 2H5
-
-        "movq (%%"REG_a", %1, 4), %%mm6         \n\t"
-        "punpcklbw %%mm7, %%mm6                 \n\t" // L6
-        "psubw %%mm6, %%mm2                     \n\t" // L5 - L6
-        "movq (%%"REG_a", %1, 4), %%mm6         \n\t"
-        "punpckhbw %%mm7, %%mm6                 \n\t" // H6
-        "psubw %%mm6, %%mm3                     \n\t" // H5 - H6
-
-        "paddw %%mm0, %%mm0                     \n\t" // 2L4
-        "paddw %%mm1, %%mm1                     \n\t" // 2H4
-        "psubw %%mm2, %%mm0                     \n\t" // 2L4 - L5 + L6
-        "psubw %%mm3, %%mm1                     \n\t" // 2H4 - H5 + H6
-
-        "psllw $2, %%mm2                        \n\t" // 4L5 - 4L6
-        "psllw $2, %%mm3                        \n\t" // 4H5 - 4H6
-        "psubw %%mm2, %%mm0                     \n\t" // 2L4 - 5L5 + 5L6
-        "psubw %%mm3, %%mm1                     \n\t" // 2H4 - 5H5 + 5H6
-
-        "movq (%0, %1, 4), %%mm2                \n\t"
-        "movq %%mm2, %%mm3                      \n\t"
-        "punpcklbw %%mm7, %%mm2                 \n\t" // L7
-        "punpckhbw %%mm7, %%mm3                 \n\t" // H7
-
-        "paddw %%mm2, %%mm2                     \n\t" // 2L7
-        "paddw %%mm3, %%mm3                     \n\t" // 2H7
-        "psubw %%mm2, %%mm0                     \n\t" // 2L4 - 5L5 + 5L6 - 2L7
-        "psubw %%mm3, %%mm1                     \n\t" // 2H4 - 5H5 + 5H6 - 2H7
-
-        "movq (%%"REG_c"), %%mm2                \n\t" // 2L0 - 5L1 + 5L2 - 2L3
-        "movq 8(%%"REG_c"), %%mm3               \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
-#if HAVE_MMX2
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "psubw %%mm0, %%mm6                     \n\t"
-        "pmaxsw %%mm6, %%mm0                    \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "psubw %%mm1, %%mm6                     \n\t"
-        "pmaxsw %%mm6, %%mm1                    \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "psubw %%mm2, %%mm6                     \n\t"
-        "pmaxsw %%mm6, %%mm2                    \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "psubw %%mm3, %%mm6                     \n\t"
-        "pmaxsw %%mm6, %%mm3                    \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#else
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "pcmpgtw %%mm0, %%mm6                   \n\t"
-        "pxor %%mm6, %%mm0                      \n\t"
-        "psubw %%mm6, %%mm0                     \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "pcmpgtw %%mm1, %%mm6                   \n\t"
-        "pxor %%mm6, %%mm1                      \n\t"
-        "psubw %%mm6, %%mm1                     \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "pcmpgtw %%mm2, %%mm6                   \n\t"
-        "pxor %%mm6, %%mm2                      \n\t"
-        "psubw %%mm6, %%mm2                     \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "pcmpgtw %%mm3, %%mm6                   \n\t"
-        "pxor %%mm6, %%mm3                      \n\t"
-        "psubw %%mm6, %%mm3                     \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#endif
-
-#if HAVE_MMX2
-        "pminsw %%mm2, %%mm0                    \n\t"
-        "pminsw %%mm3, %%mm1                    \n\t"
-#else
-        "movq %%mm0, %%mm6                      \n\t"
-        "psubusw %%mm2, %%mm6                   \n\t"
-        "psubw %%mm6, %%mm0                     \n\t"
-        "movq %%mm1, %%mm6                      \n\t"
-        "psubusw %%mm3, %%mm6                   \n\t"
-        "psubw %%mm6, %%mm1                     \n\t"
-#endif
-
-        "movd %2, %%mm2                         \n\t" // QP
-        "punpcklbw %%mm7, %%mm2                 \n\t"
-
-        "movq %%mm7, %%mm6                      \n\t" // 0
-        "pcmpgtw %%mm4, %%mm6                   \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
-        "pxor %%mm6, %%mm4                      \n\t"
-        "psubw %%mm6, %%mm4                     \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
-        "pcmpgtw %%mm5, %%mm7                   \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
-        "pxor %%mm7, %%mm5                      \n\t"
-        "psubw %%mm7, %%mm5                     \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
-// 100 opcodes
-        "psllw $3, %%mm2                        \n\t" // 8QP
-        "movq %%mm2, %%mm3                      \n\t" // 8QP
-        "pcmpgtw %%mm4, %%mm2                   \n\t"
-        "pcmpgtw %%mm5, %%mm3                   \n\t"
-        "pand %%mm2, %%mm4                      \n\t"
-        "pand %%mm3, %%mm5                      \n\t"
-
-
-        "psubusw %%mm0, %%mm4                   \n\t" // hd
-        "psubusw %%mm1, %%mm5                   \n\t" // ld
-
-
-        "movq "MANGLE(w05)", %%mm2              \n\t" // 5
-        "pmullw %%mm2, %%mm4                    \n\t"
-        "pmullw %%mm2, %%mm5                    \n\t"
-        "movq "MANGLE(w20)", %%mm2              \n\t" // 32
-        "paddw %%mm2, %%mm4                     \n\t"
-        "paddw %%mm2, %%mm5                     \n\t"
-        "psrlw $6, %%mm4                        \n\t"
-        "psrlw $6, %%mm5                        \n\t"
-
-        "movq 16(%%"REG_c"), %%mm0              \n\t" // L3 - L4
-        "movq 24(%%"REG_c"), %%mm1              \n\t" // H3 - H4
-
-        "pxor %%mm2, %%mm2                      \n\t"
-        "pxor %%mm3, %%mm3                      \n\t"
-
-        "pcmpgtw %%mm0, %%mm2                   \n\t" // sign (L3-L4)
-        "pcmpgtw %%mm1, %%mm3                   \n\t" // sign (H3-H4)
-        "pxor %%mm2, %%mm0                      \n\t"
-        "pxor %%mm3, %%mm1                      \n\t"
-        "psubw %%mm2, %%mm0                     \n\t" // |L3-L4|
-        "psubw %%mm3, %%mm1                     \n\t" // |H3-H4|
-        "psrlw $1, %%mm0                        \n\t" // |L3 - L4|/2
-        "psrlw $1, %%mm1                        \n\t" // |H3 - H4|/2
-
-        "pxor %%mm6, %%mm2                      \n\t"
-        "pxor %%mm7, %%mm3                      \n\t"
-        "pand %%mm2, %%mm4                      \n\t"
-        "pand %%mm3, %%mm5                      \n\t"
-
-#if HAVE_MMX2
-        "pminsw %%mm0, %%mm4                    \n\t"
-        "pminsw %%mm1, %%mm5                    \n\t"
-#else
-        "movq %%mm4, %%mm2                      \n\t"
-        "psubusw %%mm0, %%mm2                   \n\t"
-        "psubw %%mm2, %%mm4                     \n\t"
-        "movq %%mm5, %%mm2                      \n\t"
-        "psubusw %%mm1, %%mm2                   \n\t"
-        "psubw %%mm2, %%mm5                     \n\t"
-#endif
-        "pxor %%mm6, %%mm4                      \n\t"
-        "pxor %%mm7, %%mm5                      \n\t"
-        "psubw %%mm6, %%mm4                     \n\t"
-        "psubw %%mm7, %%mm5                     \n\t"
-        "packsswb %%mm5, %%mm4                  \n\t"
-        "movq (%0), %%mm0                       \n\t"
-        "paddb   %%mm4, %%mm0                   \n\t"
-        "movq %%mm0, (%0)                       \n\t"
-        "movq (%0, %1), %%mm0                   \n\t"
-        "psubb %%mm4, %%mm0                     \n\t"
-        "movq %%mm0, (%0, %1)                   \n\t"
-
-        : "+r" (src)
-        : "r" ((x86_reg)stride), "m" (c->pQPb)
-        : "%"REG_a, "%"REG_c
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-    const int l1= stride;
-    const int l2= stride + l1;
-    const int l3= stride + l2;
-    const int l4= stride + l3;
-    const int l5= stride + l4;
-    const int l6= stride + l5;
-    const int l7= stride + l6;
-    const int l8= stride + l7;
-//    const int l9= stride + l8;
-    int x;
-    src+= stride*3;
-    for(x=0; x<BLOCK_SIZE; x++){
-        const int middleEnergy= 5*(src[l5] - src[l4]) + 2*(src[l3] - src[l6]);
-        if(FFABS(middleEnergy) < 8*c->QP){
-            const int q=(src[l4] - src[l5])/2;
-            const int leftEnergy=  5*(src[l3] - src[l2]) + 2*(src[l1] - src[l4]);
-            const int rightEnergy= 5*(src[l7] - src[l6]) + 2*(src[l5] - src[l8]);
-
-            int d= FFABS(middleEnergy) - FFMIN( FFABS(leftEnergy), FFABS(rightEnergy) );
-            d= FFMAX(d, 0);
-
-            d= (5*d + 32) >> 6;
-            d*= FFSIGN(-middleEnergy);
-
-            if(q>0){
-                d= d<0 ? 0 : d;
-                d= d>q ? q : d;
-            }else{
-                d= d>0 ? 0 : d;
-                d= d<q ? q : d;
-            }
-
-            src[l4]-= d;
-            src[l5]+= d;
-        }
-        src++;
-    }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-#if !HAVE_ALTIVEC
-static inline void RENAME(dering)(uint8_t src[], int stride, PPContext *c)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    __asm__ volatile(
-        "pxor %%mm6, %%mm6                      \n\t"
-        "pcmpeqb %%mm7, %%mm7                   \n\t"
-        "movq %2, %%mm0                         \n\t"
-        "punpcklbw %%mm6, %%mm0                 \n\t"
-        "psrlw $1, %%mm0                        \n\t"
-        "psubw %%mm7, %%mm0                     \n\t"
-        "packuswb %%mm0, %%mm0                  \n\t"
-        "movq %%mm0, %3                         \n\t"
-
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
-
-//        0        1        2        3        4        5        6        7        8        9
-//        %0        eax        eax+%1        eax+2%1        %0+4%1        edx        edx+%1        edx+2%1        %0+8%1        edx+4%1
-
-#undef REAL_FIND_MIN_MAX
-#undef FIND_MIN_MAX
-#if HAVE_MMX2
-#define REAL_FIND_MIN_MAX(addr)\
-        "movq " #addr ", %%mm0                  \n\t"\
-        "pminub %%mm0, %%mm7                    \n\t"\
-        "pmaxub %%mm0, %%mm6                    \n\t"
-#else
-#define REAL_FIND_MIN_MAX(addr)\
-        "movq " #addr ", %%mm0                  \n\t"\
-        "movq %%mm7, %%mm1                      \n\t"\
-        "psubusb %%mm0, %%mm6                   \n\t"\
-        "paddb %%mm0, %%mm6                     \n\t"\
-        "psubusb %%mm0, %%mm1                   \n\t"\
-        "psubb %%mm1, %%mm7                     \n\t"
-#endif
-#define FIND_MIN_MAX(addr)  REAL_FIND_MIN_MAX(addr)
-
-FIND_MIN_MAX((%%REGa))
-FIND_MIN_MAX((%%REGa, %1))
-FIND_MIN_MAX((%%REGa, %1, 2))
-FIND_MIN_MAX((%0, %1, 4))
-FIND_MIN_MAX((%%REGd))
-FIND_MIN_MAX((%%REGd, %1))
-FIND_MIN_MAX((%%REGd, %1, 2))
-FIND_MIN_MAX((%0, %1, 8))
-
-        "movq %%mm7, %%mm4                      \n\t"
-        "psrlq $8, %%mm7                        \n\t"
-#if HAVE_MMX2
-        "pminub %%mm4, %%mm7                    \n\t" // min of pixels
-        "pshufw $0xF9, %%mm7, %%mm4             \n\t"
-        "pminub %%mm4, %%mm7                    \n\t" // min of pixels
-        "pshufw $0xFE, %%mm7, %%mm4             \n\t"
-        "pminub %%mm4, %%mm7                    \n\t"
-#else
-        "movq %%mm7, %%mm1                      \n\t"
-        "psubusb %%mm4, %%mm1                   \n\t"
-        "psubb %%mm1, %%mm7                     \n\t"
-        "movq %%mm7, %%mm4                      \n\t"
-        "psrlq $16, %%mm7                       \n\t"
-        "movq %%mm7, %%mm1                      \n\t"
-        "psubusb %%mm4, %%mm1                   \n\t"
-        "psubb %%mm1, %%mm7                     \n\t"
-        "movq %%mm7, %%mm4                      \n\t"
-        "psrlq $32, %%mm7                       \n\t"
-        "movq %%mm7, %%mm1                      \n\t"
-        "psubusb %%mm4, %%mm1                   \n\t"
-        "psubb %%mm1, %%mm7                     \n\t"
-#endif
-
-
-        "movq %%mm6, %%mm4                      \n\t"
-        "psrlq $8, %%mm6                        \n\t"
-#if HAVE_MMX2
-        "pmaxub %%mm4, %%mm6                    \n\t" // max of pixels
-        "pshufw $0xF9, %%mm6, %%mm4             \n\t"
-        "pmaxub %%mm4, %%mm6                    \n\t"
-        "pshufw $0xFE, %%mm6, %%mm4             \n\t"
-        "pmaxub %%mm4, %%mm6                    \n\t"
-#else
-        "psubusb %%mm4, %%mm6                   \n\t"
-        "paddb %%mm4, %%mm6                     \n\t"
-        "movq %%mm6, %%mm4                      \n\t"
-        "psrlq $16, %%mm6                       \n\t"
-        "psubusb %%mm4, %%mm6                   \n\t"
-        "paddb %%mm4, %%mm6                     \n\t"
-        "movq %%mm6, %%mm4                      \n\t"
-        "psrlq $32, %%mm6                       \n\t"
-        "psubusb %%mm4, %%mm6                   \n\t"
-        "paddb %%mm4, %%mm6                     \n\t"
-#endif
-        "movq %%mm6, %%mm0                      \n\t" // max
-        "psubb %%mm7, %%mm6                     \n\t" // max - min
-        "movd %%mm6, %%ecx                      \n\t"
-        "cmpb "MANGLE(deringThreshold)", %%cl   \n\t"
-        " jb 1f                                 \n\t"
-        "lea -24(%%"REG_SP"), %%"REG_c"         \n\t"
-        "and "ALIGN_MASK", %%"REG_c"            \n\t"
-        PAVGB(%%mm0, %%mm7)                           // a=(max + min)/2
-        "punpcklbw %%mm7, %%mm7                 \n\t"
-        "punpcklbw %%mm7, %%mm7                 \n\t"
-        "punpcklbw %%mm7, %%mm7                 \n\t"
-        "movq %%mm7, (%%"REG_c")                \n\t"
-
-        "movq (%0), %%mm0                       \n\t" // L10
-        "movq %%mm0, %%mm1                      \n\t" // L10
-        "movq %%mm0, %%mm2                      \n\t" // L10
-        "psllq $8, %%mm1                        \n\t"
-        "psrlq $8, %%mm2                        \n\t"
-        "movd -4(%0), %%mm3                     \n\t"
-        "movd 8(%0), %%mm4                      \n\t"
-        "psrlq $24, %%mm3                       \n\t"
-        "psllq $56, %%mm4                       \n\t"
-        "por %%mm3, %%mm1                       \n\t" // L00
-        "por %%mm4, %%mm2                       \n\t" // L20
-        "movq %%mm1, %%mm3                      \n\t" // L00
-        PAVGB(%%mm2, %%mm1)                           // (L20 + L00)/2
-        PAVGB(%%mm0, %%mm1)                           // (L20 + L00 + 2L10)/4
-        "psubusb %%mm7, %%mm0                   \n\t"
-        "psubusb %%mm7, %%mm2                   \n\t"
-        "psubusb %%mm7, %%mm3                   \n\t"
-        "pcmpeqb "MANGLE(b00)", %%mm0           \n\t" // L10 > a ? 0 : -1
-        "pcmpeqb "MANGLE(b00)", %%mm2           \n\t" // L20 > a ? 0 : -1
-        "pcmpeqb "MANGLE(b00)", %%mm3           \n\t" // L00 > a ? 0 : -1
-        "paddb %%mm2, %%mm0                     \n\t"
-        "paddb %%mm3, %%mm0                     \n\t"
-
-        "movq (%%"REG_a"), %%mm2                \n\t" // L11
-        "movq %%mm2, %%mm3                      \n\t" // L11
-        "movq %%mm2, %%mm4                      \n\t" // L11
-        "psllq $8, %%mm3                        \n\t"
-        "psrlq $8, %%mm4                        \n\t"
-        "movd -4(%%"REG_a"), %%mm5              \n\t"
-        "movd 8(%%"REG_a"), %%mm6               \n\t"
-        "psrlq $24, %%mm5                       \n\t"
-        "psllq $56, %%mm6                       \n\t"
-        "por %%mm5, %%mm3                       \n\t" // L01
-        "por %%mm6, %%mm4                       \n\t" // L21
-        "movq %%mm3, %%mm5                      \n\t" // L01
-        PAVGB(%%mm4, %%mm3)                           // (L21 + L01)/2
-        PAVGB(%%mm2, %%mm3)                           // (L21 + L01 + 2L11)/4
-        "psubusb %%mm7, %%mm2                   \n\t"
-        "psubusb %%mm7, %%mm4                   \n\t"
-        "psubusb %%mm7, %%mm5                   \n\t"
-        "pcmpeqb "MANGLE(b00)", %%mm2           \n\t" // L11 > a ? 0 : -1
-        "pcmpeqb "MANGLE(b00)", %%mm4           \n\t" // L21 > a ? 0 : -1
-        "pcmpeqb "MANGLE(b00)", %%mm5           \n\t" // L01 > a ? 0 : -1
-        "paddb %%mm4, %%mm2                     \n\t"
-        "paddb %%mm5, %%mm2                     \n\t"
-// 0, 2, 3, 1
-#define REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
-        "movq " #src ", " #sx "                 \n\t" /* src[0] */\
-        "movq " #sx ", " #lx "                  \n\t" /* src[0] */\
-        "movq " #sx ", " #t0 "                  \n\t" /* src[0] */\
-        "psllq $8, " #lx "                      \n\t"\
-        "psrlq $8, " #t0 "                      \n\t"\
-        "movd -4" #src ", " #t1 "               \n\t"\
-        "psrlq $24, " #t1 "                     \n\t"\
-        "por " #t1 ", " #lx "                   \n\t" /* src[-1] */\
-        "movd 8" #src ", " #t1 "                \n\t"\
-        "psllq $56, " #t1 "                     \n\t"\
-        "por " #t1 ", " #t0 "                   \n\t" /* src[+1] */\
-        "movq " #lx ", " #t1 "                  \n\t" /* src[-1] */\
-        PAVGB(t0, lx)                                 /* (src[-1] + src[+1])/2 */\
-        PAVGB(sx, lx)                                 /* (src[-1] + 2src[0] + src[+1])/4 */\
-        PAVGB(lx, pplx)                                     \
-        "movq " #lx ", 8(%%"REG_c")             \n\t"\
-        "movq (%%"REG_c"), " #lx "              \n\t"\
-        "psubusb " #lx ", " #t1 "               \n\t"\
-        "psubusb " #lx ", " #t0 "               \n\t"\
-        "psubusb " #lx ", " #sx "               \n\t"\
-        "movq "MANGLE(b00)", " #lx "            \n\t"\
-        "pcmpeqb " #lx ", " #t1 "               \n\t" /* src[-1] > a ? 0 : -1*/\
-        "pcmpeqb " #lx ", " #t0 "               \n\t" /* src[+1] > a ? 0 : -1*/\
-        "pcmpeqb " #lx ", " #sx "               \n\t" /* src[0]  > a ? 0 : -1*/\
-        "paddb " #t1 ", " #t0 "                 \n\t"\
-        "paddb " #t0 ", " #sx "                 \n\t"\
-\
-        PAVGB(plx, pplx)                              /* filtered */\
-        "movq " #dst ", " #t0 "                 \n\t" /* dst */\
-        "movq " #t0 ", " #t1 "                  \n\t" /* dst */\
-        "psubusb %3, " #t0 "                    \n\t"\
-        "paddusb %3, " #t1 "                    \n\t"\
-        PMAXUB(t0, pplx)\
-        PMINUB(t1, pplx, t0)\
-        "paddb " #sx ", " #ppsx "               \n\t"\
-        "paddb " #psx ", " #ppsx "              \n\t"\
-        "#paddb "MANGLE(b02)", " #ppsx "        \n\t"\
-        "pand "MANGLE(b08)", " #ppsx "          \n\t"\
-        "pcmpeqb " #lx ", " #ppsx "             \n\t"\
-        "pand " #ppsx ", " #pplx "              \n\t"\
-        "pandn " #dst ", " #ppsx "              \n\t"\
-        "por " #pplx ", " #ppsx "               \n\t"\
-        "movq " #ppsx ", " #dst "               \n\t"\
-        "movq 8(%%"REG_c"), " #lx "             \n\t"
-
-#define DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1) \
-   REAL_DERING_CORE(dst,src,ppsx,psx,sx,pplx,plx,lx,t0,t1)
-/*
-0000000
-1111111
-
-1111110
-1111101
-1111100
-1111011
-1111010
-1111001
-
-1111000
-1110111
-
-*/
-//DERING_CORE(dst          ,src            ,ppsx ,psx  ,sx   ,pplx ,plx  ,lx   ,t0   ,t1)
-DERING_CORE((%%REGa)       ,(%%REGa, %1)   ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
-DERING_CORE((%%REGa, %1)   ,(%%REGa, %1, 2),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
-DERING_CORE((%%REGa, %1, 2),(%0, %1, 4)    ,%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
-DERING_CORE((%0, %1, 4)    ,(%%REGd)       ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
-DERING_CORE((%%REGd)       ,(%%REGd, %1)   ,%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
-DERING_CORE((%%REGd, %1)   ,(%%REGd, %1, 2),%%mm4,%%mm0,%%mm2,%%mm5,%%mm1,%%mm3,%%mm6,%%mm7)
-DERING_CORE((%%REGd, %1, 2),(%0, %1, 8)    ,%%mm0,%%mm2,%%mm4,%%mm1,%%mm3,%%mm5,%%mm6,%%mm7)
-DERING_CORE((%0, %1, 8)    ,(%%REGd, %1, 4),%%mm2,%%mm4,%%mm0,%%mm3,%%mm5,%%mm1,%%mm6,%%mm7)
-
-        "1:                        \n\t"
-        : : "r" (src), "r" ((x86_reg)stride), "m" (c->pQPb), "m"(c->pQPb2)
-        : "%"REG_a, "%"REG_d, "%"REG_c
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-    int y;
-    int min=255;
-    int max=0;
-    int avg;
-    uint8_t *p;
-    int s[10];
-    const int QP2= c->QP/2 + 1;
-
-    for(y=1; y<9; y++){
-        int x;
-        p= src + stride*y;
-        for(x=1; x<9; x++){
-            p++;
-            if(*p > max) max= *p;
-            if(*p < min) min= *p;
-        }
-    }
-    avg= (min + max + 1)>>1;
-
-    if(max - min <deringThreshold) return;
-
-    for(y=0; y<10; y++){
-        int t = 0;
-
-        if(src[stride*y + 0] > avg) t+= 1;
-        if(src[stride*y + 1] > avg) t+= 2;
-        if(src[stride*y + 2] > avg) t+= 4;
-        if(src[stride*y + 3] > avg) t+= 8;
-        if(src[stride*y + 4] > avg) t+= 16;
-        if(src[stride*y + 5] > avg) t+= 32;
-        if(src[stride*y + 6] > avg) t+= 64;
-        if(src[stride*y + 7] > avg) t+= 128;
-        if(src[stride*y + 8] > avg) t+= 256;
-        if(src[stride*y + 9] > avg) t+= 512;
-
-        t |= (~t)<<16;
-        t &= (t<<1) & (t>>1);
-        s[y] = t;
-    }
-
-    for(y=1; y<9; y++){
-        int t = s[y-1] & s[y] & s[y+1];
-        t|= t>>16;
-        s[y-1]= t;
-    }
-
-    for(y=1; y<9; y++){
-        int x;
-        int t = s[y-1];
-
-        p= src + stride*y;
-        for(x=1; x<9; x++){
-            p++;
-            if(t & (1<<x)){
-                int f= (*(p-stride-1)) + 2*(*(p-stride)) + (*(p-stride+1))
-                      +2*(*(p     -1)) + 4*(*p         ) + 2*(*(p     +1))
-                      +(*(p+stride-1)) + 2*(*(p+stride)) + (*(p+stride+1));
-                f= (f + 8)>>4;
-
-#ifdef DEBUG_DERING_THRESHOLD
-                    __asm__ volatile("emms\n\t":);
-                    {
-                    static long long numPixels=0;
-                    if(x!=1 && x!=8 && y!=1 && y!=8) numPixels++;
-//                    if((max-min)<20 || (max-min)*QP<200)
-//                    if((max-min)*QP < 500)
-//                    if(max-min<QP/2)
-                    if(max-min < 20){
-                        static int numSkipped=0;
-                        static int errorSum=0;
-                        static int worstQP=0;
-                        static int worstRange=0;
-                        static int worstDiff=0;
-                        int diff= (f - *p);
-                        int absDiff= FFABS(diff);
-                        int error= diff*diff;
-
-                        if(x==1 || x==8 || y==1 || y==8) continue;
-
-                        numSkipped++;
-                        if(absDiff > worstDiff){
-                            worstDiff= absDiff;
-                            worstQP= QP;
-                            worstRange= max-min;
-                        }
-                        errorSum+= error;
-
-                        if(1024LL*1024LL*1024LL % numSkipped == 0){
-                            av_log(c, AV_LOG_INFO, "sum:%1.3f, skip:%d, wQP:%d, "
-                                   "wRange:%d, wDiff:%d, relSkip:%1.3f\n",
-                                   (float)errorSum/numSkipped, numSkipped, worstQP, worstRange,
-                                   worstDiff, (float)numSkipped/numPixels);
-                        }
-                    }
-                    }
-#endif
-                    if     (*p + QP2 < f) *p= *p + QP2;
-                    else if(*p - QP2 > f) *p= *p - QP2;
-                    else *p=f;
-            }
-        }
-    }
-#ifdef DEBUG_DERING_THRESHOLD
-    if(max-min < 20){
-        for(y=1; y<9; y++){
-            int x;
-            int t = 0;
-            p= src + stride*y;
-            for(x=1; x<9; x++){
-                p++;
-                *p = FFMIN(*p + 20, 255);
-            }
-        }
-//        src[0] = src[7]=src[stride*7]=src[stride*7 + 7]=255;
-    }
-#endif
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-/**
- * Deinterlaces the given block by linearly interpolating every second line.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- */
-static inline void RENAME(deInterlaceInterpolateLinear)(uint8_t src[], int stride)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    src+= 4*stride;
-    __asm__ volatile(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_c"      \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  ecx     ecx+%1  ecx+2%1 %0+8%1  ecx+4%1
-
-        "movq (%0), %%mm0                       \n\t"
-        "movq (%%"REG_a", %1), %%mm1            \n\t"
-        PAVGB(%%mm1, %%mm0)
-        "movq %%mm0, (%%"REG_a")                \n\t"
-        "movq (%0, %1, 4), %%mm0                \n\t"
-        PAVGB(%%mm0, %%mm1)
-        "movq %%mm1, (%%"REG_a", %1, 2)         \n\t"
-        "movq (%%"REG_c", %1), %%mm1            \n\t"
-        PAVGB(%%mm1, %%mm0)
-        "movq %%mm0, (%%"REG_c")                \n\t"
-        "movq (%0, %1, 8), %%mm0                \n\t"
-        PAVGB(%%mm0, %%mm1)
-        "movq %%mm1, (%%"REG_c", %1, 2)         \n\t"
-
-        : : "r" (src), "r" ((x86_reg)stride)
-        : "%"REG_a, "%"REG_c
-    );
-#else
-    int a, b, x;
-    src+= 4*stride;
-
-    for(x=0; x<2; x++){
-        a= *(uint32_t*)&src[stride*0];
-        b= *(uint32_t*)&src[stride*2];
-        *(uint32_t*)&src[stride*1]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-        a= *(uint32_t*)&src[stride*4];
-        *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-        b= *(uint32_t*)&src[stride*6];
-        *(uint32_t*)&src[stride*5]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-        a= *(uint32_t*)&src[stride*8];
-        *(uint32_t*)&src[stride*7]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-        src += 4;
-    }
-#endif
-}
-
-/**
- * Deinterlaces the given block by cubic interpolating every second line.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 3-15 and write 7-13
- */
-static inline void RENAME(deInterlaceInterpolateCubic)(uint8_t src[], int stride)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    src+= stride*3;
-    __asm__ volatile(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
-        "lea (%%"REG_d", %1, 4), %%"REG_c"      \n\t"
-        "add %1, %%"REG_c"                      \n\t"
-        "pxor %%mm7, %%mm7                      \n\t"
-//      0       1       2       3       4       5       6       7       8       9       10
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1 ecx
-
-#define REAL_DEINT_CUBIC(a,b,c,d,e)\
-        "movq " #a ", %%mm0                     \n\t"\
-        "movq " #b ", %%mm1                     \n\t"\
-        "movq " #d ", %%mm2                     \n\t"\
-        "movq " #e ", %%mm3                     \n\t"\
-        PAVGB(%%mm2, %%mm1)                             /* (b+d) /2 */\
-        PAVGB(%%mm3, %%mm0)                             /* a(a+e) /2 */\
-        "movq %%mm0, %%mm2                      \n\t"\
-        "punpcklbw %%mm7, %%mm0                 \n\t"\
-        "punpckhbw %%mm7, %%mm2                 \n\t"\
-        "movq %%mm1, %%mm3                      \n\t"\
-        "punpcklbw %%mm7, %%mm1                 \n\t"\
-        "punpckhbw %%mm7, %%mm3                 \n\t"\
-        "psubw %%mm1, %%mm0                     \n\t"   /* L(a+e - (b+d))/2 */\
-        "psubw %%mm3, %%mm2                     \n\t"   /* H(a+e - (b+d))/2 */\
-        "psraw $3, %%mm0                        \n\t"   /* L(a+e - (b+d))/16 */\
-        "psraw $3, %%mm2                        \n\t"   /* H(a+e - (b+d))/16 */\
-        "psubw %%mm0, %%mm1                     \n\t"   /* L(9b + 9d - a - e)/16 */\
-        "psubw %%mm2, %%mm3                     \n\t"   /* H(9b + 9d - a - e)/16 */\
-        "packuswb %%mm3, %%mm1                  \n\t"\
-        "movq %%mm1, " #c "                     \n\t"
-#define DEINT_CUBIC(a,b,c,d,e)  REAL_DEINT_CUBIC(a,b,c,d,e)
-
-DEINT_CUBIC((%0)        , (%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd, %1))
-DEINT_CUBIC((%%REGa, %1), (%0, %1, 4) , (%%REGd)       , (%%REGd, %1), (%0, %1, 8))
-DEINT_CUBIC((%0, %1, 4) , (%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGc))
-DEINT_CUBIC((%%REGd, %1), (%0, %1, 8) , (%%REGd, %1, 4), (%%REGc)    , (%%REGc, %1, 2))
-
-        : : "r" (src), "r" ((x86_reg)stride)
-        : "%"REG_a, "%"REG_d, "%"REG_c
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-    int x;
-    src+= stride*3;
-    for(x=0; x<8; x++){
-        src[stride*3] = CLIP((-src[0]        + 9*src[stride*2] + 9*src[stride*4] - src[stride*6])>>4);
-        src[stride*5] = CLIP((-src[stride*2] + 9*src[stride*4] + 9*src[stride*6] - src[stride*8])>>4);
-        src[stride*7] = CLIP((-src[stride*4] + 9*src[stride*6] + 9*src[stride*8] - src[stride*10])>>4);
-        src[stride*9] = CLIP((-src[stride*6] + 9*src[stride*8] + 9*src[stride*10] - src[stride*12])>>4);
-        src++;
-    }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlaces the given block by filtering every second line with a (-1 4 2 4 -1) filter.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 4-13 and write 5-11
- */
-static inline void RENAME(deInterlaceFF)(uint8_t src[], int stride, uint8_t *tmp)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    src+= stride*4;
-    __asm__ volatile(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
-        "pxor %%mm7, %%mm7                      \n\t"
-        "movq (%2), %%mm0                       \n\t"
-//      0       1       2       3       4       5       6       7       8       9       10
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1 ecx
-
-#define REAL_DEINT_FF(a,b,c,d)\
-        "movq " #a ", %%mm1                     \n\t"\
-        "movq " #b ", %%mm2                     \n\t"\
-        "movq " #c ", %%mm3                     \n\t"\
-        "movq " #d ", %%mm4                     \n\t"\
-        PAVGB(%%mm3, %%mm1)                          \
-        PAVGB(%%mm4, %%mm0)                          \
-        "movq %%mm0, %%mm3                      \n\t"\
-        "punpcklbw %%mm7, %%mm0                 \n\t"\
-        "punpckhbw %%mm7, %%mm3                 \n\t"\
-        "movq %%mm1, %%mm4                      \n\t"\
-        "punpcklbw %%mm7, %%mm1                 \n\t"\
-        "punpckhbw %%mm7, %%mm4                 \n\t"\
-        "psllw $2, %%mm1                        \n\t"\
-        "psllw $2, %%mm4                        \n\t"\
-        "psubw %%mm0, %%mm1                     \n\t"\
-        "psubw %%mm3, %%mm4                     \n\t"\
-        "movq %%mm2, %%mm5                      \n\t"\
-        "movq %%mm2, %%mm0                      \n\t"\
-        "punpcklbw %%mm7, %%mm2                 \n\t"\
-        "punpckhbw %%mm7, %%mm5                 \n\t"\
-        "paddw %%mm2, %%mm1                     \n\t"\
-        "paddw %%mm5, %%mm4                     \n\t"\
-        "psraw $2, %%mm1                        \n\t"\
-        "psraw $2, %%mm4                        \n\t"\
-        "packuswb %%mm4, %%mm1                  \n\t"\
-        "movq %%mm1, " #b "                     \n\t"\
-
-#define DEINT_FF(a,b,c,d)  REAL_DEINT_FF(a,b,c,d)
-
-DEINT_FF((%0)        , (%%REGa)       , (%%REGa, %1), (%%REGa, %1, 2))
-DEINT_FF((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4) , (%%REGd)       )
-DEINT_FF((%0, %1, 4) , (%%REGd)       , (%%REGd, %1), (%%REGd, %1, 2))
-DEINT_FF((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8) , (%%REGd, %1, 4))
-
-        "movq %%mm0, (%2)                       \n\t"
-        : : "r" (src), "r" ((x86_reg)stride), "r"(tmp)
-        : "%"REG_a, "%"REG_d
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-    int x;
-    src+= stride*4;
-    for(x=0; x<8; x++){
-        int t1= tmp[x];
-        int t2= src[stride*1];
-
-        src[stride*1]= CLIP((-t1 + 4*src[stride*0] + 2*t2 + 4*src[stride*2] - src[stride*3] + 4)>>3);
-        t1= src[stride*4];
-        src[stride*3]= CLIP((-t2 + 4*src[stride*2] + 2*t1 + 4*src[stride*4] - src[stride*5] + 4)>>3);
-        t2= src[stride*6];
-        src[stride*5]= CLIP((-t1 + 4*src[stride*4] + 2*t2 + 4*src[stride*6] - src[stride*7] + 4)>>3);
-        t1= src[stride*8];
-        src[stride*7]= CLIP((-t2 + 4*src[stride*6] + 2*t1 + 4*src[stride*8] - src[stride*9] + 4)>>3);
-        tmp[x]= t1;
-
-        src++;
-    }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlaces the given block by filtering every line with a (-1 2 6 2 -1) filter.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 4-13 and write 4-11
- */
-static inline void RENAME(deInterlaceL5)(uint8_t src[], int stride, uint8_t *tmp, uint8_t *tmp2)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    src+= stride*4;
-    __asm__ volatile(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
-        "pxor %%mm7, %%mm7                      \n\t"
-        "movq (%2), %%mm0                       \n\t"
-        "movq (%3), %%mm1                       \n\t"
-//      0       1       2       3       4       5       6       7       8       9       10
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1 ecx
-
-#define REAL_DEINT_L5(t1,t2,a,b,c)\
-        "movq " #a ", %%mm2                     \n\t"\
-        "movq " #b ", %%mm3                     \n\t"\
-        "movq " #c ", %%mm4                     \n\t"\
-        PAVGB(t2, %%mm3)                             \
-        PAVGB(t1, %%mm4)                             \
-        "movq %%mm2, %%mm5                      \n\t"\
-        "movq %%mm2, " #t1 "                    \n\t"\
-        "punpcklbw %%mm7, %%mm2                 \n\t"\
-        "punpckhbw %%mm7, %%mm5                 \n\t"\
-        "movq %%mm2, %%mm6                      \n\t"\
-        "paddw %%mm2, %%mm2                     \n\t"\
-        "paddw %%mm6, %%mm2                     \n\t"\
-        "movq %%mm5, %%mm6                      \n\t"\
-        "paddw %%mm5, %%mm5                     \n\t"\
-        "paddw %%mm6, %%mm5                     \n\t"\
-        "movq %%mm3, %%mm6                      \n\t"\
-        "punpcklbw %%mm7, %%mm3                 \n\t"\
-        "punpckhbw %%mm7, %%mm6                 \n\t"\
-        "paddw %%mm3, %%mm3                     \n\t"\
-        "paddw %%mm6, %%mm6                     \n\t"\
-        "paddw %%mm3, %%mm2                     \n\t"\
-        "paddw %%mm6, %%mm5                     \n\t"\
-        "movq %%mm4, %%mm6                      \n\t"\
-        "punpcklbw %%mm7, %%mm4                 \n\t"\
-        "punpckhbw %%mm7, %%mm6                 \n\t"\
-        "psubw %%mm4, %%mm2                     \n\t"\
-        "psubw %%mm6, %%mm5                     \n\t"\
-        "psraw $2, %%mm2                        \n\t"\
-        "psraw $2, %%mm5                        \n\t"\
-        "packuswb %%mm5, %%mm2                  \n\t"\
-        "movq %%mm2, " #a "                     \n\t"\
-
-#define DEINT_L5(t1,t2,a,b,c)  REAL_DEINT_L5(t1,t2,a,b,c)
-
-DEINT_L5(%%mm0, %%mm1, (%0)           , (%%REGa)       , (%%REGa, %1)   )
-DEINT_L5(%%mm1, %%mm0, (%%REGa)       , (%%REGa, %1)   , (%%REGa, %1, 2))
-DEINT_L5(%%mm0, %%mm1, (%%REGa, %1)   , (%%REGa, %1, 2), (%0, %1, 4)   )
-DEINT_L5(%%mm1, %%mm0, (%%REGa, %1, 2), (%0, %1, 4)    , (%%REGd)       )
-DEINT_L5(%%mm0, %%mm1, (%0, %1, 4)    , (%%REGd)       , (%%REGd, %1)   )
-DEINT_L5(%%mm1, %%mm0, (%%REGd)       , (%%REGd, %1)   , (%%REGd, %1, 2))
-DEINT_L5(%%mm0, %%mm1, (%%REGd, %1)   , (%%REGd, %1, 2), (%0, %1, 8)   )
-DEINT_L5(%%mm1, %%mm0, (%%REGd, %1, 2), (%0, %1, 8)    , (%%REGd, %1, 4))
-
-        "movq %%mm0, (%2)                       \n\t"
-        "movq %%mm1, (%3)                       \n\t"
-        : : "r" (src), "r" ((x86_reg)stride), "r"(tmp), "r"(tmp2)
-        : "%"REG_a, "%"REG_d
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-    int x;
-    src+= stride*4;
-    for(x=0; x<8; x++){
-        int t1= tmp[x];
-        int t2= tmp2[x];
-        int t3= src[0];
-
-        src[stride*0]= CLIP((-(t1 + src[stride*2]) + 2*(t2 + src[stride*1]) + 6*t3 + 4)>>3);
-        t1= src[stride*1];
-        src[stride*1]= CLIP((-(t2 + src[stride*3]) + 2*(t3 + src[stride*2]) + 6*t1 + 4)>>3);
-        t2= src[stride*2];
-        src[stride*2]= CLIP((-(t3 + src[stride*4]) + 2*(t1 + src[stride*3]) + 6*t2 + 4)>>3);
-        t3= src[stride*3];
-        src[stride*3]= CLIP((-(t1 + src[stride*5]) + 2*(t2 + src[stride*4]) + 6*t3 + 4)>>3);
-        t1= src[stride*4];
-        src[stride*4]= CLIP((-(t2 + src[stride*6]) + 2*(t3 + src[stride*5]) + 6*t1 + 4)>>3);
-        t2= src[stride*5];
-        src[stride*5]= CLIP((-(t3 + src[stride*7]) + 2*(t1 + src[stride*6]) + 6*t2 + 4)>>3);
-        t3= src[stride*6];
-        src[stride*6]= CLIP((-(t1 + src[stride*8]) + 2*(t2 + src[stride*7]) + 6*t3 + 4)>>3);
-        t1= src[stride*7];
-        src[stride*7]= CLIP((-(t2 + src[stride*9]) + 2*(t3 + src[stride*8]) + 6*t1 + 4)>>3);
-
-        tmp[x]= t3;
-        tmp2[x]= t1;
-
-        src++;
-    }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlaces the given block by filtering all lines with a (1 2 1) filter.
- * will be called for every 8x8 block and can read & write from line 4-15
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- * this filter will read lines 4-13 and write 4-11
- */
-static inline void RENAME(deInterlaceBlendLinear)(uint8_t src[], int stride, uint8_t *tmp)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    src+= 4*stride;
-    __asm__ volatile(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1
-
-        "movq (%2), %%mm0                       \n\t" // L0
-        "movq (%%"REG_a"), %%mm1                \n\t" // L2
-        PAVGB(%%mm1, %%mm0)                           // L0+L2
-        "movq (%0), %%mm2                       \n\t" // L1
-        PAVGB(%%mm2, %%mm0)
-        "movq %%mm0, (%0)                       \n\t"
-        "movq (%%"REG_a", %1), %%mm0            \n\t" // L3
-        PAVGB(%%mm0, %%mm2)                           // L1+L3
-        PAVGB(%%mm1, %%mm2)                           // 2L2 + L1 + L3
-        "movq %%mm2, (%%"REG_a")                \n\t"
-        "movq (%%"REG_a", %1, 2), %%mm2         \n\t" // L4
-        PAVGB(%%mm2, %%mm1)                           // L2+L4
-        PAVGB(%%mm0, %%mm1)                           // 2L3 + L2 + L4
-        "movq %%mm1, (%%"REG_a", %1)            \n\t"
-        "movq (%0, %1, 4), %%mm1                \n\t" // L5
-        PAVGB(%%mm1, %%mm0)                           // L3+L5
-        PAVGB(%%mm2, %%mm0)                           // 2L4 + L3 + L5
-        "movq %%mm0, (%%"REG_a", %1, 2)         \n\t"
-        "movq (%%"REG_d"), %%mm0                \n\t" // L6
-        PAVGB(%%mm0, %%mm2)                           // L4+L6
-        PAVGB(%%mm1, %%mm2)                           // 2L5 + L4 + L6
-        "movq %%mm2, (%0, %1, 4)                \n\t"
-        "movq (%%"REG_d", %1), %%mm2            \n\t" // L7
-        PAVGB(%%mm2, %%mm1)                           // L5+L7
-        PAVGB(%%mm0, %%mm1)                           // 2L6 + L5 + L7
-        "movq %%mm1, (%%"REG_d")                \n\t"
-        "movq (%%"REG_d", %1, 2), %%mm1         \n\t" // L8
-        PAVGB(%%mm1, %%mm0)                           // L6+L8
-        PAVGB(%%mm2, %%mm0)                           // 2L7 + L6 + L8
-        "movq %%mm0, (%%"REG_d", %1)            \n\t"
-        "movq (%0, %1, 8), %%mm0                \n\t" // L9
-        PAVGB(%%mm0, %%mm2)                           // L7+L9
-        PAVGB(%%mm1, %%mm2)                           // 2L8 + L7 + L9
-        "movq %%mm2, (%%"REG_d", %1, 2)         \n\t"
-        "movq %%mm1, (%2)                       \n\t"
-
-        : : "r" (src), "r" ((x86_reg)stride), "r" (tmp)
-        : "%"REG_a, "%"REG_d
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-    int a, b, c, x;
-    src+= 4*stride;
-
-    for(x=0; x<2; x++){
-        a= *(uint32_t*)&tmp[stride*0];
-        b= *(uint32_t*)&src[stride*0];
-        c= *(uint32_t*)&src[stride*1];
-        a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*0]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-
-        a= *(uint32_t*)&src[stride*2];
-        b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*1]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
-
-        b= *(uint32_t*)&src[stride*3];
-        c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*2]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
-
-        c= *(uint32_t*)&src[stride*4];
-        a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*3]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-
-        a= *(uint32_t*)&src[stride*5];
-        b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*4]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
-
-        b= *(uint32_t*)&src[stride*6];
-        c= (b&c) + (((b^c)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*5]= (c|a) - (((c^a)&0xFEFEFEFEUL)>>1);
-
-        c= *(uint32_t*)&src[stride*7];
-        a= (a&c) + (((a^c)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*6]= (a|b) - (((a^b)&0xFEFEFEFEUL)>>1);
-
-        a= *(uint32_t*)&src[stride*8];
-        b= (a&b) + (((a^b)&0xFEFEFEFEUL)>>1);
-        *(uint32_t*)&src[stride*7]= (c|b) - (((c^b)&0xFEFEFEFEUL)>>1);
-
-        *(uint32_t*)&tmp[stride*0]= c;
-        src += 4;
-        tmp += 4;
-    }
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-
-/**
- * Deinterlaces the given block by applying a median filter to every second line.
- * will be called for every 8x8 block and can read & write from line 4-15,
- * lines 0-3 have been passed through the deblock / dering filters already, but can be read, too.
- * lines 4-12 will be read into the deblocking filter and should be deinterlaced
- */
-static inline void RENAME(deInterlaceMedian)(uint8_t src[], int stride)
-{
-#if HAVE_MMX
-    src+= 4*stride;
-#if HAVE_MMX2
-    __asm__ volatile(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1
-
-        "movq (%0), %%mm0                       \n\t" //
-        "movq (%%"REG_a", %1), %%mm2            \n\t" //
-        "movq (%%"REG_a"), %%mm1                \n\t" //
-        "movq %%mm0, %%mm3                      \n\t"
-        "pmaxub %%mm1, %%mm0                    \n\t" //
-        "pminub %%mm3, %%mm1                    \n\t" //
-        "pmaxub %%mm2, %%mm1                    \n\t" //
-        "pminub %%mm1, %%mm0                    \n\t"
-        "movq %%mm0, (%%"REG_a")                \n\t"
-
-        "movq (%0, %1, 4), %%mm0                \n\t" //
-        "movq (%%"REG_a", %1, 2), %%mm1         \n\t" //
-        "movq %%mm2, %%mm3                      \n\t"
-        "pmaxub %%mm1, %%mm2                    \n\t" //
-        "pminub %%mm3, %%mm1                    \n\t" //
-        "pmaxub %%mm0, %%mm1                    \n\t" //
-        "pminub %%mm1, %%mm2                    \n\t"
-        "movq %%mm2, (%%"REG_a", %1, 2)         \n\t"
-
-        "movq (%%"REG_d"), %%mm2                \n\t" //
-        "movq (%%"REG_d", %1), %%mm1            \n\t" //
-        "movq %%mm2, %%mm3                      \n\t"
-        "pmaxub %%mm0, %%mm2                    \n\t" //
-        "pminub %%mm3, %%mm0                    \n\t" //
-        "pmaxub %%mm1, %%mm0                    \n\t" //
-        "pminub %%mm0, %%mm2                    \n\t"
-        "movq %%mm2, (%%"REG_d")                \n\t"
-
-        "movq (%%"REG_d", %1, 2), %%mm2         \n\t" //
-        "movq (%0, %1, 8), %%mm0                \n\t" //
-        "movq %%mm2, %%mm3                      \n\t"
-        "pmaxub %%mm0, %%mm2                    \n\t" //
-        "pminub %%mm3, %%mm0                    \n\t" //
-        "pmaxub %%mm1, %%mm0                    \n\t" //
-        "pminub %%mm0, %%mm2                    \n\t"
-        "movq %%mm2, (%%"REG_d", %1, 2)         \n\t"
-
-
-        : : "r" (src), "r" ((x86_reg)stride)
-        : "%"REG_a, "%"REG_d
-    );
-
-#else // MMX without MMX2
-    __asm__ volatile(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a", %1, 4), %%"REG_d"      \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1
-        "pxor %%mm7, %%mm7                      \n\t"
-
-#define REAL_MEDIAN(a,b,c)\
-        "movq " #a ", %%mm0                     \n\t"\
-        "movq " #b ", %%mm2                     \n\t"\
-        "movq " #c ", %%mm1                     \n\t"\
-        "movq %%mm0, %%mm3                      \n\t"\
-        "movq %%mm1, %%mm4                      \n\t"\
-        "movq %%mm2, %%mm5                      \n\t"\
-        "psubusb %%mm1, %%mm3                   \n\t"\
-        "psubusb %%mm2, %%mm4                   \n\t"\
-        "psubusb %%mm0, %%mm5                   \n\t"\
-        "pcmpeqb %%mm7, %%mm3                   \n\t"\
-        "pcmpeqb %%mm7, %%mm4                   \n\t"\
-        "pcmpeqb %%mm7, %%mm5                   \n\t"\
-        "movq %%mm3, %%mm6                      \n\t"\
-        "pxor %%mm4, %%mm3                      \n\t"\
-        "pxor %%mm5, %%mm4                      \n\t"\
-        "pxor %%mm6, %%mm5                      \n\t"\
-        "por %%mm3, %%mm1                       \n\t"\
-        "por %%mm4, %%mm2                       \n\t"\
-        "por %%mm5, %%mm0                       \n\t"\
-        "pand %%mm2, %%mm0                      \n\t"\
-        "pand %%mm1, %%mm0                      \n\t"\
-        "movq %%mm0, " #b "                     \n\t"
-#define MEDIAN(a,b,c)  REAL_MEDIAN(a,b,c)
-
-MEDIAN((%0)        , (%%REGa)       , (%%REGa, %1))
-MEDIAN((%%REGa, %1), (%%REGa, %1, 2), (%0, %1, 4))
-MEDIAN((%0, %1, 4) , (%%REGd)       , (%%REGd, %1))
-MEDIAN((%%REGd, %1), (%%REGd, %1, 2), (%0, %1, 8))
-
-        : : "r" (src), "r" ((x86_reg)stride)
-        : "%"REG_a, "%"REG_d
-    );
-#endif //HAVE_MMX2
-#else //HAVE_MMX
-    int x, y;
-    src+= 4*stride;
-    // FIXME - there should be a way to do a few columns in parallel like w/mmx
-    for(x=0; x<8; x++){
-        uint8_t *colsrc = src;
-        for (y=0; y<4; y++){
-            int a, b, c, d, e, f;
-            a = colsrc[0       ];
-            b = colsrc[stride  ];
-            c = colsrc[stride*2];
-            d = (a-b)>>31;
-            e = (b-c)>>31;
-            f = (c-a)>>31;
-            colsrc[stride  ] = (a|(d^f)) & (b|(d^e)) & (c|(e^f));
-            colsrc += stride*2;
-        }
-        src++;
-    }
-#endif //HAVE_MMX
-}
-
-#if HAVE_MMX
-/**
- * transposes and shift the given 8x8 Block into dst1 and dst2
- */
-static inline void RENAME(transpose1)(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int srcStride)
-{
-    __asm__(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1
-        "movq (%0), %%mm0                       \n\t" // 12345678
-        "movq (%%"REG_a"), %%mm1                \n\t" // abcdefgh
-        "movq %%mm0, %%mm2                      \n\t" // 12345678
-        "punpcklbw %%mm1, %%mm0                 \n\t" // 1a2b3c4d
-        "punpckhbw %%mm1, %%mm2                 \n\t" // 5e6f7g8h
-
-        "movq (%%"REG_a", %1), %%mm1            \n\t"
-        "movq (%%"REG_a", %1, 2), %%mm3         \n\t"
-        "movq %%mm1, %%mm4                      \n\t"
-        "punpcklbw %%mm3, %%mm1                 \n\t"
-        "punpckhbw %%mm3, %%mm4                 \n\t"
-
-        "movq %%mm0, %%mm3                      \n\t"
-        "punpcklwd %%mm1, %%mm0                 \n\t"
-        "punpckhwd %%mm1, %%mm3                 \n\t"
-        "movq %%mm2, %%mm1                      \n\t"
-        "punpcklwd %%mm4, %%mm2                 \n\t"
-        "punpckhwd %%mm4, %%mm1                 \n\t"
-
-        "movd %%mm0, 128(%2)                    \n\t"
-        "psrlq $32, %%mm0                       \n\t"
-        "movd %%mm0, 144(%2)                    \n\t"
-        "movd %%mm3, 160(%2)                    \n\t"
-        "psrlq $32, %%mm3                       \n\t"
-        "movd %%mm3, 176(%2)                    \n\t"
-        "movd %%mm3, 48(%3)                     \n\t"
-        "movd %%mm2, 192(%2)                    \n\t"
-        "movd %%mm2, 64(%3)                     \n\t"
-        "psrlq $32, %%mm2                       \n\t"
-        "movd %%mm2, 80(%3)                     \n\t"
-        "movd %%mm1, 96(%3)                     \n\t"
-        "psrlq $32, %%mm1                       \n\t"
-        "movd %%mm1, 112(%3)                    \n\t"
-
-        "lea (%%"REG_a", %1, 4), %%"REG_a"      \n\t"
-
-        "movq (%0, %1, 4), %%mm0                \n\t" // 12345678
-        "movq (%%"REG_a"), %%mm1                \n\t" // abcdefgh
-        "movq %%mm0, %%mm2                      \n\t" // 12345678
-        "punpcklbw %%mm1, %%mm0                 \n\t" // 1a2b3c4d
-        "punpckhbw %%mm1, %%mm2                 \n\t" // 5e6f7g8h
-
-        "movq (%%"REG_a", %1), %%mm1            \n\t"
-        "movq (%%"REG_a", %1, 2), %%mm3         \n\t"
-        "movq %%mm1, %%mm4                      \n\t"
-        "punpcklbw %%mm3, %%mm1                 \n\t"
-        "punpckhbw %%mm3, %%mm4                 \n\t"
-
-        "movq %%mm0, %%mm3                      \n\t"
-        "punpcklwd %%mm1, %%mm0                 \n\t"
-        "punpckhwd %%mm1, %%mm3                 \n\t"
-        "movq %%mm2, %%mm1                      \n\t"
-        "punpcklwd %%mm4, %%mm2                 \n\t"
-        "punpckhwd %%mm4, %%mm1                 \n\t"
-
-        "movd %%mm0, 132(%2)                    \n\t"
-        "psrlq $32, %%mm0                       \n\t"
-        "movd %%mm0, 148(%2)                    \n\t"
-        "movd %%mm3, 164(%2)                    \n\t"
-        "psrlq $32, %%mm3                       \n\t"
-        "movd %%mm3, 180(%2)                    \n\t"
-        "movd %%mm3, 52(%3)                     \n\t"
-        "movd %%mm2, 196(%2)                    \n\t"
-        "movd %%mm2, 68(%3)                     \n\t"
-        "psrlq $32, %%mm2                       \n\t"
-        "movd %%mm2, 84(%3)                     \n\t"
-        "movd %%mm1, 100(%3)                    \n\t"
-        "psrlq $32, %%mm1                       \n\t"
-        "movd %%mm1, 116(%3)                    \n\t"
-
-
-        :: "r" (src), "r" ((x86_reg)srcStride), "r" (dst1), "r" (dst2)
-        : "%"REG_a
-    );
-}
-
-/**
- * transposes the given 8x8 block
- */
-static inline void RENAME(transpose2)(uint8_t *dst, int dstStride, uint8_t *src)
-{
-    __asm__(
-        "lea (%0, %1), %%"REG_a"                \n\t"
-        "lea (%%"REG_a",%1,4), %%"REG_d"        \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  edx     edx+%1  edx+2%1 %0+8%1  edx+4%1
-        "movq (%2), %%mm0                       \n\t" // 12345678
-        "movq 16(%2), %%mm1                     \n\t" // abcdefgh
-        "movq %%mm0, %%mm2                      \n\t" // 12345678
-        "punpcklbw %%mm1, %%mm0                 \n\t" // 1a2b3c4d
-        "punpckhbw %%mm1, %%mm2                 \n\t" // 5e6f7g8h
-
-        "movq 32(%2), %%mm1                     \n\t"
-        "movq 48(%2), %%mm3                     \n\t"
-        "movq %%mm1, %%mm4                      \n\t"
-        "punpcklbw %%mm3, %%mm1                 \n\t"
-        "punpckhbw %%mm3, %%mm4                 \n\t"
-
-        "movq %%mm0, %%mm3                      \n\t"
-        "punpcklwd %%mm1, %%mm0                 \n\t"
-        "punpckhwd %%mm1, %%mm3                 \n\t"
-        "movq %%mm2, %%mm1                      \n\t"
-        "punpcklwd %%mm4, %%mm2                 \n\t"
-        "punpckhwd %%mm4, %%mm1                 \n\t"
-
-        "movd %%mm0, (%0)                       \n\t"
-        "psrlq $32, %%mm0                       \n\t"
-        "movd %%mm0, (%%"REG_a")                \n\t"
-        "movd %%mm3, (%%"REG_a", %1)            \n\t"
-        "psrlq $32, %%mm3                       \n\t"
-        "movd %%mm3, (%%"REG_a", %1, 2)         \n\t"
-        "movd %%mm2, (%0, %1, 4)                \n\t"
-        "psrlq $32, %%mm2                       \n\t"
-        "movd %%mm2, (%%"REG_d")                \n\t"
-        "movd %%mm1, (%%"REG_d", %1)            \n\t"
-        "psrlq $32, %%mm1                       \n\t"
-        "movd %%mm1, (%%"REG_d", %1, 2)         \n\t"
-
-
-        "movq 64(%2), %%mm0                     \n\t" // 12345678
-        "movq 80(%2), %%mm1                     \n\t" // abcdefgh
-        "movq %%mm0, %%mm2                      \n\t" // 12345678
-        "punpcklbw %%mm1, %%mm0                 \n\t" // 1a2b3c4d
-        "punpckhbw %%mm1, %%mm2                 \n\t" // 5e6f7g8h
-
-        "movq 96(%2), %%mm1                     \n\t"
-        "movq 112(%2), %%mm3                    \n\t"
-        "movq %%mm1, %%mm4                      \n\t"
-        "punpcklbw %%mm3, %%mm1                 \n\t"
-        "punpckhbw %%mm3, %%mm4                 \n\t"
-
-        "movq %%mm0, %%mm3                      \n\t"
-        "punpcklwd %%mm1, %%mm0                 \n\t"
-        "punpckhwd %%mm1, %%mm3                 \n\t"
-        "movq %%mm2, %%mm1                      \n\t"
-        "punpcklwd %%mm4, %%mm2                 \n\t"
-        "punpckhwd %%mm4, %%mm1                 \n\t"
-
-        "movd %%mm0, 4(%0)                      \n\t"
-        "psrlq $32, %%mm0                       \n\t"
-        "movd %%mm0, 4(%%"REG_a")               \n\t"
-        "movd %%mm3, 4(%%"REG_a", %1)           \n\t"
-        "psrlq $32, %%mm3                       \n\t"
-        "movd %%mm3, 4(%%"REG_a", %1, 2)        \n\t"
-        "movd %%mm2, 4(%0, %1, 4)               \n\t"
-        "psrlq $32, %%mm2                       \n\t"
-        "movd %%mm2, 4(%%"REG_d")               \n\t"
-        "movd %%mm1, 4(%%"REG_d", %1)           \n\t"
-        "psrlq $32, %%mm1                       \n\t"
-        "movd %%mm1, 4(%%"REG_d", %1, 2)        \n\t"
-
-        :: "r" (dst), "r" ((x86_reg)dstStride), "r" (src)
-        : "%"REG_a, "%"REG_d
-    );
-}
-#endif //HAVE_MMX
-//static long test=0;
-
-#if !HAVE_ALTIVEC
-static inline void RENAME(tempNoiseReducer)(uint8_t *src, int stride,
-                                    uint8_t *tempBlurred, uint32_t *tempBlurredPast, int *maxNoise)
-{
-    // to save a register (FIXME do this outside of the loops)
-    tempBlurredPast[127]= maxNoise[0];
-    tempBlurredPast[128]= maxNoise[1];
-    tempBlurredPast[129]= maxNoise[2];
-
-#define FAST_L2_DIFF
-//#define L1_DIFF //u should change the thresholds too if u try that one
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-    __asm__ volatile(
-        "lea (%2, %2, 2), %%"REG_a"             \n\t" // 3*stride
-        "lea (%2, %2, 4), %%"REG_d"             \n\t" // 5*stride
-        "lea (%%"REG_d", %2, 2), %%"REG_c"      \n\t" // 7*stride
-//      0       1       2       3       4       5       6       7       8       9
-//      %x      %x+%2   %x+2%2  %x+eax  %x+4%2  %x+edx  %x+2eax %x+ecx  %x+8%2
-//FIXME reorder?
-#ifdef L1_DIFF //needs mmx2
-        "movq (%0), %%mm0                       \n\t" // L0
-        "psadbw (%1), %%mm0                     \n\t" // |L0-R0|
-        "movq (%0, %2), %%mm1                   \n\t" // L1
-        "psadbw (%1, %2), %%mm1                 \n\t" // |L1-R1|
-        "movq (%0, %2, 2), %%mm2                \n\t" // L2
-        "psadbw (%1, %2, 2), %%mm2              \n\t" // |L2-R2|
-        "movq (%0, %%"REG_a"), %%mm3            \n\t" // L3
-        "psadbw (%1, %%"REG_a"), %%mm3          \n\t" // |L3-R3|
-
-        "movq (%0, %2, 4), %%mm4                \n\t" // L4
-        "paddw %%mm1, %%mm0                     \n\t"
-        "psadbw (%1, %2, 4), %%mm4              \n\t" // |L4-R4|
-        "movq (%0, %%"REG_d"), %%mm5            \n\t" // L5
-        "paddw %%mm2, %%mm0                     \n\t"
-        "psadbw (%1, %%"REG_d"), %%mm5          \n\t" // |L5-R5|
-        "movq (%0, %%"REG_a", 2), %%mm6         \n\t" // L6
-        "paddw %%mm3, %%mm0                     \n\t"
-        "psadbw (%1, %%"REG_a", 2), %%mm6       \n\t" // |L6-R6|
-        "movq (%0, %%"REG_c"), %%mm7            \n\t" // L7
-        "paddw %%mm4, %%mm0                     \n\t"
-        "psadbw (%1, %%"REG_c"), %%mm7          \n\t" // |L7-R7|
-        "paddw %%mm5, %%mm6                     \n\t"
-        "paddw %%mm7, %%mm6                     \n\t"
-        "paddw %%mm6, %%mm0                     \n\t"
-#else //L1_DIFF
-#if defined (FAST_L2_DIFF)
-        "pcmpeqb %%mm7, %%mm7                   \n\t"
-        "movq "MANGLE(b80)", %%mm6              \n\t"
-        "pxor %%mm0, %%mm0                      \n\t"
-#define REAL_L2_DIFF_CORE(a, b)\
-        "movq " #a ", %%mm5                     \n\t"\
-        "movq " #b ", %%mm2                     \n\t"\
-        "pxor %%mm7, %%mm2                      \n\t"\
-        PAVGB(%%mm2, %%mm5)\
-        "paddb %%mm6, %%mm5                     \n\t"\
-        "movq %%mm5, %%mm2                      \n\t"\
-        "psllw $8, %%mm5                        \n\t"\
-        "pmaddwd %%mm5, %%mm5                   \n\t"\
-        "pmaddwd %%mm2, %%mm2                   \n\t"\
-        "paddd %%mm2, %%mm5                     \n\t"\
-        "psrld $14, %%mm5                       \n\t"\
-        "paddd %%mm5, %%mm0                     \n\t"
-
-#else //defined (FAST_L2_DIFF)
-        "pxor %%mm7, %%mm7                      \n\t"
-        "pxor %%mm0, %%mm0                      \n\t"
-#define REAL_L2_DIFF_CORE(a, b)\
-        "movq " #a ", %%mm5                     \n\t"\
-        "movq " #b ", %%mm2                     \n\t"\
-        "movq %%mm5, %%mm1                      \n\t"\
-        "movq %%mm2, %%mm3                      \n\t"\
-        "punpcklbw %%mm7, %%mm5                 \n\t"\
-        "punpckhbw %%mm7, %%mm1                 \n\t"\
-        "punpcklbw %%mm7, %%mm2                 \n\t"\
-        "punpckhbw %%mm7, %%mm3                 \n\t"\
-        "psubw %%mm2, %%mm5                     \n\t"\
-        "psubw %%mm3, %%mm1                     \n\t"\
-        "pmaddwd %%mm5, %%mm5                   \n\t"\
-        "pmaddwd %%mm1, %%mm1                   \n\t"\
-        "paddd %%mm1, %%mm5                     \n\t"\
-        "paddd %%mm5, %%mm0                     \n\t"
-
-#endif //defined (FAST_L2_DIFF)
-
-#define L2_DIFF_CORE(a, b)  REAL_L2_DIFF_CORE(a, b)
-
-L2_DIFF_CORE((%0)          , (%1))
-L2_DIFF_CORE((%0, %2)      , (%1, %2))
-L2_DIFF_CORE((%0, %2, 2)   , (%1, %2, 2))
-L2_DIFF_CORE((%0, %%REGa)  , (%1, %%REGa))
-L2_DIFF_CORE((%0, %2, 4)   , (%1, %2, 4))
-L2_DIFF_CORE((%0, %%REGd)  , (%1, %%REGd))
-L2_DIFF_CORE((%0, %%REGa,2), (%1, %%REGa,2))
-L2_DIFF_CORE((%0, %%REGc)  , (%1, %%REGc))
-
-#endif //L1_DIFF
-
-        "movq %%mm0, %%mm4                      \n\t"
-        "psrlq $32, %%mm0                       \n\t"
-        "paddd %%mm0, %%mm4                     \n\t"
-        "movd %%mm4, %%ecx                      \n\t"
-        "shll $2, %%ecx                         \n\t"
-        "mov %3, %%"REG_d"                      \n\t"
-        "addl -4(%%"REG_d"), %%ecx              \n\t"
-        "addl 4(%%"REG_d"), %%ecx               \n\t"
-        "addl -1024(%%"REG_d"), %%ecx           \n\t"
-        "addl $4, %%ecx                         \n\t"
-        "addl 1024(%%"REG_d"), %%ecx            \n\t"
-        "shrl $3, %%ecx                         \n\t"
-        "movl %%ecx, (%%"REG_d")                \n\t"
-
-//        "mov %3, %%"REG_c"                      \n\t"
-//        "mov %%"REG_c", test                    \n\t"
-//        "jmp 4f                                 \n\t"
-        "cmpl 512(%%"REG_d"), %%ecx             \n\t"
-        " jb 2f                                 \n\t"
-        "cmpl 516(%%"REG_d"), %%ecx             \n\t"
-        " jb 1f                                 \n\t"
-
-        "lea (%%"REG_a", %2, 2), %%"REG_d"      \n\t" // 5*stride
-        "lea (%%"REG_d", %2, 2), %%"REG_c"      \n\t" // 7*stride
-        "movq (%0), %%mm0                       \n\t" // L0
-        "movq (%0, %2), %%mm1                   \n\t" // L1
-        "movq (%0, %2, 2), %%mm2                \n\t" // L2
-        "movq (%0, %%"REG_a"), %%mm3            \n\t" // L3
-        "movq (%0, %2, 4), %%mm4                \n\t" // L4
-        "movq (%0, %%"REG_d"), %%mm5            \n\t" // L5
-        "movq (%0, %%"REG_a", 2), %%mm6         \n\t" // L6
-        "movq (%0, %%"REG_c"), %%mm7            \n\t" // L7
-        "movq %%mm0, (%1)                       \n\t" // L0
-        "movq %%mm1, (%1, %2)                   \n\t" // L1
-        "movq %%mm2, (%1, %2, 2)                \n\t" // L2
-        "movq %%mm3, (%1, %%"REG_a")            \n\t" // L3
-        "movq %%mm4, (%1, %2, 4)                \n\t" // L4
-        "movq %%mm5, (%1, %%"REG_d")            \n\t" // L5
-        "movq %%mm6, (%1, %%"REG_a", 2)         \n\t" // L6
-        "movq %%mm7, (%1, %%"REG_c")            \n\t" // L7
-        "jmp 4f                                 \n\t"
-
-        "1:                                     \n\t"
-        "lea (%%"REG_a", %2, 2), %%"REG_d"      \n\t" // 5*stride
-        "lea (%%"REG_d", %2, 2), %%"REG_c"      \n\t" // 7*stride
-        "movq (%0), %%mm0                       \n\t" // L0
-        PAVGB((%1), %%mm0)                            // L0
-        "movq (%0, %2), %%mm1                   \n\t" // L1
-        PAVGB((%1, %2), %%mm1)                        // L1
-        "movq (%0, %2, 2), %%mm2                \n\t" // L2
-        PAVGB((%1, %2, 2), %%mm2)                     // L2
-        "movq (%0, %%"REG_a"), %%mm3            \n\t" // L3
-        PAVGB((%1, %%REGa), %%mm3)                    // L3
-        "movq (%0, %2, 4), %%mm4                \n\t" // L4
-        PAVGB((%1, %2, 4), %%mm4)                     // L4
-        "movq (%0, %%"REG_d"), %%mm5            \n\t" // L5
-        PAVGB((%1, %%REGd), %%mm5)                    // L5
-        "movq (%0, %%"REG_a", 2), %%mm6         \n\t" // L6
-        PAVGB((%1, %%REGa, 2), %%mm6)                 // L6
-        "movq (%0, %%"REG_c"), %%mm7            \n\t" // L7
-        PAVGB((%1, %%REGc), %%mm7)                    // L7
-        "movq %%mm0, (%1)                       \n\t" // R0
-        "movq %%mm1, (%1, %2)                   \n\t" // R1
-        "movq %%mm2, (%1, %2, 2)                \n\t" // R2
-        "movq %%mm3, (%1, %%"REG_a")            \n\t" // R3
-        "movq %%mm4, (%1, %2, 4)                \n\t" // R4
-        "movq %%mm5, (%1, %%"REG_d")            \n\t" // R5
-        "movq %%mm6, (%1, %%"REG_a", 2)         \n\t" // R6
-        "movq %%mm7, (%1, %%"REG_c")            \n\t" // R7
-        "movq %%mm0, (%0)                       \n\t" // L0
-        "movq %%mm1, (%0, %2)                   \n\t" // L1
-        "movq %%mm2, (%0, %2, 2)                \n\t" // L2
-        "movq %%mm3, (%0, %%"REG_a")            \n\t" // L3
-        "movq %%mm4, (%0, %2, 4)                \n\t" // L4
-        "movq %%mm5, (%0, %%"REG_d")            \n\t" // L5
-        "movq %%mm6, (%0, %%"REG_a", 2)         \n\t" // L6
-        "movq %%mm7, (%0, %%"REG_c")            \n\t" // L7
-        "jmp 4f                                 \n\t"
-
-        "2:                                     \n\t"
-        "cmpl 508(%%"REG_d"), %%ecx             \n\t"
-        " jb 3f                                 \n\t"
-
-        "lea (%%"REG_a", %2, 2), %%"REG_d"      \n\t" // 5*stride
-        "lea (%%"REG_d", %2, 2), %%"REG_c"      \n\t" // 7*stride
-        "movq (%0), %%mm0                       \n\t" // L0
-        "movq (%0, %2), %%mm1                   \n\t" // L1
-        "movq (%0, %2, 2), %%mm2                \n\t" // L2
-        "movq (%0, %%"REG_a"), %%mm3            \n\t" // L3
-        "movq (%1), %%mm4                       \n\t" // R0
-        "movq (%1, %2), %%mm5                   \n\t" // R1
-        "movq (%1, %2, 2), %%mm6                \n\t" // R2
-        "movq (%1, %%"REG_a"), %%mm7            \n\t" // R3
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        "movq %%mm0, (%1)                       \n\t" // R0
-        "movq %%mm1, (%1, %2)                   \n\t" // R1
-        "movq %%mm2, (%1, %2, 2)                \n\t" // R2
-        "movq %%mm3, (%1, %%"REG_a")            \n\t" // R3
-        "movq %%mm0, (%0)                       \n\t" // L0
-        "movq %%mm1, (%0, %2)                   \n\t" // L1
-        "movq %%mm2, (%0, %2, 2)                \n\t" // L2
-        "movq %%mm3, (%0, %%"REG_a")            \n\t" // L3
-
-        "movq (%0, %2, 4), %%mm0                \n\t" // L4
-        "movq (%0, %%"REG_d"), %%mm1            \n\t" // L5
-        "movq (%0, %%"REG_a", 2), %%mm2         \n\t" // L6
-        "movq (%0, %%"REG_c"), %%mm3            \n\t" // L7
-        "movq (%1, %2, 4), %%mm4                \n\t" // R4
-        "movq (%1, %%"REG_d"), %%mm5            \n\t" // R5
-        "movq (%1, %%"REG_a", 2), %%mm6         \n\t" // R6
-        "movq (%1, %%"REG_c"), %%mm7            \n\t" // R7
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        "movq %%mm0, (%1, %2, 4)                \n\t" // R4
-        "movq %%mm1, (%1, %%"REG_d")            \n\t" // R5
-        "movq %%mm2, (%1, %%"REG_a", 2)         \n\t" // R6
-        "movq %%mm3, (%1, %%"REG_c")            \n\t" // R7
-        "movq %%mm0, (%0, %2, 4)                \n\t" // L4
-        "movq %%mm1, (%0, %%"REG_d")            \n\t" // L5
-        "movq %%mm2, (%0, %%"REG_a", 2)         \n\t" // L6
-        "movq %%mm3, (%0, %%"REG_c")            \n\t" // L7
-        "jmp 4f                                 \n\t"
-
-        "3:                                     \n\t"
-        "lea (%%"REG_a", %2, 2), %%"REG_d"      \n\t" // 5*stride
-        "lea (%%"REG_d", %2, 2), %%"REG_c"      \n\t" // 7*stride
-        "movq (%0), %%mm0                       \n\t" // L0
-        "movq (%0, %2), %%mm1                   \n\t" // L1
-        "movq (%0, %2, 2), %%mm2                \n\t" // L2
-        "movq (%0, %%"REG_a"), %%mm3            \n\t" // L3
-        "movq (%1), %%mm4                       \n\t" // R0
-        "movq (%1, %2), %%mm5                   \n\t" // R1
-        "movq (%1, %2, 2), %%mm6                \n\t" // R2
-        "movq (%1, %%"REG_a"), %%mm7            \n\t" // R3
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        "movq %%mm0, (%1)                       \n\t" // R0
-        "movq %%mm1, (%1, %2)                   \n\t" // R1
-        "movq %%mm2, (%1, %2, 2)                \n\t" // R2
-        "movq %%mm3, (%1, %%"REG_a")            \n\t" // R3
-        "movq %%mm0, (%0)                       \n\t" // L0
-        "movq %%mm1, (%0, %2)                   \n\t" // L1
-        "movq %%mm2, (%0, %2, 2)                \n\t" // L2
-        "movq %%mm3, (%0, %%"REG_a")            \n\t" // L3
-
-        "movq (%0, %2, 4), %%mm0                \n\t" // L4
-        "movq (%0, %%"REG_d"), %%mm1            \n\t" // L5
-        "movq (%0, %%"REG_a", 2), %%mm2         \n\t" // L6
-        "movq (%0, %%"REG_c"), %%mm3            \n\t" // L7
-        "movq (%1, %2, 4), %%mm4                \n\t" // R4
-        "movq (%1, %%"REG_d"), %%mm5            \n\t" // R5
-        "movq (%1, %%"REG_a", 2), %%mm6         \n\t" // R6
-        "movq (%1, %%"REG_c"), %%mm7            \n\t" // R7
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        PAVGB(%%mm4, %%mm0)
-        PAVGB(%%mm5, %%mm1)
-        PAVGB(%%mm6, %%mm2)
-        PAVGB(%%mm7, %%mm3)
-        "movq %%mm0, (%1, %2, 4)                \n\t" // R4
-        "movq %%mm1, (%1, %%"REG_d")            \n\t" // R5
-        "movq %%mm2, (%1, %%"REG_a", 2)         \n\t" // R6
-        "movq %%mm3, (%1, %%"REG_c")            \n\t" // R7
-        "movq %%mm0, (%0, %2, 4)                \n\t" // L4
-        "movq %%mm1, (%0, %%"REG_d")            \n\t" // L5
-        "movq %%mm2, (%0, %%"REG_a", 2)         \n\t" // L6
-        "movq %%mm3, (%0, %%"REG_c")            \n\t" // L7
-
-        "4:                                     \n\t"
-
-        :: "r" (src), "r" (tempBlurred), "r"((x86_reg)stride), "m" (tempBlurredPast)
-        : "%"REG_a, "%"REG_d, "%"REG_c, "memory"
-    );
-#else //HAVE_MMX2 || HAVE_AMD3DNOW
-{
-    int y;
-    int d=0;
-//    int sysd=0;
-    int i;
-
-    for(y=0; y<8; y++){
-        int x;
-        for(x=0; x<8; x++){
-            int ref= tempBlurred[ x + y*stride ];
-            int cur= src[ x + y*stride ];
-            int d1=ref - cur;
-//            if(x==0 || x==7) d1+= d1>>1;
-//            if(y==0 || y==7) d1+= d1>>1;
-//            d+= FFABS(d1);
-            d+= d1*d1;
-//            sysd+= d1;
-        }
-    }
-    i=d;
-    d=  (
-        4*d
-        +(*(tempBlurredPast-256))
-        +(*(tempBlurredPast-1))+ (*(tempBlurredPast+1))
-        +(*(tempBlurredPast+256))
-        +4)>>3;
-    *tempBlurredPast=i;
-//    ((*tempBlurredPast)*3 + d + 2)>>2;
-
-/*
-Switch between
- 1  0  0  0  0  0  0  (0)
-64 32 16  8  4  2  1  (1)
-64 48 36 27 20 15 11 (33) (approx)
-64 56 49 43 37 33 29 (200) (approx)
-*/
-    if(d > maxNoise[1]){
-        if(d < maxNoise[2]){
-            for(y=0; y<8; y++){
-                int x;
-                for(x=0; x<8; x++){
-                    int ref= tempBlurred[ x + y*stride ];
-                    int cur= src[ x + y*stride ];
-                    tempBlurred[ x + y*stride ]=
-                    src[ x + y*stride ]=
-                        (ref + cur + 1)>>1;
-                }
-            }
-        }else{
-            for(y=0; y<8; y++){
-                int x;
-                for(x=0; x<8; x++){
-                    tempBlurred[ x + y*stride ]= src[ x + y*stride ];
-                }
-            }
-        }
-    }else{
-        if(d < maxNoise[0]){
-            for(y=0; y<8; y++){
-                int x;
-                for(x=0; x<8; x++){
-                    int ref= tempBlurred[ x + y*stride ];
-                    int cur= src[ x + y*stride ];
-                    tempBlurred[ x + y*stride ]=
-                    src[ x + y*stride ]=
-                        (ref*7 + cur + 4)>>3;
-                }
-            }
-        }else{
-            for(y=0; y<8; y++){
-                int x;
-                for(x=0; x<8; x++){
-                    int ref= tempBlurred[ x + y*stride ];
-                    int cur= src[ x + y*stride ];
-                    tempBlurred[ x + y*stride ]=
-                    src[ x + y*stride ]=
-                        (ref*3 + cur + 2)>>2;
-                }
-            }
-        }
-    }
-}
-#endif //HAVE_MMX2 || HAVE_AMD3DNOW
-}
-#endif //HAVE_ALTIVEC
-
-#if HAVE_MMX
-/**
- * accurate deblock filter
- */
-static av_always_inline void RENAME(do_a_deblock)(uint8_t *src, int step, int stride, PPContext *c){
-    int64_t dc_mask, eq_mask, both_masks;
-    int64_t sums[10*8*2];
-    src+= step*3; // src points to begin of the 8x8 Block
-//START_TIMER
-    __asm__ volatile(
-        "movq %0, %%mm7                         \n\t"
-        "movq %1, %%mm6                         \n\t"
-        : : "m" (c->mmxDcOffset[c->nonBQP]),  "m" (c->mmxDcThreshold[c->nonBQP])
-        );
-
-    __asm__ volatile(
-        "lea (%2, %3), %%"REG_a"                \n\t"
-//      0       1       2       3       4       5       6       7       8       9
-//      %1      eax     eax+%2  eax+2%2 %1+4%2  ecx     ecx+%2  ecx+2%2 %1+8%2  ecx+4%2
-
-        "movq (%2), %%mm0                       \n\t"
-        "movq (%%"REG_a"), %%mm1                \n\t"
-        "movq %%mm1, %%mm3                      \n\t"
-        "movq %%mm1, %%mm4                      \n\t"
-        "psubb %%mm1, %%mm0                     \n\t" // mm0 = differnece
-        "paddb %%mm7, %%mm0                     \n\t"
-        "pcmpgtb %%mm6, %%mm0                   \n\t"
-
-        "movq (%%"REG_a",%3), %%mm2             \n\t"
-        PMAXUB(%%mm2, %%mm4)
-        PMINUB(%%mm2, %%mm3, %%mm5)
-        "psubb %%mm2, %%mm1                     \n\t"
-        "paddb %%mm7, %%mm1                     \n\t"
-        "pcmpgtb %%mm6, %%mm1                   \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-
-        "movq (%%"REG_a", %3, 2), %%mm1         \n\t"
-        PMAXUB(%%mm1, %%mm4)
-        PMINUB(%%mm1, %%mm3, %%mm5)
-        "psubb %%mm1, %%mm2                     \n\t"
-        "paddb %%mm7, %%mm2                     \n\t"
-        "pcmpgtb %%mm6, %%mm2                   \n\t"
-        "paddb %%mm2, %%mm0                     \n\t"
-
-        "lea (%%"REG_a", %3, 4), %%"REG_a"      \n\t"
-
-        "movq (%2, %3, 4), %%mm2                \n\t"
-        PMAXUB(%%mm2, %%mm4)
-        PMINUB(%%mm2, %%mm3, %%mm5)
-        "psubb %%mm2, %%mm1                     \n\t"
-        "paddb %%mm7, %%mm1                     \n\t"
-        "pcmpgtb %%mm6, %%mm1                   \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-
-        "movq (%%"REG_a"), %%mm1                \n\t"
-        PMAXUB(%%mm1, %%mm4)
-        PMINUB(%%mm1, %%mm3, %%mm5)
-        "psubb %%mm1, %%mm2                     \n\t"
-        "paddb %%mm7, %%mm2                     \n\t"
-        "pcmpgtb %%mm6, %%mm2                   \n\t"
-        "paddb %%mm2, %%mm0                     \n\t"
-
-        "movq (%%"REG_a", %3), %%mm2            \n\t"
-        PMAXUB(%%mm2, %%mm4)
-        PMINUB(%%mm2, %%mm3, %%mm5)
-        "psubb %%mm2, %%mm1                     \n\t"
-        "paddb %%mm7, %%mm1                     \n\t"
-        "pcmpgtb %%mm6, %%mm1                   \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-
-        "movq (%%"REG_a", %3, 2), %%mm1         \n\t"
-        PMAXUB(%%mm1, %%mm4)
-        PMINUB(%%mm1, %%mm3, %%mm5)
-        "psubb %%mm1, %%mm2                     \n\t"
-        "paddb %%mm7, %%mm2                     \n\t"
-        "pcmpgtb %%mm6, %%mm2                   \n\t"
-        "paddb %%mm2, %%mm0                     \n\t"
-
-        "movq (%2, %3, 8), %%mm2                \n\t"
-        PMAXUB(%%mm2, %%mm4)
-        PMINUB(%%mm2, %%mm3, %%mm5)
-        "psubb %%mm2, %%mm1                     \n\t"
-        "paddb %%mm7, %%mm1                     \n\t"
-        "pcmpgtb %%mm6, %%mm1                   \n\t"
-        "paddb %%mm1, %%mm0                     \n\t"
-
-        "movq (%%"REG_a", %3, 4), %%mm1         \n\t"
-        "psubb %%mm1, %%mm2                     \n\t"
-        "paddb %%mm7, %%mm2                     \n\t"
-        "pcmpgtb %%mm6, %%mm2                   \n\t"
-        "paddb %%mm2, %%mm0                     \n\t"
-        "psubusb %%mm3, %%mm4                   \n\t"
-
-        "pxor %%mm6, %%mm6                      \n\t"
-        "movq %4, %%mm7                         \n\t" // QP,..., QP
-        "paddusb %%mm7, %%mm7                   \n\t" // 2QP ... 2QP
-        "psubusb %%mm4, %%mm7                   \n\t" // Diff >=2QP -> 0
-        "pcmpeqb %%mm6, %%mm7                   \n\t" // Diff < 2QP -> 0
-        "pcmpeqb %%mm6, %%mm7                   \n\t" // Diff < 2QP -> 0
-        "movq %%mm7, %1                         \n\t"
-
-        "movq %5, %%mm7                         \n\t"
-        "punpcklbw %%mm7, %%mm7                 \n\t"
-        "punpcklbw %%mm7, %%mm7                 \n\t"
-        "punpcklbw %%mm7, %%mm7                 \n\t"
-        "psubb %%mm0, %%mm6                     \n\t"
-        "pcmpgtb %%mm7, %%mm6                   \n\t"
-        "movq %%mm6, %0                         \n\t"
-
-        : "=m" (eq_mask), "=m" (dc_mask)
-        : "r" (src), "r" ((x86_reg)step), "m" (c->pQPb), "m"(c->ppMode.flatnessThreshold)
-        : "%"REG_a
-    );
-
-    both_masks = dc_mask & eq_mask;
-
-    if(both_masks){
-        x86_reg offset= -8*step;
-        int64_t *temp_sums= sums;
-
-        __asm__ volatile(
-            "movq %2, %%mm0                         \n\t"  // QP,..., QP
-            "pxor %%mm4, %%mm4                      \n\t"
-
-            "movq (%0), %%mm6                       \n\t"
-            "movq (%0, %1), %%mm5                   \n\t"
-            "movq %%mm5, %%mm1                      \n\t"
-            "movq %%mm6, %%mm2                      \n\t"
-            "psubusb %%mm6, %%mm5                   \n\t"
-            "psubusb %%mm1, %%mm2                   \n\t"
-            "por %%mm5, %%mm2                       \n\t" // ABS Diff of lines
-            "psubusb %%mm2, %%mm0                   \n\t" // diff >= QP -> 0
-            "pcmpeqb %%mm4, %%mm0                   \n\t" // diff >= QP -> FF
-
-            "pxor %%mm6, %%mm1                      \n\t"
-            "pand %%mm0, %%mm1                      \n\t"
-            "pxor %%mm1, %%mm6                      \n\t"
-            // 0:QP  6:First
-
-            "movq (%0, %1, 8), %%mm5                \n\t"
-            "add %1, %0                             \n\t" // %0 points to line 1 not 0
-            "movq (%0, %1, 8), %%mm7                \n\t"
-            "movq %%mm5, %%mm1                      \n\t"
-            "movq %%mm7, %%mm2                      \n\t"
-            "psubusb %%mm7, %%mm5                   \n\t"
-            "psubusb %%mm1, %%mm2                   \n\t"
-            "por %%mm5, %%mm2                       \n\t" // ABS Diff of lines
-            "movq %2, %%mm0                         \n\t"  // QP,..., QP
-            "psubusb %%mm2, %%mm0                   \n\t" // diff >= QP -> 0
-            "pcmpeqb %%mm4, %%mm0                   \n\t" // diff >= QP -> FF
-
-            "pxor %%mm7, %%mm1                      \n\t"
-            "pand %%mm0, %%mm1                      \n\t"
-            "pxor %%mm1, %%mm7                      \n\t"
-
-            "movq %%mm6, %%mm5                      \n\t"
-            "punpckhbw %%mm4, %%mm6                 \n\t"
-            "punpcklbw %%mm4, %%mm5                 \n\t"
-            // 4:0 5/6:First 7:Last
-
-            "movq %%mm5, %%mm0                      \n\t"
-            "movq %%mm6, %%mm1                      \n\t"
-            "psllw $2, %%mm0                        \n\t"
-            "psllw $2, %%mm1                        \n\t"
-            "paddw "MANGLE(w04)", %%mm0             \n\t"
-            "paddw "MANGLE(w04)", %%mm1             \n\t"
-
-#define NEXT\
-            "movq (%0), %%mm2                       \n\t"\
-            "movq (%0), %%mm3                       \n\t"\
-            "add %1, %0                             \n\t"\
-            "punpcklbw %%mm4, %%mm2                 \n\t"\
-            "punpckhbw %%mm4, %%mm3                 \n\t"\
-            "paddw %%mm2, %%mm0                     \n\t"\
-            "paddw %%mm3, %%mm1                     \n\t"
-
-#define PREV\
-            "movq (%0), %%mm2                       \n\t"\
-            "movq (%0), %%mm3                       \n\t"\
-            "add %1, %0                             \n\t"\
-            "punpcklbw %%mm4, %%mm2                 \n\t"\
-            "punpckhbw %%mm4, %%mm3                 \n\t"\
-            "psubw %%mm2, %%mm0                     \n\t"\
-            "psubw %%mm3, %%mm1                     \n\t"
-
-
-            NEXT //0
-            NEXT //1
-            NEXT //2
-            "movq %%mm0, (%3)                       \n\t"
-            "movq %%mm1, 8(%3)                      \n\t"
-
-            NEXT //3
-            "psubw %%mm5, %%mm0                     \n\t"
-            "psubw %%mm6, %%mm1                     \n\t"
-            "movq %%mm0, 16(%3)                     \n\t"
-            "movq %%mm1, 24(%3)                     \n\t"
-
-            NEXT //4
-            "psubw %%mm5, %%mm0                     \n\t"
-            "psubw %%mm6, %%mm1                     \n\t"
-            "movq %%mm0, 32(%3)                     \n\t"
-            "movq %%mm1, 40(%3)                     \n\t"
-
-            NEXT //5
-            "psubw %%mm5, %%mm0                     \n\t"
-            "psubw %%mm6, %%mm1                     \n\t"
-            "movq %%mm0, 48(%3)                     \n\t"
-            "movq %%mm1, 56(%3)                     \n\t"
-
-            NEXT //6
-            "psubw %%mm5, %%mm0                     \n\t"
-            "psubw %%mm6, %%mm1                     \n\t"
-            "movq %%mm0, 64(%3)                     \n\t"
-            "movq %%mm1, 72(%3)                     \n\t"
-
-            "movq %%mm7, %%mm6                      \n\t"
-            "punpckhbw %%mm4, %%mm7                 \n\t"
-            "punpcklbw %%mm4, %%mm6                 \n\t"
-
-            NEXT //7
-            "mov %4, %0                             \n\t"
-            "add %1, %0                             \n\t"
-            PREV //0
-            "movq %%mm0, 80(%3)                     \n\t"
-            "movq %%mm1, 88(%3)                     \n\t"
-
-            PREV //1
-            "paddw %%mm6, %%mm0                     \n\t"
-            "paddw %%mm7, %%mm1                     \n\t"
-            "movq %%mm0, 96(%3)                     \n\t"
-            "movq %%mm1, 104(%3)                    \n\t"
-
-            PREV //2
-            "paddw %%mm6, %%mm0                     \n\t"
-            "paddw %%mm7, %%mm1                     \n\t"
-            "movq %%mm0, 112(%3)                    \n\t"
-            "movq %%mm1, 120(%3)                    \n\t"
-
-            PREV //3
-            "paddw %%mm6, %%mm0                     \n\t"
-            "paddw %%mm7, %%mm1                     \n\t"
-            "movq %%mm0, 128(%3)                    \n\t"
-            "movq %%mm1, 136(%3)                    \n\t"
-
-            PREV //4
-            "paddw %%mm6, %%mm0                     \n\t"
-            "paddw %%mm7, %%mm1                     \n\t"
-            "movq %%mm0, 144(%3)                    \n\t"
-            "movq %%mm1, 152(%3)                    \n\t"
-
-            "mov %4, %0                             \n\t" //FIXME
-
-            : "+&r"(src)
-            : "r" ((x86_reg)step), "m" (c->pQPb), "r"(sums), "g"(src)
-        );
-
-        src+= step; // src points to begin of the 8x8 Block
-
-        __asm__ volatile(
-            "movq %4, %%mm6                         \n\t"
-            "pcmpeqb %%mm5, %%mm5                   \n\t"
-            "pxor %%mm6, %%mm5                      \n\t"
-            "pxor %%mm7, %%mm7                      \n\t"
-
-            "1:                                     \n\t"
-            "movq (%1), %%mm0                       \n\t"
-            "movq 8(%1), %%mm1                      \n\t"
-            "paddw 32(%1), %%mm0                    \n\t"
-            "paddw 40(%1), %%mm1                    \n\t"
-            "movq (%0, %3), %%mm2                   \n\t"
-            "movq %%mm2, %%mm3                      \n\t"
-            "movq %%mm2, %%mm4                      \n\t"
-            "punpcklbw %%mm7, %%mm2                 \n\t"
-            "punpckhbw %%mm7, %%mm3                 \n\t"
-            "paddw %%mm2, %%mm0                     \n\t"
-            "paddw %%mm3, %%mm1                     \n\t"
-            "paddw %%mm2, %%mm0                     \n\t"
-            "paddw %%mm3, %%mm1                     \n\t"
-            "psrlw $4, %%mm0                        \n\t"
-            "psrlw $4, %%mm1                        \n\t"
-            "packuswb %%mm1, %%mm0                  \n\t"
-            "pand %%mm6, %%mm0                      \n\t"
-            "pand %%mm5, %%mm4                      \n\t"
-            "por %%mm4, %%mm0                       \n\t"
-            "movq %%mm0, (%0, %3)                   \n\t"
-            "add $16, %1                            \n\t"
-            "add %2, %0                             \n\t"
-            " js 1b                                 \n\t"
-
-            : "+r"(offset), "+r"(temp_sums)
-            : "r" ((x86_reg)step), "r"(src - offset), "m"(both_masks)
-        );
-    }else
-        src+= step; // src points to begin of the 8x8 Block
-
-    if(eq_mask != -1LL){
-        uint8_t *temp_src= src;
-        __asm__ volatile(
-            "pxor %%mm7, %%mm7                      \n\t"
-            "lea -40(%%"REG_SP"), %%"REG_c"         \n\t" // make space for 4 8-byte vars
-            "and "ALIGN_MASK", %%"REG_c"            \n\t" // align
-//      0       1       2       3       4       5       6       7       8       9
-//      %0      eax     eax+%1  eax+2%1 %0+4%1  ecx     ecx+%1  ecx+2%1 %1+8%1  ecx+4%1
-
-            "movq (%0), %%mm0                       \n\t"
-            "movq %%mm0, %%mm1                      \n\t"
-            "punpcklbw %%mm7, %%mm0                 \n\t" // low part of line 0
-            "punpckhbw %%mm7, %%mm1                 \n\t" // high part of line 0
-
-            "movq (%0, %1), %%mm2                   \n\t"
-            "lea (%0, %1, 2), %%"REG_a"             \n\t"
-            "movq %%mm2, %%mm3                      \n\t"
-            "punpcklbw %%mm7, %%mm2                 \n\t" // low part of line 1
-            "punpckhbw %%mm7, %%mm3                 \n\t" // high part of line 1
-
-            "movq (%%"REG_a"), %%mm4                \n\t"
-            "movq %%mm4, %%mm5                      \n\t"
-            "punpcklbw %%mm7, %%mm4                 \n\t" // low part of line 2
-            "punpckhbw %%mm7, %%mm5                 \n\t" // high part of line 2
-
-            "paddw %%mm0, %%mm0                     \n\t" // 2L0
-            "paddw %%mm1, %%mm1                     \n\t" // 2H0
-            "psubw %%mm4, %%mm2                     \n\t" // L1 - L2
-            "psubw %%mm5, %%mm3                     \n\t" // H1 - H2
-            "psubw %%mm2, %%mm0                     \n\t" // 2L0 - L1 + L2
-            "psubw %%mm3, %%mm1                     \n\t" // 2H0 - H1 + H2
-
-            "psllw $2, %%mm2                        \n\t" // 4L1 - 4L2
-            "psllw $2, %%mm3                        \n\t" // 4H1 - 4H2
-            "psubw %%mm2, %%mm0                     \n\t" // 2L0 - 5L1 + 5L2
-            "psubw %%mm3, %%mm1                     \n\t" // 2H0 - 5H1 + 5H2
-
-            "movq (%%"REG_a", %1), %%mm2            \n\t"
-            "movq %%mm2, %%mm3                      \n\t"
-            "punpcklbw %%mm7, %%mm2                 \n\t" // L3
-            "punpckhbw %%mm7, %%mm3                 \n\t" // H3
-
-            "psubw %%mm2, %%mm0                     \n\t" // 2L0 - 5L1 + 5L2 - L3
-            "psubw %%mm3, %%mm1                     \n\t" // 2H0 - 5H1 + 5H2 - H3
-            "psubw %%mm2, %%mm0                     \n\t" // 2L0 - 5L1 + 5L2 - 2L3
-            "psubw %%mm3, %%mm1                     \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-            "movq %%mm0, (%%"REG_c")                \n\t" // 2L0 - 5L1 + 5L2 - 2L3
-            "movq %%mm1, 8(%%"REG_c")               \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
-            "movq (%%"REG_a", %1, 2), %%mm0         \n\t"
-            "movq %%mm0, %%mm1                      \n\t"
-            "punpcklbw %%mm7, %%mm0                 \n\t" // L4
-            "punpckhbw %%mm7, %%mm1                 \n\t" // H4
-
-            "psubw %%mm0, %%mm2                     \n\t" // L3 - L4
-            "psubw %%mm1, %%mm3                     \n\t" // H3 - H4
-            "movq %%mm2, 16(%%"REG_c")              \n\t" // L3 - L4
-            "movq %%mm3, 24(%%"REG_c")              \n\t" // H3 - H4
-            "paddw %%mm4, %%mm4                     \n\t" // 2L2
-            "paddw %%mm5, %%mm5                     \n\t" // 2H2
-            "psubw %%mm2, %%mm4                     \n\t" // 2L2 - L3 + L4
-            "psubw %%mm3, %%mm5                     \n\t" // 2H2 - H3 + H4
-
-            "lea (%%"REG_a", %1), %0                \n\t"
-            "psllw $2, %%mm2                        \n\t" // 4L3 - 4L4
-            "psllw $2, %%mm3                        \n\t" // 4H3 - 4H4
-            "psubw %%mm2, %%mm4                     \n\t" // 2L2 - 5L3 + 5L4
-            "psubw %%mm3, %%mm5                     \n\t" // 2H2 - 5H3 + 5H4
-//50 opcodes so far
-            "movq (%0, %1, 2), %%mm2                \n\t"
-            "movq %%mm2, %%mm3                      \n\t"
-            "punpcklbw %%mm7, %%mm2                 \n\t" // L5
-            "punpckhbw %%mm7, %%mm3                 \n\t" // H5
-            "psubw %%mm2, %%mm4                     \n\t" // 2L2 - 5L3 + 5L4 - L5
-            "psubw %%mm3, %%mm5                     \n\t" // 2H2 - 5H3 + 5H4 - H5
-            "psubw %%mm2, %%mm4                     \n\t" // 2L2 - 5L3 + 5L4 - 2L5
-            "psubw %%mm3, %%mm5                     \n\t" // 2H2 - 5H3 + 5H4 - 2H5
-
-            "movq (%%"REG_a", %1, 4), %%mm6         \n\t"
-            "punpcklbw %%mm7, %%mm6                 \n\t" // L6
-            "psubw %%mm6, %%mm2                     \n\t" // L5 - L6
-            "movq (%%"REG_a", %1, 4), %%mm6         \n\t"
-            "punpckhbw %%mm7, %%mm6                 \n\t" // H6
-            "psubw %%mm6, %%mm3                     \n\t" // H5 - H6
-
-            "paddw %%mm0, %%mm0                     \n\t" // 2L4
-            "paddw %%mm1, %%mm1                     \n\t" // 2H4
-            "psubw %%mm2, %%mm0                     \n\t" // 2L4 - L5 + L6
-            "psubw %%mm3, %%mm1                     \n\t" // 2H4 - H5 + H6
-
-            "psllw $2, %%mm2                        \n\t" // 4L5 - 4L6
-            "psllw $2, %%mm3                        \n\t" // 4H5 - 4H6
-            "psubw %%mm2, %%mm0                     \n\t" // 2L4 - 5L5 + 5L6
-            "psubw %%mm3, %%mm1                     \n\t" // 2H4 - 5H5 + 5H6
-
-            "movq (%0, %1, 4), %%mm2                \n\t"
-            "movq %%mm2, %%mm3                      \n\t"
-            "punpcklbw %%mm7, %%mm2                 \n\t" // L7
-            "punpckhbw %%mm7, %%mm3                 \n\t" // H7
-
-            "paddw %%mm2, %%mm2                     \n\t" // 2L7
-            "paddw %%mm3, %%mm3                     \n\t" // 2H7
-            "psubw %%mm2, %%mm0                     \n\t" // 2L4 - 5L5 + 5L6 - 2L7
-            "psubw %%mm3, %%mm1                     \n\t" // 2H4 - 5H5 + 5H6 - 2H7
-
-            "movq (%%"REG_c"), %%mm2                \n\t" // 2L0 - 5L1 + 5L2 - 2L3
-            "movq 8(%%"REG_c"), %%mm3               \n\t" // 2H0 - 5H1 + 5H2 - 2H3
-
-#if HAVE_MMX2
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "psubw %%mm0, %%mm6                     \n\t"
-            "pmaxsw %%mm6, %%mm0                    \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "psubw %%mm1, %%mm6                     \n\t"
-            "pmaxsw %%mm6, %%mm1                    \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "psubw %%mm2, %%mm6                     \n\t"
-            "pmaxsw %%mm6, %%mm2                    \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "psubw %%mm3, %%mm6                     \n\t"
-            "pmaxsw %%mm6, %%mm3                    \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#else
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "pcmpgtw %%mm0, %%mm6                   \n\t"
-            "pxor %%mm6, %%mm0                      \n\t"
-            "psubw %%mm6, %%mm0                     \n\t" // |2L4 - 5L5 + 5L6 - 2L7|
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "pcmpgtw %%mm1, %%mm6                   \n\t"
-            "pxor %%mm6, %%mm1                      \n\t"
-            "psubw %%mm6, %%mm1                     \n\t" // |2H4 - 5H5 + 5H6 - 2H7|
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "pcmpgtw %%mm2, %%mm6                   \n\t"
-            "pxor %%mm6, %%mm2                      \n\t"
-            "psubw %%mm6, %%mm2                     \n\t" // |2L0 - 5L1 + 5L2 - 2L3|
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "pcmpgtw %%mm3, %%mm6                   \n\t"
-            "pxor %%mm6, %%mm3                      \n\t"
-            "psubw %%mm6, %%mm3                     \n\t" // |2H0 - 5H1 + 5H2 - 2H3|
-#endif
-
-#if HAVE_MMX2
-            "pminsw %%mm2, %%mm0                    \n\t"
-            "pminsw %%mm3, %%mm1                    \n\t"
-#else
-            "movq %%mm0, %%mm6                      \n\t"
-            "psubusw %%mm2, %%mm6                   \n\t"
-            "psubw %%mm6, %%mm0                     \n\t"
-            "movq %%mm1, %%mm6                      \n\t"
-            "psubusw %%mm3, %%mm6                   \n\t"
-            "psubw %%mm6, %%mm1                     \n\t"
-#endif
-
-            "movd %2, %%mm2                         \n\t" // QP
-            "punpcklbw %%mm7, %%mm2                 \n\t"
-
-            "movq %%mm7, %%mm6                      \n\t" // 0
-            "pcmpgtw %%mm4, %%mm6                   \n\t" // sign(2L2 - 5L3 + 5L4 - 2L5)
-            "pxor %%mm6, %%mm4                      \n\t"
-            "psubw %%mm6, %%mm4                     \n\t" // |2L2 - 5L3 + 5L4 - 2L5|
-            "pcmpgtw %%mm5, %%mm7                   \n\t" // sign(2H2 - 5H3 + 5H4 - 2H5)
-            "pxor %%mm7, %%mm5                      \n\t"
-            "psubw %%mm7, %%mm5                     \n\t" // |2H2 - 5H3 + 5H4 - 2H5|
-// 100 opcodes
-            "psllw $3, %%mm2                        \n\t" // 8QP
-            "movq %%mm2, %%mm3                      \n\t" // 8QP
-            "pcmpgtw %%mm4, %%mm2                   \n\t"
-            "pcmpgtw %%mm5, %%mm3                   \n\t"
-            "pand %%mm2, %%mm4                      \n\t"
-            "pand %%mm3, %%mm5                      \n\t"
-
-
-            "psubusw %%mm0, %%mm4                   \n\t" // hd
-            "psubusw %%mm1, %%mm5                   \n\t" // ld
-
-
-            "movq "MANGLE(w05)", %%mm2              \n\t" // 5
-            "pmullw %%mm2, %%mm4                    \n\t"
-            "pmullw %%mm2, %%mm5                    \n\t"
-            "movq "MANGLE(w20)", %%mm2              \n\t" // 32
-            "paddw %%mm2, %%mm4                     \n\t"
-            "paddw %%mm2, %%mm5                     \n\t"
-            "psrlw $6, %%mm4                        \n\t"
-            "psrlw $6, %%mm5                        \n\t"
-
-            "movq 16(%%"REG_c"), %%mm0              \n\t" // L3 - L4
-            "movq 24(%%"REG_c"), %%mm1              \n\t" // H3 - H4
-
-            "pxor %%mm2, %%mm2                      \n\t"
-            "pxor %%mm3, %%mm3                      \n\t"
-
-            "pcmpgtw %%mm0, %%mm2                   \n\t" // sign (L3-L4)
-            "pcmpgtw %%mm1, %%mm3                   \n\t" // sign (H3-H4)
-            "pxor %%mm2, %%mm0                      \n\t"
-            "pxor %%mm3, %%mm1                      \n\t"
-            "psubw %%mm2, %%mm0                     \n\t" // |L3-L4|
-            "psubw %%mm3, %%mm1                     \n\t" // |H3-H4|
-            "psrlw $1, %%mm0                        \n\t" // |L3 - L4|/2
-            "psrlw $1, %%mm1                        \n\t" // |H3 - H4|/2
-
-            "pxor %%mm6, %%mm2                      \n\t"
-            "pxor %%mm7, %%mm3                      \n\t"
-            "pand %%mm2, %%mm4                      \n\t"
-            "pand %%mm3, %%mm5                      \n\t"
-
-#if HAVE_MMX2
-            "pminsw %%mm0, %%mm4                    \n\t"
-            "pminsw %%mm1, %%mm5                    \n\t"
-#else
-            "movq %%mm4, %%mm2                      \n\t"
-            "psubusw %%mm0, %%mm2                   \n\t"
-            "psubw %%mm2, %%mm4                     \n\t"
-            "movq %%mm5, %%mm2                      \n\t"
-            "psubusw %%mm1, %%mm2                   \n\t"
-            "psubw %%mm2, %%mm5                     \n\t"
-#endif
-            "pxor %%mm6, %%mm4                      \n\t"
-            "pxor %%mm7, %%mm5                      \n\t"
-            "psubw %%mm6, %%mm4                     \n\t"
-            "psubw %%mm7, %%mm5                     \n\t"
-            "packsswb %%mm5, %%mm4                  \n\t"
-            "movq %3, %%mm1                         \n\t"
-            "pandn %%mm4, %%mm1                     \n\t"
-            "movq (%0), %%mm0                       \n\t"
-            "paddb   %%mm1, %%mm0                   \n\t"
-            "movq %%mm0, (%0)                       \n\t"
-            "movq (%0, %1), %%mm0                   \n\t"
-            "psubb %%mm1, %%mm0                     \n\t"
-            "movq %%mm0, (%0, %1)                   \n\t"
-
-            : "+r" (temp_src)
-            : "r" ((x86_reg)step), "m" (c->pQPb), "m"(eq_mask)
-            : "%"REG_a, "%"REG_c
-        );
-    }
-/*if(step==16){
-    STOP_TIMER("step16")
-}else{
-    STOP_TIMER("stepX")
-}*/
-}
-#endif //HAVE_MMX
-
-static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
-                                const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c);
-
-/**
- * Copies a block from src to dst and fixes the blacklevel.
- * levelFix == 0 -> do not touch the brighness & contrast
- */
-#undef REAL_SCALED_CPY
-#undef SCALED_CPY
-
-static inline void RENAME(blockCopy)(uint8_t dst[], int dstStride, const uint8_t src[], int srcStride,
-                                     int levelFix, int64_t *packedOffsetAndScale)
-{
-#if !HAVE_MMX
-    int i;
-#endif
-    if(levelFix){
-#if HAVE_MMX
-    __asm__ volatile(
-        "movq (%%"REG_a"), %%mm2        \n\t" // packedYOffset
-        "movq 8(%%"REG_a"), %%mm3       \n\t" // packedYScale
-        "lea (%2,%4), %%"REG_a"         \n\t"
-        "lea (%3,%5), %%"REG_d"         \n\t"
-        "pxor %%mm4, %%mm4              \n\t"
-#if HAVE_MMX2
-#define REAL_SCALED_CPY(src1, src2, dst1, dst2)                                                \
-        "movq " #src1 ", %%mm0          \n\t"\
-        "movq " #src1 ", %%mm5          \n\t"\
-        "movq " #src2 ", %%mm1          \n\t"\
-        "movq " #src2 ", %%mm6          \n\t"\
-        "punpcklbw %%mm0, %%mm0         \n\t"\
-        "punpckhbw %%mm5, %%mm5         \n\t"\
-        "punpcklbw %%mm1, %%mm1         \n\t"\
-        "punpckhbw %%mm6, %%mm6         \n\t"\
-        "pmulhuw %%mm3, %%mm0           \n\t"\
-        "pmulhuw %%mm3, %%mm5           \n\t"\
-        "pmulhuw %%mm3, %%mm1           \n\t"\
-        "pmulhuw %%mm3, %%mm6           \n\t"\
-        "psubw %%mm2, %%mm0             \n\t"\
-        "psubw %%mm2, %%mm5             \n\t"\
-        "psubw %%mm2, %%mm1             \n\t"\
-        "psubw %%mm2, %%mm6             \n\t"\
-        "packuswb %%mm5, %%mm0          \n\t"\
-        "packuswb %%mm6, %%mm1          \n\t"\
-        "movq %%mm0, " #dst1 "          \n\t"\
-        "movq %%mm1, " #dst2 "          \n\t"\
-
-#else //HAVE_MMX2
-#define REAL_SCALED_CPY(src1, src2, dst1, dst2)                                        \
-        "movq " #src1 ", %%mm0          \n\t"\
-        "movq " #src1 ", %%mm5          \n\t"\
-        "punpcklbw %%mm4, %%mm0         \n\t"\
-        "punpckhbw %%mm4, %%mm5         \n\t"\
-        "psubw %%mm2, %%mm0             \n\t"\
-        "psubw %%mm2, %%mm5             \n\t"\
-        "movq " #src2 ", %%mm1          \n\t"\
-        "psllw $6, %%mm0                \n\t"\
-        "psllw $6, %%mm5                \n\t"\
-        "pmulhw %%mm3, %%mm0            \n\t"\
-        "movq " #src2 ", %%mm6          \n\t"\
-        "pmulhw %%mm3, %%mm5            \n\t"\
-        "punpcklbw %%mm4, %%mm1         \n\t"\
-        "punpckhbw %%mm4, %%mm6         \n\t"\
-        "psubw %%mm2, %%mm1             \n\t"\
-        "psubw %%mm2, %%mm6             \n\t"\
-        "psllw $6, %%mm1                \n\t"\
-        "psllw $6, %%mm6                \n\t"\
-        "pmulhw %%mm3, %%mm1            \n\t"\
-        "pmulhw %%mm3, %%mm6            \n\t"\
-        "packuswb %%mm5, %%mm0          \n\t"\
-        "packuswb %%mm6, %%mm1          \n\t"\
-        "movq %%mm0, " #dst1 "          \n\t"\
-        "movq %%mm1, " #dst2 "          \n\t"\
-
-#endif //HAVE_MMX2
-#define SCALED_CPY(src1, src2, dst1, dst2)\
-   REAL_SCALED_CPY(src1, src2, dst1, dst2)
-
-SCALED_CPY((%2)       , (%2, %4)      , (%3)       , (%3, %5))
-SCALED_CPY((%2, %4, 2), (%%REGa, %4, 2), (%3, %5, 2), (%%REGd, %5, 2))
-SCALED_CPY((%2, %4, 4), (%%REGa, %4, 4), (%3, %5, 4), (%%REGd, %5, 4))
-        "lea (%%"REG_a",%4,4), %%"REG_a"        \n\t"
-        "lea (%%"REG_d",%5,4), %%"REG_d"        \n\t"
-SCALED_CPY((%%REGa, %4), (%%REGa, %4, 2), (%%REGd, %5), (%%REGd, %5, 2))
-
-
-        : "=&a" (packedOffsetAndScale)
-        : "0" (packedOffsetAndScale),
-        "r"(src),
-        "r"(dst),
-        "r" ((x86_reg)srcStride),
-        "r" ((x86_reg)dstStride)
-        : "%"REG_d
-    );
-#else //HAVE_MMX
-    for(i=0; i<8; i++)
-        memcpy( &(dst[dstStride*i]),
-                &(src[srcStride*i]), BLOCK_SIZE);
-#endif //HAVE_MMX
-    }else{
-#if HAVE_MMX
-    __asm__ volatile(
-        "lea (%0,%2), %%"REG_a"                 \n\t"
-        "lea (%1,%3), %%"REG_d"                 \n\t"
-
-#define REAL_SIMPLE_CPY(src1, src2, dst1, dst2)                              \
-        "movq " #src1 ", %%mm0          \n\t"\
-        "movq " #src2 ", %%mm1          \n\t"\
-        "movq %%mm0, " #dst1 "          \n\t"\
-        "movq %%mm1, " #dst2 "          \n\t"\
-
-#define SIMPLE_CPY(src1, src2, dst1, dst2)\
-   REAL_SIMPLE_CPY(src1, src2, dst1, dst2)
-
-SIMPLE_CPY((%0)       , (%0, %2)       , (%1)       , (%1, %3))
-SIMPLE_CPY((%0, %2, 2), (%%REGa, %2, 2), (%1, %3, 2), (%%REGd, %3, 2))
-SIMPLE_CPY((%0, %2, 4), (%%REGa, %2, 4), (%1, %3, 4), (%%REGd, %3, 4))
-        "lea (%%"REG_a",%2,4), %%"REG_a"        \n\t"
-        "lea (%%"REG_d",%3,4), %%"REG_d"        \n\t"
-SIMPLE_CPY((%%REGa, %2), (%%REGa, %2, 2), (%%REGd, %3), (%%REGd, %3, 2))
-
-        : : "r" (src),
-        "r" (dst),
-        "r" ((x86_reg)srcStride),
-        "r" ((x86_reg)dstStride)
-        : "%"REG_a, "%"REG_d
-    );
-#else //HAVE_MMX
-    for(i=0; i<8; i++)
-        memcpy( &(dst[dstStride*i]),
-                &(src[srcStride*i]), BLOCK_SIZE);
-#endif //HAVE_MMX
-    }
-}
-
-/**
- * Duplicates the given 8 src pixels ? times upward
- */
-static inline void RENAME(duplicate)(uint8_t src[], int stride)
-{
-#if HAVE_MMX
-    __asm__ volatile(
-        "movq (%0), %%mm0               \n\t"
-        "add %1, %0                     \n\t"
-        "movq %%mm0, (%0)               \n\t"
-        "movq %%mm0, (%0, %1)           \n\t"
-        "movq %%mm0, (%0, %1, 2)        \n\t"
-        : "+r" (src)
-        : "r" ((x86_reg)-stride)
-    );
-#else
-    int i;
-    uint8_t *p=src;
-    for(i=0; i<3; i++){
-        p-= stride;
-        memcpy(p, src, 8);
-    }
-#endif
-}
-
-/**
- * Filters array of bytes (Y or U or V values)
- */
-static void RENAME(postProcess)(const uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height,
-                                const QP_STORE_T QPs[], int QPStride, int isColor, PPContext *c2)
-{
-    DECLARE_ALIGNED(8, PPContext, c)= *c2; //copy to stack for faster access
-    int x,y;
-#ifdef COMPILE_TIME_MODE
-    const int mode= COMPILE_TIME_MODE;
-#else
-    const int mode= isColor ? c.ppMode.chromMode : c.ppMode.lumMode;
-#endif
-    int black=0, white=255; // blackest black and whitest white in the picture
-    int QPCorrecture= 256*256;
-
-    int copyAhead;
-#if HAVE_MMX
-    int i;
-#endif
-
-    const int qpHShift= isColor ? 4-c.hChromaSubSample : 4;
-    const int qpVShift= isColor ? 4-c.vChromaSubSample : 4;
-
-    //FIXME remove
-    uint64_t * const yHistogram= c.yHistogram;
-    uint8_t * const tempSrc= srcStride > 0 ? c.tempSrc : c.tempSrc - 23*srcStride;
-    uint8_t * const tempDst= dstStride > 0 ? c.tempDst : c.tempDst - 23*dstStride;
-    //const int mbWidth= isColor ? (width+7)>>3 : (width+15)>>4;
-
-#if HAVE_MMX
-    for(i=0; i<57; i++){
-        int offset= ((i*c.ppMode.baseDcDiff)>>8) + 1;
-        int threshold= offset*2 + 1;
-        c.mmxDcOffset[i]= 0x7F - offset;
-        c.mmxDcThreshold[i]= 0x7F - threshold;
-        c.mmxDcOffset[i]*= 0x0101010101010101LL;
-        c.mmxDcThreshold[i]*= 0x0101010101010101LL;
-    }
-#endif
-
-    if(mode & CUBIC_IPOL_DEINT_FILTER) copyAhead=16;
-    else if(   (mode & LINEAR_BLEND_DEINT_FILTER)
-            || (mode & FFMPEG_DEINT_FILTER)
-            || (mode & LOWPASS5_DEINT_FILTER)) copyAhead=14;
-    else if(   (mode & V_DEBLOCK)
-            || (mode & LINEAR_IPOL_DEINT_FILTER)
-            || (mode & MEDIAN_DEINT_FILTER)
-            || (mode & V_A_DEBLOCK)) copyAhead=13;
-    else if(mode & V_X1_FILTER) copyAhead=11;
-//    else if(mode & V_RK1_FILTER) copyAhead=10;
-    else if(mode & DERING) copyAhead=9;
-    else copyAhead=8;
-
-    copyAhead-= 8;
-
-    if(!isColor){
-        uint64_t sum= 0;
-        int i;
-        uint64_t maxClipped;
-        uint64_t clipped;
-        double scale;
-
-        c.frameNum++;
-        // first frame is fscked so we ignore it
-        if(c.frameNum == 1) yHistogram[0]= width*height/64*15/256;
-
-        for(i=0; i<256; i++){
-            sum+= yHistogram[i];
-        }
-
-        /* We always get a completely black picture first. */
-        maxClipped= (uint64_t)(sum * c.ppMode.maxClippedThreshold);
-
-        clipped= sum;
-        for(black=255; black>0; black--){
-            if(clipped < maxClipped) break;
-            clipped-= yHistogram[black];
-        }
-
-        clipped= sum;
-        for(white=0; white<256; white++){
-            if(clipped < maxClipped) break;
-            clipped-= yHistogram[white];
-        }
-
-        scale= (double)(c.ppMode.maxAllowedY - c.ppMode.minAllowedY) / (double)(white-black);
-
-#if HAVE_MMX2
-        c.packedYScale= (uint16_t)(scale*256.0 + 0.5);
-        c.packedYOffset= (((black*c.packedYScale)>>8) - c.ppMode.minAllowedY) & 0xFFFF;
-#else
-        c.packedYScale= (uint16_t)(scale*1024.0 + 0.5);
-        c.packedYOffset= (black - c.ppMode.minAllowedY) & 0xFFFF;
-#endif
-
-        c.packedYOffset|= c.packedYOffset<<32;
-        c.packedYOffset|= c.packedYOffset<<16;
-
-        c.packedYScale|= c.packedYScale<<32;
-        c.packedYScale|= c.packedYScale<<16;
-
-        if(mode & LEVEL_FIX)        QPCorrecture= (int)(scale*256*256 + 0.5);
-        else                        QPCorrecture= 256*256;
-    }else{
-        c.packedYScale= 0x0100010001000100LL;
-        c.packedYOffset= 0;
-        QPCorrecture= 256*256;
-    }
-
-    /* copy & deinterlace first row of blocks */
-    y=-BLOCK_SIZE;
-    {
-        const uint8_t *srcBlock= &(src[y*srcStride]);
-        uint8_t *dstBlock= tempDst + dstStride;
-
-        // From this point on it is guaranteed that we can read and write 16 lines downward
-        // finish 1 block before the next otherwise we might have a problem
-        // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
-        for(x=0; x<width; x+=BLOCK_SIZE){
-
-#if HAVE_MMX2
-/*
-            prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
-            prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
-            prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
-            prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
-            __asm__(
-                "mov %4, %%"REG_a"              \n\t"
-                "shr $2, %%"REG_a"              \n\t"
-                "and $6, %%"REG_a"              \n\t"
-                "add %5, %%"REG_a"              \n\t"
-                "mov %%"REG_a", %%"REG_d"       \n\t"
-                "imul %1, %%"REG_a"             \n\t"
-                "imul %3, %%"REG_d"             \n\t"
-                "prefetchnta 32(%%"REG_a", %0)  \n\t"
-                "prefetcht0 32(%%"REG_d", %2)   \n\t"
-                "add %1, %%"REG_a"              \n\t"
-                "add %3, %%"REG_d"              \n\t"
-                "prefetchnta 32(%%"REG_a", %0)  \n\t"
-                "prefetcht0 32(%%"REG_d", %2)   \n\t"
-                :: "r" (srcBlock), "r" ((x86_reg)srcStride), "r" (dstBlock), "r" ((x86_reg)dstStride),
-                "g" ((x86_reg)x), "g" ((x86_reg)copyAhead)
-                : "%"REG_a, "%"REG_d
-            );
-
-#elif HAVE_AMD3DNOW
-//FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
-/*          prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
-            prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
-            prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
-            prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
-*/
-#endif
-
-            RENAME(blockCopy)(dstBlock + dstStride*8, dstStride,
-                              srcBlock + srcStride*8, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
-
-            RENAME(duplicate)(dstBlock + dstStride*8, dstStride);
-
-            if(mode & LINEAR_IPOL_DEINT_FILTER)
-                RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
-            else if(mode & LINEAR_BLEND_DEINT_FILTER)
-                RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
-            else if(mode & MEDIAN_DEINT_FILTER)
-                RENAME(deInterlaceMedian)(dstBlock, dstStride);
-            else if(mode & CUBIC_IPOL_DEINT_FILTER)
-                RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
-            else if(mode & FFMPEG_DEINT_FILTER)
-                RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
-            else if(mode & LOWPASS5_DEINT_FILTER)
-                RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
-/*          else if(mode & CUBIC_BLEND_DEINT_FILTER)
-                RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
-*/
-            dstBlock+=8;
-            srcBlock+=8;
-        }
-        if(width==FFABS(dstStride))
-            linecpy(dst, tempDst + 9*dstStride, copyAhead, dstStride);
-        else{
-            int i;
-            for(i=0; i<copyAhead; i++){
-                memcpy(dst + i*dstStride, tempDst + (9+i)*dstStride, width);
-            }
-        }
-    }
-
-    for(y=0; y<height; y+=BLOCK_SIZE){
-        //1% speedup if these are here instead of the inner loop
-        const uint8_t *srcBlock= &(src[y*srcStride]);
-        uint8_t *dstBlock= &(dst[y*dstStride]);
-#if HAVE_MMX
-        uint8_t *tempBlock1= c.tempBlocks;
-        uint8_t *tempBlock2= c.tempBlocks + 8;
-#endif
-        const int8_t *QPptr= &QPs[(y>>qpVShift)*QPStride];
-        int8_t *nonBQPptr= &c.nonBQPTable[(y>>qpVShift)*FFABS(QPStride)];
-        int QP=0;
-        /* can we mess with a 8x16 block from srcBlock/dstBlock downwards and 1 line upwards
-           if not than use a temporary buffer */
-        if(y+15 >= height){
-            int i;
-            /* copy from line (copyAhead) to (copyAhead+7) of src, these will be copied with
-               blockcopy to dst later */
-            linecpy(tempSrc + srcStride*copyAhead, srcBlock + srcStride*copyAhead,
-                    FFMAX(height-y-copyAhead, 0), srcStride);
-
-            /* duplicate last line of src to fill the void upto line (copyAhead+7) */
-            for(i=FFMAX(height-y, 8); i<copyAhead+8; i++)
-                    memcpy(tempSrc + srcStride*i, src + srcStride*(height-1), FFABS(srcStride));
-
-            /* copy up to (copyAhead+1) lines of dst (line -1 to (copyAhead-1))*/
-            linecpy(tempDst, dstBlock - dstStride, FFMIN(height-y+1, copyAhead+1), dstStride);
-
-            /* duplicate last line of dst to fill the void upto line (copyAhead) */
-            for(i=height-y+1; i<=copyAhead; i++)
-                    memcpy(tempDst + dstStride*i, dst + dstStride*(height-1), FFABS(dstStride));
-
-            dstBlock= tempDst + dstStride;
-            srcBlock= tempSrc;
-        }
-
-        // From this point on it is guaranteed that we can read and write 16 lines downward
-        // finish 1 block before the next otherwise we might have a problem
-        // with the L1 Cache of the P4 ... or only a few blocks at a time or soemthing
-        for(x=0; x<width; x+=BLOCK_SIZE){
-            const int stride= dstStride;
-#if HAVE_MMX
-            uint8_t *tmpXchg;
-#endif
-            if(isColor){
-                QP= QPptr[x>>qpHShift];
-                c.nonBQP= nonBQPptr[x>>qpHShift];
-            }else{
-                QP= QPptr[x>>4];
-                QP= (QP* QPCorrecture + 256*128)>>16;
-                c.nonBQP= nonBQPptr[x>>4];
-                c.nonBQP= (c.nonBQP* QPCorrecture + 256*128)>>16;
-                yHistogram[ srcBlock[srcStride*12 + 4] ]++;
-            }
-            c.QP= QP;
-#if HAVE_MMX
-            __asm__ volatile(
-                "movd %1, %%mm7         \n\t"
-                "packuswb %%mm7, %%mm7  \n\t" // 0, 0, 0, QP, 0, 0, 0, QP
-                "packuswb %%mm7, %%mm7  \n\t" // 0,QP, 0, QP, 0,QP, 0, QP
-                "packuswb %%mm7, %%mm7  \n\t" // QP,..., QP
-                "movq %%mm7, %0         \n\t"
-                : "=m" (c.pQPb)
-                : "r" (QP)
-            );
-#endif
-
-
-#if HAVE_MMX2
-/*
-            prefetchnta(srcBlock + (((x>>2)&6) + 5)*srcStride + 32);
-            prefetchnta(srcBlock + (((x>>2)&6) + 6)*srcStride + 32);
-            prefetcht0(dstBlock + (((x>>2)&6) + 5)*dstStride + 32);
-            prefetcht0(dstBlock + (((x>>2)&6) + 6)*dstStride + 32);
-*/
-
-            __asm__(
-                "mov %4, %%"REG_a"              \n\t"
-                "shr $2, %%"REG_a"              \n\t"
-                "and $6, %%"REG_a"              \n\t"
-                "add %5, %%"REG_a"              \n\t"
-                "mov %%"REG_a", %%"REG_d"       \n\t"
-                "imul %1, %%"REG_a"             \n\t"
-                "imul %3, %%"REG_d"             \n\t"
-                "prefetchnta 32(%%"REG_a", %0)  \n\t"
-                "prefetcht0 32(%%"REG_d", %2)   \n\t"
-                "add %1, %%"REG_a"              \n\t"
-                "add %3, %%"REG_d"              \n\t"
-                "prefetchnta 32(%%"REG_a", %0)  \n\t"
-                "prefetcht0 32(%%"REG_d", %2)   \n\t"
-                :: "r" (srcBlock), "r" ((x86_reg)srcStride), "r" (dstBlock), "r" ((x86_reg)dstStride),
-                "g" ((x86_reg)x), "g" ((x86_reg)copyAhead)
-                : "%"REG_a, "%"REG_d
-            );
-
-#elif HAVE_AMD3DNOW
-//FIXME check if this is faster on an 3dnow chip or if it is faster without the prefetch or ...
-/*          prefetch(srcBlock + (((x>>3)&3) + 5)*srcStride + 32);
-            prefetch(srcBlock + (((x>>3)&3) + 9)*srcStride + 32);
-            prefetchw(dstBlock + (((x>>3)&3) + 5)*dstStride + 32);
-            prefetchw(dstBlock + (((x>>3)&3) + 9)*dstStride + 32);
-*/
-#endif
-
-            RENAME(blockCopy)(dstBlock + dstStride*copyAhead, dstStride,
-                              srcBlock + srcStride*copyAhead, srcStride, mode & LEVEL_FIX, &c.packedYOffset);
-
-            if(mode & LINEAR_IPOL_DEINT_FILTER)
-                RENAME(deInterlaceInterpolateLinear)(dstBlock, dstStride);
-            else if(mode & LINEAR_BLEND_DEINT_FILTER)
-                RENAME(deInterlaceBlendLinear)(dstBlock, dstStride, c.deintTemp + x);
-            else if(mode & MEDIAN_DEINT_FILTER)
-                RENAME(deInterlaceMedian)(dstBlock, dstStride);
-            else if(mode & CUBIC_IPOL_DEINT_FILTER)
-                RENAME(deInterlaceInterpolateCubic)(dstBlock, dstStride);
-            else if(mode & FFMPEG_DEINT_FILTER)
-                RENAME(deInterlaceFF)(dstBlock, dstStride, c.deintTemp + x);
-            else if(mode & LOWPASS5_DEINT_FILTER)
-                RENAME(deInterlaceL5)(dstBlock, dstStride, c.deintTemp + x, c.deintTemp + width + x);
-/*          else if(mode & CUBIC_BLEND_DEINT_FILTER)
-                RENAME(deInterlaceBlendCubic)(dstBlock, dstStride);
-*/
-
-            /* only deblock if we have 2 blocks */
-            if(y + 8 < height){
-                if(mode & V_X1_FILTER)
-                    RENAME(vertX1Filter)(dstBlock, stride, &c);
-                else if(mode & V_DEBLOCK){
-                    const int t= RENAME(vertClassify)(dstBlock, stride, &c);
-
-                    if(t==1)
-                        RENAME(doVertLowPass)(dstBlock, stride, &c);
-                    else if(t==2)
-                        RENAME(doVertDefFilter)(dstBlock, stride, &c);
-                }else if(mode & V_A_DEBLOCK){
-                    RENAME(do_a_deblock)(dstBlock, stride, 1, &c);
-                }
-            }
-
-#if HAVE_MMX
-            RENAME(transpose1)(tempBlock1, tempBlock2, dstBlock, dstStride);
-#endif
-            /* check if we have a previous block to deblock it with dstBlock */
-            if(x - 8 >= 0){
-#if HAVE_MMX
-                if(mode & H_X1_FILTER)
-                        RENAME(vertX1Filter)(tempBlock1, 16, &c);
-                else if(mode & H_DEBLOCK){
-//START_TIMER
-                    const int t= RENAME(vertClassify)(tempBlock1, 16, &c);
-//STOP_TIMER("dc & minmax")
-                    if(t==1)
-                        RENAME(doVertLowPass)(tempBlock1, 16, &c);
-                    else if(t==2)
-                        RENAME(doVertDefFilter)(tempBlock1, 16, &c);
-                }else if(mode & H_A_DEBLOCK){
-                        RENAME(do_a_deblock)(tempBlock1, 16, 1, &c);
-                }
-
-                RENAME(transpose2)(dstBlock-4, dstStride, tempBlock1 + 4*16);
-
-#else
-                if(mode & H_X1_FILTER)
-                    horizX1Filter(dstBlock-4, stride, QP);
-                else if(mode & H_DEBLOCK){
-#if HAVE_ALTIVEC
-                    DECLARE_ALIGNED(16, unsigned char, tempBlock)[272];
-                    transpose_16x8_char_toPackedAlign_altivec(tempBlock, dstBlock - (4 + 1), stride);
-
-                    const int t=vertClassify_altivec(tempBlock-48, 16, &c);
-                    if(t==1) {
-                        doVertLowPass_altivec(tempBlock-48, 16, &c);
-                        transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
-                    }
-                    else if(t==2) {
-                        doVertDefFilter_altivec(tempBlock-48, 16, &c);
-                        transpose_8x16_char_fromPackedAlign_altivec(dstBlock - (4 + 1), tempBlock, stride);
-                    }
-#else
-                    const int t= RENAME(horizClassify)(dstBlock-4, stride, &c);
-
-                    if(t==1)
-                        RENAME(doHorizLowPass)(dstBlock-4, stride, &c);
-                    else if(t==2)
-                        RENAME(doHorizDefFilter)(dstBlock-4, stride, &c);
-#endif
-                }else if(mode & H_A_DEBLOCK){
-                    RENAME(do_a_deblock)(dstBlock-8, 1, stride, &c);
-                }
-#endif //HAVE_MMX
-                if(mode & DERING){
-                //FIXME filter first line
-                    if(y>0) RENAME(dering)(dstBlock - stride - 8, stride, &c);
-                }
-
-                if(mode & TEMP_NOISE_FILTER)
-                {
-                    RENAME(tempNoiseReducer)(dstBlock-8, stride,
-                            c.tempBlurred[isColor] + y*dstStride + x,
-                            c.tempBlurredPast[isColor] + (y>>3)*256 + (x>>3),
-                            c.ppMode.maxTmpNoise);
-                }
-            }
-
-            dstBlock+=8;
-            srcBlock+=8;
-
-#if HAVE_MMX
-            tmpXchg= tempBlock1;
-            tempBlock1= tempBlock2;
-            tempBlock2 = tmpXchg;
-#endif
-        }
-
-        if(mode & DERING){
-            if(y > 0) RENAME(dering)(dstBlock - dstStride - 8, dstStride, &c);
-        }
-
-        if((mode & TEMP_NOISE_FILTER)){
-            RENAME(tempNoiseReducer)(dstBlock-8, dstStride,
-                    c.tempBlurred[isColor] + y*dstStride + x,
-                    c.tempBlurredPast[isColor] + (y>>3)*256 + (x>>3),
-                    c.ppMode.maxTmpNoise);
-        }
-
-        /* did we use a tmp buffer for the last lines*/
-        if(y+15 >= height){
-            uint8_t *dstBlock= &(dst[y*dstStride]);
-            if(width==FFABS(dstStride))
-                linecpy(dstBlock, tempDst + dstStride, height-y, dstStride);
-            else{
-                int i;
-                for(i=0; i<height-y; i++){
-                    memcpy(dstBlock + i*dstStride, tempDst + (i+1)*dstStride, width);
-                }
-            }
-        }
-/*
-        for(x=0; x<width; x+=32){
-            volatile int i;
-            i+= + dstBlock[x + 7*dstStride] + dstBlock[x + 8*dstStride]
-                + dstBlock[x + 9*dstStride] + dstBlock[x +10*dstStride]
-                + dstBlock[x +11*dstStride] + dstBlock[x +12*dstStride];
-                + dstBlock[x +13*dstStride]
-                + dstBlock[x +14*dstStride] + dstBlock[x +15*dstStride];
-        }*/
-    }
-#if   HAVE_AMD3DNOW
-    __asm__ volatile("femms");
-#elif HAVE_MMX
-    __asm__ volatile("emms");
-#endif
-
-#ifdef DEBUG_BRIGHTNESS
-    if(!isColor){
-        int max=1;
-        int i;
-        for(i=0; i<256; i++)
-            if(yHistogram[i] > max) max=yHistogram[i];
-
-        for(i=1; i<256; i++){
-            int x;
-            int start=yHistogram[i-1]/(max/256+1);
-            int end=yHistogram[i]/(max/256+1);
-            int inc= end > start ? 1 : -1;
-            for(x=start; x!=end+inc; x+=inc)
-                dst[ i*dstStride + x]+=128;
-        }
-
-        for(i=0; i<100; i+=2){
-            dst[ (white)*dstStride + i]+=128;
-            dst[ (black)*dstStride + i]+=128;
-        }
-    }
-#endif
-
-    *c2= c; //copy local context back
-
-}
diff --git a/libswscale/Makefile b/libswscale/Makefile
deleted file mode 100644
index 6976079..0000000
--- a/libswscale/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = swscale
-FFLIBS = avutil
-
-HEADERS = swscale.h
-
-OBJS = options.o rgb2rgb.o swscale.o utils.o yuv2rgb.o
-
-OBJS-$(ARCH_BFIN)          +=  bfin/internal_bfin.o     \
-                               bfin/swscale_bfin.o      \
-                               bfin/yuv2rgb_bfin.o
-OBJS-$(CONFIG_MLIB)        +=  mlib/yuv2rgb_mlib.o
-OBJS-$(HAVE_ALTIVEC)       +=  ppc/yuv2rgb_altivec.o
-OBJS-$(HAVE_MMX)           +=  x86/yuv2rgb_mmx.o
-OBJS-$(HAVE_VIS)           +=  sparc/yuv2rgb_vis.o
-
-TESTPROGS = colorspace swscale
-
-DIRS = bfin mlib ppc sparc x86
-
-include $(SUBDIR)../subdir.mak
diff --git a/libswscale/bfin/internal_bfin.S b/libswscale/bfin/internal_bfin.S
deleted file mode 100644
index 5af4654..0000000
--- a/libswscale/bfin/internal_bfin.S
+++ /dev/null
@@ -1,613 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *                    April 20, 2007
- *
- * Blackfin video color space converter operations
- * convert I420 YV12 to RGB in various formats
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-/*
-YUV420 to RGB565 conversion. This routine takes a YUV 420 planar macroblock
-and converts it to RGB565. R:5 bits, G:6 bits, B:5 bits.. packed into shorts.
-
-
-The following calculation is used for the conversion:
-
-  r = clipz((y-oy)*cy  + crv*(v-128))
-  g = clipz((y-oy)*cy  + cgv*(v-128) + cgu*(u-128))
-  b = clipz((y-oy)*cy  + cbu*(u-128))
-
-y,u,v are prescaled by a factor of 4 i.e. left-shifted to gain precision.
-
-
-New factorization to eliminate the truncation error which was
-occurring due to the byteop3p.
-
-
-1) Use the bytop16m to subtract quad bytes we use this in U8 this
- then so the offsets need to be renormalized to 8bits.
-
-2) Scale operands up by a factor of 4 not 8 because Blackfin
-   multiplies include a shift.
-
-3) Compute into the accumulators cy*yx0, cy*yx1.
-
-4) Compute each of the linear equations:
-     r = clipz((y - oy) * cy  + crv * (v - 128))
-
-     g = clipz((y - oy) * cy  + cgv * (v - 128) + cgu * (u - 128))
-
-     b = clipz((y - oy) * cy  + cbu * (u - 128))
-
-   Reuse of the accumulators requires that we actually multiply
-   twice once with addition and the second time with a subtraction.
-
-   Because of this we need to compute the equations in the order R B
-   then G saving the writes for B in the case of 24/32 bit color
-   formats.
-
-   API: yuv2rgb_kind (uint8_t *Y, uint8_t *U, uint8_t *V, int *out,
-                      int dW, uint32_t *coeffs);
-
-       A          B
-       ---        ---
-       i2 = cb    i3 = cr
-       i1 = coeff i0 = y
-
-Where coeffs have the following layout in memory.
-
-uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv;
-
-coeffs is a pointer to oy.
-
-The {rgb} masks are only utilized by the 565 packing algorithm. Note the data
-replication is used to simplify the internal algorithms for the dual Mac
-architecture of BlackFin.
-
-All routines are exported with _ff_bfin_ as a symbol prefix.
-
-Rough performance gain compared against -O3:
-
-2779809/1484290 187.28%
-
-which translates to ~33c/pel to ~57c/pel for the reference vs 17.5
-c/pel for the optimized implementations. Not sure why there is such a
-huge variation on the reference codes on Blackfin I guess it must have
-to do with the memory system.
-*/
-
-#define mL3 .text
-#if defined(__FDPIC__) && CONFIG_SRAM
-#define mL1 .l1.text
-#else
-#define mL1 mL3
-#endif
-#define MEM mL1
-
-#define DEFUN(fname,where,interface) \
-        .section where;              \
-        .global _ff_bfin_ ## fname;  \
-        .type _ff_bfin_ ## fname, STT_FUNC; \
-        .align 8;                    \
-        _ff_bfin_ ## fname
-
-#define DEFUN_END(fname) \
-        .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname
-
-
-.text
-
-#define COEFF_LEN        11*4
-#define COEFF_REL_CY_OFF 4*4
-
-#define ARG_OUT   20
-#define ARG_W     24
-#define ARG_COEFF 28
-
-DEFUN(yuv2rgb565_line,MEM,
-   (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
-        link 0;
-        [--sp] = (r7:4);
-        p1 = [fp+ARG_OUT];
-        r3 = [fp+ARG_W];
-
-        i0 = r0;
-        i2 = r1;
-        i3 = r2;
-
-        r0 = [fp+ARG_COEFF];
-        i1 = r0;
-        b1 = i1;
-        l1 = COEFF_LEN;
-        m0 = COEFF_REL_CY_OFF;
-        p0 = r3;
-
-        r0   = [i0++];         // 2Y
-        r1.l = w[i2++];        // 2u
-        r1.h = w[i3++];        // 2v
-        p0 = p0>>2;
-
-        lsetup (.L0565, .L1565) lc0 = p0;
-
-        /*
-           uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
-           r0 -- used to load 4ys
-           r1 -- used to load 2us,2vs
-           r4 -- y3,y2
-           r5 -- y1,y0
-           r6 -- u1,u0
-           r7 -- v1,v0
-        */
-                                                              r2=[i1++]; // oy
-.L0565:
-        /*
-        rrrrrrrr gggggggg bbbbbbbb
-         5432109876543210
-                    bbbbb >>3
-              gggggggg    <<3
-         rrrrrrrr         <<8
-         rrrrrggggggbbbbb
-        */
-        (r4,r5) = byteop16m (r1:0, r3:2)                   || r3=[i1++]; // oc
-        (r7,r6) = byteop16m (r1:0, r3:2) (r);
-        r5 = r5 << 2 (v);                                                // y1,y0
-        r4 = r4 << 2 (v);                                                // y3,y2
-        r6 = r6 << 2 (v)                                   || r0=[i1++]; // u1,u0, r0=zero
-        r7 = r7 << 2 (v)                                   || r1=[i1++]; // v1,v0  r1=cy
-        /* Y' = y*cy */
-        a1 = r1.h*r5.h, a0 = r1.l*r5.l                     || r1=[i1++]; // crv
-
-        /* R = Y+ crv*(Cr-128) */
-        r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
-                a1 -= r1.h*r7.l,          a0 -= r1.l*r7.l  || r5=[i1++]; // rmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cbu
-        r2 = r2 >> 3 (v);
-        r3 = r2 & r5;
-
-        /* B = Y+ cbu*(Cb-128) */
-        r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
-                a1 -= r1.h*r6.l,          a0 -= r1.l*r6.l  || r5=[i1++]; // bmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cgu
-        r2 = r2 << 8 (v);
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-
-        /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
-                a1 += r1.h*r6.l,          a0 += r1.l*r6.l  || r1=[i1++]; // cgv
-        r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r5=[i1++m0]; // gmask
-        r2 = r2 << 3 (v);
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-        [p1++]=r3                                          || r1=[i1++]; // cy
-
-        /* Y' = y*cy */
-
-        a1 = r1.h*r4.h, a0 = r1.l*r4.l                     || r1=[i1++]; // crv
-
-        /* R = Y+ crv*(Cr-128) */
-        r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
-                a1 -= r1.h*r7.h,          a0 -= r1.l*r7.h  || r5=[i1++]; // rmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cbu
-        r2 = r2 >> 3 (v);
-        r3 = r2 & r5;
-
-        /* B = Y+ cbu*(Cb-128) */
-        r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
-                a1 -= r1.h*r6.h,          a0 -= r1.l*r6.h  || r5=[i1++]; // bmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cgu
-        r2 = r2 << 8 (v);
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-
-        /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
-                a1 += r1.h*r6.h,          a0 += r1.l*r6.h  || r1=[i1++]; // cgv
-        r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h) || r5=[i1++]; // gmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r0   =  [i0++];        // 2Y
-        r2 = r2 << 3 (v)                                   || r1.l = w[i2++];        // 2u
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-        [p1++]=r3                                          || r1.h = w[i3++];        // 2v
-.L1565:                                                       r2=[i1++]; // oy
-
-        l1 = 0;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(yuv2rgb565_line)
-
-DEFUN(yuv2rgb555_line,MEM,
-   (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
-        link 0;
-        [--sp] = (r7:4);
-        p1 = [fp+ARG_OUT];
-        r3 = [fp+ARG_W];
-
-        i0 = r0;
-        i2 = r1;
-        i3 = r2;
-
-        r0 = [fp+ARG_COEFF];
-        i1 = r0;
-        b1 = i1;
-        l1 = COEFF_LEN;
-        m0 = COEFF_REL_CY_OFF;
-        p0 = r3;
-
-        r0   = [i0++];         // 2Y
-        r1.l = w[i2++];        // 2u
-        r1.h = w[i3++];        // 2v
-        p0 = p0>>2;
-
-        lsetup (.L0555, .L1555) lc0 = p0;
-
-        /*
-           uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
-           r0 -- used to load 4ys
-           r1 -- used to load 2us,2vs
-           r4 -- y3,y2
-           r5 -- y1,y0
-           r6 -- u1,u0
-           r7 -- v1,v0
-        */
-                                                              r2=[i1++]; // oy
-.L0555:
-        /*
-        rrrrrrrr gggggggg bbbbbbbb
-         5432109876543210
-                    bbbbb >>3
-               gggggggg   <<2
-          rrrrrrrr        <<7
-         xrrrrrgggggbbbbb
-        */
-
-        (r4,r5) = byteop16m (r1:0, r3:2)                   || r3=[i1++]; // oc
-        (r7,r6) = byteop16m (r1:0, r3:2) (r);
-        r5 = r5 << 2 (v);                                                // y1,y0
-        r4 = r4 << 2 (v);                                                // y3,y2
-        r6 = r6 << 2 (v)                                   || r0=[i1++]; // u1,u0, r0=zero
-        r7 = r7 << 2 (v)                                   || r1=[i1++]; // v1,v0  r1=cy
-        /* Y' = y*cy */
-        a1 = r1.h*r5.h, a0 = r1.l*r5.l                     || r1=[i1++]; // crv
-
-        /* R = Y+ crv*(Cr-128) */
-        r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
-                a1 -= r1.h*r7.l,          a0 -= r1.l*r7.l  || r5=[i1++]; // rmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cbu
-        r2 = r2 >> 3 (v);
-        r3 = r2 & r5;
-
-        /* B = Y+ cbu*(Cb-128) */
-        r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
-                a1 -= r1.h*r6.l,          a0 -= r1.l*r6.l  || r5=[i1++]; // bmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cgu
-        r2 = r2 << 7 (v);
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-
-        /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
-                a1 += r1.h*r6.l,          a0 += r1.l*r6.l  || r1=[i1++]; // cgv
-        r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r5=[i1++m0]; // gmask
-        r2 = r2 << 2 (v);
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-        [p1++]=r3                                          || r1=[i1++]; // cy
-
-        /* Y' = y*cy */
-
-        a1 = r1.h*r4.h, a0 = r1.l*r4.l                     || r1=[i1++]; // crv
-
-        /* R = Y+ crv*(Cr-128) */
-        r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
-                a1 -= r1.h*r7.h,          a0 -= r1.l*r7.h  || r5=[i1++]; // rmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cbu
-        r2 = r2 >> 3 (v);
-        r3 = r2 & r5;
-
-        /* B = Y+ cbu*(Cb-128) */
-        r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
-                a1 -= r1.h*r6.h,          a0 -= r1.l*r6.h  || r5=[i1++]; // bmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cgu
-        r2 = r2 << 7 (v);
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-
-        /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
-                a1 += r1.h*r6.h,          a0 += r1.l*r6.h  || r1=[i1++]; // cgv
-        r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h) || r5=[i1++]; // gmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r0=[i0++];     // 4Y
-        r2 = r2 << 2 (v)                                   || r1.l=w[i2++];  // 2u
-        r2 = r2 & r5;
-        r3 = r3 | r2;
-        [p1++]=r3                                          || r1.h=w[i3++]; // 2v
-
-.L1555:                                                       r2=[i1++]; // oy
-
-        l1 = 0;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(yuv2rgb555_line)
-
-DEFUN(yuv2rgb24_line,MEM,
-   (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
-        link 0;
-        [--sp] = (r7:4);
-        p1 = [fp+ARG_OUT];
-        r3 = [fp+ARG_W];
-        p2 = p1;
-        p2 += 3;
-
-        i0 = r0;
-        i2 = r1;
-        i3 = r2;
-
-        r0 = [fp+ARG_COEFF]; // coeff buffer
-        i1 = r0;
-        b1 = i1;
-        l1 = COEFF_LEN;
-        m0 = COEFF_REL_CY_OFF;
-        p0 = r3;
-
-        r0   = [i0++];         // 2Y
-        r1.l = w[i2++];        // 2u
-        r1.h = w[i3++];        // 2v
-        p0 = p0>>2;
-
-        lsetup (.L0888, .L1888) lc0 = p0;
-
-        /*
-           uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
-           r0 -- used to load 4ys
-           r1 -- used to load 2us,2vs
-           r4 -- y3,y2
-           r5 -- y1,y0
-           r6 -- u1,u0
-           r7 -- v1,v0
-        */
-                                                              r2=[i1++]; // oy
-.L0888:
-        (r4,r5) = byteop16m (r1:0, r3:2)                   || r3=[i1++]; // oc
-        (r7,r6) = byteop16m (r1:0, r3:2) (r);
-        r5 = r5 << 2 (v);               // y1,y0
-        r4 = r4 << 2 (v);               // y3,y2
-        r6 = r6 << 2 (v) || r0=[i1++];  // u1,u0, r0=zero
-        r7 = r7 << 2 (v) || r1=[i1++];  // v1,v0  r1=cy
-
-        /* Y' = y*cy */
-        a1 = r1.h*r5.h, a0 = r1.l*r5.l                     || r1=[i1++]; // crv
-
-        /* R = Y+ crv*(Cr-128) */
-        r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
-                a1 -= r1.h*r7.l,          a0 -= r1.l*r7.l  || r5=[i1++]; // rmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cbu
-        r2=r2>>16 || B[p1++]=r2;
-                     B[p2++]=r2;
-
-        /* B = Y+ cbu*(Cb-128) */
-        r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
-                a1 -= r1.h*r6.l,          a0 -= r1.l*r6.l  || r5=[i1++]; // bmask
-        r3 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cgu
-
-        /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
-                a1 += r1.h*r6.l,          a0 += r1.l*r6.l  || r1=[i1++]; // cgv
-        r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r5=[i1++m0]; // gmask, oy,cy,zero
-
-        r2=r2>>16 || B[p1++]=r2;
-                     B[p2++]=r2;
-
-        r3=r3>>16 || B[p1++]=r3;
-                     B[p2++]=r3                            || r1=[i1++]; // cy
-
-        p1+=3;
-        p2+=3;
-        /* Y' = y*cy */
-        a1 = r1.h*r4.h, a0 = r1.l*r4.l                     || r1=[i1++]; // crv
-
-        /* R = Y+ crv*(Cr-128) */
-        r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
-                a1 -= r1.h*r7.h,          a0 -= r1.l*r7.h  || r5=[i1++]; // rmask
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cbu
-        r2=r2>>16 || B[p1++]=r2;
-        B[p2++]=r2;
-
-        /* B = Y+ cbu*(Cb-128) */
-        r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
-                a1 -= r1.h*r6.h,          a0 -= r1.l*r6.h  || r5=[i1++]; // bmask
-        r3 = byteop3p(r3:2, r1:0)(LO)                      || r1=[i1++]; // cgu
-
-        /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
-                a1 += r1.h*r6.h,          a0 += r1.l*r6.h  || r1=[i1++]; // cgv
-        r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
-        r2 = byteop3p(r3:2, r1:0)(LO)                      || r5=[i1++]; // gmask
-        r2=r2>>16 || B[p1++]=r2 || r0 = [i0++];    // 4y
-                     B[p2++]=r2 || r1.l = w[i2++]; // 2u
-        r3=r3>>16 || B[p1++]=r3 || r1.h = w[i3++]; // 2v
-                     B[p2++]=r3 || r2=[i1++];      // oy
-
-        p1+=3;
-.L1888: p2+=3;
-
-        l1 = 0;
-
-        (r7:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(yuv2rgb24_line)
-
-
-
-#define ARG_vdst        20
-#define ARG_width       24
-#define ARG_height      28
-#define ARG_lumStride   32
-#define ARG_chromStride 36
-#define ARG_srcStride   40
-
-DEFUN(uyvytoyv12, mL3,  (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                         long width, long height,
-                         long lumStride, long chromStride, long srcStride)):
-        link 0;
-        [--sp] = (r7:4,p5:4);
-
-        p0 = r1;       // Y top even
-
-        i2 = r2; // *u
-        r2 = [fp + ARG_vdst];
-        i3 = r2; // *v
-
-        r1 = [fp + ARG_srcStride];
-        r2 = r0 + r1;
-        i0 = r0;  // uyvy_T even
-        i1 = r2;  // uyvy_B odd
-
-        p2 = [fp + ARG_lumStride];
-        p1 = p0 + p2;  // Y bot odd
-
-        p5 = [fp + ARG_width];
-        p4 = [fp + ARG_height];
-        r0 = p5;
-        p4 = p4 >> 1;
-        p5 = p5 >> 2;
-
-        r2 = r0 << 1;
-        r1 = r1 << 1;
-        r1 = r1 - r2;  // srcStride + (srcStride - 2*width)
-        r1 += -8;  // i0,i1 is pre read need to correct
-        m0 = r1;
-
-        r2 = [fp + ARG_chromStride];
-        r0 = r0 >> 1;
-        r2 = r2 - r0;
-        m1 = r2;
-
-        /*   I0,I1 - src input line pointers
-         *   p0,p1 - luma output line pointers
-         *   I2    - dstU
-         *   I3    - dstV
-         */
-
-        lsetup (0f, 1f) lc1 = p4;   // H/2
-0:        r0 = [i0++] || r2 = [i1++];
-          r1 = [i0++] || r3 = [i1++];
-          r4 = byteop1p(r1:0, r3:2);
-          r5 = byteop1p(r1:0, r3:2) (r);
-          lsetup (2f, 3f) lc0 = p5; // W/4
-2:          r0 = r0 >> 8(v);
-            r1 = r1 >> 8(v);
-            r2 = r2 >> 8(v);
-            r3 = r3 >> 8(v);
-            r0 = bytepack(r0, r1);
-            r2 = bytepack(r2, r3)         ||  [p0++] = r0;    // yyyy
-            r6 = pack(r5.l, r4.l)         ||  [p1++] = r2;    // yyyy
-            r7 = pack(r5.h, r4.h)         ||  r0 = [i0++] || r2 = [i1++];
-            r6 = bytepack(r6, r7)         ||  r1 = [i0++] || r3 = [i1++];
-            r4 = byteop1p(r1:0, r3:2)     ||  w[i2++] = r6.l; // uu
-3:          r5 = byteop1p(r1:0, r3:2) (r) ||  w[i3++] = r6.h; // vv
-
-          i0 += m0;
-          i1 += m0;
-          i2 += m1;
-          i3 += m1;
-          p0 = p0 + p2;
-1:        p1 = p1 + p2;
-
-        (r7:4,p5:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(uyvytoyv12)
-
-DEFUN(yuyvtoyv12, mL3,  (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                         long width, long height,
-                         long lumStride, long chromStride, long srcStride)):
-        link 0;
-        [--sp] = (r7:4,p5:4);
-
-        p0 = r1;       // Y top even
-
-        i2 = r2; // *u
-        r2 = [fp + ARG_vdst];
-        i3 = r2; // *v
-
-        r1 = [fp + ARG_srcStride];
-        r2 = r0 + r1;
-
-        i0 = r0;  // uyvy_T even
-        i1 = r2;  // uyvy_B odd
-
-        p2 = [fp + ARG_lumStride];
-        p1 = p0 + p2;  // Y bot odd
-
-        p5 = [fp + ARG_width];
-        p4 = [fp + ARG_height];
-        r0 = p5;
-        p4 = p4 >> 1;
-        p5 = p5 >> 2;
-
-        r2 = r0 << 1;
-        r1 = r1 << 1;
-        r1 = r1 - r2;  // srcStride + (srcStride - 2*width)
-        r1 += -8;  // i0,i1 is pre read need to correct
-        m0 = r1;
-
-        r2 = [fp + ARG_chromStride];
-        r0 = r0 >> 1;
-        r2 = r2 - r0;
-        m1 = r2;
-
-        /*   I0,I1 - src input line pointers
-         *   p0,p1 - luma output line pointers
-         *   I2    - dstU
-         *   I3    - dstV
-         */
-
-        lsetup (0f, 1f) lc1 = p4;   // H/2
-0:        r0 = [i0++] || r2 = [i1++];
-          r1 = [i0++] || r3 = [i1++];
-          r4 = bytepack(r0, r1);
-          r5 = bytepack(r2, r3);
-          lsetup (2f, 3f) lc0 = p5; // W/4
-2:          r0 = r0 >> 8(v) || [p0++] = r4;  // yyyy-even
-            r1 = r1 >> 8(v) || [p1++] = r5;  // yyyy-odd
-            r2 = r2 >> 8(v);
-            r3 = r3 >> 8(v);
-            r4 = byteop1p(r1:0, r3:2);
-            r5 = byteop1p(r1:0, r3:2) (r);
-            r6 = pack(r5.l, r4.l);
-            r7 = pack(r5.h, r4.h)         ||  r0 = [i0++] || r2 = [i1++];
-            r6 = bytepack(r6, r7)         ||  r1 = [i0++] || r3 = [i1++];
-            r4 = bytepack(r0, r1)         ||  w[i2++] = r6.l; // uu
-3:          r5 = bytepack(r2, r3)         ||  w[i3++] = r6.h; // vv
-
-          i0 += m0;
-          i1 += m0;
-          i2 += m1;
-          i3 += m1;
-          p0 = p0 + p2;
-1:        p1 = p1 + p2;
-
-        (r7:4,p5:4) = [sp++];
-        unlink;
-        rts;
-DEFUN_END(yuyvtoyv12)
diff --git a/libswscale/bfin/swscale_bfin.c b/libswscale/bfin/swscale_bfin.c
deleted file mode 100644
index ce2f172..0000000
--- a/libswscale/bfin/swscale_bfin.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * Blackfin software video scaler operations
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include "config.h"
-#include <unistd.h>
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#if defined (__FDPIC__) && CONFIG_SRAM
-#define L1CODE __attribute__ ((l1_text))
-#else
-#define L1CODE
-#endif
-
-int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                       long width, long height,
-                       long lumStride, long chromStride, long srcStride) L1CODE;
-
-int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                       long width, long height,
-                       long lumStride, long chromStride, long srcStride) L1CODE;
-
-static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
-    uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
-    uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
-    uint8_t *ip   = src[0] + srcStride[0]*srcSliceY;
-    int w         = dstStride[0];
-
-    ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
-                       dstStride[0], dstStride[1], srcStride[0]);
-
-    return srcSliceH;
-}
-
-static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
-    uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
-    uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
-    uint8_t *ip   = src[0] + srcStride[0]*srcSliceY;
-    int w         = dstStride[0];
-
-    ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
-                       dstStride[0], dstStride[1], srcStride[0]);
-
-    return srcSliceH;
-}
-
-
-void ff_bfin_get_unscaled_swscale(SwsContext *c)
-{
-    SwsFunc swScale = c->swScale;
-    if (c->flags & SWS_CPU_CAPS_BFIN)
-        if (c->dstFormat == PIX_FMT_YUV420P)
-            if (c->srcFormat == PIX_FMT_UYVY422) {
-                av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
-                c->swScale = uyvytoyv12_unscaled;
-            }
-        if (c->dstFormat == PIX_FMT_YUV420P)
-            if (c->srcFormat == PIX_FMT_YUYV422) {
-                av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
-                c->swScale = yuyvtoyv12_unscaled;
-            }
-}
diff --git a/libswscale/bfin/yuv2rgb_bfin.c b/libswscale/bfin/yuv2rgb_bfin.c
deleted file mode 100644
index eaa83ea..0000000
--- a/libswscale/bfin/yuv2rgb_bfin.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman at analog.com>
- *
- * Blackfin video color space converter operations
- * convert I420 YV12 to RGB in various formats
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include "config.h"
-#include <unistd.h>
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-#define L1CODE __attribute__ ((l1_text))
-#else
-#define L1CODE
-#endif
-
-void ff_bfin_yuv2rgb555_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
-                             int w, uint32_t *coeffs) L1CODE;
-
-void ff_bfin_yuv2rgb565_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
-                             int w, uint32_t *coeffs) L1CODE;
-
-void ff_bfin_yuv2rgb24_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
-                            int w, uint32_t *coeffs) L1CODE;
-
-typedef void (* ltransform)(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
-                            int w, uint32_t *coeffs);
-
-
-static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks)
-{
-    int oy;
-    oy      = c->yOffset&0xffff;
-    oy      = oy >> 3; // keep everything U8.0 for offset calculation
-
-    c->oc   = 128*0x01010101U;
-    c->oy   =  oy*0x01010101U;
-
-    /* copy 64bit vector coeffs down to 32bit vector coeffs */
-    c->cy  = c->yCoeff;
-    c->zero = 0;
-
-    if (rgb) {
-        c->crv = c->vrCoeff;
-        c->cbu = c->ubCoeff;
-        c->cgu = c->ugCoeff;
-        c->cgv = c->vgCoeff;
-    } else {
-        c->crv = c->ubCoeff;
-        c->cbu = c->vrCoeff;
-        c->cgu = c->vgCoeff;
-        c->cgv = c->ugCoeff;
-    }
-
-
-    if (masks == 555) {
-        c->rmask = 0x001f * 0x00010001U;
-        c->gmask = 0x03e0 * 0x00010001U;
-        c->bmask = 0x7c00 * 0x00010001U;
-    } else if (masks == 565) {
-        c->rmask = 0x001f * 0x00010001U;
-        c->gmask = 0x07e0 * 0x00010001U;
-        c->bmask = 0xf800 * 0x00010001U;
-    }
-}
-
-static int core_yuv420_rgb(SwsContext *c,
-                           uint8_t **in, int *instrides,
-                           int srcSliceY, int srcSliceH,
-                           uint8_t **oplanes, int *outstrides,
-                           ltransform lcscf, int rgb, int masks)
-{
-    uint8_t *py,*pu,*pv,*op;
-    int w  = instrides[0];
-    int h2 = srcSliceH>>1;
-    int i;
-
-    bfin_prepare_coefficients(c, rgb, masks);
-
-    py = in[0];
-    pu = in[1+(1^rgb)];
-    pv = in[1+(0^rgb)];
-
-    op = oplanes[0] + srcSliceY*outstrides[0];
-
-    for (i=0;i<h2;i++) {
-
-        lcscf(py, pu, pv, op, w, &c->oy);
-
-        py += instrides[0];
-        op += outstrides[0];
-
-        lcscf(py, pu, pv, op, w, &c->oy);
-
-        py += instrides[0];
-        pu += instrides[1];
-        pv += instrides[2];
-        op += outstrides[0];
-    }
-
-    return srcSliceH;
-}
-
-
-static int bfin_yuv420_rgb555(SwsContext *c,
-                              uint8_t **in, int *instrides,
-                              int srcSliceY, int srcSliceH,
-                              uint8_t **oplanes, int *outstrides)
-{
-    return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
-                           outstrides, ff_bfin_yuv2rgb555_line, 1, 555);
-}
-
-static int bfin_yuv420_bgr555(SwsContext *c,
-                              uint8_t **in, int *instrides,
-                              int srcSliceY, int srcSliceH,
-                              uint8_t **oplanes, int *outstrides)
-{
-    return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
-                           outstrides, ff_bfin_yuv2rgb555_line, 0, 555);
-}
-
-static int bfin_yuv420_rgb24(SwsContext *c,
-                             uint8_t **in, int *instrides,
-                             int srcSliceY, int srcSliceH,
-                             uint8_t **oplanes, int *outstrides)
-{
-    return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
-                           outstrides, ff_bfin_yuv2rgb24_line, 1, 888);
-}
-
-static int bfin_yuv420_bgr24(SwsContext *c,
-                             uint8_t **in, int *instrides,
-                             int srcSliceY, int srcSliceH,
-                             uint8_t **oplanes, int *outstrides)
-{
-    return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
-                           outstrides, ff_bfin_yuv2rgb24_line, 0, 888);
-}
-
-static int bfin_yuv420_rgb565(SwsContext *c,
-                              uint8_t **in, int *instrides,
-                              int srcSliceY, int srcSliceH,
-                              uint8_t **oplanes, int *outstrides)
-{
-    return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
-                           outstrides, ff_bfin_yuv2rgb565_line, 1, 565);
-}
-
-static int bfin_yuv420_bgr565(SwsContext *c,
-                              uint8_t **in, int *instrides,
-                              int srcSliceY, int srcSliceH,
-                              uint8_t **oplanes, int *outstrides)
-{
-    return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
-                           outstrides, ff_bfin_yuv2rgb565_line, 0, 565);
-}
-
-
-SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c)
-{
-    SwsFunc f;
-
-    switch(c->dstFormat) {
-    case PIX_FMT_RGB555: f = bfin_yuv420_rgb555; break;
-    case PIX_FMT_BGR555: f = bfin_yuv420_bgr555; break;
-    case PIX_FMT_RGB565: f = bfin_yuv420_rgb565; break;
-    case PIX_FMT_BGR565: f = bfin_yuv420_bgr565; break;
-    case PIX_FMT_RGB24:  f = bfin_yuv420_rgb24;  break;
-    case PIX_FMT_BGR24:  f = bfin_yuv420_bgr24;  break;
-    default:
-        return 0;
-    }
-
-    av_log(c, AV_LOG_INFO, "BlackFin accelerated color space converter %s\n",
-           sws_format_name (c->dstFormat));
-
-    return f;
-}
diff --git a/libswscale/colorspace-test.c b/libswscale/colorspace-test.c
deleted file mode 100644
index 5a48065..0000000
--- a/libswscale/colorspace-test.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <string.h>              /* for memset() */
-#include <unistd.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "swscale.h"
-#include "rgb2rgb.h"
-
-#define SIZE 1000
-#define srcByte 0x55
-#define dstByte 0xBB
-
-#define FUNC(s,d,n) {s,d,#n,n}
-
-static int cpu_caps;
-
-static char *args_parse(int argc, char *argv[])
-{
-    int o;
-
-    while ((o = getopt(argc, argv, "m23")) != -1) {
-        switch (o) {
-        case 'm':
-            cpu_caps |= SWS_CPU_CAPS_MMX;
-            break;
-        case '2':
-            cpu_caps |= SWS_CPU_CAPS_MMX2;
-            break;
-        case '3':
-            cpu_caps |= SWS_CPU_CAPS_3DNOW;
-            break;
-        default:
-            av_log(NULL, AV_LOG_ERROR, "Unknown option %c\n", o);
-        }
-    }
-
-    return argv[optind];
-}
-
-int main(int argc, char **argv)
-{
-    int i, funcNum;
-    uint8_t *srcBuffer= (uint8_t*)av_malloc(SIZE);
-    uint8_t *dstBuffer= (uint8_t*)av_malloc(SIZE);
-    int failedNum=0;
-    int passedNum=0;
-
-    if (!srcBuffer || !dstBuffer)
-        return -1;
-
-    av_log(NULL, AV_LOG_INFO, "memory corruption test ...\n");
-    args_parse(argc, argv);
-    av_log(NULL, AV_LOG_INFO, "CPU capabilities forced to %x\n", cpu_caps);
-    sws_rgb2rgb_init(cpu_caps);
-
-    for(funcNum=0; ; funcNum++) {
-        struct func_info_s {
-            int src_bpp;
-            int dst_bpp;
-            const char *name;
-            void (*func)(const uint8_t *src, uint8_t *dst, long src_size);
-        } func_info[] = {
-            FUNC(2, 2, rgb15to16),
-            FUNC(2, 3, rgb15to24),
-            FUNC(2, 4, rgb15to32),
-            FUNC(2, 3, rgb16to24),
-            FUNC(2, 4, rgb16to32),
-            FUNC(3, 2, rgb24to15),
-            FUNC(3, 2, rgb24to16),
-            FUNC(3, 4, rgb24to32),
-            FUNC(4, 2, rgb32to15),
-            FUNC(4, 2, rgb32to16),
-            FUNC(4, 3, rgb32to24),
-            FUNC(2, 2, rgb16to15),
-            FUNC(2, 2, rgb15tobgr15),
-            FUNC(2, 2, rgb15tobgr16),
-            FUNC(2, 3, rgb15tobgr24),
-            FUNC(2, 4, rgb15tobgr32),
-            FUNC(2, 2, rgb16tobgr15),
-            FUNC(2, 2, rgb16tobgr16),
-            FUNC(2, 3, rgb16tobgr24),
-            FUNC(2, 4, rgb16tobgr32),
-            FUNC(3, 2, rgb24tobgr15),
-            FUNC(3, 2, rgb24tobgr16),
-            FUNC(3, 3, rgb24tobgr24),
-            FUNC(3, 4, rgb24tobgr32),
-            FUNC(4, 2, rgb32tobgr15),
-            FUNC(4, 2, rgb32tobgr16),
-            FUNC(4, 3, rgb32tobgr24),
-            FUNC(4, 4, rgb32tobgr32),
-            FUNC(0, 0, NULL)
-        };
-        int width;
-        int failed=0;
-        int srcBpp=0;
-        int dstBpp=0;
-
-        if (!func_info[funcNum].func) break;
-
-        av_log(NULL, AV_LOG_INFO,".");
-        memset(srcBuffer, srcByte, SIZE);
-
-        for(width=63; width>0; width--) {
-            int dstOffset;
-            for(dstOffset=128; dstOffset<196; dstOffset+=4) {
-                int srcOffset;
-                memset(dstBuffer, dstByte, SIZE);
-
-                for(srcOffset=128; srcOffset<196; srcOffset+=4) {
-                    uint8_t *src= srcBuffer+srcOffset;
-                    uint8_t *dst= dstBuffer+dstOffset;
-                    const char *name=NULL;
-
-                    if(failed) break; //don't fill the screen with shit ...
-
-                    srcBpp = func_info[funcNum].src_bpp;
-                    dstBpp = func_info[funcNum].dst_bpp;
-                    name   = func_info[funcNum].name;
-
-                    func_info[funcNum].func(src, dst, width*srcBpp);
-
-                    if(!srcBpp) break;
-
-                    for(i=0; i<SIZE; i++) {
-                        if(srcBuffer[i]!=srcByte) {
-                            av_log(NULL, AV_LOG_INFO, "src damaged at %d w:%d src:%d dst:%d %s\n",
-                                   i, width, srcOffset, dstOffset, name);
-                            failed=1;
-                            break;
-                        }
-                    }
-                    for(i=0; i<dstOffset; i++) {
-                        if(dstBuffer[i]!=dstByte) {
-                            av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n",
-                                   i, width, srcOffset, dstOffset, name);
-                            failed=1;
-                            break;
-                        }
-                    }
-                    for(i=dstOffset + width*dstBpp; i<SIZE; i++) {
-                        if(dstBuffer[i]!=dstByte) {
-                            av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n",
-                                   i, width, srcOffset, dstOffset, name);
-                            failed=1;
-                            break;
-                        }
-                    }
-                }
-            }
-        }
-        if(failed) failedNum++;
-        else if(srcBpp) passedNum++;
-    }
-
-    av_log(NULL, AV_LOG_INFO, "\n%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum);
-    return failedNum;
-}
diff --git a/libswscale/libswscale.v b/libswscale/libswscale.v
deleted file mode 100644
index c68f153..0000000
--- a/libswscale/libswscale.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBSWSCALE_$MAJOR {
-        global: swscale_*; sws_*; ff_*;
-        local: *;
-};
diff --git a/libswscale/mlib/yuv2rgb_mlib.c b/libswscale/mlib/yuv2rgb_mlib.c
deleted file mode 100644
index 011b0ef..0000000
--- a/libswscale/mlib/yuv2rgb_mlib.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * software YUV to RGB converter using mediaLib
- *
- * Copyright (C) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <mlib_types.h>
-#include <mlib_status.h>
-#include <mlib_sys.h>
-#include <mlib_video.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "libswscale/swscale.h"
-
-static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    if(c->srcFormat == PIX_FMT_YUV422P) {
-        srcStride[1] *= 2;
-        srcStride[2] *= 2;
-    }
-
-    assert(srcStride[1] == srcStride[2]);
-
-    mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
-                               srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
-    return srcSliceH;
-}
-
-static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    if(c->srcFormat == PIX_FMT_YUV422P) {
-        srcStride[1] *= 2;
-        srcStride[2] *= 2;
-    }
-
-    assert(srcStride[1] == srcStride[2]);
-
-    mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
-                               srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
-    return srcSliceH;
-}
-
-static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                              int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    if(c->srcFormat == PIX_FMT_YUV422P) {
-        srcStride[1] *= 2;
-        srcStride[2] *= 2;
-    }
-
-    assert(srcStride[1] == srcStride[2]);
-
-    mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
-                              srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
-    return srcSliceH;
-}
-
-
-SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c)
-{
-    switch(c->dstFormat) {
-    case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
-    case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
-    case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
-    default: return NULL;
-    }
-}
-
diff --git a/libswscale/options.c b/libswscale/options.c
deleted file mode 100644
index 75564cb..0000000
--- a/libswscale/options.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avutil.h"
-#include "libavcodec/opt.h"
-#include "swscale.h"
-#include "swscale_internal.h"
-
-static const char * sws_context_to_name(void * ptr)
-{
-    return "swscaler";
-}
-
-#define OFFSET(x) offsetof(SwsContext, x)
-#define DEFAULT 0
-#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-
-static const AVOption options[] = {
-    { "sws_flags", "scaler/cpu flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, 0, UINT_MAX, VE, "sws_flags" },
-    { "fast_bilinear", "fast bilinear", 0, FF_OPT_TYPE_CONST, SWS_FAST_BILINEAR, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "bilinear", "bilinear", 0, FF_OPT_TYPE_CONST, SWS_BILINEAR, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "bicubic", "bicubic", 0, FF_OPT_TYPE_CONST, SWS_BICUBIC, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "experimental", "experimental", 0, FF_OPT_TYPE_CONST, SWS_X, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "neighbor", "nearest neighbor", 0, FF_OPT_TYPE_CONST, SWS_POINT, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "area", "averaging area", 0, FF_OPT_TYPE_CONST, SWS_AREA, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "bicublin", "luma bicubic, chroma bilinear", 0, FF_OPT_TYPE_CONST, SWS_BICUBLIN, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "gauss", "gaussian", 0, FF_OPT_TYPE_CONST, SWS_GAUSS, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "sinc", "sinc", 0, FF_OPT_TYPE_CONST, SWS_SINC, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "lanczos", "lanczos", 0, FF_OPT_TYPE_CONST, SWS_LANCZOS, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "spline", "natural bicubic spline", 0, FF_OPT_TYPE_CONST, SWS_SPLINE, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "print_info", "print info", 0, FF_OPT_TYPE_CONST, SWS_PRINT_INFO, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "accurate_rnd", "accurate rounding", 0, FF_OPT_TYPE_CONST, SWS_ACCURATE_RND, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "mmx", "MMX SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "mmx2", "MMX2 SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX2, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "3dnow", "3DNOW SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_3DNOW, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "altivec", "AltiVec SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_ALTIVEC, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "bfin", "Blackfin SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_BFIN, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "full_chroma_int", "full chroma interpolation", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INT, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "full_chroma_inp", "full chroma input", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INP, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { "bitexact", "", 0 , FF_OPT_TYPE_CONST, SWS_BITEXACT, INT_MIN, INT_MAX, VE, "sws_flags" },
-    { NULL }
-};
-
-const AVClass sws_context_class = { "SWScaler", sws_context_to_name, options };
diff --git a/libswscale/ppc/swscale_altivec_template.c b/libswscale/ppc/swscale_altivec_template.c
deleted file mode 100644
index a438e4c..0000000
--- a/libswscale/ppc/swscale_altivec_template.c
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * AltiVec-enhanced yuv2yuvX
- *
- * Copyright (C) 2004 Romain Dolbeau <romain at dolbeau.org>
- * based on the equivalent C code in swscale.c
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define vzero vec_splat_s32(0)
-
-static inline void
-altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW)
-{
-    register int i;
-    vector unsigned int altivec_vectorShiftInt19 =
-        vec_add(vec_splat_u32(10), vec_splat_u32(9));
-    if ((unsigned long)dest % 16) {
-        /* badly aligned store, we force store alignment */
-        /* and will handle load misalignment on val w/ vec_perm */
-        vector unsigned char perm1;
-        vector signed int v1;
-        for (i = 0 ; (i < dstW) &&
-            (((unsigned long)dest + i) % 16) ; i++) {
-                int t = val[i] >> 19;
-                dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
-        }
-        perm1 = vec_lvsl(i << 2, val);
-        v1 = vec_ld(i << 2, val);
-        for ( ; i < (dstW - 15); i+=16) {
-            int offset = i << 2;
-            vector signed int v2 = vec_ld(offset + 16, val);
-            vector signed int v3 = vec_ld(offset + 32, val);
-            vector signed int v4 = vec_ld(offset + 48, val);
-            vector signed int v5 = vec_ld(offset + 64, val);
-            vector signed int v12 = vec_perm(v1, v2, perm1);
-            vector signed int v23 = vec_perm(v2, v3, perm1);
-            vector signed int v34 = vec_perm(v3, v4, perm1);
-            vector signed int v45 = vec_perm(v4, v5, perm1);
-
-            vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19);
-            vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19);
-            vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19);
-            vector signed int vD = vec_sra(v45, altivec_vectorShiftInt19);
-            vector unsigned short vs1 = vec_packsu(vA, vB);
-            vector unsigned short vs2 = vec_packsu(vC, vD);
-            vector unsigned char vf = vec_packsu(vs1, vs2);
-            vec_st(vf, i, dest);
-            v1 = v5;
-        }
-    } else { // dest is properly aligned, great
-        for (i = 0; i < (dstW - 15); i+=16) {
-            int offset = i << 2;
-            vector signed int v1 = vec_ld(offset, val);
-            vector signed int v2 = vec_ld(offset + 16, val);
-            vector signed int v3 = vec_ld(offset + 32, val);
-            vector signed int v4 = vec_ld(offset + 48, val);
-            vector signed int v5 = vec_sra(v1, altivec_vectorShiftInt19);
-            vector signed int v6 = vec_sra(v2, altivec_vectorShiftInt19);
-            vector signed int v7 = vec_sra(v3, altivec_vectorShiftInt19);
-            vector signed int v8 = vec_sra(v4, altivec_vectorShiftInt19);
-            vector unsigned short vs1 = vec_packsu(v5, v6);
-            vector unsigned short vs2 = vec_packsu(v7, v8);
-            vector unsigned char vf = vec_packsu(vs1, vs2);
-            vec_st(vf, i, dest);
-        }
-    }
-    for ( ; i < dstW ; i++) {
-        int t = val[i] >> 19;
-        dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
-    }
-}
-
-static inline void
-yuv2yuvX_altivec_real(const int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
-                      const int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
-                      uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
-{
-    const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 18)};
-    register int i, j;
-    {
-        DECLARE_ALIGNED(16, int, val)[dstW];
-
-        for (i = 0; i < (dstW -7); i+=4) {
-            vec_st(vini, i << 2, val);
-        }
-        for (; i < dstW; i++) {
-            val[i] = (1 << 18);
-        }
-
-        for (j = 0; j < lumFilterSize; j++) {
-            vector signed short l1, vLumFilter = vec_ld(j << 1, lumFilter);
-            vector unsigned char perm, perm0 = vec_lvsl(j << 1, lumFilter);
-            vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
-            vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter
-
-            perm = vec_lvsl(0, lumSrc[j]);
-            l1 = vec_ld(0, lumSrc[j]);
-
-            for (i = 0; i < (dstW - 7); i+=8) {
-                int offset = i << 2;
-                vector signed short l2 = vec_ld((i << 1) + 16, lumSrc[j]);
-
-                vector signed int v1 = vec_ld(offset, val);
-                vector signed int v2 = vec_ld(offset + 16, val);
-
-                vector signed short ls = vec_perm(l1, l2, perm); // lumSrc[j][i] ... lumSrc[j][i+7]
-
-                vector signed int i1 = vec_mule(vLumFilter, ls);
-                vector signed int i2 = vec_mulo(vLumFilter, ls);
-
-                vector signed int vf1 = vec_mergeh(i1, i2);
-                vector signed int vf2 = vec_mergel(i1, i2); // lumSrc[j][i] * lumFilter[j] ... lumSrc[j][i+7] * lumFilter[j]
-
-                vector signed int vo1 = vec_add(v1, vf1);
-                vector signed int vo2 = vec_add(v2, vf2);
-
-                vec_st(vo1, offset, val);
-                vec_st(vo2, offset + 16, val);
-
-                l1 = l2;
-            }
-            for ( ; i < dstW; i++) {
-                val[i] += lumSrc[j][i] * lumFilter[j];
-            }
-        }
-        altivec_packIntArrayToCharArray(val, dest, dstW);
-    }
-    if (uDest != 0) {
-        DECLARE_ALIGNED(16, int, u)[chrDstW];
-        DECLARE_ALIGNED(16, int, v)[chrDstW];
-
-        for (i = 0; i < (chrDstW -7); i+=4) {
-            vec_st(vini, i << 2, u);
-            vec_st(vini, i << 2, v);
-        }
-        for (; i < chrDstW; i++) {
-            u[i] = (1 << 18);
-            v[i] = (1 << 18);
-        }
-
-        for (j = 0; j < chrFilterSize; j++) {
-            vector signed short l1, l1_V, vChrFilter = vec_ld(j << 1, chrFilter);
-            vector unsigned char perm, perm0 = vec_lvsl(j << 1, chrFilter);
-            vChrFilter = vec_perm(vChrFilter, vChrFilter, perm0);
-            vChrFilter = vec_splat(vChrFilter, 0); // chrFilter[j] is loaded 8 times in vChrFilter
-
-            perm = vec_lvsl(0, chrSrc[j]);
-            l1 = vec_ld(0, chrSrc[j]);
-            l1_V = vec_ld(2048 << 1, chrSrc[j]);
-
-            for (i = 0; i < (chrDstW - 7); i+=8) {
-                int offset = i << 2;
-                vector signed short l2 = vec_ld((i << 1) + 16, chrSrc[j]);
-                vector signed short l2_V = vec_ld(((i + 2048) << 1) + 16, chrSrc[j]);
-
-                vector signed int v1 = vec_ld(offset, u);
-                vector signed int v2 = vec_ld(offset + 16, u);
-                vector signed int v1_V = vec_ld(offset, v);
-                vector signed int v2_V = vec_ld(offset + 16, v);
-
-                vector signed short ls = vec_perm(l1, l2, perm); // chrSrc[j][i] ... chrSrc[j][i+7]
-                vector signed short ls_V = vec_perm(l1_V, l2_V, perm); // chrSrc[j][i+2048] ... chrSrc[j][i+2055]
-
-                vector signed int i1 = vec_mule(vChrFilter, ls);
-                vector signed int i2 = vec_mulo(vChrFilter, ls);
-                vector signed int i1_V = vec_mule(vChrFilter, ls_V);
-                vector signed int i2_V = vec_mulo(vChrFilter, ls_V);
-
-                vector signed int vf1 = vec_mergeh(i1, i2);
-                vector signed int vf2 = vec_mergel(i1, i2); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j]
-                vector signed int vf1_V = vec_mergeh(i1_V, i2_V);
-                vector signed int vf2_V = vec_mergel(i1_V, i2_V); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j]
-
-                vector signed int vo1 = vec_add(v1, vf1);
-                vector signed int vo2 = vec_add(v2, vf2);
-                vector signed int vo1_V = vec_add(v1_V, vf1_V);
-                vector signed int vo2_V = vec_add(v2_V, vf2_V);
-
-                vec_st(vo1, offset, u);
-                vec_st(vo2, offset + 16, u);
-                vec_st(vo1_V, offset, v);
-                vec_st(vo2_V, offset + 16, v);
-
-                l1 = l2;
-                l1_V = l2_V;
-            }
-            for ( ; i < chrDstW; i++) {
-                u[i] += chrSrc[j][i] * chrFilter[j];
-                v[i] += chrSrc[j][i + 2048] * chrFilter[j];
-            }
-        }
-        altivec_packIntArrayToCharArray(u, uDest, chrDstW);
-        altivec_packIntArrayToCharArray(v, vDest, chrDstW);
-    }
-}
-
-static inline void hScale_altivec_real(int16_t *dst, int dstW,
-                                       const uint8_t *src, int srcW,
-                                       int xInc, const int16_t *filter,
-                                       const int16_t *filterPos, int filterSize)
-{
-    register int i;
-    DECLARE_ALIGNED(16, int, tempo)[4];
-
-    if (filterSize % 4) {
-        for (i=0; i<dstW; i++) {
-            register int j;
-            register int srcPos = filterPos[i];
-            register int val = 0;
-            for (j=0; j<filterSize; j++) {
-                val += ((int)src[srcPos + j])*filter[filterSize*i + j];
-            }
-            dst[i] = FFMIN(val>>7, (1<<15)-1);
-        }
-    }
-    else
-    switch (filterSize) {
-    case 4:
-    {
-    for (i=0; i<dstW; i++) {
-        register int srcPos = filterPos[i];
-
-        vector unsigned char src_v0 = vec_ld(srcPos, src);
-        vector unsigned char src_v1, src_vF;
-        vector signed short src_v, filter_v;
-        vector signed int val_vEven, val_s;
-        if ((((int)src + srcPos)% 16) > 12) {
-            src_v1 = vec_ld(srcPos + 16, src);
-        }
-        src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
-        src_v = // vec_unpackh sign-extends...
-            (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
-        // now put our elements in the even slots
-        src_v = vec_mergeh(src_v, (vector signed short)vzero);
-
-        filter_v = vec_ld(i << 3, filter);
-        // The 3 above is 2 (filterSize == 4) + 1 (sizeof(short) == 2).
-
-        // The neat trick: We only care for half the elements,
-        // high or low depending on (i<<3)%16 (it's 0 or 8 here),
-        // and we're going to use vec_mule, so we choose
-        // carefully how to "unpack" the elements into the even slots.
-        if ((i << 3) % 16)
-            filter_v = vec_mergel(filter_v, (vector signed short)vzero);
-        else
-            filter_v = vec_mergeh(filter_v, (vector signed short)vzero);
-
-        val_vEven = vec_mule(src_v, filter_v);
-        val_s = vec_sums(val_vEven, vzero);
-        vec_st(val_s, 0, tempo);
-        dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
-    }
-    }
-    break;
-
-    case 8:
-    {
-    for (i=0; i<dstW; i++) {
-        register int srcPos = filterPos[i];
-
-        vector unsigned char src_v0 = vec_ld(srcPos, src);
-        vector unsigned char src_v1, src_vF;
-        vector signed short src_v, filter_v;
-        vector signed int val_v, val_s;
-        if ((((int)src + srcPos)% 16) > 8) {
-            src_v1 = vec_ld(srcPos + 16, src);
-        }
-        src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
-        src_v = // vec_unpackh sign-extends...
-            (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
-        filter_v = vec_ld(i << 4, filter);
-        // the 4 above is 3 (filterSize == 8) + 1 (sizeof(short) == 2)
-
-        val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
-        val_s = vec_sums(val_v, vzero);
-        vec_st(val_s, 0, tempo);
-        dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
-    }
-    }
-    break;
-
-    case 16:
-    {
-        for (i=0; i<dstW; i++) {
-            register int srcPos = filterPos[i];
-
-            vector unsigned char src_v0 = vec_ld(srcPos, src);
-            vector unsigned char src_v1 = vec_ld(srcPos + 16, src);
-            vector unsigned char src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
-            vector signed short src_vA = // vec_unpackh sign-extends...
-                (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
-            vector signed short src_vB = // vec_unpackh sign-extends...
-                (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
-
-            vector signed short filter_v0 = vec_ld(i << 5, filter);
-            vector signed short filter_v1 = vec_ld((i << 5) + 16, filter);
-            // the 5 above are 4 (filterSize == 16) + 1 (sizeof(short) == 2)
-
-            vector signed int val_acc = vec_msums(src_vA, filter_v0, (vector signed int)vzero);
-            vector signed int val_v = vec_msums(src_vB, filter_v1, val_acc);
-
-            vector signed int val_s = vec_sums(val_v, vzero);
-
-            vec_st(val_s, 0, tempo);
-            dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
-        }
-    }
-    break;
-
-    default:
-    {
-    for (i=0; i<dstW; i++) {
-        register int j;
-        register int srcPos = filterPos[i];
-
-        vector signed int val_s, val_v = (vector signed int)vzero;
-        vector signed short filter_v0R = vec_ld(i * 2 * filterSize, filter);
-        vector unsigned char permF = vec_lvsl((i * 2 * filterSize), filter);
-
-        vector unsigned char src_v0 = vec_ld(srcPos, src);
-        vector unsigned char permS = vec_lvsl(srcPos, src);
-
-        for (j = 0 ; j < filterSize - 15; j += 16) {
-            vector unsigned char src_v1 = vec_ld(srcPos + j + 16, src);
-            vector unsigned char src_vF = vec_perm(src_v0, src_v1, permS);
-
-            vector signed short src_vA = // vec_unpackh sign-extends...
-                (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
-            vector signed short src_vB = // vec_unpackh sign-extends...
-                (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
-
-            vector signed short filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
-            vector signed short filter_v2R = vec_ld((i * 2 * filterSize) + (j * 2) + 32, filter);
-            vector signed short filter_v0  = vec_perm(filter_v0R, filter_v1R, permF);
-            vector signed short filter_v1  = vec_perm(filter_v1R, filter_v2R, permF);
-
-            vector signed int val_acc = vec_msums(src_vA, filter_v0, val_v);
-            val_v = vec_msums(src_vB, filter_v1, val_acc);
-
-            filter_v0R = filter_v2R;
-            src_v0 = src_v1;
-        }
-
-        if (j < filterSize-7) {
-            // loading src_v0 is useless, it's already done above
-            //vector unsigned char src_v0 = vec_ld(srcPos + j, src);
-            vector unsigned char src_v1, src_vF;
-            vector signed short src_v, filter_v1R, filter_v;
-            if ((((int)src + srcPos)% 16) > 8) {
-                src_v1 = vec_ld(srcPos + j + 16, src);
-            }
-            src_vF = vec_perm(src_v0, src_v1, permS);
-
-            src_v = // vec_unpackh sign-extends...
-                (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
-            // loading filter_v0R is useless, it's already done above
-            //vector signed short filter_v0R = vec_ld((i * 2 * filterSize) + j, filter);
-            filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
-            filter_v = vec_perm(filter_v0R, filter_v1R, permF);
-
-            val_v = vec_msums(src_v, filter_v, val_v);
-        }
-
-        val_s = vec_sums(val_v, vzero);
-
-        vec_st(val_s, 0, tempo);
-        dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
-    }
-
-    }
-    }
-}
-
-static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                                              int srcSliceH, uint8_t* dstParam[], int dstStride_a[])
-{
-    uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
-    // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
-    uint8_t *ysrc = src[0];
-    uint8_t *usrc = src[1];
-    uint8_t *vsrc = src[2];
-    const int width = c->srcW;
-    const int height = srcSliceH;
-    const int lumStride = srcStride[0];
-    const int chromStride = srcStride[1];
-    const int dstStride = dstStride_a[0];
-    const vector unsigned char yperm = vec_lvsl(0, ysrc);
-    const int vertLumPerChroma = 2;
-    register unsigned int y;
-
-    if (width&15) {
-        yv12toyuy2(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
-        return srcSliceH;
-    }
-
-    /* This code assumes:
-
-    1) dst is 16 bytes-aligned
-    2) dstStride is a multiple of 16
-    3) width is a multiple of 16
-    4) lum & chrom stride are multiples of 8
-    */
-
-    for (y=0; y<height; y++) {
-        int i;
-        for (i = 0; i < width - 31; i+= 32) {
-            const unsigned int j = i >> 1;
-            vector unsigned char v_yA = vec_ld(i, ysrc);
-            vector unsigned char v_yB = vec_ld(i + 16, ysrc);
-            vector unsigned char v_yC = vec_ld(i + 32, ysrc);
-            vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
-            vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
-            vector unsigned char v_uA = vec_ld(j, usrc);
-            vector unsigned char v_uB = vec_ld(j + 16, usrc);
-            vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
-            vector unsigned char v_vA = vec_ld(j, vsrc);
-            vector unsigned char v_vB = vec_ld(j + 16, vsrc);
-            vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
-            vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
-            vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
-            vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
-            vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
-            vector unsigned char v_yuy2_2 = vec_mergeh(v_y2, v_uv_b);
-            vector unsigned char v_yuy2_3 = vec_mergel(v_y2, v_uv_b);
-            vec_st(v_yuy2_0, (i << 1), dst);
-            vec_st(v_yuy2_1, (i << 1) + 16, dst);
-            vec_st(v_yuy2_2, (i << 1) + 32, dst);
-            vec_st(v_yuy2_3, (i << 1) + 48, dst);
-        }
-        if (i < width) {
-            const unsigned int j = i >> 1;
-            vector unsigned char v_y1 = vec_ld(i, ysrc);
-            vector unsigned char v_u = vec_ld(j, usrc);
-            vector unsigned char v_v = vec_ld(j, vsrc);
-            vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
-            vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
-            vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
-            vec_st(v_yuy2_0, (i << 1), dst);
-            vec_st(v_yuy2_1, (i << 1) + 16, dst);
-        }
-        if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
-            usrc += chromStride;
-            vsrc += chromStride;
-        }
-        ysrc += lumStride;
-        dst += dstStride;
-    }
-
-    return srcSliceH;
-}
-
-static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                                              int srcSliceH, uint8_t* dstParam[], int dstStride_a[])
-{
-    uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
-    // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
-    uint8_t *ysrc = src[0];
-    uint8_t *usrc = src[1];
-    uint8_t *vsrc = src[2];
-    const int width = c->srcW;
-    const int height = srcSliceH;
-    const int lumStride = srcStride[0];
-    const int chromStride = srcStride[1];
-    const int dstStride = dstStride_a[0];
-    const int vertLumPerChroma = 2;
-    const vector unsigned char yperm = vec_lvsl(0, ysrc);
-    register unsigned int y;
-
-    if (width&15) {
-        yv12touyvy(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
-        return srcSliceH;
-    }
-
-    /* This code assumes:
-
-    1) dst is 16 bytes-aligned
-    2) dstStride is a multiple of 16
-    3) width is a multiple of 16
-    4) lum & chrom stride are multiples of 8
-    */
-
-    for (y=0; y<height; y++) {
-        int i;
-        for (i = 0; i < width - 31; i+= 32) {
-            const unsigned int j = i >> 1;
-            vector unsigned char v_yA = vec_ld(i, ysrc);
-            vector unsigned char v_yB = vec_ld(i + 16, ysrc);
-            vector unsigned char v_yC = vec_ld(i + 32, ysrc);
-            vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
-            vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
-            vector unsigned char v_uA = vec_ld(j, usrc);
-            vector unsigned char v_uB = vec_ld(j + 16, usrc);
-            vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
-            vector unsigned char v_vA = vec_ld(j, vsrc);
-            vector unsigned char v_vB = vec_ld(j + 16, vsrc);
-            vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
-            vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
-            vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
-            vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
-            vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
-            vector unsigned char v_uyvy_2 = vec_mergeh(v_uv_b, v_y2);
-            vector unsigned char v_uyvy_3 = vec_mergel(v_uv_b, v_y2);
-            vec_st(v_uyvy_0, (i << 1), dst);
-            vec_st(v_uyvy_1, (i << 1) + 16, dst);
-            vec_st(v_uyvy_2, (i << 1) + 32, dst);
-            vec_st(v_uyvy_3, (i << 1) + 48, dst);
-        }
-        if (i < width) {
-            const unsigned int j = i >> 1;
-            vector unsigned char v_y1 = vec_ld(i, ysrc);
-            vector unsigned char v_u = vec_ld(j, usrc);
-            vector unsigned char v_v = vec_ld(j, vsrc);
-            vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
-            vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
-            vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
-            vec_st(v_uyvy_0, (i << 1), dst);
-            vec_st(v_uyvy_1, (i << 1) + 16, dst);
-        }
-        if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
-            usrc += chromStride;
-            vsrc += chromStride;
-        }
-        ysrc += lumStride;
-        dst += dstStride;
-    }
-    return srcSliceH;
-}
diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
deleted file mode 100644
index be26647..0000000
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ /dev/null
@@ -1,953 +0,0 @@
-/*
- * AltiVec acceleration for colorspace conversion
- *
- * copyright (C) 2004 Marc Hoffman <marc.hoffman at analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
-Convert I420 YV12 to RGB in various formats,
-  it rejects images that are not in 420 formats,
-  it rejects images that don't have widths of multiples of 16,
-  it rejects images that don't have heights of multiples of 2.
-Reject defers to C simulation code.
-
-Lots of optimizations to be done here.
-
-1. Need to fix saturation code. I just couldn't get it to fly with packs
-   and adds, so we currently use max/min to clip.
-
-2. The inefficient use of chroma loading needs a bit of brushing up.
-
-3. Analysis of pipeline stalls needs to be done. Use shark to identify
-   pipeline stalls.
-
-
-MODIFIED to calculate coeffs from currently selected color space.
-MODIFIED core to be a macro where you specify the output format.
-ADDED UYVY conversion which is never called due to some thing in swscale.
-CORRECTED algorithim selection to be strict on input formats.
-ADDED runtime detection of AltiVec.
-
-ADDED altivec_yuv2packedX vertical scl + RGB converter
-
-March 27,2004
-PERFORMANCE ANALYSIS
-
-The C version uses 25% of the processor or ~250Mips for D1 video rawvideo
-used as test.
-The AltiVec version uses 10% of the processor or ~100Mips for D1 video
-same sequence.
-
-720 * 480 * 30  ~10MPS
-
-so we have roughly 10 clocks per pixel. This is too high, something has
-to be wrong.
-
-OPTIMIZED clip codes to utilize vec_max and vec_packs removing the
-need for vec_min.
-
-OPTIMIZED DST OUTPUT cache/DMA controls. We are pretty much guaranteed to have
-the input video frame, it was just decompressed so it probably resides in L1
-caches. However, we are creating the output video stream. This needs to use the
-DSTST instruction to optimize for the cache. We couple this with the fact that
-we are not going to be visiting the input buffer again so we mark it Least
-Recently Used. This shaves 25% of the processor cycles off.
-
-Now memcpy is the largest mips consumer in the system, probably due
-to the inefficient X11 stuff.
-
-GL libraries seem to be very slow on this machine 1.33Ghz PB running
-Jaguar, this is not the case for my 1Ghz PB.  I thought it might be
-a versioning issue, however I have libGL.1.2.dylib for both
-machines. (We need to figure this out now.)
-
-GL2 libraries work now with patch for RGB32.
-
-NOTE: quartz vo driver ARGB32_to_RGB24 consumes 30% of the processor.
-
-Integrated luma prescaling adjustment for saturation/contrast/brightness
-adjustment.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include "config.h"
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#undef PROFILE_THE_BEAST
-#undef INC_SCALING
-
-typedef unsigned char ubyte;
-typedef signed char   sbyte;
-
-
-/* RGB interleaver, 16 planar pels 8-bit samples per channel in
-   homogeneous vector registers x0,x1,x2 are interleaved with the
-   following technique:
-
-      o0 = vec_mergeh (x0,x1);
-      o1 = vec_perm (o0, x2, perm_rgb_0);
-      o2 = vec_perm (o0, x2, perm_rgb_1);
-      o3 = vec_mergel (x0,x1);
-      o4 = vec_perm (o3,o2,perm_rgb_2);
-      o5 = vec_perm (o3,o2,perm_rgb_3);
-
-  perm_rgb_0:   o0(RG).h v1(B) --> o1*
-              0   1  2   3   4
-             rgbr|gbrg|brgb|rgbr
-             0010 0100 1001 0010
-             0102 3145 2673 894A
-
-  perm_rgb_1:   o0(RG).h v1(B) --> o2
-              0   1  2   3   4
-             gbrg|brgb|bbbb|bbbb
-             0100 1001 1111 1111
-             B5CD 6EF7 89AB CDEF
-
-  perm_rgb_2:   o3(RG).l o2(rgbB.l) --> o4*
-              0   1  2   3   4
-             gbrg|brgb|rgbr|gbrg
-             1111 1111 0010 0100
-             89AB CDEF 0182 3945
-
-  perm_rgb_2:   o3(RG).l o2(rgbB.l) ---> o5*
-              0   1  2   3   4
-             brgb|rgbr|gbrg|brgb
-             1001 0010 0100 1001
-             a67b 89cA BdCD eEFf
-
-*/
-static
-const vector unsigned char
-  perm_rgb_0 = {0x00,0x01,0x10,0x02,0x03,0x11,0x04,0x05,
-                0x12,0x06,0x07,0x13,0x08,0x09,0x14,0x0a},
-  perm_rgb_1 = {0x0b,0x15,0x0c,0x0d,0x16,0x0e,0x0f,0x17,
-                0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f},
-  perm_rgb_2 = {0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
-                0x00,0x01,0x18,0x02,0x03,0x19,0x04,0x05},
-  perm_rgb_3 = {0x1a,0x06,0x07,0x1b,0x08,0x09,0x1c,0x0a,
-                0x0b,0x1d,0x0c,0x0d,0x1e,0x0e,0x0f,0x1f};
-
-#define vec_merge3(x2,x1,x0,y0,y1,y2)       \
-do {                                        \
-    __typeof__(x0) o0,o2,o3;                \
-        o0 = vec_mergeh (x0,x1);            \
-        y0 = vec_perm (o0, x2, perm_rgb_0); \
-        o2 = vec_perm (o0, x2, perm_rgb_1); \
-        o3 = vec_mergel (x0,x1);            \
-        y1 = vec_perm (o3,o2,perm_rgb_2);   \
-        y2 = vec_perm (o3,o2,perm_rgb_3);   \
-} while(0)
-
-#define vec_mstbgr24(x0,x1,x2,ptr)      \
-do {                                    \
-    __typeof__(x0) _0,_1,_2;            \
-    vec_merge3 (x0,x1,x2,_0,_1,_2);     \
-    vec_st (_0, 0, ptr++);              \
-    vec_st (_1, 0, ptr++);              \
-    vec_st (_2, 0, ptr++);              \
-}  while (0)
-
-#define vec_mstrgb24(x0,x1,x2,ptr)      \
-do {                                    \
-    __typeof__(x0) _0,_1,_2;            \
-    vec_merge3 (x2,x1,x0,_0,_1,_2);     \
-    vec_st (_0, 0, ptr++);              \
-    vec_st (_1, 0, ptr++);              \
-    vec_st (_2, 0, ptr++);              \
-}  while (0)
-
-/* pack the pixels in rgb0 format
-   msb R
-   lsb 0
-*/
-#define vec_mstrgb32(T,x0,x1,x2,x3,ptr)                                       \
-do {                                                                          \
-    T _0,_1,_2,_3;                                                            \
-    _0 = vec_mergeh (x0,x1);                                                  \
-    _1 = vec_mergeh (x2,x3);                                                  \
-    _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \
-    _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \
-    vec_st (_2, 0*16, (T *)ptr);                                              \
-    vec_st (_3, 1*16, (T *)ptr);                                              \
-    _0 = vec_mergel (x0,x1);                                                  \
-    _1 = vec_mergel (x2,x3);                                                  \
-    _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \
-    _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \
-    vec_st (_2, 2*16, (T *)ptr);                                              \
-    vec_st (_3, 3*16, (T *)ptr);                                              \
-    ptr += 4;                                                                 \
-}  while (0)
-
-/*
-
-  | 1     0       1.4021   | | Y |
-  | 1    -0.3441 -0.7142   |x| Cb|
-  | 1     1.7718  0        | | Cr|
-
-
-  Y:      [-128 127]
-  Cb/Cr : [-128 127]
-
-  typical yuv conversion work on Y: 0-255 this version has been optimized for jpeg decode.
-
-*/
-
-
-
-
-#define vec_unh(x) \
-    (vector signed short) \
-        vec_perm(x,(__typeof__(x)){0}, \
-                 ((vector unsigned char){0x10,0x00,0x10,0x01,0x10,0x02,0x10,0x03,\
-                                         0x10,0x04,0x10,0x05,0x10,0x06,0x10,0x07}))
-#define vec_unl(x) \
-    (vector signed short) \
-        vec_perm(x,(__typeof__(x)){0}, \
-                 ((vector unsigned char){0x10,0x08,0x10,0x09,0x10,0x0A,0x10,0x0B,\
-                                         0x10,0x0C,0x10,0x0D,0x10,0x0E,0x10,0x0F}))
-
-#define vec_clip_s16(x) \
-    vec_max (vec_min (x, ((vector signed short){235,235,235,235,235,235,235,235})), \
-                         ((vector signed short){ 16, 16, 16, 16, 16, 16, 16, 16}))
-
-#define vec_packclp(x,y) \
-    (vector unsigned char)vec_packs \
-        ((vector unsigned short)vec_max (x,((vector signed short) {0})), \
-         (vector unsigned short)vec_max (y,((vector signed short) {0})))
-
-//#define out_pixels(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),a,a,a,ptr)
-
-
-static inline void cvtyuvtoRGB (SwsContext *c,
-                                vector signed short Y, vector signed short U, vector signed short V,
-                                vector signed short *R, vector signed short *G, vector signed short *B)
-{
-    vector signed   short vx,ux,uvx;
-
-    Y = vec_mradds (Y, c->CY, c->OY);
-    U  = vec_sub (U,(vector signed short)
-                    vec_splat((vector signed short){128},0));
-    V  = vec_sub (V,(vector signed short)
-                    vec_splat((vector signed short){128},0));
-
-    //   ux  = (CBU*(u<<c->CSHIFT)+0x4000)>>15;
-    ux = vec_sl (U, c->CSHIFT);
-    *B = vec_mradds (ux, c->CBU, Y);
-
-    // vx  = (CRV*(v<<c->CSHIFT)+0x4000)>>15;
-    vx = vec_sl (V, c->CSHIFT);
-    *R = vec_mradds (vx, c->CRV, Y);
-
-    // uvx = ((CGU*u) + (CGV*v))>>15;
-    uvx = vec_mradds (U, c->CGU, Y);
-    *G  = vec_mradds (V, c->CGV, uvx);
-}
-
-
-/*
-  ------------------------------------------------------------------------------
-  CS converters
-  ------------------------------------------------------------------------------
-*/
-
-
-#define DEFCSP420_CVT(name,out_pixels)                                  \
-static int altivec_##name (SwsContext *c,                               \
-                           unsigned char **in, int *instrides,          \
-                           int srcSliceY,        int srcSliceH,         \
-                           unsigned char **oplanes, int *outstrides)    \
-{                                                                       \
-    int w = c->srcW;                                                    \
-    int h = srcSliceH;                                                  \
-    int i,j;                                                            \
-    int instrides_scl[3];                                               \
-    vector unsigned char y0,y1;                                         \
-                                                                        \
-    vector signed char  u,v;                                            \
-                                                                        \
-    vector signed short Y0,Y1,Y2,Y3;                                    \
-    vector signed short U,V;                                            \
-    vector signed short vx,ux,uvx;                                      \
-    vector signed short vx0,ux0,uvx0;                                   \
-    vector signed short vx1,ux1,uvx1;                                   \
-    vector signed short R0,G0,B0;                                       \
-    vector signed short R1,G1,B1;                                       \
-    vector unsigned char R,G,B;                                         \
-                                                                        \
-    vector unsigned char *y1ivP, *y2ivP, *uivP, *vivP;                  \
-    vector unsigned char align_perm;                                    \
-                                                                        \
-    vector signed short                                                 \
-        lCY  = c->CY,                                                   \
-        lOY  = c->OY,                                                   \
-        lCRV = c->CRV,                                                  \
-        lCBU = c->CBU,                                                  \
-        lCGU = c->CGU,                                                  \
-        lCGV = c->CGV;                                                  \
-                                                                        \
-    vector unsigned short lCSHIFT = c->CSHIFT;                          \
-                                                                        \
-    ubyte *y1i   = in[0];                                               \
-    ubyte *y2i   = in[0]+instrides[0];                                  \
-    ubyte *ui    = in[1];                                               \
-    ubyte *vi    = in[2];                                               \
-                                                                        \
-    vector unsigned char *oute                                          \
-        = (vector unsigned char *)                                      \
-            (oplanes[0]+srcSliceY*outstrides[0]);                       \
-    vector unsigned char *outo                                          \
-        = (vector unsigned char *)                                      \
-            (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]);         \
-                                                                        \
-                                                                        \
-    instrides_scl[0] = instrides[0]*2-w;  /* the loop moves y{1,2}i by w */ \
-    instrides_scl[1] = instrides[1]-w/2;  /* the loop moves ui by w/2 */    \
-    instrides_scl[2] = instrides[2]-w/2;  /* the loop moves vi by w/2 */    \
-                                                                        \
-                                                                        \
-    for (i=0;i<h/2;i++) {                                               \
-        vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0);          \
-        vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1);          \
-                                                                        \
-        for (j=0;j<w/16;j++) {                                          \
-                                                                        \
-            y1ivP = (vector unsigned char *)y1i;                        \
-            y2ivP = (vector unsigned char *)y2i;                        \
-            uivP  = (vector unsigned char *)ui;                         \
-            vivP  = (vector unsigned char *)vi;                         \
-                                                                        \
-            align_perm = vec_lvsl (0, y1i);                             \
-            y0 = (vector unsigned char)                                 \
-                 vec_perm (y1ivP[0], y1ivP[1], align_perm);             \
-                                                                        \
-            align_perm = vec_lvsl (0, y2i);                             \
-            y1 = (vector unsigned char)                                 \
-                 vec_perm (y2ivP[0], y2ivP[1], align_perm);             \
-                                                                        \
-            align_perm = vec_lvsl (0, ui);                              \
-            u = (vector signed char)                                    \
-                vec_perm (uivP[0], uivP[1], align_perm);                \
-                                                                        \
-            align_perm = vec_lvsl (0, vi);                              \
-            v = (vector signed char)                                    \
-                vec_perm (vivP[0], vivP[1], align_perm);                \
-                                                                        \
-            u  = (vector signed char)                                   \
-                 vec_sub (u,(vector signed char)                        \
-                          vec_splat((vector signed char){128},0));      \
-            v  = (vector signed char)                                   \
-                 vec_sub (v,(vector signed char)                        \
-                          vec_splat((vector signed char){128},0));      \
-                                                                        \
-            U  = vec_unpackh (u);                                       \
-            V  = vec_unpackh (v);                                       \
-                                                                        \
-                                                                        \
-            Y0 = vec_unh (y0);                                          \
-            Y1 = vec_unl (y0);                                          \
-            Y2 = vec_unh (y1);                                          \
-            Y3 = vec_unl (y1);                                          \
-                                                                        \
-            Y0 = vec_mradds (Y0, lCY, lOY);                             \
-            Y1 = vec_mradds (Y1, lCY, lOY);                             \
-            Y2 = vec_mradds (Y2, lCY, lOY);                             \
-            Y3 = vec_mradds (Y3, lCY, lOY);                             \
-                                                                        \
-            /*   ux  = (CBU*(u<<CSHIFT)+0x4000)>>15 */                  \
-            ux = vec_sl (U, lCSHIFT);                                   \
-            ux = vec_mradds (ux, lCBU, (vector signed short){0});       \
-            ux0  = vec_mergeh (ux,ux);                                  \
-            ux1  = vec_mergel (ux,ux);                                  \
-                                                                        \
-            /* vx  = (CRV*(v<<CSHIFT)+0x4000)>>15;        */            \
-            vx = vec_sl (V, lCSHIFT);                                   \
-            vx = vec_mradds (vx, lCRV, (vector signed short){0});       \
-            vx0  = vec_mergeh (vx,vx);                                  \
-            vx1  = vec_mergel (vx,vx);                                  \
-                                                                        \
-            /* uvx = ((CGU*u) + (CGV*v))>>15 */                         \
-            uvx = vec_mradds (U, lCGU, (vector signed short){0});       \
-            uvx = vec_mradds (V, lCGV, uvx);                            \
-            uvx0 = vec_mergeh (uvx,uvx);                                \
-            uvx1 = vec_mergel (uvx,uvx);                                \
-                                                                        \
-            R0 = vec_add (Y0,vx0);                                      \
-            G0 = vec_add (Y0,uvx0);                                     \
-            B0 = vec_add (Y0,ux0);                                      \
-            R1 = vec_add (Y1,vx1);                                      \
-            G1 = vec_add (Y1,uvx1);                                     \
-            B1 = vec_add (Y1,ux1);                                      \
-                                                                        \
-            R  = vec_packclp (R0,R1);                                   \
-            G  = vec_packclp (G0,G1);                                   \
-            B  = vec_packclp (B0,B1);                                   \
-                                                                        \
-            out_pixels(R,G,B,oute);                                     \
-                                                                        \
-            R0 = vec_add (Y2,vx0);                                      \
-            G0 = vec_add (Y2,uvx0);                                     \
-            B0 = vec_add (Y2,ux0);                                      \
-            R1 = vec_add (Y3,vx1);                                      \
-            G1 = vec_add (Y3,uvx1);                                     \
-            B1 = vec_add (Y3,ux1);                                      \
-            R  = vec_packclp (R0,R1);                                   \
-            G  = vec_packclp (G0,G1);                                   \
-            B  = vec_packclp (B0,B1);                                   \
-                                                                        \
-                                                                        \
-            out_pixels(R,G,B,outo);                                     \
-                                                                        \
-            y1i  += 16;                                                 \
-            y2i  += 16;                                                 \
-            ui   += 8;                                                  \
-            vi   += 8;                                                  \
-                                                                        \
-        }                                                               \
-                                                                        \
-        outo  += (outstrides[0])>>4;                                    \
-        oute  += (outstrides[0])>>4;                                    \
-                                                                        \
-        ui    += instrides_scl[1];                                      \
-        vi    += instrides_scl[2];                                      \
-        y1i   += instrides_scl[0];                                      \
-        y2i   += instrides_scl[0];                                      \
-    }                                                                   \
-    return srcSliceH;                                                   \
-}
-
-
-#define out_abgr(a,b,c,ptr)  vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),c,b,a,ptr)
-#define out_bgra(a,b,c,ptr)  vec_mstrgb32(__typeof__(a),c,b,a,((__typeof__ (a)){255}),ptr)
-#define out_rgba(a,b,c,ptr)  vec_mstrgb32(__typeof__(a),a,b,c,((__typeof__ (a)){255}),ptr)
-#define out_argb(a,b,c,ptr)  vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),a,b,c,ptr)
-#define out_rgb24(a,b,c,ptr) vec_mstrgb24(a,b,c,ptr)
-#define out_bgr24(a,b,c,ptr) vec_mstbgr24(a,b,c,ptr)
-
-DEFCSP420_CVT (yuv2_abgr, out_abgr)
-#if 1
-DEFCSP420_CVT (yuv2_bgra, out_bgra)
-#else
-static int altivec_yuv2_bgra32 (SwsContext *c,
-                                unsigned char **in, int *instrides,
-                                int srcSliceY,        int srcSliceH,
-                                unsigned char **oplanes, int *outstrides)
-{
-    int w = c->srcW;
-    int h = srcSliceH;
-    int i,j;
-    int instrides_scl[3];
-    vector unsigned char y0,y1;
-
-    vector signed char  u,v;
-
-    vector signed short Y0,Y1,Y2,Y3;
-    vector signed short U,V;
-    vector signed short vx,ux,uvx;
-    vector signed short vx0,ux0,uvx0;
-    vector signed short vx1,ux1,uvx1;
-    vector signed short R0,G0,B0;
-    vector signed short R1,G1,B1;
-    vector unsigned char R,G,B;
-
-    vector unsigned char *uivP, *vivP;
-    vector unsigned char align_perm;
-
-    vector signed short
-        lCY  = c->CY,
-        lOY  = c->OY,
-        lCRV = c->CRV,
-        lCBU = c->CBU,
-        lCGU = c->CGU,
-        lCGV = c->CGV;
-
-    vector unsigned short lCSHIFT = c->CSHIFT;
-
-    ubyte *y1i   = in[0];
-    ubyte *y2i   = in[0]+w;
-    ubyte *ui    = in[1];
-    ubyte *vi    = in[2];
-
-    vector unsigned char *oute
-        = (vector unsigned char *)
-          (oplanes[0]+srcSliceY*outstrides[0]);
-    vector unsigned char *outo
-        = (vector unsigned char *)
-          (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]);
-
-
-    instrides_scl[0] = instrides[0];
-    instrides_scl[1] = instrides[1]-w/2;  /* the loop moves ui by w/2 */
-    instrides_scl[2] = instrides[2]-w/2;  /* the loop moves vi by w/2 */
-
-
-    for (i=0;i<h/2;i++) {
-        vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0);
-        vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1);
-
-        for (j=0;j<w/16;j++) {
-
-            y0 = vec_ldl (0,y1i);
-            y1 = vec_ldl (0,y2i);
-            uivP = (vector unsigned char *)ui;
-            vivP = (vector unsigned char *)vi;
-
-            align_perm = vec_lvsl (0, ui);
-            u  = (vector signed char)vec_perm (uivP[0], uivP[1], align_perm);
-
-            align_perm = vec_lvsl (0, vi);
-            v  = (vector signed char)vec_perm (vivP[0], vivP[1], align_perm);
-            u  = (vector signed char)
-                 vec_sub (u,(vector signed char)
-                          vec_splat((vector signed char){128},0));
-
-            v  = (vector signed char)
-                 vec_sub (v, (vector signed char)
-                          vec_splat((vector signed char){128},0));
-
-            U  = vec_unpackh (u);
-            V  = vec_unpackh (v);
-
-
-            Y0 = vec_unh (y0);
-            Y1 = vec_unl (y0);
-            Y2 = vec_unh (y1);
-            Y3 = vec_unl (y1);
-
-            Y0 = vec_mradds (Y0, lCY, lOY);
-            Y1 = vec_mradds (Y1, lCY, lOY);
-            Y2 = vec_mradds (Y2, lCY, lOY);
-            Y3 = vec_mradds (Y3, lCY, lOY);
-
-            /*   ux  = (CBU*(u<<CSHIFT)+0x4000)>>15 */
-            ux = vec_sl (U, lCSHIFT);
-            ux = vec_mradds (ux, lCBU, (vector signed short){0});
-            ux0  = vec_mergeh (ux,ux);
-            ux1  = vec_mergel (ux,ux);
-
-            /* vx  = (CRV*(v<<CSHIFT)+0x4000)>>15;        */
-            vx = vec_sl (V, lCSHIFT);
-            vx = vec_mradds (vx, lCRV, (vector signed short){0});
-            vx0  = vec_mergeh (vx,vx);
-            vx1  = vec_mergel (vx,vx);
-            /* uvx = ((CGU*u) + (CGV*v))>>15 */
-            uvx = vec_mradds (U, lCGU, (vector signed short){0});
-            uvx = vec_mradds (V, lCGV, uvx);
-            uvx0 = vec_mergeh (uvx,uvx);
-            uvx1 = vec_mergel (uvx,uvx);
-            R0 = vec_add (Y0,vx0);
-            G0 = vec_add (Y0,uvx0);
-            B0 = vec_add (Y0,ux0);
-            R1 = vec_add (Y1,vx1);
-            G1 = vec_add (Y1,uvx1);
-            B1 = vec_add (Y1,ux1);
-            R  = vec_packclp (R0,R1);
-            G  = vec_packclp (G0,G1);
-            B  = vec_packclp (B0,B1);
-
-            out_argb(R,G,B,oute);
-            R0 = vec_add (Y2,vx0);
-            G0 = vec_add (Y2,uvx0);
-            B0 = vec_add (Y2,ux0);
-            R1 = vec_add (Y3,vx1);
-            G1 = vec_add (Y3,uvx1);
-            B1 = vec_add (Y3,ux1);
-            R  = vec_packclp (R0,R1);
-            G  = vec_packclp (G0,G1);
-            B  = vec_packclp (B0,B1);
-
-            out_argb(R,G,B,outo);
-            y1i  += 16;
-            y2i  += 16;
-            ui   += 8;
-            vi   += 8;
-
-        }
-
-        outo  += (outstrides[0])>>4;
-        oute  += (outstrides[0])>>4;
-
-        ui    += instrides_scl[1];
-        vi    += instrides_scl[2];
-        y1i   += instrides_scl[0];
-        y2i   += instrides_scl[0];
-    }
-    return srcSliceH;
-}
-
-#endif
-
-
-DEFCSP420_CVT (yuv2_rgba, out_rgba)
-DEFCSP420_CVT (yuv2_argb, out_argb)
-DEFCSP420_CVT (yuv2_rgb24,  out_rgb24)
-DEFCSP420_CVT (yuv2_bgr24,  out_bgr24)
-
-
-// uyvy|uyvy|uyvy|uyvy
-// 0123 4567 89ab cdef
-static
-const vector unsigned char
-    demux_u = {0x10,0x00,0x10,0x00,
-               0x10,0x04,0x10,0x04,
-               0x10,0x08,0x10,0x08,
-               0x10,0x0c,0x10,0x0c},
-    demux_v = {0x10,0x02,0x10,0x02,
-               0x10,0x06,0x10,0x06,
-               0x10,0x0A,0x10,0x0A,
-               0x10,0x0E,0x10,0x0E},
-    demux_y = {0x10,0x01,0x10,0x03,
-               0x10,0x05,0x10,0x07,
-               0x10,0x09,0x10,0x0B,
-               0x10,0x0D,0x10,0x0F};
-
-/*
-  this is so I can play live CCIR raw video
-*/
-static int altivec_uyvy_rgb32 (SwsContext *c,
-                               unsigned char **in, int *instrides,
-                               int srcSliceY,        int srcSliceH,
-                               unsigned char **oplanes, int *outstrides)
-{
-    int w = c->srcW;
-    int h = srcSliceH;
-    int i,j;
-    vector unsigned char uyvy;
-    vector signed   short Y,U,V;
-    vector signed   short R0,G0,B0,R1,G1,B1;
-    vector unsigned char  R,G,B;
-    vector unsigned char *out;
-    ubyte *img;
-
-    img = in[0];
-    out = (vector unsigned char *)(oplanes[0]+srcSliceY*outstrides[0]);
-
-    for (i=0;i<h;i++) {
-        for (j=0;j<w/16;j++) {
-            uyvy = vec_ld (0, img);
-            U = (vector signed short)
-                vec_perm (uyvy, (vector unsigned char){0}, demux_u);
-
-            V = (vector signed short)
-                vec_perm (uyvy, (vector unsigned char){0}, demux_v);
-
-            Y = (vector signed short)
-                vec_perm (uyvy, (vector unsigned char){0}, demux_y);
-
-            cvtyuvtoRGB (c, Y,U,V,&R0,&G0,&B0);
-
-            uyvy = vec_ld (16, img);
-            U = (vector signed short)
-                vec_perm (uyvy, (vector unsigned char){0}, demux_u);
-
-            V = (vector signed short)
-                vec_perm (uyvy, (vector unsigned char){0}, demux_v);
-
-            Y = (vector signed short)
-                vec_perm (uyvy, (vector unsigned char){0}, demux_y);
-
-            cvtyuvtoRGB (c, Y,U,V,&R1,&G1,&B1);
-
-            R  = vec_packclp (R0,R1);
-            G  = vec_packclp (G0,G1);
-            B  = vec_packclp (B0,B1);
-
-            //      vec_mstbgr24 (R,G,B, out);
-            out_rgba (R,G,B,out);
-
-            img += 32;
-        }
-    }
-    return srcSliceH;
-}
-
-
-
-/* Ok currently the acceleration routine only supports
-   inputs of widths a multiple of 16
-   and heights a multiple 2
-
-   So we just fall back to the C codes for this.
-*/
-SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c)
-{
-    if (!(c->flags & SWS_CPU_CAPS_ALTIVEC))
-        return NULL;
-
-    /*
-      and this seems not to matter too much I tried a bunch of
-      videos with abnormal widths and MPlayer crashes elsewhere.
-      mplayer -vo x11 -rawvideo on:w=350:h=240 raw-350x240.eyuv
-      boom with X11 bad match.
-
-    */
-    if ((c->srcW & 0xf) != 0)    return NULL;
-
-    switch (c->srcFormat) {
-    case PIX_FMT_YUV410P:
-    case PIX_FMT_YUV420P:
-    /*case IMGFMT_CLPL:        ??? */
-    case PIX_FMT_GRAY8:
-    case PIX_FMT_NV12:
-    case PIX_FMT_NV21:
-        if ((c->srcH & 0x1) != 0)
-            return NULL;
-
-        switch(c->dstFormat) {
-        case PIX_FMT_RGB24:
-            av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n");
-            return altivec_yuv2_rgb24;
-        case PIX_FMT_BGR24:
-            av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGR24\n");
-            return altivec_yuv2_bgr24;
-        case PIX_FMT_ARGB:
-            av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ARGB\n");
-            return altivec_yuv2_argb;
-        case PIX_FMT_ABGR:
-            av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ABGR\n");
-            return altivec_yuv2_abgr;
-        case PIX_FMT_RGBA:
-            av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGBA\n");
-            return altivec_yuv2_rgba;
-        case PIX_FMT_BGRA:
-            av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGRA\n");
-            return altivec_yuv2_bgra;
-        default: return NULL;
-        }
-        break;
-
-    case PIX_FMT_UYVY422:
-        switch(c->dstFormat) {
-        case PIX_FMT_BGR32:
-            av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n");
-            return altivec_uyvy_rgb32;
-        default: return NULL;
-        }
-        break;
-
-    }
-    return NULL;
-}
-
-void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation)
-{
-    union {
-        DECLARE_ALIGNED(16, signed short, tmp)[8];
-        vector signed short vec;
-    } buf;
-
-    buf.tmp[0] =  ((0xffffLL) * contrast>>8)>>9;                        //cy
-    buf.tmp[1] =  -256*brightness;                                      //oy
-    buf.tmp[2] =  (inv_table[0]>>3) *(contrast>>16)*(saturation>>16);   //crv
-    buf.tmp[3] =  (inv_table[1]>>3) *(contrast>>16)*(saturation>>16);   //cbu
-    buf.tmp[4] = -((inv_table[2]>>1)*(contrast>>16)*(saturation>>16));  //cgu
-    buf.tmp[5] = -((inv_table[3]>>1)*(contrast>>16)*(saturation>>16));  //cgv
-
-
-    c->CSHIFT = (vector unsigned short)vec_splat_u16(2);
-    c->CY   = vec_splat ((vector signed short)buf.vec, 0);
-    c->OY   = vec_splat ((vector signed short)buf.vec, 1);
-    c->CRV  = vec_splat ((vector signed short)buf.vec, 2);
-    c->CBU  = vec_splat ((vector signed short)buf.vec, 3);
-    c->CGU  = vec_splat ((vector signed short)buf.vec, 4);
-    c->CGV  = vec_splat ((vector signed short)buf.vec, 5);
-    return;
-}
-
-
-void
-ff_yuv2packedX_altivec(SwsContext *c,
-                       const int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
-                       const int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
-                     uint8_t *dest, int dstW, int dstY)
-{
-    int i,j;
-    vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V;
-    vector signed short R0,G0,B0,R1,G1,B1;
-
-    vector unsigned char R,G,B;
-    vector unsigned char *out,*nout;
-
-    vector signed short   RND = vec_splat_s16(1<<3);
-    vector unsigned short SCL = vec_splat_u16(4);
-    DECLARE_ALIGNED(16, unsigned long, scratch)[16];
-
-    vector signed short *YCoeffs, *CCoeffs;
-
-    YCoeffs = c->vYCoeffsBank+dstY*lumFilterSize;
-    CCoeffs = c->vCCoeffsBank+dstY*chrFilterSize;
-
-    out = (vector unsigned char *)dest;
-
-    for (i=0; i<dstW; i+=16) {
-        Y0 = RND;
-        Y1 = RND;
-        /* extract 16 coeffs from lumSrc */
-        for (j=0; j<lumFilterSize; j++) {
-            X0 = vec_ld (0,  &lumSrc[j][i]);
-            X1 = vec_ld (16, &lumSrc[j][i]);
-            Y0 = vec_mradds (X0, YCoeffs[j], Y0);
-            Y1 = vec_mradds (X1, YCoeffs[j], Y1);
-        }
-
-        U = RND;
-        V = RND;
-        /* extract 8 coeffs from U,V */
-        for (j=0; j<chrFilterSize; j++) {
-            X  = vec_ld (0, &chrSrc[j][i/2]);
-            U  = vec_mradds (X, CCoeffs[j], U);
-            X  = vec_ld (0, &chrSrc[j][i/2+2048]);
-            V  = vec_mradds (X, CCoeffs[j], V);
-        }
-
-        /* scale and clip signals */
-        Y0 = vec_sra (Y0, SCL);
-        Y1 = vec_sra (Y1, SCL);
-        U  = vec_sra (U,  SCL);
-        V  = vec_sra (V,  SCL);
-
-        Y0 = vec_clip_s16 (Y0);
-        Y1 = vec_clip_s16 (Y1);
-        U  = vec_clip_s16 (U);
-        V  = vec_clip_s16 (V);
-
-        /* now we have
-          Y0= y0 y1 y2 y3 y4 y5 y6 y7     Y1= y8 y9 y10 y11 y12 y13 y14 y15
-          U= u0 u1 u2 u3 u4 u5 u6 u7      V= v0 v1 v2 v3 v4 v5 v6 v7
-
-          Y0= y0 y1 y2 y3 y4 y5 y6 y7    Y1= y8 y9 y10 y11 y12 y13 y14 y15
-          U0= u0 u0 u1 u1 u2 u2 u3 u3    U1= u4 u4 u5 u5 u6 u6 u7 u7
-          V0= v0 v0 v1 v1 v2 v2 v3 v3    V1= v4 v4 v5 v5 v6 v6 v7 v7
-        */
-
-        U0 = vec_mergeh (U,U);
-        V0 = vec_mergeh (V,V);
-
-        U1 = vec_mergel (U,U);
-        V1 = vec_mergel (V,V);
-
-        cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);
-        cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);
-
-        R  = vec_packclp (R0,R1);
-        G  = vec_packclp (G0,G1);
-        B  = vec_packclp (B0,B1);
-
-        switch(c->dstFormat) {
-        case PIX_FMT_ABGR:  out_abgr  (R,G,B,out); break;
-        case PIX_FMT_BGRA:  out_bgra  (R,G,B,out); break;
-        case PIX_FMT_RGBA:  out_rgba  (R,G,B,out); break;
-        case PIX_FMT_ARGB:  out_argb  (R,G,B,out); break;
-        case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break;
-        case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break;
-        default:
-            {
-                /* If this is reached, the caller should have called yuv2packedXinC
-                   instead. */
-                static int printed_error_message;
-                if (!printed_error_message) {
-                    av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n",
-                           sws_format_name(c->dstFormat));
-                    printed_error_message=1;
-                }
-                return;
-            }
-        }
-    }
-
-    if (i < dstW) {
-        i -= 16;
-
-        Y0 = RND;
-        Y1 = RND;
-        /* extract 16 coeffs from lumSrc */
-        for (j=0; j<lumFilterSize; j++) {
-            X0 = vec_ld (0,  &lumSrc[j][i]);
-            X1 = vec_ld (16, &lumSrc[j][i]);
-            Y0 = vec_mradds (X0, YCoeffs[j], Y0);
-            Y1 = vec_mradds (X1, YCoeffs[j], Y1);
-        }
-
-        U = RND;
-        V = RND;
-        /* extract 8 coeffs from U,V */
-        for (j=0; j<chrFilterSize; j++) {
-            X  = vec_ld (0, &chrSrc[j][i/2]);
-            U  = vec_mradds (X, CCoeffs[j], U);
-            X  = vec_ld (0, &chrSrc[j][i/2+2048]);
-            V  = vec_mradds (X, CCoeffs[j], V);
-        }
-
-        /* scale and clip signals */
-        Y0 = vec_sra (Y0, SCL);
-        Y1 = vec_sra (Y1, SCL);
-        U  = vec_sra (U,  SCL);
-        V  = vec_sra (V,  SCL);
-
-        Y0 = vec_clip_s16 (Y0);
-        Y1 = vec_clip_s16 (Y1);
-        U  = vec_clip_s16 (U);
-        V  = vec_clip_s16 (V);
-
-        /* now we have
-           Y0= y0 y1 y2 y3 y4 y5 y6 y7     Y1= y8 y9 y10 y11 y12 y13 y14 y15
-           U = u0 u1 u2 u3 u4 u5 u6 u7     V = v0 v1 v2 v3 v4 v5 v6 v7
-
-           Y0= y0 y1 y2 y3 y4 y5 y6 y7    Y1= y8 y9 y10 y11 y12 y13 y14 y15
-           U0= u0 u0 u1 u1 u2 u2 u3 u3    U1= u4 u4 u5 u5 u6 u6 u7 u7
-           V0= v0 v0 v1 v1 v2 v2 v3 v3    V1= v4 v4 v5 v5 v6 v6 v7 v7
-        */
-
-        U0 = vec_mergeh (U,U);
-        V0 = vec_mergeh (V,V);
-
-        U1 = vec_mergel (U,U);
-        V1 = vec_mergel (V,V);
-
-        cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);
-        cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);
-
-        R  = vec_packclp (R0,R1);
-        G  = vec_packclp (G0,G1);
-        B  = vec_packclp (B0,B1);
-
-        nout = (vector unsigned char *)scratch;
-        switch(c->dstFormat) {
-        case PIX_FMT_ABGR:  out_abgr  (R,G,B,nout); break;
-        case PIX_FMT_BGRA:  out_bgra  (R,G,B,nout); break;
-        case PIX_FMT_RGBA:  out_rgba  (R,G,B,nout); break;
-        case PIX_FMT_ARGB:  out_argb  (R,G,B,nout); break;
-        case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break;
-        case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break;
-        default:
-            /* Unreachable, I think. */
-            av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n",
-                   sws_format_name(c->dstFormat));
-            return;
-        }
-
-        memcpy (&((uint32_t*)dest)[i], scratch, (dstW-i)/4);
-    }
-
-}
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
deleted file mode 100644
index b506b12..0000000
--- a/libswscale/rgb2rgb.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * software RGB to RGB converter
- * pluralize by software PAL8 to RGB converter
- *              software YUV to YUV converter
- *              software YUV to RGB converter
- * Written by Nick Kurshev.
- * palette & YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <inttypes.h>
-#include "config.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/bswap.h"
-#include "rgb2rgb.h"
-#include "swscale.h"
-#include "swscale_internal.h"
-
-#define FAST_BGR2YV12 // use 7-bit instead of 15-bit coefficients
-
-void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32to16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb16to15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24to16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24to15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-
-void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                   long width, long height,
-                   long lumStride, long chromStride, long dstStride);
-void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                   long width, long height,
-                   long lumStride, long chromStride, long dstStride);
-void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                      long width, long height,
-                      long lumStride, long chromStride, long dstStride);
-void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                      long width, long height,
-                      long lumStride, long chromStride, long dstStride);
-void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                   long width, long height,
-                   long lumStride, long chromStride, long srcStride);
-void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                    long width, long height,
-                    long lumStride, long chromStride, long srcStride);
-void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
-                 long srcStride, long dstStride);
-void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst,
-                        long width, long height, long src1Stride,
-                        long src2Stride, long dstStride);
-void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
-                    uint8_t *dst1, uint8_t *dst2,
-                    long width, long height,
-                    long srcStride1, long srcStride2,
-                    long dstStride1, long dstStride2);
-void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
-                     uint8_t *dst,
-                     long width, long height,
-                     long srcStride1, long srcStride2,
-                     long srcStride3, long dstStride);
-void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                     long width, long height,
-                     long lumStride, long chromStride, long srcStride);
-void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                     long width, long height,
-                     long lumStride, long chromStride, long srcStride);
-void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                     long width, long height,
-                     long lumStride, long chromStride, long srcStride);
-void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                     long width, long height,
-                     long lumStride, long chromStride, long srcStride);
-
-
-#if ARCH_X86
-DECLARE_ASM_CONST(8, uint64_t, mmx_null)     = 0x0000000000000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_one)      = 0xFFFFFFFFFFFFFFFFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32b)      = 0x000000FF000000FFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32g)      = 0x0000FF000000FF00ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32r)      = 0x00FF000000FF0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32a)      = 0xFF000000FF000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32)       = 0x00FFFFFF00FFFFFFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask3216br)   = 0x00F800F800F800F8ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask3216g)    = 0x0000FC000000FC00ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask3215g)    = 0x0000F8000000F800ULL;
-DECLARE_ASM_CONST(8, uint64_t, mul3216)      = 0x2000000420000004ULL;
-DECLARE_ASM_CONST(8, uint64_t, mul3215)      = 0x2000000820000008ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24b)      = 0x00FF0000FF0000FFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24g)      = 0xFF0000FF0000FF00ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24r)      = 0x0000FF0000FF0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24l)      = 0x0000000000FFFFFFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24h)      = 0x0000FFFFFF000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24hh)     = 0xffff000000000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24hhh)    = 0xffffffff00000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24hhhh)   = 0xffffffffffff0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask15b)      = 0x001F001F001F001FULL; /* 00000000 00011111  xxB */
-DECLARE_ASM_CONST(8, uint64_t, mask15rg)     = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000  RGx */
-DECLARE_ASM_CONST(8, uint64_t, mask15s)      = 0xFFE0FFE0FFE0FFE0ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask15g)      = 0x03E003E003E003E0ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask15r)      = 0x7C007C007C007C00ULL;
-#define mask16b mask15b
-DECLARE_ASM_CONST(8, uint64_t, mask16g)      = 0x07E007E007E007E0ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask16r)      = 0xF800F800F800F800ULL;
-DECLARE_ASM_CONST(8, uint64_t, red_16mask)   = 0x0000f8000000f800ULL;
-DECLARE_ASM_CONST(8, uint64_t, green_16mask) = 0x000007e0000007e0ULL;
-DECLARE_ASM_CONST(8, uint64_t, blue_16mask)  = 0x0000001f0000001fULL;
-DECLARE_ASM_CONST(8, uint64_t, red_15mask)   = 0x00007c0000007c00ULL;
-DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL;
-DECLARE_ASM_CONST(8, uint64_t, blue_15mask)  = 0x0000001f0000001fULL;
-#endif /* ARCH_X86 */
-
-#define RGB2YUV_SHIFT 8
-#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
-#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
-#define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
-#define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5))
-#define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5))
-#define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5))
-#define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5))
-#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
-#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
-
-//Note: We have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW + MMX2 one.
-//plain C versions
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#undef HAVE_SSE2
-#define HAVE_MMX 0
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 0
-#define HAVE_SSE2 0
-#define RENAME(a) a ## _C
-#include "rgb2rgb_template.c"
-
-#if ARCH_X86
-
-//MMX versions
-#undef RENAME
-#undef HAVE_MMX
-#define HAVE_MMX 1
-#define RENAME(a) a ## _MMX
-#include "rgb2rgb_template.c"
-
-//MMX2 versions
-#undef RENAME
-#undef HAVE_MMX2
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "rgb2rgb_template.c"
-
-//3DNOW versions
-#undef RENAME
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 1
-#define RENAME(a) a ## _3DNOW
-#include "rgb2rgb_template.c"
-
-#endif //ARCH_X86 || ARCH_X86_64
-
-/*
- RGB15->RGB16 original by Strepto/Astral
- ported to gcc & bugfixed : A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
- 32-bit C version, and and&add trick by Michael Niedermayer
-*/
-
-void sws_rgb2rgb_init(int flags)
-{
-#if HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX
-    if (flags & SWS_CPU_CAPS_MMX2)
-        rgb2rgb_init_MMX2();
-    else if (flags & SWS_CPU_CAPS_3DNOW)
-        rgb2rgb_init_3DNOW();
-    else if (flags & SWS_CPU_CAPS_MMX)
-        rgb2rgb_init_MMX();
-    else
-#endif /* HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX */
-        rgb2rgb_init_C();
-}
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
-    sws_convertPalette8ToPacked32(src, dst, num_pixels, palette);
-}
-
-void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
-    sws_convertPalette8ToPacked24(src, dst, num_pixels, palette);
-}
-
-/**
- * Palette is assumed to contain BGR16, see rgb32to16 to convert the palette.
- */
-void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
-    long i;
-    for (i=0; i<num_pixels; i++)
-        ((uint16_t *)dst)[i] = ((const uint16_t *)palette)[src[i]];
-}
-void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
-    long i;
-    for (i=0; i<num_pixels; i++)
-        ((uint16_t *)dst)[i] = bswap_16(((const uint16_t *)palette)[src[i]]);
-}
-
-#endif
-
-void rgb32to24(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    long i;
-    long num_pixels = src_size >> 2;
-    for (i=0; i<num_pixels; i++) {
-#if HAVE_BIGENDIAN
-        /* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
-        dst[3*i + 0] = src[4*i + 1];
-        dst[3*i + 1] = src[4*i + 2];
-        dst[3*i + 2] = src[4*i + 3];
-#else
-        dst[3*i + 0] = src[4*i + 2];
-        dst[3*i + 1] = src[4*i + 1];
-        dst[3*i + 2] = src[4*i + 0];
-#endif
-    }
-}
-
-void rgb24to32(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    long i;
-    for (i=0; 3*i<src_size; i++) {
-#if HAVE_BIGENDIAN
-        /* RGB24 (= R,G,B) -> BGR32 (= A,R,G,B) */
-        dst[4*i + 0] = 255;
-        dst[4*i + 1] = src[3*i + 0];
-        dst[4*i + 2] = src[3*i + 1];
-        dst[4*i + 3] = src[3*i + 2];
-#else
-        dst[4*i + 0] = src[3*i + 2];
-        dst[4*i + 1] = src[3*i + 1];
-        dst[4*i + 2] = src[3*i + 0];
-        dst[4*i + 3] = 255;
-#endif
-    }
-}
-
-void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-    uint8_t *d = dst;
-    const uint16_t *s = (const uint16_t *)src;
-    end = s + src_size/2;
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-#if HAVE_BIGENDIAN
-        *d++ = 255;
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = (bgr&0x7E0)>>3;
-        *d++ = (bgr&0xF800)>>8;
-#else
-        *d++ = (bgr&0xF800)>>8;
-        *d++ = (bgr&0x7E0)>>3;
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = 255;
-#endif
-    }
-}
-
-void rgb16to24(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-    uint8_t *d = dst;
-    const uint16_t *s = (const uint16_t *)src;
-    end = s + src_size/2;
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-        *d++ = (bgr&0xF800)>>8;
-        *d++ = (bgr&0x7E0)>>3;
-        *d++ = (bgr&0x1F)<<3;
-    }
-}
-
-void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    long i;
-    long num_pixels = src_size >> 1;
-
-    for (i=0; i<num_pixels; i++) {
-        unsigned rgb = ((const uint16_t*)src)[i];
-        ((uint16_t*)dst)[i] = (rgb>>11) | (rgb&0x7E0) | (rgb<<11);
-    }
-}
-
-void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    long i;
-    long num_pixels = src_size >> 1;
-
-    for (i=0; i<num_pixels; i++) {
-        unsigned rgb = ((const uint16_t*)src)[i];
-        ((uint16_t*)dst)[i] = (rgb>>11) | ((rgb&0x7C0)>>1) | ((rgb&0x1F)<<10);
-    }
-}
-
-void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-    uint8_t *d = dst;
-    const uint16_t *s = (const uint16_t *)src;
-    end = s + src_size/2;
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-#if HAVE_BIGENDIAN
-        *d++ = 255;
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = (bgr&0x3E0)>>2;
-        *d++ = (bgr&0x7C00)>>7;
-#else
-        *d++ = (bgr&0x7C00)>>7;
-        *d++ = (bgr&0x3E0)>>2;
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = 255;
-#endif
-    }
-}
-
-void rgb15to24(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-    uint8_t *d = dst;
-    const uint16_t *s = (const uint16_t *)src;
-    end = s + src_size/2;
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-        *d++ = (bgr&0x7C00)>>7;
-        *d++ = (bgr&0x3E0)>>2;
-        *d++ = (bgr&0x1F)<<3;
-    }
-}
-
-void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    long i;
-    long num_pixels = src_size >> 1;
-
-    for (i=0; i<num_pixels; i++) {
-        unsigned rgb = ((const uint16_t*)src)[i];
-        ((uint16_t*)dst)[i] = ((rgb&0x7C00)>>10) | ((rgb&0x3E0)<<1) | (rgb<<11);
-    }
-}
-
-void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    long i;
-    long num_pixels = src_size >> 1;
-
-    for (i=0; i<num_pixels; i++) {
-        unsigned br;
-        unsigned rgb = ((const uint16_t*)src)[i];
-        br = rgb&0x7c1F;
-        ((uint16_t*)dst)[i] = (br>>10) | (rgb&0x3E0) | (br<<10);
-    }
-}
-
-void bgr8torgb8(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    long i;
-    long num_pixels = src_size;
-    for (i=0; i<num_pixels; i++) {
-        unsigned b,g,r;
-        register uint8_t rgb;
-        rgb = src[i];
-        r = (rgb&0x07);
-        g = (rgb&0x38)>>3;
-        b = (rgb&0xC0)>>6;
-        dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6);
-    }
-}
-
-#define DEFINE_SHUFFLE_BYTES(a, b, c, d)                                \
-void shuffle_bytes_##a##b##c##d(const uint8_t *src, uint8_t *dst, long src_size) \
-{                                                                       \
-    long i;                                                             \
-                                                                        \
-    for (i = 0; i < src_size; i+=4) {                                   \
-        dst[i + 0] = src[i + a];                                        \
-        dst[i + 1] = src[i + b];                                        \
-        dst[i + 2] = src[i + c];                                        \
-        dst[i + 3] = src[i + d];                                        \
-    }                                                                   \
-}
-
-DEFINE_SHUFFLE_BYTES(0, 3, 2, 1);
-DEFINE_SHUFFLE_BYTES(1, 2, 3, 0);
-DEFINE_SHUFFLE_BYTES(2, 1, 0, 3);
-DEFINE_SHUFFLE_BYTES(3, 0, 1, 2);
-DEFINE_SHUFFLE_BYTES(3, 2, 1, 0);
-
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
deleted file mode 100644
index 2e182dd..0000000
--- a/libswscale/rgb2rgb.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- *  software RGB to RGB converter
- *  pluralize by Software PAL8 to RGB converter
- *               Software YUV to YUV converter
- *               Software YUV to RGB converter
- *  Written by Nick Kurshev.
- *  YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SWSCALE_RGB2RGB_H
-#define SWSCALE_RGB2RGB_H
-
-#include <inttypes.h>
-
-#include "libswscale/swscale.h"
-#include "libavutil/avutil.h"
-
-/* A full collection of RGB to RGB(BGR) converters */
-extern void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32to16)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32to15)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb15to16)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb15to32)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb16to15)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb16to32)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24to16)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24to15)   (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-
-void rgb24to32   (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb32to24   (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16to24   (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15to24   (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
-void bgr8torgb8  (const uint8_t *src, uint8_t *dst, long src_size);
-
-void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, long src_size);
-void shuffle_bytes_1230(const uint8_t *src, uint8_t *dst, long src_size);
-void shuffle_bytes_2103(const uint8_t *src, uint8_t *dst, long src_size);
-void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, long src_size);
-void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, long src_size);
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-/* deprecated, use the public versions in swscale.h */
-attribute_deprecated void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-attribute_deprecated void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-
-/* totally deprecated, please fix code that uses this */
-attribute_deprecated void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-attribute_deprecated void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-#endif
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line, others are ignored.
- * FIXME: Write high quality version.
- */
-//void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                          long width, long height,
-                          long lumStride, long chromStride, long dstStride);
-
-/**
- * Width should be a multiple of 16.
- */
-extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                             long width, long height,
-                             long lumStride, long chromStride, long dstStride);
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                          long width, long height,
-                          long lumStride, long chromStride, long srcStride);
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                          long width, long height,
-                          long lumStride, long chromStride, long dstStride);
-
-/**
- * Width should be a multiple of 16.
- */
-extern void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                             long width, long height,
-                             long lumStride, long chromStride, long dstStride);
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 2.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line, others are ignored.
- * FIXME: Write high quality version.
- */
-extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                           long width, long height,
-                           long lumStride, long chromStride, long srcStride);
-extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
-                        long srcStride, long dstStride);
-
-extern void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst,
-                               long width, long height, long src1Stride,
-                               long src2Stride, long dstStride);
-
-extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
-                           uint8_t *dst1, uint8_t *dst2,
-                           long width, long height,
-                           long srcStride1, long srcStride2,
-                           long dstStride1, long dstStride2);
-
-extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
-                            uint8_t *dst,
-                            long width, long height,
-                            long srcStride1, long srcStride2,
-                            long srcStride3, long dstStride);
-
-
-extern void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                            long width, long height,
-                            long lumStride, long chromStride, long srcStride);
-extern void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                            long width, long height,
-                            long lumStride, long chromStride, long srcStride);
-extern void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                            long width, long height,
-                            long lumStride, long chromStride, long srcStride);
-extern void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                            long width, long height,
-                            long lumStride, long chromStride, long srcStride);
-
-void sws_rgb2rgb_init(int flags);
-
-#endif /* SWSCALE_RGB2RGB_H */
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
deleted file mode 100644
index d86cafc..0000000
--- a/libswscale/rgb2rgb_template.c
+++ /dev/null
@@ -1,2944 +0,0 @@
-/*
- * software RGB to RGB converter
- * pluralize by software PAL8 to RGB converter
- *              software YUV to YUV converter
- *              software YUV to RGB converter
- * Written by Nick Kurshev.
- * palette & YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
- * lot of big-endian byte order fixes by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stddef.h>
-
-#undef PREFETCH
-#undef MOVNTQ
-#undef EMMS
-#undef SFENCE
-#undef MMREG_SIZE
-#undef PAVGB
-
-#if HAVE_SSE2
-#define MMREG_SIZE 16
-#else
-#define MMREG_SIZE 8
-#endif
-
-#if HAVE_AMD3DNOW
-#define PREFETCH  "prefetch"
-#define PAVGB     "pavgusb"
-#elif HAVE_MMX2
-#define PREFETCH "prefetchnta"
-#define PAVGB     "pavgb"
-#else
-#define PREFETCH  " # nop"
-#endif
-
-#if HAVE_AMD3DNOW
-/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
-#define EMMS     "femms"
-#else
-#define EMMS     "emms"
-#endif
-
-#if HAVE_MMX2
-#define MOVNTQ "movntq"
-#define SFENCE "sfence"
-#else
-#define MOVNTQ "movq"
-#define SFENCE " # nop"
-#endif
-
-static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    uint8_t *dest = dst;
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s):"memory");
-    mm_end = end - 23;
-    __asm__ volatile("movq        %0, %%mm7"::"m"(mask32a):"memory");
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "punpckldq    3%1, %%mm0    \n\t"
-            "movd         6%1, %%mm1    \n\t"
-            "punpckldq    9%1, %%mm1    \n\t"
-            "movd        12%1, %%mm2    \n\t"
-            "punpckldq   15%1, %%mm2    \n\t"
-            "movd        18%1, %%mm3    \n\t"
-            "punpckldq   21%1, %%mm3    \n\t"
-            "por        %%mm7, %%mm0    \n\t"
-            "por        %%mm7, %%mm1    \n\t"
-            "por        %%mm7, %%mm2    \n\t"
-            "por        %%mm7, %%mm3    \n\t"
-            MOVNTQ"     %%mm0,   %0     \n\t"
-            MOVNTQ"     %%mm1,  8%0     \n\t"
-            MOVNTQ"     %%mm2, 16%0     \n\t"
-            MOVNTQ"     %%mm3, 24%0"
-            :"=m"(*dest)
-            :"m"(*s)
-            :"memory");
-        dest += 32;
-        s += 24;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-#if HAVE_BIGENDIAN
-        /* RGB24 (= R,G,B) -> RGB32 (= A,B,G,R) */
-        *dest++ = 255;
-        *dest++ = s[2];
-        *dest++ = s[1];
-        *dest++ = s[0];
-        s+=3;
-#else
-        *dest++ = *s++;
-        *dest++ = *s++;
-        *dest++ = *s++;
-        *dest++ = 255;
-#endif
-    }
-}
-
-#define STORE_BGR24_MMX \
-            "psrlq         $8, %%mm2    \n\t" \
-            "psrlq         $8, %%mm3    \n\t" \
-            "psrlq         $8, %%mm6    \n\t" \
-            "psrlq         $8, %%mm7    \n\t" \
-            "pand "MANGLE(mask24l)", %%mm0\n\t" \
-            "pand "MANGLE(mask24l)", %%mm1\n\t" \
-            "pand "MANGLE(mask24l)", %%mm4\n\t" \
-            "pand "MANGLE(mask24l)", %%mm5\n\t" \
-            "pand "MANGLE(mask24h)", %%mm2\n\t" \
-            "pand "MANGLE(mask24h)", %%mm3\n\t" \
-            "pand "MANGLE(mask24h)", %%mm6\n\t" \
-            "pand "MANGLE(mask24h)", %%mm7\n\t" \
-            "por        %%mm2, %%mm0    \n\t" \
-            "por        %%mm3, %%mm1    \n\t" \
-            "por        %%mm6, %%mm4    \n\t" \
-            "por        %%mm7, %%mm5    \n\t" \
- \
-            "movq       %%mm1, %%mm2    \n\t" \
-            "movq       %%mm4, %%mm3    \n\t" \
-            "psllq        $48, %%mm2    \n\t" \
-            "psllq        $32, %%mm3    \n\t" \
-            "pand "MANGLE(mask24hh)", %%mm2\n\t" \
-            "pand "MANGLE(mask24hhh)", %%mm3\n\t" \
-            "por        %%mm2, %%mm0    \n\t" \
-            "psrlq        $16, %%mm1    \n\t" \
-            "psrlq        $32, %%mm4    \n\t" \
-            "psllq        $16, %%mm5    \n\t" \
-            "por        %%mm3, %%mm1    \n\t" \
-            "pand  "MANGLE(mask24hhhh)", %%mm5\n\t" \
-            "por        %%mm5, %%mm4    \n\t" \
- \
-            MOVNTQ"     %%mm0,   %0     \n\t" \
-            MOVNTQ"     %%mm1,  8%0     \n\t" \
-            MOVNTQ"     %%mm4, 16%0"
-
-
-static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    uint8_t *dest = dst;
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s):"memory");
-    mm_end = end - 31;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movq          %1, %%mm0    \n\t"
-            "movq         8%1, %%mm1    \n\t"
-            "movq        16%1, %%mm4    \n\t"
-            "movq        24%1, %%mm5    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm1, %%mm3    \n\t"
-            "movq       %%mm4, %%mm6    \n\t"
-            "movq       %%mm5, %%mm7    \n\t"
-            STORE_BGR24_MMX
-            :"=m"(*dest)
-            :"m"(*s)
-            :"memory");
-        dest += 24;
-        s += 32;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-#if HAVE_BIGENDIAN
-        /* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
-        s++;
-        dest[2] = *s++;
-        dest[1] = *s++;
-        dest[0] = *s++;
-        dest += 3;
-#else
-        *dest++ = *s++;
-        *dest++ = *s++;
-        *dest++ = *s++;
-        s++;
-#endif
-    }
-}
-
-/*
- original by Strepto/Astral
- ported to gcc & bugfixed: A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
- 32-bit C version, and and&add trick by Michael Niedermayer
-*/
-static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    register const uint8_t* s=src;
-    register uint8_t* d=dst;
-    register const uint8_t *end;
-    const uint8_t *mm_end;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s));
-    __asm__ volatile("movq        %0, %%mm4"::"m"(mask15s));
-    mm_end = end - 15;
-    while (s<mm_end) {
-        __asm__ volatile(
-            PREFETCH"  32%1         \n\t"
-            "movq        %1, %%mm0  \n\t"
-            "movq       8%1, %%mm2  \n\t"
-            "movq     %%mm0, %%mm1  \n\t"
-            "movq     %%mm2, %%mm3  \n\t"
-            "pand     %%mm4, %%mm0  \n\t"
-            "pand     %%mm4, %%mm2  \n\t"
-            "paddw    %%mm1, %%mm0  \n\t"
-            "paddw    %%mm3, %%mm2  \n\t"
-            MOVNTQ"   %%mm0,  %0    \n\t"
-            MOVNTQ"   %%mm2, 8%0"
-            :"=m"(*d)
-            :"m"(*s)
-        );
-        d+=16;
-        s+=16;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    mm_end = end - 3;
-    while (s < mm_end) {
-        register unsigned x= *((const uint32_t *)s);
-        *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0);
-        d+=4;
-        s+=4;
-    }
-    if (s < end) {
-        register unsigned short x= *((const uint16_t *)s);
-        *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0);
-    }
-}
-
-static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    register const uint8_t* s=src;
-    register uint8_t* d=dst;
-    register const uint8_t *end;
-    const uint8_t *mm_end;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s));
-    __asm__ volatile("movq        %0, %%mm7"::"m"(mask15rg));
-    __asm__ volatile("movq        %0, %%mm6"::"m"(mask15b));
-    mm_end = end - 15;
-    while (s<mm_end) {
-        __asm__ volatile(
-            PREFETCH"  32%1         \n\t"
-            "movq        %1, %%mm0  \n\t"
-            "movq       8%1, %%mm2  \n\t"
-            "movq     %%mm0, %%mm1  \n\t"
-            "movq     %%mm2, %%mm3  \n\t"
-            "psrlq       $1, %%mm0  \n\t"
-            "psrlq       $1, %%mm2  \n\t"
-            "pand     %%mm7, %%mm0  \n\t"
-            "pand     %%mm7, %%mm2  \n\t"
-            "pand     %%mm6, %%mm1  \n\t"
-            "pand     %%mm6, %%mm3  \n\t"
-            "por      %%mm1, %%mm0  \n\t"
-            "por      %%mm3, %%mm2  \n\t"
-            MOVNTQ"   %%mm0,  %0    \n\t"
-            MOVNTQ"   %%mm2, 8%0"
-            :"=m"(*d)
-            :"m"(*s)
-        );
-        d+=16;
-        s+=16;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    mm_end = end - 3;
-    while (s < mm_end) {
-        register uint32_t x= *((const uint32_t*)s);
-        *((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F);
-        s+=4;
-        d+=4;
-    }
-    if (s < end) {
-        register uint16_t x= *((const uint16_t*)s);
-        *((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F);
-    }
-}
-
-static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    mm_end = end - 15;
-#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
-    __asm__ volatile(
-        "movq           %3, %%mm5   \n\t"
-        "movq           %4, %%mm6   \n\t"
-        "movq           %5, %%mm7   \n\t"
-        "jmp 2f                     \n\t"
-        ASMALIGN(4)
-        "1:                         \n\t"
-        PREFETCH"   32(%1)          \n\t"
-        "movd         (%1), %%mm0   \n\t"
-        "movd        4(%1), %%mm3   \n\t"
-        "punpckldq   8(%1), %%mm0   \n\t"
-        "punpckldq  12(%1), %%mm3   \n\t"
-        "movq        %%mm0, %%mm1   \n\t"
-        "movq        %%mm3, %%mm4   \n\t"
-        "pand        %%mm6, %%mm0   \n\t"
-        "pand        %%mm6, %%mm3   \n\t"
-        "pmaddwd     %%mm7, %%mm0   \n\t"
-        "pmaddwd     %%mm7, %%mm3   \n\t"
-        "pand        %%mm5, %%mm1   \n\t"
-        "pand        %%mm5, %%mm4   \n\t"
-        "por         %%mm1, %%mm0   \n\t"
-        "por         %%mm4, %%mm3   \n\t"
-        "psrld          $5, %%mm0   \n\t"
-        "pslld         $11, %%mm3   \n\t"
-        "por         %%mm3, %%mm0   \n\t"
-        MOVNTQ"      %%mm0, (%0)    \n\t"
-        "add           $16,  %1     \n\t"
-        "add            $8,  %0     \n\t"
-        "2:                         \n\t"
-        "cmp            %2,  %1     \n\t"
-        " jb            1b          \n\t"
-        : "+r" (d), "+r"(s)
-        : "r" (mm_end), "m" (mask3216g), "m" (mask3216br), "m" (mul3216)
-    );
-#else
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq    %0, %%mm7    \n\t"
-        "movq    %1, %%mm6    \n\t"
-        ::"m"(red_16mask),"m"(green_16mask));
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "movd         4%1, %%mm3    \n\t"
-            "punpckldq    8%1, %%mm0    \n\t"
-            "punpckldq   12%1, %%mm3    \n\t"
-            "movq       %%mm0, %%mm1    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm3, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "psrlq         $3, %%mm0    \n\t"
-            "psrlq         $3, %%mm3    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %2, %%mm3    \n\t"
-            "psrlq         $5, %%mm1    \n\t"
-            "psrlq         $5, %%mm4    \n\t"
-            "pand       %%mm6, %%mm1    \n\t"
-            "pand       %%mm6, %%mm4    \n\t"
-            "psrlq         $8, %%mm2    \n\t"
-            "psrlq         $8, %%mm5    \n\t"
-            "pand       %%mm7, %%mm2    \n\t"
-            "pand       %%mm7, %%mm5    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            "psllq        $16, %%mm3    \n\t"
-            "por        %%mm3, %%mm0    \n\t"
-            MOVNTQ"     %%mm0, %0       \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
-        d += 4;
-        s += 16;
-    }
-#endif
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register int rgb = *(const uint32_t*)s; s += 4;
-        *d++ = ((rgb&0xFF)>>3) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>8);
-    }
-}
-
-static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq          %0, %%mm7    \n\t"
-        "movq          %1, %%mm6    \n\t"
-        ::"m"(red_16mask),"m"(green_16mask));
-    mm_end = end - 15;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "movd         4%1, %%mm3    \n\t"
-            "punpckldq    8%1, %%mm0    \n\t"
-            "punpckldq   12%1, %%mm3    \n\t"
-            "movq       %%mm0, %%mm1    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm3, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "psllq         $8, %%mm0    \n\t"
-            "psllq         $8, %%mm3    \n\t"
-            "pand       %%mm7, %%mm0    \n\t"
-            "pand       %%mm7, %%mm3    \n\t"
-            "psrlq         $5, %%mm1    \n\t"
-            "psrlq         $5, %%mm4    \n\t"
-            "pand       %%mm6, %%mm1    \n\t"
-            "pand       %%mm6, %%mm4    \n\t"
-            "psrlq        $19, %%mm2    \n\t"
-            "psrlq        $19, %%mm5    \n\t"
-            "pand          %2, %%mm2    \n\t"
-            "pand          %2, %%mm5    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            "psllq        $16, %%mm3    \n\t"
-            "por        %%mm3, %%mm0    \n\t"
-            MOVNTQ"     %%mm0, %0       \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
-        d += 4;
-        s += 16;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register int rgb = *(const uint32_t*)s; s += 4;
-        *d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19);
-    }
-}
-
-static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    mm_end = end - 15;
-#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
-    __asm__ volatile(
-        "movq           %3, %%mm5   \n\t"
-        "movq           %4, %%mm6   \n\t"
-        "movq           %5, %%mm7   \n\t"
-        "jmp            2f          \n\t"
-        ASMALIGN(4)
-        "1:                         \n\t"
-        PREFETCH"   32(%1)          \n\t"
-        "movd         (%1), %%mm0   \n\t"
-        "movd        4(%1), %%mm3   \n\t"
-        "punpckldq   8(%1), %%mm0   \n\t"
-        "punpckldq  12(%1), %%mm3   \n\t"
-        "movq        %%mm0, %%mm1   \n\t"
-        "movq        %%mm3, %%mm4   \n\t"
-        "pand        %%mm6, %%mm0   \n\t"
-        "pand        %%mm6, %%mm3   \n\t"
-        "pmaddwd     %%mm7, %%mm0   \n\t"
-        "pmaddwd     %%mm7, %%mm3   \n\t"
-        "pand        %%mm5, %%mm1   \n\t"
-        "pand        %%mm5, %%mm4   \n\t"
-        "por         %%mm1, %%mm0   \n\t"
-        "por         %%mm4, %%mm3   \n\t"
-        "psrld          $6, %%mm0   \n\t"
-        "pslld         $10, %%mm3   \n\t"
-        "por         %%mm3, %%mm0   \n\t"
-        MOVNTQ"      %%mm0, (%0)    \n\t"
-        "add           $16,  %1     \n\t"
-        "add            $8,  %0     \n\t"
-        "2:                         \n\t"
-        "cmp            %2,  %1     \n\t"
-        " jb            1b          \n\t"
-        : "+r" (d), "+r"(s)
-        : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
-    );
-#else
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq          %0, %%mm7    \n\t"
-        "movq          %1, %%mm6    \n\t"
-        ::"m"(red_15mask),"m"(green_15mask));
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "movd         4%1, %%mm3    \n\t"
-            "punpckldq    8%1, %%mm0    \n\t"
-            "punpckldq   12%1, %%mm3    \n\t"
-            "movq       %%mm0, %%mm1    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm3, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "psrlq         $3, %%mm0    \n\t"
-            "psrlq         $3, %%mm3    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %2, %%mm3    \n\t"
-            "psrlq         $6, %%mm1    \n\t"
-            "psrlq         $6, %%mm4    \n\t"
-            "pand       %%mm6, %%mm1    \n\t"
-            "pand       %%mm6, %%mm4    \n\t"
-            "psrlq         $9, %%mm2    \n\t"
-            "psrlq         $9, %%mm5    \n\t"
-            "pand       %%mm7, %%mm2    \n\t"
-            "pand       %%mm7, %%mm5    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            "psllq        $16, %%mm3    \n\t"
-            "por        %%mm3, %%mm0    \n\t"
-            MOVNTQ"     %%mm0, %0       \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
-        d += 4;
-        s += 16;
-    }
-#endif
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register int rgb = *(const uint32_t*)s; s += 4;
-        *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
-    }
-}
-
-static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq          %0, %%mm7    \n\t"
-        "movq          %1, %%mm6    \n\t"
-        ::"m"(red_15mask),"m"(green_15mask));
-    mm_end = end - 15;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "movd         4%1, %%mm3    \n\t"
-            "punpckldq    8%1, %%mm0    \n\t"
-            "punpckldq   12%1, %%mm3    \n\t"
-            "movq       %%mm0, %%mm1    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm3, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "psllq         $7, %%mm0    \n\t"
-            "psllq         $7, %%mm3    \n\t"
-            "pand       %%mm7, %%mm0    \n\t"
-            "pand       %%mm7, %%mm3    \n\t"
-            "psrlq         $6, %%mm1    \n\t"
-            "psrlq         $6, %%mm4    \n\t"
-            "pand       %%mm6, %%mm1    \n\t"
-            "pand       %%mm6, %%mm4    \n\t"
-            "psrlq        $19, %%mm2    \n\t"
-            "psrlq        $19, %%mm5    \n\t"
-            "pand          %2, %%mm2    \n\t"
-            "pand          %2, %%mm5    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            "psllq        $16, %%mm3    \n\t"
-            "por        %%mm3, %%mm0    \n\t"
-            MOVNTQ"     %%mm0, %0       \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
-        d += 4;
-        s += 16;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register int rgb = *(const uint32_t*)s; s += 4;
-        *d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19);
-    }
-}
-
-static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq         %0, %%mm7     \n\t"
-        "movq         %1, %%mm6     \n\t"
-        ::"m"(red_16mask),"m"(green_16mask));
-    mm_end = end - 11;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "movd         3%1, %%mm3    \n\t"
-            "punpckldq    6%1, %%mm0    \n\t"
-            "punpckldq    9%1, %%mm3    \n\t"
-            "movq       %%mm0, %%mm1    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm3, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "psrlq         $3, %%mm0    \n\t"
-            "psrlq         $3, %%mm3    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %2, %%mm3    \n\t"
-            "psrlq         $5, %%mm1    \n\t"
-            "psrlq         $5, %%mm4    \n\t"
-            "pand       %%mm6, %%mm1    \n\t"
-            "pand       %%mm6, %%mm4    \n\t"
-            "psrlq         $8, %%mm2    \n\t"
-            "psrlq         $8, %%mm5    \n\t"
-            "pand       %%mm7, %%mm2    \n\t"
-            "pand       %%mm7, %%mm5    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            "psllq        $16, %%mm3    \n\t"
-            "por        %%mm3, %%mm0    \n\t"
-            MOVNTQ"     %%mm0, %0       \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
-        d += 4;
-        s += 12;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        const int b = *s++;
-        const int g = *s++;
-        const int r = *s++;
-        *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
-    }
-}
-
-static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq         %0, %%mm7     \n\t"
-        "movq         %1, %%mm6     \n\t"
-        ::"m"(red_16mask),"m"(green_16mask));
-    mm_end = end - 15;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "movd         3%1, %%mm3    \n\t"
-            "punpckldq    6%1, %%mm0    \n\t"
-            "punpckldq    9%1, %%mm3    \n\t"
-            "movq       %%mm0, %%mm1    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm3, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "psllq         $8, %%mm0    \n\t"
-            "psllq         $8, %%mm3    \n\t"
-            "pand       %%mm7, %%mm0    \n\t"
-            "pand       %%mm7, %%mm3    \n\t"
-            "psrlq         $5, %%mm1    \n\t"
-            "psrlq         $5, %%mm4    \n\t"
-            "pand       %%mm6, %%mm1    \n\t"
-            "pand       %%mm6, %%mm4    \n\t"
-            "psrlq        $19, %%mm2    \n\t"
-            "psrlq        $19, %%mm5    \n\t"
-            "pand          %2, %%mm2    \n\t"
-            "pand          %2, %%mm5    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            "psllq        $16, %%mm3    \n\t"
-            "por        %%mm3, %%mm0    \n\t"
-            MOVNTQ"     %%mm0, %0       \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
-        d += 4;
-        s += 12;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        const int r = *s++;
-        const int g = *s++;
-        const int b = *s++;
-        *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
-    }
-}
-
-static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq          %0, %%mm7    \n\t"
-        "movq          %1, %%mm6    \n\t"
-        ::"m"(red_15mask),"m"(green_15mask));
-    mm_end = end - 11;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movd          %1, %%mm0    \n\t"
-            "movd         3%1, %%mm3    \n\t"
-            "punpckldq    6%1, %%mm0    \n\t"
-            "punpckldq    9%1, %%mm3    \n\t"
-            "movq       %%mm0, %%mm1    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm3, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "psrlq         $3, %%mm0    \n\t"
-            "psrlq         $3, %%mm3    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %2, %%mm3    \n\t"
-            "psrlq         $6, %%mm1    \n\t"
-            "psrlq         $6, %%mm4    \n\t"
-            "pand       %%mm6, %%mm1    \n\t"
-            "pand       %%mm6, %%mm4    \n\t"
-            "psrlq         $9, %%mm2    \n\t"
-            "psrlq         $9, %%mm5    \n\t"
-            "pand       %%mm7, %%mm2    \n\t"
-            "pand       %%mm7, %%mm5    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            "psllq        $16, %%mm3    \n\t"
-            "por        %%mm3, %%mm0    \n\t"
-            MOVNTQ"     %%mm0, %0       \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
-        d += 4;
-        s += 12;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        const int b = *s++;
-        const int g = *s++;
-        const int r = *s++;
-        *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
-    }
-}
-
-static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint8_t *s = src;
-    const uint8_t *end;
-#if HAVE_MMX
-    const uint8_t *mm_end;
-#endif
-    uint16_t *d = (uint16_t *)dst;
-    end = s + src_size;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*src):"memory");
-    __asm__ volatile(
-        "movq         %0, %%mm7     \n\t"
-        "movq         %1, %%mm6     \n\t"
-        ::"m"(red_15mask),"m"(green_15mask));
-    mm_end = end - 15;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"   32%1            \n\t"
-            "movd         %1, %%mm0     \n\t"
-            "movd        3%1, %%mm3     \n\t"
-            "punpckldq   6%1, %%mm0     \n\t"
-            "punpckldq   9%1, %%mm3     \n\t"
-            "movq      %%mm0, %%mm1     \n\t"
-            "movq      %%mm0, %%mm2     \n\t"
-            "movq      %%mm3, %%mm4     \n\t"
-            "movq      %%mm3, %%mm5     \n\t"
-            "psllq        $7, %%mm0     \n\t"
-            "psllq        $7, %%mm3     \n\t"
-            "pand      %%mm7, %%mm0     \n\t"
-            "pand      %%mm7, %%mm3     \n\t"
-            "psrlq        $6, %%mm1     \n\t"
-            "psrlq        $6, %%mm4     \n\t"
-            "pand      %%mm6, %%mm1     \n\t"
-            "pand      %%mm6, %%mm4     \n\t"
-            "psrlq       $19, %%mm2     \n\t"
-            "psrlq       $19, %%mm5     \n\t"
-            "pand         %2, %%mm2     \n\t"
-            "pand         %2, %%mm5     \n\t"
-            "por       %%mm1, %%mm0     \n\t"
-            "por       %%mm4, %%mm3     \n\t"
-            "por       %%mm2, %%mm0     \n\t"
-            "por       %%mm5, %%mm3     \n\t"
-            "psllq       $16, %%mm3     \n\t"
-            "por       %%mm3, %%mm0     \n\t"
-            MOVNTQ"    %%mm0, %0        \n\t"
-            :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
-        d += 4;
-        s += 12;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        const int r = *s++;
-        const int g = *s++;
-        const int b = *s++;
-        *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
-    }
-}
-
-/*
-  I use less accurate approximation here by simply left-shifting the input
-  value and filling the low order bits with zeroes. This method improves PNG
-  compression but this scheme cannot reproduce white exactly, since it does
-  not generate an all-ones maximum value; the net effect is to darken the
-  image slightly.
-
-  The better method should be "left bit replication":
-
-   4 3 2 1 0
-   ---------
-   1 1 0 1 1
-
-   7 6 5 4 3  2 1 0
-   ----------------
-   1 1 0 1 1  1 1 0
-   |=======|  |===|
-       |      leftmost bits repeated to fill open bits
-       |
-   original bits
-*/
-static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-#if HAVE_MMX
-    const uint16_t *mm_end;
-#endif
-    uint8_t *d = dst;
-    const uint16_t *s = (const uint16_t*)src;
-    end = s + src_size/2;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s):"memory");
-    mm_end = end - 7;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movq          %1, %%mm0    \n\t"
-            "movq          %1, %%mm1    \n\t"
-            "movq          %1, %%mm2    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %3, %%mm1    \n\t"
-            "pand          %4, %%mm2    \n\t"
-            "psllq         $3, %%mm0    \n\t"
-            "psrlq         $2, %%mm1    \n\t"
-            "psrlq         $7, %%mm2    \n\t"
-            "movq       %%mm0, %%mm3    \n\t"
-            "movq       %%mm1, %%mm4    \n\t"
-            "movq       %%mm2, %%mm5    \n\t"
-            "punpcklwd     %5, %%mm0    \n\t"
-            "punpcklwd     %5, %%mm1    \n\t"
-            "punpcklwd     %5, %%mm2    \n\t"
-            "punpckhwd     %5, %%mm3    \n\t"
-            "punpckhwd     %5, %%mm4    \n\t"
-            "punpckhwd     %5, %%mm5    \n\t"
-            "psllq         $8, %%mm1    \n\t"
-            "psllq        $16, %%mm2    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "psllq         $8, %%mm4    \n\t"
-            "psllq        $16, %%mm5    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-
-            "movq       %%mm0, %%mm6    \n\t"
-            "movq       %%mm3, %%mm7    \n\t"
-
-            "movq         8%1, %%mm0    \n\t"
-            "movq         8%1, %%mm1    \n\t"
-            "movq         8%1, %%mm2    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %3, %%mm1    \n\t"
-            "pand          %4, %%mm2    \n\t"
-            "psllq         $3, %%mm0    \n\t"
-            "psrlq         $2, %%mm1    \n\t"
-            "psrlq         $7, %%mm2    \n\t"
-            "movq       %%mm0, %%mm3    \n\t"
-            "movq       %%mm1, %%mm4    \n\t"
-            "movq       %%mm2, %%mm5    \n\t"
-            "punpcklwd     %5, %%mm0    \n\t"
-            "punpcklwd     %5, %%mm1    \n\t"
-            "punpcklwd     %5, %%mm2    \n\t"
-            "punpckhwd     %5, %%mm3    \n\t"
-            "punpckhwd     %5, %%mm4    \n\t"
-            "punpckhwd     %5, %%mm5    \n\t"
-            "psllq         $8, %%mm1    \n\t"
-            "psllq        $16, %%mm2    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "psllq         $8, %%mm4    \n\t"
-            "psllq        $16, %%mm5    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-
-            :"=m"(*d)
-            :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null)
-            :"memory");
-        /* borrowed 32 to 24 */
-        __asm__ volatile(
-            "movq       %%mm0, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "movq       %%mm6, %%mm0    \n\t"
-            "movq       %%mm7, %%mm1    \n\t"
-
-            "movq       %%mm4, %%mm6    \n\t"
-            "movq       %%mm5, %%mm7    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm1, %%mm3    \n\t"
-
-            STORE_BGR24_MMX
-
-            :"=m"(*d)
-            :"m"(*s)
-            :"memory");
-        d += 24;
-        s += 8;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = (bgr&0x3E0)>>2;
-        *d++ = (bgr&0x7C00)>>7;
-    }
-}
-
-static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-#if HAVE_MMX
-    const uint16_t *mm_end;
-#endif
-    uint8_t *d = (uint8_t *)dst;
-    const uint16_t *s = (const uint16_t *)src;
-    end = s + src_size/2;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s):"memory");
-    mm_end = end - 7;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movq          %1, %%mm0    \n\t"
-            "movq          %1, %%mm1    \n\t"
-            "movq          %1, %%mm2    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %3, %%mm1    \n\t"
-            "pand          %4, %%mm2    \n\t"
-            "psllq         $3, %%mm0    \n\t"
-            "psrlq         $3, %%mm1    \n\t"
-            "psrlq         $8, %%mm2    \n\t"
-            "movq       %%mm0, %%mm3    \n\t"
-            "movq       %%mm1, %%mm4    \n\t"
-            "movq       %%mm2, %%mm5    \n\t"
-            "punpcklwd     %5, %%mm0    \n\t"
-            "punpcklwd     %5, %%mm1    \n\t"
-            "punpcklwd     %5, %%mm2    \n\t"
-            "punpckhwd     %5, %%mm3    \n\t"
-            "punpckhwd     %5, %%mm4    \n\t"
-            "punpckhwd     %5, %%mm5    \n\t"
-            "psllq         $8, %%mm1    \n\t"
-            "psllq        $16, %%mm2    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "psllq         $8, %%mm4    \n\t"
-            "psllq        $16, %%mm5    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-
-            "movq       %%mm0, %%mm6    \n\t"
-            "movq       %%mm3, %%mm7    \n\t"
-
-            "movq         8%1, %%mm0    \n\t"
-            "movq         8%1, %%mm1    \n\t"
-            "movq         8%1, %%mm2    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %3, %%mm1    \n\t"
-            "pand          %4, %%mm2    \n\t"
-            "psllq         $3, %%mm0    \n\t"
-            "psrlq         $3, %%mm1    \n\t"
-            "psrlq         $8, %%mm2    \n\t"
-            "movq       %%mm0, %%mm3    \n\t"
-            "movq       %%mm1, %%mm4    \n\t"
-            "movq       %%mm2, %%mm5    \n\t"
-            "punpcklwd     %5, %%mm0    \n\t"
-            "punpcklwd     %5, %%mm1    \n\t"
-            "punpcklwd     %5, %%mm2    \n\t"
-            "punpckhwd     %5, %%mm3    \n\t"
-            "punpckhwd     %5, %%mm4    \n\t"
-            "punpckhwd     %5, %%mm5    \n\t"
-            "psllq         $8, %%mm1    \n\t"
-            "psllq        $16, %%mm2    \n\t"
-            "por        %%mm1, %%mm0    \n\t"
-            "por        %%mm2, %%mm0    \n\t"
-            "psllq         $8, %%mm4    \n\t"
-            "psllq        $16, %%mm5    \n\t"
-            "por        %%mm4, %%mm3    \n\t"
-            "por        %%mm5, %%mm3    \n\t"
-            :"=m"(*d)
-            :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
-            :"memory");
-        /* borrowed 32 to 24 */
-        __asm__ volatile(
-            "movq       %%mm0, %%mm4    \n\t"
-            "movq       %%mm3, %%mm5    \n\t"
-            "movq       %%mm6, %%mm0    \n\t"
-            "movq       %%mm7, %%mm1    \n\t"
-
-            "movq       %%mm4, %%mm6    \n\t"
-            "movq       %%mm5, %%mm7    \n\t"
-            "movq       %%mm0, %%mm2    \n\t"
-            "movq       %%mm1, %%mm3    \n\t"
-
-            STORE_BGR24_MMX
-
-            :"=m"(*d)
-            :"m"(*s)
-            :"memory");
-        d += 24;
-        s += 8;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = (bgr&0x7E0)>>3;
-        *d++ = (bgr&0xF800)>>8;
-    }
-}
-
-/*
- * mm0 = 00 B3 00 B2 00 B1 00 B0
- * mm1 = 00 G3 00 G2 00 G1 00 G0
- * mm2 = 00 R3 00 R2 00 R1 00 R0
- * mm6 = FF FF FF FF FF FF FF FF
- * mm7 = 00 00 00 00 00 00 00 00
- */
-#define PACK_RGB32 \
-    "packuswb   %%mm7, %%mm0    \n\t" /* 00 00 00 00 B3 B2 B1 B0 */ \
-    "packuswb   %%mm7, %%mm1    \n\t" /* 00 00 00 00 G3 G2 G1 G0 */ \
-    "packuswb   %%mm7, %%mm2    \n\t" /* 00 00 00 00 R3 R2 R1 R0 */ \
-    "punpcklbw  %%mm1, %%mm0    \n\t" /* G3 B3 G2 B2 G1 B1 G0 B0 */ \
-    "punpcklbw  %%mm6, %%mm2    \n\t" /* FF R3 FF R2 FF R1 FF R0 */ \
-    "movq       %%mm0, %%mm3    \n\t"                               \
-    "punpcklwd  %%mm2, %%mm0    \n\t" /* FF R1 G1 B1 FF R0 G0 B0 */ \
-    "punpckhwd  %%mm2, %%mm3    \n\t" /* FF R3 G3 B3 FF R2 G2 B2 */ \
-    MOVNTQ"     %%mm0,  %0      \n\t"                               \
-    MOVNTQ"     %%mm3, 8%0      \n\t"                               \
-
-static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-#if HAVE_MMX
-    const uint16_t *mm_end;
-#endif
-    uint8_t *d = dst;
-    const uint16_t *s = (const uint16_t *)src;
-    end = s + src_size/2;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s):"memory");
-    __asm__ volatile("pxor    %%mm7,%%mm7    \n\t":::"memory");
-    __asm__ volatile("pcmpeqd %%mm6,%%mm6    \n\t":::"memory");
-    mm_end = end - 3;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movq          %1, %%mm0    \n\t"
-            "movq          %1, %%mm1    \n\t"
-            "movq          %1, %%mm2    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %3, %%mm1    \n\t"
-            "pand          %4, %%mm2    \n\t"
-            "psllq         $3, %%mm0    \n\t"
-            "psrlq         $2, %%mm1    \n\t"
-            "psrlq         $7, %%mm2    \n\t"
-            PACK_RGB32
-            :"=m"(*d)
-            :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r)
-            :"memory");
-        d += 16;
-        s += 4;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-#if HAVE_BIGENDIAN
-        *d++ = 255;
-        *d++ = (bgr&0x7C00)>>7;
-        *d++ = (bgr&0x3E0)>>2;
-        *d++ = (bgr&0x1F)<<3;
-#else
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = (bgr&0x3E0)>>2;
-        *d++ = (bgr&0x7C00)>>7;
-        *d++ = 255;
-#endif
-    }
-}
-
-static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    const uint16_t *end;
-#if HAVE_MMX
-    const uint16_t *mm_end;
-#endif
-    uint8_t *d = dst;
-    const uint16_t *s = (const uint16_t*)src;
-    end = s + src_size/2;
-#if HAVE_MMX
-    __asm__ volatile(PREFETCH"    %0"::"m"(*s):"memory");
-    __asm__ volatile("pxor    %%mm7,%%mm7    \n\t":::"memory");
-    __asm__ volatile("pcmpeqd %%mm6,%%mm6    \n\t":::"memory");
-    mm_end = end - 3;
-    while (s < mm_end) {
-        __asm__ volatile(
-            PREFETCH"    32%1           \n\t"
-            "movq          %1, %%mm0    \n\t"
-            "movq          %1, %%mm1    \n\t"
-            "movq          %1, %%mm2    \n\t"
-            "pand          %2, %%mm0    \n\t"
-            "pand          %3, %%mm1    \n\t"
-            "pand          %4, %%mm2    \n\t"
-            "psllq         $3, %%mm0    \n\t"
-            "psrlq         $3, %%mm1    \n\t"
-            "psrlq         $8, %%mm2    \n\t"
-            PACK_RGB32
-            :"=m"(*d)
-            :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r)
-            :"memory");
-        d += 16;
-        s += 4;
-    }
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-#endif
-    while (s < end) {
-        register uint16_t bgr;
-        bgr = *s++;
-#if HAVE_BIGENDIAN
-        *d++ = 255;
-        *d++ = (bgr&0xF800)>>8;
-        *d++ = (bgr&0x7E0)>>3;
-        *d++ = (bgr&0x1F)<<3;
-#else
-        *d++ = (bgr&0x1F)<<3;
-        *d++ = (bgr&0x7E0)>>3;
-        *d++ = (bgr&0xF800)>>8;
-        *d++ = 255;
-#endif
-    }
-}
-
-static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    x86_reg idx = 15 - src_size;
-    const uint8_t *s = src-idx;
-    uint8_t *d = dst-idx;
-#if HAVE_MMX
-    __asm__ volatile(
-        "test          %0, %0           \n\t"
-        "jns           2f               \n\t"
-        PREFETCH"       (%1, %0)        \n\t"
-        "movq          %3, %%mm7        \n\t"
-        "pxor          %4, %%mm7        \n\t"
-        "movq       %%mm7, %%mm6        \n\t"
-        "pxor          %5, %%mm7        \n\t"
-        ASMALIGN(4)
-        "1:                             \n\t"
-        PREFETCH"     32(%1, %0)        \n\t"
-        "movq           (%1, %0), %%mm0 \n\t"
-        "movq          8(%1, %0), %%mm1 \n\t"
-# if HAVE_MMX2
-        "pshufw      $177, %%mm0, %%mm3 \n\t"
-        "pshufw      $177, %%mm1, %%mm5 \n\t"
-        "pand       %%mm7, %%mm0        \n\t"
-        "pand       %%mm6, %%mm3        \n\t"
-        "pand       %%mm7, %%mm1        \n\t"
-        "pand       %%mm6, %%mm5        \n\t"
-        "por        %%mm3, %%mm0        \n\t"
-        "por        %%mm5, %%mm1        \n\t"
-# else
-        "movq       %%mm0, %%mm2        \n\t"
-        "movq       %%mm1, %%mm4        \n\t"
-        "pand       %%mm7, %%mm0        \n\t"
-        "pand       %%mm6, %%mm2        \n\t"
-        "pand       %%mm7, %%mm1        \n\t"
-        "pand       %%mm6, %%mm4        \n\t"
-        "movq       %%mm2, %%mm3        \n\t"
-        "movq       %%mm4, %%mm5        \n\t"
-        "pslld        $16, %%mm2        \n\t"
-        "psrld        $16, %%mm3        \n\t"
-        "pslld        $16, %%mm4        \n\t"
-        "psrld        $16, %%mm5        \n\t"
-        "por        %%mm2, %%mm0        \n\t"
-        "por        %%mm4, %%mm1        \n\t"
-        "por        %%mm3, %%mm0        \n\t"
-        "por        %%mm5, %%mm1        \n\t"
-# endif
-        MOVNTQ"     %%mm0,  (%2, %0)    \n\t"
-        MOVNTQ"     %%mm1, 8(%2, %0)    \n\t"
-        "add          $16, %0           \n\t"
-        "js            1b               \n\t"
-        SFENCE"                         \n\t"
-        EMMS"                           \n\t"
-        "2:                             \n\t"
-        : "+&r"(idx)
-        : "r" (s), "r" (d), "m" (mask32b), "m" (mask32r), "m" (mmx_one)
-        : "memory");
-#endif
-    for (; idx<15; idx+=4) {
-        register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
-        v &= 0xff00ff;
-        *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
-    }
-}
-
-static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
-    unsigned i;
-#if HAVE_MMX
-    x86_reg mmx_size= 23 - src_size;
-    __asm__ volatile (
-        "test             %%"REG_a", %%"REG_a"          \n\t"
-        "jns                     2f                     \n\t"
-        "movq     "MANGLE(mask24r)", %%mm5              \n\t"
-        "movq     "MANGLE(mask24g)", %%mm6              \n\t"
-        "movq     "MANGLE(mask24b)", %%mm7              \n\t"
-        ASMALIGN(4)
-        "1:                                             \n\t"
-        PREFETCH" 32(%1, %%"REG_a")                     \n\t"
-        "movq       (%1, %%"REG_a"), %%mm0              \n\t" // BGR BGR BG
-        "movq       (%1, %%"REG_a"), %%mm1              \n\t" // BGR BGR BG
-        "movq      2(%1, %%"REG_a"), %%mm2              \n\t" // R BGR BGR B
-        "psllq                  $16, %%mm0              \n\t" // 00 BGR BGR
-        "pand                 %%mm5, %%mm0              \n\t"
-        "pand                 %%mm6, %%mm1              \n\t"
-        "pand                 %%mm7, %%mm2              \n\t"
-        "por                  %%mm0, %%mm1              \n\t"
-        "por                  %%mm2, %%mm1              \n\t"
-        "movq      6(%1, %%"REG_a"), %%mm0              \n\t" // BGR BGR BG
-        MOVNTQ"               %%mm1,   (%2, %%"REG_a")  \n\t" // RGB RGB RG
-        "movq      8(%1, %%"REG_a"), %%mm1              \n\t" // R BGR BGR B
-        "movq     10(%1, %%"REG_a"), %%mm2              \n\t" // GR BGR BGR
-        "pand                 %%mm7, %%mm0              \n\t"
-        "pand                 %%mm5, %%mm1              \n\t"
-        "pand                 %%mm6, %%mm2              \n\t"
-        "por                  %%mm0, %%mm1              \n\t"
-        "por                  %%mm2, %%mm1              \n\t"
-        "movq     14(%1, %%"REG_a"), %%mm0              \n\t" // R BGR BGR B
-        MOVNTQ"               %%mm1,  8(%2, %%"REG_a")  \n\t" // B RGB RGB R
-        "movq     16(%1, %%"REG_a"), %%mm1              \n\t" // GR BGR BGR
-        "movq     18(%1, %%"REG_a"), %%mm2              \n\t" // BGR BGR BG
-        "pand                 %%mm6, %%mm0              \n\t"
-        "pand                 %%mm7, %%mm1              \n\t"
-        "pand                 %%mm5, %%mm2              \n\t"
-        "por                  %%mm0, %%mm1              \n\t"
-        "por                  %%mm2, %%mm1              \n\t"
-        MOVNTQ"               %%mm1, 16(%2, %%"REG_a")  \n\t"
-        "add                    $24, %%"REG_a"          \n\t"
-        " js                     1b                     \n\t"
-        "2:                                             \n\t"
-        : "+a" (mmx_size)
-        : "r" (src-mmx_size), "r"(dst-mmx_size)
-    );
-
-    __asm__ volatile(SFENCE:::"memory");
-    __asm__ volatile(EMMS:::"memory");
-
-    if (mmx_size==23) return; //finished, was multiple of 8
-
-    src+= src_size;
-    dst+= src_size;
-    src_size= 23-mmx_size;
-    src-= src_size;
-    dst-= src_size;
-#endif
-    for (i=0; i<src_size; i+=3) {
-        register uint8_t x;
-        x          = src[i + 2];
-        dst[i + 1] = src[i + 1];
-        dst[i + 2] = src[i + 0];
-        dst[i + 0] = x;
-    }
-}
-
-static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                                           long width, long height,
-                                           long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
-{
-    long y;
-    const x86_reg chromWidth= width>>1;
-    for (y=0; y<height; y++) {
-#if HAVE_MMX
-        //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
-        __asm__ volatile(
-            "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            ASMALIGN(4)
-            "1:                                         \n\t"
-            PREFETCH"    32(%1, %%"REG_a", 2)           \n\t"
-            PREFETCH"    32(%2, %%"REG_a")              \n\t"
-            PREFETCH"    32(%3, %%"REG_a")              \n\t"
-            "movq          (%2, %%"REG_a"), %%mm0       \n\t" // U(0)
-            "movq                    %%mm0, %%mm2       \n\t" // U(0)
-            "movq          (%3, %%"REG_a"), %%mm1       \n\t" // V(0)
-            "punpcklbw               %%mm1, %%mm0       \n\t" // UVUV UVUV(0)
-            "punpckhbw               %%mm1, %%mm2       \n\t" // UVUV UVUV(8)
-
-            "movq        (%1, %%"REG_a",2), %%mm3       \n\t" // Y(0)
-            "movq       8(%1, %%"REG_a",2), %%mm5       \n\t" // Y(8)
-            "movq                    %%mm3, %%mm4       \n\t" // Y(0)
-            "movq                    %%mm5, %%mm6       \n\t" // Y(8)
-            "punpcklbw               %%mm0, %%mm3       \n\t" // YUYV YUYV(0)
-            "punpckhbw               %%mm0, %%mm4       \n\t" // YUYV YUYV(4)
-            "punpcklbw               %%mm2, %%mm5       \n\t" // YUYV YUYV(8)
-            "punpckhbw               %%mm2, %%mm6       \n\t" // YUYV YUYV(12)
-
-            MOVNTQ"                  %%mm3,   (%0, %%"REG_a", 4)    \n\t"
-            MOVNTQ"                  %%mm4,  8(%0, %%"REG_a", 4)    \n\t"
-            MOVNTQ"                  %%mm5, 16(%0, %%"REG_a", 4)    \n\t"
-            MOVNTQ"                  %%mm6, 24(%0, %%"REG_a", 4)    \n\t"
-
-            "add                        $8, %%"REG_a"   \n\t"
-            "cmp                        %4, %%"REG_a"   \n\t"
-            " jb                        1b              \n\t"
-            ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
-            : "%"REG_a
-        );
-#else
-
-#if ARCH_ALPHA && HAVE_MVI
-#define pl2yuy2(n)                  \
-    y1 = yc[n];                     \
-    y2 = yc2[n];                    \
-    u = uc[n];                      \
-    v = vc[n];                      \
-    __asm__("unpkbw %1, %0" : "=r"(y1) : "r"(y1));  \
-    __asm__("unpkbw %1, %0" : "=r"(y2) : "r"(y2));  \
-    __asm__("unpkbl %1, %0" : "=r"(u) : "r"(u));    \
-    __asm__("unpkbl %1, %0" : "=r"(v) : "r"(v));    \
-    yuv1 = (u << 8) + (v << 24);                \
-    yuv2 = yuv1 + y2;               \
-    yuv1 += y1;                     \
-    qdst[n]  = yuv1;                \
-    qdst2[n] = yuv2;
-
-        int i;
-        uint64_t *qdst = (uint64_t *) dst;
-        uint64_t *qdst2 = (uint64_t *) (dst + dstStride);
-        const uint32_t *yc = (uint32_t *) ysrc;
-        const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride);
-        const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc;
-        for (i = 0; i < chromWidth; i += 8) {
-            uint64_t y1, y2, yuv1, yuv2;
-            uint64_t u, v;
-            /* Prefetch */
-            __asm__("ldq $31,64(%0)" :: "r"(yc));
-            __asm__("ldq $31,64(%0)" :: "r"(yc2));
-            __asm__("ldq $31,64(%0)" :: "r"(uc));
-            __asm__("ldq $31,64(%0)" :: "r"(vc));
-
-            pl2yuy2(0);
-            pl2yuy2(1);
-            pl2yuy2(2);
-            pl2yuy2(3);
-
-            yc    += 4;
-            yc2   += 4;
-            uc    += 4;
-            vc    += 4;
-            qdst  += 4;
-            qdst2 += 4;
-        }
-        y++;
-        ysrc += lumStride;
-        dst += dstStride;
-
-#elif HAVE_FAST_64BIT
-        int i;
-        uint64_t *ldst = (uint64_t *) dst;
-        const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
-        for (i = 0; i < chromWidth; i += 2) {
-            uint64_t k, l;
-            k = yc[0] + (uc[0] << 8) +
-                (yc[1] << 16) + (vc[0] << 24);
-            l = yc[2] + (uc[1] << 8) +
-                (yc[3] << 16) + (vc[1] << 24);
-            *ldst++ = k + (l << 32);
-            yc += 4;
-            uc += 2;
-            vc += 2;
-        }
-
-#else
-        int i, *idst = (int32_t *) dst;
-        const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
-        for (i = 0; i < chromWidth; i++) {
-#if HAVE_BIGENDIAN
-            *idst++ = (yc[0] << 24)+ (uc[0] << 16) +
-                (yc[1] << 8) + (vc[0] << 0);
-#else
-            *idst++ = yc[0] + (uc[0] << 8) +
-                (yc[1] << 16) + (vc[0] << 24);
-#endif
-            yc += 2;
-            uc++;
-            vc++;
-        }
-#endif
-#endif
-        if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
-            usrc += chromStride;
-            vsrc += chromStride;
-        }
-        ysrc += lumStride;
-        dst  += dstStride;
-    }
-#if HAVE_MMX
-    __asm__(EMMS"       \n\t"
-            SFENCE"     \n\t"
-            :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long dstStride)
-{
-    //FIXME interpolate chroma
-    RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
-}
-
-static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                                           long width, long height,
-                                           long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
-{
-    long y;
-    const x86_reg chromWidth= width>>1;
-    for (y=0; y<height; y++) {
-#if HAVE_MMX
-        //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
-        __asm__ volatile(
-            "xor                %%"REG_a", %%"REG_a"    \n\t"
-            ASMALIGN(4)
-            "1:                                         \n\t"
-            PREFETCH"   32(%1, %%"REG_a", 2)            \n\t"
-            PREFETCH"   32(%2, %%"REG_a")               \n\t"
-            PREFETCH"   32(%3, %%"REG_a")               \n\t"
-            "movq         (%2, %%"REG_a"), %%mm0        \n\t" // U(0)
-            "movq                   %%mm0, %%mm2        \n\t" // U(0)
-            "movq         (%3, %%"REG_a"), %%mm1        \n\t" // V(0)
-            "punpcklbw              %%mm1, %%mm0        \n\t" // UVUV UVUV(0)
-            "punpckhbw              %%mm1, %%mm2        \n\t" // UVUV UVUV(8)
-
-            "movq       (%1, %%"REG_a",2), %%mm3        \n\t" // Y(0)
-            "movq      8(%1, %%"REG_a",2), %%mm5        \n\t" // Y(8)
-            "movq                   %%mm0, %%mm4        \n\t" // Y(0)
-            "movq                   %%mm2, %%mm6        \n\t" // Y(8)
-            "punpcklbw              %%mm3, %%mm0        \n\t" // YUYV YUYV(0)
-            "punpckhbw              %%mm3, %%mm4        \n\t" // YUYV YUYV(4)
-            "punpcklbw              %%mm5, %%mm2        \n\t" // YUYV YUYV(8)
-            "punpckhbw              %%mm5, %%mm6        \n\t" // YUYV YUYV(12)
-
-            MOVNTQ"                 %%mm0,   (%0, %%"REG_a", 4)     \n\t"
-            MOVNTQ"                 %%mm4,  8(%0, %%"REG_a", 4)     \n\t"
-            MOVNTQ"                 %%mm2, 16(%0, %%"REG_a", 4)     \n\t"
-            MOVNTQ"                 %%mm6, 24(%0, %%"REG_a", 4)     \n\t"
-
-            "add                       $8, %%"REG_a"    \n\t"
-            "cmp                       %4, %%"REG_a"    \n\t"
-            " jb                       1b               \n\t"
-            ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
-            : "%"REG_a
-        );
-#else
-//FIXME adapt the Alpha ASM code from yv12->yuy2
-
-#if HAVE_FAST_64BIT
-        int i;
-        uint64_t *ldst = (uint64_t *) dst;
-        const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
-        for (i = 0; i < chromWidth; i += 2) {
-            uint64_t k, l;
-            k = uc[0] + (yc[0] << 8) +
-                (vc[0] << 16) + (yc[1] << 24);
-            l = uc[1] + (yc[2] << 8) +
-                (vc[1] << 16) + (yc[3] << 24);
-            *ldst++ = k + (l << 32);
-            yc += 4;
-            uc += 2;
-            vc += 2;
-        }
-
-#else
-        int i, *idst = (int32_t *) dst;
-        const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
-        for (i = 0; i < chromWidth; i++) {
-#if HAVE_BIGENDIAN
-            *idst++ = (uc[0] << 24)+ (yc[0] << 16) +
-                (vc[0] << 8) + (yc[1] << 0);
-#else
-            *idst++ = uc[0] + (yc[0] << 8) +
-               (vc[0] << 16) + (yc[1] << 24);
-#endif
-            yc += 2;
-            uc++;
-            vc++;
-        }
-#endif
-#endif
-        if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
-            usrc += chromStride;
-            vsrc += chromStride;
-        }
-        ysrc += lumStride;
-        dst += dstStride;
-    }
-#if HAVE_MMX
-    __asm__(EMMS"       \n\t"
-            SFENCE"     \n\t"
-            :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long dstStride)
-{
-    //FIXME interpolate chroma
-    RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
-}
-
-/**
- * Width should be a multiple of 16.
- */
-static inline void RENAME(yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                                         long width, long height,
-                                         long lumStride, long chromStride, long dstStride)
-{
-    RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
-}
-
-/**
- * Width should be a multiple of 16.
- */
-static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
-                                         long width, long height,
-                                         long lumStride, long chromStride, long dstStride)
-{
-    RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long srcStride)
-{
-    long y;
-    const x86_reg chromWidth= width>>1;
-    for (y=0; y<height; y+=2) {
-#if HAVE_MMX
-        __asm__ volatile(
-            "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            "pcmpeqw                 %%mm7, %%mm7       \n\t"
-            "psrlw                      $8, %%mm7       \n\t" // FF,00,FF,00...
-            ASMALIGN(4)
-            "1:                \n\t"
-            PREFETCH" 64(%0, %%"REG_a", 4)              \n\t"
-            "movq       (%0, %%"REG_a", 4), %%mm0       \n\t" // YUYV YUYV(0)
-            "movq      8(%0, %%"REG_a", 4), %%mm1       \n\t" // YUYV YUYV(4)
-            "movq                    %%mm0, %%mm2       \n\t" // YUYV YUYV(0)
-            "movq                    %%mm1, %%mm3       \n\t" // YUYV YUYV(4)
-            "psrlw                      $8, %%mm0       \n\t" // U0V0 U0V0(0)
-            "psrlw                      $8, %%mm1       \n\t" // U0V0 U0V0(4)
-            "pand                    %%mm7, %%mm2       \n\t" // Y0Y0 Y0Y0(0)
-            "pand                    %%mm7, %%mm3       \n\t" // Y0Y0 Y0Y0(4)
-            "packuswb                %%mm1, %%mm0       \n\t" // UVUV UVUV(0)
-            "packuswb                %%mm3, %%mm2       \n\t" // YYYY YYYY(0)
-
-            MOVNTQ"                  %%mm2, (%1, %%"REG_a", 2)  \n\t"
-
-            "movq     16(%0, %%"REG_a", 4), %%mm1       \n\t" // YUYV YUYV(8)
-            "movq     24(%0, %%"REG_a", 4), %%mm2       \n\t" // YUYV YUYV(12)
-            "movq                    %%mm1, %%mm3       \n\t" // YUYV YUYV(8)
-            "movq                    %%mm2, %%mm4       \n\t" // YUYV YUYV(12)
-            "psrlw                      $8, %%mm1       \n\t" // U0V0 U0V0(8)
-            "psrlw                      $8, %%mm2       \n\t" // U0V0 U0V0(12)
-            "pand                    %%mm7, %%mm3       \n\t" // Y0Y0 Y0Y0(8)
-            "pand                    %%mm7, %%mm4       \n\t" // Y0Y0 Y0Y0(12)
-            "packuswb                %%mm2, %%mm1       \n\t" // UVUV UVUV(8)
-            "packuswb                %%mm4, %%mm3       \n\t" // YYYY YYYY(8)
-
-            MOVNTQ"                  %%mm3, 8(%1, %%"REG_a", 2) \n\t"
-
-            "movq                    %%mm0, %%mm2       \n\t" // UVUV UVUV(0)
-            "movq                    %%mm1, %%mm3       \n\t" // UVUV UVUV(8)
-            "psrlw                      $8, %%mm0       \n\t" // V0V0 V0V0(0)
-            "psrlw                      $8, %%mm1       \n\t" // V0V0 V0V0(8)
-            "pand                    %%mm7, %%mm2       \n\t" // U0U0 U0U0(0)
-            "pand                    %%mm7, %%mm3       \n\t" // U0U0 U0U0(8)
-            "packuswb                %%mm1, %%mm0       \n\t" // VVVV VVVV(0)
-            "packuswb                %%mm3, %%mm2       \n\t" // UUUU UUUU(0)
-
-            MOVNTQ"                  %%mm0, (%3, %%"REG_a")     \n\t"
-            MOVNTQ"                  %%mm2, (%2, %%"REG_a")     \n\t"
-
-            "add                        $8, %%"REG_a"   \n\t"
-            "cmp                        %4, %%"REG_a"   \n\t"
-            " jb                        1b              \n\t"
-            ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
-            : "memory", "%"REG_a
-        );
-
-        ydst += lumStride;
-        src  += srcStride;
-
-        __asm__ volatile(
-            "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            ASMALIGN(4)
-            "1:                                         \n\t"
-            PREFETCH" 64(%0, %%"REG_a", 4)              \n\t"
-            "movq       (%0, %%"REG_a", 4), %%mm0       \n\t" // YUYV YUYV(0)
-            "movq      8(%0, %%"REG_a", 4), %%mm1       \n\t" // YUYV YUYV(4)
-            "movq     16(%0, %%"REG_a", 4), %%mm2       \n\t" // YUYV YUYV(8)
-            "movq     24(%0, %%"REG_a", 4), %%mm3       \n\t" // YUYV YUYV(12)
-            "pand                    %%mm7, %%mm0       \n\t" // Y0Y0 Y0Y0(0)
-            "pand                    %%mm7, %%mm1       \n\t" // Y0Y0 Y0Y0(4)
-            "pand                    %%mm7, %%mm2       \n\t" // Y0Y0 Y0Y0(8)
-            "pand                    %%mm7, %%mm3       \n\t" // Y0Y0 Y0Y0(12)
-            "packuswb                %%mm1, %%mm0       \n\t" // YYYY YYYY(0)
-            "packuswb                %%mm3, %%mm2       \n\t" // YYYY YYYY(8)
-
-            MOVNTQ"                  %%mm0,  (%1, %%"REG_a", 2) \n\t"
-            MOVNTQ"                  %%mm2, 8(%1, %%"REG_a", 2) \n\t"
-
-            "add                        $8, %%"REG_a"   \n\t"
-            "cmp                        %4, %%"REG_a"   \n\t"
-            " jb                        1b              \n\t"
-
-            ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
-            : "memory", "%"REG_a
-        );
-#else
-        long i;
-        for (i=0; i<chromWidth; i++) {
-            ydst[2*i+0]     = src[4*i+0];
-            udst[i]     = src[4*i+1];
-            ydst[2*i+1]     = src[4*i+2];
-            vdst[i]     = src[4*i+3];
-        }
-        ydst += lumStride;
-        src  += srcStride;
-
-        for (i=0; i<chromWidth; i++) {
-            ydst[2*i+0]     = src[4*i+0];
-            ydst[2*i+1]     = src[4*i+2];
-        }
-#endif
-        udst += chromStride;
-        vdst += chromStride;
-        ydst += lumStride;
-        src  += srcStride;
-    }
-#if HAVE_MMX
-    __asm__ volatile(EMMS"       \n\t"
-                     SFENCE"     \n\t"
-                     :::"memory");
-#endif
-}
-
-static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
-                                      uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                                      long width, long height, long lumStride, long chromStride)
-{
-    /* Y Plane */
-    memcpy(ydst, ysrc, width*height);
-
-    /* XXX: implement upscaling for U,V */
-}
-
-static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, long srcStride, long dstStride)
-{
-    long x,y;
-
-    dst[0]= src[0];
-
-    // first line
-    for (x=0; x<srcWidth-1; x++) {
-        dst[2*x+1]= (3*src[x] +   src[x+1])>>2;
-        dst[2*x+2]= (  src[x] + 3*src[x+1])>>2;
-    }
-    dst[2*srcWidth-1]= src[srcWidth-1];
-
-    dst+= dstStride;
-
-    for (y=1; y<srcHeight; y++) {
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-        const x86_reg mmxSize= srcWidth&~15;
-        __asm__ volatile(
-            "mov           %4, %%"REG_a"            \n\t"
-            "1:                                     \n\t"
-            "movq         (%0, %%"REG_a"), %%mm0    \n\t"
-            "movq         (%1, %%"REG_a"), %%mm1    \n\t"
-            "movq        1(%0, %%"REG_a"), %%mm2    \n\t"
-            "movq        1(%1, %%"REG_a"), %%mm3    \n\t"
-            "movq       -1(%0, %%"REG_a"), %%mm4    \n\t"
-            "movq       -1(%1, %%"REG_a"), %%mm5    \n\t"
-            PAVGB"                  %%mm0, %%mm5    \n\t"
-            PAVGB"                  %%mm0, %%mm3    \n\t"
-            PAVGB"                  %%mm0, %%mm5    \n\t"
-            PAVGB"                  %%mm0, %%mm3    \n\t"
-            PAVGB"                  %%mm1, %%mm4    \n\t"
-            PAVGB"                  %%mm1, %%mm2    \n\t"
-            PAVGB"                  %%mm1, %%mm4    \n\t"
-            PAVGB"                  %%mm1, %%mm2    \n\t"
-            "movq                   %%mm5, %%mm7    \n\t"
-            "movq                   %%mm4, %%mm6    \n\t"
-            "punpcklbw              %%mm3, %%mm5    \n\t"
-            "punpckhbw              %%mm3, %%mm7    \n\t"
-            "punpcklbw              %%mm2, %%mm4    \n\t"
-            "punpckhbw              %%mm2, %%mm6    \n\t"
-#if 1
-            MOVNTQ"                 %%mm5,  (%2, %%"REG_a", 2)  \n\t"
-            MOVNTQ"                 %%mm7, 8(%2, %%"REG_a", 2)  \n\t"
-            MOVNTQ"                 %%mm4,  (%3, %%"REG_a", 2)  \n\t"
-            MOVNTQ"                 %%mm6, 8(%3, %%"REG_a", 2)  \n\t"
-#else
-            "movq                   %%mm5,  (%2, %%"REG_a", 2)  \n\t"
-            "movq                   %%mm7, 8(%2, %%"REG_a", 2)  \n\t"
-            "movq                   %%mm4,  (%3, %%"REG_a", 2)  \n\t"
-            "movq                   %%mm6, 8(%3, %%"REG_a", 2)  \n\t"
-#endif
-            "add                       $8, %%"REG_a"            \n\t"
-            " js                       1b                       \n\t"
-            :: "r" (src + mmxSize  ), "r" (src + srcStride + mmxSize  ),
-            "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2),
-            "g" (-mmxSize)
-            : "%"REG_a
-
-        );
-#else
-        const x86_reg mmxSize=1;
-#endif
-        dst[0        ]= (3*src[0] +   src[srcStride])>>2;
-        dst[dstStride]= (  src[0] + 3*src[srcStride])>>2;
-
-        for (x=mmxSize-1; x<srcWidth-1; x++) {
-            dst[2*x          +1]= (3*src[x+0] +   src[x+srcStride+1])>>2;
-            dst[2*x+dstStride+2]= (  src[x+0] + 3*src[x+srcStride+1])>>2;
-            dst[2*x+dstStride+1]= (  src[x+1] + 3*src[x+srcStride  ])>>2;
-            dst[2*x          +2]= (3*src[x+1] +   src[x+srcStride  ])>>2;
-        }
-        dst[srcWidth*2 -1            ]= (3*src[srcWidth-1] +   src[srcWidth-1 + srcStride])>>2;
-        dst[srcWidth*2 -1 + dstStride]= (  src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2;
-
-        dst+=dstStride*2;
-        src+=srcStride;
-    }
-
-    // last line
-#if 1
-    dst[0]= src[0];
-
-    for (x=0; x<srcWidth-1; x++) {
-        dst[2*x+1]= (3*src[x] +   src[x+1])>>2;
-        dst[2*x+2]= (  src[x] + 3*src[x+1])>>2;
-    }
-    dst[2*srcWidth-1]= src[srcWidth-1];
-#else
-    for (x=0; x<srcWidth; x++) {
-        dst[2*x+0]=
-        dst[2*x+1]= src[x];
-    }
-#endif
-
-#if HAVE_MMX
-    __asm__ volatile(EMMS"       \n\t"
-                     SFENCE"     \n\t"
-                     :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line, others are ignored.
- * FIXME: Write HQ version.
- */
-static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long srcStride)
-{
-    long y;
-    const x86_reg chromWidth= width>>1;
-    for (y=0; y<height; y+=2) {
-#if HAVE_MMX
-        __asm__ volatile(
-            "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            "pcmpeqw             %%mm7, %%mm7   \n\t"
-            "psrlw                  $8, %%mm7   \n\t" // FF,00,FF,00...
-            ASMALIGN(4)
-            "1:                                 \n\t"
-            PREFETCH" 64(%0, %%"REG_a", 4)          \n\t"
-            "movq       (%0, %%"REG_a", 4), %%mm0   \n\t" // UYVY UYVY(0)
-            "movq      8(%0, %%"REG_a", 4), %%mm1   \n\t" // UYVY UYVY(4)
-            "movq                %%mm0, %%mm2   \n\t" // UYVY UYVY(0)
-            "movq                %%mm1, %%mm3   \n\t" // UYVY UYVY(4)
-            "pand                %%mm7, %%mm0   \n\t" // U0V0 U0V0(0)
-            "pand                %%mm7, %%mm1   \n\t" // U0V0 U0V0(4)
-            "psrlw                  $8, %%mm2   \n\t" // Y0Y0 Y0Y0(0)
-            "psrlw                  $8, %%mm3   \n\t" // Y0Y0 Y0Y0(4)
-            "packuswb            %%mm1, %%mm0   \n\t" // UVUV UVUV(0)
-            "packuswb            %%mm3, %%mm2   \n\t" // YYYY YYYY(0)
-
-            MOVNTQ"              %%mm2,  (%1, %%"REG_a", 2) \n\t"
-
-            "movq     16(%0, %%"REG_a", 4), %%mm1   \n\t" // UYVY UYVY(8)
-            "movq     24(%0, %%"REG_a", 4), %%mm2   \n\t" // UYVY UYVY(12)
-            "movq                %%mm1, %%mm3   \n\t" // UYVY UYVY(8)
-            "movq                %%mm2, %%mm4   \n\t" // UYVY UYVY(12)
-            "pand                %%mm7, %%mm1   \n\t" // U0V0 U0V0(8)
-            "pand                %%mm7, %%mm2   \n\t" // U0V0 U0V0(12)
-            "psrlw                  $8, %%mm3   \n\t" // Y0Y0 Y0Y0(8)
-            "psrlw                  $8, %%mm4   \n\t" // Y0Y0 Y0Y0(12)
-            "packuswb            %%mm2, %%mm1   \n\t" // UVUV UVUV(8)
-            "packuswb            %%mm4, %%mm3   \n\t" // YYYY YYYY(8)
-
-            MOVNTQ"              %%mm3, 8(%1, %%"REG_a", 2) \n\t"
-
-            "movq                %%mm0, %%mm2   \n\t" // UVUV UVUV(0)
-            "movq                %%mm1, %%mm3   \n\t" // UVUV UVUV(8)
-            "psrlw                  $8, %%mm0   \n\t" // V0V0 V0V0(0)
-            "psrlw                  $8, %%mm1   \n\t" // V0V0 V0V0(8)
-            "pand                %%mm7, %%mm2   \n\t" // U0U0 U0U0(0)
-            "pand                %%mm7, %%mm3   \n\t" // U0U0 U0U0(8)
-            "packuswb            %%mm1, %%mm0   \n\t" // VVVV VVVV(0)
-            "packuswb            %%mm3, %%mm2   \n\t" // UUUU UUUU(0)
-
-            MOVNTQ"              %%mm0, (%3, %%"REG_a") \n\t"
-            MOVNTQ"              %%mm2, (%2, %%"REG_a") \n\t"
-
-            "add                    $8, %%"REG_a"   \n\t"
-            "cmp                    %4, %%"REG_a"   \n\t"
-            " jb                    1b          \n\t"
-            ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
-            : "memory", "%"REG_a
-        );
-
-        ydst += lumStride;
-        src  += srcStride;
-
-        __asm__ volatile(
-            "xor                 %%"REG_a", %%"REG_a"   \n\t"
-            ASMALIGN(4)
-            "1:                                 \n\t"
-            PREFETCH" 64(%0, %%"REG_a", 4)          \n\t"
-            "movq       (%0, %%"REG_a", 4), %%mm0   \n\t" // YUYV YUYV(0)
-            "movq      8(%0, %%"REG_a", 4), %%mm1   \n\t" // YUYV YUYV(4)
-            "movq     16(%0, %%"REG_a", 4), %%mm2   \n\t" // YUYV YUYV(8)
-            "movq     24(%0, %%"REG_a", 4), %%mm3   \n\t" // YUYV YUYV(12)
-            "psrlw                  $8, %%mm0   \n\t" // Y0Y0 Y0Y0(0)
-            "psrlw                  $8, %%mm1   \n\t" // Y0Y0 Y0Y0(4)
-            "psrlw                  $8, %%mm2   \n\t" // Y0Y0 Y0Y0(8)
-            "psrlw                  $8, %%mm3   \n\t" // Y0Y0 Y0Y0(12)
-            "packuswb            %%mm1, %%mm0   \n\t" // YYYY YYYY(0)
-            "packuswb            %%mm3, %%mm2   \n\t" // YYYY YYYY(8)
-
-            MOVNTQ"              %%mm0,  (%1, %%"REG_a", 2) \n\t"
-            MOVNTQ"              %%mm2, 8(%1, %%"REG_a", 2) \n\t"
-
-            "add                    $8, %%"REG_a"   \n\t"
-            "cmp                    %4, %%"REG_a"   \n\t"
-            " jb                    1b          \n\t"
-
-            ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
-            : "memory", "%"REG_a
-        );
-#else
-        long i;
-        for (i=0; i<chromWidth; i++) {
-            udst[i]     = src[4*i+0];
-            ydst[2*i+0] = src[4*i+1];
-            vdst[i]     = src[4*i+2];
-            ydst[2*i+1] = src[4*i+3];
-        }
-        ydst += lumStride;
-        src  += srcStride;
-
-        for (i=0; i<chromWidth; i++) {
-            ydst[2*i+0] = src[4*i+1];
-            ydst[2*i+1] = src[4*i+3];
-        }
-#endif
-        udst += chromStride;
-        vdst += chromStride;
-        ydst += lumStride;
-        src  += srcStride;
-    }
-#if HAVE_MMX
-    __asm__ volatile(EMMS"       \n\t"
-                     SFENCE"     \n\t"
-                     :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 2.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line,
- * others are ignored in the C version.
- * FIXME: Write HQ version.
- */
-static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-                                       long width, long height,
-                                       long lumStride, long chromStride, long srcStride)
-{
-    long y;
-    const x86_reg chromWidth= width>>1;
-#if HAVE_MMX
-    for (y=0; y<height-2; y+=2) {
-        long i;
-        for (i=0; i<2; i++) {
-            __asm__ volatile(
-                "mov                        %2, %%"REG_a"   \n\t"
-                "movq  "MANGLE(ff_bgr2YCoeff)", %%mm6       \n\t"
-                "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
-                "pxor                    %%mm7, %%mm7       \n\t"
-                "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
-                ASMALIGN(4)
-                "1:                                         \n\t"
-                PREFETCH"    64(%0, %%"REG_d")              \n\t"
-                "movd          (%0, %%"REG_d"), %%mm0       \n\t"
-                "movd         3(%0, %%"REG_d"), %%mm1       \n\t"
-                "punpcklbw               %%mm7, %%mm0       \n\t"
-                "punpcklbw               %%mm7, %%mm1       \n\t"
-                "movd         6(%0, %%"REG_d"), %%mm2       \n\t"
-                "movd         9(%0, %%"REG_d"), %%mm3       \n\t"
-                "punpcklbw               %%mm7, %%mm2       \n\t"
-                "punpcklbw               %%mm7, %%mm3       \n\t"
-                "pmaddwd                 %%mm6, %%mm0       \n\t"
-                "pmaddwd                 %%mm6, %%mm1       \n\t"
-                "pmaddwd                 %%mm6, %%mm2       \n\t"
-                "pmaddwd                 %%mm6, %%mm3       \n\t"
-#ifndef FAST_BGR2YV12
-                "psrad                      $8, %%mm0       \n\t"
-                "psrad                      $8, %%mm1       \n\t"
-                "psrad                      $8, %%mm2       \n\t"
-                "psrad                      $8, %%mm3       \n\t"
-#endif
-                "packssdw                %%mm1, %%mm0       \n\t"
-                "packssdw                %%mm3, %%mm2       \n\t"
-                "pmaddwd                 %%mm5, %%mm0       \n\t"
-                "pmaddwd                 %%mm5, %%mm2       \n\t"
-                "packssdw                %%mm2, %%mm0       \n\t"
-                "psraw                      $7, %%mm0       \n\t"
-
-                "movd        12(%0, %%"REG_d"), %%mm4       \n\t"
-                "movd        15(%0, %%"REG_d"), %%mm1       \n\t"
-                "punpcklbw               %%mm7, %%mm4       \n\t"
-                "punpcklbw               %%mm7, %%mm1       \n\t"
-                "movd        18(%0, %%"REG_d"), %%mm2       \n\t"
-                "movd        21(%0, %%"REG_d"), %%mm3       \n\t"
-                "punpcklbw               %%mm7, %%mm2       \n\t"
-                "punpcklbw               %%mm7, %%mm3       \n\t"
-                "pmaddwd                 %%mm6, %%mm4       \n\t"
-                "pmaddwd                 %%mm6, %%mm1       \n\t"
-                "pmaddwd                 %%mm6, %%mm2       \n\t"
-                "pmaddwd                 %%mm6, %%mm3       \n\t"
-#ifndef FAST_BGR2YV12
-                "psrad                      $8, %%mm4       \n\t"
-                "psrad                      $8, %%mm1       \n\t"
-                "psrad                      $8, %%mm2       \n\t"
-                "psrad                      $8, %%mm3       \n\t"
-#endif
-                "packssdw                %%mm1, %%mm4       \n\t"
-                "packssdw                %%mm3, %%mm2       \n\t"
-                "pmaddwd                 %%mm5, %%mm4       \n\t"
-                "pmaddwd                 %%mm5, %%mm2       \n\t"
-                "add                       $24, %%"REG_d"   \n\t"
-                "packssdw                %%mm2, %%mm4       \n\t"
-                "psraw                      $7, %%mm4       \n\t"
-
-                "packuswb                %%mm4, %%mm0       \n\t"
-                "paddusb "MANGLE(ff_bgr2YOffset)", %%mm0    \n\t"
-
-                MOVNTQ"                  %%mm0, (%1, %%"REG_a") \n\t"
-                "add                        $8,      %%"REG_a"  \n\t"
-                " js                        1b                  \n\t"
-                : : "r" (src+width*3), "r" (ydst+width), "g" ((x86_reg)-width)
-                : "%"REG_a, "%"REG_d
-            );
-            ydst += lumStride;
-            src  += srcStride;
-        }
-        src -= srcStride*2;
-        __asm__ volatile(
-            "mov                        %4, %%"REG_a"   \n\t"
-            "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
-            "movq  "MANGLE(ff_bgr2UCoeff)", %%mm6       \n\t"
-            "pxor                    %%mm7, %%mm7       \n\t"
-            "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
-            "add                 %%"REG_d", %%"REG_d"   \n\t"
-            ASMALIGN(4)
-            "1:                                         \n\t"
-            PREFETCH"    64(%0, %%"REG_d")              \n\t"
-            PREFETCH"    64(%1, %%"REG_d")              \n\t"
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-            "movq          (%0, %%"REG_d"), %%mm0       \n\t"
-            "movq          (%1, %%"REG_d"), %%mm1       \n\t"
-            "movq         6(%0, %%"REG_d"), %%mm2       \n\t"
-            "movq         6(%1, %%"REG_d"), %%mm3       \n\t"
-            PAVGB"                   %%mm1, %%mm0       \n\t"
-            PAVGB"                   %%mm3, %%mm2       \n\t"
-            "movq                    %%mm0, %%mm1       \n\t"
-            "movq                    %%mm2, %%mm3       \n\t"
-            "psrlq                     $24, %%mm0       \n\t"
-            "psrlq                     $24, %%mm2       \n\t"
-            PAVGB"                   %%mm1, %%mm0       \n\t"
-            PAVGB"                   %%mm3, %%mm2       \n\t"
-            "punpcklbw               %%mm7, %%mm0       \n\t"
-            "punpcklbw               %%mm7, %%mm2       \n\t"
-#else
-            "movd          (%0, %%"REG_d"), %%mm0       \n\t"
-            "movd          (%1, %%"REG_d"), %%mm1       \n\t"
-            "movd         3(%0, %%"REG_d"), %%mm2       \n\t"
-            "movd         3(%1, %%"REG_d"), %%mm3       \n\t"
-            "punpcklbw               %%mm7, %%mm0       \n\t"
-            "punpcklbw               %%mm7, %%mm1       \n\t"
-            "punpcklbw               %%mm7, %%mm2       \n\t"
-            "punpcklbw               %%mm7, %%mm3       \n\t"
-            "paddw                   %%mm1, %%mm0       \n\t"
-            "paddw                   %%mm3, %%mm2       \n\t"
-            "paddw                   %%mm2, %%mm0       \n\t"
-            "movd         6(%0, %%"REG_d"), %%mm4       \n\t"
-            "movd         6(%1, %%"REG_d"), %%mm1       \n\t"
-            "movd         9(%0, %%"REG_d"), %%mm2       \n\t"
-            "movd         9(%1, %%"REG_d"), %%mm3       \n\t"
-            "punpcklbw               %%mm7, %%mm4       \n\t"
-            "punpcklbw               %%mm7, %%mm1       \n\t"
-            "punpcklbw               %%mm7, %%mm2       \n\t"
-            "punpcklbw               %%mm7, %%mm3       \n\t"
-            "paddw                   %%mm1, %%mm4       \n\t"
-            "paddw                   %%mm3, %%mm2       \n\t"
-            "paddw                   %%mm4, %%mm2       \n\t"
-            "psrlw                      $2, %%mm0       \n\t"
-            "psrlw                      $2, %%mm2       \n\t"
-#endif
-            "movq  "MANGLE(ff_bgr2VCoeff)", %%mm1       \n\t"
-            "movq  "MANGLE(ff_bgr2VCoeff)", %%mm3       \n\t"
-
-            "pmaddwd                 %%mm0, %%mm1       \n\t"
-            "pmaddwd                 %%mm2, %%mm3       \n\t"
-            "pmaddwd                 %%mm6, %%mm0       \n\t"
-            "pmaddwd                 %%mm6, %%mm2       \n\t"
-#ifndef FAST_BGR2YV12
-            "psrad                      $8, %%mm0       \n\t"
-            "psrad                      $8, %%mm1       \n\t"
-            "psrad                      $8, %%mm2       \n\t"
-            "psrad                      $8, %%mm3       \n\t"
-#endif
-            "packssdw                %%mm2, %%mm0       \n\t"
-            "packssdw                %%mm3, %%mm1       \n\t"
-            "pmaddwd                 %%mm5, %%mm0       \n\t"
-            "pmaddwd                 %%mm5, %%mm1       \n\t"
-            "packssdw                %%mm1, %%mm0       \n\t" // V1 V0 U1 U0
-            "psraw                      $7, %%mm0       \n\t"
-
-#if HAVE_MMX2 || HAVE_AMD3DNOW
-            "movq        12(%0, %%"REG_d"), %%mm4       \n\t"
-            "movq        12(%1, %%"REG_d"), %%mm1       \n\t"
-            "movq        18(%0, %%"REG_d"), %%mm2       \n\t"
-            "movq        18(%1, %%"REG_d"), %%mm3       \n\t"
-            PAVGB"                   %%mm1, %%mm4       \n\t"
-            PAVGB"                   %%mm3, %%mm2       \n\t"
-            "movq                    %%mm4, %%mm1       \n\t"
-            "movq                    %%mm2, %%mm3       \n\t"
-            "psrlq                     $24, %%mm4       \n\t"
-            "psrlq                     $24, %%mm2       \n\t"
-            PAVGB"                   %%mm1, %%mm4       \n\t"
-            PAVGB"                   %%mm3, %%mm2       \n\t"
-            "punpcklbw               %%mm7, %%mm4       \n\t"
-            "punpcklbw               %%mm7, %%mm2       \n\t"
-#else
-            "movd        12(%0, %%"REG_d"), %%mm4       \n\t"
-            "movd        12(%1, %%"REG_d"), %%mm1       \n\t"
-            "movd        15(%0, %%"REG_d"), %%mm2       \n\t"
-            "movd        15(%1, %%"REG_d"), %%mm3       \n\t"
-            "punpcklbw               %%mm7, %%mm4       \n\t"
-            "punpcklbw               %%mm7, %%mm1       \n\t"
-            "punpcklbw               %%mm7, %%mm2       \n\t"
-            "punpcklbw               %%mm7, %%mm3       \n\t"
-            "paddw                   %%mm1, %%mm4       \n\t"
-            "paddw                   %%mm3, %%mm2       \n\t"
-            "paddw                   %%mm2, %%mm4       \n\t"
-            "movd        18(%0, %%"REG_d"), %%mm5       \n\t"
-            "movd        18(%1, %%"REG_d"), %%mm1       \n\t"
-            "movd        21(%0, %%"REG_d"), %%mm2       \n\t"
-            "movd        21(%1, %%"REG_d"), %%mm3       \n\t"
-            "punpcklbw               %%mm7, %%mm5       \n\t"
-            "punpcklbw               %%mm7, %%mm1       \n\t"
-            "punpcklbw               %%mm7, %%mm2       \n\t"
-            "punpcklbw               %%mm7, %%mm3       \n\t"
-            "paddw                   %%mm1, %%mm5       \n\t"
-            "paddw                   %%mm3, %%mm2       \n\t"
-            "paddw                   %%mm5, %%mm2       \n\t"
-            "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
-            "psrlw                      $2, %%mm4       \n\t"
-            "psrlw                      $2, %%mm2       \n\t"
-#endif
-            "movq  "MANGLE(ff_bgr2VCoeff)", %%mm1       \n\t"
-            "movq  "MANGLE(ff_bgr2VCoeff)", %%mm3       \n\t"
-
-            "pmaddwd                 %%mm4, %%mm1       \n\t"
-            "pmaddwd                 %%mm2, %%mm3       \n\t"
-            "pmaddwd                 %%mm6, %%mm4       \n\t"
-            "pmaddwd                 %%mm6, %%mm2       \n\t"
-#ifndef FAST_BGR2YV12
-            "psrad                      $8, %%mm4       \n\t"
-            "psrad                      $8, %%mm1       \n\t"
-            "psrad                      $8, %%mm2       \n\t"
-            "psrad                      $8, %%mm3       \n\t"
-#endif
-            "packssdw                %%mm2, %%mm4       \n\t"
-            "packssdw                %%mm3, %%mm1       \n\t"
-            "pmaddwd                 %%mm5, %%mm4       \n\t"
-            "pmaddwd                 %%mm5, %%mm1       \n\t"
-            "add                       $24, %%"REG_d"   \n\t"
-            "packssdw                %%mm1, %%mm4       \n\t" // V3 V2 U3 U2
-            "psraw                      $7, %%mm4       \n\t"
-
-            "movq                    %%mm0, %%mm1           \n\t"
-            "punpckldq               %%mm4, %%mm0           \n\t"
-            "punpckhdq               %%mm4, %%mm1           \n\t"
-            "packsswb                %%mm1, %%mm0           \n\t"
-            "paddb "MANGLE(ff_bgr2UVOffset)", %%mm0         \n\t"
-            "movd                    %%mm0, (%2, %%"REG_a") \n\t"
-            "punpckhdq               %%mm0, %%mm0           \n\t"
-            "movd                    %%mm0, (%3, %%"REG_a") \n\t"
-            "add                        $4, %%"REG_a"       \n\t"
-            " js                        1b                  \n\t"
-            : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
-            : "%"REG_a, "%"REG_d
-        );
-
-        udst += chromStride;
-        vdst += chromStride;
-        src  += srcStride*2;
-    }
-
-    __asm__ volatile(EMMS"       \n\t"
-                     SFENCE"     \n\t"
-                     :::"memory");
-#else
-    y=0;
-#endif
-    for (; y<height; y+=2) {
-        long i;
-        for (i=0; i<chromWidth; i++) {
-            unsigned int b = src[6*i+0];
-            unsigned int g = src[6*i+1];
-            unsigned int r = src[6*i+2];
-
-            unsigned int Y  =  ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
-            unsigned int V  =  ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128;
-            unsigned int U  =  ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128;
-
-            udst[i]     = U;
-            vdst[i]     = V;
-            ydst[2*i]   = Y;
-
-            b = src[6*i+3];
-            g = src[6*i+4];
-            r = src[6*i+5];
-
-            Y  =  ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
-            ydst[2*i+1]     = Y;
-        }
-        ydst += lumStride;
-        src  += srcStride;
-
-        for (i=0; i<chromWidth; i++) {
-            unsigned int b = src[6*i+0];
-            unsigned int g = src[6*i+1];
-            unsigned int r = src[6*i+2];
-
-            unsigned int Y  =  ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
-
-            ydst[2*i]     = Y;
-
-            b = src[6*i+3];
-            g = src[6*i+4];
-            r = src[6*i+5];
-
-            Y  =  ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
-            ydst[2*i+1]     = Y;
-        }
-        udst += chromStride;
-        vdst += chromStride;
-        ydst += lumStride;
-        src  += srcStride;
-    }
-}
-
-static void RENAME(interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dest,
-                             long width, long height, long src1Stride,
-                             long src2Stride, long dstStride)
-{
-    long h;
-
-    for (h=0; h < height; h++) {
-        long w;
-
-#if HAVE_MMX
-#if HAVE_SSE2
-        __asm__(
-            "xor              %%"REG_a", %%"REG_a"  \n\t"
-            "1:                                     \n\t"
-            PREFETCH" 64(%1, %%"REG_a")             \n\t"
-            PREFETCH" 64(%2, %%"REG_a")             \n\t"
-            "movdqa     (%1, %%"REG_a"), %%xmm0     \n\t"
-            "movdqa     (%1, %%"REG_a"), %%xmm1     \n\t"
-            "movdqa     (%2, %%"REG_a"), %%xmm2     \n\t"
-            "punpcklbw           %%xmm2, %%xmm0     \n\t"
-            "punpckhbw           %%xmm2, %%xmm1     \n\t"
-            "movntdq             %%xmm0,   (%0, %%"REG_a", 2)   \n\t"
-            "movntdq             %%xmm1, 16(%0, %%"REG_a", 2)   \n\t"
-            "add                    $16, %%"REG_a"  \n\t"
-            "cmp                     %3, %%"REG_a"  \n\t"
-            " jb                     1b             \n\t"
-            ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
-            : "memory", "%"REG_a""
-        );
-#else
-        __asm__(
-            "xor %%"REG_a", %%"REG_a"               \n\t"
-            "1:                                     \n\t"
-            PREFETCH" 64(%1, %%"REG_a")             \n\t"
-            PREFETCH" 64(%2, %%"REG_a")             \n\t"
-            "movq       (%1, %%"REG_a"), %%mm0      \n\t"
-            "movq      8(%1, %%"REG_a"), %%mm2      \n\t"
-            "movq                 %%mm0, %%mm1      \n\t"
-            "movq                 %%mm2, %%mm3      \n\t"
-            "movq       (%2, %%"REG_a"), %%mm4      \n\t"
-            "movq      8(%2, %%"REG_a"), %%mm5      \n\t"
-            "punpcklbw            %%mm4, %%mm0      \n\t"
-            "punpckhbw            %%mm4, %%mm1      \n\t"
-            "punpcklbw            %%mm5, %%mm2      \n\t"
-            "punpckhbw            %%mm5, %%mm3      \n\t"
-            MOVNTQ"               %%mm0,   (%0, %%"REG_a", 2)   \n\t"
-            MOVNTQ"               %%mm1,  8(%0, %%"REG_a", 2)   \n\t"
-            MOVNTQ"               %%mm2, 16(%0, %%"REG_a", 2)   \n\t"
-            MOVNTQ"               %%mm3, 24(%0, %%"REG_a", 2)   \n\t"
-            "add                    $16, %%"REG_a"  \n\t"
-            "cmp                     %3, %%"REG_a"  \n\t"
-            " jb                     1b             \n\t"
-            ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
-            : "memory", "%"REG_a
-        );
-#endif
-        for (w= (width&(~15)); w < width; w++) {
-            dest[2*w+0] = src1[w];
-            dest[2*w+1] = src2[w];
-        }
-#else
-        for (w=0; w < width; w++) {
-            dest[2*w+0] = src1[w];
-            dest[2*w+1] = src2[w];
-        }
-#endif
-        dest += dstStride;
-                src1 += src1Stride;
-                src2 += src2Stride;
-    }
-#if HAVE_MMX
-    __asm__(
-            EMMS"       \n\t"
-            SFENCE"     \n\t"
-            ::: "memory"
-            );
-#endif
-}
-
-static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
-                                       uint8_t *dst1, uint8_t *dst2,
-                                       long width, long height,
-                                       long srcStride1, long srcStride2,
-                                       long dstStride1, long dstStride2)
-{
-    x86_reg y;
-    long x,w,h;
-    w=width/2; h=height/2;
-#if HAVE_MMX
-    __asm__ volatile(
-        PREFETCH" %0    \n\t"
-        PREFETCH" %1    \n\t"
-        ::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory");
-#endif
-    for (y=0;y<h;y++) {
-        const uint8_t* s1=src1+srcStride1*(y>>1);
-        uint8_t* d=dst1+dstStride1*y;
-        x=0;
-#if HAVE_MMX
-        for (;x<w-31;x+=32) {
-            __asm__ volatile(
-                PREFETCH"   32%1        \n\t"
-                "movq         %1, %%mm0 \n\t"
-                "movq        8%1, %%mm2 \n\t"
-                "movq       16%1, %%mm4 \n\t"
-                "movq       24%1, %%mm6 \n\t"
-                "movq      %%mm0, %%mm1 \n\t"
-                "movq      %%mm2, %%mm3 \n\t"
-                "movq      %%mm4, %%mm5 \n\t"
-                "movq      %%mm6, %%mm7 \n\t"
-                "punpcklbw %%mm0, %%mm0 \n\t"
-                "punpckhbw %%mm1, %%mm1 \n\t"
-                "punpcklbw %%mm2, %%mm2 \n\t"
-                "punpckhbw %%mm3, %%mm3 \n\t"
-                "punpcklbw %%mm4, %%mm4 \n\t"
-                "punpckhbw %%mm5, %%mm5 \n\t"
-                "punpcklbw %%mm6, %%mm6 \n\t"
-                "punpckhbw %%mm7, %%mm7 \n\t"
-                MOVNTQ"    %%mm0,   %0  \n\t"
-                MOVNTQ"    %%mm1,  8%0  \n\t"
-                MOVNTQ"    %%mm2, 16%0  \n\t"
-                MOVNTQ"    %%mm3, 24%0  \n\t"
-                MOVNTQ"    %%mm4, 32%0  \n\t"
-                MOVNTQ"    %%mm5, 40%0  \n\t"
-                MOVNTQ"    %%mm6, 48%0  \n\t"
-                MOVNTQ"    %%mm7, 56%0"
-                :"=m"(d[2*x])
-                :"m"(s1[x])
-                :"memory");
-        }
-#endif
-        for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x];
-    }
-    for (y=0;y<h;y++) {
-        const uint8_t* s2=src2+srcStride2*(y>>1);
-        uint8_t* d=dst2+dstStride2*y;
-        x=0;
-#if HAVE_MMX
-        for (;x<w-31;x+=32) {
-            __asm__ volatile(
-                PREFETCH"   32%1        \n\t"
-                "movq         %1, %%mm0 \n\t"
-                "movq        8%1, %%mm2 \n\t"
-                "movq       16%1, %%mm4 \n\t"
-                "movq       24%1, %%mm6 \n\t"
-                "movq      %%mm0, %%mm1 \n\t"
-                "movq      %%mm2, %%mm3 \n\t"
-                "movq      %%mm4, %%mm5 \n\t"
-                "movq      %%mm6, %%mm7 \n\t"
-                "punpcklbw %%mm0, %%mm0 \n\t"
-                "punpckhbw %%mm1, %%mm1 \n\t"
-                "punpcklbw %%mm2, %%mm2 \n\t"
-                "punpckhbw %%mm3, %%mm3 \n\t"
-                "punpcklbw %%mm4, %%mm4 \n\t"
-                "punpckhbw %%mm5, %%mm5 \n\t"
-                "punpcklbw %%mm6, %%mm6 \n\t"
-                "punpckhbw %%mm7, %%mm7 \n\t"
-                MOVNTQ"    %%mm0,   %0  \n\t"
-                MOVNTQ"    %%mm1,  8%0  \n\t"
-                MOVNTQ"    %%mm2, 16%0  \n\t"
-                MOVNTQ"    %%mm3, 24%0  \n\t"
-                MOVNTQ"    %%mm4, 32%0  \n\t"
-                MOVNTQ"    %%mm5, 40%0  \n\t"
-                MOVNTQ"    %%mm6, 48%0  \n\t"
-                MOVNTQ"    %%mm7, 56%0"
-                :"=m"(d[2*x])
-                :"m"(s2[x])
-                :"memory");
-        }
-#endif
-        for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
-    }
-#if HAVE_MMX
-    __asm__(
-            EMMS"       \n\t"
-            SFENCE"     \n\t"
-            ::: "memory"
-        );
-#endif
-}
-
-static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
-                                        uint8_t *dst,
-                                        long width, long height,
-                                        long srcStride1, long srcStride2,
-                                        long srcStride3, long dstStride)
-{
-    x86_reg x;
-    long y,w,h;
-    w=width/2; h=height;
-    for (y=0;y<h;y++) {
-        const uint8_t* yp=src1+srcStride1*y;
-        const uint8_t* up=src2+srcStride2*(y>>2);
-        const uint8_t* vp=src3+srcStride3*(y>>2);
-        uint8_t* d=dst+dstStride*y;
-        x=0;
-#if HAVE_MMX
-        for (;x<w-7;x+=8) {
-            __asm__ volatile(
-                PREFETCH"   32(%1, %0)          \n\t"
-                PREFETCH"   32(%2, %0)          \n\t"
-                PREFETCH"   32(%3, %0)          \n\t"
-                "movq      (%1, %0, 4), %%mm0   \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
-                "movq         (%2, %0), %%mm1   \n\t" /* U0U1U2U3U4U5U6U7 */
-                "movq         (%3, %0), %%mm2   \n\t" /* V0V1V2V3V4V5V6V7 */
-                "movq            %%mm0, %%mm3   \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
-                "movq            %%mm1, %%mm4   \n\t" /* U0U1U2U3U4U5U6U7 */
-                "movq            %%mm2, %%mm5   \n\t" /* V0V1V2V3V4V5V6V7 */
-                "punpcklbw       %%mm1, %%mm1   \n\t" /* U0U0 U1U1 U2U2 U3U3 */
-                "punpcklbw       %%mm2, %%mm2   \n\t" /* V0V0 V1V1 V2V2 V3V3 */
-                "punpckhbw       %%mm4, %%mm4   \n\t" /* U4U4 U5U5 U6U6 U7U7 */
-                "punpckhbw       %%mm5, %%mm5   \n\t" /* V4V4 V5V5 V6V6 V7V7 */
-
-                "movq            %%mm1, %%mm6   \n\t"
-                "punpcklbw       %%mm2, %%mm1   \n\t" /* U0V0 U0V0 U1V1 U1V1*/
-                "punpcklbw       %%mm1, %%mm0   \n\t" /* Y0U0 Y1V0 Y2U0 Y3V0*/
-                "punpckhbw       %%mm1, %%mm3   \n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/
-                MOVNTQ"          %%mm0,  (%4, %0, 8)    \n\t"
-                MOVNTQ"          %%mm3, 8(%4, %0, 8)    \n\t"
-
-                "punpckhbw       %%mm2, %%mm6   \n\t" /* U2V2 U2V2 U3V3 U3V3*/
-                "movq     8(%1, %0, 4), %%mm0   \n\t"
-                "movq            %%mm0, %%mm3   \n\t"
-                "punpcklbw       %%mm6, %%mm0   \n\t" /* Y U2 Y V2 Y U2 Y V2*/
-                "punpckhbw       %%mm6, %%mm3   \n\t" /* Y U3 Y V3 Y U3 Y V3*/
-                MOVNTQ"          %%mm0, 16(%4, %0, 8)   \n\t"
-                MOVNTQ"          %%mm3, 24(%4, %0, 8)   \n\t"
-
-                "movq            %%mm4, %%mm6   \n\t"
-                "movq    16(%1, %0, 4), %%mm0   \n\t"
-                "movq            %%mm0, %%mm3   \n\t"
-                "punpcklbw       %%mm5, %%mm4   \n\t"
-                "punpcklbw       %%mm4, %%mm0   \n\t" /* Y U4 Y V4 Y U4 Y V4*/
-                "punpckhbw       %%mm4, %%mm3   \n\t" /* Y U5 Y V5 Y U5 Y V5*/
-                MOVNTQ"          %%mm0, 32(%4, %0, 8)   \n\t"
-                MOVNTQ"          %%mm3, 40(%4, %0, 8)   \n\t"
-
-                "punpckhbw       %%mm5, %%mm6   \n\t"
-                "movq    24(%1, %0, 4), %%mm0   \n\t"
-                "movq            %%mm0, %%mm3   \n\t"
-                "punpcklbw       %%mm6, %%mm0   \n\t" /* Y U6 Y V6 Y U6 Y V6*/
-                "punpckhbw       %%mm6, %%mm3   \n\t" /* Y U7 Y V7 Y U7 Y V7*/
-                MOVNTQ"          %%mm0, 48(%4, %0, 8)   \n\t"
-                MOVNTQ"          %%mm3, 56(%4, %0, 8)   \n\t"
-
-                : "+r" (x)
-                : "r"(yp), "r" (up), "r"(vp), "r"(d)
-                :"memory");
-        }
-#endif
-        for (; x<w; x++) {
-            const long x2 = x<<2;
-            d[8*x+0] = yp[x2];
-            d[8*x+1] = up[x];
-            d[8*x+2] = yp[x2+1];
-            d[8*x+3] = vp[x];
-            d[8*x+4] = yp[x2+2];
-            d[8*x+5] = up[x];
-            d[8*x+6] = yp[x2+3];
-            d[8*x+7] = vp[x];
-        }
-    }
-#if HAVE_MMX
-    __asm__(
-            EMMS"       \n\t"
-            SFENCE"     \n\t"
-            ::: "memory"
-        );
-#endif
-}
-
-static void RENAME(extract_even)(const uint8_t *src, uint8_t *dst, x86_reg count)
-{
-    dst +=   count;
-    src += 2*count;
-    count= - count;
-
-#if HAVE_MMX
-    if(count <= -16) {
-        count += 15;
-        __asm__ volatile(
-            "pcmpeqw       %%mm7, %%mm7        \n\t"
-            "psrlw            $8, %%mm7        \n\t"
-            "1:                                \n\t"
-            "movq -30(%1, %0, 2), %%mm0        \n\t"
-            "movq -22(%1, %0, 2), %%mm1        \n\t"
-            "movq -14(%1, %0, 2), %%mm2        \n\t"
-            "movq  -6(%1, %0, 2), %%mm3        \n\t"
-            "pand          %%mm7, %%mm0        \n\t"
-            "pand          %%mm7, %%mm1        \n\t"
-            "pand          %%mm7, %%mm2        \n\t"
-            "pand          %%mm7, %%mm3        \n\t"
-            "packuswb      %%mm1, %%mm0        \n\t"
-            "packuswb      %%mm3, %%mm2        \n\t"
-            MOVNTQ"        %%mm0,-15(%2, %0)   \n\t"
-            MOVNTQ"        %%mm2,- 7(%2, %0)   \n\t"
-            "add             $16, %0           \n\t"
-            " js 1b                            \n\t"
-            : "+r"(count)
-            : "r"(src), "r"(dst)
-        );
-        count -= 15;
-    }
-#endif
-    while(count<0) {
-        dst[count]= src[2*count];
-        count++;
-    }
-}
-
-static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
-    dst0+=   count;
-    dst1+=   count;
-    src += 4*count;
-    count= - count;
-#if HAVE_MMX
-    if(count <= -8) {
-        count += 7;
-        __asm__ volatile(
-            "pcmpeqw       %%mm7, %%mm7        \n\t"
-            "psrlw            $8, %%mm7        \n\t"
-            "1:                                \n\t"
-            "movq -28(%1, %0, 4), %%mm0        \n\t"
-            "movq -20(%1, %0, 4), %%mm1        \n\t"
-            "movq -12(%1, %0, 4), %%mm2        \n\t"
-            "movq  -4(%1, %0, 4), %%mm3        \n\t"
-            "pand          %%mm7, %%mm0        \n\t"
-            "pand          %%mm7, %%mm1        \n\t"
-            "pand          %%mm7, %%mm2        \n\t"
-            "pand          %%mm7, %%mm3        \n\t"
-            "packuswb      %%mm1, %%mm0        \n\t"
-            "packuswb      %%mm3, %%mm2        \n\t"
-            "movq          %%mm0, %%mm1        \n\t"
-            "movq          %%mm2, %%mm3        \n\t"
-            "psrlw            $8, %%mm0        \n\t"
-            "psrlw            $8, %%mm2        \n\t"
-            "pand          %%mm7, %%mm1        \n\t"
-            "pand          %%mm7, %%mm3        \n\t"
-            "packuswb      %%mm2, %%mm0        \n\t"
-            "packuswb      %%mm3, %%mm1        \n\t"
-            MOVNTQ"        %%mm0,- 7(%3, %0)   \n\t"
-            MOVNTQ"        %%mm1,- 7(%2, %0)   \n\t"
-            "add              $8, %0           \n\t"
-            " js 1b                            \n\t"
-            : "+r"(count)
-            : "r"(src), "r"(dst0), "r"(dst1)
-        );
-        count -= 7;
-    }
-#endif
-    while(count<0) {
-        dst0[count]= src[4*count+0];
-        dst1[count]= src[4*count+2];
-        count++;
-    }
-}
-
-static void RENAME(extract_even2avg)(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
-    dst0 +=   count;
-    dst1 +=   count;
-    src0 += 4*count;
-    src1 += 4*count;
-    count= - count;
-#ifdef PAVGB
-    if(count <= -8) {
-        count += 7;
-        __asm__ volatile(
-            "pcmpeqw        %%mm7, %%mm7        \n\t"
-            "psrlw             $8, %%mm7        \n\t"
-            "1:                                \n\t"
-            "movq  -28(%1, %0, 4), %%mm0        \n\t"
-            "movq  -20(%1, %0, 4), %%mm1        \n\t"
-            "movq  -12(%1, %0, 4), %%mm2        \n\t"
-            "movq   -4(%1, %0, 4), %%mm3        \n\t"
-            PAVGB" -28(%2, %0, 4), %%mm0        \n\t"
-            PAVGB" -20(%2, %0, 4), %%mm1        \n\t"
-            PAVGB" -12(%2, %0, 4), %%mm2        \n\t"
-            PAVGB" - 4(%2, %0, 4), %%mm3        \n\t"
-            "pand           %%mm7, %%mm0        \n\t"
-            "pand           %%mm7, %%mm1        \n\t"
-            "pand           %%mm7, %%mm2        \n\t"
-            "pand           %%mm7, %%mm3        \n\t"
-            "packuswb       %%mm1, %%mm0        \n\t"
-            "packuswb       %%mm3, %%mm2        \n\t"
-            "movq           %%mm0, %%mm1        \n\t"
-            "movq           %%mm2, %%mm3        \n\t"
-            "psrlw             $8, %%mm0        \n\t"
-            "psrlw             $8, %%mm2        \n\t"
-            "pand           %%mm7, %%mm1        \n\t"
-            "pand           %%mm7, %%mm3        \n\t"
-            "packuswb       %%mm2, %%mm0        \n\t"
-            "packuswb       %%mm3, %%mm1        \n\t"
-            MOVNTQ"         %%mm0,- 7(%4, %0)   \n\t"
-            MOVNTQ"         %%mm1,- 7(%3, %0)   \n\t"
-            "add               $8, %0           \n\t"
-            " js 1b                            \n\t"
-            : "+r"(count)
-            : "r"(src0), "r"(src1), "r"(dst0), "r"(dst1)
-        );
-        count -= 7;
-    }
-#endif
-    while(count<0) {
-        dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1;
-        dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1;
-        count++;
-    }
-}
-
-static void RENAME(extract_odd2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
-    dst0+=   count;
-    dst1+=   count;
-    src += 4*count;
-    count= - count;
-#if HAVE_MMX
-    if(count <= -8) {
-        count += 7;
-        __asm__ volatile(
-            "pcmpeqw       %%mm7, %%mm7        \n\t"
-            "psrlw            $8, %%mm7        \n\t"
-            "1:                                \n\t"
-            "movq -28(%1, %0, 4), %%mm0        \n\t"
-            "movq -20(%1, %0, 4), %%mm1        \n\t"
-            "movq -12(%1, %0, 4), %%mm2        \n\t"
-            "movq  -4(%1, %0, 4), %%mm3        \n\t"
-            "psrlw            $8, %%mm0        \n\t"
-            "psrlw            $8, %%mm1        \n\t"
-            "psrlw            $8, %%mm2        \n\t"
-            "psrlw            $8, %%mm3        \n\t"
-            "packuswb      %%mm1, %%mm0        \n\t"
-            "packuswb      %%mm3, %%mm2        \n\t"
-            "movq          %%mm0, %%mm1        \n\t"
-            "movq          %%mm2, %%mm3        \n\t"
-            "psrlw            $8, %%mm0        \n\t"
-            "psrlw            $8, %%mm2        \n\t"
-            "pand          %%mm7, %%mm1        \n\t"
-            "pand          %%mm7, %%mm3        \n\t"
-            "packuswb      %%mm2, %%mm0        \n\t"
-            "packuswb      %%mm3, %%mm1        \n\t"
-            MOVNTQ"        %%mm0,- 7(%3, %0)   \n\t"
-            MOVNTQ"        %%mm1,- 7(%2, %0)   \n\t"
-            "add              $8, %0           \n\t"
-            " js 1b                            \n\t"
-            : "+r"(count)
-            : "r"(src), "r"(dst0), "r"(dst1)
-        );
-        count -= 7;
-    }
-#endif
-    src++;
-    while(count<0) {
-        dst0[count]= src[4*count+0];
-        dst1[count]= src[4*count+2];
-        count++;
-    }
-}
-
-static void RENAME(extract_odd2avg)(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
-    dst0 +=   count;
-    dst1 +=   count;
-    src0 += 4*count;
-    src1 += 4*count;
-    count= - count;
-#ifdef PAVGB
-    if(count <= -8) {
-        count += 7;
-        __asm__ volatile(
-            "pcmpeqw        %%mm7, %%mm7        \n\t"
-            "psrlw             $8, %%mm7        \n\t"
-            "1:                                \n\t"
-            "movq  -28(%1, %0, 4), %%mm0        \n\t"
-            "movq  -20(%1, %0, 4), %%mm1        \n\t"
-            "movq  -12(%1, %0, 4), %%mm2        \n\t"
-            "movq   -4(%1, %0, 4), %%mm3        \n\t"
-            PAVGB" -28(%2, %0, 4), %%mm0        \n\t"
-            PAVGB" -20(%2, %0, 4), %%mm1        \n\t"
-            PAVGB" -12(%2, %0, 4), %%mm2        \n\t"
-            PAVGB" - 4(%2, %0, 4), %%mm3        \n\t"
-            "psrlw             $8, %%mm0        \n\t"
-            "psrlw             $8, %%mm1        \n\t"
-            "psrlw             $8, %%mm2        \n\t"
-            "psrlw             $8, %%mm3        \n\t"
-            "packuswb       %%mm1, %%mm0        \n\t"
-            "packuswb       %%mm3, %%mm2        \n\t"
-            "movq           %%mm0, %%mm1        \n\t"
-            "movq           %%mm2, %%mm3        \n\t"
-            "psrlw             $8, %%mm0        \n\t"
-            "psrlw             $8, %%mm2        \n\t"
-            "pand           %%mm7, %%mm1        \n\t"
-            "pand           %%mm7, %%mm3        \n\t"
-            "packuswb       %%mm2, %%mm0        \n\t"
-            "packuswb       %%mm3, %%mm1        \n\t"
-            MOVNTQ"         %%mm0,- 7(%4, %0)   \n\t"
-            MOVNTQ"         %%mm1,- 7(%3, %0)   \n\t"
-            "add               $8, %0           \n\t"
-            " js 1b                            \n\t"
-            : "+r"(count)
-            : "r"(src0), "r"(src1), "r"(dst0), "r"(dst1)
-        );
-        count -= 7;
-    }
-#endif
-    src0++;
-    src1++;
-    while(count<0) {
-        dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1;
-        dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1;
-        count++;
-    }
-}
-
-static void RENAME(yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long srcStride)
-{
-    long y;
-    const long chromWidth= -((-width)>>1);
-
-    for (y=0; y<height; y++) {
-        RENAME(extract_even)(src, ydst, width);
-        if(y&1) {
-            RENAME(extract_odd2avg)(src-srcStride, src, udst, vdst, chromWidth);
-            udst+= chromStride;
-            vdst+= chromStride;
-        }
-
-        src += srcStride;
-        ydst+= lumStride;
-    }
-#if HAVE_MMX
-    __asm__(
-            EMMS"       \n\t"
-            SFENCE"     \n\t"
-            ::: "memory"
-        );
-#endif
-}
-
-static void RENAME(yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long srcStride)
-{
-    long y;
-    const long chromWidth= -((-width)>>1);
-
-    for (y=0; y<height; y++) {
-        RENAME(extract_even)(src, ydst, width);
-        RENAME(extract_odd2)(src, udst, vdst, chromWidth);
-
-        src += srcStride;
-        ydst+= lumStride;
-        udst+= chromStride;
-        vdst+= chromStride;
-    }
-#if HAVE_MMX
-    __asm__(
-            EMMS"       \n\t"
-            SFENCE"     \n\t"
-            ::: "memory"
-        );
-#endif
-}
-
-static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long srcStride)
-{
-    long y;
-    const long chromWidth= -((-width)>>1);
-
-    for (y=0; y<height; y++) {
-        RENAME(extract_even)(src+1, ydst, width);
-        if(y&1) {
-            RENAME(extract_even2avg)(src-srcStride, src, udst, vdst, chromWidth);
-            udst+= chromStride;
-            vdst+= chromStride;
-        }
-
-        src += srcStride;
-        ydst+= lumStride;
-    }
-#if HAVE_MMX
-    __asm__(
-            EMMS"       \n\t"
-            SFENCE"     \n\t"
-            ::: "memory"
-        );
-#endif
-}
-
-static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
-                                      long width, long height,
-                                      long lumStride, long chromStride, long srcStride)
-{
-    long y;
-    const long chromWidth= -((-width)>>1);
-
-    for (y=0; y<height; y++) {
-        RENAME(extract_even)(src+1, ydst, width);
-        RENAME(extract_even2)(src, udst, vdst, chromWidth);
-
-        src += srcStride;
-        ydst+= lumStride;
-        udst+= chromStride;
-        vdst+= chromStride;
-    }
-#if HAVE_MMX
-    __asm__(
-            EMMS"       \n\t"
-            SFENCE"     \n\t"
-            ::: "memory"
-        );
-#endif
-}
-
-static inline void RENAME(rgb2rgb_init)(void)
-{
-    rgb15to16       = RENAME(rgb15to16);
-    rgb15tobgr24    = RENAME(rgb15tobgr24);
-    rgb15to32       = RENAME(rgb15to32);
-    rgb16tobgr24    = RENAME(rgb16tobgr24);
-    rgb16to32       = RENAME(rgb16to32);
-    rgb16to15       = RENAME(rgb16to15);
-    rgb24tobgr16    = RENAME(rgb24tobgr16);
-    rgb24tobgr15    = RENAME(rgb24tobgr15);
-    rgb24tobgr32    = RENAME(rgb24tobgr32);
-    rgb32to16       = RENAME(rgb32to16);
-    rgb32to15       = RENAME(rgb32to15);
-    rgb32tobgr24    = RENAME(rgb32tobgr24);
-    rgb24to15       = RENAME(rgb24to15);
-    rgb24to16       = RENAME(rgb24to16);
-    rgb24tobgr24    = RENAME(rgb24tobgr24);
-    rgb32tobgr32    = RENAME(rgb32tobgr32);
-    rgb32tobgr16    = RENAME(rgb32tobgr16);
-    rgb32tobgr15    = RENAME(rgb32tobgr15);
-    yv12toyuy2      = RENAME(yv12toyuy2);
-    yv12touyvy      = RENAME(yv12touyvy);
-    yuv422ptoyuy2   = RENAME(yuv422ptoyuy2);
-    yuv422ptouyvy   = RENAME(yuv422ptouyvy);
-    yuy2toyv12      = RENAME(yuy2toyv12);
-//    yvu9toyv12      = RENAME(yvu9toyv12);
-    planar2x        = RENAME(planar2x);
-    rgb24toyv12     = RENAME(rgb24toyv12);
-    interleaveBytes = RENAME(interleaveBytes);
-    vu9_to_vu12     = RENAME(vu9_to_vu12);
-    yvu9_to_yuy2    = RENAME(yvu9_to_yuy2);
-
-    uyvytoyuv420    = RENAME(uyvytoyuv420);
-    uyvytoyuv422    = RENAME(uyvytoyuv422);
-    yuyvtoyuv420    = RENAME(yuyvtoyuv420);
-    yuyvtoyuv422    = RENAME(yuyvtoyuv422);
-}
diff --git a/libswscale/sparc/yuv2rgb_vis.c b/libswscale/sparc/yuv2rgb_vis.c
deleted file mode 100644
index cc98f04..0000000
--- a/libswscale/sparc/yuv2rgb_vis.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * VIS optimized software YUV to RGB converter
- * Copyright (c) 2007 Denes Balatoni <dbalatoni at programozo.hu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#define YUV2RGB_INIT \
-    "wr %%g0, 0x10, %%gsr \n\t" \
-    "ldd [%5], %%f32      \n\t" \
-    "ldd [%5+8], %%f34    \n\t" \
-    "ldd [%5+16], %%f36   \n\t" \
-    "ldd [%5+24], %%f38   \n\t" \
-    "ldd [%5+32], %%f40   \n\t" \
-    "ldd [%5+40], %%f42   \n\t" \
-    "ldd [%5+48], %%f44   \n\t" \
-    "ldd [%5+56], %%f46   \n\t" \
-    "ldd [%5+64], %%f48   \n\t" \
-    "ldd [%5+72], %%f50   \n\t"
-
-#define YUV2RGB_KERNEL \
-    /* ^^^^ f0=Y f3=u f5=v */ \
-    "fmul8x16 %%f3, %%f48, %%f6   \n\t" \
-    "fmul8x16 %%f19, %%f48, %%f22 \n\t" \
-    "fmul8x16 %%f5, %%f44, %%f8   \n\t" \
-    "fmul8x16 %%f21, %%f44, %%f24 \n\t" \
-    "fmul8x16 %%f0, %%f42, %%f0   \n\t" \
-    "fmul8x16 %%f16, %%f42, %%f16 \n\t" \
-    "fmul8x16 %%f3, %%f50, %%f2   \n\t" \
-    "fmul8x16 %%f19, %%f50, %%f18 \n\t" \
-    "fmul8x16 %%f5, %%f46, %%f4   \n\t" \
-    "fmul8x16 %%f21, %%f46, %%f20 \n\t" \
-    \
-    "fpsub16 %%f6, %%f34, %%f6   \n\t" /* 1 */ \
-    "fpsub16 %%f22, %%f34, %%f22 \n\t" /* 1 */ \
-    "fpsub16 %%f8, %%f38, %%f8   \n\t" /* 3 */ \
-    "fpsub16 %%f24, %%f38, %%f24 \n\t" /* 3 */ \
-    "fpsub16 %%f0, %%f32, %%f0   \n\t" /* 0 */ \
-    "fpsub16 %%f16, %%f32, %%f16 \n\t" /* 0 */ \
-    "fpsub16 %%f2, %%f36, %%f2   \n\t" /* 2 */ \
-    "fpsub16 %%f18, %%f36, %%f18 \n\t" /* 2 */ \
-    "fpsub16 %%f4, %%f40, %%f4   \n\t" /* 4 */ \
-    "fpsub16 %%f20, %%f40, %%f20 \n\t" /* 4 */ \
-    \
-    "fpadd16 %%f0, %%f8, %%f8    \n\t" /* Gt */ \
-    "fpadd16 %%f16, %%f24, %%f24 \n\t" /* Gt */ \
-    "fpadd16 %%f0, %%f4, %%f4    \n\t" /* R */ \
-    "fpadd16 %%f16, %%f20, %%f20 \n\t" /* R */ \
-    "fpadd16 %%f0, %%f6, %%f6    \n\t" /* B */ \
-    "fpadd16 %%f16, %%f22, %%f22 \n\t" /* B */ \
-    "fpadd16 %%f8, %%f2, %%f2    \n\t" /* G */ \
-    "fpadd16 %%f24, %%f18, %%f18 \n\t" /* G */ \
-    \
-    "fpack16 %%f4, %%f4    \n\t" \
-    "fpack16 %%f20, %%f20  \n\t" \
-    "fpack16 %%f6, %%f6    \n\t" \
-    "fpack16 %%f22, %%f22  \n\t" \
-    "fpack16 %%f2, %%f2    \n\t" \
-    "fpack16 %%f18, %%f18  \n\t"
-
-
-
-// FIXME: must be changed to set alpha to 255 instead of 0
-static int vis_420P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                           int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, out1, out2, out3, out4, out5, out6;
-
-    for(y=0;y < srcSliceH;++y) {
-        __asm__ volatile (
-            YUV2RGB_INIT
-            "wr %%g0, 0xd2, %%asi        \n\t" /* ASI_FL16_P */
-            "1:                          \n\t"
-            "ldda [%1] %%asi, %%f2       \n\t"
-            "ldda [%1+2] %%asi, %%f18    \n\t"
-            "ldda [%2] %%asi, %%f4       \n\t"
-            "ldda [%2+2] %%asi, %%f20    \n\t"
-            "ld [%0], %%f0               \n\t"
-            "ld [%0+4], %%f16            \n\t"
-            "fpmerge %%f3, %%f3, %%f2    \n\t"
-            "fpmerge %%f19, %%f19, %%f18 \n\t"
-            "fpmerge %%f5, %%f5, %%f4    \n\t"
-            "fpmerge %%f21, %%f21, %%f20 \n\t"
-            YUV2RGB_KERNEL
-            "fzero %%f0                  \n\t"
-            "fpmerge %%f4, %%f6, %%f8    \n\t"  // r,b,t1
-            "fpmerge %%f20, %%f22, %%f24 \n\t"  // r,b,t1
-            "fpmerge %%f0, %%f2, %%f10   \n\t"  // 0,g,t2
-            "fpmerge %%f0, %%f18, %%f26  \n\t"  // 0,g,t2
-            "fpmerge %%f10, %%f8, %%f4   \n\t"  // t2,t1,msb
-            "fpmerge %%f26, %%f24, %%f20 \n\t"  // t2,t1,msb
-            "fpmerge %%f11, %%f9, %%f6   \n\t"  // t2,t1,lsb
-            "fpmerge %%f27, %%f25, %%f22 \n\t"  // t2,t1,lsb
-            "std %%f4, [%3]              \n\t"
-            "std %%f20, [%3+16]          \n\t"
-            "std %%f6, [%3+8]            \n\t"
-            "std %%f22, [%3+24]          \n\t"
-
-            "add %0, 8, %0   \n\t"
-            "add %1, 4, %1   \n\t"
-            "add %2, 4, %2   \n\t"
-            "subcc %4, 8, %4 \n\t"
-            "bne 1b          \n\t"
-            "add %3, 32, %3  \n\t" //delay slot
-            : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6)
-            : "0" (src[0]+(y+srcSliceY)*srcStride[0]), "1" (src[1]+((y+srcSliceY)>>1)*srcStride[1]),
-                "2" (src[2]+((y+srcSliceY)>>1)*srcStride[2]), "3" (dst[0]+(y+srcSliceY)*dstStride[0]),
-                "4" (c->dstW),
-                "5" (c->sparc_coeffs)
-        );
-    }
-
-    return srcSliceH;
-}
-
-// FIXME: must be changed to set alpha to 255 instead of 0
-static int vis_422P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
-                           int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, out1, out2, out3, out4, out5, out6;
-
-    for(y=0;y < srcSliceH;++y) {
-        __asm__ volatile (
-            YUV2RGB_INIT
-            "wr %%g0, 0xd2, %%asi        \n\t" /* ASI_FL16_P */
-            "1:                          \n\t"
-            "ldda [%1] %%asi, %%f2       \n\t"
-            "ldda [%1+2] %%asi, %%f18    \n\t"
-            "ldda [%2] %%asi, %%f4       \n\t"
-            "ldda [%2+2] %%asi, %%f20    \n\t"
-            "ld [%0], %%f0               \n\t"
-            "ld [%0+4], %%f16            \n\t"
-            "fpmerge %%f3, %%f3, %%f2    \n\t"
-            "fpmerge %%f19, %%f19, %%f18 \n\t"
-            "fpmerge %%f5, %%f5, %%f4    \n\t"
-            "fpmerge %%f21, %%f21, %%f20 \n\t"
-            YUV2RGB_KERNEL
-            "fzero %%f0 \n\t"
-            "fpmerge %%f4, %%f6, %%f8    \n\t"  // r,b,t1
-            "fpmerge %%f20, %%f22, %%f24 \n\t"  // r,b,t1
-            "fpmerge %%f0, %%f2, %%f10   \n\t"  // 0,g,t2
-            "fpmerge %%f0, %%f18, %%f26  \n\t"  // 0,g,t2
-            "fpmerge %%f10, %%f8, %%f4   \n\t"  // t2,t1,msb
-            "fpmerge %%f26, %%f24, %%f20 \n\t"  // t2,t1,msb
-            "fpmerge %%f11, %%f9, %%f6   \n\t"  // t2,t1,lsb
-            "fpmerge %%f27, %%f25, %%f22 \n\t"  // t2,t1,lsb
-            "std %%f4, [%3]              \n\t"
-            "std %%f20, [%3+16]          \n\t"
-            "std %%f6, [%3+8]            \n\t"
-            "std %%f22, [%3+24]          \n\t"
-
-            "add %0, 8, %0   \n\t"
-            "add %1, 4, %1   \n\t"
-            "add %2, 4, %2   \n\t"
-            "subcc %4, 8, %4 \n\t"
-            "bne 1b          \n\t"
-            "add %3, 32, %3  \n\t" //delay slot
-            : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6)
-            : "0" (src[0]+(y+srcSliceY)*srcStride[0]), "1" (src[1]+(y+srcSliceY)*srcStride[1]),
-                "2" (src[2]+(y+srcSliceY)*srcStride[2]), "3" (dst[0]+(y+srcSliceY)*dstStride[0]),
-                "4" (c->dstW),
-                "5" (c->sparc_coeffs)
-        );
-    }
-
-    return srcSliceH;
-}
-
-SwsFunc ff_yuv2rgb_init_vis(SwsContext *c)
-{
-    c->sparc_coeffs[5]=c->yCoeff;
-    c->sparc_coeffs[6]=c->vgCoeff;
-    c->sparc_coeffs[7]=c->vrCoeff;
-    c->sparc_coeffs[8]=c->ubCoeff;
-    c->sparc_coeffs[9]=c->ugCoeff;
-
-    c->sparc_coeffs[0]=(((int16_t)c->yOffset*(int16_t)c->yCoeff >>11) & 0xffff) * 0x0001000100010001ULL;
-    c->sparc_coeffs[1]=(((int16_t)c->uOffset*(int16_t)c->ubCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
-    c->sparc_coeffs[2]=(((int16_t)c->uOffset*(int16_t)c->ugCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
-    c->sparc_coeffs[3]=(((int16_t)c->vOffset*(int16_t)c->vgCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
-    c->sparc_coeffs[4]=(((int16_t)c->vOffset*(int16_t)c->vrCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
-
-    if (c->dstFormat == PIX_FMT_RGB32 && c->srcFormat == PIX_FMT_YUV422P && (c->dstW & 7)==0) {
-        av_log(c, AV_LOG_INFO, "SPARC VIS accelerated YUV422P -> RGB32 (WARNING: alpha value is wrong)\n");
-        return vis_422P_ARGB32;
-    }
-    else if (c->dstFormat == PIX_FMT_RGB32 && c->srcFormat == PIX_FMT_YUV420P && (c->dstW & 7)==0) {
-        av_log(c, AV_LOG_INFO, "SPARC VIS accelerated YUV420P -> RGB32 (WARNING: alpha value is wrong)\n");
-        return vis_420P_ARGB32;
-    }
-    return NULL;
-}
diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c
deleted file mode 100644
index 887973a..0000000
--- a/libswscale/swscale-test.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <stdarg.h>
-
-#undef HAVE_AV_CONFIG_H
-#include "libavutil/mem.h"
-#include "libavutil/avutil.h"
-#include "libavutil/lfg.h"
-#include "swscale.h"
-
-/* HACK Duplicated from swscale_internal.h.
- * Should be removed when a cleaner pixel format system exists. */
-const char *sws_format_name(enum PixelFormat format);
-#define isGray(x)       (           \
-           (x)==PIX_FMT_GRAY8       \
-        || (x)==PIX_FMT_GRAY16BE    \
-        || (x)==PIX_FMT_GRAY16LE    \
-    )
-#define hasChroma(x)   (!(          \
-            isGray(x)               \
-        || (x)==PIX_FMT_MONOBLACK   \
-        || (x)==PIX_FMT_MONOWHITE   \
-    ))
-#define isALPHA(x)      (           \
-           (x)==PIX_FMT_BGR32       \
-        || (x)==PIX_FMT_BGR32_1     \
-        || (x)==PIX_FMT_RGB32       \
-        || (x)==PIX_FMT_RGB32_1     \
-        || (x)==PIX_FMT_YUVA420P    \
-    )
-
-static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h)
-{
-    int x,y;
-    uint64_t ssd=0;
-
-//printf("%d %d\n", w, h);
-
-    for (y=0; y<h; y++) {
-        for (x=0; x<w; x++) {
-            int d= src1[x + y*stride1] - src2[x + y*stride2];
-            ssd+= d*d;
-//printf("%d", abs(src1[x + y*stride1] - src2[x + y*stride2])/26 );
-        }
-//printf("\n");
-    }
-    return ssd;
-}
-
-// test by ref -> src -> dst -> out & compare out against ref
-// ref & out are YV12
-static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
-                  enum PixelFormat srcFormat, enum PixelFormat dstFormat,
-                  int srcW, int srcH, int dstW, int dstH, int flags)
-{
-    uint8_t *src[4] = {0};
-    uint8_t *dst[4] = {0};
-    uint8_t *out[4] = {0};
-    int srcStride[4], dstStride[4];
-    int i;
-    uint64_t ssdY, ssdU=0, ssdV=0, ssdA=0;
-    struct SwsContext *srcContext = NULL, *dstContext = NULL,
-                      *outContext = NULL;
-    int res;
-
-    res = 0;
-    for (i=0; i<4; i++) {
-        // avoid stride % bpp != 0
-        if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
-            srcStride[i]= srcW*3;
-        else if (srcFormat==PIX_FMT_RGB48BE || srcFormat==PIX_FMT_RGB48LE)
-            srcStride[i]= srcW*6;
-        else
-            srcStride[i]= srcW*4;
-
-        if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
-            dstStride[i]= dstW*3;
-        else if (dstFormat==PIX_FMT_RGB48BE || dstFormat==PIX_FMT_RGB48LE)
-            dstStride[i]= dstW*6;
-        else
-            dstStride[i]= dstW*4;
-
-        /* Image buffers passed into libswscale can be allocated any way you
-         * prefer, as long as they're aligned enough for the architecture, and
-         * they're freed appropriately (such as using av_free for buffers
-         * allocated with av_malloc). */
-        src[i]= av_mallocz(srcStride[i]*srcH);
-        dst[i]= av_mallocz(dstStride[i]*dstH);
-        out[i]= av_mallocz(refStride[i]*h);
-        if (!src[i] || !dst[i] || !out[i]) {
-            perror("Malloc");
-            res = -1;
-
-            goto end;
-        }
-    }
-
-    srcContext= sws_getContext(w, h, PIX_FMT_YUVA420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
-    if (!srcContext) {
-        fprintf(stderr, "Failed to get %s ---> %s\n",
-                sws_format_name(PIX_FMT_YUVA420P),
-                sws_format_name(srcFormat));
-        res = -1;
-
-        goto end;
-    }
-    dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
-    if (!dstContext) {
-        fprintf(stderr, "Failed to get %s ---> %s\n",
-                sws_format_name(srcFormat),
-                sws_format_name(dstFormat));
-        res = -1;
-
-        goto end;
-    }
-    outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUVA420P, flags, NULL, NULL, NULL);
-    if (!outContext) {
-        fprintf(stderr, "Failed to get %s ---> %s\n",
-                sws_format_name(dstFormat),
-                sws_format_name(PIX_FMT_YUVA420P));
-        res = -1;
-
-        goto end;
-    }
-//    printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2],
-//        (int)src[0], (int)src[1], (int)src[2]);
-
-    sws_scale(srcContext, ref, refStride, 0, h   , src, srcStride);
-    sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
-    sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
-
-    ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
-    if (hasChroma(srcFormat) && hasChroma(dstFormat)) {
-        //FIXME check that output is really gray
-        ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
-        ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
-    }
-    if (isALPHA(srcFormat) && isALPHA(dstFormat))
-        ssdA= getSSD(ref[3], out[3], refStride[3], refStride[3], w, h);
-
-    ssdY/= w*h;
-    ssdU/= w*h/4;
-    ssdV/= w*h/4;
-    ssdA/= w*h;
-
-    printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5"PRId64",%5"PRId64",%5"PRId64",%5"PRId64"\n",
-           sws_format_name(srcFormat), srcW, srcH,
-           sws_format_name(dstFormat), dstW, dstH,
-           flags, ssdY, ssdU, ssdV, ssdA);
-    fflush(stdout);
-
-end:
-
-    sws_freeContext(srcContext);
-    sws_freeContext(dstContext);
-    sws_freeContext(outContext);
-
-    for (i=0; i<4; i++) {
-        av_free(src[i]);
-        av_free(dst[i]);
-        av_free(out[i]);
-    }
-
-    return res;
-}
-
-static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h)
-{
-    const int flags[] = { SWS_FAST_BILINEAR,
-                          SWS_BILINEAR, SWS_BICUBIC,
-                          SWS_X       , SWS_POINT  , SWS_AREA, 0 };
-    const int srcW = w;
-    const int srcH = h;
-    const int dstW[] = { srcW - srcW/3, srcW, srcW + srcW/3, 0 };
-    const int dstH[] = { srcH - srcH/3, srcH, srcH + srcH/3, 0 };
-    enum PixelFormat srcFormat, dstFormat;
-
-    for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) {
-        if (!sws_isSupportedInput(srcFormat) || !sws_isSupportedOutput(srcFormat))
-            continue;
-
-        for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) {
-            int i, j, k;
-            int res = 0;
-
-            if (!sws_isSupportedInput(dstFormat) || !sws_isSupportedOutput(dstFormat))
-                continue;
-
-            printf("%s -> %s\n",
-                   sws_format_name(srcFormat),
-                   sws_format_name(dstFormat));
-            fflush(stdout);
-
-            for (i = 0; dstW[i] && !res; i++)
-                for (j = 0; dstH[j] && !res; j++)
-                    for (k = 0; flags[k] && !res; k++)
-                        res = doTest(ref, refStride, w, h, srcFormat, dstFormat,
-                                     srcW, srcH, dstW[i], dstH[j], flags[k]);
-        }
-    }
-}
-
-#define W 96
-#define H 96
-
-int main(int argc, char **argv)
-{
-    uint8_t *rgb_data = av_malloc (W*H*4);
-    uint8_t *rgb_src[3]= {rgb_data, NULL, NULL};
-    int rgb_stride[3]={4*W, 0, 0};
-    uint8_t *data = av_malloc (4*W*H);
-    uint8_t *src[4]= {data, data+W*H, data+W*H*2, data+W*H*3};
-    int stride[4]={W, W, W, W};
-    int x, y;
-    struct SwsContext *sws;
-    AVLFG rand;
-
-    if (!rgb_data || !data)
-        return -1;
-
-    sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL);
-
-    av_lfg_init(&rand, 1);
-
-    for (y=0; y<H; y++) {
-        for (x=0; x<W*4; x++) {
-            rgb_data[ x + y*4*W]= av_lfg_get(&rand);
-        }
-    }
-    sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);
-    sws_freeContext(sws);
-    av_free(rgb_data);
-
-    selfTest(src, stride, W, H);
-    av_free(data);
-
-    return 0;
-}
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
deleted file mode 100644
index 81f475c..0000000
--- a/libswscale/swscale.c
+++ /dev/null
@@ -1,1987 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
-  supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR32_1, BGR24, BGR16, BGR15, RGB32, RGB32_1, RGB24, Y8/Y800, YVU9/IF09, PAL8
-  supported output formats: YV12, I420/IYUV, YUY2, UYVY, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09
-  {BGR,RGB}{1,4,8,15,16} support dithering
-
-  unscaled special converters (YV12=I420=IYUV, Y800=Y8)
-  YV12 -> {BGR,RGB}{1,4,8,12,15,16,24,32}
-  x -> x
-  YUV9 -> YV12
-  YUV9/YV12 -> Y800
-  Y800 -> YUV9/YV12
-  BGR24 -> BGR32 & RGB24 -> RGB32
-  BGR32 -> BGR24 & RGB32 -> RGB24
-  BGR15 -> BGR16
-*/
-
-/*
-tested special converters (most are tested actually, but I did not write it down ...)
- YV12 -> BGR12/BGR16
- YV12 -> YV12
- BGR15 -> BGR16
- BGR16 -> BGR16
- YVU9 -> YV12
-
-untested special converters
-  YV12/I420 -> BGR15/BGR24/BGR32 (it is the yuv2rgb stuff, so it should be OK)
-  YV12/I420 -> YV12/I420
-  YUY2/BGR15/BGR24/BGR32/RGB24/RGB32 -> same format
-  BGR24 -> BGR32 & RGB24 -> RGB32
-  BGR32 -> BGR24 & RGB32 -> RGB24
-  BGR24 -> YV12
-*/
-
-#include <inttypes.h>
-#include <string.h>
-#include <math.h>
-#include <stdio.h>
-#include "config.h"
-#include <assert.h>
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "rgb2rgb.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/avutil.h"
-#include "libavutil/bswap.h"
-#include "libavutil/pixdesc.h"
-
-#undef MOVNTQ
-#undef PAVGB
-
-//#undef HAVE_MMX2
-//#define HAVE_AMD3DNOW
-//#undef HAVE_MMX
-//#undef ARCH_X86
-#define DITHER1XBPP
-
-#define FAST_BGR2YV12 // use 7 bit coefficients instead of 15 bit
-
-#ifdef M_PI
-#define PI M_PI
-#else
-#define PI 3.14159265358979323846
-#endif
-
-#define isPacked(x)         (       \
-           (x)==PIX_FMT_PAL8        \
-        || (x)==PIX_FMT_YUYV422     \
-        || (x)==PIX_FMT_UYVY422     \
-        || isAnyRGB(x)              \
-    )
-
-#define RGB2YUV_SHIFT 15
-#define BY ( (int)(0.114*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define BV (-(int)(0.081*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define BU ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GY ( (int)(0.587*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GV (-(int)(0.419*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GU (-(int)(0.331*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RY ( (int)(0.299*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RV ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RU (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-
-static const double rgb2yuv_table[8][9]={
-    {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5},
-    {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5},
-    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
-    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
-    {0.59  , 0.11  , 0.30  , -0.331, 0.5, -0.169, -0.421, -0.079, 0.5}, //FCC
-    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
-    {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5}, //SMPTE 170M
-    {0.701 , 0.087 , 0.212 , -0.384, 0.5  -0.116, -0.445, -0.055, 0.5}, //SMPTE 240M
-};
-
-/*
-NOTES
-Special versions: fast Y 1:1 scaling (no interpolation in y direction)
-
-TODO
-more intelligent misalignment avoidance for the horizontal scaler
-write special vertical cubic upscale version
-optimize C code (YV12 / minmax)
-add support for packed pixel YUV input & output
-add support for Y8 output
-optimize BGR24 & BGR32
-add BGR4 output support
-write special BGR->BGR scaler
-*/
-
-#if ARCH_X86
-DECLARE_ASM_CONST(8, uint64_t, bF8)=       0xF8F8F8F8F8F8F8F8LL;
-DECLARE_ASM_CONST(8, uint64_t, bFC)=       0xFCFCFCFCFCFCFCFCLL;
-DECLARE_ASM_CONST(8, uint64_t, w10)=       0x0010001000100010LL;
-DECLARE_ASM_CONST(8, uint64_t, w02)=       0x0002000200020002LL;
-DECLARE_ASM_CONST(8, uint64_t, bm00001111)=0x00000000FFFFFFFFLL;
-DECLARE_ASM_CONST(8, uint64_t, bm00000111)=0x0000000000FFFFFFLL;
-DECLARE_ASM_CONST(8, uint64_t, bm11111000)=0xFFFFFFFFFF000000LL;
-DECLARE_ASM_CONST(8, uint64_t, bm01010101)=0x00FF00FF00FF00FFLL;
-
-const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
-        0x0103010301030103LL,
-        0x0200020002000200LL,};
-
-const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
-        0x0602060206020602LL,
-        0x0004000400040004LL,};
-
-DECLARE_ASM_CONST(8, uint64_t, b16Mask)=   0x001F001F001F001FLL;
-DECLARE_ASM_CONST(8, uint64_t, g16Mask)=   0x07E007E007E007E0LL;
-DECLARE_ASM_CONST(8, uint64_t, r16Mask)=   0xF800F800F800F800LL;
-DECLARE_ASM_CONST(8, uint64_t, b15Mask)=   0x001F001F001F001FLL;
-DECLARE_ASM_CONST(8, uint64_t, g15Mask)=   0x03E003E003E003E0LL;
-DECLARE_ASM_CONST(8, uint64_t, r15Mask)=   0x7C007C007C007C00LL;
-
-DECLARE_ALIGNED(8, const uint64_t, ff_M24A)         = 0x00FF0000FF0000FFLL;
-DECLARE_ALIGNED(8, const uint64_t, ff_M24B)         = 0xFF0000FF0000FF00LL;
-DECLARE_ALIGNED(8, const uint64_t, ff_M24C)         = 0x0000FF0000FF0000LL;
-
-#ifdef FAST_BGR2YV12
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff)   = 0x000000210041000DULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff)   = 0x0000FFEEFFDC0038ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff)   = 0x00000038FFD2FFF8ULL;
-#else
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff)   = 0x000020E540830C8BULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff)   = 0x0000ED0FDAC23831ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff)   = 0x00003831D0E6F6EAULL;
-#endif /* FAST_BGR2YV12 */
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset)  = 0x1010101010101010ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_w1111)        = 0x0001000100010001ULL;
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY1Coeff) = 0x0C88000040870C88ULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY2Coeff) = 0x20DE4087000020DEULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY1Coeff) = 0x20DE0000408720DEULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY2Coeff) = 0x0C88408700000C88ULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toYOffset) = 0x0008400000084000ULL;
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUV)[2][4] = {
-    {0x38380000DAC83838ULL, 0xECFFDAC80000ECFFULL, 0xF6E40000D0E3F6E4ULL, 0x3838D0E300003838ULL},
-    {0xECFF0000DAC8ECFFULL, 0x3838DAC800003838ULL, 0x38380000D0E33838ULL, 0xF6E4D0E30000F6E4ULL},
-};
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUVOffset)= 0x0040400000404000ULL;
-
-#endif /* ARCH_X86 */
-
-DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_4)[2][8]={
-{  1,   3,   1,   3,   1,   3,   1,   3, },
-{  2,   0,   2,   0,   2,   0,   2,   0, },
-};
-
-DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_8)[2][8]={
-{  6,   2,   6,   2,   6,   2,   6,   2, },
-{  0,   4,   0,   4,   0,   4,   0,   4, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_4x4_16)[4][8]={
-{  8,   4,  11,   7,   8,   4,  11,   7, },
-{  2,  14,   1,  13,   2,  14,   1,  13, },
-{ 10,   6,   9,   5,  10,   6,   9,   5, },
-{  0,  12,   3,  15,   0,  12,   3,  15, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[8][8]={
-{ 17,   9,  23,  15,  16,   8,  22,  14, },
-{  5,  29,   3,  27,   4,  28,   2,  26, },
-{ 21,  13,  19,  11,  20,  12,  18,  10, },
-{  0,  24,   6,  30,   1,  25,   7,  31, },
-{ 16,   8,  22,  14,  17,   9,  23,  15, },
-{  4,  28,   2,  26,   5,  29,   3,  27, },
-{ 20,  12,  18,  10,  21,  13,  19,  11, },
-{  1,  25,   7,  31,   0,  24,   6,  30, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[8][8]={
-{  0,  55,  14,  68,   3,  58,  17,  72, },
-{ 37,  18,  50,  32,  40,  22,  54,  35, },
-{  9,  64,   5,  59,  13,  67,   8,  63, },
-{ 46,  27,  41,  23,  49,  31,  44,  26, },
-{  2,  57,  16,  71,   1,  56,  15,  70, },
-{ 39,  21,  52,  34,  38,  19,  51,  33, },
-{ 11,  66,   7,  62,  10,  65,   6,  60, },
-{ 48,  30,  43,  25,  47,  29,  42,  24, },
-};
-
-#if 1
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{117,  62, 158, 103, 113,  58, 155, 100, },
-{ 34, 199,  21, 186,  31, 196,  17, 182, },
-{144,  89, 131,  76, 141,  86, 127,  72, },
-{  0, 165,  41, 206,  10, 175,  52, 217, },
-{110,  55, 151,  96, 120,  65, 162, 107, },
-{ 28, 193,  14, 179,  38, 203,  24, 189, },
-{138,  83, 124,  69, 148,  93, 134,  79, },
-{  7, 172,  48, 213,   3, 168,  45, 210, },
-};
-#elif 1
-// tries to correct a gamma of 1.5
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{  0, 143,  18, 200,   2, 156,  25, 215, },
-{ 78,  28, 125,  64,  89,  36, 138,  74, },
-{ 10, 180,   3, 161,  16, 195,   8, 175, },
-{109,  51,  93,  38, 121,  60, 105,  47, },
-{  1, 152,  23, 210,   0, 147,  20, 205, },
-{ 85,  33, 134,  71,  81,  30, 130,  67, },
-{ 14, 190,   6, 171,  12, 185,   5, 166, },
-{117,  57, 101,  44, 113,  54,  97,  41, },
-};
-#elif 1
-// tries to correct a gamma of 2.0
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{  0, 124,   8, 193,   0, 140,  12, 213, },
-{ 55,  14, 104,  42,  66,  19, 119,  52, },
-{  3, 168,   1, 145,   6, 187,   3, 162, },
-{ 86,  31,  70,  21,  99,  39,  82,  28, },
-{  0, 134,  11, 206,   0, 129,   9, 200, },
-{ 62,  17, 114,  48,  58,  16, 109,  45, },
-{  5, 181,   2, 157,   4, 175,   1, 151, },
-{ 95,  36,  78,  26,  90,  34,  74,  24, },
-};
-#else
-// tries to correct a gamma of 2.5
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{  0, 107,   3, 187,   0, 125,   6, 212, },
-{ 39,   7,  86,  28,  49,  11, 102,  36, },
-{  1, 158,   0, 131,   3, 180,   1, 151, },
-{ 68,  19,  52,  12,  81,  25,  64,  17, },
-{  0, 119,   5, 203,   0, 113,   4, 195, },
-{ 45,   9,  96,  33,  42,   8,  91,  30, },
-{  2, 172,   1, 144,   2, 165,   0, 137, },
-{ 77,  23,  60,  15,  72,  21,  56,  14, },
-};
-#endif
-
-static av_always_inline void yuv2yuvX16inC_template(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                                    const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                                                    const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest,
-                                                    int dstW, int chrDstW, int big_endian)
-{
-    //FIXME Optimize (just quickly written not optimized..)
-    int i;
-
-    for (i = 0; i < dstW; i++) {
-        int val = 1 << 10;
-        int j;
-
-        for (j = 0; j < lumFilterSize; j++)
-            val += lumSrc[j][i] * lumFilter[j];
-
-        if (big_endian) {
-            AV_WB16(&dest[i], av_clip_uint16(val >> 11));
-        } else {
-            AV_WL16(&dest[i], av_clip_uint16(val >> 11));
-        }
-    }
-
-    if (uDest) {
-        for (i = 0; i < chrDstW; i++) {
-            int u = 1 << 10;
-            int v = 1 << 10;
-            int j;
-
-            for (j = 0; j < chrFilterSize; j++) {
-                u += chrSrc[j][i       ] * chrFilter[j];
-                v += chrSrc[j][i + VOFW] * chrFilter[j];
-            }
-
-            if (big_endian) {
-                AV_WB16(&uDest[i], av_clip_uint16(u >> 11));
-                AV_WB16(&vDest[i], av_clip_uint16(v >> 11));
-            } else {
-                AV_WL16(&uDest[i], av_clip_uint16(u >> 11));
-                AV_WL16(&vDest[i], av_clip_uint16(v >> 11));
-            }
-        }
-    }
-
-    if (CONFIG_SWSCALE_ALPHA && aDest) {
-        for (i = 0; i < dstW; i++) {
-            int val = 1 << 10;
-            int j;
-
-            for (j = 0; j < lumFilterSize; j++)
-                val += alpSrc[j][i] * lumFilter[j];
-
-            if (big_endian) {
-                AV_WB16(&aDest[i], av_clip_uint16(val >> 11));
-            } else {
-                AV_WL16(&aDest[i], av_clip_uint16(val >> 11));
-            }
-        }
-    }
-}
-
-static inline void yuv2yuvX16inC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                 const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                                 const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, int dstW, int chrDstW,
-                                 enum PixelFormat dstFormat)
-{
-    if (isBE(dstFormat)) {
-        yuv2yuvX16inC_template(lumFilter, lumSrc, lumFilterSize,
-                               chrFilter, chrSrc, chrFilterSize,
-                               alpSrc,
-                               dest, uDest, vDest, aDest,
-                               dstW, chrDstW, 1);
-    } else {
-        yuv2yuvX16inC_template(lumFilter, lumSrc, lumFilterSize,
-                               chrFilter, chrSrc, chrFilterSize,
-                               alpSrc,
-                               dest, uDest, vDest, aDest,
-                               dstW, chrDstW, 0);
-    }
-}
-
-static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                               const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                               const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW)
-{
-    //FIXME Optimize (just quickly written not optimized..)
-    int i;
-    for (i=0; i<dstW; i++) {
-        int val=1<<18;
-        int j;
-        for (j=0; j<lumFilterSize; j++)
-            val += lumSrc[j][i] * lumFilter[j];
-
-        dest[i]= av_clip_uint8(val>>19);
-    }
-
-    if (uDest)
-        for (i=0; i<chrDstW; i++) {
-            int u=1<<18;
-            int v=1<<18;
-            int j;
-            for (j=0; j<chrFilterSize; j++) {
-                u += chrSrc[j][i] * chrFilter[j];
-                v += chrSrc[j][i + VOFW] * chrFilter[j];
-            }
-
-            uDest[i]= av_clip_uint8(u>>19);
-            vDest[i]= av_clip_uint8(v>>19);
-        }
-
-    if (CONFIG_SWSCALE_ALPHA && aDest)
-        for (i=0; i<dstW; i++) {
-            int val=1<<18;
-            int j;
-            for (j=0; j<lumFilterSize; j++)
-                val += alpSrc[j][i] * lumFilter[j];
-
-            aDest[i]= av_clip_uint8(val>>19);
-        }
-
-}
-
-static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                                uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
-{
-    //FIXME Optimize (just quickly written not optimized..)
-    int i;
-    for (i=0; i<dstW; i++) {
-        int val=1<<18;
-        int j;
-        for (j=0; j<lumFilterSize; j++)
-            val += lumSrc[j][i] * lumFilter[j];
-
-        dest[i]= av_clip_uint8(val>>19);
-    }
-
-    if (!uDest)
-        return;
-
-    if (dstFormat == PIX_FMT_NV12)
-        for (i=0; i<chrDstW; i++) {
-            int u=1<<18;
-            int v=1<<18;
-            int j;
-            for (j=0; j<chrFilterSize; j++) {
-                u += chrSrc[j][i] * chrFilter[j];
-                v += chrSrc[j][i + VOFW] * chrFilter[j];
-            }
-
-            uDest[2*i]= av_clip_uint8(u>>19);
-            uDest[2*i+1]= av_clip_uint8(v>>19);
-        }
-    else
-        for (i=0; i<chrDstW; i++) {
-            int u=1<<18;
-            int v=1<<18;
-            int j;
-            for (j=0; j<chrFilterSize; j++) {
-                u += chrSrc[j][i] * chrFilter[j];
-                v += chrSrc[j][i + VOFW] * chrFilter[j];
-            }
-
-            uDest[2*i]= av_clip_uint8(v>>19);
-            uDest[2*i+1]= av_clip_uint8(u>>19);
-        }
-}
-
-#define YSCALE_YUV_2_PACKEDX_NOCLIP_C(type,alpha) \
-    for (i=0; i<(dstW>>1); i++) {\
-        int j;\
-        int Y1 = 1<<18;\
-        int Y2 = 1<<18;\
-        int U  = 1<<18;\
-        int V  = 1<<18;\
-        int av_unused A1, A2;\
-        type av_unused *r, *b, *g;\
-        const int i2= 2*i;\
-        \
-        for (j=0; j<lumFilterSize; j++) {\
-            Y1 += lumSrc[j][i2] * lumFilter[j];\
-            Y2 += lumSrc[j][i2+1] * lumFilter[j];\
-        }\
-        for (j=0; j<chrFilterSize; j++) {\
-            U += chrSrc[j][i] * chrFilter[j];\
-            V += chrSrc[j][i+VOFW] * chrFilter[j];\
-        }\
-        Y1>>=19;\
-        Y2>>=19;\
-        U >>=19;\
-        V >>=19;\
-        if (alpha) {\
-            A1 = 1<<18;\
-            A2 = 1<<18;\
-            for (j=0; j<lumFilterSize; j++) {\
-                A1 += alpSrc[j][i2  ] * lumFilter[j];\
-                A2 += alpSrc[j][i2+1] * lumFilter[j];\
-            }\
-            A1>>=19;\
-            A2>>=19;\
-        }
-
-#define YSCALE_YUV_2_PACKEDX_C(type,alpha) \
-        YSCALE_YUV_2_PACKEDX_NOCLIP_C(type,alpha)\
-        if ((Y1|Y2|U|V)&256) {\
-            if (Y1>255)   Y1=255; \
-            else if (Y1<0)Y1=0;   \
-            if (Y2>255)   Y2=255; \
-            else if (Y2<0)Y2=0;   \
-            if (U>255)    U=255;  \
-            else if (U<0) U=0;    \
-            if (V>255)    V=255;  \
-            else if (V<0) V=0;    \
-        }\
-        if (alpha && ((A1|A2)&256)) {\
-            A1=av_clip_uint8(A1);\
-            A2=av_clip_uint8(A2);\
-        }
-
-#define YSCALE_YUV_2_PACKEDX_FULL_C(rnd,alpha) \
-    for (i=0; i<dstW; i++) {\
-        int j;\
-        int Y = 0;\
-        int U = -128<<19;\
-        int V = -128<<19;\
-        int av_unused A;\
-        int R,G,B;\
-        \
-        for (j=0; j<lumFilterSize; j++) {\
-            Y += lumSrc[j][i     ] * lumFilter[j];\
-        }\
-        for (j=0; j<chrFilterSize; j++) {\
-            U += chrSrc[j][i     ] * chrFilter[j];\
-            V += chrSrc[j][i+VOFW] * chrFilter[j];\
-        }\
-        Y >>=10;\
-        U >>=10;\
-        V >>=10;\
-        if (alpha) {\
-            A = rnd;\
-            for (j=0; j<lumFilterSize; j++)\
-                A += alpSrc[j][i     ] * lumFilter[j];\
-            A >>=19;\
-            if (A&256)\
-                A = av_clip_uint8(A);\
-        }
-
-#define YSCALE_YUV_2_RGBX_FULL_C(rnd,alpha) \
-    YSCALE_YUV_2_PACKEDX_FULL_C(rnd>>3,alpha)\
-        Y-= c->yuv2rgb_y_offset;\
-        Y*= c->yuv2rgb_y_coeff;\
-        Y+= rnd;\
-        R= Y + V*c->yuv2rgb_v2r_coeff;\
-        G= Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;\
-        B= Y +                          U*c->yuv2rgb_u2b_coeff;\
-        if ((R|G|B)&(0xC0000000)) {\
-            if (R>=(256<<22))   R=(256<<22)-1; \
-            else if (R<0)R=0;   \
-            if (G>=(256<<22))   G=(256<<22)-1; \
-            else if (G<0)G=0;   \
-            if (B>=(256<<22))   B=(256<<22)-1; \
-            else if (B<0)B=0;   \
-        }
-
-#define YSCALE_YUV_2_GRAY16_C \
-    for (i=0; i<(dstW>>1); i++) {\
-        int j;\
-        int Y1 = 1<<18;\
-        int Y2 = 1<<18;\
-        int U  = 1<<18;\
-        int V  = 1<<18;\
-        \
-        const int i2= 2*i;\
-        \
-        for (j=0; j<lumFilterSize; j++) {\
-            Y1 += lumSrc[j][i2] * lumFilter[j];\
-            Y2 += lumSrc[j][i2+1] * lumFilter[j];\
-        }\
-        Y1>>=11;\
-        Y2>>=11;\
-        if ((Y1|Y2|U|V)&65536) {\
-            if (Y1>65535)   Y1=65535; \
-            else if (Y1<0)Y1=0;   \
-            if (Y2>65535)   Y2=65535; \
-            else if (Y2<0)Y2=0;   \
-        }
-
-#define YSCALE_YUV_2_RGBX_C(type,alpha) \
-    YSCALE_YUV_2_PACKEDX_C(type,alpha)  /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/\
-    r = (type *)c->table_rV[V];   \
-    g = (type *)(c->table_gU[U] + c->table_gV[V]); \
-    b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_PACKED2_C(type,alpha)   \
-    for (i=0; i<(dstW>>1); i++) { \
-        const int i2= 2*i;       \
-        int Y1= (buf0[i2  ]*yalpha1+buf1[i2  ]*yalpha)>>19;           \
-        int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19;           \
-        int U= (uvbuf0[i     ]*uvalpha1+uvbuf1[i     ]*uvalpha)>>19;  \
-        int V= (uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19;  \
-        type av_unused *r, *b, *g;                                    \
-        int av_unused A1, A2;                                         \
-        if (alpha) {\
-            A1= (abuf0[i2  ]*yalpha1+abuf1[i2  ]*yalpha)>>19;         \
-            A2= (abuf0[i2+1]*yalpha1+abuf1[i2+1]*yalpha)>>19;         \
-        }
-
-#define YSCALE_YUV_2_GRAY16_2_C   \
-    for (i=0; i<(dstW>>1); i++) { \
-        const int i2= 2*i;       \
-        int Y1= (buf0[i2  ]*yalpha1+buf1[i2  ]*yalpha)>>11;           \
-        int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>11;
-
-#define YSCALE_YUV_2_RGB2_C(type,alpha) \
-    YSCALE_YUV_2_PACKED2_C(type,alpha)\
-    r = (type *)c->table_rV[V];\
-    g = (type *)(c->table_gU[U] + c->table_gV[V]);\
-    b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_PACKED1_C(type,alpha) \
-    for (i=0; i<(dstW>>1); i++) {\
-        const int i2= 2*i;\
-        int Y1= buf0[i2  ]>>7;\
-        int Y2= buf0[i2+1]>>7;\
-        int U= (uvbuf1[i     ])>>7;\
-        int V= (uvbuf1[i+VOFW])>>7;\
-        type av_unused *r, *b, *g;\
-        int av_unused A1, A2;\
-        if (alpha) {\
-            A1= abuf0[i2  ]>>7;\
-            A2= abuf0[i2+1]>>7;\
-        }
-
-#define YSCALE_YUV_2_GRAY16_1_C \
-    for (i=0; i<(dstW>>1); i++) {\
-        const int i2= 2*i;\
-        int Y1= buf0[i2  ]<<1;\
-        int Y2= buf0[i2+1]<<1;
-
-#define YSCALE_YUV_2_RGB1_C(type,alpha) \
-    YSCALE_YUV_2_PACKED1_C(type,alpha)\
-    r = (type *)c->table_rV[V];\
-    g = (type *)(c->table_gU[U] + c->table_gV[V]);\
-    b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_PACKED1B_C(type,alpha) \
-    for (i=0; i<(dstW>>1); i++) {\
-        const int i2= 2*i;\
-        int Y1= buf0[i2  ]>>7;\
-        int Y2= buf0[i2+1]>>7;\
-        int U= (uvbuf0[i     ] + uvbuf1[i     ])>>8;\
-        int V= (uvbuf0[i+VOFW] + uvbuf1[i+VOFW])>>8;\
-        type av_unused *r, *b, *g;\
-        int av_unused A1, A2;\
-        if (alpha) {\
-            A1= abuf0[i2  ]>>7;\
-            A2= abuf0[i2+1]>>7;\
-        }
-
-#define YSCALE_YUV_2_RGB1B_C(type,alpha) \
-    YSCALE_YUV_2_PACKED1B_C(type,alpha)\
-    r = (type *)c->table_rV[V];\
-    g = (type *)(c->table_gU[U] + c->table_gV[V]);\
-    b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_MONO2_C \
-    const uint8_t * const d128=dither_8x8_220[y&7];\
-    uint8_t *g= c->table_gU[128] + c->table_gV[128];\
-    for (i=0; i<dstW-7; i+=8) {\
-        int acc;\
-        acc =       g[((buf0[i  ]*yalpha1+buf1[i  ]*yalpha)>>19) + d128[0]];\
-        acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\
-        acc+= acc + g[((buf0[i+2]*yalpha1+buf1[i+2]*yalpha)>>19) + d128[2]];\
-        acc+= acc + g[((buf0[i+3]*yalpha1+buf1[i+3]*yalpha)>>19) + d128[3]];\
-        acc+= acc + g[((buf0[i+4]*yalpha1+buf1[i+4]*yalpha)>>19) + d128[4]];\
-        acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\
-        acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\
-        acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\
-        ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
-        dest++;\
-    }
-
-#define YSCALE_YUV_2_MONOX_C \
-    const uint8_t * const d128=dither_8x8_220[y&7];\
-    uint8_t *g= c->table_gU[128] + c->table_gV[128];\
-    int acc=0;\
-    for (i=0; i<dstW-1; i+=2) {\
-        int j;\
-        int Y1=1<<18;\
-        int Y2=1<<18;\
-\
-        for (j=0; j<lumFilterSize; j++) {\
-            Y1 += lumSrc[j][i] * lumFilter[j];\
-            Y2 += lumSrc[j][i+1] * lumFilter[j];\
-        }\
-        Y1>>=19;\
-        Y2>>=19;\
-        if ((Y1|Y2)&256) {\
-            if (Y1>255)   Y1=255;\
-            else if (Y1<0)Y1=0;\
-            if (Y2>255)   Y2=255;\
-            else if (Y2<0)Y2=0;\
-        }\
-        acc+= acc + g[Y1+d128[(i+0)&7]];\
-        acc+= acc + g[Y2+d128[(i+1)&7]];\
-        if ((i&7)==6) {\
-            ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
-            dest++;\
-        }\
-    }
-
-#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16, func_monoblack)\
-    switch(c->dstFormat) {\
-    case PIX_FMT_RGB48BE:\
-    case PIX_FMT_RGB48LE:\
-        func(uint8_t,0)\
-            ((uint8_t*)dest)[ 0]= r[Y1];\
-            ((uint8_t*)dest)[ 1]= r[Y1];\
-            ((uint8_t*)dest)[ 2]= g[Y1];\
-            ((uint8_t*)dest)[ 3]= g[Y1];\
-            ((uint8_t*)dest)[ 4]= b[Y1];\
-            ((uint8_t*)dest)[ 5]= b[Y1];\
-            ((uint8_t*)dest)[ 6]= r[Y2];\
-            ((uint8_t*)dest)[ 7]= r[Y2];\
-            ((uint8_t*)dest)[ 8]= g[Y2];\
-            ((uint8_t*)dest)[ 9]= g[Y2];\
-            ((uint8_t*)dest)[10]= b[Y2];\
-            ((uint8_t*)dest)[11]= b[Y2];\
-            dest+=12;\
-        }\
-        break;\
-    case PIX_FMT_RGBA:\
-    case PIX_FMT_BGRA:\
-        if (CONFIG_SMALL) {\
-            int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;\
-            func(uint32_t,needAlpha)\
-                ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (needAlpha ? (A1<<24) : 0);\
-                ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (needAlpha ? (A2<<24) : 0);\
-            }\
-        } else {\
-            if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {\
-                func(uint32_t,1)\
-                    ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (A1<<24);\
-                    ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (A2<<24);\
-                }\
-            } else {\
-                func(uint32_t,0)\
-                    ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];\
-                    ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];\
-                }\
-            }\
-        }\
-        break;\
-    case PIX_FMT_ARGB:\
-    case PIX_FMT_ABGR:\
-        if (CONFIG_SMALL) {\
-            int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;\
-            func(uint32_t,needAlpha)\
-                ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (needAlpha ? A1 : 0);\
-                ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (needAlpha ? A2 : 0);\
-            }\
-        } else {\
-            if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {\
-                func(uint32_t,1)\
-                    ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + A1;\
-                    ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + A2;\
-                }\
-            } else {\
-                func(uint32_t,0)\
-                    ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];\
-                    ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];\
-                }\
-            }\
-        }                \
-        break;\
-    case PIX_FMT_RGB24:\
-        func(uint8_t,0)\
-            ((uint8_t*)dest)[0]= r[Y1];\
-            ((uint8_t*)dest)[1]= g[Y1];\
-            ((uint8_t*)dest)[2]= b[Y1];\
-            ((uint8_t*)dest)[3]= r[Y2];\
-            ((uint8_t*)dest)[4]= g[Y2];\
-            ((uint8_t*)dest)[5]= b[Y2];\
-            dest+=6;\
-        }\
-        break;\
-    case PIX_FMT_BGR24:\
-        func(uint8_t,0)\
-            ((uint8_t*)dest)[0]= b[Y1];\
-            ((uint8_t*)dest)[1]= g[Y1];\
-            ((uint8_t*)dest)[2]= r[Y1];\
-            ((uint8_t*)dest)[3]= b[Y2];\
-            ((uint8_t*)dest)[4]= g[Y2];\
-            ((uint8_t*)dest)[5]= r[Y2];\
-            dest+=6;\
-        }\
-        break;\
-    case PIX_FMT_RGB565BE:\
-    case PIX_FMT_RGB565LE:\
-    case PIX_FMT_BGR565BE:\
-    case PIX_FMT_BGR565LE:\
-        {\
-            const int dr1= dither_2x2_8[y&1    ][0];\
-            const int dg1= dither_2x2_4[y&1    ][0];\
-            const int db1= dither_2x2_8[(y&1)^1][0];\
-            const int dr2= dither_2x2_8[y&1    ][1];\
-            const int dg2= dither_2x2_4[y&1    ][1];\
-            const int db2= dither_2x2_8[(y&1)^1][1];\
-            func(uint16_t,0)\
-                ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];\
-                ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];\
-            }\
-        }\
-        break;\
-    case PIX_FMT_RGB555BE:\
-    case PIX_FMT_RGB555LE:\
-    case PIX_FMT_BGR555BE:\
-    case PIX_FMT_BGR555LE:\
-        {\
-            const int dr1= dither_2x2_8[y&1    ][0];\
-            const int dg1= dither_2x2_8[y&1    ][1];\
-            const int db1= dither_2x2_8[(y&1)^1][0];\
-            const int dr2= dither_2x2_8[y&1    ][1];\
-            const int dg2= dither_2x2_8[y&1    ][0];\
-            const int db2= dither_2x2_8[(y&1)^1][1];\
-            func(uint16_t,0)\
-                ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];\
-                ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];\
-            }\
-        }\
-        break;\
-    case PIX_FMT_RGB444BE:\
-    case PIX_FMT_RGB444LE:\
-    case PIX_FMT_BGR444BE:\
-    case PIX_FMT_BGR444LE:\
-        {\
-            const int dr1= dither_4x4_16[y&3    ][0];\
-            const int dg1= dither_4x4_16[y&3    ][1];\
-            const int db1= dither_4x4_16[(y&3)^3][0];\
-            const int dr2= dither_4x4_16[y&3    ][1];\
-            const int dg2= dither_4x4_16[y&3    ][0];\
-            const int db2= dither_4x4_16[(y&3)^3][1];\
-            func(uint16_t,0)\
-                ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];\
-                ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];\
-            }\
-        }\
-        break;\
-    case PIX_FMT_RGB8:\
-    case PIX_FMT_BGR8:\
-        {\
-            const uint8_t * const d64= dither_8x8_73[y&7];\
-            const uint8_t * const d32= dither_8x8_32[y&7];\
-            func(uint8_t,0)\
-                ((uint8_t*)dest)[i2+0]= r[Y1+d32[(i2+0)&7]] + g[Y1+d32[(i2+0)&7]] + b[Y1+d64[(i2+0)&7]];\
-                ((uint8_t*)dest)[i2+1]= r[Y2+d32[(i2+1)&7]] + g[Y2+d32[(i2+1)&7]] + b[Y2+d64[(i2+1)&7]];\
-            }\
-        }\
-        break;\
-    case PIX_FMT_RGB4:\
-    case PIX_FMT_BGR4:\
-        {\
-            const uint8_t * const d64= dither_8x8_73 [y&7];\
-            const uint8_t * const d128=dither_8x8_220[y&7];\
-            func(uint8_t,0)\
-                ((uint8_t*)dest)[i]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]]\
-                                 + ((r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]])<<4);\
-            }\
-        }\
-        break;\
-    case PIX_FMT_RGB4_BYTE:\
-    case PIX_FMT_BGR4_BYTE:\
-        {\
-            const uint8_t * const d64= dither_8x8_73 [y&7];\
-            const uint8_t * const d128=dither_8x8_220[y&7];\
-            func(uint8_t,0)\
-                ((uint8_t*)dest)[i2+0]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]];\
-                ((uint8_t*)dest)[i2+1]= r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]];\
-            }\
-        }\
-        break;\
-    case PIX_FMT_MONOBLACK:\
-    case PIX_FMT_MONOWHITE:\
-        {\
-            func_monoblack\
-        }\
-        break;\
-    case PIX_FMT_YUYV422:\
-        func2\
-            ((uint8_t*)dest)[2*i2+0]= Y1;\
-            ((uint8_t*)dest)[2*i2+1]= U;\
-            ((uint8_t*)dest)[2*i2+2]= Y2;\
-            ((uint8_t*)dest)[2*i2+3]= V;\
-        }                \
-        break;\
-    case PIX_FMT_UYVY422:\
-        func2\
-            ((uint8_t*)dest)[2*i2+0]= U;\
-            ((uint8_t*)dest)[2*i2+1]= Y1;\
-            ((uint8_t*)dest)[2*i2+2]= V;\
-            ((uint8_t*)dest)[2*i2+3]= Y2;\
-        }                \
-        break;\
-    case PIX_FMT_GRAY16BE:\
-        func_g16\
-            ((uint8_t*)dest)[2*i2+0]= Y1>>8;\
-            ((uint8_t*)dest)[2*i2+1]= Y1;\
-            ((uint8_t*)dest)[2*i2+2]= Y2>>8;\
-            ((uint8_t*)dest)[2*i2+3]= Y2;\
-        }                \
-        break;\
-    case PIX_FMT_GRAY16LE:\
-        func_g16\
-            ((uint8_t*)dest)[2*i2+0]= Y1;\
-            ((uint8_t*)dest)[2*i2+1]= Y1>>8;\
-            ((uint8_t*)dest)[2*i2+2]= Y2;\
-            ((uint8_t*)dest)[2*i2+3]= Y2>>8;\
-        }                \
-        break;\
-    }
-
-static inline void yuv2packedXinC(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                  const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                                  const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
-{
-    int i;
-    YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void,0), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOX_C)
-}
-
-static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                    const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                                    const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
-{
-    int i;
-    int step= c->dstFormatBpp/8;
-    int aidx= 3;
-
-    switch(c->dstFormat) {
-    case PIX_FMT_ARGB:
-        dest++;
-        aidx= 0;
-    case PIX_FMT_RGB24:
-        aidx--;
-    case PIX_FMT_RGBA:
-        if (CONFIG_SMALL) {
-            int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;
-            YSCALE_YUV_2_RGBX_FULL_C(1<<21, needAlpha)
-                dest[aidx]= needAlpha ? A : 255;
-                dest[0]= R>>22;
-                dest[1]= G>>22;
-                dest[2]= B>>22;
-                dest+= step;
-            }
-        } else {
-            if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-                YSCALE_YUV_2_RGBX_FULL_C(1<<21, 1)
-                    dest[aidx]= A;
-                    dest[0]= R>>22;
-                    dest[1]= G>>22;
-                    dest[2]= B>>22;
-                    dest+= step;
-                }
-            } else {
-                YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
-                    dest[aidx]= 255;
-                    dest[0]= R>>22;
-                    dest[1]= G>>22;
-                    dest[2]= B>>22;
-                    dest+= step;
-                }
-            }
-        }
-        break;
-    case PIX_FMT_ABGR:
-        dest++;
-        aidx= 0;
-    case PIX_FMT_BGR24:
-        aidx--;
-    case PIX_FMT_BGRA:
-        if (CONFIG_SMALL) {
-            int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;
-            YSCALE_YUV_2_RGBX_FULL_C(1<<21, needAlpha)
-                dest[aidx]= needAlpha ? A : 255;
-                dest[0]= B>>22;
-                dest[1]= G>>22;
-                dest[2]= R>>22;
-                dest+= step;
-            }
-        } else {
-            if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-                YSCALE_YUV_2_RGBX_FULL_C(1<<21, 1)
-                    dest[aidx]= A;
-                    dest[0]= B>>22;
-                    dest[1]= G>>22;
-                    dest[2]= R>>22;
-                    dest+= step;
-                }
-            } else {
-                YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
-                    dest[aidx]= 255;
-                    dest[0]= B>>22;
-                    dest[1]= G>>22;
-                    dest[2]= R>>22;
-                    dest+= step;
-                }
-            }
-        }
-        break;
-    default:
-        assert(0);
-    }
-}
-
-static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, uint8_t val)
-{
-    int i;
-    uint8_t *ptr = plane + stride*y;
-    for (i=0; i<height; i++) {
-        memset(ptr, val, width);
-        ptr += stride;
-    }
-}
-
-static inline void rgb48ToY(uint8_t *dst, const uint8_t *src, int width,
-                            uint32_t *unused)
-{
-    int i;
-    for (i = 0; i < width; i++) {
-        int r = src[i*6+0];
-        int g = src[i*6+2];
-        int b = src[i*6+4];
-
-        dst[i] = (RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
-    }
-}
-
-static inline void rgb48ToUV(uint8_t *dstU, uint8_t *dstV,
-                             const uint8_t *src1, const uint8_t *src2,
-                             int width, uint32_t *unused)
-{
-    int i;
-    assert(src1==src2);
-    for (i = 0; i < width; i++) {
-        int r = src1[6*i + 0];
-        int g = src1[6*i + 2];
-        int b = src1[6*i + 4];
-
-        dstU[i] = (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
-        dstV[i] = (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
-    }
-}
-
-static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV,
-                                  const uint8_t *src1, const uint8_t *src2,
-                                  int width, uint32_t *unused)
-{
-    int i;
-    assert(src1==src2);
-    for (i = 0; i < width; i++) {
-        int r= src1[12*i + 0] + src1[12*i + 6];
-        int g= src1[12*i + 2] + src1[12*i + 8];
-        int b= src1[12*i + 4] + src1[12*i + 10];
-
-        dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);
-        dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);
-    }
-}
-
-#define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)\
-static inline void name(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)\
-{\
-    int i;\
-    for (i=0; i<width; i++) {\
-        int b= (((const type*)src)[i]>>shb)&maskb;\
-        int g= (((const type*)src)[i]>>shg)&maskg;\
-        int r= (((const type*)src)[i]>>shr)&maskr;\
-\
-        dst[i]= (((RY)*r + (GY)*g + (BY)*b + (33<<((S)-1)))>>(S));\
-    }\
-}
-
-BGR2Y(uint32_t, bgr32ToY,16, 0, 0, 0x00FF, 0xFF00, 0x00FF, RY<< 8, GY   , BY<< 8, RGB2YUV_SHIFT+8)
-BGR2Y(uint32_t, rgb32ToY, 0, 0,16, 0x00FF, 0xFF00, 0x00FF, RY<< 8, GY   , BY<< 8, RGB2YUV_SHIFT+8)
-BGR2Y(uint16_t, bgr16ToY, 0, 0, 0, 0x001F, 0x07E0, 0xF800, RY<<11, GY<<5, BY    , RGB2YUV_SHIFT+8)
-BGR2Y(uint16_t, bgr15ToY, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, RY<<10, GY<<5, BY    , RGB2YUV_SHIFT+7)
-BGR2Y(uint16_t, rgb16ToY, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RY    , GY<<5, BY<<11, RGB2YUV_SHIFT+8)
-BGR2Y(uint16_t, rgb15ToY, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RY    , GY<<5, BY<<10, RGB2YUV_SHIFT+7)
-
-static inline void abgrToA(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-    int i;
-    for (i=0; i<width; i++) {
-        dst[i]= src[4*i];
-    }
-}
-
-#define BGR2UV(type, name, shr, shg, shb, maska, maskr, maskg, maskb, RU, GU, BU, RV, GV, BV, S)\
-static inline void name(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\
-{\
-    int i;\
-    for (i=0; i<width; i++) {\
-        int b= (((const type*)src)[i]&maskb)>>shb;\
-        int g= (((const type*)src)[i]&maskg)>>shg;\
-        int r= (((const type*)src)[i]&maskr)>>shr;\
-\
-        dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<((S)-1)))>>(S);\
-        dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<((S)-1)))>>(S);\
-    }\
-}\
-static inline void name ## _half(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\
-{\
-    int i;\
-    for (i=0; i<width; i++) {\
-        int pix0= ((const type*)src)[2*i+0];\
-        int pix1= ((const type*)src)[2*i+1];\
-        int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\
-        int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\
-        int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\
-        g&= maskg|(2*maskg);\
-\
-        g>>=shg;\
-\
-        dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<(S)))>>((S)+1);\
-        dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<(S)))>>((S)+1);\
-    }\
-}
-
-BGR2UV(uint32_t, bgr32ToUV,16, 0, 0, 0xFF000000, 0xFF0000, 0xFF00,   0x00FF, RU<< 8, GU   , BU<< 8, RV<< 8, GV   , BV<< 8, RGB2YUV_SHIFT+8)
-BGR2UV(uint32_t, rgb32ToUV, 0, 0,16, 0xFF000000,   0x00FF, 0xFF00, 0xFF0000, RU<< 8, GU   , BU<< 8, RV<< 8, GV   , BV<< 8, RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, bgr16ToUV, 0, 0, 0,          0,   0x001F, 0x07E0,   0xF800, RU<<11, GU<<5, BU    , RV<<11, GV<<5, BV    , RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, bgr15ToUV, 0, 0, 0,          0,   0x001F, 0x03E0,   0x7C00, RU<<10, GU<<5, BU    , RV<<10, GV<<5, BV    , RGB2YUV_SHIFT+7)
-BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0,          0,   0xF800, 0x07E0,   0x001F, RU    , GU<<5, BU<<11, RV    , GV<<5, BV<<11, RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0,          0,   0x7C00, 0x03E0,   0x001F, RU    , GU<<5, BU<<10, RV    , GV<<5, BV<<10, RGB2YUV_SHIFT+7)
-
-static inline void palToY(uint8_t *dst, const uint8_t *src, long width, uint32_t *pal)
-{
-    int i;
-    for (i=0; i<width; i++) {
-        int d= src[i];
-
-        dst[i]= pal[d] & 0xFF;
-    }
-}
-
-static inline void palToUV(uint8_t *dstU, uint8_t *dstV,
-                           const uint8_t *src1, const uint8_t *src2,
-                           long width, uint32_t *pal)
-{
-    int i;
-    assert(src1 == src2);
-    for (i=0; i<width; i++) {
-        int p= pal[src1[i]];
-
-        dstU[i]= p>>8;
-        dstV[i]= p>>16;
-    }
-}
-
-static inline void monowhite2Y(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-    int i, j;
-    for (i=0; i<width/8; i++) {
-        int d= ~src[i];
-        for(j=0; j<8; j++)
-            dst[8*i+j]= ((d>>(7-j))&1)*255;
-    }
-}
-
-static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-    int i, j;
-    for (i=0; i<width/8; i++) {
-        int d= src[i];
-        for(j=0; j<8; j++)
-            dst[8*i+j]= ((d>>(7-j))&1)*255;
-    }
-}
-
-//Note: we have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
-//Plain C versions
-#if (!HAVE_MMX && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_C
-#endif
-
-#if ARCH_PPC
-#if HAVE_ALTIVEC
-#define COMPILE_ALTIVEC
-#endif
-#endif //ARCH_PPC
-
-#if ARCH_X86
-
-#if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_MMX
-#endif
-
-#if HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_MMX2
-#endif
-
-#if (HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_3DNOW
-#endif
-#endif //ARCH_X86
-
-#define COMPILE_TEMPLATE_MMX 0
-#define COMPILE_TEMPLATE_MMX2 0
-#define COMPILE_TEMPLATE_AMD3DNOW 0
-#define COMPILE_TEMPLATE_ALTIVEC 0
-
-#ifdef COMPILE_C
-#define RENAME(a) a ## _C
-#include "swscale_template.c"
-#endif
-
-#ifdef COMPILE_ALTIVEC
-#undef RENAME
-#undef COMPILE_TEMPLATE_ALTIVEC
-#define COMPILE_TEMPLATE_ALTIVEC 1
-#define RENAME(a) a ## _altivec
-#include "swscale_template.c"
-#endif
-
-#if ARCH_X86
-
-//MMX versions
-#ifdef COMPILE_MMX
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX
-#undef COMPILE_TEMPLATE_MMX2
-#undef COMPILE_TEMPLATE_AMD3DNOW
-#define COMPILE_TEMPLATE_MMX 1
-#define COMPILE_TEMPLATE_MMX2 0
-#define COMPILE_TEMPLATE_AMD3DNOW 0
-#define RENAME(a) a ## _MMX
-#include "swscale_template.c"
-#endif
-
-//MMX2 versions
-#ifdef COMPILE_MMX2
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX
-#undef COMPILE_TEMPLATE_MMX2
-#undef COMPILE_TEMPLATE_AMD3DNOW
-#define COMPILE_TEMPLATE_MMX 1
-#define COMPILE_TEMPLATE_MMX2 1
-#define COMPILE_TEMPLATE_AMD3DNOW 0
-#define RENAME(a) a ## _MMX2
-#include "swscale_template.c"
-#endif
-
-//3DNOW versions
-#ifdef COMPILE_3DNOW
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX
-#undef COMPILE_TEMPLATE_MMX2
-#undef COMPILE_TEMPLATE_AMD3DNOW
-#define COMPILE_TEMPLATE_MMX 1
-#define COMPILE_TEMPLATE_MMX2 0
-#define COMPILE_TEMPLATE_AMD3DNOW 1
-#define RENAME(a) a ## _3DNow
-#include "swscale_template.c"
-#endif
-
-#endif //ARCH_X86
-
-SwsFunc ff_getSwsFunc(SwsContext *c)
-{
-#if CONFIG_RUNTIME_CPUDETECT
-    int flags = c->flags;
-
-#if ARCH_X86
-    // ordered per speed fastest first
-    if (flags & SWS_CPU_CAPS_MMX2) {
-        sws_init_swScale_MMX2(c);
-        return swScale_MMX2;
-    } else if (flags & SWS_CPU_CAPS_3DNOW) {
-        sws_init_swScale_3DNow(c);
-        return swScale_3DNow;
-    } else if (flags & SWS_CPU_CAPS_MMX) {
-        sws_init_swScale_MMX(c);
-        return swScale_MMX;
-    } else {
-        sws_init_swScale_C(c);
-        return swScale_C;
-    }
-
-#else
-#ifdef COMPILE_ALTIVEC
-    if (flags & SWS_CPU_CAPS_ALTIVEC) {
-        sws_init_swScale_altivec(c);
-        return swScale_altivec;
-    } else {
-        sws_init_swScale_C(c);
-        return swScale_C;
-    }
-#endif
-    sws_init_swScale_C(c);
-    return swScale_C;
-#endif /* ARCH_X86 */
-#else //CONFIG_RUNTIME_CPUDETECT
-#if   COMPILE_TEMPLATE_MMX2
-    sws_init_swScale_MMX2(c);
-    return swScale_MMX2;
-#elif COMPILE_TEMPLATE_AMD3DNOW
-    sws_init_swScale_3DNow(c);
-    return swScale_3DNow;
-#elif COMPILE_TEMPLATE_MMX
-    sws_init_swScale_MMX(c);
-    return swScale_MMX;
-#elif COMPILE_TEMPLATE_ALTIVEC
-    sws_init_swScale_altivec(c);
-    return swScale_altivec;
-#else
-    sws_init_swScale_C(c);
-    return swScale_C;
-#endif
-#endif //!CONFIG_RUNTIME_CPUDETECT
-}
-
-static int planarToNv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-    /* Copy Y plane */
-    if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
-        memcpy(dst, src[0], srcSliceH*dstStride[0]);
-    else {
-        int i;
-        const uint8_t *srcPtr= src[0];
-        uint8_t *dstPtr= dst;
-        for (i=0; i<srcSliceH; i++) {
-            memcpy(dstPtr, srcPtr, c->srcW);
-            srcPtr+= srcStride[0];
-            dstPtr+= dstStride[0];
-        }
-    }
-    dst = dstParam[1] + dstStride[1]*srcSliceY/2;
-    if (c->dstFormat == PIX_FMT_NV12)
-        interleaveBytes(src[1], src[2], dst, c->srcW/2, srcSliceH/2, srcStride[1], srcStride[2], dstStride[0]);
-    else
-        interleaveBytes(src[2], src[1], dst, c->srcW/2, srcSliceH/2, srcStride[2], srcStride[1], dstStride[0]);
-
-    return srcSliceH;
-}
-
-static int planarToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
-    yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
-
-    return srcSliceH;
-}
-
-static int planarToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
-    yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
-
-    return srcSliceH;
-}
-
-static int yuv422pToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
-    yuv422ptoyuy2(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]);
-
-    return srcSliceH;
-}
-
-static int yuv422pToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
-    yuv422ptouyvy(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]);
-
-    return srcSliceH;
-}
-
-static int yuyvToYuv420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
-    uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY/2;
-    uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY/2;
-
-    yuyvtoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
-    if (dstParam[3])
-        fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
-
-    return srcSliceH;
-}
-
-static int yuyvToYuv422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
-    uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY;
-    uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY;
-
-    yuyvtoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
-    return srcSliceH;
-}
-
-static int uyvyToYuv420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
-    uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY/2;
-    uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY/2;
-
-    uyvytoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
-    if (dstParam[3])
-        fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
-
-    return srcSliceH;
-}
-
-static int uyvyToYuv422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                               int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
-    uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
-    uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY;
-    uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY;
-
-    uyvytoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
-    return srcSliceH;
-}
-
-static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                           int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    const enum PixelFormat srcFormat= c->srcFormat;
-    const enum PixelFormat dstFormat= c->dstFormat;
-    void (*conv)(const uint8_t *src, uint8_t *dst, long num_pixels,
-                 const uint8_t *palette)=NULL;
-    int i;
-    uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
-    const uint8_t *srcPtr= src[0];
-
-    if (usePal(srcFormat)) {
-        switch (dstFormat) {
-        case PIX_FMT_RGB32  : conv = sws_convertPalette8ToPacked32; break;
-        case PIX_FMT_BGR32  : conv = sws_convertPalette8ToPacked32; break;
-        case PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break;
-        case PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break;
-        case PIX_FMT_RGB24  : conv = sws_convertPalette8ToPacked24; break;
-        case PIX_FMT_BGR24  : conv = sws_convertPalette8ToPacked24; break;
-        }
-    }
-
-    if (!conv)
-        av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
-               sws_format_name(srcFormat), sws_format_name(dstFormat));
-    else {
-        for (i=0; i<srcSliceH; i++) {
-            conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb);
-            srcPtr+= srcStride[0];
-            dstPtr+= dstStride[0];
-        }
-    }
-
-    return srcSliceH;
-}
-
-#define isRGBA32(x) (            \
-           (x) == PIX_FMT_ARGB   \
-        || (x) == PIX_FMT_RGBA   \
-        || (x) == PIX_FMT_BGRA   \
-        || (x) == PIX_FMT_ABGR   \
-        )
-
-/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
-static int rgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                           int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    const enum PixelFormat srcFormat= c->srcFormat;
-    const enum PixelFormat dstFormat= c->dstFormat;
-    const int srcBpp= (c->srcFormatBpp + 7) >> 3;
-    const int dstBpp= (c->dstFormatBpp + 7) >> 3;
-    const int srcId= c->srcFormatBpp >> 2; /* 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8 */
-    const int dstId= c->dstFormatBpp >> 2;
-    void (*conv)(const uint8_t *src, uint8_t *dst, long src_size)=NULL;
-
-#define CONV_IS(src, dst) (srcFormat == PIX_FMT_##src && dstFormat == PIX_FMT_##dst)
-
-    if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) {
-        if (     CONV_IS(ABGR, RGBA)
-              || CONV_IS(ARGB, BGRA)
-              || CONV_IS(BGRA, ARGB)
-              || CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210;
-        else if (CONV_IS(ABGR, ARGB)
-              || CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321;
-        else if (CONV_IS(ABGR, BGRA)
-              || CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230;
-        else if (CONV_IS(BGRA, RGBA)
-              || CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103;
-        else if (CONV_IS(BGRA, ABGR)
-              || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012;
-    } else
-    /* BGR -> BGR */
-    if (  (isBGRinInt(srcFormat) && isBGRinInt(dstFormat))
-       || (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
-        switch(srcId | (dstId<<4)) {
-        case 0x34: conv= rgb16to15; break;
-        case 0x36: conv= rgb24to15; break;
-        case 0x38: conv= rgb32to15; break;
-        case 0x43: conv= rgb15to16; break;
-        case 0x46: conv= rgb24to16; break;
-        case 0x48: conv= rgb32to16; break;
-        case 0x63: conv= rgb15to24; break;
-        case 0x64: conv= rgb16to24; break;
-        case 0x68: conv= rgb32to24; break;
-        case 0x83: conv= rgb15to32; break;
-        case 0x84: conv= rgb16to32; break;
-        case 0x86: conv= rgb24to32; break;
-        }
-    } else if (  (isBGRinInt(srcFormat) && isRGBinInt(dstFormat))
-             || (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
-        switch(srcId | (dstId<<4)) {
-        case 0x33: conv= rgb15tobgr15; break;
-        case 0x34: conv= rgb16tobgr15; break;
-        case 0x36: conv= rgb24tobgr15; break;
-        case 0x38: conv= rgb32tobgr15; break;
-        case 0x43: conv= rgb15tobgr16; break;
-        case 0x44: conv= rgb16tobgr16; break;
-        case 0x46: conv= rgb24tobgr16; break;
-        case 0x48: conv= rgb32tobgr16; break;
-        case 0x63: conv= rgb15tobgr24; break;
-        case 0x64: conv= rgb16tobgr24; break;
-        case 0x66: conv= rgb24tobgr24; break;
-        case 0x68: conv= rgb32tobgr24; break;
-        case 0x83: conv= rgb15tobgr32; break;
-        case 0x84: conv= rgb16tobgr32; break;
-        case 0x86: conv= rgb24tobgr32; break;
-        }
-    }
-
-    if (!conv) {
-        av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
-               sws_format_name(srcFormat), sws_format_name(dstFormat));
-    } else {
-        const uint8_t *srcPtr= src[0];
-              uint8_t *dstPtr= dst[0];
-        if ((srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1) && !isRGBA32(dstFormat))
-            srcPtr += ALT32_CORR;
-
-        if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) && !isRGBA32(srcFormat))
-            dstPtr += ALT32_CORR;
-
-        if (dstStride[0]*srcBpp == srcStride[0]*dstBpp && srcStride[0] > 0)
-            conv(srcPtr, dstPtr + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]);
-        else {
-            int i;
-            dstPtr += dstStride[0]*srcSliceY;
-
-            for (i=0; i<srcSliceH; i++) {
-                conv(srcPtr, dstPtr, c->srcW*srcBpp);
-                srcPtr+= srcStride[0];
-                dstPtr+= dstStride[0];
-            }
-        }
-    }
-    return srcSliceH;
-}
-
-static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                              int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    rgb24toyv12(
-        src[0],
-        dst[0]+ srcSliceY    *dstStride[0],
-        dst[1]+(srcSliceY>>1)*dstStride[1],
-        dst[2]+(srcSliceY>>1)*dstStride[2],
-        c->srcW, srcSliceH,
-        dstStride[0], dstStride[1], srcStride[0]);
-    if (dst[3])
-        fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
-    return srcSliceH;
-}
-
-static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                             int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int i;
-
-    /* copy Y */
-    if (srcStride[0]==dstStride[0] && srcStride[0] > 0)
-        memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
-    else {
-        const uint8_t *srcPtr= src[0];
-        uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
-
-        for (i=0; i<srcSliceH; i++) {
-            memcpy(dstPtr, srcPtr, c->srcW);
-            srcPtr+= srcStride[0];
-            dstPtr+= dstStride[0];
-        }
-    }
-
-    if (c->dstFormat==PIX_FMT_YUV420P || c->dstFormat==PIX_FMT_YUVA420P) {
-        planar2x(src[1], dst[1] + dstStride[1]*(srcSliceY >> 1), c->chrSrcW,
-                 srcSliceH >> 2, srcStride[1], dstStride[1]);
-        planar2x(src[2], dst[2] + dstStride[2]*(srcSliceY >> 1), c->chrSrcW,
-                 srcSliceH >> 2, srcStride[2], dstStride[2]);
-    } else {
-        planar2x(src[1], dst[2] + dstStride[2]*(srcSliceY >> 1), c->chrSrcW,
-                 srcSliceH >> 2, srcStride[1], dstStride[2]);
-        planar2x(src[2], dst[1] + dstStride[1]*(srcSliceY >> 1), c->chrSrcW,
-                 srcSliceH >> 2, srcStride[2], dstStride[1]);
-    }
-    if (dst[3])
-        fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
-    return srcSliceH;
-}
-
-/* unscaled copy like stuff (assumes nearly identical formats) */
-static int packedCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                             int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
-        memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);
-    else {
-        int i;
-        const uint8_t *srcPtr= src[0];
-        uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
-        int length=0;
-
-        /* universal length finder */
-        while(length+c->srcW <= FFABS(dstStride[0])
-           && length+c->srcW <= FFABS(srcStride[0])) length+= c->srcW;
-        assert(length!=0);
-
-        for (i=0; i<srcSliceH; i++) {
-            memcpy(dstPtr, srcPtr, length);
-            srcPtr+= srcStride[0];
-            dstPtr+= dstStride[0];
-        }
-    }
-    return srcSliceH;
-}
-
-static int planarCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                             int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int plane, i, j;
-    for (plane=0; plane<4; plane++) {
-        int length= (plane==0 || plane==3) ? c->srcW  : -((-c->srcW  )>>c->chrDstHSubSample);
-        int y=      (plane==0 || plane==3) ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample);
-        int height= (plane==0 || plane==3) ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample);
-        const uint8_t *srcPtr= src[plane];
-        uint8_t *dstPtr= dst[plane] + dstStride[plane]*y;
-
-        if (!dst[plane]) continue;
-        // ignore palette for GRAY8
-        if (plane == 1 && !dst[2]) continue;
-        if (!src[plane] || (plane == 1 && !src[2])) {
-            if(is16BPS(c->dstFormat))
-                length*=2;
-            fillPlane(dst[plane], dstStride[plane], length, height, y, (plane==3) ? 255 : 128);
-        } else {
-            if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) {
-                if (!isBE(c->srcFormat)) srcPtr++;
-                for (i=0; i<height; i++) {
-                    for (j=0; j<length; j++) dstPtr[j] = srcPtr[j<<1];
-                    srcPtr+= srcStride[plane];
-                    dstPtr+= dstStride[plane];
-                }
-            } else if(!is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) {
-                for (i=0; i<height; i++) {
-                    for (j=0; j<length; j++) {
-                        dstPtr[ j<<1   ] = srcPtr[j];
-                        dstPtr[(j<<1)+1] = srcPtr[j];
-                    }
-                    srcPtr+= srcStride[plane];
-                    dstPtr+= dstStride[plane];
-                }
-            } else if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)
-                  && isBE(c->srcFormat) != isBE(c->dstFormat)) {
-
-                for (i=0; i<height; i++) {
-                    for (j=0; j<length; j++)
-                        ((uint16_t*)dstPtr)[j] = bswap_16(((const uint16_t*)srcPtr)[j]);
-                    srcPtr+= srcStride[plane];
-                    dstPtr+= dstStride[plane];
-                }
-            } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0)
-                memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]);
-            else {
-                if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat))
-                    length*=2;
-                for (i=0; i<height; i++) {
-                    memcpy(dstPtr, srcPtr, length);
-                    srcPtr+= srcStride[plane];
-                    dstPtr+= dstStride[plane];
-                }
-            }
-        }
-    }
-    return srcSliceH;
-}
-
-int ff_hardcodedcpuflags(void)
-{
-    int flags = 0;
-#if   COMPILE_TEMPLATE_MMX2
-    flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
-#elif COMPILE_TEMPLATE_AMD3DNOW
-    flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW;
-#elif COMPILE_TEMPLATE_MMX
-    flags |= SWS_CPU_CAPS_MMX;
-#elif COMPILE_TEMPLATE_ALTIVEC
-    flags |= SWS_CPU_CAPS_ALTIVEC;
-#elif ARCH_BFIN
-    flags |= SWS_CPU_CAPS_BFIN;
-#endif
-    return flags;
-}
-
-void ff_get_unscaled_swscale(SwsContext *c)
-{
-    const enum PixelFormat srcFormat = c->srcFormat;
-    const enum PixelFormat dstFormat = c->dstFormat;
-    const int flags = c->flags;
-    const int dstH = c->dstH;
-    int needsDither;
-
-    needsDither= isAnyRGB(dstFormat)
-        &&  c->dstFormatBpp < 24
-        && (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat)));
-
-    /* yv12_to_nv12 */
-    if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
-        c->swScale= planarToNv12Wrapper;
-    }
-    /* yuv2bgr */
-    if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && isAnyRGB(dstFormat)
-        && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) {
-        c->swScale= ff_yuv2rgb_get_func_ptr(c);
-    }
-
-    if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) {
-        c->swScale= yvu9ToYv12Wrapper;
-    }
-
-    /* bgr24toYV12 */
-    if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
-        c->swScale= bgr24ToYv12Wrapper;
-
-    /* RGB/BGR -> RGB/BGR (no dither needed forms) */
-    if (   isAnyRGB(srcFormat)
-        && isAnyRGB(dstFormat)
-        && srcFormat != PIX_FMT_BGR8      && dstFormat != PIX_FMT_BGR8
-        && srcFormat != PIX_FMT_RGB8      && dstFormat != PIX_FMT_RGB8
-        && srcFormat != PIX_FMT_BGR4      && dstFormat != PIX_FMT_BGR4
-        && srcFormat != PIX_FMT_RGB4      && dstFormat != PIX_FMT_RGB4
-        && srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
-        && srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
-        && srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
-        && srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
-        && srcFormat != PIX_FMT_RGB48LE   && dstFormat != PIX_FMT_RGB48LE
-        && srcFormat != PIX_FMT_RGB48BE   && dstFormat != PIX_FMT_RGB48BE
-        && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
-        c->swScale= rgbToRgbWrapper;
-
-    if ((usePal(srcFormat) && (
-        dstFormat == PIX_FMT_RGB32   ||
-        dstFormat == PIX_FMT_RGB32_1 ||
-        dstFormat == PIX_FMT_RGB24   ||
-        dstFormat == PIX_FMT_BGR32   ||
-        dstFormat == PIX_FMT_BGR32_1 ||
-        dstFormat == PIX_FMT_BGR24)))
-        c->swScale= palToRgbWrapper;
-
-    if (srcFormat == PIX_FMT_YUV422P) {
-        if (dstFormat == PIX_FMT_YUYV422)
-            c->swScale= yuv422pToYuy2Wrapper;
-        else if (dstFormat == PIX_FMT_UYVY422)
-            c->swScale= yuv422pToUyvyWrapper;
-    }
-
-    /* LQ converters if -sws 0 or -sws 4*/
-    if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
-        /* yv12_to_yuy2 */
-        if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) {
-            if (dstFormat == PIX_FMT_YUYV422)
-                c->swScale= planarToYuy2Wrapper;
-            else if (dstFormat == PIX_FMT_UYVY422)
-                c->swScale= planarToUyvyWrapper;
-        }
-    }
-    if(srcFormat == PIX_FMT_YUYV422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
-        c->swScale= yuyvToYuv420Wrapper;
-    if(srcFormat == PIX_FMT_UYVY422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
-        c->swScale= uyvyToYuv420Wrapper;
-    if(srcFormat == PIX_FMT_YUYV422 && dstFormat == PIX_FMT_YUV422P)
-        c->swScale= yuyvToYuv422Wrapper;
-    if(srcFormat == PIX_FMT_UYVY422 && dstFormat == PIX_FMT_YUV422P)
-        c->swScale= uyvyToYuv422Wrapper;
-
-#ifdef COMPILE_ALTIVEC
-    if ((c->flags & SWS_CPU_CAPS_ALTIVEC) &&
-        !(c->flags & SWS_BITEXACT) &&
-        srcFormat == PIX_FMT_YUV420P) {
-        // unscaled YV12 -> packed YUV, we want speed
-        if (dstFormat == PIX_FMT_YUYV422)
-            c->swScale= yv12toyuy2_unscaled_altivec;
-        else if (dstFormat == PIX_FMT_UYVY422)
-            c->swScale= yv12touyvy_unscaled_altivec;
-    }
-#endif
-
-    /* simple copy */
-    if (  srcFormat == dstFormat
-        || (srcFormat == PIX_FMT_YUVA420P && dstFormat == PIX_FMT_YUV420P)
-        || (srcFormat == PIX_FMT_YUV420P && dstFormat == PIX_FMT_YUVA420P)
-        || (isPlanarYUV(srcFormat) && isGray(dstFormat))
-        || (isPlanarYUV(dstFormat) && isGray(srcFormat))
-        || (isGray(dstFormat) && isGray(srcFormat))
-        || (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat)
-            && c->chrDstHSubSample == c->chrSrcHSubSample
-            && c->chrDstVSubSample == c->chrSrcVSubSample
-            && dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21
-            && srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21))
-    {
-        if (isPacked(c->srcFormat))
-            c->swScale= packedCopyWrapper;
-        else /* Planar YUV or gray */
-            c->swScale= planarCopyWrapper;
-    }
-#if ARCH_BFIN
-    if (flags & SWS_CPU_CAPS_BFIN)
-        ff_bfin_get_unscaled_swscale (c);
-#endif
-}
-
-static void reset_ptr(const uint8_t* src[], int format)
-{
-    if(!isALPHA(format))
-        src[3]=NULL;
-    if(!isPlanarYUV(format)) {
-        src[3]=src[2]=NULL;
-
-        if (!usePal(format))
-            src[1]= NULL;
-    }
-}
-
-/**
- * swscale wrapper, so we don't need to export the SwsContext.
- * Assumes planar YUV to be in YUV order instead of YVU.
- */
-int sws_scale(SwsContext *c, const uint8_t* const src[], const int srcStride[], int srcSliceY,
-              int srcSliceH, uint8_t* const dst[], const int dstStride[])
-{
-    int i;
-    const uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
-    uint8_t* dst2[4]= {dst[0], dst[1], dst[2], dst[3]};
-
-    // do not mess up sliceDir if we have a "trailing" 0-size slice
-    if (srcSliceH == 0)
-        return 0;
-
-    if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
-        av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
-        return 0;
-    }
-    if (c->sliceDir == 0) {
-        if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;
-    }
-
-    if (usePal(c->srcFormat)) {
-        for (i=0; i<256; i++) {
-            int p, r, g, b,y,u,v;
-            if(c->srcFormat == PIX_FMT_PAL8) {
-                p=((const uint32_t*)(src[1]))[i];
-                r= (p>>16)&0xFF;
-                g= (p>> 8)&0xFF;
-                b=  p     &0xFF;
-            } else if(c->srcFormat == PIX_FMT_RGB8) {
-                r= (i>>5    )*36;
-                g= ((i>>2)&7)*36;
-                b= (i&3     )*85;
-            } else if(c->srcFormat == PIX_FMT_BGR8) {
-                b= (i>>6    )*85;
-                g= ((i>>3)&7)*36;
-                r= (i&7     )*36;
-            } else if(c->srcFormat == PIX_FMT_RGB4_BYTE) {
-                r= (i>>3    )*255;
-                g= ((i>>1)&3)*85;
-                b= (i&1     )*255;
-            } else if(c->srcFormat == PIX_FMT_GRAY8) {
-                r = g = b = i;
-            } else {
-                assert(c->srcFormat == PIX_FMT_BGR4_BYTE);
-                b= (i>>3    )*255;
-                g= ((i>>1)&3)*85;
-                r= (i&1     )*255;
-            }
-            y= av_clip_uint8((RY*r + GY*g + BY*b + ( 33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
-            u= av_clip_uint8((RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
-            v= av_clip_uint8((RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
-            c->pal_yuv[i]= y + (u<<8) + (v<<16);
-
-            switch(c->dstFormat) {
-            case PIX_FMT_BGR32:
-#if !HAVE_BIGENDIAN
-            case PIX_FMT_RGB24:
-#endif
-                c->pal_rgb[i]=  r + (g<<8) + (b<<16);
-                break;
-            case PIX_FMT_BGR32_1:
-#if HAVE_BIGENDIAN
-            case PIX_FMT_BGR24:
-#endif
-                c->pal_rgb[i]= (r + (g<<8) + (b<<16)) << 8;
-                break;
-            case PIX_FMT_RGB32_1:
-#if HAVE_BIGENDIAN
-            case PIX_FMT_RGB24:
-#endif
-                c->pal_rgb[i]= (b + (g<<8) + (r<<16)) << 8;
-                break;
-            case PIX_FMT_RGB32:
-#if !HAVE_BIGENDIAN
-            case PIX_FMT_BGR24:
-#endif
-            default:
-                c->pal_rgb[i]=  b + (g<<8) + (r<<16);
-            }
-        }
-    }
-
-    // copy strides, so they can safely be modified
-    if (c->sliceDir == 1) {
-        // slices go from top to bottom
-        int srcStride2[4]= {srcStride[0], srcStride[1], srcStride[2], srcStride[3]};
-        int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2], dstStride[3]};
-
-        reset_ptr(src2, c->srcFormat);
-        reset_ptr((const uint8_t**)dst2, c->dstFormat);
-
-        /* reset slice direction at end of frame */
-        if (srcSliceY + srcSliceH == c->srcH)
-            c->sliceDir = 0;
-
-        return c->swScale(c, src2, srcStride2, srcSliceY, srcSliceH, dst2, dstStride2);
-    } else {
-        // slices go from bottom to top => we flip the image internally
-        int srcStride2[4]= {-srcStride[0], -srcStride[1], -srcStride[2], -srcStride[3]};
-        int dstStride2[4]= {-dstStride[0], -dstStride[1], -dstStride[2], -dstStride[3]};
-
-        src2[0] += (srcSliceH-1)*srcStride[0];
-        if (!usePal(c->srcFormat))
-            src2[1] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1];
-        src2[2] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2];
-        src2[3] += (srcSliceH-1)*srcStride[3];
-        dst2[0] += ( c->dstH                      -1)*dstStride[0];
-        dst2[1] += ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1];
-        dst2[2] += ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2];
-        dst2[3] += ( c->dstH                      -1)*dstStride[3];
-
-        reset_ptr(src2, c->srcFormat);
-        reset_ptr((const uint8_t**)dst2, c->dstFormat);
-
-        /* reset slice direction at end of frame */
-        if (!srcSliceY)
-            c->sliceDir = 0;
-
-        return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2);
-    }
-}
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-int sws_scale_ordered(SwsContext *c, const uint8_t* const src[], int srcStride[], int srcSliceY,
-                      int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
-}
-#endif
-
-/* Convert the palette to the same packed 32-bit format as the palette */
-void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
-    long i;
-
-    for (i=0; i<num_pixels; i++)
-        ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i]];
-}
-
-/* Palette format: ABCD -> dst format: ABC */
-void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
-    long i;
-
-    for (i=0; i<num_pixels; i++) {
-        //FIXME slow?
-        dst[0]= palette[src[i]*4+0];
-        dst[1]= palette[src[i]*4+1];
-        dst[2]= palette[src[i]*4+2];
-        dst+= 3;
-    }
-}
diff --git a/libswscale/swscale.h b/libswscale/swscale.h
deleted file mode 100644
index 1e7af3a..0000000
--- a/libswscale/swscale.h
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SWSCALE_SWSCALE_H
-#define SWSCALE_SWSCALE_H
-
-/**
- * @file
- * @brief
- *     external api for the swscale stuff
- */
-
-#include "libavutil/avutil.h"
-
-#define LIBSWSCALE_VERSION_MAJOR 0
-#define LIBSWSCALE_VERSION_MINOR 11
-#define LIBSWSCALE_VERSION_MICRO 0
-
-#define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
-                                               LIBSWSCALE_VERSION_MINOR, \
-                                               LIBSWSCALE_VERSION_MICRO)
-#define LIBSWSCALE_VERSION      AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
-                                           LIBSWSCALE_VERSION_MINOR, \
-                                           LIBSWSCALE_VERSION_MICRO)
-#define LIBSWSCALE_BUILD        LIBSWSCALE_VERSION_INT
-
-#define LIBSWSCALE_IDENT        "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
-
-/**
- * Returns the LIBSWSCALE_VERSION_INT constant.
- */
-unsigned swscale_version(void);
-
-/**
- * Returns the libswscale build-time configuration.
- */
-const char *swscale_configuration(void);
-
-/**
- * Returns the libswscale license.
- */
-const char *swscale_license(void);
-
-/* values for the flags, the stuff on the command line is different */
-#define SWS_FAST_BILINEAR     1
-#define SWS_BILINEAR          2
-#define SWS_BICUBIC           4
-#define SWS_X                 8
-#define SWS_POINT          0x10
-#define SWS_AREA           0x20
-#define SWS_BICUBLIN       0x40
-#define SWS_GAUSS          0x80
-#define SWS_SINC          0x100
-#define SWS_LANCZOS       0x200
-#define SWS_SPLINE        0x400
-
-#define SWS_SRC_V_CHR_DROP_MASK     0x30000
-#define SWS_SRC_V_CHR_DROP_SHIFT    16
-
-#define SWS_PARAM_DEFAULT           123456
-
-#define SWS_PRINT_INFO              0x1000
-
-//the following 3 flags are not completely implemented
-//internal chrominace subsampling info
-#define SWS_FULL_CHR_H_INT    0x2000
-//input subsampling info
-#define SWS_FULL_CHR_H_INP    0x4000
-#define SWS_DIRECT_BGR        0x8000
-#define SWS_ACCURATE_RND      0x40000
-#define SWS_BITEXACT          0x80000
-
-#define SWS_CPU_CAPS_MMX      0x80000000
-#define SWS_CPU_CAPS_MMX2     0x20000000
-#define SWS_CPU_CAPS_3DNOW    0x40000000
-#define SWS_CPU_CAPS_ALTIVEC  0x10000000
-#define SWS_CPU_CAPS_BFIN     0x01000000
-
-#define SWS_MAX_REDUCE_CUTOFF 0.002
-
-#define SWS_CS_ITU709         1
-#define SWS_CS_FCC            4
-#define SWS_CS_ITU601         5
-#define SWS_CS_ITU624         5
-#define SWS_CS_SMPTE170M      5
-#define SWS_CS_SMPTE240M      7
-#define SWS_CS_DEFAULT        5
-
-/**
- * Returns a pointer to yuv<->rgb coefficients for the given colorspace
- * suitable for sws_setColorspaceDetails().
- *
- * @param colorspace One of the SWS_CS_* macros. If invalid,
- * SWS_CS_DEFAULT is used.
- */
-const int *sws_getCoefficients(int colorspace);
-
-
-// when used for filters they must have an odd number of elements
-// coeffs cannot be shared between vectors
-typedef struct {
-    double *coeff;              ///< pointer to the list of coefficients
-    int length;                 ///< number of coefficients in the vector
-} SwsVector;
-
-// vectors can be shared
-typedef struct {
-    SwsVector *lumH;
-    SwsVector *lumV;
-    SwsVector *chrH;
-    SwsVector *chrV;
-} SwsFilter;
-
-struct SwsContext;
-
-/**
- * Returns a positive value if pix_fmt is a supported input format, 0
- * otherwise.
- */
-int sws_isSupportedInput(enum PixelFormat pix_fmt);
-
-/**
- * Returns a positive value if pix_fmt is a supported output format, 0
- * otherwise.
- */
-int sws_isSupportedOutput(enum PixelFormat pix_fmt);
-
-/**
- * Frees the swscaler context swsContext.
- * If swsContext is NULL, then does nothing.
- */
-void sws_freeContext(struct SwsContext *swsContext);
-
-/**
- * Allocates and returns a SwsContext. You need it to perform
- * scaling/conversion operations using sws_scale().
- *
- * @param srcW the width of the source image
- * @param srcH the height of the source image
- * @param srcFormat the source image format
- * @param dstW the width of the destination image
- * @param dstH the height of the destination image
- * @param dstFormat the destination image format
- * @param flags specify which algorithm and options to use for rescaling
- * @return a pointer to an allocated context, or NULL in case of error
- */
-struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
-                                  int dstW, int dstH, enum PixelFormat dstFormat,
-                                  int flags, SwsFilter *srcFilter,
-                                  SwsFilter *dstFilter, const double *param);
-
-/**
- * Scales the image slice in srcSlice and puts the resulting scaled
- * slice in the image in dst. A slice is a sequence of consecutive
- * rows in an image.
- *
- * Slices have to be provided in sequential order, either in
- * top-bottom or bottom-top order. If slices are provided in
- * non-sequential order the behavior of the function is undefined.
- *
- * @param context   the scaling context previously created with
- *                  sws_getContext()
- * @param srcSlice  the array containing the pointers to the planes of
- *                  the source slice
- * @param srcStride the array containing the strides for each plane of
- *                  the source image
- * @param srcSliceY the position in the source image of the slice to
- *                  process, that is the number (counted starting from
- *                  zero) in the image of the first row of the slice
- * @param srcSliceH the height of the source slice, that is the number
- *                  of rows in the slice
- * @param dst       the array containing the pointers to the planes of
- *                  the destination image
- * @param dstStride the array containing the strides for each plane of
- *                  the destination image
- * @return          the height of the output slice
- */
-int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], const int srcStride[],
-              int srcSliceY, int srcSliceH, uint8_t* const dst[], const int dstStride[]);
-#if LIBSWSCALE_VERSION_MAJOR < 1
-/**
- * @deprecated Use sws_scale() instead.
- */
-int sws_scale_ordered(struct SwsContext *context, const uint8_t* const src[],
-                      int srcStride[], int srcSliceY, int srcSliceH,
-                      uint8_t* dst[], int dstStride[]) attribute_deprecated;
-#endif
-
-/**
- * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
- * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
- * @return -1 if not supported
- */
-int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
-                             int srcRange, const int table[4], int dstRange,
-                             int brightness, int contrast, int saturation);
-
-/**
- * @return -1 if not supported
- */
-int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
-                             int *srcRange, int **table, int *dstRange,
-                             int *brightness, int *contrast, int *saturation);
-
-/**
- * Allocates and returns an uninitialized vector with length coefficients.
- */
-SwsVector *sws_allocVec(int length);
-
-/**
- * Returns a normalized Gaussian curve used to filter stuff
- * quality=3 is high quality, lower is lower quality.
- */
-SwsVector *sws_getGaussianVec(double variance, double quality);
-
-/**
- * Allocates and returns a vector with length coefficients, all
- * with the same value c.
- */
-SwsVector *sws_getConstVec(double c, int length);
-
-/**
- * Allocates and returns a vector with just one coefficient, with
- * value 1.0.
- */
-SwsVector *sws_getIdentityVec(void);
-
-/**
- * Scales all the coefficients of a by the scalar value.
- */
-void sws_scaleVec(SwsVector *a, double scalar);
-
-/**
- * Scales all the coefficients of a so that their sum equals height.
- */
-void sws_normalizeVec(SwsVector *a, double height);
-void sws_convVec(SwsVector *a, SwsVector *b);
-void sws_addVec(SwsVector *a, SwsVector *b);
-void sws_subVec(SwsVector *a, SwsVector *b);
-void sws_shiftVec(SwsVector *a, int shift);
-
-/**
- * Allocates and returns a clone of the vector a, that is a vector
- * with the same coefficients as a.
- */
-SwsVector *sws_cloneVec(SwsVector *a);
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-/**
- * @deprecated Use sws_printVec2() instead.
- */
-attribute_deprecated void sws_printVec(SwsVector *a);
-#endif
-
-/**
- * Prints with av_log() a textual representation of the vector a
- * if log_level <= av_log_level.
- */
-void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
-
-void sws_freeVec(SwsVector *a);
-
-SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
-                                float lumaSharpen, float chromaSharpen,
-                                float chromaHShift, float chromaVShift,
-                                int verbose);
-void sws_freeFilter(SwsFilter *filter);
-
-/**
- * Checks if context can be reused, otherwise reallocates a new
- * one.
- *
- * If context is NULL, just calls sws_getContext() to get a new
- * context. Otherwise, checks if the parameters are the ones already
- * saved in context. If that is the case, returns the current
- * context. Otherwise, frees context and gets a new context with
- * the new parameters.
- *
- * Be warned that srcFilter and dstFilter are not checked, they
- * are assumed to remain the same.
- */
-struct SwsContext *sws_getCachedContext(struct SwsContext *context,
-                                        int srcW, int srcH, enum PixelFormat srcFormat,
-                                        int dstW, int dstH, enum PixelFormat dstFormat,
-                                        int flags, SwsFilter *srcFilter,
-                                        SwsFilter *dstFilter, const double *param);
-
-/**
- * Converts an 8bit paletted frame into a frame with a color depth of 32-bits.
- *
- * The output frame will have the same packed format as the palette.
- *
- * @param src        source frame buffer
- * @param dst        destination frame buffer
- * @param num_pixels number of pixels to convert
- * @param palette    array with [256] entries, which must match color arrangement (RGB or BGR) of src
- */
-void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-
-/**
- * Converts an 8bit paletted frame into a frame with a color depth of 24 bits.
- *
- * With the palette format "ABCD", the destination frame ends up with the format "ABC".
- *
- * @param src        source frame buffer
- * @param dst        destination frame buffer
- * @param num_pixels number of pixels to convert
- * @param palette    array with [256] entries, which must match color arrangement (RGB or BGR) of src
- */
-void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-
-
-#endif /* SWSCALE_SWSCALE_H */
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
deleted file mode 100644
index 5be17d4..0000000
--- a/libswscale/swscale_internal.h
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SWSCALE_SWSCALE_INTERNAL_H
-#define SWSCALE_SWSCALE_INTERNAL_H
-
-#include "config.h"
-
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-#include "libavutil/avutil.h"
-
-#define STR(s)         AV_TOSTRING(s) //AV_STRINGIFY is too long
-
-#define MAX_FILTER_SIZE 256
-
-#if ARCH_X86
-#define VOFW 5120
-#else
-#define VOFW 2048 // faster on PPC and not tested on others
-#endif
-
-#define VOF  (VOFW*2)
-
-#if HAVE_BIGENDIAN
-#define ALT32_CORR (-1)
-#else
-#define ALT32_CORR   1
-#endif
-
-#if ARCH_X86_64
-#   define APCK_PTR2 8
-#   define APCK_COEF 16
-#   define APCK_SIZE 24
-#else
-#   define APCK_PTR2 4
-#   define APCK_COEF 8
-#   define APCK_SIZE 16
-#endif
-
-struct SwsContext;
-
-typedef int (*SwsFunc)(struct SwsContext *context, const uint8_t* src[],
-                       int srcStride[], int srcSliceY, int srcSliceH,
-                       uint8_t* dst[], int dstStride[]);
-
-/* This struct should be aligned on at least a 32-byte boundary. */
-typedef struct SwsContext {
-    /**
-     * info on struct for av_log
-     */
-    const AVClass *av_class;
-
-    /**
-     * Note that src, dst, srcStride, dstStride will be copied in the
-     * sws_scale() wrapper so they can be freely modified here.
-     */
-    SwsFunc swScale;
-    int srcW;                     ///< Width  of source      luma/alpha planes.
-    int srcH;                     ///< Height of source      luma/alpha planes.
-    int dstH;                     ///< Height of destination luma/alpha planes.
-    int chrSrcW;                  ///< Width  of source      chroma     planes.
-    int chrSrcH;                  ///< Height of source      chroma     planes.
-    int chrDstW;                  ///< Width  of destination chroma     planes.
-    int chrDstH;                  ///< Height of destination chroma     planes.
-    int lumXInc, chrXInc;
-    int lumYInc, chrYInc;
-    enum PixelFormat dstFormat;   ///< Destination pixel format.
-    enum PixelFormat srcFormat;   ///< Source      pixel format.
-    int dstFormatBpp;             ///< Number of bits per pixel of the destination pixel format.
-    int srcFormatBpp;             ///< Number of bits per pixel of the source      pixel format.
-    int chrSrcHSubSample;         ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source      image.
-    int chrSrcVSubSample;         ///< Binary logarithm of vertical   subsampling factor between luma/alpha and chroma planes in source      image.
-    int chrDstHSubSample;         ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image.
-    int chrDstVSubSample;         ///< Binary logarithm of vertical   subsampling factor between luma/alpha and chroma planes in destination image.
-    int vChrDrop;                 ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
-    int sliceDir;                 ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
-    double param[2];              ///< Input parameters for scaling algorithms that need them.
-
-    uint32_t pal_yuv[256];
-    uint32_t pal_rgb[256];
-
-    /**
-     * @name Scaled horizontal lines ring buffer.
-     * The horizontal scaler keeps just enough scaled lines in a ring buffer
-     * so they may be passed to the vertical scaler. The pointers to the
-     * allocated buffers for each line are duplicated in sequence in the ring
-     * buffer to simplify indexing and avoid wrapping around between lines
-     * inside the vertical scaler code. The wrapping is done before the
-     * vertical scaler is called.
-     */
-    //@{
-    int16_t **lumPixBuf;          ///< Ring buffer for scaled horizontal luma   plane lines to be fed to the vertical scaler.
-    int16_t **chrPixBuf;          ///< Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler.
-    int16_t **alpPixBuf;          ///< Ring buffer for scaled horizontal alpha  plane lines to be fed to the vertical scaler.
-    int       vLumBufSize;        ///< Number of vertical luma/alpha lines allocated in the ring buffer.
-    int       vChrBufSize;        ///< Number of vertical chroma     lines allocated in the ring buffer.
-    int       lastInLumBuf;       ///< Last scaled horizontal luma/alpha line from source in the ring buffer.
-    int       lastInChrBuf;       ///< Last scaled horizontal chroma     line from source in the ring buffer.
-    int       lumBufIndex;        ///< Index in ring buffer of the last scaled horizontal luma/alpha line from source.
-    int       chrBufIndex;        ///< Index in ring buffer of the last scaled horizontal chroma     line from source.
-    //@}
-
-    uint8_t formatConvBuffer[VOF]; //FIXME dynamic allocation, but we have to change a lot of code for this to be useful
-
-    /**
-     * @name Horizontal and vertical filters.
-     * To better understand the following fields, here is a pseudo-code of
-     * their usage in filtering a horizontal line:
-     * @code
-     * for (i = 0; i < width; i++) {
-     *     dst[i] = 0;
-     *     for (j = 0; j < filterSize; j++)
-     *         dst[i] += src[ filterPos[i] + j ] * filter[ filterSize * i + j ];
-     *     dst[i] >>= FRAC_BITS; // The actual implementation is fixed-point.
-     * }
-     * @endcode
-     */
-    //@{
-    int16_t *hLumFilter;          ///< Array of horizontal filter coefficients for luma/alpha planes.
-    int16_t *hChrFilter;          ///< Array of horizontal filter coefficients for chroma     planes.
-    int16_t *vLumFilter;          ///< Array of vertical   filter coefficients for luma/alpha planes.
-    int16_t *vChrFilter;          ///< Array of vertical   filter coefficients for chroma     planes.
-    int16_t *hLumFilterPos;       ///< Array of horizontal filter starting positions for each dst[i] for luma/alpha planes.
-    int16_t *hChrFilterPos;       ///< Array of horizontal filter starting positions for each dst[i] for chroma     planes.
-    int16_t *vLumFilterPos;       ///< Array of vertical   filter starting positions for each dst[i] for luma/alpha planes.
-    int16_t *vChrFilterPos;       ///< Array of vertical   filter starting positions for each dst[i] for chroma     planes.
-    int      hLumFilterSize;      ///< Horizontal filter size for luma/alpha pixels.
-    int      hChrFilterSize;      ///< Horizontal filter size for chroma     pixels.
-    int      vLumFilterSize;      ///< Vertical   filter size for luma/alpha pixels.
-    int      vChrFilterSize;      ///< Vertical   filter size for chroma     pixels.
-    //@}
-
-    int lumMmx2FilterCodeSize;    ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for luma/alpha planes.
-    int chrMmx2FilterCodeSize;    ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for chroma     planes.
-    uint8_t *lumMmx2FilterCode;   ///< Runtime-generated MMX2 horizontal fast bilinear scaler code for luma/alpha planes.
-    uint8_t *chrMmx2FilterCode;   ///< Runtime-generated MMX2 horizontal fast bilinear scaler code for chroma     planes.
-
-    int canMMX2BeUsed;
-
-    int dstY;                     ///< Last destination vertical line output from last slice.
-    int flags;                    ///< Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
-    void * yuvTable;            // pointer to the yuv->rgb table start so it can be freed()
-    uint8_t * table_rV[256];
-    uint8_t * table_gU[256];
-    int    table_gV[256];
-    uint8_t * table_bU[256];
-
-    //Colorspace stuff
-    int contrast, brightness, saturation;    // for sws_getColorspaceDetails
-    int srcColorspaceTable[4];
-    int dstColorspaceTable[4];
-    int srcRange;                 ///< 0 = MPG YUV range, 1 = JPG YUV range (source      image).
-    int dstRange;                 ///< 0 = MPG YUV range, 1 = JPG YUV range (destination image).
-    int yuv2rgb_y_offset;
-    int yuv2rgb_y_coeff;
-    int yuv2rgb_v2r_coeff;
-    int yuv2rgb_v2g_coeff;
-    int yuv2rgb_u2g_coeff;
-    int yuv2rgb_u2b_coeff;
-
-#define RED_DITHER            "0*8"
-#define GREEN_DITHER          "1*8"
-#define BLUE_DITHER           "2*8"
-#define Y_COEFF               "3*8"
-#define VR_COEFF              "4*8"
-#define UB_COEFF              "5*8"
-#define VG_COEFF              "6*8"
-#define UG_COEFF              "7*8"
-#define Y_OFFSET              "8*8"
-#define U_OFFSET              "9*8"
-#define V_OFFSET              "10*8"
-#define LUM_MMX_FILTER_OFFSET "11*8"
-#define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
-#define DSTW_OFFSET           "11*8+4*4*256*2" //do not change, it is hardcoded in the ASM
-#define ESP_OFFSET            "11*8+4*4*256*2+8"
-#define VROUNDER_OFFSET       "11*8+4*4*256*2+16"
-#define U_TEMP                "11*8+4*4*256*2+24"
-#define V_TEMP                "11*8+4*4*256*2+32"
-#define Y_TEMP                "11*8+4*4*256*2+40"
-#define ALP_MMX_FILTER_OFFSET "11*8+4*4*256*2+48"
-
-    DECLARE_ALIGNED(8, uint64_t, redDither);
-    DECLARE_ALIGNED(8, uint64_t, greenDither);
-    DECLARE_ALIGNED(8, uint64_t, blueDither);
-
-    DECLARE_ALIGNED(8, uint64_t, yCoeff);
-    DECLARE_ALIGNED(8, uint64_t, vrCoeff);
-    DECLARE_ALIGNED(8, uint64_t, ubCoeff);
-    DECLARE_ALIGNED(8, uint64_t, vgCoeff);
-    DECLARE_ALIGNED(8, uint64_t, ugCoeff);
-    DECLARE_ALIGNED(8, uint64_t, yOffset);
-    DECLARE_ALIGNED(8, uint64_t, uOffset);
-    DECLARE_ALIGNED(8, uint64_t, vOffset);
-    int32_t  lumMmxFilter[4*MAX_FILTER_SIZE];
-    int32_t  chrMmxFilter[4*MAX_FILTER_SIZE];
-    int dstW;                     ///< Width  of destination luma/alpha planes.
-    DECLARE_ALIGNED(8, uint64_t, esp);
-    DECLARE_ALIGNED(8, uint64_t, vRounder);
-    DECLARE_ALIGNED(8, uint64_t, u_temp);
-    DECLARE_ALIGNED(8, uint64_t, v_temp);
-    DECLARE_ALIGNED(8, uint64_t, y_temp);
-    int32_t  alpMmxFilter[4*MAX_FILTER_SIZE];
-
-#if HAVE_ALTIVEC
-    vector signed short   CY;
-    vector signed short   CRV;
-    vector signed short   CBU;
-    vector signed short   CGU;
-    vector signed short   CGV;
-    vector signed short   OY;
-    vector unsigned short CSHIFT;
-    vector signed short   *vYCoeffsBank, *vCCoeffsBank;
-#endif
-
-#if ARCH_BFIN
-    DECLARE_ALIGNED(4, uint32_t, oy);
-    DECLARE_ALIGNED(4, uint32_t, oc);
-    DECLARE_ALIGNED(4, uint32_t, zero);
-    DECLARE_ALIGNED(4, uint32_t, cy);
-    DECLARE_ALIGNED(4, uint32_t, crv);
-    DECLARE_ALIGNED(4, uint32_t, rmask);
-    DECLARE_ALIGNED(4, uint32_t, cbu);
-    DECLARE_ALIGNED(4, uint32_t, bmask);
-    DECLARE_ALIGNED(4, uint32_t, cgu);
-    DECLARE_ALIGNED(4, uint32_t, cgv);
-    DECLARE_ALIGNED(4, uint32_t, gmask);
-#endif
-
-#if HAVE_VIS
-    DECLARE_ALIGNED(8, uint64_t, sparc_coeffs)[10];
-#endif
-
-    /* function pointers for swScale() */
-    void (*yuv2nv12X  )(struct SwsContext *c,
-                        const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                        const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                        uint8_t *dest, uint8_t *uDest,
-                        int dstW, int chrDstW, int dstFormat);
-    void (*yuv2yuv1   )(struct SwsContext *c,
-                        const int16_t *lumSrc, const int16_t *chrSrc, const int16_t *alpSrc,
-                        uint8_t *dest,
-                        uint8_t *uDest, uint8_t *vDest, uint8_t *aDest,
-                        long dstW, long chrDstW);
-    void (*yuv2yuvX   )(struct SwsContext *c,
-                        const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                        const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                        const int16_t **alpSrc,
-                        uint8_t *dest,
-                        uint8_t *uDest, uint8_t *vDest, uint8_t *aDest,
-                        long dstW, long chrDstW);
-    void (*yuv2packed1)(struct SwsContext *c,
-                        const uint16_t *buf0,
-                        const uint16_t *uvbuf0, const uint16_t *uvbuf1,
-                        const uint16_t *abuf0,
-                        uint8_t *dest,
-                        int dstW, int uvalpha, int dstFormat, int flags, int y);
-    void (*yuv2packed2)(struct SwsContext *c,
-                        const uint16_t *buf0, const uint16_t *buf1,
-                        const uint16_t *uvbuf0, const uint16_t *uvbuf1,
-                        const uint16_t *abuf0, const uint16_t *abuf1,
-                        uint8_t *dest,
-                        int dstW, int yalpha, int uvalpha, int y);
-    void (*yuv2packedX)(struct SwsContext *c,
-                        const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                        const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                        const int16_t **alpSrc, uint8_t *dest,
-                        long dstW, long dstY);
-
-    void (*lumToYV12)(uint8_t *dst, const uint8_t *src,
-                      long width, uint32_t *pal); ///< Unscaled conversion of luma plane to YV12 for horizontal scaler.
-    void (*alpToYV12)(uint8_t *dst, const uint8_t *src,
-                      long width, uint32_t *pal); ///< Unscaled conversion of alpha plane to YV12 for horizontal scaler.
-    void (*chrToYV12)(uint8_t *dstU, uint8_t *dstV,
-                      const uint8_t *src1, const uint8_t *src2,
-                      long width, uint32_t *pal); ///< Unscaled conversion of chroma planes to YV12 for horizontal scaler.
-    void (*hyscale_fast)(struct SwsContext *c,
-                         int16_t *dst, long dstWidth,
-                         const uint8_t *src, int srcW, int xInc);
-    void (*hcscale_fast)(struct SwsContext *c,
-                         int16_t *dst, long dstWidth,
-                         const uint8_t *src1, const uint8_t *src2,
-                         int srcW, int xInc);
-
-    void (*hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW,
-                   int xInc, const int16_t *filter, const int16_t *filterPos,
-                   long filterSize);
-
-    void (*lumConvertRange)(uint16_t *dst, int width); ///< Color range conversion function for luma plane if needed.
-    void (*chrConvertRange)(uint16_t *dst, int width); ///< Color range conversion function for chroma planes if needed.
-
-    int lumSrcOffset; ///< Offset given to luma src pointers passed to horizontal input functions.
-    int chrSrcOffset; ///< Offset given to chroma src pointers passed to horizontal input functions.
-    int alpSrcOffset; ///< Offset given to alpha src pointers passed to horizontal input functions.
-
-    int needs_hcscale; ///< Set if there are chroma planes to be converted.
-
-} SwsContext;
-//FIXME check init (where 0)
-
-SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c);
-int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
-                             int fullRange, int brightness,
-                             int contrast, int saturation);
-
-void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4],
-                                    int brightness, int contrast, int saturation);
-SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_vis(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c);
-SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
-void ff_bfin_get_unscaled_swscale(SwsContext *c);
-void ff_yuv2packedX_altivec(SwsContext *c,
-                            const int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
-                            const int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
-                            uint8_t *dest, int dstW, int dstY);
-
-const char *sws_format_name(enum PixelFormat format);
-
-//FIXME replace this with something faster
-#define is16BPS(x)      (           \
-           (x)==PIX_FMT_GRAY16BE    \
-        || (x)==PIX_FMT_GRAY16LE    \
-        || (x)==PIX_FMT_RGB48BE     \
-        || (x)==PIX_FMT_RGB48LE     \
-        || (x)==PIX_FMT_YUV420P16LE   \
-        || (x)==PIX_FMT_YUV422P16LE   \
-        || (x)==PIX_FMT_YUV444P16LE   \
-        || (x)==PIX_FMT_YUV420P16BE   \
-        || (x)==PIX_FMT_YUV422P16BE   \
-        || (x)==PIX_FMT_YUV444P16BE   \
-    )
-#define isBE(x) ((x)&1)
-#define isPlanar8YUV(x) (           \
-           (x)==PIX_FMT_YUV410P     \
-        || (x)==PIX_FMT_YUV420P     \
-        || (x)==PIX_FMT_YUVA420P    \
-        || (x)==PIX_FMT_YUV411P     \
-        || (x)==PIX_FMT_YUV422P     \
-        || (x)==PIX_FMT_YUV444P     \
-        || (x)==PIX_FMT_YUV440P     \
-        || (x)==PIX_FMT_NV12        \
-        || (x)==PIX_FMT_NV21        \
-    )
-#define isPlanarYUV(x)  (           \
-        isPlanar8YUV(x)             \
-        || (x)==PIX_FMT_YUV420P16LE   \
-        || (x)==PIX_FMT_YUV422P16LE   \
-        || (x)==PIX_FMT_YUV444P16LE   \
-        || (x)==PIX_FMT_YUV420P16BE   \
-        || (x)==PIX_FMT_YUV422P16BE   \
-        || (x)==PIX_FMT_YUV444P16BE   \
-    )
-#define isYUV(x)        (           \
-           (x)==PIX_FMT_UYVY422     \
-        || (x)==PIX_FMT_YUYV422     \
-        || isPlanarYUV(x)           \
-    )
-#define isGray(x)       (           \
-           (x)==PIX_FMT_GRAY8       \
-        || (x)==PIX_FMT_GRAY16BE    \
-        || (x)==PIX_FMT_GRAY16LE    \
-    )
-#define isGray16(x)     (           \
-           (x)==PIX_FMT_GRAY16BE    \
-        || (x)==PIX_FMT_GRAY16LE    \
-    )
-#define isRGBinInt(x)   (           \
-           (x)==PIX_FMT_RGB48BE     \
-        || (x)==PIX_FMT_RGB48LE     \
-        || (x)==PIX_FMT_RGB32       \
-        || (x)==PIX_FMT_RGB32_1     \
-        || (x)==PIX_FMT_RGB24       \
-        || (x)==PIX_FMT_RGB565BE    \
-        || (x)==PIX_FMT_RGB565LE    \
-        || (x)==PIX_FMT_RGB555BE    \
-        || (x)==PIX_FMT_RGB555LE    \
-        || (x)==PIX_FMT_RGB444BE    \
-        || (x)==PIX_FMT_RGB444LE    \
-        || (x)==PIX_FMT_RGB8        \
-        || (x)==PIX_FMT_RGB4        \
-        || (x)==PIX_FMT_RGB4_BYTE   \
-        || (x)==PIX_FMT_MONOBLACK   \
-        || (x)==PIX_FMT_MONOWHITE   \
-    )
-#define isBGRinInt(x)   (           \
-           (x)==PIX_FMT_BGR32       \
-        || (x)==PIX_FMT_BGR32_1     \
-        || (x)==PIX_FMT_BGR24       \
-        || (x)==PIX_FMT_BGR565BE    \
-        || (x)==PIX_FMT_BGR565LE    \
-        || (x)==PIX_FMT_BGR555BE    \
-        || (x)==PIX_FMT_BGR555LE    \
-        || (x)==PIX_FMT_BGR444BE    \
-        || (x)==PIX_FMT_BGR444LE    \
-        || (x)==PIX_FMT_BGR8        \
-        || (x)==PIX_FMT_BGR4        \
-        || (x)==PIX_FMT_BGR4_BYTE   \
-        || (x)==PIX_FMT_MONOBLACK   \
-        || (x)==PIX_FMT_MONOWHITE   \
-    )
-#define isRGBinBytes(x) (           \
-           (x)==PIX_FMT_RGB48BE     \
-        || (x)==PIX_FMT_RGB48LE     \
-        || (x)==PIX_FMT_RGBA        \
-        || (x)==PIX_FMT_ARGB        \
-        || (x)==PIX_FMT_RGB24       \
-    )
-#define isBGRinBytes(x) (           \
-           (x)==PIX_FMT_BGRA        \
-        || (x)==PIX_FMT_ABGR        \
-        || (x)==PIX_FMT_BGR24       \
-    )
-#define isAnyRGB(x)     (           \
-            isRGBinInt(x)           \
-        ||  isBGRinInt(x)           \
-    )
-#define isALPHA(x)      (           \
-           (x)==PIX_FMT_BGR32       \
-        || (x)==PIX_FMT_BGR32_1     \
-        || (x)==PIX_FMT_RGB32       \
-        || (x)==PIX_FMT_RGB32_1     \
-        || (x)==PIX_FMT_YUVA420P    \
-    )
-#define usePal(x) (av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL)
-
-extern const uint64_t ff_dither4[2];
-extern const uint64_t ff_dither8[2];
-
-extern const AVClass sws_context_class;
-
-/**
- * Sets c->swScale to an unscaled converter if one exists for the specific
- * source and destination formats, bit depths, flags, etc.
- */
-void ff_get_unscaled_swscale(SwsContext *c);
-
-/**
- * Returns the SWS_CPU_CAPS for the optimized code compiled into swscale.
- */
-int ff_hardcodedcpuflags(void);
-
-/**
- * Returns function pointer to fastest main scaler path function depending
- * on architecture and available optimizations.
- */
-SwsFunc ff_getSwsFunc(SwsContext *c);
-
-#endif /* SWSCALE_SWSCALE_INTERNAL_H */
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
deleted file mode 100644
index 0d259ed..0000000
--- a/libswscale/swscale_template.c
+++ /dev/null
@@ -1,3066 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef REAL_MOVNTQ
-#undef MOVNTQ
-#undef PAVGB
-#undef PREFETCH
-
-#if COMPILE_TEMPLATE_AMD3DNOW
-#define PREFETCH  "prefetch"
-#elif COMPILE_TEMPLATE_MMX2
-#define PREFETCH "prefetchnta"
-#else
-#define PREFETCH  " # nop"
-#endif
-
-#if COMPILE_TEMPLATE_MMX2
-#define PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
-#elif COMPILE_TEMPLATE_AMD3DNOW
-#define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
-#endif
-
-#if COMPILE_TEMPLATE_MMX2
-#define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t"
-#else
-#define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t"
-#endif
-#define MOVNTQ(a,b)  REAL_MOVNTQ(a,b)
-
-#if COMPILE_TEMPLATE_ALTIVEC
-#include "ppc/swscale_altivec_template.c"
-#endif
-
-#define YSCALEYUV2YV12X(x, offset, dest, width) \
-    __asm__ volatile(\
-        "xor                          %%"REG_a", %%"REG_a"  \n\t"\
-        "movq             "VROUNDER_OFFSET"(%0), %%mm3      \n\t"\
-        "movq                             %%mm3, %%mm4      \n\t"\
-        "lea                     " offset "(%0), %%"REG_d"  \n\t"\
-        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
-        ASMALIGN(4) /* FIXME Unroll? */\
-        "1:                                                 \n\t"\
-        "movq                      8(%%"REG_d"), %%mm0      \n\t" /* filterCoeff */\
-        "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
-        "movq 8+"  x "(%%"REG_S", %%"REG_a", 2), %%mm5      \n\t" /* srcData */\
-        "add                                $16, %%"REG_d"  \n\t"\
-        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
-        "test                         %%"REG_S", %%"REG_S"  \n\t"\
-        "pmulhw                           %%mm0, %%mm2      \n\t"\
-        "pmulhw                           %%mm0, %%mm5      \n\t"\
-        "paddw                            %%mm2, %%mm3      \n\t"\
-        "paddw                            %%mm5, %%mm4      \n\t"\
-        " jnz                                1b             \n\t"\
-        "psraw                               $3, %%mm3      \n\t"\
-        "psraw                               $3, %%mm4      \n\t"\
-        "packuswb                         %%mm4, %%mm3      \n\t"\
-        MOVNTQ(%%mm3, (%1, %%REGa))\
-        "add                                 $8, %%"REG_a"  \n\t"\
-        "cmp                                 %2, %%"REG_a"  \n\t"\
-        "movq             "VROUNDER_OFFSET"(%0), %%mm3      \n\t"\
-        "movq                             %%mm3, %%mm4      \n\t"\
-        "lea                     " offset "(%0), %%"REG_d"  \n\t"\
-        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
-        "jb                                  1b             \n\t"\
-        :: "r" (&c->redDither),\
-        "r" (dest), "g" (width)\
-        : "%"REG_a, "%"REG_d, "%"REG_S\
-    );
-
-#define YSCALEYUV2YV12X_ACCURATE(x, offset, dest, width) \
-    __asm__ volatile(\
-        "lea                     " offset "(%0), %%"REG_d"  \n\t"\
-        "xor                          %%"REG_a", %%"REG_a"  \n\t"\
-        "pxor                             %%mm4, %%mm4      \n\t"\
-        "pxor                             %%mm5, %%mm5      \n\t"\
-        "pxor                             %%mm6, %%mm6      \n\t"\
-        "pxor                             %%mm7, %%mm7      \n\t"\
-        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
-        ASMALIGN(4) \
-        "1:                                                 \n\t"\
-        "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm0      \n\t" /* srcData */\
-        "movq 8+"  x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
-        "mov        "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S"  \n\t"\
-        "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm1      \n\t" /* srcData */\
-        "movq                             %%mm0, %%mm3      \n\t"\
-        "punpcklwd                        %%mm1, %%mm0      \n\t"\
-        "punpckhwd                        %%mm1, %%mm3      \n\t"\
-        "movq       "STR(APCK_COEF)"(%%"REG_d"), %%mm1      \n\t" /* filterCoeff */\
-        "pmaddwd                          %%mm1, %%mm0      \n\t"\
-        "pmaddwd                          %%mm1, %%mm3      \n\t"\
-        "paddd                            %%mm0, %%mm4      \n\t"\
-        "paddd                            %%mm3, %%mm5      \n\t"\
-        "movq 8+"  x "(%%"REG_S", %%"REG_a", 2), %%mm3      \n\t" /* srcData */\
-        "mov        "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S"  \n\t"\
-        "add                  $"STR(APCK_SIZE)", %%"REG_d"  \n\t"\
-        "test                         %%"REG_S", %%"REG_S"  \n\t"\
-        "movq                             %%mm2, %%mm0      \n\t"\
-        "punpcklwd                        %%mm3, %%mm2      \n\t"\
-        "punpckhwd                        %%mm3, %%mm0      \n\t"\
-        "pmaddwd                          %%mm1, %%mm2      \n\t"\
-        "pmaddwd                          %%mm1, %%mm0      \n\t"\
-        "paddd                            %%mm2, %%mm6      \n\t"\
-        "paddd                            %%mm0, %%mm7      \n\t"\
-        " jnz                                1b             \n\t"\
-        "psrad                              $16, %%mm4      \n\t"\
-        "psrad                              $16, %%mm5      \n\t"\
-        "psrad                              $16, %%mm6      \n\t"\
-        "psrad                              $16, %%mm7      \n\t"\
-        "movq             "VROUNDER_OFFSET"(%0), %%mm0      \n\t"\
-        "packssdw                         %%mm5, %%mm4      \n\t"\
-        "packssdw                         %%mm7, %%mm6      \n\t"\
-        "paddw                            %%mm0, %%mm4      \n\t"\
-        "paddw                            %%mm0, %%mm6      \n\t"\
-        "psraw                               $3, %%mm4      \n\t"\
-        "psraw                               $3, %%mm6      \n\t"\
-        "packuswb                         %%mm6, %%mm4      \n\t"\
-        MOVNTQ(%%mm4, (%1, %%REGa))\
-        "add                                 $8, %%"REG_a"  \n\t"\
-        "cmp                                 %2, %%"REG_a"  \n\t"\
-        "lea                     " offset "(%0), %%"REG_d"  \n\t"\
-        "pxor                             %%mm4, %%mm4      \n\t"\
-        "pxor                             %%mm5, %%mm5      \n\t"\
-        "pxor                             %%mm6, %%mm6      \n\t"\
-        "pxor                             %%mm7, %%mm7      \n\t"\
-        "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
-        "jb                                  1b             \n\t"\
-        :: "r" (&c->redDither),\
-        "r" (dest), "g" (width)\
-        : "%"REG_a, "%"REG_d, "%"REG_S\
-    );
-
-#define YSCALEYUV2YV121 \
-    "mov %2, %%"REG_a"                    \n\t"\
-    ASMALIGN(4) /* FIXME Unroll? */\
-    "1:                                   \n\t"\
-    "movq  (%0, %%"REG_a", 2), %%mm0      \n\t"\
-    "movq 8(%0, %%"REG_a", 2), %%mm1      \n\t"\
-    "psraw                 $7, %%mm0      \n\t"\
-    "psraw                 $7, %%mm1      \n\t"\
-    "packuswb           %%mm1, %%mm0      \n\t"\
-    MOVNTQ(%%mm0, (%1, %%REGa))\
-    "add                   $8, %%"REG_a"  \n\t"\
-    "jnc                   1b             \n\t"
-
-#define YSCALEYUV2YV121_ACCURATE \
-    "mov %2, %%"REG_a"                    \n\t"\
-    "pcmpeqw %%mm7, %%mm7                 \n\t"\
-    "psrlw                 $15, %%mm7     \n\t"\
-    "psllw                  $6, %%mm7     \n\t"\
-    ASMALIGN(4) /* FIXME Unroll? */\
-    "1:                                   \n\t"\
-    "movq  (%0, %%"REG_a", 2), %%mm0      \n\t"\
-    "movq 8(%0, %%"REG_a", 2), %%mm1      \n\t"\
-    "paddsw             %%mm7, %%mm0      \n\t"\
-    "paddsw             %%mm7, %%mm1      \n\t"\
-    "psraw                 $7, %%mm0      \n\t"\
-    "psraw                 $7, %%mm1      \n\t"\
-    "packuswb           %%mm1, %%mm0      \n\t"\
-    MOVNTQ(%%mm0, (%1, %%REGa))\
-    "add                   $8, %%"REG_a"  \n\t"\
-    "jnc                   1b             \n\t"
-
-/*
-    :: "m" (-lumFilterSize), "m" (-chrFilterSize),
-       "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4),
-       "r" (dest), "m" (dstW),
-       "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize)
-    : "%eax", "%ebx", "%ecx", "%edx", "%esi"
-*/
-#define YSCALEYUV2PACKEDX_UV \
-    __asm__ volatile(\
-        "xor                   %%"REG_a", %%"REG_a"     \n\t"\
-        ASMALIGN(4)\
-        "nop                                            \n\t"\
-        "1:                                             \n\t"\
-        "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d"     \n\t"\
-        "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
-        "movq      "VROUNDER_OFFSET"(%0), %%mm3         \n\t"\
-        "movq                      %%mm3, %%mm4         \n\t"\
-        ASMALIGN(4)\
-        "2:                                             \n\t"\
-        "movq               8(%%"REG_d"), %%mm0         \n\t" /* filterCoeff */\
-        "movq     (%%"REG_S", %%"REG_a"), %%mm2         \n\t" /* UsrcData */\
-        "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm5         \n\t" /* VsrcData */\
-        "add                         $16, %%"REG_d"     \n\t"\
-        "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
-        "pmulhw                    %%mm0, %%mm2         \n\t"\
-        "pmulhw                    %%mm0, %%mm5         \n\t"\
-        "paddw                     %%mm2, %%mm3         \n\t"\
-        "paddw                     %%mm5, %%mm4         \n\t"\
-        "test                  %%"REG_S", %%"REG_S"     \n\t"\
-        " jnz                         2b                \n\t"\
-
-#define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \
-    "lea                "offset"(%0), %%"REG_d"     \n\t"\
-    "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
-    "movq      "VROUNDER_OFFSET"(%0), "#dst1"       \n\t"\
-    "movq                    "#dst1", "#dst2"       \n\t"\
-    ASMALIGN(4)\
-    "2:                                             \n\t"\
-    "movq               8(%%"REG_d"), "#coeff"      \n\t" /* filterCoeff */\
-    "movq  (%%"REG_S", %%"REG_a", 2), "#src1"       \n\t" /* Y1srcData */\
-    "movq 8(%%"REG_S", %%"REG_a", 2), "#src2"       \n\t" /* Y2srcData */\
-    "add                         $16, %%"REG_d"            \n\t"\
-    "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
-    "pmulhw                 "#coeff", "#src1"       \n\t"\
-    "pmulhw                 "#coeff", "#src2"       \n\t"\
-    "paddw                   "#src1", "#dst1"       \n\t"\
-    "paddw                   "#src2", "#dst2"       \n\t"\
-    "test                  %%"REG_S", %%"REG_S"     \n\t"\
-    " jnz                         2b                \n\t"\
-
-#define YSCALEYUV2PACKEDX \
-    YSCALEYUV2PACKEDX_UV \
-    YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \
-
-#define YSCALEYUV2PACKEDX_END                     \
-        :: "r" (&c->redDither),                   \
-            "m" (dummy), "m" (dummy), "m" (dummy),\
-            "r" (dest), "m" (dstW)                \
-        : "%"REG_a, "%"REG_d, "%"REG_S            \
-    );
-
-#define YSCALEYUV2PACKEDX_ACCURATE_UV \
-    __asm__ volatile(\
-        "xor %%"REG_a", %%"REG_a"                       \n\t"\
-        ASMALIGN(4)\
-        "nop                                            \n\t"\
-        "1:                                             \n\t"\
-        "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d"     \n\t"\
-        "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
-        "pxor                      %%mm4, %%mm4         \n\t"\
-        "pxor                      %%mm5, %%mm5         \n\t"\
-        "pxor                      %%mm6, %%mm6         \n\t"\
-        "pxor                      %%mm7, %%mm7         \n\t"\
-        ASMALIGN(4)\
-        "2:                                             \n\t"\
-        "movq     (%%"REG_S", %%"REG_a"), %%mm0         \n\t" /* UsrcData */\
-        "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm2         \n\t" /* VsrcData */\
-        "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S"     \n\t"\
-        "movq     (%%"REG_S", %%"REG_a"), %%mm1         \n\t" /* UsrcData */\
-        "movq                      %%mm0, %%mm3         \n\t"\
-        "punpcklwd                 %%mm1, %%mm0         \n\t"\
-        "punpckhwd                 %%mm1, %%mm3         \n\t"\
-        "movq "STR(APCK_COEF)"(%%"REG_d"),%%mm1         \n\t" /* filterCoeff */\
-        "pmaddwd                   %%mm1, %%mm0         \n\t"\
-        "pmaddwd                   %%mm1, %%mm3         \n\t"\
-        "paddd                     %%mm0, %%mm4         \n\t"\
-        "paddd                     %%mm3, %%mm5         \n\t"\
-        "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm3         \n\t" /* VsrcData */\
-        "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S"     \n\t"\
-        "add           $"STR(APCK_SIZE)", %%"REG_d"     \n\t"\
-        "test                  %%"REG_S", %%"REG_S"     \n\t"\
-        "movq                      %%mm2, %%mm0         \n\t"\
-        "punpcklwd                 %%mm3, %%mm2         \n\t"\
-        "punpckhwd                 %%mm3, %%mm0         \n\t"\
-        "pmaddwd                   %%mm1, %%mm2         \n\t"\
-        "pmaddwd                   %%mm1, %%mm0         \n\t"\
-        "paddd                     %%mm2, %%mm6         \n\t"\
-        "paddd                     %%mm0, %%mm7         \n\t"\
-        " jnz                         2b                \n\t"\
-        "psrad                       $16, %%mm4         \n\t"\
-        "psrad                       $16, %%mm5         \n\t"\
-        "psrad                       $16, %%mm6         \n\t"\
-        "psrad                       $16, %%mm7         \n\t"\
-        "movq      "VROUNDER_OFFSET"(%0), %%mm0         \n\t"\
-        "packssdw                  %%mm5, %%mm4         \n\t"\
-        "packssdw                  %%mm7, %%mm6         \n\t"\
-        "paddw                     %%mm0, %%mm4         \n\t"\
-        "paddw                     %%mm0, %%mm6         \n\t"\
-        "movq                      %%mm4, "U_TEMP"(%0)  \n\t"\
-        "movq                      %%mm6, "V_TEMP"(%0)  \n\t"\
-
-#define YSCALEYUV2PACKEDX_ACCURATE_YA(offset) \
-    "lea                "offset"(%0), %%"REG_d"     \n\t"\
-    "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
-    "pxor                      %%mm1, %%mm1         \n\t"\
-    "pxor                      %%mm5, %%mm5         \n\t"\
-    "pxor                      %%mm7, %%mm7         \n\t"\
-    "pxor                      %%mm6, %%mm6         \n\t"\
-    ASMALIGN(4)\
-    "2:                                             \n\t"\
-    "movq  (%%"REG_S", %%"REG_a", 2), %%mm0         \n\t" /* Y1srcData */\
-    "movq 8(%%"REG_S", %%"REG_a", 2), %%mm2         \n\t" /* Y2srcData */\
-    "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S"     \n\t"\
-    "movq  (%%"REG_S", %%"REG_a", 2), %%mm4         \n\t" /* Y1srcData */\
-    "movq                      %%mm0, %%mm3         \n\t"\
-    "punpcklwd                 %%mm4, %%mm0         \n\t"\
-    "punpckhwd                 %%mm4, %%mm3         \n\t"\
-    "movq "STR(APCK_COEF)"(%%"REG_d"), %%mm4         \n\t" /* filterCoeff */\
-    "pmaddwd                   %%mm4, %%mm0         \n\t"\
-    "pmaddwd                   %%mm4, %%mm3         \n\t"\
-    "paddd                     %%mm0, %%mm1         \n\t"\
-    "paddd                     %%mm3, %%mm5         \n\t"\
-    "movq 8(%%"REG_S", %%"REG_a", 2), %%mm3         \n\t" /* Y2srcData */\
-    "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S"     \n\t"\
-    "add           $"STR(APCK_SIZE)", %%"REG_d"     \n\t"\
-    "test                  %%"REG_S", %%"REG_S"     \n\t"\
-    "movq                      %%mm2, %%mm0         \n\t"\
-    "punpcklwd                 %%mm3, %%mm2         \n\t"\
-    "punpckhwd                 %%mm3, %%mm0         \n\t"\
-    "pmaddwd                   %%mm4, %%mm2         \n\t"\
-    "pmaddwd                   %%mm4, %%mm0         \n\t"\
-    "paddd                     %%mm2, %%mm7         \n\t"\
-    "paddd                     %%mm0, %%mm6         \n\t"\
-    " jnz                         2b                \n\t"\
-    "psrad                       $16, %%mm1         \n\t"\
-    "psrad                       $16, %%mm5         \n\t"\
-    "psrad                       $16, %%mm7         \n\t"\
-    "psrad                       $16, %%mm6         \n\t"\
-    "movq      "VROUNDER_OFFSET"(%0), %%mm0         \n\t"\
-    "packssdw                  %%mm5, %%mm1         \n\t"\
-    "packssdw                  %%mm6, %%mm7         \n\t"\
-    "paddw                     %%mm0, %%mm1         \n\t"\
-    "paddw                     %%mm0, %%mm7         \n\t"\
-    "movq               "U_TEMP"(%0), %%mm3         \n\t"\
-    "movq               "V_TEMP"(%0), %%mm4         \n\t"\
-
-#define YSCALEYUV2PACKEDX_ACCURATE \
-    YSCALEYUV2PACKEDX_ACCURATE_UV \
-    YSCALEYUV2PACKEDX_ACCURATE_YA(LUM_MMX_FILTER_OFFSET)
-
-#define YSCALEYUV2RGBX \
-    "psubw  "U_OFFSET"(%0), %%mm3       \n\t" /* (U-128)8*/\
-    "psubw  "V_OFFSET"(%0), %%mm4       \n\t" /* (V-128)8*/\
-    "movq            %%mm3, %%mm2       \n\t" /* (U-128)8*/\
-    "movq            %%mm4, %%mm5       \n\t" /* (V-128)8*/\
-    "pmulhw "UG_COEFF"(%0), %%mm3       \n\t"\
-    "pmulhw "VG_COEFF"(%0), %%mm4       \n\t"\
-    /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
-    "pmulhw "UB_COEFF"(%0), %%mm2       \n\t"\
-    "pmulhw "VR_COEFF"(%0), %%mm5       \n\t"\
-    "psubw  "Y_OFFSET"(%0), %%mm1       \n\t" /* 8(Y-16)*/\
-    "psubw  "Y_OFFSET"(%0), %%mm7       \n\t" /* 8(Y-16)*/\
-    "pmulhw  "Y_COEFF"(%0), %%mm1       \n\t"\
-    "pmulhw  "Y_COEFF"(%0), %%mm7       \n\t"\
-    /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
-    "paddw           %%mm3, %%mm4       \n\t"\
-    "movq            %%mm2, %%mm0       \n\t"\
-    "movq            %%mm5, %%mm6       \n\t"\
-    "movq            %%mm4, %%mm3       \n\t"\
-    "punpcklwd       %%mm2, %%mm2       \n\t"\
-    "punpcklwd       %%mm5, %%mm5       \n\t"\
-    "punpcklwd       %%mm4, %%mm4       \n\t"\
-    "paddw           %%mm1, %%mm2       \n\t"\
-    "paddw           %%mm1, %%mm5       \n\t"\
-    "paddw           %%mm1, %%mm4       \n\t"\
-    "punpckhwd       %%mm0, %%mm0       \n\t"\
-    "punpckhwd       %%mm6, %%mm6       \n\t"\
-    "punpckhwd       %%mm3, %%mm3       \n\t"\
-    "paddw           %%mm7, %%mm0       \n\t"\
-    "paddw           %%mm7, %%mm6       \n\t"\
-    "paddw           %%mm7, %%mm3       \n\t"\
-    /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
-    "packuswb        %%mm0, %%mm2       \n\t"\
-    "packuswb        %%mm6, %%mm5       \n\t"\
-    "packuswb        %%mm3, %%mm4       \n\t"\
-
-#define REAL_YSCALEYUV2PACKED(index, c) \
-    "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0              \n\t"\
-    "movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1              \n\t"\
-    "psraw                $3, %%mm0                           \n\t"\
-    "psraw                $3, %%mm1                           \n\t"\
-    "movq              %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\
-    "movq              %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\
-    "xor            "#index", "#index"                        \n\t"\
-    ASMALIGN(4)\
-    "1:                                 \n\t"\
-    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
-    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
-    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
-    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
-    "psubw             %%mm3, %%mm2     \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
-    "psubw             %%mm4, %%mm5     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
-    "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0    \n\t"\
-    "pmulhw            %%mm0, %%mm2     \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\
-    "pmulhw            %%mm0, %%mm5     \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\
-    "psraw                $7, %%mm3     \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
-    "psraw                $7, %%mm4     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
-    "paddw             %%mm2, %%mm3     \n\t" /* uvbuf0[eax]uvalpha1 - uvbuf1[eax](1-uvalpha1)*/\
-    "paddw             %%mm5, %%mm4     \n\t" /* uvbuf0[eax+2048]uvalpha1 - uvbuf1[eax+2048](1-uvalpha1)*/\
-    "movq  (%0, "#index", 2), %%mm0     \n\t" /*buf0[eax]*/\
-    "movq  (%1, "#index", 2), %%mm1     \n\t" /*buf1[eax]*/\
-    "movq 8(%0, "#index", 2), %%mm6     \n\t" /*buf0[eax]*/\
-    "movq 8(%1, "#index", 2), %%mm7     \n\t" /*buf1[eax]*/\
-    "psubw             %%mm1, %%mm0     \n\t" /* buf0[eax] - buf1[eax]*/\
-    "psubw             %%mm7, %%mm6     \n\t" /* buf0[eax] - buf1[eax]*/\
-    "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0  \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
-    "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6  \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
-    "psraw                $7, %%mm1     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "psraw                $7, %%mm7     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "paddw             %%mm0, %%mm1     \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
-    "paddw             %%mm6, %%mm7     \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
-
-#define YSCALEYUV2PACKED(index, c)  REAL_YSCALEYUV2PACKED(index, c)
-
-#define REAL_YSCALEYUV2RGB_UV(index, c) \
-    "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
-    "1:                                 \n\t"\
-    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
-    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
-    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
-    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
-    "psubw             %%mm3, %%mm2     \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
-    "psubw             %%mm4, %%mm5     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
-    "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0    \n\t"\
-    "pmulhw            %%mm0, %%mm2     \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\
-    "pmulhw            %%mm0, %%mm5     \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\
-    "psraw                $4, %%mm3     \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
-    "psraw                $4, %%mm4     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
-    "paddw             %%mm2, %%mm3     \n\t" /* uvbuf0[eax]uvalpha1 - uvbuf1[eax](1-uvalpha1)*/\
-    "paddw             %%mm5, %%mm4     \n\t" /* uvbuf0[eax+2048]uvalpha1 - uvbuf1[eax+2048](1-uvalpha1)*/\
-    "psubw  "U_OFFSET"("#c"), %%mm3     \n\t" /* (U-128)8*/\
-    "psubw  "V_OFFSET"("#c"), %%mm4     \n\t" /* (V-128)8*/\
-    "movq              %%mm3, %%mm2     \n\t" /* (U-128)8*/\
-    "movq              %%mm4, %%mm5     \n\t" /* (V-128)8*/\
-    "pmulhw "UG_COEFF"("#c"), %%mm3     \n\t"\
-    "pmulhw "VG_COEFF"("#c"), %%mm4     \n\t"\
-    /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
-
-#define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \
-    "movq  ("#b1", "#index", 2), %%mm0     \n\t" /*buf0[eax]*/\
-    "movq  ("#b2", "#index", 2), %%mm1     \n\t" /*buf1[eax]*/\
-    "movq 8("#b1", "#index", 2), %%mm6     \n\t" /*buf0[eax]*/\
-    "movq 8("#b2", "#index", 2), %%mm7     \n\t" /*buf1[eax]*/\
-    "psubw             %%mm1, %%mm0     \n\t" /* buf0[eax] - buf1[eax]*/\
-    "psubw             %%mm7, %%mm6     \n\t" /* buf0[eax] - buf1[eax]*/\
-    "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0  \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
-    "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6  \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
-    "psraw                $4, %%mm1     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "psraw                $4, %%mm7     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "paddw             %%mm0, %%mm1     \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
-    "paddw             %%mm6, %%mm7     \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
-
-#define REAL_YSCALEYUV2RGB_COEFF(c) \
-    "pmulhw "UB_COEFF"("#c"), %%mm2     \n\t"\
-    "pmulhw "VR_COEFF"("#c"), %%mm5     \n\t"\
-    "psubw  "Y_OFFSET"("#c"), %%mm1     \n\t" /* 8(Y-16)*/\
-    "psubw  "Y_OFFSET"("#c"), %%mm7     \n\t" /* 8(Y-16)*/\
-    "pmulhw  "Y_COEFF"("#c"), %%mm1     \n\t"\
-    "pmulhw  "Y_COEFF"("#c"), %%mm7     \n\t"\
-    /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
-    "paddw             %%mm3, %%mm4     \n\t"\
-    "movq              %%mm2, %%mm0     \n\t"\
-    "movq              %%mm5, %%mm6     \n\t"\
-    "movq              %%mm4, %%mm3     \n\t"\
-    "punpcklwd         %%mm2, %%mm2     \n\t"\
-    "punpcklwd         %%mm5, %%mm5     \n\t"\
-    "punpcklwd         %%mm4, %%mm4     \n\t"\
-    "paddw             %%mm1, %%mm2     \n\t"\
-    "paddw             %%mm1, %%mm5     \n\t"\
-    "paddw             %%mm1, %%mm4     \n\t"\
-    "punpckhwd         %%mm0, %%mm0     \n\t"\
-    "punpckhwd         %%mm6, %%mm6     \n\t"\
-    "punpckhwd         %%mm3, %%mm3     \n\t"\
-    "paddw             %%mm7, %%mm0     \n\t"\
-    "paddw             %%mm7, %%mm6     \n\t"\
-    "paddw             %%mm7, %%mm3     \n\t"\
-    /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
-    "packuswb          %%mm0, %%mm2     \n\t"\
-    "packuswb          %%mm6, %%mm5     \n\t"\
-    "packuswb          %%mm3, %%mm4     \n\t"\
-
-#define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2)
-
-#define YSCALEYUV2RGB(index, c) \
-    REAL_YSCALEYUV2RGB_UV(index, c) \
-    REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \
-    REAL_YSCALEYUV2RGB_COEFF(c)
-
-#define REAL_YSCALEYUV2PACKED1(index, c) \
-    "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
-    "1:                                 \n\t"\
-    "movq     (%2, "#index"), %%mm3     \n\t" /* uvbuf0[eax]*/\
-    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
-    "psraw                $7, %%mm3     \n\t" \
-    "psraw                $7, %%mm4     \n\t" \
-    "movq  (%0, "#index", 2), %%mm1     \n\t" /*buf0[eax]*/\
-    "movq 8(%0, "#index", 2), %%mm7     \n\t" /*buf0[eax]*/\
-    "psraw                $7, %%mm1     \n\t" \
-    "psraw                $7, %%mm7     \n\t" \
-
-#define YSCALEYUV2PACKED1(index, c)  REAL_YSCALEYUV2PACKED1(index, c)
-
-#define REAL_YSCALEYUV2RGB1(index, c) \
-    "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
-    "1:                                 \n\t"\
-    "movq     (%2, "#index"), %%mm3     \n\t" /* uvbuf0[eax]*/\
-    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
-    "psraw                $4, %%mm3     \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
-    "psraw                $4, %%mm4     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
-    "psubw  "U_OFFSET"("#c"), %%mm3     \n\t" /* (U-128)8*/\
-    "psubw  "V_OFFSET"("#c"), %%mm4     \n\t" /* (V-128)8*/\
-    "movq              %%mm3, %%mm2     \n\t" /* (U-128)8*/\
-    "movq              %%mm4, %%mm5     \n\t" /* (V-128)8*/\
-    "pmulhw "UG_COEFF"("#c"), %%mm3     \n\t"\
-    "pmulhw "VG_COEFF"("#c"), %%mm4     \n\t"\
-    /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
-    "movq  (%0, "#index", 2), %%mm1     \n\t" /*buf0[eax]*/\
-    "movq 8(%0, "#index", 2), %%mm7     \n\t" /*buf0[eax]*/\
-    "psraw                $4, %%mm1     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "psraw                $4, %%mm7     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "pmulhw "UB_COEFF"("#c"), %%mm2     \n\t"\
-    "pmulhw "VR_COEFF"("#c"), %%mm5     \n\t"\
-    "psubw  "Y_OFFSET"("#c"), %%mm1     \n\t" /* 8(Y-16)*/\
-    "psubw  "Y_OFFSET"("#c"), %%mm7     \n\t" /* 8(Y-16)*/\
-    "pmulhw  "Y_COEFF"("#c"), %%mm1     \n\t"\
-    "pmulhw  "Y_COEFF"("#c"), %%mm7     \n\t"\
-    /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
-    "paddw             %%mm3, %%mm4     \n\t"\
-    "movq              %%mm2, %%mm0     \n\t"\
-    "movq              %%mm5, %%mm6     \n\t"\
-    "movq              %%mm4, %%mm3     \n\t"\
-    "punpcklwd         %%mm2, %%mm2     \n\t"\
-    "punpcklwd         %%mm5, %%mm5     \n\t"\
-    "punpcklwd         %%mm4, %%mm4     \n\t"\
-    "paddw             %%mm1, %%mm2     \n\t"\
-    "paddw             %%mm1, %%mm5     \n\t"\
-    "paddw             %%mm1, %%mm4     \n\t"\
-    "punpckhwd         %%mm0, %%mm0     \n\t"\
-    "punpckhwd         %%mm6, %%mm6     \n\t"\
-    "punpckhwd         %%mm3, %%mm3     \n\t"\
-    "paddw             %%mm7, %%mm0     \n\t"\
-    "paddw             %%mm7, %%mm6     \n\t"\
-    "paddw             %%mm7, %%mm3     \n\t"\
-    /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
-    "packuswb          %%mm0, %%mm2     \n\t"\
-    "packuswb          %%mm6, %%mm5     \n\t"\
-    "packuswb          %%mm3, %%mm4     \n\t"\
-
-#define YSCALEYUV2RGB1(index, c)  REAL_YSCALEYUV2RGB1(index, c)
-
-#define REAL_YSCALEYUV2PACKED1b(index, c) \
-    "xor "#index", "#index"             \n\t"\
-    ASMALIGN(4)\
-    "1:                                 \n\t"\
-    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
-    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
-    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
-    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
-    "paddw             %%mm2, %%mm3     \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\
-    "paddw             %%mm5, %%mm4     \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\
-    "psrlw                $8, %%mm3     \n\t" \
-    "psrlw                $8, %%mm4     \n\t" \
-    "movq  (%0, "#index", 2), %%mm1     \n\t" /*buf0[eax]*/\
-    "movq 8(%0, "#index", 2), %%mm7     \n\t" /*buf0[eax]*/\
-    "psraw                $7, %%mm1     \n\t" \
-    "psraw                $7, %%mm7     \n\t"
-#define YSCALEYUV2PACKED1b(index, c)  REAL_YSCALEYUV2PACKED1b(index, c)
-
-// do vertical chrominance interpolation
-#define REAL_YSCALEYUV2RGB1b(index, c) \
-    "xor            "#index", "#index"  \n\t"\
-    ASMALIGN(4)\
-    "1:                                 \n\t"\
-    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
-    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
-    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
-    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
-    "paddw             %%mm2, %%mm3     \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\
-    "paddw             %%mm5, %%mm4     \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\
-    "psrlw                $5, %%mm3     \n\t" /*FIXME might overflow*/\
-    "psrlw                $5, %%mm4     \n\t" /*FIXME might overflow*/\
-    "psubw  "U_OFFSET"("#c"), %%mm3     \n\t" /* (U-128)8*/\
-    "psubw  "V_OFFSET"("#c"), %%mm4     \n\t" /* (V-128)8*/\
-    "movq              %%mm3, %%mm2     \n\t" /* (U-128)8*/\
-    "movq              %%mm4, %%mm5     \n\t" /* (V-128)8*/\
-    "pmulhw "UG_COEFF"("#c"), %%mm3     \n\t"\
-    "pmulhw "VG_COEFF"("#c"), %%mm4     \n\t"\
-    /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
-    "movq  (%0, "#index", 2), %%mm1     \n\t" /*buf0[eax]*/\
-    "movq 8(%0, "#index", 2), %%mm7     \n\t" /*buf0[eax]*/\
-    "psraw                $4, %%mm1     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "psraw                $4, %%mm7     \n\t" /* buf0[eax] - buf1[eax] >>4*/\
-    "pmulhw "UB_COEFF"("#c"), %%mm2     \n\t"\
-    "pmulhw "VR_COEFF"("#c"), %%mm5     \n\t"\
-    "psubw  "Y_OFFSET"("#c"), %%mm1     \n\t" /* 8(Y-16)*/\
-    "psubw  "Y_OFFSET"("#c"), %%mm7     \n\t" /* 8(Y-16)*/\
-    "pmulhw  "Y_COEFF"("#c"), %%mm1     \n\t"\
-    "pmulhw  "Y_COEFF"("#c"), %%mm7     \n\t"\
-    /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
-    "paddw             %%mm3, %%mm4     \n\t"\
-    "movq              %%mm2, %%mm0     \n\t"\
-    "movq              %%mm5, %%mm6     \n\t"\
-    "movq              %%mm4, %%mm3     \n\t"\
-    "punpcklwd         %%mm2, %%mm2     \n\t"\
-    "punpcklwd         %%mm5, %%mm5     \n\t"\
-    "punpcklwd         %%mm4, %%mm4     \n\t"\
-    "paddw             %%mm1, %%mm2     \n\t"\
-    "paddw             %%mm1, %%mm5     \n\t"\
-    "paddw             %%mm1, %%mm4     \n\t"\
-    "punpckhwd         %%mm0, %%mm0     \n\t"\
-    "punpckhwd         %%mm6, %%mm6     \n\t"\
-    "punpckhwd         %%mm3, %%mm3     \n\t"\
-    "paddw             %%mm7, %%mm0     \n\t"\
-    "paddw             %%mm7, %%mm6     \n\t"\
-    "paddw             %%mm7, %%mm3     \n\t"\
-    /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
-    "packuswb          %%mm0, %%mm2     \n\t"\
-    "packuswb          %%mm6, %%mm5     \n\t"\
-    "packuswb          %%mm3, %%mm4     \n\t"\
-
-#define YSCALEYUV2RGB1b(index, c)  REAL_YSCALEYUV2RGB1b(index, c)
-
-#define REAL_YSCALEYUV2RGB1_ALPHA(index) \
-    "movq  (%1, "#index", 2), %%mm7     \n\t" /* abuf0[index  ]     */\
-    "movq 8(%1, "#index", 2), %%mm1     \n\t" /* abuf0[index+4]     */\
-    "psraw                $7, %%mm7     \n\t" /* abuf0[index  ] >>7 */\
-    "psraw                $7, %%mm1     \n\t" /* abuf0[index+4] >>7 */\
-    "packuswb          %%mm1, %%mm7     \n\t"
-#define YSCALEYUV2RGB1_ALPHA(index) REAL_YSCALEYUV2RGB1_ALPHA(index)
-
-#define REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) \
-    "movq       "#b", "#q2"     \n\t" /* B */\
-    "movq       "#r", "#t"      \n\t" /* R */\
-    "punpcklbw  "#g", "#b"      \n\t" /* GBGBGBGB 0 */\
-    "punpcklbw  "#a", "#r"      \n\t" /* ARARARAR 0 */\
-    "punpckhbw  "#g", "#q2"     \n\t" /* GBGBGBGB 2 */\
-    "punpckhbw  "#a", "#t"      \n\t" /* ARARARAR 2 */\
-    "movq       "#b", "#q0"     \n\t" /* GBGBGBGB 0 */\
-    "movq      "#q2", "#q3"     \n\t" /* GBGBGBGB 2 */\
-    "punpcklwd  "#r", "#q0"     \n\t" /* ARGBARGB 0 */\
-    "punpckhwd  "#r", "#b"      \n\t" /* ARGBARGB 1 */\
-    "punpcklwd  "#t", "#q2"     \n\t" /* ARGBARGB 2 */\
-    "punpckhwd  "#t", "#q3"     \n\t" /* ARGBARGB 3 */\
-\
-    MOVNTQ(   q0,   (dst, index, 4))\
-    MOVNTQ(    b,  8(dst, index, 4))\
-    MOVNTQ(   q2, 16(dst, index, 4))\
-    MOVNTQ(   q3, 24(dst, index, 4))\
-\
-    "add      $8, "#index"      \n\t"\
-    "cmp "#dstw", "#index"      \n\t"\
-    " jb      1b                \n\t"
-#define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)  REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)
-
-#define REAL_WRITERGB16(dst, dstw, index) \
-    "pand "MANGLE(bF8)", %%mm2  \n\t" /* B */\
-    "pand "MANGLE(bFC)", %%mm4  \n\t" /* G */\
-    "pand "MANGLE(bF8)", %%mm5  \n\t" /* R */\
-    "psrlq           $3, %%mm2  \n\t"\
-\
-    "movq         %%mm2, %%mm1  \n\t"\
-    "movq         %%mm4, %%mm3  \n\t"\
-\
-    "punpcklbw    %%mm7, %%mm3  \n\t"\
-    "punpcklbw    %%mm5, %%mm2  \n\t"\
-    "punpckhbw    %%mm7, %%mm4  \n\t"\
-    "punpckhbw    %%mm5, %%mm1  \n\t"\
-\
-    "psllq           $3, %%mm3  \n\t"\
-    "psllq           $3, %%mm4  \n\t"\
-\
-    "por          %%mm3, %%mm2  \n\t"\
-    "por          %%mm4, %%mm1  \n\t"\
-\
-    MOVNTQ(%%mm2,  (dst, index, 2))\
-    MOVNTQ(%%mm1, 8(dst, index, 2))\
-\
-    "add             $8, "#index"   \n\t"\
-    "cmp        "#dstw", "#index"   \n\t"\
-    " jb             1b             \n\t"
-#define WRITERGB16(dst, dstw, index)  REAL_WRITERGB16(dst, dstw, index)
-
-#define REAL_WRITERGB15(dst, dstw, index) \
-    "pand "MANGLE(bF8)", %%mm2  \n\t" /* B */\
-    "pand "MANGLE(bF8)", %%mm4  \n\t" /* G */\
-    "pand "MANGLE(bF8)", %%mm5  \n\t" /* R */\
-    "psrlq           $3, %%mm2  \n\t"\
-    "psrlq           $1, %%mm5  \n\t"\
-\
-    "movq         %%mm2, %%mm1  \n\t"\
-    "movq         %%mm4, %%mm3  \n\t"\
-\
-    "punpcklbw    %%mm7, %%mm3  \n\t"\
-    "punpcklbw    %%mm5, %%mm2  \n\t"\
-    "punpckhbw    %%mm7, %%mm4  \n\t"\
-    "punpckhbw    %%mm5, %%mm1  \n\t"\
-\
-    "psllq           $2, %%mm3  \n\t"\
-    "psllq           $2, %%mm4  \n\t"\
-\
-    "por          %%mm3, %%mm2  \n\t"\
-    "por          %%mm4, %%mm1  \n\t"\
-\
-    MOVNTQ(%%mm2,  (dst, index, 2))\
-    MOVNTQ(%%mm1, 8(dst, index, 2))\
-\
-    "add             $8, "#index"   \n\t"\
-    "cmp        "#dstw", "#index"   \n\t"\
-    " jb             1b             \n\t"
-#define WRITERGB15(dst, dstw, index)  REAL_WRITERGB15(dst, dstw, index)
-
-#define WRITEBGR24OLD(dst, dstw, index) \
-    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
-    "movq      %%mm2, %%mm1             \n\t" /* B */\
-    "movq      %%mm5, %%mm6             \n\t" /* R */\
-    "punpcklbw %%mm4, %%mm2             \n\t" /* GBGBGBGB 0 */\
-    "punpcklbw %%mm7, %%mm5             \n\t" /* 0R0R0R0R 0 */\
-    "punpckhbw %%mm4, %%mm1             \n\t" /* GBGBGBGB 2 */\
-    "punpckhbw %%mm7, %%mm6             \n\t" /* 0R0R0R0R 2 */\
-    "movq      %%mm2, %%mm0             \n\t" /* GBGBGBGB 0 */\
-    "movq      %%mm1, %%mm3             \n\t" /* GBGBGBGB 2 */\
-    "punpcklwd %%mm5, %%mm0             \n\t" /* 0RGB0RGB 0 */\
-    "punpckhwd %%mm5, %%mm2             \n\t" /* 0RGB0RGB 1 */\
-    "punpcklwd %%mm6, %%mm1             \n\t" /* 0RGB0RGB 2 */\
-    "punpckhwd %%mm6, %%mm3             \n\t" /* 0RGB0RGB 3 */\
-\
-    "movq      %%mm0, %%mm4             \n\t" /* 0RGB0RGB 0 */\
-    "psrlq        $8, %%mm0             \n\t" /* 00RGB0RG 0 */\
-    "pand "MANGLE(bm00000111)", %%mm4   \n\t" /* 00000RGB 0 */\
-    "pand "MANGLE(bm11111000)", %%mm0   \n\t" /* 00RGB000 0.5 */\
-    "por       %%mm4, %%mm0             \n\t" /* 00RGBRGB 0 */\
-    "movq      %%mm2, %%mm4             \n\t" /* 0RGB0RGB 1 */\
-    "psllq       $48, %%mm2             \n\t" /* GB000000 1 */\
-    "por       %%mm2, %%mm0             \n\t" /* GBRGBRGB 0 */\
-\
-    "movq      %%mm4, %%mm2             \n\t" /* 0RGB0RGB 1 */\
-    "psrld       $16, %%mm4             \n\t" /* 000R000R 1 */\
-    "psrlq       $24, %%mm2             \n\t" /* 0000RGB0 1.5 */\
-    "por       %%mm4, %%mm2             \n\t" /* 000RRGBR 1 */\
-    "pand "MANGLE(bm00001111)", %%mm2   \n\t" /* 0000RGBR 1 */\
-    "movq      %%mm1, %%mm4             \n\t" /* 0RGB0RGB 2 */\
-    "psrlq        $8, %%mm1             \n\t" /* 00RGB0RG 2 */\
-    "pand "MANGLE(bm00000111)", %%mm4   \n\t" /* 00000RGB 2 */\
-    "pand "MANGLE(bm11111000)", %%mm1   \n\t" /* 00RGB000 2.5 */\
-    "por       %%mm4, %%mm1             \n\t" /* 00RGBRGB 2 */\
-    "movq      %%mm1, %%mm4             \n\t" /* 00RGBRGB 2 */\
-    "psllq       $32, %%mm1             \n\t" /* BRGB0000 2 */\
-    "por       %%mm1, %%mm2             \n\t" /* BRGBRGBR 1 */\
-\
-    "psrlq       $32, %%mm4             \n\t" /* 000000RG 2.5 */\
-    "movq      %%mm3, %%mm5             \n\t" /* 0RGB0RGB 3 */\
-    "psrlq        $8, %%mm3             \n\t" /* 00RGB0RG 3 */\
-    "pand "MANGLE(bm00000111)", %%mm5   \n\t" /* 00000RGB 3 */\
-    "pand "MANGLE(bm11111000)", %%mm3   \n\t" /* 00RGB000 3.5 */\
-    "por       %%mm5, %%mm3             \n\t" /* 00RGBRGB 3 */\
-    "psllq       $16, %%mm3             \n\t" /* RGBRGB00 3 */\
-    "por       %%mm4, %%mm3             \n\t" /* RGBRGBRG 2.5 */\
-\
-    MOVNTQ(%%mm0,   (dst))\
-    MOVNTQ(%%mm2,  8(dst))\
-    MOVNTQ(%%mm3, 16(dst))\
-    "add         $24, "#dst"            \n\t"\
-\
-    "add          $8, "#index"          \n\t"\
-    "cmp     "#dstw", "#index"          \n\t"\
-    " jb          1b                    \n\t"
-
-#define WRITEBGR24MMX(dst, dstw, index) \
-    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
-    "movq      %%mm2, %%mm1     \n\t" /* B */\
-    "movq      %%mm5, %%mm6     \n\t" /* R */\
-    "punpcklbw %%mm4, %%mm2     \n\t" /* GBGBGBGB 0 */\
-    "punpcklbw %%mm7, %%mm5     \n\t" /* 0R0R0R0R 0 */\
-    "punpckhbw %%mm4, %%mm1     \n\t" /* GBGBGBGB 2 */\
-    "punpckhbw %%mm7, %%mm6     \n\t" /* 0R0R0R0R 2 */\
-    "movq      %%mm2, %%mm0     \n\t" /* GBGBGBGB 0 */\
-    "movq      %%mm1, %%mm3     \n\t" /* GBGBGBGB 2 */\
-    "punpcklwd %%mm5, %%mm0     \n\t" /* 0RGB0RGB 0 */\
-    "punpckhwd %%mm5, %%mm2     \n\t" /* 0RGB0RGB 1 */\
-    "punpcklwd %%mm6, %%mm1     \n\t" /* 0RGB0RGB 2 */\
-    "punpckhwd %%mm6, %%mm3     \n\t" /* 0RGB0RGB 3 */\
-\
-    "movq      %%mm0, %%mm4     \n\t" /* 0RGB0RGB 0 */\
-    "movq      %%mm2, %%mm6     \n\t" /* 0RGB0RGB 1 */\
-    "movq      %%mm1, %%mm5     \n\t" /* 0RGB0RGB 2 */\
-    "movq      %%mm3, %%mm7     \n\t" /* 0RGB0RGB 3 */\
-\
-    "psllq       $40, %%mm0     \n\t" /* RGB00000 0 */\
-    "psllq       $40, %%mm2     \n\t" /* RGB00000 1 */\
-    "psllq       $40, %%mm1     \n\t" /* RGB00000 2 */\
-    "psllq       $40, %%mm3     \n\t" /* RGB00000 3 */\
-\
-    "punpckhdq %%mm4, %%mm0     \n\t" /* 0RGBRGB0 0 */\
-    "punpckhdq %%mm6, %%mm2     \n\t" /* 0RGBRGB0 1 */\
-    "punpckhdq %%mm5, %%mm1     \n\t" /* 0RGBRGB0 2 */\
-    "punpckhdq %%mm7, %%mm3     \n\t" /* 0RGBRGB0 3 */\
-\
-    "psrlq        $8, %%mm0     \n\t" /* 00RGBRGB 0 */\
-    "movq      %%mm2, %%mm6     \n\t" /* 0RGBRGB0 1 */\
-    "psllq       $40, %%mm2     \n\t" /* GB000000 1 */\
-    "por       %%mm2, %%mm0     \n\t" /* GBRGBRGB 0 */\
-    MOVNTQ(%%mm0, (dst))\
-\
-    "psrlq       $24, %%mm6     \n\t" /* 0000RGBR 1 */\
-    "movq      %%mm1, %%mm5     \n\t" /* 0RGBRGB0 2 */\
-    "psllq       $24, %%mm1     \n\t" /* BRGB0000 2 */\
-    "por       %%mm1, %%mm6     \n\t" /* BRGBRGBR 1 */\
-    MOVNTQ(%%mm6, 8(dst))\
-\
-    "psrlq       $40, %%mm5     \n\t" /* 000000RG 2 */\
-    "psllq        $8, %%mm3     \n\t" /* RGBRGB00 3 */\
-    "por       %%mm3, %%mm5     \n\t" /* RGBRGBRG 2 */\
-    MOVNTQ(%%mm5, 16(dst))\
-\
-    "add         $24, "#dst"    \n\t"\
-\
-    "add          $8, "#index"  \n\t"\
-    "cmp     "#dstw", "#index"  \n\t"\
-    " jb          1b            \n\t"
-
-#define WRITEBGR24MMX2(dst, dstw, index) \
-    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
-    "movq "MANGLE(ff_M24A)", %%mm0 \n\t"\
-    "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
-    "pshufw $0x50, %%mm2, %%mm1 \n\t" /* B3 B2 B3 B2  B1 B0 B1 B0 */\
-    "pshufw $0x50, %%mm4, %%mm3 \n\t" /* G3 G2 G3 G2  G1 G0 G1 G0 */\
-    "pshufw $0x00, %%mm5, %%mm6 \n\t" /* R1 R0 R1 R0  R1 R0 R1 R0 */\
-\
-    "pand   %%mm0, %%mm1        \n\t" /*    B2        B1       B0 */\
-    "pand   %%mm0, %%mm3        \n\t" /*    G2        G1       G0 */\
-    "pand   %%mm7, %%mm6        \n\t" /*       R1        R0       */\
-\
-    "psllq     $8, %%mm3        \n\t" /* G2        G1       G0    */\
-    "por    %%mm1, %%mm6        \n\t"\
-    "por    %%mm3, %%mm6        \n\t"\
-    MOVNTQ(%%mm6, (dst))\
-\
-    "psrlq     $8, %%mm4        \n\t" /* 00 G7 G6 G5  G4 G3 G2 G1 */\
-    "pshufw $0xA5, %%mm2, %%mm1 \n\t" /* B5 B4 B5 B4  B3 B2 B3 B2 */\
-    "pshufw $0x55, %%mm4, %%mm3 \n\t" /* G4 G3 G4 G3  G4 G3 G4 G3 */\
-    "pshufw $0xA5, %%mm5, %%mm6 \n\t" /* R5 R4 R5 R4  R3 R2 R3 R2 */\
-\
-    "pand "MANGLE(ff_M24B)", %%mm1 \n\t" /* B5       B4        B3    */\
-    "pand   %%mm7, %%mm3        \n\t" /*       G4        G3       */\
-    "pand   %%mm0, %%mm6        \n\t" /*    R4        R3       R2 */\
-\
-    "por    %%mm1, %%mm3        \n\t" /* B5    G4 B4     G3 B3    */\
-    "por    %%mm3, %%mm6        \n\t"\
-    MOVNTQ(%%mm6, 8(dst))\
-\
-    "pshufw $0xFF, %%mm2, %%mm1 \n\t" /* B7 B6 B7 B6  B7 B6 B6 B7 */\
-    "pshufw $0xFA, %%mm4, %%mm3 \n\t" /* 00 G7 00 G7  G6 G5 G6 G5 */\
-    "pshufw $0xFA, %%mm5, %%mm6 \n\t" /* R7 R6 R7 R6  R5 R4 R5 R4 */\
-\
-    "pand   %%mm7, %%mm1        \n\t" /*       B7        B6       */\
-    "pand   %%mm0, %%mm3        \n\t" /*    G7        G6       G5 */\
-    "pand "MANGLE(ff_M24B)", %%mm6 \n\t" /* R7       R6        R5    */\
-\
-    "por    %%mm1, %%mm3        \n\t"\
-    "por    %%mm3, %%mm6        \n\t"\
-    MOVNTQ(%%mm6, 16(dst))\
-\
-    "add      $24, "#dst"       \n\t"\
-\
-    "add       $8, "#index"     \n\t"\
-    "cmp  "#dstw", "#index"     \n\t"\
-    " jb       1b               \n\t"
-
-#if COMPILE_TEMPLATE_MMX2
-#undef WRITEBGR24
-#define WRITEBGR24(dst, dstw, index)  WRITEBGR24MMX2(dst, dstw, index)
-#else
-#undef WRITEBGR24
-#define WRITEBGR24(dst, dstw, index)  WRITEBGR24MMX(dst, dstw, index)
-#endif
-
-#define REAL_WRITEYUY2(dst, dstw, index) \
-    "packuswb  %%mm3, %%mm3     \n\t"\
-    "packuswb  %%mm4, %%mm4     \n\t"\
-    "packuswb  %%mm7, %%mm1     \n\t"\
-    "punpcklbw %%mm4, %%mm3     \n\t"\
-    "movq      %%mm1, %%mm7     \n\t"\
-    "punpcklbw %%mm3, %%mm1     \n\t"\
-    "punpckhbw %%mm3, %%mm7     \n\t"\
-\
-    MOVNTQ(%%mm1, (dst, index, 2))\
-    MOVNTQ(%%mm7, 8(dst, index, 2))\
-\
-    "add          $8, "#index"  \n\t"\
-    "cmp     "#dstw", "#index"  \n\t"\
-    " jb          1b            \n\t"
-#define WRITEYUY2(dst, dstw, index)  REAL_WRITEYUY2(dst, dstw, index)
-
-
-static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                    const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc,
-                                    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW)
-{
-#if COMPILE_TEMPLATE_MMX
-    if(!(c->flags & SWS_BITEXACT)) {
-        if (c->flags & SWS_ACCURATE_RND) {
-            if (uDest) {
-                YSCALEYUV2YV12X_ACCURATE(   "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
-                YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
-            }
-            if (CONFIG_SWSCALE_ALPHA && aDest) {
-                YSCALEYUV2YV12X_ACCURATE(   "0", ALP_MMX_FILTER_OFFSET, aDest, dstW)
-            }
-
-            YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW)
-        } else {
-            if (uDest) {
-                YSCALEYUV2YV12X(   "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
-                YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
-            }
-            if (CONFIG_SWSCALE_ALPHA && aDest) {
-                YSCALEYUV2YV12X(   "0", ALP_MMX_FILTER_OFFSET, aDest, dstW)
-            }
-
-            YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW)
-        }
-        return;
-    }
-#endif
-#if COMPILE_TEMPLATE_ALTIVEC
-    yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize,
-                          chrFilter, chrSrc, chrFilterSize,
-                          dest, uDest, vDest, dstW, chrDstW);
-#else //COMPILE_TEMPLATE_ALTIVEC
-    yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize,
-                chrFilter, chrSrc, chrFilterSize,
-                alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW);
-#endif //!COMPILE_TEMPLATE_ALTIVEC
-}
-
-static inline void RENAME(yuv2nv12X)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                     const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                                     uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, enum PixelFormat dstFormat)
-{
-    yuv2nv12XinC(lumFilter, lumSrc, lumFilterSize,
-                 chrFilter, chrSrc, chrFilterSize,
-                 dest, uDest, dstW, chrDstW, dstFormat);
-}
-
-static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const int16_t *chrSrc, const int16_t *alpSrc,
-                                    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW)
-{
-    int i;
-#if COMPILE_TEMPLATE_MMX
-    if(!(c->flags & SWS_BITEXACT)) {
-        long p= 4;
-        const uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW};
-        uint8_t *dst[4]= {aDest, dest, uDest, vDest};
-        x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW};
-
-        if (c->flags & SWS_ACCURATE_RND) {
-            while(p--) {
-                if (dst[p]) {
-                    __asm__ volatile(
-                        YSCALEYUV2YV121_ACCURATE
-                        :: "r" (src[p]), "r" (dst[p] + counter[p]),
-                        "g" (-counter[p])
-                        : "%"REG_a
-                    );
-                }
-            }
-        } else {
-            while(p--) {
-                if (dst[p]) {
-                    __asm__ volatile(
-                        YSCALEYUV2YV121
-                        :: "r" (src[p]), "r" (dst[p] + counter[p]),
-                        "g" (-counter[p])
-                        : "%"REG_a
-                    );
-                }
-            }
-        }
-        return;
-    }
-#endif
-    for (i=0; i<dstW; i++) {
-        int val= (lumSrc[i]+64)>>7;
-
-        if (val&256) {
-            if (val<0) val=0;
-            else       val=255;
-        }
-
-        dest[i]= val;
-    }
-
-    if (uDest)
-        for (i=0; i<chrDstW; i++) {
-            int u=(chrSrc[i       ]+64)>>7;
-            int v=(chrSrc[i + VOFW]+64)>>7;
-
-            if ((u|v)&256) {
-                if (u<0)        u=0;
-                else if (u>255) u=255;
-                if (v<0)        v=0;
-                else if (v>255) v=255;
-            }
-
-            uDest[i]= u;
-            vDest[i]= v;
-        }
-
-    if (CONFIG_SWSCALE_ALPHA && aDest)
-        for (i=0; i<dstW; i++) {
-            int val= (alpSrc[i]+64)>>7;
-            aDest[i]= av_clip_uint8(val);
-        }
-}
-
-
-/**
- * vertical scale YV12 to RGB
- */
-static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
-                                       const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
-                                       const int16_t **alpSrc, uint8_t *dest, long dstW, long dstY)
-{
-#if COMPILE_TEMPLATE_MMX
-    x86_reg dummy=0;
-    if(!(c->flags & SWS_BITEXACT)) {
-        if (c->flags & SWS_ACCURATE_RND) {
-            switch(c->dstFormat) {
-            case PIX_FMT_RGB32:
-                if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-                    YSCALEYUV2PACKEDX_ACCURATE
-                    YSCALEYUV2RGBX
-                    "movq                      %%mm2, "U_TEMP"(%0)  \n\t"
-                    "movq                      %%mm4, "V_TEMP"(%0)  \n\t"
-                    "movq                      %%mm5, "Y_TEMP"(%0)  \n\t"
-                    YSCALEYUV2PACKEDX_ACCURATE_YA(ALP_MMX_FILTER_OFFSET)
-                    "movq               "Y_TEMP"(%0), %%mm5         \n\t"
-                    "psraw                        $3, %%mm1         \n\t"
-                    "psraw                        $3, %%mm7         \n\t"
-                    "packuswb                  %%mm7, %%mm1         \n\t"
-                    WRITEBGR32(%4, %5, %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6)
-
-                    YSCALEYUV2PACKEDX_END
-                } else {
-                    YSCALEYUV2PACKEDX_ACCURATE
-                    YSCALEYUV2RGBX
-                    "pcmpeqd %%mm7, %%mm7 \n\t"
-                    WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-
-                    YSCALEYUV2PACKEDX_END
-                }
-                return;
-            case PIX_FMT_BGR24:
-                YSCALEYUV2PACKEDX_ACCURATE
-                YSCALEYUV2RGBX
-                "pxor %%mm7, %%mm7 \n\t"
-                "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize
-                "add %4, %%"REG_c"                        \n\t"
-                WRITEBGR24(%%REGc, %5, %%REGa)
-
-
-                :: "r" (&c->redDither),
-                "m" (dummy), "m" (dummy), "m" (dummy),
-                "r" (dest), "m" (dstW)
-                : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
-                );
-                return;
-            case PIX_FMT_RGB555:
-                YSCALEYUV2PACKEDX_ACCURATE
-                YSCALEYUV2RGBX
-                "pxor %%mm7, %%mm7 \n\t"
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                "paddusb "BLUE_DITHER"(%0), %%mm2\n\t"
-                "paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
-                "paddusb "RED_DITHER"(%0), %%mm5\n\t"
-#endif
-
-                WRITERGB15(%4, %5, %%REGa)
-                YSCALEYUV2PACKEDX_END
-                return;
-            case PIX_FMT_RGB565:
-                YSCALEYUV2PACKEDX_ACCURATE
-                YSCALEYUV2RGBX
-                "pxor %%mm7, %%mm7 \n\t"
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                "paddusb "BLUE_DITHER"(%0), %%mm2\n\t"
-                "paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
-                "paddusb "RED_DITHER"(%0), %%mm5\n\t"
-#endif
-
-                WRITERGB16(%4, %5, %%REGa)
-                YSCALEYUV2PACKEDX_END
-                return;
-            case PIX_FMT_YUYV422:
-                YSCALEYUV2PACKEDX_ACCURATE
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-
-                "psraw $3, %%mm3    \n\t"
-                "psraw $3, %%mm4    \n\t"
-                "psraw $3, %%mm1    \n\t"
-                "psraw $3, %%mm7    \n\t"
-                WRITEYUY2(%4, %5, %%REGa)
-                YSCALEYUV2PACKEDX_END
-                return;
-            }
-        } else {
-            switch(c->dstFormat) {
-            case PIX_FMT_RGB32:
-                if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-                    YSCALEYUV2PACKEDX
-                    YSCALEYUV2RGBX
-                    YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET, %%mm0, %%mm3, %%mm6, %%mm1, %%mm7)
-                    "psraw                        $3, %%mm1         \n\t"
-                    "psraw                        $3, %%mm7         \n\t"
-                    "packuswb                  %%mm7, %%mm1         \n\t"
-                    WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
-                    YSCALEYUV2PACKEDX_END
-                } else {
-                    YSCALEYUV2PACKEDX
-                    YSCALEYUV2RGBX
-                    "pcmpeqd %%mm7, %%mm7 \n\t"
-                    WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-                    YSCALEYUV2PACKEDX_END
-                }
-                return;
-            case PIX_FMT_BGR24:
-                YSCALEYUV2PACKEDX
-                YSCALEYUV2RGBX
-                "pxor                    %%mm7, %%mm7       \n\t"
-                "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"   \n\t" //FIXME optimize
-                "add                        %4, %%"REG_c"   \n\t"
-                WRITEBGR24(%%REGc, %5, %%REGa)
-
-                :: "r" (&c->redDither),
-                "m" (dummy), "m" (dummy), "m" (dummy),
-                "r" (dest),  "m" (dstW)
-                : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
-                );
-                return;
-            case PIX_FMT_RGB555:
-                YSCALEYUV2PACKEDX
-                YSCALEYUV2RGBX
-                "pxor %%mm7, %%mm7 \n\t"
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                "paddusb "BLUE_DITHER"(%0), %%mm2  \n\t"
-                "paddusb "GREEN_DITHER"(%0), %%mm4  \n\t"
-                "paddusb "RED_DITHER"(%0), %%mm5  \n\t"
-#endif
-
-                WRITERGB15(%4, %5, %%REGa)
-                YSCALEYUV2PACKEDX_END
-                return;
-            case PIX_FMT_RGB565:
-                YSCALEYUV2PACKEDX
-                YSCALEYUV2RGBX
-                "pxor %%mm7, %%mm7 \n\t"
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                "paddusb "BLUE_DITHER"(%0), %%mm2  \n\t"
-                "paddusb "GREEN_DITHER"(%0), %%mm4  \n\t"
-                "paddusb "RED_DITHER"(%0), %%mm5  \n\t"
-#endif
-
-                WRITERGB16(%4, %5, %%REGa)
-                YSCALEYUV2PACKEDX_END
-                return;
-            case PIX_FMT_YUYV422:
-                YSCALEYUV2PACKEDX
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-
-                "psraw $3, %%mm3    \n\t"
-                "psraw $3, %%mm4    \n\t"
-                "psraw $3, %%mm1    \n\t"
-                "psraw $3, %%mm7    \n\t"
-                WRITEYUY2(%4, %5, %%REGa)
-                YSCALEYUV2PACKEDX_END
-                return;
-            }
-        }
-    }
-#endif /* COMPILE_TEMPLATE_MMX */
-#if COMPILE_TEMPLATE_ALTIVEC
-    /* The following list of supported dstFormat values should
-       match what's found in the body of ff_yuv2packedX_altivec() */
-    if (!(c->flags & SWS_BITEXACT) && !c->alpPixBuf &&
-         (c->dstFormat==PIX_FMT_ABGR  || c->dstFormat==PIX_FMT_BGRA  ||
-          c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 ||
-          c->dstFormat==PIX_FMT_RGBA  || c->dstFormat==PIX_FMT_ARGB))
-            ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize,
-                                   chrFilter, chrSrc, chrFilterSize,
-                                   dest, dstW, dstY);
-    else
-#endif
-        yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
-                       chrFilter, chrSrc, chrFilterSize,
-                       alpSrc, dest, dstW, dstY);
-}
-
-/**
- * vertical bilinear scale YV12 to RGB
- */
-static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *uvbuf0, const uint16_t *uvbuf1,
-                          const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
-{
-    int  yalpha1=4095- yalpha;
-    int uvalpha1=4095-uvalpha;
-    int i;
-
-#if COMPILE_TEMPLATE_MMX
-    if(!(c->flags & SWS_BITEXACT)) {
-        switch(c->dstFormat) {
-        //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
-        case PIX_FMT_RGB32:
-            if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-#if ARCH_X86_64
-                __asm__ volatile(
-                    YSCALEYUV2RGB(%%r8, %5)
-                    YSCALEYUV2RGB_YA(%%r8, %5, %6, %7)
-                    "psraw                  $3, %%mm1       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
-                    "psraw                  $3, %%mm7       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
-                    "packuswb            %%mm7, %%mm1       \n\t"
-                    WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "r" (dest),
-                    "a" (&c->redDither)
-                    ,"r" (abuf0), "r" (abuf1)
-                    : "%r8"
-                );
-#else
-                *(const uint16_t **)(&c->u_temp)=abuf0;
-                *(const uint16_t **)(&c->v_temp)=abuf1;
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB(%%REGBP, %5)
-                    "push                   %0              \n\t"
-                    "push                   %1              \n\t"
-                    "mov          "U_TEMP"(%5), %0          \n\t"
-                    "mov          "V_TEMP"(%5), %1          \n\t"
-                    YSCALEYUV2RGB_YA(%%REGBP, %5, %0, %1)
-                    "psraw                  $3, %%mm1       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
-                    "psraw                  $3, %%mm7       \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
-                    "packuswb            %%mm7, %%mm1       \n\t"
-                    "pop                    %1              \n\t"
-                    "pop                    %0              \n\t"
-                    WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-#endif
-            } else {
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB(%%REGBP, %5)
-                    "pcmpeqd %%mm7, %%mm7                   \n\t"
-                    WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-            }
-            return;
-        case PIX_FMT_BGR24:
-            __asm__ volatile(
-                "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                "mov        %4, %%"REG_b"               \n\t"
-                "push %%"REG_BP"                        \n\t"
-                YSCALEYUV2RGB(%%REGBP, %5)
-                "pxor    %%mm7, %%mm7                   \n\t"
-                WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
-                "pop %%"REG_BP"                         \n\t"
-                "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-                :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                "a" (&c->redDither)
-            );
-            return;
-        case PIX_FMT_RGB555:
-            __asm__ volatile(
-                "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                "mov        %4, %%"REG_b"               \n\t"
-                "push %%"REG_BP"                        \n\t"
-                YSCALEYUV2RGB(%%REGBP, %5)
-                "pxor    %%mm7, %%mm7                   \n\t"
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                "paddusb "BLUE_DITHER"(%5), %%mm2      \n\t"
-                "paddusb "GREEN_DITHER"(%5), %%mm4      \n\t"
-                "paddusb "RED_DITHER"(%5), %%mm5      \n\t"
-#endif
-
-                WRITERGB15(%%REGb, 8280(%5), %%REGBP)
-                "pop %%"REG_BP"                         \n\t"
-                "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                "a" (&c->redDither)
-            );
-            return;
-        case PIX_FMT_RGB565:
-            __asm__ volatile(
-                "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                "mov        %4, %%"REG_b"               \n\t"
-                "push %%"REG_BP"                        \n\t"
-                YSCALEYUV2RGB(%%REGBP, %5)
-                "pxor    %%mm7, %%mm7                   \n\t"
-                /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                "paddusb "BLUE_DITHER"(%5), %%mm2      \n\t"
-                "paddusb "GREEN_DITHER"(%5), %%mm4      \n\t"
-                "paddusb "RED_DITHER"(%5), %%mm5      \n\t"
-#endif
-
-                WRITERGB16(%%REGb, 8280(%5), %%REGBP)
-                "pop %%"REG_BP"                         \n\t"
-                "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-                :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                "a" (&c->redDither)
-            );
-            return;
-        case PIX_FMT_YUYV422:
-            __asm__ volatile(
-                "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                "mov %4, %%"REG_b"                        \n\t"
-                "push %%"REG_BP"                        \n\t"
-                YSCALEYUV2PACKED(%%REGBP, %5)
-                WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
-                "pop %%"REG_BP"                         \n\t"
-                "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-                :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                "a" (&c->redDither)
-            );
-            return;
-        default: break;
-        }
-    }
-#endif //COMPILE_TEMPLATE_MMX
-    YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C(void,0), YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONO2_C)
-}
-
-/**
- * YV12 to RGB without scaling or interpolating
- */
-static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, const uint16_t *uvbuf0, const uint16_t *uvbuf1,
-                          const uint16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, enum PixelFormat dstFormat, int flags, int y)
-{
-    const int yalpha1=0;
-    int i;
-
-    const uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
-    const int yalpha= 4096; //FIXME ...
-
-    if (flags&SWS_FULL_CHR_H_INT) {
-        c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y);
-        return;
-    }
-
-#if COMPILE_TEMPLATE_MMX
-    if(!(flags & SWS_BITEXACT)) {
-        if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
-            switch(dstFormat) {
-            case PIX_FMT_RGB32:
-                if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-                    __asm__ volatile(
-                        "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                        "mov        %4, %%"REG_b"               \n\t"
-                        "push %%"REG_BP"                        \n\t"
-                        YSCALEYUV2RGB1(%%REGBP, %5)
-                        YSCALEYUV2RGB1_ALPHA(%%REGBP)
-                        WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-                        "pop %%"REG_BP"                         \n\t"
-                        "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                        :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                        "a" (&c->redDither)
-                    );
-                } else {
-                    __asm__ volatile(
-                        "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                        "mov        %4, %%"REG_b"               \n\t"
-                        "push %%"REG_BP"                        \n\t"
-                        YSCALEYUV2RGB1(%%REGBP, %5)
-                        "pcmpeqd %%mm7, %%mm7                   \n\t"
-                        WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-                        "pop %%"REG_BP"                         \n\t"
-                        "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                        :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                        "a" (&c->redDither)
-                    );
-                }
-                return;
-            case PIX_FMT_BGR24:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB1(%%REGBP, %5)
-                    "pxor    %%mm7, %%mm7                   \n\t"
-                    WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            case PIX_FMT_RGB555:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB1(%%REGBP, %5)
-                    "pxor    %%mm7, %%mm7                   \n\t"
-                    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                    "paddusb "BLUE_DITHER"(%5), %%mm2      \n\t"
-                    "paddusb "GREEN_DITHER"(%5), %%mm4      \n\t"
-                    "paddusb "RED_DITHER"(%5), %%mm5      \n\t"
-#endif
-                    WRITERGB15(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            case PIX_FMT_RGB565:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB1(%%REGBP, %5)
-                    "pxor    %%mm7, %%mm7                   \n\t"
-                    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                    "paddusb "BLUE_DITHER"(%5), %%mm2      \n\t"
-                    "paddusb "GREEN_DITHER"(%5), %%mm4      \n\t"
-                    "paddusb "RED_DITHER"(%5), %%mm5      \n\t"
-#endif
-
-                    WRITERGB16(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            case PIX_FMT_YUYV422:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2PACKED1(%%REGBP, %5)
-                    WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            }
-        } else {
-            switch(dstFormat) {
-            case PIX_FMT_RGB32:
-                if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-                    __asm__ volatile(
-                        "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                        "mov        %4, %%"REG_b"               \n\t"
-                        "push %%"REG_BP"                        \n\t"
-                        YSCALEYUV2RGB1b(%%REGBP, %5)
-                        YSCALEYUV2RGB1_ALPHA(%%REGBP)
-                        WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-                        "pop %%"REG_BP"                         \n\t"
-                        "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                        :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                        "a" (&c->redDither)
-                    );
-                } else {
-                    __asm__ volatile(
-                        "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                        "mov        %4, %%"REG_b"               \n\t"
-                        "push %%"REG_BP"                        \n\t"
-                        YSCALEYUV2RGB1b(%%REGBP, %5)
-                        "pcmpeqd %%mm7, %%mm7                   \n\t"
-                        WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-                        "pop %%"REG_BP"                         \n\t"
-                        "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                        :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                        "a" (&c->redDither)
-                    );
-                }
-                return;
-            case PIX_FMT_BGR24:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB1b(%%REGBP, %5)
-                    "pxor    %%mm7, %%mm7                   \n\t"
-                    WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            case PIX_FMT_RGB555:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB1b(%%REGBP, %5)
-                    "pxor    %%mm7, %%mm7                   \n\t"
-                    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                    "paddusb "BLUE_DITHER"(%5), %%mm2      \n\t"
-                    "paddusb "GREEN_DITHER"(%5), %%mm4      \n\t"
-                    "paddusb "RED_DITHER"(%5), %%mm5      \n\t"
-#endif
-                    WRITERGB15(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            case PIX_FMT_RGB565:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2RGB1b(%%REGBP, %5)
-                    "pxor    %%mm7, %%mm7                   \n\t"
-                    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
-                    "paddusb "BLUE_DITHER"(%5), %%mm2      \n\t"
-                    "paddusb "GREEN_DITHER"(%5), %%mm4      \n\t"
-                    "paddusb "RED_DITHER"(%5), %%mm5      \n\t"
-#endif
-
-                    WRITERGB16(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            case PIX_FMT_YUYV422:
-                __asm__ volatile(
-                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
-                    "mov        %4, %%"REG_b"               \n\t"
-                    "push %%"REG_BP"                        \n\t"
-                    YSCALEYUV2PACKED1b(%%REGBP, %5)
-                    WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
-                    "pop %%"REG_BP"                         \n\t"
-                    "mov "ESP_OFFSET"(%5), %%"REG_b"        \n\t"
-
-                    :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
-                    "a" (&c->redDither)
-                );
-                return;
-            }
-        }
-    }
-#endif /* COMPILE_TEMPLATE_MMX */
-    if (uvalpha < 2048) {
-        YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)
-    } else {
-        YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)
-    }
-}
-
-//FIXME yuy2* can read up to 7 samples too much
-
-static inline void RENAME(yuy2ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    __asm__ volatile(
-        "movq "MANGLE(bm01010101)", %%mm2           \n\t"
-        "mov                    %0, %%"REG_a"       \n\t"
-        "1:                                         \n\t"
-        "movq    (%1, %%"REG_a",2), %%mm0           \n\t"
-        "movq   8(%1, %%"REG_a",2), %%mm1           \n\t"
-        "pand                %%mm2, %%mm0           \n\t"
-        "pand                %%mm2, %%mm1           \n\t"
-        "packuswb            %%mm1, %%mm0           \n\t"
-        "movq                %%mm0, (%2, %%"REG_a") \n\t"
-        "add                    $8, %%"REG_a"       \n\t"
-        " js                    1b                  \n\t"
-        : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width)
-        : "%"REG_a
-    );
-#else
-    int i;
-    for (i=0; i<width; i++)
-        dst[i]= src[2*i];
-#endif
-}
-
-static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    __asm__ volatile(
-        "movq "MANGLE(bm01010101)", %%mm4           \n\t"
-        "mov                    %0, %%"REG_a"       \n\t"
-        "1:                                         \n\t"
-        "movq    (%1, %%"REG_a",4), %%mm0           \n\t"
-        "movq   8(%1, %%"REG_a",4), %%mm1           \n\t"
-        "psrlw                  $8, %%mm0           \n\t"
-        "psrlw                  $8, %%mm1           \n\t"
-        "packuswb            %%mm1, %%mm0           \n\t"
-        "movq                %%mm0, %%mm1           \n\t"
-        "psrlw                  $8, %%mm0           \n\t"
-        "pand                %%mm4, %%mm1           \n\t"
-        "packuswb            %%mm0, %%mm0           \n\t"
-        "packuswb            %%mm1, %%mm1           \n\t"
-        "movd                %%mm0, (%3, %%"REG_a") \n\t"
-        "movd                %%mm1, (%2, %%"REG_a") \n\t"
-        "add                    $4, %%"REG_a"       \n\t"
-        " js                    1b                  \n\t"
-        : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width)
-        : "%"REG_a
-    );
-#else
-    int i;
-    for (i=0; i<width; i++) {
-        dstU[i]= src1[4*i + 1];
-        dstV[i]= src1[4*i + 3];
-    }
-#endif
-    assert(src1 == src2);
-}
-
-static inline void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    __asm__ volatile(
-        "mov                    %0, %%"REG_a"       \n\t"
-        "1:                                         \n\t"
-        "movq    (%1, %%"REG_a",2), %%mm0           \n\t"
-        "movq   8(%1, %%"REG_a",2), %%mm1           \n\t"
-        "movq    (%2, %%"REG_a",2), %%mm2           \n\t"
-        "movq   8(%2, %%"REG_a",2), %%mm3           \n\t"
-        "psrlw                  $8, %%mm0           \n\t"
-        "psrlw                  $8, %%mm1           \n\t"
-        "psrlw                  $8, %%mm2           \n\t"
-        "psrlw                  $8, %%mm3           \n\t"
-        "packuswb            %%mm1, %%mm0           \n\t"
-        "packuswb            %%mm3, %%mm2           \n\t"
-        "movq                %%mm0, (%3, %%"REG_a") \n\t"
-        "movq                %%mm2, (%4, %%"REG_a") \n\t"
-        "add                    $8, %%"REG_a"       \n\t"
-        " js                    1b                  \n\t"
-        : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width)
-        : "%"REG_a
-    );
-#else
-    int i;
-    for (i=0; i<width; i++) {
-        dstU[i]= src1[2*i + 1];
-        dstV[i]= src2[2*i + 1];
-    }
-#endif
-}
-
-/* This is almost identical to the previous, end exists only because
- * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */
-static inline void RENAME(uyvyToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    __asm__ volatile(
-        "mov                  %0, %%"REG_a"         \n\t"
-        "1:                                         \n\t"
-        "movq  (%1, %%"REG_a",2), %%mm0             \n\t"
-        "movq 8(%1, %%"REG_a",2), %%mm1             \n\t"
-        "psrlw                $8, %%mm0             \n\t"
-        "psrlw                $8, %%mm1             \n\t"
-        "packuswb          %%mm1, %%mm0             \n\t"
-        "movq              %%mm0, (%2, %%"REG_a")   \n\t"
-        "add                  $8, %%"REG_a"         \n\t"
-        " js                  1b                    \n\t"
-        : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width)
-        : "%"REG_a
-    );
-#else
-    int i;
-    for (i=0; i<width; i++)
-        dst[i]= src[2*i+1];
-#endif
-}
-
-static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    __asm__ volatile(
-        "movq "MANGLE(bm01010101)", %%mm4           \n\t"
-        "mov                    %0, %%"REG_a"       \n\t"
-        "1:                                         \n\t"
-        "movq    (%1, %%"REG_a",4), %%mm0           \n\t"
-        "movq   8(%1, %%"REG_a",4), %%mm1           \n\t"
-        "pand                %%mm4, %%mm0           \n\t"
-        "pand                %%mm4, %%mm1           \n\t"
-        "packuswb            %%mm1, %%mm0           \n\t"
-        "movq                %%mm0, %%mm1           \n\t"
-        "psrlw                  $8, %%mm0           \n\t"
-        "pand                %%mm4, %%mm1           \n\t"
-        "packuswb            %%mm0, %%mm0           \n\t"
-        "packuswb            %%mm1, %%mm1           \n\t"
-        "movd                %%mm0, (%3, %%"REG_a") \n\t"
-        "movd                %%mm1, (%2, %%"REG_a") \n\t"
-        "add                    $4, %%"REG_a"       \n\t"
-        " js                    1b                  \n\t"
-        : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width)
-        : "%"REG_a
-    );
-#else
-    int i;
-    for (i=0; i<width; i++) {
-        dstU[i]= src1[4*i + 0];
-        dstV[i]= src1[4*i + 2];
-    }
-#endif
-    assert(src1 == src2);
-}
-
-static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    __asm__ volatile(
-        "movq "MANGLE(bm01010101)", %%mm4           \n\t"
-        "mov                    %0, %%"REG_a"       \n\t"
-        "1:                                         \n\t"
-        "movq    (%1, %%"REG_a",2), %%mm0           \n\t"
-        "movq   8(%1, %%"REG_a",2), %%mm1           \n\t"
-        "movq    (%2, %%"REG_a",2), %%mm2           \n\t"
-        "movq   8(%2, %%"REG_a",2), %%mm3           \n\t"
-        "pand                %%mm4, %%mm0           \n\t"
-        "pand                %%mm4, %%mm1           \n\t"
-        "pand                %%mm4, %%mm2           \n\t"
-        "pand                %%mm4, %%mm3           \n\t"
-        "packuswb            %%mm1, %%mm0           \n\t"
-        "packuswb            %%mm3, %%mm2           \n\t"
-        "movq                %%mm0, (%3, %%"REG_a") \n\t"
-        "movq                %%mm2, (%4, %%"REG_a") \n\t"
-        "add                    $8, %%"REG_a"       \n\t"
-        " js                    1b                  \n\t"
-        : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width)
-        : "%"REG_a
-    );
-#else
-    int i;
-    for (i=0; i<width; i++) {
-        dstU[i]= src1[2*i];
-        dstV[i]= src2[2*i];
-    }
-#endif
-}
-
-static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,
-                                    const uint8_t *src, long width)
-{
-#if COMPILE_TEMPLATE_MMX
-    __asm__ volatile(
-        "movq "MANGLE(bm01010101)", %%mm4           \n\t"
-        "mov                    %0, %%"REG_a"       \n\t"
-        "1:                                         \n\t"
-        "movq    (%1, %%"REG_a",2), %%mm0           \n\t"
-        "movq   8(%1, %%"REG_a",2), %%mm1           \n\t"
-        "movq                %%mm0, %%mm2           \n\t"
-        "movq                %%mm1, %%mm3           \n\t"
-        "pand                %%mm4, %%mm0           \n\t"
-        "pand                %%mm4, %%mm1           \n\t"
-        "psrlw                  $8, %%mm2           \n\t"
-        "psrlw                  $8, %%mm3           \n\t"
-        "packuswb            %%mm1, %%mm0           \n\t"
-        "packuswb            %%mm3, %%mm2           \n\t"
-        "movq                %%mm0, (%2, %%"REG_a") \n\t"
-        "movq                %%mm2, (%3, %%"REG_a") \n\t"
-        "add                    $8, %%"REG_a"       \n\t"
-        " js                    1b                  \n\t"
-        : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width)
-        : "%"REG_a
-    );
-#else
-    int i;
-    for (i = 0; i < width; i++) {
-        dst1[i] = src[2*i+0];
-        dst2[i] = src[2*i+1];
-    }
-#endif
-}
-
-static inline void RENAME(nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
-                                    const uint8_t *src1, const uint8_t *src2,
-                                    long width, uint32_t *unused)
-{
-    RENAME(nvXXtoUV)(dstU, dstV, src1, width);
-}
-
-static inline void RENAME(nv21ToUV)(uint8_t *dstU, uint8_t *dstV,
-                                    const uint8_t *src1, const uint8_t *src2,
-                                    long width, uint32_t *unused)
-{
-    RENAME(nvXXtoUV)(dstV, dstU, src1, width);
-}
-
-#if COMPILE_TEMPLATE_MMX
-static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long width, enum PixelFormat srcFormat)
-{
-
-    if(srcFormat == PIX_FMT_BGR24) {
-        __asm__ volatile(
-            "movq  "MANGLE(ff_bgr24toY1Coeff)", %%mm5       \n\t"
-            "movq  "MANGLE(ff_bgr24toY2Coeff)", %%mm6       \n\t"
-            :
-        );
-    } else {
-        __asm__ volatile(
-            "movq  "MANGLE(ff_rgb24toY1Coeff)", %%mm5       \n\t"
-            "movq  "MANGLE(ff_rgb24toY2Coeff)", %%mm6       \n\t"
-            :
-        );
-    }
-
-    __asm__ volatile(
-        "movq  "MANGLE(ff_bgr24toYOffset)", %%mm4   \n\t"
-        "mov                        %2, %%"REG_a"   \n\t"
-        "pxor                    %%mm7, %%mm7       \n\t"
-        "1:                                         \n\t"
-        PREFETCH"               64(%0)              \n\t"
-        "movd                     (%0), %%mm0       \n\t"
-        "movd                    2(%0), %%mm1       \n\t"
-        "movd                    6(%0), %%mm2       \n\t"
-        "movd                    8(%0), %%mm3       \n\t"
-        "add                       $12, %0          \n\t"
-        "punpcklbw               %%mm7, %%mm0       \n\t"
-        "punpcklbw               %%mm7, %%mm1       \n\t"
-        "punpcklbw               %%mm7, %%mm2       \n\t"
-        "punpcklbw               %%mm7, %%mm3       \n\t"
-        "pmaddwd                 %%mm5, %%mm0       \n\t"
-        "pmaddwd                 %%mm6, %%mm1       \n\t"
-        "pmaddwd                 %%mm5, %%mm2       \n\t"
-        "pmaddwd                 %%mm6, %%mm3       \n\t"
-        "paddd                   %%mm1, %%mm0       \n\t"
-        "paddd                   %%mm3, %%mm2       \n\t"
-        "paddd                   %%mm4, %%mm0       \n\t"
-        "paddd                   %%mm4, %%mm2       \n\t"
-        "psrad                     $15, %%mm0       \n\t"
-        "psrad                     $15, %%mm2       \n\t"
-        "packssdw                %%mm2, %%mm0       \n\t"
-        "packuswb                %%mm0, %%mm0       \n\t"
-        "movd                %%mm0, (%1, %%"REG_a") \n\t"
-        "add                        $4, %%"REG_a"   \n\t"
-        " js                        1b              \n\t"
-    : "+r" (src)
-    : "r" (dst+width), "g" ((x86_reg)-width)
-    : "%"REG_a
-    );
-}
-
-static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat)
-{
-    __asm__ volatile(
-        "movq                    24+%4, %%mm6       \n\t"
-        "mov                        %3, %%"REG_a"   \n\t"
-        "pxor                    %%mm7, %%mm7       \n\t"
-        "1:                                         \n\t"
-        PREFETCH"               64(%0)              \n\t"
-        "movd                     (%0), %%mm0       \n\t"
-        "movd                    2(%0), %%mm1       \n\t"
-        "punpcklbw               %%mm7, %%mm0       \n\t"
-        "punpcklbw               %%mm7, %%mm1       \n\t"
-        "movq                    %%mm0, %%mm2       \n\t"
-        "movq                    %%mm1, %%mm3       \n\t"
-        "pmaddwd                    %4, %%mm0       \n\t"
-        "pmaddwd                  8+%4, %%mm1       \n\t"
-        "pmaddwd                 16+%4, %%mm2       \n\t"
-        "pmaddwd                 %%mm6, %%mm3       \n\t"
-        "paddd                   %%mm1, %%mm0       \n\t"
-        "paddd                   %%mm3, %%mm2       \n\t"
-
-        "movd                    6(%0), %%mm1       \n\t"
-        "movd                    8(%0), %%mm3       \n\t"
-        "add                       $12, %0          \n\t"
-        "punpcklbw               %%mm7, %%mm1       \n\t"
-        "punpcklbw               %%mm7, %%mm3       \n\t"
-        "movq                    %%mm1, %%mm4       \n\t"
-        "movq                    %%mm3, %%mm5       \n\t"
-        "pmaddwd                    %4, %%mm1       \n\t"
-        "pmaddwd                  8+%4, %%mm3       \n\t"
-        "pmaddwd                 16+%4, %%mm4       \n\t"
-        "pmaddwd                 %%mm6, %%mm5       \n\t"
-        "paddd                   %%mm3, %%mm1       \n\t"
-        "paddd                   %%mm5, %%mm4       \n\t"
-
-        "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3       \n\t"
-        "paddd                   %%mm3, %%mm0       \n\t"
-        "paddd                   %%mm3, %%mm2       \n\t"
-        "paddd                   %%mm3, %%mm1       \n\t"
-        "paddd                   %%mm3, %%mm4       \n\t"
-        "psrad                     $15, %%mm0       \n\t"
-        "psrad                     $15, %%mm2       \n\t"
-        "psrad                     $15, %%mm1       \n\t"
-        "psrad                     $15, %%mm4       \n\t"
-        "packssdw                %%mm1, %%mm0       \n\t"
-        "packssdw                %%mm4, %%mm2       \n\t"
-        "packuswb                %%mm0, %%mm0       \n\t"
-        "packuswb                %%mm2, %%mm2       \n\t"
-        "movd                %%mm0, (%1, %%"REG_a") \n\t"
-        "movd                %%mm2, (%2, %%"REG_a") \n\t"
-        "add                        $4, %%"REG_a"   \n\t"
-        " js                        1b              \n\t"
-    : "+r" (src)
-    : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])
-    : "%"REG_a
-    );
-}
-#endif
-
-static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24);
-#else
-    int i;
-    for (i=0; i<width; i++) {
-        int b= src[i*3+0];
-        int g= src[i*3+1];
-        int r= src[i*3+2];
-
-        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
-    }
-#endif /* COMPILE_TEMPLATE_MMX */
-}
-
-static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24);
-#else
-    int i;
-    for (i=0; i<width; i++) {
-        int b= src1[3*i + 0];
-        int g= src1[3*i + 1];
-        int r= src1[3*i + 2];
-
-        dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
-        dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
-    }
-#endif /* COMPILE_TEMPLATE_MMX */
-    assert(src1 == src2);
-}
-
-static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-    int i;
-    for (i=0; i<width; i++) {
-        int b= src1[6*i + 0] + src1[6*i + 3];
-        int g= src1[6*i + 1] + src1[6*i + 4];
-        int r= src1[6*i + 2] + src1[6*i + 5];
-
-        dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
-        dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
-    }
-    assert(src1 == src2);
-}
-
-static inline void RENAME(rgb24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24);
-#else
-    int i;
-    for (i=0; i<width; i++) {
-        int r= src[i*3+0];
-        int g= src[i*3+1];
-        int b= src[i*3+2];
-
-        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
-    }
-#endif
-}
-
-static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
-    assert(src1==src2);
-    RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);
-#else
-    int i;
-    assert(src1==src2);
-    for (i=0; i<width; i++) {
-        int r= src1[3*i + 0];
-        int g= src1[3*i + 1];
-        int b= src1[3*i + 2];
-
-        dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
-        dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
-    }
-#endif
-}
-
-static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-    int i;
-    assert(src1==src2);
-    for (i=0; i<width; i++) {
-        int r= src1[6*i + 0] + src1[6*i + 3];
-        int g= src1[6*i + 1] + src1[6*i + 4];
-        int b= src1[6*i + 2] + src1[6*i + 5];
-
-        dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
-        dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
-    }
-}
-
-
-// bilinear / bicubic scaling
-static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc,
-                                  const int16_t *filter, const int16_t *filterPos, long filterSize)
-{
-#if COMPILE_TEMPLATE_MMX
-    assert(filterSize % 4 == 0 && filterSize>0);
-    if (filterSize==4) { // Always true for upscaling, sometimes for down, too.
-        x86_reg counter= -2*dstW;
-        filter-= counter*2;
-        filterPos-= counter/2;
-        dst-= counter/2;
-        __asm__ volatile(
-#if defined(PIC)
-            "push            %%"REG_b"              \n\t"
-#endif
-            "pxor                %%mm7, %%mm7       \n\t"
-            "push           %%"REG_BP"              \n\t" // we use 7 regs here ...
-            "mov             %%"REG_a", %%"REG_BP"  \n\t"
-            ASMALIGN(4)
-            "1:                                     \n\t"
-            "movzwl   (%2, %%"REG_BP"), %%eax       \n\t"
-            "movzwl  2(%2, %%"REG_BP"), %%ebx       \n\t"
-            "movq  (%1, %%"REG_BP", 4), %%mm1       \n\t"
-            "movq 8(%1, %%"REG_BP", 4), %%mm3       \n\t"
-            "movd      (%3, %%"REG_a"), %%mm0       \n\t"
-            "movd      (%3, %%"REG_b"), %%mm2       \n\t"
-            "punpcklbw           %%mm7, %%mm0       \n\t"
-            "punpcklbw           %%mm7, %%mm2       \n\t"
-            "pmaddwd             %%mm1, %%mm0       \n\t"
-            "pmaddwd             %%mm2, %%mm3       \n\t"
-            "movq                %%mm0, %%mm4       \n\t"
-            "punpckldq           %%mm3, %%mm0       \n\t"
-            "punpckhdq           %%mm3, %%mm4       \n\t"
-            "paddd               %%mm4, %%mm0       \n\t"
-            "psrad                  $7, %%mm0       \n\t"
-            "packssdw            %%mm0, %%mm0       \n\t"
-            "movd                %%mm0, (%4, %%"REG_BP")    \n\t"
-            "add                    $4, %%"REG_BP"  \n\t"
-            " jnc                   1b              \n\t"
-
-            "pop            %%"REG_BP"              \n\t"
-#if defined(PIC)
-            "pop             %%"REG_b"              \n\t"
-#endif
-            : "+a" (counter)
-            : "c" (filter), "d" (filterPos), "S" (src), "D" (dst)
-#if !defined(PIC)
-            : "%"REG_b
-#endif
-        );
-    } else if (filterSize==8) {
-        x86_reg counter= -2*dstW;
-        filter-= counter*4;
-        filterPos-= counter/2;
-        dst-= counter/2;
-        __asm__ volatile(
-#if defined(PIC)
-            "push             %%"REG_b"             \n\t"
-#endif
-            "pxor                 %%mm7, %%mm7      \n\t"
-            "push            %%"REG_BP"             \n\t" // we use 7 regs here ...
-            "mov              %%"REG_a", %%"REG_BP" \n\t"
-            ASMALIGN(4)
-            "1:                                     \n\t"
-            "movzwl    (%2, %%"REG_BP"), %%eax      \n\t"
-            "movzwl   2(%2, %%"REG_BP"), %%ebx      \n\t"
-            "movq   (%1, %%"REG_BP", 8), %%mm1      \n\t"
-            "movq 16(%1, %%"REG_BP", 8), %%mm3      \n\t"
-            "movd       (%3, %%"REG_a"), %%mm0      \n\t"
-            "movd       (%3, %%"REG_b"), %%mm2      \n\t"
-            "punpcklbw            %%mm7, %%mm0      \n\t"
-            "punpcklbw            %%mm7, %%mm2      \n\t"
-            "pmaddwd              %%mm1, %%mm0      \n\t"
-            "pmaddwd              %%mm2, %%mm3      \n\t"
-
-            "movq  8(%1, %%"REG_BP", 8), %%mm1      \n\t"
-            "movq 24(%1, %%"REG_BP", 8), %%mm5      \n\t"
-            "movd      4(%3, %%"REG_a"), %%mm4      \n\t"
-            "movd      4(%3, %%"REG_b"), %%mm2      \n\t"
-            "punpcklbw            %%mm7, %%mm4      \n\t"
-            "punpcklbw            %%mm7, %%mm2      \n\t"
-            "pmaddwd              %%mm1, %%mm4      \n\t"
-            "pmaddwd              %%mm2, %%mm5      \n\t"
-            "paddd                %%mm4, %%mm0      \n\t"
-            "paddd                %%mm5, %%mm3      \n\t"
-            "movq                 %%mm0, %%mm4      \n\t"
-            "punpckldq            %%mm3, %%mm0      \n\t"
-            "punpckhdq            %%mm3, %%mm4      \n\t"
-            "paddd                %%mm4, %%mm0      \n\t"
-            "psrad                   $7, %%mm0      \n\t"
-            "packssdw             %%mm0, %%mm0      \n\t"
-            "movd                 %%mm0, (%4, %%"REG_BP")   \n\t"
-            "add                     $4, %%"REG_BP" \n\t"
-            " jnc                    1b             \n\t"
-
-            "pop             %%"REG_BP"             \n\t"
-#if defined(PIC)
-            "pop              %%"REG_b"             \n\t"
-#endif
-            : "+a" (counter)
-            : "c" (filter), "d" (filterPos), "S" (src), "D" (dst)
-#if !defined(PIC)
-            : "%"REG_b
-#endif
-        );
-    } else {
-        const uint8_t *offset = src+filterSize;
-        x86_reg counter= -2*dstW;
-        //filter-= counter*filterSize/2;
-        filterPos-= counter/2;
-        dst-= counter/2;
-        __asm__ volatile(
-            "pxor                  %%mm7, %%mm7     \n\t"
-            ASMALIGN(4)
-            "1:                                     \n\t"
-            "mov                      %2, %%"REG_c" \n\t"
-            "movzwl      (%%"REG_c", %0), %%eax     \n\t"
-            "movzwl     2(%%"REG_c", %0), %%edx     \n\t"
-            "mov                      %5, %%"REG_c" \n\t"
-            "pxor                  %%mm4, %%mm4     \n\t"
-            "pxor                  %%mm5, %%mm5     \n\t"
-            "2:                                     \n\t"
-            "movq                   (%1), %%mm1     \n\t"
-            "movq               (%1, %6), %%mm3     \n\t"
-            "movd (%%"REG_c", %%"REG_a"), %%mm0     \n\t"
-            "movd (%%"REG_c", %%"REG_d"), %%mm2     \n\t"
-            "punpcklbw             %%mm7, %%mm0     \n\t"
-            "punpcklbw             %%mm7, %%mm2     \n\t"
-            "pmaddwd               %%mm1, %%mm0     \n\t"
-            "pmaddwd               %%mm2, %%mm3     \n\t"
-            "paddd                 %%mm3, %%mm5     \n\t"
-            "paddd                 %%mm0, %%mm4     \n\t"
-            "add                      $8, %1        \n\t"
-            "add                      $4, %%"REG_c" \n\t"
-            "cmp                      %4, %%"REG_c" \n\t"
-            " jb                      2b            \n\t"
-            "add                      %6, %1        \n\t"
-            "movq                  %%mm4, %%mm0     \n\t"
-            "punpckldq             %%mm5, %%mm4     \n\t"
-            "punpckhdq             %%mm5, %%mm0     \n\t"
-            "paddd                 %%mm0, %%mm4     \n\t"
-            "psrad                    $7, %%mm4     \n\t"
-            "packssdw              %%mm4, %%mm4     \n\t"
-            "mov                      %3, %%"REG_a" \n\t"
-            "movd                  %%mm4, (%%"REG_a", %0)   \n\t"
-            "add                      $4, %0        \n\t"
-            " jnc                     1b            \n\t"
-
-            : "+r" (counter), "+r" (filter)
-            : "m" (filterPos), "m" (dst), "m"(offset),
-            "m" (src), "r" ((x86_reg)filterSize*2)
-            : "%"REG_a, "%"REG_c, "%"REG_d
-        );
-    }
-#else
-#if COMPILE_TEMPLATE_ALTIVEC
-    hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize);
-#else
-    int i;
-    for (i=0; i<dstW; i++) {
-        int j;
-        int srcPos= filterPos[i];
-        int val=0;
-        //printf("filterPos: %d\n", filterPos[i]);
-        for (j=0; j<filterSize; j++) {
-            //printf("filter: %d, src: %d\n", filter[i], src[srcPos + j]);
-            val += ((int)src[srcPos + j])*filter[filterSize*i + j];
-        }
-        //filter += hFilterSize;
-        dst[i] = FFMIN(val>>7, (1<<15)-1); // the cubic equation does overflow ...
-        //dst[i] = val>>7;
-    }
-#endif /* COMPILE_TEMPLATE_ALTIVEC */
-#endif /* COMPILE_MMX */
-}
-
-//FIXME all pal and rgb srcFormats could do this convertion as well
-//FIXME all scalers more complex than bilinear could do half of this transform
-static void RENAME(chrRangeToJpeg)(uint16_t *dst, int width)
-{
-    int i;
-    for (i = 0; i < width; i++) {
-        dst[i     ] = (FFMIN(dst[i     ],30775)*4663 - 9289992)>>12; //-264
-        dst[i+VOFW] = (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; //-264
-    }
-}
-static void RENAME(chrRangeFromJpeg)(uint16_t *dst, int width)
-{
-    int i;
-    for (i = 0; i < width; i++) {
-        dst[i     ] = (dst[i     ]*1799 + 4081085)>>11; //1469
-        dst[i+VOFW] = (dst[i+VOFW]*1799 + 4081085)>>11; //1469
-    }
-}
-static void RENAME(lumRangeToJpeg)(uint16_t *dst, int width)
-{
-    int i;
-    for (i = 0; i < width; i++)
-        dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14;
-}
-static void RENAME(lumRangeFromJpeg)(uint16_t *dst, int width)
-{
-    int i;
-    for (i = 0; i < width; i++)
-        dst[i] = (dst[i]*14071 + 33561947)>>14;
-}
-
-#define FAST_BILINEAR_X86 \
-    "subl    %%edi, %%esi    \n\t" /*  src[xx+1] - src[xx] */                   \
-    "imull   %%ecx, %%esi    \n\t" /* (src[xx+1] - src[xx])*xalpha */           \
-    "shll      $16, %%edi    \n\t"                                              \
-    "addl    %%edi, %%esi    \n\t" /* src[xx+1]*xalpha + src[xx]*(1-xalpha) */  \
-    "mov        %1, %%"REG_D"\n\t"                                              \
-    "shrl       $9, %%esi    \n\t"                                              \
-
-static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
-                                        long dstWidth, const uint8_t *src, int srcW,
-                                        int xInc)
-{
-#if ARCH_X86
-#if COMPILE_TEMPLATE_MMX2
-    int32_t *filterPos = c->hLumFilterPos;
-    int16_t *filter    = c->hLumFilter;
-    int     canMMX2BeUsed  = c->canMMX2BeUsed;
-    void    *mmx2FilterCode= c->lumMmx2FilterCode;
-    int i;
-#if defined(PIC)
-    DECLARE_ALIGNED(8, uint64_t, ebxsave);
-#endif
-    if (canMMX2BeUsed) {
-        __asm__ volatile(
-#if defined(PIC)
-            "mov               %%"REG_b", %5        \n\t"
-#endif
-            "pxor                  %%mm7, %%mm7     \n\t"
-            "mov                      %0, %%"REG_c" \n\t"
-            "mov                      %1, %%"REG_D" \n\t"
-            "mov                      %2, %%"REG_d" \n\t"
-            "mov                      %3, %%"REG_b" \n\t"
-            "xor               %%"REG_a", %%"REG_a" \n\t" // i
-            PREFETCH"        (%%"REG_c")            \n\t"
-            PREFETCH"      32(%%"REG_c")            \n\t"
-            PREFETCH"      64(%%"REG_c")            \n\t"
-
-#if ARCH_X86_64
-
-#define CALL_MMX2_FILTER_CODE \
-            "movl            (%%"REG_b"), %%esi     \n\t"\
-            "call                    *%4            \n\t"\
-            "movl (%%"REG_b", %%"REG_a"), %%esi     \n\t"\
-            "add               %%"REG_S", %%"REG_c" \n\t"\
-            "add               %%"REG_a", %%"REG_D" \n\t"\
-            "xor               %%"REG_a", %%"REG_a" \n\t"\
-
-#else
-
-#define CALL_MMX2_FILTER_CODE \
-            "movl (%%"REG_b"), %%esi        \n\t"\
-            "call         *%4                       \n\t"\
-            "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
-            "add               %%"REG_a", %%"REG_D" \n\t"\
-            "xor               %%"REG_a", %%"REG_a" \n\t"\
-
-#endif /* ARCH_X86_64 */
-
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-
-#if defined(PIC)
-            "mov                      %5, %%"REG_b" \n\t"
-#endif
-            :: "m" (src), "m" (dst), "m" (filter), "m" (filterPos),
-            "m" (mmx2FilterCode)
-#if defined(PIC)
-            ,"m" (ebxsave)
-#endif
-            : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
-#if !defined(PIC)
-            ,"%"REG_b
-#endif
-        );
-        for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128;
-    } else {
-#endif /* COMPILE_TEMPLATE_MMX2 */
-    x86_reg xInc_shr16 = xInc >> 16;
-    uint16_t xInc_mask = xInc & 0xffff;
-    //NO MMX just normal asm ...
-    __asm__ volatile(
-        "xor %%"REG_a", %%"REG_a"            \n\t" // i
-        "xor %%"REG_d", %%"REG_d"            \n\t" // xx
-        "xorl    %%ecx, %%ecx                \n\t" // xalpha
-        ASMALIGN(4)
-        "1:                                  \n\t"
-        "movzbl    (%0, %%"REG_d"), %%edi    \n\t" //src[xx]
-        "movzbl   1(%0, %%"REG_d"), %%esi    \n\t" //src[xx+1]
-        FAST_BILINEAR_X86
-        "movw     %%si, (%%"REG_D", %%"REG_a", 2)   \n\t"
-        "addw       %4, %%cx                 \n\t" //xalpha += xInc&0xFFFF
-        "adc        %3, %%"REG_d"            \n\t" //xx+= xInc>>16 + carry
-
-        "movzbl    (%0, %%"REG_d"), %%edi    \n\t" //src[xx]
-        "movzbl   1(%0, %%"REG_d"), %%esi    \n\t" //src[xx+1]
-        FAST_BILINEAR_X86
-        "movw     %%si, 2(%%"REG_D", %%"REG_a", 2)  \n\t"
-        "addw       %4, %%cx                 \n\t" //xalpha += xInc&0xFFFF
-        "adc        %3, %%"REG_d"            \n\t" //xx+= xInc>>16 + carry
-
-
-        "add        $2, %%"REG_a"            \n\t"
-        "cmp        %2, %%"REG_a"            \n\t"
-        " jb        1b                       \n\t"
-
-
-        :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask)
-        : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
-    );
-#if COMPILE_TEMPLATE_MMX2
-    } //if MMX2 can't be used
-#endif
-#else
-    int i;
-    unsigned int xpos=0;
-    for (i=0;i<dstWidth;i++) {
-        register unsigned int xx=xpos>>16;
-        register unsigned int xalpha=(xpos&0xFFFF)>>9;
-        dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;
-        xpos+=xInc;
-    }
-#endif /* ARCH_X86 */
-}
-
-      // *** horizontal scale Y line to temp buffer
-static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src, int srcW, int xInc,
-                                   const int16_t *hLumFilter,
-                                   const int16_t *hLumFilterPos, int hLumFilterSize,
-                                   uint8_t *formatConvBuffer,
-                                   uint32_t *pal, int isAlpha)
-{
-    void (*toYV12)(uint8_t *, const uint8_t *, long, uint32_t *) = isAlpha ? c->alpToYV12 : c->lumToYV12;
-    void (*convertRange)(uint16_t *, int) = isAlpha ? NULL : c->lumConvertRange;
-
-    src += isAlpha ? c->alpSrcOffset : c->lumSrcOffset;
-
-    if (toYV12) {
-        toYV12(formatConvBuffer, src, srcW, pal);
-        src= formatConvBuffer;
-    }
-
-    if (!c->hyscale_fast) {
-        c->hScale(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize);
-    } else { // fast bilinear upscale / crap downscale
-        c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc);
-    }
-
-    if (convertRange)
-        convertRange(dst, dstWidth);
-}
-
-static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst,
-                                        long dstWidth, const uint8_t *src1,
-                                        const uint8_t *src2, int srcW, int xInc)
-{
-#if ARCH_X86
-#if COMPILE_TEMPLATE_MMX2
-    int32_t *filterPos = c->hChrFilterPos;
-    int16_t *filter    = c->hChrFilter;
-    int     canMMX2BeUsed  = c->canMMX2BeUsed;
-    void    *mmx2FilterCode= c->chrMmx2FilterCode;
-    int i;
-#if defined(PIC)
-    DECLARE_ALIGNED(8, uint64_t, ebxsave);
-#endif
-    if (canMMX2BeUsed) {
-        __asm__ volatile(
-#if defined(PIC)
-            "mov          %%"REG_b", %6         \n\t"
-#endif
-            "pxor             %%mm7, %%mm7      \n\t"
-            "mov                 %0, %%"REG_c"  \n\t"
-            "mov                 %1, %%"REG_D"  \n\t"
-            "mov                 %2, %%"REG_d"  \n\t"
-            "mov                 %3, %%"REG_b"  \n\t"
-            "xor          %%"REG_a", %%"REG_a"  \n\t" // i
-            PREFETCH"   (%%"REG_c")             \n\t"
-            PREFETCH" 32(%%"REG_c")             \n\t"
-            PREFETCH" 64(%%"REG_c")             \n\t"
-
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            "xor          %%"REG_a", %%"REG_a"  \n\t" // i
-            "mov                 %5, %%"REG_c"  \n\t" // src
-            "mov                 %1, %%"REG_D"  \n\t" // buf1
-            "add              $"AV_STRINGIFY(VOF)", %%"REG_D"  \n\t"
-            PREFETCH"   (%%"REG_c")             \n\t"
-            PREFETCH" 32(%%"REG_c")             \n\t"
-            PREFETCH" 64(%%"REG_c")             \n\t"
-
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-            CALL_MMX2_FILTER_CODE
-
-#if defined(PIC)
-            "mov %6, %%"REG_b"    \n\t"
-#endif
-            :: "m" (src1), "m" (dst), "m" (filter), "m" (filterPos),
-            "m" (mmx2FilterCode), "m" (src2)
-#if defined(PIC)
-            ,"m" (ebxsave)
-#endif
-            : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
-#if !defined(PIC)
-            ,"%"REG_b
-#endif
-        );
-        for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) {
-            //printf("%d %d %d\n", dstWidth, i, srcW);
-            dst[i] = src1[srcW-1]*128;
-            dst[i+VOFW] = src2[srcW-1]*128;
-        }
-    } else {
-#endif /* COMPILE_TEMPLATE_MMX2 */
-        x86_reg xInc_shr16 = (x86_reg) (xInc >> 16);
-        uint16_t xInc_mask = xInc & 0xffff;
-        __asm__ volatile(
-            "xor %%"REG_a", %%"REG_a"               \n\t" // i
-            "xor %%"REG_d", %%"REG_d"               \n\t" // xx
-            "xorl    %%ecx, %%ecx                   \n\t" // xalpha
-            ASMALIGN(4)
-            "1:                                     \n\t"
-            "mov        %0, %%"REG_S"               \n\t"
-            "movzbl  (%%"REG_S", %%"REG_d"), %%edi  \n\t" //src[xx]
-            "movzbl 1(%%"REG_S", %%"REG_d"), %%esi  \n\t" //src[xx+1]
-            FAST_BILINEAR_X86
-            "movw     %%si, (%%"REG_D", %%"REG_a", 2)   \n\t"
-
-            "movzbl    (%5, %%"REG_d"), %%edi       \n\t" //src[xx]
-            "movzbl   1(%5, %%"REG_d"), %%esi       \n\t" //src[xx+1]
-            FAST_BILINEAR_X86
-            "movw     %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2)   \n\t"
-
-            "addw       %4, %%cx                    \n\t" //xalpha += xInc&0xFFFF
-            "adc        %3, %%"REG_d"               \n\t" //xx+= xInc>>16 + carry
-            "add        $1, %%"REG_a"               \n\t"
-            "cmp        %2, %%"REG_a"               \n\t"
-            " jb        1b                          \n\t"
-
-/* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
-which is needed to support GCC 4.0. */
-#if ARCH_X86_64 && AV_GCC_VERSION_AT_LEAST(3,4)
-            :: "m" (src1), "m" (dst), "g" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
-#else
-            :: "m" (src1), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
-#endif
-            "r" (src2)
-            : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
-        );
-#if COMPILE_TEMPLATE_MMX2
-    } //if MMX2 can't be used
-#endif
-#else
-    int i;
-    unsigned int xpos=0;
-    for (i=0;i<dstWidth;i++) {
-        register unsigned int xx=xpos>>16;
-        register unsigned int xalpha=(xpos&0xFFFF)>>9;
-        dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
-        dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
-        /* slower
-        dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha;
-        dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha;
-        */
-        xpos+=xInc;
-    }
-#endif /* ARCH_X86 */
-}
-
-inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2,
-                                   int srcW, int xInc, const int16_t *hChrFilter,
-                                   const int16_t *hChrFilterPos, int hChrFilterSize,
-                                   uint8_t *formatConvBuffer,
-                                   uint32_t *pal)
-{
-
-    src1 += c->chrSrcOffset;
-    src2 += c->chrSrcOffset;
-
-    if (c->chrToYV12) {
-        c->chrToYV12(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
-        src1= formatConvBuffer;
-        src2= formatConvBuffer+VOFW;
-    }
-
-    if (!c->hcscale_fast) {
-        c->hScale(dst     , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
-        c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
-    } else { // fast bilinear upscale / crap downscale
-        c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc);
-    }
-
-    if (c->chrConvertRange)
-        c->chrConvertRange(dst, dstWidth);
-}
-
-#define DEBUG_SWSCALE_BUFFERS 0
-#define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
-
-static int RENAME(swScale)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                           int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    /* load a few things into local vars to make the code more readable? and faster */
-    const int srcW= c->srcW;
-    const int dstW= c->dstW;
-    const int dstH= c->dstH;
-    const int chrDstW= c->chrDstW;
-    const int chrSrcW= c->chrSrcW;
-    const int lumXInc= c->lumXInc;
-    const int chrXInc= c->chrXInc;
-    const enum PixelFormat dstFormat= c->dstFormat;
-    const int flags= c->flags;
-    int16_t *vLumFilterPos= c->vLumFilterPos;
-    int16_t *vChrFilterPos= c->vChrFilterPos;
-    int16_t *hLumFilterPos= c->hLumFilterPos;
-    int16_t *hChrFilterPos= c->hChrFilterPos;
-    int16_t *vLumFilter= c->vLumFilter;
-    int16_t *vChrFilter= c->vChrFilter;
-    int16_t *hLumFilter= c->hLumFilter;
-    int16_t *hChrFilter= c->hChrFilter;
-    int32_t *lumMmxFilter= c->lumMmxFilter;
-    int32_t *chrMmxFilter= c->chrMmxFilter;
-    int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
-    const int vLumFilterSize= c->vLumFilterSize;
-    const int vChrFilterSize= c->vChrFilterSize;
-    const int hLumFilterSize= c->hLumFilterSize;
-    const int hChrFilterSize= c->hChrFilterSize;
-    int16_t **lumPixBuf= c->lumPixBuf;
-    int16_t **chrPixBuf= c->chrPixBuf;
-    int16_t **alpPixBuf= c->alpPixBuf;
-    const int vLumBufSize= c->vLumBufSize;
-    const int vChrBufSize= c->vChrBufSize;
-    uint8_t *formatConvBuffer= c->formatConvBuffer;
-    const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample;
-    const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample);
-    int lastDstY;
-    uint32_t *pal=c->pal_yuv;
-
-    /* vars which will change and which we need to store back in the context */
-    int dstY= c->dstY;
-    int lumBufIndex= c->lumBufIndex;
-    int chrBufIndex= c->chrBufIndex;
-    int lastInLumBuf= c->lastInLumBuf;
-    int lastInChrBuf= c->lastInChrBuf;
-
-    if (isPacked(c->srcFormat)) {
-        src[0]=
-        src[1]=
-        src[2]=
-        src[3]= src[0];
-        srcStride[0]=
-        srcStride[1]=
-        srcStride[2]=
-        srcStride[3]= srcStride[0];
-    }
-    srcStride[1]<<= c->vChrDrop;
-    srcStride[2]<<= c->vChrDrop;
-
-    DEBUG_BUFFERS("swScale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n",
-                  src[0], srcStride[0], src[1], srcStride[1], src[2], srcStride[2], src[3], srcStride[3],
-                  dst[0], dstStride[0], dst[1], dstStride[1], dst[2], dstStride[2], dst[3], dstStride[3]);
-    DEBUG_BUFFERS("srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n",
-                   srcSliceY,    srcSliceH,    dstY,    dstH);
-    DEBUG_BUFFERS("vLumFilterSize: %d vLumBufSize: %d vChrFilterSize: %d vChrBufSize: %d\n",
-                   vLumFilterSize,    vLumBufSize,    vChrFilterSize,    vChrBufSize);
-
-    if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0 || dstStride[3]%8 != 0) {
-        static int warnedAlready=0; //FIXME move this into the context perhaps
-        if (flags & SWS_PRINT_INFO && !warnedAlready) {
-            av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n"
-                   "         ->cannot do aligned memory accesses anymore\n");
-            warnedAlready=1;
-        }
-    }
-
-    /* Note the user might start scaling the picture in the middle so this
-       will not get executed. This is not really intended but works
-       currently, so people might do it. */
-    if (srcSliceY ==0) {
-        lumBufIndex=-1;
-        chrBufIndex=-1;
-        dstY=0;
-        lastInLumBuf= -1;
-        lastInChrBuf= -1;
-    }
-
-    lastDstY= dstY;
-
-    for (;dstY < dstH; dstY++) {
-        unsigned char *dest =dst[0]+dstStride[0]*dstY;
-        const int chrDstY= dstY>>c->chrDstVSubSample;
-        unsigned char *uDest=dst[1]+dstStride[1]*chrDstY;
-        unsigned char *vDest=dst[2]+dstStride[2]*chrDstY;
-        unsigned char *aDest=(CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3]+dstStride[3]*dstY : NULL;
-
-        const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
-        const int firstLumSrcY2= vLumFilterPos[FFMIN(dstY | ((1<<c->chrDstVSubSample) - 1), dstH-1)];
-        const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
-        int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input
-        int lastLumSrcY2=firstLumSrcY2+ vLumFilterSize -1; // Last line needed as input
-        int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input
-        int enough_lines;
-
-        //handle holes (FAST_BILINEAR & weird filters)
-        if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1;
-        if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1;
-        assert(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1);
-        assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1);
-
-        DEBUG_BUFFERS("dstY: %d\n", dstY);
-        DEBUG_BUFFERS("\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n",
-                         firstLumSrcY,    lastLumSrcY,    lastInLumBuf);
-        DEBUG_BUFFERS("\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n",
-                         firstChrSrcY,    lastChrSrcY,    lastInChrBuf);
-
-        // Do we have enough lines in this slice to output the dstY line
-        enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample);
-
-        if (!enough_lines) {
-            lastLumSrcY = srcSliceY + srcSliceH - 1;
-            lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1;
-            DEBUG_BUFFERS("buffering slice: lastLumSrcY %d lastChrSrcY %d\n",
-                                            lastLumSrcY, lastChrSrcY);
-        }
-
-        //Do horizontal scaling
-        while(lastInLumBuf < lastLumSrcY) {
-            const uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
-            const uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3];
-            lumBufIndex++;
-            assert(lumBufIndex < 2*vLumBufSize);
-            assert(lastInLumBuf + 1 - srcSliceY < srcSliceH);
-            assert(lastInLumBuf + 1 - srcSliceY >= 0);
-            RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc,
-                            hLumFilter, hLumFilterPos, hLumFilterSize,
-                            formatConvBuffer,
-                            pal, 0);
-            if (CONFIG_SWSCALE_ALPHA && alpPixBuf)
-                RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc,
-                                hLumFilter, hLumFilterPos, hLumFilterSize,
-                                formatConvBuffer,
-                                pal, 1);
-            lastInLumBuf++;
-            DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n",
-                               lumBufIndex,    lastInLumBuf);
-        }
-        while(lastInChrBuf < lastChrSrcY) {
-            const uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
-            const uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
-            chrBufIndex++;
-            assert(chrBufIndex < 2*vChrBufSize);
-            assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH));
-            assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
-            //FIXME replace parameters through context struct (some at least)
-
-            if (c->needs_hcscale)
-                RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc,
-                                hChrFilter, hChrFilterPos, hChrFilterSize,
-                                formatConvBuffer,
-                                pal);
-            lastInChrBuf++;
-            DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n",
-                               chrBufIndex,    lastInChrBuf);
-        }
-        //wrap buf index around to stay inside the ring buffer
-        if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize;
-        if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize;
-        if (!enough_lines)
-            break; //we can't output a dstY line so let's try with the next slice
-
-#if COMPILE_TEMPLATE_MMX
-        c->blueDither= ff_dither8[dstY&1];
-        if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
-            c->greenDither= ff_dither8[dstY&1];
-        else
-            c->greenDither= ff_dither4[dstY&1];
-        c->redDither= ff_dither8[(dstY+1)&1];
-#endif
-        if (dstY < dstH-2) {
-            const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
-            const int16_t **chrSrcPtr= (const int16_t **) chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
-            const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
-#if COMPILE_TEMPLATE_MMX
-            int i;
-            if (flags & SWS_ACCURATE_RND) {
-                int s= APCK_SIZE / 8;
-                for (i=0; i<vLumFilterSize; i+=2) {
-                    *(const void**)&lumMmxFilter[s*i              ]= lumSrcPtr[i  ];
-                    *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4  ]= lumSrcPtr[i+(vLumFilterSize>1)];
-                              lumMmxFilter[s*i+APCK_COEF/4  ]=
-                              lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i    ]
-                        + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
-                    if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
-                        *(const void**)&alpMmxFilter[s*i              ]= alpSrcPtr[i  ];
-                        *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4  ]= alpSrcPtr[i+(vLumFilterSize>1)];
-                                  alpMmxFilter[s*i+APCK_COEF/4  ]=
-                                  alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4  ];
-                    }
-                }
-                for (i=0; i<vChrFilterSize; i+=2) {
-                    *(const void**)&chrMmxFilter[s*i              ]= chrSrcPtr[i  ];
-                    *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4  ]= chrSrcPtr[i+(vChrFilterSize>1)];
-                              chrMmxFilter[s*i+APCK_COEF/4  ]=
-                              chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i    ]
-                        + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
-                }
-            } else {
-                for (i=0; i<vLumFilterSize; i++) {
-                    lumMmxFilter[4*i+0]= (int32_t)lumSrcPtr[i];
-                    lumMmxFilter[4*i+1]= (uint64_t)lumSrcPtr[i] >> 32;
-                    lumMmxFilter[4*i+2]=
-                    lumMmxFilter[4*i+3]=
-                        ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
-                    if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
-                        alpMmxFilter[4*i+0]= (int32_t)alpSrcPtr[i];
-                        alpMmxFilter[4*i+1]= (uint64_t)alpSrcPtr[i] >> 32;
-                        alpMmxFilter[4*i+2]=
-                        alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
-                    }
-                }
-                for (i=0; i<vChrFilterSize; i++) {
-                    chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i];
-                    chrMmxFilter[4*i+1]= (uint64_t)chrSrcPtr[i] >> 32;
-                    chrMmxFilter[4*i+2]=
-                    chrMmxFilter[4*i+3]=
-                        ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;
-                }
-            }
-#endif
-            if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) {
-                const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
-                if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
-                c->yuv2nv12X(c,
-                             vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
-                             vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                             dest, uDest, dstW, chrDstW, dstFormat);
-            } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 like
-                const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
-                if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
-                if (is16BPS(dstFormat)) {
-                    yuv2yuvX16inC(
-                                  vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
-                                  vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                  alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW,
-                                  dstFormat);
-                } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12
-                    const int16_t *lumBuf = lumSrcPtr[0];
-                    const int16_t *chrBuf= chrSrcPtr[0];
-                    const int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL;
-                    c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW);
-                } else { //General YV12
-                    c->yuv2yuvX(c,
-                                vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
-                                vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW);
-                }
-            } else {
-                assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
-                assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2);
-                if (vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB
-                    int chrAlpha= vChrFilter[2*dstY+1];
-                    if(flags & SWS_FULL_CHR_H_INT) {
-                        yuv2rgbXinC_full(c, //FIXME write a packed1_full function
-                                         vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
-                                         vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                         alpSrcPtr, dest, dstW, dstY);
-                    } else {
-                        c->yuv2packed1(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1),
-                                       alpPixBuf ? *alpSrcPtr : NULL,
-                                       dest, dstW, chrAlpha, dstFormat, flags, dstY);
-                    }
-                } else if (vLumFilterSize == 2 && vChrFilterSize == 2) { //bilinear upscale RGB
-                    int lumAlpha= vLumFilter[2*dstY+1];
-                    int chrAlpha= vChrFilter[2*dstY+1];
-                    lumMmxFilter[2]=
-                    lumMmxFilter[3]= vLumFilter[2*dstY   ]*0x10001;
-                    chrMmxFilter[2]=
-                    chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001;
-                    if(flags & SWS_FULL_CHR_H_INT) {
-                        yuv2rgbXinC_full(c, //FIXME write a packed2_full function
-                                         vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
-                                         vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                         alpSrcPtr, dest, dstW, dstY);
-                    } else {
-                        c->yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1),
-                                       alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL,
-                                       dest, dstW, lumAlpha, chrAlpha, dstY);
-                    }
-                } else { //general RGB
-                    if(flags & SWS_FULL_CHR_H_INT) {
-                        yuv2rgbXinC_full(c,
-                                         vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
-                                         vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                         alpSrcPtr, dest, dstW, dstY);
-                    } else {
-                        c->yuv2packedX(c,
-                                       vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
-                                       vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                       alpSrcPtr, dest, dstW, dstY);
-                    }
-                }
-            }
-        } else { // hmm looks like we can't use MMX here without overwriting this array's tail
-            const int16_t **lumSrcPtr= (const int16_t **)lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
-            const int16_t **chrSrcPtr= (const int16_t **)chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
-            const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
-            if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) {
-                const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
-                if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
-                yuv2nv12XinC(
-                             vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
-                             vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                             dest, uDest, dstW, chrDstW, dstFormat);
-            } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12
-                const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
-                if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
-                if (is16BPS(dstFormat)) {
-                    yuv2yuvX16inC(
-                                  vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
-                                  vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                  alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW,
-                                  dstFormat);
-                } else {
-                    yuv2yuvXinC(
-                                vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
-                                vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW);
-                }
-            } else {
-                assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
-                assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2);
-                if(flags & SWS_FULL_CHR_H_INT) {
-                    yuv2rgbXinC_full(c,
-                                     vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
-                                     vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                     alpSrcPtr, dest, dstW, dstY);
-                } else {
-                    yuv2packedXinC(c,
-                                   vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
-                                   vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
-                                   alpSrcPtr, dest, dstW, dstY);
-                }
-            }
-        }
-    }
-
-    if ((dstFormat == PIX_FMT_YUVA420P) && !alpPixBuf)
-        fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255);
-
-#if COMPILE_TEMPLATE_MMX
-    if (flags & SWS_CPU_CAPS_MMX2 )  __asm__ volatile("sfence":::"memory");
-    /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
-    if (flags & SWS_CPU_CAPS_3DNOW)  __asm__ volatile("femms" :::"memory");
-    else                             __asm__ volatile("emms"  :::"memory");
-#endif
-    /* store changed local vars back in the context */
-    c->dstY= dstY;
-    c->lumBufIndex= lumBufIndex;
-    c->chrBufIndex= chrBufIndex;
-    c->lastInLumBuf= lastInLumBuf;
-    c->lastInChrBuf= lastInChrBuf;
-
-    return dstY - lastDstY;
-}
-
-static void RENAME(sws_init_swScale)(SwsContext *c)
-{
-    enum PixelFormat srcFormat = c->srcFormat;
-
-    c->yuv2nv12X    = RENAME(yuv2nv12X   );
-    c->yuv2yuv1     = RENAME(yuv2yuv1    );
-    c->yuv2yuvX     = RENAME(yuv2yuvX    );
-    c->yuv2packed1  = RENAME(yuv2packed1 );
-    c->yuv2packed2  = RENAME(yuv2packed2 );
-    c->yuv2packedX  = RENAME(yuv2packedX );
-
-    c->hScale       = RENAME(hScale      );
-
-#if COMPILE_TEMPLATE_MMX
-    // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
-    if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed)
-#else
-    if (c->flags & SWS_FAST_BILINEAR)
-#endif
-    {
-        c->hyscale_fast = RENAME(hyscale_fast);
-        c->hcscale_fast = RENAME(hcscale_fast);
-    }
-
-    c->chrToYV12 = NULL;
-    switch(srcFormat) {
-        case PIX_FMT_YUYV422  : c->chrToYV12 = RENAME(yuy2ToUV); break;
-        case PIX_FMT_UYVY422  : c->chrToYV12 = RENAME(uyvyToUV); break;
-        case PIX_FMT_NV12     : c->chrToYV12 = RENAME(nv12ToUV); break;
-        case PIX_FMT_NV21     : c->chrToYV12 = RENAME(nv21ToUV); break;
-        case PIX_FMT_RGB8     :
-        case PIX_FMT_BGR8     :
-        case PIX_FMT_PAL8     :
-        case PIX_FMT_BGR4_BYTE:
-        case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV; break;
-        case PIX_FMT_YUV420P16BE:
-        case PIX_FMT_YUV422P16BE:
-        case PIX_FMT_YUV444P16BE: c->chrToYV12 = RENAME(BEToUV); break;
-        case PIX_FMT_YUV420P16LE:
-        case PIX_FMT_YUV422P16LE:
-        case PIX_FMT_YUV444P16LE: c->chrToYV12 = RENAME(LEToUV); break;
-    }
-    if (c->chrSrcHSubSample) {
-        switch(srcFormat) {
-        case PIX_FMT_RGB48BE:
-        case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV_half; break;
-        case PIX_FMT_RGB32  :
-        case PIX_FMT_RGB32_1: c->chrToYV12 = bgr32ToUV_half; break;
-        case PIX_FMT_BGR24  : c->chrToYV12 = RENAME(bgr24ToUV_half); break;
-        case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV_half; break;
-        case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV_half; break;
-        case PIX_FMT_BGR32  :
-        case PIX_FMT_BGR32_1: c->chrToYV12 = rgb32ToUV_half; break;
-        case PIX_FMT_RGB24  : c->chrToYV12 = RENAME(rgb24ToUV_half); break;
-        case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV_half; break;
-        case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV_half; break;
-        }
-    } else {
-        switch(srcFormat) {
-        case PIX_FMT_RGB48BE:
-        case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV; break;
-        case PIX_FMT_RGB32  :
-        case PIX_FMT_RGB32_1: c->chrToYV12 = bgr32ToUV; break;
-        case PIX_FMT_BGR24  : c->chrToYV12 = RENAME(bgr24ToUV); break;
-        case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV; break;
-        case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV; break;
-        case PIX_FMT_BGR32  :
-        case PIX_FMT_BGR32_1: c->chrToYV12 = rgb32ToUV; break;
-        case PIX_FMT_RGB24  : c->chrToYV12 = RENAME(rgb24ToUV); break;
-        case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV; break;
-        case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV; break;
-        }
-    }
-
-    c->lumToYV12 = NULL;
-    c->alpToYV12 = NULL;
-    switch (srcFormat) {
-    case PIX_FMT_YUYV422  :
-    case PIX_FMT_YUV420P16BE:
-    case PIX_FMT_YUV422P16BE:
-    case PIX_FMT_YUV444P16BE:
-    case PIX_FMT_GRAY16BE : c->lumToYV12 = RENAME(yuy2ToY); break;
-    case PIX_FMT_UYVY422  :
-    case PIX_FMT_YUV420P16LE:
-    case PIX_FMT_YUV422P16LE:
-    case PIX_FMT_YUV444P16LE:
-    case PIX_FMT_GRAY16LE : c->lumToYV12 = RENAME(uyvyToY); break;
-    case PIX_FMT_BGR24    : c->lumToYV12 = RENAME(bgr24ToY); break;
-    case PIX_FMT_BGR565   : c->lumToYV12 = bgr16ToY; break;
-    case PIX_FMT_BGR555   : c->lumToYV12 = bgr15ToY; break;
-    case PIX_FMT_RGB24    : c->lumToYV12 = RENAME(rgb24ToY); break;
-    case PIX_FMT_RGB565   : c->lumToYV12 = rgb16ToY; break;
-    case PIX_FMT_RGB555   : c->lumToYV12 = rgb15ToY; break;
-    case PIX_FMT_RGB8     :
-    case PIX_FMT_BGR8     :
-    case PIX_FMT_PAL8     :
-    case PIX_FMT_BGR4_BYTE:
-    case PIX_FMT_RGB4_BYTE: c->lumToYV12 = palToY; break;
-    case PIX_FMT_MONOBLACK: c->lumToYV12 = monoblack2Y; break;
-    case PIX_FMT_MONOWHITE: c->lumToYV12 = monowhite2Y; break;
-    case PIX_FMT_RGB32  :
-    case PIX_FMT_RGB32_1: c->lumToYV12 = bgr32ToY; break;
-    case PIX_FMT_BGR32  :
-    case PIX_FMT_BGR32_1: c->lumToYV12 = rgb32ToY; break;
-    case PIX_FMT_RGB48BE:
-    case PIX_FMT_RGB48LE: c->lumToYV12 = rgb48ToY; break;
-    }
-    if (c->alpPixBuf) {
-        switch (srcFormat) {
-        case PIX_FMT_RGB32  :
-        case PIX_FMT_RGB32_1:
-        case PIX_FMT_BGR32  :
-        case PIX_FMT_BGR32_1: c->alpToYV12 = abgrToA; break;
-        }
-    }
-
-    switch (srcFormat) {
-    case PIX_FMT_RGB32  :
-    case PIX_FMT_BGR32  :
-        c->alpSrcOffset = 3;
-        break;
-    case PIX_FMT_RGB32_1:
-    case PIX_FMT_BGR32_1:
-        c->lumSrcOffset = ALT32_CORR;
-        c->chrSrcOffset = ALT32_CORR;
-        break;
-    case PIX_FMT_RGB48LE:
-        c->lumSrcOffset = 1;
-        c->chrSrcOffset = 1;
-        c->alpSrcOffset = 1;
-        break;
-    }
-
-    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
-        if (c->srcRange) {
-            c->lumConvertRange = RENAME(lumRangeFromJpeg);
-            c->chrConvertRange = RENAME(chrRangeFromJpeg);
-        } else {
-            c->lumConvertRange = RENAME(lumRangeToJpeg);
-            c->chrConvertRange = RENAME(chrRangeToJpeg);
-        }
-    }
-
-    if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
-          srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))
-        c->needs_hcscale = 1;
-}
diff --git a/libswscale/utils.c b/libswscale/utils.c
deleted file mode 100644
index d7a6ea2..0000000
--- a/libswscale/utils.c
+++ /dev/null
@@ -1,1591 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define _SVID_SOURCE //needed for MAP_ANONYMOUS
-#include <inttypes.h>
-#include <string.h>
-#include <math.h>
-#include <stdio.h>
-#include "config.h"
-#include <assert.h>
-#if HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-#endif
-#if HAVE_VIRTUALALLOC
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#endif
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "rgb2rgb.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/avutil.h"
-#include "libavutil/bswap.h"
-#include "libavutil/pixdesc.h"
-
-unsigned swscale_version(void)
-{
-    return LIBSWSCALE_VERSION_INT;
-}
-
-const char *swscale_configuration(void)
-{
-    return FFMPEG_CONFIGURATION;
-}
-
-const char *swscale_license(void)
-{
-#define LICENSE_PREFIX "libswscale license: "
-    return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
-
-#define RET 0xC3 //near return opcode for x86
-
-#define isSupportedIn(x)    (       \
-           (x)==PIX_FMT_YUV420P     \
-        || (x)==PIX_FMT_YUVA420P    \
-        || (x)==PIX_FMT_YUYV422     \
-        || (x)==PIX_FMT_UYVY422     \
-        || (x)==PIX_FMT_RGB48BE     \
-        || (x)==PIX_FMT_RGB48LE     \
-        || (x)==PIX_FMT_RGB32       \
-        || (x)==PIX_FMT_RGB32_1     \
-        || (x)==PIX_FMT_BGR24       \
-        || (x)==PIX_FMT_BGR565      \
-        || (x)==PIX_FMT_BGR555      \
-        || (x)==PIX_FMT_BGR32       \
-        || (x)==PIX_FMT_BGR32_1     \
-        || (x)==PIX_FMT_RGB24       \
-        || (x)==PIX_FMT_RGB565      \
-        || (x)==PIX_FMT_RGB555      \
-        || (x)==PIX_FMT_GRAY8       \
-        || (x)==PIX_FMT_YUV410P     \
-        || (x)==PIX_FMT_YUV440P     \
-        || (x)==PIX_FMT_NV12        \
-        || (x)==PIX_FMT_NV21        \
-        || (x)==PIX_FMT_GRAY16BE    \
-        || (x)==PIX_FMT_GRAY16LE    \
-        || (x)==PIX_FMT_YUV444P     \
-        || (x)==PIX_FMT_YUV422P     \
-        || (x)==PIX_FMT_YUV411P     \
-        || (x)==PIX_FMT_YUVJ420P    \
-        || (x)==PIX_FMT_YUVJ422P    \
-        || (x)==PIX_FMT_YUVJ440P    \
-        || (x)==PIX_FMT_YUVJ444P    \
-        || (x)==PIX_FMT_PAL8        \
-        || (x)==PIX_FMT_BGR8        \
-        || (x)==PIX_FMT_RGB8        \
-        || (x)==PIX_FMT_BGR4_BYTE   \
-        || (x)==PIX_FMT_RGB4_BYTE   \
-        || (x)==PIX_FMT_YUV440P     \
-        || (x)==PIX_FMT_MONOWHITE   \
-        || (x)==PIX_FMT_MONOBLACK   \
-        || (x)==PIX_FMT_YUV420P16LE   \
-        || (x)==PIX_FMT_YUV422P16LE   \
-        || (x)==PIX_FMT_YUV444P16LE   \
-        || (x)==PIX_FMT_YUV420P16BE   \
-        || (x)==PIX_FMT_YUV422P16BE   \
-        || (x)==PIX_FMT_YUV444P16BE   \
-    )
-
-int sws_isSupportedInput(enum PixelFormat pix_fmt)
-{
-    return isSupportedIn(pix_fmt);
-}
-
-#define isSupportedOut(x)   (       \
-           (x)==PIX_FMT_YUV420P     \
-        || (x)==PIX_FMT_YUVA420P    \
-        || (x)==PIX_FMT_YUYV422     \
-        || (x)==PIX_FMT_UYVY422     \
-        || (x)==PIX_FMT_YUV444P     \
-        || (x)==PIX_FMT_YUV422P     \
-        || (x)==PIX_FMT_YUV411P     \
-        || (x)==PIX_FMT_YUVJ420P    \
-        || (x)==PIX_FMT_YUVJ422P    \
-        || (x)==PIX_FMT_YUVJ440P    \
-        || (x)==PIX_FMT_YUVJ444P    \
-        || isAnyRGB(x)              \
-        || (x)==PIX_FMT_NV12        \
-        || (x)==PIX_FMT_NV21        \
-        || (x)==PIX_FMT_GRAY16BE    \
-        || (x)==PIX_FMT_GRAY16LE    \
-        || (x)==PIX_FMT_GRAY8       \
-        || (x)==PIX_FMT_YUV410P     \
-        || (x)==PIX_FMT_YUV440P     \
-        || (x)==PIX_FMT_YUV420P16LE   \
-        || (x)==PIX_FMT_YUV422P16LE   \
-        || (x)==PIX_FMT_YUV444P16LE   \
-        || (x)==PIX_FMT_YUV420P16BE   \
-        || (x)==PIX_FMT_YUV422P16BE   \
-        || (x)==PIX_FMT_YUV444P16BE   \
-    )
-
-int sws_isSupportedOutput(enum PixelFormat pix_fmt)
-{
-    return isSupportedOut(pix_fmt);
-}
-
-extern const int32_t ff_yuv2rgb_coeffs[8][4];
-
-const char *sws_format_name(enum PixelFormat format)
-{
-    if ((unsigned)format < PIX_FMT_NB && av_pix_fmt_descriptors[format].name)
-        return av_pix_fmt_descriptors[format].name;
-    else
-        return "Unknown format";
-}
-
-static double getSplineCoeff(double a, double b, double c, double d, double dist)
-{
-//    printf("%f %f %f %f %f\n", a,b,c,d,dist);
-    if (dist<=1.0) return ((d*dist + c)*dist + b)*dist +a;
-    else           return getSplineCoeff(        0.0,
-                                          b+ 2.0*c + 3.0*d,
-                                                 c + 3.0*d,
-                                         -b- 3.0*c - 6.0*d,
-                                         dist-1.0);
-}
-
-static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc,
-                      int srcW, int dstW, int filterAlign, int one, int flags,
-                      SwsVector *srcFilter, SwsVector *dstFilter, double param[2])
-{
-    int i;
-    int filterSize;
-    int filter2Size;
-    int minFilterSize;
-    int64_t *filter=NULL;
-    int64_t *filter2=NULL;
-    const int64_t fone= 1LL<<54;
-    int ret= -1;
-#if ARCH_X86
-    if (flags & SWS_CPU_CAPS_MMX)
-        __asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
-#endif
-
-    // NOTE: the +1 is for the MMX scaler which reads over the end
-    FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW+1)*sizeof(int16_t), fail);
-
-    if (FFABS(xInc - 0x10000) <10) { // unscaled
-        int i;
-        filterSize= 1;
-        FF_ALLOCZ_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
-        for (i=0; i<dstW; i++) {
-            filter[i*filterSize]= fone;
-            (*filterPos)[i]=i;
-        }
-
-    } else if (flags&SWS_POINT) { // lame looking point sampling mode
-        int i;
-        int xDstInSrc;
-        filterSize= 1;
-        FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
-        xDstInSrc= xInc/2 - 0x8000;
-        for (i=0; i<dstW; i++) {
-            int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
-
-            (*filterPos)[i]= xx;
-            filter[i]= fone;
-            xDstInSrc+= xInc;
-        }
-    } else if ((xInc <= (1<<16) && (flags&SWS_AREA)) || (flags&SWS_FAST_BILINEAR)) { // bilinear upscale
-        int i;
-        int xDstInSrc;
-        filterSize= 2;
-        FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
-        xDstInSrc= xInc/2 - 0x8000;
-        for (i=0; i<dstW; i++) {
-            int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
-            int j;
-
-            (*filterPos)[i]= xx;
-            //bilinear upscale / linear interpolate / area averaging
-            for (j=0; j<filterSize; j++) {
-                int64_t coeff= fone - FFABS((xx<<16) - xDstInSrc)*(fone>>16);
-                if (coeff<0) coeff=0;
-                filter[i*filterSize + j]= coeff;
-                xx++;
-            }
-            xDstInSrc+= xInc;
-        }
-    } else {
-        int xDstInSrc;
-        int sizeFactor;
-
-        if      (flags&SWS_BICUBIC)      sizeFactor=  4;
-        else if (flags&SWS_X)            sizeFactor=  8;
-        else if (flags&SWS_AREA)         sizeFactor=  1; //downscale only, for upscale it is bilinear
-        else if (flags&SWS_GAUSS)        sizeFactor=  8;   // infinite ;)
-        else if (flags&SWS_LANCZOS)      sizeFactor= param[0] != SWS_PARAM_DEFAULT ? ceil(2*param[0]) : 6;
-        else if (flags&SWS_SINC)         sizeFactor= 20; // infinite ;)
-        else if (flags&SWS_SPLINE)       sizeFactor= 20;  // infinite ;)
-        else if (flags&SWS_BILINEAR)     sizeFactor=  2;
-        else {
-            sizeFactor= 0; //GCC warning killer
-            assert(0);
-        }
-
-        if (xInc <= 1<<16)      filterSize= 1 + sizeFactor; // upscale
-        else                    filterSize= 1 + (sizeFactor*srcW + dstW - 1)/ dstW;
-
-        if (filterSize > srcW-2) filterSize=srcW-2;
-
-        FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
-        xDstInSrc= xInc - 0x10000;
-        for (i=0; i<dstW; i++) {
-            int xx= (xDstInSrc - ((filterSize-2)<<16)) / (1<<17);
-            int j;
-            (*filterPos)[i]= xx;
-            for (j=0; j<filterSize; j++) {
-                int64_t d= ((int64_t)FFABS((xx<<17) - xDstInSrc))<<13;
-                double floatd;
-                int64_t coeff;
-
-                if (xInc > 1<<16)
-                    d= d*dstW/srcW;
-                floatd= d * (1.0/(1<<30));
-
-                if (flags & SWS_BICUBIC) {
-                    int64_t B= (param[0] != SWS_PARAM_DEFAULT ? param[0] :   0) * (1<<24);
-                    int64_t C= (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1<<24);
-                    int64_t dd = ( d*d)>>30;
-                    int64_t ddd= (dd*d)>>30;
-
-                    if      (d < 1LL<<30)
-                        coeff = (12*(1<<24)-9*B-6*C)*ddd + (-18*(1<<24)+12*B+6*C)*dd + (6*(1<<24)-2*B)*(1<<30);
-                    else if (d < 1LL<<31)
-                        coeff = (-B-6*C)*ddd + (6*B+30*C)*dd + (-12*B-48*C)*d + (8*B+24*C)*(1<<30);
-                    else
-                        coeff=0.0;
-                    coeff *= fone>>(30+24);
-                }
-/*                else if (flags & SWS_X) {
-                    double p= param ? param*0.01 : 0.3;
-                    coeff = d ? sin(d*PI)/(d*PI) : 1.0;
-                    coeff*= pow(2.0, - p*d*d);
-                }*/
-                else if (flags & SWS_X) {
-                    double A= param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
-                    double c;
-
-                    if (floatd<1.0)
-                        c = cos(floatd*M_PI);
-                    else
-                        c=-1.0;
-                    if (c<0.0)      c= -pow(-c, A);
-                    else            c=  pow( c, A);
-                    coeff= (c*0.5 + 0.5)*fone;
-                } else if (flags & SWS_AREA) {
-                    int64_t d2= d - (1<<29);
-                    if      (d2*xInc < -(1LL<<(29+16))) coeff= 1.0 * (1LL<<(30+16));
-                    else if (d2*xInc <  (1LL<<(29+16))) coeff= -d2*xInc + (1LL<<(29+16));
-                    else coeff=0.0;
-                    coeff *= fone>>(30+16);
-                } else if (flags & SWS_GAUSS) {
-                    double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
-                    coeff = (pow(2.0, - p*floatd*floatd))*fone;
-                } else if (flags & SWS_SINC) {
-                    coeff = (d ? sin(floatd*M_PI)/(floatd*M_PI) : 1.0)*fone;
-                } else if (flags & SWS_LANCZOS) {
-                    double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
-                    coeff = (d ? sin(floatd*M_PI)*sin(floatd*M_PI/p)/(floatd*floatd*M_PI*M_PI/p) : 1.0)*fone;
-                    if (floatd>p) coeff=0;
-                } else if (flags & SWS_BILINEAR) {
-                    coeff= (1<<30) - d;
-                    if (coeff<0) coeff=0;
-                    coeff *= fone >> 30;
-                } else if (flags & SWS_SPLINE) {
-                    double p=-2.196152422706632;
-                    coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, floatd) * fone;
-                } else {
-                    coeff= 0.0; //GCC warning killer
-                    assert(0);
-                }
-
-                filter[i*filterSize + j]= coeff;
-                xx++;
-            }
-            xDstInSrc+= 2*xInc;
-        }
-    }
-
-    /* apply src & dst Filter to filter -> filter2
-       av_free(filter);
-    */
-    assert(filterSize>0);
-    filter2Size= filterSize;
-    if (srcFilter) filter2Size+= srcFilter->length - 1;
-    if (dstFilter) filter2Size+= dstFilter->length - 1;
-    assert(filter2Size>0);
-    FF_ALLOCZ_OR_GOTO(NULL, filter2, filter2Size*dstW*sizeof(*filter2), fail);
-
-    for (i=0; i<dstW; i++) {
-        int j, k;
-
-        if(srcFilter) {
-            for (k=0; k<srcFilter->length; k++) {
-                for (j=0; j<filterSize; j++)
-                    filter2[i*filter2Size + k + j] += srcFilter->coeff[k]*filter[i*filterSize + j];
-            }
-        } else {
-            for (j=0; j<filterSize; j++)
-                filter2[i*filter2Size + j]= filter[i*filterSize + j];
-        }
-        //FIXME dstFilter
-
-        (*filterPos)[i]+= (filterSize-1)/2 - (filter2Size-1)/2;
-    }
-    av_freep(&filter);
-
-    /* try to reduce the filter-size (step1 find size and shift left) */
-    // Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not).
-    minFilterSize= 0;
-    for (i=dstW-1; i>=0; i--) {
-        int min= filter2Size;
-        int j;
-        int64_t cutOff=0.0;
-
-        /* get rid of near zero elements on the left by shifting left */
-        for (j=0; j<filter2Size; j++) {
-            int k;
-            cutOff += FFABS(filter2[i*filter2Size]);
-
-            if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
-
-            /* preserve monotonicity because the core can't handle the filter otherwise */
-            if (i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
-
-            // move filter coefficients left
-            for (k=1; k<filter2Size; k++)
-                filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k];
-            filter2[i*filter2Size + k - 1]= 0;
-            (*filterPos)[i]++;
-        }
-
-        cutOff=0;
-        /* count near zeros on the right */
-        for (j=filter2Size-1; j>0; j--) {
-            cutOff += FFABS(filter2[i*filter2Size + j]);
-
-            if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
-            min--;
-        }
-
-        if (min>minFilterSize) minFilterSize= min;
-    }
-
-    if (flags & SWS_CPU_CAPS_ALTIVEC) {
-        // we can handle the special case 4,
-        // so we don't want to go to the full 8
-        if (minFilterSize < 5)
-            filterAlign = 4;
-
-        // We really don't want to waste our time
-        // doing useless computation, so fall back on
-        // the scalar C code for very small filters.
-        // Vectorizing is worth it only if you have a
-        // decent-sized vector.
-        if (minFilterSize < 3)
-            filterAlign = 1;
-    }
-
-    if (flags & SWS_CPU_CAPS_MMX) {
-        // special case for unscaled vertical filtering
-        if (minFilterSize == 1 && filterAlign == 2)
-            filterAlign= 1;
-    }
-
-    assert(minFilterSize > 0);
-    filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
-    assert(filterSize > 0);
-    filter= av_malloc(filterSize*dstW*sizeof(*filter));
-    if (filterSize >= MAX_FILTER_SIZE*16/((flags&SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter)
-        goto fail;
-    *outFilterSize= filterSize;
-
-    if (flags&SWS_PRINT_INFO)
-        av_log(NULL, AV_LOG_VERBOSE, "SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
-    /* try to reduce the filter-size (step2 reduce it) */
-    for (i=0; i<dstW; i++) {
-        int j;
-
-        for (j=0; j<filterSize; j++) {
-            if (j>=filter2Size) filter[i*filterSize + j]= 0;
-            else               filter[i*filterSize + j]= filter2[i*filter2Size + j];
-            if((flags & SWS_BITEXACT) && j>=minFilterSize)
-                filter[i*filterSize + j]= 0;
-        }
-    }
-
-    //FIXME try to align filterPos if possible
-
-    //fix borders
-    for (i=0; i<dstW; i++) {
-        int j;
-        if ((*filterPos)[i] < 0) {
-            // move filter coefficients left to compensate for filterPos
-            for (j=1; j<filterSize; j++) {
-                int left= FFMAX(j + (*filterPos)[i], 0);
-                filter[i*filterSize + left] += filter[i*filterSize + j];
-                filter[i*filterSize + j]=0;
-            }
-            (*filterPos)[i]= 0;
-        }
-
-        if ((*filterPos)[i] + filterSize > srcW) {
-            int shift= (*filterPos)[i] + filterSize - srcW;
-            // move filter coefficients right to compensate for filterPos
-            for (j=filterSize-2; j>=0; j--) {
-                int right= FFMIN(j + shift, filterSize-1);
-                filter[i*filterSize +right] += filter[i*filterSize +j];
-                filter[i*filterSize +j]=0;
-            }
-            (*filterPos)[i]= srcW - filterSize;
-        }
-    }
-
-    // Note the +1 is for the MMX scaler which reads over the end
-    /* align at 16 for AltiVec (needed by hScale_altivec_real) */
-    FF_ALLOCZ_OR_GOTO(NULL, *outFilter, *outFilterSize*(dstW+1)*sizeof(int16_t), fail);
-
-    /* normalize & store in outFilter */
-    for (i=0; i<dstW; i++) {
-        int j;
-        int64_t error=0;
-        int64_t sum=0;
-
-        for (j=0; j<filterSize; j++) {
-            sum+= filter[i*filterSize + j];
-        }
-        sum= (sum + one/2)/ one;
-        for (j=0; j<*outFilterSize; j++) {
-            int64_t v= filter[i*filterSize + j] + error;
-            int intV= ROUNDED_DIV(v, sum);
-            (*outFilter)[i*(*outFilterSize) + j]= intV;
-            error= v - intV*sum;
-        }
-    }
-
-    (*filterPos)[dstW]= (*filterPos)[dstW-1]; // the MMX scaler will read over the end
-    for (i=0; i<*outFilterSize; i++) {
-        int j= dstW*(*outFilterSize);
-        (*outFilter)[j + i]= (*outFilter)[j + i - (*outFilterSize)];
-    }
-
-    ret=0;
-fail:
-    av_free(filter);
-    av_free(filter2);
-    return ret;
-}
-
-#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT)
-static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *filter, int32_t *filterPos, int numSplits)
-{
-    uint8_t *fragmentA;
-    x86_reg imm8OfPShufW1A;
-    x86_reg imm8OfPShufW2A;
-    x86_reg fragmentLengthA;
-    uint8_t *fragmentB;
-    x86_reg imm8OfPShufW1B;
-    x86_reg imm8OfPShufW2B;
-    x86_reg fragmentLengthB;
-    int fragmentPos;
-
-    int xpos, i;
-
-    // create an optimized horizontal scaling routine
-    /* This scaler is made of runtime-generated MMX2 code using specially
-     * tuned pshufw instructions. For every four output pixels, if four
-     * input pixels are enough for the fast bilinear scaling, then a chunk
-     * of fragmentB is used. If five input pixels are needed, then a chunk
-     * of fragmentA is used.
-     */
-
-    //code fragment
-
-    __asm__ volatile(
-        "jmp                         9f                 \n\t"
-    // Begin
-        "0:                                             \n\t"
-        "movq    (%%"REG_d", %%"REG_a"), %%mm3          \n\t"
-        "movd    (%%"REG_c", %%"REG_S"), %%mm0          \n\t"
-        "movd   1(%%"REG_c", %%"REG_S"), %%mm1          \n\t"
-        "punpcklbw                %%mm7, %%mm1          \n\t"
-        "punpcklbw                %%mm7, %%mm0          \n\t"
-        "pshufw                   $0xFF, %%mm1, %%mm1   \n\t"
-        "1:                                             \n\t"
-        "pshufw                   $0xFF, %%mm0, %%mm0   \n\t"
-        "2:                                             \n\t"
-        "psubw                    %%mm1, %%mm0          \n\t"
-        "movl   8(%%"REG_b", %%"REG_a"), %%esi          \n\t"
-        "pmullw                   %%mm3, %%mm0          \n\t"
-        "psllw                       $7, %%mm1          \n\t"
-        "paddw                    %%mm1, %%mm0          \n\t"
-
-        "movq                     %%mm0, (%%"REG_D", %%"REG_a") \n\t"
-
-        "add                         $8, %%"REG_a"      \n\t"
-    // End
-        "9:                                             \n\t"
-//        "int $3                                         \n\t"
-        "lea                 " LOCAL_MANGLE(0b) ", %0   \n\t"
-        "lea                 " LOCAL_MANGLE(1b) ", %1   \n\t"
-        "lea                 " LOCAL_MANGLE(2b) ", %2   \n\t"
-        "dec                         %1                 \n\t"
-        "dec                         %2                 \n\t"
-        "sub                         %0, %1             \n\t"
-        "sub                         %0, %2             \n\t"
-        "lea                 " LOCAL_MANGLE(9b) ", %3   \n\t"
-        "sub                         %0, %3             \n\t"
-
-
-        :"=r" (fragmentA), "=r" (imm8OfPShufW1A), "=r" (imm8OfPShufW2A),
-        "=r" (fragmentLengthA)
-    );
-
-    __asm__ volatile(
-        "jmp                         9f                 \n\t"
-    // Begin
-        "0:                                             \n\t"
-        "movq    (%%"REG_d", %%"REG_a"), %%mm3          \n\t"
-        "movd    (%%"REG_c", %%"REG_S"), %%mm0          \n\t"
-        "punpcklbw                %%mm7, %%mm0          \n\t"
-        "pshufw                   $0xFF, %%mm0, %%mm1   \n\t"
-        "1:                                             \n\t"
-        "pshufw                   $0xFF, %%mm0, %%mm0   \n\t"
-        "2:                                             \n\t"
-        "psubw                    %%mm1, %%mm0          \n\t"
-        "movl   8(%%"REG_b", %%"REG_a"), %%esi          \n\t"
-        "pmullw                   %%mm3, %%mm0          \n\t"
-        "psllw                       $7, %%mm1          \n\t"
-        "paddw                    %%mm1, %%mm0          \n\t"
-
-        "movq                     %%mm0, (%%"REG_D", %%"REG_a") \n\t"
-
-        "add                         $8, %%"REG_a"      \n\t"
-    // End
-        "9:                                             \n\t"
-//        "int                       $3                   \n\t"
-        "lea                 " LOCAL_MANGLE(0b) ", %0   \n\t"
-        "lea                 " LOCAL_MANGLE(1b) ", %1   \n\t"
-        "lea                 " LOCAL_MANGLE(2b) ", %2   \n\t"
-        "dec                         %1                 \n\t"
-        "dec                         %2                 \n\t"
-        "sub                         %0, %1             \n\t"
-        "sub                         %0, %2             \n\t"
-        "lea                 " LOCAL_MANGLE(9b) ", %3   \n\t"
-        "sub                         %0, %3             \n\t"
-
-
-        :"=r" (fragmentB), "=r" (imm8OfPShufW1B), "=r" (imm8OfPShufW2B),
-        "=r" (fragmentLengthB)
-    );
-
-    xpos= 0; //lumXInc/2 - 0x8000; // difference between pixel centers
-    fragmentPos=0;
-
-    for (i=0; i<dstW/numSplits; i++) {
-        int xx=xpos>>16;
-
-        if ((i&3) == 0) {
-            int a=0;
-            int b=((xpos+xInc)>>16) - xx;
-            int c=((xpos+xInc*2)>>16) - xx;
-            int d=((xpos+xInc*3)>>16) - xx;
-            int inc                = (d+1<4);
-            uint8_t *fragment      = (d+1<4) ? fragmentB       : fragmentA;
-            x86_reg imm8OfPShufW1  = (d+1<4) ? imm8OfPShufW1B  : imm8OfPShufW1A;
-            x86_reg imm8OfPShufW2  = (d+1<4) ? imm8OfPShufW2B  : imm8OfPShufW2A;
-            x86_reg fragmentLength = (d+1<4) ? fragmentLengthB : fragmentLengthA;
-            int maxShift= 3-(d+inc);
-            int shift=0;
-
-            if (filterCode) {
-                filter[i  ] = (( xpos         & 0xFFFF) ^ 0xFFFF)>>9;
-                filter[i+1] = (((xpos+xInc  ) & 0xFFFF) ^ 0xFFFF)>>9;
-                filter[i+2] = (((xpos+xInc*2) & 0xFFFF) ^ 0xFFFF)>>9;
-                filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9;
-                filterPos[i/2]= xx;
-
-                memcpy(filterCode + fragmentPos, fragment, fragmentLength);
-
-                filterCode[fragmentPos + imm8OfPShufW1]=
-                    (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6);
-                filterCode[fragmentPos + imm8OfPShufW2]=
-                    a | (b<<2) | (c<<4) | (d<<6);
-
-                if (i+4-inc>=dstW) shift=maxShift; //avoid overread
-                else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align
-
-                if (shift && i>=shift) {
-                    filterCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift;
-                    filterCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift;
-                    filterPos[i/2]-=shift;
-                }
-            }
-
-            fragmentPos+= fragmentLength;
-
-            if (filterCode)
-                filterCode[fragmentPos]= RET;
-        }
-        xpos+=xInc;
-    }
-    if (filterCode)
-        filterPos[((i/2)+1)&(~1)]= xpos>>16; // needed to jump to the next part
-
-    return fragmentPos + 1;
-}
-#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) */
-
-static void getSubSampleFactors(int *h, int *v, enum PixelFormat format)
-{
-    *h = av_pix_fmt_descriptors[format].log2_chroma_w;
-    *v = av_pix_fmt_descriptors[format].log2_chroma_h;
-}
-
-static uint16_t roundToInt16(int64_t f)
-{
-    int r= (f + (1<<15))>>16;
-         if (r<-0x7FFF) return 0x8000;
-    else if (r> 0x7FFF) return 0x7FFF;
-    else                return r;
-}
-
-int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
-{
-    int64_t crv =  inv_table[0];
-    int64_t cbu =  inv_table[1];
-    int64_t cgu = -inv_table[2];
-    int64_t cgv = -inv_table[3];
-    int64_t cy  = 1<<16;
-    int64_t oy  = 0;
-
-    memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4);
-    memcpy(c->dstColorspaceTable,     table, sizeof(int)*4);
-
-    c->brightness= brightness;
-    c->contrast  = contrast;
-    c->saturation= saturation;
-    c->srcRange  = srcRange;
-    c->dstRange  = dstRange;
-    if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
-
-    c->uOffset=   0x0400040004000400LL;
-    c->vOffset=   0x0400040004000400LL;
-
-    if (!srcRange) {
-        cy= (cy*255) / 219;
-        oy= 16<<16;
-    } else {
-        crv= (crv*224) / 255;
-        cbu= (cbu*224) / 255;
-        cgu= (cgu*224) / 255;
-        cgv= (cgv*224) / 255;
-    }
-
-    cy = (cy *contrast             )>>16;
-    crv= (crv*contrast * saturation)>>32;
-    cbu= (cbu*contrast * saturation)>>32;
-    cgu= (cgu*contrast * saturation)>>32;
-    cgv= (cgv*contrast * saturation)>>32;
-
-    oy -= 256*brightness;
-
-    c->yCoeff=    roundToInt16(cy *8192) * 0x0001000100010001ULL;
-    c->vrCoeff=   roundToInt16(crv*8192) * 0x0001000100010001ULL;
-    c->ubCoeff=   roundToInt16(cbu*8192) * 0x0001000100010001ULL;
-    c->vgCoeff=   roundToInt16(cgv*8192) * 0x0001000100010001ULL;
-    c->ugCoeff=   roundToInt16(cgu*8192) * 0x0001000100010001ULL;
-    c->yOffset=   roundToInt16(oy *   8) * 0x0001000100010001ULL;
-
-    c->yuv2rgb_y_coeff  = (int16_t)roundToInt16(cy <<13);
-    c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);
-    c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13);
-    c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13);
-    c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13);
-    c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13);
-
-    ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
-    //FIXME factorize
-
-#if HAVE_ALTIVEC
-    if (c->flags & SWS_CPU_CAPS_ALTIVEC)
-        ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation);
-#endif
-    return 0;
-}
-
-int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
-{
-    if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
-
-    *inv_table = c->srcColorspaceTable;
-    *table     = c->dstColorspaceTable;
-    *srcRange  = c->srcRange;
-    *dstRange  = c->dstRange;
-    *brightness= c->brightness;
-    *contrast  = c->contrast;
-    *saturation= c->saturation;
-
-    return 0;
-}
-
-static int handle_jpeg(enum PixelFormat *format)
-{
-    switch (*format) {
-    case PIX_FMT_YUVJ420P:
-        *format = PIX_FMT_YUV420P;
-        return 1;
-    case PIX_FMT_YUVJ422P:
-        *format = PIX_FMT_YUV422P;
-        return 1;
-    case PIX_FMT_YUVJ444P:
-        *format = PIX_FMT_YUV444P;
-        return 1;
-    case PIX_FMT_YUVJ440P:
-        *format = PIX_FMT_YUV440P;
-        return 1;
-    default:
-        return 0;
-    }
-}
-
-SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
-                           int dstW, int dstH, enum PixelFormat dstFormat, int flags,
-                           SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
-{
-    SwsContext *c;
-    int i;
-    int usesVFilter, usesHFilter;
-    int unscaled;
-    int srcRange, dstRange;
-    SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
-#if ARCH_X86
-    if (flags & SWS_CPU_CAPS_MMX)
-        __asm__ volatile("emms\n\t"::: "memory");
-#endif
-
-#if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off
-    flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
-    flags |= ff_hardcodedcpuflags();
-#endif /* CONFIG_RUNTIME_CPUDETECT */
-    if (!rgb15to16) sws_rgb2rgb_init(flags);
-
-    unscaled = (srcW == dstW && srcH == dstH);
-
-    srcRange = handle_jpeg(&srcFormat);
-    dstRange = handle_jpeg(&dstFormat);
-
-    if (!isSupportedIn(srcFormat)) {
-        av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as input pixel format\n", sws_format_name(srcFormat));
-        return NULL;
-    }
-    if (!isSupportedOut(dstFormat)) {
-        av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as output pixel format\n", sws_format_name(dstFormat));
-        return NULL;
-    }
-
-    i= flags & ( SWS_POINT
-                |SWS_AREA
-                |SWS_BILINEAR
-                |SWS_FAST_BILINEAR
-                |SWS_BICUBIC
-                |SWS_X
-                |SWS_GAUSS
-                |SWS_LANCZOS
-                |SWS_SINC
-                |SWS_SPLINE
-                |SWS_BICUBLIN);
-    if(!i || (i & (i-1))) {
-        av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be chosen\n");
-        return NULL;
-    }
-
-    /* sanity check */
-    if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
-        av_log(NULL, AV_LOG_ERROR, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n",
-               srcW, srcH, dstW, dstH);
-        return NULL;
-    }
-    if(srcW > VOFW || dstW > VOFW) {
-        av_log(NULL, AV_LOG_ERROR, "swScaler: Compile-time maximum width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n");
-        return NULL;
-    }
-
-    if (!dstFilter) dstFilter= &dummyFilter;
-    if (!srcFilter) srcFilter= &dummyFilter;
-
-    FF_ALLOCZ_OR_GOTO(NULL, c, sizeof(SwsContext), fail);
-
-    c->av_class = &sws_context_class;
-    c->srcW= srcW;
-    c->srcH= srcH;
-    c->dstW= dstW;
-    c->dstH= dstH;
-    c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW;
-    c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH;
-    c->flags= flags;
-    c->dstFormat= dstFormat;
-    c->srcFormat= srcFormat;
-    c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]);
-    c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]);
-    c->vRounder= 4* 0x0001000100010001ULL;
-
-    usesVFilter = (srcFilter->lumV && srcFilter->lumV->length>1) ||
-                  (srcFilter->chrV && srcFilter->chrV->length>1) ||
-                  (dstFilter->lumV && dstFilter->lumV->length>1) ||
-                  (dstFilter->chrV && dstFilter->chrV->length>1);
-    usesHFilter = (srcFilter->lumH && srcFilter->lumH->length>1) ||
-                  (srcFilter->chrH && srcFilter->chrH->length>1) ||
-                  (dstFilter->lumH && dstFilter->lumH->length>1) ||
-                  (dstFilter->chrH && dstFilter->chrH->length>1);
-
-    getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
-    getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
-
-    // reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
-    if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
-
-    // drop some chroma lines if the user wants it
-    c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
-    c->chrSrcVSubSample+= c->vChrDrop;
-
-    // drop every other pixel for chroma calculation unless user wants full chroma
-    if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP)
-      && srcFormat!=PIX_FMT_RGB8      && srcFormat!=PIX_FMT_BGR8
-      && srcFormat!=PIX_FMT_RGB4      && srcFormat!=PIX_FMT_BGR4
-      && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
-      && ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&(SWS_FAST_BILINEAR|SWS_POINT))))
-        c->chrSrcHSubSample=1;
-
-    if (param) {
-        c->param[0] = param[0];
-        c->param[1] = param[1];
-    } else {
-        c->param[0] =
-        c->param[1] = SWS_PARAM_DEFAULT;
-    }
-
-    // Note the -((-x)>>y) is so that we always round toward +inf.
-    c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
-    c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
-    c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
-    c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
-
-    sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16);
-
-    /* unscaled special cases */
-    if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isAnyRGB(dstFormat))) {
-        ff_get_unscaled_swscale(c);
-
-        if (c->swScale) {
-            if (flags&SWS_PRINT_INFO)
-                av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n",
-                       sws_format_name(srcFormat), sws_format_name(dstFormat));
-            return c;
-        }
-    }
-
-    if (flags & SWS_CPU_CAPS_MMX2) {
-        c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
-        if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
-            if (flags&SWS_PRINT_INFO)
-                av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
-        }
-        if (usesHFilter) c->canMMX2BeUsed=0;
-    }
-    else
-        c->canMMX2BeUsed=0;
-
-    c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;
-    c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH;
-
-    // match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src to pixel n-2 of dst
-    // but only for the FAST_BILINEAR mode otherwise do correct scaling
-    // n-2 is the last chrominance sample available
-    // this is not perfect, but no one should notice the difference, the more correct variant
-    // would be like the vertical one, but that would require some special code for the
-    // first and last pixel
-    if (flags&SWS_FAST_BILINEAR) {
-        if (c->canMMX2BeUsed) {
-            c->lumXInc+= 20;
-            c->chrXInc+= 20;
-        }
-        //we don't use the x86 asm scaler if MMX is available
-        else if (flags & SWS_CPU_CAPS_MMX) {
-            c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
-            c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
-        }
-    }
-
-    /* precalculate horizontal scaler filter coefficients */
-    {
-#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT)
-// can't downscale !!!
-        if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
-            c->lumMmx2FilterCodeSize = initMMX2HScaler(      dstW, c->lumXInc, NULL, NULL, NULL, 8);
-            c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4);
-
-#ifdef MAP_ANONYMOUS
-            c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-            c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-#elif HAVE_VIRTUALALLOC
-            c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
-            c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
-#else
-            c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize);
-            c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
-#endif
-
-            if (!c->lumMmx2FilterCode || !c->chrMmx2FilterCode)
-                goto fail;
-            FF_ALLOCZ_OR_GOTO(c, c->hLumFilter   , (dstW        /8+8)*sizeof(int16_t), fail);
-            FF_ALLOCZ_OR_GOTO(c, c->hChrFilter   , (c->chrDstW  /4+8)*sizeof(int16_t), fail);
-            FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW      /2/8+8)*sizeof(int32_t), fail);
-            FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail);
-
-            initMMX2HScaler(      dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, c->hLumFilterPos, 8);
-            initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, c->hChrFilterPos, 4);
-
-#ifdef MAP_ANONYMOUS
-            mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
-            mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
-#endif
-        } else
-#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) */
-        {
-            const int filterAlign=
-                (flags & SWS_CPU_CAPS_MMX) ? 4 :
-                (flags & SWS_CPU_CAPS_ALTIVEC) ? 8 :
-                1;
-
-            if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
-                           srcW      ,       dstW, filterAlign, 1<<14,
-                           (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC)  : flags,
-                           srcFilter->lumH, dstFilter->lumH, c->param) < 0)
-                goto fail;
-            if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
-                           c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
-                           (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
-                           srcFilter->chrH, dstFilter->chrH, c->param) < 0)
-                goto fail;
-        }
-    } // initialize horizontal stuff
-
-    /* precalculate vertical scaler filter coefficients */
-    {
-        const int filterAlign=
-            (flags & SWS_CPU_CAPS_MMX) && (flags & SWS_ACCURATE_RND) ? 2 :
-            (flags & SWS_CPU_CAPS_ALTIVEC) ? 8 :
-            1;
-
-        if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
-                       srcH      ,        dstH, filterAlign, (1<<12),
-                       (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC)  : flags,
-                       srcFilter->lumV, dstFilter->lumV, c->param) < 0)
-            goto fail;
-        if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
-                       c->chrSrcH, c->chrDstH, filterAlign, (1<<12),
-                       (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
-                       srcFilter->chrV, dstFilter->chrV, c->param) < 0)
-            goto fail;
-
-#if HAVE_ALTIVEC
-        FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail);
-        FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail);
-
-        for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
-            int j;
-            short *p = (short *)&c->vYCoeffsBank[i];
-            for (j=0;j<8;j++)
-                p[j] = c->vLumFilter[i];
-        }
-
-        for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) {
-            int j;
-            short *p = (short *)&c->vCCoeffsBank[i];
-            for (j=0;j<8;j++)
-                p[j] = c->vChrFilter[i];
-        }
-#endif
-    }
-
-    // calculate buffer sizes so that they won't run out while handling these damn slices
-    c->vLumBufSize= c->vLumFilterSize;
-    c->vChrBufSize= c->vChrFilterSize;
-    for (i=0; i<dstH; i++) {
-        int chrI= i*c->chrDstH / dstH;
-        int nextSlice= FFMAX(c->vLumFilterPos[i   ] + c->vLumFilterSize - 1,
-                           ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample));
-
-        nextSlice>>= c->chrSrcVSubSample;
-        nextSlice<<= c->chrSrcVSubSample;
-        if (c->vLumFilterPos[i   ] + c->vLumBufSize < nextSlice)
-            c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
-        if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample))
-            c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI];
-    }
-
-    // allocate pixbufs (we use dynamic allocation because otherwise we would need to
-    // allocate several megabytes to handle all possible cases)
-    FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
-    FF_ALLOC_OR_GOTO(c, c->chrPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
-    if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
-        FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
-    //Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000)
-    /* align at 16 bytes for AltiVec */
-    for (i=0; i<c->vLumBufSize; i++) {
-        FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], VOF+1, fail);
-        c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
-    }
-    for (i=0; i<c->vChrBufSize; i++) {
-        FF_ALLOC_OR_GOTO(c, c->chrPixBuf[i+c->vChrBufSize], (VOF+1)*2, fail);
-        c->chrPixBuf[i] = c->chrPixBuf[i+c->vChrBufSize];
-    }
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-        for (i=0; i<c->vLumBufSize; i++) {
-            FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], VOF+1, fail);
-            c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
-        }
-
-    //try to avoid drawing green stuff between the right end and the stride end
-    for (i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, (VOF+1)*2);
-
-    assert(2*VOFW == VOF);
-
-    assert(c->chrDstH <= dstH);
-
-    if (flags&SWS_PRINT_INFO) {
-        if (flags&SWS_FAST_BILINEAR)
-            av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
-        else if (flags&SWS_BILINEAR)
-            av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
-        else if (flags&SWS_BICUBIC)
-            av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
-        else if (flags&SWS_X)
-            av_log(c, AV_LOG_INFO, "Experimental scaler, ");
-        else if (flags&SWS_POINT)
-            av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
-        else if (flags&SWS_AREA)
-            av_log(c, AV_LOG_INFO, "Area Averaging scaler, ");
-        else if (flags&SWS_BICUBLIN)
-            av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
-        else if (flags&SWS_GAUSS)
-            av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
-        else if (flags&SWS_SINC)
-            av_log(c, AV_LOG_INFO, "Sinc scaler, ");
-        else if (flags&SWS_LANCZOS)
-            av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
-        else if (flags&SWS_SPLINE)
-            av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
-        else
-            av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
-
-        av_log(c, AV_LOG_INFO, "from %s to %s%s ",
-               sws_format_name(srcFormat),
-#ifdef DITHER1XBPP
-               dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ||
-               dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
-               dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE ? "dithered " : "",
-#else
-               "",
-#endif
-               sws_format_name(dstFormat));
-
-        if (flags & SWS_CPU_CAPS_MMX2)
-            av_log(c, AV_LOG_INFO, "using MMX2\n");
-        else if (flags & SWS_CPU_CAPS_3DNOW)
-            av_log(c, AV_LOG_INFO, "using 3DNOW\n");
-        else if (flags & SWS_CPU_CAPS_MMX)
-            av_log(c, AV_LOG_INFO, "using MMX\n");
-        else if (flags & SWS_CPU_CAPS_ALTIVEC)
-            av_log(c, AV_LOG_INFO, "using AltiVec\n");
-        else
-            av_log(c, AV_LOG_INFO, "using C\n");
-
-        if (flags & SWS_CPU_CAPS_MMX) {
-            if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
-                av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
-            else {
-                if (c->hLumFilterSize==4)
-                    av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n");
-                else if (c->hLumFilterSize==8)
-                    av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal luminance scaling\n");
-                else
-                    av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal luminance scaling\n");
-
-                if (c->hChrFilterSize==4)
-                    av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal chrominance scaling\n");
-                else if (c->hChrFilterSize==8)
-                    av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal chrominance scaling\n");
-                else
-                    av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n");
-            }
-        } else {
-#if ARCH_X86
-            av_log(c, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n");
-#else
-            if (flags & SWS_FAST_BILINEAR)
-                av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
-            else
-                av_log(c, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n");
-#endif
-        }
-        if (isPlanarYUV(dstFormat)) {
-            if (c->vLumFilterSize==1)
-                av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-            else
-                av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-        } else {
-            if (c->vLumFilterSize==1 && c->vChrFilterSize==2)
-                av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
-                       "      2-tap scaler for vertical chrominance scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-            else if (c->vLumFilterSize==2 && c->vChrFilterSize==2)
-                av_log(c, AV_LOG_VERBOSE, "using 2-tap linear %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-            else
-                av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-        }
-
-        if (dstFormat==PIX_FMT_BGR24)
-            av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 converter\n",
-                   (flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
-        else if (dstFormat==PIX_FMT_RGB32)
-            av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-        else if (dstFormat==PIX_FMT_BGR565)
-            av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-        else if (dstFormat==PIX_FMT_BGR555)
-            av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-        else if (dstFormat == PIX_FMT_RGB444BE || dstFormat == PIX_FMT_RGB444LE ||
-                 dstFormat == PIX_FMT_BGR444BE || dstFormat == PIX_FMT_BGR444LE)
-            av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR12 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-
-        av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
-        av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
-               c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
-        av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
-               c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
-    }
-
-    c->swScale= ff_getSwsFunc(c);
-    return c;
-
-fail:
-    sws_freeContext(c);
-    return NULL;
-}
-
-SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
-                                float lumaSharpen, float chromaSharpen,
-                                float chromaHShift, float chromaVShift,
-                                int verbose)
-{
-    SwsFilter *filter= av_malloc(sizeof(SwsFilter));
-    if (!filter)
-        return NULL;
-
-    if (lumaGBlur!=0.0) {
-        filter->lumH= sws_getGaussianVec(lumaGBlur, 3.0);
-        filter->lumV= sws_getGaussianVec(lumaGBlur, 3.0);
-    } else {
-        filter->lumH= sws_getIdentityVec();
-        filter->lumV= sws_getIdentityVec();
-    }
-
-    if (chromaGBlur!=0.0) {
-        filter->chrH= sws_getGaussianVec(chromaGBlur, 3.0);
-        filter->chrV= sws_getGaussianVec(chromaGBlur, 3.0);
-    } else {
-        filter->chrH= sws_getIdentityVec();
-        filter->chrV= sws_getIdentityVec();
-    }
-
-    if (chromaSharpen!=0.0) {
-        SwsVector *id= sws_getIdentityVec();
-        sws_scaleVec(filter->chrH, -chromaSharpen);
-        sws_scaleVec(filter->chrV, -chromaSharpen);
-        sws_addVec(filter->chrH, id);
-        sws_addVec(filter->chrV, id);
-        sws_freeVec(id);
-    }
-
-    if (lumaSharpen!=0.0) {
-        SwsVector *id= sws_getIdentityVec();
-        sws_scaleVec(filter->lumH, -lumaSharpen);
-        sws_scaleVec(filter->lumV, -lumaSharpen);
-        sws_addVec(filter->lumH, id);
-        sws_addVec(filter->lumV, id);
-        sws_freeVec(id);
-    }
-
-    if (chromaHShift != 0.0)
-        sws_shiftVec(filter->chrH, (int)(chromaHShift+0.5));
-
-    if (chromaVShift != 0.0)
-        sws_shiftVec(filter->chrV, (int)(chromaVShift+0.5));
-
-    sws_normalizeVec(filter->chrH, 1.0);
-    sws_normalizeVec(filter->chrV, 1.0);
-    sws_normalizeVec(filter->lumH, 1.0);
-    sws_normalizeVec(filter->lumV, 1.0);
-
-    if (verbose) sws_printVec2(filter->chrH, NULL, AV_LOG_DEBUG);
-    if (verbose) sws_printVec2(filter->lumH, NULL, AV_LOG_DEBUG);
-
-    return filter;
-}
-
-SwsVector *sws_allocVec(int length)
-{
-    SwsVector *vec = av_malloc(sizeof(SwsVector));
-    if (!vec)
-        return NULL;
-    vec->length = length;
-    vec->coeff  = av_malloc(sizeof(double) * length);
-    if (!vec->coeff)
-        av_freep(&vec);
-    return vec;
-}
-
-SwsVector *sws_getGaussianVec(double variance, double quality)
-{
-    const int length= (int)(variance*quality + 0.5) | 1;
-    int i;
-    double middle= (length-1)*0.5;
-    SwsVector *vec= sws_allocVec(length);
-
-    if (!vec)
-        return NULL;
-
-    for (i=0; i<length; i++) {
-        double dist= i-middle;
-        vec->coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*M_PI);
-    }
-
-    sws_normalizeVec(vec, 1.0);
-
-    return vec;
-}
-
-SwsVector *sws_getConstVec(double c, int length)
-{
-    int i;
-    SwsVector *vec= sws_allocVec(length);
-
-    if (!vec)
-        return NULL;
-
-    for (i=0; i<length; i++)
-        vec->coeff[i]= c;
-
-    return vec;
-}
-
-SwsVector *sws_getIdentityVec(void)
-{
-    return sws_getConstVec(1.0, 1);
-}
-
-static double sws_dcVec(SwsVector *a)
-{
-    int i;
-    double sum=0;
-
-    for (i=0; i<a->length; i++)
-        sum+= a->coeff[i];
-
-    return sum;
-}
-
-void sws_scaleVec(SwsVector *a, double scalar)
-{
-    int i;
-
-    for (i=0; i<a->length; i++)
-        a->coeff[i]*= scalar;
-}
-
-void sws_normalizeVec(SwsVector *a, double height)
-{
-    sws_scaleVec(a, height/sws_dcVec(a));
-}
-
-static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b)
-{
-    int length= a->length + b->length - 1;
-    int i, j;
-    SwsVector *vec= sws_getConstVec(0.0, length);
-
-    if (!vec)
-        return NULL;
-
-    for (i=0; i<a->length; i++) {
-        for (j=0; j<b->length; j++) {
-            vec->coeff[i+j]+= a->coeff[i]*b->coeff[j];
-        }
-    }
-
-    return vec;
-}
-
-static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b)
-{
-    int length= FFMAX(a->length, b->length);
-    int i;
-    SwsVector *vec= sws_getConstVec(0.0, length);
-
-    if (!vec)
-        return NULL;
-
-    for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
-    for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]+= b->coeff[i];
-
-    return vec;
-}
-
-static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b)
-{
-    int length= FFMAX(a->length, b->length);
-    int i;
-    SwsVector *vec= sws_getConstVec(0.0, length);
-
-    if (!vec)
-        return NULL;
-
-    for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
-    for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]-= b->coeff[i];
-
-    return vec;
-}
-
-/* shift left / or right if "shift" is negative */
-static SwsVector *sws_getShiftedVec(SwsVector *a, int shift)
-{
-    int length= a->length + FFABS(shift)*2;
-    int i;
-    SwsVector *vec= sws_getConstVec(0.0, length);
-
-    if (!vec)
-        return NULL;
-
-    for (i=0; i<a->length; i++) {
-        vec->coeff[i + (length-1)/2 - (a->length-1)/2 - shift]= a->coeff[i];
-    }
-
-    return vec;
-}
-
-void sws_shiftVec(SwsVector *a, int shift)
-{
-    SwsVector *shifted= sws_getShiftedVec(a, shift);
-    av_free(a->coeff);
-    a->coeff= shifted->coeff;
-    a->length= shifted->length;
-    av_free(shifted);
-}
-
-void sws_addVec(SwsVector *a, SwsVector *b)
-{
-    SwsVector *sum= sws_sumVec(a, b);
-    av_free(a->coeff);
-    a->coeff= sum->coeff;
-    a->length= sum->length;
-    av_free(sum);
-}
-
-void sws_subVec(SwsVector *a, SwsVector *b)
-{
-    SwsVector *diff= sws_diffVec(a, b);
-    av_free(a->coeff);
-    a->coeff= diff->coeff;
-    a->length= diff->length;
-    av_free(diff);
-}
-
-void sws_convVec(SwsVector *a, SwsVector *b)
-{
-    SwsVector *conv= sws_getConvVec(a, b);
-    av_free(a->coeff);
-    a->coeff= conv->coeff;
-    a->length= conv->length;
-    av_free(conv);
-}
-
-SwsVector *sws_cloneVec(SwsVector *a)
-{
-    int i;
-    SwsVector *vec= sws_allocVec(a->length);
-
-    if (!vec)
-        return NULL;
-
-    for (i=0; i<a->length; i++) vec->coeff[i]= a->coeff[i];
-
-    return vec;
-}
-
-void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level)
-{
-    int i;
-    double max=0;
-    double min=0;
-    double range;
-
-    for (i=0; i<a->length; i++)
-        if (a->coeff[i]>max) max= a->coeff[i];
-
-    for (i=0; i<a->length; i++)
-        if (a->coeff[i]<min) min= a->coeff[i];
-
-    range= max - min;
-
-    for (i=0; i<a->length; i++) {
-        int x= (int)((a->coeff[i]-min)*60.0/range +0.5);
-        av_log(log_ctx, log_level, "%1.3f ", a->coeff[i]);
-        for (;x>0; x--) av_log(log_ctx, log_level, " ");
-        av_log(log_ctx, log_level, "|\n");
-    }
-}
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-void sws_printVec(SwsVector *a)
-{
-    sws_printVec2(a, NULL, AV_LOG_DEBUG);
-}
-#endif
-
-void sws_freeVec(SwsVector *a)
-{
-    if (!a) return;
-    av_freep(&a->coeff);
-    a->length=0;
-    av_free(a);
-}
-
-void sws_freeFilter(SwsFilter *filter)
-{
-    if (!filter) return;
-
-    if (filter->lumH) sws_freeVec(filter->lumH);
-    if (filter->lumV) sws_freeVec(filter->lumV);
-    if (filter->chrH) sws_freeVec(filter->chrH);
-    if (filter->chrV) sws_freeVec(filter->chrV);
-    av_free(filter);
-}
-
-void sws_freeContext(SwsContext *c)
-{
-    int i;
-    if (!c) return;
-
-    if (c->lumPixBuf) {
-        for (i=0; i<c->vLumBufSize; i++)
-            av_freep(&c->lumPixBuf[i]);
-        av_freep(&c->lumPixBuf);
-    }
-
-    if (c->chrPixBuf) {
-        for (i=0; i<c->vChrBufSize; i++)
-            av_freep(&c->chrPixBuf[i]);
-        av_freep(&c->chrPixBuf);
-    }
-
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-        for (i=0; i<c->vLumBufSize; i++)
-            av_freep(&c->alpPixBuf[i]);
-        av_freep(&c->alpPixBuf);
-    }
-
-    av_freep(&c->vLumFilter);
-    av_freep(&c->vChrFilter);
-    av_freep(&c->hLumFilter);
-    av_freep(&c->hChrFilter);
-#if HAVE_ALTIVEC
-    av_freep(&c->vYCoeffsBank);
-    av_freep(&c->vCCoeffsBank);
-#endif
-
-    av_freep(&c->vLumFilterPos);
-    av_freep(&c->vChrFilterPos);
-    av_freep(&c->hLumFilterPos);
-    av_freep(&c->hChrFilterPos);
-
-#if ARCH_X86
-#ifdef MAP_ANONYMOUS
-    if (c->lumMmx2FilterCode) munmap(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize);
-    if (c->chrMmx2FilterCode) munmap(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize);
-#elif HAVE_VIRTUALALLOC
-    if (c->lumMmx2FilterCode) VirtualFree(c->lumMmx2FilterCode, 0, MEM_RELEASE);
-    if (c->chrMmx2FilterCode) VirtualFree(c->chrMmx2FilterCode, 0, MEM_RELEASE);
-#else
-    av_free(c->lumMmx2FilterCode);
-    av_free(c->chrMmx2FilterCode);
-#endif
-    c->lumMmx2FilterCode=NULL;
-    c->chrMmx2FilterCode=NULL;
-#endif /* ARCH_X86 */
-
-    av_freep(&c->yuvTable);
-
-    av_free(c);
-}
-
-struct SwsContext *sws_getCachedContext(struct SwsContext *context,
-                                        int srcW, int srcH, enum PixelFormat srcFormat,
-                                        int dstW, int dstH, enum PixelFormat dstFormat, int flags,
-                                        SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
-{
-    static const double default_param[2] = {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT};
-
-    if (!param)
-        param = default_param;
-
-    if (context &&
-        (context->srcW      != srcW      ||
-         context->srcH      != srcH      ||
-         context->srcFormat != srcFormat ||
-         context->dstW      != dstW      ||
-         context->dstH      != dstH      ||
-         context->dstFormat != dstFormat ||
-         context->flags     != flags     ||
-         context->param[0]  != param[0]  ||
-         context->param[1]  != param[1])) {
-        sws_freeContext(context);
-        context = NULL;
-    }
-
-    if (!context) {
-        return sws_getContext(srcW, srcH, srcFormat,
-                              dstW, dstH, dstFormat, flags,
-                              srcFilter, dstFilter, param);
-    }
-    return context;
-}
-
diff --git a/libswscale/x86/yuv2rgb_mmx.c b/libswscale/x86/yuv2rgb_mmx.c
deleted file mode 100644
index d042421..0000000
--- a/libswscale/x86/yuv2rgb_mmx.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * software YUV to RGB converter
- *
- * Copyright (C) 2009 Konstantin Shishkov
- *
- * MMX/MMX2 template stuff (needed for fast movntq support),
- * 1,4,8bpp support and context / deglobalize stuff
- * by Michael Niedermayer (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "config.h"
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-#include "libavutil/x86_cpu.h"
-
-#define DITHER1XBPP // only for MMX
-
-/* hope these constant values are cache line aligned */
-DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw)   = 0x00ff00ff00ff00ffULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
-
-//MMX versions
-#undef RENAME
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 0
-#define RENAME(a) a ## _MMX
-#if CONFIG_GPL
-#include "yuv2rgb_template.c"
-#else
-#include "yuv2rgb_template2.c"
-#endif
-
-//MMX2 versions
-#undef RENAME
-#undef HAVE_MMX2
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#if CONFIG_GPL
-#include "yuv2rgb_template.c"
-#else
-#include "yuv2rgb_template2.c"
-#endif
-
-SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
-{
-    if (c->flags & SWS_CPU_CAPS_MMX2) {
-        switch (c->dstFormat) {
-        case PIX_FMT_RGB32:
-            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
-                if (HAVE_7REGS) return yuva420_rgb32_MMX2;
-                break;
-            } else return yuv420_rgb32_MMX2;
-        case PIX_FMT_BGR32:
-            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
-                if (HAVE_7REGS) return yuva420_bgr32_MMX2;
-                break;
-            } else return yuv420_bgr32_MMX2;
-        case PIX_FMT_RGB24:  return yuv420_rgb24_MMX2;
-        case PIX_FMT_BGR24:  return yuv420_bgr24_MMX2;
-        case PIX_FMT_RGB565: return yuv420_rgb16_MMX2;
-        case PIX_FMT_RGB555: return yuv420_rgb15_MMX2;
-        }
-    }
-    if (c->flags & SWS_CPU_CAPS_MMX) {
-        switch (c->dstFormat) {
-        case PIX_FMT_RGB32:
-            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
-                if (HAVE_7REGS) return yuva420_rgb32_MMX;
-                break;
-            } else return yuv420_rgb32_MMX;
-        case PIX_FMT_BGR32:
-            if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
-                if (HAVE_7REGS) return yuva420_bgr32_MMX;
-                break;
-            } else return yuv420_bgr32_MMX;
-        case PIX_FMT_RGB24:  return yuv420_rgb24_MMX;
-        case PIX_FMT_BGR24:  return yuv420_bgr24_MMX;
-        case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
-        case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
-        }
-    }
-
-    return NULL;
-}
diff --git a/libswscale/x86/yuv2rgb_template.c b/libswscale/x86/yuv2rgb_template.c
deleted file mode 100644
index ba90689..0000000
--- a/libswscale/x86/yuv2rgb_template.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- * yuv2rgb_mmx.c, software YUV to RGB converter with Intel MMX "technology"
- *
- * Copyright (C) 2000, Silicon Integrated System Corp
- *
- * Author: Olie Lho <ollie at sis.com.tw>
- *
- * 15,24 bpp and dithering from Michael Niedermayer (michaelni at gmx.at)
- * MMX/MMX2 Template stuff from Michael Niedermayer (needed for fast movntq support)
- * context / deglobalize stuff by Michael Niedermayer
- *
- * This file is part of mpeg2dec, a free MPEG-2 video decoder
- *
- * mpeg2dec 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, or (at your option)
- * any later version.
- *
- * mpeg2dec 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 mpeg2dec; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef MOVNTQ
-#undef EMMS
-#undef SFENCE
-
-#if HAVE_AMD3DNOW
-/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
-#define EMMS     "femms"
-#else
-#define EMMS     "emms"
-#endif
-
-#if HAVE_MMX2
-#define MOVNTQ "movntq"
-#define SFENCE "sfence"
-#else
-#define MOVNTQ "movq"
-#define SFENCE " # nop"
-#endif
-
-#define YUV2RGB \
-    /* Do the multiply part of the conversion for even and odd pixels,
-       register usage:
-       mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
-       mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
-       mm6 -> Y even, mm7 -> Y odd */\
-    /* convert the chroma part */\
-    "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
-    "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
-\
-    "psllw $3, %%mm0;" /* Promote precision */ \
-    "psllw $3, %%mm1;" /* Promote precision */ \
-\
-    "psubsw "U_OFFSET"(%4), %%mm0;" /* Cb -= 128 */ \
-    "psubsw "V_OFFSET"(%4), %%mm1;" /* Cr -= 128 */ \
-\
-    "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
-    "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
-\
-    "pmulhw "UG_COEFF"(%4), %%mm2;" /* Mul Cb with green coeff -> Cb green */ \
-    "pmulhw "VG_COEFF"(%4), %%mm3;" /* Mul Cr with green coeff -> Cr green */ \
-\
-    "pmulhw "UB_COEFF"(%4), %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */\
-    "pmulhw "VR_COEFF"(%4), %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */\
-\
-    "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */\
-\
-    /* convert the luma part */\
-    "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
-    "pand "MANGLE(mmx_00ffw)", %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */\
-\
-    "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */\
-\
-    "psllw $3, %%mm6;" /* Promote precision */\
-    "psllw $3, %%mm7;" /* Promote precision */\
-\
-    "psubw "Y_OFFSET"(%4), %%mm6;" /* Y -= 16 */\
-    "psubw "Y_OFFSET"(%4), %%mm7;" /* Y -= 16 */\
-\
-    "pmulhw "Y_COEFF"(%4), %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */\
-    "pmulhw "Y_COEFF"(%4), %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */\
-\
-    /* Do the addition part of the conversion for even and odd pixels,
-       register usage:
-       mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
-       mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
-       mm6 -> Y even, mm7 -> Y odd */\
-    "movq %%mm0, %%mm3;" /* Copy Cblue */\
-    "movq %%mm1, %%mm4;" /* Copy Cred */\
-    "movq %%mm2, %%mm5;" /* Copy Cgreen */\
-\
-    "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */\
-    "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */\
-\
-    "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */\
-    "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */\
-\
-    "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */\
-    "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */\
-\
-    /* Limit RGB even to 0..255 */\
-    "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0  B6 B4 B2 B0 */\
-    "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0  R6 R4 R2 R0 */\
-    "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0  G6 G4 G2 G0 */\
-\
-    /* Limit RGB odd to 0..255 */\
-    "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1  B7 B5 B3 B1 */\
-    "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1  R7 R5 R3 R1 */\
-    "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1  G7 G5 G3 G1 */\
-\
-    /* Interleave RGB even and odd */\
-    "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */\
-    "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */\
-    "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\
-
-
-#define YUV422_UNSHIFT                   \
-    if(c->srcFormat == PIX_FMT_YUV422P) {\
-        srcStride[1] *= 2;               \
-        srcStride[2] *= 2;               \
-    }                                    \
-
-#define YUV2RGB_LOOP(depth)                                   \
-    h_size= (c->dstW+7)&~7;                                   \
-    if(h_size*depth > FFABS(dstStride[0])) h_size-=8;         \
-\
-    __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ );    \
-    for (y= 0; y<srcSliceH; y++ ) {                           \
-        uint8_t *image = dst[0] + (y+srcSliceY)*dstStride[0]; \
-        const uint8_t *py = src[0] + y*srcStride[0];          \
-        const uint8_t *pu = src[1] + (y>>1)*srcStride[1];     \
-        const uint8_t *pv = src[2] + (y>>1)*srcStride[2];     \
-        x86_reg index= -h_size/2;                                \
-
-#define YUV2RGB_INIT                                                       \
-        /* This MMX assembly code deals with a SINGLE scan line at a time, \
-         * it converts 8 pixels in each iteration. */                      \
-        __asm__ volatile (                                                 \
-        /* load data for start of next scan line */                        \
-        "movd    (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ \
-        "movd    (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ \
-        "movq (%5, %0, 2), %%mm6;" /* Load 8  Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \
-        /*                                                                 \
-        ".balign 16     \n\t"                                              \
-        */                                                                 \
-        "1:             \n\t"                                              \
-        /* No speed difference on my p3 at 500 with prefetch,                 \
-         * if it is faster for anyone with -benchmark then tell me.        \
-        PREFETCH" 64(%0) \n\t"                                             \
-        PREFETCH" 64(%1) \n\t"                                             \
-        PREFETCH" 64(%2) \n\t"                                             \
-        */                                                                 \
-
-#define YUV2RGB_ENDLOOP(depth) \
-        "add $"AV_STRINGIFY(depth*8)", %1    \n\t" \
-        "add                       $4, %0    \n\t" \
-        " js                       1b        \n\t" \
-
-#define YUV2RGB_OPERANDS \
-        : "+r" (index), "+r" (image) \
-        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index) \
-        ); \
-    } \
-    __asm__ volatile (SFENCE"\n\t"EMMS); \
-    return srcSliceH; \
-
-#define YUV2RGB_OPERANDS_ALPHA \
-        : "+r" (index), "+r" (image) \
-        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), "r" (pa - 2*index) \
-        ); \
-    } \
-    __asm__ volatile (SFENCE"\n\t"EMMS); \
-    return srcSliceH; \
-
-static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                       int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV422_UNSHIFT
-    YUV2RGB_LOOP(2)
-
-        c->blueDither= ff_dither8[y&1];
-        c->greenDither= ff_dither4[y&1];
-        c->redDither= ff_dither8[(y+1)&1];
-
-        YUV2RGB_INIT
-        YUV2RGB
-
-#ifdef DITHER1XBPP
-        "paddusb "BLUE_DITHER"(%4), %%mm0;"
-        "paddusb "GREEN_DITHER"(%4), %%mm2;"
-        "paddusb "RED_DITHER"(%4), %%mm1;"
-#endif
-        /* mask unneeded bits off */
-        "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
-        "pand "MANGLE(mmx_grnmask)", %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
-        "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
-
-        "psrlw   $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
-        "pxor %%mm4, %%mm4;" /* zero mm4 */
-
-        "movq %%mm0, %%mm5;" /* Copy B7-B0 */
-        "movq %%mm2, %%mm7;" /* Copy G7-G0 */
-
-        /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
-        "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
-        "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
-        "psllw  $3, %%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
-        "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
-
-        "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
-        MOVNTQ "      %%mm0, (%1);" /* store pixel 0-3 */
-
-        /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
-        "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
-        "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
-        "psllw        $3, %%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
-        "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
-        "por       %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
-        "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
-
-        MOVNTQ "   %%mm5, 8 (%1);" /* store pixel 4-7 */
-
-    YUV2RGB_ENDLOOP(2)
-    YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuv420_rgb15)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                       int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV422_UNSHIFT
-    YUV2RGB_LOOP(2)
-
-        c->blueDither= ff_dither8[y&1];
-        c->greenDither= ff_dither8[y&1];
-        c->redDither= ff_dither8[(y+1)&1];
-
-        YUV2RGB_INIT
-        YUV2RGB
-
-#ifdef DITHER1XBPP
-        "paddusb "BLUE_DITHER"(%4), %%mm0  \n\t"
-        "paddusb "GREEN_DITHER"(%4), %%mm2  \n\t"
-        "paddusb "RED_DITHER"(%4), %%mm1  \n\t"
-#endif
-
-        /* mask unneeded bits off */
-        "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
-        "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
-        "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
-
-        "psrlw   $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
-        "psrlw   $1, %%mm1;" /* 0_r7r6r5  r4r3_0_0 0_r7r6r5 r4r3_0_0 */
-        "pxor %%mm4, %%mm4;" /* zero mm4 */
-
-        "movq %%mm0, %%mm5;" /* Copy B7-B0 */
-        "movq %%mm2, %%mm7;" /* Copy G7-G0 */
-
-        /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
-        "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */
-        "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
-        "psllw  $2, %%mm2;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
-        "por %%mm2, %%mm0;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
-
-        "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
-        MOVNTQ "      %%mm0, (%1);"  /* store pixel 0-3 */
-
-        /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
-        "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */
-        "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
-        "psllw        $2, %%mm7;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
-        "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
-        "por       %%mm7, %%mm5;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
-        "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
-
-        MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
-
-    YUV2RGB_ENDLOOP(2)
-    YUV2RGB_OPERANDS
-}
-
-#undef RGB_PLANAR2PACKED24
-#if HAVE_MMX2
-#define RGB_PLANAR2PACKED24(red, blue)\
-        "movq "MANGLE(ff_M24A)", %%mm4     \n\t"\
-        "movq "MANGLE(ff_M24C)", %%mm7     \n\t"\
-        "pshufw $0x50, %%mm"blue", %%mm5   \n\t" /* B3 B2 B3 B2  B1 B0 B1 B0 */\
-        "pshufw $0x50, %%mm2, %%mm3     \n\t" /* G3 G2 G3 G2  G1 G0 G1 G0 */\
-        "pshufw $0x00, %%mm"red", %%mm6 \n\t" /* R1 R0 R1 R0  R1 R0 R1 R0 */\
-\
-        "pand   %%mm4, %%mm5            \n\t" /*    B2        B1       B0 */\
-        "pand   %%mm4, %%mm3            \n\t" /*    G2        G1       G0 */\
-        "pand   %%mm7, %%mm6            \n\t" /*       R1        R0       */\
-\
-        "psllq     $8, %%mm3            \n\t" /* G2        G1       G0    */\
-        "por    %%mm5, %%mm6            \n\t"\
-        "por    %%mm3, %%mm6            \n\t"\
-        MOVNTQ" %%mm6, (%1)             \n\t"\
-\
-        "psrlq     $8, %%mm2            \n\t" /* 00 G7 G6 G5  G4 G3 G2 G1 */\
-        "pshufw $0xA5, %%mm"blue", %%mm5\n\t" /* B5 B4 B5 B4  B3 B2 B3 B2 */\
-        "pshufw $0x55, %%mm2, %%mm3     \n\t" /* G4 G3 G4 G3  G4 G3 G4 G3 */\
-        "pshufw $0xA5, %%mm"red", %%mm6 \n\t" /* R5 R4 R5 R4  R3 R2 R3 R2 */\
-\
-        "pand "MANGLE(ff_M24B)", %%mm5  \n\t" /* B5       B4        B3    */\
-        "pand          %%mm7, %%mm3     \n\t" /*       G4        G3       */\
-        "pand          %%mm4, %%mm6     \n\t" /*    R4        R3       R2 */\
-\
-        "por    %%mm5, %%mm3            \n\t" /* B5    G4 B4     G3 B3    */\
-        "por    %%mm3, %%mm6            \n\t"\
-        MOVNTQ" %%mm6, 8(%1)            \n\t"\
-\
-        "pshufw $0xFF, %%mm"blue", %%mm5\n\t" /* B7 B6 B7 B6  B7 B6 B6 B7 */\
-        "pshufw $0xFA, %%mm2, %%mm3     \n\t" /* 00 G7 00 G7  G6 G5 G6 G5 */\
-        "pshufw $0xFA, %%mm"red", %%mm6 \n\t" /* R7 R6 R7 R6  R5 R4 R5 R4 */\
-        "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */\
-\
-        "pand          %%mm7, %%mm5     \n\t" /*       B7        B6       */\
-        "pand          %%mm4, %%mm3     \n\t" /*    G7        G6       G5 */\
-        "pand "MANGLE(ff_M24B)", %%mm6  \n\t" /* R7       R6        R5    */\
-        "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */\
-\
-        "por          %%mm5, %%mm3      \n\t"\
-        "por          %%mm3, %%mm6      \n\t"\
-        MOVNTQ"       %%mm6, 16(%1)     \n\t"\
-        "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
-        "pxor         %%mm4, %%mm4      \n\t"
-#else
-#define RGB_PLANAR2PACKED24(red, blue)\
-        "pxor      %%mm4, %%mm4     \n\t"\
-        "movq      %%mm"blue", %%mm5\n\t" /* B */\
-        "movq      %%mm"red", %%mm6 \n\t" /* R */\
-        "punpcklbw %%mm2, %%mm"blue"\n\t" /* GBGBGBGB 0 */\
-        "punpcklbw %%mm4, %%mm"red" \n\t" /* 0R0R0R0R 0 */\
-        "punpckhbw %%mm2, %%mm5     \n\t" /* GBGBGBGB 2 */\
-        "punpckhbw %%mm4, %%mm6     \n\t" /* 0R0R0R0R 2 */\
-        "movq      %%mm"blue", %%mm7\n\t" /* GBGBGBGB 0 */\
-        "movq      %%mm5, %%mm3     \n\t" /* GBGBGBGB 2 */\
-        "punpcklwd %%mm"red", %%mm7 \n\t" /* 0RGB0RGB 0 */\
-        "punpckhwd %%mm"red", %%mm"blue"\n\t" /* 0RGB0RGB 1 */\
-        "punpcklwd %%mm6, %%mm5     \n\t" /* 0RGB0RGB 2 */\
-        "punpckhwd %%mm6, %%mm3     \n\t" /* 0RGB0RGB 3 */\
-\
-        "movq      %%mm7, %%mm2     \n\t" /* 0RGB0RGB 0 */\
-        "movq      %%mm"blue", %%mm6\n\t" /* 0RGB0RGB 1 */\
-        "movq      %%mm5, %%mm"red" \n\t" /* 0RGB0RGB 2 */\
-        "movq      %%mm3, %%mm4     \n\t" /* 0RGB0RGB 3 */\
-\
-        "psllq       $40, %%mm7     \n\t" /* RGB00000 0 */\
-        "psllq       $40, %%mm"blue"\n\t" /* RGB00000 1 */\
-        "psllq       $40, %%mm5     \n\t" /* RGB00000 2 */\
-        "psllq       $40, %%mm3     \n\t" /* RGB00000 3 */\
-\
-        "punpckhdq %%mm2, %%mm7     \n\t" /* 0RGBRGB0 0 */\
-        "punpckhdq %%mm6, %%mm"blue"\n\t" /* 0RGBRGB0 1 */\
-        "punpckhdq %%mm"red", %%mm5 \n\t" /* 0RGBRGB0 2 */\
-        "punpckhdq %%mm4, %%mm3     \n\t" /* 0RGBRGB0 3 */\
-\
-        "psrlq        $8, %%mm7     \n\t" /* 00RGBRGB 0 */\
-        "movq      %%mm"blue", %%mm6\n\t" /* 0RGBRGB0 1 */\
-        "psllq       $40, %%mm"blue"\n\t" /* GB000000 1 */\
-        "por       %%mm"blue", %%mm7\n\t" /* GBRGBRGB 0 */\
-        MOVNTQ"    %%mm7, (%1)      \n\t"\
-\
-        "psrlq       $24, %%mm6     \n\t" /* 0000RGBR 1 */\
-        "movq      %%mm5, %%mm"red" \n\t" /* 0RGBRGB0 2 */\
-        "psllq       $24, %%mm5     \n\t" /* BRGB0000 2 */\
-        "por       %%mm5, %%mm6     \n\t" /* BRGBRGBR 1 */\
-        MOVNTQ"    %%mm6, 8(%1)     \n\t"\
-\
-        "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
-\
-        "psrlq       $40, %%mm"red" \n\t" /* 000000RG 2 */\
-        "psllq        $8, %%mm3     \n\t" /* RGBRGB00 3 */\
-        "por       %%mm3, %%mm"red" \n\t" /* RGBRGBRG 2 */\
-        MOVNTQ"    %%mm"red", 16(%1)\n\t"\
-\
-        "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */\
-        "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */\
-        "pxor      %%mm4, %%mm4     \n\t"
-#endif
-
-static inline int RENAME(yuv420_rgb24)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                       int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV422_UNSHIFT
-    YUV2RGB_LOOP(3)
-
-        YUV2RGB_INIT
-        YUV2RGB
-        /* mm0=B, %%mm2=G, %%mm1=R */
-        RGB_PLANAR2PACKED24("0", "1")
-
-    YUV2RGB_ENDLOOP(3)
-    YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuv420_bgr24)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                       int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV422_UNSHIFT
-    YUV2RGB_LOOP(3)
-
-        YUV2RGB_INIT
-        YUV2RGB
-        /* mm0=B, %%mm2=G, %%mm1=R */
-        RGB_PLANAR2PACKED24("1", "0")
-
-    YUV2RGB_ENDLOOP(3)
-    YUV2RGB_OPERANDS
-}
-
-/*
-
-RGB_PLANAR2PACKED32(red,green,blue,alpha)
-
-convert RGB plane to RGB packed format
-
-macro parameters specify the output color channel order:
-
-RGB_PLANAR2PACKED32(REG_RED,  REG_GREEN, REG_BLUE, REG_ALPHA) for RGBA output,
-RGB_PLANAR2PACKED32(REG_BLUE, REG_GREEN, REG_RED,  REG_ALPHA) for BGRA output,
-RGB_PLANAR2PACKED32(REG_ALPHA,REG_BLUE,  REG_GREEN,REG_RED)   for ABGR output,
-
-etc.
-*/
-
-#define REG_BLUE  "0"
-#define REG_RED   "1"
-#define REG_GREEN "2"
-#define REG_ALPHA "3"
-
-#define RGB_PLANAR2PACKED32(red,green,blue,alpha)                       \
-    /* convert RGB plane to RGB packed format,                          \
-       mm0 ->  B, mm1 -> R, mm2 -> G, mm3 -> A,                         \
-       mm4 -> GB, mm5 -> AR pixel 4-7,                                  \
-       mm6 -> GB, mm7 -> AR pixel 0-3 */                                \
-    "movq      %%mm" blue ", %%mm6;"   /* B7 B6 B5 B4 B3 B2 B1 B0 */    \
-    "movq      %%mm" red  ", %%mm7;"   /* R7 R6 R5 R4 R3 R2 R1 R0 */    \
-\
-    "movq      %%mm" blue ", %%mm4;"   /* B7 B6 B5 B4 B3 B2 B1 B0 */    \
-    "movq      %%mm" red  ", %%mm5;"   /* R7 R6 R5 R4 R3 R2 R1 R0 */    \
-\
-    "punpcklbw %%mm" green ", %%mm6;"  /* G3 B3 G2 B2 G1 B1 G0 B0 */    \
-    "punpcklbw %%mm" alpha ", %%mm7;"  /* A3 R3 A2 R2 A1 R1 A0 R0 */    \
-\
-    "punpcklwd %%mm7, %%mm6;"          /* A1 R1 B1 G1 A0 R0 B0 G0 */    \
-    MOVNTQ "   %%mm6, (%1);"           /* Store ARGB1 ARGB0 */          \
-\
-    "movq      %%mm" blue ", %%mm6;"   /* B7 B6 B5 B4 B3 B2 B1 B0 */    \
-    "punpcklbw %%mm" green ", %%mm6;"  /* G3 B3 G2 B2 G1 B1 G0 B0 */    \
-\
-    "punpckhwd %%mm7, %%mm6;"          /* A3 R3 G3 B3 A2 R2 B3 G2 */    \
-    MOVNTQ "   %%mm6, 8 (%1);"         /* Store ARGB3 ARGB2 */          \
-\
-    "punpckhbw %%mm" green ", %%mm4;"  /* G7 B7 G6 B6 G5 B5 G4 B4 */    \
-    "punpckhbw %%mm" alpha ", %%mm5;"  /* A7 R7 A6 R6 A5 R5 A4 R4 */    \
-\
-    "punpcklwd %%mm5, %%mm4;"          /* A5 R5 B5 G5 A4 R4 B4 G4 */    \
-    MOVNTQ "   %%mm4, 16 (%1);"        /* Store ARGB5 ARGB4 */          \
-\
-    "movq      %%mm" blue ", %%mm4;"   /* B7 B6 B5 B4 B3 B2 B1 B0 */    \
-    "punpckhbw %%mm" green ", %%mm4;"  /* G7 B7 G6 B6 G5 B5 G4 B4 */    \
-\
-    "punpckhwd %%mm5, %%mm4;"   /* A7 R7 G7 B7 A6 R6 B6 G6 */           \
-    MOVNTQ "   %%mm4, 24 (%1);" /* Store ARGB7 ARGB6 */                 \
-\
-    "movd 4 (%2, %0), %%mm0;"   /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ \
-    "movd 4 (%3, %0), %%mm1;"   /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ \
-\
-    "pxor         %%mm4, %%mm4;" /* zero mm4 */                         \
-    "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \
-
-static inline int RENAME(yuv420_rgb32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                       int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV422_UNSHIFT
-    YUV2RGB_LOOP(4)
-
-        YUV2RGB_INIT
-        YUV2RGB
-        "pcmpeqd   %%mm3, %%mm3;"   /* fill mm3 */
-        RGB_PLANAR2PACKED32(REG_RED,REG_GREEN,REG_BLUE,REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuva420_rgb32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                        int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-#if HAVE_7REGS
-    int y, h_size;
-
-    YUV2RGB_LOOP(4)
-
-        const uint8_t *pa = src[3] + y*srcStride[3];
-        YUV2RGB_INIT
-        YUV2RGB
-        "movq     (%6, %0, 2), %%mm3;"            /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
-        RGB_PLANAR2PACKED32(REG_RED,REG_GREEN,REG_BLUE,REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS_ALPHA
-#endif
-}
-
-static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                       int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV422_UNSHIFT
-    YUV2RGB_LOOP(4)
-
-        YUV2RGB_INIT
-        YUV2RGB
-        "pcmpeqd   %%mm3, %%mm3;"   /* fill mm3 */
-        RGB_PLANAR2PACKED32(REG_BLUE,REG_GREEN,REG_RED,REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
-                                        int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-#if HAVE_7REGS
-    int y, h_size;
-
-    YUV2RGB_LOOP(4)
-
-        const uint8_t *pa = src[3] + y*srcStride[3];
-        YUV2RGB_INIT
-        YUV2RGB
-        "movq     (%6, %0, 2), %%mm3;"            /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
-        RGB_PLANAR2PACKED32(REG_BLUE,REG_GREEN,REG_RED,REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS_ALPHA
-#endif
-}
diff --git a/libswscale/x86/yuv2rgb_template2.c b/libswscale/x86/yuv2rgb_template2.c
deleted file mode 100644
index f391cde..0000000
--- a/libswscale/x86/yuv2rgb_template2.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * software YUV to RGB converter
- *
- * Copyright (C) 2001-2007 Michael Niedermayer
- *           (c) 2010 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef MOVNTQ
-#undef EMMS
-#undef SFENCE
-
-#if HAVE_AMD3DNOW
-/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
-#define EMMS   "femms"
-#else
-#define EMMS   "emms"
-#endif
-
-#if HAVE_MMX2
-#define MOVNTQ "movntq"
-#define SFENCE "sfence"
-#else
-#define MOVNTQ "movq"
-#define SFENCE " # nop"
-#endif
-
-#define REG_BLUE  "0"
-#define REG_RED   "1"
-#define REG_GREEN "2"
-#define REG_ALPHA "3"
-
-#define YUV2RGB_LOOP(depth)                                          \
-    h_size = (c->dstW + 7) & ~7;                                     \
-    if (h_size * depth > FFABS(dstStride[0]))                        \
-        h_size -= 8;                                                 \
-                                                                     \
-    if (c->srcFormat == PIX_FMT_YUV422P) {                           \
-        srcStride[1] *= 2;                                           \
-        srcStride[2] *= 2;                                           \
-    }                                                                \
-                                                                     \
-    __asm__ volatile ("pxor %mm4, %mm4\n\t");                        \
-    for (y = 0; y < srcSliceH; y++) {                                \
-        uint8_t *image    = dst[0] + (y + srcSliceY) * dstStride[0]; \
-        const uint8_t *py = src[0] +               y * srcStride[0]; \
-        const uint8_t *pu = src[1] +        (y >> 1) * srcStride[1]; \
-        const uint8_t *pv = src[2] +        (y >> 1) * srcStride[2]; \
-        x86_reg index = -h_size / 2;                                 \
-
-#define YUV2RGB_INITIAL_LOAD          \
-    __asm__ volatile (                \
-        "movq (%5, %0, 2), %%mm6\n\t" \
-        "movd    (%2, %0), %%mm0\n\t" \
-        "movd    (%3, %0), %%mm1\n\t" \
-        "1: \n\t"                     \
-
-/* YUV2RGB core
- * Conversion is performed in usual way:
- * R = Y' * Ycoef + Vred * V'
- * G = Y' * Ycoef + Vgreen * V' + Ugreen * U'
- * B = Y' * Ycoef               + Ublue * U'
- *
- * where X' = X * 8 - Xoffset (multiplication is performed to increase
- * precision a bit).
- * Since it operates in YUV420 colorspace, Y component is additionally
- * split into Y1 and Y2 for even and odd pixels.
- *
- * Input:
- * mm0 - U (4 elems), mm1 - V (4 elems), mm6 - Y (8 elems), mm4 - zero register
- * Output:
- * mm1 - R, mm2 - G, mm0 - B
- */
-#define YUV2RGB                                  \
-    /* convert Y, U, V into Y1', Y2', U', V' */  \
-    "movq      %%mm6, %%mm7\n\t"                 \
-    "punpcklbw %%mm4, %%mm0\n\t"                 \
-    "punpcklbw %%mm4, %%mm1\n\t"                 \
-    "pand     "MANGLE(mmx_00ffw)", %%mm6\n\t"    \
-    "psrlw     $8,    %%mm7\n\t"                 \
-    "psllw     $3,    %%mm0\n\t"                 \
-    "psllw     $3,    %%mm1\n\t"                 \
-    "psllw     $3,    %%mm6\n\t"                 \
-    "psllw     $3,    %%mm7\n\t"                 \
-    "psubsw   "U_OFFSET"(%4), %%mm0\n\t"         \
-    "psubsw   "V_OFFSET"(%4), %%mm1\n\t"         \
-    "psubw    "Y_OFFSET"(%4), %%mm6\n\t"         \
-    "psubw    "Y_OFFSET"(%4), %%mm7\n\t"         \
-\
-     /* multiply by coefficients */              \
-    "movq      %%mm0, %%mm2\n\t"                 \
-    "movq      %%mm1, %%mm3\n\t"                 \
-    "pmulhw   "UG_COEFF"(%4), %%mm2\n\t"         \
-    "pmulhw   "VG_COEFF"(%4), %%mm3\n\t"         \
-    "pmulhw   "Y_COEFF" (%4), %%mm6\n\t"         \
-    "pmulhw   "Y_COEFF" (%4), %%mm7\n\t"         \
-    "pmulhw   "UB_COEFF"(%4), %%mm0\n\t"         \
-    "pmulhw   "VR_COEFF"(%4), %%mm1\n\t"         \
-    "paddsw    %%mm3, %%mm2\n\t"                 \
-    /* now: mm0 = UB, mm1 = VR, mm2 = CG */      \
-    /*      mm6 = Y1, mm7 = Y2 */                \
-\
-    /* produce RGB */                            \
-    "movq      %%mm7, %%mm3\n\t"                 \
-    "movq      %%mm7, %%mm5\n\t"                 \
-    "paddsw    %%mm0, %%mm3\n\t"                 \
-    "paddsw    %%mm1, %%mm5\n\t"                 \
-    "paddsw    %%mm2, %%mm7\n\t"                 \
-    "paddsw    %%mm6, %%mm0\n\t"                 \
-    "paddsw    %%mm6, %%mm1\n\t"                 \
-    "paddsw    %%mm6, %%mm2\n\t"                 \
-\
-    /* pack and interleave even/odd pixels */    \
-    "packuswb  %%mm0, %%mm0\n\t"                 \
-    "packuswb  %%mm1, %%mm1\n\t"                 \
-    "packuswb  %%mm2, %%mm2\n\t"                 \
-    "packuswb  %%mm3, %%mm3\n\t"                 \
-    "packuswb  %%mm5, %%mm5\n\t"                 \
-    "packuswb  %%mm7, %%mm7\n\t"                 \
-    "punpcklbw %%mm3, %%mm0\n\t"                 \
-    "punpcklbw %%mm5, %%mm1\n\t"                 \
-    "punpcklbw %%mm7, %%mm2\n\t"                 \
-
-#define YUV2RGB_ENDLOOP(depth)                   \
-    "movq 8 (%5, %0, 2), %%mm6\n\t"              \
-    "movd 4 (%3, %0),    %%mm1\n\t"              \
-    "movd 4 (%2, %0),    %%mm0\n\t"              \
-    "add $"AV_STRINGIFY(depth * 8)", %1\n\t"     \
-    "add  $4, %0\n\t"                            \
-    "js   1b\n\t"                                \
-
-#define YUV2RGB_OPERANDS                                          \
-        : "+r" (index), "+r" (image)                              \
-        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), \
-          "r" (py - 2*index)                                      \
-        );                                                        \
-    }                                                             \
-
-#define YUV2RGB_OPERANDS_ALPHA                                    \
-        : "+r" (index), "+r" (image)                              \
-        : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), \
-          "r" (py - 2*index), "r" (pa - 2*index)                  \
-        );                                                        \
-    }                                                             \
-
-#define YUV2RGB_ENDFUNC                          \
-    __asm__ volatile (SFENCE"\n\t"EMMS);         \
-    return srcSliceH;                            \
-
-
-#define RGB_PACK16(gmask, gshift, rshift)        \
-    "pand      "MANGLE(mmx_redmask)", %%mm0\n\t" \
-    "pand      "MANGLE(mmx_redmask)", %%mm1\n\t" \
-    "psrlw     $3,        %%mm0\n\t"             \
-    "pand      "MANGLE(gmask)",       %%mm2\n\t" \
-    "movq      %%mm0,     %%mm5\n\t"             \
-    "movq      %%mm1,     %%mm6\n\t"             \
-    "movq      %%mm2,     %%mm7\n\t"             \
-    "punpcklbw %%mm4,     %%mm0\n\t"             \
-    "punpcklbw %%mm4,     %%mm1\n\t"             \
-    "punpcklbw %%mm4,     %%mm2\n\t"             \
-    "punpckhbw %%mm4,     %%mm5\n\t"             \
-    "punpckhbw %%mm4,     %%mm6\n\t"             \
-    "punpckhbw %%mm4,     %%mm7\n\t"             \
-    "psllw     $"rshift", %%mm1\n\t"             \
-    "psllw     $"rshift", %%mm6\n\t"             \
-    "psllw     $"gshift", %%mm2\n\t"             \
-    "psllw     $"gshift", %%mm7\n\t"             \
-    "por       %%mm1,     %%mm0\n\t"             \
-    "por       %%mm6,     %%mm5\n\t"             \
-    "por       %%mm2,     %%mm0\n\t"             \
-    "por       %%mm7,     %%mm5\n\t"             \
-    MOVNTQ "   %%mm0,      (%1)\n\t"             \
-    MOVNTQ "   %%mm5,     8(%1)\n\t"             \
-
-#define DITHER_RGB                               \
-    "paddusb "BLUE_DITHER"(%4),  %%mm0\n\t"      \
-    "paddusb "GREEN_DITHER"(%4), %%mm2\n\t"      \
-    "paddusb "RED_DITHER"(%4),   %%mm1\n\t"      \
-
-static inline int RENAME(yuv420_rgb15)(SwsContext *c, const uint8_t *src[],
-                                       int srcStride[],
-                                       int srcSliceY, int srcSliceH,
-                                       uint8_t *dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV2RGB_LOOP(2)
-
-#ifdef DITHER1XBPP
-        c->blueDither  = ff_dither8[y       & 1];
-        c->greenDither = ff_dither8[y       & 1];
-        c->redDither   = ff_dither8[(y + 1) & 1];
-#endif
-
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-#ifdef DITHER1XBPP
-        DITHER_RGB
-#endif
-        RGB_PACK16(mmx_redmask, "2", "7")
-
-    YUV2RGB_ENDLOOP(2)
-    YUV2RGB_OPERANDS
-    YUV2RGB_ENDFUNC
-}
-
-static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t *src[],
-                                       int srcStride[],
-                                       int srcSliceY, int srcSliceH,
-                                       uint8_t *dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV2RGB_LOOP(2)
-
-#ifdef DITHER1XBPP
-        c->blueDither  = ff_dither8[y       & 1];
-        c->greenDither = ff_dither4[y       & 1];
-        c->redDither   = ff_dither8[(y + 1) & 1];
-#endif
-
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-#ifdef DITHER1XBPP
-        DITHER_RGB
-#endif
-        RGB_PACK16(mmx_grnmask, "3", "8")
-
-    YUV2RGB_ENDLOOP(2)
-    YUV2RGB_OPERANDS
-    YUV2RGB_ENDFUNC
-}
-
-
-#define RGB_PACK24(red, blue)              \
-    /* generate first packed RGB octet */  \
-    "movq      %%mm2,      %%mm5\n\t"      \
-    "movq      %%mm"blue", %%mm6\n\t"      \
-    "movq      %%mm"red",  %%mm7\n\t"      \
-    "punpcklbw %%mm5,      %%mm6\n\t"      \
-    "punpcklbw %%mm4,      %%mm7\n\t"      \
-    "movq      %%mm6,      %%mm3\n\t"      \
-    "punpcklwd %%mm7,      %%mm6\n\t"      \
-    "psrlq     $32,        %%mm3\n\t"      \
-    "movq      %%mm6,      %%mm5\n\t"      \
-    "psllq     $40,        %%mm6\n\t"      \
-    "psllq     $48,        %%mm3\n\t"      \
-    "psrlq     $32,        %%mm5\n\t"      \
-    "psrlq     $40,        %%mm6\n\t"      \
-    "psllq     $24,        %%mm5\n\t"      \
-    "por       %%mm3,      %%mm6\n\t"      \
-    "por       %%mm5,      %%mm6\n\t"      \
-    MOVNTQ "   %%mm6,      (%1)\n\t"       \
-\
-    /* generate second packed RGB octet */ \
-    "movq      %%mm"red",  %%mm7\n\t"      \
-    "movq      %%mm2,      %%mm5\n\t"      \
-    "movq      %%mm"blue", %%mm6\n\t"      \
-    "punpcklbw %%mm4,      %%mm7\n\t"      \
-    "punpcklbw %%mm5,      %%mm6\n\t"      \
-    "movq      %%mm7,      %%mm3\n\t"      \
-    "punpckhwd %%mm7,      %%mm6\n\t"      \
-    "psllq     $16,        %%mm3\n\t"      \
-    "psrlq     $32,        %%mm6\n\t"      \
-    "psrlq     $48,        %%mm3\n\t"      \
-    "psllq     $8,         %%mm6\n\t"      \
-    "movq      %%mm"red",  %%mm7\n\t"      \
-    "por       %%mm6,      %%mm3\n\t"      \
-    "movq      %%mm"blue", %%mm6\n\t"      \
-    "movq      %%mm2,      %%mm5\n\t"      \
-    "punpckhbw %%mm4,      %%mm7\n\t"      \
-    "punpckhbw %%mm5,      %%mm6\n\t"      \
-    "movq      %%mm6,      %%mm5\n\t"      \
-    "punpcklwd %%mm7,      %%mm6\n\t"      \
-    "psrlq     $16,        %%mm5\n\t"      \
-    "psllq     $56,        %%mm5\n\t"      \
-    "por       %%mm5,      %%mm3\n\t"      \
-    "psllq     $32,        %%mm6\n\t"      \
-    "por       %%mm6,      %%mm3\n\t"      \
-    MOVNTQ "   %%mm3,      8(%1)\n\t"      \
-\
-    /* generate third packed RGB octet */  \
-    "movq      %%mm"red",  %%mm7\n\t"      \
-    "movq      %%mm2,      %%mm5\n\t"      \
-    "movq      %%mm2,      %%mm3\n\t"      \
-    "movq      %%mm"blue", %%mm6\n\t"      \
-    "punpckhbw %%mm"red",  %%mm3\n\t"      \
-    "punpckhbw %%mm4,      %%mm7\n\t"      \
-    "psllq     $32,        %%mm3\n\t"      \
-    "punpckhbw %%mm5,      %%mm6\n\t"      \
-    "psrlq     $48,        %%mm3\n\t"      \
-    "punpckhwd %%mm7,      %%mm6\n\t"      \
-    "movq      %%mm6,      %%mm7\n\t"      \
-    "psrlq     $32,        %%mm6\n\t"      \
-    "psllq     $32,        %%mm7\n\t"      \
-    "psllq     $40,        %%mm6\n\t"      \
-    "psrlq     $16,        %%mm7\n\t"      \
-    "por       %%mm6,      %%mm3\n\t"      \
-    "por       %%mm7,      %%mm3\n\t"      \
-    MOVNTQ "   %%mm3,      16(%1)\n\t"     \
-
-static inline int RENAME(yuv420_rgb24)(SwsContext *c, const uint8_t *src[],
-                                       int srcStride[],
-                                       int srcSliceY, int srcSliceH,
-                                       uint8_t *dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV2RGB_LOOP(3)
-
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-        RGB_PACK24(REG_BLUE, REG_RED)
-
-    YUV2RGB_ENDLOOP(3)
-    YUV2RGB_OPERANDS
-    YUV2RGB_ENDFUNC
-}
-
-static inline int RENAME(yuv420_bgr24)(SwsContext *c, const uint8_t *src[],
-                                       int srcStride[],
-                                       int srcSliceY, int srcSliceH,
-                                       uint8_t *dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV2RGB_LOOP(3)
-
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-        RGB_PACK24(REG_RED, REG_BLUE)
-
-    YUV2RGB_ENDLOOP(3)
-    YUV2RGB_OPERANDS
-    YUV2RGB_ENDFUNC
-}
-
-
-#define SET_EMPTY_ALPHA                                                      \
-    "pcmpeqd   %%mm"REG_ALPHA", %%mm"REG_ALPHA"\n\t" /* set alpha to 0xFF */ \
-
-#define LOAD_ALPHA                                   \
-    "movq      (%6, %0, 2),     %%mm"REG_ALPHA"\n\t" \
-
-#define RGB_PACK32(red, green, blue, alpha)  \
-    "movq      %%mm"blue",  %%mm5\n\t"       \
-    "movq      %%mm"red",   %%mm6\n\t"       \
-    "punpckhbw %%mm"green", %%mm5\n\t"       \
-    "punpcklbw %%mm"green", %%mm"blue"\n\t"  \
-    "punpckhbw %%mm"alpha", %%mm6\n\t"       \
-    "punpcklbw %%mm"alpha", %%mm"red"\n\t"   \
-    "movq      %%mm"blue",  %%mm"green"\n\t" \
-    "movq      %%mm5,       %%mm"alpha"\n\t" \
-    "punpcklwd %%mm"red",   %%mm"blue"\n\t"  \
-    "punpckhwd %%mm"red",   %%mm"green"\n\t" \
-    "punpcklwd %%mm6,       %%mm5\n\t"       \
-    "punpckhwd %%mm6,       %%mm"alpha"\n\t" \
-    MOVNTQ "   %%mm"blue",   0(%1)\n\t"      \
-    MOVNTQ "   %%mm"green",  8(%1)\n\t"      \
-    MOVNTQ "   %%mm5,       16(%1)\n\t"      \
-    MOVNTQ "   %%mm"alpha", 24(%1)\n\t"      \
-
-static inline int RENAME(yuv420_rgb32)(SwsContext *c, const uint8_t *src[],
-                                       int srcStride[],
-                                       int srcSliceY, int srcSliceH,
-                                       uint8_t *dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV2RGB_LOOP(4)
-
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-        SET_EMPTY_ALPHA
-        RGB_PACK32(REG_RED, REG_GREEN, REG_BLUE, REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS
-    YUV2RGB_ENDFUNC
-}
-
-static inline int RENAME(yuva420_rgb32)(SwsContext *c, const uint8_t *src[],
-                                        int srcStride[],
-                                        int srcSliceY, int srcSliceH,
-                                        uint8_t *dst[], int dstStride[])
-{
-#if HAVE_7REGS
-    int y, h_size;
-
-    YUV2RGB_LOOP(4)
-
-        const uint8_t *pa = src[3] + y * srcStride[3];
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-        LOAD_ALPHA
-        RGB_PACK32(REG_RED, REG_GREEN, REG_BLUE, REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS_ALPHA
-    YUV2RGB_ENDFUNC
-#endif
-}
-
-static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t *src[],
-                                       int srcStride[],
-                                       int srcSliceY, int srcSliceH,
-                                       uint8_t *dst[], int dstStride[])
-{
-    int y, h_size;
-
-    YUV2RGB_LOOP(4)
-
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-        SET_EMPTY_ALPHA
-        RGB_PACK32(REG_BLUE, REG_GREEN, REG_RED, REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS
-    YUV2RGB_ENDFUNC
-}
-
-static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t *src[],
-                                        int srcStride[],
-                                        int srcSliceY, int srcSliceH,
-                                        uint8_t *dst[], int dstStride[])
-{
-#if HAVE_7REGS
-    int y, h_size;
-
-    YUV2RGB_LOOP(4)
-
-        const uint8_t *pa = src[3] + y * srcStride[3];
-        YUV2RGB_INITIAL_LOAD
-        YUV2RGB
-        LOAD_ALPHA
-        RGB_PACK32(REG_BLUE, REG_GREEN, REG_RED, REG_ALPHA)
-
-    YUV2RGB_ENDLOOP(4)
-    YUV2RGB_OPERANDS_ALPHA
-    YUV2RGB_ENDFUNC
-#endif
-}
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
deleted file mode 100644
index f47b15d..0000000
--- a/libswscale/yuv2rgb.c
+++ /dev/null
@@ -1,825 +0,0 @@
-/*
- * software YUV to RGB converter
- *
- * Copyright (C) 2009 Konstantin Shishkov
- *
- * 1,4,8bpp support and context / deglobalize stuff
- * by Michael Niedermayer (michaelni at gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "config.h"
-#include "rgb2rgb.h"
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/bswap.h"
-
-extern const uint8_t dither_4x4_16[4][8];
-extern const uint8_t dither_8x8_32[8][8];
-extern const uint8_t dither_8x8_73[8][8];
-extern const uint8_t dither_8x8_220[8][8];
-
-const int32_t ff_yuv2rgb_coeffs[8][4] = {
-    {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
-    {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
-    {104597, 132201, 25675, 53279}, /* unspecified */
-    {104597, 132201, 25675, 53279}, /* reserved */
-    {104448, 132798, 24759, 53109}, /* FCC */
-    {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
-    {104597, 132201, 25675, 53279}, /* SMPTE 170M */
-    {117579, 136230, 16907, 35559}  /* SMPTE 240M (1987) */
-};
-
-const int *sws_getCoefficients(int colorspace)
-{
-    if (colorspace > 7 || colorspace < 0)
-        colorspace = SWS_CS_DEFAULT;
-    return ff_yuv2rgb_coeffs[colorspace];
-}
-
-#define LOADCHROMA(i)                               \
-    U = pu[i];                                      \
-    V = pv[i];                                      \
-    r = (void *)c->table_rV[V];                     \
-    g = (void *)(c->table_gU[U] + c->table_gV[V]);  \
-    b = (void *)c->table_bU[U];
-
-#define PUTRGB(dst,src,i)            \
-    Y = src[2*i];                    \
-    dst[2*i  ] = r[Y] + g[Y] + b[Y]; \
-    Y = src[2*i+1];                  \
-    dst[2*i+1] = r[Y] + g[Y] + b[Y];
-
-#define PUTRGB24(dst,src,i)                                  \
-    Y = src[2*i];                                            \
-    dst[6*i+0] = r[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = b[Y]; \
-    Y = src[2*i+1];                                          \
-    dst[6*i+3] = r[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = b[Y];
-
-#define PUTBGR24(dst,src,i)                                  \
-    Y = src[2*i];                                            \
-    dst[6*i+0] = b[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = r[Y]; \
-    Y = src[2*i+1];                                          \
-    dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y];
-
-#define PUTRGBA(dst,ysrc,asrc,i,s)                      \
-    Y = ysrc[2*i];                                      \
-    dst[2*i  ] = r[Y] + g[Y] + b[Y] + (asrc[2*i  ]<<s); \
-    Y = ysrc[2*i+1];                                    \
-    dst[2*i+1] = r[Y] + g[Y] + b[Y] + (asrc[2*i+1]<<s);
-
-#define PUTRGB48(dst,src,i)             \
-    Y = src[2*i];                       \
-    dst[12*i+ 0] = dst[12*i+ 1] = r[Y]; \
-    dst[12*i+ 2] = dst[12*i+ 3] = g[Y]; \
-    dst[12*i+ 4] = dst[12*i+ 5] = b[Y]; \
-    Y = src[2*i+1];                     \
-    dst[12*i+ 6] = dst[12*i+ 7] = r[Y]; \
-    dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
-    dst[12*i+10] = dst[12*i+11] = b[Y];
-
-#define YUV2RGBFUNC(func_name, dst_type, alpha) \
-static int func_name(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, \
-                     int srcSliceH, uint8_t* dst[], int dstStride[]) \
-{\
-    int y;\
-\
-    if (!alpha && c->srcFormat == PIX_FMT_YUV422P) {\
-        srcStride[1] *= 2;\
-        srcStride[2] *= 2;\
-    }\
-    for (y=0; y<srcSliceH; y+=2) {\
-        dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY  )*dstStride[0]);\
-        dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
-        dst_type av_unused *r, *b;\
-        dst_type *g;\
-        const uint8_t *py_1 = src[0] + y*srcStride[0];\
-        const uint8_t *py_2 = py_1 + srcStride[0];\
-        const uint8_t *pu = src[1] + (y>>1)*srcStride[1];\
-        const uint8_t *pv = src[2] + (y>>1)*srcStride[2];\
-        const uint8_t av_unused *pa_1, *pa_2;\
-        unsigned int h_size = c->dstW>>3;\
-        if (alpha) {\
-            pa_1 = src[3] + y*srcStride[3];\
-            pa_2 = pa_1 + srcStride[3];\
-        }\
-        while (h_size--) {\
-            int av_unused U, V;\
-            int Y;\
-
-#define ENDYUV2RGBLINE(dst_delta)\
-            pu += 4;\
-            pv += 4;\
-            py_1 += 8;\
-            py_2 += 8;\
-            dst_1 += dst_delta;\
-            dst_2 += dst_delta;\
-        }\
-        if (c->dstW & 4) {\
-            int av_unused Y, U, V;\
-
-#define ENDYUV2RGBFUNC()\
-        }\
-    }\
-    return srcSliceH;\
-}
-
-#define CLOSEYUV2RGBFUNC(dst_delta)\
-    ENDYUV2RGBLINE(dst_delta)\
-    ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0)
-    LOADCHROMA(0);
-    PUTRGB48(dst_1,py_1,0);
-    PUTRGB48(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB48(dst_2,py_2,1);
-    PUTRGB48(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTRGB48(dst_1,py_1,2);
-    PUTRGB48(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTRGB48(dst_2,py_2,3);
-    PUTRGB48(dst_1,py_1,3);
-ENDYUV2RGBLINE(48)
-    LOADCHROMA(0);
-    PUTRGB48(dst_1,py_1,0);
-    PUTRGB48(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB48(dst_2,py_2,1);
-    PUTRGB48(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
-    LOADCHROMA(0);
-    PUTRGB(dst_1,py_1,0);
-    PUTRGB(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB(dst_2,py_2,1);
-    PUTRGB(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTRGB(dst_1,py_1,2);
-    PUTRGB(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTRGB(dst_2,py_2,3);
-    PUTRGB(dst_1,py_1,3);
-ENDYUV2RGBLINE(8)
-    LOADCHROMA(0);
-    PUTRGB(dst_1,py_1,0);
-    PUTRGB(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB(dst_2,py_2,1);
-    PUTRGB(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1)
-    LOADCHROMA(0);
-    PUTRGBA(dst_1,py_1,pa_1,0,24);
-    PUTRGBA(dst_2,py_2,pa_2,0,24);
-
-    LOADCHROMA(1);
-    PUTRGBA(dst_2,py_2,pa_1,1,24);
-    PUTRGBA(dst_1,py_1,pa_2,1,24);
-
-    LOADCHROMA(2);
-    PUTRGBA(dst_1,py_1,pa_1,2,24);
-    PUTRGBA(dst_2,py_2,pa_2,2,24);
-
-    LOADCHROMA(3);
-    PUTRGBA(dst_2,py_2,pa_1,3,24);
-    PUTRGBA(dst_1,py_1,pa_2,3,24);
-    pa_1 += 8;\
-    pa_2 += 8;\
-ENDYUV2RGBLINE(8)
-    LOADCHROMA(0);
-    PUTRGBA(dst_1,py_1,pa_1,0,24);
-    PUTRGBA(dst_2,py_2,pa_2,0,24);
-
-    LOADCHROMA(1);
-    PUTRGBA(dst_2,py_2,pa_1,1,24);
-    PUTRGBA(dst_1,py_1,pa_2,1,24);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuva2argb_c, uint32_t, 1)
-    LOADCHROMA(0);
-    PUTRGBA(dst_1,py_1,pa_1,0,0);
-    PUTRGBA(dst_2,py_2,pa_2,0,0);
-
-    LOADCHROMA(1);
-    PUTRGBA(dst_2,py_2,pa_2,1,0);
-    PUTRGBA(dst_1,py_1,pa_1,1,0);
-
-    LOADCHROMA(2);
-    PUTRGBA(dst_1,py_1,pa_1,2,0);
-    PUTRGBA(dst_2,py_2,pa_2,2,0);
-
-    LOADCHROMA(3);
-    PUTRGBA(dst_2,py_2,pa_2,3,0);
-    PUTRGBA(dst_1,py_1,pa_1,3,0);
-    pa_1 += 8;\
-    pa_2 += 8;\
-ENDYUV2RGBLINE(8)
-    LOADCHROMA(0);
-    PUTRGBA(dst_1,py_1,pa_1,0,0);
-    PUTRGBA(dst_2,py_2,pa_2,0,0);
-
-    LOADCHROMA(1);
-    PUTRGBA(dst_2,py_2,pa_2,1,0);
-    PUTRGBA(dst_1,py_1,pa_1,1,0);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0)
-    LOADCHROMA(0);
-    PUTRGB24(dst_1,py_1,0);
-    PUTRGB24(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB24(dst_2,py_2,1);
-    PUTRGB24(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTRGB24(dst_1,py_1,2);
-    PUTRGB24(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTRGB24(dst_2,py_2,3);
-    PUTRGB24(dst_1,py_1,3);
-ENDYUV2RGBLINE(24)
-    LOADCHROMA(0);
-    PUTRGB24(dst_1,py_1,0);
-    PUTRGB24(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB24(dst_2,py_2,1);
-    PUTRGB24(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-// only trivial mods from yuv2rgb_c_24_rgb
-YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0)
-    LOADCHROMA(0);
-    PUTBGR24(dst_1,py_1,0);
-    PUTBGR24(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTBGR24(dst_2,py_2,1);
-    PUTBGR24(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTBGR24(dst_1,py_1,2);
-    PUTBGR24(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTBGR24(dst_2,py_2,3);
-    PUTBGR24(dst_1,py_1,3);
-ENDYUV2RGBLINE(24)
-    LOADCHROMA(0);
-    PUTBGR24(dst_1,py_1,0);
-    PUTBGR24(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTBGR24(dst_2,py_2,1);
-    PUTBGR24(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_16, uint16_t, 0)
-    LOADCHROMA(0);
-    PUTRGB(dst_1,py_1,0);
-    PUTRGB(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB(dst_2,py_2,1);
-    PUTRGB(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTRGB(dst_1,py_1,2);
-    PUTRGB(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTRGB(dst_2,py_2,3);
-    PUTRGB(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(8)
-
-#if 0 // Currently unused
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_8, uint8_t, 0)
-    LOADCHROMA(0);
-    PUTRGB(dst_1,py_1,0);
-    PUTRGB(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB(dst_2,py_2,1);
-    PUTRGB(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTRGB(dst_1,py_1,2);
-    PUTRGB(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTRGB(dst_2,py_2,3);
-    PUTRGB(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(8)
-#endif
-
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_12_ordered_dither, uint16_t, 0)
-    const uint8_t *d16 = dither_4x4_16[y&3];
-#define PUTRGB12(dst,src,i,o)                                   \
-    Y = src[2*i];                                               \
-    dst[2*i]   = r[Y+d16[0+o]] + g[Y+d16[0+o]] + b[Y+d16[0+o]]; \
-    Y = src[2*i+1];                                             \
-    dst[2*i+1] = r[Y+d16[1+o]] + g[Y+d16[1+o]] + b[Y+d16[1+o]];
-
-    LOADCHROMA(0);
-    PUTRGB12(dst_1,py_1,0,0);
-    PUTRGB12(dst_2,py_2,0,0+8);
-
-    LOADCHROMA(1);
-    PUTRGB12(dst_2,py_2,1,2+8);
-    PUTRGB12(dst_1,py_1,1,2);
-
-    LOADCHROMA(2);
-    PUTRGB12(dst_1,py_1,2,4);
-    PUTRGB12(dst_2,py_2,2,4+8);
-
-    LOADCHROMA(3);
-    PUTRGB12(dst_2,py_2,3,6+8);
-    PUTRGB12(dst_1,py_1,3,6);
-CLOSEYUV2RGBFUNC(8)
-
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
-    const uint8_t *d32 = dither_8x8_32[y&7];
-    const uint8_t *d64 = dither_8x8_73[y&7];
-#define PUTRGB8(dst,src,i,o)                                    \
-    Y = src[2*i];                                               \
-    dst[2*i]   = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \
-    Y = src[2*i+1];                                             \
-    dst[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]];
-
-    LOADCHROMA(0);
-    PUTRGB8(dst_1,py_1,0,0);
-    PUTRGB8(dst_2,py_2,0,0+8);
-
-    LOADCHROMA(1);
-    PUTRGB8(dst_2,py_2,1,2+8);
-    PUTRGB8(dst_1,py_1,1,2);
-
-    LOADCHROMA(2);
-    PUTRGB8(dst_1,py_1,2,4);
-    PUTRGB8(dst_2,py_2,2,4+8);
-
-    LOADCHROMA(3);
-    PUTRGB8(dst_2,py_2,3,6+8);
-    PUTRGB8(dst_1,py_1,3,6);
-CLOSEYUV2RGBFUNC(8)
-
-#if 0 // Currently unused
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_4, uint8_t, 0)
-    int acc;
-#define PUTRGB4(dst,src,i)          \
-    Y = src[2*i];                   \
-    acc = r[Y] + g[Y] + b[Y];       \
-    Y = src[2*i+1];                 \
-    acc |= (r[Y] + g[Y] + b[Y])<<4; \
-    dst[i] = acc;
-
-    LOADCHROMA(0);
-    PUTRGB4(dst_1,py_1,0);
-    PUTRGB4(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB4(dst_2,py_2,1);
-    PUTRGB4(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTRGB4(dst_1,py_1,2);
-    PUTRGB4(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTRGB4(dst_2,py_2,3);
-    PUTRGB4(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(4)
-#endif
-
-YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
-    const uint8_t *d64 =  dither_8x8_73[y&7];
-    const uint8_t *d128 = dither_8x8_220[y&7];
-    int acc;
-
-#define PUTRGB4D(dst,src,i,o)                                     \
-    Y = src[2*i];                                                 \
-    acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]];        \
-    Y = src[2*i+1];                                               \
-    acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4;  \
-    dst[i]= acc;
-
-    LOADCHROMA(0);
-    PUTRGB4D(dst_1,py_1,0,0);
-    PUTRGB4D(dst_2,py_2,0,0+8);
-
-    LOADCHROMA(1);
-    PUTRGB4D(dst_2,py_2,1,2+8);
-    PUTRGB4D(dst_1,py_1,1,2);
-
-    LOADCHROMA(2);
-    PUTRGB4D(dst_1,py_1,2,4);
-    PUTRGB4D(dst_2,py_2,2,4+8);
-
-    LOADCHROMA(3);
-    PUTRGB4D(dst_2,py_2,3,6+8);
-    PUTRGB4D(dst_1,py_1,3,6);
-CLOSEYUV2RGBFUNC(4)
-
-#if 0 // Currently unused
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t, 0)
-    LOADCHROMA(0);
-    PUTRGB(dst_1,py_1,0);
-    PUTRGB(dst_2,py_2,0);
-
-    LOADCHROMA(1);
-    PUTRGB(dst_2,py_2,1);
-    PUTRGB(dst_1,py_1,1);
-
-    LOADCHROMA(2);
-    PUTRGB(dst_1,py_1,2);
-    PUTRGB(dst_2,py_2,2);
-
-    LOADCHROMA(3);
-    PUTRGB(dst_2,py_2,3);
-    PUTRGB(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(8)
-#endif
-
-YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
-    const uint8_t *d64 =  dither_8x8_73[y&7];
-    const uint8_t *d128 = dither_8x8_220[y&7];
-
-#define PUTRGB4DB(dst,src,i,o)                                    \
-    Y = src[2*i];                                                 \
-    dst[2*i]   = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \
-    Y = src[2*i+1];                                               \
-    dst[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]];
-
-    LOADCHROMA(0);
-    PUTRGB4DB(dst_1,py_1,0,0);
-    PUTRGB4DB(dst_2,py_2,0,0+8);
-
-    LOADCHROMA(1);
-    PUTRGB4DB(dst_2,py_2,1,2+8);
-    PUTRGB4DB(dst_1,py_1,1,2);
-
-    LOADCHROMA(2);
-    PUTRGB4DB(dst_1,py_1,2,4);
-    PUTRGB4DB(dst_2,py_2,2,4+8);
-
-    LOADCHROMA(3);
-    PUTRGB4DB(dst_2,py_2,3,6+8);
-    PUTRGB4DB(dst_1,py_1,3,6);
-CLOSEYUV2RGBFUNC(8)
-
-YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
-        const uint8_t *d128 = dither_8x8_220[y&7];
-        char out_1 = 0, out_2 = 0;
-        g= c->table_gU[128] + c->table_gV[128];
-
-#define PUTRGB1(out,src,i,o)    \
-    Y = src[2*i];               \
-    out+= out + g[Y+d128[0+o]]; \
-    Y = src[2*i+1];             \
-    out+= out + g[Y+d128[1+o]];
-
-    PUTRGB1(out_1,py_1,0,0);
-    PUTRGB1(out_2,py_2,0,0+8);
-
-    PUTRGB1(out_2,py_2,1,2+8);
-    PUTRGB1(out_1,py_1,1,2);
-
-    PUTRGB1(out_1,py_1,2,4);
-    PUTRGB1(out_2,py_2,2,4+8);
-
-    PUTRGB1(out_2,py_2,3,6+8);
-    PUTRGB1(out_1,py_1,3,6);
-
-    dst_1[0]= out_1;
-    dst_2[0]= out_2;
-CLOSEYUV2RGBFUNC(1)
-
-SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
-{
-    SwsFunc t = NULL;
-#if HAVE_MMX
-     t = ff_yuv2rgb_init_mmx(c);
-#endif
-#if HAVE_VIS
-    t = ff_yuv2rgb_init_vis(c);
-#endif
-#if CONFIG_MLIB
-    t = ff_yuv2rgb_init_mlib(c);
-#endif
-#if HAVE_ALTIVEC
-    if (c->flags & SWS_CPU_CAPS_ALTIVEC)
-        t = ff_yuv2rgb_init_altivec(c);
-#endif
-
-#if ARCH_BFIN
-    if (c->flags & SWS_CPU_CAPS_BFIN)
-        t = ff_yuv2rgb_get_func_ptr_bfin(c);
-#endif
-
-    if (t)
-        return t;
-
-    av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found from %s to %s.\n", sws_format_name(c->srcFormat), sws_format_name(c->dstFormat));
-
-    switch (c->dstFormat) {
-    case PIX_FMT_RGB48BE:
-    case PIX_FMT_RGB48LE:    return yuv2rgb_c_48;
-    case PIX_FMT_ARGB:
-    case PIX_FMT_ABGR:       if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) return yuva2argb_c;
-    case PIX_FMT_RGBA:
-    case PIX_FMT_BGRA:       return (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) ? yuva2rgba_c : yuv2rgb_c_32;
-    case PIX_FMT_RGB24:      return yuv2rgb_c_24_rgb;
-    case PIX_FMT_BGR24:      return yuv2rgb_c_24_bgr;
-    case PIX_FMT_RGB565:
-    case PIX_FMT_BGR565:
-    case PIX_FMT_RGB555:
-    case PIX_FMT_BGR555:     return yuv2rgb_c_16;
-    case PIX_FMT_RGB444:
-    case PIX_FMT_BGR444:     return yuv2rgb_c_12_ordered_dither;
-    case PIX_FMT_RGB8:
-    case PIX_FMT_BGR8:       return yuv2rgb_c_8_ordered_dither;
-    case PIX_FMT_RGB4:
-    case PIX_FMT_BGR4:       return yuv2rgb_c_4_ordered_dither;
-    case PIX_FMT_RGB4_BYTE:
-    case PIX_FMT_BGR4_BYTE:  return yuv2rgb_c_4b_ordered_dither;
-    case PIX_FMT_MONOBLACK:  return yuv2rgb_c_1_ordered_dither;
-    default:
-        assert(0);
-    }
-    return NULL;
-}
-
-static void fill_table(uint8_t* table[256], const int elemsize, const int inc, uint8_t *y_table)
-{
-    int i;
-    int64_t cb = 0;
-
-    y_table -= elemsize * (inc >> 9);
-
-    for (i = 0; i < 256; i++) {
-        table[i] = y_table + elemsize * (cb >> 16);
-        cb += inc;
-    }
-}
-
-static void fill_gv_table(int table[256], const int elemsize, const int inc)
-{
-    int i;
-    int64_t cb = 0;
-    int off = -(inc >> 9);
-
-    for (i = 0; i < 256; i++) {
-        table[i] = elemsize * (off + (cb >> 16));
-        cb += inc;
-    }
-}
-
-av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange,
-                                     int brightness, int contrast, int saturation)
-{
-    const int isRgb =      c->dstFormat==PIX_FMT_RGB32
-                        || c->dstFormat==PIX_FMT_RGB32_1
-                        || c->dstFormat==PIX_FMT_BGR24
-                        || c->dstFormat==PIX_FMT_RGB565BE
-                        || c->dstFormat==PIX_FMT_RGB565LE
-                        || c->dstFormat==PIX_FMT_RGB555BE
-                        || c->dstFormat==PIX_FMT_RGB555LE
-                        || c->dstFormat==PIX_FMT_RGB444BE
-                        || c->dstFormat==PIX_FMT_RGB444LE
-                        || c->dstFormat==PIX_FMT_RGB8
-                        || c->dstFormat==PIX_FMT_RGB4
-                        || c->dstFormat==PIX_FMT_RGB4_BYTE
-                        || c->dstFormat==PIX_FMT_MONOBLACK;
-    const int isNotNe =    c->dstFormat==PIX_FMT_NE(RGB565LE,RGB565BE)
-                        || c->dstFormat==PIX_FMT_NE(RGB555LE,RGB555BE)
-                        || c->dstFormat==PIX_FMT_NE(RGB444LE,RGB444BE)
-                        || c->dstFormat==PIX_FMT_NE(BGR565LE,BGR565BE)
-                        || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE)
-                        || c->dstFormat==PIX_FMT_NE(BGR444LE,BGR444BE);
-    const int bpp = c->dstFormatBpp;
-    uint8_t *y_table;
-    uint16_t *y_table16;
-    uint32_t *y_table32;
-    int i, base, rbase, gbase, bbase, abase, needAlpha;
-    const int yoffs = fullRange ? 384 : 326;
-
-    int64_t crv =  inv_table[0];
-    int64_t cbu =  inv_table[1];
-    int64_t cgu = -inv_table[2];
-    int64_t cgv = -inv_table[3];
-    int64_t cy  = 1<<16;
-    int64_t oy  = 0;
-
-    int64_t yb = 0;
-
-    if (!fullRange) {
-        cy = (cy*255) / 219;
-        oy = 16<<16;
-    } else {
-        crv = (crv*224) / 255;
-        cbu = (cbu*224) / 255;
-        cgu = (cgu*224) / 255;
-        cgv = (cgv*224) / 255;
-    }
-
-    cy  = (cy *contrast             ) >> 16;
-    crv = (crv*contrast * saturation) >> 32;
-    cbu = (cbu*contrast * saturation) >> 32;
-    cgu = (cgu*contrast * saturation) >> 32;
-    cgv = (cgv*contrast * saturation) >> 32;
-    oy -= 256*brightness;
-
-    //scale coefficients by cy
-    crv = ((crv << 16) + 0x8000) / cy;
-    cbu = ((cbu << 16) + 0x8000) / cy;
-    cgu = ((cgu << 16) + 0x8000) / cy;
-    cgv = ((cgv << 16) + 0x8000) / cy;
-
-    av_free(c->yuvTable);
-
-    switch (bpp) {
-    case 1:
-        c->yuvTable = av_malloc(1024);
-        y_table = c->yuvTable;
-        yb = -(384<<16) - oy;
-        for (i = 0; i < 1024-110; i++) {
-            y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
-            yb += cy;
-        }
-        fill_table(c->table_gU, 1, cgu, y_table + yoffs);
-        fill_gv_table(c->table_gV, 1, cgv);
-        break;
-    case 4:
-    case 4|128:
-        rbase = isRgb ? 3 : 0;
-        gbase = 1;
-        bbase = isRgb ? 0 : 3;
-        c->yuvTable = av_malloc(1024*3);
-        y_table = c->yuvTable;
-        yb = -(384<<16) - oy;
-        for (i = 0; i < 1024-110; i++) {
-            int yval = av_clip_uint8((yb + 0x8000) >> 16);
-            y_table[i+110     ] =  (yval >> 7)       << rbase;
-            y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase;
-            y_table[i+110+2048] =  (yval >> 7)       << bbase;
-            yb += cy;
-        }
-        fill_table(c->table_rV, 1, crv, y_table + yoffs);
-        fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
-        fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
-        fill_gv_table(c->table_gV, 1, cgv);
-        break;
-    case 8:
-        rbase = isRgb ? 5 : 0;
-        gbase = isRgb ? 2 : 3;
-        bbase = isRgb ? 0 : 6;
-        c->yuvTable = av_malloc(1024*3);
-        y_table = c->yuvTable;
-        yb = -(384<<16) - oy;
-        for (i = 0; i < 1024-38; i++) {
-            int yval = av_clip_uint8((yb + 0x8000) >> 16);
-            y_table[i+16     ] = ((yval + 18) / 36) << rbase;
-            y_table[i+16+1024] = ((yval + 18) / 36) << gbase;
-            y_table[i+37+2048] = ((yval + 43) / 85) << bbase;
-            yb += cy;
-        }
-        fill_table(c->table_rV, 1, crv, y_table + yoffs);
-        fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
-        fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
-        fill_gv_table(c->table_gV, 1, cgv);
-        break;
-    case 12:
-        rbase = isRgb ? 8 : 0;
-        gbase = 4;
-        bbase = isRgb ? 0 : 8;
-        c->yuvTable = av_malloc(1024*3*2);
-        y_table16 = c->yuvTable;
-        yb = -(384<<16) - oy;
-        for (i = 0; i < 1024; i++) {
-            uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
-            y_table16[i     ] = (yval >> 4) << rbase;
-            y_table16[i+1024] = (yval >> 4) << gbase;
-            y_table16[i+2048] = (yval >> 4) << bbase;
-            yb += cy;
-        }
-        if (isNotNe)
-            for (i = 0; i < 1024*3; i++)
-                y_table16[i] = bswap_16(y_table16[i]);
-        fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
-        fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
-        fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
-        fill_gv_table(c->table_gV, 2, cgv);
-        break;
-    case 15:
-    case 16:
-        rbase = isRgb ? bpp - 5 : 0;
-        gbase = 5;
-        bbase = isRgb ? 0 : (bpp - 5);
-        c->yuvTable = av_malloc(1024*3*2);
-        y_table16 = c->yuvTable;
-        yb = -(384<<16) - oy;
-        for (i = 0; i < 1024; i++) {
-            uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
-            y_table16[i     ] = (yval >> 3)          << rbase;
-            y_table16[i+1024] = (yval >> (18 - bpp)) << gbase;
-            y_table16[i+2048] = (yval >> 3)          << bbase;
-            yb += cy;
-        }
-        if(isNotNe)
-            for (i = 0; i < 1024*3; i++)
-                y_table16[i] = bswap_16(y_table16[i]);
-        fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
-        fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
-        fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
-        fill_gv_table(c->table_gV, 2, cgv);
-        break;
-    case 24:
-    case 48:
-        c->yuvTable = av_malloc(1024);
-        y_table = c->yuvTable;
-        yb = -(384<<16) - oy;
-        for (i = 0; i < 1024; i++) {
-            y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
-            yb += cy;
-        }
-        fill_table(c->table_rV, 1, crv, y_table + yoffs);
-        fill_table(c->table_gU, 1, cgu, y_table + yoffs);
-        fill_table(c->table_bU, 1, cbu, y_table + yoffs);
-        fill_gv_table(c->table_gV, 1, cgv);
-        break;
-    case 32:
-        base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0;
-        rbase = base + (isRgb ? 16 : 0);
-        gbase = base + 8;
-        bbase = base + (isRgb ? 0 : 16);
-        needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
-        if (!needAlpha)
-            abase = (base + 24) & 31;
-        c->yuvTable = av_malloc(1024*3*4);
-        y_table32 = c->yuvTable;
-        yb = -(384<<16) - oy;
-        for (i = 0; i < 1024; i++) {
-            uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
-            y_table32[i     ] = (yval << rbase) + (needAlpha ? 0 : (255 << abase));
-            y_table32[i+1024] = yval << gbase;
-            y_table32[i+2048] = yval << bbase;
-            yb += cy;
-        }
-        fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
-        fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024);
-        fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048);
-        fill_gv_table(c->table_gV, 4, cgv);
-        break;
-    default:
-        c->yuvTable = NULL;
-        av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
-        return -1;
-    }
-    return 0;
-}
diff --git a/subdir.mak b/subdir.mak
deleted file mode 100644
index 36a40d3..0000000
--- a/subdir.mak
+++ /dev/null
@@ -1,101 +0,0 @@
-SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
-
-include $(SUBDIR)../common.mak
-
-LIBVERSION := $(lib$(NAME)_VERSION)
-LIBMAJOR   := $(lib$(NAME)_VERSION_MAJOR)
-INCINSTDIR := $(INCDIR)/lib$(NAME)
-THIS_LIB   := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
-
-all-$(CONFIG_STATIC): $(SUBDIR)$(LIBNAME)
-all-$(CONFIG_SHARED): $(SUBDIR)$(SLIBNAME)
-
-$(SUBDIR)%-test.o: $(SUBDIR)%.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $(CC_O) $^
-
-$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c $(CC_O) $^
-
-$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
-	$(YASMDEP) $(YASMFLAGS) -I $(<D)/ -M -o $@ $< > $(@:.o=.d)
-	$(YASM) $(YASMFLAGS) -I $(<D)/ -o $@ $<
-
-$(OBJS) $(SUBDIR)%.ho $(SUBDIR)%-test.o $(TESTOBJS): CPPFLAGS += -DHAVE_AV_CONFIG_H
-
-$(SUBDIR)$(LIBNAME): $(OBJS)
-	$(RM) $@
-	$(AR) rc $@ $^ $(EXTRAOBJS)
-	$(RANLIB) $@
-
-install-headers: install-lib$(NAME)-headers install-lib$(NAME)-pkgconfig
-
-install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static
-install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared
-
-define RULES
-$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
-	$$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
-
-$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
-	$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
-
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
-	$(SLIB_CREATE_DEF_CMD)
-	$$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
-	$(SLIB_EXTRA_CMD)
-
-ifdef SUBDIR
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
-endif
-
-clean::
-	$(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
-	    $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS)))) \
-	    $(HOSTOBJS) $(HOSTPROGS)
-
-distclean:: clean
-	$(RM)  $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
-            $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
-
-install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
-	$(Q)mkdir -p "$(SHLIBDIR)"
-	$$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	$$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	$(Q)cd "$(SHLIBDIR)" && \
-		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
-	$(Q)cd "$(SHLIBDIR)" && \
-		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
-	$(SLIB_INSTALL_EXTRA_CMD)
-
-install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
-	$(Q)mkdir -p "$(LIBDIR)"
-	$$(INSTALL) -m 644 $$< "$(LIBDIR)"
-	$(LIB_INSTALL_EXTRA_CMD)
-
-install-lib$(NAME)-headers: $(addprefix $(SUBDIR),$(HEADERS) $(BUILT_HEADERS))
-	$(Q)mkdir -p "$(INCINSTDIR)"
-	$$(INSTALL) -m 644 $$^ "$(INCINSTDIR)"
-
-install-lib$(NAME)-pkgconfig: $(SUBDIR)lib$(NAME).pc
-	$(Q)mkdir -p "$(LIBDIR)/pkgconfig"
-	$$(INSTALL) -m 644 $$^ "$(LIBDIR)/pkgconfig"
-
-uninstall-libs::
-	-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
-	       "$(SHLIBDIR)/$(SLIBNAME)"            \
-	       "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
-	-$(SLIB_UNINSTALL_EXTRA_CMD)
-	-$(RM) "$(LIBDIR)/$(LIBNAME)"
-
-uninstall-headers::
-	$(RM) $(addprefix "$(INCINSTDIR)/",$(HEADERS))
-	$(RM) "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
-	-rmdir "$(INCDIR)"
-endef
-
-$(eval $(RULES))
-
-$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
-
-examples: $(EXAMPLES)
-testprogs: $(TESTPROGS)
diff --git a/tests/audiogen.c b/tests/audiogen.c
deleted file mode 100644
index 38ca5dd..0000000
--- a/tests/audiogen.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Generates a synthetic stereo sound
- * NOTE: No floats are used to guarantee a bit exact output.
- *
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#define NB_CHANNELS 2
-#define FE 44100
-
-static unsigned int myrnd(unsigned int *seed_ptr, int n)
-{
-    unsigned int seed, val;
-
-    seed = *seed_ptr;
-    seed = (seed * 314159) + 1;
-    if (n == 256) {
-        val = seed >> 24;
-    } else {
-        val = seed % n;
-    }
-    *seed_ptr = seed;
-    return val;
-}
-
-#define FRAC_BITS 16
-#define FRAC_ONE (1 << FRAC_BITS)
-
-#define COS_TABLE_BITS 7
-
-/* integer cosinus */
-static const unsigned short cos_table[(1 << COS_TABLE_BITS) + 2] = {
- 0x8000, 0x7ffe, 0x7ff6, 0x7fea, 0x7fd9, 0x7fc2, 0x7fa7, 0x7f87,
- 0x7f62, 0x7f38, 0x7f0a, 0x7ed6, 0x7e9d, 0x7e60, 0x7e1e, 0x7dd6,
- 0x7d8a, 0x7d3a, 0x7ce4, 0x7c89, 0x7c2a, 0x7bc6, 0x7b5d, 0x7aef,
- 0x7a7d, 0x7a06, 0x798a, 0x790a, 0x7885, 0x77fb, 0x776c, 0x76d9,
- 0x7642, 0x75a6, 0x7505, 0x7460, 0x73b6, 0x7308, 0x7255, 0x719e,
- 0x70e3, 0x7023, 0x6f5f, 0x6e97, 0x6dca, 0x6cf9, 0x6c24, 0x6b4b,
- 0x6a6e, 0x698c, 0x68a7, 0x67bd, 0x66d0, 0x65de, 0x64e9, 0x63ef,
- 0x62f2, 0x61f1, 0x60ec, 0x5fe4, 0x5ed7, 0x5dc8, 0x5cb4, 0x5b9d,
- 0x5a82, 0x5964, 0x5843, 0x571e, 0x55f6, 0x54ca, 0x539b, 0x5269,
- 0x5134, 0x4ffb, 0x4ec0, 0x4d81, 0x4c40, 0x4afb, 0x49b4, 0x486a,
- 0x471d, 0x45cd, 0x447b, 0x4326, 0x41ce, 0x4074, 0x3f17, 0x3db8,
- 0x3c57, 0x3af3, 0x398d, 0x3825, 0x36ba, 0x354e, 0x33df, 0x326e,
- 0x30fc, 0x2f87, 0x2e11, 0x2c99, 0x2b1f, 0x29a4, 0x2827, 0x26a8,
- 0x2528, 0x23a7, 0x2224, 0x209f, 0x1f1a, 0x1d93, 0x1c0c, 0x1a83,
- 0x18f9, 0x176e, 0x15e2, 0x1455, 0x12c8, 0x113a, 0x0fab, 0x0e1c,
- 0x0c8c, 0x0afb, 0x096b, 0x07d9, 0x0648, 0x04b6, 0x0324, 0x0192,
- 0x0000, 0x0000,
-};
-
-#define CSHIFT (FRAC_BITS - COS_TABLE_BITS - 2)
-
-static int int_cos(int a)
-{
-    int neg, v, f;
-    const unsigned short *p;
-
-    a = a & (FRAC_ONE - 1); /* modulo 2 * pi */
-    if (a >= (FRAC_ONE / 2))
-        a = FRAC_ONE - a;
-    neg = 0;
-    if (a > (FRAC_ONE / 4)) {
-        neg = -1;
-        a = (FRAC_ONE / 2) - a;
-    }
-    p = cos_table + (a >> CSHIFT);
-    /* linear interpolation */
-    f = a & ((1 << CSHIFT) - 1);
-    v = p[0] + (((p[1] - p[0]) * f + (1 << (CSHIFT - 1))) >> CSHIFT);
-    v = (v ^ neg) - neg;
-    v = v << (FRAC_BITS - 15);
-    return v;
-}
-
-FILE *outfile;
-
-static void put_sample(int v)
-{
-    fputc(v & 0xff, outfile);
-    fputc((v >> 8) & 0xff, outfile);
-}
-
-int main(int argc, char **argv)
-{
-    int i, a, v, j, f, amp, ampa;
-    unsigned int seed = 1;
-    int tabf1[NB_CHANNELS], tabf2[NB_CHANNELS];
-    int taba[NB_CHANNELS];
-
-    if (argc != 2) {
-        printf("usage: %s file\n"
-               "generate a test raw 16 bit stereo audio stream\n", argv[0]);
-        exit(1);
-    }
-
-    outfile = fopen(argv[1], "wb");
-    if (!outfile) {
-        perror(argv[1]);
-        return 1;
-    }
-
-    /* 1 second of single freq sinus at 1000 Hz */
-    a = 0;
-    for(i=0;i<1 * FE;i++) {
-        v = (int_cos(a) * 10000) >> FRAC_BITS;
-        for(j=0;j<NB_CHANNELS;j++)
-            put_sample(v);
-        a += (1000 * FRAC_ONE) / FE;
-    }
-
-    /* 1 second of varing frequency between 100 and 10000 Hz */
-    a = 0;
-    for(i=0;i<1 * FE;i++) {
-        v = (int_cos(a) * 10000) >> FRAC_BITS;
-        for(j=0;j<NB_CHANNELS;j++)
-            put_sample(v);
-        f = 100 + (((10000 - 100) * i) / FE);
-        a += (f * FRAC_ONE) / FE;
-    }
-
-    /* 0.5 second of low amplitude white noise */
-    for(i=0;i<FE / 2;i++) {
-        v = myrnd(&seed, 20000) - 10000;
-        for(j=0;j<NB_CHANNELS;j++)
-            put_sample(v);
-    }
-
-    /* 0.5 second of high amplitude white noise */
-    for(i=0;i<FE / 2;i++) {
-        v = myrnd(&seed, 65535) - 32768;
-        for(j=0;j<NB_CHANNELS;j++)
-            put_sample(v);
-    }
-
-    /* stereo : 2 unrelated ramps */
-    for(j=0;j<NB_CHANNELS;j++) {
-        taba[j] = 0;
-        tabf1[j] = 100 + myrnd(&seed, 5000);
-        tabf2[j] = 100 + myrnd(&seed, 5000);
-    }
-    for(i=0;i<1 * FE;i++) {
-        for(j=0;j<NB_CHANNELS;j++) {
-            v = (int_cos(taba[j]) * 10000) >> FRAC_BITS;
-            put_sample(v);
-            f = tabf1[j] + (((tabf2[j] - tabf1[j]) * i) / FE);
-            taba[j] += (f * FRAC_ONE) / FE;
-        }
-    }
-
-    /* stereo 500 Hz with varying volume */
-    a = 0;
-    ampa = 0;
-    for(i=0;i<2 * FE;i++) {
-        for(j=0;j<NB_CHANNELS;j++) {
-            amp = ((FRAC_ONE + int_cos(ampa)) * 5000) >> FRAC_BITS;
-            if (j & 1)
-                amp = 10000 - amp;
-            v = (int_cos(a) * amp) >> FRAC_BITS;
-            put_sample(v);
-            a += (500 * FRAC_ONE) / FE;
-            ampa += (2 * FRAC_ONE) / FE;
-        }
-    }
-
-    fclose(outfile);
-    return 0;
-}
diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh
deleted file mode 100755
index ce958ce..0000000
--- a/tests/codec-regression.sh
+++ /dev/null
@@ -1,352 +0,0 @@
-#!/bin/sh
-#
-# automatic regression test for ffmpeg
-#
-#
-#set -x
-
-set -e
-
-. $(dirname $0)/regression-funcs.sh
-
-eval do_$test=y
-
-rm -f "$logfile"
-rm -f "$benchfile"
-
-# generate reference for quality check
-if [ -n "$do_vref" ]; then
-do_ffmpeg_nocheck $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo $target_path/$raw_ref
-fi
-if [ -n "$do_aref" ]; then
-do_ffmpeg_nocheck $pcm_ref -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $target_path/$pcm_ref
-fi
-
-if [ -n "$do_mpeg" ] ; then
-# mpeg1
-do_video_encoding mpeg1.mpg "-qscale 10" "-f mpeg1video"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2" ] ; then
-# mpeg2
-do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
-do_video_decoding
-
-# mpeg2 encoding intra vlc qprd
-do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -trellis 1 -flags +qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" "-vcodec mpeg2video -f mpeg2video"
-do_video_decoding
-
-#mpeg2 4:2:2 encoding
-do_video_encoding mpeg2_422.mpg "-vb 1000k -bf 2 -trellis 1 -flags +qprd+mv0+ildct+ilme -flags2 +ivlc -mbd rd" "-vcodec mpeg2video -pix_fmt yuv422p -f mpeg2video"
-do_video_decoding
-
-# mpeg2
-do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
-do_video_decoding "-idct int"
-
-# mpeg2 encoding interlaced
-do_video_encoding mpeg2i.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg2thread" ] ; then
-# mpeg2 encoding interlaced
-do_video_encoding mpeg2thread.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
-do_video_decoding
-
-# mpeg2 encoding interlaced using intra vlc
-do_video_encoding mpeg2threadivlc.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
-do_video_decoding
-
-# mpeg2 encoding interlaced
-file=${outfile}mpeg2reuse.mpg
-do_ffmpeg $file -sameq -me_threshold 256 -mb_threshold 1024 -i ${target_path}/${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4
-do_video_decoding
-fi
-
-if [ -n "$do_msmpeg4v2" ] ; then
-do_video_encoding msmpeg4v2.avi "-qscale 10" "-an -vcodec msmpeg4v2"
-do_video_decoding
-fi
-
-if [ -n "$do_msmpeg4" ] ; then
-do_video_encoding msmpeg4.avi "-qscale 10" "-an -vcodec msmpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_wmv1" ] ; then
-do_video_encoding wmv1.avi "-qscale 10" "-an -vcodec wmv1"
-do_video_decoding
-fi
-
-if [ -n "$do_wmv2" ] ; then
-do_video_encoding wmv2.avi "-qscale 10" "-an -vcodec wmv2"
-do_video_decoding
-fi
-
-if [ -n "$do_h261" ] ; then
-do_video_encoding h261.avi "-qscale 11" "-s 352x288 -an -vcodec h261"
-do_video_decoding
-fi
-
-if [ -n "$do_h263" ] ; then
-do_video_encoding h263.avi "-qscale 10" "-s 352x288 -an -vcodec h263"
-do_video_decoding
-fi
-
-if [ -n "$do_h263p" ] ; then
-do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4" ] ; then
-do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_huffyuv" ] ; then
-do_video_encoding huffyuv.avi "" "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
-do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
-fi
-
-if [ -n "$do_rc" ] ; then
-do_video_encoding mpeg4-rc.avi "-b 400k -bf 2" "-an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4adv" ] ; then
-do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200" "-an -vcodec mpeg4"
-do_video_decoding
-
-do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -trellis 1 -flags +mv4+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd" "-an -vcodec mpeg4"
-do_video_decoding
-
-do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+mv0 -trellis 1 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3" "-an -vcodec mpeg4"
-do_video_decoding
-
-do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4thread" ] ; then
-do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
-do_video_decoding
-fi
-
-if [ -n "$do_error" ] ; then
-do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg4nr" ] ; then
-do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
-do_video_decoding
-fi
-
-if [ -n "$do_mpeg1b" ] ; then
-do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
-do_video_decoding
-fi
-
-if [ -n "$do_mjpeg" ] ; then
-do_video_encoding mjpeg.avi "-qscale 9" "-an -vcodec mjpeg -pix_fmt yuvj420p"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_ljpeg" ] ; then
-do_video_encoding ljpeg.avi "" "-an -vcodec ljpeg -strict -1"
-do_video_decoding
-fi
-
-if [ -n "$do_jpegls" ] ; then
-do_video_encoding jpegls.avi "" "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
-do_video_decoding "" "-pix_fmt yuv420p  -sws_flags area+bitexact"
-fi
-
-if [ -n "$do_rv10" ] ; then
-do_video_encoding rv10.rm "-qscale 10" "-an"
-do_video_decoding
-fi
-
-if [ -n "$do_rv20" ] ; then
-do_video_encoding rv20.rm "-qscale 10" "-vcodec rv20 -an"
-do_video_decoding
-fi
-
-if [ -n "$do_asv1" ] ; then
-do_video_encoding asv1.avi "-qscale 10" "-an -vcodec asv1"
-do_video_decoding
-fi
-
-if [ -n "$do_asv2" ] ; then
-do_video_encoding asv2.avi "-qscale 10" "-an -vcodec asv2"
-do_video_decoding
-fi
-
-if [ -n "$do_flv" ] ; then
-do_video_encoding flv.flv "-qscale 10" "-an -vcodec flv"
-do_video_decoding
-fi
-
-if [ -n "$do_ffv1" ] ; then
-do_video_encoding ffv1.avi "-strict -2" "-an -vcodec ffv1"
-do_video_decoding
-fi
-
-if [ -n "$do_snow" ] ; then
-do_video_encoding snow.avi "-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
-do_video_decoding "" "-s 352x288"
-fi
-
-if [ -n "$do_snowll" ] ; then
-do_video_encoding snow53.avi "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
-do_video_decoding
-fi
-
-if [ -n "$do_dv" ] ; then
-do_video_encoding dv.dv "-dct int" "-s pal -an"
-do_video_decoding "" "-s cif"
-
-do_video_encoding dv411.dv "-dct int" "-s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
-do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
-fi
-
-if [ -n "$do_dv50" ] ; then
-do_video_encoding dv50.dv "-dct int" "-s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
-do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
-fi
-
-if [ -n "$do_dnxhd_1080i" ] ; then
-# FIXME: interlaced raw DNxHD decoding is broken
-do_video_encoding dnxhd-1080i.mov "" "-vcodec dnxhd -flags +ildct -s hd1080 -b 120Mb -pix_fmt yuv422p -vframes 5 -an"
-do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
-fi
-
-if [ -n "$do_dnxhd_720p" ] ; then
-do_video_encoding dnxhd-720p.dnxhd "" "-s hd720 -b 90Mb -pix_fmt yuv422p -vframes 5 -an"
-do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
-fi
-
-if [ -n "$do_dnxhd_720p_rd" ] ; then
-do_video_encoding dnxhd-720p-rd.dnxhd "" "-threads 4 -mbd rd -s hd720 -b 90Mb -pix_fmt yuv422p -vframes 5 -an"
-do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
-fi
-
-if [ -n "$do_svq1" ] ; then
-do_video_encoding svq1.mov "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_flashsv" ] ; then
-do_video_encoding flashsv.flv "" "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
-do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
-fi
-
-if [ -n "$do_roq" ] ; then
-do_video_encoding roqav.roq "" "-vframes 5"
-do_video_decoding "" "-pix_fmt yuv420p"
-fi
-
-if [ -n "$do_mp2" ] ; then
-do_audio_encoding mp2.mp2 "-ar 44100"
-do_audio_decoding
-$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
-fi
-
-if [ -n "$do_ac3" ] ; then
-do_audio_encoding ac3.rm "" -vn
-# binaries configured with --disable-sse decode ac3 differently
-#do_audio_decoding
-#$tiny_psnr $pcm_dst $pcm_ref 2 1024 >> $logfile
-fi
-
-if [ -n "$do_g726" ] ; then
-do_audio_encoding g726.wav "-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_ima_wav" ] ; then
-do_audio_encoding adpcm_ima.wav "-ar 44100" "-acodec adpcm_ima_wav"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_ima_qt" ] ; then
-do_audio_encoding adpcm_qt.aiff "-ar 44100" "-acodec adpcm_ima_qt"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_ms" ] ; then
-do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_yam" ] ; then
-do_audio_encoding adpcm_yam.wav "-ar 44100" "-acodec adpcm_yamaha"
-do_audio_decoding
-fi
-
-if [ -n "$do_adpcm_swf" ] ; then
-do_audio_encoding adpcm_swf.flv "-ar 44100" "-acodec adpcm_swf"
-do_audio_decoding
-fi
-
-if [ -n "$do_alac" ] ; then
-do_audio_encoding alac.m4a "-ar 44100" "-acodec alac -compression_level 1"
-do_audio_decoding
-fi
-
-if [ -n "$do_flac" ] ; then
-do_audio_encoding flac.flac "-ar 44100" "-acodec flac -compression_level 2"
-do_audio_decoding
-fi
-
-if [ -n "$do_wmav1" ] ; then
-do_audio_encoding wmav1.asf "-ar 44100" "-acodec wmav1"
-do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
-$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
-fi
-if [ -n "$do_wmav2" ] ; then
-do_audio_encoding wmav2.asf "-ar 44100" "-acodec wmav2"
-do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
-$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
-fi
-
-#if [ -n "$do_vorbis" ] ; then
-# vorbis
-#disabled because it is broken
-#do_audio_encoding vorbis.asf "-ar 44100" "-acodec vorbis"
-#do_audio_decoding
-#fi
-
-do_audio_enc_dec() {
-    do_audio_encoding $3.$1 "" "$4 -sample_fmt $2 -acodec $3"
-    do_audio_decoding
-}
-
-if [ -n "$do_pcm" ] ; then
-do_audio_enc_dec wav s16 pcm_alaw
-do_audio_enc_dec wav s16 pcm_mulaw
-do_audio_enc_dec mov u8 pcm_s8
-do_audio_enc_dec wav u8 pcm_u8
-do_audio_enc_dec mov s16 pcm_s16be
-do_audio_enc_dec wav s16 pcm_s16le
-do_audio_enc_dec mkv s16 pcm_s16be
-do_audio_enc_dec mkv s16 pcm_s16le
-do_audio_enc_dec mov s32 pcm_s24be
-do_audio_enc_dec wav s32 pcm_s24le
-#do_audio_enc_dec ??? s32 pcm_u24be #no compatible muxer or demuxer
-#do_audio_enc_dec ??? s32 pcm_u24le #no compatible muxer or demuxer
-do_audio_enc_dec mov s32 pcm_s32be
-do_audio_enc_dec wav s32 pcm_s32le
-#do_audio_enc_dec ??? s32 pcm_u32be #no compatible muxer or demuxer
-#do_audio_enc_dec ??? s32 pcm_u32le #no compatible muxer or demuxer
-do_audio_enc_dec au  flt pcm_f32be
-do_audio_enc_dec wav flt pcm_f32le
-do_audio_enc_dec au  dbl pcm_f64be
-do_audio_enc_dec wav dbl pcm_f64le
-do_audio_enc_dec wav s16 pcm_zork
-do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
-fi
-
-rm -f "$bench" "$bench2"
diff --git a/tests/copy.regression.ref b/tests/copy.regression.ref
deleted file mode 100644
index 0f62a7b..0000000
--- a/tests/copy.regression.ref
+++ /dev/null
@@ -1,465 +0,0 @@
-----------------
-./tests/data/a-ac3.rm
-first.nut second.nut differ: char 34, line 1
-1dd5a62b7edb3a1bcf77626af0a85bc1  first.nut
-----------------
-./tests/data/a-adpcm_ima.wav
-first.nut second.nut differ: char 34, line 1
-c95390143078f08db8a3bfba5789c2da  first.nut
-----------------
-./tests/data/a-adpcm_ms.wav
-first.nut second.nut differ: char 34, line 1
-05e4d8842f4001fed506423e1a8ef963  first.nut
-----------------
-./tests/data/a-adpcm_qt.aiff
-first.nut second.nut differ: char 34, line 1
-7455d87f626f05e20030f4c93ec91e69  first.nut
-----------------
-./tests/data/a-adpcm_swf.flv
-c0402ee010a483403a655f353e184df1  first.nut
-----------------
-./tests/data/a-adpcm_yam.wav
-first.nut second.nut differ: char 34, line 1
-f861047f6c6f75cdf3ce7bb78a4003ad  first.nut
-----------------
-./tests/data/a-alac.m4a
-first.nut second.nut differ: char 34, line 1
-ab152b0b01e540e74b04a807e3882083  first.nut
-----------------
-./tests/data/a-asv1.avi
-636fc0dfef1830cc51cf2c182bd4a7b2  first.nut
-----------------
-./tests/data/a-asv2.avi
-bbfc299390378c7bdbd7463434d8fcbe  first.nut
-----------------
-./tests/data/a-dnxhd-1080i.mov
-first.nut second.nut differ: char 113, line 1
-037e31900e6cdf7161c2a0df23d9dc9d  first.nut
-----------------
-./tests/data/a-dnxhd-720p-rd.dnxhd
-first.nut second.nut differ: char 113, line 1
-1237abac554ea9adb2a926641eec0de0  first.nut
-----------------
-./tests/data/a-dnxhd-720p.dnxhd
-first.nut second.nut differ: char 113, line 1
-6694322cefa2f482bc3dac8be22eb5d5  first.nut
-----------------
-./tests/data/a-dv.dv
-1aa367a56d31bb45f98d820121820909  first.nut
-----------------
-./tests/data/a-dv411.dv
-7ef296512960e00d96850f2606b4b683  first.nut
-----------------
-./tests/data/a-dv50.dv
-6424dd39e22a1789a8182d7e8da224a9  first.nut
-----------------
-./tests/data/a-error-mpeg4-adv.avi
-715b262e3e7c9be2b59525ba0289f30e  first.nut
-----------------
-./tests/data/a-ffv1.avi
-edada4da2170ffd3386636cff67a90f0  first.nut
-----------------
-./tests/data/a-flac.flac
-d5e0a6d87034c21627afb2a904412a21  first.nut
-----------------
-./tests/data/a-flashsv.flv
-985076a8a87df1f91b34cbb81ce96217  first.nut
-----------------
-./tests/data/a-flv.flv
-6d01a0eb07c15ec3d0a70bfad0615bec  first.nut
-----------------
-./tests/data/a-g726.wav
-first.nut second.nut differ: char 34, line 1
-59540b44c97b8e1eafc53ebdaeaf3eb8  first.nut
-----------------
-./tests/data/a-h261.avi
-18d47cc50e05e5c855a8aec1a5d8d9ec  first.nut
-----------------
-./tests/data/a-h263.avi
-91b67a478420a30cf10c3d872f7e799b  first.nut
-----------------
-./tests/data/a-h263p.avi
-1e9f108181dca2dd3bb621bb45fc5834  first.nut
-----------------
-./tests/data/a-huffyuv.avi
-62dccc2a428b561c08497f8378ea1567  first.nut
-----------------
-./tests/data/a-jpegls.avi
-35f1bb0f9b14bf3eb29134784f278c4f  first.nut
-----------------
-./tests/data/a-ljpeg.avi
-45ec1072d8e55d6cfa784cc732830f3c  first.nut
-----------------
-./tests/data/a-mjpeg.avi
-4e6d42fdda880661de8308cfa45652ee  first.nut
-----------------
-./tests/data/a-mp2.mp2
-6c8d1a33dd994d63c68e5c9953b5cb8c  first.nut
-----------------
-./tests/data/a-mpeg1.mpg
-first.nut second.nut differ: char 34, line 1
-9d444c67713ef70c06d35fd355200ed5  first.nut
-----------------
-./tests/data/a-mpeg1b.mpg
-first.nut second.nut differ: char 34, line 1
-9d444c67713ef70c06d35fd355200ed5  first.nut
-----------------
-./tests/data/a-mpeg2.mpg
-first.nut second.nut differ: char 34, line 1
-328f6a0069b76397c5ed0dcea8b69b50  first.nut
-----------------
-./tests/data/a-mpeg2.mpg
-first.nut second.nut differ: char 34, line 1
-328f6a0069b76397c5ed0dcea8b69b50  first.nut
-----------------
-./tests/data/a-mpeg2_422.mpg
-first.nut second.nut differ: char 34, line 1
-d27035bcf30801cd1bee6ac59e8f5e3e  first.nut
-----------------
-./tests/data/a-mpeg2i.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1  first.nut
-----------------
-./tests/data/a-mpeg2ivlc-qprd.mpg
-first.nut second.nut differ: char 34, line 1
-d910da52fa10eb1deca10fa9443132d2  first.nut
-----------------
-./tests/data/a-mpeg2reuse.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1  first.nut
-----------------
-./tests/data/a-mpeg2thread.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1  first.nut
-----------------
-./tests/data/a-mpeg2threadivlc.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1  first.nut
-----------------
-./tests/data/a-mpeg4-Q.avi
-first.nut second.nut differ: char 34, line 1
-305bab90451e2c3b741e3aef51bc2a4c  first.nut
-----------------
-./tests/data/a-mpeg4-adap.avi
-first.nut second.nut differ: char 34, line 1
-5d9315ec49c4122f6f23cf84cab5fc53  first.nut
-----------------
-./tests/data/a-mpeg4-adv.avi
-5d672bf4c2e879d6a20e349cb4dc09a6  first.nut
-----------------
-./tests/data/a-mpeg4-nr.avi
-0243b2e03115fe948f99da1ee10ae588  first.nut
-----------------
-./tests/data/a-mpeg4-qprd.avi
-first.nut second.nut differ: char 34, line 1
-5d9315ec49c4122f6f23cf84cab5fc53  first.nut
-----------------
-./tests/data/a-mpeg4-rc.avi
-first.nut second.nut differ: char 34, line 1
-5d9315ec49c4122f6f23cf84cab5fc53  first.nut
-----------------
-./tests/data/a-mpeg4-thread.avi
-first.nut second.nut differ: char 34, line 1
-6aa94d589e9e7626e51575d8a2aec6e7  first.nut
-----------------
-./tests/data/a-msmpeg4.avi
-836d432509ff22fd363237ef1dced5f3  first.nut
-----------------
-./tests/data/a-msmpeg4v2.avi
-37f253da3666fb057edecb86ed2dba39  first.nut
-----------------
-./tests/data/a-odivx.mp4
-e3bd9d8a3417abc749c489e64119dbf3  first.nut
-----------------
-./tests/data/a-pcm_alaw.wav
-first.nut second.nut differ: char 34, line 1
-22853e7806b0f0162fd5e2573e34b03c  first.nut
-----------------
-./tests/data/a-pcm_f32be.au
-first.nut second.nut differ: char 34, line 1
-94cb60c3107ec509af79191e86099a0e  first.nut
-----------------
-./tests/data/a-pcm_f32le.wav
-first.nut second.nut differ: char 34, line 1
-8d887b27a8531390af5b682557631986  first.nut
-----------------
-./tests/data/a-pcm_f64be.au
-first.nut second.nut differ: char 34, line 1
-e0c7b64e13bb9398a57dac60806515fb  first.nut
-----------------
-./tests/data/a-pcm_f64le.wav
-first.nut second.nut differ: char 34, line 1
-9dbb9bda0c990502e910e082a008433f  first.nut
-----------------
-./tests/data/a-pcm_mulaw.wav
-first.nut second.nut differ: char 34, line 1
-78c4aae32fdddaba4f9caa5683018c94  first.nut
-----------------
-./tests/data/a-pcm_s16be.mkv
-first.nut second.nut differ: char 34, line 1
-279810a0c30a06c4ab7de154e3de140d  first.nut
-----------------
-./tests/data/a-pcm_s16be.mov
-first.nut second.nut differ: char 42, line 1
-0a8ede3d121f17a98e9038771eb98e1a  first.nut
-----------------
-./tests/data/a-pcm_s16le.mkv
-47942f5188f8d081bcbe7fb82550b135  first.nut
-----------------
-./tests/data/a-pcm_s16le.wav
-first.nut second.nut differ: char 34, line 1
-9f868acb99ba107750f165431f95c382  first.nut
-----------------
-./tests/data/a-pcm_s24be.mov
-first.nut second.nut differ: char 34, line 1
-9c96762f631851014dec14b506091cc1  first.nut
-----------------
-./tests/data/a-pcm_s24daud.302
-60ecb7037b205e2013490fdadab9697b  first.nut
-----------------
-./tests/data/a-pcm_s24le.wav
-first.nut second.nut differ: char 34, line 1
-5805a2e6e2eddede4757fd488d0d6adb  first.nut
-----------------
-./tests/data/a-pcm_s32be.mov
-first.nut second.nut differ: char 34, line 1
-d6c868a1130be573bbe0cfc88913a60c  first.nut
-----------------
-./tests/data/a-pcm_s32le.wav
-first.nut second.nut differ: char 34, line 1
-3e0a81669647739c490f12521f897527  first.nut
-----------------
-./tests/data/a-pcm_s8.mov
-first.nut second.nut differ: char 34, line 1
-a6fe0827966ee4515f27c7053d579229  first.nut
-----------------
-./tests/data/a-pcm_u8.wav
-first.nut second.nut differ: char 34, line 1
-f0d398fd651cdedfd7b4c5433c08fd79  first.nut
-----------------
-./tests/data/a-pcm_zork.wav
-first.nut second.nut differ: char 34, line 1
-69e40cc9266836a7101000677ee14a87  first.nut
-----------------
-./tests/data/a-roqav.roq
-first.nut second.nut differ: char 34, line 1
-0e7a57bb28054b7e319eac2ba0a4be23  first.nut
-----------------
-./tests/data/a-rv10.rm
-first.nut second.nut differ: char 34, line 1
-80f982c6bffea91ff45a9b320cb93c14  first.nut
-----------------
-./tests/data/a-rv20.rm
-first.nut second.nut differ: char 34, line 1
-5b02113c0941578ca6918215eed8a728  first.nut
-----------------
-./tests/data/a-snow.avi
-e73b88690aa491491ede5970641134ad  first.nut
-----------------
-./tests/data/a-snow53.avi
-18a6b061252c8c74bd22b42a7d5b2bae  first.nut
-----------------
-./tests/data/a-svq1.mov
-first.nut second.nut differ: char 197, line 1
-6bbe90d47c1763654e8388ce51ab911e  first.nut
-----------------
-./tests/data/a-wmav1.asf
-first.nut second.nut differ: char 34, line 1
-c3f7bc239ff166d738b29252b47bd437  first.nut
-----------------
-./tests/data/a-wmav2.asf
-first.nut second.nut differ: char 34, line 1
-930f1824b9677f0b6b714f1c6ddcf825  first.nut
-----------------
-./tests/data/a-wmv1.avi
-206bd9985b575f61a8a580656af39beb  first.nut
-----------------
-./tests/data/a-wmv2.avi
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-bgr24.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-gray.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-monob.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-monow.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-rgb24.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-rgb32.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-rgb555.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-rgb565.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuv410p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuv411p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuv420p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuv422p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuv440p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuv444p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuvj420p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuvj422p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuvj440p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuvj444p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf-yuyv422.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a  first.nut
-----------------
-./tests/data/b-lavf.aif
-first.nut second.nut differ: char 34, line 1
-3f1d3faae1671f1cf862ddb66a5c59d1  first.nut
-----------------
-./tests/data/b-lavf.al
-e6d4b977e74a535b039a6a1dfed2dbc1  first.nut
-----------------
-./tests/data/b-lavf.asf
-first.nut second.nut differ: char 34, line 1
-57727c41b3974697c0a79cfd08515ddd  first.nut
-----------------
-./tests/data/b-lavf.au
-first.nut second.nut differ: char 34, line 1
-1da12f41bc5ea1fd851e8a48b222c204  first.nut
-----------------
-./tests/data/b-lavf.avi
-a88edf9fb8e02e658ba3cae9313a3cdc  first.nut
-----------------
-./tests/data/b-lavf.dv
-first.nut second.nut differ: char 34, line 1
-819018a5d91c55312ffe784e8712ac4b  first.nut
-----------------
-./tests/data/b-lavf.ffm
-first.nut second.nut differ: char 34, line 1
-17f8894a05c71adb51c9a0ff1b9040bb  first.nut
-----------------
-./tests/data/b-lavf.flv
-d74edb56e74e0eea748863f3aeeafa61  first.nut
-----------------
-./tests/data/b-lavf.gif
-first.nut second.nut differ: char 34, line 1
-ef9ba6bf88f44d9d326049ef2872a4d3  first.nut
-----------------
-./tests/data/b-lavf.gxf
-first.nut second.nut differ: char 44, line 1
-522957f46ba46051fd03a0868c905e54  first.nut
-----------------
-./tests/data/b-lavf.mkv
-8c9427bb75c96210d6580d9b881d9e4d  first.nut
-----------------
-./tests/data/b-lavf.mmf
-first.nut second.nut differ: char 42, line 1
-298136aef02389fc5b0844995fe6ac72  first.nut
-----------------
-./tests/data/b-lavf.mov
-ce895b33ff206fafbae89fd5a8f959d2  first.nut
-----------------
-./tests/data/b-lavf.mpg
-d279e3343993267241c2fac4f4563cdb  first.nut
-----------------
-./tests/data/b-lavf.mxf
-first.nut second.nut differ: char 34, line 1
-3e98a90d40986b8ea4305be06175927a  first.nut
-----------------
-./tests/data/b-lavf.mxf_d10
-1ee69644165344a096ddfaaac951a0e9  first.nut
-----------------
-./tests/data/b-lavf.nut
-1426bca4c65796516a3e94b6bebc5a58  first.nut
-----------------
-./tests/data/b-lavf.ogg
-c986ce79045f2068ae1bedc2b8702884  first.nut
-----------------
-./tests/data/b-lavf.rm
-first.nut second.nut differ: char 34, line 1
-a3b2c9d3ec2c86b6d4c3bf0ed91391c3  first.nut
-----------------
-./tests/data/b-lavf.swf
-first.nut second.nut differ: char 34, line 1
-d4a5c5e6343dc17bed49397d889e0799  first.nut
-----------------
-./tests/data/b-lavf.ts
-40fd2ece0c8386d3a250943eab023795  first.nut
-----------------
-./tests/data/b-lavf.ul
-1c4c747e2e9c0fd195656359341eef76  first.nut
-----------------
-./tests/data/b-lavf.voc
-first.nut second.nut differ: char 42, line 1
-500ef42830c5bc2af849dbdcc4380f1b  first.nut
-----------------
-./tests/data/b-lavf.wav
-first.nut second.nut differ: char 42, line 1
-8d4c6a79af442610ad912625c9b85d02  first.nut
-----------------
-./tests/data/b-lavf.y4m
-f42a6ff4488de306925b057ecee75b0e  first.nut
-----------------
-./tests/data/b-lavf02.bmp
-first.nut second.nut differ: char 113, line 1
-02e3c782ef3a0c96e820201d4d4b8268  first.nut
-----------------
-./tests/data/b-lavf02.jpg
-61a19c3012a5aa056d8e9a589e29de2e  first.nut
-----------------
-./tests/data/b-lavf02.pcx
-first.nut second.nut differ: char 113, line 1
-3c4e1b9c8d5dd2bedb8eebd1edc7a2f5  first.nut
-----------------
-./tests/data/b-lavf02.pgm
-first.nut second.nut differ: char 113, line 1
-cc36bdadd7aef501a6d5d588dec2188b  first.nut
-----------------
-./tests/data/b-lavf02.ppm
-first.nut second.nut differ: char 113, line 1
-453ec690bea6c3668e2b65e0b7ad14c8  first.nut
-----------------
-./tests/data/b-lavf02.sgi
-first.nut second.nut differ: char 113, line 1
-6cdadd58aaa5ad196697352e96723e52  first.nut
-----------------
-./tests/data/b-lavf02.tga
-4144d2b4ee2948c1a16f7fc31b381be3  first.nut
-----------------
-./tests/data/b-lavf02.tiff
-first.nut second.nut differ: char 113, line 1
-237fa2da2d5f4930dae9825c9cf928a6  first.nut
-----------------
-./tests/data/b-pbmpipe.pbm
-first.nut second.nut differ: char 113, line 1
-2c65ef7188398da8a5f107b9dd5fb998  first.nut
-----------------
-./tests/data/b-pgmpipe.pgm
-first.nut second.nut differ: char 113, line 1
-b7e98248ada1e6f7170bc7fedee3825c  first.nut
-----------------
-./tests/data/b-ppmpipe.ppm
-first.nut second.nut differ: char 113, line 1
-869fcefe430c35a9a8e46fd5f040b62e  first.nut
diff --git a/tests/copycooker.sh b/tests/copycooker.sh
deleted file mode 100755
index 4b5811d..0000000
--- a/tests/copycooker.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-LC_ALL=C
-export LC_ALL
-
-datadir="tests/data"
-
-logfile="$datadir/copy.regression"
-reffile="$1"
-
-list=$(grep -oh ' ./tests/data/.*' tests/ref/{acodec,lavf,vsynth1}/*| sort)
-rm -f $logfile
-for i in $list ; do
-    echo ---------------- >> $logfile
-    echo $i >> $logfile
-    ./ffmpeg_g -flags +bitexact -i $i -acodec copy -vcodec copy -y first.nut
-    ./ffmpeg_g -flags +bitexact -i first.nut -acodec copy -vcodec copy -y second.nut
-    cmp first.nut second.nut >> $logfile
-    md5sum first.nut >> $logfile
-done
-
-if diff -u -w "$reffile" "$logfile" ; then
-    echo
-    echo copy regression test: success
-    exit 0
-else
-    echo
-    echo copy regression test: error
-    exit 1
-fi
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
deleted file mode 100755
index 899580f..0000000
--- a/tests/fate-run.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#! /bin/sh
-
-base=$(dirname $0)
-. "${base}/md5.sh"
-
-test="${1#fate-}"
-SAMPLES_PATH=$2
-target_exec=$3
-BUILD_PATH=$4
-command=$5
-
-ref="${base}/ref/fate/${test}"
-outdir="tests/data/fate"
-outfile="${outdir}/${test}"
-
-mkdir -p "$outdir"
-
-eval $target_exec $command > "$outfile" 2>/dev/null
-diff -u -w "$ref" "$outfile"
diff --git a/tests/fate-update.sh b/tests/fate-update.sh
deleted file mode 100755
index 92eaaf5..0000000
--- a/tests/fate-update.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-
-set -e
-
-base=$(dirname $0)
-ref="${base}/ref/fate"
-
-FATE_DB_URL="http://fate.multimedia.cx/fate-tests.sqlite.bz2"
-FATE_DB=$(mktemp fate-db.XXXXXX)
-SQL_TESTS='SELECT id,short_name,command FROM test_spec WHERE active=1 ORDER BY short_name'
-
-do_sql(){
-    sqlite3 -noheader -separator ' ' "$FATE_DB" "$@"
-}
-
-wget -q -O - "$FATE_DB_URL" | bunzip2 > "$FATE_DB"
-rm -rf "$ref"
-mkdir -p "$ref"
-exec 3>"$base/fate.mak"
-
-do_sql "$SQL_TESTS" | while read id name command; do
-    case "$name" in
-        00-full-regression|ffmpeg-help|binsize-*) continue ;;
-    esac
-    case "$command" in
-        {MD5}*) command="${command#\{MD5\}} | do_md5sum | cut -c-32" ;;
-        {*}*)   continue ;;
-    esac
-    command=$(echo "$command" | sed 's/\$/$$/g')
-    do_sql "SELECT expected_stdout FROM test_spec WHERE id=$id" | awk '/./{print}' > "$ref/$name"
-    printf "FATE_TESTS += fate-${name}\n" >&3
-    printf "fate-${name}: CMD = %s\n" "$command" >&3
-done
-
-exec 3<&-
-rm -f "$FATE_DB"
diff --git a/tests/fate.mak b/tests/fate.mak
deleted file mode 100644
index 933dec6..0000000
--- a/tests/fate.mak
+++ /dev/null
@@ -1,694 +0,0 @@
-FATE_TESTS += fate-4xm
-fate-4xm: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/4xm/TimeGatep01s01n01a02_2.4xm -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-8bps
-fate-8bps: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/8bps/full9iron-partial.mov -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-aac-demux
-fate-aac-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/aac/ct_faac-adts.aac -acodec copy -f crc -
-FATE_TESTS += fate-aasc
-fate-aasc: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/aasc/AASC-1.5MB.AVI -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-adpcm-ea-r2
-fate-adpcm-ea-r2: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-mpc/THX_logo.mpc -vn -f crc -
-FATE_TESTS += fate-adpcm-ea-r3
-fate-adpcm-ea-r3: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-vp6/THX_logo.vp6 -vn -f crc -
-FATE_TESTS += fate-aea-demux
-fate-aea-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/aea/chirp.aea -acodec copy -f crc -
-FATE_TESTS += fate-alg-mm
-fate-alg-mm: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/alg-mm/ibmlogo.mm -an -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-amv
-fate-amv: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/amv/MTV_high_res_320x240_sample_Penguin_Joke_MTV_from_WMV.amv -t 10 -f framecrc -
-FATE_TESTS += fate-armovie-escape124
-fate-armovie-escape124: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/rpl/ESCAPE.RPL -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-auravision
-fate-auravision: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/auravision/SOUVIDEO.AVI -an -f framecrc -
-FATE_TESTS += fate-auravision-v2
-fate-auravision-v2: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/auravision/salma-hayek-in-ugly-betty-partial-avi -an -f framecrc -
-FATE_TESTS += fate-bethsoft-vid
-fate-bethsoft-vid: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/bethsoft-vid/ANIM0001.VID -vsync 0 -t 5 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-bfi
-fate-bfi: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/bfi/2287.bfi -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-bink-demux
-fate-bink-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/bink/Snd0a7d9b58.dee -vn -acodec copy -f crc -
-FATE_TESTS += fate-bink-demux-video
-fate-bink-demux-video: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/bink/hol2br.bik -f framecrc -
-FATE_TESTS += fate-caf
-fate-caf: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/caf/caf-pcm16.caf -f crc -
-FATE_TESTS += fate-cdgraphics
-fate-cdgraphics: CMD = $$BUILD_PATH/ffmpeg -t 1 -i $$SAMPLES_PATH/cdgraphics/BrotherJohn.cdg -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-cljr
-fate-cljr: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cljr/testcljr-partial.avi -f framecrc -
-FATE_TESTS += fate-corepng
-fate-corepng: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/png1/corepng-partial.avi -f framecrc -
-FATE_TESTS += fate-creative-adpcm
-fate-creative-adpcm: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/creative/intro-partial.wav -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-creative-adpcm-8-2.6bit
-fate-creative-adpcm-8-2.6bit: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/creative/BBC_3BIT.VOC -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-creative-adpcm-8-2bit
-fate-creative-adpcm-8-2bit: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/creative/BBC_2BIT.VOC -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-creative-adpcm-8-4bit
-fate-creative-adpcm-8-4bit: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/creative/BBC_4BIT.VOC -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-creatureshock-avs
-fate-creatureshock-avs: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/creatureshock-avs/OUTATIME.AVS -pix_fmt rgb24  -f framecrc -
-FATE_TESTS += fate-cryo-apc
-fate-cryo-apc: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cryo-apc/cine007.APC -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-cscd
-fate-cscd: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/CSCD/sample_video.avi -an -vsync 0 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-cvid
-fate-cvid: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cvid/laracroft-cinepak-partial.avi -an -f framecrc -
-FATE_TESTS += fate-cvid-palette
-fate-cvid-palette: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cvid/catfight-cvid-pal8-partial.mov -pix_fmt rgb24 -an -f framecrc -
-FATE_TESTS += fate-cyberia-c93
-fate-cyberia-c93: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cyberia-c93/intro1.c93 -t 3 -pix_fmt rgb24  -f framecrc -
-FATE_TESTS += fate-cyuv
-fate-cyuv: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cyuv/cyuv.avi -f framecrc -
-FATE_TESTS += fate-d-cinema-demux
-fate-d-cinema-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/d-cinema/THX_Science_FLT_1920-partial.302 -acodec copy -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-delphine-cin
-fate-delphine-cin: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/delphine-cin/LOGO-partial.CIN -pix_fmt rgb24 -vsync 0 -f framecrc -
-FATE_TESTS += fate-deluxepaint-anm
-fate-deluxepaint-anm: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/deluxepaint-anm/INTRO1.ANM -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-dpx
-fate-dpx: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/dpx/lighthouse_rgb48.dpx -f framecrc -
-FATE_TESTS += fate-duck-dk3
-fate-duck-dk3: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/duck/sop-audio-only.avi -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-duck-dk4
-fate-duck-dk4: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/duck/salsa-audio-only.avi -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-duck-tm2
-fate-duck-tm2: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/duck/tm20.avi -f framecrc -
-FATE_TESTS += fate-ea-cdata
-fate-ea-cdata: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-cdata/166b084d.46410f77.0009b440.24be960c.cdata -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-ea-cmv
-fate-ea-cmv: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-cmv/TITLE.CMV -vsync 0 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-ea-dct
-fate-ea-dct: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/ea-dct/NFS2Esprit-partial.dct -f framecrc -
-FATE_TESTS += fate-ea-mad-adpcm-ea-r1
-fate-ea-mad-adpcm-ea-r1: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-mad/NFS6LogoE.mad -f framecrc -
-FATE_TESTS += fate-ea-mad-pcm-planar
-fate-ea-mad-pcm-planar: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-mad/xeasport.mad -f framecrc -
-FATE_TESTS += fate-ea-tgq
-fate-ea-tgq: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-tgq/v27.tgq -an -f framecrc -
-FATE_TESTS += fate-ea-tgv-ima-ea-eacs
-fate-ea-tgv-ima-ea-eacs: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-tgv/INTRO8K-partial.TGV -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-ea-tgv-ima-ea-sead
-fate-ea-tgv-ima-ea-sead: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-tgv/INTEL_S.TGV -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-ea-tqi-adpcm
-fate-ea-tqi-adpcm: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-wve/networkBackbone-partial.wve -f framecrc -
-FATE_TESTS += fate-ea-vp60
-fate-ea-vp60: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-vp6/g36.vp6 -f framecrc -
-FATE_TESTS += fate-ea-vp61
-fate-ea-vp61: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ea-vp6/MovieSkirmishGondor.vp6 -t 4 -f framecrc -
-FATE_TESTS += fate-feeble-dxa
-fate-feeble-dxa: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/dxa/meetsquid.dxa -t 2 -pix_fmt rgb24  -f framecrc -
-FATE_TESTS += fate-film-cvid-pcm-stereo-8bit
-fate-film-cvid-pcm-stereo-8bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/film/logo-capcom.cpk -f framecrc -
-FATE_TESTS += fate-flic-af11-palette-change
-fate-flic-af11-palette-change: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fli/fli-engines.fli -t 3.3 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-flic-af12
-fate-flic-af12: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fli/jj00c2.fli -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-flic-magiccarpet
-fate-flic-magiccarpet: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fli/intel.dat -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-fraps-v0
-fate-fraps-v0: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fraps/Griffin_Ragdoll01-partial.avi -f framecrc -
-FATE_TESTS += fate-fraps-v1
-fate-fraps-v1: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fraps/sample-v1.avi -an -f framecrc -
-FATE_TESTS += fate-fraps-v2
-fate-fraps-v2: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fraps/test3-nosound-partial.avi -f framecrc -
-FATE_TESTS += fate-fraps-v3
-fate-fraps-v3: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fraps/psclient-partial.avi -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-fraps-v4
-fate-fraps-v4: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fraps/WoW_2006-11-03_14-58-17-19-nosound-partial.avi -f framecrc -
-FATE_TESTS += fate-fraps-v5
-fate-fraps-v5: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/fraps/fraps-v5-bouncing-balls-partial.avi -f framecrc -
-FATE_TESTS += fate-frwu
-fate-frwu: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/frwu/frwu.avi -f framecrc -
-FATE_TESTS += fate-funcom-iss
-fate-funcom-iss: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/funcom-iss/0004010100.iss -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-h264-conformance-aud_mw_e
-fate-h264-conformance-aud_mw_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/AUD_MW_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-ba1_ft_c
-fate-h264-conformance-ba1_ft_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BA1_FT_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-ba1_sony_d
-fate-h264-conformance-ba1_sony_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BA1_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-ba2_sony_f
-fate-h264-conformance-ba2_sony_f: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BA2_Sony_F.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-ba3_sva_c
-fate-h264-conformance-ba3_sva_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/BA3_SVA_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-ba_mw_d
-fate-h264-conformance-ba_mw_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BA_MW_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-bamq1_jvc_c
-fate-h264-conformance-bamq1_jvc_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BAMQ1_JVC_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-bamq2_jvc_c
-fate-h264-conformance-bamq2_jvc_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BAMQ2_JVC_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-banm_mw_d
-fate-h264-conformance-banm_mw_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BANM_MW_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-basqp1_sony_c
-fate-h264-conformance-basqp1_sony_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/BASQP1_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-caba1_sony_d
-fate-h264-conformance-caba1_sony_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CABA1_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-caba1_sva_b
-fate-h264-conformance-caba1_sva_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CABA1_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-caba2_sony_e
-fate-h264-conformance-caba2_sony_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CABA2_Sony_E.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-caba2_sva_b
-fate-h264-conformance-caba2_sva_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CABA2_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-caba3_sony_c
-fate-h264-conformance-caba3_sony_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CABA3_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-caba3_sva_b
-fate-h264-conformance-caba3_sva_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CABA3_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-caba3_toshiba_e
-fate-h264-conformance-caba3_toshiba_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CABA3_TOSHIBA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabac_mot_fld0_full
-fate-h264-conformance-cabac_mot_fld0_full: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/camp_mot_fld0_full.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabac_mot_frm0_full
-fate-h264-conformance-cabac_mot_frm0_full: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/camp_mot_frm0_full.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabac_mot_mbaff0_full
-fate-h264-conformance-cabac_mot_mbaff0_full: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/camp_mot_mbaff0_full.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabac_mot_picaff0_full
-fate-h264-conformance-cabac_mot_picaff0_full: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/camp_mot_picaff0_full.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabaci3_sony_b
-fate-h264-conformance-cabaci3_sony_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CABACI3_Sony_B.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabast3_sony_e
-fate-h264-conformance-cabast3_sony_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CABAST3_Sony_E.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabastbr3_sony_b
-fate-h264-conformance-cabastbr3_sony_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CABASTBR3_Sony_B.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cabref3_sand_d
-fate-h264-conformance-cabref3_sand_d: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CABREF3_Sand_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cacqp3_sony_d
-fate-h264-conformance-cacqp3_sony_d: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CACQP3_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cafi1_sva_c
-fate-h264-conformance-cafi1_sva_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAFI1_SVA_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cama1_sony_c
-fate-h264-conformance-cama1_sony_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CAMA1_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cama1_toshiba_b
-fate-h264-conformance-cama1_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMA1_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cama1_vtc_c
-fate-h264-conformance-cama1_vtc_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/cama1_vtc_c.avc -f framecrc -
-FATE_TESTS += fate-h264-conformance-cama2_vtc_b
-fate-h264-conformance-cama2_vtc_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -i $$SAMPLES_PATH/h264-conformance/cama2_vtc_b.avc -f framecrc -
-FATE_TESTS += fate-h264-conformance-cama3_sand_e
-fate-h264-conformance-cama3_sand_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMA3_Sand_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cama3_vtc_b
-fate-h264-conformance-cama3_vtc_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/cama3_vtc_b.avc -f framecrc -
-FATE_TESTS += fate-h264-conformance-camaci3_sony_c
-fate-h264-conformance-camaci3_sony_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMACI3_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-camanl1_toshiba_b
-fate-h264-conformance-camanl1_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMANL1_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-camanl2_toshiba_b
-fate-h264-conformance-camanl2_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMANL2_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-camanl3_sand_e
-fate-h264-conformance-camanl3_sand_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMANL3_Sand_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-camasl3_sony_b
-fate-h264-conformance-camasl3_sony_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMASL3_Sony_B.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-camp_mot_mbaff_l30
-fate-h264-conformance-camp_mot_mbaff_l30: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMP_MOT_MBAFF_L30.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-camp_mot_mbaff_l31
-fate-h264-conformance-camp_mot_mbaff_l31: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAMP_MOT_MBAFF_L31.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl1_sony_e
-fate-h264-conformance-canl1_sony_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANL1_Sony_E.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl1_sva_b
-fate-h264-conformance-canl1_sva_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANL1_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl1_toshiba_g
-fate-h264-conformance-canl1_toshiba_g: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANL1_TOSHIBA_G.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl2_sony_e
-fate-h264-conformance-canl2_sony_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANL2_Sony_E.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl2_sva_b
-fate-h264-conformance-canl2_sva_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANL2_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl3_sony_c
-fate-h264-conformance-canl3_sony_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CANL3_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl3_sva_b
-fate-h264-conformance-canl3_sva_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANL3_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-canl4_sva_b
-fate-h264-conformance-canl4_sva_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANL4_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-canlma2_sony_c
-fate-h264-conformance-canlma2_sony_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANLMA2_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-canlma3_sony_c
-fate-h264-conformance-canlma3_sony_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CANLMA3_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-capa1_toshiba_b
-fate-h264-conformance-capa1_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAPA1_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-capama3_sand_f
-fate-h264-conformance-capama3_sand_f: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAPAMA3_Sand_F.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-capcm1_sand_e
-fate-h264-conformance-capcm1_sand_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CAPCM1_Sand_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-capcmnl1_sand_e
-fate-h264-conformance-capcmnl1_sand_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CAPCMNL1_Sand_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-capm3_sony_d
-fate-h264-conformance-capm3_sony_d: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAPM3_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-caqp1_sony_b
-fate-h264-conformance-caqp1_sony_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CAQP1_Sony_B.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cavlc_mot_fld0_full_b
-fate-h264-conformance-cavlc_mot_fld0_full_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/cvmp_mot_fld0_full_B.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cavlc_mot_frm0_full_b
-fate-h264-conformance-cavlc_mot_frm0_full_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/cvmp_mot_frm0_full_B.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cavlc_mot_mbaff0_full_b
-fate-h264-conformance-cavlc_mot_mbaff0_full_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/cvmp_mot_mbaff0_full_B.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cavlc_mot_picaff0_full_b
-fate-h264-conformance-cavlc_mot_picaff0_full_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/cvmp_mot_picaff0_full_B.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cawp1_toshiba_e
-fate-h264-conformance-cawp1_toshiba_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CAWP1_TOSHIBA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cawp5_toshiba_e
-fate-h264-conformance-cawp5_toshiba_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CAWP5_TOSHIBA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-ci1_ft_b
-fate-h264-conformance-ci1_ft_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CI1_FT_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-ci_mw_d
-fate-h264-conformance-ci_mw_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CI_MW_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvbs3_sony_c
-fate-h264-conformance-cvbs3_sony_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVBS3_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvcanlma2_sony_c
-fate-h264-conformance-cvcanlma2_sony_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CVCANLMA2_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvfi1_sony_d
-fate-h264-conformance-cvfi1_sony_d: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVFI1_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvfi1_sva_c
-fate-h264-conformance-cvfi1_sva_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVFI1_SVA_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvfi2_sony_h
-fate-h264-conformance-cvfi2_sony_h: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVFI2_Sony_H.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvfi2_sva_c
-fate-h264-conformance-cvfi2_sva_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVFI2_SVA_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvma1_sony_d
-fate-h264-conformance-cvma1_sony_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CVMA1_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvma1_toshiba_b
-fate-h264-conformance-cvma1_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMA1_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvmanl1_toshiba_b
-fate-h264-conformance-cvmanl1_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMANL1_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvmanl2_toshiba_b
-fate-h264-conformance-cvmanl2_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMANL2_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvmapaqp3_sony_e
-fate-h264-conformance-cvmapaqp3_sony_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMAPAQP3_Sony_E.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvmaqp2_sony_g
-fate-h264-conformance-cvmaqp2_sony_g: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMAQP2_Sony_G.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvmaqp3_sony_d
-fate-h264-conformance-cvmaqp3_sony_d: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMAQP3_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvmp_mot_fld_l30_b
-fate-h264-conformance-cvmp_mot_fld_l30_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMP_MOT_FLD_L30_B.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvmp_mot_frm_l31_b
-fate-h264-conformance-cvmp_mot_frm_l31_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVMP_MOT_FRM_L31_B.26l -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvnlfi1_sony_c
-fate-h264-conformance-cvnlfi1_sony_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -i $$SAMPLES_PATH/h264-conformance/CVNLFI1_Sony_C.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvnlfi2_sony_h
-fate-h264-conformance-cvnlfi2_sony_h: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVNLFI2_Sony_H.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvpa1_toshiba_b
-fate-h264-conformance-cvpa1_toshiba_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVPA1_TOSHIBA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvpcmnl1_sva_c
-fate-h264-conformance-cvpcmnl1_sva_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CVPCMNL1_SVA_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvpcmnl2_sva_c
-fate-h264-conformance-cvpcmnl2_sva_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CVPCMNL2_SVA_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvwp1_toshiba_e
-fate-h264-conformance-cvwp1_toshiba_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/CVWP1_TOSHIBA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvwp2_toshiba_e
-fate-h264-conformance-cvwp2_toshiba_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVWP2_TOSHIBA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvwp3_toshiba_e
-fate-h264-conformance-cvwp3_toshiba_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVWP3_TOSHIBA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-cvwp5_toshiba_e
-fate-h264-conformance-cvwp5_toshiba_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/CVWP5_TOSHIBA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-fi1_sony_e
-fate-h264-conformance-fi1_sony_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -i $$SAMPLES_PATH/h264-conformance/FI1_Sony_E.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-alphaconformanceg
-fate-h264-conformance-frext-alphaconformanceg: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/test8b43.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-bcrm_freh10
-fate-h264-conformance-frext-bcrm_freh10: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh10.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-brcm_freh11
-fate-h264-conformance-frext-brcm_freh11: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh11.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-brcm_freh3
-fate-h264-conformance-frext-brcm_freh3: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh3.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-brcm_freh4
-fate-h264-conformance-frext-brcm_freh4: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh4.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-brcm_freh5
-fate-h264-conformance-frext-brcm_freh5: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh5.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-brcm_freh8
-fate-h264-conformance-frext-brcm_freh8: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh8.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-brcm_freh9
-fate-h264-conformance-frext-brcm_freh9: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh9.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-freh12_b
-fate-h264-conformance-frext-freh12_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/Freh12_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-freh1_b
-fate-h264-conformance-frext-freh1_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/Freh1_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-freh2_b
-fate-h264-conformance-frext-freh2_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/Freh2_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-freh6
-fate-h264-conformance-frext-freh6: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/freh6.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-freh7_b
-fate-h264-conformance-frext-freh7_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/Freh7_B.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-frext01_jvc_d
-fate-h264-conformance-frext-frext01_jvc_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/FREXT01_JVC_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-frext02_jvc_c
-fate-h264-conformance-frext-frext02_jvc_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/FREXT02_JVC_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-frext1_panasonic_c
-fate-h264-conformance-frext-frext1_panasonic_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/FRExt1_Panasonic.avc -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-frext2_panasonic_b
-fate-h264-conformance-frext-frext2_panasonic_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/FRExt2_Panasonic.avc -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-frext3_panasonic_d
-fate-h264-conformance-frext-frext3_panasonic_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/FRExt3_Panasonic.avc -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-frext4_panasonic_a
-fate-h264-conformance-frext-frext4_panasonic_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/FRExt4_Panasonic.avc -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-frext_mmco4_sony_b
-fate-h264-conformance-frext-frext_mmco4_sony_b: CMD = $$BUILD_PATH/ffmpeg -strict 1 -i $$SAMPLES_PATH/h264-conformance/FRext/FRExt_MMCO4_Sony_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hcaff1_hhi_b
-fate-h264-conformance-frext-hcaff1_hhi_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HCAFF1_HHI.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hcafr1_hhi_c
-fate-h264-conformance-frext-hcafr1_hhi_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HCAFR1_HHI.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hcafr2_hhi_a
-fate-h264-conformance-frext-hcafr2_hhi_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HCAFR2_HHI.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hcafr3_hhi_a
-fate-h264-conformance-frext-hcafr3_hhi_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HCAFR3_HHI.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hcafr4_hhi_a
-fate-h264-conformance-frext-hcafr4_hhi_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HCAFR4_HHI.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hcamff1_hhi_b
-fate-h264-conformance-frext-hcamff1_hhi_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HCAMFF1_HHI.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpca_brcm_c
-fate-h264-conformance-frext-hpca_brcm_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCA_BRCM_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcadq_brcm_b
-fate-h264-conformance-frext-hpcadq_brcm_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCADQ_BRCM_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcafl_bcrm_c
-fate-h264-conformance-frext-hpcafl_bcrm_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCAFL_BRCM_C.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcaflnl_bcrm_c
-fate-h264-conformance-frext-hpcaflnl_bcrm_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCAFLNL_BRCM_C.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcalq_brcm_b
-fate-h264-conformance-frext-hpcalq_brcm_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCALQ_BRCM_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcamapalq_bcrm_b
-fate-h264-conformance-frext-hpcamapalq_bcrm_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCAMAPALQ_BRCM_B.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcamolq_brcm_b
-fate-h264-conformance-frext-hpcamolq_brcm_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCAMOLQ_BRCM_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcanl_brcm_c
-fate-h264-conformance-frext-hpcanl_brcm_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCANL_BRCM_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcaq2lq_brcm_b
-fate-h264-conformance-frext-hpcaq2lq_brcm_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCAQ2LQ_BRCM_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcv_brcm_a
-fate-h264-conformance-frext-hpcv_brcm_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCV_BRCM_A.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcvfl_bcrm_a
-fate-h264-conformance-frext-hpcvfl_bcrm_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCVFL_BRCM_A.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcvflnl_bcrm_a
-fate-h264-conformance-frext-hpcvflnl_bcrm_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCVFLNL_BRCM_A.264 -vsync 0 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcvmolq_brcm_b
-fate-h264-conformance-frext-hpcvmolq_brcm_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCVMOLQ_BRCM_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-frext-hpcvnl_brcm_a
-fate-h264-conformance-frext-hpcvnl_brcm_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/FRext/HPCVNL_BRCM_A.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-hcbp2_hhi_a
-fate-h264-conformance-hcbp2_hhi_a: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/HCBP2_HHI_A.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-hcmp1_hhi_a
-fate-h264-conformance-hcmp1_hhi_a: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/HCMP1_HHI_A.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-ls_sva_d
-fate-h264-conformance-ls_sva_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/LS_SVA_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-midr_mw_d
-fate-h264-conformance-midr_mw_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/MIDR_MW_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mps_mw_a
-fate-h264-conformance-mps_mw_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/MPS_MW_A.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr1_bt_a
-fate-h264-conformance-mr1_bt_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/MR1_BT_A.h264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr1_mw_a
-fate-h264-conformance-mr1_mw_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/MR1_MW_A.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr2_mw_a
-fate-h264-conformance-mr2_mw_a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/MR2_MW_A.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr2_tandberg_e
-fate-h264-conformance-mr2_tandberg_e: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR2_TANDBERG_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr3_tandberg_b
-fate-h264-conformance-mr3_tandberg_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR3_TANDBERG_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr4_tandberg_c
-fate-h264-conformance-mr4_tandberg_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR4_TANDBERG_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr5_tandberg_c
-fate-h264-conformance-mr5_tandberg_c: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR5_TANDBERG_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr6_bt_b
-fate-h264-conformance-mr6_bt_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR6_BT_B.h264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr7_bt_b
-fate-h264-conformance-mr7_bt_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR7_BT_B.h264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr8_bt_b
-fate-h264-conformance-mr8_bt_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR8_BT_B.h264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mr9_bt_b
-fate-h264-conformance-mr9_bt_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/MR9_BT_B.h264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-mv1_brcm_d
-fate-h264-conformance-mv1_brcm_d: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/src19td.IBP.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-nl1_sony_d
-fate-h264-conformance-nl1_sony_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/NL1_Sony_D.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-nl2_sony_h
-fate-h264-conformance-nl2_sony_h: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/NL2_Sony_H.jsv -f framecrc -
-FATE_TESTS += fate-h264-conformance-nl3_sva_e
-fate-h264-conformance-nl3_sva_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/NL3_SVA_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-nlmq1_jvc_c
-fate-h264-conformance-nlmq1_jvc_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/NLMQ1_JVC_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-nlmq2_jvc_c
-fate-h264-conformance-nlmq2_jvc_c: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/NLMQ2_JVC_C.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-nrf_mw_e
-fate-h264-conformance-nrf_mw_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/NRF_MW_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sharp_mp_field_1_b
-fate-h264-conformance-sharp_mp_field_1_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -i $$SAMPLES_PATH/h264-conformance/Sharp_MP_Field_1_B.jvt -f framecrc -
-FATE_TESTS += fate-h264-conformance-sharp_mp_field_2_b
-fate-h264-conformance-sharp_mp_field_2_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -i $$SAMPLES_PATH/h264-conformance/Sharp_MP_Field_2_B.jvt -f framecrc -
-FATE_TESTS += fate-h264-conformance-sharp_mp_field_3_b
-fate-h264-conformance-sharp_mp_field_3_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -i $$SAMPLES_PATH/h264-conformance/Sharp_MP_Field_3_B.jvt -f framecrc -
-FATE_TESTS += fate-h264-conformance-sharp_mp_paff_1r2
-fate-h264-conformance-sharp_mp_paff_1r2: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/Sharp_MP_PAFF_1r2.jvt -f framecrc -
-FATE_TESTS += fate-h264-conformance-sharp_mp_paff_2r
-fate-h264-conformance-sharp_mp_paff_2r: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/Sharp_MP_PAFF_2.jvt -f framecrc -
-FATE_TESTS += fate-h264-conformance-sl1_sva_b
-fate-h264-conformance-sl1_sva_b: CMD = $$BUILD_PATH/ffmpeg -vsync 0 -strict 1 -i $$SAMPLES_PATH/h264-conformance/SL1_SVA_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sva_ba1_b
-fate-h264-conformance-sva_ba1_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/SVA_BA1_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sva_ba2_d
-fate-h264-conformance-sva_ba2_d: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/SVA_BA2_D.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sva_base_b
-fate-h264-conformance-sva_base_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/SVA_Base_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sva_cl1_e
-fate-h264-conformance-sva_cl1_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/SVA_CL1_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sva_fm1_e
-fate-h264-conformance-sva_fm1_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/SVA_FM1_E.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sva_nl1_b
-fate-h264-conformance-sva_nl1_b: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/SVA_NL1_B.264 -f framecrc -
-FATE_TESTS += fate-h264-conformance-sva_nl2_e
-fate-h264-conformance-sva_nl2_e: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/h264-conformance/SVA_NL2_E.264 -f framecrc -
-FATE_TESTS += fate-id-cin-video
-fate-id-cin-video: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/idcin/idlog-2MB.cin -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-idroq-video-dpcm
-fate-idroq-video-dpcm: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/idroq/idlogo.roq -f framecrc -
-FATE_TESTS += fate-idroq-video-encode
-fate-idroq-video-encode: CMD =  $$BUILD_PATH/ffmpeg -t 0.2 -f image2 -vcodec pgmyuv -i $$SAMPLES_PATH/ffmpeg-synthetic/vsynth1/%02d.pgm -sws_flags +bitexact -padleft 80 -padright 80 -padtop 112 -padbottom 112 -f RoQ - | do_md5sum | cut -c-32
-FATE_TESTS += fate-iff-byterun1
-fate-iff-byterun1: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/iff/ASH.LBM -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-iff-fibonacci
-fate-iff-fibonacci: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/iff/dasboot-in-compressed -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-iff-ilbm
-fate-iff-ilbm: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/iff/lms-matriks.ilbm -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-iff-pcm
-fate-iff-pcm: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/iff/Bells -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-indeo2
-fate-indeo2: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/rt21/VPAR0026.AVI -f framecrc -
-FATE_TESTS += fate-indeo3
-fate-indeo3: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/iv32/cubes.mov -f framecrc -
-FATE_TESTS += fate-indeo5
-fate-indeo5: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/iv50/Educ_Movie_DeadlyForce.avi -an -f framecrc -
-FATE_TESTS += fate-interplay-mve-16bit
-fate-interplay-mve-16bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/interplay-mve/descent3-level5-16bit-partial.mve -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-interplay-mve-8bit
-fate-interplay-mve-8bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/interplay-mve/interplay-logo-2MB.mve -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-iv8-demux
-fate-iv8-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/iv8/zzz-partial.mpg -vsync 0 -vcodec copy -f framecrc -
-FATE_TESTS += fate-kmvc
-fate-kmvc: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/KMVC/LOGO1.AVI -an -t 3 -pix_fmt rgb24  -f framecrc -
-FATE_TESTS += fate-lmlm4-demux
-fate-lmlm4-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lmlm4/LMLM4_CIFat30fps.divx -t 3 -acodec copy -vcodec copy -f framecrc -
-FATE_TESTS += fate-loco-rgb
-fate-loco-rgb: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/loco/pig-loco-rgb.avi -f framecrc -
-FATE_TESTS += fate-loco-yuy2
-fate-loco-yuy2: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/loco/pig-loco-0.avi -f framecrc -
-FATE_TESTS += fate-lossless-appleaudio
-fate-lossless-appleaudio: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/inside.m4a -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-lossless-meridianaudio
-fate-lossless-meridianaudio: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/luckynight-partial.mlp -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-lossless-monkeysaudio
-fate-lossless-monkeysaudio: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/luckynight-partial.ape -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-lossless-shortenaudio
-fate-lossless-shortenaudio: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/luckynight-partial.shn -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-lossless-tta
-fate-lossless-tta: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/inside.tta -f crc -
-FATE_TESTS += fate-lossless-wavpackaudio
-fate-lossless-wavpackaudio: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/luckynight-partial.wv -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-maxis-xa
-fate-maxis-xa: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/maxis-xa/SC2KBUG.XA -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-mimic
-fate-mimic: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/mimic/mimic2-womanloveffmpeg.cam -vsync 0 -f framecrc -
-FATE_TESTS += fate-motionpixels
-fate-motionpixels: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/motion-pixels/INTRO-partial.MVI -an -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-mpc7-demux
-fate-mpc7-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/musepack/inside-mp7.mpc -acodec copy -f crc -
-FATE_TESTS += fate-mpc8-demux
-fate-mpc8-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/musepack/inside-mp8.mpc -acodec copy -f crc -
-FATE_TESTS += fate-mpeg4-als-conformance-00
-fate-mpeg4-als-conformance-00: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/als_00_2ch48k16b.mp4 -f crc -
-FATE_TESTS += fate-mpeg4-als-conformance-01
-fate-mpeg4-als-conformance-01: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/als_01_2ch48k16b.mp4 -f crc -
-FATE_TESTS += fate-mpeg4-als-conformance-02
-fate-mpeg4-als-conformance-02: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/als_02_2ch48k16b.mp4 -f crc -
-FATE_TESTS += fate-mpeg4-als-conformance-03
-fate-mpeg4-als-conformance-03: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/als_03_2ch48k16b.mp4 -f crc -
-FATE_TESTS += fate-mpeg4-als-conformance-04
-fate-mpeg4-als-conformance-04: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/als_04_2ch48k16b.mp4 -f crc -
-FATE_TESTS += fate-mpeg4-als-conformance-05
-fate-mpeg4-als-conformance-05: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lossless-audio/als_05_2ch48k16b.mp4 -f crc -
-FATE_TESTS += fate-msrle-8bit
-fate-msrle-8bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/msrle/Search-RLE.avi -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-msvideo1-16bit
-fate-msvideo1-16bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cram/clock-cram16.avi -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-msvideo1-8bit
-fate-msvideo1-8bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/cram/skating.avi -t 1 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-mszh
-fate-mszh: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lcl/mszh-1frame.avi -f framecrc -
-FATE_TESTS += fate-mtv
-fate-mtv: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/mtv/comedian_auto-partial.mtv -acodec copy -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-mxf-demux
-fate-mxf-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/mxf/C0023S01.mxf -acodec copy -vcodec copy -f framecrc -
-FATE_TESTS += fate-nc-demux
-fate-nc-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/nc-camera/nc-sample-partial -vcodec copy -f framecrc -
-FATE_TESTS += fate-nsv-demux
-fate-nsv-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/nsv/witchblade-51kbps.nsv -t 6 -vcodec copy -acodec copy -f framecrc -
-FATE_TESTS += fate-nuv
-fate-nuv: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/nuv/Today.nuv -f framecrc -
-FATE_TESTS += fate-oma-demux
-fate-oma-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/oma/01-Untitled-partial.oma -acodec copy -f crc -
-FATE_TESTS += fate-pcm_dvd
-fate-pcm_dvd: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/pcm-dvd/coolitnow-partial.vob -vn -f framecrc -
-FATE_TESTS += fate-psx-str
-fate-psx-str: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/psx-str/descent-partial.str -f framecrc -
-FATE_TESTS += fate-ptx
-fate-ptx: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ptx/_113kw_pic.ptx -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-pva-demux
-fate-pva-demux: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/pva/PVA_test-partial.pva -t 0.6 -acodec copy -f framecrc -
-FATE_TESTS += fate-qcp-demux
-fate-qcp-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qcp/0036580847.QCP -acodec copy -f crc -
-FATE_TESTS += fate-qpeg
-fate-qpeg: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qpeg/Clock.avi -an -pix_fmt rgb24  -f framecrc -
-FATE_TESTS += fate-qt-alaw-mono
-fate-qt-alaw-mono: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-1-16-B-alaw.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-alaw-stereo
-fate-qt-alaw-stereo: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-16-B-alaw.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-ima4-mono
-fate-qt-ima4-mono: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-1-16-B-ima4.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-ima4-stereo
-fate-qt-ima4-stereo: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-16-B-ima4.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-mac3-mono
-fate-qt-mac3-mono: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-1-8-MAC3.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-mac3-stereo
-fate-qt-mac3-stereo: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-8-MAC3.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-mac6-mono
-fate-qt-mac6-mono: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-1-8-MAC6.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-mac6-stereo
-fate-qt-mac6-stereo: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-8-MAC6.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-msadpcm-stereo
-fate-qt-msadpcm-stereo: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-16-L-ms02.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-msimaadpcm-stereo
-fate-qt-msimaadpcm-stereo: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-16-L-ms11.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-rawpcm-16bit-stereo-signed-be
-fate-qt-rawpcm-16bit-stereo-signed-be: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-16-B-twos.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-rawpcm-16bit-stereo-signed-le
-fate-qt-rawpcm-16bit-stereo-signed-le: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-16-L-sowt.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-rawpcm-8bit-mono-unsigned
-fate-qt-rawpcm-8bit-mono-unsigned: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-1-8-raw.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-rawpcm-8bit-stereo-unsigned
-fate-qt-rawpcm-8bit-stereo-unsigned: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-8-raw.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-ulaw-mono
-fate-qt-ulaw-mono: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-1-16-B-ulaw.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qt-ulaw-stereo
-fate-qt-ulaw-stereo: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qt-surge-suite/surge-2-16-B-ulaw.mov -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-qtrle-16bit
-fate-qtrle-16bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qtrle/mr-cork-rle.mov -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-qtrle-1bit
-fate-qtrle-1bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qtrle/Animation-Monochrome.mov -f framecrc -
-FATE_TESTS += fate-qtrle-24bit
-fate-qtrle-24bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qtrle/aletrek-rle.mov -vsync 0 -f framecrc -
-FATE_TESTS += fate-qtrle-2bit
-fate-qtrle-2bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qtrle/Animation-4Greys.mov -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-qtrle-32bit
-fate-qtrle-32bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qtrle/ultra_demo_720_480_32bpp_rle.mov -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-qtrle-4bit
-fate-qtrle-4bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qtrle/Animation-16Greys.mov -pix_fmt rgb24 -an -f framecrc -
-FATE_TESTS += fate-qtrle-8bit
-fate-qtrle-8bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/qtrle/criticalpath-credits.mov -vsync 0 -pix_fmt rgb24 -an -f framecrc -
-FATE_TESTS += fate-quickdraw
-fate-quickdraw: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/quickdraw/Airplane.mov -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-real-14_4
-fate-real-14_4: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/real/ra3_in_rm_file.rm -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-real-rv40
-fate-real-rv40: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/real/spygames-2MB.rmvb -t 10 -an -f framecrc -
-FATE_TESTS += fate-redcode-demux
-fate-redcode-demux: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/r3d/4MB-sample.r3d -vcodec copy -acodec copy -f framecrc -
-FATE_TESTS += fate-rl2
-fate-rl2: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/rl2/Z4915300.RL2 -pix_fmt rgb24 -an -vsync 0 -f framecrc -
-FATE_TESTS += fate-rpza
-fate-rpza: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/rpza/rpza2.mov -t 2 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-sierra-audio
-fate-sierra-audio: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/sol/lsl7sample.sol -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-sierra-vmd
-fate-sierra-vmd: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/vmd/12.vmd -vsync 0 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-siff
-fate-siff: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/SIFF/INTRO_B.VB -t 3 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-smacker
-fate-smacker: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/smacker/wetlogo.smk -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-smc
-fate-smc: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/smc/cass_schi.qt -vsync 0 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-sp5x
-fate-sp5x: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/sp5x/sp5x_problem.avi -f framecrc -
-FATE_TESTS += fate-sunraster-1bit-raw
-fate-sunraster-1bit-raw: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/sunraster/lena-1bit-raw.sun -f framecrc -
-FATE_TESTS += fate-sunraster-1bit-rle
-fate-sunraster-1bit-rle: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/sunraster/lena-1bit-rle.sun -f framecrc -
-FATE_TESTS += fate-sunraster-24bit-raw
-fate-sunraster-24bit-raw: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/sunraster/lena-24bit-raw.sun -f framecrc -
-FATE_TESTS += fate-sunraster-24bit-rle
-fate-sunraster-24bit-rle: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/sunraster/lena-24bit-rle.sun -f framecrc -
-FATE_TESTS += fate-sunraster-8bit-raw
-fate-sunraster-8bit-raw: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/sunraster/lena-8bit-raw.sun -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-sunraster-8bit-rle
-fate-sunraster-8bit-rle: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/sunraster/lena-8bit-rle.sun -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-svq1
-fate-svq1: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/svq1/marymary-shackles.mov -an -t 10 -f framecrc -
-FATE_TESTS += fate-svq3
-fate-svq3: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/svq3/Vertical400kbit.sorenson3.mov -t 6 -an -f framecrc -
-FATE_TESTS += fate-thp-mjpeg-adpcm
-fate-thp-mjpeg-adpcm: CMD = $$BUILD_PATH/ffmpeg -idct simple -i $$SAMPLES_PATH/thp/pikmin2-opening1-partial.thp -f framecrc -
-FATE_TESTS += fate-tiertex-seq
-fate-tiertex-seq: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/tiertex-seq/Gameover.seq -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-tmv
-fate-tmv: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/tmv/pop-partial.tmv -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-tscc-15bit
-fate-tscc-15bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/tscc/oneminute.avi -t 15 -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-tscc-32bit
-fate-tscc-32bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/tscc/2004-12-17-uebung9-partial.avi -pix_fmt rgb24 -an -f framecrc -
-FATE_TESTS += fate-ulti
-fate-ulti: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/ulti/hit12w.avi -an -f framecrc -
-FATE_TESTS += fate-v210
-fate-v210: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/v210/v210_720p-partial.avi -pix_fmt yuv422p16be -an -f framecrc -
-FATE_TESTS += fate-vc1
-fate-vc1: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/vc1/SA00040.vc1 -f framecrc -
-FATE_TESTS += fate-vcr1
-fate-vcr1: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/vcr1/VCR1test.avi -an -f framecrc -
-FATE_TESTS += fate-video-xl
-fate-video-xl: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/vixl/pig-vixl.avi -f framecrc -
-FATE_TESTS += fate-vmnc-16bit
-fate-vmnc-16bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/VMnc/test.avi -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-vmnc-32bit
-fate-vmnc-32bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/VMnc/VS2k5DebugDemo-01-partial.avi -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-vp5
-fate-vp5: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/vp5/potter512-400-partial.avi -an -f framecrc -
-FATE_TESTS += fate-vp6a
-fate-vp6a: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/flash-vp6/300x180-Scr-f8-056alpha.flv -f framecrc -
-FATE_TESTS += fate-vp6f
-fate-vp6f: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/flash-vp6/clip1024.flv -f framecrc -
-FATE_TESTS += fate-vqa-cc
-fate-vqa-cc: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/vqa/cc-demo1-partial.vqa -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-vqf-demux
-fate-vqf-demux: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/vqf/achterba.vqf -acodec copy -f framecrc - | do_md5sum | cut -c-32
-FATE_TESTS += fate-w64
-fate-w64: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/w64/w64-pcm16.w64 -f crc -
-FATE_TESTS += fate-wc3movie-xan
-fate-wc3movie-xan: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/wc3movie/SC_32-part.MVE -pix_fmt rgb24 -f framecrc -
-FATE_TESTS += fate-westwood-aud
-fate-westwood-aud: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/westwood-aud/excellent.aud -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-wnv1
-fate-wnv1: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/wnv1/wnv1-codec.avi -an -f framecrc -
-FATE_TESTS += fate-xan-dpcm
-fate-xan-dpcm: CMD =  $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/wc4-xan/wc4_2.avi -vn -f s16le - | do_md5sum | cut -c-32
-FATE_TESTS += fate-zlib
-fate-zlib: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/lcl/zlib-1frame.avi -f framecrc -
-FATE_TESTS += fate-zmbv-15bit
-fate-zmbv-15bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/zmbv/zmbv_15bit.avi -pix_fmt rgb24 -t 25 -f framecrc -
-FATE_TESTS += fate-zmbv-16bit
-fate-zmbv-16bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/zmbv/zmbv_16bit.avi -pix_fmt rgb24 -t 25 -f framecrc -
-FATE_TESTS += fate-zmbv-32bit
-fate-zmbv-32bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/zmbv/zmbv_32bit.avi -pix_fmt rgb24 -t 25 -f framecrc -
-FATE_TESTS += fate-zmbv-8bit
-fate-zmbv-8bit: CMD = $$BUILD_PATH/ffmpeg -i $$SAMPLES_PATH/zmbv/wc2_001-partial.avi -an -pix_fmt rgb24 -f framecrc -
diff --git a/tests/ffserver-regression.sh b/tests/ffserver-regression.sh
deleted file mode 100755
index 11e4a54..0000000
--- a/tests/ffserver-regression.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-#perl -e 'chomp($wd = `pwd`); print map { s!tests/data/!!; "<Stream $_>\nFile $wd/tests/data/$_\n</Stream>\n\n" } @ARGV' tests/data/a* >> tests/data/ffserver.conf
-#perl -e 'chomp($wd = `pwd`); print map { s!tests/data/!!; "<Stream $_.asf>\nFile $wd/tests/data/$_\n</Stream>\n\n" } @ARGV' tests/data/a* >> tests/data/ffserver.conf
-
-. $(dirname $0)/md5.sh
-
-FILES=$(sed -n 's/^[^#]*<Stream \(.*\)>.*/\1/p' $2 | grep -v html)
-
-rm -f tests/feed1.ffm
-./ffserver -d -f "$2" 2> /dev/null &
-FFSERVER_PID=$!
-echo "Waiting for feeds to startup..."
-sleep 2
-(
-    cd tests/data || exit $?
-    rm -f ff-* ffserver.regression
-    WGET_OPTIONS="--user-agent=NSPlayer -q --proxy=off -e verbose=off -e server_response=off"
-    for file in $FILES; do
-        if [ $(expr $file : "a-*") != 0 ]; then
-            wget $WGET_OPTIONS -O - http://localhost:9999/$file > ff-$file
-        else
-            wget $WGET_OPTIONS -O - http://localhost:9999/$file?date=19700101T000000Z | dd bs=1 count=20000 > ff-$file 2>/dev/null
-        fi
-        do_md5sum ff-$file >>ffserver.regression
-    done
-)
-kill $FFSERVER_PID
-wait > /dev/null 2>&1
-rm -f tests/feed1.ffm
-if diff -u "$1" tests/data/ffserver.regression; then
-    echo
-    echo Server regression test succeeded.
-    exit 0
-else
-    echo
-    echo Server regression test: Error.
-    exit 1
-fi
diff --git a/tests/ffserver.conf b/tests/ffserver.conf
deleted file mode 100644
index 1e6994a..0000000
--- a/tests/ffserver.conf
+++ /dev/null
@@ -1,307 +0,0 @@
-#
-# This is a test configuration file. You can invoke it with
-# ../ffserver -f ffserver.conf
-# when in the tests directory and once the vsynth1 subdirectory
-# has been populated. Then point your browser at http://whatever:9999/teststat.html
-# and you can look at the streams
-#
-
-#
-# Port on which the server is listening. You must select a different
-# port from your standard http web server if it is running on the same
-# computer.
-
-Port 9999
-RTSPPort 9990
-
-# Address on which the server is bound. Only useful if you have
-# several network interfaces.
-
-BindAddress 0.0.0.0
-
-# Number of simultaneous requests that can be handled. Since FFServer
-# is very fast, this limit is determined mainly by your Internet
-# connection speed.
-
-MaxClients 1000
-
-MaxBandwidth 100000
-
-# Access Log file (uses standard Apache log file format)
-# '-' is the standard output
-
-CustomLog -
-
-##################################################################
-# Definition of the live feeds. Each live feed contains one video
-# and/or audio sequence coming from an ffmpeg encoder or another
-# ffserver. This sequence may be encoded simultaneously with several
-# codecs at several resolutions.
-
-<Feed feed1.ffm>
-
-# You must use 'ffmpeg' to send a live feed to ffserver. In this
-# example, you can type:
-#
-# ffmpeg http://localhost:8090/feed1.ffm
-
-# ffserver can also do time shifting. It means that it can stream any
-# previously recorded live stream. The request should contain:
-# "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
-# a path where the feed is stored on disk. You also specify the
-# maximum size of the feed (100M bytes here). Default:
-# File=/tmp/feed_name.ffm FileMaxSize=5M
-
-File tests/feed1.ffm
-FileMaxSize 100M
-
-# Fire up ffmpeg pointing at this stream
-
-Launch ./ffmpeg -v 0 -y -f pgmyuv -i tests/vsynth1/%02d.pgm
-
-ACL allow localhost
-</Feed>
-
-##################################################################
-# Now you can define each stream which will be generated from the
-# original audio and video stream. Each format has a filename (here
-# 'test128.mpg'). FFServer will send this stream when answering a
-# request containing this filename.
-
-<Stream test_h.avi>
-Feed feed1.ffm
-Format avi
-#
-BitExact
-DctFastint
-IdctSimple
-VideoFrameRate 10
-VideoSize 352x288
-VideoBitRate 100
-VideoGopSize 30
-NoAudio
-
-PreRoll 10
-StartSendOnKey
-MaxTime 100
-
-</Stream>
-
-<Stream test_l.avi>
-Feed feed1.ffm
-Format avi
-#
-BitExact
-DctFastint
-IdctSimple
-VideoFrameRate 2
-VideoSize 320x240
-VideoBitRate 40
-VideoGopSize 20
-NoAudio
-
-PreRoll 20
-StartSendOnKey
-MaxTime 100
-
-</Stream>
-
-#<Stream test_h.mpg>
-#Feed feed1.ffm
-#
-#VideoFrameRate 10
-#VideoSize 352x288
-#VideoBitRate 100
-#VideoGopSize 30
-#NoAudio
-
-#PreRoll 10
-#StartSendOnKey
-#MaxTime 100
-#
-#</Stream>
-#
-#<Stream test_l.mpg>
-#Feed feed1.ffm
-##
-#VideoFrameRate 2
-#VideoSize 320x240
-#VideoBitRate 40
-#VideoGopSize 20
-#NoAudio
-#
-#PreRoll 20
-#StartSendOnKey
-#MaxTime 100
-#
-#</Stream>
-#
-<Stream test.swf>
-Feed feed1.ffm
-#
-BitExact
-DctFastint
-IdctSimple
-Qscale 10
-VideoFrameRate 10
-VideoSize 352x288
-VideoBitRate 100
-VideoGopSize 30
-NoAudio
-
-PreRoll 10
-StartSendOnKey
-MaxTime 100
-
-</Stream>
-
-<Stream test_h.asf>
-Feed feed1.ffm
-Format asf
-#
-BitExact
-DctFastint
-IdctSimple
-Qscale 10
-VideoFrameRate 10
-VideoSize 320x240
-VideoBitRate 100
-VideoGopSize 30
-NoAudio
-
-PreRoll 10
-StartSendOnKey
-MaxTime 100
-
-Title "Test data stream"
-
-</Stream>
-
-<Stream test_l.asf>
-Feed feed1.ffm
-Format asf
-#
-BitExact
-DctFastint
-IdctSimple
-Qscale 10
-VideoFrameRate 2
-VideoSize 320x240
-VideoBitRate 40
-VideoGopSize 20
-NoAudio
-
-PreRoll 20
-StartSendOnKey
-MaxTime 100
-
-Title "Test data stream"
-
-</Stream>
-
-<Stream test_h.rm>
-
-Feed feed1.ffm
-Format rm
-
-BitExact
-DctFastint
-IdctSimple
-Qscale 10
-VideoBitRate 100
-VideoFrameRate 10
-VideoGopSize 30
-VideoSize    320x240
-NoAudio
-
-PreRoll 10
-StartSendOnKey
-MaxTime 100
-
-</Stream>
-
-<Stream test_l.rm>
-
-Feed feed1.ffm
-Format rm
-
-BitExact
-DctFastint
-IdctSimple
-Qscale 10
-VideoBitRate 40
-VideoFrameRate 2
-VideoGopSize 20
-VideoSize    320x240
-NoAudio
-
-PreRoll 20
-StartSendOnKey
-MaxTime 100
-
-</Stream>
-
-
-<Stream test.jpg>
-
-Feed feed1.ffm
-Format jpeg
-Strict -1
-
-BitExact
-DctFastint
-IdctSimple
-VideoFrameRate 1
-VideoSize 352x288
-NoAudio
-
-PreRoll 2
-
-</Stream>
-
-<Stream test_small.jpg>
-
-Feed feed1.ffm
-Format jpeg
-Strict -1
-
-BitExact
-DctFastint
-IdctSimple
-VideoFrameRate 1
-VideoSize 160x128
-NoAudio
-
-PreRoll 2
-
-</Stream>
-
-<Stream test.mjpg>
-
-Feed feed1.ffm
-Format mpjpeg
-Strict -1
-
-BitExact
-DctFastint
-IdctSimple
-VideoFrameRate 1
-VideoSize    320x240
-NoAudio
-StartSendOnKey
-
-PreRoll 1
-MaxTime 100
-
-</Stream>
-
-
-##################################################################
-# Special stream : server status
-
-<Stream teststat.html>
-
-Format status
-
-</Stream>
-
diff --git a/tests/ffserver.regression.ref b/tests/ffserver.regression.ref
deleted file mode 100644
index 9fc7497..0000000
--- a/tests/ffserver.regression.ref
+++ /dev/null
@@ -1,10 +0,0 @@
-18c4ba0e8e7adb781216e38de61c2e39  ff-test_h.avi
-f84767c7af61f360f4b443c2c73f322f  ff-test_l.avi
-d976848a9e4d5d8fc2659e4841cdece5  ff-test.swf
-28fd87d5075b9b011aad57292f271a04  ff-test_h.asf
-a31ccd3aba2551e60b9fb1c156fca2f8  ff-test_l.asf
-3279d3ed0ef2d1347b5eda84db2cf3e6  ff-test_h.rm
-440231fe3cf0849887390b4d67d6894a  ff-test_l.rm
-e0dc91430660c619e97b5c82e0f398fc  ff-test.jpg
-0d6c98fc8a4f00560fe34e94e26880a9  ff-test_small.jpg
-e2a315d7ac0576279f8b4d917999615a  ff-test.mjpg
diff --git a/tests/lavf-regression.sh b/tests/lavf-regression.sh
deleted file mode 100755
index 6e489a6..0000000
--- a/tests/lavf-regression.sh
+++ /dev/null
@@ -1,226 +0,0 @@
-#!/bin/sh
-#
-# automatic regression test for libavformat
-#
-#
-#set -x
-
-set -e
-
-. $(dirname $0)/regression-funcs.sh
-
-eval do_$test=y
-
-do_lavf()
-{
-    file=${outfile}lavf.$1
-    do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src $2
-    do_ffmpeg_crc $file -i $target_path/$file $3
-}
-
-do_streamed_images()
-{
-    file=${outfile}${1}pipe.$1
-    do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe
-    do_ffmpeg_crc $file -f image2pipe -i $target_path/$file
-}
-
-do_image_formats()
-{
-    outfile="$datadir/images/$1/"
-    mkdir -p "$outfile"
-    file=${outfile}%02d.$1
-    $echov $ffmpeg -t 0.5 -y -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $2 $3 -flags +bitexact -sws_flags +accurate_rnd+bitexact $target_path/$file
-    $ffmpeg -t 0.5 -y -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $2 $3 -flags +bitexact -sws_flags +accurate_rnd+bitexact $target_path/$file
-    do_md5sum ${outfile}02.$1 >> $logfile
-    do_ffmpeg_crc $file $3 -i $target_path/$file
-    wc -c ${outfile}02.$1 >> $logfile
-}
-
-do_audio_only()
-{
-    file=${outfile}lavf.$1
-    do_ffmpeg $file -t 1 -qscale 10 -f s16le -i $pcm_src
-    do_ffmpeg_crc $file -i $target_path/$file
-}
-
-rm -f "$logfile"
-rm -f "$benchfile"
-
-if [ -n "$do_avi" ] ; then
-do_lavf avi
-fi
-
-if [ -n "$do_asf" ] ; then
-do_lavf asf "-acodec mp2" "-r 25"
-fi
-
-if [ -n "$do_rm" ] ; then
-file=${outfile}lavf.rm
-do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src
-# broken
-#do_ffmpeg_crc $file -i $target_path/$file
-fi
-
-if [ -n "$do_mpg" ] ; then
-do_lavf mpg
-fi
-
-if [ -n "$do_mxf" ] ; then
-do_lavf mxf "-ar 48000 -bf 2 -timecode_frame_start 264363"
-do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -padtop 32 -vcodec mpeg2video -intra -flags +ildct+low_delay -dc 10 -flags2 +ivlc+non_linear_q -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10"
-fi
-
-if [ -n "$do_ts" ] ; then
-do_lavf ts
-fi
-
-if [ -n "$do_swf" ] ; then
-do_lavf swf -an
-fi
-
-if [ -n "$do_ffm" ] ; then
-do_lavf ffm
-fi
-
-if [ -n "$do_flv_fmt" ] ; then
-do_lavf flv -an
-fi
-
-if [ -n "$do_mov" ] ; then
-do_lavf mov "-acodec pcm_alaw"
-fi
-
-if [ -n "$do_dv_fmt" ] ; then
-do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
-fi
-
-if [ -n "$do_gxf" ] ; then
-do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
-fi
-
-if [ -n "$do_nut" ] ; then
-do_lavf nut "-acodec mp2"
-fi
-
-if [ -n "$do_mkv" ] ; then
-do_lavf mkv
-fi
-
-
-# streamed images
-# mjpeg
-#file=${outfile}lavf.mjpeg
-#do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
-#do_ffmpeg_crc $file -i $target_path/$file
-
-if [ -n "$do_pbmpipe" ] ; then
-do_streamed_images pbm
-fi
-
-if [ -n "$do_pgmpipe" ] ; then
-do_streamed_images pgm
-fi
-
-if [ -n "$do_ppmpipe" ] ; then
-do_streamed_images ppm
-fi
-
-if [ -n "$do_gif" ] ; then
-file=${outfile}lavf.gif
-do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -pix_fmt rgb24
-#do_ffmpeg_crc $file -i $target_path/$file
-fi
-
-if [ -n "$do_yuv4mpeg" ] ; then
-file=${outfile}lavf.y4m
-do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
-#do_ffmpeg_crc $file -i $target_path/$file
-fi
-
-# image formats
-
-if [ -n "$do_pgm" ] ; then
-do_image_formats pgm
-fi
-
-if [ -n "$do_ppm" ] ; then
-do_image_formats ppm
-fi
-
-if [ -n "$do_bmp" ] ; then
-do_image_formats bmp
-fi
-
-if [ -n "$do_tga" ] ; then
-do_image_formats tga
-fi
-
-if [ -n "$do_tiff" ] ; then
-do_image_formats tiff "-pix_fmt rgb24"
-fi
-
-if [ -n "$do_sgi" ] ; then
-do_image_formats sgi
-fi
-
-if [ -n "$do_jpg" ] ; then
-do_image_formats jpg "-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
-fi
-
-if [ -n "$do_pcx" ] ; then
-do_image_formats pcx
-fi
-
-# audio only
-
-if [ -n "$do_wav" ] ; then
-do_audio_only wav
-fi
-
-if [ -n "$do_alaw" ] ; then
-do_audio_only al
-fi
-
-if [ -n "$do_mulaw" ] ; then
-do_audio_only ul
-fi
-
-if [ -n "$do_au" ] ; then
-do_audio_only au
-fi
-
-if [ -n "$do_mmf" ] ; then
-do_audio_only mmf
-fi
-
-if [ -n "$do_aiff" ] ; then
-do_audio_only aif
-fi
-
-if [ -n "$do_voc" ] ; then
-do_audio_only voc
-fi
-
-if [ -n "$do_ogg" ] ; then
-do_audio_only ogg
-fi
-
-# pix_fmt conversions
-
-if [ -n "$do_pixfmt" ] ; then
-outfile="$datadir/pixfmt/"
-mkdir -p "$outfile"
-conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
-             yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
-             monob yuv440p yuvj440p"
-for pix_fmt in $conversions ; do
-    file=${outfile}${pix_fmt}.yuv
-    do_ffmpeg_nocheck $file -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \
-                            -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
-    do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
-                    -f rawvideo -s 352x288 -pix_fmt yuv444p
-done
-fi
-
-rm -f "$bench" "$bench2"
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh
deleted file mode 100755
index 03e7cef..0000000
--- a/tests/lavfi-regression.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/sh
-#
-# automatic regression test for libavfilter
-#
-#
-#set -x
-
-set -e
-
-. $(dirname $0)/regression-funcs.sh
-
-eval do_$test=y
-
-rm -f "$logfile"
-rm -f "$benchfile"
-
-do_lavfi() {
-    test_name=$1
-    eval test=\$do_$test_name
-    vfilters="slicify=random,$2"
-
-    if [ -n "$test" ] ; then
-        do_video_encoding ${test_name}.nut "" "-vcodec rawvideo -vfilters $vfilters"
-    fi
-}
-
-do_lavfi "crop"               "crop=100:100"
-do_lavfi "crop_scale"         "crop=100:100,scale=400:-1"
-do_lavfi "crop_scale_vflip"   "null,null,crop=200:200,crop=20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=100:100,vflip,scale=200:200,null,vflip,crop=100:100,null"
-do_lavfi "crop_vflip"         "crop=100:100,vflip"
-do_lavfi "null"               "null"
-do_lavfi "scale200"           "scale=200:200"
-do_lavfi "scale500"           "scale=500:500"
-do_lavfi "vflip"              "vflip"
-do_lavfi "vflip_crop"         "vflip,crop=100:100"
-do_lavfi "vflip_vflip"        "vflip,vflip"
-
-# TODO: add tests for
-# direct rendering,
-# slices
-# chains with feedback loops
-
-rm -f "$bench" "$bench2"
diff --git a/tests/lena.pnm b/tests/lena.pnm
deleted file mode 100644
index 700508c..0000000
--- a/tests/lena.pnm
+++ /dev/null
@@ -1,109 +0,0 @@
-P6
-# CREATOR: The GIMP's PNM Filter Version 1.0
-256 256
-255
-â‰}߈‚â†väˆ|âŠ{â†|à†rÞ„uÝ„nÞŠvß‚kÞ„jÜ„pà€gÝ‚tށsà‚jà„râŠvæŠrèŽrè’wì—zè—yî•vê”xévè†tàwfØvvÊZa´P_¨@Tœ>\œ=Y¤EX¦GXªJZ®IZ²J\²NW±JV¯LV°OZ²LX²LX´NX²LV²NZ°NZ®JS´JT´OV¸SY¼TZÂXZÂTXÂZYÄ^ZÄ[\Ê`\Ê^\Ë\ZÌf_Îb^ÎebÌabËbbËkhÍffÎd`Ìb]Îb`Ê`^Êg_Ëd^Ëd`Ëa^ÎhaÎhjÑb^ÐebÐfaÐgfÒebÔe`ÒddÒfbÒgdÎheÎf`Ïd^ÐffÐjfÌfeÎfbÎjfÐgbÓidÑibÐicÎhjÒheÊghÊknÎhlÌffËe_ÇddÌf^Îe]ÍcbÊcbÈjhÍibÍdaÎddÎdbÒb\Ðe`ÑhbÒf`Ðg`ÐjdÑd\ÏfdÎ``ÎjjÒplÍgcÌd_ÈbbÒe`Êd`ÎfgÌb^Çb`Îe`È`eÎieÈbcÈc^Êb`ÌcbÈccÎabËadÈbbÇbdÈ^^ÉbcÄbaÀ\`Â[dÀZ`»Za´X_°T[±PX¨HV¶LP¾V\È`]ÑlbÔqlÖzlÙtÜ„pÞˆnÞŠrÚŽvÝ‚nÜzgÜ~jÚ€jÜlÞ€nÜ€rÞ‚rÝ€pÞ†xÞ‚n߀hÞ€jÜ~j߀eÞ€lÞfà}fÝ‚jށhÜ€eÞ„hÜ„m܆nÝ‚jÞ†q݈qÝ„pÜ‚hØ„nä”nï¹…ôȐøΖøОúÔ£üÔœúÔŸôȐ⪀Ärj§M\¥HX¨PZ®OZµX\¹Z\¶Za¼^`ºac¼X\¼^^¾ZZ½^b»dhº[cº\aÃZ[À[^ÃZZÃZ^¾^^Ã]`Â_^Á`cÄ`bÀ^_Å^]¼V\Á`cÂ`bÄbhÁ``Æ[[ÂbbÄa`¿[]¼V\¼V\ºVZ¾\bÚ{væ’€è”zÒrdâ‰}߈‚â†väˆ|âŠ{â†|à†rÞ„uÝ„nÞŠvß‚kÞ„jÜ„pà€gÝ‚tށsà‚jà„râŠvæŠrèŽrè’wì—zè—yî•vê”xévè†tàwfØvvÊZa´P_¨@Tœ>\œ=Y¤EX¦GXªJZ®IZ²J\²NW±JV¯LV°OZ²LX²LX´NX²LV²NZ°NZ®JS´JT´OV¸SY¼TZÂXZÂTXÂZYÄ^ZÄ[\Ê`\Ê^\Ë\ZÌf_Îb^ÎebÌabËbbËkhÍffÎd`Ìb]Îb`Ê`^Êg_Ëd^Ëd`Ëa^ÎhaÎhjÑb^ÐebÐfaÐgfÒebÔe`ÒddÒfbÒgdÎheÎf`Ïd^ÐffÐjfÌfeÎfbÎjfÐgbÓidÑibÐicÎhjÒheÊghÊknÎhlÌffËe_ÇddÌf^Îe]ÍcbÊcbÈjhÍibÍdaÎddÎdbÒb\Ðe`ÑhbÒf`Ðg`ÐjdÑd\ÏfdÎ``ÎjjÒplÍgcÌd_ÈbbÒe`Êd`ÎfgÌb^Çb`Îe`È`eÎieÈbcÈc^Êb`ÌcbÈccÎabËadÈbbÇbdÈ^^ÉbcÄbaÀ\`Â[dÀZ`»Za´X_°T[±PX¨HV¶LP¾V\È`]ÑlbÔqlÖzlÙtÜ„pÞˆnÞŠrÚŽvÝ‚nÜzgÜ~jÚ€jÜlÞ€nÜ€rÞ‚rÝ€pÞ†xÞ‚n߀hÞ€jÜ~j߀eÞ€lÞfà}fÝ‚jށhÜ€eÞ„hÜ„m܆nÝ‚jÞ†q݈qÝ„pÜ‚hØ„nä”nï¹…ôȐøΖøОúÔ£üÔœúÔŸôȐ⪀Ärj§M\¥HX¨PZ®OZµX\¹Z\¶Za¼^`ºac¼X\¼^^¾ZZ½^b»dhº[cº\aÃZ[À[^ÃZZÃZ^¾^^Ã]`Â_^Á`cÄ`bÀ^_Å^]¼V\Á`cÂ`bÄbhÁ``Æ[[ÂbbÄa`¿[]¼V\¼V\ºVZ¾\bÚ{væ’€è”zÒrdâŠ|à†yâ†vä†xâˆvâ„vàƒnà‚oß„m߆p߀hàhÞ„oà€gÝ€tÞ‚nß‚lށnáˆtæ‹qçrè“yë—zë—yî–vì”vêuç„oßwh×omÈX_´O^§AW>Yž<V¤BV¦FZªFY®JZ°JZ²KV±JT®JT°LX³IS²JV³LW±JT²LX²LW¯JR³KU²PW¸QX¼U[ÂWYÃVZÂZXÄ\ZÆ\]Ê][Ê^^Ë[[Êa^Ïc^ÎdbËddËa^ÌheËccÎfbÍc^Ía`Ëa`ÊfcÌd`Íb`Ìb_ÏieÎgjÐd_ÐgdÐhdÒidÓfaÔeaÓfbÒfbÒfbÏidÐd`Ïc_ÐecÐgbÎdbÏfcÐhbÐgaÒhaÑfbÏhdÎhfÒgaËgjÍhiÍjjËebÌb`ÉbaÌe^Ðd]ÎcaÌb`ÈfdÍjaÊb_ÌddÍc_Ña\ÍfbÐfaÐfaÏf^ÐgbÐe^Ðd`Îb_ÌhhÒjiÎhdÌdaÇbaÐd_Ìc_ÌccÍd_Éa`ÍdaÉacËhiÈ^`Èa^ÉccÊdeÉa`ÎbcËceÈ`bÇbdÈ``Ë`aÄ`aÁ\_Â[bÀ\`ºY`µW^³TZ°OY¨JVµJP½TXÇ_^ÏjbÔpl×ylÙ}rÝ‚rÞ‡uߊrÛŠs݃mÜ|jÝhÜ~kÜmÜ}kÜ~oÞ‚pÜ€mÝ‚pÞƒoà€h߀hÝjÞ~fÞ~lÞ€hß~iÞ€hÞ„i܁dÞƒhÞ‚i܆o܃jÝ„qÞ†nÞ„p܁iفlâ‘oôŏ÷ΘùÐœúÔ¡üԝúÖžö˔求Êzm¨NX¥HXªLV®Q\³X]¸Y\¹Y\½\^½``¼Z]»]]¾\[¼^b¼`eº]a¸[`¿[\¿Y\ÃZYÄ\]¿_`Ä^]Ä^^À_aÄa`Á`_Ä^\½WZÂ_aÁ^aÅbdÄ_`Ç]ZÂbbÄ`^À\\¾U\¾V\¼Z\À_bØtlÞ…vÚ}l¶WZâ†xà†qâ†vä‚nâ‡vâ†tâ€eà}lànà€ià€há~gÞ‚kà€fß|jÞ‚kß„nÞ€gä„næŒrévì’tì–|ì–xí–yì’sënæ„gÞxiÔfbÈZ\µL[¨<UŸ7S›;T¢<S§>T¬@T°KZ°LY°FS±FQ²EP±IV®FR°GS±JV²HOµFN²IT°GO³KV¶LRºOR¼VXÀTXÄWYÆ\\È_ZÊ\VÉ^ZÊZUÌZXÍ_\Ðb\Îa[ÌecÏ`\Îb_ËcbÐa^Ë`aÏbbÑf`Ðd_Íc]Ìc`Ïb]Òc`Ïb\Òc\ÐfgÐfdÑfbÒf`Òb^ÕebÔe`Ód^Ôa[Ñf^Òb^ÐabÎcdÎc_Ñc^ÑfcÎfdÎdaÏedÎfdÐc^Ïb`ÌdhËknÌdfËmjÊbbÍgbÊb`Îd`Î`ZËc`ËjfÌieËbbÊe`Í^XÎd\Îd^ÎgdÓd^Îh`Íb`Ðe`Ïa]ÐfbÐd^ÐffÍedÐd`Îa\Ë_\Ç`cÌ`^ÉfhÌ^]Ëb`Éa`Êa_Ê_^ÅbeÎa\ÎabËcaÌbaÌabÉ`^ÊbdÌ_\È^^Æ^`Æ[]ÁZ^¼\f¼W^¹T[¶RZ²LT«KX¬EPºUXÄ\^Èe`ÓlgÔvnØ{nہrÛ†pÞˆt߈tÞ„mÞ‚oÞ~gÞ}gÜoÜ|gÞ€nÜ€nÜiÝ‚nß‚là€fßi߁fßeÞ~cà€ià‚hÝ€j߀fÞ}dÞeÞ‚gÝ‚iÜ‚lÝ„mÜ„rÞ‚kÝ‚jÚiہhè¢xñ¾Š÷ʐøКúÒ›ûÔžüÖžûÒ•òÉߞs¸d_£HX¦JW«P]²V]¸V[¼[]½TWº[^»Z]½ZZ¼`^ÀZ^¾`a¿\^º^bº_d½]^¾^\Âa[Á__Æ_[À`_Á^]Ã]\Â\^Å\ZÀ^^¿[`Ä^^Æ``Ç]bÇ\[ÄbdÇ`\Ä_`Á[\Å[]Å`cÅb`¹VZœET~,KfEà‚ià…páƒrâ‚nâ…tâƒrà„kã€lâ€kà„nà‚jâiށnß~mÝ~hà‚lÞ~iâƒjå‰mçŽré“rì“wì”sì–rî•ní‘pêŒlå€dÞtfÔjaÉWZ¸NX¨=Rž:Q¢8N¤:O¦@R­DT®DR²DPµHSµFP²DN³LW¯GR²KR²HR²GO²HN²HR°JT³LU³PY´OX»QY»VZÃUWÅZ]ÃYWÅ]]Ê^YÈ^]Ê]XÈa^Ì]]Í`^Ê_[Ðd]Ìc_Ìb`Íb^Íd_Íd`Îa^Îb]Îb^Ìd^Íb\Ðb^Îf_ÐbaÏc`ÏfaÐgbÒfaÓh^ÒhaÓd^Ñb_ÒgbÏhaÒdbÎb`ÐkhÑedÏdaÐfbÐdbÍa`ÑefÏcaÐd`ÏbfÌ`_Ë`bÒdbÎb^ËgfÌbaË`\Í^\Í`]ÉfbÌgdËhcÎedÎ^VÎ_[Ìb\Ëe_ÎdcÐb^Óa]Ðc`Ðb[Ïb_Òb\ÎcaÐd^ÐfbÌecÏ`\Ða^Êb`Í`\ËbbÊ]]Ëb]Ë`^Ì`]Ê\\È^`Í^^É]^ÈbaÎa_Ê_\Ì`[Ëb`Ç[[É^]Ç]]È_^Æ\^¼Y_¼Ya¹TX¸PX·QS³LU¬HT±JU¼SYÂ]^ÎffÑql×xpÚ{nÜ‚qÞ„tߊuß…rß‚nÝ‚pÞ€jÝ~jÞƒká„lß‚iàjÞ„m߁iàjá„kàƒgâ‚e߁jßg߀jà‚jß}eށjß‚jÞƒjÜ‚l܁l݁nہm܁l܁kځhÚ~mÞ‰n쮀õÂŒöÌ™øКûÓžúÓ›üÔ™øÍ’ë·~Єl¬U[¨LY¬NU¯S\¸SZ¹XZºZ]¼\^¼Z_»Z\º]^¾[^¼]a¾\aÀ\]¾X[ÀZ`Á\^Â^^Â`^Ä[XÄ_^ÁZ\Ã_[Ã\_Ä^ZÆ]\Ä]^Ä`\Æ`cÆ``Å`]Ã`_Æa]ÈbbÆbdÉ_^Ä_\°NTŒ/Id@\B\Aàƒlà†nä‚iázká…oâƒká‚lâƒkä‚nàná„kâiß~hàhâ‚làbà‚hâ„jæŠjèŽnê’oë“qì–sì•oî”nìhèŽmå}eÞo^Õf]É\[µKT¨;OŸ8Q8P¥<P©@S¬BR®@P°HS´CN³GQ´FP±GT±IO´IR´DM±GP³IQ°DO°JR´KS¶OV¸OS½QT»VZÀW[Â[_Ä]`Æ\^È[VÊ^ZÎ[WÌb\Ï^ZËb_Í_ZÌa^Î`\Ïa^Í_ZÊfdÐd^Ïd`Ðe_Î`]Ïc\ÎaZÐ`]Ðe]Ð`[ÐdbÒfbÐfbÓb^Ôb[ÒdaÓd`ÒebÔd^ÐcaÐ_\ÑbbÐfbÓb^Òd`Ôd_Ñ`]Îc^ÐfaÎbbÑc\Ïc`ËcbÐa^ÐfdÍdbÎb`Ìb`ÍcbÏ`\Îa^Ìa^Ï`^ÈfcÏb^ÌcZÌc]ÍbaÎb\ÍdaÏcaÐhdÏc]Íd`Ïa]Îa_Î`_Î`[Ïb_Íd_Ðd_Ìc^ÌbbÑaZÌ`]Ì`]Êa^ÊbfÌb]Í``Èa_Ì_^ÊaaÊ^]Ì`dÌd`Ì`_Ìa]Èa`ÈbaÈ`]Ä^_À\`¼V\¿YbºTZ·U`´NV²NX¯LY®HV±NX¾X^ÈegÐjfÖsoÚzrÜ~tß„vàˆuà†rá„o߁lÞ‚pßj߁läƒiá†lá„mâ†oájâƒlá„jáƒl߁j߀ià‚jà€hà†jàkà~fà€g߁lÚ}a݁nÚlÚƒlÚhÛ€fÚ‚gÚ|iØkä—tð¹„öÆ’ùΘúÐœûÔšþÖœûÓ˜õÆŒä¤uÀlc¬JR¬IU«LU²RX³SZ¼VXÀ\]½ZZºY^»^a¾ZZ¾]^½Y\º\]¼Y_½ZZ½XZ¾\\¿\\Ã^^½]b¿]^Ä^\Ä\\Á^\Æ\\Â^^Ä^_È^\Í_\É\\Æ^`ÈdcÎfbËhbÃ_]®HO…,Fe@\@ZAZBäƒnâ‚pâ‚kâƒná„nâƒjâ€hâƒlâ‚jà‚qâ…lâkà€j߀iájáhãƒjä‹qèŒnè’rç”pé“tê’të“kínêŽhç‹hâ~gÝp\Ôh]ÉVT²JRª?Qœ7N :O¢=O¨<N¬BR°DQ±IV±GR³LX±KV°MV±NV³FN°DO±IP²CL±FO±DOµJR¸RVºNW¾RRÁWVÃVZÁVYÄZ^ÄX[È\ZË\YÍ\XÌ]YÐ]VÎ[XÍ^XÑb`Ì``Ðb_Îd_ÐebÑd`Òc`Îb^ÏbaÎb`Ía\Ñc\Îd`Ï`\ÏbcÏgcÐb\Ôb^Ód^ÓgdÔg]Öc^Ôb\Ðb\ÐfcÑddÐd`Óc`Ób]Ô_]Ñd_Î`aÐdcÎ`cÒc_Òb_ÑeaÒe`ÑdaÎdcÐd`Îb^Ï`^Îb_Ð_\Íb^ÏcaÍc`Òc`Ì_[Î`ZÎebÐb]ÐhdÒhdÒhaÑddÏfbÎb`ÎebÏb^Îb]Îd`Íb_Îb^ÐfbÌdfÎa\Èb`Î_ZÍcaÌb`ÉbaË^]Ìb`Ì__Ëc`Æ^\È]^Ì`^Ê`_É_^Ë`^ÌddÈ__Ã]bÅ\`À\`ÀZ^¹V`µPZ´PX±SZ²PZ®IT©HW·S\Â_hÏkiÔqnÚvlÛ}tàmá‡vâˆsâ‡sà„má„mß…lÞ‚oã†ná‡lâˆmåˆoä‰kä†pâ„pâ…jã‚fà‚là‚jà…gà‚ká‚fÞ€hàhÞ~dÜ‚jÜ€jÜ~jÜ‚oÜ€fÚ€jÚ‚mØ|hÖ~kÜ„lê©|óÀ‹øÊ’ùЛûÔžüÕœüÖžúјð»ˆÖr´WY¨LX¨M[¯T\±TZºTX¼X]¼Y_¼X\¼\_½\]ÂZZ¾\^¾[]ÀZ\ÁX[¼^c½[[¿^aÀ[ZÃ]\ÂZYÄ\]Ã\\Â\\Ã[\Æa^Ê`[Ç\[Æ`aÇ^`È^^ÌhcÏgcÇ]Y²OV†,Gb$HY@X=Z@\>ä„pâ„nâ‚jã‚eß„nâƒhâ‚lâjã‚mâ‚jâ€gá€jà€gÞ€jáiâ„iåˆpåŽpçqè“rç“vé“rê’nênêŽmæŒoç„fä~hÝr^×bVÊX\¶NW¦>Rœ<Qž<R£<M§?O­FT±CN³FSµIRµJU±KT²JU´JR³HO²CP°IP²KP±BK°DM´JQ¶MV¹OV¾PQ¾TWÁTZÆVUÄ[aÅ^\Ê^\É\YÉ]YÍb[Ì^XÎ^YÌb^Î^ZÍ^\Îb]Îd`Ìc`Ða^Ðd\Ïb^Ða`Ða^Ï_\Óc\Îd`Ðc]Ñc_Ðb^Òb^ÒaZÓheÖb`Ôc]Òb`Ñb[ÐcbÒd`ÑdbÒfeÖc^Ò`\Ñ``ÏfdÏdeÒfdÐcbÐecÒa`Ïc_ÏddÏdaÐc`Ñc\Îd_Ðb^Òb\Îc`Ïd]ÍdaÌb`Ïc`Ï_ZÎc]Îe_Ïb[Ðd^ÓhaÓd_ÒgfÎddÏb]ÐgdÏb]Î`^ÎddÎd`Îb_ÎaaÌcbÎc`ÉbcÍa^Í`\Ê`\Ë_]Ì`^Ê_`Î`bÊbcÊ`aÌ`_Îb^Ìa`Ë``Ìe_ËadÈ^cÄ^bÆ^`Â\aÁX^¼WY¶R]·T]±Vc±N[­KY«JX²NZ¼VaÊehÖpkØvrÜ|qÝsÞ…tâŠpâˆráŠvãˆnàˆtá…rä‡täˆnåŠpæ‰påŒoè‡jã…ká„kâƒgá€lâ‚hà‚hàhâ~fâ‚fá‚fà‚hÝ~hÜ|jÜ|hÙ€kÙ€pÜ€lÚ€oØ‚pØ~jØyhä“qñ¶€øčú͘úÒœüÕŸü֝üÕŸ÷Ê“ç°€È{i¬MX­MY­MU´NW¶OUºZ[¸T\·VZ¼\^½Y[¾ZYÂ`]À[[¿YX½\]¾Z\À\`¿\b¿Z^Ã\\Á]`Ã^]Ä_`Æ_^Â]^Æ^^Å^^Å`ZÊcdÍdcÌecÎk`ÄZ\¨EQ&Ea?\HZBZ<\B\Bã‚pà‚máƒmágâƒlä‚gâ‚oâ‚hâ€gã‚kâ‚jãjà~fÞ~mâ€jãŠtæŠnætè’påqç‘pêpêlêŽmêŽnç‰mæ„gà|gÝo\Ôf\ÈWY¶HR¦<LŸ7L 6J¢=O¨:J­FR²GQ°@L·KR´HO´HRµMV±HT²GT°FQ´JT²DM´DN±DKµEN·MP¼NQÀQUÁRSÅTSÇXVÈZ[Æ\bÇ]ZË\YË]ZÎ^ZÏ`\Ï_\Í_[ÌeaÌ`\Ða[Ðd\Îb^Óa[Òb^Òc^Ñb^ÎfaÒa^Ð`ZÐc_Óc`Òf_ÐfdÑd^Òc^ÑgeÒfbÔe`ÓkhÒegÒfcÔa]Òd^Ôf\ÔefÑd^Õa_Ò``ÒfcÐecÑcbÌa_ÐedÑgdÑffÐhdÒecÒb^ÒffÑebÑ`\Í_\Ï`ZÎf]Ñd_Ïc`ÌbaÌ`]Ðb]Ðc^Óf]ÒifÒfcÕjfÓe^ÐcaÐd`Îb\ÎebÎc^Ðc`Òa_Ðd\Íc`Î_\Ì`\ÏbaÎ`[Ì`_Ê`]Î^ZÌ[^Î_^Ì_^ÎbbÎaaÉbcÎ``ËbdÎ`^ÎbcËb`Æ_`À`bÃY\ÃZ]¾TX¿QV¹T[¶Zc´MX²OWªJ\®HW¹S^Á^hÐooÖvpØwpÜ}qÜ„wà…pá‰tâŽsâŠsâ†tã†lå†påŠpäŒuã‰lãŠqä‰qä†mâ„nâ…oâŠnâ†jáƒnà‚láfâgá}bàhÞ„rÝ|eÚjÚ|lÛ€mÚ}lØ~mÚ~hØ}i×{iÞ~hé¥{ô¿ˆúÊ‘úÑžûÓœüÖ¢üÖ ûÒœóÃŽážvºb`¦JX­LV¬NZ¶PWºX\»TZ¼V[½Z_ÀY\¾[[Ä[ZÀZ[¾[]À_\½[\¿_a¾]_¿^^ÂabÂ_bÂ\\ÀceÅa^Ê`[Éb^Ìb`Îb\Ðd`ÒhbÏfeÃ\[¦@Ly!B^>W>X<ZBY>[9_@âlà‚là„sâhâ„jâiä„hä†kä†kâ†mâiàƒpà€màlá…pä‰påråoænè‘qæ‘pèŽpèsç‰jèŽuèˆoä‚dâ{jÝreÖjeÆ^a¶Q\¦@Sœ8MŸ9L¤?P©@M®DM²CN±BN¶FP´GR´LT±IW´FP³HT°JT´FO±DN¯JS±DL¶KS¹NR»QW¼UZÁSWÀY_ÅXXÂY\ÈWZÆ^[Ê\\ÊYVÌ`]Í`\Ï^`Ð`[Ða_Ñ^\Ða\Òd\ÎdbÐc_Ðc]ÏfdÒd`ÑfcÐa^Ïb_ÎdaÒa]Ñb`Òc`Ô`[ÑaaÑdbÒfbÔd_Òd_Òf`Òc_Ôb^Òb^ÒdaÔc\Òb\ÓcaÒ^[ÐbcÓjiÒdbÔb^ÐdbÑcbÑabÎaaÎdbÑdaÓgeÏa`ÎdfÌbeÎ`bÌfbÌgbÍf`Ì_]Í_^Ðb]Ðd]ÐgaÑgfÐigÒjfÐgdÑdcÐfbÎdaÌfcÐd`Ðb_ÎgfÓfbÌ`^Ìa^Î\[Ía`ÎcdÌcbÎdeÍ_ZÌ`^Ì^bÍ_`Ì`\ÎbbÐcaÍadÌabÊ\ZÏ__ÊaaÃ^dÀbgÂ^d¿Z`¾VZ¾TY»S\¶P[³NX³NX®HV­FX³Q^¼[gËfgÓol×xqÛ~uÜ‚uâ…tã‰râŒxãˆväŠwãŠoã†oäŠqã‹räŽuæˆmåŒmå‹qã…jã„má…jã†oä†ná‚pâ‚hàkà€dá‚j݁lÝ~lÜ~jÚlÝ}jÙ€pØlÙnØ~iØzeØxf߉jð°øÅŠúΕûÓ ûÔžüÖŸý֝øÌ“íµ„Ð…l«NXªISªM\°NVµTZ·V^ºTZ¼X_¾Z\Ä\ZÀ_`¾\`Ä_[À``¾\]À]`¼^`¾bbÀ]^Â__Â^^Äb^ÆbdÌ^]Ìb`ÐfbÐg^ÒgdÒiaÄZ[¤>Lu$CZ<V@YBZC^D\?\>`;â‚jà‚oâ‚nâláƒlæ‚jâ…mä„kä…lãƒlà~nâ‚nànà‚ná†oãŒqætæ‘oèŒpæ‘ränæoåpåŠkæ‰lç‰oç‚dä|fÞqbÕhbÈ^^´V\¤BRž=O9N¥=J¨>J®BPµFP²FO³OWµIRµFN´KQ°HP°IQ®CO°DL±KP°EL³EK³FR·OX¼OV¼RU¿QPÄUUÃVVÆWVÆZYË\YÈZWÌ\VÈ\\Ì\XÍ_^Ìa[Í`^Ïa`Ña[ÎcbÌ`_Ð_]ÎefÐ_[Ðc`Ñb`ÎdaÒb`ÍdcÐbZÏabÑc`Ñd\Ða`Ña]Òc`Ôd`Ôc^Ð`ZÑaZÔc`Ò`_ÐbaÒbaÒd_ÐcbÐaaÑeeÔc`Ò`]Ò`]Ô_\ÒecÓfgÎbbÏa`ÎacÏbbÎb`ÌjfÌbbÎe`Îc`ÌcaÍbbÎ^\Í`ZÌb`Îa]ÌcaÑedÒghÐkmÑooÑefÎdeÎb^ÏfdÐb_Ìb`ÍbaÑfcÌ`ZÌa`Ì]_Ðb[Ì_`Ë`]Î``Ð`\Ê\]ÌZ[Ê``Ë`^Î^\Ï`^Ì``Í_^Ì_\Ï_^Ê^ZÊ^`Â\`À]h¿\dÀelÂV\ºPX¶T\³LZ²JX°NY®FT´OY¸V^ÌecÑok×ztÜzn܁sß„pàŠvâŒyäŠvåvä‰pä†oá‰täŠxä‰rãnäˆrä‰pâˆoäƒlà„nâ‚pâ„oâ„râ€fá‚sà‚jÞƒpÝ}kÜ~nÜ~lÛjÜ€jځoÙlØ}oÚ|kØ}lÚ{kÙyeæœtó»‡øÉ’úÏšúÓ ûÖ üؤüÓ˜õÆŒä¦w»jbªLT°R[®NU¸T[µPW¹X^»X\»X\¾Z\¼\`À`aÀZ^½[]¼\_¼`e¼Z^¿^`¾aeÂhjÄabÈabÊb_ÊfeÍedÑhgÒigÒlfÆ\]£?Nx#D[AR@ZFXFX@\CZB]?aAâƒqà‚lâ~iâ‚lâ„mä‚iäƒnä„mã†râƒlâƒnà„màjâ€iã„mæŠtç‘nå“tçtä‹nåŽlæpäŒpäŠlå†jä‰ræ‚hâ{hÚwhÖheÉ`d´OZ¥@Rœ8N;N¥?O«AK°AL±DN°GP²QX³DM´FO²DN²EL²HN²GN±HN±EL±IP²GN¶HPµLQ¹PT½NQ¿UU¿SVÄZYÂWXÅWVÉZXÌZVÎ\WÈ\\Ë`\Ð_]Î`[Îc^Ñb[Ð`YÎc_Î`\ÎccÎc_Ðc`Î`\Î`bÍb[Ð`^Íb`Ò`ZÒc_ÐdbÐb]Îb]Òc]ÒdbÓa^ÑcfÐ`]Òc]Ñ`[Îb_Ï^ZÔc^Ñ_ZÑb^ÒecÐ^^Ób^Òd`Ò\XÒ_[Ðb`Ñ^]Í]]Î`\Ïb^Ìa^Ð``Ð\[Ïb^Ðc]Íb^Ì``Ëc`Í^\Ì`\Î_YÍbbÑfdÑbbÏedÏfdÎffÍbbÐc`ËbcÍa`Îb`ËdbÐb`Ðb]Ìe`ËaaÌa_Î`[ÌddÌ[YÊ\_Ë]\Ë\]Í^ZÌ`^Ì^ZÌ`ZÍ\]Ð^\ÎZ\Ï\ZÏa_Ê`\Ë]]Â\`Â[`À[b¿Y]¾X`¾RV¶QZ°PZ²S\¯JW«JZ®O[¶P[Æ`dÐjiÖxpÚzvÜ€xÝ„tàˆyâ‰vãŠwãŠxä‡näŠrã‡máˆpá‡sátä‡näˆkâŠoá‰qàƒgà€mâ‚jâ‚jâ€hàmÝhÝlÝ~jÛ€lÜ|kÛ€jÚ}jÛ~lÛ|iØ{kØ~k×~lØveÔvfÜ„jì¬|õÉøÌ’ùÒ›ûÔžüÕžû×¢úҗf֌i³TW¬JS°PU´PZ´RV¹V[»Y\ºVX¼V\¾UXÀ\\À_]¾[^¾\]ÀWZ¾\`ÀZ\ÁadÂbcÃfiÆdhÇddÌedÎgdÒhiÓldÊ\[ >OnA_IV@XEZA\ LZ?]>\>b<c@â‚hßlànâƒtä†qä…jå…mä„lã‡mãlàƒrâ„oà‚qâ†päŠsçtçvæsæ’oårã‹qåŠsä‹rá„kåˆlæ‡læ„jã}dÞtcÖh\ÊZZ¸LT¦@Nž6I5H¥>Mª<I°=J¯BN¯JR¶JR´HP²HR³CO±JR³JP±FL´FK°EL²EM´HN¸LP¹MP¸PU¾LR¾QSÃWXÅZYÆZWÈWUÈZXÈYTÌ`\Ë_\Ï_[Ð`^ÍZVÌ^\Ìc]Ïc_Ò`[Îc_Ð^_Ð_ZÐb^Òb_Ì]^Î``Ð`^Î`^Ñ_\Ñ`YÎb`Ò`ZÐ^YÓd_ÔfdÖe`Ô_\Òa\Ó`YÒ`ZÐ``Ð`\Òb`ÐfhÑgfÓdaÒa_Òa\Ó^\Õ^WÒ_ZÑ]XÒZVÐ^[Ï^[ÐZWÒ]WÍ]^Ì\^Î^]Î]YÎ^ZÍ`ZÌ^[Î^ZÌ`]Ð\WÌ][ÐaaÍ`_Ïb`ÍdiÎdbÒcbÒb`ÎcaÍbaÑc_ÏcbÐd_Ï_\Î`\Î^\Î\ZÎ^ZÎb^Î`XÍ\[Í_\Í\YÌ\[Ì^^Ê_\Î_\Î^[Î\ZÌ[\Í\XÎ``Î`_É\[Æ\aÂ^dÂZbÂ_fÀV]ºQ\µNW²N[°NW®JV®L\±T`·YhÆafÎjlÔtrÛ{tÜ~xß…yà‰|â‹vâ‹xâ‰xãŒtäŽuâ†pá†ràˆrâ‰nâ‡lâˆnáˆkâˆoã…i߁jàlà„jájá‚i߁oà‚lÞ~hÜlÞ~mÚ€kÛ}kÜ}jÛlÚ}lÙ|jØ|i×zmÖxkÖydã–qòº†øÇ’úКúÔžûÖ¢ûØ¡ü֝÷ÊŽç°~Çw`¨JU­KS°OX±TW¶X^¼]]¿ZYÁ\]½Z]Á\ZÄ^ZÀ[]À\Y¿Z]¿ZZ½Y\¼]cÄbfÃ]_ÅcbÉdfÐdhÒifÒjgÈ\_¤<Nr#Gf4XWDV>W=X<Z=X:`;_?f?f@â€fß‚pâ‚oäjä„næ…mæ…iäƒiä…mâ†râ‚nâ„má„nåŠpærètérç‘sçræoå‰iä‡pâˆnàˆqä‡jæˆpæ‡nã~gàt^Ùg[ÉTQ´FL¨7FŸ8Lš0Gž6I¨<L¯BM°DN°HN¶EN´GPµHQ²LV°JT°IT°DN¯FP²FQ´DL¶GN¸KO¸LP¹JN¼QW¿STÁX\ÆYXÄUUÈZ\ÊZVÇ^\ÌXYÈabÍ^[Îb_Í^\Ë]aÌ^YÏ^_Ð`ZÍbcÍ^aÏ^ZÎ`^Ð``Î`eÏbcÑb_ÎcbÐaaÐc_Ñ`\Ò^XÏ\ZÐaZÏ_`Ó`_Ó`]Ôb^Ò^ZÑ]ZÑ`\ÒdbÑcdÐdlÕhfÒgfÒebÒ`aÕ^ZÒXXÑYVÑ[WÎZZÏZZÎZWÎ]WÎ\XÎ`\Ì`bÐ^[Í`[Ì\_Ê\ZÍ_\Ê`]É^]Ê^[ÈbaÌZXÎ`bÌ]^ÌbbÏfeÏcdÐcbÐaaÏdbÒddÎcbÌfcÌ_ZÌ_]Í^ZÌ^\Ì^[Ì__Ì^`Ê][ËabË^_Î]WË_`Î`^Ë^]Î`XÍ\\Î]ZÎb`Í^_É^]È^`Ä]^ÀY`Ã\_Ã^a¾^dÀR\¶MX¸NW´LS±JQ±JY¶P^¹WbÃ[fÑfjÖolÖutÜ€xà†xâ…{â‡zâŠuâ‰uáŠwäˆtâ‡sá†mà†qá‡pâ…mà†lá‡hãˆhâ‡kÞƒlâƒlß„ná‚jâƒkÞ„mßjÞ€lÜ~lÝmہmÜlÞhØ€mÛ|jÙ}mÚ~kÖwhÖzlÕvhÜ€dê«zö‹ù͘úÒ™ûÕŸúØ¥üÛ üÔ™ò‰ڜw´\Z¬JP²NT³RW´V[¶ST¾ac¼^cÀ`aÄY^Â]^Â^^¿Z]¿\\¿V\Àab½^cÃ\\Á_bÆbbÎd`ÒheÐhhÊ^X¢=MsAYA\FYDS:U7Z<\8_=c9h=j>c9äƒpã„oä„mã„jä„hæ„nå…lå„hå…oã†oä…jã†rãˆuçŽoètç”rç”tä‘ræpåŒsã‡hã‡kâ„oà†qåŠhæŠnç†låcàsZØgZÊXR·JN§<Kž6Hœ3H£;I¨CN®?M¯DO²HS±DNµHP³IR²HN²LV²FN¬KV°FN±HP°EP´HM·KT¸KO¸KR½SVÀSRÂTWÆXUÄZ\ÆYXÈYXÈ\[É]ZÊ`ZÊ`ZÌ^WÌ]ZÍ]ZÌa\Ì^[Î_[Î_[Î\]Ìb]ÍabÎa_Ña`ÌchÎ]]ÎbbÐbaÐacÑabÒc]ÎacÐ`]Ð`]ÒddÕ^^Ô`aÒ\]Ð^^Ï__Ô^ZÔ^^ÑedÓfeÒhhÒgaÒadÑ[\ÎZXÑ\ZÍ[XÊZWËVUÎWRÍZZÎVWÎ]\ÌbdÎ^[ÍZYÈ\`Ë\XÌZ[ÊYYÌ^\Ì^^Ì\ZÎa^Ða_Ìb`Ì^^ÎbdÐ`^ÎbeÌbfÐb^ÐdcÏhfÐbbÍb^Ê\\Ð_]Ê^\Ì_bÍa^Ê`aË`aÌ^[Î\ZÍ_]Ì\XÉ]\Ì\ZÏ]\ÍZ]ÈZ]Îa`Ì^aÎ_\Ë]\Æ\_Ä^bÃU]ÄX^¾V^ÀYb¸OW¹QX¸NVµLU²LX¶Pa½XcÆaiÎfjÔprØwtÚ~wÞƒyß„và†xãˆ{âŠtâŠxâˆtà‰vá‡tá‡o߇tâ‰oà‚mâˆjä†kâ…jã†jâ„iàmâƒmâ‚qá‚nâ€lÞƒrß‚oÝ‚sÜ„rÞ€nÜ~lÜ~nÚ~hÚ~qÙ{h×xkØxi×xdÖvgâlô¸€øÇ‘úÑ›úÔŸúÖ üؤüØ¢øДɁl°IN¬MU²OU´TY½UW¼VX½ZZ¾[^¾^]Â\ZÀ[]¾]]ÂZZ¾[`½]]Á^aÆb`Ä^^ÉfdÌfdÏjdÂZ_¢9Kt>W=V:ZCXA[BW;^?^<b=d=g@a>f'Lä„jã…qä„pâ…må†mç„kåˆpä‡iä‡qä†näˆqåŒnåvèrçwé“rè’tèrçŽrçŠlä†jâ†nà‚rá†tçˆkèŠnèŠmè€fÞs^ØgXÊXU¶KP¦=KŸ:Nž4K¦<Kª@M¯BR°BL²FR¶LV²LVµNV±DN±LU²GM°EP²FO²IR±DP²IQ¶IR·JO¸KQ½NR¾TUÅTVÇWVÂ\_Æ[ZÊ[XÆ\ZÉ\ZËZVÌ_[Ì\YÍ`^Ì_]Ë`_Ì`\Î`^Ì]ZÎ^^Ì\\Ï`\Î_aÍ``ËbfÍadÏ``Î_cÓd_Ð_^Ñb]Òc`Ð`\Î``ÏcbÓ^`Òa^Ð`]Ò`_Ð_^Î^^ÏbfÑebÐdeÒa`ÑbbÒdcÎ`cÎ_\ÎYVÌZZËUUÍXVÌZVÊYWÌ\[ÌZ\Î\ZÍ`]Ì^^Ì]`Î\\Î\XÈ]^È[\Î\[Ê]\Ñ[XÏcaÌdgÌacÎ`^Íb`ÌbdÌefÍfhÌa`ÌdhÎ^[Ëa`Ç]`ÌbbË\[É\_Ìb^Ë``Ë_^Ìb^Î]\ÎZXÊ^aÌ_^Ê[ZË^^Î]`Í\`ËbaÐ^\Ï``Ë`aÊbdÇX]ÀT_ÁV^ÀV\¼V`¿TYºLWºNX´NZ°KZ´Oaº[jÆclÎilÓkjÕwxÛ|tÞ€và„xá‚tâ†sâ‹xá‡wâ†tß…và‚qá‡và„oãˆpã†iâ†gä„hâ„mä„jáƒlà€eánàqá„rá€há~kÞƒp݃rÞ„pß‚nÞ‚lÝ~lÜ€oÚzlÛjÚyjÖwgÖxjÔtf×|gì¥xöÀ‰úÊ”ûÒœùÕ¡úÙ§üÙ¤üמ÷Ë’ã§v¹d]®JP²OT´PXºUV¹VV¾XX¾V[Á^`À]`¾Y\¿ZZ¿\^À^]¿`bÅ[]Å``ÈcdËgbÍgcÄZV¢=Ks<X9W@[@\@\BZ=]?^>b=e<e<b:bAcEä‚gä„pä„näiå…lä…hä†jä‡lå‡pä‰væ†pçŒrèsé”té”ré”rè’ræ‘tèpæŠeä‡fâ‡lâ…pã…iæˆoèˆièˆjåcâv^ÜhVÌ[VºHN§<JŸ9J¡9K¦?Q¥?P¬AN°BN²DN³GQ´HS´KT²KT°NV²FO´CL°CL²EP®ENµHO·GP¶JSºNU½PVÂPQÂTUÆUVÆYZÄZ]É\\ÆVVÊ[[É\\Ë_\Í^ZÎb]ÊZ]Ð`\Î^\Ía`Ê_aÌ^ZÊ]`Ð]ZÎ`aÌ`^Î`aÑ`^Ð`aÔ``Ò`_ÐaaÐb]ÑbbÒb]ÓbcÏ_`Ï_^ÐaeÓehÑ`^Ñ^]Ò_\Ñ``Ò``ÒcdÏbbÓddÑ\ZÔ\YÓ`_Ð[XÎXVÍZXÉZVÈXYÈVWÌ[XÈVDÌ[YÍ]ZÉ]^ÊZ[Ì^[Í\\Ì\XÌZZÉ\YÆ\YÊ[^Ë_]ÍabÌ_`ÎbeÌ`aÌ]`ËabÍheÎbeÍcbÎ_`Í__Ê^]Í__Ë^^ÌaJÎabÍ^`É^^Ëa_Ï^\ÎZXÌ`\É`cÊ\`Í]\Ì[^Ì^]Í[]Í`]Ê``Ç]`É^_É[_ÆW_ÅX_ÄT`¼RX¸QH¶L]¸N[´HX¶JX¶LY¼Y]Ç^bÏelÒjjÔqnÙwsÝ|rÞ€rÞƒvá†xá†wâ‡tâ‰vß„wÞ†t߆s߆sá‰rá‰mà…râ‡oá…là„Vâ„oà‚pâƒkà„qãƒoà€jß„nÞ‚p߆nà‚n߃TÞƒrÞ€m݁nÛoÛ~qÙ~oØ|nØvmÕrOÒqe܃iï®löÄdùÎúÓ‚úØ—úÚžüÛ¡üÖ õƘښ³\~«Nw®Ni´PZ¼VV½WU¼UZ¿XZ¾[YÀ_[Á^[¿^\ÀaaÂ^^Â_`Èd`ÇgeÍg]Â[]¨CUw#R[NXNTG_DZ2]B\:`Hb?eBe;b<`<d@d >ä‡sâ…lá…nâƒkä…mä‰läŠnæˆpå‡räŠtåŒrèŽqè’uêré’qèrêoèpèkå‡jä†mã†mâ„lã†lèˆiæ‹lè†gä~eàr[ØfVÉVP´HM¨>Kš6L;M¥;K¨BP®BR°@M´IR´GP´HP²HQ²JQ¯FM²FN°IS²EK°CM²BM´CMµEO¸LTºOW½OUÂRRÄSVÄSUÆXXÉWTË[ZÈZVÈ]YÆ\\Ê[ZÌ\YÍ`]Ð__Í^]Ð][Ò`]Ï_]Í_XÏ`^ÐZZÑ]\ÎYZÎ^`Óa_ÎceÕb^Ò^`Ñ^\ÒZXÒ``ÎbdÏ`bÎa`Ñ`^Î^eÐ`eÐ``Ð^^Ð`_Ð^]Ð`aÕcgÓdaÒ``Ñ^`Î][Ñ[XÏZYÏWUÍXYÉ[\ÈXZÆX[ÊXVÊX[ËZ[È\^Ê^^Ìb`ÈXVÄ[ZÉWWÌYWÉYXÈ]\Ê[XÎ_^ÌabÊafË_aÍefÌbcËbfÍejËgfÊfjÌaaÎ^\ËbdÍ`_Ì`aËbaÏa_Ë\`Ð][Î^^É]\Í]ZË]`Î]\Ì]\Ê\XÍ[]Î`]Í]]Î^]Ê_`Æ`dË]^Æ[_ÉW^ÅW^ÁRY¿T^µP[·P[¹RZ´JX¹LYºQ^½VaÈYcÏbfÕhkÕqnÙwqÝ}tÜ}t߁uà‚tÞ†vá…tâˆuÞ„vá„qà†oß„ná†kà†mà„náƒnáƒnà‚iá†mÝ…pà€ná„pà„pá†l߁oàn߃mÞ€pàƒmà‚r߁pÜ~oÚpÝ~pÜ~pØxjØzjÕtcÔtcÖveçžsô¿ŠúË—ùÒ úרúÚ«ûÛ¦ýÚ¥úΘ賆ÂvfªLU«JS±NX¶PW»QTºVY¿VX¾\]À^^ÄZX¿[\Â^aÄdhÇbbÍdbÏhgÅ]\¤?Pu>Z9W;V=Z=Z@a"LaBfFdCf;iAd<b@d@f>e<ä„wä†mä„oãˆlâ‹väŽrå‰nä‰næ‹yæpæsè’tè’oêrépê‘péjèŽnçŠfç†jäiâ…mâ†nã†kå†jç‡lè†læ|eÞp[ÙdTÌ[R¶HP¤<Hš5Hž4I¢9Hª@P®@O±CN¯DQ´FN°DO®FL°FN­HP®HN°EQ®EQ°CO²JU²IS·FP·LTºNTºQX¼PU¿X[ÂRVÇY[ÆVTÄVXÇXXÈ^YÅZ\ÉVXË^XÌ_`Î^YÎ][Ï\ZÎcdÎ_\Ñ\WÐ\ZÏYYÌ^^ÉX\Í^\Ð\\Î``Ñ\]Ð[ZÔ`_Ñ\VÐ^\Ì\_Ê^bÎ`_Ð_aÐckÏgkÒbdÑ`^Ò`]Ð^^Ò\\Ñ_^Ò`^Ò^]Ï]^ÍZ\Ñ\ZÑ[[ÍZXÎ[WÎ[WËYVÇYZÉ^`ËXTÊ_aÊ]XÌ]XÌ]VÆXTÈXUÂ\XÃXZÉVWÈ]ZÈZZÊ]]Ì`bÌ`cÎabÌ`aÍdcÌaeËfjÌccÊejÌabÍ``Ê]`Ê^`Í^^Ï`_Ï`^Ë`^Í]^Ì^`Ì][ÐZXÌZXËZZÐ^_Ï_aÐ[XÎ][Í\ZÐ\\Ê]_Î_cËXZÉWZËY]ÄV\ÃQZÂY`¼T]¹T\ºPV¸JT´JZ¶M[¾UcÆ[fÌblÓklÔmpÔtrÙzqÛ~uÞ€uß‚tÜ€t߃sá„tà„tÞ†rށmÞ…oá„là‡rá†lß‚p߃oàoá‡q߃lÞ€oá…ráƒnâ‚làƒoàkàƒoß‚jÞ€pÞp߃qß~lÚ{pÛ{nÜ{oØzlÙ{kÖviÕtfÖrc݁fî­~øÆŽùИùÖ¤úئùÚ©üÛ«üÖ£öōܞy·^Y¨DO¯FQ´OT¸RX½SX½TYÀZ\À^^Â]_ÂbbÂ_cÌecÊfdÏfeÀVWœ:Js?X:W>V<Y>YC^D`FdDdCe>d@d?^>d=cAa<^;äˆvãˆnäˆoã‡gä‡råˆjå‡qåŠpæŒsæuê‘rêrèŽoêséoéŠjèŒfè‹kè‰eæ‡nâ„kä„jã‰rä‡oçˆlç‰næ„gä}gÝq]Öi]ÊXQ¶FK£6Fž0C›3G 8J§?N©BN°CP²DJµGM±KT°CK¯GN°FN°DL®GP°HN¯HQ²GP®BNµEPµKR¸NS¼QTÀSUÂSUÃSXÅZ\ÄVXÄVXÃVYÅW]Ç^^È]YÈ\]É\\Ë_ZÈ[WË]\Ï_]Ê^^Î\YÈ\ZÌVVÌ]]É`cÎ`^Ð^_Ï`_ÑabÑ^^ÐabÐ^ZËZYÍ`^Î`bÌ_aÑ^]Ò`cÐ`bÒ_aÏ`cÐ`^Ï\\Ó^\ÐbcÏ\[Ò]]Ô\[ÒZ[Ò[YÏZZÌZZÍ\]ÈYZÌTTÌ\^ÊXYËVVÊXXÊ[XËZZÇTSÉVTÉTXÆVVÅTWÂZ[ÅY[È\^Ê\ZÊ\\Ì`bË]`Ë_dÈbhÊbeÎehÎacËabÐ``Ë^^Ê^^Ì^_Ë^`Ï^aÑ``Ï`^ÏZ\Î^aÌ`_Í\ZÊ]_Ë^\Ê[^ÌZ\Ð]XÍ_`Î[XÏ[\Î]\Ì]bÌY^ÉZcÇV\ÄUXÀV_¼Wa¿Wd¸U`¹NVµJX¶HY¹KY¾R`Å]fÌchÒhk×pnÔwsØzsÚzqÜ~oÝ€uÜ€uÝ„tà„vß…xÞ†sß‚o܆tàƒjà‚oáƒhàƒpà‚pß‚láƒmá‚oà~jà~kâ‚jã†rá„oà„là€oÞƒsà€nßnÞ~mÞ~lÚzkÛzjÜzlÙyiÚwf×ufÖqbÕpaÕrbæ–pô¼„øË”úÔžùÙªúÚªüÛ¬üÜ©ûÒ™ñ¾ƒÎƒhªJR¦DO¯OX³PV·PT»RYÀUZºW`¾Y[À_dÃacÈdfÌhe¾W[>Nn@Y<X@U>Y?V=\Cb"Od'Pe#Kj%Ld$GdDb>d@b>_?^<`CåŠwâŠpåŠnä†päˆjæ‹päˆqæŒvètè’uè“véoèpé‰oèˆièŒkçŒfçˆkçˆjæ†lä†næ†må‡qçˆjéˆhè‰lç‚gä}fàp[ÖbVÈUP¸AJ¦:I™0Fœ2G£<N¦:K«BP±HR²JT²FP±AP³BL´EP°EP®DN¯EQ²EO°DN¯EN°GPµEMºFN¼NT¾PTÂQSÄVWÁX\ÃVVÅZ\ÄYXÆ\YÁ\^ÄWZÉ][ÉVTÆYZÎ]ZÍ]YÈ]^È\`È^`Ì[ZËZZÎZWÍZ^ÏYZÍ[]Ñ^`Ð\ZÔ^`Ñ^^Ñ_aÒ^ZÐ\ZÐbaÎ`bÐ^]Îa_Ð\]Ð`dÐ\^Ða`Ñ^\Ð\`Ñ^aÔ^^Ñ^aÒ\^Ó^bÐ\\Ð\\Ð^^Ð[[Í]aÊ\[ÌXYÎ[WÏZUÌYTÈTPÇTTÆWVÈWSÆWYÅYUÆVVÉVQÃXZÄVVÈXXÉWWË^\É``Ê]aËabÊefÍafÌbdÊbfÌ_^Ë]`Í_eÎ^]ÌZ[È^cË^`Î_`Í_^Î^`Î][ÌYXÎ^`Î_`Ì^^Ë^bË^ZÎ]XÌ\ZÍ][Ò^^Î]\Ê\^È[`ÈY_ÇUZÂTZ½R[¿S\¾S\¼R\¼PZ»OZ¹L\»NYÄT_ÆZdÎbdÐflÕopÕrnÙwsÚwoÚ|tÝvÝ€u܁xÞ‚vÝ‚tÞ†sß…sÞ‚oà…káƒlß‚oá€iÞ‚tà€ià‚làjà}iß~i߀lá‚pá…nâ‚rál߀jàlÞ~mÜ}nÝ~jÛzjÛziÛ{iÚvjÚubØtbÖtbÕp_Ön_Üdî­y÷ÈŽùÑ—øÖ¥ùÚªûÛ©ûÞªüפøȍå©z¾f[§EP®LR¯OX·MS¸QYºRZ¶T\¼Z_À\`ÅddÊd_Ã\\¥?Lt?Z=V=X@X>\>Z@^@d@fAdAa>b<`@`<a:_>_9Z>\>å†mäˆpå‰oæˆpä†käˆpäˆpçsé’yè”réxçˆjç‡lç†hèƒfè†cç„få‚eç‡jèˆnå‡räƒhæ‡oæ†oè†jçˆkç†låzfÜp\ØgXÇYU´EM¤7Kœ1H4I£:N¥<O«DT®DO²EP²DJ±HS¶HO±HS¯GO´LR°AL±JP®DO¯DM²IO¶FJ¹IP¼MR¼NQ¼RXÄUXÈXTÇYWÆTTÆTTÅZ_Æ\[Æ\[Ì]ZÌYXÉXXÌZYÎZZÌ\bÎ`_ÉYZÍZZÍ\\ÐYXÒ_^Ñ^bÎ`aÑ^bÐ^bÒ][Î\_Ñ\YÐ\bÎZYÒ`^Ó[ZÐ`]Ñ_`Ð^^Ð_bÒ`^Ò``Ò]^Ñ^]Ð__Ñ``Ð]\Ï\^Ò^^ÐZZÑ\ZÔcaÒ^\ÓZXÐ[WÐZXÏ[UÊWVÌZVÌXTÃXVÈURÆXUÄUVÄWTÃSRÅXRÂTR¾XWÆVUÈVWÉ\[Ç\]Ë^_Ê\`Í_bË_dÈadÎbeÍ^aÍ\^É\aË_`Ë^_Ê`eÌZ\Î`gÍbdÍehÎ[^Î\_ÏbfÍ^bÌ][Ê_bÍ\XÐ\YÎZZÏ]YÐ^]Ë_aÉYZÄY[ÈZ\ÈXZÄRWÂX]¾RV½S]ºQ\¸R]¶NY¶KX¸MZ¿R]ÄXdÎ\`ÑjjÒlj×qnÖtrØxpÙypÜzpÛ~sÜ€wÞ~pÜ„w߃tà…tßjß‚lá€jànàƒnÝ€rÞ‚lÜ€qß~gá€kà‚lß~lâ€nà~jâ‚nâ€qßmà~lÞ|jÞzfÛwfÛxkØvfÚtgØvjÙtbØsbÔqdÖq^×o\Ös_ä“oòº‡ùÌ”ùÕ¢øئúÚ¬úÛ§üܧüÔ›ð¾…ÑŠl®MRªGP®LU±MV±OV´RY¸SYºZ]À]bÉheÁYY¤>Hw"A^>V<V=X>Y>]A_BaHg"If&KdCb@_DaD`B]?^<^:]>\;ä‰pä…käŠläˆlãˆläˆrä‹qè’uê–ué’vèŠmæ„hæ€eæ‚gæ€hæ‚bå€eä‚iç†gè‹dç‡må‡hã…nä†læŠnçˆlè…nå|fÞub×bWÉVS±DM£=L˜/E3F£=M§=N®AM­CP°DQ´EN´EO±GR²EQ²BN²HR²HO°FL®FP±FO²FPµHPºLR»IR¾PTÁU\ÅRVÆVVÆVXÈVXÆXYË\ZÈ^[ÈZYÊ\YÊ][Ì[ZÎ\XÌ\YÊ^`ËZYË\[ÎZ[Ê\^Î^\Ï^bÑ]]Ð`bÑblÐ[^Ò^^Î\_Ë[]ÍZXÎ_bÐc`Ô^^Ð`_Ó^_ÑbcÒ\_ÒabÑ[ZÓ^`ÐZ_Ò[YÐbbÑbbÒZZÒ^ZÐXYÏZYÒ[\Ò_\Î[\ÎZ^ÎX[ËZ^ÈXcÆdqÄhrȇÇuzņ‘Ày~Àv~¾jp¾kr¼[`½X^ÁWVÅWVÆXWÉ[XÃXZÈWZÇ^^Ç\_ÇZ_Ë[_ÈX\Í^aÍ^^É^`Ï^`Ì^cÍ]`Ð^aÌaeÎbcÍ`dÎ\\Ñ]]Ï]^Í\`Ì`cÎb^Ñ[UÐ^ZÌ]ZÎ]`Î]^Ç\^ÊZ^É]\ÈY_ÃS\¾T^½Q\»R\¸VaºPX¶JT·JZºLY¼P\ÅT`Ê^cÐhgÔlkÕnfÖvqÙtiØwpÚzrÚ}sÚ|vÝ|nÝ€uÞ‚tÞ‚rÞƒq߁oÞ€l߀mà€m܁qÞlß‚pßjá€jâ‚kâ€iâià~hàoáià}hßzlÝzgÜzjÚwjÕuj×qdØwhØqeÚrcØtbÖrcØsbØp_ÖrdÜ{dì©xöÅŒùΘùÖ¤úÚ¨úÚ©ûܪýÙ£÷̐æ­}ÀhZ¨FR­JT°KS²PX¸U\¹RZ¼^bÁb`¼X\£@Nv@[>X?W=X@X>\A_AdCa FeFg"IgFaEa@dAb>^9^<`;_>]<æ‹xä‰qåŠså†nä…låŠtçŒnê’uìréˆhæ†hå€hä|cæ}cäz_ãz[ç|bä€cçˆlèŠjçŒpç‰lä†qå‹uèˆlé‰pêƒbå~lát_Ùj^È\[²GS¥;K™3Jœ2H <R¦=N­>O®CL²FQµFN³HSµKT´LU°GN²FR²GQ²FM¯EN°FP³HN¹GN¸PW¹NU¾RY¾QYÄUTÌXUÅWXÈZYËVXËZXÉZVËYUÍ[ZÊ[YË\ZÐ]\Í[\Ì\`Ì^cË[\ÑZXÎ]aÏ^]Òa\Ð\\Ñ[^Ð`bÒ^bÔ`bÒ]]ÎZ]Ð\]Ï\^ÒljÒ_aÐ``ÒbbÒdmÏ]`Ô\`Ð]_ÒYYÑ_`Ñ[[Ó^\ÒhfÍ_eÒY\Ï\`ÌZ\ÎbnÈ_fÍz‚ÈpuÅuÂs{¿x…Å„‰ÊžÏ”‰Î šÔœ•Î¡¡Ðš’Ѩ£Ô¤”ͤ¢É œÀ€†Áu}¾[]ÁVYÂRTÅTTÂVVÁVZÆXZÈ\aÌZZÌZ_ÍZ]Í\^ÎY]Ê_bË]aÏbfÎbfÎ`hÎacÍ_dÍ_cÉY_Í[]Ë]aË\\ÑZZÐYZÌ__Î\^Í[ZÌZ]ÌY_ÇYYÅV\ÂT_ÀR[¼Q\½S[ºR^¼LV¹KT¸HT¹NY¸UaÆU_Ì`eÒgdÕklÔqnÖsmÕup×toÚulÙxrÚ{uÛzrہxÝ€tÞ€o݃r߁lÞ‚pÞ~jÞ~mÜnÝ}oÞ€lÞ€náiâgâ€lâ€ià|hà~ià|iß|hÞyhÞvfÚxfÚvhØwlØvdØvjØrc×tg×udÕpaÕvdÖsdÕqaØqbãpó¶ŠøÈ’ùÓœúצúÛªûܪýÛ©üÔœóĈזt°RW­W_®OX³SZ¹U]¼Y^¼_a¼VV˜8Jq B\:V?ZBZAY<Z@]@^BbDgGh"Fe#IcDfAcE`=]<]>]=\<^?\<æŠuäˆnå‰kæˆlä…nèŠmè’yê”sê–pé‰læ‚eå}eäw]âw^âu\ßxdâw]âjèŠnæ‰hæˆnå‡mä†pä†réŒrçŠpé„hæ}dàs_Üe\Í]Z¶HO¦<Mœ6Lœ2J 9K¨<L¬=O°@L°BQ²FR²FUµFQ±JX®FP³EM´HO´FM³CN²DL´FL¿FL¹PS¿PVÀNQÂLPÄQVÈUSÇYYÇVWÇYXÊYZÌ\[ÌZYÊ^[Ì[VÌ\YÏ^ZÌ]^Ì^^Ð\^Î^]ÐZZÒ\\Ñ^\Ó\\Ð^`ÑcdÒ\aÏ]^Ð^_Ï[_Ð^`Ó]_Ï^^Ë]_Ð]\ÐabÐb`Ò`bÒ\^Ò^\Ò^]Õ_[ÒX[ÒZZÐ]^Î\bÐirÍivÇr€Æq}Æ~‰Â}ŠÃ}‚¾|ˆÀ~ŠÈ‰ŒÊ––Í’ˆÏ”Ï¥Î¡›Î£›ÎŸœÓ­Ñ¥˜Ö´¦Ù¨˜Ö°§Ú³¢Ó¤šÊ§¥È˜™Àv|¿`h¿WZ¾UX¾VY¿X^ÄV]Ê\_ÈZ`ÈZZÊ\^È]_Ê`dÉehÈdlÉagÌdiÌcdÌ`bÌ\^ÏaeÏZXÍ^^Ð]^Ï[^Î`_É[^Í\^Î^`ÌZ\ÇY^ÉUVÃX^ÁV\ÁNV¼OZ½NZ¼P[¶LX·IV·LX¸P]ÂX`Ì\cÐed×kjÖqjØsnÖqmÕtlÖxpØtl×{xÛzrÜ~pÜ~vÞ€pށpށqàqÜ{mÞ~nÞ~ná~kà}mÞjà€lâjägâ€gß{eá|hßzjÞ}fÝzhÝxdØwfÙtfÖvj×tdØvh×rb×paÙr`ÖscÖrbÖsdÕobÖubÚxeë¡wöÀŒø͘úÔ¤úبûÚ¨üÜ©ýÚ§üÏ—ì´Êxa¯NU«KT¶UZ¹U\Â_\¼TVŸ@Nq@X
:V<V>X:W>Z:`@`Ae!Ga@f$Id$Jb"Gd"FbE^>[:Z:\;a<^;`<`=æˆqæˆræ…nä†näˆtçŽqì”sì”uë‘qè†häbãt]ßt\Þp^ßn\ßqcáv`ä‚jç‹oèŽmå‹næ‰lçˆqæˆqèŠlè‹nê„iæhÞscÜgXÎZV´FL£:G™2Hœ6F£9I¨:G«>N¯?L°BR·FP²ER±IQ²DN¯DM¯EN³GP´HP¶HO´EN¸FK¾JO¾MNÁNVÁOTÂQVÇTVÈY]ÈWVÊXZÊVRÌWTÌ\YÌZTÎ`_ÍZTÌ\XÍ\YÊ[ZÊ_\Ì\ZÎ[\Ð\[ÑegÐ`bÑ_`Ò__Ò^`Ô^bÔ^^ÔacÒ\\Ò]aÑY^Î]`Ð^]Ò_`Ôa\Óf_Ô]\Ô\\Ó^\Ô\YÑZXÏZ\Ì[fÌivÄw†Ç{„É‚ˆÇ}€Æƒ‡Çƒ†ÀƒÂŠÂ‹Ê“Ò —͐ŒÌ˜”͘‘Ïž˜Õ¦šÔ­¨Ñ¨›Í£žÒ¦›Ò©ŸÐ§–Ѧ”Ò£˜Ö¯¢Û¶§Ú´£Ø³£Ï¥žÄ”—¼pz¼]f»U[¼NWÄWYÇUXÈZ[ÆY[ÆX^È^bÌ`dÈdjËahÌ_eÐ^bÎ`cÌ\_Ï^^ÍZ^ÎZYÎ\_Í\ZÏ\[Ñ[^Ë\^ÎXYËVWÅT_ÆVZÅS[¾W`½SX¾MW¼OZ¼MWµLY°J\·KV¸P\ÄV\Í_fÒfaÓmlÔrlÙtjØsjÖsj×umÕuqÙvlÜzmÚzrÜ{nÞ€sÜnÞ€q߀nÜ~nà€l߀p߀màkÞ|hà~oâ|gâ~gá€iàzfß|hàzhÝvfÞubÜwgÚudØrd×qg×sb×pfÖpfÖpaØpb×p^ÖpfÖn^Ön_×pbÖveß„nð°‚øÆ‘úКøÖ§úÚªüÜ­üàªþئøÉŽâ¡v¾c[²PXºX\¿]]ºXXœ=Lq>[;S:U<Y=Z<Z>Z?^?bDcCcBfCdBdEbA`EZ>X9Z:^8a8]7_=^;æ‡tæ„læ‡kçˆræŠmëpì’pê’lêŠmçhäx`àr\ÝlWÜiZÜm]ÝkYàw^ä‚gèŠlèŒhæoæ‡på‰lèŠoéŽsé‰iê†hå|dár\ÚfWÏWR¸EM¦8Gš2E˜3F 6K§<L©8L²BO°DN³GT´FQ±FL±IR­DR²KO³DM¶CLµGQ´GP·JP¾HN¼HPÁMTÃPRÅRVÉTSËVVÍXWÍZVÆUVÊWTÍZXÐZXÒ]YÐ]ZÏ\VÐYVÌYUÎZZÎ\]Î^\Ð_^Ò_\Ð]]Ô`]ÒZZÑ`aÖ__Ô^^Õ_\Ò`_Ð^aÐ]^Ñ^^Ï\[Ð]^Ò[ZÓ^XÓ]YÑ\`ÒZ\Ð[]Ð[aÌfrÆt‚Ãv€Æ~‚Æ}€Ê†ŠÃz‚¾s|Â|‚ÄzÃ|ƒÊŠŽÒ–ŽÎ™Ì›‘Θ’Ν—Ï£ ÔªÕ§›Ô§˜Ð¥œÑ¬žÍš‘ʝ”ÌŸ–ЪŸÕ¨”Ó©šÖ³¢×­œÝº©Þ¸¥Ø³¢Ð¥˜Â„ŠºdoºPWÀRXÂSZÃY_ÆX^È[^É\aÈ`dÉ\aÌ[`Ï]`Ð^`Ê\eÊ]cË]`É[]Î^_ÌW[ÎYYËZ^Î^^ÇX`ÆT[ÄVaÉUWÂSX¾T`ÀRX¾OX¸P^·QZ´JX²IV»IV¼MZ¿X`ÎbcÔgeÖnjØoiØxuØsnÕtqÕroØupÚwoÚwrÚxqÛ|wÜzsÝ‚rÞ}qÞ~nÞqß{lÞ{gÞ|là~jß{lß{ià|hÞzhá|hÞxjÝzfÞsdÝweÝscÜreÚtdØpeÖn`ØqeÖo`Öod×ocØp^ÔrdÔsc×scØn\ÕpcÔqdÖudç–qô»†úË’ùÓ¢úاûܬûß®þà®þÖžó֍rºYZ¾YZ½XY£GQuA\<R=U
>X>V>X=[>Z>`@dDfDbCb>d@`>`@\@\@[>^<`9b:\8Z9]8è„hæˆoç†iêŒsèrìoì’rêŽnè‡håeàsXÞlYÛ`RÚ^RÚeZÛl]äu^ä…gèŠjê‹iç‹mèŠnè‰pé‰lìkèŠpê†eæ€jãrZÜjZÎVP¶FL¤6F—.Cš6I£5J§:K¨<L°?J¬AP±CPµFN²AM±BP¯FL±FN¯FP³EM¹IQ³CL¶EPºJN¼MT¿RZÄVZÃRUÊTWÌVTÌSUÍWVÉZXÌYYÍYXÐZ]Ð[\Ð\YÎ^ZÑZWÎZXÎZ[Ò^ZÏbaÑa`Ð`]Ñ\\Ñ\\Ñ\bÒ]\Ö^`ÔYYÔ\\ÑXYÓ^ZÏUVÑ\\Ð^^Ð^]Ñ^\Ô\\ÐY]Î[cÊanÉ_pÀfxÆy‚È}†¾qÀz„ƆɄŠÀz„½u~¾tyÇ‚…Æ‚ƒÈ‚„ÌŒŒÐ“ŠÉŒ†Ì””ИŒÐœ™Ô¢•Ð£Ñ®¦Ð¦ Î¤ŸÎ¡šÌ¢Ð ’У™Ô° Ò¦“Ó¬ŸÖ±Ú³¤Ù°¤Ý¼ªß· à¸¢Òª¢Á|‚ºU^¿PVÃUZÂUZÈRWÅ\_Æ\bÈ^hÌZbÍ^dÌ\bËbjÊ[^Ë\cÈZ\Í^bÌ[aÆY`ÊZ\ÊW[ÉY`ÉSYÅX]ÅTYÀR^¿PX½R]ºO[¹QXºPX³JX¯IY·P\»NZÂZ`Ï``ÒhfÙlgÚshÛshÚtk×rlØsnØsnÚvnÜvnÙxtÚzsÛ~xÜ~uÞ~sÞq߀nà|lÛylÞ{nß}mÛ{lÜzfÜvfÝvfÝzfÞvdàxcÞubÜtcÜrbÜp`ÜvhÚsd×ndÖnbÙod×lbØn`ÖocÔse×od×pd×o`ÖnbÔrcÓkbØv`íªzøÄŒúИùبûÛ«ûܯþà¯þÞ¬ýҘÉuf¼\Z§DOz"D\@T?T>XAXD\D`@`DbCcFdEd Eb@b>d@^>W?X>\FbHb=`:_?^9\9`<é„mæ…lçˆpêŒqë“pí–qì‘lêŠhè€eäxZÜmUØcSÖXOÔ[RÕ`YÛo`â{bæƒfê‹léjèŽkê‹nç‹lêuëpëŒpé‡læ‚iâubÚfXÍZTµBI 6J–-F–.D¡4E£5Hª;H°?K¬>M®@L¯AM±DO²@L²DL²FO±ER°BN´FP´IRµIQ¸FO¼IS½MTÂTZÅOQÈTVÊSRËUVÈWVËYVÎUTÎ\\ÌXZÒ\]ÐWWÎZXÑYUÏ[YÎZYÍ`^ÎYZÒ[ZÒZZÒ^^ÑZ\Ï_`Ò]\Ò`cÏ\^Ó\[ÑXZÐYXÐXZÎ]]Ï^`ÊbnÍeoÍpÌpyÅjw¾`k¶dvÃtxË€Äv~¾zƒÅx~Å|~Év{ÇzxÆzzÅ‚ŠÈ‚Æx~Ç‚‡É…Ȇ…Ɛ–ʇƒÎ’ŒÍ“Ì•‘Ó Ò¤ŸÔ¨ Ñ¢™Ò¦–Ï¢šÒ©™ÕžÒª¡Ô¯š×§–Ó« ÚµžÝ´¤Ø´¥Ûº®âÀªá»¦Þ¶¦Ìžœ¹jr¼PYÀPU¾T\ÀX`Æ]gÉ[bÆ`iÉ`hÇ^fÌ\bÈZ_ÉZbÌ\`Ï\^ÈY`ÈZ^ÌVZÊX^ÆXZÆUXÂS[ÂRW¾NV½QZ½R\¼NU»R]¸JS´O[³HV·Q^»NVÆY_Ð^_Ôji×poÚndÚshÜvmÙukÙriØtmÙuoÛwoÚyqÙwqØ}xÙ{vÜ|uÝ|mÞ|qÞ}iÛylÝvjÞzgÜxhÜweÜvcÜubÝxcÛwfÜt`ÜthÛraÜrbÚtcÜp`ÙpeÙqcØk`ÖndØm`ÚkXØpbÖo]ÙpbÚp`Øo^Øo^ÖpbÕl^Ôl`á‰fó¶„úÌ•ùÖ®üÚ®ûܬýß®ÿà­ÿÝ©üÌ“ážy²MR~#CX<W@S>U=W;Z?Z@_CdBgCe?cEcAb@cAaBZ@Z?`F`B`B]:\>Z9Z;_<`:æˆoçŠmèpìoí–zì“mê‹mèƒlæzbàrXÚdTÐVKÍSOÎRN×dZÝvhâ~lä†gèŒlìŒléŽiêŽlè‹léŠlêŒnéŠné„hè}`ãvdÜh[ÌVPµCL¡4F—*B”/Fœ2EŸAX¨>M®@O©>M­>L°AN°BK°FS±@I¯CM²DL±?L³@JµJS´JPºFO¹JR¼OT¿NSÄQRÃTWÆTTÇTTÌVTÉXXÉX\ÊVWÊZ\ËZXÅZ\ÌXUÊW\ÇXTÍ]XÌ]^Ì\YÑ^\Î^^ÐZ\Ñ\_Ñ]^Ò]^Ò[ZÑZZÒX]ÍU]ÌalÉZkÍkxÎ~ŒÍ~ˆË~„¾rz¾fm¸Xe¼Ydºix¼hrÄnsÀpxÄrvÄx|ÅrwÈqwÅvzÈ‚ƒÊ}€É„‚Éxzȁ‚ʆ†ÈŒÇˆŠÊ”ŽÎ˜–Ì™‘Ï”‘Í–Ò¤—ÒœÏ—ŽÑ¨œÖ§”ÏœÒ¬œÙ¨–Ó«¢Ú¸§Ø®žÖ²¦Üº¦Ý¶Ü¶¢Ü¼®Þ¼­à¼¦à¹¥Öµ¨¾~ˆ·T_¹NV¿V_½[dÃV_ÄY`Å^eÉ\dÇV\ÇV[ÆXcÉ[`ÉY^ÇX]ÍZ\ÌX\ÇW\ÃTZÀRX¿R\ÅQWÁNW¾MXÀOUºLV¶MYµGT²FT²IW¸MZ½OVÅR\Î]`ÓfdÖmlØrkÜvnÚulØulØtjØsmÚsmÝtpÙvpØzw×wuÙxsÝ|pÞ}rÝ}nß|nÞzhÝugÝwfÛtbÝxhÜxfÚsbÜr_ÜveÜteÞudÛucÚqdÛp^ÙrfÚpcØpbØpeØn`ØpfÖl\Ùm`Øl^Öl`ÚoaØo^Ùo`ÕsbÔmaÔl\Ùq\ìŸsùĐúÏŸûתûÜ­ýÞ±ÿß®ÿà¬ÿÚ ñ¼ˆ©HP\>RAV@U?XAZAZ?X>bAeDf>d@bBd@eBdD_C^D[@^>aD`>]=\A]?\:_:b9æ‡rèŠmë’xì”ní•vípê†jæ€fãzfÞiZÐXPÆJJ¾EJÇOLØ`XÞrbã|dæ†iêmê‘pêŒkìŽoèŠmémëˆkíŒjê†jèƒgät[Þk\Ð[PµDM¡6H–3G“.G˜5M;N 7J¦=L¨CSªFP­GT¬AL¬AK±AJ®DM­AL²DK±EM´FQ³IS³HR¸KSÁJUÀMSÂLQÆTZÅSTÇUUÆRUÆXZÈZ\ÌUTÉW[ËTXÎWUÌ\_ÎYWÊZZÌVUÍ\[Î[^ÏZXÒ]`ÐZ[Ò]^Ð^\Î[^ÐUXÒX\ÑTZÕelß›ŠÐy€Ñ„Ê}|Ãv{¾ow¾biÀbiÂ\c¾\i¹_n¸dlÀlwÀlvÀnsºfm¿kp¾jrËzxÇqwÅutȁ„È|{Ê…ˆË€~È„…ˆ‚Í“”Ґ…Ï’’ÍžšÑ›Ê”ŽÌ˜—Ò¢‘Ô¤—Ò«¡Õ£‘Óž×´¥Ü®—Ö¬™Ø¸¨Ü±–Ü°ŸÚ·¨ßº¢âº¡Ý´¦Û»°ßÀ«ä¾¦ÝºªÇµguµR_¸Xc¼PXÂS[ÂR\ÀWZÂX_ÉYZÂV^ÅX^ÆX^ÇV\ÆV]ÆX^ÆX]ÄV]ÂT[ÂPTÁPXÂPVÀQWºNX´L\·LW³KU²DR°EQ´KX¼OXÉRWÎ`hÖedØpiÚriÜtnÜvnÚul×tiÙrjÚqjÚwjÜwmÛvnØsmÚvrÜ}qÜ|rÞzkÞ|nß~rÞzlÜtdÚqcÛtdÜqeÚpbÜrbÝr`ÜueÝtcÚvgÜqbÜr`ÜpbÙqeÙpb×pgÙo`Øl`ØpaÚp_Ûn_Øo_×pfÙrcÛo`Ørd×o_Õm^Õk^à}dò±‚ûÅ‘úÒ üبýÝ°þá³ÿä³ÿÞ£ò¾€‘.CM	8P>R=W?V@\@Z=\>dBhCc@bBbBdE`=]?Z=\B_@g#I_@^BW<^B`?_6d=f:çŠrèrë“pí˜vì’qêŠjç‚håx`ßp]Õ^OÄKM°@J´@JÈUPÖdXÞugä~fæ†dêtìlëŽmêŽjêmêŠlìŒmê‹oë†iè~hãvaÝf[ÎXS¶FO 6J”,D0F™2J›8LŸ6H£:L§=L¬=N©@Nª@Nª?K­AN¬AM¬BI²FM²CL°CL³FO¶EL¸JQ¹LV¼NXÁPVÄQVÄTVÄPRÅTYÆWYÃZ^ÆXZÅTSÍXXÊVUÌZZÏXVÉYZÎZVÐXXÎ[\Ñ[YÐZYÐZ\ÐXZÐXXÎY\ÐXXÎw‚Ïb`Í`dÇaeÈmqÆllÀgj½cj»^jÀbh½\g¼[j¼\h´`r¿gnÁnzÂlp¾nvºfr¹erÂhpÅw¼htÅrxÆy|Ê~}ʈˆÈ„ÅˆŠÌŽŠÐ–ÍŽ†ÍŽ‡Ð˜É“Í ›Ðœ—Ц Ö¬Ñ–Ò²¤×²£Õ¬œÖ± Û¯”Ö¥–ײ¢Ý¸žÚ®™×±¥Ü¼­Þ¹£Ý¸ªÞ¼°àÁ±âÁªÞº¥Õ°¨½‚ˆ¯Xf¶NZ»NXÀPXÀV]ÄT\ÃSZÄT[Å[`ÆV]ÇW[ÆUXÇU_ÆWYÂV[ÀUZ¿TZÃOW¾MS¾PZ¶KW³JY´LW²FS²GU²@J·KW¾KUÇT^Ö^`ÖhfÜlbÜqhÞwjßvnÛtmÚthÙslÚsjÜtnØwrÚvoÚwrÚunÛvnÛ{uÝxkàylÞ}oß}qÜwhÚuiÛrbÚn`ÚnbÝraÝsbÜsbÛvfÚtcÜqaÛsgÚp`ÚrbÚufÚpeÙpcØodÙpbØpbØo^Úp_ØsbÚqaØthØqfÙl_×oaÕpfØsfè–sø¼ŠýОüتþÞ°þâ¶ÿâ¬ýԐÑ|_Z8P>Q=T>W>Z?\@_?bBfBeDdAdCeA`<[<Y>Z>`@d!Db?]<\=X;\9`;b:hAf=éŽmê”ví›sî—rëvê„då€dãw^ÚiXÌQK¶BF¤3C²9EÈRNÕbVÝsbä€fç‡hìŽnêŽhêmèŽléjëŒníŒnìŠmêŠnè}hãv\ÝfZÏWO¶CIž4G+BŽ-C–2F›0E¢4G¤:I¦?N¦?L¦@O¨=J¬CN¬AK¯DJ®CM­BL¯FS±FT·FN´HSµHN¸MV»FK»OVÁRYÇQRÄTWÄS[ÃVYÉSRÈUVÇRUÊZ[ÊWZÇ[]ÈZ\ËXWÊW[Í^_ËZ\ÑZZÎWYÎ[^ÏWUÐXYÎV\Ög_ìšrÊNMÀV[¾_d¿\d¼_c»`e¼X]»]g¼\e¹\f¾`n½^cºbl¾ms¼nvÁlp»ip¸doºhpÄptÀsxÂprÄpwÆtwÆ|~Â~…Át|Ë…†Ë„~Î’‹É…‚ĉŠÌ–’͍ŒÓ§—Ó›ŒÐš–Õ¦˜Ù®ŸÙ± Ö²¥Ú°œÖ¥–Ô¯£Ú²˜Û²ŸÛµ¦Ú¶Þ°–Ú­¢Ú¸®à»¦àº¨Ü¸¬Ú»±Ü¾«â¾ªÛ·¢Ã–™´cm²LX³NX¸NW½NX¾T\ÁYd¼T]ÅU\ÄSXÃTYÅS[ÇSXÂTZ¾S]ÀTY¾Q\½NVÀOV»MX´P_·GT´LX±FS®FT¶FR¼LZÁS\Ï_aÖffÚnhÜtiàvjÞyoÜujÝtgÛsjÛsjÜqiØtnØrjØtnØsnÚupÙtnÚunÞ|kÞ|qÞyiÜxoÚpdÚpbØnaÚndÞo`Ûo^ÜpbÞqaÜvfÞp`ÜoaÙqdÚscÛrdÚpeÚo`Øk`ÛpbÙn^Øl_ØpaÚueÙrfÚse×tjÚrdÖpcÒqe×n`Üykï¤|ýÊ•þצÿß²ÿà­þÕ•ê¥p‚)AL:Q>Q9U=X>YB^@dCgGfCcBdBhBb@[:Y<X<]@a@c@`BY=Y:\:]:c<g>c9\8ì’pë™xîœrî”mì‹kéƒiåxbßq`Õ`W¿JI¢:J–+B¯>FÇQOÖe\àtaæ~eèŒkéŽnìkêŽlëjçqè‰jì‰kêŠnê…hçzbãrYÞf[ÐVN¸FNœ2E-FŽ)C“.G™4HŸ8M¢>N¥;L«:Gª>L¨@K¯>K¬@M­CO«BQ¬EP®DO®EN²HT´BN¸GM·FR¸DNºNTÀNVÁPSÃQUÀRXÂVVÃQTÅPSÅTXÊ`cÊZ[ÈXXÌ\[ÉZ[ËZ^ÎZYÏVVÑZXÌZZÌZ[ÌXXÌQWÏXZåœ}Îo\ :T¶NY¼\cÀZbº`i¼X[À^e¸X`º`jº[eº\e¸Wb¾biÂjpÁflÃko¼eg¹fp¼jr¾lvÀnuÁkoÆs{Ànw¾x€ÄrtÅz‚Ɔ„ŃƒÄƒˆÈŒˆË‰‰Ò¥˜Ôž”Л•Î£šÔ¤™Ô¦šÖ°£Ø®šÕ£–Ø´¢Ú´£Ù¨”ر¤Û¸¤Þ®—תžØµ¤à¹ Ý¶£Üº­Þ¿°Þ¼¦à»­Ú»¬Ú¼®Úº¨Ýº¡Ô®¡¸t{­N[¯FT´IV´OZ¸U`ºPW¿NS¾RY¼RXÃR[ÁTZÂRXÀT\¾PYÁLV¼OY¸JU¹LY´LZ³KX¸HQ®FR°AQ³FVºNZÅW^Ñ_aÙjfÝmgÞtlâwlàxnàylÞxlÞtfØuqÙrmÖspØtlØqlØrm×pmÖpi×upÙunÞxpÞ{kÞ{nÚrbØphÚlbØn`ÝnaÜneÜp`ÞsdÞtbÛteÚpdØoaÚrfÚodØqaØpeÚo`ÚpbØohÙoaÚqeÙsgÙteÙp`ÚtdÙugÖrf×ufÖteØshâƒmù¾ˆÿÒžÿÛ¥ÿÒ–ï«xŸBHT=N>Q>T@T@V<\Bb?gCf Fd@f EgAhC`BX>Y=]?cBbA^@X:Z?[>`;d>k?d>T2I2ì“rî–wî•wìré…jæ}fâtdÚdVÊTR«<F—*B–*B¨;IÅRMÔbZÝo\ä|`èŒlêŒkì’jëqêŠlêjèŠmìŠlêŠlêƒiè|bâmYÝcUÏUQ¶CK4D)BŽ)B˜2F›6H :K =L¤@N¬<L©BPªCR«@N¬AO©DO«BP«DP¯GT°CL®DP´FN´HPµKT½LS»NU¾PUÁPSÄNP¿OUÅRTÄRRÄVZÄTVÆWYÇV[ÄVZËUWËZYÎZ^ÌVYÉ]_ÐZXÎZZÐZXÐXXÏ\\ÐXVâuXÂRT²IZ½PX¿V_ÄVYÃ^c»V`½Xb¾_iÁei½[h·Yd¸\dºdp¼dnÃilÀkr¸fq·fq½go¾jsÂouÆrvÁjnÄknÅpuÅxvÃx}ÄvyÆ€|ˆ‡Ì‰†Ð’†Ð“‹Ò¤ Ó¢Ó ›Õ¤˜Ö¤Ô¦šÔ¬ Ø¬˜ØªØ¯ Ø°šÞ°ŸÙª¢Ü¹§à´ŸÜ¯œÜ´§ß¸¡áº¢Þ¸¬Û¼²ß²ݼ¬Ú¶¦Ú½³Ü¾µâÁ¬Û¾¨Á–š¬Wc±DT´MX±JU¶GP¹JS·LW½QX¾OWÀQZ¾PXÀOXÂOU¼N[ºLU¶OZ´O]²HX¶JW´JV±HR­ET´GU¹NZÄP[Ò`eØjdßpiÞvnâzqâ{mÞzmßxqÞwlÚtjÙtnØrjÖro×mhÔtmÖnkÔokÔmfÚnhÛrlÝ{mÞzpÝsdÛtjÛpeÙndÜo`Þr`ÞraàsdÞugÜteÛpdÛr`ÛpfÜoaÜqaÛpd×nbØqhÚpgÙpdÚrjÛqhÝtfÚnbÛseÜtdÚukÚugÝxlÛxnßxjó¢~ÿÈ’ÿÌŒï§q£HNY?Q;T>V@U>V<[=\=dAa>d@cBfBgA`AZ@\A]@`BdA_AV=Z@[>\=bBi"Cg!DW9F3D3î•~î”pî“oìŒkç„hçx^ßlYÒZT¸FNš.>*C–0F¬?LÈRNÒc\Þp\ãyaç‰gìŽlì’jêrê‰nêŒiìqìŒné‹mæƒkæ{`álXÜfXÍVQ³EK›/D(CŽ(B“2J›8L¢4G¢;R¢@RªFW«HVªGY­HX©BP­GR¬COªAQ­EP¬DR¬IU³DR´KV·JT¸IT¼NRÁRXÄTY½JPÁMQÃSVÁSXÂUXÂUZÅVZÇUYÆUVÊUZËX[ÊXXÌ\[Ì[\ÐYXÎWZÑZ\ÒXYÏZVÐpg»NR»MU½RZ½KVÂV]ÂW_¿V]½V_½Za¾Z^¿_h¾\e¼\g¼\eÀdmÅlpÃnqÀks¾en¾ku¾jsÄovÆorÄirÃacºktÀt{¼krºjtÈ{Êyż…Њ…Í’ŠÓ—‰ÔšÓ¤—Ø¢ŽÑšÒ­ Ø¥‘Ï –Ó©£Û¯˜Ö£”Ô¦žØ¸«Þ¶£Ü±ŸÛ¸©ßº¥ß±žÛµªÞ¾¯á¾¥àº§Ý»¬ÛÀ²Ý¾¦Þ»ªÜ¼®ßúâóáÁ©Ë¡šªYg¦CUªBP¬HS¯HQ²JS¶JR¼MT¼PWÀRX»NX»PY¹NX¸NZ¶MV³K^´IVµJU³LX¯IY®AN²FTºJXÅR\ÑZ]Ùihßnfßwnâzräznãzjâynß|qÜyrÜwnÚrlØmiÔjlÕlkÔjhÓklÒgd×lhØoiÛwkÝylÝvhÝthÜpbÜpbÞp_ÞreÞofÜsfÞt`ÝtiÜpaÛo`ÙpiÚqbØpfÚpdØoeÛsiÜrcÛrgÜteÚpeßsdÝtgÛtjÜtjÜwiÚujÞznß}pà{nî’uù´}æŽi›<FX<W?WBW>V=X<Z>]>`<d<`@d@cCd?a@Y@ZBcFeDg@bB^EX<]A\@d>n(Jp,ObAI
-3?0R9î”zï”tïlì…eèfâr\×cWÄTS¨;H”.D(Aš3E°BJÃQSÕbXßp[ä|hé‡jênì’pë’têŽtêŽrê‹në‰lê†gé„jç{bàoZÙg\ÎTP²BI™-BŒ,BŒ(@”1E6JŸ:K¢>P¨?O©DV©DU§AR¨L^§DT®CNª>M­BN°@M¬EQ¬?N°EO²GR´KU·LXºKR¼PX¾NXÂTZ¾TZÀRUÃQYÂTWÆRTÈXYÆUXÄTTÍUVÊWWÌTXÌZZÐXXÑYXÍUVÎV[ÏSW×ppÕdWºMU»Q[ÂSVÀVX¾RW¼PW¶MVºSaÁU\¸Vb¿^dÁ\gÃbiÁ^bÀ`iÃjmÀ^a¾gn¿mpÁjrÆljÌmoÈnmÀeo¼enÁrzÈnrÉ|yÇrpÈ{€È~|Àw͍†Î†‚ΖÓ˜ŠÐ‘ˆÔ£•Õ™ŽÓœÖ­¡Ø°Úª–Õ¨ ×´¦ß¸ŸÜ±¢Ú¶¨Ý¹¦Üµ¢Ûµ©ß»ªà¸¢à¹©Ü»®Ý¿®ß»¥Úº©Ù¹®ÚÀ´ÝÀ²àÁ³à·áõãÄ­Î¥š«bož>MŸBN¤>J¬BN®DNµIR³LW¸R[¹KR¹PW¸LX´JX°HW¶JV³L^¹PVµIU²ET±BR¯FV¸IXÁS\Ð^e×jjÞqnàvhã}nã|kã|mä~pàylßzoÞtlÚsjÙmfÔhdÑfdÍfiÎcfÐb_ÒbaÔieØpiÜxpÞymÞviÞrbÞobßp`ÞpeÝqeÞtgÞuiÞsdÞq_ÜpeÞpdÚp`ÛoeÝobÙrfÝqfÛshÛrcÛsgÜrdÞvfÞqbÜvhßxjÞyiÝxjÞwjãnålç„lÖo\’2C_AU?ZBVAV=Z@[?a?`=b@f>e>f@f;b>[<U;^Bg$JdC`>ZEV@Z>bEbCq)Ls.QfBT;D6K;E]ï•xî’rì‰nèƒlæxdÜl^ÏVS·DH1B“-D–*Bœ4F®BOÄVXÕdYÝn\æ€hè‰hìlî‘nèqìsêsê‹mî‹oêŠiè„iæxaâr\ÛbWÊVU°CK›,BŽ*D*@—2Gž6H¡:M¤@P¦=M¨BTªAO«DR¬GS¬CQ®GSªBR°DQ¬BQ«BO®DP±ER·HR´HR¶MV¸KT¼QY¾PWÂPVÂPZÁNTÀPUÂSWÆVUÌVZÈTVÇUVÊVUÈX[ËX\ÈZZÏXYÐYVÎWWÍW[Õf`é§~ÇPQ½MX¼SWÂPS¼OU¹MV¶KW»PW¼S]¾V]¼Y[¾ahÄfk¾[a¼`gÆhe¿_d¼]bÂgjÇlpÄjlÄopÆnp»jwÃkoÆuxÁmsÉppÄlsÂwzÃqxÀ{…˃„Åz|ȍ‡Ê‡É–‘ϐŠÎŽŒÐŸš×¬™Ø ”Ö¨¡×°ŸÜ¨—Ú­¢Û³¤Ý¹¡Ý´£Û²§Üºªß¶¢Ýµ¨Þ¼±âÁ¯à·¢Þ¼¨Ü¼®Ûº¤Þ»©ß¼«Ü¾²Ü¾±Þ¶¢Ú´¨Ý¾µßƺҲ´¬~Œ©t¢Sbž<K¤@O«DQ´GR´O[·KV¸OX·JS¶JU²JX·HS³ETµJZ´DU¬DU¬BT¬CX¸KWÁN^Ñ^d×npßwsáznä|lå|lå‚sç€rã~oÞxpàwjÜxn×ohÕebÏbdÉ\`Å]dÈZ[Î\`Òbg×njÝrkÞzkÞvlßseÞpeÞn`ßrcâucâudàxjßwbÞl_ÜnbÜpbÜn^ÚodÜqfÛpfÜseÜtdÚshÜreÜtjÝzoÝtdÞvhÞxhàweàxjâzlã€pè€hØkb™7J`@X>V=V<Y=V:V9Y?aAg Ch!Cf?d<`=_:Z=X:^>dAgBdF\GZAYD]BfDh$Gr+Ng"EV:J5O;„:SËurîvìŒpê‡læ~fäq\Ù`TÃLN¦5G˜9M•2J“,D˜4H®CNÇUSÔdXÝq]æ{bèŠhëiìoìjì‘pënéŠrë‰kë‡iê„fæ|cát`ÚbUÉVR±@I›,DŽ*D*D˜1Fœ4F 3I¦@R§?L«GY¨@M¬>P¬@R¬@MªDR«CR­CO­DO®ER¯DO°FNµHPµJQ´LT³OTºMT¿NSÄSRÄT\ÀQTÁQVÃRVÆZ[ÄUVÆSVÄXZÈSXÊX\ÍVXËSVËWXÒ\\ÌYXÐTZßwpÜmUÁNUÂQP¾NSºIP¸JS·IP¸P]¿QV¾X`¾Y]¾T\Â]a¾X_¾ciÉbeÂ\aÀ_cÂflÂlnÂei¼hrÆchÌnnÍquÅpqÈprÃjl¿lxÃsz¾ekÇxzÌzÈ||Í~zÇ€|Í‘ˆË‚~Ëš’Ô¤”Ô™’Õ¦Ù­–تŸÚ©ŸÙ³ªÜ²œÚ¨Ú±¢Û¸¤á´œÛ°žÜ·¬ß¸§àºªÞ¸«Ý»°à¼§Þ¸¢Ö¶§Ø»¬Ú¸¥Ó¬¢Ñ°¯Ò½¼ØÅÇàÎÈæÔÍëÙÐæÛÐà×Ëξ¸«`hœ5H¦;M¬DQ±MZ¸IR±KW³LW³HP®DT±HTµGU±IV°FX«FXªBY³EV¸K\ÀS^ÒbdÖnmßsmá{på~nä€månæ€nâ~sá{nà|sÝxlØodÓd`Ì\_ÂV^¿PZÀTXÅT\Î`_ÖedÚpiÝulàxkßufßpdàrdßsgàrbâxgßvjßtdÞn^ÞneÝpcÝp`ÛpdÜpcÝrlÞrgÝrdÝqfÞreÞukÜqeÜrhÝuiàwiáxjâ{häoæoÞwh¸KPk@XAU@V?W=W<V:\>bDc?fBc@h@f<d:\>Y=^AeCe DfG]BXC\A\@`Dh!Fr2Sh$HS;J<N<y0Nºioà‰{êŒvê‡mèiäwdÜj\ÌVR´?G™.D˜3G›6I™1E/F¬AMÈTSÕbZßqbæ|cé…hëŽnìsì’pîpí‘uìnìŠhê†jè…dæ~dár]ÚfYÊTP°ENœ2F(D/F–2FŸ:L 5J¥?M§FT«H[¬BQ«@O«EQ«FQªBQ¬DT¬AP®FT°CO°DO°GR´GU·IPºNY»PX½TYÀU]ÁTWÂNTÀPRÂPV¿UXÀQXÊXYÈTUÆV]ÈV\ÉYZÎVZÊVXÌVXÒXXÒVXÒ\Väx^ÅUWÀSS¼LR¸JT·FO·LX¸KS»U_ÁW]¼X]½SX¼U\»PXÃbfÂZ\Âdl¾XbÀbgÅhm¾dlÃdh¿afÂgmËlnÁilÄnsÆln¾jrÉrpÂrxÂsxÇz|ÌzzÍywÍ€Ì|zË‹ˆÎ–Ò”ŽÒ—“׬–Ý©šØ¦›Ø´©Ý¶ Ü¬›×§œÛ·¢Ü±Û¨šÛ·§Üºªá·¦Ú®¤Ü¿³à¼¦Þ³¡Ú·©Ú·¨Ö­žÒ­©Ò¸¼ÚľäÎÃèÎÂêÐÃìÓÅìÓÇïÖÆòÝÏòàÑòàÉÒ´­ŸDV›4LŸ8J¨ER®FT®LV°HP®EP®CQ±CO°FU±GV¬FX¨FX©>T²GX³K\¼O`Ð_cØlhÞukâwlå{næ€pä~lç€pä|nãzkæ{lß|rÛriÕgbÌX^ÃPX´DN³JV¹IVÄTZÐ]^ØkjÛoiàwnàxnÞtißr`ÝrhàrcârdàteàsdÝpfÝn`ÝrhÞpcÜreÜpdÜodÞqfÝqeÝpdàobßtgßrbßvlàwkàwlãznâ~qæ€nä|gÂVVz'HXCU@X>X@V8[AX<`@`>d@h@c=c<`8[:Z<]<d?jEb?_HVDX@^D^Bf$Kq.Py7Yf FO9Q@m'N¡YiÓ~täxë…fè†næycßn`Ô^W¿MO :K™.A˜2G˜3Hœ5Gž3H¬FRÉWTÖd^àtdå|fé‡gë‹iìlê‘nìŽnìpëŽmìŒjèŠmæ„læ|bàq]ÚaVÍRL°@K›5F*DŠ&B”2H4J¤8M¤<L§?Sª>Nª?P¬@O«?N­FR¬ER«@N®ER¯FR®DQ¯CO³ET³JPµLV¸MVºLSºNU¾QXÁRW¼PVÄPUÄV[ÄX\È[\ÊX_ÊVWÇ\bÊVZÆ\ZÈX^ÈTTËTWÐZ\ÐZ]ÔgbÐ[VÄQR¼KR¼HPºMXµKT¹NW½O[ÀT]À^^ºRX¼RX¼X_Æ]cÃ^dÃ\c½\d¿]bÂ^b¿em¼dl¼cjÀ[bÀjlÅdoÂlrÆhlÊqoÅjiÁisÃhlÂrv΂ÈllË|xÏ€}ËŠŠÎŒ‡É~‚ÓŸØ¡Ö ”Ú°¢Þ²šÜ©žØ¦œÛ¶¨Û«šØ§œÙ²¨Ý¸¤Þ°žÝ´¤Û¸¬à¹¦Þ² Ù¯žÙ±£Øª›Ó°²Ô¿½àËÂåÏÃæÌÄè̾èÔÆæÎÅèÎÀçÑÆêÓÄîÖÆïÞÒôáÎïÚ¾»|’1Hš4K¡>M©CR¬GT®DQ®HV®CT¬FT¬FW­BS¬DT¥DV¤@V­DXµN\¾Q^Ï`cØgbÞsláwiå}nä~lä}kæ€kä}nå|nâ}qà|oÞrfÚg`ÌZY¼JP¬?J¤;M§;M³IXÅU^Óca×kmÞtpâxlàujàsdÝoaàpbào`àtcârdßpbÝpdÞncßqdÞodÞqhÞuiÝqgÜtiÜreÝrdÞrfàsbásháwháthâzlå€næzkÐ_Z.JZ>VET=X?X<\>^>`>c?f Da>e@f>b@]AX=Z=cBjBhC\AVAXBX=^B`Go-R|:[t5XdHW=o)K XhÅxzÛƒuä’wéˆvèhâtcÛdVÊQP­@K™.Fš0Hš4H™4Gš0Hž5H®CNÄTUÖd\àq`å|bê…fìŒkì’kênìqì‘rêjêtè‡pèƒkæz`Þm[ØaZÌOP³>Kœ0F+C+Fš2F 6I¤;L¨>Rª>L¬<O®GT­DT«DP­DP©CP«BP¬BN¬AO®DT®HQ²HS²ITµJRºNT¸OZÀOTÀNV¾RTÀRVÀPTÃRVÅSUÄXYÉVXÆTXÄZ`ÍWZÈWXÈTYÎYXÌXWÐ[\Ò\]Ñ]VÈQT»IN»LQ»NTºLU½NU¼T_¼U`ÀZbÀWa½RY¼[cÂ]`ÀX^¿[fÀ[^½Z`¾Z`¾_d¸T]Àcf¿`dÀhnÂckÆru¾bkÂlqÃbdÄnrÉhkÄlpÊrqÇprÉopÇimÐ~zÉzw͈„Ô•ˆÔ…Ó˜ŽÚ«—Ü® Ö¢œØ±žß³œÚª ×¬¢Þ¹«Þ­šÖ§žÚµ¨Ýº¢Û®™Ö§›Ò ˜Ò¨¡Ò´´ØÀ¼äÌÂçÏÂèÏÄæɸåÌÀæÌ¿æ̺çÐÂçʼèͼéÒÃêÐÃîÙÉïÞÐðÞÈØĸ¤^l0Iš7J¢>N¨FS«BQ¬ES°ES­DP¦BS¨FVªDS¨BV£=U§BV´KZ»P\Î`dØjhÝrlâuhäzjåmä{iæ~lå|mâznä|oàzrÜskØljÏ_`¾NW¢8J•1H–2J¡6MºJXÊ[_ÒhiÜnjÝtkàvpßseÝrfàobâreàufár`ÝpbÛoaÝofÜrjÝpbÝndÞpfßqhÞvjÜrgÜshßshßsiâulâviãviåtæ€pÛmc¢<O`@T>T?U8Z8Z8[;b>c>d@d@d@f=b>`@W<Y<b<i>i?`BU?ZBYB\AcFi(Or-Ts0Tn+P`?p&J›SdÀprÒ~wÙ‡vß‹uè|dãybßm^ÑZQ·EO 5J”.Dœ4K4I5H6J¢8H±DOÆTTÒbVßq_å|dè„fënì‘lì’lì‘pìŽnênëŒoéˆmédåz_àn[Ø`TÈMQ®MLž5J+E,F˜2HŸ6H¥8J¦?N§@N¬?QªBP¯@N¬BO¬CT¬@P®L[®HW«DR®FS®AN³HU²BO¶JRºNV¸OWÂQT¾TX¿QTÃQXÁRZÃVYÄSVÆX[ÊTXÊWVÆW]ÌVVÊZ[ÊVYÌ]XÌYYÏ[\ÖaXÉPRºHP¸MT¹IQ½KRºLT¼OTÂX`¿V`¾V`¹T`À]bÂ\cÀVZ¿Zb¿Zc¾]b·T^¿^]ºXb¼al¾`gÄfgÁgnÊjmÈlnÌroÈipÊvvÄcfÂprÇklÃqvÇrsÄjnËz|ÎvwÍ€Ò‹†Ï†…Õ™×›Ž×œŽÜ¯£ß®˜Ü©šÚ¬¡Þµ¦àº¥Ý°¤Ù²¦Ú´œÜ¦Ô¤–ÎœšÏ¤¨Ñ²¶ÞÄ¿åÌÀæÎÂèʹæÌÀå˽äɾäÉ¿äÍÂäɼæ̺æÍÀäÅ»æʵéÐÃéÓÈîÛÐïÛÍðßÄд­—BT”2F˜7LŸ<M¨>P¦>MªDR­@O¬@Q©DV©@Q¨AU¨?R­>T³KZ¿PYÍ]d×efÝnjàxläpä€mâ|kä{mãznã~pä|páxpÝqjÙleÍ_\¼NW™:J„%C€"AŒ(D¨@RÃTZÎceÕhiÛrlÞvjàujàtkàn`ârfàveàtiÞrgÛpdßqdÞrhÞn`ÝndÝrfàthàobÜpdÞqfÞsjàtjäxiâvmåylénßvi¹LPmCU=U9T
:V7[:]@b?d@f@fBc>f@c@`<X>W=_@d>iBbAZ=W@\?^B`Bg"Mq1Wv6[l)Pg%Jz1R˜Nc»mrÎxÏ}tÖ~uÕ†yèvaâr^ØaRÃLL¤7G›.Bœ6L¢5H¡:Lž9Jž1D¢;N®BLÅTVÔdXßo[ä{hçˆnëŽhîpìlìrëŽrëŒnêŽnêŠmè‚däzbàn[×bUÉTR°FMŸ6J‘-E2L˜3G:L¤8L¤:L¦<N©@Q®@M®CP®BN«BP¯FQ®JX°DQ°BQªAR®DQ²DN²HT¶JRµKR¼LS¾NUÀQTÁPQÆPOÅPUÇRTÃRVÄVZËVWÊUUÊVVËVWÊZ^ÌYXÌ\[ÌZ\Ð]YÇW\ºLT¸FP¶HR¸HNºPZ½RV¾T^¿X`¸MX½XaÂ`hÂY_¼X_¾[bÀZaºU\ºZa¼U]¸V^½^fÄbfÅghÄkoÄbbÆntÎttÆhnÌolËlnÇooÈilÄrvÉzyÇosÌwuÉkqÏ€|Ö†€Ò€€ÔŒƒÔ‘‹Ö˜‘Û£–ݪ™Øš”Ù®›Ýª“ܨšÚ¯ Þ·¢Ú­žÏŽ‡Ï–”Π¥Õ¸¹áÉÄäÌÃêÓÈèË»æÈ»åîäƵäɺå˾å̽ãǺäÈ»äƹè̺æÏÂâƹèʶéÓÇëÔÆîÛÎìÚÌêØ¿º”—”:N”-Fœ2F¡;L¢>O¥CU£@T§AS¦F[¢@R£?T¦:O©@T´IXÁPXÏ[_ÖfcÝokàznä~pä~mázmä|kä|lâ}oâ|qÞzsßqkÚlfÑbdºQWž7M~=q@x=ž4I·LWÊX\ÒfhØlmÞumàvmÞvgßriàocÞofáreßsiÜndÜmdßtlÝoeÞphÜpgàrhàpfÞnbÞodàpfäneæpfäxoê~lè|mÈc`†%@[:R9U8X
6Y
:Z:^=eBgCgChCdBgCaBY@T
;\Bd?hBa>\@Y@\B_Cf1Vh2Zm'Rr6Zp1Xn*Rx2T™Lc·lsÉ|xЁwÌzuÍzsÖ}râq^ÜfVÊTP°>Jœ2Iš2Eœ7K 8I¢8G¡4C2Dž7K®EOÃTVÖe[Ýscä{bæ†péŒnìŽlëoìŽqëŒlêqêqèŠkèeãy_Ýo\ÖbXÈRO°CMž5I‘,F’(C–2Gž3G¥:O¤;N§@P«;Q¬>M¬?R°FT«FR¯FS°HU­FU¯EO­CT°DO®ES¶KS¹KT¸LT¸KS»OVÁPVÀSUÄRUÁT[ÄQWÅVXÅW\ÈVVÌVXÊXXÍXXÈYYÈXXÍ\^Ò`\ÉRR»OXºJQ»JO¶LXºHP¼PUºS]ºNV½PXºU^ÆZ\ÁY_¹UZºQXÂ`g¼TX¼V`¶U_ºU`ÀW\ÃcgÅ^bÆgjÂ^gÂlpÊkmÊorËjiÇdjÌqsÊfjËnpÐtxÆmrÏrrËtvÎzÑwtÎ}wÒ†Ñ~|ד†Ø”†Õ“Ø£˜Þ©–Ù¡˜Ö¡”Ú³£Û¦ŽÒ•ŠÏ”’Ê•—Õ´´áÀ·æÍÄéÍÂèÌÁêʸåȼãƺà¼áÅ´åʼãžãÈ»âÈ¿âÄ·âɼåǺèɹæμâƺå˹åÍÂêÐÃìßÒíÚÈäÓ»¸ˆ‹2G“0H›0FŸ9N <P£BS¢?T¢AT£@S BV¤>RªAS·GTÂPZÎZ\ØgdÜqnáznä~qå|lå~mç~kä{là|pâxnÜytßvkÚljÌaf¾V[ @R‚"Dh=p>Š$@¦;LÀQXÊ\aÖhgÜpiàuoàzoátjßpfàpfápdÞthÛqgÜogßpbÞqfÞpgÞqiÞrdàshÝn_àreàqfäqfæuiç{qé}jÜl_5FbAT8V?Y>Z;Z<`@dBjBgDdBfAf@`@\AU@Y>h Dj"Bd?\=X?YB^Aa#Je&Oh)Sl-Vt8az/Z~3Y–Pi³iuÈzx́~ЂzÈwsÇrqËulàfRÔ^N¼FJ¡7G˜2Hœ6HŸ8J¢6G¡:GŸ7E 6HŸ4E­EMÃQRÔ`ZÜq_äybèfêŠrëŽoënìŽnêpêŒlìŠnèŒlèƒbäycànZ×`UÊPL´DNž2G‘(B,E˜4Jœ;N¢<P¤?P¨ATª>Pª@S¬DV®GU©CN®HV±FPªDN­ER«CP­CR²HQ´IRºJP·JR¹LT»PUÀPSÀSUÂTXÃPTÄTXÇWVÈZ`ÈZZÉXZÈQTÌZ\ÈWZÉXYÐ^YÉXU¼JQ¶NX¸GN¼KQ¸OXµKWºQ[¾RY¶MZ¾[`Å\aÀRW»X_¸T_¼Z[¼W\²QZµQ^½Z`À^dÁ[\ÄdjÄc`¼X_ÇfjÆkoÇvsÆgfÂnpÍtrËlmÏrnÏqqÌuxÎvtÏrsÒ|xÏzzÌ|}Ìyvρ|ÔŒ‰Ó†ˆÑ‰Ù¤–ܪ™ÚÙ¥–Û¬š×¡•Ì„~ƍ”Ϧ¯Ý¹±èȺæȼê˶åËÀãĵßļâ¼âȾäʸÞÀ¶æÈ´äÊÁâÈ¿ãǽáǺãµäȸàżãǹåÎÆãÐÇäÒÌèÔËíÝÑîßÔíØÂÜƹ¡[kŽ/E“1I—6Fš8Mœ7M>NCU¡?R¢@R <P¦?R®FU¼Q]Î]_×ddÛnláxoå~tå€tä€sæoå|jã{mãznà|sßxqÜolÓefÂV_¦AP„%Bd8^9y:˜1G³FSÃR[Ñ__ÚkhÞumÞuláwkàrcßpdàrfÞpeÜqfÛmcÞpgÞnhÞrjÜnfÞqnàrgÞpfÞuhàvpãwnçxnç~rÞscµBNk@VAb8\`0S^IZ<\=eCfAgAe@gBfBcB^@X@X>b@jBfB]AY>[@\?`=d$Lh%Nm+Vt4_u0\‚:`–Kh­fwÅvxÍ|zЁxÓƒwÂqn¾nl΂zØZNÈQN¬=H›1I›6I¡8L ?Nž8J¢:M5G9JŸ6G«>LÇTSÕ^XÞr`ã{gæ„hèŠrêŒpëoì’têŒnêŠlìŒnêŠgè…dåz`àlZÖ^SÈRR°@Hž6IŽ,G+F•8L›8L£<N¨?Q¨AQªAP©;N¬?L«DO¨@P­AM¯DQ«@P­@N¬BN®FS³HS´HN¶FQ¸IQ¸QY½PT¿PVÀSVÃRUÄRUÇTTÈUWÇUVÊTWÇ[\ÆVXÈWXÉYYÌZ^Î[S»MR¸JQºJO¹KR½MWÀRZ¼QZ¼PZ¼NX¾W_ÃW\¾V^½W`½V\¾U\·V^µN\¬M\µTb¿]eÆbcÂehÂaf¾ekÂhmÄhmËwtÌmnÌsrÌvrÆptÐwsËnpÎxxÔvuÏwvÐtkÈruÊsrÎqsÎvvÏ{vӁÖ’†ÛžŒÙ™‹Ú¡”Ü©—Õ–ŒÏŠƒÈƒ„Çž¦Ü¾¸âĸãĹæÀ±çŴ俵â´ÞÆÁäÌÃæÐÄäȺâĺâIJ῰åïáĹâ¶àÁ·ßÄ»ßÆÂâÏÇäÎÄéÒÂèÐÊéÓÄêÔÈìÜÒïàÔìÜÒìÛÀͳ­—ASŠ-CŽ1G“0F˜6J–9L™8Mš;Pž;P¡<P¥@S®GXÃQ]Î]_×ihÞqlázmç~mæ€qä|lå}oå|lã}mã|qà|vàskÚppÑglÂZc¨BT‚$Ab9W;fB†,H¢DUµKVÈX`ÕgbÝojàtláwpàthÞpgàsjÞpgÝndÞqfÞocßncàrjÝohàrcàrjàqeâpdâulæukê}pærÍZV€ @Y@V@V;Z>Y;\>a<c>h>hAd>gBfA_>Z>X?a?n Bm$E]=Z@]D^D_@^Ab"Gh*Xl.Yv7b:_”Jg«at¼t|ÊywË~{ЁxÎ|xÀon΀wÔ‹ÌRP³DHŸ2F›2Fš7H¤>N¢>L£:I¢8H:Hž2Dž4H®AMÃQQÔc^Ýq\âxbæ€fåŠfëŒnì’sêqêŽsêuínêˆlçƒjä|dÜn`Õ`TÇOMµ@HŸ3GŽ+FŒ1J4O˜<P¢BR©AR§BP¯FS«AUªBN®BN¬AS¯DM®DSªCR±FR­CO®BQ³JT²HN·GN¸JP»MP¾QYÂPT¾RYÂUWÄRQÆTSÄUXÁTYÆVXÆV^ÈZ`ÎZ[ÍZZË]_¿TX¼TT¶KR·HQ¾NSÁSZºPZ·LW¼T`½R_¾W^»T^¼V]ÂTV¶JT´S\°HY³P\¹Ta¼Zc¼V_ÊehÂblÁfnÆabÇghÌlhËijÌrqÍgjÈtwÎvsÒrsÑwrÒ{zÎzvÍnlÀhoÎwtÈlmÍyyÓyvÏ{z׏„אˆÖ’‡Ú©šÖ”„ÑŽ€Å€}½ŠÐ¤¨âÁ²åǼæƶåȹâ÷ửâĸáÆ¿æ˼æÌÁæŵãǽâÀ²ÞÁ¶Ý»²Ú¶¬Þ¼®àƾàùäʽèÒÆéÔÄçÎÂèɹåÌÀäɼå̾èÒÃêÔÅîÝÍîÚÆïÚÁ¸…†“@M†0F…,D3G3H˜7Kš8Lž7Kž6O¦?O¬HXÃRXÑ^[ØifÞphâxnå}pæ~pã}lä~täziâ~sâ€vá|rÞvnÚphÒb`ÀVZ¥<J‡%B_
6P8`@v$F˜<U®GWÄV^Ñc`ÚjgÞpkávlávmàujàpeÞphÞldÞqfÞlbÞpißphßndÞqhàpjàqhâseåthèxiê|mÛmb£7F^;R:R:W?X<]@bAh@fAg@g?j!De@`:X<R9^;fBpBfBV<[@^>aC_AaBfLi&Tr5b~8b•Pn¨bwÀv}É~|ȁÌzwÎ|sÂqrÊ{qÔ‹|ؐ{¹CK¤9I™3Fš5N 6G¢:L¡:K¤;K¦9Lž6Fœ1DŸ8J¯=IÃPTÔbYÝnZâw`æƒièˆjéŒvêpësêuêŒrê‹nê‹uè‚lã~iÞn^Ôe`ÆRR²LT 2F)E4I–5K;O¤<M¨BQ¦?M«DP¬ET¨?O®AP¯AM¬@L®CQ®DP°BN¬HQ­FN²FS¯FM¶ER¸JRºPT¾OTÂQRÆX]ÂUWÀRTÃSVÉQVÆVXÈVXÈVZÈW\ÆZaÍbaÆYZ¼X_¼Q\¶PZ½U]¸IU¼RZ½NZºNX¼R\¾S\ÁX\¾U^¾SU¼OZ¹RV¶Xd¶V\¸Zg¿X\¼\iÂ`b¿\dÅklÁ_f¿hlÈeaÅotÊlhÄbdÊrsÎolÌtrÓtnÒyvÓzvÉloÄrxÊssÊosÌrrÐtwÏyyÖ‚{Ò€ƒÔ”ˆÚžŒÕ‘€ÈxzÀt|•ŸÙ¬£âøã¶ä´âµã÷ã¸àûäôæɻིåıßÀ¸à¸«Ý¼³Þ¼²áÈÀݸáúçʹäĸä°åƱâÁ²à²ÝÅÀßƺàÊÂàÉ¿âÎÀäÐÆåÐÅèÔÈîÚÈÜÎŶŸª™`tŽ>O‰,B‹.BŽ0B™2Fž:G›4K¤:N®DQ¿RZÏ]^Øhbßoiâxkå}så~mä}qå~räylâ{pã~ràynßwnÞphÓdaÄY_¥<K†">c9UBWFg Gˆ3M¢BTºIUÊ\\ÖbbÚmhßtnâtnáufârbßnbÜndÝmbÜmfÞmeÝoiÞrlßqjãrhásjäxjèylêzläti¾NPq>Z?Q
-9V8W;W=`BfDjEj"DfAe@dBb;^<Z<[?iBnBiA[=X=aE`BbDd Fj*Qf&Qg"Nu3]IjªdtºryÊ{|Ë~{Î{ÂxvÂutÊ~uЈyÖŽ}×’¨;Lš2F›6J›6J¡7H¤;K¢>P¤:G¢;N 9L 4Hž4G°DPÁOSÔ^UÚmZâyhæ‚féˆhë‹mêŽpéŒréŽtéŒrëˆlé†lç„käydÜj[Ö^VÄTS²DL7K*CŽ+B”+Eœ9L¡;Q¥@P©?R«BR©CRªBQ­DUª@O¬CNª@O¬BO°DO±AO³FPµFR±JO´JQµJS¹MU¾OZÅRVÄTYÀSUÃSVÄNQÆT[ÇVWÍXXÊV]ÊWYÌ_aÔe^ÂQV½NT¼LVÀQW¾TZ¼PV¸OWºLT¸RX½QW¾T[¸V^ÃT\ºOV¼Yc¾Xc½\d¾X`¼WdºZbÀYaÆeiÆfhÁbhÃjnÅ`fÀlrÎtrÇkoÌtrÌfmÂnsÒurÊjjÑvmÎnnÇsrÍnlÉinÎrrÐpmÎ|zÐxtÎvwӍƒÙ–‰ÔŠ|Ãpp·o~Ì¥¨ß²¢à»±å¹¦âÄ·àÀ¹ß¹«ãƺæɼåȾ᾵⺬ßĻܾ»Û´¬Ú¿¼à¸¦ßøæʺãŶིྶ޼±ÜÁºÞúàúà¸äÊ»ãÌÄäËÂåÎÂãÎÀæÎÀæÎÄèÒÅìÖÉðÚËîÞËÖÎÀ¬„“…4F‡-F‰)A’0F•3H–3H£:L®BOÁOZÐ\^ÖicÝolÞwkäpå~pã|lætä~lâ|nãzrß}vßztÜqlÔdaÃVX¥>M‡&Af:X=X@`<p82Hª?LÀTZÏ[]ÖgeÞoiâvlãtgâseàqdÞqdÞmcÜmfÞkaßnfßphàriárjátkæxlêzlèxhÑ^Z‰*FZ;S:T
;V
;W:\@gAl"HjDhAhBg>f?]<Z:W>d>qCjC`@W@[BbB`CcD`Ie"Jh$Rl(Sƒ;_¦[n¾rzÅzzÊ{z΀|΀vÁvxÅ|zÓŒ}Õ”€Õ}דš:N—4H7J <J¢8J£9J¢7H¢8J¤<Nž8NŸ5GŸ6H¬?MÂPOÐ^XÛpbâu`ç„jè†nëŒpèŽjéŒvèzèŒsìŒtèŠrè…mäzbÞpaÕbYÉRSµBMž5F’+C,D—0C7H¢9J¦=N¨@Q¨@R¬GS­CP«BN©DP¯EO­@M¬FP®AO°HV®IQ°DP²HN¹HO¸MS¼JS½MSÀPWÀTVÁRUÁSVÆV\ÆTVÆTZÇX[ÈTUÉW\×i`Í_\¼HT¼IR¼HR¼KTÁTZÂPT¸N\¸NU·NX¼NV¼QZ¼TZÁV\ºNX¿Xb¿W\ÄXZ¹XbÀX\»_hÃdmÆbcÁfnÆba¾`jÉnuÉfkÍorÐppÉfkÊnpÐpoÊt{ÏrpÍptÌllÌnmÀirÇlkÄlsÈrtÌoqÊxyÐ~{ÓŒˆÐ€{ÄimŒױ§á½®Ýµ¬â´ Ûº¶ß¶¨äƶ࿴弧æĵå´àÀ¶Üº´à¼¯â¹ݼ´ãǶܶ¬Ý¼²Ý»±à¿­ßÄÀàļàļãŹæÈ»äƼâǼâȾäʾäËÄäʽäÍÂåÌÂçÍÂçÒÆèÔÈêÕÉñÚÈòÞÈàÖıŒ•¢FP$@‹)D/F”2Gž6K®BO¾MTÎX\×hdÞrkàznã~på~pã|nå~sã{mäykâ~sâu߃ÜlgÒdfÁRX¨@L‹'Dj<Z>U:W
9f9~;™4J²FVÈV]Óa`Úgeàthâtgàteârfán_ÝlbÛlbÞqgàpgàndáqiãtläulçxmê{kÝj`¦8Ib5T8T
8T9Y<\<^<h@i@jDl HgBfBfA\?V;`?kDlA`>^?\D\=fFbCc I`Lb!Nm$R{9^Ri¼nxÆwxÆy|Èxv΁yÈzxÄxzщ~א~Ö“€Ö‘€Ø‘~˜<Nš7Kž9L£<I¤<K¤:K¢<M£=K :L¡9Jœ6K 9L¬ANÁNMÐb\Úpbâvdæ‚jèˆpêrèŽxèŽté‘zéwêŒrèˆsèƒiäzdÜo`Õ_XÇTV´FN <O‘*DŽ(B–0FŸ2F£:K¦=M§<K®BP©@N®@N¬BS¬CQ­FR¬BO«DP­FQ±EO­@I±FR´EJ¸JN»LRÀLQÀNSÂTVÂTWÀVXÂWXÈTVÂVXÂUXÅUXÆWZÎd^ÔcYÁRU¸LT·PW²EQ·LW¿OTÃRW¼OXºRXºNV¾QU¶R\¼NW¸PY»TZ»U`¼RZÁWZ¿Yb½^fÈfgËhlÈgjÃ^dÅlsÍpoÌmpÐwwÐsrÈhqÏzwÏjlÌnnÌonÈkrÏpoÈfhÆlpÊhjÂbmÌrsÌprÌtnÇnnÀkqÄrp¿nxÉ’‘ܱ¨âº©â½®ß¼¬Ú¶²ã¼£Û½´à² á¸§Üº°ß·©Þ¹¬Þ»´Þ¼°ÞÀ¶äÁ®ß¼µßµ«Ü¾ºàÄ´âÈÁß¼±æÄ®åÌÃåǸáȾäÆ»ãȾäʼãÊÁâȼäʺãÊÀäÌ»è̽åÅ°çϾèÏÀçÏÀêμíÔÃðàÊâÖ³}†}%A"=ˆ'@.Cœ6L¨?O½MVÌ`aÕfdÜocàxsä€rã}sä|oæ~pâzpâ|räzrå€pÞxrÞldÔb_ÀRWª@LŒ'Dl:^=W:W4`;m:Ž)C¨<LºGSÌ`aØdcÞohàuiâtgàtfÝqeÜm`ÜlaÞkbàndßriâtjátkäyné|räsd¾PTr;Z>T:V<V<Z>`Af@j Bh@i@h=fBeDa<[@_AgAjBf H\>\>c"Gb@cBaD`I]Hb Nv3\˜Vn´lxÅyÇwxÃw|ÊzwÆxxÁxzÎ…~Ӑ}Ö”‚Ö”€×’ÕŽ}š4Jœ8H¡:L£<M£<N¤<K¢<K¡?JŸ<Jž;Pž6J >P¬BNÁUYÕaZÜo`âuaç‚næ†oè‰pèŽréŒuêŒvêŠrèŠpé‡oè‚jæzeÞpbØbXÅRT¯BM <R’*DŽ,H–/Fš8K <M¤?N¥?L¦AM¨>Q«>M®FU®IV´BL¯@M®BP¬BO®EM­DQ²DQ³EL·IPºLS·JQ½NV¿PVÂRXÂTWÄVZÆXYÁVY½RXÄPUÅ\_ÝŠuÊSTºHM±BP°EP®EP¶EPºNRÂRX¾V[¿RX¹KT¿SU¾OX¾TX¾U^»PV¹R\¼X_¸Vb¾X`Ã`_ÆhkÈadÁfrÈrrÎijÏuvÒwuÎnoÇrvÌljÌnpÏvwÌqyÅntÎurÉflÉmrÇlrÈlmÉhhÆmrËrlÆkn¼em½js¿|ˆÑš”ܦ–ᶡඦ࿴࿰ྰ߯¢ß¸¥Ü¸²Û±¦Þ¶£Ü¸°Ú´²àº®àº­Þ´§Ý¶²àÀµâžçƷᾶèƱäɾ߽¹èƲäÈÁåÊ¿ãȾãƺâȼåʾáøãŸãÊ»ä̾ãʾâȼæξæÒÈäÏÄåÑÃæÎÁê×ÊðؼÜξ›Vjv:~"@Œ)A˜4H§>K»NVÎZYÓd`Ûngàyoãzlä~på|oäzmæ}päzrã|oã~uãwnÞnkÒdcÄTZªBNŒ-Hj<\8[9X6X5b
5v6+E°>JÆWZÒ][ÚfcÞnfàriàteÞndÝk_Ük`ÜjbßjaàtjárhãtlæznèygÑc\Œ(F^;V<V;\=Z>^<d=i>i>h@f@eBh"DcA^@[?dAh Fc<\;V:^?`Bc?h$IZB]H\Mp(T”NjµlxÇ{|Ê|ÆxvÃxyÂquÀsvÇ~xÒŠÖ”Ö”‚Õ“‚Õ’Ô~›6Kœ4J¡:K¢>P¢<L£;Kž>N¢@N¤=K :Lž:N ;L¬GSÀQWÒc\ÛlZávbä‚må†nè‹pæŠpæˆrèŠtéŽsè†hçŠrç„jå{fßp_×f`ÄRS°DOœ6L‘,G,F–/Fš5K¤:N¥<Nª>K¨<O«?L¬?L­CR¬FU®CPªDT¬@L¬@M¬BN®DO±FN´FN¶HPºKR»MT½PW¿MVÁPVÀV[ÂQVÄQU¿QUÀNVÂNWÞ„pèmÆNR´AMµDP·IU´DO·JQºNZ½MR½QY¾PT¼MT¼OU»QX¼QVºMW¶P\¹PZ¼W`Ä[^¿^hÄZ\Ã\fÄmuÌjmÇ`jËsrÒssÍsuÌrnÆ\`ÄnsÎqnÐptÌyzÏnqÐqsÊrrÂenÂioÀ^hºbnÅllº`j¾blºdrÍ•’Û²§Ú¨™Ú¢˜Þ­œá»°æ¼¤à¼¯Þ´¤Þº©Ý±¥ß¸¦Ø´²Ù°¨àº¦Ü³§Ú¦šÚ²ªÚ·²âÀ±âļåÄ·äĺáƼἴçÆ·ãÉÁÞÀ»æƲâõãÇ¿áÄ·ãʼå;ãȺæȸåʼãÊ»äɼàÈÂáƸçÒÅçÐÅèÑÃèÕÆéÚÒéÒÄîظɮ¨~*D~ ?‡#B”/D¤;H¹HRÌ[ZÔd]Üofàvlå{næ}nä}lä~oä~tä{rá}rá|wàvpÜomÓbdÄXY¨FRŠ,En=]<^<]>Z7[
7f5~>›2F²DNËUSÖ`ZÚh`ÜobÞviÜraÞk^Ýj\Ük`àlbßreärhåwpæzmÜma¥>Ib:X>X<X=Z<X>`;iAj>hAgBi!EhAdC`@Z?^>gBfD`CY>^@dAfB`>_AVA_Kj%R…?a¬cwÇy}΁}È{|Ãrt»nv¿psÉ€ÒŒ}ҏ€Ô’Õ‘~Õ”‚Ö“~Ö‘ <Jž8I¡:L£?L¢;L£>L¢9J 7I¢:JŸ9Jž7L 4F«CPÂSXÑ`WÜnbâzeå‚mä‡pç‹oêŽoèŠsè‹qè‰té‹tçŠræˆoå|iÝpcÔcbÆRS³EP<SŒ,I,G•3Jš5J¡8K£<L¢<LªAN¨DR«BO¬BP­CR«CN®FP¬CP®AO°BN®EM²DP¸FMµGO¶KR¹NSÀSYÃQTÄSX½RXÀPNÂTVÂORºPVÀTZê©„æƒbÂEL±=JºDN·KT³HV´NZºRZµLT»R[ºLVÁOT¾NWÀPXºMX¾T^¼U]ÄX^ÂV`Ã`fÆ^d¼YcÈbbÌ]cËjqÌjpÑotÒztÍgh¿ajÂlrÏleÅioÔurÌjsÍorÍloÃchÃmn¾`j¾`fÁ`bº`j´\f¿t~ӝ–Ý ‹â¸§Ý¬¢Þ®žß°¤å´›à²¤ß¶ŸÜ±¦ß¶¨Þº«Ù­¬Þ¸ŸÛ²¨Ú¨›×°®Ù´¯à½±à¿µà½¶ä³âÄ»äĹäƺáÇÀãÀ±åÎÁàÃÀ⽫áÉÃåɹáƽäȺäʼáǺáÈÀâȽßÄ·àĸÞĺÞĶàÊÂäÏÂæÔÈçÑÅéÚÎìÚÏëÞÊãÑ¿£ft˜;J„ BŽ*Bž8HµFOÊUVÔbZÝnfàvjä|lä~oã|mä€qä~qãztä~tàznßxoÜlgÓcdÇTV«CR+Er>^;\>^9\7[
-6^4m5‡"=Ÿ8F»IOÊVUÒ`XÕj`ÚqbÛpbÚj[Üj\Üh[ßn`ÞqdâtjåwlàvkÃRTt=V<V9U<Y=[=`Ed<j?f>h<gBfAf@cCZ>^BcBiDcBZA^DaCjBiF`@X@R=`Iƒ<d§`wÄy€Ð€€Ì}|ÈxzÁrqºnsÇ~|͆}ÔŒ{ՐÔ|ÖŽ|ԏ~Ô“‚Ö‘}Ÿ>P¡<J¡:H¤<J¡<M 8L ;L¢>M¡<Jž6Hœ7Kœ7K§APÀOTÒaZÜpeâweå‚lç†néŠnæŒqèŽoêoéˆpéˆsé‹xçˆuä|iÞrdÔe`ÈVT²EQœ5MŽ,HŒ-K–1J˜7Mž4F¥;L¥<Lª?MªAO«AL¬BO¬FSªDS®FT°FS¬DQ®DO­DV²FR´LX¸NV¹NU¼KR¾PTÂMU½OVÀSX¼T\ºPX¸JU´K\Îmdô»ŠÚuY¸BK¯BL·EO´HU¯KW¶KV·JV¼LT¼NXºKU½PU¾RW¾PWÅZ\ÂZ^ÄVZÄY_ÃZ^ÀZbÅdeÇ^d¿alÇhlÍopÒppÓwnÈbcÃhpÆjiÈilÃhsÎtmÎjoÎqrÐmjÅflÆehÂahÄde¹Q`®Pd³ViÁ„ŽÖžšÝ™†Ü¯¤â°›àÀµà°¢á³¢Ü¦šÞ®—ܯ§ß¹£Ü¹¬Þ´¢Ý¯œÕ šÚ¶¬Ü¸µá»ªß¾·Ü¶¯à½­ãÀ³ß»°ãÁ±áżáżãÆ´ßÀ»ä°ãÊÁÞÁ»äIJáŽáŸßżâĵàµàÀ¹ÞµÜÊÄÝÇÀáÊÀàǺåÌ»äÎÆæÒÆçÓÈèÔÄëÜÒîßÏëáÊÑĺžXft=Š'Cš2H¯HRÈZ^Ôd`Úmfßugãzlä|näzmä~rå}nâ~wä|rá|tÞxpÜniÔb`ÄSZ©DT.Jr?b>`<_:`:\5\5]5l5‡$> :G³HNÂVXÌvyҐ“ÖŸ Ö£¤ÐŠÙi`ÛndÜ„}ãzjäwfÐcZŽ'D[=YAW;[@Z;`Bb@h?j$Ig?f=iEhDdB_C^Bd>fDeE\?\BbBhBi!Cb>X=P9T@r*S›Ut¿t|Ñ}~Î}~Äx{Ápw¿prÈzuшÓŒ}ÕŒÖ‘|ԏ‚ÔŽ|ÔŽ€ÕŽ|ÕŒ|¢<L¢@P ;L¢:H <Nž>O¢=J =Ož:Mž:Lš0Fœ4G§>P¿MPÒd_Üpdáxcähç‡nëŠmêŒrê‹oé‹séŠsêŠoéŠvçŠtä}iÞr`Ôc\ÇSV²FTš4N.JŽ+G”2Lœ6L¡7K¦>N¨>N¨:L©>K¬<J¬BP¬AO±FR°IV«BQ­DQ®ET¯GX²MZ²LY¶GQºLS¸PW½KRÁQZÂRVÀRV½LR¼LT¹IX¹Q]誊õ¯Íb`°?R²IU®HY²FSµFV¹GOºNWºHU¼PWºNTÀPTÂOR¾PUÅSVÄV]ÅYaÂR[¿[bÌaaÆ^gÄblÉioÊinÒsqÐhgÄfnÊklÌihÄhrÉnkÍlhÆlvÍruÍpuÅmrÈbg¶^lÂce²P`ªOd´`p̘”ݦ™Ü¨Ûª á¯•â¯£ã·œÞ±¨Þ¦œÛ¯¡Û¨œß¶žÝ°¤Þ¬™Ô ™Ó££Ü´¨à¾´ä¿²Þ¸²á¾®Þ¾¶Û·°à¶¦ß¿¸ÞÀ¸äĶãǾâÇ»âöÝÀ¸âƹâÆ»àÄ»åƶàƺÞÁ¶Øµ¯ÚÀ·ßĽàƼäÌ»äÎÁàÊÃâǸàɾâÍÄåÎÁäÐÅåÐÇêÖÆéÜÓîàÐîßÄË°¬}"B~ C’0IªFTÈXXÐccÚldßxoäyhâxläyjâ}pà|qã{qä~tã}sà~wÜplÓ``ÄX[¨FUˆ+FpD`;]>a:_:[7\6X5Z
-0g7+D¤UkÉ ¤àÀ¶æÏÄëÔÄîÒºàÄ´Ô žÜ¯²ã÷┌Ömd¢8Hb?V>U<Z>ZC]@^>fBh@g@gBdBg!Fi"Jf I^DcCf@b@^>ZAaDhEgAd?`=Y@T@h"LIj·n|Ì~|ÐzÈvvÄpt¼pxÄvvÌ„~ÔŒ„ÔŒyÕŽ~ÔŽ„ÓŒ}ÖŠzÔŠzÔŠ~ÖŒ{ž<NžAQ 9Kž:JŸ:Kœ8Mœ5G 9Jœ4Gœ4F3D3G§>M½OTÓ_ZÚnaàygæjç†oè‹nèŽsèˆpç‹sèˆoéˆqè‰tèˆräzcßpdØe`Æ\\²KVž8L,I-H˜0Hš2E¡:J¢<M¨<K§;K§>L°@L«BN¬CP¨@P«BP©BQ©>NªEV¯GX°N\³IT¸KS¸IP¸LS½JR¾OW¼NT¿NTÀLP¼KT¶FVÈ_^úÅ‘ïžwÏYW®>R²GT³HV±ER´GR¸HRºMX¹NXÀPX¾PX¾LSºJUµGV¹NZÄX^¾T_Å[_È\aÄ_cÍfaÊafËhlËfhÄejÉnnÍvsÐpoÉlkÎjeÇdkÅlpÏljÑqnÆ`c·P[º`j¿\b´Ve¯Pc¼u„Ô‘ÛŽÝ«¢Þ²¦àµ¢ß¤–⬔ڣœß«•Ý³©Ý³©Ü¹­Ù¡–וŒÖ—Ø¯¨ß² ßµ¬â·¦âº°à¾²Þº¶â»¬ßÁºÛ¸±â¼®âÁ¸ã¼¯ãƸà»ß¼ÞÀ¸ßÄ¿àÀ´à·޼´Ü½·ÞƹÝÇÁà¶áõáǼàÈ¿ãÈ»âÏÃàÊÂà²âÌ¿âÌÅå̾åÒÆæÓÇêÝÐìàÑïßÆäÓ»CZy>‘2H­AQÄWXÔf`ÝndÝvpâyjâyjá{jä|nã|qä|mä}näxmá|tÞokÔcaÂZ_ªBPŠ0Jp?a<Z<_=\8Z:T
-2O4N8\Bœj~ؾºèÐÁîØÃìѹâÀªÞ»¯ÞºåÍÂíÑÂîÕÂæÖÀď–lBVARAVAX?\F[>cBi!DfAgBe?hBeDf$HbB^@fDdE^?_?^Ad@h Eb@\<V:\Fk$P‹Af²gzÈz~Ï~zÎzxÆvxÀpvÃxz΂Ò‰€Õ‚Ԑ~ÔŽ}ÓŠ~ÔŒ|ÓŠ~ҍyÒ‰zÖ‹{˜8J™<Lž:Jœ<Lž:Kœ;Lž9JŸ<J =Mœ9I›2Fš4F£>LºMPÏ\TØnháwhå€jçˆpéŒtèrçŠqé‹uç‹vç‰wç‰ré†mäzeào]×dXÈSS²CQ™9Nˆ$B‰(F–.G˜2H 7JŸ6K 8I¦;M§<L¨>Oª<M¨?O¦AM¤@R§>L¨DW©BS«DR¯HR°DP´HR¶GT¸LT¸LT½NU¼LT¼OTºJP¶BP°BXÛ“€ûÈ’é‹cÀPV¯>P²HX´ER´BRµJT¸JV¼LVÁRVÈTX»KVÁNVÀPX»MX¼R\¿X\ÂS\¿P_ÉaeÊajÈclÍhhÐnrÎknËgiÊdkÑssÌjiÇZ^ÃfnÎjhÐopÎkfÄ[^°Ub´\f»W]²Sc±\nÆz‚Ù›Ú¡–Ø™–୕㺪ᰜۨšÚš‹ØŽØ¢˜Þ±£Þ¸«Üª˜ÒžŸ×¨ Ü´¬à­™Ü²ªß²¢Ýº°à¸ªà»°âÀ³Þµ­á¼©ß½´àº®à¼«Ý¼´Þº¯â÷àļܽµÞ¼°Ù¹²Ø¼·àǽáǾãóæÊÀßȽ޽´áøàȼàÉÀâʾáÍÃÞÈÂáÊ¿äÍÂáËÄäÎÂåÐÄçÓÈìÞÔìÜÎêÛÀ²ˆx@Œ*C¥?NÂRVÑcaÚlißwnâzmâ{lå~lå~nã~lä~nä~qá|rà{sÝpnÑcb¾VZ¬ITŒ/Jn>\?\<\<W8U8P
6L?XEŸ|ÝɼíÔÂìÒºæÀ¨Û²¥×¼¸àÊÃåÎÆìÖÈìØÏíÙÌîÓ¹Üijj,LLARDTBVB\C]AfAi"EfDbBh&Lg F`BbBbBcDfDdE_B]?`Dj"Fl(JaAW<P<^B~5Z¦_xÅxÏ€Ï~yÆv|ÂtzÃtv΂€Ò‰~Ô‘‚Ô•€Õ‹}ÕŒ~ԍ}ÔŒ~Ó‰~Ò‰{Ô‰{ÔŠ{œCV›:Kœ:L;L8I6I¢6G 9H¤8Fž6H2Dœ4H¦:I½JOÒ`XÙh`âxfælæˆné‹téŠnê‹nè‹pæ‰xé‰mætè‡näzdàp`Öe\ÃTV®CRš/H†&BŽ)E“/H–3Jœ2Jž8J¢;L¦<O§<N¬AN§@N¨>L¨@L¨?N¦<Lª@P¬CO«DN¯HV±GV²HW´IR´HS·HQ¼NX¸KR»NR»FN°CV¸NYñ¼—ù¸~ã}eÄRV²BT¯@P´BO¸HR¸HU½KT¶M[½LQ½RXÂPTÀPYÆRVÀS\ÀU[ÂX^½YdÂZ\Æ]eËdcÌegÊ`dÏnmÐghÇclÇmkÉ\`Â]dÈjkÎljÐolÍhe¾[cµ]e¹X\­GXªI^¹j|ÏŒ‹Ø‘‹Ø–Þ¬ŸÞ¬žß¡Œà±£ÚœÙ¡”ؤšÖ ™Ú¤’Ù¢‘ט×¤¡Ý³¥ß²§ß®™Û®¦Ü¨˜Þ³¥ß¹¬àº°Þ¶¨à¸ªÝ»²Þ³ªâ¾¬Ú¸³Ü¸®à»°Ü¾¶Þ¼´ßº¬Ö´¯Øº¶Ý¾¹àÁ¸ãƺâȺáÄ»ä´âʾàǽÞÀ»áÄ´àȾßÊÃáȽâËÂàËÃßÈ¿ãÊ»áÌÄä;äÐÄêÖÊìßÒêßÊμ·…4N‡(C 9L¾OTÐ`\ÚjaÝtmßxlá|nå|læ~nå{jã{oåqâ|rß{rÛqjÔdb½RV§BNˆ(Dm=\;W9X8R4M8J<f4Y°™¨à̽íÙÄèÈ°Û®˜Ö·±àÉÂåÑÈìÚÎïÞÐòßÎõâÑôäÕðàÐèݐi‚HBNBSAYBXAbBg"Hi@c?dAi Ff EbCbDaBb?f@a@[BaBbBh@dCaAV@V>p#NœQm¼t€Ï€„Ï}}ÊwyÇtwÄtxÈ~€Óˆ~Ր„Ö‘Ô’ÕŒ}э€ÒŠ~Ô‹~ÓŠzÓˆ{ÔŒ|Ô‰xœ6I™:OŸ8Iž:L =M¤=L¢<L£>N¦=J ;Mž9KŸ1Fª<L½PTÎ`Z×j_àubäjè†méŒtêpëŒrêŠqêŠsê‰rèŠrç„læ|fÜqbÒ_XÇVU°BJ—.J‡&DŒ&E+E’0Gš4I :L¢:M¨=L¨BP­?J®@L®?M®BNª@RªAN¬CR¬@P­AP±FT°GS¶FR¸HRµJR¿KR¿NU»PUºJP¸KU²?UÈf^ûΚô©vænÊXY°DT®BR±HU²FV¸LU¾NV¶FS¶PWÂSZÄLPÂR\ÀQXÄWY¼SaÄ[_ÂR\ÄaiË`bÉ^dÎhiÎa]Æ\bÄhlÈc^¶O]¹`lÏmiÎiiÐkhÊbcÂZ_Æhg¿S\²L\®M^ÂnwØ“‡Ù›–Ûž•Þ¤ã¯œÜ—ˆØ‰ÜžØ¢Öž˜Ø¤Ù«œÖ’‰Ñ“‘ל—Þ®›Ü¬¢à°žÙª Ý°žÜ´©Ú®¤ß¸¬à¸ªÜ´©Ý¼µà¸¬Üº±Ý²«ßº¬Ú´°Ü·¬Ú²£Ù°«×´²Ý¿¸âÅ¿âÁ¹à¹â¸ãÆ»âźßÀ¸á¾¯âǵßƻݼ²àÄ´àǼÞÈÀáȺßȼßƼÝúߟàÇ¿âËÄäÓÌêÜÒëÞÐáת‚‹‚&Cš4G½NQÒ^XØnhÚ|qßznâ~lä|hãnãpã~lä|mâ}qÞ|rÛskÑc_¾RT¤CMŠ,Eg:V:R9O8I9K?{Mm¬²æÏ¿ë־⼥ћ‘Òº¹åÏÂëÕÈìÙÉïÜÊïÛÊïÙÉòÚÌôßÍøæÒóæÌŬ­LFNDP@U@Y?^?bBfDgCiBh>`@^>^>b@c@bAX>[AcBh DfAfD[@ZAj$ODeµj|̃ӀyÍ||ÅuzÂvxÈ||І€Õ‹~ԍÖŽ€ÕŽÓŠ€ÕŽ|Ô‹‚ÒŒ€Ò‹~ÒŒ|Òˆ{Ò‰{Ÿ:Lœ:KŸ;K ;J£;G¢<L£<K¨>Q©?L¤8G ;K¡5F§?JÀOPÑ\XÚiXáveäfèˆréŠpêŽuêtéŽrépéŠqèˆpç„mæ~gÝpcØbYÊQQ­=I—2E‡&D‡'C(B’,Cš3G¡;L¦AL¦:Jª@M®@M«BP­BM­DR­BP°@M²@L®CQ¯@M°EO±HP´IS¹DN¼FNÀLPÀOS¾NU¹NW´GS´BXÓˆ|úÍ—ö©xáuaÄKR¯ER®?Q«BTµDP¶LVºDOµJVÀRVÆX`¼KTÀPUÂNZ½V\¿TZ·P`½`iË]bÎffÐhgÄXZ»VbÄda½PZªN]ÀdhÒigÒkiËghÉccÄadÄ]Y½QU´MZ¹P`È{}ØŽ‹ÙˆÞ¦–ݦœÞ¢–Ý›Ø‘…Õ‹†×ˆ×š”Û´¨Û¡”Ô•’צ Ü¥—Û©œÜš‹Ù¨“ܪžÜ³¤Û¶®Þ­›Û·®ß³£Þ¸ªÚ­ªáµ¦Þº¸Þº¯Þ¹®Û²«Ü²¡Ö¬¦×®¥Ý¼·äÁ¶á¾¸äÁ³áÀ¶àÁ¶âÄ»âĻᾱàÀ´ÜÀ¶Þ»¯àÀ¯Û¾´Þ¾°ßǼâȾÞļÞĽàÈÀÝÈÂÜÈÂáÎÅáÉÂâËÁçÕÍéÞÕèÜËÖǼšQf˜.F¹HJÏ\X×jfÜnlà…zâ~uå~qç€jæ€oå~nä{nâzoßxnÜohÍcc½UY¤=K|=]5N8I4I<RF“j†Ò¼èÐÀé̲֩•Ì•“ÚþåÒÄìÖÇíÕÅëÔÁìÓÃëÓÄëÒÅîØÈïÙËôàÎöèÌØÌÁ`(LLEOAV@^C`CcBeChCgDa?dA[@cAf@bC\>Z@\@dBf>fC_DZBdL„8\¬cxÆw€Ð€~Î~~ÇwzÁqvÆ{|І€ÔŠ€Ö‹€ÖŽ~Ö‹~Ս~Ս~ÓŒ~Ó‰zÓŠ~ÓŠ~Ò‰{ÔŠ|Óˆz >Rž:M¢=L <L¦:G¦<N¨;IªAN¨=N¦:H¢7H¤4E¬<J¸MSÎZUÚj_ávcåfèˆlëŽqêrìnéŽvêrërêŠpé„iå|fÞqaÕbXÆPO¯@L—.EŒ0HŠ-DŽ.E‘*B›5L:L¨>M¨@P¯BO°DOªBP®@J°DN°?J²BN²@M±DN®@N³DNµEP´GP·JS¸HO¿KQÀPU¼U[¸V_¶FQ´GXüÆŒñŸzÜo]¾HT¬=P¨BS¯FV³GS²FRºHO½LUÀOSÀVY¹FN¹LWÃ[`ÀJR¼VbÊ^_ËccÍfkÇaaÁXc¾`jÂY_¸Pc¸\gÅcgÐhkÏhbÊ`^À\fÆc`¾RT´PW³LX®I`È‚Û•ˆÜœ‘Úš–ߧ˜ÞŸ’Ø”ŽÚŠØ“ŽÔ’’Õ—–Ú¦”֏…Õ’ŽÚ¦›á¯œÜ«ŸÛ¤’ל“Ùš”ßµ¨Þ²¬ß¹«Ø°«Ý¬˜Û°¤Ü¬£Ý¶¬Û¬«â¶¡Ú»³Þ´¤Ø¦¢×«¨Þ½µÞº´äº¨á½³á¿±Þ»´à¹§á¼°ä¶à¹޼µàÁ´à·޿´Ü¾¶Ü÷ÜÀ¼àźáÈ¿áÊÁßƾßÌÄáÌÁàËÅâ˾áÈÀàÉÁåÐÇçÕÍèÙÌåÙÄÀ¢¦˜6L²CNÍ[VØiaÛtjàtã€ränçƒmæoæ‚oä~oá€rÞzpØlfÎc^¹NRœ<Jv:W
6H
6C<[(N¦‰ ÚƼéÒ¿äÄ­ÐœŠÆ›¡×¼éÓÅí×ÅìÒÁêпç;çÏÁéÓÃêÍ¿èÆ·ëÐÄòÛÈ÷æÑãÔÀxC`JDRCYA]B_@a@c>e@b@cA`<`<d<^:W:V=`Da@iGiDcC`I\Dv&PŸRnÂtÒƒ†ÑyÊzxÇvzÆwvÌ‚ÕŠÔŠ}ÕŒ€Ö‹y׆{ÖŒ{Ô‹|ÕŒzÓ‹}ÔŠ€Ô‰xÒ‹{ÓŠyÖ‡x =P¢:N¢>L¤;K¥=L¨<L©?K¨>Iª>L©?K¦=L¤6Hª@L¼KRÎ]YÜiXãv`åfèŠlê’sêqêŽrê‘uërìŽnêsè‚jæ{dÜqdÖbYÄTT®EM—0F‹'@)B‘,D•0FŸ5H¢;N¤>N¬@L¬CP¯@M¬@M®CL²EN³BL±DM²BL°DJµDK²EP³EL·HP¼KTºOWÁLPÁNR¼NT¹Q]µHY¹OXô¾™ú¼…óžkÙoc¹AMª:L«@M¯FS®DS´JT¹JU¾PX¼PU´@L¬@P¿W[»MZ¿X^Ì\_ÊafÈ^`Ìb`À[bÀZ_¿OY¸VeÂ^fÑjmÍrpË^`ÂTZÃ`aÎfbÂU[¸PX¸LX´ViÎ~‚ÚŒƒÜš•ÞŸÜ§œÚ˜ˆØ…ÖŽ†×Õ–”Ü£šÚ–ŠÔ’Ú¥ŸÜ§Þž‘ܤ—ܦ’ئ›Ø£žÚ®¨à§•Þ¼´Ü®¡Þ¹«Ø®©Üª¢Ý§ Ú®£ß·¦Ù©©Ú¢–Ö£¤Û²ªâ¿¶ã¿µãÀµà¹²â¹¨Þ¼¶á½°Û´®Ý®£â»ªâøà´޾µà¶àúÝļÜÄ»ßÅ»ßÆÀãËÀàǼàÅ»ßƶÞŸÜüÞÅ¿ÝÇÁßÉ¿àÉÂâÍÆäÐÅèØÅÝμªev®BKÊYUÔhaÚulà|lã€mä~jç€oæ€jæ~læ€hß}oÞtcÖojÆZZ¶HJ—:Gg6J8F>o>a¶Ÿ¬ãÐÄìÒ¼Þº£Ê…Ê¢¨ÜÈÂéÓÆìÕÃëÓÀèϽçË»å̾è̾åɸáŶáƽèÑÇïØÊöäÌçÛÅ„McKDP@ZAZB^Ab@b?fBbB`<`=`;b<\>V9]Ab?c>iAbB]EYCgHŽ@d¶j}Ђ„Ô‚~ÏzzËxxÆx{Ë~|ш׌‚ÖŠ|؇zÖˆyÔ‡|ÔŠ{ÕŠ}ÕˆzÓ‰~Ò†|Ô‰xÑŠ~ÒŠz׊y¤<J¤=L¥?N¨AN¦=LªAV¨BO¨?L¬@P¨?K¬BO¨=M¬@MÀQPÓ^VÝfYáu`ä‚hèˆkêpê’qêqê“xêrëqéŒnéˆiåmàt`Öe\ÃSS®EN˜4K*B.G‘-F›1F 8J¥:L£>N®>Mª>N®@O¯CO®CR²EM´AL²@L³@J²DP´ISµHS¸GP¹IO¼JQ¹JR¿MSÀOUÀPTµFR²@RÅ[YüÐœø¹†î•qà|aµHT¬:M­GT±DR´HW¸MW¸GS´HR¨>Q®GUÂNUÁU\ÄY`ÄX`Ê\_Í]`ÀT]Ä^fÃY`µN`»ZkÉ_cÈ`gÏhgÈdfÂ]gÈbfÏjdÂ`dºRWµGTºYeÔ‹‚ÞŠ…Ú‹†àžŠÜœÙ”ˆÖ“ŒÖŠ‚Ò„†Ù›’Û£˜×Œ†Ø—˜Ý¦žß§œÞªžÛ¡”Û›ŽÙŸ—ݪœß²ªß°œÚª¤Þ§˜×±¬Û©œÝ´­Û®¤Û´¨Ú¦žÚ ˜ÙÕ­¨Þ¸ªÝ³¬á¸¨â¾µà½´âÀ·à´¯à¶¦á¿´á¾®Üº´Ý²ªá¾®à¶ß¸߽°à¿µá³àÊÃàľ࿰޿±Ú¹«Ø¾·ÛľÜƼÝǾàŸÞÉÀàȾßÉÁàÊÂáÍÅäÒÉâÖÈ̶¶±htÇXXÖcXÝtfàyhã}hå~iæ‚læhä€jå~lâxeÛscÔhbÁRQªBIŒ-D]:]#JŽfÊ¸¸èÓÃèÌ´Û´¡È––ΰ´ßÈÁéÒÂêоêоèλèλäǹݻ­âŸáÄ·ãȺéÎÂêÔÈïÚÌõãÈèÜÄ‚K`JDR@\C\D`GdDdC`8\:\9]:d@`;[@]A_>eBfBd>Y<U>[F|*Rª\tÌ|‚Ñ„ˆÒ|Êz~Èt|Ê~шÔŒ‚׉׉|ÖŒ~Ö‡|Ô‹|Óˆ~Ò‹ÒˆyÔŠ~ч|Ô‡xÔ‡}ÓŠ~Ö‰y¨>M¨@N¦>Lª@K§BO«@J­DN®AK¯@L¬?K«>Kª=J­@L¼NRÑZXÚncát`å€jæŠnêŽnê’xêqê‘wépëlèlèˆpè‚gâveÙfYÆSW±FO4G0F’+E—0Fš4J¢8I¡>O§?L¬BO¯DN°AL­DP±BP±AL´CN´DN´BL±@L´EMºIPºFPºHM¹MS»MRÀMPÀPR¾MP¸JR³BUÑrhüΞøº‰ê’gÑ`V¼KS°@N²GR°@L´JT²GS²EN¤8Q­JXÀTb¾VZÄNYÆY\ÌabËTXÄZbÉ\]ÁR^»_jÀ^dÄR]Ä\fÎhgËdlÊrtÐnnÌghÆ`aºKR­DT¼ajÑxyÛ…wÜ›Û’ŠÚŽ‚ÚˆzÔŠ†Ô‰„ؘ’ÖžžØ‡zÔ‡ƒØ–à«œÝ¦à¤•Þ£œÙ£œÕž™ÛªœÜªœß² Û¨£Þ¬œØ«¤Ú¤—دªÝ¦›Û²¦Ú£˜Ö˜‘ÒšžÚ¤ŸÞ¸¨Þ­¢ß±žÝ¶«ä»¬â¾¶â¼°Þ»°Üµ°à´¨ß¼²à¼¬Þ¼²Ý¶°â¿«â÷ÝÁµÜ¼¬Ý³¢Þº©Ö§˜Õ¶´Ú¾´Ûº´à´àÄ»áĹßÆ»ÝÁ·àȼÞžàÈ»ßÉÂÞÈÁäÎÄãÒÏåÒÆÒÀ¾Éˆ‘ÖbYÞp\âzdå{bæ|aç€gæ~dä€já}fßwbÚugÒaW»PP 5D~&F†Ig¶œ§ÜÊÁêÒ¿â¾£Ôª™Î¢ØÀ½äÍÂìÔÃéÐÀè̽ç˼äÊ»äƶßÁ¶ÝºáÄ·áĶäË¿êÐÂì×ÊòÚÊõßÇåÙÁ€D]HBPB[C]EbHf"EfEa<_;`:`8]6Z8\=`>gBf<c<^:O9M
-:fL–DcÃu‚Ò‚‚Ò€~Îx|Êw|ÈyxцÔŒØŽ|֌։|Ö‰~ÕˆxÓŠ|Óˆ|ÒŠÒ‹ÓˆzІÓ„yс|Òˆ|Ô†|©@N§DO¬BL«>K¯@L°EP¯AL°?I°?G«<K®>Iª9G¯BJÂJOÒ`[ÜjXáufä€gçˆpêxëŒpêŽréxë’qëwípêŒtècâxhØh[ÆRRµCN¡3F’+E•.E™.D5G¤=K¦?L¨?N®CN¬CP´?J¶GN´EP³BMµDP·JO¶EO³AJ³DM¶HPºKS¾KR¹LR¾LRÀRTÃOT¾PV·FR³>Wà‘yûʐ÷½ˆâz`Ñ\T»IV«=L¨>L®@P¯DO²CR®@R·KWÀO]ÈVZÁMRÅ[^ÀOR¿TYÇa]ÆR[´HXÁZaÈW`ÅZeÄ_gÎ`bÍgnÌceÄZbÆ]`Ç`_¸HT¨<R¸eq؉|ØŒ„×€|ߌzÜœŠÔ}€Óxvҁ}ÕššÚ “Ô„}ÒˆŠØ˜Ü•ÞšŒÞ¬›Ü¡œÜœ’Ü­ Ý®¦ÙŸ“Ú ™Ü¦œÞ°¤Û¨£Ú¦–ש¤Ü£šÚ°¥Ö˜’Ò”“Óšžß¦–ß´§Ü¶ªÜ®£Ü§ Þ¬›ß¶¬àµ¤Þº¯à¼´à»²Ýº²ßº¯Ýº³à¼¯Þ¾¸Ý·¬á¹âÅ·Û¹­Ñ–Ë“Ô´´ß·Ý¶ÝÀ·Ý¿¹àÅ»ÝÁ¶ÝúݼÝÁ¶ÝļÞļÞøÜþÞÆÂáÏÊãÏÊçÔÆÞÎÂԍŒÝjVâw^äydä{aå{eå}fã|eâydÝvbÕm^Ë[S°JUœD^¬y‰Ò¼»éÔÂæĮ۶¢Ò¨ Ïª¦Û¾æÑÄèÏÂèξæɹæɶæȹâĸÞĸ޿´à¶âĶäȼèÏÂêÒÆìÔËòÛÎôÞÅâÕ¿u9RLBTDZB\DbCgBe F_=d>`<b:`>]<bEcCjBhAc=T8H8S@„5]³fxÏ{~ӁƒÎ}€Ëv|Èw{΁Պƒ×‹~ØŒ€Ö‹~ÕˆÖ‡xÔ‡zÔ‡}Óˆ{Ó‡{Ô…xÔˆ{ÒŠzÔ†zφ{ІyÔ‡zªBPªAK®BP®DM®BL­BN­EP¬EOªBL°@L«<G¬>J°@HÄHKÒ\TÜjZáxiä€hæ‡tèrêqêsê‘tênísí‘pìŠlê€iâvdÕhcÆVT´CJ£2F‘*B”0E˜0Gœ5I 5F¤>Oª=K®@L­BN±BO³BL±BN¶CMµHR²HN´CN±AL³AH¶DM¸OV¹JM¾LP½OP¿LMÂPR¾QT¸ET¶CVꬖüÊ”ô²~Þq[ÊSO¹OT¬@M§=K©>O¬EN±GT¿LQÂNZ½IQ¾KVÂPV¹AJ±LY½][¿NW·IYÅ^bÎ\fÆXeÉ_dÎ]dÈ_cÈ[^¼R]»Y`Ä`^´MZ©F]¾fqÓ|wØ‚zÜŒ†ÙŽ€ÒvtÔyoÓƒƒÑxyэˆÖ’Í|ƒÔŽÞ ˜Üž–Ú˜‘ݘ“Üš’ܨÚ«§Ü¤˜Ý²¦Ø ˜Ø•ÚŸ’Ø£ Ú¬žØ¤¤Û§›Ú¦œ×“ŠÏ×¢žÛª¢Û¦šÜ¤“Ý´¥Û²«Ú°¦Ø§¢Þ²¢Ý´®à´§Þº¬ß»²Ý²«á¾°Þùܼ²à¼®ÞÀ¸àÀ´Þ·§Ôž”Ë’–Ò©¦Ý¶§Þ¼°ßÀ³ÝÁ»Þ¹ßƺÜÀºÞºàùÞúÝÀµÚ¾³Ø¼¶ÜÀ¶ÜľÞÆÀàÌÄâÏÊçÒÁÞ¸Ü}nãv^äfädå|`ãyfâybßxbÚo[Òe]Ä^d¸sƒÎ¬°äÏÀèӻརմ¦×³¤Õ´²ÝÈÁåÐÂç;çͽæʹâŶàÄ´äÆ»ßÀµßÁ³á¸âÅ·äÇ»åȽæÎÄíÓÇìÖËñÙÍòÛÃÞͼf$DOET<ZB\@_?bB` Gd!He@b>_>^;^?eBb>h>f>_<P	4L
-:lL¤TrÄu~Ò„†Ò‚…Í|€ÈvÌ€€Ô‡|׋‚Ö‹ÖŒ|Ô‹‚Ô‡xÖŠ~Óˆ}І{Ó…|Òˆ}Ó†zÔ…|ц|Ô„zÒ„|Ð…{Ð…~«FRªDP©CM¬DM®FP±@J°BL­CN°BL®>G­@Q®;I´ALÅNOÖ\TÜk\ávdä€gè†lê‹rèŽrêpë”wê’mìŽtìnìŒkè‚jâydØi`ÊVTºIK 2F’)A”,E˜/C6J¢4H¥<Lª@N±EP­FR¯DR²DO²DO³EL²?L±HP´CK°?H¯@H¸BL¹HN¸GLºJP¸NT¾LO»PVºIQ°@Q±AQó¿“ýÉŒðžrÚfUÅSVÂRU¯ES¦<P±DQ°FUºHR»IP½HT²BP½LR¶BO³KUÄVYÁTZ¾V_ÆX^ÇT`ÈXbÎ]_ËbdÌafÊYZ»U^¿^c¿VZµNZ®M]ÄivØ|uڍ„×…Ù†|×…€ÓurÎpwÏusÖš”ÊzwÆlvÕŒ‚ݘàœ‘Ü›–Üœ“ß –Ú¦žØœ–Ü£ÖŸžÜ™Ú¦–Ø¡ŸÙš”Ú¨™Ú¡ŸÝ°¢Ø¦ Ó†ÍŒ’؝’Þ²£Ü®¤ÛªŸÚ£šÜª Ý³¤Û´¤Û¬¤Þ¬¡ß¶§Ü²«ß°¢Þ·ªÜ°ªß¸­àÀ¸àºÞÀºàÀ²Þ¸ªÎŽˆÎ”‘ر¦Ú¹ªÙµ®Ù¸³Ü¾´ÞÁ·ß¾¶ÞÁ¸ßÁ´àºß·ÜÀ·ÝÀºÛ¿·Ø¾ºÚ¹°Û¾´ÚÁ»ÝùÞÈÂáÉÀäζܡšãu`æ~`å{bã{câu\ßyfÜveÖmdÒ„Ô¬®ßɽëÒ½æÁ¥Û² Ø´¤Öª ×»¶àÉÀçпæͼå˺äɹãķ߸ãŸáÁ´ÝÁµá÷âÄ·âĸäÊ¿æÎÂèÑÈêÒÇíÕÌðÙËðܾӸ¨QDNCVF^E^C^B`B^@b@c@^7^9Z<[<b@f=e>`>Z<O
-9]BŽ9`ºfvЀÓƒ‚Ñ}|Éz}É|~ЃÖŒ€ØŽ~Ö‰|ÔŽ‚ÔŒyÕˆ}ׇ|Õˆ|Óˆ|Ô†zÑ‹|Ó‡~Òƒ|Ó†{Ò„zÑ…yÔ„yÒ„xªBTªCN°FQ°EO®CN­BO«CM¬AL°DO¬@N¯@N®BK¶GLËOLØ]SÞmXâwbâ{hæƒcèpéŽoì‘tì–sì”rí’vì“rí“tègâxgØf[ÈWT·FLž0D“.D˜-D›0Fš6H¤<L¥<K§>L°@M«AL±AN³FP²EM²EN¯@L³EL°DM°AN´@JµDK²DN¸HM½HLºJO¾MP¹KO³GQ®<R·LUö̦ù½ŒçŠfÖg^Ñb[ÀV[µFS®IU®AR´FRµIU¸>J®GX³AN¬<MºOSÄOSÀU`ÃTV»HU¾Q[Î^`Ë]fÍagÉXZ½KX¸TaÃZ^ÂS]¸T`´L\ÁkpÔpk×}Ü…xÙŠ€ÔspÐwvÔyxÓ…„΁|ÄgfËy|Öˆ‡ÚŠ…Ý”…ݘÚš”Ü¢œÜ¢šÛŸ×˜‘Ô”•Ø”ˆÖš–Ø™˜Þ±¢Û®®Úž–Ú¥’Û“ˆÔ’‘Ò™›Ü§”Ú¥ Üž“ܬÜ®¥Û¥žÛ©–Ú£›ÛžÝ²¡Û­¤Û œÝ§—Þ´¬Ü´°Ý¶²Ü¶°áÀ·â·áÀ¸Ù«¡Ò›”Ѧ¤Ö¬¤Ú´¨Ø²©Ý¹¬Û¼´Ü¾´Þ¼°Ü¼°Ü¼´Û¹­ß¿¸Ü½²Þ¾¶Ü¾·Ý¾·Û¾º×½·Ø¶­Ù¼¶Ö¼¹Ø¾¹ÝÈÂâʹ߾³ãxbå|bæ}dãxZßu_ÜpaÛvqØž¢àúêѾæǮܱ–ض¦Ú´£Ô­¨ÚÃÀâÌ¿çξä˼ãȹâǶàõ߶à¶ßÀ²àĹàøâĸãÄ·âÊ¿æͽèÐÆêÐÃìÔÇìØÌðØÉðÚ¼À˜’KFPATA^F]B`B\=]@dAc>_<\=\>\:b>g=e>`@]>hA€.U¬YtÊz~ҁÒ€€Ï{{ÌwxÎ}Ö‡׋€ØŒ~ÖŠÕˆ~ÕŠ~Ôˆ|ÕˆwÔˆ~Ò…zÒˆ}Óˆ|ЇzЈ}Ò†zÒ…yσ{Ô…yÒ„x«CR¬FO¬BN¯?H®BL¯@L¬CP¬BL¬FT¬<J®BI±?G¼HJËNLÙ_Vßl^äxlá~lêˆfêpêlë“sî”rî–tí”tí”qípè†iãzgÛj\ÊXT´FL 3D•+@’*B™0Dœ9K¤?L¤9L¨@Q¬BOªDN­AN³EK°DN´@J²DO²EM²DP°BK²AI²EM´DM¸HNºIN»IN·GNºIO¯FRª<TÆb]üÒ ø¿‚àƒpÞr`Ð]VÈYY¶FR¶GR³HV³JZ°BP³DQ°?P©@R¶NX±>Q¼NV¼IR®@T¸R^ÆX^ÂT`ÆY^ÆRZºJX¼W`Æ\a¾S_ºR`ºUeÌsv×yrÕwvÚ{oØv×|sÏuuÐvvԁ‚Òˆ€ÀdiÈy~Õ‰ˆÚ…ٍŒÕ€Ú˜‹Û¦¡Ú •×˜Ö’Ø“Ž×”Ô’•ÙŽÜªœÛ¦ ß°œÙ¦£×‰…Òƒ„Ö™•Ü¬¡Ü¡’۝’Ù¡›Úš’୘ܪ§Ü ”Û¤™Ø¤šØš’ݦ“ج¨Øž˜Û¦–߸®àº­ß´§ßª–ß°œØ¦ Ð˜•Ö¬¢Û³¨Þ¸©Ú² Ú²£Ø­œ×¯¦Û¸®Úµ¬ØºµÚ¼µÚ»¶Ý¶¨Ý¸°Û¶¬Ú´ªÛ¼´Ø¾¸Ø¼µÕµ³Ö²¤Õº²Ô´¯Ø¹±Û»Ýź݄yâz]âzbãxfÝxk؏ŽÜ²®âʼæͶᶜٳžÚµ¢ÙªœØ·´áʼæξæʸåǺáŹà´ßÁ¶ÞÀ¶àÀ´áÁ´àĹâĸâƺâ¶âƺäÈ»çÌ¿èοêÏÂîÕÈîØÌðÚÅïܼ§v|KCRJX"I^H^E`AbAa@b>\:\<Y9Z<`?d?fBfFeEmJ~$M›HhÁn|Ñ|€Ñ€Ñz|Ïy|ÎzxÒ„Ö‰~׋֍ÖŒ€ÖŠ|Ö†Ôˆ}Õ†zÕŒzÔ‡{Õ‰yÓ†~Ò„{ц~І€Ò†}Ñ„zÐ…zÒ€z¬EN­BP¯BN³@J®@L¬@N«BO®BP±FO­@I®>I°@K»GJËNKÖ_WÞlZâ{hä„nè‹qëŒsì“mì–vî–rë”tî–}î–xì”vé‡jä{gÛiZÍXP²BL 2G’.F”.D—3I›;O¤<M¤<L«<K¯EO®@K¬@L¯DM¯BO±CN°CL²AL°;J±BI¯CN²FN²EK·JQ¼HO¹KO¶HN·FK®AO©7QÖ‚rüÑŸõ´~êkÝq\Ó_WÈ][´DN¸HP´HT²GU¹KX¼LW°HY¶ET´DU·LS¾PV´JYÀRYÈRXÉ[_ÃX_»O\¾Q\Ä^cÈ]dÅ\bÂU^¸PcÌsv×€€Ôwt×€{×stÕslÒrtÑvqҍˆÈoj¿bkËx~Ø‚ƒÙ†~Ùˆ†ÚˆÙ”‘Ö’ŽÙ™‰ÖœšÚ—Œ×—ŽÖ‘’Ù’‹Ù •×¢¤×Ž†Üª™ÛšŽÖ’‰Í€ˆÖ–ŽÛ¦™Û —Øœ—× šÙ›”Ù¤šÛŸšÞ¡Ø§¤Ú˜”Û­¢Ø£ ×˜’Ú©šÚ¯ªÚªžÜ´¥ÜŸ’Ö™ÑŒÖŸ›Ø¢œÚ¬£Ý´£Ø©–Ö¦Õ¤œÕ¬¨Ô®­Ö³ªØº²Øµ±Úº°Ý¾¸Ý»´Ø²°Ú®¥Úµ¬Ø´®Ù³¯×¸°×·´Ôµ²Ò¬¡Ô³­Ð²­Ó´®×¹²Ü²ۧ¦àqbßxd݆„Û°®à°èɴả޷¡à¼¨á´¤Ü±©ÚÁºå̾èͽåƺâƸá´ÜÁ¶ÞÀµß·ßµàµß·âÅ·äƸâĸâĶãĸáÄ·äȹæÌÁèÐÅî×ÊîÙÍñÙÄìÚ¾‰RdOJRGXF^E`FbE`AaBb<Z<W
7^;`B`=eCc?dFp"Lz(P’8\±\tÎy‚Ò||ÒxyÎv{Ðx|Ï€~Ôˆ‚֍„׈~׈€ÕŠ~Ô‹‚Ս~Ôˆ|Ôˆ{Ô†}Öˆ|Ö‰~ÒˆzІ|ц|уwÓ…xσ|Єzу{­BP¬FO¯BN³@J­CN¬DP®CN°AK¯EL±AI²@I²>J½CGÊPMÖ]VÝm]äzfå…lê‹nëŽmë’rï’pî–sì—wî•uî—~ï’rê‹pâ{fÜn^ÎUQµFL 6D‘+D“.C–3F?O¥@P¤8E©<K®@L¬DO«EP°BM¯@K±AJ±@L°BK±<I®@M­FR®BM²FN´FOºFOµFL¸GNµCJ¨;N¨:Oæœ~þΗ÷µémß~cÓh\Ê\X¾PU´BM²ES¬DS´IQ¶IX¸GRµFW¼R\µ@Q¹P\ÀLW¼ITÄY[ÄV\ºKX¿TbÈZbË_fÌ]bÀOX´K]ËjrÖxtÕxvÔ}~Ù‚zÖqoÏhhÒttÒ„ˆÎpg¿aiÍt~Ù~uÚŠ„ׄƒØ‚ƒØ“‹Ú™‹ÓƒƒÎ…ØŽ‚Ø”’Ø—Ú ”Ø™—Ø—Ý¦•Ô›–Ó„wÓˆш†Ù¤“Ü –ÚšŒÚ ŒÙ£ Ú£™Ü¤šÚš”ÜžŽÚžÜšˆÙ¨ Ú–Û¨—ר©Ù¨¢Þ³ªÜ®¥Ý³¥Ô›•Ò™˜ØªŸÜ®£Û¬¥Û³§×¬¤ÏŸ Ö¤šÚ´­ÙµªÛº²Ø²®Ü½¶Ù¸²Ú¶¯ß¸§Ú¶«Ø¬£×ª¢Ù°¨Ù´¬Ù³°Ö¯¤Ö´°Ò±­Ð­«Ó®¦Ò¶´Ó¯ªÔ°±Ö·«Û¾ºÜ’Ûš˜à¿°èϹäªڪ‘Ú³žß±ß³ªãÀ·åǺæɸæɺäƸâŸàÄ·ÞÀ·ß¶àÀ³ß¸àÁ¶áùâƼãǼãŹáĸâ¶߿±ÞÁµæÊ¿æÍÂéÏÄîÖÌïÚÌòÜÄäÖ¿v6QKDVH\D`BbD^@`FbG^?]=X:^=c?c<dBdGjJt%Pƒ1W£PnÄrÓ}Ó|Íy}Êv}Í~|Є‚֊Ռ؋€×‰~ÓŠ€ÔŠ‚ÕˆÒ‡{Ôˆ~Ò…|ÒŠ}Ô†|Ô„xÐ…}Ñ…zÒ†xÒ‡xЂyц~Є{¯@N¬AL­CR³DN¯FP®AK«<I«CL®DP°?H±?J¶BHºHLÌQLÕ`UÜl\ä|dç‚fè‹nì‘qì•tî–oïští™vï—wî–zî’xê‡gäzdÞk\ÌWP¸HM¡4E‘,A+A–.Dœ5F¥6H§;H©?K®:H­AM®AN°FL°@J°BN²>I°?K¯>L¯DN®>L²AK³BL²DN¸FLµJP¸FL²BK©9O®<Pï¼™üΕö«vì˜jàxjÙhbÎZV¿LQ³HQ²ERºNS¶LSµFR­BR¶JVÀHQ½NXÅP[ÁT`¾S\ÇS\¿OYÁT\ÌY_Ì_jÈY[¿MW¶K^ÈktÖz|ÔrsÖ|zØ~xÔvqÒpnÐqnÑvrÊnjÀafÍpyÖ}xÔ{}Öxx؍‡Ø–“׊„Ò…ƒ×…Ôˆ‹Ô‹‹ÚŒˆÚ¢›Û¨¢Û¨œÖ”—Ø‘ˆØ–ŒÏ{Ô––Ú¢˜Üœ’Ý¡‘Øœ—Ö•’ÛœŠÚ¨žÜ¡”Ú›’Ø¡—ÜœŒÖ•–Üž‹Ù¨×œ˜Þ±£Üº³à²£Ü§™Ö¢Ø¥¡Ù§žØ¤›Ú¦›Ü«™Û´ªØ´­Ø³ªÖ¬©Ú°£Ø¶ªÚ·®Øµ®×²©Ú¸¯Ú±©Ú¦œØ¯¤Õª¨Øª§×­¨Ø°¬Ö°§Ôª¨Ô°§Ó­¤Ð«¨Î£ŸÒ¯«Ð¬¬Ô®©Ó±«Û¸¨Ý¹«ãÄ°çƭ⸡ڵ¢Ü¹¦Ü·ªÛ»²âöæɹçƶäÄ´ãÄ·âĶàÁµàÁ³ÞÀ´Þ¾®ß½²àÀ·àÀ¶ãŸáÆ»äŹäµâĹ޼¬Ýº­àöæ̽èËÀêÌÀî×ÊïÙÉòÝÁÛŲ\AL@V@Y<]?^>`Ad#EdD]@Y;Z8`>d>a?dIk$Pq$P1\–Imºf{Ñ{}Ö~~Òx{ÌwzÎy|Ï„‚Ò‰„ÖŒ}ØŒ~؍~׊‚ÖŠÖŠÖŠ‚Ò‡‚Ó†~Óˆ€Ó†|ÔŠ|Ò†zцyÔ†xÒ†|Ò…{̆}ÒˆzÒ†}­FUªAM«BP­BN¬DPª:L«@M­BN­DP²AI³DK³BL·HMÅQRÐ^TÛl^äyaæ…gêŽlì’rî–mî•xî›vð˜rñ˜mî—rî’rìˆiä{gÜkZËRO·IOŸ5G“,B+@—0B4D¦8Fª=L«:H®=J¬<L®@M¬GQ­CR±@M®>J¬BL®@L­AM¯CM±@I²@L´DM¹IO¶DN¶BH²AL«8N¸FRöÍ©üǏó®xêŸ|ãx_ÞzcÏ\WÌ]XÀLUÅVR·KT´DPµFV°CR»JVÀKP¾JRÂPVÍRQÆOTÈX_ÇbdÉV_Ì]dÊ``¾P_²F[ÂhrÔuw×|wÔwwÔsqÒnnÒpnÔxvÒ|rÂad½_jÌpsÕxtÓuvÔ|Ô€ƒÓyÖ”ŒÎ|{Õ}yÖ…‚֍ŠÙ’×˜Ø‘Úž‘Ü¥˜Øž“Ôƒ‚Ò€ÖŽ‹à›‰Üª›Ü ”Ø“‹Üœ“Ûž“Ú˜–Ú—‹Û¤–Úœ”Ü –Ø›‘Ö˜’×”Ú—Û¨Ü¦¤Ý¨›Ø¤ŸØ¥žÚ¨Ü©žÜª—Ü«œÜ­žÖ¤œÖ¦ŸÚ±©Ù²ªÚ¸²Ô¯©Ú²¥Ø¶¬Ù³¬Ø²®ÜªžÚ«œØ¨¦×›”Ô¤Ö«¤Ö¯«Õ°«Ô¤™Ò®ªÓªŸÔ­¥Î¤žÊš™ÈœšÎªªÒª¢×µ«à±俨߰’Þ­Þ½ªàºªÞ¸°áöåÊ»é̼æÈ·â³⽫àÀ¶à³ÞÁ¶ßÀ´à¿°ß¿±ß¾°à·à÷âƸáøâÅ·äƸຮ۱£Ü¸®áúæɽæÊ¿êξïÖËñØÂïظ›L>O=X>[<_@]:cAb>[>\;Y<`Ab=f=gDdFbEn%RŠ:c¬[vÊt}Ö~Ò}|ÐwzÌvzÑ~~Ò‡Õ‰€ØŽ×€ÕŒÖŠÕŠÖˆ~Ô†Óˆ€Ó†Ô‡}Ó‰€Ô†{ш€Ñ‡|Ò†€Ñ†~Ò†}Ò…{Ò‡{Ó…z°FW«AOª>N¬CPªDQ°AN¬>Hª@M¬>J¬=I¯@L³?G·ENÂQNÍ\VÙn`äxcæ‚hèŽsí”sî–mï™sî›sî–yï–rî™zï‘qê‰näydÜhZÎUR¶INŸ3E“'@’)C˜.Ež6F¢8H¥=LªAL°?I²@M°=J¯AK«@M°>K¯AL¯BN®@M­>I°@J´CL³BJ·EM¾IN´FN·BH®FR¨6NºLQøУþʼnô¨qñ¡nä|cÞqcØj^Ò`ZË\UÌVTÂNQ¼RX¸GR´HXºGR¸GV¼MU¼KV®>N¼QWÊTWÂTZÄ\cÈY\¼Va¶N[Ã`nÒqsÖvrÔz|ÕytÍlpËhlÒwwÔ‹„Ã_aÄhoÒuvÕÒzyÒzyÔ~|ÕŠˆÆsuÌpnÕ†}Òz~ØŒƒÙœÚžœÜš’ם“ԍ‰Ö†{Ö‡„Ô…ˆÚŸ™Ü¡”ڏˆÝ˜„ÜœŽÜ–ŽÜ™ŽÞœÜ¦˜Ú›”ڐ†Ü¢—Ûž˜Úœ‘ØŸ—Ö–’Øœ™Ú”Ú¢—Õ œÙŸ˜Þ®¡Û°¨Ùª¢Ø£Ø¦šÖ¨¤×ž™×¦œÙ®¦Ø®¦Û¸°Õ´°Ô®¨Ú°¤Ø²¬Ø© Øª¤Õ¡£×œ’Ô  Ôœ™Õ¨£Ö­©Ö­©Ô©¨Ð¡•Ï ¢Ñ¢™É–—ʐÇ™›Ô±¥ßòäêݬ–×¥˜Ó¦žÛº¬à¼°Ý¼²âŹæʼè̸æǸäIJ۸¬Ü¼²àÀµÞ¿µàÀ±ßÁ¶ß»°Þ¾´à¿³âø߸âÅ»ãĹåƸäÀ±Ù¨ž× “ܲ¥ß¾²äƼçȽêʽîÑÄîÔÀéÕº–^fKCR;Z=[<]=^Db>dD\BX=Y=]<c<hAfB]<Z?u)TžMj¿o}Ó|Ö}{Ðy|ÐuxÌy|Ò€~ÕŠ‚Ö‹ƒ×ŽÖŒ}ÔŠ€Ö‹€Õ‰|׋‚֌Ԇ€Õ‡ÔŠ‚Óˆ‚ÕŠ€Ô‡|Ò‡ÔŠ}Ò†}Ó…~Ò‰~ÔŠzÔ†{§AQª=Kª@NªDPªDQ¬CP«?M©AL¬@M¯AJ­?J¬=H²CLÀMLÐ\RÛn\âwaå…eêŒnëpî˜qî•rî˜uî”rð—wï–vî’oê‰räv`ÝjZÌ[U·JM 4H”,C“+C™.FŸ3F¦;G¨?Iª@K®<K°AL´>J¯BN­?L°BJ²BN®@K­?L°CK°?J³@K²FN¶DN³CM´HN´DJ®BM¨7N¿TXùÔ­û¿…ô¬wéštÞs\Þzc×h_ÖjbÈQSÌjbÆTSÂMN¶CN¼HP¶CP½P[¸FR°HZ¶J\ÁSXÃYdÀT\ÄPTºP`´L`Âck×rxÓjlÖwyÕzuÎlqÒnpÌvwÑ€w¾Y^ºZfÐprÙ|tÖ|yØyvÔ‚~Ô†€ÒztÊgkÐprÒprÔ‡‚ՍØÜ¥ Ù™˜Ø”ˆÖ‹†ÎptÖŠ†Ý¤—Þ —Þ ”ÜšŠÕŠÛŒ{ÞŸ‘Üœ”ÜšÞ¢•Ý§šÙ›–Û–’Ü ‘Úž•×›˜Ø™’׏„טŽÚ—•Ü›ŽÙ§žÝ¦šÛ¦˜Û£™ÚžÖ¨¡Ü¬¢Ùª¦×Ÿ›Ú¨–Ø®¨Ùµ­Ú¶­×²¬×¨¢Ù¢™Ù¦¢Ø©¤Ö®ªÓ¢£Ô›”Ó£ Ö˜•Ö«£Õ©¦Õ¨£Ï–Ì ŸÉŠ…Å‘”Í¢ Ý¿³ä®޳œÕž’Õ£˜Þ¹®Þº®à¾²àĹãǸçǶåƸãƶã²ܺ±Ü¼³ÞÀ´àÀ¶àÁ´Þ¿´ß¿´à¾´ßÀ³á÷àúáƼä÷åƶäƹץ˜Ò–ŒÒ•ŽÛ¥”Úµ«æƺäĶæƸîÑÁíѺáÉ´o,HQ@T<X:Z:\<`Ba>c$L_&LV;`>a;eDhDcDY@ZA„3\®cyÏ|~ÔƒÑz|Ìv|Ïz|Ѓ‚ÑŠ‚ÖŒ€×Š|ÖŒƒ×~Ö‰€×‹ƒÖŒ×‹~ÖŒ€ÕŠ‚Ô‡}Óˆ‚ÔŠ~Ô‹xÓ‰Ô‰|Ó‰|Ôˆ}Ò†}ÔŠzÕŒ{Ô†z¬<J¬DQªFT«?M«=Jª@M®?N¬@M¬@L­DP©?Lª@L³DLÄQPÏ\TÜn[âw_è…gìjî’nì—rî–uí™rí–uî–ví˜{ì‘tê‡kåzaÜl^ËXW´JS 7J˜,D’.G˜4J <O£:H¦=K¨:I®=J°CM²BL±DN±@J¬>G°BN°CJ®>I°DJ²>H°?L´FO¶DJ³GNµIO´DN¯@I¨7PÅ\Tù׫ü€ô¨zí•jâ•zÜoØpeÝr`ÓaX×]VÑZS»HN»HQ´JV¶DO³ET¶IYÂRXºGVÀ[bË\Y¹GR«AWµHXÈlsÔxuÖhjÔtpÖurÑkjÓsuÑrpЀr²T_»\hÐnlÖyvÔtrÓzvՁ€Õ|ЄÏopÍktÒxzÔ~ƒÑxyØŒzц‹Õ‡~Ùœ”Ò‚€Ñ}‚ÔŠŒÛ™’ßšÝ¡Úœ”Û”ˆÛ”ŠÕÝ‚ÝžÚž˜Üœ’Þœß¢“Ú˜”ØŒˆÖ‚€Ö”ˆÙ£–Ö•ÖˆÜ–‰Û ”ÚœŽÜ ”ҐÖœ×¥ Ù¢˜ÜªžÚ¯¨Ø­¤ÚŸ–Ú« Ú±¬Ø¯¦×«¡×¥ ØŸš× žØ¦¢Ø¤¡Ù­¨×§¤Ö˜ŽÔ¡¢Õ˜ŒÔ¦žÔŸ˜ÌŽÆŽÇ––Û»°æĮṞ֪—׫žÙ¶ªÜ³«ßº±àÁ´æƶæƵäöä±ã±àÀ®Þ½±Ý¼±Þ¾±ÞÀ¶ÞÀ¶ß¿´ß½³ßÀµàÀ·à´ãĸáźâĹäƹãŶܰžÔ”ÑŠ‚ÓŒˆØ›ŽÝ¸©à¶¢Þ°Ÿä¼®íʼêήƕŒT<P>U@Z@]>`@_?^;]AZ?\>_;`9_=`C_H_Hn!LœJjÀn}Ô€Õ~}Ïy|Îv|΁҈„ÔŒ„ÖŒ~֏‚֏€Ù€Ö‹‚Öˆ׊‚ÔŒ…Ô‹Õ†yÔˆ|Ô‡|Ó‰|Ôˆ~Óˆ{Ò‡|Õ‡{ÓŒ{Òˆ{Óˆ}Ô†}Ô†z¬@L¨AJ¨AJ¨BQª>NªANª>L¬@M¬=I¯@K¬>I¬?H´GPÄNOÐ`XÞo`ãzbæ…nëlî–oì—uí–ví˜zí˜xì“tì–vî‘xê‡iä|jÞjZÎXW°FP 2H”.F”*E˜3IŸ9H¥>N«?L¨?L®@L°?M¬HS®BN¯BO­@L²?K°BJ®@J®AN±>H°CN¯BL´DM³AJµEK¶BI±AM£5Q½VTùÔ®ù¶~ô¦uî™lî‰géŠhàwaàr^ÞmXØj]ÌZ[ÁQTÆPO»IP¨2F¬BS¼MSµDP¿UZÇXYÄRXµHT°FXÆdjÕtsÔspÒmnÒfdÎnvÑmnÔ€tÆrr²P^»XfÐrpÕvuÙ{xÖz|ÑzwÓ‚|ÏvxÕ|{ÒryÒ|×…‡ÔŠ‚ÌrxÌnsÖ’ˆÎƒŠÑtpÎ}„Ú‘Œßž–Ýž’Û“ŽÙ‹ÚˆÚšŽÙ•ŒÛ”Ž×’‹ØŠ†Ü–ˆÚ –Ù–Ú‹€ØŽ‰×”ŽÖ‰ÓŠÚ€Ø˜ŽØœ•Ø˜ÕÒˆÐ“šÕ ™Ö™Øœ”ؤšØŸ™Û®£Ü®¦Úª¦Ö¡ž×§š×§Ÿ×¡šØ¢˜ÖžžÕ–“Ù§¤×¨¦Ö§¨Ø¥›Ò–šÔš‘ЉˆÐš–Ì’”È“’Ôªžä®æÀ¤Ú§Ù¬œÛ·¨Ý´¦Ýº¯à¸âĶä°å²âÀ²à¼®Þ¸¦Üº«Ý¹ªÜ½³Ý½°à¼°áÀ´ß¿µÞÀµÞ½²áõâ¸áÀ¶âŸãÆ»âȾä²âÀ±Õ›ŒÒ‹„͈ˆÐ‹‹Ö¤—Ø£–΀zØž–ḭêÄ®æϸ‹LWQ@T@]"J]C`A`@aB`A^@W=\8`<^9Z<^Cn&Vz0\Œ:_²cyÐy|Ó}ÒzxÏwzÏy|ЂƒÒˆ~Ö‹„׋ØŒ‚ØŒ‚ÕŠ׋|ØŠÔˆԏ†Ô‰}Ô‡~ÓŒ€Ñˆ}ÓŒ~ш~ÒŠ{Ôˆ|ӌҌӆ|Ó‡tÒ‰€Õ†x¬@JªBNª>JªES¥<K§@O¦BN©@J©@Jª>K¬?L±BL³BN¿NSÏa\Ýoaä€lç†hëlí•rë”uí“vì™pë•sí’vì•yìŽléˆkæz`Þk\Ì[V±GOœ6J’0F’.D˜.FŸ6H§>P¨>Oª>P®ER®DPª@Nª@N°BL°@L°@K®AL°@K¯@K°@L°EO°BJµBL´HP²@K²BL«?M¢7V¾`WúÔ¬úµpò®{ìfæ‰må€dÜ|jßpYØogÛdZØg]Ò\VÆNS±@NªBR¯<L¬:M»NTÃRV¾OW¿MV³GXÄjnÒjnÖnjÔnmÔnlÌdjÏjpÐwwÊzu¶R`¸VfÏjlÖpnÖyvÙxt×€{ÎwuËrrÍr{ÒttÕ„Ô…†ÎrrÌx}ÍzÑtÕ~zÕ~xÏvÚˆzÜ”à˜Þ›‘Ü•ŒØŽØ‰ÜŒ‡Û˜Ü”ŒÛ™’Ø–Ž×†„܏€Ùœ‹Ø•Ù‹ƒÛ”‰Ù‹Ø•‰Ò–‘ØŽ†ÕˆÑ‚‚Ì…ˆÓÙ––Øž–Øž“Ùœ–؝’Úš˜Ø˜Ú¯§Ù«¦Ô¥ Óž›ÕŸ˜Ö¢œÖž™Õœ™Ò–˜Ô”’×£ŸØ¬¢Ô žÏ™™Ê…~ʈÉ‹ŠÕ¢”ݺ¨ã½¢Ü¨ŽØª—Û²ŸÛ´¥Ü¹°Þ¾³âÇ·çÅ´ãÁ°á¾°á½¬Þ»ªÛµ¬Úµ«Ú´ªÛ¸°Ü»°Üº°àÀ´Þ¿³àÀµàÀ³Þ¿²à·âÀµâĹâùäȼãƸäǺؤ”Ћ„̓Ñ’ŽØ¤—ؤ’ÀjhÆz€Ùž—೤ææֵ¥^=TDR8\C_"J` D`?b<_:Z:Z;b9d>\;\Bb Oy.Zˆ8d¦XrÈt€Ö|{Ó|}ÐvzÌvyÍ€‚Òˆ…Ò‹„Ô‹€×Œ€ÔŒ€ÖŠ€Ö„}Ö‹×ŠƒÖ‹‚ÖŠÓ‰ÒŠ€Òˆ{Ò‰‚ÒˆÒˆÒŠÔ‰|Ò‰€ÒŒ|Ô‡|Ò†yÔˆ}Ôˆ¬@L¨@K§;J¦>H£>L¨:L¥<I¥@J§>L§>Iª?L°@N°BOÅQRÓbZÜrbä{cè†fëŽpì’rë”uê“wì”té”sì“rê”vìoì†jæzcÝl\ÎXR±HPŸ8H”)D/H˜.Fž5J¥<K¦;Lª@N«?L«DQ®BN°@K¬@L¯BN¬>J®BM®AJ¬>H­@I±AH´DH´AJ³EN³AI°@Iª>MŸ4PÆl\úÌœõ±|ó¥lì–qëŽgç†héeÞobÛj\ØpfÛm_ÍXU¾FN³FS®@M¥8N²HQ¼LS»HP·EO²@TÇmrÔtqÒmjÎioÓifÐegÏlnÐppÊqo´P\¸ZjÈjnÓllÔllÖxt×€}ÐtsÐsrËloÑtrԁÎvpË~Ìx~ÖŠˆÖ…‚Õ{yÍjpÔ}{Û–Ö‚‰Ùˆ€Ü‰Ú‰‰ÝŠ‡Ü˜‘Û–˜ÙŒŠÚ’†Ø–ŒÜ’‡Ø“ŠØ‹…Ö†‡Ø‚|ß ’Ø”’ÙŒ†Ý‘‚Ù—ÕƒÊ~‚Ï‹ˆÑ•”Ô“Ö™’Ö•‘Ø””ÛŸ”Üž×•”Ø—’Ô“”Ø¡–Û¬£Ø£œ×ž˜Ö“‘Ô™‘՝ÔžšÓ‘ÓšœÔ•–Õ££Òš˜ÅŽÅƒÎ”’Ù±¥åÀ«ÞªÖ¥–Ù­ŸÚª Þ²¨ÞÀ¶âȼæÄ´æòãÀ°äÀ­Ý¹­Ü¯¤Ú¸­Ýº­Ü¶ªÚµ¬Ýº°à»²Þ¾²àÁµàÁ¶áÁµßµàÀ¸âøâÀ¶ãȾäȽäǺäǵ⽭̇ˈˆÑŽ‰Ø£”Ø¥ÀkjÀnqÓ‹ŒÛ œß´¦èÑ´©v}P<P<U:X:]@d(K`$C^<[9X7^=h>c<\>_Fl#R~1\žIj¼o}Óz|Ô{Ôz{ÎvzËz}Є€×‰‚ÔŒƒÕŽÕŒ„ҏ€ÐŽ‚Ö‡~ÔŒ€Õ‡}ÓˆÒŠ|ÔŠ~ҌՋ҆~ІÔˆzÒ‡yÒˆ}ӍÒ‹}ÔŠyІ{ÏŠ~Ò‡~«<G¬JT§=J¨@N¦>J¨BK©@L¨=J©>I©>L©@J­?L´DPÃSXÓ`[ßn^æ|dè†ièŽlërì–vë–rë–yë–tì–ví•xì’qêˆmæ|dßr`ÎYT¶FN 6H”*D“,F™0H¡8L¥>M¨=L¨BO©BP®BQ­AN¯@K­BN«;G¬>L®AJ¬@M®AN¯AJ°BJ±FQ°@I°AK¬@Jª?H¥8Kž2NÎziúΞú®jð xîškçŠoæ‚_Ýrfæ{^Ùm`ÜfYÖpfÑ[R¼JO¸GT­CT¶JU½JPºLWºET®EYÆdlÖrqÑpqÔkjÏjiÊY`ÍinÏtuÁaa±ZhºXeÆ`iÓqqÔwuÑqrÒrpÓtoÎrtÐnqÔvqÉryÈqjÂgrÐ|xØ„…ׂ~ց‚ÎosÏ{ƒÔzzÜŠÙ‘ŠÒ‡ŒÓ{ׂz؇ŒÜŒƒÝ£”Û’Ø†ƒÙŠ„؆€ØŠ‚Ù‘†ÚŠÖŽ‹Û†€Ý˜†Ù–Òvq́ы‡Ò›–Ӎ‹ÖŠˆÖ”Ž×ŒƒÛ–ŽÖ—Ú”ŒÚœšÚ”ŒÙŒŠØš”Ø”Û˜×›•Õ–˜ÖœšÓ’•Ø˜ÔœžÎ’Ò”ËŒ‘ΐˆÎÈ”بžã¼¦â±‘ÚšˆÕžÜ¯™Ü°¢Þ¾²áÁ²æȸæŲå¯ßÀ¯Üº¬Ü¶ªÙ¹«Ü¸¬Üº¬Û¸¬Ü·«Üº®Ý¼±à¾´ßÀ´â³ßµ߿¶à¸àĸßøÞļâȼæÉ»æ˺äɸ՘‰Ë†ƒÒ’ŒÚ¢–× ŽÂpnÀw}ʆˆØ™”ÜŸšã¶¤æÒ¼‚BTN<R<X;[<]AaA^A\=W<[<`@e@`<\AcLv.ZŠ7a¯_wË{~Ö„ÔyyÍvyÎx{Í€|Ó‰‚ÔŠÒ‹€ÖŽƒÔŠƒÕ‹†ÕŽ€Ôˆ~Óˆ€ÒˆÒ‰„ÒŠ€Ó‹Ћ„Ó‹}Ò‰}Òˆ~ш~Òˆ|Ñ…}ÒŠ~ÔˆxÒ†€Ðˆ€ÐŠ{Ô‰|¨>Kª@M¨?L¦=J¥>L¨>L¨>K§<I¦<J©>L®<Hª@Q³DPÆPRÒd\ân\æ|fç†jèlì”që–vì–tì“yí”rï”oî”tí”pêˆjäzcÞn`Ì]Y±GSŸ;P”-H“/I™2J¡7J¤:L¨=LªAN­@N¯>M®@K®@L®@K°<H°BN°@I®@M°BL³FN°DK²BK²@J°DK¬BK©<G¥8K¢1MÜ’súÄ‹óªzó©në™tëœmÜtjæˆdÚvoÜl\Î`\ÚpcÏ]YÊQUÂRW·MVµCR¸HQ¶BPºHWËilÔtvÔppÓnnÒhiÊfjÉehÌmkÂgj³O^ÃajÉcnÓtuÔsrÖpmÔ~}ÐkkÐjmÐppÐytÈhmÅimÉrvÒ~~ÑyzÓ~zÒpoÎhoÔ}~Ú‰…׏ŒØ€Úƒ~؆„Ó†ŠÔ€„Ú…~ÕŒŽÚŠÙ†Ï‚ˆÒ†”Õˆ‹ØŒÚŒ‡Ý’…ܘÙŽ„ҁxÍyzÄw€Ôƒ×œ˜ÙŽ‚Ú’‡Ø”Ø™Ö×‡„Û˜‘Ù”–Üœ‘Ù“’Ø““؍ˆÖ•‘Ö‹ÔˆˆÖ‘ŒÖœ˜Ó—˜Ò‹Ô•ŽÒ“‘Ê€„ÉŠŽÇ‚ˆÔ”Žá´¢ä¶ŸÞ¤‹Ø ŽÜ©“Þ­Ÿà¹©äÀ­åÄ°çª㿪ཨ๤۸ªÜ·¬Ú´¨Ú¹°Ü¸®Þº®Ü»°ß»­ß½¯ß¿µàÀ´à¸á¹áÁ¶à·âÄ·á·âÄ»âǼäÊÀçʼæʺඤ̆ƒÌ†…Ôž–ØžŽÇwrÇ‚ԏŒÕ–‘ÒŠŠÜ£œçֹ̳§V@P@T?Z@\<^?_@^=^&MU<[<aAcB]@^Gj#Sy+Z NoÀo~Ò‚„Õ~}ÐxzÌx}ÑyzЂÓ‡ƒÕ‰Ö~׌|ÔŒ‚Ô‰~Ôˆ~Óˆ}Ò†zÓ†{Ó†~Òˆ€Ó‹{Ó‰€Ò‡|Òˆ~Òˆ{Ї{ÒŒ|Ò‰{Ó‰|Ї|Óˆ}ІyÒ‡zÓ‡z¦BUªBM¨DS©=L¦8F©=J¨?J©@L¥<Mª>K«<I²BN¼JRÌUTÚaXánYä|dç‡kénì”pé”sê–ní“xì”tì˜rí’tí’uëˆnæzgÞqbÐ[V´JR¢4H’,CŽ.Fš1EŸ:K¤:L¨<Kª@O°AN«BL¬@O¬?M¬AM²@L¬AL­@J­<H«?L¬@G±@K¯@G°<I°BL®BL«:F¥5Fž/Lâž…ø¾…ø¶zñ¤{ô¯pëoéjÞv`éˆfÜtbßq\Ûj^Ûj\ÍUUÐZT¼LS¶JR°?O®DWÈegÊ`jÕjiÑlqÎfhÌglÊjpÎtt¿X^°TfÀUfÆ^dÒtpÕtrÔssÖuvÖwvÎnlÑmoÍvrÀ`gÁbnÌkqÔzyÕ~xЁ„ÏpsÊgoÑ||Ù€؇€Ú„Ûˆ†Ô{~Ôx|ÚŒ‚Ø‘–Ñ~ƒÔ~ЁÎv‡ÀsÄƒ™Ôˆ‘ØŽ”Ø“ƒÜƒØˆÐ€Å~‰ÑŽ×Ž‡×Š†Û‘„Ö’Ö‡†ÛŒ„Ø“ŽÚ’ŽØŽØŠˆØ”Œ×Š‰×“ÙŽŽÖ”˜Ô†ˆÕŽˆÑŽ’Ò‹ÒŠÒ”ÐˆŠÐ‹ŒËŒŽÅ‹ÌÚ¬œâ¸¢à®‘ÙŸÚ¡ˆÛ¨—Þ·¬ãÀ­ã¼©ã¼¦á¸Ÿá·žß²™Ù¬™Ø¬žÚ¶¦Ü´¨Û¶¬Þ»®ß»­Þ¼®Þ»­Ý¼¯ßÁ³à´âøâ÷âĸá¸à·á÷âĺâǺäË¿åʽæ̺ãŶ΍ƒÈ……Ò–Ò˜ŽÇuyʇŠÔ—Ó‰~ÉvwÌ€†á´¥îÙ½¨tvLBO?V@XD^A^?_>]EU:^$KaBeBdB^E_Jk+X†8b³dtÏ}Ò€€Ò}|ÍuxÊvyЀщ„Ó‰‚ÔŒƒÕŒÕ‹€ÔˆÑŠ€Ò†~Ó„|Óˆ‚Ôˆ~Ôˆ|Ò‹„Ò‰}шÒ‡}Ò‹}Љ|ц}ÑŠyω|Ò†|ч|щ~χ}Ò‰Óˆx¨=K¦?J¨BR®BP­AN¬<J¨@N¨?M«@L¬@H³@M´@J¾GPÉTTÖbZàpaåzeæ…léŽpì“oì–uì—rì˜xë™xì˜pì˜tínëˆpæ|fÞshÐ]\¶NT¤:N“)B‘.C˜-C6J :K¥>L§>L©<M­BL­=L®=J¬@N¯9G®?J°@L²AJ®BN¬AN®?H°>I°BN±AM«>I©:D£2Gž0Iì°†ûÅŽö¸…ö¹yíœzð©|èpæ“pâ‚jä~_ÜdTáycÙo]Òf^ÅLN¼HP´<L©<NÈgf×mkÑhjÇXaÐjhÈfrËdjÍrrÂ_b´WeÀZfÄ]lÓtuÐlqÒllÓutÖzvÐhiÐuwÌipº[g½]lÌhqÓz}Ô€|ÐssÒ{uÈdmØyz׈ˆØˆ„ց„ځ|ׄ‰Ö|Ð~ÐwŠÓ‹šÎ‰¢ÅŒ«¼…œ²ž¨v–¨j†¬by¯gx«Uh¹^aˆˆÔŠŠ×Š„ÚŽŠÛˆØŒ„ؐØˆ„Ø‘ˆÖˆ‡Ô†…ۏ†Û–ŽØˆ×…Ö”“ÕŠˆ×’×ÔÒ„ŒÔ‘ŠÑ’—Í{Î‹ŽÊ„ŒÅˆÊ…ˆÖ¤™Þ³›ä¶ŸÛ˜†Ù “Þ²žÞ¬¤ß¸¤çñå¬ỨܴœÛ± Ø­žÔ­ŸÕ°£Ù±¨Üµ¨Þ¸¬ÝºªÜº­Þ»¬Þ½°à¾³ßÀ´à÷àĸãøâĹâøá¸ß¸áŹáÅ»ãɽæÊÀåÌ¿çк֪¡Æ‚‚Ñ–Ñ’†ÇzzÎŒ‡Íˆw¾ed²Ud¿mvٝ˜éÌ·åÒ½t0HJ<R@WAZA`FaB`D`"LZEc!Hi,PgDc@aH`Gt&X›JjÆqyÕ€~Ö~|Ñy~ÎwyÎ|yÓ…Òˆ~ÕŠ€×ˆ~Õ‰|Õˆ~Ó‰|Ó‡|Ôˆ}Ô†|ш{Ô…zÓ†|Óˆ~ÔŠ~Ô‰}Ó‡~Ò†{ш}чyÒˆzЊ{Ò‰~Òˆ}ÒŠÒˆ|Ó†|Ò…x¬>Kª@M¨@N¬BP¨AP©AM¦>P¨>J¯@J­BMµDL¸HRÄHNÏTTÚ`Xàm^åzcèˆiëŒrì”tì˜tì•vî–rì—vî“tì•pìmîˆlæ|fßqcÎa]°DKŸ5E‘*C'?–.Fœ4H ;L¤>O¨AQª<P«BO­BN«>M©>L¨<K«BO®BK®>J¬>J®CL°@I®@K¯>H°@H¬<H§:FŸ.Ež-J髏úÆ’ü¾‚ò«xõ½†î”kí›pèŠiæißq\Ü~kánVâmÞhVÍb\¾DK¬3JÂSVÏbhÖjiÐhkÈenÄ[fÉjuÌom½\e³VfÁcjÄZfÓutÕqmÑkjÐllÒqrÒjgÎnrÉgi¿[lÅipÇfsËjrÔ€{Ð|ƒÎrpÀ_kÐkr×yxÛ‚€Ù„Ú‡…ÓyÈs~³^~´d}¯i‡®h„¸rŠÅx‡Æ‚ŽÈ|ˆ°b~½zÃxz±v†•U|+VÍ~€ÚŽ‚׈„ÛŠ€ÚŒ…Ö†ƒÖ†Ò…‡Ó‹–ÛŠŒØŒÖˆ‰Ú‹ÖŽÔ„‚Ø…~Ò‰‹Ð„ŒÐ‹ŠÓ‹’ÔŒŒÏ„ˆÑŒÈ‚ŒÈyy˃ÌŠ‹Þ¬–羦ߠ‡ÙŒØžÛ­¥á¹§à¸­åº¢èÀ«á¼©Ü³ Ù²¤Ù³¤Ùµ¦Û²¢Úµ©Ü¸¬Ûº°Þ»°Ýº°Ü½­Þ¿²ß¾°àÀ´âÁ¶á¶âöâºâ¶ãĹáżàùãƹâƼæ˽æ˾æ̾åƸɈ„Ì“’Ћ€Æ€Æ|r³TS¢MXš>W°XfÅ{„ⶬîؼ̬žT?K<P:X@ZDaDcD^A\DZ>bBl)LcDbFcNj!Q…2\²`vÏ}Ö‚~ÑxxÐyzÍz|Ђ~Óˆ~Ó‹ØŒ~׊ÔŠ~Ôˆ€Õ‰~ÓˆÔ†{Ô†}Ò†|Ð…~ш€Ôˆ~Ô…{ч~Ó†{Ò‡yшzÓ†uш}ЉzχzЈ~Ð…|φ~цzÎ…}¬DQª>N¬BO¨@N¨<J¬@KªEP©AM®AL±@M·HL¸FPÂHNÌSUØbXào\åzaç†lêŽnì–rí”sì—rí˜tì–xî”pí—nî’pîŒmå~gÞo^Ï[S´DL¢6H‘'A(C•0F™4J¢7K¡<M¨DR«BP©=L¬?K¯<Gª;J®<HªBM®>J®?L°AM±<J±=J°CL´@G¯BL®<H§8Eœ/Gš+KꬂúÌ™÷¹…÷ÀŠò¡wðª~êŠhè˜lè€\åjä‚[à|mèzVÝzkÕZQ¶ES¸HVÇ]dÌ`aÇ^hË`fÌbfÇ`hÌqrÄag­N_¾\gÄ\fÏopØvrÔstÑkjÒnsÐloÑspÆfg¶VgÊdkËjmÍsyÌntÑmoÎwrÈ\jÓ{ÔzÖvyØ{yÓw}¿dvžDfŸP{¤\§Wv Ji—Eh”Ab¡Nm»gvÈm|¨QsÈ|…Ëx…ЄŠ·wƒ”Nzª^lËyÎÕŠŠÚŠ†Ø‡ÖŒ‹½u€²uŠÂzÍz€Î~„ØŽÖˆŽØŒÌyŒ¶i§ZxŒ7XÅ‚Ð†Ì‡’Æv{Ɓ‹Är}Ò–à´¢ä°–Ý ŠÖ—ŠÚ©¢Þ¶®á¹¬ä½­æ¾ªäº§ã¼©Ý¶¦Û±£Ú´¤Ú¸§Û·¬Ú·«Ú¸ªÛº°Ü¼±Ü¿µà¾³ÞÀ±à´߾³à³â·á¸âƸâĺàÄ·ãŸâÄ·âùäǺäȽçÍÀèÏÁæʺנ–ΐŒÎˆ€È‚v²ZW”:G”1IAT¢H^Áv†Ö¢£ìϾíÚ»—_bM
-8J
-6Q
-7Y;\?_<\@\<\?]@f@lB_@`I`Mr&TšLjÂny×|×|ÐvyÌv~Ï}ЄÓ‰‚ÔŒÖ‰€Ø‹Ö‰|ÖŠ~Õ‰|Ò†|Ò†zш|Ò‡|Ô…|ц}Ôˆ|Ò†|ц|ц}Ò‡{Є}ч~Ð…yÑŠ}Ј€Ð‰|Є}Ð…zÐ…uÍ…{¨BQªDR®?L¬CR¨>N«BP¨AS«AN¯BP¯BP¸CL½DNÃHPÊSV×d[àq^å{_è…fìoì”së”sì˜rì—sì–sî˜tî˜nï‘sîŒnäƒpßpaÓ]T¶HL6D‘+@Œ$?–+@œ9K£8L¥=JªBN®AL­?L«BP¬AK­DN±?I¬>J°DJ®@K°?K±<H¯CN²AG±>J°:Dª>J©<F0Dœ,I檈øɝüÆŒøªyö”ïšlæ˜tè‡`äŽnæ~WÞvhèƒ^à{dê{XÐ_`ÆPUÊZ_ÄU^Ç[aÉ^bÅ^iÊ]dÊns¼]`¬N]¼XdÀ\hÏjlÔptÒklÓpqÐhkÐehÐtr¾Z^¼XcÊhnÆamÊksÍrrÐ~‚ÇclÃ`lÐsvÕz~×€ƒÖ~…Ðq|·To”Cmª\{Ä~ŽÆn~ÅizºXp±[r§PnœKnˆ6^“>d–Oză”Ù’“ۏÔŒ¼wŒ›_”T‰’S…ŸZ~©Wx¶`sшÚˆÓ†ŒÇŽ˜°z’žV~»pˆ¹kˆÆxŠ¸Œ±—^¢pw5pf O°mÊ†’ÂvŠÌxØ¤–㳚঎؏€Ø–‰Û¦žâ¶¡æÆ´æ²æÀªâ¸¥à¶¢àº¨Ü¹ªÜ¹ªÚ¶¬Û¸¨Ú·©Ù¹«Ú»±Üº¬Ü½µàÁµàÀµßÁ¶áÀ´à·áÁ·âøãĹâŸâ¶áĺâĸâĺãÄ·åȺæÊÁèοêоܮÒ•‰Ì‡|¸h`œ;H‹3J–<Mœ<O¨L^¹anÖ›šçÆ»ñÖ¸Ùº¢f:M:P8T9[:a@^<]?Y?\;c>f>h D_G^Kh N€3\®_vÉz‚Ó}|Ô}zÎx|ÐwyÑ‚~Ó‹„ҍ‚Óˆ}Ô‰ÕŠ€Òˆ~ÕŒ|Ô‡|Ò‡Ôˆш‚ш€Ñ‡€Ñ†~ш~ц|Ї}Ñ„zЈ|цzшzЇ~Ï…yΆ}І}Є|Í‚zΈ|΃zªDN¨BP«>MªDQ©DQ©@O¨?M¬BM±BP­>N¶AJ»CHÆJPÑTQÜdXäpZæ{bé†kìlí–vë–uï–qîpí—vî–ní—vï’pí‹lè€fáp^Ó\R¶HNŸ4D'>,E•0D˜0Dž8H¢<J©>LªAQ©@O¬=M±@L®AN±>K°AK³BK±=KµBP²@J²@L¶@F²=H´>F«<F¨4?ž-C+Iå{ùÒ¢ö¶ˆøÃŽöªzòµ…ðžfç›uéƒ^Ûvdä}XÚpfè…bàp[ÜhYÊTWÀQYÂ\aÂT\¿P\Æ\fÈflÃ`d¬M`¶]h¼XdÎmr×rlÒniÒjhÎefÎnpËfj¼[b¸XdÄbjÊdiÈhnËjqÍnrÎmkÁ`lÎnrÔutÑzÓw~Ó{~Áh€«Rvºn‰Èo|Ín~¾]s¶Yu°Tq¢Ll›Ff—Df‹?ks&\N|À‰¤Ö” ÙŒ˜Ø–»l’¤hš¦lš f™œiš™e™†J8^–Jh®a{°b·p‰¡Vv“Lq‹Cjl$Nw6]h$WŠFd„FpQIw4VÅ…•Ìˆ‘Û¦ã®›×Ž€Ô‰€×’ŽÙ§ Ü¶«á± ä¼¦ã¾¬â¼«Þ¶¦Ý¸¬à¼¬Üº®Úº®Üº¬Úº­Ø¶ªÚ¹°Ü»°Ü½°ÞÀ´ßÀµàÀ´ßÀ¶áÁ´á´á³á´ãǼãÆ·ãÁµâøãÅ·âøäźçÇ»éοæÇ°Þ©Î‚Ànc©QRŽ2E“:M—?NžBS¤BVµ\kцŠâ¶¬îѸéÔ¹LOO:N
9X?\=_>\;`<]9Y9Y:c?iCbA[B\In%R˜LjÁp~Ó}~Ñ~|Ðx{Ív|Ì|Ó†‚Ô‹‚֏ÔŒ‚Õ‹Ôˆ€ÕŒ~Õ‰~ÔŒÔŠ|Ô†|Ñ…|Óˆч~Ј‚Ñ…|ц~І~Ј~Є{ЄxЃ|φ€Î…|Ï„{Ά}Ð…z̓xЈxρw®@N«DP®BMªBQ¨@N¨JV§@P¬CR®FS°GP¶FL¾HOÈOQÔYVÝf\âq^æ~fè…hìkí•tìšví–qî˜vî—tî—vî˜uï“tîŠféião[Ñ\V³HQž7J*E$?–,Cœ2F¡6H§=K¥>Mª<Jª?M¬>I¯FQ²FM°=M°?L®FS°>J²@J±AM±?I²?K¸?E²@F¬<G§9D /Cœ,Páš~÷ƘúÌšù°võ¾‘ù¯uòžhå‹nátOÑaVáw[Ül`ë”bÖbT¹KX»KVÀSZÁ^bÀT`ÄcfÂ_a§FX²RbÁXeÊhmÓplÔllÐhkÎjlÍlmÊfj¼V`¼[fÈflÌ`fÊflËjoÈfkÃflÅ^hÍltÒz}ÐjnÒtwÓz‚Áaw¬PrÂx‡Íz…Çlz¹\w›Fl›KnœMm‹<\0Sy(Ps&Qo"\Iz©¦Ìƒ–шš¼~§¢n¡¤r  \Š”R|V}@vr;tx=y†Wu9il.dn2`t0`n(Uq+W^NUHXLQAUDJH]"Q¾‡”㸪ܞ‘Ï‚{Õ‹‚Ô˜œÜ´¤ã¿¬ç¿¬ä¹¦ã¼­â¼ªÞ¶ªÛµ©Ý¹ªà½®Þ½­Û·©Ü¸ªÙ¸¬Ù·©Û¹®Ý½®ßº¯ßÀ´àÀ³ÞÀ·àÁ´áÀ³àÀ´âÀ²ãÅ·ãƹâĶäŹâŽãƽäĺåÈ»æư߯–ϐw¼po¬NQ˜;G“6G”7Hœ8Gœ<N¥FZ°TfÈ‚Šà®¥êƲêÓ·¾‚T:L
9T:X<_B_=]<^BX8[8`8c>h@^?TD^Hƒ<a­_rÏy|Ò€Îx~Ëv|Ëvwу‚ÖŠÔŽ„Ô‹‚ÔŠ€×ŽƒÕ‰~ÓŒ‚ÕŠ|ÖŒ€Ó‡~Ò‡~Ò…|Ò†Òˆ€Òˆ}Ò‡Ò…~І~Ñ„zІ}ЇzІzÌ…~Є|ЈxÏ…|·{Î…{Ð…zÒ‚v°BQ¬BNªET®FPªEQ©BN¨DNªAN®BP´FPÀFJÄFNËKNÔTOÝh\äsYè~dé†iì“lí˜qî–qí—qíšwí–xñ—tì˜uï’rìkæ~gâp`Õ^VµLN4FŽ.FŒ&A•.F™1E 7K¨?L¤>K«@M©?N«BN°BP°BL°?J®BO±FP°=H°=J²?L°?J³BJ¸<F³=G®?H±:C¦3Eœ*KÕy]øÕ¬û¹€ø¿‹÷°xô¼—ø³nî›qìˆXÔlVÛeSËSPâ€`ÝhRºNY´JU¹LX¾R[Å\`Æ\`À[_¦BU®Nb½YgÈfqÒqnÎhjÐhhÏfeÒkjÊmn¸ZgÂdnÊ`dÀhqÈdnÎllÌkpÄcm¾ZbÌjsÐptÕutÐnuÊlyÁ^q§Rp´i„Ên}Ìq~¯\|˜Ah Nu¨UqœBe–Bg¤Pq P{ˆ;t„C†Ž^–œb“²lŽ©l•¤x¤h–P~v0gh*bd$Xh'et8tŽd–€N~b Xp6kk+b^LZEYER?SGSGK>JH\"Všn‹Ö®£Ù–ŠÉ}€Ï’•Ø°±ß¼²ä¾­å½¨ã»ªâ¸¦á½­Þ¸§Þ¸¬ß¸©Þ¼©á¼ªÝ¹©ÜºªÚ´¦Ø¶ªÙ»°Üº­Þ»®ßÀ°ß¾²áÀ²àÀ²à´ྰྮ⽭åǺåƸäŹæƽæÆ»åǺãÁ¬Úª’Çvd®XTžDM—>L™@O˜9J™:G›9H¢@P BW±Xd̃‰Ý§è·¤î̳ßìv/BY$IR=X=[Aa?a@\@\?V@a@h@g@aAX@O@bJ–IfÀoxÏ~Íz}ËvwÊsxÐ|{Óˆ„ÔŒ…ÔŽ‚ÓŽ…ӍƒÓŒ‚Ô‹€ÔŠ~ÔŠÓŒÒ‹~ÔŠ‚ÑŠÐ‡‚цω‚ҁ|̃|Ï…Î†€Ï†~Ї~·}͆}Í„{Ì„|Î…{І|φ|Ò†zÒƒvª?P¬EP¬EQ®HQ­FP¬AO©DP©AP²DN³@KºHOÅIOÉJNÒVRÛf\àr^é~`êŠfì“pì“píšrï–rî•tï˜vî”tîšuî“qíŠlæ‚lârcÖ^R¹KQž0F&B‹)A”1Fš4Hž8N¢=N¥@P¦>L«CR¯AM¬>J®<J°BN°AP²BM²=J°BK³@L°@K´CMµAH²DK­>G­=E¥5Cž,IÀZNöΟúÉ–üµzô¾˜ü¾~ô³Œò¢jæ„eÛeVÊPLÑbTÒ^QÍc^¾UW¹T`»R]¸NZ¿U]Ädg«FR®Rc¹Q^Â_kÔjnÏhmÐhmÏfjÌhkÊfh¸U`Â^dÍdjÊflÎjqÂeoÊdkÉjqÆ`hÄdpÓnrÒrrÒlvÒntÆdt£Io±ZvËo|Ìn|´`€˜Rv®ZyÀhz²Qh¦Jx´fŠ¶j’¡^Žƒ8m|1i~Bt„D}‚>pšh—^…€9qv6kr4ke#Xh"`‡R†…X„k,Xi+bj,hm0dr5hWKRCN?K
-:RQONNQŒ`‘µ†ŒÛª“ÏŠ}¿xÐ—Þ¼µäðæıåÀªä»ªà»®Þµ¦Þº¦Ü¶¨Þ¶©ß·§Þ¹¨Ü¹¬ß»«Ý¹¨Ù¶§Ú¸ªÛ¹©Ü¼¯Üº¯Þ¾±ß¾²Þ¾²âÀ°à½´àÁ´ß¸©â¿±çÉ»åÄ·æǸçɼྤЕ{¯\VœEN™;J;I–<NCS˜<Lœ>Kž<M¢DR®Ta¸dqΉŠá©œæµ¢êÀ¥á¼ž“PTR;UBV:]@b@dC`=]B\DZ@^<hAf?\>SDQBr*S¨XnËwzÑ{xÍx{Èw~Ëx~ÒƒÔ‡Ö‘ˆÔ‹ÒŒ€ÔŽ„Ô‹~ÖŠƒÓŒƒÕŒ~ÔŒƒÒ‰ÒˆÓ‰~ÑŠ†Ï‰…χÐ†~Î…Í…€Ï…~΃~Ї~Ά{Ï…}ψ{І}Ï…|΂xÏ‚xÎ…xÑ„y¬CP®DN®ER¯HP°FN±BK¬BL¬=J®AM¶JR½HNÄFKÌLLÕWOÝcTàr`ç|`çŠnì•lì–rì”tí”tí—vî˜qð–pî—sî•sîŠlè€iãp^Ô`X¯GN 4F.D(B–2G›3F¡<J¦>L¥DQ­>J­?M«DK°BJ¯BJ®?I°DM²AL±@M­@K°BP¶?I²BK°<G±?L­<F­;E¨4Bž,F«9Kô˨ûÇøÅ“ü¾€÷·‹ýº{ð¦ví‘aÑ]WÌQR¿INÌqlÓk`ÄdlÄS[Ä[c¸S_»Z`°NX®MZ¾S_Æ[dÔlkÒkpÒhiÐgqÌhkÈdf¸Ze¼WaÆ\`ÉdnÎilÌjqËkqÄelÁXcÆ`kÒlmÒqtÏjoÑhoÉm{ªIl²a|ÂizÆewÀ[r¢Px¨Vy¿a¯V}¨W†œO€œXxƒ=h}7il"Vt*\u-\t+eƒFyXŒ†N†ŠTŽ~<y{2p€B‚ŠV‹y<ir2hyAxm.cb$Uk>fn1h\!MVDM>C9B
-:HD{Dlͤ›Ü ŠÈurÃv|Íš¤Ý¬œâ¼¬æ½¤â¾­áº«â»¬ßºªß¹¨Ý·©Üº©Ý¸¦Ý¶©ß»«à»©Ý¸¨Ý¹­Ú¸ªØ·©Ü¹«Ü¶«Üº¯ß¾¯Ýº°Ü¼±àÀ´à÷ãŵã°æƹéʺèÊ·äéƋr£MNšBO“9L˜9L™9J–7Jœ<L AOœ=M¤BR¥I^®XjÄ|Ù‹æ¦–캜꿠¸s`s):V9V;V9Z>bAb@c@_=^?[>_Dd=j?eCX@PBXEŒ?dºj|Ð}Ï|{ÍxzÉv|΀~Ó‰‚׎„Ø‘„ÖŽ€×Ž€Ó‹†ÔŒÔ…Ô‹ÔŒ‚Ô‹‚ÒŒΊÑŠ€Ñ‡ƒÑ‡~Έ„ψÑˆ‚Ј€Ï‡‚΄~Ѓ{Ї}І|χ~΄{Î…~Ï…|΄|΄{уz°BR­DS°FR°GR®FQ®DP¬?K«>I®@M·FP¼DNÄFLÈMPÔXTÜeYàp`å~gèˆgì“lì–tê˜sì–pî•qî™qð–rí–víoìŒnèƒgãoWÐ_ZµGN 3F)CŒ,B—0H›/Dª:G«<K¨=M«<H®@N°BM¬@M®BN¬=J°DP´BM°AN°>I¯DR´>J²@J²=H®>G®<Hª:B¤:E ,E¤/Gíµ€ùÌ¢üÁöÀ”ü¼ö½’ò¥ræ‚dÚn[ÆKWÈY`݉zÒlnÚ{fÆW`Ê^_ÀY[¬N`§DT·UeÀZdÎgfÏfjÔnmÐjpËlpÃfl¶Yc¿\iÈ^bÈbhÌdhÇhpÇhpÆdjÄ_dÆ^fÎjmÐmrÕjnÐjtÄ[l­Ji®[yÂhyÄhxÈfx´T|N|®fŽ¤_˜T‚Ksv-Zk%RgNf RePhSlTx2m‹NŒ†O†’r£„EyR†Hz–iš~;nZ‹ŠX„]Lg(d\Vo at mwDyNCJ;OJD
BMJŠ_|É¡™Ø–€º\d¾jvÓ¨¤á¼¨à°žà°šß°šÝµ¢Ü¸«à»­Ý¹¬Ü¶¦ß·¥Ý¶£Û²£Ýµ¤Û´¨Û¸¬Ý¸¦Ü¶ªÛ·¥Ø·¨Ø¹«Úº­Úº¯Ü»¯Ü¼±ÞÀ´â¾°â¸äÀ¯äÀ³æǶæƲܴ›³ji˜DT˜>NžBRš=N›>Oš9L—9I >M¥HW¬Vg±^o¿oyÒ†…àç°¤ë¾£èħ°tmZ7V>W<\<\>_BcAa>`=^<]AX8b>f=j AbEXDUJl&S¢SnÅt~Ó}xÐ|zÇu|Êy~Є„ÓŽ„׏ˆÖ‚ÕŽØŽ€ÓŽ‚Ò‡ƒÔ‹‚ÓŒ„ÔŒ‚Ò‹ƒÒŒ‚ÑŠ‚ÒŒ„҈ъ‡Î‡Òˆ‚ІƒÐ†€Ð…|Ï„}Ά}І~Ï„xÊ…~̆~Î…|Í„|χ€Ì…~Î…~³JT°IR°GQ³FN®HQ®BN¯>J­AK¯?L´DN¼FLÂHNÈJJÒWQÚdTás`äzbç†iètì•nî”rì”rì–rìšsï”tî—oî“rìŒlè‚gâp^ÖaX´FM¢6F1F,E–,Fš4E¢9J©=H§;K«=J¬>M°?I®@J®>J®BJ°@L¯DP°AL­;H°@H´BN±BI²;F¯<F¬<H°@H¦=Iœ6F™/MڐvúÉœøº‹û„ö¸‡üÆ~ñ§|ê…X×^XÔ`XÛwgØmjÖ|uÐ^^ÐspÄ^f²GV¬HXµM^¿T`ÍdhÐddÎlpÐhoÐhjÆfu¹P^¼]lÉ`mÆZ^ÊgnÍenÆhnÄgqÅ_hÅZfÒnrÓkmÐjlÓluÊap§Ffª\€»dzÃfyÌjwÄa~¦P|’KzˆHtu1^s.`~3ly0hv.`lQdLh"TjSt,dŒT’ˆJ{•pŸ‚Bs|>uj"T:lˆAv†O†’Xx0ev<{v=xXRlAer at tF>C
-<@@d,fn„Ö®—Ô†v´[fµfuÔ¢žâ¹ å¹œß®˜Ûª›Ù¬ Ø­ Ú¶¬Ý¸¨ÜµªÛ³¥Üµ¤Þ·¦Ù«œ×±¤Û·¨Ü¶§Ù´¨Û¶¨Ø³¨Ù»«Ú¸«Úº°Ü¼¶Û»°Ü»°ß¾±Ü¿¶Þ¿²à½²áÀ¯Ô«–º€x®p€§cxž@V >L¤APœ:L˜<Lš<M ATªMb¹hsÊvwÙ‡Þ‰|㙇訔鴖è¨͝‡g<VA]>[<_>`>eEd?fA^:^<X:]<dFj Cj'F`(PXL\N„;a·duÍz|Ò|xÍ|zÇtxЁ|ҍ„Õ”†×’†Õ’†Ó„֏Ô†ÔŒ~ÔŽ„ÑŒ…ÒŒ‚Ӎ€ÏŒÑŠÑ‹€ÏˆÐ‰€ÎŠ…Љ‚͇ÏŠ€Ñˆ}Έ‚щ|ц{φy͇~ψ€Î†}Ά̓~͆‚Í€x²HX²IVµKX³DP¯GW®<K¯BN°BN²BJ²AR¸BJ¼FPÃIMÒYUÜbUàr^æzcç†nêrë”uê™vê—té–rì”rì˜pë•sî“pìŒnè‚gãr]Ô]T¶HN 8JŒ*DŒ(B“-D™4H¢<N¤<Nª>K«=I©AL©?J¬BJ¯>I­@K±DP°BM®BL®AJ­@L®DL°?N²<I²@H®AL°BH¨<G¤4Dš'G¿_NøЬûĆõ¸ú»ö²…õ®rä†jâ~\Ö\SÌdkÖwuÚvgÔ€{Ðe_Â[g¦DU³PcºO_È_dÒjnÏfgÍbfÍloÆbf¾YbºZfÆ`iÈ]fÆ^hÊckÌjnÅdk¿ZgÃUaÎnsÑuxÍhnÎkmÐbjÅ`t™7`¾i€Èj|Éhx¾TnžDo†7lp(^n&Zz3l…F}~;qq0^e MaHbJcNm Z‹L‚™b–X‹‰R€s2b]D`Sj(X‡Tt5h|6jIƒx=m^"RM
EiDnb)ZB?<<YN©yˆÙ¡Ð~m·^n½v‚ר ã°–䶠߬“Ù¤”צ›Ö©ŸØ±¤ÛµªÛ³§Û³¢Ýµ§Ý´ŸÚ®ŸÚ²¡Û³¢Û²£Ü´©Ü´¨Ûµ§Ú¸«Ú·¬Ú¸¬Ù¹­Úº²Ý¼°Ý¼²à½²âÁ¶à¯ذ˜µ|u˜NhRm«vŠ®k|¬Vg¤BP¨BS¡>T£J^´ao¾ksЂ|܉|ß‹zå”旁柎ꬔçÀ¤Ã“|m#>T
<Z?^?^?`=fCeCiAb?^;[;Y=]8f?j"GbD`(T\%Tk(TŸRnÈt|Ò}{Ð}{Èz|Éx}Ò…€Õ„Ö“†Ø‚ԐƒÔŽ„֍ƒÔ†ÔŽƒÔ‹‚ÔŽ‚ÕŒ€ÒŒ€Ñ|ӌЌ„ÎŒˆÐŒ‡Ð‹„Ή‚Ά€Î‡‚Òˆ~Ï…|Ï…|Ð…~Έ}̆χ{ІzΆ~́{Ì‚zÎ|±LZ´FPµJV°HU¯EP²FP³GS±BQ±BL±BN¸BI¼ELÆLNÒVQØf]àtaå|cç…dêŽpê”sê”mê”uì“së”oî”sì•qî’píŠlèeãs\ÕbX¸LSœ8IŽ,DŽ+F•0Cš2H 6D§:G¦<K§=J¨=L®?L¯?L®@M­<J®AK­@K°BK«@J¯CO®@K±FM¶>F¶BK®BK°BI¬>G¢:E›-E¨8Kñ‘ùƘú½€ó¯ˆø½ƒñ¬|ò¤mß}cÊmjÇ\ZÚ€uÓheÞyeÂhn¯HY®EVÀVbÆ_kÍnrÐfhÑhnÎjkÉen°O`´WhÄ\hÇboÄ^hÌ]eÉ`fÇfnÃ`h¼ZiÍ_hÒjqÐgjÒkmÒjlÏirÆhz>dÀh€Èfv©Mo‹>lv,`fRg!XŠJ‚‰Lzl'SdL_LbL\DfQ]L„;užj›œ]ˆ’Z~v2`]FX
F`N‡[Fyl,eI|€LzXFJEHB|WŒqAƒHHg/Y®~†Üž‡Érl¼foɆŒÝ³®â·¢ãµžÞ¯œØ©›Ö¦ŸØ©œÙ±¥Ù±¦Ú±¡Ú°¢Ù²¢Ù±¢Ú±ŸÙ¯žÚ®šÙ¯ Ø³¢Ü´©Û¸©Ú²£Û¶©Ø¶¬Üº¬Üº®Üº¬à¾°ßÀ³Þ½¬Þº¢¿ŠzŽFX‚B_”Xv˜Vv«uŠ²xŠ»ly´`o¾hoÉmjÒzà‹zâtæ‘wå“vá|æz蛄馒ìÀ¤Æ‘~g6T>X<^<^=_<fCdAc@h@d?\C[<W8`7j@l!Bg!HZH^I€3Z²duÎx{Ï|xÎ{|ÊsuÏzxԍ€×“„Ö‘€Ö“‚֏‚Ó“…ד€Ô’…֐ƒÔŽ…Ӑ„ҏˆÓ€ÒŒ‚ÑŒƒÐŠ‚·‚ÓŠƒÐŒÍ†‚φ€Í†ƒÑˆ|̇€Ìˆ€Î†~͈€Ï‰~Ј€Î‡‚Ά}̃΂{Ê‚|¶LX²GS±FU¯DQ°JU°DT²ER¯@L±BM°AM·CKÀAIÉKNÐTP×b\Þq`ä}hæ„lëŽqì’ré–së–qê”tì˜pì’sî•pî”rìŒrçhâr`Ô`X¶JP8I*C)D‘.F™2H 4H¦<J¨<I¨@P¬?M­<K²AL®CM°BM±@K­BL¯AM®AK¬BN®>I¬<H®=J²@H²BL³DL¬BJ¥;H/Eœ,JސlùÌ¡ö»Žûº}ò®‚ú¼ƒî vçœxà„iÌqp×i[Ú€sÍ\XÄ\^³LUºPbÆTaÔhkÒihÐilÐceÂ`j¸LY´L]Â]iÄ_jÉcgÉcmÊfj½ZhÅ]e¼Yd²UoÈnÈiuÊdrÑelÔhoÕr~Ên|§Fi»`v®Sl{0Zj$WdTw2i‹M|v6_^FXEZDdN`F\D`N\L‘Wˆ–W‡›Pt{2]^HdPbR‰W‘\Šo*`y;tz at q]IJ>RNI?€[f3g|<k½‡Ú–€Élh¶_jÌŠß²¨ä¼«á¶¡Þ®™Ø°£×¨šÔ¦ Õª Ø° Ø¬¡Ø¬›Ø«Ô©›Ø± Ú¬›ÙªŸÚ°£Ú±¢Ú°£Þ´£Ý´¢Ûµ¥Ü¶¦Ú¸®Ü¹¬Ý½³Þ¾´ãÀ®Ü¾¦ÀŽv‚>H|<\‰Hk†=`•Uq”Nk¦j†´xÐ€„ÝŠ€åˆuæŠrèxæŽwæxå|蕂Ⓜ蚋쪔îĤԣŒj!<P;W;[;`>cAf Cj Db?dAe>_:aA]=a>d;j?a9W<VFdL—PmÀpzÑ|zÌzxÉ{€ÉsxÑ€|Õ’Ù’„ՐƒÖ’†Ö”ƒ×”Ö”†Õ’€ÔŽ‚ՍƒÖŽ€ÓŒ„ӍˆÏ‚Ñ‹‚ÑŽ„ÑŠ€ÐŠ…ЉÐˆ‚ψ€Í…Ή~·‚Í…|χχ~ÌŠ|͇~Î…z͈˃z΂|ˁ{µLX°MX±IT°FS°FQ²HU²HT­AM°CP³EK¸BI¾FKÁKMÐTQØ`Xâp\æzdéˆgìŽjì˜tì–pë•së”sê–rì–vî–nï”níŒpébáp\×`V¸LPž8F)DŽ)D•/Fœ7I¢6J¦:N¦?N§=L©?M©=K®@L®BN®BL±DN°BJ®DP®BM®@J¯AL¬AK°=I°CL²BL²CN±CM§<H¢3Gœ.MÊq[÷Ò°úÀ€ö´ŠúÁ‰ô®~ú¼‡ê˜p߇|å™t×rhâŽsÇ^]«AL¶P_Ã`gËdkÑknÎfmÔljÈen°JV«F\ÀWdÉ[cÈ`hÅ_jÆ[kÇ`iÃ_l¼Vd¼Wb»ly´dpœMhB_ªF]ÉasÖpxÊjv¤Dd’Bbv*Uh0^g$Zx8h„Ami"Pb$R[IWAh#Ph"OU
:]FaPz;qšlšx.Z~4_dH\Gh X‰W‘”g“‡D|@{R‰TEO>i4vF	@QJ„XŒƒKoÆ‹†ÚsÂdf¼hqÌ’–Þ­–廤⼨ܮ™ÙªœÖ¦›Ö¤žÔ©¤Ö®¤Ø­¢×«šÕ¨šÒ§žÔªšÔ§šÖ¨š×­œÖ¬¢Ù¯¤Ú±¤Þ¶©Þ¸§Ü´§Þ¶¨Üº­Ý»°ß¼ªá¼¢Ì¤ŠŒIG‚<YaI};X l‡”Sx—Tp˜Rvaz²|Ó‡†à„æŠwåxçtç‘vçvå{阃衏ðÄ Ó£Šv(=R;V<V
8Z8b?b>d<jCdBdAfE`:^;]:^<e?g@^EVB^Os*T¬]qÎ{~ÑzxÌwzÉxzÎ{yÓŠ€×’Ø’„Õ”Ö’€Ô‚Ö”ƒÕ“„֐‚ԐÕ‚ÕŽ‚Ґ†Ó‚Њ€Ð‹‚ЊÐ‰Ó‹Ð‹‚ЊÐˆ‚ÍŠÏˆΆ€ÌˆÎ‰‚̇Í†̆€É„Î…~΄|Í„́z²JW´JR´IR²IR²FQ³FP®EQ®EP³DK³EL³AJ¼BIÁILÐVTÚbWáo_æybç†lênë–pê–tì–ví–xì–rï•qî”pî”pìˆlégâr_ÖbYºNR 8IŽ(@+F’-Fœ7L¢;L¢<M¤?O¨=Jª=Qª>J¯@K¯@L«?K¯BM¬@K¬>K¬=I¬>J®BM¬AL±@G¶CH³DL·EK°FP«@I§9Ež/I´FKîÁ’öÆŸüǍö²ùÄ‹ò¢tã‡p袄ærߌuØmUÄ^\¬ATÂZcÊ\cÎ`fÐinÐkmÎce¿Xb°Rbº_lÄ[dÊ^gÈafÀZh¸ZhÁblÂ\g¾U`ÎhoÕlpÖjlÍhp¸[sJl<c¦Eb¸VkšFeq(Tg%Xl-`{;ky0bm*[f"Xb ReLj%Su/^X<R;\Fp)`†IvˆH{cGiMdOcP€FˆP€y4m]–Š^Šf&ZMGnF|nC{:>b6lª|¢Ë™”Ïzm¼_f¼cnÑ””߸­à²¢äº¥ß¹©Ö® Ö¦œÑ¤ Ø¨œØªžÔª¢Ù¬œÖ©šÖªšÔ¦—Ô§™Ó¨›ÒžÓ¨ž×±¥×´¦Û´¦Ý²¢Û±¤Ü³¡Ý¸ªÝº¬Þ¹£Ù¸ ¶‚jf;fD‘Mfˆ?jy,R­wƒ¢k†˜Tp¡d™Rr±t‡Ì†’Ú‰†âˆ}è’{è”|ê“vê—|ꚁ漣ð¿œÙ©Šv)BR9V?Y;^=^<a?f>c?e?c?c?d?`<[7_>`=g>d@]E^IdKA`¸juÍy}ÌyyÊtxËvzÒ‚|֐„Ø’€×’…Ø•€Ö“„Ô‘€Ö”×•ƒÕ‘Ô‘ÕŽ‚ՐÓƒÔ‘ÓŽÓŽ‚ÎŒ„ÒŒƒÒŠÑ‰ƒÎ†„̈€Î‰€ÏŠω~Έ|ψ€Ìˆ‚Ά̆Ê„€Íˆ‚Í„{Í…|É‚´FP°JR³GS±IT°HU²DQ®DP¯BN´BO²AL°DMµFG¾FIÍOO×]Qân\æzcê‡hê’në•rëšqì’sí–zë“qî”uî–rî•uìŽsç‚nâr`Öe^¾KPž6H&BŠ$@’,F˜0HŸ:M¢8H¤;J¦>Lª?N¬;H¬=I­>Lª>L¯CL®CL­=L­>J¬>H¯@K¬>K°>K´EL¹EK¼FN¶DH±DN­>H¢9LŸ6NÎv[÷زùúÍ—õ´|ê âˆlì~å „äkÀ_]¨8H¶NYÏddÉdlÄ[fÌ`bÊfm½R_­CV»boÅ`kÄ]fÉbfÀVbºYf¼UfÅ[f¾WeÊckÑflÖnqÕlsÇjt¦Hf-N˜Fb‰6_x,X{:ft8kn+^y3i„?|p1el*^f S^Lm'VŠNƒ^CQ
-<R>bR~>vx;bx4b^DbGbJh$R‰N~t*b€Cy‡No1gP
Go>x‹xªQLEHiÆ“ŸÊ{s®ZeºftИšá¸¦ç½§ä¸¥á³¡Ý´¥Ø¯¢Ôª¢Ó¦™Ô© Ö©œÓ¥›Ö«žÔ©›Ñ¥•Ò¡–Ò£šÓ¤˜Ñ¦œÐ¤˜Ö¯¡Ø´©Ø´«Ü¹­Ú¶§ß³¢à¶¥Ü¶Ÿ×©’´fY€.ElEf?FbžWn8a’Ld­}“š[x£m‚ž\{¦gz¾‚’Ð{àˆ{è“yê“xì˜yìž„í¢ˆò²”ê½–»rXo&:U6S5X7]:a:a=f?d@d@hDf Dc Ba?_@\=`8b=e;b?Z@_Jp(QŸPl¼pzÊwxÉx|ÆpvÌyzÖˆ}Ø”Ø”×•ƒÕ‘€×—‚֐‚Ö‘‚ב€Ö“…Õ’„ՐƒÓÔ‚ҐƒÑƒÔŠÑŒÐ‰ƒÑŠÐ‹ÎŠÍ‰†ÒŠƒÏŠ€Ð‰~ІÌŠƒÎˆ~Έ€Ì‡|Ë„‚͈ˁ}Ì„{Ë‚~»NZ¶KT³KU³KZ³IU³HR®IT®BN±AL®AL­EN´AI¼DJÌPQÕ]VÞm[æzbéŠmëpí–që”vì’wí•sì˜uï•xî˜mî”uìˆhè‚jäp_ÚbY¿MNž4FŒ(CŠ&C‘/H›5H 6I¤:L¤>L¥>M«;I¬?K®<L®>H®<K¯<I¬:G°@HµBK®<H°?J°AJ±@J·FN·DK¸ELºIJ²FN²DJª>F¢3H¯BM춄úÔ¯ú„öƓ짆à„mè˜zìŸxä~Íe_®BTÇ^aÐgjÌdkËbhÆ^fÃ[d´N\¶TgÈ\eÊ^fÄ`lÀ\lÂYh½WjÂ[jÂZmÌ\lÓltÍclÈ]fÀUe¬Nd”@bt'Vm"Pv"S{4dq6dm(Z?q|;ko0`e&Xb PTD\IŒR…<iS<S@UAl(Y‹Hzq1_cFX@cHs'Xs)Vv,^aLm-]‚P‚ZNSKŽ«€bŽGEj0lµˆ¡ª^r«\t¿lzÕ£ â´¨æº§ãº©à·¦Ý´¤Ú³¦×²¦Ö«ŸÔ¬ ÖªžÓ¨£Ñ«£Õ¬ŸÒ£›Ô£”Ñœ’У˜Ô¨žÔ©œÐ¦š×¯¢ÙµªØ·©Úµ©Ý´£Ü²¤Ý­žÚ¦œÕ“Œ±YfŽ2OŒ8Vˆ<^}.OJd–SlŠDlš_rªvŽœ\s¤iƒ˜Rq»|‰Ë€ˆÞ‚zæŽzë’|ë—‚î Šòºšç´ŠžTN\6W:V<T
-6Y:`9b;b<h<i Eg!Gh"Ci$Dc@`<^<\8_9e<e>aC\Fi"N‚4Xª^oÀrvÁnuÁpv¿ltÐ~|׏‚Ö“„Ø•†Ù”Õ”‚×”€×”ƒÔ•ƒÔ‘‚ԍ€ÔƒÔ‘‚Õ’„ӏ„ӏÔ€ÔŒÓЋ„Ò‹€ÏŠ€Ò‰€Ð‹ƒÎ‡„΋€ÏŠ~Έ~Έ€Í‰€Î‡ƒÌ…΃xÌ…€ËƒzÌ‚|΄}²HS´JT´JW±NX²MVµIR±GR­ES­@L¯AI²>H±>H¸CIÉPNÕ^SÝm^å{dè…lëpì•vê˜tí”yï–qì˜uíšuì—sï”qí‰lçiâubÖ`X¾JMž4G+D(B”0H—5G 0F¤8J¦<J¥<Mª>M¬AP®AO­@K°@L®>J°=I°>J°?N®<I²>I®@L°AL¶EO·FM¸HOµHL¶HN´CK¯DJ¨;H 2JÄaPöÆ”øÐ¥úÆŽó®€ç¦‰ç˜{쨂è¥{Ãg`¼cfÎ`aËagÈdlÌdoÃZg´Rb²TfÄ\fÌbgÍflÇalÃ`o¿Zq¾\r»UlÀ]xÎjxÍar¶Sp­Ss®Tr°Xr¨KlžHn‘<fˆ9gp&Xk$Y}6j‚Aoe%RYITBSC\Sz3l˜f‘t2\R:S
?YDo+]ŠIxr0^]?`BjLdDgNaNYIt?k~IOIX UŽ~®l6fˆKz–i˜Ro Oh§iŒÕ«ªå¸žä»¦â·¨Þ¶¨Ý¸¬Ú°¢×¯¥Õ¬¡Ó«žÐ§›Ñ¤šÕª¡Õ«žÔ­ Ñ¤˜Î˜ŽÎš“Ó§šÖ«¢Ó¨žÑ«¡Ô±¨×²§Õ°¦Ø²¦ØªÚ¥žå°§ê±¨è¢›Ø‚¬BUŒ-OŽ9P•Pt„<^ŒDb‹GeŠCgªt„¡f€ b}›Lm°l„ˌ݁è•‚í ˆð­”ñº’ᣁ‰8CX<W;Z;Y=[
5_;c;i>f=c=jBfAk Dg=\<Z<Z<^=]:f>dD_Gj$Qt(S’Hd´hr¼ox¹ls¸jtÁptц‚Ø–‚×—…Ù’Ú”Õ’‚Ö’„Ԑ~Ԑ‚֏‚ÓŽ€ÕŽÖƒÖ€Ô‘„Ր†ÖŽ€ÔÓ€ÒÒŒ…ÑŒ†ÑŽ†ÐŒ…Ћ‚ÑŠ‚ÐŒ~ЉЉ€ÎŠ~̈~ˈˆ‚Ά|Ì„}È~Ë‚|´N\´MR³LV´KU±EO±FR®HR°EO²CL®CP¯>H°>H·@EÇLLÔ\SÞjZãzhè…jëŽtìtì—xì–zî˜xî™vï˜vì—rî“rîoéhâs`ÖbXÀMQœ3HŒ)Cˆ(B.F™/Bœ5H¡:J£<M¦8I«BO©>OªBN®?L«?I®>L°BN°AN±?M®>J¯>N±BL¶DO¸DL·GL¸JP¹FL¹HL·FM±DN«?I£8L 5Rß•lúÒ¦øÄ’ò²ƒö·„彩ð®~Ú}o´=FÙybË^[ÆVZÈaiÆbp¾[g·ViÀXeÃ_hÈdq¿]w¿n‡»gŒ¼_ˆ·a‘¶V†°\†¼^Æb~Èa}Æ^oÃUg¡B[•=X›<b4^~.^t.d‚:nŠIt|@mb QUFQCSC_O‚<q˜h’dGQ<YCaMn*\v.Zq.[bHcFr$QbEbHaOUGzFz{;zTLuI†Œl£›`Žº”œlœ„6[®b~»‘¦â± äµ¢á¶¥Þµ¥Þ·§Û´ªÙ¬ Ö¬¡ÔªœÒ¤šÑ¨žÔ¨˜Ô¨›Öª Ô¥˜Ïž’Π™Ð¡œÑ«£Ô¯¦Ô¬¡Ñ«¢Õ±©Ô®¤Õª Û§žâ¦¢ç®ªé°ªé³¨æ«Ÿà‘ŠÉ]e¥>Pˆ2]‚4Tžb€–Rt“Lr–Sw `v¬z¥f~¤d‚¯k€Ç€ŒÜ‰‹î¤ò¶–ð¶‹Èv]€*>Z:X?X:X;^<a:e>i@h?f<d:gBe>h>f@^=]=`?^8b>e>dD`Hi$O4XŸWjºpu¼ns¯fr¯dpÄv|ÒŽ‚ו„Ø–†×—„Ö•‚Ó’„Ԑ‚ÔŽ„Õ‘~Ô‘€ÔŽƒÖƒØ‚×’Õ‘‚ÕŽÓ‘‚ÓŽ„ÐŒÐƒÐ‚ÏŠ‚ЈƒÐ‹Ï„ÑŽƒÐŒ~Јщ€Ì‰„ÍŠ‚Ë…Ì‰€Î†~Ë…}ˇ€Î„~µKV´JT´LV²KW°FR²HT°EQ­CN®?N¯DM¬>G®<Jµ?FÃILÑ\UÜk\ät`èˆoì’pì•wë–tî–zí–yî•rîštðœtð”sïlè€hâtb×`T¿JR 6H*F‰(B’,D˜0D›4FŸ7J¤=L¨:L¨CR¨@N§?O¬>K¬<L¬?M°@L®<J®BK³CO®BO¬CO±EO¶EO·FL¼INÀHP¾LRºJP³JP²FJ¨8EŸ4N¼ONóÈž÷¾•ô·ˆó´‚ó°‚ñ¶ŠÍf`ÇghÙoaÆU[ÂPWÁ\d¾WaµNb½`lÇ`qÊ`jÈev¹]v¼^qºXl²Rl´^|²e†³^†¥U‚ŸQ{¦_ˆªR~ Bl~1]r%V‰6f{,[ˆ:j†:hŽDu‰H|p,\aN\KZFTFbOˆN€ŽU\CVCeH~Ev^A`HcHgRm!V€9m„>z€>z€>}p%c†XŽw8sk)lƒR‰†P¡_ƒ©l•˜]Ÿ`†Ê¦ËžªÞ°œâ°œÜ®¢Ý¯ Û´§Õ°¤Ø¬žÔ©žÓ§›Ò¦žÓ§žÑ¥žÔ§˜Ò¢•Ò •Ò¢–Ò¢šÔŸ•Ò¬¥Õ¬¤Õ¬¢Ñª¥Õ¬§Úª¥æ®¤éª ê¯¨ë´ªë¹®ê¹¬æ®¢â “×qr¼HUœ:N7^ˆ<T¢l„“Kf†?`€:Z¬pƒ©rˆ«pŠ®jƒÆ|Þ•’꧉ߑq§JIi9];Z>Y>Z>]<[8f>j>f>j!Fh@eAf@f>k?b<\;Z:b=`:f<f?^Ec"Lo)U?^­dp¸qr´iq®dn´kxÊ€}Ô“ŒÖ–ˆØ˜„Ö˜‡Ô”„Ԑ֐€Ô’Ô’‚Ô’„ԐƒÖ‘ƒÖ’‚ÔŽÕŽƒÓŽÔÒŽ€ÐŽƒÐ‚ÑŒ„Ѝ‚ÒŒ‚ҍƒÑ‹‚Ћ€ÏˆÏŠ‚Έ€Ê‹~ˈ€Ìˆ‚Ë…}̈Ì„zÌ„ź|¶LR´LX´NW´KS¯FT´CP¶FL±GP°DP¬@Kª>M«;E°:H¿JMÐ]YÝl[âzgç‡nêŒoë–xê˜tî”ví—vëšxï—vð˜wð–pðŽmè€hâvb×f[»LN 5FŒ&AŒ$?’+F—2Ež4F¡8H£9I¦;Lª>L©=J«?N¬@L¬<J®>J¯?I­BL­@M°>K°?L®@K¶EP¸EPºHQÀJRºLPºPT¼JP¶KO¸EK­BJ¤8K¤6Qè©„öز÷Á˜ôµ„ô´€ò»ŽÖxhÛu^Ì\[ÅY`¾S_½V]°IY°L_½YeÆajÄcqÂ^n¶Oe´Rb°I`Â]rÍbrÏ`pË\sÊbvÂj~§Xq’Fop%Yp%V|/dr&X„0aƒ0`‚9gŒFt|;km.Zd"PdLXJVGj$X|7j€Ani"Tf Rn(Sp2^[?^>aB^@` EaCi"Lf$N^FbJ|Auj)Zn,dyAt}A€†L‡¤z¨š^ŒÄš£ÆœÒ¢ Ûª–ܦ”ؤ˜Ö¬ŸØ°¢Ô¬ Ô¤šÑ”ÒžŽÒŸ˜Ñ¥Òž’Ñž“Ó¡“Ò¤šÓ¢šÒ¢™Ñ¡šÑ¤Ï¥ Ò¦¢Úª¤ä²¬è±ªê°¦ê±¨ì´©ë´­ï¶¯ï¼¯í¶¨ë°¡ãŒ„Ô^b²;J’7Ox-Xn,Hœa€„:[~8b€Aa®vŒªq‰¯p‰¾}ŽÖŠ‰Ðqn¶XX€)F[
:Z
=X;ZAY>]>a>f9g=h>j@h>j@i Bj@h A^9Z9[;`=b=g>bA^Cf Ly/VšOg¶jq¸ow°fs®hsºmtΈ€Ö–†Ö™…Ô”„Õ—„Ô•†Ô”ƒÕƒÔ”†Ó‘€Ô€Ô“Ö’֐‚ԏ~ÓŽ€Ó‚Ó’ƒÒƒÒƒÒŽ„ҍ„ѐ€ÓŽ€ÐƒÏŒ„Ί~Ћ‚Ћ|щ‚ω͈}΋€Í„~Ά{Ì„zʁ}É…‚µHT¶MVµLV³GS³FR´HP±DP°CL¯BP¬@K¨>J§<H®;E»JMÎ[XÚjZà{hå‚fèrê’uë—vìšqê—xì–yïšwî˜zð•sîqé‚kârbØcWÂOQ¢6FŒ&A‡%A‘+C•1D–2F :L¡6H¨?L­=L¯?K­>L«>N¬?L¬>L®:H¬>J­@N¯@K°@M²BL²BPºDM»HP½GN¾JR¾PV¼MVºJQ·HO²BI¥;N¤5Pá—zúÑ™úÒ¤öÀŒöº†ö´‹æ›rÐibÂXbÆ^dÂ^jµJ^¬DX¶Rh¿`pÈ^kÁ]l¹Wj·Sj¸QeÆfnÑfnÑboÄ[q®FgªH`Ìgs¾\sžDjw*So,Zo*]dPi!Un!Vz1d…Ap~7gq*\g!VZFXO`Pp-bl$Zx4k‚?v>rh#NZB]@^<]=^>_C_C\>Z=T=R@l-ar*ZˆFtz;nm/nzK„”]‹™l–±~¾Š‘Ô¡˜Ú¥œÖž•Õ¥žÕ¨žÕ«žÒ¢—Ξ”Λ”Í–’Ò¦žÑ —Ï ™Ò¢›Ô£›Ó¡•Ò ™Ï¢šÏ¤—Ìš“Ϥ¡á°¨ê¶©í·¬ë°¨ê²©ì°ªíµ«ìµ¬ì´ªî¶­ï¶©î´žèœŽÝnj¿FO£6K-LkOr0JNo‹@ct'R f}¬nˆ´xŽ¼}É€„Âhm´QSŠ(BY<X9X>V;Z=^<gAh@h>jAl DjCg@jBe?a=^:Z8Z6`<l<f>_@`Hp'S‰=_«dr»qt·lp­an±doÁtw͈‚Ö”„וƒÔ”ƒÕ˜„Õ”‚Ö“Õ’ƒÑ˜ƒÑ‚Ô’€Ò‘‚Ô’‚Ô“…Ó’€Õ€ÔŽ„Ԑ€Ô‚Ґ„ÒŽƒÓƒÓŽƒÔ€ÒŽ€Ð‹ƒÑŠ~Ј}ЉÐŠ‚ψÐˆ|·~͆|ω{Ì‚{ʃ΄z¶IV²JR´HU´HO±HW´FP®FR°BN°BK®BMª=I¦7F¨;J¸IMÎXSÚj[ávcæ€héŽoì’uë–wí’tî”wê—xîšví˜xî˜tðnèmãtcÙbXÂNM4GŒ(BŠ&@”0G“,Dœ1F£<N¢:N¨:K­BO°AL­AM¬BP®BO­BPª@P¯?M°AMª>K¯@O¶CK²DN·HP´DN¼MTÁQS¼NT¼KQ¸LO¼KJ´DL£:N¦2Nß–€ùÓ®üΖøÈšø¼Žôµzä†`ÆX\ÄZ]ÄZcÆ\d¸Td´RkÄ\g¿\e½Ta¶Tj·RgÉ`pÐlpØhjÒafË\hÆ\m«He¡Og²Sc£?Z•5X.Wt,dh#PcL[K^Ln+Z{4gx.dq(^y4hp)\d!U^Jw4m^Ot8pT†ŒM~k$UW:[=^BZ>]>^B^HZ@T<SATBx6hœQx Liˆ:gx9}Žo¦£~œ¸“£Ì™“×›ŒØ£›Ö¤œÖ¦ Ö¯¤×­¡Ò¦œÐ–Ò™Í—”ÏŸ–Ñ¡šÒ£œÓ¦œÔ¦šÑ–Ïš‘Ò£šÍ¡›Ë—˜Ô Ÿç­¨ì°¥ìµ«îº¯ë´¨ì¶­ìµ©ì¹®îµ®ì¶¬î¸¨ðº¦ï±¢ìžàvrÈMU°<JŒ.Kl!HTCu4RŽGe|.]ˆA`©pŒ³p‡¾‚’Ë…ŠÊps²NVv>`>T;X
:X:]=b<hAlCi@h<lEl An&Gl$Hf@`<^=Y;[7\7e;b<ZDcLv*S˜Nhµgtºpt²jq²bk¸ktÈ~}Љ‚Ó’Õ”„Ö–‚Ö”„Ö“‚Õ•‚Ô–…Ô‘‚ӐƒÔ‘ÓÔ‘€Õ„Ô’Õ“}Ӑ„ÒŽ‚ҏ‚Ó‘ƒÒ‰€ÒŒ†ÑŒ‡ÔŽ…э…Ñ‹ƒÐŽ}ЈЊ~Ñ‹~ÑŠ~Ћ~ωΈ}Ά|Ά|̆~Ì‚~²L\²HR°HW´HT°FS°JS±HP®>I±@I®?K©:E¥7F¦<N¸LQÌZVÛh]âvbã‚qèŒjì•xë˜vì–vì™xîšzï˜xî˜yï˜xíoèläudØf^ÀPP¡4H(FŠ%E’-H–4I7M¢>N¢8K§BQ«>N¬@P¬?N®DR­EP®AN¬AN®?M²?L¬<L¯<K¯@NµAN¸FRºHO¿LTÃMU¿MT½PV¼MP¼FK²DM¬=M©3Nà’zûÔ¢ýÌ›ûПúÈŽñ¨sÊRNºFPÀX_Ä^i¸Vf»VfÃ\fÆ\d¶We¬E^¸NbÉanÔjqÔejÒdjÒcgÄap¸QdŸ;X’1L•7P|Ht"M‡Btq-[^EXBUBWFaKz7lu,\q/a{:f>qa QXHu3d^Kd$YŠRŠ™g”|:kV<\@]>^BZ@V9XBS<M7P@l'U”Np®_tŽ/R˜Bg˜_š¬ˆ¬·{Õ¦Û¨˜Ú£–ب›Øª¢Ù°§Ù±¤ÖªŸÒ£˜Î˜ŽÍ‹Í˜”Κ’Òœ—Ó¦ Ó§žÑ ”ʏŠÊ’‰Í›–ј–á¤šê®¤ì¶§ìµ§ìº¯í¾¯ì¶«ë¶ªë´¨ì·¯ì·°ð»°î¶¨î¶«ï± ëž‘å‡|ÒX\´9G’,Ir C^AZ>ŠHb€4Z~5\§l„¯nˆ»u…΃Êtw¬HRl@\>X<\<Z>^=d;d;j Af@k!Ej>iAl#DiBd>_<`A[9\:b<g>_>ZAbJ‚=`©aq¼rv¼pv³kp¯fn¸tvȇ€ÑŒ€Ó€Ó‘‚Ö”€Ö“€Ö’Õ}Ô“‚Ó‘Õ“|Ӎ€Ò|֐~ԐÔ‘ԏ~Ö“ƒÔ’€Ô~ӏ€Ô€ÓŽ‚А†Ð‚Ñ‹Ò†ÒŠƒÒŠ€ÑŽ‚Ò‹‚Òˆ}ЊÑˆ}χ€Í‡Ì‚zÍzË€}¯KV²LV±ES±KX°JV´JS¯GQ­FS¬BL«BN¨;F£;G¨8H¶EMË[[Øhbãu`ç‚mèŒtê’vê“wê˜vì—wíšvï—vî˜xð–qîŒnè€låtfÙ`V¾MQ¤2F*D*E'B™4Hž7N£=P¦<MªAQ®BN®>N®AN°CQ®@N¯@O°CR¯@K±?M´AL³@M³BL¶FP·FQ¸HP¿MRÄRVÀSV¾PY½NS½LO¶JR¯<Mª4NߌrûÒ¨üТýÊŠ÷Ì›á}Z¶EN¹CMÂVZ¾V_ºT`¾YeÆ\d»\m²K^´NdÆ\kÒflÐdmÎelÐdhÁTfÂWdº^oƒ*Jd:mD\Bn.Yy4]dDWAZCWCYHYJx7f~>jl$Yv2b‚Bs^ NVJu4icRUKv=w’b“šil'Z^G[@Y?Y=V;P:N	6L?h!M¨c|¥ZtšKo›?b¼€šµˆ¤ª‚¤¾Š£Ø¬¡Ù§–Û§›Ø¬šÚ²§Ú³¨×°£Ô¨šÐ—’Ê’ŠÍŽ‡Ì”Ì™”ÏŸšÓ«£Ò¤žË——LjˆÏ’“Þ›ç£™è©œê®¡ì´¬ì¶¨î¸¨ï¼¯ï¹¬ì¹­íµ«í·¬ð¸«ð¼®ï½¯ò»­ï¸¨í¨œçŠ‚ÒZZ¸;Jž2JtA]>YBn!F†9\y.W›\r¶x‘»‚•Ê‚‰Çy‚.IeA^E]B^>]>_;e;j?l?k!DlEj Gp,Mm#Hl&Hc@^<]9_:`;f:c;Y<[Hk!L“Id¶jrÃvu·qs°fp¹kpÅ|}͆Ì…€Ð†|ҐÕ”€Ö”„Ö“‚Õ“€Ö•„Ö”‚Ó’Ò‘€ÐŽÒŽ€ÓŽ€Ô‚ҏƒÔ‚Ԑ֐€Ô’ÒŽÒ‚ÐŒ„Ô‹‚ÒŽ‚ÒŠ„ЉЊ‚ÑŠ‚щ€ÐŠ‚ÑŒ€Ñˆ~·€Ò†zЇw΄~Ê€®HX±JV°KU¯LZ®JV®EP­FT®CP®AN­AK§?H¤;Hª:H¸JOËZZÙi^áwfæiè‹vê“|ì”tì—wì˜yí˜{î–yí”wî•yíŒpè„nâtcÙe[¾OP¡;I-H&@”*B—1E›5F¤@V¥<N«>N¬@N®CP°AQ°BR²DP°CR­@R°@L­>L°BN°BP±EQµHUºFN¹JR½JSÁLS¿NTÀNWÂNP¾JR»KN´@M¬8TÒr]úÖ³þÑ™ûÍ”ø¹‚ÉXN´DN¹FMºKS¼RX»P[»S^¾Te·J[ºRaÌ]cÌ\iÉZgÂOYËelÊVc¼Rf¾\n¶\n<^V@Z@hJ}=llI]@ZB[>X>\HXFd$R~9jx.ho%Xz9fr.bWIq:gh VQ
B\RyCv¢wª‹Iƒ…Bx‚ExdQN
-8N:I
-8H
?^F¬lzÐ}z FfœJkÄ‚–ٝÀ…“škšºŽ¦Û°£Ö£–Ùª›Ù´§Ü¶«Þ¸¤Ø¨žÒ›’Ï”Ê‘ŽÎ‰Ì“’НšÒ¨ ÔªžÒž”я†ÛŽˆæ•è˜ê¦ê¨é°¢ì¶§ì²¢ì¶¨ð½®í»®îºªïº«ð¼°ñ¾±ò¿³ñ¿³ñÀ±ñ½®î°œê”ŠÙmj»ALŸ7JzBT=ZC^<…:Xx)TGf¼„˜Â‘ϐ”Áuy&Fa@[>X@]:^>`?d:j<k>i@jAn%Fl"Dm#DkB^8^;]:]8b7d?_=\DbJ|2T£\m¼uvÀut·nq¶jpÁzyÉ‚|ʆzɁzÈ‚x͆ÎŠҐ~Õ‘ƒÔ•Õ•„Ô”„Ô”ƒÓ’„Ґ€Ò’}ӏÒŽÕŽ€ÔŒ‚Ô’Ö’‚Õ’„ԏ„ԍÑƒÒ‹~Ò‹ÏŠÐ‰‚Ò‹~э~΋€Ð‰~Ï‹~Έ€Íˆ€Ðˆz΄xЄ{Ì~z®DQ®HV²IU°FR®HR¬DO®DR°BN¯EN«ERª@K¨7F¨=HºIPÍ[X×i]àxhã‚pèxì’tì™wë–ví”sí›xî—xî˜wï”wívè‚jâ{nÚc\¼PY <M*EŽ">—/E˜1F5G¢<O¦:Kª>O®?N«BN²BN²AK²@N´EO°BP®@O°BO°AO²BPµEN¶EP·EMºKQ¹IRÀLTÂSXÇTXÃMP¾LR¿JQ¸DL±>RÀOTöÈœþÑžüÔœè›s¼FM¸KRºKQ²KWµLV»U\¶R[ºVd¹XgÉ`iÌ\aÍaiÊbg©BX¶Rg¸Od¶Pc®G_£C\‚7V[A^D7b„@i]>X<X<aE`?_EZFYHf"L|9np)Zo*Zn,\d"Vs<ml'[^O^Xk._ž~¨o)VbDd FZ?O:G6G:X@§n|Ôx¾Td²Tkƈ–ܦšÚŽ‡ÎŒœm›ª‚¦Ð«¬Õ£¡ØœÝ¶«Ú¯ŸÜ¬ŸÒ¢›Ð˜–Ì’“É‘‘ɐÊ—”ЧžÖ®¡Ò™ŠÕ„€àˆ„å’‹è–æŸ•ê¨›ì­¤ì±¥ì¶¨ì´©í¹ªï¾²í½±îºªð¼°ð¿±òÀ²ôǹòǺôÅ´ôĶð¶£î á{xÆKP¬8IŠ&A^
:T?[Bu%H0^‚2Y»”‡–Жœ¼q}x D_<`>Y:b@_=b<e@f@i@h?j CiDp'Fo&Je=\:\8]7]8d9e>\=ZEj!PB\²iuÂxv¾qp·jq»ptÇ‚€Î‡~Ë…~Ê‚yʁyÌ„{ǃ}͆€Ï‰~ÑŠ€Ò‚Ô’ÐŽ€Ò€Ó€Õ|ÖŽ~Ӎ€ÒŽ€ÓŽ~Ԑ~Ԑ€Õ“€Ó€ÔŒ„э‚ÑŒ€ÑŒƒÎŒ†ÑˆÐ‰Њ„ÑŠ~Ћ~ÒŒ{ψ~ψzЇ}Єy΃|Ìy®EP®HT°FT°IU®HT²GS°FQ®EQ«@K©DP©@N¨:I¤<NµJRÊ[\Ùj]áwbäƒmé‹sêtì–vì–wí–{ì˜zî›vì—yï™qî‘pæ„hãveÚf`ÃRV¢:OŽ,H‹(B’.H˜.DŸ4G¢?M¤=L¨>N­BO¬DQ®CO®CP³DR²DR²AM°EN°DP¯CR²BU¶DNµCOµ?M¹GRÄmuÂRUÁPUÄRUÀNTÆPRÄLQºIM²>O¶>Q쬁þÖ«üӜށj»PZ½LPÂSX¿S[¹OZ¼PX²FU´L`ÐhjÌbdÆXdÆT^¸T_’7Wƒ0QŒ9\‰0T}$L‚/Q‚3VkJ_G†Do{1^X<V=X>k!P_Aj"N\A\E\Bl)Ts/`h"Qg#Wm(^{<nj$Yf,^]Vc$V˜u›s.`V>S
8M8K	5E5O>šZiÖŽxÀSa»SgΉ“߬žÛ”ˆÚ†ÕŽŒ©v™¥„©¸›«Ä–£Ôœ›Û´©Ô¤™Õ¨¢Ò›—Ñ›šÐœ•Ì–“Í••Ïœ˜Õ¦˜ÒŠÖ{zãˆäŽ„æ˜Šèè¦›ê¨œì²¦ì²¥î»°ì¶§ì¼¯ï¼¬î¼¯í¼¬ð»­ð¾±óöõôóÆ·ôdzõÇ´ò¾«ï¬šæ…{ÏV[´<H˜*Ai9P;X<hAz.Rt&T©fzÆŠ—Øœ™¿z†v"HbCh@_?h>n?j"EeAfCh?hDl Do)Jl%Dl @b>^9]>_<c>g=c@W>\Fr(PVh¼u{Æzt¼np´dpÂ{v̈ÐŽΆʆ€Èƒ|Í„~Æ‚~Ɂ~È‚€Ì„€Î…~χ΋‚ÑŽ}ÐŒ€ÐŒ|Ԑ~ҏÓŒ€ÓŽ€Ó~Ó’‚Ґ…Ó’†ÒŒ‚ЍÐ‚ÔŒ‚яƒÑˆЋ€Ñ‰€Ðˆ~щ|Òˆ|Ї{Ñ…{І|Ï‚|΂|Í|µBQ°IT°IT±CN°HT°GS°DN®DL­DN«ANª>L§<I¦=JµHNÌXVÛjaávdä†qæ‹sê•tì–uì—wì˜tì™~í›vì˜zï—vð’nè‚nãvf×d\ÀPW¤<N-F*D’+B˜0F¢0E¡9I¢<Lª?Q«CQ¯FT²DR±ET±IX²DS±GR´AN±@R®CP°@N°@Lµ?P¶HXÈvpÞ„hÄJO¿MTÃSXÆOPÆONÀLP¾JM·FS²DZÔu^üܶûÓ Ùn[ÃOR½NVÃXYÄW\¸Q^°@R´L`ÊgiÎahÈ]gÎgp·Ul™Fh—Bb€2Y€5SŠ2Rh<u!Ez!F[D`FŽT„l$MVAU@^Jr*VaIgKYB_DfL\FbKi&UaQdSCw„C|‚J~aR]PVv„L}R;N
9L
-6I<M>NgÒ‰yÂaj³QeЃ’Ý¢–ÜšŽØ”‹Ø‘‰Ó”•­{˜³¤Ì¦¡¿— Ò©¨×¶¬×³¨Ö¦ŸÐ—”И˜Òœ–Îœ˜Ò“Л”Ó…|Ùyzá‰†ä‡æ’‡å˜‘èŸ•ê¬žê¦šî²£í²¡î·©î¶§î»¬ðº®í¼®î»®ð¿°ñÄ´óĸóõóǺõÅ´öɸôÀ¬ñ°žê“ŠÙbd¾AJž,Dr?V@T:]
:jE}+\ŠC`À„–Ò•˜ÃƒŠ†7Y`HdDZ>`Af>h=fBi BkEl"Jl"Fp(In'HiAaAZ<\8b<d?iAbAU@XCy2V¨cqÄxvÄspºlp¼otÈ‚~ÔŽ€ÒŽΉ~Ì„}Ê„{É„~ʁ|ʁ}È€~ɁzÈ‚~È€|Ê‚}Ë…|Ì„~ÎŒ|Ò‹}ÐŒ€ÓŒÒŒ‚ÐŽ‚ҍ}ÑŽÐŽƒÑ‚Џ…ЋƒÐŒ‚Љ€ÑƒÐˆ~χ€Ò‰|Ò†zΈ{φÑ†}Ò†‚Ά~̓Î€|²HP´MR±IS¯LS®FS¯EP®EP«FQªBO§EQª>J¥:I©;H¶JPÌYVÙj`âtfäƒkèŽsê•vê–zì–xí™zí˜yí˜uì™uí–wí’pæ„kàtbØd]·QX¤?S,IŠ*F–.F™2F£6H¨<N¨AQ­DV®BR²CS°GS°IW´JTµDQ°FS²DN°@N°BN°@Q°BR¶@OÆZYÕo\ÂPTÄNRÄSXÀOTÄQWÆNQÂSXÃRX¼LQ·JW¾T`ñº‡ù×®Ù~nÄMPÄQSÃQVÅQS¾T`¸MZÆ]dÈX^Ë_cË^kÖetÑco¾R_³J`£Fb‘8ZkG^BbCX?V?eI‹P~dCU<ZCt0\j MbKdKYB`IhMYC^Fk&VaLbRt3f’R†—b’v2nbVl5\‘g”VCF4D
-9J?ˆE^ЊvÎgk½XgÎ}ˆÝ¨›Ý™ŠÝ¨žØœ•Ö’‘Ô™°š¹Œ¢ÕÑ —Ö¬¥Û¶«Ù¶«Ó¢šÐ˜’К–Ðœ’ΗŽÐ‘Õ}zÞzwâ~yæ‹„æˆæ’‹æœ•é¦šê°¢ê®£ì¯¢í´­îº¬îº©î¸¬ï¾°ï½°î¼®ð¾¯òŵòŹôÆ·õŸõɸöÇ·ôÀ±ô¶¦íœŽÞmmÆDLŸ.D:Z;M6V:aA€4`z-SÃŒ Ð“”Ä‚„‘@[bH`B^&M^@f@g@hBjCj#Eg Dm#Hq*Jn$Eh>c>Z9]:`:f;j=[=WAaFŒCa¸lqÅyvÀtx»hjÄzxω€Ò•€ÏÎŒÍ‰z̈~̆É…}ɆȃÈ…€È€zȁzɁ|ʆ€È‚|É„Ë„}Ë„yË„|ψÐŒ€ÑŒ{ÒŽÒ€Ð„Ѝ‚я†Ð€ÏŠƒÒ‰ÍŠ„ψ|Љ{ψ~ІzÏ…|Ï…~Ï…z΂yЁÎ|t¶FR³HT±IS¯FR®EQ°>N°BL®BNªBL¨AP¦:H¤9K©BN¹HMÌXQØh[àtbäjèŒvë”vê”uìšvíšyìšvî—vìšwî›wîræ‚nâu`Öh^»TZ¢>TŒ1PŽ-L˜3O˜4NŸ7O¦?R¨AT²ET±CR°CQ³CP²FP²AQ²DP±BN²BN²@N±@L²DPµDN¸HQÃPSÁPWÂNV¿RYÄPWÈTVÅRVÅUZÂQVÄRTÃRV¼KT¶GZÜ|bùÜ®æ›ÇTSÃST¾OS¹FQÄV\Ñ\\Ê\aÅ_hÆV_ÍhrÊ^pÄU^®DX¨B]€!IkD`Ij$PeGP<VAZA…JtcHZDaJcH\Bj&S^C]FeHaLZFh#TdNVDj%U‚>x‚?zw3c„F€~:€‚C~¢Ž°r2^D6E;{5UÇ€xÌi`»WjÅsÞ«á–‡à¢”Þ¨—Ù¦¡Ù¡šÖ¥¢±† ²ˆ Ï“ŒÔš’Û°¦Þ¾µÚ¸ªÒš–ј“ÑšÌŒÎ‹Ø|zß{zâƒä†‚æ†å“‰æ’ˆèœ“ê¥™ë¬ í°¦î²¨ì²§íµ¨ï¹¨ï»­ð¾®ðÀ¯ð¾¬ñ½­ñòòŸôƵôƺöȶõȹõÅ´ôºªî£–âyqÅHP§4Fˆ!@`:J8S
;YAz0Wu&T‰šÐ“•Â€ˆ™AXl H`F^DbDl FeAhBl$Hl En#Fq$Iq(Hl%DfA]<^=]=b:d<b>V>YDt*TŸ\pÀvwÆxu½pr¿knÈ}}ҏÖ”€Ô”‚ӏ€ÐŒÎŠ}͈zÌ„|ǃ|ȃ|Æ‚|È‚}Å~}Â|Æ€|Æ‚{ƃyƁzÃ~{Ã|yÆ‚}È‚}Ê„|ω€ÎŒƒÐ„ÎŒ„ÎŒÎ‰‚Έ‚ψ|Ί~Έ}φ|φ}Í„|χ~΄|Ë‚{Ð~wÒ€yÑ}t´HR²JS±HS²HR®DP­>N¯AO¯EP©?J¦=K¦<J¦:J¨<HµHNÆXYÖdYàtcâiéwê‘zê–xì˜zìœyëœvì™yë˜uî—zî‘tæƒqâug×f^»RY¢<Q0M/N–4Pš<PŸ>P¤?P¦<OªAS­AN«FR¯DS°CR±DOµDN°DR±CO´DO²EQ³CQ´FT¹EPÂMRÂ\eÂMQ½NVÂQVÈXXÆTWÊSVÆTWÉRRÆR[ÄPQÂKTÉV\ñ½ˆì¬ÎXTÆXWÂNN¿GRÎdbÍ\aÈ\cÐdhÌctÉZdÅ\hª<R¡>R…(IdMaNq/`€<lU<P:RAWFw6ez8lr)Tj"TZDf$Pg"R\C`IfLaG`Hr0]dNU
C^F‡K‰o._u-`n*^VH^F™|›m+`B:n&LÀvsÎqn»UbÀevס”ß—„ß—Œß£ŽÞ±¦Ü®£Ø¥¢Õ§¤°ƒ ®|’Í“˜Óž–ܵ­Ý¼²Ó¦›Ð”ÏŽÎ“ŽÑ‘ŒÛ{zá€}á~ãŠ†æˆæ”‰ç•è”ŽéœŽë¦ëªœì³¦î´¤ìµ©í¶ªî¹­îºªð¿°ï¾°ïÀ°òÁ±ò´òĶôÅ·ôȶõȹöɺöȶôÁ«ï¬žä€{ÏTX´<J–$?j:P;Q<UAfE|,Z°j~Ж˜Æ…Ž¢Ldp#JZA[@dBlCh DeEf!Fj$FiCq#Fq(Fj!DfC_>^<c=d@e>aAX@`EŒC_´l{È{zÂut¹nr¿qsË„{Ñ”„Õ”ƒÒ’~Ò“ƒÑ’Ï’‚ϐÍŠ}ɉÇ‰~Ȇ|ʈ{Ç…€È„~È„|Å„}Ã}€zÃ~}À~€}ÀzÂ|zÈ~{Æ„€Ê„~Ɇʇ„ÍŠ‚ΊƒÎ„~Ά}ʃ|ˆ{Í…{͆zÌ…z̈Ðƒzуzс{Ð}z¯EQ±IT±FQ¯FR«ES®CR°AL®CQª=J§<L¦;H¨6F¦3H´FKÆZ[Üf[àvfå‚lèŽvë”|êšwê™vìšxêœ|íšwí™zî–oìŽoæ„nàtgÕic½OT¤<PŽ+L.J”.L›<R :O¤>Q§>P«@R¬BP°ES²BO±ES³CO¶FO´FT±FT±FR²FQ´BP´EP·GQºIRÌ^\ÃMTÃUZÄPVËUXÉUXËUYÇWZÅYZÇTZÅPUÆQWÈT\à}`í¡vÐZRÅTX¼ERÐ_cÔb`ÔfkË`nÍbrÍhyÀex¶M_™6Qm@bI`Ra!P‚Jzw6gV?T?ZDWDbH…Hrk NVD]Fz<ifL_DbEbIZEk*Zl&Sk$VZF`Jl.\YEz6j`JL	=N
- at wQpŠRŽbF³nrÒvl¾U_ÃenÓ—›ÛŒ|ݐ‡ÞŒÜ¢’ß²¤Ú­¤Ø°§Ï¨£®†œ¤l€ÍŸž×­¦Ü·­Öª Îš–ÍŒ†ÊŠŠ×†ß|zâ€ä†…á†…äŽç“‘æ–é˜ŒèšŽèšŽê¢”ê¦ší²¢ì±¤î±¦ï¶©îºªí¸©ðÁ®ð¾°ð¿¯ò¾­ñ´òŵóƸóĶô˽ö˼öË»öIJð³¤æ‰‚×ac·<K /DvBXBRAT<aD…5c—NcÒ——Ó––žK^n@\>`@bBhDgDh&Hj$IhBg!Dk#DmCg@c@^?]<`<g?d>X;XBiH™NhÀtwÇ{tÄtrºnpÂ{{΍‚Ö–€Ô–‚Ð’€Ò’Ñ’‚ÒŽ|А‚ÌŽ~̏ƒÎ„ËŒ…̉€Ë‡ˇ€Ì†|ˇ~ɇ~Ç‚{Ä{¼€}Á~~¾x¾‚zÀ~¾~Á}~~Ç€~É~zÌ‚|Í„{̓|̆€Ì‚|Ë…{Í‚z͆Ï…{ЂwЂwÑ€wÐ}t²CP®GR±FP­BP«EP®DR«BN¬>M­BK¨@L¥<J¨6D¤:H·HPÊYTÚj^àvfæ|oèŒwë”|ê—uì™xë›sì™|î›tî˜wí–ríuå…pázmØg_ºOT¢8LŽ/I*J–0Jœ8P :P§@Q¥>O©ET®DR±CO°BR³FS±ER²JS´ES´BS²DR³DQ¶BR¸FR¹IU½IRÀQ[ÀSX¿QWÆNPÇPTÆRRÆPQÃQSÄSQÃORÆRSÊ\YÐc_È[MÔq]ÃMPÄTTÊUYÖa_ÔkuÓftÂi‰µc‰±_¨Sp’8ZpE`Gr.cXBS?xExh"SVBj-aZA^HU=bFz2d`J{:kz2^\B[=bG]FWAv8hbEx4d^GYEVEf YIz`OH	8F<XHU…¨c€Õ‚m¾Yc¾Zg΍’Þ’zÝŒ€ÚŠÛ‘ƒÜ¦”ܲ¥Ø¬¦Ù°§Ô¬§À”ž¦k†ÊŸ¤Ú´§×¬ Ð™”ˍÍ……Øzà€‚à€„ãƒ„â‡„âŠˆæ’Žè•æ“è˜Œê™‘èž•ë –ê¦˜ì®¢í²¥íµªï¶ªð»ªë¸®ï¸©ï¼«ï½­ð¾­ñÁ²òôôƶòÆ·öɸöȸöÊ»öDzðº©ê–‹Ûji¾DO§:Iƒ'FZCTAS<Z@‚<bŽ>\ΕœÖ˜˜œFZm!Ep$I]>cCh"Gi Al"Cl"Dn&Jl%Hk)Ii"Eb>`?`@b@e@f@`<V=aLƒ>_¨dwÂxrÅtoÄop½pwÈ}yÐ’‚Ô”€Ò‘ÒÒ‚ѐƒÏ’‚ÐŽΏ€Ð–€Ó”Ñ~А‚А‚ÎŽ€ÌŒƒÎ†{ˈ}ʉ|Å„}¾€€¾}~¾}y¼{ă}¾}|À~~½{~À|~Á|ÁztÇ|xÊxË~yÊ…‚ʁzÊ…|Ά|ψ{Ï„|ЂxÏ€xÑ€v²CM²GT°BO°IU®FN¬DO¬EN®=I­@J©DR¨=N¦7G¥;K³EOÉYYØh\Þvjãpèxê—{ê˜|ì™zë›xëš{îžsívï˜uíqè„jäudØf\ºNP¤;L“,G,H—0H—4Kž6K¥=R£ARªFV¬BR±ET¬CS°HU²FT³HV¶GRµFQ³BP³BR·FS¶IRºGR¼KR¿NTÈRXÊRTÂSVÂPV¼PYÀNS¹LR·LV¶KTÀPTÔn\ÂVHž8H±MPÁTV¿FLÔcbÑYdÐdz¾eŽ«_Œ®g‡­^|›Ib†.RZBl2`o)\M
@L<€R†m(Z`Mj,[T>aHXBVFi SƒJ~…FphI[>W9fMZB\AFxS@f Or/ddPaT[Ge‘h&TG5F6M=†De¸o{¸T`¸Taʍ“ÜžˆÚ†|ÛŠ×ŠÔŽŠÖ›’Û°¤Ø±¬×­¦Ø®¤Î£¤º†’Ч¤Ô¨¡Ò”‘Д’ч„Ý~€á†…âŒŒâ††á…†â‹äŒŠç’è–è–Žé˜’êšŽê ”êœ”ì£˜ë­ í¯ î´©î·ªðµ¤ì´§î¶£í·¨î»¬ð¼®ïÀ°ð¾®ó´óŵõƶöȼöȸóÁ´ð¼ªî¥–ßtpÂHQ­9H&D^?P
9R>Z@|.U‰2UÉ‹”×›˜§Ziw&LgF_>aDjBfDhFh"Gn(Ip(Hn%Fh F]>]:b?b<e?e>\?XDdN’Ni²kyÀxwÀqp½nrÆsp΃{Ô‘Ö‘~Ô’ƒÓŽÒŽ€ÒŽ€ÎŽÎ€Î~Ï‘€Ò”‚Ó“‚Ò‘„Ó“…Ò”„ύ~Ί|·͉~ȆÂ„€Á€|Àz¿‚yÁƒ}Á~|¾}}¼~z¾}~Àzy¿y{Àyz¿zxÀ}zÃ|zÆ}zÊ„̇~Ɂ{ˁ|Ёx́xÏ€y°DR°HQ¯EO³EN¬CS®@P­CL«=J¬?L©BN¨>L¤6F¤:I²DMÈYYÚibÝzqâ†qæxè”|é”zë™|ëœxìšzí›~ìš{í—uî’rè„màtbÚb[ÀKN¥;M’.KŽ(E–.G›6MŸ5N¤<R¨?Q­BPªFT®FV®@P°FU±CQ´ERµEQ³DO´GS´DQ¸DQ´HR¸KR¾LQ¿KPÆQRÊQPËTUÌVWËSTÌWXÊRSÌVTÌSWÐ\XÊwtž9R¶V^΄oҏ„ÃLWËVdÂ^ƒ°`³mŽ²]t¾T`Æ]b¨F[wL^R…S„d RI
- at NB‚WŠz9ldQV@\O]En)^o$\ˆM}=fs*ZbEU:X?hPVD`A|@nT
C_N…JƒfTZGo>nk0TR>RGH<t2V¶rx K\FaÉ€‡Û¡’ÛŒ€Ú‡Ø“„Ö‰ÓŒ‡ÓœÜ²§Ø´«Õ¬¢×±ªÓ§£Î¢Òª£Ð —Ï”ŠÔ„~Ü~‚á††ãŠŠãŒŠäŠŽâ‹ŠäŒææ”Žêœ“è™’ê˜’éœê›‘ë˜ëž–ì¨šî«ší°¤í·¦î¶©ë´¥î³£î·¨îº®ð¼ªî½¬ð¿²òÁ²óijôƶõȺ÷ǸöÆ´ô¯ð©•ázvÈKQ¬8IŽ$Ca<S
:S>XCt*O€.VÀ|ŠÙžœ¯dv~,Pk&JeFi$Kp*Nh"Fm&Ji!Fl'Jn(Ik&Hf@]@_BbBa>e@a<Y@ZEr+SŸ[p¾uwÂtvºmn¸hnÆ{vщ~Ԑzԏ~Õ’€Ñ’€Ò‘„ÐŽ‚ϐƒÐŽ|Б|ҏ€Ó“‚Ó•„Ó–„Ó“„Ò–ŠÐ”†Ð„ÏŒ€ÎŒ~ʈ}Ç„~}À„}Ä€x‚~À~|¿|v¼}¼z|¼||¾{{½{|Â{~½xyÀ{{Á{yÄ}}È~zÇ€~Í~yÐv΂|Ì„}®?N±HQ°BK®AL©CS¯@L®CK°?J¬<I¬@L©<L¥8J¢:N²FRÊVYØlfÞwmãlçzé“xë–vì—xìšzí›xìœ{îœzï›xí’ræ„iáwdÚfYÁNO¢:K‘0LŒ)H•-H™3J :L£=P§?R¬ER­BR®BP­EU°IX°EV²DT°BP°DN´FR±BN·@N²HPºHPÃLQÂOUÄNSÄTTÆORÊTUÌTSÊUTÈWXËUSÍZbÒ[Vâ–rÀ\NÍZOàjRíœhÐff»Wuª^Œµg…Æbs¾TaÈ\d»Udz"G\Lk,f…XˆZ@KBSFX†ƒJ~V?R:[DZHr,\†Ft‚<gt0\g"JZ>V>Z@dL[Ig(Mp2[S>\F†U‡`LY>|FvWF]VRLaE¶rxÅ_a¥;S¿w€Ý«šÜ‘~ݘˆÜ Ø™ŽÔ†ÔŠƒÖ˜Û±¥×³ªÖ±©Ø²¬Òª¨Ó© Ñ¤˜Å|kÀTZÍ`iÔqwÛxyß~€á†‰â‹â‰ææ••ç™’Ꙓ꜔ꞔ뜏ꛑ뜐좔죕쮞봤ﳡﶦ︦ð¼ªñ¾«ó¾«ñÀ°ôŲöȸôƸõÁ²ó¿«ð¬—â‚|ÆNVž,F}Bc9U:R:V?kGw"P¶xˆÙ£ ºq{…+N{,LdHn,Nm*Ne Ef Hk$Eo%Ho*GjCb>^>bBa@d?f!E^?TBe K†@d«bsÂrwÁrsºlqºnsÈ€|ÒŒ€Ò~Ó‘€ÒÒ‘ҏ~Ò‘€Ð~Ѝ€ÎБzÑ’€Ò’‚Ó’Ó˜†Ò•†Ò‘‚Ò‘ÏŽÏŠÌ‹~ËŒ}Ȉ~Æ|ƒÀ„yÀ}½~¿}{¾||¿~|¾{}Áy{¾{|Â{{¾y}ºwy¼z|Á{~ÂyxÆwrÉ|wÊ{xÌ}v±GR¯CO¯FR¯DO«@M«BN®@L®@M±>L¬AM©=J¨;I¤8H¯EPÊUTÖjfÞqfäƒoæŒxç”|ê˜yì™|ìš|ìœzî›zî›vì—vìqè†qâvdÚdY¿NR¤:L’.L‹*H–0K›6PŸ8N <O¤@S«BQ°FR±FR°FT°DR¬>R°ER²CP¯DP®BQ³BNµGT¸HQºJRÀLSÂQTÇPPÇTWÉTRÈSZËUTÊSWÈR\Õ†‡ã®‰Ö„dÀbPb:n6t:(=¼Zn²j•³d„ÇcmÅV]»LUÂRVž9TdJm.lu;g|KxL
-=NHb"XŒcv8iP	:Y@`Dk"Pp&OdDaDeJZ;V
;X@]A^DaHf'N_GTBh.`‚Oƒ^Kg&Zw7id$YQCQ>¢\hÍ}n¨DY¸]lÝ°¢àš„Ý“‚Ü¢Üª—Ô—‰Ð„~ҁÕ›—Û³«Ú¶²Ü¹´Ü´¬×³¡ÌŸ„¦PJ•*>¢:PµJ^ºQ`Å_lÍhsÐjp×ruÝ€âŒå“’è—’ëœ•ë •ë’ê™‘éšŽë˜Œëšì¡‘î¢–ìªžî´£î¶¦ë´¢î°¡í®¢ì´¦ï¶¤ïº¥ð»¨ðºªñ¾©ôðôôôðò¾­ð³—ꛉÚvqºDL…@p=a<W7T;T?lFw'W¤f{Û¦Á|…Š2Rp Dk Im&Jf"Jh)Pi$Jl*Ns1Rr0Ph!@d?]=a@`@e?fCY@XFk"Q•Nk¹ntÀtu¿ps·hpÀrrÌ…|ÔŽ{ӏ‚ҍ~ÓŠ}ÑŽ~ÑŽÑ‹}ÑŽ}ÏŽxÎŽ~Ћ|Џ}А€Ñ‚Ð’‚Ð’€Ò“ƒÐ‘‚΋Í‰ÍŠ{ÌŠ~ʈ€ÉŠƆ}Ä…Ã†~¾ƒ}À|¿€ƒÄ€~Á€À€~À}~¾{z¼yy¹z|º{¿{|ºy{¿xxÀuuÁuxÃvv¯@P²CN®BN®BP­DP­CQ±AN°BN°DN¬@M¬<J¥;I¦<J²DLÉXVØf_Þwoæ‚nèsê‘yí™xîš‚ìœ{îœ|ïš|îœxí–sì”pæ…láxfÙdXÀQS¤:MŽ0L‹-K”2M˜6OŸ3J :M£?R«AR¬@R°FU²GV­HU±HU°ES°DT°DQ®CT´FUµCN¶FN¹HRÀJQÂORÆSVÈSTÆSXÉVXÉVVËT[ÎY_õ¾›Þ‰i¦<A|;Q
9Q
<S
Ar&Q¼x”Р°×§©ÍVZ¶BQ«FT4LkEeR~?s{N‚g%UOFPKu7n–ršn0^Q	6`EZ<_DaF`G`Hf"OYAX?bJZD\Ah$Vt._k#VbOp.jy<ldRl0`XEL>H9…D[Í}q¯LZ¯N^Ôœ“ࠆߖƒÝ¡ß®–Þ´ ÒŽ†Î…€ÎŠˆØ¨§Ü³ªÜº²Þº±Ú¸§Ê€¬HP¨BW«K^°KZ¯EW©@NªBV›6I¦?U³K_ÃVfÒmrÛ‚ƒãŠèš“ê¢˜ëœ”ëšêš‘ìš’ê•Šëš‰ì£’ì¨—î° í²Ÿê²£ëªœí­ë°žî²£íµ£ð»ªòºªð¾©ô®ôÀ¬ð»¦î®˜ã’Övn¾RX3Jx@j:a8X6S;V
?iD{.^’Jeݪ¦Æ€…žLedIhCv,Qj$Ii"HiEm'Hr-Jm%De=_>]>b?dCb@fGXBZFx/W Wq¾ptÁvx¹pv¸gpÆz{Њ|Ր~Ս|э}ÓŒ|Њ}ЋxÒŒ~э{Ï‹z΋|ÎŒ{ÏŒzÌŠ~ÐŽ~Ґϐ‚ÑŽ~Ñ’Ò‘~ÍŠzˆzʇ~ÍŒ|̉{ÊŠ~ljlj{LJ~Â…~ă€Â††Ä€À‚‡¿~|¸z}¼{|½zy¾x{¼wz»w|ºx¸x|¶sz»rr¯BO®FR­ET®BR®EP®CQ°ES°@L®BL®AOª<L¢=N¢6J²BLÈWZÙj_Þyjå‚oè‹të’xì˜xï™~íìœxïxíœ~ðš~îsç‡mã|gÙh[¾NS¢6K-KŒ+L’0M—6Nž4M¥BT§<O«@R­ES°HV°DR«BS±CQ°IT²GT²DPµEOµCL´ANµGP¸FQ¼KRÁUWÃPUÇQVÊRWÈW]É[_ÈZ`Ñccð¤~Ò†r’6KtBe>T=gE Lk¾™ì•uâ‹fÂRX•+Hˆ-Mƒ+NhSj*c{Bm‡^‘RCQJb#^€D~pq6`M7W?R<g"Um3]b*R\Fl/Yc LV>dGX=V@XAr,\†H€dKt<vd(Ti%[f)_OAJ@n*LÂyp¾`d¤G[ÌŒ’ÞœƒÜ™„Þ¢Þª˜àº¦Û®œÐ‡Ï…‚Ò•™Ú®¨Ù´®Úº°Ú¶¤ÌƒxÈ[bÎdjØtyØrv×rwÌhsÂ]j´Q^œ<S‡">‚$@†$>š4H±FXÍjoÝ‚æ–‹ê˜é™Šé•é™Žç–‰ê—Œì›ìª›í¯žî²¢ê²£í¨œì«Ÿë­ î¯žî² òº¡ñ¸¤ð¸¢ð¸Ÿê­”ߏ€Ìrm¸X]®JX£<LŽ(D~=w:d
4[8T<TBdEr$U„=ZÚ¥¢Ì‰‹«YkgH`Bj"Fu(Ho*Kj#Eo(Il#FeB` EaE]?_?e<g"CeA\C^C„:\¬dsÄts¾px¸kq¶lú|ԍ~Ù’~֐xÓ‰|ÓŒ{Њ~Њ|ÑŠ~Ћ}ÒˆyÐŒz͈}Ή€ÎŠ~ÎŒ}Ë‹‚̍€ÎŽ‚ÐŽÍ̈}Ɇ}ɇ|ʇ~ÊŠzʈ|Ȉ~ȆzɉÆ‡‚ÇŠ…ņ„Ĉ„‚„ă¾}}¼|}½{|¾{z¸~¸wz»w|µrx²py¶pt¶GQ¯HV²DS°DQ±HP®DO®CN¬EQ²DO®@Jª>J¦<M¥9J°ANÉTT×g^àujãlèyì–xë™vî•vî›}î™{í}ïœ~î™ví‘xè„mâvcÛi\ÂRT¡9L-H0O–1N™8Pž9N¤:J¬=Pª@P¬DR²JV²ER±EQ°AN®@N¯@N®BP²@N´EP²ALµEN¼IR½IP½MSÁRV¿QVÉRTÈTYÊ`cÑnhØibÙlbß„m³XRvB`:N;RF˜LoÆovÆ\a£:I¤CV€ GŒ8T*SgTz?w|BugOVL\PyB|:{xMp|GtM	;QAXKr8cl%U\"Kh6_m.Xt0^Z@`BS
8T;Q
-:VBt6f|>s~Q‰U<y9t[HJ?TBªclҁx°KZćஙܑ~ݝŒà¨›ß·¦Þ¼«Ò›ŒË€ÐŒÓ¦¢×¶®Û¼±Ö²¡ÉqhÊT\ÔfjÛsuà{xÝuzÛpnâ‚€à~€ØlpÇXcµJY6L“-E†$>‚ ;Ž)A«CUÒprãŠ€æ‘†ç‘‡é‡è’Šé˜ëœŽí§•î­î® í®Ÿì©œíª í´¢î°¡í¬›ð²í¦ä˜Ðvg¶UT¥EN”4KŠ1M˜8S¦FX¨BVª?L¡1Dt:f;W=U>^?p%S~<Xؤ¦Î…Š´eto&KeIaBu1Rs-Kt&Gs+Ln$Cd?Y;`?^>_?d@h"GdD^DfL’Fb´p|Ãtv¸lu·hrÁtt΄|֏|׎|ÖŽ|Ô‹~Ô‹|ÑŠ|щ|Њ€Ï‹|ЊzΊ|ψvψ|̈~΋~ÌŒ~ÍŒ‚ÎŒ€Î|΍}͈|ÌŠ€Ëˆyˆ~Ɉ|ˉ}Ȉ|Ê‹zȈ‚ʈ~ËŠƒÊ‹…lj†Å‡„Ä„ƒ¿‚€À‚‚»|€¼|~¼{·x|ºu}³ry³tz³nt²BM­BR°GP¯CS¬JV±KV­FQ®FP±BL¯@JªAP£5H¡8J°BMÈTWØbYàwhã{méˆsì”yî›xî”sî›|ì™xï›|ðœzðœzî”xç…läxeØh\ÁQR¢:N‘,I1N˜1Mš8NŸ:P¤BQ¨>Q¬AR°JX±GS²BQ²DQ²BP³CO¯AP­:I°BO²?I´GR³DM¶DM¹JRºGN¿JPÀOUÂO[ÐfiÚ{vátÜojÝneÚ}j§VemE‚:Vp0SJB’Pv¿cqÂbo›1QŒ6RŒ7Ty"IhMp-b„M„t7p]R\Uv at w„Mƒ^Qh3Z”hšV@TDV@p)XcHSBWGn1`ˆKxk#OV8T6X8X:Z?_"Qm7VˆY‡YDh*UL7G6†>V΄vÊb`¿lxÜ« Þ—Ü—†Ü¤’ݲ ß¾­Ù³£ÐŒ„·†ÔŸœÚµ®Ü½®Ö¬”¾^YÄRWÐ\cÏ]`×kk×ijÑjqºH\×vtãƒ|ÝuuÍZbÎaa³?P®?P¦8J›2H•/Iš2KµGYÔhnãŠ„æŠ†çŒ†ê†éˆì–‹ì£˜í©œí°Ÿî°¡í«¢î©Ÿí¬ží¨™ë¢’ê¡Ö{t¹TV 8Mž=T¦Jb¦I\±UiºVcÍdjÂLN¸CJ¢4Bv=o=Y;T?[<t&V}/RÖžË‡Œ°ar}.OdBbCu2PgDo"Jr(Kp(IeB\@`A`=dAfAfDdFdIp#PRn¾rx¿ts¶kp¹jnÇ}{ÔŠ|Ս{֏~Ô‹~Ô‹|ÕŒ|Ò‰|ш~ÓˆzЊzЊ{ψ~ІzΉ{·{φxΊ|ÏŠ~ЋÐŒ{ÏŠ{ΉxΈẅxȇ}ʆyˉ~ˇ{Ê‹zËŠ€Çˆ‚ȉ€ÉŠ†È†…ȇ„Ç„‚Ã…„Ä„}¾‚…»€º~~¸x~¸uy²r{²qz°nz®AO­FT¯FT°FT°JV®FV®HR®BK°CM¬>G§:J¤6E¢4C¯CMÉVXØg\àv`ã€pêŠtì–xìšzï˜}ï˜wìšyïšwðzñ~í”tæ‡oâ|iØl`ÂTY§;L‘,H‹)G•2Kœ4J 8M¥>P¨AS°DS°DR±DQ®BQ²ER±AN³EO²BO²>K´FP²AK²AJ²CN¸DK¾JN¹GQ¸KU½LUÇTZÚxnށuÞ€yÞzpßvlæ…lØ …¯nqÅ|~¿lz–Fd¦bƒ¾U`Ôjf¢=Rp(Il"D[Kk$_{7o`™x0hp&fp0h‡X†n1fK@ZH‹[ƒe%TVEYD}=n\BP=RCh(VŒR}t-[T:U6Z
5`>\:V:Z?` Fr4fN
-8J:f!BÂ~y¾[`¶ZfÚ¦ Ý ‰Ü–‚Þ¡ß²žâºªà¾­Ù¦šÒ“ŒÓ–”Ú®¤ÝÀ­Îžˆ­JL¸BHÂJN¾FPºHM¾OPÁPNµKQ†<¬CKÔthÂP[¬=L¯BRµDYÂXi¸DT¼LZ¸AT¸EV¼DVÏ[bÞtvà~‚æz剃牂둉죗ð²¢ï³¦ï¯ î«Ÿî®¡ì¥™æ“‡Ø~|ÂZd´Wf²N`¶U]¶R\ 8IŸ9G²HN±AI™0B–/CŽ(Bz =y'HZAU>[Cw,Xv,PÑšœÎŠŽ°_jB[a<b@r/Ph Dm(Hp)Gl"Bb?]>b?d>b@f?a@_Af J‚3YªbvÁsw¼ru¹gm¼kmÌ€zÔ‹|ԍ|ÕŠ~Õ‰~Ôˆ{Ô†yÓŠzÒ†|ÒˆzшxÒˆv·χxЇxχ{ΉzΈ|ÏŒxÐŒ}ÑŒzÏŠwΉẅÿ|̆wˆ{ˆzʆ~Æ„~Ȉ€ÈŠ~ÌŒ€Í‹ÉŠ…ÉŒ‰Å†‚Ä‚~ƃ€Ä†Â…ƒ¿¸}~¸vzµu}³u~°oy°@T¬FR­ER®HW¯FR¯DS®BM¬AM®DNª<I¤<I 3G¢2D°?LÈXUØe`áugå€kèŒrí–xîœuîœxð™tð›zïœuîœvìš{ìvçˆvã~gÚndÅQU§<K’,EŽ(H–0G›3H 3I£@P¦?S­AN­BR²BR´EQ²BL±?K²BL°BK³@J´?H®;I³?J´BL³@K¶ET²N_¶Zt¾o{ÎpuÛtjÜ€rÞ‚xÞ€xÞ|pæhî–pãŠgá}à‰€¿Wa‡/Mƒ$D} @`A^2[]#Qh)f~;t^‘}>sdT|7vv3j‰[ˆg&XG>RCs<bv:lY@ZH€BrZ>R=R?[L{AkˆP~YBV<Y=\8a:]<Y<S:V<XLL
-5¢YcÏxr®JXАâ©ŒÚ–…Þ›ˆà©˜âº¨äÁ³Ýº®ÖªžÖœ•Ú© Þ¾­É‘}œ7B¤6E§7B 3B¤;H‰$=†"=„#:~6o5z6”/:w9m6w;š4G¾Va²AVÐ\eËU\ÍQ\ÌR^ÑYaÙfmÞtwâ|æ‚~ç}ꏈﰢñ¯œïµ¥ð²¤î®¡ï¬žë§–߆‚Ñno½`h·X\›5B…(=z8r7r:}>{@~"@‹'?‡ =ƒ,Dk8\;R:\B|1Yw&NÒ—˜Ë–¬Xh•G]hCaBt3Ol"Gp(Ll"Ef?a<`?`=`>`>d@^?U=eJ’Ib¸pw¿wzºquµhoÀvvÎ…zÕŽ~ՍzÕŒ~ÕŠzÒŠyÒ…zЇ}ц{ÓŠzÓ‰vÓ‡wІyЄyЄyЇ|Ј|ЈzΊzЉwΊzΊxІzˆyÎ…vÌ…zʆẍ}ÊŠ{dž€Ì‰|ȉɈ€Í‰È‰‚Ȇ„Å‚€Â€}Â~|ÀÁ€¾~º}¾z€¸v~¶w{±r~®@N«HR°DN¬DQ¯AP®DQ­@M¬DN®>H§AO¤8E¡8G›0E°>IÌVT×f^Þuhä|jéŒrê”wì™tïwîœvîŸyïœxí|í˜zì’tè†nâxdÚhZÆRS¦;J3L*D–*Bš2F 3I§9J¢=K±@O´DN²BL·DMµBJ´AJ´BL´<G°>L²?H²BL®<H²;G®=P´QdÂ{ŒÊŽÔ‹zÔqjÜwfàzhàrß|sâ{mâpÙxk·N^ÀT`Ãmu”<^^:T<K	;QHk8kt8s|:|ŠR‡–jšp&ak$]„G‰x4hŒ`d#VNDWDr4fq2a^MXB‚N~X?S
;P;RH`RŽ_…M„`MS:X9b:_8V
5P
6G>L9w3Qˇ€¾Yc¿lvÞ³¦Ý—‚ݝ‹Þ£’â³£ãÀ±ß¾®Û²§Ú® Ûª™ß¼¦Ã…o+<”*B’&<ˆ <r:v:o:o:l:j8j8l<h8f<a5]
-3k7€;»UbÔjuÔ\fÖ[aÕXaÕ]dÙhpÝnpâvuä}zæ‚}ìŒ‡í “ð®¡ð²¥ð¶¬ñº©ð·¥ì®™ä–†Êkf;H'Br<m7p8l8k8j8l=n?p<v?$Ay"A`6]=Q<X<2ZsIГ’Ó˜š¬^n–F[z/NbAq,Nn(Jn#Gl%Df@`:`>c@^@d>fCYBR
<bGžTi¿txÂtq¹mp¿klÇzuЈ|ÔŠ|ÔŒxÒŠ}Ò‹|Ó‰vÓ‡vЈzІ{Ñ‚vшwÓˆxч|Ò†xÒˆvχ{Їyω}ΉxЊ|ЋyЋxÎ…x̆vË…{ˈ|Ê„{ʇzɆ}Ç…{Ȇ~LJ€É†‚ʈ„ƈƒÇ…€Ã…€¾€À€¾|{¼z»}€»|€·z~¶wzµuz±s|¨>N¬DNªBN§>O¥DQ¨@Q«<K¨<M§<J¤=Kž4E™0F˜0G©8FÄOPÖdZÞtfäkèrì’uíšyðšvïžyìžxð|î›|ð™xìŽuèƒiäwdÚnaÃRR¤<L/J‹&A“-Dš2Hœ6E¤6H¢4F«@N¬>L²HQ¶BM´@H²>J®>J°@L­>K®@L®;I¬5Hª4N¯F^Å‚–ØšöLjáz^×l_Þvfàvfá{pâ~rá|rÙzwÀfr“B\lF‡<X€.PR<G	@RMzG‚ŽXŽz3kz:pb—t1_€B€t1i~@~|By“oc"UMCUCu3fXAq/h[I‰W†[@TAR:O
-;RDj,Z_ŽZŽm,_P
-5Y
5`9\;J9F<U=³opÅnf¹VdÚ© à ƒß”€Ü †Þ¨™á´¨â¶ݺªÝ²©Þ³¢Ý¶ŸÆwŽ*=† =†<w6n:n<k:l=i:g5c9d=k&KŠCY„9Rm?Z7Y9_
6ƒ>¾KXÓfkÕ`eÔZbÖ\dÛdiÝklàrxãxuåë†í¢˜ð°Ÿó»­ó¼¯ó¿­ðº¥á ‹»[Z†(BjDd@eCk>~(F|(Do=h<j=oAl Bp>z<l8d8_7U:Y?v)SqFÌŠŽÕ˜ž­[n”H`v,Lo#Lp*Ln&Jl$DkAb<[<`=c<b?eAbCZATBr$Jª^lÄy{ÀspºntÅstΆ~ÕŽÔŒ|ÓŒxÒˆyÒˆzÒ†yÏ‚yчxЄzÏ„zÏ„vц{уvчyÒ‰y΄yÒƒzІyψzЇ|·|ψsÎ…{̇xÉ…y̆{̈zÊ„zȆ~È„~Ƀ|Ȇ†È…€È…€Ä„~Á~Á~}Á|¾||½~|¼{~½z|ºy}¶x{¸x}µv{´s{¨>L§=L¨AN¦<J¥>J¨@N¦:H¦;K¦:HŸ8Iœ6D•,B’+E¤5H½PTÕbWàrcä~féŽsì˜wí›xîštîšrîžvï›~îœtîšvìnè„häxbÙe\ÅRT§8JŽ(CŒ&C—(B2F¡6J¤:J¦:J¨?J«=J°>H±BN¯<I¯<I°>L­;H¯>Jª9G¥8G¦0H¡.NÏ„~í¸šòµˆøºtÒZQÙnbÞraàveâlälÈadÁox°^o‚-Mz-Sm@X@JDLEU‹^l'X^I†YŒd)SXOx<pBwz5vŠ_Ž”l”XJJ<XFn0`TFd$Ti&W‰^ˆf!KXE[>T:T=TCm4_V†Gty:pgOZ6U
-5J;H
-:H]Í‚z«HWÎŒŽã²™Ý–‚à›ˆÜ¢“Þª–ྰàÀ´ß»®Þ³§Ü¼¦È{Ž*@”)B‡!>u7g9f;i7k:h:i;]=hCtJŽFf¿– Á–§ Xpt$E[
7Z6a:*GÊXXÕbdÔYbÙZ\ÜbjÞejánoâuwç}zꊄð²©õÀ­õµôŭ篖®PVj=aD\C^Lp!K2dœWv®k~—?Vk<^
5f8m>p?n>c7h:a=V;^@{.WpFȆŠÙ¡ž­`rŽAYt'Jo Hv.Ps-Km"Eg@a<^<`>b<b=cC^>[E_Gˆ;Y¹jsËxvÄvu¾orÈ{{Ί|ÕŽyÔˆzÒŒ{Љ}Ò†xÒ‡zÒ„wÏ„yЃvÏ‚zцyЂyÏ„vЃuщЃzσyЈzЊ|Ά|΄|ΆzÏ…zÎ…yÍ„tΈ~Ά|Ì„|É…{Ç…|‚|рĄÆ…€~À~Á||½||»z|ºy|´u}¶u{¹vz¸w|²t|µt|²qx§>M©EP¨BQ¦<L¨;J¦?O£:M¥:J¡:Hž5F˜0D“1E”)B£5DÀMNÖe[Þsbä€iéŽví™sî›{ï™xïxîœ|ïœ|ð|ïšvëtæ„lâvcÚfZÆSP§:HŽ*D‘(D˜,F¡4H¦5J¤<N¬>K­AN¯?K°?K²?M³=H°CL°<J°BK«;I¬8F¨5D¦3J¢0Oáv誘õ¹…à€hÌ^\×lcÞteâzfähØrk¢C_Êjpº]l|+Ox$KO
>RIXNp>pˆVzk#VVF{Izs9aJ
BNHv6lŽ_—‡F}‰YƒDpVHP>WG`FT>XHWF{Onx<h\D\AW:\>[AZ?bBW>b)Ls7abHT
-:K=a@Áxw¼]`³\n೥ܘ€ÞšÞ¦“Û¤—Ù¯§ãĸ࿳໧àÀ©Èš‚˜7E4D”*B|9g8a7k?†2IvAs"BpDT	8d@0W…8TÖ®¯á¼ÀѨ®²~ƒ+Ns=˜;Z‘(GÀOTÐXbÎR[ÔV[Ü`gÝejànrßplå~{銃ð–ô¹ª÷Ǻö̵ðèÂoc|AbB`CZF\Jx*NªxŸŸ[sȏ¡¶fv‰*Id9b7j8n9jAd;d;_<T6`@~-TgDÇ‚…Øž™°^t–BY‚8]q(My4Rp%Ho&EfBa;`<`;d @bB^>\@WBl"OPfÁryÊztÂtt¿pqË{ÓŠ|Ô‹zÕ‰|ÓˆzÓ‰zшyщw΂wЇzÒ…|уtÏ„zЂtЃxÏ…zΆ~ЄwЄwΆ~Ï‚x΄yІuΆ|ˆ~͆vÍ„vÌ„xˆ|Í„{ɃzÅ‚}Ɓ|Ä‚}Æ…€Â‚€»}€»|y¼zy¼yx¸vzµtz´w{µpv²t|¯t|®q{¬s|«px¬DNªBN©AO¥?P¦?L¨@O¦=N¥;K¢6Kœ4E™2E’,B‘'@¡8IÄPQÖf^Þr`ã‚kéŽrî›rîžxížxí™yîžvðŸxî wéšä„nâxbÚdZÆRP¥:L‘(C“)Aœ0E 2E¨;J©BP«>L°@K²BJ°BL¬@M­>L­BN²EL¯BK®?L­9H¨9D£4G!F¶[]ࡔݦ{Þ¨”ׂÖvpÝtlâxjàxiÐkmº[hÜ{hœ8Rc@dALE^TFzDr\FXGo2hp0Yd"XPKYRx:n”d™|;s†[ˆ~>o^KUBV@U>V=ZCSEk1S‹Y‡e"M`DT9X>Z=^E\=U7YAVFR@^Rr(g–NfËvm¬EWÖ¤ã¬’Ü–…Ý¢ŒÝ¬™Ù¯¤à¾²â·àÀ±âÀªÕ¬”¢FN¬AM 6F‰"?s;g8k:#B¡IY‹1P|/N‹>`lEt(HCeo(PÒ®½ä¿Ä潾ܰ°¿n~•&H¸LU¶@T¹@IÊRXÆLVÌT^×ZcÚdkÞghájpç{v쏊ð§›õ½®úлôвۘ†¢>K‚(HgDz0NbCdCx+OŽ?d™TrÔ›¥Ë|…¢9Jv>a8g<g6i<b;b:bDX@d@~3\gDÀ„ŽÖœ¶n’4N‹Dfs*L;Wl"Fj!Dc>b:`>a>a;`=Z>Y@]I}0Rª^pÆvvÈttÁssÂstÏ„zԌ҉~Ó‰xÒ‡{Ôˆ|Ô‰yΆ€Í„|Í‚xÒ‚vÑ‚vσxÐ…vσyЀvÒ‚sÑ‚yЄyÏ‚vÍ‚w΂xÏ„|Ï€vÎ…{Ì„zÌ„wË„~Ì„zÈ€{ƁzÁ~Á~|ā|Â{À~~¼}€¼z|¼y}¶z~¶v|±s{²ov²rx¯oxªovªlxªo{°vz°ANªAQªGT©=L¨CP«>J¦?M¡<K 8K›;K˜2B•,D&?¢4F¾OQÕbXßrcãnêŽtî˜vì›|ìžzíž|í yð¤ð {ïœ|ì”vè†rãu^ÙfYÈTR©>K–+B”*C›1G 2Fª>K®AN®AK¶DL¶CK³BLµFN±DN³GN°EP²@L±FP®@Lª<GŽ(BiB—MRÆ•›Š2O«^Tê°’ç­œâŠ|à€qÛzk´Q\‹,D‰/E^BP=RGWP~Gz‡HtfQSCm2ip-a`Pt8nZNaYzEz’^˜|9t•v |=mXCSBZD[BZCW<PAcL’dŽp(U[?Y?X:Z;`D\8X5W9R7L@L>j(N¤^{™@Z¸l€Ú¥˜Ò‡‚É€ƒÍ’“צ¢Üº®á¶ÝÀ´Ü¼©×±š°Z^°GWÂR^³HV¤8L•2H{<l6‘&F¨HS«Xlz'J‚6V‹;V‡7WwJšbŽÜÇÏçÇÆêÅ¿éÀ·Û”®AZ¨6IÉR\¸:HÄHTÄJXÉP_ÓT`Ö^`Üdmßqt惀쒋ðªžöóøθîŬÊpn£<P§Rj|&KE`Ž=]‰6RŽA^{$N°r•Ú–Òzƒ«AN~ <h3`3b2f8^:`9^9W=fB~3ZcFÀ|…×¢œÀx‚„2QGbz.Q„@\hDm$F`>\8a<bAeBc?^@ZBbEŒ?[´joÃxvÅtp¾npÃyzÍ„|ÏŒЉ|ÓŠzщ|Ї~ÒŠy΃zЄxÍ„v΄vÏ„uË‚wÏ€uÌ‚|уvÑ„zÒ„yІzσxÌ„vψzÏ„zЃtЂvÌ„xÍ€yÊ€vÃ~xʁ{Æ„|Ã~{Â|Ã~zÀ~{¾zz½{}»vxºx~¸uv´ps®nv°os®jrªmv¯py²z~»‚„ÆŒƒ¯FQ©CP©BQª@JªBN«@P¥BR¢8JŸ=Mœ8G”0B‘*BŒ%@ž4F¼MRÔb[Þsdãmèrì—xîžvïyîœwñ¢zðzí—xç‰oãv`ØdZÈSQ­?J–2H˜+Eš4F¢6Iª:J°@K°BL¸DL»FL³DK¸EK³JW³?M¸FSºJQ»YU—1B}9q:^?l@ƍ¬c{˜šç©”úÉ¢õҾꮎ°TTbGR>TCSAOBXKx<n~:hi Pe"\cWq0fi*bd!Up/am+gs0nˆ\”b™‚=y™zš€H~RDVA_H[Bd#MXBSA^D}BghF\=bEZ<X:a>^<W9P6Q<PHVFœZnªUb˜H`Àš¦ÆŠƒÍ”’Ô ’Ü°¢à»­ßÀ³Þ¼±Ü¼©Ø²š²\_µN\ÂT\Í_dÈ\hÇYdºQX <Ov8=®EZ¹V^¡Rl}.RrHy*Xš^ŒË±ÅçÁÄíÁÀ첦áˆ~Í_kÂBTÐWVÆKVÈKSÎV`ËNZÑTcØ^fÙgnàpp傀씌ð¶©ö̾÷Һ輪½S`´M^Àlv¦Wyƒ4RB\‹B`€.X›Y…Π±Ü”Òq~ª;L€=m5j6j4h6\7^7Z;Y?o)Jz2ZeJ¹u„Ù š¾{ˆ€0T‡@b‚6Uƒ<ZhCfA`<bBb@`>i$Fc=\:Z>dC—Nd¼ryÅytÂut¾tyÊvÑŠyÒŒ|ÑŠ{ЈxÒ†yІ{Έ|Ì‚wÏ…vÌ€xÎ…z̓vÍ„{΄|΃wρyЄw΀yÐ…xÐ…x΁x̓zÏ‚yÏ„xÏ‚vÌ‚w΄uÈ€zÅ}xÄ€zÆxÃ}yÁ€¾{{À~z¾x|¹sw¹t|´tx´r|±mt®oz­lt°rw²y}À„{ÈŠ‚Д…Øž‡®@N¬FQªCP­BNª@LªBN§@N¢9J¢;J›:K–2F‘*CŠ$@ž6F»LSÔ`Yàubã~nèŒrî–yížvïŸzð xðŸ{òŸ~ðž~î•zè‡oâxfÚdZÊRP²>M›0Gš1H 4I¥8I¯>JµCL²EM¶GN¶JP½HO»IP»HNµEL±?Fž3<„)<l<2[z$P‡<_§_|И”Ë‚šç”ˆî¸£ùïÑôݯ´r`h!Lm0jM>R@M?TJs4nŠK„|;tq5nh(aZKl0jv7ny<s|:r€Dys/hŠb•ˆU’s0h–tžˆX_L_K[BV=cFZ<X;_=f#H]DbEfFY=\:\<`>Q8N:J	8RL„D\Âwx¢BVÀ†Ú¨šÕ‚zÜŸÚ¨•Þ·¬ß¼²Ü¿´Û»¨Ôª’¶ZV¾R_ÉVaËR\ÐVdÔhmÖjoÑcj¼Tf6R—2N³@TÀQgÂez´a¨Z„³u’Χ¯á¸ºå¿½îļ析ÜmpÞsoÓ\gÌNWÒ_cÎPVÍNXÒU[Ó[dÖ[dÙ_hÝinä~똒ò¾´÷ÔÅõһ⮞¼P\¬<Pµ\hÂp‚¦`•Hv•M~¦lœÊ¢¶Ø «×’˜Îgp¦:L€>m9n;n6o=c>Y<`C_Br,Lu+RdL­cvÚ£Ÿ¿„‹‡8\†>`‚>^€;Vl&G`>`>_>];^=k>f>\>Z?n(M£Zf¾uxÂssÀqrÂtt˃ÒŽ~ЉzщzÒ‡wЇzцv΄|Î…w΄vË‚wЂx΂wÍ„zΐƒÌ…|ʃsÏ…x̃|Ï…x·{·wÊ…z̓y΃z΁xÊ‚zÌ‚sÉ€wÅ{Ç€xÆ|wÂ|y¼yy¼yzºxw¼wvºyx¶qv±qx²nv®lw¯tz»~{Ň|ʏ€Ô–ƒØž„Û¢ˆà«‹¯DQ«EP®FPªAN¨BN©BN©@M¤8L¤8K:J•6G)@&A 2GÁPQÕcYàsbä€lêŒsë–uíœ|î uî¢yï¤|ð ñ ~ì—vê‰qã{jÚg[ÊWT°@N4I™5J¢3D¨8I­<J³AMºEN¿HP¾LT¼IRÀJR¿MP³]bp8^7b;tHžSl²k‹ÇØ~„䔊߫­áŸ’óɤʔk|<CXKYKH€SMVQh)l„P’šo¥ŒZ†{ApP>OCPDuB_L‚Byw6mr2lt8x‹j˜’g¦k(dœƒ°b|>rh"Ke$VR=[>T
-4V
8]A^@^Ag GdB`A^=^#C\>R6J7K<e C¼ru´MX²]qÞ·¯Ûš‰Ú•ˆÜ¥—Ü°¡Þ¿´ÞÁ¶Û¾ªÑª”¬OQ½LVÊX^ÍZdÏ`eÒ[bÙkmÚrxØnsÕhlÅ^k·HX¯B[²D^ËSdÐdnÑt€Ø€‰Û‹‡Üœ›ã¤¡é¤Ÿæžœàž¥Ú…–Úq€Ð_rÒ_hÖ_bÔV\ÎQ\ÏQZÖZbÔ]eÙXbÞovå~€ìš•ò¹­øÕÇóÒÄડÅj|´Nm°LoÄXpÌs‡ÃtÉz”щ×‘žÑ†Îpr¾HP‘*@n4{#@{">t<r?d?[Bc"K`Fw2Ks*RcK©dzÜž—Đ˜—Gb†;[ŒHcs$Fm"JcDZ:^AZ8b;h>b>Z8dC†8V®gtÀxwÀsuºnrÆ{ẍÐŒ‚χ|ΆyÒŠx͆x̓tÎ…yÌ„v̓xÆ~z̃z΃vΆ|ÏŒ‚ΓˆÌƒzÑ…w΂xЄzΆzˆ{́ỹwÌ€vÌ€vÉ€wÊ~tÅ~yÃ|vÄyvÂ|x¿zx¼yz¸t{ºvy¼xxµst¶qx²nt´tx¼}}ƍ{ГÖ˜Û¤ˆÝ§‰àª„䮇粌°JV®IQ®DR­DR­IT¬FN¨>K¢9H 8Jœ1F˜0D”-D$>2D¿MPÔb\àsbä‚mèŽtê–wî™zðž{ï yñ¡€ñ¢|ò¢ñ {ðšwê‹pä{hÜk\ÈUR¯@M2F›1F£7H¬<I±>I´FP¶GQ»NR¾LR½OY¿KSË^P«XY\8\
8ƒ*P¡JfÆ…ŒÍ‚ˆÃwŒÏyˆÌr‚ΊÛ¥¡¬ifb CY RTNVP{G|‡PŽˆPŠˆW„}Erl/Y|Gx_MJ@MC[N„X’UJ|H}v6pl,kv8x‡Y‹v«…G‰¡‡¯‡R~~Bwn1ar9hSAY@S:U<Y=]@^?a@]=`<`A[?Y9O
-4J
-8N
-6—O]Érl¨>UË•–ଛړ„ÛŸŽÝ®Þ¹¬àöݿ«Ò®š¯LN·DNÊP\Ï_iÒ^hÔdmÕcnÙjqÜnuÝosÙpvÖkqÊ\hÊcrÎ[fºGXÆRd²>QÅ[lÒgpÈfiÊnlÄdkÒ~ˆØ‘œÛ—£Ü›œÞˆØnqÒW`ÒV_ÎVbÒZhÖXbØ\dÚ\fÜkqãzzé—’ð¶¯öÕÊôÖÊæ°ªÞ˜ÖŽÎ€ŒÌp~ÖvÍdpÈ]gÌnrÆpr¬JTŸ4F“&>€<t<—8JŠ-Av<t@eB\=e"HdEv0Mq#J^K¤\uØ•‘Ì“—žVn}3TD`u,Jp$F\>\>`?\<e<l#G`BbBy<X˜LcµjtÀux¾mnÁopÇ|wÑŠ{ЊχxшzчzΆ{Í‚yÍ„z΃xÊ€xāz΂zÍ‚zΆzÏŒ„Ê’‹È„{̓ỹ}Í„zÌ…{̇zφz̃uÌ‚zÊ~tÄ}xÇ~uÇ|s¾wv½utÁyv¿xv¹tx¸pw´uz¶uy³tzµrw¹{|ȆwÓ“~מÜ¥„⨆⬅䯈它氆贉´CP®DP°HW®HU«BN¬DQ¥<N¢9I¤4Gœ4F–.B’(@$?œ0B½HLÕc\às_äqèŽoê˜xì›}ï}î¢|ï¦|ò¨|ó£~ñ¥}ð—yêtå~mÜhYÌXT±BL™/Fœ0F¡6F©>K°DL´DN»EKÀLR»KVÁKOÂFPÊXJ´hciA+K¶bvÊlyڍˆÌnƒ²j†®jŒ®cÀ~}ŸS`j&Vn-`e QZF\RaRf–^–n,d`\„V}IyRFRDTJ]I‚R‰`$ZwCtJTSn2nˆY]“‘[–™sŸDˆVŠŽrŸZCR<\AW?ZBX;\<_@^>[9_C`>V5T4J
-5H	<p)IÂwv¹JSµXcÚ®¢×‚Úœ‹Û¨—೥ྰÝÁ¯Õ²š¨IN¯<LÅJXÐZdÔblÕdtÚnrÙhpØnsÛpzÛptÛnvÚqzÙqvÚquÓcmÄTbÌZfµF^È`nËjvÀcyºYl¸\xÉ|‡ÒxÜ‚„ÞƒƒÚvxÒfsÌVdÐT`Ñ\jÔ`mÖX^ÖYfØXeÚjrãvyꏍﰪ÷ÓÈôØÊ涰ޑ‘Þ~×tvØlnÑjm½Uh³Rj´Tl²Qa˜8X‰*H†&E—6N™3G4F”)?x7v:e:]7eBdD7Tp)O`P¤VrÖ””Ðœœ«d{~/TŽH`x+Ig>`@^>_?Z9h@hA]?dB„8S©]m¾tx¾rr¾mqÁvwË„|эÔŒ{ω~ΆyÏ…{ІyÏ„t΄{ʆ{΃xÆ„€ÈxÍsÍ‚wË„yË‚yÌ‚vÍ…zÈ€zË€x˃vÌ…|Ë‚{Ê‚zÊ€yÈ~xÂ{vÅ|tÄzvÀxr¼xzºts¹rs·sx´tt²q{¸rwºz}Ɉ~Ï’€Öž~Ü¥„ુ⬇泆沆糈汆汌籈³DR¯HR®GP®CN¤CQ©BP¢;Lž9L1Eš5G•0D)BŠ%>˜+@¼JNÓaXÞrdä€léŽpë•{ìœ|ðŸxï xñ¤|ñ¤ñ¤ó¤€ñš|ëŽxå|hßjZÎWP²CJœ.Dœ.E¡2D¥9F°>K´CM¸FL¼KQÀPS¿JPÀFP¾JWÊypªap´pÊr†¾d‰»tÂŠŒª^k‡8Xp,Sy4^…Gmv2^_JW>PAWLONh5g—{©•l­‰X˜šs§‡KŽ~KŒd"W^ TO
FxCsg'bn2e†Xj,lh6l‚Nˆ„Pˆ–l¥™n©”k¢•|£d*NP>\H^JV<]AaBZ:`B`@]>_D^>X8N
-6D4S>¬foÉqk®FTË‚†Ö™„Ú•ŠÚ£•Ú¨Ý»°àò׶§NM¢0B¿ANÊPYÔ\dÔbmÙguÜrzÜoxÚs|ßtzßx~ÛquÜlpÜppÝwwÚkrÖjqÚhkÑ_jÓcnÔjrÓkxÌjxÔx„Ø~†Ü‹Ú|‡ÚvØz‚Ôw}ÎYhÓVfÖ`j×bkÖ\dÖZcØVcÚ_nãx€êŠí²¬ôÏÅöÙËé¾´Þœ›ÚˆˆØ}€ÖoxÓdpÐ^jÏcpÈ\iÊ^i¾Qa¤>K¢4K¥>L©@J¢=I˜/?|8y8_
6`8c<fBy-Ln(P_LžVrÕŽŒÖ¤£³m€€2V‡?\r$F^<d@\9[:\8q(Dd<Y<a>‹>[²jtÁrs½mn¸hpÇyu΋|эÒ‰zω|Í„yφz̓zÏ„zË€x̓ẃxÈ…ÊƒyË„|Ì„xÌ€sÌ‚xÌ‚vÈ‚|É„vÊ‚{É‚|É‚vȃzÉ€uÇxÇxÀzvÂ~x¾yy»vu¼xy¸vw·ss¶tw¹ptµpy¾~}ÎŽ~Öš€Ü¦‚஄氄洂贅鵇泆贇賅氄粂®CQ©GTªDP¨CT¤@O¢>Ož9Iš5Iš2E–6F‘.C‹%A„:™.C¼FJÓ^WÜqfâ€rçwì–zí~îyï¢xñ¢|ô¢‚ñ¥€óžzñœ}ìnä~jÝm^ÏZS´AJž,D™,B 4H¦<H®=H²CJºFL¾HM¿HLÀGLÀFN¼DTÔ`U΀‡×w€Þ‘ڍÉpyªRm‚4^l3_j+X}8d„@dj'TRDRB^#YZJYN^Wn6h›}®šv°”hžŽhšS€d!Q\NMFh+[u6nf&aO…ŒS”{E}p4ir3k‹X’‹W…›{¬„R}|>tm-]h#RX<\<[<]>\:\;cB\?\;X<P6P
<I	:}8OÍ~r¾RW¿\bÛª›Ø”†Üž‹Û¬ Ü¶ªáıÛÀ¨¦TNž/G¸:JÅJVÏS[Ò[gØfoÛoyÞu|àz}ßz}Þwxáz}à{~ß|~ÞyzÞttÚnrÜrxÜouÜlpÚoxÛq{Üz~Ý}†à‚‹àˆà‰ŽÞ…Ý†Þ‰ŽÖovÒ_iÖ_l×dnÙdmØ\gØWeØXdÛZhâr|荐óɼô×Ìëĺતޛœß‰ŠÞ€„ÙszÙlsÙhnÒ^gÏ[cÇV^ºHT¹FT¯HTµIO­BL 2@~8{ =_9b<f>hFs*Fn$N`PšRkÔŽŽÕ¡¤¶p„2T}2Rp$DeBg@`F[@_;o(A`;V;c@–I_ºpuÁqrºnp¼lmÉ~{щ~шxЊz·~Ë‚zχ~Їy˃|Ë€xÌ€z˃y̆zÌ‚w΀vˁzʁyǁxÊ‚vÉ‚yɁxÌ‚xɃ|È„|È~zÇ{xÉ~uÇ{tÂyvÀxv¾zt½z|¾ttºrs¶rt²mx¸tz‚‚Ó—„Û¦„ᮈ䲅趈귃뵆궆洆泉貇賅籄鲇°DRªBP¦@N§<J =M8Iœ6F–4Fš2E’0CŒ)A„;w8%<µEKÒ`ZÜqdã~nçŠtê’vìšxí yð¢yð¢~ñ¤ñ¤‚ò¤„ñšyêŒpä~fÞmZÐZP²>Gœ.Dš/B¢6G¦8Fª<H´BL·DL¾HMÂJNÁGLÂGM¾ISÁNZÕkg׋ˆÏyƒºXo¯Xo–Iik'Tf"R}:iŠJxp/\^NNETKq8pdTn-fq2n‚I„„NvGxuCr‚Pk/^XDTBPDb Vp1fh&d^"YˆZ’a£ƒPŽ‹U“‚I…yDv…W„j0[M~`F`BZ@X>X;Y9[;Z<aB[BZCWDP>J
@Z@¶opÉe^°FSÌ~†Þ¡Þ¥”Ü«ßµªâóÞÅ®­hX“&>°:GÀHRÈLVÐTYÔbl×blÚlsàv|àz|à|€Þ}ƒâ„ˆä…ˆå„‚ㄈ⁅ßy„Þ|€ÞŠß|€Þƒˆá‡ˆàŠâŽã‘”áŒŽâ–á†ŠàŽÝ„‡×ktÕ]kØckÛjrÜchÚXb×ZhÙYbÛYjáqx劌訪ñÉÂôØÌëĺ⮧⤡ߎß„†Ü‚Ûx|ÚqwÕ`lÓ^fÏ^hÎVZÅPZ¼R^¾PY´JS¤8G„<|=c9h:f>p"Dv,Jn&N\M–NiӍ’ק¨´w„„7]~6Sr(Jb>f=Z<Y7c;f:Z9ZAl C¢We½tvÀqs¼nt¼qrÊ€zÏŠ~ÑŠ{φ~Έ{Љ{Í‚zÌ„xÌ‚zÍ‚xÊ‚yË„{ʃ{̓vÌ‚zʃxÌ„yʁyÉ€wÊ‚xÈ‚{ÉzƁyÄ‚}ÆxÆ|xÄ|tÄ{xÀxtÂyv¾wx¸yz·rv´nr³mpµqtƈ„Öœ‚᫊消鸈까빂븄鶄궂鵂貅貄賁贆賃ªDT©=K¦9J£8Jž<N›6L™2F–-G–1F”/CŠ&<†;€:Ž$>®AKÑ_ZÝqdâ}hçŒvè•|뜀îŸ|ð¢ƒð¢|ò£€ò£~ð¤ð›wêŽsä}fàkZÎYP¯@Iž4Eœ*A¤2D¨9G²=G´@K¹HN½LT¼LP¼KP¿KT¾JX¾Vf¾]w¸^z¨Op®Ri¡Efy-bz?{ˆKQr1_\H_NUJ^MzBzq+f„J‰Ž[–a~@u\Wq5i‡R…f#TI
?ND^Tb[w at q|Aw\ \W V•r¥†²Œan,dt at zyAx—Œºn9_QBX@_B\>]AZ?Y:Z@\D^HZHUGNFPEŒEVÎzk²ETµXfÖœ•Þ Þ¬Ÿß²¢â¾¬àÊ°´o‚!>§.Bº?LÆMSÍQ\ÓV^Ö^dÖfsÛiràuxâw{á~‚ä…懇厌懆勉甊䔑⌋䊈⌊㌌䖓◓㔏㑐⌌䒏⊊ፈÞ||ØjrÙflÜopÛkpÙchÙ\dØ[aÚZfÚYgßov厎騪òÇ»óÖÌíÊÀ䱧ᥝߘ—Þ‰ŠÜ€Ü|€ÚxyÖjsÖdlÔ^hÒY`ÊRbÃRa½L[´HU¦<M†:x>g:h>h>s#Dx&DkEXF’FdÑŽ—Þ¤ Á‚Ž„3Yv/Jp"Fb<g>X<Y9f:b:X8[:|+M­`h½qr½nl¹nsÄww͈~΋Ï†|Ј{ÒˆzÎ…{Í„z̃x΂vÌ‚zȁ{Ë‚{Æ€y̆xÈ„}˃yÉ‚xÇ~uȁxÌ‚yÈ€xÈ~xÄ~vÀ|Ã}yÇ}|Ä{wÀyvÁ{u¾zv»xt¶ss´pr°ovµrtÆŒØ ‚⫇赊꼌컈빇붃鴃굁곂沅贆贂粅괇¦<N¤;K¢:M 8Jœ5Lš4H–5I”.F”.F‘.EŠ"<„;:+C°?GÒ^XÜl`ã|kç‹tê’xìš|ïž~ðžyð |ó¥xò¢~ð¢‚ð˜vêŒpçeÝm\ÎZT±CK0D—-A 1A¦:H®<F²@L·DL¼HMºKT¾JR¼NZÀN_ÀVm¬P|¤L}¼n˜¾w  d¤žw´¨ˆ¸¡v¢„Jye$Ud S_QcXn*_ŠTŒv2jeœŒXŒŒSˆz7wt5r“g™{@pN>J@QFZKe&_ƒJ„•dšz@{l2nl4jwDvŽd Hb¡š¹Žfƒf$Rh&Mh!G`D^B^@]AX=X;ZDWFXHRDNGeD¾xsÃ_Z²JZË‹‘ÜŸŽà¨•ß´¢à¸ªßÁªÄš‡w=&B¬5E¿FRÈLSÑV]ÒW`ÔZbØhsÜgqßprâx~ä}}åæ…„æ‘Žæ‡†æ‰è”Œè˜‘ä”äæŽŒåæ”Žç”ã‘ŽæŽ“ä”“â“âŽŽàƒÞyvÚltÛhoÜntÙfnÚ`bÙYdÖ\fÚY`ÙU^Þfr倅訨ðÁ»óÖËðÍÄæ±ªà¤šàž™ßÜƒ†ÝzzÝtxÚknØdhØbhÒ]fÒW_ÈVcÆS[ºNU¨<L‰#=t<b=h<p Br>z-HoCWFŒ?`ÒŽ”Ü¥œÇˆŽˆ<]r&Fm A[6jB[A\:d=_<[<c@’?X·fk¾vt¾npºntÈ|xЊ„ЍvЊzφ|ψx΄x΃~Ë€vÌ€y˃{Ê„{É‚~ȃzʃzÊ‚zʁxÌ€xÇ€wȃyË~sÈ€{Æ~vÆ~xÃ|w¾|wÂxxÄyuÀyv¼uq¼us¶tr¶st±puµtvÆ‹|Ùž‚ã®‡éµ‰ì¼‰ì¾Šî¼Œí»‡ë¸†ê¶궂괁豄簀鲅鴂絆赌¢:I¢=L¡DQ:L™7J˜6L–5J’3F.C,C…#<:{>Ž(?­>JÐYVÙncâ€oèoì•|ëœzîwïžð ò£zñ¡xò ~ñ™uìŒoæ€iÜlZÊTP¯@Hž0C™,B¡3E¢;J¬;G³>F²>KºCT¿HX¼Qq¾\Œ¹n »x«°}´º‰ºÃ‰­»’¯žy˜Œ^~ƒVvz?ki)Yd!Rf%Tl-`e Ux;n„M„u6n‹_‘‹W€A{ŒX”’b„Fu[HL?R@O:ZJUN_T{Dt‡NŒ‰X’Œ\˜€MŒ~>x˜|¥œ°ˆ\‡n.Xš\}™Hc‹9Pƒ3TR<WB_BY;WAX@VDRCLBNF”RbÐ}p­EW¸XcØ¥£ÜŸ’ß´¢Ü´¨âĮҵ›t/B{:˜(B°:IÁKXÉO[ÐS\ÔYaÖ[b×alÜipßouãy~äxwåƒç„†çŽˆè‘Œç„è–ê™“ç”‹èœ–ê™”æ—’ç”‘åå‘‘è™•æ™“æ—âŒà€€àxyÝruÛkqÞnuÚksÚcj×ZeÚ`iÚU]ÚV`ßbkä}‚袠ïÀ¼ôÕÌðÐÅé¸­à¡˜àš‘á˜ŽÞ‡†ÛxyÞptØjqÚfiÖen×_lÔXdÏXbÌU\ÂQR«DOˆ#BvAb?f@nBt!B~-Hh?U
-Bˆ:WÒŠÜž—È‹Ž’Fan!?e9V2o#CV8_<h<_;\=f? Pa¼qwÂrsºnnÂnn̆|ÒŒ|Ћ}Јz͇{ˈ~̃|ΆyÍ„zÌ…€Î„Ê‚xÇ‚}̇zɃ}Ì‚zʆzǃ{Æ‚xāxÀ|€|Ä|wÄ~|Ä}zÀ|yÀywÂwr¼vw½wsºrt¸rw´rv´rxƈÖœã­Šè¶‡í¼‹ð¾Œî½†ð¼‹î¹ˆë¸…췅괁곂鲄糅궈괅趉鸌ž7Lœ:MBU™7I•4H˜0H”0E”/F,D'?†$>}<w8Œ'>²HRÐ\XÚpbßjçŠoê”|ê›xîyðŸ|ð zò¢|ò¢€ò |ðš{ê‰næ~iÜkZÌYU°@Lš,Cœ*@ 1B 7Gª7H³?N°Dc¸Nt¿h’È„œÊzŽÅšºpŽÁpŽÈu´p‚|:V^!Sb'Zv=ph)X` Rh&Yi&Zh$Wm&Z~G€€B|x;sˆ^—z at zfŸ™nž„Ith*VWGYHT?P?XASEUKd*Yr3ot8l’_“˜kž•k•l6\NARJx2V´u€±huœPc„4UWFYE[>X?VBWDSBSFNF_ J¾}z½ba°P`Ç|†Ü¨“ட߷¨áÁ¬ÜǬ„GL]8<š.B¶<HÉMUÍOTÒT^ÕX^Ø[bÙdnÛilàptâwtâvxä~€ç„„挄蓊锎蕑ꞕ痐葎霕皔蝖曒痑阒皓敌䏊⅃àxyÝsvÝv|ÞpuÜlrÜdoÜ^eÛ^fÜY^Û[dÜbnãw|皘ï¼ôÔÉðÎÆë»°á¡šà’Œá‹‰à‰†ß‚‚áutÜirÚbhÙ_n×ZiÕ\iÒ\hÌTZÄRY­?O‚DuBa>l Bt$Ds"C€0Hd>YG|-RЊÛœšÌˆ¢\sm"AcCY8k>\;b<d<\8^;x)G¬[d¿vuÂqp¾mnÄvtц{Ѝ~Ћ~ψ}ΈyÊ„|̆y͈zÊ‚zʁ~È‚zÈ‚~Ê„zÇ€{È€{ɈȃyʁuÄ|xÆ~xÄ~xÁ}wÀ~xÆ~{À|xÄzuÁzxºvw»tt¹sv·pp´qvµptÂ{Öš~à¬‚èµˆê¹ˆî¼‹î¼„í»‰íº†í¹„ì¹†ì·ƒé¶ƒê´‡è³èµ„ë·Šê·Žé¸è»“™6K˜5N˜:P–6L“0G”,D•6N-F*C‰&?„'D{=x<‹'C­CMÍ\ZÙthß~lçrì•xëš}îœ{ïŸyðœzð zð¦€ð¢~ð–zêŒqä€iÜn`ËXQª>Hœ/C˜,Až0B¤6G«9L¶ET·atÂhtÇ\bÄQ^ÁXkµdˆ¬aŠ°eLx†6hk$\m)a|:nv7hg#Ug'Yb Rf']j)b|?xu<ru7p‹Z—ŒX”–u«–l–’f‘aQXG]J\DZCWBYCVBUFYNl/Xx?v_Jh-H„CWT<D>[D‹<\¶ot·nu P_v*N\DTAY>Y@V@V@SBNDRIŽM`ÌzpµT]¸\dӝŸÞ¢â´¢àº¤â̲¥zhO9g9‚<¢:J»DLÆQVÐUXÒV\ÔY`×^`Û_gÜfnàpxâorâyvä~~胂挈鏊蔌ꖍ꜔ꜘ隒階雔蘐皏盏꜒薌玆懄ã€|â~|ßuxÞqsÞnsÞlrÜglÚ^aØ^dÙ[dØXbÛ`iãwæ™™ïÀ¶ôÒÊïÔÊëÀ´ä¢™Þ“ŠÞŒ‡ß‡„á‚‚ßwyÛkrÚepÚ`kÙZhÖZjÒZdÍX[ÄRW¬@M|?v@^Ao?nCu'Fƒ3Nd?VDy*NΆŒÔ”™Ì„„´sl=`8Z
4`6^7e:b<Y7[=…5Q¶djÄsrÂsqÀnpÈzvЊÒŽЉ~Љ}ψ}͇}̇~ψzÌ„zȃ|Ë„ˆ~ɁzÈ‚|Ë‚zÊ‚xȁzɁvÆ€|ÄxÃ}xÃ}wwÀ|{ÀzyÀ}z¾||¾xt·tv¶tx®nt²qu½xvÔ”âª€ç³…ë¸†í¹ƒíº‡îº„ì»…î¼…ì¹ì»ˆì¸긁굀綇跍뺐꽖êÀ–êÁœ–4J”3I’0H’0H0FŽ)C”.E‘/G‹*F†(D‚"=x;t?‡ @¯@HÎ^XÜndâ~mæŽpê–yîœ|î›zîž}ðŸ{ð¥~î }ðž|ï˜}êŒræzdßl_ËTS°DIž/D–*@š6G¥5H«=J±GV´MY¹HU¼MV¾N\ÃVeÂd|©Po•Fh>mˆH|‚>uƒAt~?rr1]s)ZiN_Vp-g‚H…WŒ_ \r6n—k¦™v¢‘bk)Xi1]n1f\I_HZ@Y@XDXCXB[HXIWEr.Rv:ncCˆ6IX<H<T<–E\´ep¼qwžRf”Lf^AUAT=T>R;XCN=J@j&JÀ}|¾ef¹TdÉ€ˆâ²¥á°Ÿß°œà¿§Â¡ŒX<Z<p<„!@¦8IÀGRÉRXÐR[ÒW^ÔV]ÕWZÚ_eÝikÞksãtsâyzãzyä~}凂针閎阉윓ꛓꞙꡚ蜒蚒界蚋ꕏ甈率åˆâ„}àywàtvàtvßttÞpqÜjnÚbgÙ`dÚVaØ^bÜ`gãwzçí¾¶ôÖÎñØÎëø⠚ޒ‹Þˆˆß††ß„€ßxyÜqvÚkqÜ`lÚ^m×ZfÖ\aÑY[ÆMR¦8Iu?tA[=p?hBv$@Š9Nc@YAt IȁˆÖ”˜Àox¼…Œp?\:W7^:n"Be<`8]<d:–EV¾mmÈynÅtpÀpqÍ„{ÑŽ~Ӑ~ÍŠxψxÌ„ẇzˈÌˆzÊ„zË€xÊ‚~É‚zÉ€zÉ€zÊyËzÇ~yŁ|€|Ç€xÈ|xÄ}xÅ|yÀ~¾||Àzv¼z|ºuv¶rq³puµlr¹rt̍€Þ¤€è±ƒë¸†î¸ƒí¸~ì¹„í¸„ì¹‚íº„ìºƒì·„ë¹†ê¹†è·ŠêºŠê»ì¿–ëÀ–ìœꠔ2J0I1J‘.HŽ.FŽ,D*D‰*Bˆ+D†)B~#@x Aw@ˆ#@²?HÍ\XÙmdã{kæpè’vêš}îœyì ~î |ïŸ~ðŸ|ò€ï—}éŠpæxfßl^ËZU¯@Jš0F”.Dž4F¢8K¨@P¬@N°LW·KV¹LU¿N]ÆS]Ä_nž=`Š<jx4my6o…I‚ˆMˆy0`“Lz}1bdVr-h‡N„†^Žc*\\^zCš~±†Q†‚VŠd*cl8go2\`JV?Z@[A^J^FZE]FZFX@d&HZD_@ˆ8Mb:F9T?“CY±bq¸eu´€‚R^\BQ7P<R;O6U>K;K	8˜M]Étj·P]º\fÚ°®â°˜â¶§Ý´ ÖÀ§r9FM>Z@l>Š'B©<J¿KRÊNVÏRYÔXbØ[`×\cÙ`iÜ_cÞfkáqpârrârrä{y元鍆菅ꔎ옐霖윔ꡒ顕薍瓊疌蓊蔅戀äƒ|â}zàxvßqràoqßtsÜlmÛfjÚ`cÖY]ØY`Ù_gÛblàpwå’’í¸®óÐËñÖÊìȽ࢘ސŠàŒ‹ß‰‡ß~ÞyxÛrtÜkrÝ`pÚ`qÖ[dÔ]bÏZ\ÀJPž2Fx@n@]<oAdBz#D‹9N`:X	<sFÆ€ŠÖ“—ÂqzÊŒ†z&HZ8^=\:r&Dc:`<^6o>£PZÀnjÅspÂqnÇxvЈ{Ґ€ÓŒ{Έzχu˃y·{Ì…|Ì…yˆ~Í‚zÊ€xÈv́xÈ‚xƁzÄ~|Æ~zȁwÁ}yÇ€vÆ~uÂ}zÄzvÅ~w¾{{¼x{¼xx¼ut·rq±mp²hnÅ€yØœ{æ¯츄ðºƒí·„í·‚î¶„ì¹€íº‚ì¹„ì¹†í¹‰êºŠë»‹ì¿”ëÀ’íÅœìÄžéÅ ëÄ¢’2J2JŒ,F‹*CŠ(B‹*Eˆ'D†(C„'E„$@}>w?u:ˆ%C¯:DÏ\WÙojà~låˆxë”{ê–vì›{êŸ{ë›xïœ|îœ|ïšxð•zê‰oç~hàk\Í\X²AJš,A”.D›2DŸ8L¤9J¬ET²FRºFP¾GNÂMSÄMV¿P`Ž*Z‚=|™dœ˜n¤‘av/cŒ<l¡Rz4iz4jX„P}^(UVP][j.g‰j™a¢€Lzx?xc'Pe'U]HUDZ@dJ\E]FZ@ZFZEZEZ F^IX@y,Bj=J
-;t FœDY¬^pžJlȉÀwv‚7TL6N<L
;L
-5N:K9fBÀxj»^^·TbÆw}ß´¥à³¤â¼¬ÜȲžpmODSCdCo?ˆ#?ª:H¾GPÌTWÍRXÑSZØ\dÚ`fÚ^dÜafßioãnrânpâtuäzxå{vè€x艂ꌃ쓊Ꚑ꜒ꚓ顏阐镎藊璈捂åˆ|æ„uá{wßmpÝmpÜhlÞppÛhkÛfeØ]cÔUTÔ\aÙ\cÚdmÞt{䉌쭨óÎÆñ×ÍîËÀᣚޑ†àˆÞ„‚Þ‚Ýz~ÚrwÛmqÚdmØ^jØZgÓZbÌV]½LT‘+EzBa=a=i;d>{"B‰8Nb8Z
-=jEÄ‚†ÙœšÄv}̍…Š?ZT:X
-6Z:t*Dd>]>b@€*F²adÅtkÆtnÂppʈ„Õ™ŒÓ“‚ÓŒyωzΈ|χy·zˉ|̃xÊ„}ˁxÌ‚xÇ‚yÇ€wÅ~zÉ}|Å|zÃ{Ä€}Á|vÄ}wÂ~vÀyuÁ|xÀyw¼zw¼xuºtw¶op¶np´ko»tuÔ‘{⪂괂ﺂì¹î·‚ìº€ì¹ƒìºƒì¹‡í¼‰ëÀìÁ‘íÄ™ìÅœîÆœìÆ›êÆžêÅ¢Š-G‹,H‡.L‡,G†/Hˆ.H‡.I†(G~%D€&Cx>t:q:Š">¯:FÍ[[Ùroà|lå†té‘xê”|ì›xìšyë˜xí›|îœzíœxí•ué‹wç|dàlZÎZS¬?M˜*B’,I›3J¢>T©Hi¨?N°CN´FO¹JQÁJSÁK`°M{’J¥‡¶ŸyšX|w1f;ošU…ˆGzs-_]“‚Nzc%Y^&\e&^d&bXWqBt’v¨|Cv†UŽ\Pf'RgO]J`Dj$MYBXAY@V=ZBWC\#F€PvX;^5o =R>\=—CZ¢Zvš>a®PQÖ—Šºxyx2QO>H8J9N7Y=DPËre¶JR¾ZaÖ¤¤à±£å¾®äʶƫ”XBJ:UBlCr:‰#D¤8I»FRËNUÐUXÔX^×Y^Ú]cÜ_aÞgkághânpâtvåtwåzxäzv䀀戂猄ꐍꗏ閎Ꙏ뚌ꗒ萈ꒆꐃ猄æ‡{ä|âxtàsqÝknÚgnÝhjÜijÙbdÙZYÔVa×VYØ\cÚ`làruよꜝñÈÁòØÎðÍÀᥠލƒàˆƒÞ†ƒÛ||ÞuxÜzÚmtØfpØ_lÕ^iÒZ]ÈV\·DNŠ&Bp>X=e@i<iCx)Bˆ8L]8V
-?a>»x€Øš˜Æw‚Ë„‚ Vl^ER9V:n$@eD[@h>“8N¼ihÂsjÃqnÀopÍ„~Õš†Ô•‚ÒˆxÒˆ{Їz͇y͆}Ì„y̆xÍ‚xˆ}Ê€tÉyÉ€|Ä~{Å~zÆxÄ{Ä}zÃ|wÁ{tÁyvÂ|xÅ{xÂ|x½{y¼xx¸sp¶pt´mp´oṗxÞ¢é°†í¸ƒï»ƒïº‚ﶁî¸îµ}íµì¸…í¸ƒìºˆì¼ìÀ‘ëÄ—ìÆ›ìÇžìƝîÆžíÅžìÄžêߍ-Hˆ/J†-L†,J‡*H‡.L†1O„'G~(H|'Hv Bo>l=„ =­>KÍYVÚpjá~mç†oé”têš|ìšyê˜{é—zì›|ìœxðxïnê…næxdàm]ÐYP«?L–,B'C–.L¦Jb¶iŠ¬@S®>N·GT¸F\ºTyÀq µ‡¨¦w’ƒLfn*XdUƒ>s¨qššT†s2dg˜€JqZOZQzH…l,fq0p_ a‚Yššz°‰P‡”qh(Z`!Nd"Pb"RcGl(QXBWDT<T>YET
>^"Hr5LhCkAn<`@vKHc­r‚¸`dŽ)G°QUÒŒv¼|}`?J;P:R
=^;¶ji½a_´LXÃnt⿵㾳æIJàʳCJI9M<^>{%Ds='B¤5F¹AOÆJSÌPVÔX^Ø[`Ù[`Ý_`Übdàjnágoârtäxzåxxä~~æ}{悀狄쎅ꘊ딍떎ꕌ閌鎉钉錆芁å†zä|táxtßkiÚbhÙcgØbeØhjØ`dÕX^ÕX[ÕT[ØY^Ûckàjsည霝ñļóÖÊñÒÄ㪧݇‚à†‚Ý„‚Ü~ÝsxÜszÛhrÛfmÖ`hÕ^hÑ\dÈTZ®@N‚ AdBX@h@jDnA|*DŠ:NY6T:a
<´lvÖ’‘Èt}Ã~«^nj"FP:\<k>`BXBj< P`ÂohÆtlÃrnÅxpЍ~ԍzӐ{ÒŠwЉxÏŠuÏ…{Ì…zʈzÌ„xÊ‚}Ɂ{Ê€vÊ€wÈ€wÄ€|Ä}tÆ}vÃ|xÅ~zÃ{vÁ{uÀ|ÀzvÀxwÀ|w¼wyºuu¹tu´no°opÀ{sÖ–u䬂췂ﺀï¹}︁î¶}í¸î¶î·í¸‚캃뽎íÀ”îÄ–íÇ›îÊ¥íÊ£íÈ îƝìÚêÄžë Ž5Jˆ-Jˆ.Jˆ.Lˆ0L„0L,J€+J|'G{$Ev@l;l8„&D°CKÌZXØnhß|läˆrèŽyꖁì˜yê˜xé–zìŸîž|ðžwïqêˆnåyfÞk]ÎVV®@M–(B‘*G“'H«Pb°h‹ =X¬:Z¶Qx¿u£Å§»y¹l€Œ:bTBaUw2m¢e•º ŽEvˆ\yBj]SXVZ$]…^˜l<qi,th4n˜†»”qŸ‘\™„Z€€E|_JeOf.Vc Lj"NX@Q;O<O<SBX?r$C9Qˆ.Cˆ1Kf=€.Q4]œW~͐Í†–7Rw"F½`\̃j{(LF4J
-9H<~8NÆxo¶U^´VaÔššæÀ¯æųâȱ¯ƒnO:N:N
-;c@‚*Fs;‹<¦2E·@LÂJRËNVÒT\×]`×[`Ú`dÛ`dàcfàlnânoässäxxã~~å|惂ç‚}鈁玊ꔋꋄ蒉ꔊ鑇蒉鍂舀æ‡|â€yàxrÝhfÙabØbhØbfÙ`cØ^`Ö\`ÔRVÕRXÕX\Ù\fÜcoà‚‰éœ ð·óÓÉòÖÉè·´Þ‹ƒßŒ‰ß€}à{~ársÜpyÙjrØbjÖ`hÖ_hÒX\ÆSU¤5JxBZ=VAfDt$DmA€)A;R^8T>_Bª_lÑ“’Às~Æ„‡°gxn(HK
-7b>e@^=X>w*J­YaÄujÇrkÄpoÈ|uяzÔŽzÔŽxÕŽ}ÒˆvÒŠyψz̈wΆz̆|΄{Ë„zÈ‚|Ç€}Æ‚|Æ~yÆxÄ~xÀ~|Ä}xÃzu¿zwÂ}wÀxu¿vu¾zw»uw»vx´su¶knºpr΋uà§{è¶íº‚ð»€îºð·|ï¶zî·~î·|ì·z뼃íîÆ–îÇœïË îÌ¡îË¢ìÉ ìƘë–éšê0JŒ1L‰/K†0N†5P…/N„1P‚(Hz"Fy#FsBl<h:€$B¬9FÌZZØofàziæ‡tê’yë–|ê˜zê–yë–yì™vîœ|ïœsî‘pèˆoçyeÜn^ÍXS­9H•)?‘*C”&F©>QÀwŠ«P³TwƆ¢ÅrŠ®Sx®d±f{&XbTz,e a¤l–ŠBjŒS‚z>ie#Z`"`\ Zt@€{H„ežq6u|T’‘qª‡Y•o¬u>l˜r¦d#Pd$Rd)P`Ff NV=P8M8H7V>jH=N«Zg:K‚&@b@7[’Hw¸qƒâ£˜ß¥‘®WdYD’7F¬jpkBC4@4S:²ii¾ib²Xd¾dhݯ¨åÁ°ãƮģŽZ4K
-6P8N
-6i!A†0Hx:Œ!;¡1D¹DNÇFNÌOYÒX_ÖZbØ]`Û[cÜ]`àdjàdjàlqârxæwzå|~æ{vç~憃æ}熀掇捈萄ꎂ萈莄舁è†å‚wä{tßvvÜihÚdd×^dØ_dÙadÔ[cÕY]ÓTZÒSZÔVZ×X`Üjmá~„蘒ﴮòÑÆôÛÎìźۂ{ß„Ý|ÝzzÞttÚpvÚmtØbo×]jÖ^fÐZ\¾HR›/Iq@T@Y@`Av"Cs'Gƒ-G<L]6P	:^@£Ndя‘‚ŽÈ…ˆ´pwm%HH3`:]=[<Z:Š5P¸fhÇvoÈqlÂpnÍ„{ÔŒ{ÒŒxÒŽxшwчvÎ…xÏ„vÏ…x·yΆxÊ‚xÈ„zʃ{È‚xÆ‚zÄzÄ€zÁ€}āzÄ~x¿}yÁ|vÂ|v¿yv½vs»vt¹ww¸qr±pq¶lpÇ|tÚ˜|æ°~ì¸‚í¼ƒð¹‚î¸|í¶î¶}í¶„í¸íº…ì¿Žî—îƘîÈ™ðÊ îË¢îË îÌ¢ìÇŸíÆ¡êÃœêÝìàŽ1J‹1JŠ2J„-H„.L‚+K‚+H€(Fz&Dz @s=l;c7<ª<HÌ]ZØlbà~læ‰ré“ê”|ì—}ë˜|ë–wí˜vîœzî›xï”sêŠnèzfÝl\ÍWO¬<G’+@’(B’'Bš1L¹R_Æx„ºk‹´Z€§Lt§Rz¶_}°Zw‰/ep \Aj¨hŠOp9k€Kzv<l|T`!Yn4sIˆv at vŠhžj(eƒaœ‡^š‰\’žˆº{<q‘ršf#PYCZDb!Kc HX>S8T>O:n FfP|*E©QY >PwB2`Fi¬^r³FUØžáªš½nr^<s:…8JO5D2D6v*CÄugºTXºXcË„äÁ´æÆ°Õ¾©p1BJ:R
9O
-9P=j<’9Rz:$> .B¶?KÈHLÊNVÔ\`ÖT\×Z_Ú\bÛbdÞdißdmàjmärväpqãzzävwå}ç…|æ€}æ|èƒ~æ†|挄艁猄刀芁抁å‚|âyvßpoÚhf×b`Ö^cÖ]dÖ]`Õ[bÔV\ÐSYÒRXÔTZÖXcÛflày~挍쪨óÒÉöÞÒðÍÀÛ‰†Þ‡„Ú~|Ü{zÞsrÜrwÜhpØen×_kÔ\aËTW³FP-I^AV@`G_<v#Ev$Dƒ.E‡6K`
3R5]@™DZÑŠ‹Ì‹’É~€¶v{s+KI6b@T:[?c@˜EV¿nlÈtmÈpjÄtpÑ„yÕŽzÒŒxҍwÒŠ{цtÐ{pφt·vΆtÌ„yË…{Ê‚wÌ„yÉ…{ɁzÄ~xÆ€xÄ‚}ÀxÆ|xÃ~zÂ|vÂyv½wuºvu¾zx½tt¶st²nrºrrÒŠxá§~ê´}ðºƒîºð¸‚î·î¸~칆켈îÓïÈ™ïɝìʝîÊœîËžîÉ¢îË ìÈ¡ìÈ¡íÆžëÄŸíÆ¥’0J2L4Jˆ,Lƒ0N‚(H„+H,J|'Dt=m;i9c9~7«9EËXZÙlaâ}måˆxç‘zé”yí™}íšxíœ}îšyîœyñšwï•sé‰lè~bßm[ÐTK­;H–*@“(@“+B˜1F¢?N®E\µPj®Y‡¥c“§c–¶gŽ¹d„‡6fdR|9p’T…>qF€>x~F„c!Yt:xzB‚r3pŠh¢O‚p4t~Z—zC€fš¢·x4prJrg*\N<RAV@`E]?X>U?TA`El4d€>b6R‘8S†*Q²w~¶a`µSX+GŒ9B­h_’JW^:W4dDN5K9R8 S[Æl^ºWb¿clÞµ®èÆ®ÞĤ][K7P<S9S
-:R9n(F–AT€;Œ(@§2C³<IÂGLÌPUÐSZÔZ`Ú]`Ü\aÜ_dÞahàeiàjnälqãqvâutäwwäwuäzwæ~yå~{å|{僁戁犁æ…å…€è†~ä€{â|uàrrÜmnØddÒZ\ÑY]ÔVZ×^bØdjÖU^ÖT\ÓV[ÑNV×ZbÚclàx}抌좞òÐÆöàÔñÏ¿Þ’ŠÝ‚~ÚÞy|ÞxyÚqyÙgoÖfnÔ^gÓ]cÃUZ§>L~AT<SB_>cCw(Gx'D„+Aƒ/Dd:Q4Y
;“9T̆‡ÍÈ||¼xx€8UV;\>R9Z<v&I¢S\ÃtoÉtlÆqmÊvlÒŠ~ҍzÒŠuЋxЇz͈x΂sÎ…t˃t΄vÌ‚ẋ|Ljzʆ€Ç‚wÇ€xÇ‚vāxÆ‚xzÆ|tÂ~y¾}xÂ}x¾{v¼usºzvºss¸mo´mrÅ~vÛŸ|氄ñ¼ïºð¸|ï¶î¶~ï¸ƒì¸„í¾ŒíÐîÆœðÊžîÌžîʝîÈ›îÉžíÈœìÈ¢ìÉ¡íɤìɦíÆ£íÇ¡’2OŽ2K‹0IŒ0JŠ.J‡0J‡0I‚.K| Bw@r<g:`5y8¨8DÊXSÙj\à{måˆxêzꕁí˜zí›|í™î›zðŸyò~ð•wëkç~bânZÐVP°@K”,D&B’,Eœ2G¤;T©Hj¶\|´Tt§Ot¸`}·f¦Xr'Yt*^‚@q}4j|:nŽWŽ‚Ho0et:u|D}n.rn2iq¢c%[e'_~X˜p3s‹gš£‘·€>~d0T‚P†N?SA[FU>^FdF\ET?Y
=e"F7as&H…/TŸG\Æwt¾HOž3Fy H‹Oi†C_aEP5W;]@F2Z<ŒBU»d_¶QV»ZaÍ‚„äÀ¨Òš~¼†{Y9J5K5V
8U8T9s*EšJ^:”%<£/B²;HÀENÊOSÌRZÔW]×[\Ú]`Û`bÜdfÝ^fàekâlqäqvãsråxyãxxâxväxzã{z偀æ‚|僂艂æ„~戅èƒ}â€zàxtÞssÛpn×`bÐRYÍNVØY`Ù`fÜdfÙ]`ØX_ÔW\ÓTZÖ^cÛdlàrw犐ꞙòËÄöáÖòÓ¾Þ—’ÜvrÜvuÞxxÞzzÛnpÖhnÖbjÒ[cÎZ^»T\›:Nd>Q>UB`A]@v"C}*Eƒ.G~(>j<U4\
<…-NÁ|†Î•Æ|€Å€˜Qf\<T:L:U9…2M³_bËxmÌwkÆsmÊ{vҐ|ҍzÑŠ|ψzΆx̆{ΆxÌ‚tË„tÌ‚yÌ~tʁtÊ‚{É‚{Ê‚uɁyÆ‚yÂ~ƁxŁvÅxÈ}rÂ}xÁzvÂxw¿vs½us¸pq¸mq·suЍx⩁뷂ñ¼„ñº‚ð¹~ðº€î¸|ðÃŽðÆ—ðË ðʝïʝïÊ™îƘíƘìÈœìÈ¢ìÉ¢ìÊ¢ìÉ¢íÉ¥ìȨ“4I1JŽ2K.L‰0HŠ/Jˆ,E‚&B~=w;t:f6`
-2{7¨6BÊWTÙi]à}oèŠpê‘xë–yîš~ì˜~îšzîšyð~ñ |ò•víŒtæ~fßl[ÐWR¯AJ*AŒ"?–-L¥@^²\„¾d†¶Tm³G^ªMmµRq¹Ri™<ht%]-b†Asv,fƒI}–fšz7js6nt6ln-nc"a„]‘†XˆURh-nŽl¤q1s…_™žˆ¬ŽUŽ^ NŒf•WDQAZLb!Sl/X_CT9J	7^Bn&I~7a—O_™Slœ<TÆnYÈ„s¯dlBX‡=Po'FV:N7X>K
-;Q>œh¼u|·fm¦P\ŸPfÀ|wʈ|À‹Œ°xn%JS
8O6Z8W6W@u*BK]%<&=ž0C­:FÄKQÊORÑTZÔY]ÖYZÙX\Ú_bÞ`eággáhnánqämnáoqåxsãxväuuåzvã{zæ}~å~xä‚~ç|æ„~æ„~惀â|{àvsÞmlØmlÑSYÈFRÐQYÚ_eÜgiÜelÝgmÜhnØ`g×X]ÖY_ÙblÞlp芊ôÈ»ùáÓóÓ¿ß•ØtsÜuqÞvwÞtw×lr×djÔ^fÑ]cÈW^³N]…&CY@V@Z?aB\A{%B.H€+E€+Bf;T3[;r>»v~Í“•Ê…‡Ì„}¤\mg=R;K
9X<•GZ¼ikÏ{qËzpÊtlÏ€tҍzщw͈zÎ…xÍ…{Í…tÌ‚vʁvȁx̆wÊ€sɁũwÊ‚wÈ‚{ȇ|Æ‚xÄ‚~Ç€vǁwÄzÁ~vÀ…~Ã|v¾wv½vr¼rq³ll¶npÄzwÙ˜z鲂ò¾‚ðº€ð¸ð¸|ð¹€î¸‚(ïÀŽðÄ•ðȝîÊšîÊ îÈ™îÈ–îÅ”ìÆ›ìÇžìÈ êÈ¥ì̧ëʨêÈ¥ìȨ”6N’9O’2L1H‹0H‹.F‡,F†(@‚%@};v;f8`4|9¦<HÍXVÚjaázmæ‹vê’|ë–~ì˜|ë›}횀ï{îž|òzñ–tìŒpædàmZÐVR²<J“,K”-V¦Fq»f‹Áe{´KZ°EZ¶IV®Pq¸Sr¹Pk‹8hz,`i'T†Ay‚;y”b“ŽZ‰z2hx;nh,^o3pZ Ut¥t;nPQe*bŽp£x8€vH{ ®“b–\Q|Y€j'^[Ll+[g%PX<^<l$IN
-4U=iH…6Nªj_ KMf=q%K’@T¥Sin"DT:P3K
-2R4T9D:‚LfΔ‹Ø‡Ï‰Ä†‚·w„¸~ˆÌ§šÒœ…žKP[
-4O5R9\7T
7U<u.H Na’0CŒ!< 2E¶>HÃJSÌPWÑX^ÕSZÖ]bÚY^Ü\bÞ`càacàhlâlnâmpàmpãppäwvãwtäxuä€|ä~{ä€zä€yæz允ã‚å‚~â~|ÞvoÞrwØpoÐV]ÉDMÔR[ÜchÞjkÞejßjjÞkjÞjmØZ\ÔQXØWXßlo熀ó¿°÷Ô»òζۏ‡ÚtqÜwuÛuxÝnrØipØdiÓ\eÑY`ÆX]¤BPfDR<T>X<_?a?u$A{)G~+D~&Be:Z6^=f?´mxÒ”“Í…ŠÇ}~¨bln$CS:H8Z<ŸPbÄrkÓyhÏyhÇsoÒ‡zÒŒxÎŒ}Έ}ψzψ|ΆwÌ‚vË‚yÊ‚uÈ‚wʁvÊ‚sǁxÈ€xÅ~yÆuă€Å~zÇ€vÆ‚xÄ~vÃ|tÂ|uÀ|xÀzyºss»sq´kq¼otΈxߢ|춁ð»„ò»~ð»‚ð¹zð¸…﹂jïÑðÈ—ðÉžïÈšîÉ›íÈšîÆšìÆ™ëÈšìǝíÊ¢ëÊ¥ëɧìË¥êʦëƧ–=N’4K1H7L‹0F‹3H‡*B‡(A‚$?€ ;z ?k7e6†"@©?JÍZVØj_àzlæŠré‘zê–zë–zꘀë–{ï™zîž|òŸyð—xìyämÞj[ÏZY´FX¢?a§Ol«Pj®HW¦?R©>P°AS¶DX°Tu¼Xt­Pv†6gq&Zf&[ŠC|‹N†Ž\ŒŒM}8ll-cXNh(f~T‘Œen.eXXUTˆb˜€C‡p3qœ¤¢°`ZvPsŽb‘SD`EZBY@g=‚4PN
-9L<WAl-TcFX8R<^FCf—Rh0LV8N8N5X:G8D3®„ŠÐ”’ØšŒ×•Úœà¤˜ß¨“Ö Š¦[al:P
-6P
-4T6_5Y=X
-:x.JœL\’.D’#:¨4C¸<DÆKRÊOVÓWVÖY^ØZ_ÚW_Ü[dÞ^hàbfáklâflânrâkpärtävvãuwäuvâtwäz{ä~xã{}ä|æ~å‚|ä€zá~{ßvrÝrtÚmlÑT_ËFP×W`ÞccÝa^Ù^WÔVN×abÚ`]×\bÓP[ØOTÜagävs옍︨ô®콬րvÚuuÜuuÜruÜprØmtÓirÒ_aÊ[[»QX‚&FX?V@RAXE`Ff@v@‚/Hv"?&Ab5b;\:Z
>¦_pГ”Î’“Ãxz¨dpt$FU<H
9gA¨W`ÊzpÐ|fÍunÈztÓ‹~э|΋|͈}̆vÍ„z̆xË„xÊ€vʆuÌ„zȃzÈ‚xdžyÆ„zÄ„~Æ€yÂvÈ„xÈwÆ€wÃ~wÁ~xÂ|w¾wx¼wv¾tp¸pr´mr¿tqÖ•€äª„î·|ð¼‡ñºð¸~ð¶~ð¶ðº‚ð¾ˆïÐïÄ”ðƘïÆ™íÈœîÇ îÆœìÉŸìÈŸëÈŸìȤëȤë̪ë˧ë˦êɨëȧ’2J’5L’/G‘0J/HŽ,CŽ-Eˆ*B„"?~!?{?t<n8Ž&A°ENÏ\]Úoià{læŠuéxê’|ë˜{ê˜~ì˜}îš~ðž~óœ~ò˜xìŽpç|dÞnbÐ\_´Jbž<\*L“,Hš3K¤9J«=P°DU¶DV´Mj¸UxŸPwˆ5a„*`v,b‡D}„D|›l”˜V†}6hi(`J
-Ej6l Š¶†Hj)]l/qVVW…N~>Š—v ² Âv3uh5]ž~§ZGXGZDu-Tj"@€4NN4M;N<Z@g#Od![^M h‚¨w–c;P
-6Q8R<V9M7E<\DȤ–Ö¡˜Ý¯Û¦›Þ®¤Ú¬œËž”UVb9S4Q1T
-4X5b=Z
8[;t+EœK]”5Nœ)>®8D´=HÅJLÊPQÓSTÖRT×WYÚZ\ÛZXÝ^aàfhàdhâfjâlpâlnæwsäqråvxäxuâ{xãyuäz|ä}zä€~ä€{ä‚zä€{â‚€àysàsrÛljÓblÐPYÜ^^ßbXÏWQˆ6t6š%9½>BÄCEÐRRÖTW×VZÞbdèŠ‡î¬¡ï»­à˜‰Ú}zÛvxÜuvÜttÜnrÙhoÕ^hÒ\`ÆZ^¦APe?T?WBT@ZGcFi>}%C…0Dt>(De8f8\
:X
-<œVpÓŒŒÎ’”Ânqµnvz0MS>VB|,J¸dgÌ~oÒ|nÌyjÊvÓŒ|Ò‹|Ήz͇|̇|̈{Ì„yȁwÈ‚xÈ‚{Ì€vÌ€vÉ‚xÈ€zÈ‚xÆ}wÄ{zÃ~z‚|Ç~tÂ|tÂzrÃ{sÂ}t»yx¾yx¼rpµpt²kpÈ}tÜ™~鯁ñ·ñ¼ò»~ð¹~ﻀñ¹ð½…ððÆ•ïǘðÇ—îÅ™ìÆžîÇœìÈžíË ìÊ¡ìʤì̤ì̧ê˧ëÍ©ë˦ìÉ¥êÈ©“0J’0I‘/G-G.F‘.G’1GŠ)B†#>€"?€$>y:{;—/DºNVÒbaÝtlà~tæˆvévé–€ê˜|ì˜zíš~î™yï|ò}ï”{ìqç~hÞn`Ð]d¶FT—.G%A•.E5E¢:J«>M´BM¸DS¶Md§Qy˜?h…1\•6gz0d„Bx†H{±p‰”Iwv1hVHLM\’•m”l&`j2f|@‚Z'\vH}„Q~B’j ªš¶ŒOŒ`%S›„¬\KTDW?y5Nt$Du(Da?L
-7J8L
<T@n-^z1j¬wŒ®dldDV<YB^@R9E
-;F9ˆRiˏ„×–‹à¯˜ß®Ÿá·©Ú¶¨¨hnV2R
-4T4S5V7]:c:_;Z
-9w*H¢Wdš9P¤+=°=JºAHÅFLÎMNÎSVÖRUØVXÛZ]Ü[`Ü\`àbdàdhájnápsãopåpoâxvävtåtvâuyäwwä~{ä€|æ€|ä{å€yä€}ã‚€àytâvqÞspÛflÓQZÖWZÜ\ZÉQV¨7P™.K°BT¶CR°7J¯6DÈHKÑRWÛ\\ávtè¢˜è¬ŸàŠÞ‰ƒÜuwÜsvÚpuÙknÖinÒcjÒ`bÃVZ…(H\BVCYCTC`C`@mA‚(B‚(Du'A‚)Af8f7d:T;@ZЍ†Ï”’µgnºz€€2NQ:o F“;PÂniÐ}oÔykËvg΁vÔ‰|Њ{ΈzË…yÉ„wÊ„|É‚yË‚vÈ‚zÆ€zÊ€xÈ€xÉ„|ǁ}È€vÆ€zÈwÃ~vÂ}xÆ{sÃ{tÆ}vÄsÀ{wÁxt¾xw¸ru¸pr¸psÑ„wá¢}í³|ñº‚ð¼ò»}ñ»ïº„ñ¼†ð¿ŽïÆ”ñǘïÇœïÉ›îǝìÈ¢îȤíʤìË¢íͧí̦í̦į̀ìͨíͪìˤëÈ£ìÉ¥/F‘5K’.F“-F’,D“.D‘*BŒ'A†&A†(B„&A‚$>‡#@¡7IÀSZÐhhÜyoá€rç‹uè‘zꕁë˜|ê”zì™ïœ}ðž€òñ˜{ìŽuèkák[Ò[Wµ@Hš.F’&B—2Iž9K¦<M¯BL³DPºJZ¸Mn°X~Ÿ>fŽ=fŠ3c{6g€>pw1g…Cnv1bj'`M
Jq@{™w „P„i$`uF||G\ZxJ}‹`™yG|aœ›~¡Ÿv­l,dœ†¢j*YF
-8K8^>aAYg®e`f>LAH<J>O@†T‘b€jFR
:f Hf@j Ha Fl%F‚6Z©^d¿qtЄzØŽ€ß™„ߦŒ½yr)BP
-8W	:Z<Y=]<_5c:[:\B|.J£Zh¡:Oœ*=´?JÂCHÌNQÎKPÔTY×UYÙTXÙZ\Û[`Ü]_àbhàbjâiiâmpâpráooãtsâuráooäxxãw{äzxä{xåzwæ€|äƒ|ãyäƒ~á}váusÞvtÝpsÔ]gÓRZÙUZØYZÚ[\Ø[^Ø^dÛ\[ÐPWÃKWÃFQÌR`ÖYhÜ|ˆæ©¢äŸ‘␄ބ}Û{|ÛtyØnrÙipÓfpÔ^fË`d®FUiBZBYDWEQBbEbBo B…,Dƒ.Hv&B‚,Be5i8h<S=|-Nʈ‰Ò”‘¹px¾~~ˆ@WT?n#E§OZÊwmÑ|iÑ|iÊ{tÏ„zÒŒ|΋|Ίy͇v͆wʃwÌ‚wÍ‚xÌ‚tÈ‚}È‚zÆ…}È„|ÈwÂzÄ€xÈ€xÄzÄ~uÃvÀ|vÅ}rÁytÂytÀyt¼vt¸tt¶mq½tpÖŽwå¥{î·|ñ»ð»€ñºƒñº‚ðº‚ñ¿ŠñÐòÉ—òǝïÉœïÉœîÉ£ìÊ îÉŸîÈží̧ïΨî̧î̦į̂íÌ£îʤíÈ£ëȤìÈ©”,E4G,D”0D+B(AŽ+FŠ*E…!;‚"?†)Cˆ)C/Gª<OÃW^ÒlnÝwqâ‚tçŠvèŽxé’zé’{ê”{ì–zî˜|ïò¡‚òœyëvè}gÞqeÐ^V¶EMš.IŽ&A–0F8J¤:Fª@P±BQºI^º[x¸Sjœ@d2YjNv/_„Bwt1bw4`d"RNGh,d˜l™†N{l*_y=wu:rq4mj(ltFx‹`•t5w‡^œ^Žª’¼„Hƒ–xš‚K}G9K;hG^>¼ijÜ‹t˜HVX6?	9E	@WNŽ^„€@h\LH
:€<\‡:\ PižOf¥Yp±q€§NR³[^½\`¶fnÏ­ªÈ°¥f$<P8P9Z<d.Qj>^e&J`6b6[6^Hw-Jª`m£EY.@²:GÂHPÌJOÎPSÔRXÕVZØV[ÚYUÙ^eÞZ\ß_eÞbgßdjãlnánoâmnátràptâqsávuättä}~âuxå{xå€}å€|å€~ä€|äyâyvàxvàtpÝlnØfjÙ`k×UYÞX[àYZÝ^^Þ``×QXÔQ^ÔfxÕ…—ܝ¨å«¤æ¬žæ™Žâ‹…܁€Ý{{Úuy×nvÕhpÒbkÑcfÄX\ˆ/L\@XCZEVEVE`CdDnFŒ9L„2N|(B€*Df8k9`7V
->qHŃˆÒ˜¼ls¿{~”G]^Dl$B·`fÑxiÒ{pÓwhÊ{oÒŠzÒ‹zΊzцtφzΆzÌ„{ɃwɃwˁvÈ€yË€vÆ‚zÆ‚{ȁzÉ€yƁyÅvÀ||ÁxÂ{¿|sÁys¾{wÀzt¾|x»tq¸po¹nnÂztÚ”{讀ï¸~òºï»}ñº€ñ»‚ð¾‡ñÐñÄ–ñÊ›òÉŸðȝðÈžîÉ íÈŸîÈœîÊ îΣðͦíÍ©íË£íÍ£íÌ îÈ¡ìÉ¥ëÈ¥ìË­‘,FŒ3HŽ.D’,BŽ&>‘0C”.D*E‡#B‚&B†)B+B”5MªBRÅ\aÔopÜ|tà„yä‹vè’zèwê’xê’vë–zîš~ðšzð {ðš{ëvçfÞp`Ò[T¸BJ™1F“'A–1Fž5I¢:I«?M¯?P¸K]ºRfÄQcªRyjNRDj$X?sv4bn']`U\ Vf–„Ho` O`Uu:os2pn4m{G„|Qˆ†V|Bl¢B€œ~§”[”™y¤”i”RCN9fD^B­ZfØŒnÄ|f]:@
-:E
9uJql#Gr&Et*Sz3V”D[¢Ph¬Zr¼€ŽË¡™¶mbªNR¦DU°ZeÅ‹‘äв›[ZN>R?S:^:c@g$DbDf;b:Z9Z<{2K«ao BQž-C³:FÅHNËMQÐPVÒTW×TU×VZÙYXØZbÚXZÝ^dß`dàadâhjäklânoàmmàosâqrãtvärqåz|ãzxæ|{âzzã€zæ€y䂁å}xä}}á~|ÞzxßtvànpÝlqÚajÛ`lÜagÞkmß{xÚtyØoz㊌벩踭赥嫟旑⌇Ü{|ÜyxÙtx×pvÔhnÏejÍ_b²LXdBXDX>ZFVETCdGh Hp$F’?N.E4J€%@n9t$@^:\>hA¼v}Ó™ºjt¸u}‘CYlE€.IÂllÎ{oÐykÓ|pÌ€pÑŒxЉz·x͈z͈|Ë„źw̃wË„yÈ‚zÆ‚{Ê€vÄ€{|Æ‚xƃzÅyÈ~vÄ€vÅ€uÁ|vÁ~yÃ~wÀzx¾xt¿vr·sr´rqµpmÈ}rÞ›zë²€òº€ñ¸}ðº„ò»~ñ¼†ñÁòÅ”ðÇ›ñÊœðÈšîÇœîÉ¢îÈŸìÈ›ïÉŸîÊ¡ïÌ¢îˤí̦ì̤íÏ¥ìÊ¥ìÊ£ìʧêˬìÌ®‘.H4KŽ.HŠ.E4K”0F‘0HŽ+A†)Bƒ&E‚$?Œ,F˜;R¬HZÆ^eÕrrß~vá„xæ‹zè{æ‘të“xë–{ì˜zð—~ï~òœ~ñš|îtè‚jápeÔ`Z·DO–1H,F”1IŸ5G¢:K¨<K±AQ´CV»MfÌh€Åqˆy$WUHe&U~=up&Zo,jh#bŠf›^‚f'VSL[Tt2lq1oh1j~K„‡a—„QˆŠZ‰ašr3vŠf‘œn¤™y¢œzžu8kUEgHfD‘D\¼hrªAJmFLC_,S`$LNGw0T›\v¡Um¥\{¯f€À†•Õ¦ŸÄ€žDV¢LZ°\r¼v‚ܼ¬¼•€ZEVG[HZH`AbFg$EhAfBd>\A^Dz1O¨`q¡GZŸ0F°>KÀHQÊLVÎTXÔT[ÖUX×XZÙSVÚYZÛ]bÞ`bÞbhàfiàhlâlmâljàloàpsàlpâosäwuäyzä{zä}|å€僂æ€~ã€}ã€|ã}zá|áyvàvvÞvtÝqtßklÝimßnpâ|z服䞙à}}ç‹ê´¤é¶ªè³¦ä®¡æšŽà†Ü}|Úuz×ptÕkpÑblÌblÄ^e9SZH[IXBXET@WIaFr&Jo E˜FSz&A…:O{$@o<x(B`<\<\
>¬ivÔ™¸kr¸u~>S(K˜ATÄrmÒzlÒxeÒwi΄qÒŒxшv͆y̆|̇z̈zË‚wÌ„zÍ„ýxÈ€uÈzÉwÄ€xÆ€zŁ|ÅxÅ|wÈ}uÆ|xÆ€v¾|yÀ|v¿|uÀzt»xyµpn¶pp¹pnΆvâž|í±~òº~òºð¹~ñº~ð¼ˆðòÆ”ðÊ›ñʝñÊœîÊ ðÆ›ïÆšíÉžîÊžðÊžîÌžïͤí̤íÍ¥îÌ¥ì̦î̦ìͪíήîͲŽ3AŒ0Fˆ(@Œ*C.E‘.D‹*F)?†&@~;~=‹)?˜@T²JXÇ`iÓqsÞ{tá„våŠxèxé‘vê”xì”vî˜|ðœ}ðŸ‚ó ðšuêvékßs`Ñ`Z¶FN˜0D*D/H™8N¤>O¨@P­DV¶J`Æe„ÑyµWpz,`]Pj&]~Bzo*d€B‚Ž\’•lj.Z]RTOZSl,`q3hf+ep9pQ‰y?tŠXŠe˜{DŠ}S~œw«‡Y‰œ{¢ŽYŠn-ap*Yƒ5aƒ:]›F]’;\n'Sl(Pj&LG>TL{;d¶t„¶n†½~Í”™Ò¢˜Ò«žžHPDRš9W¼hlÓ¬¢Ë¯—l.EVDZF_!N`"JbHd$Jh%Iq'Hj"HfA`B\Gw0O¢Zl¢M`¤8L´@N¾ITÊPXÎW^ÔV\ÔW_×[^Ø\^Ú]`Û]`Þahágkàglâikâhgâfißlnßkrânrâsväyxäyzãzzãz|ä{zã~z倀ä€{ã~~ázxàyvß{zÝxxßurÞutÝppÞpoâ|wèˆê²¤ç´¨âŽç˜ê´¦è·®è´¦ç±¦ä—Žà…Üv~ÛqwÚsw×jvÔgkÌfl¸U`fBYEWHVGYHXFYFk*Kt&Mt%D˜@Pw&Bƒ1F{"Cp >u#DgD\?ZD VeÒ˜Œ¼w~¾x~‹>UŒ8R­W^ÊvlÒ|jÏuhÌ|nЂtÒŒ|φzΉ~͇zˇzʃvÊ‚yÆ‚{Ê‚zÌ‚vāvÈ‚xÈ€zÈ‚zƁzÄ{wÄ~yÆ~xÆ€yÄ{ÄxÂ~vÀ~u¾wrÀvq½xs¶rsµnm»qpÒŠwä¤wïµ€ò»}ñ¹|ð¹‚ñ½‚ñÁŒïÆ’òÊ›ñÊœñËšðÈšïȘðÆ—ðǘîÈ›ðÉœïÊ ïÊžîË¢ì̤îΨî̧ìϨį́íαëÍ­îÌ®Š*Bˆ.BŠ&@Š+BŒ(BŽ'@Ž+CŒ*B„!={8=‰(B–8O°N^ÉdlÔrvÝ~tâ†{æŠyè‘|ê’yê”tì“}í•wðš~ð ~òž{ð˜zì‘rèjßq^Ï]W·DL˜3H*B”0Fš2F¤6J¬<P°<R¿ZtÐv‘·Zw P|{/_h&Yo)av2j„H›oœ†Ptl)Ta(UWFYRZNp0en0bm0ck.ft<un/f…V‹€R…}Iq6p“lœ„P„¢„¯˜cŽw4ju2c“KxŒ@m†<`„7Z]>Z@g HMCp*X³ŽÄ‰’Æ„ŒÍ•–С¢Õ°§º€w™=Mž?Pž@XµjnÔ»£v9 at U9Y=[>]>b:d<c:h=w(Bn%Bb?`8\?mB¡Yj¢N`¨:N±@IÃIOÈKTÑTVÕSVÖYYØXYÚX[ÚWYÛ]`Ý_^ÞefßegàkkàlnàhmÞfißikãgjállårrävvãvwäxxâxxàvsäzyãyzâ~yà{zÝutÞxwÝwuÜtsÞttÞupßywâ€|皎캯柘痍츮뻮긨賡㓈߂€Ùx}×ouÚsvØgrÔflÊaf’7NYCZHXHWAXCUBXDq(Ho#I|,F“:N{$?…1G~"Bx >w;d6V8X<‘AYÌ’‰À‚‡»v|Œ;QžNaµ]^ÐxgÕ{hÒr\Î~qщwÑŠwχx̆yʇyÌ„|˃yÈ‚{È‚xÇ‚zÈ€zÇ‚xÇvÄ€xÃ~yÂ|tÂ|yÂ|tÀ}Â~xÂ~uÂ|xÀv¾|tÀxs¾zv¾xq¹sp¶onÀtn֐wè¦{î¸~ñº€ñ»|ð»€ñ¿‰ñĐðÈšòÊ™òÌŸñÉ™ñÈšðɘïÇ›ðÈ—îÉ›ðËŸîÊœîÊœî̦į̀îάîͨìΨîͪîίîÍ®íÍ°Š,Dˆ,CŒ&@*B†)@ˆ(@Ž+@ˆ$>†;€=>‹'B—=Q®N\ÉbjÒptÝ|vá†xæŒvëwé”xê’uë’xì˜|îšyñ ò ð›zì’tæ„làr\Ñ`Y¸FJ˜1EŒ&?*?œ4G£5I¨<R¸PjÊy“·Xr²Ui¥Rtq Rp"Zr,d‚;vŸl“YƒVAZFkBf[Na"X\Np/id(Wv1lh(\w:vp.i|Bn‹a—g*at:|ˆb‘—fœŸ€ª™iŽƒ@vm$O©nˆŒ=Zh Gm@Z;O6p E‡5VPk¼zÆ€ˆÉˆ‘Ò šØ¸«Ò®˜¤IK§IRœ;P¥P\ɤœ’]TO>U;Z=j>]<a9f6c7i;}-Fo?_;f<Y
-8o ?œQežK^¥GY®<JÀFLÈKQÏPUÔRVØVZÙXZÚ_^Ù\\ÜWZàacádeàccâhmâeeãhlàhkàloáiißlnâljãqqâtrâtuâvvâsuäytáy{ä€zàzvÜurÞstÜxvÚ{zÝwyÞzuá||刄飖îŶêÀ´æ§¢æ™ì»¬ì¿³ê¶¦ç­Ÿã•‹Þƒ‚ÖrwØrx×pvÔioÐhn¸ZdiCWBYD\EZC]CU@_Fu)Gp%I…/F’7J&A‚/E|=}'@o7f8Y6V
>ˆ=Zʇ~½}ƒ¹mtŽ>T¨Vf½c^ÔveÔ{gÔvaÏ~lЉxцwΆv̈zʇ|È„~É‚xʁuǁxÉ€vÆzÄ~zÇ€wŃyā|ÄxÂztÂ|vÂvÁxtÃ~wÂ}x¿}zÁ~v¾zpÀxq½wl¹rq¶lnÂsmØ’vè­xð¸zòºòº~ò¼„òÂŒñÈ–ðÌžòËœòÊ›ñÉ›ðÇ—ðɝðÉœðÊžîɝðËžîÈžíÊ í˦ìÍ­íΪìͨí̪îΪí̪ì̱îΰ‰+B‡(Bˆ(@‡(Bˆ%?†!<‰%<…&@‚"@}"A€$?Œ.F’4J«JYÃ]hÏpqÛ|và‚xæ‹séŽxç“wê•vì–tìš}ì˜~ïœyñžzòœzísè…kàtdÒ\T»CH™.FŒ%>”.Dš4J£0MªB^ÀmŒ¶\v°JbÀap¢NznUr"Z…>y“Uˆ—l”x;kTGbRd,Wp5li+_c(Wm.f]L}Brn,[h.bo.kq/d‹^c#`n3q‰]Žœl›b”bœdšŠFeÊŠt8aFV7p#Dz+T<ZžMb¡I`¬dxƒŒÌ˜Ó¬¤Ö¹©°b^DQš:O BW¼ˆŒ®lVAR<`>e?n?fC`:l;c8n @~,Cz(Ed<c:\<j>˜L_HZ¦Qe¢1E¹GTÆJPÎPVÕTZÙV[Ú[`ÜYYÚ\aÜZ^à^`ßehàagâfjällãdhàfiàkkácdàjhâhjâikáppâssàstáqqârqàtqâ|xàrpÝxvÝrvÝvuÛxxÛ~}Þ~yâ‚~䎈馜ðǺì´槝攐쯥íÀ¶ê¸¬ç®›ä”ŒÛz|×ntØqvÔkwÑktÊek›?XYDYBXCZDXAZAYEbFs&Lj$IŠ4IŽ4J€*E‚/Fr8y%Bq=e=Z9S
?ˆ@]Æ€zĈŠ´js’=VµcjÉj_ÓueÓwbÏzn΁wΉxÌ„xΊ|ʇ|Ì‚yʇ|Ì…x̆uÉxÉ€vÉ„~Æ~xÆ€|āzÅ€zÄ}xÂ~yÆ}vÂ~yÃ}vÁ€wÂ~yÄ}vÂxnÂzp»tp³pr´ml´moÃwmÚ—xë®vñ¹‚ò»}ò»ñ¿‰òÆ‘òÈ”ñÌœóÊ—òÊ™òÉ™ñÈ›ðÊœðÊ¡ðÊžîÈœðʝíÉœìÊ£ì̪ìЭíÏ­ïͬį̂îͪíίìÍ­îα†*D„&C…&A…$B†$@‡%?„%?%A€>z <ƒ&>Œ+E‘7L¥G\À\jÎmtÙ|yàƒyæŠzèvé“{ë“uê—}í™zîœ}ìž„ñ }òžyî“pé„làtcÕ^S¸GI”,A#>’-D™1M¥;V¼g½h«H^¸FV¿dr›Hvk V5o„<p‡N€‹\†j'X^M`Qa#Vp2ff(\l2jh+^h.bt8fx7gd*Zh-bj.b}Ju{C|[V`$^Œ\Œžx«Ž[›t°x‘²\\R0U@X
?|1O®at¦`zœLf Pe¶p~ÈŽ˜ÎœœÖ»¬¾„tœDQœ:LŸ@WµkoÄ ŠX8N:R;o#@€*GdAb=]8n9f>n<{-F~,Fp?c:\7h:›O`›DS¤Lbž0Dµ<FÄJRÏJNÔVYÙTWØX[ÚZXÛ[_Û]`ß`_àdeàdháhlâlkãgfãiiàehàdeàfhàflßjnàioàkiÞosàppÞqrÞmnÞtsÞnlÜprÝqrÜrsÛttÞzzÞ||ႀ捎騛íÁ±ìÇÁ毳騫îĽîÀ®ì¸¨è°£ä–“ÙtyÖjqÖjuÒjvÓkqÂ`jlEU@Y>XDb&JYFXDXAe"En$Gx)H…1IŠ2L€%?.Fs >v"?v!<b9Y
9U
->~7U¾wzËŠŒ·kn—E_¶`gËmaÑsbÑwdÌ}qΆrΊyΆvІu͈xΈzÌ‚v̆xÉ€yÇsÆwÇwÀ{Æ~zÅ‚}Å~zÆ~yÈ€xÅ}xÄ}xÁ~|À}xÂ|yÄ|uÄ{pÀxtºup»rm²or³ljÆzpÞ˜vê°xñº€óº‚ô½‰òÄ‘óÈ”óËšòËšóËšñÉšðʘñʘðËžðËžðÊœîɘîÈšìÊžíΧíΩíЭíΫîÏ­íΫîήîέîϯîΰƒ,B| @{ >€ <#?‚)D…'B$D‚!B~ >„#Aˆ&@‘5M¦DWÂ]lÏntÚ~z߃xåŒ{è‘xè”yê–|ì—|îšî{î¡~ñ¢|ðœ{ì–vè‚iàs`Ó^VºJO”*DŽ%B’(G™/O´ZsÀn†¥CZ²ASºHV¹]t”>mp&Yr*_]H‰YŠ„Hy_Lc"T_Nn5fc&X_&Xn9rh,b{Fxw:p~@st5kh.do6kp7m|Ftz@~YWh,d”l’”c—–r¢„¤p0[@@IB}0V¶`rËsË–£¿•ª¸–È•£Û³¤Ø¸¨Ë‹œ>H¥JU CW²^gƤŸx?KPDO@R?„3F•:Pd@a@Z8l>e=l=x(E‡8Nr"@b6`<h:”G]™>P¢L^œ5J²8FÁEPÌJPÕOSÖVZÚY\ÜZZÚ][Ü[[ß\_ÞggâcaÞfjáffáhjáheÞekÞcdÞehàihÞlnÝlhÝefÜjlÜnlÞhjÚglÜonÛroÚprÝkrÝoqÜzzàxá…zä‚zæƒtå„t꓁虇쳘뛎苋ꈈ暏⒐ÒfnÏ_lÑdsÔlsÐjq¡DYZHVAV>[Ea&LXBZA_BbAu)Hz)H†4KŠ8P~&Bˆ0F€-Fx">€(>e7T
-5X>n)L»w|Г’²dj£Pc¼ieÎqaÔu_Òx`Ëzh΄sÏŠwЈv͈{̇zÌ…yÊ‚wÌ„zÊ„{Æ‚yÇ}xÆ€wƃzÈ…wÄ€}Ä€wÆ€xÄ€zÂysÆ}vÂ}xÅ}yÃ|uÂzsÃypÀwr¼wq»tr´nk³kpÈ{lÞœxì­|ðºò¾óŠòÅ’òÊœòΞòËœóÌ™òÉšñɘñËžðË ðÌ ðËžíÊ¡ïÊŸí˦ìͦîͬíÒ°îЭïϯíάïͪîϬîΪîά€(Ex?x>{:~"@‚#=‚&C‚$A‚$B~=„ ?‹,C’2I¦FWÃ`lÐpqÚ~{à‰xä‹zè’}ê•{ê–}ì•~ë˜zî›~ð¢ð €ñ{ì”wé…hàueÕZRºCK•-E‰&H‘*L¥B\Âs‰¨Ic§:M¯>S¸J]¼l„?ifO[L_#W‰Z„“a’d"Mb$T^ Qf*[f$XZSd+cg(dq;k‰T’€Au†J~z>wu<rp4li*aˆZ‡w;q]Sh0c|B~d™˜s›‘h—TTMA§Td¥Bd¬^~И¦â¾´ß¾¾ç°⼩Ҥ’ FI¦JRœ8P«OXÈ“¢qfO
9Q=S:V;„+B˜AJ^:b:Y6n<m:p>-D|,Fx"?`@b:l<–J^8IœIU•/D©3B¼?KÉKQÓTTØT[ÛZXÝ\ZÚ^[ÛYVÞ^\à^^Þ`_àbdáeeâjmàjnàfeàfgßffâjiÝccÚ`^Ú\ZÚ[ZÚ_\ÚdfÚgcÙopÚifÚomÜkgÜolÞjbßhfÞefÜ`aÜ^eÜ[bãjpâhpävxæz}ãoxãeuãhrÞtuÐjh¿L[Æ[fÒkvÒotÆenrCYFWCXA^D\D^D]FcBdDy-Jo(F‚0J‰6J„,B‰4L'Bv>}(Bg9T5Y<hFºv̐¬Za®ZhÆkbÒudÖzfÔvcÍznφ{ΊyφyΉyˇzË„wʁvȁxȁzÄ}vÈ€tÄ|yÄ€xÇ„xÃ~|ÄyÄ‚z€xÀ}|Â}z¾~~¿||ÃzqÄzrÂxq¾wt¼to¹rq´lm²hkÊ~qßšzí±€ðº‚ñÁŠóÅ‘ñÈ™òÌŸòÌŸñËœñÊœñÈšðÊšó˝ðÊ ñÌ¡ðÌ îÊ¢ï̦îÍ£ìÏ«îΫíЬîЭîЮíЯîάîЭíÏ­ïÏ«s?r>v=t<v<z=&A‚$A~ :}<‚ <Š*A’4H¢DVÁ_jÓqsÚ€yß‹|åzꔀê˜}門뜀ïš}ðž~ð €ñž€ðž~ì’qèƒjàraÔ[Q¶DK)F‰!E›6X¹i„±Xq 6Oª8O±H^ÂbzÃsŠ‰4a^L[Ir4lb!M|Gsl)[b&Xa&Vj-]f*[^!TTT`!^s at v’k£‚E|‹Qƒ†Ny?rp4kh+hl1d‹\Žz;|j5m~PŒL€Žg †N‚‹V—_˜Öˆ¬k–¡hÌ¢ªÞ¶´êɾèűִ¤©ST©LT¤CR¢DY»{}Ħ˜Z<P?R;\=V<l8ˆ4F_;]9a:f;j<v%Ax%C|(A…+E^6^:g:šRd3H˜D[’,C¡1Fº<HÆGLÏNPÖRYÚ\\Û^_ÚXVÚXYÝYXÝ[Yß`]ß^_àcbâhlâloâliájiâldßrgØ[T·9@®6>ÀGHÊSMÑYSÕ]Z×`YÕ\YÔ[VÕWXÕQQÒOOÓPOÑPMÐKMÐLNÎHRÝRVßWXßf`ÙbaÀ>D´3@ÆDMÂNSµ>L¸FUÍadÙrtÏov¦J\]CVDXA[@dDXB\BZ>fAf@‚3JlBˆ2Fƒ,D€*@8K{%>k8z&@p=U5\8cD°hv͍Œ¬Yj¹jsËodÔzg×xaÔ|iÊvnφxΈvΉv̈zÊ‚uÌ„zË…xÇ‚xÈ‚vǃzÇ€wÃ~zƃv€{Ä‚|€yÆ‚vÂzÄ{¾}wÀ~yÀ|uÃ|rÄ{rÃ|uÀzu½usµrq±kn´hhÍ‚uá tï°|ò½…ôÅŽóÈ•òÌŸò΢òËŸñÌ ò̝ðÌ¢ðÌžñÊ›ðÈšðÌ ðÊžïË¡îͤïͨíЬîЪìЮîÑ°îЯîÏ­îÏ®îϯîЭîÒ­pAp>s>vAv"?}#A‚&@€=}>=†%AŽ.F”:S¨K\ÂblÒvwÛ~|à†yåŽxê˜~ëš|ëœ}íœ~ðž~ï {îŸðœuì“vè„mào_ÑZR´DM”-K&O¹m‹½g~¡:T£0Lª:TÃe~ÑyŠ¿l‚ƒ0`bQo)\|<iVE\HbPg*Zb(Xl1cm-`d&[YZ]^wJ—{¦‘a“ŠTŒ‚J€ŒVŒ}@xs=va'`o6j^‘gšNƒf)^xM{n3jy0]µj‚³pˆ¯^uÉŠŠÜ²ºÞ»½ê˼ÞÁ®´xxœ=L«KT¢AX³clе¨…JPP
=ZB^@cAT8c<.>kA]
5d9b8h:r @q ?|+Dˆ3Jc3Z6f8”H\ƒ(F•ER‘3H–*@´<FÂFMÌRRÓQRÔ][Ù_[ÙZWØ[[ÚXTÚ\^Ý^_âd`àgeãfhájiâlläojânhßneÑTR±:N®;K¨.>¥*=®0<³6>¼:@Á:BÄ@HÉHLÂ>F»;D·8C¬4A°/=¸4BÄ?HÕGO×LRÖRXÈER·?T²6TºDXÇWfÆQ^É\bÖlpÖuxÇinv$FW@UDY>`BeCZ>Z@bBfAt*Gz*Jm CŠ8L€*B‚0E‹6Hz">e
5€0Az)D[8]@^D£ZlʍŒ´htÄvzÐoaÔ|hØxbÖ|jÌ}qЊẏyÍ’€Ì†vÊ…wË…uʆwÊ„wʃvȃ{ÇxÄ€{Å€u‚|¿{À}xÄ~yÁwÃ~zÀ}w¾{xÃ|sÀ~yÃ|uÅ{s¼xu¸tpµnm®jl¸khÒ„qã¦xï³|ò¾ŠôƐôËœñΤóÍ òÍ ñÌœñÌžòËœðÊ›ñÉ›ïÊœðË¡ïÌ îÌ¢ð̦ïͧíάíάíÏ­îÒ¯îÓ­íЮïЮïÑ°ïЮïάl@l?p>q?v?|>€&A~!A~=€ B„$@8O•:U¯L]Ä`jÑvvÜ~uâˆxåyì˜~ë™zì›~îœ{ññ¢zð¢|ïœ{ìqæ‚lÞnbÏ[Z³BU˜/T°\€Är†£BW.J£2L²LhÎrŒÈm„¯_z~,\bKu2ch#O[HR?d&Rh-Zc,Wl5ff$Yj0bh*j^ bwH€˜v¦–k„L…€H…†K‡‡O„ŒT€Dv;y…L}Ÿ|ž„I~e'\j3n]"\ƒ>n·h{ÎmkÚb`Þbf伶ìØÑæ̾Ӭ›¢LR¦ESœ8Q´\hΩŸª~oSAXA`<b<^9T;`6s$>s >]=b<j<k=o ?n@v(Cƒ5Jj=a=d<’G\„*E‘=O6K“.C°6D¼@IÊNSÒRRÔUSÕ\Y×VTÙUUØXVÙ\]Ü]bàbeÞdbàadàejáspâppâqmànhÙ\^ÔV]ÖW^ÏR[ÈFVÅ>LÄ<LÊ@OÐDOÒLWÕN\ÔNXÐO]ÐP^ÌK_ÊN\ÌObÒLbÚUmß`vÚe|ÞjƒÚb}ÕVrÒ]nÔjqÒfhÙilÜrqÔnn¤DRZDVBRC\@aB^DU@W@f?gA|.HpBr?Œ6Jƒ0I‚+DŒ8Hz"Ah;{.F€1K[9\<\BšLaЈ„¹muÍ~|Ôq_Õ~rØxaÑ~mÍ}rщxЉxЈw·xÊ„wË…yÊ„zÈ…|ʃxÈ‚yȆ{€zÄ€v‚Â~yÁzÁƒ~‚|ÁyÀ{¾|xÄ}tÂ~vÂ}xÁ|u¼vs¸uq´on°kn¹nlÕ‹pæ§~ñ¸‚ôÄŽôʘôÍžòΡòΠñÌ ñÍŸòÌžñʝðÌ ðÊœðÌ ñÍ£ðΤîÍ¡ðΦî̦îÏ©ïÏ®îЬïÑ«ðÒ°îЫðϬðЬïϬðάh@kAp?q>v>y?} =|>|=z"B†,EŽ>U•AZ­QeÂeoÓsrÞ}sâˆxævé™zê›~í›}ìœ}îž{ð¢|ð£ð¡ïšzêqælÝqgÍVb³C`µgˆÇ|Œ¦B\“,Eš.L¨<X¿bÈqŠ¶Yv§Rp‚7bj(Wj&Rs/^^K^MXA]NVJn7ig%]d(Ws8xY^uQ„¦–¼˜g™n0jzE€Lˆ~KŠ…P‚‰P‚‚Gw‚Hxn2a{Do~D~l:vL„¥`ŽÜ}{ån[Ýa_ÓVaÛŽƒïÚËÛ¼«´pq GT¨FX²WeГŒÉ¦’`$FQE^DdAd@Z>U=`:p"Br <^9a;j?r"Ao!BpBr"@€2Hm?^@e>‹CYz)FŠ6JŠ6L’1H§7I¶@JÇMQÏOOÎSUÔYUÕTRÖTWÖXXÖZ\ØZZÞ_aÜabÞffÞghßpoàsnàqnáonánnÞfdÞZZÚVWÛVXßU[ÞRbàNWáKVäSZäZiã_pæZpèm…åw”æ{šå„œè„¡ë“¬ì µë¤±ìž«èwÞ_{ÚbvÒrsÚtvÜnnÖpoÂ__mAV?XCVBb@fB[AXAZAgAh Dy%CjBw&C‹:L-E†.G5K}(Gh>z*@„6O_=_<\B’B[ÊŒŠÀw|Ð}yÕs`ׁqØwdÒnÌ€rÑ‹tʉyˈwÌ„wʃwʆ{ʇzÉ„wɆzʃxÌ„{ŁxÀwÁyÁ~vÂ~vÀ€x€vÀwÀ|xÁzÄ~vÁzyÂ~vÂzv¾vr¹vu³no°gi»mf׋vçª~ò¼‰óÅ’ôΞóΞñУòΠòÌŸðÌ ñÍ ðΡðÍ ðËžïΠíÍ£ïΧîÏ©îЪîÑ©íЮðЭîѯîЬïϬíΪîΪðΩïϨñͤj>iBp@r@u@z!A#B"@z={?‰*F8L™@V«K\ÁalÐsqÞ}vá…væ‹tê˜~ëšzìzìž{î¡yð¤î¢}îœvèzäƒzÚpwÉWrÂh‡Æ|Œ¢EZŽ)D—,Eš0N®KhÊuµVtµOh¦JlŠ9fm)\f"P‰S‰k(U_ LN>XKSHvBzp*^b!S~J‡V\xX‡®œ¼“e’d+cd(d{I€†W’Š]•D€z<p|Cq[%_i-\VŒ‚PŒ’fž¥h•Õy‰äocÚb\ËP`ÎyâÌ„x¤FQ¬NVÁgiÚš€Ö®˜„FPSGZM]EbAb@Z<X;\8g:n6k=^8c<p >k:t!Bt">~+Ht@]<g?„:O|$A8Kˆ6I‡&@˜.A¬:HÀIMÉLPÌKRÐTVÐPRÔRVÓWZÔXYÖZ`ÚY[Ü\`Ü`aÜglánláppánnänlåtláhhÞ``Û\_ÙVUÜWZÞTWàVZàLWâNZæP\åZmçetêy„錎휘뚘ðŸ˜ï©¦ï°«í žænÜ`wÕhwÕvyÜxwØllÈjl5JX@WAT@ZDd>g?X<V:_;j=l=f<j@~-D‘@Sƒ(@‹0DŽ/Lv=o:~)A‰<Ob>`<]D>\ːŒÆ†Ð|uÔxbׁr×xdÑ€r̃sÌŠzÌŠz̉{ΊwÆ…yɉ|Ê…xÌ„wÌ…vʆ{È„xƃxÅ„wÃzăwÄ€vƒxÂyÄ~x½}zzÄvÁ|vÂ~v½zwºzv¶qn²oq­fn¾ojØŽtë®|ôÀõËšõΞôУñΝòΞòΠðÌœòΞñÍ¡ðΤðÍ¥ïΧðϧðÎ¥ïÏ­ñШîЬïѬðЫîШîÏ©ïϦîΤðͤðͤðÍŸñÊœhCkAl>r<s>y>z<| =w<w>‡/J“:Oš@U¬HXÁ^hÒrpÞ}t߇xäŒwé“{êšzì}ì }ì{ï¡zî¢ðŸ}î˜|鐀␔Í|¡ÁlÃpˆ B[Š$B‹$B‘+Kœ:[¹`ÄxŽ¬If±Ib–Dkw,V|2ks2`šzžp*WT<S@UI^%X‚N‡m+^f!YwFzf"ff”¬š¼•f–n1p] Zv=vt=w|Mfž„P‰z?wn6hg-b€@rJ‚žx¬ªp˜É|˜âkiÔU`ÊhsÔ¯²Ï°¦˜?P°W`Æjfä˜{Ø•~]TVCXJXB_DbDcB_<Z<^7^:k<k<_=`:j>p@r At#B},Dx(D`<c={+Cz"@Ž8Nˆ6L"?3J®<H»BKÄHKÉMPÎQUÊPVÎPRÐVXÐTYÖTYØYXØ\bÙY\ÚadÚlhàjjâmiätpäplánfßhfÝbdØY[×W\ØRUÚVZßU^âYaæR\çP\ê\nìjxên|îu‚í|…ìxƒîn€ípì{ŒçxŠÜ`vØk{ÖrvÜxyÜttÒnp¹W\d>U=V<V@Y>h?d<Y;W8`8g8w(Ba:h=€,A–BV„,F‘8JŠ5Jz$Bw$Bx$@‹@Rg:_>\FŠ>^É‹ŠÉ„‡ÏzwØ~hÖ†yØzaÑ€rˁrÍŠvÌ‹w΋xÌŠxÊŠzÌŒzʈyȇzÊ…xÈ„wȆxɈyÄ‚wÄ{ăzÆ…yÄ€xÂ|wÀ~tÁ~yzÂ|wÁzwÂ~v¾ztºvt¹rn²kl­hk½mlÛ’x첄õďõÌšöÒ¤ôПòУòÎœóΠñË¢òΠò΢ñ΢ñШðЦðϨñϦðЦñѬðѨðШðϦïϤïËŸðËžîÍ¡ïÉšðÉ™îɘñÈ—m Dg?l>n>v:x9v9v:s:w<†,G“8L™?S¨DTÁ\cÒppÜ~vã†væxè•yé™}ì }íž}í |î¢}î¢|ï£†ìšˆç‘ŠåŒ‰à”Înx°NW'D…>Ž$F”/Q¬RtɁ˜µRl­C`°OiŒ=dfOl&Z„U~”fŠf KZFZHRJd/`L…g"WA‚l8mt6u˜ƒ²¡„¬]Œ‘bž` \q9nzF…_%_xNw•j¥‡TŠŠSŠ~LŠŠZ–†Pˆ§‚°Ä„¢¼w–×t…ÉJ]Ձå˸´pw®SaÐtkå‘r躓¬ihZHYKZG[F`Ed!Fg CbBZ>^<aBe@f>f@b@f>t)BlAn"By*Fw(Ec>cC}6Q„.JŒ9Kƒ0Hz!=‡*D 6I³BL»HRÂKOÇLPÉMMÊMRÐQTÏTVÓZZÖXYÔ_dØZaØ_fÛfgÞhiÞjhàloâpmâmlàieÜcbÛ`fÛ^[ØWVÖTWÕVZÚXZàYZâVYäT`è^pébxêbyëk‚êiìdzébzçcxâ`vØfzÔt|ÛvtÙ|xÒlnÈfhŽ4KXBXBVCSAZCdA^@`>]>h>f8r"Ad<k<‰.B’9T~&DŒ8M‰1J(C}'Ds>ŽDWe<b=^F‡>_ʈŠÎ‰‡Õ~tØ~n؆x×{fÍ‚tˆỷzÊŠw͉xˈxÈ…xȆxʉ{Ɇy̆wÊ…xɇxÆ„zĆxāzÄ‚wĆ{āz€xÀ}y{¾|½~y¿~{Á|tÂ}uºvt²rr°nn¬dn¼njÜ’w÷Ê”öРöÒ£öѤóРóÏŸóΠñÍ òΠòШòÑ©òШïÒ¬ñЩñÑ©ðÒ¯ñÓ¬ñѨðΡðÌžîÌŸîÊ›îÈ™îÈ”ïÇ”ðÆ’îÆ–ðÇ”e>d:j:m9l:s<v:q:r=x;‹/F˜8K˜EZ¥@PÁZ`ÒnlÜypàƒrä‰sè’{ì~ë |î¡|ð¡{ï }ð¤€í›‚葃â‚|ÚtqËY[¬@J(@ˆ"E(M;\Âz“¿g¥Da°H^®Xx„:`cR`O•t˜’]€X?XDZMSOwF|xDwXPv:qv8xv<r§šÆ–hš{D}”zªEˆ|D€‹c–n3ne+duFo˜n¨ŒN‚’x­™pš‘T˜eŽÎªÁ€Çp“ÄJaÍ~ƒÖ¼»»iqÏwvärí¸—À{fn,NVL]"LXI[G^Gg"IdDb*L\D_FbEcH_Be!DhDe!Dj Du&En#Cw,Fz+Hh Ed>v-H‚0L3F2Hy"@…,D˜-A¬;H¸BJ»DLÂDIÇLOÈOTÊRYÌTUÏX\ÓXXÖabÖadÚbdÜddÜfkÚfjÞhlàijâkfàmjÜddÜbdÜ^_Ú_`ØYZÖ[`ÔXYØQTØQWÜQZáXZáZcá]hådvä]gã\jáWfÜVbØdsØuvÙxwÛsrÖttÌjj¦DMx#DT<XCVBX?_Cb?`Ah@`Bh=j@p"@e=m:ˆ4F‹8M'FŒ8H‡/E…0Gy >x:’FVi;d@`G‚;_Ȇ„ÏŽ‰Ð}m×€p؆tÔjÍ„sʉvËŠvÈ‹z̈u͉xȇzɆzˉ|Ë‹ÿwÈ…yÇ…zÇ„wÅ„xÄ…{ÃxÀƒzÄ‚v¿z½€x¾~x¼~yº|x¼yw¼vs¾zrµtt²qm°lm¨co¾liÝ•{õÊ”õÒ¦öÓ¨öÒ¢òÑ¢óΞòФòÏ¡òТñϦñÒ¬ôÓ«ñÓ®ñÒªòÒ¨ðѧñТðΠðÊ™ïȘîÈ–ïÆ”îÆ—ìÅ–îÇ—íÈ–îÆ–îÆšf&Lc<f<g<j:r=p;n;o>w;Ž3FžAM˜8L£=NÀV]ÒjfÚvoށtä‡uè•xëœ}í¢~ìŸ}îŸð}ï¢|ð¡~é’|ä€oÜqfÍ[T®@K’)D"H†$N©TnÄ€—¥Fi¨C\°Lb Nil"NcUo&Y~™‹TyQ
=^HSHRKP‚j1^XP\!Vx=‚~F±¯Îœv§o1n|R„–q¨ˆVŽ’lœw=tg,bb$czP€–€³“r£ŒMv§oŽ|?k­xœ²_~¶z¥ÁUoŏœÞ½܂pì—x쥏ئ{v*KXNXJ\H\ L` LdDhAj!Ca@Z?`Bg!B`?_@`Bq!Cp$DhBt(Bn"@t(Bx&Ek?a@o$C3P|,C‡6Ls >|(DŒ'@¡1A°<F¸GO¾DN¾BFÂKSÇLQÉRVÍQXÏTXÕ[\Ø\]Ø\`ÚdfÚaeÚflÝfkÞjoßkmßgiÞimÜdfÜ`eÛ`_Û\\Ü^aÖZWÕXZÎTXÐQTÑMSÒNRÓQTÒOZÑLTÐP\ÒT`ÔhsÝ~Úz|ÜptÚrqÏqm¶MP…)AiBVBT>R<W>^?]>hBeDn"Cc<i;h;j;n<”DS‹2JŠ0H‹5H‡3D….Cw=x"@<Jq:d?`F€8[ÉҐŽÑ{lفrØ‚vÒ}mʃwʉxÊŠxȈuȈẅzɆ|ʈ}ʇ|ɆẍzɇzɆzÌŠxɈzÄ…yÁƒ}À…|ƒyÀ„zÂxÁy¼}z½}v¼{xº|y¼xqµvt±on«ik§agºjiÙ–xö͝öÔ¨öÔ«öÒ¤ôУòУòТñТòЦòÒ¨òÔ¯ôÔ­ñÔ®òÓ«òЦðͤñÌœíɘîÈ–îÈ•íÈ—îÇ–îÈœíÉšîÈžîÊŸïË¡ðÊž`?b>f>k@h;h8j8f6k;z"@”<OžBPš>O¦>N¾V^ÐhbÚrnÜ|râƒté’|ëœìž{ì {ðž{ð¡{ñ¢~ð¤{ðš{èwå„pàqdÍ[Y±BL*E‚DŒ'P®Xrºu’ @^ªF`£Rj{7]\L^Ty2ct”€=bXAXFOJ\'X€I~g&X\TNPa&df²¨Èž€ª‚Gˆg5n™‚´b›‘nŸG‚q<zr6w~Z™mœ™x¥–cš–Ms}7j˜f”–Mx©d¾QgÔ©ªÛ­¬Úzræ›å®~ƒ8GVFVG[J\F[C^BeCj Al BdAW?]<k@]@bAa!GfCm BqBj@l @o?s#@l?dAjB|-Kv$C†:Rt#Cv#B‹,Ež,@¤6D±<Eº@F¹CH¾GL¿ELÈNSÌOTÐUXÔXZÖ\^Ø\_Ø_fØaiÚhmÝfjÜjlÝllÜhlÚgnÙbhÛdiÚ`dÙ^dÙ`dØ\cØbf×dgÖ^cÏ[bÌW`ÎZfÑ^jÔbgØirÛu|ß{zÝ|}Úp{ØhrÖpnÄlm€ >…*Cc@V>UBT?Z>aBcDdCl+Im$Cd @e>j>i>k>•GW3K‹.IŒ8HŽ<P€)Ex<z%BŽ<Ls=o"EgHz4WăˆÕ—ŽÓ}nÚ…zÕ€pÎ{n̆vʈxÌŠ{ËŒyȇ|ÌŒ|ɇzˉ~ˈ{Ȉ̈~ʈ{ÊŠ~ÌŠ{È‹LJ~ņzÀ†€Âƒ{À‚{¾z¾€w»~x½~wº{x»zv¼ztµro°onªhj£_e³hhÜ•vð¾÷ÏžõÖ«öÔ¨öÒ¤óТóÒ£óÑ¢òÑ£óѨòÓ¬òÓ¬ôÓ­óÓªóЧñΤïÌ›ðÊœíÉ–îɘïÊ›îËœïËžðÌ îË¡ðË¢ðÍ£ðÍ£òË¥bD`=f>h>f=i<h9f<j:„,FŸL\§GR¢FR­J\ÂX[ÐedÖqjÜznâ…tè’vêš|ìœ{î~ížzð|ð €ð¢‚îš~ê’xæ„pàtbÒ_X´CL)D‚EŒ#N®Xt¶p”¤<Z¥Bc:`y2Zi(WcUt4]b†h L\HUFGC`-\y at p^Kf)\WUR[˜¬«—½–{«™p¢t<„f“š{°–p ‰TŽ‚SŒlžLtBvl Ÿj–Dlh-b–mœ˜e˜—`–§V„Ö ¢Û¸½î¦ñ¿¡QTVIWJXEZF[BZD^Ah!FgAl Be BZB_Ah"EbDgD^DbDf"Fk BlDl Bp!@t"Br'Ch@d=x%CpB€3Jt'Cl?‚,B“+Až5C¥6D®<G¸CI»EN¾IOÆJTËRWÏU]Õ[cÕY^Ö\aØajÙ`cÚdjÛikÛflÛfkÞfnÚfiÙgiÚcjÚejÙglÙbjÙefÞmnÞqpÞrpßtyÝx|ßx|ãvxâw{ãzyá|Û|Þx|ÙhvÙqsÑol«JUc8€,E^DXAR>UBX@`B`BhBg Bj#D`?f;d8g=j<˜DTŽ4J1HŽ7FŒ7L‚)Az"<{">Ž:Fw%Dk8fGt,N„†Ô“ŠÖ~oØŠyÔ|oÌ|nË‹yÉ…xÍŠxÊ‹|ʉwʈ|ƇzȆzÉŠzɈ{ʈÊ„ż|ȇ}Ƈ|Ć|ÁƒÁ…zÁ‚|À‚|½€|¼x¼~{¹|v¸}zºzv¸xw´sq®kl¨gj¥bi²gjÛ—vðÀŽöÒ¡õÖªöÖªöÖ¥ôÒ£ôÑ£óѤòÔªôÔ¬òÒªôÓ¨ôÒ©ñФñÏ¢ðÌ ðËžîËœîÌ¡ðÌ¡ñÌ ïËžðÍ¡ðË¢ðͦðÍ£òΣòÌ£òÌ¡bBb@d<e<c;e:d6a:i<Ž5F©ITªLU¨FR²JWÅ[`ÎhfÖpkÝvkã‚tévë˜}ìœyìœ~ìž|î~ïž‚ð ~îš}èzå‡rÞtcÐ`Z¹CH’+G… DŠ$K¤Ff´hŽ«HgHmŒCf5\l&U~8gu3X}Ck^H\EPHLEh4ay=nWKi*[] ZY!_Žlª“¶‘q§ƒO‚—m¢|M€¡’½–q¢ˆWŠaŠ[Šh1guFƒ‡b”¨n–§Dbo&WŽbQw¡g”·e~྾ïÊ¿ö¾“Ât_m#HSETEYF\I\B\A]@hBlChBg@U>\@h Da=c@c@\@aChAm"Cl@p @t#Aq$@h<`<n <r?t$Ax+DhAv$@ˆ&@Ž%;¢4C§6D²AH¹DL¿FLÄIPÈKTÍU[ÕZ[ØVWÕ]aØbf×cfØikÚdkÚfjÛgmÜimÚimÚjpÞjmÜhpÜpqÜnrÜpsàvwà{} 煇猆戄æzå|å~{à‚ß|zÜu}ØrwØspÈnhy=a<„.FXCR=UAZBXB^B^Bm'Fh@o&G`<k>a9d@n>›LX5Jˆ-DŒ7JŽ7EŠ/C€(A„.D6F|'Bf<pLp"JăƒØš‹×†sØŽ~ÐxfÉqÌŠxËŠvÊŒzÊŒzÉŽyËŠ|Ĉ~Ć€ÆŠ€Ä†ȇ{Å„zǃzƇ}ć€Æˆ|¿„{Á…Á‚zÀ…€¾€y¾|»z¹||·|z¶xxµwt°qr¨jp¦inŸbl¬dj۝~ñÑöТõÖ¬õתöרôÔ¥ôÓ¤ôÒ¦óÓªôѤòÐ¥óСôУñЧñΤðÍ¡ïÌ£ð΢ðϦðÏ¥ò΢ñÌ¡òÍŸòÌ ðÌžòË òËœòÊœóɝb<^>^=d>c@c>a>b@rC˜;KªFP§HT©FS´JSÅ^eÑdbÖqhÛwjä„pê’xë˜|ì›îì›zîœ|ðž}ðž‚î—{ìwåqàsbÒ^V¸DO˜1Jˆ"Dˆ&L”;Z¨\€¬Qt¡Nl†3`v.\s-]ŒKt€>ev8b`JVELDNHr:fx;lQH`Pf"^Z[}W€œy£‚ZŽ€TŽŠ_–‰Srœ}°Œ\ŒŒ^’€N‡v;wp:tsBuœpœÀPv¾Eh k–r:d’Y„¤JiÓ–„êȱÀŠjh$G\IUGZI[J`!J^ H]G`De?l Dm Dd?W@`Aj"@_@f<l@^>\<`;j Bi>n<t!>t&Ai=b;l>v$Dn ?{,Bh=q;†+@€:!8˜0>¦<G®<D´CO¾FNÅJPÌNSÓWZÕ\_Õ]e×`b×cfØhfÚfnØgnÚglÛkkÚmpÛnpßoqßtwá|}ây{Þvxãvv䃃拉猆蒋鑎劂æƒ~â~}ß‚€Ý|~Üu~ØuvÔyq®RZ\7b:v#BVBVBVBVDVDbEi$Il"Bt,JfAf:j<a>gAo? S_‘7LŠ0F‘>QŠ1F…-G&@‡.F8N{(Ep>mKp H„†ÖšÖ‡zڐÌuiʆxʆyʐyÌ‹|ÉŒzÉŠ~ÉŒ€ÄŠȈ~ÇŠÃ…Æ„dž~Â…}ņ}ÄŠÆˆ|‚yÁƒ|Ä|¾‚º~z¸€¸}v¸{w¸|y´zx´wv±rr©lp¤ek£`l®imÞ¢ðÄ•öÓ§õ׬õÕ§öÖ¦ôÔ£ôУôТôТôÐ¥ò΢ò΢ôΠò΢ñΤòΤñϤò΢òΣòϧñÌ¥ñÊŸñÊšòʝñɘòÈœòÈ›ñÆ–ôÆš^:`;b:a<c@b@`>`Ft>•6H¨JT¬JS¦DR´LVÉ^_Ñd`×neÝ|tâ…qèvêœ{êšyꚀëžzížyîœ}ðžƒîœzêŽxæ„oÞraÐ[U·CJ—.F†BŽ*Hš7R¡LhHl¢Ji‡8fw/Zu5a€;aˆGmr2\`"OXJNFMFu at mx6gPIZNf"Vj)j~Pv˜qœQuB}„YŽŽdž‰]–•t¢’h¡’m Œ_˜†Tn9vl6n¡y¡°R~ÒLd±p˜r7bKx™Pv¶u†Ð¹¶t:RXJf FUDZB[E\A\CZC_;i$Eo'Fn<`AX<bAn"@`?b?l=c>]<`<f=n>l=n;r ?lAf<g<t"?o@s"=k=m>‡.A€";r6ƒ7ž-=¡2>®:B¶@HºBIÅJNÌRVÔVWØ`d×`cØacÖbfÙfjÛfkÚinÜorÚmtÜnpßtxàxxä䅄၂âƒæ„„叉蔌葉玅萌准䊈߈†Þ}~Üv|Ú||Ïun‹/IX>kAw$CTAUAXDTBbHb!Dm$FhAo%Ca;q$Bo!@b:l;x A O\“8P‹3I’@V:M€'C€'?ˆ.DŒ3Hv$B~&GkEr$LÂ…‰Ô•Öˆt؏‚ÊtiÆ‚tLJxÍ‘|ÌŒxÉŽzȆ|ÊŒ~Ň|ȉ€Å‡|Ć{È„{Ć~Ń}Ȉ|Çzˆ~Ã…{‡}¾†|½‚~»€|·||¶}z·|vµ{y³xx´uv®tt©lp¤hpž`j²prଋòËžöÖ§öجöת÷Ö¦õÒ¢ôÑ¢óСòΡòϤòΠòÏ£ôЦòÒ¨óШóФòÏ£òΞòÍ ñËœòÊžðË òÉœñÈœðÈžñÈœóÇœñÆœóÔ_:]>]>`>_>]@]A\@t @—;L¦IQ­JR¨GT°GRÆ\^ÑhdØneÞxoã‡xé{꜂êžvì›|ìžwîî›|ïž}îšxëtè…qÞs_Ï\T´CL”+G‚B,H–4Q¢Nf–GhKiw&Rj)So*]h#R\ƒm0YZLa OUIOHr<ft2fQF]"T\Ts2r„M€dŽ‚XŠ`#Xb&`i3eˆa–h¨™{­—t°j‘fšQ’p8yžz¡£b–ÁHjÆ€žˆBfn5a•Ut£X`Ǭ¤i)Pw:U_LUIZH\H^G[D^H`@p-Lp$DnBb?X9d?m"B]?\<f>f@Y>`=`?f;k<p>k?r<j=h@q!Al>t%?t"Ah9€-Dƒ,Ao6p4€6&:ž0>¦<C²=B¼BHÇMPÍUZÔZ[ÓYdÖ^cÖbhÙdjØejÚlqÝsxÜsxÜqvàzyá}€ã†ƒåŽŒäŽŒæ‰ˆæ†ç‹ˆèˆæŠˆäˆ‡èŽäŽçŽ‹Þˆ„ÜxÜvxÖ}xÅgfj9W?v'BgBSBZFZEUF^F`Fn'Fk#@m @^<s*Ee<e>jAy$FŸVb•?P2L’DWŠ6G„(B…0G….Cˆ*Bv$@….JbBlI‰Œ×™Ö†~Ö‹€ÉykÈ„~ʇxËŽ~ÊŒ|ÈŒzÇŠzÆ…ă~ƆĆ~Ä|„À„}Àƒ~Ä|Æ{Ɔ{Áƒ{„zÁ{¿‚}¼|x¸}z¶{z¶zy´{x³vt³ss®qp©np hjŸ_m¹wv紏òÌŸöצõÙ®öק÷Ô¢ôÏšóÎœóΠòΟóϤòΦòÒ¦ôѧóѤôÒ¥ôÏ¢òΠò˝òÉ™ðÉšñǘñÇšñÆ™ñÇœðǘòÅžòÆšòÄ–ñÀ‘^=^<aBb@\<[<`B`Dt#D‘5H›<K BQ£CP¶HPÉ\[Òh`×leÞ|lã†qè“yì™ë›vëœwëšzîžyîžxï¡~ï›|ëpè†nár^Ò^X´EL’+D†"CŠ,J“7R G]¢Pp€0Vk"Nh#Rb!Tb&R—kŒj*XY!N`#OWLTNk4^t2cRJ^!RWQj,i^Š”j˜…X‹f&^Z S] \l5p„Z–u¨–s§†Z•”s¦’s«„X˜”h•ªnœºf“Âx–¯G`Fv…I`…@[l1Lh)Nz6QTLWI]Gl$F^D[D[F`Dq#Dr"Dr"CaBZ?dBq&D^>_E`>n>_;^<d=`>k @m?n>l:k?k@p$Bl<s"?t(Ch>z(Bƒ,Ar<d7g5u3†";š.<©0<°8DÁEJÊOTÎT\ÐZbÓ^aÒaiØcjÙfnÜhnÝmpÚrvØstßvzâyyä~}捍䒍厊匊萋把半犈葑瘏唎ކ„Ùv}ØzzÑzx´JQa?\>v%D^FWK^!JVJXJ_ J^Gn$Cr(Ef:`=j!<e<b>l=x#AžT_•=R5O’GZˆ2G…*D‹9H†0Fˆ.Hv&@‡/Kp"HjHƉٜ’؈|֏†ÈxoÆ€wɉxÊ‹xÊ‹ÉŒ~ÈŠ{Ljz‚zÁ‚~Ć}Ɓ¿‡Á‡À…€¿ƒ}¾†~¿„Â…{Á…|½„}º‚€¶{º|z¶|{µzxµxx³zy¯vtªqq§nq¢ckŸcn½€x긎ôСöÚ©õÛ°öÖ¥÷ÒžóΙôÍ™ôΛòΝóФòТôÑ¥ôÒ¨ñѦóѧôΟò̘òÊ™òÆ–ñÅ–òÈ–ðÅ•ðÄ’òÓñÔôÁŒð¼‘í¶ˆêª‚^B\>`D`C[B\AY@[>mA‚.E˜:L¡BPªGRºPXÌabÔiaÙngß|nå†tç“xè™zêœ|뚀ìzížzîž|î |î›|ì’té†nâr`Ð^X²@K‘*F€ D‡(H’4N G^¤PbcG^GbLYRe.Z•_~€<dVJd$Pi)XVJo2`l*]RGZNSOTU]’œt¤’st2hZPl*jl8p{I„ˆYŽ‹d™’j£—z®–x­†Z“Œ_š›c–´tŸ´~“Lv–Dk‡Ia’N`^%No+N[#JX!KUE\FaD\EYBXDa@r @t@u$B^@V>eAx(C_@`B`Ai$FaA[@d@]:b>k Bn!Bh<l!>d=lAn#Ep =t'Df@r#?~+D„+Bh<a:a5s5‚9’(>¡0A²>HÂJLÈRVÌSZÎTZÐ\aÕ`i×bf×cmÛkkÜrtÛqvÜvtÞv|àvy䂂≄扈捍撍璑揋匈玊䎋⋇݀…Ørz×yvÆmlª@IY;[<s#HZHW"M^$LX$OX L]J_!Jo%At.Id;f?e>i@i<l@„,E¡Wb“>LŽ/G”CT„.Fƒ)@Ž6J‰/D0Gx"@ˆ3LjFgHȆ„Ö–ŠØ‡w׏„Æ|tŁyÄ„uĆzÈŠyŇ|ň}Â…€Â‚}Á‡Ä„€Å…~†ƒÀ‡½…~ƒ|†~À…¾„|¿‚z¸~}»~y·|z´||²yw³xw¶xv±xt­rv¨nq§jk bl£dkÉŠzóÒ¢öÛ­õÛ®öÕ¦÷ОôÍ›ô̘ôÏœòОôСôÒ£ôÒ¨ôÒ©ñЦôΡó˝òÉšñÆ™òÆ“òÇ™óÔðÃ’ï¾Ží¹ˆìµ„ê«|äœz؇eÃgOa?\?]=\=[<Y=Z<\Bf@y$B“5FžDPªHTºTZËcdÒd^Úqià{ræ†tè’zê˜ë—xë–{ëœ|î›|ð~ð›~î’tç†ràuaÐ^Y¬ALˆ)Ex D{&GŽ3N¦[t€3Ub F\DWIj)[v>j€<]4^YKd&Sl(Vd"Rp.\h,ZSHUKUQJPR‚ ƒ²’sš‡P…_Vs9ro5q{D|‡WŽ€K†Žf Ša”œ†¶˜‚¶˜}°Ž^– s¢¸‚¦¾Ž¨x4cyAfŽMeŠIdZ"LRKT"LTJZJ\J\H\JYHd Jr&Hw+H~,HcAWBc>v(D]@^Dd CgBe D[@b@bA`?f?l!@j Bn%Ck%Dh>nBn!Co#DgBo"D‚.F†+By"Aj<e9f9n:|:Œ,Bœ.@«8@­<I²@KÀJMÅV\ÇU]È\fÉ\hÓbiÕgkÜjkÜprÝrxßvzâ}€à|~åˆ‰æŒˆæŒ‰è’Œä‡„ã†‚ä†‚à…„ß„„Ûz|Ör{ÐsrÆgd©@NZD\Ej$LY%OZ$N[&PW$O\$L_"L_ Is+Hr*HbDm'Ga@fBgChA„.JžQ]’?S‘;NARŠ5I†0F;NŒ8M3H~,HŠ8NmJl#LĈŒØ’…Ø‚xÒˆ}Äxp¼tp¸ur»|tÂ}sÀzÃ~wÃx‚{†‚¿~À†‚À„€Â„~Á„|Á€¿‚|„|Àƒ~¼|½€|µ}~¸}zµzw°yz´zx²uv³vw®ux¨no¦hlŸcl¤foÔ˜zïÃ’öÓ¢öÚ©öجõÕ¤÷ПôÍœôÍšôРóНôÏŸõÑžôѤöТôΞôÍžôÉœñÈšòÆ—ôÅ•óÃ’ò¿”ﻋꯆäœpÙ†cÄfP¢FF€- at h;X<[@ZB^@^?X=W;YC`?p@Ž1FŸDP¦FR²IRÇ\_ÑfbÙukàvãŠxéxè˜|ê–{è˜~ꘀízî|îž{ï˜zì‘rè„pßq^Î[T®AK„&DiEƒ/T¬f„¦^„ˆ9a“V~WHNIp-ZŒJro,Tv0Xf"Mg%Se&Tk(Sl,Wc$RTFTHYRKRlDt¢Œ»˜w£^g(\n4er6pf*d€Dx`‘hž{F‡^ˆ™{«„TŽ’nª›t¨¯¸¾‡ª›gŸ£x¦¤iˆ¨n„h1VLHNFSFXJZF\H^F\DmB{&B.Fz&DX=X=g!Bx,E_A]A_>hAjA^@_=c>[<a?f>h@o"An BjCq(Fs&Er(FiDl D~+G‚+Dˆ,E|!>u>q>n:x<{7";† :„":‹&<–0@¡;I¨@KªMX¶TbÀZaË\cÏdjÕjnÔnwÚwzÞxyÞtzá~|㇆䉆劄ჂÞ{zßzxÞ|xÜ|zÕpuÐppÊkhÉ^S—0BX@ZB_FXJ\"MZLX$N`#Na!L]Jn,Jl!DcCiBbBa<gBo$H„.J O_“CZ’>R=S‹8M„/FŽ=P‘:N7I&@‹6Lo Kt)Oȏ×‚Öˆ~΂x¹roµhf°ff¸lk¼rl»vn»uwÀzw¾z¾|{¼~¾„‚À„~„ˆƒÂ„~À…~¿‚~¾‚}½€|¾€y¶¶~~¸||´}|°yx°ux¯vw­su§nq¡dp `k­ouÞ¨ƒñÇ—õÔ¤÷Ù©öÖ¦öÓ£öÏžôÌ™õÎœõΝôΝôÏŸöΞôΠõËŸõÌ›ôȘõÈšòÇ“òÂ’ð¼Šî´ˆëªâštÒ~h³ULˆ0?i8^<X@U>Y@[>`A]>Z<X:X>V>];q B†-DšBPœAO¤ANÁTVÑe_Úpc߀rã†rè’yé–|è˜~é—|ì˜xìš|ëœzðŸ„ð˜~êŒtã„lÚn_ÈTP¤<Iz H†7`ºšÓ°°¥Lm Ut±t‡UEOGc M~8`q0YfJl'Ph#Qa Np/Z]H\LWFSHWLMPa4e Œ¹~©Ÿ­ƒJ†€L‚z?ub$`p6m”h˜’w¢J„q;o…c–}S“o¢Ÿƒ³®’¶¢y¤ q¢­†¦·™·±«•fŠX)SQNRKUKXJ[JZG[Il E‡2L0Ix)EZAT>e<{-D_?`A\A_?hA^?`?d>]>c=dBf@n!Aq%Bo"Cp$Dr%Ds%Bo!Bh=p!@‚&A”6G‹-D~"=z@~#?Š/J.MŽ6O”5OŸ>[§H^®H`¯Lc²Kb³Qc¾UlÄ\lÌXhÑ_jÖdtÔdzÚuÜu~Ý|…ßz‚á‡â‹âŠŠà‚Šà~†à}‰Ý|ƒÖp|ÈhrÆipËlb½VUˆ4KYF\F[L\#NY'OY(SY La%M^"L^Go,Nj$Ff Dd@a@_@d=r$D€,HœN`“BV‘<P‘CR‰<R„4Lˆ4L8L6H}&DŠ0Kw*Px*PÌŽ‹×Ž{؉Èyr¯ff®`b«Z\¬\`´c`µjn´nn»ml·tu¼rr¶tx¸wx»~z¾~~¿|zÂ~z½‚¿…‚¼‚¸€‚¼€|º€}·|x´zz±yz¯uw®tvªuvªlp¤jqžcj `l¹xt䲋òʘõÖ§÷×£öÒ¢öÏœöÌ›ôÌšôΝõÍšô͝ôÌ›õÌœôÊ™öÊšõÉ›ôÇ’ó’æ¨~Þ’nÎvZªMJ€-Bc;Z<T7U:Y;^>^@`=`A^>X>V<X9T<Z;q;‡-A—=G˜;Ož9J¼IRÎa\Ùqeß~oä‡yæxè–|ëš{é–véšwë™wêš}î™zî—{ê‹päjÚlbÃRP¢7S˜Agتܾ¬–JT|$XšRmŸc~TGMCUG~>gv4]aKj$Pj(Rf#Pm*S\H`JTFSETHNOb0`™|¨–n¢¥ˆ¨—jœt8dy9kf&b`!]~Hs—w›zC|n6t‹o¥o®t>x˜{§§Œµ ~¥‰Tˆq2[“Nm§†®‘´“ah0YNBM@RDVBZGZDlCŠ0H…4Hu(GT<R=h Cu$B^B_@]?^Be@c?\?b>c?_=e@`?g?m$Cj#Ei?o!Al!Am Ag=j<€'=‰,A‘-B0E˜1H¤?NµLZ·OZ¾Q`Æ\gÌajÒbkÐenÒptÐpvÏjmÌinÊlnÎpzÒnr×uyØuz܇܃Þ‰‚Þ„}ß„~Þ‰‚ߏ„ޏ‹à“Šá•Žß”ˆÛ”Ž×•–ÕšžØœÃ–£av{A_e.MW#HY'PZ(NZ#NY$L[!H^"N^Gl#Dh"Fe D`>^BaA`=t%D|*F›LZ–HYŽ8M“FVŠ:T…2L‰8N‘:N0I}(B‚,H{+S~5WЖ‘ׇtÕˆÁmh¦X[¬bb¦RX¨V^¯ZX¯`f³ae°bb®fi¶on±hl²nt¶st¶tuµwx¹vu¾~xÁ|¾‚~»‚€º~yº}z¸}|´yx°x|®xv­svªqp¨mp hp`i¡_kƉ{꼏õϝöÕ§øÕžöÏ™öË’öÌ–ó̘ð˘ôÌœóÊšöÊšõÊ–ôÈ”öÇ‘õÇ“óÁŽí¸ç¬†á~Ñ…o¶ZQ‹/@e;X;T:O:R<`<n<p>eCf DfBfA\=W=T:R<X;o<‚)=3CŒ0D’1E¶OTËdcØobÞ|sã…wæ“|è—|ê˜}ê˜|ê˜|ê–xé˜|î™}î™zèŽrã{eÖh`½Qb±UxР¯â¿¢GLˆNmr%TžftŒLaX KT MPD|<d{8an*Vi&Tl&Tt2`_H^Iq1]VIXIXJVQu>s™v¨’fŸ’hŸ€¬„N„u8fj.d[Ob%XwFswAƒZ˜žŽ·“qšv>|R‹žˆ³¨’ºšw£x at xb"Tu6`´”¨¾¢»¦ƒ¨f1aGCNFSFUE`Dn@.HŠ8Ks @T>T=o*Fy(B^@]@`>^>cCh?\>a>b>\<aAb>d Dg An"Bj<u&?j>f<f8c8t$=†,D’3D“6I¦AO¶KX»O^ÄZfÊ]`Ð`dÐ_fÓ``ÔcfÔlhÔihÓheÑjkÍljÔpn×jk×mrÜtwÜzwÝ}yہ|Þ|{Ü{zÚ€€Û€xÚ‚~Û‚|Ý„‚݈à“‰ä›‘槜貝鸣ᷥЭ¤²˜‡\{j9]R#IW$MUJY$M[E^EfBf BaAX@XCi!F`?s(F{(G—KY”G\‰7O‘FX:S…2LŒ5J;P’8L‡-F†,Hy&N‡:WÓ•Õ€jÖ†}¸ff¨QX´\\­Y\¨O\ªSW¨U]¯Z_®Z^­^c¬_hª[c¬bi©bg®fk¯jn®ln²ps·ss¸zzºzwºwv¶yz´z{´z{°xz±y}®ts¨or¥jq¢gnœaj¤dlÔ—ïÀ”öПøÔ¢÷ÒžõÊ”öÈ’öÊ—ôÊ•ò˘ôÎœòÊ›ôÉ™òÈ”ôÈ”õÄ”òÂí¼Žç®Šß›|ÒŠu´e_Š8Hf:W>S@P:Z>e8w"=ƒ.F€*Di>i"Dl$Fd!Ed@^?Z>U:V
8l=z!=†/A…/F/E¯KQÌcb×lbÜ{må…vèzè–{ê–ê•~é˜|ê—|욁ì~î—{èŠrâzjÕklÊj€Û«®Ü°Œ’BH}0Ru&Pc K[xj*PL?MDNFw8^„Bhp,VdNl)Rn)R` M`Q~Dmd!Q] M[LXPp4j“k™•m Z’šxœœ~©|Fv^&UNK]#]‚WfŸ“x§Ÿ´€PwD|RˆŒe’ž¦”T|”iŠƒFzd P–_vÓ µ–«¢‚¬a0`MKSFVFbEs#Gƒ-GŽ:KmBXDXBt.Hx-I]C]CbF]B_@fB`@_=`>_>_@bBbBjBo#CkAl?r#Ce?d;f@m>‰-C”2GŸ:JµFSÀQXÊV^Ð`fÐ_dÐ^gÌY^Ë_cÏ`aÐbcÒfeÑedÌglÏihÓjoØmpØpqÛvuÜvtÚzyÙ|zÛwwÙyvØvtÙut×xtÙzwہÛˆ‚ß”‡âŸŒâ¨–çµ¡è·¥ìº¤í½¦ì¾¨à¼¬À¢¥“k†n?aX,QW(PYH^HeEc E^BVBXB^DdEv.N‚1L—GU–Ja†2KŠ;PŒAZ†3M„0L:OŽ6N‹1H/Mw,U‹>[×™”Ö€n΀y¸bc©Zb°]e¶cd¬Zb¬V\ªYa¬R]®\bªX`¬V`ªYc¬Z`£Yd¨\b¦\g§ah©di¯hl­jp¯mp±pr¯pw°tv±uy¬sv°ux¬rs©or¤ktžfrœ`m¨dnØž€òÄ“öÏšöҝø͘ôƐöÈ‘÷ǐòÇ–ôËœôÊšôÉšöÉ™õÈ—ôÃŽóÀî»”굌⦋ה|¿rj—DLoB\BS:W;a>k @})DŒ1GŠ4H‡/Hx,Hu*Jp(Hm%IhCfA`CV@W@f>{#?‚)A‚%=ˆ,B¦BLÄWXÔf^Üthå‚sæŽxè”}ê”|è–zè’|ê•|ê–}í™wì‘wè‰tâ~vÚ~Šß­¬Ó’u4Hx$H‡8[f"T|<_¯xˆVDLELCLDn*VˆDjv*TdLg&Ri'S^NeT|Ej~<he"S\M[Nf&`q>n‘j˜šr£†S…“m——w¨p7w`*fq9tƒP†˜w¤¡’¸k’h1jwJzF‚|FŠf”—p¤~Dn}@lt8v„Ii¬ˆ ¢jƒ¨Œ ¡‚¬T"MODVFf Es)P,H‘:LhEWCXDj%Fy/NfH\Fb D\CZ?cCh"G`B`>bCbDfD`@eAm#Fm&FjBl Ce@i Af<m>‰2G–7K¢:K·J\ÂT^Ê[`Ð]`Í_dÎZaÌ[`Ê]cË`gÎfjÒbcÏejÐhlÓknÖilÖgmÙnsÜqqÛvtÛvwØsrÚrtÔqqÔtuÖqxØrtØvuÝ{ÞŒ‡â™‹âŸŒãª˜æ´žçº¤èº£é¼¤ê¾¨íÀ¬î«⿭Ȫ¨œu‰sDg[,NV!G]G[H` HUCTCZCdFp(GŒ>W•IW˜Ob†5Pˆ=Sˆ<U/L†2I’=NŽ4N„+G…8Wx,V”H^Øž”×iËvr´be²bfºmoºhf·jj²[_°ag¯[^°Y]¬V\©U`¨T^¨T^¥P]¢T`ŸS^ V`¡W^¥T\¦^f¨^e§^g¤bm¨bi¬hm¨joªlo¨kp¤ip£fmžfnœ^j§dqÚ ~òÂŽöΘöКöʏõŐôčõÈ‘ôÉ—õËœôÈ™óÊ›öʘôɘðÀŽí¸‹ê°‡ä¨†Ý–Èzj LTr=]9Z:_>gCr B+C0G’8MŽ5J†3I™NdBZ‚5L{,Ft%Dj>f>_@a?q>}$>{$>t<~"<–4F¾NRÐ`XÚtjãƒtèŽwé–zè”xê’{ê“|ê•wì“xí›yí“|玅䌎贞ٌr£EP€#Dx$I~0^t+V´‡šWaMBJ>J@K
->\ H€;dy.YW@d%N_H^J`P~GkNys*[l)Zf%Sb$YUQm8fœx¦’a˜|Axm˜fŸ”o«˜t²˜w­¤”¶š†¨l3du>}s<x†Z€Jˆ~N‚”q—‹Vm.kh›£rž¸”¯£f‰w6]«šªh”RKTBcGnB~(EŠ0HaBRCUCr,H~1J`B\@bD[A\>^>i DaA_@bB_Ad=aB`>l"?l#Bk Cp@hChAf>k:*C’8N¨=K¾LVÂP[ËYZËX^Î\_ÐZ]ËZ^ÊZbÎZ_Ð^cÑbhÓdkÑjlÖhn×ijØklÚknÛpnÙrsÚqpÖkjÖrpÕllÖpp×rrØroÛ{xÞ€zà’„á–‰â¢ã¬•æ´žæ¹£é»¢ê¾¦ë¾¤ë¾¥êÀ¨ì¿¨ïÀ¨è¿ªÏ²©¤|u@\Z BR?Z>O:N>P;`=p!D‰=U‰8LšPb‚/J‡:T†8O‚/Kƒ.K’=P4K~&E~3Pr#JžQbÙšÔ~lÈtmµfi´lkÀqmºljÂql½ni¸ed¶fd³bh±^c°\`«U`¦Vb£PY£P[¥OW¢OWœLWšL[¡Q[¢Ua£X\ [hžX`œX` [b \d \i\e]j—Xc˜Uf§agÛ¡„òÀöË–öÌ’öÅŠôËóďöÇ–ôɘôÊšôÊ›òÉ™õÊšóÈ›ðÀ’봊䧄ړv¾fX–=Fq<Z7[5f=n>t"B€*E‹1G”8H’7L‘5J”?N¢kz cv›RdCW†5M}.Gv$Dj@jAz"@x:t<n6p8‰(@­BKÌWRÚoeâ‚pèxè“zè“yê–ë’tê”x薀ꗈꡞ갢朄à€lÆ[Z¤APˆ'I€,R˜Ko§rŠ¯nsi$ILBRBO?NBXCg$S:bn)Ux;fM:SB^Lr0[’R{|6fs1dj%Pr>lKENLˆd…qœ`Œs8ja)UtAiƒM|‘l’Ÿ®uFqo7vxF~‚P†x?x‰b—ˆ^–†YŠ[†P‰”f˜²ŒŸÅ–¢•Tn|7hvB^ª”¤o8cVAgBmB€)DŠ5K`@RBVCx-C‚1L_?^BbA\>\@Z<jCf>`>a@]?^?a?dGl$Hp&Ci Bs BkBj?g>f:~(DŒ5J¢<K¼MVÄY`ÁX_ÆV\ÏZ]ÎZ]Ì\^Í\aÏ[dÌ[fÐ`jÔjlÑhhÔfkÖgjØglÜjmÙlsØln×jr×moÙklÔnsÖpmØpoÚtqÚ|wÞ„}ᒃ☌䧐殛貜縢鸡꼤꽢꾨ìÀ§íÀ«î¾¦ïÁªñĪîĭ̲¨ wf5TQ<L8K<M6`:n@‡1Jˆ:O˜P`€(F‡;Pˆ8Qƒ1J‚,H9H‡*D€*Dz%Er$N¦XgÙ’Ò}pÈtrºlnºsn¾trºqnÁrlÄvrºke½jh¶hh³eh³dk®^e«Xb©Xb¦S^¢MW¢KUžJT IZœJU˜DTJVšOY•KX•LY–N^šLX U_žX^—R]GXŽDYžUbØ•yﻆöɐöÉ’öňõ‹öŏõȘóǘõÈ›ôɘôɘöÈ•óƖミ嬈ږt¹f\„,A`<^<c>m>z&Ax&B~(D†*B‘8J”4G‘4J“9L–<N¦q€¦q€§k{ _n“I]Œ=P‚4Lv'Dv$B„,Fy<s9j8n9…&?¨>GÉTTÚncâ~næŒ{ê’zê’~ì”}ê˜zë–z蔂砏ð§Œìš|æˆtÛtgÌ^YªBTŠ,PMwª`lЩ£w(DT?M>L>L=O=VARFr-WŒPw‚ItG7L=[Nm&W“`ˆ†Drw2ew8exCrJ@JC^"TbŒx§•g›|JzCvv:pƒW‘p™^#Z€UŒƒVL††T‹ƒLŠg˜fŸŠ^’‹Y•a–f}°’­„Cj~:ct/e|Dež|Ÿe"MiChB€'D…/I`?T?U=y+C~-Ca>`@a@Z@\BY>iBg Bd@_B[A\?bBh BfAm$Dl"B{0Ip!Bl@g=b<q!>‰0F¤?JµHPÀPUÃRXÌXYÌY]ÊY\ÊV\Ì\dÐ[`Ñ_eÏ]dÐhkÑfgÚddØdiÙhjÚjlÙlnØinØouÖkn×km×om×rnØvvÛxuށ}àˆ~ß•ˆâ Šä«æ¯—ç²–æ´œè·šé¶œê»í¼¥ë¾¦í¿¦îÁ¨í¿¨ð¬òëóƯéȱÀ©ªWvR#CH<J<[<q&D€-IŠ<O–Ob},L†7L3L}.I~(D5H‚,Eƒ,Hy)Kr$O¬^kØŽƒÒzqÃvxÀvzÀzu½xt¾vpÀunÁzt¼rl¼qr·ooºlo¸jj´hn³fi°bkªYa¨Vc§U_£P\ LYHT›FT˜DR–JVHUAV‘HXšJW§W[§XZžRU?Q„0J–DVÑ‹töÈ’öÈŽöÄŒõÃŽôÇ”õËœôÊšôǘôÈ–òÆ”ò•걈ޗ|ÀufŠ5D]6`;pA€*D~,Bƒ+F€,E…0G3F“8I‘7J–8J•8L“7L©|„§u„¨t‡¦r} bpTf’AZˆ7N‚1Lˆ4K~(Dr=f>h;€(D¦>HÉTRÚncâ‚qç‹tè{é’wê’zì”yì”|ë|ìš~í•zë’rè…rßtbÊ\]¨C[˜Dd³gˆ»w}ÆŠ‚W?RCNAQAQ?TDR?WNi(V‡QuƒHpE9H<PFh%Tp–‡Fsv2b†R}w at iTIOETHo4b[ƒa‡›v¨ˆTŽRˆ˜|¤„Th.mc-e‡b’ˆ[”ˆ[ŠY“v at nœ‡¶‘j¢’hšw¡£b‚¢iz¨ˆªu-X^JŽR„ vƒWbCgD‚(Ax(D^@R;Q;|5Ix-GbC`Cd!E[?\CW>f!IdDj'Ib!F`B]B`BgBdCi Eq%H|,Hz(Fo BjBc@r B‡4KŸDV²HR»NW¿NUÅQZÇY_ÌX\Î[_Î]dÓ`dÐ^`Æ_hÎaf×fgÚehÚkhÙjjÜnkÙjlØlmØmnÖjj×mnÙrrØppÛvtÝ}yÞ„yà‚á—‡ã‰ä§Žå®•å°–æ²šç¯–ç²–è·ê¸Ÿê¹›ì½¤ï¾£ð¿¦ðÀ¥òÁ¦ñƬôȲòɮ׿®œ~”\-PJ:V<n"Br@†:K—NZx$F‚0J4N{*F~*D1G„(D‚0Ju Ep#M¶lw֍Ðyq¿pnÀ|zÀ~zÁ~|¿xuÀzwÅyr¾wvºsr¸su¶rtºqr·noºmn´jl¯fk¯ah®^e¨Zb§Wb¡P\ŸL[˜FZ”JXBR?S“FV¤T^´ca±`XªWZ“CQ0L’>PӍsð½ŒöÈ’õÈŽöÆŒôƐöÊ™õÌ ôÉšôǘõÈ–òŕç¦zÜ’jÀhYŽ8Gg<b;s$B‚,F‹4J†2J…/H†6JŠ4L”7I”<L˜<K”6H”>P”9M¨zˆ¨v‡¨}‰¦y‡¦s¥hvŸWj—L\Ž@U@N…3F{#@d8e4€(@¤>HÈRR×ncâ‚qæ‹{èzç’yê’xë”wì”{ë–zë•|ì—{êŽwè„lÞrfÆZ^¹dºuŒ¯^u¿zzŒH]RFP?QBR<N>Q?ODv;r•U”Y†DsSIGDXU‰UˆŸvšu0`y7hHra%PXKQHi,`‡N|u2cd"XzJyŽ^–yŸ~Kpd(]k2iq6xh2fŒfšf–_“ˆH„”o¤Œ¸”hœ›tšœY‚”Lb™oyœ|¦ZN^ MŽLp¬†žm,UeD|&EnCYBS?W@‚1G~.Gd?cF_BbD^BXC\CfFh&Gh,L_A^C^BcAhDi"Do"E|,H‰4Jn"DfBbAo Bˆ6J•BU®HUÀRXÄQXÆRXÆVZÍY\Î\bÏ[`Ð^dÃZaÊahÕdhØhkÜikÚnpÚlnÜlnØkmØhhÙjnØde×mrÙstØttÜxvށyÞ‡~à’„áš‹ã ‹ä¦’ä«”ç²šæ°•æ®™è±™è¸œé¶ éµœë»¤ì¾¤ï¾¤ð£ò©ðĬòÆ®òÈ°ò˳åʱ°š¤m:ZQAfBeBx1M‘K\u(J}2N4Ny(F„0GŽ9L'D,GlDs%MÀ{€Ö†zÎwjÀqtÊ~yÈtÄ|wÁ~|Á~uÁzvÀxt»vu¼uvºtvºtw¹sv»rv¹or´jm°go®bj¬elª_f¨Ze¢R_¢T]›Tb”HV‘@TŸOY®XZ¾k`¿eYµSN”DR‚+I›FTÚ–wñ½ŠöÊ–öÊ•öÈ•õÉ”öΞ÷ΞöÌ›öÉšôÈ•ðđ窀؄e´UQ|$>_7a:u$Bˆ0EŽ6LŒ0F‰1I‹3H:O–;Lœ?Pš@N˜AM’7I•2G–7N¦x†¥t„¨}Šª‚’¬„ªy‡¦lw \l™K[–EUŠ7H}&@f8e9z=§<HÉVUØplá€tçŒ}ê{ë”xê•zè”zì–xì˜zî™~ï”zêŽqä€lÝmdÈ_eÒ‡–Ü¥¢šC]¨^tv.RPBPBQ?R>L9N8H
-<VF‡Ip›d’p¢šb W’›lžiŒ|8`r.fn,^k.Zs:rPLf+c’a‹€Ald!Th(`ƒ^hr;bn5l^$[h2ft?up;uq at ra–”jŸ–eš£…²ž~«š­–ršžvœm'RaLˆg{ˆ`ŽMLm/a¡m{˜l_Ew"Fj!KXJUFTF6O|.JfFfHaHbE^BWD] He Hh$If$Ha"GaD^Ba>r%Fi%Hx%Gw$A‹5Hy%Df?hDmA‹9Lš?S­LYÂRTÃRZÊTYÈT[Ï[aÐ\aÍ[`ÆZ\ÆajÔad×diÛikÚnqÙpoÜmmÚlm×nmÚddÙfk×fgØoqÛrmÜvlÝxÞƒyàŠ~à‚á”ƒâ˜‰ä£‘ä¨’å®“å«–æ®æ²˜è²–é²–é´—ë¸›í» ï¾¤ïÀ¦ñÀ¤ñħòƬñÆ®óÈ°ôʶìÌ®½¦¦t@^\>WAl$D‹BTp"Ft(Dy,Ht"B~(A‹4J(C„(DfAr#JÄ…†ÖnÊunÀuŏxȁzÆ}vÂ~xÄ~zÄ}vÀ|w¾xy¾yz¼wxºxwºux¸qu¸tv¹op´op³kp±in®cfª_h¨`i¤Zb WešSa™GW¢OV·\YÈjTÄk\µXP›BN‘2N¶^Zà£~òÄ‘öʘö̘÷˘õÌ›öΙøÎœô˘öÈ•ôƕᅬݛr´\Wz$>\@Z9t!B;K”:H‘7F‹0FŒ0GŽ1H–;M?O CRŸDQš>L‘8K”2D˜8N¢n‚¤v†¨‹¬ˆ“°Š’®„¬|‡§m|¢`h›P^;K‚(@j=^
7w @¤=IÈYV×njâ‚tè‘zê–}ëšyê–{ê–|ê•uë˜víœ{í˜vêŽnä€nÛkjÔ{ˆéƸԕ„=]‘@Z1Yd"RTBP>V>P7T?P@VCk)Ta!Jc%J|;`VvLlu1\n.[v8hc!Vb([k0fx@|”fŽŽTu^HTHo2b”y¢m-X^"Vf.ba$[]"\r>r€N†r<t€R†Œb’—n¢žx¤šw©šz¨Ÿ€­£«ƒDuHJvB_¶¢°|H{\Jƒ?f·›ªl(OlD`CRBRBRDz0G~,IhDfA`Cd H^FSD^Dh Cl)Jj&F`EbD^E`Dt&Hl!Fz&H},H˜:K’6FiAe=h>Œ8P–9N²P[ÃPSÆQWÍWZÍ^`ÐZ\ËZ^ÄTXÊZbÔgk×ik×gkÛdfÛikÙnlÙllÚlnÚlmØffÙhlØjmÚljÜtnÞzv߁{à…{àŠ€áŽ€á‘†ã–†â ‹ä¢å©’å¨“æª’è°“æ®‘è²”ç´šê¸œìºžì¸ð¿ ñÀ¢ðħóÄ«òÈ°óɱõʳô̵îδŭ¦DdT?j Dˆ:NjBo!?t%Bn C.Dˆ/H+By#D_?t#FÌ„„ցuÇvq½toʃxÆxÆ‚xÂ}yÂ~xÂ|v¾{tÀzy¿|x»z|¼|z¹vvºsu¶su·su¶rr²ln°ko¯gm­ho§clªal¤`k¢_kŸR`¥X\ºbVÆkXÈjUµXQ¤DQ <PÎxeè³…ôÆ–öΝöÎœöÍœöÍžôΝ÷ÏŸöÊšóÄŽòÁé±Î‚jœBP^=Z<p!D9Mœ>L–>N–8L“8K2I•9NŸDQ¤FR¨JUžCPš?N“:L’6Hž@O l~¢t‡©~Œ¬„”­Ž™®‰•¯ˆ“«|‰§nz¢`j”HV.Fl @\8y#B¤<HÄTW×nfãƒuçyé™|ì˜yêš|ê—}ë˜zì˜yíyî–zèŽrå~lÞnnæ“”öо¸nzTr;\`FdJ_J[EbJXCWF\Ei$Rv8_XGLEh'Rw5_n(Rk&Sb!N^Kf$Ss4gzDozChx;]e#PNBUP‹]‹™{¤XR\$Vd(\n6me)dd*c}L€‚PˆxA{zD|‹[v¦œv¦˜r ¥“¼ž‚šŸ{¢SQSJ´†º£½m*X‡F{žvPwh@Z@Q?TDSFv-Lw,HeDhB]E`E`GXG^GcDl(Ir(H^B`A`E]Gv.Jr*Hv Aˆ1K£?I©BKt#C`;_;†0H’4H¶S^ÄQVÉPWÎVXÏa]ÇU]ºO]ÆW_ÖadØfkØmlÙhjØdgÚflÚjkØihÛmjÚjhÙklÜjmØouÜqrÝwsÝ}xá€xà…~àŠ€â‹â‚ã•…ãœŒäžŒä£Žæ£æ§’ç¬æ¬—é¯”è²’êµ˜ì¶—ì·žð¼¢ñ¾¢ð¤óèóÅ®óÆ®ôÊ´ô˶õιñϲĪ¥s;ZeE€4Ll#Fm"Fm#Fu'G…6M‡2H-Iy*J\G|.QÔŽ‡Õ|mÄxr»wxÇ€yÅ‚zƃÀ}z¿~|À}z½|w¿‚}¾zx¿}z¾yw»wx¼x|¹ww·tx¼vy¹ss±nr±lr°orªjt©jp¦hr¤ai¢\e«_Z¹gZÂhVÄjS¹[O«NR²NTٍqﺉöÈ•öΛöΘ÷Í™öΛöΛø͝ôÈ”ðŠ북á¡s¿n^ƒ*C\;k@ˆ0H›;L˜=L—?Q—:J”7M˜6JCS¨JR«LR«HRžAM˜<N–=P˜<P£FXœl€h|£r„¬‚¬‹–¬Ž˜®Œ–ª‚¬x‚©tz XaŒ<Ls ?a7z#@¢7FÆVX×ohâƒrçŽvéš|íœ~êšuì˜|ì—xìšyí{ì•vèŒpänßqs蜒îʬXr¼o}±xŽJ
:S@P8\Bf Hh"KfJh$Nn(Sx3Xf#QPDr/Vx6\j#L^Hf$Qh(Tf&S`!JXDVCVI`!PRNXRV~ŽgŠm2jPH`(`p:kn6lj0jk7j‡ZŽK~xAuK›pœŸ«œs¢œ ŽbŒšwšˆVŒm-n–VrÌš”¡r”€Et@V°Œ¥c JXHTFVJWL|4Qv.Ok!Hh#Lc Jb$L^$KZ L^!Jd%Km(Lt.M_"Ib"M`$Nc!J€5Sy/Ls"J‰6R©FW­HU…0MbF]B~-J’9P¸ZfÈW\ÈT[ÊSZÅW^¶N\ÃW]ÔfmØafØceÚjnØfjØgmÚimÛmlÛnmÛhiÙhjÛifÛlhÛroÞvqÝxtÞ~váƒ{áŠ|߈|Ꮐᑂ┆⑃㜇垇䤍䠊夋毎讐鮏鴗쳕췘ð½ ðÀ¤òĦòƪñÇ°ôɶóɵóλõѺîг¿ž p-Nl!<n=c>l;p!@-Dx"D„/H},LYE†4NÖ”‡ÒufÄwrÂwrÆ~xÅ‚{Æ‚s€xÀ€x¿}v½xrÀ~zÂzs¿zx¿{x¼y{½vv»wxºuw¸vv¹sv´rx±nr°mp¯lpªitªjq¥dl¥cj¬``µdYÃjVÇiUÄdP¶TPÂ_SáŸyð‘õÌ›öΙõКøÍœøΚøÎœøΝóÈ’í¼‡æªxÕ‰e¯XSwAf@~(Dš>Pž=Lš<NžAQœ@Qš;K<N«LV¯TW°V]¨JVDR–=N•4J›@O¢AQ‰JdSjŸl~¦yˆª‚’°Š–°’°Œ˜´Š•°‚‡¥fm@Rr >b8| ; @LÅWZØneá€rè‘xê›zïš~íšìœ{ì{ìšzî }ìšyêpè„nàphÞ€zᵪ˜Ah˜HT¤fjJ=M>S@T;ZA[CX?^Ao2Xl%Ko+R]D]BZ!LXDZKw:h}>lf(P_ IS@PBQCp5^^"NPFZ SuBoˆV…b&[VLh*`d)\p6nk/ltBtŒ^–€F‚z<t—n›¡~«œt™s¡`”“j” x¡ŠMz–Y‰“Rl¦„žr8l]J¸£­v4ZRESHQERC€5Nt(Ij%Fl&HaA^@]DUDaBb"Hj#Fx,K^HbDa@`@s#Bz*Ew$F’6N´MR¹LPš8Hh;^<|(F‘6K´YdËXYÊPV¿M[¸T]É`cÖ^aØadØbiÚhkÝhiÙhiØlkÛjfÜijÜojÜhgÙnlÚllÛllÛqlßvrÞytá}râƒxâ‰}à‡zà‹€áŒ}㐂㖆✊㚄䝊䝉妎棌馐觋ꮑ쵕븚ð¼ ð¿ óèòìòÆ®ôɳôʶôͺõνôÒ¼îÒ²²ˆ•c?j;^5e:t;‚-Dt!B}%@r"D\C”@RÖ“„ÑrdÂtpÄ|tÆ‚{È„uāxÀ€x¾~xÀ}u½ztÀ{wÀxt¾zvÀ{v¾xt½zx¼xx¹wz¹txµqt²rx·qs°nt±ot¨jr§mt©flªgl®fd½h^Är\ÇlSÅcO¿[RÐw_ꯂóŐöОöÎœöϝøÏš÷Ðœ÷ÐœøÍ™ðÅ“éµ…à›tÉrXžDPx Dz(H9N CRœ>Q™8Lž>Nœ=Oš?R§HT´PY´TY°MT¢HTœCR˜=Nœ@Q¥GU¤JYm*L~:\—\rŸp…¦}Œ­Š˜¶™¢¶˜˜¼–˜µ…‰©pu—P^u!@`9v=£;GÆVXÚsjä„qè{ìœzîœ}ìœ~ëš}ëš{îž~ï¢|î˜yétékârhÚ‡Ê~‚¢Xx{/Qf AL=Q>V@Q;T>]@UA^Dr3\\@e#HeHTCUBQC\K…JxˆK}d!Mk-W\KKCQFr<_v8gLDNKf1c‡T‚GvYQ^$Tl2jo3fh,fn5s|Q‚ˆYy>v–k˜¡¨šn—˜pž|¯˜n›¦†ªŠEodƒq%Ux|ª…ª\O¾”“še‚L<N<OCR=€3Fr%Dn@p"Ad@`A^@TCb@aCq&Ht.K_D_=Z>\;r#@{*Dz$E™>P¾QUÂSV§EPr<b<r"D“9M²PbÊTVºER¾O[Ìbf×fdÖ^_×\\ÚfhÚhfÛhgÛilØheÙljÛghÚhiÜikÚghÛmpÜqpÜnlßtnÞxqÞzqâ~rá‡{â‡zâ…}àŠ~ã~ã‘äš†â‡âš„ãœˆæžŽä§ç¦‹æ§Žè¬’ì´–ë¶˜í¸›ï¼›ï¾žñÁ§òĦòŬôÈ°ôȲôÍ·õмõÑÀõÔ¾çͶ—dwi@Z8a8n8{'@n>r%Ch=[A¢J[ד†Îq`ÂvmÇ~vÅ€vÀtÅrÁ~uÀ€uÂ~w¿|uÃ}zÂxt¾xvÁ|v¼xz¼||¼wv¼yy¾ut·tt²rvµqt´rv¯mq«luªjt¬il®in´hfÄmZÌsXÌqUÆhSÄ`SØ„f﹄óÉ™÷Ñ öКöÎœ÷К÷Θ÷Í›õÊšðĎ讀ւd¸XPŽ1J{(HŠ4MœAN¡CQ™:Mž=NŸ@NžBU¢FV¬PX²QY¯RX«LS£DTž@Oœ:P¡AQ HX¥KYZ<n'KˆKfšf|¤wˆ­Ž˜·œ¢»šž½š˜´‹¬xzž\dz.G]
:t>Ÿ9HÆXYÜphäƒrèyìž~ðœîš|ëœ~ìž|î {ïž|홀ëwæ€jàvtâwÍš¥ª_p‚2Tk"LO>O=R>R>T;\AUCu<bh%LUD\#J^A^GTBSHf%UŒS~…EyXBx=dj$QOBNCd)RTWOPH_(Zz>tt;f}Cy_"Zh-bw:ps6ni4ih2f‚[‘€D|“i–ŽZƒ[Šb’Ÿ‚²x§² ¾¬yžª[r[Ie*J¿¨¯:p°€„º›L>N8M:Q>{,Bn$Fm Ar%Ff?eB_@V@aCcCl$Fo$Ea"HbH]@Z:q#>x(B|$Bª@LÃUXÄRT°EJ|!:`:q$B’6G§L_¾GTÁMZÒ[aÚcbØcdÖ^aÖ^`ÛcfØefÛfmÚliÙkkÚlkÛgcÛkkÞhfÛjmÝnlÜllÝrnÞpnÞxrÞzsàzràuáˆxâ†yà‰|áŒ|äŽä“‚ãš„ãšˆãž‡æ¤ŠæŸŠè¥Žç®Žè¬Žê±–ê²“í¶™í¸–îº ñÀ¤ñÀ¨òìôÆ°òǵó̶õ̺ôÑ¿öÔÂô׺պ²†<TX;_:m9u=h:r @iAaB´\eÖˆzÌl^¾wpÄxpÆ€vÄ~tÄ€vƁtÂ~qÃ|u¾|rÄ€uÁ~w½|vÀ{u¾{x¾{v½xwºxz¸xzºvy´rtµxy®ru®ns®kt¬ip®os®gj·jcÈpXÍpSÌrVÈpSÇjWà”mò½‡öÎœøÔ¤öÑžöΞöÐœöΙ÷ИõȒâ¢zÉnX =K†,K‡/M”<N DS™>Rœ?R EV¡BR¦FW®OZ¶U\´W\­LVž@Pž@Pœ@R BT¥L\£J^ L\P8\?z9[Zqžs…²”š·˜ ½ž¡¿œ·Ž®{ fm€1I[6n<˜7LÉXXÚvlå„té’|ëš~î|îŸ}îž|훀íž|î {íšzésè„fâsgât`Üž¥Wy‡@`v8]K;M<UBR<VAXAZEƒFl\DUFSDZ*Q]F\EVIm(X—aŒ…FuUBl2Vi#NQ7O
@RD‚Jnt4iQJUK}J~h$Yw at l~Bf$^~L}~Gxq:t`(an<qI€h™|@t”_Ž˜k›d”{©´ž¹¬«LtN@HC‚Q`–^Ž£tÉ¬´M=J8H6R
:x(An&Dk@z)Dd=d>\>V>]A_Gt3Ts+J`B`Be(L^9p>t<†$@²DNÅTVÈUTµJK‚%>`7j=‰0J£H[ÃTZÎUUÖY[ÙacØedÕadÖchÚ]`ÙdhÜegÜfiÚljÜlfÛmlÜlhÝmhÛjjÚllÜmkÝmlßvtÞxsÞ|uà}và‚và„}à‡zà‰~âŠyãŽ~â”ƒã”ƒã˜„ä™ˆäŸ‰ä¢‹ç¦åªŒè«ê±•ê²–ì¶–î¹Ÿí¼ ò¾¤ñÀ¦ðªòÆ°ñůòʶö͸õϼöÔÃõØÃïÖ¶½‘”\<X:d:r1Kb6q!?]>b@¾kkÌ‚vÆmbÁwqÄ}tÄ‚{Ä€tÄ}tÄ}uÃ}vÂ|r¾uÀvÀ{t½xrÀ|x½wt½xu¼yyºvu½vv¹ux¸tu¶uy³qs²ps®lt¯no¯ls°ge¹eaÅlZÍoXÎvXÐv[Ðw[ä¤uòÁŽõЛøÓ¡õÎœøÏ›øНö͘öË•õÈ“ì¼~Û”r´TNŽ.D‹.H”6L›=N@Q”:N FT£FU¥DS­JU¶TYµRZ®JTBPš<Ož>NžBR¨GU¨JW¦M`ŸJ_N	5V8fGBašk‚®Žœ¹ž£¾¢£Á¢¡º”–±†ˆ£ot6P[4d7“2FÄV[Úulå‚rè’yì›ìš~욀ì›|í |ì €íž{î™yítè†jàxfÔdb·Y\Ä“ ‘JYw0MG<R?VCSAXAZDo3[l)LWATAXFYJVBXB\Im)Y–g‹…K{PCg,Vp*RV?S@L
@`LƒAns.fQDwDug#Zd*[†M€z>yw at s†Q‰…W‰Lˆj2lq=r‰\‘z>v™oœs£‰Xz¬°›¸§ˆ£ŒRz_"UDCd&U£z®¨yˆØÃÂY@MEF?P<w*Cv&Cp>~/I`>b=_=Z=bB^Cq(Gx/L\BcF_C^:n?s=•2H¸LUÁRUÇSR±DJ"<^8d@Ž4N¨K^ÊPTÐRT×][Úbb×^\ÖaeØahÛcgÚb`ÛdbÝgcÛjeÛmkÛigÜkhÞlhÝmiÚmlÜprÞrlÞrqàvnàuqáyqà}ràuàˆ{à†zàŽ€âŽâ}㒄☄⛆䟌堊觏䤎欐糘鲑뵘츙ð¾¤ñªòìòůñÅ°ñ˸ó˸ôͺ÷ÒÀöÖÄõ×»äÊ´ˆE]X>b8j9a7n<W
-8f;ÅrpЀuÃk_ÄvpɃyȁtÆ~sÇ€sÃ}sÅ}rÃzo¿zpÃt¼zt¼wu½wv¼xvºwvºxv·uw»vuºvw¸ss¶tt´sv®os®ps®jm°gl±ed²a]Ãi\Ñ}fÚˆbÞ–là t곈òÄŽöРöÒžöÐœøÑžøÐœöÌ–öÊ•õƉé²|Ð}^¦DL‹/J•6Jœ;L >P˜9N™@T¦GR¦KZ®OW²RW²SX¬FR BP˜:N›8L =L£JY©IW¦J\ H\œLeJ5K	4^Bx6Y˜mƒ®Œ—ºŸ¤¼ £ÀŸž¼–š¶ˆŠ¤ov8NU
-4\3,@Ã[XØrdâƒrè}ëš{íŸyìŸxê™{ì™xîžð ~ñ{í’vë‡käxfÕdZ·P\Ì“z2R^CLAVDT@R<[!N^!Jj&O]EU?WBZGVBT>TA[Go,W›m”~BrQCf'Pz8^^EN
9M
<QF_K„Dq|;qt?qn.dZOq2dz at yw<w‚R‡Š\ŒŒ^Š~Ji0fzDyt:te’£y¨Ÿ‚µœušª‘ª’d…bCh)VRFr&Z³Ž°¾‘¡ÖÄÂ` GI?G>P9€0Et!>w!>ƒ2GaAb@\BXA^D^ Gr)Ep"E\A_?_A_:l<p<š:H´CJ¾INÀRS³AHŒ)?`>i=–:P­FRÊTWÐRT×\YØ``ÖXXØ^`ÚfeÚcbØ__Ý`^ßgfÛdfÛlkÜlfÜmjÝlhÜlfÝlhÞtsÞuqàyvÝxtÞunàztàuß~tâ„xà†yá‰{àŠ␁㔅㗆♇䜊䢎壐复媒讔箘괕캠캜ᄂð¿©ðîòƱñÈ´òȵô˸ôνöÒ¿õÔÂõÖ¾óطÕ™[8\9f8^3a7R
-<t>ÎzqÒˆÁmgÄxmʃrÈ‚wÅ~rÈ|pÄ}pÆrÀ|qÀ{sÃ~s¾|x¼yw¼zw¾xwºyx¼us¶st·svºxu¶st´ss³ru«np«jn«hk°hg²_a¸hfÌxhÜŠqäžuê«xì´òÁŽõÉ—÷ÐœöÒ øÒšøЛøΖøÌ–ôÆŒñ¿†ážlÄgP›:H—5Lž9N¢BPž@R8O¦BQªHU­KW²QX·TW´NV§DNž=O”8K›;M¡?N§JX¨KY¢LašJbL`L6M<[Dq-T–ay®‹–¼Ÿ£¾£§À££Àž˜·Œ¦rtt(BP4\9.@ÇWTÜtfâ„nçvꞀí¢zìŸzì{ìœ|í zðŸðš€í•têŠiæ{fÕc[ªKd¢Ub¨s‡TAM@YFUAR=ZCf(N_D^AYAYDUBUGYESCUK|<j ¢w;hQA]C|=^\CM:R?[LVJd&Vz>i‚Ftv:nYJr5mf-\Hƒ}FxŠ\Œ‚R‚~J}r9pvC{s6q…T…¦‡®¨´£~­¨Œ©¢„¨^KRCz8meR­†¦È¨¶Ìµ¸T:I;B;N
<.DnBw&BŽAT\?c>[@[>`@b@q&Ai!B[A]@c#FfBp@~(D¤AN¾NN½JL¶>G²DH–0Ag7o;—<N¬HTËTXÑVYÚ]\×`]×XZ×[^ÚbdÚecÚedÝgdÜhdÜfdÛjkÛibÛigÝldÛlhÜnkÝsrÞvqàsmßphÞxràwqÞzqáuà€xÞ„wàˆ|áˆ{áŒ⒃䘊䘇䜉䟍垉䩒橐氖毕貕꺠컟ðªïÄ®òƱñDzòÍ·ò˹ò̺ôÐÁöÔÃôÖÄöØÀäʵ„<UY
8`9W
-4_4K4?Ñ€tÖ†s¿lhÇ|rÊ„rƃtƁrÉ€vÅ}sÄtÂzvÄ~uÂ}w¾}u¾xs¿xv¼vrºwtºro¹rr¹rs¸st±tx´pt²ru®lo¬fj¬hk²b^ºb`ÍshÞŽtê¢zí³„ð¸†ñ½ŠóŐ÷Ì™÷ÒžøÓŸøÒœ÷ÑœùΘõÈ•ôƍë³~׊a³ML›:Kœ=L¢>M¦BPž=P¡AN­GU¬IR²MT´SX´OTªJQœCT–=N˜>Nž?O§EO¨LW¥JWžF]™K`NbH
-6R@XBl(RŽYtª‡“º› Â£¤Â¤£½œ˜·ŽŸipo+HN
:]9“2DÄWWÚteà‚së‘xì|ð¡€ì |ìŸ{îŸ}î¡zð ‚îŸvì–uë‹kå|hØha¸e~¬_p«hjPHWLZHRDUE`&N`"IXE_EXBX@VCZH[BRKXRW„¤¢x8cNAQ>}8\j(NN9bKaMUA`(P\K[Eb%SVIu;mf&\{H}‚E~ƒR„~J|xE|n4kwB{r:uˆVŠ£|¤¥Š²w¡£‚¡¨ŽŸx>qK?_J^P¦~™Æ³½¶•ŸJ?K=KDTA‰8Jv&Fu$C’CU_EgA\D^HaAcDt(FfEY<Z<_>i;r=1H°FL»HK­?HºHN¾PS›0 at f:l>š>O¨CRÊPVÕ[[ØaaØ_[Ù]^×\`ÛcdÜhbÚgdÞhdÞidÛfbÜf`ÜhaÜjdÜkeÜmgÛolÜliÝpnÞtnÝplÞsoßyrà~sà‚tà€x߃xá„zà†{᐀⏀▇▂❌⚎㡐嫓媓媒殕籖궛뻠ᆭðÁ«ñíòÇ°ðŲñ̺òʸðÌ»óϽõÒÂõÔÆøÖÁò×·¼…ŠZ
-4\	4S.\
-3O6ˆ.EÐ{lׄrÁqnÅ~vÈ‚sÈ‚tÆ„uÆ„uÄ|rÅ~pÈ€tÂ~rÃ{tÂ|r¾|x¾|r»utºyv¸ts¶ts¶tt¸tr²tr°np²nj¬lm®gi°ffµd^ÆofÜŽqé§òµ‡ô¼‡õ½‡öÁ’øÈ“ùÐœøÓ¢ùÒŸøÒžøÑ›ùÍ–öÈŒñ½‚ä¢oÊjR§@Jž8M >M¡?LŸ<M AM©ER­LV°LU¶RVºUV²LU¦DN™>P™;M>P¢DT¨GR¨M[¡HVšCZ›NbœPdI2L
-5V@j,WŽVo«‚¶”žÀ ¥Ä£¢¼œœ°Š‡ kpt-HL5[
-4’+@ÃXUØr_å„qê“uìž|ížzêžzëž}îœ{í¡xï¤}ñ €í–yêˆlåyhÛg^Ø”“¯epz?]NEa GR?Q@a#Od%QZDX:`BU>T>[F\DUBRIa%Zšsžœu˜v2XL>O=l+Mm(OR<i)Qf#KUDb.XWLO?ZO\Ph.[r4jj8j‚N†R‚‹^’|L~s?um4rg2nˆZ‘¢~¥žy©^‘¬Ž²Ÿt–_†YGNFZNŸwŽ¿°»†VhREI
-;I<]>Ž:Hr Bz'C†5I`<j D^A`<a@e>p*Hf(K[B\<b:n?u:–:H­>F²@J¼GPÈZZÅST6Fg<o;™BU¬HVÊRTØ]^Ø`_×\\Ú]\Ú``ÜhdÜfdÜdbàhdÝheÛhdÛb^ÜfaÛhbÝibÚieÝjgÜmjÜtpßqkÝroÞtlÞxrß{qà}tà~wà‚zà‚wâ‹}àŽˆâá“à—„㗅㜌塋䢐䨖殗宗泖鵜깢Eð¾ªï«òÅ®ðIJðɸñ̹ð̼ñͼòÐÀóÓÂ÷ÖÃöØ»àÀ®u @X:P2X	4N8”?OÏzgÑ|lÄysÅsŃuŁrÄpƃxÄqÄ€pÄ~pÅ~pÀyoÀxt¹|x¼xt»xv¸tr³no¶pq·roµqs¯ru¯np®lqªhj¬ef®ef¹baÔ€q殃ò¾öÅ•ôÄ“ö¾‹÷ÂŽöȐøÒŸöÕ¤÷Ò øÒžúÑ›úÍ”öÅŠì±sÚ‹a¼VN¡<N¢<J >K£;IŸ:K§DN®JW°MV´RV¹UX¸UW«HS?N—@Sœ:MœAR¥JS¨IR¦JXžH\šI_žSgšQeI1K3O
-7bJŠRmª‚³¼ž¤Á¢¡¾Ÿœ±ˆŸmqv0JQ2^7Ž)>ÁTTÚrbå„lé‘vëœ{ì¢xíž|ì {êžxí ï£|ðŸzî—tìŠhæzcÝf]ØŽˆ¤^jn9ZN?bJTC]Gh)O^DWAV@Z?XBT<_IM
9L@NIyJ‡žp–œjŽu.ZNCQBYDa$LT>r4\cJYJZJ[$PTCXKWHZLt3ji0bw=v„Q„c’~H{l6ik4n`%f‡Sƒª³—nš•j›¦²’m”ž|¤“_’j)hd TªŒ¬««v;`’s¡J=H<b@Œ7It$F|,H~*DaAg>c=d?b>bBg?bG^$J_De>t"@"<™5GÀFNÄNQÊWZÌWVÇSR 8He
8w"BŸ?N´JUÌOPØ]\Ø`dÚ`cÛaaÛ`]ÜgdÝdeÜc`ÝhdÝedÝfeßd_ÜeeÛebÞfcÚfdÞlfÛsqÛrjÝrmÜtnÝrjÝwoÞ{rß|tÝ}vß‚xáƒwá‡}âŠ{ãàŽ‚à“†â˜‡âœˆåžŒä Žä¤Žæ­•å­˜æ±—ê·žê¸ î»¦îÀ­ðÄ®òűðɲðÈ·ñȶîͼð;òÑÁôÐÁöÕÄ÷Ö¾îÕµ¥fpP6N5U3P5§LXÒwdÐvnÈ{qÄpÆ‚uÇ€tātÁxÄtÁ~tÄpÄ|p¿|vÀ|qºtq½zr¼wr¸tn¶tr¸qn´rp±or­ln­kp®moªln°kl°`bÃjbáž}ñ¾’÷ÌœøÏ ÷ÌšöÄ“öÄ‹õÉ”øНöÔ ùÔžùÒŸ÷Ϙ÷ʍò½€çŸjÏsX¬JI¡<I¢>J¡=L >M¡?O®DN°GPºSV¹TW¼TX·TZ¥ESš=P˜:N>N ER©NX¦MX L[šJ`šHZ™Mb•H^G0I	2L6^D„Jl¦{Š³‘¼ ¢Å£¤ÂŸœ¸Œ¤rvx1KP0\6†&?¾VWÛr\å†pì”vìž{ï {ëž}ì {ìž~î¤xï¦zòšwî’qì‰dçyaÛh\Î}u’HdR>PAdH\Id"N]BZAV:W<X?W@ZBXAJ=JD`*`œz§›f‡—f„q0XL>NAR=` H\Dr-S^AbJS=ZJVCa"QWHTHl,\b)Wj4ju at o˜pšˆZˆ^ R^![a&e…X‹¤ˆ®žz©¦„©¨­B|€Ll¢~¥I~™k¤¶¤Â¡w« |¥À±»\GK?d>„,Dk?x(Cr"Dj Bg@j"Di@`?c>h@b@^DdGhAu?’0E±GTÊRSÌXZÍY\ÎZWÆTR¢:Hg9~,G›<L³LTÐRTÖ`]Ø`_Ø`bÛhfÙdaØgiÞe_Üfdàe`Þd`ÛcbÜhfÛhfÜf`Ûf_Üh`ÛnhÜomÜpjÜqmÞphÝtnÞslàymÞ{tà}uÝ€vàƒ{à‹}áˆ{áŠàŽ€áŽ€ä™…âž‰ãœˆâ¢Žä¥‘æ­‘æ¬—å±–êµœé¶ í¼¥î«ðªðűðÉ´ðȵñʶðͼòͽñÎÀóοõÓÃø×Ãôض̜”T
-2D-M2R	3´Y\ÎreÐ{jÄzpÆŠ|ȁsÆ‚uÄ~vÂ~tÁ~tÁztÁtÄ{u¾{q¿yu½vq¾wo¹xtºxr¹sp¶qn´rt´qr®kn®jm­mu«ik¬ei´aeÊp`ê°ˆòÉœøÒ¥øÔ¦ùОøÈ•öÈ”÷Ì™úÒœøÕ¦ùÔ¢ùÓœøЖöÆŠí²tߊ`Â\O«BIªAJ¦;F :H 8H¥<L¬EP´KS·PU¼QSºRW­JTŸCS›<O˜9O AO¦JV¥KZ¨O]žJ^›Lb™Mb˜PcŽDZG	4I3N7[B‚@b¢t‡´”¾¡£Å¤¢ÁŸš¶¥tx9MT	2[3Œ"<ÀVXÜoYä†të’uî ~î¡{ìŸzì|î¢~î¡{ï¤zð xî˜qìŠhå|eÚh^ÊrlF_VF\Je"Lf$N`HR
:YBS;[<X>XAYBO@MEd&XŽ_’Z‚‚Fg…IlbINAM?QD[Fj)Pp,TU9b HO8O=VEh*T`"PP>k/^d&V]&\`$[‹d’g”g(df.htE‡‹c– z¦Ÿ{¦§‰²®’³ z¦ˆDq¦r—x5h¦ˆ²®•±lˆ’qz†_jQ@V>n"@}(Da?r!Bm!As'DeBf!Bl!Bd@h"Dd<c=`?f@z&F(F¡:HÄTRËSXÏZZÍZ\ÎWVÅTV›-Dk;†6LŸ@O¶LVÑTV×WR×][Ú]`ÜdcÚhdÛgaÝefÝicÞfbÞf`Üd^Þd\ÜecÜgbÜhdÜidÝhdÞljÜlhÞnjÜrkÝrpÞxtÞvoÞzsà€xà‚{á…zàƒxÞ‹}àˆߎ€â„ã˜‡ãœä—‰ä¡ä¦äªå­˜æ¯šç´œç¶¡ë¹¥î¾ªí¾¬ðƳïIJðǵðȶð̼ñ̽ðÎÀñÏÃöÑÀ÷ÔÄöÙºãÄ°r)EE9H4X
6¼_[ÍndÎwkÃxsÌŠ{Ä}pÆ‚y€sÃrÂzpÃ|pÃ{sÁ}u¼xtÁzr¾wp¼zs¼vp¹xs´ql²on¶sn´pn­mo¬kn­gh«de¯bd¶^_Ñ}iôÍ øÖ¨øÔ¦ùΚùÊ”öÌ™÷ΛøÓŸ÷Ô¤ùÔžùÑšø̏õ¿‚è nÖvU¼NI­DL°?F¤=H¡:H 7F§AN«DO´NV¶TWºTU²MT¦BP @R›>Nœ>R¡FQ¥NZ¥L\¡L\šMa˜Pf˜K_“J\‡:RH.J4M
-:\CDc t„´’›Á¢¤Æ¨¤Â¡œµ‘¥xy‡BTU4\
-4†#;¾QRÜp_älë”vî›yíž{íŸ|îœ~îŸ|î¡xð ~ì˜nëŠjå}iÙjfÃbbŒCdbOh%Rj&RZEXGS>X>X@Z<[>Y@VDRH^L’d‹|Fj^LƒNz~Bdg.XTEPCSF\!Kv4]k&LR8`GR<Q:[De(P`#RK
-=a)Rl.`a [j:p‡cœŒZŽŠ[’~L†TŽ‘f–¡x¢¢|¡¤z‚Knœw ¤z¦¨²²Ž´Ç®¶¡}[BG9K6f&Kk"@y(Bs @]@u"Bj>n$Bb?f Bf?a?l$Ad@b@bAoA€(B-F­DKÎWSÒZXÒ[ZÌXZÌTTÀLO&>g:‹<P >M¸KTÓXVÖXVØ\]Ú`_Úb[ÚebÜgdÞj`ßf^àgdÞh^ÜgcÜf_ÚheÚjgÝjdÝjhÜhcÝnlÞphßpjÝrlÜpjÜvpÜxnÞvmà~rà~uàwß…à„|á‰~⌁⌀⑄㚌䝋㡌㤐妑䮘沚浘踣뺦뽩íÀ®ïƱîÄ´ïÆ´ðÇ·ïʺðÉ»ï̼ñÏÀôοõÒÂöÕ¿ïвšYhA1H5a:ÀlgÎl]ËzjÄytÈŠ|ÄrÂ|rÂ~rÀ~vÀ~sÀ~t¿|tÀ{r¸xu»xvºxt»yrºzv¹us·wr²rs±rr²qq¯mm¬jm¬fg®fe²`a»b`ÖŒrñ¾ŒõΞ÷Õ¦ùÒžöÍ’öÈ“÷É‘øÏž÷Ô¢÷Ô¥øѝøΗöÇ‹ï²záŽ_ÌiT¹NP´IM°HO­BN¦@J¨?Jª@K°GP»RR½XT´MR®IU¢CR=N<O CS§KZ¦O]¤N\žL_˜IZ–DZ”E[ˆ<Qˆ=XF0J6H5[A|Ddžvˆ°˜¼Ÿ¢Â¥¥ÀŸž¶¦yy‰JY]8\3…$?¸PTÜqdæ„pê“vìŸxìœ{ìœzëžxêžsèwëxîwè‘vä‡rà~rÖplºZm”Lsl'Xg%Ne"PTAS?T>Y@W<X=Z>WGZLi*Zn2[j.PQHYJ”b†~<bn2XVBTARB`!Lw7[h#JT@XAU@P@YDf&Rf(WLA_(QAq_OTIf/`n4f‰]Ž”kž•s©–jœrŸ¦‡¨—i|6p‚Kršm›v¢²‘´º•«¦€¨†YŒ^&Z`'IBXX<x,BjBdBz&DfAn$Dk"Dk$BeCd<o"B`=c<e<}!@‡)@–4G¹GMÍXSÑ\ZÏZXÎXZÍ[[ÂPN…!<h8;N¢@QºKSÓZXØ_`Ú`\ÚbbÚ^\ÚdgÜgfÞfaßlfàkfßebÜdcßf`ÜfcÛe`ÜffÜhcÜieÝidÜjfÞjbÛliÚpmÞupÜumÝtlß|tß~và‚z߁y߆~áˆ~àŒ€â‘„á”„ä•ˆä›Šâžä å¦”ä­˜æ±Ÿç²šç¶žêº¥ëº¨ëÀ¬îIJî²îÅ´ðƶðʹñ˽ð̺ñÍÀòϽôÑÃöÓ¾ô׵ǐG0D5g9ÃigÐn^ÊwkÅ|vÈ„wƃv¾|vÀ~tÄ~p¾~t¾{p¼{s¾xm¼yv¾znºwp½zs¹xt·xr¶tq´st²st±pp¬ovªjl®lo¯fe´c`¾jhÛ’wñÀ÷Ðœ÷Ò øÍ“öÆŒ÷ÆŠö˘øПúÕ¦øÔ¢ùҝøÍ’óÁê¢nØy[ÄaT¼RR·KL³EJ®GOªAIªCL«BM°HP»PQ¼RU¶QU­IR¢DRœ>Ož@P BR¥JX¥LZ¡L]žJ^–JZ•CV‘@Tˆ9R„5RH3F0L4W?w at b tˆ¯š¼¡Â¤¢¾  ¸”§z|Uac:^2„ =·NPÛodæ‚në’ví›|뜀痂æ˜~ä˜|ß”}â—‚åšä’{à…uÝ|rÒki¸fy§kk(UXFYJTCVDW@X>W@`HZFWHm3\€Fp]EUFTGbM…Ai~<d~>bVCWHTDc*Pd"Kf(QXCU>VFTC]Jj1ZXFZQi+V}Bpe%VTFUJZXm:njœœ®špž”d“Ÿ~¦–l—ŒU~}>hs:_zQp’s•’b°ŽŸ¾˜«£x¡ªv “Rz>nŽGfo&Hf Cj Bk F}0L‚9Pm>e@hAi>d;`<f<†(AŒ)@Ÿ5DÀIKÌZXÏZ[ÐYYÐW\ÏZX¾NR?j<•<N¨GTÃRRÖWR×[WÙb^Ùb]Ú_\ÚefÚjiàidßojájbÝhdÞe`ÞjcÛbYÜ`]Üb]ÜfbÝg`ÜjbÛlfÞndÜpgÛmhÞqjÞulßvrÞypÞ}uàxàƒxÞˆ~à†yÞ†zâŠ~áŽâ•„à”‡á–Žâ¢Œäª’ä«“å³˜æ²˜ç³Ÿêº¤ê½«êÀ­í³î²îųðƸðÉ·ð̺ò˺òÏ¿ò;óÏÃöÒÀöÔ¸Û¸©`<D6w:Æh^Îs`ÇzpÂ|sÆ„vĉ{¿|t½ztÁ|pÀ|t¼yo¿yr»zpºzt¸vt½xn¼wr¹wp¸zs¶ur´ts³ut¯lqªoq¬kp®gg°fe¹c_Æmcà–zòÐöН÷Óœ÷Ê–õčöč÷Ê”ùÑ›ùÔ¦øÔ ùИöƈð¶yâŒ^ÎhUÂZTÄXTºLN²GOª=G¬AI§CMªIT¬FL¶PV·QR±PT¨DOž>Nœ;K>NŸHV¨MY¡I[¢Pc™EZ”JZ’BZŒ<T‰>Y…6RF/D2J:U>v9^šj}²—Àž¡Ã¤¤À¡º•¬~~U]]7[0‚#<·JNÚl]çƒlí’wîœ{ï~êœ|æ›~曀㚁堆蜀è“qè†nâygÕlmÆr„®bl&Rd&MRBVBX?W@X>T<`B]DXBe*Ma#GUA]HZKYH‚Bk}?dv2W^HRD_#Lc&OWC`$J^EYHZEZHZGd*S^R^P|Bk}@qYJTHFBQNi5nf˜£„¬“f•™r§˜qš˜pœ†Fl†JuM
-7O:i0Kp1XX:h#A†?QŒG[†Rp o“¦lž\Œ¢sŸ˜_‰”Y{†>Vj@n @c>c;k>a;e>o>†(B™4I¨@NÇOQÐ\ZÏWYÒ[\Ò]bÒXV¶HM%FtA›?P«HTÆTZ×[V×]^Úc`Úd`Ûa`ÛabÜfeÞicÞljàjeÝhbÝidßgcÛdaÛc_Üb\Úc]ßf_ÞjeÛheÞohÝneÜmfÞnjßwrÞzsàymÞ~yà~và}xß„y߇{߆~âŒ€â’‚â”‡ãˆà˜ˆá¡ã¨Žä©”å­˜æ°šæ³ é¸¦è»¨ê¼«ìÀ¯íòî±ðÄ´ðƶñÊ·ð˼ñνðÍ¿ñÐÀõÑ¿öÒºè̯‡=WF:*DÇh]ÌtgÄ|sÀ{sÄ€rÄŠ|Ä~sÀ~v¾|r»{x½~t¿}tºws½xo¸wr½xs½xr»yr»zr·xt²sr¶ts®mn¬jnªgh­ge´hdºgdËnbå¡|õÄ“öϘøÑš÷ÈŽöÉöčöÊ“øÒžøÕ¦úÒ¢ùÎ’ôˆé¥jÙyYÇ]TÄTPÅXV¹KN²JP¯BL¬CM§?K±DN³JNµPS²NR¬DL >Oš<K9HžBQ¢KY¤N\ L^šFY˜DX˜F[‘<SŠ>WD[‰AXJ	4H2G6R>n1U–dx°Ž•»šžÃ¥¥Ä¢Ÿ¿œ™®„„ŒS`c8\9‚"@¹NQÛk]æ…kê’yìš{ï›yìžyìž{럀ì|í¡|îœzë•tèŒkäzfÕwuÆm~˜Fjd"ObFXG[DW@] FX>ZA^BY>U@YBVD] Jc#LXEXFw7\r5^j)PbFYGg*S[HUC`$Gc"H[BY>S@Q@d&R^ RXH†Ott8fL<e,eLE\ Zo4s‡Z‡–lœ}Jvœ‚ª…P‡bŠœlœY~r0cN=`=|FmP>W<x1DI8N;w/Ir/Jl%Kžcf–[o‘JaOsy/Qk Bd=f!FhA^=f=}'C.Ež6E´CLÎUTÏXZÐZ^Ð`bÎ_cÑ\^­;ItB~(Ež@R¯ESÎX\Øa`Ù]\Ûb\ØdfÚcbÚgfÜjfÞigÞkdßggßgbÞd`ÞjfÜfcÚbZÛc^Ûc]Üe`ÚgbÛgfÝkeÜohÛplÝohßsnÞtnÝzrÜzvÞzwà‚yà„vß‚xß„yáˆ{à€à“‚ã‘…á™Šà Šâ¢Œã¤äª˜ç²›æ´¢è¶ èº¨é»«ì¿¯í³î¶ðĶðÆ´ñȹðɼï̾ñÍ¿ò̾óпõлñÒ®´pzF5‘8JÉi\ÍvbÃ|r¾|rÃqÆ‚s„xÀ|pÀ~rÂ{u½|u»zt¹xnºwrºzo¸xr¼xo»yt¸xt¶wt¶vrµur³rqªloªnm®lm²ki¼hbÌn`䤂ôÁ‹÷͘øҝöȏöÁ†öÄŽöÊ—øÖ£úÖ¤ùÑ™øÈŽñ¹|ä•bÔlUÆVSÀPRÀVX¸KP°HN¯HM£=HªCM±GL¶HJ¶KN­FP¥BL8I˜8Fœ9J¤FS¦LZ¤N^žO_–>T”CX”FY=RŽAYŽA[B]I5H2I
-8R?f%L’_uªˆ“¹šžÂ¤£Ã¤Ÿ»œ”«…†Ubf<_4‚%BºLPØl`ãnë’wì˜zîž|íìžvì |ì¡zí¢}íŸxë–qç‹oâzbÓoqÀsƒ—EhbH[A[@d"LZ=V@W=X>\HZCUBYH^"Le(PZFTFc Nq2Yj.Uc!KYD^"L\FXGXGg+Nh-TX@S;N=T>g%SOD\NƒPvr9kMJX$Pv@k,dt at zƒLhš‡[”dŽl …Q‹˜n›žtš–f“\E];„TvR7g>b;H?]@w,HfCYDp1Ja"Ht$GŒ?Mœ]fo&Hh>b;`<_>o@†*A–5F¢<J¼IMÍVXÌXYÎ\`Ð^aÐ`bÎ^[ <In?Ž4M¥FU´MUÔ``Ùb]Ú`[ÚbcÛcbÜggÜggÛlhßhdÞgbÞhdßlhÞjdÝifÜcaÛdbÜdaÜd`ÜfdÛkeÛieÛlhÛigÜlißmjÝrkÜupÜtqÝxsß|tÞ„{Þ„{Ý„z݇{Þ‹}à~á‘„â“áš†à™ˆâžˆä¦’å¬“ç²•ä³ç¶Ÿè¸¦èºªê¾®ìÀ³ïÆ·ïÅ´îÆ·ïȶðɺð̽ñÌ»ñÌ¿ò̼õоóҲРšM	6š>LÇbWÍxgÄ|uÁ€vÄ‚w‚sÁƒ{¼zwÂ|t¿zvÂ~tÀzsºxo»xrºzrºwq¹ytºwu¹xt·xu´vr²rr°oo­no­kl±lm¸lgÀeXÌobà˜sò¹„öÈ’ø͐÷ÇŠöÀ…øÉ÷Ì—ùÔ¢ûÔ ùÏ•õĈî²x܆bÐ\NÅWVÀTQ¼RS¸OU¶HN¬DN¢>J¦:G¬EP®EM°IP¤?L—6Jš8L˜<J¢CP©HU¨OZ¢M`›J^–BV˜I_”DW@XAXF^“H`P9L9L;T>f$K[sª„‘µ’˜À ¤À¢œ¶š”¬†ƒ”Ydf<^:…'F¶LQØk`ãhê’tëšsëžzë yìŸyìž|ì xíŸzî yì™tê‹sàxeÖy|Äv†¦KkgHbEZAdHU=WBS@V@^HUAVFd$Pq/Vg)PVCXKXGj*Wd(Lf(Ng&M^ LR?UDTD]Hu<aUAQ=RB]Fa"NMBl2gt:jk5^s>yTPs at q|Bu?kL|}JvŒg”‰`”„XŠ}Iz‡Zœt¦€¢„Hy[>‡Y|T9d=P<Q>p&Bp<e%H[>u)Dh@m ?a?|- at r&D^@^;[9b:z$AŒ2Cœ6F¯BNÂJOÍVVÐ[ZÐ\^ÎbdÏ_]ÄTV”/DjB“:L¨LZ¼RXÖ_^Ø`aØ`^ÛggÜhfÞhfÝheÝfdÞleßlfàlhàngßmdÞhfÛfcÛdZÛfdÚc^ÛgdÝhbÜjbÝh_ÜmbÜndÝpfÞpmÜsnÝvrÞxoß}uÞ~wÞ€xà‚yÞ‡Þ‹àŽ}áâ‘‚à“€ßš‡âžŠä¦Žä¨‘孒䵝财跥黪켭꾭î´îòíŵðÆ´ïȺïÊ¿òͼòÍ¿ðÌÀôξóжßÀ¬o E BLÉfZÌxiÆxÀ€vÂ…|¿‚yÀ€t¾}wÀ|pÀ|t½|vÂ~vºzr½{t½{v»xt»zv¼zx¸xqµwu²tr³sq®nm«mp°pp¶rn»leÄl]Êl`Ú†dê¨xñ¾ƒöÀ‚ö¿„õ¿€öÃŒøΚúÖ¤úÔžöΕóˆë¨mÚ|XÊWSÂTRÂQT½NR´JN³LV§DM @M¤>J¬DL®JP <H•2E‘.Bš9M¡IW©KX¦L^ GXžJ\•BV”BZ—F\”E[•C\@Y‘Ea“H_L
-4L
-5K8Q>b L‹Ul§Œµ”˜¾£ ½¡¹˜•¬‡†–_jm$Cd<„#B¶HNØj^âiéŽuê˜xìŸyëžxìœzìž{êž|ìŸzíœyì—rè‰gàtfÛ€}Ðz„´`ufEo&PV>`FQ>R>P
;VG]HUIu7b…@ek'L^CTBTDZIh*Sb#Md$Kb#G[F^JZFVJSGd)O`PO<UA^I^$TPF~Huj+``&V}Myn2jQFyT„NyM‡zH‰‹lœ–u¢ˆb“u<nd&]{Fq˜j }§}8bKp\ CdHL<T?r$@j @`;`;o$Dr(Dg>^>d>i#C_?]<^8j:€$=‘3G¤8H»HNÀJRÉW]ÍVVÍ^_Î^`Î]\¹NS#CnD™:N©IVÄUWÖ`]Øc`ÚbaÞjgÜkhÞifÜjiÝgißkeÝjgákfßkgÞhbÞiiÚecÜfbÜgfÙedÛfbÝkeÞg\Þf`ÝibÜlbÞlgÞtoÞtlÞupÛuoàwqà€tßtà‚uÞƒzà‰~ߍ‚à~⏀ߐ‚à–†â›†â¥ä¦ä­”æ°šæ¶¢æµ¢æ¼ªê½¬é½­ìÁ®î³îÆ´ïŲðȸîɼñ̼ïʾð̾ò̽òϺìÌ®žVjªGOÍj]ÊzfÀ|t¾xmÀ„x¾z¼|x¼~t¿}w¿~t¼}y¾zuÀ€s¾~w¼|u¼|t½{u»zvºyt¶zv³vu³vt²rr®np´rl¶nm¿peÉo`Ëm\ÐsZ܇`è¤nê­rí®vî¶xõÍøϝúÖ¢ùÒš÷Ê‹ôÀ‚è i×rUÆTR¾PR¿LO»LO´FO®DK¦<I¢<J¥AN«HPªAJ˜6HŠ&@1FŸBR§LYªLY£HUŸJX™BTŽ@S“BV–BW”BX”D[‘Ha‘JaŽCXR<R>N:M9[F„Jf¥}ˆ´”š½¡¤À¢ž¼š—®……šdlx0Jj>ˆ)DµFN×i_ã|dëuìš}ízìœzí~é|êŸ{ì }îž|ì”qê‰káxhØvvÚ‡„±WmkFˆ>d\BZAL>NBN@_Im&R~=ey:]c!CX>TAPDTGb(Tk(Qf*S^FYFVHh&R_$LZ#PRJZ$It8hRBbLXG`(\e.\m2[b%Wd$Zs:b‚R‚LLII‡pœœ–ÈŠb’—|±‡d’ˆ^ˆL~i.gd+dŒdž’f”˜n “_šzFp˜}¤N<[Dn AeD\Dh Bj Ap"B`>b@`>c>_>Z8a:p >‹1B–5D¨;E¿LPÅPTÊVXÌ[^Ð\ZÏZXÊVW®DNnC~,JBTªLXÌ\^Ø^]ØffÚgfßhfÞkiÞjgÝhfÝmiÞqpßifág`ßgbÞf^ßgaßf^ÜhdÜc`ÛibÚfaÙe`Þe]Ýf\ÝjdÞldÞnhÝpjÞupÞvpÞ{ußzsÞ}rÞ|tà‚xàƒx݆zàˆ|à‹~ጀ⒁ᘄ☄➊㢎䬒䫖洠泠纩黨輮ëÀ±ïóîÄ·ðĵðʸðɼò˺ð̽ðË»òÌ¿ñλðΰ̌‘¸LNÐpcÊxf¹tj¬he¸rp¼wn¼wr¼zu¾{u¾~z¾w‚tÀ~x¼zº|x¼|t½|w»{vº|v´yw´wt´us°op±sqºrm¼tpÄthÈtfÌr\Ît_Ît\ÖZÞŽbà“fê­zöÆŽ÷ÑšùØ¢úЗ÷ÉŠò»}è—`ÒiVÆRP¾MN¸KQ´EM¯DM§>Lž9L£ALªHT¦@N>M’1GŠ.H”9N¤GTªT\¨LXŸHVžGY”?SŽ;T‘AS”F[”H\”BZ”H[H^†8OR:M
7M9J
-9WB~Ddžuƒ°’˜ºŸ¾¢ž¼›–®‰‰žnu~:Pn?†&C²FLÖi\â€hé{ë˜tîœíšzê›}éžzéž{ìž~îžxì”pçˆnßxfÖprÜŽ‚²Zrs&MŒBb^JXCO?OD^ Nw8^{;^h$K[HSBSBTARDVHj-Zd Om-X^I\I`$Nk)Tm,Uc)RWIPCk,W`$N\HQJd*V‚R‚^GUD]Mc$R‚Zm4fOMS IoBdq?oˆbŽˆh–‹e“p8d\R]TxK|g£©Œµ¡v­¤Ž±ŒfN:^@k@^=T<n?c=d=]8b<`=[8]=_:f:z >Ž,D¢>H¶FPÄORÉTVÎVWÌ^^ÎYXÌY\ÄTZ—3Gh?Œ4J¤BQ½U\Ô]\ØadÙedÚfeÛgiÝnjÞmhÞjkßleàqmâmhàldÞhaÝjfÞieÞh_ÚhdÜc^ÙfdÚd\ÞdaÝf_Üd[ÝmeÜpjÞlkÞpkÝslÞsiÜwnÞxlÝ|sß}tà}s߁uÞ„{Þ„vß‹|߉zߐ‚ß–‚àœˆáž‰â¨ã©ä¬”è°ç´¤è¸¦é»¨è¼®ê¾±î±îÅ·ðƸðɺðÌ¿ñʼð̼ïʼò̼ñÌ¿òϸ䶫ÂWXÒw^Åxa°e`¢Z[©cf«ff®ij´nj¹pk¸snÀxs¿~t¾~wÀy¿€w¹}wºxº~uº~v¸|y´{u·zt´tr¶ztÀsnÅxoÈxnÎykÏvfÐt\Éq^ÊiRÎsZÙ„dë®xøȐúÖ¢ûןûÒ“øƉð³qâŠ\ÎaRÁPPºNPµJO°>H¦BP¡9LŸ<N§BP©@L¢=L•4GŒ,D6J?R¨LX¨PX¥HZšCV”AV>RŽ>V@T•EX“F]’DY“Nb‰@R0JN:M
6L
-5NAR@zA`žx†°š¸œœµš·™–¬ˆ†žlr€;Pn>†&>µBJÖfYâ{bè‹të–vìšzë›vêœwêžwì{ìŸxíœ~ë–xèsâ{jÓfeÚ†z´ats'K‰?`b I[CUBUC\C`E_CWEWEXEV@ZHTF\ Jd"Nk+Xj+P_ LYIh,Ue#P_Ic"Ld!La!Ij*N]APCLDk6]}Fq\FPEYNl0c‡`ŽBzi/bUKWKVKWNtHr–}¡„X„[K\Rn0lrBs˜o—¶¥¼¨˜§_$JY<d<j?V>X;r!>e!C`>]<b<]8Z9`;e8j:ƒ(A‘.C§>J¿LPÂOTÊPRÍXXÎ^`ËYYÍXVºIM}@lD˜=R¨EQËZZØ_XÜdbÚbbÛghÞhgÜgfÞjfßkhàidápkàsnálfàhhÞhdâkbßldßlaÜhbÛfcÜdaÞgcÞkbÝfaÜlhÛmfÜllÜphÜsoÞwqÞwmÞxpÝysÞ{oß|r߁uÝ‚wÝ…{݇~ߊ|àƒâ“€à›„áˆâ¢‰â¦ã¨ä°œæ´ å¸¤è¸¦è½ªê¿­îÀ±îĶðȸðȺðȼðÉ»ð̽ð;ñ̾ð̾òϺïÊ·ÒspÓv^¾iX¢OR–DQŸTZOU¡Y^¢\_ªfj®gf´nl¶qt»xu¾zv½|s¾{»z»€x¸|y¸}z¶|tµyu¸vs¼wpÄ|uÉ~ŕoÐ}hÐwfÐt^ÊtdÅk\ËviÖ†kì·„øÌ–úÙ£ûÖžûϐöÆì¦gÜ|ZÉ[NÄNL¹MP²HN«DP¤<Lž7L¤@NªFR£AO•1F1F1G˜<M CT¨LZ£IX H\™FV“A[<R‘@W”CZ–H[’DXŽDYCW„9Nv'?P:N6J5L;TA‚Fd¡x‡­•¶˜š¸œ£º™—®ˆŠns€<Ps#@†&@±BJÕdXß{iè‹pê–vì›zêxìœzëžxìyíŸ{îœyë•tìŠnå|bÔd_Ðtr®_vx,N5Xl%PZCS@R=X@]B[CZDVDT?TD[JXEk,X_Jl)S[L\!P`'Pz>ag*PRCYE\@c#I]AS@OAP?wBjb J`IUJXNx at ui˜Žg—i0^o6jZHX HLFSO‚`z•mœ[P\"RJ~€Gxr4^˜wŽˆVuO
9a=j>e>R7]8h<a:^8^;]5X8Y8e9g;o>‰*?˜6D±FKÂKNÅPTÊRRÊUXÌ\^ËY[ÉXX£9LiIx&F<L¼PVÓ`\Øa[ÚgcØfaÚigÜgfÝiiÝifÞhdßmhàniáncàpjájdàjbâlbàldàkbßjdÞe\Üg`ÜhbÜg^ÝldÝhaÛoiÞojÝojÞqjßxmÜvrßvjßypß{qà~uÝ|qÞ‚wà‡zàˆ}àŒzá}ß”á˜„ᘇ➇⤎䪒殚岝涡踦輬êÀ®ìÁ±ì´ïÅ·ðȼîÈ»òʼñÊ»ðͼñ̼ñ˽óϾóÑ´Ý—ÊlX§LN”@J†4H˜HS‘;F–DI˜KRžOT¤Y]©`d«ef®jh²ll·vv³trºyv·xs¶xt¶zx·~z¸|wºzrÁvmÆ{o΄tÒ„jÔ}gÑx_ÐvYËq[Éo\Ðt]ݐmñ¾ŽøΚúØ¢üÕ™û̉ó¼|ç˜^ÖmTÅRL½KMµEN¨>Hœ:Jš6I<J©BL¦CN—8MŒ,BŠ-F–9MŸFX¤L]¢JY CT›DT–CW:P’@W–EW›Lb˜J]‘DVF\†:R},Em>N5L2M
-8M:WB|<]šk|®Œ–¼ ¡Å¦¢Á¢µ– qt€:Or$@ˆ(@´?GÒe\ß|fçŠrê˜zê–xìœzêœxìœ{ëž~ì¡zï yì–wëŠmè~bÖf]Èbd¤Vn~4V„>^p(PT>N?SA]Fa"IYDYGXCTBTC]Ja&Qe&Lb&Pj(SVIWLd,Ur5Xl+PVDT@S<ZF[CTAR@XDr9bTA^ Kj+^\Tj+`Œd•’g’‘h–\"Ki)TZNJ>VLf1To<Z_#WYM†V†[††G~Œ\y}BbU
7g9l@^9U>b<^8^9^@^6T4X6]7i=u&C~(C‘,@¦>HºNOÂORÇSSÈSTÊZXÌ]]ÎZT¾PO‡&@c>ˆ/I¢ANÊZ\×fdÚd`Úb[ÙcdÚfdÜhfÞkfÞkfÞnjàlfánlßmjÞpnàlhàjfàjcßngßgdàhbÝd\ÛhfÜhbÜcbÚgbÛicÚjbÝkfÜrkÞrhÜulÞxpßumà{pß|qß~rÞ|tÞxÞˆx݉|ߊzâ|ß’~à•‡à•„á˜‚ã¡ˆâ§Žä°—ä¯œæ²¢ç¶¢å¸¦é¾¯ìÁ´íŵðÆ·ðÈ·ïɼð;ð˽ñÎÁòÎÀñÎÂôÏ¿ôԺ亩·ZV‘6FŒ2D€'?Ž6C„,=‹8EŽ7G“DN˜DR›FPžOUŸR\¤^_§ad§bf¯jj°nn®pq°pr³ut¸ywº~{Ä‚w΂oчtщkÎz`ÈtXÇiQÈiTËnWÔ~bå¥zôŐúÒœüØ¡ûÒ’øÆ‚í²râŠXÏbSÀQM³FJ¤=I–1G“0F–5J¢>L¨DMž>KŽ.F‡(BŽ2H•:N¤N[¤IXœDTšDV™FZ”CT>X•BWšN`œOb•EZŽEZ‰>T€6Mt%@j @L4L7J	2L
-6Y@o,P•f}¸˜œÂ¤¤Â§¥Á¥¡¸—–¦z|‹G[n!?~ ?®>GÓaUÞveä‡nç”sè—vèœ~êšyìž|êž}ì |ð |î˜uìkçcÛk^Æ`eŸPn€4Z„;^{3[N>N@ZAj%LZ@WAT@RDVGXHj(Qj*RVDd+Tb&PUKWJg(Oh&Jr.V]EXCXAT>R8]DQ>ZFYBWHa,ii0a…X–„NŽƒN„˜pžŸ†©m;p[Lj0\l0hVCe#L`!N\Jd%U‰b•r/Z‰Jt—b‹d CX;b<f8R
:Z<c>Y<Y:Z7Y8U4Z6b:l;+DŠ,B˜6G´FNÄQQÇRPÇRSÈPTÌVTÉVSÇVT¤9Dd;r$G’:N®ITÔ`ZÖa^Øb\ÙebØffÚfdÜhgÞnlàmhÞohànjátiÝkgàgeàjeàndándàlbÞlgàiaÞe^ÜdYÜhbÛd\Üf`Üh_ÜlcÛieÞpdÝpfÞrhÞrgßvpÞypÞynÞ|sށvށuÞ„v߆x߉váŽzà’á”‚à–‚àš†âœŠâ¤Žå¯˜ä®—ä²æ³¢æ·©é¾¬ëÁ±ëĵïŶíƸïʹñ̼ðʼò˼óÌ»ñÐÁôпöÓ¼ëʶ±UZ…,D4F…0J‹:L€)B‚+B„,@‹0@Š8J9F“@M“CN–DP˜MU˜JZœR\Ÿ[`Ÿ^d¤`j¨gj¯rs¹tpÄ|t͈vҐzÓŒp΁jÃv]¼eXÂjYÈlW؈eöË•üÕ¡ý× ûΏó¿~éžbÚuVÈYR´FL¥:F˜4EŽ,C2G˜8H¤BP¤@L—6H…&@Œ0F™>N¡HV£NcBT—BV˜CW”CY“AV’BX”D\›PbšOc”F]EY‚8Pz-Fl<n;L3H2H
-6L
8Q=h#O–j|µ”˜À žÄª¤Ä¦¡»›‘¨~~”Wcn<&@­=FÑ`WÞviå†pé“wê˜xê˜xêž{ëž|ì›zïž{ïžvî—xìŒnç~aÞodÃX^¤Uu†6[ƒ<^|6ZP>O>`FdAV@V@VBUCTFZHo0V\HSHl,V^MQJXNk,Vj(Mj)OaF`DY?R@WF\B_G\FSF_'LnErFDpBlˆZŒ|E|‘h¡‘jŽ¡Ž¸x>ua&Vf(Sj(br2az8fv2fEl „šZBf#Br4KbB`=d9]6R5b@]:W8Z>\=W;W9]5i @q;ˆ0C‘1D£<H¾MNÆRRÊXUÆTRÈSUÉTTÇVT¸LPx;Z=„0NžCQÀVXÖ`]Ùd`Ú_ZÜhbÛa_ÙcdÜf_ÜjgÞjhàlfàleáoiàlfâgbÞjcàofájbßf_ßjeßgbÞe^Þh`Þg]Úe\Üf[ÜfaÜg[ÜleÜofÞmgßofÞrjßrjßvlÝvjß{lÞ|tÞ€tà‚uÞ†xà‡yàŒà‘€á”€ß˜†ä—†â˜†ä¢Žä¬’㬘属洢湪辯꾮ì´íĸíƺîÈ»ðʺïÊ¿ð;óÌÀñÏÂôÐÁöÒ»ñÒ¸¸rwˆ/G’;HŒ8H’>N‹2IŒ5J†3I†2H†6J„/E‰1D†5D†2E‡4D‰:HŠ>K‹COETIX–P]\f«fjºrlÆ~pЊpÓŠlÎ|bÍ‚hч]Ё`Í|_ۍjðº†øЛüÖ¤üÔ˜úÈ…í°và…XÐdN¸JK£<G–1D*A‹,B’4FžANŸ>M›9H.C‡,E”:N¡IY¤J] K]˜BT–AX•FV“@T’?S–GVšLbšRg–I`“H^ŠAW}0Lt*Cg=l:O:J7G	6F1L
9g"Ošl|´’À ¢Æ§ È§¢½œ—ªˆ…œblu">€&@¨>HÏ]WÜvdãˆpæ’tè—zêšvêœ{ìŸzêš|í¢|ð¡{íš{ëŒpè‚cÙk^¨?P¦b}‹:`ŠBcx3ZK
<Q>bFX;RAV@R?RB\Km.Vi'OTFUGo0U\KRGXHi(Ri(On,Sc!Lh(ObFP=U@[D\D`K\JZCZHFARHxF{v:vˆ[‹ašššŸ©Š_–] Rn5h…K€”^‡•[ƒj%Do#>U?X<X=f?h#CcBV6X;`;X:X9X9Y8W8Z=`8o;w <3Eš4DµDJÃRUÆVUÈWVÈRWÈYXÈTTÂPMŽ*@Y:e=”;LªO\Í^ZÛbZÚd`Úd]Úb`ÚdbÞegÝegÝjfÝlfàjdàieápiàjdÞhhÞjhßniànhàjbÞjaáhdßf`Ýg\ÜhaÚdZÛaXÛfaÚd\ÝkdÜmcÜkcÞrhÞmdßqgÝwkÞwlßynßzmÞ|n߁t݆zÞ†wß‹zàŽyâ’à”ᔁ◄㠊㨐㪖实岤温軫꾯êÁ²ìÅ·ìĸîȺðɸïÊ»ð˼ñË¿òÌ¿õÑÀõмôԴЖ”†,FŽ9J–>M–BN˜DS“>N’6I6HŒ:L…0F„*A€,Av&By(Ax+Dz)Ay,Cv.Fx.Fz.FŠAP”NV©``¼l^Ær^Î|fÔŒgÝœpÝ–f؃^Õ„câ¢uôÃŽúҝý֝üЕöÀxèšdØuWÀSJ¦:B.B‚;};Œ'?–2Fš8F•2G3FŒ.H3IžFV¤N\¢JX“<P•>T”BV–EW’>T“>T˜DWLb˜Nd‘D[‘F[‡?V~2Hm!>k=k@W9R7P
-4R5R
:f"K—hv²’™ÂžŸÇª¤Èª¤¾˜±‡žjtv&?|$>¦<HÎ_UÜwlä‰pæ’wé—vëyë›yêž{êœ{ì¢}ð¡íš|ì’oæ„jÌ[WŒ1N¥bxŒ>`„:[t-WN?\G\AS=V>S=R@YGv6`b!G` LTCTFr4]\LSH[Ln+Tf"Km-Tf'Qf'QaG[ET=d LVA^"K^!HVDN@OFXMQFzJ†€L†’gš‘q¨•ošŸ‚¨‹SŒg‰IxƒBpSu€Ft`FO<V;Z?e=h@\9S8\=]9T7U6X6V5Z8X:d9r @‚'=š;D©=G»GJÄRQÇPLÉTPÇSRÆUSÆUN¦5<a6Z:,F¢CRÂV[ØbXÛb\Ûg]Üg`Ýb^ÚfdÜhdÜijÞigßjeßieàhfàkeàjbàljáofâneÞniÞjdàk_âf^áicÞjbÝgcÜf^ÝdZÛhbÚibÞj`Ük`ÜhbÜqlÝrlÞphÝslÞxpßwlÞyjà{oà~sށvÞ„vÞ†zߌ|â~à“„à“…âœ‡âŸŽã¤Žä«—ä®˜ä¯æ¶£è¾«ê¼­é¿°ìŵìôìÇ»îƹîÊ»ïÌ¿òʾñÌÁôÐÁõÏÂõԹ⺭“6M9JšBM˜GTœFSšDN™BQ˜BO–:J8J8J….D-Ew%An Am=h;d6`7c8j <w,B?JŸOR´VTÒ„nä®|çµ|áªp׉dÚŽdê­zøƐúÒ˜ýÔ–úˈð¸qãŽ`ÊaP«?E”/D}"@v>| <‘2J”6I’2F‹,D0H’:OšDS¤Qc¤P_›FY“AT’=S’=S’?V’@T“@TšHZ›Lb—Ob”I^DW„7Rs$?n ?i:h;`<^;b;hAhCp(Lšft²’–¿¡¢È«ªÉ¬¤Ä£·˜”Ÿkpy+E}'A¦@KÎ`[Ûwhãˆsæ’xè™xèzéxèœzéžxì¥}ï£zïš~î’pæ„fÀWY’9T¨i~…6Xp&LeKL>\ IT@R=XBS@[Hf$Lh&KXEb$OYDUDe*P[IQD_$Lo0Tc"Je%Mb#Kc"L\De$Jb"HXBP>R@^$Ib"KVG[HUENBUNxG|ˆV™}¢›„¹‰[šv‘\‰…Fz}Axp0^ŠSxt5bT;R:^<e?]8Z<X@aFXFU<]:T7T6Z8Z6h9{&@‹-BŸ;I´DHÁKOÇPRÆPQÈUSÉTRÈVO¶AFt6V
:k?–;N¶RXÓ^YÖ`YÙd_Ûg_ÚgaÝd`ÛfbÛhfÞhhÝkcÞhbÞhdßfbßjiÞjeßnlàkhàqkáicànhànfàj_ßk`ßi]ÝgcÜgbÞg^Ûd]Ûh`Ýj]Üh\Üg]ÜkdÜngÞocÜukÜ{nÞyoÞ{n߀pà€rÞ€rà„rÞ‡yÞˆ|à|á}à”âšƒâ ãŸŠâ¦‘âª“ä­šå³¤ç¹§è»¦ê¾®ìÁ²ëöìĸíƺîȸï̾ð˾ðÌÀòÏÃõоõзîͲª]h6H–DQ›IS¡NY¢LTžKTGSšAM•?O•<L‹4G‡,D(Cu'Bo@d<^<X9X:U7]<k ?:Q»ldá¦}î½„íº€æ®rÝ”cÝ’jïµ€øɐüЕüЍøÆ‚ìªfØzS²KH•/@†(@s<} B…(A0D’5HŠ2F†*DŽ6L›AQžHZ¤Sb P^™FV“>P“>R8PŒ=R’>T•BXœJZœPh•LbH[ˆ<Ry2Il"=p <h8g:i8~,C.B~,Dy(F|4Q˜]p³ŠŒÄ¤¡È¬§Ë°ªÈ«¢º›’žin~4I(D¨BLÍ\SÜviã„qæ“xê˜xéŸvêžvæšvèž|î£vð¢zîœzípã„h´MZ™@W¶t„=^j$KbJR>dHR?TEYDf$OdFWAYCWCc#LW>SEZHh&TTBh(Ti+Qc%Mc"Nc Ic"Lb"NZD]ER=SAN
<R<l-P_EXAe&QVEXCRJp<oŽ`”£Ž±˜³‘qž“lœu8p†Nˆ˜`ˆ¡n‹~:fP<T;e>a<S7W7Y4X7U7U8T6P6X8Y9d=}$@‡*@•3Dª@J¼HKÈNNÆONÊSRËPNËXT¼LL:W;]<ˆ0H®JRÎ\ZÖ_VÖ`^Ûf_Ûf_ÛgbÝe`ÛhcÛeeÝfaÜhdÞifÝhcÝgeÞllßleàrlßlhâpjànháldàjaáifàj^àjdÝgaÜe]ßh_Üd]ÜhaÛngÛg`ÝjbÜjbÚnhÞjcÞpeÛujÝthÜxlß|nà|pށvàƒqÞ‚x߆vÞŠzߏ|ᓀ㜄䞌⟊⨔⫖宝䴤湤繫輪êÁ°ëõìÆ·íǺìƺïʺð̽ð̽òÎÀôξôкòбĈ‰Ž9J”BQšKT R\¢NV£OU¢MVžKU˜GW–@P>P8J‡2F~1Ht <h@`<Z?R:L5N:Y?<RÕŒp컇ôĆïÄ‚æ¤dÛ„[à™pô¾†úÍ’ýÒ’ý̈ô¼zã•^À[M˜5C€!?u@vA…&BŒ/F5FŽ2H‚&D„(G”:QžH\¦Rb¢N^—FY‘=SŒ8R‹8QŠ<Tˆ5LAW˜H]ŸSfžSh—MbDY…8Pu(Es'Bj<f=n;Š6IŽ>NŽ:Lˆ6N†9RˆB]—^r­„ˆÂŸœË®¤Ï²¤ÊªŸº™•¤rv…@R-C¨@IÌ\PÚteã‡ræ”uìœzèxéŸwêš|èž|ì¦yï§~í™vê”pß|b¹L]¡D[·p‚’Ffj"LZBWB]DVF^Jq2Zh%IY@VBT?XDa!I[IUHYFd$N^Il,V^ Kb'Mj(Sd&Pf(Nd LVBUESBS?YBR=T:f"P[Bv6`c JVBPDMFq9f”nž“q ›²˜|±†Rˆ‹Xˆ„>q—Rh›_ŠR?W?c?W:X<V:V7S8V7U9S;V>\8^:p<Œ0DŽ.Dž<I¶FJÄQRÆTSÇPRÆWXÈVN¿OO(;a7W9u>¤@NÉVUÔ`^Ö]S×e`Üe_Úc[Úc^Ýf_ÚmhÝgeÜjhÞhcÞjgàhaßjdàjfáicâohálfàplàngàojàldápfÞmdßh]Ýg_ÝiaÞi`ÜhbÜh`ÝicÜi^ÝjbÝj`Ýi^ÚkdÜpfÜrhÞtjÞrfßxjà€n݁s߃vÝ€xÞƒyàˆzàŒ|á‘~◃㘁䚉䤑㤎䫘峢赦繩缮辭ëÀ´ëõìźíɽîǹîɼðË¿ñÎÀóÌ¿ôÏ¿õÓ¶Ú®¤”=M’>O˜JTŸJS¤P]¥PX¥RX¡PXLVœFS”FV>PŒ=P8O~.Fq"Ai D^8X<N=I
:Q;š<Là›nóÀ‰÷ȃóÂzÞ—[܆^çªxô†üËŒü΋ùÄ€é¨nÎoP’0>€!:q>p>z#@…*DŒ/FŠ0D„,Hƒ+IŽ6O™DV¦N_¦Vf˜JZŒ:Q‰6N‡9R‰8OŠ8OŠ8M’>U›NbŸXmžVk•J`ˆ@W‚8Q|2Jx,Gp%Dj>l!A’BR‘DV‘?PŽ?QE\‘I`dw¬„Œ¾ž›Ê¬¤Ì°¨È¬žºŸª|yŽIW„4I¥COÌ\VÚvdâ†rå’uêšxèŸ|êž{ëœwéŸyð¦|ò§}ìžuê“rÜzf¸U_ Lb®ezCct,TQ>SAXBd#J`Ca DYBW@XBZA[DXB\DWE[G]H`%Li)OZFh+Um,Xi*Te&Lf$MR@UDR@P>ZG^GL>b"Gn+Uh*Rd K\KVHXLf,^p:eŒa“ ~¤«—³—t¦|D~€G{’j•Ž_X?^@[<V8V7V9U<T9U5R5Q	1Y6^6h6(>.A“.@¨>G¾LMÅRPÅTSÉRPÈWQÂOK%;[7Z=v%D9JÂPQÐ]VÖ^UØ^ZÙg_Úd[ÙdbÜd`ÞhaÝlaÝleÞidÜg`ÞhaßkháhcàieÝhgàpjàleÞlhßmgànhàmfàngÞj`àh_àjaÞnfÝh^Ýf^Þe\ÜiaÜi\ÜmbÜjaÚg_ÜkcÛpkÛpjßugÜsiÞxlÞ|pÝ~oÞ‚t߀tà‚zÞˆzàŠxâ“€à•ƒâ“‚â™…äžŠã¥Žå®šæ°žæ´¤çºªçºªç¾°ê³êĶìƵëÅ·ìÈ»îȽï˾ñ̾òÌ¿óϾöѶèDZ£LX8N•CRœOW¢T\¢PX§RW¤PV MUFR™GV=NAR‰9Pƒ2J|1Kq&Ah"@]<T;O<X?<JÞ’iðº|øÄ~ð¾xâ›fã˜jì²zõÁƒùÆ…öÀ~í­qÑzV¢:Cv9t<l>y#B‚&@‹0F„&?'?‚)BŒ3MœCT¡Na¥Sa›L\>Tˆ:N†6N„1Jˆ5NŠ8N@V—G^ Ui¡]pœNd‘K_Œ@Vƒ6Q€5Pz)Fn#?k!@s'DŒ:PBP?PCX”K`—Vj¡n~®ŠŒ½Ÿ¡Åª¦É°«Ê®¢Â¢•ª‚€’Ta†0D«DNÊXQÛtcã†qç”xëœyêž|ì¡zëžzêž|ï¥~ð§ví pè—nÚzc¦L^¦Nh¬`s†@`u*SXB[GX=XCX?ZB[DX?VAX?]Ja%L` HXFWEV@XAZDYGi-Tm.X^!JZIf&Od)STBVBRDVBh&Na#NP=e$Lj,Ud&P\Mb"Rm/^b$Np0\j.\m8]ŠZ‚—xš’f˜Šaf3O[A\@_AYAT<Y@T;V<V8O4N5X7`@d8t =†+@”4Gž4C¸HJÁMOÉ[WÆTTÈQP½KEŠ#7T3T
-4p >š9I¼JPÏ\WÒ\YÖ]ZØ_[×b\Úf]ÚfeÝb[ßhbÜhhÚjfÞhfÝjaÞheÝlgàjcàheÞhfßngßnfàlißkfàlcàohàpiàh]àkaàmfÞhbÞg^ÞedÛd]ÝjdÜiaÝmdÜndÙkdÜibÜmcÛsfßrgÞrgßziÜ|pÝ{nÞ|qß‚tÞ†yÞŠ|ÞŠzà~à‹xß’€ã˜…✌⨐䧕䫚沢洣湧迭龴ê¶ìĹìÆ»íǺðÇ»ð˾ò̾òǶó˼öϼðβºtxŠ3D“BP›JTŸR\¤SY¨RW¥SZ¢OUŸKU˜DS–GU”CR8L‹9M…5Jx,Bt'Bf>`:^@jE˜:LÖ‚bí²zõÀ„ó¿î¶yí±xð¶uö¼~ò¸zê¥iÔ{Tž@Cx;j<g<o<|$B‚*Aˆ,D$Aƒ(CŠ1J”<P KY¤Pb›JW’AX†4N€0J‚2L…2K†2KŒ8R”FZMd XmžXr”OgG^‡;T…:T‚8Os*Go"Bk$Ar)Fˆ;RŽ@V“DW—K^—Sgž_p¦v„®‹Ž¼¢£Ã¬¦É¯§Ê¬£Ä£–­„ƒ–Zd‡3F¨CLËZOÙrbá‰zç’téšyêzêŸzìŸvë¢|î§yñ¤zïxì–mÚn—7O®\qªYl„@`d FR>_GT?YDYDX@ZD[@ZCX@ZCb%JbIWGZGYEUCTDc%Pd%Le'QVJVHp4\|>fVBZHVFL@g&Q|@j`LTDf%Js5f\LXLs>gu;raQw at svAp€Oq<l’fŽž„©v at gZ?\<[>U>T>\@T;V8U=N=R
7[:`5n9†,@ˆ,@—3B®BJ¶FOÅQPÈWRÇOK¶DHv9S
-7W<v#@Ÿ6F·FLÊVVÒYTÒZZÕ^XØa\×^YÚf_Úf_Ýd[ßjhÝgdÞlbßh`ÜhaÛebÜmfÞgfßhbÞgdßlgàqhàohàkdÞkfÞolàpkßmfálcàlgßneßiaàg_ÛfbÜlfÛibÜngÜjbÛohÝj`ÜleÝrfÝrjÜrjÜtfÞvjÞxpß|nßrÞ‚wá‰xàŠ~àà‰{àŽã—ƒäŠâ ˆâ£ä¨–ä± å³¥æµ¦ç»«è¾²ê²ëÄ·ìÄ·íɹîʾîʾð̾ðȹò̾õιóдա–’7G<H”BPœKT¢QV§V[¤TXŸPWŸNX™EM™HT–ET?RŽ?R†7J~1H}2Kv,Et"?v$C{'C“6LÐweê²€ôˆôÊõ†òº{î®jê¤jä’_ÎsY¤JM‚)Dl<g>k>u"A€)B*A"?~$B‰3K—?QJY¢L]žL`“BXŒ>R‚6L2L…/H„6L‰6O’@Y˜Lb Uj \qšPg’E`ŒH\†=U€4Nx.Jm$Cp"Dt0Lu.Kx-JŠ>P–L\œXhœ\m dv§t€¯†‹À¡¡Æ¨¤Ç«¥Å§ž¾ ˜­„€—\dˆ6G¢FPÉZWØsgà‡tår蚀êxéžzêŸzí¤~î§ð¦víœzë”sß‚i–6R°bv¥Un†;_ZBQB`HRAXGW@\FXAaJbJVB]Df$J_FS@VDTFUF`'Su5bj/Zj1]TD^!Ox>d|Ad[FSAZHKAf(Y~Ei|>g^L]LzBmZH`&\a0X}Jyf'`v>o—l˜”ld&Pp1]p at X‚Jud?Z@U?T>W;\<X:R9P7O4V8b@c<z)HŒ0F4I¯CH·FK¶GIÀOJ´FFŠ&7]6N7`6‰-B¨>HµHNÅONÍXUÐZXÔ^Z×^XÙ`\Ùa[Ûe`Úh^Ûd^áj`Üj`ÞibÝh_ÝjcßjcÞhbÞieÞjdÞkgßldâniâkbâjbÞlgÞngáohßoeàlbàldàkdàmdÞhaÛjjÞk_ÚifÝndÚh^Üh`ÜfZÚl`ÜpfÝphÜreÜujÞwjÝvhÝ~qÞrÞ~uÞˆzàŠxà‹|à}à’‚â”‚á’„àœ†âžã¦–ã­šä±£ä²§åº§æ¼®è¿²ë´ëƸíƺïÇ»îʼï̼ïÊ»ðËÀõμôж侬žCRŠ:K“CRšJUžKQ£PX£PT¡PX¢LVšHV•FQ—MX”DT”FSŠ;P„8O…8J2J‚3J†6IŠ3N£GUÏ|lè´‚öÇ”øÌ–÷È’ò¸zæ iÙ|TÂbQ¢BJ‚*Du"@n;n@v&E‚.F„,B)B|"B†/F‘8OšFX Qb¢O_˜MZŽ?U„2M2M€.J…2L†4MŒ>VšNbŸTh£[nœRh–MeŽBZŒHZ‡=R~4Mt*Hr&Et,Gq*Jm Ak">„?W’J[Znœ^oœ^oœj{«„¼ ¿¥¥Å©¨Ä§ ½Ÿ”¬„€˜^iŒ<L£GPÇXRØrdà…oå–xèšyèšzêž|ëŸ{ì zî¦zî§{îyì“o߃hž:T£Wl YpˆBfR>N?YCTB`"N]Cd&NT?f&N_IWC^Db%Hg'NWEQ=SCTFb'P}8duAnk6`SJe&UvAf~Djr4\N@R@VG] I|Cnk,Sj,V_#Te+MwAu[ Jj+\`!Rw:nl0i‰T~¥‡©€Mzv4jTAwAhn'OU>Q;S<Y=\?S8P
4Q:M3U
4^3n:ˆ1A–1?£=E²AH¯BGœ6@„6b6R:Z:x$B 9GµBL»JPÆQQÉSUÎ\WÓXRÔ]VØ`ZØaXØc^ÜdZÙfaÙf]Üg`ÚicÝf\ÞhdÞljànaÝleÞießifàjfâldàngßnfánbßtlàngàrjßpkàmhámfßofàofÝndÜlhÝliÜj`ßmcÞj`Üi_Ýk_Üi^ÜmeÞndÜqgÞwiÝuiÜvmÞylÞ|tÞoà‡{Þ‡zߊzá‹~â’â‘â’‡à›ŒâŠâ¢—ãª˜ã® â²¢æ¶§æ¹¬è¾²êÀ³ê¶ìŶîȾîʾïËÀî˽ï;óÏÀôϸêʯ¬^i‰7F’AO–HQšMYžMUNVŸNS¡T[›JU™IQ™JV’GZ–HV>P‹<Qˆ;TŒAR@P”=P–8K­KTÓ€pé°„÷È•ùÌ‘õÂ…è¤pÑyS±PK‘4D(@|">r<t@{&B|*C‚.E€&B'A‡,H’=RœGZ Q`ŸNa˜J]EW‡5L|-Iy*H~,G„5PŠ<Q“BZœPb¢Zl£ZkœNf–QdŽG]ŽFZ€6Ly1Jl @t%Fz0Kv1Ml$Bb<€4LŒG]—Vf–Vi‘Si”^t¢y…µ–š¿¤¡Äª¤Åª ¼ š¬‚˜Zf>L¦GRÅVP×rdá„mã“wèšzëž|êŸ|í }ì¡€ï¤ï£|ëžxî’kàˆn >X˜If˜Tny2TN@N>XCTD]"KX@b!JZBk'O`FT@XG]Fq2\b&OSAXFVDl.Yv0^yLuv7cTHb$Tu at j‚Lt~Aj`LRA]JV@€Fli)TQ>WJ]%Oh‘b%Vd&Y^Rq:it9u|Ax¡¡ŽaŽq5d\Ih.Vj.YR<N8WA[<T9R9R8Z=U:\5j4)?Ž1<”1?‰,=|<h6V@W9`:$@œ0A­@IµBG½KNÆSTËWXÎTTÐYYÒ\VÐecÖ`\Ö_\Öa\Ûh]Ùe^Ûd\Üg_Ûh`Üb^Þf`àleßkbÞheÝidàgcÞpiámdâlbàngápcàqdßtjàtfßrjáqißrjàphándÞmbßleÜljÛjdÞjbÞiaÜj^ÝlbÝi`Ýj]ÝpfÝpdÝugÝvhÛxlÞxlÝ~qÜ€uށtÞ…x߈|áˆ|á’┃◈⚈⛌⣐㦖䫚㲤䵧幭缰辯êĹëŸíÇ»ìË¿îËÂðʽïË¿òÎÂñνïί‡„†3E:G“HR•JT›LWšLTœPVŸNU™NW™HTšOZ”K]—MX“ETŽCVEV•FX˜HV™CQ—>Q«HUÒxf樄ñ¿Œð¿ˆèª{ց^¨HJŽ4Gˆ4K~.F|(Fw!A€,Dƒ.E‡2H„.D‚*D….H”:QžK^¤Tc¤WjšN\‘CU†:L€2Hx(Fu(Gz&B‡4M‘BW—F\¢Vh YlŸVgšQg“MaŽH]„>Vy.Gl"Bq&Bz,Hx-Ht,Gh!BZ6o'C~9PˆDZ‰F[ŠKe“\t u„°“–À¤¢Ç«¦Èª¡¿¢™°ˆ„Ÿdn>I¢ENÅXQØp`ß‚nã’wêœvìœì |î£|í£xï¦zî§vëì”lä‰m±P`Œ7XD`n(OQ@TAU>YE] I[H_GT>m+Vf"JZBZHX@v<gTBVCYFVDj*Sn)TvLoq3\KAd&Vz:hŒZŽ„Lu€@n[JWFQGh,Q„KtK>THc&ZsHa`•b#QY Td(_uBx‰W––dŽ«—´‘_Œ\E^Fd+SS;P8U9Y>T=ZAX8[8^8f3i8i8e8^>S7W9[>j!D‚,Fœ;OªBPµDN¼HLÀNSÉTUÍUTÎ]^ÎXTÐXXÒZVÒ^ZÖ_YÖa\Ö^ZÚcaÚgaÙfeÜhaÛebÜjfàg^ÞjaÞjcÜfbÛfdÝkhßmfßlhÞldÞngàpdÞpjÞtràphásfàtlàsmÞnhßlhÝnfÝphßodÚjeÜhbÝldÞpfÞnbÜnfÛlbÞodÛphÜrgÞtfÜxlÝynÝzrÞ~sàuÞ„w߇{á†}ፀⓃᖆ➊❉⡓⤔䬘䮜䳦䵥漯龰éÀ´ëÄ·ìȾìļîËÀíÊÀî̾ñÎÀò̹òήܮ¢9GŒ;HŽ@O’FO•JU˜LVšOXŸSZžR\›LW™R\›PZ–MZ’FZ“JY™M^ P\¤P`¤NX¢GU¨GTÈc\ۏuâpÞšnÌyZ§JJŒ8N‰8Nˆ:K†0Iƒ,D†0Fˆ/DŒ2Jˆ/F„*E…/J‘8P™FZŸRa¢[jMY“AQ‰9L‚2J~5Pz(Ct'F|-FŽ;O™M`Qf¥^m Zož\n˜Pg•NcŒFZ€7Mr(Dp&Fr,Fw*Ft(Fj!CgAW:f >p*H€<T‡D[‰HdVpžo°•¼¤ŸÄ¨£Æ¨ Á ˜±Š‡ kr–FS¦FRÄVRÙnaß‚mäŽvê™xìœzí ~ð¤zî¢~ñ¦ð¨~ïŸzî•sæŠn¼\fv'K}6\]BUDSBR>U>X?YE\J^Jk'Pg K\I\H\F|GsVEVDZHWId!Nd#PzNxk*XMG`$S‚E€Œ_ŠY†ŒT€j'TV"QTL^LŠUz`(VLHSEb$W‹a‚t7fn2f_!Ut>pb”^™šr‘¤z ‚Ft`L`&NR<P:V9S:T8\>]?\8^5[2U5T6^<d:t(B†(@“/Bž6C¬9D¯<JºGNÂPTÊTVÎVZÎ^[ÐZWÑ\\Ñ_^Ò`_Ò]YÓ^ZÔ\V×`XÔb]Ød[ÖdbØ`ZÚjcÙgbÜf\àj`Þh`Þf]ÞfaÝjbÞiaÞifÞjeàidßlcàsißmgánfàqjßrlárißsoßojßnfÞnbàneÞmbÝodÜhbÜjcÝj_àp`ÞnbÜm`ÞndÛogÝrgÜtkÝvjÝzqß{nÜsà„wÞ†|߆~àˆxáŒ€â‘€à”…âž†â Žá¡‘â§—äªšâ¬œã²¢ä´¦æº¨è¼¬èÀ²éôíŶíɾí˾îÊ¿íÌÀðÎÀñξñз嬜HX†7HŠ<LŽ@N’IV•KX–MRRXŸR^žS\ V^›Q\˜K\–P]˜R^ Ra¨W]¬V\ªRZªLU®LV¼VWËl`Êp^ÀeZ¨JS’:LŠ4K‡2F‹.E4H’4G”:K‘4FŽ1B,Dƒ,G‰8N•DYL^žQbžT`“ET‰<J€,C{(Bx(Ft!@v(F†4PšK] RežYj¤]n¤^pžZn•MeNd†?X|0Hr)Dr(Cn"@r#@q$BhB_;Y@e>j @u1L€;T‚A\ˆJg›gx¬Š¸œÃ¦ Â¦Ÿ½ š³‰„¢lqšRW£KTÁXS×kZá€læ’xê™zꝀí ~î¡|î¡€ñ¢ñ§은ëtç‰rÆddr!Ev5ZT@XFRCV@\)M\ATAZDb"Lh*Tb!L` Pd"O`K}Mub LVBYFZKd*Wn,Y~Nvc MOCZL|@v‡Tƒ_ŠZ†j0]PGKBt<rƒHiŠ[…L@G<j+`k.Z‹X„g*Xn.nd(X“i™Ž_‡yDt}KqZ‚zAm\EOBSDWJV IYHW:S3U4X4a3m:v"=…$9‘);›4@§4@«;E®;G»HQÀLRÆTTÊWXÏWSÎTUÑVUÐWVÓZYÒ^WÓ\UÓ^ZÒ\\Ö^VÔ_XÖ[T×c]Øe^Ø`ZÜc[ÚfcÝh^Üe_Üf`Þe]ÜgbßlgßkdàlfájeálcàmfàmfÝqlßrlàtpàtjátlÞnjßnhÞtmÞndÝsißnbÞrfÜldÞkbÜpfàlaÝodÞl`ÞncÚqhÜngÝshÝyhÞ{nÞxlÝ|qßuàƒu߃wà„xà‚â‹~áà˜ˆãŽâ¢ã§’䫘䮛䰝䳣嶨庫迲鿲ì¶ìÄ·î˽î̾íÊ¿î̽ðÌÀòθì̯´muƒ4E†9JŠBPŒDR“KY•KQšNZ¡U^¡TZ W_œXfšP_šRažTa¥[f«^a¯ZZ²VW±SX´RX²OT´TV²TZ¦NW›CR’:O’=O“<N”:LšBRš<K—:I–6GŒ-A†*C‰.I“<R™H\œPb˜R_DVˆ=Qƒ0F.D},Cu$Bs#D|0K’ATŸQ` Vl Vh£`r¡^qœXo•UiŽIc„9T{0Is(Ep"Bm"An$Ck @c<aC^ Ad"Ae?m(Hz6T~=[‚Ab•by«†»Ÿ Æª¡Æ¬¥Ã¤š²‘‡¦stžW_¤LY¿WV×jZà€kåuê™zí}졀ñ¤€ñ¤~ì}é’tã‰p»[_t"Iu1W[H^HVFV>[F\FR=YAb Kk*Te%Qb%Qb"N_Mn:Zq5fTDQBVHc M{BdzCkXFPGSGv<h„Pˆ|Ht”j’zBrPCFCb%WˆNx•jŒn-YC<MFr2ey@\ƒL}^$Nh,fS‚ŒX‡’c˜j4j†S|~Di]"KP?P<V"BT8P4R4W6`7k=t;…'@’/B›8H¢6E©CL¶HL¸FIÂMNÆPPÈTXÉVYÌVWÎWUÏXVÐZYÐZXÒZZÓ][Ôb\Ô`YÐ\WÖ^UÖYSÖ^ZØ^\Ød\Úd\ÚhaÜd^ÞfZÜc\Üb_ÝfbÛohÞofàj`ài`âldànfßibÞkhÜliÞqjßrlÞqjàpfÞrnÝnfàsjàpiÝqgßpdÞvjÞndßneÜocßl^ÞleÝldßrlÛohÝqdÞthÜviÝviÞvlßznàqÞƒsÞtÞ‡y߉~à€à‘ƒá’†á›‰àœŠá£â¥‘ãªšã°œã°¢ä´¤ç¸©æ¹®è¿°ë·êÅ·îÊ»îʼìʼî˼ï̾ðκïαɔŽƒ4K‚3H‡@OŒBS‘JT’KV˜OZžS]ŸV^ \bžWcœV`¡Xa§[f«^b°\]µVV²TX¶TW¼TW´NS¬LUªJR¢FSœAQ™>Qš@R¡HV£FR¦HTŸ>O–:M5I‹2G‹6J7P—BVœPe™J^H[ˆ8L„6N‚6Mƒ2H{*Fw,Fv&Fˆ;T˜J^¢Xl¢Zm¥bw£fxœYj–Tf‘Nb‡CZ|/Kv+Fo$Ck @l"Do"?gAb <bA\@f%Dh*Li%Cn,Mt3T{:Z’]t¯ˆ‘Á¦¤Ð´¬Ô¸®Î´¬Á¤–®} \e¥JSÀYX×l^â‚kæ’vìšyí ~ì î£~ð¨ò¦í¡|ç•tÐ|a”<PlIp.Ta.PY#MSAWDZ@ZDV@_"MaHh'R] J` Ne$Nb$T\ I}FxZGQARF]NyDjt4aQBQFQJv:k‹Y–g'X“j’’f’\MNERL„Hz•g‡„HmVF><XF‚Bpaˆh(\SJo8jˆV‰’a„T€p7cg+Ka"KM;R>U?T:W=]9h9l3t58•*: 5B©:F²BH¾OLÄNNÄOKÄPOÆNNÈTSÊXVÎYWÐZXÒ^\ÒZXÔ^\Ô][Õ^UÖ\VÕ\WÓ_W×]WÖ[YÖ`XÚgbÚb\Úd`ÞhhÜfZÞd^ÜdaÝf]Þf_Üjeßibàgbàh`àkeànfßjhÞnfßleßmhárißpjáskápiàpiàsjÞtlàpkßqlßwqÞrfÞpfßodÞreÞriÜncßphÛtlÝvkßvhÜxhÞvjÞ|rÝzpß}sÞ€rà‚uÞ…zߊ{âŒ⎀ᑄ╆♊ᢐ㠒⣔⫝̸ᮛⰣ乨巪绮èÁ´ê¶íȸìÊ»ëÉ»ìǹî̽ð̸ñͱװ¡Œ3H€0D†=L‹CS’IT•MWšQZU]žY`Xb [d£]e§^hª_d¬]a¸`^»XV·TU¸VVºQT´NR¬IT¬KT¨HT¥FP¤DR¦GU¯NR°NX¯IR£BO—:LŽ2HŒ3J8O˜@TšF\•JZˆ7N„6L~2G}+B‚0C‚.C}2L|.H2K‘@TžN`¦\l£`l¨ap£`s˜Tf–TeŒFZ‚6Ox+El Bj @n>f>e:d:b8f6^=b BdBbAj(Jj)Nn-S”Yp´Ž“ж°ÜµßóÝÀ®Ö¹¦»•Ž£_f§T[ÀZXØn\á„lçríœ{îž|îŸ~ð¤‚ñ§ô§€ðŸâŒpªS^z,QdDh%N^C_JV@\ I[DUBVE_Hc%Pf%N\Jb Md$Mf(TXIoAao3cP@VH]K‹aŒ|@mTLUNTLzApŒ^“hY‚R}šwž}GxZ"PPEqGoŠVz„Oyr/^H?J>v0`zC_”h•VNPEr3e}Ju‘bl.dR>b$MP?T;ZAV@\>c8k8q0€!6”0?¥9A²?IºCG½NOÅMJÊPKÊRPÇNKÉQPÊSRÎWUÐ[VÐZUÑZYÓ\XÕ^XÖ_WÒZTÔa\×\SÖ^TÙaX×^XÖ^ZÚd\Ø`YÚf_Úc[Üe\ÜdZÜh`ÞfZÞg`Üi`Þiaßg]àf\ámdàj`àlcßlfÞmdàqkáphàpiàniàrqßrkàulÞqlÞskàqhßulßrhàrlßrdàncÞriÝpfÞwlÝrfÝthàvhàxgßxjßwkÝzpÞznÞpÞ…vÞ…zߌ{àŒ~ã‘€á“ƒá–†àá ”â¤à¦âªšâ­žà® äµ¦æº¯ç½¯è¿±èÁ³ëÄ·ëƺêɺëȽêǼì̼ñ͵âîšKZ|.G…;K‡BVŽDOšQYœR\žRYžXbVb [f¤`fªaf¬af´`^·YZºUU¹VU¸VV¸UX·QT´QV°JT«JR©DT¬FRµQV¼TV¸QU®HR£@Nš:N“6N˜=R•DV˜I`–I\ŒAZ†:L~,Dz*A|,D~.G~)>~6N4NŽ;NœPd¥\h§aq§s¤^nžZo–PeŒEY†?Uy1Hn)Gh$Ah @i>h"@f>f;f<v:Z>d"@bA_@h"Eg%Jo.W”av½•—Û¾¯áóâijß°޾¤Î©“­po§RZÁZVØjZà‚næpìšxìŸ{ïœ~ð¢€î¢€ð¤ð¤~ìž|â“y¼lpOlx'Pc KVCbFf&NZAZDQBYB`#PbHfKb"Ld"Nj(Qi-UZL\&IzGvL@TGb'T˜uz8bVEWOVH~EtŽbo'_w8hŸ}¢•j”b#LOBRFy at h‡T€_"J`#SI
@j'Ou/^ˆXs€FxOBq0dn1cŠ[‰yJum6po4\T=P:V
7S6_6l6s2‚!7—0;¤7>°<@¹EG¾GGÀMHÃPNÊQJÊTLÈTNËRNÉSMÐWSÒXSÒ]UÐZVÒXPÓ^YÕZRÒXVÖ^XÕ^ZÕ`YÚcZØ`Y×^YÚ^XØaZÛaTÝd[ÜaXÝhaÜh`Þh`Þf]ÝdaÝh`ÞfZÞjgàhcáießkdàjaÞhgáogßqjàleápnárkàrsãtiàtkàpjàtfÞxoápjàvpßsjßreÞxqÞvlßtnÞtiÝtkÞznÞxjàylà|qß~kÞzpß}mà„và„táŠxâ|à‘‚à—…à“…á™‹à â¤“á¡Žá©œâ¬œá®Ÿä´¦æ¼¬æº¬é¾²èÀ´ëõêĶêÈ»ëÈ»ëʽìͺñ͹êʱ¯ox{.J„8H‰>JŒGUŒGPŒHT˜T]˜Tb›T`ŸZb¨bi­bf°ae´``¸ZYº[Y¼VQ¼TT¹UV¸RT·OU¸JP³LT²NV¸VYÁWXÀVV¶RY­LT¦AR@Q—=T™DZ˜F\—H^’K_„>Vƒ6J~.C}-F‚.I}0F}/H0I‹=SœM^£Wd«bn«du¨bpž\p˜VjŽJ`ŠBU4Lr)Fh#Cd>h">k%Cf:h;i<r >Œ2HY<`=`@`>d&GcHk*P˜bz̤œÛ½±ß³ãijàòݼ§Ó°’»ƒw¨PWÀ\\Õm`á€järìœvìœxìxï¡|îž{î£~ñ£|îŸ~é‘sÈnn³do‚3VcJYE\D`DXD_KPA_"Jb-Sf&PfMd Pi"Nn)Um+Tf"RTFzJpb PVLg-W˜r—s2^[JVJ\NˆQ|e•eR}4q„Uv ¦s4dPBSJh*WŠ\‚g,ac&Pe"TZA€:dn.T†NucTi)[p,`„T€G€†V„_‹ZDL6N	2X1c3u4ƒ#;’.<¥5=¬9?·DI¹HJÀGGÃNKÂJJÊPNÊTOÌSPÍVQËRPÐVOÑZUÔ`YÒ\UÐ\XÐ]VÔYRÑ[VÖ]V×a^Ø`XÚ_XÚb\Ø`[Ú^RØ_YÜ_VÜd\ÛaZÞd[Ýf^Ýf_Üb[Ûg_Þmfáj^Þhdàh`àkdàg^àlbàlhßplànjàniásnàoeàqiâulßriâtkàthàqkávjàwmÞthâujßxmßsjàslÞtfÞtgÞwlÞzlâyná~sà|sà{pßzoáƒzâ‡{á‹yâà‘€ß‘à’ᚆ⠊ឈ࢒䨖⭜௝䲡䶨亭羰çÀ´êĶêÄ·êȺìȺìʼìÊ»ñ˹îαʓ’}/J{4Lˆ>LHR’R[–MY—P\”NZ›Vc¡\b«^c¯ad²]`¶\^º][À[WÂXV¼UV¼UVºOQ¸OU½RS¼QS¿WYÈ[VÊ_XÂXWºOQ¬GR ?Pœ@U›DXœNb”F]ˆBZˆ@Y‚<Xˆ;Qƒ8Rƒ4J‚;P€-G†2H‹:P˜H\§Vh­cq¬hs¬fv¤cp›Uf•RiˆD]€;Rt*Fh @c;`6f9i<j)Fl<}+Fˆ0C™8IZ>[=b?`@d"EaEj'P˜\rΦœÚ¼¯ÜÀ°àñßÁ®Þ»¦Õ²˜Áˆ~¥R\¾ZXÖnbà‚kåŽuìœvìžwê xí¢|î {ï£|ñ¥€íšxß“xºYbžNbv-QbF^DWAX>ZAc JUH^H`#LdLk%Rh"Nr*Vz6\z5]r2\[Jd$Ms0`\OsDnŒ\‚q,XcJ[Nj"W„Fq`TB~?ut0dšz˜–d‘[KRIk/b_„‹X†XJe&Pf&Tr0T}<gf*Oh+XVGn/`~@k€I}s9q”fŠ^‰^!KT4\4o3€7&9œ+;¨6>¯9B¸FHºDEÁGFÆPQÈPNÌOLÊWTÍUQÎUPÌWTÐXQÐXOÒ_WÒ]VÐZWÐ\XÔ^TÓ`[×`UØbXÖ]ZÙ`XÙb\ØbYÜ\TÛ^TÚh_Üd[ÝjdÝf`ÞeXÝc]Ý`XÜf`ÞjhÞjbÝgeÞmkÞkfßgdàicàngánjâpdârgâtjárgàsjàkiàrfásháqjßrhârfázpàwnâxiátgÞxlávhÞrfßuhÞxoÝzjà{lâ~lá}oà€rà~rà„wã…và‹}áŒ~à‹|ÝŠá’‚á–‡àžŽàšŠá£’ã©—ã¬á®ã²žæµ¨å¹§ç¼±è¾±êÁ´ë·éÆ·ìƸíʽíʺðʺïͲڲ¦‹:N4I„<KŠ?IBN”FO’NZ”O[šR\ž[b¨\`®^a´[\¸^^ÄaXÃa^Ã\VÀTRÀTS¿SPÁYWÇXTËUTÐ`WÐ`XÌ_XÃVS¸KR£GTž?Oš@V™DT–E\Š<X‚<V6Pƒ9OŠ<U„:P†:P†5K„2GŒ<Q˜H]£Xj¬bl¯mx¬kx«htž\m—Uh‹EZ€<Tt)Ei<f!A^8a>e>g=p&By(CŒ5HŸ?J¢<KU<\<^>^:c D^Fc&O‰OmË¢šÚ»²Þ¾²ÞÀ³Ý¿²Ú¸¦Ò®—À‡y§NXÀ\XØn_ß„nåtìšwëž{적î |좀ñ¤}íŸvÞ‘w¤JWŠA^j"Gf$NdHR@P<_Bh%LP?g*V[Hh)Rn(Rg#Pp-Vs*Tx5Zx6b\JbMp0fj.^o’†HpbLg!T` QiR†Lub‹P@w8fv3fu<h“jŠ€FzXMf'U˜p—‹XzXDRCTDl(Q<^s0\f(SWIWFaL~Kym,b}?g—f…X|j$Ki<‚$<–->œ4B¢1?©7@®?F½GHÁHIÆMJÊQNÊSRÊPPÎTTÎXSÏXSÐWUÑ\SÓZRÐZXÑZXÐ^[Ò]TÖ]TÓ]TÕ^X×_TØ\UØ\XØaZ×`ZÛ^XÚ^VÛcXÜa\Üe[àe[Þi`Þf_à^WÞdZÝc[Þd\Þhhàh_àhdÞlfàjcÞnhàrgárfâpfßphßrjßrjÞkfàrlâsjàtoßsmârgáwlàxlàuhàtlàvhßyoßymàtgßxjÜ{pàwkßyoá€rá€tá€pá‚sâ…yáˆ|áŽ€àŽ„àŽá~ß“†á˜ŠàšŒàžŒâ¤•âª•â¯Ÿä± å´¦å¸¨å¸¬ç¿°ê¿°êÁ´éĶíƼíÈÀìÇ»ïʼðηæÄ®¥Vl„>Z‡?PˆDS‘HNŽ@JBM”JV™W`œW_¦Y`«X[´^_Âe_Ìg\É`VÆ[VÅ\WÆZTÆXTÄZWÎb[Ñh[ÖkXÑdYË]UÀTR±IR¡>NžBQ—>O’:P‡7Q{4Q4R‚6SŒBY>XŠ@Tˆ:Q†:P…4M”DUžK^©Zk²gp¯n|¬ktªguœ]kŽH^:Qv/Hg >a<_6`:`8c;j?u+F†4Jš@R¬FRªANR9^>`=\=` C[>`H†HfÄ™ŽÚ¼®Þ¾±Ü¾°Ü¾®Øº¦Ñ¬·zq¡S^Â`\Øl\á„mæŒnë–x을ì¢zì¢|ð¤‚잀á–{¢JWFdh&Nj%LY>Q>P:d"Gi*PH8g(RV@r0Yr2[k"Mq*Vm&Nt-Xx4^f%ObS|@t|;h ˆ«r4Y`Fq.`VBd R‚Gm^ˆTHi(Tt4`p+d|Fk˜nœs2l\!N x|EhN=YFSJZDo*Xy:`e-Se"PTD_L}Lso.a`F‚Lzz7NR€z8’/D—1A›2>¨:D¨8@²@DºDF¾HKÃJJÆLNÈQRÏSRËWTÌVQÎXQÑZPÐXQÒZTÑbZÑa[ÐZWÒ]TÕ\TÔ\VÔ]WÖ\T×`\×b^Ùb\Öd]Û`TÛ^XÜ^Wß`YÞe^ÞibÞe_Üe]ß`XÞc\Ýd\ßb^ÞfdâhfàhdÞnháihàhbàojândârlÞnfÞpfÞnnâmcàrkárhàqhßrjàrhàvjàxiáypàwlßvhßxlÞxqáyißxlÞ{oÞztà{pà„rà„tà‚xâ€tà„tàˆ~áŒ‚à†ßŒ„ߐ€à”ˆá”Šâ˜Œàœâ¦”᪘ᬘ峢䳤䷤䶨溰辰èÀ´ê´ìŹìÇÀîļðÊ»ð˵êÈ·Ân‚žR€’IhˆEZŽDRŽBPHT“HRšPWœRZœPY°bf½f^Çj]Ñh\Ïc\Ì`VÈ\XÎ]TÊ[TÈ`\Ðj^×l[ØkZÑfZÊXP¸RS¨BK˜<J˜<L6Lƒ/H1Lx2P|2P‰>ZŽ@]AXŽBZ†<V‡6QŒ<R—DV¤P_¬cn²fp®mvªjx¥dr–Vg†D[v+Fh#@f"D_<Z2_7`:k>v,N~8P–BV¨GT²DN·HQ
\ No newline at end of file
diff --git a/tests/md5.sh b/tests/md5.sh
deleted file mode 100644
index 6809169..0000000
--- a/tests/md5.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-# try to find an md5 program
-
-if [ X"$(echo | md5sum 2> /dev/null)" != X ]; then
-    do_md5sum() { md5sum -b $1; }
-elif [ X"$(echo | md5 2> /dev/null)" != X ]; then
-    do_md5sum() { md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
-elif [ -x /sbin/md5 ]; then
-    do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
-else
-    do_md5sum() { echo No md5sum program found; }
-fi
diff --git a/tests/ref/acodec/ac3 b/tests/ref/acodec/ac3
deleted file mode 100644
index b393956..0000000
--- a/tests/ref/acodec/ac3
+++ /dev/null
@@ -1,2 +0,0 @@
-081bfd5e683b13cccf1b07c43c1c5005 *./tests/data/acodec/ac3.rm
-98751 ./tests/data/acodec/ac3.rm
diff --git a/tests/ref/acodec/adpcm_ima_qt b/tests/ref/acodec/adpcm_ima_qt
deleted file mode 100644
index 4fef154..0000000
--- a/tests/ref/acodec/adpcm_ima_qt
+++ /dev/null
@@ -1,4 +0,0 @@
-3c06fd2f7831e3e8735b936e23ca220c *./tests/data/acodec/adpcm_qt.aiff
-281252 ./tests/data/acodec/adpcm_qt.aiff
-9580492803ba1c1a3746367b24b751c8 *./tests/data/adpcm_ima_qt.acodec.out.wav
-stddev:  914.63 PSNR: 37.10 bytes:  1058604/  1058444
diff --git a/tests/ref/acodec/adpcm_ima_wav b/tests/ref/acodec/adpcm_ima_wav
deleted file mode 100644
index a58c279..0000000
--- a/tests/ref/acodec/adpcm_ima_wav
+++ /dev/null
@@ -1,4 +0,0 @@
-56b75c3a6dacedcf2ce7b0586aa33594 *./tests/data/acodec/adpcm_ima.wav
-267324 ./tests/data/acodec/adpcm_ima.wav
-78a2af1c895792d0c221d127bdd48ece *./tests/data/adpcm_ima_wav.acodec.out.wav
-stddev:  903.51 PSNR: 37.21 bytes:  1061792/  1058444
diff --git a/tests/ref/acodec/adpcm_ms b/tests/ref/acodec/adpcm_ms
deleted file mode 100644
index 99a7105..0000000
--- a/tests/ref/acodec/adpcm_ms
+++ /dev/null
@@ -1,4 +0,0 @@
-a407b87daeef5b25dfb6c5b3f519e9c1 *./tests/data/acodec/adpcm_ms.wav
-268378 ./tests/data/acodec/adpcm_ms.wav
-7be370f937c51e8a967e6a3d08d5156a *./tests/data/adpcm_ms.acodec.out.wav
-stddev: 1050.00 PSNR: 35.91 bytes:  1060620/  1058444
diff --git a/tests/ref/acodec/adpcm_swf b/tests/ref/acodec/adpcm_swf
deleted file mode 100644
index 59bf8f3..0000000
--- a/tests/ref/acodec/adpcm_swf
+++ /dev/null
@@ -1,4 +0,0 @@
-42d4639866ed4d692eaf126228a4fa2a *./tests/data/acodec/adpcm_swf.flv
-269166 ./tests/data/acodec/adpcm_swf.flv
-628089745a7059ae4055c2515b6d668b *./tests/data/adpcm_swf.acodec.out.wav
-stddev:  933.65 PSNR: 36.93 bytes:  1065004/  1058444
diff --git a/tests/ref/acodec/adpcm_yam b/tests/ref/acodec/adpcm_yam
deleted file mode 100644
index 9889dd9..0000000
--- a/tests/ref/acodec/adpcm_yam
+++ /dev/null
@@ -1,4 +0,0 @@
-2546d72df736b5ffa1557e8c9c9ef788 *./tests/data/acodec/adpcm_yam.wav
-266296 ./tests/data/acodec/adpcm_yam.wav
-c80c847a53a0fee17a88fa889ec34a4e *./tests/data/adpcm_yam.acodec.out.wav
-stddev: 1247.64 PSNR: 34.41 bytes:  1065004/  1058444
diff --git a/tests/ref/acodec/alac b/tests/ref/acodec/alac
deleted file mode 100644
index 143b1f3..0000000
--- a/tests/ref/acodec/alac
+++ /dev/null
@@ -1,4 +0,0 @@
-c68f649777ab8e7c9a0f1f221451d3ad *./tests/data/acodec/alac.m4a
-389386 ./tests/data/acodec/alac.m4a
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/alac.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
diff --git a/tests/ref/acodec/flac b/tests/ref/acodec/flac
deleted file mode 100644
index b1e4174..0000000
--- a/tests/ref/acodec/flac
+++ /dev/null
@@ -1,4 +0,0 @@
-151eef9097f944726968bec48649f00a *./tests/data/acodec/flac.flac
-361582 ./tests/data/acodec/flac.flac
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/flac.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
diff --git a/tests/ref/acodec/g726 b/tests/ref/acodec/g726
deleted file mode 100644
index 02b9eea..0000000
--- a/tests/ref/acodec/g726
+++ /dev/null
@@ -1,4 +0,0 @@
-5d8cce28f83dd33c3c7eaf43a5db5294 *./tests/data/acodec/g726.wav
-24082 ./tests/data/acodec/g726.wav
-4f1ba1af75dee64625a1c852e6cd01d3 *./tests/data/g726.acodec.out.wav
-stddev: 8506.46 PSNR: 17.73 bytes:    96148/  1058444
diff --git a/tests/ref/acodec/mp2 b/tests/ref/acodec/mp2
deleted file mode 100644
index 0607cab..0000000
--- a/tests/ref/acodec/mp2
+++ /dev/null
@@ -1,5 +0,0 @@
-f6eb0a205350bbd7fb1028a01c7ae8aa *./tests/data/acodec/mp2.mp2
-96130 ./tests/data/acodec/mp2.mp2
-74c7b6b15a001add199619fafe4059a1 *./tests/data/mp2.acodec.out.wav
-stddev: 9315.80 PSNR: 16.94 bytes:  1059884/  1058444
-stddev: 4385.25 PSNR: 23.49 bytes:  1057960/  1058444
diff --git a/tests/ref/acodec/pcm b/tests/ref/acodec/pcm
deleted file mode 100644
index 8e34408..0000000
--- a/tests/ref/acodec/pcm
+++ /dev/null
@@ -1,72 +0,0 @@
-89f5b8dd97e0dddbe59af0d44fd229f3 *./tests/data/acodec/pcm_alaw.wav
-529256 ./tests/data/acodec/pcm_alaw.wav
-0568b0b9a72e31559e150e7e09d301cd *./tests/data/pcm.acodec.out.wav
-stddev:  101.67 PSNR: 56.19 bytes:  1058444/  1058444
-f443a8eeb1647ec1eeb8370c939e52d4 *./tests/data/acodec/pcm_mulaw.wav
-529256 ./tests/data/acodec/pcm_mulaw.wav
-1c3eeaa8814ebd4916780dff80ed6dc5 *./tests/data/pcm.acodec.out.wav
-stddev:  103.38 PSNR: 56.04 bytes:  1058444/  1058444
-b7936d7170e0efefb379349d81aed360 *./tests/data/acodec/pcm_s8.mov
-530837 ./tests/data/acodec/pcm_s8.mov
-652edf30f35ad89bf27bcc9d2f9c7b53 *./tests/data/pcm.acodec.out.wav
-stddev:  147.89 PSNR: 52.93 bytes:  1058444/  1058444
-98cadb3502dbdc99e6e077c28b1a036c *./tests/data/acodec/pcm_u8.wav
-529244 ./tests/data/acodec/pcm_u8.wav
-652edf30f35ad89bf27bcc9d2f9c7b53 *./tests/data/pcm.acodec.out.wav
-stddev:  147.89 PSNR: 52.93 bytes:  1058444/  1058444
-c42b9c04305455250366c84e17c1023f *./tests/data/acodec/pcm_s16be.mov
-1060037 ./tests/data/acodec/pcm_s16be.mov
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/acodec/pcm_s16le.wav
-1058444 ./tests/data/acodec/pcm_s16le.wav
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-43440f8078f2383c0dd618ad606f6830 *./tests/data/acodec/pcm_s16be.mkv
- 1060693 ./tests/data/acodec/pcm_s16be.mkv
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-1e63166f1672b7eb00877c697c06743c *./tests/data/acodec/pcm_s16le.mkv
- 1060693 ./tests/data/acodec/pcm_s16le.mkv
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-07ffe7ffb78f3648b6524debdde5aec1 *./tests/data/acodec/pcm_s24be.mov
-1589237 ./tests/data/acodec/pcm_s24be.mov
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-a85380fb79b0d4fff38e24ac1e34bb94 *./tests/data/acodec/pcm_s24le.wav
-1587668 ./tests/data/acodec/pcm_s24le.wav
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-d7792f0343cd66fda8b50b569e2bcc48 *./tests/data/acodec/pcm_s32be.mov
-2118437 ./tests/data/acodec/pcm_s32be.mov
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-da6ed80f4f40f0082577dea80827e014 *./tests/data/acodec/pcm_s32le.wav
-2116868 ./tests/data/acodec/pcm_s32le.wav
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-118ff3dc83c62ce9ce669eef57e55bb2 *./tests/data/acodec/pcm_f32be.au
-2116824 ./tests/data/acodec/pcm_f32be.au
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-46f44f86a18984a832206ab9e29a79f2 *./tests/data/acodec/pcm_f32le.wav
-2116880 ./tests/data/acodec/pcm_f32le.wav
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-8112296b1ed94f72f20d04b1a54850a7 *./tests/data/acodec/pcm_f64be.au
-4233624 ./tests/data/acodec/pcm_f64be.au
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-ba17c6d1a270e1333e981f239bf7eb45 *./tests/data/acodec/pcm_f64le.wav
-4233680 ./tests/data/acodec/pcm_f64le.wav
-95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
-stddev:    0.00 PSNR:999.99 bytes:  1058444/  1058444
-8c74234928ed425b1171211a89f67ead *./tests/data/acodec/pcm_zork.wav
-529256 ./tests/data/acodec/pcm_zork.wav
-864c8c866ac25642c29a13b122c70709 *./tests/data/pcm.acodec.out.wav
-stddev:  633.10 PSNR: 40.30 bytes:  1058444/  1058444
-8168a5c1343553ef027541830f2cb879 *./tests/data/acodec/pcm_s24daud.302
-10368730 ./tests/data/acodec/pcm_s24daud.302
-f552afadfdfcd6348a07095da6382de5 *./tests/data/pcm.acodec.out.wav
-stddev: 9415.16 PSNR: 16.85 bytes:  6911864/  1058444
diff --git a/tests/ref/acodec/wmav1 b/tests/ref/acodec/wmav1
deleted file mode 100644
index f1bb69c..0000000
--- a/tests/ref/acodec/wmav1
+++ /dev/null
@@ -1,4 +0,0 @@
-26a7f6b0f0b7181df8df3fa589f6bf81 *./tests/data/acodec/wmav1.asf
-106004 ./tests/data/acodec/wmav1.asf
-stddev:12245.27 PSNR: 14.57 bytes:  1065004/  1058444
-stddev: 2097.78 PSNR: 29.89 bytes:  1056812/  1058444
diff --git a/tests/ref/acodec/wmav2 b/tests/ref/acodec/wmav2
deleted file mode 100644
index ca18dea..0000000
--- a/tests/ref/acodec/wmav2
+++ /dev/null
@@ -1,4 +0,0 @@
-7c6c0cb692af01b312ae345723674b5f *./tests/data/acodec/wmav2.asf
-106044 ./tests/data/acodec/wmav2.asf
-stddev:12249.69 PSNR: 14.57 bytes:  1065004/  1058444
-stddev: 2091.12 PSNR: 29.92 bytes:  1056812/  1058444
diff --git a/tests/ref/fate/4xm b/tests/ref/fate/4xm
deleted file mode 100644
index 614da5e..0000000
--- a/tests/ref/fate/4xm
+++ /dev/null
@@ -1 +0,0 @@
-88a53430410d1cec5ed46846652ffd51
diff --git a/tests/ref/fate/8bps b/tests/ref/fate/8bps
deleted file mode 100644
index 6ee9617..0000000
--- a/tests/ref/fate/8bps
+++ /dev/null
@@ -1,35 +0,0 @@
-1, 0, 2048, 0x3d042426
-0, 0, 259200, 0x7e91df07
-1, 4180, 2048, 0x5bcae456
-0, 7200, 259200, 0x7e91df07
-1, 8359, 2048, 0xb6043655
-1, 12539, 2048, 0x6fdaffad
-0, 14400, 259200, 0xc468c119
-1, 16718, 2048, 0xf86700cb
-1, 20898, 2048, 0x045e46c1
-0, 21600, 259200, 0x0e058930
-1, 25078, 2048, 0x000df0e5
-0, 28800, 259200, 0xa0261310
-1, 29257, 2048, 0x8f5f12fb
-1, 33437, 2048, 0xd516f6b0
-0, 36000, 259200, 0x78ca9aba
-1, 37616, 2048, 0xa1fe2bd3
-1, 41796, 2048, 0x3647087a
-0, 43200, 259200, 0x4971f7b3
-1, 45976, 2048, 0xd2ee584e
-1, 50155, 2048, 0xf132088c
-0, 50400, 259200, 0x7dc2cff7
-1, 54335, 2048, 0x1efc0eb1
-0, 57600, 259200, 0x8cbc53d5
-1, 58514, 2048, 0xeb73f402
-1, 62694, 2048, 0x75cb3d20
-0, 64800, 259200, 0xcccd77e3
-1, 66873, 2048, 0x85a501b6
-1, 71053, 2048, 0xa4eb312d
-0, 72000, 259200, 0x6b3e0fb3
-1, 75233, 2048, 0xf0aaf8c7
-0, 79200, 259200, 0x281dd175
-1, 79412, 2048, 0x65371cda
-1, 83592, 2048, 0x25512cd6
-1, 87771, 2048, 0xc81410e3
-1, 91951, 514, 0x57d77b94
diff --git a/tests/ref/fate/aac-demux b/tests/ref/fate/aac-demux
deleted file mode 100644
index 744ae64..0000000
--- a/tests/ref/fate/aac-demux
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0xbda37454
diff --git a/tests/ref/fate/aasc b/tests/ref/fate/aasc
deleted file mode 100644
index 7ec02ba..0000000
--- a/tests/ref/fate/aasc
+++ /dev/null
@@ -1,23 +0,0 @@
-0, 0, 168000, 0x45addf8f
-0, 3600, 168000, 0x45addf8f
-0, 7200, 168000, 0x45addf8f
-0, 10800, 168000, 0x45addf8f
-0, 14400, 168000, 0x45addf8f
-0, 18000, 168000, 0x45addf8f
-0, 21600, 168000, 0x45addf8f
-0, 25200, 168000, 0x45addf8f
-0, 28800, 168000, 0x45addf8f
-0, 32400, 168000, 0x45addf8f
-0, 36000, 168000, 0x45addf8f
-0, 39600, 168000, 0x45addf8f
-0, 43200, 168000, 0x8730699b
-0, 46800, 168000, 0x08b095df
-0, 50400, 168000, 0x203526e3
-0, 54000, 168000, 0x0ebc5142
-0, 57600, 168000, 0xd168e7c2
-0, 61200, 168000, 0xcc7da0e6
-0, 64800, 168000, 0x72ac60b8
-0, 68400, 168000, 0xb691e27c
-0, 72000, 168000, 0x646fa087
-0, 75600, 168000, 0x404450a2
-0, 79200, 168000, 0x5214c456
diff --git a/tests/ref/fate/adpcm-ea-r2 b/tests/ref/fate/adpcm-ea-r2
deleted file mode 100644
index 4bca11f..0000000
--- a/tests/ref/fate/adpcm-ea-r2
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0xa1158634
diff --git a/tests/ref/fate/adpcm-ea-r3 b/tests/ref/fate/adpcm-ea-r3
deleted file mode 100644
index 920a4d0..0000000
--- a/tests/ref/fate/adpcm-ea-r3
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x9ea2507f
diff --git a/tests/ref/fate/aea-demux b/tests/ref/fate/aea-demux
deleted file mode 100644
index 18ec8b8..0000000
--- a/tests/ref/fate/aea-demux
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0xc1312082
diff --git a/tests/ref/fate/alg-mm b/tests/ref/fate/alg-mm
deleted file mode 100644
index 6e245ac..0000000
--- a/tests/ref/fate/alg-mm
+++ /dev/null
@@ -1,31 +0,0 @@
-0, 0, 122880, 0x4ed8123f
-0, 9000, 122880, 0xc4c35304
-0, 18000, 122880, 0xbd3015fd
-0, 27000, 122880, 0xece5dbab
-0, 36000, 122880, 0x13249f3f
-0, 45000, 122880, 0x58f75895
-0, 54000, 122880, 0xe6570f7d
-0, 63000, 122880, 0xcce88145
-0, 72000, 122880, 0x796f633c
-0, 81000, 122880, 0x182c3cd3
-0, 90000, 122880, 0x04b2513b
-0, 99000, 122880, 0x6b7e2e42
-0, 108000, 122880, 0x2fa47070
-0, 117000, 122880, 0x7142919e
-0, 126000, 122880, 0x8995337e
-0, 135000, 122880, 0x5146ca20
-0, 144000, 122880, 0x9aadb491
-0, 153000, 122880, 0x2d5b0032
-0, 162000, 122880, 0x5c7c8314
-0, 171000, 122880, 0x2ba8253c
-0, 180000, 122880, 0xd19d504b
-0, 189000, 122880, 0x4ff15fd1
-0, 198000, 122880, 0x76039f9f
-0, 207000, 122880, 0xcce84d35
-0, 216000, 122880, 0x68c5797c
-0, 225000, 122880, 0xf1da4293
-0, 234000, 122880, 0xf5f537f3
-0, 243000, 122880, 0x8d3ffa94
-0, 252000, 122880, 0x3ca9b69c
-0, 261000, 122880, 0x21187f6c
-0, 270000, 122880, 0xe5136e34
diff --git a/tests/ref/fate/amv b/tests/ref/fate/amv
deleted file mode 100644
index a8e7136..0000000
--- a/tests/ref/fate/amv
+++ /dev/null
@@ -1,320 +0,0 @@
-0, 0, 28800, 0x026058a9
-1, 0, 2756, 0x0af35034
-1, 5624, 2756, 0x8462443f
-0, 5625, 28800, 0x5dc728de
-1, 11249, 2756, 0x9f493ba6
-0, 11250, 28800, 0x83e19a2c
-1, 16873, 2756, 0x634e5f06
-0, 16875, 28800, 0xb029f94a
-1, 22498, 2760, 0x51f35cd4
-0, 22500, 28800, 0x735a6b15
-0, 28125, 28800, 0xf7e9dc8b
-1, 28131, 2756, 0x011c51e5
-0, 33750, 28800, 0xa108b0cf
-1, 33755, 2756, 0x8c2c198c
-0, 39375, 28800, 0x3d11c138
-1, 39380, 2756, 0x2b4a3397
-0, 45000, 28800, 0xed23afda
-1, 45004, 2756, 0x63794f22
-0, 50625, 28800, 0x713bb2dc
-1, 50629, 2756, 0xfc363898
-0, 56250, 28800, 0x551ad51e
-1, 56253, 2756, 0x0da5486e
-0, 61875, 28800, 0x49dfcf2d
-1, 61878, 2756, 0xbae17a5f
-0, 67500, 28800, 0x6399d5b3
-1, 67502, 2760, 0xba266e1b
-0, 73125, 28800, 0x520ad812
-1, 73135, 2756, 0xdfb61002
-0, 78750, 28800, 0xc46ad9da
-1, 78759, 2756, 0x15d029da
-0, 84375, 28800, 0xe79edb9e
-1, 84384, 2756, 0x7bc82012
-0, 90000, 28800, 0xdb1acb30
-1, 90008, 2756, 0x002e6999
-0, 95625, 28800, 0x050fb669
-1, 95633, 2756, 0x96346ba6
-0, 101250, 28800, 0x096ca687
-1, 101257, 2756, 0x3d54543b
-0, 106875, 28800, 0x0054a6bd
-1, 106882, 2760, 0x601786e1
-0, 112500, 28800, 0x6d7daad2
-1, 112514, 2756, 0xf22a5793
-0, 118125, 28800, 0x9c10a9dc
-1, 118139, 2756, 0x21f54d49
-0, 123750, 28800, 0x89b1a623
-1, 123763, 2756, 0x0c6d4399
-0, 129375, 28800, 0xa0a19c3f
-1, 129388, 2756, 0x17282f8e
-0, 135000, 28800, 0x26c898ad
-1, 135012, 2756, 0xeb698f75
-0, 140625, 28800, 0x6f639dae
-1, 140637, 2756, 0x935e1de2
-0, 146250, 28800, 0xa173a9b5
-1, 146261, 2760, 0xb6fb4293
-0, 151875, 28800, 0xa309aa08
-1, 151894, 2756, 0x485053dc
-0, 157500, 28800, 0x2059b6c4
-1, 157518, 2756, 0x24c35027
-0, 163125, 28800, 0x5ae8c761
-1, 163143, 2756, 0x09f323ee
-0, 168750, 28800, 0xb780c9c5
-1, 168767, 2756, 0xbc7d58d5
-0, 174375, 28800, 0xf58ac8fe
-1, 174392, 2756, 0xaefd487c
-0, 180000, 28800, 0x9bb307e7
-1, 180016, 2756, 0xaca16cc0
-0, 185625, 28800, 0xd32c3e81
-1, 185641, 2760, 0x98a76091
-0, 191250, 28800, 0x4edd51d2
-1, 191273, 2756, 0x5d357141
-0, 196875, 28800, 0x5a88684d
-1, 196898, 2756, 0x65ea2657
-0, 202500, 28800, 0x5bd97f0e
-1, 202522, 2756, 0xb5e1334a
-0, 208125, 28800, 0x36d67843
-1, 208147, 2756, 0x32cd5d91
-0, 213750, 28800, 0x0e18781d
-1, 213771, 2756, 0xdc23722b
-0, 219375, 28800, 0xa3168807
-1, 219396, 2756, 0x2ba34684
-0, 225000, 28800, 0xa7c575b8
-1, 225020, 2756, 0xf9755ba8
-0, 230625, 28800, 0x86367c37
-1, 230645, 2760, 0x24221ddb
-0, 236250, 28800, 0xb0f79180
-1, 236278, 2756, 0xef843aa4
-0, 241875, 28800, 0x61da8c0f
-1, 241902, 2756, 0x420442fe
-0, 247500, 28800, 0x9b11948a
-1, 247527, 2756, 0x5a0933cb
-0, 253125, 28800, 0xc53d9b44
-1, 253151, 2756, 0xef5f6d61
-0, 258750, 28800, 0xdc699185
-1, 258776, 2756, 0xe57e6dc0
-0, 264375, 28800, 0x7b4f92b5
-1, 264400, 2756, 0xc0f0495a
-0, 270000, 28800, 0x40469065
-1, 270024, 2760, 0x2c3b55df
-0, 275625, 28800, 0x737ea07e
-1, 275657, 2756, 0x39c2586c
-0, 281250, 28800, 0x0db49c8b
-1, 281282, 2756, 0x7ffc46e5
-0, 286875, 28800, 0x39249f10
-1, 286906, 2756, 0xa2766664
-0, 292500, 28800, 0xc182ab99
-1, 292531, 2756, 0xacb50c6c
-0, 298125, 28800, 0xd8f7a7c9
-1, 298155, 2756, 0x7f659084
-0, 303750, 28800, 0x46789caa
-1, 303780, 2756, 0xc72e6a12
-0, 309375, 28800, 0x4759a374
-1, 309404, 2760, 0xdb6944df
-0, 315000, 28800, 0xe621b16a
-1, 315037, 2756, 0x954f45c1
-0, 320625, 28800, 0xcf47a999
-1, 320661, 2756, 0xa9484240
-0, 326250, 28800, 0x801dacd4
-1, 326286, 2756, 0x1d595349
-0, 331875, 28800, 0xe580af51
-1, 331910, 2756, 0xcf2a565e
-0, 337500, 28800, 0x03d7a887
-1, 337535, 2756, 0x391028d5
-0, 343125, 28800, 0xa67ea51d
-1, 343159, 2756, 0x348db7ad
-0, 348750, 28800, 0x9fee0ec8
-1, 348784, 2760, 0xb69b5e3a
-0, 354375, 28800, 0x7f602a5e
-1, 354416, 2756, 0xe3635fbe
-0, 360000, 28800, 0x100d432a
-1, 360041, 2756, 0xdcad3654
-0, 365625, 28800, 0x42164dfb
-1, 365665, 2756, 0x5c17abef
-0, 371250, 28800, 0x86c05196
-1, 371290, 2756, 0xb3235184
-0, 376875, 28800, 0xfc225938
-1, 376914, 2756, 0xdabb64a6
-0, 382500, 28800, 0x81085e87
-1, 382539, 2756, 0xa95dc58d
-0, 388125, 28800, 0xaa8f5d0a
-1, 388163, 2760, 0x8e7ac9eb
-0, 393750, 28800, 0x605a5f9f
-1, 393796, 2756, 0x492b658e
-0, 399375, 28800, 0x68dc64b2
-1, 399420, 2756, 0x377483ab
-0, 405000, 28800, 0xd08e710b
-1, 405045, 2756, 0x2c250279
-0, 410625, 28800, 0xf8567939
-1, 410669, 2756, 0x704dbdb3
-0, 416250, 28800, 0x8dad7a4f
-1, 416294, 2756, 0x800d7da2
-0, 421875, 28800, 0x1a19813c
-1, 421918, 2756, 0x872aa32e
-0, 427500, 28800, 0x8a157f0e
-1, 427543, 2756, 0x2d4837fe
-0, 433125, 28800, 0xa4fa7b9d
-1, 433167, 2760, 0xc89ea57e
-0, 438750, 28800, 0x093b7b36
-1, 438800, 2756, 0x6447d7ef
-0, 444375, 28800, 0xa925755b
-1, 444424, 2756, 0x144f59cc
-0, 450000, 28800, 0xa5968138
-1, 450049, 2756, 0xc667154e
-0, 455625, 28800, 0xe00877ac
-1, 455673, 2756, 0xf0de66ae
-0, 461250, 28800, 0xd736183e
-1, 461298, 2756, 0xeabf3c32
-0, 466875, 28800, 0x356f2068
-1, 466922, 2756, 0xe98e81d1
-0, 472500, 28800, 0xf9a50f22
-1, 472547, 2760, 0x56aa5889
-0, 478125, 28800, 0x92df2ae8
-1, 478180, 2756, 0x4fd34c0e
-0, 483750, 28800, 0x67a43dc8
-1, 483804, 2756, 0x67cf6912
-0, 489375, 28800, 0xf8ce2ead
-1, 489429, 2756, 0xfa944def
-0, 495000, 28800, 0xf42f37ee
-1, 495053, 2756, 0xc12f23b2
-0, 500625, 28800, 0x03611f37
-1, 500678, 2756, 0x5ea325a2
-0, 506250, 28800, 0xddda2327
-1, 506302, 2756, 0x2b245824
-0, 511875, 28800, 0xdf073d85
-1, 511927, 2760, 0x90ac533e
-0, 517500, 28800, 0xa8331fee
-1, 517559, 2756, 0xcca34d26
-0, 523125, 28800, 0x59d3490a
-1, 523184, 2756, 0xb5f820d0
-0, 528750, 28800, 0xa8335be6
-1, 528808, 2756, 0x27f24335
-0, 534375, 28800, 0xd5483b43
-1, 534433, 2756, 0x4a9e87b7
-0, 540000, 28800, 0x23422dc9
-1, 540057, 2756, 0xbd076129
-0, 545625, 28800, 0xc04e4689
-1, 545682, 2756, 0x2e0e3f2e
-0, 551250, 28800, 0xd4d96372
-1, 551306, 2760, 0xdf534478
-0, 556875, 28800, 0x9c814e96
-1, 556939, 2756, 0xca000a2e
-0, 562500, 28800, 0x7c4b5d3b
-1, 562563, 2756, 0x87472df3
-0, 568125, 28800, 0x6bf66c04
-1, 568188, 2756, 0x16733810
-0, 573750, 28800, 0x6e8d4bb6
-1, 573812, 2756, 0xfa0734b4
-0, 579375, 28800, 0xad964d00
-1, 579437, 2756, 0x5eff3fc4
-0, 585000, 28800, 0x1ff36bd1
-1, 585061, 2756, 0xf35346bd
-0, 590625, 28800, 0xa4664c76
-1, 590686, 2756, 0xac6411c5
-0, 596250, 28800, 0x50626d82
-1, 596310, 2760, 0x478c3c56
-0, 601875, 28800, 0x81906c5c
-1, 601943, 2756, 0xebd30bdd
-0, 607500, 28800, 0x5060543f
-1, 607567, 2756, 0xaef95a31
-0, 613125, 28800, 0x231c5a86
-1, 613192, 2756, 0x8aad29d1
-0, 618750, 28800, 0x79775d48
-1, 618816, 2756, 0x626863f0
-0, 624375, 28800, 0xbb893571
-1, 624441, 2756, 0x68c05707
-0, 630000, 28800, 0x794c49ed
-1, 630065, 2756, 0x437c5e8d
-0, 635625, 28800, 0x70464bac
-1, 635690, 2760, 0x8eca4bdb
-0, 641250, 28800, 0xe79549ce
-1, 641322, 2756, 0x62bd4162
-0, 646875, 28800, 0xa6565555
-1, 646947, 2756, 0x9f744aa4
-0, 652500, 28800, 0x2ef1ad6d
-1, 652571, 2756, 0x0f3f6409
-0, 658125, 28800, 0xdd22b9aa
-1, 658196, 2756, 0x3fee827a
-0, 663750, 28800, 0x26ebaa97
-1, 663820, 2756, 0x48a0ac19
-0, 669375, 28800, 0x32bd979e
-1, 669445, 2756, 0x8e4ce0d0
-0, 675000, 28800, 0x4c167c9a
-1, 675069, 2760, 0xcda82236
-0, 680625, 28800, 0xfdf76051
-1, 680702, 2756, 0x0e523255
-0, 686250, 28800, 0x966938a8
-1, 686327, 2756, 0x84103d30
-0, 691875, 28800, 0xcea3fbde
-1, 691951, 2756, 0x13941cde
-0, 697500, 28800, 0x29a0c213
-1, 697576, 2756, 0x9fc834c5
-0, 703125, 28800, 0x5633a1c2
-1, 703200, 2756, 0xc0217a77
-0, 708750, 28800, 0xdc0b9af8
-1, 708824, 2756, 0x3f643659
-0, 714375, 28800, 0x92138848
-1, 714449, 2760, 0x9dbd6002
-0, 720000, 28800, 0xd7308da5
-1, 720082, 2756, 0x94f046fb
-0, 725625, 28800, 0x0c8f9b3f
-1, 725706, 2756, 0xab01fb12
-0, 731250, 28800, 0xd059b5d1
-1, 731331, 2756, 0x04cffe5c
-0, 736875, 28800, 0xba6ed9cd
-1, 736955, 2756, 0xef661c5e
-0, 742500, 28800, 0x896c1064
-1, 742580, 2756, 0x094c5fc5
-0, 748125, 28800, 0x986e2fc9
-1, 748204, 2756, 0xe0c1486a
-0, 753750, 28800, 0xcba94e4b
-1, 753829, 2760, 0x8c3535b7
-0, 759375, 28800, 0xf3e778ed
-1, 759461, 2756, 0x594934aa
-0, 765000, 28800, 0xc6cd7d48
-1, 765086, 2756, 0x74007238
-0, 770625, 28800, 0xd9bd84d8
-1, 770710, 2756, 0x61f1394d
-0, 776250, 28800, 0x391197b4
-1, 776335, 2756, 0x72584f07
-0, 781875, 28800, 0xf361a1d9
-1, 781959, 2756, 0xced9acf9
-0, 787500, 28800, 0x9a1ea54e
-1, 787584, 2756, 0x7d2e3ea1
-0, 793125, 28800, 0x551aab57
-1, 793208, 2756, 0x56c06897
-0, 798750, 28800, 0x3af8577d
-1, 798833, 2760, 0x19983bbf
-0, 804375, 28800, 0x10f76ed0
-1, 804465, 2756, 0x4f884f27
-0, 810000, 28800, 0x026a7fde
-1, 810090, 2756, 0x81ab2f63
-0, 815625, 28800, 0x3e0e8db8
-1, 815714, 2756, 0x448e681d
-0, 821250, 28800, 0x22998d2d
-1, 821339, 2756, 0x0ba9826e
-0, 826875, 28800, 0x05978b12
-1, 826963, 2756, 0x049f36fa
-0, 832500, 28800, 0x38b88294
-1, 832588, 2756, 0x096a2b62
-0, 838125, 28800, 0x2ef677d6
-1, 838212, 2760, 0x579e2035
-0, 843750, 28800, 0x0b9a8894
-1, 843845, 2756, 0xd13e30e1
-0, 849375, 28800, 0x2dcb6718
-1, 849469, 2756, 0x30b6412b
-0, 855000, 28800, 0xa31b6679
-1, 855094, 2756, 0xbb1c3268
-0, 860625, 28800, 0x262d6a50
-1, 860718, 2756, 0xbc175b6a
-0, 866250, 28800, 0xff3d6d0d
-1, 866343, 2756, 0xf8d160e2
-0, 871875, 28800, 0x159d7045
-1, 871967, 2756, 0xc1048154
-0, 877500, 28800, 0xf0df7800
-1, 877592, 2760, 0xb83548f4
-0, 883125, 28800, 0xbe825ea5
-1, 883224, 2756, 0x22647962
-0, 888750, 28800, 0x80e25d5a
-1, 888849, 2756, 0x14ca54d3
-0, 894375, 28800, 0x8cbe263f
-1, 894473, 2756, 0x58754b3a
diff --git a/tests/ref/fate/armovie-escape124 b/tests/ref/fate/armovie-escape124
deleted file mode 100644
index 19e6795..0000000
--- a/tests/ref/fate/armovie-escape124
+++ /dev/null
@@ -1,104 +0,0 @@
-0, 0, 230400, 0x5288d70f
-1, 0, 176400, 0xdd61578c
-0, 3600, 230400, 0x2d3c1066
-0, 7200, 230400, 0x89eb5b4a
-0, 10800, 230400, 0x24c2d2e7
-0, 14400, 230400, 0x9271cb38
-0, 18000, 230400, 0xc74a5009
-0, 21600, 230400, 0x61d70705
-0, 25200, 230400, 0x6bb2c252
-0, 28800, 230400, 0x6b3ac910
-0, 32400, 230400, 0x44071f28
-0, 36000, 230400, 0x8abd00fe
-0, 39600, 230400, 0xcbe3395d
-0, 43200, 230400, 0x603e7b7a
-0, 46800, 230400, 0x2ca8865b
-0, 50400, 230400, 0x11b4c665
-0, 54000, 230400, 0x3f19787c
-0, 57600, 230400, 0x651d24b6
-0, 61200, 230400, 0x325d05af
-0, 64800, 230400, 0x4f89d8a8
-0, 68400, 230400, 0xb07647f0
-0, 72000, 230400, 0x71141237
-0, 75600, 230400, 0xa848a2d2
-0, 79200, 230400, 0x3fbe4b58
-0, 82800, 230400, 0xa1e235a0
-0, 86400, 230400, 0x9bcf607a
-0, 90000, 230400, 0x3302e9eb
-1, 90000, 176400, 0x0b9e6d67
-0, 93600, 230400, 0xd731ba90
-0, 97200, 230400, 0x821eedcf
-0, 100800, 230400, 0xd068a93d
-0, 104400, 230400, 0x2811d46e
-0, 108000, 230400, 0xd9740446
-0, 111600, 230400, 0x1bce0df6
-0, 115200, 230400, 0x44bc60ad
-0, 118800, 230400, 0xf56f6200
-0, 122400, 230400, 0x874a2264
-0, 126000, 230400, 0xaa155c0e
-0, 129600, 230400, 0x595392d4
-0, 133200, 230400, 0x58dc57de
-0, 136800, 230400, 0x1c06733e
-0, 140400, 230400, 0x6807b1db
-0, 144000, 230400, 0x3fedff87
-0, 147600, 230400, 0x3e38cc13
-0, 151200, 230400, 0x6685ec35
-0, 154800, 230400, 0x6c0742fd
-0, 158400, 230400, 0x8108f83c
-0, 162000, 230400, 0xc0e217c8
-0, 165600, 230400, 0xb22ca65d
-0, 169200, 230400, 0xd54cec93
-0, 172800, 230400, 0xd9d61de3
-0, 176400, 230400, 0x7e0f9675
-0, 180000, 230400, 0x9869f5b7
-1, 180000, 176400, 0x2793fad7
-0, 183600, 230400, 0x22f33400
-0, 187200, 230400, 0x31b999bd
-0, 190800, 230400, 0x36c23878
-0, 194400, 230400, 0x06093a30
-0, 198000, 230400, 0x213f1718
-0, 201600, 230400, 0x83683006
-0, 205200, 230400, 0x0bfcec36
-0, 208800, 230400, 0x01b77825
-0, 212400, 230400, 0x650a5ea2
-0, 216000, 230400, 0xd8b2c559
-0, 219600, 230400, 0xb012eb10
-0, 223200, 230400, 0x135d53a4
-0, 226800, 230400, 0x98dd0712
-0, 230400, 230400, 0x75240ac0
-0, 234000, 230400, 0xa16769d5
-0, 237600, 230400, 0x3e08cda3
-0, 241200, 230400, 0xcd20d561
-0, 244800, 230400, 0x3531577d
-0, 248400, 230400, 0x65ff4c82
-0, 252000, 230400, 0x8fd4a580
-0, 255600, 230400, 0x3cf7af4c
-0, 259200, 230400, 0xda7a9202
-0, 262800, 230400, 0x4bebc138
-0, 266400, 230400, 0x5517e685
-0, 270000, 230400, 0x95f6c7a3
-1, 270000, 176400, 0xe2649a4a
-0, 273600, 230400, 0x9849ebf9
-0, 277200, 230400, 0xd77e1c7d
-0, 280800, 230400, 0x4dc6c923
-0, 284400, 230400, 0x7ce817c8
-0, 288000, 230400, 0xafb4acde
-0, 291600, 230400, 0xd0030b2c
-0, 295200, 230400, 0xb3acb77c
-0, 298800, 230400, 0x4d32b61c
-0, 302400, 230400, 0x2436a915
-0, 306000, 230400, 0xa6fd831f
-0, 309600, 230400, 0x6c6edfca
-0, 313200, 230400, 0x4b30d72e
-0, 316800, 230400, 0x59f46a8a
-0, 320400, 230400, 0xa2d0435f
-0, 324000, 230400, 0x463872c4
-0, 327600, 230400, 0x1d7e870a
-0, 331200, 230400, 0x74f4e530
-0, 334800, 230400, 0xbc61053d
-0, 338400, 230400, 0x5fb238dc
-0, 342000, 230400, 0x14a29d83
-0, 345600, 230400, 0x3fd1d09b
-0, 349200, 230400, 0x098afc13
-0, 352800, 230400, 0x9bd12a62
-0, 356400, 230400, 0x7bf71419
diff --git a/tests/ref/fate/auravision b/tests/ref/fate/auravision
deleted file mode 100644
index a7bccc0..0000000
--- a/tests/ref/fate/auravision
+++ /dev/null
@@ -1,24 +0,0 @@
-0, 0, 28800, 0x4a4efbbc
-0, 6001, 28800, 0xc6c7e26a
-0, 12002, 28800, 0x6cd40913
-0, 18003, 28800, 0xa7b40fe9
-0, 24004, 28800, 0x5e77fcc6
-0, 30005, 28800, 0x9b3ef3f0
-0, 36006, 28800, 0xe7031845
-0, 42007, 28800, 0x2c15458d
-0, 48008, 28800, 0xbc3d4abf
-0, 54009, 28800, 0xf8755ac7
-0, 60010, 28800, 0x64d0405b
-0, 66011, 28800, 0x1e0c341d
-0, 72012, 28800, 0x05ca3c2b
-0, 78013, 28800, 0x28cb307f
-0, 84014, 28800, 0x3a9855af
-0, 90015, 28800, 0x92b63321
-0, 96016, 28800, 0x85585151
-0, 102017, 28800, 0x1ff01bf9
-0, 108018, 28800, 0x4bab200f
-0, 114019, 28800, 0xcf732ad7
-0, 120020, 28800, 0xced00cff
-0, 126021, 28800, 0xa69046fd
-0, 132022, 28800, 0x5aa341c3
-0, 138023, 28800, 0x87ef6219
diff --git a/tests/ref/fate/auravision-v2 b/tests/ref/fate/auravision-v2
deleted file mode 100644
index a4b6e82..0000000
--- a/tests/ref/fate/auravision-v2
+++ /dev/null
@@ -1,2 +0,0 @@
-0, 0, 115200, 0x2f247f66
-0, 3000, 115200, 0xf492929e
diff --git a/tests/ref/fate/bethsoft-vid b/tests/ref/fate/bethsoft-vid
deleted file mode 100644
index 4c252bd..0000000
--- a/tests/ref/fate/bethsoft-vid
+++ /dev/null
@@ -1,141 +0,0 @@
-1, 0, 1480, 0x00000000
-0, 0, 192000, 0x00000000
-0, 1500, 192000, 0x01a6cf45
-0, 3000, 192000, 0xd07d57e9
-0, 4500, 192000, 0x3cb1dff5
-1, 5994, 1480, 0x20a92bd4
-0, 6000, 192000, 0xd1aaa8fb
-0, 7500, 192000, 0x75f526cd
-0, 9000, 192000, 0x0f673577
-0, 10500, 192000, 0x897b6781
-1, 11988, 1850, 0xa9e48a74
-0, 12000, 192000, 0x81e6b7f7
-0, 13500, 192000, 0x1f45ce61
-0, 15000, 192000, 0x5a0772a6
-0, 16500, 192000, 0xf78732b3
-0, 18000, 192000, 0x8427f9e5
-1, 19481, 1480, 0x23ecd018
-0, 19500, 192000, 0x40473f11
-0, 21000, 192000, 0x173ceebe
-0, 22500, 192000, 0x136b9516
-0, 24000, 192000, 0x138d11ae
-1, 25475, 1480, 0x206bb915
-0, 25500, 192000, 0x063dbff3
-0, 27000, 192000, 0x5280852f
-0, 28500, 192000, 0x99943a8f
-0, 30000, 192000, 0x0330a728
-1, 31469, 1850, 0xb0e10e75
-0, 31500, 192000, 0x5d35467d
-0, 33000, 192000, 0xfd436343
-0, 34500, 192000, 0xc323fcfe
-0, 36000, 192000, 0x2a1530a0
-0, 37500, 192000, 0xbd43bb60
-1, 38961, 1480, 0x8d9baedd
-0, 39000, 192000, 0xa47f5eab
-0, 40500, 192000, 0xff17f5f7
-0, 42000, 192000, 0xb4140b55
-0, 43500, 192000, 0xb8782cc4
-1, 44955, 1480, 0xb802aae1
-0, 45000, 192000, 0x92975b8b
-0, 46500, 192000, 0xf42a64d6
-0, 48000, 192000, 0x2cc7077d
-0, 49500, 192000, 0x00080cc8
-1, 50950, 1480, 0xecd7b5cc
-0, 51000, 192000, 0x584b48f3
-0, 52500, 192000, 0xd68f57da
-0, 54000, 192000, 0x60158422
-0, 55500, 192000, 0xd7fb89e6
-1, 56944, 1850, 0x16861355
-0, 57000, 192000, 0x97f1c76a
-0, 58500, 192000, 0x46c4bb9e
-0, 60000, 192000, 0xd32f9b66
-0, 61500, 192000, 0x74f43886
-0, 63000, 192000, 0x3c4e47df
-1, 64436, 1480, 0xa51690bd
-0, 64500, 192000, 0xb5ac0a58
-0, 66000, 192000, 0xcc572b31
-0, 67500, 192000, 0xb1739d26
-0, 69000, 192000, 0x73da5473
-1, 70430, 1480, 0xdd0b90d1
-0, 70500, 192000, 0x5f79f5bc
-0, 72000, 192000, 0x0affc0a0
-0, 73500, 192000, 0x2b4d5c1c
-0, 75000, 192000, 0x309b41bc
-1, 76424, 1850, 0x3ce6e333
-0, 76500, 192000, 0xd42b6424
-0, 78000, 192000, 0x4795c948
-0, 79500, 192000, 0xbc1a3a8b
-0, 81000, 192000, 0x16529c5b
-0, 82500, 192000, 0x6b1b31ba
-1, 83917, 1480, 0xf8ce8ea3
-0, 84000, 192000, 0x569182ce
-0, 85500, 192000, 0xe6ea9866
-0, 87000, 192000, 0x102c6076
-0, 88500, 192000, 0xb29f527a
-1, 89911, 1480, 0xda4597af
-0, 90000, 192000, 0x040b4eee
-0, 91500, 192000, 0x92574f4a
-0, 93000, 192000, 0x1e8acdce
-0, 94500, 192000, 0x1becf516
-1, 95905, 1480, 0x918f7cb3
-0, 96000, 192000, 0xb62e9776
-0, 97500, 192000, 0xed37a08e
-0, 99000, 192000, 0xc0719912
-0, 100500, 192000, 0x24cf7a7e
-1, 101899, 1850, 0xca6edb15
-0, 102000, 192000, 0x0307f62f
-0, 103500, 192000, 0x79b7417b
-1, 109392, 1480, 0xba279597
-1, 115386, 1480, 0xc5a38a9e
-1, 121380, 1850, 0x8147eef5
-1, 128872, 1480, 0xce2c7cb5
-1, 134866, 1480, 0x4282819f
-1, 140860, 1480, 0xbdbb8da6
-1, 146854, 1850, 0xdbbeea10
-1, 154347, 1480, 0xbe6a77c2
-1, 160341, 1480, 0xa85c75b2
-1, 166335, 1850, 0xa45bde21
-1, 173828, 1480, 0x84aa7895
-1, 179822, 1480, 0x147f7d9f
-1, 185816, 1480, 0xc8e77b85
-1, 191810, 1850, 0x10d4d81b
-1, 199302, 1480, 0xb4ae8bb1
-1, 205297, 1480, 0x3ef782a5
-1, 211291, 1850, 0xdeebda14
-1, 218783, 1480, 0x4c7e7bbb
-1, 224777, 1480, 0x0e0e9198
-1, 230771, 1480, 0x5c1f819f
-1, 236765, 1850, 0x0e4cf6ff
-1, 244258, 1480, 0x374388a7
-1, 250252, 1480, 0xed729389
-1, 256246, 1850, 0xe0f1e43f
-1, 263739, 1480, 0x3b27839a
-1, 269733, 1480, 0xe6287e94
-1, 275727, 1480, 0x7e0d84b5
-1, 281721, 1850, 0xf08bebf7
-1, 289213, 1480, 0x94cf73a0
-1, 295207, 1480, 0xfef384ae
-1, 301202, 1850, 0x3b93e0f7
-1, 308694, 1480, 0x28d27bae
-1, 314688, 1480, 0x94d57da5
-1, 320682, 1480, 0xc9327db5
-1, 326676, 1850, 0xe781f604
-1, 334169, 1480, 0x752f8c5b
-1, 340163, 1480, 0x30068032
-1, 346157, 1850, 0x7895023e
-1, 353650, 1480, 0xa1e0a6e1
-1, 359644, 1480, 0x6af4b500
-1, 365638, 1480, 0xc26ea4c7
-1, 371632, 1850, 0x16a72419
-1, 379124, 1480, 0x1794aacc
-1, 385118, 1480, 0x2ecad8d0
-1, 391112, 1850, 0x2e645e07
-1, 398605, 1480, 0x1c54dfe7
-1, 404599, 1480, 0xbd35feec
-1, 410593, 1480, 0x419403d6
-1, 416587, 1850, 0x78699d2a
-1, 424080, 1480, 0x74ec68e0
-1, 430074, 1480, 0x76af64d9
-1, 436068, 1850, 0x5a303d1a
-1, 443560, 1074, 0x142ce7ba
-1, 447910, 1850, 0x7ff682f7
diff --git a/tests/ref/fate/bfi b/tests/ref/fate/bfi
deleted file mode 100644
index b0d853b..0000000
--- a/tests/ref/fate/bfi
+++ /dev/null
@@ -1,114 +0,0 @@
-1, 0, 17768, 0x07df135c
-0, 0, 134400, 0xc218b00c
-0, 10000, 134400, 0x114daf7c
-0, 20000, 134400, 0xe14db24c
-0, 30000, 134400, 0x88c71df7
-0, 40000, 134400, 0xc98c09fc
-0, 50000, 134400, 0xf7c2e7a9
-0, 60000, 134400, 0xf54f304f
-0, 70000, 134400, 0x67370fdd
-1, 72522, 2220, 0x44953646
-0, 80000, 134400, 0xe70f43cd
-1, 81584, 2220, 0x256b3329
-0, 90000, 134400, 0xad74c06f
-1, 90645, 2222, 0x344d20c6
-1, 99714, 2220, 0xd8ee20db
-0, 100000, 134400, 0xef42fdf2
-1, 108776, 2222, 0x46d70aa2
-0, 110000, 134400, 0xa14cc4b8
-1, 117845, 2220, 0xbe0a2213
-0, 120000, 134400, 0xc6e57381
-1, 126906, 2222, 0x4ee0fd07
-0, 130000, 134400, 0x74b4804b
-1, 135976, 2220, 0x709dfe87
-0, 140000, 134400, 0xe0863d6f
-1, 145037, 2222, 0xbb382521
-0, 150000, 134400, 0x90b6d03c
-1, 154106, 2220, 0x6dba1d2d
-0, 160000, 134400, 0x3d0409fd
-1, 163167, 2222, 0xbc4cdd6d
-0, 170000, 134400, 0xc02e09a4
-1, 172237, 2220, 0x54340d2c
-0, 180000, 134400, 0xa3515997
-1, 181298, 2220, 0x8925d335
-0, 190000, 134400, 0xc0fda122
-1, 190359, 2222, 0xa39bd15f
-1, 199429, 2220, 0x6875f632
-0, 200000, 134400, 0x5380d707
-1, 208490, 2222, 0xda46be57
-0, 210000, 134400, 0xcc19c085
-1, 217559, 2220, 0xd591eb44
-0, 220000, 134400, 0x8041e977
-1, 226620, 2222, 0x33afd17f
-0, 230000, 134400, 0xb96b2bea
-1, 235690, 2220, 0xd97be03b
-0, 240000, 134400, 0xcc977ca7
-1, 244751, 2222, 0x3b71e82e
-0, 250000, 134400, 0xe37abb34
-1, 253820, 2220, 0x95fbec2b
-0, 260000, 134400, 0xce488baa
-1, 262882, 2220, 0xae3a1c1e
-0, 270000, 134400, 0xa0734e8a
-1, 271943, 2222, 0x46cd0973
-0, 280000, 134400, 0x6b5ce0b0
-1, 281012, 2220, 0x7b28f3f6
-0, 290000, 134400, 0xf207f938
-1, 290073, 2222, 0xa2a5bc47
-1, 299143, 2220, 0x4727df63
-0, 300000, 134400, 0xe10060f8
-1, 308204, 2222, 0xdf53f4e2
-0, 310000, 134400, 0xaebe6b37
-1, 317273, 2220, 0x469c1e8f
-0, 320000, 134400, 0x08ea5c75
-1, 326335, 2222, 0x3c541799
-0, 330000, 134400, 0x05c6b514
-1, 335404, 2220, 0xc8d21fee
-0, 340000, 134400, 0x68cb3703
-1, 344465, 2222, 0x5f52126f
-0, 350000, 134400, 0x48867fd0
-1, 353535, 2220, 0x06a9ff18
-0, 360000, 134400, 0xc53eda30
-1, 362596, 2220, 0x84f9aa2b
-0, 370000, 134400, 0x0c1b198d
-1, 371657, 2222, 0xe0518c83
-0, 380000, 134400, 0xc8ac5bc8
-1, 380727, 2220, 0xc85ee26c
-1, 389788, 2222, 0xda23fd2d
-0, 390000, 134400, 0x9e35240d
-1, 398857, 2220, 0x7ee2e818
-0, 400000, 134400, 0x885d142f
-1, 407918, 2222, 0x45eb0465
-0, 410000, 134400, 0x207cb4ac
-1, 416988, 2220, 0xf3e90549
-0, 420000, 134400, 0x0abe748b
-1, 426049, 2222, 0x17aacf3d
-0, 430000, 134400, 0xf13e991b
-1, 435118, 2220, 0x6cb7e325
-0, 440000, 134400, 0x2544248d
-1, 444180, 2220, 0x20164553
-0, 450000, 134400, 0x5444bb22
-1, 453241, 2222, 0x00000000
-0, 460000, 134400, 0xc5a8f55a
-1, 462310, 2220, 0x00000000
-0, 470000, 134400, 0xe6006820
-1, 471371, 2222, 0x00000000
-0, 480000, 134400, 0x2a34239d
-1, 480441, 2220, 0x00000000
-1, 489502, 2222, 0x00000000
-0, 490000, 134400, 0x26deac5b
-1, 498571, 2220, 0x00000000
-0, 500000, 134400, 0x82c2c0a9
-1, 507633, 2222, 0x00000000
-0, 510000, 134400, 0xcdd8daba
-1, 516702, 2450, 0x00000000
-0, 520000, 134400, 0x5a1a2105
-1, 526702, 2450, 0x00000000
-0, 530000, 134400, 0x2ad43604
-1, 536702, 2450, 0x00000000
-0, 540000, 134400, 0xa9b58f35
-1, 546702, 2450, 0x00000000
-0, 550000, 134400, 0x0e37a7a8
-1, 556702, 2450, 0x00000000
-0, 560000, 134400, 0xd288eef7
-1, 566702, 2450, 0x00000000
-1, 576702, 2450, 0x00000000
diff --git a/tests/ref/fate/bink-demux b/tests/ref/fate/bink-demux
deleted file mode 100644
index b721f0d..0000000
--- a/tests/ref/fate/bink-demux
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x839f34e6
diff --git a/tests/ref/fate/bink-demux-video b/tests/ref/fate/bink-demux-video
deleted file mode 100644
index 22fb3c5..0000000
--- a/tests/ref/fate/bink-demux-video
+++ /dev/null
@@ -1,20 +0,0 @@
-0, 0, 460800, 0xb06f7841
-0, 6000, 460800, 0x7ed06412
-0, 12000, 460800, 0xe82b5c3d
-0, 18000, 460800, 0x67284940
-0, 24000, 460800, 0x17e2c544
-0, 30000, 460800, 0x5dc65d36
-0, 36000, 460800, 0x7de63f90
-0, 42000, 460800, 0x15c8cf7d
-0, 48000, 460800, 0xbffe4047
-0, 54000, 460800, 0xcabcc150
-0, 60000, 460800, 0xe8a17ebe
-0, 66000, 460800, 0x27e94c03
-0, 72000, 460800, 0x71c0f48e
-0, 78000, 460800, 0x5fc8f783
-0, 84000, 460800, 0xd23d336a
-0, 90000, 460800, 0xa7aca9e0
-0, 96000, 460800, 0x1dff2144
-0, 102000, 460800, 0x82cf8b2b
-0, 108000, 460800, 0x4cbe3544
-0, 114000, 460800, 0x7e724731
diff --git a/tests/ref/fate/caf b/tests/ref/fate/caf
deleted file mode 100644
index a400501..0000000
--- a/tests/ref/fate/caf
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x5b74195c
diff --git a/tests/ref/fate/cdgraphics b/tests/ref/fate/cdgraphics
deleted file mode 100644
index 0f9e74e..0000000
--- a/tests/ref/fate/cdgraphics
+++ /dev/null
@@ -1,299 +0,0 @@
-0, 0, 194400, 0xd919c635
-0, 300, 194400, 0xd919c635
-0, 600, 194400, 0x516a1007
-0, 900, 194400, 0x516a1007
-0, 1200, 194400, 0x516a1007
-0, 1500, 194400, 0x516a1007
-0, 1800, 194400, 0x516a1007
-0, 2100, 194400, 0x516a1007
-0, 2400, 194400, 0x516a1007
-0, 2700, 194400, 0x516a1007
-0, 3000, 194400, 0x516a1007
-0, 3300, 194400, 0x516a1007
-0, 3600, 194400, 0x516a1007
-0, 3900, 194400, 0x516a1007
-0, 4200, 194400, 0x516a1007
-0, 4500, 194400, 0x516a1007
-0, 4800, 194400, 0x46ad80da
-0, 5100, 194400, 0x46ad80da
-0, 5400, 194400, 0x46ad80da
-0, 5700, 194400, 0x46ad80da
-0, 6000, 194400, 0x46ad80da
-0, 6300, 194400, 0x46ad80da
-0, 6600, 194400, 0x46ad80da
-0, 6900, 194400, 0x46ad80da
-0, 7200, 194400, 0x46ad80da
-0, 7500, 194400, 0x46ad80da
-0, 7800, 194400, 0x46ad80da
-0, 8100, 194400, 0x46ad80da
-0, 8400, 194400, 0x46ad80da
-0, 8700, 194400, 0x46ad80da
-0, 9000, 194400, 0x46ad80da
-0, 9300, 194400, 0x46ad80da
-0, 9600, 194400, 0x9392c3b9
-0, 9900, 194400, 0x9ff8cbb1
-0, 10200, 194400, 0xd015dba1
-0, 10500, 194400, 0x6a39f18b
-0, 10800, 194400, 0x7b8cf983
-0, 11100, 194400, 0x07a20f7c
-0, 11400, 194400, 0xa63e2962
-0, 11700, 194400, 0xa63e2962
-0, 12000, 194400, 0x2dd54447
-0, 12300, 194400, 0x90735e2d
-0, 12600, 194400, 0x90735e2d
-0, 12900, 194400, 0x90d98506
-0, 13200, 194400, 0xe5b08ffb
-0, 13500, 194400, 0xe5b08ffb
-0, 13800, 194400, 0x7a0d95f5
-0, 14100, 194400, 0xff6bacde
-0, 14400, 194400, 0xff6bacde
-0, 14700, 194400, 0xd998c2c8
-0, 15000, 194400, 0x3d1ddfab
-0, 15300, 194400, 0x3d1ddfab
-0, 15600, 194400, 0x817de4a6
-0, 15900, 194400, 0xfa3ef694
-0, 16200, 194400, 0xfa3ef694
-0, 16500, 194400, 0x0b5bfb8f
-0, 16800, 194400, 0x00f62376
-0, 17100, 194400, 0x00f62376
-0, 17400, 194400, 0x2f6b2d6c
-0, 17700, 194400, 0x40cb4752
-0, 18000, 194400, 0x40cb4752
-0, 18300, 194400, 0xd8456435
-0, 18600, 194400, 0x459f6a2f
-0, 18900, 194400, 0x459f6a2f
-0, 19200, 194400, 0x9b678910
-0, 19500, 194400, 0x8791a1f7
-0, 19800, 194400, 0x8791a1f7
-0, 20100, 194400, 0xdb4ac5d3
-0, 20400, 194400, 0xb223c8d0
-0, 20700, 194400, 0xb223c8d0
-0, 21000, 194400, 0x4a9ce7b1
-0, 21300, 194400, 0x187eeaae
-0, 21600, 194400, 0x187eeaae
-0, 21900, 194400, 0xc712f8a0
-0, 22200, 194400, 0x549c00a7
-0, 22500, 194400, 0x549c00a7
-0, 22800, 194400, 0x4d991295
-0, 23100, 194400, 0xc41b2681
-0, 23400, 194400, 0xc41b2681
-0, 23700, 194400, 0xed5a3077
-0, 24000, 194400, 0x85ad4463
-0, 24300, 194400, 0x85ad4463
-0, 24600, 194400, 0xb98f4760
-0, 24900, 194400, 0x87ef5e49
-0, 25200, 194400, 0x87ef5e49
-0, 25500, 194400, 0x830a6146
-0, 25800, 194400, 0xe33a792e
-0, 26100, 194400, 0xe33a792e
-0, 26400, 194400, 0x83517a2d
-0, 26700, 194400, 0xa97e9314
-0, 27000, 194400, 0xa97e9314
-0, 27300, 194400, 0x39059611
-0, 27600, 194400, 0xbf4eb9ed
-0, 27900, 194400, 0xbf4eb9ed
-0, 28200, 194400, 0xe5afc4e2
-0, 28500, 194400, 0x35d4cdd9
-0, 28800, 194400, 0x35d4cdd9
-0, 29100, 194400, 0xb376e1c5
-0, 29400, 194400, 0x6128e3c3
-0, 29700, 194400, 0x6128e3c3
-0, 30000, 194400, 0x30b7f7af
-0, 30300, 194400, 0xf1effaac
-0, 30600, 194400, 0xf1effaac
-0, 30900, 194400, 0x483914a1
-0, 31200, 194400, 0xbd48199c
-0, 31500, 194400, 0xbd48199c
-0, 31800, 194400, 0x382f2d88
-0, 32100, 194400, 0x5a573085
-0, 32400, 194400, 0x5a573085
-0, 32700, 194400, 0x89733580
-0, 33000, 194400, 0xd1325a5b
-0, 33300, 194400, 0xd1325a5b
-0, 33600, 194400, 0x655b6253
-0, 33900, 194400, 0x55146352
-0, 34200, 194400, 0x55146352
-0, 34500, 194400, 0xda527c39
-0, 34800, 194400, 0xb0cd7e37
-0, 35100, 194400, 0xb0cd7e37
-0, 35400, 194400, 0x25e7991c
-0, 35700, 194400, 0x5c22a411
-0, 36000, 194400, 0x5c22a411
-0, 36300, 194400, 0x1e2abdf7
-0, 36600, 194400, 0x8308bff5
-0, 36900, 194400, 0x8308bff5
-0, 37200, 194400, 0xfdbfd6de
-0, 37500, 194400, 0xd4d4d9db
-0, 37800, 194400, 0xd4d4d9db
-0, 38100, 194400, 0xa449fbb9
-0, 38400, 194400, 0x3dcafdb7
-0, 38700, 194400, 0x3dcafdb7
-0, 39000, 194400, 0x6f1f01c2
-0, 39300, 194400, 0xf54a1da6
-0, 39600, 194400, 0xf54a1da6
-0, 39900, 194400, 0x88d11fa4
-0, 40200, 194400, 0x59642d96
-0, 40500, 194400, 0x59642d96
-0, 40800, 194400, 0x8ba44182
-0, 41100, 194400, 0x88f56360
-0, 41400, 194400, 0x88f56360
-0, 41700, 194400, 0xfb246d56
-0, 42000, 194400, 0xad128043
-0, 42300, 194400, 0xad128043
-0, 42600, 194400, 0x3a4f8a39
-0, 42900, 194400, 0x563d9d26
-0, 43200, 194400, 0x563d9d26
-0, 43500, 194400, 0x6ff8a320
-0, 43800, 194400, 0xcdb9b70c
-0, 44100, 194400, 0xcdb9b70c
-0, 44400, 194400, 0x99c2bd06
-0, 44700, 194400, 0x4b47cef4
-0, 45000, 194400, 0x4b47cef4
-0, 45300, 194400, 0x10b9dce6
-0, 45600, 194400, 0xdd39f1d1
-0, 45900, 194400, 0xdd39f1d1
-0, 46200, 194400, 0xbcf104cd
-0, 46500, 194400, 0x85ec17ba
-0, 46800, 194400, 0x85ec17ba
-0, 47100, 194400, 0x069219b8
-0, 47400, 194400, 0x84dd3899
-0, 47700, 194400, 0x84dd3899
-0, 48000, 194400, 0xacca4190
-0, 48300, 194400, 0xcf5b5d74
-0, 48600, 194400, 0xcf5b5d74
-0, 48900, 194400, 0x4b8c626f
-0, 49200, 194400, 0xf0817958
-0, 49500, 194400, 0xf0817958
-0, 49800, 194400, 0xc0887e53
-0, 50100, 194400, 0x42e6854c
-0, 50400, 194400, 0x42e6854c
-0, 50700, 194400, 0x036c9140
-0, 51000, 194400, 0x0f21a62b
-0, 51300, 194400, 0x0f21a62b
-0, 51600, 194400, 0xcdaeaa27
-0, 51900, 194400, 0xe425bc15
-0, 52200, 194400, 0xe425bc15
-0, 52500, 194400, 0x8e18c20f
-0, 52800, 194400, 0x767cd5fb
-0, 53100, 194400, 0x767cd5fb
-0, 53400, 194400, 0x554ae6ea
-0, 53700, 194400, 0xeac1f9d7
-0, 54000, 194400, 0xeac1f9d7
-0, 54300, 194400, 0x0b32fed2
-0, 54600, 194400, 0xe30c19c6
-0, 54900, 194400, 0xe30c19c6
-0, 55200, 194400, 0x6a8a23bc
-0, 55500, 194400, 0x26bf36a9
-0, 55800, 194400, 0x26bf36a9
-0, 56100, 194400, 0x1e4f3fa0
-0, 56400, 194400, 0x231f5986
-0, 56700, 194400, 0x231f5986
-0, 57000, 194400, 0xf557756a
-0, 57300, 194400, 0x6bce805f
-0, 57600, 194400, 0x6bce805f
-0, 57900, 194400, 0xcd80924d
-0, 58200, 194400, 0x65dc9f40
-0, 58500, 194400, 0x65dc9f40
-0, 58800, 194400, 0x2ab7af30
-0, 59100, 194400, 0xd43cb728
-0, 59400, 194400, 0xd43cb728
-0, 59700, 194400, 0x05d9c916
-0, 60000, 194400, 0x43cad10e
-0, 60300, 194400, 0x43cad10e
-0, 60600, 194400, 0x06b5e0fe
-0, 60900, 194400, 0xa142f0ee
-0, 61200, 194400, 0xa142f0ee
-0, 61500, 194400, 0xed7f03ea
-0, 61800, 194400, 0xf26019d4
-0, 62100, 194400, 0xf26019d4
-0, 62400, 194400, 0x3b7f29c4
-0, 62700, 194400, 0x30282ebf
-0, 63000, 194400, 0x30282ebf
-0, 63300, 194400, 0xaeff4aa3
-0, 63600, 194400, 0x1d355697
-0, 63900, 194400, 0x1d355697
-0, 64200, 194400, 0x2ead6f7e
-0, 64500, 194400, 0xf1b67776
-0, 64800, 194400, 0xf1b67776
-0, 65100, 194400, 0x93b38b62
-0, 65400, 194400, 0x9469905d
-0, 65700, 194400, 0x9469905d
-0, 66000, 194400, 0x27bf9756
-0, 66300, 194400, 0xd016a548
-0, 66600, 194400, 0xd016a548
-0, 66900, 194400, 0x6889b835
-0, 67200, 194400, 0x6a05be2f
-0, 67500, 194400, 0x6a05be2f
-0, 67800, 194400, 0xe0a1ce1f
-0, 68100, 194400, 0x8fdbd617
-0, 68400, 194400, 0x8fdbd617
-0, 68700, 194400, 0xd68fe805
-0, 69000, 194400, 0x0d1dfbf1
-0, 69300, 194400, 0x0d1dfbf1
-0, 69600, 194400, 0x0fe70bf0
-0, 69900, 194400, 0x0a8f13e8
-0, 70200, 194400, 0x0a8f13e8
-0, 70500, 194400, 0x0ca42bd0
-0, 70800, 194400, 0x6f3838c3
-0, 71100, 194400, 0x6f3838c3
-0, 71400, 194400, 0x045448b3
-0, 71700, 194400, 0x764349b2
-0, 72000, 194400, 0x764349b2
-0, 72300, 194400, 0xed1651aa
-0, 72600, 194400, 0xbb376398
-0, 72900, 194400, 0xbb376398
-0, 73200, 194400, 0xd0d5718a
-0, 73500, 194400, 0xcd977e7d
-0, 73800, 194400, 0xcd977e7d
-0, 74100, 194400, 0x8cb39665
-0, 74400, 194400, 0xb935b04b
-0, 74700, 194400, 0xb935b04b
-0, 75000, 194400, 0x0292be3d
-0, 75300, 194400, 0x4f21c833
-0, 75600, 194400, 0x4f21c833
-0, 75900, 194400, 0xa5c7d823
-0, 76200, 194400, 0xfb8ee01b
-0, 76500, 194400, 0xfb8ee01b
-0, 76800, 194400, 0xea53ee0d
-0, 77100, 194400, 0x803efcfe
-0, 77400, 194400, 0x803efcfe
-0, 77700, 194400, 0x2c0e0aff
-0, 78000, 194400, 0x3df318f1
-0, 78300, 194400, 0x3df318f1
-0, 78600, 194400, 0xc4cb26e3
-0, 78900, 194400, 0x92a033d6
-0, 79200, 194400, 0x92a033d6
-0, 79500, 194400, 0x1b2048c1
-0, 79800, 194400, 0x236858b1
-0, 80100, 194400, 0x236858b1
-0, 80400, 194400, 0x482f6d9c
-0, 80700, 194400, 0x9ee97891
-0, 81000, 194400, 0x9ee97891
-0, 81300, 194400, 0xe0dc8683
-0, 81600, 194400, 0x461b9079
-0, 81900, 194400, 0x461b9079
-0, 82200, 194400, 0xd346a960
-0, 82500, 194400, 0xa384b554
-0, 82800, 194400, 0xa384b554
-0, 83100, 194400, 0x3246cf3a
-0, 83400, 194400, 0xa53fe722
-0, 83700, 194400, 0xa53fe722
-0, 84000, 194400, 0xe620fd0c
-0, 84300, 194400, 0xd6370414
-0, 84600, 194400, 0xd6370414
-0, 84900, 194400, 0xf57f1404
-0, 85200, 194400, 0x8c6420f7
-0, 85500, 194400, 0x8c6420f7
-0, 85800, 194400, 0xd4be3add
-0, 86100, 194400, 0xa8dc4ec9
-0, 86400, 194400, 0xa8dc4ec9
-0, 86700, 194400, 0xda1563b4
-0, 87000, 194400, 0xd51873a4
-0, 87300, 194400, 0xd51873a4
-0, 87600, 194400, 0x68588196
-0, 87900, 194400, 0x40d18e89
-0, 88200, 194400, 0x40d18e89
-0, 88500, 194400, 0x1b75a275
-0, 88800, 194400, 0xedd1a572
-0, 89100, 194400, 0xedd1a572
-0, 89400, 194400, 0x55daad6a
diff --git a/tests/ref/fate/cljr b/tests/ref/fate/cljr
deleted file mode 100644
index 7221b9e..0000000
--- a/tests/ref/fate/cljr
+++ /dev/null
@@ -1,36 +0,0 @@
-0, 0, 64800, 0x44a1c47c
-0, 3169, 64800, 0x649cc3a4
-0, 6338, 64800, 0xcab1b88c
-0, 9507, 64800, 0xf56cb788
-0, 12676, 64800, 0x5336b618
-0, 15845, 64800, 0x2704b438
-0, 19013, 64800, 0x04c7b8e4
-0, 22182, 64800, 0x3185b288
-0, 25351, 64800, 0xa537c410
-0, 28520, 64800, 0x6495c0f8
-0, 31689, 64800, 0x06a1ca14
-0, 34858, 64800, 0x69cdd2a0
-0, 38027, 64800, 0x4ad2d828
-0, 41196, 64800, 0x9604dea4
-0, 44365, 64800, 0x1c00e430
-0, 47534, 64800, 0x9afeefe0
-0, 50702, 64800, 0xc13fdd78
-0, 53871, 64800, 0x8438da7c
-0, 57040, 64800, 0xa0ead278
-0, 60209, 64800, 0xbeced2d8
-0, 63378, 64800, 0x85bbd7dc
-0, 66547, 64800, 0xbe59ce34
-0, 69716, 64800, 0xd76ecccc
-0, 72885, 64800, 0xe182b474
-0, 76054, 64800, 0x916cc394
-0, 79223, 64800, 0x7efebd14
-0, 82391, 64800, 0x8d28c9f0
-0, 85560, 64800, 0x00a1c960
-0, 88729, 64800, 0xc164c400
-0, 91898, 64800, 0xfd4dc544
-0, 95067, 64800, 0x01bfbe38
-0, 98236, 64800, 0xff11b5d0
-0, 101405, 64800, 0x4876bb20
-0, 104574, 64800, 0x756ecb04
-0, 107743, 64800, 0x3b8cd540
-0, 110912, 64800, 0x063ed444
diff --git a/tests/ref/fate/corepng b/tests/ref/fate/corepng
deleted file mode 100644
index 7b01e7a..0000000
--- a/tests/ref/fate/corepng
+++ /dev/null
@@ -1,37 +0,0 @@
-1, 0, 11026, 0x27ad637c
-0, 0, 230400, 0x03e25ead
-0, 6000, 230400, 0x0a520ffd
-0, 12000, 230400, 0x0b11a671
-0, 18000, 230400, 0x7d3fce32
-0, 24000, 230400, 0x1edb18cc
-0, 30000, 230400, 0x1d470493
-0, 36000, 230400, 0xe53ba01d
-0, 42000, 230400, 0xc4df13c2
-1, 45004, 1470, 0x4af4b7a3
-0, 48000, 230400, 0x5febe6c9
-1, 51004, 1470, 0x2601fc3b
-0, 54000, 230400, 0xb0de2ed9
-1, 57004, 1470, 0xd94ec488
-0, 60000, 230400, 0x4991ee21
-1, 63004, 1470, 0x5ffb6bdd
-0, 66000, 230400, 0x6b367a75
-1, 69004, 1470, 0xc5fece50
-0, 72000, 230400, 0x1d406b55
-1, 75004, 1470, 0xf4988a98
-0, 78000, 230400, 0x2bbbf1d3
-1, 81004, 1470, 0xa839620f
-0, 84000, 230400, 0x2a5ee265
-1, 87004, 1470, 0x800a77ff
-0, 90000, 230400, 0x0ae9de8d
-1, 93004, 1470, 0x8fc8a729
-0, 96000, 230400, 0x567eabf8
-1, 99004, 1470, 0x78708001
-0, 102000, 230400, 0x00260e67
-1, 105004, 1470, 0xb601958b
-1, 111004, 1470, 0xb054d1d3
-1, 117004, 1470, 0xce18bb41
-1, 123004, 1470, 0x43d182f9
-1, 129004, 1470, 0xe9448449
-1, 135004, 1470, 0x175ea4b3
-1, 141004, 1470, 0xf96b0e6a
-1, 147004, 1470, 0x12cc42fb
diff --git a/tests/ref/fate/creative-adpcm b/tests/ref/fate/creative-adpcm
deleted file mode 100644
index 039ca3a..0000000
--- a/tests/ref/fate/creative-adpcm
+++ /dev/null
@@ -1 +0,0 @@
-66004779a5e51ca659b21a4197e019e6
diff --git a/tests/ref/fate/creative-adpcm-8-2.6bit b/tests/ref/fate/creative-adpcm-8-2.6bit
deleted file mode 100644
index 8357604..0000000
--- a/tests/ref/fate/creative-adpcm-8-2.6bit
+++ /dev/null
@@ -1 +0,0 @@
-dee4417597abc2db70a175d6809870e7
diff --git a/tests/ref/fate/creative-adpcm-8-2bit b/tests/ref/fate/creative-adpcm-8-2bit
deleted file mode 100644
index 4166846..0000000
--- a/tests/ref/fate/creative-adpcm-8-2bit
+++ /dev/null
@@ -1 +0,0 @@
-832846066fbce28821b7f0717c4d3a90
diff --git a/tests/ref/fate/creative-adpcm-8-4bit b/tests/ref/fate/creative-adpcm-8-4bit
deleted file mode 100644
index 2d579aa..0000000
--- a/tests/ref/fate/creative-adpcm-8-4bit
+++ /dev/null
@@ -1 +0,0 @@
-1813d196cef83f7030bb150399b2903e
diff --git a/tests/ref/fate/creatureshock-avs b/tests/ref/fate/creatureshock-avs
deleted file mode 100644
index 54ed2f8..0000000
--- a/tests/ref/fate/creatureshock-avs
+++ /dev/null
@@ -1,92 +0,0 @@
-1, 0, 16372, 0xfaaab59d
-0, 0, 188892, 0xcb5be3dd
-0, 6000, 188892, 0x0f313ebc
-0, 12000, 188892, 0xc0da25cc
-0, 18000, 188892, 0xad6e1d44
-0, 24000, 188892, 0xb1103b40
-0, 30000, 188892, 0xae033450
-1, 33154, 4028, 0xc2daed72
-0, 36000, 188892, 0xb31f03b4
-1, 41310, 5486, 0xf7fd794d
-0, 42000, 188892, 0xacb2d3f9
-0, 48000, 188892, 0x7d77ecbd
-1, 52420, 5790, 0xfd5a369f
-0, 54000, 188892, 0x7faa2f6c
-0, 60000, 188892, 0x28f4fdf1
-1, 64145, 1068, 0x0b602cd0
-0, 66000, 188892, 0x4b53f3b9
-1, 66307, 4908, 0xfe870aad
-0, 72000, 188892, 0x1f09bb29
-1, 76246, 6062, 0x8a4d6e0f
-0, 78000, 188892, 0x3afcc11d
-0, 84000, 188892, 0x6b918e49
-1, 88522, 5402, 0x71fd352f
-0, 90000, 188892, 0x9630a04d
-0, 96000, 188892, 0x9381b4c1
-1, 99461, 544, 0xeb766d34
-1, 100563, 5906, 0x47ac7e08
-0, 102000, 188892, 0xa7dea7e5
-0, 108000, 188892, 0xd277c41d
-1, 112522, 5916, 0x0d26eb56
-0, 114000, 188892, 0xafa2a6c9
-0, 120000, 188892, 0x13a38839
-1, 124502, 4006, 0x9941c71a
-0, 126000, 188892, 0xcd5e5a6d
-0, 132000, 188892, 0xe7da71e9
-1, 132615, 2100, 0xc9a2ee36
-1, 136867, 5894, 0xd2ba4eaa
-0, 138000, 188892, 0x06928add
-0, 144000, 188892, 0x4a108eb9
-1, 148803, 6090, 0xf43e73d0
-0, 150000, 188892, 0xea2598f5
-0, 156000, 188892, 0x17ed6839
-1, 161135, 2288, 0x5a8b7aa0
-0, 162000, 188892, 0x9de6ab65
-1, 165768, 3850, 0x7f66eb2c
-0, 168000, 188892, 0xb4ee326f
-1, 173564, 5796, 0xc5cf3ee8
-0, 174000, 188892, 0x3f85095b
-0, 180000, 188892, 0xaab7e331
-1, 185302, 6042, 0xed80136d
-0, 186000, 188892, 0xc2a079e1
-0, 192000, 188892, 0x612080c2
-1, 197537, 684, 0xc42bd137
-0, 198000, 188892, 0xa7232d47
-1, 198922, 5436, 0xb7f8a6fd
-0, 204000, 188892, 0xc053297d
-1, 209930, 6098, 0xee6354a2
-0, 210000, 188892, 0x1ecc3bfe
-0, 216000, 188892, 0xcc4ac803
-0, 222000, 188892, 0x4b90047b
-1, 222278, 4838, 0x129e61d0
-0, 228000, 188892, 0xd863b643
-1, 232075, 1074, 0x9da90634
-0, 234000, 188892, 0x93a25fb1
-1, 234250, 6084, 0x8ffed952
-0, 240000, 188892, 0xf969e131
-0, 246000, 188892, 0x73bd2469
-1, 246571, 6038, 0xa07b4276
-0, 252000, 188892, 0x265a9ce2
-0, 258000, 188892, 0xd59ccd39
-1, 258798, 3176, 0xebef63c1
-0, 264000, 188892, 0xe50fc068
-1, 265229, 2794, 0xbe1000db
-0, 270000, 188892, 0x83113a86
-1, 270887, 6020, 0xd8e34961
-0, 276000, 188892, 0xa0203504
-0, 282000, 188892, 0x9e2d518c
-1, 283078, 6020, 0xc07cf461
-0, 288000, 188892, 0x5f610e66
-0, 294000, 188892, 0x9b77f900
-1, 295268, 1538, 0xc975ae02
-1, 298383, 4230, 0x0827111b
-0, 300000, 188892, 0xaaf279c2
-0, 306000, 188892, 0x4ac97cc2
-1, 306949, 6084, 0x2cf0a407
-0, 312000, 188892, 0xddd91642
-0, 318000, 188892, 0x4f32dcd1
-1, 319269, 5828, 0x12750279
-0, 324000, 188892, 0xdc126b42
-0, 330000, 188892, 0x00000000
-1, 331071, 230, 0xc9c03f3b
-1, 331536, 768, 0x6137a04d
diff --git a/tests/ref/fate/cryo-apc b/tests/ref/fate/cryo-apc
deleted file mode 100644
index 16e1dd6..0000000
--- a/tests/ref/fate/cryo-apc
+++ /dev/null
@@ -1 +0,0 @@
-6dcee91d3364f389f804da7a25934b36
diff --git a/tests/ref/fate/cscd b/tests/ref/fate/cscd
deleted file mode 100644
index 75a7725..0000000
--- a/tests/ref/fate/cscd
+++ /dev/null
@@ -1,208 +0,0 @@
-0, 0, 270000, 0xf90015d8
-0, 2880, 270000, 0xf90015d8
-0, 5760, 270000, 0xf90015d8
-0, 8640, 270000, 0xf90015d8
-0, 11520, 270000, 0xf90015d8
-0, 14400, 270000, 0xf90015d8
-0, 17280, 270000, 0xf90015d8
-0, 20160, 270000, 0xf90015d8
-0, 23040, 270000, 0xf90015d8
-0, 25920, 270000, 0xf90015d8
-0, 28800, 270000, 0xf90015d8
-0, 31680, 270000, 0xf90015d8
-0, 34560, 270000, 0xf90015d8
-0, 37440, 270000, 0xf90015d8
-0, 40320, 270000, 0xf90015d8
-0, 43200, 270000, 0xf90015d8
-0, 46080, 270000, 0xf90015d8
-0, 48960, 270000, 0xf90015d8
-0, 51840, 270000, 0xf90015d8
-0, 54720, 270000, 0xf90015d8
-0, 57600, 270000, 0xf90015d8
-0, 60480, 270000, 0xf90015d8
-0, 63360, 270000, 0xf90015d8
-0, 66240, 270000, 0xf90015d8
-0, 69120, 270000, 0xf90015d8
-0, 72000, 270000, 0xf90015d8
-0, 74880, 270000, 0xf90015d8
-0, 77760, 270000, 0xf90015d8
-0, 80640, 270000, 0xf90015d8
-0, 83520, 270000, 0xf90015d8
-0, 86400, 270000, 0xf90015d8
-0, 89280, 270000, 0xf90015d8
-0, 92160, 270000, 0xf90015d8
-0, 95040, 270000, 0xf90015d8
-0, 97920, 270000, 0xf90015d8
-0, 100800, 270000, 0xf90015d8
-0, 103680, 270000, 0xf90015d8
-0, 106560, 270000, 0xf90015d8
-0, 109440, 270000, 0xf90015d8
-0, 112320, 270000, 0x1f9c15d8
-0, 115200, 270000, 0x436f15d8
-0, 118080, 270000, 0xe90115d8
-0, 120960, 270000, 0xe90115d8
-0, 123840, 270000, 0x8ea215d8
-0, 126720, 270000, 0x424015d8
-0, 129600, 270000, 0x0ce315d8
-0, 132480, 270000, 0x14bc15d8
-0, 135360, 270000, 0x2a9215d8
-0, 138240, 270000, 0x233f15d8
-0, 141120, 270000, 0x764b15d8
-0, 144000, 270000, 0xf76115d8
-0, 146880, 270000, 0xbbe015d8
-0, 149760, 270000, 0x95af15d8
-0, 152640, 270000, 0x324815d8
-0, 155520, 270000, 0x311915d8
-0, 158400, 270000, 0x090ef191
-0, 161280, 270000, 0xd88974dc
-0, 164160, 270000, 0xfa7f58df
-0, 167040, 270000, 0x78f849c3
-0, 169920, 270000, 0xae174892
-0, 172800, 270000, 0x9d4e2332
-0, 175680, 270000, 0x874b09b4
-0, 178560, 270000, 0x4069fed6
-0, 181440, 270000, 0x4069fed6
-0, 184320, 270000, 0x4069fed6
-0, 187200, 270000, 0x4069fed6
-0, 190080, 270000, 0x4069fed6
-0, 192960, 270000, 0x4069fed6
-0, 195840, 270000, 0x4069fed6
-0, 198720, 270000, 0x4069fed6
-0, 201600, 270000, 0x4069fed6
-0, 204480, 270000, 0x4069fed6
-0, 207360, 270000, 0x4069fed6
-0, 210240, 270000, 0x773db046
-0, 213120, 270000, 0x773db046
-0, 216000, 270000, 0x773db046
-0, 218880, 270000, 0x773db046
-0, 221760, 270000, 0x773db046
-0, 224640, 270000, 0x773db046
-0, 227520, 270000, 0x773db046
-0, 230400, 270000, 0x773db046
-0, 233280, 270000, 0x773db046
-0, 236160, 270000, 0x773db046
-0, 239040, 270000, 0x773db046
-0, 241920, 270000, 0x773db046
-0, 244800, 270000, 0x773db046
-0, 247680, 270000, 0x773db046
-0, 250560, 270000, 0x773db046
-0, 253440, 270000, 0x773db046
-0, 256320, 270000, 0x773db046
-0, 259200, 270000, 0x17b9aec9
-0, 262080, 270000, 0x622fad4c
-0, 264960, 270000, 0xdaea3aef
-0, 267840, 270000, 0x61bb10e3
-0, 270720, 270000, 0xfc37ee0c
-0, 273600, 270000, 0x50dbd01e
-0, 276480, 270000, 0xcd66c27c
-0, 279360, 270000, 0xd13f1e4f
-0, 282240, 270000, 0xa4a2dbf5
-0, 285120, 270000, 0xf302c9ab
-0, 288000, 270000, 0x4479f7fe
-0, 290880, 270000, 0x1afe92c8
-0, 293760, 270000, 0x3007f4c3
-0, 296640, 270000, 0x5834c096
-0, 299520, 270000, 0x40109126
-0, 302400, 270000, 0x0a7b8882
-0, 305280, 270000, 0x15b8635d
-0, 308160, 270000, 0xeaa5598e
-0, 311040, 270000, 0x0b7b5489
-0, 313920, 270000, 0x0b7b5489
-0, 316800, 270000, 0x0b7b5489
-0, 319680, 270000, 0x0b7b5489
-0, 322560, 270000, 0x8f0e6eaa
-0, 325440, 270000, 0xc46fc0f2
-0, 328320, 270000, 0xadd7e605
-0, 331200, 270000, 0x9d23a056
-0, 334080, 270000, 0x365afa63
-0, 336960, 270000, 0x6ac3bda2
-0, 339840, 270000, 0x14f5daf2
-0, 342720, 270000, 0x4b3afb6a
-0, 345600, 270000, 0x1a3302e3
-0, 348480, 270000, 0x1a3302e3
-0, 351360, 270000, 0x1a3302e3
-0, 354240, 270000, 0x1a3302e3
-0, 357120, 270000, 0xc15526e2
-0, 360000, 270000, 0x3dd73006
-0, 362880, 270000, 0x60abb5bc
-0, 365760, 270000, 0xb960c27c
-0, 368640, 270000, 0x8fa4c01c
-0, 371520, 270000, 0x8fa4c01c
-0, 374400, 270000, 0x8fa4c01c
-0, 377280, 270000, 0xb20dcc38
-0, 380160, 270000, 0x03c6ad3c
-0, 383040, 270000, 0xe550b194
-0, 385920, 270000, 0xe550b194
-0, 388800, 270000, 0xe550b194
-0, 391680, 270000, 0xe550b194
-0, 394560, 270000, 0xe550b194
-0, 397440, 270000, 0xe550b194
-0, 400320, 270000, 0xe550b194
-0, 403200, 270000, 0xe550b194
-0, 406080, 270000, 0xe550b194
-0, 408960, 270000, 0xe550b194
-0, 411840, 270000, 0xe550b194
-0, 414720, 270000, 0xe550b194
-0, 417600, 270000, 0xe550b194
-0, 420480, 270000, 0xe550b194
-0, 423360, 270000, 0x4550a014
-0, 426240, 270000, 0xaf639da8
-0, 429120, 270000, 0xe4229da8
-0, 432000, 270000, 0x315d9da8
-0, 434880, 270000, 0x7e899da8
-0, 437760, 270000, 0x99b9a8a0
-0, 440640, 270000, 0x4588ac2a
-0, 443520, 270000, 0x1e79ae6e
-0, 446400, 270000, 0xa003cb14
-0, 449280, 270000, 0x03ef1bb8
-0, 452160, 270000, 0x3b3f30fc
-0, 455040, 270000, 0x4dad3525
-0, 457920, 270000, 0x5b600c12
-0, 460800, 270000, 0x75a1fab3
-0, 463680, 270000, 0xc9f7d9ad
-0, 466560, 270000, 0x9eaec58d
-0, 469440, 270000, 0xb91bc3e8
-0, 472320, 270000, 0x77bdbbfb
-0, 475200, 270000, 0x77bdbbfb
-0, 478080, 270000, 0x77bdbbfb
-0, 480960, 270000, 0x77bdbbfb
-0, 483840, 270000, 0x77bdbbfb
-0, 486720, 270000, 0x77bdbbfb
-0, 489600, 270000, 0x3d54eac2
-0, 492480, 270000, 0x3d54eac2
-0, 495360, 270000, 0x3d54eac2
-0, 498240, 270000, 0x3d54eac2
-0, 501120, 270000, 0x3d54eac2
-0, 504000, 270000, 0x3d54eac2
-0, 506880, 270000, 0x3d54eac2
-0, 509760, 270000, 0x3d54eac2
-0, 512640, 270000, 0x3d54eac2
-0, 515520, 270000, 0x3d54eac2
-0, 518400, 270000, 0x3d54eac2
-0, 521280, 270000, 0x3d54eac2
-0, 524160, 270000, 0x3d54eac2
-0, 527040, 270000, 0x3d54eac2
-0, 529920, 270000, 0x3d54eac2
-0, 532800, 270000, 0x3d54eac2
-0, 535680, 270000, 0x3d54eac2
-0, 538560, 270000, 0x3d54eac2
-0, 541440, 270000, 0x3d54eac2
-0, 544320, 270000, 0x5f3609ba
-0, 547200, 270000, 0x80921b0c
-0, 550080, 270000, 0x80921b0c
-0, 552960, 270000, 0x80921b0c
-0, 555840, 270000, 0x80921b0c
-0, 558720, 270000, 0x80921b0c
-0, 561600, 270000, 0x80921b0c
-0, 564480, 270000, 0x80921b0c
-0, 567360, 270000, 0x80921b0c
-0, 570240, 270000, 0x80921b0c
-0, 573120, 270000, 0x80921b0c
-0, 576000, 270000, 0x80921b0c
-0, 578880, 270000, 0x80921b0c
-0, 581760, 270000, 0x80921b0c
-0, 584640, 270000, 0x80921b0c
-0, 587520, 270000, 0x80921b0c
-0, 590400, 270000, 0x80921b0c
-0, 593280, 270000, 0xf0e626a8
-0, 596160, 270000, 0xf0e626a8
diff --git a/tests/ref/fate/cvid b/tests/ref/fate/cvid
deleted file mode 100644
index d7ebe11..0000000
--- a/tests/ref/fate/cvid
+++ /dev/null
@@ -1,78 +0,0 @@
-0, 0, 112400, 0x829180d8
-0, 7500, 112400, 0xdbebac5b
-0, 15000, 112400, 0xc5adc0f7
-0, 22500, 112400, 0xbe1fc030
-0, 30000, 112400, 0xe08ab460
-0, 37500, 112400, 0xfde0dbc5
-0, 45000, 112400, 0xed9242b0
-0, 52500, 112400, 0x1ae3933a
-0, 60000, 112400, 0xc82d2f5b
-0, 67500, 112400, 0xbae9ddfc
-0, 75000, 112400, 0xa350a1f7
-0, 82500, 112400, 0x3cf78029
-0, 90000, 112400, 0xaa0b82bf
-0, 97500, 112400, 0x71aa4794
-0, 105000, 112400, 0x2fe57373
-0, 112500, 112400, 0x429c6f82
-0, 120000, 112400, 0xfb2d917d
-0, 127500, 112400, 0xcc84cb9a
-0, 135000, 112400, 0xc68f0613
-0, 142500, 112400, 0x05f30e6a
-0, 150000, 112400, 0x5c5d853d
-0, 157500, 112400, 0x01e0aff2
-0, 165000, 112400, 0xc3b2cf4a
-0, 172500, 112400, 0xc0a3cf19
-0, 180000, 112400, 0xc743abda
-0, 187500, 112400, 0x54bd17a2
-0, 195000, 112400, 0x616ef28d
-0, 202500, 112400, 0x04b51f59
-0, 210000, 112400, 0x857511a2
-0, 217500, 112400, 0x25c62440
-0, 225000, 112400, 0x8c78198d
-0, 232500, 112400, 0xc046c912
-0, 240000, 112400, 0x0d828630
-0, 247500, 112400, 0x48999b80
-0, 255000, 112400, 0x9a869e77
-0, 262500, 112400, 0x16d893df
-0, 270000, 112400, 0xf6b86132
-0, 277500, 112400, 0xfa564ea4
-0, 285000, 112400, 0xdd473f69
-0, 292500, 112400, 0xf89625a6
-0, 300000, 112400, 0x823a58aa
-0, 307500, 112400, 0x25e0fe43
-0, 315000, 112400, 0x41034522
-0, 322500, 112400, 0xb8da4f00
-0, 330000, 112400, 0x9f684fce
-0, 337500, 112400, 0xf7188710
-0, 345000, 112400, 0x428fbfc6
-0, 352500, 112400, 0x535bace0
-0, 360000, 112400, 0x23216059
-0, 367500, 112400, 0x9b8bbfa6
-0, 375000, 112400, 0x932be522
-0, 382500, 112400, 0xdbd31409
-0, 390000, 112400, 0x0a69bf18
-0, 397500, 112400, 0xa15ef128
-0, 405000, 112400, 0x49a1fa92
-0, 412500, 112400, 0xadeeaf62
-0, 420000, 112400, 0xc1ce636e
-0, 427500, 112400, 0x5ca544eb
-0, 435000, 112400, 0x07230a36
-0, 442500, 112400, 0x12ae2b53
-0, 450000, 112400, 0x62453ef6
-0, 457500, 112400, 0xe0588a98
-0, 465000, 112400, 0xacd3927a
-0, 472500, 112400, 0x5d3c6b01
-0, 480000, 112400, 0xda671808
-0, 487500, 112400, 0x61d0b492
-0, 495000, 112400, 0x068b1293
-0, 502500, 112400, 0x75b99287
-0, 510000, 112400, 0xe657e7d6
-0, 517500, 112400, 0x17873df6
-0, 525000, 112400, 0xa8db5e31
-0, 532500, 112400, 0x4f633b8e
-0, 540000, 112400, 0x22266252
-0, 547500, 112400, 0x308a6282
-0, 555000, 112400, 0xfdb356ce
-0, 562500, 112400, 0xe4394f1f
-0, 570000, 112400, 0x8ca8649f
-0, 577500, 112400, 0x804d44eb
diff --git a/tests/ref/fate/cvid-palette b/tests/ref/fate/cvid-palette
deleted file mode 100644
index 6f6ba11..0000000
--- a/tests/ref/fate/cvid-palette
+++ /dev/null
@@ -1,56 +0,0 @@
-0, 0, 57600, 0x1f5c89b7
-0, 6006, 57600, 0xd2055aaf
-0, 12012, 57600, 0x22336052
-0, 18018, 57600, 0xf7135e2a
-0, 24024, 57600, 0xd9de126a
-0, 30030, 57600, 0xe5a9e1de
-0, 36036, 57600, 0x253f1702
-0, 42042, 57600, 0xcb8679c9
-0, 48048, 57600, 0x96cb5fa8
-0, 54054, 57600, 0xbe03528a
-0, 60060, 57600, 0x120a097d
-0, 66066, 57600, 0xaf562041
-0, 72072, 57600, 0x15b2d8c9
-0, 78078, 57600, 0x95f60e58
-0, 84084, 57600, 0x5ace5a6b
-0, 90090, 57600, 0x2f80b8e3
-0, 96096, 57600, 0x5c49c915
-0, 102102, 57600, 0xb91efe60
-0, 108108, 57600, 0xa80d29e8
-0, 114114, 57600, 0x6e72d03a
-0, 120120, 57600, 0x4f716a9e
-0, 126126, 57600, 0x3a43b9c9
-0, 132132, 57600, 0x65002db3
-0, 138138, 57600, 0x70edc765
-0, 144144, 57600, 0x9dc54abd
-0, 150150, 57600, 0xd17bda86
-0, 156156, 57600, 0xc5d2d458
-0, 162162, 57600, 0x32313c79
-0, 168168, 57600, 0x2e537e8d
-0, 174174, 57600, 0xe77d5d9e
-0, 180180, 57600, 0x9cc2599a
-0, 186186, 57600, 0x8a9be76e
-0, 192192, 57600, 0x47447eef
-0, 198198, 57600, 0xbf5f84fa
-0, 204204, 57600, 0xacd49c07
-0, 210210, 57600, 0xdc628975
-0, 216216, 57600, 0x97d7964e
-0, 222222, 57600, 0xd0a19b6b
-0, 228228, 57600, 0x5ea3d78c
-0, 234234, 57600, 0x39b59be0
-0, 240240, 57600, 0x6501a2d2
-0, 246246, 57600, 0x0ee7e36d
-0, 252252, 57600, 0x354ddd1d
-0, 258258, 57600, 0x9b8f22d3
-0, 264264, 57600, 0x0aadfb8c
-0, 270270, 57600, 0x322e2785
-0, 276276, 57600, 0x78a6467e
-0, 282282, 57600, 0x1757f3b1
-0, 288288, 57600, 0xe874ceb7
-0, 294294, 57600, 0xc40f9e4d
-0, 300300, 57600, 0x89f6a735
-0, 306306, 57600, 0xe3635393
-0, 312312, 57600, 0xdae585c7
-0, 318318, 57600, 0xf99baa60
-0, 324324, 57600, 0x28a8b1ee
-0, 330330, 57600, 0xcd5587f8
diff --git a/tests/ref/fate/cyberia-c93 b/tests/ref/fate/cyberia-c93
deleted file mode 100644
index a0dacb7..0000000
--- a/tests/ref/fate/cyberia-c93
+++ /dev/null
@@ -1,42 +0,0 @@
-0, 0, 184320, 0x8433f0f8
-1, 0, 28368, 0xaacc96a5
-0, 7200, 184320, 0xd0d480f7
-0, 14400, 184320, 0xaec85413
-0, 21600, 184320, 0x29d134dc
-0, 28800, 184320, 0xeac07175
-0, 36000, 184320, 0x21426b49
-0, 43200, 184320, 0xe500a37d
-0, 50400, 184320, 0x1d9cae21
-0, 57600, 184320, 0xda65309d
-0, 64800, 184320, 0xb64c331d
-0, 72000, 184320, 0xcb832741
-1, 79147, 28368, 0x6d1099bd
-0, 79200, 184320, 0xe573b565
-0, 86400, 184320, 0xa40c92d1
-0, 93600, 184320, 0x6d04ea3f
-0, 100800, 184320, 0xc438ae56
-0, 108000, 184320, 0xc6405523
-0, 115200, 184320, 0xaefef0b3
-0, 122400, 184320, 0x3e4526c6
-0, 129600, 184320, 0x2b164323
-0, 136800, 184320, 0x89b22193
-0, 144000, 184320, 0x3b73611b
-0, 151200, 184320, 0x42b33583
-1, 158294, 28368, 0x93033ae1
-0, 158400, 184320, 0x43e79dff
-0, 165600, 184320, 0xe389a377
-0, 172800, 184320, 0x09cb65f0
-0, 180000, 184320, 0x64b27755
-0, 187200, 184320, 0xdd25d6c6
-0, 194400, 184320, 0x082a80c9
-0, 201600, 184320, 0x41a8d7f4
-0, 208800, 184320, 0x6227d8d4
-0, 216000, 184320, 0x54975910
-0, 223200, 184320, 0xf4857db9
-0, 230400, 184320, 0x82d18161
-1, 237441, 28368, 0x9101e519
-0, 237600, 184320, 0x06d93bd0
-0, 244800, 184320, 0xa4304c00
-0, 252000, 184320, 0x5f77d9cd
-0, 259200, 184320, 0x95cb84e9
-0, 266400, 184320, 0x7c979475
diff --git a/tests/ref/fate/cyuv b/tests/ref/fate/cyuv
deleted file mode 100644
index f712323..0000000
--- a/tests/ref/fate/cyuv
+++ /dev/null
@@ -1,150 +0,0 @@
-0, 0, 38016, 0x501e6abe
-0, 3000, 38016, 0x84976f13
-0, 6000, 38016, 0x8c487acb
-0, 9000, 38016, 0x70998800
-0, 12000, 38016, 0x51ac9416
-0, 15000, 38016, 0xd1da94b7
-0, 18000, 38016, 0x52d691e8
-0, 21000, 38016, 0x3ca3907a
-0, 24000, 38016, 0x5f62929f
-0, 27000, 38016, 0x81ec98ac
-0, 30000, 38016, 0x72499f12
-0, 33000, 38016, 0x7598a716
-0, 36000, 38016, 0x38ada96f
-0, 39000, 38016, 0x78c8a727
-0, 42000, 38016, 0xe2d79d2d
-0, 45000, 38016, 0x84a2925a
-0, 48000, 38016, 0x131b8d70
-0, 50999, 38016, 0x32a78242
-0, 53999, 38016, 0x29f583e5
-0, 56999, 38016, 0x4a7f7305
-0, 59999, 38016, 0x80885f56
-0, 62999, 38016, 0xa73c4f61
-0, 65999, 38016, 0xe54d422b
-0, 68999, 38016, 0xa8c03188
-0, 71999, 38016, 0xa02a294e
-0, 74999, 38016, 0xc84e2366
-0, 77999, 38016, 0xe21112ca
-0, 80999, 38016, 0x3e450594
-0, 83999, 38016, 0x2499017c
-0, 86999, 38016, 0xecb1effa
-0, 89999, 38016, 0xa0f8eb28
-0, 92999, 38016, 0xa396e800
-0, 95999, 38016, 0xae1be010
-0, 98999, 38016, 0x4b41dff5
-0, 101999, 38016, 0x9172e319
-0, 104999, 38016, 0xb82ee262
-0, 107999, 38016, 0x151de59f
-0, 110999, 38016, 0x799deabd
-0, 113999, 38016, 0x008dee95
-0, 116999, 38016, 0x5ad502ce
-0, 119999, 38016, 0xdeb321f1
-0, 122999, 38016, 0x82734a09
-0, 125999, 38016, 0x1ccb6ddd
-0, 128999, 38016, 0x266584f0
-0, 131999, 38016, 0x46349e73
-0, 134999, 38016, 0x0b8cac83
-0, 137999, 38016, 0x7bcd9f49
-0, 140999, 38016, 0x4f5d7521
-0, 143999, 38016, 0x7709250c
-0, 146999, 38016, 0xf8eef5ad
-0, 149999, 38016, 0x2c5d28e3
-0, 152998, 38016, 0xdb116d69
-0, 155998, 38016, 0xb66c39d6
-0, 158998, 38016, 0xacecc966
-0, 161998, 38016, 0xaffd76af
-0, 164998, 38016, 0xd2b05d04
-0, 167998, 38016, 0x4d18582a
-0, 170998, 38016, 0x23635ca7
-0, 173998, 38016, 0x7ccc58f1
-0, 176998, 38016, 0xce9a4cc6
-0, 179998, 38016, 0xbeb259d3
-0, 182998, 38016, 0x0b28714c
-0, 185998, 38016, 0x642a8fdd
-0, 188998, 38016, 0x937bb589
-0, 191998, 38016, 0x1a48c407
-0, 194998, 38016, 0x8b44cd79
-0, 197998, 38016, 0xf35cde31
-0, 200998, 38016, 0xfc05fad9
-0, 203998, 38016, 0x44102111
-0, 206998, 38016, 0x832f5041
-0, 209998, 38016, 0x41177c71
-0, 212998, 38016, 0x723b88b5
-0, 215998, 38016, 0x05548f81
-0, 218998, 38016, 0xd9dd7995
-0, 221998, 38016, 0xed0d6226
-0, 224998, 38016, 0x458b5ce2
-0, 227998, 38016, 0xc7ef69af
-0, 230998, 38016, 0x936a7022
-0, 233998, 38016, 0x7a446c3d
-0, 236998, 38016, 0x9b2b73ee
-0, 239998, 38016, 0xa47779cd
-0, 242998, 38016, 0x7be47981
-0, 245998, 38016, 0x5d1778ac
-0, 248998, 38016, 0xf1f578fc
-0, 251997, 38016, 0x865b7edf
-0, 254997, 38016, 0x0a208252
-0, 257997, 38016, 0x22f07570
-0, 260997, 38016, 0x93036cef
-0, 263997, 38016, 0xa04b6120
-0, 266997, 38016, 0x80b249fe
-0, 269997, 38016, 0x5fe5317e
-0, 272997, 38016, 0x75bd0770
-0, 275997, 38016, 0x0607da6e
-0, 278997, 38016, 0x11cbb3a7
-0, 281997, 38016, 0xbb8b9335
-0, 284997, 38016, 0xa2bc75d9
-0, 287997, 38016, 0x58c160dd
-0, 290997, 38016, 0x742b55dc
-0, 293997, 38016, 0x62b24540
-0, 296997, 38016, 0x14f4381b
-0, 299997, 38016, 0x6494334d
-0, 302997, 38016, 0xb3772676
-0, 305997, 38016, 0x0c312715
-0, 308997, 38016, 0x8b401fc9
-0, 311997, 38016, 0xa851125a
-0, 314997, 38016, 0x3171092b
-0, 317997, 38016, 0x5c3603aa
-0, 320997, 38016, 0xab56fc95
-0, 323997, 38016, 0x5c76fcb5
-0, 326997, 38016, 0xbf13f3b4
-0, 329997, 38016, 0xbdb5ed1b
-0, 332997, 38016, 0xb511ea7c
-0, 335997, 38016, 0xec84df90
-0, 338997, 38016, 0x69aed672
-0, 341997, 38016, 0x72a6d334
-0, 344997, 38016, 0x7ec5c6a7
-0, 347997, 38016, 0x837abc3e
-0, 350996, 38016, 0x5ef7be01
-0, 353996, 38016, 0x173bb950
-0, 356996, 38016, 0xf572ab31
-0, 359996, 38016, 0xe704a2d9
-0, 362996, 38016, 0x26359bb5
-0, 365996, 38016, 0x00868e2d
-0, 368996, 38016, 0x72ef879e
-0, 371996, 38016, 0x510b7b07
-0, 374996, 38016, 0x947876ff
-0, 377996, 38016, 0x934073a7
-0, 380996, 38016, 0xf7c36a15
-0, 383996, 38016, 0xbcc86424
-0, 386996, 38016, 0x55b65fb0
-0, 389996, 38016, 0x6c4b5c4e
-0, 392996, 38016, 0xb315557a
-0, 395996, 38016, 0x154f503e
-0, 398996, 38016, 0x7abd44da
-0, 401996, 38016, 0x291940c6
-0, 404996, 38016, 0xc2264202
-0, 407996, 38016, 0xbd703e12
-0, 410996, 38016, 0x39193a9c
-0, 413996, 38016, 0x086637de
-0, 416996, 38016, 0x494c3be2
-0, 419996, 38016, 0x2d523e06
-0, 422996, 38016, 0x3843448a
-0, 425996, 38016, 0x307f4bd3
-0, 428996, 38016, 0xee074e3f
-0, 431996, 38016, 0x760d534a
-0, 434996, 38016, 0xbfa251cc
-0, 437996, 38016, 0x49094e22
-0, 440996, 38016, 0xda6a4f16
-0, 443996, 38016, 0xa3304fd5
-0, 446996, 38016, 0x99995068
diff --git a/tests/ref/fate/d-cinema-demux b/tests/ref/fate/d-cinema-demux
deleted file mode 100644
index 169f54f..0000000
--- a/tests/ref/fate/d-cinema-demux
+++ /dev/null
@@ -1,4 +0,0 @@
-0, 0, 36000, 0xd592781d
-0, 1875, 36000, 0xd592781d
-0, 3750, 36000, 0xd592781d
-0, 5625, 23056, 0xde81f0d6
diff --git a/tests/ref/fate/delphine-cin b/tests/ref/fate/delphine-cin
deleted file mode 100644
index c8894d1..0000000
--- a/tests/ref/fate/delphine-cin
+++ /dev/null
@@ -1,183 +0,0 @@
-0, 0, 153600, 0x00000000
-1, 0, 176448, 0x541ddc55
-0, 7500, 153600, 0x9c77862c
-0, 15000, 153600, 0xd487c33c
-0, 22500, 153600, 0x5c00c01c
-0, 30000, 153600, 0x5496c2a2
-0, 37500, 153600, 0x858ac5c0
-0, 45000, 153600, 0xe32fc7d9
-0, 52500, 153600, 0xabffc965
-0, 60000, 153600, 0x4171c8e7
-0, 67500, 153600, 0xaec4ca90
-0, 75000, 153600, 0x3cb4cb5d
-0, 82500, 153600, 0x3aedcdc0
-0, 90000, 153600, 0x0fa4cf55
-0, 97500, 153600, 0x66a1d146
-0, 105000, 153600, 0x3828d3ad
-0, 112500, 153600, 0x73ccd7a4
-0, 120000, 153600, 0xb815d983
-0, 127500, 153600, 0x11a5a54f
-0, 135000, 153600, 0x337d8bff
-0, 142500, 153600, 0x0a1c8e5c
-0, 150000, 153600, 0x09648a57
-0, 157500, 153600, 0xf7398ba4
-0, 165000, 153600, 0x836d8aaf
-0, 172500, 153600, 0x4ee385bf
-0, 180000, 153600, 0xacf2c4d6
-0, 187500, 153600, 0x0610f426
-0, 195000, 153600, 0xb798e4a1
-0, 202500, 153600, 0xdaabe17e
-0, 210000, 153600, 0x7b82def5
-0, 217500, 153600, 0x56afe483
-0, 225000, 153600, 0x4640acef
-0, 232500, 153600, 0x4415f46c
-0, 240000, 153600, 0x258d01d0
-0, 247500, 153600, 0x18a55ba1
-0, 255000, 153600, 0x165a7173
-0, 262500, 153600, 0xfa8a438b
-0, 270000, 153600, 0x57083a34
-0, 277500, 153600, 0xb39923cd
-0, 285000, 153600, 0x3e32fd70
-0, 292500, 153600, 0xa7e9eb7f
-0, 300000, 153600, 0x8c20ed88
-0, 307500, 153600, 0x8c9bed27
-0, 315000, 153600, 0xc79af188
-0, 322500, 153600, 0x3bda00c8
-0, 330000, 153600, 0x03f837a7
-0, 337500, 153600, 0x550b83e3
-0, 345000, 153600, 0xc0bc6080
-0, 352500, 153600, 0xb8d968ed
-0, 360000, 153600, 0x893e2348
-1, 360098, 3676, 0xaf455081
-0, 367500, 153600, 0x6cd01834
-1, 367600, 3676, 0x27ef4e91
-0, 375000, 153600, 0x9e6926c5
-1, 375102, 3676, 0xd1d986a3
-0, 382500, 153600, 0x4b57a4ea
-1, 382604, 3676, 0xaaa2b589
-0, 390000, 153600, 0xaab2cfcd
-1, 390106, 3676, 0x6e794ff9
-0, 397500, 153600, 0xffbb334d
-1, 397608, 3676, 0x266351f1
-0, 405000, 153600, 0x4b37e5a9
-1, 405110, 3676, 0xdeae50b2
-0, 412500, 153600, 0x3486dee0
-1, 412612, 3676, 0x90f1f96a
-0, 420000, 153600, 0xa7185454
-1, 420114, 3676, 0xea07adf9
-0, 427500, 153600, 0xec29b8c2
-1, 427616, 3676, 0xb80a8925
-0, 435000, 153600, 0x01e562ba
-1, 435118, 3676, 0xc392a1da
-0, 442500, 153600, 0xe695cda3
-1, 442620, 3676, 0xa076bdda
-0, 450000, 153600, 0xf6b59dac
-1, 450122, 3676, 0x8f40b4cc
-0, 457500, 153600, 0xb308206b
-1, 457624, 3676, 0x4227fe30
-0, 465000, 153600, 0xcc6ede4a
-1, 465127, 3676, 0x82b31ec8
-0, 472500, 153600, 0xd9f8071c
-1, 472629, 3676, 0x3ba04042
-0, 480000, 153600, 0xfb434821
-1, 480131, 3676, 0x6fe7440a
-0, 487500, 153600, 0x84c97077
-1, 487633, 3676, 0x23e33177
-0, 495000, 153600, 0x82dc5217
-1, 495135, 3676, 0x1f14242c
-0, 502500, 153600, 0xdbfd0ba8
-1, 502637, 3676, 0x72931fb0
-0, 510000, 153600, 0x3d71058e
-1, 510139, 3676, 0x2b1351c2
-0, 517500, 153600, 0x3027b928
-1, 517641, 3676, 0x6aee7070
-0, 525000, 153600, 0x792ae3bd
-1, 525143, 3676, 0x237658fa
-0, 532500, 153600, 0x36db00a7
-1, 532645, 3676, 0xac001143
-0, 540000, 153600, 0x4484e720
-1, 540147, 3676, 0x1921ee21
-0, 547500, 153600, 0xfaa76cdc
-1, 547649, 3676, 0x80186091
-0, 555000, 153600, 0x9f1e4c7e
-1, 555151, 3676, 0xb7f37ede
-0, 562500, 153600, 0x4b545d88
-1, 562653, 3676, 0x355227ef
-0, 570000, 153600, 0xa11cfd15
-1, 570155, 3676, 0xb0411f35
-0, 577500, 153600, 0x9f5d49c4
-1, 577657, 3676, 0xe7c4fe0e
-0, 585000, 153600, 0x7a496740
-1, 585159, 3676, 0x0425984d
-0, 592500, 153600, 0x98477803
-1, 592661, 3676, 0xfd59dea1
-0, 600000, 153600, 0xa5fc20f8
-1, 600163, 3676, 0xa53d5aab
-0, 607500, 153600, 0x344ff96e
-1, 607665, 3676, 0x8bc403c2
-0, 615000, 153600, 0x20c91746
-1, 615167, 3676, 0x7dd638c2
-0, 622500, 153600, 0x7c59b379
-1, 622669, 3676, 0x284913eb
-0, 630000, 153600, 0x38e3b86d
-1, 630171, 3676, 0xec17e83c
-0, 637500, 153600, 0xff25a440
-1, 637673, 3676, 0x40543463
-0, 645000, 153600, 0xa1f66533
-1, 645176, 3676, 0x92d81bf8
-0, 652500, 153600, 0xe136260a
-1, 652678, 3676, 0x44ef161d
-0, 660000, 153600, 0x048ccf56
-1, 660180, 3676, 0x499df3d5
-0, 667500, 153600, 0x65f68a24
-1, 667682, 3676, 0xf98f4d75
-0, 675000, 153600, 0xf32b385a
-1, 675184, 3676, 0x8ffe2681
-0, 682500, 153600, 0x3e930a8f
-1, 682686, 3676, 0x84093bfd
-1, 690188, 3676, 0x5f9c2e32
-1, 697690, 3676, 0x8f93c29b
-1, 705192, 3676, 0xf0ada687
-1, 712694, 3676, 0x30019db2
-1, 720196, 3676, 0x06ebace3
-1, 727698, 3676, 0xc293d944
-1, 735200, 3676, 0x789ff65e
-1, 742702, 3676, 0xa2ae13c1
-1, 750204, 3676, 0xb64f1cd9
-1, 757706, 3676, 0x18f4e36a
-1, 765208, 3676, 0xe9ccd0f0
-1, 772710, 3676, 0xc215b4ab
-1, 780212, 3676, 0x45b5c410
-1, 787714, 3676, 0xf84a9939
-1, 795216, 3676, 0xc8aff71e
-1, 802718, 3676, 0x76cc3afc
-1, 810220, 3676, 0x524e1dd6
-1, 817722, 3676, 0x115a3f10
-1, 825224, 3676, 0xd2bb51d1
-1, 832727, 3676, 0xe1dbfca5
-1, 840229, 3676, 0xc428f070
-1, 847731, 3676, 0x6aa4dddf
-1, 855233, 3676, 0xa0428f08
-1, 862735, 3676, 0x8fd7e256
-1, 870237, 3676, 0x41cb1787
-1, 877739, 3676, 0xe348568e
-1, 885241, 3676, 0x79091a0c
-1, 892743, 3676, 0x592f6f2e
-1, 900245, 3676, 0xa151448f
-1, 907747, 3676, 0xb3402e7a
-1, 915249, 3676, 0x74112e27
-1, 922751, 3676, 0xba090659
-1, 930253, 3676, 0xa0451f81
-1, 937755, 3676, 0x09c7393a
-1, 945257, 3676, 0xceb4e340
-1, 952759, 3676, 0x0440291a
-1, 960261, 3676, 0xb7b930c4
-1, 967763, 3676, 0x1a2afa4a
-1, 975265, 3676, 0x414fee56
-1, 982767, 3676, 0x5e26bc97
-1, 990269, 3676, 0x780e0481
-1, 997771, 3676, 0xb6dfb9c5
-1, 1005273, 3676, 0x447b36ca
-1, 1012776, 3676, 0x601c3067
-1, 1020278, 3676, 0x199f2f8d
-1, 1027780, 3676, 0x98645b08
diff --git a/tests/ref/fate/deluxepaint-anm b/tests/ref/fate/deluxepaint-anm
deleted file mode 100644
index 2a60606..0000000
--- a/tests/ref/fate/deluxepaint-anm
+++ /dev/null
@@ -1,155 +0,0 @@
-0, 0, 192000, 0x82a79641
-0, 3000, 192000, 0x43079971
-0, 6000, 192000, 0x6311f1e5
-0, 9000, 192000, 0x9e1ef4dc
-0, 12000, 192000, 0x6f81049b
-0, 15000, 192000, 0xe696fb12
-0, 18000, 192000, 0x1ef4d160
-0, 21000, 192000, 0x2f1bf0d4
-0, 24000, 192000, 0xcfed92da
-0, 27000, 192000, 0xbd409978
-0, 30000, 192000, 0x50f76f07
-0, 33000, 192000, 0xc8d52062
-0, 36000, 192000, 0x75061d0e
-0, 39000, 192000, 0x01b2a711
-0, 42000, 192000, 0x541ca739
-0, 45000, 192000, 0xe931ad85
-0, 48000, 192000, 0xb7e4d4a5
-0, 51000, 192000, 0xfc20d475
-0, 54000, 192000, 0x7a5eefe5
-0, 57000, 192000, 0x95a3ef97
-0, 60000, 192000, 0x021d7f69
-0, 63000, 192000, 0x108e7ed9
-0, 66000, 192000, 0x021d7f69
-0, 69000, 192000, 0x681817d8
-0, 72000, 192000, 0x653e19d2
-0, 75000, 192000, 0x56d9b14a
-0, 78000, 192000, 0x82240846
-0, 81000, 192000, 0xa2e90840
-0, 84000, 192000, 0x8e031416
-0, 87000, 192000, 0xe23813a6
-0, 90000, 192000, 0xb2451aa1
-0, 93000, 192000, 0x92eec7d2
-0, 96000, 192000, 0x6400c80e
-0, 99000, 192000, 0x24f01fce
-0, 102000, 192000, 0x7c1b201c
-0, 105000, 192000, 0xe2c878a1
-0, 108000, 192000, 0xf6006739
-0, 111000, 192000, 0x726b6677
-0, 114000, 192000, 0xca61a01d
-0, 117000, 192000, 0x87e49f69
-0, 120000, 192000, 0x57120bd4
-0, 123000, 192000, 0x50171c4b
-0, 126000, 192000, 0x8ace1c49
-0, 129000, 192000, 0x83082a8c
-0, 132000, 192000, 0x6e092b58
-0, 135000, 192000, 0x207a9af4
-0, 138000, 192000, 0xedf193f0
-0, 141000, 192000, 0x531793f0
-0, 144000, 192000, 0x24e2a406
-0, 147000, 192000, 0x6c34a1e5
-0, 150000, 192000, 0x8e7acdae
-0, 153000, 192000, 0x1f941805
-0, 156000, 192000, 0x0c391218
-0, 159000, 192000, 0xf25aa1fd
-0, 162000, 192000, 0xcb2aa40e
-0, 165000, 192000, 0x69701e49
-0, 168000, 192000, 0x0dd719d3
-0, 171000, 192000, 0x5ef71955
-0, 174000, 192000, 0xac2063ca
-0, 177000, 192000, 0xce7d601c
-0, 180000, 192000, 0x43003946
-0, 183000, 192000, 0xa72a38ee
-0, 186000, 192000, 0x98023933
-0, 189000, 192000, 0xa72a38ee
-0, 192000, 192000, 0x98023933
-0, 195000, 192000, 0xa72a38ee
-0, 198000, 192000, 0x98023933
-0, 201000, 192000, 0xa72a38ee
-0, 204000, 192000, 0xdd7f371d
-0, 207000, 192000, 0xeed134c6
-0, 210000, 192000, 0x362931f5
-0, 213000, 192000, 0x362931f5
-0, 216000, 192000, 0x362931f5
-0, 219000, 192000, 0x362931f5
-0, 222000, 192000, 0x362931f5
-0, 225000, 192000, 0x362931f5
-0, 228000, 192000, 0x362931f5
-0, 231000, 192000, 0x362931f5
-0, 234000, 192000, 0x362931f5
-0, 237000, 192000, 0x362931f5
-0, 240000, 192000, 0x362931f5
-0, 243000, 192000, 0x362931f5
-0, 246000, 192000, 0x362931f5
-0, 249000, 192000, 0x362931f5
-0, 252000, 192000, 0x362931f5
-0, 255000, 192000, 0x362931f5
-0, 258000, 192000, 0x362931f5
-0, 261000, 192000, 0x362931f5
-0, 264000, 192000, 0x362931f5
-0, 267000, 192000, 0x362931f5
-0, 270000, 192000, 0x362931f5
-0, 273000, 192000, 0x362931f5
-0, 276000, 192000, 0x362931f5
-0, 279000, 192000, 0x362931f5
-0, 282000, 192000, 0x362931f5
-0, 285000, 192000, 0x362931f5
-0, 288000, 192000, 0x362931f5
-0, 291000, 192000, 0x362931f5
-0, 294000, 192000, 0x362931f5
-0, 297000, 192000, 0x362931f5
-0, 300000, 192000, 0x362931f5
-0, 303000, 192000, 0x362931f5
-0, 306000, 192000, 0x362931f5
-0, 309000, 192000, 0xfb41331d
-0, 312000, 192000, 0x087433f8
-0, 315000, 192000, 0xf36b34a6
-0, 318000, 192000, 0x652a33cd
-0, 321000, 192000, 0x652a33cd
-0, 324000, 192000, 0xe50c336a
-0, 327000, 192000, 0x652a33cd
-0, 330000, 192000, 0xeed134c6
-0, 333000, 192000, 0x652a33cd
-0, 336000, 192000, 0x5d7633e5
-0, 339000, 192000, 0x845233b5
-0, 342000, 192000, 0x9d1c349b
-0, 345000, 192000, 0x25843317
-0, 348000, 192000, 0xc84b375c
-0, 351000, 192000, 0xaf2b3410
-0, 354000, 192000, 0xaf2b3410
-0, 357000, 192000, 0x26d23594
-0, 360000, 192000, 0xaf2b3410
-0, 363000, 192000, 0x26d23594
-0, 366000, 192000, 0xaf2b3410
-0, 369000, 192000, 0x72c4dfb9
-0, 372000, 192000, 0x3c72e390
-0, 375000, 192000, 0xb4466634
-0, 378000, 192000, 0x84f064f5
-0, 381000, 192000, 0xad43f3f5
-0, 384000, 192000, 0xa8644d57
-0, 387000, 192000, 0xfac35238
-0, 390000, 192000, 0xe9374d1e
-0, 393000, 192000, 0x0bd14cfa
-0, 396000, 192000, 0x7e51a437
-0, 399000, 192000, 0x92678dfa
-0, 402000, 192000, 0x43338d41
-0, 405000, 192000, 0x00000000
-0, 408000, 192000, 0x00000000
-0, 411000, 192000, 0x00000000
-0, 414000, 192000, 0x00000000
-0, 417000, 192000, 0x00000000
-0, 420000, 192000, 0x00000000
-0, 423000, 192000, 0x00000000
-0, 426000, 192000, 0x00000000
-0, 429000, 192000, 0x00000000
-0, 432000, 192000, 0x00000000
-0, 435000, 192000, 0x00000000
-0, 438000, 192000, 0x00000000
-0, 441000, 192000, 0x00000000
-0, 444000, 192000, 0x00000000
-0, 447000, 192000, 0x00000000
-0, 450000, 192000, 0x00000000
-0, 453000, 192000, 0x00000000
-0, 456000, 192000, 0x00000000
-0, 459000, 192000, 0x00000000
-0, 462000, 192000, 0x82a79641
diff --git a/tests/ref/fate/dpx b/tests/ref/fate/dpx
deleted file mode 100644
index 9260977..0000000
--- a/tests/ref/fate/dpx
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 2359296, 0x30d4d24f
diff --git a/tests/ref/fate/duck-dk3 b/tests/ref/fate/duck-dk3
deleted file mode 100644
index 08c0fd1..0000000
--- a/tests/ref/fate/duck-dk3
+++ /dev/null
@@ -1 +0,0 @@
-62fbe4db4a49cb044f57f92cce9993c5
diff --git a/tests/ref/fate/duck-dk4 b/tests/ref/fate/duck-dk4
deleted file mode 100644
index d47ef20..0000000
--- a/tests/ref/fate/duck-dk4
+++ /dev/null
@@ -1 +0,0 @@
-5234b53dde4961dd715a2524d6a8eb75
diff --git a/tests/ref/fate/duck-tm2 b/tests/ref/fate/duck-tm2
deleted file mode 100644
index e7c4ee4..0000000
--- a/tests/ref/fate/duck-tm2
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 230400, 0x135cb509
-0, 6000, 230400, 0x919a1ab7
-0, 12000, 230400, 0x0af8722b
-0, 18000, 230400, 0xc9616809
-0, 24000, 230400, 0xe16ecaf7
-0, 30000, 230400, 0xa86f8d1b
-0, 36000, 230400, 0xd351b5a4
-0, 42000, 230400, 0xd112b5b7
-0, 48000, 230400, 0xc9c3c9b1
-0, 54000, 230400, 0x4f91e572
-0, 60000, 230400, 0xb1d8c4d3
-0, 66000, 230400, 0x34de10c1
-0, 72000, 230400, 0xbd4f3b29
-0, 78000, 230400, 0xfeaf1477
-0, 84000, 230400, 0x718ffa17
-0, 90000, 230400, 0x23b46ef3
-0, 96000, 230400, 0x6346d9b8
-0, 102000, 230400, 0xdb66bf57
-0, 108000, 230400, 0xeb74a2ff
-0, 114000, 230400, 0xe0750470
-0, 120000, 230400, 0x645eb109
-0, 126000, 230400, 0xbb96489a
-0, 132000, 230400, 0x58a70e35
-0, 138000, 230400, 0xc7563441
-0, 144000, 230400, 0x6098f07e
-0, 150000, 230400, 0x579ece15
-0, 156000, 230400, 0xe1ca8d03
-0, 162000, 230400, 0x8928cf34
-0, 168000, 230400, 0xf621620e
-0, 174000, 230400, 0x98a344ea
diff --git a/tests/ref/fate/ea-cdata b/tests/ref/fate/ea-cdata
deleted file mode 100644
index cbfc1f5..0000000
--- a/tests/ref/fate/ea-cdata
+++ /dev/null
@@ -1 +0,0 @@
-db441b7f9c8767ee675002763cd3ae46
diff --git a/tests/ref/fate/ea-cmv b/tests/ref/fate/ea-cmv
deleted file mode 100644
index 36d8889..0000000
--- a/tests/ref/fate/ea-cmv
+++ /dev/null
@@ -1,194 +0,0 @@
-0, 0, 120000, 0x34ac91d2
-0, 9000, 120000, 0x17150729
-0, 18000, 120000, 0xc3f510bb
-0, 27000, 120000, 0xb3b14a3b
-0, 36000, 120000, 0x26a7f3d1
-0, 45000, 120000, 0xd161af6f
-0, 54000, 120000, 0x459fc92d
-0, 63000, 120000, 0x05c3fa94
-0, 72000, 120000, 0x6630cd8c
-0, 81000, 120000, 0x60cd39d4
-0, 90000, 120000, 0xc8854d1c
-0, 99000, 120000, 0xe55e8e6d
-0, 108000, 120000, 0xbeab201f
-0, 117000, 120000, 0x70744b0b
-0, 126000, 120000, 0x80dea5d0
-0, 135000, 120000, 0x769bfa1c
-0, 144000, 120000, 0x04e25bbe
-0, 153000, 120000, 0x48abc5a5
-0, 162000, 120000, 0xda5c4e2a
-0, 171000, 120000, 0x8de96d38
-0, 180000, 120000, 0xe96418b0
-0, 189000, 120000, 0x1c2f272b
-0, 198000, 120000, 0x4b755804
-0, 207000, 120000, 0xc92f96fd
-0, 216000, 120000, 0x69e90ebb
-0, 225000, 120000, 0x78d4bd1a
-0, 234000, 120000, 0xaf2edf55
-0, 243000, 120000, 0x94161c78
-0, 252000, 120000, 0x1109094d
-0, 261000, 120000, 0xc61b0392
-0, 270000, 120000, 0xc157d003
-0, 279000, 120000, 0xf2747e7b
-0, 288000, 120000, 0xa36299c2
-0, 297000, 120000, 0x49bc788c
-0, 306000, 120000, 0x3bee336e
-0, 315000, 120000, 0xa316b9d1
-0, 324000, 120000, 0x5cc32e9c
-0, 333000, 120000, 0x9f7eca16
-0, 342000, 120000, 0x958e2988
-0, 351000, 120000, 0xebcba2f1
-0, 360000, 120000, 0x281f1e60
-0, 369000, 120000, 0x82256c4d
-0, 378000, 120000, 0xddc8be56
-0, 387000, 120000, 0x64ff2ed0
-0, 396000, 120000, 0x3e63ab02
-0, 405000, 120000, 0x43f78b37
-0, 414000, 120000, 0xb7cc62d4
-0, 423000, 120000, 0x694f1764
-0, 432000, 120000, 0x2264c483
-0, 441000, 120000, 0xb6680b4a
-0, 450000, 120000, 0x2a92626a
-0, 459000, 120000, 0x8da02509
-0, 468000, 120000, 0xa976c382
-0, 477000, 120000, 0x749e822b
-0, 486000, 120000, 0xe9e7fc8c
-0, 495000, 120000, 0xfdc05a0c
-0, 504000, 120000, 0x7d5a856d
-0, 513000, 120000, 0xcc344937
-0, 522000, 120000, 0x9d90bc67
-0, 531000, 120000, 0x3f527712
-0, 540000, 120000, 0xf0f57f97
-0, 549000, 120000, 0xc29535cd
-0, 558000, 120000, 0x9a64598b
-0, 567000, 120000, 0x0d1ddf7c
-0, 576000, 120000, 0xb580ec24
-0, 585000, 120000, 0xf0db5bbc
-0, 594000, 120000, 0x6b980b61
-0, 603000, 120000, 0xc29f30b5
-0, 612000, 120000, 0xaf2c4bcd
-0, 621000, 120000, 0x1e725645
-0, 630000, 120000, 0x295c4c96
-0, 639000, 120000, 0x7ea121a2
-0, 648000, 120000, 0xdb9e9cec
-0, 657000, 120000, 0x1da47c80
-0, 666000, 120000, 0x9d0c1345
-0, 675000, 120000, 0x88058527
-0, 684000, 120000, 0x46766aed
-0, 693000, 120000, 0xba520bd3
-0, 702000, 120000, 0x7fb6373c
-0, 711000, 120000, 0x05a86f4d
-0, 720000, 120000, 0x7fb47cbd
-0, 729000, 120000, 0x6814d8ca
-0, 738000, 120000, 0x9c13acb8
-0, 747000, 120000, 0xad0edbfe
-0, 756000, 120000, 0x352fde81
-0, 765000, 120000, 0xa654b386
-0, 774000, 120000, 0xd3b3dc72
-0, 783000, 120000, 0x01572668
-0, 792000, 120000, 0x30189e03
-0, 801000, 120000, 0x26126d30
-0, 810000, 120000, 0x4f376c7d
-0, 819000, 120000, 0xd3667bcf
-0, 828000, 120000, 0x0b46b3d5
-0, 837000, 120000, 0x893415ef
-0, 846000, 120000, 0x99a78749
-0, 855000, 120000, 0x6da0d8e9
-0, 864000, 120000, 0x22d8ceb6
-0, 873000, 120000, 0x67ef9be8
-0, 882000, 120000, 0xb696fb53
-0, 891000, 120000, 0x70339dab
-0, 900000, 120000, 0xc1876efa
-0, 909000, 120000, 0x80e78c92
-0, 918000, 120000, 0x18d2f2ac
-0, 927000, 120000, 0x28be9ae4
-0, 936000, 120000, 0xc3c2c190
-0, 945000, 120000, 0xd6a859d8
-0, 954000, 120000, 0x40b9046d
-0, 963000, 120000, 0x7f8d5999
-0, 972000, 120000, 0x89724027
-0, 981000, 120000, 0x4c15c988
-0, 990000, 120000, 0x812ebe08
-0, 999000, 120000, 0x273ef8e2
-0, 1008000, 120000, 0xe029de06
-0, 1017000, 120000, 0x5846127c
-0, 1026000, 120000, 0x6c5df8e3
-0, 1035000, 120000, 0x7424919f
-0, 1044000, 120000, 0xa8313015
-0, 1053000, 120000, 0x28878ab4
-0, 1062000, 120000, 0x126d0746
-0, 1071000, 120000, 0xee3f7138
-0, 1080000, 120000, 0xd4b2e0a1
-0, 1089000, 120000, 0x8d60bfff
-0, 1098000, 120000, 0x701c23d0
-0, 1107000, 120000, 0x1cbb5654
-0, 1116000, 120000, 0x0f5853e9
-0, 1125000, 120000, 0x2a5c3339
-0, 1134000, 120000, 0x86b00350
-0, 1143000, 120000, 0xe8cc6931
-0, 1152000, 120000, 0xf1cad983
-0, 1161000, 120000, 0xabcd8704
-0, 1170000, 120000, 0x89592f94
-0, 1179000, 120000, 0x100486d9
-0, 1188000, 120000, 0x60ef9e2d
-0, 1197000, 120000, 0x2485176a
-0, 1206000, 120000, 0x6b8c360d
-0, 1215000, 120000, 0xe2e1bf4f
-0, 1224000, 120000, 0xe17b65c3
-0, 1233000, 120000, 0x2a42821a
-0, 1242000, 120000, 0xbe9ddba7
-0, 1251000, 120000, 0x19f937fe
-0, 1260000, 120000, 0xb7e0c600
-0, 1269000, 120000, 0xfbf8c5f6
-0, 1278000, 120000, 0x93b62f93
-0, 1287000, 120000, 0xb6ddec93
-0, 1296000, 120000, 0xa04d031b
-0, 1305000, 120000, 0x61c986c0
-0, 1314000, 120000, 0x3516e54a
-0, 1323000, 120000, 0x3489eb2c
-0, 1332000, 120000, 0xb75a4827
-0, 1341000, 120000, 0x76031a80
-0, 1350000, 120000, 0x867c3969
-0, 1359000, 120000, 0x9b63a093
-0, 1368000, 120000, 0xcb253d8a
-0, 1377000, 120000, 0x354ba3b2
-0, 1386000, 120000, 0x4d5ead8c
-0, 1395000, 120000, 0x7b7029ae
-0, 1404000, 120000, 0x4765ab9d
-0, 1413000, 120000, 0x747cdee9
-0, 1422000, 120000, 0x20989b08
-0, 1431000, 120000, 0x3a957085
-0, 1440000, 120000, 0xdd49e8ad
-0, 1449000, 120000, 0x00e89719
-0, 1458000, 120000, 0x2822aa76
-0, 1467000, 120000, 0x492388f3
-0, 1476000, 120000, 0x4dffa6ee
-0, 1485000, 120000, 0xc382bb83
-0, 1494000, 120000, 0xb59aaa74
-0, 1503000, 120000, 0x7c7885d3
-0, 1512000, 120000, 0xc05ee219
-0, 1521000, 120000, 0xc3df6b73
-0, 1530000, 120000, 0x8ae31170
-0, 1539000, 120000, 0xb979fdce
-0, 1548000, 120000, 0xb8f9e407
-0, 1557000, 120000, 0x56675b80
-0, 1566000, 120000, 0x1aad1ce2
-0, 1575000, 120000, 0xa050a52b
-0, 1584000, 120000, 0x49f8c32f
-0, 1593000, 120000, 0x8e7f4d2c
-0, 1602000, 120000, 0x5c07f751
-0, 1611000, 120000, 0x67fa5523
-0, 1620000, 120000, 0xf38b933a
-0, 1629000, 120000, 0xb113e202
-0, 1638000, 120000, 0xb8d99ff4
-0, 1647000, 120000, 0x15ab6cc6
-0, 1656000, 120000, 0xd64a51c9
-0, 1665000, 120000, 0x2088b53c
-0, 1674000, 120000, 0xdd78d40a
-0, 1683000, 120000, 0x2fb58848
-0, 1692000, 120000, 0xf775d36a
-0, 1701000, 120000, 0xa03987e9
-0, 1710000, 120000, 0x457322ad
-0, 1719000, 120000, 0x0f6c3d1c
-0, 1728000, 120000, 0xbdf2f1a5
-0, 1737000, 120000, 0x5828ee1d
diff --git a/tests/ref/fate/ea-dct b/tests/ref/fate/ea-dct
deleted file mode 100644
index 98a2817..0000000
--- a/tests/ref/fate/ea-dct
+++ /dev/null
@@ -1,267 +0,0 @@
-0, 0, 102144, 0x6edc83de
-1, 0, 5936, 0xea261a29
-0, 6000, 102144, 0xd0534fda
-1, 6057, 5824, 0x253df061
-0, 12000, 102144, 0x6447911f
-1, 12000, 5936, 0x603a5bd7
-0, 18000, 102144, 0xf21f3b46
-1, 18057, 5824, 0x9d283f59
-0, 24000, 102144, 0x0975077a
-1, 24000, 5936, 0x49323497
-0, 30000, 102144, 0xb9a12d8e
-1, 30057, 5824, 0x7c299939
-0, 36000, 102144, 0x17413513
-1, 36000, 5936, 0x9f918e9a
-0, 42000, 102144, 0x1e622a04
-1, 42057, 5824, 0x1226b534
-0, 48000, 102144, 0x7489224e
-1, 48000, 5936, 0xdd159326
-0, 54000, 102144, 0xae14956e
-1, 54057, 5824, 0x361ad10f
-0, 60000, 102144, 0x104fd3a0
-1, 60000, 5936, 0x6ccac9e3
-0, 66000, 102144, 0xea63a940
-1, 66057, 5824, 0x1861efef
-0, 72000, 102144, 0x0cf81588
-1, 72000, 5936, 0x5f718eb9
-0, 78000, 102144, 0xe4a5b2fd
-1, 78057, 5824, 0xd4ca72ba
-0, 84000, 102144, 0x0c9aaf77
-1, 84000, 5936, 0xbf2b27e6
-0, 90000, 102144, 0x065007d7
-1, 90057, 5824, 0xcb6f024e
-0, 96000, 102144, 0x54c0c29b
-1, 96000, 5936, 0x7dfb7e05
-0, 102000, 102144, 0x1114cb8e
-1, 102057, 5824, 0x80e16f13
-0, 108000, 102144, 0xe4270462
-1, 108000, 5936, 0x0fb59227
-0, 114000, 102144, 0x61e5b7fd
-1, 114057, 5824, 0x4d6f1fdb
-0, 120000, 102144, 0x7cbeaca6
-1, 120000, 5936, 0x505a5103
-0, 126000, 102144, 0xed92daa4
-1, 126057, 5824, 0x47ef4c13
-0, 132000, 102144, 0xd8654d0d
-1, 132000, 5936, 0xbe4795fb
-0, 138000, 102144, 0x854e842b
-1, 138057, 5824, 0xb82cc4ff
-0, 144000, 102144, 0x56407c3a
-1, 144000, 5936, 0xf7c6ab8d
-0, 150000, 102144, 0x17db3f90
-1, 150057, 5824, 0x1442f5e0
-0, 156000, 102144, 0x8b133b9a
-1, 156000, 5936, 0x64659389
-0, 162000, 102144, 0xe4899db9
-1, 162057, 5824, 0xdd81725c
-0, 168000, 102144, 0x579cf092
-1, 168000, 5936, 0x7f7c604f
-0, 174000, 102144, 0x19fa5062
-1, 174057, 5824, 0xafc77beb
-0, 180000, 102144, 0x71339792
-1, 180000, 5936, 0x24f88e4d
-0, 186000, 102144, 0x970e5c0c
-1, 186057, 5824, 0xa31956ca
-0, 192000, 102144, 0x84ee616a
-1, 192000, 5936, 0x958e02b9
-0, 198000, 102144, 0x1d6f9a23
-1, 198057, 5824, 0xcfc79890
-0, 204000, 102144, 0xc28e19db
-1, 204000, 5936, 0xc7e788ae
-0, 210000, 102144, 0x0e898967
-1, 210057, 5824, 0x4b6b1acc
-0, 216000, 102144, 0x52a8b671
-1, 216000, 5936, 0xa74496dc
-0, 222000, 102144, 0x3f45ea83
-1, 222057, 5824, 0x719e6171
-0, 228000, 102144, 0x7b0fc603
-1, 228000, 5936, 0x9346222d
-0, 234000, 102144, 0x14f94469
-1, 234057, 5824, 0x9e2a876e
-0, 240000, 102144, 0x5b9f37cc
-1, 240000, 5936, 0xeca6ea64
-0, 246000, 102144, 0xf902b7c7
-1, 246057, 5824, 0x07d8174f
-0, 252000, 102144, 0x326836e0
-1, 252000, 5936, 0x2df5aa6b
-0, 258000, 102144, 0x2e4aebba
-1, 258057, 5824, 0x314e7034
-0, 264000, 102144, 0xd10ae58c
-1, 264000, 5936, 0x5a328768
-0, 270000, 102144, 0xbd084ecf
-1, 270057, 5824, 0x32b92446
-0, 276000, 102144, 0xb2157c0a
-1, 276000, 5936, 0x20ecbc9b
-0, 282000, 102144, 0xd7f158d4
-1, 282057, 5824, 0x76019c14
-0, 288000, 102144, 0x3cf86462
-1, 288000, 5936, 0x8c3ef8a6
-0, 294000, 102144, 0x53ecddab
-1, 294057, 5824, 0xcdaab50b
-0, 300000, 102144, 0xcdaba8ef
-1, 300000, 5936, 0xb2f87f4f
-0, 306000, 102144, 0xab9ede18
-1, 306057, 5824, 0x70c26379
-0, 312000, 102144, 0xb6706e79
-1, 312000, 5936, 0x5691ecfd
-0, 318000, 102144, 0x76371069
-1, 318057, 5824, 0x61e208fe
-0, 324000, 102144, 0x3a365016
-1, 324000, 5936, 0x87d1a5e0
-0, 330000, 102144, 0x52177c09
-1, 330057, 5824, 0x02054cfd
-0, 336000, 102144, 0xc33eb4fb
-1, 336000, 5936, 0x22ff1c4b
-0, 342000, 102144, 0x16098436
-1, 342057, 5824, 0xc6d87fef
-0, 348000, 102144, 0x715d6a2b
-1, 348000, 5936, 0x9028bb3b
-0, 354000, 102144, 0xd3abc960
-1, 354057, 5824, 0xbadde406
-0, 360000, 102144, 0x7f34b0d4
-1, 360000, 5936, 0x6e88ddf1
-0, 366000, 102144, 0xe3219b9c
-1, 366057, 5824, 0x5bb8be6e
-0, 372000, 102144, 0x5fa54f54
-1, 372000, 5936, 0xe1f8d7fc
-0, 378000, 102144, 0x0fb746cb
-1, 378057, 5824, 0xc824e388
-0, 384000, 102144, 0xa6bd2da2
-1, 384000, 5936, 0x654371a9
-0, 390000, 102144, 0x04579119
-1, 390057, 5824, 0xae6ee9ec
-0, 396000, 102144, 0xda818691
-1, 396000, 5936, 0x9aa4550d
-0, 402000, 102144, 0xe9d44445
-1, 402057, 5824, 0xdce210ac
-0, 408000, 102144, 0x94868dc9
-1, 408000, 5936, 0xb12641c8
-0, 414000, 102144, 0x3ca52ce6
-1, 414057, 5824, 0x277e014b
-0, 420000, 102144, 0xd7eb4c4f
-1, 420000, 5936, 0xb0d262de
-0, 426000, 102144, 0xfcdfafca
-1, 426057, 5824, 0xf94d6f49
-0, 432000, 102144, 0x473a4a5a
-1, 432000, 5936, 0x3d7848cb
-0, 438000, 102144, 0xe5a5f3cb
-1, 438057, 5824, 0xe67fc08e
-0, 444000, 102144, 0x34070219
-1, 444000, 5936, 0x0475e0d6
-0, 450000, 102144, 0x0faa965a
-1, 450057, 5824, 0x8a9a4a2e
-0, 456000, 102144, 0xe2c6acda
-1, 456000, 5936, 0x82576204
-0, 462000, 102144, 0xe22776d5
-1, 462057, 5824, 0x3017b648
-0, 468000, 102144, 0x80d85602
-1, 468000, 5936, 0xca4c3e04
-0, 474000, 102144, 0x2f3fa190
-1, 474057, 5824, 0x340077d1
-0, 480000, 102144, 0x70b461b1
-1, 480000, 5936, 0x805bea6e
-0, 486000, 102144, 0x366c8b27
-1, 486057, 5824, 0x2cf6c87b
-0, 492000, 102144, 0x65cc0866
-1, 492000, 5936, 0x3635bc5f
-0, 498000, 102144, 0x903beb14
-1, 498057, 5824, 0x0d7a81c7
-0, 504000, 102144, 0xb6c5f5c7
-1, 504000, 5936, 0x26179764
-0, 510000, 102144, 0xaa813725
-1, 510057, 5824, 0xa0b2454f
-0, 516000, 102144, 0x014a84a0
-1, 516000, 5936, 0x91d24608
-0, 522000, 102144, 0xd286ece1
-1, 522057, 5824, 0x6509b3e1
-0, 528000, 102144, 0x48b1c27d
-1, 528000, 5936, 0xa0e3c9fc
-0, 534000, 102144, 0xa611ef42
-1, 534057, 5824, 0x18682a2f
-0, 540000, 102144, 0x98627584
-1, 540000, 5936, 0x89cea4ff
-0, 546000, 102144, 0x43de7c75
-1, 546057, 5824, 0x7dd22b85
-0, 552000, 102144, 0xa9e22c68
-1, 552000, 5936, 0x8b2eeb8d
-0, 558000, 102144, 0x84ac34d4
-1, 558057, 5824, 0x0c21af82
-0, 564000, 102144, 0x6abd00ba
-1, 564000, 5936, 0x9c5a748d
-0, 570000, 102144, 0x5d11066e
-1, 570057, 5824, 0x1dc72c5c
-0, 576000, 102144, 0xb6b083aa
-1, 576000, 5936, 0xe6129383
-0, 582000, 102144, 0x5d152a11
-1, 582057, 5824, 0x0a44312a
-0, 588000, 102144, 0x0c0aec67
-1, 588000, 5936, 0x7ed30640
-0, 594000, 102144, 0xa248bd10
-1, 594057, 5824, 0xede15f25
-0, 600000, 102144, 0x4e6c12cc
-1, 600000, 5936, 0x0096d0f3
-0, 606000, 102144, 0xca1d6753
-1, 606057, 5824, 0x13764b4b
-0, 612000, 102144, 0x116310c3
-1, 612000, 5936, 0xd4608756
-0, 618000, 102144, 0x16903cd0
-1, 618057, 5824, 0x254b5f2a
-0, 624000, 102144, 0x239adfed
-1, 624000, 5936, 0x7705b830
-0, 630000, 102144, 0x0970ce49
-1, 630057, 5824, 0x64a63d78
-0, 636000, 102144, 0xb628adc1
-1, 636000, 5936, 0xc02d81a6
-0, 642000, 102144, 0x473613f7
-1, 642057, 5824, 0xd239e55e
-0, 648000, 102144, 0x3eef3987
-1, 648000, 5936, 0x8018cd3a
-0, 654000, 102144, 0x935b99ca
-1, 654057, 5824, 0xf86b8a98
-0, 660000, 102144, 0xb9f4d6ee
-1, 660000, 5936, 0x2a0078bc
-0, 666000, 102144, 0xac811656
-1, 666057, 5824, 0x058d4e1b
-0, 672000, 102144, 0xd1f84af0
-1, 672000, 5936, 0xbc718309
-0, 678000, 102144, 0xf2fd25f4
-1, 678057, 5824, 0xaf6c29e5
-0, 684000, 102144, 0x935bbed9
-1, 684000, 5936, 0x80df004d
-0, 690000, 102144, 0x8c8c3e53
-1, 690057, 5824, 0xeca5aa57
-0, 696000, 102144, 0x24afc20f
-1, 696000, 5936, 0xb793a8f8
-0, 702000, 102144, 0xad20a451
-1, 702057, 5824, 0x70fa6aff
-0, 708000, 102144, 0xd1a0df13
-1, 708000, 5936, 0xda8d4cc6
-0, 714000, 102144, 0xb0ee53f8
-1, 714057, 5824, 0xa70088eb
-0, 720000, 102144, 0x08cdb591
-1, 720000, 5936, 0x1c0b0aab
-0, 726000, 102144, 0x89b985b0
-1, 726057, 5824, 0x234d2436
-0, 732000, 102144, 0xdd27d51f
-1, 732000, 5936, 0xf79d731e
-0, 738000, 102144, 0xa783fce0
-1, 738057, 5824, 0x5a4e454a
-0, 744000, 102144, 0xfe5602e8
-1, 744000, 5936, 0xccf6d042
-0, 750000, 102144, 0xfb989934
-1, 750057, 5824, 0x4e524d14
-0, 756000, 102144, 0xf857eb2b
-1, 756000, 5936, 0xf8f2fcc3
-0, 762000, 102144, 0x987a7098
-1, 762057, 5824, 0x08f12491
-0, 768000, 102144, 0xbc749f42
-1, 768000, 5936, 0x506e0a42
-0, 774000, 102144, 0x221e48a6
-1, 774057, 5824, 0x7cf05049
-0, 780000, 102144, 0x4c4b5da2
-1, 780000, 5936, 0xdeb9d295
-0, 786000, 102144, 0x32140027
-1, 786057, 5824, 0x758ef642
-0, 792000, 102144, 0xbeb4bf18
-1, 792000, 5936, 0x91903980
-0, 798000, 102144, 0x523012e5
diff --git a/tests/ref/fate/ea-mad-adpcm-ea-r1 b/tests/ref/fate/ea-mad-adpcm-ea-r1
deleted file mode 100644
index b75de55..0000000
--- a/tests/ref/fate/ea-mad-adpcm-ea-r1
+++ /dev/null
@@ -1,191 +0,0 @@
-0, 0, 535680, 0x889c32cf
-1, 0, 6496, 0x00000000
-0, 2970, 535680, 0x0b1ef044
-1, 3045, 6384, 0x00000000
-0, 5940, 535680, 0xa7d0818b
-1, 6038, 6384, 0x00000000
-0, 8910, 535680, 0xf392e4e1
-1, 9030, 6384, 0x00000000
-0, 11880, 535680, 0x08480c69
-1, 12023, 6384, 0x00000000
-0, 14850, 535680, 0x2b8af1ed
-1, 15015, 6496, 0xe2034d04
-0, 17820, 535680, 0x0d58e062
-1, 18060, 6384, 0x089c9157
-0, 20790, 535680, 0xd140ced0
-1, 21053, 6384, 0xeed5743c
-0, 23760, 535680, 0xbd0e6652
-1, 24045, 6384, 0x71de6b34
-0, 26730, 535680, 0xdc2f2a6b
-1, 27038, 6384, 0xc0d67710
-0, 29700, 535680, 0x97c31a38
-1, 30030, 6496, 0x35786490
-0, 32670, 535680, 0x1a2bdf38
-1, 33075, 6384, 0xdf1c99a2
-0, 35640, 535680, 0xb3af3ac4
-1, 36068, 6384, 0xca9591ad
-0, 38610, 535680, 0x07a52577
-1, 39060, 6384, 0x6f0d9c3d
-0, 41580, 535680, 0x78407368
-1, 42053, 6384, 0xfacbbaee
-0, 44550, 535680, 0xd2a9efc3
-1, 45045, 6496, 0x927fb136
-0, 47520, 535680, 0x36df2f29
-1, 48090, 6384, 0x9d4f2572
-0, 50490, 535680, 0x9821d8f7
-1, 51083, 6384, 0x2a3c6d08
-0, 53460, 535680, 0xf64321aa
-1, 54075, 6384, 0x4282b1e0
-0, 56430, 535680, 0x53e4d9aa
-1, 57068, 6384, 0xc4a77b9f
-0, 59400, 535680, 0xdbd6f853
-1, 60060, 6496, 0x2af6a14f
-0, 62370, 535680, 0x5d40cf8b
-1, 63105, 6384, 0x4d734169
-0, 65340, 535680, 0xe624af9d
-1, 66098, 6384, 0xb91b5865
-0, 68310, 535680, 0xd9dbb4cd
-1, 69090, 6384, 0x9dce2417
-0, 71280, 535680, 0xf14e72ec
-1, 72083, 6384, 0xb7c4e1ce
-0, 74250, 535680, 0xb35c18f6
-1, 75075, 6496, 0xef0dc07a
-0, 77220, 535680, 0xc96d7757
-1, 78120, 6384, 0x4ad21d10
-0, 80190, 535680, 0xdfb937df
-1, 81113, 6384, 0xcfe14682
-0, 83160, 535680, 0x40cd71d7
-1, 84105, 6384, 0x07be48eb
-0, 86130, 535680, 0x15e176d6
-1, 87098, 6384, 0x09de3498
-0, 89100, 535680, 0x7f891b24
-1, 90090, 6496, 0xab2e9686
-0, 92070, 535680, 0xb87a8c32
-1, 93135, 6384, 0x3aba3ccc
-0, 95040, 535680, 0x0c01541f
-1, 96128, 6384, 0x0a905ec3
-0, 98010, 535680, 0x9eee99b3
-1, 99120, 6384, 0x76a93ce4
-0, 100980, 535680, 0xd65eb689
-1, 102113, 6384, 0xa99063a4
-0, 103950, 535680, 0x6e733cfa
-1, 105105, 6496, 0xc16bb88d
-0, 106920, 535680, 0xac536670
-1, 108150, 6384, 0x650379bf
-0, 109890, 535680, 0x002275b8
-1, 111143, 6384, 0x4e0749fe
-0, 112860, 535680, 0x6a5385cb
-1, 114135, 6384, 0x778e8d12
-0, 115830, 535680, 0xd129ade3
-1, 117128, 6384, 0x9fa8c494
-0, 118800, 535680, 0x32cab5d7
-1, 120120, 6496, 0x61d5bead
-0, 121770, 535680, 0x08be1c8f
-1, 123165, 6384, 0x4da9bc3c
-0, 124740, 535680, 0x59e1fba0
-1, 126158, 6384, 0xa72b6f93
-0, 127710, 535680, 0x138aee3a
-1, 129150, 6384, 0x811f5f77
-0, 130680, 535680, 0x4cfbcd5e
-1, 132143, 6384, 0x83ea5e3d
-0, 133650, 535680, 0xf6cf0fb4
-1, 135135, 6496, 0x78bab460
-0, 136620, 535680, 0xb13a06de
-1, 138180, 6384, 0xc9a07432
-0, 139590, 535680, 0x59176f00
-1, 141173, 6384, 0x4b4f2a34
-0, 142560, 535680, 0xf84b4ca3
-1, 144165, 6384, 0x4d707a53
-0, 145530, 535680, 0x7fd09f73
-1, 147158, 6384, 0x703efb60
-0, 148500, 535680, 0x3be383b8
-1, 150150, 6496, 0x319a77bb
-0, 151470, 535680, 0xa7118e51
-1, 153195, 6384, 0xbdfd82ec
-0, 154440, 535680, 0xbd83120c
-1, 156188, 6384, 0x413c3503
-0, 157410, 535680, 0x3bc9d256
-1, 159180, 6384, 0xe6e666b3
-0, 160380, 535680, 0xb6c87f87
-1, 162173, 6384, 0xa09c7342
-0, 163350, 535680, 0xe80d110a
-1, 165165, 6496, 0x60cba846
-0, 166320, 535680, 0xb3a83362
-1, 168210, 6384, 0x0ba34308
-0, 169290, 535680, 0xfb39eb52
-1, 171203, 6384, 0xdc3a65f0
-0, 172260, 535680, 0xbf6e1220
-1, 174195, 6384, 0x1ebf9dc4
-0, 175230, 535680, 0x9ecdfbae
-1, 177188, 6384, 0xbbcb1449
-0, 178200, 535680, 0x069a65f5
-1, 180180, 6496, 0x926574eb
-0, 181170, 535680, 0x206e372c
-1, 183225, 6384, 0xb4da92f1
-0, 184140, 535680, 0x58c83dd4
-1, 186218, 6384, 0xdbbd21e0
-0, 187110, 535680, 0xc3562b03
-1, 189210, 6384, 0x08510eff
-0, 190080, 535680, 0xd1ed85a0
-1, 192203, 6384, 0x9534b7ca
-0, 193050, 535680, 0xb6205f4b
-1, 195195, 6496, 0x50a5ed30
-0, 196020, 535680, 0xaedf8bfa
-1, 198240, 6384, 0xf5ac2f7c
-0, 198990, 535680, 0xa48d5dea
-1, 201233, 6384, 0x4fe1fa55
-0, 201960, 535680, 0xff82e7c1
-1, 204225, 6384, 0xd61c4c05
-0, 204930, 535680, 0xc9560222
-1, 207218, 6384, 0x56d11b45
-0, 207900, 535680, 0x0fafa549
-1, 210210, 6496, 0x3906084b
-0, 210870, 535680, 0x8d556ccb
-1, 213255, 6384, 0x1ef31fed
-0, 213840, 535680, 0x802aac1f
-1, 216248, 6384, 0x58ed82f5
-0, 216810, 535680, 0x7d0fa168
-1, 219240, 6384, 0xb31ccd1f
-0, 219780, 535680, 0x1a9255c9
-1, 222233, 6384, 0xfb648285
-0, 222750, 535680, 0xb4ec7e35
-1, 225225, 6496, 0xfae2950b
-0, 225720, 535680, 0x48fac072
-1, 228270, 6384, 0xe28c8357
-0, 228690, 535680, 0x1e260135
-1, 231263, 6384, 0xda718e60
-0, 231660, 535680, 0xce4d5079
-1, 234255, 6384, 0x27516999
-0, 234630, 535680, 0x13e5e4ed
-1, 237248, 6384, 0x0ba07921
-0, 237600, 535680, 0x592305ec
-1, 240240, 6496, 0xcfbecfab
-0, 240570, 535680, 0x9e227508
-1, 243285, 6384, 0xae4cedcd
-0, 243540, 535680, 0x1d37e5ea
-1, 246278, 6384, 0x917b4707
-0, 246510, 535680, 0x7eae7692
-1, 249270, 6384, 0x8671b28e
-0, 249480, 535680, 0xf452e4b9
-1, 252263, 6384, 0x9a1238fa
-0, 252450, 535680, 0x1460e7e9
-1, 255255, 6496, 0x23b8f8ca
-0, 255420, 535680, 0xc6d8a638
-1, 258300, 6384, 0x3903bcd6
-0, 258390, 535680, 0x854f5fb0
-1, 261293, 6384, 0x0532b267
-0, 261360, 535680, 0x854f5fb0
-1, 264285, 6384, 0xde931220
-0, 264330, 535680, 0x70a02d87
-1, 267278, 6384, 0x4ed70a80
-0, 267300, 535680, 0x9a4ad464
-0, 270270, 535680, 0x9a4ad464
-1, 270270, 6496, 0x4a52d5a1
-0, 273240, 535680, 0x9a4ad464
-1, 273315, 6384, 0xc1be5760
-0, 276210, 535680, 0x9a4ad464
-1, 276308, 6384, 0x790d69ba
-0, 279180, 535680, 0x9a4ad464
-1, 279300, 6384, 0x9d73e6cf
-0, 282150, 535680, 0x9a4ad464
-1, 282293, 6272, 0xbc0fc725
diff --git a/tests/ref/fate/ea-mad-pcm-planar b/tests/ref/fate/ea-mad-pcm-planar
deleted file mode 100644
index dc47354..0000000
--- a/tests/ref/fate/ea-mad-pcm-planar
+++ /dev/null
@@ -1,292 +0,0 @@
-0, 0, 196608, 0x75d22292
-1, 0, 5884, 0x00000000
-0, 2970, 196608, 0x75d22292
-1, 3002, 5884, 0x00000000
-0, 5940, 196608, 0x75d22292
-1, 6004, 5888, 0x00000000
-0, 8910, 196608, 0x75d22292
-1, 9008, 5884, 0x00000000
-0, 11880, 196608, 0x75d22292
-1, 12010, 5888, 0x00000000
-0, 14850, 196608, 0x75d22292
-1, 15014, 5884, 0x00000000
-0, 17820, 196608, 0x75d22292
-1, 18016, 5888, 0x00000000
-0, 20790, 196608, 0x75d22292
-1, 21020, 5884, 0x00000000
-0, 23760, 196608, 0x75d22292
-1, 24022, 5888, 0x00000000
-0, 26730, 196608, 0xd3f66981
-1, 27027, 5884, 0x00000000
-0, 29700, 196608, 0xed37c4c3
-1, 30029, 5888, 0x174b2bd4
-0, 32670, 196608, 0x6ce01dc4
-1, 33033, 5884, 0xfab9563d
-0, 35640, 196608, 0x2874fc9a
-1, 36035, 5888, 0x0129a4f5
-0, 38610, 196608, 0x9b65bbc8
-1, 39039, 5884, 0xf12b15dd
-0, 41580, 196608, 0x8f9af811
-1, 42041, 5888, 0x60c8c922
-0, 44550, 196608, 0x04aeb0b0
-1, 45045, 5884, 0x85693c81
-0, 47520, 196608, 0x0df037a1
-1, 48047, 5888, 0xcefcf0e0
-0, 50490, 196608, 0xa32c5515
-1, 51051, 5884, 0x243974ff
-0, 53460, 196608, 0xf3b11a1b
-1, 54053, 5884, 0x9101b901
-0, 56430, 196608, 0xaf945190
-1, 57055, 5888, 0xe3c68cb9
-0, 59400, 196608, 0xabee8b24
-1, 60059, 5884, 0x80f2ff5f
-0, 62370, 196608, 0x1d7b3df0
-1, 63061, 5888, 0xfc2d19dc
-0, 65340, 196608, 0x1347d787
-1, 66065, 5884, 0xb6e0af21
-0, 68310, 196608, 0x654c4a9b
-1, 69067, 5888, 0x476e74ff
-0, 71280, 196608, 0xa2a6596a
-1, 72071, 5884, 0x3921bc7f
-0, 74250, 196608, 0x50d04d8e
-1, 75073, 5888, 0x44180a3f
-0, 77220, 196608, 0x4f9f9352
-1, 78078, 5884, 0x01b5a119
-0, 80190, 196608, 0xbb358281
-1, 81080, 5888, 0xdd7ad621
-0, 83160, 196608, 0xcd91a50a
-1, 84084, 5884, 0xadabe898
-0, 86130, 196608, 0xb665bb76
-1, 87086, 5888, 0x2141ff8e
-0, 89100, 196608, 0xec924ee7
-1, 90090, 5884, 0xfb5118fb
-0, 92070, 196608, 0x9c4aa4ad
-1, 93092, 5888, 0x06d31461
-0, 95040, 196608, 0x27ccdf86
-1, 96096, 5884, 0x80ce34c1
-0, 98010, 196608, 0x93778cc8
-1, 99098, 5888, 0x72bf392f
-0, 100980, 196608, 0x3d68e826
-1, 102102, 5884, 0x9d9237cf
-0, 103950, 196608, 0x9240b751
-1, 105104, 5884, 0xf5c9ce23
-0, 106920, 196608, 0xd77ec46b
-1, 108106, 5888, 0x12a05dc5
-0, 109890, 196608, 0x4a303ef1
-1, 111110, 5884, 0xd3ed5d4b
-0, 112860, 196608, 0x2508bacf
-1, 114112, 5888, 0x06557401
-0, 115830, 196608, 0xb74cb5bf
-1, 117116, 5884, 0x53d81662
-0, 118800, 196608, 0x9c4a9719
-1, 120118, 5888, 0xd7e0d98d
-0, 121770, 196608, 0xc34a7924
-1, 123122, 5884, 0xdf00752e
-0, 124740, 196608, 0x9d8428bd
-1, 126124, 5888, 0x82f1d7a9
-0, 127710, 196608, 0x019eebf7
-1, 129129, 5884, 0x9cb3aba9
-0, 130680, 196608, 0x36e58d6b
-1, 132131, 5888, 0xd6f98e91
-0, 133650, 196608, 0xc7038ceb
-1, 135135, 5884, 0xaa7f7c09
-0, 136620, 196608, 0xb041fd50
-1, 138137, 5888, 0xb97a82a7
-0, 139590, 196608, 0x76934674
-1, 141141, 5884, 0x375a3d53
-0, 142560, 196608, 0x22afa88b
-1, 144143, 5888, 0xa0a460cb
-0, 145530, 196608, 0x22158960
-1, 147147, 5884, 0xe05efbab
-0, 148500, 196608, 0x75ab0895
-1, 150149, 5888, 0x95e151f0
-0, 151470, 196608, 0xcaab6c6d
-1, 153153, 5884, 0x44ac688d
-0, 154440, 196608, 0xe64d8b91
-1, 156155, 5884, 0xfc6d929f
-0, 157410, 196608, 0x1e8aa17a
-1, 159157, 5888, 0x6406c5f1
-0, 160380, 196608, 0x7dd94fdb
-1, 162161, 5884, 0x4ee9e48c
-0, 163350, 196608, 0xab74566c
-1, 165163, 5888, 0xd55d43d0
-0, 166320, 196608, 0xec962966
-1, 168167, 5884, 0xcae69baf
-0, 169290, 196608, 0xf5bfd751
-1, 171169, 5888, 0x4c01f1f5
-0, 172260, 196608, 0xc7f46e0e
-1, 174173, 5884, 0xf7d6dab6
-0, 175230, 196608, 0xe641f676
-1, 177176, 5888, 0x1affdeb5
-0, 178200, 196608, 0xea7c7b75
-1, 180180, 5884, 0x6db72487
-0, 181170, 196608, 0x69120371
-1, 183182, 5888, 0x4f344e49
-0, 184140, 196608, 0xb2319175
-1, 186186, 5884, 0x2df3827b
-0, 187110, 196608, 0xd2d73b56
-1, 189188, 5888, 0x1d1fc283
-0, 190080, 196608, 0x74aafac0
-1, 192192, 5884, 0x22eb1dd5
-0, 193050, 196608, 0x15e8ddbc
-1, 195194, 5888, 0x734e7093
-0, 196020, 196608, 0xd4e2c90c
-1, 198198, 5884, 0x357c9531
-0, 198990, 196608, 0x86eaf31c
-1, 201200, 5888, 0x108c102d
-0, 201960, 196608, 0x8004291b
-1, 204204, 5884, 0x96ad26c6
-0, 204930, 196608, 0xbbf6954a
-1, 207206, 5888, 0x7bea1996
-0, 207900, 196608, 0x2f24f0e1
-1, 210210, 5884, 0x124a1f8e
-0, 210870, 196608, 0x59d56dfb
-1, 213212, 5884, 0x08d272fb
-0, 213840, 196608, 0x1377c9cb
-1, 216214, 5888, 0x88832c6b
-0, 216810, 196608, 0x07582cc3
-1, 219218, 5884, 0xedf41493
-0, 219780, 196608, 0xa5a853fc
-1, 222220, 5888, 0xc4f226d7
-0, 222750, 196608, 0x3b01856a
-1, 225224, 5884, 0x97730397
-0, 225720, 196608, 0x64927496
-1, 228227, 5888, 0xbc3540e9
-0, 228690, 196608, 0xf24c6f8a
-1, 231231, 5884, 0x8adfa135
-0, 231660, 196608, 0xc92c3c46
-1, 234233, 5888, 0x6d4be121
-0, 234630, 196608, 0xa50d07fb
-1, 237237, 5884, 0xc3daea85
-0, 237600, 196608, 0xb1d4a092
-1, 240239, 5888, 0x5498e9f0
-0, 240570, 196608, 0x20c5526b
-1, 243243, 5884, 0xa0eb691f
-0, 243540, 196608, 0x6127fbbd
-1, 246245, 5888, 0x775c7c59
-0, 246510, 196608, 0xc168a747
-1, 249249, 5884, 0x9f108fd1
-0, 249480, 196608, 0x9c0d3241
-1, 252251, 5888, 0x72d53062
-0, 252450, 196608, 0x5466dd21
-1, 255255, 5884, 0x13a93faa
-0, 255420, 196608, 0x5bba67cc
-1, 258257, 5888, 0x64773c8e
-0, 258390, 196608, 0x4c1a1c18
-1, 261261, 5884, 0xaf696999
-0, 261360, 196608, 0x22c0a537
-1, 264263, 5884, 0xf45e7e81
-0, 264330, 196608, 0x4ffc5ea6
-1, 267265, 5888, 0x00000000
-0, 267300, 196608, 0x7e8e2395
-1, 270269, 5884, 0x00000000
-0, 270270, 196608, 0xa3b6f198
-0, 273240, 196608, 0xf6aac4d1
-1, 273271, 5888, 0x00000000
-0, 276210, 196608, 0x1a6ea9ee
-1, 276276, 5884, 0x00000000
-0, 279180, 196608, 0xfd729443
-1, 279278, 5888, 0x00000000
-0, 282150, 196608, 0xc6a69012
-1, 282282, 5884, 0x00000000
-0, 285120, 196608, 0x576f9270
-1, 285284, 5888, 0x00000000
-0, 288090, 196608, 0x0d539fe5
-1, 288288, 5884, 0x00000000
-0, 291060, 196608, 0x191db7d6
-1, 291290, 5888, 0x00000000
-0, 294030, 196608, 0x80cddedd
-1, 294294, 5884, 0x00000000
-0, 297000, 196608, 0xccf5fd39
-1, 297296, 5888, 0x00000000
-0, 299970, 196608, 0x521d33b6
-1, 300300, 5884, 0x00000000
-0, 302940, 196608, 0xb75e59ee
-1, 303302, 5888, 0x00000000
-0, 305910, 196608, 0xbba68972
-1, 306306, 5884, 0x00000000
-0, 308880, 196608, 0x368fb86a
-1, 309308, 5888, 0x00000000
-0, 311850, 196608, 0x99e6e94a
-1, 312312, 5884, 0x00000000
-0, 314820, 196608, 0xe4021296
-1, 315314, 5884, 0x00000000
-0, 317790, 196608, 0xbc993b10
-1, 318316, 5888, 0x00000000
-0, 320760, 196608, 0xf2765d22
-1, 321320, 5884, 0x00000000
-0, 323730, 196608, 0xc6257db5
-1, 324322, 5888, 0x00000000
-0, 326700, 196608, 0xa832782f
-1, 327327, 5884, 0x00000000
-0, 329670, 196608, 0xa832782f
-1, 330329, 5888, 0x00000000
-0, 332640, 196608, 0xa832782f
-1, 333333, 5884, 0x00000000
-0, 335610, 196608, 0xa832782f
-1, 336335, 5888, 0x00000000
-0, 338580, 196608, 0xa832782f
-1, 339339, 5884, 0x00000000
-0, 341550, 196608, 0xa832782f
-1, 342341, 5888, 0x00000000
-0, 344520, 196608, 0xa832782f
-1, 345345, 5884, 0x00000000
-0, 347490, 196608, 0xa832782f
-1, 348347, 5888, 0x00000000
-0, 350460, 196608, 0xa832782f
-1, 351351, 5884, 0xfe4b2bd4
-0, 353430, 196608, 0xa832782f
-1, 354353, 5888, 0x00000000
-0, 356400, 196608, 0xa832782f
-1, 357357, 5884, 0x00000000
-0, 359370, 196608, 0xa832782f
-1, 360359, 5888, 0x00000000
-0, 362340, 196608, 0xa832782f
-1, 363363, 5884, 0x00000000
-0, 365310, 196608, 0xa832782f
-1, 366365, 5884, 0x00000000
-0, 368280, 196608, 0xa832782f
-1, 369367, 5888, 0x00000000
-0, 371250, 196608, 0xa832782f
-1, 372371, 5884, 0x00000000
-0, 374220, 196608, 0xa832782f
-1, 375373, 5888, 0x00000000
-0, 377190, 196608, 0xa832782f
-1, 378378, 5884, 0x00000000
-0, 380160, 196608, 0xa832782f
-1, 381380, 5888, 0x00000000
-0, 383130, 196608, 0xa832782f
-1, 384384, 5884, 0x00000000
-0, 386100, 196608, 0xa832782f
-1, 387386, 5888, 0x00000000
-0, 389070, 196608, 0xa832782f
-1, 390390, 5884, 0x00000000
-0, 392040, 196608, 0xa832782f
-1, 393392, 5888, 0x00000000
-0, 395010, 196608, 0xa832782f
-1, 396396, 5884, 0x00000000
-0, 397980, 196608, 0xa832782f
-1, 399398, 5888, 0x00000000
-0, 400950, 196608, 0xa832782f
-1, 402402, 5884, 0x00000000
-0, 403920, 196608, 0xa832782f
-1, 405404, 5888, 0x00000000
-0, 406890, 196608, 0xa832782f
-1, 408408, 5884, 0x00000000
-0, 409860, 196608, 0xa832782f
-1, 411410, 5888, 0x00000000
-0, 412830, 196608, 0xa832782f
-1, 414414, 5884, 0x00000000
-0, 415800, 196608, 0xa832782f
-1, 417416, 5888, 0x00000000
-0, 418770, 196608, 0xa832782f
-1, 420420, 5884, 0x00000000
-0, 421740, 196608, 0xa832782f
-1, 423422, 5048, 0x00000000
-0, 424710, 196608, 0xa832782f
-0, 427680, 196608, 0xa832782f
-0, 430650, 196608, 0xa832782f
-0, 433620, 196608, 0xa832782f
-0, 436590, 196608, 0xa832782f
-0, 439560, 196608, 0xa832782f
-0, 442530, 196608, 0xa832782f
diff --git a/tests/ref/fate/ea-tgq b/tests/ref/fate/ea-tgq
deleted file mode 100644
index 993c08e..0000000
--- a/tests/ref/fate/ea-tgq
+++ /dev/null
@@ -1,278 +0,0 @@
-0, 0, 34944, 0xe33671a4
-0, 6000, 34944, 0xe33671a4
-0, 12000, 34944, 0xe33671a4
-0, 18000, 34944, 0xe33671a4
-0, 24000, 34944, 0xe33671a4
-0, 30000, 34944, 0xe33671a4
-0, 36000, 34944, 0xe33671a4
-0, 42000, 34944, 0xe33671a4
-0, 48000, 34944, 0xe33671a4
-0, 54000, 34944, 0xe33671a4
-0, 60000, 34944, 0xe33671a4
-0, 66000, 34944, 0xe33671a4
-0, 72000, 34944, 0xe33671a4
-0, 78000, 34944, 0xe33671a4
-0, 84000, 34944, 0xe33671a4
-0, 90000, 34944, 0x63196b41
-0, 96000, 34944, 0x308d6f10
-0, 102000, 34944, 0x86026ced
-0, 108000, 34944, 0xaa6a6bc9
-0, 114000, 34944, 0x58276ee3
-0, 120000, 34944, 0x402d70c2
-0, 126000, 34944, 0x948d74bf
-0, 132000, 34944, 0x3d31759c
-0, 138000, 34944, 0x638c734e
-0, 144000, 34944, 0xe218768a
-0, 150000, 34944, 0xed6678ff
-0, 156000, 34944, 0x381b7dda
-0, 162000, 34944, 0x216680e7
-0, 168000, 34944, 0xaca5810f
-0, 174000, 34944, 0xf70b81eb
-0, 180000, 34944, 0x3675858b
-0, 186000, 34944, 0xa51188c3
-0, 192000, 34944, 0x3a848bf1
-0, 198000, 34944, 0x67608d4d
-0, 204000, 34944, 0xafe49165
-0, 210000, 34944, 0x7e8a94a7
-0, 216000, 34944, 0x3b889432
-0, 222000, 34944, 0x97e89623
-0, 228000, 34944, 0x07819793
-0, 234000, 34944, 0xdac39b87
-0, 240000, 34944, 0x4d8c9d93
-0, 246000, 34944, 0xcf009fa7
-0, 252000, 34944, 0x2f109f6e
-0, 258000, 34944, 0xcedda4eb
-0, 264000, 34944, 0xfe89a6df
-0, 270000, 34944, 0x195ea7a9
-0, 276000, 34944, 0x9287ab92
-0, 282000, 34944, 0x6d21af54
-0, 288000, 34944, 0xd627b28b
-0, 294000, 34944, 0x3ad5b6fd
-0, 300000, 34944, 0x5101b64d
-0, 306000, 34944, 0xb968b8ca
-0, 312000, 34944, 0xa105b74a
-0, 318000, 34944, 0xc056bdd6
-0, 324000, 34944, 0xec7fc1d9
-0, 330000, 34944, 0x92c3c3e0
-0, 336000, 34944, 0x9bffc45c
-0, 342000, 34944, 0x5aabca4b
-0, 348000, 34944, 0xcbdacb26
-0, 354000, 34944, 0xed6cce3f
-0, 360000, 34944, 0xcc61cfb8
-0, 366000, 34944, 0x7a97d427
-0, 372000, 34944, 0x7cdbd5ec
-0, 378000, 34944, 0x5851d9c4
-0, 384000, 34944, 0x69d5dd1d
-0, 390000, 34944, 0xdf30dcf4
-0, 396000, 34944, 0x2359e084
-0, 402000, 34944, 0xe0bae491
-0, 408000, 34944, 0xa716e4fd
-0, 414000, 34944, 0xe48aeaf4
-0, 420000, 34944, 0x0a0deb21
-0, 426000, 34944, 0xe8a56e12
-0, 432000, 34944, 0x0d72c98e
-0, 438000, 34944, 0x71a7bb9d
-0, 444000, 34944, 0xc0c8c108
-0, 450000, 34944, 0x1d1fc3ba
-0, 456000, 34944, 0xebcfc67f
-0, 462000, 34944, 0x2921cb5b
-0, 468000, 34944, 0x793ed099
-0, 474000, 34944, 0xefebd9e8
-0, 480000, 34944, 0x163c2330
-0, 486000, 34944, 0x35155672
-0, 492000, 34944, 0x05474e2e
-0, 498000, 34944, 0x9433542f
-0, 504000, 34944, 0x777d5a13
-0, 510000, 34944, 0x87526776
-0, 516000, 34944, 0x4c3c72c1
-0, 522000, 34944, 0x70407b87
-0, 528000, 34944, 0x2358861d
-0, 534000, 34944, 0xec61923f
-0, 540000, 34944, 0x0bb2a0d4
-0, 546000, 34944, 0x6b6d8624
-0, 552000, 34944, 0x624761ec
-0, 558000, 34944, 0xff23b926
-0, 564000, 34944, 0x07fc7ca5
-0, 570000, 34944, 0xa8d3ffda
-0, 576000, 34944, 0xa2d31265
-0, 582000, 34944, 0x5e58225e
-0, 588000, 34944, 0x284b2fb0
-0, 594000, 34944, 0x205b3cb1
-0, 600000, 34944, 0x3fa64a09
-0, 606000, 34944, 0xa5de5097
-0, 612000, 34944, 0x00686cea
-0, 618000, 34944, 0x465a8282
-0, 624000, 34944, 0x4ceb8189
-0, 630000, 34944, 0x14698509
-0, 636000, 34944, 0x232c830d
-0, 642000, 34944, 0x0739807c
-0, 648000, 34944, 0x83b0861e
-0, 654000, 34944, 0xbdc094b1
-0, 660000, 34944, 0xc4c0a605
-0, 666000, 34944, 0x8376b059
-0, 672000, 34944, 0x2035b939
-0, 678000, 34944, 0xb6bfc812
-0, 684000, 34944, 0xc5d4d5c4
-0, 690000, 34944, 0x492c954e
-0, 696000, 34944, 0xd23f0dcc
-0, 702000, 34944, 0x22d7ff6c
-0, 708000, 34944, 0xd08b4168
-0, 714000, 34944, 0xa82e4062
-0, 720000, 34944, 0xcc4f2f31
-0, 726000, 34944, 0x964b0307
-0, 732000, 34944, 0xe8130606
-0, 738000, 34944, 0x5fb744bf
-0, 744000, 34944, 0x1546a88b
-0, 750000, 34944, 0xe6e4d94d
-0, 756000, 34944, 0x8d1ea97e
-0, 762000, 34944, 0x3bb1fb55
-0, 768000, 34944, 0x3c37e9cc
-0, 774000, 34944, 0xe2d22521
-0, 780000, 34944, 0x7c0ec8cc
-0, 786000, 34944, 0x7c2dc956
-0, 792000, 34944, 0x7fe3c263
-0, 798000, 34944, 0x9a65b813
-0, 804000, 34944, 0x7ea7cb14
-0, 810000, 34944, 0x31ded64e
-0, 816000, 34944, 0x50f30ad1
-0, 822000, 34944, 0x12eac45c
-0, 828000, 34944, 0x984b6335
-0, 834000, 34944, 0x3b9b02f0
-0, 840000, 34944, 0x4629d2a4
-0, 846000, 34944, 0x38687e89
-0, 852000, 34944, 0xb76620fe
-0, 858000, 34944, 0x66347155
-0, 864000, 34944, 0x6e6bc297
-0, 870000, 34944, 0x452a653a
-0, 876000, 34944, 0x8c8a0683
-0, 882000, 34944, 0xaf5d7c2d
-0, 888000, 34944, 0x3064a7e1
-0, 894000, 34944, 0xc0657fc4
-0, 900000, 34944, 0x1f129266
-0, 906000, 34944, 0x35adedfb
-0, 912000, 34944, 0x40a3db0d
-0, 918000, 34944, 0x87bebb37
-0, 924000, 34944, 0x04d7ffed
-0, 930000, 34944, 0x9bde3180
-0, 936000, 34944, 0xc35c25bd
-0, 942000, 34944, 0x820bf4bb
-0, 948000, 34944, 0x876163ef
-0, 954000, 34944, 0x3ab6dac0
-0, 960000, 34944, 0x69a9ef73
-0, 966000, 34944, 0x0df3813c
-0, 972000, 34944, 0x1bba0947
-0, 978000, 34944, 0x0b7883d4
-0, 984000, 34944, 0xa9972f7e
-0, 990000, 34944, 0x603d08fe
-0, 996000, 34944, 0x05f4f111
-0, 1002000, 34944, 0xb24fdb42
-0, 1008000, 34944, 0xfe2ad344
-0, 1014000, 34944, 0xda4bcb8f
-0, 1020000, 34944, 0xd28aca6b
-0, 1026000, 34944, 0x9486c260
-0, 1032000, 34944, 0xad9fc04d
-0, 1038000, 34944, 0x9333c0ca
-0, 1044000, 34944, 0x96e9c226
-0, 1050000, 34944, 0x3e89bd6f
-0, 1056000, 34944, 0x7a2dbd32
-0, 1062000, 34944, 0xe578ba53
-0, 1068000, 34944, 0xb77ebab1
-0, 1074000, 34944, 0xd8bfbcb1
-0, 1080000, 34944, 0x15d9bc97
-0, 1086000, 34944, 0x09c3b9f0
-0, 1092000, 34944, 0xd8c8b944
-0, 1098000, 34944, 0x2c2fb996
-0, 1104000, 34944, 0xd7a8b7e7
-0, 1110000, 34944, 0xce34b843
-0, 1116000, 34944, 0xba69e9fd
-0, 1122000, 34944, 0x1b3f1adc
-0, 1128000, 34944, 0x48f515aa
-0, 1134000, 34944, 0x864e12bb
-0, 1140000, 34944, 0xca571996
-0, 1146000, 34944, 0x1d5a1af0
-0, 1152000, 34944, 0x3d1e171f
-0, 1158000, 34944, 0xb57417ca
-0, 1164000, 34944, 0x6e6d1e9d
-0, 1170000, 34944, 0xc9971899
-0, 1176000, 34944, 0xe0b112c8
-0, 1182000, 34944, 0x121b0cd9
-0, 1188000, 34944, 0x418e0eff
-0, 1194000, 34944, 0x9e1b07d8
-0, 1200000, 34944, 0x5590064a
-0, 1206000, 34944, 0x7a170b14
-0, 1212000, 34944, 0xf25709f0
-0, 1218000, 34944, 0x94fa099a
-0, 1224000, 34944, 0x081e06ae
-0, 1230000, 34944, 0xcfc40417
-0, 1236000, 34944, 0xed33096f
-0, 1242000, 34944, 0xd73a07e2
-0, 1248000, 34944, 0xc512077d
-0, 1254000, 34944, 0x27d7021d
-0, 1260000, 34944, 0xab59fd20
-0, 1266000, 34944, 0xcc2400b7
-0, 1272000, 34944, 0xcb3bfb99
-0, 1278000, 34944, 0x0974fb1a
-0, 1284000, 34944, 0xef79f8ba
-0, 1290000, 34944, 0xf932f3a2
-0, 1296000, 34944, 0xa32df1bc
-0, 1302000, 34944, 0xdbe0f532
-0, 1308000, 34944, 0x234cf142
-0, 1314000, 34944, 0xe68befd0
-0, 1320000, 34944, 0xe4e7ee45
-0, 1326000, 34944, 0x0283eff1
-0, 1332000, 34944, 0xc8d3f6db
-0, 1338000, 34944, 0x0aa6ee88
-0, 1344000, 34944, 0xcc3de527
-0, 1350000, 34944, 0x9db0ebef
-0, 1356000, 34944, 0xa207e9db
-0, 1362000, 34944, 0x35b3e74a
-0, 1368000, 34944, 0x1988e848
-0, 1374000, 34944, 0x727de73c
-0, 1380000, 34944, 0x05d5e709
-0, 1386000, 34944, 0x3214e4b2
-0, 1392000, 34944, 0xed85e0a9
-0, 1398000, 34944, 0xf6c9e100
-0, 1404000, 34944, 0x57a8dbaf
-0, 1410000, 34944, 0xc75fdf41
-0, 1416000, 34944, 0x736fde24
-0, 1422000, 34944, 0x8d4bde80
-0, 1428000, 34944, 0x3220dc86
-0, 1434000, 34944, 0xe498da85
-0, 1440000, 34944, 0x0655daed
-0, 1446000, 34944, 0xb22ad874
-0, 1452000, 34944, 0x8198d411
-0, 1458000, 34944, 0xd0d2d557
-0, 1464000, 34944, 0xd740d1ff
-0, 1470000, 34944, 0x2783d00e
-0, 1476000, 34944, 0x7abdcd6b
-0, 1482000, 34944, 0x2e47d1eb
-0, 1488000, 34944, 0xfe1bcf60
-0, 1494000, 34944, 0xf0f0d5bb
-0, 1500000, 34944, 0x9af7d581
-0, 1506000, 34944, 0xb325ca3d
-0, 1512000, 34944, 0xd88abfbd
-0, 1518000, 34944, 0xf2bab746
-0, 1524000, 34944, 0xac44a7dd
-0, 1530000, 34944, 0x609e9ea3
-0, 1536000, 34944, 0xa39993b9
-0, 1542000, 34944, 0x9c948911
-0, 1548000, 34944, 0x72f8822d
-0, 1554000, 34944, 0x7f3f7a8c
-0, 1560000, 34944, 0x7ab475f9
-0, 1566000, 34944, 0x536f73aa
-0, 1572000, 34944, 0x86cb71e5
-0, 1578000, 34944, 0x17157186
-0, 1584000, 34944, 0xe33671a4
-0, 1590000, 34944, 0xe33671a4
-0, 1596000, 34944, 0xe33671a4
-0, 1602000, 34944, 0xe33671a4
-0, 1608000, 34944, 0xe33671a4
-0, 1614000, 34944, 0xe33671a4
-0, 1620000, 34944, 0xe33671a4
-0, 1626000, 34944, 0xe33671a4
-0, 1632000, 34944, 0xe33671a4
-0, 1638000, 34944, 0xe33671a4
-0, 1644000, 34944, 0xe33671a4
-0, 1650000, 34944, 0xe33671a4
-0, 1656000, 34944, 0xe33671a4
-0, 1662000, 34944, 0xe33671a4
diff --git a/tests/ref/fate/ea-tgv-ima-ea-eacs b/tests/ref/fate/ea-tgv-ima-ea-eacs
deleted file mode 100644
index de73eef..0000000
--- a/tests/ref/fate/ea-tgv-ima-ea-eacs
+++ /dev/null
@@ -1,94 +0,0 @@
-0, 0, 230400, 0xfbf2581e
-1, 0, 5872, 0x00000000
-1, 5992, 5872, 0x00000000
-0, 6000, 230400, 0xfbf2581e
-1, 11984, 5872, 0x00000000
-0, 12000, 230400, 0xfbf2581e
-1, 17976, 5872, 0x00000000
-0, 18000, 230400, 0xfbf2581e
-1, 23967, 5872, 0x00000000
-0, 24000, 230400, 0xfbf2581e
-1, 29959, 5872, 0x00000000
-0, 30000, 230400, 0xfbf2581e
-1, 35951, 5872, 0x00000000
-0, 36000, 230400, 0xfbf2581e
-1, 41943, 5872, 0x00000000
-0, 42000, 230400, 0xfbf2581e
-1, 47935, 5872, 0x00000000
-0, 48000, 230400, 0xfbf2581e
-1, 53927, 5872, 0x00000000
-0, 54000, 230400, 0xfbf2581e
-1, 59918, 5872, 0x00000000
-0, 60000, 230400, 0xfbf2581e
-1, 65910, 5872, 0x00000000
-0, 66000, 230400, 0xfbf2581e
-1, 71902, 5872, 0x00000000
-0, 72000, 230400, 0xfbf2581e
-1, 77894, 5872, 0x00000000
-0, 78000, 230400, 0xfbf2581e
-1, 83886, 5872, 0x00000000
-0, 84000, 230400, 0xfbf2581e
-1, 89878, 5872, 0xc6f64777
-0, 90000, 230400, 0xf5a0a21d
-1, 95869, 5872, 0x7c9e60e8
-0, 96000, 230400, 0x909cc039
-1, 101861, 5872, 0x46525c54
-0, 102000, 230400, 0x14d899dd
-1, 107853, 5872, 0x842796bb
-0, 108000, 230400, 0x0d246edf
-1, 113845, 5872, 0xb1f6cbd5
-0, 114000, 230400, 0x5345fe0d
-1, 119837, 5872, 0x0261a74b
-0, 120000, 230400, 0x5abdff9a
-1, 125829, 5872, 0x8218b1f9
-0, 126000, 230400, 0x1730d973
-1, 131820, 5872, 0xd7a2cae6
-0, 132000, 230400, 0xec881be9
-1, 137812, 5872, 0x69d34562
-0, 138000, 230400, 0xf4216895
-1, 143804, 5872, 0x9303ec65
-0, 144000, 230400, 0x529d7a52
-1, 149796, 5872, 0xd5d963a1
-0, 150000, 230400, 0x93b4c7b9
-1, 155788, 5872, 0x0557e06f
-0, 156000, 230400, 0xedc65bcd
-1, 161780, 5872, 0x1eb48b41
-0, 162000, 230400, 0xf0fb54ae
-1, 167771, 5872, 0x70f5ca3f
-0, 168000, 230400, 0x27864ce9
-1, 173763, 5872, 0xd39e5c5e
-0, 174000, 230400, 0xcd05012d
-1, 179755, 5872, 0x29c59140
-0, 180000, 230400, 0x019b6d84
-1, 185747, 5872, 0x7d95e643
-0, 186000, 230400, 0xcc05d416
-1, 191739, 5872, 0x45353fd8
-0, 192000, 230400, 0xb04c0248
-1, 197731, 5872, 0xad7b1b27
-0, 198000, 230400, 0x6806eb92
-1, 203722, 5872, 0x1f0377b3
-0, 204000, 230400, 0x60e9c001
-1, 209714, 5872, 0x6074541e
-0, 210000, 230400, 0x9b040261
-1, 215706, 5872, 0xa4f5e892
-0, 216000, 230400, 0x6961fb90
-1, 221698, 5872, 0x084bc696
-0, 222000, 230400, 0xbf67ad24
-1, 227690, 5872, 0x67fdafce
-0, 228000, 230400, 0x2270f328
-1, 233682, 5872, 0x8dfd249d
-0, 234000, 230400, 0xd0c345f6
-1, 239673, 5872, 0x514184ee
-0, 240000, 230400, 0xfd159212
-1, 245665, 5872, 0xc0090b0d
-0, 246000, 230400, 0x085578ff
-1, 251657, 5872, 0xc1171cc8
-0, 252000, 230400, 0xcca8afa6
-1, 257649, 5872, 0x7d7dd07e
-0, 258000, 230400, 0x901ec91c
-1, 263641, 5872, 0xe6aa619c
-0, 264000, 230400, 0xf1cb99f3
-1, 269633, 5872, 0xd5aac0df
-0, 270000, 230400, 0x86d98f0c
-1, 275624, 5872, 0x3b68b390
-0, 276000, 230400, 0x52970700
diff --git a/tests/ref/fate/ea-tgv-ima-ea-sead b/tests/ref/fate/ea-tgv-ima-ea-sead
deleted file mode 100644
index bfa8419..0000000
--- a/tests/ref/fate/ea-tgv-ima-ea-sead
+++ /dev/null
@@ -1,87 +0,0 @@
-0, 0, 192000, 0xdfc2f225
-1, 0, 2944, 0x00000000
-1, 3004, 5888, 0x5ae3c2a4
-0, 6000, 192000, 0x059b57bd
-1, 9012, 5888, 0x158fbcb4
-0, 12000, 192000, 0x766cb086
-1, 15020, 5888, 0x3fc85d35
-0, 18000, 192000, 0x459e3bac
-1, 21029, 5888, 0x4667ec2b
-0, 24000, 192000, 0x5293e622
-1, 27037, 5888, 0x82744494
-0, 30000, 192000, 0x898b03f4
-1, 33045, 5888, 0x3b0cb86f
-0, 36000, 192000, 0xb184a627
-1, 39053, 5888, 0x29493fbb
-0, 42000, 192000, 0xa3fc650a
-1, 45061, 5888, 0xaa2d8595
-0, 48000, 192000, 0xea448589
-1, 51069, 5888, 0x2e563de6
-0, 54000, 192000, 0x700e2b76
-1, 57078, 5888, 0x225cca99
-0, 60000, 192000, 0xa1a1d66d
-1, 63086, 5888, 0x2b577599
-0, 66000, 192000, 0xd63bc8a1
-1, 69094, 5888, 0x3d967f32
-0, 72000, 192000, 0x5f08c023
-1, 75102, 5888, 0x16639a84
-0, 78000, 192000, 0x8b75ec3b
-1, 81110, 5888, 0x90549ba0
-0, 84000, 192000, 0x62728ce4
-1, 87118, 5888, 0xf46e6644
-0, 90000, 192000, 0xaa007941
-1, 93127, 5888, 0x39a073ec
-0, 96000, 192000, 0x55dc5b3b
-1, 99135, 5888, 0xb1d7a93a
-0, 102000, 192000, 0x72d836c2
-1, 105143, 5888, 0x25e9795b
-0, 108000, 192000, 0x1f2de2fc
-1, 111151, 5888, 0xbbc07644
-0, 114000, 192000, 0xb295dfdb
-1, 117159, 5888, 0x323f6a1b
-0, 120000, 192000, 0xe5c5f634
-1, 123167, 5888, 0x7cae130b
-0, 126000, 192000, 0x455a0464
-1, 129176, 5888, 0xd23bf9c6
-0, 132000, 192000, 0x3bf2340d
-1, 135184, 5888, 0x5f73ef35
-0, 138000, 192000, 0xe368f0fc
-1, 141192, 5888, 0xc66026be
-0, 144000, 192000, 0xfa7549c0
-1, 147200, 5888, 0xc8fdb539
-0, 150000, 192000, 0x4dd76f3d
-1, 153208, 5888, 0x94c6bfbd
-0, 156000, 192000, 0x50a49f6c
-1, 159216, 5888, 0xb77e1b83
-0, 162000, 192000, 0xb6072f65
-1, 165224, 5888, 0x6c6d6693
-0, 168000, 192000, 0x093ce1a8
-1, 171233, 5888, 0xd9f064d4
-0, 174000, 192000, 0x55afe3db
-1, 177241, 5888, 0x85dd990d
-0, 180000, 192000, 0x81c3bfab
-1, 183249, 5888, 0x385e021b
-0, 186000, 192000, 0x583ebd3d
-1, 189257, 5888, 0xac09fd02
-0, 192000, 192000, 0x2504f003
-1, 195265, 5888, 0xc6dcdff2
-0, 198000, 192000, 0x44ade2af
-1, 201273, 5888, 0x86a6944d
-0, 204000, 192000, 0x77cbcfd8
-1, 207282, 5888, 0x8587b964
-0, 210000, 192000, 0xac7ddfa1
-1, 213290, 5888, 0x2b0355ff
-0, 216000, 192000, 0x79f7cfe8
-1, 219298, 5888, 0xe4148a85
-0, 222000, 192000, 0xdf2898fd
-1, 225306, 5888, 0xdf02ed4f
-1, 231314, 5888, 0x87a54b15
-1, 237322, 5888, 0x3ad2be45
-1, 243331, 5888, 0x3a49c2c3
-1, 249339, 5888, 0xc2b66404
-1, 255347, 5888, 0xac3e234a
-1, 261355, 5888, 0x5dcf523b
-1, 267363, 5888, 0x2034b5d6
-1, 273371, 5888, 0x96882832
-1, 279380, 5888, 0x2be3d534
-1, 285388, 5888, 0xa841a49d
diff --git a/tests/ref/fate/ea-tqi-adpcm b/tests/ref/fate/ea-tqi-adpcm
deleted file mode 100644
index c79eed5..0000000
--- a/tests/ref/fate/ea-tqi-adpcm
+++ /dev/null
@@ -1,52 +0,0 @@
-0, 0, 115200, 0x375ec573
-1, 0, 5936, 0x00000000
-0, 6000, 115200, 0x375ec573
-1, 6057, 5824, 0x00000000
-0, 12000, 115200, 0x375ec573
-1, 12000, 5936, 0x00000000
-0, 18000, 115200, 0x375ec573
-1, 18057, 5824, 0x00000000
-0, 24000, 115200, 0x375ec573
-1, 24000, 5936, 0x00000000
-0, 30000, 115200, 0x375ec573
-1, 30057, 5824, 0x00000000
-0, 36000, 115200, 0x375ec573
-1, 36000, 5936, 0x00000000
-0, 42000, 115200, 0x375ec573
-1, 42057, 5824, 0x0f06f5bb
-0, 48000, 115200, 0x0b4d31bf
-1, 48000, 5936, 0xb0dbfc46
-0, 54000, 115200, 0xdd724598
-1, 54057, 5824, 0x9daa9f9c
-0, 60000, 115200, 0xc3077e75
-1, 60000, 5936, 0x61400d2f
-0, 66000, 115200, 0xbf70778a
-1, 66057, 5824, 0x34a5b0e3
-0, 72000, 115200, 0x117eb766
-1, 72000, 5936, 0x6e546f72
-0, 78000, 115200, 0x4617fbad
-1, 78057, 5824, 0x4f093b35
-0, 84000, 115200, 0x5f5b02d2
-1, 84000, 5936, 0x95b5b599
-0, 90000, 115200, 0x2a9c5325
-1, 90057, 5824, 0x75e15e60
-0, 96000, 115200, 0x14a89e2a
-1, 96000, 5936, 0xd1077d39
-0, 102000, 115200, 0xe69aa994
-1, 102057, 5824, 0x956e21ca
-0, 108000, 115200, 0xfbacf589
-1, 108000, 5936, 0x33bac234
-0, 114000, 115200, 0x1d714c6e
-1, 114057, 5824, 0x5df37824
-0, 120000, 115200, 0x6eff66cb
-1, 120000, 5936, 0xc174af24
-0, 126000, 115200, 0xee21c1cb
-1, 126057, 5824, 0xe5dc2159
-0, 132000, 115200, 0xce714ada
-1, 132000, 5936, 0x63ffc8b1
-0, 138000, 115200, 0xf89d56c3
-1, 138057, 5824, 0xefe4c365
-0, 144000, 115200, 0x65fd5e60
-1, 144000, 5936, 0x2174304d
-0, 150000, 115200, 0x0c256424
-0, 156000, 115200, 0xa9cdd8d2
diff --git a/tests/ref/fate/ea-vp60 b/tests/ref/fate/ea-vp60
deleted file mode 100644
index b5a70c3..0000000
--- a/tests/ref/fate/ea-vp60
+++ /dev/null
@@ -1,133 +0,0 @@
-0, 0, 55296, 0x6a3202a3
-0, 3003, 55296, 0x2af202eb
-0, 6006, 55296, 0xa1a40388
-0, 9009, 55296, 0x61c90426
-0, 12012, 55296, 0x17720594
-0, 15015, 55296, 0x49440805
-0, 18018, 55296, 0x5b2e0d32
-0, 21021, 55296, 0x207891c1
-0, 24024, 55296, 0x502da4cd
-0, 27027, 55296, 0x75a22a75
-0, 30030, 55296, 0xd55099af
-0, 33033, 55296, 0x48778bb6
-0, 36036, 55296, 0xe76b7df7
-0, 39039, 55296, 0x5a049f33
-0, 42042, 55296, 0xc83d9b90
-0, 45045, 55296, 0x567877b8
-0, 48048, 55296, 0x334c7f6e
-0, 51051, 55296, 0x8717945c
-0, 54054, 55296, 0xe432831e
-0, 57057, 55296, 0x032e8d2d
-0, 60060, 55296, 0x37109fd6
-0, 63063, 55296, 0xe9b0b61b
-0, 66066, 55296, 0x7385dae8
-0, 69069, 55296, 0x74b8a9f5
-0, 72072, 55296, 0xbce2e218
-0, 75075, 55296, 0x0ab6c623
-0, 78078, 55296, 0x2234d6d6
-0, 81081, 55296, 0xd18be4d6
-0, 84084, 55296, 0x5247ecc9
-0, 87087, 55296, 0xc89f10ca
-0, 90090, 55296, 0x16181f87
-0, 93093, 55296, 0x893bfa85
-0, 96096, 55296, 0x1fd9f1c0
-0, 99099, 55296, 0xa2e8e6a9
-0, 102102, 55296, 0x1b42dfd5
-0, 105105, 55296, 0x0fa9f509
-0, 108108, 55296, 0x4449c216
-0, 111111, 55296, 0xb66baa36
-0, 114114, 55296, 0x38c19f3b
-0, 117117, 55296, 0xcdce83a0
-0, 120120, 55296, 0xac4ea82b
-0, 123123, 55296, 0xb77a6979
-0, 126126, 55296, 0xc8834ec2
-0, 129129, 55296, 0x181d3f0f
-0, 132132, 55296, 0x2ae04252
-0, 135135, 55296, 0x07633c18
-0, 138138, 55296, 0xdc6a3340
-0, 141141, 55296, 0xa456ebb1
-0, 144144, 55296, 0xbf7de5e2
-0, 147147, 55296, 0x54a1c39b
-0, 150150, 55296, 0x08fc9423
-0, 153153, 55296, 0x926f968a
-0, 156156, 55296, 0x5c908481
-0, 159159, 55296, 0x6b257f16
-0, 162162, 55296, 0xbaf8658a
-0, 165165, 55296, 0x61c957b1
-0, 168168, 55296, 0xa6d181ff
-0, 171171, 55296, 0xef476e69
-0, 174174, 55296, 0x74f72f9a
-0, 177177, 55296, 0x3a9328e9
-0, 180180, 55296, 0xbe962874
-0, 183183, 55296, 0x5f8b58cc
-0, 186186, 55296, 0x1e066d22
-0, 189189, 55296, 0x9ef72b34
-0, 192192, 55296, 0x525c2bb1
-0, 195195, 55296, 0x8e5a20a3
-0, 198198, 55296, 0x1c6723d0
-0, 201201, 55296, 0x2b1023c8
-0, 204204, 55296, 0x8f682691
-0, 207207, 55296, 0x3a0624f5
-0, 210210, 55296, 0xbc1046fb
-0, 213213, 55296, 0x2859470e
-0, 216216, 55296, 0x61d45a12
-0, 219219, 55296, 0xa68853b6
-0, 222222, 55296, 0x36543ce4
-0, 225225, 55296, 0x95b953d4
-0, 228228, 55296, 0x804b3c53
-0, 231231, 55296, 0x743960f6
-0, 234234, 55296, 0x23916b9c
-0, 237237, 55296, 0x8f5a59e3
-0, 240240, 55296, 0xf1285f83
-0, 243243, 55296, 0xde75640f
-0, 246246, 55296, 0xde146188
-0, 249249, 55296, 0xb5315cc9
-0, 252252, 55296, 0xa85f6861
-0, 255255, 55296, 0x4fda562f
-0, 258258, 55296, 0xa0185863
-0, 261261, 55296, 0xe4dc5a5f
-0, 264264, 55296, 0x8a2aabb6
-0, 267267, 55296, 0x3ba89b4f
-0, 270270, 55296, 0x82b07c21
-0, 273273, 55296, 0xb7998478
-0, 276276, 55296, 0xceca8046
-0, 279279, 55296, 0xe652b325
-0, 282282, 55296, 0xc26bb607
-0, 285285, 55296, 0x40c99200
-0, 288288, 55296, 0x61bc9b27
-0, 291291, 55296, 0x1e4baa30
-0, 294294, 55296, 0xd8a7adb0
-0, 297297, 55296, 0x0d0aa8fb
-0, 300300, 55296, 0x1f1ba33c
-0, 303303, 55296, 0xa000a80b
-0, 306306, 55296, 0xb49dd332
-0, 309309, 55296, 0x6b8ac499
-0, 312312, 55296, 0x9636ed15
-0, 315315, 55296, 0xa152f03d
-0, 318318, 55296, 0x47a8cfc7
-0, 321321, 55296, 0x9f94c82a
-0, 324324, 55296, 0xe208d626
-0, 327327, 55296, 0x28cc0616
-0, 330330, 55296, 0xc545179e
-0, 333333, 55296, 0xdf9205af
-0, 336336, 55296, 0x31d6ed99
-0, 339339, 55296, 0x866bf86e
-0, 342342, 55296, 0x0490fbd1
-0, 345345, 55296, 0xe1102987
-0, 348348, 55296, 0x7f860c29
-0, 351351, 55296, 0xc3a91f7a
-0, 354354, 55296, 0x69641a52
-0, 357357, 55296, 0x05b12204
-0, 360360, 55296, 0x715b6206
-0, 363363, 55296, 0xdcf55139
-0, 366366, 55296, 0x1369f746
-0, 369369, 55296, 0xc1533ef5
-0, 372372, 55296, 0xc00ff85f
-0, 375375, 55296, 0x4f5f70dc
-0, 378378, 55296, 0x85720ccc
-0, 381381, 55296, 0xfdff0780
-0, 384384, 55296, 0x57ef04ff
-0, 387387, 55296, 0xbf94041f
-0, 390390, 55296, 0x4cee0392
-0, 393393, 55296, 0x80160314
-0, 396396, 55296, 0x396802af
diff --git a/tests/ref/fate/ea-vp61 b/tests/ref/fate/ea-vp61
deleted file mode 100644
index bddaf42..0000000
--- a/tests/ref/fate/ea-vp61
+++ /dev/null
@@ -1,120 +0,0 @@
-0, 0, 18816, 0xc3fe9fc7
-0, 3003, 18816, 0x6ddf972f
-0, 6006, 18816, 0x72808b6e
-0, 9009, 18816, 0x8f09857f
-0, 12012, 18816, 0xe8027c00
-0, 15015, 18816, 0x308670cf
-0, 18018, 18816, 0x0e656170
-0, 21021, 18816, 0x594e54a4
-0, 24024, 18816, 0x36944b05
-0, 27027, 18816, 0x87013a34
-0, 30030, 18816, 0xc0f32f0d
-0, 33033, 18816, 0x911f1951
-0, 36036, 18816, 0xad590d59
-0, 39039, 18816, 0x943afff0
-0, 42042, 18816, 0x7f5ef719
-0, 45045, 18816, 0x889feafc
-0, 48048, 18816, 0x4334e12b
-0, 51051, 18816, 0xd080cc67
-0, 54054, 18816, 0xc3c1c04c
-0, 57057, 18816, 0x816bae4b
-0, 60060, 18816, 0xed23a5c7
-0, 63063, 18816, 0x86689c2f
-0, 66066, 18816, 0x63408c52
-0, 69069, 18816, 0x399c79d6
-0, 72072, 18816, 0xf0ff63bf
-0, 75075, 18816, 0xa6185353
-0, 78078, 18816, 0xe33d46fc
-0, 81081, 18816, 0xd58d3c6d
-0, 84084, 18816, 0xc94a27ea
-0, 87087, 18816, 0x62f31c59
-0, 90090, 18816, 0x71880825
-0, 93093, 18816, 0xa6ce01d7
-0, 96096, 18816, 0xa1d4fc06
-0, 99099, 18816, 0xc208f570
-0, 102102, 18816, 0xc862e637
-0, 105105, 18816, 0xcf9ed93a
-0, 108108, 18816, 0x85a8cbcc
-0, 111111, 18816, 0x650ac6c1
-0, 114114, 18816, 0xb418c12b
-0, 117117, 18816, 0x9fe5b412
-0, 120120, 18816, 0x80f6a7c1
-0, 123123, 18816, 0x283299e4
-0, 126126, 18816, 0x15429202
-0, 129129, 18816, 0x9f0f8c8a
-0, 132132, 18816, 0x8e828811
-0, 135135, 18816, 0xaac67993
-0, 138138, 18816, 0x8f3b6f4f
-0, 141141, 18816, 0x0b125f95
-0, 144144, 18816, 0xb4e75d14
-0, 147147, 18816, 0x1bac5933
-0, 150150, 18816, 0x300b521b
-0, 153153, 18816, 0x51174590
-0, 156156, 18816, 0x03df3d70
-0, 159159, 18816, 0x338a344a
-0, 162162, 18816, 0x45ad328d
-0, 165165, 18816, 0x2d4e321a
-0, 168168, 18816, 0x15932563
-0, 171171, 18816, 0x9b4f1c76
-0, 174174, 18816, 0x8e31153c
-0, 177177, 18816, 0xfb391185
-0, 180180, 18816, 0x93ee0cdc
-0, 183183, 18816, 0xddeb0642
-0, 186186, 18816, 0xda6cf529
-0, 189189, 18816, 0xdbd6f085
-0, 192192, 18816, 0x357aec81
-0, 195195, 18816, 0x36eaecca
-0, 198198, 18816, 0x6535ee02
-0, 201201, 18816, 0xb7dfe466
-0, 204204, 18816, 0x58d3d86b
-0, 207207, 18816, 0xd8aad64b
-0, 210210, 18816, 0x37ecd588
-0, 213213, 18816, 0xe2f9cee4
-0, 216216, 18816, 0xcd1ac93e
-0, 219219, 18816, 0x18e1be81
-0, 222222, 18816, 0xa05bb9d7
-0, 225225, 18816, 0xe0ebb663
-0, 228228, 18816, 0x7d61b39a
-0, 231231, 18816, 0x01b8acb5
-0, 234234, 18816, 0x7577aa8b
-0, 237237, 18816, 0x6bbda4b5
-0, 240240, 18816, 0xd0cc9b29
-0, 243243, 18816, 0xb2858cbb
-0, 246246, 18816, 0x93608c9d
-0, 249249, 18816, 0x80c38e03
-0, 252252, 18816, 0x37d6843c
-0, 255255, 18816, 0xacc47b9a
-0, 258258, 18816, 0xc4317178
-0, 261261, 18816, 0xc92f6ebd
-0, 264264, 18816, 0xc1217a3b
-0, 267267, 18816, 0x03a37ccb
-0, 270270, 18816, 0xf38c71a2
-0, 273273, 18816, 0x68ff697d
-0, 276276, 18816, 0x0fe358e5
-0, 279279, 18816, 0x58455870
-0, 282282, 18816, 0xc9075ce7
-0, 285285, 18816, 0x16685773
-0, 288288, 18816, 0x1b434c0e
-0, 291291, 18816, 0x008e4c97
-0, 294294, 18816, 0xb4d04f4f
-0, 297297, 18816, 0xc8c94848
-0, 300300, 18816, 0x64664191
-0, 303303, 18816, 0xd591367f
-0, 306306, 18816, 0xc70d3141
-0, 309309, 18816, 0x8d492655
-0, 312312, 18816, 0x7e7f22c8
-0, 315315, 18816, 0x335d23f9
-0, 318318, 18816, 0x0a7f22b6
-0, 321321, 18816, 0x6cf51cb2
-0, 324324, 18816, 0x312516e1
-0, 327327, 18816, 0x8a3c0c7a
-0, 330330, 18816, 0x997d0d20
-0, 333333, 18816, 0xffbd117e
-0, 336336, 18816, 0x855808ca
-0, 339339, 18816, 0xe335fb94
-0, 342342, 18816, 0x12e6f95c
-0, 345345, 18816, 0x2d62f845
-0, 348348, 18816, 0x7e63f591
-0, 351351, 18816, 0x7463f175
-0, 354354, 18816, 0x1521e0d2
-0, 357357, 18816, 0x96a8dbce
diff --git a/tests/ref/fate/feeble-dxa b/tests/ref/fate/feeble-dxa
deleted file mode 100644
index 3096032..0000000
--- a/tests/ref/fate/feeble-dxa
+++ /dev/null
@@ -1,65 +0,0 @@
-1, 0, 1000, 0x64cd9403
-0, 0, 921600, 0x0d03844f
-1, 4082, 1000, 0xa4ef8a9d
-1, 8163, 1000, 0x75c19868
-0, 9000, 921600, 0x0d03844f
-1, 12245, 1000, 0x93db6f79
-1, 16327, 1000, 0x6835625d
-0, 18000, 921600, 0x649cdcea
-1, 20408, 1000, 0xb3affa8f
-1, 24490, 1000, 0x159fdcc8
-0, 27000, 921600, 0x649cdcea
-1, 28571, 1000, 0x79f9f7f1
-1, 32653, 1000, 0xd7d1131e
-0, 36000, 921600, 0x9c7f22e8
-1, 36735, 1000, 0x52a6f797
-1, 40816, 1000, 0x748202ca
-1, 44898, 1000, 0x0ef92449
-0, 45000, 921600, 0x9c7f22e8
-1, 48980, 1000, 0x6a3760ab
-1, 53061, 1000, 0xce5c5abf
-0, 54000, 921600, 0x3451514a
-1, 57143, 1000, 0x23396792
-1, 61224, 1000, 0xa5276238
-0, 63000, 921600, 0x3451514a
-1, 65306, 1000, 0x288adf1b
-1, 69388, 1000, 0xe7de6fb2
-0, 72000, 921600, 0x8f19f600
-1, 73469, 1000, 0x2c2c707f
-1, 77551, 1000, 0xd66d6daf
-0, 81000, 921600, 0x8f19f600
-1, 81633, 1000, 0xbcea7d64
-1, 85714, 1000, 0x766feea5
-1, 89796, 1000, 0xd2e1d63a
-0, 90000, 921600, 0x07e7445b
-1, 93878, 1000, 0x2f7ef4ed
-1, 97959, 1000, 0xb655cba4
-0, 99000, 921600, 0x07e7445b
-1, 102041, 1000, 0x4507d37b
-1, 106122, 1000, 0x0c57f794
-0, 108000, 921600, 0x873d1227
-1, 110204, 1000, 0x0ecbe5cc
-1, 114286, 1000, 0x9bf6e345
-0, 117000, 921600, 0x873d1227
-1, 118367, 1000, 0xc461443c
-1, 122449, 1000, 0xad9657bf
-0, 126000, 921600, 0xbef62d86
-1, 126531, 1000, 0x466fe91c
-1, 130612, 1000, 0x9ee377fe
-1, 134694, 1000, 0x09956428
-0, 135000, 921600, 0xbef62d86
-1, 138776, 1000, 0x9b285f0a
-1, 142857, 1000, 0x0a3e61a6
-0, 144000, 921600, 0xcf84fee4
-1, 146939, 1000, 0xacc25d6b
-1, 151020, 1000, 0x377be319
-0, 153000, 921600, 0xcf84fee4
-1, 155102, 1000, 0xe4890504
-1, 159184, 1000, 0xe90a6497
-0, 162000, 921600, 0x5639e670
-1, 163265, 1000, 0xd00fe950
-1, 167347, 1000, 0xf195eb44
-0, 171000, 921600, 0x5639e670
-1, 171429, 1000, 0xa491f3ef
-1, 175510, 1000, 0x2c036e18
-1, 179592, 1000, 0x52d65e2a
diff --git a/tests/ref/fate/film-cvid-pcm-stereo-8bit b/tests/ref/fate/film-cvid-pcm-stereo-8bit
deleted file mode 100644
index ebe0fc4..0000000
--- a/tests/ref/fate/film-cvid-pcm-stereo-8bit
+++ /dev/null
@@ -1,247 +0,0 @@
-1, 0, 88192, 0x23bb50ae
-0, 0, 107520, 0xa6c9fdd2
-0, 3000, 107520, 0x61eb28c1
-0, 6000, 107520, 0x45e20af7
-0, 9000, 107520, 0x45e20af7
-0, 12000, 107520, 0x366970fc
-0, 15000, 107520, 0x366970fc
-0, 18000, 107520, 0xa392bcb3
-0, 21000, 107520, 0xa392bcb3
-0, 24000, 107520, 0xcf7bac98
-0, 27000, 107520, 0xcf7bac98
-0, 30000, 107520, 0x222eba53
-0, 33000, 107520, 0x222eba53
-0, 36000, 107520, 0x74e255a1
-0, 39000, 107520, 0x74e255a1
-0, 42000, 107520, 0xc19eec6f
-1, 44996, 44112, 0x79600f01
-0, 45000, 107520, 0xc19eec6f
-0, 48000, 107520, 0xa3880681
-0, 51000, 107520, 0xa3880681
-0, 54000, 107520, 0x957878db
-0, 57000, 107520, 0x957878db
-0, 60000, 107520, 0x18340692
-0, 63000, 107520, 0x18340692
-0, 66000, 107520, 0x9970f24d
-1, 67502, 44096, 0x09dbf7aa
-0, 69000, 107520, 0x9970f24d
-0, 72000, 107520, 0xf08618aa
-0, 75000, 107520, 0xf08618aa
-0, 78000, 107520, 0xee7324f0
-0, 81000, 107520, 0xee7324f0
-0, 84000, 107520, 0xe15025b3
-0, 87000, 107520, 0xe15025b3
-1, 90000, 44112, 0x18fed048
-0, 90000, 107520, 0x8afa312e
-0, 93000, 107520, 0x8afa312e
-0, 96000, 107520, 0x717a7d0f
-0, 99000, 107520, 0x717a7d0f
-0, 102000, 107520, 0x355c6e23
-0, 105000, 107520, 0x355c6e23
-0, 108000, 107520, 0x7015a50f
-0, 111000, 107520, 0x7015a50f
-1, 112506, 44112, 0x030d35ef
-0, 114000, 107520, 0xcdfc1a16
-0, 117000, 107520, 0xcdfc1a16
-0, 120000, 107520, 0x38d929e7
-0, 123000, 107520, 0x38d929e7
-0, 126000, 107520, 0x52913423
-0, 129000, 107520, 0x52913423
-0, 132000, 107520, 0xe2c91c10
-0, 135000, 107520, 0xe2c91c10
-1, 135012, 44112, 0xc23154d5
-0, 138000, 107520, 0x85516e9c
-0, 141000, 107520, 0x85516e9c
-0, 144000, 107520, 0xd1626030
-0, 147000, 107520, 0xd1626030
-0, 150000, 107520, 0xea7b16de
-0, 153000, 107520, 0xea7b16de
-0, 156000, 107520, 0xa33eaa0d
-1, 157518, 44064, 0xe4713ee7
-0, 159000, 107520, 0xa33eaa0d
-0, 162000, 107520, 0x8e3be6a6
-0, 165000, 107520, 0x8e3be6a6
-0, 168000, 107520, 0x14147bd6
-0, 171000, 107520, 0x14147bd6
-0, 174000, 107520, 0x07d54bec
-0, 177000, 107520, 0x07d54bec
-1, 180000, 44112, 0xddc19d91
-0, 180000, 107520, 0xe287a0a7
-0, 183000, 107520, 0xe287a0a7
-0, 186000, 107520, 0xc023a14d
-0, 189000, 107520, 0xc023a14d
-0, 192000, 107520, 0x2437085d
-0, 195000, 107520, 0x2437085d
-0, 198000, 107520, 0x63823918
-0, 201000, 107520, 0x63823918
-1, 202506, 44112, 0x9591522d
-0, 204000, 107520, 0xbc17e198
-0, 207000, 107520, 0xbc17e198
-0, 210000, 107520, 0x9d99bc81
-0, 213000, 107520, 0x9d99bc81
-0, 216000, 107520, 0x7e4ec71e
-0, 219000, 107520, 0x7e4ec71e
-0, 222000, 107520, 0x55b98376
-0, 225000, 107520, 0x55b98376
-1, 225012, 44112, 0x90deb013
-0, 228000, 107520, 0x356d8e9e
-0, 231000, 107520, 0x356d8e9e
-0, 234000, 107520, 0xf77e8a61
-0, 237000, 107520, 0xf77e8a61
-0, 240000, 107520, 0x5ae7c8c7
-0, 243000, 107520, 0x5ae7c8c7
-0, 246000, 107520, 0x8acf9322
-1, 247518, 44064, 0x3842d420
-0, 249000, 107520, 0x8acf9322
-0, 252000, 107520, 0x40a9177e
-0, 255000, 107520, 0x40a9177e
-0, 258000, 107520, 0x3e0e4d8d
-0, 261000, 107520, 0x3e0e4d8d
-0, 264000, 107520, 0xd268865b
-0, 267000, 107520, 0xd268865b
-1, 270000, 44112, 0x99c8c3d9
-0, 270000, 107520, 0x89a4efeb
-0, 273000, 107520, 0x89a4efeb
-0, 276000, 107520, 0x70ca2478
-0, 279000, 107520, 0x70ca2478
-0, 282000, 107520, 0xcc9ec981
-0, 285000, 107520, 0xcc9ec981
-0, 288000, 107520, 0xf0648459
-0, 291000, 107520, 0xf0648459
-1, 292506, 44112, 0xffaf3824
-0, 294000, 107520, 0x7e4a4cca
-0, 297000, 107520, 0x7e4a4cca
-0, 300000, 107520, 0xb315dc65
-0, 303000, 107520, 0xb315dc65
-0, 306000, 107520, 0x2aecc7b4
-0, 309000, 107520, 0x2aecc7b4
-0, 312000, 107520, 0x81742f51
-0, 315000, 107520, 0x81742f51
-1, 315012, 44112, 0x3dbe1aef
-0, 318000, 107520, 0x3a1d7571
-0, 321000, 107520, 0x3a1d7571
-0, 324000, 107520, 0x3a1d7571
-0, 327000, 107520, 0x3a1d7571
-0, 330000, 107520, 0x3a1d7571
-0, 333000, 107520, 0x3a1d7571
-0, 336000, 107520, 0x3a1d7571
-1, 337518, 44064, 0xed2c7dfb
-0, 339000, 107520, 0x3a1d7571
-0, 342000, 107520, 0x3a1d7571
-0, 345000, 107520, 0x3a1d7571
-0, 348000, 107520, 0x3a1d7571
-0, 351000, 107520, 0x3a1d7571
-0, 354000, 107520, 0x3a1d7571
-0, 357000, 107520, 0x3a1d7571
-1, 360000, 44112, 0x9e475274
-0, 360000, 107520, 0xe974733e
-0, 363000, 107520, 0xe974733e
-0, 366000, 107520, 0x999c6fbf
-0, 369000, 107520, 0x999c6fbf
-0, 372000, 107520, 0x26b56b6e
-0, 375000, 107520, 0x26b56b6e
-0, 378000, 107520, 0xc9f9647b
-0, 381000, 107520, 0xc9f9647b
-1, 382506, 44112, 0x541f05d4
-0, 384000, 107520, 0x6d025d00
-0, 387000, 107520, 0x6d025d00
-0, 390000, 107520, 0xf9c056c1
-0, 393000, 107520, 0xf9c056c1
-0, 396000, 107520, 0xa5cc4d0b
-0, 399000, 107520, 0xa5cc4d0b
-0, 402000, 107520, 0x1a4c4236
-0, 405000, 107520, 0x1a4c4236
-1, 405012, 44112, 0x09e39025
-0, 408000, 107520, 0xa9d538b6
-0, 411000, 107520, 0xa9d538b6
-0, 414000, 107520, 0x14682d00
-0, 417000, 107520, 0x14682d00
-0, 420000, 107520, 0x6236204f
-0, 423000, 107520, 0x6236204f
-0, 426000, 107520, 0x303e14aa
-1, 427518, 44064, 0xdc111087
-0, 429000, 107520, 0x303e14aa
-0, 432000, 107520, 0x943b0837
-0, 435000, 107520, 0x943b0837
-0, 438000, 107520, 0xfce5fd07
-0, 441000, 107520, 0xfce5fd07
-0, 444000, 107520, 0xd993f193
-0, 447000, 107520, 0xd993f193
-1, 450000, 44112, 0xb8f86e48
-0, 450000, 107520, 0x4d48e7b4
-0, 453000, 107520, 0x4d48e7b4
-0, 456000, 107520, 0x61ccdf83
-0, 459000, 107520, 0x61ccdf83
-0, 462000, 107520, 0xfb4fd608
-0, 465000, 107520, 0xfb4fd608
-0, 468000, 107520, 0x5efdcdb3
-0, 471000, 107520, 0x5efdcdb3
-1, 472506, 44112, 0xa1e0c75c
-0, 474000, 107520, 0xb03ec886
-0, 477000, 107520, 0xb03ec886
-0, 480000, 107520, 0xf464c343
-0, 483000, 107520, 0xf464c343
-0, 486000, 107520, 0xf464c343
-0, 489000, 107520, 0xf464c343
-0, 492000, 107520, 0xf464c343
-0, 495000, 107520, 0xf464c343
-1, 495012, 44112, 0x0654dcb0
-0, 498000, 107520, 0xf464c343
-0, 501000, 107520, 0xf464c343
-0, 504000, 107520, 0xf464c343
-0, 507000, 107520, 0xf464c343
-0, 510000, 107520, 0xf464c343
-0, 513000, 107520, 0xf464c343
-0, 516000, 107520, 0xf464c343
-1, 517518, 44064, 0xb921e11a
-0, 519000, 107520, 0xf464c343
-0, 522000, 107520, 0xf464c343
-0, 525000, 107520, 0xf464c343
-0, 528000, 107520, 0xf464c343
-0, 531000, 107520, 0xf464c343
-0, 534000, 107520, 0xf464c343
-0, 537000, 107520, 0xf464c343
-1, 540000, 44112, 0xe0ac619f
-0, 540000, 107520, 0xf464c343
-0, 543000, 107520, 0xf464c343
-0, 546000, 107520, 0xf2b2c712
-0, 549000, 107520, 0xf2b2c712
-0, 552000, 107520, 0xf2b2c712
-0, 555000, 107520, 0xf2b2c712
-0, 558000, 107520, 0xf2b2c712
-0, 561000, 107520, 0xf2b2c712
-1, 562506, 44112, 0xb07aa65c
-0, 564000, 107520, 0xf2b2c712
-0, 567000, 107520, 0xf2b2c712
-0, 570000, 107520, 0xb95e6bc8
-0, 573000, 107520, 0xb95e6bc8
-0, 576000, 107520, 0x33feee37
-0, 579000, 107520, 0x33feee37
-0, 582000, 107520, 0x36ee3cd5
-0, 585000, 107520, 0x36ee3cd5
-1, 585012, 44112, 0x24610ff0
-0, 588000, 107520, 0x59096471
-0, 591000, 107520, 0x59096471
-0, 594000, 107520, 0x53b470c6
-0, 597000, 107520, 0x53b470c6
-0, 600000, 107520, 0xdb7c64ff
-0, 603000, 107520, 0xdb7c64ff
-0, 606000, 107520, 0xe5a1596a
-1, 607518, 44064, 0x00000000
-0, 609000, 107520, 0xe5a1596a
-0, 612000, 107520, 0x8c8942eb
-0, 615000, 107520, 0x8c8942eb
-0, 618000, 107520, 0x5ecc379e
-0, 621000, 107520, 0x5ecc379e
-0, 624000, 107520, 0xea09432a
-0, 627000, 107520, 0xea09432a
-1, 630000, 44112, 0x00000000
-0, 630000, 107520, 0xe01e6b73
-0, 633000, 107520, 0xe01e6b73
-0, 636000, 107520, 0x1d13bba8
-0, 639000, 107520, 0x1d13bba8
-0, 642000, 107520, 0x3a993a6c
-0, 645000, 107520, 0x3a993a6c
-0, 648000, 107520, 0x2ede041a
-0, 651000, 107520, 0x2ede041a
-1, 652506, 8800, 0x00000000
diff --git a/tests/ref/fate/flic-af11-palette-change b/tests/ref/fate/flic-af11-palette-change
deleted file mode 100644
index ac609b8..0000000
--- a/tests/ref/fate/flic-af11-palette-change
+++ /dev/null
@@ -1,116 +0,0 @@
-0, 0, 192000, 0x64da83e8
-0, 2571, 192000, 0xf59ccccc
-0, 5143, 192000, 0xaaa06c5c
-0, 7714, 192000, 0xa98f82c0
-0, 10286, 192000, 0x164fbbdc
-0, 12857, 192000, 0x0b3abc0c
-0, 15429, 192000, 0x47661943
-0, 18000, 192000, 0x30711074
-0, 20571, 192000, 0x67684a84
-0, 23143, 192000, 0x1d9afa70
-0, 25714, 192000, 0x4fd28e78
-0, 28286, 192000, 0x9bc5c8cc
-0, 30857, 192000, 0xcf268b6c
-0, 33429, 192000, 0xdfe65fd4
-0, 36000, 192000, 0x47e75404
-0, 38571, 192000, 0xb3b5b448
-0, 41143, 192000, 0x826c94b4
-0, 43714, 192000, 0x158e95f8
-0, 46286, 192000, 0x576f031f
-0, 48857, 192000, 0xea3399e8
-0, 51429, 192000, 0x76b1e224
-0, 54000, 192000, 0x290073db
-0, 56571, 192000, 0x83741abf
-0, 59143, 192000, 0x50f9c4ec
-0, 61714, 192000, 0x6d8fdac0
-0, 64286, 192000, 0xe26e2600
-0, 66857, 192000, 0xbeb0e11c
-0, 69429, 192000, 0x38282fd4
-0, 72000, 192000, 0x13d0b790
-0, 74571, 192000, 0x0cf8fca9
-0, 77143, 192000, 0x64da83e8
-0, 79714, 192000, 0xf59ccccc
-0, 82286, 192000, 0xaaa06c5c
-0, 84857, 192000, 0xa98f82c0
-0, 87429, 192000, 0x164fbbdc
-0, 90000, 192000, 0x0b3abc0c
-0, 92571, 192000, 0x47661943
-0, 95143, 192000, 0x30711074
-0, 97714, 192000, 0x67684a84
-0, 100286, 192000, 0x1d9afa70
-0, 102857, 192000, 0x4fd28e78
-0, 105429, 192000, 0x9bc5c8cc
-0, 108000, 192000, 0xcf268b6c
-0, 110571, 192000, 0xdfe65fd4
-0, 113143, 192000, 0x47e75404
-0, 115714, 192000, 0xb3b5b448
-0, 118286, 192000, 0x826c94b4
-0, 120857, 192000, 0x158e95f8
-0, 123429, 192000, 0x576f031f
-0, 126000, 192000, 0xea3399e8
-0, 128571, 192000, 0x76b1e224
-0, 131143, 192000, 0x290073db
-0, 133714, 192000, 0x83741abf
-0, 136286, 192000, 0x50f9c4ec
-0, 138857, 192000, 0x6d8fdac0
-0, 141429, 192000, 0xe26e2600
-0, 144000, 192000, 0xbeb0e11c
-0, 146571, 192000, 0x38282fd4
-0, 149143, 192000, 0x13d0b790
-0, 151714, 192000, 0x0cf8fca9
-0, 154286, 192000, 0x64da83e8
-0, 156857, 192000, 0xf59ccccc
-0, 159429, 192000, 0xaaa06c5c
-0, 162000, 192000, 0xa98f82c0
-0, 164571, 192000, 0x164fbbdc
-0, 167143, 192000, 0x0b3abc0c
-0, 169714, 192000, 0x47661943
-0, 172286, 192000, 0x30711074
-0, 174857, 192000, 0x67684a84
-0, 177429, 192000, 0x1d9afa70
-0, 180000, 192000, 0x4fd28e78
-0, 182571, 192000, 0x9bc5c8cc
-0, 185143, 192000, 0xcf268b6c
-0, 187714, 192000, 0xdfe65fd4
-0, 190286, 192000, 0x47e75404
-0, 192857, 192000, 0xb3b5b448
-0, 195429, 192000, 0x826c94b4
-0, 198000, 192000, 0x158e95f8
-0, 200571, 192000, 0x576f031f
-0, 203143, 192000, 0xea3399e8
-0, 205714, 192000, 0x76b1e224
-0, 208286, 192000, 0x290073db
-0, 210857, 192000, 0x83741abf
-0, 213429, 192000, 0x50f9c4ec
-0, 216000, 192000, 0x6d8fdac0
-0, 218571, 192000, 0xe26e2600
-0, 221143, 192000, 0xbeb0e11c
-0, 223714, 192000, 0x38282fd4
-0, 226286, 192000, 0x13d0b790
-0, 228857, 192000, 0x0cf8fca9
-0, 231429, 192000, 0xfcb10883
-0, 234000, 192000, 0xfcb10883
-0, 236571, 192000, 0xd0ba80c4
-0, 239143, 192000, 0xd0ba80c4
-0, 241714, 192000, 0x690520d9
-0, 244286, 192000, 0x690520d9
-0, 246857, 192000, 0x5b621c3f
-0, 249429, 192000, 0x5b621c3f
-0, 252000, 192000, 0x689e231f
-0, 254571, 192000, 0x689e231f
-0, 257143, 192000, 0x20653ff2
-0, 259714, 192000, 0x20653ff2
-0, 262286, 192000, 0xc18b3231
-0, 264857, 192000, 0xc18b3231
-0, 267429, 192000, 0x6d87ec3d
-0, 270000, 192000, 0x6d87ec3d
-0, 272571, 192000, 0x1c5b53d6
-0, 275143, 192000, 0x1c5b53d6
-0, 277714, 192000, 0x152fdf12
-0, 280286, 192000, 0xde187291
-0, 282857, 192000, 0x167617a5
-0, 285429, 192000, 0x5067b8de
-0, 288000, 192000, 0xd02ae54e
-0, 290571, 192000, 0x0d6e9402
-0, 293143, 192000, 0xa8e98616
-0, 295714, 192000, 0x04762d1a
diff --git a/tests/ref/fate/flic-af12 b/tests/ref/fate/flic-af12
deleted file mode 100644
index 4c3c535..0000000
--- a/tests/ref/fate/flic-af12
+++ /dev/null
@@ -1,27 +0,0 @@
-0, 0, 921600, 0x50a87396
-0, 6480, 921600, 0xa6e65d9e
-0, 12960, 921600, 0x05956f62
-0, 19440, 921600, 0xffd6a5d7
-0, 25920, 921600, 0xaab0a179
-0, 32400, 921600, 0x289db2db
-0, 38880, 921600, 0x3d3840cf
-0, 45360, 921600, 0xec0a4142
-0, 51840, 921600, 0x713a9f65
-0, 58320, 921600, 0x28a8f0cd
-0, 64800, 921600, 0x0fd95ba9
-0, 71280, 921600, 0xa744bdfd
-0, 77760, 921600, 0x3cdea2a5
-0, 84240, 921600, 0xe7d671e4
-0, 90720, 921600, 0x75824cdf
-0, 97200, 921600, 0x82067d95
-0, 103680, 921600, 0xee143a4c
-0, 110160, 921600, 0xa53d3f2b
-0, 116640, 921600, 0xb491c0c5
-0, 123120, 921600, 0x6aaaef07
-0, 129600, 921600, 0xad23cca8
-0, 136080, 921600, 0xdce91bd8
-0, 142560, 921600, 0x1a1499bc
-0, 149040, 921600, 0x4cbe505a
-0, 155520, 921600, 0x24006f65
-0, 162000, 921600, 0x0711906e
-0, 168480, 921600, 0x50a87396
diff --git a/tests/ref/fate/flic-magiccarpet b/tests/ref/fate/flic-magiccarpet
deleted file mode 100644
index a7d9ab9..0000000
--- a/tests/ref/fate/flic-magiccarpet
+++ /dev/null
@@ -1,42 +0,0 @@
-0, 0, 192000, 0x00000000
-0, 6429, 192000, 0x9c057d9c
-0, 12857, 192000, 0xab1aacaf
-0, 19286, 192000, 0x49a1dccd
-0, 25714, 192000, 0xebb7e245
-0, 32143, 192000, 0x6287759e
-0, 38571, 192000, 0xbf007410
-0, 45000, 192000, 0x6c72b247
-0, 51429, 192000, 0x4c26a8c3
-0, 57857, 192000, 0x99f06050
-0, 64286, 192000, 0x663f2d23
-0, 70714, 192000, 0x813c3a1f
-0, 77143, 192000, 0x6d6cfbe7
-0, 83571, 192000, 0x7b04163a
-0, 90000, 192000, 0x6792e679
-0, 96429, 192000, 0x939ac626
-0, 102857, 192000, 0xc7a139c0
-0, 109286, 192000, 0xcac7ef0c
-0, 115714, 192000, 0xf4ec59e0
-0, 122143, 192000, 0x56060f59
-0, 128571, 192000, 0xf45ecb3b
-0, 135000, 192000, 0xe7e634ff
-0, 141429, 192000, 0x7ac04aa4
-0, 147857, 192000, 0x4eaba5a1
-0, 154286, 192000, 0x89b84e25
-0, 160714, 192000, 0xc368ec1e
-0, 167143, 192000, 0xeeafb59e
-0, 173571, 192000, 0x0b630619
-0, 180000, 192000, 0x59cb8954
-0, 186429, 192000, 0x16b2875f
-0, 192857, 192000, 0x524e32bd
-0, 199286, 192000, 0x96000ba2
-0, 205714, 192000, 0x18ec28af
-0, 212143, 192000, 0x2609c56c
-0, 218571, 192000, 0xff25bb5a
-0, 225000, 192000, 0xb19a8819
-0, 231429, 192000, 0xa5ff8727
-0, 237857, 192000, 0xe83f6289
-0, 244286, 192000, 0xc6cb4903
-0, 250714, 192000, 0xa4d93eb5
-0, 257143, 192000, 0xec84ef6c
-0, 263571, 192000, 0x00000000
diff --git a/tests/ref/fate/fraps-v0 b/tests/ref/fate/fraps-v0
deleted file mode 100644
index bcf6e2e..0000000
--- a/tests/ref/fate/fraps-v0
+++ /dev/null
@@ -1,20 +0,0 @@
-0, 0, 101088, 0x7bf448f8
-0, 3600, 101088, 0x1ba749ec
-0, 7200, 101088, 0x94eb4dc4
-0, 10800, 101088, 0xd80b4f54
-0, 14400, 101088, 0x6fd44fff
-0, 18000, 101088, 0xf30e4f12
-0, 21600, 101088, 0x67a04fef
-0, 25200, 101088, 0xd92b4f8e
-0, 28800, 101088, 0x92cd4cde
-0, 32400, 101088, 0x93a34973
-0, 36000, 101088, 0x79a646cb
-0, 39600, 101088, 0x5d9c4227
-0, 43200, 101088, 0x239941ff
-0, 46800, 101088, 0x147e11de
-0, 50400, 101088, 0x3943cbd5
-0, 54000, 101088, 0x2ce1c01f
-0, 57600, 101088, 0xe0b7ec06
-0, 61200, 101088, 0xfe5b9baa
-0, 64800, 101088, 0x9acb4d37
-0, 68400, 101088, 0xbdbd9af5
diff --git a/tests/ref/fate/fraps-v1 b/tests/ref/fate/fraps-v1
deleted file mode 100644
index 7d09310..0000000
--- a/tests/ref/fate/fraps-v1
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 230400, 0x6bc891ff
diff --git a/tests/ref/fate/fraps-v2 b/tests/ref/fate/fraps-v2
deleted file mode 100644
index 63a01f2..0000000
--- a/tests/ref/fate/fraps-v2
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 1179648, 0x99f80436
-0, 3000, 1179648, 0x99f80436
-0, 6000, 1179648, 0x99f80436
-0, 9000, 1179648, 0x99f80436
-0, 12000, 1179648, 0x99f80436
-0, 15000, 1179648, 0xe8ae7a30
-0, 18000, 1179648, 0xe8ae7a30
-0, 21000, 1179648, 0xe8ae7a30
-0, 24000, 1179648, 0xe8ae7a30
-0, 27000, 1179648, 0xe8ae7a30
diff --git a/tests/ref/fate/fraps-v3 b/tests/ref/fate/fraps-v3
deleted file mode 100644
index ba66206..0000000
--- a/tests/ref/fate/fraps-v3
+++ /dev/null
@@ -1,9 +0,0 @@
-0, 0, 589824, 0x0b181bbf
-0, 3000, 589824, 0xcd740f79
-0, 6000, 589824, 0x16f8f90e
-0, 9000, 589824, 0x1aaaceba
-0, 12000, 589824, 0x1aaaceba
-0, 15000, 589824, 0x902e8fe4
-0, 18000, 589824, 0x019a4443
-0, 21000, 589824, 0x019a4443
-0, 24000, 589824, 0x04eff6c6
diff --git a/tests/ref/fate/fraps-v4 b/tests/ref/fate/fraps-v4
deleted file mode 100644
index 4c9377e..0000000
--- a/tests/ref/fate/fraps-v4
+++ /dev/null
@@ -1,7 +0,0 @@
-0, 0, 491520, 0x68ff12c0
-0, 3000, 491520, 0x22d36f0d
-0, 6000, 491520, 0xce6f877d
-0, 9000, 491520, 0x85d6744c
-0, 12000, 491520, 0x1aa85794
-0, 15000, 491520, 0x528d1274
-0, 18000, 491520, 0x357ec61c
diff --git a/tests/ref/fate/fraps-v5 b/tests/ref/fate/fraps-v5
deleted file mode 100644
index 3fe1c49..0000000
--- a/tests/ref/fate/fraps-v5
+++ /dev/null
@@ -1,58 +0,0 @@
-0, 0, 145152, 0x8458d4cb
-0, 3000, 145152, 0xa694d7c7
-0, 6000, 145152, 0x2bd4bfc9
-0, 9000, 145152, 0xe53b1616
-0, 12000, 145152, 0x6a0a806a
-0, 15000, 145152, 0x45f7b8e6
-0, 18000, 145152, 0x4e14150e
-0, 21000, 145152, 0xe1cd9b6f
-0, 24000, 145152, 0x5b5802d7
-0, 27000, 145152, 0xb03da5e7
-0, 30000, 145152, 0x3436b06e
-0, 33000, 145152, 0x4535e638
-0, 36000, 145152, 0x72934af1
-0, 39000, 145152, 0xb672d459
-0, 42000, 145152, 0xab57491b
-0, 45000, 145152, 0xdbac3480
-0, 48000, 145152, 0x54215962
-0, 51000, 145152, 0x451f456e
-0, 54000, 145152, 0xa17655d1
-0, 57000, 145152, 0xce95422c
-0, 60000, 145152, 0xe0ee8e77
-0, 63000, 145152, 0xdaabe277
-0, 66000, 145152, 0xc21bb665
-0, 69000, 145152, 0x1e74270e
-0, 72000, 145152, 0xae7bac5f
-0, 75000, 145152, 0xf62442ed
-0, 78000, 145152, 0x5c8d8984
-0, 81000, 145152, 0x97a69fe7
-0, 84000, 145152, 0x1f244d19
-0, 87000, 145152, 0x2758bc25
-0, 90000, 145152, 0xf43ddb89
-0, 93000, 145152, 0x086a524e
-0, 96000, 145152, 0x8b464d4d
-0, 99000, 145152, 0xb77b63d2
-0, 102000, 145152, 0xfd842fa8
-0, 105000, 145152, 0xa98b6dbe
-0, 108000, 145152, 0xdedbab2c
-0, 111000, 145152, 0x24e19172
-0, 114000, 145152, 0x1ef456f6
-0, 117000, 145152, 0xaceabdf0
-0, 120000, 145152, 0xb54de3d9
-0, 123000, 145152, 0x3af0df9b
-0, 126000, 145152, 0xf89fbd9a
-0, 129000, 145152, 0xc6a9673c
-0, 132000, 145152, 0x6d5a929e
-0, 135000, 145152, 0x879e7d9b
-0, 138000, 145152, 0x233c14eb
-0, 141000, 145152, 0x8246f081
-0, 144000, 145152, 0x3366c4bf
-0, 147000, 145152, 0x6b0203da
-0, 150000, 145152, 0x48a00163
-0, 153000, 145152, 0xe956ac2c
-0, 156000, 145152, 0xa2511283
-0, 159000, 145152, 0x7e03222d
-0, 162000, 145152, 0xc31a7a40
-0, 165000, 145152, 0x80448031
-0, 168000, 145152, 0xe3b1fbf7
-0, 171000, 145152, 0xa00395a4
diff --git a/tests/ref/fate/frwu b/tests/ref/fate/frwu
deleted file mode 100644
index 6877b8b..0000000
--- a/tests/ref/fate/frwu
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 153600, 0x050422c0
-0, 6000, 153600, 0x0cf35359
-0, 12000, 153600, 0x2ae95db0
-0, 18000, 153600, 0x8c855b14
-0, 24000, 153600, 0xc7a890b4
-0, 30000, 153600, 0x755bed3b
-0, 36000, 153600, 0x454a4e27
-0, 42000, 153600, 0xdc3eaecb
-0, 48000, 153600, 0x190f9a82
-0, 54000, 153600, 0x4f67511f
diff --git a/tests/ref/fate/funcom-iss b/tests/ref/fate/funcom-iss
deleted file mode 100644
index 341ef24..0000000
--- a/tests/ref/fate/funcom-iss
+++ /dev/null
@@ -1 +0,0 @@
-816ca37c22e42f488fd787e3155e59ff
diff --git a/tests/ref/fate/h264-conformance-aud_mw_e b/tests/ref/fate/h264-conformance-aud_mw_e
deleted file mode 100644
index 202e14e..0000000
--- a/tests/ref/fate/h264-conformance-aud_mw_e
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 38016, 0xa6d63b2e
-0, 3600, 38016, 0x28bae101
-0, 7200, 38016, 0x139f9b29
-0, 10800, 38016, 0xa7b463e8
-0, 14400, 38016, 0xdcdc5130
-0, 18000, 38016, 0x3cf17039
-0, 21600, 38016, 0xdeeb9ae9
-0, 25200, 38016, 0xdc8da889
-0, 28800, 38016, 0x7a32a81c
-0, 32400, 38016, 0xaf15908b
-0, 36000, 38016, 0x4c8b5461
-0, 39600, 38016, 0x1d4826db
-0, 43200, 38016, 0x5ca72731
-0, 46800, 38016, 0xb09732e6
-0, 50400, 38016, 0xa65252eb
-0, 54000, 38016, 0x09fa7644
-0, 57600, 38016, 0x5262af8f
-0, 61200, 38016, 0x50d6c6ac
-0, 64800, 38016, 0x6895c300
-0, 68400, 38016, 0x2d58bf4f
-0, 72000, 38016, 0x50dfc4c0
-0, 75600, 38016, 0x12d2cb90
-0, 79200, 38016, 0xe465c7d7
-0, 82800, 38016, 0x47c5c615
-0, 86400, 38016, 0x76fdc6e6
-0, 90000, 38016, 0xefeec7ae
-0, 93600, 38016, 0x2cebcdf7
-0, 97200, 38016, 0x49abd265
-0, 100800, 38016, 0x157bdfe4
-0, 104400, 38016, 0x3635e5da
-0, 108000, 38016, 0x6263aace
-0, 111600, 38016, 0x7fff72f0
-0, 115200, 38016, 0x83994b85
-0, 118800, 38016, 0xa8c990a7
-0, 122400, 38016, 0xce5204c4
-0, 126000, 38016, 0xf1176131
-0, 129600, 38016, 0x4252bdca
-0, 133200, 38016, 0xd8f447c3
-0, 136800, 38016, 0xc5e79075
-0, 140400, 38016, 0x5291ca60
-0, 144000, 38016, 0x5dffe889
-0, 147600, 38016, 0x6dc4fad6
-0, 151200, 38016, 0xbcc7f16a
-0, 154800, 38016, 0xcd5c059a
-0, 158400, 38016, 0x452314ad
-0, 162000, 38016, 0x19d1fd99
-0, 165600, 38016, 0x93f4ca3c
-0, 169200, 38016, 0x23dd9d81
-0, 172800, 38016, 0x4a4cabdb
-0, 176400, 38016, 0x15a3d785
-0, 180000, 38016, 0xaa34e055
-0, 183600, 38016, 0x8a34b88d
-0, 187200, 38016, 0x1955d649
-0, 190800, 38016, 0xf6dc0782
-0, 194400, 38016, 0x66cb360a
-0, 198000, 38016, 0xf3615cfb
-0, 201600, 38016, 0xca466b6d
-0, 205200, 38016, 0xe0ad3523
-0, 208800, 38016, 0x8181323e
-0, 212400, 38016, 0x93324bab
-0, 216000, 38016, 0xce2c38b6
-0, 219600, 38016, 0xe50a20fc
-0, 223200, 38016, 0x8a74ce30
-0, 226800, 38016, 0x893ca7d8
-0, 230400, 38016, 0x716fd810
-0, 234000, 38016, 0x352aeb3c
-0, 237600, 38016, 0xdf14e4d1
-0, 241200, 38016, 0x7e87dd42
-0, 244800, 38016, 0xe084c706
-0, 248400, 38016, 0x4000ba1f
-0, 252000, 38016, 0x10679f5a
-0, 255600, 38016, 0x5cb686b2
-0, 259200, 38016, 0x5dea8ffe
-0, 262800, 38016, 0x8bd27fc8
-0, 266400, 38016, 0x72912b15
-0, 270000, 38016, 0xb86be965
-0, 273600, 38016, 0x7a42da39
-0, 277200, 38016, 0x9ddacae0
-0, 280800, 38016, 0xb767ff5b
-0, 284400, 38016, 0xa3c64887
-0, 288000, 38016, 0xbc6981f2
-0, 291600, 38016, 0xc2506c22
-0, 295200, 38016, 0x6e785862
-0, 298800, 38016, 0xfade2b2d
-0, 302400, 38016, 0xada1d917
-0, 306000, 38016, 0x459beba1
-0, 309600, 38016, 0x8b491f3c
-0, 313200, 38016, 0x917b0fab
-0, 316800, 38016, 0x053fb1d2
-0, 320400, 38016, 0x96e44e17
-0, 324000, 38016, 0x4d34f7e0
-0, 327600, 38016, 0x2265c386
-0, 331200, 38016, 0xc45dd284
-0, 334800, 38016, 0x0638fca3
-0, 338400, 38016, 0xcd9c2bbc
-0, 342000, 38016, 0x3220dea3
-0, 345600, 38016, 0x72dfb576
-0, 349200, 38016, 0xb804ee86
-0, 352800, 38016, 0xbd516400
-0, 356400, 38016, 0x737fa296
diff --git a/tests/ref/fate/h264-conformance-ba1_ft_c b/tests/ref/fate/h264-conformance-ba1_ft_c
deleted file mode 100644
index e97e05c..0000000
--- a/tests/ref/fate/h264-conformance-ba1_ft_c
+++ /dev/null
@@ -1,299 +0,0 @@
-0, 0, 152064, 0xa6f9b2a8
-0, 3600, 152064, 0x936a8ed6
-0, 7200, 152064, 0xa9f47652
-0, 10800, 152064, 0xf53ea804
-0, 14400, 152064, 0xc951304d
-0, 18000, 152064, 0x59b786b9
-0, 21600, 152064, 0x01b3d9e9
-0, 25200, 152064, 0x94db5883
-0, 28800, 152064, 0xef01ce6c
-0, 32400, 152064, 0x18401484
-0, 36000, 152064, 0xf8773e58
-0, 39600, 152064, 0x09d07ae7
-0, 43200, 152064, 0xbbec5291
-0, 46800, 152064, 0x1ddcbb1e
-0, 50400, 152064, 0x51b257f2
-0, 54000, 152064, 0x2e537d43
-0, 57600, 152064, 0xc4d3c391
-0, 61200, 152064, 0xe6d0ed1c
-0, 64800, 152064, 0x99d81859
-0, 68400, 152064, 0xba1c1693
-0, 72000, 152064, 0x60a22321
-0, 75600, 152064, 0xfe000aee
-0, 79200, 152064, 0x3b056f2d
-0, 82800, 152064, 0xf735caf9
-0, 86400, 152064, 0x81b94a66
-0, 90000, 152064, 0x28ad08af
-0, 93600, 152064, 0x69b316f5
-0, 97200, 152064, 0xa90e6480
-0, 100800, 152064, 0x2600a97a
-0, 104400, 152064, 0x28b1e894
-0, 108000, 152064, 0x8caaeb3c
-0, 111600, 152064, 0xeaa3cd5d
-0, 115200, 152064, 0x2aeab842
-0, 118800, 152064, 0x8781b8fe
-0, 122400, 152064, 0xd5829de5
-0, 126000, 152064, 0xd04489cd
-0, 129600, 152064, 0xfe268158
-0, 133200, 152064, 0x43917137
-0, 136800, 152064, 0x99963053
-0, 140400, 152064, 0xe085087d
-0, 144000, 152064, 0x0344f8d3
-0, 147600, 152064, 0xe353b02a
-0, 151200, 152064, 0x3f84816d
-0, 154800, 152064, 0x3c3a8145
-0, 158400, 152064, 0x478caf10
-0, 162000, 152064, 0xdc879176
-0, 165600, 152064, 0x502f3b81
-0, 169200, 152064, 0x49997d1a
-0, 172800, 152064, 0x6375e30f
-0, 176400, 152064, 0x2abd5994
-0, 180000, 152064, 0xa32a06a0
-0, 183600, 152064, 0x9a2aed47
-0, 187200, 152064, 0x1963fa9d
-0, 190800, 152064, 0xa429cc58
-0, 194400, 152064, 0x8f08abca
-0, 198000, 152064, 0xdabe3408
-0, 201600, 152064, 0x5b94b0f1
-0, 205200, 152064, 0xb2565ba5
-0, 208800, 152064, 0x6eaf3500
-0, 212400, 152064, 0x04d79374
-0, 216000, 152064, 0x0a9281d7
-0, 219600, 152064, 0x97bf672b
-0, 223200, 152064, 0x996d0b1a
-0, 226800, 152064, 0xb5c4d52d
-0, 230400, 152064, 0x8ab3897b
-0, 234000, 152064, 0xd3303ae0
-0, 237600, 152064, 0x2c217280
-0, 241200, 152064, 0xcc21c7ff
-0, 244800, 152064, 0xf9ae50ea
-0, 248400, 152064, 0xa8af67a2
-0, 252000, 152064, 0xba2cbf40
-0, 255600, 152064, 0x80364875
-0, 259200, 152064, 0xe7028c24
-0, 262800, 152064, 0x6730636d
-0, 266400, 152064, 0xd5d9bf5f
-0, 270000, 152064, 0x2ec4cf74
-0, 273600, 152064, 0x47c0e7ec
-0, 277200, 152064, 0x0e1741fb
-0, 280800, 152064, 0x4b39d9b6
-0, 284400, 152064, 0x30737f2e
-0, 288000, 152064, 0xce133061
-0, 291600, 152064, 0x3b7ce6b9
-0, 295200, 152064, 0x5b11d100
-0, 298800, 152064, 0x8bd801ca
-0, 302400, 152064, 0x5d322cf6
-0, 306000, 152064, 0xdd47a0a3
-0, 309600, 152064, 0x0e3b3c60
-0, 313200, 152064, 0x8b69ac27
-0, 316800, 152064, 0xef66b267
-0, 320400, 152064, 0x29140655
-0, 324000, 152064, 0x25f6ae5c
-0, 327600, 152064, 0xc1a48b89
-0, 331200, 152064, 0xc3eee9e4
-0, 334800, 152064, 0xec23534a
-0, 338400, 152064, 0x9eed2a2e
-0, 342000, 152064, 0x7e5de8e7
-0, 345600, 152064, 0x8d824e10
-0, 349200, 152064, 0x841ebdc5
-0, 352800, 152064, 0x9bc03542
-0, 356400, 152064, 0xd77d5b14
-0, 360000, 152064, 0x2b4597ed
-0, 363600, 152064, 0xf460a0c5
-0, 367200, 152064, 0x01f58bf9
-0, 370800, 152064, 0xa5cb8dd9
-0, 374400, 152064, 0x12e49e6f
-0, 378000, 152064, 0x6aaac311
-0, 381600, 152064, 0x0ff1d37a
-0, 385200, 152064, 0x0e5ca8ce
-0, 388800, 152064, 0x997c3a1f
-0, 392400, 152064, 0x83c1d64e
-0, 396000, 152064, 0xed2379a3
-0, 399600, 152064, 0xe6b83696
-0, 403200, 152064, 0x1a7c1864
-0, 406800, 152064, 0xb0bcf08e
-0, 410400, 152064, 0x74deb96f
-0, 414000, 152064, 0xe86a9396
-0, 417600, 152064, 0xf78a916b
-0, 421200, 152064, 0x8d35a888
-0, 424800, 152064, 0xb01a956d
-0, 428400, 152064, 0xc8d37b7d
-0, 432000, 152064, 0x903251c9
-0, 435600, 152064, 0x93b819ac
-0, 439200, 152064, 0xb949f48f
-0, 442800, 152064, 0x7dbfeaba
-0, 446400, 152064, 0x951903ae
-0, 450000, 152064, 0x05742b8e
-0, 453600, 152064, 0xb270514a
-0, 457200, 152064, 0xf729867a
-0, 460800, 152064, 0x7e05f652
-0, 464400, 152064, 0x32a99f23
-0, 468000, 152064, 0x57e7394b
-0, 471600, 152064, 0xc0ffc453
-0, 475200, 152064, 0x7b1e79fa
-0, 478800, 152064, 0x90ee1d52
-0, 482400, 152064, 0xaed672a8
-0, 486000, 152064, 0xa253ccc4
-0, 489600, 152064, 0x2d0807f9
-0, 493200, 152064, 0xdc7ec4cc
-0, 496800, 152064, 0x3c624e2e
-0, 500400, 152064, 0xfa4a91dd
-0, 504000, 152064, 0xcaa83992
-0, 507600, 152064, 0x81e5c52d
-0, 511200, 152064, 0x46ab76f8
-0, 514800, 152064, 0x4ab115d8
-0, 518400, 152064, 0x65d8c9d7
-0, 522000, 152064, 0xcb1e16b1
-0, 525600, 152064, 0xb766c029
-0, 529200, 152064, 0x2a49c7c0
-0, 532800, 152064, 0x37f35440
-0, 536400, 152064, 0x33b4940f
-0, 540000, 152064, 0x6b22fb9a
-0, 543600, 152064, 0x785e138a
-0, 547200, 152064, 0xc7a1954a
-0, 550800, 152064, 0x6f325026
-0, 554400, 152064, 0x23d6bf8d
-0, 558000, 152064, 0x8e6f5815
-0, 561600, 152064, 0x434c4770
-0, 565200, 152064, 0x22319908
-0, 568800, 152064, 0xec368ac8
-0, 572400, 152064, 0xc69d7306
-0, 576000, 152064, 0xc10ab1c8
-0, 579600, 152064, 0x2497f329
-0, 583200, 152064, 0x95782b50
-0, 586800, 152064, 0xe0481c57
-0, 590400, 152064, 0xa656f1e6
-0, 594000, 152064, 0x562da8a1
-0, 597600, 152064, 0x21716296
-0, 601200, 152064, 0xb1ffd9de
-0, 604800, 152064, 0x49204932
-0, 608400, 152064, 0x88e1ac93
-0, 612000, 152064, 0x6abb5dfb
-0, 615600, 152064, 0xacdede42
-0, 619200, 152064, 0xca28f448
-0, 622800, 152064, 0x6b7e5e84
-0, 626400, 152064, 0x464d4b58
-0, 630000, 152064, 0xd39620f1
-0, 633600, 152064, 0x67336772
-0, 637200, 152064, 0x6de386c2
-0, 640800, 152064, 0x6d8fbc97
-0, 644400, 152064, 0x09fbc88d
-0, 648000, 152064, 0x08dfa188
-0, 651600, 152064, 0xf3461401
-0, 655200, 152064, 0xdd6d1ce5
-0, 658800, 152064, 0x90182ee8
-0, 662400, 152064, 0xcb7cf9a2
-0, 666000, 152064, 0x237e59bd
-0, 669600, 152064, 0xf2efa664
-0, 673200, 152064, 0x6565d69b
-0, 676800, 152064, 0x321ce6e5
-0, 680400, 152064, 0xc7035cb7
-0, 684000, 152064, 0xbfcf2ecc
-0, 687600, 152064, 0x8a2eb353
-0, 691200, 152064, 0x5224b608
-0, 694800, 152064, 0xc0c51491
-0, 698400, 152064, 0xdeadac32
-0, 702000, 152064, 0x8ffd15fe
-0, 705600, 152064, 0x6a7fda8c
-0, 709200, 152064, 0x32ae6c5a
-0, 712800, 152064, 0x9668d580
-0, 716400, 152064, 0xb10325d6
-0, 720000, 152064, 0x1cfa4e12
-0, 723600, 152064, 0x87cb2dc6
-0, 727200, 152064, 0x03636041
-0, 730800, 152064, 0x266df3d6
-0, 734400, 152064, 0x48cd5b1b
-0, 738000, 152064, 0xf42e4dde
-0, 741600, 152064, 0x63b21de2
-0, 745200, 152064, 0xef377b16
-0, 748800, 152064, 0x540a3c21
-0, 752400, 152064, 0xbc7576a4
-0, 756000, 152064, 0x38508049
-0, 759600, 152064, 0x5c120e6f
-0, 763200, 152064, 0x5f7dae8a
-0, 766800, 152064, 0x84632e15
-0, 770400, 152064, 0xe6200a58
-0, 774000, 152064, 0xeef9c63d
-0, 777600, 152064, 0xe5c60794
-0, 781200, 152064, 0x387849c9
-0, 784800, 152064, 0x165744e6
-0, 788400, 152064, 0xdc9cce84
-0, 792000, 152064, 0xea3604e0
-0, 795600, 152064, 0xaf9f5a76
-0, 799200, 152064, 0x05ee7254
-0, 802800, 152064, 0x62ed20cf
-0, 806400, 152064, 0x6e038a86
-0, 810000, 152064, 0xc782f21c
-0, 813600, 152064, 0x9d214e66
-0, 817200, 152064, 0xd33ad489
-0, 820800, 152064, 0x5b04dd7a
-0, 824400, 152064, 0xaf9a865d
-0, 828000, 152064, 0x9eb4912a
-0, 831600, 152064, 0x677628d8
-0, 835200, 152064, 0x0b15e1b6
-0, 838800, 152064, 0xda66848a
-0, 842400, 152064, 0xd29a27a8
-0, 846000, 152064, 0x2d74c6a2
-0, 849600, 152064, 0xafa69b91
-0, 853200, 152064, 0xf065a24b
-0, 856800, 152064, 0xe9d5fe63
-0, 860400, 152064, 0xe0428668
-0, 864000, 152064, 0x2cfe6235
-0, 867600, 152064, 0x6506229d
-0, 871200, 152064, 0xc8cddb6b
-0, 874800, 152064, 0x1b827b12
-0, 878400, 152064, 0x366af54b
-0, 882000, 152064, 0x810b5998
-0, 885600, 152064, 0x40d8d09e
-0, 889200, 152064, 0xf5bd32c5
-0, 892800, 152064, 0xb7af7607
-0, 896400, 152064, 0x005ac53b
-0, 900000, 152064, 0x1a28f754
-0, 903600, 152064, 0x8e15108e
-0, 907200, 152064, 0xb40515ec
-0, 910800, 152064, 0x43a30620
-0, 914400, 152064, 0x000beec8
-0, 918000, 152064, 0x1f6e9253
-0, 921600, 152064, 0x14695f50
-0, 925200, 152064, 0x056359d6
-0, 928800, 152064, 0xdc4360e5
-0, 932400, 152064, 0x3716abb2
-0, 936000, 152064, 0xee1cff6a
-0, 939600, 152064, 0x7b251ba9
-0, 943200, 152064, 0xe4f81d2e
-0, 946800, 152064, 0x01411136
-0, 950400, 152064, 0xcff2f30a
-0, 954000, 152064, 0xc8bcd80d
-0, 957600, 152064, 0x94e8a397
-0, 961200, 152064, 0x6fd071c8
-0, 964800, 152064, 0xb6145d60
-0, 968400, 152064, 0x593f5f70
-0, 972000, 152064, 0xb5133bb7
-0, 975600, 152064, 0x40ad1ae8
-0, 979200, 152064, 0xedfc0faa
-0, 982800, 152064, 0xa2ab0578
-0, 986400, 152064, 0x3038fb4f
-0, 990000, 152064, 0xdf10fb53
-0, 993600, 152064, 0x6b63ff01
-0, 997200, 152064, 0xb34af6cd
-0, 1000800, 152064, 0xc7e9cfb0
-0, 1004400, 152064, 0x22ffb57c
-0, 1008000, 152064, 0xf429b3eb
-0, 1011600, 152064, 0x3861e0db
-0, 1015200, 152064, 0x166321b7
-0, 1018800, 152064, 0x3058744c
-0, 1022400, 152064, 0x6e1dc37a
-0, 1026000, 152064, 0xef2aee63
-0, 1029600, 152064, 0x1a9c3957
-0, 1033200, 152064, 0x93807ed4
-0, 1036800, 152064, 0x117fcbe1
-0, 1040400, 152064, 0x80502017
-0, 1044000, 152064, 0xba5a3dac
-0, 1047600, 152064, 0x157764f1
-0, 1051200, 152064, 0xc7577daf
-0, 1054800, 152064, 0xe9e8ae69
-0, 1058400, 152064, 0x04f9ddac
-0, 1062000, 152064, 0x90441226
-0, 1065600, 152064, 0xaa594ed2
-0, 1069200, 152064, 0x59258b49
-0, 1072800, 152064, 0x13ec85c6
diff --git a/tests/ref/fate/h264-conformance-ba1_sony_d b/tests/ref/fate/h264-conformance-ba1_sony_d
deleted file mode 100644
index 9eefa53..0000000
--- a/tests/ref/fate/h264-conformance-ba1_sony_d
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x99e1fe60
-0, 7200, 38016, 0x65eace24
-0, 10800, 38016, 0xb2b0a513
-0, 14400, 38016, 0x8af47c64
-0, 18000, 38016, 0xa56670c6
-0, 21600, 38016, 0x11d45ac9
-0, 25200, 38016, 0xcd4e4f18
-0, 28800, 38016, 0x399934b2
-0, 32400, 38016, 0xedd23f7b
-0, 36000, 38016, 0x38c350b9
-0, 39600, 38016, 0xdd937244
-0, 43200, 38016, 0x39c67be6
-0, 46800, 38016, 0xabb7a34d
-0, 50400, 38016, 0x535d971f
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0xfddda183
diff --git a/tests/ref/fate/h264-conformance-ba2_sony_f b/tests/ref/fate/h264-conformance-ba2_sony_f
deleted file mode 100644
index 126b6e6..0000000
--- a/tests/ref/fate/h264-conformance-ba2_sony_f
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x47b90d4b
-0, 7200, 38016, 0x3e99dfcf
-0, 10800, 38016, 0xeb18bb85
-0, 14400, 38016, 0xcf1e9658
-0, 18000, 38016, 0xf01b7bf1
-0, 21600, 38016, 0x92e06ac5
-0, 25200, 38016, 0x8ae35c1f
-0, 28800, 38016, 0x4bda52c8
-0, 32400, 38016, 0xbffe59e5
-0, 36000, 38016, 0x56c96cad
-0, 39600, 38016, 0x8a278da1
-0, 43200, 38016, 0xce6f97d6
-0, 46800, 38016, 0x69edad2e
-0, 50400, 38016, 0x5134a67c
-0, 54000, 38016, 0x1abfb2a1
-0, 57600, 38016, 0x4a37b185
-0, 61200, 38016, 0x5270a90e
-0, 64800, 38016, 0xe28f9d5d
-0, 68400, 38016, 0x3fcc87b0
-0, 72000, 38016, 0x719e6605
-0, 75600, 38016, 0x8b824ca3
-0, 79200, 38016, 0x5f6a3544
-0, 82800, 38016, 0x2ecd2ada
-0, 86400, 38016, 0x5d4f3055
-0, 90000, 38016, 0xc54441d3
-0, 93600, 38016, 0x93f83f2c
-0, 97200, 38016, 0xaa4d46a8
-0, 100800, 38016, 0x7ca45c1f
-0, 104400, 38016, 0x59de7854
-0, 108000, 38016, 0xc8f98709
-0, 111600, 38016, 0x9a199eeb
-0, 115200, 38016, 0xfd82b785
-0, 118800, 38016, 0x319fd17f
-0, 122400, 38016, 0xc6ebd362
-0, 126000, 38016, 0xbd60d5dc
-0, 129600, 38016, 0x6e27d260
-0, 133200, 38016, 0x96b7cf93
-0, 136800, 38016, 0x6787cbcf
-0, 140400, 38016, 0x48dacd76
-0, 144000, 38016, 0xbef1d08e
-0, 147600, 38016, 0xbb1bd9a4
-0, 151200, 38016, 0xa420d63b
-0, 154800, 38016, 0xfa26d0ab
-0, 158400, 38016, 0xa349d2e0
-0, 162000, 38016, 0x9946ce09
-0, 165600, 38016, 0xb101cabe
-0, 169200, 38016, 0x9e18c6b2
-0, 172800, 38016, 0xe7cccbd9
-0, 176400, 38016, 0x1067d145
-0, 180000, 38016, 0xae13cd75
-0, 183600, 38016, 0x8e06cce5
-0, 187200, 38016, 0x0b3dcbf8
-0, 190800, 38016, 0xc6cbcfbe
-0, 194400, 38016, 0x1eced2f7
-0, 198000, 38016, 0x5d72da04
-0, 201600, 38016, 0x0643e191
-0, 205200, 38016, 0x3cace7f7
-0, 208800, 38016, 0x5e31f1f0
-0, 212400, 38016, 0x04d1ef46
-0, 216000, 38016, 0xffdbe794
-0, 219600, 38016, 0x106ad275
-0, 223200, 38016, 0x5c64a147
-0, 226800, 38016, 0xb7676212
-0, 230400, 38016, 0x86ea653e
-0, 234000, 38016, 0xabb48937
-0, 237600, 38016, 0x6b1cadc4
-0, 241200, 38016, 0xa4eaf34b
-0, 244800, 38016, 0x4174280f
-0, 248400, 38016, 0xfe845818
-0, 252000, 38016, 0xc64a838e
-0, 255600, 38016, 0x5e24aaf0
-0, 259200, 38016, 0x8bffd9d8
-0, 262800, 38016, 0x00d912c9
-0, 266400, 38016, 0x0dba50f0
-0, 270000, 38016, 0x80958628
-0, 273600, 38016, 0x4e81a356
-0, 277200, 38016, 0x121dc289
-0, 280800, 38016, 0x4885de6f
-0, 284400, 38016, 0x5329e4f9
-0, 288000, 38016, 0xa129ef6b
-0, 291600, 38016, 0x3ea6fd46
-0, 295200, 38016, 0x9a68fbb4
-0, 298800, 38016, 0xea1dffdd
-0, 302400, 38016, 0x7bf9f719
-0, 306000, 38016, 0x9aa5ff2a
-0, 309600, 38016, 0xf050fe90
-0, 313200, 38016, 0xb6f50938
-0, 316800, 38016, 0xbe900b57
-0, 320400, 38016, 0x27b90a6b
-0, 324000, 38016, 0xe87bf703
-0, 327600, 38016, 0xaf0fdbe1
-0, 331200, 38016, 0x3f2cc304
-0, 334800, 38016, 0x0114b42f
-0, 338400, 38016, 0x7f739915
-0, 342000, 38016, 0xcc3da414
-0, 345600, 38016, 0x57e2afe8
-0, 349200, 38016, 0x59b6bdc5
-0, 352800, 38016, 0xb3eacf6a
-0, 356400, 38016, 0xa10ddcd8
-0, 360000, 38016, 0xae05e697
-0, 363600, 38016, 0x8cb9d81c
-0, 367200, 38016, 0x5d5cc3b1
-0, 370800, 38016, 0x8f89c0c0
-0, 374400, 38016, 0x593cda26
-0, 378000, 38016, 0xd5d1f2fc
-0, 381600, 38016, 0x2586ff00
-0, 385200, 38016, 0x1c2613f0
-0, 388800, 38016, 0x236133bd
-0, 392400, 38016, 0x92c5439b
-0, 396000, 38016, 0xd1145724
-0, 399600, 38016, 0xf2fa5c12
-0, 403200, 38016, 0x810d5f50
-0, 406800, 38016, 0x196f4470
-0, 410400, 38016, 0xcba71d6b
-0, 414000, 38016, 0x58ab17b0
-0, 417600, 38016, 0x4a96278d
-0, 421200, 38016, 0x4afe2f7d
-0, 424800, 38016, 0xe1ca3d55
-0, 428400, 38016, 0x4f6844ab
-0, 432000, 38016, 0x7ad24bc5
-0, 435600, 38016, 0x068c49f0
-0, 439200, 38016, 0x23b92dae
-0, 442800, 38016, 0x0e9a0793
-0, 446400, 38016, 0xc1d2dd4a
-0, 450000, 38016, 0x1b5cbc00
-0, 453600, 38016, 0xa951b88d
-0, 457200, 38016, 0x8b4ac1df
-0, 460800, 38016, 0x91d3d98d
-0, 464400, 38016, 0xa42aeb49
-0, 468000, 38016, 0x21b5f1f6
-0, 471600, 38016, 0xd632f07f
-0, 475200, 38016, 0x6566ec26
-0, 478800, 38016, 0x03f4ee70
-0, 482400, 38016, 0x62b6e999
-0, 486000, 38016, 0xfd1de6fb
-0, 489600, 38016, 0xb07bdc79
-0, 493200, 38016, 0xace9d441
-0, 496800, 38016, 0x7d98c788
-0, 500400, 38016, 0x3c7dbae4
-0, 504000, 38016, 0x6e85b20f
-0, 507600, 38016, 0x86a5a6bc
-0, 511200, 38016, 0xacbe93ca
-0, 514800, 38016, 0x8e438bde
-0, 518400, 38016, 0x88b4963d
-0, 522000, 38016, 0x86119504
-0, 525600, 38016, 0x0ccc8932
-0, 529200, 38016, 0x69a45f01
-0, 532800, 38016, 0x8f173148
-0, 536400, 38016, 0x1e320daf
-0, 540000, 38016, 0x3957e834
-0, 543600, 38016, 0x57c1dcee
-0, 547200, 38016, 0x2a9edf52
-0, 550800, 38016, 0x116ed4bc
-0, 554400, 38016, 0x81cfc686
-0, 558000, 38016, 0x6685db47
-0, 561600, 38016, 0xab79fd2f
-0, 565200, 38016, 0x65201bdd
-0, 568800, 38016, 0x06e64eb6
-0, 572400, 38016, 0xbcb77ac0
-0, 576000, 38016, 0x65679028
-0, 579600, 38016, 0xf33e837e
-0, 583200, 38016, 0xa77d7b6c
-0, 586800, 38016, 0x0e7b64f6
-0, 590400, 38016, 0x2d1f597c
-0, 594000, 38016, 0x1b6748a1
-0, 597600, 38016, 0x12a91f4f
-0, 601200, 38016, 0xc09df3ee
-0, 604800, 38016, 0x1b9dcd6f
-0, 608400, 38016, 0xf3c2bce4
-0, 612000, 38016, 0xfe05d34b
-0, 615600, 38016, 0x421deb25
-0, 619200, 38016, 0x0f8d0725
-0, 622800, 38016, 0xa03d0a3d
-0, 626400, 38016, 0xe00cf88f
-0, 630000, 38016, 0xa55abfdf
-0, 633600, 38016, 0x11618891
-0, 637200, 38016, 0x45835caf
-0, 640800, 38016, 0x7be63a3b
-0, 644400, 38016, 0x1ebb2104
-0, 648000, 38016, 0x055b0b26
-0, 651600, 38016, 0x076ef47e
-0, 655200, 38016, 0xa828e6e1
-0, 658800, 38016, 0x0de5eb60
-0, 662400, 38016, 0x5238f229
-0, 666000, 38016, 0x332cff7c
-0, 669600, 38016, 0x74072063
-0, 673200, 38016, 0x1e623ceb
-0, 676800, 38016, 0xad2448c9
-0, 680400, 38016, 0x32065043
-0, 684000, 38016, 0x2e7ff976
-0, 687600, 38016, 0xf1a8c805
-0, 691200, 38016, 0x3f64d1cc
-0, 694800, 38016, 0xc855efbd
-0, 698400, 38016, 0x152b0fed
-0, 702000, 38016, 0x43335881
-0, 705600, 38016, 0xec5c7979
-0, 709200, 38016, 0x150e9488
-0, 712800, 38016, 0x1a63b67a
-0, 716400, 38016, 0x24a4cca6
-0, 720000, 38016, 0x3838dba2
-0, 723600, 38016, 0xef1bec71
-0, 727200, 38016, 0x0478f12a
-0, 730800, 38016, 0x478fee17
-0, 734400, 38016, 0x1d09f0ac
-0, 738000, 38016, 0x3daef591
-0, 741600, 38016, 0xf7f3033c
-0, 745200, 38016, 0xfb09faa0
-0, 748800, 38016, 0xd87de6c9
-0, 752400, 38016, 0xbd99d6bc
-0, 756000, 38016, 0x87d8bd7d
-0, 759600, 38016, 0xf244b18a
-0, 763200, 38016, 0x3a34a2da
-0, 766800, 38016, 0x25739701
-0, 770400, 38016, 0x346b8b9a
-0, 774000, 38016, 0xc67379ec
-0, 777600, 38016, 0xbd30780d
-0, 781200, 38016, 0xc5197c2b
-0, 784800, 38016, 0xd5ce73e8
-0, 788400, 38016, 0x63ce72d1
-0, 792000, 38016, 0x140d688d
-0, 795600, 38016, 0x027158aa
-0, 799200, 38016, 0x90884ce3
-0, 802800, 38016, 0x4faa38c5
-0, 806400, 38016, 0x78693f54
-0, 810000, 38016, 0xe1fa41c1
-0, 813600, 38016, 0x9b524771
-0, 817200, 38016, 0xbb3056c8
-0, 820800, 38016, 0xa93b67df
-0, 824400, 38016, 0xe661909f
-0, 828000, 38016, 0x55a0af6d
-0, 831600, 38016, 0xa5f6d0a8
-0, 835200, 38016, 0xa44300f8
-0, 838800, 38016, 0xc7cc265e
-0, 842400, 38016, 0xe7384598
-0, 846000, 38016, 0x77e4589a
-0, 849600, 38016, 0x073c7054
-0, 853200, 38016, 0xe50e6ea8
-0, 856800, 38016, 0xcedf518f
-0, 860400, 38016, 0x8674266b
-0, 864000, 38016, 0x360e0517
-0, 867600, 38016, 0x19acdb3a
-0, 871200, 38016, 0xd029d91b
-0, 874800, 38016, 0x3101277f
-0, 878400, 38016, 0x3a919153
-0, 882000, 38016, 0x0646ffaf
-0, 885600, 38016, 0xffdd13a5
-0, 889200, 38016, 0x13e2e641
-0, 892800, 38016, 0xc6f6a13b
-0, 896400, 38016, 0x984f2ecd
-0, 900000, 38016, 0xafaec63a
-0, 903600, 38016, 0x9025817a
-0, 907200, 38016, 0x20d574d7
-0, 910800, 38016, 0x72eacc49
-0, 914400, 38016, 0x6297335a
-0, 918000, 38016, 0xc69adba1
-0, 921600, 38016, 0x7852d515
-0, 925200, 38016, 0x0e846003
-0, 928800, 38016, 0xeb294c5e
-0, 932400, 38016, 0x0913448f
-0, 936000, 38016, 0xea2c4fc1
-0, 939600, 38016, 0xb8165b3f
-0, 943200, 38016, 0x5f596c9d
-0, 946800, 38016, 0x3a1370d1
-0, 950400, 38016, 0x25dd6a9a
-0, 954000, 38016, 0x70075f7a
-0, 957600, 38016, 0xaf6749f0
-0, 961200, 38016, 0xd5c22d02
-0, 964800, 38016, 0xf6e80af2
-0, 968400, 38016, 0x42d1dcf7
-0, 972000, 38016, 0x232cb536
-0, 975600, 38016, 0x7c848ebf
-0, 979200, 38016, 0x4c756c28
-0, 982800, 38016, 0x720e1f07
-0, 986400, 38016, 0x2385ccb2
-0, 990000, 38016, 0xcd97bf76
-0, 993600, 38016, 0xebcad10b
-0, 997200, 38016, 0xbed8ceeb
-0, 1000800, 38016, 0x660ffaf8
-0, 1004400, 38016, 0x6a1662a9
-0, 1008000, 38016, 0x71f20775
-0, 1011600, 38016, 0x597ecf26
-0, 1015200, 38016, 0x7a81a050
-0, 1018800, 38016, 0x05f6676a
-0, 1022400, 38016, 0xd0065042
-0, 1026000, 38016, 0x17ca9cd9
-0, 1029600, 38016, 0x76956633
-0, 1033200, 38016, 0x9211a2b0
-0, 1036800, 38016, 0xc134b304
-0, 1040400, 38016, 0xdaca9260
-0, 1044000, 38016, 0x10252d19
-0, 1047600, 38016, 0xf52a44af
-0, 1051200, 38016, 0x4053d2d1
-0, 1054800, 38016, 0x165e0bed
-0, 1058400, 38016, 0x577352d0
-0, 1062000, 38016, 0xf9564a09
-0, 1065600, 38016, 0x78a8295f
-0, 1069200, 38016, 0xb2d7182a
-0, 1072800, 38016, 0x9a0c2487
-0, 1076400, 38016, 0x1b044efa
diff --git a/tests/ref/fate/h264-conformance-ba3_sva_c b/tests/ref/fate/h264-conformance-ba3_sva_c
deleted file mode 100644
index 2b36542..0000000
--- a/tests/ref/fate/h264-conformance-ba3_sva_c
+++ /dev/null
@@ -1,33 +0,0 @@
-0, 0, 38016, 0xbf5f1df5
-0, 3600, 38016, 0x8de61f39
-0, 7200, 38016, 0xaeec0a18
-0, 10800, 38016, 0x386c2599
-0, 14400, 38016, 0x8fcf2df0
-0, 18000, 38016, 0x34fe57ec
-0, 21600, 38016, 0x7e6c5e1a
-0, 25200, 38016, 0x8f319659
-0, 28800, 38016, 0x1e1291e2
-0, 32400, 38016, 0x97e9bf55
-0, 36000, 38016, 0x35bcad1a
-0, 39600, 38016, 0xea39d354
-0, 43200, 38016, 0xca7db081
-0, 46800, 38016, 0x2c069b6c
-0, 50400, 38016, 0x32f86a99
-0, 54000, 38016, 0xb4019668
-0, 57600, 38016, 0x04038324
-0, 61200, 38016, 0xe4f0b032
-0, 64800, 38016, 0xe6119a63
-0, 68400, 38016, 0xdf17b9fa
-0, 72000, 38016, 0xe199a348
-0, 75600, 38016, 0x6704b749
-0, 79200, 38016, 0x33fc7592
-0, 82800, 38016, 0xc0c371b2
-0, 86400, 38016, 0x017628aa
-0, 90000, 38016, 0xa46b3ab5
-0, 93600, 38016, 0x216f1fdb
-0, 97200, 38016, 0x28c54669
-0, 100800, 38016, 0x070c4ac1
-0, 104400, 38016, 0x4d4c6765
-0, 108000, 38016, 0xb496626c
-0, 111600, 38016, 0x9f767057
-0, 115200, 38016, 0xe2bc4de1
diff --git a/tests/ref/fate/h264-conformance-ba_mw_d b/tests/ref/fate/h264-conformance-ba_mw_d
deleted file mode 100644
index b5fbd69..0000000
--- a/tests/ref/fate/h264-conformance-ba_mw_d
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0x393097f9
-0, 10800, 38016, 0x8fb56676
-0, 14400, 38016, 0x39d64fd2
-0, 18000, 38016, 0x7fad729a
-0, 21600, 38016, 0x7e25955f
-0, 25200, 38016, 0xc4d9a359
-0, 28800, 38016, 0x30afaca4
-0, 32400, 38016, 0x9ee195ea
-0, 36000, 38016, 0x09f65805
-0, 39600, 38016, 0x58d126ab
-0, 43200, 38016, 0x4f29282c
-0, 46800, 38016, 0x8af235a1
-0, 50400, 38016, 0x6dfe525a
-0, 54000, 38016, 0xd51c793f
-0, 57600, 38016, 0x4e90abba
-0, 61200, 38016, 0xe706c5b7
-0, 64800, 38016, 0x35fab7ef
-0, 68400, 38016, 0xed78b8fc
-0, 72000, 38016, 0x2907bb4e
-0, 75600, 38016, 0x1749bb47
-0, 79200, 38016, 0x284ec688
-0, 82800, 38016, 0x534abc24
-0, 86400, 38016, 0xcd01bd13
-0, 90000, 38016, 0xe97bbd51
-0, 93600, 38016, 0xac1cb9e9
-0, 97200, 38016, 0xd861c0a3
-0, 100800, 38016, 0xf0f1ced4
-0, 104400, 38016, 0xa9e8d2bf
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0xe2eb6bde
-0, 115200, 38016, 0x92eb44a1
-0, 118800, 38016, 0x376b8919
-0, 122400, 38016, 0x291bfdd9
-0, 126000, 38016, 0xed0c60a0
-0, 129600, 38016, 0xf505b70d
-0, 133200, 38016, 0x26b33a9b
-0, 136800, 38016, 0xc9269664
-0, 140400, 38016, 0xe21dc61e
-0, 144000, 38016, 0xe88fe653
-0, 147600, 38016, 0xd4cff39c
-0, 151200, 38016, 0x02bdecdf
-0, 154800, 38016, 0xec48fc13
-0, 158400, 38016, 0x363f071c
-0, 162000, 38016, 0x7fcbf2fd
-0, 165600, 38016, 0xc3d1c265
-0, 169200, 38016, 0x818a94e9
-0, 172800, 38016, 0x30b5a52f
-0, 176400, 38016, 0x7a1acd17
-0, 180000, 38016, 0xb5a6dc91
-0, 183600, 38016, 0x7d39b673
-0, 187200, 38016, 0x341ad3f9
-0, 190800, 38016, 0x264cff5f
-0, 194400, 38016, 0x613a445b
-0, 198000, 38016, 0x42a55cd6
-0, 201600, 38016, 0xe84f6a39
-0, 205200, 38016, 0xd8e93151
-0, 208800, 38016, 0xc7333ac4
-0, 212400, 38016, 0xa08a4b2c
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0x88bf1883
-0, 223200, 38016, 0x0043c104
-0, 226800, 38016, 0xa9d6a35d
-0, 230400, 38016, 0x01dec5af
-0, 234000, 38016, 0x673cdf0e
-0, 237600, 38016, 0xc8d0ce67
-0, 241200, 38016, 0xcac2d0bd
-0, 244800, 38016, 0x8575c7b9
-0, 248400, 38016, 0x71c1b4f4
-0, 252000, 38016, 0x2affa1d4
-0, 255600, 38016, 0xae947cfd
-0, 259200, 38016, 0x48b2821d
-0, 262800, 38016, 0x1c5d77f4
-0, 266400, 38016, 0x3625233b
-0, 270000, 38016, 0xcfc8e3ff
-0, 273600, 38016, 0x6d04cfa5
-0, 277200, 38016, 0x2c4ec463
-0, 280800, 38016, 0x72b1ea07
-0, 284400, 38016, 0x448d3996
-0, 288000, 38016, 0x89256b87
-0, 291600, 38016, 0x69af5fea
-0, 295200, 38016, 0x908f46b0
-0, 298800, 38016, 0x56e11a8b
-0, 302400, 38016, 0x7fd4c5f5
-0, 306000, 38016, 0x560bd701
-0, 309600, 38016, 0x71570820
-0, 313200, 38016, 0x11b20b14
-0, 316800, 38016, 0xa3fd9f19
-0, 320400, 38016, 0x4a564d33
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0xf853a971
-0, 331200, 38016, 0xb136bf89
-0, 334800, 38016, 0xb686e8c3
-0, 338400, 38016, 0x8afc1a4c
-0, 342000, 38016, 0xa24adb65
-0, 345600, 38016, 0xd951ae27
-0, 349200, 38016, 0xa731f04e
-0, 352800, 38016, 0xabd65795
-0, 356400, 38016, 0x46bc95e1
diff --git a/tests/ref/fate/h264-conformance-bamq1_jvc_c b/tests/ref/fate/h264-conformance-bamq1_jvc_c
deleted file mode 100644
index 11f4352..0000000
--- a/tests/ref/fate/h264-conformance-bamq1_jvc_c
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 38016, 0x6951213f
-0, 3600, 38016, 0x82ddf39d
-0, 7200, 38016, 0x3f81c6b1
-0, 10800, 38016, 0x55149f23
-0, 14400, 38016, 0x366a74e1
-0, 18000, 38016, 0xe6f465cf
-0, 21600, 38016, 0x14fd4999
-0, 25200, 38016, 0x49273f0f
-0, 28800, 38016, 0xa20a2ebe
-0, 32400, 38016, 0x701b32a4
-0, 36000, 38016, 0x8a394066
-0, 39600, 38016, 0xe9b766a6
-0, 43200, 38016, 0x4e7f766d
-0, 46800, 38016, 0x2c159585
-0, 50400, 38016, 0x31b38c2b
-0, 54000, 38016, 0xde58937f
-0, 57600, 38016, 0xf69e94f9
-0, 61200, 38016, 0x849e8a08
-0, 64800, 38016, 0xe53f79e9
-0, 68400, 38016, 0xf2ce6103
-0, 72000, 38016, 0xe98d3c96
-0, 75600, 38016, 0xea8c17c5
-0, 79200, 38016, 0xea0a01d8
-0, 82800, 38016, 0x6a45fd53
-0, 86400, 38016, 0xaad9fd47
-0, 90000, 38016, 0xabc603b7
-0, 93600, 38016, 0x89410350
-0, 97200, 38016, 0x1fac129b
-0, 100800, 38016, 0x1af529ee
-0, 104400, 38016, 0x384141b6
diff --git a/tests/ref/fate/h264-conformance-bamq2_jvc_c b/tests/ref/fate/h264-conformance-bamq2_jvc_c
deleted file mode 100644
index a16cb05..0000000
--- a/tests/ref/fate/h264-conformance-bamq2_jvc_c
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 38016, 0x6951213f
-0, 3600, 38016, 0xd1bbf830
-0, 7200, 38016, 0x79dcc8cb
-0, 10800, 38016, 0xa426a50e
-0, 14400, 38016, 0x002275d6
-0, 18000, 38016, 0xab9a666e
-0, 21600, 38016, 0x9bd54be9
-0, 25200, 38016, 0x09003ed1
-0, 28800, 38016, 0x75e0340a
-0, 32400, 38016, 0x65ae3b23
-0, 36000, 38016, 0x4c1049a8
-0, 39600, 38016, 0x6e336a25
-0, 43200, 38016, 0x4d3579ee
-0, 46800, 38016, 0x81f89545
-0, 50400, 38016, 0xc9358e56
-0, 54000, 38016, 0x3fa69885
-0, 57600, 38016, 0x1ea49bea
-0, 61200, 38016, 0xce939241
-0, 64800, 38016, 0xbc278236
-0, 68400, 38016, 0xf11868d2
-0, 72000, 38016, 0xe4124537
-0, 75600, 38016, 0xd5831e16
-0, 79200, 38016, 0x9f5608e8
-0, 82800, 38016, 0x30ad0448
-0, 86400, 38016, 0x06a00523
-0, 90000, 38016, 0x25e50e24
-0, 93600, 38016, 0x2c220a92
-0, 97200, 38016, 0xd4b7185e
-0, 100800, 38016, 0x80f92d07
-0, 104400, 38016, 0x285a4586
diff --git a/tests/ref/fate/h264-conformance-banm_mw_d b/tests/ref/fate/h264-conformance-banm_mw_d
deleted file mode 100644
index 188d7a7..0000000
--- a/tests/ref/fate/h264-conformance-banm_mw_d
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0xaf9d9753
-0, 10800, 38016, 0x8a6f6906
-0, 14400, 38016, 0xcfe85810
-0, 18000, 38016, 0x00ed737f
-0, 21600, 38016, 0x93509e20
-0, 25200, 38016, 0xa02ba402
-0, 28800, 38016, 0xce09afd9
-0, 32400, 38016, 0xc7a49dcf
-0, 36000, 38016, 0x0da163c6
-0, 39600, 38016, 0xb3be2fcf
-0, 43200, 38016, 0x0d564479
-0, 46800, 38016, 0x5c554f55
-0, 50400, 38016, 0x05d06d25
-0, 54000, 38016, 0x352687bc
-0, 57600, 38016, 0x9e13b74d
-0, 61200, 38016, 0x1c3dd2af
-0, 64800, 38016, 0x3c1ad091
-0, 68400, 38016, 0x0461cad8
-0, 72000, 38016, 0xa002cc91
-0, 75600, 38016, 0x9c06d06e
-0, 79200, 38016, 0xfad0cee0
-0, 82800, 38016, 0x5cbbd4a5
-0, 86400, 38016, 0x9a99d463
-0, 90000, 38016, 0xa115d051
-0, 93600, 38016, 0x5b63cc22
-0, 97200, 38016, 0x53b3cfd2
-0, 100800, 38016, 0x7b22db61
-0, 104400, 38016, 0x4f28e319
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0xe2eb6bde
-0, 115200, 38016, 0xdfc84927
-0, 118800, 38016, 0xa0098eab
-0, 122400, 38016, 0x607a00e2
-0, 126000, 38016, 0x58da68d0
-0, 129600, 38016, 0x1290c8c6
-0, 133200, 38016, 0x40615120
-0, 136800, 38016, 0x070e9d9c
-0, 140400, 38016, 0x5295d213
-0, 144000, 38016, 0xaaa0f00a
-0, 147600, 38016, 0x0ef7f99d
-0, 151200, 38016, 0x018cf596
-0, 154800, 38016, 0xb9010555
-0, 158400, 38016, 0x54b10d05
-0, 162000, 38016, 0xa06ff53b
-0, 165600, 38016, 0x9a2ec1aa
-0, 169200, 38016, 0x75999938
-0, 172800, 38016, 0xda6ba315
-0, 176400, 38016, 0xaa38cc4e
-0, 180000, 38016, 0x87f6e751
-0, 183600, 38016, 0x2318c2b9
-0, 187200, 38016, 0xdebfd9c8
-0, 190800, 38016, 0xdc9a115f
-0, 194400, 38016, 0x6d1e495d
-0, 198000, 38016, 0x53d46db4
-0, 201600, 38016, 0x53287856
-0, 205200, 38016, 0x0ce93af7
-0, 208800, 38016, 0x44974b42
-0, 212400, 38016, 0x65a16170
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0x65da180b
-0, 223200, 38016, 0x6eb1cd77
-0, 226800, 38016, 0xc890b0c1
-0, 230400, 38016, 0x359ad301
-0, 234000, 38016, 0x4be2e140
-0, 237600, 38016, 0x5094da18
-0, 241200, 38016, 0x9ef9d904
-0, 244800, 38016, 0x0ad8cbb4
-0, 248400, 38016, 0xd68cb3db
-0, 252000, 38016, 0x7fcd9d3c
-0, 255600, 38016, 0x017385aa
-0, 259200, 38016, 0xa2328d96
-0, 262800, 38016, 0x18858630
-0, 266400, 38016, 0x795228e0
-0, 270000, 38016, 0xb70ce750
-0, 273600, 38016, 0x55d9da49
-0, 277200, 38016, 0x7714cc94
-0, 280800, 38016, 0xec39f711
-0, 284400, 38016, 0x561e4366
-0, 288000, 38016, 0xd91c83e0
-0, 291600, 38016, 0x8b3379e2
-0, 295200, 38016, 0xdee36b36
-0, 298800, 38016, 0x1b4940fd
-0, 302400, 38016, 0x9b13e7b2
-0, 306000, 38016, 0xb0b2f2eb
-0, 309600, 38016, 0x0e7c2373
-0, 313200, 38016, 0x87401fb0
-0, 316800, 38016, 0xc4bdb8be
-0, 320400, 38016, 0xbbfc4f40
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0xf7e8a749
-0, 331200, 38016, 0x8c66b366
-0, 334800, 38016, 0x9823f33e
-0, 338400, 38016, 0x5013240a
-0, 342000, 38016, 0xf174d83a
-0, 345600, 38016, 0xe49cae19
-0, 349200, 38016, 0xadc2f8f7
-0, 352800, 38016, 0x667961b0
-0, 356400, 38016, 0xcb6d9bcd
diff --git a/tests/ref/fate/h264-conformance-basqp1_sony_c b/tests/ref/fate/h264-conformance-basqp1_sony_c
deleted file mode 100644
index f856547..0000000
--- a/tests/ref/fate/h264-conformance-basqp1_sony_c
+++ /dev/null
@@ -1,4 +0,0 @@
-0, 0, 38016, 0xe2d73230
-0, 3600, 38016, 0xda4dfc8e
-0, 7200, 38016, 0x7334cb99
-0, 10800, 38016, 0xd8feab7d
diff --git a/tests/ref/fate/h264-conformance-caba1_sony_d b/tests/ref/fate/h264-conformance-caba1_sony_d
deleted file mode 100644
index 62232d2..0000000
--- a/tests/ref/fate/h264-conformance-caba1_sony_d
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x99e1fe60
-0, 7200, 38016, 0x65eace24
-0, 10800, 38016, 0xb2b0a513
-0, 14400, 38016, 0x8af47c64
-0, 18000, 38016, 0xa56670c6
-0, 21600, 38016, 0x11d45ac9
-0, 25200, 38016, 0xcd4e4f18
-0, 28800, 38016, 0x399934b2
-0, 32400, 38016, 0xedd23f7b
-0, 36000, 38016, 0x38c350b9
-0, 39600, 38016, 0xdd937244
-0, 43200, 38016, 0x39c67be6
-0, 46800, 38016, 0xabb7a34d
-0, 50400, 38016, 0x535d971f
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0xfddda183
-0, 61200, 38016, 0x7b659dc5
-0, 64800, 38016, 0x06978b0c
-0, 68400, 38016, 0x62596b00
-0, 72000, 38016, 0x5e504719
-0, 75600, 38016, 0x55252349
-0, 79200, 38016, 0xdbdd0d9e
-0, 82800, 38016, 0x550a0918
-0, 86400, 38016, 0xb890feeb
-0, 90000, 38016, 0x8aa01221
-0, 93600, 38016, 0xfcc01085
-0, 97200, 38016, 0x78f11d7d
-0, 100800, 38016, 0xfcd33487
-0, 104400, 38016, 0x9b444cfc
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0x07e17628
-0, 115200, 38016, 0x9bb792fd
-0, 118800, 38016, 0xa6aea73d
-0, 122400, 38016, 0x4b90b778
-0, 126000, 38016, 0x6df2b998
-0, 129600, 38016, 0x799eb2db
-0, 133200, 38016, 0x48dab272
-0, 136800, 38016, 0x9877b4eb
-0, 140400, 38016, 0x901ab58e
-0, 144000, 38016, 0x32c2beb1
-0, 147600, 38016, 0xe542b56e
-0, 151200, 38016, 0x1edf9ff4
-0, 154800, 38016, 0xf103942c
-0, 158400, 38016, 0x097a8dc7
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0xce9a9026
-0, 169200, 38016, 0x78ba841b
-0, 172800, 38016, 0x5fc687ab
-0, 176400, 38016, 0x03a49472
diff --git a/tests/ref/fate/h264-conformance-caba1_sva_b b/tests/ref/fate/h264-conformance-caba1_sva_b
deleted file mode 100644
index f5b426b..0000000
--- a/tests/ref/fate/h264-conformance-caba1_sva_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0xee831fe4
-0, 3600, 38016, 0x1098ff23
-0, 7200, 38016, 0x8fc3e078
-0, 10800, 38016, 0x86530991
-0, 14400, 38016, 0xdc8e279e
-0, 18000, 38016, 0x54ea3234
-0, 21600, 38016, 0x79014662
-0, 25200, 38016, 0x5d0a5a88
-0, 28800, 38016, 0xf712805d
-0, 32400, 38016, 0x0a09937e
-0, 36000, 38016, 0xfa62a1d7
-0, 39600, 38016, 0x67c6a41b
-0, 43200, 38016, 0x6452ab94
-0, 46800, 38016, 0xdb269049
-0, 50400, 38016, 0xc7ab8864
-0, 54000, 38016, 0xbb828f4a
-0, 57600, 38016, 0x4fb3a61a
diff --git a/tests/ref/fate/h264-conformance-caba2_sony_e b/tests/ref/fate/h264-conformance-caba2_sony_e
deleted file mode 100644
index 0732027..0000000
--- a/tests/ref/fate/h264-conformance-caba2_sony_e
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0x23a30e47
-0, 7200, 38016, 0xa0b7df0f
-0, 10800, 38016, 0x5cd9beed
-0, 14400, 38016, 0x13b09699
-0, 18000, 38016, 0x66697d65
-0, 21600, 38016, 0xf0486d0d
-0, 25200, 38016, 0xaf94644e
-0, 28800, 38016, 0x43c45981
-0, 32400, 38016, 0x8f655e70
-0, 36000, 38016, 0x3d747a52
-0, 39600, 38016, 0x906e95f9
-0, 43200, 38016, 0xdd3ea1a0
-0, 46800, 38016, 0x216eb0ee
-0, 50400, 38016, 0x06cbabfe
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0x6d2fa58e
-0, 61200, 38016, 0x0adca6fc
-0, 64800, 38016, 0x51c49ad9
-0, 68400, 38016, 0x83e57a42
-0, 72000, 38016, 0xe47b5dad
-0, 75600, 38016, 0x5e123c13
-0, 79200, 38016, 0xad682f93
-0, 82800, 38016, 0x77b02d2c
-0, 86400, 38016, 0x976d316e
-0, 90000, 38016, 0x3d923c72
-0, 93600, 38016, 0xf073398d
-0, 97200, 38016, 0x6dc547b4
-0, 100800, 38016, 0xfa9859b3
-0, 104400, 38016, 0xfc3f77b9
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0xc040929e
-0, 115200, 38016, 0x5562af3c
-0, 118800, 38016, 0xa56abc78
-0, 122400, 38016, 0x702ec702
-0, 126000, 38016, 0x8ee7c909
-0, 129600, 38016, 0x9065c44f
-0, 133200, 38016, 0x11e3c40b
-0, 136800, 38016, 0x20fbc27a
-0, 140400, 38016, 0xaeecc582
-0, 144000, 38016, 0x3b32ca4f
-0, 147600, 38016, 0x5464ce6c
-0, 151200, 38016, 0x41d4cd66
-0, 154800, 38016, 0x8a69c6ef
-0, 158400, 38016, 0x2c63c59e
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0xc60c9ca3
-0, 169200, 38016, 0x8299a65a
-0, 172800, 38016, 0x67d4b3d5
-0, 176400, 38016, 0xd650bd19
-0, 180000, 38016, 0xe8c9b285
-0, 183600, 38016, 0x9a3dba0c
-0, 187200, 38016, 0xb3f4bfc3
-0, 190800, 38016, 0xe3edbe71
-0, 194400, 38016, 0xea7fc14f
-0, 198000, 38016, 0x4560cb94
-0, 201600, 38016, 0x3b48ce1b
-0, 205200, 38016, 0xc668d24c
-0, 208800, 38016, 0x8bdcd514
-0, 212400, 38016, 0xd0f8d380
-0, 216000, 38016, 0x98a59a5a
-0, 219600, 38016, 0x086d9c52
-0, 223200, 38016, 0x50417af3
-0, 226800, 38016, 0xe8ae428b
-0, 230400, 38016, 0xb5663f68
-0, 234000, 38016, 0x452e6045
-0, 237600, 38016, 0x0412991e
-0, 241200, 38016, 0xa791d0c8
-0, 244800, 38016, 0x952c13e8
-0, 248400, 38016, 0x9356462c
-0, 252000, 38016, 0x34026bf3
-0, 255600, 38016, 0x3a109e70
-0, 259200, 38016, 0xc28dccb1
-0, 262800, 38016, 0x445f08e7
-0, 266400, 38016, 0x1e0c4781
-0, 270000, 38016, 0x4c0b3afa
-0, 273600, 38016, 0x90147b21
-0, 277200, 38016, 0xe6fb9ee6
-0, 280800, 38016, 0x3bbac15a
-0, 284400, 38016, 0x113ecc97
-0, 288000, 38016, 0xa271e248
-0, 291600, 38016, 0xbc97f36a
-0, 295200, 38016, 0x2a5af366
-0, 298800, 38016, 0xc171ec49
-0, 302400, 38016, 0x2393e85e
-0, 306000, 38016, 0xbf59eeb0
-0, 309600, 38016, 0xcec2f989
-0, 313200, 38016, 0x3cb8fcb3
-0, 316800, 38016, 0x28150278
-0, 320400, 38016, 0x27f70026
-0, 324000, 38016, 0x8fa69f07
-0, 327600, 38016, 0x198b9a79
-0, 331200, 38016, 0x40928d52
-0, 334800, 38016, 0x1504834e
-0, 338400, 38016, 0xb53677ab
-0, 342000, 38016, 0x2e2c783d
-0, 345600, 38016, 0x5fd38e3a
-0, 349200, 38016, 0x697e9cd3
-0, 352800, 38016, 0x0b18ad4b
-0, 356400, 38016, 0x6ad7b78f
-0, 360000, 38016, 0x6af3c654
-0, 363600, 38016, 0x5aabb804
-0, 367200, 38016, 0x9b5aa6e5
-0, 370800, 38016, 0x2993a311
-0, 374400, 38016, 0x1382b8e5
-0, 378000, 38016, 0xf294a253
-0, 381600, 38016, 0xafa5c2a5
-0, 385200, 38016, 0x621ce2b5
-0, 388800, 38016, 0x676c0440
-0, 392400, 38016, 0xa7c31e07
-0, 396000, 38016, 0x29612ba2
-0, 399600, 38016, 0xb38c3920
-0, 403200, 38016, 0xfcce3ee5
-0, 406800, 38016, 0x3ee81fac
-0, 410400, 38016, 0x635cfdb0
-0, 414000, 38016, 0x222afa63
-0, 417600, 38016, 0x230c09cb
-0, 421200, 38016, 0x2b491802
-0, 424800, 38016, 0x9cac2164
-0, 428400, 38016, 0xa0532de8
-0, 432000, 38016, 0x32e93592
-0, 435600, 38016, 0x724033a9
-0, 439200, 38016, 0x74411884
-0, 442800, 38016, 0xae14efcf
-0, 446400, 38016, 0x0188cdc7
-0, 450000, 38016, 0x5708b5c1
-0, 453600, 38016, 0x54aba6da
-0, 457200, 38016, 0x7364b397
-0, 460800, 38016, 0xf676c547
-0, 464400, 38016, 0x6926db3a
-0, 468000, 38016, 0xccdbe5be
-0, 471600, 38016, 0x8fc8e490
-0, 475200, 38016, 0x5d7fdd35
-0, 478800, 38016, 0x0e27e010
-0, 482400, 38016, 0x8120dd43
-0, 486000, 38016, 0x1612a173
-0, 489600, 38016, 0x3f1cb4b7
-0, 493200, 38016, 0xd1c7b0a6
-0, 496800, 38016, 0x472baad5
-0, 500400, 38016, 0xfe37a1f3
-0, 504000, 38016, 0x42a391ba
-0, 507600, 38016, 0xdb618cac
-0, 511200, 38016, 0x7af879bf
-0, 514800, 38016, 0xe6f27644
-0, 518400, 38016, 0x550a7f0c
-0, 522000, 38016, 0x7d297eaa
-0, 525600, 38016, 0xaeb57623
-0, 529200, 38016, 0x6d5e4995
-0, 532800, 38016, 0x57df1be0
-0, 536400, 38016, 0x7617f825
-0, 540000, 38016, 0xf731aef2
-0, 543600, 38016, 0x489aae6c
-0, 547200, 38016, 0x2d80b7a4
-0, 550800, 38016, 0xe4b6ac4e
-0, 554400, 38016, 0xd243a374
-0, 558000, 38016, 0x5cf9b85b
-0, 561600, 38016, 0xe824d798
-0, 565200, 38016, 0x8a46f630
-0, 568800, 38016, 0x4a03337f
-0, 572400, 38016, 0xefe25cf7
-0, 576000, 38016, 0xed876efa
-0, 579600, 38016, 0xdf1b6b65
-0, 583200, 38016, 0xd3225d8c
-0, 586800, 38016, 0x0cf04d8d
-0, 590400, 38016, 0x0fdc3bb3
-0, 594000, 38016, 0xc31bf5da
-0, 597600, 38016, 0x09e0ec79
-0, 601200, 38016, 0x6521c8fb
-0, 604800, 38016, 0x6f67a94c
-0, 608400, 38016, 0xa0a49f38
-0, 612000, 38016, 0x759fb6f2
-0, 615600, 38016, 0xea41ddf8
-0, 619200, 38016, 0xe559f0a6
-0, 622800, 38016, 0x1dcbec38
-0, 626400, 38016, 0xfb62dc6a
-0, 630000, 38016, 0x3d0fac24
-0, 633600, 38016, 0x87c373a1
-0, 637200, 38016, 0x97a84562
-0, 640800, 38016, 0xe4361c2e
-0, 644400, 38016, 0x21170c47
-0, 648000, 38016, 0x0769ec52
-0, 651600, 38016, 0xac1ad44d
-0, 655200, 38016, 0xdf87cb3e
-0, 658800, 38016, 0x95c0d66f
-0, 662400, 38016, 0xba33da6f
-0, 666000, 38016, 0x71b2e866
-0, 669600, 38016, 0x64540dd1
-0, 673200, 38016, 0x79cb2d92
-0, 676800, 38016, 0xfe8e394b
-0, 680400, 38016, 0x648f443f
-0, 684000, 38016, 0x491eee56
-0, 687600, 38016, 0x6195b91b
-0, 691200, 38016, 0x3935c2b0
-0, 694800, 38016, 0x2408e296
-0, 698400, 38016, 0xe17106b5
-0, 702000, 38016, 0xd8d01ad1
-0, 705600, 38016, 0x85d15104
-0, 709200, 38016, 0xacc16731
-0, 712800, 38016, 0xb6a990b7
-0, 716400, 38016, 0x8153a9cd
-0, 720000, 38016, 0xef5ab92a
-0, 723600, 38016, 0x392acfab
-0, 727200, 38016, 0x7031d48e
-0, 730800, 38016, 0x5d3ed39f
-0, 734400, 38016, 0x004fd516
-0, 738000, 38016, 0x8de7dc94
-0, 741600, 38016, 0x7e21db4a
-0, 745200, 38016, 0x518dd829
-0, 748800, 38016, 0xf780cf45
-0, 752400, 38016, 0x0a49bd6f
-0, 756000, 38016, 0xadb65d17
-0, 759600, 38016, 0xbe79629d
-0, 763200, 38016, 0x2daa65c8
-0, 766800, 38016, 0x0b4a6737
-0, 770400, 38016, 0x8e705885
-0, 774000, 38016, 0x6d2a4af2
-0, 777600, 38016, 0x89fe4b54
-0, 781200, 38016, 0x90cb4dde
-0, 784800, 38016, 0x2d9e4f4e
-0, 788400, 38016, 0x5fcd4a7b
-0, 792000, 38016, 0xdb4143e7
-0, 795600, 38016, 0xd9343662
-0, 799200, 38016, 0xdf4a2af2
-0, 802800, 38016, 0xbe8f1fd2
-0, 806400, 38016, 0x4658200f
-0, 810000, 38016, 0x92b51315
-0, 813600, 38016, 0x441f1576
-0, 817200, 38016, 0x970b29b4
-0, 820800, 38016, 0x93ac40f2
-0, 824400, 38016, 0xa0ac6b06
-0, 828000, 38016, 0xdd5b8f01
-0, 831600, 38016, 0xa921b3d5
-0, 835200, 38016, 0xdd6fdf01
-0, 838800, 38016, 0x1c6c0306
-0, 842400, 38016, 0xcea2235d
-0, 846000, 38016, 0x43853758
-0, 849600, 38016, 0xa0234e29
-0, 853200, 38016, 0x94c85022
-0, 856800, 38016, 0xaf4e33ab
-0, 860400, 38016, 0x07f90e0c
-0, 864000, 38016, 0x99cee4bd
-0, 867600, 38016, 0xb7cdcf79
-0, 871200, 38016, 0x5923c14c
-0, 874800, 38016, 0x771f15d4
-0, 878400, 38016, 0x20f08043
-0, 882000, 38016, 0xb7bfeab2
-0, 885600, 38016, 0x53440996
-0, 889200, 38016, 0x6452d384
-0, 892800, 38016, 0xabcb975e
-0, 896400, 38016, 0x146123b9
-0, 900000, 38016, 0xbeddbfff
-0, 903600, 38016, 0xa0c97c47
-0, 907200, 38016, 0x1dca7308
-0, 910800, 38016, 0x16c5c832
-0, 914400, 38016, 0xcab326b9
-0, 918000, 38016, 0xe952c9bd
-0, 921600, 38016, 0x216ec182
-0, 925200, 38016, 0xb21a5074
-0, 928800, 38016, 0xcbe73c15
-0, 932400, 38016, 0xb5e532de
-0, 936000, 38016, 0x3a693aa5
-0, 939600, 38016, 0x157f4a20
-0, 943200, 38016, 0x9f9a5868
-0, 946800, 38016, 0x50f65ea1
-0, 950400, 38016, 0xe1735d4f
-0, 954000, 38016, 0x15284ec7
-0, 957600, 38016, 0x32433d94
-0, 961200, 38016, 0x768f2092
-0, 964800, 38016, 0x6b01f5ad
-0, 968400, 38016, 0xadcbce27
-0, 972000, 38016, 0x6faca613
-0, 975600, 38016, 0xd9327d40
-0, 979200, 38016, 0xbc1060ef
-0, 982800, 38016, 0xbe071251
-0, 986400, 38016, 0x47abbfaa
-0, 990000, 38016, 0x4851af88
-0, 993600, 38016, 0xff53c772
-0, 997200, 38016, 0xa1dcbef5
-0, 1000800, 38016, 0x106df309
-0, 1004400, 38016, 0x92e65f13
-0, 1008000, 38016, 0x7e8ffdb9
-0, 1011600, 38016, 0x0ba4d317
-0, 1015200, 38016, 0xe038a2a2
-0, 1018800, 38016, 0xc479675b
-0, 1022400, 38016, 0xadbc4d18
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0x3240617d
-0, 1033200, 38016, 0xa60f9b98
-0, 1036800, 38016, 0x3aeea379
-0, 1040400, 38016, 0x45a0936c
-0, 1044000, 38016, 0xf0c42d2f
-0, 1047600, 38016, 0x930343ee
-0, 1051200, 38016, 0xe074d631
-0, 1054800, 38016, 0xc6f20ab5
-0, 1058400, 38016, 0x3f5a4ef7
-0, 1062000, 38016, 0x94d44b16
-0, 1065600, 38016, 0xa52427da
-0, 1069200, 38016, 0x2f2116a1
-0, 1072800, 38016, 0x566c2541
-0, 1076400, 38016, 0x0b894c8b
diff --git a/tests/ref/fate/h264-conformance-caba2_sva_b b/tests/ref/fate/h264-conformance-caba2_sva_b
deleted file mode 100644
index af25df7..0000000
--- a/tests/ref/fate/h264-conformance-caba2_sva_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0xee831fe4
-0, 3600, 38016, 0xd9130e19
-0, 7200, 38016, 0x8ad70cae
-0, 10800, 38016, 0x98f11d0e
-0, 14400, 38016, 0x311d46ea
-0, 18000, 38016, 0xe2f15cc5
-0, 21600, 38016, 0xb4c174c6
-0, 25200, 38016, 0x22708406
-0, 28800, 38016, 0x7116a2d2
-0, 32400, 38016, 0x7937b29b
-0, 36000, 38016, 0xfa62a1d7
-0, 39600, 38016, 0x2066b1c6
-0, 43200, 38016, 0x18ecaa40
-0, 46800, 38016, 0xe5dc8d99
-0, 50400, 38016, 0x77046f4a
-0, 54000, 38016, 0x1c50704f
-0, 57600, 38016, 0x87f1879d
diff --git a/tests/ref/fate/h264-conformance-caba3_sony_c b/tests/ref/fate/h264-conformance-caba3_sony_c
deleted file mode 100644
index d5465b3..0000000
--- a/tests/ref/fate/h264-conformance-caba3_sony_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0xb6261cdd
-0, 7200, 38016, 0x42ecede9
-0, 10800, 38016, 0xfcd6aec1
-0, 14400, 38016, 0xb3ffa014
-0, 18000, 38016, 0xc65383e3
-0, 21600, 38016, 0xa8494fb1
-0, 25200, 38016, 0x7fb14e0f
-0, 28800, 38016, 0x7dd3462a
-0, 32400, 38016, 0x4bd43dda
-0, 36000, 38016, 0x717e736f
-0, 39600, 38016, 0x2a9b8e47
-0, 43200, 38016, 0x1bc272be
-0, 46800, 38016, 0x0127afb5
-0, 50400, 38016, 0xfd7aacda
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0xd205b1ee
-0, 61200, 38016, 0x967ca895
-0, 64800, 38016, 0x25978063
-0, 68400, 38016, 0x632081b3
-0, 72000, 38016, 0x8ccf5f0b
-0, 75600, 38016, 0x21cc2141
-0, 79200, 38016, 0x477d2543
-0, 82800, 38016, 0xff971bb8
-0, 86400, 38016, 0x0dc21005
-0, 90000, 38016, 0xc69c2d90
-0, 93600, 38016, 0xd7922b5d
-0, 97200, 38016, 0x59a3278f
-0, 100800, 38016, 0x83c55d4d
-0, 104400, 38016, 0xaac96f23
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0xf86b9ef4
-0, 115200, 38016, 0xe616b81c
-0, 118800, 38016, 0xde60a57b
-0, 122400, 38016, 0x5fe8d130
-0, 126000, 38016, 0x11decaca
-0, 129600, 38016, 0x526fa8e2
-0, 133200, 38016, 0xc5e7ccfb
-0, 136800, 38016, 0x10e1c588
-0, 140400, 38016, 0x78aeb05b
-0, 144000, 38016, 0xff85c717
-0, 147600, 38016, 0x3f02c1b2
-0, 151200, 38016, 0xf45eb015
-0, 154800, 38016, 0x0211b84d
-0, 158400, 38016, 0x3864ba1f
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0x575da8b5
-0, 169200, 38016, 0xc841ad98
-0, 172800, 38016, 0xe69ea78f
-0, 176400, 38016, 0x45cabf16
-0, 180000, 38016, 0x0e00b8eb
-0, 183600, 38016, 0xa774a808
-0, 187200, 38016, 0xfb1bbc2b
-0, 190800, 38016, 0xcfb4b41d
-0, 194400, 38016, 0x66abaff8
-0, 198000, 38016, 0xc39ac9a9
-0, 201600, 38016, 0xbec0cc9a
-0, 205200, 38016, 0xf393c7fc
-0, 208800, 38016, 0xedb5d4ef
-0, 212400, 38016, 0x4b0fd4fe
-0, 216000, 38016, 0x98a59a5a
-0, 219600, 38016, 0x0a69a4f3
-0, 223200, 38016, 0x72bc89ce
-0, 226800, 38016, 0xfe8538b6
-0, 230400, 38016, 0xc8a158a3
-0, 234000, 38016, 0x1cb57fcd
-0, 237600, 38016, 0x76c29215
-0, 241200, 38016, 0xdb36ec21
-0, 244800, 38016, 0xc2e22427
-0, 248400, 38016, 0xafb433cd
-0, 252000, 38016, 0x4d736e28
-0, 255600, 38016, 0xc6ab9949
-0, 259200, 38016, 0xaa9bb9e6
-0, 262800, 38016, 0x0d41f894
-0, 266400, 38016, 0x603332b0
-0, 270000, 38016, 0x4c0b3afa
-0, 273600, 38016, 0x8fd3845e
-0, 277200, 38016, 0x8cf09ae3
-0, 280800, 38016, 0x1e02adfb
-0, 284400, 38016, 0x3c9ac38e
-0, 288000, 38016, 0xb5fdd2d9
-0, 291600, 38016, 0x82c5dd7f
-0, 295200, 38016, 0x4b6ee80a
-0, 298800, 38016, 0xaeaee46f
-0, 302400, 38016, 0x390ed382
-0, 306000, 38016, 0xedbfde44
-0, 309600, 38016, 0xabf6eba0
-0, 313200, 38016, 0x5bf5efd0
-0, 316800, 38016, 0x9a88ebe3
-0, 320400, 38016, 0x2af7ec3b
-0, 324000, 38016, 0x8fa69f07
-0, 327600, 38016, 0xff8fb3b5
-0, 331200, 38016, 0xd06fa3c1
-0, 334800, 38016, 0xe5a97d39
-0, 338400, 38016, 0x961e7c6f
-0, 342000, 38016, 0x18b278af
-0, 345600, 38016, 0x9a0d73d2
-0, 349200, 38016, 0x378f9d74
-0, 352800, 38016, 0x42e5a7a3
-0, 356400, 38016, 0x4595a78e
-0, 360000, 38016, 0x6c09c035
-0, 363600, 38016, 0xec58ab98
-0, 367200, 38016, 0x1b4b8d2b
-0, 370800, 38016, 0xf5199117
-0, 374400, 38016, 0xcd31af4d
-0, 378000, 38016, 0xf294a253
-0, 381600, 38016, 0x360dde6b
-0, 385200, 38016, 0x101cf70c
-0, 388800, 38016, 0x4b34ff17
-0, 392400, 38016, 0x520639c0
-0, 396000, 38016, 0x901840a9
-0, 399600, 38016, 0x4cb03284
-0, 403200, 38016, 0x6929470c
-0, 406800, 38016, 0x21282bdf
-0, 410400, 38016, 0xee8df0ec
-0, 414000, 38016, 0x24970e16
-0, 417600, 38016, 0x280118e3
-0, 421200, 38016, 0x00a10b64
-0, 424800, 38016, 0xb0673f83
-0, 428400, 38016, 0x838644de
-0, 432000, 38016, 0x32e93592
-0, 435600, 38016, 0xedfc477a
-0, 439200, 38016, 0x41062501
-0, 442800, 38016, 0xf218ebf2
-0, 446400, 38016, 0x3430dc73
-0, 450000, 38016, 0xb2fab8f0
-0, 453600, 38016, 0x11b19bab
-0, 457200, 38016, 0x8e30b8e7
-0, 460800, 38016, 0xc8b9c646
-0, 464400, 38016, 0xc902d559
-0, 468000, 38016, 0x3a24ec30
-0, 471600, 38016, 0x744de424
-0, 475200, 38016, 0xc40cd059
-0, 478800, 38016, 0xd98dd9ec
-0, 482400, 38016, 0x9719d698
-0, 486000, 38016, 0x1612a173
-0, 489600, 38016, 0xc044b9f1
-0, 493200, 38016, 0xc433af2f
-0, 496800, 38016, 0x559891e3
-0, 500400, 38016, 0x969e9a33
-0, 504000, 38016, 0x8a6a8e77
-0, 507600, 38016, 0x9d7b76bf
-0, 511200, 38016, 0x3725711a
-0, 514800, 38016, 0x5b316bd0
-0, 518400, 38016, 0x4c616abd
-0, 522000, 38016, 0x43637e2b
-0, 525600, 38016, 0xd9e36c4c
-0, 529200, 38016, 0x823d3596
-0, 532800, 38016, 0x57361a59
-0, 536400, 38016, 0x4a91f007
-0, 540000, 38016, 0xf731aef2
-0, 543600, 38016, 0x8ed2c618
-0, 547200, 38016, 0x6f1cc918
-0, 550800, 38016, 0x2a8ba336
-0, 554400, 38016, 0x8159b595
-0, 558000, 38016, 0x07cfced9
-0, 561600, 38016, 0x8804c878
-0, 565200, 38016, 0x624e0656
-0, 568800, 38016, 0x8628302b
-0, 572400, 38016, 0xd155461e
-0, 576000, 38016, 0x3c1c647c
-0, 579600, 38016, 0x8a485727
-0, 583200, 38016, 0x144934f7
-0, 586800, 38016, 0x43183494
-0, 590400, 38016, 0x20fd2ef2
-0, 594000, 38016, 0xc31bf5da
-0, 597600, 38016, 0x4c70f0f2
-0, 601200, 38016, 0xba1bcbcc
-0, 604800, 38016, 0x11039c6c
-0, 608400, 38016, 0x67c59b61
-0, 612000, 38016, 0xdc0aa2ba
-0, 615600, 38016, 0x1e2dbec9
-0, 619200, 38016, 0xacacdc6c
-0, 622800, 38016, 0x2049defe
-0, 626400, 38016, 0x7488cc3e
-0, 630000, 38016, 0x14bca829
-0, 633600, 38016, 0xc19c76ee
-0, 637200, 38016, 0xeca33612
-0, 640800, 38016, 0x93b027a5
-0, 644400, 38016, 0x82ae1e62
-0, 648000, 38016, 0x0769ec52
-0, 651600, 38016, 0x7cdee8dd
-0, 655200, 38016, 0x7d22d43d
-0, 658800, 38016, 0x65d8cd49
-0, 662400, 38016, 0xa7d2ede4
-0, 666000, 38016, 0x6bd2ffa1
-0, 669600, 38016, 0xb4db0734
-0, 673200, 38016, 0x69cb35ac
-0, 676800, 38016, 0x05e52e88
-0, 680400, 38016, 0x4dc92a43
-0, 684000, 38016, 0x8ca0e858
-0, 687600, 38016, 0x74fbae53
-0, 691200, 38016, 0x19f0aa17
-0, 694800, 38016, 0x04c9dc83
-0, 698400, 38016, 0x0a8ff4b9
-0, 702000, 38016, 0xd8d01ad1
-0, 705600, 38016, 0xa41b5100
-0, 709200, 38016, 0xfaf96547
-0, 712800, 38016, 0xadab8265
-0, 716400, 38016, 0x6e12a9c3
-0, 720000, 38016, 0x1de7b7d1
-0, 723600, 38016, 0x2279bc4a
-0, 727200, 38016, 0x4f62ca0f
-0, 730800, 38016, 0xfaf2cc43
-0, 734400, 38016, 0xbf68c7df
-0, 738000, 38016, 0xb927d1ea
-0, 741600, 38016, 0x8b93d7c6
-0, 745200, 38016, 0x13f3d7d6
-0, 748800, 38016, 0x9ee4cc7b
-0, 752400, 38016, 0x16deb1a0
-0, 756000, 38016, 0xadb65d17
-0, 759600, 38016, 0x0b9e7542
-0, 763200, 38016, 0x05777490
-0, 766800, 38016, 0x6805549f
-0, 770400, 38016, 0xe3246225
-0, 774000, 38016, 0x4003551b
-0, 777600, 38016, 0x1e083a01
-0, 781200, 38016, 0x756e4f22
-0, 784800, 38016, 0xf2f24967
-0, 788400, 38016, 0x680d37f2
-0, 792000, 38016, 0x85b34185
-0, 795600, 38016, 0xefa32eeb
-0, 799200, 38016, 0xca791448
-0, 802800, 38016, 0x7c6b2b13
-0, 806400, 38016, 0x0d8232a6
-0, 810000, 38016, 0x92b51315
-0, 813600, 38016, 0xcfde349c
-0, 817200, 38016, 0xdc1a488b
-0, 820800, 38016, 0xdcf94106
-0, 824400, 38016, 0xc205829b
-0, 828000, 38016, 0x0aff9da3
-0, 831600, 38016, 0x3295b04e
-0, 835200, 38016, 0xc42dfaab
-0, 838800, 38016, 0x799e14a2
-0, 842400, 38016, 0xf658150c
-0, 846000, 38016, 0x4c8751fe
-0, 849600, 38016, 0xe57d58ed
-0, 853200, 38016, 0x28f83c49
-0, 856800, 38016, 0x9760453c
-0, 860400, 38016, 0x1d550fcf
-0, 864000, 38016, 0x99cee4bd
-0, 867600, 38016, 0x743ad122
-0, 871200, 38016, 0xb533ab7c
-0, 874800, 38016, 0x5ca5fc65
-0, 878400, 38016, 0x491c7076
-0, 882000, 38016, 0x8a96d9e5
-0, 885600, 38016, 0x23c3f207
-0, 889200, 38016, 0x3181d62d
-0, 892800, 38016, 0xc72e9636
-0, 896400, 38016, 0xe0c31ae9
-0, 900000, 38016, 0x2f91c0ce
-0, 903600, 38016, 0x17937763
-0, 907200, 38016, 0x61986c20
-0, 910800, 38016, 0x6adeca83
-0, 914400, 38016, 0x894a376b
-0, 918000, 38016, 0xe952c9bd
-0, 921600, 38016, 0x0418d8e9
-0, 925200, 38016, 0x30de606e
-0, 928800, 38016, 0xd15e3116
-0, 932400, 38016, 0xee0446ac
-0, 936000, 38016, 0x34ee44f7
-0, 939600, 38016, 0x825745d4
-0, 943200, 38016, 0xb8046176
-0, 946800, 38016, 0xa812588a
-0, 950400, 38016, 0xed754b26
-0, 954000, 38016, 0xa39c51cd
-0, 957600, 38016, 0x315b38d5
-0, 961200, 38016, 0x12550e05
-0, 964800, 38016, 0xbda6fd9a
-0, 968400, 38016, 0xd10bd86c
-0, 972000, 38016, 0x6faca613
-0, 975600, 38016, 0x6268848a
-0, 979200, 38016, 0x2b8367e6
-0, 982800, 38016, 0xdb6806fd
-0, 986400, 38016, 0x4f58d418
-0, 990000, 38016, 0x59beb628
-0, 993600, 38016, 0x8017aae2
-0, 997200, 38016, 0xb26ad1b3
-0, 1000800, 38016, 0xa058f3a3
-0, 1004400, 38016, 0x4fee4ac2
-0, 1008000, 38016, 0x5dd20ae9
-0, 1011600, 38016, 0x6365dbda
-0, 1015200, 38016, 0x25b47f80
-0, 1018800, 38016, 0x468b8ecb
-0, 1022400, 38016, 0x0b0760f9
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0x4bb47357
-0, 1033200, 38016, 0x2c0ca74c
-0, 1036800, 38016, 0x6484a271
-0, 1040400, 38016, 0xa55871df
-0, 1044000, 38016, 0xa617ecd8
-0, 1047600, 38016, 0xf7231cc5
-0, 1051200, 38016, 0x15dba20b
-0, 1054800, 38016, 0x56a7d8c7
-0, 1058400, 38016, 0x5e78382b
-0, 1062000, 38016, 0x8edf243b
-0, 1065600, 38016, 0x571effaf
-0, 1069200, 38016, 0x274302d2
-0, 1072800, 38016, 0xc950203d
-0, 1076400, 38016, 0x4a744324
diff --git a/tests/ref/fate/h264-conformance-caba3_sva_b b/tests/ref/fate/h264-conformance-caba3_sva_b
deleted file mode 100644
index 449fb75..0000000
--- a/tests/ref/fate/h264-conformance-caba3_sva_b
+++ /dev/null
@@ -1,33 +0,0 @@
-0, 0, 38016, 0x0e091175
-0, 3600, 38016, 0xe8f81506
-0, 7200, 38016, 0xf706f5cd
-0, 10800, 38016, 0x9aeb21b1
-0, 14400, 38016, 0xdc533379
-0, 18000, 38016, 0xd26d534b
-0, 21600, 38016, 0xdcb25dc5
-0, 25200, 38016, 0x1b258cc2
-0, 28800, 38016, 0xdfb58ff8
-0, 32400, 38016, 0x143abf85
-0, 36000, 38016, 0xace399ea
-0, 39600, 38016, 0x1ad6bb8e
-0, 43200, 38016, 0xf01d9b78
-0, 46800, 38016, 0x5a0c99ed
-0, 50400, 38016, 0x9d4e684c
-0, 54000, 38016, 0xca3d811f
-0, 57600, 38016, 0x388c7bc4
-0, 61200, 38016, 0x36329ae0
-0, 64800, 38016, 0x7ca686ac
-0, 68400, 38016, 0x9d7ababf
-0, 72000, 38016, 0x563eaf2a
-0, 75600, 38016, 0xce22a4be
-0, 79200, 38016, 0xb7cb719a
-0, 82800, 38016, 0x7b706edf
-0, 86400, 38016, 0x009a30b5
-0, 90000, 38016, 0xf1fe3fbc
-0, 93600, 38016, 0x7f732436
-0, 97200, 38016, 0x055147ec
-0, 100800, 38016, 0x1670494c
-0, 104400, 38016, 0xfede7bab
-0, 108000, 38016, 0xa3b660d8
-0, 111600, 38016, 0x33db7209
-0, 115200, 38016, 0xb7b25559
diff --git a/tests/ref/fate/h264-conformance-caba3_toshiba_e b/tests/ref/fate/h264-conformance-caba3_toshiba_e
deleted file mode 100644
index e874659..0000000
--- a/tests/ref/fate/h264-conformance-caba3_toshiba_e
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0x72723ce4
-0, 3600, 38016, 0x347219d7
-0, 7200, 38016, 0x813ff182
-0, 10800, 38016, 0x4e69d41a
-0, 14400, 38016, 0x5e56acb6
-0, 18000, 38016, 0xe72197e5
-0, 21600, 38016, 0xd035807a
-0, 25200, 38016, 0x9ee57559
-0, 28800, 38016, 0xd0f56f28
-0, 32400, 38016, 0xa5097788
-0, 36000, 38016, 0xf108978d
-0, 39600, 38016, 0xf76cb475
-0, 43200, 38016, 0x0184cc3a
-0, 46800, 38016, 0xa4b5dc15
-0, 50400, 38016, 0x209cdc42
-0, 54000, 38016, 0xd9e69a8c
-0, 57600, 38016, 0xa2c3a9ba
-0, 61200, 38016, 0xdf84a52e
-0, 64800, 38016, 0xfe48a7f0
-0, 68400, 38016, 0xb0279a19
-0, 72000, 38016, 0xf3b48652
-0, 75600, 38016, 0xc12b61b5
-0, 79200, 38016, 0x13065a22
-0, 82800, 38016, 0x804853d4
-0, 86400, 38016, 0x40935736
-0, 90000, 38016, 0x1a135ecb
-0, 93600, 38016, 0x125f6116
-0, 97200, 38016, 0x53286da3
-0, 100800, 38016, 0xd49287ac
-0, 104400, 38016, 0xc70a9c2c
-0, 108000, 38016, 0x0c0c6998
-0, 111600, 38016, 0xf37d9141
-0, 115200, 38016, 0xd36eafa2
-0, 118800, 38016, 0x0d1fc298
-0, 122400, 38016, 0xf84ad5d9
-0, 126000, 38016, 0xc1e8d93d
-0, 129600, 38016, 0xe190dabd
-0, 133200, 38016, 0x9542db28
-0, 136800, 38016, 0xa67edc7f
-0, 140400, 38016, 0x65efdfa7
-0, 144000, 38016, 0x7039e6c6
-0, 147600, 38016, 0x8307ee87
-0, 151200, 38016, 0x1f83ec00
-0, 154800, 38016, 0x9e33ea6e
-0, 158400, 38016, 0xb53ef238
-0, 162000, 38016, 0x6d04930c
-0, 165600, 38016, 0xed90a50e
-0, 169200, 38016, 0xd98cb4a6
-0, 172800, 38016, 0xa7f5bd5e
-0, 176400, 38016, 0x4df9ca95
-0, 180000, 38016, 0xc8e7cb40
-0, 183600, 38016, 0x93d9d23c
-0, 187200, 38016, 0xc07fd34f
-0, 190800, 38016, 0xf7c5d645
-0, 194400, 38016, 0x3c1ddf53
-0, 198000, 38016, 0x0bafe394
-0, 201600, 38016, 0x9179ec6f
-0, 205200, 38016, 0x3483efc3
-0, 208800, 38016, 0xf7ccf70d
-0, 212400, 38016, 0x289ef13b
-0, 216000, 38016, 0xb00c99dc
-0, 219600, 38016, 0x59409b34
-0, 223200, 38016, 0x3fc079a2
-0, 226800, 38016, 0x90ad49d9
-0, 230400, 38016, 0x8e7751e2
-0, 234000, 38016, 0xed20743d
-0, 237600, 38016, 0x66a1a470
-0, 241200, 38016, 0x7a77e252
-0, 244800, 38016, 0x6bb427fe
-0, 248400, 38016, 0x87126360
-0, 252000, 38016, 0x330789d0
-0, 255600, 38016, 0xc298b987
-0, 259200, 38016, 0x4959f143
-0, 262800, 38016, 0xa66e3082
-0, 266400, 38016, 0xb9f67824
-0, 270000, 38016, 0x27fe46a2
-0, 273600, 38016, 0xc50c87ed
-0, 277200, 38016, 0x9523a9f6
-0, 280800, 38016, 0xbe28d1d7
-0, 284400, 38016, 0x3c0ee964
-0, 288000, 38016, 0x65c7f36c
-0, 291600, 38016, 0xe5030946
-0, 295200, 38016, 0x4bbb11fa
-0, 298800, 38016, 0xeaf209ed
-0, 302400, 38016, 0x96c80987
-0, 306000, 38016, 0x69820c58
-0, 309600, 38016, 0x5f951aa7
-0, 313200, 38016, 0xfe6122d9
-0, 316800, 38016, 0xa202301a
-0, 320400, 38016, 0xdd2628fb
-0, 324000, 38016, 0xe081a5ff
-0, 327600, 38016, 0x5b858e9e
-0, 331200, 38016, 0x7a368229
-0, 334800, 38016, 0x3791829a
-0, 338400, 38016, 0x9c68723d
-0, 342000, 38016, 0xef26778e
-0, 345600, 38016, 0x39a491cf
-0, 349200, 38016, 0x776ea867
-0, 352800, 38016, 0xda9ac03b
-0, 356400, 38016, 0x653bc9a3
-0, 360000, 38016, 0x79e1da19
-0, 363600, 38016, 0x3b98c6eb
-0, 367200, 38016, 0x42cdb846
-0, 370800, 38016, 0x7872ada1
-0, 374400, 38016, 0xb2f6d2ef
-0, 378000, 38016, 0x9468b16a
-0, 381600, 38016, 0xe793c91a
-0, 385200, 38016, 0x80bde366
-0, 388800, 38016, 0xa7250446
-0, 392400, 38016, 0x7039280b
-0, 396000, 38016, 0x1665350c
-0, 399600, 38016, 0xb5c93f1f
-0, 403200, 38016, 0xf77a4c44
-0, 406800, 38016, 0x3a093143
-0, 410400, 38016, 0x1d6b1005
-0, 414000, 38016, 0xe1a10c01
-0, 417600, 38016, 0x2d4d1d54
-0, 421200, 38016, 0x902f2b14
-0, 424800, 38016, 0xb26e3e73
-0, 428400, 38016, 0xed7a469e
-0, 432000, 38016, 0xbc663d2a
-0, 435600, 38016, 0x60a5488e
-0, 439200, 38016, 0x451b31ca
-0, 442800, 38016, 0x54311166
-0, 446400, 38016, 0x57d9f31e
-0, 450000, 38016, 0x567dd693
-0, 453600, 38016, 0x0e58d88c
-0, 457200, 38016, 0xa555e124
-0, 460800, 38016, 0x94e2f835
-0, 464400, 38016, 0xe49e0ec0
-0, 468000, 38016, 0x585d188e
-0, 471600, 38016, 0x696e1a0d
-0, 475200, 38016, 0xac9014b1
-0, 478800, 38016, 0x915413c6
-0, 482400, 38016, 0x5fa30be7
-0, 486000, 38016, 0x8fbfb69c
-0, 489600, 38016, 0xcaeabfab
-0, 493200, 38016, 0xe494bf5c
-0, 496800, 38016, 0xae03be55
-0, 500400, 38016, 0xb734b4d3
-0, 504000, 38016, 0xdc6fb56f
-0, 507600, 38016, 0xfea0a853
-0, 511200, 38016, 0xb4919381
-0, 514800, 38016, 0x13a792fe
-0, 518400, 38016, 0xc8829fd8
-0, 522000, 38016, 0x2113a62b
-0, 525600, 38016, 0x171f98d2
-0, 529200, 38016, 0x1a6d6d17
-0, 532800, 38016, 0xd4ab41c3
-0, 536400, 38016, 0xd2df1c80
-0, 540000, 38016, 0x14cdbb35
-0, 543600, 38016, 0x2b74b829
-0, 547200, 38016, 0x6433bd55
-0, 550800, 38016, 0xd11dbc28
-0, 554400, 38016, 0x4981ad33
-0, 558000, 38016, 0xc38bbbad
-0, 561600, 38016, 0x048de367
-0, 565200, 38016, 0x6c9a0c5a
-0, 568800, 38016, 0x384c4255
-0, 572400, 38016, 0x3e9873ba
-0, 576000, 38016, 0xe4988671
-0, 579600, 38016, 0x05b4843c
-0, 583200, 38016, 0xed0a7e13
-0, 586800, 38016, 0x750c6f90
-0, 590400, 38016, 0x9d296035
-0, 594000, 38016, 0xbaa006bd
-0, 597600, 38016, 0x8289f8ae
-0, 601200, 38016, 0x3f3de147
-0, 604800, 38016, 0xc5debc49
-0, 608400, 38016, 0x1fe9bbfc
-0, 612000, 38016, 0x006cd4a9
-0, 615600, 38016, 0xe551f2b3
-0, 619200, 38016, 0xb370140e
-0, 622800, 38016, 0xc9441c24
-0, 626400, 38016, 0x7f5c01c5
-0, 630000, 38016, 0x352ad9f6
-0, 633600, 38016, 0xe0909a17
-0, 637200, 38016, 0x49bf5ea8
-0, 640800, 38016, 0x7f1d387b
-0, 644400, 38016, 0x30812233
-0, 648000, 38016, 0xb0bdf16f
-0, 651600, 38016, 0x5372d0e9
-0, 655200, 38016, 0xbf1bc91c
-0, 658800, 38016, 0xaef5d647
-0, 662400, 38016, 0xf007e86c
-0, 666000, 38016, 0x683bf72b
-0, 669600, 38016, 0xbb722114
-0, 673200, 38016, 0xc5864b63
-0, 676800, 38016, 0xfefd5cf4
-0, 680400, 38016, 0xa0f263d5
-0, 684000, 38016, 0x18401a02
-0, 687600, 38016, 0x55cdd97b
-0, 691200, 38016, 0x5a4ee22d
-0, 694800, 38016, 0xa60706b3
-0, 698400, 38016, 0x644422bb
-0, 702000, 38016, 0xc22421c9
-0, 705600, 38016, 0x1d6b54e4
-0, 709200, 38016, 0xc7627820
-0, 712800, 38016, 0x0a6ea609
-0, 716400, 38016, 0x4315c087
-0, 720000, 38016, 0x3164d978
-0, 723600, 38016, 0x08e3e7eb
-0, 727200, 38016, 0x4f04eaed
-0, 730800, 38016, 0x9f83eb5a
-0, 734400, 38016, 0xfbbcf0b2
-0, 738000, 38016, 0xee1efb8a
-0, 741600, 38016, 0x87710ba0
-0, 745200, 38016, 0xb96b05c1
-0, 748800, 38016, 0xd5a4fc50
-0, 752400, 38016, 0xad85ea19
-0, 756000, 38016, 0x5f606058
-0, 759600, 38016, 0xdaf55ad0
-0, 763200, 38016, 0xee8564d6
-0, 766800, 38016, 0xa1846cad
-0, 770400, 38016, 0xcd316a62
-0, 774000, 38016, 0xdcf5638f
-0, 777600, 38016, 0xc5e36d1d
-0, 781200, 38016, 0x958369a6
-0, 784800, 38016, 0x05826bf0
-0, 788400, 38016, 0x22146914
-0, 792000, 38016, 0xf5086111
-0, 795600, 38016, 0x88f35468
-0, 799200, 38016, 0x3ae94126
-0, 802800, 38016, 0xf4473aa8
-0, 806400, 38016, 0x430c3da2
-0, 810000, 38016, 0xaf95113e
-0, 813600, 38016, 0xa8a216d6
-0, 817200, 38016, 0xad2f328c
-0, 820800, 38016, 0xea724415
-0, 824400, 38016, 0x34016af4
-0, 828000, 38016, 0x4829a4cb
-0, 831600, 38016, 0x4b24bc67
-0, 835200, 38016, 0xb523f023
-0, 838800, 38016, 0x5c6d2305
-0, 842400, 38016, 0x39e63adc
-0, 846000, 38016, 0xf7c64a7c
-0, 849600, 38016, 0xd601680a
-0, 853200, 38016, 0xbbad6a12
-0, 856800, 38016, 0xddc1500f
-0, 860400, 38016, 0x1f1726e6
-0, 864000, 38016, 0x48aee68f
-0, 867600, 38016, 0xc1fbd4f0
-0, 871200, 38016, 0x4a89dc83
-0, 874800, 38016, 0xa7cd2b02
-0, 878400, 38016, 0xf52aa0b8
-0, 882000, 38016, 0x1f260626
-0, 885600, 38016, 0x80561eac
-0, 889200, 38016, 0x6687f8ef
-0, 892800, 38016, 0x986ab08f
-0, 896400, 38016, 0xb4923773
-0, 900000, 38016, 0x5cc2d603
-0, 903600, 38016, 0x9e8d93db
-0, 907200, 38016, 0x33fd8981
-0, 910800, 38016, 0xaf45e630
-0, 914400, 38016, 0x1227448e
-0, 918000, 38016, 0x424cccf0
-0, 921600, 38016, 0x03b0cb3e
-0, 925200, 38016, 0x7aad547d
-0, 928800, 38016, 0xbf8544b2
-0, 932400, 38016, 0x54a843ca
-0, 936000, 38016, 0x759d4dd0
-0, 939600, 38016, 0x000162da
-0, 943200, 38016, 0x87ec74b0
-0, 946800, 38016, 0xefee8259
-0, 950400, 38016, 0x7b547eea
-0, 954000, 38016, 0xcae96b73
-0, 957600, 38016, 0x730f59c3
-0, 961200, 38016, 0x7d9b3e82
-0, 964800, 38016, 0x3bb11ef0
-0, 968400, 38016, 0x7581fa6b
-0, 972000, 38016, 0xe594a982
-0, 975600, 38016, 0xde3888d6
-0, 979200, 38016, 0x0e096d6b
-0, 982800, 38016, 0x297c20dc
-0, 986400, 38016, 0x51f7ce7f
-0, 990000, 38016, 0x23d2c247
-0, 993600, 38016, 0x0bdcd0d0
-0, 997200, 38016, 0x63cfd4f3
-0, 1000800, 38016, 0x6d4b01f8
-0, 1004400, 38016, 0xa50d72f0
-0, 1008000, 38016, 0xccad0d72
-0, 1011600, 38016, 0x10c9e33e
-0, 1015200, 38016, 0xba6daf97
-0, 1018800, 38016, 0xd65074e0
-0, 1022400, 38016, 0xd36954aa
-0, 1026000, 38016, 0xd9a2a642
-0, 1029600, 38016, 0xce755f9f
-0, 1033200, 38016, 0x81d29c44
-0, 1036800, 38016, 0x23b0aef5
-0, 1040400, 38016, 0xb0ef9efa
-0, 1044000, 38016, 0xf20d4a7a
-0, 1047600, 38016, 0xa0c86899
-0, 1051200, 38016, 0x1ae4f865
-0, 1054800, 38016, 0x3a5731c8
-0, 1058400, 38016, 0x75f17ec5
-0, 1062000, 38016, 0x8f447aa9
-0, 1065600, 38016, 0x71615441
-0, 1069200, 38016, 0x90c13e26
-0, 1072800, 38016, 0x08d04aaf
-0, 1076400, 38016, 0x14fd7b04
diff --git a/tests/ref/fate/h264-conformance-cabac_mot_fld0_full b/tests/ref/fate/h264-conformance-cabac_mot_fld0_full
deleted file mode 100644
index a88e0c1..0000000
--- a/tests/ref/fate/h264-conformance-cabac_mot_fld0_full
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0xbf168f4e
-0, 3600, 518400, 0xeda5e54f
-0, 7200, 518400, 0xef496d43
-0, 10800, 518400, 0x6b68dad5
-0, 14400, 518400, 0x9a40a7de
-0, 18000, 518400, 0x0c21c018
-0, 21600, 518400, 0x4ac5a846
-0, 25200, 518400, 0x3a1aa817
-0, 28800, 518400, 0xcc4eb434
-0, 32400, 518400, 0x4368a3c2
-0, 36000, 518400, 0xb923682f
-0, 39600, 518400, 0xd95460a8
-0, 43200, 518400, 0x8e8518aa
-0, 46800, 518400, 0x292a1a80
-0, 50400, 518400, 0xbada388e
-0, 54000, 518400, 0xa67f63c9
-0, 57600, 518400, 0x9fc77e21
-0, 61200, 518400, 0xe99dc2ac
-0, 64800, 518400, 0x17d7d080
-0, 68400, 518400, 0x41760c0b
-0, 72000, 518400, 0x3c70f34d
-0, 75600, 518400, 0x0d640285
-0, 79200, 518400, 0x448893e8
-0, 82800, 518400, 0x08194490
-0, 86400, 518400, 0xcf227031
-0, 90000, 518400, 0x8d94587d
-0, 93600, 518400, 0x696fca01
-0, 97200, 518400, 0xe0ab234b
-0, 100800, 518400, 0x0620153b
-0, 104400, 518400, 0xb78c146c
diff --git a/tests/ref/fate/h264-conformance-cabac_mot_frm0_full b/tests/ref/fate/h264-conformance-cabac_mot_frm0_full
deleted file mode 100644
index 437a86b..0000000
--- a/tests/ref/fate/h264-conformance-cabac_mot_frm0_full
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x40c7e2d9
-0, 3600, 518400, 0xb16701a5
-0, 7200, 518400, 0x12c2f5b1
-0, 10800, 518400, 0x9832aecc
-0, 14400, 518400, 0x2b8bcdec
-0, 18000, 518400, 0x04448f3a
-0, 21600, 518400, 0xc7ac82d8
-0, 25200, 518400, 0xe746bb8a
-0, 28800, 518400, 0xc7ac92d3
-0, 32400, 518400, 0x38d89443
-0, 36000, 518400, 0xcb9fbe74
-0, 39600, 518400, 0x5543867d
-0, 43200, 518400, 0xaf1b147f
-0, 46800, 518400, 0xe5f07e40
-0, 50400, 518400, 0x66dc6734
-0, 54000, 518400, 0x0f9491be
-0, 57600, 518400, 0xbcdaacac
-0, 61200, 518400, 0xf4480ae7
-0, 64800, 518400, 0xa5cef4d5
-0, 68400, 518400, 0x9e4e4320
-0, 72000, 518400, 0x620c3212
-0, 75600, 518400, 0x4350df1d
-0, 79200, 518400, 0x6360ef84
-0, 82800, 518400, 0xc1866d03
-0, 86400, 518400, 0x38eb3b5b
-0, 90000, 518400, 0x00166df1
-0, 93600, 518400, 0x841ea87c
-0, 97200, 518400, 0x8b40f836
-0, 100800, 518400, 0x3b380ddf
-0, 104400, 518400, 0x275adf46
diff --git a/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full b/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full
deleted file mode 100644
index 0e582f3..0000000
--- a/tests/ref/fate/h264-conformance-cabac_mot_mbaff0_full
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x8336b7db
-0, 3600, 518400, 0x9818c309
-0, 7200, 518400, 0x5417b6f9
-0, 10800, 518400, 0x8f0a5de4
-0, 14400, 518400, 0xa4ce43f3
-0, 18000, 518400, 0xfe748339
-0, 21600, 518400, 0xeab93a93
-0, 25200, 518400, 0x095176e4
-0, 28800, 518400, 0x99a45050
-0, 32400, 518400, 0xad3766e8
-0, 36000, 518400, 0xea133c1b
-0, 39600, 518400, 0xdcb2188b
-0, 43200, 518400, 0xec08c8ce
-0, 46800, 518400, 0xf38cd4f2
-0, 50400, 518400, 0x06177f80
-0, 54000, 518400, 0x2c68b642
-0, 57600, 518400, 0x7d290881
-0, 61200, 518400, 0x26c939d8
-0, 64800, 518400, 0xa0391a6e
-0, 68400, 518400, 0x3b9f02c1
-0, 72000, 518400, 0x335a0ff9
-0, 75600, 518400, 0x0deafb41
-0, 79200, 518400, 0xbf00bfe4
-0, 82800, 518400, 0xc9145210
-0, 86400, 518400, 0xb6e16a54
-0, 90000, 518400, 0xc31664da
-0, 93600, 518400, 0xfd3be55d
-0, 97200, 518400, 0xf33b134c
-0, 100800, 518400, 0xc6977304
-0, 104400, 518400, 0xa605bdb6
diff --git a/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full b/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full
deleted file mode 100644
index f2d6358..0000000
--- a/tests/ref/fate/h264-conformance-cabac_mot_picaff0_full
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0xd8b58a23
-0, 3600, 518400, 0xe53b4aba
-0, 7200, 518400, 0x6cbca47a
-0, 10800, 518400, 0xceb51253
-0, 14400, 518400, 0x60cb3cdd
-0, 18000, 518400, 0x7b633553
-0, 21600, 518400, 0x10c012c9
-0, 25200, 518400, 0xa340ee20
-0, 28800, 518400, 0x574c22c2
-0, 32400, 518400, 0xbcdb1bf7
-0, 36000, 518400, 0x57811e9a
-0, 39600, 518400, 0xdd4af748
-0, 43200, 518400, 0xb931a637
-0, 46800, 518400, 0xcef6ce95
-0, 50400, 518400, 0xd28c7085
-0, 54000, 518400, 0xae9daf53
-0, 57600, 518400, 0xca29d819
-0, 61200, 518400, 0x3c4bd7eb
-0, 64800, 518400, 0x912ee227
-0, 68400, 518400, 0xb67d0e27
-0, 72000, 518400, 0x8cf7309d
-0, 75600, 518400, 0x358ad344
-0, 79200, 518400, 0x4462c642
-0, 82800, 518400, 0x3bb43428
-0, 86400, 518400, 0x12d6f8ca
-0, 90000, 518400, 0x003f13aa
-0, 93600, 518400, 0x6cd8c432
-0, 97200, 518400, 0xee5ff01b
-0, 100800, 518400, 0xba0616ee
-0, 104400, 518400, 0x37fa7891
diff --git a/tests/ref/fate/h264-conformance-cabaci3_sony_b b/tests/ref/fate/h264-conformance-cabaci3_sony_b
deleted file mode 100644
index f0ea8c2..0000000
--- a/tests/ref/fate/h264-conformance-cabaci3_sony_b
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0x705f2f41
-0, 3600, 38016, 0xa76d1766
-0, 7200, 38016, 0xf367e6f4
-0, 10800, 38016, 0xdce8a69a
-0, 14400, 38016, 0xda9d986e
-0, 18000, 38016, 0x50117ea5
-0, 21600, 38016, 0x07a848eb
-0, 25200, 38016, 0x28ab4f59
-0, 28800, 38016, 0xf6913e4c
-0, 32400, 38016, 0x3daa3500
-0, 36000, 38016, 0xe9f67703
-0, 39600, 38016, 0x9a5289e6
-0, 43200, 38016, 0x9efd705f
-0, 46800, 38016, 0x1193b01d
-0, 50400, 38016, 0x30a5acd7
-0, 54000, 38016, 0x7e3da07d
-0, 57600, 38016, 0x0f85afc6
-0, 61200, 38016, 0x8b7ba455
-0, 64800, 38016, 0xac327dfb
-0, 68400, 38016, 0x3eee7fdb
-0, 72000, 38016, 0x37fa626b
-0, 75600, 38016, 0x2c4f2501
-0, 79200, 38016, 0xa25a239a
-0, 82800, 38016, 0xe69b2327
-0, 86400, 38016, 0x6bd6164e
-0, 90000, 38016, 0xae9c2daa
-0, 93600, 38016, 0xe115331d
-0, 97200, 38016, 0xde8f2833
-0, 100800, 38016, 0xd0b45915
-0, 104400, 38016, 0x3ab16824
-0, 108000, 38016, 0x4df45e8d
-0, 111600, 38016, 0x48569b82
-0, 115200, 38016, 0x75c5b1ee
-0, 118800, 38016, 0x64e5a3ba
-0, 122400, 38016, 0x3190d133
-0, 126000, 38016, 0x4825ce86
-0, 129600, 38016, 0x8f85ab8e
-0, 133200, 38016, 0x3fb1cbc5
-0, 136800, 38016, 0x2b2cbe7d
-0, 140400, 38016, 0xa905a6a6
-0, 144000, 38016, 0x6365c188
-0, 147600, 38016, 0xff23c08d
-0, 151200, 38016, 0x73edada6
-0, 154800, 38016, 0x6be0b8a9
-0, 158400, 38016, 0x604bb6c9
-0, 162000, 38016, 0x62468a3b
-0, 165600, 38016, 0x994aad7a
-0, 169200, 38016, 0xfee1b59e
-0, 172800, 38016, 0xf722aa78
-0, 176400, 38016, 0x0ddfbf68
-0, 180000, 38016, 0x510ab7b1
-0, 183600, 38016, 0x156ca919
-0, 187200, 38016, 0xb176b488
-0, 190800, 38016, 0xd70cb8f8
-0, 194400, 38016, 0x3844b2d2
-0, 198000, 38016, 0x0ed8c6ee
-0, 201600, 38016, 0x0c6ac5ff
-0, 205200, 38016, 0x1284c442
-0, 208800, 38016, 0x0486d06c
-0, 212400, 38016, 0x0d42d1c1
-0, 216000, 38016, 0xd24297f3
-0, 219600, 38016, 0xe05cab59
-0, 223200, 38016, 0x12f1921f
-0, 226800, 38016, 0x0dc6403e
-0, 230400, 38016, 0x277f593c
-0, 234000, 38016, 0xfb7c81f8
-0, 237600, 38016, 0xb31b90b0
-0, 241200, 38016, 0x8be3e8ae
-0, 244800, 38016, 0x9aaa1ff1
-0, 248400, 38016, 0x4e6832b9
-0, 252000, 38016, 0x93fd6a5e
-0, 255600, 38016, 0xd9438f08
-0, 259200, 38016, 0x5e41b067
-0, 262800, 38016, 0xee80f32a
-0, 266400, 38016, 0x75632fe3
-0, 270000, 38016, 0xc0a93ec1
-0, 273600, 38016, 0x4e3e80c4
-0, 277200, 38016, 0x9e5398d6
-0, 280800, 38016, 0xd20aac32
-0, 284400, 38016, 0xacf5c5da
-0, 288000, 38016, 0xbe6bca1a
-0, 291600, 38016, 0x098bdac2
-0, 295200, 38016, 0xe706e491
-0, 298800, 38016, 0xcda7d8ee
-0, 302400, 38016, 0xb1d4d3f4
-0, 306000, 38016, 0x3e20d6cd
-0, 309600, 38016, 0xf368e66a
-0, 313200, 38016, 0xbfbee5b1
-0, 316800, 38016, 0xb580ec3d
-0, 320400, 38016, 0xce8dec65
-0, 324000, 38016, 0xb6fda1c2
-0, 327600, 38016, 0xb2d5ad04
-0, 331200, 38016, 0x28959c5a
-0, 334800, 38016, 0x7b1d7c65
-0, 338400, 38016, 0x357e79cd
-0, 342000, 38016, 0x08f57396
-0, 345600, 38016, 0xe59973b8
-0, 349200, 38016, 0x288a9c28
-0, 352800, 38016, 0x09a4a82f
-0, 356400, 38016, 0x61b5a518
-0, 360000, 38016, 0xddbfb88d
-0, 363600, 38016, 0x14b5a41e
-0, 367200, 38016, 0x56588add
-0, 370800, 38016, 0x7e3890c1
-0, 374400, 38016, 0xbb1eb4df
-0, 378000, 38016, 0x3b34a7d8
-0, 381600, 38016, 0xe15ddc56
-0, 385200, 38016, 0x9ed7ff21
-0, 388800, 38016, 0x03200458
-0, 392400, 38016, 0x74493572
-0, 396000, 38016, 0x73d14274
-0, 399600, 38016, 0x02933587
-0, 403200, 38016, 0x5ea74e05
-0, 406800, 38016, 0xd73d303e
-0, 410400, 38016, 0x0a17f1ea
-0, 414000, 38016, 0x915f0dcd
-0, 417600, 38016, 0xca041a88
-0, 421200, 38016, 0xc6a303b2
-0, 424800, 38016, 0x2c903df2
-0, 428400, 38016, 0x2dd04691
-0, 432000, 38016, 0xfe783551
-0, 435600, 38016, 0x900c419c
-0, 439200, 38016, 0x01b92a15
-0, 442800, 38016, 0xcce4e851
-0, 446400, 38016, 0x0167d6f6
-0, 450000, 38016, 0x023eb3fa
-0, 453600, 38016, 0xafc29caa
-0, 457200, 38016, 0xf205b88c
-0, 460800, 38016, 0x5518cc46
-0, 464400, 38016, 0x64cdd1d5
-0, 468000, 38016, 0x8e9eecb4
-0, 471600, 38016, 0xd1e0e2f8
-0, 475200, 38016, 0xb849cf3c
-0, 478800, 38016, 0xb5e4d916
-0, 482400, 38016, 0xc6c5da7e
-0, 486000, 38016, 0xcbcda68d
-0, 489600, 38016, 0x21d7bd73
-0, 493200, 38016, 0x6737b4b9
-0, 496800, 38016, 0x379f9a5f
-0, 500400, 38016, 0xa13da6cc
-0, 504000, 38016, 0x06fc941a
-0, 507600, 38016, 0x78c57e95
-0, 511200, 38016, 0x2f6674d4
-0, 514800, 38016, 0x37776db9
-0, 518400, 38016, 0x257268db
-0, 522000, 38016, 0x1dbe7e72
-0, 525600, 38016, 0x2cb96bb0
-0, 529200, 38016, 0x46a840f2
-0, 532800, 38016, 0x95951fd6
-0, 536400, 38016, 0x627ef7b2
-0, 540000, 38016, 0xa5b0b2d3
-0, 543600, 38016, 0x69fdcae9
-0, 547200, 38016, 0x0c25c873
-0, 550800, 38016, 0x3533a2cc
-0, 554400, 38016, 0x3a74b6c2
-0, 558000, 38016, 0x9d1dcbc1
-0, 561600, 38016, 0xce33cf86
-0, 565200, 38016, 0xf34201f5
-0, 568800, 38016, 0xab5f2e2b
-0, 572400, 38016, 0xf062405d
-0, 576000, 38016, 0xe7f85f7c
-0, 579600, 38016, 0x684f4ee4
-0, 583200, 38016, 0x41b83014
-0, 586800, 38016, 0x70142f5f
-0, 590400, 38016, 0x3cb229b1
-0, 594000, 38016, 0x6bd1f24c
-0, 597600, 38016, 0x9366ec77
-0, 601200, 38016, 0x6af0c1ec
-0, 604800, 38016, 0xb11a9005
-0, 608400, 38016, 0x83e390b7
-0, 612000, 38016, 0x97679ab5
-0, 615600, 38016, 0xabe3b114
-0, 619200, 38016, 0x2efed19f
-0, 622800, 38016, 0x18eddb2e
-0, 626400, 38016, 0x0a37c6fb
-0, 630000, 38016, 0xddb0a2fe
-0, 633600, 38016, 0xf8627091
-0, 637200, 38016, 0x97123074
-0, 640800, 38016, 0x33af3174
-0, 644400, 38016, 0x5caa22fe
-0, 648000, 38016, 0xa203eccf
-0, 651600, 38016, 0x506eee0c
-0, 655200, 38016, 0x2066d541
-0, 658800, 38016, 0xe08acab1
-0, 662400, 38016, 0x6740ecc4
-0, 666000, 38016, 0x954dfd6d
-0, 669600, 38016, 0xbd7ffef8
-0, 673200, 38016, 0x629f2cca
-0, 676800, 38016, 0xebd92f12
-0, 680400, 38016, 0xe5bd297f
-0, 684000, 38016, 0xcb2be670
-0, 687600, 38016, 0x51d7b529
-0, 691200, 38016, 0x95d7ab30
-0, 694800, 38016, 0x18e3df99
-0, 698400, 38016, 0xae3af726
-0, 702000, 38016, 0x9b831ee3
-0, 705600, 38016, 0x3c614e45
-0, 709200, 38016, 0x3c0a600c
-0, 712800, 38016, 0xdade838b
-0, 716400, 38016, 0xbbe3a0a7
-0, 720000, 38016, 0xd4d5b780
-0, 723600, 38016, 0xceebb4b7
-0, 727200, 38016, 0x1a8ccbb3
-0, 730800, 38016, 0x95dccfab
-0, 734400, 38016, 0xea9bc737
-0, 738000, 38016, 0xa0f6d561
-0, 741600, 38016, 0x7877d698
-0, 745200, 38016, 0xd6aad54c
-0, 748800, 38016, 0xca62c8b7
-0, 752400, 38016, 0xebc9ae1c
-0, 756000, 38016, 0x46c96194
-0, 759600, 38016, 0x61197fc4
-0, 763200, 38016, 0x9ae97570
-0, 766800, 38016, 0x7cd254da
-0, 770400, 38016, 0xe4816953
-0, 774000, 38016, 0x68685b2c
-0, 777600, 38016, 0x08d93f79
-0, 781200, 38016, 0xb4cc526b
-0, 784800, 38016, 0xc0d253d9
-0, 788400, 38016, 0x95b83d64
-0, 792000, 38016, 0xadf7454f
-0, 795600, 38016, 0xaa1d339b
-0, 799200, 38016, 0xae0417f8
-0, 802800, 38016, 0x09d2294d
-0, 806400, 38016, 0xbd892e9d
-0, 810000, 38016, 0xbccd0f97
-0, 813600, 38016, 0x03c13bd3
-0, 817200, 38016, 0x09d045d7
-0, 820800, 38016, 0xaa484278
-0, 824400, 38016, 0x054b8639
-0, 828000, 38016, 0x45e29e62
-0, 831600, 38016, 0x38bbb067
-0, 835200, 38016, 0x9f5cfc30
-0, 838800, 38016, 0x38551b76
-0, 842400, 38016, 0x3e1b18ee
-0, 846000, 38016, 0x7baf4e34
-0, 849600, 38016, 0xff6458d1
-0, 853200, 38016, 0xb7963c49
-0, 856800, 38016, 0xdaee3f6a
-0, 860400, 38016, 0xc88e09c9
-0, 864000, 38016, 0x88a7de38
-0, 867600, 38016, 0x9e81cb62
-0, 871200, 38016, 0x84d0aca7
-0, 874800, 38016, 0x3312f41e
-0, 878400, 38016, 0x550065dc
-0, 882000, 38016, 0x7e88d07e
-0, 885600, 38016, 0x9370ed4f
-0, 889200, 38016, 0xd9c9d592
-0, 892800, 38016, 0xec7589ce
-0, 896400, 38016, 0xeca71251
-0, 900000, 38016, 0xf183b951
-0, 903600, 38016, 0x9a1b740a
-0, 907200, 38016, 0x97ea5ffc
-0, 910800, 38016, 0x058dc572
-0, 914400, 38016, 0xae44345a
-0, 918000, 38016, 0xef22c82e
-0, 921600, 38016, 0x8364d583
-0, 925200, 38016, 0x2f725dfa
-0, 928800, 38016, 0x5eda3160
-0, 932400, 38016, 0x4a464613
-0, 936000, 38016, 0x447f444d
-0, 939600, 38016, 0x076b3dd8
-0, 943200, 38016, 0x690f58de
-0, 946800, 38016, 0xf4635e91
-0, 950400, 38016, 0xd5db44e7
-0, 954000, 38016, 0xced25176
-0, 957600, 38016, 0x227a2f9a
-0, 961200, 38016, 0x72100520
-0, 964800, 38016, 0x6549f9b4
-0, 968400, 38016, 0x3f77cef4
-0, 972000, 38016, 0x3d1ba72f
-0, 975600, 38016, 0xa1dd85d2
-0, 979200, 38016, 0x9a35655e
-0, 982800, 38016, 0xdc900dc6
-0, 986400, 38016, 0xca05d5cb
-0, 990000, 38016, 0xeff0be86
-0, 993600, 38016, 0xdcceb22e
-0, 997200, 38016, 0x5952d133
-0, 1000800, 38016, 0x3ab3facb
-0, 1004400, 38016, 0xdb8d4de4
-0, 1008000, 38016, 0x0afc170d
-0, 1011600, 38016, 0xd14ddc59
-0, 1015200, 38016, 0xbabf89eb
-0, 1018800, 38016, 0x09d38f7b
-0, 1022400, 38016, 0xe4805dba
-0, 1026000, 38016, 0x4d919dcf
-0, 1029600, 38016, 0x3e8c60be
-0, 1033200, 38016, 0x6c1fa94b
-0, 1036800, 38016, 0x6b68a320
-0, 1040400, 38016, 0x9de774f6
-0, 1044000, 38016, 0x38d0ecc6
-0, 1047600, 38016, 0x0623207f
-0, 1051200, 38016, 0x36429915
-0, 1054800, 38016, 0x659fdd42
-0, 1058400, 38016, 0x59c93475
-0, 1062000, 38016, 0xecd1200d
-0, 1065600, 38016, 0x3b2af9c2
-0, 1069200, 38016, 0xd00600da
-0, 1072800, 38016, 0xb0bc21ee
-0, 1076400, 38016, 0xc11f3ec2
diff --git a/tests/ref/fate/h264-conformance-cabast3_sony_e b/tests/ref/fate/h264-conformance-cabast3_sony_e
deleted file mode 100644
index 06c9f1c..0000000
--- a/tests/ref/fate/h264-conformance-cabast3_sony_e
+++ /dev/null
@@ -1,25 +0,0 @@
-0, 0, 152064, 0x96ebb3a2
-0, 3600, 152064, 0x5184d912
-0, 7200, 152064, 0xfa0c9abe
-0, 10800, 152064, 0x6dd81860
-0, 14400, 152064, 0xc5202966
-0, 18000, 152064, 0xa7dfdf71
-0, 21600, 152064, 0xffa5609f
-0, 25200, 152064, 0x352e7ce5
-0, 28800, 152064, 0xc9e52c2a
-0, 32400, 152064, 0x12dfd28d
-0, 36000, 152064, 0x962af5fe
-0, 39600, 152064, 0xa8459cb1
-0, 43200, 152064, 0xc0771945
-0, 46800, 152064, 0xfcbc351d
-0, 50400, 152064, 0xd925dfa3
-0, 54000, 152064, 0x7c627c21
-0, 57600, 152064, 0x617d8d96
-0, 61200, 152064, 0x91816b34
-0, 64800, 152064, 0xece0eaf8
-0, 68400, 152064, 0x7b1408ef
-0, 72000, 152064, 0x7430c4d2
-0, 75600, 152064, 0xdb5844fa
-0, 79200, 152064, 0xcc874ff7
-0, 82800, 152064, 0x97630fb8
-0, 86400, 152064, 0x16ae9c92
diff --git a/tests/ref/fate/h264-conformance-cabastbr3_sony_b b/tests/ref/fate/h264-conformance-cabastbr3_sony_b
deleted file mode 100644
index d51959b..0000000
--- a/tests/ref/fate/h264-conformance-cabastbr3_sony_b
+++ /dev/null
@@ -1,25 +0,0 @@
-0, 0, 152064, 0x96ebb3a2
-0, 3600, 152064, 0x5184d912
-0, 7200, 152064, 0xb7b5ba68
-0, 10800, 152064, 0x6dd81860
-0, 14400, 152064, 0xcffe2ff0
-0, 18000, 152064, 0x27740140
-0, 21600, 152064, 0xffa5609f
-0, 25200, 152064, 0x05e9a6c6
-0, 28800, 152064, 0xa5ea5692
-0, 32400, 152064, 0x78a9dd79
-0, 36000, 152064, 0x2bf218b3
-0, 39600, 152064, 0x4591cadc
-0, 43200, 152064, 0x075428a8
-0, 46800, 152064, 0xbbda56d8
-0, 50400, 152064, 0xc8fa1a28
-0, 54000, 152064, 0x7c627c21
-0, 57600, 152064, 0x9043ba42
-0, 61200, 152064, 0xb426940d
-0, 64800, 152064, 0x51d4058b
-0, 68400, 152064, 0xb7513536
-0, 72000, 152064, 0xe906ffab
-0, 75600, 152064, 0x3d075443
-0, 79200, 152064, 0x85c37afd
-0, 82800, 152064, 0x2ac74040
-0, 86400, 152064, 0x3a08aa90
diff --git a/tests/ref/fate/h264-conformance-cabref3_sand_d b/tests/ref/fate/h264-conformance-cabref3_sand_d
deleted file mode 100644
index 7d75e01..0000000
--- a/tests/ref/fate/h264-conformance-cabref3_sand_d
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 152064, 0x2061bbd0
-0, 3600, 152064, 0x41adb750
-0, 7200, 152064, 0x6e889e90
-0, 10800, 152064, 0xbb5e60f5
-0, 14400, 152064, 0x5a32eca7
-0, 18000, 152064, 0x5cb05e88
-0, 21600, 152064, 0x2fff3e6c
-0, 25200, 152064, 0xd917c85e
-0, 28800, 152064, 0x6eac446f
-0, 32400, 152064, 0x238b24b0
-0, 36000, 152064, 0x3f3bd44c
-0, 39600, 152064, 0x73982bc5
-0, 43200, 152064, 0xf6188a82
-0, 46800, 152064, 0x818c5b41
-0, 50400, 152064, 0x000d1012
-0, 54000, 152064, 0xc4a8750e
-0, 57600, 152064, 0x1689bb77
-0, 61200, 152064, 0x8f52f338
-0, 64800, 152064, 0xbf5ee06b
-0, 68400, 152064, 0x89508ad7
-0, 72000, 152064, 0x2b1986a6
-0, 75600, 152064, 0xe6fd6b0e
-0, 79200, 152064, 0x883e2e4e
-0, 82800, 152064, 0xd133db07
-0, 86400, 152064, 0x39b3bb22
-0, 90000, 152064, 0x8447410a
-0, 93600, 152064, 0x9c66c6e5
-0, 97200, 152064, 0x514de9cc
-0, 100800, 152064, 0x08d9f1da
-0, 104400, 152064, 0x8f10f536
-0, 108000, 152064, 0x57d4b27b
-0, 111600, 152064, 0x46f56d3c
-0, 115200, 152064, 0x5d260230
-0, 118800, 152064, 0x4a72aeac
-0, 122400, 152064, 0x5cfe187f
-0, 126000, 152064, 0x08e55cb2
-0, 129600, 152064, 0x4727f34f
-0, 133200, 152064, 0xd6a26f1c
-0, 136800, 152064, 0xcc1fcf9c
-0, 140400, 152064, 0x3681b775
-0, 144000, 152064, 0xf580c7d9
-0, 147600, 152064, 0xaa6747fb
-0, 151200, 152064, 0x2e22f9f9
-0, 154800, 152064, 0xb3ee6d81
-0, 158400, 152064, 0x930b0145
-0, 162000, 152064, 0xae36af99
-0, 165600, 152064, 0xeb58fd26
-0, 169200, 152064, 0xb9004da3
-0, 172800, 152064, 0x2b25e444
-0, 176400, 152064, 0xb36927de
diff --git a/tests/ref/fate/h264-conformance-cacqp3_sony_d b/tests/ref/fate/h264-conformance-cacqp3_sony_d
deleted file mode 100644
index 56881b3..0000000
--- a/tests/ref/fate/h264-conformance-cacqp3_sony_d
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 38016, 0x295a375c
-0, 3600, 38016, 0xd0da1f37
-0, 7200, 38016, 0x0e5ed514
-0, 10800, 38016, 0x477dcbe7
-0, 14400, 38016, 0x2e0980f3
-0, 18000, 38016, 0xf6d0888f
-0, 21600, 38016, 0x884f4bf2
-0, 25200, 38016, 0x75135ea9
-0, 28800, 38016, 0xc85031bd
-0, 32400, 38016, 0x4dde6353
-0, 36000, 38016, 0x8c8f4f2a
-0, 39600, 38016, 0xbdae892b
-0, 43200, 38016, 0x4898783a
-0, 46800, 38016, 0xb4cc9d6b
-0, 50400, 38016, 0xd24f8797
-0, 54000, 38016, 0x74c4a0df
-0, 57600, 38016, 0x43e58a83
-0, 61200, 38016, 0x05bba901
-0, 64800, 38016, 0xe2d57f63
-0, 68400, 38016, 0xdb398611
-0, 72000, 38016, 0x7f143de2
-0, 75600, 38016, 0xff39406f
-0, 79200, 38016, 0xfed61162
-0, 82800, 38016, 0xb9e62a1e
-0, 86400, 38016, 0x65f316d1
-0, 90000, 38016, 0xda782b9c
-0, 93600, 38016, 0xb64b202c
-0, 97200, 38016, 0xb2b141ea
-0, 100800, 38016, 0xdb6b421b
-0, 104400, 38016, 0xf3287342
-0, 108000, 38016, 0xfbb35b92
-0, 111600, 38016, 0x8c77a0de
-0, 115200, 38016, 0x326c9cb4
-0, 118800, 38016, 0x7e73cc0c
-0, 122400, 38016, 0xb948b8e9
-0, 126000, 38016, 0x6f7adb29
-0, 129600, 38016, 0xb629b8c5
-0, 133200, 38016, 0xf798ccd4
-0, 136800, 38016, 0xde5bb331
-0, 140400, 38016, 0xbca4d8dc
-0, 144000, 38016, 0x9369ba10
-0, 147600, 38016, 0x581ed965
-0, 151200, 38016, 0xce7bbd59
-0, 154800, 38016, 0x95d9ce3d
-0, 158400, 38016, 0x6154bd98
-0, 162000, 38016, 0xa279c487
-0, 165600, 38016, 0x8169b5a6
-0, 169200, 38016, 0x709dc334
-0, 172800, 38016, 0x82aabea1
-0, 176400, 38016, 0x6923c4c3
diff --git a/tests/ref/fate/h264-conformance-cafi1_sva_c b/tests/ref/fate/h264-conformance-cafi1_sva_c
deleted file mode 100644
index c652ce2..0000000
--- a/tests/ref/fate/h264-conformance-cafi1_sva_c
+++ /dev/null
@@ -1,33 +0,0 @@
-0, 0, 518400, 0x47bd73fa
-0, 3600, 518400, 0xfe3ea7cc
-0, 7200, 518400, 0x9bc549ae
-0, 10800, 518400, 0x7bb7f0a1
-0, 14400, 518400, 0x328903d4
-0, 18000, 518400, 0x96ab366b
-0, 21600, 518400, 0xa923eed3
-0, 25200, 518400, 0x162b08f6
-0, 28800, 518400, 0xe711bd8b
-0, 32400, 518400, 0x55e2d4ed
-0, 36000, 518400, 0x7dd3107b
-0, 39600, 518400, 0x0ed20bcf
-0, 43200, 518400, 0x352f5743
-0, 46800, 518400, 0x0a3aeb5e
-0, 50400, 518400, 0xc458eda3
-0, 54000, 518400, 0xe8d5fec5
-0, 57600, 518400, 0x18fc6c37
-0, 61200, 518400, 0x448add76
-0, 64800, 518400, 0x8741ead7
-0, 68400, 518400, 0x7008a751
-0, 72000, 518400, 0x4ca0633d
-0, 75600, 518400, 0x021ab800
-0, 79200, 518400, 0xfb91ba57
-0, 82800, 518400, 0x90e71dd0
-0, 86400, 518400, 0xac859de5
-0, 90000, 518400, 0xce9790bd
-0, 93600, 518400, 0x010ade8b
-0, 97200, 518400, 0xd0b3a399
-0, 100800, 518400, 0x6cafcff3
-0, 104400, 518400, 0xc32284c0
-0, 108000, 518400, 0x1af8f73e
-0, 111600, 518400, 0x3babd71e
-0, 115200, 518400, 0xd77cb86b
diff --git a/tests/ref/fate/h264-conformance-cama1_sony_c b/tests/ref/fate/h264-conformance-cama1_sony_c
deleted file mode 100644
index 6b309aa..0000000
--- a/tests/ref/fate/h264-conformance-cama1_sony_c
+++ /dev/null
@@ -1,5 +0,0 @@
-0, 0, 518400, 0x75701511
-0, 3600, 518400, 0xa7eeaa16
-0, 7200, 518400, 0xe0f32e35
-0, 10800, 518400, 0x7a1dadd9
-0, 14400, 518400, 0x4a1672a6
diff --git a/tests/ref/fate/h264-conformance-cama1_toshiba_b b/tests/ref/fate/h264-conformance-cama1_toshiba_b
deleted file mode 100644
index 897e915..0000000
--- a/tests/ref/fate/h264-conformance-cama1_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0x9a9ce366
-0, 3600, 152064, 0xf4639828
-0, 7200, 152064, 0x625024a3
-0, 10800, 152064, 0x80dc2f9d
-0, 14400, 152064, 0xb2c4feea
-0, 18000, 152064, 0x4ec6ad64
-0, 21600, 152064, 0x1957bec3
-0, 25200, 152064, 0xb682799d
-0, 28800, 152064, 0x34cd2053
-0, 32400, 152064, 0x81490b4c
-0, 36000, 152064, 0x242dc943
-0, 39600, 152064, 0x3e126734
-0, 43200, 152064, 0x8e474ff8
-0, 46800, 152064, 0x239d2fbd
-0, 50400, 152064, 0x0ca3e16f
-0, 54000, 152064, 0x6161d7c2
-0, 57600, 152064, 0xca7ad1af
-0, 61200, 152064, 0xf8ef9026
-0, 64800, 152064, 0x01f2f4c1
-0, 68400, 152064, 0x510b19ec
-0, 72000, 152064, 0xe489028b
-0, 75600, 152064, 0x7a693c1e
-0, 79200, 152064, 0x276b23fe
-0, 82800, 152064, 0x0e9ced3a
-0, 86400, 152064, 0x658228f7
-0, 90000, 152064, 0x6a271bc3
-0, 93600, 152064, 0x431ecd8b
-0, 97200, 152064, 0x23a5ed14
-0, 100800, 152064, 0x76fbe121
-0, 104400, 152064, 0x471f919d
-0, 108000, 152064, 0x16bfabbc
-0, 111600, 152064, 0x0762993f
-0, 115200, 152064, 0x5a2b0b0e
-0, 118800, 152064, 0x81415ef7
-0, 122400, 152064, 0xb96e4164
-0, 126000, 152064, 0xf77aee83
-0, 129600, 152064, 0x6af81633
-0, 133200, 152064, 0xed78e5b5
-0, 136800, 152064, 0x67e38e2c
-0, 140400, 152064, 0x0417ae01
-0, 144000, 152064, 0x3887b312
-0, 147600, 152064, 0x3a4b70fb
-0, 151200, 152064, 0xcaae9e7f
-0, 154800, 152064, 0xaf9597be
-0, 158400, 152064, 0x9bae63d3
-0, 162000, 152064, 0x0e80825f
-0, 165600, 152064, 0x915661fd
-0, 169200, 152064, 0x67d3dc94
-0, 172800, 152064, 0x3dcf240c
-0, 176400, 152064, 0x127ff832
-0, 180000, 152064, 0xc8969981
-0, 183600, 152064, 0x57179c77
-0, 187200, 152064, 0x9f88656c
-0, 190800, 152064, 0xc28ff5d3
-0, 194400, 152064, 0xf100fad9
-0, 198000, 152064, 0xb570ce12
-0, 201600, 152064, 0xe8f28955
-0, 205200, 152064, 0x1f0a9549
-0, 208800, 152064, 0x22b17e9b
-0, 212400, 152064, 0x7cf1400e
-0, 216000, 152064, 0xafd273b7
-0, 219600, 152064, 0xeb9b712e
-0, 223200, 152064, 0x0f81de24
-0, 226800, 152064, 0x8f4e1953
-0, 230400, 152064, 0x682e2170
-0, 234000, 152064, 0xc32ad1b2
-0, 237600, 152064, 0x53a81d79
-0, 241200, 152064, 0x54002596
-0, 244800, 152064, 0x4b5fdbd9
-0, 248400, 152064, 0x96613368
-0, 252000, 152064, 0xd6ac0171
-0, 255600, 152064, 0xf1c1b7b7
-0, 259200, 152064, 0xc730d82f
-0, 262800, 152064, 0x0415d934
-0, 266400, 152064, 0x5338915e
-0, 270000, 152064, 0x8e9dda6d
-0, 273600, 152064, 0xe3a8b0a0
-0, 277200, 152064, 0x5fa36e44
-0, 280800, 152064, 0x0e63dc72
-0, 284400, 152064, 0xd0dad71f
-0, 288000, 152064, 0x0c4aac94
-0, 291600, 152064, 0x60d50e8d
-0, 295200, 152064, 0x96872d7c
-0, 298800, 152064, 0x4fcefc33
-0, 302400, 152064, 0x6b8157c9
-0, 306000, 152064, 0xa40d527d
-0, 309600, 152064, 0x9884480a
-0, 313200, 152064, 0xff5d9754
-0, 316800, 152064, 0x4a26a74d
-0, 320400, 152064, 0x81059e82
diff --git a/tests/ref/fate/h264-conformance-cama1_vtc_c b/tests/ref/fate/h264-conformance-cama1_vtc_c
deleted file mode 100644
index 8c0e226..0000000
--- a/tests/ref/fate/h264-conformance-cama1_vtc_c
+++ /dev/null
@@ -1,4 +0,0 @@
-0, 0, 518400, 0x41c2ce17
-0, 3600, 518400, 0x39f217da
-0, 7200, 518400, 0x5a108db9
-0, 10800, 518400, 0x20cb214c
diff --git a/tests/ref/fate/h264-conformance-cama2_vtc_b b/tests/ref/fate/h264-conformance-cama2_vtc_b
deleted file mode 100644
index 8320f1f..0000000
--- a/tests/ref/fate/h264-conformance-cama2_vtc_b
+++ /dev/null
@@ -1,4 +0,0 @@
-0, 0, 622080, 0x004bb93f
-0, 3600, 622080, 0xe70e193c
-0, 7200, 622080, 0xd394cf17
-0, 10800, 622080, 0x9e4cc924
diff --git a/tests/ref/fate/h264-conformance-cama3_sand_e b/tests/ref/fate/h264-conformance-cama3_sand_e
deleted file mode 100644
index 77927c9..0000000
--- a/tests/ref/fate/h264-conformance-cama3_sand_e
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 152064, 0xf772f152
-0, 3600, 152064, 0x7c501772
-0, 7200, 152064, 0x98ed0a07
-0, 10800, 152064, 0x8f9289ae
-0, 14400, 152064, 0x4047c5e6
-0, 18000, 152064, 0xf1f11922
-0, 21600, 152064, 0xef8d8130
-0, 25200, 152064, 0x6cef489d
-0, 28800, 152064, 0x3743a97f
-0, 32400, 152064, 0x9d6b9846
-0, 36000, 152064, 0x332e05a7
-0, 39600, 152064, 0x7dad10af
-0, 43200, 152064, 0x835c99de
-0, 46800, 152064, 0x2ba3f9bb
-0, 50400, 152064, 0xf8ab5286
-0, 54000, 152064, 0x76624cca
-0, 57600, 152064, 0x8ebf6342
-0, 61200, 152064, 0x8756f87b
-0, 64800, 152064, 0xf005bc2f
-0, 68400, 152064, 0x9b1ae18e
-0, 72000, 152064, 0x3e1154aa
-0, 75600, 152064, 0x851e28d6
-0, 79200, 152064, 0x940a2518
-0, 82800, 152064, 0x861be99c
-0, 86400, 152064, 0x21a788a7
-0, 90000, 152064, 0x53e216eb
-0, 93600, 152064, 0x053cb9ec
-0, 97200, 152064, 0x3bb5cfc6
-0, 100800, 152064, 0x92b250c3
-0, 104400, 152064, 0xacc20f1c
-0, 108000, 152064, 0xb01256d3
-0, 111600, 152064, 0x6db62cf2
-0, 115200, 152064, 0x7fa3074d
-0, 118800, 152064, 0x63385103
-0, 122400, 152064, 0x83ba02b6
-0, 126000, 152064, 0x3731edbb
-0, 129600, 152064, 0xb73d5b99
-0, 133200, 152064, 0xd2e743e2
-0, 136800, 152064, 0x4bcd5bf2
-0, 140400, 152064, 0x45ef7b97
-0, 144000, 152064, 0x757952c6
-0, 147600, 152064, 0xed73e3db
-0, 151200, 152064, 0x8cf41b15
-0, 154800, 152064, 0x86e2b02d
-0, 158400, 152064, 0xf8d16c87
-0, 162000, 152064, 0x6720db65
-0, 165600, 152064, 0x67a5a150
-0, 169200, 152064, 0x1849fa2a
-0, 172800, 152064, 0xb0156742
-0, 176400, 152064, 0xde75b1fd
diff --git a/tests/ref/fate/h264-conformance-cama3_vtc_b b/tests/ref/fate/h264-conformance-cama3_vtc_b
deleted file mode 100644
index 8e7a351..0000000
--- a/tests/ref/fate/h264-conformance-cama3_vtc_b
+++ /dev/null
@@ -1,4 +0,0 @@
-0, 0, 622080, 0xf3f0bf86
-0, 3600, 622080, 0x6aaf3d42
-0, 7200, 622080, 0xe53bcd5d
-0, 10800, 622080, 0x8dabca9d
diff --git a/tests/ref/fate/h264-conformance-camaci3_sony_c b/tests/ref/fate/h264-conformance-camaci3_sony_c
deleted file mode 100644
index 643d803..0000000
--- a/tests/ref/fate/h264-conformance-camaci3_sony_c
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 36864, 0x9b5dcf28
-0, 3600, 36864, 0xb13d4fee
-0, 7200, 36864, 0x11c512ac
-0, 10800, 36864, 0xc013b0e3
-0, 14400, 36864, 0x25002dae
-0, 18000, 36864, 0xefd0055a
-0, 21600, 36864, 0x6be2d3b2
-0, 25200, 36864, 0xa8a0d525
-0, 28800, 36864, 0x1bf942e8
-0, 32400, 36864, 0x5c08c94f
-0, 36000, 36864, 0x5555e762
-0, 39600, 36864, 0xcc1429c7
-0, 43200, 36864, 0xa3cc1535
-0, 46800, 36864, 0x14dc2b75
-0, 50400, 36864, 0x6b965ce9
-0, 54000, 36864, 0x7424d19b
-0, 57600, 36864, 0xcada6a7f
diff --git a/tests/ref/fate/h264-conformance-camanl1_toshiba_b b/tests/ref/fate/h264-conformance-camanl1_toshiba_b
deleted file mode 100644
index 07422b8..0000000
--- a/tests/ref/fate/h264-conformance-camanl1_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x78882b27
-0, 14400, 152064, 0x3afef36d
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x3a8bab81
-0, 25200, 152064, 0x2a437174
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x39c5f125
-0, 36000, 152064, 0x256eaad2
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x412a4aa7
-0, 46800, 152064, 0x3f091baf
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0x2fc4ce67
-0, 57600, 152064, 0x119cde3e
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0x4be4f192
-0, 68400, 152064, 0x906c1237
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0x6a833025
-0, 79200, 152064, 0x681d1c4f
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0xc69226f0
-0, 90000, 152064, 0x86631102
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xc746ddd4
-0, 100800, 152064, 0x5f2bd3cb
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0x5b7fa380
-0, 111600, 152064, 0x82438cf7
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0xc50d41f1
-0, 122400, 152064, 0xf3453631
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x045b03f7
-0, 133200, 152064, 0xf64bd756
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0x3613a0a5
-0, 144000, 152064, 0xe6a7a8d6
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0x4dfc912b
-0, 154800, 152064, 0x81e3991c
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0xed478395
-0, 165600, 152064, 0x4cb25ab6
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x8bcc1a8d
-0, 176400, 152064, 0x2fe1f240
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0xe3929556
-0, 187200, 152064, 0xd370632a
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0x444bf18c
-0, 198000, 152064, 0xab40bd14
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0xe1f09568
-0, 208800, 152064, 0x09ee7a7e
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0xdbd467e9
-0, 219600, 152064, 0x99726777
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0xcf770fdb
-0, 230400, 152064, 0x2a890fd9
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x04191304
-0, 241200, 152064, 0x15722022
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0x28ba373f
-0, 252000, 152064, 0xf9e400b8
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0x6917d2a5
-0, 262800, 152064, 0x61cae234
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x1ee2d9bd
-0, 273600, 152064, 0xdce9ab8e
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x10e8cb60
-0, 284400, 152064, 0x8d07cd25
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xb0f10280
-0, 295200, 152064, 0x76a71f13
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x9aba5724
-0, 306000, 152064, 0x5db85385
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0xa71e85bb
-0, 316800, 152064, 0xdcf59cd7
-0, 320400, 152064, 0x5e319459
diff --git a/tests/ref/fate/h264-conformance-camanl2_toshiba_b b/tests/ref/fate/h264-conformance-camanl2_toshiba_b
deleted file mode 100644
index d8959a3..0000000
--- a/tests/ref/fate/h264-conformance-camanl2_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x5f352e98
-0, 14400, 152064, 0xeba5fe28
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x1120b6a4
-0, 25200, 152064, 0x67506e16
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x929becd6
-0, 36000, 152064, 0x6ffcb4b0
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x1b034ebb
-0, 46800, 152064, 0x7e2d213c
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0xdeaecab3
-0, 57600, 152064, 0xd220d704
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0xbdf0ef57
-0, 68400, 152064, 0x7e2e10df
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0xdb80256d
-0, 79200, 152064, 0xa4561c61
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0x7bb917d6
-0, 90000, 152064, 0x796f0e2b
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xda32de2e
-0, 100800, 152064, 0x00ffc15a
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0xb7588f7f
-0, 111600, 152064, 0xa4e07c02
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0x2c3245ee
-0, 122400, 152064, 0x6565355b
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x0abffe08
-0, 133200, 152064, 0x119ccc3e
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0xba4b9820
-0, 144000, 152064, 0xb6dfa596
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0xf3c29133
-0, 154800, 152064, 0x08cd8e2b
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0x5b7c6e48
-0, 165600, 152064, 0xd28a47c2
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x3a5619b1
-0, 176400, 152064, 0xa517e7f2
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0x25929175
-0, 187200, 152064, 0x20f05834
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0xa265f06f
-0, 198000, 152064, 0x97bbbfb7
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0x1b0989da
-0, 208800, 152064, 0xfd1878ce
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0x0d8151a7
-0, 219600, 152064, 0xe7a05bb8
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0x8751123f
-0, 230400, 152064, 0x8252101a
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x4ea317fe
-0, 241200, 152064, 0x519224d9
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0xc93c1dba
-0, 252000, 152064, 0xe3c9fb61
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0xcebacfd3
-0, 262800, 152064, 0x7327da99
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x5ea6c8d2
-0, 273600, 152064, 0x66fd8c6f
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x58b9be96
-0, 284400, 152064, 0xa5abcdb7
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xc7d20190
-0, 295200, 152064, 0xb6da14aa
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x129354e2
-0, 306000, 152064, 0xffa148d5
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0x1c7f8976
-0, 316800, 152064, 0xa107a54d
-0, 320400, 152064, 0x5e319459
diff --git a/tests/ref/fate/h264-conformance-camanl3_sand_e b/tests/ref/fate/h264-conformance-camanl3_sand_e
deleted file mode 100644
index ac8be19..0000000
--- a/tests/ref/fate/h264-conformance-camanl3_sand_e
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 152064, 0x6c1ff6a7
-0, 3600, 152064, 0x17f1ff3a
-0, 7200, 152064, 0xf7ddcda8
-0, 10800, 152064, 0xdcb64a37
-0, 14400, 152064, 0x4d2ad1db
-0, 18000, 152064, 0x2e49028a
-0, 21600, 152064, 0xcebb0f39
-0, 25200, 152064, 0xac74e574
-0, 28800, 152064, 0x8cd667e5
-0, 32400, 152064, 0xda511cf6
-0, 36000, 152064, 0x795c45c1
-0, 39600, 152064, 0x6034397c
-0, 43200, 152064, 0xafb4b03d
-0, 46800, 152064, 0xd73b1785
-0, 50400, 152064, 0xd873a98f
-0, 54000, 152064, 0x07ac191e
-0, 57600, 152064, 0x14fa5413
-0, 61200, 152064, 0xe6d1667e
-0, 64800, 152064, 0x1cc2a92e
-0, 68400, 152064, 0x4a878e35
-0, 72000, 152064, 0x4adfa52c
-0, 75600, 152064, 0x8dbb370b
-0, 79200, 152064, 0x4d66a69a
-0, 82800, 152064, 0x2dcb66da
-0, 86400, 152064, 0x74591150
-0, 90000, 152064, 0x259eb13f
-0, 93600, 152064, 0xe5c96dd3
-0, 97200, 152064, 0x0fb52fe3
-0, 100800, 152064, 0x47c506a0
-0, 104400, 152064, 0xcc09ca7a
-0, 108000, 152064, 0xc3430f03
-0, 111600, 152064, 0x702b1a73
-0, 115200, 152064, 0x4f385186
-0, 118800, 152064, 0x07a34aa5
-0, 122400, 152064, 0x698310b0
-0, 126000, 152064, 0x5fa469bc
-0, 129600, 152064, 0xb6ab39ef
-0, 133200, 152064, 0xbb6dc59d
-0, 136800, 152064, 0xe5fa7503
-0, 140400, 152064, 0xd367512a
-0, 144000, 152064, 0x215c0ca7
-0, 147600, 152064, 0x6bea4847
-0, 151200, 152064, 0xba03f875
-0, 154800, 152064, 0x3ac282cd
-0, 158400, 152064, 0x23aee807
-0, 162000, 152064, 0x4274c84c
-0, 165600, 152064, 0xdfdacf4b
-0, 169200, 152064, 0xb2de9e6e
-0, 172800, 152064, 0x456b684e
-0, 176400, 152064, 0xa6297c83
diff --git a/tests/ref/fate/h264-conformance-camasl3_sony_b b/tests/ref/fate/h264-conformance-camasl3_sony_b
deleted file mode 100644
index 73f9b7f..0000000
--- a/tests/ref/fate/h264-conformance-camasl3_sony_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 36864, 0xfe2ad849
-0, 3600, 36864, 0x37954ba1
-0, 7200, 36864, 0xaf0e0877
-0, 10800, 36864, 0xf28cadd1
-0, 14400, 36864, 0xe182365a
-0, 18000, 36864, 0xdcdc03b7
-0, 21600, 36864, 0x2eded02f
-0, 25200, 36864, 0xa706ca87
-0, 28800, 36864, 0x446f4c83
-0, 32400, 36864, 0x766acab3
-0, 36000, 36864, 0x651feaed
-0, 39600, 36864, 0x834a2a75
-0, 43200, 36864, 0xb1811822
-0, 46800, 36864, 0xd8e12e21
-0, 50400, 36864, 0x6b445b13
-0, 54000, 36864, 0xa4ded223
-0, 57600, 36864, 0xbd1161b5
diff --git a/tests/ref/fate/h264-conformance-camp_mot_mbaff_l30 b/tests/ref/fate/h264-conformance-camp_mot_mbaff_l30
deleted file mode 100644
index f8a1b8c..0000000
--- a/tests/ref/fate/h264-conformance-camp_mot_mbaff_l30
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x672279df
-0, 3600, 518400, 0xb248a762
-0, 7200, 518400, 0x4399de88
-0, 10800, 518400, 0x14200d2d
-0, 14400, 518400, 0x14a704cf
-0, 18000, 518400, 0xcaac5431
-0, 21600, 518400, 0x69d77cee
-0, 25200, 518400, 0x420d5f92
-0, 28800, 518400, 0x083a357d
-0, 32400, 518400, 0x01777426
-0, 36000, 518400, 0x474640e9
-0, 39600, 518400, 0x3d690eab
-0, 43200, 518400, 0x58074830
-0, 46800, 518400, 0x3e3f0fcc
-0, 50400, 518400, 0x8c72de01
-0, 54000, 518400, 0xbf0a4f6f
-0, 57600, 518400, 0xbdea010d
-0, 61200, 518400, 0x54bdc458
-0, 64800, 518400, 0xdcd00ed0
-0, 68400, 518400, 0x64ba9ba9
-0, 72000, 518400, 0x5c0c6790
-0, 75600, 518400, 0x178674ed
-0, 79200, 518400, 0x9ebec8d3
-0, 82800, 518400, 0x375c5426
-0, 86400, 518400, 0x19987af8
-0, 90000, 518400, 0x347ec12c
-0, 93600, 518400, 0x96856c36
-0, 97200, 518400, 0xb81264a6
-0, 100800, 518400, 0xde0a08d6
-0, 104400, 518400, 0x19cb10be
diff --git a/tests/ref/fate/h264-conformance-camp_mot_mbaff_l31 b/tests/ref/fate/h264-conformance-camp_mot_mbaff_l31
deleted file mode 100644
index baccdb8..0000000
--- a/tests/ref/fate/h264-conformance-camp_mot_mbaff_l31
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x077637bf
-0, 3600, 518400, 0xbd096d55
-0, 7200, 518400, 0x58b58820
-0, 10800, 518400, 0xdf24aced
-0, 14400, 518400, 0x2354c6a2
-0, 18000, 518400, 0xedaaffdf
-0, 21600, 518400, 0x28a8f027
-0, 25200, 518400, 0x05dee3d2
-0, 28800, 518400, 0x2ae9dbe4
-0, 32400, 518400, 0x361fec4a
-0, 36000, 518400, 0xd9c7b07d
-0, 39600, 518400, 0xa9d69c9f
-0, 43200, 518400, 0x7f44c08c
-0, 46800, 518400, 0xbfed83b4
-0, 50400, 518400, 0x65a5588c
-0, 54000, 518400, 0xf4859855
-0, 57600, 518400, 0xcba96df9
-0, 61200, 518400, 0x8ae11dfd
-0, 64800, 518400, 0xf0e36904
-0, 68400, 518400, 0x45cf1cb3
-0, 72000, 518400, 0xffefde04
-0, 75600, 518400, 0xc2a8edef
-0, 79200, 518400, 0x72b15456
-0, 82800, 518400, 0x67b8dd35
-0, 86400, 518400, 0x8b91f38e
-0, 90000, 518400, 0xe7055df1
-0, 93600, 518400, 0x5c32200d
-0, 97200, 518400, 0xfbb709dc
-0, 100800, 518400, 0x5c45b17f
-0, 104400, 518400, 0x3a25903f
diff --git a/tests/ref/fate/h264-conformance-canl1_sony_e b/tests/ref/fate/h264-conformance-canl1_sony_e
deleted file mode 100644
index 552caa8..0000000
--- a/tests/ref/fate/h264-conformance-canl1_sony_e
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x3809fec3
-0, 7200, 38016, 0xf698ce3c
-0, 10800, 38016, 0x7e3da603
-0, 14400, 38016, 0x68b07d81
-0, 18000, 38016, 0xd91f717a
-0, 21600, 38016, 0x48885dd6
-0, 25200, 38016, 0x27e64e8e
-0, 28800, 38016, 0x955835ce
-0, 32400, 38016, 0xf19940a0
-0, 36000, 38016, 0x9a1c51e4
-0, 39600, 38016, 0xf59373af
-0, 43200, 38016, 0x5d6c7d06
-0, 46800, 38016, 0x32fca533
-0, 50400, 38016, 0x37e69987
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xee37a1f9
-0, 61200, 38016, 0xc6279d8f
-0, 64800, 38016, 0x33d28b0a
-0, 68400, 38016, 0x42946b72
-0, 72000, 38016, 0x51e947bf
-0, 75600, 38016, 0xb10b2399
-0, 79200, 38016, 0x250c0fe4
-0, 82800, 38016, 0x81e20b18
-0, 86400, 38016, 0xb93f00db
-0, 90000, 38016, 0x4f9d13d8
-0, 93600, 38016, 0x7d9c1184
-0, 97200, 38016, 0xd3271d2c
-0, 100800, 38016, 0x9b253539
-0, 104400, 38016, 0xc4fd4d89
-0, 108000, 38016, 0x006f63cc
-0, 111600, 38016, 0xa7d976b4
-0, 115200, 38016, 0x30de94d6
-0, 118800, 38016, 0x2cb7a745
-0, 122400, 38016, 0xa7a2b854
-0, 126000, 38016, 0x1ca1ba1a
-0, 129600, 38016, 0x13b2b430
-0, 133200, 38016, 0x82bbb2de
-0, 136800, 38016, 0x5fa0b4f9
-0, 140400, 38016, 0xedefb64d
-0, 144000, 38016, 0x5ccdbf33
-0, 147600, 38016, 0x4fd0b4bb
-0, 151200, 38016, 0x195fa008
-0, 154800, 38016, 0xda1494e0
-0, 158400, 38016, 0x98ac8fa6
-0, 162000, 38016, 0xd1548835
-0, 165600, 38016, 0x35c790ee
-0, 169200, 38016, 0xecda84f1
-0, 172800, 38016, 0x9d9f8710
-0, 176400, 38016, 0x72d89581
diff --git a/tests/ref/fate/h264-conformance-canl1_sva_b b/tests/ref/fate/h264-conformance-canl1_sva_b
deleted file mode 100644
index 8594553..0000000
--- a/tests/ref/fate/h264-conformance-canl1_sva_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0x0bd22424
-0, 3600, 38016, 0x4eb601f0
-0, 7200, 38016, 0xe16de459
-0, 10800, 38016, 0xde2e0c37
-0, 14400, 38016, 0x14a0286b
-0, 18000, 38016, 0x37bc35b5
-0, 21600, 38016, 0xcfa24923
-0, 25200, 38016, 0xac755ba0
-0, 28800, 38016, 0x27d1822a
-0, 32400, 38016, 0xa8039548
-0, 36000, 38016, 0x400ea1fb
-0, 39600, 38016, 0x7d2ca44a
-0, 43200, 38016, 0xd42dae4f
-0, 46800, 38016, 0x39ce9599
-0, 50400, 38016, 0x37498aa1
-0, 54000, 38016, 0x8558911f
-0, 57600, 38016, 0x06a8a9ad
diff --git a/tests/ref/fate/h264-conformance-canl1_toshiba_g b/tests/ref/fate/h264-conformance-canl1_toshiba_g
deleted file mode 100644
index 49faee0..0000000
--- a/tests/ref/fate/h264-conformance-canl1_toshiba_g
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0x58892149
-0, 3600, 38016, 0xda2ded74
-0, 7200, 38016, 0x2661cdb0
-0, 10800, 38016, 0xb581a73a
-0, 14400, 38016, 0xa04a7e93
-0, 18000, 38016, 0x149e7861
-0, 21600, 38016, 0x53725080
-0, 25200, 38016, 0x341a4d3f
-0, 28800, 38016, 0x2ecc41ac
-0, 32400, 38016, 0x99b85127
-0, 36000, 38016, 0x7bdc50bc
-0, 39600, 38016, 0xd3d58663
-0, 43200, 38016, 0x717485e9
-0, 46800, 38016, 0x2ac29c85
-0, 50400, 38016, 0x36daa429
-0, 54000, 38016, 0x8bb7a48e
-0, 57600, 38016, 0xb38aab11
-0, 61200, 38016, 0xacd89c4c
-0, 64800, 38016, 0x676b71e1
-0, 68400, 38016, 0xa2e7731e
-0, 72000, 38016, 0x4a2f5766
-0, 75600, 38016, 0x04ef1873
-0, 79200, 38016, 0x52ac0171
-0, 82800, 38016, 0xdd0a027a
-0, 86400, 38016, 0x700810c6
-0, 90000, 38016, 0x417f0cd3
-0, 93600, 38016, 0xf8ef0da9
-0, 97200, 38016, 0xfce62a5a
-0, 100800, 38016, 0x03592b0a
-0, 104400, 38016, 0x9b7b5373
-0, 108000, 38016, 0xab015505
-0, 111600, 38016, 0xf3387ae1
-0, 115200, 38016, 0x1d09a5b6
-0, 118800, 38016, 0x9159a5e2
-0, 122400, 38016, 0x8887c177
-0, 126000, 38016, 0x914dbacd
-0, 129600, 38016, 0xaa97c0f6
-0, 133200, 38016, 0x0837b14a
-0, 136800, 38016, 0x0198be16
-0, 140400, 38016, 0xc14bc9c6
-0, 144000, 38016, 0xdb58c2a7
-0, 147600, 38016, 0xa751ae90
-0, 151200, 38016, 0x5813a64d
-0, 154800, 38016, 0x73959f9b
-0, 158400, 38016, 0xb0de8994
-0, 162000, 38016, 0x79ea9214
-0, 165600, 38016, 0x0b388957
-0, 169200, 38016, 0x31aa91c9
-0, 172800, 38016, 0xadcf88ec
-0, 176400, 38016, 0x5bc99b68
-0, 180000, 38016, 0x535e7c2e
-0, 183600, 38016, 0xbfef8e0a
-0, 187200, 38016, 0xc56285aa
-0, 190800, 38016, 0x76758edc
-0, 194400, 38016, 0xd8c3a20b
-0, 198000, 38016, 0xd2aa918b
-0, 201600, 38016, 0xfe1ea23b
-0, 205200, 38016, 0x3533a68d
-0, 208800, 38016, 0xd8679427
-0, 212400, 38016, 0x76be9c98
-0, 216000, 38016, 0xc37a9a7a
-0, 219600, 38016, 0x1ebe9463
-0, 223200, 38016, 0xab4c63d2
-0, 226800, 38016, 0x761b3c50
-0, 230400, 38016, 0xb57c4bb7
-0, 234000, 38016, 0x86117755
-0, 237600, 38016, 0xd89dacf3
-0, 241200, 38016, 0x8940eee9
-0, 244800, 38016, 0x2f7c3abf
-0, 248400, 38016, 0x98366678
-0, 252000, 38016, 0x14348147
-0, 255600, 38016, 0x4e3ba8f8
-0, 259200, 38016, 0xc167c205
-0, 262800, 38016, 0x0581e211
-0, 266400, 38016, 0x62cd0ea6
-0, 270000, 38016, 0x753b3a2b
-0, 273600, 38016, 0x25ce507a
-0, 277200, 38016, 0x726f64af
-0, 280800, 38016, 0xa13c7c58
-0, 284400, 38016, 0xa27b7584
-0, 288000, 38016, 0x45b47c12
-0, 291600, 38016, 0x0f6a9456
-0, 295200, 38016, 0x30ae9e92
-0, 298800, 38016, 0xf59fa16d
-0, 302400, 38016, 0x16d292d7
-0, 306000, 38016, 0x828791cc
-0, 309600, 38016, 0x71769267
-0, 313200, 38016, 0xf297a0e0
-0, 316800, 38016, 0x33a4a00a
-0, 320400, 38016, 0xda96c5b8
-0, 324000, 38016, 0x742daf25
-0, 327600, 38016, 0x603f8bba
-0, 331200, 38016, 0x89d18e70
-0, 334800, 38016, 0x8c2b8c29
-0, 338400, 38016, 0x9ccf6983
-0, 342000, 38016, 0x8ddd5a29
-0, 345600, 38016, 0x5679718d
-0, 349200, 38016, 0x28aa80b3
-0, 352800, 38016, 0x3b08780e
-0, 356400, 38016, 0x9e408cbc
-0, 360000, 38016, 0xe7c18e94
-0, 363600, 38016, 0xaba57f22
-0, 367200, 38016, 0xd8826dc5
-0, 370800, 38016, 0x2ed2710e
-0, 374400, 38016, 0x59748443
-0, 378000, 38016, 0x5076b247
-0, 381600, 38016, 0xf6ae9bcd
-0, 385200, 38016, 0x4d83d68f
-0, 388800, 38016, 0x118ff589
-0, 392400, 38016, 0x65b3f2c0
-0, 396000, 38016, 0x8f341576
-0, 399600, 38016, 0xbeac1816
-0, 403200, 38016, 0x19073cf9
-0, 406800, 38016, 0xcfdb2e55
-0, 410400, 38016, 0x99fd08f8
-0, 414000, 38016, 0x025c0249
-0, 417600, 38016, 0x4d311afc
-0, 421200, 38016, 0xef532038
-0, 424800, 38016, 0x7c353d9a
-0, 428400, 38016, 0x9fed4678
-0, 432000, 38016, 0x67062dad
-0, 435600, 38016, 0x1e5b2069
-0, 439200, 38016, 0x8b25fd3f
-0, 442800, 38016, 0x06a9e566
-0, 446400, 38016, 0x263badf5
-0, 450000, 38016, 0x35a99a45
-0, 453600, 38016, 0x930a8491
-0, 457200, 38016, 0xf9d49dfd
-0, 460800, 38016, 0xbc8cb0a6
-0, 464400, 38016, 0x8f10d1a9
-0, 468000, 38016, 0xb6dbc51b
-0, 471600, 38016, 0x2f1bc747
-0, 475200, 38016, 0xecdac1ac
-0, 478800, 38016, 0x6391bdcc
-0, 482400, 38016, 0x7e5eb209
-0, 486000, 38016, 0x8f5ea1e8
-0, 489600, 38016, 0x969195a9
-0, 493200, 38016, 0x18579903
-0, 496800, 38016, 0x4cfe8893
-0, 500400, 38016, 0x68c57143
-0, 504000, 38016, 0x297f6420
-0, 507600, 38016, 0x36b1669c
-0, 511200, 38016, 0x3d78362e
-0, 514800, 38016, 0xaba14c36
-0, 518400, 38016, 0xe6914a59
-0, 522000, 38016, 0x3733481a
-0, 525600, 38016, 0xb6df4c6d
-0, 529200, 38016, 0x20631838
-0, 532800, 38016, 0x014df835
-0, 536400, 38016, 0xcb36db94
-0, 540000, 38016, 0x4cb8b44a
-0, 543600, 38016, 0xa49da6e5
-0, 547200, 38016, 0x8dbfb72d
-0, 550800, 38016, 0x3ba5b7d5
-0, 554400, 38016, 0xc8ebad2d
-0, 558000, 38016, 0x36fad594
-0, 561600, 38016, 0x6302f0f2
-0, 565200, 38016, 0xc799139e
-0, 568800, 38016, 0x947947d0
-0, 572400, 38016, 0x39756224
-0, 576000, 38016, 0x1d995e51
-0, 579600, 38016, 0x56274435
-0, 583200, 38016, 0x3cfc2b1d
-0, 586800, 38016, 0x5a4a178f
-0, 590400, 38016, 0xca212af1
-0, 594000, 38016, 0x885af884
-0, 597600, 38016, 0x3241c9c1
-0, 601200, 38016, 0x4ef997a4
-0, 604800, 38016, 0x5ecb8030
-0, 608400, 38016, 0x2eb76daa
-0, 612000, 38016, 0x485780ba
-0, 615600, 38016, 0xf5f88241
-0, 619200, 38016, 0x563f97d0
-0, 622800, 38016, 0x4a01a6c4
-0, 626400, 38016, 0xd7ea8457
-0, 630000, 38016, 0x08ae6916
-0, 633600, 38016, 0x4c933e75
-0, 637200, 38016, 0x49541e4a
-0, 640800, 38016, 0xd14e028a
-0, 644400, 38016, 0xabd5f4e6
-0, 648000, 38016, 0xfe3bdd0f
-0, 651600, 38016, 0xbb30cef4
-0, 655200, 38016, 0xd724d0e3
-0, 658800, 38016, 0x7537d6bf
-0, 662400, 38016, 0x3da3e67a
-0, 666000, 38016, 0xf02606eb
-0, 669600, 38016, 0x2dde399b
-0, 673200, 38016, 0xafe94c86
-0, 676800, 38016, 0x923d6081
-0, 680400, 38016, 0x9c733e4e
-0, 684000, 38016, 0x2b16d821
-0, 687600, 38016, 0x1edf9cd1
-0, 691200, 38016, 0xa9c3b601
-0, 694800, 38016, 0x9adeb02b
-0, 698400, 38016, 0xf5eaddc3
-0, 702000, 38016, 0xac871bea
-0, 705600, 38016, 0x060429f4
-0, 709200, 38016, 0xf80b421d
-0, 712800, 38016, 0x7dcd6c50
-0, 716400, 38016, 0x46e46798
-0, 720000, 38016, 0xdbee759f
-0, 723600, 38016, 0xbbe78774
-0, 727200, 38016, 0xb85990ed
-0, 730800, 38016, 0xda0e8530
-0, 734400, 38016, 0x5eaf8508
-0, 738000, 38016, 0x5c2c83fa
-0, 741600, 38016, 0x6dfe9322
-0, 745200, 38016, 0xa3059a60
-0, 748800, 38016, 0x357c8237
-0, 752400, 38016, 0xccae6b20
-0, 756000, 38016, 0x25fe57c1
-0, 759600, 38016, 0xfa65376b
-0, 763200, 38016, 0xd9b12ef8
-0, 766800, 38016, 0x3ab73fa0
-0, 770400, 38016, 0xcb6a2f96
-0, 774000, 38016, 0x8a973915
-0, 777600, 38016, 0x71ac1dd2
-0, 781200, 38016, 0x71802085
-0, 784800, 38016, 0x4de728d9
-0, 788400, 38016, 0xdf3a1de7
-0, 792000, 38016, 0x36270e93
-0, 795600, 38016, 0x90d4fe93
-0, 799200, 38016, 0x3477fb4e
-0, 802800, 38016, 0xd410fa81
-0, 806400, 38016, 0xfc230675
-0, 810000, 38016, 0xbda40c03
-0, 813600, 38016, 0x7a47fc07
-0, 817200, 38016, 0x53fe2a37
-0, 820800, 38016, 0x342d3bec
-0, 824400, 38016, 0xf13163a3
-0, 828000, 38016, 0x03f087da
-0, 831600, 38016, 0xbc03c466
-0, 835200, 38016, 0x6318d676
-0, 838800, 38016, 0xbc2f0b68
-0, 842400, 38016, 0xcb57354b
-0, 846000, 38016, 0x7e9a5b48
-0, 849600, 38016, 0x9dca693a
-0, 853200, 38016, 0xd0776497
-0, 856800, 38016, 0x05a24093
-0, 860400, 38016, 0x69b21063
-0, 864000, 38016, 0x15f3ed8b
-0, 867600, 38016, 0x2417bc52
-0, 871200, 38016, 0xabc2a564
-0, 874800, 38016, 0x67f2dd90
-0, 878400, 38016, 0xa5fe4b6e
-0, 882000, 38016, 0x7801add2
-0, 885600, 38016, 0xf4abc321
-0, 889200, 38016, 0x1d06a837
-0, 892800, 38016, 0x2e0d6fc2
-0, 896400, 38016, 0xc4f30535
-0, 900000, 38016, 0x67d09a80
-0, 903600, 38016, 0xca505a1e
-0, 907200, 38016, 0x2e2e56c8
-0, 910800, 38016, 0x689ea3e2
-0, 914400, 38016, 0x9989165a
-0, 918000, 38016, 0xd8e2c30e
-0, 921600, 38016, 0x2a98bf3f
-0, 925200, 38016, 0x44664d3e
-0, 928800, 38016, 0x53a939de
-0, 932400, 38016, 0x4c153702
-0, 936000, 38016, 0x03c73e88
-0, 939600, 38016, 0x7cd649d4
-0, 943200, 38016, 0x7d7c5687
-0, 946800, 38016, 0x8f3c53a6
-0, 950400, 38016, 0x24634dd1
-0, 954000, 38016, 0x5d00442c
-0, 957600, 38016, 0xdcc72906
-0, 961200, 38016, 0x5def12f3
-0, 964800, 38016, 0x95e6e8be
-0, 968400, 38016, 0x2675c694
-0, 972000, 38016, 0x906aa24e
-0, 975600, 38016, 0x09468fe4
-0, 979200, 38016, 0xaec9736d
-0, 982800, 38016, 0xa5812142
-0, 986400, 38016, 0x9986d55f
-0, 990000, 38016, 0x9f7fc399
-0, 993600, 38016, 0xc345d526
-0, 997200, 38016, 0x3ae3b9bd
-0, 1000800, 38016, 0xb103ec45
-0, 1004400, 38016, 0x3ff462c2
-0, 1008000, 38016, 0x5c07ed68
-0, 1011600, 38016, 0xccbad189
-0, 1015200, 38016, 0x6f3f9a18
-0, 1018800, 38016, 0x26406fa1
-0, 1022400, 38016, 0x06cf5f62
-0, 1026000, 38016, 0x3eb29bd1
-0, 1029600, 38016, 0x12ab807e
-0, 1033200, 38016, 0x7621bf0d
-0, 1036800, 38016, 0x88eabc0c
-0, 1040400, 38016, 0x21386662
-0, 1044000, 38016, 0x5839e3e4
-0, 1047600, 38016, 0xd196ee7c
-0, 1051200, 38016, 0x84dc8477
-0, 1054800, 38016, 0xbf2dcc7a
-0, 1058400, 38016, 0x29e3fe96
-0, 1062000, 38016, 0xf115ffc3
-0, 1065600, 38016, 0x7585d699
-0, 1069200, 38016, 0x7a7dcb8a
-0, 1072800, 38016, 0x03cfdb04
-0, 1076400, 38016, 0xd56e028c
diff --git a/tests/ref/fate/h264-conformance-canl2_sony_e b/tests/ref/fate/h264-conformance-canl2_sony_e
deleted file mode 100644
index 327e925..0000000
--- a/tests/ref/fate/h264-conformance-canl2_sony_e
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x3017107e
-0, 7200, 38016, 0xe172e2d2
-0, 10800, 38016, 0x7fefbb5b
-0, 14400, 38016, 0x331097e6
-0, 18000, 38016, 0x47de825a
-0, 21600, 38016, 0x0bf36d87
-0, 25200, 38016, 0x03ae60c5
-0, 28800, 38016, 0x986b5930
-0, 32400, 38016, 0x398b6450
-0, 36000, 38016, 0x8e1b77e7
-0, 39600, 38016, 0xefb198a6
-0, 43200, 38016, 0x395aa9ee
-0, 46800, 38016, 0x1918b963
-0, 50400, 38016, 0xe6cab421
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xf076abc7
-0, 61200, 38016, 0xd0f4ab70
-0, 64800, 38016, 0x7a39a75c
-0, 68400, 38016, 0xb04f8bad
-0, 72000, 38016, 0xe4996ff5
-0, 75600, 38016, 0x096e549a
-0, 79200, 38016, 0x36d73f1a
-0, 82800, 38016, 0x25f53bbf
-0, 86400, 38016, 0x7ebd3f9f
-0, 90000, 38016, 0x464c4b4c
-0, 93600, 38016, 0x2d794a40
-0, 97200, 38016, 0x1599532d
-0, 100800, 38016, 0xf8326999
-0, 104400, 38016, 0x858e789b
-0, 108000, 38016, 0x006f63cc
-0, 111600, 38016, 0x488a9614
-0, 115200, 38016, 0x950fb7cc
-0, 118800, 38016, 0x6deac9dd
-0, 122400, 38016, 0x0a82d725
-0, 126000, 38016, 0x2702d5fe
-0, 129600, 38016, 0xf7ead782
-0, 133200, 38016, 0x560fd1f1
-0, 136800, 38016, 0xa3cdd31a
-0, 140400, 38016, 0xa19ed45c
-0, 144000, 38016, 0x8d85d757
-0, 147600, 38016, 0x7fa6e1b5
-0, 151200, 38016, 0x8a31db0e
-0, 154800, 38016, 0x9dead6ff
-0, 158400, 38016, 0x8a8adf44
-0, 162000, 38016, 0xd1548835
-0, 165600, 38016, 0xf696a62c
-0, 169200, 38016, 0x5edbb219
-0, 172800, 38016, 0x0d9db749
-0, 176400, 38016, 0xc109c379
-0, 180000, 38016, 0xe814c2b1
-0, 183600, 38016, 0x4a8dc84b
-0, 187200, 38016, 0x6bcac28c
-0, 190800, 38016, 0xa37ec8da
-0, 194400, 38016, 0x3202d5e9
-0, 198000, 38016, 0x3d65ddb6
-0, 201600, 38016, 0x165de082
-0, 205200, 38016, 0x5702e231
-0, 208800, 38016, 0x034fe8f4
-0, 212400, 38016, 0x96f0ea58
-0, 216000, 38016, 0x65539ad7
-0, 219600, 38016, 0xdf98a7cf
-0, 223200, 38016, 0xda007de0
-0, 226800, 38016, 0xdf43520e
-0, 230400, 38016, 0xc5d553d2
-0, 234000, 38016, 0xc3327450
-0, 237600, 38016, 0x81c4a2e0
-0, 241200, 38016, 0x7c56e2d1
-0, 244800, 38016, 0x813f20a4
-0, 248400, 38016, 0xe48257ad
-0, 252000, 38016, 0x261b812f
-0, 255600, 38016, 0x8836ae43
-0, 259200, 38016, 0x4c52e30f
-0, 262800, 38016, 0x0614245f
-0, 266400, 38016, 0xbf275e2e
-0, 270000, 38016, 0x2f0f3e49
-0, 273600, 38016, 0xfaf57eb1
-0, 277200, 38016, 0xd1b49f95
-0, 280800, 38016, 0x10f4c2f6
-0, 284400, 38016, 0x2322d359
-0, 288000, 38016, 0x994de596
-0, 291600, 38016, 0x2a0df115
-0, 295200, 38016, 0xfcb7f1ec
-0, 298800, 38016, 0xcbc2ee10
-0, 302400, 38016, 0x49f5ee5c
-0, 306000, 38016, 0x4eb9f286
-0, 309600, 38016, 0xe5d80039
-0, 313200, 38016, 0xfa57fa81
-0, 316800, 38016, 0x2bea01f7
-0, 320400, 38016, 0x4e7c07a0
-0, 324000, 38016, 0x43b6a0f7
-0, 327600, 38016, 0x996e93cc
-0, 331200, 38016, 0x8e5c8a40
-0, 334800, 38016, 0x15cc7fe7
-0, 338400, 38016, 0x7f0a6c35
-0, 342000, 38016, 0x031677a4
-0, 345600, 38016, 0x14dd8b6d
-0, 349200, 38016, 0x143ca592
-0, 352800, 38016, 0x8e56b262
-0, 356400, 38016, 0x01c7c2b9
-0, 360000, 38016, 0xc117cbfa
-0, 363600, 38016, 0x609bbe4b
-0, 367200, 38016, 0x9a9fad05
-0, 370800, 38016, 0xba959d79
-0, 374400, 38016, 0x8773c00e
-0, 378000, 38016, 0xea22a35b
-0, 381600, 38016, 0x4b76c5fa
-0, 385200, 38016, 0x5088e610
-0, 388800, 38016, 0xb6db1234
-0, 392400, 38016, 0xef631cf7
-0, 396000, 38016, 0x7d993030
-0, 399600, 38016, 0xa9b24013
-0, 403200, 38016, 0xc3a14055
-0, 406800, 38016, 0x5e7e2b4c
-0, 410400, 38016, 0xae3505e0
-0, 414000, 38016, 0x48880369
-0, 417600, 38016, 0x844e1316
-0, 421200, 38016, 0x1d501951
-0, 424800, 38016, 0x36ae2e34
-0, 428400, 38016, 0xe48b385f
-0, 432000, 38016, 0xd88d3691
-0, 435600, 38016, 0xf38f3ad4
-0, 439200, 38016, 0x2a0e256e
-0, 442800, 38016, 0x0c25fbbd
-0, 446400, 38016, 0x13dbd8fc
-0, 450000, 38016, 0x8c4dc0b1
-0, 453600, 38016, 0x054bb5d5
-0, 457200, 38016, 0x19f8c259
-0, 460800, 38016, 0x4037d8fd
-0, 464400, 38016, 0x13f4ecda
-0, 468000, 38016, 0xde8af5a1
-0, 471600, 38016, 0x5997f541
-0, 475200, 38016, 0x876bebfe
-0, 478800, 38016, 0x7322ef36
-0, 482400, 38016, 0xe6a7ecc3
-0, 486000, 38016, 0x20e5a1eb
-0, 489600, 38016, 0xd1e5b985
-0, 493200, 38016, 0xe83cb437
-0, 496800, 38016, 0x8928a6f2
-0, 500400, 38016, 0xc6b1a7f4
-0, 504000, 38016, 0xcaf79531
-0, 507600, 38016, 0x3ded956e
-0, 511200, 38016, 0x494b82c5
-0, 514800, 38016, 0x86cb794a
-0, 518400, 38016, 0x548687e6
-0, 522000, 38016, 0x8f478a9f
-0, 525600, 38016, 0x32a97cbb
-0, 529200, 38016, 0x587b56cf
-0, 532800, 38016, 0x933428a9
-0, 536400, 38016, 0xcb610212
-0, 540000, 38016, 0x0d27b12d
-0, 543600, 38016, 0xf5a9b7e0
-0, 547200, 38016, 0x5287bdb7
-0, 550800, 38016, 0xa4e9b762
-0, 554400, 38016, 0x289da6d8
-0, 558000, 38016, 0x1969bb3e
-0, 561600, 38016, 0x29cbe019
-0, 565200, 38016, 0xe01403c6
-0, 568800, 38016, 0xce003f90
-0, 572400, 38016, 0x455d67e1
-0, 576000, 38016, 0xb57f7724
-0, 579600, 38016, 0x7fce73b9
-0, 583200, 38016, 0x7f136bbe
-0, 586800, 38016, 0xf096599f
-0, 590400, 38016, 0xe6df4c3a
-0, 594000, 38016, 0x98d2f70e
-0, 597600, 38016, 0xb500f2d7
-0, 601200, 38016, 0x95d3ce30
-0, 604800, 38016, 0x02a9ae41
-0, 608400, 38016, 0xb146a958
-0, 612000, 38016, 0x86a0bf3d
-0, 615600, 38016, 0x0c58d90a
-0, 619200, 38016, 0x27aef37f
-0, 622800, 38016, 0x3933fc3e
-0, 626400, 38016, 0x9ce9dc1c
-0, 630000, 38016, 0x3161ac45
-0, 633600, 38016, 0x4e8174cd
-0, 637200, 38016, 0xd8904d4b
-0, 640800, 38016, 0x933c2a55
-0, 644400, 38016, 0x85371555
-0, 648000, 38016, 0x3bb3ecd3
-0, 651600, 38016, 0x6b6ad873
-0, 655200, 38016, 0xa04dcf64
-0, 658800, 38016, 0x7869dc82
-0, 662400, 38016, 0x1c11e371
-0, 666000, 38016, 0x91eef557
-0, 669600, 38016, 0x27a30e42
-0, 673200, 38016, 0xcba73491
-0, 676800, 38016, 0xdffc402e
-0, 680400, 38016, 0x49b543c6
-0, 684000, 38016, 0xe3f7f438
-0, 687600, 38016, 0xed3ec663
-0, 691200, 38016, 0x174ad199
-0, 694800, 38016, 0x5330eef8
-0, 698400, 38016, 0x19d9074b
-0, 702000, 38016, 0x25961ad1
-0, 705600, 38016, 0x63024e80
-0, 709200, 38016, 0x25de6e2e
-0, 712800, 38016, 0x4cc594e8
-0, 716400, 38016, 0x8b25afcf
-0, 720000, 38016, 0x7b29bfcf
-0, 723600, 38016, 0x93abce16
-0, 727200, 38016, 0xc7f1d8fb
-0, 730800, 38016, 0x277ed79e
-0, 734400, 38016, 0x30dbdfe4
-0, 738000, 38016, 0xbd8be711
-0, 741600, 38016, 0xf072ea62
-0, 745200, 38016, 0xbfd0e5a5
-0, 748800, 38016, 0xedffdb3d
-0, 752400, 38016, 0x5238cb59
-0, 756000, 38016, 0x39305ec1
-0, 759600, 38016, 0x07816d20
-0, 763200, 38016, 0x61416e5b
-0, 766800, 38016, 0xc39d6ae2
-0, 770400, 38016, 0x1de95fe1
-0, 774000, 38016, 0x0530552f
-0, 777600, 38016, 0xa48f5b19
-0, 781200, 38016, 0x11305e31
-0, 784800, 38016, 0x9ae25bda
-0, 788400, 38016, 0xf16e5b67
-0, 792000, 38016, 0x9a375284
-0, 795600, 38016, 0x5a744019
-0, 799200, 38016, 0x811631e5
-0, 802800, 38016, 0x178a20e6
-0, 806400, 38016, 0xcab02bf2
-0, 810000, 38016, 0x6fca13cb
-0, 813600, 38016, 0xa1a71ba8
-0, 817200, 38016, 0x95f52de5
-0, 820800, 38016, 0xd2744451
-0, 824400, 38016, 0x717f6ef6
-0, 828000, 38016, 0x1f9e8ca9
-0, 831600, 38016, 0xc931b115
-0, 835200, 38016, 0xa4c1db05
-0, 838800, 38016, 0x92e80cc1
-0, 842400, 38016, 0x5ac5276c
-0, 846000, 38016, 0x624340ca
-0, 849600, 38016, 0x774a5a7c
-0, 853200, 38016, 0x1da55863
-0, 856800, 38016, 0x1bbc3b98
-0, 860400, 38016, 0x953b1479
-0, 864000, 38016, 0x8b11e5a8
-0, 867600, 38016, 0xf749d359
-0, 871200, 38016, 0xb54fcb8a
-0, 874800, 38016, 0xb64b1951
-0, 878400, 38016, 0x99778550
-0, 882000, 38016, 0x5e70e9e2
-0, 885600, 38016, 0x22550b80
-0, 889200, 38016, 0xfe3ddcde
-0, 892800, 38016, 0x1e28989e
-0, 896400, 38016, 0x25b926a4
-0, 900000, 38016, 0xf2c3c536
-0, 903600, 38016, 0x534a8643
-0, 907200, 38016, 0xf44b7f07
-0, 910800, 38016, 0x2873c895
-0, 914400, 38016, 0x67a7388d
-0, 918000, 38016, 0x0e5eca3b
-0, 921600, 38016, 0xc50dc747
-0, 925200, 38016, 0x6a3a4f1e
-0, 928800, 38016, 0x77d83b5f
-0, 932400, 38016, 0x91213d43
-0, 936000, 38016, 0x28344889
-0, 939600, 38016, 0xd1155a3f
-0, 943200, 38016, 0x5c7a65c5
-0, 946800, 38016, 0x3d4e7104
-0, 950400, 38016, 0x91d96a37
-0, 954000, 38016, 0xbc7f63f3
-0, 957600, 38016, 0x79275184
-0, 961200, 38016, 0xa6b43348
-0, 964800, 38016, 0x9e1d105a
-0, 968400, 38016, 0x14bce053
-0, 972000, 38016, 0x0ce3a7ca
-0, 975600, 38016, 0x4b5980fe
-0, 979200, 38016, 0x32745e1c
-0, 982800, 38016, 0x85b91358
-0, 986400, 38016, 0x9e26c66c
-0, 990000, 38016, 0x9735b157
-0, 993600, 38016, 0xfeaac3d1
-0, 997200, 38016, 0x8c95ca9f
-0, 1000800, 38016, 0x1336fa92
-0, 1004400, 38016, 0x37bb65f8
-0, 1008000, 38016, 0x830c078a
-0, 1011600, 38016, 0x088dd912
-0, 1015200, 38016, 0x8ef1a5a0
-0, 1018800, 38016, 0x9a1e642d
-0, 1022400, 38016, 0xa165517e
-0, 1026000, 38016, 0x0a34a67f
-0, 1029600, 38016, 0xaf0a662a
-0, 1033200, 38016, 0x3a5fa553
-0, 1036800, 38016, 0xda92b1f8
-0, 1040400, 38016, 0xac2997f4
-0, 1044000, 38016, 0x5df32cfc
-0, 1047600, 38016, 0x5cea491d
-0, 1051200, 38016, 0xeafbd139
-0, 1054800, 38016, 0x9ced0e69
-0, 1058400, 38016, 0x89514e3f
-0, 1062000, 38016, 0x3f0b4842
-0, 1065600, 38016, 0xc9902325
-0, 1069200, 38016, 0xdb3e1585
-0, 1072800, 38016, 0x3cf31e95
-0, 1076400, 38016, 0x60f14679
diff --git a/tests/ref/fate/h264-conformance-canl2_sva_b b/tests/ref/fate/h264-conformance-canl2_sva_b
deleted file mode 100644
index 8594553..0000000
--- a/tests/ref/fate/h264-conformance-canl2_sva_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0x0bd22424
-0, 3600, 38016, 0x4eb601f0
-0, 7200, 38016, 0xe16de459
-0, 10800, 38016, 0xde2e0c37
-0, 14400, 38016, 0x14a0286b
-0, 18000, 38016, 0x37bc35b5
-0, 21600, 38016, 0xcfa24923
-0, 25200, 38016, 0xac755ba0
-0, 28800, 38016, 0x27d1822a
-0, 32400, 38016, 0xa8039548
-0, 36000, 38016, 0x400ea1fb
-0, 39600, 38016, 0x7d2ca44a
-0, 43200, 38016, 0xd42dae4f
-0, 46800, 38016, 0x39ce9599
-0, 50400, 38016, 0x37498aa1
-0, 54000, 38016, 0x8558911f
-0, 57600, 38016, 0x06a8a9ad
diff --git a/tests/ref/fate/h264-conformance-canl3_sony_c b/tests/ref/fate/h264-conformance-canl3_sony_c
deleted file mode 100644
index 4d7f0eb..0000000
--- a/tests/ref/fate/h264-conformance-canl3_sony_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0xa0b41fef
-0, 7200, 38016, 0x965cf070
-0, 10800, 38016, 0x4552af45
-0, 14400, 38016, 0x8429a576
-0, 18000, 38016, 0xf6df8fc0
-0, 21600, 38016, 0x5d85554c
-0, 25200, 38016, 0x9c9d5b96
-0, 28800, 38016, 0xbc4a4b71
-0, 32400, 38016, 0xae4d3fc8
-0, 36000, 38016, 0xf4da7f25
-0, 39600, 38016, 0xf7d89a46
-0, 43200, 38016, 0x204977fd
-0, 46800, 38016, 0xa505b626
-0, 50400, 38016, 0xc7b8b3f8
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xfcfab8cc
-0, 61200, 38016, 0x750caf2d
-0, 64800, 38016, 0xa2c682ca
-0, 68400, 38016, 0x3dcd8f07
-0, 72000, 38016, 0x48fb69b3
-0, 75600, 38016, 0x128e3310
-0, 79200, 38016, 0x03803338
-0, 82800, 38016, 0x11362bda
-0, 86400, 38016, 0xc672229a
-0, 90000, 38016, 0x68e540d0
-0, 93600, 38016, 0x9d3a3deb
-0, 97200, 38016, 0x53b233af
-0, 100800, 38016, 0x3c6767eb
-0, 104400, 38016, 0x2a8d75f2
-0, 108000, 38016, 0x006f63cc
-0, 111600, 38016, 0x3652a79e
-0, 115200, 38016, 0x42f8c0fa
-0, 118800, 38016, 0x052eb292
-0, 122400, 38016, 0xbe7de0e7
-0, 126000, 38016, 0xf9f9d46f
-0, 129600, 38016, 0xb6d9b200
-0, 133200, 38016, 0xc3bcd2d2
-0, 136800, 38016, 0x23b5c8c2
-0, 140400, 38016, 0x67caaf99
-0, 144000, 38016, 0xb365cd31
-0, 147600, 38016, 0x7cabc68f
-0, 151200, 38016, 0xca8bb87a
-0, 154800, 38016, 0x66a4be22
-0, 158400, 38016, 0x2d10c1b0
-0, 162000, 38016, 0xd1548835
-0, 165600, 38016, 0x8b15b359
-0, 169200, 38016, 0x2337b654
-0, 172800, 38016, 0x56cfac2b
-0, 176400, 38016, 0x7ad4c642
-0, 180000, 38016, 0x6666c353
-0, 183600, 38016, 0x053fb0f2
-0, 187200, 38016, 0x2547c115
-0, 190800, 38016, 0xf202c045
-0, 194400, 38016, 0x94a8b95f
-0, 198000, 38016, 0x439ccb13
-0, 201600, 38016, 0xdfe4d54f
-0, 205200, 38016, 0x2a0aceae
-0, 208800, 38016, 0x1293dbd5
-0, 212400, 38016, 0x9a62d994
-0, 216000, 38016, 0x65539ad7
-0, 219600, 38016, 0xc415ad58
-0, 223200, 38016, 0x47bb9417
-0, 226800, 38016, 0x92b745ea
-0, 230400, 38016, 0x8fe8646e
-0, 234000, 38016, 0x2b94857a
-0, 237600, 38016, 0x12ac9aa4
-0, 241200, 38016, 0x856bf0ea
-0, 244800, 38016, 0xdbb32674
-0, 248400, 38016, 0x96b53747
-0, 252000, 38016, 0x875a7548
-0, 255600, 38016, 0xdba4985c
-0, 259200, 38016, 0x47cbb86c
-0, 262800, 38016, 0x32dcfb99
-0, 266400, 38016, 0x18b53b26
-0, 270000, 38016, 0x2f0f3e49
-0, 273600, 38016, 0x27b1880d
-0, 277200, 38016, 0xbcc19dac
-0, 280800, 38016, 0x7b6caeb1
-0, 284400, 38016, 0xf3eece06
-0, 288000, 38016, 0x7d93d4c9
-0, 291600, 38016, 0xe6b8d923
-0, 295200, 38016, 0xf47ce844
-0, 298800, 38016, 0x74fce21c
-0, 302400, 38016, 0x8e87d8cd
-0, 306000, 38016, 0x9675d3ce
-0, 309600, 38016, 0xd797ec75
-0, 313200, 38016, 0x70aeeef1
-0, 316800, 38016, 0x47baef32
-0, 320400, 38016, 0x5054ec56
-0, 324000, 38016, 0x43b6a0f7
-0, 327600, 38016, 0x95dfb688
-0, 331200, 38016, 0xc878a574
-0, 334800, 38016, 0xeb928019
-0, 338400, 38016, 0x304b7fec
-0, 342000, 38016, 0x02cd7ea4
-0, 345600, 38016, 0x505f7a7a
-0, 349200, 38016, 0x09f59eaf
-0, 352800, 38016, 0x513faaf7
-0, 356400, 38016, 0xbd0daaa8
-0, 360000, 38016, 0x8012be0f
-0, 363600, 38016, 0xb663aa15
-0, 367200, 38016, 0xd138981a
-0, 370800, 38016, 0xc16b98a2
-0, 374400, 38016, 0xf43eb8f8
-0, 378000, 38016, 0xea22a35b
-0, 381600, 38016, 0x9a0be0bb
-0, 385200, 38016, 0x2a77ff9d
-0, 388800, 38016, 0x2e350431
-0, 392400, 38016, 0x9d0335ba
-0, 396000, 38016, 0x62f23f21
-0, 399600, 38016, 0x3e973351
-0, 403200, 38016, 0x9d8f4ac5
-0, 406800, 38016, 0x91e132ba
-0, 410400, 38016, 0xfd04f69a
-0, 414000, 38016, 0x481a1778
-0, 417600, 38016, 0x27fa1dc4
-0, 421200, 38016, 0x23ae0a6a
-0, 424800, 38016, 0xc3ec426a
-0, 428400, 38016, 0xc2a54ac1
-0, 432000, 38016, 0xd88d3691
-0, 435600, 38016, 0x46014ba7
-0, 439200, 38016, 0xbf902815
-0, 442800, 38016, 0x2af5ee16
-0, 446400, 38016, 0xd183dc64
-0, 450000, 38016, 0xf0c5bdd8
-0, 453600, 38016, 0xb21aa102
-0, 457200, 38016, 0xb35bbec2
-0, 460800, 38016, 0x7efad1ce
-0, 464400, 38016, 0x04e3d71d
-0, 468000, 38016, 0x901ff71b
-0, 471600, 38016, 0xc6c6e640
-0, 475200, 38016, 0xd292d5d3
-0, 478800, 38016, 0x2ce4e3fe
-0, 482400, 38016, 0xe7fedf8a
-0, 486000, 38016, 0x20e5a1eb
-0, 489600, 38016, 0xbc39be76
-0, 493200, 38016, 0xf749b4dd
-0, 496800, 38016, 0xbc3f97a4
-0, 500400, 38016, 0xa058a244
-0, 504000, 38016, 0x77eb961b
-0, 507600, 38016, 0xa92e7f25
-0, 511200, 38016, 0xc75e796f
-0, 514800, 38016, 0x114c79bd
-0, 518400, 38016, 0x3fb96da3
-0, 522000, 38016, 0x1c6f87b8
-0, 525600, 38016, 0x25567ae4
-0, 529200, 38016, 0xf5dd42b2
-0, 532800, 38016, 0xe6172d0c
-0, 536400, 38016, 0xcec0fd48
-0, 540000, 38016, 0x0d27b12d
-0, 543600, 38016, 0x3ec7cd24
-0, 547200, 38016, 0xb2dccabe
-0, 550800, 38016, 0xa977a844
-0, 554400, 38016, 0x4b3bbfed
-0, 558000, 38016, 0xed6dd876
-0, 561600, 38016, 0x751bd34e
-0, 565200, 38016, 0x80160cf9
-0, 568800, 38016, 0xfbf53be8
-0, 572400, 38016, 0x726e4f3b
-0, 576000, 38016, 0x8ebb730c
-0, 579600, 38016, 0x2c0c5fe6
-0, 583200, 38016, 0x450940c0
-0, 586800, 38016, 0xeed63ff8
-0, 590400, 38016, 0x6f233d75
-0, 594000, 38016, 0x98d2f70e
-0, 597600, 38016, 0x8d38f2e8
-0, 601200, 38016, 0x905dcbc9
-0, 604800, 38016, 0x68c3a0f7
-0, 608400, 38016, 0x4bb8a40c
-0, 612000, 38016, 0x3650b08e
-0, 615600, 38016, 0x3c3bbfd7
-0, 619200, 38016, 0xcbc9da56
-0, 622800, 38016, 0x576de6cd
-0, 626400, 38016, 0x95f5c8c1
-0, 630000, 38016, 0xbbcaacc8
-0, 633600, 38016, 0x1b547ba4
-0, 637200, 38016, 0x8f5238b2
-0, 640800, 38016, 0x4c0f35c4
-0, 644400, 38016, 0x894f278d
-0, 648000, 38016, 0x3bb3ecd3
-0, 651600, 38016, 0x177bf317
-0, 655200, 38016, 0xdb1fdada
-0, 658800, 38016, 0xec27cc28
-0, 662400, 38016, 0x6a12eec7
-0, 666000, 38016, 0x0168ff3f
-0, 669600, 38016, 0x3fa206ba
-0, 673200, 38016, 0x47cc30b5
-0, 676800, 38016, 0xb2d02ddd
-0, 680400, 38016, 0x306626bb
-0, 684000, 38016, 0xfb06eb5b
-0, 687600, 38016, 0x5881b60e
-0, 691200, 38016, 0xd58caaf8
-0, 694800, 38016, 0x840bdd0c
-0, 698400, 38016, 0xb71efac1
-0, 702000, 38016, 0x25961ad1
-0, 705600, 38016, 0xbec156eb
-0, 709200, 38016, 0xe2d1695c
-0, 712800, 38016, 0x3fbe83d4
-0, 716400, 38016, 0x10d8afe2
-0, 720000, 38016, 0xa61fb9aa
-0, 723600, 38016, 0x0c20be29
-0, 727200, 38016, 0xc273cdd4
-0, 730800, 38016, 0xfb21cfa0
-0, 734400, 38016, 0xb1ccc643
-0, 738000, 38016, 0x30f5d7a2
-0, 741600, 38016, 0xe742da0f
-0, 745200, 38016, 0x0a08d6a3
-0, 748800, 38016, 0x85c4cf6c
-0, 752400, 38016, 0xc117b8f4
-0, 756000, 38016, 0x39305ec1
-0, 759600, 38016, 0xf2867b2d
-0, 763200, 38016, 0x81147a22
-0, 766800, 38016, 0x308b59c3
-0, 770400, 38016, 0xfd076bbd
-0, 774000, 38016, 0x11bf57f5
-0, 777600, 38016, 0x8c103fb7
-0, 781200, 38016, 0x4f5e5a48
-0, 784800, 38016, 0xa0fd54dc
-0, 788400, 38016, 0x69d7429b
-0, 792000, 38016, 0x93154a7c
-0, 795600, 38016, 0xc72e3995
-0, 799200, 38016, 0x86541ae0
-0, 802800, 38016, 0xa9c93120
-0, 806400, 38016, 0x602d368a
-0, 810000, 38016, 0x6fca13cb
-0, 813600, 38016, 0x314f3702
-0, 817200, 38016, 0x4d1647bd
-0, 820800, 38016, 0x73673c96
-0, 824400, 38016, 0x62897c6f
-0, 828000, 38016, 0x918e9a7d
-0, 831600, 38016, 0x9fb9ad4f
-0, 835200, 38016, 0xc4c30339
-0, 838800, 38016, 0x137017df
-0, 842400, 38016, 0xa98a1b61
-0, 846000, 38016, 0xf74c4b4f
-0, 849600, 38016, 0x3eac5cb1
-0, 853200, 38016, 0x5d403e50
-0, 856800, 38016, 0xa33a4eb6
-0, 860400, 38016, 0x3f0a13fb
-0, 864000, 38016, 0x8b11e5a8
-0, 867600, 38016, 0x536bca4b
-0, 871200, 38016, 0xe1daa789
-0, 874800, 38016, 0xab37f6d1
-0, 878400, 38016, 0xbefe6f58
-0, 882000, 38016, 0xa5fdd2ff
-0, 885600, 38016, 0x6065ec01
-0, 889200, 38016, 0x939dd93a
-0, 892800, 38016, 0x3a7593d5
-0, 896400, 38016, 0x30fe19fe
-0, 900000, 38016, 0xb507c21c
-0, 903600, 38016, 0xf47f73ac
-0, 907200, 38016, 0xe9fc669a
-0, 910800, 38016, 0x2b85d19a
-0, 914400, 38016, 0x57033999
-0, 918000, 38016, 0x0e5eca3b
-0, 921600, 38016, 0x6a7bda2c
-0, 925200, 38016, 0x3517638d
-0, 928800, 38016, 0x1f5432e3
-0, 932400, 38016, 0x584d4c96
-0, 936000, 38016, 0x92474c0c
-0, 939600, 38016, 0x8c5e44a5
-0, 943200, 38016, 0x07dd64d4
-0, 946800, 38016, 0x828d632b
-0, 950400, 38016, 0x142254b6
-0, 954000, 38016, 0x8f9b60a4
-0, 957600, 38016, 0x44f745dd
-0, 961200, 38016, 0xc3321666
-0, 964800, 38016, 0x95520396
-0, 968400, 38016, 0x3eb3de27
-0, 972000, 38016, 0x0ce3a7ca
-0, 975600, 38016, 0x58258838
-0, 979200, 38016, 0x5725627a
-0, 982800, 38016, 0x901907ab
-0, 986400, 38016, 0xf965da2f
-0, 990000, 38016, 0xf542bae9
-0, 993600, 38016, 0x3dc4b3c3
-0, 997200, 38016, 0x8a1dd1e9
-0, 1000800, 38016, 0x4f6ef803
-0, 1004400, 38016, 0xde384800
-0, 1008000, 38016, 0x7251116f
-0, 1011600, 38016, 0x89f9e1ca
-0, 1015200, 38016, 0xc9818624
-0, 1018800, 38016, 0x30e391a6
-0, 1022400, 38016, 0x7aab6887
-0, 1026000, 38016, 0x0a34a67f
-0, 1029600, 38016, 0xe1258086
-0, 1033200, 38016, 0x5b16a887
-0, 1036800, 38016, 0x3297a135
-0, 1040400, 38016, 0x45a77236
-0, 1044000, 38016, 0xa414013a
-0, 1047600, 38016, 0xfab52c7e
-0, 1051200, 38016, 0x9074aca1
-0, 1054800, 38016, 0x843ad8a6
-0, 1058400, 38016, 0xccc63573
-0, 1062000, 38016, 0x3ba52a5f
-0, 1065600, 38016, 0x2f7b0236
-0, 1069200, 38016, 0x0ad407ec
-0, 1072800, 38016, 0x42082369
-0, 1076400, 38016, 0x5a9d3f63
diff --git a/tests/ref/fate/h264-conformance-canl3_sva_b b/tests/ref/fate/h264-conformance-canl3_sva_b
deleted file mode 100644
index 1c575c8..0000000
--- a/tests/ref/fate/h264-conformance-canl3_sva_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0x0bd22424
-0, 3600, 38016, 0xc45d1947
-0, 7200, 38016, 0x9d3d1218
-0, 10800, 38016, 0x79b71e03
-0, 14400, 38016, 0xd11e4a14
-0, 18000, 38016, 0x44c66b22
-0, 21600, 38016, 0xb9cc7acf
-0, 25200, 38016, 0x8ccd92a1
-0, 28800, 38016, 0x4a76aec4
-0, 32400, 38016, 0x6e2fc27e
-0, 36000, 38016, 0x400ea1fb
-0, 39600, 38016, 0xd1e2b7c4
-0, 43200, 38016, 0xb45eb08d
-0, 46800, 38016, 0x15079991
-0, 50400, 38016, 0x0fc97188
-0, 54000, 38016, 0xf9fc81af
-0, 57600, 38016, 0x020f992d
diff --git a/tests/ref/fate/h264-conformance-canl4_sva_b b/tests/ref/fate/h264-conformance-canl4_sva_b
deleted file mode 100644
index 65555fa..0000000
--- a/tests/ref/fate/h264-conformance-canl4_sva_b
+++ /dev/null
@@ -1,33 +0,0 @@
-0, 0, 38016, 0x5d9514e3
-0, 3600, 38016, 0xf5e8155c
-0, 7200, 38016, 0xc0a5f88b
-0, 10800, 38016, 0x421d2610
-0, 14400, 38016, 0x971838af
-0, 18000, 38016, 0xbd645dfc
-0, 21600, 38016, 0xaab5626a
-0, 25200, 38016, 0xc8fc9b6b
-0, 28800, 38016, 0x8be593f4
-0, 32400, 38016, 0x6560c0f4
-0, 36000, 38016, 0x29009b56
-0, 39600, 38016, 0x20b4bd2a
-0, 43200, 38016, 0xe8a7a51e
-0, 46800, 38016, 0x8c5e906a
-0, 50400, 38016, 0x15496f1e
-0, 54000, 38016, 0xdc788399
-0, 57600, 38016, 0x2b1e89b2
-0, 61200, 38016, 0xe9fda9bd
-0, 64800, 38016, 0x7c319f69
-0, 68400, 38016, 0x2921cbc4
-0, 72000, 38016, 0xb4fab1e2
-0, 75600, 38016, 0x6af6ba57
-0, 79200, 38016, 0xb36e7df5
-0, 82800, 38016, 0x57517aec
-0, 86400, 38016, 0x9f5f331a
-0, 90000, 38016, 0xafde3f8a
-0, 93600, 38016, 0x97f32b54
-0, 97200, 38016, 0x0c194bf7
-0, 100800, 38016, 0x58a054c2
-0, 104400, 38016, 0x6a637e5f
-0, 108000, 38016, 0x8b2d63d0
-0, 111600, 38016, 0x521772c5
-0, 115200, 38016, 0xae555677
diff --git a/tests/ref/fate/h264-conformance-canlma2_sony_c b/tests/ref/fate/h264-conformance-canlma2_sony_c
deleted file mode 100644
index 5eff64e..0000000
--- a/tests/ref/fate/h264-conformance-canlma2_sony_c
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 518400, 0xfbca00c6
-0, 3600, 518400, 0x82b80adf
-0, 7200, 518400, 0x87ecdf4a
-0, 10800, 518400, 0xf6ca8cbe
-0, 14400, 518400, 0x8e9bb8a0
-0, 18000, 518400, 0x6512caa2
-0, 21600, 518400, 0xc015e43e
-0, 25200, 518400, 0x5f504a5c
-0, 28800, 518400, 0x4c7458a4
-0, 32400, 518400, 0x630f4004
-0, 36000, 518400, 0x889af20e
-0, 39600, 518400, 0x4437a5a4
-0, 43200, 518400, 0x1e19a254
-0, 46800, 518400, 0xb7ef1763
-0, 50400, 518400, 0xc966c95a
-0, 54000, 518400, 0x0c9074d6
-0, 57600, 518400, 0x24c906c9
diff --git a/tests/ref/fate/h264-conformance-canlma3_sony_c b/tests/ref/fate/h264-conformance-canlma3_sony_c
deleted file mode 100644
index 9ee15dd..0000000
--- a/tests/ref/fate/h264-conformance-canlma3_sony_c
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 518400, 0xfbca00c6
-0, 3600, 518400, 0x82b80adf
-0, 7200, 518400, 0x4874c24c
-0, 10800, 518400, 0xdb19528a
-0, 14400, 518400, 0x27888656
-0, 18000, 518400, 0x5e7aa98f
-0, 21600, 518400, 0xb43ecd8b
-0, 25200, 518400, 0xef772cbd
-0, 28800, 518400, 0x4f1e1d7e
-0, 32400, 518400, 0x0e9fe921
-0, 36000, 518400, 0xe4dab3d2
-0, 39600, 518400, 0x9279587b
-0, 43200, 518400, 0xa8248296
-0, 46800, 518400, 0x7be6c0d6
-0, 50400, 518400, 0x85ea92b1
-0, 54000, 518400, 0x0c9074d6
-0, 57600, 518400, 0x5c95bf41
diff --git a/tests/ref/fate/h264-conformance-capa1_toshiba_b b/tests/ref/fate/h264-conformance-capa1_toshiba_b
deleted file mode 100644
index 9f1d91f..0000000
--- a/tests/ref/fate/h264-conformance-capa1_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0x4040d2fc
-0, 3600, 152064, 0x0d8f9897
-0, 7200, 152064, 0xc23321cd
-0, 10800, 152064, 0x3c9225eb
-0, 14400, 152064, 0x8927006f
-0, 18000, 152064, 0xf706a302
-0, 21600, 152064, 0x8219c106
-0, 25200, 152064, 0x06c990ea
-0, 28800, 152064, 0x3a0f1135
-0, 32400, 152064, 0x4cff21d3
-0, 36000, 152064, 0x6be0e050
-0, 39600, 152064, 0x718b6c7b
-0, 43200, 152064, 0x24b38713
-0, 46800, 152064, 0x500553fb
-0, 50400, 152064, 0x531ae610
-0, 54000, 152064, 0x46f4ff1b
-0, 57600, 152064, 0xe5abe5ff
-0, 61200, 152064, 0x97daa351
-0, 64800, 152064, 0xfbef0a8f
-0, 68400, 152064, 0xbe76134f
-0, 72000, 152064, 0xa4bf10ea
-0, 75600, 152064, 0xb2fb32af
-0, 79200, 152064, 0xd33027a5
-0, 82800, 152064, 0x78e20c2b
-0, 86400, 152064, 0xefda2d6f
-0, 90000, 152064, 0xb99126f0
-0, 93600, 152064, 0x89d7e465
-0, 97200, 152064, 0x6150ff97
-0, 100800, 152064, 0xde03d937
-0, 104400, 152064, 0xd90ca874
-0, 108000, 152064, 0xb120b294
-0, 111600, 152064, 0x644eade4
-0, 115200, 152064, 0xd1bb004f
-0, 118800, 152064, 0x99806a8b
-0, 122400, 152064, 0x8c6b635f
-0, 126000, 152064, 0xa269fa8b
-0, 129600, 152064, 0xc11c0e64
-0, 133200, 152064, 0xac13f5eb
-0, 136800, 152064, 0x895799cf
-0, 140400, 152064, 0x95a9bea1
-0, 144000, 152064, 0xe998dfba
-0, 147600, 152064, 0xc72d8460
-0, 151200, 152064, 0xd1cb9b9a
-0, 154800, 152064, 0xb49aadd3
-0, 158400, 152064, 0x8bc38547
-0, 162000, 152064, 0x3485984b
-0, 165600, 152064, 0xdf305c0a
-0, 169200, 152064, 0x6a1ec990
-0, 172800, 152064, 0x595e0de4
-0, 176400, 152064, 0xe1baf7c4
-0, 180000, 152064, 0xf08b9b47
-0, 183600, 152064, 0x6532ba6f
-0, 187200, 152064, 0x3de67da6
-0, 190800, 152064, 0x439ffd04
-0, 194400, 152064, 0x6e6c1e97
-0, 198000, 152064, 0x8e5aee7a
-0, 201600, 152064, 0xd634999a
-0, 205200, 152064, 0xadfa9e8b
-0, 208800, 152064, 0x1b9090f5
-0, 212400, 152064, 0x29094dfc
-0, 216000, 152064, 0x56748851
-0, 219600, 152064, 0x2316719d
-0, 223200, 152064, 0x2ee0060b
-0, 226800, 152064, 0x3edb36d4
-0, 230400, 152064, 0x9ef437a3
-0, 234000, 152064, 0x8d9af72e
-0, 237600, 152064, 0xab86389c
-0, 241200, 152064, 0xd3b34576
-0, 244800, 152064, 0x9e5b04f4
-0, 248400, 152064, 0x6a164c17
-0, 252000, 152064, 0xcecf20ab
-0, 255600, 152064, 0x07c8e273
-0, 259200, 152064, 0x9b46fe6a
-0, 262800, 152064, 0xc1e8002b
-0, 266400, 152064, 0xdebdbe53
-0, 270000, 152064, 0x0d2dfd99
-0, 273600, 152064, 0xe8ae925f
-0, 277200, 152064, 0xe1fe6272
-0, 280800, 152064, 0xbb74d5e6
-0, 284400, 152064, 0xc7b5d949
-0, 288000, 152064, 0x9b15b020
-0, 291600, 152064, 0xc8201f44
-0, 295200, 152064, 0x30d03303
-0, 298800, 152064, 0x9f66fbc2
-0, 302400, 152064, 0x482b71ec
-0, 306000, 152064, 0x1c9e50bf
-0, 309600, 152064, 0x89f247e4
-0, 313200, 152064, 0xaa5f9141
-0, 316800, 152064, 0xb816aa8c
-0, 320400, 152064, 0x3112a619
diff --git a/tests/ref/fate/h264-conformance-capama3_sand_f b/tests/ref/fate/h264-conformance-capama3_sand_f
deleted file mode 100644
index 5fb9756..0000000
--- a/tests/ref/fate/h264-conformance-capama3_sand_f
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 152064, 0xf772f152
-0, 3600, 152064, 0xc416d300
-0, 7200, 152064, 0xc2275c94
-0, 10800, 152064, 0x1bd35645
-0, 14400, 152064, 0x60327bf5
-0, 18000, 152064, 0x7f5541bd
-0, 21600, 152064, 0x52e5ebad
-0, 25200, 152064, 0xb8e5c1f3
-0, 28800, 152064, 0x2b4e3653
-0, 32400, 152064, 0x9a8f8499
-0, 36000, 152064, 0x32d4e9fb
-0, 39600, 152064, 0x0bc73d7a
-0, 43200, 152064, 0xb58a8b87
-0, 46800, 152064, 0xddbc5468
-0, 50400, 152064, 0xcfa30b64
-0, 54000, 152064, 0xad411f36
-0, 57600, 152064, 0x2f8c4d9b
-0, 61200, 152064, 0xc8523359
-0, 64800, 152064, 0x86be9861
-0, 68400, 152064, 0x7518d731
-0, 72000, 152064, 0x425fbfab
-0, 75600, 152064, 0x4f00250d
-0, 79200, 152064, 0x12b40617
-0, 82800, 152064, 0x65ff925d
-0, 86400, 152064, 0xc76a94c9
-0, 90000, 152064, 0x640170d5
-0, 93600, 152064, 0xd338a090
-0, 97200, 152064, 0xce715174
-0, 100800, 152064, 0x7bded195
-0, 104400, 152064, 0x09e7d3b9
-0, 108000, 152064, 0x651e1518
-0, 111600, 152064, 0x03cadc5f
-0, 115200, 152064, 0x08906919
-0, 118800, 152064, 0x3303ebe0
-0, 122400, 152064, 0xa28676c5
-0, 126000, 152064, 0x3900ecaf
-0, 129600, 152064, 0xeb795a05
-0, 133200, 152064, 0x870034df
-0, 136800, 152064, 0x69b0527a
-0, 140400, 152064, 0xb2b314f9
-0, 144000, 152064, 0x1a44ea1a
-0, 147600, 152064, 0xe6eaec87
-0, 151200, 152064, 0xd9ad818e
-0, 154800, 152064, 0x9c7ff76e
-0, 158400, 152064, 0x74c45abb
-0, 162000, 152064, 0x2f4fa5c6
-0, 165600, 152064, 0x19620702
-0, 169200, 152064, 0xfc9601f3
-0, 172800, 152064, 0x33e0d8e7
-0, 176400, 152064, 0xdf7f2a80
diff --git a/tests/ref/fate/h264-conformance-capcm1_sand_e b/tests/ref/fate/h264-conformance-capcm1_sand_e
deleted file mode 100644
index 3a90eaf..0000000
--- a/tests/ref/fate/h264-conformance-capcm1_sand_e
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 152064, 0x9989b588
-0, 3600, 152064, 0x7cbf85d4
-0, 7200, 152064, 0x72615cf1
-0, 10800, 152064, 0xcf98053c
-0, 14400, 152064, 0x42daddb0
-0, 18000, 152064, 0x460ca616
-0, 21600, 152064, 0x54cc5ab1
-0, 25200, 152064, 0xd146396e
-0, 28800, 152064, 0xefbbffc3
-0, 32400, 152064, 0x41ecd870
-0, 36000, 152064, 0x57bba322
-0, 39600, 152064, 0x7e7270f8
-0, 43200, 152064, 0x1f5d1f0e
-0, 46800, 152064, 0x5478eb60
-0, 50400, 152064, 0xd9abb62a
-0, 54000, 152064, 0x97997f6d
-0, 57600, 152064, 0xfc405569
-0, 61200, 152064, 0x4e49329b
-0, 64800, 152064, 0x6b98f9c6
-0, 68400, 152064, 0xa872cf59
-0, 72000, 152064, 0x478a897d
-0, 75600, 152064, 0xf6744e5d
-0, 79200, 152064, 0x7ddf110d
-0, 82800, 152064, 0xe6bde4be
-0, 86400, 152064, 0x5c3ba029
-0, 90000, 152064, 0x07759146
-0, 93600, 152064, 0x4beb510f
-0, 97200, 152064, 0x5b063ad9
-0, 100800, 152064, 0xc2930366
-0, 104400, 152064, 0x5435e658
diff --git a/tests/ref/fate/h264-conformance-capcmnl1_sand_e b/tests/ref/fate/h264-conformance-capcmnl1_sand_e
deleted file mode 100644
index 02f6a90..0000000
--- a/tests/ref/fate/h264-conformance-capcmnl1_sand_e
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 152064, 0xf973b384
-0, 3600, 152064, 0x84418532
-0, 7200, 152064, 0x63165bc0
-0, 10800, 152064, 0x54b5049d
-0, 14400, 152064, 0xde66dbbc
-0, 18000, 152064, 0x8001a4f5
-0, 21600, 152064, 0x6b5259b7
-0, 25200, 152064, 0xd15137a1
-0, 28800, 152064, 0x1d19fdb9
-0, 32400, 152064, 0x3533d5a1
-0, 36000, 152064, 0xf82ba039
-0, 39600, 152064, 0x04366ee9
-0, 43200, 152064, 0xf7ac1dfb
-0, 46800, 152064, 0x6d0aebd7
-0, 50400, 152064, 0x4f2bb62d
-0, 54000, 152064, 0x6a7a7d50
-0, 57600, 152064, 0xc9c95422
-0, 61200, 152064, 0x35a13150
-0, 64800, 152064, 0xb576f7e4
-0, 68400, 152064, 0x5ad3cde5
-0, 72000, 152064, 0xbcb18908
-0, 75600, 152064, 0xa2a24ca7
-0, 79200, 152064, 0x95700ea5
-0, 82800, 152064, 0xfdb5e316
-0, 86400, 152064, 0x56e3a003
-0, 90000, 152064, 0x09ae905c
-0, 93600, 152064, 0xa1175024
-0, 97200, 152064, 0x8b82395e
-0, 100800, 152064, 0x032202da
-0, 104400, 152064, 0xae15e5e7
diff --git a/tests/ref/fate/h264-conformance-capm3_sony_d b/tests/ref/fate/h264-conformance-capm3_sony_d
deleted file mode 100644
index 4080b65..0000000
--- a/tests/ref/fate/h264-conformance-capm3_sony_d
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xa3b72d2f
-0, 3600, 38016, 0x77d918ae
-0, 7200, 38016, 0x181ad684
-0, 10800, 38016, 0x0dafa49c
-0, 14400, 38016, 0x8250a733
-0, 18000, 38016, 0x5d4f79b5
-0, 21600, 38016, 0x59664665
-0, 25200, 38016, 0xdce3491c
-0, 28800, 38016, 0xaffc395f
-0, 32400, 38016, 0xfb09320d
-0, 36000, 38016, 0x9b776724
-0, 39600, 38016, 0x30497da7
-0, 43200, 38016, 0xffd16ea0
-0, 46800, 38016, 0x5b7da1b5
-0, 50400, 38016, 0x764a9cc4
-0, 54000, 38016, 0xc4c79c41
-0, 57600, 38016, 0x883299dd
-0, 61200, 38016, 0xd5f39350
-0, 64800, 38016, 0x892f6808
-0, 68400, 38016, 0x5b0572d7
-0, 72000, 38016, 0x53c84a0c
-0, 75600, 38016, 0xe6ff14e2
-0, 79200, 38016, 0xd66d1924
-0, 82800, 38016, 0x7bec105f
-0, 86400, 38016, 0x405ffc8d
-0, 90000, 38016, 0xfccc2019
-0, 93600, 38016, 0x639f25a2
-0, 97200, 38016, 0xf89e179b
-0, 100800, 38016, 0x3e49456e
-0, 104400, 38016, 0x8d7d5d8e
-0, 108000, 38016, 0x89d15f1e
-0, 111600, 38016, 0x413d8c6a
-0, 115200, 38016, 0xf1a0a555
-0, 118800, 38016, 0x61249a1f
-0, 122400, 38016, 0xbd91c000
-0, 126000, 38016, 0x3209c225
-0, 129600, 38016, 0xfebca72f
-0, 133200, 38016, 0x839abdfd
-0, 136800, 38016, 0xa47cbc00
-0, 140400, 38016, 0x4537a269
-0, 144000, 38016, 0xbf19c0b2
-0, 147600, 38016, 0x7487c290
-0, 151200, 38016, 0xfbf8ab0c
-0, 154800, 38016, 0xce2ab41e
-0, 158400, 38016, 0xb505acf2
-0, 162000, 38016, 0x758489bc
-0, 165600, 38016, 0x7eae9aca
-0, 169200, 38016, 0x67b59692
-0, 172800, 38016, 0x074d9354
-0, 176400, 38016, 0xb6f6ae8a
-0, 180000, 38016, 0xe3b9a825
-0, 183600, 38016, 0x5f4e9cb2
-0, 187200, 38016, 0x88b3abcd
-0, 190800, 38016, 0x0cd7acdb
-0, 194400, 38016, 0xa731a3e4
-0, 198000, 38016, 0x9414c055
-0, 201600, 38016, 0x6cfec34a
-0, 205200, 38016, 0x6c89bce0
-0, 208800, 38016, 0xdabdc781
-0, 212400, 38016, 0x1afcc587
-0, 216000, 38016, 0xb4e79851
-0, 219600, 38016, 0x383ca78a
-0, 223200, 38016, 0x461f83fb
-0, 226800, 38016, 0x55f039e3
-0, 230400, 38016, 0xb6ec5d3f
-0, 234000, 38016, 0x645888af
-0, 237600, 38016, 0x37bc9e52
-0, 241200, 38016, 0x12a4f603
-0, 244800, 38016, 0x63e92df7
-0, 248400, 38016, 0x1a0246e3
-0, 252000, 38016, 0x1a6282fe
-0, 255600, 38016, 0x4e99a785
-0, 259200, 38016, 0xdaefbf23
-0, 262800, 38016, 0x9e8f00f1
-0, 266400, 38016, 0x85ea26c5
-0, 270000, 38016, 0x495e2ddb
-0, 273600, 38016, 0xab6278a4
-0, 277200, 38016, 0x48a78708
-0, 280800, 38016, 0x6fe99535
-0, 284400, 38016, 0xc3d9b8eb
-0, 288000, 38016, 0x4491c577
-0, 291600, 38016, 0x4d42cc30
-0, 295200, 38016, 0x3469d8bd
-0, 298800, 38016, 0x563dd0ad
-0, 302400, 38016, 0x681dbdef
-0, 306000, 38016, 0x5da9d2a7
-0, 309600, 38016, 0x75abdf2e
-0, 313200, 38016, 0x9bf0d13a
-0, 316800, 38016, 0x3c24dd7c
-0, 320400, 38016, 0x5132df96
-0, 324000, 38016, 0x01bd9d86
-0, 327600, 38016, 0x2b97bdfe
-0, 331200, 38016, 0xa7fdb2f1
-0, 334800, 38016, 0xcf908cfd
-0, 338400, 38016, 0xd18e7e52
-0, 342000, 38016, 0x6a1d78d3
-0, 345600, 38016, 0xd9cc83af
-0, 349200, 38016, 0xf6329ca1
-0, 352800, 38016, 0x1976aaeb
-0, 356400, 38016, 0xa3e8a3ce
-0, 360000, 38016, 0x73a2bd65
-0, 363600, 38016, 0xfd00a552
-0, 367200, 38016, 0x2df18642
-0, 370800, 38016, 0x85ad82fb
-0, 374400, 38016, 0x0456a864
-0, 378000, 38016, 0x0d6da3b6
-0, 381600, 38016, 0xabf0de94
-0, 385200, 38016, 0x68aef77e
-0, 388800, 38016, 0xd6aefd84
-0, 392400, 38016, 0x01953184
-0, 396000, 38016, 0xff324067
-0, 399600, 38016, 0x49aa300f
-0, 403200, 38016, 0xc146456b
-0, 406800, 38016, 0xfe5c2980
-0, 410400, 38016, 0x8f4df7eb
-0, 414000, 38016, 0x137c1373
-0, 417600, 38016, 0xfb9d1006
-0, 421200, 38016, 0x7f5409f9
-0, 424800, 38016, 0xa6ff29fc
-0, 428400, 38016, 0xc63e3807
-0, 432000, 38016, 0xd77c313a
-0, 435600, 38016, 0xdd3832dd
-0, 439200, 38016, 0xe70d140c
-0, 442800, 38016, 0xa559d731
-0, 446400, 38016, 0x3593d345
-0, 450000, 38016, 0x7497ad8a
-0, 453600, 38016, 0x9906919f
-0, 457200, 38016, 0x18bfb034
-0, 460800, 38016, 0xa4fbbd76
-0, 464400, 38016, 0xbd6cc31c
-0, 468000, 38016, 0x6ddde005
-0, 471600, 38016, 0x0072dd5f
-0, 475200, 38016, 0x62c5c5c0
-0, 478800, 38016, 0x1093cf81
-0, 482400, 38016, 0x46dbc9ff
-0, 486000, 38016, 0x0269a169
-0, 489600, 38016, 0xc96daa27
-0, 493200, 38016, 0xa0319cf4
-0, 496800, 38016, 0x1cae87fd
-0, 500400, 38016, 0xf1a0977f
-0, 504000, 38016, 0xc4d48a56
-0, 507600, 38016, 0xd3b1704c
-0, 511200, 38016, 0xd5e46a6c
-0, 514800, 38016, 0xb73e68fb
-0, 518400, 38016, 0xc0585fcf
-0, 522000, 38016, 0x1b3978fe
-0, 525600, 38016, 0xdda66c02
-0, 529200, 38016, 0x581033d6
-0, 532800, 38016, 0x0737185f
-0, 536400, 38016, 0xa0c9f494
-0, 540000, 38016, 0x916eae22
-0, 543600, 38016, 0xfdf7d6cd
-0, 547200, 38016, 0x6978ce4c
-0, 550800, 38016, 0x6783b016
-0, 554400, 38016, 0x528ac304
-0, 558000, 38016, 0x245de0ae
-0, 561600, 38016, 0x1dade956
-0, 565200, 38016, 0xa8f316da
-0, 568800, 38016, 0x95f04ca6
-0, 572400, 38016, 0x76615822
-0, 576000, 38016, 0x21de6ff4
-0, 579600, 38016, 0x12be5e8b
-0, 583200, 38016, 0x47ea3cbd
-0, 586800, 38016, 0x113631b5
-0, 590400, 38016, 0x546b2789
-0, 594000, 38016, 0x0505f2bb
-0, 597600, 38016, 0x90eee299
-0, 601200, 38016, 0x305cb341
-0, 604800, 38016, 0x5921841b
-0, 608400, 38016, 0x1449922d
-0, 612000, 38016, 0xca8f9f0a
-0, 615600, 38016, 0x0daeab19
-0, 619200, 38016, 0xde20dc27
-0, 622800, 38016, 0xb6ffd92c
-0, 626400, 38016, 0xedb1bc49
-0, 630000, 38016, 0x4ccf9ff5
-0, 633600, 38016, 0xfb636cd5
-0, 637200, 38016, 0x9c562c3d
-0, 640800, 38016, 0x0b021c95
-0, 644400, 38016, 0x8da50f21
-0, 648000, 38016, 0xa043ec8c
-0, 651600, 38016, 0x0143f4f2
-0, 655200, 38016, 0x77bece5b
-0, 658800, 38016, 0x147ccc68
-0, 662400, 38016, 0xa90cf948
-0, 666000, 38016, 0x8764066e
-0, 669600, 38016, 0x26c61821
-0, 673200, 38016, 0x39dd3be4
-0, 676800, 38016, 0xe2203c69
-0, 680400, 38016, 0x00e73014
-0, 684000, 38016, 0x0024f9eb
-0, 687600, 38016, 0x3a0da880
-0, 691200, 38016, 0x0336a353
-0, 694800, 38016, 0x721ed897
-0, 698400, 38016, 0x1c51f53f
-0, 702000, 38016, 0xeec91a00
-0, 705600, 38016, 0x73074864
-0, 709200, 38016, 0x672e5ff8
-0, 712800, 38016, 0xe7ea7aba
-0, 716400, 38016, 0x11899f08
-0, 720000, 38016, 0xa98daf03
-0, 723600, 38016, 0x4553af5c
-0, 727200, 38016, 0x4892c5d5
-0, 730800, 38016, 0x0ddbc2eb
-0, 734400, 38016, 0x0ce5b867
-0, 738000, 38016, 0xb0e6ce2c
-0, 741600, 38016, 0x8a2bd4da
-0, 745200, 38016, 0xf9f4cbec
-0, 748800, 38016, 0x77aeba8f
-0, 752400, 38016, 0xc1839e46
-0, 756000, 38016, 0x34845d3a
-0, 759600, 38016, 0xc3227ad7
-0, 763200, 38016, 0x2dad7051
-0, 766800, 38016, 0x7145565a
-0, 770400, 38016, 0x1e056ef1
-0, 774000, 38016, 0x9baa5195
-0, 777600, 38016, 0xacb53a1a
-0, 781200, 38016, 0x825d4fb7
-0, 784800, 38016, 0x63194b14
-0, 788400, 38016, 0xcb16360e
-0, 792000, 38016, 0x35104320
-0, 795600, 38016, 0x7e4c33dc
-0, 799200, 38016, 0x84811693
-0, 802800, 38016, 0x242b1811
-0, 806400, 38016, 0xb4af2667
-0, 810000, 38016, 0x77a20da2
-0, 813600, 38016, 0x8e4f36a8
-0, 817200, 38016, 0xe72435cb
-0, 820800, 38016, 0xf38a381b
-0, 824400, 38016, 0xb2b876d6
-0, 828000, 38016, 0x1c359b35
-0, 831600, 38016, 0x4fb8b180
-0, 835200, 38016, 0x90fdf94b
-0, 838800, 38016, 0xb8680c40
-0, 842400, 38016, 0x99331edd
-0, 846000, 38016, 0xd8e3433d
-0, 849600, 38016, 0x6d4d5aa2
-0, 853200, 38016, 0x4c3545c4
-0, 856800, 38016, 0x25b8376f
-0, 860400, 38016, 0xc4fe09df
-0, 864000, 38016, 0x6a9fe4f8
-0, 867600, 38016, 0x8fd2c2f3
-0, 871200, 38016, 0x78199f41
-0, 874800, 38016, 0x27b6e9f0
-0, 878400, 38016, 0xd8316400
-0, 882000, 38016, 0x0a70cd14
-0, 885600, 38016, 0x2075e91c
-0, 889200, 38016, 0xcd3cd7cb
-0, 892800, 38016, 0x4edc8cf5
-0, 896400, 38016, 0xf02e0bc7
-0, 900000, 38016, 0xcdd1b487
-0, 903600, 38016, 0xea5f6c8f
-0, 907200, 38016, 0x6b635e22
-0, 910800, 38016, 0xd548c435
-0, 914400, 38016, 0x455826ee
-0, 918000, 38016, 0x120ac7ed
-0, 921600, 38016, 0xf86adc5a
-0, 925200, 38016, 0x8dbd5c4e
-0, 928800, 38016, 0xe4c62dae
-0, 932400, 38016, 0x0a2a3be7
-0, 936000, 38016, 0xf8a243d7
-0, 939600, 38016, 0x898a3afb
-0, 943200, 38016, 0x39e661bb
-0, 946800, 38016, 0xe4e65f22
-0, 950400, 38016, 0x014846ff
-0, 954000, 38016, 0xf392509c
-0, 957600, 38016, 0x34623207
-0, 961200, 38016, 0xac4a09ed
-0, 964800, 38016, 0x9d18eb07
-0, 968400, 38016, 0x4594c90e
-0, 972000, 38016, 0x624f9b6b
-0, 975600, 38016, 0x8adc89d3
-0, 979200, 38016, 0xf4dd64f6
-0, 982800, 38016, 0x4c121386
-0, 986400, 38016, 0xfb5ddc7e
-0, 990000, 38016, 0x837fc31e
-0, 993600, 38016, 0xa4f4bd31
-0, 997200, 38016, 0x0445def7
-0, 1000800, 38016, 0xbac0fe62
-0, 1004400, 38016, 0x050b5778
-0, 1008000, 38016, 0x3d0723e5
-0, 1011600, 38016, 0x9967eae7
-0, 1015200, 38016, 0xf4be9ec7
-0, 1018800, 38016, 0x870377d2
-0, 1022400, 38016, 0x5c9d648a
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0xa50e7c6f
-0, 1033200, 38016, 0x2bd1b477
-0, 1036800, 38016, 0xd123ae8d
-0, 1040400, 38016, 0xf2fc7a6b
-0, 1044000, 38016, 0xaa3ee416
-0, 1047600, 38016, 0x5f8801d6
-0, 1051200, 38016, 0xbee7924a
-0, 1054800, 38016, 0x6e47c3e1
-0, 1058400, 38016, 0xf34f1223
-0, 1062000, 38016, 0x7a610876
-0, 1065600, 38016, 0x15e9e47f
-0, 1069200, 38016, 0x557ddcf1
-0, 1072800, 38016, 0xf0cd02e2
-0, 1076400, 38016, 0xe98f1deb
diff --git a/tests/ref/fate/h264-conformance-caqp1_sony_b b/tests/ref/fate/h264-conformance-caqp1_sony_b
deleted file mode 100644
index fe023eb..0000000
--- a/tests/ref/fate/h264-conformance-caqp1_sony_b
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 38016, 0x25f92b0e
-0, 3600, 38016, 0x2ecbe752
-0, 7200, 38016, 0x3432e744
-0, 10800, 38016, 0x7970aa2e
-0, 14400, 38016, 0x250787bf
-0, 18000, 38016, 0xd58e5e56
-0, 21600, 38016, 0xf4b8580f
-0, 25200, 38016, 0x9acb4096
-0, 28800, 38016, 0xeed0476f
-0, 32400, 38016, 0xe33846ef
-0, 36000, 38016, 0x02da4e76
-0, 39600, 38016, 0xd3e572f8
-0, 43200, 38016, 0x5fd27f8a
-0, 46800, 38016, 0xfa169823
-0, 50400, 38016, 0xcc6b8d76
-0, 54000, 38016, 0xcc4da11f
-0, 57600, 38016, 0x32259b9d
-0, 61200, 38016, 0xf1e39b70
-0, 64800, 38016, 0xb49d7480
-0, 68400, 38016, 0x3dc158e9
-0, 72000, 38016, 0x4ce134db
-0, 75600, 38016, 0x4fb30b43
-0, 79200, 38016, 0xda49fe5f
-0, 82800, 38016, 0x7fda0d68
-0, 86400, 38016, 0x3a8b25e3
-0, 90000, 38016, 0x3df11d4e
-0, 93600, 38016, 0x26e11107
-0, 97200, 38016, 0xdc3b03a7
-0, 100800, 38016, 0x72b2434d
-0, 104400, 38016, 0x2a013e27
-0, 108000, 38016, 0xf95a4c2e
-0, 111600, 38016, 0x1e7b6656
-0, 115200, 38016, 0x776a81c8
-0, 118800, 38016, 0x162cb0bf
-0, 122400, 38016, 0x7ff4aaf5
-0, 126000, 38016, 0x7150b50b
-0, 129600, 38016, 0xf7d0b889
-0, 133200, 38016, 0xbe09b5c2
-0, 136800, 38016, 0xf6f7d29c
-0, 140400, 38016, 0x4356b996
-0, 144000, 38016, 0xb056c4b4
-0, 147600, 38016, 0x38e9c6e6
-0, 151200, 38016, 0x9c64ab45
-0, 154800, 38016, 0x31189eef
-0, 158400, 38016, 0x1ee3a3b1
-0, 162000, 38016, 0x8bed7c95
-0, 165600, 38016, 0x30357cee
-0, 169200, 38016, 0x5d828428
-0, 172800, 38016, 0xc06388b3
-0, 176400, 38016, 0x2af597b4
diff --git a/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b b/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b
deleted file mode 100644
index 6a77690..0000000
--- a/tests/ref/fate/h264-conformance-cavlc_mot_fld0_full_b
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x99d0df36
-0, 3600, 518400, 0xa8601c1a
-0, 7200, 518400, 0x4a17d235
-0, 10800, 518400, 0x75f23abf
-0, 14400, 518400, 0x746aad53
-0, 18000, 518400, 0xb0b8913e
-0, 21600, 518400, 0x60a27f57
-0, 25200, 518400, 0xfa227f3e
-0, 28800, 518400, 0x7a1e57c2
-0, 32400, 518400, 0xcbbaa84f
-0, 36000, 518400, 0xf9c1bd13
-0, 39600, 518400, 0x9e80caaf
-0, 43200, 518400, 0x14cc6928
-0, 46800, 518400, 0xca0353ef
-0, 50400, 518400, 0xcad65e5f
-0, 54000, 518400, 0xd5bc47b3
-0, 57600, 518400, 0xa9893d36
-0, 61200, 518400, 0x69bd9085
-0, 64800, 518400, 0xff33c476
-0, 68400, 518400, 0x9538adf7
-0, 72000, 518400, 0xd4ff3b62
-0, 75600, 518400, 0x021a11fd
-0, 79200, 518400, 0x293e6f9f
-0, 82800, 518400, 0x5d38e4c3
-0, 86400, 518400, 0xd1f4ad49
-0, 90000, 518400, 0xf13dd946
-0, 93600, 518400, 0x0359e9ff
-0, 97200, 518400, 0xb61098ad
-0, 100800, 518400, 0xa855b11c
-0, 104400, 518400, 0x7fcf9343
diff --git a/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b b/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b
deleted file mode 100644
index 5d29a40..0000000
--- a/tests/ref/fate/h264-conformance-cavlc_mot_frm0_full_b
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x21baedbf
-0, 3600, 518400, 0x6003273c
-0, 7200, 518400, 0x935d45d7
-0, 10800, 518400, 0x00485000
-0, 14400, 518400, 0x31b191ff
-0, 18000, 518400, 0xe334135a
-0, 21600, 518400, 0xc4d7bf2c
-0, 25200, 518400, 0x7106ac82
-0, 28800, 518400, 0xeb277b07
-0, 32400, 518400, 0xaf1ee80f
-0, 36000, 518400, 0x8c7d1bad
-0, 39600, 518400, 0x0e24ae6c
-0, 43200, 518400, 0x89c216b4
-0, 46800, 518400, 0x991fbcb1
-0, 50400, 518400, 0x87411486
-0, 54000, 518400, 0x0151b48f
-0, 57600, 518400, 0x3f4d5a91
-0, 61200, 518400, 0x48ea911b
-0, 64800, 518400, 0x6bec19a0
-0, 68400, 518400, 0x10233bf6
-0, 72000, 518400, 0x2a36ae4d
-0, 75600, 518400, 0xd8d3224b
-0, 79200, 518400, 0xf5c5f81f
-0, 82800, 518400, 0x30054561
-0, 86400, 518400, 0x67ea1c9f
-0, 90000, 518400, 0xbbda3984
-0, 93600, 518400, 0x9af40c71
-0, 97200, 518400, 0xb0cf0d12
-0, 100800, 518400, 0x569b9866
-0, 104400, 518400, 0xffd72ee5
diff --git a/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b b/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b
deleted file mode 100644
index 2b6d0d3..0000000
--- a/tests/ref/fate/h264-conformance-cavlc_mot_mbaff0_full_b
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x4cecc821
-0, 3600, 518400, 0xee49ea81
-0, 7200, 518400, 0x78b0d65f
-0, 10800, 518400, 0x7fa72010
-0, 14400, 518400, 0xbc7fecdb
-0, 18000, 518400, 0xe54cf951
-0, 21600, 518400, 0x1e2795e0
-0, 25200, 518400, 0x7db968b9
-0, 28800, 518400, 0xcecb446b
-0, 32400, 518400, 0x4f813fc5
-0, 36000, 518400, 0xd0816131
-0, 39600, 518400, 0x6cf66cb7
-0, 43200, 518400, 0xac9913a1
-0, 46800, 518400, 0x0a2dd6ae
-0, 50400, 518400, 0x5de1acef
-0, 54000, 518400, 0x5ac7741e
-0, 57600, 518400, 0x4d2726de
-0, 61200, 518400, 0x6b9b2677
-0, 64800, 518400, 0x99b70e82
-0, 68400, 518400, 0x6a01ed56
-0, 72000, 518400, 0xa6976f95
-0, 75600, 518400, 0x645f6562
-0, 79200, 518400, 0xf750796b
-0, 82800, 518400, 0xe381ee9c
-0, 86400, 518400, 0xb7d45f84
-0, 90000, 518400, 0x7c9d79df
-0, 93600, 518400, 0x8a306a11
-0, 97200, 518400, 0x766fcf15
-0, 100800, 518400, 0x45c3cbdd
-0, 104400, 518400, 0x6a22610e
diff --git a/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b b/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b
deleted file mode 100644
index 741b94c..0000000
--- a/tests/ref/fate/h264-conformance-cavlc_mot_picaff0_full_b
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0xf6b83a0e
-0, 3600, 518400, 0xc5e8b8ee
-0, 7200, 518400, 0xb3bc6e43
-0, 10800, 518400, 0x5b08dc73
-0, 14400, 518400, 0x4a7f7690
-0, 18000, 518400, 0x8a9f4275
-0, 21600, 518400, 0xc7cb92fd
-0, 25200, 518400, 0xc721e231
-0, 28800, 518400, 0xfb31371b
-0, 32400, 518400, 0xac57f5d9
-0, 36000, 518400, 0x92b7debc
-0, 39600, 518400, 0xfe3e533e
-0, 43200, 518400, 0x1b3a7a72
-0, 46800, 518400, 0x98df2d81
-0, 50400, 518400, 0xe0ce9c52
-0, 54000, 518400, 0x6a31166d
-0, 57600, 518400, 0x64ffd4d2
-0, 61200, 518400, 0x3ec062ef
-0, 64800, 518400, 0x3480fae1
-0, 68400, 518400, 0xa87ae4b7
-0, 72000, 518400, 0xd301319f
-0, 75600, 518400, 0xa9284989
-0, 79200, 518400, 0x3de73b50
-0, 82800, 518400, 0x30a79f84
-0, 86400, 518400, 0x7d5152d4
-0, 90000, 518400, 0x25514095
-0, 93600, 518400, 0x1749a05f
-0, 97200, 518400, 0x598139a7
-0, 100800, 518400, 0x3cece862
-0, 104400, 518400, 0xe1c27efe
diff --git a/tests/ref/fate/h264-conformance-cawp1_toshiba_e b/tests/ref/fate/h264-conformance-cawp1_toshiba_e
deleted file mode 100644
index 36223a3..0000000
--- a/tests/ref/fate/h264-conformance-cawp1_toshiba_e
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0xc26760ae
-0, 10800, 152064, 0x7ed0c861
-0, 14400, 152064, 0x1a13d207
-0, 18000, 152064, 0x700bdb09
-0, 21600, 152064, 0x7fa6476e
-0, 25200, 152064, 0x951158c6
-0, 28800, 152064, 0x263a2dfc
-0, 32400, 152064, 0xa25c5371
-0, 36000, 152064, 0xd67bd5c5
-0, 39600, 152064, 0x73e6d7c0
-0, 43200, 152064, 0x509967e4
-0, 46800, 152064, 0x27574b8f
-0, 50400, 152064, 0xa701d36f
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0xe9977098
-0, 61200, 152064, 0x33b3542b
-0, 64800, 152064, 0x5635d3fa
-0, 68400, 152064, 0x51dbc0bd
-0, 72000, 152064, 0xa2287df1
-0, 75600, 152064, 0x24533377
-0, 79200, 152064, 0xfd05e083
-0, 82800, 152064, 0xfadce02d
-0, 86400, 152064, 0xf67cc1da
-0, 90000, 152064, 0x4e7bc654
-0, 93600, 152064, 0x5b686f11
-0, 97200, 152064, 0xb8e33dc8
-0, 100800, 152064, 0x0ff224ca
-0, 104400, 152064, 0xcd98c152
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0xb1b7f4fc
-0, 115200, 152064, 0x666ccd6a
-0, 118800, 152064, 0x80e9c1a3
-0, 122400, 152064, 0x304b9be3
-0, 126000, 152064, 0x9741fb13
-0, 129600, 152064, 0x5e016501
-0, 133200, 152064, 0x50dd4139
-0, 136800, 152064, 0x9a4ef972
-0, 140400, 152064, 0x03b7da4e
-0, 144000, 152064, 0x17fd7d8a
-0, 147600, 152064, 0xc0137bb0
-0, 151200, 152064, 0xaf167d40
-0, 154800, 152064, 0xde191051
-0, 158400, 152064, 0x1cdcee05
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0xade6bf62
-0, 169200, 152064, 0x4515a552
-0, 172800, 152064, 0xb05036fe
-0, 176400, 152064, 0xfa500b17
-0, 180000, 152064, 0x512dec06
-0, 183600, 152064, 0x0e77ff69
-0, 187200, 152064, 0x06f7b2cd
-0, 190800, 152064, 0x9bc99b67
-0, 194400, 152064, 0x6b68301b
-0, 198000, 152064, 0xe31321ba
-0, 201600, 152064, 0x9ad0192e
-0, 205200, 152064, 0xcc14d7c8
-0, 208800, 152064, 0xf6ab91ec
-0, 212400, 152064, 0xf76afbce
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xca95e688
-0, 223200, 152064, 0xc36bb8ac
-0, 226800, 152064, 0xc1c06a2e
-0, 230400, 152064, 0xf2a08f2a
-0, 234000, 152064, 0xb81013d2
-0, 237600, 152064, 0xf30cee41
-0, 241200, 152064, 0xad85c0d6
-0, 244800, 152064, 0x087b7807
-0, 248400, 152064, 0x178c39f0
-0, 252000, 152064, 0x6e0e3e66
-0, 255600, 152064, 0x9a020bcf
-0, 259200, 152064, 0xc33d4749
-0, 262800, 152064, 0x6370dbad
-0, 266400, 152064, 0x928cbe47
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x79d92c37
-0, 277200, 152064, 0xc4cf0d8f
-0, 280800, 152064, 0xfe706c76
-0, 284400, 152064, 0x6a37de81
-0, 288000, 152064, 0x659eb2c1
-0, 291600, 152064, 0x0630855f
-0, 295200, 152064, 0xfa964f67
-0, 298800, 152064, 0xc5a1ff95
-0, 302400, 152064, 0xa131b89f
-0, 306000, 152064, 0x73007c16
-0, 309600, 152064, 0x4d237a3b
-0, 313200, 152064, 0xe68f44be
-0, 316800, 152064, 0x065f0be3
-0, 320400, 152064, 0x39cab454
diff --git a/tests/ref/fate/h264-conformance-cawp5_toshiba_e b/tests/ref/fate/h264-conformance-cawp5_toshiba_e
deleted file mode 100644
index 30f6912..0000000
--- a/tests/ref/fate/h264-conformance-cawp5_toshiba_e
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0x20f72775
-0, 10800, 152064, 0x57c07111
-0, 14400, 152064, 0x1b49267f
-0, 18000, 152064, 0x024cd238
-0, 21600, 152064, 0x044d1ae0
-0, 25200, 152064, 0xbfec1b59
-0, 28800, 152064, 0x1a91f935
-0, 32400, 152064, 0x9ee184dc
-0, 36000, 152064, 0x65047dbe
-0, 39600, 152064, 0xd1632fb5
-0, 43200, 152064, 0x56f64c3e
-0, 46800, 152064, 0xe6122f37
-0, 50400, 152064, 0x0575e670
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0x6b508105
-0, 61200, 152064, 0xcaaf5ea7
-0, 64800, 152064, 0x9f4e4501
-0, 68400, 152064, 0x1c661a73
-0, 72000, 152064, 0x2fd9d1c8
-0, 75600, 152064, 0x4ac99ab1
-0, 79200, 152064, 0xf2d36809
-0, 82800, 152064, 0xa8e32ffb
-0, 86400, 152064, 0xd4da2fd2
-0, 90000, 152064, 0xac3adde0
-0, 93600, 152064, 0xf014ed0f
-0, 97200, 152064, 0xca2e7d28
-0, 100800, 152064, 0x3a875e51
-0, 104400, 152064, 0xc03e4bda
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0x9243f098
-0, 115200, 152064, 0x9361bae6
-0, 118800, 152064, 0x7a1dadee
-0, 122400, 152064, 0x72a59e15
-0, 126000, 152064, 0xb5b47170
-0, 129600, 152064, 0x5eb16651
-0, 133200, 152064, 0xe7894af7
-0, 136800, 152064, 0x2683bb0b
-0, 140400, 152064, 0x90b4c8c5
-0, 144000, 152064, 0xf800c5b5
-0, 147600, 152064, 0xc2f5a895
-0, 151200, 152064, 0x213c65d4
-0, 154800, 152064, 0x01c65a19
-0, 158400, 152064, 0xd9f1b04b
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0x2d0cb0cd
-0, 169200, 152064, 0x5b0783fe
-0, 172800, 152064, 0x29e628ec
-0, 176400, 152064, 0x1b8527e5
-0, 180000, 152064, 0x4b46d179
-0, 183600, 152064, 0x6184c708
-0, 187200, 152064, 0x697bb8e2
-0, 190800, 152064, 0x5fd3a772
-0, 194400, 152064, 0x91456c86
-0, 198000, 152064, 0x376c4dae
-0, 201600, 152064, 0x00ba2b3f
-0, 205200, 152064, 0xf6f0f553
-0, 208800, 152064, 0xc0020855
-0, 212400, 152064, 0xec3d13d2
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xf9dae37b
-0, 223200, 152064, 0x50d9cc93
-0, 226800, 152064, 0xba1eb592
-0, 230400, 152064, 0x67616557
-0, 234000, 152064, 0x09804760
-0, 237600, 152064, 0xc2ffba00
-0, 241200, 152064, 0xb71fcf46
-0, 244800, 152064, 0x6cd975af
-0, 248400, 152064, 0x19189167
-0, 252000, 152064, 0xbca8fe71
-0, 255600, 152064, 0xb0b3f607
-0, 259200, 152064, 0x7614d73a
-0, 262800, 152064, 0x7de9d87d
-0, 266400, 152064, 0x81f58cf2
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x26d1e2e4
-0, 277200, 152064, 0xb41a1e6c
-0, 280800, 152064, 0x4f9be4a9
-0, 284400, 152064, 0xe95ad5d3
-0, 288000, 152064, 0xdffc9335
-0, 291600, 152064, 0x01d658c0
-0, 295200, 152064, 0x631b4b75
-0, 298800, 152064, 0x80ae282f
-0, 302400, 152064, 0xb34bf688
-0, 306000, 152064, 0xd0cc7d65
-0, 309600, 152064, 0x86aa4590
-0, 313200, 152064, 0xcb515a57
-0, 316800, 152064, 0x68650834
-0, 320400, 152064, 0x444ee2a4
diff --git a/tests/ref/fate/h264-conformance-ci1_ft_b b/tests/ref/fate/h264-conformance-ci1_ft_b
deleted file mode 100644
index b2dca70..0000000
--- a/tests/ref/fate/h264-conformance-ci1_ft_b
+++ /dev/null
@@ -1,291 +0,0 @@
-0, 0, 152064, 0xb291a678
-0, 3600, 152064, 0x913c5a5d
-0, 7200, 152064, 0x9558a372
-0, 10800, 152064, 0x5e521e9b
-0, 14400, 152064, 0xbc2c7bd7
-0, 18000, 152064, 0x8867cc80
-0, 21600, 152064, 0xae394b0b
-0, 25200, 152064, 0x15d9c120
-0, 28800, 152064, 0xffe01d0f
-0, 32400, 152064, 0xf90a1d50
-0, 36000, 152064, 0x7b9b6a02
-0, 39600, 152064, 0x687f5afa
-0, 43200, 152064, 0x6bf7b8a2
-0, 46800, 152064, 0x45cb58e9
-0, 50400, 152064, 0xc4246ef0
-0, 54000, 152064, 0xa19dbe0a
-0, 57600, 152064, 0xe297eaa9
-0, 61200, 152064, 0x8f4300bc
-0, 64800, 152064, 0x9a541a18
-0, 68400, 152064, 0xf3b51480
-0, 72000, 152064, 0x5a191303
-0, 75600, 152064, 0x2e887f27
-0, 79200, 152064, 0xf050d46d
-0, 82800, 152064, 0xc31c6716
-0, 86400, 152064, 0x37761725
-0, 90000, 152064, 0x81141cf6
-0, 93600, 152064, 0x181f7e61
-0, 97200, 152064, 0x9fc2b668
-0, 100800, 152064, 0x3716f5da
-0, 104400, 152064, 0x3b28f0c9
-0, 108000, 152064, 0xe33bd972
-0, 111600, 152064, 0x948ccdaa
-0, 115200, 152064, 0x21fdc6c2
-0, 118800, 152064, 0x3874b6fc
-0, 122400, 152064, 0x07b7a748
-0, 126000, 152064, 0x7aee8b8d
-0, 129600, 152064, 0x013d7552
-0, 133200, 152064, 0x9631487e
-0, 136800, 152064, 0xd9a109d6
-0, 140400, 152064, 0x7b450b1b
-0, 144000, 152064, 0x25f0cb06
-0, 147600, 152064, 0x6542aa9c
-0, 151200, 152064, 0x40ba9bd7
-0, 154800, 152064, 0x2dc7d564
-0, 158400, 152064, 0x4534a83f
-0, 162000, 152064, 0x671551a3
-0, 165600, 152064, 0xc69a9a28
-0, 169200, 152064, 0x899be59a
-0, 172800, 152064, 0x1adb6455
-0, 176400, 152064, 0x5d34066b
-0, 180000, 152064, 0x17f4dcec
-0, 183600, 152064, 0xcc9fd4b1
-0, 187200, 152064, 0x329aaeb5
-0, 190800, 152064, 0x4532a3f0
-0, 194400, 152064, 0xb0440be3
-0, 198000, 152064, 0x9055a9e2
-0, 201600, 152064, 0x1f5b4730
-0, 205200, 152064, 0x55fc2ba8
-0, 208800, 152064, 0x6adc911a
-0, 212400, 152064, 0x4968851f
-0, 216000, 152064, 0x31a86628
-0, 219600, 152064, 0x7223240a
-0, 223200, 152064, 0xb982e88e
-0, 226800, 152064, 0xba45b5ea
-0, 230400, 152064, 0x72f55121
-0, 234000, 152064, 0x36c59af9
-0, 237600, 152064, 0x6fc51449
-0, 241200, 152064, 0xbd9d99b7
-0, 244800, 152064, 0x0bd3a6e7
-0, 248400, 152064, 0x5a5d0203
-0, 252000, 152064, 0x44a26951
-0, 255600, 152064, 0xfe9fcff5
-0, 259200, 152064, 0xce25a939
-0, 262800, 152064, 0xdf7c1b79
-0, 266400, 152064, 0xe82a1c4c
-0, 270000, 152064, 0x946b20d7
-0, 273600, 152064, 0x5d4887d2
-0, 277200, 152064, 0xadfe1034
-0, 280800, 152064, 0x6d20b119
-0, 284400, 152064, 0x8e414e12
-0, 288000, 152064, 0x06effdf9
-0, 291600, 152064, 0x3073e4f5
-0, 295200, 152064, 0xa0ef2291
-0, 298800, 152064, 0x3feb2cf6
-0, 302400, 152064, 0x3e77b0c8
-0, 306000, 152064, 0xdbce3b7a
-0, 309600, 152064, 0x15e0b088
-0, 313200, 152064, 0xb05bb465
-0, 316800, 152064, 0x63423915
-0, 320400, 152064, 0x290210f4
-0, 324000, 152064, 0x4d14cc43
-0, 327600, 152064, 0x4a5509fe
-0, 331200, 152064, 0x110c6420
-0, 334800, 152064, 0xbe614dfb
-0, 338400, 152064, 0xa6311469
-0, 342000, 152064, 0x198b6b73
-0, 345600, 152064, 0xe96fe872
-0, 349200, 152064, 0x7a7a6937
-0, 352800, 152064, 0xfe2b868d
-0, 356400, 152064, 0x9e0bbb2b
-0, 360000, 152064, 0x53dbdf39
-0, 363600, 152064, 0xee90ba8e
-0, 367200, 152064, 0x38bcb94d
-0, 370800, 152064, 0x16a6d9bb
-0, 374400, 152064, 0x450ae454
-0, 378000, 152064, 0x7d98fcf4
-0, 381600, 152064, 0xc54ed4cf
-0, 385200, 152064, 0x560d74ac
-0, 388800, 152064, 0xb203fc98
-0, 392400, 152064, 0xb085b576
-0, 396000, 152064, 0x05e16f79
-0, 399600, 152064, 0x90cd4c73
-0, 403200, 152064, 0x4dd42a7f
-0, 406800, 152064, 0x26b9e35c
-0, 410400, 152064, 0x70cbb417
-0, 414000, 152064, 0x0a1bc4a9
-0, 417600, 152064, 0xe08fdbc9
-0, 421200, 152064, 0x8768cd49
-0, 424800, 152064, 0x80a4b575
-0, 428400, 152064, 0x68478ea6
-0, 432000, 152064, 0x8f8c589d
-0, 435600, 152064, 0x8ee4345c
-0, 439200, 152064, 0x93911901
-0, 442800, 152064, 0x38fb4298
-0, 446400, 152064, 0x8bee60e7
-0, 450000, 152064, 0x3f906dbd
-0, 453600, 152064, 0x9de2a984
-0, 457200, 152064, 0x64c804e0
-0, 460800, 152064, 0x4757c864
-0, 464400, 152064, 0xe6f43905
-0, 468000, 152064, 0x8ad2e577
-0, 471600, 152064, 0x1b06977e
-0, 475200, 152064, 0xe92a2dfa
-0, 478800, 152064, 0x97b993fa
-0, 482400, 152064, 0x1602de2d
-0, 486000, 152064, 0x6dda24f1
-0, 489600, 152064, 0x5552ec9d
-0, 493200, 152064, 0xcce058e8
-0, 496800, 152064, 0x4359bccd
-0, 500400, 152064, 0xe41d77d0
-0, 504000, 152064, 0x05730d21
-0, 507600, 152064, 0xa963bf92
-0, 511200, 152064, 0x3f4d8e29
-0, 514800, 152064, 0x385d2403
-0, 518400, 152064, 0xd8e279d6
-0, 522000, 152064, 0xcfcb3713
-0, 525600, 152064, 0xd68d57d4
-0, 529200, 152064, 0xdaecd2d6
-0, 532800, 152064, 0x7c1805cf
-0, 536400, 152064, 0x19969137
-0, 540000, 152064, 0x15007e0c
-0, 543600, 152064, 0xf4f5011a
-0, 547200, 152064, 0x792793e3
-0, 550800, 152064, 0x1c4126f9
-0, 554400, 152064, 0xfaeb9465
-0, 558000, 152064, 0x3366c5c6
-0, 561600, 152064, 0x8efa29ed
-0, 565200, 152064, 0x2b36d937
-0, 568800, 152064, 0x4cfc993f
-0, 572400, 152064, 0x0809f8f8
-0, 576000, 152064, 0x5be26710
-0, 579600, 152064, 0x6d757860
-0, 583200, 152064, 0xf4e8706d
-0, 586800, 152064, 0xec42387d
-0, 590400, 152064, 0x828f02e1
-0, 594000, 152064, 0x45a0954c
-0, 597600, 152064, 0xbcca1065
-0, 601200, 152064, 0xd5946707
-0, 604800, 152064, 0x6887cbcb
-0, 608400, 152064, 0x63fc7423
-0, 612000, 152064, 0x3339ebc2
-0, 615600, 152064, 0x6419e277
-0, 619200, 152064, 0xe9cd70aa
-0, 622800, 152064, 0x23903b35
-0, 626400, 152064, 0xd83d028a
-0, 630000, 152064, 0x79e21536
-0, 633600, 152064, 0x81cc6027
-0, 637200, 152064, 0x56334e89
-0, 640800, 152064, 0xe32e532e
-0, 644400, 152064, 0x528832b4
-0, 648000, 152064, 0x348da007
-0, 651600, 152064, 0x5104b2e8
-0, 655200, 152064, 0x7b0d1f8f
-0, 658800, 152064, 0x6750c77c
-0, 662400, 152064, 0x3a8f2faa
-0, 666000, 152064, 0x8a24a116
-0, 669600, 152064, 0x82d00d82
-0, 673200, 152064, 0xc6f5b11a
-0, 676800, 152064, 0x2b352039
-0, 680400, 152064, 0x7c067e22
-0, 684000, 152064, 0xc975d80d
-0, 687600, 152064, 0xa49978ed
-0, 691200, 152064, 0x441f703e
-0, 694800, 152064, 0x5cb150c5
-0, 698400, 152064, 0xeeda6c8e
-0, 702000, 152064, 0xe9e0ce47
-0, 705600, 152064, 0xba55acbd
-0, 709200, 152064, 0xae8250e5
-0, 712800, 152064, 0xf438f2e8
-0, 716400, 152064, 0xe6263d10
-0, 720000, 152064, 0x8d13277a
-0, 723600, 152064, 0x4bfb4aab
-0, 727200, 152064, 0x1c0a78ea
-0, 730800, 152064, 0xa0651778
-0, 734400, 152064, 0xa309ca66
-0, 738000, 152064, 0x294c750b
-0, 741600, 152064, 0xd55d6881
-0, 745200, 152064, 0x8d002b72
-0, 748800, 152064, 0xe0ae5976
-0, 752400, 152064, 0xc6f28961
-0, 756000, 152064, 0x6fb5899d
-0, 759600, 152064, 0x046f3445
-0, 763200, 152064, 0x9b2d5779
-0, 766800, 152064, 0xeb9db946
-0, 770400, 152064, 0x190bdc3b
-0, 774000, 152064, 0xb9ae5c7b
-0, 777600, 152064, 0xca07ad32
-0, 781200, 152064, 0x8d1fee22
-0, 784800, 152064, 0x446470dd
-0, 788400, 152064, 0x8802cf93
-0, 792000, 152064, 0x8bbaeb30
-0, 795600, 152064, 0xfe4e7fdf
-0, 799200, 152064, 0xc6379dc7
-0, 802800, 152064, 0xaa53198b
-0, 806400, 152064, 0x88d6d37c
-0, 810000, 152064, 0xd1b89370
-0, 813600, 152064, 0xdab349f4
-0, 817200, 152064, 0x4702c238
-0, 820800, 152064, 0xfaa893bb
-0, 824400, 152064, 0x515b940e
-0, 828000, 152064, 0x4d86d838
-0, 831600, 152064, 0xe3815641
-0, 835200, 152064, 0x0e501c17
-0, 838800, 152064, 0x449df073
-0, 842400, 152064, 0xc06daa27
-0, 846000, 152064, 0x72f5394c
-0, 849600, 152064, 0x18be9f70
-0, 853200, 152064, 0xc508213a
-0, 856800, 152064, 0xa616a322
-0, 860400, 152064, 0x1a5d09e5
-0, 864000, 152064, 0xf6e78051
-0, 867600, 152064, 0x8945ad83
-0, 871200, 152064, 0xa06fd95d
-0, 874800, 152064, 0x7d86f015
-0, 878400, 152064, 0x768af87c
-0, 882000, 152064, 0xffa2e8d9
-0, 885600, 152064, 0x2ac0d2df
-0, 889200, 152064, 0x40c27662
-0, 892800, 152064, 0xfcc7580a
-0, 896400, 152064, 0xcdbd51f0
-0, 900000, 152064, 0xe0d754ec
-0, 903600, 152064, 0xbfb59395
-0, 907200, 152064, 0x26f6db71
-0, 910800, 152064, 0x1d85f144
-0, 914400, 152064, 0xfacbfbd9
-0, 918000, 152064, 0x55bdf6b8
-0, 921600, 152064, 0x9c89e3f8
-0, 925200, 152064, 0x6e90c4bd
-0, 928800, 152064, 0x3b19a944
-0, 932400, 152064, 0xcb527670
-0, 936000, 152064, 0xc0ec5c7b
-0, 939600, 152064, 0x7f5f4814
-0, 943200, 152064, 0xb0983900
-0, 946800, 152064, 0xc57534a6
-0, 950400, 152064, 0xd37b30b9
-0, 954000, 152064, 0x61fe2e9f
-0, 957600, 152064, 0x613d2e8a
-0, 961200, 152064, 0x9bc5224b
-0, 964800, 152064, 0x246122c2
-0, 968400, 152064, 0x28811a8f
-0, 972000, 152064, 0x609cfcbf
-0, 975600, 152064, 0x9c5aee70
-0, 979200, 152064, 0x06d7e997
-0, 982800, 152064, 0xcb3e1e4a
-0, 986400, 152064, 0x65e36256
-0, 990000, 152064, 0x571eb628
-0, 993600, 152064, 0x9e940be8
-0, 997200, 152064, 0x425a374b
-0, 1000800, 152064, 0xbeed72a2
-0, 1004400, 152064, 0x295bb61d
-0, 1008000, 152064, 0xfe2df639
-0, 1011600, 152064, 0xbd4f441a
-0, 1015200, 152064, 0x61ce59bc
-0, 1018800, 152064, 0xd5eb825f
-0, 1022400, 152064, 0xc03cb656
-0, 1026000, 152064, 0xfc10c1f6
-0, 1029600, 152064, 0xb93908dc
-0, 1033200, 152064, 0xbc2d3209
-0, 1036800, 152064, 0xcc267ab3
-0, 1040400, 152064, 0x32629fa0
-0, 1044000, 152064, 0x5d5bb942
diff --git a/tests/ref/fate/h264-conformance-ci_mw_d b/tests/ref/fate/h264-conformance-ci_mw_d
deleted file mode 100644
index 193c5c8..0000000
--- a/tests/ref/fate/h264-conformance-ci_mw_d
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x8523e136
-0, 7200, 38016, 0xcffc99dd
-0, 10800, 38016, 0xd42c63b0
-0, 14400, 38016, 0x6ba94f84
-0, 18000, 38016, 0xa5c56dd3
-0, 21600, 38016, 0x6f6a929e
-0, 25200, 38016, 0x84f89b27
-0, 28800, 38016, 0x35bd9f0f
-0, 32400, 38016, 0x69058ed2
-0, 36000, 38016, 0x44c05088
-0, 39600, 38016, 0xed9725f0
-0, 43200, 38016, 0x37b92a40
-0, 46800, 38016, 0xbeed3c7c
-0, 50400, 38016, 0x833a5669
-0, 54000, 38016, 0xf37b78b1
-0, 57600, 38016, 0x84e2aff4
-0, 61200, 38016, 0x8c69c59c
-0, 64800, 38016, 0x40fdbe25
-0, 68400, 38016, 0x1c7cba40
-0, 72000, 38016, 0x052abe29
-0, 75600, 38016, 0x398ec317
-0, 79200, 38016, 0xa157bb47
-0, 82800, 38016, 0x6acfc1a0
-0, 86400, 38016, 0xfa77bdba
-0, 90000, 38016, 0x2254bb0d
-0, 93600, 38016, 0xefdfbdb3
-0, 97200, 38016, 0x80eec1f4
-0, 100800, 38016, 0x48b6c903
-0, 104400, 38016, 0x277dd23b
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0x223f6bb7
-0, 115200, 38016, 0xdbee4420
-0, 118800, 38016, 0x5f888bdc
-0, 122400, 38016, 0xe5aef9b8
-0, 126000, 38016, 0x6a68596e
-0, 129600, 38016, 0x47feb0d4
-0, 133200, 38016, 0x46d13363
-0, 136800, 38016, 0x31758ae0
-0, 140400, 38016, 0xa9b3c513
-0, 144000, 38016, 0x041ce805
-0, 147600, 38016, 0xd3aef1e9
-0, 151200, 38016, 0x8c51ecf8
-0, 154800, 38016, 0x60a5f20d
-0, 158400, 38016, 0xf3c80bfb
-0, 162000, 38016, 0xcec4f6af
-0, 165600, 38016, 0x70a1c28c
-0, 169200, 38016, 0x1c579938
-0, 172800, 38016, 0x07a8a63d
-0, 176400, 38016, 0xd16ccd4e
-0, 180000, 38016, 0xceb5e478
-0, 183600, 38016, 0x81c0bf00
-0, 187200, 38016, 0x4867d846
-0, 190800, 38016, 0xd8650fd3
-0, 194400, 38016, 0x1d8f375c
-0, 198000, 38016, 0x5ce65ef5
-0, 201600, 38016, 0xbc766bf0
-0, 205200, 38016, 0x73cd27ee
-0, 208800, 38016, 0xd1433004
-0, 212400, 38016, 0xc5bc4798
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0xd4b014b8
-0, 223200, 38016, 0xaaa2c77e
-0, 226800, 38016, 0xa0a5a94e
-0, 230400, 38016, 0x74edcf2e
-0, 234000, 38016, 0x2925e32a
-0, 237600, 38016, 0x5400da3a
-0, 241200, 38016, 0xc50eda9b
-0, 244800, 38016, 0xfd4acbe7
-0, 248400, 38016, 0xa75eb6ee
-0, 252000, 38016, 0xc0dca463
-0, 255600, 38016, 0xfd1b83b7
-0, 259200, 38016, 0x5b378f02
-0, 262800, 38016, 0x608983d5
-0, 266400, 38016, 0x6f6f2cda
-0, 270000, 38016, 0x9367e1b2
-0, 273600, 38016, 0x12d7d677
-0, 277200, 38016, 0xd02cc0c5
-0, 280800, 38016, 0xbe2fed59
-0, 284400, 38016, 0x66c1402d
-0, 288000, 38016, 0x150e75cf
-0, 291600, 38016, 0x83c959ea
-0, 295200, 38016, 0xa9c048f4
-0, 298800, 38016, 0xffa9237f
-0, 302400, 38016, 0x0ab0d668
-0, 306000, 38016, 0xae4de2a4
-0, 309600, 38016, 0xfc4322e8
-0, 313200, 38016, 0x21f026dd
-0, 316800, 38016, 0x7582b6a6
-0, 320400, 38016, 0x4ddc5306
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0x33a0ace6
-0, 331200, 38016, 0xe96ebd07
-0, 334800, 38016, 0xdff2e5ef
-0, 338400, 38016, 0xbf941880
-0, 342000, 38016, 0x12ffcea4
-0, 345600, 38016, 0x1ef6aaef
-0, 349200, 38016, 0x2b01f811
-0, 352800, 38016, 0x422b5992
-0, 356400, 38016, 0x68ba9d2d
diff --git a/tests/ref/fate/h264-conformance-cvbs3_sony_c b/tests/ref/fate/h264-conformance-cvbs3_sony_c
deleted file mode 100644
index 7a5db82..0000000
--- a/tests/ref/fate/h264-conformance-cvbs3_sony_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb3883478
-0, 3600, 38016, 0xddf01d9d
-0, 7200, 38016, 0xb177ece2
-0, 10800, 38016, 0xfcd6aec1
-0, 14400, 38016, 0x5cb5a017
-0, 18000, 38016, 0xeb3884e7
-0, 21600, 38016, 0xa8494fb1
-0, 25200, 38016, 0xe0084edb
-0, 28800, 38016, 0x605845e7
-0, 32400, 38016, 0xe2103e96
-0, 36000, 38016, 0x3b057699
-0, 39600, 38016, 0x130b9413
-0, 43200, 38016, 0x1af773f6
-0, 46800, 38016, 0x1a77b1f3
-0, 50400, 38016, 0xbb5bac34
-0, 54000, 38016, 0xd41c9cf7
-0, 57600, 38016, 0x6df3ac7f
-0, 61200, 38016, 0xba44a850
-0, 64800, 38016, 0xe8887fc4
-0, 68400, 38016, 0xa50387fa
-0, 72000, 38016, 0x164c6317
-0, 75600, 38016, 0xb9c52925
-0, 79200, 38016, 0xfbcc2f11
-0, 82800, 38016, 0x5c0f258c
-0, 86400, 38016, 0x0d61186e
-0, 90000, 38016, 0xec173b07
-0, 93600, 38016, 0x322c353a
-0, 97200, 38016, 0x30f72be0
-0, 100800, 38016, 0xb0aa5d52
-0, 104400, 38016, 0x915a70e2
-0, 108000, 38016, 0xed9563d3
-0, 111600, 38016, 0x2122a450
-0, 115200, 38016, 0xc8a6ba0a
-0, 118800, 38016, 0x7fbaad08
-0, 122400, 38016, 0xef19d83b
-0, 126000, 38016, 0x4fb1d339
-0, 129600, 38016, 0xe73eb1a3
-0, 133200, 38016, 0xfd23d6f0
-0, 136800, 38016, 0xfc21ca53
-0, 140400, 38016, 0xa6c7b2c9
-0, 144000, 38016, 0x4fb3c8e0
-0, 147600, 38016, 0xdb7acc62
-0, 151200, 38016, 0x281db765
-0, 154800, 38016, 0x2e11b6e9
-0, 158400, 38016, 0x8237b906
-0, 162000, 38016, 0xe3728780
-0, 165600, 38016, 0x2932a82c
-0, 169200, 38016, 0x8a0ab2ca
-0, 172800, 38016, 0xdb38a893
-0, 176400, 38016, 0xd64cbfc3
-0, 180000, 38016, 0x8a53b992
-0, 183600, 38016, 0xef29abc9
-0, 187200, 38016, 0x6d64baf6
-0, 190800, 38016, 0xc402bf13
-0, 194400, 38016, 0x00c7b709
-0, 198000, 38016, 0x55ddcb84
-0, 201600, 38016, 0x22cac705
-0, 205200, 38016, 0xfa1bc59d
-0, 208800, 38016, 0x82a1d3d0
-0, 212400, 38016, 0x7db8d411
-0, 216000, 38016, 0x98a59a5a
-0, 219600, 38016, 0x02bda814
-0, 223200, 38016, 0xc4a288d9
-0, 226800, 38016, 0x799a3804
-0, 230400, 38016, 0x11474f82
-0, 234000, 38016, 0x0b807846
-0, 237600, 38016, 0x2a118c7e
-0, 241200, 38016, 0xa076e441
-0, 244800, 38016, 0x9b2c1c2b
-0, 248400, 38016, 0xf1433098
-0, 252000, 38016, 0xbf68697b
-0, 255600, 38016, 0x0c2c94de
-0, 259200, 38016, 0x5fdcb88b
-0, 262800, 38016, 0x543dfb09
-0, 266400, 38016, 0x4c602fc8
-0, 270000, 38016, 0x4c0b3afa
-0, 273600, 38016, 0x97dd846b
-0, 277200, 38016, 0xb5cb97f7
-0, 280800, 38016, 0x42dba91c
-0, 284400, 38016, 0x827cc117
-0, 288000, 38016, 0xd589cd88
-0, 291600, 38016, 0x15bfdd09
-0, 295200, 38016, 0x77cbe929
-0, 298800, 38016, 0x499edfb2
-0, 302400, 38016, 0x3bd5d22c
-0, 306000, 38016, 0xed0ed545
-0, 309600, 38016, 0x1751e754
-0, 313200, 38016, 0x042feed4
-0, 316800, 38016, 0x24dde6b3
-0, 320400, 38016, 0x8aa2ed66
-0, 324000, 38016, 0x8fa69f07
-0, 327600, 38016, 0xe018ad28
-0, 331200, 38016, 0x0b31992e
-0, 334800, 38016, 0xf8aa6dbc
-0, 338400, 38016, 0x0eb36da4
-0, 342000, 38016, 0x392b6658
-0, 345600, 38016, 0xb8056967
-0, 349200, 38016, 0x16899181
-0, 352800, 38016, 0x44b9a1b2
-0, 356400, 38016, 0x20ee9b98
-0, 360000, 38016, 0x42cdad98
-0, 363600, 38016, 0xd438a3d6
-0, 367200, 38016, 0x551e8751
-0, 370800, 38016, 0x68428f39
-0, 374400, 38016, 0x7449b249
-0, 378000, 38016, 0xf294a253
-0, 381600, 38016, 0x8628d899
-0, 385200, 38016, 0xba05f633
-0, 388800, 38016, 0x329bfacb
-0, 392400, 38016, 0xaa5c33dd
-0, 396000, 38016, 0x2b9437d9
-0, 399600, 38016, 0x8bd8273b
-0, 403200, 38016, 0xc6d541fb
-0, 406800, 38016, 0xb42c1e45
-0, 410400, 38016, 0xdd39e610
-0, 414000, 38016, 0xae56fe66
-0, 417600, 38016, 0x812a16e4
-0, 421200, 38016, 0x47fdff0f
-0, 424800, 38016, 0xfbb33b56
-0, 428400, 38016, 0x792a486f
-0, 432000, 38016, 0x32e93592
-0, 435600, 38016, 0xbd2142ca
-0, 439200, 38016, 0x2d412532
-0, 442800, 38016, 0x5ee8e957
-0, 446400, 38016, 0x57c3de13
-0, 450000, 38016, 0xad94b6f1
-0, 453600, 38016, 0x8cda97a1
-0, 457200, 38016, 0x3563b54e
-0, 460800, 38016, 0x1d2bc4fb
-0, 464400, 38016, 0xada2cf01
-0, 468000, 38016, 0x8dabed0a
-0, 471600, 38016, 0x441ae3c0
-0, 475200, 38016, 0x5514cc85
-0, 478800, 38016, 0xd20cddad
-0, 482400, 38016, 0x5286d569
-0, 486000, 38016, 0x1612a173
-0, 489600, 38016, 0x5946be84
-0, 493200, 38016, 0x1925b1fe
-0, 496800, 38016, 0xf34f93eb
-0, 500400, 38016, 0xac3d9add
-0, 504000, 38016, 0x12d18ba6
-0, 507600, 38016, 0xcc7f7e5a
-0, 511200, 38016, 0x449270ec
-0, 514800, 38016, 0x04416f83
-0, 518400, 38016, 0x50d36abf
-0, 522000, 38016, 0x8605799f
-0, 525600, 38016, 0xe6ec6cfd
-0, 529200, 38016, 0x1f2d3baf
-0, 532800, 38016, 0x9f3e1a4c
-0, 536400, 38016, 0x5c3ef4c8
-0, 540000, 38016, 0xf731aef2
-0, 543600, 38016, 0x90b4c921
-0, 547200, 38016, 0xa12dc74f
-0, 550800, 38016, 0x1fe2a278
-0, 554400, 38016, 0xa6b0b432
-0, 558000, 38016, 0xf9e9cb79
-0, 561600, 38016, 0xef58d10e
-0, 565200, 38016, 0x957805c0
-0, 568800, 38016, 0x76e03b1f
-0, 572400, 38016, 0xcb2a4905
-0, 576000, 38016, 0xb863646d
-0, 579600, 38016, 0x3e5f57fe
-0, 583200, 38016, 0xbe7d3d77
-0, 586800, 38016, 0x4f3c3ce5
-0, 590400, 38016, 0x806033d0
-0, 594000, 38016, 0xc31bf5da
-0, 597600, 38016, 0x6f8ef69e
-0, 601200, 38016, 0x010ac670
-0, 604800, 38016, 0x374e9bdd
-0, 608400, 38016, 0xd8499c26
-0, 612000, 38016, 0x5901a512
-0, 615600, 38016, 0x31b2bcdf
-0, 619200, 38016, 0x972cdda0
-0, 622800, 38016, 0x10c8ded1
-0, 626400, 38016, 0xc6e3c839
-0, 630000, 38016, 0xf661aa12
-0, 633600, 38016, 0x6ca379d0
-0, 637200, 38016, 0xc5a53d41
-0, 640800, 38016, 0x317d353c
-0, 644400, 38016, 0xb9962522
-0, 648000, 38016, 0x0769ec52
-0, 651600, 38016, 0x4463ea8b
-0, 655200, 38016, 0xdd7dd585
-0, 658800, 38016, 0x6039ca99
-0, 662400, 38016, 0x87beeba1
-0, 666000, 38016, 0x2503fd5d
-0, 669600, 38016, 0xde950c40
-0, 673200, 38016, 0xd6f5332f
-0, 676800, 38016, 0xa95b3137
-0, 680400, 38016, 0x37c026b4
-0, 684000, 38016, 0x93f9e3e3
-0, 687600, 38016, 0x5826b471
-0, 691200, 38016, 0xef81ac84
-0, 694800, 38016, 0x6361dfa0
-0, 698400, 38016, 0x9774f041
-0, 702000, 38016, 0xd8d01ad1
-0, 705600, 38016, 0x456252f3
-0, 709200, 38016, 0x448c6119
-0, 712800, 38016, 0x12157fca
-0, 716400, 38016, 0x145ca727
-0, 720000, 38016, 0x17a5b174
-0, 723600, 38016, 0xc0c0bb0c
-0, 727200, 38016, 0x9afbc5e8
-0, 730800, 38016, 0xc8c7cc3a
-0, 734400, 38016, 0x489dc5dd
-0, 738000, 38016, 0x6da6c7c8
-0, 741600, 38016, 0x6408d491
-0, 745200, 38016, 0x0820d9ce
-0, 748800, 38016, 0xebcfc8d6
-0, 752400, 38016, 0xf462b2a2
-0, 756000, 38016, 0xadb65d17
-0, 759600, 38016, 0xecde79e9
-0, 763200, 38016, 0x81786ed0
-0, 766800, 38016, 0x3cfc51f8
-0, 770400, 38016, 0x307560ba
-0, 774000, 38016, 0xc4f95361
-0, 777600, 38016, 0xe2fe384b
-0, 781200, 38016, 0x95de4e60
-0, 784800, 38016, 0x1b6147f9
-0, 788400, 38016, 0xe1bc385b
-0, 792000, 38016, 0x14cc446a
-0, 795600, 38016, 0x5fcb313f
-0, 799200, 38016, 0xf33f1721
-0, 802800, 38016, 0x49fc2fbb
-0, 806400, 38016, 0x33ad3314
-0, 810000, 38016, 0x92b51315
-0, 813600, 38016, 0x7e4d3139
-0, 817200, 38016, 0xb99e432b
-0, 820800, 38016, 0x52cb3c30
-0, 824400, 38016, 0xe5e48199
-0, 828000, 38016, 0x59419769
-0, 831600, 38016, 0x3e90b130
-0, 835200, 38016, 0x85fbfbd6
-0, 838800, 38016, 0xba8912ac
-0, 842400, 38016, 0x3fc3128c
-0, 846000, 38016, 0x61db4d37
-0, 849600, 38016, 0x3c405a46
-0, 853200, 38016, 0x9c113b43
-0, 856800, 38016, 0x739c43f4
-0, 860400, 38016, 0xffab0fe6
-0, 864000, 38016, 0x99cee4bd
-0, 867600, 38016, 0xd76dcff5
-0, 871200, 38016, 0xe8ccb16c
-0, 874800, 38016, 0x43d8ff1f
-0, 878400, 38016, 0xffde708b
-0, 882000, 38016, 0xe5cfd3d4
-0, 885600, 38016, 0x0b67ef9f
-0, 889200, 38016, 0xd54cd697
-0, 892800, 38016, 0x5879926e
-0, 896400, 38016, 0x9cb01428
-0, 900000, 38016, 0x09b0c0b7
-0, 903600, 38016, 0xbbef721e
-0, 907200, 38016, 0xcebd66ea
-0, 910800, 38016, 0x7492c956
-0, 914400, 38016, 0xeaa5317b
-0, 918000, 38016, 0xe952c9bd
-0, 921600, 38016, 0xb4cfd878
-0, 925200, 38016, 0xa8675f14
-0, 928800, 38016, 0x24653121
-0, 932400, 38016, 0xeec9425e
-0, 936000, 38016, 0x14413e58
-0, 939600, 38016, 0xc8e13f0a
-0, 943200, 38016, 0x09045f0f
-0, 946800, 38016, 0xa021583e
-0, 950400, 38016, 0x26384591
-0, 954000, 38016, 0x157b55d2
-0, 957600, 38016, 0x22973c65
-0, 961200, 38016, 0x2fe30f64
-0, 964800, 38016, 0xf640fab4
-0, 968400, 38016, 0x2b82d807
-0, 972000, 38016, 0x6faca613
-0, 975600, 38016, 0x8a5b89c3
-0, 979200, 38016, 0xb7d76316
-0, 982800, 38016, 0x3e3a0a82
-0, 986400, 38016, 0x7d93d78b
-0, 990000, 38016, 0xa3bcc050
-0, 993600, 38016, 0x41d4b2ba
-0, 997200, 38016, 0x7a08d518
-0, 1000800, 38016, 0xd6b0f72b
-0, 1004400, 38016, 0x9c794c7b
-0, 1008000, 38016, 0xc2680d18
-0, 1011600, 38016, 0x9fa6db96
-0, 1015200, 38016, 0xd90c83c3
-0, 1018800, 38016, 0xf1278cf5
-0, 1022400, 38016, 0xf2ce5e19
-0, 1026000, 38016, 0x2d41a44b
-0, 1029600, 38016, 0xade2715b
-0, 1033200, 38016, 0xd21da6fe
-0, 1036800, 38016, 0x37c89e7f
-0, 1040400, 38016, 0x6bad76e8
-0, 1044000, 38016, 0xfefce893
-0, 1047600, 38016, 0xcd301b29
-0, 1051200, 38016, 0x0e80a08d
-0, 1054800, 38016, 0x88f3d605
-0, 1058400, 38016, 0x80273791
-0, 1062000, 38016, 0x36472009
-0, 1065600, 38016, 0xe8b6fc54
-0, 1069200, 38016, 0x5d9bfd2d
-0, 1072800, 38016, 0x61df1820
-0, 1076400, 38016, 0x8db23b5c
diff --git a/tests/ref/fate/h264-conformance-cvcanlma2_sony_c b/tests/ref/fate/h264-conformance-cvcanlma2_sony_c
deleted file mode 100644
index 5eff64e..0000000
--- a/tests/ref/fate/h264-conformance-cvcanlma2_sony_c
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 518400, 0xfbca00c6
-0, 3600, 518400, 0x82b80adf
-0, 7200, 518400, 0x87ecdf4a
-0, 10800, 518400, 0xf6ca8cbe
-0, 14400, 518400, 0x8e9bb8a0
-0, 18000, 518400, 0x6512caa2
-0, 21600, 518400, 0xc015e43e
-0, 25200, 518400, 0x5f504a5c
-0, 28800, 518400, 0x4c7458a4
-0, 32400, 518400, 0x630f4004
-0, 36000, 518400, 0x889af20e
-0, 39600, 518400, 0x4437a5a4
-0, 43200, 518400, 0x1e19a254
-0, 46800, 518400, 0xb7ef1763
-0, 50400, 518400, 0xc966c95a
-0, 54000, 518400, 0x0c9074d6
-0, 57600, 518400, 0x24c906c9
diff --git a/tests/ref/fate/h264-conformance-cvfi1_sony_d b/tests/ref/fate/h264-conformance-cvfi1_sony_d
deleted file mode 100644
index aaf0e7b..0000000
--- a/tests/ref/fate/h264-conformance-cvfi1_sony_d
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 518400, 0xd9444d71
-0, 3600, 518400, 0x5d8928cd
-0, 7200, 518400, 0xea5bc08b
-0, 10800, 518400, 0xb4465d31
-0, 14400, 518400, 0x983b5dbb
-0, 18000, 518400, 0x54936746
-0, 21600, 518400, 0x7ae38b02
-0, 25200, 518400, 0xc2a0dd83
-0, 28800, 518400, 0x61cac7a6
-0, 32400, 518400, 0xb0038443
-0, 36000, 518400, 0x16514296
-0, 39600, 518400, 0xa68dd470
-0, 43200, 518400, 0x2572f868
-0, 46800, 518400, 0x770a3239
-0, 50400, 518400, 0xdd04f6d2
-0, 54000, 518400, 0xa5e5d01e
-0, 57600, 518400, 0x5fe25c86
diff --git a/tests/ref/fate/h264-conformance-cvfi1_sva_c b/tests/ref/fate/h264-conformance-cvfi1_sva_c
deleted file mode 100644
index bcff3ea..0000000
--- a/tests/ref/fate/h264-conformance-cvfi1_sva_c
+++ /dev/null
@@ -1,7 +0,0 @@
-0, 0, 518400, 0x8f022263
-0, 3600, 518400, 0x02692654
-0, 7200, 518400, 0x55eff579
-0, 10800, 518400, 0x6c1bdf1d
-0, 14400, 518400, 0xbbedf5e4
-0, 18000, 518400, 0xb90d740d
-0, 21600, 518400, 0x81300adb
diff --git a/tests/ref/fate/h264-conformance-cvfi2_sony_h b/tests/ref/fate/h264-conformance-cvfi2_sony_h
deleted file mode 100644
index 1a7743a..0000000
--- a/tests/ref/fate/h264-conformance-cvfi2_sony_h
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 518400, 0xd9444d71
-0, 3600, 518400, 0x491faf75
-0, 7200, 518400, 0xf8b4d15c
-0, 10800, 518400, 0x99d9f60c
-0, 14400, 518400, 0x46c17a6d
-0, 18000, 518400, 0x30b9447d
-0, 21600, 518400, 0x135d0c76
-0, 25200, 518400, 0x1b831a3c
-0, 28800, 518400, 0x5910def8
-0, 32400, 518400, 0x8db90147
-0, 36000, 518400, 0x6a2b79c7
-0, 39600, 518400, 0xc8d302e5
-0, 43200, 518400, 0x515bb024
-0, 46800, 518400, 0xedf7836c
-0, 50400, 518400, 0x7e247b9d
-0, 54000, 518400, 0x10c9bb10
-0, 57600, 518400, 0xe38e2807
diff --git a/tests/ref/fate/h264-conformance-cvfi2_sva_c b/tests/ref/fate/h264-conformance-cvfi2_sva_c
deleted file mode 100644
index ffb0a83..0000000
--- a/tests/ref/fate/h264-conformance-cvfi2_sva_c
+++ /dev/null
@@ -1,13 +0,0 @@
-0, 0, 518400, 0x4073cc0b
-0, 3600, 518400, 0x5f599a48
-0, 7200, 518400, 0xc6fe555a
-0, 10800, 518400, 0xe63ac345
-0, 14400, 518400, 0x9b4f0c5c
-0, 18000, 518400, 0x98aaba2d
-0, 21600, 518400, 0xd629bd09
-0, 25200, 518400, 0xe9796c37
-0, 28800, 518400, 0xba54d16e
-0, 32400, 518400, 0xe396c3eb
-0, 36000, 518400, 0x63ee4b81
-0, 39600, 518400, 0x68ac6986
-0, 43200, 518400, 0xe0d53000
diff --git a/tests/ref/fate/h264-conformance-cvma1_sony_d b/tests/ref/fate/h264-conformance-cvma1_sony_d
deleted file mode 100644
index 6b309aa..0000000
--- a/tests/ref/fate/h264-conformance-cvma1_sony_d
+++ /dev/null
@@ -1,5 +0,0 @@
-0, 0, 518400, 0x75701511
-0, 3600, 518400, 0xa7eeaa16
-0, 7200, 518400, 0xe0f32e35
-0, 10800, 518400, 0x7a1dadd9
-0, 14400, 518400, 0x4a1672a6
diff --git a/tests/ref/fate/h264-conformance-cvma1_toshiba_b b/tests/ref/fate/h264-conformance-cvma1_toshiba_b
deleted file mode 100644
index 897e915..0000000
--- a/tests/ref/fate/h264-conformance-cvma1_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0x9a9ce366
-0, 3600, 152064, 0xf4639828
-0, 7200, 152064, 0x625024a3
-0, 10800, 152064, 0x80dc2f9d
-0, 14400, 152064, 0xb2c4feea
-0, 18000, 152064, 0x4ec6ad64
-0, 21600, 152064, 0x1957bec3
-0, 25200, 152064, 0xb682799d
-0, 28800, 152064, 0x34cd2053
-0, 32400, 152064, 0x81490b4c
-0, 36000, 152064, 0x242dc943
-0, 39600, 152064, 0x3e126734
-0, 43200, 152064, 0x8e474ff8
-0, 46800, 152064, 0x239d2fbd
-0, 50400, 152064, 0x0ca3e16f
-0, 54000, 152064, 0x6161d7c2
-0, 57600, 152064, 0xca7ad1af
-0, 61200, 152064, 0xf8ef9026
-0, 64800, 152064, 0x01f2f4c1
-0, 68400, 152064, 0x510b19ec
-0, 72000, 152064, 0xe489028b
-0, 75600, 152064, 0x7a693c1e
-0, 79200, 152064, 0x276b23fe
-0, 82800, 152064, 0x0e9ced3a
-0, 86400, 152064, 0x658228f7
-0, 90000, 152064, 0x6a271bc3
-0, 93600, 152064, 0x431ecd8b
-0, 97200, 152064, 0x23a5ed14
-0, 100800, 152064, 0x76fbe121
-0, 104400, 152064, 0x471f919d
-0, 108000, 152064, 0x16bfabbc
-0, 111600, 152064, 0x0762993f
-0, 115200, 152064, 0x5a2b0b0e
-0, 118800, 152064, 0x81415ef7
-0, 122400, 152064, 0xb96e4164
-0, 126000, 152064, 0xf77aee83
-0, 129600, 152064, 0x6af81633
-0, 133200, 152064, 0xed78e5b5
-0, 136800, 152064, 0x67e38e2c
-0, 140400, 152064, 0x0417ae01
-0, 144000, 152064, 0x3887b312
-0, 147600, 152064, 0x3a4b70fb
-0, 151200, 152064, 0xcaae9e7f
-0, 154800, 152064, 0xaf9597be
-0, 158400, 152064, 0x9bae63d3
-0, 162000, 152064, 0x0e80825f
-0, 165600, 152064, 0x915661fd
-0, 169200, 152064, 0x67d3dc94
-0, 172800, 152064, 0x3dcf240c
-0, 176400, 152064, 0x127ff832
-0, 180000, 152064, 0xc8969981
-0, 183600, 152064, 0x57179c77
-0, 187200, 152064, 0x9f88656c
-0, 190800, 152064, 0xc28ff5d3
-0, 194400, 152064, 0xf100fad9
-0, 198000, 152064, 0xb570ce12
-0, 201600, 152064, 0xe8f28955
-0, 205200, 152064, 0x1f0a9549
-0, 208800, 152064, 0x22b17e9b
-0, 212400, 152064, 0x7cf1400e
-0, 216000, 152064, 0xafd273b7
-0, 219600, 152064, 0xeb9b712e
-0, 223200, 152064, 0x0f81de24
-0, 226800, 152064, 0x8f4e1953
-0, 230400, 152064, 0x682e2170
-0, 234000, 152064, 0xc32ad1b2
-0, 237600, 152064, 0x53a81d79
-0, 241200, 152064, 0x54002596
-0, 244800, 152064, 0x4b5fdbd9
-0, 248400, 152064, 0x96613368
-0, 252000, 152064, 0xd6ac0171
-0, 255600, 152064, 0xf1c1b7b7
-0, 259200, 152064, 0xc730d82f
-0, 262800, 152064, 0x0415d934
-0, 266400, 152064, 0x5338915e
-0, 270000, 152064, 0x8e9dda6d
-0, 273600, 152064, 0xe3a8b0a0
-0, 277200, 152064, 0x5fa36e44
-0, 280800, 152064, 0x0e63dc72
-0, 284400, 152064, 0xd0dad71f
-0, 288000, 152064, 0x0c4aac94
-0, 291600, 152064, 0x60d50e8d
-0, 295200, 152064, 0x96872d7c
-0, 298800, 152064, 0x4fcefc33
-0, 302400, 152064, 0x6b8157c9
-0, 306000, 152064, 0xa40d527d
-0, 309600, 152064, 0x9884480a
-0, 313200, 152064, 0xff5d9754
-0, 316800, 152064, 0x4a26a74d
-0, 320400, 152064, 0x81059e82
diff --git a/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b b/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b
deleted file mode 100644
index 07422b8..0000000
--- a/tests/ref/fate/h264-conformance-cvmanl1_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x78882b27
-0, 14400, 152064, 0x3afef36d
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x3a8bab81
-0, 25200, 152064, 0x2a437174
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x39c5f125
-0, 36000, 152064, 0x256eaad2
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x412a4aa7
-0, 46800, 152064, 0x3f091baf
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0x2fc4ce67
-0, 57600, 152064, 0x119cde3e
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0x4be4f192
-0, 68400, 152064, 0x906c1237
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0x6a833025
-0, 79200, 152064, 0x681d1c4f
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0xc69226f0
-0, 90000, 152064, 0x86631102
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xc746ddd4
-0, 100800, 152064, 0x5f2bd3cb
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0x5b7fa380
-0, 111600, 152064, 0x82438cf7
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0xc50d41f1
-0, 122400, 152064, 0xf3453631
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x045b03f7
-0, 133200, 152064, 0xf64bd756
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0x3613a0a5
-0, 144000, 152064, 0xe6a7a8d6
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0x4dfc912b
-0, 154800, 152064, 0x81e3991c
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0xed478395
-0, 165600, 152064, 0x4cb25ab6
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x8bcc1a8d
-0, 176400, 152064, 0x2fe1f240
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0xe3929556
-0, 187200, 152064, 0xd370632a
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0x444bf18c
-0, 198000, 152064, 0xab40bd14
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0xe1f09568
-0, 208800, 152064, 0x09ee7a7e
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0xdbd467e9
-0, 219600, 152064, 0x99726777
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0xcf770fdb
-0, 230400, 152064, 0x2a890fd9
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x04191304
-0, 241200, 152064, 0x15722022
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0x28ba373f
-0, 252000, 152064, 0xf9e400b8
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0x6917d2a5
-0, 262800, 152064, 0x61cae234
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x1ee2d9bd
-0, 273600, 152064, 0xdce9ab8e
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x10e8cb60
-0, 284400, 152064, 0x8d07cd25
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xb0f10280
-0, 295200, 152064, 0x76a71f13
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x9aba5724
-0, 306000, 152064, 0x5db85385
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0xa71e85bb
-0, 316800, 152064, 0xdcf59cd7
-0, 320400, 152064, 0x5e319459
diff --git a/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b b/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b
deleted file mode 100644
index d8959a3..0000000
--- a/tests/ref/fate/h264-conformance-cvmanl2_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xb1edd842
-0, 3600, 152064, 0x551f8f45
-0, 7200, 152064, 0xb4931cb2
-0, 10800, 152064, 0x5f352e98
-0, 14400, 152064, 0xeba5fe28
-0, 18000, 152064, 0x85afad0a
-0, 21600, 152064, 0x1120b6a4
-0, 25200, 152064, 0x67506e16
-0, 28800, 152064, 0x22421437
-0, 32400, 152064, 0x929becd6
-0, 36000, 152064, 0x6ffcb4b0
-0, 39600, 152064, 0x668a5d31
-0, 43200, 152064, 0x1b034ebb
-0, 46800, 152064, 0x7e2d213c
-0, 50400, 152064, 0xbf16d262
-0, 54000, 152064, 0xdeaecab3
-0, 57600, 152064, 0xd220d704
-0, 61200, 152064, 0xb40b8632
-0, 64800, 152064, 0xbdf0ef57
-0, 68400, 152064, 0x7e2e10df
-0, 72000, 152064, 0x95380024
-0, 75600, 152064, 0xdb80256d
-0, 79200, 152064, 0xa4561c61
-0, 82800, 152064, 0x08c8dea4
-0, 86400, 152064, 0x7bb917d6
-0, 90000, 152064, 0x796f0e2b
-0, 93600, 152064, 0x7f40c77a
-0, 97200, 152064, 0xda32de2e
-0, 100800, 152064, 0x00ffc15a
-0, 104400, 152064, 0x643c8316
-0, 108000, 152064, 0xb7588f7f
-0, 111600, 152064, 0xa4e07c02
-0, 115200, 152064, 0xdee0f7e7
-0, 118800, 152064, 0x2c3245ee
-0, 122400, 152064, 0x6565355b
-0, 126000, 152064, 0x90bce66b
-0, 129600, 152064, 0x0abffe08
-0, 133200, 152064, 0x119ccc3e
-0, 136800, 152064, 0xff997ef2
-0, 140400, 152064, 0xba4b9820
-0, 144000, 152064, 0xb6dfa596
-0, 147600, 152064, 0xb0906c42
-0, 151200, 152064, 0xf3c29133
-0, 154800, 152064, 0x08cd8e2b
-0, 158400, 152064, 0x4efc61fb
-0, 162000, 152064, 0x5b7c6e48
-0, 165600, 152064, 0xd28a47c2
-0, 169200, 152064, 0x28e7d51f
-0, 172800, 152064, 0x3a5619b1
-0, 176400, 152064, 0xa517e7f2
-0, 180000, 152064, 0xb4978ef8
-0, 183600, 152064, 0x25929175
-0, 187200, 152064, 0x20f05834
-0, 190800, 152064, 0xba86ffb2
-0, 194400, 152064, 0xa265f06f
-0, 198000, 152064, 0x97bbbfb7
-0, 201600, 152064, 0xfd488a5d
-0, 205200, 152064, 0x1b0989da
-0, 208800, 152064, 0xfd1878ce
-0, 212400, 152064, 0x9360397c
-0, 216000, 152064, 0x0d8151a7
-0, 219600, 152064, 0xe7a05bb8
-0, 223200, 152064, 0x009fd46c
-0, 226800, 152064, 0x8751123f
-0, 230400, 152064, 0x8252101a
-0, 234000, 152064, 0x7f40de4b
-0, 237600, 152064, 0x4ea317fe
-0, 241200, 152064, 0x519224d9
-0, 244800, 152064, 0x59f4ea93
-0, 248400, 152064, 0xc93c1dba
-0, 252000, 152064, 0xe3c9fb61
-0, 255600, 152064, 0x85c4bd98
-0, 259200, 152064, 0xcebacfd3
-0, 262800, 152064, 0x7327da99
-0, 266400, 152064, 0x752a9a2d
-0, 270000, 152064, 0x5ea6c8d2
-0, 273600, 152064, 0x66fd8c6f
-0, 277200, 152064, 0x51225fd0
-0, 280800, 152064, 0x58b9be96
-0, 284400, 152064, 0xa5abcdb7
-0, 288000, 152064, 0xb18ba61b
-0, 291600, 152064, 0xc7d20190
-0, 295200, 152064, 0xb6da14aa
-0, 298800, 152064, 0x3004f5a1
-0, 302400, 152064, 0x129354e2
-0, 306000, 152064, 0xffa148d5
-0, 309600, 152064, 0xbe9d3f5b
-0, 313200, 152064, 0x1c7f8976
-0, 316800, 152064, 0xa107a54d
-0, 320400, 152064, 0x5e319459
diff --git a/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e b/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e
deleted file mode 100644
index ba89dfc..0000000
--- a/tests/ref/fate/h264-conformance-cvmapaqp3_sony_e
+++ /dev/null
@@ -1,8 +0,0 @@
-0, 0, 518400, 0x80dffda2
-0, 3600, 518400, 0x9450183b
-0, 7200, 518400, 0x85d429a7
-0, 10800, 518400, 0xe1f3b686
-0, 14400, 518400, 0x2180c761
-0, 18000, 518400, 0x30269c7c
-0, 21600, 518400, 0xe9aa575a
-0, 25200, 518400, 0x7b815a0a
diff --git a/tests/ref/fate/h264-conformance-cvmaqp2_sony_g b/tests/ref/fate/h264-conformance-cvmaqp2_sony_g
deleted file mode 100644
index 292aeed..0000000
--- a/tests/ref/fate/h264-conformance-cvmaqp2_sony_g
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 36864, 0xdee3d4e3
-0, 3600, 36864, 0xaa1a67ca
-0, 7200, 36864, 0xe00e0dec
-0, 10800, 36864, 0x31f0b63f
-0, 14400, 36864, 0xd0cc34d9
-0, 18000, 36864, 0x3e76eba5
-0, 21600, 36864, 0x0e7dcc9c
-0, 25200, 36864, 0xd71bc457
-0, 28800, 36864, 0x11c81ebe
-0, 32400, 36864, 0x1d4ca6d7
-0, 36000, 36864, 0xb191d155
-0, 39600, 36864, 0x435a188c
-0, 43200, 36864, 0x99d7227c
-0, 46800, 36864, 0x700637fc
-0, 50400, 36864, 0x351f7dd3
-0, 54000, 36864, 0x1658c18b
-0, 57600, 36864, 0x60034b90
diff --git a/tests/ref/fate/h264-conformance-cvmaqp3_sony_d b/tests/ref/fate/h264-conformance-cvmaqp3_sony_d
deleted file mode 100644
index c029f45..0000000
--- a/tests/ref/fate/h264-conformance-cvmaqp3_sony_d
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 36864, 0xdee3d4e3
-0, 3600, 36864, 0xabec8d44
-0, 7200, 36864, 0x95d029fe
-0, 10800, 36864, 0x4daeb4b9
-0, 14400, 36864, 0x320a6301
-0, 18000, 36864, 0x6b881d0c
-0, 21600, 36864, 0xfe6eda15
-0, 25200, 36864, 0xda72d0b2
-0, 28800, 36864, 0x3232651b
-0, 32400, 36864, 0x9f20cbf1
-0, 36000, 36864, 0x5dfbd085
-0, 39600, 36864, 0x2bb62dd1
-0, 43200, 36864, 0xf8ed11cf
-0, 46800, 36864, 0x1ed62476
-0, 50400, 36864, 0x65b18976
-0, 54000, 36864, 0x1658c18b
-0, 57600, 36864, 0x76073a08
diff --git a/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b b/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b
deleted file mode 100644
index ba7caaf..0000000
--- a/tests/ref/fate/h264-conformance-cvmp_mot_fld_l30_b
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0xe9c7643e
-0, 3600, 518400, 0xba7456ec
-0, 7200, 518400, 0xdeb96749
-0, 10800, 518400, 0xa101a986
-0, 14400, 518400, 0x3db7baa5
-0, 18000, 518400, 0xf3dfcec7
-0, 21600, 518400, 0x79b4f537
-0, 25200, 518400, 0x9e64fe68
-0, 28800, 518400, 0x0e810b53
-0, 32400, 518400, 0x20baf3b8
-0, 36000, 518400, 0x0a49d341
-0, 39600, 518400, 0xa8304ab5
-0, 43200, 518400, 0x2600e98f
-0, 46800, 518400, 0x9253e3e8
-0, 50400, 518400, 0xd6e12783
-0, 54000, 518400, 0x6894fc79
-0, 57600, 518400, 0xfb60d3e3
-0, 61200, 518400, 0x523602be
-0, 64800, 518400, 0x4979f409
-0, 68400, 518400, 0x50d4e2ab
-0, 72000, 518400, 0xa8c2140a
-0, 75600, 518400, 0x45c0bc15
-0, 79200, 518400, 0xaef78cab
-0, 82800, 518400, 0xec539d02
-0, 86400, 518400, 0x602585ea
-0, 90000, 518400, 0xda263463
-0, 93600, 518400, 0xa03d8922
-0, 97200, 518400, 0x43ea1c1d
-0, 100800, 518400, 0xb1e055a6
-0, 104400, 518400, 0x6fff9398
diff --git a/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b b/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b
deleted file mode 100644
index 05827ef..0000000
--- a/tests/ref/fate/h264-conformance-cvmp_mot_frm_l31_b
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 518400, 0x7b2475e3
-0, 3600, 518400, 0xda786a87
-0, 7200, 518400, 0xb1dd8108
-0, 10800, 518400, 0x760ed65d
-0, 14400, 518400, 0x8632d20c
-0, 18000, 518400, 0xdd81e625
-0, 21600, 518400, 0x853f1c41
-0, 25200, 518400, 0x20191585
-0, 28800, 518400, 0x0367e357
-0, 32400, 518400, 0x60521167
-0, 36000, 518400, 0xa887d4cc
-0, 39600, 518400, 0x9a450f9e
-0, 43200, 518400, 0xe9620841
-0, 46800, 518400, 0xb482fb0e
-0, 50400, 518400, 0x7b79f670
-0, 54000, 518400, 0x9d37f1d1
-0, 57600, 518400, 0xe358d323
-0, 61200, 518400, 0x62ade59c
-0, 64800, 518400, 0xdd78da66
-0, 68400, 518400, 0xd97b867b
-0, 72000, 518400, 0x8a90cf8c
-0, 75600, 518400, 0x9d386610
-0, 79200, 518400, 0x2c590f46
-0, 82800, 518400, 0x92662861
-0, 86400, 518400, 0x6979f563
-0, 90000, 518400, 0xdd0fa1b2
-0, 93600, 518400, 0xccbf1c1c
-0, 97200, 518400, 0x7e358112
-0, 100800, 518400, 0xb7c0d89d
-0, 104400, 518400, 0xc6b03973
diff --git a/tests/ref/fate/h264-conformance-cvnlfi1_sony_c b/tests/ref/fate/h264-conformance-cvnlfi1_sony_c
deleted file mode 100644
index 26fa93a..0000000
--- a/tests/ref/fate/h264-conformance-cvnlfi1_sony_c
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 518400, 0x0fbb4e71
-0, 3600, 518400, 0x4b816734
-0, 7200, 518400, 0x0c350f19
-0, 10800, 518400, 0xda049cb6
-0, 14400, 518400, 0x1f3e7bb9
-0, 18000, 518400, 0x995cbe66
-0, 21600, 518400, 0x07f7e65c
-0, 25200, 518400, 0xfcb7487f
-0, 28800, 518400, 0xb080f48a
-0, 32400, 518400, 0x3ef5b7e4
-0, 36000, 518400, 0xa1518e1c
-0, 39600, 518400, 0xb36f1cc9
-0, 43200, 518400, 0x86ea48af
-0, 46800, 518400, 0xe42373b7
-0, 50400, 518400, 0xa8435828
-0, 54000, 518400, 0xc942ea0e
-0, 57600, 518400, 0xcc597514
diff --git a/tests/ref/fate/h264-conformance-cvnlfi2_sony_h b/tests/ref/fate/h264-conformance-cvnlfi2_sony_h
deleted file mode 100644
index 045929b..0000000
--- a/tests/ref/fate/h264-conformance-cvnlfi2_sony_h
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 518400, 0x0fbb4e71
-0, 3600, 518400, 0xc46bec04
-0, 7200, 518400, 0xc50ffc1d
-0, 10800, 518400, 0x684b07b7
-0, 14400, 518400, 0xde799af0
-0, 18000, 518400, 0xed497b27
-0, 21600, 518400, 0x3e9d1e3a
-0, 25200, 518400, 0x154d3c5c
-0, 28800, 518400, 0x5257e37c
-0, 32400, 518400, 0x6e15139a
-0, 36000, 518400, 0x5dc39c59
-0, 39600, 518400, 0xe1803100
-0, 43200, 518400, 0xb4d4d535
-0, 46800, 518400, 0x7a97a25d
-0, 50400, 518400, 0xf86b8923
-0, 54000, 518400, 0x3355be98
-0, 57600, 518400, 0x8f555830
diff --git a/tests/ref/fate/h264-conformance-cvpa1_toshiba_b b/tests/ref/fate/h264-conformance-cvpa1_toshiba_b
deleted file mode 100644
index 6f94315..0000000
--- a/tests/ref/fate/h264-conformance-cvpa1_toshiba_b
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0x128cd77a
-0, 3600, 152064, 0x565b9fc1
-0, 7200, 152064, 0xbe322679
-0, 10800, 152064, 0x0ea4238f
-0, 14400, 152064, 0x1e08fb3c
-0, 18000, 152064, 0x6da3a93c
-0, 21600, 152064, 0x75e5b181
-0, 25200, 152064, 0xa0b39334
-0, 28800, 152064, 0xa0d10d6d
-0, 32400, 152064, 0x33842bcb
-0, 36000, 152064, 0x9a74e1e4
-0, 39600, 152064, 0xc2037244
-0, 43200, 152064, 0x364b8ae4
-0, 46800, 152064, 0x18c04971
-0, 50400, 152064, 0x7234ecb5
-0, 54000, 152064, 0x3719f8bc
-0, 57600, 152064, 0x1285ead1
-0, 61200, 152064, 0xd3bfab18
-0, 64800, 152064, 0x898111e2
-0, 68400, 152064, 0x681c15fc
-0, 72000, 152064, 0x8e501572
-0, 75600, 152064, 0xd7c838be
-0, 79200, 152064, 0xede424b2
-0, 82800, 152064, 0xcfc20240
-0, 86400, 152064, 0x13992e86
-0, 90000, 152064, 0x56fb251a
-0, 93600, 152064, 0xee9be320
-0, 97200, 152064, 0xea650153
-0, 100800, 152064, 0x2cb6dabe
-0, 104400, 152064, 0xf44fa4b5
-0, 108000, 152064, 0xdac2adff
-0, 111600, 152064, 0x9e15a1dc
-0, 115200, 152064, 0x28d00970
-0, 118800, 152064, 0xe4277347
-0, 122400, 152064, 0xebd25ad1
-0, 126000, 152064, 0x029402da
-0, 129600, 152064, 0x1a2311ef
-0, 133200, 152064, 0xb86bf96a
-0, 136800, 152064, 0x67d7a5b0
-0, 140400, 152064, 0x573abc2d
-0, 144000, 152064, 0xbe97dec0
-0, 147600, 152064, 0x592b91a4
-0, 151200, 152064, 0x9adda65e
-0, 154800, 152064, 0x0354b2cb
-0, 158400, 152064, 0x91e27ff9
-0, 162000, 152064, 0x389f8625
-0, 165600, 152064, 0x90175850
-0, 169200, 152064, 0x2d36c427
-0, 172800, 152064, 0xc0dd14ab
-0, 176400, 152064, 0xd49bf131
-0, 180000, 152064, 0x0d4a9b92
-0, 183600, 152064, 0xae9bb2f1
-0, 187200, 152064, 0x36847ade
-0, 190800, 152064, 0x74810382
-0, 194400, 152064, 0xc56d1d9f
-0, 198000, 152064, 0xcfefe3ae
-0, 201600, 152064, 0xeaa39353
-0, 205200, 152064, 0x14289aef
-0, 208800, 152064, 0x74ba8f3b
-0, 212400, 152064, 0xdcaa518d
-0, 216000, 152064, 0x6e4881c2
-0, 219600, 152064, 0xa4db767d
-0, 223200, 152064, 0x239b0b19
-0, 226800, 152064, 0x5d054236
-0, 230400, 152064, 0x6f392d7c
-0, 234000, 152064, 0x5c2af146
-0, 237600, 152064, 0x26b439af
-0, 241200, 152064, 0xba7043ab
-0, 244800, 152064, 0x0816000c
-0, 248400, 152064, 0x3a713c05
-0, 252000, 152064, 0xb3111f6d
-0, 255600, 152064, 0xdbf8dae2
-0, 259200, 152064, 0x09ddf22e
-0, 262800, 152064, 0x8871fa7e
-0, 266400, 152064, 0x9f5db7a1
-0, 270000, 152064, 0xcc38f225
-0, 273600, 152064, 0xa1d18df9
-0, 277200, 152064, 0x9b1c5d6a
-0, 280800, 152064, 0x9f2bc696
-0, 284400, 152064, 0xc39bd11a
-0, 288000, 152064, 0x4ceca7d0
-0, 291600, 152064, 0x63a60f1d
-0, 295200, 152064, 0x4cd31f28
-0, 298800, 152064, 0x9c9af5d1
-0, 302400, 152064, 0x6def65fc
-0, 306000, 152064, 0x1011466d
-0, 309600, 152064, 0xfeca406d
-0, 313200, 152064, 0xd1ca8a1e
-0, 316800, 152064, 0x30caa195
-0, 320400, 152064, 0x31a09a48
diff --git a/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c b/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c
deleted file mode 100644
index feb3010..0000000
--- a/tests/ref/fate/h264-conformance-cvpcmnl1_sva_c
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 152064, 0x19b8407d
-0, 3600, 152064, 0xab8bede6
-0, 7200, 152064, 0xf59acd09
-0, 10800, 152064, 0xc905853b
-0, 14400, 152064, 0x1c3d32f8
-0, 18000, 152064, 0x26a91508
-0, 21600, 152064, 0x9443e44a
-0, 25200, 152064, 0x0d158c55
-0, 28800, 152064, 0x4b207062
-0, 32400, 152064, 0x31d8543f
-0, 36000, 152064, 0x43520337
-0, 39600, 152064, 0x4676dd14
-0, 43200, 152064, 0x8b4291d4
-0, 46800, 152064, 0xb35e4950
-0, 50400, 152064, 0xd7164390
-0, 54000, 152064, 0x7cce0af7
-0, 57600, 152064, 0x4f67ca7d
-0, 61200, 152064, 0xd517af08
-0, 64800, 152064, 0x519b8322
-0, 68400, 152064, 0xa87d2987
-0, 72000, 152064, 0xfe8cfd89
-0, 75600, 152064, 0x3b40b919
-0, 79200, 152064, 0x83398526
-0, 82800, 152064, 0x309b6168
-0, 86400, 152064, 0xa8351c37
-0, 90000, 152064, 0x7977f8fd
-0, 93600, 152064, 0x5b24e5a7
-0, 97200, 152064, 0x0ad0a48e
-0, 100800, 152064, 0xd93a7d3e
-0, 104400, 152064, 0xae0f6631
diff --git a/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c b/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
deleted file mode 100644
index 16a4650..0000000
--- a/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
+++ /dev/null
@@ -1,2 +0,0 @@
-0, 0, 1382400, 0xccbe6bf8
-0, 3600, 1382400, 0x49c0cfd7
diff --git a/tests/ref/fate/h264-conformance-cvwp1_toshiba_e b/tests/ref/fate/h264-conformance-cvwp1_toshiba_e
deleted file mode 100644
index 6c9b227..0000000
--- a/tests/ref/fate/h264-conformance-cvwp1_toshiba_e
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0xe941572f
-0, 10800, 152064, 0xcf63e20e
-0, 14400, 152064, 0x57dedcde
-0, 18000, 152064, 0x4de7bf34
-0, 21600, 152064, 0xc8014983
-0, 25200, 152064, 0x5ab946fc
-0, 28800, 152064, 0x2ca02582
-0, 32400, 152064, 0x9c95435d
-0, 36000, 152064, 0x8371b963
-0, 39600, 152064, 0xa0f1af67
-0, 43200, 152064, 0xf1155345
-0, 46800, 152064, 0x66a71c79
-0, 50400, 152064, 0x509db08a
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0x66035e2b
-0, 61200, 152064, 0xa4113115
-0, 64800, 152064, 0x3d35d3c0
-0, 68400, 152064, 0x5117d324
-0, 72000, 152064, 0x7b0c7660
-0, 75600, 152064, 0x0eacf9ba
-0, 79200, 152064, 0x358d0486
-0, 82800, 152064, 0xc2dbeadc
-0, 86400, 152064, 0x61b2c275
-0, 90000, 152064, 0xbb3697d2
-0, 93600, 152064, 0x44e58e8a
-0, 97200, 152064, 0x21f6464f
-0, 100800, 152064, 0xdb3416f2
-0, 104400, 152064, 0x8201d928
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0x28cff0a5
-0, 115200, 152064, 0x5d77cab2
-0, 118800, 152064, 0x2218b509
-0, 122400, 152064, 0xaf40790a
-0, 126000, 152064, 0xaed42b3b
-0, 129600, 152064, 0x866d2462
-0, 133200, 152064, 0x23a7111a
-0, 136800, 152064, 0xceefc9d0
-0, 140400, 152064, 0x88dba819
-0, 144000, 152064, 0x19b350f3
-0, 147600, 152064, 0x85a857e5
-0, 151200, 152064, 0x02ca7c6f
-0, 154800, 152064, 0xe2de12d0
-0, 158400, 152064, 0x84a36173
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0x6b72ab43
-0, 169200, 152064, 0x5fba909e
-0, 172800, 152064, 0x43ab27f2
-0, 176400, 152064, 0x414cdd60
-0, 180000, 152064, 0x080fde7b
-0, 183600, 152064, 0xb1b7e4db
-0, 187200, 152064, 0xf17db2da
-0, 190800, 152064, 0x248b88e9
-0, 194400, 152064, 0x6b68301b
-0, 198000, 152064, 0xc581100d
-0, 201600, 152064, 0x8e9cf443
-0, 205200, 152064, 0x3c4ec87a
-0, 208800, 152064, 0x6e417a1f
-0, 212400, 152064, 0x02c7ecc4
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xc44cf3fa
-0, 223200, 152064, 0x0f8db331
-0, 226800, 152064, 0x71fe651b
-0, 230400, 152064, 0xdd0b9b70
-0, 234000, 152064, 0x4f6114c3
-0, 237600, 152064, 0x5a64e819
-0, 241200, 152064, 0x20bce1a1
-0, 244800, 152064, 0x6b196d49
-0, 248400, 152064, 0x7c1535a6
-0, 252000, 152064, 0x9b5225a4
-0, 255600, 152064, 0x72c5f185
-0, 259200, 152064, 0x3da4f50d
-0, 262800, 152064, 0xd7f7af48
-0, 266400, 152064, 0x0e1a8f2e
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x003a2b62
-0, 277200, 152064, 0x7777f6bd
-0, 280800, 152064, 0x91003021
-0, 284400, 152064, 0xb2e1af8c
-0, 288000, 152064, 0xae6676bc
-0, 291600, 152064, 0x72f55c98
-0, 295200, 152064, 0x9dfb52bc
-0, 298800, 152064, 0x4b6b0db4
-0, 302400, 152064, 0xba8bab86
-0, 306000, 152064, 0x775a8da0
-0, 309600, 152064, 0x96a35194
-0, 313200, 152064, 0x17732a58
-0, 316800, 152064, 0x45eef560
-0, 320400, 152064, 0x95c79208
diff --git a/tests/ref/fate/h264-conformance-cvwp2_toshiba_e b/tests/ref/fate/h264-conformance-cvwp2_toshiba_e
deleted file mode 100644
index 4e904bc..0000000
--- a/tests/ref/fate/h264-conformance-cvwp2_toshiba_e
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xf503fb79
-0, 3600, 152064, 0xeaa4ba5d
-0, 7200, 152064, 0x50865a33
-0, 10800, 152064, 0x34125f86
-0, 14400, 152064, 0xc5a8bb68
-0, 18000, 152064, 0xe6e9b376
-0, 21600, 152064, 0x4e41d48e
-0, 25200, 152064, 0xea73cc5d
-0, 28800, 152064, 0xc0c60ac0
-0, 32400, 152064, 0xd7110670
-0, 36000, 152064, 0x00465d0d
-0, 39600, 152064, 0xa37a726b
-0, 43200, 152064, 0x5dd13b2a
-0, 46800, 152064, 0x08471f31
-0, 50400, 152064, 0x2bb2b055
-0, 54000, 152064, 0xd06d7f1c
-0, 57600, 152064, 0x91fde84a
-0, 61200, 152064, 0xdbb52d2b
-0, 64800, 152064, 0x505c08b4
-0, 68400, 152064, 0xd8aeef9f
-0, 72000, 152064, 0x4e3f8721
-0, 75600, 152064, 0xce534aee
-0, 79200, 152064, 0x51f80737
-0, 82800, 152064, 0x8fa0e443
-0, 86400, 152064, 0xe8c9db17
-0, 90000, 152064, 0xc84bcee6
-0, 93600, 152064, 0xa7916158
-0, 97200, 152064, 0x16149c36
-0, 100800, 152064, 0xe55213fd
-0, 104400, 152064, 0xa701e59d
-0, 108000, 152064, 0xad65e200
-0, 111600, 152064, 0x4606dc82
-0, 115200, 152064, 0x582f9f64
-0, 118800, 152064, 0xc630662a
-0, 122400, 152064, 0xe54bacf5
-0, 126000, 152064, 0x230e387f
-0, 129600, 152064, 0x1a9c746c
-0, 133200, 152064, 0xfa002d7c
-0, 136800, 152064, 0xe617c4a9
-0, 140400, 152064, 0xd3a4df19
-0, 144000, 152064, 0x25b9ca8c
-0, 147600, 152064, 0x0c505f7c
-0, 151200, 152064, 0x43f84f88
-0, 154800, 152064, 0x859fb3af
-0, 158400, 152064, 0x9680fc13
-0, 162000, 152064, 0x3fe6ecb6
-0, 165600, 152064, 0xf4c05a9c
-0, 169200, 152064, 0x16ba3b13
-0, 172800, 152064, 0x72f33fb9
-0, 176400, 152064, 0x3076e567
-0, 180000, 152064, 0x4e69b604
-0, 183600, 152064, 0x9c37a98b
-0, 187200, 152064, 0x0d5756c7
-0, 190800, 152064, 0xa4a46a81
-0, 194400, 152064, 0xadfc89d7
-0, 198000, 152064, 0x35693493
-0, 201600, 152064, 0xe3baedbf
-0, 205200, 152064, 0x78cfb405
-0, 208800, 152064, 0xd85c7074
-0, 212400, 152064, 0x14ab350e
-0, 216000, 152064, 0xaf55433e
-0, 219600, 152064, 0x75a8e79f
-0, 223200, 152064, 0x2fb599f6
-0, 226800, 152064, 0xbe30bdfe
-0, 230400, 152064, 0x8b07a5ce
-0, 234000, 152064, 0x99b32730
-0, 237600, 152064, 0x9265182d
-0, 241200, 152064, 0x91e789fd
-0, 244800, 152064, 0x1c1e6d16
-0, 248400, 152064, 0xfa06bdaa
-0, 252000, 152064, 0x7177041f
-0, 255600, 152064, 0xd902f99d
-0, 259200, 152064, 0x29bdc134
-0, 262800, 152064, 0xd713ab76
-0, 266400, 152064, 0x60e4788e
-0, 270000, 152064, 0xb18c7789
-0, 273600, 152064, 0x0b7829a5
-0, 277200, 152064, 0xf676d780
-0, 280800, 152064, 0xa88a3a57
-0, 284400, 152064, 0x825cf289
-0, 288000, 152064, 0x78928201
-0, 291600, 152064, 0x013a589c
-0, 295200, 152064, 0x9269fa64
-0, 298800, 152064, 0x6db5f5fa
-0, 302400, 152064, 0x49ad9d6a
-0, 306000, 152064, 0x1b7c290f
-0, 309600, 152064, 0x99716ad1
-0, 313200, 152064, 0x371527c2
-0, 316800, 152064, 0x9f351841
-0, 320400, 152064, 0x884bb432
diff --git a/tests/ref/fate/h264-conformance-cvwp3_toshiba_e b/tests/ref/fate/h264-conformance-cvwp3_toshiba_e
deleted file mode 100644
index e78f209..0000000
--- a/tests/ref/fate/h264-conformance-cvwp3_toshiba_e
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0x3b3ffd31
-0, 3600, 152064, 0x14e0b899
-0, 7200, 152064, 0x50865a33
-0, 10800, 152064, 0x12e749e5
-0, 14400, 152064, 0xe5921130
-0, 18000, 152064, 0x2ca3b10d
-0, 21600, 152064, 0xa9a39f04
-0, 25200, 152064, 0x2c78761a
-0, 28800, 152064, 0x70890ad7
-0, 32400, 152064, 0x4fc30132
-0, 36000, 152064, 0x10e4d2c9
-0, 39600, 152064, 0xa3326b50
-0, 43200, 152064, 0x8e054bf1
-0, 46800, 152064, 0x5bd91687
-0, 50400, 152064, 0x70bab119
-0, 54000, 152064, 0x9a1ab472
-0, 57600, 152064, 0x490776a0
-0, 61200, 152064, 0xdbb52d2b
-0, 64800, 152064, 0x142714b9
-0, 68400, 152064, 0xa051ee6f
-0, 72000, 152064, 0xafa97fdf
-0, 75600, 152064, 0x1ae67347
-0, 79200, 152064, 0xc4f42ed6
-0, 82800, 152064, 0x4445dc60
-0, 86400, 152064, 0xaef4d04b
-0, 90000, 152064, 0x6a51be82
-0, 93600, 152064, 0x48356190
-0, 97200, 152064, 0xc09b5f5d
-0, 100800, 152064, 0x933d3379
-0, 104400, 152064, 0xfb57e471
-0, 108000, 152064, 0xb5b2f45c
-0, 111600, 152064, 0xce36e45e
-0, 115200, 152064, 0x582f9f64
-0, 118800, 152064, 0x2f45b1fd
-0, 122400, 152064, 0x90708fa0
-0, 126000, 152064, 0xee483b8f
-0, 129600, 152064, 0xd2163e6c
-0, 133200, 152064, 0x39492dfe
-0, 136800, 152064, 0xf89cc57f
-0, 140400, 152064, 0xbfc3c411
-0, 144000, 152064, 0x919eb007
-0, 147600, 152064, 0x2c526309
-0, 151200, 152064, 0x39f067a2
-0, 154800, 152064, 0xb7653abb
-0, 158400, 152064, 0xe26a035c
-0, 162000, 152064, 0xcef1eb3b
-0, 165600, 152064, 0xb8b3c55f
-0, 169200, 152064, 0x16ba3b13
-0, 172800, 152064, 0x153a3117
-0, 176400, 152064, 0x90a21859
-0, 180000, 152064, 0x9231b756
-0, 183600, 152064, 0x65fcbcb9
-0, 187200, 152064, 0x447eaf44
-0, 190800, 152064, 0xa26b6a8e
-0, 194400, 152064, 0x100464f8
-0, 198000, 152064, 0x479648ec
-0, 201600, 152064, 0x6742f51f
-0, 205200, 152064, 0x14e9d906
-0, 208800, 152064, 0xa058ab87
-0, 212400, 152064, 0x8d093874
-0, 216000, 152064, 0xef7f2965
-0, 219600, 152064, 0x200d02bd
-0, 223200, 152064, 0x2fb599f6
-0, 226800, 152064, 0xf65fb6e4
-0, 230400, 152064, 0x489a9152
-0, 234000, 152064, 0xbe8a2fc2
-0, 237600, 152064, 0xea04097e
-0, 241200, 152064, 0xaf0cd627
-0, 244800, 152064, 0xc0a26b27
-0, 248400, 152064, 0x985f67e7
-0, 252000, 152064, 0x7d1b4c4c
-0, 255600, 152064, 0x9908f838
-0, 259200, 152064, 0xb8fef131
-0, 262800, 152064, 0xb1feaf6c
-0, 266400, 152064, 0x37b16bda
-0, 270000, 152064, 0x242471aa
-0, 273600, 152064, 0xf18c3839
-0, 277200, 152064, 0xf676d780
-0, 280800, 152064, 0x17bd0f76
-0, 284400, 152064, 0x3703e7a6
-0, 288000, 152064, 0x69ba8a8a
-0, 291600, 152064, 0x205281b3
-0, 295200, 152064, 0x54bf51e1
-0, 298800, 152064, 0xf6daf8ed
-0, 302400, 152064, 0x8728e805
-0, 306000, 152064, 0xe98cd2b0
-0, 309600, 152064, 0x7ef76e26
-0, 313200, 152064, 0x0fbf5230
-0, 316800, 152064, 0x9e4d104b
-0, 320400, 152064, 0xd562b815
diff --git a/tests/ref/fate/h264-conformance-cvwp5_toshiba_e b/tests/ref/fate/h264-conformance-cvwp5_toshiba_e
deleted file mode 100644
index 30f6912..0000000
--- a/tests/ref/fate/h264-conformance-cvwp5_toshiba_e
+++ /dev/null
@@ -1,90 +0,0 @@
-0, 0, 152064, 0xabf9ae05
-0, 3600, 152064, 0x20418b16
-0, 7200, 152064, 0x20f72775
-0, 10800, 152064, 0x57c07111
-0, 14400, 152064, 0x1b49267f
-0, 18000, 152064, 0x024cd238
-0, 21600, 152064, 0x044d1ae0
-0, 25200, 152064, 0xbfec1b59
-0, 28800, 152064, 0x1a91f935
-0, 32400, 152064, 0x9ee184dc
-0, 36000, 152064, 0x65047dbe
-0, 39600, 152064, 0xd1632fb5
-0, 43200, 152064, 0x56f64c3e
-0, 46800, 152064, 0xe6122f37
-0, 50400, 152064, 0x0575e670
-0, 54000, 152064, 0x3d457728
-0, 57600, 152064, 0x6b508105
-0, 61200, 152064, 0xcaaf5ea7
-0, 64800, 152064, 0x9f4e4501
-0, 68400, 152064, 0x1c661a73
-0, 72000, 152064, 0x2fd9d1c8
-0, 75600, 152064, 0x4ac99ab1
-0, 79200, 152064, 0xf2d36809
-0, 82800, 152064, 0xa8e32ffb
-0, 86400, 152064, 0xd4da2fd2
-0, 90000, 152064, 0xac3adde0
-0, 93600, 152064, 0xf014ed0f
-0, 97200, 152064, 0xca2e7d28
-0, 100800, 152064, 0x3a875e51
-0, 104400, 152064, 0xc03e4bda
-0, 108000, 152064, 0x4fdfb595
-0, 111600, 152064, 0x9243f098
-0, 115200, 152064, 0x9361bae6
-0, 118800, 152064, 0x7a1dadee
-0, 122400, 152064, 0x72a59e15
-0, 126000, 152064, 0xb5b47170
-0, 129600, 152064, 0x5eb16651
-0, 133200, 152064, 0xe7894af7
-0, 136800, 152064, 0x2683bb0b
-0, 140400, 152064, 0x90b4c8c5
-0, 144000, 152064, 0xf800c5b5
-0, 147600, 152064, 0xc2f5a895
-0, 151200, 152064, 0x213c65d4
-0, 154800, 152064, 0x01c65a19
-0, 158400, 152064, 0xd9f1b04b
-0, 162000, 152064, 0xa8d1b139
-0, 165600, 152064, 0x2d0cb0cd
-0, 169200, 152064, 0x5b0783fe
-0, 172800, 152064, 0x29e628ec
-0, 176400, 152064, 0x1b8527e5
-0, 180000, 152064, 0x4b46d179
-0, 183600, 152064, 0x6184c708
-0, 187200, 152064, 0x697bb8e2
-0, 190800, 152064, 0x5fd3a772
-0, 194400, 152064, 0x91456c86
-0, 198000, 152064, 0x376c4dae
-0, 201600, 152064, 0x00ba2b3f
-0, 205200, 152064, 0xf6f0f553
-0, 208800, 152064, 0xc0020855
-0, 212400, 152064, 0xec3d13d2
-0, 216000, 152064, 0xb7d7f1dc
-0, 219600, 152064, 0xf9dae37b
-0, 223200, 152064, 0x50d9cc93
-0, 226800, 152064, 0xba1eb592
-0, 230400, 152064, 0x67616557
-0, 234000, 152064, 0x09804760
-0, 237600, 152064, 0xc2ffba00
-0, 241200, 152064, 0xb71fcf46
-0, 244800, 152064, 0x6cd975af
-0, 248400, 152064, 0x19189167
-0, 252000, 152064, 0xbca8fe71
-0, 255600, 152064, 0xb0b3f607
-0, 259200, 152064, 0x7614d73a
-0, 262800, 152064, 0x7de9d87d
-0, 266400, 152064, 0x81f58cf2
-0, 270000, 152064, 0xb8b036cc
-0, 273600, 152064, 0x26d1e2e4
-0, 277200, 152064, 0xb41a1e6c
-0, 280800, 152064, 0x4f9be4a9
-0, 284400, 152064, 0xe95ad5d3
-0, 288000, 152064, 0xdffc9335
-0, 291600, 152064, 0x01d658c0
-0, 295200, 152064, 0x631b4b75
-0, 298800, 152064, 0x80ae282f
-0, 302400, 152064, 0xb34bf688
-0, 306000, 152064, 0xd0cc7d65
-0, 309600, 152064, 0x86aa4590
-0, 313200, 152064, 0xcb515a57
-0, 316800, 152064, 0x68650834
-0, 320400, 152064, 0x444ee2a4
diff --git a/tests/ref/fate/h264-conformance-fi1_sony_e b/tests/ref/fate/h264-conformance-fi1_sony_e
deleted file mode 100644
index 5b7f4c8..0000000
--- a/tests/ref/fate/h264-conformance-fi1_sony_e
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 36864, 0x3d54d3e3
-0, 3600, 36864, 0xa9573ef0
-0, 7200, 36864, 0x0ea5f263
-0, 10800, 36864, 0x5a849fb9
-0, 14400, 36864, 0x7ddb1eff
-0, 18000, 36864, 0x5e73e3b7
-0, 21600, 36864, 0x7d50d329
-0, 25200, 36864, 0xf2c2cd27
-0, 28800, 36864, 0xdf4f4628
-0, 32400, 36864, 0xddd6d5be
-0, 36000, 36864, 0xb530e1aa
-0, 39600, 36864, 0xeca42470
-0, 43200, 36864, 0xa5701caf
-0, 46800, 36864, 0x6f5d28fc
-0, 50400, 36864, 0xd4ab4ab2
-0, 54000, 36864, 0xf2dfcc22
-0, 57600, 36864, 0xcaa87e79
diff --git a/tests/ref/fate/h264-conformance-frext-alphaconformanceg b/tests/ref/fate/h264-conformance-frext-alphaconformanceg
deleted file mode 100644
index 02a7274..0000000
--- a/tests/ref/fate/h264-conformance-frext-alphaconformanceg
+++ /dev/null
@@ -1,43 +0,0 @@
-0, 0, 783360, 0xbc458a9a
-0, 3600, 783360, 0xc2b4a765
-0, 7200, 783360, 0x40a8ca87
-0, 10800, 783360, 0xdd0cbc2c
-0, 14400, 783360, 0xecf8e434
-0, 18000, 783360, 0xcc87e3d4
-0, 21600, 783360, 0x386e1a34
-0, 25200, 783360, 0x6ac4a62e
-0, 28800, 783360, 0xf23d89bb
-0, 32400, 783360, 0x52f7b94c
-0, 36000, 783360, 0x2b4ea2c2
-0, 39600, 783360, 0x0a43839c
-0, 43200, 783360, 0xad4b81ea
-0, 46800, 783360, 0xcb4fe0d4
-0, 50400, 783360, 0x6c3ca755
-0, 54000, 783360, 0x17d37f49
-0, 57600, 783360, 0x8fdfebec
-0, 61200, 783360, 0x1a177b49
-0, 64800, 783360, 0x72d230ad
-0, 68400, 783360, 0x62147d69
-0, 72000, 783360, 0xeed9b62c
-0, 75600, 783360, 0x7fc45b23
-0, 79200, 783360, 0x5dc60681
-0, 82800, 783360, 0x2d91c001
-0, 86400, 783360, 0x259ab608
-0, 90000, 783360, 0x29112b29
-0, 93600, 783360, 0x7e4d497e
-0, 97200, 783360, 0x616e5507
-0, 100800, 783360, 0x299473c9
-0, 104400, 783360, 0x4d63d722
-0, 108000, 783360, 0xa89e4bc6
-0, 111600, 783360, 0xbdef585a
-0, 115200, 783360, 0x5b12c72c
-0, 118800, 783360, 0x5a884bd8
-0, 122400, 783360, 0x97728ade
-0, 126000, 783360, 0x27dd8999
-0, 129600, 783360, 0x94104d66
-0, 133200, 783360, 0xf30244f1
-0, 136800, 783360, 0xfc98c63e
-0, 140400, 783360, 0x8b27de2e
-0, 144000, 783360, 0xfc6bbbf2
-0, 147600, 783360, 0x4527b6a3
-0, 151200, 783360, 0x4070daf0
diff --git a/tests/ref/fate/h264-conformance-frext-bcrm_freh10 b/tests/ref/fate/h264-conformance-frext-bcrm_freh10
deleted file mode 100644
index 252214e..0000000
--- a/tests/ref/fate/h264-conformance-frext-bcrm_freh10
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0xbdc2b880
-0, 3600, 152064, 0x4ebf93fe
-0, 7200, 152064, 0xe30d6871
-0, 10800, 152064, 0x04f46b9b
-0, 14400, 152064, 0xd7dd219a
-0, 18000, 152064, 0x02fc6511
-0, 21600, 152064, 0x98868faa
-0, 25200, 152064, 0x54b94f92
-0, 28800, 152064, 0xe3b6be4b
-0, 32400, 152064, 0xf148cf10
-0, 36000, 152064, 0xda3239b8
-0, 39600, 152064, 0x6c5d7331
-0, 43200, 152064, 0x825f1fea
-0, 46800, 152064, 0x47791056
-0, 50400, 152064, 0xc08e8a58
-0, 54000, 152064, 0x020299f3
-0, 57600, 152064, 0x0dfd4457
-0, 61200, 152064, 0xcf005e68
-0, 64800, 152064, 0x1f9e2c32
-0, 68400, 152064, 0xa8359324
-0, 72000, 152064, 0x4b03752d
-0, 75600, 152064, 0xd6281621
-0, 79200, 152064, 0xc97ac928
-0, 82800, 152064, 0xded90dcd
-0, 86400, 152064, 0xd6883255
-0, 90000, 152064, 0x6edb4d4f
-0, 93600, 152064, 0xd6f93a80
-0, 97200, 152064, 0x163d6153
-0, 100800, 152064, 0x04b90c06
-0, 104400, 152064, 0xee8730c1
-0, 108000, 152064, 0xd5f5c669
-0, 111600, 152064, 0xcc600b1f
-0, 115200, 152064, 0x15ddde03
-0, 118800, 152064, 0xd0388dd0
-0, 122400, 152064, 0xa292ab7d
-0, 126000, 152064, 0xacf584e9
-0, 129600, 152064, 0xcef42714
-0, 133200, 152064, 0xeb162f35
-0, 136800, 152064, 0x0a07de7b
-0, 140400, 152064, 0x7ae76c81
-0, 144000, 152064, 0x139c8fda
-0, 147600, 152064, 0x43724411
-0, 151200, 152064, 0x07b2ddea
-0, 154800, 152064, 0x831a1cc7
-0, 158400, 152064, 0x092f5073
-0, 162000, 152064, 0xe5b6d380
-0, 165600, 152064, 0xdd30d69e
-0, 169200, 152064, 0x887020b2
-0, 172800, 152064, 0x84436510
-0, 176400, 152064, 0x49f63606
-0, 180000, 152064, 0x6b96e959
-0, 183600, 152064, 0xc6247cc7
-0, 187200, 152064, 0x7a67c532
-0, 190800, 152064, 0x93f4c476
-0, 194400, 152064, 0x3c119654
-0, 198000, 152064, 0xa45f7c72
-0, 201600, 152064, 0x2ac50cb0
-0, 205200, 152064, 0x9bf16d06
-0, 208800, 152064, 0xfa0750d9
-0, 212400, 152064, 0x02197630
-0, 216000, 152064, 0x6d44f9b5
-0, 219600, 152064, 0x86b211f5
-0, 223200, 152064, 0xf4fda5d0
-0, 226800, 152064, 0x36f840a7
-0, 230400, 152064, 0x42412992
-0, 234000, 152064, 0xd0c9ba37
-0, 237600, 152064, 0xc40eba62
-0, 241200, 152064, 0x2d093b53
-0, 244800, 152064, 0xee39c69c
-0, 248400, 152064, 0xcbbf8968
-0, 252000, 152064, 0xfddc1704
-0, 255600, 152064, 0x8dc47c61
-0, 259200, 152064, 0xf15580bf
-0, 262800, 152064, 0x9c71a8b0
-0, 266400, 152064, 0x19b90b9f
-0, 270000, 152064, 0xb65ae287
-0, 273600, 152064, 0xf265693d
-0, 277200, 152064, 0x721714a1
-0, 280800, 152064, 0x383e8ac5
-0, 284400, 152064, 0x02558677
-0, 288000, 152064, 0xdaab3cdf
-0, 291600, 152064, 0xc939a2f6
-0, 295200, 152064, 0x977afa7f
-0, 298800, 152064, 0xe5e65f35
-0, 302400, 152064, 0x247546fa
-0, 306000, 152064, 0x49ff2094
-0, 309600, 152064, 0x9fd58cda
-0, 313200, 152064, 0x3e31b6e3
-0, 316800, 152064, 0x75c6d796
-0, 320400, 152064, 0x4ab3e7bb
-0, 324000, 152064, 0x393935ea
-0, 327600, 152064, 0xc8e62905
-0, 331200, 152064, 0xbb149e61
-0, 334800, 152064, 0x2553c4c5
-0, 338400, 152064, 0x7f82a8b4
-0, 342000, 152064, 0x26ef31e6
-0, 345600, 152064, 0xf029744a
-0, 349200, 152064, 0x0a6f191a
-0, 352800, 152064, 0x55808643
-0, 356400, 152064, 0x27576172
diff --git a/tests/ref/fate/h264-conformance-frext-brcm_freh11 b/tests/ref/fate/h264-conformance-frext-brcm_freh11
deleted file mode 100644
index fa2e708..0000000
--- a/tests/ref/fate/h264-conformance-frext-brcm_freh11
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x9744ac59
-0, 3600, 152064, 0x3eba88bf
-0, 7200, 152064, 0xd4105c5a
-0, 10800, 152064, 0x452966a3
-0, 14400, 152064, 0x30071add
-0, 18000, 152064, 0x0eb75245
-0, 21600, 152064, 0x4daa80fa
-0, 25200, 152064, 0xf53a43a1
-0, 28800, 152064, 0xa55ab43d
-0, 32400, 152064, 0x915ec82e
-0, 36000, 152064, 0xadce2f9a
-0, 39600, 152064, 0xf7a25715
-0, 43200, 152064, 0x90c91c7d
-0, 46800, 152064, 0x4f0df4ef
-0, 50400, 152064, 0xf6e0783c
-0, 54000, 152064, 0x417c8ca8
-0, 57600, 152064, 0xd33d29d8
-0, 61200, 152064, 0xc9723fa3
-0, 64800, 152064, 0x3e4f22f4
-0, 68400, 152064, 0xd5aa7bd8
-0, 72000, 152064, 0x2a425b54
-0, 75600, 152064, 0x2d400788
-0, 79200, 152064, 0x12fab3a4
-0, 82800, 152064, 0x5544f881
-0, 86400, 152064, 0xd0612cc5
-0, 90000, 152064, 0x157b3654
-0, 93600, 152064, 0x04b61fe0
-0, 97200, 152064, 0x897d600a
-0, 100800, 152064, 0x0d94fa29
-0, 104400, 152064, 0xc0fe249d
-0, 108000, 152064, 0x65abc1d6
-0, 111600, 152064, 0x2bd5f09d
-0, 115200, 152064, 0xd3eebd28
-0, 118800, 152064, 0x93458649
-0, 122400, 152064, 0x55e793a6
-0, 126000, 152064, 0x9fc378ce
-0, 129600, 152064, 0x24c32731
-0, 133200, 152064, 0x3c321c50
-0, 136800, 152064, 0xcef3ca8b
-0, 140400, 152064, 0x97116676
-0, 144000, 152064, 0x73ae78f6
-0, 147600, 152064, 0xdeec219e
-0, 151200, 152064, 0xc061d584
-0, 154800, 152064, 0xcf47f6c9
-0, 158400, 152064, 0x280d3a2d
-0, 162000, 152064, 0xb660c846
-0, 165600, 152064, 0xe167c588
-0, 169200, 152064, 0x08f808de
-0, 172800, 152064, 0x9de65c0b
-0, 176400, 152064, 0xc52a1937
-0, 180000, 152064, 0xf5a4d86f
-0, 183600, 152064, 0xbef86d37
-0, 187200, 152064, 0xa227b21b
-0, 190800, 152064, 0x0601ad35
-0, 194400, 152064, 0x15198730
-0, 198000, 152064, 0x9af764c6
-0, 201600, 152064, 0x1a95e99a
-0, 205200, 152064, 0x6bef5aa8
-0, 208800, 152064, 0x92f03267
-0, 212400, 152064, 0x0a3d56cb
-0, 216000, 152064, 0xd9c9f62e
-0, 219600, 152064, 0xcd81ea16
-0, 223200, 152064, 0x8ed789c0
-0, 226800, 152064, 0x5a5e356f
-0, 230400, 152064, 0x2f260ebf
-0, 234000, 152064, 0xa0379c89
-0, 237600, 152064, 0x100cb40c
-0, 241200, 152064, 0xaad2220a
-0, 244800, 152064, 0xec82aa8d
-0, 248400, 152064, 0x91088303
-0, 252000, 152064, 0x0cce0e9e
-0, 255600, 152064, 0xf3bc716a
-0, 259200, 152064, 0x989879c5
-0, 262800, 152064, 0x491297a0
-0, 266400, 152064, 0xdc16f30d
-0, 270000, 152064, 0xb9bfdd57
-0, 273600, 152064, 0x5fba59c2
-0, 277200, 152064, 0x89c40529
-0, 280800, 152064, 0x1b3e7b54
-0, 284400, 152064, 0x5d0d7903
-0, 288000, 152064, 0x2e3434e1
-0, 291600, 152064, 0x1f47a276
-0, 295200, 152064, 0xa22de2b1
-0, 298800, 152064, 0x77344844
-0, 302400, 152064, 0x6a6b3fce
-0, 306000, 152064, 0x82660651
-0, 309600, 152064, 0x51e67cc9
-0, 313200, 152064, 0xb790ae51
-0, 316800, 152064, 0x906bc6b6
-0, 320400, 152064, 0x55c5dc21
-0, 324000, 152064, 0xb51f3004
-0, 327600, 152064, 0x68500a25
-0, 331200, 152064, 0x5dbc812e
-0, 334800, 152064, 0x895eb6ed
-0, 338400, 152064, 0x2f5594fc
-0, 342000, 152064, 0x04a222a9
-0, 345600, 152064, 0x90036f6a
-0, 349200, 152064, 0x8b8b064c
-0, 352800, 152064, 0xd47c7334
-0, 356400, 152064, 0x13f06213
diff --git a/tests/ref/fate/h264-conformance-frext-brcm_freh3 b/tests/ref/fate/h264-conformance-frext-brcm_freh3
deleted file mode 100644
index 4a56710..0000000
--- a/tests/ref/fate/h264-conformance-frext-brcm_freh3
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x9f9caf3c
-0, 3600, 152064, 0x4e8e9dc4
-0, 7200, 152064, 0x7eab62be
-0, 10800, 152064, 0x79de6e48
-0, 14400, 152064, 0x6bb843f3
-0, 18000, 152064, 0xd0e96c36
-0, 21600, 152064, 0x061a9036
-0, 25200, 152064, 0x342c42ea
-0, 28800, 152064, 0x9835cfc3
-0, 32400, 152064, 0x129ed3dd
-0, 36000, 152064, 0x81413cf7
-0, 39600, 152064, 0xcd16539e
-0, 43200, 152064, 0x927728cd
-0, 46800, 152064, 0x5ebd1126
-0, 50400, 152064, 0x9ad29eb3
-0, 54000, 152064, 0x0ae5a447
-0, 57600, 152064, 0xaf275266
-0, 61200, 152064, 0x98f96209
-0, 64800, 152064, 0x5fcf241f
-0, 68400, 152064, 0x17507ee5
-0, 72000, 152064, 0xb4ad5f2d
-0, 75600, 152064, 0x02fff6da
-0, 79200, 152064, 0x8726c662
-0, 82800, 152064, 0x8ca707d5
-0, 86400, 152064, 0xe41f3946
-0, 90000, 152064, 0xc7b34d1e
-0, 93600, 152064, 0x25146571
-0, 97200, 152064, 0xeb4868f4
-0, 100800, 152064, 0xd0fe149d
-0, 104400, 152064, 0x31043d0a
-0, 108000, 152064, 0xdaf2ba1c
-0, 111600, 152064, 0xb474076c
-0, 115200, 152064, 0x0cf7f1a2
-0, 118800, 152064, 0x2e427793
-0, 122400, 152064, 0x08d9a655
-0, 126000, 152064, 0x79bc8fc9
-0, 129600, 152064, 0xb9871e5c
-0, 133200, 152064, 0xca1246df
-0, 136800, 152064, 0x08c8d524
-0, 140400, 152064, 0xb9be5ecb
-0, 144000, 152064, 0x807f87f0
-0, 147600, 152064, 0x72eb3ab2
-0, 151200, 152064, 0xf463d15f
-0, 154800, 152064, 0x857d0471
-0, 158400, 152064, 0x5dda5ede
-0, 162000, 152064, 0xec33b550
-0, 165600, 152064, 0x2217b9bb
-0, 169200, 152064, 0x060b0fa4
-0, 172800, 152064, 0x5a785b49
-0, 176400, 152064, 0x6969268b
-0, 180000, 152064, 0xe145d3a4
-0, 183600, 152064, 0xb7256e99
-0, 187200, 152064, 0x5bbebf16
-0, 190800, 152064, 0x9234b31e
-0, 194400, 152064, 0x9f0f8c7e
-0, 198000, 152064, 0x15e271c4
-0, 201600, 152064, 0xe8110297
-0, 205200, 152064, 0x1a4364f3
-0, 208800, 152064, 0xb7b336f8
-0, 212400, 152064, 0x31657acb
-0, 216000, 152064, 0xd8e1de00
-0, 219600, 152064, 0x9a57117a
-0, 223200, 152064, 0xfb828be8
-0, 226800, 152064, 0x30bf2ab7
-0, 230400, 152064, 0xaf840b27
-0, 234000, 152064, 0x900cbcd4
-0, 237600, 152064, 0x6439acfc
-0, 241200, 152064, 0x716036fd
-0, 244800, 152064, 0xc3d9baa8
-0, 248400, 152064, 0x455f7d1f
-0, 252000, 152064, 0x84c10d78
-0, 255600, 152064, 0x2cd76642
-0, 259200, 152064, 0x5c746b3a
-0, 262800, 152064, 0x92e39e7d
-0, 266400, 152064, 0xae610df8
-0, 270000, 152064, 0xc8bac3fa
-0, 273600, 152064, 0x04be8a35
-0, 277200, 152064, 0xaaf91b17
-0, 280800, 152064, 0x5afa8764
-0, 284400, 152064, 0x31828a12
-0, 288000, 152064, 0xf1bd3da9
-0, 291600, 152064, 0xbbb2aaef
-0, 295200, 152064, 0xcf69efa1
-0, 298800, 152064, 0x54e85e1b
-0, 302400, 152064, 0x89ff3a1a
-0, 306000, 152064, 0x86c80511
-0, 309600, 152064, 0x41c886f2
-0, 313200, 152064, 0x9f2ebd74
-0, 316800, 152064, 0x74d3d0e0
-0, 320400, 152064, 0xc79501cc
-0, 324000, 152064, 0x123e23e2
-0, 327600, 152064, 0xb6122ea0
-0, 331200, 152064, 0x551f95df
-0, 334800, 152064, 0x0652ac2d
-0, 338400, 152064, 0x6483a8ad
-0, 342000, 152064, 0x7f632ae2
-0, 345600, 152064, 0xae74622f
-0, 349200, 152064, 0xdd411339
-0, 352800, 152064, 0xff0e7f69
-0, 356400, 152064, 0x8b3a5933
diff --git a/tests/ref/fate/h264-conformance-frext-brcm_freh4 b/tests/ref/fate/h264-conformance-frext-brcm_freh4
deleted file mode 100644
index 8f0305a..0000000
--- a/tests/ref/fate/h264-conformance-frext-brcm_freh4
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x9744ac59
-0, 3600, 152064, 0xe1c69d97
-0, 7200, 152064, 0x9ae85f93
-0, 10800, 152064, 0x452966a3
-0, 14400, 152064, 0xe8192823
-0, 18000, 152064, 0x58b764eb
-0, 21600, 152064, 0x51b686b1
-0, 25200, 152064, 0x4bca5822
-0, 28800, 152064, 0x29abc41c
-0, 32400, 152064, 0x850ec94f
-0, 36000, 152064, 0xac2c34f8
-0, 39600, 152064, 0x080c6e67
-0, 43200, 152064, 0x5e4e14d2
-0, 46800, 152064, 0x978b054c
-0, 50400, 152064, 0x861d8c3c
-0, 54000, 152064, 0xe0818918
-0, 57600, 152064, 0x8b834511
-0, 61200, 152064, 0x223f567c
-0, 64800, 152064, 0x6d61298d
-0, 68400, 152064, 0xfe30826e
-0, 72000, 152064, 0x4bad4f98
-0, 75600, 152064, 0x69d5fdca
-0, 79200, 152064, 0xe45bba1b
-0, 82800, 152064, 0xa6d81298
-0, 86400, 152064, 0x7f3f2c91
-0, 90000, 152064, 0x658754b9
-0, 93600, 152064, 0x2c6d3eba
-0, 97200, 152064, 0x4500600c
-0, 100800, 152064, 0xa745f74b
-0, 104400, 152064, 0x2bf21fca
-0, 108000, 152064, 0x08b8bdb3
-0, 111600, 152064, 0x5a9d0a8b
-0, 115200, 152064, 0x3a57d523
-0, 118800, 152064, 0x3606826e
-0, 122400, 152064, 0x3b91a8fb
-0, 126000, 152064, 0x37c28959
-0, 129600, 152064, 0xb51d1e75
-0, 133200, 152064, 0x13be3f58
-0, 136800, 152064, 0x0ed0e7cf
-0, 140400, 152064, 0x298560d4
-0, 144000, 152064, 0x62b68373
-0, 147600, 152064, 0xf8bb4520
-0, 151200, 152064, 0x90dfd6af
-0, 154800, 152064, 0xf4770d20
-0, 158400, 152064, 0x0d9549a0
-0, 162000, 152064, 0x004eccb1
-0, 165600, 152064, 0x3146d46b
-0, 169200, 152064, 0x078d1808
-0, 172800, 152064, 0x5d8d60cd
-0, 176400, 152064, 0x8ff52dd8
-0, 180000, 152064, 0x5aa3ccf7
-0, 183600, 152064, 0x5bec6c39
-0, 187200, 152064, 0xd44cae9d
-0, 190800, 152064, 0xa1b0a151
-0, 194400, 152064, 0xe3be7bb2
-0, 198000, 152064, 0x50096775
-0, 201600, 152064, 0xdffff851
-0, 205200, 152064, 0x1d7250eb
-0, 208800, 152064, 0x69663ca7
-0, 212400, 152064, 0x62f77fc7
-0, 216000, 152064, 0xbab8f471
-0, 219600, 152064, 0x6af31785
-0, 223200, 152064, 0xcbb2a9aa
-0, 226800, 152064, 0xc57c32b9
-0, 230400, 152064, 0xecbe2ce0
-0, 234000, 152064, 0x2fbebf81
-0, 237600, 152064, 0xa168af68
-0, 241200, 152064, 0x1e5631ac
-0, 244800, 152064, 0xe69fc927
-0, 248400, 152064, 0x8e5c81d8
-0, 252000, 152064, 0x42402010
-0, 255600, 152064, 0xd7267482
-0, 259200, 152064, 0x64b280df
-0, 262800, 152064, 0xc4cbafcc
-0, 266400, 152064, 0xcf2f1e8b
-0, 270000, 152064, 0x4d6fdb3f
-0, 273600, 152064, 0xf22d6fed
-0, 277200, 152064, 0x625b167c
-0, 280800, 152064, 0x41348089
-0, 284400, 152064, 0x6db2779b
-0, 288000, 152064, 0xe87030a8
-0, 291600, 152064, 0x91b29cdd
-0, 295200, 152064, 0xe824f242
-0, 298800, 152064, 0xac995380
-0, 302400, 152064, 0x7efe361b
-0, 306000, 152064, 0xe10c0c26
-0, 309600, 152064, 0x93108260
-0, 313200, 152064, 0xbf4caed7
-0, 316800, 152064, 0xb6a4d826
-0, 320400, 152064, 0x78beea4e
-0, 324000, 152064, 0xdf612df9
-0, 327600, 152064, 0xa9ef2830
-0, 331200, 152064, 0x06448895
-0, 334800, 152064, 0x332eb6d5
-0, 338400, 152064, 0x935ba2c5
-0, 342000, 152064, 0x62a22656
-0, 345600, 152064, 0x06a670a7
-0, 349200, 152064, 0xf60b1af0
-0, 352800, 152064, 0x85177c10
-0, 356400, 152064, 0x5e4e5c4b
diff --git a/tests/ref/fate/h264-conformance-frext-brcm_freh5 b/tests/ref/fate/h264-conformance-frext-brcm_freh5
deleted file mode 100644
index dc7efef..0000000
--- a/tests/ref/fate/h264-conformance-frext-brcm_freh5
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0xd816ae9a
-0, 3600, 152064, 0x970e9c33
-0, 7200, 152064, 0xbdd14635
-0, 10800, 152064, 0x103f667c
-0, 14400, 152064, 0x752b1ebb
-0, 18000, 152064, 0x1e9d59d4
-0, 21600, 152064, 0x4b9d89b6
-0, 25200, 152064, 0x16c1362e
-0, 28800, 152064, 0x3ea9a977
-0, 32400, 152064, 0x24e3c7fe
-0, 36000, 152064, 0xe64132fa
-0, 39600, 152064, 0xb2074e31
-0, 43200, 152064, 0x87e61824
-0, 46800, 152064, 0xf3e7f2d3
-0, 50400, 152064, 0x36856b98
-0, 54000, 152064, 0xe2be97dd
-0, 57600, 152064, 0xb99a3a3d
-0, 61200, 152064, 0xf4d04afa
-0, 64800, 152064, 0x20a92205
-0, 68400, 152064, 0x5f6272ca
-0, 72000, 152064, 0xe1f45d11
-0, 75600, 152064, 0x7ff113ee
-0, 79200, 152064, 0x47e8befb
-0, 82800, 152064, 0x562c03c6
-0, 86400, 152064, 0x197a311c
-0, 90000, 152064, 0x30017402
-0, 93600, 152064, 0x27e6384e
-0, 97200, 152064, 0x456f6152
-0, 100800, 152064, 0x368810d1
-0, 104400, 152064, 0x7be61b5f
-0, 108000, 152064, 0x5fa9aaef
-0, 111600, 152064, 0x957de9da
-0, 115200, 152064, 0x47c6bc4f
-0, 118800, 152064, 0xb2247b98
-0, 122400, 152064, 0xd045a416
-0, 126000, 152064, 0xa0b16da9
-0, 129600, 152064, 0xe9bd1d8f
-0, 133200, 152064, 0xe7881f4d
-0, 136800, 152064, 0x85e2d4a9
-0, 140400, 152064, 0x00a967cd
-0, 144000, 152064, 0x02507278
-0, 147600, 152064, 0xc511370e
-0, 151200, 152064, 0x7963cf0b
-0, 154800, 152064, 0xf99ef0fd
-0, 158400, 152064, 0x00813540
-0, 162000, 152064, 0xa9aeaf2b
-0, 165600, 152064, 0x559eb849
-0, 169200, 152064, 0x315605c1
-0, 172800, 152064, 0xe2594b7c
-0, 176400, 152064, 0x844ef85c
-0, 180000, 152064, 0x5012c785
-0, 183600, 152064, 0x239f600d
-0, 187200, 152064, 0x80a2a156
-0, 190800, 152064, 0xec239895
-0, 194400, 152064, 0xd7387dbe
-0, 198000, 152064, 0xe8aa6125
-0, 201600, 152064, 0x4742d997
-0, 205200, 152064, 0x88515422
-0, 208800, 152064, 0x3dd02167
-0, 212400, 152064, 0xe36855d1
-0, 216000, 152064, 0x202edeb9
-0, 219600, 152064, 0xf5a5eed3
-0, 223200, 152064, 0xd3bc6e68
-0, 226800, 152064, 0xba902a0a
-0, 230400, 152064, 0x4db4f721
-0, 234000, 152064, 0x293c90bd
-0, 237600, 152064, 0xa651a49f
-0, 241200, 152064, 0x5c1a2a7d
-0, 244800, 152064, 0xa67986de
-0, 248400, 152064, 0xe5fe7d26
-0, 252000, 152064, 0xde191b31
-0, 255600, 152064, 0x5e303cb1
-0, 259200, 152064, 0x657f6d5d
-0, 262800, 152064, 0x5c44adaa
-0, 266400, 152064, 0x8c3c0422
-0, 270000, 152064, 0x161cb54f
-0, 273600, 152064, 0xc96355c8
-0, 277200, 152064, 0xeb02fdec
-0, 280800, 152064, 0xd18a7989
-0, 284400, 152064, 0xc7d671bf
-0, 288000, 152064, 0x2e1637cc
-0, 291600, 152064, 0xd0d5958a
-0, 295200, 152064, 0x2f9dd79c
-0, 298800, 152064, 0xa96b4dd1
-0, 302400, 152064, 0x7bfc2eb9
-0, 306000, 152064, 0xc3c91809
-0, 309600, 152064, 0x9e167aa3
-0, 313200, 152064, 0xb47e9f6e
-0, 316800, 152064, 0x70e6c184
-0, 320400, 152064, 0x0d92e4e7
-0, 324000, 152064, 0xf4891b11
-0, 327600, 152064, 0x93f912c7
-0, 331200, 152064, 0xa3bc52c5
-0, 334800, 152064, 0xc6fca440
-0, 338400, 152064, 0x045aa5d4
-0, 342000, 152064, 0x15ba1dd0
-0, 345600, 152064, 0x59f45a8b
-0, 349200, 152064, 0x9dc20832
-0, 352800, 152064, 0x36316eb4
-0, 356400, 152064, 0x28ba54f4
diff --git a/tests/ref/fate/h264-conformance-frext-brcm_freh8 b/tests/ref/fate/h264-conformance-frext-brcm_freh8
deleted file mode 100644
index 69a55e1..0000000
--- a/tests/ref/fate/h264-conformance-frext-brcm_freh8
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0xdcc4ac76
-0, 3600, 152064, 0xfde6871a
-0, 7200, 152064, 0xe8a351b5
-0, 10800, 152064, 0x0e586608
-0, 14400, 152064, 0xbe3c2adc
-0, 18000, 152064, 0x244a5b3c
-0, 21600, 152064, 0x7cad919e
-0, 25200, 152064, 0x24c452c0
-0, 28800, 152064, 0x089dc7f0
-0, 32400, 152064, 0x6ee5d1dd
-0, 36000, 152064, 0x177430f0
-0, 39600, 152064, 0xf2af65f6
-0, 43200, 152064, 0x4c4626a7
-0, 46800, 152064, 0x897af1da
-0, 50400, 152064, 0xf16199b1
-0, 54000, 152064, 0x2979a469
-0, 57600, 152064, 0x5ce345a0
-0, 61200, 152064, 0x1a044ff3
-0, 64800, 152064, 0x9075241f
-0, 68400, 152064, 0xd1457558
-0, 72000, 152064, 0xdfe3669f
-0, 75600, 152064, 0x4961fc7a
-0, 79200, 152064, 0xb84daee5
-0, 82800, 152064, 0xc4efe5c3
-0, 86400, 152064, 0x35f73410
-0, 90000, 152064, 0xf99a2c73
-0, 93600, 152064, 0xe5c12391
-0, 97200, 152064, 0xc2056236
-0, 100800, 152064, 0xce2bff90
-0, 104400, 152064, 0x01d92bb1
-0, 108000, 152064, 0xc55eb558
-0, 111600, 152064, 0xf02ef0ff
-0, 115200, 152064, 0x069dd1c6
-0, 118800, 152064, 0x49718229
-0, 122400, 152064, 0x0e9ea401
-0, 126000, 152064, 0x307e7f8b
-0, 129600, 152064, 0xf5071e31
-0, 133200, 152064, 0xac2c2ad0
-0, 136800, 152064, 0x5586d665
-0, 140400, 152064, 0xa62a6a2b
-0, 144000, 152064, 0xff167d1b
-0, 147600, 152064, 0x02d225c2
-0, 151200, 152064, 0x868ccb0b
-0, 154800, 152064, 0x36edfa29
-0, 158400, 152064, 0xb6244864
-0, 162000, 152064, 0xd891b5dc
-0, 165600, 152064, 0x9246b763
-0, 169200, 152064, 0xea240b61
-0, 172800, 152064, 0x2d985877
-0, 176400, 152064, 0xe6b92603
-0, 180000, 152064, 0x102ac84f
-0, 183600, 152064, 0xddaf709b
-0, 187200, 152064, 0x48dfb25e
-0, 190800, 152064, 0xf2acadbb
-0, 194400, 152064, 0x647685f5
-0, 198000, 152064, 0x893874c9
-0, 201600, 152064, 0xdfd7ed77
-0, 205200, 152064, 0x97b36277
-0, 208800, 152064, 0x59f33282
-0, 212400, 152064, 0xba5c6a0e
-0, 216000, 152064, 0x7856ddf0
-0, 219600, 152064, 0x74e5f095
-0, 223200, 152064, 0x76167a60
-0, 226800, 152064, 0xa6cf2255
-0, 230400, 152064, 0x9f8b1446
-0, 234000, 152064, 0xa775aa79
-0, 237600, 152064, 0x5662a698
-0, 241200, 152064, 0xe6321e5b
-0, 244800, 152064, 0xdaea9a83
-0, 248400, 152064, 0xd89d835f
-0, 252000, 152064, 0x0b1503e2
-0, 255600, 152064, 0x7fef6395
-0, 259200, 152064, 0xc27273f2
-0, 262800, 152064, 0xff9288fd
-0, 266400, 152064, 0xb76aee35
-0, 270000, 152064, 0xbd0dc4b2
-0, 273600, 152064, 0x3085598e
-0, 277200, 152064, 0x22e408f6
-0, 280800, 152064, 0xc054866d
-0, 284400, 152064, 0x881377f8
-0, 288000, 152064, 0x0dd7311e
-0, 291600, 152064, 0x627ea688
-0, 295200, 152064, 0x95bbe693
-0, 298800, 152064, 0x806c480f
-0, 302400, 152064, 0x6feb3d47
-0, 306000, 152064, 0x639f0a72
-0, 309600, 152064, 0x4922909d
-0, 313200, 152064, 0x44bbc195
-0, 316800, 152064, 0xf119ca8f
-0, 320400, 152064, 0x6f46e9c8
-0, 324000, 152064, 0xd68e222a
-0, 327600, 152064, 0xedc716eb
-0, 331200, 152064, 0x090a7702
-0, 334800, 152064, 0xc94eac7a
-0, 338400, 152064, 0x629d8823
-0, 342000, 152064, 0x30a51f8c
-0, 345600, 152064, 0x4265666b
-0, 349200, 152064, 0x766dfd25
-0, 352800, 152064, 0x7dc37c52
-0, 356400, 152064, 0x07c65fbe
diff --git a/tests/ref/fate/h264-conformance-frext-brcm_freh9 b/tests/ref/fate/h264-conformance-frext-brcm_freh9
deleted file mode 100644
index 5b21b7f..0000000
--- a/tests/ref/fate/h264-conformance-frext-brcm_freh9
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x9f9caf3c
-0, 3600, 152064, 0x68f285b1
-0, 7200, 152064, 0x28bd4987
-0, 10800, 152064, 0x79de6e48
-0, 14400, 152064, 0x48301bf9
-0, 18000, 152064, 0x2c9e516c
-0, 21600, 152064, 0xf774946a
-0, 25200, 152064, 0x36534317
-0, 28800, 152064, 0x98b7bd86
-0, 32400, 152064, 0x2aa3d50b
-0, 36000, 152064, 0xc4343429
-0, 39600, 152064, 0x276c5f04
-0, 43200, 152064, 0x042d2916
-0, 46800, 152064, 0x777ee739
-0, 50400, 152064, 0x1ce186d8
-0, 54000, 152064, 0x0ae5a447
-0, 57600, 152064, 0x179435a8
-0, 61200, 152064, 0x96d743b8
-0, 64800, 152064, 0x7dcc26b7
-0, 68400, 152064, 0x72c860c8
-0, 72000, 152064, 0x12a95052
-0, 75600, 152064, 0x1ed00304
-0, 79200, 152064, 0xf9f698be
-0, 82800, 152064, 0x768ef04d
-0, 86400, 152064, 0x873833ee
-0, 90000, 152064, 0x1b4a1e1e
-0, 93600, 152064, 0x67462224
-0, 97200, 152064, 0x0206612a
-0, 100800, 152064, 0xd203f197
-0, 104400, 152064, 0x5dc020b0
-0, 108000, 152064, 0xdaf2ba1c
-0, 111600, 152064, 0xad54e4b2
-0, 115200, 152064, 0x4273c281
-0, 118800, 152064, 0x0655817d
-0, 122400, 152064, 0xdea79e1c
-0, 126000, 152064, 0x60ae6d1e
-0, 129600, 152064, 0x45401d1b
-0, 133200, 152064, 0xc6b12160
-0, 136800, 152064, 0x163fbde9
-0, 140400, 152064, 0x91636a0c
-0, 144000, 152064, 0x442173a4
-0, 147600, 152064, 0x0f941379
-0, 151200, 152064, 0x0649caad
-0, 154800, 152064, 0x1238eaa4
-0, 158400, 152064, 0x86013d55
-0, 162000, 152064, 0xec33b550
-0, 165600, 152064, 0x4cc7b33d
-0, 169200, 152064, 0x4c93f8ab
-0, 172800, 152064, 0x0cf15a34
-0, 176400, 152064, 0x04b71770
-0, 180000, 152064, 0xf860cea8
-0, 183600, 152064, 0x77fb76a3
-0, 187200, 152064, 0xa494b27c
-0, 190800, 152064, 0xf7a0b0b2
-0, 194400, 152064, 0x4cae843b
-0, 198000, 152064, 0x590e6403
-0, 201600, 152064, 0xe439e63e
-0, 205200, 152064, 0xbeca5f92
-0, 208800, 152064, 0x31d9164f
-0, 212400, 152064, 0xedab54a9
-0, 216000, 152064, 0xd8e1de00
-0, 219600, 152064, 0xd04fe391
-0, 223200, 152064, 0xef6568b3
-0, 226800, 152064, 0x859a2811
-0, 230400, 152064, 0x9d5ffe6f
-0, 234000, 152064, 0x5a679908
-0, 237600, 152064, 0xc264a830
-0, 241200, 152064, 0xbfdf08c0
-0, 244800, 152064, 0x4fd68cb7
-0, 248400, 152064, 0x0a7b86f3
-0, 252000, 152064, 0xe4fe043b
-0, 255600, 152064, 0x8b186a22
-0, 259200, 152064, 0xf715765a
-0, 262800, 152064, 0xfd7b77e5
-0, 266400, 152064, 0x9e3fdd06
-0, 270000, 152064, 0xc8bac3fa
-0, 273600, 152064, 0x4e83449f
-0, 277200, 152064, 0xe5fefcff
-0, 280800, 152064, 0x89d77b09
-0, 284400, 152064, 0x77fd6f7e
-0, 288000, 152064, 0xa7ec356c
-0, 291600, 152064, 0x2000aa87
-0, 295200, 152064, 0xa9a1e267
-0, 298800, 152064, 0xf67c3fcc
-0, 302400, 152064, 0x10143acc
-0, 306000, 152064, 0xa5fa0476
-0, 309600, 152064, 0x2e8d8966
-0, 313200, 152064, 0x74ccbbde
-0, 316800, 152064, 0xf903b2cf
-0, 320400, 152064, 0x66a8d7ab
-0, 324000, 152064, 0x123e23e2
-0, 327600, 152064, 0x8bd70865
-0, 331200, 152064, 0x2b017249
-0, 334800, 152064, 0x17f1aba6
-0, 338400, 152064, 0x38368449
-0, 342000, 152064, 0x72ee1b69
-0, 345600, 152064, 0x0f1c6a1d
-0, 349200, 152064, 0xbeea0040
-0, 352800, 152064, 0x4a9e73b9
-0, 356400, 152064, 0x51a46120
diff --git a/tests/ref/fate/h264-conformance-frext-freh12_b b/tests/ref/fate/h264-conformance-frext-freh12_b
deleted file mode 100644
index 12c1959..0000000
--- a/tests/ref/fate/h264-conformance-frext-freh12_b
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x9f9caf3c
-0, 3600, 152064, 0x0ff688a6
-0, 7200, 152064, 0x247d4215
-0, 10800, 152064, 0x6d075b1b
-0, 14400, 152064, 0x23893f77
-0, 18000, 152064, 0x46db7dfc
-0, 21600, 152064, 0x6438c4b9
-0, 25200, 152064, 0x1f468257
-0, 28800, 152064, 0xd534ff36
-0, 32400, 152064, 0xb230f7b8
-0, 36000, 152064, 0xd8f66983
-0, 39600, 152064, 0x2068b7a9
-0, 43200, 152064, 0xd5748d8c
-0, 46800, 152064, 0x1d701770
-0, 50400, 152064, 0xe505c973
-0, 54000, 152064, 0x0ae5a447
-0, 57600, 152064, 0x3cf356bc
-0, 61200, 152064, 0x7d735625
-0, 64800, 152064, 0x3ce6438f
-0, 68400, 152064, 0xef3d947c
-0, 72000, 152064, 0xa35872be
-0, 75600, 152064, 0xcb9d1a37
-0, 79200, 152064, 0x9ad4cda1
-0, 82800, 152064, 0xc8d00a24
-0, 86400, 152064, 0xadab390b
-0, 90000, 152064, 0x530837a5
-0, 93600, 152064, 0xfda73274
-0, 97200, 152064, 0x7a297022
-0, 100800, 152064, 0x0d5f16a1
-0, 104400, 152064, 0xb0453e15
-0, 108000, 152064, 0xdaf2ba1c
-0, 111600, 152064, 0x55e5f451
-0, 115200, 152064, 0x723ecbce
-0, 118800, 152064, 0xb8376dfa
-0, 122400, 152064, 0xf53d97b7
-0, 126000, 152064, 0x1e2065cb
-0, 129600, 152064, 0x79ab0d75
-0, 133200, 152064, 0xc5da27ed
-0, 136800, 152064, 0x37c9d744
-0, 140400, 152064, 0xa8ab8bc3
-0, 144000, 152064, 0xab16a630
-0, 147600, 152064, 0xbbd76705
-0, 151200, 152064, 0xe67b2032
-0, 154800, 152064, 0xe1e02979
-0, 158400, 152064, 0xe79260b2
-0, 162000, 152064, 0xec33b550
-0, 165600, 152064, 0x679cca25
-0, 169200, 152064, 0x464b0935
-0, 172800, 152064, 0xa4c36a2a
-0, 176400, 152064, 0xe9593764
-0, 180000, 152064, 0x10f9ff42
-0, 183600, 152064, 0x6518a6fa
-0, 187200, 152064, 0xd161e4f3
-0, 190800, 152064, 0xc9d9be11
-0, 194400, 152064, 0x0db78ff6
-0, 198000, 152064, 0xd47d7e0f
-0, 201600, 152064, 0xdf34e3a3
-0, 205200, 152064, 0x13b68bd6
-0, 208800, 152064, 0x90e845bd
-0, 212400, 152064, 0xb434883a
-0, 216000, 152064, 0xd8e1de00
-0, 219600, 152064, 0xc9a3df1f
-0, 223200, 152064, 0x01476f54
-0, 226800, 152064, 0xd52824a4
-0, 230400, 152064, 0x63d43662
-0, 234000, 152064, 0x40a90d0f
-0, 237600, 152064, 0x332b22eb
-0, 241200, 152064, 0x1c267e8c
-0, 244800, 152064, 0x9be230d3
-0, 248400, 152064, 0x0ca308e8
-0, 252000, 152064, 0xfb5c5fdd
-0, 255600, 152064, 0x0d386358
-0, 259200, 152064, 0x3c7148b3
-0, 262800, 152064, 0xc2c07dab
-0, 266400, 152064, 0x76bbf8eb
-0, 270000, 152064, 0xc8bac3fa
-0, 273600, 152064, 0x35ef5e12
-0, 277200, 152064, 0x5d1fea8d
-0, 280800, 152064, 0xafbb54ef
-0, 284400, 152064, 0xf5d3396e
-0, 288000, 152064, 0xc4f4f8eb
-0, 291600, 152064, 0x60a17fa1
-0, 295200, 152064, 0x8804cdf9
-0, 298800, 152064, 0x3227412f
-0, 302400, 152064, 0x130e5026
-0, 306000, 152064, 0xcb17344e
-0, 309600, 152064, 0x4f0dde70
-0, 313200, 152064, 0x57422405
-0, 316800, 152064, 0x48070e40
-0, 320400, 152064, 0x5c2f134d
-0, 324000, 152064, 0x123e23e2
-0, 327600, 152064, 0x393c1185
-0, 331200, 152064, 0x59919a69
-0, 334800, 152064, 0xc1dad5c4
-0, 338400, 152064, 0x49b8c9a9
-0, 342000, 152064, 0x8dab7b1c
-0, 345600, 152064, 0x3a63c0c0
-0, 349200, 152064, 0x224860bc
-0, 352800, 152064, 0xdc40c9b2
-0, 356400, 152064, 0xd3a0b8a1
diff --git a/tests/ref/fate/h264-conformance-frext-freh1_b b/tests/ref/fate/h264-conformance-frext-freh1_b
deleted file mode 100644
index 4e35e13..0000000
--- a/tests/ref/fate/h264-conformance-frext-freh1_b
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x42a3d9ce
-0, 3600, 152064, 0xa95cc2ed
-0, 7200, 152064, 0xc48f8fdc
-0, 10800, 152064, 0x1584b7e8
-0, 14400, 152064, 0xd6f34b7e
-0, 18000, 152064, 0xbb196ee4
-0, 21600, 152064, 0xdfe79cbd
-0, 25200, 152064, 0x023799b7
-0, 28800, 152064, 0x156b1932
-0, 32400, 152064, 0x6dd14765
-0, 36000, 152064, 0xd2bd86b9
-0, 39600, 152064, 0xee62c71d
-0, 43200, 152064, 0x60667d48
-0, 46800, 152064, 0x09df084c
-0, 50400, 152064, 0xc1a0b8d7
-0, 54000, 152064, 0x55adc538
-0, 57600, 152064, 0xf6d28a14
-0, 61200, 152064, 0x1adab322
-0, 64800, 152064, 0xa6c796aa
-0, 68400, 152064, 0x60d8dc6a
-0, 72000, 152064, 0x20f9c609
-0, 75600, 152064, 0x299f4059
-0, 79200, 152064, 0x93eb0fea
-0, 82800, 152064, 0x76e7547e
-0, 86400, 152064, 0xc4b76f90
-0, 90000, 152064, 0x4b7a85ea
-0, 93600, 152064, 0x2e138df4
-0, 97200, 152064, 0x7df1a421
-0, 100800, 152064, 0x0e9a1a3e
-0, 104400, 152064, 0x56124293
-0, 108000, 152064, 0x1faee8f7
-0, 111600, 152064, 0x7f551572
-0, 115200, 152064, 0x8974cbf0
-0, 118800, 152064, 0x1c5dc5e9
-0, 122400, 152064, 0x2498eb5b
-0, 126000, 152064, 0x861ed634
-0, 129600, 152064, 0x0e62a433
-0, 133200, 152064, 0xf3648cc0
-0, 136800, 152064, 0x69bc344b
-0, 140400, 152064, 0x797eaafe
-0, 144000, 152064, 0x722fbff8
-0, 147600, 152064, 0xa8895582
-0, 151200, 152064, 0xde1bcffb
-0, 154800, 152064, 0xf558ed3f
-0, 158400, 152064, 0xa5173e0e
-0, 162000, 152064, 0x6872d018
-0, 165600, 152064, 0x6af6c55d
-0, 169200, 152064, 0x7c6b1f26
-0, 172800, 152064, 0xa8086db3
-0, 176400, 152064, 0x70b762e1
-0, 180000, 152064, 0x85b7eb76
-0, 183600, 152064, 0x3a4393f1
-0, 187200, 152064, 0xdabdda42
-0, 190800, 152064, 0xbb84b84c
-0, 194400, 152064, 0xabe880d8
-0, 198000, 152064, 0xe7303cc5
-0, 201600, 152064, 0xecdcc142
-0, 205200, 152064, 0x591118db
-0, 208800, 152064, 0x37a715c6
-0, 212400, 152064, 0x9106221e
-0, 216000, 152064, 0xb1821a2e
-0, 219600, 152064, 0x3adeccdb
-0, 223200, 152064, 0xd4ac64a8
-0, 226800, 152064, 0x8f34134f
-0, 230400, 152064, 0x1f3cf03d
-0, 234000, 152064, 0x7b5da3b0
-0, 237600, 152064, 0x23f69e68
-0, 241200, 152064, 0x67e62093
-0, 244800, 152064, 0xf226d12e
-0, 248400, 152064, 0x2eb08a1f
-0, 252000, 152064, 0x5bb70c54
-0, 255600, 152064, 0x2edb3578
-0, 259200, 152064, 0x9d0c1b30
-0, 262800, 152064, 0xd8266732
-0, 266400, 152064, 0xad67cd45
-0, 270000, 152064, 0x7a11d3cc
-0, 273600, 152064, 0xac534ec1
-0, 277200, 152064, 0x7ff6ba17
-0, 280800, 152064, 0xf9741b77
-0, 284400, 152064, 0x318d25fa
-0, 288000, 152064, 0xff4ae686
-0, 291600, 152064, 0x26a05ae2
-0, 295200, 152064, 0x95619a34
-0, 298800, 152064, 0xec2b1136
-0, 302400, 152064, 0xf93ebeca
-0, 306000, 152064, 0xd8237aaa
-0, 309600, 152064, 0x1c362a05
-0, 313200, 152064, 0x6fc74faa
-0, 316800, 152064, 0x875e5b67
-0, 320400, 152064, 0xc04093be
-0, 324000, 152064, 0x4c2340a1
-0, 327600, 152064, 0x7af99e63
-0, 331200, 152064, 0xf5b89a4e
-0, 334800, 152064, 0xb7759e48
-0, 338400, 152064, 0x61a15c06
-0, 342000, 152064, 0x91a5ae4c
-0, 345600, 152064, 0x6aedf226
-0, 349200, 152064, 0x870dbf36
-0, 352800, 152064, 0x814d04a3
-0, 356400, 152064, 0xd5a30892
diff --git a/tests/ref/fate/h264-conformance-frext-freh2_b b/tests/ref/fate/h264-conformance-frext-freh2_b
deleted file mode 100644
index ac9a48c..0000000
--- a/tests/ref/fate/h264-conformance-frext-freh2_b
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x1668b41a
-0, 3600, 152064, 0x953ca7fb
-0, 7200, 152064, 0x3e38bc6e
-0, 10800, 152064, 0x18dff6cc
-0, 14400, 152064, 0x03105f7a
-0, 18000, 152064, 0x6fe79efb
-0, 21600, 152064, 0xbd4ccb6f
-0, 25200, 152064, 0xaf398a10
-0, 28800, 152064, 0x4f281075
-0, 32400, 152064, 0x88f63791
-0, 36000, 152064, 0x7500b606
-0, 39600, 152064, 0xebebd6e6
-0, 43200, 152064, 0x3ed7c35e
-0, 46800, 152064, 0xc95826d6
-0, 50400, 152064, 0x0989ab63
-0, 54000, 152064, 0xddd5d22b
-0, 57600, 152064, 0x11683b8a
-0, 61200, 152064, 0x5ce36d50
-0, 64800, 152064, 0xa5185ccf
-0, 68400, 152064, 0xf47583b5
-0, 72000, 152064, 0xac6e82b6
-0, 75600, 152064, 0xf8dc25c0
-0, 79200, 152064, 0x5a6aba8e
-0, 82800, 152064, 0x43790f6d
-0, 86400, 152064, 0x787c4377
-0, 90000, 152064, 0xe6833159
-0, 93600, 152064, 0xe5c21131
-0, 97200, 152064, 0x16ae69bb
-0, 100800, 152064, 0x754fcc9e
-0, 104400, 152064, 0x71aaf1e1
-0, 108000, 152064, 0xce9de9ee
-0, 111600, 152064, 0x05e6d832
-0, 115200, 152064, 0x5773b413
-0, 118800, 152064, 0xe518881c
-0, 122400, 152064, 0xe248bce9
-0, 126000, 152064, 0x421e8c0d
-0, 129600, 152064, 0x30135143
-0, 133200, 152064, 0xf02347f4
-0, 136800, 152064, 0x3fa71a0e
-0, 140400, 152064, 0x2c14d955
-0, 144000, 152064, 0x18b2d558
-0, 147600, 152064, 0x54cb7fa2
-0, 151200, 152064, 0x90ae2332
-0, 154800, 152064, 0x7957129a
-0, 158400, 152064, 0x6c9b463e
-0, 162000, 152064, 0x8c44e126
-0, 165600, 152064, 0xde3ba475
-0, 169200, 152064, 0x9823e3ed
-0, 172800, 152064, 0x3ce03b21
-0, 176400, 152064, 0x930007a2
-0, 180000, 152064, 0x6f94bf67
-0, 183600, 152064, 0x3e113ce9
-0, 187200, 152064, 0xa31c8828
-0, 190800, 152064, 0xe65260e0
-0, 194400, 152064, 0x4c612620
-0, 198000, 152064, 0xdc41f17f
-0, 201600, 152064, 0x6d3f6a84
-0, 205200, 152064, 0xfb55e9e9
-0, 208800, 152064, 0x21e2c8b5
-0, 212400, 152064, 0x2d0939a9
-0, 216000, 152064, 0xe1f422d2
-0, 219600, 152064, 0xab0ad4a3
-0, 223200, 152064, 0x948f46df
-0, 226800, 152064, 0x61f50c16
-0, 230400, 152064, 0x7f5edb05
-0, 234000, 152064, 0x8d8c4782
-0, 237600, 152064, 0xe8644529
-0, 241200, 152064, 0x1e7ce779
-0, 244800, 152064, 0x22f355a9
-0, 248400, 152064, 0x4dd736d4
-0, 252000, 152064, 0x3d968c63
-0, 255600, 152064, 0xa629c711
-0, 259200, 152064, 0xae87c4c6
-0, 262800, 152064, 0xcd482dd2
-0, 266400, 152064, 0x6bbbbd25
-0, 270000, 152064, 0x4f0ad3d2
-0, 273600, 152064, 0x66052e88
-0, 277200, 152064, 0xa09dff03
-0, 280800, 152064, 0xb3837263
-0, 284400, 152064, 0x3c91fdde
-0, 288000, 152064, 0x4d9309a9
-0, 291600, 152064, 0x6b624164
-0, 295200, 152064, 0xaa425ecb
-0, 298800, 152064, 0x37aec7c9
-0, 302400, 152064, 0xf4b3d359
-0, 306000, 152064, 0x85d3af2b
-0, 309600, 152064, 0xe5c1f190
-0, 313200, 152064, 0x8cb00e09
-0, 316800, 152064, 0x59406ebc
-0, 320400, 152064, 0xd7ac351f
-0, 324000, 152064, 0x998238b6
-0, 327600, 152064, 0x8e89d064
-0, 331200, 152064, 0x644223c5
-0, 334800, 152064, 0x90ad366f
-0, 338400, 152064, 0x40a12122
-0, 342000, 152064, 0x3045024c
-0, 345600, 152064, 0x58673cfb
-0, 349200, 152064, 0x567cf1fe
-0, 352800, 152064, 0x2d236e41
-0, 356400, 152064, 0xc493577d
diff --git a/tests/ref/fate/h264-conformance-frext-freh6 b/tests/ref/fate/h264-conformance-frext-freh6
deleted file mode 100644
index 4dd3afd..0000000
--- a/tests/ref/fate/h264-conformance-frext-freh6
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x3b21d6cd
-0, 3600, 152064, 0xc32088c6
-0, 7200, 152064, 0x65a64cee
-0, 10800, 152064, 0x0bd45a5b
-0, 14400, 152064, 0xb2210d4d
-0, 18000, 152064, 0xf5b15527
-0, 21600, 152064, 0x806572ad
-0, 25200, 152064, 0x6ecb1fc8
-0, 28800, 152064, 0xc25e96d5
-0, 32400, 152064, 0x5593b825
-0, 36000, 152064, 0xf3be1cff
-0, 39600, 152064, 0xa9155072
-0, 43200, 152064, 0xd5552e26
-0, 46800, 152064, 0x7bf0dbee
-0, 50400, 152064, 0x998b4911
-0, 54000, 152064, 0xcc71bbe0
-0, 57600, 152064, 0x602415b8
-0, 61200, 152064, 0xcfff37cf
-0, 64800, 152064, 0x7cf824a8
-0, 68400, 152064, 0x34816ee5
-0, 72000, 152064, 0x1480540c
-0, 75600, 152064, 0xc2351aaf
-0, 79200, 152064, 0x3b8eac9f
-0, 82800, 152064, 0x92a8faf8
-0, 86400, 152064, 0x7b6121c8
-0, 90000, 152064, 0xe73a3bac
-0, 93600, 152064, 0xcd6e1e36
-0, 97200, 152064, 0xb24660b1
-0, 100800, 152064, 0xa290ec25
-0, 104400, 152064, 0x308915ff
-0, 108000, 152064, 0x1e8dd4db
-0, 111600, 152064, 0x1372f2e0
-0, 115200, 152064, 0xa07cc1d0
-0, 118800, 152064, 0x34bb872c
-0, 122400, 152064, 0x59e6a565
-0, 126000, 152064, 0x9a097932
-0, 129600, 152064, 0x938f2e20
-0, 133200, 152064, 0x59a8157d
-0, 136800, 152064, 0x5cacd404
-0, 140400, 152064, 0xdad068f5
-0, 144000, 152064, 0x7ba67d47
-0, 147600, 152064, 0xc2a11e2d
-0, 151200, 152064, 0xd37fdef7
-0, 154800, 152064, 0x19a3f80a
-0, 158400, 152064, 0x7ec7426a
-0, 162000, 152064, 0x8ffedb61
-0, 165600, 152064, 0x82aebdd0
-0, 169200, 152064, 0xdfc920cc
-0, 172800, 152064, 0x2a467698
-0, 176400, 152064, 0xd08a37d5
-0, 180000, 152064, 0xe606e66a
-0, 183600, 152064, 0x0e7b8bd8
-0, 187200, 152064, 0xf983c732
-0, 190800, 152064, 0x9b82c2e7
-0, 194400, 152064, 0xa990a47e
-0, 198000, 152064, 0x2d5679f1
-0, 201600, 152064, 0x7f1c0201
-0, 205200, 152064, 0xc38b709d
-0, 208800, 152064, 0x040246d8
-0, 212400, 152064, 0xbc856021
-0, 216000, 152064, 0x81e01a78
-0, 219600, 152064, 0xaff1e7f1
-0, 223200, 152064, 0x1fee7715
-0, 226800, 152064, 0x65053711
-0, 230400, 152064, 0x238a0118
-0, 234000, 152064, 0x563491b4
-0, 237600, 152064, 0x5974a6cc
-0, 241200, 152064, 0xd8682c35
-0, 244800, 152064, 0x85c49e96
-0, 248400, 152064, 0x29486faa
-0, 252000, 152064, 0x1a4f0579
-0, 255600, 152064, 0x6ab86c2f
-0, 259200, 152064, 0x36a36d2b
-0, 262800, 152064, 0x3bd77543
-0, 266400, 152064, 0x8fbddc41
-0, 270000, 152064, 0xccc6e0a5
-0, 273600, 152064, 0x00a9539e
-0, 277200, 152064, 0x07ba0714
-0, 280800, 152064, 0xbab2735d
-0, 284400, 152064, 0x79cb5ba0
-0, 288000, 152064, 0xdbcc1c92
-0, 291600, 152064, 0xffec952c
-0, 295200, 152064, 0xc31ac68e
-0, 298800, 152064, 0x24293eb9
-0, 302400, 152064, 0x7b9b2cb4
-0, 306000, 152064, 0x9dd4fe95
-0, 309600, 152064, 0xb62e8baf
-0, 313200, 152064, 0x9fefc174
-0, 316800, 152064, 0xe027c24e
-0, 320400, 152064, 0xe38adc70
-0, 324000, 152064, 0xc7bf536f
-0, 327600, 152064, 0x4448f330
-0, 331200, 152064, 0x4dad5339
-0, 334800, 152064, 0x48fbab15
-0, 338400, 152064, 0xe6c97b2c
-0, 342000, 152064, 0x3c3829ee
-0, 345600, 152064, 0x927772c0
-0, 349200, 152064, 0xbb0f0ef4
-0, 352800, 152064, 0xe65780a7
-0, 356400, 152064, 0xaf8f6d72
diff --git a/tests/ref/fate/h264-conformance-frext-freh7_b b/tests/ref/fate/h264-conformance-frext-freh7_b
deleted file mode 100644
index 8c397f2..0000000
--- a/tests/ref/fate/h264-conformance-frext-freh7_b
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x89f2e8d5
-0, 3600, 152064, 0x35b99397
-0, 7200, 152064, 0x6ef46744
-0, 10800, 152064, 0xec4d6c1c
-0, 14400, 152064, 0xad6e0c70
-0, 18000, 152064, 0x2db534b3
-0, 21600, 152064, 0xcbd25ddd
-0, 25200, 152064, 0xd90708b4
-0, 28800, 152064, 0xc2aa52df
-0, 32400, 152064, 0xbcfc84dc
-0, 36000, 152064, 0xa5a6d269
-0, 39600, 152064, 0x27220ce9
-0, 43200, 152064, 0xf075ee6d
-0, 46800, 152064, 0x9fd3c2ac
-0, 50400, 152064, 0xcba24c2d
-0, 54000, 152064, 0x41cd9441
-0, 57600, 152064, 0x0126efa3
-0, 61200, 152064, 0xf62112af
-0, 64800, 152064, 0x35aff50f
-0, 68400, 152064, 0xcb0b276f
-0, 72000, 152064, 0xc7ef0214
-0, 75600, 152064, 0x7f78d387
-0, 79200, 152064, 0x266c673d
-0, 82800, 152064, 0x1d39c073
-0, 86400, 152064, 0x6a3ae455
-0, 90000, 152064, 0xe4ce0230
-0, 93600, 152064, 0x7f95e87b
-0, 97200, 152064, 0x7c552236
-0, 100800, 152064, 0x24c799b9
-0, 104400, 152064, 0x5042d974
-0, 108000, 152064, 0xe934a5b8
-0, 111600, 152064, 0x6d59c884
-0, 115200, 152064, 0xd00f7fdb
-0, 118800, 152064, 0x62ac3ebd
-0, 122400, 152064, 0xb40a6c25
-0, 126000, 152064, 0x8706188c
-0, 129600, 152064, 0x7682e339
-0, 133200, 152064, 0x1061d943
-0, 136800, 152064, 0x50fa684a
-0, 140400, 152064, 0xab4b1975
-0, 144000, 152064, 0x2d043acb
-0, 147600, 152064, 0xe3c2ec0a
-0, 151200, 152064, 0xb9bc99dc
-0, 154800, 152064, 0x051fb857
-0, 158400, 152064, 0x71d1fe52
-0, 162000, 152064, 0x4230c694
-0, 165600, 152064, 0xb412a137
-0, 169200, 152064, 0x2f50f90d
-0, 172800, 152064, 0x68a1466f
-0, 176400, 152064, 0x77e3f47b
-0, 180000, 152064, 0x4d08de2b
-0, 183600, 152064, 0x1fc663be
-0, 187200, 152064, 0x2c8ba712
-0, 190800, 152064, 0xd50d85b9
-0, 194400, 152064, 0xe8483437
-0, 198000, 152064, 0x4e331e4c
-0, 201600, 152064, 0x0f64a7a0
-0, 205200, 152064, 0x797b0b8c
-0, 208800, 152064, 0x1b91e6d8
-0, 212400, 152064, 0xf3a1f3b6
-0, 216000, 152064, 0x2b94bd52
-0, 219600, 152064, 0x1f30962e
-0, 223200, 152064, 0x853321cf
-0, 226800, 152064, 0x8266c0ac
-0, 230400, 152064, 0x25498be0
-0, 234000, 152064, 0x0f653af9
-0, 237600, 152064, 0x0a025f7e
-0, 241200, 152064, 0x1cfbae04
-0, 244800, 152064, 0x3a874757
-0, 248400, 152064, 0x2c67006e
-0, 252000, 152064, 0x1d409bce
-0, 255600, 152064, 0xfe43121f
-0, 259200, 152064, 0x43411830
-0, 262800, 152064, 0x536d26ca
-0, 266400, 152064, 0x9eb873ea
-0, 270000, 152064, 0x093f93ec
-0, 273600, 152064, 0xdf6f0381
-0, 277200, 152064, 0xa9f4b5e5
-0, 280800, 152064, 0x08f71ef8
-0, 284400, 152064, 0x7a68f820
-0, 288000, 152064, 0xae0c73e7
-0, 291600, 152064, 0x886ae6c7
-0, 295200, 152064, 0x9357f433
-0, 298800, 152064, 0xcc335068
-0, 302400, 152064, 0x2ea108ab
-0, 306000, 152064, 0x06d7dcb0
-0, 309600, 152064, 0x81dc81bc
-0, 313200, 152064, 0xfb32b626
-0, 316800, 152064, 0x2787d1c7
-0, 320400, 152064, 0x69e51118
-0, 324000, 152064, 0xba15d94d
-0, 327600, 152064, 0xc41c09cf
-0, 331200, 152064, 0x7e50e12f
-0, 334800, 152064, 0x0763ddbe
-0, 338400, 152064, 0x8a09bb88
-0, 342000, 152064, 0x530752b7
-0, 345600, 152064, 0x9b159923
-0, 349200, 152064, 0xcbb83ed3
-0, 352800, 152064, 0xdeb5ac0e
-0, 356400, 152064, 0x189299d4
diff --git a/tests/ref/fate/h264-conformance-frext-frext01_jvc_d b/tests/ref/fate/h264-conformance-frext-frext01_jvc_d
deleted file mode 100644
index ae71a63..0000000
--- a/tests/ref/fate/h264-conformance-frext-frext01_jvc_d
+++ /dev/null
@@ -1,16 +0,0 @@
-0, 0, 152064, 0x31bc935e
-0, 3600, 152064, 0x501ea92a
-0, 7200, 152064, 0x8b2f6ead
-0, 10800, 152064, 0xa86277e3
-0, 14400, 152064, 0xe5936250
-0, 18000, 152064, 0x497794cb
-0, 21600, 152064, 0xcb34c39a
-0, 25200, 152064, 0xa739994d
-0, 28800, 152064, 0x01e804b7
-0, 32400, 152064, 0xfcf00627
-0, 36000, 152064, 0xcd747bda
-0, 39600, 152064, 0x1d979394
-0, 43200, 152064, 0xd5d52a6a
-0, 46800, 152064, 0xd7fb147b
-0, 50400, 152064, 0x5d7cb44a
-0, 54000, 152064, 0x9b87803b
diff --git a/tests/ref/fate/h264-conformance-frext-frext02_jvc_c b/tests/ref/fate/h264-conformance-frext-frext02_jvc_c
deleted file mode 100644
index ae71a63..0000000
--- a/tests/ref/fate/h264-conformance-frext-frext02_jvc_c
+++ /dev/null
@@ -1,16 +0,0 @@
-0, 0, 152064, 0x31bc935e
-0, 3600, 152064, 0x501ea92a
-0, 7200, 152064, 0x8b2f6ead
-0, 10800, 152064, 0xa86277e3
-0, 14400, 152064, 0xe5936250
-0, 18000, 152064, 0x497794cb
-0, 21600, 152064, 0xcb34c39a
-0, 25200, 152064, 0xa739994d
-0, 28800, 152064, 0x01e804b7
-0, 32400, 152064, 0xfcf00627
-0, 36000, 152064, 0xcd747bda
-0, 39600, 152064, 0x1d979394
-0, 43200, 152064, 0xd5d52a6a
-0, 46800, 152064, 0xd7fb147b
-0, 50400, 152064, 0x5d7cb44a
-0, 54000, 152064, 0x9b87803b
diff --git a/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c b/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c
deleted file mode 100644
index ec01250..0000000
--- a/tests/ref/fate/h264-conformance-frext-frext1_panasonic_c
+++ /dev/null
@@ -1,8 +0,0 @@
-0, 0, 152064, 0xf9c30518
-0, 3600, 152064, 0x509dd18f
-0, 7200, 152064, 0x7f5c8f07
-0, 10800, 152064, 0x8ce42210
-0, 14400, 152064, 0x59fd527a
-0, 18000, 152064, 0xd987ceea
-0, 21600, 152064, 0xc53167fa
-0, 25200, 152064, 0xb3179926
diff --git a/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b b/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b
deleted file mode 100644
index a980a9d..0000000
--- a/tests/ref/fate/h264-conformance-frext-frext2_panasonic_b
+++ /dev/null
@@ -1,15 +0,0 @@
-0, 0, 152064, 0x0147a2a9
-0, 3600, 152064, 0xe2365351
-0, 7200, 152064, 0xb5f9daee
-0, 10800, 152064, 0xd60818b2
-0, 14400, 152064, 0x21b528e5
-0, 18000, 152064, 0x9c9dda18
-0, 21600, 152064, 0x387fe7de
-0, 25200, 152064, 0x8f0c5a1e
-0, 28800, 152064, 0x02409694
-0, 32400, 152064, 0x2b36a7a7
-0, 36000, 152064, 0x3c6d3863
-0, 39600, 152064, 0xaa7835e1
-0, 43200, 152064, 0x6d105fe7
-0, 46800, 152064, 0x9a348732
-0, 50400, 152064, 0x96a3af13
diff --git a/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d b/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d
deleted file mode 100644
index 94590b3..0000000
--- a/tests/ref/fate/h264-conformance-frext-frext3_panasonic_d
+++ /dev/null
@@ -1,11 +0,0 @@
-0, 0, 152064, 0xdd346292
-0, 3600, 152064, 0xb07e6efd
-0, 7200, 152064, 0x81b4d540
-0, 10800, 152064, 0xc50066cf
-0, 14400, 152064, 0x30a49588
-0, 18000, 152064, 0x57520bfa
-0, 21600, 152064, 0xc0409dd9
-0, 25200, 152064, 0x8e6453e9
-0, 28800, 152064, 0x7ca86d86
-0, 32400, 152064, 0xf937b3b5
-0, 36000, 152064, 0x6c1f4604
diff --git a/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a b/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a
deleted file mode 100644
index 3cf454c..0000000
--- a/tests/ref/fate/h264-conformance-frext-frext4_panasonic_a
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 152064, 0xd604d440
-0, 3600, 152064, 0x08ef262c
-0, 7200, 152064, 0x992fca8e
-0, 10800, 152064, 0x5a02ee15
-0, 14400, 152064, 0xf15d5c66
-0, 18000, 152064, 0x360dda12
-0, 21600, 152064, 0x18b54985
-0, 25200, 152064, 0xf12b6cde
-0, 28800, 152064, 0x3b2e63f7
-0, 32400, 152064, 0x140abcfd
diff --git a/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b b/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b
deleted file mode 100644
index 117b48b..0000000
--- a/tests/ref/fate/h264-conformance-frext-frext_mmco4_sony_b
+++ /dev/null
@@ -1,60 +0,0 @@
-0, 0, 152064, 0x24846654
-0, 3600, 152064, 0xd33945be
-0, 7200, 152064, 0x961cbbfb
-0, 10800, 152064, 0x91eb854d
-0, 14400, 152064, 0x998351b4
-0, 18000, 152064, 0xe7515c67
-0, 21600, 152064, 0xd32058ae
-0, 25200, 152064, 0x99cb5695
-0, 28800, 152064, 0x281de175
-0, 32400, 152064, 0xf4146f55
-0, 36000, 152064, 0x63abbb61
-0, 39600, 152064, 0xf44550c5
-0, 43200, 152064, 0x5797a5c2
-0, 46800, 152064, 0x13b15c60
-0, 50400, 152064, 0x6521e682
-0, 54000, 152064, 0x780c32a4
-0, 57600, 152064, 0x6289f37c
-0, 61200, 152064, 0x96d64d81
-0, 64800, 152064, 0x12ac80ef
-0, 68400, 152064, 0x470956e4
-0, 72000, 152064, 0x3954f944
-0, 75600, 152064, 0x2147f0db
-0, 79200, 152064, 0xca7c9a39
-0, 82800, 152064, 0x727e7772
-0, 86400, 152064, 0xb3b0f8c8
-0, 90000, 152064, 0x6d6eb7ba
-0, 93600, 152064, 0x1eaf5734
-0, 97200, 152064, 0xd7938056
-0, 100800, 152064, 0xcae1ead3
-0, 104400, 152064, 0x6411b82c
-0, 108000, 152064, 0x6f001718
-0, 111600, 152064, 0x3724d9b8
-0, 115200, 152064, 0x04501fec
-0, 118800, 152064, 0x3f4d13bb
-0, 122400, 152064, 0x38f2510a
-0, 126000, 152064, 0x5bb71106
-0, 129600, 152064, 0xe888b09d
-0, 133200, 152064, 0xca6f5f6a
-0, 136800, 152064, 0x01c7d329
-0, 140400, 152064, 0x4e670932
-0, 144000, 152064, 0x651b4984
-0, 147600, 152064, 0x76371fa3
-0, 151200, 152064, 0x60574af0
-0, 154800, 152064, 0xcc1f2080
-0, 158400, 152064, 0xdbf29eb6
-0, 162000, 152064, 0x8ff870be
-0, 165600, 152064, 0x5d39ea56
-0, 169200, 152064, 0xabb7c0a5
-0, 172800, 152064, 0xecb15771
-0, 176400, 152064, 0x571ab1ae
-0, 180000, 152064, 0xc0f22bad
-0, 183600, 152064, 0x22e7593f
-0, 187200, 152064, 0x3c3dee75
-0, 190800, 152064, 0x1c80b995
-0, 194400, 152064, 0x5ba442fa
-0, 198000, 152064, 0xe2291c05
-0, 201600, 152064, 0xa780b11e
-0, 205200, 152064, 0x15bf83fa
-0, 208800, 152064, 0x60fb7c11
-0, 212400, 152064, 0x3fb8cee5
diff --git a/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b b/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b
deleted file mode 100644
index 5e366b4..0000000
--- a/tests/ref/fate/h264-conformance-frext-hcaff1_hhi_b
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 152064, 0xb055a9bd
-0, 3600, 152064, 0x9e1eadb6
-0, 7200, 152064, 0x48f117d2
-0, 10800, 152064, 0x3e3ff049
-0, 14400, 152064, 0x2ff80943
-0, 18000, 152064, 0xc5ee16a6
-0, 21600, 152064, 0x38c33f28
-0, 25200, 152064, 0x3e8444c7
-0, 28800, 152064, 0x14ca4ab2
-0, 32400, 152064, 0xe20e78f7
diff --git a/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c b/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c
deleted file mode 100644
index 102fe89..0000000
--- a/tests/ref/fate/h264-conformance-frext-hcafr1_hhi_c
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 152064, 0xd48c87b3
-0, 3600, 152064, 0xb7a67f8f
-0, 7200, 152064, 0x3c3f3c11
-0, 10800, 152064, 0xc411af54
-0, 14400, 152064, 0xde2efb95
-0, 18000, 152064, 0xa4787125
-0, 21600, 152064, 0x3c17085a
-0, 25200, 152064, 0xee217266
-0, 28800, 152064, 0xa23a8e9d
-0, 32400, 152064, 0x70a06d90
diff --git a/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a b/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a
deleted file mode 100644
index 516b39d..0000000
--- a/tests/ref/fate/h264-conformance-frext-hcafr2_hhi_a
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 152064, 0xd5448f0e
-0, 3600, 152064, 0x93d022ba
-0, 7200, 152064, 0x1eaed76e
-0, 10800, 152064, 0xbbd54f09
-0, 14400, 152064, 0x175d6316
-0, 18000, 152064, 0x15ede384
-0, 21600, 152064, 0xb785e9ac
-0, 25200, 152064, 0xdbbb4ee6
-0, 28800, 152064, 0xaf27c827
-0, 32400, 152064, 0xbf3eeed4
diff --git a/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a b/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a
deleted file mode 100644
index da60e63..0000000
--- a/tests/ref/fate/h264-conformance-frext-hcafr3_hhi_a
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 152064, 0xd5448f0e
-0, 3600, 152064, 0x665e33b5
-0, 7200, 152064, 0x6648e99d
-0, 10800, 152064, 0xbbd54f09
-0, 14400, 152064, 0x3dac7644
-0, 18000, 152064, 0xe980f078
-0, 21600, 152064, 0xb785e9ac
-0, 25200, 152064, 0xa500630e
-0, 28800, 152064, 0x6dade9b0
-0, 32400, 152064, 0xbf3eeed4
diff --git a/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a b/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a
deleted file mode 100644
index 0dcf5a5..0000000
--- a/tests/ref/fate/h264-conformance-frext-hcafr4_hhi_a
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 152064, 0xc7d8832d
-0, 3600, 152064, 0x8d9ffc59
-0, 7200, 152064, 0xaf3ea0d1
-0, 10800, 152064, 0x6805671e
-0, 14400, 152064, 0x49202ab8
-0, 18000, 152064, 0x6b06b1ad
-0, 21600, 152064, 0x909f3e4e
-0, 25200, 152064, 0xa4ce28ec
-0, 28800, 152064, 0xc3c5b8bc
-0, 32400, 152064, 0x78744dac
diff --git a/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b b/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b
deleted file mode 100644
index 1dc66a1..0000000
--- a/tests/ref/fate/h264-conformance-frext-hcamff1_hhi_b
+++ /dev/null
@@ -1,10 +0,0 @@
-0, 0, 152064, 0x18f494ec
-0, 3600, 152064, 0x7515e6d7
-0, 7200, 152064, 0xaa8ee665
-0, 10800, 152064, 0xa946e180
-0, 14400, 152064, 0xd1467f7e
-0, 18000, 152064, 0xd779f4c2
-0, 21600, 152064, 0xed456fed
-0, 25200, 152064, 0x4ca23a72
-0, 28800, 152064, 0x26381cd2
-0, 32400, 152064, 0x50df40fa
diff --git a/tests/ref/fate/h264-conformance-frext-hpca_brcm_c b/tests/ref/fate/h264-conformance-frext-hpca_brcm_c
deleted file mode 100644
index cbfc568..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpca_brcm_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x995bb4bd
-0, 3600, 152064, 0xad287357
-0, 7200, 152064, 0x38fa4661
-0, 10800, 152064, 0x8aae73cf
-0, 14400, 152064, 0x4a13eada
-0, 18000, 152064, 0x48b33901
-0, 21600, 152064, 0x011487bc
-0, 25200, 152064, 0xd4ce1925
-0, 28800, 152064, 0x5d679ddd
-0, 32400, 152064, 0x276cd5cf
-0, 36000, 152064, 0x99c625f0
-0, 39600, 152064, 0xb2f756d1
-0, 43200, 152064, 0xb19c2978
-0, 46800, 152064, 0xdac0ff3c
-0, 50400, 152064, 0x3c1c8d63
-0, 54000, 152064, 0x818ea0a8
-0, 57600, 152064, 0xa7c122a5
-0, 61200, 152064, 0x67ad3519
-0, 64800, 152064, 0xc81b2a88
-0, 68400, 152064, 0x8ae6633e
-0, 72000, 152064, 0xed945788
-0, 75600, 152064, 0x4c740bcb
-0, 79200, 152064, 0xd8408d09
-0, 82800, 152064, 0xb710e8b8
-0, 86400, 152064, 0xb8c647b9
-0, 90000, 152064, 0x802b2e23
-0, 93600, 152064, 0x30672529
-0, 97200, 152064, 0x328a72b6
-0, 100800, 152064, 0xeb6dbe94
-0, 104400, 152064, 0x1c19dcc5
-0, 108000, 152064, 0xfdc6b998
-0, 111600, 152064, 0xf9e2cd80
-0, 115200, 152064, 0x025eb15e
-0, 118800, 152064, 0xfd998ad8
-0, 122400, 152064, 0x8fdf736f
-0, 126000, 152064, 0xa5a7554a
-0, 129600, 152064, 0xcea63304
-0, 133200, 152064, 0xcb28ec28
-0, 136800, 152064, 0x92efb591
-0, 140400, 152064, 0x0f2376c3
-0, 144000, 152064, 0xe9cb5ecf
-0, 147600, 152064, 0xcd2d0eba
-0, 151200, 152064, 0xd57fe4fd
-0, 154800, 152064, 0xc486ab8e
-0, 158400, 152064, 0x01a1f709
-0, 162000, 152064, 0x7ac5b13a
-0, 165600, 152064, 0x6f519279
-0, 169200, 152064, 0xfd7cd9a0
-0, 172800, 152064, 0xfae649d2
-0, 176400, 152064, 0x618507ca
-0, 180000, 152064, 0xb177bc15
-0, 183600, 152064, 0x6fa36854
-0, 187200, 152064, 0xc13cb77d
-0, 190800, 152064, 0x6d40cb01
-0, 194400, 152064, 0xa3db96a2
-0, 198000, 152064, 0xe5ba6c99
-0, 201600, 152064, 0xca9ff3ee
-0, 205200, 152064, 0x6c016c65
-0, 208800, 152064, 0xdf93ed80
-0, 212400, 152064, 0x93112ec8
-0, 216000, 152064, 0x8ab3ea14
-0, 219600, 152064, 0x02f5b891
-0, 223200, 152064, 0xdafd562b
-0, 226800, 152064, 0xa96a2bd7
-0, 230400, 152064, 0xdff8bc68
-0, 234000, 152064, 0x8d956b4b
-0, 237600, 152064, 0xb4aeb960
-0, 241200, 152064, 0x391cf0dd
-0, 244800, 152064, 0x03137de9
-0, 248400, 152064, 0x2bfa8c4b
-0, 252000, 152064, 0xfb54d3a5
-0, 255600, 152064, 0x650146e7
-0, 259200, 152064, 0xd3a7765f
-0, 262800, 152064, 0x49d72b90
-0, 266400, 152064, 0xf089b357
-0, 270000, 152064, 0x23a2be41
-0, 273600, 152064, 0x2ea86592
-0, 277200, 152064, 0x99d6f56b
-0, 280800, 152064, 0xc2ca75b9
-0, 284400, 152064, 0x390b7278
-0, 288000, 152064, 0x0f6d1f1e
-0, 291600, 152064, 0x79e2a3f4
-0, 295200, 152064, 0x51d5e1da
-0, 298800, 152064, 0xdb57419a
-0, 302400, 152064, 0xf90a4153
-0, 306000, 152064, 0xd192f6c6
-0, 309600, 152064, 0x8cd3895a
-0, 313200, 152064, 0x0d3ec577
-0, 316800, 152064, 0x146e8492
-0, 320400, 152064, 0xc9939c22
-0, 324000, 152064, 0xf1f4275e
-0, 327600, 152064, 0xb898eb35
-0, 331200, 152064, 0xed315ee9
-0, 334800, 152064, 0x9046b760
-0, 338400, 152064, 0x599a736b
-0, 342000, 152064, 0xaef20726
-0, 345600, 152064, 0x0d136768
-0, 349200, 152064, 0xfe4ed2a8
-0, 352800, 152064, 0x5a85524b
-0, 356400, 152064, 0x6d495dd2
-0, 360000, 152064, 0x04bdb815
-0, 363600, 152064, 0x28aae1c5
-0, 367200, 152064, 0xc20bc8d9
-0, 370800, 152064, 0xa33d9b41
-0, 374400, 152064, 0x6269cb43
-0, 378000, 152064, 0x4f81d636
-0, 381600, 152064, 0xc6062166
-0, 385200, 152064, 0xb027fbcc
-0, 388800, 152064, 0x73a7a584
-0, 392400, 152064, 0xf67e520a
-0, 396000, 152064, 0x94eff023
-0, 399600, 152064, 0xef1da8e5
-0, 403200, 152064, 0x2d9ab411
-0, 406800, 152064, 0xf0c39b5d
-0, 410400, 152064, 0xb2374724
-0, 414000, 152064, 0x939a5243
-0, 417600, 152064, 0xee3438db
-0, 421200, 152064, 0x7da04012
-0, 424800, 152064, 0xac611668
-0, 428400, 152064, 0xdce3062e
-0, 432000, 152064, 0xb57cc00e
-0, 435600, 152064, 0xaf96b59e
-0, 439200, 152064, 0x56789c13
-0, 442800, 152064, 0xb1f678b5
-0, 446400, 152064, 0xb340b8c4
-0, 450000, 152064, 0x86e6e304
-0, 453600, 152064, 0xa056e037
-0, 457200, 152064, 0x16885d27
-0, 460800, 152064, 0x9c5ac065
-0, 464400, 152064, 0x563d5335
-0, 468000, 152064, 0x3ca71c1e
-0, 471600, 152064, 0xad34e16c
-0, 475200, 152064, 0x6d074b27
-0, 478800, 152064, 0x9b1c4909
-0, 482400, 152064, 0xdbced198
-0, 486000, 152064, 0x8a0ded00
-0, 489600, 152064, 0x5ffc209b
-0, 493200, 152064, 0x47cfd269
-0, 496800, 152064, 0xe3c0137e
-0, 500400, 152064, 0xcb6a5e53
-0, 504000, 152064, 0x87cec05f
-0, 507600, 152064, 0x92721dd2
-0, 511200, 152064, 0x3f7d7b3b
-0, 514800, 152064, 0xd63ef417
-0, 518400, 152064, 0xf8e4b05a
-0, 522000, 152064, 0xb5dcb421
-0, 525600, 152064, 0x53c96f6a
-0, 529200, 152064, 0x24ae98a3
-0, 532800, 152064, 0x2e9b5fff
-0, 536400, 152064, 0x7795bf12
-0, 540000, 152064, 0x499d37ca
-0, 543600, 152064, 0xfe478487
-0, 547200, 152064, 0xcd661afb
-0, 550800, 152064, 0x44f8bf00
-0, 554400, 152064, 0x90b67809
-0, 558000, 152064, 0x8f5726d1
-0, 561600, 152064, 0x2e3c39d5
-0, 565200, 152064, 0x4b67c4e6
-0, 568800, 152064, 0x9fecb7cf
-0, 572400, 152064, 0x207766ea
-0, 576000, 152064, 0x5846bf7b
-0, 579600, 152064, 0x4237fba1
-0, 583200, 152064, 0x983e0cbd
-0, 586800, 152064, 0x6be100d1
-0, 590400, 152064, 0x9d0beb8f
-0, 594000, 152064, 0x234b82e7
-0, 597600, 152064, 0x83fb5ef1
-0, 601200, 152064, 0xf503dcb2
-0, 604800, 152064, 0x031a27f2
-0, 608400, 152064, 0x2f1abf24
-0, 612000, 152064, 0x54d77010
-0, 615600, 152064, 0x049fc0fc
-0, 619200, 152064, 0x20f2f7e7
-0, 622800, 152064, 0xc0d57467
-0, 626400, 152064, 0xbe464eef
-0, 630000, 152064, 0x035c9052
-0, 633600, 152064, 0x91cba4fb
-0, 637200, 152064, 0x11cdbbfb
-0, 640800, 152064, 0xe61116d5
-0, 644400, 152064, 0x16db46b8
-0, 648000, 152064, 0x54f30d9f
-0, 651600, 152064, 0x211a8d2d
-0, 655200, 152064, 0x5a74a56b
-0, 658800, 152064, 0x0ff4ba72
-0, 662400, 152064, 0x4c398ad6
-0, 666000, 152064, 0x830814f0
-0, 669600, 152064, 0xa51f4bab
-0, 673200, 152064, 0xf3460de6
-0, 676800, 152064, 0x7e1979a1
-0, 680400, 152064, 0x4b3ebb3a
-0, 684000, 152064, 0x83d1f4f8
-0, 687600, 152064, 0xfbf08683
-0, 691200, 152064, 0x901c07ec
-0, 694800, 152064, 0xbc2dc1c7
-0, 698400, 152064, 0x6e646b3b
-0, 702000, 152064, 0x51a25aab
-0, 705600, 152064, 0xa042ab78
-0, 709200, 152064, 0xb972af58
-0, 712800, 152064, 0xcdca9568
-0, 716400, 152064, 0x17b69d1c
-0, 720000, 152064, 0x41c43ea2
-0, 723600, 152064, 0x195fc7a0
-0, 727200, 152064, 0xf4cec580
-0, 730800, 152064, 0xb3b10936
-0, 734400, 152064, 0x102bc2ec
-0, 738000, 152064, 0xc99d4767
-0, 741600, 152064, 0x60c745b0
-0, 745200, 152064, 0x8176e0cf
-0, 748800, 152064, 0xd47e69b5
-0, 752400, 152064, 0xacce674c
-0, 756000, 152064, 0x031b51f8
-0, 759600, 152064, 0x0eb681ef
-0, 763200, 152064, 0x0b69334b
-0, 766800, 152064, 0xda819c1f
-0, 770400, 152064, 0xa93f62d2
-0, 774000, 152064, 0x51374db5
-0, 777600, 152064, 0x885dccff
-0, 781200, 152064, 0xd0780444
-0, 784800, 152064, 0xa31733ca
-0, 788400, 152064, 0x3f3de84e
-0, 792000, 152064, 0x2af2b2c3
-0, 795600, 152064, 0xa62dceae
-0, 799200, 152064, 0xca1cffd1
-0, 802800, 152064, 0x3c7d561b
-0, 806400, 152064, 0xbc04130a
-0, 810000, 152064, 0xbd2829ae
-0, 813600, 152064, 0xdbbb9820
-0, 817200, 152064, 0xfc3ef628
-0, 820800, 152064, 0xd5da3ec3
-0, 824400, 152064, 0x62d5fcc1
-0, 828000, 152064, 0x455a8dae
-0, 831600, 152064, 0x421c9147
-0, 835200, 152064, 0x6a168484
-0, 838800, 152064, 0x7ba15d32
-0, 842400, 152064, 0xd089ed27
-0, 846000, 152064, 0x8fc4d894
-0, 849600, 152064, 0x99e47125
-0, 853200, 152064, 0xf55dda68
-0, 856800, 152064, 0x6bf06cf1
-0, 860400, 152064, 0x7dc41a9d
-0, 864000, 152064, 0x78b84019
-0, 867600, 152064, 0x85ae8973
-0, 871200, 152064, 0x7b7aeabe
-0, 874800, 152064, 0xf9a8f6bf
-0, 878400, 152064, 0xe195ddcd
-0, 882000, 152064, 0x83edffe9
-0, 885600, 152064, 0x59cce97a
-0, 889200, 152064, 0x15268af1
-0, 892800, 152064, 0x270cca95
-0, 896400, 152064, 0x8bced1f9
-0, 900000, 152064, 0x08ee5cec
-0, 903600, 152064, 0x01e74f95
-0, 907200, 152064, 0x7e19238f
-0, 910800, 152064, 0x6bcb2b9d
-0, 914400, 152064, 0x58111385
-0, 918000, 152064, 0x6c7aa1f7
-0, 921600, 152064, 0xb713a822
-0, 925200, 152064, 0x1d645cee
-0, 928800, 152064, 0x9c592969
-0, 932400, 152064, 0x2472769e
-0, 936000, 152064, 0x71b7a5ad
-0, 939600, 152064, 0xc6bba1c6
-0, 943200, 152064, 0x7351f305
-0, 946800, 152064, 0x579edbba
-0, 950400, 152064, 0x90eda919
-0, 954000, 152064, 0x2833b10d
-0, 957600, 152064, 0x4b967d65
-0, 961200, 152064, 0x6e7d1702
-0, 964800, 152064, 0x59dbcf5b
-0, 968400, 152064, 0xa138847b
-0, 972000, 152064, 0xb2414e8d
-0, 975600, 152064, 0xb90497f6
-0, 979200, 152064, 0xcd728159
-0, 982800, 152064, 0x005d5bdd
-0, 986400, 152064, 0x27c88fb6
-0, 990000, 152064, 0x3ccb8a93
-0, 993600, 152064, 0xc50256dd
-0, 997200, 152064, 0x111e7dee
-0, 1000800, 152064, 0x259d4a5d
-0, 1004400, 152064, 0x9385148b
-0, 1008000, 152064, 0x74002ab0
-0, 1011600, 152064, 0xd2c74adc
-0, 1015200, 152064, 0x72854b2a
-0, 1018800, 152064, 0x638e5c08
-0, 1022400, 152064, 0x9626bbb3
-0, 1026000, 152064, 0xc107c18f
-0, 1029600, 152064, 0x8bd04578
-0, 1033200, 152064, 0xbcdb6db6
-0, 1036800, 152064, 0x9d0c81be
-0, 1040400, 152064, 0xf25106b6
-0, 1044000, 152064, 0x54c25254
-0, 1047600, 152064, 0x4bf74663
-0, 1051200, 152064, 0x0051b054
-0, 1054800, 152064, 0x5193d3d4
-0, 1058400, 152064, 0xb5d0d045
-0, 1062000, 152064, 0x350a31ca
-0, 1065600, 152064, 0xb8fb7264
-0, 1069200, 152064, 0x7fb97645
-0, 1072800, 152064, 0xcd948c41
-0, 1076400, 152064, 0x38c7570a
diff --git a/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b b/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b
deleted file mode 100644
index b5778dd..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcadq_brcm_b
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0xf3c68dea
-0, 3600, 152064, 0xf52d483f
-0, 7200, 152064, 0x612f1792
-0, 10800, 152064, 0x4df34726
-0, 14400, 152064, 0xfed7c058
-0, 18000, 152064, 0x2d48025c
-0, 21600, 152064, 0x03544ab9
-0, 25200, 152064, 0x20cadfc5
-0, 28800, 152064, 0x7cd3672e
-0, 32400, 152064, 0x5f2b9ede
-0, 36000, 152064, 0xc0bbdf75
-0, 39600, 152064, 0x95571e7c
-0, 43200, 152064, 0x0d1afc5b
-0, 46800, 152064, 0x9c91c11f
-0, 50400, 152064, 0x73e667e4
-0, 54000, 152064, 0xfb7f8892
-0, 57600, 152064, 0x5707f566
-0, 61200, 152064, 0x21032449
-0, 64800, 152064, 0x199e20b7
-0, 68400, 152064, 0x23213179
-0, 72000, 152064, 0x29812daa
-0, 75600, 152064, 0x04e3eb6b
-0, 79200, 152064, 0xab206165
-0, 82800, 152064, 0x392fbf7b
-0, 86400, 152064, 0x137a1c6a
-0, 90000, 152064, 0x9caff265
-0, 93600, 152064, 0x6becf046
-0, 97200, 152064, 0xfc2c3ba6
-0, 100800, 152064, 0xcf4b9b4c
-0, 104400, 152064, 0x4e2ebd37
-0, 108000, 152064, 0xcd419daa
-0, 111600, 152064, 0xe12294b0
-0, 115200, 152064, 0x6bda7493
-0, 118800, 152064, 0xefbf5d0b
-0, 122400, 152064, 0x9500458a
-0, 126000, 152064, 0x6b5d212e
-0, 129600, 152064, 0xb928fc31
-0, 133200, 152064, 0x64f2bb2f
-0, 136800, 152064, 0xf93a724d
-0, 140400, 152064, 0xdd0d32c0
-0, 144000, 152064, 0xe1b51d95
-0, 147600, 152064, 0xbb43d295
-0, 151200, 152064, 0x6dcea069
-0, 154800, 152064, 0x89d79805
-0, 158400, 152064, 0x50b5dd43
-0, 162000, 152064, 0xe3099e3f
-0, 165600, 152064, 0x003b6ace
-0, 169200, 152064, 0x2213b672
-0, 172800, 152064, 0x5b273093
-0, 176400, 152064, 0xdbfbd9bf
-0, 180000, 152064, 0xf26b89d0
-0, 183600, 152064, 0x1470527e
-0, 187200, 152064, 0x0e668970
-0, 190800, 152064, 0x00218692
-0, 194400, 152064, 0xaabf79a8
-0, 198000, 152064, 0xf68b4663
-0, 201600, 152064, 0x4c08d01f
-0, 205200, 152064, 0x48e75380
-0, 208800, 152064, 0x4b8be58f
-0, 212400, 152064, 0x8a6c1365
-0, 216000, 152064, 0x9439ca02
-0, 219600, 152064, 0x831d9855
-0, 223200, 152064, 0xff031ffd
-0, 226800, 152064, 0x3680f4bc
-0, 230400, 152064, 0x794c95a4
-0, 234000, 152064, 0x23e53349
-0, 237600, 152064, 0x85307117
-0, 241200, 152064, 0x0bc0bf5a
-0, 244800, 152064, 0xc79f46c8
-0, 248400, 152064, 0x48be4e21
-0, 252000, 152064, 0x2ad89b4f
-0, 255600, 152064, 0xd454f9a9
-0, 259200, 152064, 0x64852f6d
-0, 262800, 152064, 0xcb7b0c05
-0, 266400, 152064, 0x4e108ced
-0, 270000, 152064, 0xf5e5a37b
-0, 273600, 152064, 0x224e29c7
-0, 277200, 152064, 0xad90d3c2
-0, 280800, 152064, 0x5ddb5d05
-0, 284400, 152064, 0x4ebf4337
-0, 288000, 152064, 0x7e2bfeed
-0, 291600, 152064, 0x00e884c7
-0, 295200, 152064, 0xa4f6a534
-0, 298800, 152064, 0x622f1511
-0, 302400, 152064, 0x8d99233d
-0, 306000, 152064, 0x5910d02c
-0, 309600, 152064, 0x20d6706c
-0, 313200, 152064, 0x8e30a417
-0, 316800, 152064, 0x180d745a
-0, 320400, 152064, 0xc25189b9
-0, 324000, 152064, 0x909101ad
-0, 327600, 152064, 0x9967be1c
-0, 331200, 152064, 0x72ff3206
-0, 334800, 152064, 0x48d07f48
-0, 338400, 152064, 0x7f8244b7
-0, 342000, 152064, 0xf871e21e
-0, 345600, 152064, 0xd4743610
-0, 349200, 152064, 0xc2c7a7b1
-0, 352800, 152064, 0x95be1a75
-0, 356400, 152064, 0x44972b2e
-0, 360000, 152064, 0xa6036c4f
-0, 363600, 152064, 0xecdd8dd6
-0, 367200, 152064, 0xbb7e8551
-0, 370800, 152064, 0x42916e6c
-0, 374400, 152064, 0x972db010
-0, 378000, 152064, 0x80dab6a0
-0, 381600, 152064, 0xc753ecdb
-0, 385200, 152064, 0x0823bffa
-0, 388800, 152064, 0x80876b2d
-0, 392400, 152064, 0x4a8b2118
-0, 396000, 152064, 0x0be2c13d
-0, 399600, 152064, 0xa6966e4f
-0, 403200, 152064, 0xf6a57650
-0, 406800, 152064, 0x49d66fd4
-0, 410400, 152064, 0x21d92047
-0, 414000, 152064, 0x155f20a8
-0, 417600, 152064, 0x5ab90c1d
-0, 421200, 152064, 0xa0c31337
-0, 424800, 152064, 0xd20de1d6
-0, 428400, 152064, 0x300ad916
-0, 432000, 152064, 0xbcb89eb5
-0, 435600, 152064, 0x08759342
-0, 439200, 152064, 0xa5d06e72
-0, 442800, 152064, 0x3b4c537f
-0, 446400, 152064, 0x7f48912b
-0, 450000, 152064, 0x200dbd1f
-0, 453600, 152064, 0x918abfde
-0, 457200, 152064, 0xd8072cdf
-0, 460800, 152064, 0x89d2902b
-0, 464400, 152064, 0xcd2e2e3c
-0, 468000, 152064, 0xf343e4a2
-0, 471600, 152064, 0xc424acad
-0, 475200, 152064, 0xf71e3031
-0, 478800, 152064, 0xf1bc1179
-0, 482400, 152064, 0x9af58d24
-0, 486000, 152064, 0x48a4d01e
-0, 489600, 152064, 0xcf24f721
-0, 493200, 152064, 0x5bc7b4f3
-0, 496800, 152064, 0x8763fc59
-0, 500400, 152064, 0xb6954051
-0, 504000, 152064, 0x044ba446
-0, 507600, 152064, 0xdaaaee7e
-0, 511200, 152064, 0x8eac550d
-0, 514800, 152064, 0x5191d08c
-0, 518400, 152064, 0x3cd76d43
-0, 522000, 152064, 0xf01f8fa9
-0, 525600, 152064, 0x0e283e9b
-0, 529200, 152064, 0x7cef69ee
-0, 532800, 152064, 0xc8e332bc
-0, 536400, 152064, 0x5b1aa484
-0, 540000, 152064, 0x3975234f
-0, 543600, 152064, 0x52b8661e
-0, 547200, 152064, 0xb4b8fed8
-0, 550800, 152064, 0x5aff9f70
-0, 554400, 152064, 0x7b575735
-0, 558000, 152064, 0x77d51523
-0, 561600, 152064, 0xf5131eba
-0, 565200, 152064, 0x4bd2b1ad
-0, 568800, 152064, 0xccfc8dca
-0, 572400, 152064, 0xcf245472
-0, 576000, 152064, 0xe055adf5
-0, 579600, 152064, 0x2a90e171
-0, 583200, 152064, 0x1bd8ea64
-0, 586800, 152064, 0x32f1d794
-0, 590400, 152064, 0xc938c42a
-0, 594000, 152064, 0x12b5644f
-0, 597600, 152064, 0x99003711
-0, 601200, 152064, 0xaecfad1c
-0, 604800, 152064, 0x94b00ae1
-0, 608400, 152064, 0xbb4f982f
-0, 612000, 152064, 0x6f7f5dc1
-0, 615600, 152064, 0x7be7c2cb
-0, 619200, 152064, 0x3b2ee4d3
-0, 622800, 152064, 0xc75f5666
-0, 626400, 152064, 0xff7a3ede
-0, 630000, 152064, 0x55866b59
-0, 633600, 152064, 0x408b8455
-0, 637200, 152064, 0x96c4ab66
-0, 640800, 152064, 0x1d87f575
-0, 644400, 152064, 0x3a3b17ac
-0, 648000, 152064, 0x9c99e591
-0, 651600, 152064, 0xc1fc663d
-0, 655200, 152064, 0x17b982dd
-0, 658800, 152064, 0x24fe9dad
-0, 662400, 152064, 0xea8760ee
-0, 666000, 152064, 0x23dcefad
-0, 669600, 152064, 0xee6d23f0
-0, 673200, 152064, 0xfddc1962
-0, 676800, 152064, 0xb23190df
-0, 680400, 152064, 0xf066a595
-0, 684000, 152064, 0x2200fef8
-0, 687600, 152064, 0x5491ab2f
-0, 691200, 152064, 0xea93fa58
-0, 694800, 152064, 0x3e13d4f4
-0, 698400, 152064, 0x3dda841d
-0, 702000, 152064, 0xfc243577
-0, 705600, 152064, 0xca4a9127
-0, 709200, 152064, 0x41908ec0
-0, 712800, 152064, 0x10a758bd
-0, 716400, 152064, 0x6a849e5b
-0, 720000, 152064, 0xb55a1f2b
-0, 723600, 152064, 0x2bfe9627
-0, 727200, 152064, 0x2bfca28c
-0, 730800, 152064, 0xd166f336
-0, 734400, 152064, 0x9facb32b
-0, 738000, 152064, 0x6a672475
-0, 741600, 152064, 0xc7b219cf
-0, 745200, 152064, 0x2b43ca53
-0, 748800, 152064, 0x43b542c4
-0, 752400, 152064, 0xdc654337
-0, 756000, 152064, 0x68003d7c
-0, 759600, 152064, 0x3cb85724
-0, 763200, 152064, 0x422701c2
-0, 766800, 152064, 0x1c667870
-0, 770400, 152064, 0x75ef3230
-0, 774000, 152064, 0x0ac82643
-0, 777600, 152064, 0x3eb3a0be
-0, 781200, 152064, 0x482bd77e
-0, 784800, 152064, 0xd3ce1171
-0, 788400, 152064, 0xeaefc7e4
-0, 792000, 152064, 0xa9c67939
-0, 795600, 152064, 0x0af0a25b
-0, 799200, 152064, 0xd094d95a
-0, 802800, 152064, 0xfda42fc6
-0, 806400, 152064, 0x4669f952
-0, 810000, 152064, 0x52d40e98
-0, 813600, 152064, 0x27c36cd1
-0, 817200, 152064, 0xa103b6ce
-0, 820800, 152064, 0x2be9026d
-0, 824400, 152064, 0x2f4ecc59
-0, 828000, 152064, 0x53144cef
-0, 831600, 152064, 0x15d54fc9
-0, 835200, 152064, 0x7e302db7
-0, 838800, 152064, 0x82521901
-0, 842400, 152064, 0x1123cdb6
-0, 846000, 152064, 0x3185878a
-0, 849600, 152064, 0xbb294983
-0, 853200, 152064, 0x83d9fe66
-0, 856800, 152064, 0xede9fb08
-0, 860400, 152064, 0xa543b551
-0, 864000, 152064, 0x39e82734
-0, 867600, 152064, 0xd0447fb5
-0, 871200, 152064, 0x8cc6f502
-0, 874800, 152064, 0xda8d1da8
-0, 878400, 152064, 0xcafdccca
-0, 882000, 152064, 0xbf0e04f4
-0, 885600, 152064, 0x0c6eefec
-0, 889200, 152064, 0xb9026d39
-0, 892800, 152064, 0x0121a7a8
-0, 896400, 152064, 0x453ebbc6
-0, 900000, 152064, 0x14ae15e3
-0, 903600, 152064, 0x51d618e1
-0, 907200, 152064, 0x2254f452
-0, 910800, 152064, 0x8c360633
-0, 914400, 152064, 0x8704d9bc
-0, 918000, 152064, 0xe5d48301
-0, 921600, 152064, 0xf25b7b3f
-0, 925200, 152064, 0xd2ad3b73
-0, 928800, 152064, 0x53db0387
-0, 932400, 152064, 0x2486341c
-0, 936000, 152064, 0x4a24570b
-0, 939600, 152064, 0x0694620a
-0, 943200, 152064, 0xbbc2a302
-0, 946800, 152064, 0x08ad9c02
-0, 950400, 152064, 0x601a63ab
-0, 954000, 152064, 0xe4234a48
-0, 957600, 152064, 0x07702235
-0, 961200, 152064, 0x719dbecf
-0, 964800, 152064, 0xf301a7ad
-0, 968400, 152064, 0xf15c70c3
-0, 972000, 152064, 0x0ab93386
-0, 975600, 152064, 0x99c05adb
-0, 979200, 152064, 0x9ed43530
-0, 982800, 152064, 0xa2f62122
-0, 986400, 152064, 0xf16f4525
-0, 990000, 152064, 0xa3403b4a
-0, 993600, 152064, 0x95521096
-0, 997200, 152064, 0x0d412988
-0, 1000800, 152064, 0x829e080a
-0, 1004400, 152064, 0x0805c1b5
-0, 1008000, 152064, 0xa136be48
-0, 1011600, 152064, 0x0f8de228
-0, 1015200, 152064, 0x272cf2d3
-0, 1018800, 152064, 0xa1df2a5e
-0, 1022400, 152064, 0xf9db8350
-0, 1026000, 152064, 0x5536997d
-0, 1029600, 152064, 0xab83e81e
-0, 1033200, 152064, 0xec791b49
-0, 1036800, 152064, 0x04d03e19
-0, 1040400, 152064, 0xd6a2bd21
-0, 1044000, 152064, 0x2d35f0aa
-0, 1047600, 152064, 0x137bf715
-0, 1051200, 152064, 0x56ef5ae1
-0, 1054800, 152064, 0x9bb5821e
-0, 1058400, 152064, 0x533c7fff
-0, 1062000, 152064, 0x469ad380
-0, 1065600, 152064, 0x75710e84
-0, 1069200, 152064, 0xbbd72551
-0, 1072800, 152064, 0xf1137026
-0, 1076400, 152064, 0x6238412b
diff --git a/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c b/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c
deleted file mode 100644
index a67b4ba..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcafl_bcrm_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x502ec077
-0, 3600, 152064, 0x84807243
-0, 7200, 152064, 0xd7474a6e
-0, 10800, 152064, 0x793469bb
-0, 14400, 152064, 0xb7a0faf7
-0, 18000, 152064, 0x1d3d3cba
-0, 21600, 152064, 0xb62583de
-0, 25200, 152064, 0xc8422fb1
-0, 28800, 152064, 0x321dc699
-0, 32400, 152064, 0x7a34d350
-0, 36000, 152064, 0xaa4c302d
-0, 39600, 152064, 0x45fa7ab0
-0, 43200, 152064, 0xc7262e41
-0, 46800, 152064, 0x3550000c
-0, 50400, 152064, 0xf4bab54b
-0, 54000, 152064, 0xaccf9c1a
-0, 57600, 152064, 0x9bee20e9
-0, 61200, 152064, 0x47fb7720
-0, 64800, 152064, 0x12c63ffb
-0, 68400, 152064, 0xfa2b8b4d
-0, 72000, 152064, 0x279964bd
-0, 75600, 152064, 0xb8b01c7e
-0, 79200, 152064, 0x816fa010
-0, 82800, 152064, 0x59fe1c8c
-0, 86400, 152064, 0x13393fad
-0, 90000, 152064, 0x991a50a4
-0, 93600, 152064, 0x57df3eb7
-0, 97200, 152064, 0x744371df
-0, 100800, 152064, 0xe9f6d3ff
-0, 104400, 152064, 0xc506fba0
-0, 108000, 152064, 0x6295b90e
-0, 111600, 152064, 0xa19cee2d
-0, 115200, 152064, 0xf8c1b3ca
-0, 118800, 152064, 0x69f68ce0
-0, 122400, 152064, 0x80558bb6
-0, 126000, 152064, 0x27824fa5
-0, 129600, 152064, 0x27c929a1
-0, 133200, 152064, 0xc0fe06d1
-0, 136800, 152064, 0xc52bc58c
-0, 140400, 152064, 0x0a5363c7
-0, 144000, 152064, 0xd0f45a0d
-0, 147600, 152064, 0x274710f9
-0, 151200, 152064, 0x89d2d390
-0, 154800, 152064, 0x12a9bfb0
-0, 158400, 152064, 0x04501a93
-0, 162000, 152064, 0xf92cbbf4
-0, 165600, 152064, 0xf6d1b27d
-0, 169200, 152064, 0xe3e904c3
-0, 172800, 152064, 0x58f8516d
-0, 176400, 152064, 0x70370c2b
-0, 180000, 152064, 0xfeebc88c
-0, 183600, 152064, 0x974c6ed6
-0, 187200, 152064, 0x401bdcf2
-0, 190800, 152064, 0xfe61e278
-0, 194400, 152064, 0x96ba8bb9
-0, 198000, 152064, 0x988492fd
-0, 201600, 152064, 0xd1d913a9
-0, 205200, 152064, 0x6bc46f0e
-0, 208800, 152064, 0x695ef706
-0, 212400, 152064, 0x142045c9
-0, 216000, 152064, 0xb390ed87
-0, 219600, 152064, 0xb9e6d2e5
-0, 223200, 152064, 0xe348797f
-0, 226800, 152064, 0x1cbd29d6
-0, 230400, 152064, 0xbd7dd694
-0, 234000, 152064, 0x516873c3
-0, 237600, 152064, 0x27bba182
-0, 241200, 152064, 0x7541f920
-0, 244800, 152064, 0xfdf67042
-0, 248400, 152064, 0x6c3c7896
-0, 252000, 152064, 0xed86c467
-0, 255600, 152064, 0x4ea83ca2
-0, 259200, 152064, 0xa3e6725b
-0, 262800, 152064, 0x917f5f16
-0, 266400, 152064, 0x8cf2d2e1
-0, 270000, 152064, 0x57a8d116
-0, 273600, 152064, 0x0db267d4
-0, 277200, 152064, 0xce782ac5
-0, 280800, 152064, 0x1c9d8518
-0, 284400, 152064, 0x47598ac7
-0, 288000, 152064, 0xc5033d97
-0, 291600, 152064, 0xd7aaa3a4
-0, 295200, 152064, 0x078afc96
-0, 298800, 152064, 0xc9fe673d
-0, 302400, 152064, 0xe9284066
-0, 306000, 152064, 0xbc570982
-0, 309600, 152064, 0x0aac8574
-0, 313200, 152064, 0x098cbeee
-0, 316800, 152064, 0x19c36a9d
-0, 320400, 152064, 0x8fe4a893
-0, 324000, 152064, 0x0b652f17
-0, 327600, 152064, 0x10f2e6bf
-0, 331200, 152064, 0x7ce5634e
-0, 334800, 152064, 0x8fe4ac6c
-0, 338400, 152064, 0xcaba749e
-0, 342000, 152064, 0x5f8a0d5c
-0, 345600, 152064, 0xcaa66bbc
-0, 349200, 152064, 0xc87ae617
-0, 352800, 152064, 0xe8ef4dd7
-0, 356400, 152064, 0xdfca5a07
-0, 360000, 152064, 0x5f7eab7d
-0, 363600, 152064, 0x8a65ebbb
-0, 367200, 152064, 0x4beab4a0
-0, 370800, 152064, 0xb5e6ab30
-0, 374400, 152064, 0x8fe4f4d4
-0, 378000, 152064, 0x95bde1ca
-0, 381600, 152064, 0xcc5e3a53
-0, 385200, 152064, 0xf09f1dd7
-0, 388800, 152064, 0x10179672
-0, 392400, 152064, 0x4ad16184
-0, 396000, 152064, 0x9efa0e23
-0, 399600, 152064, 0x22f59522
-0, 403200, 152064, 0x4d38f09d
-0, 406800, 152064, 0x4c5ebf56
-0, 410400, 152064, 0xb19d5077
-0, 414000, 152064, 0xa98576b9
-0, 417600, 152064, 0x65324239
-0, 421200, 152064, 0x709e4031
-0, 424800, 152064, 0xf8e81681
-0, 428400, 152064, 0x058514e5
-0, 432000, 152064, 0xd1d1c806
-0, 435600, 152064, 0x0e4dde57
-0, 439200, 152064, 0x49e9c2bb
-0, 442800, 152064, 0x01417ce6
-0, 446400, 152064, 0xda7ebbf1
-0, 450000, 152064, 0xa22906b7
-0, 453600, 152064, 0x32e2df87
-0, 457200, 152064, 0x69917c8f
-0, 460800, 152064, 0xea8ed2cc
-0, 464400, 152064, 0x0b8d57f1
-0, 468000, 152064, 0x5f683bcd
-0, 471600, 152064, 0x5162fe2f
-0, 475200, 152064, 0x49c052f8
-0, 478800, 152064, 0x990b69ba
-0, 482400, 152064, 0xa6d4f99f
-0, 486000, 152064, 0xe79ef4da
-0, 489600, 152064, 0x5e8a3847
-0, 493200, 152064, 0x38b1e75f
-0, 496800, 152064, 0xf5c91bed
-0, 500400, 152064, 0xd59a6d26
-0, 504000, 152064, 0xc361de06
-0, 507600, 152064, 0x63ed2229
-0, 511200, 152064, 0xb8229205
-0, 514800, 152064, 0x7c6619af
-0, 518400, 152064, 0x4126b02f
-0, 522000, 152064, 0x9250b99b
-0, 525600, 152064, 0x589778f9
-0, 529200, 152064, 0xed1fa45b
-0, 532800, 152064, 0x700b6f32
-0, 536400, 152064, 0x0590df55
-0, 540000, 152064, 0x3e9c4018
-0, 543600, 152064, 0x957b8860
-0, 547200, 152064, 0x56161560
-0, 550800, 152064, 0xbc43bc3b
-0, 554400, 152064, 0x508d8632
-0, 558000, 152064, 0xbc5736d8
-0, 561600, 152064, 0xed7d3aef
-0, 565200, 152064, 0x1dcdda9f
-0, 568800, 152064, 0x8ef6d5c9
-0, 572400, 152064, 0x15466acc
-0, 576000, 152064, 0x45d4cf67
-0, 579600, 152064, 0x8c900b9d
-0, 583200, 152064, 0x747006e0
-0, 586800, 152064, 0xac920a0c
-0, 590400, 152064, 0xb8210c27
-0, 594000, 152064, 0x7dbb873a
-0, 597600, 152064, 0x0d4d7584
-0, 601200, 152064, 0xefb3fe60
-0, 604800, 152064, 0x905e2644
-0, 608400, 152064, 0x7c04e534
-0, 612000, 152064, 0x8889972a
-0, 615600, 152064, 0x21c7d8ad
-0, 619200, 152064, 0x1c641176
-0, 622800, 152064, 0xf71489a4
-0, 626400, 152064, 0xd7ac5555
-0, 630000, 152064, 0xb4609c6d
-0, 633600, 152064, 0xf5b2bd5e
-0, 637200, 152064, 0x9f43ce57
-0, 640800, 152064, 0x77642dd3
-0, 644400, 152064, 0x3e79565c
-0, 648000, 152064, 0x95f40b8e
-0, 651600, 152064, 0x3c8ca4d4
-0, 655200, 152064, 0xa02ac497
-0, 658800, 152064, 0x4c93b377
-0, 662400, 152064, 0x55f5ac68
-0, 666000, 152064, 0xf8652eca
-0, 669600, 152064, 0x56e94574
-0, 673200, 152064, 0x6d8302e1
-0, 676800, 152064, 0x29a57061
-0, 680400, 152064, 0x24e4cfdc
-0, 684000, 152064, 0xf5a5d62a
-0, 687600, 152064, 0x998870c1
-0, 691200, 152064, 0xa15b1f4e
-0, 694800, 152064, 0xb0ccb51f
-0, 698400, 152064, 0xeaaf59ab
-0, 702000, 152064, 0x7e2b4fe6
-0, 705600, 152064, 0x72299fea
-0, 709200, 152064, 0x769da8b2
-0, 712800, 152064, 0xefad7ef8
-0, 716400, 152064, 0x24819983
-0, 720000, 152064, 0x2aad32ab
-0, 723600, 152064, 0xc80cac79
-0, 727200, 152064, 0x1659d628
-0, 730800, 152064, 0xef941f66
-0, 734400, 152064, 0x0d7fcdb5
-0, 738000, 152064, 0x7c1853fa
-0, 741600, 152064, 0xb94c4d3c
-0, 745200, 152064, 0xc47adfc2
-0, 748800, 152064, 0x366a6729
-0, 752400, 152064, 0x7eb37b70
-0, 756000, 152064, 0xafd54c27
-0, 759600, 152064, 0x67b18636
-0, 763200, 152064, 0x93b22dcf
-0, 766800, 152064, 0xa64991f1
-0, 770400, 152064, 0xd32a7102
-0, 774000, 152064, 0xff665d1c
-0, 777600, 152064, 0xf107cc31
-0, 781200, 152064, 0xf5b25652
-0, 784800, 152064, 0x8caf783d
-0, 788400, 152064, 0x72f3eb00
-0, 792000, 152064, 0xb5aea5f8
-0, 795600, 152064, 0xee70e870
-0, 799200, 152064, 0x7c3a0156
-0, 802800, 152064, 0x871b6383
-0, 806400, 152064, 0x48d831ff
-0, 810000, 152064, 0xca233913
-0, 813600, 152064, 0xe14bc5eb
-0, 817200, 152064, 0x9b1d27e7
-0, 820800, 152064, 0xfb9637f7
-0, 824400, 152064, 0x0c022157
-0, 828000, 152064, 0x16d35fc9
-0, 831600, 152064, 0x6d935f71
-0, 835200, 152064, 0xae4066fa
-0, 838800, 152064, 0xcef94fdc
-0, 842400, 152064, 0xc234edb9
-0, 846000, 152064, 0x26a4f2e2
-0, 849600, 152064, 0xd29ac23e
-0, 853200, 152064, 0xb7604395
-0, 856800, 152064, 0x408084f6
-0, 860400, 152064, 0x0a02026c
-0, 864000, 152064, 0x78b33c7c
-0, 867600, 152064, 0xcb02b874
-0, 871200, 152064, 0xf566513b
-0, 874800, 152064, 0xb34e52b1
-0, 878400, 152064, 0xf55ff493
-0, 882000, 152064, 0xb0e8282a
-0, 885600, 152064, 0xe9510bbe
-0, 889200, 152064, 0x292e8c5a
-0, 892800, 152064, 0x62b9d2b0
-0, 896400, 152064, 0x3a8cc827
-0, 900000, 152064, 0x25cc465e
-0, 903600, 152064, 0xf2bc32e2
-0, 907200, 152064, 0x6141f914
-0, 910800, 152064, 0x1171256f
-0, 914400, 152064, 0x13cb2ded
-0, 918000, 152064, 0x3d4ca557
-0, 921600, 152064, 0xf2b9e72e
-0, 925200, 152064, 0x03f7547a
-0, 928800, 152064, 0xc7302955
-0, 932400, 152064, 0xe78a46d3
-0, 936000, 152064, 0x3726a270
-0, 939600, 152064, 0x2f65722a
-0, 943200, 152064, 0x55acce40
-0, 946800, 152064, 0xf6fa9db2
-0, 950400, 152064, 0x70a36937
-0, 954000, 152064, 0x9313742d
-0, 957600, 152064, 0x2eb14e53
-0, 961200, 152064, 0x3d47c9c3
-0, 964800, 152064, 0xd0a90348
-0, 968400, 152064, 0x6ad48088
-0, 972000, 152064, 0x68e64738
-0, 975600, 152064, 0x04c3735a
-0, 979200, 152064, 0x51d0593f
-0, 982800, 152064, 0x42cf2b48
-0, 986400, 152064, 0xa5496a0c
-0, 990000, 152064, 0x84c25549
-0, 993600, 152064, 0x96691600
-0, 997200, 152064, 0x423135db
-0, 1000800, 152064, 0x8d2e08b6
-0, 1004400, 152064, 0xaeb4c840
-0, 1008000, 152064, 0xf3e71780
-0, 1011600, 152064, 0x8858228b
-0, 1015200, 152064, 0xf28613f8
-0, 1018800, 152064, 0xb5327882
-0, 1022400, 152064, 0xbb60bb85
-0, 1026000, 152064, 0x345ab1c9
-0, 1029600, 152064, 0x8aac2cba
-0, 1033200, 152064, 0x7ce15b4c
-0, 1036800, 152064, 0xc09c55c0
-0, 1040400, 152064, 0x8482ddd6
-0, 1044000, 152064, 0xab222a13
-0, 1047600, 152064, 0xd39b0dea
-0, 1051200, 152064, 0x6dab6e06
-0, 1054800, 152064, 0xec0891bd
-0, 1058400, 152064, 0x88bd9701
-0, 1062000, 152064, 0xdf13072a
-0, 1065600, 152064, 0x23b33081
-0, 1069200, 152064, 0x63943137
-0, 1072800, 152064, 0xab6a9052
-0, 1076400, 152064, 0x05485494
diff --git a/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c b/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c
deleted file mode 100644
index 97d7677..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcaflnl_bcrm_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x3e39c08b
-0, 3600, 152064, 0xabc67990
-0, 7200, 152064, 0x19614e74
-0, 10800, 152064, 0xa3776beb
-0, 14400, 152064, 0xcce6ffdf
-0, 18000, 152064, 0xb0e94746
-0, 21600, 152064, 0xdb1a84ef
-0, 25200, 152064, 0xb2624509
-0, 28800, 152064, 0x32e2d826
-0, 32400, 152064, 0xb3bddf0b
-0, 36000, 152064, 0x2e273ce3
-0, 39600, 152064, 0x67af7e4d
-0, 43200, 152064, 0x505c3261
-0, 46800, 152064, 0xa43d015e
-0, 50400, 152064, 0xad41c1f6
-0, 54000, 152064, 0x633ba55f
-0, 57600, 152064, 0xe80634f0
-0, 61200, 152064, 0x80a07dc9
-0, 64800, 152064, 0x0e7a3bbf
-0, 68400, 152064, 0xcb099196
-0, 72000, 152064, 0x57c96db5
-0, 75600, 152064, 0xccd422fa
-0, 79200, 152064, 0x0850b7a7
-0, 82800, 152064, 0x30e33156
-0, 86400, 152064, 0x34e13f9a
-0, 90000, 152064, 0x03d36000
-0, 93600, 152064, 0xbf7d49da
-0, 97200, 152064, 0x77336d09
-0, 100800, 152064, 0xca8be5a9
-0, 104400, 152064, 0xe57c0b08
-0, 108000, 152064, 0xbe77c093
-0, 111600, 152064, 0x6bf1ff05
-0, 115200, 152064, 0x9142babf
-0, 118800, 152064, 0x08db8e67
-0, 122400, 152064, 0x69ac8cb6
-0, 126000, 152064, 0xaa3b5c88
-0, 129600, 152064, 0x9bd32638
-0, 133200, 152064, 0x7972115a
-0, 136800, 152064, 0x5c1dd47b
-0, 140400, 152064, 0x8a196e02
-0, 144000, 152064, 0xa89672bc
-0, 147600, 152064, 0x27b220e4
-0, 151200, 152064, 0xfa38dc4a
-0, 154800, 152064, 0x4784c639
-0, 158400, 152064, 0xa5e4229a
-0, 162000, 152064, 0xa986bdfc
-0, 165600, 152064, 0x2951b47b
-0, 169200, 152064, 0x4df404a6
-0, 172800, 152064, 0xc75155e8
-0, 176400, 152064, 0xfc05248c
-0, 180000, 152064, 0x5d53da10
-0, 183600, 152064, 0x284376ec
-0, 187200, 152064, 0x19fce380
-0, 190800, 152064, 0x876be6c9
-0, 194400, 152064, 0x39eb8ff9
-0, 198000, 152064, 0x289c9543
-0, 201600, 152064, 0x24dd2356
-0, 205200, 152064, 0x1dc17d3c
-0, 208800, 152064, 0xd17c00ac
-0, 212400, 152064, 0xc2ad54de
-0, 216000, 152064, 0xbe11ee2f
-0, 219600, 152064, 0x3db9dc89
-0, 223200, 152064, 0xac0d7bc2
-0, 226800, 152064, 0x8dab2dde
-0, 230400, 152064, 0x566ad225
-0, 234000, 152064, 0x587c7853
-0, 237600, 152064, 0x601c9c80
-0, 241200, 152064, 0x2afaf751
-0, 244800, 152064, 0x1c9f7e3a
-0, 248400, 152064, 0x899475bf
-0, 252000, 152064, 0x0d65c7d9
-0, 255600, 152064, 0xafd63d12
-0, 259200, 152064, 0x162e62b9
-0, 262800, 152064, 0x5c9554be
-0, 266400, 152064, 0x35fbdaa2
-0, 270000, 152064, 0x6438cbd8
-0, 273600, 152064, 0xde0772c9
-0, 277200, 152064, 0x79f82854
-0, 280800, 152064, 0x86957840
-0, 284400, 152064, 0xd9468cbf
-0, 288000, 152064, 0x23e74609
-0, 291600, 152064, 0x3919a146
-0, 295200, 152064, 0xd641078b
-0, 298800, 152064, 0x24397220
-0, 302400, 152064, 0xe7fc3a7c
-0, 306000, 152064, 0x3997154a
-0, 309600, 152064, 0x2af3952c
-0, 313200, 152064, 0x274ac07a
-0, 316800, 152064, 0x288f7b09
-0, 320400, 152064, 0xe6f9b022
-0, 324000, 152064, 0xf09e2fbb
-0, 327600, 152064, 0x7244e477
-0, 331200, 152064, 0x0dfc72eb
-0, 334800, 152064, 0x0322b21f
-0, 338400, 152064, 0x18b08205
-0, 342000, 152064, 0x6606153e
-0, 345600, 152064, 0x85186272
-0, 349200, 152064, 0x3369f064
-0, 352800, 152064, 0xbe0d5a44
-0, 356400, 152064, 0x320258bb
-0, 360000, 152064, 0x4d6fb091
-0, 363600, 152064, 0xc9bbf5e7
-0, 367200, 152064, 0x0aa1b69b
-0, 370800, 152064, 0x85b9ac11
-0, 374400, 152064, 0xb25ff818
-0, 378000, 152064, 0xa155dc25
-0, 381600, 152064, 0xa8e03bfd
-0, 385200, 152064, 0x0a862956
-0, 388800, 152064, 0x11b49264
-0, 392400, 152064, 0xa94e664e
-0, 396000, 152064, 0x330e0fa2
-0, 399600, 152064, 0xaf3d9518
-0, 403200, 152064, 0x0836f2e8
-0, 406800, 152064, 0xbf6dc578
-0, 410400, 152064, 0x7b524d20
-0, 414000, 152064, 0x9ef7677f
-0, 417600, 152064, 0xeacf3f34
-0, 421200, 152064, 0xfb4e3dbe
-0, 424800, 152064, 0xb46e25cb
-0, 428400, 152064, 0x363c1603
-0, 432000, 152064, 0x263fc542
-0, 435600, 152064, 0xf106e548
-0, 439200, 152064, 0xde43c56a
-0, 442800, 152064, 0xc2c4770a
-0, 446400, 152064, 0x122fce19
-0, 450000, 152064, 0x3ba01434
-0, 453600, 152064, 0x0e8ce5ee
-0, 457200, 152064, 0x6ceb82e1
-0, 460800, 152064, 0xa23ee21c
-0, 464400, 152064, 0xc6d960f9
-0, 468000, 152064, 0x0de15258
-0, 471600, 152064, 0x187b0333
-0, 475200, 152064, 0x92e6582f
-0, 478800, 152064, 0xb9586ce0
-0, 482400, 152064, 0xefd803b5
-0, 486000, 152064, 0x24eafb29
-0, 489600, 152064, 0x20c73b14
-0, 493200, 152064, 0xbd7ceaaa
-0, 496800, 152064, 0x775216c8
-0, 500400, 152064, 0xa08971c7
-0, 504000, 152064, 0xef0ee865
-0, 507600, 152064, 0x9ac61c2f
-0, 511200, 152064, 0x52ae8ea9
-0, 514800, 152064, 0x06571c14
-0, 518400, 152064, 0x6e78ad33
-0, 522000, 152064, 0xad01c627
-0, 525600, 152064, 0xbfe074d3
-0, 529200, 152064, 0x9357a183
-0, 532800, 152064, 0x8de7767f
-0, 536400, 152064, 0xa5e6e76e
-0, 540000, 152064, 0xa6f646fe
-0, 543600, 152064, 0x132e99f8
-0, 547200, 152064, 0xb79f27de
-0, 550800, 152064, 0x36d3cdcf
-0, 554400, 152064, 0xdc938336
-0, 558000, 152064, 0xacaa3a7f
-0, 561600, 152064, 0xc61a37fd
-0, 565200, 152064, 0x4fe1ddf0
-0, 568800, 152064, 0xc0f7d660
-0, 572400, 152064, 0xd72458ea
-0, 576000, 152064, 0x6978d123
-0, 579600, 152064, 0x64e60ccf
-0, 583200, 152064, 0xaa07004c
-0, 586800, 152064, 0x07cd1064
-0, 590400, 152064, 0xa82320e5
-0, 594000, 152064, 0xaedd8d30
-0, 597600, 152064, 0x79b082ea
-0, 601200, 152064, 0x9ed800ab
-0, 604800, 152064, 0xde592bb4
-0, 608400, 152064, 0xd966df88
-0, 612000, 152064, 0xf921988a
-0, 615600, 152064, 0x557ad9ae
-0, 619200, 152064, 0xc3f31a9a
-0, 622800, 152064, 0x65248561
-0, 626400, 152064, 0x63df4aa6
-0, 630000, 152064, 0x618da0a9
-0, 633600, 152064, 0xe6f1c435
-0, 637200, 152064, 0x9f90c38f
-0, 640800, 152064, 0xd2853e14
-0, 644400, 152064, 0x6e0268a9
-0, 648000, 152064, 0x393712d1
-0, 651600, 152064, 0x470da25f
-0, 655200, 152064, 0xaf55cb3d
-0, 658800, 152064, 0x6935b8b9
-0, 662400, 152064, 0x5409a15f
-0, 666000, 152064, 0x09073fee
-0, 669600, 152064, 0xfb274e82
-0, 673200, 152064, 0x1a770581
-0, 676800, 152064, 0x17277d0d
-0, 680400, 152064, 0xd4dcd982
-0, 684000, 152064, 0x6b04eaf3
-0, 687600, 152064, 0x8a3d822e
-0, 691200, 152064, 0x1b971ec9
-0, 694800, 152064, 0x14e0c0f6
-0, 698400, 152064, 0x00667450
-0, 702000, 152064, 0xd2385902
-0, 705600, 152064, 0x905da6ab
-0, 709200, 152064, 0xa3ffb18b
-0, 712800, 152064, 0x10d48b19
-0, 716400, 152064, 0xb2c7a3bd
-0, 720000, 152064, 0x45593e96
-0, 723600, 152064, 0x47a0b60c
-0, 727200, 152064, 0x68c6d1b9
-0, 730800, 152064, 0xbc881fcc
-0, 734400, 152064, 0x422cc6f2
-0, 738000, 152064, 0x9b686410
-0, 741600, 152064, 0x35dc5e86
-0, 745200, 152064, 0x247bedaa
-0, 748800, 152064, 0x22b76fd1
-0, 752400, 152064, 0x67cc7a75
-0, 756000, 152064, 0xa197521e
-0, 759600, 152064, 0x428c8662
-0, 763200, 152064, 0x33dc2c73
-0, 766800, 152064, 0x5b538903
-0, 770400, 152064, 0x3c4176b6
-0, 774000, 152064, 0x774364ba
-0, 777600, 152064, 0xf237d03e
-0, 781200, 152064, 0xac8746fb
-0, 784800, 152064, 0x6b306a84
-0, 788400, 152064, 0xa2ace513
-0, 792000, 152064, 0x709c9be7
-0, 795600, 152064, 0x2403f373
-0, 799200, 152064, 0x147bf717
-0, 802800, 152064, 0xe58964c8
-0, 806400, 152064, 0xa0da36fc
-0, 810000, 152064, 0x1ac1355c
-0, 813600, 152064, 0x8a31c9f2
-0, 817200, 152064, 0x42ba205c
-0, 820800, 152064, 0xa11b3575
-0, 824400, 152064, 0xcb35207c
-0, 828000, 152064, 0x528f6189
-0, 831600, 152064, 0x34f05bd7
-0, 835200, 152064, 0x72317356
-0, 838800, 152064, 0xaabd5028
-0, 842400, 152064, 0x13dbeb7b
-0, 846000, 152064, 0x62f1e8a8
-0, 849600, 152064, 0x1723bfcd
-0, 853200, 152064, 0x5c083c00
-0, 856800, 152064, 0x52137894
-0, 860400, 152064, 0xef1e082c
-0, 864000, 152064, 0x664b3d53
-0, 867600, 152064, 0x2eb9b296
-0, 871200, 152064, 0xd0ca511e
-0, 874800, 152064, 0x012d4724
-0, 878400, 152064, 0xa847f5af
-0, 882000, 152064, 0x483a2fde
-0, 885600, 152064, 0xd1ab0257
-0, 889200, 152064, 0x414692c7
-0, 892800, 152064, 0x0b79df88
-0, 896400, 152064, 0xdaa2c4a3
-0, 900000, 152064, 0xd1b44500
-0, 903600, 152064, 0xfd3d2cf3
-0, 907200, 152064, 0xfdc0f748
-0, 910800, 152064, 0xce762a2a
-0, 914400, 152064, 0x08b63572
-0, 918000, 152064, 0x5a46a38d
-0, 921600, 152064, 0x03cee9c0
-0, 925200, 152064, 0x9ee45473
-0, 928800, 152064, 0x5a432386
-0, 932400, 152064, 0x54c83d87
-0, 936000, 152064, 0xc9caa1de
-0, 939600, 152064, 0xa28367f1
-0, 943200, 152064, 0x2607cdf1
-0, 946800, 152064, 0x06baa8de
-0, 950400, 152064, 0xf5346e32
-0, 954000, 152064, 0x6d3e732b
-0, 957600, 152064, 0x798c584b
-0, 961200, 152064, 0x4076c948
-0, 964800, 152064, 0x868cf63a
-0, 968400, 152064, 0x23107ac5
-0, 972000, 152064, 0x306f3fe2
-0, 975600, 152064, 0xbd1d71d6
-0, 979200, 152064, 0x1429545f
-0, 982800, 152064, 0xaded29aa
-0, 986400, 152064, 0x9b455a94
-0, 990000, 152064, 0xb3774ce7
-0, 993600, 152064, 0x92580986
-0, 997200, 152064, 0x0eae2f95
-0, 1000800, 152064, 0x599208b2
-0, 1004400, 152064, 0x4804c04c
-0, 1008000, 152064, 0x5f730e8f
-0, 1011600, 152064, 0x3e501d1e
-0, 1015200, 152064, 0x32100740
-0, 1018800, 152064, 0x62226ff8
-0, 1022400, 152064, 0x7683b622
-0, 1026000, 152064, 0xc3e0aec1
-0, 1029600, 152064, 0xfac12608
-0, 1033200, 152064, 0xb21a5781
-0, 1036800, 152064, 0x8f1e4964
-0, 1040400, 152064, 0x0f62dd6e
-0, 1044000, 152064, 0xac062ac4
-0, 1047600, 152064, 0x1b320f7a
-0, 1051200, 152064, 0x346e7211
-0, 1054800, 152064, 0xe47592f3
-0, 1058400, 152064, 0xa3a7919c
-0, 1062000, 152064, 0xa3580fa6
-0, 1065600, 152064, 0xc73430c1
-0, 1069200, 152064, 0x994a2c18
-0, 1072800, 152064, 0x0b5d8d45
-0, 1076400, 152064, 0x9eed5109
diff --git a/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b b/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b
deleted file mode 100644
index b5778dd..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcalq_brcm_b
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0xf3c68dea
-0, 3600, 152064, 0xf52d483f
-0, 7200, 152064, 0x612f1792
-0, 10800, 152064, 0x4df34726
-0, 14400, 152064, 0xfed7c058
-0, 18000, 152064, 0x2d48025c
-0, 21600, 152064, 0x03544ab9
-0, 25200, 152064, 0x20cadfc5
-0, 28800, 152064, 0x7cd3672e
-0, 32400, 152064, 0x5f2b9ede
-0, 36000, 152064, 0xc0bbdf75
-0, 39600, 152064, 0x95571e7c
-0, 43200, 152064, 0x0d1afc5b
-0, 46800, 152064, 0x9c91c11f
-0, 50400, 152064, 0x73e667e4
-0, 54000, 152064, 0xfb7f8892
-0, 57600, 152064, 0x5707f566
-0, 61200, 152064, 0x21032449
-0, 64800, 152064, 0x199e20b7
-0, 68400, 152064, 0x23213179
-0, 72000, 152064, 0x29812daa
-0, 75600, 152064, 0x04e3eb6b
-0, 79200, 152064, 0xab206165
-0, 82800, 152064, 0x392fbf7b
-0, 86400, 152064, 0x137a1c6a
-0, 90000, 152064, 0x9caff265
-0, 93600, 152064, 0x6becf046
-0, 97200, 152064, 0xfc2c3ba6
-0, 100800, 152064, 0xcf4b9b4c
-0, 104400, 152064, 0x4e2ebd37
-0, 108000, 152064, 0xcd419daa
-0, 111600, 152064, 0xe12294b0
-0, 115200, 152064, 0x6bda7493
-0, 118800, 152064, 0xefbf5d0b
-0, 122400, 152064, 0x9500458a
-0, 126000, 152064, 0x6b5d212e
-0, 129600, 152064, 0xb928fc31
-0, 133200, 152064, 0x64f2bb2f
-0, 136800, 152064, 0xf93a724d
-0, 140400, 152064, 0xdd0d32c0
-0, 144000, 152064, 0xe1b51d95
-0, 147600, 152064, 0xbb43d295
-0, 151200, 152064, 0x6dcea069
-0, 154800, 152064, 0x89d79805
-0, 158400, 152064, 0x50b5dd43
-0, 162000, 152064, 0xe3099e3f
-0, 165600, 152064, 0x003b6ace
-0, 169200, 152064, 0x2213b672
-0, 172800, 152064, 0x5b273093
-0, 176400, 152064, 0xdbfbd9bf
-0, 180000, 152064, 0xf26b89d0
-0, 183600, 152064, 0x1470527e
-0, 187200, 152064, 0x0e668970
-0, 190800, 152064, 0x00218692
-0, 194400, 152064, 0xaabf79a8
-0, 198000, 152064, 0xf68b4663
-0, 201600, 152064, 0x4c08d01f
-0, 205200, 152064, 0x48e75380
-0, 208800, 152064, 0x4b8be58f
-0, 212400, 152064, 0x8a6c1365
-0, 216000, 152064, 0x9439ca02
-0, 219600, 152064, 0x831d9855
-0, 223200, 152064, 0xff031ffd
-0, 226800, 152064, 0x3680f4bc
-0, 230400, 152064, 0x794c95a4
-0, 234000, 152064, 0x23e53349
-0, 237600, 152064, 0x85307117
-0, 241200, 152064, 0x0bc0bf5a
-0, 244800, 152064, 0xc79f46c8
-0, 248400, 152064, 0x48be4e21
-0, 252000, 152064, 0x2ad89b4f
-0, 255600, 152064, 0xd454f9a9
-0, 259200, 152064, 0x64852f6d
-0, 262800, 152064, 0xcb7b0c05
-0, 266400, 152064, 0x4e108ced
-0, 270000, 152064, 0xf5e5a37b
-0, 273600, 152064, 0x224e29c7
-0, 277200, 152064, 0xad90d3c2
-0, 280800, 152064, 0x5ddb5d05
-0, 284400, 152064, 0x4ebf4337
-0, 288000, 152064, 0x7e2bfeed
-0, 291600, 152064, 0x00e884c7
-0, 295200, 152064, 0xa4f6a534
-0, 298800, 152064, 0x622f1511
-0, 302400, 152064, 0x8d99233d
-0, 306000, 152064, 0x5910d02c
-0, 309600, 152064, 0x20d6706c
-0, 313200, 152064, 0x8e30a417
-0, 316800, 152064, 0x180d745a
-0, 320400, 152064, 0xc25189b9
-0, 324000, 152064, 0x909101ad
-0, 327600, 152064, 0x9967be1c
-0, 331200, 152064, 0x72ff3206
-0, 334800, 152064, 0x48d07f48
-0, 338400, 152064, 0x7f8244b7
-0, 342000, 152064, 0xf871e21e
-0, 345600, 152064, 0xd4743610
-0, 349200, 152064, 0xc2c7a7b1
-0, 352800, 152064, 0x95be1a75
-0, 356400, 152064, 0x44972b2e
-0, 360000, 152064, 0xa6036c4f
-0, 363600, 152064, 0xecdd8dd6
-0, 367200, 152064, 0xbb7e8551
-0, 370800, 152064, 0x42916e6c
-0, 374400, 152064, 0x972db010
-0, 378000, 152064, 0x80dab6a0
-0, 381600, 152064, 0xc753ecdb
-0, 385200, 152064, 0x0823bffa
-0, 388800, 152064, 0x80876b2d
-0, 392400, 152064, 0x4a8b2118
-0, 396000, 152064, 0x0be2c13d
-0, 399600, 152064, 0xa6966e4f
-0, 403200, 152064, 0xf6a57650
-0, 406800, 152064, 0x49d66fd4
-0, 410400, 152064, 0x21d92047
-0, 414000, 152064, 0x155f20a8
-0, 417600, 152064, 0x5ab90c1d
-0, 421200, 152064, 0xa0c31337
-0, 424800, 152064, 0xd20de1d6
-0, 428400, 152064, 0x300ad916
-0, 432000, 152064, 0xbcb89eb5
-0, 435600, 152064, 0x08759342
-0, 439200, 152064, 0xa5d06e72
-0, 442800, 152064, 0x3b4c537f
-0, 446400, 152064, 0x7f48912b
-0, 450000, 152064, 0x200dbd1f
-0, 453600, 152064, 0x918abfde
-0, 457200, 152064, 0xd8072cdf
-0, 460800, 152064, 0x89d2902b
-0, 464400, 152064, 0xcd2e2e3c
-0, 468000, 152064, 0xf343e4a2
-0, 471600, 152064, 0xc424acad
-0, 475200, 152064, 0xf71e3031
-0, 478800, 152064, 0xf1bc1179
-0, 482400, 152064, 0x9af58d24
-0, 486000, 152064, 0x48a4d01e
-0, 489600, 152064, 0xcf24f721
-0, 493200, 152064, 0x5bc7b4f3
-0, 496800, 152064, 0x8763fc59
-0, 500400, 152064, 0xb6954051
-0, 504000, 152064, 0x044ba446
-0, 507600, 152064, 0xdaaaee7e
-0, 511200, 152064, 0x8eac550d
-0, 514800, 152064, 0x5191d08c
-0, 518400, 152064, 0x3cd76d43
-0, 522000, 152064, 0xf01f8fa9
-0, 525600, 152064, 0x0e283e9b
-0, 529200, 152064, 0x7cef69ee
-0, 532800, 152064, 0xc8e332bc
-0, 536400, 152064, 0x5b1aa484
-0, 540000, 152064, 0x3975234f
-0, 543600, 152064, 0x52b8661e
-0, 547200, 152064, 0xb4b8fed8
-0, 550800, 152064, 0x5aff9f70
-0, 554400, 152064, 0x7b575735
-0, 558000, 152064, 0x77d51523
-0, 561600, 152064, 0xf5131eba
-0, 565200, 152064, 0x4bd2b1ad
-0, 568800, 152064, 0xccfc8dca
-0, 572400, 152064, 0xcf245472
-0, 576000, 152064, 0xe055adf5
-0, 579600, 152064, 0x2a90e171
-0, 583200, 152064, 0x1bd8ea64
-0, 586800, 152064, 0x32f1d794
-0, 590400, 152064, 0xc938c42a
-0, 594000, 152064, 0x12b5644f
-0, 597600, 152064, 0x99003711
-0, 601200, 152064, 0xaecfad1c
-0, 604800, 152064, 0x94b00ae1
-0, 608400, 152064, 0xbb4f982f
-0, 612000, 152064, 0x6f7f5dc1
-0, 615600, 152064, 0x7be7c2cb
-0, 619200, 152064, 0x3b2ee4d3
-0, 622800, 152064, 0xc75f5666
-0, 626400, 152064, 0xff7a3ede
-0, 630000, 152064, 0x55866b59
-0, 633600, 152064, 0x408b8455
-0, 637200, 152064, 0x96c4ab66
-0, 640800, 152064, 0x1d87f575
-0, 644400, 152064, 0x3a3b17ac
-0, 648000, 152064, 0x9c99e591
-0, 651600, 152064, 0xc1fc663d
-0, 655200, 152064, 0x17b982dd
-0, 658800, 152064, 0x24fe9dad
-0, 662400, 152064, 0xea8760ee
-0, 666000, 152064, 0x23dcefad
-0, 669600, 152064, 0xee6d23f0
-0, 673200, 152064, 0xfddc1962
-0, 676800, 152064, 0xb23190df
-0, 680400, 152064, 0xf066a595
-0, 684000, 152064, 0x2200fef8
-0, 687600, 152064, 0x5491ab2f
-0, 691200, 152064, 0xea93fa58
-0, 694800, 152064, 0x3e13d4f4
-0, 698400, 152064, 0x3dda841d
-0, 702000, 152064, 0xfc243577
-0, 705600, 152064, 0xca4a9127
-0, 709200, 152064, 0x41908ec0
-0, 712800, 152064, 0x10a758bd
-0, 716400, 152064, 0x6a849e5b
-0, 720000, 152064, 0xb55a1f2b
-0, 723600, 152064, 0x2bfe9627
-0, 727200, 152064, 0x2bfca28c
-0, 730800, 152064, 0xd166f336
-0, 734400, 152064, 0x9facb32b
-0, 738000, 152064, 0x6a672475
-0, 741600, 152064, 0xc7b219cf
-0, 745200, 152064, 0x2b43ca53
-0, 748800, 152064, 0x43b542c4
-0, 752400, 152064, 0xdc654337
-0, 756000, 152064, 0x68003d7c
-0, 759600, 152064, 0x3cb85724
-0, 763200, 152064, 0x422701c2
-0, 766800, 152064, 0x1c667870
-0, 770400, 152064, 0x75ef3230
-0, 774000, 152064, 0x0ac82643
-0, 777600, 152064, 0x3eb3a0be
-0, 781200, 152064, 0x482bd77e
-0, 784800, 152064, 0xd3ce1171
-0, 788400, 152064, 0xeaefc7e4
-0, 792000, 152064, 0xa9c67939
-0, 795600, 152064, 0x0af0a25b
-0, 799200, 152064, 0xd094d95a
-0, 802800, 152064, 0xfda42fc6
-0, 806400, 152064, 0x4669f952
-0, 810000, 152064, 0x52d40e98
-0, 813600, 152064, 0x27c36cd1
-0, 817200, 152064, 0xa103b6ce
-0, 820800, 152064, 0x2be9026d
-0, 824400, 152064, 0x2f4ecc59
-0, 828000, 152064, 0x53144cef
-0, 831600, 152064, 0x15d54fc9
-0, 835200, 152064, 0x7e302db7
-0, 838800, 152064, 0x82521901
-0, 842400, 152064, 0x1123cdb6
-0, 846000, 152064, 0x3185878a
-0, 849600, 152064, 0xbb294983
-0, 853200, 152064, 0x83d9fe66
-0, 856800, 152064, 0xede9fb08
-0, 860400, 152064, 0xa543b551
-0, 864000, 152064, 0x39e82734
-0, 867600, 152064, 0xd0447fb5
-0, 871200, 152064, 0x8cc6f502
-0, 874800, 152064, 0xda8d1da8
-0, 878400, 152064, 0xcafdccca
-0, 882000, 152064, 0xbf0e04f4
-0, 885600, 152064, 0x0c6eefec
-0, 889200, 152064, 0xb9026d39
-0, 892800, 152064, 0x0121a7a8
-0, 896400, 152064, 0x453ebbc6
-0, 900000, 152064, 0x14ae15e3
-0, 903600, 152064, 0x51d618e1
-0, 907200, 152064, 0x2254f452
-0, 910800, 152064, 0x8c360633
-0, 914400, 152064, 0x8704d9bc
-0, 918000, 152064, 0xe5d48301
-0, 921600, 152064, 0xf25b7b3f
-0, 925200, 152064, 0xd2ad3b73
-0, 928800, 152064, 0x53db0387
-0, 932400, 152064, 0x2486341c
-0, 936000, 152064, 0x4a24570b
-0, 939600, 152064, 0x0694620a
-0, 943200, 152064, 0xbbc2a302
-0, 946800, 152064, 0x08ad9c02
-0, 950400, 152064, 0x601a63ab
-0, 954000, 152064, 0xe4234a48
-0, 957600, 152064, 0x07702235
-0, 961200, 152064, 0x719dbecf
-0, 964800, 152064, 0xf301a7ad
-0, 968400, 152064, 0xf15c70c3
-0, 972000, 152064, 0x0ab93386
-0, 975600, 152064, 0x99c05adb
-0, 979200, 152064, 0x9ed43530
-0, 982800, 152064, 0xa2f62122
-0, 986400, 152064, 0xf16f4525
-0, 990000, 152064, 0xa3403b4a
-0, 993600, 152064, 0x95521096
-0, 997200, 152064, 0x0d412988
-0, 1000800, 152064, 0x829e080a
-0, 1004400, 152064, 0x0805c1b5
-0, 1008000, 152064, 0xa136be48
-0, 1011600, 152064, 0x0f8de228
-0, 1015200, 152064, 0x272cf2d3
-0, 1018800, 152064, 0xa1df2a5e
-0, 1022400, 152064, 0xf9db8350
-0, 1026000, 152064, 0x5536997d
-0, 1029600, 152064, 0xab83e81e
-0, 1033200, 152064, 0xec791b49
-0, 1036800, 152064, 0x04d03e19
-0, 1040400, 152064, 0xd6a2bd21
-0, 1044000, 152064, 0x2d35f0aa
-0, 1047600, 152064, 0x137bf715
-0, 1051200, 152064, 0x56ef5ae1
-0, 1054800, 152064, 0x9bb5821e
-0, 1058400, 152064, 0x533c7fff
-0, 1062000, 152064, 0x469ad380
-0, 1065600, 152064, 0x75710e84
-0, 1069200, 152064, 0xbbd72551
-0, 1072800, 152064, 0xf1137026
-0, 1076400, 152064, 0x6238412b
diff --git a/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b b/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b
deleted file mode 100644
index 4f6f2ba..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcamapalq_bcrm_b
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0xf8248ceb
-0, 3600, 152064, 0xb6204c81
-0, 7200, 152064, 0x22fb1737
-0, 10800, 152064, 0xce8c3fd7
-0, 14400, 152064, 0xee88cedc
-0, 18000, 152064, 0x1d4209ca
-0, 21600, 152064, 0x6fb15238
-0, 25200, 152064, 0x505200c2
-0, 28800, 152064, 0xb73574ba
-0, 32400, 152064, 0x0586a097
-0, 36000, 152064, 0xed50fe02
-0, 39600, 152064, 0x222221ab
-0, 43200, 152064, 0x8afefd46
-0, 46800, 152064, 0x6832c5cc
-0, 50400, 152064, 0xba4c8110
-0, 54000, 152064, 0x95c07e1e
-0, 57600, 152064, 0xc5d6fde9
-0, 61200, 152064, 0xe75a4921
-0, 64800, 152064, 0x53b61688
-0, 68400, 152064, 0x0335424b
-0, 72000, 152064, 0x621742c7
-0, 75600, 152064, 0x4f69f41b
-0, 79200, 152064, 0x6b3f65d7
-0, 82800, 152064, 0x8dfde04f
-0, 86400, 152064, 0x30750ff5
-0, 90000, 152064, 0xe3d70f3c
-0, 93600, 152064, 0x0c1af825
-0, 97200, 152064, 0x58a53935
-0, 100800, 152064, 0xc63d9e98
-0, 104400, 152064, 0xa85fdc48
-0, 108000, 152064, 0x01bb9784
-0, 111600, 152064, 0xdd5cb509
-0, 115200, 152064, 0x29ae7d2b
-0, 118800, 152064, 0xdb08593e
-0, 122400, 152064, 0x372d5d4e
-0, 126000, 152064, 0x31522664
-0, 129600, 152064, 0x3f13f335
-0, 133200, 152064, 0xfd10c19a
-0, 136800, 152064, 0xef728975
-0, 140400, 152064, 0x8e79234d
-0, 144000, 152064, 0x47022791
-0, 147600, 152064, 0x1ef9d297
-0, 151200, 152064, 0x77bf9738
-0, 154800, 152064, 0xd6bc8f03
-0, 158400, 152064, 0x283ded4a
-0, 162000, 152064, 0xd87098d1
-0, 165600, 152064, 0x300077a2
-0, 169200, 152064, 0x30ffbea4
-0, 172800, 152064, 0x5dc5356b
-0, 176400, 152064, 0x31cce185
-0, 180000, 152064, 0x47fc9148
-0, 183600, 152064, 0x1641491e
-0, 187200, 152064, 0x2184937d
-0, 190800, 152064, 0x126eb74a
-0, 194400, 152064, 0x25c07593
-0, 198000, 152064, 0xb1294e7e
-0, 201600, 152064, 0x8b35f45d
-0, 205200, 152064, 0x54765025
-0, 208800, 152064, 0x1d17e901
-0, 212400, 152064, 0xaeab358d
-0, 216000, 152064, 0xf682c91f
-0, 219600, 152064, 0x0b4c9b06
-0, 223200, 152064, 0x45f326dc
-0, 226800, 152064, 0x132eeda3
-0, 230400, 152064, 0x3c9b8e16
-0, 234000, 152064, 0x1be133c1
-0, 237600, 152064, 0xfa876720
-0, 241200, 152064, 0x1666cdb8
-0, 244800, 152064, 0x362f418f
-0, 248400, 152064, 0x926b4a96
-0, 252000, 152064, 0xee3da1df
-0, 255600, 152064, 0xc11f025d
-0, 259200, 152064, 0x9ba62c19
-0, 262800, 152064, 0x0d66194f
-0, 266400, 152064, 0x2fd09340
-0, 270000, 152064, 0x3dfb9e4d
-0, 273600, 152064, 0xa3192ce6
-0, 277200, 152064, 0x6bfce0e1
-0, 280800, 152064, 0x3b7c5286
-0, 284400, 152064, 0xb52f4bf5
-0, 288000, 152064, 0x30870027
-0, 291600, 152064, 0x6f8e71c3
-0, 295200, 152064, 0x8d41b09a
-0, 298800, 152064, 0xc1ff1d05
-0, 302400, 152064, 0xca54125c
-0, 306000, 152064, 0x3342d823
-0, 309600, 152064, 0xcc4a7542
-0, 313200, 152064, 0x21fc9a9d
-0, 316800, 152064, 0x91587574
-0, 320400, 152064, 0x30929cc2
-0, 324000, 152064, 0xf07606b7
-0, 327600, 152064, 0x0476b876
-0, 331200, 152064, 0x213333dc
-0, 334800, 152064, 0x87c67597
-0, 338400, 152064, 0x05434641
-0, 342000, 152064, 0x959eeffc
-0, 345600, 152064, 0x92a130b4
-0, 349200, 152064, 0x53d0b544
-0, 352800, 152064, 0xaf8c233e
-0, 356400, 152064, 0xd3d4259a
-0, 360000, 152064, 0xa0287753
-0, 363600, 152064, 0xfa23972a
-0, 367200, 152064, 0xacae756d
-0, 370800, 152064, 0xd8b58b5c
-0, 374400, 152064, 0x7db2c755
-0, 378000, 152064, 0x31e7b79a
-0, 381600, 152064, 0xd8660d98
-0, 385200, 152064, 0xdcf0d10d
-0, 388800, 152064, 0x3e6567e6
-0, 392400, 152064, 0xec3530fd
-0, 396000, 152064, 0xf686c61a
-0, 399600, 152064, 0x6e706804
-0, 403200, 152064, 0x5fd4a1a3
-0, 406800, 152064, 0xbb3384f7
-0, 410400, 152064, 0x8ffb14dd
-0, 414000, 152064, 0x01253a73
-0, 417600, 152064, 0xf89c15df
-0, 421200, 152064, 0xda2b0b4c
-0, 424800, 152064, 0xfc9dfcc1
-0, 428400, 152064, 0xfef4f0fa
-0, 432000, 152064, 0x91669bea
-0, 435600, 152064, 0x3664a565
-0, 439200, 152064, 0x32dd7923
-0, 442800, 152064, 0x26825231
-0, 446400, 152064, 0x5f81896e
-0, 450000, 152064, 0x0c64ca2f
-0, 453600, 152064, 0x488bb665
-0, 457200, 152064, 0x4d183a0f
-0, 460800, 152064, 0xed169321
-0, 464400, 152064, 0xcec22917
-0, 468000, 152064, 0xbe04ea6c
-0, 471600, 152064, 0x32b8bf9f
-0, 475200, 152064, 0x9c7c2e13
-0, 478800, 152064, 0x232e3016
-0, 482400, 152064, 0x1b76c08e
-0, 486000, 152064, 0x7425d821
-0, 489600, 152064, 0x0818ff3c
-0, 493200, 152064, 0xb4f2c42b
-0, 496800, 152064, 0xe029f979
-0, 500400, 152064, 0x97c54c2f
-0, 504000, 152064, 0xd101c3b5
-0, 507600, 152064, 0x5ed1f5d4
-0, 511200, 152064, 0xc28264d1
-0, 514800, 152064, 0xa162dd31
-0, 518400, 152064, 0x2ee872ce
-0, 522000, 152064, 0x809a8fce
-0, 525600, 152064, 0xcfcc3ef9
-0, 529200, 152064, 0xa5be6ce3
-0, 532800, 152064, 0xd75930a0
-0, 536400, 152064, 0x28acb80f
-0, 540000, 152064, 0x223f2152
-0, 543600, 152064, 0x0cf070cb
-0, 547200, 152064, 0xcc7d011e
-0, 550800, 152064, 0xb2c2a63c
-0, 554400, 152064, 0x15514caa
-0, 558000, 152064, 0x0c6d18ee
-0, 561600, 152064, 0x33b4265d
-0, 565200, 152064, 0xb4abaaaf
-0, 568800, 152064, 0x26a7a856
-0, 572400, 152064, 0xc75249cc
-0, 576000, 152064, 0x59ccb0e1
-0, 579600, 152064, 0xc613f202
-0, 583200, 152064, 0xd1c0e171
-0, 586800, 152064, 0xa195da2b
-0, 590400, 152064, 0xbc7ed475
-0, 594000, 152064, 0x99206e2c
-0, 597600, 152064, 0x0ef04e03
-0, 601200, 152064, 0x68cbc6a1
-0, 604800, 152064, 0x2a5304b1
-0, 608400, 152064, 0xf017978b
-0, 612000, 152064, 0x94f5641a
-0, 615600, 152064, 0xd681bd8f
-0, 619200, 152064, 0x16e1e3a3
-0, 622800, 152064, 0xe4486c7e
-0, 626400, 152064, 0xa1bd394e
-0, 630000, 152064, 0x49ad5959
-0, 633600, 152064, 0x82219b70
-0, 637200, 152064, 0x64e2abcf
-0, 640800, 152064, 0x6d7d05d8
-0, 644400, 152064, 0xd9ac2251
-0, 648000, 152064, 0xf477eee5
-0, 651600, 152064, 0xb9826a78
-0, 655200, 152064, 0x97828a37
-0, 658800, 152064, 0x12099b1f
-0, 662400, 152064, 0x1ec45fa7
-0, 666000, 152064, 0xfd5501c9
-0, 669600, 152064, 0x6a8b26a3
-0, 673200, 152064, 0xae58ff40
-0, 676800, 152064, 0xc0f47aa1
-0, 680400, 152064, 0x08bfa548
-0, 684000, 152064, 0x7f2ff5ef
-0, 687600, 152064, 0x5efa94a3
-0, 691200, 152064, 0xf786f970
-0, 694800, 152064, 0xab6bc712
-0, 698400, 152064, 0x25647bee
-0, 702000, 152064, 0x54333ad5
-0, 705600, 152064, 0xb3a99413
-0, 709200, 152064, 0xe7a78a0d
-0, 712800, 152064, 0xa5054abc
-0, 716400, 152064, 0xb94896ea
-0, 720000, 152064, 0x9f641bca
-0, 723600, 152064, 0x7363901c
-0, 727200, 152064, 0xd340a000
-0, 730800, 152064, 0x0217f413
-0, 734400, 152064, 0xbbdba6e6
-0, 738000, 152064, 0xabc42617
-0, 741600, 152064, 0xa3442925
-0, 745200, 152064, 0x7d06c7e9
-0, 748800, 152064, 0xa45e32df
-0, 752400, 152064, 0xf5ed407f
-0, 756000, 152064, 0x5ec235d5
-0, 759600, 152064, 0xa5706635
-0, 763200, 152064, 0xa44a209b
-0, 766800, 152064, 0xf2137e37
-0, 770400, 152064, 0x5220508f
-0, 774000, 152064, 0xae6b37da
-0, 777600, 152064, 0xdf09b6cd
-0, 781200, 152064, 0x2d39e1c0
-0, 784800, 152064, 0xc8284a76
-0, 788400, 152064, 0x7d7bbe76
-0, 792000, 152064, 0xcfed7416
-0, 795600, 152064, 0x81caaedd
-0, 799200, 152064, 0x9dcdd771
-0, 802800, 152064, 0x46c1331b
-0, 806400, 152064, 0xace60efa
-0, 810000, 152064, 0x9e0909f7
-0, 813600, 152064, 0x72f5a321
-0, 817200, 152064, 0x68f8cdcc
-0, 820800, 152064, 0xcc59fdd9
-0, 824400, 152064, 0xc0a700c6
-0, 828000, 152064, 0xf4254dcf
-0, 831600, 152064, 0xc59b46d1
-0, 835200, 152064, 0x2e5b2524
-0, 838800, 152064, 0x46051293
-0, 842400, 152064, 0x3cbcd1cd
-0, 846000, 152064, 0x9f308587
-0, 849600, 152064, 0x6b91633f
-0, 853200, 152064, 0xb7191012
-0, 856800, 152064, 0xd2fd030f
-0, 860400, 152064, 0x15a0ae2e
-0, 864000, 152064, 0xac3920d0
-0, 867600, 152064, 0x0eef80aa
-0, 871200, 152064, 0x319008f1
-0, 874800, 152064, 0x7734450c
-0, 878400, 152064, 0xf112df62
-0, 882000, 152064, 0x1dd8ffae
-0, 885600, 152064, 0x655ef429
-0, 889200, 152064, 0x27026213
-0, 892800, 152064, 0x5c14b015
-0, 896400, 152064, 0x9512abeb
-0, 900000, 152064, 0x961812b2
-0, 903600, 152064, 0xb8890aea
-0, 907200, 152064, 0x4519db9a
-0, 910800, 152064, 0xf358034a
-0, 914400, 152064, 0x45d9f2ab
-0, 918000, 152064, 0xebd47e7d
-0, 921600, 152064, 0x15578be9
-0, 925200, 152064, 0x1b373b2d
-0, 928800, 152064, 0xbbe707e5
-0, 932400, 152064, 0x5bf62385
-0, 936000, 152064, 0x832e6ef5
-0, 939600, 152064, 0x761e5968
-0, 943200, 152064, 0x251f984d
-0, 946800, 152064, 0xbda48899
-0, 950400, 152064, 0x3fd843b9
-0, 954000, 152064, 0x00485425
-0, 957600, 152064, 0x4e282b39
-0, 961200, 152064, 0x2630a8ea
-0, 964800, 152064, 0x5ea5c973
-0, 968400, 152064, 0xfc436d21
-0, 972000, 152064, 0x69852ef5
-0, 975600, 152064, 0x44cb5589
-0, 979200, 152064, 0x32f32725
-0, 982800, 152064, 0x54d50aca
-0, 986400, 152064, 0xe7a639bb
-0, 990000, 152064, 0x01be2ad5
-0, 993600, 152064, 0x5c63eca4
-0, 997200, 152064, 0x94e91116
-0, 1000800, 152064, 0x9a8be637
-0, 1004400, 152064, 0x165d9a12
-0, 1008000, 152064, 0x8c25ca0a
-0, 1011600, 152064, 0x4ee2ed32
-0, 1015200, 152064, 0x4b2fe0c6
-0, 1018800, 152064, 0x521e434e
-0, 1022400, 152064, 0x97679d7e
-0, 1026000, 152064, 0x886b9506
-0, 1029600, 152064, 0x4283eda8
-0, 1033200, 152064, 0xef793c49
-0, 1036800, 152064, 0x68ac2afe
-0, 1040400, 152064, 0x3d1ab510
-0, 1044000, 152064, 0x98d3ec95
-0, 1047600, 152064, 0x09f7e512
-0, 1051200, 152064, 0x801355dd
-0, 1054800, 152064, 0xf2e87a11
-0, 1058400, 152064, 0x16757601
-0, 1062000, 152064, 0x3074d74a
-0, 1065600, 152064, 0xec8c1290
-0, 1069200, 152064, 0x46fb1877
-0, 1072800, 152064, 0xf0b662c4
-0, 1076400, 152064, 0xf8683940
diff --git a/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b b/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b
deleted file mode 100644
index 6d2e27a..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcamolq_brcm_b
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0xac83f54f
-0, 3600, 152064, 0x4d673b43
-0, 7200, 152064, 0x9050731f
-0, 10800, 152064, 0x4a0741f3
-0, 14400, 152064, 0xb2371c28
-0, 18000, 152064, 0x42210524
-0, 21600, 152064, 0x385f4be5
-0, 25200, 152064, 0xe44ec27a
-0, 28800, 152064, 0xfc668399
-0, 32400, 152064, 0x903fe200
-0, 36000, 152064, 0x4da1deaa
-0, 39600, 152064, 0x68c956ab
-0, 43200, 152064, 0x9cfad799
-0, 46800, 152064, 0x841ed3cd
-0, 50400, 152064, 0x99e66b48
-0, 54000, 152064, 0xcfa28482
-0, 57600, 152064, 0x72f2c717
-0, 61200, 152064, 0xd1d92c80
-0, 64800, 152064, 0x595063eb
-0, 68400, 152064, 0x87373979
-0, 72000, 152064, 0xfa0e75ac
-0, 75600, 152064, 0x0cef3592
-0, 79200, 152064, 0xecfc9c9a
-0, 82800, 152064, 0x5776ff23
-0, 86400, 152064, 0x83419e37
-0, 90000, 152064, 0x4bb31524
-0, 93600, 152064, 0xad8e1bdc
-0, 97200, 152064, 0x7243b6cb
-0, 100800, 152064, 0xf016cda0
-0, 104400, 152064, 0xa2c1d730
-0, 108000, 152064, 0x7999d704
-0, 111600, 152064, 0x86ad0baf
-0, 115200, 152064, 0x35dafe62
-0, 118800, 152064, 0xcb2f5de2
-0, 122400, 152064, 0x3542eb82
-0, 126000, 152064, 0xa704dd92
-0, 129600, 152064, 0x3e50ed92
-0, 133200, 152064, 0x2fe5428a
-0, 136800, 152064, 0xf05dab9d
-0, 140400, 152064, 0xef40c2a3
-0, 144000, 152064, 0x2df8983f
-0, 147600, 152064, 0x0a205c93
-0, 151200, 152064, 0x505562ea
-0, 154800, 152064, 0x24114860
-0, 158400, 152064, 0x2eecccc1
-0, 162000, 152064, 0xc809105f
-0, 165600, 152064, 0x394ab285
-0, 169200, 152064, 0xfda68f17
-0, 172800, 152064, 0x2fd66a51
-0, 176400, 152064, 0x3abb891a
-0, 180000, 152064, 0x62266682
-0, 183600, 152064, 0x68fb38e9
-0, 187200, 152064, 0xae4b9d9b
-0, 190800, 152064, 0xdaf8e150
-0, 194400, 152064, 0x2fd8bf74
-0, 198000, 152064, 0xd2ad6c38
-0, 201600, 152064, 0x76290574
-0, 205200, 152064, 0xaea6b9be
-0, 208800, 152064, 0xd0d797d7
-0, 212400, 152064, 0x87ad00b2
-0, 216000, 152064, 0xe57d11d0
-0, 219600, 152064, 0x25a5c567
-0, 223200, 152064, 0x477e2202
-0, 226800, 152064, 0xaa0618ca
-0, 230400, 152064, 0xb5d2262b
-0, 234000, 152064, 0xae7c135d
-0, 237600, 152064, 0xddb86a7c
-0, 241200, 152064, 0x59bad3ba
-0, 244800, 152064, 0x0b155178
-0, 248400, 152064, 0xc2f265d9
-0, 252000, 152064, 0xb550e8a8
-0, 255600, 152064, 0x1fef6cbc
-0, 259200, 152064, 0xd3d4e578
-0, 262800, 152064, 0x70d20c0d
-0, 266400, 152064, 0xbb8e95a9
-0, 270000, 152064, 0x2a92cda3
-0, 273600, 152064, 0xc0a5e7e0
-0, 277200, 152064, 0x15b99dab
-0, 280800, 152064, 0x536d44e8
-0, 284400, 152064, 0xe43fb4fa
-0, 288000, 152064, 0xdb0873b0
-0, 291600, 152064, 0xc7901e9b
-0, 295200, 152064, 0x36b69923
-0, 298800, 152064, 0xc6a8ac8d
-0, 302400, 152064, 0xd7e4c595
-0, 306000, 152064, 0x2d64cf38
-0, 309600, 152064, 0x007878b1
-0, 313200, 152064, 0xc9c997d4
-0, 316800, 152064, 0xf9de12de
-0, 320400, 152064, 0x25982d54
-0, 324000, 152064, 0xea5eef7c
-0, 327600, 152064, 0x108aceb2
-0, 331200, 152064, 0x3cbac8c8
-0, 334800, 152064, 0x581ec9e1
-0, 338400, 152064, 0xc898bd7d
-0, 342000, 152064, 0x142a0235
-0, 345600, 152064, 0xf9d0aa7e
-0, 349200, 152064, 0xb9fe0bc4
-0, 352800, 152064, 0x21889912
-0, 356400, 152064, 0x3fb2ab18
diff --git a/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c b/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c
deleted file mode 100644
index fe47465..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcanl_brcm_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x2744afa1
-0, 3600, 152064, 0x17246583
-0, 7200, 152064, 0x501836ed
-0, 10800, 152064, 0xe90d6961
-0, 14400, 152064, 0x27abe1ad
-0, 18000, 152064, 0xcfc730e4
-0, 21600, 152064, 0xeaaa83ee
-0, 25200, 152064, 0xb5d80ebd
-0, 28800, 152064, 0x1e1b9d03
-0, 32400, 152064, 0x60e7cf33
-0, 36000, 152064, 0xc44616b1
-0, 39600, 152064, 0x0a2a5906
-0, 43200, 152064, 0xf101309c
-0, 46800, 152064, 0x0b57f348
-0, 50400, 152064, 0x4f018c05
-0, 54000, 152064, 0x22359c60
-0, 57600, 152064, 0x020f1cc3
-0, 61200, 152064, 0x15be3892
-0, 64800, 152064, 0x834a2e23
-0, 68400, 152064, 0x1176586c
-0, 72000, 152064, 0x9cf25641
-0, 75600, 152064, 0xc1c4051d
-0, 79200, 152064, 0x790d8bfa
-0, 82800, 152064, 0x4dcbe7d7
-0, 86400, 152064, 0xe81d3b7b
-0, 90000, 152064, 0xe9e21309
-0, 93600, 152064, 0x22021dbc
-0, 97200, 152064, 0x430c5ecb
-0, 100800, 152064, 0xf524be8b
-0, 104400, 152064, 0xa437dadc
-0, 108000, 152064, 0xff00b440
-0, 111600, 152064, 0x4bd1bf15
-0, 115200, 152064, 0x1f46a3ea
-0, 118800, 152064, 0x60b47c5e
-0, 122400, 152064, 0x45117ac6
-0, 126000, 152064, 0x43894fca
-0, 129600, 152064, 0x21572b55
-0, 133200, 152064, 0xe96def09
-0, 136800, 152064, 0x4d2ab41f
-0, 140400, 152064, 0x072d6b06
-0, 144000, 152064, 0x81865687
-0, 147600, 152064, 0x8d9a0ea6
-0, 151200, 152064, 0x1484d3cd
-0, 154800, 152064, 0xbdabae6b
-0, 158400, 152064, 0x4211edbe
-0, 162000, 152064, 0xd84dad6d
-0, 165600, 152064, 0xe4e79344
-0, 169200, 152064, 0x9c1addd7
-0, 172800, 152064, 0xdcf94283
-0, 176400, 152064, 0x6bd005b2
-0, 180000, 152064, 0x9679bd10
-0, 183600, 152064, 0x052064ab
-0, 187200, 152064, 0x915db3f3
-0, 190800, 152064, 0xec2fbd58
-0, 194400, 152064, 0x26728258
-0, 198000, 152064, 0x2b2b617f
-0, 201600, 152064, 0x2339eb3d
-0, 205200, 152064, 0xcf6e6773
-0, 208800, 152064, 0xb993efe4
-0, 212400, 152064, 0x4054253d
-0, 216000, 152064, 0x4befe5b5
-0, 219600, 152064, 0x0678c0fa
-0, 223200, 152064, 0xe3c54a03
-0, 226800, 152064, 0xffa3210c
-0, 230400, 152064, 0xed04b823
-0, 234000, 152064, 0x00926457
-0, 237600, 152064, 0xd56aaaf0
-0, 241200, 152064, 0x6047ef6e
-0, 244800, 152064, 0x44316d07
-0, 248400, 152064, 0xe8a879b7
-0, 252000, 152064, 0x1856cd86
-0, 255600, 152064, 0x6528349a
-0, 259200, 152064, 0xdeff676e
-0, 262800, 152064, 0xda412e47
-0, 266400, 152064, 0xa2c2a96f
-0, 270000, 152064, 0xc703b8cd
-0, 273600, 152064, 0x20b0650b
-0, 277200, 152064, 0x8c14faa5
-0, 280800, 152064, 0xa442706c
-0, 284400, 152064, 0x6e456137
-0, 288000, 152064, 0x6dde11c6
-0, 291600, 152064, 0xb017978a
-0, 295200, 152064, 0xc0bad34b
-0, 298800, 152064, 0x8bd439ee
-0, 302400, 152064, 0xa92735e4
-0, 306000, 152064, 0x1623f501
-0, 309600, 152064, 0x5be980b2
-0, 313200, 152064, 0x4306b9bf
-0, 316800, 152064, 0xb4f18976
-0, 320400, 152064, 0x4ffb9b46
-0, 324000, 152064, 0x23082275
-0, 327600, 152064, 0xc7f0e087
-0, 331200, 152064, 0x68b95327
-0, 334800, 152064, 0xd030a8e4
-0, 338400, 152064, 0xf8f9615c
-0, 342000, 152064, 0x1b26fe3e
-0, 345600, 152064, 0x3381608d
-0, 349200, 152064, 0x9939d49d
-0, 352800, 152064, 0x575f4f94
-0, 356400, 152064, 0x436c581c
-0, 360000, 152064, 0x8f47aa58
-0, 363600, 152064, 0xd251d95a
-0, 367200, 152064, 0x3c33b32c
-0, 370800, 152064, 0xa1e19413
-0, 374400, 152064, 0x8d95cbad
-0, 378000, 152064, 0x98cbd35e
-0, 381600, 152064, 0xceb81a0f
-0, 385200, 152064, 0x5490fab1
-0, 388800, 152064, 0x8e57a38c
-0, 392400, 152064, 0xc379517a
-0, 396000, 152064, 0xafc4f747
-0, 399600, 152064, 0xbc9c9be4
-0, 403200, 152064, 0xd602b2f5
-0, 406800, 152064, 0x8d85a450
-0, 410400, 152064, 0x48183c74
-0, 414000, 152064, 0xd1725590
-0, 417600, 152064, 0x5ef42ed7
-0, 421200, 152064, 0xad3a3883
-0, 424800, 152064, 0x7a3e0ddd
-0, 428400, 152064, 0x59bdfd38
-0, 432000, 152064, 0x5ac3ba9f
-0, 435600, 152064, 0x266cbd00
-0, 439200, 152064, 0x97d29e00
-0, 442800, 152064, 0x620774c2
-0, 446400, 152064, 0xaae8b96f
-0, 450000, 152064, 0x5f6bdfb6
-0, 453600, 152064, 0xb239da53
-0, 457200, 152064, 0x654b5680
-0, 460800, 152064, 0xd796b723
-0, 464400, 152064, 0xd5c84a81
-0, 468000, 152064, 0x2a761652
-0, 471600, 152064, 0x1137e145
-0, 475200, 152064, 0x1a9a451b
-0, 478800, 152064, 0x5ca751c4
-0, 482400, 152064, 0x074acec7
-0, 486000, 152064, 0x9ddfe77d
-0, 489600, 152064, 0xfb211c29
-0, 493200, 152064, 0x681ad4dd
-0, 496800, 152064, 0x702c12cc
-0, 500400, 152064, 0x556c5101
-0, 504000, 152064, 0x39d4bb54
-0, 507600, 152064, 0xa3a118d6
-0, 511200, 152064, 0xb78b7db1
-0, 514800, 152064, 0x4e20eed5
-0, 518400, 152064, 0x6555a9df
-0, 522000, 152064, 0xb607a9a4
-0, 525600, 152064, 0x3cf96a94
-0, 529200, 152064, 0xb2679007
-0, 532800, 152064, 0xf09d5b85
-0, 536400, 152064, 0x3961ba07
-0, 540000, 152064, 0x0c28363a
-0, 543600, 152064, 0x0a017c2d
-0, 547200, 152064, 0x3a661de3
-0, 550800, 152064, 0xf8d1bdee
-0, 554400, 152064, 0x6f47791b
-0, 558000, 152064, 0xe05b22c6
-0, 561600, 152064, 0x7cc93bb0
-0, 565200, 152064, 0xeb90c3d8
-0, 568800, 152064, 0x1a1eac98
-0, 572400, 152064, 0x92985671
-0, 576000, 152064, 0x2fe3ce53
-0, 579600, 152064, 0x61def691
-0, 583200, 152064, 0x90820730
-0, 586800, 152064, 0x17630372
-0, 590400, 152064, 0xaf6cea12
-0, 594000, 152064, 0xfe3b7ecc
-0, 597600, 152064, 0x904a5b2e
-0, 601200, 152064, 0x0d88d5f2
-0, 604800, 152064, 0x498d22b1
-0, 608400, 152064, 0x56baba83
-0, 612000, 152064, 0xda4d6dfa
-0, 615600, 152064, 0xaa38cbdd
-0, 619200, 152064, 0x4077f15d
-0, 622800, 152064, 0x7e006ec2
-0, 626400, 152064, 0x59964a89
-0, 630000, 152064, 0x04c078e3
-0, 633600, 152064, 0x7a5faf97
-0, 637200, 152064, 0xc517b3e9
-0, 640800, 152064, 0xfcc81af5
-0, 644400, 152064, 0xdcb44f62
-0, 648000, 152064, 0x2a080b72
-0, 651600, 152064, 0x91f88c67
-0, 655200, 152064, 0xd39caf81
-0, 658800, 152064, 0x0764ae31
-0, 662400, 152064, 0x0ddb82ed
-0, 666000, 152064, 0xed6d17e4
-0, 669600, 152064, 0xb4f74712
-0, 673200, 152064, 0x23a20787
-0, 676800, 152064, 0x853e7b33
-0, 680400, 152064, 0xc6bac173
-0, 684000, 152064, 0xb590ec15
-0, 687600, 152064, 0xfdd2943c
-0, 691200, 152064, 0xba5d1160
-0, 694800, 152064, 0xe732c5a7
-0, 698400, 152064, 0x279f6ce9
-0, 702000, 152064, 0xb3835829
-0, 705600, 152064, 0x0901b2a1
-0, 709200, 152064, 0x3df2b8f8
-0, 712800, 152064, 0x374496a4
-0, 716400, 152064, 0x1bc6a4ae
-0, 720000, 152064, 0xdb4b372e
-0, 723600, 152064, 0x8c11c214
-0, 727200, 152064, 0xd2d5c093
-0, 730800, 152064, 0x8dda094e
-0, 734400, 152064, 0x9b2cc401
-0, 738000, 152064, 0x1a3b49d5
-0, 741600, 152064, 0xaf5342ff
-0, 745200, 152064, 0x74c0de83
-0, 748800, 152064, 0xcf486137
-0, 752400, 152064, 0xcf005b3b
-0, 756000, 152064, 0x86a64c55
-0, 759600, 152064, 0xdd3f7ae9
-0, 763200, 152064, 0xb0d01e53
-0, 766800, 152064, 0x83219065
-0, 770400, 152064, 0x17a35d27
-0, 774000, 152064, 0xf92645b5
-0, 777600, 152064, 0x8322bdbf
-0, 781200, 152064, 0xd589f6a2
-0, 784800, 152064, 0x80a62d9e
-0, 788400, 152064, 0x05b3e0d1
-0, 792000, 152064, 0xd657aa0b
-0, 795600, 152064, 0xec5ac2dd
-0, 799200, 152064, 0xbf0ff969
-0, 802800, 152064, 0xc34a5140
-0, 806400, 152064, 0x814705c4
-0, 810000, 152064, 0xe9592008
-0, 813600, 152064, 0xf12c933c
-0, 817200, 152064, 0x2daee178
-0, 820800, 152064, 0xa2573028
-0, 824400, 152064, 0x6109f58d
-0, 828000, 152064, 0x64ab8ce4
-0, 831600, 152064, 0x13a88b6e
-0, 835200, 152064, 0x8f0181a9
-0, 838800, 152064, 0xd5295fd4
-0, 842400, 152064, 0xfdbeeb0d
-0, 846000, 152064, 0x05ecd231
-0, 849600, 152064, 0x48d164cd
-0, 853200, 152064, 0xc279cf63
-0, 856800, 152064, 0x1d5e6a03
-0, 860400, 152064, 0xd9dc1807
-0, 864000, 152064, 0xbcc83676
-0, 867600, 152064, 0x65a9811e
-0, 871200, 152064, 0x3ccfe5a8
-0, 874800, 152064, 0x2f2ff051
-0, 878400, 152064, 0x9193e093
-0, 882000, 152064, 0x9a30fdc6
-0, 885600, 152064, 0x90b7ea10
-0, 889200, 152064, 0x3291910c
-0, 892800, 152064, 0x2335d186
-0, 896400, 152064, 0x2890cf1d
-0, 900000, 152064, 0x8c8b6245
-0, 903600, 152064, 0x24b84eda
-0, 907200, 152064, 0x04a12446
-0, 910800, 152064, 0xd9d91d51
-0, 914400, 152064, 0xbf450adf
-0, 918000, 152064, 0xa19a9a41
-0, 921600, 152064, 0x2211ab01
-0, 925200, 152064, 0x8fe85430
-0, 928800, 152064, 0x5a152861
-0, 932400, 152064, 0x7fe76995
-0, 936000, 152064, 0x508b99cd
-0, 939600, 152064, 0x92e79437
-0, 943200, 152064, 0x8572eac9
-0, 946800, 152064, 0x42e3d513
-0, 950400, 152064, 0x6bee9e38
-0, 954000, 152064, 0x2858ad4b
-0, 957600, 152064, 0x96d87d00
-0, 961200, 152064, 0x749f1032
-0, 964800, 152064, 0x668fca6c
-0, 968400, 152064, 0x11d278d9
-0, 972000, 152064, 0x10fd46ea
-0, 975600, 152064, 0xc8b193c8
-0, 979200, 152064, 0x035e7d02
-0, 982800, 152064, 0x067f583c
-0, 986400, 152064, 0xd9648a1e
-0, 990000, 152064, 0x92487b7e
-0, 993600, 152064, 0xc7b35421
-0, 997200, 152064, 0x2ed57c1c
-0, 1000800, 152064, 0xefe24c5f
-0, 1004400, 152064, 0x8df0118b
-0, 1008000, 152064, 0x18f0278d
-0, 1011600, 152064, 0x63ac45ad
-0, 1015200, 152064, 0xd79849f0
-0, 1018800, 152064, 0x1f1d4dab
-0, 1022400, 152064, 0x736fb5b8
-0, 1026000, 152064, 0xc24eb80c
-0, 1029600, 152064, 0x64ca3b11
-0, 1033200, 152064, 0x35d8674c
-0, 1036800, 152064, 0x3c5a7b51
-0, 1040400, 152064, 0x97550b81
-0, 1044000, 152064, 0x731454b5
-0, 1047600, 152064, 0x01de43bc
-0, 1051200, 152064, 0xbda7afae
-0, 1054800, 152064, 0xeb34d714
-0, 1058400, 152064, 0x1260cc98
-0, 1062000, 152064, 0x7e592c36
-0, 1065600, 152064, 0x40b3676e
-0, 1069200, 152064, 0x8c9d6b94
-0, 1072800, 152064, 0xc7988665
-0, 1076400, 152064, 0xf2994d52
diff --git a/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b b/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b
deleted file mode 100644
index bc41f24..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcaq2lq_brcm_b
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0x712a2ad3
-0, 3600, 152064, 0x83420c9d
-0, 7200, 152064, 0xf3d77f46
-0, 10800, 152064, 0x67eab1a2
-0, 14400, 152064, 0x41df4534
-0, 18000, 152064, 0x68f268ce
-0, 21600, 152064, 0x288debdf
-0, 25200, 152064, 0x46ae56a7
-0, 28800, 152064, 0x1720f327
-0, 32400, 152064, 0x64752592
-0, 36000, 152064, 0x43e17a27
-0, 39600, 152064, 0x39f7cc52
-0, 43200, 152064, 0xc19a785c
-0, 46800, 152064, 0x562df0d4
-0, 50400, 152064, 0x50c96da0
-0, 54000, 152064, 0x1da8bdb5
-0, 57600, 152064, 0x02ddfb59
-0, 61200, 152064, 0x4d0c3e0e
-0, 64800, 152064, 0x1605371b
-0, 68400, 152064, 0x9772464d
-0, 72000, 152064, 0xc603441c
-0, 75600, 152064, 0xf9581917
-0, 79200, 152064, 0x4dbf74af
-0, 82800, 152064, 0x04b8b820
-0, 86400, 152064, 0x75061cdf
-0, 90000, 152064, 0x760bea90
-0, 93600, 152064, 0x7114cab3
-0, 97200, 152064, 0x89e14328
-0, 100800, 152064, 0x402ba116
-0, 104400, 152064, 0x8af2ccc6
-0, 108000, 152064, 0x1294333a
-0, 111600, 152064, 0xe466aa9f
-0, 115200, 152064, 0x7ce28426
-0, 118800, 152064, 0x21c16487
-0, 122400, 152064, 0xde3d5fc9
-0, 126000, 152064, 0x58cb2906
-0, 129600, 152064, 0x1df514ec
-0, 133200, 152064, 0x7e45bfb6
-0, 136800, 152064, 0xcdaaafc0
-0, 140400, 152064, 0x70a58eac
-0, 144000, 152064, 0xca7263b0
-0, 147600, 152064, 0x022621e0
-0, 151200, 152064, 0x938901c2
-0, 154800, 152064, 0x8c099e47
-0, 158400, 152064, 0xebfecda0
-0, 162000, 152064, 0x5a3aff71
-0, 165600, 152064, 0xb47c6692
-0, 169200, 152064, 0xde04b626
-0, 172800, 152064, 0xb1c61c94
-0, 176400, 152064, 0xbcc7eb35
-0, 180000, 152064, 0x801b958d
-0, 183600, 152064, 0xf5254f5d
-0, 187200, 152064, 0x4336da49
-0, 190800, 152064, 0x3139bcaf
-0, 194400, 152064, 0xb8359026
-0, 198000, 152064, 0xb6d39756
-0, 201600, 152064, 0xdf5c1c14
-0, 205200, 152064, 0x3f587336
-0, 208800, 152064, 0x105eeb74
-0, 212400, 152064, 0xffe23c19
-0, 216000, 152064, 0xfb1a1c5e
-0, 219600, 152064, 0xb8edb942
-0, 223200, 152064, 0x7ca92b27
-0, 226800, 152064, 0xd2fe1e24
-0, 230400, 152064, 0xd6b8939a
-0, 234000, 152064, 0xd59743da
-0, 237600, 152064, 0x005d9e7a
-0, 241200, 152064, 0x4c5cb03e
-0, 244800, 152064, 0x4a7c363a
-0, 248400, 152064, 0x627c88a8
-0, 252000, 152064, 0x3fcd8650
-0, 255600, 152064, 0x75b7f0b3
-0, 259200, 152064, 0xcbb95a00
-0, 262800, 152064, 0xc9871783
-0, 266400, 152064, 0xe9c2b471
-0, 270000, 152064, 0x513f0eb3
-0, 273600, 152064, 0x5a5c4fdc
-0, 277200, 152064, 0xdc8cbab6
-0, 280800, 152064, 0x86fe75d2
-0, 284400, 152064, 0xa6d52ce2
-0, 288000, 152064, 0xde74a975
-0, 291600, 152064, 0xc1bf3ef2
-0, 295200, 152064, 0xa1a1b832
-0, 298800, 152064, 0x0b23f718
-0, 302400, 152064, 0x842eed85
-0, 306000, 152064, 0xda96923b
-0, 309600, 152064, 0x7d011f83
-0, 313200, 152064, 0x26a25528
-0, 316800, 152064, 0x117b7971
-0, 320400, 152064, 0x3f17b29d
-0, 324000, 152064, 0x428654c0
-0, 327600, 152064, 0xc2343316
-0, 331200, 152064, 0x284371fe
-0, 334800, 152064, 0x388ef972
-0, 338400, 152064, 0x5f046560
-0, 342000, 152064, 0x6e9ac7e9
-0, 345600, 152064, 0x0cd6277c
-0, 349200, 152064, 0xfc7ba0b1
-0, 352800, 152064, 0x4d840475
-0, 356400, 152064, 0xd4cb26a6
diff --git a/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a b/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a
deleted file mode 100644
index cbfc568..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcv_brcm_a
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x995bb4bd
-0, 3600, 152064, 0xad287357
-0, 7200, 152064, 0x38fa4661
-0, 10800, 152064, 0x8aae73cf
-0, 14400, 152064, 0x4a13eada
-0, 18000, 152064, 0x48b33901
-0, 21600, 152064, 0x011487bc
-0, 25200, 152064, 0xd4ce1925
-0, 28800, 152064, 0x5d679ddd
-0, 32400, 152064, 0x276cd5cf
-0, 36000, 152064, 0x99c625f0
-0, 39600, 152064, 0xb2f756d1
-0, 43200, 152064, 0xb19c2978
-0, 46800, 152064, 0xdac0ff3c
-0, 50400, 152064, 0x3c1c8d63
-0, 54000, 152064, 0x818ea0a8
-0, 57600, 152064, 0xa7c122a5
-0, 61200, 152064, 0x67ad3519
-0, 64800, 152064, 0xc81b2a88
-0, 68400, 152064, 0x8ae6633e
-0, 72000, 152064, 0xed945788
-0, 75600, 152064, 0x4c740bcb
-0, 79200, 152064, 0xd8408d09
-0, 82800, 152064, 0xb710e8b8
-0, 86400, 152064, 0xb8c647b9
-0, 90000, 152064, 0x802b2e23
-0, 93600, 152064, 0x30672529
-0, 97200, 152064, 0x328a72b6
-0, 100800, 152064, 0xeb6dbe94
-0, 104400, 152064, 0x1c19dcc5
-0, 108000, 152064, 0xfdc6b998
-0, 111600, 152064, 0xf9e2cd80
-0, 115200, 152064, 0x025eb15e
-0, 118800, 152064, 0xfd998ad8
-0, 122400, 152064, 0x8fdf736f
-0, 126000, 152064, 0xa5a7554a
-0, 129600, 152064, 0xcea63304
-0, 133200, 152064, 0xcb28ec28
-0, 136800, 152064, 0x92efb591
-0, 140400, 152064, 0x0f2376c3
-0, 144000, 152064, 0xe9cb5ecf
-0, 147600, 152064, 0xcd2d0eba
-0, 151200, 152064, 0xd57fe4fd
-0, 154800, 152064, 0xc486ab8e
-0, 158400, 152064, 0x01a1f709
-0, 162000, 152064, 0x7ac5b13a
-0, 165600, 152064, 0x6f519279
-0, 169200, 152064, 0xfd7cd9a0
-0, 172800, 152064, 0xfae649d2
-0, 176400, 152064, 0x618507ca
-0, 180000, 152064, 0xb177bc15
-0, 183600, 152064, 0x6fa36854
-0, 187200, 152064, 0xc13cb77d
-0, 190800, 152064, 0x6d40cb01
-0, 194400, 152064, 0xa3db96a2
-0, 198000, 152064, 0xe5ba6c99
-0, 201600, 152064, 0xca9ff3ee
-0, 205200, 152064, 0x6c016c65
-0, 208800, 152064, 0xdf93ed80
-0, 212400, 152064, 0x93112ec8
-0, 216000, 152064, 0x8ab3ea14
-0, 219600, 152064, 0x02f5b891
-0, 223200, 152064, 0xdafd562b
-0, 226800, 152064, 0xa96a2bd7
-0, 230400, 152064, 0xdff8bc68
-0, 234000, 152064, 0x8d956b4b
-0, 237600, 152064, 0xb4aeb960
-0, 241200, 152064, 0x391cf0dd
-0, 244800, 152064, 0x03137de9
-0, 248400, 152064, 0x2bfa8c4b
-0, 252000, 152064, 0xfb54d3a5
-0, 255600, 152064, 0x650146e7
-0, 259200, 152064, 0xd3a7765f
-0, 262800, 152064, 0x49d72b90
-0, 266400, 152064, 0xf089b357
-0, 270000, 152064, 0x23a2be41
-0, 273600, 152064, 0x2ea86592
-0, 277200, 152064, 0x99d6f56b
-0, 280800, 152064, 0xc2ca75b9
-0, 284400, 152064, 0x390b7278
-0, 288000, 152064, 0x0f6d1f1e
-0, 291600, 152064, 0x79e2a3f4
-0, 295200, 152064, 0x51d5e1da
-0, 298800, 152064, 0xdb57419a
-0, 302400, 152064, 0xf90a4153
-0, 306000, 152064, 0xd192f6c6
-0, 309600, 152064, 0x8cd3895a
-0, 313200, 152064, 0x0d3ec577
-0, 316800, 152064, 0x146e8492
-0, 320400, 152064, 0xc9939c22
-0, 324000, 152064, 0xf1f4275e
-0, 327600, 152064, 0xb898eb35
-0, 331200, 152064, 0xed315ee9
-0, 334800, 152064, 0x9046b760
-0, 338400, 152064, 0x599a736b
-0, 342000, 152064, 0xaef20726
-0, 345600, 152064, 0x0d136768
-0, 349200, 152064, 0xfe4ed2a8
-0, 352800, 152064, 0x5a85524b
-0, 356400, 152064, 0x6d495dd2
-0, 360000, 152064, 0x04bdb815
-0, 363600, 152064, 0x28aae1c5
-0, 367200, 152064, 0xc20bc8d9
-0, 370800, 152064, 0xa33d9b41
-0, 374400, 152064, 0x6269cb43
-0, 378000, 152064, 0x4f81d636
-0, 381600, 152064, 0xc6062166
-0, 385200, 152064, 0xb027fbcc
-0, 388800, 152064, 0x73a7a584
-0, 392400, 152064, 0xf67e520a
-0, 396000, 152064, 0x94eff023
-0, 399600, 152064, 0xef1da8e5
-0, 403200, 152064, 0x2d9ab411
-0, 406800, 152064, 0xf0c39b5d
-0, 410400, 152064, 0xb2374724
-0, 414000, 152064, 0x939a5243
-0, 417600, 152064, 0xee3438db
-0, 421200, 152064, 0x7da04012
-0, 424800, 152064, 0xac611668
-0, 428400, 152064, 0xdce3062e
-0, 432000, 152064, 0xb57cc00e
-0, 435600, 152064, 0xaf96b59e
-0, 439200, 152064, 0x56789c13
-0, 442800, 152064, 0xb1f678b5
-0, 446400, 152064, 0xb340b8c4
-0, 450000, 152064, 0x86e6e304
-0, 453600, 152064, 0xa056e037
-0, 457200, 152064, 0x16885d27
-0, 460800, 152064, 0x9c5ac065
-0, 464400, 152064, 0x563d5335
-0, 468000, 152064, 0x3ca71c1e
-0, 471600, 152064, 0xad34e16c
-0, 475200, 152064, 0x6d074b27
-0, 478800, 152064, 0x9b1c4909
-0, 482400, 152064, 0xdbced198
-0, 486000, 152064, 0x8a0ded00
-0, 489600, 152064, 0x5ffc209b
-0, 493200, 152064, 0x47cfd269
-0, 496800, 152064, 0xe3c0137e
-0, 500400, 152064, 0xcb6a5e53
-0, 504000, 152064, 0x87cec05f
-0, 507600, 152064, 0x92721dd2
-0, 511200, 152064, 0x3f7d7b3b
-0, 514800, 152064, 0xd63ef417
-0, 518400, 152064, 0xf8e4b05a
-0, 522000, 152064, 0xb5dcb421
-0, 525600, 152064, 0x53c96f6a
-0, 529200, 152064, 0x24ae98a3
-0, 532800, 152064, 0x2e9b5fff
-0, 536400, 152064, 0x7795bf12
-0, 540000, 152064, 0x499d37ca
-0, 543600, 152064, 0xfe478487
-0, 547200, 152064, 0xcd661afb
-0, 550800, 152064, 0x44f8bf00
-0, 554400, 152064, 0x90b67809
-0, 558000, 152064, 0x8f5726d1
-0, 561600, 152064, 0x2e3c39d5
-0, 565200, 152064, 0x4b67c4e6
-0, 568800, 152064, 0x9fecb7cf
-0, 572400, 152064, 0x207766ea
-0, 576000, 152064, 0x5846bf7b
-0, 579600, 152064, 0x4237fba1
-0, 583200, 152064, 0x983e0cbd
-0, 586800, 152064, 0x6be100d1
-0, 590400, 152064, 0x9d0beb8f
-0, 594000, 152064, 0x234b82e7
-0, 597600, 152064, 0x83fb5ef1
-0, 601200, 152064, 0xf503dcb2
-0, 604800, 152064, 0x031a27f2
-0, 608400, 152064, 0x2f1abf24
-0, 612000, 152064, 0x54d77010
-0, 615600, 152064, 0x049fc0fc
-0, 619200, 152064, 0x20f2f7e7
-0, 622800, 152064, 0xc0d57467
-0, 626400, 152064, 0xbe464eef
-0, 630000, 152064, 0x035c9052
-0, 633600, 152064, 0x91cba4fb
-0, 637200, 152064, 0x11cdbbfb
-0, 640800, 152064, 0xe61116d5
-0, 644400, 152064, 0x16db46b8
-0, 648000, 152064, 0x54f30d9f
-0, 651600, 152064, 0x211a8d2d
-0, 655200, 152064, 0x5a74a56b
-0, 658800, 152064, 0x0ff4ba72
-0, 662400, 152064, 0x4c398ad6
-0, 666000, 152064, 0x830814f0
-0, 669600, 152064, 0xa51f4bab
-0, 673200, 152064, 0xf3460de6
-0, 676800, 152064, 0x7e1979a1
-0, 680400, 152064, 0x4b3ebb3a
-0, 684000, 152064, 0x83d1f4f8
-0, 687600, 152064, 0xfbf08683
-0, 691200, 152064, 0x901c07ec
-0, 694800, 152064, 0xbc2dc1c7
-0, 698400, 152064, 0x6e646b3b
-0, 702000, 152064, 0x51a25aab
-0, 705600, 152064, 0xa042ab78
-0, 709200, 152064, 0xb972af58
-0, 712800, 152064, 0xcdca9568
-0, 716400, 152064, 0x17b69d1c
-0, 720000, 152064, 0x41c43ea2
-0, 723600, 152064, 0x195fc7a0
-0, 727200, 152064, 0xf4cec580
-0, 730800, 152064, 0xb3b10936
-0, 734400, 152064, 0x102bc2ec
-0, 738000, 152064, 0xc99d4767
-0, 741600, 152064, 0x60c745b0
-0, 745200, 152064, 0x8176e0cf
-0, 748800, 152064, 0xd47e69b5
-0, 752400, 152064, 0xacce674c
-0, 756000, 152064, 0x031b51f8
-0, 759600, 152064, 0x0eb681ef
-0, 763200, 152064, 0x0b69334b
-0, 766800, 152064, 0xda819c1f
-0, 770400, 152064, 0xa93f62d2
-0, 774000, 152064, 0x51374db5
-0, 777600, 152064, 0x885dccff
-0, 781200, 152064, 0xd0780444
-0, 784800, 152064, 0xa31733ca
-0, 788400, 152064, 0x3f3de84e
-0, 792000, 152064, 0x2af2b2c3
-0, 795600, 152064, 0xa62dceae
-0, 799200, 152064, 0xca1cffd1
-0, 802800, 152064, 0x3c7d561b
-0, 806400, 152064, 0xbc04130a
-0, 810000, 152064, 0xbd2829ae
-0, 813600, 152064, 0xdbbb9820
-0, 817200, 152064, 0xfc3ef628
-0, 820800, 152064, 0xd5da3ec3
-0, 824400, 152064, 0x62d5fcc1
-0, 828000, 152064, 0x455a8dae
-0, 831600, 152064, 0x421c9147
-0, 835200, 152064, 0x6a168484
-0, 838800, 152064, 0x7ba15d32
-0, 842400, 152064, 0xd089ed27
-0, 846000, 152064, 0x8fc4d894
-0, 849600, 152064, 0x99e47125
-0, 853200, 152064, 0xf55dda68
-0, 856800, 152064, 0x6bf06cf1
-0, 860400, 152064, 0x7dc41a9d
-0, 864000, 152064, 0x78b84019
-0, 867600, 152064, 0x85ae8973
-0, 871200, 152064, 0x7b7aeabe
-0, 874800, 152064, 0xf9a8f6bf
-0, 878400, 152064, 0xe195ddcd
-0, 882000, 152064, 0x83edffe9
-0, 885600, 152064, 0x59cce97a
-0, 889200, 152064, 0x15268af1
-0, 892800, 152064, 0x270cca95
-0, 896400, 152064, 0x8bced1f9
-0, 900000, 152064, 0x08ee5cec
-0, 903600, 152064, 0x01e74f95
-0, 907200, 152064, 0x7e19238f
-0, 910800, 152064, 0x6bcb2b9d
-0, 914400, 152064, 0x58111385
-0, 918000, 152064, 0x6c7aa1f7
-0, 921600, 152064, 0xb713a822
-0, 925200, 152064, 0x1d645cee
-0, 928800, 152064, 0x9c592969
-0, 932400, 152064, 0x2472769e
-0, 936000, 152064, 0x71b7a5ad
-0, 939600, 152064, 0xc6bba1c6
-0, 943200, 152064, 0x7351f305
-0, 946800, 152064, 0x579edbba
-0, 950400, 152064, 0x90eda919
-0, 954000, 152064, 0x2833b10d
-0, 957600, 152064, 0x4b967d65
-0, 961200, 152064, 0x6e7d1702
-0, 964800, 152064, 0x59dbcf5b
-0, 968400, 152064, 0xa138847b
-0, 972000, 152064, 0xb2414e8d
-0, 975600, 152064, 0xb90497f6
-0, 979200, 152064, 0xcd728159
-0, 982800, 152064, 0x005d5bdd
-0, 986400, 152064, 0x27c88fb6
-0, 990000, 152064, 0x3ccb8a93
-0, 993600, 152064, 0xc50256dd
-0, 997200, 152064, 0x111e7dee
-0, 1000800, 152064, 0x259d4a5d
-0, 1004400, 152064, 0x9385148b
-0, 1008000, 152064, 0x74002ab0
-0, 1011600, 152064, 0xd2c74adc
-0, 1015200, 152064, 0x72854b2a
-0, 1018800, 152064, 0x638e5c08
-0, 1022400, 152064, 0x9626bbb3
-0, 1026000, 152064, 0xc107c18f
-0, 1029600, 152064, 0x8bd04578
-0, 1033200, 152064, 0xbcdb6db6
-0, 1036800, 152064, 0x9d0c81be
-0, 1040400, 152064, 0xf25106b6
-0, 1044000, 152064, 0x54c25254
-0, 1047600, 152064, 0x4bf74663
-0, 1051200, 152064, 0x0051b054
-0, 1054800, 152064, 0x5193d3d4
-0, 1058400, 152064, 0xb5d0d045
-0, 1062000, 152064, 0x350a31ca
-0, 1065600, 152064, 0xb8fb7264
-0, 1069200, 152064, 0x7fb97645
-0, 1072800, 152064, 0xcd948c41
-0, 1076400, 152064, 0x38c7570a
diff --git a/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a b/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a
deleted file mode 100644
index a67b4ba..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcvfl_bcrm_a
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x502ec077
-0, 3600, 152064, 0x84807243
-0, 7200, 152064, 0xd7474a6e
-0, 10800, 152064, 0x793469bb
-0, 14400, 152064, 0xb7a0faf7
-0, 18000, 152064, 0x1d3d3cba
-0, 21600, 152064, 0xb62583de
-0, 25200, 152064, 0xc8422fb1
-0, 28800, 152064, 0x321dc699
-0, 32400, 152064, 0x7a34d350
-0, 36000, 152064, 0xaa4c302d
-0, 39600, 152064, 0x45fa7ab0
-0, 43200, 152064, 0xc7262e41
-0, 46800, 152064, 0x3550000c
-0, 50400, 152064, 0xf4bab54b
-0, 54000, 152064, 0xaccf9c1a
-0, 57600, 152064, 0x9bee20e9
-0, 61200, 152064, 0x47fb7720
-0, 64800, 152064, 0x12c63ffb
-0, 68400, 152064, 0xfa2b8b4d
-0, 72000, 152064, 0x279964bd
-0, 75600, 152064, 0xb8b01c7e
-0, 79200, 152064, 0x816fa010
-0, 82800, 152064, 0x59fe1c8c
-0, 86400, 152064, 0x13393fad
-0, 90000, 152064, 0x991a50a4
-0, 93600, 152064, 0x57df3eb7
-0, 97200, 152064, 0x744371df
-0, 100800, 152064, 0xe9f6d3ff
-0, 104400, 152064, 0xc506fba0
-0, 108000, 152064, 0x6295b90e
-0, 111600, 152064, 0xa19cee2d
-0, 115200, 152064, 0xf8c1b3ca
-0, 118800, 152064, 0x69f68ce0
-0, 122400, 152064, 0x80558bb6
-0, 126000, 152064, 0x27824fa5
-0, 129600, 152064, 0x27c929a1
-0, 133200, 152064, 0xc0fe06d1
-0, 136800, 152064, 0xc52bc58c
-0, 140400, 152064, 0x0a5363c7
-0, 144000, 152064, 0xd0f45a0d
-0, 147600, 152064, 0x274710f9
-0, 151200, 152064, 0x89d2d390
-0, 154800, 152064, 0x12a9bfb0
-0, 158400, 152064, 0x04501a93
-0, 162000, 152064, 0xf92cbbf4
-0, 165600, 152064, 0xf6d1b27d
-0, 169200, 152064, 0xe3e904c3
-0, 172800, 152064, 0x58f8516d
-0, 176400, 152064, 0x70370c2b
-0, 180000, 152064, 0xfeebc88c
-0, 183600, 152064, 0x974c6ed6
-0, 187200, 152064, 0x401bdcf2
-0, 190800, 152064, 0xfe61e278
-0, 194400, 152064, 0x96ba8bb9
-0, 198000, 152064, 0x988492fd
-0, 201600, 152064, 0xd1d913a9
-0, 205200, 152064, 0x6bc46f0e
-0, 208800, 152064, 0x695ef706
-0, 212400, 152064, 0x142045c9
-0, 216000, 152064, 0xb390ed87
-0, 219600, 152064, 0xb9e6d2e5
-0, 223200, 152064, 0xe348797f
-0, 226800, 152064, 0x1cbd29d6
-0, 230400, 152064, 0xbd7dd694
-0, 234000, 152064, 0x516873c3
-0, 237600, 152064, 0x27bba182
-0, 241200, 152064, 0x7541f920
-0, 244800, 152064, 0xfdf67042
-0, 248400, 152064, 0x6c3c7896
-0, 252000, 152064, 0xed86c467
-0, 255600, 152064, 0x4ea83ca2
-0, 259200, 152064, 0xa3e6725b
-0, 262800, 152064, 0x917f5f16
-0, 266400, 152064, 0x8cf2d2e1
-0, 270000, 152064, 0x57a8d116
-0, 273600, 152064, 0x0db267d4
-0, 277200, 152064, 0xce782ac5
-0, 280800, 152064, 0x1c9d8518
-0, 284400, 152064, 0x47598ac7
-0, 288000, 152064, 0xc5033d97
-0, 291600, 152064, 0xd7aaa3a4
-0, 295200, 152064, 0x078afc96
-0, 298800, 152064, 0xc9fe673d
-0, 302400, 152064, 0xe9284066
-0, 306000, 152064, 0xbc570982
-0, 309600, 152064, 0x0aac8574
-0, 313200, 152064, 0x098cbeee
-0, 316800, 152064, 0x19c36a9d
-0, 320400, 152064, 0x8fe4a893
-0, 324000, 152064, 0x0b652f17
-0, 327600, 152064, 0x10f2e6bf
-0, 331200, 152064, 0x7ce5634e
-0, 334800, 152064, 0x8fe4ac6c
-0, 338400, 152064, 0xcaba749e
-0, 342000, 152064, 0x5f8a0d5c
-0, 345600, 152064, 0xcaa66bbc
-0, 349200, 152064, 0xc87ae617
-0, 352800, 152064, 0xe8ef4dd7
-0, 356400, 152064, 0xdfca5a07
-0, 360000, 152064, 0x5f7eab7d
-0, 363600, 152064, 0x8a65ebbb
-0, 367200, 152064, 0x4beab4a0
-0, 370800, 152064, 0xb5e6ab30
-0, 374400, 152064, 0x8fe4f4d4
-0, 378000, 152064, 0x95bde1ca
-0, 381600, 152064, 0xcc5e3a53
-0, 385200, 152064, 0xf09f1dd7
-0, 388800, 152064, 0x10179672
-0, 392400, 152064, 0x4ad16184
-0, 396000, 152064, 0x9efa0e23
-0, 399600, 152064, 0x22f59522
-0, 403200, 152064, 0x4d38f09d
-0, 406800, 152064, 0x4c5ebf56
-0, 410400, 152064, 0xb19d5077
-0, 414000, 152064, 0xa98576b9
-0, 417600, 152064, 0x65324239
-0, 421200, 152064, 0x709e4031
-0, 424800, 152064, 0xf8e81681
-0, 428400, 152064, 0x058514e5
-0, 432000, 152064, 0xd1d1c806
-0, 435600, 152064, 0x0e4dde57
-0, 439200, 152064, 0x49e9c2bb
-0, 442800, 152064, 0x01417ce6
-0, 446400, 152064, 0xda7ebbf1
-0, 450000, 152064, 0xa22906b7
-0, 453600, 152064, 0x32e2df87
-0, 457200, 152064, 0x69917c8f
-0, 460800, 152064, 0xea8ed2cc
-0, 464400, 152064, 0x0b8d57f1
-0, 468000, 152064, 0x5f683bcd
-0, 471600, 152064, 0x5162fe2f
-0, 475200, 152064, 0x49c052f8
-0, 478800, 152064, 0x990b69ba
-0, 482400, 152064, 0xa6d4f99f
-0, 486000, 152064, 0xe79ef4da
-0, 489600, 152064, 0x5e8a3847
-0, 493200, 152064, 0x38b1e75f
-0, 496800, 152064, 0xf5c91bed
-0, 500400, 152064, 0xd59a6d26
-0, 504000, 152064, 0xc361de06
-0, 507600, 152064, 0x63ed2229
-0, 511200, 152064, 0xb8229205
-0, 514800, 152064, 0x7c6619af
-0, 518400, 152064, 0x4126b02f
-0, 522000, 152064, 0x9250b99b
-0, 525600, 152064, 0x589778f9
-0, 529200, 152064, 0xed1fa45b
-0, 532800, 152064, 0x700b6f32
-0, 536400, 152064, 0x0590df55
-0, 540000, 152064, 0x3e9c4018
-0, 543600, 152064, 0x957b8860
-0, 547200, 152064, 0x56161560
-0, 550800, 152064, 0xbc43bc3b
-0, 554400, 152064, 0x508d8632
-0, 558000, 152064, 0xbc5736d8
-0, 561600, 152064, 0xed7d3aef
-0, 565200, 152064, 0x1dcdda9f
-0, 568800, 152064, 0x8ef6d5c9
-0, 572400, 152064, 0x15466acc
-0, 576000, 152064, 0x45d4cf67
-0, 579600, 152064, 0x8c900b9d
-0, 583200, 152064, 0x747006e0
-0, 586800, 152064, 0xac920a0c
-0, 590400, 152064, 0xb8210c27
-0, 594000, 152064, 0x7dbb873a
-0, 597600, 152064, 0x0d4d7584
-0, 601200, 152064, 0xefb3fe60
-0, 604800, 152064, 0x905e2644
-0, 608400, 152064, 0x7c04e534
-0, 612000, 152064, 0x8889972a
-0, 615600, 152064, 0x21c7d8ad
-0, 619200, 152064, 0x1c641176
-0, 622800, 152064, 0xf71489a4
-0, 626400, 152064, 0xd7ac5555
-0, 630000, 152064, 0xb4609c6d
-0, 633600, 152064, 0xf5b2bd5e
-0, 637200, 152064, 0x9f43ce57
-0, 640800, 152064, 0x77642dd3
-0, 644400, 152064, 0x3e79565c
-0, 648000, 152064, 0x95f40b8e
-0, 651600, 152064, 0x3c8ca4d4
-0, 655200, 152064, 0xa02ac497
-0, 658800, 152064, 0x4c93b377
-0, 662400, 152064, 0x55f5ac68
-0, 666000, 152064, 0xf8652eca
-0, 669600, 152064, 0x56e94574
-0, 673200, 152064, 0x6d8302e1
-0, 676800, 152064, 0x29a57061
-0, 680400, 152064, 0x24e4cfdc
-0, 684000, 152064, 0xf5a5d62a
-0, 687600, 152064, 0x998870c1
-0, 691200, 152064, 0xa15b1f4e
-0, 694800, 152064, 0xb0ccb51f
-0, 698400, 152064, 0xeaaf59ab
-0, 702000, 152064, 0x7e2b4fe6
-0, 705600, 152064, 0x72299fea
-0, 709200, 152064, 0x769da8b2
-0, 712800, 152064, 0xefad7ef8
-0, 716400, 152064, 0x24819983
-0, 720000, 152064, 0x2aad32ab
-0, 723600, 152064, 0xc80cac79
-0, 727200, 152064, 0x1659d628
-0, 730800, 152064, 0xef941f66
-0, 734400, 152064, 0x0d7fcdb5
-0, 738000, 152064, 0x7c1853fa
-0, 741600, 152064, 0xb94c4d3c
-0, 745200, 152064, 0xc47adfc2
-0, 748800, 152064, 0x366a6729
-0, 752400, 152064, 0x7eb37b70
-0, 756000, 152064, 0xafd54c27
-0, 759600, 152064, 0x67b18636
-0, 763200, 152064, 0x93b22dcf
-0, 766800, 152064, 0xa64991f1
-0, 770400, 152064, 0xd32a7102
-0, 774000, 152064, 0xff665d1c
-0, 777600, 152064, 0xf107cc31
-0, 781200, 152064, 0xf5b25652
-0, 784800, 152064, 0x8caf783d
-0, 788400, 152064, 0x72f3eb00
-0, 792000, 152064, 0xb5aea5f8
-0, 795600, 152064, 0xee70e870
-0, 799200, 152064, 0x7c3a0156
-0, 802800, 152064, 0x871b6383
-0, 806400, 152064, 0x48d831ff
-0, 810000, 152064, 0xca233913
-0, 813600, 152064, 0xe14bc5eb
-0, 817200, 152064, 0x9b1d27e7
-0, 820800, 152064, 0xfb9637f7
-0, 824400, 152064, 0x0c022157
-0, 828000, 152064, 0x16d35fc9
-0, 831600, 152064, 0x6d935f71
-0, 835200, 152064, 0xae4066fa
-0, 838800, 152064, 0xcef94fdc
-0, 842400, 152064, 0xc234edb9
-0, 846000, 152064, 0x26a4f2e2
-0, 849600, 152064, 0xd29ac23e
-0, 853200, 152064, 0xb7604395
-0, 856800, 152064, 0x408084f6
-0, 860400, 152064, 0x0a02026c
-0, 864000, 152064, 0x78b33c7c
-0, 867600, 152064, 0xcb02b874
-0, 871200, 152064, 0xf566513b
-0, 874800, 152064, 0xb34e52b1
-0, 878400, 152064, 0xf55ff493
-0, 882000, 152064, 0xb0e8282a
-0, 885600, 152064, 0xe9510bbe
-0, 889200, 152064, 0x292e8c5a
-0, 892800, 152064, 0x62b9d2b0
-0, 896400, 152064, 0x3a8cc827
-0, 900000, 152064, 0x25cc465e
-0, 903600, 152064, 0xf2bc32e2
-0, 907200, 152064, 0x6141f914
-0, 910800, 152064, 0x1171256f
-0, 914400, 152064, 0x13cb2ded
-0, 918000, 152064, 0x3d4ca557
-0, 921600, 152064, 0xf2b9e72e
-0, 925200, 152064, 0x03f7547a
-0, 928800, 152064, 0xc7302955
-0, 932400, 152064, 0xe78a46d3
-0, 936000, 152064, 0x3726a270
-0, 939600, 152064, 0x2f65722a
-0, 943200, 152064, 0x55acce40
-0, 946800, 152064, 0xf6fa9db2
-0, 950400, 152064, 0x70a36937
-0, 954000, 152064, 0x9313742d
-0, 957600, 152064, 0x2eb14e53
-0, 961200, 152064, 0x3d47c9c3
-0, 964800, 152064, 0xd0a90348
-0, 968400, 152064, 0x6ad48088
-0, 972000, 152064, 0x68e64738
-0, 975600, 152064, 0x04c3735a
-0, 979200, 152064, 0x51d0593f
-0, 982800, 152064, 0x42cf2b48
-0, 986400, 152064, 0xa5496a0c
-0, 990000, 152064, 0x84c25549
-0, 993600, 152064, 0x96691600
-0, 997200, 152064, 0x423135db
-0, 1000800, 152064, 0x8d2e08b6
-0, 1004400, 152064, 0xaeb4c840
-0, 1008000, 152064, 0xf3e71780
-0, 1011600, 152064, 0x8858228b
-0, 1015200, 152064, 0xf28613f8
-0, 1018800, 152064, 0xb5327882
-0, 1022400, 152064, 0xbb60bb85
-0, 1026000, 152064, 0x345ab1c9
-0, 1029600, 152064, 0x8aac2cba
-0, 1033200, 152064, 0x7ce15b4c
-0, 1036800, 152064, 0xc09c55c0
-0, 1040400, 152064, 0x8482ddd6
-0, 1044000, 152064, 0xab222a13
-0, 1047600, 152064, 0xd39b0dea
-0, 1051200, 152064, 0x6dab6e06
-0, 1054800, 152064, 0xec0891bd
-0, 1058400, 152064, 0x88bd9701
-0, 1062000, 152064, 0xdf13072a
-0, 1065600, 152064, 0x23b33081
-0, 1069200, 152064, 0x63943137
-0, 1072800, 152064, 0xab6a9052
-0, 1076400, 152064, 0x05485494
diff --git a/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a b/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a
deleted file mode 100644
index 97d7677..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcvflnl_bcrm_a
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x3e39c08b
-0, 3600, 152064, 0xabc67990
-0, 7200, 152064, 0x19614e74
-0, 10800, 152064, 0xa3776beb
-0, 14400, 152064, 0xcce6ffdf
-0, 18000, 152064, 0xb0e94746
-0, 21600, 152064, 0xdb1a84ef
-0, 25200, 152064, 0xb2624509
-0, 28800, 152064, 0x32e2d826
-0, 32400, 152064, 0xb3bddf0b
-0, 36000, 152064, 0x2e273ce3
-0, 39600, 152064, 0x67af7e4d
-0, 43200, 152064, 0x505c3261
-0, 46800, 152064, 0xa43d015e
-0, 50400, 152064, 0xad41c1f6
-0, 54000, 152064, 0x633ba55f
-0, 57600, 152064, 0xe80634f0
-0, 61200, 152064, 0x80a07dc9
-0, 64800, 152064, 0x0e7a3bbf
-0, 68400, 152064, 0xcb099196
-0, 72000, 152064, 0x57c96db5
-0, 75600, 152064, 0xccd422fa
-0, 79200, 152064, 0x0850b7a7
-0, 82800, 152064, 0x30e33156
-0, 86400, 152064, 0x34e13f9a
-0, 90000, 152064, 0x03d36000
-0, 93600, 152064, 0xbf7d49da
-0, 97200, 152064, 0x77336d09
-0, 100800, 152064, 0xca8be5a9
-0, 104400, 152064, 0xe57c0b08
-0, 108000, 152064, 0xbe77c093
-0, 111600, 152064, 0x6bf1ff05
-0, 115200, 152064, 0x9142babf
-0, 118800, 152064, 0x08db8e67
-0, 122400, 152064, 0x69ac8cb6
-0, 126000, 152064, 0xaa3b5c88
-0, 129600, 152064, 0x9bd32638
-0, 133200, 152064, 0x7972115a
-0, 136800, 152064, 0x5c1dd47b
-0, 140400, 152064, 0x8a196e02
-0, 144000, 152064, 0xa89672bc
-0, 147600, 152064, 0x27b220e4
-0, 151200, 152064, 0xfa38dc4a
-0, 154800, 152064, 0x4784c639
-0, 158400, 152064, 0xa5e4229a
-0, 162000, 152064, 0xa986bdfc
-0, 165600, 152064, 0x2951b47b
-0, 169200, 152064, 0x4df404a6
-0, 172800, 152064, 0xc75155e8
-0, 176400, 152064, 0xfc05248c
-0, 180000, 152064, 0x5d53da10
-0, 183600, 152064, 0x284376ec
-0, 187200, 152064, 0x19fce380
-0, 190800, 152064, 0x876be6c9
-0, 194400, 152064, 0x39eb8ff9
-0, 198000, 152064, 0x289c9543
-0, 201600, 152064, 0x24dd2356
-0, 205200, 152064, 0x1dc17d3c
-0, 208800, 152064, 0xd17c00ac
-0, 212400, 152064, 0xc2ad54de
-0, 216000, 152064, 0xbe11ee2f
-0, 219600, 152064, 0x3db9dc89
-0, 223200, 152064, 0xac0d7bc2
-0, 226800, 152064, 0x8dab2dde
-0, 230400, 152064, 0x566ad225
-0, 234000, 152064, 0x587c7853
-0, 237600, 152064, 0x601c9c80
-0, 241200, 152064, 0x2afaf751
-0, 244800, 152064, 0x1c9f7e3a
-0, 248400, 152064, 0x899475bf
-0, 252000, 152064, 0x0d65c7d9
-0, 255600, 152064, 0xafd63d12
-0, 259200, 152064, 0x162e62b9
-0, 262800, 152064, 0x5c9554be
-0, 266400, 152064, 0x35fbdaa2
-0, 270000, 152064, 0x6438cbd8
-0, 273600, 152064, 0xde0772c9
-0, 277200, 152064, 0x79f82854
-0, 280800, 152064, 0x86957840
-0, 284400, 152064, 0xd9468cbf
-0, 288000, 152064, 0x23e74609
-0, 291600, 152064, 0x3919a146
-0, 295200, 152064, 0xd641078b
-0, 298800, 152064, 0x24397220
-0, 302400, 152064, 0xe7fc3a7c
-0, 306000, 152064, 0x3997154a
-0, 309600, 152064, 0x2af3952c
-0, 313200, 152064, 0x274ac07a
-0, 316800, 152064, 0x288f7b09
-0, 320400, 152064, 0xe6f9b022
-0, 324000, 152064, 0xf09e2fbb
-0, 327600, 152064, 0x7244e477
-0, 331200, 152064, 0x0dfc72eb
-0, 334800, 152064, 0x0322b21f
-0, 338400, 152064, 0x18b08205
-0, 342000, 152064, 0x6606153e
-0, 345600, 152064, 0x85186272
-0, 349200, 152064, 0x3369f064
-0, 352800, 152064, 0xbe0d5a44
-0, 356400, 152064, 0x320258bb
-0, 360000, 152064, 0x4d6fb091
-0, 363600, 152064, 0xc9bbf5e7
-0, 367200, 152064, 0x0aa1b69b
-0, 370800, 152064, 0x85b9ac11
-0, 374400, 152064, 0xb25ff818
-0, 378000, 152064, 0xa155dc25
-0, 381600, 152064, 0xa8e03bfd
-0, 385200, 152064, 0x0a862956
-0, 388800, 152064, 0x11b49264
-0, 392400, 152064, 0xa94e664e
-0, 396000, 152064, 0x330e0fa2
-0, 399600, 152064, 0xaf3d9518
-0, 403200, 152064, 0x0836f2e8
-0, 406800, 152064, 0xbf6dc578
-0, 410400, 152064, 0x7b524d20
-0, 414000, 152064, 0x9ef7677f
-0, 417600, 152064, 0xeacf3f34
-0, 421200, 152064, 0xfb4e3dbe
-0, 424800, 152064, 0xb46e25cb
-0, 428400, 152064, 0x363c1603
-0, 432000, 152064, 0x263fc542
-0, 435600, 152064, 0xf106e548
-0, 439200, 152064, 0xde43c56a
-0, 442800, 152064, 0xc2c4770a
-0, 446400, 152064, 0x122fce19
-0, 450000, 152064, 0x3ba01434
-0, 453600, 152064, 0x0e8ce5ee
-0, 457200, 152064, 0x6ceb82e1
-0, 460800, 152064, 0xa23ee21c
-0, 464400, 152064, 0xc6d960f9
-0, 468000, 152064, 0x0de15258
-0, 471600, 152064, 0x187b0333
-0, 475200, 152064, 0x92e6582f
-0, 478800, 152064, 0xb9586ce0
-0, 482400, 152064, 0xefd803b5
-0, 486000, 152064, 0x24eafb29
-0, 489600, 152064, 0x20c73b14
-0, 493200, 152064, 0xbd7ceaaa
-0, 496800, 152064, 0x775216c8
-0, 500400, 152064, 0xa08971c7
-0, 504000, 152064, 0xef0ee865
-0, 507600, 152064, 0x9ac61c2f
-0, 511200, 152064, 0x52ae8ea9
-0, 514800, 152064, 0x06571c14
-0, 518400, 152064, 0x6e78ad33
-0, 522000, 152064, 0xad01c627
-0, 525600, 152064, 0xbfe074d3
-0, 529200, 152064, 0x9357a183
-0, 532800, 152064, 0x8de7767f
-0, 536400, 152064, 0xa5e6e76e
-0, 540000, 152064, 0xa6f646fe
-0, 543600, 152064, 0x132e99f8
-0, 547200, 152064, 0xb79f27de
-0, 550800, 152064, 0x36d3cdcf
-0, 554400, 152064, 0xdc938336
-0, 558000, 152064, 0xacaa3a7f
-0, 561600, 152064, 0xc61a37fd
-0, 565200, 152064, 0x4fe1ddf0
-0, 568800, 152064, 0xc0f7d660
-0, 572400, 152064, 0xd72458ea
-0, 576000, 152064, 0x6978d123
-0, 579600, 152064, 0x64e60ccf
-0, 583200, 152064, 0xaa07004c
-0, 586800, 152064, 0x07cd1064
-0, 590400, 152064, 0xa82320e5
-0, 594000, 152064, 0xaedd8d30
-0, 597600, 152064, 0x79b082ea
-0, 601200, 152064, 0x9ed800ab
-0, 604800, 152064, 0xde592bb4
-0, 608400, 152064, 0xd966df88
-0, 612000, 152064, 0xf921988a
-0, 615600, 152064, 0x557ad9ae
-0, 619200, 152064, 0xc3f31a9a
-0, 622800, 152064, 0x65248561
-0, 626400, 152064, 0x63df4aa6
-0, 630000, 152064, 0x618da0a9
-0, 633600, 152064, 0xe6f1c435
-0, 637200, 152064, 0x9f90c38f
-0, 640800, 152064, 0xd2853e14
-0, 644400, 152064, 0x6e0268a9
-0, 648000, 152064, 0x393712d1
-0, 651600, 152064, 0x470da25f
-0, 655200, 152064, 0xaf55cb3d
-0, 658800, 152064, 0x6935b8b9
-0, 662400, 152064, 0x5409a15f
-0, 666000, 152064, 0x09073fee
-0, 669600, 152064, 0xfb274e82
-0, 673200, 152064, 0x1a770581
-0, 676800, 152064, 0x17277d0d
-0, 680400, 152064, 0xd4dcd982
-0, 684000, 152064, 0x6b04eaf3
-0, 687600, 152064, 0x8a3d822e
-0, 691200, 152064, 0x1b971ec9
-0, 694800, 152064, 0x14e0c0f6
-0, 698400, 152064, 0x00667450
-0, 702000, 152064, 0xd2385902
-0, 705600, 152064, 0x905da6ab
-0, 709200, 152064, 0xa3ffb18b
-0, 712800, 152064, 0x10d48b19
-0, 716400, 152064, 0xb2c7a3bd
-0, 720000, 152064, 0x45593e96
-0, 723600, 152064, 0x47a0b60c
-0, 727200, 152064, 0x68c6d1b9
-0, 730800, 152064, 0xbc881fcc
-0, 734400, 152064, 0x422cc6f2
-0, 738000, 152064, 0x9b686410
-0, 741600, 152064, 0x35dc5e86
-0, 745200, 152064, 0x247bedaa
-0, 748800, 152064, 0x22b76fd1
-0, 752400, 152064, 0x67cc7a75
-0, 756000, 152064, 0xa197521e
-0, 759600, 152064, 0x428c8662
-0, 763200, 152064, 0x33dc2c73
-0, 766800, 152064, 0x5b538903
-0, 770400, 152064, 0x3c4176b6
-0, 774000, 152064, 0x774364ba
-0, 777600, 152064, 0xf237d03e
-0, 781200, 152064, 0xac8746fb
-0, 784800, 152064, 0x6b306a84
-0, 788400, 152064, 0xa2ace513
-0, 792000, 152064, 0x709c9be7
-0, 795600, 152064, 0x2403f373
-0, 799200, 152064, 0x147bf717
-0, 802800, 152064, 0xe58964c8
-0, 806400, 152064, 0xa0da36fc
-0, 810000, 152064, 0x1ac1355c
-0, 813600, 152064, 0x8a31c9f2
-0, 817200, 152064, 0x42ba205c
-0, 820800, 152064, 0xa11b3575
-0, 824400, 152064, 0xcb35207c
-0, 828000, 152064, 0x528f6189
-0, 831600, 152064, 0x34f05bd7
-0, 835200, 152064, 0x72317356
-0, 838800, 152064, 0xaabd5028
-0, 842400, 152064, 0x13dbeb7b
-0, 846000, 152064, 0x62f1e8a8
-0, 849600, 152064, 0x1723bfcd
-0, 853200, 152064, 0x5c083c00
-0, 856800, 152064, 0x52137894
-0, 860400, 152064, 0xef1e082c
-0, 864000, 152064, 0x664b3d53
-0, 867600, 152064, 0x2eb9b296
-0, 871200, 152064, 0xd0ca511e
-0, 874800, 152064, 0x012d4724
-0, 878400, 152064, 0xa847f5af
-0, 882000, 152064, 0x483a2fde
-0, 885600, 152064, 0xd1ab0257
-0, 889200, 152064, 0x414692c7
-0, 892800, 152064, 0x0b79df88
-0, 896400, 152064, 0xdaa2c4a3
-0, 900000, 152064, 0xd1b44500
-0, 903600, 152064, 0xfd3d2cf3
-0, 907200, 152064, 0xfdc0f748
-0, 910800, 152064, 0xce762a2a
-0, 914400, 152064, 0x08b63572
-0, 918000, 152064, 0x5a46a38d
-0, 921600, 152064, 0x03cee9c0
-0, 925200, 152064, 0x9ee45473
-0, 928800, 152064, 0x5a432386
-0, 932400, 152064, 0x54c83d87
-0, 936000, 152064, 0xc9caa1de
-0, 939600, 152064, 0xa28367f1
-0, 943200, 152064, 0x2607cdf1
-0, 946800, 152064, 0x06baa8de
-0, 950400, 152064, 0xf5346e32
-0, 954000, 152064, 0x6d3e732b
-0, 957600, 152064, 0x798c584b
-0, 961200, 152064, 0x4076c948
-0, 964800, 152064, 0x868cf63a
-0, 968400, 152064, 0x23107ac5
-0, 972000, 152064, 0x306f3fe2
-0, 975600, 152064, 0xbd1d71d6
-0, 979200, 152064, 0x1429545f
-0, 982800, 152064, 0xaded29aa
-0, 986400, 152064, 0x9b455a94
-0, 990000, 152064, 0xb3774ce7
-0, 993600, 152064, 0x92580986
-0, 997200, 152064, 0x0eae2f95
-0, 1000800, 152064, 0x599208b2
-0, 1004400, 152064, 0x4804c04c
-0, 1008000, 152064, 0x5f730e8f
-0, 1011600, 152064, 0x3e501d1e
-0, 1015200, 152064, 0x32100740
-0, 1018800, 152064, 0x62226ff8
-0, 1022400, 152064, 0x7683b622
-0, 1026000, 152064, 0xc3e0aec1
-0, 1029600, 152064, 0xfac12608
-0, 1033200, 152064, 0xb21a5781
-0, 1036800, 152064, 0x8f1e4964
-0, 1040400, 152064, 0x0f62dd6e
-0, 1044000, 152064, 0xac062ac4
-0, 1047600, 152064, 0x1b320f7a
-0, 1051200, 152064, 0x346e7211
-0, 1054800, 152064, 0xe47592f3
-0, 1058400, 152064, 0xa3a7919c
-0, 1062000, 152064, 0xa3580fa6
-0, 1065600, 152064, 0xc73430c1
-0, 1069200, 152064, 0x994a2c18
-0, 1072800, 152064, 0x0b5d8d45
-0, 1076400, 152064, 0x9eed5109
diff --git a/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b b/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b
deleted file mode 100644
index 9db3fe5..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcvmolq_brcm_b
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 152064, 0xa18cfb97
-0, 3600, 152064, 0x509b54d2
-0, 7200, 152064, 0x1ba0fb8e
-0, 10800, 152064, 0x43e7721f
-0, 14400, 152064, 0xed196624
-0, 18000, 152064, 0x4277f1e8
-0, 21600, 152064, 0x88015cd6
-0, 25200, 152064, 0x0f230af3
-0, 28800, 152064, 0x91bbd664
-0, 32400, 152064, 0x117c65dd
-0, 36000, 152064, 0x8eebe5e8
-0, 39600, 152064, 0xd205cc10
-0, 43200, 152064, 0x4084a356
-0, 46800, 152064, 0x37385081
-0, 50400, 152064, 0xb7d34d8a
-0, 54000, 152064, 0x96648874
-0, 57600, 152064, 0x0623e65b
-0, 61200, 152064, 0x7d5b0173
-0, 64800, 152064, 0x0b6428e4
-0, 68400, 152064, 0xf3ca22a8
-0, 72000, 152064, 0x092e322c
-0, 75600, 152064, 0xe82c2971
-0, 79200, 152064, 0x29bf6111
-0, 82800, 152064, 0x84f1ea0d
-0, 86400, 152064, 0x45f822eb
-0, 90000, 152064, 0x9672b2a7
-0, 93600, 152064, 0xdb98e020
-0, 97200, 152064, 0x729879eb
-0, 100800, 152064, 0x3f629eae
-0, 104400, 152064, 0x02e0ddb7
-0, 108000, 152064, 0xbb1a0bb1
-0, 111600, 152064, 0x9b85b55b
-0, 115200, 152064, 0x2bae448b
-0, 118800, 152064, 0xa8f28bfa
-0, 122400, 152064, 0x687479da
-0, 126000, 152064, 0xe1ec3111
-0, 129600, 152064, 0x8afa37f1
-0, 133200, 152064, 0x4af89faf
-0, 136800, 152064, 0x1d9da53a
-0, 140400, 152064, 0xdc599bcd
-0, 144000, 152064, 0x01fb2e11
-0, 147600, 152064, 0x2a33498e
-0, 151200, 152064, 0x87874877
-0, 154800, 152064, 0xdcd095c6
-0, 158400, 152064, 0x4f14e6fb
-0, 162000, 152064, 0x65fd165e
-0, 165600, 152064, 0x4c267122
-0, 169200, 152064, 0x18adf3aa
-0, 172800, 152064, 0x74044daa
-0, 176400, 152064, 0xa03bca1e
-0, 180000, 152064, 0x7c1463fe
-0, 183600, 152064, 0x688a14e3
-0, 187200, 152064, 0x35c91c4e
-0, 190800, 152064, 0xeaf51d07
-0, 194400, 152064, 0xee61b9b1
-0, 198000, 152064, 0xbab75db3
-0, 201600, 152064, 0x199af472
-0, 205200, 152064, 0x3bcf96db
-0, 208800, 152064, 0x3fecdb09
-0, 212400, 152064, 0x07be2431
-0, 216000, 152064, 0x61432984
-0, 219600, 152064, 0xdb12a3b9
-0, 223200, 152064, 0xc2b8403e
-0, 226800, 152064, 0x34c60bde
-0, 230400, 152064, 0x08639859
-0, 234000, 152064, 0xfc0fc556
-0, 237600, 152064, 0x9cc27272
-0, 241200, 152064, 0x3ef7dbb0
-0, 244800, 152064, 0xbb74d9a3
-0, 248400, 152064, 0x4007fc6e
-0, 252000, 152064, 0x3d902f9b
-0, 255600, 152064, 0xfbd0a76a
-0, 259200, 152064, 0x4f1a4631
-0, 262800, 152064, 0x4f58ee25
-0, 266400, 152064, 0xd2c39501
-0, 270000, 152064, 0x23de68d5
-0, 273600, 152064, 0x4bf7d4ce
-0, 277200, 152064, 0x2bdccc79
-0, 280800, 152064, 0xc26b8f81
-0, 284400, 152064, 0xe77fa90a
-0, 288000, 152064, 0x48528308
-0, 291600, 152064, 0xab19b66b
-0, 295200, 152064, 0x04db5b4a
-0, 298800, 152064, 0x9fade901
-0, 302400, 152064, 0x1b7274ba
-0, 306000, 152064, 0x387a0191
-0, 309600, 152064, 0x2b3a8128
-0, 313200, 152064, 0x2a0dab30
-0, 316800, 152064, 0x5f5fc2da
-0, 320400, 152064, 0x5a5c8150
-0, 324000, 152064, 0xe0f5095e
-0, 327600, 152064, 0xb87c8072
-0, 331200, 152064, 0x08155daf
-0, 334800, 152064, 0xc308353f
-0, 338400, 152064, 0x2a04e8e4
-0, 342000, 152064, 0xabe75987
-0, 345600, 152064, 0x8733fb98
-0, 349200, 152064, 0x810f53a0
-0, 352800, 152064, 0xb3e4ea37
-0, 356400, 152064, 0xb7a70980
diff --git a/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a b/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a
deleted file mode 100644
index fe47465..0000000
--- a/tests/ref/fate/h264-conformance-frext-hpcvnl_brcm_a
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 152064, 0x2744afa1
-0, 3600, 152064, 0x17246583
-0, 7200, 152064, 0x501836ed
-0, 10800, 152064, 0xe90d6961
-0, 14400, 152064, 0x27abe1ad
-0, 18000, 152064, 0xcfc730e4
-0, 21600, 152064, 0xeaaa83ee
-0, 25200, 152064, 0xb5d80ebd
-0, 28800, 152064, 0x1e1b9d03
-0, 32400, 152064, 0x60e7cf33
-0, 36000, 152064, 0xc44616b1
-0, 39600, 152064, 0x0a2a5906
-0, 43200, 152064, 0xf101309c
-0, 46800, 152064, 0x0b57f348
-0, 50400, 152064, 0x4f018c05
-0, 54000, 152064, 0x22359c60
-0, 57600, 152064, 0x020f1cc3
-0, 61200, 152064, 0x15be3892
-0, 64800, 152064, 0x834a2e23
-0, 68400, 152064, 0x1176586c
-0, 72000, 152064, 0x9cf25641
-0, 75600, 152064, 0xc1c4051d
-0, 79200, 152064, 0x790d8bfa
-0, 82800, 152064, 0x4dcbe7d7
-0, 86400, 152064, 0xe81d3b7b
-0, 90000, 152064, 0xe9e21309
-0, 93600, 152064, 0x22021dbc
-0, 97200, 152064, 0x430c5ecb
-0, 100800, 152064, 0xf524be8b
-0, 104400, 152064, 0xa437dadc
-0, 108000, 152064, 0xff00b440
-0, 111600, 152064, 0x4bd1bf15
-0, 115200, 152064, 0x1f46a3ea
-0, 118800, 152064, 0x60b47c5e
-0, 122400, 152064, 0x45117ac6
-0, 126000, 152064, 0x43894fca
-0, 129600, 152064, 0x21572b55
-0, 133200, 152064, 0xe96def09
-0, 136800, 152064, 0x4d2ab41f
-0, 140400, 152064, 0x072d6b06
-0, 144000, 152064, 0x81865687
-0, 147600, 152064, 0x8d9a0ea6
-0, 151200, 152064, 0x1484d3cd
-0, 154800, 152064, 0xbdabae6b
-0, 158400, 152064, 0x4211edbe
-0, 162000, 152064, 0xd84dad6d
-0, 165600, 152064, 0xe4e79344
-0, 169200, 152064, 0x9c1addd7
-0, 172800, 152064, 0xdcf94283
-0, 176400, 152064, 0x6bd005b2
-0, 180000, 152064, 0x9679bd10
-0, 183600, 152064, 0x052064ab
-0, 187200, 152064, 0x915db3f3
-0, 190800, 152064, 0xec2fbd58
-0, 194400, 152064, 0x26728258
-0, 198000, 152064, 0x2b2b617f
-0, 201600, 152064, 0x2339eb3d
-0, 205200, 152064, 0xcf6e6773
-0, 208800, 152064, 0xb993efe4
-0, 212400, 152064, 0x4054253d
-0, 216000, 152064, 0x4befe5b5
-0, 219600, 152064, 0x0678c0fa
-0, 223200, 152064, 0xe3c54a03
-0, 226800, 152064, 0xffa3210c
-0, 230400, 152064, 0xed04b823
-0, 234000, 152064, 0x00926457
-0, 237600, 152064, 0xd56aaaf0
-0, 241200, 152064, 0x6047ef6e
-0, 244800, 152064, 0x44316d07
-0, 248400, 152064, 0xe8a879b7
-0, 252000, 152064, 0x1856cd86
-0, 255600, 152064, 0x6528349a
-0, 259200, 152064, 0xdeff676e
-0, 262800, 152064, 0xda412e47
-0, 266400, 152064, 0xa2c2a96f
-0, 270000, 152064, 0xc703b8cd
-0, 273600, 152064, 0x20b0650b
-0, 277200, 152064, 0x8c14faa5
-0, 280800, 152064, 0xa442706c
-0, 284400, 152064, 0x6e456137
-0, 288000, 152064, 0x6dde11c6
-0, 291600, 152064, 0xb017978a
-0, 295200, 152064, 0xc0bad34b
-0, 298800, 152064, 0x8bd439ee
-0, 302400, 152064, 0xa92735e4
-0, 306000, 152064, 0x1623f501
-0, 309600, 152064, 0x5be980b2
-0, 313200, 152064, 0x4306b9bf
-0, 316800, 152064, 0xb4f18976
-0, 320400, 152064, 0x4ffb9b46
-0, 324000, 152064, 0x23082275
-0, 327600, 152064, 0xc7f0e087
-0, 331200, 152064, 0x68b95327
-0, 334800, 152064, 0xd030a8e4
-0, 338400, 152064, 0xf8f9615c
-0, 342000, 152064, 0x1b26fe3e
-0, 345600, 152064, 0x3381608d
-0, 349200, 152064, 0x9939d49d
-0, 352800, 152064, 0x575f4f94
-0, 356400, 152064, 0x436c581c
-0, 360000, 152064, 0x8f47aa58
-0, 363600, 152064, 0xd251d95a
-0, 367200, 152064, 0x3c33b32c
-0, 370800, 152064, 0xa1e19413
-0, 374400, 152064, 0x8d95cbad
-0, 378000, 152064, 0x98cbd35e
-0, 381600, 152064, 0xceb81a0f
-0, 385200, 152064, 0x5490fab1
-0, 388800, 152064, 0x8e57a38c
-0, 392400, 152064, 0xc379517a
-0, 396000, 152064, 0xafc4f747
-0, 399600, 152064, 0xbc9c9be4
-0, 403200, 152064, 0xd602b2f5
-0, 406800, 152064, 0x8d85a450
-0, 410400, 152064, 0x48183c74
-0, 414000, 152064, 0xd1725590
-0, 417600, 152064, 0x5ef42ed7
-0, 421200, 152064, 0xad3a3883
-0, 424800, 152064, 0x7a3e0ddd
-0, 428400, 152064, 0x59bdfd38
-0, 432000, 152064, 0x5ac3ba9f
-0, 435600, 152064, 0x266cbd00
-0, 439200, 152064, 0x97d29e00
-0, 442800, 152064, 0x620774c2
-0, 446400, 152064, 0xaae8b96f
-0, 450000, 152064, 0x5f6bdfb6
-0, 453600, 152064, 0xb239da53
-0, 457200, 152064, 0x654b5680
-0, 460800, 152064, 0xd796b723
-0, 464400, 152064, 0xd5c84a81
-0, 468000, 152064, 0x2a761652
-0, 471600, 152064, 0x1137e145
-0, 475200, 152064, 0x1a9a451b
-0, 478800, 152064, 0x5ca751c4
-0, 482400, 152064, 0x074acec7
-0, 486000, 152064, 0x9ddfe77d
-0, 489600, 152064, 0xfb211c29
-0, 493200, 152064, 0x681ad4dd
-0, 496800, 152064, 0x702c12cc
-0, 500400, 152064, 0x556c5101
-0, 504000, 152064, 0x39d4bb54
-0, 507600, 152064, 0xa3a118d6
-0, 511200, 152064, 0xb78b7db1
-0, 514800, 152064, 0x4e20eed5
-0, 518400, 152064, 0x6555a9df
-0, 522000, 152064, 0xb607a9a4
-0, 525600, 152064, 0x3cf96a94
-0, 529200, 152064, 0xb2679007
-0, 532800, 152064, 0xf09d5b85
-0, 536400, 152064, 0x3961ba07
-0, 540000, 152064, 0x0c28363a
-0, 543600, 152064, 0x0a017c2d
-0, 547200, 152064, 0x3a661de3
-0, 550800, 152064, 0xf8d1bdee
-0, 554400, 152064, 0x6f47791b
-0, 558000, 152064, 0xe05b22c6
-0, 561600, 152064, 0x7cc93bb0
-0, 565200, 152064, 0xeb90c3d8
-0, 568800, 152064, 0x1a1eac98
-0, 572400, 152064, 0x92985671
-0, 576000, 152064, 0x2fe3ce53
-0, 579600, 152064, 0x61def691
-0, 583200, 152064, 0x90820730
-0, 586800, 152064, 0x17630372
-0, 590400, 152064, 0xaf6cea12
-0, 594000, 152064, 0xfe3b7ecc
-0, 597600, 152064, 0x904a5b2e
-0, 601200, 152064, 0x0d88d5f2
-0, 604800, 152064, 0x498d22b1
-0, 608400, 152064, 0x56baba83
-0, 612000, 152064, 0xda4d6dfa
-0, 615600, 152064, 0xaa38cbdd
-0, 619200, 152064, 0x4077f15d
-0, 622800, 152064, 0x7e006ec2
-0, 626400, 152064, 0x59964a89
-0, 630000, 152064, 0x04c078e3
-0, 633600, 152064, 0x7a5faf97
-0, 637200, 152064, 0xc517b3e9
-0, 640800, 152064, 0xfcc81af5
-0, 644400, 152064, 0xdcb44f62
-0, 648000, 152064, 0x2a080b72
-0, 651600, 152064, 0x91f88c67
-0, 655200, 152064, 0xd39caf81
-0, 658800, 152064, 0x0764ae31
-0, 662400, 152064, 0x0ddb82ed
-0, 666000, 152064, 0xed6d17e4
-0, 669600, 152064, 0xb4f74712
-0, 673200, 152064, 0x23a20787
-0, 676800, 152064, 0x853e7b33
-0, 680400, 152064, 0xc6bac173
-0, 684000, 152064, 0xb590ec15
-0, 687600, 152064, 0xfdd2943c
-0, 691200, 152064, 0xba5d1160
-0, 694800, 152064, 0xe732c5a7
-0, 698400, 152064, 0x279f6ce9
-0, 702000, 152064, 0xb3835829
-0, 705600, 152064, 0x0901b2a1
-0, 709200, 152064, 0x3df2b8f8
-0, 712800, 152064, 0x374496a4
-0, 716400, 152064, 0x1bc6a4ae
-0, 720000, 152064, 0xdb4b372e
-0, 723600, 152064, 0x8c11c214
-0, 727200, 152064, 0xd2d5c093
-0, 730800, 152064, 0x8dda094e
-0, 734400, 152064, 0x9b2cc401
-0, 738000, 152064, 0x1a3b49d5
-0, 741600, 152064, 0xaf5342ff
-0, 745200, 152064, 0x74c0de83
-0, 748800, 152064, 0xcf486137
-0, 752400, 152064, 0xcf005b3b
-0, 756000, 152064, 0x86a64c55
-0, 759600, 152064, 0xdd3f7ae9
-0, 763200, 152064, 0xb0d01e53
-0, 766800, 152064, 0x83219065
-0, 770400, 152064, 0x17a35d27
-0, 774000, 152064, 0xf92645b5
-0, 777600, 152064, 0x8322bdbf
-0, 781200, 152064, 0xd589f6a2
-0, 784800, 152064, 0x80a62d9e
-0, 788400, 152064, 0x05b3e0d1
-0, 792000, 152064, 0xd657aa0b
-0, 795600, 152064, 0xec5ac2dd
-0, 799200, 152064, 0xbf0ff969
-0, 802800, 152064, 0xc34a5140
-0, 806400, 152064, 0x814705c4
-0, 810000, 152064, 0xe9592008
-0, 813600, 152064, 0xf12c933c
-0, 817200, 152064, 0x2daee178
-0, 820800, 152064, 0xa2573028
-0, 824400, 152064, 0x6109f58d
-0, 828000, 152064, 0x64ab8ce4
-0, 831600, 152064, 0x13a88b6e
-0, 835200, 152064, 0x8f0181a9
-0, 838800, 152064, 0xd5295fd4
-0, 842400, 152064, 0xfdbeeb0d
-0, 846000, 152064, 0x05ecd231
-0, 849600, 152064, 0x48d164cd
-0, 853200, 152064, 0xc279cf63
-0, 856800, 152064, 0x1d5e6a03
-0, 860400, 152064, 0xd9dc1807
-0, 864000, 152064, 0xbcc83676
-0, 867600, 152064, 0x65a9811e
-0, 871200, 152064, 0x3ccfe5a8
-0, 874800, 152064, 0x2f2ff051
-0, 878400, 152064, 0x9193e093
-0, 882000, 152064, 0x9a30fdc6
-0, 885600, 152064, 0x90b7ea10
-0, 889200, 152064, 0x3291910c
-0, 892800, 152064, 0x2335d186
-0, 896400, 152064, 0x2890cf1d
-0, 900000, 152064, 0x8c8b6245
-0, 903600, 152064, 0x24b84eda
-0, 907200, 152064, 0x04a12446
-0, 910800, 152064, 0xd9d91d51
-0, 914400, 152064, 0xbf450adf
-0, 918000, 152064, 0xa19a9a41
-0, 921600, 152064, 0x2211ab01
-0, 925200, 152064, 0x8fe85430
-0, 928800, 152064, 0x5a152861
-0, 932400, 152064, 0x7fe76995
-0, 936000, 152064, 0x508b99cd
-0, 939600, 152064, 0x92e79437
-0, 943200, 152064, 0x8572eac9
-0, 946800, 152064, 0x42e3d513
-0, 950400, 152064, 0x6bee9e38
-0, 954000, 152064, 0x2858ad4b
-0, 957600, 152064, 0x96d87d00
-0, 961200, 152064, 0x749f1032
-0, 964800, 152064, 0x668fca6c
-0, 968400, 152064, 0x11d278d9
-0, 972000, 152064, 0x10fd46ea
-0, 975600, 152064, 0xc8b193c8
-0, 979200, 152064, 0x035e7d02
-0, 982800, 152064, 0x067f583c
-0, 986400, 152064, 0xd9648a1e
-0, 990000, 152064, 0x92487b7e
-0, 993600, 152064, 0xc7b35421
-0, 997200, 152064, 0x2ed57c1c
-0, 1000800, 152064, 0xefe24c5f
-0, 1004400, 152064, 0x8df0118b
-0, 1008000, 152064, 0x18f0278d
-0, 1011600, 152064, 0x63ac45ad
-0, 1015200, 152064, 0xd79849f0
-0, 1018800, 152064, 0x1f1d4dab
-0, 1022400, 152064, 0x736fb5b8
-0, 1026000, 152064, 0xc24eb80c
-0, 1029600, 152064, 0x64ca3b11
-0, 1033200, 152064, 0x35d8674c
-0, 1036800, 152064, 0x3c5a7b51
-0, 1040400, 152064, 0x97550b81
-0, 1044000, 152064, 0x731454b5
-0, 1047600, 152064, 0x01de43bc
-0, 1051200, 152064, 0xbda7afae
-0, 1054800, 152064, 0xeb34d714
-0, 1058400, 152064, 0x1260cc98
-0, 1062000, 152064, 0x7e592c36
-0, 1065600, 152064, 0x40b3676e
-0, 1069200, 152064, 0x8c9d6b94
-0, 1072800, 152064, 0xc7988665
-0, 1076400, 152064, 0xf2994d52
diff --git a/tests/ref/fate/h264-conformance-hcbp2_hhi_a b/tests/ref/fate/h264-conformance-hcbp2_hhi_a
deleted file mode 100644
index 87a9db1..0000000
--- a/tests/ref/fate/h264-conformance-hcbp2_hhi_a
+++ /dev/null
@@ -1,250 +0,0 @@
-0, 0, 152064, 0xf9deb95a
-0, 3600, 152064, 0xdce9c541
-0, 7200, 152064, 0xc45a8a77
-0, 10800, 152064, 0x5132a470
-0, 14400, 152064, 0x65542c98
-0, 18000, 152064, 0x2df95883
-0, 21600, 152064, 0x9f4f1280
-0, 25200, 152064, 0x11c9f32c
-0, 28800, 152064, 0x66535f0c
-0, 32400, 152064, 0x5b13770c
-0, 36000, 152064, 0xadcd3278
-0, 39600, 152064, 0x06e00e91
-0, 43200, 152064, 0x1fa1886f
-0, 46800, 152064, 0xd524b6a3
-0, 50400, 152064, 0x45f82b73
-0, 54000, 152064, 0x0fd301aa
-0, 57600, 152064, 0x2983acdd
-0, 61200, 152064, 0xe74004c6
-0, 64800, 152064, 0xe279328a
-0, 68400, 152064, 0x85be8f85
-0, 72000, 152064, 0xec503b6b
-0, 75600, 152064, 0x3d4495db
-0, 79200, 152064, 0x3a9774d2
-0, 82800, 152064, 0x80a07a42
-0, 86400, 152064, 0x484427ce
-0, 90000, 152064, 0x9e6b773f
-0, 93600, 152064, 0xd3be5f07
-0, 97200, 152064, 0x69a76c5e
-0, 100800, 152064, 0xd448fde2
-0, 104400, 152064, 0x04a34635
-0, 108000, 152064, 0xd4e3e0e1
-0, 111600, 152064, 0x2564cf13
-0, 115200, 152064, 0x98bc5167
-0, 118800, 152064, 0xcf06991f
-0, 122400, 152064, 0x3edf621f
-0, 126000, 152064, 0x47039967
-0, 129600, 152064, 0x299636b5
-0, 133200, 152064, 0x2bc0849d
-0, 136800, 152064, 0xe94946a6
-0, 140400, 152064, 0x5a5768ac
-0, 144000, 152064, 0xfe4ce9cd
-0, 147600, 152064, 0xbeb34b2e
-0, 151200, 152064, 0xa26020e3
-0, 154800, 152064, 0xb2514c55
-0, 158400, 152064, 0x723be4b1
-0, 162000, 152064, 0xeef4434e
-0, 165600, 152064, 0x1237e1db
-0, 169200, 152064, 0x4814c1fb
-0, 172800, 152064, 0xe7544446
-0, 176400, 152064, 0xd93a53d9
-0, 180000, 152064, 0x90e029c6
-0, 183600, 152064, 0xfa493dfc
-0, 187200, 152064, 0x081fa2d9
-0, 190800, 152064, 0x9782ef8c
-0, 194400, 152064, 0x1daf911c
-0, 198000, 152064, 0xc9058a57
-0, 201600, 152064, 0x68a90f04
-0, 205200, 152064, 0xc7115091
-0, 208800, 152064, 0xe9731898
-0, 212400, 152064, 0xd7bc206e
-0, 216000, 152064, 0xf760baac
-0, 219600, 152064, 0x6f9700e3
-0, 223200, 152064, 0xec54b42d
-0, 226800, 152064, 0x0dc5bf77
-0, 230400, 152064, 0x196e33c3
-0, 234000, 152064, 0x090cae46
-0, 237600, 152064, 0x06897499
-0, 241200, 152064, 0xf54cd959
-0, 244800, 152064, 0x24167906
-0, 248400, 152064, 0xea06e67b
-0, 252000, 152064, 0xa97ed69c
-0, 255600, 152064, 0x03c4ce82
-0, 259200, 152064, 0xca864ddd
-0, 262800, 152064, 0x1bc9956f
-0, 266400, 152064, 0x7864908c
-0, 270000, 152064, 0x52f3be55
-0, 273600, 152064, 0x78b469b5
-0, 277200, 152064, 0x8b3bb23e
-0, 280800, 152064, 0x5bed7f47
-0, 284400, 152064, 0x401b7e9c
-0, 288000, 152064, 0x4cbc3193
-0, 291600, 152064, 0xa00b7ed2
-0, 295200, 152064, 0xda548927
-0, 298800, 152064, 0x30a5cffb
-0, 302400, 152064, 0x9536bdf0
-0, 306000, 152064, 0x927e3cf4
-0, 309600, 152064, 0x95533148
-0, 313200, 152064, 0x763c553a
-0, 316800, 152064, 0x7010f280
-0, 320400, 152064, 0xa537667c
-0, 324000, 152064, 0xe599927a
-0, 327600, 152064, 0x72dde2ab
-0, 331200, 152064, 0x02089d51
-0, 334800, 152064, 0x4ca8231a
-0, 338400, 152064, 0x90b126aa
-0, 342000, 152064, 0x65a9260f
-0, 345600, 152064, 0xf37cf34a
-0, 349200, 152064, 0xf21f63f6
-0, 352800, 152064, 0x95209e85
-0, 356400, 152064, 0x0df00a65
-0, 360000, 152064, 0x0ce71e2b
-0, 363600, 152064, 0x6cbf8843
-0, 367200, 152064, 0x17f29296
-0, 370800, 152064, 0x88278aa9
-0, 374400, 152064, 0x84ad74d0
-0, 378000, 152064, 0xda48eea1
-0, 381600, 152064, 0xcaf33b25
-0, 385200, 152064, 0x9b288538
-0, 388800, 152064, 0xd1b7561f
-0, 392400, 152064, 0x4bfcbdac
-0, 396000, 152064, 0x1dd5b920
-0, 399600, 152064, 0xde50ceeb
-0, 403200, 152064, 0xa552963b
-0, 406800, 152064, 0xb2f5ef15
-0, 410400, 152064, 0x5abf061c
-0, 414000, 152064, 0x9b4c45f6
-0, 417600, 152064, 0xe61d1b02
-0, 421200, 152064, 0xe5728c4e
-0, 424800, 152064, 0xcb944655
-0, 428400, 152064, 0x648b951a
-0, 432000, 152064, 0xc3671a38
-0, 435600, 152064, 0x7d3fbcf3
-0, 439200, 152064, 0x3c0ba1c5
-0, 442800, 152064, 0xf5ac0d3a
-0, 446400, 152064, 0x87faf534
-0, 450000, 152064, 0xb3f05d11
-0, 453600, 152064, 0x825e3423
-0, 457200, 152064, 0xade45431
-0, 460800, 152064, 0x7715d496
-0, 464400, 152064, 0x983c45fa
-0, 468000, 152064, 0xe8d621d8
-0, 471600, 152064, 0x71ec7553
-0, 475200, 152064, 0xb20d5556
-0, 478800, 152064, 0xfa6bd00b
-0, 482400, 152064, 0x2a18acf1
-0, 486000, 152064, 0xa241c342
-0, 489600, 152064, 0xa3597426
-0, 493200, 152064, 0x6f72ff61
-0, 496800, 152064, 0xceffe8af
-0, 500400, 152064, 0x76853b09
-0, 504000, 152064, 0x3f58cc0c
-0, 507600, 152064, 0x16080a6d
-0, 511200, 152064, 0x752ae0aa
-0, 514800, 152064, 0x7dadf81b
-0, 518400, 152064, 0x9828aa7c
-0, 522000, 152064, 0x05a51e04
-0, 525600, 152064, 0xf9a92ae6
-0, 529200, 152064, 0xce0169f9
-0, 532800, 152064, 0x784d405b
-0, 536400, 152064, 0x531b9869
-0, 540000, 152064, 0xdf6a6129
-0, 543600, 152064, 0x5cdf5aac
-0, 547200, 152064, 0x28dd0050
-0, 550800, 152064, 0x76bd5ea7
-0, 554400, 152064, 0xcf3036bf
-0, 558000, 152064, 0x20365c0d
-0, 561600, 152064, 0x171ad303
-0, 565200, 152064, 0x1388416d
-0, 568800, 152064, 0x9b92f171
-0, 572400, 152064, 0xe2bc377a
-0, 576000, 152064, 0x90639e6c
-0, 579600, 152064, 0x1b50e759
-0, 583200, 152064, 0x43a9b680
-0, 586800, 152064, 0xb1780015
-0, 590400, 152064, 0x9a6783a6
-0, 594000, 152064, 0x1471e2e4
-0, 597600, 152064, 0xb1899be2
-0, 601200, 152064, 0x2facd37c
-0, 604800, 152064, 0x197361fc
-0, 608400, 152064, 0x823ffce1
-0, 612000, 152064, 0x9ce3cb14
-0, 615600, 152064, 0x16620232
-0, 619200, 152064, 0x4fedb29e
-0, 622800, 152064, 0xb45cd8b4
-0, 626400, 152064, 0x84387e9d
-0, 630000, 152064, 0xd5017ca0
-0, 633600, 152064, 0x106002a5
-0, 637200, 152064, 0x20c44a82
-0, 640800, 152064, 0x0694fbb2
-0, 644400, 152064, 0x849cfdf3
-0, 648000, 152064, 0xef827c85
-0, 651600, 152064, 0xc04ecde3
-0, 655200, 152064, 0x2f81bee2
-0, 658800, 152064, 0x86dbe8cc
-0, 662400, 152064, 0x9ee67bcd
-0, 666000, 152064, 0xa2618f39
-0, 669600, 152064, 0x35a40f36
-0, 673200, 152064, 0x9f6b0b54
-0, 676800, 152064, 0xcee2c0b5
-0, 680400, 152064, 0x3c3cb8f3
-0, 684000, 152064, 0xf3ab2e21
-0, 687600, 152064, 0xc51afcbc
-0, 691200, 152064, 0x272bbb4d
-0, 694800, 152064, 0x1448f2cc
-0, 698400, 152064, 0xd286e217
-0, 702000, 152064, 0xd6abf89e
-0, 705600, 152064, 0xf908bb8a
-0, 709200, 152064, 0x8a17ddd6
-0, 712800, 152064, 0xc30d9039
-0, 716400, 152064, 0xb8c6a557
-0, 720000, 152064, 0xf1675620
-0, 723600, 152064, 0xbb41b898
-0, 727200, 152064, 0x662298b2
-0, 730800, 152064, 0x0f8271aa
-0, 734400, 152064, 0x34d90197
-0, 738000, 152064, 0x15254eb2
-0, 741600, 152064, 0x4d942235
-0, 745200, 152064, 0xa2cefa6a
-0, 748800, 152064, 0x909a7050
-0, 752400, 152064, 0x219abae7
-0, 756000, 152064, 0x0166bc37
-0, 759600, 152064, 0x8b960965
-0, 763200, 152064, 0x71f6af2a
-0, 766800, 152064, 0x8d69f377
-0, 770400, 152064, 0x27b1a17d
-0, 774000, 152064, 0x6b09b049
-0, 777600, 152064, 0x733472e7
-0, 781200, 152064, 0x986efe32
-0, 784800, 152064, 0x99a37cc5
-0, 788400, 152064, 0x82433283
-0, 792000, 152064, 0x4698c0bd
-0, 795600, 152064, 0x1f6ce7f9
-0, 799200, 152064, 0x6e398d44
-0, 802800, 152064, 0x14ae5d85
-0, 806400, 152064, 0xef2f1e28
-0, 810000, 152064, 0x9dfe46ae
-0, 813600, 152064, 0x91997a8f
-0, 817200, 152064, 0x6c828dda
-0, 820800, 152064, 0x723f3f5c
-0, 824400, 152064, 0xcb86883d
-0, 828000, 152064, 0x1c25cbed
-0, 831600, 152064, 0x3cad814a
-0, 835200, 152064, 0xe0d8f5e7
-0, 838800, 152064, 0xaefb35cc
-0, 842400, 152064, 0x5dfc2181
-0, 846000, 152064, 0x13f26603
-0, 849600, 152064, 0x97a3dd0d
-0, 853200, 152064, 0xbecff890
-0, 856800, 152064, 0xd226badc
-0, 860400, 152064, 0x7f4adbd1
-0, 864000, 152064, 0x5da1565a
-0, 867600, 152064, 0x35cbac9c
-0, 871200, 152064, 0xf1b26f8a
-0, 874800, 152064, 0xc8d08d07
-0, 878400, 152064, 0xa9f643c2
-0, 882000, 152064, 0xc420b0ba
-0, 885600, 152064, 0x8871a4f5
-0, 889200, 152064, 0x4e7647b4
-0, 892800, 152064, 0xb4dad812
-0, 896400, 152064, 0x6a3d00d5
diff --git a/tests/ref/fate/h264-conformance-hcmp1_hhi_a b/tests/ref/fate/h264-conformance-hcmp1_hhi_a
deleted file mode 100644
index 88b758d..0000000
--- a/tests/ref/fate/h264-conformance-hcmp1_hhi_a
+++ /dev/null
@@ -1,250 +0,0 @@
-0, 0, 152064, 0xda244f3f
-0, 3600, 152064, 0x35a1cb02
-0, 7200, 152064, 0xa729d9ca
-0, 10800, 152064, 0x69d90602
-0, 14400, 152064, 0x4ccdae72
-0, 18000, 152064, 0x06f9d8b9
-0, 21600, 152064, 0x0a14a736
-0, 25200, 152064, 0xc344b167
-0, 28800, 152064, 0xf3303e92
-0, 32400, 152064, 0xbe28813f
-0, 36000, 152064, 0x971f4980
-0, 39600, 152064, 0x69124d31
-0, 43200, 152064, 0x6d93e7f2
-0, 46800, 152064, 0x5c1315e4
-0, 50400, 152064, 0xb011cfe4
-0, 54000, 152064, 0x65a0d147
-0, 57600, 152064, 0x463d8c39
-0, 61200, 152064, 0x15f2a757
-0, 64800, 152064, 0xc2418f1f
-0, 68400, 152064, 0x7a48b94c
-0, 72000, 152064, 0x1c079ec9
-0, 75600, 152064, 0x348ced32
-0, 79200, 152064, 0x6014d525
-0, 82800, 152064, 0x146ed41f
-0, 86400, 152064, 0x543177e6
-0, 90000, 152064, 0x79a4b44e
-0, 93600, 152064, 0x4401a7ae
-0, 97200, 152064, 0xc0aec3c1
-0, 100800, 152064, 0x92348852
-0, 104400, 152064, 0x90eece70
-0, 108000, 152064, 0x19efd00f
-0, 111600, 152064, 0x608912ac
-0, 115200, 152064, 0xa707bdb1
-0, 118800, 152064, 0x926e1ffe
-0, 122400, 152064, 0x56863ca8
-0, 126000, 152064, 0xe18e81b4
-0, 129600, 152064, 0xf17466f2
-0, 133200, 152064, 0x2281feef
-0, 136800, 152064, 0x33603b66
-0, 140400, 152064, 0xe30fad28
-0, 144000, 152064, 0x66efb21e
-0, 147600, 152064, 0x405f32d6
-0, 151200, 152064, 0xe90f262b
-0, 154800, 152064, 0xf85144b0
-0, 158400, 152064, 0xcff4feab
-0, 162000, 152064, 0x02b63e49
-0, 165600, 152064, 0x91d9ff77
-0, 169200, 152064, 0x2c6c0d2a
-0, 172800, 152064, 0xacad9e66
-0, 176400, 152064, 0x83951353
-0, 180000, 152064, 0x549c16e4
-0, 183600, 152064, 0xcad9610c
-0, 187200, 152064, 0x264e4b57
-0, 190800, 152064, 0x9758afe8
-0, 194400, 152064, 0x0273a81d
-0, 198000, 152064, 0x31c6f1a0
-0, 201600, 152064, 0x80d1c9cf
-0, 205200, 152064, 0x41b861f7
-0, 208800, 152064, 0xad416fe7
-0, 212400, 152064, 0xdde59bf0
-0, 216000, 152064, 0x886c491c
-0, 219600, 152064, 0x4bf4a21f
-0, 223200, 152064, 0x2581a06e
-0, 226800, 152064, 0x8188cf9b
-0, 230400, 152064, 0xbfaf82ce
-0, 234000, 152064, 0xed9ef8b1
-0, 237600, 152064, 0xf5f4e0c0
-0, 241200, 152064, 0xa24421ac
-0, 244800, 152064, 0xf0cdde38
-0, 248400, 152064, 0x7f211f2c
-0, 252000, 152064, 0x241ff38b
-0, 255600, 152064, 0x19bc25a6
-0, 259200, 152064, 0xd9d5ede9
-0, 262800, 152064, 0x88f98579
-0, 266400, 152064, 0x630da1aa
-0, 270000, 152064, 0x19abf44f
-0, 273600, 152064, 0x3a95d341
-0, 277200, 152064, 0xdeb9333e
-0, 280800, 152064, 0x0c994783
-0, 284400, 152064, 0xb58b7d26
-0, 288000, 152064, 0x6e392b24
-0, 291600, 152064, 0x1f7e2d63
-0, 295200, 152064, 0x732342d3
-0, 298800, 152064, 0xbda4a761
-0, 302400, 152064, 0xdc387777
-0, 306000, 152064, 0xd5d00469
-0, 309600, 152064, 0xc840cf6d
-0, 313200, 152064, 0x3dfef3d9
-0, 316800, 152064, 0xf731594f
-0, 320400, 152064, 0x126fef41
-0, 324000, 152064, 0x5705b1e3
-0, 327600, 152064, 0xa8ecbe94
-0, 331200, 152064, 0xcbcd0e48
-0, 334800, 152064, 0x3da860da
-0, 338400, 152064, 0x97882d5f
-0, 342000, 152064, 0x19803d16
-0, 345600, 152064, 0xa639b969
-0, 349200, 152064, 0xc0a00bc3
-0, 352800, 152064, 0xb12f0617
-0, 356400, 152064, 0x0e53481c
-0, 360000, 152064, 0x1fa0e47d
-0, 363600, 152064, 0x818119fa
-0, 367200, 152064, 0xc28ffc3e
-0, 370800, 152064, 0x8abdfb3c
-0, 374400, 152064, 0x670cb951
-0, 378000, 152064, 0x172808bd
-0, 381600, 152064, 0x6be1ea7f
-0, 385200, 152064, 0x05dbfadc
-0, 388800, 152064, 0xcfcfbcec
-0, 392400, 152064, 0x9306e1d2
-0, 396000, 152064, 0xcf3ccc54
-0, 399600, 152064, 0xf36ad41a
-0, 403200, 152064, 0x751b835b
-0, 406800, 152064, 0x7ebed47b
-0, 410400, 152064, 0x9659d022
-0, 414000, 152064, 0xef7701ae
-0, 417600, 152064, 0x5cdee3b0
-0, 421200, 152064, 0xf6c3ed42
-0, 424800, 152064, 0x412ee2fb
-0, 428400, 152064, 0x309cd2bd
-0, 432000, 152064, 0x50f09af5
-0, 435600, 152064, 0x4a05087a
-0, 439200, 152064, 0xaedc2125
-0, 442800, 152064, 0x54e2692a
-0, 446400, 152064, 0x0403590c
-0, 450000, 152064, 0x8a4c9833
-0, 453600, 152064, 0x36b6893e
-0, 457200, 152064, 0x21fd9204
-0, 460800, 152064, 0xa1cd3bc7
-0, 464400, 152064, 0x3cfa3d18
-0, 468000, 152064, 0xb5f7fefd
-0, 471600, 152064, 0x133cf831
-0, 475200, 152064, 0xcaabdd54
-0, 478800, 152064, 0xcab45366
-0, 482400, 152064, 0x8b6f4c90
-0, 486000, 152064, 0x4de74903
-0, 489600, 152064, 0x2dde0c4f
-0, 493200, 152064, 0x09364c1d
-0, 496800, 152064, 0x610318b9
-0, 500400, 152064, 0xd85109d5
-0, 504000, 152064, 0x27a1eac7
-0, 507600, 152064, 0xafd50e70
-0, 511200, 152064, 0x96ac088c
-0, 514800, 152064, 0x1332091c
-0, 518400, 152064, 0x9d38ce90
-0, 522000, 152064, 0xeff10d8e
-0, 525600, 152064, 0x6c320de3
-0, 529200, 152064, 0xeb683437
-0, 532800, 152064, 0xe8a73715
-0, 536400, 152064, 0x53a27669
-0, 540000, 152064, 0xd5665cdc
-0, 543600, 152064, 0x76bc4f86
-0, 547200, 152064, 0xb5282913
-0, 550800, 152064, 0xf788398b
-0, 554400, 152064, 0xa2a74268
-0, 558000, 152064, 0x1e8c57c4
-0, 561600, 152064, 0x12c0542f
-0, 565200, 152064, 0x8dbe9945
-0, 568800, 152064, 0x0f7583cd
-0, 572400, 152064, 0x814e9e0b
-0, 576000, 152064, 0x39575c04
-0, 579600, 152064, 0x75a07f38
-0, 583200, 152064, 0x8a6247c1
-0, 586800, 152064, 0x0f8d606e
-0, 590400, 152064, 0x7dcc4169
-0, 594000, 152064, 0x039d6df2
-0, 597600, 152064, 0x16b779c4
-0, 601200, 152064, 0x8b3a9767
-0, 604800, 152064, 0x281e6d83
-0, 608400, 152064, 0x7d22a528
-0, 612000, 152064, 0x93778828
-0, 615600, 152064, 0xd54c95fc
-0, 619200, 152064, 0xf4e76d9a
-0, 622800, 152064, 0xaa7ba3fd
-0, 626400, 152064, 0x94d88d91
-0, 630000, 152064, 0xa46b9c34
-0, 633600, 152064, 0x9dcb4d0c
-0, 637200, 152064, 0x347d0983
-0, 640800, 152064, 0x870ecd2b
-0, 644400, 152064, 0x5dafe6d6
-0, 648000, 152064, 0x10d77857
-0, 651600, 152064, 0xddc1d127
-0, 655200, 152064, 0x2732a13c
-0, 658800, 152064, 0x3d81bac9
-0, 662400, 152064, 0x619d3dd3
-0, 666000, 152064, 0x2db3e1ac
-0, 669600, 152064, 0x63a7e7e5
-0, 673200, 152064, 0x902a4c92
-0, 676800, 152064, 0x9c38e0f6
-0, 680400, 152064, 0x8ceb3a46
-0, 684000, 152064, 0x73cbb6bd
-0, 687600, 152064, 0x5f6fa7d6
-0, 691200, 152064, 0x8cdad086
-0, 694800, 152064, 0xe7cf083f
-0, 698400, 152064, 0x18c0f6b9
-0, 702000, 152064, 0xfe582ddf
-0, 705600, 152064, 0x5fca4740
-0, 709200, 152064, 0x072981ab
-0, 712800, 152064, 0xcb874172
-0, 716400, 152064, 0xfa153e05
-0, 720000, 152064, 0x259ae495
-0, 723600, 152064, 0x1714beb4
-0, 727200, 152064, 0xa051721e
-0, 730800, 152064, 0x52d17b85
-0, 734400, 152064, 0x9cbf5da3
-0, 738000, 152064, 0x28d69092
-0, 741600, 152064, 0xbdb942e7
-0, 745200, 152064, 0xeefe2253
-0, 748800, 152064, 0xbef2af4d
-0, 752400, 152064, 0x622dee36
-0, 756000, 152064, 0x61decf4e
-0, 759600, 152064, 0x8dfefdbe
-0, 763200, 152064, 0x78d67e90
-0, 766800, 152064, 0x9cddaa58
-0, 770400, 152064, 0x8d487f4d
-0, 774000, 152064, 0x67f58715
-0, 777600, 152064, 0xc9203f22
-0, 781200, 152064, 0x0fec8343
-0, 784800, 152064, 0xb57e7b6a
-0, 788400, 152064, 0xa2ed7700
-0, 792000, 152064, 0x34722cad
-0, 795600, 152064, 0x02c83b2a
-0, 799200, 152064, 0x91b11583
-0, 802800, 152064, 0x7676166d
-0, 806400, 152064, 0x76a9d5fc
-0, 810000, 152064, 0x4fcd1750
-0, 813600, 152064, 0xaa6ff7bf
-0, 817200, 152064, 0x5e2bfab6
-0, 820800, 152064, 0x3abec811
-0, 824400, 152064, 0x0711eb85
-0, 828000, 152064, 0xb10ebf41
-0, 831600, 152064, 0x32d8cb56
-0, 835200, 152064, 0x9b1ca411
-0, 838800, 152064, 0x771f0768
-0, 842400, 152064, 0x69e1258e
-0, 846000, 152064, 0xe8b352e2
-0, 849600, 152064, 0x3ee638d8
-0, 853200, 152064, 0x0bc48414
-0, 856800, 152064, 0xc1df5925
-0, 860400, 152064, 0xb30f705e
-0, 864000, 152064, 0x90654127
-0, 867600, 152064, 0x000e5f43
-0, 871200, 152064, 0x1f5e5e15
-0, 874800, 152064, 0x4aa48433
-0, 878400, 152064, 0xb74a56a3
-0, 882000, 152064, 0x94347a06
-0, 885600, 152064, 0xd14e58d4
-0, 889200, 152064, 0x60116d97
-0, 892800, 152064, 0xf2962979
-0, 896400, 152064, 0x7f176514
diff --git a/tests/ref/fate/h264-conformance-ls_sva_d b/tests/ref/fate/h264-conformance-ls_sva_d
deleted file mode 100644
index d458641..0000000
--- a/tests/ref/fate/h264-conformance-ls_sva_d
+++ /dev/null
@@ -1,1700 +0,0 @@
-0, 0, 38016, 0x85d20fc6
-0, 3600, 38016, 0xc0432c21
-0, 7200, 38016, 0x1450168f
-0, 10800, 38016, 0xeddb1833
-0, 14400, 38016, 0x631216d4
-0, 18000, 38016, 0xfcd1138b
-0, 21600, 38016, 0x181f17d5
-0, 25200, 38016, 0x3dc91855
-0, 28800, 38016, 0x92b71924
-0, 32400, 38016, 0xfcb6228d
-0, 36000, 38016, 0x11d04b4a
-0, 39600, 38016, 0x743a6a06
-0, 43200, 38016, 0xac511cc3
-0, 46800, 38016, 0x66bc1e2d
-0, 50400, 38016, 0x6c761ef3
-0, 54000, 38016, 0xa08a1ef5
-0, 57600, 38016, 0x777270da
-0, 61200, 38016, 0x9a738d9f
-0, 64800, 38016, 0x31a8afa2
-0, 68400, 38016, 0x1148cc11
-0, 72000, 38016, 0xf5fa1f26
-0, 75600, 38016, 0xc0481fbc
-0, 79200, 38016, 0x461b2228
-0, 82800, 38016, 0x27bb209d
-0, 86400, 38016, 0xbe921f04
-0, 90000, 38016, 0xabdbd493
-0, 93600, 38016, 0x4f6ad36e
-0, 97200, 38016, 0xe2f8d0ca
-0, 100800, 38016, 0xd82aaea2
-0, 104400, 38016, 0xb208854b
-0, 108000, 38016, 0xfe632920
-0, 111600, 38016, 0x1a8128ce
-0, 115200, 38016, 0xd9ea2be9
-0, 118800, 38016, 0x258b2ab0
-0, 122400, 38016, 0xb5812bef
-0, 126000, 38016, 0x00c92cdf
-0, 129600, 38016, 0x4a6b9f6f
-0, 133200, 38016, 0xb589b0a1
-0, 136800, 38016, 0xf2d0bbca
-0, 140400, 38016, 0xe614cce3
-0, 144000, 38016, 0x6d81d01c
-0, 147600, 38016, 0x7f32d175
-0, 151200, 38016, 0x6abc2f40
-0, 154800, 38016, 0x767d2f6a
-0, 158400, 38016, 0xd64b30cf
-0, 162000, 38016, 0xf83d3000
-0, 165600, 38016, 0x5f3230d5
-0, 169200, 38016, 0x80b330a0
-0, 172800, 38016, 0x42c4326e
-0, 176400, 38016, 0x7cb8d069
-0, 180000, 38016, 0xb7bb9d2f
-0, 183600, 38016, 0xf4f47c47
-0, 187200, 38016, 0xe3455aa0
-0, 190800, 38016, 0x3b074630
-0, 194400, 38016, 0x1fd44e63
-0, 198000, 38016, 0x5ecb6a07
-0, 201600, 38016, 0xe3a130c9
-0, 205200, 38016, 0x307f311a
-0, 208800, 38016, 0x4e2d3202
-0, 212400, 38016, 0x06ac31c1
-0, 216000, 38016, 0x767931ab
-0, 219600, 38016, 0xcb6433aa
-0, 223200, 38016, 0xc88e3597
-0, 226800, 38016, 0xfe06371f
-0, 230400, 38016, 0x9e3c8a14
-0, 234000, 38016, 0xba819e5b
-0, 237600, 38016, 0x0017a693
-0, 241200, 38016, 0x25aca2dd
-0, 244800, 38016, 0x3bf5980d
-0, 248400, 38016, 0x2a0ba2ae
-0, 252000, 38016, 0x99e19853
-0, 255600, 38016, 0x5e7a9699
-0, 259200, 38016, 0x11983c1a
-0, 262800, 38016, 0x5ab53cbf
-0, 266400, 38016, 0x49803f12
-0, 270000, 38016, 0xf1633fdc
-0, 273600, 38016, 0x91de3ff3
-0, 277200, 38016, 0x418942a1
-0, 280800, 38016, 0x670c4277
-0, 284400, 38016, 0xc04e403e
-0, 288000, 38016, 0xa33e40ad
-0, 291600, 38016, 0x7f959a9c
-0, 295200, 38016, 0x096696ae
-0, 298800, 38016, 0xdb41933c
-0, 302400, 38016, 0xb26086b4
-0, 306000, 38016, 0x80c97e07
-0, 309600, 38016, 0xa7416837
-0, 313200, 38016, 0xa82f6342
-0, 316800, 38016, 0x8da16527
-0, 320400, 38016, 0x1c1965a9
-0, 324000, 38016, 0x09ad470c
-0, 327600, 38016, 0x3f694725
-0, 331200, 38016, 0xa7034699
-0, 334800, 38016, 0x38104981
-0, 338400, 38016, 0x216048b7
-0, 342000, 38016, 0x24e04c22
-0, 345600, 38016, 0xbb7e4871
-0, 349200, 38016, 0x8c074b97
-0, 352800, 38016, 0x92aa4b79
-0, 356400, 38016, 0x073c4d97
-0, 360000, 38016, 0xe225f953
-0, 363600, 38016, 0xcaccf96b
-0, 367200, 38016, 0xc395cd82
-0, 370800, 38016, 0x8c61ad55
-0, 374400, 38016, 0x6fb988f2
-0, 378000, 38016, 0x99fe7aea
-0, 381600, 38016, 0xab3c73bf
-0, 385200, 38016, 0xcdb06bc4
-0, 388800, 38016, 0x65a1540a
-0, 392400, 38016, 0xc22f4fb0
-0, 396000, 38016, 0xe5ca4830
-0, 399600, 38016, 0x06b346f9
-0, 403200, 38016, 0x02154629
-0, 406800, 38016, 0x3d5e4467
-0, 410400, 38016, 0x6aa4460c
-0, 414000, 38016, 0x05bc47c4
-0, 417600, 38016, 0xc46e4666
-0, 421200, 38016, 0xc28145f5
-0, 424800, 38016, 0xf57f4811
-0, 428400, 38016, 0x1bbc49f8
-0, 432000, 38016, 0x34e14c2c
-0, 435600, 38016, 0x7e7d7740
-0, 439200, 38016, 0x97d798f3
-0, 442800, 38016, 0x7d71ca3b
-0, 446400, 38016, 0xc6bc0776
-0, 450000, 38016, 0xda052645
-0, 453600, 38016, 0xf0b32de9
-0, 457200, 38016, 0x996f23cf
-0, 460800, 38016, 0x22ea1a43
-0, 464400, 38016, 0xbde61021
-0, 468000, 38016, 0x8180079d
-0, 471600, 38016, 0x3ac6f314
-0, 475200, 38016, 0x93604f67
-0, 478800, 38016, 0xb9a55213
-0, 482400, 38016, 0x89c8523c
-0, 486000, 38016, 0x670a511b
-0, 489600, 38016, 0x62395128
-0, 493200, 38016, 0x01605431
-0, 496800, 38016, 0x677253cd
-0, 500400, 38016, 0xc57f56b1
-0, 504000, 38016, 0x767f5679
-0, 507600, 38016, 0x4abc5717
-0, 511200, 38016, 0x838657dc
-0, 514800, 38016, 0x63bf56ad
-0, 518400, 38016, 0x7019c8ad
-0, 522000, 38016, 0xebbaa7bf
-0, 525600, 38016, 0xebbc8ddb
-0, 529200, 38016, 0xea609f00
-0, 532800, 38016, 0x88e6b1e4
-0, 536400, 38016, 0x7f9edd6b
-0, 540000, 38016, 0xeaf354a6
-0, 543600, 38016, 0xf30274c9
-0, 547200, 38016, 0x05a756da
-0, 550800, 38016, 0xacea1ca6
-0, 554400, 38016, 0x1520d86d
-0, 558000, 38016, 0xb0f7afa4
-0, 561600, 38016, 0xe33c5802
-0, 565200, 38016, 0xce2a58cd
-0, 568800, 38016, 0xd3ad5a30
-0, 572400, 38016, 0x29aa5955
-0, 576000, 38016, 0x59015aef
-0, 579600, 38016, 0x247c5a72
-0, 583200, 38016, 0x79a85b27
-0, 586800, 38016, 0x6cf858fe
-0, 590400, 38016, 0x78ec5b20
-0, 594000, 38016, 0x7cb158c5
-0, 597600, 38016, 0xc52c581f
-0, 601200, 38016, 0x125c58bd
-0, 604800, 38016, 0xf8b257c9
-0, 608400, 38016, 0x20329756
-0, 612000, 38016, 0x60a07c12
-0, 615600, 38016, 0xa2c26ad1
-0, 619200, 38016, 0xcbbc681b
-0, 622800, 38016, 0x2c0562ad
-0, 626400, 38016, 0x8a72640d
-0, 630000, 38016, 0xe6e7756a
-0, 633600, 38016, 0x64608a48
-0, 637200, 38016, 0xe9bea9fa
-0, 640800, 38016, 0x24bac776
-0, 644400, 38016, 0x6aa9d01b
-0, 648000, 38016, 0xf41ebb02
-0, 651600, 38016, 0x28017154
-0, 655200, 38016, 0x3fc55eb4
-0, 658800, 38016, 0xe7bc5f22
-0, 662400, 38016, 0xe6706162
-0, 666000, 38016, 0xee385fe2
-0, 669600, 38016, 0x79c0600b
-0, 673200, 38016, 0x735a603f
-0, 676800, 38016, 0xe7916199
-0, 680400, 38016, 0x542d601d
-0, 684000, 38016, 0xbfaa611a
-0, 687600, 38016, 0xb7504e05
-0, 691200, 38016, 0xd1964339
-0, 694800, 38016, 0x4213278a
-0, 698400, 38016, 0xb503229f
-0, 702000, 38016, 0x166a091c
-0, 705600, 38016, 0x37176bbc
-0, 709200, 38016, 0x95977cc3
-0, 712800, 38016, 0x5bab93f4
-0, 716400, 38016, 0x71d5d142
-0, 720000, 38016, 0x97d1cfa6
-0, 723600, 38016, 0xac82ff20
-0, 727200, 38016, 0x489a1fa1
-0, 730800, 38016, 0x32944930
-0, 734400, 38016, 0x72a2647c
-0, 738000, 38016, 0x95b685d6
-0, 741600, 38016, 0xb7e19840
-0, 745200, 38016, 0x85569129
-0, 748800, 38016, 0x6bc6a197
-0, 752400, 38016, 0x55ccace8
-0, 756000, 38016, 0x9bbdc9c2
-0, 759600, 38016, 0xbce4ade3
-0, 763200, 38016, 0x39c7c48a
-0, 766800, 38016, 0x498ac4aa
-0, 770400, 38016, 0xeda3b715
-0, 774000, 38016, 0x700db089
-0, 777600, 38016, 0xf6b6bf36
-0, 781200, 38016, 0x6abebf1c
-0, 784800, 38016, 0x8855c17c
-0, 788400, 38016, 0xfba09dd5
-0, 792000, 38016, 0xd5868240
-0, 795600, 38016, 0x438074a2
-0, 799200, 38016, 0xc8b2c501
-0, 802800, 38016, 0xd48ec1ef
-0, 806400, 38016, 0xa715c4be
-0, 810000, 38016, 0xd758c281
-0, 813600, 38016, 0x07c25900
-0, 817200, 38016, 0xee7950e6
-0, 820800, 38016, 0x3e154be9
-0, 824400, 38016, 0xa8f33bb7
-0, 828000, 38016, 0xf493bc3c
-0, 831600, 38016, 0x9d69bccb
-0, 835200, 38016, 0xbf9fbafa
-0, 838800, 38016, 0x2e62b9a8
-0, 842400, 38016, 0x2f41bae1
-0, 846000, 38016, 0xd820355d
-0, 849600, 38016, 0xf3623118
-0, 853200, 38016, 0x659b4459
-0, 856800, 38016, 0xdcd74654
-0, 860400, 38016, 0x73f33f73
-0, 864000, 38016, 0xbf96b5ec
-0, 867600, 38016, 0xe9ebb550
-0, 871200, 38016, 0xfe12b5dd
-0, 874800, 38016, 0x9908b6d5
-0, 878400, 38016, 0xe805b8cf
-0, 882000, 38016, 0x1a8eb68a
-0, 885600, 38016, 0x6aed288d
-0, 889200, 38016, 0x162f167f
-0, 892800, 38016, 0x49110ae5
-0, 896400, 38016, 0xab060059
-0, 900000, 38016, 0x0fb8a0a8
-0, 903600, 38016, 0xf3b0b384
-0, 907200, 38016, 0x6f32bb1b
-0, 910800, 38016, 0x7278bb3a
-0, 914400, 38016, 0xdeb1bdcf
-0, 918000, 38016, 0x90efbc5c
-0, 921600, 38016, 0xd2f6bb28
-0, 925200, 38016, 0xba4dba32
-0, 928800, 38016, 0x0751ba19
-0, 932400, 38016, 0xc3f7b9db
-0, 936000, 38016, 0xca22c433
-0, 939600, 38016, 0x82a7e336
-0, 943200, 38016, 0x45e90a19
-0, 946800, 38016, 0x82cd2c11
-0, 950400, 38016, 0x4e2e56cc
-0, 954000, 38016, 0x0ad281c6
-0, 957600, 38016, 0x8685b8b7
-0, 961200, 38016, 0xe502b7b3
-0, 964800, 38016, 0x4898b696
-0, 968400, 38016, 0xe0fcb729
-0, 972000, 38016, 0xe5e0b822
-0, 975600, 38016, 0x9030b82c
-0, 979200, 38016, 0x7dc6b93c
-0, 982800, 38016, 0x727cb981
-0, 986400, 38016, 0xb08999c9
-0, 990000, 38016, 0x3e54b6d7
-0, 993600, 38016, 0x5d15c1e2
-0, 997200, 38016, 0x5840d8d7
-0, 1000800, 38016, 0x1109d730
-0, 1004400, 38016, 0xb898c47e
-0, 1008000, 38016, 0xbde196c6
-0, 1011600, 38016, 0x75999430
-0, 1015200, 38016, 0xa17db11e
-0, 1018800, 38016, 0xb428b220
-0, 1022400, 38016, 0x1537b1ed
-0, 1026000, 38016, 0x102ab213
-0, 1029600, 38016, 0xee38af9e
-0, 1033200, 38016, 0xc9c5b34e
-0, 1036800, 38016, 0x8618af6d
-0, 1040400, 38016, 0x97f3af7a
-0, 1044000, 38016, 0x222eb095
-0, 1047600, 38016, 0xb1508324
-0, 1051200, 38016, 0x2149ad09
-0, 1054800, 38016, 0x67261443
-0, 1058400, 38016, 0x90918df5
-0, 1062000, 38016, 0x5d43e726
-0, 1065600, 38016, 0x1d77dfa3
-0, 1069200, 38016, 0xa60b941c
-0, 1072800, 38016, 0x48813a99
-0, 1076400, 38016, 0x2324b77a
-0, 1080000, 38016, 0xdfd99d0d
-0, 1083600, 38016, 0x44129be1
-0, 1087200, 38016, 0x1137a099
-0, 1090800, 38016, 0xbd24a0a1
-0, 1094400, 38016, 0x3883a310
-0, 1098000, 38016, 0x0680a358
-0, 1101600, 38016, 0xf333a501
-0, 1105200, 38016, 0x3945a6ac
-0, 1108800, 38016, 0x79eea741
-0, 1112400, 38016, 0x8c7aa6b0
-0, 1116000, 38016, 0x0342642f
-0, 1119600, 38016, 0x83632b63
-0, 1123200, 38016, 0x1503ff51
-0, 1126800, 38016, 0xa4bcea0f
-0, 1130400, 38016, 0x37dcd11b
-0, 1134000, 38016, 0x9aa7287a
-0, 1137600, 38016, 0x34deae76
-0, 1141200, 38016, 0x51710057
-0, 1144800, 38016, 0x9ee6fc0a
-0, 1148400, 38016, 0xa419ea79
-0, 1152000, 38016, 0x49388f7e
-0, 1155600, 38016, 0x08498b2d
-0, 1159200, 38016, 0x104f8c4d
-0, 1162800, 38016, 0xdb998d74
-0, 1166400, 38016, 0xd54e8c95
-0, 1170000, 38016, 0x54a48e5e
-0, 1173600, 38016, 0xbe6f8cd0
-0, 1177200, 38016, 0x2a7f8ec2
-0, 1180800, 38016, 0x23848f19
-0, 1184400, 38016, 0x9b168ee3
-0, 1188000, 38016, 0xc2628fb6
-0, 1191600, 38016, 0xe2bdfd4e
-0, 1195200, 38016, 0xfdae1546
-0, 1198800, 38016, 0xb1fe20db
-0, 1202400, 38016, 0x5ebf23f0
-0, 1206000, 38016, 0xecbc1fcb
-0, 1209600, 38016, 0xe72e141c
-0, 1213200, 38016, 0xbad7f54d
-0, 1216800, 38016, 0x95ead3c6
-0, 1220400, 38016, 0xf5c6b948
-0, 1224000, 38016, 0x2f8b80ab
-0, 1227600, 38016, 0x0aed47a7
-0, 1231200, 38016, 0xdcb278e3
-0, 1234800, 38016, 0x2a677958
-0, 1238400, 38016, 0x45427ae8
-0, 1242000, 38016, 0xebce78de
-0, 1245600, 38016, 0xaf007bb1
-0, 1249200, 38016, 0xb4677cdb
-0, 1252800, 38016, 0xbf6d8024
-0, 1256400, 38016, 0xb67180de
-0, 1260000, 38016, 0xb1581358
-0, 1263600, 38016, 0x258f140d
-0, 1267200, 38016, 0x753d17e6
-0, 1270800, 38016, 0xf33816b4
-0, 1274400, 38016, 0x0d011c76
-0, 1278000, 38016, 0x48cfd85d
-0, 1281600, 38016, 0x13ce822d
-0, 1285200, 38016, 0x221a4468
-0, 1288800, 38016, 0x11364be7
-0, 1292400, 38016, 0xafc047b0
-0, 1296000, 38016, 0xeafd4217
-0, 1299600, 38016, 0x930b8a41
-0, 1303200, 38016, 0x2dda0bd2
-0, 1306800, 38016, 0x461cc3f2
-0, 1310400, 38016, 0xa99e962a
-0, 1314000, 38016, 0xc1d954ba
-0, 1317600, 38016, 0x0ce91a87
-0, 1321200, 38016, 0x10701e2d
-0, 1324800, 38016, 0x98c22205
-0, 1328400, 38016, 0xb76622f1
-0, 1332000, 38016, 0x6d1a22d4
-0, 1335600, 38016, 0x00ee23c5
-0, 1339200, 38016, 0xc38125e6
-0, 1342800, 38016, 0x8de52597
-0, 1346400, 38016, 0xec282293
-0, 1350000, 38016, 0xb50f2238
-0, 1353600, 38016, 0xbdcf1f9f
-0, 1357200, 38016, 0x5c6c1780
-0, 1360800, 38016, 0x41941237
-0, 1364400, 38016, 0x95ee1e69
-0, 1368000, 38016, 0x84b65009
-0, 1371600, 38016, 0x27bbf0ab
-0, 1375200, 38016, 0xdd86f4fb
-0, 1378800, 38016, 0x97733086
-0, 1382400, 38016, 0x3241472f
-0, 1386000, 38016, 0x5d050c50
-0, 1389600, 38016, 0x8378aa9b
-0, 1393200, 38016, 0x94f174cd
-0, 1396800, 38016, 0x5825df16
-0, 1400400, 38016, 0x5f362875
-0, 1404000, 38016, 0x30704cd6
-0, 1407600, 38016, 0xc74e3614
-0, 1411200, 38016, 0xe033eb04
-0, 1414800, 38016, 0x665be967
-0, 1418400, 38016, 0x95d5ed67
-0, 1422000, 38016, 0x37dfefc1
-0, 1425600, 38016, 0x1908ee8e
-0, 1429200, 38016, 0xf0cfee38
-0, 1432800, 38016, 0x871df078
-0, 1436400, 38016, 0xb2f2f0f9
-0, 1440000, 38016, 0xf955621f
-0, 1443600, 38016, 0xbd2365a5
-0, 1447200, 38016, 0xe70d6bb0
-0, 1450800, 38016, 0x857e6d00
-0, 1454400, 38016, 0x000d6ee5
-0, 1458000, 38016, 0x9a2f7244
-0, 1461600, 38016, 0xe8c2f83c
-0, 1465200, 38016, 0x23eb0377
-0, 1468800, 38016, 0xe0802a7f
-0, 1472400, 38016, 0x5dbc4d69
-0, 1476000, 38016, 0xa3031f36
-0, 1479600, 38016, 0x27fbb378
-0, 1483200, 38016, 0xeee9a313
-0, 1486800, 38016, 0x189b1e68
-0, 1490400, 38016, 0x9a90678a
-0, 1494000, 38016, 0x1a65ed20
-0, 1497600, 38016, 0x2f51beb7
-0, 1501200, 38016, 0x671ada9d
-0, 1504800, 38016, 0x30af355a
-0, 1508400, 38016, 0x1804d4f9
-0, 1512000, 38016, 0xee227951
-0, 1515600, 38016, 0x20dc3900
-0, 1519200, 38016, 0x334f82dc
-0, 1522800, 38016, 0xb1728506
-0, 1526400, 38016, 0x2236fc10
-0, 1530000, 38016, 0x80d2964d
-0, 1533600, 38016, 0x5e368712
-0, 1537200, 38016, 0x10408765
-0, 1540800, 38016, 0x4b3084c5
-0, 1544400, 38016, 0x975c473f
-0, 1548000, 38016, 0x6f16efa3
-0, 1551600, 38016, 0xe73aac5e
-0, 1555200, 38016, 0x996b6e24
-0, 1558800, 38016, 0x424f6f55
-0, 1562400, 38016, 0x33786d10
-0, 1566000, 38016, 0x8a0f6870
-0, 1569600, 38016, 0x5e8556d4
-0, 1573200, 38016, 0x863b2366
-0, 1576800, 38016, 0x3fa74842
-0, 1580400, 38016, 0x70208948
-0, 1584000, 38016, 0xcf005140
-0, 1587600, 38016, 0xa7585013
-0, 1591200, 38016, 0x61145096
-0, 1594800, 38016, 0x92b952a5
-0, 1598400, 38016, 0x35575235
-0, 1602000, 38016, 0x3e47ec63
-0, 1605600, 38016, 0xfce57b69
-0, 1609200, 38016, 0xf03815e6
-0, 1612800, 38016, 0xb5b6af64
-0, 1616400, 38016, 0x5e3f1b08
-0, 1620000, 38016, 0xd3f9ee61
-0, 1623600, 38016, 0xb8e2ee66
-0, 1627200, 38016, 0x86f8f4b5
-0, 1630800, 38016, 0x23c8f499
-0, 1634400, 38016, 0x634df498
-0, 1638000, 38016, 0xd2b3f570
-0, 1641600, 38016, 0x053e67d3
-0, 1645200, 38016, 0x8d2cbeb3
-0, 1648800, 38016, 0xba0b1e1c
-0, 1652400, 38016, 0x0f5c7d73
-0, 1656000, 38016, 0x46b2118a
-0, 1659600, 38016, 0x818ebae5
-0, 1663200, 38016, 0x4a7af8a9
-0, 1666800, 38016, 0x0c22f937
-0, 1670400, 38016, 0x967ef9b3
-0, 1674000, 38016, 0x530afd34
-0, 1677600, 38016, 0x2a00fdb6
-0, 1681200, 38016, 0xca14f913
-0, 1684800, 38016, 0x82b6f7bc
-0, 1688400, 38016, 0xd32879ec
-0, 1692000, 38016, 0x242b6920
-0, 1695600, 38016, 0x44fd66e4
-0, 1699200, 38016, 0x69d3479c
-0, 1702800, 38016, 0x41a63899
-0, 1706400, 38016, 0xfb370720
-0, 1710000, 38016, 0x5cf0f42d
-0, 1713600, 38016, 0x74e8ca33
-0, 1717200, 38016, 0x1f09cb30
-0, 1720800, 38016, 0xc5e8c1d8
-0, 1724400, 38016, 0x3a82bd74
-0, 1728000, 38016, 0xada0bd71
-0, 1731600, 38016, 0xe695bcc9
-0, 1735200, 38016, 0xc255bb45
-0, 1738800, 38016, 0x6deebbcd
-0, 1742400, 38016, 0x6bf5cef2
-0, 1746000, 38016, 0x8eaed078
-0, 1749600, 38016, 0x3a8addb0
-0, 1753200, 38016, 0x0f2bfe11
-0, 1756800, 38016, 0xe13d2e3b
-0, 1760400, 38016, 0x9bb7606f
-0, 1764000, 38016, 0x9fcc8899
-0, 1767600, 38016, 0xfa22a313
-0, 1771200, 38016, 0xc599b318
-0, 1774800, 38016, 0x33ecb361
-0, 1778400, 38016, 0x2ba8b2df
-0, 1782000, 38016, 0x0debb343
-0, 1785600, 38016, 0x8bbcb7cd
-0, 1789200, 38016, 0x093fbb20
-0, 1792800, 38016, 0x4340c0d2
-0, 1796400, 38016, 0xd765bcb8
-0, 1800000, 38016, 0xe9ea3103
-0, 1803600, 38016, 0x24d7a1ae
-0, 1807200, 38016, 0x9b9ac80f
-0, 1810800, 38016, 0x81b7da0c
-0, 1814400, 38016, 0xb7c5f017
-0, 1818000, 38016, 0xa0e9f9c1
-0, 1821600, 38016, 0x932111a9
-0, 1825200, 38016, 0x15fc17ba
-0, 1828800, 38016, 0x3c7710bd
-0, 1832400, 38016, 0xae1b0ba8
-0, 1836000, 38016, 0x7dc24093
-0, 1839600, 38016, 0x8b9042ad
-0, 1843200, 38016, 0x257f4c1c
-0, 1846800, 38016, 0xaa0442d8
-0, 1850400, 38016, 0xbedd462c
-0, 1854000, 38016, 0xa9bd4905
-0, 1857600, 38016, 0x69d74f50
-0, 1861200, 38016, 0x18143c0d
-0, 1864800, 38016, 0xd2eb5820
-0, 1868400, 38016, 0x94fb5e93
-0, 1872000, 38016, 0x3072f80d
-0, 1875600, 38016, 0xd838f186
-0, 1879200, 38016, 0x3e41e695
-0, 1882800, 38016, 0x66eef2cd
-0, 1886400, 38016, 0x3854ec56
-0, 1890000, 38016, 0x05d3f9c2
-0, 1893600, 38016, 0x53820cc3
-0, 1897200, 38016, 0x09d413ea
-0, 1900800, 38016, 0x82f217f2
-0, 1904400, 38016, 0x07b21d50
-0, 1908000, 38016, 0xd72155c2
-0, 1911600, 38016, 0x20b04c74
-0, 1915200, 38016, 0x5b8962f6
-0, 1918800, 38016, 0xfb8b72c9
-0, 1922400, 38016, 0x6d0f56a7
-0, 1926000, 38016, 0x97876300
-0, 1929600, 38016, 0xfd7f655f
-0, 1933200, 38016, 0x3e405ff6
-0, 1936800, 38016, 0x5ad27a20
-0, 1940400, 38016, 0x46125305
-0, 1944000, 38016, 0x91017b86
-0, 1947600, 38016, 0x5c150c66
-0, 1951200, 38016, 0xc3430969
-0, 1954800, 38016, 0x5f400689
-0, 1958400, 38016, 0x21ddf969
-0, 1962000, 38016, 0x5feff594
-0, 1965600, 38016, 0xb304f3c1
-0, 1969200, 38016, 0xa9c3f70e
-0, 1972800, 38016, 0x6014fa8e
-0, 1976400, 38016, 0x7198f22e
-0, 1980000, 38016, 0xe338e495
-0, 1983600, 38016, 0x9a69ea32
-0, 1987200, 38016, 0xc0cc5d05
-0, 1990800, 38016, 0xefa16044
-0, 1994400, 38016, 0x3e3c6120
-0, 1998000, 38016, 0x06ef63e1
-0, 2001600, 38016, 0x25d5631f
-0, 2005200, 38016, 0xbc8963ee
-0, 2008800, 38016, 0xc2336218
-0, 2012400, 38016, 0xb23965fd
-0, 2016000, 38016, 0x84c9651f
-0, 2019600, 38016, 0x41f6647a
-0, 2023200, 38016, 0xddbe6572
-0, 2026800, 38016, 0x113f65f2
-0, 2030400, 38016, 0x89beec24
-0, 2034000, 38016, 0x6490f37b
-0, 2037600, 38016, 0x15ecf84d
-0, 2041200, 38016, 0xa439f491
-0, 2044800, 38016, 0xda8bf5c4
-0, 2048400, 38016, 0x6bc2f96a
-0, 2052000, 38016, 0x243d0bac
-0, 2055600, 38016, 0xb7c611a2
-0, 2059200, 38016, 0x99243328
-0, 2062800, 38016, 0xa9534571
-0, 2066400, 38016, 0xa5a657bd
-0, 2070000, 38016, 0xd8d06892
-0, 2073600, 38016, 0xb4eb6c8d
-0, 2077200, 38016, 0xa3d36ca8
-0, 2080800, 38016, 0x153a6e9e
-0, 2084400, 38016, 0xf2607081
-0, 2088000, 38016, 0x799d7081
-0, 2091600, 38016, 0x377570cd
-0, 2095200, 38016, 0x90496e54
-0, 2098800, 38016, 0x1d4c746c
-0, 2102400, 38016, 0xbe5e72bb
-0, 2106000, 38016, 0x3c6a760d
-0, 2109600, 38016, 0xd4097614
-0, 2113200, 38016, 0xf45a7a28
-0, 2116800, 38016, 0x8fe37bb8
-0, 2120400, 38016, 0x966295dc
-0, 2124000, 38016, 0xb40da3df
-0, 2127600, 38016, 0x9714b2ac
-0, 2131200, 38016, 0xbdb3c61d
-0, 2134800, 38016, 0x12fcd320
-0, 2138400, 38016, 0x1ee8d858
-0, 2142000, 38016, 0x49e5e217
-0, 2145600, 38016, 0x92aef38e
-0, 2149200, 38016, 0xc26c0476
-0, 2152800, 38016, 0x8eed0e04
-0, 2156400, 38016, 0xe4e3118d
-0, 2160000, 38016, 0x282ce796
-0, 2163600, 38016, 0xbec801e1
-0, 2167200, 38016, 0x864afaf2
-0, 2170800, 38016, 0xe0860383
-0, 2174400, 38016, 0x4261001d
-0, 2178000, 38016, 0x976c0005
-0, 2181600, 38016, 0x69c40af3
-0, 2185200, 38016, 0xb3c00e18
-0, 2188800, 38016, 0x28300c2c
-0, 2192400, 38016, 0xf2d9ff9d
-0, 2196000, 38016, 0xcaeaf979
-0, 2199600, 38016, 0x6733f58e
-0, 2203200, 38016, 0x2bb80869
-0, 2206800, 38016, 0x3c370085
-0, 2210400, 38016, 0x11a2fa2a
-0, 2214000, 38016, 0x828ff770
-0, 2217600, 38016, 0x79bcf490
-0, 2221200, 38016, 0x31d5ee87
-0, 2224800, 38016, 0x6336f00d
-0, 2228400, 38016, 0x058af9d1
-0, 2232000, 38016, 0xff29eb2f
-0, 2235600, 38016, 0x3c3be1f4
-0, 2239200, 38016, 0xfbf5ddc2
-0, 2242800, 38016, 0x22a4d324
-0, 2246400, 38016, 0xb2d4d1d4
-0, 2250000, 38016, 0xa159171f
-0, 2253600, 38016, 0x61a80251
-0, 2257200, 38016, 0xe0429283
-0, 2260800, 38016, 0x5c255bd4
-0, 2264400, 38016, 0xdb0f57ac
-0, 2268000, 38016, 0x3c8bcbf0
-0, 2271600, 38016, 0x2be3d2ef
-0, 2275200, 38016, 0xcd2dc8cc
-0, 2278800, 38016, 0x6905c4cf
-0, 2282400, 38016, 0xd9c9c590
-0, 2286000, 38016, 0xa945cb51
-0, 2289600, 38016, 0x5c8458d3
-0, 2293200, 38016, 0xa1624b6e
-0, 2296800, 38016, 0xb167532e
-0, 2300400, 38016, 0x149d6413
-0, 2304000, 38016, 0x85d97340
-0, 2307600, 38016, 0x8f478203
-0, 2311200, 38016, 0x1902cc8e
-0, 2314800, 38016, 0x1521c5e5
-0, 2318400, 38016, 0xf2d6c7d8
-0, 2322000, 38016, 0x7150c510
-0, 2325600, 38016, 0xfc0ec330
-0, 2329200, 38016, 0x91c4c933
-0, 2332800, 38016, 0x5ec6cbc8
-0, 2336400, 38016, 0x23c0955c
-0, 2340000, 38016, 0x76fb7c27
-0, 2343600, 38016, 0x33c07597
-0, 2347200, 38016, 0x797b6acd
-0, 2350800, 38016, 0xc4945313
-0, 2354400, 38016, 0xa50f25da
-0, 2358000, 38016, 0x7bb6096c
-0, 2361600, 38016, 0x8a1acc48
-0, 2365200, 38016, 0x19a1c9b4
-0, 2368800, 38016, 0x4436cd03
-0, 2372400, 38016, 0xfd73d6fe
-0, 2376000, 38016, 0x25d3d4f0
-0, 2379600, 38016, 0x3acfcd98
-0, 2383200, 38016, 0x2ed3d071
-0, 2386800, 38016, 0x246fd4bd
-0, 2390400, 38016, 0x3e410c62
-0, 2394000, 38016, 0x29da1177
-0, 2397600, 38016, 0x039f1e46
-0, 2401200, 38016, 0x178d1e1a
-0, 2404800, 38016, 0x75561d47
-0, 2408400, 38016, 0x7d65193c
-0, 2412000, 38016, 0xd38d19a8
-0, 2415600, 38016, 0x39c92b20
-0, 2419200, 38016, 0x6c8aebc3
-0, 2422800, 38016, 0xd8d4f9be
-0, 2426400, 38016, 0x7e730a4a
-0, 2430000, 38016, 0xbfae1fee
-0, 2433600, 38016, 0x398f3484
-0, 2437200, 38016, 0xd8e84019
-0, 2440800, 38016, 0x2cf64db3
-0, 2444400, 38016, 0x7e074f09
-0, 2448000, 38016, 0xac384b5a
-0, 2451600, 38016, 0xd28b3a83
-0, 2455200, 38016, 0xa5ce5610
-0, 2458800, 38016, 0xde8565f7
-0, 2462400, 38016, 0x01397a1a
-0, 2466000, 38016, 0xdbdf7fb7
-0, 2469600, 38016, 0x8c1f8ba6
-0, 2473200, 38016, 0xab2a943c
-0, 2476800, 38016, 0x4f8b8421
-0, 2480400, 38016, 0x36f57b3a
-0, 2484000, 38016, 0x565c4dd9
-0, 2487600, 38016, 0x53c34715
-0, 2491200, 38016, 0x38fd4aaa
-0, 2494800, 38016, 0x4dca43eb
-0, 2498400, 38016, 0x1afe40f3
-0, 2502000, 38016, 0xc3dc43cc
-0, 2505600, 38016, 0x1d92431d
-0, 2509200, 38016, 0x3f794765
-0, 2512800, 38016, 0x1c5d4a71
-0, 2516400, 38016, 0xb601531e
-0, 2520000, 38016, 0x4d925d7c
-0, 2523600, 38016, 0x1c605f1e
-0, 2527200, 38016, 0x50ff5608
-0, 2530800, 38016, 0x8da14815
-0, 2534400, 38016, 0x53cc3007
-0, 2538000, 38016, 0x5ce82198
-0, 2541600, 38016, 0x074e15bc
-0, 2545200, 38016, 0x59fb13c9
-0, 2548800, 38016, 0xe28e13a6
-0, 2552400, 38016, 0xcb4f3fa8
-0, 2556000, 38016, 0x7fad560c
-0, 2559600, 38016, 0x7dbc614a
-0, 2563200, 38016, 0xe96f6d9c
-0, 2566800, 38016, 0xf3c47a74
-0, 2570400, 38016, 0xd2af8027
-0, 2574000, 38016, 0x504779d1
-0, 2577600, 38016, 0x876e7f5f
-0, 2581200, 38016, 0x959f8c3d
-0, 2584800, 38016, 0x64d690be
-0, 2588400, 38016, 0xdb899760
-0, 2592000, 38016, 0xbd229ba1
-0, 2595600, 38016, 0xdace575b
-0, 2599200, 38016, 0xfda46324
-0, 2602800, 38016, 0x57b75dbd
-0, 2606400, 38016, 0x264a59cf
-0, 2610000, 38016, 0xfde95cc8
-0, 2613600, 38016, 0x5116601b
-0, 2617200, 38016, 0x72e67205
-0, 2620800, 38016, 0xf1057674
-0, 2624400, 38016, 0x7e917eb9
-0, 2628000, 38016, 0x50ed8b28
-0, 2631600, 38016, 0x357a826c
-0, 2635200, 38016, 0xd68fa449
-0, 2638800, 38016, 0x3a839e39
-0, 2642400, 38016, 0x79469a1b
-0, 2646000, 38016, 0xa9ca9590
-0, 2649600, 38016, 0xbf399686
-0, 2653200, 38016, 0x40499eaf
-0, 2656800, 38016, 0x9972a76d
-0, 2660400, 38016, 0xa3d0aff4
-0, 2664000, 38016, 0xdf27b647
-0, 2667600, 38016, 0x4147c66e
-0, 2671200, 38016, 0x1378d1db
-0, 2674800, 38016, 0x1ca3d444
-0, 2678400, 38016, 0x464d9538
-0, 2682000, 38016, 0xaed28de9
-0, 2685600, 38016, 0xc77a9f86
-0, 2689200, 38016, 0x0882aa10
-0, 2692800, 38016, 0x206ac330
-0, 2696400, 38016, 0x63efd763
-0, 2700000, 38016, 0xbfe2e663
-0, 2703600, 38016, 0xfe6ff1ad
-0, 2707200, 38016, 0x60f9f47e
-0, 2710800, 38016, 0xba1cf0c0
-0, 2714400, 38016, 0x1880eb3d
-0, 2718000, 38016, 0xf0fdd350
-0, 2721600, 38016, 0xb678eedb
-0, 2725200, 38016, 0xa17cf5e4
-0, 2728800, 38016, 0x567fff2a
-0, 2732400, 38016, 0x52ab043b
-0, 2736000, 38016, 0x8e8b0bd9
-0, 2739600, 38016, 0x0f131a7e
-0, 2743200, 38016, 0x26aa2303
-0, 2746800, 38016, 0x70c12bab
-0, 2750400, 38016, 0xa8a93858
-0, 2754000, 38016, 0x289f3b94
-0, 2757600, 38016, 0x3d883605
-0, 2761200, 38016, 0xe171329e
-0, 2764800, 38016, 0x75292865
-0, 2768400, 38016, 0x1d2ac8dc
-0, 2772000, 38016, 0xa336aa94
-0, 2775600, 38016, 0xcede9906
-0, 2779200, 38016, 0x1c9a8b52
-0, 2782800, 38016, 0x2a9c8a78
-0, 2786400, 38016, 0x920a8583
-0, 2790000, 38016, 0xb3ee7e2d
-0, 2793600, 38016, 0x96be75fc
-0, 2797200, 38016, 0x2a8a68d2
-0, 2800800, 38016, 0xdf8e6baf
-0, 2804400, 38016, 0xd46570d1
-0, 2808000, 38016, 0x765b71af
-0, 2811600, 38016, 0x25fe71df
-0, 2815200, 38016, 0x9ca124e3
-0, 2818800, 38016, 0x77c51bab
-0, 2822400, 38016, 0x0b380db9
-0, 2826000, 38016, 0xb0be108b
-0, 2829600, 38016, 0x5c4808b8
-0, 2833200, 38016, 0x73331227
-0, 2836800, 38016, 0xce790cf2
-0, 2840400, 38016, 0x46ac0dfc
-0, 2844000, 38016, 0xdc310caf
-0, 2847600, 38016, 0x909c0606
-0, 2851200, 38016, 0x0756fb3e
-0, 2854800, 38016, 0x4eb0fb0d
-0, 2858400, 38016, 0x6276f6e2
-0, 2862000, 38016, 0x92e0f070
-0, 2865600, 38016, 0x6f2d793f
-0, 2869200, 38016, 0x215f704b
-0, 2872800, 38016, 0xf9b7765e
-0, 2876400, 38016, 0xdb6176bf
-0, 2880000, 38016, 0x2b5165eb
-0, 2883600, 38016, 0xf1145c06
-0, 2887200, 38016, 0x343f698d
-0, 2890800, 38016, 0xcb96713f
-0, 2894400, 38016, 0xc50f775a
-0, 2898000, 38016, 0xbb927e81
-0, 2901600, 38016, 0xa2497bd4
-0, 2905200, 38016, 0xe52b80fa
-0, 2908800, 38016, 0x900f7ac7
-0, 2912400, 38016, 0x77e77d0e
-0, 2916000, 38016, 0xdb33f302
-0, 2919600, 38016, 0xf0519288
-0, 2923200, 38016, 0x4552f487
-0, 2926800, 38016, 0xe7b5f34c
-0, 2930400, 38016, 0x0db18be6
-0, 2934000, 38016, 0xb9ba87c2
-0, 2937600, 38016, 0x1dc2f805
-0, 2941200, 38016, 0x4986f535
-0, 2944800, 38016, 0xc099f301
-0, 2948400, 38016, 0x3d8c6787
-0, 2952000, 38016, 0xd3a4796f
-0, 2955600, 38016, 0xfe01635f
-0, 2959200, 38016, 0xba8df082
-0, 2962800, 38016, 0x55f3f017
-0, 2966400, 38016, 0xf2d7f36a
-0, 2970000, 38016, 0x8bd8f7a1
-0, 2973600, 38016, 0xabcd638b
-0, 2977200, 38016, 0x69ae59ea
-0, 2980800, 38016, 0x5bf43408
-0, 2984400, 38016, 0x6466fd67
-0, 2988000, 38016, 0xc90effb4
-0, 2991600, 38016, 0x82110480
-0, 2995200, 38016, 0xb364f74b
-0, 2998800, 38016, 0x7f1efd76
-0, 3002400, 38016, 0x1a20f30f
-0, 3006000, 38016, 0x4b0fe377
-0, 3009600, 38016, 0x57b4c896
-0, 3013200, 38016, 0x92b1ab52
-0, 3016800, 38016, 0x10ceaf82
-0, 3020400, 38016, 0xc4d3b0b8
-0, 3024000, 38016, 0x68b9f314
-0, 3027600, 38016, 0xc627fd70
-0, 3031200, 38016, 0x5fc108dc
-0, 3034800, 38016, 0x0f1f12d7
-0, 3038400, 38016, 0x6edc208e
-0, 3042000, 38016, 0x91f824eb
-0, 3045600, 38016, 0x1464b836
-0, 3049200, 38016, 0x84c7c412
-0, 3052800, 38016, 0x3e8dd049
-0, 3056400, 38016, 0x493dd1a7
-0, 3060000, 38016, 0x25dfbd00
-0, 3063600, 38016, 0x140bbd33
-0, 3067200, 38016, 0x488e2db6
-0, 3070800, 38016, 0x9e4f2c0a
-0, 3074400, 38016, 0xd60928d3
-0, 3078000, 38016, 0x38b61e0b
-0, 3081600, 38016, 0xb6331660
-0, 3085200, 38016, 0x0a3a0e4c
-0, 3088800, 38016, 0x6ad9105b
-0, 3092400, 38016, 0x29a8cd6b
-0, 3096000, 38016, 0x35e1da7d
-0, 3099600, 38016, 0x824de492
-0, 3103200, 38016, 0x1c76d83c
-0, 3106800, 38016, 0xbe25d98d
-0, 3110400, 38016, 0x5efaf222
-0, 3114000, 38016, 0x17370266
-0, 3117600, 38016, 0x417a2375
-0, 3121200, 38016, 0xb7e423d3
-0, 3124800, 38016, 0x224020fe
-0, 3128400, 38016, 0x4bbe1ee9
-0, 3132000, 38016, 0x72aa1f21
-0, 3135600, 38016, 0xc810126d
-0, 3139200, 38016, 0x42730cd4
-0, 3142800, 38016, 0xfd510c5d
-0, 3146400, 38016, 0x7c6f1313
-0, 3150000, 38016, 0xc1b31b89
-0, 3153600, 38016, 0x57772339
-0, 3157200, 38016, 0x20922349
-0, 3160800, 38016, 0xea4f1a45
-0, 3164400, 38016, 0x79e214d2
-0, 3168000, 38016, 0x77521b5d
-0, 3171600, 38016, 0x5929276c
-0, 3175200, 38016, 0x40b3130d
-0, 3178800, 38016, 0x040a157e
-0, 3182400, 38016, 0x0de31983
-0, 3186000, 38016, 0xdb0a1852
-0, 3189600, 38016, 0x73111b91
-0, 3193200, 38016, 0xf7a61765
-0, 3196800, 38016, 0xc5dd2557
-0, 3200400, 38016, 0xabc32e16
-0, 3204000, 38016, 0x5f093823
-0, 3207600, 38016, 0x9f462f1e
-0, 3211200, 38016, 0x29822c19
-0, 3214800, 38016, 0x259a2697
-0, 3218400, 38016, 0x7ad61867
-0, 3222000, 38016, 0x32fe111f
-0, 3225600, 38016, 0xf65c1142
-0, 3229200, 38016, 0xc5b91a6d
-0, 3232800, 38016, 0x4461191e
-0, 3236400, 38016, 0x0458193a
-0, 3240000, 38016, 0x3ed084a9
-0, 3243600, 38016, 0x4dd28047
-0, 3247200, 38016, 0x18dd8523
-0, 3250800, 38016, 0x4ab87d32
-0, 3254400, 38016, 0xecd0824c
-0, 3258000, 38016, 0xae567d36
-0, 3261600, 38016, 0xfa2e82d0
-0, 3265200, 38016, 0xbce08c2e
-0, 3268800, 38016, 0x125094c4
-0, 3272400, 38016, 0x475e9b1d
-0, 3276000, 38016, 0x9b921150
-0, 3279600, 38016, 0x6f7b1124
-0, 3283200, 38016, 0xa1fe0d8b
-0, 3286800, 38016, 0x12930955
-0, 3290400, 38016, 0x3d981105
-0, 3294000, 38016, 0x92d92e3b
-0, 3297600, 38016, 0x29a33ed5
-0, 3301200, 38016, 0x8d0b578e
-0, 3304800, 38016, 0xda5571ba
-0, 3308400, 38016, 0xbc638172
-0, 3312000, 38016, 0x73fd9abb
-0, 3315600, 38016, 0x53df952b
-0, 3319200, 38016, 0xe1758a4c
-0, 3322800, 38016, 0x064f8812
-0, 3326400, 38016, 0xd9b08971
-0, 3330000, 38016, 0xfe6688a9
-0, 3333600, 38016, 0x3b50938b
-0, 3337200, 38016, 0x4e1a9c13
-0, 3340800, 38016, 0x63599bf0
-0, 3344400, 38016, 0x97e0957f
-0, 3348000, 38016, 0x5a6e98d7
-0, 3351600, 38016, 0xa4be8cf2
-0, 3355200, 38016, 0x53bb901e
-0, 3358800, 38016, 0x15f0994e
-0, 3362400, 38016, 0x71499a4b
-0, 3366000, 38016, 0xf41a87a5
-0, 3369600, 38016, 0x3e237999
-0, 3373200, 38016, 0xf77f5dd2
-0, 3376800, 38016, 0x89874799
-0, 3380400, 38016, 0x02d82294
-0, 3384000, 38016, 0xc5920154
-0, 3387600, 38016, 0x6e61f375
-0, 3391200, 38016, 0x41a6940c
-0, 3394800, 38016, 0x130b97f7
-0, 3398400, 38016, 0xdff09b51
-0, 3402000, 38016, 0xb2999bd6
-0, 3405600, 38016, 0x0bb99d20
-0, 3409200, 38016, 0x9f819633
-0, 3412800, 38016, 0x5bda9640
-0, 3416400, 38016, 0xdcf29321
-0, 3420000, 38016, 0xa6838a63
-0, 3423600, 38016, 0x820a825e
-0, 3427200, 38016, 0x69bb7859
-0, 3430800, 38016, 0x4a8c79c2
-0, 3434400, 38016, 0x1e97e67d
-0, 3438000, 38016, 0x1ad4de1b
-0, 3441600, 38016, 0xe8abeb33
-0, 3445200, 38016, 0xf3a51523
-0, 3448800, 38016, 0xb997399c
-0, 3452400, 38016, 0x9fee8105
-0, 3456000, 38016, 0xf2b6ada3
-0, 3459600, 38016, 0xe6f5bbb3
-0, 3463200, 38016, 0x8ed7ca9f
-0, 3466800, 38016, 0x711abc1a
-0, 3470400, 38016, 0x707ab544
-0, 3474000, 38016, 0x03b8af51
-0, 3477600, 38016, 0x50497b2c
-0, 3481200, 38016, 0x72b57a30
-0, 3484800, 38016, 0xfb6d8164
-0, 3488400, 38016, 0x88618e82
-0, 3492000, 38016, 0xb7369e49
-0, 3495600, 38016, 0x2502a3ca
-0, 3499200, 38016, 0x793aa276
-0, 3502800, 38016, 0x883a8ec6
-0, 3506400, 38016, 0x5f7784e5
-0, 3510000, 38016, 0xddfa7e94
-0, 3513600, 38016, 0xdb877fb8
-0, 3517200, 38016, 0x07e07f39
-0, 3520800, 38016, 0x412590fb
-0, 3524400, 38016, 0x1bd1b527
-0, 3528000, 38016, 0xbb6098c3
-0, 3531600, 38016, 0x5f1b8788
-0, 3535200, 38016, 0x42f068e8
-0, 3538800, 38016, 0x316b53bb
-0, 3542400, 38016, 0xbdbb3fa0
-0, 3546000, 38016, 0xa68f506c
-0, 3549600, 38016, 0xca355d03
-0, 3553200, 38016, 0xfafc6b88
-0, 3556800, 38016, 0x0f106535
-0, 3560400, 38016, 0xa4ae4e63
-0, 3564000, 38016, 0xb206400f
-0, 3567600, 38016, 0x3a5946d1
-0, 3571200, 38016, 0xca739868
-0, 3574800, 38016, 0xe6939d41
-0, 3578400, 38016, 0x2ec19a76
-0, 3582000, 38016, 0x614e96a4
-0, 3585600, 38016, 0x2c2b9348
-0, 3589200, 38016, 0xa00c7f1f
-0, 3592800, 38016, 0x95cb6eca
-0, 3596400, 38016, 0x069d6c4c
-0, 3600000, 38016, 0xe17e03e3
-0, 3603600, 38016, 0xa7491870
-0, 3607200, 38016, 0xacc91e48
-0, 3610800, 38016, 0x99eb1e2a
-0, 3614400, 38016, 0xb2eb1279
-0, 3618000, 38016, 0xa5020c77
-0, 3621600, 38016, 0xde966613
-0, 3625200, 38016, 0xac7f6e1e
-0, 3628800, 38016, 0x1c378a7a
-0, 3632400, 38016, 0x32e6d8a4
-0, 3636000, 38016, 0xecb8d286
-0, 3639600, 38016, 0xa497d941
-0, 3643200, 38016, 0x8ad7d36e
-0, 3646800, 38016, 0xdbd8a91a
-0, 3650400, 38016, 0x718f61d7
-0, 3654000, 38016, 0x862619cf
-0, 3657600, 38016, 0xaa049781
-0, 3661200, 38016, 0xd3986887
-0, 3664800, 38016, 0x9e9f5782
-0, 3668400, 38016, 0x2a9d4f70
-0, 3672000, 38016, 0x62b91421
-0, 3675600, 38016, 0x32313eaa
-0, 3679200, 38016, 0xf9bf1879
-0, 3682800, 38016, 0xc33c0811
-0, 3686400, 38016, 0xe9c21227
-0, 3690000, 38016, 0xf2922db6
-0, 3693600, 38016, 0x669d0627
-0, 3697200, 38016, 0x64c1048a
-0, 3700800, 38016, 0xdd28fa70
-0, 3704400, 38016, 0xd88e8b77
-0, 3708000, 38016, 0x3716bdb8
-0, 3711600, 38016, 0x1834ef57
-0, 3715200, 38016, 0xddb800b7
-0, 3718800, 38016, 0x140302cc
-0, 3722400, 38016, 0x7fa60568
-0, 3726000, 38016, 0x7cc6fd4b
-0, 3729600, 38016, 0xf14c2568
-0, 3733200, 38016, 0x2ee88bbc
-0, 3736800, 38016, 0x915cd143
-0, 3740400, 38016, 0x13ede5fa
-0, 3744000, 38016, 0x6615f63b
-0, 3747600, 38016, 0x8814f54f
-0, 3751200, 38016, 0xb53ef24a
-0, 3754800, 38016, 0xc6a8ee80
-0, 3758400, 38016, 0x9473ee09
-0, 3762000, 38016, 0x9b77d932
-0, 3765600, 38016, 0x142fc69a
-0, 3769200, 38016, 0xb238c6a2
-0, 3772800, 38016, 0x4364d302
-0, 3776400, 38016, 0xde39d174
-0, 3780000, 38016, 0x7fca7fa6
-0, 3783600, 38016, 0x77678d42
-0, 3787200, 38016, 0xaa7e8b68
-0, 3790800, 38016, 0xeecb8c89
-0, 3794400, 38016, 0x6e5e8980
-0, 3798000, 38016, 0x4f4a80de
-0, 3801600, 38016, 0xb3b5cee6
-0, 3805200, 38016, 0x0c72cf1c
-0, 3808800, 38016, 0xd83fd12d
-0, 3812400, 38016, 0x8deeda59
-0, 3816000, 38016, 0xe7fae46e
-0, 3819600, 38016, 0x8233ecd5
-0, 3823200, 38016, 0x0c32808c
-0, 3826800, 38016, 0xf43f8571
-0, 3830400, 38016, 0xae898f01
-0, 3834000, 38016, 0x5a4a99e9
-0, 3837600, 38016, 0x589f9b80
-0, 3841200, 38016, 0x6ca5a33b
-0, 3844800, 38016, 0x3811af0a
-0, 3848400, 38016, 0x8272eda7
-0, 3852000, 38016, 0xa807f046
-0, 3855600, 38016, 0x5b4fec80
-0, 3859200, 38016, 0xb6e6e7fa
-0, 3862800, 38016, 0x250cdb5c
-0, 3866400, 38016, 0x3f38e876
-0, 3870000, 38016, 0x8110e94a
-0, 3873600, 38016, 0x0f19abd7
-0, 3877200, 38016, 0x9e1ca9bd
-0, 3880800, 38016, 0x1f33abae
-0, 3884400, 38016, 0xff18ad65
-0, 3888000, 38016, 0x3d02b300
-0, 3891600, 38016, 0xb7a9b4b2
-0, 3895200, 38016, 0xd8cab454
-0, 3898800, 38016, 0xb48ab772
-0, 3902400, 38016, 0x7f98fe59
-0, 3906000, 38016, 0x786c1795
-0, 3909600, 38016, 0x013437ff
-0, 3913200, 38016, 0xba28622a
-0, 3916800, 38016, 0xf48486e1
-0, 3920400, 38016, 0xc13695c4
-0, 3924000, 38016, 0x1fc5a4d2
-0, 3927600, 38016, 0x016caefd
-0, 3931200, 38016, 0x76b8bc54
-0, 3934800, 38016, 0xcf63bdbc
-0, 3938400, 38016, 0xeb02c0e2
-0, 3942000, 38016, 0xb57dc067
-0, 3945600, 38016, 0x8ec8c058
-0, 3949200, 38016, 0xcb04be49
-0, 3952800, 38016, 0xceccbfac
-0, 3956400, 38016, 0x3408c0c3
-0, 3960000, 38016, 0xee526afa
-0, 3963600, 38016, 0xd7529aad
-0, 3967200, 38016, 0x98bd9221
-0, 3970800, 38016, 0x2fbd7e5a
-0, 3974400, 38016, 0x0fb8a8fc
-0, 3978000, 38016, 0xfd28af91
-0, 3981600, 38016, 0x81db9907
-0, 3985200, 38016, 0x1f0a8ae7
-0, 3988800, 38016, 0xd91e93e3
-0, 3992400, 38016, 0x5fe6b043
-0, 3996000, 38016, 0x2a618a48
-0, 3999600, 38016, 0xef1c8cc2
-0, 4003200, 38016, 0x928595ce
-0, 4006800, 38016, 0xf2a59a43
-0, 4010400, 38016, 0x61bf92d0
-0, 4014000, 38016, 0x584d840f
-0, 4017600, 38016, 0x42177cb1
-0, 4021200, 38016, 0x08867c3b
-0, 4024800, 38016, 0x5a89813b
-0, 4028400, 38016, 0xba558022
-0, 4032000, 38016, 0x3d58878a
-0, 4035600, 38016, 0x8d215911
-0, 4039200, 38016, 0xea27370c
-0, 4042800, 38016, 0x7e2a1a9c
-0, 4046400, 38016, 0xbb86f763
-0, 4050000, 38016, 0xf03fd3c7
-0, 4053600, 38016, 0x1eaac263
-0, 4057200, 38016, 0x8a4bd0e1
-0, 4060800, 38016, 0x5adcf66d
-0, 4064400, 38016, 0xa0320a89
-0, 4068000, 38016, 0x77338f96
-0, 4071600, 38016, 0xf3498f6a
-0, 4075200, 38016, 0x7e248dcf
-0, 4078800, 38016, 0xf7f68dcc
-0, 4082400, 38016, 0x5da597c9
-0, 4086000, 38016, 0x63db9d00
-0, 4089600, 38016, 0xd1f09e52
-0, 4093200, 38016, 0xfc7ba2e1
-0, 4096800, 38016, 0x8c26ab25
-0, 4100400, 38016, 0x6a45add3
-0, 4104000, 38016, 0x0dd7b2a2
-0, 4107600, 38016, 0x70c00c4f
-0, 4111200, 38016, 0x437e255e
-0, 4114800, 38016, 0x63dd455b
-0, 4118400, 38016, 0x01453a2e
-0, 4122000, 38016, 0x08c120af
-0, 4125600, 38016, 0xf3111451
-0, 4129200, 38016, 0xf3f10603
-0, 4132800, 38016, 0xb154fa41
-0, 4136400, 38016, 0x4734ee73
-0, 4140000, 38016, 0x28ca7926
-0, 4143600, 38016, 0xbb628234
-0, 4147200, 38016, 0x0ca1b42f
-0, 4150800, 38016, 0x8397b202
-0, 4154400, 38016, 0x9d92b832
-0, 4158000, 38016, 0x8fbeb4b2
-0, 4161600, 38016, 0x056aa904
-0, 4165200, 38016, 0x4e78a55c
-0, 4168800, 38016, 0xe8a8a265
-0, 4172400, 38016, 0xb703a17b
-0, 4176000, 38016, 0xe79e9d71
-0, 4179600, 38016, 0xbd769f5d
-0, 4183200, 38016, 0x602ea70f
-0, 4186800, 38016, 0x034caf76
-0, 4190400, 38016, 0x28dd9702
-0, 4194000, 38016, 0xc8879c85
-0, 4197600, 38016, 0x15b098f2
-0, 4201200, 38016, 0xf34b9ce5
-0, 4204800, 38016, 0x6d159fbf
-0, 4208400, 38016, 0x22eb9cac
-0, 4212000, 38016, 0xae42a220
-0, 4215600, 38016, 0x1275a131
-0, 4219200, 38016, 0x8188a057
-0, 4222800, 38016, 0x65dea0d1
-0, 4226400, 38016, 0x5bd19be2
-0, 4230000, 38016, 0xfbd99219
-0, 4233600, 38016, 0xad19b3a2
-0, 4237200, 38016, 0xa897bb92
-0, 4240800, 38016, 0x5b1fbf2e
-0, 4244400, 38016, 0x02a5cb24
-0, 4248000, 38016, 0xd6ead6fe
-0, 4251600, 38016, 0x3083de8a
-0, 4255200, 38016, 0xbf1decb4
-0, 4258800, 38016, 0xd92af986
-0, 4262400, 38016, 0x4c520154
-0, 4266000, 38016, 0xd45805a1
-0, 4269600, 38016, 0x25e2084d
-0, 4273200, 38016, 0x4e3d0960
-0, 4276800, 38016, 0x5b449ef2
-0, 4280400, 38016, 0xda15abcc
-0, 4284000, 38016, 0x1b3ba622
-0, 4287600, 38016, 0xaf61a32a
-0, 4291200, 38016, 0xcfa39e3d
-0, 4294800, 38016, 0x8865a56c
-0, 4298400, 38016, 0x3bc9af9b
-0, 4302000, 38016, 0x0a83c081
-0, 4305600, 38016, 0x5ccec976
-0, 4309200, 38016, 0x1f1fc906
-0, 4312800, 38016, 0x1ef6cc46
-0, 4316400, 38016, 0x7776c39e
-0, 4320000, 38016, 0x5860a212
-0, 4323600, 38016, 0x2d9092a3
-0, 4327200, 38016, 0x964d9f81
-0, 4330800, 38016, 0xc35c9691
-0, 4334400, 38016, 0x5e0dc673
-0, 4338000, 38016, 0xada3b7d6
-0, 4341600, 38016, 0x4f3a8d03
-0, 4345200, 38016, 0xfcb4861a
-0, 4348800, 38016, 0xfa908149
-0, 4352400, 38016, 0x6994c514
-0, 4356000, 38016, 0x37c5aaa9
-0, 4359600, 38016, 0x207abcfe
-0, 4363200, 38016, 0x778d7a2d
-0, 4366800, 38016, 0x60b773ff
-0, 4370400, 38016, 0x41cd67d5
-0, 4374000, 38016, 0x3c595a99
-0, 4377600, 38016, 0xd672b14c
-0, 4381200, 38016, 0x7db2c0fd
-0, 4384800, 38016, 0x3d21cf34
-0, 4388400, 38016, 0xdd1cf044
-0, 4392000, 38016, 0xc4594bcb
-0, 4395600, 38016, 0x595e4356
-0, 4399200, 38016, 0x9cc53c0d
-0, 4402800, 38016, 0x78fc325f
-0, 4406400, 38016, 0xc632324f
-0, 4410000, 38016, 0x18b1f5c1
-0, 4413600, 38016, 0x63aff55e
-0, 4417200, 38016, 0x8a50fb04
-0, 4420800, 38016, 0x7d5e20f6
-0, 4424400, 38016, 0xc31114bb
-0, 4428000, 38016, 0xf4852e6e
-0, 4431600, 38016, 0x9b6927ba
-0, 4435200, 38016, 0x024836c2
-0, 4438800, 38016, 0x20843b21
-0, 4442400, 38016, 0x19134055
-0, 4446000, 38016, 0x1cd843f7
-0, 4449600, 38016, 0x122705b1
-0, 4453200, 38016, 0x1880fc3d
-0, 4456800, 38016, 0x78dbfeaf
-0, 4460400, 38016, 0x212c273d
-0, 4464000, 38016, 0xff2eb7be
-0, 4467600, 38016, 0xe0bd752d
-0, 4471200, 38016, 0x277b478a
-0, 4474800, 38016, 0x59e84ab2
-0, 4478400, 38016, 0x338a50e4
-0, 4482000, 38016, 0xaf715a99
-0, 4485600, 38016, 0xd1e459a8
-0, 4489200, 38016, 0x70da4ac9
-0, 4492800, 38016, 0xa695540d
-0, 4496400, 38016, 0x9385320b
-0, 4500000, 38016, 0x9a8703cd
-0, 4503600, 38016, 0xbeda239e
-0, 4507200, 38016, 0x5bf262c1
-0, 4510800, 38016, 0x9b216899
-0, 4514400, 38016, 0x52f24135
-0, 4518000, 38016, 0x75a23955
-0, 4521600, 38016, 0xb92f4ea2
-0, 4525200, 38016, 0xdac95333
-0, 4528800, 38016, 0x1a2d4ed4
-0, 4532400, 38016, 0xfce25650
-0, 4536000, 38016, 0x1e264fdd
-0, 4539600, 38016, 0xe77349b8
-0, 4543200, 38016, 0x7d2046b0
-0, 4546800, 38016, 0x65373899
-0, 4550400, 38016, 0x3b3569ae
-0, 4554000, 38016, 0x346485d0
-0, 4557600, 38016, 0x80b93e57
-0, 4561200, 38016, 0xeb724ba5
-0, 4564800, 38016, 0x533d7459
-0, 4568400, 38016, 0x60f957a7
-0, 4572000, 38016, 0x900281b2
-0, 4575600, 38016, 0xf4489e06
-0, 4579200, 38016, 0xe77730c9
-0, 4582800, 38016, 0x41b23060
-0, 4586400, 38016, 0x4e8c3012
-0, 4590000, 38016, 0x651f2cff
-0, 4593600, 38016, 0x787b2e99
-0, 4597200, 38016, 0x541e2d10
-0, 4600800, 38016, 0x27a824a3
-0, 4604400, 38016, 0xe1e72121
-0, 4608000, 38016, 0xffb52626
-0, 4611600, 38016, 0x7677c8c9
-0, 4615200, 38016, 0xa501d38f
-0, 4618800, 38016, 0xa6d2c5dc
-0, 4622400, 38016, 0xba94d1c1
-0, 4626000, 38016, 0x137dac4d
-0, 4629600, 38016, 0x65c1bd6e
-0, 4633200, 38016, 0x7a32cd65
-0, 4636800, 38016, 0x518adf61
-0, 4640400, 38016, 0x8baaee58
-0, 4644000, 38016, 0xe7642712
-0, 4647600, 38016, 0xba191b45
-0, 4651200, 38016, 0x93dd16b1
-0, 4654800, 38016, 0x22831478
-0, 4658400, 38016, 0xe48c103a
-0, 4662000, 38016, 0x7c2709e7
-0, 4665600, 38016, 0xd7d8f454
-0, 4669200, 38016, 0xc504f31a
-0, 4672800, 38016, 0x2510e4ae
-0, 4676400, 38016, 0x0b56d119
-0, 4680000, 38016, 0x6c248150
-0, 4683600, 38016, 0xbac4be42
-0, 4687200, 38016, 0x5787c4a8
-0, 4690800, 38016, 0x65b3d0bd
-0, 4694400, 38016, 0xdcc4efbd
-0, 4698000, 38016, 0xfe92f78b
-0, 4701600, 38016, 0xfda60c1c
-0, 4705200, 38016, 0x4997238e
-0, 4708800, 38016, 0xfaca43ca
-0, 4712400, 38016, 0x81fe533c
-0, 4716000, 38016, 0x350bcb11
-0, 4719600, 38016, 0xacfdcde4
-0, 4723200, 38016, 0xb039c663
-0, 4726800, 38016, 0x3402c942
-0, 4730400, 38016, 0x388bc3d0
-0, 4734000, 38016, 0x85dec11a
-0, 4737600, 38016, 0xdfc2be86
-0, 4741200, 38016, 0x515cc1a9
-0, 4744800, 38016, 0xc7ddb990
-0, 4748400, 38016, 0x043fb332
-0, 4752000, 38016, 0x5b05b3a7
-0, 4755600, 38016, 0xacdf9836
-0, 4759200, 38016, 0x55079a49
-0, 4762800, 38016, 0x5de2d90d
-0, 4766400, 38016, 0x7f9deb52
-0, 4770000, 38016, 0x83ddc6d9
-0, 4773600, 38016, 0x77ecdc93
-0, 4777200, 38016, 0x745fe832
-0, 4780800, 38016, 0x920bf8e7
-0, 4784400, 38016, 0xd9fc1803
-0, 4788000, 38016, 0x06c13052
-0, 4791600, 38016, 0x4a962b49
-0, 4795200, 38016, 0xd4a7b571
-0, 4798800, 38016, 0xdb76bd1e
-0, 4802400, 38016, 0x11a4be41
-0, 4806000, 38016, 0x575eb740
-0, 4809600, 38016, 0x7f11bb5c
-0, 4813200, 38016, 0x0f97b9b5
-0, 4816800, 38016, 0xa421bc1e
-0, 4820400, 38016, 0x2510bda8
-0, 4824000, 38016, 0x5ec1c3c2
-0, 4827600, 38016, 0xab02c212
-0, 4831200, 38016, 0x7862c24a
-0, 4834800, 38016, 0x3654c47c
-0, 4838400, 38016, 0x6e4f3fd5
-0, 4842000, 38016, 0x77b54c6f
-0, 4845600, 38016, 0x51016691
-0, 4849200, 38016, 0x5c2e7a7a
-0, 4852800, 38016, 0x29aea461
-0, 4856400, 38016, 0x8f4397b1
-0, 4860000, 38016, 0x8af41dba
-0, 4863600, 38016, 0x4c1154ca
-0, 4867200, 38016, 0xe23e6e91
-0, 4870800, 38016, 0xd0617571
-0, 4874400, 38016, 0x2ab88348
-0, 4878000, 38016, 0x8bf1a109
-0, 4881600, 38016, 0xfdd4c390
-0, 4885200, 38016, 0x17b8c6bf
-0, 4888800, 38016, 0xa012bd5d
-0, 4892400, 38016, 0x4c16cee2
-0, 4896000, 38016, 0x739fcfae
-0, 4899600, 38016, 0x3edae498
-0, 4903200, 38016, 0x0d38e4ad
-0, 4906800, 38016, 0x896cea10
-0, 4910400, 38016, 0x13a0f1a9
-0, 4914000, 38016, 0xfe70eeb4
-0, 4917600, 38016, 0x540bf40e
-0, 4921200, 38016, 0xee20f65e
-0, 4924800, 38016, 0x8404fdf7
-0, 4928400, 38016, 0x1c71b182
-0, 4932000, 38016, 0x96e4c5cc
-0, 4935600, 38016, 0x6aa1dcf1
-0, 4939200, 38016, 0x4549ed9b
-0, 4942800, 38016, 0xd50bffba
-0, 4946400, 38016, 0x22701379
-0, 4950000, 38016, 0x19462a6b
-0, 4953600, 38016, 0x4f6b41e0
-0, 4957200, 38016, 0x9d344fcc
-0, 4960800, 38016, 0x60625fa9
-0, 4964400, 38016, 0xeb377eae
-0, 4968000, 38016, 0x0d9f945d
-0, 4971600, 38016, 0x4d0fb1dc
-0, 4975200, 38016, 0x0b580421
-0, 4978800, 38016, 0x30f3191a
-0, 4982400, 38016, 0xc5f7295c
-0, 4986000, 38016, 0xc4ad35e9
-0, 4989600, 38016, 0x25964387
-0, 4993200, 38016, 0x3a805820
-0, 4996800, 38016, 0x67e26985
-0, 5000400, 38016, 0x518f7941
-0, 5004000, 38016, 0x2a7982e1
-0, 5007600, 38016, 0x54aa84f0
-0, 5011200, 38016, 0x3d808f45
-0, 5014800, 38016, 0x5dae923c
-0, 5018400, 38016, 0xa2a99ccf
-0, 5022000, 38016, 0xefdd9a77
-0, 5025600, 38016, 0x246fcfa5
-0, 5029200, 38016, 0xe315cbcd
-0, 5032800, 38016, 0x4825df58
-0, 5036400, 38016, 0x0e241554
-0, 5040000, 38016, 0x968d8433
-0, 5043600, 38016, 0x97eec628
-0, 5047200, 38016, 0x7c4cb603
-0, 5050800, 38016, 0x6d11e7bf
-0, 5054400, 38016, 0xae041b61
-0, 5058000, 38016, 0x385e040c
-0, 5061600, 38016, 0x449e357a
-0, 5065200, 38016, 0x997f4aac
-0, 5068800, 38016, 0xd68c4f8b
-0, 5072400, 38016, 0xb3b962eb
-0, 5076000, 38016, 0x4685adc2
-0, 5079600, 38016, 0xed0d7473
-0, 5083200, 38016, 0xd069c0bb
-0, 5086800, 38016, 0x76abcd8e
-0, 5090400, 38016, 0xd6c096da
-0, 5094000, 38016, 0x76c2bab5
-0, 5097600, 38016, 0x1461dfb3
-0, 5101200, 38016, 0xf979f59f
-0, 5104800, 38016, 0x0554f985
-0, 5108400, 38016, 0x11c6d2a3
-0, 5112000, 38016, 0xe6e3faee
-0, 5115600, 38016, 0x6ceafbcc
-0, 5119200, 38016, 0x429b02e1
-0, 5122800, 38016, 0x97bd03f1
-0, 5126400, 38016, 0x78330c48
-0, 5130000, 38016, 0xb2720325
-0, 5133600, 38016, 0x26d412ab
-0, 5137200, 38016, 0xb6fb1b5c
-0, 5140800, 38016, 0xde8d300a
-0, 5144400, 38016, 0x7d28450e
-0, 5148000, 38016, 0xb3c5fbef
-0, 5151600, 38016, 0x2222f726
-0, 5155200, 38016, 0x66f7f42f
-0, 5158800, 38016, 0xef8af722
-0, 5162400, 38016, 0x4ac0f8d7
-0, 5166000, 38016, 0x5bfe5c81
-0, 5169600, 38016, 0x4afb6df9
-0, 5173200, 38016, 0xa8128a37
-0, 5176800, 38016, 0x1fc79ed0
-0, 5180400, 38016, 0x9967a997
-0, 5184000, 38016, 0x7bb5f6e1
-0, 5187600, 38016, 0xdda90122
-0, 5191200, 38016, 0x81700c1a
-0, 5194800, 38016, 0x9e121e77
-0, 5198400, 38016, 0xf58926a3
-0, 5202000, 38016, 0x4d1431a4
-0, 5205600, 38016, 0x0de6e741
-0, 5209200, 38016, 0x3ae9f601
-0, 5212800, 38016, 0xbed2e950
-0, 5216400, 38016, 0x619f100d
-0, 5220000, 38016, 0x6fa4a4e2
-0, 5223600, 38016, 0x316cddcd
-0, 5227200, 38016, 0x03132791
-0, 5230800, 38016, 0x10122784
-0, 5234400, 38016, 0x0e732980
-0, 5238000, 38016, 0x382d26f9
-0, 5241600, 38016, 0x651028fd
-0, 5245200, 38016, 0x61732850
-0, 5248800, 38016, 0x47912dde
-0, 5252400, 38016, 0xe3a12fdc
-0, 5256000, 38016, 0x8bc332ff
-0, 5259600, 38016, 0xcc3a3cdc
-0, 5263200, 38016, 0x190e2fec
-0, 5266800, 38016, 0x236c3291
-0, 5270400, 38016, 0xc0e55dd3
-0, 5274000, 38016, 0x06c85411
-0, 5277600, 38016, 0x0c0b3091
-0, 5281200, 38016, 0x8c1333cd
-0, 5284800, 38016, 0x51b339a5
-0, 5288400, 38016, 0x2d5b33ef
-0, 5292000, 38016, 0x73f0395b
-0, 5295600, 38016, 0x505b42d3
-0, 5299200, 38016, 0x56e44c7f
-0, 5302800, 38016, 0x26465781
-0, 5306400, 38016, 0x1d14800d
-0, 5310000, 38016, 0x752cb297
-0, 5313600, 38016, 0x0c3ab720
-0, 5317200, 38016, 0x21c2f136
-0, 5320800, 38016, 0xbae8b293
-0, 5324400, 38016, 0xe4b2fe9b
-0, 5328000, 38016, 0xfaaf0394
-0, 5331600, 38016, 0xa6f61d4b
-0, 5335200, 38016, 0x0e205192
-0, 5338800, 38016, 0x9b3c5c1f
-0, 5342400, 38016, 0x3b93552f
-0, 5346000, 38016, 0xe56e5b54
-0, 5349600, 38016, 0xa1c26095
-0, 5353200, 38016, 0x1eb66e41
-0, 5356800, 38016, 0x83eb6e83
-0, 5360400, 38016, 0xc8a979d3
-0, 5364000, 38016, 0x81fb7b32
-0, 5367600, 38016, 0xe07928b7
-0, 5371200, 38016, 0x38591267
-0, 5374800, 38016, 0xce563165
-0, 5378400, 38016, 0x5fec3563
-0, 5382000, 38016, 0xd7402c7c
-0, 5385600, 38016, 0xf2a93af4
-0, 5389200, 38016, 0x78f22fe7
-0, 5392800, 38016, 0x25554875
-0, 5396400, 38016, 0x79546ca2
-0, 5400000, 38016, 0xdae2814a
-0, 5403600, 38016, 0xf1ef9a9e
-0, 5407200, 38016, 0xb76d8b83
-0, 5410800, 38016, 0x1abf8fa8
-0, 5414400, 38016, 0x8f098fa4
-0, 5418000, 38016, 0xb098843c
-0, 5421600, 38016, 0x1d5186d3
-0, 5425200, 38016, 0x93f4923c
-0, 5428800, 38016, 0x496094e2
-0, 5432400, 38016, 0x7aea93f1
-0, 5436000, 38016, 0x556c6675
-0, 5439600, 38016, 0x90566aca
-0, 5443200, 38016, 0x14899a93
-0, 5446800, 38016, 0xd269e0e7
-0, 5450400, 38016, 0x1261d2cc
-0, 5454000, 38016, 0x299c9301
-0, 5457600, 38016, 0xee9c9ba5
-0, 5461200, 38016, 0xb48ab676
-0, 5464800, 38016, 0x4ef9b1c5
-0, 5468400, 38016, 0x8aae9912
-0, 5472000, 38016, 0x1bc09f53
-0, 5475600, 38016, 0x2e089c6b
-0, 5479200, 38016, 0x67598f8d
-0, 5482800, 38016, 0xacd394e1
-0, 5486400, 38016, 0xe2979b75
-0, 5490000, 38016, 0xb9749ff9
-0, 5493600, 38016, 0x02bda2f0
-0, 5497200, 38016, 0xe6caa499
-0, 5500800, 38016, 0xc6d9a547
-0, 5504400, 38016, 0x1c89aa34
-0, 5508000, 38016, 0x61feb4fc
-0, 5511600, 38016, 0x2a40b1f4
-0, 5515200, 38016, 0x4ad3ac08
-0, 5518800, 38016, 0xf5e8b06d
-0, 5522400, 38016, 0xb0eea800
-0, 5526000, 38016, 0x430cc535
-0, 5529600, 38016, 0x8e66b9cf
-0, 5533200, 38016, 0x5c68b4c4
-0, 5536800, 38016, 0x9381c64b
-0, 5540400, 38016, 0x4234bed7
-0, 5544000, 38016, 0xce72bf02
-0, 5547600, 38016, 0xb8cfbcd7
-0, 5551200, 38016, 0x75a5b1bd
-0, 5554800, 38016, 0xc27fb9eb
-0, 5558400, 38016, 0xa1b1bc62
-0, 5562000, 38016, 0x1cdeb0a3
-0, 5565600, 38016, 0xaea6a799
-0, 5569200, 38016, 0x8152ac4f
-0, 5572800, 38016, 0x59c1a66d
-0, 5576400, 38016, 0x6bd99f24
-0, 5580000, 38016, 0x96a73236
-0, 5583600, 38016, 0xb27e4856
-0, 5587200, 38016, 0x8b57447a
-0, 5590800, 38016, 0xcef84a21
-0, 5594400, 38016, 0x5babc7cc
-0, 5598000, 38016, 0x6ed2cec3
-0, 5601600, 38016, 0xa2efdc17
-0, 5605200, 38016, 0x47bad971
-0, 5608800, 38016, 0x150dffd4
-0, 5612400, 38016, 0x3ecef2ad
-0, 5616000, 38016, 0x355cdade
-0, 5619600, 38016, 0x3b15e809
-0, 5623200, 38016, 0x37fcf890
-0, 5626800, 38016, 0x8ca606d1
-0, 5630400, 38016, 0x51cafefe
-0, 5634000, 38016, 0x736be64a
-0, 5637600, 38016, 0x4f2052c1
-0, 5641200, 38016, 0xc6715e93
-0, 5644800, 38016, 0x765c5a58
-0, 5648400, 38016, 0x5abe5617
-0, 5652000, 38016, 0xb1ac540a
-0, 5655600, 38016, 0xd9f75c21
-0, 5659200, 38016, 0x0c1946c0
-0, 5662800, 38016, 0x93363a34
-0, 5666400, 38016, 0x2c9f2fe4
-0, 5670000, 38016, 0x023c321a
-0, 5673600, 38016, 0x1931314b
-0, 5677200, 38016, 0x16782d59
-0, 5680800, 38016, 0x29aa289f
-0, 5684400, 38016, 0xea0ddb85
-0, 5688000, 38016, 0xe09ae656
-0, 5691600, 38016, 0x682ff29f
-0, 5695200, 38016, 0xf3ac29ca
-0, 5698800, 38016, 0x95160cad
-0, 5702400, 38016, 0x9afa093c
-0, 5706000, 38016, 0x2ad30958
-0, 5709600, 38016, 0x4b600e3a
-0, 5713200, 38016, 0x5b0e099b
-0, 5716800, 38016, 0x2d2aff9b
-0, 5720400, 38016, 0x8bb10aa6
-0, 5724000, 38016, 0xfebe1f1d
-0, 5727600, 38016, 0xa4431abd
-0, 5731200, 38016, 0xef7729a6
-0, 5734800, 38016, 0x7b5b1f78
-0, 5738400, 38016, 0x903b203e
-0, 5742000, 38016, 0xbcc716a2
-0, 5745600, 38016, 0xee6c1f4c
-0, 5749200, 38016, 0xc78c2ab8
-0, 5752800, 38016, 0xa77a255a
-0, 5756400, 38016, 0x9d5815fc
-0, 5760000, 38016, 0x7d5e7d79
-0, 5763600, 38016, 0xf7989072
-0, 5767200, 38016, 0x45499feb
-0, 5770800, 38016, 0xc58aae7b
-0, 5774400, 38016, 0x882aa1cb
-0, 5778000, 38016, 0x56cd97bf
-0, 5781600, 38016, 0x2d6af920
-0, 5785200, 38016, 0x43c312eb
-0, 5788800, 38016, 0x12872b9f
-0, 5792400, 38016, 0x3c623ffe
-0, 5796000, 38016, 0x120e302d
-0, 5799600, 38016, 0x9cb43964
-0, 5803200, 38016, 0xb371311c
-0, 5806800, 38016, 0x28b523d4
-0, 5810400, 38016, 0x58031bff
-0, 5814000, 38016, 0xe6691818
-0, 5817600, 38016, 0x6a9b29c3
-0, 5821200, 38016, 0x794b25ce
-0, 5824800, 38016, 0xfc273119
-0, 5828400, 38016, 0x82ad2a3a
-0, 5832000, 38016, 0x9d2da281
-0, 5835600, 38016, 0x11271ba1
-0, 5839200, 38016, 0x1558b618
-0, 5842800, 38016, 0xf5d8c22f
-0, 5846400, 38016, 0xf20214f9
-0, 5850000, 38016, 0x15b01f3a
-0, 5853600, 38016, 0x68f2b533
-0, 5857200, 38016, 0x9686a827
-0, 5860800, 38016, 0xf214a2dc
-0, 5864400, 38016, 0x3d421eb0
-0, 5868000, 38016, 0x78251e60
-0, 5871600, 38016, 0xab092856
-0, 5875200, 38016, 0x5eaba7bc
-0, 5878800, 38016, 0x612fb699
-0, 5882400, 38016, 0x8a83a3fd
-0, 5886000, 38016, 0xbcd9919b
-0, 5889600, 38016, 0xb9063049
-0, 5893200, 38016, 0x5cb22fde
-0, 5896800, 38016, 0x7db92390
-0, 5900400, 38016, 0x801b241b
-0, 5904000, 38016, 0x6eeb8e1b
-0, 5907600, 38016, 0x660b9568
-0, 5911200, 38016, 0x2a5b8b3d
-0, 5914800, 38016, 0x15098b9a
-0, 5918400, 38016, 0xd29284f5
-0, 5922000, 38016, 0x839323c6
-0, 5925600, 38016, 0xd6a4212c
-0, 5929200, 38016, 0x1c1c2259
-0, 5932800, 38016, 0x0b1d2ef2
-0, 5936400, 38016, 0xecd52cfc
-0, 5940000, 38016, 0x419326cb
-0, 5943600, 38016, 0xea813e68
-0, 5947200, 38016, 0xba9a33ba
-0, 5950800, 38016, 0x703b3b25
-0, 5954400, 38016, 0x391c3cce
-0, 5958000, 38016, 0xd1533fe3
-0, 5961600, 38016, 0xb9361f10
-0, 5965200, 38016, 0x8d652ea6
-0, 5968800, 38016, 0x22dc15ae
-0, 5972400, 38016, 0x2e5e0ee7
-0, 5976000, 38016, 0xd6bd15cf
-0, 5979600, 38016, 0xb16f198a
-0, 5983200, 38016, 0xd9653e95
-0, 5986800, 38016, 0x39da2e3a
-0, 5990400, 38016, 0x01b12526
-0, 5994000, 38016, 0x94a52dde
-0, 5997600, 38016, 0xda0c32d8
-0, 6001200, 38016, 0x89af2566
-0, 6004800, 38016, 0x71961a43
-0, 6008400, 38016, 0x5fb91337
-0, 6012000, 38016, 0x6e430a84
-0, 6015600, 38016, 0x1defffb2
-0, 6019200, 38016, 0xcc93023f
-0, 6022800, 38016, 0xfcd60168
-0, 6026400, 38016, 0x8a3201d4
-0, 6030000, 38016, 0x5235fef3
-0, 6033600, 38016, 0x989121b9
-0, 6037200, 38016, 0x067a1d36
-0, 6040800, 38016, 0xa168242b
-0, 6044400, 38016, 0x425f2475
-0, 6048000, 38016, 0x298f14d9
-0, 6051600, 38016, 0x3a7c1838
-0, 6055200, 38016, 0xd173155a
-0, 6058800, 38016, 0x210113ec
-0, 6062400, 38016, 0xa0c2f88f
-0, 6066000, 38016, 0x4fa1f4e2
-0, 6069600, 38016, 0x812df750
-0, 6073200, 38016, 0xfd5cea45
-0, 6076800, 38016, 0xb823ee4a
-0, 6080400, 38016, 0x3555d6bf
-0, 6084000, 38016, 0x6dabf021
-0, 6087600, 38016, 0x7ae0f191
-0, 6091200, 38016, 0xabdc1546
-0, 6094800, 38016, 0x36dd0dbb
-0, 6098400, 38016, 0x008ffe5f
-0, 6102000, 38016, 0xe956f9c0
-0, 6105600, 38016, 0x9823ee03
-0, 6109200, 38016, 0xf63fedde
-0, 6112800, 38016, 0x67530afb
-0, 6116400, 38016, 0x2da5e470
diff --git a/tests/ref/fate/h264-conformance-midr_mw_d b/tests/ref/fate/h264-conformance-midr_mw_d
deleted file mode 100644
index afffdc8..0000000
--- a/tests/ref/fate/h264-conformance-midr_mw_d
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0x393097f9
-0, 10800, 38016, 0x8fb56676
-0, 14400, 38016, 0x39d64fd2
-0, 18000, 38016, 0x7fad729a
-0, 21600, 38016, 0x7e25955f
-0, 25200, 38016, 0xc4d9a359
-0, 28800, 38016, 0x30afaca4
-0, 32400, 38016, 0x9ee195ea
-0, 36000, 38016, 0x09f65805
-0, 39600, 38016, 0x58d126ab
-0, 43200, 38016, 0x4f29282c
-0, 46800, 38016, 0x8af235a1
-0, 50400, 38016, 0x6dfe525a
-0, 54000, 38016, 0xd51c793f
-0, 57600, 38016, 0x4e90abba
-0, 61200, 38016, 0xe706c5b7
-0, 64800, 38016, 0x35fab7ef
-0, 68400, 38016, 0xed78b8fc
-0, 72000, 38016, 0x2907bb4e
-0, 75600, 38016, 0x1749bb47
-0, 79200, 38016, 0x284ec688
-0, 82800, 38016, 0x534abc24
-0, 86400, 38016, 0xcd01bd13
-0, 90000, 38016, 0xe97bbd51
-0, 93600, 38016, 0xac1cb9e9
-0, 97200, 38016, 0xd861c0a3
-0, 100800, 38016, 0xf0f1ced4
-0, 104400, 38016, 0xa9e8d2bf
-0, 108000, 38016, 0x4c6aa7c5
-0, 111600, 38016, 0xb20079ac
-0, 115200, 38016, 0xbfc3563b
-0, 118800, 38016, 0x48259358
-0, 122400, 38016, 0x1bce0434
-0, 126000, 38016, 0xa0ac59db
-0, 129600, 38016, 0x87bdb608
-0, 133200, 38016, 0x318037eb
-0, 136800, 38016, 0x0f7d8496
-0, 140400, 38016, 0x9e65bc1e
-0, 144000, 38016, 0xc56be1ea
-0, 147600, 38016, 0xc31fefb7
-0, 151200, 38016, 0xcbcee4e4
-0, 154800, 38016, 0xcf03f238
-0, 158400, 38016, 0xc6a903a1
-0, 162000, 38016, 0xfdabee4f
-0, 165600, 38016, 0x9054bb39
-0, 169200, 38016, 0xe9bf8cd8
-0, 172800, 38016, 0x943d9e0a
-0, 176400, 38016, 0x404cc87d
-0, 180000, 38016, 0x3cd9dd49
-0, 183600, 38016, 0x5eabbdf1
-0, 187200, 38016, 0xd206d9ef
-0, 190800, 38016, 0x75e310ad
-0, 194400, 38016, 0x01893e25
-0, 198000, 38016, 0xda5360e6
-0, 201600, 38016, 0x80656a39
-0, 205200, 38016, 0x85452c84
-0, 208800, 38016, 0x48d92ef7
-0, 212400, 38016, 0x0edc45b2
-0, 216000, 38016, 0xeb8a3531
-0, 219600, 38016, 0x7b5914b5
-0, 223200, 38016, 0xf1b6c7fa
-0, 226800, 38016, 0x68fca853
-0, 230400, 38016, 0x68ebcc02
-0, 234000, 38016, 0x793edc8e
-0, 237600, 38016, 0x9c86d139
-0, 241200, 38016, 0x2aeed2f9
-0, 244800, 38016, 0xb8cfc89d
-0, 248400, 38016, 0x22d2b5c4
-0, 252000, 38016, 0x01ae9d2d
-0, 255600, 38016, 0x4e9b7c84
-0, 259200, 38016, 0xa52c8553
-0, 262800, 38016, 0x50df78d0
-0, 266400, 38016, 0x4dc31f1c
-0, 270000, 38016, 0xf24ee29a
-0, 273600, 38016, 0xced0d363
-0, 277200, 38016, 0x2263bfdc
-0, 280800, 38016, 0x1363f580
-0, 284400, 38016, 0xfc7f3a50
-0, 288000, 38016, 0x38427007
-0, 291600, 38016, 0xfc5757eb
-0, 295200, 38016, 0xf20f4d0b
-0, 298800, 38016, 0x64871ca3
-0, 302400, 38016, 0xcb66cd99
-0, 306000, 38016, 0xaacdda1f
-0, 309600, 38016, 0xd52206c8
-0, 313200, 38016, 0xcb461142
-0, 316800, 38016, 0x9e36a3b3
-0, 320400, 38016, 0xf3b44a7c
-0, 324000, 38016, 0x1722db32
-0, 327600, 38016, 0xa943d602
-0, 331200, 38016, 0xc899e7bf
-0, 334800, 38016, 0xacd10bdc
-0, 338400, 38016, 0x703b3802
-0, 342000, 38016, 0xe246efb4
-0, 345600, 38016, 0x1ebfccb2
-0, 349200, 38016, 0x57380778
-0, 352800, 38016, 0xb70e7313
-0, 356400, 38016, 0x0cd4af3d
diff --git a/tests/ref/fate/h264-conformance-mps_mw_a b/tests/ref/fate/h264-conformance-mps_mw_a
deleted file mode 100644
index 47e7feb..0000000
--- a/tests/ref/fate/h264-conformance-mps_mw_a
+++ /dev/null
@@ -1,150 +0,0 @@
-0, 0, 38016, 0x06150e88
-0, 3600, 38016, 0x32d90103
-0, 7200, 38016, 0x5b5f2fae
-0, 10800, 38016, 0xba6e6302
-0, 14400, 38016, 0x6c4b8e95
-0, 18000, 38016, 0x6d51ab43
-0, 21600, 38016, 0x5582a7c5
-0, 25200, 38016, 0xf48e6545
-0, 28800, 38016, 0x083a8481
-0, 32400, 38016, 0x0576a254
-0, 36000, 38016, 0x07429a61
-0, 39600, 38016, 0xd1e26eb1
-0, 43200, 38016, 0x94032564
-0, 46800, 38016, 0xc9d217c0
-0, 50400, 38016, 0xf0ee3f46
-0, 54000, 38016, 0xe8fc4d97
-0, 57600, 38016, 0xd3b0488d
-0, 61200, 38016, 0xc4243d99
-0, 64800, 38016, 0xa65b36ed
-0, 68400, 38016, 0x84ca1844
-0, 72000, 38016, 0xcd6706bf
-0, 75600, 38016, 0x1c03ec0a
-0, 79200, 38016, 0xf1380127
-0, 82800, 38016, 0xa499e0a5
-0, 86400, 38016, 0x5fca87ce
-0, 90000, 38016, 0x0b385064
-0, 93600, 38016, 0x6a4f49c4
-0, 97200, 38016, 0x97e0464b
-0, 100800, 38016, 0xcbf98750
-0, 104400, 38016, 0xa9efe0cd
-0, 108000, 38016, 0x9ea7d82e
-0, 111600, 38016, 0x28cec5ce
-0, 115200, 38016, 0xaec6ac1e
-0, 118800, 38016, 0x8cba69b3
-0, 122400, 38016, 0x727720c1
-0, 126000, 38016, 0xee4f4822
-0, 129600, 38016, 0x9d456e11
-0, 133200, 38016, 0x14123f91
-0, 136800, 38016, 0xf5e1d1a3
-0, 140400, 38016, 0xaadd9435
-0, 144000, 38016, 0x94df6e5e
-0, 147600, 38016, 0x18805412
-0, 151200, 38016, 0x0ba26c8c
-0, 154800, 38016, 0x4548a5c1
-0, 158400, 38016, 0x9217cb5f
-0, 162000, 38016, 0x2ea74a9e
-0, 165600, 38016, 0xeb0c57b6
-0, 169200, 38016, 0xf968a4a5
-0, 172800, 38016, 0xa410ef43
-0, 176400, 38016, 0x55813001
-0, 180000, 38016, 0x9cea4512
-0, 183600, 38016, 0x27754fa6
-0, 187200, 38016, 0x9824548a
-0, 190800, 38016, 0x7f1047eb
-0, 194400, 38016, 0x75fb2e10
-0, 198000, 38016, 0xe50df970
-0, 201600, 38016, 0x6ed6dfb4
-0, 205200, 38016, 0x8e97ccee
-0, 208800, 38016, 0x7f96c5f0
-0, 212400, 38016, 0x0940c200
-0, 216000, 38016, 0x86b98701
-0, 219600, 38016, 0x977d759a
-0, 223200, 38016, 0xf2b17bff
-0, 226800, 38016, 0xee1496d7
-0, 230400, 38016, 0x6cb1c1b5
-0, 234000, 38016, 0xa6bc0db9
-0, 237600, 38016, 0x902f660d
-0, 241200, 38016, 0x7bf7a434
-0, 244800, 38016, 0x97f9c2a6
-0, 248400, 38016, 0xf8bf9241
-0, 252000, 38016, 0x8639502b
-0, 255600, 38016, 0x82c2537f
-0, 259200, 38016, 0x1141243a
-0, 262800, 38016, 0xcaef5ae5
-0, 266400, 38016, 0xe2c4d308
-0, 270000, 38016, 0x35530a2c
-0, 273600, 38016, 0x22a3b317
-0, 277200, 38016, 0xda988427
-0, 280800, 38016, 0x54616f11
-0, 284400, 38016, 0xc38fc57c
-0, 288000, 38016, 0x7039d019
-0, 291600, 38016, 0x0fd6e6d9
-0, 295200, 38016, 0xc213e48e
-0, 298800, 38016, 0xf469b8e1
-0, 302400, 38016, 0x1f5c706c
-0, 306000, 38016, 0x69652db3
-0, 309600, 38016, 0xe1b9d46d
-0, 313200, 38016, 0x4e7522aa
-0, 316800, 38016, 0x8f4025a4
-0, 320400, 38016, 0xbc0483f6
-0, 324000, 38016, 0xae91d342
-0, 327600, 38016, 0xb1435578
-0, 331200, 38016, 0xf7535863
-0, 334800, 38016, 0xc16ff613
-0, 338400, 38016, 0x55bc394f
-0, 342000, 38016, 0xc7b76458
-0, 345600, 38016, 0xd3fd69ae
-0, 349200, 38016, 0x4b44d724
-0, 352800, 38016, 0x740b99c5
-0, 356400, 38016, 0x40c7c625
-0, 360000, 38016, 0x1691a7ef
-0, 363600, 38016, 0x6ea9392e
-0, 367200, 38016, 0xf958200f
-0, 370800, 38016, 0x916d75eb
-0, 374400, 38016, 0x6b4bee69
-0, 378000, 38016, 0x87adf9de
-0, 381600, 38016, 0x92dc586e
-0, 385200, 38016, 0x3c5aa531
-0, 388800, 38016, 0x00f81488
-0, 392400, 38016, 0x981aeb9f
-0, 396000, 38016, 0x49cf8e5f
-0, 399600, 38016, 0xfd56b231
-0, 403200, 38016, 0x419aaa2e
-0, 406800, 38016, 0xae155602
-0, 410400, 38016, 0x1e530aa1
-0, 414000, 38016, 0x60ca2c1b
-0, 417600, 38016, 0x0e7bdec7
-0, 421200, 38016, 0xe858b864
-0, 424800, 38016, 0x47378c1d
-0, 428400, 38016, 0x90008a4d
-0, 432000, 38016, 0xa1293af0
-0, 435600, 38016, 0x596964a8
-0, 439200, 38016, 0xb25d9ccf
-0, 442800, 38016, 0xccdbb7a0
-0, 446400, 38016, 0x3becf25a
-0, 450000, 38016, 0x918d1816
-0, 453600, 38016, 0x71d02564
-0, 457200, 38016, 0x643015fd
-0, 460800, 38016, 0x3af5f577
-0, 464400, 38016, 0x77b5ecea
-0, 468000, 38016, 0x7f940014
-0, 471600, 38016, 0x726f0bf3
-0, 475200, 38016, 0xb728078f
-0, 478800, 38016, 0x46e1f70a
-0, 482400, 38016, 0x79ccdd3e
-0, 486000, 38016, 0x80d2ca75
-0, 489600, 38016, 0xc87dc034
-0, 493200, 38016, 0x7535c12a
-0, 496800, 38016, 0x2d32bd77
-0, 500400, 38016, 0x2fceb360
-0, 504000, 38016, 0x8d0aa592
-0, 507600, 38016, 0xc9b9bb80
-0, 511200, 38016, 0xa667dd9c
-0, 514800, 38016, 0x7b5df35b
-0, 518400, 38016, 0x5feb1125
-0, 522000, 38016, 0x222a306f
-0, 525600, 38016, 0x64c84c75
-0, 529200, 38016, 0x5e605c79
-0, 532800, 38016, 0x2d2f78f3
-0, 536400, 38016, 0x7b72973d
diff --git a/tests/ref/fate/h264-conformance-mr1_bt_a b/tests/ref/fate/h264-conformance-mr1_bt_a
deleted file mode 100644
index b077cd4..0000000
--- a/tests/ref/fate/h264-conformance-mr1_bt_a
+++ /dev/null
@@ -1,62 +0,0 @@
-0, 0, 38016, 0xc6658719
-0, 3600, 38016, 0x8a7c7423
-0, 7200, 38016, 0x97e99b66
-0, 10800, 38016, 0x73c4c4f7
-0, 14400, 38016, 0xb45bfb44
-0, 18000, 38016, 0x1bc3249c
-0, 21600, 38016, 0xd98a3121
-0, 25200, 38016, 0x6f0aefc1
-0, 28800, 38016, 0x6287f651
-0, 32400, 38016, 0x2a4a1630
-0, 36000, 38016, 0x5e7b5a35
-0, 39600, 38016, 0x58847533
-0, 43200, 38016, 0x2bad942b
-0, 46800, 38016, 0x17d75cb1
-0, 50400, 38016, 0x6d8e818d
-0, 54000, 38016, 0xfa3165db
-0, 57600, 38016, 0x6a6e249f
-0, 61200, 38016, 0x2d232ece
-0, 64800, 38016, 0xfba6616e
-0, 68400, 38016, 0xa9e7533f
-0, 72000, 38016, 0x7c4827e6
-0, 75600, 38016, 0xf570f8ca
-0, 79200, 38016, 0x0dac953f
-0, 82800, 38016, 0x74cb5f30
-0, 86400, 38016, 0x038ce61b
-0, 90000, 38016, 0x291f8ecb
-0, 93600, 38016, 0x768a6539
-0, 97200, 38016, 0x27a960e6
-0, 100800, 38016, 0x4d8ab279
-0, 104400, 38016, 0x7da78115
-0, 108000, 38016, 0x27beadcf
-0, 111600, 38016, 0x98c43180
-0, 115200, 38016, 0x566d55db
-0, 118800, 38016, 0xddc19fda
-0, 122400, 38016, 0xe353c891
-0, 126000, 38016, 0x17e2e3ab
-0, 129600, 38016, 0x8759e7c3
-0, 133200, 38016, 0x9d93bca9
-0, 136800, 38016, 0x8b77af4e
-0, 140400, 38016, 0x9b799dac
-0, 144000, 38016, 0xcb8bc504
-0, 147600, 38016, 0x58e989c8
-0, 151200, 38016, 0x4e4dbb7f
-0, 154800, 38016, 0xdfa6934e
-0, 158400, 38016, 0x14947459
-0, 162000, 38016, 0x7a31ff6a
-0, 165600, 38016, 0xc044fbc3
-0, 169200, 38016, 0xcaa723d1
-0, 172800, 38016, 0x325c1dca
-0, 176400, 38016, 0x62fb027d
-0, 180000, 38016, 0x710f3ae9
-0, 183600, 38016, 0xdbbf1804
-0, 187200, 38016, 0x1487f491
-0, 190800, 38016, 0x6a722d73
-0, 194400, 38016, 0xeb7258dd
-0, 198000, 38016, 0x685e8a68
-0, 201600, 38016, 0x1627800e
-0, 205200, 38016, 0xa88a9a31
-0, 208800, 38016, 0x4d5eaf56
-0, 212400, 38016, 0xe3a9af0a
-0, 216000, 38016, 0x3c38b8b2
-0, 219600, 38016, 0x991fc29e
diff --git a/tests/ref/fate/h264-conformance-mr1_mw_a b/tests/ref/fate/h264-conformance-mr1_mw_a
deleted file mode 100644
index 98f112c..0000000
--- a/tests/ref/fate/h264-conformance-mr1_mw_a
+++ /dev/null
@@ -1,150 +0,0 @@
-0, 0, 38016, 0xc8981780
-0, 3600, 38016, 0xf089d880
-0, 7200, 38016, 0x5eee0731
-0, 10800, 38016, 0x79604e7c
-0, 14400, 38016, 0xb92186a9
-0, 18000, 38016, 0xe18ea8d9
-0, 21600, 38016, 0xedb599dd
-0, 25200, 38016, 0xc2665a04
-0, 28800, 38016, 0x88387c78
-0, 32400, 38016, 0x70b09638
-0, 36000, 38016, 0xb5629ba8
-0, 39600, 38016, 0xc8ee696b
-0, 43200, 38016, 0x9af12088
-0, 46800, 38016, 0x044f1510
-0, 50400, 38016, 0x04153fcc
-0, 54000, 38016, 0x6a433225
-0, 57600, 38016, 0x8fb43d81
-0, 61200, 38016, 0x708c5884
-0, 64800, 38016, 0xb2fa310d
-0, 68400, 38016, 0xa54f23bf
-0, 72000, 38016, 0x875d12a9
-0, 75600, 38016, 0xa7c2f3e5
-0, 79200, 38016, 0xba120362
-0, 82800, 38016, 0xf922ead0
-0, 86400, 38016, 0x23c38ae4
-0, 90000, 38016, 0x8e705ad0
-0, 93600, 38016, 0x60854be9
-0, 97200, 38016, 0x63163fd9
-0, 100800, 38016, 0x6d5886bd
-0, 104400, 38016, 0xd66fdaaa
-0, 108000, 38016, 0xcda78bc1
-0, 111600, 38016, 0x7e11aa47
-0, 115200, 38016, 0x4ac4ceba
-0, 118800, 38016, 0x80a45b77
-0, 122400, 38016, 0x6d1a19f9
-0, 126000, 38016, 0xd2b93d81
-0, 129600, 38016, 0x4532dc5a
-0, 133200, 38016, 0x874c3d28
-0, 136800, 38016, 0xbeb4552c
-0, 140400, 38016, 0xd85e8b6d
-0, 144000, 38016, 0x4c3a6953
-0, 147600, 38016, 0xf8615235
-0, 151200, 38016, 0x9b3e613a
-0, 154800, 38016, 0xfbba9dd5
-0, 158400, 38016, 0x435fbc73
-0, 162000, 38016, 0x15746d9d
-0, 165600, 38016, 0xfc6c2960
-0, 169200, 38016, 0x80c41d21
-0, 172800, 38016, 0xa621c891
-0, 176400, 38016, 0x24ce0e8b
-0, 180000, 38016, 0x15552d28
-0, 183600, 38016, 0xbc0b3703
-0, 187200, 38016, 0x81643dee
-0, 190800, 38016, 0x479c42ea
-0, 194400, 38016, 0x63d426db
-0, 198000, 38016, 0x5830f8e4
-0, 201600, 38016, 0xce24d921
-0, 205200, 38016, 0x0224c7b9
-0, 208800, 38016, 0x8f44bf31
-0, 212400, 38016, 0xc3d5c00f
-0, 216000, 38016, 0x13268498
-0, 219600, 38016, 0x83b99095
-0, 223200, 38016, 0xbb66a4b3
-0, 226800, 38016, 0x9b849565
-0, 230400, 38016, 0x81edbe5a
-0, 234000, 38016, 0x43781090
-0, 237600, 38016, 0x449c6974
-0, 241200, 38016, 0xbe61a0e0
-0, 244800, 38016, 0x5128c18e
-0, 248400, 38016, 0x2bf68f94
-0, 252000, 38016, 0x0fea4bbb
-0, 255600, 38016, 0x7dd650d2
-0, 259200, 38016, 0xc4332d1d
-0, 262800, 38016, 0xc7946d1c
-0, 266400, 38016, 0x6856e33f
-0, 270000, 38016, 0x567f7cc2
-0, 273600, 38016, 0x378bafed
-0, 277200, 38016, 0x3f710f7c
-0, 280800, 38016, 0x5d866a75
-0, 284400, 38016, 0xe264bdc7
-0, 288000, 38016, 0x48b2cbe9
-0, 291600, 38016, 0x0a4be700
-0, 295200, 38016, 0xcc4ed40d
-0, 298800, 38016, 0x93acaf5a
-0, 302400, 38016, 0xdd7465f2
-0, 306000, 38016, 0x4d492419
-0, 309600, 38016, 0xc2c2ca96
-0, 313200, 38016, 0x190324d8
-0, 316800, 38016, 0xd8962520
-0, 320400, 38016, 0x8d917eea
-0, 324000, 38016, 0x08ec794f
-0, 327600, 38016, 0x7ab598a6
-0, 331200, 38016, 0xaaec0ef7
-0, 334800, 38016, 0x7f6ffbe3
-0, 338400, 38016, 0x116d37cb
-0, 342000, 38016, 0x7b3a59fd
-0, 345600, 38016, 0xed5361cb
-0, 349200, 38016, 0x9c558a98
-0, 352800, 38016, 0x292e84ea
-0, 356400, 38016, 0x0d35bf44
-0, 360000, 38016, 0xaad7bedd
-0, 363600, 38016, 0xa6111b87
-0, 367200, 38016, 0x3c8bfc27
-0, 370800, 38016, 0x65ce6703
-0, 374400, 38016, 0x60ece2ec
-0, 378000, 38016, 0x8abbb25f
-0, 381600, 38016, 0x41108b27
-0, 385200, 38016, 0xac26284e
-0, 388800, 38016, 0x5f4c0db0
-0, 392400, 38016, 0xcccbee91
-0, 396000, 38016, 0x34238dc1
-0, 399600, 38016, 0x7479b326
-0, 403200, 38016, 0xaaf8a957
-0, 406800, 38016, 0xc49b55cb
-0, 410400, 38016, 0x338b129f
-0, 414000, 38016, 0xf0ed3328
-0, 417600, 38016, 0x39f8dcb3
-0, 421200, 38016, 0x7aecb808
-0, 424800, 38016, 0x35e8827a
-0, 428400, 38016, 0x16ac8b9d
-0, 432000, 38016, 0x3abdcb78
-0, 435600, 38016, 0xdfbfba7f
-0, 439200, 38016, 0x692a964e
-0, 442800, 38016, 0x11a5ebdb
-0, 446400, 38016, 0x46bc156d
-0, 450000, 38016, 0x1b153144
-0, 453600, 38016, 0xdd23349a
-0, 457200, 38016, 0xbad02161
-0, 460800, 38016, 0xc5030168
-0, 464400, 38016, 0x3e4ff28d
-0, 468000, 38016, 0x17faffe2
-0, 471600, 38016, 0xba04122f
-0, 475200, 38016, 0x8a8e0e1e
-0, 478800, 38016, 0xe5d6fc7d
-0, 482400, 38016, 0x22e3e630
-0, 486000, 38016, 0x7eb1a935
-0, 489600, 38016, 0xde46bead
-0, 493200, 38016, 0x34abc542
-0, 496800, 38016, 0x10ceaea3
-0, 500400, 38016, 0xb86fa676
-0, 504000, 38016, 0xbd9d9d3c
-0, 507600, 38016, 0x355fb37f
-0, 511200, 38016, 0xfb6fd3b0
-0, 514800, 38016, 0x3062edf4
-0, 518400, 38016, 0xf6940b60
-0, 522000, 38016, 0x78bd2f4e
-0, 525600, 38016, 0x51fc444f
-0, 529200, 38016, 0x118957cc
-0, 532800, 38016, 0x53777a50
-0, 536400, 38016, 0xeeaa9761
diff --git a/tests/ref/fate/h264-conformance-mr2_mw_a b/tests/ref/fate/h264-conformance-mr2_mw_a
deleted file mode 100644
index e172849..0000000
--- a/tests/ref/fate/h264-conformance-mr2_mw_a
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0x06150e88
-0, 3600, 38016, 0x32d90103
-0, 7200, 38016, 0xb32d338f
-0, 10800, 38016, 0x653c5fc3
-0, 14400, 38016, 0x69ec8bce
-0, 18000, 38016, 0x354fa53a
-0, 21600, 38016, 0x2ee79c2c
-0, 25200, 38016, 0x2c50666c
-0, 28800, 38016, 0x65ea824d
-0, 32400, 38016, 0x7419948b
-0, 36000, 38016, 0x19b298a0
-0, 39600, 38016, 0x29087291
-0, 43200, 38016, 0x92be1e95
-0, 46800, 38016, 0x9699119a
-0, 50400, 38016, 0xa4863bff
-0, 54000, 38016, 0x7dfc4f6b
-0, 57600, 38016, 0x946e5cfa
-0, 61200, 38016, 0x57287bdc
-0, 64800, 38016, 0xe7ae8bbe
-0, 68400, 38016, 0x21d367c7
-0, 72000, 38016, 0x9d0551c2
-0, 75600, 38016, 0xecc980b5
-0, 79200, 38016, 0x0ac4a749
-0, 82800, 38016, 0x9162262f
-0, 86400, 38016, 0x4a071c14
-0, 90000, 38016, 0x8571fae8
-0, 93600, 38016, 0xc0843707
-0, 97200, 38016, 0x7b4a63b0
-0, 100800, 38016, 0x5faf5d86
-0, 104400, 38016, 0x64623f6b
-0, 108000, 38016, 0xa97b523a
-0, 111600, 38016, 0x4048459a
-0, 115200, 38016, 0x56ba3d73
-0, 118800, 38016, 0x5394355a
-0, 122400, 38016, 0xb6c0176e
-0, 126000, 38016, 0x668c0772
-0, 129600, 38016, 0x86feeae8
-0, 133200, 38016, 0x9e75f9af
-0, 136800, 38016, 0xd72de054
-0, 140400, 38016, 0x39eb8743
-0, 144000, 38016, 0xd07b4d8e
-0, 147600, 38016, 0x89c045a9
-0, 151200, 38016, 0x209542e6
-0, 154800, 38016, 0xc43886ed
-0, 158400, 38016, 0xe091e433
-0, 162000, 38016, 0x176b1f65
-0, 165600, 38016, 0xd7730c3e
-0, 169200, 38016, 0x2bb90778
-0, 172800, 38016, 0x9b4540a8
-0, 176400, 38016, 0xd34c50db
-0, 180000, 38016, 0xf8007af9
-0, 183600, 38016, 0x54748466
-0, 187200, 38016, 0x20ab88a5
-0, 190800, 38016, 0x6aca8887
-0, 194400, 38016, 0xa1bf899f
-0, 198000, 38016, 0x8145966d
-0, 201600, 38016, 0x98f5a29c
-0, 205200, 38016, 0x4ed1b4d1
-0, 208800, 38016, 0x3177b95c
-0, 212400, 38016, 0x2b2cc4b2
-0, 216000, 38016, 0xf389db1e
-0, 219600, 38016, 0xfc6fca35
-0, 223200, 38016, 0x5f06af41
-0, 226800, 38016, 0x93a368d6
-0, 230400, 38016, 0x3de421f3
-0, 234000, 38016, 0x1e3f4b8d
-0, 237600, 38016, 0x6c3e6d4a
-0, 241200, 38016, 0x96ab4569
-0, 244800, 38016, 0x0de2d417
-0, 248400, 38016, 0x1a8a8d91
-0, 252000, 38016, 0xffb96503
-0, 255600, 38016, 0x1e1b4959
-0, 259200, 38016, 0x6aa267cd
-0, 262800, 38016, 0xcb87a00c
-0, 266400, 38016, 0x3b8ac17c
-0, 270000, 38016, 0x1348bf7b
-0, 273600, 38016, 0x1807b42d
-0, 277200, 38016, 0x22dfa6cb
-0, 280800, 38016, 0x3d23a622
-0, 284400, 38016, 0x662cb1e0
-0, 288000, 38016, 0x6ecfafaf
-0, 291600, 38016, 0xbffcaa71
-0, 295200, 38016, 0xf75ab93f
-0, 298800, 38016, 0xaea796bf
-0, 302400, 38016, 0x4a547fe8
-0, 306000, 38016, 0x2f1a800f
-0, 309600, 38016, 0xc7788261
-0, 313200, 38016, 0x8be17fd3
-0, 316800, 38016, 0xe830830c
-0, 320400, 38016, 0x62345ab7
-0, 324000, 38016, 0x70f926c6
-0, 327600, 38016, 0x37e94bf0
-0, 331200, 38016, 0xb1509312
-0, 334800, 38016, 0xc70fea7a
-0, 338400, 38016, 0x8062243b
-0, 342000, 38016, 0xe64a48b1
-0, 345600, 38016, 0x6f0c4dd7
-0, 349200, 38016, 0x5f9c53b4
-0, 352800, 38016, 0x4c5e506c
-0, 356400, 38016, 0xb7c631ef
-0, 360000, 38016, 0x30f302a9
-0, 363600, 38016, 0x4f28ebf0
-0, 367200, 38016, 0x3145d3d3
-0, 370800, 38016, 0x69b6c92f
-0, 374400, 38016, 0xa3b2c646
-0, 378000, 38016, 0x5ee00dec
-0, 381600, 38016, 0x313ee3ea
-0, 385200, 38016, 0x4002070e
-0, 388800, 38016, 0x5e0106b1
-0, 392400, 38016, 0xd03b2c4d
-0, 396000, 38016, 0xdd085316
-0, 399600, 38016, 0xb47a5f86
-0, 403200, 38016, 0xc25d5750
-0, 406800, 38016, 0x16ad52b3
-0, 410400, 38016, 0xa4fe2754
-0, 414000, 38016, 0xac5dfb18
-0, 417600, 38016, 0xe36ee83b
-0, 421200, 38016, 0xc708e54e
-0, 424800, 38016, 0x6c4beb85
-0, 428400, 38016, 0xf19fd825
-0, 432000, 38016, 0x94e7bb13
-0, 435600, 38016, 0x026e9ddf
-0, 439200, 38016, 0xdc71a591
-0, 442800, 38016, 0xb46eb169
-0, 446400, 38016, 0x25f5d5f4
-0, 450000, 38016, 0x27da203d
-0, 453600, 38016, 0xed217513
-0, 457200, 38016, 0x78d7bb08
-0, 460800, 38016, 0x623dd66d
-0, 464400, 38016, 0xd68c9f82
-0, 468000, 38016, 0x88b059e2
-0, 471600, 38016, 0x623159aa
-0, 475200, 38016, 0x1782245b
-0, 478800, 38016, 0x64f55b4a
-0, 482400, 38016, 0x83c7d154
-0, 486000, 38016, 0x43461c7c
-0, 489600, 38016, 0xc3e38c36
-0, 493200, 38016, 0x763394b4
-0, 496800, 38016, 0xff99749d
-0, 500400, 38016, 0x76ca13d0
-0, 504000, 38016, 0x29510aea
-0, 507600, 38016, 0x385f4309
-0, 511200, 38016, 0x142f5339
-0, 514800, 38016, 0x980ca66e
-0, 518400, 38016, 0xc330c0db
-0, 522000, 38016, 0xa7dbca0f
-0, 525600, 38016, 0x4261c683
-0, 529200, 38016, 0x6d467d81
-0, 532800, 38016, 0x1a107d17
-0, 536400, 38016, 0xd91e765a
-0, 540000, 38016, 0x789cfb94
-0, 543600, 38016, 0xc9bc9ee1
-0, 547200, 38016, 0x32f8754c
-0, 550800, 38016, 0xad906454
-0, 554400, 38016, 0xe5d6b78d
-0, 558000, 38016, 0x307bc291
-0, 561600, 38016, 0x629bdec9
-0, 565200, 38016, 0xf23ccd36
-0, 568800, 38016, 0x6105aa1b
-0, 572400, 38016, 0x3da66383
-0, 576000, 38016, 0x48ce2141
-0, 579600, 38016, 0x09fac5fd
-0, 583200, 38016, 0xa0bc208d
-0, 586800, 38016, 0x49892a74
-0, 590400, 38016, 0xfcb48093
-0, 594000, 38016, 0x850e7e4c
-0, 597600, 38016, 0x7cf24f55
-0, 601200, 38016, 0x654845f4
-0, 604800, 38016, 0x35ac5d63
-0, 608400, 38016, 0x795ea726
-0, 612000, 38016, 0xf387a03d
-0, 615600, 38016, 0x29279e19
-0, 619200, 38016, 0x48e3b03d
-0, 622800, 38016, 0xbcfb8192
-0, 626400, 38016, 0x3fe2749a
-0, 630000, 38016, 0xe0a04bbd
-0, 633600, 38016, 0x9a912cd7
-0, 637200, 38016, 0x39781e59
-0, 640800, 38016, 0x90e5131a
-0, 644400, 38016, 0x8bd90b4b
-0, 648000, 38016, 0x410dda61
-0, 651600, 38016, 0x33eb60fd
-0, 655200, 38016, 0x08e8632b
-0, 658800, 38016, 0x6163fd94
-0, 662400, 38016, 0x60af34e1
-0, 666000, 38016, 0x00016227
-0, 669600, 38016, 0xe6bd71bd
-0, 673200, 38016, 0xb40cdf28
-0, 676800, 38016, 0x3cdeb88e
-0, 680400, 38016, 0xb9ffe0d6
-0, 684000, 38016, 0xd630ce53
-0, 687600, 38016, 0x120056c2
-0, 691200, 38016, 0x0940399e
-0, 694800, 38016, 0x3d337fd0
-0, 698400, 38016, 0x6ef1f4b9
-0, 702000, 38016, 0x7e20f462
-0, 705600, 38016, 0xe397f30a
-0, 709200, 38016, 0x6eadf916
-0, 712800, 38016, 0x850e07b9
-0, 716400, 38016, 0x131b10db
-0, 720000, 38016, 0x17961d0e
-0, 723600, 38016, 0x447557da
-0, 727200, 38016, 0x93da7c0e
-0, 730800, 38016, 0xd6259239
-0, 734400, 38016, 0x2db99d95
-0, 738000, 38016, 0x648ea2bd
-0, 741600, 38016, 0xf8f46ef6
-0, 745200, 38016, 0xb85a7405
-0, 748800, 38016, 0x55dc7bbd
-0, 752400, 38016, 0xf38d76f8
-0, 756000, 38016, 0x9e860b96
-0, 759600, 38016, 0x7c5a5da7
-0, 763200, 38016, 0xdf36a619
-0, 766800, 38016, 0x327d1144
-0, 770400, 38016, 0x4a01eabd
-0, 774000, 38016, 0xee8b8717
-0, 777600, 38016, 0x874eaf23
-0, 781200, 38016, 0xddaaaf38
-0, 784800, 38016, 0xcab85271
-0, 788400, 38016, 0x970f0d3f
-0, 792000, 38016, 0x2a042dcc
-0, 795600, 38016, 0xa240e0e7
-0, 799200, 38016, 0x9564c081
-0, 802800, 38016, 0x894d82b4
-0, 806400, 38016, 0xb0748d24
-0, 810000, 38016, 0xafa56340
-0, 813600, 38016, 0x614287c6
-0, 817200, 38016, 0x4dfcaaac
-0, 820800, 38016, 0x58dab168
-0, 824400, 38016, 0x19fbb779
-0, 828000, 38016, 0x25adb4c9
-0, 831600, 38016, 0x5fc1bdae
-0, 835200, 38016, 0x6581a5d0
-0, 838800, 38016, 0x81d57061
-0, 842400, 38016, 0x43445964
-0, 846000, 38016, 0x68224a19
-0, 849600, 38016, 0xa85d390a
-0, 853200, 38016, 0xb571344d
-0, 856800, 38016, 0xd3632bfd
-0, 860400, 38016, 0x5af52535
-0, 864000, 38016, 0x21b93882
-0, 867600, 38016, 0x8da56743
-0, 871200, 38016, 0x9e7b9da2
-0, 874800, 38016, 0xc1a6bbd9
-0, 878400, 38016, 0xd77be9aa
-0, 882000, 38016, 0x2715100f
-0, 885600, 38016, 0xac8c1e30
-0, 889200, 38016, 0x110c14b9
-0, 892800, 38016, 0x5a8ff5c4
-0, 896400, 38016, 0x25d4ef19
-0, 900000, 38016, 0x080ffe7f
-0, 903600, 38016, 0x7f5b15ef
-0, 907200, 38016, 0xf97f10e1
-0, 910800, 38016, 0xdd80f7e5
-0, 914400, 38016, 0xb177df60
-0, 918000, 38016, 0x406023f6
-0, 921600, 38016, 0xf396220f
-0, 925200, 38016, 0x50fc2e7a
-0, 928800, 38016, 0x959b42da
-0, 932400, 38016, 0x61c7484a
-0, 936000, 38016, 0x09825cd1
-0, 939600, 38016, 0x0e7b6bd9
-0, 943200, 38016, 0x4a386b9e
-0, 946800, 38016, 0x817b5e14
-0, 950400, 38016, 0x51696069
-0, 954000, 38016, 0x84a35f51
-0, 957600, 38016, 0xf7758da3
-0, 961200, 38016, 0x787b6659
-0, 964800, 38016, 0xedb95942
-0, 968400, 38016, 0x4d4d8eb5
-0, 972000, 38016, 0x716cb36a
-0, 975600, 38016, 0x6556b912
-0, 979200, 38016, 0xbdd8c0b6
-0, 982800, 38016, 0xd9ffbba5
-0, 986400, 38016, 0xb5d7b4a7
-0, 990000, 38016, 0x4690a4ed
-0, 993600, 38016, 0x6fc8bdc4
-0, 997200, 38016, 0x827de512
-0, 1000800, 38016, 0x897bfc43
-0, 1004400, 38016, 0x41f8144a
-0, 1008000, 38016, 0xff7d369e
-0, 1011600, 38016, 0x526f48fa
-0, 1015200, 38016, 0x53245921
-0, 1018800, 38016, 0x69a3791e
-0, 1022400, 38016, 0x3de095df
-0, 1026000, 38016, 0x9ae2a0f2
-0, 1029600, 38016, 0xd1668593
-0, 1033200, 38016, 0x322c4f5b
-0, 1036800, 38016, 0x15882875
-0, 1040400, 38016, 0xa8886b9a
-0, 1044000, 38016, 0xc6f07ac1
-0, 1047600, 38016, 0xf9446d58
-0, 1051200, 38016, 0x98ef5ffc
-0, 1054800, 38016, 0x23434b21
-0, 1058400, 38016, 0xa1f353d2
-0, 1062000, 38016, 0x6b3d4452
-0, 1065600, 38016, 0xd4ac32bf
-0, 1069200, 38016, 0xc577065d
-0, 1072800, 38016, 0x2d01111d
-0, 1076400, 38016, 0xf51721d4
diff --git a/tests/ref/fate/h264-conformance-mr2_tandberg_e b/tests/ref/fate/h264-conformance-mr2_tandberg_e
deleted file mode 100644
index f47730f..0000000
--- a/tests/ref/fate/h264-conformance-mr2_tandberg_e
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0xca461abd
-0, 7200, 38016, 0x578a0c87
-0, 10800, 38016, 0xb3cc1ecb
-0, 14400, 38016, 0xd2c84463
-0, 18000, 38016, 0x815d6363
-0, 21600, 38016, 0x7cc17319
-0, 25200, 38016, 0x0f7e8cab
-0, 28800, 38016, 0x1876abee
-0, 32400, 38016, 0x8f25bccd
-0, 36000, 38016, 0xc1c7bb9c
-0, 39600, 38016, 0xf861bdb5
-0, 43200, 38016, 0xae1ac352
-0, 46800, 38016, 0x9b6f990b
-0, 50400, 38016, 0xa5217121
-0, 54000, 38016, 0x12ac8367
-0, 57600, 38016, 0x687f8526
-0, 61200, 38016, 0x9b009a01
-0, 64800, 38016, 0x9c629e04
-0, 68400, 38016, 0xfee5a366
-0, 72000, 38016, 0x264e9b00
-0, 75600, 38016, 0xf89f9508
-0, 79200, 38016, 0x19247145
-0, 82800, 38016, 0xc4cd41bd
-0, 86400, 38016, 0x035c2696
-0, 90000, 38016, 0x22310e7f
-0, 93600, 38016, 0xdd771898
-0, 97200, 38016, 0x61522adf
-0, 100800, 38016, 0x5eee412f
-0, 104400, 38016, 0x03f05077
-0, 108000, 38016, 0x69625001
-0, 111600, 38016, 0x8e025073
-0, 115200, 38016, 0x37374607
-0, 118800, 38016, 0xc90547ea
-0, 122400, 38016, 0xe9eb4193
-0, 126000, 38016, 0xf7214070
-0, 129600, 38016, 0xc3ce38de
-0, 133200, 38016, 0xb99933cb
-0, 136800, 38016, 0x5ee12b39
-0, 140400, 38016, 0x13c921be
-0, 144000, 38016, 0x66341136
-0, 147600, 38016, 0x97710eef
-0, 151200, 38016, 0xe5910c52
-0, 154800, 38016, 0xbf9d0fbb
-0, 158400, 38016, 0x0405177d
-0, 162000, 38016, 0x25ec13da
-0, 165600, 38016, 0xda29f457
-0, 169200, 38016, 0x8e7dbe67
-0, 172800, 38016, 0x64809802
-0, 176400, 38016, 0xbd45731d
-0, 180000, 38016, 0xf9e75c5b
-0, 183600, 38016, 0x4509551e
-0, 187200, 38016, 0xd73b54c9
-0, 190800, 38016, 0x434d430e
-0, 194400, 38016, 0xfbd940fe
-0, 198000, 38016, 0xddb1612a
-0, 201600, 38016, 0xffec797a
-0, 205200, 38016, 0x4355aa0c
-0, 208800, 38016, 0x1776d3e0
-0, 212400, 38016, 0x7a64dd7f
-0, 216000, 38016, 0xe619e56c
-0, 219600, 38016, 0x43b0d8e7
-0, 223200, 38016, 0x2103caf1
-0, 226800, 38016, 0x808fbb8d
-0, 230400, 38016, 0x0654ae1e
-0, 234000, 38016, 0x8b6da03f
-0, 237600, 38016, 0x15ee6b73
-0, 241200, 38016, 0x8ab049c4
-0, 244800, 38016, 0x7c6d351c
-0, 248400, 38016, 0xe3fa3794
-0, 252000, 38016, 0x5b3c581c
-0, 255600, 38016, 0xf07a70e8
-0, 259200, 38016, 0xcc378cb4
-0, 262800, 38016, 0x15f49788
-0, 266400, 38016, 0x23de74b4
-0, 270000, 38016, 0x2e842db6
-0, 273600, 38016, 0xd23cf2b9
-0, 277200, 38016, 0xfbb7cea3
-0, 280800, 38016, 0x05039bf0
-0, 284400, 38016, 0x854d8c6c
-0, 288000, 38016, 0x7d2770d7
-0, 291600, 38016, 0x7e5f6374
-0, 295200, 38016, 0x204753ee
-0, 298800, 38016, 0x66906f4d
-0, 302400, 38016, 0xf6ae700b
-0, 306000, 38016, 0x64438aba
-0, 309600, 38016, 0xc93aa41f
-0, 313200, 38016, 0x27bdbdb7
-0, 316800, 38016, 0x7aceb0a3
-0, 320400, 38016, 0x751d81bd
-0, 324000, 38016, 0xa86e3940
-0, 327600, 38016, 0x9d022dd6
-0, 331200, 38016, 0x0a484d7c
-0, 334800, 38016, 0x6d555adb
-0, 338400, 38016, 0xfe9799e0
-0, 342000, 38016, 0x245ad49b
-0, 345600, 38016, 0x6d22e3e3
-0, 349200, 38016, 0xdffc00df
-0, 352800, 38016, 0x34ec1984
-0, 356400, 38016, 0x15172b1a
-0, 360000, 38016, 0x05d742d8
-0, 363600, 38016, 0xc94350fc
-0, 367200, 38016, 0x3af65a84
-0, 370800, 38016, 0xfbf96492
-0, 374400, 38016, 0x1c8f6e2e
-0, 378000, 38016, 0xe41677dc
-0, 381600, 38016, 0xd36284e1
-0, 385200, 38016, 0xa5f57f14
-0, 388800, 38016, 0x6a7d70f4
-0, 392400, 38016, 0x4c1a584f
-0, 396000, 38016, 0x4f093dd3
-0, 399600, 38016, 0x5a1634b3
-0, 403200, 38016, 0xdd1a29b5
-0, 406800, 38016, 0x28c81aa3
-0, 410400, 38016, 0x681a0e29
-0, 414000, 38016, 0x74110802
-0, 417600, 38016, 0x468afe8a
-0, 421200, 38016, 0xfbb609e0
-0, 424800, 38016, 0x79d60da0
-0, 428400, 38016, 0x0774036d
-0, 432000, 38016, 0x904bf22d
-0, 435600, 38016, 0xddeaedb5
-0, 439200, 38016, 0x5de1d5af
-0, 442800, 38016, 0xb9bad4cf
-0, 446400, 38016, 0x452bcf0e
-0, 450000, 38016, 0x9ab9cca8
-0, 453600, 38016, 0x9b77d6ba
-0, 457200, 38016, 0xb9f5dfaf
-0, 460800, 38016, 0x7b33fac4
-0, 464400, 38016, 0x25e41c67
-0, 468000, 38016, 0x6af749b5
-0, 471600, 38016, 0xe6576d07
-0, 475200, 38016, 0x55a49498
-0, 478800, 38016, 0x3bf4bd93
-0, 482400, 38016, 0xba65cabb
-0, 486000, 38016, 0x0c02de64
-0, 489600, 38016, 0xdb86e742
-0, 493200, 38016, 0x37acdf69
-0, 496800, 38016, 0x8c1ea6be
-0, 500400, 38016, 0x5295739e
-0, 504000, 38016, 0xb2f85eb7
-0, 507600, 38016, 0x17394375
-0, 511200, 38016, 0x8a7f7528
-0, 514800, 38016, 0x17c3e7a5
-0, 518400, 38016, 0xbe1763ef
-0, 522000, 38016, 0x236eab70
-0, 525600, 38016, 0x4b3e9bbb
-0, 529200, 38016, 0xc1d664f9
-0, 532800, 38016, 0xc2300411
-0, 536400, 38016, 0x1cf2903c
-0, 540000, 38016, 0xd8783451
-0, 543600, 38016, 0xf3c8ff31
-0, 547200, 38016, 0xf6dfd324
-0, 550800, 38016, 0x7b93b5d0
-0, 554400, 38016, 0xf246a0f4
-0, 558000, 38016, 0x5e970b10
-0, 561600, 38016, 0xcb98878e
-0, 565200, 38016, 0xc804f169
-0, 568800, 38016, 0x801fec84
-0, 572400, 38016, 0xb242ee41
-0, 576000, 38016, 0xb8a7f3c1
-0, 579600, 38016, 0x24b10420
-0, 583200, 38016, 0x4b7601ab
-0, 586800, 38016, 0x4c30f75a
-0, 590400, 38016, 0x8e8cf5ae
-0, 594000, 38016, 0xd94fefd2
-0, 597600, 38016, 0x31c9c604
-0, 601200, 38016, 0x09d29f6f
-0, 604800, 38016, 0xa55e8075
-0, 608400, 38016, 0x482d53da
-0, 612000, 38016, 0x957e36f1
-0, 615600, 38016, 0xcd261153
-0, 619200, 38016, 0xbf08d284
-0, 622800, 38016, 0x42957a37
-0, 626400, 38016, 0x28b73287
-0, 630000, 38016, 0xe6e33893
-0, 633600, 38016, 0x7f0e3db5
-0, 637200, 38016, 0xb80b46a3
-0, 640800, 38016, 0x1ccca614
-0, 644400, 38016, 0x531e2dfa
-0, 648000, 38016, 0x0d95ef09
-0, 651600, 38016, 0xb631a635
-0, 655200, 38016, 0x4ed86a94
-0, 658800, 38016, 0x919832ab
-0, 662400, 38016, 0x724b60d5
-0, 666000, 38016, 0x9965f58f
-0, 669600, 38016, 0x7b04f567
-0, 673200, 38016, 0x774740d6
-0, 676800, 38016, 0xf8204134
-0, 680400, 38016, 0xcbadfa7a
-0, 684000, 38016, 0x9748728a
-0, 687600, 38016, 0x973047e7
-0, 691200, 38016, 0xcc52aa4d
-0, 694800, 38016, 0x3fa7d81f
-0, 698400, 38016, 0x7a33eddd
-0, 702000, 38016, 0xe51ed885
-0, 705600, 38016, 0xcc93b1a2
-0, 709200, 38016, 0xf70cab47
-0, 712800, 38016, 0x983eb17e
-0, 716400, 38016, 0xdb02d6bb
-0, 720000, 38016, 0xad99c4f9
-0, 723600, 38016, 0xd0e5618c
-0, 727200, 38016, 0x5eb05134
-0, 730800, 38016, 0x4ce0cf23
-0, 734400, 38016, 0x70de3edb
-0, 738000, 38016, 0x3519c858
-0, 741600, 38016, 0x1a4e785f
-0, 745200, 38016, 0x8d09b6ee
-0, 748800, 38016, 0x79b2fd7e
-0, 752400, 38016, 0xcd5aa9a4
-0, 756000, 38016, 0x1e1effd2
-0, 759600, 38016, 0xa1d1b497
-0, 763200, 38016, 0x5c036e34
-0, 766800, 38016, 0x937f152b
-0, 770400, 38016, 0xe434bed9
-0, 774000, 38016, 0x09eb8913
-0, 777600, 38016, 0x4d671935
-0, 781200, 38016, 0x9c62f30c
-0, 784800, 38016, 0x4d080e9c
-0, 788400, 38016, 0x7fe23bb4
-0, 792000, 38016, 0x95399638
-0, 795600, 38016, 0x6aa41ac2
-0, 799200, 38016, 0xe748bc32
-0, 802800, 38016, 0x5fab449b
-0, 806400, 38016, 0x8798bb84
-0, 810000, 38016, 0x4e700879
-0, 813600, 38016, 0x6d794fa4
-0, 817200, 38016, 0xf40c9e13
-0, 820800, 38016, 0x92330fdb
-0, 824400, 38016, 0x558b899a
-0, 828000, 38016, 0xec2320ed
-0, 831600, 38016, 0x3179f275
-0, 835200, 38016, 0x86cfd19d
-0, 838800, 38016, 0x2c88c48a
-0, 842400, 38016, 0x0c84b86f
-0, 846000, 38016, 0x95069c90
-0, 849600, 38016, 0x82da8061
-0, 853200, 38016, 0x847f7634
-0, 856800, 38016, 0x48d46d89
-0, 860400, 38016, 0x220d81f3
-0, 864000, 38016, 0x5cbe9a7e
-0, 867600, 38016, 0xc0e9d5b9
-0, 871200, 38016, 0xcc26ff97
-0, 874800, 38016, 0x01332392
-0, 878400, 38016, 0x44e44439
-0, 882000, 38016, 0xfe8751ee
-0, 885600, 38016, 0x010d74a1
-0, 889200, 38016, 0xbf4a7c2d
-0, 892800, 38016, 0x77869402
-0, 896400, 38016, 0x1ae8b176
-0, 900000, 38016, 0x917cc0b8
-0, 903600, 38016, 0x3eb6d02a
-0, 907200, 38016, 0x815ed568
-0, 910800, 38016, 0xcd6bcd54
-0, 914400, 38016, 0xd3e5bfcd
-0, 918000, 38016, 0x95e2bd36
-0, 921600, 38016, 0x102ca664
-0, 925200, 38016, 0x95c59672
-0, 928800, 38016, 0x1d5b8845
-0, 932400, 38016, 0x3d988a4d
-0, 936000, 38016, 0x4139a121
-0, 939600, 38016, 0x9eeca508
-0, 943200, 38016, 0xf9f2a9cc
-0, 946800, 38016, 0x9420b177
-0, 950400, 38016, 0x13edadd7
-0, 954000, 38016, 0x3d18a416
-0, 957600, 38016, 0x88b09166
-0, 961200, 38016, 0x2e1c939c
-0, 964800, 38016, 0x4f8381c3
-0, 968400, 38016, 0x36647382
-0, 972000, 38016, 0x26a272c1
-0, 975600, 38016, 0x9a5a7cc8
-0, 979200, 38016, 0xc2fc7734
-0, 982800, 38016, 0xd21b7e6c
-0, 986400, 38016, 0x948c77a0
-0, 990000, 38016, 0x179e7d1a
-0, 993600, 38016, 0xbfd17561
-0, 997200, 38016, 0x30f97511
-0, 1000800, 38016, 0x893e6f54
-0, 1004400, 38016, 0x76036ecb
-0, 1008000, 38016, 0x3f0e6966
-0, 1011600, 38016, 0xed946afe
-0, 1015200, 38016, 0x2c2676de
-0, 1018800, 38016, 0x7b348c94
-0, 1022400, 38016, 0x77f5afc8
-0, 1026000, 38016, 0xdb54cea0
-0, 1029600, 38016, 0xc9fed974
-0, 1033200, 38016, 0x04bbe454
-0, 1036800, 38016, 0x7320ffb9
-0, 1040400, 38016, 0x841b199a
-0, 1044000, 38016, 0x7d792ee3
-0, 1047600, 38016, 0x5ce33607
-0, 1051200, 38016, 0xec52432e
-0, 1054800, 38016, 0xe6a04efe
-0, 1058400, 38016, 0xc7b45cef
-0, 1062000, 38016, 0xdbe76bf9
-0, 1065600, 38016, 0xd57f7e18
-0, 1069200, 38016, 0x8e03915d
-0, 1072800, 38016, 0x30779ec6
-0, 1076400, 38016, 0x89b1aa42
diff --git a/tests/ref/fate/h264-conformance-mr3_tandberg_b b/tests/ref/fate/h264-conformance-mr3_tandberg_b
deleted file mode 100644
index ce9813e..0000000
--- a/tests/ref/fate/h264-conformance-mr3_tandberg_b
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0xca461abd
-0, 7200, 38016, 0x578a0c87
-0, 10800, 38016, 0xb3cc1ecb
-0, 14400, 38016, 0xd2c84463
-0, 18000, 38016, 0x815d6363
-0, 21600, 38016, 0x7cc17319
-0, 25200, 38016, 0x0f7e8cab
-0, 28800, 38016, 0x1876abee
-0, 32400, 38016, 0xda748c2f
-0, 36000, 38016, 0x7b4dbff0
-0, 39600, 38016, 0xd4a1b24a
-0, 43200, 38016, 0x714cb4cc
-0, 46800, 38016, 0x2c6d80f0
-0, 50400, 38016, 0x92266151
-0, 54000, 38016, 0x6b766a23
-0, 57600, 38016, 0xb24f7efe
-0, 61200, 38016, 0x8410838e
-0, 64800, 38016, 0x67fe872a
-0, 68400, 38016, 0x55b49d36
-0, 72000, 38016, 0x7a1c9c41
-0, 75600, 38016, 0xb4818e0e
-0, 79200, 38016, 0x25f6683c
-0, 82800, 38016, 0xe4d141a4
-0, 86400, 38016, 0x808216ad
-0, 90000, 38016, 0x2acf0baf
-0, 93600, 38016, 0xf3de13c4
-0, 97200, 38016, 0x5f412187
-0, 100800, 38016, 0xb31a340a
-0, 104400, 38016, 0x019d42d1
-0, 108000, 38016, 0xeeb94b9b
-0, 111600, 38016, 0xef55472e
-0, 115200, 38016, 0xdb5e3697
-0, 118800, 38016, 0x8565303e
-0, 122400, 38016, 0x5f9c2c1b
-0, 126000, 38016, 0xeb3d27f4
-0, 129600, 38016, 0x9a43282d
-0, 133200, 38016, 0xe04720c6
-0, 136800, 38016, 0x19cc0eba
-0, 140400, 38016, 0x218efeb6
-0, 144000, 38016, 0x7733f491
-0, 147600, 38016, 0x7f3bede9
-0, 151200, 38016, 0x49c5ec0d
-0, 154800, 38016, 0x803cf19e
-0, 158400, 38016, 0x31de0d3f
-0, 162000, 38016, 0xa7e30426
-0, 165600, 38016, 0xba37f068
-0, 169200, 38016, 0x2842bdf8
-0, 172800, 38016, 0x76df97dc
-0, 176400, 38016, 0xf3246d26
-0, 180000, 38016, 0x0a384d72
-0, 183600, 38016, 0x40964f41
-0, 187200, 38016, 0x46364324
-0, 190800, 38016, 0x7cbf3db4
-0, 194400, 38016, 0x7a223bec
-0, 198000, 38016, 0x458651c1
-0, 201600, 38016, 0xb82d7e3c
-0, 205200, 38016, 0x0f50a55d
-0, 208800, 38016, 0xc306cae4
-0, 212400, 38016, 0x9d6ddfcb
-0, 216000, 38016, 0xb602e8e9
-0, 219600, 38016, 0xbf0ae386
-0, 223200, 38016, 0x0a8bd46e
-0, 226800, 38016, 0xd437c5c1
-0, 230400, 38016, 0xd61d9959
-0, 234000, 38016, 0x70639b56
-0, 237600, 38016, 0x36fd407b
-0, 241200, 38016, 0x58ce3ddd
-0, 244800, 38016, 0x86cc1d8c
-0, 248400, 38016, 0xee422dc2
-0, 252000, 38016, 0xab475639
-0, 255600, 38016, 0xc1327ad8
-0, 259200, 38016, 0x63d196d4
-0, 262800, 38016, 0x1aba8ebd
-0, 266400, 38016, 0x74a269ac
-0, 270000, 38016, 0x267f3563
-0, 273600, 38016, 0xa18ff180
-0, 277200, 38016, 0x70c9c9fd
-0, 280800, 38016, 0xa6c59f9c
-0, 284400, 38016, 0xd7cd8927
-0, 288000, 38016, 0xd30b7345
-0, 291600, 38016, 0x679a4dda
-0, 295200, 38016, 0xeb0562de
-0, 298800, 38016, 0xdd7d6cdb
-0, 302400, 38016, 0xd6e26b73
-0, 306000, 38016, 0xa65a860f
-0, 309600, 38016, 0xae95c71e
-0, 313200, 38016, 0x1a89ca86
-0, 316800, 38016, 0xa33ecee6
-0, 320400, 38016, 0x821da6cb
-0, 324000, 38016, 0xf0e1612f
-0, 327600, 38016, 0x67b8516b
-0, 331200, 38016, 0x62f965bc
-0, 334800, 38016, 0xd1917aa6
-0, 338400, 38016, 0xe72db54d
-0, 342000, 38016, 0x9b64e721
-0, 345600, 38016, 0xa819efda
-0, 349200, 38016, 0xeacfdacb
-0, 352800, 38016, 0x52f235e1
-0, 356400, 38016, 0x2b512cb8
-0, 360000, 38016, 0xaac73fb3
-0, 363600, 38016, 0x7d2d504f
-0, 367200, 38016, 0x396d503a
-0, 370800, 38016, 0x97905235
-0, 374400, 38016, 0xf0056693
-0, 378000, 38016, 0x728a6a9e
-0, 381600, 38016, 0x0eed7824
-0, 385200, 38016, 0x59506237
-0, 388800, 38016, 0xd4304c93
-0, 392400, 38016, 0x7e663ee8
-0, 396000, 38016, 0x0ebc2d11
-0, 399600, 38016, 0x52db2112
-0, 403200, 38016, 0x74aa1815
-0, 406800, 38016, 0x57a60dc6
-0, 410400, 38016, 0x86e9fa32
-0, 414000, 38016, 0x67e8ff09
-0, 417600, 38016, 0x26e8f7ea
-0, 421200, 38016, 0x183dff56
-0, 424800, 38016, 0xa470af8d
-0, 428400, 38016, 0xe017d594
-0, 432000, 38016, 0xb899d48b
-0, 435600, 38016, 0x0d3bc5f7
-0, 439200, 38016, 0xd68bbb0d
-0, 442800, 38016, 0x8bf5b4cb
-0, 446400, 38016, 0x6bfcaa47
-0, 450000, 38016, 0x29a9b01b
-0, 453600, 38016, 0xcdedbdb7
-0, 457200, 38016, 0xdb5ad9c3
-0, 460800, 38016, 0x468aeef6
-0, 464400, 38016, 0xdc2b143e
-0, 468000, 38016, 0x6776277c
-0, 471600, 38016, 0xb78d5294
-0, 475200, 38016, 0x1dfb63ab
-0, 478800, 38016, 0xbd1f99bc
-0, 482400, 38016, 0xde16b89a
-0, 486000, 38016, 0xbf46edca
-0, 489600, 38016, 0x6306e8c4
-0, 493200, 38016, 0x7b09d224
-0, 496800, 38016, 0xfea1aff6
-0, 500400, 38016, 0x183686b0
-0, 504000, 38016, 0x665a61ff
-0, 507600, 38016, 0xc8af42d1
-0, 511200, 38016, 0xe2326bc1
-0, 514800, 38016, 0x56dbde82
-0, 518400, 38016, 0xa0254f97
-0, 522000, 38016, 0x3b74a0b4
-0, 525600, 38016, 0x9aee9b7f
-0, 529200, 38016, 0xd94b6133
-0, 532800, 38016, 0x5819f795
-0, 536400, 38016, 0xc45a8c02
-0, 540000, 38016, 0x2f9204a0
-0, 543600, 38016, 0xbe09e051
-0, 547200, 38016, 0xb542badd
-0, 550800, 38016, 0x23bd9e00
-0, 554400, 38016, 0x4f338d3d
-0, 558000, 38016, 0x8c91e8f3
-0, 561600, 38016, 0xa7347d57
-0, 565200, 38016, 0x6d91de4d
-0, 568800, 38016, 0x3443d936
-0, 572400, 38016, 0x9d25b4e2
-0, 576000, 38016, 0xd93cd4b3
-0, 579600, 38016, 0xa1c9e9a0
-0, 583200, 38016, 0x1482f220
-0, 586800, 38016, 0x1295f270
-0, 590400, 38016, 0x399ae9da
-0, 594000, 38016, 0x85dcdf28
-0, 597600, 38016, 0x4207b9e5
-0, 601200, 38016, 0xad1c9d75
-0, 604800, 38016, 0x4a266c14
-0, 608400, 38016, 0x3afc4508
-0, 612000, 38016, 0x2b1b2385
-0, 615600, 38016, 0x738f005f
-0, 619200, 38016, 0xfec3d833
-0, 622800, 38016, 0x3f7f6ae9
-0, 626400, 38016, 0xd8551823
-0, 630000, 38016, 0x6df03570
-0, 633600, 38016, 0x767c3054
-0, 637200, 38016, 0x89bd342c
-0, 640800, 38016, 0x77ba806c
-0, 644400, 38016, 0x1c98005c
-0, 648000, 38016, 0xa13ce2a3
-0, 651600, 38016, 0x1be59915
-0, 655200, 38016, 0x279c6027
-0, 658800, 38016, 0x96ac11a2
-0, 662400, 38016, 0x3ae95131
-0, 666000, 38016, 0xae19f7fe
-0, 669600, 38016, 0xcde4efe6
-0, 673200, 38016, 0x5ecc3f7a
-0, 676800, 38016, 0x79645152
-0, 680400, 38016, 0x1ee2e89f
-0, 684000, 38016, 0x91d34bb4
-0, 687600, 38016, 0xf019d464
-0, 691200, 38016, 0x8eb07205
-0, 694800, 38016, 0x5399bb5b
-0, 698400, 38016, 0x61f0c77a
-0, 702000, 38016, 0xb2bd8726
-0, 705600, 38016, 0x47b89243
-0, 709200, 38016, 0xebfe4d76
-0, 712800, 38016, 0xe8f87d91
-0, 716400, 38016, 0x5e9fb239
-0, 720000, 38016, 0x357ca1f8
-0, 723600, 38016, 0x757d2e02
-0, 727200, 38016, 0x40672e7c
-0, 730800, 38016, 0xd966abca
-0, 734400, 38016, 0xe98d0d47
-0, 738000, 38016, 0x341babf5
-0, 741600, 38016, 0xd12d5a0c
-0, 745200, 38016, 0xea2f99ab
-0, 748800, 38016, 0x14bce88e
-0, 752400, 38016, 0xe4bda9e8
-0, 756000, 38016, 0x2c57ec89
-0, 759600, 38016, 0x28bbb83e
-0, 763200, 38016, 0xf8444b54
-0, 766800, 38016, 0x3aba03cd
-0, 770400, 38016, 0x373daa20
-0, 774000, 38016, 0x69586597
-0, 777600, 38016, 0xc0c70d53
-0, 781200, 38016, 0x76a5df5a
-0, 784800, 38016, 0x1afde8f0
-0, 788400, 38016, 0x9638285a
-0, 792000, 38016, 0x9f0686c0
-0, 795600, 38016, 0xc65b2238
-0, 799200, 38016, 0x0d61b610
-0, 802800, 38016, 0x78e14e1f
-0, 806400, 38016, 0xcf80ac4a
-0, 810000, 38016, 0xe094083d
-0, 813600, 38016, 0xee5e612e
-0, 817200, 38016, 0x51cdad9d
-0, 820800, 38016, 0xae41100e
-0, 824400, 38016, 0x77558f58
-0, 828000, 38016, 0xb9503b95
-0, 831600, 38016, 0xb71dffeb
-0, 835200, 38016, 0x1872e3e6
-0, 838800, 38016, 0x29c3d252
-0, 842400, 38016, 0x1c77c6ec
-0, 846000, 38016, 0x26feb194
-0, 849600, 38016, 0x3307c3c4
-0, 853200, 38016, 0x8e5a8080
-0, 856800, 38016, 0x933472f7
-0, 860400, 38016, 0xd4768d84
-0, 864000, 38016, 0x3324485f
-0, 867600, 38016, 0xd50af078
-0, 871200, 38016, 0x53820752
-0, 874800, 38016, 0xbe7f1c47
-0, 878400, 38016, 0xe43d3a34
-0, 882000, 38016, 0x57194b82
-0, 885600, 38016, 0x68a052ed
-0, 889200, 38016, 0x5c898052
-0, 892800, 38016, 0x7104a6ad
-0, 896400, 38016, 0x1676b5e8
-0, 900000, 38016, 0xe1cfd375
-0, 903600, 38016, 0x16fede04
-0, 907200, 38016, 0xca49dd4a
-0, 910800, 38016, 0x7b98d9d1
-0, 914400, 38016, 0x4020d210
-0, 918000, 38016, 0x62c5d1e4
-0, 921600, 38016, 0x756abdb4
-0, 925200, 38016, 0x558fb00f
-0, 928800, 38016, 0x4ab0b1f1
-0, 932400, 38016, 0x7c9fb0c2
-0, 936000, 38016, 0xcecfbdd0
-0, 939600, 38016, 0x70e6d174
-0, 943200, 38016, 0x83d7ddde
-0, 946800, 38016, 0xbbcde2d9
-0, 950400, 38016, 0xc89eeaef
-0, 954000, 38016, 0x8565e15c
-0, 957600, 38016, 0x28e0db24
-0, 961200, 38016, 0x1d9dd334
-0, 964800, 38016, 0xce02c452
-0, 968400, 38016, 0xe29dbd0c
-0, 972000, 38016, 0x4aa3b638
-0, 975600, 38016, 0x5533c135
-0, 979200, 38016, 0x6c57b65f
-0, 982800, 38016, 0x23d3b851
-0, 986400, 38016, 0xd8cbb960
-0, 990000, 38016, 0x02edb916
-0, 993600, 38016, 0xa622bd42
-0, 997200, 38016, 0x4ba5be1c
-0, 1000800, 38016, 0xe69bb625
-0, 1004400, 38016, 0xbca5b292
-0, 1008000, 38016, 0xde38b1c8
-0, 1011600, 38016, 0xe9e3b617
-0, 1015200, 38016, 0x216cc574
-0, 1018800, 38016, 0x3780c5ad
-0, 1022400, 38016, 0x5531e3f9
-0, 1026000, 38016, 0xe2c5f5d4
-0, 1029600, 38016, 0x24cefc6e
-0, 1033200, 38016, 0xa3ce003d
-0, 1036800, 38016, 0x42d01c9e
-0, 1040400, 38016, 0xbfc13689
-0, 1044000, 38016, 0x122647a9
-0, 1047600, 38016, 0xe45254da
-0, 1051200, 38016, 0xad955b0c
-0, 1054800, 38016, 0x4b086abb
-0, 1058400, 38016, 0xd4857b8c
-0, 1062000, 38016, 0xa71594ce
-0, 1065600, 38016, 0x04e4a73d
-0, 1069200, 38016, 0x295abf63
-0, 1072800, 38016, 0xbe4ed5dd
-0, 1076400, 38016, 0x087bcf64
diff --git a/tests/ref/fate/h264-conformance-mr4_tandberg_c b/tests/ref/fate/h264-conformance-mr4_tandberg_c
deleted file mode 100644
index 5aceda2..0000000
--- a/tests/ref/fate/h264-conformance-mr4_tandberg_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0x0ff111f0
-0, 7200, 38016, 0xbac70271
-0, 10800, 38016, 0x8c361866
-0, 14400, 38016, 0x9d9640be
-0, 18000, 38016, 0xd36b563b
-0, 21600, 38016, 0xe5966f5f
-0, 25200, 38016, 0xb8b28ab0
-0, 28800, 38016, 0xf817a3e6
-0, 32400, 38016, 0xba26acd8
-0, 36000, 38016, 0x453dba2f
-0, 39600, 38016, 0xe50bd16e
-0, 43200, 38016, 0x95c2c1f7
-0, 46800, 38016, 0xc6a59679
-0, 50400, 38016, 0x9f468726
-0, 54000, 38016, 0x371091eb
-0, 57600, 38016, 0xd499d26b
-0, 61200, 38016, 0x172fd389
-0, 64800, 38016, 0x3c04de2a
-0, 68400, 38016, 0xa461aed2
-0, 72000, 38016, 0x098cdef2
-0, 75600, 38016, 0x5d8d9c7d
-0, 79200, 38016, 0x087db718
-0, 82800, 38016, 0x064191ef
-0, 86400, 38016, 0x2f842ef5
-0, 90000, 38016, 0x2b5b0e77
-0, 93600, 38016, 0xcc671b7f
-0, 97200, 38016, 0x859f4f75
-0, 100800, 38016, 0x132a7a48
-0, 104400, 38016, 0x6e8987ab
-0, 108000, 38016, 0x02db8591
-0, 111600, 38016, 0x30567d9b
-0, 115200, 38016, 0x92ea3b53
-0, 118800, 38016, 0xae807c6e
-0, 122400, 38016, 0xbfbc7458
-0, 126000, 38016, 0x66294d04
-0, 129600, 38016, 0xdb2a5f10
-0, 133200, 38016, 0xb19112fe
-0, 136800, 38016, 0xdd26490e
-0, 140400, 38016, 0x51cd31de
-0, 144000, 38016, 0xf6cc2dad
-0, 147600, 38016, 0x0c302dfd
-0, 151200, 38016, 0xb846245d
-0, 154800, 38016, 0xd61c2e88
-0, 158400, 38016, 0xf8264117
-0, 162000, 38016, 0x13862a3d
-0, 165600, 38016, 0xfb481750
-0, 169200, 38016, 0x6377e4af
-0, 172800, 38016, 0x1759c1b4
-0, 176400, 38016, 0xca03942b
-0, 180000, 38016, 0x0126810b
-0, 183600, 38016, 0x3c8c820b
-0, 187200, 38016, 0x863379ec
-0, 190800, 38016, 0xaf9b6d52
-0, 194400, 38016, 0x9ba86946
-0, 198000, 38016, 0xf97980fb
-0, 201600, 38016, 0x9cf4785c
-0, 205200, 38016, 0x51cdcdc7
-0, 208800, 38016, 0x923de162
-0, 212400, 38016, 0xdcd3c3cb
-0, 216000, 38016, 0x6f9fea31
-0, 219600, 38016, 0x7ab7b133
-0, 223200, 38016, 0xb8a2c99f
-0, 226800, 38016, 0x040a99c6
-0, 230400, 38016, 0xa8c4b28f
-0, 234000, 38016, 0x4c577509
-0, 237600, 38016, 0xb30f7277
-0, 241200, 38016, 0xb5f73b46
-0, 244800, 38016, 0x723f3ccc
-0, 248400, 38016, 0x3e4a0cca
-0, 252000, 38016, 0xe0df386e
-0, 255600, 38016, 0xc4832c7b
-0, 259200, 38016, 0x014a2d9f
-0, 262800, 38016, 0xae4272d9
-0, 266400, 38016, 0xcde25e0f
-0, 270000, 38016, 0xdecb13d6
-0, 273600, 38016, 0x9d8ae5d9
-0, 277200, 38016, 0x280abccf
-0, 280800, 38016, 0x885a9fcc
-0, 284400, 38016, 0x9b328b6f
-0, 288000, 38016, 0x8fb7663c
-0, 291600, 38016, 0x35fd4c32
-0, 295200, 38016, 0xdd484efb
-0, 298800, 38016, 0xb8f576b1
-0, 302400, 38016, 0xe8016312
-0, 306000, 38016, 0x65a88d55
-0, 309600, 38016, 0x83dca3a9
-0, 313200, 38016, 0xfc3ba542
-0, 316800, 38016, 0x3d55ac26
-0, 320400, 38016, 0xb91f6bbe
-0, 324000, 38016, 0x67bd2f75
-0, 327600, 38016, 0x0af12875
-0, 331200, 38016, 0xc18a2d55
-0, 334800, 38016, 0x22fd4e01
-0, 338400, 38016, 0x466b8dcd
-0, 342000, 38016, 0xfe93c2d9
-0, 345600, 38016, 0x2cc0e638
-0, 349200, 38016, 0xbe550d40
-0, 352800, 38016, 0x65900ffc
-0, 356400, 38016, 0xcc61228c
-0, 360000, 38016, 0x8ae34904
-0, 363600, 38016, 0x74b8411a
-0, 367200, 38016, 0xae36408d
-0, 370800, 38016, 0x251429ad
-0, 374400, 38016, 0x4d8e6dc6
-0, 378000, 38016, 0x9e07801e
-0, 381600, 38016, 0x8fdd83ef
-0, 385200, 38016, 0x976084a1
-0, 388800, 38016, 0x69f7609f
-0, 392400, 38016, 0x48971b09
-0, 396000, 38016, 0x78e63ff4
-0, 399600, 38016, 0x0852365b
-0, 403200, 38016, 0x8044232c
-0, 406800, 38016, 0x9ec3178d
-0, 410400, 38016, 0x6f260955
-0, 414000, 38016, 0x903cfe23
-0, 417600, 38016, 0x441afbe4
-0, 421200, 38016, 0xe4420313
-0, 424800, 38016, 0xf86d0c34
-0, 428400, 38016, 0xafe5f3c3
-0, 432000, 38016, 0x9f61e43b
-0, 435600, 38016, 0x9330e186
-0, 439200, 38016, 0xc900ce86
-0, 442800, 38016, 0xffd6c4a6
-0, 446400, 38016, 0xd7b3cd79
-0, 450000, 38016, 0x8015c914
-0, 453600, 38016, 0x36d3c884
-0, 457200, 38016, 0x2981db44
-0, 460800, 38016, 0x94f40162
-0, 464400, 38016, 0x091022c5
-0, 468000, 38016, 0xd554203f
-0, 471600, 38016, 0xdcf26c7e
-0, 475200, 38016, 0xdc398ff4
-0, 478800, 38016, 0xeb5ca01c
-0, 482400, 38016, 0x4931c311
-0, 486000, 38016, 0x0ddabf2a
-0, 489600, 38016, 0x2432a265
-0, 493200, 38016, 0x65409b4f
-0, 496800, 38016, 0x466e6957
-0, 500400, 38016, 0x82a08bb4
-0, 504000, 38016, 0xdb6a35c4
-0, 507600, 38016, 0xda5b0d28
-0, 511200, 38016, 0x2be76f6d
-0, 514800, 38016, 0x7587a456
-0, 518400, 38016, 0x69994004
-0, 522000, 38016, 0xaefd46ec
-0, 525600, 38016, 0x88094d53
-0, 529200, 38016, 0xfcb82a4c
-0, 532800, 38016, 0x2877c850
-0, 536400, 38016, 0x327f5e88
-0, 540000, 38016, 0xaa1c4a3f
-0, 543600, 38016, 0x1950dfbd
-0, 547200, 38016, 0x8580b472
-0, 550800, 38016, 0xb5ef90c0
-0, 554400, 38016, 0x0906b3e7
-0, 558000, 38016, 0x026b12fa
-0, 561600, 38016, 0xe8ef556a
-0, 565200, 38016, 0x2e1afe7f
-0, 568800, 38016, 0xef2ad28a
-0, 572400, 38016, 0xe6d7d947
-0, 576000, 38016, 0x25ebd549
-0, 579600, 38016, 0xc443f3cf
-0, 583200, 38016, 0x9dc7dcad
-0, 586800, 38016, 0x8b7ce835
-0, 590400, 38016, 0x27a3e48b
-0, 594000, 38016, 0x0b6bc8a9
-0, 597600, 38016, 0xdb98d21e
-0, 601200, 38016, 0x4cb89812
-0, 604800, 38016, 0x41f35c5e
-0, 608400, 38016, 0xfd764d91
-0, 612000, 38016, 0xb7cc313f
-0, 615600, 38016, 0x51ba22d1
-0, 619200, 38016, 0x00d8deee
-0, 622800, 38016, 0x50db806a
-0, 626400, 38016, 0xbf022623
-0, 630000, 38016, 0xf2fe22ba
-0, 633600, 38016, 0x7055191b
-0, 637200, 38016, 0xbefb8590
-0, 640800, 38016, 0x90e59103
-0, 644400, 38016, 0x61d443da
-0, 648000, 38016, 0x6ad0e637
-0, 651600, 38016, 0xda39f9c1
-0, 655200, 38016, 0x03408181
-0, 658800, 38016, 0xee973480
-0, 662400, 38016, 0x9674d65d
-0, 666000, 38016, 0x1fdd5529
-0, 669600, 38016, 0x51a219bb
-0, 673200, 38016, 0x9cd9747e
-0, 676800, 38016, 0xa58a3c33
-0, 680400, 38016, 0xdf1905a9
-0, 684000, 38016, 0x44a52c69
-0, 687600, 38016, 0x0cf6e56b
-0, 691200, 38016, 0xe2115e06
-0, 694800, 38016, 0x15efa840
-0, 698400, 38016, 0x0811bad8
-0, 702000, 38016, 0x8240a91d
-0, 705600, 38016, 0xdfe46b7d
-0, 709200, 38016, 0xcead819a
-0, 712800, 38016, 0xe8f87d91
-0, 716400, 38016, 0x951ebd82
-0, 720000, 38016, 0x37d98ecb
-0, 723600, 38016, 0x54fb54da
-0, 727200, 38016, 0xb306302e
-0, 730800, 38016, 0xa8acd0dc
-0, 734400, 38016, 0x68e43757
-0, 738000, 38016, 0x7018cd48
-0, 741600, 38016, 0x1c34824e
-0, 745200, 38016, 0x22e7e478
-0, 748800, 38016, 0x534a0470
-0, 752400, 38016, 0x1a65bc45
-0, 756000, 38016, 0x5e78223b
-0, 759600, 38016, 0xc3c9c912
-0, 763200, 38016, 0x52557c74
-0, 766800, 38016, 0xf5ff1f9a
-0, 770400, 38016, 0x56afe047
-0, 774000, 38016, 0x50259235
-0, 777600, 38016, 0xca19311d
-0, 781200, 38016, 0xd96eeb53
-0, 784800, 38016, 0x21a218b7
-0, 788400, 38016, 0x24162395
-0, 792000, 38016, 0xadf9b983
-0, 795600, 38016, 0x68443df2
-0, 799200, 38016, 0xa970df8a
-0, 802800, 38016, 0x8381bbee
-0, 806400, 38016, 0x36fe1d22
-0, 810000, 38016, 0xa0326ddf
-0, 813600, 38016, 0x01dc7ca7
-0, 817200, 38016, 0xf485d505
-0, 820800, 38016, 0xb5a8fe68
-0, 824400, 38016, 0x6385f303
-0, 828000, 38016, 0x4d099ef1
-0, 831600, 38016, 0xeaa54d25
-0, 835200, 38016, 0x5c32c503
-0, 838800, 38016, 0xd52538b3
-0, 842400, 38016, 0x1ca2e4c2
-0, 846000, 38016, 0xe3a95b82
-0, 849600, 38016, 0x14393895
-0, 853200, 38016, 0xd77cef50
-0, 856800, 38016, 0x47b901b8
-0, 860400, 38016, 0x14d70226
-0, 864000, 38016, 0xab32b360
-0, 867600, 38016, 0xb92d3090
-0, 871200, 38016, 0xbd50ae43
-0, 874800, 38016, 0x5ea8d59a
-0, 878400, 38016, 0xb6d7fe63
-0, 882000, 38016, 0xe228050d
-0, 885600, 38016, 0x09e251ed
-0, 889200, 38016, 0xcea332d0
-0, 892800, 38016, 0x048838af
-0, 896400, 38016, 0x0a625a93
-0, 900000, 38016, 0x018aa719
-0, 903600, 38016, 0x630e70a8
-0, 907200, 38016, 0x93cb4c39
-0, 910800, 38016, 0x3cdb7cf8
-0, 914400, 38016, 0x48491fb4
-0, 918000, 38016, 0x06aa4101
-0, 921600, 38016, 0x4b402d3e
-0, 925200, 38016, 0x13cbf927
-0, 928800, 38016, 0xdc7528b6
-0, 932400, 38016, 0x652d0576
-0, 936000, 38016, 0xa3a504d6
-0, 939600, 38016, 0x5bd33fe4
-0, 943200, 38016, 0xae11267b
-0, 946800, 38016, 0xb58b5613
-0, 950400, 38016, 0x50160d80
-0, 954000, 38016, 0x4a643ed0
-0, 957600, 38016, 0xe3983ed6
-0, 961200, 38016, 0xa1fb3338
-0, 964800, 38016, 0x48d0286d
-0, 968400, 38016, 0x67043801
-0, 972000, 38016, 0x00bafaad
-0, 975600, 38016, 0xf07de35a
-0, 979200, 38016, 0x493e4579
-0, 982800, 38016, 0xa917532b
-0, 986400, 38016, 0x463fcc89
-0, 990000, 38016, 0xd47c1b1b
-0, 993600, 38016, 0x3543c596
-0, 997200, 38016, 0x65d6cd5b
-0, 1000800, 38016, 0x22cbd5ef
-0, 1004400, 38016, 0x08e0f250
-0, 1008000, 38016, 0x4e4aeb0a
-0, 1011600, 38016, 0x7895e0bd
-0, 1015200, 38016, 0xc11cea95
-0, 1018800, 38016, 0x13b3bcf8
-0, 1022400, 38016, 0xcb312186
-0, 1026000, 38016, 0x791007ca
-0, 1029600, 38016, 0xaa77354f
-0, 1033200, 38016, 0x1dbc2a67
-0, 1036800, 38016, 0x00646a65
-0, 1040400, 38016, 0x19db488d
-0, 1044000, 38016, 0x16c155e5
-0, 1047600, 38016, 0xb760898e
-0, 1051200, 38016, 0xbd6691e8
-0, 1054800, 38016, 0x06829781
-0, 1058400, 38016, 0xcebab8ad
-0, 1062000, 38016, 0xe2f38e79
-0, 1065600, 38016, 0x1e00c08e
-0, 1069200, 38016, 0x86d6c935
-0, 1072800, 38016, 0xaa88dfdc
-0, 1076400, 38016, 0xa9029b45
diff --git a/tests/ref/fate/h264-conformance-mr5_tandberg_c b/tests/ref/fate/h264-conformance-mr5_tandberg_c
deleted file mode 100644
index 5aceda2..0000000
--- a/tests/ref/fate/h264-conformance-mr5_tandberg_c
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xb96f1feb
-0, 3600, 38016, 0x0ff111f0
-0, 7200, 38016, 0xbac70271
-0, 10800, 38016, 0x8c361866
-0, 14400, 38016, 0x9d9640be
-0, 18000, 38016, 0xd36b563b
-0, 21600, 38016, 0xe5966f5f
-0, 25200, 38016, 0xb8b28ab0
-0, 28800, 38016, 0xf817a3e6
-0, 32400, 38016, 0xba26acd8
-0, 36000, 38016, 0x453dba2f
-0, 39600, 38016, 0xe50bd16e
-0, 43200, 38016, 0x95c2c1f7
-0, 46800, 38016, 0xc6a59679
-0, 50400, 38016, 0x9f468726
-0, 54000, 38016, 0x371091eb
-0, 57600, 38016, 0xd499d26b
-0, 61200, 38016, 0x172fd389
-0, 64800, 38016, 0x3c04de2a
-0, 68400, 38016, 0xa461aed2
-0, 72000, 38016, 0x098cdef2
-0, 75600, 38016, 0x5d8d9c7d
-0, 79200, 38016, 0x087db718
-0, 82800, 38016, 0x064191ef
-0, 86400, 38016, 0x2f842ef5
-0, 90000, 38016, 0x2b5b0e77
-0, 93600, 38016, 0xcc671b7f
-0, 97200, 38016, 0x859f4f75
-0, 100800, 38016, 0x132a7a48
-0, 104400, 38016, 0x6e8987ab
-0, 108000, 38016, 0x02db8591
-0, 111600, 38016, 0x30567d9b
-0, 115200, 38016, 0x92ea3b53
-0, 118800, 38016, 0xae807c6e
-0, 122400, 38016, 0xbfbc7458
-0, 126000, 38016, 0x66294d04
-0, 129600, 38016, 0xdb2a5f10
-0, 133200, 38016, 0xb19112fe
-0, 136800, 38016, 0xdd26490e
-0, 140400, 38016, 0x51cd31de
-0, 144000, 38016, 0xf6cc2dad
-0, 147600, 38016, 0x0c302dfd
-0, 151200, 38016, 0xb846245d
-0, 154800, 38016, 0xd61c2e88
-0, 158400, 38016, 0xf8264117
-0, 162000, 38016, 0x13862a3d
-0, 165600, 38016, 0xfb481750
-0, 169200, 38016, 0x6377e4af
-0, 172800, 38016, 0x1759c1b4
-0, 176400, 38016, 0xca03942b
-0, 180000, 38016, 0x0126810b
-0, 183600, 38016, 0x3c8c820b
-0, 187200, 38016, 0x863379ec
-0, 190800, 38016, 0xaf9b6d52
-0, 194400, 38016, 0x9ba86946
-0, 198000, 38016, 0xf97980fb
-0, 201600, 38016, 0x9cf4785c
-0, 205200, 38016, 0x51cdcdc7
-0, 208800, 38016, 0x923de162
-0, 212400, 38016, 0xdcd3c3cb
-0, 216000, 38016, 0x6f9fea31
-0, 219600, 38016, 0x7ab7b133
-0, 223200, 38016, 0xb8a2c99f
-0, 226800, 38016, 0x040a99c6
-0, 230400, 38016, 0xa8c4b28f
-0, 234000, 38016, 0x4c577509
-0, 237600, 38016, 0xb30f7277
-0, 241200, 38016, 0xb5f73b46
-0, 244800, 38016, 0x723f3ccc
-0, 248400, 38016, 0x3e4a0cca
-0, 252000, 38016, 0xe0df386e
-0, 255600, 38016, 0xc4832c7b
-0, 259200, 38016, 0x014a2d9f
-0, 262800, 38016, 0xae4272d9
-0, 266400, 38016, 0xcde25e0f
-0, 270000, 38016, 0xdecb13d6
-0, 273600, 38016, 0x9d8ae5d9
-0, 277200, 38016, 0x280abccf
-0, 280800, 38016, 0x885a9fcc
-0, 284400, 38016, 0x9b328b6f
-0, 288000, 38016, 0x8fb7663c
-0, 291600, 38016, 0x35fd4c32
-0, 295200, 38016, 0xdd484efb
-0, 298800, 38016, 0xb8f576b1
-0, 302400, 38016, 0xe8016312
-0, 306000, 38016, 0x65a88d55
-0, 309600, 38016, 0x83dca3a9
-0, 313200, 38016, 0xfc3ba542
-0, 316800, 38016, 0x3d55ac26
-0, 320400, 38016, 0xb91f6bbe
-0, 324000, 38016, 0x67bd2f75
-0, 327600, 38016, 0x0af12875
-0, 331200, 38016, 0xc18a2d55
-0, 334800, 38016, 0x22fd4e01
-0, 338400, 38016, 0x466b8dcd
-0, 342000, 38016, 0xfe93c2d9
-0, 345600, 38016, 0x2cc0e638
-0, 349200, 38016, 0xbe550d40
-0, 352800, 38016, 0x65900ffc
-0, 356400, 38016, 0xcc61228c
-0, 360000, 38016, 0x8ae34904
-0, 363600, 38016, 0x74b8411a
-0, 367200, 38016, 0xae36408d
-0, 370800, 38016, 0x251429ad
-0, 374400, 38016, 0x4d8e6dc6
-0, 378000, 38016, 0x9e07801e
-0, 381600, 38016, 0x8fdd83ef
-0, 385200, 38016, 0x976084a1
-0, 388800, 38016, 0x69f7609f
-0, 392400, 38016, 0x48971b09
-0, 396000, 38016, 0x78e63ff4
-0, 399600, 38016, 0x0852365b
-0, 403200, 38016, 0x8044232c
-0, 406800, 38016, 0x9ec3178d
-0, 410400, 38016, 0x6f260955
-0, 414000, 38016, 0x903cfe23
-0, 417600, 38016, 0x441afbe4
-0, 421200, 38016, 0xe4420313
-0, 424800, 38016, 0xf86d0c34
-0, 428400, 38016, 0xafe5f3c3
-0, 432000, 38016, 0x9f61e43b
-0, 435600, 38016, 0x9330e186
-0, 439200, 38016, 0xc900ce86
-0, 442800, 38016, 0xffd6c4a6
-0, 446400, 38016, 0xd7b3cd79
-0, 450000, 38016, 0x8015c914
-0, 453600, 38016, 0x36d3c884
-0, 457200, 38016, 0x2981db44
-0, 460800, 38016, 0x94f40162
-0, 464400, 38016, 0x091022c5
-0, 468000, 38016, 0xd554203f
-0, 471600, 38016, 0xdcf26c7e
-0, 475200, 38016, 0xdc398ff4
-0, 478800, 38016, 0xeb5ca01c
-0, 482400, 38016, 0x4931c311
-0, 486000, 38016, 0x0ddabf2a
-0, 489600, 38016, 0x2432a265
-0, 493200, 38016, 0x65409b4f
-0, 496800, 38016, 0x466e6957
-0, 500400, 38016, 0x82a08bb4
-0, 504000, 38016, 0xdb6a35c4
-0, 507600, 38016, 0xda5b0d28
-0, 511200, 38016, 0x2be76f6d
-0, 514800, 38016, 0x7587a456
-0, 518400, 38016, 0x69994004
-0, 522000, 38016, 0xaefd46ec
-0, 525600, 38016, 0x88094d53
-0, 529200, 38016, 0xfcb82a4c
-0, 532800, 38016, 0x2877c850
-0, 536400, 38016, 0x327f5e88
-0, 540000, 38016, 0xaa1c4a3f
-0, 543600, 38016, 0x1950dfbd
-0, 547200, 38016, 0x8580b472
-0, 550800, 38016, 0xb5ef90c0
-0, 554400, 38016, 0x0906b3e7
-0, 558000, 38016, 0x026b12fa
-0, 561600, 38016, 0xe8ef556a
-0, 565200, 38016, 0x2e1afe7f
-0, 568800, 38016, 0xef2ad28a
-0, 572400, 38016, 0xe6d7d947
-0, 576000, 38016, 0x25ebd549
-0, 579600, 38016, 0xc443f3cf
-0, 583200, 38016, 0x9dc7dcad
-0, 586800, 38016, 0x8b7ce835
-0, 590400, 38016, 0x27a3e48b
-0, 594000, 38016, 0x0b6bc8a9
-0, 597600, 38016, 0xdb98d21e
-0, 601200, 38016, 0x4cb89812
-0, 604800, 38016, 0x41f35c5e
-0, 608400, 38016, 0xfd764d91
-0, 612000, 38016, 0xb7cc313f
-0, 615600, 38016, 0x51ba22d1
-0, 619200, 38016, 0x00d8deee
-0, 622800, 38016, 0x50db806a
-0, 626400, 38016, 0xbf022623
-0, 630000, 38016, 0xf2fe22ba
-0, 633600, 38016, 0x7055191b
-0, 637200, 38016, 0xbefb8590
-0, 640800, 38016, 0x90e59103
-0, 644400, 38016, 0x61d443da
-0, 648000, 38016, 0x6ad0e637
-0, 651600, 38016, 0xda39f9c1
-0, 655200, 38016, 0x03408181
-0, 658800, 38016, 0xee973480
-0, 662400, 38016, 0x9674d65d
-0, 666000, 38016, 0x1fdd5529
-0, 669600, 38016, 0x51a219bb
-0, 673200, 38016, 0x9cd9747e
-0, 676800, 38016, 0xa58a3c33
-0, 680400, 38016, 0xdf1905a9
-0, 684000, 38016, 0x44a52c69
-0, 687600, 38016, 0x0cf6e56b
-0, 691200, 38016, 0xe2115e06
-0, 694800, 38016, 0x15efa840
-0, 698400, 38016, 0x0811bad8
-0, 702000, 38016, 0x8240a91d
-0, 705600, 38016, 0xdfe46b7d
-0, 709200, 38016, 0xcead819a
-0, 712800, 38016, 0xe8f87d91
-0, 716400, 38016, 0x951ebd82
-0, 720000, 38016, 0x37d98ecb
-0, 723600, 38016, 0x54fb54da
-0, 727200, 38016, 0xb306302e
-0, 730800, 38016, 0xa8acd0dc
-0, 734400, 38016, 0x68e43757
-0, 738000, 38016, 0x7018cd48
-0, 741600, 38016, 0x1c34824e
-0, 745200, 38016, 0x22e7e478
-0, 748800, 38016, 0x534a0470
-0, 752400, 38016, 0x1a65bc45
-0, 756000, 38016, 0x5e78223b
-0, 759600, 38016, 0xc3c9c912
-0, 763200, 38016, 0x52557c74
-0, 766800, 38016, 0xf5ff1f9a
-0, 770400, 38016, 0x56afe047
-0, 774000, 38016, 0x50259235
-0, 777600, 38016, 0xca19311d
-0, 781200, 38016, 0xd96eeb53
-0, 784800, 38016, 0x21a218b7
-0, 788400, 38016, 0x24162395
-0, 792000, 38016, 0xadf9b983
-0, 795600, 38016, 0x68443df2
-0, 799200, 38016, 0xa970df8a
-0, 802800, 38016, 0x8381bbee
-0, 806400, 38016, 0x36fe1d22
-0, 810000, 38016, 0xa0326ddf
-0, 813600, 38016, 0x01dc7ca7
-0, 817200, 38016, 0xf485d505
-0, 820800, 38016, 0xb5a8fe68
-0, 824400, 38016, 0x6385f303
-0, 828000, 38016, 0x4d099ef1
-0, 831600, 38016, 0xeaa54d25
-0, 835200, 38016, 0x5c32c503
-0, 838800, 38016, 0xd52538b3
-0, 842400, 38016, 0x1ca2e4c2
-0, 846000, 38016, 0xe3a95b82
-0, 849600, 38016, 0x14393895
-0, 853200, 38016, 0xd77cef50
-0, 856800, 38016, 0x47b901b8
-0, 860400, 38016, 0x14d70226
-0, 864000, 38016, 0xab32b360
-0, 867600, 38016, 0xb92d3090
-0, 871200, 38016, 0xbd50ae43
-0, 874800, 38016, 0x5ea8d59a
-0, 878400, 38016, 0xb6d7fe63
-0, 882000, 38016, 0xe228050d
-0, 885600, 38016, 0x09e251ed
-0, 889200, 38016, 0xcea332d0
-0, 892800, 38016, 0x048838af
-0, 896400, 38016, 0x0a625a93
-0, 900000, 38016, 0x018aa719
-0, 903600, 38016, 0x630e70a8
-0, 907200, 38016, 0x93cb4c39
-0, 910800, 38016, 0x3cdb7cf8
-0, 914400, 38016, 0x48491fb4
-0, 918000, 38016, 0x06aa4101
-0, 921600, 38016, 0x4b402d3e
-0, 925200, 38016, 0x13cbf927
-0, 928800, 38016, 0xdc7528b6
-0, 932400, 38016, 0x652d0576
-0, 936000, 38016, 0xa3a504d6
-0, 939600, 38016, 0x5bd33fe4
-0, 943200, 38016, 0xae11267b
-0, 946800, 38016, 0xb58b5613
-0, 950400, 38016, 0x50160d80
-0, 954000, 38016, 0x4a643ed0
-0, 957600, 38016, 0xe3983ed6
-0, 961200, 38016, 0xa1fb3338
-0, 964800, 38016, 0x48d0286d
-0, 968400, 38016, 0x67043801
-0, 972000, 38016, 0x00bafaad
-0, 975600, 38016, 0xf07de35a
-0, 979200, 38016, 0x493e4579
-0, 982800, 38016, 0xa917532b
-0, 986400, 38016, 0x463fcc89
-0, 990000, 38016, 0xd47c1b1b
-0, 993600, 38016, 0x3543c596
-0, 997200, 38016, 0x65d6cd5b
-0, 1000800, 38016, 0x22cbd5ef
-0, 1004400, 38016, 0x08e0f250
-0, 1008000, 38016, 0x4e4aeb0a
-0, 1011600, 38016, 0x7895e0bd
-0, 1015200, 38016, 0xc11cea95
-0, 1018800, 38016, 0x13b3bcf8
-0, 1022400, 38016, 0xcb312186
-0, 1026000, 38016, 0x791007ca
-0, 1029600, 38016, 0xaa77354f
-0, 1033200, 38016, 0x1dbc2a67
-0, 1036800, 38016, 0x00646a65
-0, 1040400, 38016, 0x19db488d
-0, 1044000, 38016, 0x16c155e5
-0, 1047600, 38016, 0xb760898e
-0, 1051200, 38016, 0xbd6691e8
-0, 1054800, 38016, 0x06829781
-0, 1058400, 38016, 0xcebab8ad
-0, 1062000, 38016, 0xe2f38e79
-0, 1065600, 38016, 0x1e00c08e
-0, 1069200, 38016, 0x86d6c935
-0, 1072800, 38016, 0xaa88dfdc
-0, 1076400, 38016, 0xa9029b45
diff --git a/tests/ref/fate/h264-conformance-mr6_bt_b b/tests/ref/fate/h264-conformance-mr6_bt_b
deleted file mode 100644
index 8deff75..0000000
--- a/tests/ref/fate/h264-conformance-mr6_bt_b
+++ /dev/null
@@ -1,60 +0,0 @@
-0, 0, 36864, 0x954464be
-0, 3600, 36864, 0xace1d90b
-0, 7200, 36864, 0x8f149f03
-0, 10800, 36864, 0xea9b21eb
-0, 14400, 36864, 0xb51d9fe3
-0, 18000, 36864, 0x61bd11d7
-0, 21600, 36864, 0x9d36980f
-0, 25200, 36864, 0xa4192c5e
-0, 28800, 36864, 0x11006433
-0, 32400, 36864, 0x4a243e46
-0, 36000, 36864, 0x1807b5e8
-0, 39600, 36864, 0xbe37743c
-0, 43200, 36864, 0x82491319
-0, 46800, 36864, 0x006e9914
-0, 50400, 36864, 0xa5261884
-0, 54000, 36864, 0x2030c9d6
-0, 57600, 36864, 0xc80eb1ce
-0, 61200, 36864, 0x4d559791
-0, 64800, 36864, 0xf5f900ee
-0, 68400, 36864, 0x2cc9c0d7
-0, 72000, 36864, 0x5ba14186
-0, 75600, 36864, 0x47a46865
-0, 79200, 36864, 0x5ba180b7
-0, 82800, 36864, 0xc67c4876
-0, 86400, 36864, 0x4311d75d
-0, 90000, 36864, 0x56edb851
-0, 93600, 36864, 0x7e5aa3e0
-0, 97200, 36864, 0x8df8283a
-0, 100800, 36864, 0xb8583ddf
-0, 104400, 36864, 0xf33fb779
-0, 108000, 36864, 0xe9942ddc
-0, 111600, 36864, 0x2bc5f7fa
-0, 115200, 36864, 0xc7b66c65
-0, 118800, 36864, 0x1a524319
-0, 122400, 36864, 0xf60c6141
-0, 126000, 36864, 0x113f41f2
-0, 129600, 36864, 0xad191a31
-0, 133200, 36864, 0x3898264a
-0, 136800, 36864, 0x3c2f34a4
-0, 140400, 36864, 0xd0fc76aa
-0, 144000, 36864, 0x2870b546
-0, 147600, 36864, 0x7d326fb4
-0, 151200, 36864, 0xd7ed14e1
-0, 154800, 36864, 0x205174aa
-0, 158400, 36864, 0xa3a88be9
-0, 162000, 36864, 0xd6f01751
-0, 165600, 36864, 0x5420bb80
-0, 169200, 36864, 0xe14518f9
-0, 172800, 36864, 0x931db61e
-0, 176400, 36864, 0x052ecfae
-0, 180000, 36864, 0x29b1b0f5
-0, 183600, 36864, 0xa3057117
-0, 187200, 36864, 0x954464be
-0, 190800, 36864, 0xace1d90b
-0, 194400, 36864, 0x8f149f03
-0, 198000, 36864, 0x485722c5
-0, 201600, 36864, 0x534b18f9
-0, 205200, 36864, 0xc893a0a6
-0, 208800, 36864, 0x8b04e1dd
-0, 212400, 36864, 0xaf536964
diff --git a/tests/ref/fate/h264-conformance-mr7_bt_b b/tests/ref/fate/h264-conformance-mr7_bt_b
deleted file mode 100644
index 3d40bde..0000000
--- a/tests/ref/fate/h264-conformance-mr7_bt_b
+++ /dev/null
@@ -1,60 +0,0 @@
-0, 0, 36864, 0x579e6274
-0, 3600, 36864, 0x8650c61c
-0, 7200, 36864, 0xbc359647
-0, 10800, 36864, 0x08d91c13
-0, 14400, 36864, 0xe8b79043
-0, 18000, 36864, 0x2f16085a
-0, 21600, 36864, 0x81e89739
-0, 25200, 36864, 0xf2f324dd
-0, 28800, 36864, 0x592b5a01
-0, 32400, 36864, 0x4c2f2d91
-0, 36000, 36864, 0x8baeb610
-0, 39600, 36864, 0x86d47617
-0, 43200, 36864, 0xf11011cc
-0, 46800, 36864, 0xe56a9daa
-0, 50400, 36864, 0xd57119d6
-0, 54000, 36864, 0xe28fcde7
-0, 57600, 36864, 0x9aeeba86
-0, 61200, 36864, 0xa518a7c5
-0, 64800, 36864, 0x9af410be
-0, 68400, 36864, 0x1fedd12f
-0, 72000, 36864, 0xa8032e03
-0, 75600, 36864, 0x579e6274
-0, 79200, 36864, 0x99846ef6
-0, 82800, 36864, 0xb5ad3ca7
-0, 86400, 36864, 0x7845cb90
-0, 90000, 36864, 0x569fae24
-0, 93600, 36864, 0x8a3c9f98
-0, 97200, 36864, 0x0b7722af
-0, 100800, 36864, 0x699c2dd8
-0, 104400, 36864, 0xd477af13
-0, 108000, 36864, 0x17b62d7c
-0, 111600, 36864, 0xb1ecf6a7
-0, 115200, 36864, 0xf9c17e4c
-0, 118800, 36864, 0xe7c44618
-0, 122400, 36864, 0x7e23654e
-0, 126000, 36864, 0xd8a0457c
-0, 129600, 36864, 0x57e11df1
-0, 133200, 36864, 0xd54d2a43
-0, 136800, 36864, 0xc6f03950
-0, 140400, 36864, 0x687e750e
-0, 144000, 36864, 0x2870b546
-0, 147600, 36864, 0xda0370d0
-0, 151200, 36864, 0x5a2e0bff
-0, 154800, 36864, 0xe1f07533
-0, 158400, 36864, 0x3de892b9
-0, 162000, 36864, 0xe5c31505
-0, 165600, 36864, 0x96b8c082
-0, 169200, 36864, 0x55391423
-0, 172800, 36864, 0xc285bd71
-0, 176400, 36864, 0xf702d9f3
-0, 180000, 36864, 0x7afbadf8
-0, 183600, 36864, 0xd9b568f7
-0, 187200, 36864, 0x579e6274
-0, 190800, 36864, 0x8650c61c
-0, 194400, 36864, 0xbc359647
-0, 198000, 36864, 0x5522328c
-0, 201600, 36864, 0x02821fd6
-0, 205200, 36864, 0xb4ee9562
-0, 208800, 36864, 0xcefedb68
-0, 212400, 36864, 0xd959782e
diff --git a/tests/ref/fate/h264-conformance-mr8_bt_b b/tests/ref/fate/h264-conformance-mr8_bt_b
deleted file mode 100644
index ab35869..0000000
--- a/tests/ref/fate/h264-conformance-mr8_bt_b
+++ /dev/null
@@ -1,58 +0,0 @@
-0, 0, 36864, 0x36df68f4
-0, 3600, 36864, 0x52d4c6d9
-0, 7200, 36864, 0xad16b0be
-0, 10800, 36864, 0xf8c72556
-0, 14400, 36864, 0x70aaad30
-0, 18000, 36864, 0x53cffd5e
-0, 21600, 36864, 0xb3fa8abc
-0, 25200, 36864, 0x9c894009
-0, 28800, 36864, 0xfbc08050
-0, 32400, 36864, 0x9d5b2d65
-0, 36000, 36864, 0x3bd8bb5d
-0, 39600, 36864, 0x8d976ecf
-0, 43200, 36864, 0x25010368
-0, 46800, 36864, 0xb6e6a11c
-0, 50400, 36864, 0x595a3967
-0, 54000, 36864, 0x4fbcb9a8
-0, 57600, 36864, 0xc7c5c16b
-0, 61200, 36864, 0x661ae1eb
-0, 64800, 36864, 0x169f04a7
-0, 68400, 36864, 0xd124c93a
-0, 72000, 36864, 0x3f642dba
-0, 75600, 36864, 0xe7ad6956
-0, 79200, 36864, 0x47dc76d3
-0, 82800, 36864, 0x496a3917
-0, 86400, 36864, 0xa976d5f3
-0, 90000, 36864, 0x507bb685
-0, 93600, 36864, 0x2f61ac12
-0, 97200, 36864, 0x527818d8
-0, 100800, 36864, 0xa4983396
-0, 104400, 36864, 0x3ec9b07b
-0, 108000, 36864, 0x7db52d99
-0, 111600, 36864, 0xe974fd00
-0, 115200, 36864, 0x9c677a4f
-0, 118800, 36864, 0x108f3a05
-0, 122400, 36864, 0x23a56ba2
-0, 126000, 36864, 0x4c8d47e8
-0, 129600, 36864, 0x9e0b0f09
-0, 133200, 36864, 0x4d262b16
-0, 136800, 36864, 0x6122402e
-0, 140400, 36864, 0xed037036
-0, 144000, 36864, 0x62b3ba08
-0, 147600, 36864, 0x7f876930
-0, 151200, 36864, 0x4a6c0983
-0, 154800, 36864, 0xf9787086
-0, 158400, 36864, 0x01d1b1b5
-0, 162000, 36864, 0xc1622655
-0, 165600, 36864, 0x27e8e0f7
-0, 169200, 36864, 0xc1622655
-0, 172800, 36864, 0x12c2b7e9
-0, 176400, 36864, 0xd752d2ef
-0, 180000, 36864, 0xcbb1c3a7
-0, 183600, 36864, 0x18c56fba
-0, 187200, 36864, 0xb1b3771c
-0, 190800, 36864, 0x284ef3c4
-0, 194400, 36864, 0xda6eb5a0
-0, 198000, 36864, 0x17ad337c
-0, 201600, 36864, 0xe2801e4f
-0, 205200, 36864, 0x6c33bd17
diff --git a/tests/ref/fate/h264-conformance-mr9_bt_b b/tests/ref/fate/h264-conformance-mr9_bt_b
deleted file mode 100644
index dcf0b42..0000000
--- a/tests/ref/fate/h264-conformance-mr9_bt_b
+++ /dev/null
@@ -1,58 +0,0 @@
-0, 0, 36864, 0xb4c5642e
-0, 3600, 36864, 0x929fd05f
-0, 7200, 36864, 0x447c9b69
-0, 10800, 36864, 0xab0712da
-0, 14400, 36864, 0xd9f69216
-0, 18000, 36864, 0xec04f6dc
-0, 21600, 36864, 0x5ffa86cc
-0, 25200, 36864, 0x75122807
-0, 28800, 36864, 0x27036a2b
-0, 32400, 36864, 0x00072654
-0, 36000, 36864, 0x49fab4fd
-0, 39600, 36864, 0x975a7545
-0, 43200, 36864, 0x9b080a2f
-0, 46800, 36864, 0x78db960e
-0, 50400, 36864, 0xd7a928d4
-0, 54000, 36864, 0x0a83ba1b
-0, 57600, 36864, 0xad6bb30c
-0, 61200, 36864, 0xf6addb0d
-0, 64800, 36864, 0x00540a0a
-0, 68400, 36864, 0x049cc748
-0, 72000, 36864, 0x5b1e2291
-0, 75600, 36864, 0x2367706e
-0, 79200, 36864, 0x88ef6b11
-0, 82800, 36864, 0x85b73230
-0, 86400, 36864, 0xe46cd522
-0, 90000, 36864, 0x98489c05
-0, 93600, 36864, 0x7e439564
-0, 97200, 36864, 0x71330799
-0, 100800, 36864, 0x81a6239e
-0, 104400, 36864, 0x8005a302
-0, 108000, 36864, 0xdf132e3f
-0, 111600, 36864, 0x2a1d00de
-0, 115200, 36864, 0x7bb57e14
-0, 118800, 36864, 0xf2a637cf
-0, 122400, 36864, 0xae6f6916
-0, 126000, 36864, 0x2f1d4763
-0, 129600, 36864, 0xa4e1145e
-0, 133200, 36864, 0xc1644392
-0, 136800, 36864, 0x21853537
-0, 140400, 36864, 0x0bc45bac
-0, 144000, 36864, 0x84ccb8ee
-0, 147600, 36864, 0x65de651c
-0, 151200, 36864, 0x33ff027e
-0, 154800, 36864, 0xefe47056
-0, 158400, 36864, 0x8952b47c
-0, 162000, 36864, 0x78730fcf
-0, 165600, 36864, 0x14bae79f
-0, 169200, 36864, 0x53230fbe
-0, 172800, 36864, 0x15b0b245
-0, 176400, 36864, 0x45fbd155
-0, 180000, 36864, 0x41cfbac4
-0, 183600, 36864, 0x0d635d61
-0, 187200, 36864, 0x55aa8d3c
-0, 190800, 36864, 0x8f02fbaf
-0, 194400, 36864, 0xb17fac3f
-0, 198000, 36864, 0xc12627f9
-0, 201600, 36864, 0xa5971e4a
-0, 205200, 36864, 0x3677abfe
diff --git a/tests/ref/fate/h264-conformance-mv1_brcm_d b/tests/ref/fate/h264-conformance-mv1_brcm_d
deleted file mode 100644
index f7ce1d6..0000000
--- a/tests/ref/fate/h264-conformance-mv1_brcm_d
+++ /dev/null
@@ -1,257 +0,0 @@
-0, 0, 518400, 0x230d7aa6
-0, 3600, 518400, 0x9fc976e0
-0, 7200, 518400, 0x51052db9
-0, 10800, 518400, 0xad82d599
-0, 14400, 518400, 0xa122c6a7
-0, 18000, 518400, 0x0c3a81a0
-0, 21600, 518400, 0x6235364e
-0, 25200, 518400, 0x4d5104f8
-0, 28800, 518400, 0x09cc49b1
-0, 32400, 518400, 0xcdb05c19
-0, 36000, 518400, 0x894be6de
-0, 39600, 518400, 0x53a41fc3
-0, 43200, 518400, 0x7568ccee
-0, 46800, 518400, 0x2b5ae37b
-0, 50400, 518400, 0xd0b994bb
-0, 54000, 518400, 0x1b161358
-0, 57600, 518400, 0xc5434edc
-0, 61200, 518400, 0xc4709590
-0, 64800, 518400, 0x60c6803a
-0, 68400, 518400, 0xdff3edcd
-0, 72000, 518400, 0x8a02b8b4
-0, 75600, 518400, 0x478cf791
-0, 79200, 518400, 0x7c42fed0
-0, 82800, 518400, 0x12b1336d
-0, 86400, 518400, 0xe16e765e
-0, 90000, 518400, 0x002c291e
-0, 93600, 518400, 0x50810b53
-0, 97200, 518400, 0xda7e2453
-0, 100800, 518400, 0x6e330093
-0, 104400, 518400, 0xf30740b3
-0, 108000, 518400, 0xc27ae19d
-0, 111600, 518400, 0xe49da8c2
-0, 115200, 518400, 0xa739372c
-0, 118800, 518400, 0x4b44788c
-0, 122400, 518400, 0xfdf9e6cf
-0, 126000, 518400, 0xee205413
-0, 129600, 518400, 0x8792dc0e
-0, 133200, 518400, 0x6820d611
-0, 136800, 518400, 0x106cbc2c
-0, 140400, 518400, 0x7d8e3e92
-0, 144000, 518400, 0xbfe48709
-0, 147600, 518400, 0xc5d5a55d
-0, 151200, 518400, 0x7c234886
-0, 154800, 518400, 0x852372b0
-0, 158400, 518400, 0x43d697f9
-0, 162000, 518400, 0xc3460806
-0, 165600, 518400, 0x0600abea
-0, 169200, 518400, 0xf6e3ab0e
-0, 172800, 518400, 0x651f9a46
-0, 176400, 518400, 0xed467ba0
-0, 180000, 518400, 0x62312c3f
-0, 183600, 518400, 0xb121898d
-0, 187200, 518400, 0xb1f96406
-0, 190800, 518400, 0x78003318
-0, 194400, 518400, 0x1032b15b
-0, 198000, 518400, 0x72683d37
-0, 201600, 518400, 0xd1349f12
-0, 205200, 518400, 0x4162f707
-0, 208800, 518400, 0x894711c9
-0, 212400, 518400, 0xca37429b
-0, 216000, 518400, 0xb8e91eb5
-0, 219600, 518400, 0xe5eb3103
-0, 223200, 518400, 0x56a33cea
-0, 226800, 518400, 0x79ef0227
-0, 230400, 518400, 0x7ceaab75
-0, 234000, 518400, 0x3f4787b2
-0, 237600, 518400, 0x9e6d2abb
-0, 241200, 518400, 0xedb0cf82
-0, 244800, 518400, 0x19c8723f
-0, 248400, 518400, 0x35d8399b
-0, 252000, 518400, 0xe0224dc8
-0, 255600, 518400, 0xc95467bf
-0, 259200, 518400, 0x99662844
-0, 262800, 518400, 0x10a322c9
-0, 266400, 518400, 0xe6313d98
-0, 270000, 518400, 0x2e2a63d1
-0, 273600, 518400, 0x2c9d0715
-0, 277200, 518400, 0xf31d9e19
-0, 280800, 518400, 0xcea1f9f8
-0, 284400, 518400, 0xece1cd92
-0, 288000, 518400, 0xa8d35347
-0, 291600, 518400, 0xd8cd2228
-0, 295200, 518400, 0xe040993a
-0, 298800, 518400, 0xebc2b387
-0, 302400, 518400, 0xc3e81e85
-0, 306000, 518400, 0xcc507bc9
-0, 309600, 518400, 0xb98c4902
-0, 313200, 518400, 0x454a2a50
-0, 316800, 518400, 0x1460c5dd
-0, 320400, 518400, 0x37d7a99d
-0, 324000, 518400, 0x1de7a047
-0, 327600, 518400, 0xc7b83c21
-0, 331200, 518400, 0xe06d1c9b
-0, 334800, 518400, 0xfd8259b5
-0, 338400, 518400, 0xc3df7e1a
-0, 342000, 518400, 0x60c9ccec
-0, 345600, 518400, 0x7d163c04
-0, 349200, 518400, 0x8fc61e9d
-0, 352800, 518400, 0xa5f520e6
-0, 356400, 518400, 0x8d709ec1
-0, 360000, 518400, 0xca2b6287
-0, 363600, 518400, 0x8531bb18
-0, 367200, 518400, 0x830f9187
-0, 370800, 518400, 0x67c5d413
-0, 374400, 518400, 0x428aeecd
-0, 378000, 518400, 0xbf8e3448
-0, 381600, 518400, 0x847389f0
-0, 385200, 518400, 0x18d0b3ba
-0, 388800, 518400, 0xbee957ea
-0, 392400, 518400, 0x34941f3e
-0, 396000, 518400, 0x850e0126
-0, 399600, 518400, 0xab992409
-0, 403200, 518400, 0xb7d8d01f
-0, 406800, 518400, 0xe602576c
-0, 410400, 518400, 0x22388048
-0, 414000, 518400, 0x81ab9f4a
-0, 417600, 518400, 0xc5977820
-0, 421200, 518400, 0xc43f98bd
-0, 424800, 518400, 0xfd5e6d12
-0, 428400, 518400, 0xb9f12c73
-0, 432000, 518400, 0x44be16b9
-0, 435600, 518400, 0x32f0d9b9
-0, 439200, 518400, 0x6e9c3113
-0, 442800, 518400, 0x00618755
-0, 446400, 518400, 0x080c9955
-0, 450000, 518400, 0xb21d6096
-0, 453600, 518400, 0x51502f54
-0, 457200, 518400, 0xf062e38b
-0, 460800, 518400, 0x66f05988
-0, 464400, 518400, 0x37d569f1
-0, 468000, 518400, 0xba78ae5e
-0, 471600, 518400, 0x634a2d25
-0, 475200, 518400, 0x283e5e4a
-0, 478800, 518400, 0x9344d41c
-0, 482400, 518400, 0x1fdb5c18
-0, 486000, 518400, 0xd8139683
-0, 489600, 518400, 0xd27f555e
-0, 493200, 518400, 0x34ed517f
-0, 496800, 518400, 0x1f55ad2d
-0, 500400, 518400, 0x9a8bd368
-0, 504000, 518400, 0x9726e3bf
-0, 507600, 518400, 0xaf8945ee
-0, 511200, 518400, 0x28c20699
-0, 514800, 518400, 0x43e180c9
-0, 518400, 518400, 0x0c88e592
-0, 522000, 518400, 0xdcb8825e
-0, 525600, 518400, 0x1ec09a5e
-0, 529200, 518400, 0x149768b2
-0, 532800, 518400, 0x1eeab153
-0, 536400, 518400, 0x25666d6f
-0, 540000, 518400, 0x691cad89
-0, 543600, 518400, 0x2d9f8ced
-0, 547200, 518400, 0xd80b768d
-0, 550800, 518400, 0xe4f23a79
-0, 554400, 518400, 0xd51d0150
-0, 558000, 518400, 0x060156f4
-0, 561600, 518400, 0x800720fb
-0, 565200, 518400, 0x2a433b28
-0, 568800, 518400, 0xffc79782
-0, 572400, 518400, 0x31ba693b
-0, 576000, 518400, 0xd13c8395
-0, 579600, 518400, 0x07d9f752
-0, 583200, 518400, 0xabb81043
-0, 586800, 518400, 0xba0ee926
-0, 590400, 518400, 0xa17e7ea9
-0, 594000, 518400, 0x9d709e52
-0, 597600, 518400, 0x7fa02633
-0, 601200, 518400, 0x5cdc5217
-0, 604800, 518400, 0x888be0b0
-0, 608400, 518400, 0xe1bac436
-0, 612000, 518400, 0xa479b1b8
-0, 615600, 518400, 0xb61feb17
-0, 619200, 518400, 0xa0745cd4
-0, 622800, 518400, 0x871cffe5
-0, 626400, 518400, 0x01f7deea
-0, 630000, 518400, 0xdaf6f9f5
-0, 633600, 518400, 0xfee4849c
-0, 637200, 518400, 0xc3b9b428
-0, 640800, 518400, 0x50b4b47f
-0, 644400, 518400, 0xe8e58b82
-0, 648000, 518400, 0x7c6f94e0
-0, 651600, 518400, 0x0cfe7c08
-0, 655200, 518400, 0xb2975466
-0, 658800, 518400, 0xa1245de1
-0, 662400, 518400, 0x46ae79b7
-0, 666000, 518400, 0x8344a9b2
-0, 669600, 518400, 0x1e805013
-0, 673200, 518400, 0x19b61baf
-0, 676800, 518400, 0xd018383b
-0, 680400, 518400, 0xc9248d31
-0, 684000, 518400, 0x838ad8ec
-0, 687600, 518400, 0xa848824a
-0, 691200, 518400, 0xc6a46ebd
-0, 694800, 518400, 0x2a7c489c
-0, 698400, 518400, 0xb1db6cef
-0, 702000, 518400, 0xd24a999f
-0, 705600, 518400, 0xce47efcd
-0, 709200, 518400, 0xf3e058cb
-0, 712800, 518400, 0x25d7f6e3
-0, 716400, 518400, 0xe3daa12d
-0, 720000, 518400, 0xb3de8475
-0, 723600, 518400, 0x13efffdc
-0, 727200, 518400, 0xfb37e048
-0, 730800, 518400, 0x599a6daf
-0, 734400, 518400, 0x84bf6814
-0, 738000, 518400, 0x83c03a3f
-0, 741600, 518400, 0x3a319ae9
-0, 745200, 518400, 0x0af252c3
-0, 748800, 518400, 0xeb8f2f43
-0, 752400, 518400, 0x3bdcd421
-0, 756000, 518400, 0x9107e0f2
-0, 759600, 518400, 0x5f4fe3cf
-0, 763200, 518400, 0x38f1e8ef
-0, 766800, 518400, 0xb0359a0b
-0, 770400, 518400, 0xdddd4645
-0, 774000, 518400, 0xe14ffb0b
-0, 777600, 518400, 0x34a31c96
-0, 781200, 518400, 0x1f4406de
-0, 784800, 518400, 0x042b82b6
-0, 788400, 518400, 0x6af16a4d
-0, 792000, 518400, 0x3cfba41a
-0, 795600, 518400, 0xa054b6e8
-0, 799200, 518400, 0x2d55721b
-0, 802800, 518400, 0x55391f75
-0, 806400, 518400, 0xc2d46fa6
-0, 810000, 518400, 0x3a2576d9
-0, 813600, 518400, 0xea9ea26d
-0, 817200, 518400, 0xe2ec8962
-0, 820800, 518400, 0x47568769
-0, 824400, 518400, 0xc55e0186
-0, 828000, 518400, 0x73a44453
-0, 831600, 518400, 0xe36b1c77
-0, 835200, 518400, 0x414db365
-0, 838800, 518400, 0xfb25f7f6
-0, 842400, 518400, 0x5b4847a7
-0, 846000, 518400, 0xe96babf4
-0, 849600, 518400, 0x15edbf63
-0, 853200, 518400, 0x08a984c6
-0, 856800, 518400, 0x47ec41af
-0, 860400, 518400, 0x1912eaca
-0, 864000, 518400, 0xe058b0cc
-0, 867600, 518400, 0x03e9660b
-0, 871200, 518400, 0x85fea285
-0, 874800, 518400, 0xdf02bdd6
-0, 878400, 518400, 0xad3e6849
-0, 882000, 518400, 0x0ad866b6
-0, 885600, 518400, 0x1b994f78
-0, 889200, 518400, 0xc5916af5
-0, 892800, 518400, 0x5f66adeb
-0, 896400, 518400, 0x1c9f96a1
-0, 900000, 518400, 0xfc390832
-0, 903600, 518400, 0x0352ff56
-0, 907200, 518400, 0x6803c8f4
-0, 910800, 518400, 0x0f0b8686
-0, 914400, 518400, 0xdc3a5bce
-0, 918000, 518400, 0x96dd28d1
-0, 921600, 518400, 0x51d56824
diff --git a/tests/ref/fate/h264-conformance-nl1_sony_d b/tests/ref/fate/h264-conformance-nl1_sony_d
deleted file mode 100644
index 5528f9e..0000000
--- a/tests/ref/fate/h264-conformance-nl1_sony_d
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x3809fec3
-0, 7200, 38016, 0xf698ce3c
-0, 10800, 38016, 0x7e3da603
-0, 14400, 38016, 0x68b07d81
-0, 18000, 38016, 0xd91f717a
-0, 21600, 38016, 0x48885dd6
-0, 25200, 38016, 0x27e64e8e
-0, 28800, 38016, 0x955835ce
-0, 32400, 38016, 0xf19940a0
-0, 36000, 38016, 0x9a1c51e4
-0, 39600, 38016, 0xf59373af
-0, 43200, 38016, 0x5d6c7d06
-0, 46800, 38016, 0x32fca533
-0, 50400, 38016, 0x37e69987
-0, 54000, 38016, 0x96929e05
-0, 57600, 38016, 0xee37a1f9
diff --git a/tests/ref/fate/h264-conformance-nl2_sony_h b/tests/ref/fate/h264-conformance-nl2_sony_h
deleted file mode 100644
index 41d811f..0000000
--- a/tests/ref/fate/h264-conformance-nl2_sony_h
+++ /dev/null
@@ -1,300 +0,0 @@
-0, 0, 38016, 0xc805351d
-0, 3600, 38016, 0x320510a8
-0, 7200, 38016, 0x3ef6e4c6
-0, 10800, 38016, 0x3b94c5e0
-0, 14400, 38016, 0x4be4a689
-0, 18000, 38016, 0x70919210
-0, 21600, 38016, 0x78a07b5a
-0, 25200, 38016, 0x8bd86efc
-0, 28800, 38016, 0xe3976cab
-0, 32400, 38016, 0x77fa735e
-0, 36000, 38016, 0x62488adb
-0, 39600, 38016, 0x5b07a6a4
-0, 43200, 38016, 0x7058b15f
-0, 46800, 38016, 0xa22dc9e2
-0, 50400, 38016, 0xc9d5cae3
-0, 54000, 38016, 0x16cbd6e1
-0, 57600, 38016, 0x4b23d9e9
-0, 61200, 38016, 0x96f7d798
-0, 64800, 38016, 0xdbcdcfdd
-0, 68400, 38016, 0x9314b847
-0, 72000, 38016, 0x0a209c28
-0, 75600, 38016, 0x6c757322
-0, 79200, 38016, 0x3d1a6376
-0, 82800, 38016, 0x155f5df7
-0, 86400, 38016, 0xd4446441
-0, 90000, 38016, 0xe1006713
-0, 93600, 38016, 0x5d226a3e
-0, 97200, 38016, 0xe839790c
-0, 100800, 38016, 0xa28c8b9a
-0, 104400, 38016, 0xde469f7a
-0, 108000, 38016, 0xf800b7ad
-0, 111600, 38016, 0xf2f9ccac
-0, 115200, 38016, 0x60feeb52
-0, 118800, 38016, 0xad39fd4f
-0, 122400, 38016, 0x4075fce6
-0, 126000, 38016, 0x5f2f036e
-0, 129600, 38016, 0x3e180450
-0, 133200, 38016, 0xd806fc04
-0, 136800, 38016, 0x3f15fbc6
-0, 140400, 38016, 0xb881faa4
-0, 144000, 38016, 0xf1cafdc8
-0, 147600, 38016, 0xd881f881
-0, 151200, 38016, 0x6314fdc8
-0, 154800, 38016, 0x8fa6f0d3
-0, 158400, 38016, 0x90d0f40d
-0, 162000, 38016, 0x1d30ee93
-0, 165600, 38016, 0x87f6ecca
-0, 169200, 38016, 0xca9ae712
-0, 172800, 38016, 0x02c6eb47
-0, 176400, 38016, 0xc263f492
-0, 180000, 38016, 0x717def51
-0, 183600, 38016, 0x0d3af240
-0, 187200, 38016, 0xc232ea7d
-0, 190800, 38016, 0x3c41f195
-0, 194400, 38016, 0x5d77f7fb
-0, 198000, 38016, 0x2901fb90
-0, 201600, 38016, 0x3b35033e
-0, 205200, 38016, 0xca4d034f
-0, 208800, 38016, 0x1e730e22
-0, 212400, 38016, 0x69b60d52
-0, 216000, 38016, 0xe50107bc
-0, 219600, 38016, 0x44b6f25f
-0, 223200, 38016, 0x222ebc66
-0, 226800, 38016, 0x165b7bca
-0, 230400, 38016, 0x12a37e44
-0, 234000, 38016, 0xcce9a1dc
-0, 237600, 38016, 0x273dd1a9
-0, 241200, 38016, 0x72b00e90
-0, 244800, 38016, 0x449a4fa6
-0, 248400, 38016, 0x203d8582
-0, 252000, 38016, 0x3fa7aaeb
-0, 255600, 38016, 0x0b47d491
-0, 259200, 38016, 0x1fa70639
-0, 262800, 38016, 0xf9fe391e
-0, 266400, 38016, 0x91c6786c
-0, 270000, 38016, 0x7ab99bb2
-0, 273600, 38016, 0x73f2c0f5
-0, 277200, 38016, 0xcffad748
-0, 280800, 38016, 0xe2b0ee34
-0, 284400, 38016, 0x6025f6d6
-0, 288000, 38016, 0xd722017c
-0, 291600, 38016, 0x321f0c24
-0, 295200, 38016, 0x336f0e81
-0, 298800, 38016, 0x783a012f
-0, 302400, 38016, 0x134cf484
-0, 306000, 38016, 0xec4bf2db
-0, 309600, 38016, 0xb481012e
-0, 313200, 38016, 0x76ff026c
-0, 316800, 38016, 0xaf3b102a
-0, 320400, 38016, 0x2eaf0bd6
-0, 324000, 38016, 0x39b8f833
-0, 327600, 38016, 0xe928d7ea
-0, 331200, 38016, 0xbe7ac2f8
-0, 334800, 38016, 0x3683b5c4
-0, 338400, 38016, 0xb3559d1c
-0, 342000, 38016, 0x73fb9f71
-0, 345600, 38016, 0x3e97b5aa
-0, 349200, 38016, 0x0c9dc525
-0, 352800, 38016, 0xecead941
-0, 356400, 38016, 0x4999e247
-0, 360000, 38016, 0x11ddea7c
-0, 363600, 38016, 0x4882cf24
-0, 367200, 38016, 0xae9ac0c6
-0, 370800, 38016, 0x4f88b589
-0, 374400, 38016, 0xc677d43f
-0, 378000, 38016, 0x5f46f219
-0, 381600, 38016, 0x5c1ffa13
-0, 385200, 38016, 0x162e11a3
-0, 388800, 38016, 0xd0b631d4
-0, 392400, 38016, 0x7133441a
-0, 396000, 38016, 0xbb085604
-0, 399600, 38016, 0x54a960d2
-0, 403200, 38016, 0xc0b468e7
-0, 406800, 38016, 0xe1ef485a
-0, 410400, 38016, 0x025f27e6
-0, 414000, 38016, 0x14da215e
-0, 417600, 38016, 0xe8f2394a
-0, 421200, 38016, 0x7c7a44e8
-0, 424800, 38016, 0xdb2e54c3
-0, 428400, 38016, 0xae5c5eee
-0, 432000, 38016, 0x74ae643f
-0, 435600, 38016, 0x70146b61
-0, 439200, 38016, 0x545c5265
-0, 442800, 38016, 0xe5a92556
-0, 446400, 38016, 0xf19e04e8
-0, 450000, 38016, 0xda51e574
-0, 453600, 38016, 0x4c17ded9
-0, 457200, 38016, 0x51fce958
-0, 460800, 38016, 0xae96fd16
-0, 464400, 38016, 0x7a610e32
-0, 468000, 38016, 0x06f31a06
-0, 471600, 38016, 0x658a1998
-0, 475200, 38016, 0xda370e80
-0, 478800, 38016, 0xe7a00dca
-0, 482400, 38016, 0xb07a0810
-0, 486000, 38016, 0x193c01a3
-0, 489600, 38016, 0xa700fd8f
-0, 493200, 38016, 0x8c14ed46
-0, 496800, 38016, 0xcd81dc72
-0, 500400, 38016, 0x67acd3bb
-0, 504000, 38016, 0x662cc586
-0, 507600, 38016, 0xa09ac106
-0, 511200, 38016, 0xf1abab73
-0, 514800, 38016, 0xfd9ba674
-0, 518400, 38016, 0x7686ae41
-0, 522000, 38016, 0x7185a2e9
-0, 525600, 38016, 0x2b5898da
-0, 529200, 38016, 0x3cdd6c42
-0, 532800, 38016, 0x0299414d
-0, 536400, 38016, 0x2b851a52
-0, 540000, 38016, 0x01c8ff7b
-0, 543600, 38016, 0x55d3f715
-0, 547200, 38016, 0xbe5ff38e
-0, 550800, 38016, 0xc31fe232
-0, 554400, 38016, 0x3201dc26
-0, 558000, 38016, 0xf8feed84
-0, 561600, 38016, 0x0a471009
-0, 565200, 38016, 0xef0d351d
-0, 568800, 38016, 0x79de6f09
-0, 572400, 38016, 0xa5039be4
-0, 576000, 38016, 0x4e1cafa6
-0, 579600, 38016, 0x2a71aea1
-0, 583200, 38016, 0xa99e9d08
-0, 586800, 38016, 0x80aa8a6a
-0, 590400, 38016, 0x9f287bb9
-0, 594000, 38016, 0x2ddc5ef7
-0, 597600, 38016, 0x31843470
-0, 601200, 38016, 0x08f3074e
-0, 604800, 38016, 0xa639e58d
-0, 608400, 38016, 0xcf31d61f
-0, 612000, 38016, 0x1ac7e986
-0, 615600, 38016, 0x9bbbfe98
-0, 619200, 38016, 0x3e0d0ce1
-0, 622800, 38016, 0x53240e4c
-0, 626400, 38016, 0xda6bf0d5
-0, 630000, 38016, 0x1701c355
-0, 633600, 38016, 0x572c8b1d
-0, 637200, 38016, 0x1f4f5a14
-0, 640800, 38016, 0x0fea3e61
-0, 644400, 38016, 0xa71c29ed
-0, 648000, 38016, 0xd3b218fb
-0, 651600, 38016, 0x228e05f8
-0, 655200, 38016, 0x4b8bfa9e
-0, 658800, 38016, 0x13d505ab
-0, 662400, 38016, 0xa58808b3
-0, 666000, 38016, 0x4b2a1329
-0, 669600, 38016, 0x13c63567
-0, 673200, 38016, 0x4ece56f8
-0, 676800, 38016, 0x934f67c3
-0, 680400, 38016, 0x2b606f56
-0, 684000, 38016, 0xba481841
-0, 687600, 38016, 0x1488ea11
-0, 691200, 38016, 0x066cefeb
-0, 694800, 38016, 0xb23105b7
-0, 698400, 38016, 0x64312267
-0, 702000, 38016, 0xd0cf6a37
-0, 705600, 38016, 0xb5a482c5
-0, 709200, 38016, 0x61289957
-0, 712800, 38016, 0x26a6ba47
-0, 716400, 38016, 0xb771d25e
-0, 720000, 38016, 0xedb5de8d
-0, 723600, 38016, 0x4fd2e829
-0, 727200, 38016, 0xbef3ef1f
-0, 730800, 38016, 0x5e0ef333
-0, 734400, 38016, 0x5081f460
-0, 738000, 38016, 0x6798fe84
-0, 741600, 38016, 0x28ce0078
-0, 745200, 38016, 0x9fb4f6a1
-0, 748800, 38016, 0x0a02e822
-0, 752400, 38016, 0x5615d41e
-0, 756000, 38016, 0x1a3bc214
-0, 759600, 38016, 0x5333b48a
-0, 763200, 38016, 0x646da3c9
-0, 766800, 38016, 0x024fa1b1
-0, 770400, 38016, 0x7b4892de
-0, 774000, 38016, 0x10ab8953
-0, 777600, 38016, 0x8aa28410
-0, 781200, 38016, 0xcbd185be
-0, 784800, 38016, 0xfa49818a
-0, 788400, 38016, 0x0f7a82d5
-0, 792000, 38016, 0xb86f716d
-0, 795600, 38016, 0xd22a6050
-0, 799200, 38016, 0x89a4520e
-0, 802800, 38016, 0x8a1147cf
-0, 806400, 38016, 0xa02a4196
-0, 810000, 38016, 0xece240f7
-0, 813600, 38016, 0xa5b940ff
-0, 817200, 38016, 0x9b274ce8
-0, 820800, 38016, 0xba0b68c7
-0, 824400, 38016, 0x39f28a91
-0, 828000, 38016, 0xc070af11
-0, 831600, 38016, 0x2a26d309
-0, 835200, 38016, 0xfa9afe77
-0, 838800, 38016, 0xe2f22ebf
-0, 842400, 38016, 0xf8ee4a45
-0, 846000, 38016, 0x14186047
-0, 849600, 38016, 0xe3407152
-0, 853200, 38016, 0xcef578b8
-0, 856800, 38016, 0x3fc06964
-0, 860400, 38016, 0xa7da3ade
-0, 864000, 38016, 0xa46d1b2b
-0, 867600, 38016, 0x14abfac5
-0, 871200, 38016, 0xbffbf269
-0, 874800, 38016, 0x1d9c3ade
-0, 878400, 38016, 0xc9c39c46
-0, 882000, 38016, 0x824afa80
-0, 885600, 38016, 0xc76611b8
-0, 889200, 38016, 0x31fce0d6
-0, 892800, 38016, 0x6740a03f
-0, 896400, 38016, 0x91d63134
-0, 900000, 38016, 0xb0f6cc86
-0, 903600, 38016, 0x3d878a14
-0, 907200, 38016, 0x1d008063
-0, 910800, 38016, 0xe47cd260
-0, 914400, 38016, 0x56503400
-0, 918000, 38016, 0xb201dc61
-0, 921600, 38016, 0xba42de1b
-0, 925200, 38016, 0x9c115ccb
-0, 928800, 38016, 0xe9be47d9
-0, 932400, 38016, 0xa7684b02
-0, 936000, 38016, 0xb4d74f42
-0, 939600, 38016, 0xbe006415
-0, 943200, 38016, 0xa30c7858
-0, 946800, 38016, 0x838f7f47
-0, 950400, 38016, 0xc1c28346
-0, 954000, 38016, 0xc7737219
-0, 957600, 38016, 0xa19a5fd5
-0, 961200, 38016, 0x56a64b00
-0, 964800, 38016, 0x6b672497
-0, 968400, 38016, 0x4cfafbe2
-0, 972000, 38016, 0xbe53d51b
-0, 975600, 38016, 0x4a86acc7
-0, 979200, 38016, 0x297288b0
-0, 982800, 38016, 0xd4bd2ec9
-0, 986400, 38016, 0x3697e2f6
-0, 990000, 38016, 0xa493d289
-0, 993600, 38016, 0xb2b9e324
-0, 997200, 38016, 0x998de275
-0, 1000800, 38016, 0x422a10cb
-0, 1004400, 38016, 0x845383b4
-0, 1008000, 38016, 0xb4a72107
-0, 1011600, 38016, 0x0e0eef6b
-0, 1015200, 38016, 0xbd8bbd01
-0, 1018800, 38016, 0x2f217c45
-0, 1022400, 38016, 0xb3515be7
-0, 1026000, 38016, 0xb633a542
-0, 1029600, 38016, 0x7e7a7086
-0, 1033200, 38016, 0xef64a834
-0, 1036800, 38016, 0x7b81bdad
-0, 1040400, 38016, 0x0fc7a7d2
-0, 1044000, 38016, 0x9111351d
-0, 1047600, 38016, 0x161c43dc
-0, 1051200, 38016, 0x945fce2a
-0, 1054800, 38016, 0x48780c38
-0, 1058400, 38016, 0x28904d31
-0, 1062000, 38016, 0x140d47d5
-0, 1065600, 38016, 0x1f5e257c
-0, 1069200, 38016, 0xb36a159c
-0, 1072800, 38016, 0x85ad2465
-0, 1076400, 38016, 0x973649e0
diff --git a/tests/ref/fate/h264-conformance-nl3_sva_e b/tests/ref/fate/h264-conformance-nl3_sva_e
deleted file mode 100644
index 4664afb..0000000
--- a/tests/ref/fate/h264-conformance-nl3_sva_e
+++ /dev/null
@@ -1,33 +0,0 @@
-0, 0, 38016, 0x2fad15e2
-0, 3600, 38016, 0x7e391566
-0, 7200, 38016, 0x954001d4
-0, 10800, 38016, 0xe5ae2057
-0, 14400, 38016, 0xface3d5e
-0, 18000, 38016, 0x2b2361cd
-0, 21600, 38016, 0x5e906b5a
-0, 25200, 38016, 0xa46398e5
-0, 28800, 38016, 0x2a3ea141
-0, 32400, 38016, 0xa2a0beac
-0, 36000, 38016, 0x4830ab90
-0, 39600, 38016, 0xdd53d0fc
-0, 43200, 38016, 0x4d71ae7d
-0, 46800, 38016, 0x2290a25e
-0, 50400, 38016, 0x8baa6cca
-0, 54000, 38016, 0xc3e99458
-0, 57600, 38016, 0x5c608374
-0, 61200, 38016, 0x6443aa6c
-0, 64800, 38016, 0x1ef7991c
-0, 68400, 38016, 0xd246b49b
-0, 72000, 38016, 0xe181a026
-0, 75600, 38016, 0x878db497
-0, 79200, 38016, 0x071079c2
-0, 82800, 38016, 0xa94a62fa
-0, 86400, 38016, 0xa9da278f
-0, 90000, 38016, 0x247b3195
-0, 93600, 38016, 0xd7f81a90
-0, 97200, 38016, 0x9c303cdc
-0, 100800, 38016, 0x646e42a1
-0, 104400, 38016, 0x474a613d
-0, 108000, 38016, 0x63255932
-0, 111600, 38016, 0x2f0569e4
-0, 115200, 38016, 0x1f525192
diff --git a/tests/ref/fate/h264-conformance-nlmq1_jvc_c b/tests/ref/fate/h264-conformance-nlmq1_jvc_c
deleted file mode 100644
index e9fca86..0000000
--- a/tests/ref/fate/h264-conformance-nlmq1_jvc_c
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 38016, 0xde1a2194
-0, 3600, 38016, 0x2957f3e5
-0, 7200, 38016, 0x9df4c6cf
-0, 10800, 38016, 0xf3db9f2d
-0, 14400, 38016, 0xd97474db
-0, 18000, 38016, 0x8e3065fa
-0, 21600, 38016, 0xc0be49b1
-0, 25200, 38016, 0xa69c3f06
-0, 28800, 38016, 0x96bb2e92
-0, 32400, 38016, 0x1ca232c1
-0, 36000, 38016, 0x3a06409d
-0, 39600, 38016, 0xcdce66e5
-0, 43200, 38016, 0x96387681
-0, 46800, 38016, 0xd0309561
-0, 50400, 38016, 0xb7b08c49
-0, 54000, 38016, 0xf5709355
-0, 57600, 38016, 0x3c1594ea
-0, 61200, 38016, 0x9be48a2c
-0, 64800, 38016, 0xdf7279c3
-0, 68400, 38016, 0xe3b660f3
-0, 72000, 38016, 0xd72a3cbe
-0, 75600, 38016, 0x06a117d1
-0, 79200, 38016, 0x8f5501b7
-0, 82800, 38016, 0x8f5afd81
-0, 86400, 38016, 0x98ecfd2b
-0, 90000, 38016, 0xd0b103bf
-0, 93600, 38016, 0xb9a7035c
-0, 97200, 38016, 0x866c12c7
-0, 100800, 38016, 0x3a0329f3
-0, 104400, 38016, 0x725141c1
diff --git a/tests/ref/fate/h264-conformance-nlmq2_jvc_c b/tests/ref/fate/h264-conformance-nlmq2_jvc_c
deleted file mode 100644
index a2c7c5a..0000000
--- a/tests/ref/fate/h264-conformance-nlmq2_jvc_c
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 38016, 0xde1a2194
-0, 3600, 38016, 0x8b6cf842
-0, 7200, 38016, 0x6dc7c88b
-0, 10800, 38016, 0xdaefa55d
-0, 14400, 38016, 0x61b77631
-0, 18000, 38016, 0xfd096789
-0, 21600, 38016, 0x69204c43
-0, 25200, 38016, 0x2c8e40c0
-0, 28800, 38016, 0xa4f33298
-0, 32400, 38016, 0x67193923
-0, 36000, 38016, 0x0b634893
-0, 39600, 38016, 0x7ced69e1
-0, 43200, 38016, 0xc20179dc
-0, 46800, 38016, 0x9d4d94b9
-0, 50400, 38016, 0xf4158e1a
-0, 54000, 38016, 0xf24b986a
-0, 57600, 38016, 0x3fd39baf
-0, 61200, 38016, 0xc0f991b9
-0, 64800, 38016, 0xe3a98216
-0, 68400, 38016, 0x37246882
-0, 72000, 38016, 0xad5745b0
-0, 75600, 38016, 0x42831ea7
-0, 79200, 38016, 0x14530a1b
-0, 82800, 38016, 0x1a9f03a8
-0, 86400, 38016, 0x34f905f3
-0, 90000, 38016, 0x94300e93
-0, 93600, 38016, 0xcda00be5
-0, 97200, 38016, 0x607516d6
-0, 100800, 38016, 0xabb02c3b
-0, 104400, 38016, 0xcf3746bf
diff --git a/tests/ref/fate/h264-conformance-nrf_mw_e b/tests/ref/fate/h264-conformance-nrf_mw_e
deleted file mode 100644
index 425ee75..0000000
--- a/tests/ref/fate/h264-conformance-nrf_mw_e
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 38016, 0x3ae838ee
-0, 3600, 38016, 0x9ed7e141
-0, 7200, 38016, 0x354e83ed
-0, 10800, 38016, 0x96754ff4
-0, 14400, 38016, 0x2a013a3c
-0, 18000, 38016, 0x57ab4cf2
-0, 21600, 38016, 0x55037493
-0, 25200, 38016, 0x910b8920
-0, 28800, 38016, 0x457785a1
-0, 32400, 38016, 0x9d6864ad
-0, 36000, 38016, 0xe80131ce
-0, 39600, 38016, 0x4cd7f487
-0, 43200, 38016, 0x030df59a
-0, 46800, 38016, 0x6ea60426
-0, 50400, 38016, 0x35311f71
-0, 54000, 38016, 0x731450d8
-0, 57600, 38016, 0x29368c47
-0, 61200, 38016, 0x006292b0
-0, 64800, 38016, 0x961493b1
-0, 68400, 38016, 0xb2e99a07
-0, 72000, 38016, 0xa52f98be
-0, 75600, 38016, 0x8c0a8f70
-0, 79200, 38016, 0xdc5b992c
-0, 82800, 38016, 0xa4a49787
-0, 86400, 38016, 0x7a959608
-0, 90000, 38016, 0xc9619c0a
-0, 93600, 38016, 0xb5519a7e
-0, 97200, 38016, 0x05ea9d9b
-0, 100800, 38016, 0xf73fac90
-0, 104400, 38016, 0x0cd4b3d8
-0, 108000, 38016, 0xb3119df6
-0, 111600, 38016, 0xb8db5d78
-0, 115200, 38016, 0xfb633ee0
-0, 118800, 38016, 0xed1c8935
-0, 122400, 38016, 0x421fedd1
-0, 126000, 38016, 0xa4b84473
-0, 129600, 38016, 0x25598f81
-0, 133200, 38016, 0x92de1dd7
-0, 136800, 38016, 0x776b68c5
-0, 140400, 38016, 0x07b49a7a
-0, 144000, 38016, 0x883ccd79
-0, 147600, 38016, 0xb351e0fc
-0, 151200, 38016, 0x5577d53b
-0, 154800, 38016, 0xffd9ef7d
-0, 158400, 38016, 0x38c1fc8b
-0, 162000, 38016, 0xb9abf3e6
-0, 165600, 38016, 0x2191b0d6
-0, 169200, 38016, 0x313397a3
-0, 172800, 38016, 0x96bca02a
-0, 176400, 38016, 0xd39ac859
-0, 180000, 38016, 0xfb31e18f
-0, 183600, 38016, 0xe182b468
-0, 187200, 38016, 0x8af7dfd6
-0, 190800, 38016, 0x7c19fd4f
-0, 194400, 38016, 0xa8373bae
-0, 198000, 38016, 0x91055016
-0, 201600, 38016, 0x432b5d52
-0, 205200, 38016, 0x81301b3f
-0, 208800, 38016, 0x0d6c2367
-0, 212400, 38016, 0xf0023ac2
-0, 216000, 38016, 0xb9f33791
-0, 219600, 38016, 0xdab62201
-0, 223200, 38016, 0xfab7cfdd
-0, 226800, 38016, 0xfbb2a78f
-0, 230400, 38016, 0xe317c687
-0, 234000, 38016, 0xe4f5d939
-0, 237600, 38016, 0x022dda5b
-0, 241200, 38016, 0x8b5cdf2c
-0, 244800, 38016, 0x3dfec699
-0, 248400, 38016, 0x9484a75c
-0, 252000, 38016, 0x763a911b
-0, 255600, 38016, 0xb1fb7cc8
-0, 259200, 38016, 0x56bf7f7b
-0, 262800, 38016, 0x87567e3e
-0, 266400, 38016, 0x1aa1209e
-0, 270000, 38016, 0xe2b0da25
-0, 273600, 38016, 0xd250c706
-0, 277200, 38016, 0xbea1be9d
-0, 280800, 38016, 0x02f0e6fb
-0, 284400, 38016, 0xd18d382b
-0, 288000, 38016, 0xd0fa57f3
-0, 291600, 38016, 0x873b43e3
-0, 295200, 38016, 0x75b33855
-0, 298800, 38016, 0xcabbe932
-0, 302400, 38016, 0xeded9c0f
-0, 306000, 38016, 0x86b0b9ec
-0, 309600, 38016, 0xb461e10d
-0, 313200, 38016, 0x6702dbbe
-0, 316800, 38016, 0xb3e47c8c
-0, 320400, 38016, 0xd71333ee
-0, 324000, 38016, 0x15c3f15d
-0, 327600, 38016, 0xa7e6bb4e
-0, 331200, 38016, 0x5d5bd15b
-0, 334800, 38016, 0x2476f6b0
-0, 338400, 38016, 0xbee21b05
-0, 342000, 38016, 0x8172d7b9
-0, 345600, 38016, 0x4893b4b2
-0, 349200, 38016, 0xfda7ed23
-0, 352800, 38016, 0xc1ff4cb4
-0, 356400, 38016, 0x9fdc8cc4
diff --git a/tests/ref/fate/h264-conformance-sharp_mp_field_1_b b/tests/ref/fate/h264-conformance-sharp_mp_field_1_b
deleted file mode 100644
index 7fc503e..0000000
--- a/tests/ref/fate/h264-conformance-sharp_mp_field_1_b
+++ /dev/null
@@ -1,15 +0,0 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xa3f2e502
-0, 7200, 518400, 0xb98920a4
-0, 10800, 518400, 0xad098ec1
-0, 14400, 518400, 0x3009b7aa
-0, 18000, 518400, 0xcf514018
-0, 21600, 518400, 0xd869038d
-0, 25200, 518400, 0x3ce5e188
-0, 28800, 518400, 0x029b4c14
-0, 32400, 518400, 0xd2224afc
-0, 36000, 518400, 0xbbca027c
-0, 39600, 518400, 0x1f3fa0ac
-0, 43200, 518400, 0x823b0125
-0, 46800, 518400, 0xaaa27cfb
-0, 50400, 518400, 0x5e926a4a
diff --git a/tests/ref/fate/h264-conformance-sharp_mp_field_2_b b/tests/ref/fate/h264-conformance-sharp_mp_field_2_b
deleted file mode 100644
index ec278fa..0000000
--- a/tests/ref/fate/h264-conformance-sharp_mp_field_2_b
+++ /dev/null
@@ -1,15 +0,0 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xf0c4b44a
-0, 7200, 518400, 0x3f5dc91c
-0, 10800, 518400, 0x03dc8453
-0, 14400, 518400, 0x5e5227af
-0, 18000, 518400, 0x9e7136af
-0, 21600, 518400, 0x963a2e3a
-0, 25200, 518400, 0xa544be6c
-0, 28800, 518400, 0xefa1f63a
-0, 32400, 518400, 0x62155ff1
-0, 36000, 518400, 0x253eb857
-0, 39600, 518400, 0x73530327
-0, 43200, 518400, 0x8920c9a3
-0, 46800, 518400, 0x4bdd038c
-0, 50400, 518400, 0xea6016dd
diff --git a/tests/ref/fate/h264-conformance-sharp_mp_field_3_b b/tests/ref/fate/h264-conformance-sharp_mp_field_3_b
deleted file mode 100644
index efdd491..0000000
--- a/tests/ref/fate/h264-conformance-sharp_mp_field_3_b
+++ /dev/null
@@ -1,15 +0,0 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0x7112ac25
-0, 7200, 518400, 0x28bc28d2
-0, 10800, 518400, 0x6fc36875
-0, 14400, 518400, 0x3de99be0
-0, 18000, 518400, 0x97125499
-0, 21600, 518400, 0xb96fca3a
-0, 25200, 518400, 0x1ec56c0f
-0, 28800, 518400, 0xc65901d0
-0, 32400, 518400, 0x2baa1bfa
-0, 36000, 518400, 0x244fc6b7
-0, 39600, 518400, 0xc3536383
-0, 43200, 518400, 0xbcf40d5a
-0, 46800, 518400, 0x955f4734
-0, 50400, 518400, 0xe1b0275e
diff --git a/tests/ref/fate/h264-conformance-sharp_mp_paff_1r2 b/tests/ref/fate/h264-conformance-sharp_mp_paff_1r2
deleted file mode 100644
index 0824132..0000000
--- a/tests/ref/fate/h264-conformance-sharp_mp_paff_1r2
+++ /dev/null
@@ -1,15 +0,0 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xfb452a9c
-0, 7200, 518400, 0x2f7a35bd
-0, 10800, 518400, 0xe63e30b9
-0, 14400, 518400, 0x39628205
-0, 18000, 518400, 0x17fa1ea4
-0, 21600, 518400, 0xd5ee83e2
-0, 25200, 518400, 0x611ee98d
-0, 28800, 518400, 0x07c1eeb8
-0, 32400, 518400, 0x9dff3418
-0, 36000, 518400, 0x87cd2f56
-0, 39600, 518400, 0x88675628
-0, 43200, 518400, 0x9bb8c9a0
-0, 46800, 518400, 0xe6c1df00
-0, 50400, 518400, 0xfcaab7a7
diff --git a/tests/ref/fate/h264-conformance-sharp_mp_paff_2r b/tests/ref/fate/h264-conformance-sharp_mp_paff_2r
deleted file mode 100644
index b41a131..0000000
--- a/tests/ref/fate/h264-conformance-sharp_mp_paff_2r
+++ /dev/null
@@ -1,15 +0,0 @@
-0, 0, 518400, 0xc93c7c47
-0, 3600, 518400, 0xfb452a9c
-0, 7200, 518400, 0x2f7a35bd
-0, 10800, 518400, 0xe63e30b9
-0, 14400, 518400, 0x39628205
-0, 18000, 518400, 0x17fa1ea4
-0, 21600, 518400, 0xd5ee83e2
-0, 25200, 518400, 0x4fd6d5c9
-0, 28800, 518400, 0x8703c999
-0, 32400, 518400, 0x1a87e2d3
-0, 36000, 518400, 0xa27fc4d0
-0, 39600, 518400, 0x6effab5d
-0, 43200, 518400, 0x51ea02c9
-0, 46800, 518400, 0xbcf84c88
-0, 50400, 518400, 0x1d41076b
diff --git a/tests/ref/fate/h264-conformance-sl1_sva_b b/tests/ref/fate/h264-conformance-sl1_sva_b
deleted file mode 100644
index b218a58..0000000
--- a/tests/ref/fate/h264-conformance-sl1_sva_b
+++ /dev/null
@@ -1,33 +0,0 @@
-0, 0, 38016, 0x666c110c
-0, 3600, 38016, 0xc87421f6
-0, 7200, 38016, 0x1b74033d
-0, 10800, 38016, 0x21fe21c7
-0, 14400, 38016, 0x8f03321e
-0, 18000, 38016, 0xdbd46290
-0, 21600, 38016, 0x316a57d4
-0, 25200, 38016, 0x0a688f29
-0, 28800, 38016, 0x8bb890d5
-0, 32400, 38016, 0x4210c0a4
-0, 36000, 38016, 0x45f6b0e7
-0, 39600, 38016, 0x5feed346
-0, 43200, 38016, 0x22aea97e
-0, 46800, 38016, 0x8d96a049
-0, 50400, 38016, 0xe623654c
-0, 54000, 38016, 0xccd17c75
-0, 57600, 38016, 0x32ca7712
-0, 61200, 38016, 0x2fe49df2
-0, 64800, 38016, 0x6ee49068
-0, 68400, 38016, 0x74a0ba36
-0, 72000, 38016, 0x5079a13c
-0, 75600, 38016, 0xfd20a991
-0, 79200, 38016, 0xfc987386
-0, 82800, 38016, 0xa1f66a0b
-0, 86400, 38016, 0xd7112683
-0, 90000, 38016, 0xb60b3784
-0, 93600, 38016, 0x9e621ca3
-0, 97200, 38016, 0xd9264308
-0, 100800, 38016, 0x00db43fb
-0, 104400, 38016, 0x665a5b34
-0, 108000, 38016, 0x582050ce
-0, 111600, 38016, 0x52b95de5
-0, 115200, 38016, 0x95d8445e
diff --git a/tests/ref/fate/h264-conformance-sva_ba1_b b/tests/ref/fate/h264-conformance-sva_ba1_b
deleted file mode 100644
index 0cb825a..0000000
--- a/tests/ref/fate/h264-conformance-sva_ba1_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0x359316a1
-0, 3600, 38016, 0xd5fafa54
-0, 7200, 38016, 0xea99e9be
-0, 10800, 38016, 0xd680f3db
-0, 14400, 38016, 0x8b771545
-0, 18000, 38016, 0xff8c3073
-0, 21600, 38016, 0x543d403a
-0, 25200, 38016, 0xd2136010
-0, 28800, 38016, 0x11d17cd3
-0, 32400, 38016, 0xd8c69527
-0, 36000, 38016, 0x070d9a08
-0, 39600, 38016, 0xc8e3b21d
-0, 43200, 38016, 0xe903b09e
-0, 46800, 38016, 0x30ba9ece
-0, 50400, 38016, 0xb32482a4
-0, 54000, 38016, 0x56cf8ea3
-0, 57600, 38016, 0x0b41abd0
diff --git a/tests/ref/fate/h264-conformance-sva_ba2_d b/tests/ref/fate/h264-conformance-sva_ba2_d
deleted file mode 100644
index 90337a2..0000000
--- a/tests/ref/fate/h264-conformance-sva_ba2_d
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0x359316a1
-0, 3600, 38016, 0xd7bb1285
-0, 7200, 38016, 0x3c36059f
-0, 10800, 38016, 0x983d195f
-0, 14400, 38016, 0xba323cc5
-0, 18000, 38016, 0xc9db4f32
-0, 21600, 38016, 0xc2a06817
-0, 25200, 38016, 0x18018392
-0, 28800, 38016, 0x8b4da14c
-0, 32400, 38016, 0x5a33b0f5
-0, 36000, 38016, 0x5b48b808
-0, 39600, 38016, 0xfc13c523
-0, 43200, 38016, 0xb915c169
-0, 46800, 38016, 0xfaab94ed
-0, 50400, 38016, 0xe455786f
-0, 54000, 38016, 0x529182a8
-0, 57600, 38016, 0xfb6893a9
diff --git a/tests/ref/fate/h264-conformance-sva_base_b b/tests/ref/fate/h264-conformance-sva_base_b
deleted file mode 100644
index 56cc9c6..0000000
--- a/tests/ref/fate/h264-conformance-sva_base_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0x1c131302
-0, 3600, 38016, 0xbbca0c4f
-0, 7200, 38016, 0x81f5fd7b
-0, 10800, 38016, 0xc8990c96
-0, 14400, 38016, 0xd4c337ce
-0, 18000, 38016, 0xc4544ee1
-0, 21600, 38016, 0x5de26832
-0, 25200, 38016, 0xc1fc7ba9
-0, 28800, 38016, 0x5fea9c67
-0, 32400, 38016, 0xfa0aaf63
-0, 36000, 38016, 0xa7f6c07d
-0, 39600, 38016, 0x11a0c6ff
-0, 43200, 38016, 0xfdefc3a0
-0, 46800, 38016, 0xdb729a49
-0, 50400, 38016, 0x9b5e7f0b
-0, 54000, 38016, 0x6a047ea9
-0, 57600, 38016, 0xd8c29302
diff --git a/tests/ref/fate/h264-conformance-sva_cl1_e b/tests/ref/fate/h264-conformance-sva_cl1_e
deleted file mode 100644
index af1dbab..0000000
--- a/tests/ref/fate/h264-conformance-sva_cl1_e
+++ /dev/null
@@ -1,50 +0,0 @@
-0, 0, 38016, 0x6811161f
-0, 3600, 38016, 0x243a0d4e
-0, 7200, 38016, 0x0bc700de
-0, 10800, 38016, 0x30db1659
-0, 14400, 38016, 0xf88d3f1a
-0, 18000, 38016, 0xb37d5bd2
-0, 21600, 38016, 0x93f46c04
-0, 25200, 38016, 0xdb9878d0
-0, 28800, 38016, 0x92509f3a
-0, 32400, 38016, 0xd63badea
-0, 36000, 38016, 0xb942b664
-0, 39600, 38016, 0x703bc4ee
-0, 43200, 38016, 0xa78abfcd
-0, 46800, 38016, 0x4e1b96d8
-0, 50400, 38016, 0xaed371ac
-0, 54000, 38016, 0x2c917f89
-0, 57600, 38016, 0x57c29c96
-0, 61200, 38016, 0xaf1fb16a
-0, 64800, 38016, 0x257eb325
-0, 68400, 38016, 0x7701b0f9
-0, 72000, 38016, 0x7074c151
-0, 75600, 38016, 0x9778b1fe
-0, 79200, 38016, 0x9c2e8c0c
-0, 82800, 38016, 0x394276e9
-0, 86400, 38016, 0x2f5157bc
-0, 90000, 38016, 0xfb313ee7
-0, 93600, 38016, 0xbc6349c3
-0, 97200, 38016, 0xdca95a0c
-0, 100800, 38016, 0x53c46d45
-0, 104400, 38016, 0x62867764
-0, 108000, 38016, 0x87847fa3
-0, 111600, 38016, 0x74527d90
-0, 115200, 38016, 0x5c7a7779
-0, 118800, 38016, 0xeafd7e73
-0, 122400, 38016, 0x63aa7d06
-0, 126000, 38016, 0x2bc06fd2
-0, 129600, 38016, 0x058a7eae
-0, 133200, 38016, 0xc51a6f85
-0, 136800, 38016, 0xb49e6b0b
-0, 140400, 38016, 0x881a5997
-0, 144000, 38016, 0x5e4956b7
-0, 147600, 38016, 0x835441a0
-0, 151200, 38016, 0x212933cd
-0, 154800, 38016, 0x914031bd
-0, 158400, 38016, 0x29b63d29
-0, 162000, 38016, 0x03a03b60
-0, 165600, 38016, 0x282e1a0f
-0, 169200, 38016, 0x8964f214
-0, 172800, 38016, 0x23a9c5f9
-0, 176400, 38016, 0x04f9a780
diff --git a/tests/ref/fate/h264-conformance-sva_fm1_e b/tests/ref/fate/h264-conformance-sva_fm1_e
deleted file mode 100644
index f83a51b..0000000
--- a/tests/ref/fate/h264-conformance-sva_fm1_e
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0x1c131302
-0, 3600, 38016, 0x89dd0c15
-0, 7200, 38016, 0xaf7700bd
-0, 10800, 38016, 0x220d1115
-0, 14400, 38016, 0x76d0354e
-0, 18000, 38016, 0x9e514b93
-0, 21600, 38016, 0x20ff5e7c
-0, 25200, 38016, 0xd9cb7e01
-0, 28800, 38016, 0x26b7992d
-0, 32400, 38016, 0xa29dac84
-0, 36000, 38016, 0x407cb6e8
-0, 39600, 38016, 0xe82cc064
-0, 43200, 38016, 0x63ddb80f
-0, 46800, 38016, 0xec6f93a1
-0, 50400, 38016, 0x5f217759
-0, 54000, 38016, 0x341982ba
-0, 57600, 38016, 0x3f48980c
diff --git a/tests/ref/fate/h264-conformance-sva_nl1_b b/tests/ref/fate/h264-conformance-sva_nl1_b
deleted file mode 100644
index 074e656..0000000
--- a/tests/ref/fate/h264-conformance-sva_nl1_b
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0xb9ac19bd
-0, 3600, 38016, 0x3898fc35
-0, 7200, 38016, 0xf6f4ed19
-0, 10800, 38016, 0xc31af64b
-0, 14400, 38016, 0x42161687
-0, 18000, 38016, 0xe88133a3
-0, 21600, 38016, 0xebb5415a
-0, 25200, 38016, 0x643c62ac
-0, 28800, 38016, 0x7ad68041
-0, 32400, 38016, 0x2625981b
-0, 36000, 38016, 0x1a839bbf
-0, 39600, 38016, 0xe41db3a9
-0, 43200, 38016, 0x894eb2dd
-0, 46800, 38016, 0x4633a2a2
-0, 50400, 38016, 0xeb848787
-0, 54000, 38016, 0x23c590b0
-0, 57600, 38016, 0xc7cbaf63
diff --git a/tests/ref/fate/h264-conformance-sva_nl2_e b/tests/ref/fate/h264-conformance-sva_nl2_e
deleted file mode 100644
index 6c0a40e..0000000
--- a/tests/ref/fate/h264-conformance-sva_nl2_e
+++ /dev/null
@@ -1,17 +0,0 @@
-0, 0, 38016, 0xb9ac19bd
-0, 3600, 38016, 0x53c91566
-0, 7200, 38016, 0xb5bd089f
-0, 10800, 38016, 0xb81320bb
-0, 14400, 38016, 0x7c793dce
-0, 18000, 38016, 0x3d605b31
-0, 21600, 38016, 0x40216830
-0, 25200, 38016, 0x11c48f52
-0, 28800, 38016, 0x0f37a013
-0, 32400, 38016, 0xb06cb753
-0, 36000, 38016, 0x6233ca83
-0, 39600, 38016, 0x02b6d5a1
-0, 43200, 38016, 0xf76cc409
-0, 46800, 38016, 0xd19fa5c3
-0, 50400, 38016, 0x8d1c8a02
-0, 54000, 38016, 0x6802966d
-0, 57600, 38016, 0x107fb055
diff --git a/tests/ref/fate/id-cin-video b/tests/ref/fate/id-cin-video
deleted file mode 100644
index 174cef8..0000000
--- a/tests/ref/fate/id-cin-video
+++ /dev/null
@@ -1,105 +0,0 @@
-0, 0, 230400, 0x00000000
-1, 0, 6300, 0xdd759df8
-0, 6429, 230400, 0x3a3486b4
-1, 6429, 6300, 0x43aa398c
-0, 12857, 230400, 0xb6a9b772
-1, 12857, 6300, 0x61a7b9fd
-0, 19286, 230400, 0x8e2d4c03
-1, 19286, 6300, 0xfc8adbc8
-0, 25714, 230400, 0x5df342a9
-1, 25714, 6300, 0x84c4dffc
-0, 32143, 230400, 0x00f95cc9
-1, 32143, 6300, 0x3044ede1
-0, 38571, 230400, 0x72ee1c4c
-1, 38571, 6300, 0x6de5b64c
-0, 45000, 230400, 0x2bd991e8
-1, 45000, 6300, 0x1d9df1b0
-0, 51429, 230400, 0x84cf471e
-1, 51429, 6300, 0xb5864b86
-0, 57857, 230400, 0x75253428
-1, 57857, 6300, 0xf2f7fbc2
-0, 64286, 230400, 0x57246d42
-1, 64286, 6300, 0xe61307a8
-0, 70714, 230400, 0x57246d42
-1, 70714, 6300, 0x07fcd607
-0, 77143, 230400, 0x57246d42
-1, 77143, 6300, 0xb8dfbdf6
-0, 83571, 230400, 0x7072be1b
-1, 83571, 6300, 0xf308e40c
-0, 90000, 230400, 0x2e9ffcf2
-1, 90000, 6300, 0xa6163aa8
-0, 96429, 230400, 0x2e9ffcf2
-1, 96429, 6300, 0x3f74c286
-0, 102857, 230400, 0x1a5cb24d
-1, 102857, 6300, 0xcece754c
-0, 109286, 230400, 0x1a06c797
-1, 109286, 6300, 0x7c5b47b9
-0, 115714, 230400, 0x9e51b953
-1, 115714, 6300, 0x3a7baf37
-0, 122143, 230400, 0x9e51b953
-1, 122143, 6300, 0x56fd368e
-0, 128571, 230400, 0x9e51b953
-1, 128571, 6300, 0x68db250e
-0, 135000, 230400, 0x9e51b953
-1, 135000, 6300, 0x37d2d710
-0, 141429, 230400, 0x9e51b953
-1, 141429, 6300, 0xf458b88e
-0, 147857, 230400, 0xccd7c68d
-1, 147857, 6300, 0xed38430f
-0, 154286, 230400, 0x776da8bc
-1, 154286, 6300, 0xd5982d28
-0, 160714, 230400, 0x495bec1c
-1, 160714, 6300, 0x17465fb3
-0, 167143, 230400, 0x495bec1c
-1, 167143, 6300, 0xe4591d73
-0, 173571, 230400, 0x495bec1c
-1, 173571, 6300, 0x4cbbf957
-0, 180000, 230400, 0x495bec1c
-1, 180000, 6300, 0x4f031f50
-0, 186429, 230400, 0x495bec1c
-1, 186429, 6300, 0xc03f8ca1
-0, 192857, 230400, 0x495bec1c
-1, 192857, 6300, 0x1f0d133c
-0, 199286, 230400, 0x495bec1c
-1, 199286, 6300, 0x18dbbeb4
-0, 205714, 230400, 0xa1cae3f3
-1, 205714, 6300, 0xef3fa45f
-0, 212143, 230400, 0x5cd567eb
-1, 212143, 6300, 0x7880f935
-0, 218571, 230400, 0x57bbfe30
-1, 218571, 6300, 0x5eeca5d5
-0, 225000, 230400, 0xc7763926
-1, 225000, 6300, 0xda99accc
-0, 231429, 230400, 0xc7763926
-1, 231429, 6300, 0x90aea270
-0, 237857, 230400, 0xc7763926
-1, 237857, 6300, 0x7fc9da4e
-0, 244286, 230400, 0xc7763926
-1, 244286, 6300, 0xb64d34d4
-0, 250714, 230400, 0xc7763926
-1, 250714, 6300, 0x385ed9e7
-0, 257143, 230400, 0xc7763926
-1, 257143, 6300, 0xd2f5be45
-0, 263571, 230400, 0xc7763926
-1, 263571, 6300, 0x763fa974
-0, 270000, 230400, 0x0e68cb2f
-1, 270000, 6300, 0x5a785ec4
-0, 276429, 230400, 0x1a5d96ba
-1, 276429, 6300, 0x2877c5a5
-0, 282857, 230400, 0xff3554f4
-1, 282857, 6300, 0x667e81a5
-0, 289286, 230400, 0x74438207
-1, 289286, 6300, 0xdcfeffeb
-0, 295714, 230400, 0x488de02d
-1, 295714, 6300, 0x1aae1606
-0, 302143, 230400, 0x488de02d
-1, 302143, 6300, 0x37e0550f
-0, 308571, 230400, 0x488de02d
-1, 308571, 6300, 0x018202e9
-0, 315000, 230400, 0x488de02d
-1, 315000, 6300, 0x2b13de85
-0, 321429, 230400, 0x488de02d
-1, 321429, 6300, 0xe3bfa403
-0, 327857, 230400, 0x488de02d
-1, 327857, 6300, 0x2c5bd9c9
-0, 334286, 230400, 0x488de02d
diff --git a/tests/ref/fate/idroq-video-dpcm b/tests/ref/fate/idroq-video-dpcm
deleted file mode 100644
index cad87fe..0000000
--- a/tests/ref/fate/idroq-video-dpcm
+++ /dev/null
@@ -1,377 +0,0 @@
-1, 0, 29824, 0x77e265b7
-0, 0, 393216, 0x56995aac
-0, 3000, 393216, 0xf9ed5d6c
-0, 6000, 393216, 0xd3285d75
-0, 9000, 393216, 0x82d15d62
-0, 12000, 393216, 0x893e5d6f
-0, 15000, 393216, 0x82d15d62
-0, 18000, 393216, 0x893e5d6f
-0, 21000, 393216, 0x82d15d62
-0, 24000, 393216, 0x893e5d6f
-0, 27000, 393216, 0x82d15d62
-0, 30000, 393216, 0x893e5d6f
-1, 30433, 2944, 0x8dcdf50b
-0, 33000, 393216, 0x82d15d62
-1, 33437, 2944, 0xb135cd2a
-0, 36000, 393216, 0x893e5d6f
-1, 36441, 2944, 0x54a6e73f
-0, 39000, 393216, 0x82d15d62
-1, 39445, 2944, 0x050ccd4e
-0, 42000, 393216, 0x893e5d6f
-1, 42449, 2944, 0x6b68db44
-0, 45000, 393216, 0x82d15d62
-1, 45453, 2944, 0x55d1f308
-0, 48000, 393216, 0x2ae39eca
-1, 48457, 2944, 0x7e92f50b
-0, 51000, 393216, 0x9254be70
-1, 51461, 2944, 0xe9e91eed
-0, 54000, 393216, 0x4b2ed384
-1, 54465, 2944, 0x80af2ce0
-0, 57000, 393216, 0xbbd9d8f7
-1, 57469, 2944, 0xc67ffb07
-0, 60000, 393216, 0x1f2be0c3
-1, 60473, 2944, 0x7aaded27
-0, 63000, 393216, 0x2434eb25
-1, 63478, 2944, 0x14a024fd
-0, 66000, 393216, 0xa6cced4e
-1, 66482, 2944, 0x26e8df1f
-0, 69000, 393216, 0xd116f38b
-1, 69486, 2944, 0x2688df44
-0, 72000, 393216, 0x6b86f380
-1, 72490, 2944, 0x4b9cdd33
-0, 75000, 393216, 0xc1b3f8e9
-1, 75494, 2944, 0x10c2f11c
-0, 78000, 393216, 0x2993fd5d
-1, 78498, 2944, 0xc4e3ad6d
-0, 81000, 393216, 0xf489fe18
-1, 81502, 2944, 0xbeb1a78e
-0, 84000, 393216, 0x9ef10501
-1, 84506, 2944, 0x283d4e7f
-0, 87000, 393216, 0x8faf0512
-1, 87510, 2944, 0x4acf65e0
-0, 90000, 393216, 0xa54d0736
-1, 90514, 2944, 0x0ca29b8c
-0, 93000, 393216, 0xf4ef01e0
-1, 93518, 2944, 0x003fae34
-0, 96000, 393216, 0xe241ef51
-1, 96522, 2944, 0x2acfec7e
-0, 99000, 393216, 0xcc38e51f
-1, 99527, 2944, 0xea6fc6fe
-0, 102000, 393216, 0xb1345876
-1, 102531, 2944, 0xf5daec2f
-0, 105000, 393216, 0xf9b0968b
-1, 105535, 2944, 0x8d33ed7a
-0, 108000, 393216, 0x6bb1523f
-1, 108539, 2944, 0xc328f984
-0, 111000, 393216, 0x83469a05
-1, 111543, 2944, 0x6e0b58d3
-0, 114000, 393216, 0x73e30882
-1, 114547, 2944, 0xe282dc3f
-0, 117000, 393216, 0x8673da66
-1, 117551, 2944, 0xbf9bf3e6
-0, 120000, 393216, 0xb67596d3
-1, 120555, 2944, 0xd7b7d7e3
-0, 123000, 393216, 0xf7638710
-1, 123559, 2944, 0x4e87b6ab
-0, 126000, 393216, 0x813a8f47
-1, 126563, 2944, 0x7b8ce8d6
-0, 129000, 393216, 0xb3526555
-1, 129567, 2944, 0xd42991a5
-0, 132000, 393216, 0x1b167be3
-1, 132571, 2944, 0x452c98ca
-0, 135000, 393216, 0x99114562
-1, 135576, 2944, 0x6d27832d
-0, 138000, 393216, 0xfafb0693
-1, 138580, 2944, 0xa558720e
-0, 141000, 393216, 0x121d96c8
-1, 141584, 2944, 0x0a31bec0
-0, 144000, 393216, 0xb3c68c5d
-1, 144588, 2944, 0x28431384
-0, 147000, 393216, 0x2035b97f
-1, 147592, 2944, 0xd5e9fb3d
-0, 150000, 393216, 0xfbcaeb62
-1, 150596, 2944, 0x34f0e9f8
-0, 153000, 393216, 0xfd5aea5d
-1, 153600, 2944, 0x979432df
-0, 156000, 393216, 0x66efbddd
-1, 156604, 2944, 0xb00acd4d
-0, 159000, 393216, 0xf1e17862
-1, 159608, 2944, 0x726bffd6
-0, 162000, 393216, 0x27fa584d
-1, 162612, 2944, 0xa1f39a6d
-0, 165000, 393216, 0xe644ec5f
-1, 165616, 2944, 0xf6a8e30e
-0, 168000, 393216, 0x7e3067ba
-1, 168620, 2944, 0x608e9e06
-0, 171000, 393216, 0x1b6ba6fd
-1, 171624, 2944, 0x4ec58bc3
-0, 174000, 393216, 0x55bdba34
-1, 174629, 2944, 0x6d5c8458
-0, 177000, 393216, 0xc67db2e4
-1, 177633, 2944, 0x76a0abbd
-0, 180000, 393216, 0x359de8a2
-1, 180637, 2944, 0xf830e8a6
-0, 183000, 393216, 0x7b7a32ef
-1, 183641, 2944, 0x1bdd7bec
-0, 186000, 393216, 0xbe512a66
-1, 186645, 2944, 0x3c1bd187
-0, 189000, 393216, 0x681d82bf
-1, 189649, 2944, 0xf52cf697
-0, 192000, 393216, 0xa2320ec5
-1, 192653, 2944, 0x8f65b773
-0, 195000, 393216, 0xcfbd9954
-1, 195657, 2944, 0xf8b5b598
-0, 198000, 393216, 0x7fee9854
-1, 198661, 2944, 0xcd87d5ed
-0, 201000, 393216, 0x70eec155
-1, 201665, 2944, 0x672ac02a
-0, 204000, 393216, 0x114f684e
-1, 204669, 2944, 0x1d5d13ed
-0, 207000, 393216, 0xe27f034f
-1, 207673, 2944, 0xe298e3d4
-0, 210000, 393216, 0xfbbd89b4
-1, 210678, 2944, 0x3d2e9c32
-0, 213000, 393216, 0xcef4c58a
-1, 213682, 2944, 0xf3a39259
-0, 216000, 393216, 0x9eea88e9
-1, 216686, 2944, 0x930ae8f8
-0, 219000, 393216, 0x911cea42
-1, 219690, 2944, 0x8562aff7
-0, 222000, 393216, 0xec5727ea
-1, 222694, 2944, 0x9cd6c6a7
-0, 225000, 393216, 0xda998c33
-1, 225698, 2944, 0x2709dc5c
-0, 228000, 393216, 0xc82140ed
-1, 228702, 2944, 0xcbe31816
-0, 231000, 393216, 0x4caa8591
-1, 231706, 2944, 0xd7876ec4
-0, 234000, 393216, 0x4944206c
-1, 234710, 2944, 0xc2468b6a
-0, 237000, 393216, 0xd4676a94
-1, 237714, 2944, 0x76043e84
-0, 240000, 393216, 0x9e0340b3
-1, 240718, 2944, 0xd2c35bf0
-0, 243000, 393216, 0xbdef7f94
-1, 243722, 2944, 0x63de6061
-0, 246000, 393216, 0xfac05cb0
-1, 246727, 2944, 0xd8f6ed1d
-0, 249000, 393216, 0xfef5a369
-1, 249731, 2944, 0xe034928a
-0, 252000, 393216, 0x9fcb3711
-1, 252735, 2944, 0xa044da74
-0, 255000, 393216, 0x6d93f761
-1, 255739, 2944, 0xee410dba
-0, 258000, 393216, 0xe95dc1ae
-1, 258743, 2944, 0x8e020c7c
-0, 261000, 393216, 0x3e561557
-1, 261747, 2944, 0x73057ddb
-0, 264000, 393216, 0x0fa7a049
-1, 264751, 2944, 0xdee5cc18
-0, 267000, 393216, 0xf16afb95
-1, 267755, 2944, 0xf4d31dec
-0, 270000, 393216, 0xe53a2064
-1, 270759, 2944, 0xe8131e1c
-0, 273000, 393216, 0x57f046a4
-1, 273763, 2944, 0x8ae69c95
-0, 276000, 393216, 0xf6f16a0c
-1, 276767, 2944, 0x791c0bf4
-0, 279000, 393216, 0xcba0c8b0
-1, 279771, 2944, 0xd45a10db
-0, 282000, 393216, 0x5bdbe522
-1, 282776, 2944, 0x3a72b010
-0, 285000, 393216, 0x0fed0151
-1, 285780, 2944, 0x6a4a0411
-0, 288000, 393216, 0xbf86faf8
-1, 288784, 2944, 0xd77ab7f5
-0, 291000, 393216, 0x39854c5f
-1, 291788, 2944, 0xe3bf4fe5
-0, 294000, 393216, 0xd9b7760a
-1, 294792, 2944, 0x12db1be8
-0, 297000, 393216, 0x8edcc1d9
-1, 297796, 2944, 0x345210b0
-0, 300000, 393216, 0x44ae1435
-1, 300800, 2944, 0xcfc1f892
-0, 303000, 393216, 0xbc3d6d73
-1, 303804, 2944, 0x5b0a80bb
-0, 306000, 393216, 0xedd82647
-1, 306808, 2944, 0x31ab1168
-0, 309000, 393216, 0x1c2e5ce3
-1, 309812, 2944, 0xd4a4bb0a
-0, 312000, 393216, 0x04e29afe
-1, 312816, 2944, 0x8e211c8f
-0, 315000, 393216, 0xb191578e
-1, 315820, 2944, 0xcf464d50
-0, 318000, 393216, 0x31d75a06
-1, 318824, 2944, 0xe74ff3d6
-0, 321000, 393216, 0xfdb6c56e
-1, 321829, 2944, 0x6274635f
-0, 324000, 393216, 0xf528f484
-1, 324833, 2944, 0xc34c9f64
-0, 327000, 393216, 0x87af758e
-1, 327837, 2944, 0xbb997537
-0, 330000, 393216, 0xc8bdafb7
-1, 330841, 2944, 0x3600da72
-0, 333000, 393216, 0x573afe93
-1, 333845, 2944, 0x343e15f4
-0, 336000, 393216, 0xb03cb8f5
-1, 336849, 2944, 0x17bc58a8
-0, 339000, 393216, 0x6e03ac71
-1, 339853, 2944, 0x3dcbd3ff
-0, 342000, 393216, 0xf919164e
-1, 342857, 2944, 0x1d422371
-0, 345000, 393216, 0x80059f3c
-1, 345861, 2944, 0xe2b83d9d
-0, 348000, 393216, 0xf4ea0b1a
-1, 348865, 2944, 0x65388409
-0, 351000, 393216, 0xe7720ffb
-1, 351869, 2944, 0xafbca269
-0, 354000, 393216, 0x1ec0cd56
-1, 354873, 2944, 0x2d00c0fb
-0, 357000, 393216, 0x2bc8cf18
-1, 357878, 2944, 0xbac9c503
-0, 360000, 393216, 0xe0bf17b5
-1, 360882, 2944, 0x9990768d
-0, 363000, 393216, 0x660247e1
-1, 363886, 2944, 0x8ba978be
-0, 366000, 393216, 0xcf66f2a9
-1, 366890, 2944, 0x5a44a2f5
-0, 369000, 393216, 0x5494d5ab
-1, 369894, 2944, 0xa4b6f3b8
-0, 372000, 393216, 0x2c02f2c4
-1, 372898, 2944, 0x631b6b9f
-0, 375000, 393216, 0x93fa3783
-1, 375902, 2944, 0x4c840923
-0, 378000, 393216, 0x4cc50633
-1, 378906, 2944, 0x7c105df3
-0, 381000, 393216, 0x3f179386
-1, 381910, 2944, 0x01bcb213
-0, 384000, 393216, 0x2bca9e1b
-1, 384914, 2944, 0x95cffbf7
-0, 387000, 393216, 0x3e4af867
-1, 387918, 2944, 0x170a9c3a
-0, 390000, 393216, 0x7e7df93c
-1, 390922, 2944, 0x59e09d61
-0, 393000, 393216, 0x577e4fb0
-1, 393927, 2944, 0x3ea0f205
-0, 396000, 393216, 0x34487f0a
-1, 396931, 2944, 0xd9ea1a3a
-0, 399000, 393216, 0x0937bcfc
-1, 399935, 2944, 0xaf32d704
-0, 402000, 393216, 0xa9e75a5e
-1, 402939, 2944, 0x2d473392
-0, 405000, 393216, 0xf7bc0c89
-1, 405943, 2944, 0x2a8ec544
-0, 408000, 393216, 0x06dacca6
-1, 408947, 2944, 0x883c8838
-0, 411000, 393216, 0x7baaa4bd
-1, 411951, 2944, 0xfaf4d789
-0, 414000, 393216, 0x95477f5f
-1, 414955, 2944, 0xcb315b65
-0, 417000, 393216, 0x51117526
-1, 417959, 2944, 0x980c93b0
-0, 420000, 393216, 0x69656d03
-1, 420963, 2944, 0x0819583b
-0, 423000, 393216, 0xcbd061bb
-1, 423967, 2944, 0xf126e5b5
-0, 426000, 393216, 0x8d1d5be2
-1, 426971, 2944, 0x88836255
-0, 429000, 393216, 0x43e55930
-1, 429976, 2944, 0xc8ae8ca8
-0, 432000, 393216, 0xb56f5872
-1, 432980, 2944, 0xf0750551
-0, 435000, 393216, 0x09a255e9
-1, 435984, 2944, 0x3dfe13a3
-0, 438000, 393216, 0xcaaa5456
-1, 438988, 2944, 0xf2aa957b
-0, 441000, 393216, 0xd267501f
-1, 441992, 2944, 0xa77b79a3
-0, 444000, 393216, 0x7bef4eca
-1, 444996, 2944, 0xb1038284
-0, 447000, 393216, 0x9aa94af3
-1, 448000, 2944, 0xf96be3ba
-0, 450000, 393216, 0xd39d4a29
-1, 451004, 2944, 0x1ae6e293
-0, 453000, 393216, 0x7a754960
-1, 454008, 2944, 0x2059d020
-0, 456000, 393216, 0x3f004921
-1, 457012, 2944, 0x7e6c9996
-0, 459000, 393216, 0x0f784ca8
-1, 460016, 2944, 0x3108b540
-0, 462000, 393216, 0x2a062c70
-1, 463020, 2944, 0x75133155
-0, 465000, 393216, 0x114ef770
-1, 466024, 2944, 0x59a19226
-0, 468000, 393216, 0xfb7673bf
-1, 469029, 2944, 0x3140c138
-0, 471000, 393216, 0xbaea88f7
-1, 472033, 2944, 0x7570d3be
-0, 474000, 393216, 0x6fdfe2ec
-1, 475037, 2944, 0x54fd4ff6
-0, 477000, 393216, 0xb7b2b398
-1, 478041, 2944, 0x23bcf6dc
-0, 480000, 393216, 0x14ba127e
-1, 481045, 2944, 0x2d26489b
-0, 483000, 393216, 0x660b3041
-1, 484049, 2944, 0x4b37bf13
-0, 486000, 393216, 0xe3f3302a
-1, 487053, 2944, 0x12812ec9
-0, 489000, 393216, 0x34c7f1c9
-1, 490057, 2944, 0xc4a609dd
-0, 492000, 393216, 0xa8257bf4
-1, 493061, 2944, 0x5a8c5b20
-0, 495000, 393216, 0xd63fc649
-1, 496065, 2944, 0xd05d110f
-0, 498000, 393216, 0xf8e5b79c
-1, 499069, 2944, 0xceea6f1f
-0, 501000, 393216, 0xa67b52ab
-1, 502073, 2944, 0x4033b0a5
-0, 504000, 393216, 0xef8f9c74
-1, 505078, 2944, 0x101895ce
-0, 507000, 393216, 0x6d3aa6b6
-1, 508082, 2944, 0xd6c6809f
-0, 510000, 393216, 0x8c174ee6
-1, 511086, 2944, 0x197bda7e
-0, 513000, 393216, 0x2dfbc524
-1, 514090, 2944, 0x96fb3e4b
-0, 516000, 393216, 0x7d0808b6
-1, 517094, 2944, 0x12a6e3de
-0, 519000, 393216, 0x6cbdf6f5
-1, 520098, 2944, 0xfb80e466
-0, 522000, 393216, 0xfe39bc53
-1, 523102, 2944, 0xedb8c2fc
-0, 525000, 393216, 0xa3d869b0
-1, 526106, 1016, 0x30e56ca5
-0, 528000, 393216, 0x09f00057
-0, 531000, 393216, 0x6ba56343
-0, 534000, 393216, 0xb696ca3e
-0, 537000, 393216, 0x4eba0225
-0, 540000, 393216, 0xdd45464b
-0, 543000, 393216, 0x2909a9ea
-0, 546000, 393216, 0x12aa3f85
-0, 549000, 393216, 0x59421352
-0, 552000, 393216, 0x57ea0313
-0, 555000, 393216, 0x4e5f3a38
-0, 558000, 393216, 0x55bc932d
-0, 561000, 393216, 0x666ee55d
-0, 564000, 393216, 0xb0f84a69
-0, 567000, 393216, 0xad3ae63f
-0, 570000, 393216, 0x970fd47d
-0, 573000, 393216, 0x86c418e0
-0, 576000, 393216, 0x52c9ce50
-0, 579000, 393216, 0xd54c98c8
-0, 582000, 393216, 0xb40e5fea
-0, 585000, 393216, 0x2aa74875
-0, 588000, 393216, 0x305b251e
-0, 591000, 393216, 0xab8c0780
-0, 594000, 393216, 0x0101dd0e
-0, 597000, 393216, 0x23739cab
-0, 600000, 393216, 0xf05196a0
-0, 603000, 393216, 0x932d1e00
-0, 606000, 393216, 0x932d1e00
-0, 609000, 393216, 0x932d1e00
-0, 612000, 393216, 0x932d1e00
-0, 615000, 393216, 0x932d1e00
-0, 618000, 393216, 0x932d1e00
-0, 621000, 393216, 0x932d1e00
-0, 624000, 393216, 0x932d1e00
-0, 627000, 393216, 0x932d1e00
diff --git a/tests/ref/fate/idroq-video-encode b/tests/ref/fate/idroq-video-encode
deleted file mode 100644
index 4c89de8..0000000
--- a/tests/ref/fate/idroq-video-encode
+++ /dev/null
@@ -1 +0,0 @@
-75df9ce475c1b185fc3dbc219596edd3
diff --git a/tests/ref/fate/iff-byterun1 b/tests/ref/fate/iff-byterun1
deleted file mode 100644
index 8620c86..0000000
--- a/tests/ref/fate/iff-byterun1
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 230400, 0x35e51c62
diff --git a/tests/ref/fate/iff-fibonacci b/tests/ref/fate/iff-fibonacci
deleted file mode 100644
index e452f31..0000000
--- a/tests/ref/fate/iff-fibonacci
+++ /dev/null
@@ -1 +0,0 @@
-e968a853779bb6438339e3b8d69d8d24
diff --git a/tests/ref/fate/iff-ilbm b/tests/ref/fate/iff-ilbm
deleted file mode 100644
index eb253a0..0000000
--- a/tests/ref/fate/iff-ilbm
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 230400, 0x0929e342
diff --git a/tests/ref/fate/iff-pcm b/tests/ref/fate/iff-pcm
deleted file mode 100644
index cffcc57..0000000
--- a/tests/ref/fate/iff-pcm
+++ /dev/null
@@ -1 +0,0 @@
-6dc1329541393525a60fd6b9782573f5
diff --git a/tests/ref/fate/indeo2 b/tests/ref/fate/indeo2
deleted file mode 100644
index 49fabb4..0000000
--- a/tests/ref/fate/indeo2
+++ /dev/null
@@ -1,130 +0,0 @@
-0, 0, 21600, 0x57a2ba42
-0, 6000, 21600, 0x61e09615
-0, 12000, 21600, 0x826e4e63
-0, 18000, 21600, 0x107716ec
-0, 24000, 21600, 0xb35ce1f4
-0, 30000, 21600, 0x12cab085
-0, 36000, 21600, 0x2f917f69
-0, 42000, 21600, 0x25aa3d6e
-0, 48000, 21600, 0xab1bfbed
-0, 54000, 21600, 0x9936dff9
-0, 60000, 21600, 0xc23cd8e5
-0, 66000, 21600, 0xa7ebbcaa
-0, 72000, 21600, 0xd4dda045
-0, 78000, 21600, 0xcbce6d7d
-0, 84000, 21600, 0x3cf35baf
-0, 90000, 21600, 0x16de6008
-0, 96000, 21600, 0x49d41acf
-0, 102001, 21600, 0x8c630034
-0, 108001, 21600, 0x0b310296
-0, 114001, 21600, 0x4887067d
-0, 120001, 21600, 0x1219f29e
-0, 126001, 21600, 0x3f3fc0c8
-0, 132001, 21600, 0x1bd1d0fc
-0, 138001, 21600, 0x913f9d4c
-0, 144001, 21600, 0x69e9a6b4
-0, 150001, 21600, 0xcc2e917f
-0, 156001, 21600, 0xf6967e30
-0, 162001, 21600, 0xdf816593
-0, 168001, 21600, 0xfd945b75
-0, 174001, 21600, 0x7d7e0224
-0, 180001, 21600, 0x7246f584
-0, 186001, 21600, 0x07b7ce82
-0, 192001, 21600, 0xee16c291
-0, 198001, 21600, 0xf4efb53a
-0, 204001, 21600, 0x2e73a208
-0, 210001, 21600, 0x1c2b6068
-0, 216001, 21600, 0x004250de
-0, 222001, 21600, 0x61d957d9
-0, 228001, 21600, 0x8b5d2cb0
-0, 234001, 21600, 0xc0a91fbc
-0, 240001, 21600, 0xa38108fc
-0, 246001, 21600, 0x551f03b9
-0, 252001, 21600, 0x93def5ca
-0, 258001, 21600, 0xe8ecf8bb
-0, 264001, 21600, 0x4c04fbb0
-0, 270001, 21600, 0x0e41dae4
-0, 276001, 21600, 0xca9fb0df
-0, 282001, 21600, 0xb123af19
-0, 288001, 21600, 0xfd59be7a
-0, 294001, 21600, 0x2c88b7a6
-0, 300002, 21600, 0x64cc9a1f
-0, 306002, 21600, 0x73d6a9ba
-0, 312002, 21600, 0x79198a11
-0, 318002, 21600, 0x0d4a8610
-0, 324002, 21600, 0x352e71bc
-0, 330002, 21600, 0x08aa627e
-0, 336002, 21600, 0xbee36e45
-0, 342002, 21600, 0x30de5c1b
-0, 348002, 21600, 0x21d75484
-0, 354002, 21600, 0xe0e91d52
-0, 360002, 21600, 0x678c2ebb
-0, 366002, 21600, 0x2080397b
-0, 372002, 21600, 0x7dbc1333
-0, 378002, 21600, 0x9c730ad0
-0, 384002, 21600, 0x4da50f55
-0, 390002, 21600, 0xdde5eaa7
-0, 396002, 21600, 0x949ed4fa
-0, 402002, 21600, 0x5d63bc54
-0, 408002, 21600, 0xc5dcba4f
-0, 414002, 21600, 0xd68caee1
-0, 420002, 21600, 0xf7409fc9
-0, 426002, 21600, 0x6b0ca3e5
-0, 432002, 21600, 0xd133a108
-0, 438002, 21600, 0xf2687b81
-0, 444002, 21600, 0x6e94645d
-0, 450002, 21600, 0xff7e7524
-0, 456002, 21600, 0x8c7255dd
-0, 462002, 21600, 0x84e979cf
-0, 468002, 21600, 0xaa4e7127
-0, 474002, 21600, 0x0b56708c
-0, 480002, 21600, 0x38f086c4
-0, 486002, 21600, 0x6a7086f6
-0, 492002, 21600, 0x57a3619d
-0, 498002, 21600, 0xee27639a
-0, 504003, 21600, 0x754b7ec6
-0, 510003, 21600, 0x2f7b428c
-0, 516003, 21600, 0x0dc94603
-0, 522003, 21600, 0xeede54d8
-0, 528003, 21600, 0x587b4725
-0, 534003, 21600, 0xe7c72c7a
-0, 540003, 21600, 0x523949cb
-0, 546003, 21600, 0xeade5385
-0, 552003, 21600, 0x1a8f45c8
-0, 558003, 21600, 0x814a393c
-0, 564003, 21600, 0xe7b34887
-0, 570003, 21600, 0x8eef3f5f
-0, 576003, 21600, 0x56f12f08
-0, 582003, 21600, 0xb2d02448
-0, 588003, 21600, 0xb7d936db
-0, 594003, 21600, 0x45f726ab
-0, 600003, 21600, 0x6012404d
-0, 606003, 21600, 0x273c254e
-0, 612003, 21600, 0x38e82c19
-0, 618003, 21600, 0x73653274
-0, 624003, 21600, 0x2ff63b0c
-0, 630003, 21600, 0x96d03611
-0, 636003, 21600, 0xee8c29d7
-0, 642003, 21600, 0xac043199
-0, 648003, 21600, 0xd2c741a7
-0, 654003, 21600, 0xdc7b2b81
-0, 660003, 21600, 0x376f438f
-0, 666003, 21600, 0x55442ff7
-0, 672003, 21600, 0x653b1472
-0, 678003, 21600, 0xc4293779
-0, 684003, 21600, 0xc6553740
-0, 690003, 21600, 0xcf441053
-0, 696003, 21600, 0xb1531bce
-0, 702004, 21600, 0x145323b3
-0, 708004, 21600, 0x916c2e9e
-0, 714004, 21600, 0xb89bfecc
-0, 720004, 21600, 0x8e2415b9
-0, 726004, 21600, 0x5af23021
-0, 732004, 21600, 0x53e81c10
-0, 738004, 21600, 0xf7f82a6f
-0, 744004, 21600, 0x851121a2
-0, 750004, 21600, 0xa8432bd2
-0, 756004, 21600, 0x1a381799
-0, 762004, 21600, 0xbb761384
-0, 768004, 21600, 0xc8f328d5
-0, 774004, 21600, 0xb3742e8a
diff --git a/tests/ref/fate/indeo3 b/tests/ref/fate/indeo3
deleted file mode 100644
index ee34b27..0000000
--- a/tests/ref/fate/indeo3
+++ /dev/null
@@ -1,40 +0,0 @@
-0, 0, 21600, 0x845098fc
-0, 9000, 21600, 0xc28e8bf0
-0, 18000, 21600, 0x2f418fb4
-0, 27000, 21600, 0x051d7a0e
-0, 36000, 21600, 0x1b36aa7c
-0, 45000, 21600, 0xb9e2ad38
-0, 54000, 21600, 0x8dc99b60
-0, 63000, 21600, 0xa3fa789a
-0, 72000, 21600, 0x1fdbade2
-0, 81000, 21600, 0x4f4ac164
-0, 90000, 21600, 0x0ea5cb50
-0, 99000, 21600, 0xfb659528
-0, 108000, 21600, 0xac5790f8
-0, 117000, 21600, 0x9762beb4
-0, 126000, 21600, 0x29b0da0a
-0, 135000, 21600, 0x6d88b0da
-0, 144000, 21600, 0x687b8efa
-0, 153000, 21600, 0xcd726220
-0, 162000, 21600, 0xa1766598
-0, 171000, 21600, 0xff4b8074
-0, 180000, 21600, 0x845098fc
-0, 189000, 21600, 0xdb259e08
-0, 198000, 21600, 0xb6bda5a0
-0, 207000, 21600, 0xbb998962
-0, 216000, 21600, 0x28aa7b7c
-0, 225000, 21600, 0x1ad1a15c
-0, 234000, 21600, 0xb535a128
-0, 243000, 21600, 0x4dbf968a
-0, 252000, 21600, 0xfe90a8d6
-0, 261000, 21600, 0xf63fabf0
-0, 270000, 21600, 0xd6fabe58
-0, 279000, 21600, 0x172eb09c
-0, 288000, 21600, 0x44f8a8fe
-0, 297000, 21600, 0x29429a06
-0, 306000, 21600, 0xb12f8cc4
-0, 315000, 21600, 0xd0c78cb4
-0, 324000, 21600, 0x97e17e0c
-0, 333000, 21600, 0xf8ac6700
-0, 342000, 21600, 0xf9c17c94
-0, 351000, 21600, 0xb10e8c54
diff --git a/tests/ref/fate/indeo5 b/tests/ref/fate/indeo5
deleted file mode 100644
index 73fe74c..0000000
--- a/tests/ref/fate/indeo5
+++ /dev/null
@@ -1,134 +0,0 @@
-0, 0, 48600, 0x72d4193b
-0, 6000, 48600, 0x72d4193b
-0, 12000, 48600, 0x36abd6f3
-0, 18000, 48600, 0x99e582f7
-0, 24000, 48600, 0xa4cb6fb7
-0, 30000, 48600, 0xf9b5657b
-0, 36000, 48600, 0xb7d666a4
-0, 42000, 48600, 0xb7345308
-0, 48000, 48600, 0x4f5339b9
-0, 54000, 48600, 0x1a9a02c7
-0, 60000, 48600, 0x4ed40866
-0, 66000, 48600, 0x635bf2af
-0, 72000, 48600, 0x12c02f49
-0, 78000, 48600, 0xc548a36d
-0, 84000, 48600, 0x9d9ffbf0
-0, 90000, 48600, 0x4f9dba66
-0, 96000, 48600, 0x2332b0e4
-0, 102000, 48600, 0x6c64342d
-0, 108000, 48600, 0x81156d54
-0, 114000, 48600, 0x8bfb9f04
-0, 120000, 48600, 0xd6bc38db
-0, 126000, 48600, 0x64de39d7
-0, 132000, 48600, 0xbddb3c37
-0, 138000, 48600, 0x15b75a31
-0, 144000, 48600, 0xa2dd7bdf
-0, 150000, 48600, 0xe4fb9b25
-0, 156000, 48600, 0xf2788234
-0, 162000, 48600, 0xa481a3d0
-0, 168000, 48600, 0x6087c790
-0, 174000, 48600, 0xf1dacfa1
-0, 180000, 48600, 0xe29e2e78
-0, 186000, 48600, 0x505b2db1
-0, 192000, 48600, 0x7bc56b02
-0, 198000, 48600, 0x3f7640de
-0, 204000, 48600, 0xd21a3f0b
-0, 210000, 48600, 0x92dc9b72
-0, 216000, 48600, 0x26e6804e
-0, 222000, 48600, 0xc3867fdc
-0, 228000, 48600, 0xe135c689
-0, 234000, 48600, 0xf0fda68b
-0, 240000, 48600, 0x7e07a430
-0, 246000, 48600, 0xb0809c56
-0, 252000, 48600, 0xd3f3d4b0
-0, 258000, 48600, 0x068ce7b9
-0, 264000, 48600, 0x3ae5ebb7
-0, 270000, 48600, 0x2274d1d8
-0, 276000, 48600, 0x9a2b95b7
-0, 282000, 48600, 0xe864dc3d
-0, 288000, 48600, 0xdf39d4db
-0, 294000, 48600, 0x5155c707
-0, 300000, 48600, 0xa26e9879
-0, 306000, 48600, 0x91b5747c
-0, 312000, 48600, 0xe7925589
-0, 318000, 48600, 0x582f1cb2
-0, 324000, 48600, 0x13180bdb
-0, 330000, 48600, 0x1623d914
-0, 336000, 48600, 0xfeeea068
-0, 342000, 48600, 0x61f8679c
-0, 348000, 48600, 0xcb678447
-0, 354000, 48600, 0xd0028749
-0, 360000, 48600, 0xec116a9c
-0, 366000, 48600, 0x16926417
-0, 372000, 48600, 0x342c6014
-0, 378000, 48600, 0xb81a3ec3
-0, 384000, 48600, 0xfd0d4654
-0, 390000, 48600, 0x741cc27a
-0, 396000, 48600, 0x2c53a9fe
-0, 402000, 48600, 0x795dc493
-0, 408000, 48600, 0x46eebc82
-0, 414000, 48600, 0xa2b7b84b
-0, 420000, 48600, 0x2274c95e
-0, 426000, 48600, 0x0ba5ac69
-0, 432000, 48600, 0x8335eb20
-0, 438000, 48600, 0xca80ef55
-0, 444000, 48600, 0xbb7cec8a
-0, 450000, 48600, 0x775bdde2
-0, 456000, 48600, 0x68a5a673
-0, 462000, 48600, 0x091ccca2
-0, 468000, 48600, 0xced6d065
-0, 474000, 48600, 0xed7fca50
-0, 480000, 48600, 0x5c77be3f
-0, 486000, 48600, 0x84719fe6
-0, 492000, 48600, 0x571cc076
-0, 498000, 48600, 0xa3b5be2a
-0, 504000, 48600, 0x0218bc6f
-0, 510000, 48600, 0x5ec1fa4c
-0, 516000, 48600, 0xcd3035fa
-0, 522000, 48600, 0xb8d2a741
-0, 528000, 48600, 0x6d39847c
-0, 534000, 48600, 0x0ffefc73
-0, 540000, 48600, 0x2bb74b68
-0, 546000, 48600, 0xf541d49f
-0, 552000, 48600, 0x6f7c9066
-0, 558000, 48600, 0x70d58548
-0, 564000, 48600, 0x92d38b55
-0, 570000, 48600, 0x5f4bdaa6
-0, 576000, 48600, 0x43868008
-0, 582000, 48600, 0xddb8e551
-0, 588000, 48600, 0xcd0cbd5f
-0, 594000, 48600, 0xf97e6bbd
-0, 600000, 48600, 0x5f1b31eb
-0, 606000, 48600, 0x10ff924d
-0, 612000, 48600, 0xcc31ca3f
-0, 618000, 48600, 0x5f27f9ff
-0, 624000, 48600, 0xd6fe4b71
-0, 630000, 48600, 0xa7d3b2c4
-0, 636000, 48600, 0x9992d6c7
-0, 642000, 48600, 0xd283089b
-0, 648000, 48600, 0x6ab52ede
-0, 654000, 48600, 0x495b1bad
-0, 660000, 48600, 0x3a4d1b72
-0, 666000, 48600, 0xdb421ba3
-0, 672000, 48600, 0x8ad11baa
-0, 678000, 48600, 0x17701bcc
-0, 684000, 48600, 0x4b771b6a
-0, 690000, 48600, 0x5345067e
-0, 696000, 48600, 0x2cd403a7
-0, 702000, 48600, 0x2cc5fd60
-0, 708000, 48600, 0xfa9cf1d4
-0, 714000, 48600, 0x8498e2d6
-0, 720000, 48600, 0x93dcc863
-0, 726000, 48600, 0xd46ac5d5
-0, 732000, 48600, 0x34e8c01b
-0, 738000, 48600, 0x4ad3b246
-0, 744000, 48600, 0x9848a6ca
-0, 750000, 48600, 0x7b7e8bee
-0, 756000, 48600, 0xaee0896b
-0, 762000, 48600, 0x263a812c
-0, 768000, 48600, 0x5d7b7782
-0, 774000, 48600, 0x3a2b6ad2
-0, 780000, 48600, 0xcf2a4ef3
-0, 786000, 48600, 0xc0134c9b
-0, 792000, 48600, 0x93c342d2
-0, 798000, 48600, 0x8d90393c
diff --git a/tests/ref/fate/interplay-mve-16bit b/tests/ref/fate/interplay-mve-16bit
deleted file mode 100644
index 2d22cca..0000000
--- a/tests/ref/fate/interplay-mve-16bit
+++ /dev/null
@@ -1,129 +0,0 @@
-1, 0, 5788, 0x916d2db8
-0, 0, 614400, 0x00000000
-1, 2953, 5888, 0xc65cb069
-0, 3002, 614400, 0x00000000
-1, 5957, 5888, 0xd8ec1acc
-0, 6005, 614400, 0xa17ea4ec
-1, 8961, 5888, 0xb22af0d6
-0, 9007, 614400, 0x4fd207fb
-1, 11965, 5888, 0x86bb50d9
-0, 12010, 614400, 0xd7a510fb
-1, 14969, 5888, 0x7674d923
-0, 15012, 614400, 0xe901e2f4
-1, 17973, 5888, 0xb97c5500
-0, 18014, 614400, 0x4ac5d3c4
-1, 20978, 5888, 0xecea1249
-0, 21017, 614400, 0x32e3e99c
-1, 23982, 5888, 0x0f4fea81
-0, 24019, 614400, 0x7a2ff20c
-1, 26986, 5888, 0x997914d8
-0, 27022, 614400, 0x59941193
-1, 29990, 5888, 0xd012f03a
-0, 30024, 614400, 0x92773a2b
-1, 32994, 5888, 0x03fd5248
-0, 33026, 614400, 0x4cd14313
-1, 35998, 5888, 0x3041a288
-0, 36029, 614400, 0x2a093fa3
-1, 39002, 5888, 0xe6105de1
-0, 39031, 614400, 0xf68b8463
-1, 42006, 5888, 0xaa38c7bd
-0, 42034, 614400, 0xa9e1969b
-1, 45010, 5888, 0xbfff702c
-0, 45036, 614400, 0x461996bb
-1, 48014, 5888, 0xbe4319a3
-0, 48038, 614400, 0xae58d053
-1, 51018, 5888, 0x2e89d262
-0, 51041, 614400, 0x7693015a
-1, 54022, 5888, 0x10992b9c
-0, 54043, 614400, 0x0b3507fa
-1, 57027, 5888, 0x972904bf
-0, 57046, 614400, 0xff5c2492
-1, 60031, 5888, 0x0093501c
-0, 60048, 614400, 0x636e3e32
-1, 63035, 5888, 0x8994ad0e
-0, 63050, 614400, 0x1acd6d0a
-1, 66039, 5888, 0x9db37d21
-0, 66053, 614400, 0x67039232
-1, 69043, 5888, 0xa8c7300f
-0, 69055, 614400, 0x8ab9c75a
-1, 72047, 5888, 0x1b7073b5
-0, 72058, 614400, 0xe824bbe2
-1, 75051, 5888, 0x56ad7f7b
-0, 75060, 614400, 0x5133e9ea
-1, 78055, 5888, 0x9706a8fb
-0, 78062, 614400, 0xcecf1249
-1, 81059, 5888, 0x16c9420e
-0, 81065, 614400, 0xe6d928c1
-1, 84063, 5888, 0x3e11be0a
-0, 84067, 614400, 0x8da46ff1
-1, 87067, 5888, 0x3e534a32
-0, 87070, 614400, 0x1c778319
-1, 90071, 5788, 0x0ffae5f4
-0, 90072, 614400, 0x35a19451
-1, 93024, 5888, 0xc2018f82
-0, 93074, 614400, 0x5145d1b9
-1, 96029, 5888, 0x2a11f529
-0, 96077, 614400, 0x146ee231
-1, 99033, 5888, 0xec282167
-0, 99079, 614400, 0xd9b33380
-1, 102037, 5888, 0xd61b5a05
-0, 102082, 614400, 0x8b112ef8
-1, 105041, 5888, 0x61de2741
-0, 105084, 614400, 0xb9e79ab0
-1, 108045, 5888, 0x17aaff8c
-0, 108086, 614400, 0x62d3a498
-1, 111049, 5888, 0xd40cd7a6
-0, 111089, 614400, 0xaeaaaa58
-1, 114053, 5888, 0x840840d4
-0, 114091, 614400, 0x8922c440
-1, 117057, 5888, 0x7c97ddcf
-0, 117094, 614400, 0xd62ef758
-1, 120061, 5888, 0xed9150f7
-0, 120096, 614400, 0x2a53149f
-1, 123065, 5888, 0xbccf973e
-0, 123098, 614400, 0x13da47df
-1, 126069, 5888, 0x74bda5ea
-0, 126101, 614400, 0x27c05c3f
-1, 129073, 5888, 0xd083892a
-0, 129103, 614400, 0x41ff7ca7
-1, 132078, 5888, 0x16e444b2
-0, 132106, 614400, 0x6b0e8a07
-1, 135082, 5888, 0x68a9cedb
-0, 135108, 614400, 0xa200ad9f
-1, 138086, 5888, 0x80849f36
-0, 138110, 614400, 0x9da7cc77
-1, 141090, 5888, 0x63cb7df9
-0, 141113, 614400, 0x2f5703be
-1, 144094, 5888, 0xf90f754d
-0, 144115, 614400, 0x91c720f6
-1, 147098, 5888, 0x9c2c867d
-0, 147118, 614400, 0x927a882e
-1, 150102, 5888, 0x337994a4
-1, 153106, 5888, 0xf354a28d
-1, 156110, 5888, 0x70933738
-1, 159114, 5888, 0x3c019219
-1, 162118, 5888, 0xe0c21295
-1, 165122, 5888, 0x21869515
-1, 168127, 5888, 0xe9b1ec7d
-1, 171131, 5888, 0x57825497
-1, 174135, 5888, 0xae02ebeb
-1, 177139, 5888, 0x0c62e14f
-1, 180143, 5788, 0x8a255f8f
-1, 183096, 5888, 0x38993359
-1, 186100, 5888, 0x390baf95
-1, 189104, 5888, 0xb72c72ea
-1, 192108, 5888, 0xbbd3c6fe
-1, 195112, 5888, 0xefb26f0a
-1, 198116, 5888, 0xcc404dd0
-1, 201120, 5888, 0xffa23082
-1, 204124, 5888, 0xd0c43567
-1, 207129, 5888, 0x4d3b7958
-1, 210133, 5888, 0x47125aa1
-1, 213137, 5888, 0x99286cf3
-1, 216141, 5888, 0x478d61e2
-1, 219145, 5888, 0xac65b47e
-1, 222149, 5888, 0x333c1d1a
-1, 225153, 5888, 0x8f960ecf
-1, 228157, 5888, 0x58f76aec
-1, 231161, 5888, 0xb5e0dded
-1, 234165, 5888, 0xaf1a8f9a
diff --git a/tests/ref/fate/interplay-mve-8bit b/tests/ref/fate/interplay-mve-8bit
deleted file mode 100644
index 0b41f35..0000000
--- a/tests/ref/fate/interplay-mve-8bit
+++ /dev/null
@@ -1,234 +0,0 @@
-1, 0, 5848, 0xea04292b
-0, 0, 414720, 0xa5cd50ca
-1, 5967, 5888, 0x0e59e942
-0, 6006, 414720, 0x3facd321
-1, 11976, 5888, 0x56d480f6
-0, 12011, 414720, 0x849e6d4b
-1, 17984, 5888, 0xcb560b22
-0, 18017, 414720, 0xe649363f
-1, 23992, 5888, 0xca26865b
-0, 24022, 414720, 0x5bbd7b14
-1, 30000, 5888, 0xa434392f
-0, 30028, 414720, 0xe246ab51
-1, 36008, 5888, 0xa0615fe4
-0, 36033, 414720, 0x5721b22e
-1, 42016, 5888, 0x85b241cd
-0, 42039, 414720, 0xe391e107
-1, 48024, 5888, 0x2c417a43
-0, 48044, 414720, 0x04d851ff
-1, 54033, 5888, 0x2d5ed665
-0, 54050, 414720, 0x8d80d580
-1, 60041, 5888, 0x37267a2d
-0, 60055, 414720, 0x5a24b0bc
-1, 66049, 5888, 0x1f803c67
-0, 66061, 414720, 0x06cd6960
-1, 72057, 5888, 0xfb7940ef
-0, 72066, 414720, 0xf5ca48b4
-1, 78065, 5888, 0x1a5371e8
-0, 78072, 414720, 0x24700f94
-1, 84073, 5888, 0x37e29b21
-0, 84077, 414720, 0xb0bfe451
-1, 90082, 5848, 0x70065769
-0, 90083, 414720, 0x00e9f3d1
-1, 96049, 5888, 0xaf624f3d
-0, 96088, 414720, 0x0efbffd1
-1, 102057, 5888, 0x8f5e5b57
-0, 102094, 414720, 0x2ecdfc8d
-1, 108065, 5888, 0x93545968
-0, 108099, 414720, 0x94b531fc
-1, 114073, 5888, 0x915f268f
-0, 114105, 414720, 0x2c2579f8
-1, 120082, 5888, 0x9cd48ac4
-0, 120110, 414720, 0x6c7ecfb8
-1, 126090, 5888, 0x812c8e13
-0, 126116, 414720, 0x08982527
-1, 132098, 5888, 0xe794a2a7
-0, 132121, 414720, 0x5c0161b3
-1, 138106, 5888, 0x4a056e4b
-0, 138127, 414720, 0x453ce413
-1, 144114, 5888, 0xa3589992
-0, 144132, 414720, 0x634e36b2
-1, 150122, 5888, 0x19ea7ec5
-0, 150138, 414720, 0x401a683a
-1, 156131, 5888, 0x422d5097
-0, 156144, 414720, 0x3c5f442e
-1, 162139, 5888, 0xc9fd963f
-0, 162149, 414720, 0x075ef787
-1, 168147, 5888, 0xc556a5ea
-0, 168155, 414720, 0x8501a04f
-1, 174155, 5888, 0x51557e0f
-0, 174160, 414720, 0x3620093b
-1, 180163, 5848, 0x4903ad21
-0, 180166, 414720, 0xa42d9480
-1, 186131, 5888, 0xb1c85e85
-0, 186171, 414720, 0x09b150b4
-1, 192139, 5888, 0x68963d65
-0, 192177, 414720, 0xcad407f0
-1, 198147, 5888, 0x62a3124e
-0, 198182, 414720, 0x69e5eecd
-1, 204155, 5888, 0x4ff1878f
-0, 204188, 414720, 0xb92ad2d9
-1, 210163, 5888, 0x8b09ac18
-0, 210193, 414720, 0xc78eaf29
-1, 216171, 5888, 0x67d85338
-0, 216199, 414720, 0x47c3fa91
-1, 222180, 5888, 0x82eca0a6
-0, 222204, 414720, 0x8847b7b8
-1, 228188, 5888, 0x81a17eb8
-0, 228210, 414720, 0x864cab2f
-1, 234196, 5888, 0x7108478c
-0, 234215, 414720, 0x78d653e2
-1, 240204, 5888, 0xbfc18b09
-0, 240221, 414720, 0xda15cbd2
-1, 246212, 5888, 0xad93711f
-0, 246226, 414720, 0xdf9ce28a
-1, 252220, 5888, 0xf8d25e39
-0, 252232, 414720, 0xe88c49ca
-1, 258229, 5888, 0x41edd04e
-0, 258237, 414720, 0xd6bcbc07
-1, 264237, 5888, 0xa6557ee2
-0, 264243, 414720, 0xf0b4a7bf
-1, 270245, 5848, 0xc14d5456
-0, 270248, 414720, 0x74f9bfbf
-1, 276212, 5888, 0x20a7821f
-0, 276254, 414720, 0x904ce103
-1, 282220, 5888, 0x9f1a8f9d
-0, 282259, 414720, 0xca877e4a
-1, 288229, 5888, 0x2f3c6cc8
-0, 288265, 414720, 0x588effd6
-1, 294237, 5888, 0x757c894a
-0, 294270, 414720, 0x6dff8b71
-1, 300245, 5888, 0x483e98bb
-0, 300276, 414720, 0xbeaae788
-1, 306253, 5888, 0x84289c75
-0, 306282, 414720, 0x1a4d1242
-1, 312261, 5888, 0xf79d5a91
-0, 312287, 414720, 0x4ae98ea0
-1, 318269, 5888, 0x395b5228
-0, 318293, 414720, 0x41ed6d22
-1, 324278, 5888, 0x9c937a14
-0, 324298, 414720, 0x486e70aa
-1, 330286, 5888, 0x40c169cf
-0, 330304, 414720, 0xfddc103e
-1, 336294, 5888, 0x3e7f99b0
-0, 336309, 414720, 0x8620f03e
-1, 342302, 5888, 0xd4de993e
-0, 342315, 414720, 0x0e4ec273
-1, 348310, 5888, 0xae856b09
-0, 348320, 414720, 0xb2298b3e
-1, 354318, 5888, 0xa2369c95
-0, 354326, 414720, 0xb4f50176
-1, 360327, 5848, 0x992d516b
-0, 360331, 414720, 0xb9c7a495
-1, 366294, 5888, 0xcd785ba9
-0, 366337, 414720, 0xed270702
-1, 372302, 5888, 0x55ea3bce
-0, 372342, 414720, 0x98b72586
-1, 378310, 5888, 0xf06d4bbf
-0, 378348, 414720, 0xd8977cb1
-1, 384318, 5888, 0x2a9d4c1a
-0, 384353, 414720, 0xff3d3851
-1, 390327, 5888, 0xd5e348a3
-0, 390359, 414720, 0x7e4f0424
-1, 396335, 5888, 0x6431a24c
-0, 396364, 414720, 0xa9e75006
-1, 402343, 5888, 0x41f9908c
-0, 402370, 414720, 0x8f98cba9
-1, 408351, 5888, 0x0ed99656
-0, 408375, 414720, 0x25ecd620
-1, 414359, 5888, 0x635a6392
-0, 414381, 414720, 0x78cf5c58
-1, 420367, 5888, 0x690c750c
-0, 420386, 414720, 0x3fb4b81a
-1, 426376, 5888, 0xf9d97b23
-0, 426392, 414720, 0xd7b655fa
-1, 432384, 5888, 0x75e1606b
-0, 432397, 414720, 0xd9158db3
-1, 438392, 5888, 0x1bcb43b0
-0, 438403, 414720, 0x2e651852
-1, 444400, 5888, 0x48c295cb
-0, 444408, 414720, 0x9f9adb64
-1, 450408, 5848, 0xe47f7b5d
-0, 450414, 414720, 0xe9d16e81
-1, 456376, 5888, 0x20be7f3e
-0, 456420, 414720, 0xbe73daf5
-1, 462384, 5888, 0x8c2428c4
-0, 462425, 414720, 0x3d164329
-1, 468392, 5888, 0x851379af
-0, 468431, 414720, 0x1d5a9bc8
-1, 474400, 5888, 0x5916647d
-0, 474436, 414720, 0x8e8debbe
-1, 480408, 5888, 0xef9c6281
-0, 480442, 414720, 0x4e7a2bf0
-1, 486416, 5888, 0x49660d32
-0, 486447, 414720, 0x4a13804d
-1, 492424, 5888, 0x62cf36a1
-0, 492453, 414720, 0x5dd188d8
-1, 498433, 5888, 0x56dff39c
-0, 498458, 414720, 0xbe7f4963
-1, 504441, 5888, 0x4e6b5b02
-0, 504464, 414720, 0xcff3b767
-1, 510449, 5888, 0xb8697067
-0, 510469, 414720, 0xbbd3afa0
-1, 516457, 5888, 0xcb4e2706
-0, 516475, 414720, 0xaf9dec62
-1, 522465, 5888, 0x6eaa9669
-0, 522480, 414720, 0xc74816a1
-1, 528473, 5888, 0xfd9d7dba
-0, 528486, 414720, 0x51488bfc
-1, 534482, 5888, 0xfe137923
-0, 534491, 414720, 0x68c10a2c
-1, 540490, 5848, 0x1931296f
-0, 540497, 414720, 0x10179c4e
-1, 546457, 5888, 0xa09a7c03
-0, 546502, 414720, 0x18d559b7
-1, 552465, 5888, 0xded9802d
-0, 552508, 414720, 0x8257aa55
-1, 558473, 5888, 0x9f6723b7
-0, 558513, 414720, 0x9ea24501
-1, 564482, 5888, 0x3ad02476
-0, 564519, 414720, 0x238605cc
-1, 570490, 5888, 0xa1647e32
-0, 570524, 414720, 0xb552deaa
-1, 576498, 5888, 0x728672da
-0, 576530, 414720, 0x07c3348d
-1, 582506, 5888, 0x9c098090
-0, 582535, 414720, 0x82f4f9b0
-1, 588514, 5888, 0x32a65ea3
-0, 588541, 414720, 0xf5d76bc5
-1, 594522, 5888, 0xdde141d5
-0, 594546, 414720, 0x34b3a1e6
-1, 600531, 5888, 0x816c5fb4
-0, 600552, 414720, 0xda25e11b
-1, 606539, 5888, 0x75e17581
-0, 606558, 414720, 0x2b19936b
-1, 612547, 5888, 0x59035469
-0, 612563, 414720, 0xe91f9f73
-1, 618555, 5888, 0x20d340cd
-0, 618569, 414720, 0x48d09aab
-1, 624563, 5888, 0xa89a8790
-0, 624574, 414720, 0xac42bf83
-1, 630571, 5848, 0x12b74c34
-0, 630580, 414720, 0x2d8ca14e
-1, 636539, 5888, 0xcd3b3bef
-0, 636585, 414720, 0xe65462fd
-1, 642547, 5888, 0xe5c44bf3
-0, 642591, 414720, 0xe5bfc929
-1, 648555, 5888, 0xb82c4fa4
-0, 648596, 414720, 0x66784c58
-1, 654563, 5888, 0x05b2443a
-0, 654602, 414720, 0x70dbeca8
-1, 660571, 5888, 0x78028172
-1, 666580, 5888, 0xdfcac19a
-1, 672588, 5888, 0x0761a0b9
-1, 678596, 5888, 0x77d88607
-1, 684604, 5888, 0xdd7f4d77
-1, 690612, 5888, 0x366bf58a
-1, 696620, 5888, 0x9a3d59b5
-1, 702629, 5888, 0x16cb777f
-1, 708637, 5888, 0x1d4afe64
-1, 714645, 5888, 0xc0fe1e73
-1, 720653, 5848, 0xcceb69c8
-1, 726620, 5888, 0x89449643
-1, 732629, 5888, 0x5fe595b7
-1, 738637, 5888, 0x400a8c77
diff --git a/tests/ref/fate/iv8-demux b/tests/ref/fate/iv8-demux
deleted file mode 100644
index 87217f9..0000000
--- a/tests/ref/fate/iv8-demux
+++ /dev/null
@@ -1,25 +0,0 @@
-0, 0, 20883, 0x347191e2
-0, 0, 20882, 0xe1573905
-0, 3600, 20894, 0xd54f516a
-0, 7200, 20891, 0x1b5c5039
-0, 10800, 20883, 0x8e785b4d
-0, 14400, 20870, 0xd26ca1f6
-0, 18000, 21448, 0x946f5b2b
-0, 21600, 21433, 0xb18687c5
-0, 25200, 20865, 0xc0eb3fce
-0, 28800, 20842, 0x9d0728ba
-0, 32399, 20878, 0xf60f5dee
-0, 35999, 20866, 0x3bde568f
-0, 39600, 20884, 0x22736993
-0, 43200, 20860, 0xf56f2fca
-0, 46800, 20872, 0xf39e3cb3
-0, 50400, 20835, 0xa3c4363b
-0, 53999, 20905, 0x552853d1
-0, 57600, 20874, 0xed0b91ec
-0, 61200, 20877, 0xe1623e01
-0, 64799, 20933, 0x19906564
-0, 68399, 20891, 0x3d064fd3
-0, 72000, 20834, 0xcb774dbc
-0, 75600, 20870, 0xbc536589
-0, 79200, 21421, 0xc99a68e4
-0, 82800, 12869, 0x5684e304
diff --git a/tests/ref/fate/kmvc b/tests/ref/fate/kmvc
deleted file mode 100644
index eb7bcda..0000000
--- a/tests/ref/fate/kmvc
+++ /dev/null
@@ -1,75 +0,0 @@
-0, 0, 153600, 0x00000000
-0, 3600, 153600, 0x00000000
-0, 7200, 153600, 0x00000000
-0, 10800, 153600, 0x3ad906f0
-0, 14400, 153600, 0x9f7c2e80
-0, 18000, 153600, 0x548c9e10
-0, 21600, 153600, 0xab4154e7
-0, 25200, 153600, 0x762964be
-0, 28800, 153600, 0xea6beab1
-0, 32400, 153600, 0x00805c23
-0, 36000, 153600, 0x932eebd2
-0, 39600, 153600, 0x73a9a1c4
-0, 43200, 153600, 0x3ecf80a2
-0, 46800, 153600, 0xb7266fcc
-0, 50400, 153600, 0xf9a75e02
-0, 54000, 153600, 0xa4cb4c00
-0, 57600, 153600, 0x8cc653fa
-0, 61200, 153600, 0xf0735df0
-0, 64800, 153600, 0x46945766
-0, 68400, 153600, 0x1cf75120
-0, 72000, 153600, 0x015d4476
-0, 75600, 153600, 0x4ad6419c
-0, 79200, 153600, 0xf97a1292
-0, 82800, 153600, 0x8048c6bd
-0, 86400, 153600, 0x0aa97f7f
-0, 90000, 153600, 0xcd1a0531
-0, 93600, 153600, 0xeb9e72b4
-0, 97200, 153600, 0x5a61d657
-0, 100800, 153600, 0xc4eb1759
-0, 104400, 153600, 0x07b05b0c
-0, 108000, 153600, 0x9c417927
-0, 111600, 153600, 0xa3a28516
-0, 115200, 153600, 0x78e97511
-0, 118800, 153600, 0x05c94e38
-0, 122400, 153600, 0x0003ffa4
-0, 126000, 153600, 0x46489827
-0, 129600, 153600, 0xa6ac0ea6
-0, 133200, 153600, 0xf4ae7e9a
-0, 136800, 153600, 0xe07dd526
-0, 140400, 153600, 0x5c0d0ab9
-0, 144000, 153600, 0xad542525
-0, 147600, 153600, 0xa72a35b1
-0, 151200, 153600, 0x373d3cbd
-0, 154800, 153600, 0x242c3cad
-0, 158400, 153600, 0xbe4f44e5
-0, 162000, 153600, 0x3b883575
-0, 165600, 153600, 0xcd7d2995
-0, 169200, 153600, 0x89a01f99
-0, 172800, 153600, 0x79ac0861
-0, 176400, 153600, 0xefb6ee22
-0, 180000, 153600, 0x4498d6b2
-0, 183600, 153600, 0x99efd0a6
-0, 187200, 153600, 0xd937c282
-0, 190800, 153600, 0xa6c6bbb2
-0, 194400, 153600, 0xf667bf0e
-0, 198000, 153600, 0x83b2c12e
-0, 201600, 153600, 0xcbd6c766
-0, 205200, 153600, 0xc5b3c762
-0, 208800, 153600, 0xe51fc5fa
-0, 212400, 153600, 0x6542c5ee
-0, 216000, 153600, 0x59d2c946
-0, 219600, 153600, 0xccaacdde
-0, 223200, 153600, 0x884ec6aa
-0, 226800, 153600, 0xb3d7c2de
-0, 230400, 153600, 0xd4e8c1a2
-0, 234000, 153600, 0xa416c3ba
-0, 237600, 153600, 0x6905b62e
-0, 241200, 153600, 0xce16b456
-0, 244800, 153600, 0xcbd9a67e
-0, 248400, 153600, 0x6785afd6
-0, 252000, 153600, 0x6fd7b1fa
-0, 255600, 153600, 0x2a65b77e
-0, 259200, 153600, 0xa162aff6
-0, 262800, 153600, 0x227ea802
-0, 266400, 153600, 0x98de79fa
diff --git a/tests/ref/fate/lmlm4-demux b/tests/ref/fate/lmlm4-demux
deleted file mode 100644
index 8ecf4b2..0000000
--- a/tests/ref/fate/lmlm4-demux
+++ /dev/null
@@ -1,547 +0,0 @@
-1, 0, 768, 0xaebcbebb
-0, 0, 5951, 0xe9118e0d
-1, 2160, 768, 0xaebcbebb
-0, 3003, 1672, 0x4b80d4ca
-1, 4320, 768, 0xaebcbebb
-0, 6006, 1604, 0x99e1b0a7
-1, 6480, 768, 0x866fe37a
-1, 8640, 768, 0x05d76890
-0, 9009, 1204, 0x9559038a
-1, 10800, 768, 0x858f5511
-0, 12012, 1482, 0x60056564
-1, 12960, 768, 0x97cb65ef
-0, 15015, 1105, 0xf508cef4
-1, 15120, 768, 0xe269742c
-1, 17280, 768, 0xa6015f8d
-0, 18018, 1193, 0xc8e0fd36
-1, 19440, 768, 0x759163e0
-0, 21021, 1247, 0x8dd202e5
-1, 21600, 768, 0xb1e16082
-1, 23760, 768, 0x1b616429
-0, 24024, 1367, 0xf59435e5
-1, 25920, 768, 0x7e4364f7
-0, 27027, 1406, 0x68ba4a7e
-1, 28080, 768, 0x59bd64f7
-0, 30030, 1262, 0x82c04123
-1, 30240, 768, 0xc3116fc6
-1, 32400, 768, 0x6a1c6b56
-0, 33033, 1381, 0x02335cf9
-1, 34560, 768, 0x285a64cf
-0, 36036, 1450, 0x7be46fd1
-1, 36720, 768, 0x79b16d65
-1, 38880, 768, 0x09b47635
-0, 39039, 1362, 0x75cc381a
-1, 41040, 768, 0x81597446
-0, 42042, 1409, 0x9ed74f3f
-1, 43200, 768, 0xfeb66eee
-0, 45045, 1253, 0x82400ae1
-1, 45360, 768, 0x78557618
-1, 47520, 768, 0x3af170bf
-0, 48048, 5499, 0xed286805
-1, 49680, 768, 0xefbd6399
-0, 51051, 1403, 0x483c4cbc
-1, 51840, 768, 0xc98e7492
-1, 54000, 768, 0x010d7149
-0, 54054, 1632, 0xa9ebcd6c
-1, 56160, 768, 0xce838b07
-0, 57057, 1207, 0xc8580724
-1, 58320, 768, 0xed18726c
-0, 60060, 1289, 0x61fb2fd2
-1, 60480, 768, 0x017e6712
-1, 62640, 768, 0x7f9268e9
-0, 63063, 1230, 0xf348f53c
-1, 64800, 768, 0xf6f258fc
-0, 66066, 1579, 0xa260b1ac
-1, 66960, 768, 0x9a1a6f31
-0, 69069, 949, 0x91849002
-1, 69120, 768, 0x14b47b23
-1, 71280, 768, 0x9bdc6a50
-0, 72072, 786, 0x3e33576f
-1, 73440, 768, 0x0fc46dab
-0, 75075, 894, 0x9ac36a61
-1, 75600, 768, 0x6c387372
-1, 77760, 768, 0x581e71cd
-0, 78078, 1186, 0x6bfc116e
-1, 79920, 768, 0x00cb785f
-0, 81081, 1187, 0xcfc512ae
-1, 82080, 768, 0x1dda7032
-0, 84084, 1527, 0x5c2c965a
-1, 84240, 768, 0xf57c7103
-1, 86400, 768, 0x2d927183
-0, 87087, 1536, 0x5ba7ac29
-1, 88560, 768, 0xdae86cdf
-0, 90090, 1095, 0xce06eb96
-1, 90720, 768, 0x2a2f6c3c
-1, 92880, 768, 0x44696eba
-0, 93093, 1402, 0x642f6b0d
-1, 95040, 768, 0xf67c71c4
-0, 96096, 5551, 0xf01a9c08
-1, 97200, 768, 0xc1ce7237
-0, 99099, 1211, 0x350206f7
-1, 99360, 768, 0xd9c36ef5
-1, 101520, 768, 0x63b06b03
-0, 102102, 887, 0x08767619
-1, 103680, 768, 0x8de97ebe
-0, 105105, 1042, 0xcc81a9ed
-1, 105840, 768, 0xbf117c32
-1, 108000, 768, 0x82897497
-0, 108108, 1247, 0x6f320614
-1, 110160, 768, 0x7a347abb
-0, 111111, 1459, 0xd28975b5
-1, 112320, 768, 0xc99b691e
-0, 114114, 1116, 0x1ab1e9db
-1, 114480, 768, 0xf4fc6e74
-1, 116640, 768, 0x511d6ec4
-0, 117117, 1110, 0x6411f66a
-1, 118800, 768, 0xb8c06b5f
-0, 120120, 1282, 0xd468375d
-1, 120960, 768, 0xf1776aed
-1, 123120, 768, 0xe6fe7fb4
-0, 123123, 1077, 0x1273c6e3
-1, 125280, 768, 0x36907aff
-0, 126126, 1043, 0x12dbd3ae
-1, 127440, 768, 0xddf666bb
-0, 129129, 1087, 0x3e70d37a
-1, 129600, 768, 0x8e896ebc
-1, 131760, 768, 0x0aa47dfa
-0, 132132, 992, 0x0651a71c
-1, 133920, 768, 0xc1736811
-0, 135135, 1012, 0x6a069f8c
-1, 136080, 768, 0xb3e87009
-0, 138138, 1320, 0x92803d69
-1, 138240, 768, 0xf23e6c00
-1, 140400, 768, 0x993a71d2
-0, 141141, 1080, 0xe0ffbe95
-1, 142560, 768, 0xa53466dd
-0, 144144, 5639, 0x658ca26b
-1, 144720, 768, 0xb43a74b0
-1, 146880, 768, 0x348f615c
-0, 147147, 1385, 0xbcb96241
-1, 149040, 768, 0x298f6e1b
-0, 150150, 1142, 0x8c6df318
-1, 151200, 768, 0x5db469c8
-0, 153153, 1175, 0xcac1faef
-1, 153360, 768, 0x08f16c2c
-1, 155520, 768, 0x4a0474cb
-0, 156156, 1091, 0xa937e32a
-1, 157680, 768, 0x077c760b
-0, 159159, 1174, 0xfa50040d
-1, 159840, 768, 0xa5777c2e
-1, 162000, 768, 0x0d157ea6
-0, 162162, 1293, 0x0c8d2740
-1, 164160, 768, 0x9bc26f86
-0, 165165, 1262, 0x502c0c35
-1, 166320, 768, 0x1a72742d
-0, 168168, 1038, 0x5e98c0cd
-1, 168480, 768, 0xa5bb6bbb
-1, 170640, 768, 0x48496c4c
-0, 171171, 1362, 0x256e43cf
-1, 172800, 768, 0x800d78f0
-0, 174174, 1200, 0x29e6f055
-1, 174960, 768, 0x40db840c
-1, 177120, 768, 0xadc96a6b
-0, 177177, 1495, 0x88e9b973
-1, 179280, 768, 0xff986b03
-0, 180180, 1386, 0x849297d2
-1, 181440, 768, 0x152473d6
-0, 183183, 1572, 0x63b7dc79
-1, 183600, 768, 0x01567323
-1, 185760, 768, 0xe5f26fe5
-0, 186186, 1190, 0x32ccf4cb
-1, 187920, 768, 0xa8fd72cd
-0, 189189, 1395, 0xa6ec4ae9
-1, 190080, 768, 0x8857655b
-0, 192192, 5692, 0x81aed6f3
-1, 192240, 768, 0x84017b13
-1, 194400, 768, 0xe6a968b3
-0, 195195, 1335, 0xe98a5497
-1, 196560, 768, 0xb03a7566
-0, 198198, 1361, 0x8ae15ab5
-1, 198720, 768, 0x8bea5f62
-1, 200880, 768, 0xac7570b0
-0, 201201, 1525, 0xed2bc1e8
-1, 203040, 768, 0x11306fac
-0, 204204, 1570, 0xba70d74b
-1, 205200, 768, 0xf2af5b28
-0, 207207, 1349, 0xd97a687d
-1, 207360, 768, 0x3069681f
-1, 209520, 768, 0x7ff07033
-0, 210210, 1270, 0xca8c3ca8
-1, 211680, 768, 0xd74973f2
-0, 213213, 1016, 0x32d0c81a
-1, 213840, 768, 0xb3627304
-1, 216000, 768, 0x11ff7589
-0, 216216, 983, 0x536faa97
-1, 218160, 768, 0x4a156c63
-0, 219219, 1111, 0x44ade015
-1, 220320, 768, 0xcb036127
-0, 222222, 1314, 0xce7c477d
-1, 222480, 768, 0x0b796bb9
-1, 224640, 768, 0x1d516c35
-0, 225225, 1005, 0x0196b491
-1, 226800, 768, 0xa9146da1
-0, 228228, 1162, 0xb8f6ebe6
-1, 228960, 768, 0x6d176392
-1, 231120, 768, 0x6f966269
-0, 231231, 1440, 0xfca67c72
-1, 233280, 768, 0x7ee17724
-0, 234234, 1437, 0x491181b1
-1, 235440, 768, 0x3f07614a
-0, 237237, 1261, 0xf0cd1898
-1, 237600, 768, 0x49d56945
-1, 239760, 768, 0x68eb660a
-0, 240240, 5638, 0x3a25a9f2
-1, 241920, 768, 0xe7c96677
-0, 243243, 1091, 0x67d9c693
-1, 244080, 768, 0x7dc07a35
-1, 246240, 768, 0x1e9c6397
-0, 246246, 875, 0x52147bb1
-1, 248400, 768, 0x93ef5de4
-0, 249249, 1188, 0x8522000f
-1, 250560, 768, 0x34af6803
-0, 252252, 1360, 0x89b82e7b
-1, 252720, 768, 0x77e068be
-1, 254880, 768, 0x65e274de
-0, 255255, 1378, 0xe8644914
-1, 257040, 768, 0xb7ad6a8a
-0, 258258, 1194, 0x89fef83d
-1, 259200, 768, 0x84b3635f
-0, 261261, 1422, 0x99daa18b
-1, 261360, 768, 0x066b78f2
-1, 263520, 768, 0xda137428
-0, 264264, 1049, 0x72a9cec1
-1, 265680, 768, 0xfd6c7597
-0, 267267, 1327, 0x7d15307c
-1, 267840, 768, 0x8d766d40
-0, 270270, 1225, 0x1b5d0f5f
-0, 273273, 1173, 0x840efed5
-0, 276276, 1215, 0xa8e0035e
-0, 279279, 1295, 0x142918ca
-0, 282282, 1144, 0xf50cef50
-0, 285285, 1527, 0x7d13bd9d
-0, 288288, 5609, 0x1ae1921d
-0, 291291, 1303, 0xabdc264f
-0, 294294, 1419, 0x878169bf
-0, 297297, 972, 0x00c4a257
-0, 300300, 1277, 0x87d520cf
-0, 303303, 1014, 0x5946b4ee
-0, 306306, 1177, 0x124e0e23
-0, 309309, 1402, 0x8e6363cc
-0, 312312, 1171, 0x9bdaeda2
-0, 315315, 1389, 0x2db53b22
-0, 318318, 1056, 0xd1c3de3e
-0, 321321, 1320, 0x1ea142c7
-0, 324324, 1250, 0x33612229
-0, 327327, 1477, 0xb9648b48
-0, 330330, 1522, 0x5352c318
-0, 333333, 1391, 0x5e9157e0
-0, 336336, 5545, 0x569e64c1
-0, 339339, 1354, 0xdb39469e
-0, 342342, 1302, 0x79912b5d
-0, 345345, 1065, 0x4befcdd2
-0, 348348, 1408, 0x7d2f65a2
-0, 351351, 1727, 0x9cac0398
-0, 354354, 1590, 0xa321b563
-0, 357357, 1039, 0xfa35cabf
-0, 360360, 1184, 0xb332fde7
-0, 363363, 669, 0xb10e3783
-0, 366366, 784, 0x57275e09
-0, 369369, 1051, 0xe072cd33
-0, 372372, 1119, 0x635ee9ee
-0, 375375, 1147, 0x3916f981
-0, 378378, 1086, 0x306ef895
-0, 381381, 827, 0x213f7aef
-0, 384384, 5525, 0x19157827
-0, 387387, 1044, 0xb661abc5
-0, 390390, 1143, 0x032e1109
-0, 393393, 1460, 0x5a2f9503
-0, 396396, 1178, 0xd038141f
-0, 399399, 1004, 0x410ec3b2
-0, 402402, 1089, 0xc89af8c9
-0, 405405, 1367, 0x52085e0a
-0, 408408, 1115, 0x8bb2ee7f
-0, 411411, 1325, 0xc2e05647
-0, 414414, 1295, 0x213951c9
-0, 417417, 1054, 0xbb8bdaae
-0, 420420, 1210, 0x431122bd
-0, 423423, 1400, 0x47526fcc
-0, 426426, 1188, 0x19770b07
-0, 429429, 1301, 0x437161c8
-0, 432432, 5281, 0xc0c92b55
-0, 435435, 840, 0x67da7b2f
-0, 438438, 1094, 0x3fd6d944
-0, 441441, 832, 0x0eda74bc
-0, 444444, 1096, 0x3300da7b
-0, 447447, 1018, 0xa208c971
-0, 450450, 1389, 0x1167724c
-0, 453453, 1411, 0xe3be666b
-0, 456456, 1294, 0xa8f35cc6
-0, 459459, 1232, 0xfd0d20fd
-0, 462462, 1252, 0xadd83a26
-0, 465465, 844, 0xcbaf6a55
-0, 468468, 979, 0x78d9b241
-0, 471471, 1057, 0x6743e16c
-0, 474474, 776, 0xfedd6615
-0, 477477, 1158, 0xa39fee34
-0, 480480, 5288, 0x5f26ee02
-0, 483483, 1029, 0xa681bee8
-0, 486486, 1106, 0xa68dea33
-0, 489489, 844, 0x42fd83ec
-0, 492492, 779, 0xb5006759
-0, 495495, 951, 0xec13af4f
-0, 498498, 1011, 0x90e5c86e
-0, 501501, 892, 0x4db48ca4
-0, 504504, 804, 0x59bf73a7
-0, 507507, 1001, 0x10c2b3ff
-0, 510510, 879, 0x65c57eaf
-0, 513513, 1320, 0x80815836
-0, 516516, 1448, 0xaf457b3b
-0, 519519, 1168, 0x65b9f96a
-0, 522522, 1002, 0x053fafb9
-0, 525525, 1101, 0x2d30c3d5
-0, 528528, 5314, 0x87cee383
-0, 531531, 1305, 0xb19035db
-0, 534534, 1240, 0xdc6a0a65
-0, 537537, 1067, 0x9c88ba67
-0, 540540, 823, 0x2f736a43
-0, 543543, 1183, 0x2ef9f3c9
-0, 546546, 899, 0x3fcc8d11
-0, 549549, 886, 0xccec8d49
-0, 552552, 1190, 0x2d020fa1
-0, 555555, 1017, 0x0776b627
-0, 558558, 1202, 0xbdd808d5
-0, 561561, 998, 0x64c7c246
-0, 564564, 1200, 0x9d6e2289
-0, 567567, 895, 0xa8a68d80
-0, 570570, 748, 0xe61a49fb
-0, 573573, 929, 0x30168b50
-0, 576576, 5276, 0xceb2edf2
-0, 579579, 1127, 0xab43ddc3
-0, 582582, 1028, 0xaacfbff5
-0, 585585, 914, 0xb63c8fb0
-0, 588588, 1067, 0xbdacd1ed
-0, 591591, 1109, 0x6792ddec
-0, 594594, 1310, 0x71bc4da2
-0, 597597, 1098, 0xc464de9b
-0, 600600, 1018, 0x6833b875
-0, 603603, 1210, 0x44faf34b
-0, 606606, 1200, 0x9ee816f6
-0, 609609, 1461, 0xc76b7d2b
-0, 612612, 829, 0x006677e6
-0, 615615, 1145, 0xc769fb13
-0, 618618, 1292, 0xb63225f5
-0, 621621, 1252, 0x0e2a2626
-0, 624624, 5257, 0x3877eca1
-0, 627627, 952, 0x7f708d25
-0, 630630, 1125, 0x140cd81b
-0, 633633, 1095, 0x3025dade
-0, 636636, 1388, 0xd7494d4e
-0, 639639, 1124, 0x0c48ee92
-0, 642642, 1556, 0xa0749ee2
-0, 645645, 1461, 0xe5fd7d7f
-0, 648648, 903, 0x07a58303
-0, 651651, 1049, 0x4b6cd03b
-0, 654654, 1044, 0x5f47cb48
-0, 657657, 1253, 0xba281c6a
-0, 660660, 1618, 0xed7cd040
-0, 663663, 981, 0x2926b6f4
-0, 666666, 1560, 0xa0e1ab73
-0, 669669, 1479, 0x41a77e88
-0, 672672, 5222, 0xc2dbd182
-0, 675675, 925, 0x967580dd
-0, 678678, 1284, 0x5b7822e0
-0, 681681, 1512, 0xe84da1e0
-0, 684684, 1514, 0xc38bb09e
-0, 687687, 1224, 0x8752228e
-0, 690690, 1296, 0xcf053c03
-0, 693693, 1117, 0x9a81e659
-0, 696696, 1090, 0x003ed687
-0, 699699, 1196, 0x3a510937
-0, 702702, 1075, 0x05eec8d4
-0, 705705, 1048, 0x3b19cb96
-0, 708708, 944, 0xaad89770
-0, 711711, 960, 0x94649e4c
-0, 714714, 1079, 0x530ddaba
-0, 717717, 1150, 0x0339e696
-0, 720720, 5189, 0xb8dac0bf
-0, 723723, 1129, 0x3b2cd64d
-0, 726726, 962, 0xe9df9a07
-0, 729729, 1113, 0xc6ccddb2
-0, 732732, 1069, 0xf589d4a4
-0, 735735, 889, 0x5f7b8762
-0, 738738, 863, 0xe9c36be4
-0, 741741, 1021, 0xcfb5a737
-0, 744744, 1048, 0x203ac9ff
-0, 747747, 1223, 0x3e30fe35
-0, 750750, 814, 0x59c076fc
-0, 753753, 1157, 0x0dcf0bd0
-0, 756756, 1691, 0xdd030547
-0, 759759, 1700, 0x7641fb7e
-0, 762762, 1791, 0x57ac147b
-0, 765765, 2008, 0x3d4483ca
-0, 768768, 4579, 0x874aa75b
-0, 771771, 1647, 0xeddef621
-0, 774774, 1999, 0x61d4a23a
-0, 777777, 1572, 0x1c3ae6e1
-0, 780780, 1803, 0xb31c3a11
-0, 783783, 1919, 0xccbf64e3
-0, 786786, 1720, 0xa4d010e5
-0, 789789, 1721, 0x87ee0c7b
-0, 792792, 1626, 0x8211f3d0
-0, 795795, 1675, 0xef8a0b3d
-0, 798798, 1609, 0x8731ce06
-0, 801801, 1691, 0xcf24038b
-0, 804804, 1637, 0x21d8e1b2
-0, 807807, 1546, 0xc597a700
-0, 810810, 1518, 0xb944bc11
-0, 813813, 1403, 0x999e59a8
-0, 816816, 2467, 0xe69f2507
-0, 819819, 531, 0x3c7cea7e
-0, 822822, 555, 0xdf20fb22
-0, 825825, 500, 0xebeee00d
-0, 828828, 446, 0x664cc711
-0, 831831, 521, 0xf223df4b
-0, 834834, 559, 0x4dc60028
-0, 837837, 593, 0xec440ba9
-0, 840840, 557, 0xef0100b1
-0, 843843, 602, 0x7b1cfd88
-0, 846846, 566, 0x77700a1d
-0, 849849, 523, 0x3df7eb64
-0, 852852, 482, 0x5da1dba9
-0, 855855, 541, 0x9c8ff3d7
-0, 858858, 572, 0x3e1204b2
-0, 861861, 549, 0x0921fe3d
-0, 864864, 2429, 0xba4fe5a8
-0, 867867, 495, 0xc35ade54
-0, 870870, 453, 0xcc66c9dc
-0, 873873, 421, 0x3aa7ce8f
-0, 876876, 448, 0x56c6d3d7
-0, 879879, 478, 0x4131d467
-0, 882882, 497, 0xac3ce3ca
-0, 885885, 470, 0x41b9d9d3
-0, 888888, 454, 0x44c2d956
-0, 891891, 460, 0x6629db01
-0, 894894, 488, 0x6be2dd68
-0, 897897, 512, 0xda4cf116
-0, 900900, 550, 0x6e990da9
-0, 903903, 561, 0x81180e5e
-0, 906906, 689, 0xe58a5a9a
-0, 909909, 548, 0xfa1417a9
-0, 912912, 2832, 0x942495a5
-0, 915915, 610, 0x6b201ab9
-0, 918918, 1015, 0x5f36b3f9
-0, 921921, 870, 0x14e48f0c
-0, 924924, 716, 0xf4034b52
-0, 927927, 763, 0xcbf4694e
-0, 930930, 778, 0xb9396764
-0, 933933, 831, 0x31999005
-0, 936936, 877, 0xc95e977f
-0, 939939, 836, 0xb56c7d61
-0, 942942, 853, 0x2d5980cf
-0, 945945, 861, 0x25629295
-0, 948948, 897, 0x0ff78a5f
-0, 951951, 1016, 0x4dd8cdfd
-0, 954954, 1117, 0x763f06c4
-0, 957957, 984, 0xcf7bc906
-0, 960960, 2750, 0xd428962d
-0, 963963, 995, 0x5cbdd6a4
-0, 966966, 894, 0xc42b9e25
-0, 969969, 1028, 0xdf8ad906
-0, 972972, 1059, 0x4c49f0cc
-0, 975975, 1122, 0x8880eed8
-0, 978978, 1007, 0xa9b4c243
-0, 981981, 1055, 0x6051dcd6
-0, 984984, 1293, 0xc3b32fa5
-0, 987987, 1101, 0xf986f9af
-0, 990990, 1272, 0x13883127
-0, 993993, 1037, 0xb97cebff
-0, 996996, 980, 0x0931d807
-0, 999999, 928, 0xbc3eb30b
-0, 1003002, 1068, 0x62d9e8de
-0, 1006005, 852, 0x9278a49a
-0, 1009008, 2841, 0x3091d12d
-0, 1012011, 931, 0x60f6c26e
-0, 1015014, 949, 0x31b9c856
-0, 1018017, 835, 0xfe018775
-0, 1021020, 779, 0x85356cd7
-0, 1024023, 748, 0x862756bf
-0, 1027026, 768, 0x0b7d645c
-0, 1030029, 786, 0x7c196f5b
-0, 1033032, 716, 0x4e8252cc
-0, 1036035, 671, 0x0b2d3023
-0, 1039038, 708, 0x3b2b4f25
-0, 1042041, 786, 0x523d670e
-0, 1045044, 680, 0x329142ec
-0, 1048047, 703, 0x841b456c
-0, 1051050, 660, 0x5cf332f1
-0, 1054053, 681, 0xcd7b3915
-0, 1057056, 2445, 0x27660ecb
-0, 1060059, 667, 0xf3d53d2a
-0, 1063062, 652, 0xe2b037b0
-0, 1066065, 695, 0x200248fc
-0, 1069068, 659, 0x7f6434c5
-0, 1072071, 682, 0x8d243afb
-0, 1075074, 701, 0x16e6476f
-0, 1078077, 636, 0x319a3236
-0, 1081080, 679, 0x81fa41f9
-0, 1084083, 740, 0xb32850af
-0, 1087086, 694, 0xe3f832c2
-0, 1090089, 681, 0x8174353f
-0, 1093092, 757, 0xebbe5a1f
-0, 1096095, 683, 0x9b46383c
-0, 1099098, 816, 0xd41e6bdf
-0, 1102101, 1058, 0x6170d2e6
-0, 1105104, 2489, 0x58fb28e1
-0, 1108107, 804, 0xb3037da8
-0, 1111110, 1053, 0x81ffc0a8
-0, 1114113, 868, 0xf73583cb
-0, 1117116, 875, 0xfa5d85bd
-0, 1120119, 723, 0x0714418d
-0, 1123122, 670, 0xd04333a1
-0, 1126125, 854, 0x370e730d
-0, 1129128, 794, 0x3d8a5e3c
-0, 1132131, 836, 0xebe26aa7
-0, 1135134, 871, 0x1da58c5e
-0, 1138137, 827, 0xda1e6ccb
-0, 1141140, 805, 0x10ad6a44
-0, 1144143, 831, 0x826f6fc9
-0, 1147146, 832, 0xb2517364
-0, 1150149, 887, 0x11bf8a3f
-0, 1153152, 2718, 0x26a8a174
-0, 1156155, 805, 0x4d0179f9
-0, 1159158, 699, 0x176c4f45
-0, 1162161, 758, 0xc1fc5b16
-0, 1165164, 707, 0x161b4891
-0, 1168167, 733, 0x99b554c0
-0, 1171170, 671, 0xccee2f89
-0, 1174173, 762, 0xd6416c9d
-0, 1177176, 721, 0x2ad94f0c
-0, 1180179, 727, 0x6280572e
-0, 1183182, 856, 0x0a7b797e
-0, 1186185, 843, 0xc64288aa
-0, 1189188, 877, 0x6d1c945d
-0, 1192191, 780, 0x4ba464e8
-0, 1195194, 808, 0xb3087cca
-0, 1198197, 870, 0x75809930
-0, 1201200, 2919, 0x5a80f685
-0, 1204203, 1027, 0xc98add3d
-0, 1207206, 1003, 0x0d88bd54
-0, 1210209, 1189, 0xb2f91ec7
-0, 1213212, 1320, 0x5acc4db3
-0, 1216215, 1381, 0xbd585feb
-0, 1219218, 1378, 0xe1a656f0
-0, 1222221, 1398, 0x88b57a5e
-0, 1225224, 1449, 0x1c737698
-0, 1228227, 1420, 0x6f0f80cd
-0, 1231230, 1032, 0x2d16d643
-0, 1234233, 1275, 0x38844729
-0, 1237236, 1112, 0x300207ea
-0, 1240239, 1105, 0xa2b700be
-0, 1243242, 1283, 0x08d04bef
-0, 1246245, 1056, 0xf795d994
-0, 1249248, 3202, 0xebf07050
-0, 1252251, 1034, 0x1099dbe5
-0, 1255254, 922, 0x88be9edc
-0, 1258257, 1050, 0xd3d7eb96
-0, 1261260, 979, 0x8de6b302
-0, 1264263, 1053, 0x5de2eca8
diff --git a/tests/ref/fate/loco-rgb b/tests/ref/fate/loco-rgb
deleted file mode 100644
index 4d2790b..0000000
--- a/tests/ref/fate/loco-rgb
+++ /dev/null
@@ -1,5 +0,0 @@
-0, 0, 72192, 0x1847500c
-0, 12780, 72192, 0x1b0e2e87
-0, 25560, 72192, 0x293276c8
-0, 38340, 72192, 0x743b9705
-0, 51120, 72192, 0xcc1b2530
diff --git a/tests/ref/fate/loco-yuy2 b/tests/ref/fate/loco-yuy2
deleted file mode 100644
index d3d68df..0000000
--- a/tests/ref/fate/loco-yuy2
+++ /dev/null
@@ -1,3 +0,0 @@
-0, 0, 48128, 0x7795782d
-0, 12780, 48128, 0x3d89bcf7
-0, 25560, 48128, 0x170d200a
diff --git a/tests/ref/fate/lossless-appleaudio b/tests/ref/fate/lossless-appleaudio
deleted file mode 100644
index df27061..0000000
--- a/tests/ref/fate/lossless-appleaudio
+++ /dev/null
@@ -1 +0,0 @@
-d0beb768d860b4776358077dd9fcb1e9
diff --git a/tests/ref/fate/lossless-meridianaudio b/tests/ref/fate/lossless-meridianaudio
deleted file mode 100644
index 7f6f43f..0000000
--- a/tests/ref/fate/lossless-meridianaudio
+++ /dev/null
@@ -1 +0,0 @@
-b3d0c9523c42fae639f7074e60281509
diff --git a/tests/ref/fate/lossless-monkeysaudio b/tests/ref/fate/lossless-monkeysaudio
deleted file mode 100644
index 4b8caa1..0000000
--- a/tests/ref/fate/lossless-monkeysaudio
+++ /dev/null
@@ -1 +0,0 @@
-a28d4e5f2192057f7d4bece870f40bd0
diff --git a/tests/ref/fate/lossless-shortenaudio b/tests/ref/fate/lossless-shortenaudio
deleted file mode 100644
index 9448052..0000000
--- a/tests/ref/fate/lossless-shortenaudio
+++ /dev/null
@@ -1 +0,0 @@
-9949141c405524f37ef1058b1ef4114b
diff --git a/tests/ref/fate/lossless-tta b/tests/ref/fate/lossless-tta
deleted file mode 100644
index 85b7a59..0000000
--- a/tests/ref/fate/lossless-tta
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0xb2b8b6d9
diff --git a/tests/ref/fate/lossless-wavpackaudio b/tests/ref/fate/lossless-wavpackaudio
deleted file mode 100644
index 6281924..0000000
--- a/tests/ref/fate/lossless-wavpackaudio
+++ /dev/null
@@ -1 +0,0 @@
-97223f65c91213694a660d52f87f35aa
diff --git a/tests/ref/fate/maxis-xa b/tests/ref/fate/maxis-xa
deleted file mode 100644
index 0dd23db..0000000
--- a/tests/ref/fate/maxis-xa
+++ /dev/null
@@ -1 +0,0 @@
-b4cd52fc080bffefeea94ce7c116046f
diff --git a/tests/ref/fate/mimic b/tests/ref/fate/mimic
deleted file mode 100644
index 8195cdc..0000000
--- a/tests/ref/fate/mimic
+++ /dev/null
@@ -1,76 +0,0 @@
-0, 0, 115200, 0xa974d407
-0, 90, 115200, 0x72618b84
-0, 180, 115200, 0x87768573
-0, 270, 115200, 0x5d218e3e
-0, 360, 115200, 0x0c0db41c
-0, 450, 115200, 0xb777fd48
-0, 540, 115200, 0x40765de7
-0, 630, 115200, 0x370a3c90
-0, 720, 115200, 0xc605785a
-0, 810, 115200, 0x49468b23
-0, 900, 115200, 0x986b6fd4
-0, 990, 115200, 0x30f22ef8
-0, 1080, 115200, 0xa90bd608
-0, 1170, 115200, 0x9cf36518
-0, 1260, 115200, 0x4ef1a679
-0, 1350, 115200, 0x0df65873
-0, 1440, 115200, 0xfecd4233
-0, 1530, 115200, 0xee2f26cb
-0, 1620, 115200, 0x795f612d
-0, 1710, 115200, 0xbbb90125
-0, 1800, 115200, 0x9230fb6e
-0, 1890, 115200, 0x11869996
-0, 1980, 115200, 0x6b5c892b
-0, 2070, 115200, 0x88bdb9cd
-0, 2160, 115200, 0x364bc5a0
-0, 2250, 115200, 0x6b66d817
-0, 2340, 115200, 0xd3a41252
-0, 2430, 115200, 0x0cf5612f
-0, 2520, 115200, 0x9752d055
-0, 2610, 115200, 0x486e9f6f
-0, 2700, 115200, 0x3eab62f8
-0, 2790, 115200, 0xa7f52762
-0, 2880, 115200, 0xfd4c4bbc
-0, 2970, 115200, 0x194023f6
-0, 3060, 115200, 0xd4668dad
-0, 3150, 115200, 0x6b20d64b
-0, 3240, 115200, 0xf2572aae
-0, 3330, 115200, 0xc3554f25
-0, 3420, 115200, 0xeeb5073a
-0, 3510, 115200, 0xbd46291f
-0, 3600, 115200, 0x0526838d
-0, 3690, 115200, 0x85b2e864
-0, 3780, 115200, 0xcfd894bc
-0, 3870, 115200, 0x644f10fb
-0, 3960, 115200, 0x556e4d88
-0, 4050, 115200, 0x93243614
-0, 4140, 115200, 0x754275c5
-0, 4230, 115200, 0x7f648bf3
-0, 4320, 115200, 0xece18c9b
-0, 4410, 115200, 0x385d52c1
-0, 4500, 115200, 0xafc58e4a
-0, 4590, 115200, 0x50daf750
-0, 4680, 115200, 0xf6bc67d1
-0, 4770, 115200, 0xb64b6e07
-0, 4860, 115200, 0x8751ed15
-0, 4950, 115200, 0x329ce803
-0, 5040, 115200, 0x40b2cb05
-0, 5130, 115200, 0x60f3517d
-0, 5220, 115200, 0xe0d46fdf
-0, 5310, 115200, 0x204529fa
-0, 5400, 115200, 0xd5afaf22
-0, 5490, 115200, 0xd3cb3d4c
-0, 5580, 115200, 0x87973a79
-0, 5670, 115200, 0xe3b2f917
-0, 5760, 115200, 0xf1923238
-0, 5850, 115200, 0x51494d71
-0, 5940, 115200, 0x58bc59bb
-0, 6030, 115200, 0xd0273fdb
-0, 6120, 115200, 0x6cc79700
-0, 6210, 115200, 0xc8172d31
-0, 6300, 115200, 0x8eb037ef
-0, 6390, 115200, 0xc0bc2d76
-0, 6480, 115200, 0x663c467a
-0, 6570, 115200, 0xd085e950
-0, 6660, 115200, 0x7d198d72
-0, 6750, 115200, 0x6ebacda0
diff --git a/tests/ref/fate/motionpixels b/tests/ref/fate/motionpixels
deleted file mode 100644
index e588ed3..0000000
--- a/tests/ref/fate/motionpixels
+++ /dev/null
@@ -1,112 +0,0 @@
-0, 0, 230400, 0xee05b509
-0, 6000, 230400, 0x71048964
-0, 12000, 230400, 0x2ebe4ba1
-0, 18000, 230400, 0xeedc45a6
-0, 24000, 230400, 0x218e8656
-0, 30000, 230400, 0x5792b17e
-0, 36000, 230400, 0x51b0a062
-0, 42000, 230400, 0x5dc4fd9c
-0, 48000, 230400, 0x9b0261b1
-0, 54000, 230400, 0x35086ffc
-0, 60000, 230400, 0xcf9352ff
-0, 66000, 230400, 0x0b5139a1
-0, 72000, 230400, 0x22e8a31e
-0, 78000, 230400, 0x82f61a81
-0, 84000, 230400, 0xc5741ab5
-0, 90000, 230400, 0xb5e7b2ff
-0, 96000, 230400, 0x583289ca
-0, 102001, 230400, 0xee52afbb
-0, 108001, 230400, 0xfdb4dc1a
-0, 114001, 230400, 0xf5ce99c0
-0, 120001, 230400, 0xae222255
-0, 126001, 230400, 0xc4f4439d
-0, 132001, 230400, 0x1758f224
-0, 138001, 230400, 0x5f517926
-0, 144001, 230400, 0x73a8bed8
-0, 150001, 230400, 0x7ef8410c
-0, 156001, 230400, 0xfcb693c7
-0, 162001, 230400, 0x5292832e
-0, 168001, 230400, 0x591261d7
-0, 174001, 230400, 0x28cca691
-0, 180001, 230400, 0x22cf40ef
-0, 186001, 230400, 0x517b10f9
-0, 192001, 230400, 0x8197e939
-0, 198001, 230400, 0x9654ffdb
-0, 204001, 230400, 0x803f10dd
-0, 210001, 230400, 0xff9f67af
-0, 216001, 230400, 0x4847244c
-0, 222001, 230400, 0xff31638f
-0, 228001, 230400, 0x9692def5
-0, 234001, 230400, 0x67f0a5fb
-0, 240001, 230400, 0xce192074
-0, 246001, 230400, 0x33d6c4a5
-0, 252001, 230400, 0xaf7b5a03
-0, 258001, 230400, 0xd956b0c0
-0, 264001, 230400, 0x58ff1a65
-0, 270001, 230400, 0x044758a1
-0, 276001, 230400, 0xe8045b65
-0, 282001, 230400, 0xf504c5fb
-0, 288001, 230400, 0x17a9a2b0
-0, 294001, 230400, 0xf68bab8c
-0, 300002, 230400, 0xd06dd0cb
-0, 306002, 230400, 0xc47d2673
-0, 312002, 230400, 0x2112f291
-0, 318002, 230400, 0x4c07c83c
-0, 324002, 230400, 0x22ca0113
-0, 330002, 230400, 0x25b0c8b1
-0, 336002, 230400, 0xb6afc645
-0, 342002, 230400, 0x663b1c09
-0, 348002, 230400, 0x9006ef1f
-0, 354002, 230400, 0x54f81b11
-0, 360002, 230400, 0x456b79f2
-0, 366002, 230400, 0xb08f24d0
-0, 372002, 230400, 0x652ad875
-0, 378002, 230400, 0xc6ecd67f
-0, 384002, 230400, 0x78dad721
-0, 390002, 230400, 0x1d2a4f71
-0, 396002, 230400, 0xc71721d1
-0, 402002, 230400, 0x64e3a7df
-0, 408002, 230400, 0x3bb18e71
-0, 414002, 230400, 0xb571d58c
-0, 420002, 230400, 0xdae6ed5c
-0, 426002, 230400, 0xdd91504b
-0, 432002, 230400, 0xd5a807a5
-0, 438002, 230400, 0x39a67b03
-0, 444002, 230400, 0xe245c8ac
-0, 450002, 230400, 0x5b0d7858
-0, 456002, 230400, 0x501b8097
-0, 462002, 230400, 0xf7b10d48
-0, 468002, 230400, 0x769db0bd
-0, 474002, 230400, 0x600f1086
-0, 480002, 230400, 0x874f5565
-0, 486002, 230400, 0x14322f73
-0, 492002, 230400, 0x0eaa36a5
-0, 498002, 230400, 0x97178d13
-0, 504003, 230400, 0xd4c7a0d1
-0, 510003, 230400, 0x1d424ec8
-0, 516003, 230400, 0x695ad8d9
-0, 522003, 230400, 0xe7cc3ecf
-0, 528003, 230400, 0xfd25fd8c
-0, 534003, 230400, 0xef4bc203
-0, 540003, 230400, 0x2a113bec
-0, 546003, 230400, 0x6e7ad403
-0, 552003, 230400, 0xc6714d2b
-0, 558003, 230400, 0x77df8ba6
-0, 564003, 230400, 0xcd283106
-0, 570003, 230400, 0xcb95676f
-0, 576003, 230400, 0xb0b70393
-0, 582003, 230400, 0x4c40bd63
-0, 588003, 230400, 0x557e8ccf
-0, 594003, 230400, 0x9d5934b2
-0, 600003, 230400, 0x43c1793f
-0, 606003, 230400, 0x0232361e
-0, 612003, 230400, 0x92ed91e4
-0, 618003, 230400, 0x99769789
-0, 624003, 230400, 0xd49c2c5b
-0, 630003, 230400, 0x66b03495
-0, 636003, 230400, 0xb88a4658
-0, 642003, 230400, 0x9c21e4c2
-0, 648003, 230400, 0xb343f372
-0, 654003, 230400, 0xf7f1e588
-0, 660003, 230400, 0x9682bdb2
-0, 666003, 230400, 0x538a3db8
diff --git a/tests/ref/fate/mpc7-demux b/tests/ref/fate/mpc7-demux
deleted file mode 100644
index f7f2f6e..0000000
--- a/tests/ref/fate/mpc7-demux
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0xdeb152dd
diff --git a/tests/ref/fate/mpc8-demux b/tests/ref/fate/mpc8-demux
deleted file mode 100644
index 85b0aa4..0000000
--- a/tests/ref/fate/mpc8-demux
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x5cdeaf0c
diff --git a/tests/ref/fate/mpeg4-als-conformance-00 b/tests/ref/fate/mpeg4-als-conformance-00
deleted file mode 100644
index 84a14c4..0000000
--- a/tests/ref/fate/mpeg4-als-conformance-00
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x7e67db0b
diff --git a/tests/ref/fate/mpeg4-als-conformance-01 b/tests/ref/fate/mpeg4-als-conformance-01
deleted file mode 100644
index 84a14c4..0000000
--- a/tests/ref/fate/mpeg4-als-conformance-01
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x7e67db0b
diff --git a/tests/ref/fate/mpeg4-als-conformance-02 b/tests/ref/fate/mpeg4-als-conformance-02
deleted file mode 100644
index 84a14c4..0000000
--- a/tests/ref/fate/mpeg4-als-conformance-02
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x7e67db0b
diff --git a/tests/ref/fate/mpeg4-als-conformance-03 b/tests/ref/fate/mpeg4-als-conformance-03
deleted file mode 100644
index 84a14c4..0000000
--- a/tests/ref/fate/mpeg4-als-conformance-03
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x7e67db0b
diff --git a/tests/ref/fate/mpeg4-als-conformance-04 b/tests/ref/fate/mpeg4-als-conformance-04
deleted file mode 100644
index 84a14c4..0000000
--- a/tests/ref/fate/mpeg4-als-conformance-04
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x7e67db0b
diff --git a/tests/ref/fate/mpeg4-als-conformance-05 b/tests/ref/fate/mpeg4-als-conformance-05
deleted file mode 100644
index 84a14c4..0000000
--- a/tests/ref/fate/mpeg4-als-conformance-05
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x7e67db0b
diff --git a/tests/ref/fate/msrle-8bit b/tests/ref/fate/msrle-8bit
deleted file mode 100644
index b2374cd..0000000
--- a/tests/ref/fate/msrle-8bit
+++ /dev/null
@@ -1,29 +0,0 @@
-0, 0, 11520, 0xaf416a66
-0, 15000, 11520, 0x8ab76654
-0, 30000, 11520, 0xd22880c4
-0, 45000, 11520, 0x9d2f612a
-0, 60000, 11520, 0xf538600a
-0, 75000, 11520, 0x371d64e6
-0, 90000, 11520, 0x49043fbf
-0, 105000, 11520, 0x49043fbf
-0, 120000, 11520, 0x12d16528
-0, 134999, 11520, 0x1e0a6109
-0, 149999, 11520, 0x9d2f612a
-0, 164999, 11520, 0x96e083ca
-0, 179999, 11520, 0x8ab76654
-0, 194999, 11520, 0x43ac6de7
-0, 209999, 11520, 0x43ac6de7
-0, 224999, 11520, 0x5c3e6819
-0, 239999, 11520, 0x22758af0
-0, 254999, 11520, 0x88845eba
-0, 269999, 11520, 0x4b38848a
-0, 284999, 11520, 0x4f7495d3
-0, 299999, 11520, 0x736b702c
-0, 314999, 11520, 0x736b702c
-0, 329999, 11520, 0x4f7495d3
-0, 344999, 11520, 0x4b38848a
-0, 359999, 11520, 0x88845eba
-0, 374999, 11520, 0x22758af0
-0, 389998, 11520, 0x5c3e6819
-0, 404998, 11520, 0x43ac6de7
-0, 419998, 11520, 0x43ac6de7
diff --git a/tests/ref/fate/msvideo1-16bit b/tests/ref/fate/msvideo1-16bit
deleted file mode 100644
index b403311..0000000
--- a/tests/ref/fate/msvideo1-16bit
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 65712, 0x917e0076
-0, 6006, 65712, 0xfe76fd1f
-0, 12013, 65712, 0xd85820ee
-0, 18019, 65712, 0x1b410f6e
-0, 24026, 65712, 0x53c50436
-0, 30032, 65712, 0xa191044d
-0, 36039, 65712, 0xcf02ff1f
-0, 42045, 65712, 0xc2abf85f
-0, 48051, 65712, 0xe273087e
-0, 54058, 65712, 0x087d0936
-0, 60064, 65712, 0x4e4f2e96
-0, 66071, 65712, 0x91b51896
-0, 72077, 65712, 0x2798450e
-0, 78083, 65712, 0x9fea1d06
-0, 84090, 65712, 0xc64a2506
-0, 90096, 65712, 0x0551fe07
-0, 96103, 65712, 0xc64a042e
-0, 102109, 65712, 0xf3680dc6
-0, 108116, 65712, 0x2ea5356e
-0, 114122, 65712, 0x0315ed3f
-0, 120128, 65712, 0xc1d1f917
-0, 126135, 65712, 0xc0f6e607
-0, 132141, 65712, 0x5b0a092e
-0, 138148, 65712, 0x1551f16f
-0, 144154, 65712, 0x8440ee87
-0, 150161, 65712, 0xf7581ae6
-0, 156167, 65712, 0xee67037e
-0, 162173, 65712, 0x4a212ca6
-0, 168180, 65712, 0x693e0aa6
-0, 174186, 65712, 0x13e31116
diff --git a/tests/ref/fate/msvideo1-8bit b/tests/ref/fate/msvideo1-8bit
deleted file mode 100644
index e0c7033..0000000
--- a/tests/ref/fate/msvideo1-8bit
+++ /dev/null
@@ -1,31 +0,0 @@
-0, 0, 57600, 0x8c3c5ee8
-0, 3000, 57600, 0xb79800b1
-0, 6000, 57600, 0x54a221be
-0, 9000, 57600, 0xb377ffb3
-0, 12000, 57600, 0x46efd210
-0, 15000, 57600, 0x46efd210
-0, 18000, 57600, 0x46efd210
-0, 21000, 57600, 0x92751fbc
-0, 24000, 57600, 0xd7287442
-0, 27000, 57600, 0xcf1153ee
-0, 30000, 57600, 0xda5de91a
-0, 33000, 57600, 0xa11cd513
-0, 36000, 57600, 0xa8edac2a
-0, 39000, 57600, 0xefd2a392
-0, 42000, 57600, 0x2d7060cf
-0, 45000, 57600, 0xbda3130d
-0, 48000, 57600, 0xacb8e940
-0, 50999, 57600, 0x93778985
-0, 53999, 57600, 0x25ed4d97
-0, 56999, 57600, 0x5be924bf
-0, 59999, 57600, 0xde5ee1f7
-0, 62999, 57600, 0x39850ab6
-0, 65999, 57600, 0x77da195d
-0, 68999, 57600, 0x6dad13c0
-0, 71999, 57600, 0x69897c48
-0, 74999, 57600, 0xfbe74728
-0, 77999, 57600, 0x908af79d
-0, 80999, 57600, 0x4ec4a868
-0, 83999, 57600, 0x7db370a1
-0, 86999, 57600, 0x2b1e52f6
-0, 89999, 57600, 0x2141467c
diff --git a/tests/ref/fate/mszh b/tests/ref/fate/mszh
deleted file mode 100644
index ba6221f..0000000
--- a/tests/ref/fate/mszh
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 253440, 0x94af61e5
diff --git a/tests/ref/fate/mtv b/tests/ref/fate/mtv
deleted file mode 100644
index d7dfa94..0000000
--- a/tests/ref/fate/mtv
+++ /dev/null
@@ -1,135 +0,0 @@
-1, 0, 417, 0xae1cc66a
-0, 0, 18432, 0xbd7e0ac8
-1, 2351, 418, 0xdc3ec850
-1, 4702, 418, 0x4e8ed05f
-0, 5625, 18432, 0xbd7e0ac8
-1, 7053, 418, 0xeb43d574
-1, 9404, 418, 0x9357c91d
-0, 11250, 18432, 0x902e0ab4
-1, 11755, 418, 0x5306d16b
-1, 14106, 418, 0x46e0d4da
-1, 16457, 418, 0xac11ce79
-0, 16875, 18432, 0xf1940b28
-1, 18808, 418, 0xffdfc4ad
-1, 21159, 418, 0xf8a8c2ff
-0, 22500, 18432, 0x2c180ac8
-1, 23510, 418, 0x2d66d83f
-1, 25861, 418, 0x65c0da12
-0, 28125, 18432, 0x2eae0b34
-1, 28212, 418, 0x0eafd20f
-1, 30563, 418, 0x8c6dd949
-1, 32914, 418, 0x9094c02d
-0, 33750, 18432, 0x2eae0b34
-1, 35265, 418, 0xb47bd944
-1, 37616, 418, 0x935ccce7
-0, 39375, 18432, 0x2eae0b34
-1, 39967, 418, 0x6e3ed020
-1, 42318, 418, 0x8922cd6c
-1, 44669, 418, 0xe811c8f8
-0, 45000, 18432, 0x2eae0b34
-1, 47020, 418, 0xb84adc72
-1, 49371, 418, 0xa2bbc5f4
-0, 50625, 18432, 0x2eae0b34
-1, 51722, 418, 0xec0cb67d
-1, 54073, 418, 0x89d1d014
-0, 56250, 18432, 0x2eae0b34
-1, 56424, 418, 0xfb5bc872
-1, 58776, 417, 0x8bfcc7a0
-1, 61127, 418, 0xeb4ac61b
-0, 61875, 18432, 0x2eae0b34
-1, 63478, 418, 0xd3cbc3c4
-1, 65829, 418, 0xa272d092
-0, 67500, 18432, 0x2eae0b34
-1, 68180, 418, 0x611ec37e
-1, 70531, 418, 0x70a3d423
-1, 72882, 418, 0xeff9ccf4
-0, 73125, 18432, 0x2eae0b34
-1, 75233, 418, 0x9788c65b
-1, 77584, 418, 0xe9a8cb8c
-0, 78750, 18432, 0x2eae0b34
-1, 79935, 418, 0x5834c300
-1, 82286, 418, 0xa4b8cd3a
-0, 84375, 18432, 0x2eae0b34
-1, 84637, 418, 0x6de2c7f9
-1, 86988, 418, 0x961bbbf3
-1, 89339, 418, 0x53edc13a
-0, 90000, 18432, 0x2c180ac8
-1, 91690, 418, 0x2fedc4b0
-1, 94041, 418, 0xb756c18b
-0, 95625, 18432, 0x2eae0b34
-1, 96392, 418, 0xaf0ed0e4
-1, 98743, 418, 0x019fd3f0
-1, 101094, 418, 0x6e29d83e
-0, 101250, 18432, 0x2c180ac8
-1, 103445, 418, 0x2ddad6bb
-1, 105796, 418, 0xafefca99
-0, 106875, 18432, 0x2eae0b34
-1, 108147, 418, 0x366ed013
-1, 110498, 418, 0x532ac7e0
-0, 112500, 18432, 0x2c180ac8
-1, 112849, 418, 0x1d0cd1ce
-1, 115200, 417, 0x572ad1e3
-1, 117551, 418, 0x858cd91f
-0, 118125, 18432, 0x2eae0b34
-1, 119902, 418, 0x82cacdfd
-1, 122253, 418, 0xf4dcc6ed
-0, 123750, 18432, 0x2c180ac8
-1, 124604, 418, 0x2cf3ca72
-1, 126955, 418, 0x5963c859
-1, 129306, 418, 0xa667c53d
-0, 129375, 18432, 0x2eae0b34
-1, 131657, 418, 0xb2f1d09c
-1, 134008, 418, 0x2ec1c8d3
-0, 135000, 18432, 0x2eae0b34
-1, 136359, 418, 0x5754d2e8
-1, 138710, 418, 0x1956bdba
-0, 140625, 18432, 0x2eae0b34
-1, 141061, 418, 0x3e18bd55
-1, 143412, 418, 0xe4cfc339
-1, 145763, 418, 0xb426c835
-0, 146250, 18432, 0x2eae0b34
-1, 148114, 418, 0xd7b6cbcf
-1, 150465, 418, 0x340ec315
-0, 151875, 18432, 0x2eae0b34
-1, 152816, 418, 0x23a9baec
-1, 155167, 418, 0x9f04cd01
-0, 157500, 18432, 0x2eae0b34
-1, 157518, 418, 0xa80ec223
-1, 159869, 418, 0x23d6bd5d
-1, 162220, 418, 0xcb25cf5b
-0, 163125, 18432, 0x2eae0b34
-1, 164571, 418, 0xccccc217
-1, 166922, 418, 0x757abbfe
-0, 168750, 18432, 0x2eae0b34
-1, 169273, 418, 0xa2e6cc68
-1, 171624, 418, 0xdf77cc05
-1, 173976, 417, 0xe9d2c5d5
-0, 174375, 18432, 0x2eae0b34
-1, 176327, 418, 0x50dec174
-1, 178678, 418, 0xf654b27e
-0, 180000, 18432, 0x2c180ac8
-1, 181029, 418, 0x4d8bc26e
-1, 183380, 418, 0xccd2bf37
-0, 185625, 18432, 0x2eae0b34
-1, 185731, 418, 0x6ce2c18a
-1, 188082, 418, 0xb3cdcf0c
-1, 190433, 418, 0x55eebe9a
-0, 191250, 18432, 0x2c180ac8
-1, 192784, 418, 0x9031c9ec
-1, 195135, 418, 0xb037c49d
-0, 196875, 18432, 0x2eae0b34
-1, 197486, 418, 0x377bcc78
-1, 199837, 418, 0x3762c725
-1, 202188, 418, 0x39afbd4d
-0, 202500, 18432, 0x2c180ac8
-1, 204539, 418, 0x655ed6cd
-1, 206890, 418, 0x09aec202
-0, 208125, 18432, 0x2eae0b34
-1, 209241, 418, 0xf2d2ce55
-1, 211592, 418, 0x254ebf04
-0, 213750, 18432, 0x2c180ac8
-1, 213943, 418, 0xa105cdcc
-1, 216294, 418, 0x1477ba58
-1, 218645, 418, 0x8d0dcdb2
-1, 220996, 418, 0x0d7cbef4
-1, 223347, 294, 0x5e2b87c4
diff --git a/tests/ref/fate/mxf-demux b/tests/ref/fate/mxf-demux
deleted file mode 100644
index 8774753..0000000
--- a/tests/ref/fate/mxf-demux
+++ /dev/null
@@ -1,97 +0,0 @@
-0, 0, 8468, 0xc0855553
-1, 0, 32000, 0x479155e6
-0, 3600, 3814, 0xa10783b4
-0, 7200, 3747, 0xb7bf6973
-0, 10800, 3705, 0x5462a600
-0, 14400, 3704, 0x1e564943
-0, 18000, 3760, 0x10464b9a
-0, 21600, 3799, 0xd41d6dcf
-0, 25200, 3832, 0x5cf6999e
-0, 28800, 3778, 0xe5fc7b9e
-0, 32400, 38193, 0xd34e5dd4
-0, 36000, 8520, 0x2a203e68
-0, 39600, 3832, 0xe4c4b2fe
-0, 43200, 3787, 0x0cf95fee
-0, 46800, 3766, 0x9e019d14
-0, 50400, 3785, 0x0ea9ae75
-0, 54000, 3703, 0x11d349ff
-0, 57600, 3731, 0x5cf358ef
-0, 61200, 3785, 0x01c8962f
-0, 64800, 3741, 0xb2c47d53
-0, 68400, 38150, 0x08fa1f55
-0, 72000, 8487, 0x0c234b9a
-0, 75600, 3791, 0x831192ef
-0, 79200, 3612, 0x598944fb
-0, 82800, 3710, 0xccbb711a
-0, 86400, 3864, 0x4385966e
-0, 90000, 3919, 0x24e2abc3
-0, 93600, 3777, 0x210c6219
-0, 97200, 3811, 0x23bf68c2
-0, 100800, 3802, 0x52688862
-0, 104400, 38027, 0x3d5aa8b9
-0, 108000, 8333, 0x617de950
-0, 111600, 3831, 0x13fad8fc
-0, 115200, 3719, 0xbc317470
-0, 118800, 3761, 0xeac460b6
-0, 122400, 3637, 0x27d64b32
-0, 126000, 3666, 0xf0f700a5
-0, 129600, 3788, 0x1c4662a8
-0, 133200, 3960, 0xef6b9e99
-0, 136800, 3793, 0x3a6ca832
-0, 140400, 38312, 0xce1317cc
-0, 144000, 8548, 0x4ca944d4
-0, 147600, 3866, 0x4e85bf0f
-0, 151200, 3644, 0x030338e5
-0, 154800, 3634, 0xa95f4512
-0, 158400, 3925, 0x7583ba86
-0, 162000, 3675, 0x979f423f
-0, 165600, 3703, 0x11375f7a
-0, 169200, 3705, 0xb7de5d16
-0, 172800, 3688, 0x1db45852
-0, 176400, 38412, 0x2ee26a63
-0, 180000, 8385, 0x0bc20a27
-1, 180000, 32000, 0x8f7e5009
-0, 183600, 3733, 0xa3e2a9a0
-0, 187200, 3773, 0x27769caa
-0, 190800, 3670, 0xc8335e98
-0, 194400, 3596, 0xd6512fb0
-0, 198000, 3579, 0xa621fbc2
-0, 201600, 3641, 0x2f4f46ca
-0, 205200, 3686, 0x0a92385a
-0, 208800, 3672, 0xe65137b9
-0, 212400, 39065, 0xc723bf8b
-0, 216000, 8611, 0x5d177f40
-0, 219600, 3758, 0x33d59966
-0, 223200, 3674, 0x54f37902
-0, 226800, 3615, 0xa0f045fa
-0, 230400, 3719, 0x41cf93ff
-0, 234000, 3757, 0x3a1b7e8f
-0, 237600, 3762, 0xe7f9714d
-0, 241200, 3738, 0x8121805b
-0, 244800, 3733, 0x13e262db
-0, 248400, 38433, 0x3d58c500
-0, 252000, 8410, 0xa4f7fd2e
-0, 255600, 3711, 0x0e112d3c
-0, 259200, 3692, 0xb46574b2
-0, 262800, 3563, 0xad43343d
-0, 266400, 3613, 0x5cd85c4f
-0, 270000, 3653, 0xe15a2853
-0, 273600, 3684, 0x9ddd58cb
-0, 277200, 3256, 0xd7f89f2e
-0, 280800, 3698, 0x2b82624a
-0, 284400, 39520, 0xd3f2b7c5
-0, 288000, 8493, 0x163559be
-0, 291600, 3719, 0x6fa0916f
-0, 295200, 3655, 0xa9233de1
-0, 298800, 3684, 0xa6125737
-0, 302400, 3688, 0xa9da6686
-0, 306000, 3685, 0x674d634e
-0, 309600, 3677, 0x7a85535d
-0, 313200, 3666, 0xce3600a2
-0, 316800, 3837, 0x3a7090e1
-0, 320400, 38696, 0x12c59cd2
-0, 324000, 8022, 0xd343433f
-0, 327600, 5157, 0x440c14e5
-0, 331200, 5003, 0xf8e1daff
-0, 334800, 4954, 0x89866344
-0, 338400, 53664, 0xeb0c4c42
diff --git a/tests/ref/fate/nc-demux b/tests/ref/fate/nc-demux
deleted file mode 100644
index adc03f0..0000000
--- a/tests/ref/fate/nc-demux
+++ /dev/null
@@ -1,91 +0,0 @@
-0, 0, 19787, 0x75e463f3
-0, 900, 11913, 0x0f429c34
-0, 1800, 14225, 0xbd3c704c
-0, 2700, 10357, 0xbf232393
-0, 3600, 9595, 0xf565d39e
-0, 4500, 9262, 0x2afd6ce0
-0, 5400, 12214, 0x6ae81d9b
-0, 6300, 13920, 0x31b5b307
-0, 7200, 10164, 0x141eca4e
-0, 8100, 9516, 0xd5f2c42b
-0, 9000, 10006, 0x80850a76
-0, 9900, 11791, 0x10bc2dcd
-0, 10800, 13756, 0xda1fee08
-0, 11700, 10452, 0xbb3d62b0
-0, 12600, 9171, 0x64ae10f6
-0, 13500, 8816, 0x31ad8fcb
-0, 14400, 13168, 0xea1085ac
-0, 15300, 12797, 0x25143d22
-0, 16200, 11324, 0x3a54b38e
-0, 17100, 9173, 0x8b2bf552
-0, 18000, 9247, 0x2e87226b
-0, 18900, 14140, 0x1063786c
-0, 19800, 14437, 0xde123a17
-0, 20700, 11938, 0x3f1168f4
-0, 21600, 11966, 0xdd6786ec
-0, 22500, 13213, 0x8ab27c58
-0, 23400, 11843, 0x90415d8b
-0, 24300, 13345, 0x3c0e1793
-0, 25200, 9977, 0x74fc7f4b
-0, 26100, 9158, 0x0b5426a5
-0, 27000, 12715, 0x0035d569
-0, 27900, 19944, 0xe2887ba8
-0, 28800, 12762, 0xb0f17939
-0, 29700, 10260, 0x182b27aa
-0, 30600, 7405, 0x227fe9bf
-0, 31500, 13317, 0x1a678c62
-0, 32400, 11304, 0x3277af6d
-0, 33300, 13291, 0xe267616a
-0, 34200, 8975, 0xe7eeacea
-0, 35100, 8473, 0x8bb1cbff
-0, 36000, 13878, 0xfd3d55bb
-0, 36900, 11278, 0x61c7c55e
-0, 37800, 13785, 0x2acbf88f
-0, 38700, 9521, 0x99e2d065
-0, 39600, 9340, 0xe5c96510
-0, 40500, 12777, 0x4c3c7844
-0, 41400, 10685, 0x39e0f42e
-0, 42300, 14237, 0x9398d07f
-0, 43200, 9021, 0x3343c7ec
-0, 44100, 9327, 0xad489e86
-0, 45000, 13507, 0xb1344f1c
-0, 45900, 10199, 0x9a8868bf
-0, 46800, 14535, 0xddb13f41
-0, 47700, 8773, 0x3d8b6a79
-0, 48600, 16084, 0x5d915de4
-0, 49500, 9156, 0x5cb08a6a
-0, 50400, 15027, 0xc23b1dc8
-0, 51300, 8240, 0xd6d3526c
-0, 52200, 8720, 0x439c43bf
-0, 53100, 13684, 0x18fc82f0
-0, 54000, 8829, 0xa3ebeb30
-0, 54900, 14650, 0x99e8678c
-0, 55800, 19626, 0x80a7ee5c
-0, 56700, 7762, 0x7c209a12
-0, 57600, 13636, 0xc89c1aa3
-0, 58500, 8337, 0x749bf76a
-0, 59400, 15098, 0xc98bc6dc
-0, 60300, 9070, 0xcd4cf7f1
-0, 61200, 8269, 0x90e95d54
-0, 62100, 12672, 0x034888d0
-0, 63000, 7519, 0x6c089672
-0, 63900, 14439, 0x5d2478b9
-0, 64800, 6928, 0x98fbaa67
-0, 65700, 8735, 0x07643f1e
-0, 66600, 13522, 0x55034cdb
-0, 67500, 7807, 0xf5983103
-0, 68400, 14484, 0xfc9cf260
-0, 69300, 7193, 0x170a0fa1
-0, 70200, 9444, 0x6f9be36f
-0, 71100, 12598, 0x69b7609d
-0, 72000, 7650, 0x1abaec9e
-0, 72900, 15162, 0x2a87f723
-0, 73800, 7752, 0xcca248aa
-0, 74700, 9085, 0x1ca7d7e5
-0, 75600, 13187, 0xababcc64
-0, 76500, 7968, 0x64a28f46
-0, 77400, 15474, 0xf34c587c
-0, 78300, 8615, 0x61301034
-0, 79200, 14129, 0x42c88bea
-0, 80100, 7223, 0x675d7500
-0, 81000, 3072, 0x4cb6254c
diff --git a/tests/ref/fate/nsv-demux b/tests/ref/fate/nsv-demux
deleted file mode 100644
index 620dfa0..0000000
--- a/tests/ref/fate/nsv-demux
+++ /dev/null
@@ -1,171 +0,0 @@
-0, 0, 12, 0x1396035f
-0, 6006, 24, 0x8ab80ac7
-0, 12012, 208, 0x1de1603e
-1, 12522, 104, 0x8ae85dc9
-1, 17224, 105, 0xb7033847
-0, 18018, 364, 0xffb4b341
-1, 21926, 104, 0x5f853482
-0, 24024, 456, 0x7a4deaeb
-1, 26628, 105, 0xfcb731fd
-0, 30030, 432, 0xf4ddd813
-1, 31330, 104, 0x4f8232bb
-1, 36032, 105, 0x2f543039
-0, 36036, 572, 0xc84c21ff
-1, 40734, 104, 0xe4cc34a1
-0, 42042, 500, 0x0e6bf9f4
-1, 45436, 105, 0xea663711
-0, 48048, 508, 0x2d6efe2a
-1, 50138, 104, 0x3c583098
-0, 54054, 436, 0x7d07d3c5
-1, 54840, 105, 0xbe6c33ff
-1, 59542, 104, 0x56de2d7a
-0, 60060, 620, 0xa9313342
-1, 64244, 105, 0x4e80385d
-0, 66066, 1384, 0x9b97c579
-1, 68946, 104, 0x34eb340d
-0, 72072, 760, 0xd1aa8183
-1, 73648, 105, 0x87e82f74
-0, 78078, 836, 0x261da980
-1, 78350, 104, 0xa546377d
-1, 83052, 105, 0x92bd349d
-0, 84084, 860, 0x52f0afa0
-1, 87754, 104, 0xdba53f3d
-0, 90090, 696, 0x63845855
-1, 92456, 105, 0xd3c3384e
-0, 96096, 460, 0x2916e7be
-1, 97158, 104, 0xdf7d30ce
-1, 101860, 105, 0xae20344e
-0, 102102, 328, 0xab8caaca
-1, 106562, 104, 0xe4cc33b7
-0, 108108, 396, 0xc775bc8e
-1, 111264, 105, 0xda993806
-0, 114114, 344, 0x114ea25a
-1, 115966, 104, 0xd6d12edd
-1, 120668, 105, 0x6b9c2ed5
-1, 125370, 104, 0xce6c3b04
-0, 126126, 532, 0xd5650f54
-1, 130072, 105, 0x31db399e
-1, 134775, 104, 0xd50b347a
-0, 138138, 476, 0x77f1f3a7
-1, 139477, 105, 0xe87734d6
-1, 144179, 104, 0x21873412
-0, 150150, 976, 0x2f7cf7ae
-1, 150420, 105, 0x29c03514
-1, 155122, 104, 0x91a5347a
-1, 159824, 105, 0xdbbf3696
-0, 162162, 104, 0x8fbf2f65
-1, 164526, 104, 0x3b463afc
-1, 169228, 105, 0xddf53845
-1, 173930, 104, 0x94c23d1a
-0, 174174, 652, 0xa9244ac0
-1, 178632, 105, 0xc0fd36c4
-1, 183334, 104, 0x36d535e0
-0, 186186, 152, 0x97804cc1
-1, 188036, 105, 0xe81a35da
-1, 192738, 104, 0x2b4e3699
-1, 197440, 105, 0x3978392c
-0, 198198, 156, 0xca434d31
-1, 202142, 104, 0xca903459
-0, 204204, 196, 0x1ff16161
-1, 206844, 105, 0xedc4374a
-0, 210210, 176, 0x9b455230
-1, 211546, 104, 0x0b3938d2
-0, 216216, 156, 0xbbbf4bf3
-1, 216249, 105, 0xb2653246
-1, 220951, 104, 0x76333479
-0, 222222, 220, 0x77a97152
-1, 225653, 105, 0x779138c4
-0, 228228, 204, 0x667d5ecf
-1, 230355, 104, 0xfe142f55
-0, 234234, 232, 0x3a266ccd
-1, 235057, 105, 0x39aa3410
-1, 239759, 104, 0x520f330d
-0, 240240, 308, 0x844a95b7
-1, 244461, 104, 0x1aad37b0
-0, 246246, 384, 0x71d2c695
-1, 249163, 105, 0x164038eb
-1, 253865, 104, 0x21d434bd
-0, 258258, 520, 0x4f9d012a
-1, 258567, 105, 0x9c1236d4
-1, 263269, 104, 0x6aa933c3
-1, 267971, 105, 0xec5c371e
-0, 270270, 648, 0xabd13b29
-1, 272673, 104, 0xedb33251
-1, 277375, 105, 0x4f953476
-1, 282077, 104, 0x7da13400
-0, 282282, 604, 0x006b328f
-1, 286779, 105, 0x57a83aaa
-1, 291481, 104, 0x8b822f2f
-0, 294294, 492, 0xa150fac1
-1, 296183, 105, 0x3b31341a
-1, 300885, 104, 0x74a4316d
-1, 305587, 105, 0x05013469
-0, 306306, 456, 0xd3e9e52c
-1, 310289, 104, 0xcc8932cb
-1, 314991, 105, 0xd9233422
-0, 318318, 340, 0x7229a1b7
-1, 319693, 104, 0x5c603350
-1, 324395, 105, 0x76e631bc
-1, 329097, 104, 0x657e3b35
-0, 330330, 280, 0x48948b60
-1, 333799, 105, 0x9d283226
-1, 338502, 104, 0x574936ef
-0, 342342, 304, 0x3ae68dcf
-1, 343204, 105, 0x1b923555
-1, 347906, 104, 0x2a9f3583
-1, 352608, 105, 0xb8cd306f
-0, 354354, 324, 0x005da2ab
-1, 357310, 104, 0xa21d3475
-1, 362012, 105, 0x651539ea
-0, 366366, 348, 0x3230a873
-1, 366714, 104, 0x7b7235b8
-1, 371416, 105, 0x2bbb337a
-1, 376118, 104, 0x26c332eb
-0, 378378, 336, 0x8655ad2d
-1, 380820, 105, 0x990838d8
-1, 385522, 104, 0x4dc63ad4
-1, 390224, 105, 0xfb8e3418
-0, 390390, 380, 0x742ebc44
-1, 394926, 104, 0x1882388e
-1, 399628, 105, 0xe6b534cc
-0, 402402, 340, 0xfc1aa74e
-1, 404330, 104, 0x60fe35d0
-1, 409032, 105, 0x5164354a
-1, 413734, 104, 0x92ee3115
-0, 414414, 332, 0x3cfba56c
-1, 418436, 105, 0x9b32327e
-1, 423138, 104, 0x9b9e394a
-0, 426426, 332, 0xc024ad4c
-1, 427840, 105, 0xce3c337f
-1, 432542, 104, 0x7a4e33c5
-0, 438438, 3432, 0xcdfcd1c9
-1, 440868, 105, 0x0e3d34eb
-1, 445570, 104, 0xd23e338e
-1, 450272, 105, 0x4abf340c
-0, 450450, 792, 0xe7df949f
-1, 454974, 104, 0xe7522e15
-1, 459676, 105, 0x995037ba
-0, 462462, 912, 0xbc61d549
-1, 464378, 104, 0x5ef12e9b
-1, 469080, 105, 0x5c3b3166
-1, 473782, 104, 0xfc38314b
-0, 474474, 956, 0x809bdff0
-1, 478484, 104, 0x5e3636e4
-1, 483186, 105, 0xae7b3345
-0, 486486, 652, 0x88d3484f
-1, 487888, 104, 0x635c317a
-1, 492590, 105, 0xa90c361a
-1, 497292, 104, 0x8f563594
-0, 498498, 1284, 0xecc37164
-1, 501468, 105, 0x028e3985
-1, 506170, 104, 0x4fd135f6
-0, 510510, 428, 0x4794e174
-1, 510872, 105, 0xaaf539ac
-1, 515574, 104, 0x668b3265
-1, 520276, 105, 0x74ad3b4b
-0, 522522, 460, 0x7253d94a
-1, 524978, 104, 0xbde5332f
-1, 529680, 105, 0xdc3631e7
-1, 534382, 104, 0x3e363a1e
-0, 534534, 24, 0x664206ba
-1, 539084, 105, 0x48b63926
diff --git a/tests/ref/fate/nuv b/tests/ref/fate/nuv
deleted file mode 100644
index 204a411..0000000
--- a/tests/ref/fate/nuv
+++ /dev/null
@@ -1,30 +0,0 @@
-1, 0, 4096, 0x00000000
-0, 0, 460800, 0x54aedafe
-1, 2090, 4096, 0x4dfae7a6
-0, 3003, 460800, 0x54aedafe
-1, 4180, 4096, 0x3fd9f5c6
-0, 6006, 460800, 0x54aedafe
-1, 6269, 4096, 0x7b86e310
-1, 8359, 4096, 0x611cece5
-0, 9009, 460800, 0x54aedafe
-1, 10449, 4096, 0xb7d8e872
-0, 12012, 460800, 0xb7aa8b56
-1, 12539, 4096, 0x072ef72b
-1, 14629, 4096, 0xb3560144
-0, 15015, 460800, 0x283ea3b5
-1, 16718, 4096, 0x0a3d119e
-0, 18018, 460800, 0x283ea3b5
-1, 18808, 4096, 0xbe391aa4
-1, 20898, 4096, 0x28f7c6e5
-0, 21021, 460800, 0x10e577de
-1, 22988, 4096, 0xca9d9df2
-0, 24024, 460800, 0x4e091ee2
-1, 25078, 4096, 0x5c6b95a9
-0, 27027, 460800, 0x2ea88828
-1, 27167, 4096, 0x0bdfc0bf
-1, 29257, 4096, 0xd95a9277
-0, 30030, 460800, 0x4b7f4df0
-1, 31347, 4096, 0xae2bef2c
-0, 33033, 460800, 0xb30eb322
-1, 33437, 4096, 0xbf031e83
-1, 35527, 4096, 0x4c83e2d1
diff --git a/tests/ref/fate/oma-demux b/tests/ref/fate/oma-demux
deleted file mode 100644
index 39fcf5a..0000000
--- a/tests/ref/fate/oma-demux
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0xdd181a1c
diff --git a/tests/ref/fate/pcm_dvd b/tests/ref/fate/pcm_dvd
deleted file mode 100644
index 475fce4..0000000
--- a/tests/ref/fate/pcm_dvd
+++ /dev/null
@@ -1,123 +0,0 @@
-0, 0, 1336, 0x8e3c0abc
-0, 626, 1336, 0x99c41108
-0, 1253, 1336, 0xd65be322
-0, 1879, 1336, 0x15b575fb
-0, 2505, 1336, 0x366f742a
-0, 3131, 1336, 0xed72ad83
-0, 3758, 1336, 0x73f21c93
-0, 4384, 1336, 0x4be7a770
-0, 5010, 1336, 0x69ecf80c
-0, 5636, 1336, 0x835dc0e5
-0, 6263, 1336, 0x3089458d
-0, 6889, 1336, 0xc73b8cdc
-0, 7515, 1336, 0xc1cdaa8f
-0, 8141, 1336, 0x47a49186
-0, 8768, 1336, 0x2db387e2
-0, 9394, 1336, 0x90da9a97
-0, 10020, 1336, 0xcd34a467
-0, 10646, 1336, 0xdca8bd29
-0, 11273, 1336, 0xa09f9da3
-0, 11899, 1336, 0x47c8acf6
-0, 12525, 1336, 0x94dfa20e
-0, 13151, 1336, 0x2123a5f6
-0, 13778, 1336, 0x2f1badde
-0, 14404, 1336, 0x47579528
-0, 15030, 1336, 0x028daa10
-0, 15656, 1336, 0x5ed7adcd
-0, 16283, 1336, 0xc5ee8f10
-0, 16909, 1336, 0xcfacb489
-0, 17535, 1336, 0x07de937b
-0, 18161, 1336, 0x07bd8f8b
-0, 18788, 1336, 0x4660912e
-0, 19414, 1336, 0x047f97ad
-0, 20040, 1336, 0xe0e8a11f
-0, 20666, 1336, 0xcd9898e6
-0, 21293, 1336, 0xccfda786
-0, 21919, 1336, 0xab1b9e40
-0, 22545, 1336, 0x2ea79ea1
-0, 23171, 1336, 0xade2ad7e
-0, 23798, 1336, 0xe5cf9684
-0, 24424, 1336, 0xb57184cf
-0, 25050, 1336, 0x0668a5ce
-0, 25676, 1336, 0x643a9d96
-0, 26303, 1336, 0x97dc8ecc
-0, 26929, 1336, 0x72c2b174
-0, 27555, 1336, 0xe39d8fc3
-0, 28181, 1336, 0x56fc76d2
-0, 28808, 1336, 0x91a884b3
-0, 29434, 1336, 0x7b039a4e
-0, 30060, 1336, 0x3770a9dd
-0, 30686, 1336, 0x317c9cb8
-0, 31313, 1336, 0xdd97ad48
-0, 31939, 1336, 0x98066c1b
-0, 32565, 1336, 0xecd3a31c
-0, 33191, 1336, 0x0578b329
-0, 33818, 1336, 0x6942881c
-0, 34444, 1336, 0x56b5af29
-0, 35070, 1336, 0xf111a48a
-0, 35696, 1336, 0x1f5a8d45
-0, 36323, 1336, 0x39abdded
-0, 36949, 1336, 0xdb997fe8
-0, 37575, 1336, 0xd7f0d0b2
-0, 38201, 1336, 0xf3219413
-0, 38828, 1336, 0x9d80899d
-0, 39454, 1336, 0x7238bd63
-0, 40080, 1336, 0x7376703e
-0, 40706, 1336, 0x0fd56d02
-0, 41333, 1336, 0xa6c0951e
-0, 41959, 1336, 0xfacb674e
-0, 42585, 1336, 0x805bd289
-0, 43211, 1336, 0xa2a51a12
-0, 43838, 1336, 0x8a75d91b
-0, 44464, 1336, 0x34b1ef80
-0, 45090, 1336, 0x902921e0
-0, 45716, 1336, 0xc2db7895
-0, 46343, 1336, 0x7a0db9e1
-0, 46969, 1336, 0x66a93277
-0, 47595, 1336, 0x30830a83
-0, 48221, 1336, 0x251cf132
-0, 48848, 1336, 0x08dd852c
-0, 49474, 1336, 0x22ea164c
-0, 50100, 1336, 0x3bdd91c4
-0, 50726, 1336, 0xa4c0fbd7
-0, 51353, 1336, 0x83aa81bd
-0, 51979, 1336, 0x8a7b0fdb
-0, 52605, 1336, 0x35c37b01
-0, 53231, 1336, 0xdede811e
-0, 53858, 1336, 0x7473a657
-0, 54484, 1336, 0x5b917e2b
-0, 55110, 1336, 0x1c5a7cfc
-0, 55736, 1336, 0xeb7bab0d
-0, 56363, 1336, 0x7337795c
-0, 56989, 1336, 0x68da9d08
-0, 57615, 1336, 0xe93b87fe
-0, 58241, 1336, 0xd4639f00
-0, 58868, 1336, 0x1070a91d
-0, 59494, 1336, 0x50e3788f
-0, 60120, 1336, 0x1dac6691
-0, 60746, 1336, 0xf62c709d
-0, 61373, 1336, 0x2369648d
-0, 61999, 1336, 0xbfc792e6
-0, 62625, 1336, 0x975eb8e3
-0, 63251, 1336, 0x35c49ba6
-0, 63878, 1336, 0xe6198aa9
-0, 64504, 1336, 0x99f37d9d
-0, 65130, 1336, 0x4815aff1
-0, 65756, 1336, 0x4fd366ca
-0, 66383, 1336, 0x43cf7bb4
-0, 67009, 1336, 0x14a576ac
-0, 67635, 1336, 0xc6986978
-0, 68261, 1336, 0x10f67dc4
-0, 68888, 1336, 0xcca07f7a
-0, 69514, 1336, 0x6d0a5dfe
-0, 70140, 1336, 0x4e0761ef
-0, 70766, 1336, 0x31368e66
-0, 71393, 1336, 0x14b895c1
-0, 72019, 1336, 0x4bb7c111
-0, 72645, 1336, 0x1676a8bb
-0, 73271, 1336, 0xddaaa459
-0, 73898, 1336, 0xc43eabce
-0, 74524, 1336, 0x4d9f8d54
-0, 75150, 1336, 0x0ac292cb
-0, 75776, 1336, 0x2d9c74e4
-0, 76403, 1336, 0xe73da38f
diff --git a/tests/ref/fate/psx-str b/tests/ref/fate/psx-str
deleted file mode 100644
index c0b9908..0000000
--- a/tests/ref/fate/psx-str
+++ /dev/null
@@ -1,200 +0,0 @@
-1, 0, 8064, 0x02260037
-0, 0, 115200, 0x6b106a56
-1, 4800, 8064, 0x4ee9f4e9
-0, 6000, 115200, 0x53c16930
-1, 9600, 8064, 0xf8fd82aa
-0, 12000, 115200, 0xe2126f03
-1, 14400, 8064, 0xc100792b
-0, 18000, 115200, 0xc3c18ba0
-1, 19200, 8064, 0xf11a5316
-1, 24000, 8064, 0x6937f8c0
-0, 24000, 115200, 0xe281b655
-1, 28800, 8064, 0xed194e42
-0, 30000, 115200, 0x7b1e0536
-1, 33600, 8064, 0x619ce54b
-0, 36000, 115200, 0xbbd868c5
-1, 38400, 8064, 0x544999ec
-0, 42000, 115200, 0xfc67bf8e
-1, 43200, 8064, 0x0ea877b4
-1, 48000, 8064, 0xb764d1c0
-0, 48000, 115200, 0xb463151c
-1, 52800, 8064, 0x7a2fd211
-0, 54000, 115200, 0x6e686846
-1, 57600, 8064, 0xff69f6c5
-0, 60000, 115200, 0xca36b835
-1, 62400, 8064, 0x26c11ec7
-0, 66000, 115200, 0x17b91efc
-1, 67200, 8064, 0xfb4ecc0c
-1, 72000, 8064, 0x111d799b
-0, 72000, 115200, 0xc051a49a
-1, 76800, 8064, 0xc704dc91
-0, 78000, 115200, 0xc68c227b
-1, 81600, 8064, 0xa9f372fb
-0, 84000, 115200, 0x9ba6b521
-1, 86400, 8064, 0xa3f0ad0f
-0, 90000, 115200, 0x09d56ecc
-1, 91200, 8064, 0x958719b9
-1, 96000, 8064, 0x9b011bf7
-0, 96000, 115200, 0xc20e3485
-1, 100800, 8064, 0x466d96fb
-0, 102000, 115200, 0xf07e2c48
-1, 105600, 8064, 0x6ed4eb29
-0, 108000, 115200, 0x551c6da1
-1, 110400, 8064, 0x066966db
-0, 114000, 115200, 0xed65bacd
-1, 115200, 8064, 0xf60fe0bc
-1, 120000, 8064, 0x2c845167
-0, 120000, 115200, 0x51a23a3b
-1, 124800, 8064, 0x7d63894f
-0, 126000, 115200, 0x559ddce1
-1, 129600, 8064, 0x0682ee36
-0, 132000, 115200, 0x1fef6373
-1, 134400, 8064, 0xcaeb7c70
-0, 138000, 115200, 0x11b2dece
-1, 139200, 8064, 0x93948697
-1, 144000, 8064, 0x5805f0d6
-0, 144000, 115200, 0x851b877c
-1, 148800, 8064, 0xcfb641ff
-0, 150000, 115200, 0x5f9a7c99
-1, 153600, 8064, 0xe3499bb1
-0, 156000, 115200, 0x9ffe6153
-1, 158400, 8064, 0x689fe483
-0, 162000, 115200, 0x950b0de8
-1, 163200, 8064, 0x1b8f2f2d
-1, 168000, 8064, 0x23852e71
-0, 168000, 115200, 0x6ec4c89a
-1, 172800, 8064, 0x15e7b298
-0, 174000, 115200, 0xa9234812
-1, 177600, 8064, 0x5345a9a3
-0, 180000, 115200, 0xc834f491
-1, 182400, 8064, 0x257b6ecf
-0, 186000, 115200, 0x2cc1a2aa
-1, 187200, 8064, 0xaf62836c
-1, 192000, 8064, 0xc3a401e3
-0, 192000, 115200, 0x5df53b71
-1, 196800, 8064, 0x2b98fdf1
-0, 198000, 115200, 0xe1d0cb31
-1, 201600, 8064, 0x37168697
-0, 204000, 115200, 0xa0d2f8ab
-1, 206400, 8064, 0x2d876c89
-0, 210000, 115200, 0x9342d739
-1, 211200, 8064, 0xc40a6ada
-1, 216000, 8064, 0xcca6b829
-0, 216000, 115200, 0x586bc658
-1, 220800, 8064, 0x6667550a
-0, 222000, 115200, 0x76902834
-1, 225600, 8064, 0x99c1b5cb
-0, 228000, 115200, 0x91f25616
-1, 230400, 8064, 0xc05d3ed3
-0, 234000, 115200, 0xce8c95fb
-1, 235200, 8064, 0xdd641781
-1, 240000, 8064, 0xa65d49dc
-0, 240000, 115200, 0xdf0d3de6
-1, 244800, 8064, 0x2a0d5df7
-0, 246000, 115200, 0x120db7ae
-1, 249600, 8064, 0xa6348438
-0, 252000, 115200, 0x2143e287
-1, 254400, 8064, 0xf2e1412d
-0, 258000, 115200, 0x2498d3b6
-1, 259200, 8064, 0xc41c6a7a
-1, 264000, 8064, 0x147edc3d
-0, 264000, 115200, 0x99975ff8
-1, 268800, 8064, 0x17e3cfe7
-0, 270000, 115200, 0xbad65f9f
-1, 273600, 8064, 0x01fe3969
-0, 276000, 115200, 0x5066605b
-1, 278400, 8064, 0xc437ac11
-0, 282000, 115200, 0x6f8a61a0
-1, 283200, 8064, 0xbbf747c1
-1, 288000, 8064, 0x2a4b88c0
-0, 288000, 115200, 0x80c96143
-1, 292800, 8064, 0xcd149c80
-0, 294000, 115200, 0x663c6198
-1, 297600, 8064, 0xcf339dfc
-0, 300000, 115200, 0x0354620b
-1, 302400, 8064, 0xc81ff84b
-0, 306000, 115200, 0xfe186346
-1, 307200, 8064, 0x4d978100
-1, 312000, 8064, 0x6da6665b
-0, 312000, 115200, 0x844962f8
-1, 316800, 8064, 0x12fa354f
-0, 318000, 115200, 0x917c672f
-1, 321600, 8064, 0x6baedae6
-0, 324000, 115200, 0x45086647
-1, 326400, 8064, 0xddd77327
-0, 330000, 115200, 0xace06816
-1, 331200, 8064, 0x0a31c118
-1, 336000, 8064, 0x7652ee6e
-0, 336000, 115200, 0x4ef26aa2
-1, 340800, 8064, 0x486a24cc
-0, 342000, 115200, 0xf2046bb3
-1, 345600, 8064, 0xf6cf01ee
-0, 348000, 115200, 0x846b6eb0
-1, 350400, 8064, 0x2a19e830
-0, 354000, 115200, 0x8a17716d
-1, 355200, 8064, 0xde675a31
-1, 360000, 8064, 0xeefcc9af
-0, 360000, 115200, 0x36127568
-1, 364800, 8064, 0xaec4c989
-0, 366000, 115200, 0x3e877b5c
-1, 369600, 8064, 0x16b73de9
-0, 372000, 115200, 0xea5681e8
-1, 374400, 8064, 0x188a582a
-0, 378000, 115200, 0x41bc8a39
-1, 379200, 8064, 0xc092e73d
-1, 384000, 8064, 0xf7ebca97
-0, 384000, 115200, 0x6f839446
-1, 388800, 8064, 0x170ce07a
-0, 390000, 115200, 0xef74a005
-1, 393600, 8064, 0xa0705384
-0, 396000, 115200, 0x4354b2c2
-1, 398400, 8064, 0xd0154a3c
-0, 402000, 115200, 0x4607cf99
-1, 403200, 8064, 0x57c73c6c
-1, 408000, 8064, 0x590c9ddb
-0, 408000, 115200, 0x4c18e8db
-1, 412800, 8064, 0x2cbe552f
-0, 414000, 115200, 0x04d71efb
-1, 417600, 8064, 0x0d286932
-0, 420000, 115200, 0x32f4b9ae
-1, 422400, 8064, 0x5931cea3
-0, 426000, 115200, 0x4dd48d01
-1, 427200, 8064, 0xaf0fb80d
-1, 432000, 8064, 0x7fb61e9b
-0, 432000, 115200, 0x5fa9627f
-1, 436800, 8064, 0xf17134bb
-0, 438000, 115200, 0x7a413f88
-1, 441600, 8064, 0xd647859a
-0, 444000, 115200, 0xf1b7e5b6
-1, 446400, 8064, 0x55a60921
-0, 450000, 115200, 0x3d720e05
-1, 451200, 8064, 0x3811fa58
-1, 456000, 8064, 0xaceeccea
-0, 456000, 115200, 0x49243fd8
-1, 460800, 8064, 0x5fcedf14
-0, 462000, 115200, 0x9834b697
-1, 465600, 8064, 0xd8c64abf
-0, 468000, 115200, 0x4b8bc217
-1, 470400, 8064, 0x79495e8d
-0, 474000, 115200, 0x3eaf5504
-1, 475200, 8064, 0x4b7db039
-1, 480000, 8064, 0x7152f86d
-0, 480000, 115200, 0x057a3701
-1, 484800, 8064, 0xd92cfc1a
-0, 486000, 115200, 0x6e88f21a
-1, 489600, 8064, 0x75c540ef
-0, 492000, 115200, 0x236c5226
-1, 494400, 8064, 0x9c03ef5e
-0, 498000, 115200, 0x92212d84
-1, 499200, 8064, 0x7b2911c8
-1, 504000, 8064, 0x69d9d553
-0, 504000, 115200, 0xf6b0a4ff
-1, 508800, 8064, 0xcb45d7c5
-0, 510000, 115200, 0xb49e9b4e
-1, 513600, 8064, 0x37ec8b0a
-0, 516000, 115200, 0x4a252440
-1, 518400, 8064, 0xe4354221
-0, 522000, 115200, 0x65f3339a
-1, 523200, 8064, 0xc0d91cdb
-1, 528000, 8064, 0xea0be175
-0, 528000, 115200, 0x38e40a20
diff --git a/tests/ref/fate/ptx b/tests/ref/fate/ptx
deleted file mode 100644
index e1688bb..0000000
--- a/tests/ref/fate/ptx
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 393216, 0xda280efc
diff --git a/tests/ref/fate/pva-demux b/tests/ref/fate/pva-demux
deleted file mode 100644
index 511f652..0000000
--- a/tests/ref/fate/pva-demux
+++ /dev/null
@@ -1,25 +0,0 @@
-1, 0, 384, 0x071abcc8
-1, 0, 384, 0x31c9aee0
-1, 2160, 384, 0xa50eaa94
-1, 4320, 384, 0x9e86ba0e
-1, 8640, 384, 0x2321b800
-1, 10800, 384, 0x2347afa8
-1, 12960, 384, 0x0831b8d3
-1, 15120, 384, 0xd5acafa1
-1, 17280, 384, 0xc975b9d2
-1, 19440, 384, 0x2e10b02a
-1, 21600, 384, 0x501eadd0
-1, 23760, 384, 0x153fc171
-1, 25920, 384, 0xc5f0b3c2
-1, 28080, 384, 0xf731b200
-1, 30240, 384, 0x2e16b713
-1, 32400, 384, 0x61f6bba9
-1, 34560, 384, 0x1b9eb0ff
-1, 36720, 384, 0x2ab4b7bd
-1, 38880, 384, 0xd66eb45c
-1, 41040, 384, 0x145ab426
-1, 43200, 384, 0x297cb370
-1, 45360, 384, 0x287bb6b7
-1, 47520, 384, 0xfddbb7df
-1, 49680, 384, 0xbbb2af0c
-1, 51840, 384, 0x8f03b5fc
diff --git a/tests/ref/fate/qcp-demux b/tests/ref/fate/qcp-demux
deleted file mode 100644
index cd7157d..0000000
--- a/tests/ref/fate/qcp-demux
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0x4f9f567a
diff --git a/tests/ref/fate/qpeg b/tests/ref/fate/qpeg
deleted file mode 100644
index b7d698c..0000000
--- a/tests/ref/fate/qpeg
+++ /dev/null
@@ -1,100 +0,0 @@
-0, 0, 230400, 0x0b712fba
-0, 3600, 230400, 0x30252ac7
-0, 7200, 230400, 0x6d98a787
-0, 10800, 230400, 0x5d1f6ce7
-0, 14400, 230400, 0xccb79136
-0, 18000, 230400, 0x394093e1
-0, 21600, 230400, 0x3e76c5e9
-0, 25200, 230400, 0xd6cdc8f1
-0, 28800, 230400, 0xd355371d
-0, 32400, 230400, 0x2c1519ca
-0, 36000, 230400, 0xd82427e1
-0, 39600, 230400, 0x4202e3b4
-0, 43200, 230400, 0x27c15cda
-0, 46800, 230400, 0x3fd7d5db
-0, 50400, 230400, 0x03838791
-0, 54000, 230400, 0x8253d774
-0, 57600, 230400, 0x833e9c9f
-0, 61200, 230400, 0xe30aba05
-0, 64800, 230400, 0x81056b68
-0, 68400, 230400, 0xe6454d37
-0, 72000, 230400, 0x6bb65f77
-0, 75600, 230400, 0x95b652eb
-0, 79200, 230400, 0x4f585a73
-0, 82800, 230400, 0x9bc2c9d8
-0, 86400, 230400, 0x09f00930
-0, 90000, 230400, 0x6be9d11a
-0, 93600, 230400, 0x5cdd4ea5
-0, 97200, 230400, 0x77508d67
-0, 100800, 230400, 0x76b21fdd
-0, 104400, 230400, 0x39e2dddb
-0, 108000, 230400, 0x8b16d389
-0, 111600, 230400, 0xb2b329fb
-0, 115200, 230400, 0x8e998c17
-0, 118800, 230400, 0x3852049f
-0, 122400, 230400, 0x5a7f6302
-0, 126000, 230400, 0xdd7d9d86
-0, 129600, 230400, 0x337298bd
-0, 133200, 230400, 0x2fa38668
-0, 136800, 230400, 0xfc42afcd
-0, 140400, 230400, 0x20ff7b1d
-0, 144000, 230400, 0xa9190f28
-0, 147600, 230400, 0x2ca26827
-0, 151200, 230400, 0x1106bd55
-0, 154800, 230400, 0xb965748e
-0, 158400, 230400, 0x2c2d2691
-0, 162000, 230400, 0x8096db4d
-0, 165600, 230400, 0x7b223871
-0, 169200, 230400, 0xf9edbca9
-0, 172800, 230400, 0x0e607f74
-0, 176400, 230400, 0x3e64ed79
-0, 180000, 230400, 0x2198f77a
-0, 183600, 230400, 0x3cf4925a
-0, 187200, 230400, 0x2de0ebdb
-0, 190800, 230400, 0x5104c55f
-0, 194400, 230400, 0xebd7f8f7
-0, 198000, 230400, 0xfce8a2ae
-0, 201600, 230400, 0xeb073121
-0, 205200, 230400, 0x8f2ed47d
-0, 208800, 230400, 0xdcb72934
-0, 212400, 230400, 0xf69e75a1
-0, 216000, 230400, 0xc45ab599
-0, 219600, 230400, 0x0d218766
-0, 223200, 230400, 0x4a6aafce
-0, 226800, 230400, 0x642153ca
-0, 230400, 230400, 0x8bd7a2a4
-0, 234000, 230400, 0x04abeeed
-0, 237600, 230400, 0x37bf9f2c
-0, 241200, 230400, 0x1d966ae5
-0, 244800, 230400, 0x3a2ef337
-0, 248400, 230400, 0x9edaf34f
-0, 252000, 230400, 0x7f3c0ff8
-0, 255600, 230400, 0x403cbdee
-0, 259200, 230400, 0x86b340e8
-0, 262800, 230400, 0x5a57c916
-0, 266400, 230400, 0x35763ab3
-0, 270000, 230400, 0xd135a1ba
-0, 273600, 230400, 0x56a7b1db
-0, 277200, 230400, 0x6e8d2910
-0, 280800, 230400, 0xc8d9c4e1
-0, 284400, 230400, 0xb61fd11f
-0, 288000, 230400, 0x8949b165
-0, 291600, 230400, 0x60082f69
-0, 295200, 230400, 0xf9c74a14
-0, 298800, 230400, 0x1f0af3f4
-0, 302400, 230400, 0x1abe4a3b
-0, 306000, 230400, 0xdf762ffb
-0, 309600, 230400, 0x38513b73
-0, 313200, 230400, 0xf3b01fcf
-0, 316800, 230400, 0xea7d486c
-0, 320400, 230400, 0xfabc7a89
-0, 324000, 230400, 0xc72f6977
-0, 327600, 230400, 0x1c9e4590
-0, 331200, 230400, 0x51abf71e
-0, 334800, 230400, 0x39c9d819
-0, 338400, 230400, 0xfc62d8e0
-0, 342000, 230400, 0x40bb8c0d
-0, 345600, 230400, 0xa0bd86d2
-0, 349200, 230400, 0x610dfe19
-0, 352800, 230400, 0x997e1572
-0, 356400, 230400, 0x49919319
diff --git a/tests/ref/fate/qt-alaw-mono b/tests/ref/fate/qt-alaw-mono
deleted file mode 100644
index fc23d57..0000000
--- a/tests/ref/fate/qt-alaw-mono
+++ /dev/null
@@ -1 +0,0 @@
-7257c296fbba7eedf688fcb667144f7b
diff --git a/tests/ref/fate/qt-alaw-stereo b/tests/ref/fate/qt-alaw-stereo
deleted file mode 100644
index 1a9af29..0000000
--- a/tests/ref/fate/qt-alaw-stereo
+++ /dev/null
@@ -1 +0,0 @@
-011d4aecaee697cc861012b7c25b5d40
diff --git a/tests/ref/fate/qt-ima4-mono b/tests/ref/fate/qt-ima4-mono
deleted file mode 100644
index 66767d5..0000000
--- a/tests/ref/fate/qt-ima4-mono
+++ /dev/null
@@ -1 +0,0 @@
-721b51fd66c3bb3dc49dd88d404188eb
diff --git a/tests/ref/fate/qt-ima4-stereo b/tests/ref/fate/qt-ima4-stereo
deleted file mode 100644
index 5e6b123..0000000
--- a/tests/ref/fate/qt-ima4-stereo
+++ /dev/null
@@ -1 +0,0 @@
-c9e4c21fb62eca34a533f3a9ad2e394a
diff --git a/tests/ref/fate/qt-mac3-mono b/tests/ref/fate/qt-mac3-mono
deleted file mode 100644
index c320e18..0000000
--- a/tests/ref/fate/qt-mac3-mono
+++ /dev/null
@@ -1 +0,0 @@
-728d89210e1c90a9185db729b0b6e8c0
diff --git a/tests/ref/fate/qt-mac3-stereo b/tests/ref/fate/qt-mac3-stereo
deleted file mode 100644
index 7b5ce45..0000000
--- a/tests/ref/fate/qt-mac3-stereo
+++ /dev/null
@@ -1 +0,0 @@
-2eef3c68fce3d18ec757bcbc0d369698
diff --git a/tests/ref/fate/qt-mac6-mono b/tests/ref/fate/qt-mac6-mono
deleted file mode 100644
index d4d5104..0000000
--- a/tests/ref/fate/qt-mac6-mono
+++ /dev/null
@@ -1 +0,0 @@
-eec238d2737365fba15da813e5a7fbc9
diff --git a/tests/ref/fate/qt-mac6-stereo b/tests/ref/fate/qt-mac6-stereo
deleted file mode 100644
index d018cb0..0000000
--- a/tests/ref/fate/qt-mac6-stereo
+++ /dev/null
@@ -1 +0,0 @@
-2716d66016d8230bcc0fe90586da97a9
diff --git a/tests/ref/fate/qt-msadpcm-stereo b/tests/ref/fate/qt-msadpcm-stereo
deleted file mode 100644
index 6b131c1..0000000
--- a/tests/ref/fate/qt-msadpcm-stereo
+++ /dev/null
@@ -1 +0,0 @@
-3b7554e9a186c30adfd2a86bae950f4a
diff --git a/tests/ref/fate/qt-msimaadpcm-stereo b/tests/ref/fate/qt-msimaadpcm-stereo
deleted file mode 100644
index cb6a481..0000000
--- a/tests/ref/fate/qt-msimaadpcm-stereo
+++ /dev/null
@@ -1 +0,0 @@
-1ee96f1efc09251a732621049dc5b66e
diff --git a/tests/ref/fate/qt-rawpcm-16bit-stereo-signed-be b/tests/ref/fate/qt-rawpcm-16bit-stereo-signed-be
deleted file mode 100644
index 2500ba2..0000000
--- a/tests/ref/fate/qt-rawpcm-16bit-stereo-signed-be
+++ /dev/null
@@ -1 +0,0 @@
-f0c0fd7615cdef66fa72f5816632ca9b
diff --git a/tests/ref/fate/qt-rawpcm-16bit-stereo-signed-le b/tests/ref/fate/qt-rawpcm-16bit-stereo-signed-le
deleted file mode 100644
index f0837d1..0000000
--- a/tests/ref/fate/qt-rawpcm-16bit-stereo-signed-le
+++ /dev/null
@@ -1 +0,0 @@
-0262b20b728f5bb95594e64e2173b2f2
diff --git a/tests/ref/fate/qt-rawpcm-8bit-mono-unsigned b/tests/ref/fate/qt-rawpcm-8bit-mono-unsigned
deleted file mode 100644
index 2b46dbc..0000000
--- a/tests/ref/fate/qt-rawpcm-8bit-mono-unsigned
+++ /dev/null
@@ -1 +0,0 @@
-c2dcec9b230dad733b6b877fbed36755
diff --git a/tests/ref/fate/qt-rawpcm-8bit-stereo-unsigned b/tests/ref/fate/qt-rawpcm-8bit-stereo-unsigned
deleted file mode 100644
index 701a515..0000000
--- a/tests/ref/fate/qt-rawpcm-8bit-stereo-unsigned
+++ /dev/null
@@ -1 +0,0 @@
-973cf68365c3d58ff60ba652433b3bd2
diff --git a/tests/ref/fate/qt-ulaw-mono b/tests/ref/fate/qt-ulaw-mono
deleted file mode 100644
index 62fbc4e..0000000
--- a/tests/ref/fate/qt-ulaw-mono
+++ /dev/null
@@ -1 +0,0 @@
-63075293c68079826146963e94f45ca6
diff --git a/tests/ref/fate/qt-ulaw-stereo b/tests/ref/fate/qt-ulaw-stereo
deleted file mode 100644
index 642f0cb..0000000
--- a/tests/ref/fate/qt-ulaw-stereo
+++ /dev/null
@@ -1 +0,0 @@
-96316117d444b06b2aa20877f7de36fd
diff --git a/tests/ref/fate/qtrle-16bit b/tests/ref/fate/qtrle-16bit
deleted file mode 100644
index 2f0ca48..0000000
--- a/tests/ref/fate/qtrle-16bit
+++ /dev/null
@@ -1,83 +0,0 @@
-0, 0, 57600, 0xe6b0a48c
-0, 6000, 57600, 0xe064d51c
-0, 12000, 57600, 0xbfce6b33
-0, 18000, 57600, 0x371bab02
-0, 24000, 57600, 0x0d2d7456
-0, 30000, 57600, 0x9184eecb
-0, 36000, 57600, 0xb482e8db
-0, 42000, 57600, 0x0f4cd4be
-0, 48000, 57600, 0xe276cccb
-0, 54000, 57600, 0x04c21c62
-0, 60000, 57600, 0x848960a2
-0, 66000, 57600, 0xc4c8cf03
-0, 72000, 57600, 0xb4094866
-0, 78000, 57600, 0xf22da043
-0, 84000, 57600, 0x6517b67b
-0, 90000, 57600, 0x23e39ccb
-0, 96000, 57600, 0x41525ca3
-0, 102000, 57600, 0xc3edc5f3
-0, 108000, 57600, 0x8ce81c7e
-0, 114000, 57600, 0x56829443
-0, 120000, 57600, 0x511ce287
-0, 126000, 57600, 0x8f029a5b
-0, 132000, 57600, 0x2b47cf43
-0, 138000, 57600, 0x8e7ecf4b
-0, 144000, 57600, 0xd620317e
-0, 150000, 57600, 0x5987646e
-0, 156000, 57600, 0xcfedb7df
-0, 162000, 57600, 0x33746e7b
-0, 168000, 57600, 0x1d318573
-0, 174000, 57600, 0xc851848b
-0, 180000, 57600, 0x939db1d7
-0, 186000, 57600, 0x1719aed3
-0, 192000, 57600, 0x1ba3e18c
-0, 198000, 57600, 0x04f355fb
-0, 204000, 57600, 0x6fafd5f4
-0, 210000, 57600, 0x434f800b
-0, 216000, 57600, 0xed42179b
-0, 222000, 57600, 0x3b33118b
-0, 228000, 57600, 0xf81880cb
-0, 234000, 57600, 0xd2c58e1b
-0, 240000, 57600, 0xd96f50eb
-0, 246000, 57600, 0x64ef63fb
-0, 252000, 57600, 0x7b14b6fc
-0, 258000, 57600, 0xeb1c9054
-0, 264000, 57600, 0x3b30c97c
-0, 270000, 57600, 0xc93e9484
-0, 276000, 57600, 0xe012c0cc
-0, 282000, 57600, 0x48e2dda4
-0, 288000, 57600, 0x13eb55fb
-0, 294000, 57600, 0xa5edbedc
-0, 300000, 57600, 0x0123a484
-0, 306000, 57600, 0xc624a7ac
-0, 312000, 57600, 0xd83cf45c
-0, 318000, 57600, 0x8f9bf4b4
-0, 324000, 57600, 0x2d494b8c
-0, 330000, 57600, 0xb246f07c
-0, 336000, 57600, 0x5750e67c
-0, 342000, 57600, 0x6643e9ac
-0, 348000, 57600, 0x8d3b86b3
-0, 354000, 57600, 0x4bb0546b
-0, 360000, 57600, 0xfe439333
-0, 366000, 57600, 0x0cc76233
-0, 372000, 57600, 0xb6fe40ae
-0, 378000, 57600, 0xf79fe0d7
-0, 384000, 57600, 0xdc90dcbb
-0, 390000, 57600, 0x371e7c2b
-0, 396000, 57600, 0x7c4590bb
-0, 402000, 57600, 0x66f5454b
-0, 408000, 57600, 0x1678ae5b
-0, 414000, 57600, 0x1ee8fdec
-0, 420000, 57600, 0x98d2a083
-0, 426000, 57600, 0x86d29e5b
-0, 432000, 57600, 0x23d2bc83
-0, 438000, 57600, 0x3fc729f2
-0, 444000, 57600, 0x821d61da
-0, 450000, 57600, 0xdd549e0e
-0, 456000, 57600, 0x641234e2
-0, 462000, 57600, 0x9a282112
-0, 468000, 57600, 0x6587e2fb
-0, 474000, 57600, 0x043d0cb2
-0, 480000, 57600, 0x90328707
-0, 486000, 57600, 0x5744d313
-0, 492000, 57600, 0x6e1b95cb
diff --git a/tests/ref/fate/qtrle-1bit b/tests/ref/fate/qtrle-1bit
deleted file mode 100644
index 040c9bf..0000000
--- a/tests/ref/fate/qtrle-1bit
+++ /dev/null
@@ -1,107 +0,0 @@
-0, 0, 9600, 0xc1632102
-1, 0, 2040, 0x0a157db4
-1, 4163, 2040, 0x00c63e08
-0, 7500, 9600, 0x0f6c0521
-1, 8327, 2040, 0xacf2a25b
-1, 12490, 2040, 0xd6189e85
-0, 15000, 9600, 0x04b90b5a
-1, 16653, 2040, 0x8276f843
-1, 20816, 2040, 0xadebae73
-0, 22500, 9600, 0x2ebd4500
-1, 24980, 2040, 0x5da76697
-1, 29143, 2040, 0x469d0ea7
-0, 30000, 9600, 0x726f46f4
-1, 33306, 2040, 0x0d7412e1
-1, 37469, 2040, 0x2f2cc63f
-0, 37500, 9600, 0x37f6968e
-1, 41633, 2040, 0x10106eb7
-0, 45000, 9600, 0x7305872e
-1, 45796, 2040, 0x300124c7
-1, 49959, 2040, 0xa329f8e8
-0, 52500, 9600, 0x222eff5e
-1, 54122, 2040, 0xcea35ca5
-1, 58286, 2040, 0x55105aef
-0, 60000, 9600, 0x9317e227
-1, 62449, 2040, 0x08980ce1
-1, 66612, 2040, 0x367faf24
-0, 67500, 9600, 0x421eee9d
-1, 70776, 2040, 0x75bfef06
-1, 74939, 2040, 0x34f1daf4
-0, 75000, 9600, 0xcbcfaaff
-1, 79102, 2040, 0x97050317
-0, 82500, 9600, 0xe7d43be2
-1, 83265, 2040, 0xd297c536
-1, 87429, 2040, 0xa8abad5a
-0, 90000, 9600, 0x0b71e28c
-1, 91592, 2040, 0x445ce8e0
-1, 95755, 2040, 0xa3f4d940
-0, 97500, 9600, 0xd6a050ca
-1, 99918, 2040, 0x0ebb7b26
-1, 104082, 2040, 0x4372f6f6
-0, 105000, 9600, 0x0ac6dbf5
-1, 108245, 2040, 0xd4365079
-1, 112408, 2040, 0x56f902f7
-0, 112500, 9600, 0x5c036038
-1, 116571, 2040, 0x4153938a
-0, 120000, 9600, 0x6e417ed6
-1, 120735, 2040, 0x14996d86
-1, 124898, 2040, 0x3f99c318
-0, 127500, 9600, 0x8bd0dc22
-1, 129061, 2040, 0x939978a5
-1, 133224, 2040, 0x7086bd44
-0, 135000, 9600, 0xdf3b0877
-1, 137388, 276, 0x25b89d22
-1, 137951, 2040, 0xf3edb106
-1, 142114, 2040, 0x0ca61430
-0, 142500, 9600, 0xae6e7823
-1, 146278, 2040, 0x7229c458
-0, 150000, 9600, 0x8ff0ac32
-1, 150441, 2040, 0xc37edd31
-1, 154604, 2040, 0xa3da98b4
-0, 157500, 9600, 0xa2d9e2ce
-1, 158767, 2040, 0x69704803
-1, 162931, 2040, 0xa79bf334
-0, 165000, 9600, 0x5fd92b65
-1, 167094, 2040, 0x59d8d4c4
-1, 171257, 2040, 0xf9ff0271
-0, 172500, 9600, 0x81c1c824
-1, 175420, 2040, 0xc4ced9d6
-1, 179584, 2040, 0x859f1912
-0, 180000, 9600, 0xb8a2ace4
-1, 183747, 2040, 0xe7955aa6
-0, 187500, 9600, 0x65b70404
-1, 187910, 2040, 0x374624fd
-1, 192073, 2040, 0x52121097
-0, 195000, 9600, 0xc5349eb2
-1, 196237, 2040, 0x660fe645
-1, 200400, 2040, 0xf624176a
-0, 202500, 9600, 0xf60cc2b8
-1, 204563, 2040, 0x1f2246dd
-1, 208727, 2040, 0x940e0a32
-0, 210000, 9600, 0x31474595
-1, 212890, 2040, 0x9c6d338c
-1, 217053, 2040, 0xfce0d30a
-0, 217500, 9600, 0xf602635b
-1, 221216, 2040, 0xd0ec9aa5
-0, 225000, 9600, 0x873cbd87
-1, 225380, 2040, 0x58012141
-1, 229543, 2040, 0xde67fc43
-0, 232500, 9600, 0xb9793ffe
-1, 233706, 2040, 0x6baa0450
-1, 237869, 2040, 0xf4f80252
-0, 240000, 9600, 0x42eb2831
-1, 242033, 2040, 0x0cd47ee3
-1, 246196, 2040, 0x129cbaa7
-0, 247500, 9600, 0x44cc1dab
-1, 250359, 2040, 0x5ef5c0a1
-1, 254522, 2040, 0xf660baa7
-0, 255000, 9600, 0xbdcbbb87
-1, 258686, 2040, 0xe48bc0a1
-0, 262500, 9600, 0x29c22df7
-1, 262849, 2040, 0xdfeabaa7
-1, 267012, 2040, 0xed04c0a1
-0, 270000, 9600, 0xde502ef5
-1, 271176, 2040, 0xd771baa7
-1, 275339, 300, 0x521f24e9
-1, 275951, 1476, 0x9b9394b1
-0, 277500, 9600, 0xaf311aeb
diff --git a/tests/ref/fate/qtrle-24bit b/tests/ref/fate/qtrle-24bit
deleted file mode 100644
index da8fec4..0000000
--- a/tests/ref/fate/qtrle-24bit
+++ /dev/null
@@ -1,34 +0,0 @@
-0, 0, 57600, 0x3718ad00
-0, 9000, 57600, 0x54861558
-0, 18000, 57600, 0xea1d6233
-0, 27000, 57600, 0xf669a2fd
-0, 36000, 57600, 0xc9f76f31
-0, 45000, 57600, 0xe23c6d7b
-0, 54000, 57600, 0xbc9d6167
-0, 63000, 57600, 0x0ca63477
-0, 72000, 57600, 0xc0850d22
-0, 81000, 57600, 0x735d10b2
-0, 90000, 57600, 0x561f3c4a
-0, 99000, 57600, 0x84db9cf1
-0, 108000, 57600, 0x9fb841f4
-0, 117000, 57600, 0xeaf262ab
-0, 126000, 57600, 0x264886b4
-0, 135000, 57600, 0x5edc5518
-0, 144000, 57600, 0xd3e60c72
-0, 153000, 57600, 0x9cabaed7
-0, 162000, 57600, 0x616716cf
-0, 171000, 57600, 0xa43f61aa
-0, 180000, 57600, 0xdba3a0bd
-0, 189000, 57600, 0xa7dd6dfa
-0, 198000, 57600, 0xc3fa6c84
-0, 207000, 57600, 0xb1275fb8
-0, 216000, 57600, 0x2e39331f
-0, 225000, 57600, 0x5b9e0bca
-0, 234000, 57600, 0x0e760f5a
-0, 243000, 57600, 0xc56c3e69
-0, 252000, 57600, 0x51da9fb8
-0, 261000, 57600, 0xe3a1432b
-0, 270000, 57600, 0xe1b360a3
-0, 279000, 57600, 0x30b383cd
-0, 288000, 57600, 0x950c5439
-0, 297000, 57600, 0x8f9d0ca2
diff --git a/tests/ref/fate/qtrle-2bit b/tests/ref/fate/qtrle-2bit
deleted file mode 100644
index c7e3fe6..0000000
--- a/tests/ref/fate/qtrle-2bit
+++ /dev/null
@@ -1,107 +0,0 @@
-0, 0, 230400, 0xb1ee55dc
-1, 0, 2040, 0x0a157db4
-1, 4163, 2040, 0x00c63e08
-0, 7500, 230400, 0x97c580bf
-1, 8327, 2040, 0xacf2a25b
-1, 12490, 2040, 0xd6189e85
-0, 15000, 230400, 0xd4bd57e8
-1, 16653, 2040, 0x8276f843
-1, 20816, 2040, 0xadebae73
-0, 22500, 230400, 0x412b79aa
-1, 24980, 2040, 0x5da76697
-1, 29143, 2040, 0x469d0ea7
-0, 30000, 230400, 0x928a44d1
-1, 33306, 2040, 0x0d7412e1
-1, 37469, 2040, 0x2f2cc63f
-0, 37500, 230400, 0x6bbdc0e4
-1, 41633, 2040, 0x10106eb7
-0, 45000, 230400, 0x382e960f
-1, 45796, 2040, 0x300124c7
-1, 49959, 2040, 0xa329f8e8
-0, 52500, 230400, 0x62c863ea
-1, 54122, 2040, 0xcea35ca5
-1, 58286, 2040, 0x55105aef
-0, 60000, 230400, 0xbfccd3ce
-1, 62449, 2040, 0x08980ce1
-1, 66612, 2040, 0x367faf24
-0, 67500, 230400, 0x1987cdd4
-1, 70776, 2040, 0x75bfef06
-1, 74939, 2040, 0x34f1daf4
-0, 75000, 230400, 0x40279727
-1, 79102, 2040, 0x97050317
-0, 82500, 230400, 0x9d4f6746
-1, 83265, 2040, 0xd297c536
-1, 87429, 2040, 0xa8abad5a
-0, 90000, 230400, 0x7b8a77ec
-1, 91592, 2040, 0x445ce8e0
-1, 95755, 2040, 0xa3f4d940
-0, 97500, 230400, 0x2ce7a781
-1, 99918, 2040, 0x0ebb7b26
-1, 104082, 2040, 0x4372f6f6
-0, 105000, 230400, 0xb749815e
-1, 108245, 2040, 0xd4365079
-1, 112408, 2040, 0x56f902f7
-0, 112500, 230400, 0x61c88610
-1, 116571, 2040, 0x4153938a
-0, 120000, 230400, 0x8449114d
-1, 120735, 2040, 0x14996d86
-1, 124898, 2040, 0x3f99c318
-0, 127500, 230400, 0x5f73e666
-1, 129061, 2040, 0x939978a5
-1, 133224, 2040, 0x7086bd44
-0, 135000, 230400, 0xbde53ce6
-1, 137388, 276, 0x25b89d22
-1, 137951, 2040, 0xf3edb106
-1, 142114, 2040, 0x0ca61430
-0, 142500, 230400, 0x8c7406fd
-1, 146278, 2040, 0x7229c458
-0, 150000, 230400, 0xf9e9a3ef
-1, 150441, 2040, 0xc37edd31
-1, 154604, 2040, 0xa3da98b4
-0, 157500, 230400, 0x7e0a3077
-1, 158767, 2040, 0x69704803
-1, 162931, 2040, 0xa79bf334
-0, 165000, 230400, 0xd9245c5f
-1, 167094, 2040, 0x59d8d4c4
-1, 171257, 2040, 0xf9ff0271
-0, 172500, 230400, 0x6d077ea2
-1, 175420, 2040, 0xc4ced9d6
-1, 179584, 2040, 0x859f1912
-0, 180000, 230400, 0xf622bb2a
-1, 183747, 2040, 0xe7955aa6
-0, 187500, 230400, 0x35292dc8
-1, 187910, 2040, 0x374624fd
-1, 192073, 2040, 0x52121097
-0, 195000, 230400, 0xc0cea946
-1, 196237, 2040, 0x660fe645
-1, 200400, 2040, 0xf624176a
-0, 202500, 230400, 0x98b27b60
-1, 204563, 2040, 0x1f2246dd
-1, 208727, 2040, 0x940e0a32
-0, 210000, 230400, 0x668ef6bd
-1, 212890, 2040, 0x9c6d338c
-1, 217053, 2040, 0xfce0d30a
-0, 217500, 230400, 0x6c07a31c
-1, 221216, 2040, 0xd0ec9aa5
-0, 225000, 230400, 0x0b4a6ae1
-1, 225380, 2040, 0x58012141
-1, 229543, 2040, 0xde67fc43
-0, 232500, 230400, 0x945b9878
-1, 233706, 2040, 0x6baa0450
-1, 237869, 2040, 0xf4f80252
-0, 240000, 230400, 0xab28031c
-1, 242033, 2040, 0x0cd47ee3
-1, 246196, 2040, 0x129cbaa7
-0, 247500, 230400, 0x977252b0
-1, 250359, 2040, 0x5ef5c0a1
-1, 254522, 2040, 0xf660baa7
-0, 255000, 230400, 0x6c3d9706
-1, 258686, 2040, 0xe48bc0a1
-0, 262500, 230400, 0xe053bc2a
-1, 262849, 2040, 0xdfeabaa7
-1, 267012, 2040, 0xed04c0a1
-0, 270000, 230400, 0x4cf2fc7c
-1, 271176, 2040, 0xd771baa7
-1, 275339, 300, 0x521f24e9
-1, 275951, 1476, 0x9b9394b1
-0, 277500, 230400, 0x610beda7
diff --git a/tests/ref/fate/qtrle-32bit b/tests/ref/fate/qtrle-32bit
deleted file mode 100644
index a5e9c8a..0000000
--- a/tests/ref/fate/qtrle-32bit
+++ /dev/null
@@ -1,26 +0,0 @@
-0, 0, 1036800, 0x2a90d062
-0, 3003, 1036800, 0x6565aded
-0, 6006, 1036800, 0xf0b587d2
-0, 9009, 1036800, 0xf0b4e53f
-0, 12012, 1036800, 0x5ba4b96a
-0, 15015, 1036800, 0x501df9c1
-0, 18018, 1036800, 0xcf45b940
-0, 21021, 1036800, 0xa454df07
-0, 24024, 1036800, 0xc504d152
-0, 27027, 1036800, 0xd90ecac7
-0, 30030, 1036800, 0xe30368df
-0, 33033, 1036800, 0x0ca35522
-0, 36036, 1036800, 0xe76b8d43
-0, 39039, 1036800, 0x7c85a447
-0, 42042, 1036800, 0x3e2d1b5f
-0, 45045, 1036800, 0x230fa5a6
-0, 48048, 1036800, 0x4fad025e
-0, 51051, 1036800, 0x7d3366ae
-0, 54054, 1036800, 0xa83720f7
-0, 57057, 1036800, 0x5dbd13b1
-0, 60060, 1036800, 0xd0ebd56d
-0, 63063, 1036800, 0x4d7c67f3
-0, 66066, 1036800, 0x226baa3f
-0, 69069, 1036800, 0xc0e93acf
-0, 72072, 1036800, 0x5a466c17
-0, 75075, 1036800, 0xfdb7d2ea
diff --git a/tests/ref/fate/qtrle-4bit b/tests/ref/fate/qtrle-4bit
deleted file mode 100644
index 5678096..0000000
--- a/tests/ref/fate/qtrle-4bit
+++ /dev/null
@@ -1,38 +0,0 @@
-0, 0, 230400, 0x0655b3d9
-0, 7500, 230400, 0x9c626fd3
-0, 15000, 230400, 0x5bc95868
-0, 22500, 230400, 0x55a38387
-0, 30000, 230400, 0xd3495b60
-0, 37500, 230400, 0xecdb2d15
-0, 45000, 230400, 0x7f9b373e
-0, 52500, 230400, 0x51caac22
-0, 60000, 230400, 0x0f2ac153
-0, 67500, 230400, 0xe5a6f9e7
-0, 75000, 230400, 0xfc2b2250
-0, 82500, 230400, 0x24e2da1b
-0, 90000, 230400, 0x2723d7dd
-0, 97500, 230400, 0x024a4989
-0, 105000, 230400, 0xdbafb92d
-0, 112500, 230400, 0x6b9b5056
-0, 120000, 230400, 0x010cabb4
-0, 127500, 230400, 0xf75bc1c0
-0, 135000, 230400, 0x6c7fd744
-0, 142500, 230400, 0xabe4371a
-0, 150000, 230400, 0xe41fb781
-0, 157500, 230400, 0x42c5649e
-0, 165000, 230400, 0xf5511deb
-0, 172500, 230400, 0xebf5ab32
-0, 180000, 230400, 0x44398194
-0, 187500, 230400, 0xfd63510c
-0, 195000, 230400, 0xa013975e
-0, 202500, 230400, 0xe0aa028d
-0, 210000, 230400, 0x349f6f3b
-0, 217500, 230400, 0x2446032c
-0, 225000, 230400, 0x648f122c
-0, 232500, 230400, 0xbda221fd
-0, 240000, 230400, 0xf0f97642
-0, 247500, 230400, 0x6a1737de
-0, 255000, 230400, 0x808a8179
-0, 262500, 230400, 0x121641cf
-0, 270000, 230400, 0x275d11ea
-0, 277500, 230400, 0x92adf2cf
diff --git a/tests/ref/fate/qtrle-8bit b/tests/ref/fate/qtrle-8bit
deleted file mode 100644
index 62f7482..0000000
--- a/tests/ref/fate/qtrle-8bit
+++ /dev/null
@@ -1,167 +0,0 @@
-0, 0, 921600, 0x1492e3ed
-0, 6000, 921600, 0x1492e3ed
-0, 12000, 921600, 0x1492e3ed
-0, 18000, 921600, 0x23ef4fc7
-0, 24000, 921600, 0x23ef4fc7
-0, 30000, 921600, 0xe406d4be
-0, 36000, 921600, 0xe406d4be
-0, 42000, 921600, 0xe406d4be
-0, 48000, 921600, 0x62b8b5a1
-0, 54000, 921600, 0x62b8b5a1
-0, 60000, 921600, 0x7d8ba674
-0, 66000, 921600, 0x7d8ba674
-0, 72000, 921600, 0x7d8ba674
-0, 78000, 921600, 0xfe666be7
-0, 84000, 921600, 0xfe666be7
-0, 90000, 921600, 0x721baec0
-0, 96000, 921600, 0x721baec0
-0, 102000, 921600, 0x721baec0
-0, 108000, 921600, 0xc237180a
-0, 114000, 921600, 0xc237180a
-0, 120000, 921600, 0xf03a7482
-0, 126000, 921600, 0xf03a7482
-0, 132000, 921600, 0xf03a7482
-0, 138000, 921600, 0x5612a391
-0, 144000, 921600, 0x5612a391
-0, 150000, 921600, 0x9dbcc46a
-0, 156000, 921600, 0x9dbcc46a
-0, 162000, 921600, 0x9dbcc46a
-0, 168000, 921600, 0xa128a5d5
-0, 174000, 921600, 0xa128a5d5
-0, 180000, 921600, 0x63e0025c
-0, 186000, 921600, 0x63e0025c
-0, 192000, 921600, 0x63e0025c
-0, 198000, 921600, 0x262359ed
-0, 204000, 921600, 0x262359ed
-0, 210000, 921600, 0x343688e8
-0, 216000, 921600, 0x343688e8
-0, 222000, 921600, 0x343688e8
-0, 228000, 921600, 0x343688e8
-0, 234000, 921600, 0x343688e8
-0, 240000, 921600, 0x343688e8
-0, 246000, 921600, 0x343688e8
-0, 252000, 921600, 0x343688e8
-0, 258000, 921600, 0x343688e8
-0, 264000, 921600, 0x343688e8
-0, 270000, 921600, 0xe4b29d57
-0, 276000, 921600, 0xe4b29d57
-0, 282000, 921600, 0xe4b29d57
-0, 288000, 921600, 0x198e8a4a
-0, 294000, 921600, 0x198e8a4a
-0, 300000, 921600, 0x0cad8dc9
-0, 306000, 921600, 0x0cad8dc9
-0, 312000, 921600, 0x0cad8dc9
-0, 318000, 921600, 0x1f74cf3d
-0, 324000, 921600, 0x1f74cf3d
-0, 330000, 921600, 0xec5b5449
-0, 336000, 921600, 0xec5b5449
-0, 342000, 921600, 0xec5b5449
-0, 348000, 921600, 0x39829711
-0, 354000, 921600, 0x39829711
-0, 360000, 921600, 0x6de5b9c6
-0, 366000, 921600, 0x6de5b9c6
-0, 372000, 921600, 0x6de5b9c6
-0, 378000, 921600, 0x47b0e9d4
-0, 384000, 921600, 0x47b0e9d4
-0, 390000, 921600, 0x756452b8
-0, 396000, 921600, 0x756452b8
-0, 402000, 921600, 0x756452b8
-0, 408000, 921600, 0x6fce3478
-0, 414000, 921600, 0x6fce3478
-0, 420000, 921600, 0x372397cd
-0, 426000, 921600, 0x372397cd
-0, 432000, 921600, 0x372397cd
-0, 438000, 921600, 0xe3999ba1
-0, 444000, 921600, 0xe3999ba1
-0, 450000, 921600, 0x6ba26b43
-0, 456000, 921600, 0x6ba26b43
-0, 462000, 921600, 0x6ba26b43
-0, 468000, 921600, 0x4e9ee49e
-0, 474000, 921600, 0x4e9ee49e
-0, 480000, 921600, 0xdb5fd6e7
-0, 486000, 921600, 0xdb5fd6e7
-0, 492000, 921600, 0xdb5fd6e7
-0, 498000, 921600, 0x8f2254a5
-0, 504000, 921600, 0x8f2254a5
-0, 510000, 921600, 0x8f2254a5
-0, 516000, 921600, 0x8f2254a5
-0, 522000, 921600, 0x8f2254a5
-0, 528000, 921600, 0x8f2254a5
-0, 534000, 921600, 0x8f2254a5
-0, 540000, 921600, 0x8f2254a5
-0, 546000, 921600, 0x8f2254a5
-0, 552000, 921600, 0x8f2254a5
-0, 558000, 921600, 0x57e95c32
-0, 564000, 921600, 0x57e95c32
-0, 570000, 921600, 0x41627a9b
-0, 576000, 921600, 0x41627a9b
-0, 582000, 921600, 0x41627a9b
-0, 588000, 921600, 0x7412dcee
-0, 594000, 921600, 0x7412dcee
-0, 600000, 921600, 0xaebe10ed
-0, 606000, 921600, 0xaebe10ed
-0, 612000, 921600, 0xaebe10ed
-0, 618000, 921600, 0x411a91f6
-0, 624000, 921600, 0x411a91f6
-0, 630000, 921600, 0xb059df3f
-0, 636000, 921600, 0xb059df3f
-0, 642000, 921600, 0xb059df3f
-0, 648000, 921600, 0x4d6f5a77
-0, 654000, 921600, 0x4d6f5a77
-0, 660000, 921600, 0xbbf06df4
-0, 666000, 921600, 0xbbf06df4
-0, 672000, 921600, 0xbbf06df4
-0, 678000, 921600, 0xe27f7bf6
-0, 684000, 921600, 0xe27f7bf6
-0, 690000, 921600, 0xd7e8360e
-0, 696000, 921600, 0xd7e8360e
-0, 702000, 921600, 0xd7e8360e
-0, 708000, 921600, 0x1dd4c344
-0, 714000, 921600, 0x1dd4c344
-0, 720000, 921600, 0x7995a7ce
-0, 726000, 921600, 0x7995a7ce
-0, 732000, 921600, 0x7995a7ce
-0, 738000, 921600, 0x2ef3c566
-0, 744000, 921600, 0x2ef3c566
-0, 750000, 921600, 0xf296736e
-0, 756000, 921600, 0xf296736e
-0, 762000, 921600, 0xf296736e
-0, 768000, 921600, 0xf296736e
-0, 774000, 921600, 0xf296736e
-0, 780000, 921600, 0xf296736e
-0, 786000, 921600, 0xf296736e
-0, 792000, 921600, 0xf296736e
-0, 798000, 921600, 0xf296736e
-0, 804000, 921600, 0xf296736e
-0, 810000, 921600, 0x1a488311
-0, 816000, 921600, 0x1a488311
-0, 822000, 921600, 0x1a488311
-0, 828000, 921600, 0x9e28011b
-0, 834000, 921600, 0x9e28011b
-0, 840000, 921600, 0x84d1ea80
-0, 846000, 921600, 0x84d1ea80
-0, 852000, 921600, 0x84d1ea80
-0, 858000, 921600, 0x9ed41052
-0, 864000, 921600, 0x9ed41052
-0, 870000, 921600, 0xd4db7206
-0, 876000, 921600, 0xd4db7206
-0, 882000, 921600, 0xd4db7206
-0, 888000, 921600, 0x55f695a9
-0, 894000, 921600, 0x55f695a9
-0, 900000, 921600, 0x9d8c667f
-0, 906000, 921600, 0x9d8c667f
-0, 912000, 921600, 0x9d8c667f
-0, 918000, 921600, 0x9b6037ec
-0, 924000, 921600, 0x9b6037ec
-0, 930000, 921600, 0x57c5e835
-0, 936000, 921600, 0x57c5e835
-0, 942000, 921600, 0x57c5e835
-0, 948000, 921600, 0x476dad89
-0, 954000, 921600, 0x476dad89
-0, 960000, 921600, 0xcfd6ad2b
-0, 966000, 921600, 0xcfd6ad2b
-0, 972000, 921600, 0xcfd6ad2b
-0, 978000, 921600, 0x3b372379
-0, 984000, 921600, 0x3b372379
-0, 990000, 921600, 0x36f245f5
-0, 996000, 921600, 0x36f245f5
diff --git a/tests/ref/fate/quickdraw b/tests/ref/fate/quickdraw
deleted file mode 100644
index 5d6303b..0000000
--- a/tests/ref/fate/quickdraw
+++ /dev/null
@@ -1,2 +0,0 @@
-0, 0, 921600, 0xc0e68764
-0, 6000, 921600, 0x01a16629
diff --git a/tests/ref/fate/real-14_4 b/tests/ref/fate/real-14_4
deleted file mode 100644
index 4710566..0000000
--- a/tests/ref/fate/real-14_4
+++ /dev/null
@@ -1 +0,0 @@
-2da17ae831ea415592c7e6828e3fb69a
diff --git a/tests/ref/fate/real-rv40 b/tests/ref/fate/real-rv40
deleted file mode 100644
index 2a445d0..0000000
--- a/tests/ref/fate/real-rv40
+++ /dev/null
@@ -1,121 +0,0 @@
-0, 0, 276480, 0x5f7a0d4f
-0, 7500, 276480, 0x5f7a0d4f
-0, 15000, 276480, 0x5f7a0d4f
-0, 22500, 276480, 0x5f7a0d4f
-0, 30000, 276480, 0x5f7a0d4f
-0, 37500, 276480, 0x5f7a0d4f
-0, 45000, 276480, 0x5f7a0d4f
-0, 52500, 276480, 0x5f7a0d4f
-0, 60000, 276480, 0x5f7a0d4f
-0, 67500, 276480, 0x5f7a0d4f
-0, 75000, 276480, 0x5f7a0d4f
-0, 82500, 276480, 0x5f7a0d4f
-0, 90000, 276480, 0x5f7a0d4f
-0, 97500, 276480, 0x5f7a0d4f
-0, 105000, 276480, 0x5f7a0d4f
-0, 112500, 276480, 0x5f7a0d4f
-0, 120000, 276480, 0x5f7a0d4f
-0, 127500, 276480, 0x5f7a0d4f
-0, 135000, 276480, 0x2d722f8a
-0, 142500, 276480, 0xebbb3c8f
-0, 150000, 276480, 0x8574c868
-0, 157500, 276480, 0x4ec1e418
-0, 165000, 276480, 0x95f22651
-0, 172500, 276480, 0x071d897e
-0, 180000, 276480, 0x9f7623f9
-0, 187500, 276480, 0x86d4dedf
-0, 195000, 276480, 0xc0a0be22
-0, 202500, 276480, 0xc5902aec
-0, 210000, 276480, 0xe000f066
-0, 217500, 276480, 0x0b2a48d5
-0, 225000, 276480, 0xa1565256
-0, 232500, 276480, 0x8de3ceb3
-0, 240000, 276480, 0x654b564a
-0, 247500, 276480, 0xc9c57884
-0, 255000, 276480, 0x89cdcdd4
-0, 262500, 276480, 0x3594fe61
-0, 270000, 276480, 0x9d082a81
-0, 277500, 276480, 0x4e6cd0c3
-0, 285000, 276480, 0xc129765f
-0, 292500, 276480, 0x92a04c99
-0, 300000, 276480, 0x5ca62953
-0, 307500, 276480, 0xb7e478aa
-0, 315000, 276480, 0x932735d5
-0, 322500, 276480, 0xaaa2d7aa
-0, 330000, 276480, 0xd1329996
-0, 337500, 276480, 0x6de1e34b
-0, 345000, 276480, 0x8c963c9b
-0, 352500, 276480, 0xce6eff29
-0, 360000, 276480, 0x25412f7e
-0, 367500, 276480, 0x11a5ad85
-0, 375000, 276480, 0x26ea3248
-0, 382500, 276480, 0x86c35fa4
-0, 390000, 276480, 0xa98a2d38
-0, 397500, 276480, 0xed827333
-0, 405000, 276480, 0x5d44a824
-0, 412500, 276480, 0x46d54d04
-0, 420000, 276480, 0x413fd26a
-0, 427500, 276480, 0xf0b3b71b
-0, 435000, 276480, 0x459bc06d
-0, 442500, 276480, 0x4199cd45
-0, 450000, 276480, 0xa8d35683
-0, 457500, 276480, 0x9a3e7de0
-0, 465000, 276480, 0x5a30f666
-0, 472500, 276480, 0x40152668
-0, 480000, 276480, 0x90c4d22c
-0, 487500, 276480, 0x5cbaacc9
-0, 495000, 276480, 0x72b658f1
-0, 502500, 276480, 0x0ba3dcc9
-0, 510000, 276480, 0x259ed5c1
-0, 517500, 276480, 0x7fd73a99
-0, 525000, 276480, 0x488980c5
-0, 532500, 276480, 0x1d4c96a5
-0, 540000, 276480, 0x41ced7f2
-0, 547500, 276480, 0xd62d1837
-0, 555000, 276480, 0xf5fd9d20
-0, 562500, 276480, 0x2af91fda
-0, 570000, 276480, 0x38ce229d
-0, 577500, 276480, 0xf3a712c0
-0, 585000, 276480, 0x57b111d2
-0, 592500, 276480, 0x8556b792
-0, 600000, 276480, 0xb32d0896
-0, 607500, 276480, 0x923b9937
-0, 615000, 276480, 0x0da1e7e3
-0, 622500, 276480, 0x7f172382
-0, 630000, 276480, 0x93622b88
-0, 637500, 276480, 0x2599d540
-0, 645000, 276480, 0xed20c105
-0, 652500, 276480, 0x62ce256e
-0, 660000, 276480, 0x286a04bb
-0, 667500, 276480, 0x423f7e7c
-0, 675000, 276480, 0x21fc252a
-0, 682500, 276480, 0xf8a8e8ee
-0, 690000, 276480, 0x770d4a8d
-0, 697500, 276480, 0xaa12b6fd
-0, 705000, 276480, 0xdc7221a8
-0, 712500, 276480, 0x487eeb30
-0, 720000, 276480, 0x1e74f2db
-0, 727500, 276480, 0x40ae2bc3
-0, 735000, 276480, 0x9ca9b930
-0, 742500, 276480, 0x9fb19b0f
-0, 750000, 276480, 0x7bdf836c
-0, 757500, 276480, 0x1e607ba7
-0, 765000, 276480, 0xbd96578b
-0, 772500, 276480, 0x2124bf07
-0, 780000, 276480, 0x4895e27a
-0, 787500, 276480, 0x694d76e3
-0, 795000, 276480, 0xe70df513
-0, 802500, 276480, 0xcacafe6b
-0, 810000, 276480, 0x64087748
-0, 817500, 276480, 0x571fda23
-0, 825000, 276480, 0x8c86cbe9
-0, 832500, 276480, 0xc8ea4671
-0, 840000, 276480, 0xbfb74300
-0, 847500, 276480, 0xbe1e3770
-0, 855000, 276480, 0x757a0232
-0, 862500, 276480, 0xa5f50c84
-0, 870000, 276480, 0x6d95f808
-0, 877500, 276480, 0xf002c5ca
-0, 885000, 276480, 0x1a2abb26
-0, 892500, 276480, 0x6cf69bf2
-0, 900000, 276480, 0x8f316c66
diff --git a/tests/ref/fate/redcode-demux b/tests/ref/fate/redcode-demux
deleted file mode 100644
index 2a4db65..0000000
--- a/tests/ref/fate/redcode-demux
+++ /dev/null
@@ -1,5 +0,0 @@
-0, 0, 1626280, 0x5768c7d6
-1, 0, 14816, 0xd185e8c7
-0, 3754, 1626092, 0x070bd882
-1, 6803, 32736, 0x791b737a
-0, 7508, 893932, 0x8c7cd0a6
diff --git a/tests/ref/fate/rl2 b/tests/ref/fate/rl2
deleted file mode 100644
index 7a2146d..0000000
--- a/tests/ref/fate/rl2
+++ /dev/null
@@ -1,108 +0,0 @@
-0, 0, 192000, 0x7112a667
-0, 9559, 192000, 0x6936abf3
-0, 19118, 192000, 0xb1f08981
-0, 28678, 192000, 0x4ce7fece
-0, 38237, 192000, 0xf04decde
-0, 47796, 192000, 0x47fef74b
-0, 57355, 192000, 0x99b42ac2
-0, 66914, 192000, 0x3c4c419d
-0, 76473, 192000, 0x66bf5588
-0, 86033, 192000, 0xe1de4725
-0, 95592, 192000, 0x348b2af9
-0, 105151, 192000, 0x1ce73e83
-0, 114710, 192000, 0xcdaa6e02
-0, 124269, 192000, 0x370dc2ce
-0, 133829, 192000, 0x1e1e40fe
-0, 143388, 192000, 0x491470a4
-0, 152947, 192000, 0x88c43e9a
-0, 162506, 192000, 0x036f3f44
-0, 172065, 192000, 0xc8be7e25
-0, 181624, 192000, 0xbedb397d
-0, 191184, 192000, 0x97c410f4
-0, 200743, 192000, 0xc2c8225d
-0, 210302, 192000, 0xe396bccb
-0, 219861, 192000, 0x7e89c24c
-0, 229420, 192000, 0xb044954c
-0, 238980, 192000, 0x335890dd
-0, 248539, 192000, 0x58a457c0
-0, 258098, 192000, 0xeb0f4798
-0, 267657, 192000, 0x0bfc39a1
-0, 277216, 192000, 0x06a6905a
-0, 286776, 192000, 0x5300c99b
-0, 296335, 192000, 0x38f3f845
-0, 305894, 192000, 0x6afa3543
-0, 315453, 192000, 0x5106a8e0
-0, 325012, 192000, 0xc76f0dab
-0, 334571, 192000, 0x8efa6939
-0, 344131, 192000, 0x64ea23d7
-0, 353690, 192000, 0x421a2817
-0, 363249, 192000, 0xc854fa18
-0, 372808, 192000, 0x4a10d59c
-0, 382367, 192000, 0x72637829
-0, 391927, 192000, 0xdbbe2796
-0, 401486, 192000, 0xff742e6b
-0, 411045, 192000, 0xf94b9346
-0, 420604, 192000, 0xc90ea53c
-0, 430163, 192000, 0x177483bb
-0, 439722, 192000, 0x3510369c
-0, 449282, 192000, 0x501034bf
-0, 458841, 192000, 0x315c744b
-0, 468400, 192000, 0xdb5048ae
-0, 477959, 192000, 0x09a86221
-0, 487518, 192000, 0xb9c9568a
-0, 497078, 192000, 0x5eee665b
-0, 506637, 192000, 0xdef85517
-0, 516196, 192000, 0x7896b5ad
-0, 525755, 192000, 0x19fbad39
-0, 535314, 192000, 0x63358748
-0, 544873, 192000, 0xca0196a3
-0, 554433, 192000, 0x0b321da3
-0, 563992, 192000, 0xa07af07e
-0, 573551, 192000, 0x21f9310c
-0, 583110, 192000, 0x62d59874
-0, 592669, 192000, 0x021227b4
-0, 602229, 192000, 0x01dac0c2
-0, 611788, 192000, 0xf3c33a74
-0, 621347, 192000, 0xeebe83b7
-0, 630906, 192000, 0x9ec77f97
-0, 640465, 192000, 0xc91c2e37
-0, 650024, 192000, 0x7b58751d
-0, 659584, 192000, 0xb178dfbb
-0, 669143, 192000, 0x2a63b5be
-0, 678702, 192000, 0x44a407ac
-0, 688261, 192000, 0x9a8e17dd
-0, 697820, 192000, 0x5546f4c8
-0, 707380, 192000, 0xeda94586
-0, 716939, 192000, 0x941dfa6b
-0, 726498, 192000, 0x9772301d
-0, 736057, 192000, 0x8be16b16
-0, 745616, 192000, 0x26dd4496
-0, 755176, 192000, 0x27823797
-0, 764735, 192000, 0xacc914f7
-0, 774294, 192000, 0xcbb72c9b
-0, 783853, 192000, 0x4bd3391c
-0, 793412, 192000, 0x4e6adbfe
-0, 802971, 192000, 0x7a791c75
-0, 812531, 192000, 0xc4f59c94
-0, 822090, 192000, 0xc4f59c94
-0, 831649, 192000, 0x984a4a0b
-0, 841208, 192000, 0x3353f31f
-0, 850767, 192000, 0xa9d4dc5a
-0, 860327, 192000, 0xb33425d0
-0, 869886, 192000, 0x546d768a
-0, 879445, 192000, 0xfefbe5c9
-0, 889004, 192000, 0xbd6be61d
-0, 898563, 192000, 0xf5792731
-0, 908122, 192000, 0xccde0582
-0, 917682, 192000, 0x857d58ee
-0, 927241, 192000, 0xe914ce48
-0, 936800, 192000, 0x1f736298
-0, 946359, 192000, 0xec0b4846
-0, 955918, 192000, 0xe1422624
-0, 965478, 192000, 0x56e2b0e0
-0, 975037, 192000, 0xc4190640
-0, 984596, 192000, 0x7c461977
-0, 994155, 192000, 0x34b1d5e8
-0, 1003714, 192000, 0xbdc70f7a
-0, 1013273, 192000, 0xb466cd8d
-0, 1022833, 192000, 0x0e86a04c
diff --git a/tests/ref/fate/rpza b/tests/ref/fate/rpza
deleted file mode 100644
index 32ea1cf..0000000
--- a/tests/ref/fate/rpza
+++ /dev/null
@@ -1,30 +0,0 @@
-0, 0, 230400, 0x4aec80a3
-0, 6000, 230400, 0xb6c41452
-0, 12000, 230400, 0xa6c27f12
-0, 18000, 230400, 0x309bd2d2
-0, 24000, 230400, 0x597a7341
-0, 30000, 230400, 0x597a7341
-0, 36000, 230400, 0xd6d6c569
-0, 42000, 230400, 0x31413d89
-0, 48000, 230400, 0x464e42e9
-0, 54000, 230400, 0x502d7c71
-0, 60000, 230400, 0x502d7c71
-0, 66000, 230400, 0xc96f23d1
-0, 72000, 230400, 0xc96f23d1
-0, 78000, 230400, 0x5bfd2bc7
-0, 84000, 230400, 0x821640a7
-0, 90000, 230400, 0x8f001967
-0, 96000, 230400, 0x406ba109
-0, 102000, 230400, 0x85d99b50
-0, 108000, 230400, 0x2fdb4018
-0, 114000, 230400, 0xfa127259
-0, 120000, 230400, 0xe6427b9b
-0, 126000, 230400, 0xe6427b9b
-0, 132000, 230400, 0x3a279000
-0, 138000, 230400, 0x710755ee
-0, 144000, 230400, 0x76549d35
-0, 150000, 230400, 0xf4d0132c
-0, 156000, 230400, 0xf4d0132c
-0, 162000, 230400, 0x19d7ec14
-0, 168000, 230400, 0x19d7ec14
-0, 174000, 230400, 0x5f24b7e1
diff --git a/tests/ref/fate/sierra-audio b/tests/ref/fate/sierra-audio
deleted file mode 100644
index 16f226e..0000000
--- a/tests/ref/fate/sierra-audio
+++ /dev/null
@@ -1 +0,0 @@
-a99402e1f1a0f137608898251b3f309b
diff --git a/tests/ref/fate/sierra-vmd b/tests/ref/fate/sierra-vmd
deleted file mode 100644
index 4d9e4cd..0000000
--- a/tests/ref/fate/sierra-vmd
+++ /dev/null
@@ -1,303 +0,0 @@
-0, 0, 230400, 0x0224ab01
-1, 0, 123480, 0xc1059826
-0, 9000, 230400, 0x449e4d81
-0, 18000, 230400, 0x3e15e07a
-0, 27000, 230400, 0xdabe4172
-0, 36000, 230400, 0x0947b7db
-0, 45000, 230400, 0x934e243b
-0, 54000, 230400, 0x6b5c5b6c
-0, 63000, 230400, 0x4bf7bbb5
-0, 72000, 230400, 0x423eec8e
-0, 81000, 230400, 0x63663b5e
-0, 90000, 230400, 0x9c258a67
-0, 99000, 230400, 0x1c92b6e0
-0, 108000, 230400, 0xdd0a0e28
-0, 117000, 230400, 0x51d64af1
-0, 126000, 230400, 0x5776ac12
-0, 135000, 230400, 0x49070132
-0, 144000, 230400, 0xa59635ab
-0, 153000, 230400, 0xb1f99504
-0, 162000, 230400, 0x61fac725
-0, 171000, 230400, 0xc32c28d5
-0, 180000, 230400, 0x2b7a91d6
-0, 189000, 230400, 0x917be717
-0, 198000, 230400, 0xd3c5a2ff
-0, 207000, 230400, 0x0678a707
-0, 216000, 230400, 0x122504e6
-0, 225000, 230400, 0x76aebdae
-0, 234000, 230400, 0x81357545
-0, 243000, 230400, 0x38baeebd
-1, 252000, 4410, 0x261a09c0
-0, 252000, 230400, 0x1c5c44d4
-1, 261000, 4410, 0x68e9489e
-0, 261000, 230400, 0x60e189cc
-1, 270000, 4410, 0xb830827a
-0, 270000, 230400, 0xb1f4381c
-1, 279000, 4410, 0xb053b70c
-0, 279000, 230400, 0xb5048fed
-1, 288000, 4410, 0xd8845d5d
-0, 288000, 230400, 0xc947c30e
-1, 297000, 4410, 0xd741f940
-0, 297000, 230400, 0xe8e31c07
-1, 306000, 4410, 0x4860193c
-0, 306000, 230400, 0x6d49dd02
-1, 315000, 4410, 0x2e70df5f
-0, 315000, 230400, 0x293e15d3
-1, 324000, 4410, 0x4b3e0e54
-0, 324000, 230400, 0x354d792e
-1, 333000, 4410, 0x4afbf661
-0, 333000, 230400, 0x35468780
-1, 342000, 4410, 0x485c3903
-0, 342000, 230400, 0x365d3991
-1, 351000, 4410, 0xc0a1a00c
-0, 351000, 230400, 0xc9debef2
-1, 360000, 4410, 0x0ce2d38e
-0, 360000, 230400, 0x4c4634c2
-1, 369000, 4410, 0x5b52dfa3
-0, 369000, 230400, 0x347c2dca
-1, 378000, 4410, 0x0d6c02ba
-0, 378000, 230400, 0x1efa0aaa
-1, 387000, 4410, 0x55f31fe1
-0, 387000, 230400, 0xa79a0b5a
-1, 396000, 4410, 0x7350b1b2
-0, 396000, 230400, 0xfdb2dcdb
-1, 405000, 4410, 0x2b918eea
-0, 405000, 230400, 0x42dbea33
-1, 414000, 4410, 0x6df6cf92
-0, 414000, 230400, 0x2a207e43
-1, 423000, 4410, 0x2ddd1782
-0, 423000, 230400, 0x86573783
-1, 432000, 4410, 0x12265e8e
-0, 432000, 230400, 0xc3968473
-1, 441000, 4410, 0x00c62139
-0, 441000, 230400, 0x8f62a7b4
-1, 450000, 4410, 0xf2579b6c
-0, 450000, 230400, 0x5a2e3073
-1, 459000, 4410, 0x3bc24a12
-0, 459000, 230400, 0xd24f5e2c
-1, 468000, 4410, 0x0ce25212
-0, 468000, 230400, 0x1df3c67d
-1, 477000, 4410, 0xad70de9a
-0, 477000, 230400, 0xe4fd884d
-1, 486000, 4410, 0x232705e4
-0, 486000, 230400, 0x9a228555
-1, 495000, 4410, 0x5ceba444
-0, 495000, 230400, 0x9eba8ed5
-1, 504000, 4410, 0x17a3660b
-0, 504000, 230400, 0x3d808a3d
-1, 513000, 4410, 0x291bb07e
-0, 513000, 230400, 0xf57e866d
-1, 522000, 4410, 0xc13ccf88
-0, 522000, 230400, 0x85f594f5
-1, 531000, 4410, 0xfb0cd542
-0, 531000, 230400, 0xb09f99dd
-1, 540000, 4410, 0xb6438478
-0, 540000, 230400, 0x2b368475
-1, 549000, 4410, 0x263e9df2
-0, 549000, 230400, 0xa2417afd
-1, 558000, 4410, 0x81621e20
-0, 558000, 230400, 0x590b709d
-1, 567000, 4410, 0xe9a51d77
-0, 567000, 230400, 0x5d617705
-1, 576000, 4410, 0x69a3c758
-0, 576000, 230400, 0xabf981ad
-1, 585000, 4410, 0x725af958
-0, 585000, 230400, 0x5a8590cd
-1, 594000, 4410, 0x09db995d
-0, 594000, 230400, 0x1bff853d
-1, 603000, 4410, 0x42963941
-0, 603000, 230400, 0x71d08055
-1, 612000, 4410, 0x33a29bc4
-0, 612000, 230400, 0x2ebd817d
-1, 621000, 4410, 0x02ee2bd1
-0, 621000, 230400, 0x6e838255
-1, 630000, 4410, 0xda968535
-0, 630000, 230400, 0x043984cd
-1, 639000, 4410, 0x5414a080
-0, 639000, 230400, 0x7ff18495
-1, 648000, 4410, 0x021ac433
-0, 648000, 230400, 0xa43b8385
-1, 657000, 4410, 0x50195048
-0, 657000, 230400, 0x72b5825d
-1, 666000, 4410, 0xc40921c7
-0, 666000, 230400, 0x3a178085
-1, 675000, 4410, 0xdbb622e0
-0, 675000, 230400, 0x67748245
-1, 684000, 4410, 0xc8d07342
-0, 684000, 230400, 0xeddf81d5
-1, 693000, 4410, 0x6ed9b17a
-0, 693000, 230400, 0x8b088665
-1, 702000, 4410, 0x39ac6a03
-0, 702000, 230400, 0x6c408e15
-1, 711000, 4410, 0x119ed51c
-0, 711000, 230400, 0x81f196dd
-1, 720000, 4410, 0xc9a20539
-0, 720000, 230400, 0xab9f953d
-1, 729000, 4410, 0x6db5fdbd
-0, 729000, 230400, 0xa5f69795
-1, 738000, 4410, 0x64c6b468
-0, 738000, 230400, 0xa772950d
-1, 747000, 4410, 0x1286686e
-0, 747000, 230400, 0x6a5596d5
-1, 756000, 4410, 0x76632813
-0, 756000, 230400, 0x1355958d
-1, 765000, 4410, 0x9923669b
-0, 765000, 230400, 0x4134981d
-1, 774000, 4410, 0x1cf31b5c
-0, 774000, 230400, 0x8b929515
-1, 783000, 4410, 0xa9f14389
-0, 783000, 230400, 0x482f95c5
-1, 792000, 4410, 0x9438c5cc
-0, 792000, 230400, 0x7a9795d5
-1, 801000, 4410, 0x48dd0a72
-0, 801000, 230400, 0x21c29abd
-1, 810000, 4410, 0xb0fe24dd
-0, 810000, 230400, 0x9ae6a475
-1, 819000, 4410, 0xdb9d03ac
-0, 819000, 230400, 0x3734aee5
-1, 828000, 4410, 0x487d7ac3
-0, 828000, 230400, 0xa0a1b365
-1, 837000, 4410, 0x2b61d4d5
-0, 837000, 230400, 0x2dcab1c5
-1, 846000, 4410, 0xab934d9c
-0, 846000, 230400, 0x9c8b6c44
-1, 855000, 4410, 0xd2ee6f94
-0, 855000, 230400, 0x5da75feb
-1, 864000, 4410, 0x012c3002
-0, 864000, 230400, 0x4d02f8e3
-1, 873000, 4410, 0xfccbd3cc
-0, 873000, 230400, 0x66824f3a
-1, 882000, 4410, 0xe53230d8
-0, 882000, 230400, 0x0c9257e2
-1, 891000, 4410, 0x2f6a6102
-0, 891000, 230400, 0xb2927092
-1, 900000, 4410, 0x77bb876a
-0, 900000, 230400, 0xb5dc6e9a
-1, 909000, 4410, 0xbcb76718
-0, 909000, 230400, 0x6e567bc6
-1, 918000, 4410, 0x51c00790
-0, 918000, 230400, 0xbf9e0f7a
-1, 927000, 4410, 0x51b8fc5a
-0, 927000, 230400, 0xb16f684a
-1, 936000, 4410, 0x20fe9b42
-0, 936000, 230400, 0xf9e55e81
-1, 945000, 4410, 0x363c5566
-0, 945000, 230400, 0xd8d0bcba
-1, 954000, 4410, 0x3424a84c
-0, 954000, 230400, 0x44720ac0
-1, 963000, 4410, 0x7c3053c0
-0, 963000, 230400, 0x7d4c2058
-1, 972000, 4410, 0x368f2f30
-0, 972000, 230400, 0xb0973eb9
-1, 981000, 4410, 0x0f1e6fd2
-0, 981000, 230400, 0x405a13ce
-1, 990000, 4410, 0x3a1fe07e
-0, 990000, 230400, 0x6422f00a
-1, 999000, 4410, 0x74afd86a
-0, 999000, 230400, 0x924b6c1e
-1, 1008000, 4410, 0xfdf911dd
-0, 1008000, 230400, 0xcf7809c0
-1, 1017000, 4410, 0x1206a561
-0, 1017000, 230400, 0x883a3863
-1, 1026000, 4410, 0x5f0f33d5
-0, 1026000, 230400, 0x6adc9e03
-1, 1035000, 4410, 0xca3d88e0
-0, 1035000, 230400, 0x4f5ab7a8
-1, 1044000, 4410, 0xdf8f19ea
-0, 1044000, 230400, 0xdc0aab94
-1, 1053000, 4410, 0xe3275b9e
-1, 1062000, 4410, 0xee1945c5
-1, 1071000, 4410, 0x0afbd006
-1, 1080000, 4410, 0x90ff8f14
-1, 1089000, 4410, 0xfc0c887a
-1, 1098000, 4410, 0xae9bc232
-1, 1107000, 4410, 0x5f688eb8
-1, 1116000, 4410, 0x9a307469
-1, 1125000, 4410, 0x27f1e324
-1, 1134000, 4410, 0x0c0d4ca2
-1, 1143000, 4410, 0xd7e8ce74
-1, 1152000, 4410, 0x16a4bfd6
-1, 1161000, 4410, 0xbfb02f6d
-1, 1170000, 4410, 0xf4b81a79
-1, 1179000, 4410, 0x05d97288
-1, 1188000, 4410, 0x3a7db4be
-1, 1197000, 4410, 0xc6bea83e
-1, 1206000, 4410, 0x436f62ed
-1, 1215000, 4410, 0x6fabea0c
-1, 1224000, 4410, 0x954878aa
-1, 1233000, 4410, 0x4d10f579
-1, 1242000, 4410, 0xac65932a
-1, 1251000, 4410, 0x6889f957
-1, 1260000, 4410, 0x65cf5830
-1, 1269000, 4410, 0x87a7af71
-1, 1278000, 4410, 0x82378c13
-1, 1287000, 4410, 0x88ab6bd5
-1, 1296000, 4410, 0xf90a3342
-1, 1305000, 4410, 0xd790a1bc
-1, 1314000, 4410, 0x89919d7c
-1, 1323000, 4410, 0x7ffb22bf
-1, 1332000, 4410, 0xfefbcce3
-1, 1341000, 4410, 0x07714e80
-1, 1350000, 4410, 0x73078f53
-1, 1359000, 4410, 0x35c23078
-1, 1368000, 4410, 0x452538bb
-1, 1377000, 4410, 0x61493f33
-1, 1386000, 4410, 0x2137c390
-1, 1395000, 4410, 0x78c9393f
-1, 1404000, 4410, 0x7aeaf8e1
-1, 1413000, 4410, 0x4bb8da1c
-1, 1422000, 4410, 0x5995dfc2
-1, 1431000, 4410, 0xccce8872
-1, 1440000, 4410, 0xca2753a4
-1, 1449000, 4410, 0x4296ff6d
-1, 1458000, 4410, 0xe582d191
-1, 1467000, 4410, 0xc40268da
-1, 1476000, 4410, 0xda1d475e
-1, 1485000, 4410, 0x5e91e4e0
-1, 1494000, 4410, 0xfeb44475
-1, 1503000, 4410, 0x17ff8e38
-1, 1512000, 4410, 0x3bd58bcf
-1, 1521000, 4410, 0x9476e23c
-1, 1530000, 4410, 0x440651ab
-1, 1539000, 4410, 0xb08cdc74
-1, 1548000, 4410, 0x6fc3031f
-1, 1557000, 4410, 0x197ab39a
-1, 1566000, 4410, 0xf92f0e3d
-1, 1575000, 4410, 0xd5f6b678
-1, 1584000, 4410, 0x8af127a6
-1, 1593000, 4410, 0xe22f585e
-1, 1602000, 4410, 0x67515610
-1, 1611000, 4410, 0x21569d7a
-1, 1620000, 4410, 0x114597d8
-1, 1629000, 4410, 0xba213fb6
-1, 1638000, 4410, 0x1aca9fee
-1, 1647000, 4410, 0x48cdd264
-1, 1656000, 4410, 0x533619ec
-1, 1665000, 4410, 0x21466244
-1, 1674000, 4410, 0x26e00e88
-1, 1683000, 4410, 0x8e51d07c
-1, 1692000, 4410, 0xa6c4048a
-1, 1701000, 4410, 0x98ce10e4
-1, 1710000, 4410, 0x379bc8c2
-1, 1719000, 4410, 0x404b09c6
-1, 1728000, 4410, 0xfc89da8a
-1, 1737000, 4410, 0xbdbe6914
-1, 1746000, 4410, 0x2cb09f08
-1, 1755000, 4410, 0x835bf2d9
-1, 1764000, 4410, 0xa4611790
-1, 1773000, 4410, 0x67740896
-1, 1782000, 4410, 0x489f6bd0
-1, 1791000, 4410, 0x072bae9c
-1, 1800000, 4410, 0xadce5a89
-1, 1809000, 4410, 0x209f2c2c
-1, 1818000, 4410, 0xf5706665
-1, 1827000, 4410, 0x631841cb
-1, 1836000, 4410, 0xa1a2c65f
-1, 1845000, 4410, 0x8818b96b
-1, 1854000, 4410, 0x63158025
-1, 1863000, 4410, 0xf6ae79f5
-1, 1872000, 4410, 0xb3dcd214
-1, 1881000, 4410, 0x7a745449
-1, 1890000, 4410, 0x5d2b15f4
-1, 1899000, 4410, 0x48764b7c
-1, 1908000, 4410, 0x1294e119
diff --git a/tests/ref/fate/siff b/tests/ref/fate/siff
deleted file mode 100644
index 2f67254..0000000
--- a/tests/ref/fate/siff
+++ /dev/null
@@ -1,39 +0,0 @@
-1, 0, 44100, 0xd0a49e09
-0, 0, 230400, 0x3bd1d731
-0, 7500, 230400, 0x9d0774c3
-0, 15000, 230400, 0xa0faafe2
-0, 22500, 230400, 0x38325309
-0, 30000, 230400, 0xe90a1b1e
-0, 37500, 230400, 0x8efbc904
-0, 45000, 230400, 0x0a8476f3
-0, 52500, 230400, 0x5d94587d
-0, 60000, 230400, 0x280b905d
-0, 67500, 230400, 0x07178dd9
-0, 75000, 230400, 0xf52b8db4
-0, 82500, 230400, 0x2b70c1dc
-1, 90000, 44100, 0xf151af4d
-0, 90000, 230400, 0x8157a6e9
-0, 97500, 230400, 0xd4a3c357
-0, 105000, 230400, 0x703861bb
-0, 112500, 230400, 0xa13cf75e
-0, 120000, 230400, 0x140e487f
-0, 127500, 230400, 0x05cca333
-0, 135000, 230400, 0x0506ee2b
-0, 142500, 230400, 0xe3e13466
-0, 150000, 230400, 0x8a24118c
-0, 157500, 230400, 0x22050962
-0, 165000, 230400, 0x0f5c8a0d
-0, 172500, 230400, 0x3475df44
-1, 180000, 44100, 0xecd3cd08
-0, 180000, 230400, 0x65354e06
-0, 187500, 230400, 0xb9a01978
-0, 195000, 230400, 0x15207ee1
-0, 202500, 230400, 0x3b214f0b
-0, 210000, 230400, 0xf9461bbb
-0, 217500, 230400, 0x1469290f
-0, 225000, 230400, 0x8ddfd514
-0, 232500, 230400, 0x1bffa6a1
-0, 240000, 230400, 0x5a04d712
-0, 247500, 230400, 0xaa8de439
-0, 255000, 230400, 0x610c5439
-0, 262500, 230400, 0xd02d3e7c
diff --git a/tests/ref/fate/smacker b/tests/ref/fate/smacker
deleted file mode 100644
index 85c4a98..0000000
--- a/tests/ref/fate/smacker
+++ /dev/null
@@ -1,186 +0,0 @@
-0, 0, 192000, 0x8926d7fc
-1, 0, 47240, 0xad778a78
-0, 6390, 192000, 0x2506d384
-0, 12780, 192000, 0x9a8dc93a
-0, 19170, 192000, 0x4badb7f2
-0, 25560, 192000, 0xc1fc9631
-0, 31950, 192000, 0xfc906592
-0, 38340, 192000, 0xeddd28e2
-0, 44730, 192000, 0xeee0dcf5
-0, 51120, 192000, 0x76798c91
-0, 57510, 192000, 0x8a034c1b
-0, 63900, 192000, 0x4df3127c
-0, 70290, 192000, 0x2eefd36f
-0, 76680, 192000, 0x58a2a1d6
-0, 83070, 192000, 0x1a3d7971
-0, 89460, 192000, 0xa1a65bd5
-0, 95850, 192000, 0x344957b9
-1, 96408, 3128, 0x4c1564ae
-0, 102240, 192000, 0xe23b5f4e
-1, 102792, 3128, 0x34553309
-0, 108630, 192000, 0xb5c2710b
-1, 109176, 3136, 0xb474d246
-0, 115020, 192000, 0x7a25938f
-1, 115576, 3128, 0x87b868ea
-0, 121410, 192000, 0x0a84e4c9
-1, 121959, 3136, 0xf1516dc3
-0, 127800, 192000, 0x94209b0d
-1, 128359, 3128, 0x867563cb
-0, 134190, 192000, 0xf940e51f
-1, 134743, 3128, 0x5200728c
-0, 140580, 192000, 0xb9fdec42
-1, 141127, 3136, 0xeda118a0
-0, 146970, 192000, 0x7b04a376
-1, 147527, 3128, 0x03e2c1d6
-0, 153360, 192000, 0x5fe0026b
-1, 153910, 3136, 0xc3e862b6
-0, 159750, 192000, 0x775aca39
-1, 160310, 3128, 0x937a13be
-0, 166140, 192000, 0xae14fb32
-1, 166694, 3128, 0x7b1b9577
-0, 172530, 192000, 0x661106e5
-1, 173078, 3136, 0x042c7113
-0, 178920, 192000, 0xe8658dbf
-1, 179478, 3128, 0xac48f451
-0, 185310, 192000, 0x5359f0f9
-1, 185861, 3128, 0x018fbbe9
-0, 191700, 192000, 0xc1ec80f4
-1, 192245, 3136, 0xc62aa7ce
-0, 198090, 192000, 0xca53806b
-1, 198645, 3128, 0x106e3924
-0, 204480, 192000, 0xf0766b2e
-1, 205029, 3136, 0xfeb82ecc
-0, 210870, 192000, 0x39962da8
-1, 211429, 3128, 0x7e7c005b
-0, 217260, 192000, 0x4171c37f
-1, 217812, 3128, 0x949d3560
-0, 223650, 192000, 0x3abf3b46
-1, 224196, 3136, 0x02bd4aff
-0, 230040, 192000, 0xecc68313
-1, 230596, 3128, 0x4aaf4715
-0, 236430, 192000, 0xea339baf
-1, 236980, 3136, 0x2958825f
-0, 242820, 192000, 0x616b8f16
-1, 243380, 3128, 0x99a5914d
-0, 249210, 192000, 0xf77a8581
-1, 249763, 3128, 0xe67277a4
-0, 255600, 192000, 0xb315678b
-1, 256147, 3136, 0x11296973
-0, 261990, 192000, 0x0a4a5218
-1, 262547, 3128, 0x5cc362f7
-0, 268380, 192000, 0x98802be4
-1, 268931, 3128, 0x0c5e6586
-0, 274770, 192000, 0xa2f0fd94
-1, 275314, 3136, 0xe940b0f9
-0, 281160, 192000, 0x6671c84f
-1, 281714, 3128, 0x2c9292cc
-0, 287550, 192000, 0x38327e31
-1, 288098, 3136, 0xa807c096
-0, 293940, 192000, 0xb85d3e08
-1, 294498, 3128, 0x9d2254d8
-0, 300330, 192000, 0xdc69eba9
-1, 300882, 3128, 0xe68015b0
-0, 306720, 192000, 0x8955a0b3
-1, 307265, 3136, 0x65d58029
-0, 313110, 192000, 0x714a548b
-1, 313665, 3128, 0xcffcc48c
-0, 319500, 192000, 0xc0471de9
-1, 320049, 3136, 0x8c704944
-0, 325890, 192000, 0x2e16e039
-1, 326449, 3128, 0x1459231d
-0, 332280, 192000, 0x9fa4b033
-1, 332833, 3128, 0x7dde4839
-0, 338670, 192000, 0x4a0f9402
-1, 339216, 3136, 0xbb6890e2
-0, 345060, 192000, 0x1f3e6843
-1, 345616, 3128, 0xcd9a8524
-0, 351450, 192000, 0x31774850
-1, 352000, 3128, 0xa244fc31
-0, 357840, 192000, 0x9d5336a2
-1, 358384, 3136, 0x504e2bd9
-0, 364230, 192000, 0xf7de27a2
-1, 364784, 3128, 0x655858d8
-0, 370620, 192000, 0x98c717ce
-1, 371167, 3136, 0x46027610
-0, 377010, 192000, 0x615b10b8
-1, 377567, 3128, 0x4192d5e3
-0, 383400, 192000, 0xd5bc0e7e
-1, 383951, 3128, 0x21d2e7fe
-0, 389790, 192000, 0xd5bc0e7e
-1, 390335, 3136, 0x7c93e329
-0, 396180, 192000, 0xd5bc0e7e
-1, 396735, 3128, 0xa67718c0
-0, 402570, 192000, 0xd5bc0e7e
-1, 403118, 3136, 0x9bb6e8a3
-0, 408960, 192000, 0xd5bc0e7e
-1, 409518, 3128, 0x0933b7a6
-0, 415350, 192000, 0xd5bc0e7e
-1, 415902, 3128, 0x07f1fb57
-0, 421740, 192000, 0xd5bc0e7e
-1, 422286, 3136, 0x8a050cfd
-0, 428130, 192000, 0xd5bc0e7e
-1, 428686, 3128, 0xdb773c0b
-0, 434520, 192000, 0xd5bc0e7e
-1, 435069, 3136, 0xd1281c53
-0, 440910, 192000, 0xd5bc0e7e
-1, 441469, 3128, 0x9f395324
-0, 447300, 192000, 0xd5bc0e7e
-1, 447853, 3128, 0x5f13edec
-0, 453690, 192000, 0xd5bc0e7e
-1, 454237, 3136, 0x871cbecf
-0, 460080, 192000, 0xd5bc0e7e
-1, 460637, 3128, 0x799eff3e
-0, 466470, 192000, 0xd5bc0e7e
-1, 467020, 3128, 0x3f902762
-0, 472860, 192000, 0xd5bc0e7e
-1, 473404, 3136, 0x29f8bb04
-0, 479250, 192000, 0xd5bc0e7e
-1, 479804, 3128, 0xf3523ee9
-0, 485640, 192000, 0xd5bc0e7e
-1, 486188, 3136, 0x4405c435
-0, 492030, 192000, 0xd5bc0e7e
-1, 492588, 3128, 0x892957cb
-0, 498420, 192000, 0xd5bc0e7e
-1, 498971, 3128, 0xdf483dbd
-0, 504810, 192000, 0xd5bc0e7e
-1, 505355, 3136, 0x5e8ab797
-0, 511200, 192000, 0xd5bc0e7e
-1, 511755, 3128, 0x92e13820
-0, 517590, 192000, 0xd5bc0e7e
-1, 518139, 3136, 0xfde719b6
-0, 523980, 192000, 0xd5bc0e7e
-1, 524539, 3128, 0x442f17ae
-0, 530370, 192000, 0xd5bc0e7e
-1, 530922, 3128, 0x011af61f
-0, 536760, 192000, 0xd5bc0e7e
-1, 537306, 3136, 0x4e3e3a6d
-0, 543150, 192000, 0xd5bc0e7e
-1, 543706, 3128, 0xc11242b9
-0, 549540, 192000, 0xd5bc0e7e
-1, 550090, 3128, 0x01415b59
-0, 555930, 192000, 0xd5bc0e7e
-1, 556473, 3136, 0x302e0e55
-0, 562320, 192000, 0xd5bc0e7e
-1, 562873, 3128, 0x20522d04
-0, 568710, 192000, 0xd5bc0e7e
-1, 569257, 3136, 0x316a697d
-0, 575100, 192000, 0xd5bc0e7e
-1, 575657, 3128, 0x6d75ee27
-0, 581490, 192000, 0xd5bc0e7e
-1, 582041, 3128, 0xcb008ae8
-0, 587880, 192000, 0xd5bc0e7e
-1, 588424, 3136, 0xd2664b51
-0, 594270, 192000, 0xd5bc0e7e
-1, 594824, 3128, 0xdfcab728
-0, 600660, 192000, 0xd5bc0e7e
-1, 601208, 3136, 0x00000000
-0, 607050, 192000, 0xd5bc0e7e
-1, 607608, 3128, 0x00000000
-0, 613440, 192000, 0xd5bc0e7e
-1, 613992, 3128, 0x00000000
-0, 619830, 192000, 0xd5bc0e7e
-1, 620376, 3136, 0x00000000
-0, 626220, 192000, 0xd5bc0e7e
-1, 626776, 3128, 0x00000000
-0, 632610, 192000, 0xd5bc0e7e
-1, 633159, 2856, 0x00000000
diff --git a/tests/ref/fate/smc b/tests/ref/fate/smc
deleted file mode 100644
index 08e3d5e..0000000
--- a/tests/ref/fate/smc
+++ /dev/null
@@ -1,120 +0,0 @@
-0, 0, 230400, 0xf814fc90
-0, 3000, 230400, 0xe1b13137
-0, 6000, 230400, 0xa7f4d408
-0, 9000, 230400, 0x4b86e1d5
-0, 12000, 230400, 0xc663af5a
-0, 15000, 230400, 0x943b5757
-0, 18000, 230400, 0x0d7ee496
-0, 21000, 230400, 0x78792de4
-0, 24000, 230400, 0xd102fb8d
-0, 27000, 230400, 0xf9006139
-0, 30000, 230400, 0x216bd87d
-0, 33000, 230400, 0x1e4c902c
-0, 36000, 230400, 0x5aaa7742
-0, 39000, 230400, 0x48699d93
-0, 42000, 230400, 0xd1e22a5c
-0, 45000, 230400, 0x18929315
-0, 48000, 230400, 0x680dd4d3
-0, 51000, 230400, 0x4cdbcbcb
-0, 54000, 230400, 0x6f810d98
-0, 57000, 230400, 0xb4f68204
-0, 60000, 230400, 0xbd3bb19e
-0, 63000, 230400, 0xab27b424
-0, 66000, 230400, 0xe5dd675d
-0, 69000, 230400, 0x811e45a1
-0, 72000, 230400, 0x951011f7
-0, 75000, 230400, 0x2f1e2b99
-0, 78000, 230400, 0x6657c0d6
-0, 81000, 230400, 0xfd29177d
-0, 84000, 230400, 0x4b4c01d7
-0, 87000, 230400, 0x9af286aa
-0, 90000, 230400, 0xc4e9b193
-0, 93000, 230400, 0x05dc28ec
-0, 96000, 230400, 0x68352119
-0, 99000, 230400, 0x0b87e79c
-0, 102000, 230400, 0x8358b180
-0, 105000, 230400, 0x8debbc9d
-0, 108000, 230400, 0x961c58ce
-0, 111000, 230400, 0xd8a809c8
-0, 114000, 230400, 0x5351789d
-0, 117000, 230400, 0xa7ca598c
-0, 120000, 230400, 0xc5ce1812
-0, 123000, 230400, 0x74496550
-0, 126000, 230400, 0x326e366e
-0, 129000, 230400, 0x27ae9a92
-0, 132000, 230400, 0xadbc8794
-0, 135000, 230400, 0x7f3587d8
-0, 138000, 230400, 0xf0400ca6
-0, 141000, 230400, 0x59a5138e
-0, 144000, 230400, 0x456d62a5
-0, 147000, 230400, 0xf1a5e5f1
-0, 150000, 230400, 0x75c712e4
-0, 153000, 230400, 0xd160780a
-0, 156000, 230400, 0xc6c23cf0
-0, 159000, 230400, 0x0339a2ac
-0, 162000, 230400, 0x0e27a2e2
-0, 165000, 230400, 0x84976300
-0, 168000, 230400, 0xb368f3c4
-0, 171000, 230400, 0xa5231fb8
-0, 174000, 230400, 0x17c036d4
-0, 177000, 230400, 0xfc81a2c0
-0, 180000, 230400, 0x99faa403
-0, 183000, 230400, 0xff59efd3
-0, 186000, 230400, 0xcece1d23
-0, 189000, 230400, 0x56c785d9
-0, 192000, 230400, 0xe5a9f222
-0, 195000, 230400, 0xb80946f8
-0, 198000, 230400, 0xf6b642c6
-0, 201000, 230400, 0x69573aed
-0, 204000, 230400, 0xfb69a1fd
-0, 207000, 230400, 0x100b47f4
-0, 210000, 230400, 0x6edf9543
-0, 213000, 230400, 0x11fdf43c
-0, 216000, 230400, 0xd143bf2a
-0, 219000, 230400, 0x7ca747c4
-0, 222000, 230400, 0xd984bd73
-0, 225000, 230400, 0xc5477e8d
-0, 228000, 230400, 0xf7d58300
-0, 231000, 230400, 0x7a1b9463
-0, 234000, 230400, 0x47a29342
-0, 237000, 230400, 0xdf437f9d
-0, 240000, 230400, 0xf836ef5d
-0, 243000, 230400, 0xc98937af
-0, 246000, 230400, 0x9258695b
-0, 249000, 230400, 0xd4fe179c
-0, 252000, 230400, 0x35d524d3
-0, 255000, 230400, 0xd9ce5484
-0, 258000, 230400, 0xdef776ed
-0, 261000, 230400, 0x154c4057
-0, 264000, 230400, 0xf5c764f1
-0, 267000, 230400, 0x41979b13
-0, 270000, 230400, 0xae4e83db
-0, 273000, 230400, 0x09fc0f83
-0, 276000, 230400, 0x60267fdf
-0, 279000, 230400, 0xeaafc525
-0, 282000, 230400, 0x80cc35e5
-0, 285000, 230400, 0xd82c6164
-0, 288000, 230400, 0xd68b8111
-0, 291000, 230400, 0x96f874a3
-0, 294000, 230400, 0x7fc861c4
-0, 297000, 230400, 0xb911f310
-0, 300000, 230400, 0x35bbf5aa
-0, 303000, 230400, 0xa922b683
-0, 306000, 230400, 0xbf6ae353
-0, 309000, 230400, 0x6bd3984c
-0, 312000, 230400, 0xe51768c0
-0, 315000, 230400, 0xee691624
-0, 318000, 230400, 0xd546fed7
-0, 321000, 230400, 0x98d375e6
-0, 324000, 230400, 0x3b9ca990
-0, 327000, 230400, 0x27128ad1
-0, 330000, 230400, 0x2788e38c
-0, 333000, 230400, 0xb0cf3381
-0, 336000, 230400, 0x4fc86d39
-0, 339000, 230400, 0xf5632fff
-0, 342000, 230400, 0x7fa1e6c2
-0, 345000, 230400, 0xffeef044
-0, 348000, 230400, 0x932af385
-0, 351000, 230400, 0x76738428
-0, 354000, 230400, 0xf6771ba2
-0, 357000, 230400, 0x17e2ff27
diff --git a/tests/ref/fate/sp5x b/tests/ref/fate/sp5x
deleted file mode 100644
index ed06a77..0000000
--- a/tests/ref/fate/sp5x
+++ /dev/null
@@ -1,19 +0,0 @@
-0, 0, 115200, 0x8ebcb7f8
-1, 0, 2048, 0x366ee71c
-0, 9234, 115200, 0x1fa8e673
-1, 11520, 2048, 0xc62f0414
-0, 18468, 115200, 0xec07fb6a
-1, 23040, 2048, 0x754e0f19
-0, 27702, 115200, 0x6773a8c3
-1, 34560, 2048, 0x4a44152a
-0, 36936, 115200, 0x0d279643
-1, 46080, 2048, 0x4fd3ff01
-0, 46170, 115200, 0xb33796e4
-0, 55404, 115200, 0xfe11fc79
-1, 57600, 2048, 0x11c3fa1b
-0, 64638, 115200, 0x4ac8e31b
-1, 69120, 2048, 0x9945fa06
-0, 73872, 115200, 0x15317942
-1, 80640, 2048, 0x12e5071a
-0, 83106, 115200, 0x07803f0e
-1, 92160, 44, 0x7ad110e8
diff --git a/tests/ref/fate/sunraster-1bit-raw b/tests/ref/fate/sunraster-1bit-raw
deleted file mode 100644
index 40babe7..0000000
--- a/tests/ref/fate/sunraster-1bit-raw
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 32768, 0x6d16e246
diff --git a/tests/ref/fate/sunraster-1bit-rle b/tests/ref/fate/sunraster-1bit-rle
deleted file mode 100644
index 40babe7..0000000
--- a/tests/ref/fate/sunraster-1bit-rle
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 32768, 0x6d16e246
diff --git a/tests/ref/fate/sunraster-24bit-raw b/tests/ref/fate/sunraster-24bit-raw
deleted file mode 100644
index 0b0dafc..0000000
--- a/tests/ref/fate/sunraster-24bit-raw
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 786432, 0xb4d417bf
diff --git a/tests/ref/fate/sunraster-24bit-rle b/tests/ref/fate/sunraster-24bit-rle
deleted file mode 100644
index 0b0dafc..0000000
--- a/tests/ref/fate/sunraster-24bit-rle
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 786432, 0xb4d417bf
diff --git a/tests/ref/fate/sunraster-8bit-raw b/tests/ref/fate/sunraster-8bit-raw
deleted file mode 100644
index 3f22c8f..0000000
--- a/tests/ref/fate/sunraster-8bit-raw
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 786432, 0xf4364008
diff --git a/tests/ref/fate/sunraster-8bit-rle b/tests/ref/fate/sunraster-8bit-rle
deleted file mode 100644
index 3f22c8f..0000000
--- a/tests/ref/fate/sunraster-8bit-rle
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 786432, 0xf4364008
diff --git a/tests/ref/fate/svq1 b/tests/ref/fate/svq1
deleted file mode 100644
index b048681..0000000
--- a/tests/ref/fate/svq1
+++ /dev/null
@@ -1,150 +0,0 @@
-0, 0, 21600, 0x7f9389e3
-0, 6000, 21600, 0xcebb8896
-0, 12000, 21600, 0xef51860a
-0, 18000, 21600, 0x88d97e7d
-0, 24000, 21600, 0xc7757c88
-0, 30000, 21600, 0x2f537ade
-0, 36000, 21600, 0xd50a7eff
-0, 42000, 21600, 0xdcfb7fc6
-0, 48000, 21600, 0x0d608299
-0, 54000, 21600, 0x97ca81b4
-0, 60000, 21600, 0x791f80e7
-0, 66000, 21600, 0x96ae7d33
-0, 72000, 21600, 0x4d7474a8
-0, 78000, 21600, 0x2ae76f37
-0, 84000, 21600, 0x7da76265
-0, 90000, 21600, 0x93ae3eb6
-0, 96000, 21600, 0xebfd3868
-0, 102000, 21600, 0x54f82ffa
-0, 108000, 21600, 0x8d5b2ad0
-0, 114000, 21600, 0xe67128e6
-0, 120000, 21600, 0xb7bf613e
-0, 126000, 21600, 0xefd0f51b
-0, 132000, 21600, 0x31b7da59
-0, 138000, 21600, 0x7a84a8f7
-0, 144000, 21600, 0x0351ad27
-0, 150000, 21600, 0xed6f434d
-0, 156000, 21600, 0x0e771127
-0, 162000, 21600, 0x37bf0b95
-0, 168000, 21600, 0x30e10a77
-0, 174000, 21600, 0x1a48288a
-0, 180000, 21600, 0xf43c6770
-0, 186000, 21600, 0x3c43ae68
-0, 192000, 21600, 0x04dc0949
-0, 198000, 21600, 0x7920758d
-0, 204000, 21600, 0x6c12bab5
-0, 210000, 21600, 0x1ac23706
-0, 216000, 21600, 0x7a95cb5f
-0, 222000, 21600, 0xf1bfbb46
-0, 228000, 21600, 0x773d1d0c
-0, 234000, 21600, 0x2e7bea65
-0, 240000, 21600, 0xdb1a086f
-0, 246000, 21600, 0x5b36b78d
-0, 252000, 21600, 0x7b533ca6
-0, 258000, 21600, 0x65d75105
-0, 264000, 21600, 0xfe6f6207
-0, 270000, 21600, 0x44c4ce57
-0, 276000, 21600, 0x220f3dae
-0, 282000, 21600, 0xb4d20ffb
-0, 288000, 21600, 0x8907ad72
-0, 294000, 21600, 0xc6418998
-0, 300000, 21600, 0x395b6670
-0, 306000, 21600, 0x83495b88
-0, 312000, 21600, 0x8920d683
-0, 318000, 21600, 0xd7fc64ea
-0, 324000, 21600, 0x21a3b222
-0, 330000, 21600, 0xc11f2dbd
-0, 336000, 21600, 0xd1d5495d
-0, 342000, 21600, 0x70f2de20
-0, 348000, 21600, 0x10adc9a9
-0, 354000, 21600, 0xf713c0ec
-0, 360000, 21600, 0xa346b3fe
-0, 366000, 21600, 0x7945c29b
-0, 372000, 21600, 0xb07ceb91
-0, 378000, 21600, 0xe1eaf9ef
-0, 384000, 21600, 0x6fa915c7
-0, 390000, 21600, 0x61952055
-0, 396000, 21600, 0x4bca2382
-0, 402000, 21600, 0x36161fe2
-0, 408000, 21600, 0xf93a28f7
-0, 414000, 21600, 0xa02a3d47
-0, 420000, 21600, 0x925b3609
-0, 426000, 21600, 0x5b6941db
-0, 432000, 21600, 0x33154a91
-0, 438000, 21600, 0xb1d75c50
-0, 444000, 21600, 0x1cb369bd
-0, 450000, 21600, 0x3be4eff2
-0, 456000, 21600, 0xbb89c301
-0, 462000, 21600, 0xc7630d85
-0, 468000, 21600, 0xf7441c67
-0, 474000, 21600, 0xc23611ef
-0, 480000, 21600, 0x840efb21
-0, 486000, 21600, 0x7d470a0f
-0, 492000, 21600, 0xfe093210
-0, 498000, 21600, 0x0f3ea098
-0, 504000, 21600, 0xcd72286f
-0, 510000, 21600, 0x826f8030
-0, 516000, 21600, 0xcda3ace8
-0, 522000, 21600, 0x39cb4cd0
-0, 528000, 21600, 0xa86a60ac
-0, 534000, 21600, 0xcd32ed8e
-0, 540000, 21600, 0x769b285d
-0, 546000, 21600, 0x10234cd0
-0, 552000, 21600, 0x951036b8
-0, 558000, 21600, 0xaef248fa
-0, 564000, 21600, 0x74e36e84
-0, 570000, 21600, 0x3908531b
-0, 576000, 21600, 0x342f2a9d
-0, 582000, 21600, 0x291d58f3
-0, 588000, 21600, 0xcf24b1e5
-0, 594000, 21600, 0x3e7c7959
-0, 600000, 21600, 0x6517e573
-0, 606000, 21600, 0x304cc6db
-0, 612000, 21600, 0x272895e4
-0, 618000, 21600, 0x52325837
-0, 624000, 21600, 0xd01344bd
-0, 630000, 21600, 0xd25a370b
-0, 636000, 21600, 0x274e0ae9
-0, 642000, 21600, 0x6f66138f
-0, 648000, 21600, 0xd35a0f60
-0, 654000, 21600, 0xe0610863
-0, 660000, 21600, 0x920b05fb
-0, 666000, 21600, 0x5befe39d
-0, 672000, 21600, 0xd167bd58
-0, 678000, 21600, 0x653ac504
-0, 684000, 21600, 0x8372c6d7
-0, 690000, 21600, 0x0302c276
-0, 696000, 21600, 0xa176b694
-0, 702000, 21600, 0x4c2e935a
-0, 708000, 21600, 0xf7ea844e
-0, 714000, 21600, 0x76d6c07b
-0, 720000, 21600, 0x0a14d610
-0, 726000, 21600, 0x0ec9f3f3
-0, 732000, 21600, 0xdc90f6ea
-0, 738000, 21600, 0xc841f9ef
-0, 744000, 21600, 0x7ab5f9b9
-0, 750000, 21600, 0xda40f3c2
-0, 756000, 21600, 0x0040fb72
-0, 762000, 21600, 0x705b0786
-0, 768000, 21600, 0x26d5198d
-0, 774000, 21600, 0x6f5153ad
-0, 780000, 21600, 0x9f26624b
-0, 786000, 21600, 0x0d3ea7af
-0, 792000, 21600, 0xb957ca79
-0, 798000, 21600, 0x03a60612
-0, 804000, 21600, 0x3ddc4ff1
-0, 810000, 21600, 0x8fe5697f
-0, 816000, 21600, 0x3d199b09
-0, 822000, 21600, 0x97e2b504
-0, 828000, 21600, 0x7563f784
-0, 834000, 21600, 0x9a473879
-0, 840000, 21600, 0x2e2054e5
-0, 846000, 21600, 0x06b3658b
-0, 852000, 21600, 0xa37ee249
-0, 858000, 21600, 0xa527efa1
-0, 864000, 21600, 0x12791532
-0, 870000, 21600, 0xc5350145
-0, 876000, 21600, 0xcd44f1ac
-0, 882000, 21600, 0xe610edfb
-0, 888000, 21600, 0x5642f672
-0, 894000, 21600, 0xf2bc3e5b
diff --git a/tests/ref/fate/svq3 b/tests/ref/fate/svq3
deleted file mode 100644
index 324c363..0000000
--- a/tests/ref/fate/svq3
+++ /dev/null
@@ -1,180 +0,0 @@
-0, 0, 115200, 0x2c810465
-0, 3000, 115200, 0x010b5765
-0, 6000, 115200, 0x2be11a4e
-0, 9000, 115200, 0x99445d06
-0, 12000, 115200, 0x6b54d83c
-0, 15000, 115200, 0x3832b76a
-0, 18000, 115200, 0x3832b76a
-0, 21000, 115200, 0xe18385db
-0, 24000, 115200, 0x847d4bf0
-0, 27000, 115200, 0x0d650f50
-0, 30000, 115200, 0x4b85c44c
-0, 33000, 115200, 0xce1927a6
-0, 36000, 115200, 0x89353747
-0, 39000, 115200, 0x58da43f2
-0, 42000, 115200, 0xee9a4eef
-0, 45000, 115200, 0xce9453d9
-0, 48000, 115200, 0x804a5eb0
-0, 51000, 115200, 0xb3d46605
-0, 54000, 115200, 0x45b5668e
-0, 57000, 115200, 0xdd0d4c5a
-0, 60000, 115200, 0x99101301
-0, 63000, 115200, 0xf0c3f272
-0, 66000, 115200, 0xea21f8b1
-0, 69000, 115200, 0xd8e7fbb1
-0, 72000, 115200, 0x89d90aa1
-0, 75000, 115200, 0x882e19da
-0, 78000, 115200, 0xfc0f2709
-0, 81000, 115200, 0x9b732f3f
-0, 84000, 115200, 0xec453cda
-0, 87000, 115200, 0xa77e4989
-0, 90000, 115200, 0xad935834
-0, 93000, 115200, 0x3a5a6177
-0, 96000, 115200, 0xd3c07999
-0, 99000, 115200, 0xfad388dd
-0, 102000, 115200, 0xaf6e9520
-0, 105000, 115200, 0xdb64a4b3
-0, 108000, 115200, 0xc6f9b49e
-0, 111000, 115200, 0x4446c315
-0, 114000, 115200, 0x660bd01c
-0, 117000, 115200, 0x963fdd7d
-0, 120000, 115200, 0x8733e7b3
-0, 123000, 115200, 0x41aaf1d5
-0, 126000, 115200, 0xa803fd81
-0, 129000, 115200, 0xe2b4077f
-0, 132000, 115200, 0xfe6707cb
-0, 135000, 115200, 0x027c122d
-0, 138000, 115200, 0xbcb81ea8
-0, 141000, 115200, 0xd2ac2405
-0, 144000, 115200, 0x3d893006
-0, 147000, 115200, 0xbdcc3ba8
-0, 150000, 115200, 0x83ed4c6b
-0, 153000, 115200, 0x69ee5e7c
-0, 156000, 115200, 0xfe317411
-0, 159000, 115200, 0x849e84e6
-0, 162000, 115200, 0x040f945f
-0, 165000, 115200, 0x6481ac89
-0, 168000, 115200, 0x8a48be9e
-0, 171000, 115200, 0xb162ce94
-0, 174000, 115200, 0x178dd69a
-0, 177000, 115200, 0x64fdecaa
-0, 180000, 115200, 0x4b51297e
-0, 183000, 115200, 0x3d39a1ae
-0, 186000, 115200, 0x900fd939
-0, 189000, 115200, 0x7704fb19
-0, 192000, 115200, 0xa426137e
-0, 195000, 115200, 0x9a112706
-0, 198000, 115200, 0x294931f7
-0, 201000, 115200, 0x0d0e4372
-0, 204000, 115200, 0x33bd50e4
-0, 207000, 115200, 0x9c86e3e2
-0, 210000, 115200, 0x714af5d5
-0, 213000, 115200, 0xc5f9fcd0
-0, 216000, 115200, 0x184602bb
-0, 219000, 115200, 0x6958e9e6
-0, 222000, 115200, 0x5a214952
-0, 225000, 115200, 0x706cca0e
-0, 228000, 115200, 0x67689363
-0, 231000, 115200, 0x459f410c
-0, 234000, 115200, 0xa8f4c365
-0, 237000, 115200, 0xf1fc50c5
-0, 240000, 115200, 0xc22af545
-0, 243000, 115200, 0xd39802a2
-0, 246000, 115200, 0xb76c04b6
-0, 249000, 115200, 0x7a548db4
-0, 252000, 115200, 0x79e56765
-0, 255000, 115200, 0x3f273a17
-0, 258000, 115200, 0xe04366db
-0, 261000, 115200, 0x8e10939b
-0, 264000, 115200, 0x49220ea2
-0, 267000, 115200, 0x35361889
-0, 270000, 115200, 0x9b20bdfa
-0, 273000, 115200, 0x5d472eaf
-0, 276000, 115200, 0xeda43081
-0, 279000, 115200, 0x59bae8b4
-0, 282000, 115200, 0xf126d6a4
-0, 285000, 115200, 0x18106464
-0, 288000, 115200, 0x85530c73
-0, 291000, 115200, 0xcef32c78
-0, 294000, 115200, 0xfd6233a0
-0, 297000, 115200, 0xae9d6fc3
-0, 300000, 115200, 0x3d0cce10
-0, 303000, 115200, 0xfce5f124
-0, 306000, 115200, 0x90b10802
-0, 309000, 115200, 0xeea44201
-0, 312000, 115200, 0x1cefb56d
-0, 315000, 115200, 0xd6daa0b1
-0, 318000, 115200, 0xd700cef4
-0, 321000, 115200, 0x36dbf58f
-0, 324000, 115200, 0xdb20d060
-0, 327000, 115200, 0x5ca61fd5
-0, 330000, 115200, 0x4f271361
-0, 333000, 115200, 0xcaf03743
-0, 336000, 115200, 0x520f351a
-0, 339000, 115200, 0x40bc7b89
-0, 342000, 115200, 0xd0af0b08
-0, 345000, 115200, 0x6a45290c
-0, 348000, 115200, 0x57210c14
-0, 351000, 115200, 0xc1e233f9
-0, 354000, 115200, 0x96fdfc54
-0, 357000, 115200, 0x43a8359c
-0, 360000, 115200, 0xd493bfde
-0, 363000, 115200, 0xd5339d13
-0, 366000, 115200, 0x7542baa0
-0, 369000, 115200, 0x268d2cb9
-0, 372000, 115200, 0xaf3888bb
-0, 375000, 115200, 0xb82f520a
-0, 378000, 115200, 0x0feb2981
-0, 381000, 115200, 0x45314b58
-0, 384000, 115200, 0xb26a193a
-0, 387000, 115200, 0xdfdffc38
-0, 390000, 115200, 0xec6a55f5
-0, 393000, 115200, 0xf6e35716
-0, 396000, 115200, 0x5ce8544e
-0, 399000, 115200, 0x3e38ddce
-0, 402000, 115200, 0x964a2006
-0, 405000, 115200, 0xaba138d6
-0, 408000, 115200, 0x2f46949c
-0, 411000, 115200, 0xbdbdb587
-0, 414000, 115200, 0x1bf11e1d
-0, 417000, 115200, 0x2632f558
-0, 420000, 115200, 0x0e58078b
-0, 423000, 115200, 0x2ab2f9be
-0, 426000, 115200, 0x9205f1d8
-0, 429000, 115200, 0x6a4bd949
-0, 432000, 115200, 0xedc1552f
-0, 435000, 115200, 0x0a60974d
-0, 438000, 115200, 0xe1a1400e
-0, 441000, 115200, 0x45f06952
-0, 444000, 115200, 0xc5163125
-0, 447000, 115200, 0x151da156
-0, 450000, 115200, 0x3f34b048
-0, 453000, 115200, 0xcf7c1e5d
-0, 456000, 115200, 0xed9c4e1c
-0, 459000, 115200, 0x47e06453
-0, 462000, 115200, 0xc8ce6f19
-0, 465000, 115200, 0xac619619
-0, 468000, 115200, 0x64711e2d
-0, 471000, 115200, 0x1f502b52
-0, 474000, 115200, 0x39592c9d
-0, 477000, 115200, 0x7dffb901
-0, 480000, 115200, 0xc75fa3ce
-0, 483000, 115200, 0x625bc977
-0, 486000, 115200, 0x15c7fda3
-0, 489000, 115200, 0x6e5d35b5
-0, 492000, 115200, 0xf847cf88
-0, 495000, 115200, 0xc10867fe
-0, 498000, 115200, 0xae07fbfc
-0, 501000, 115200, 0xc1571542
-0, 504000, 115200, 0x4c7d5602
-0, 507000, 115200, 0xbe7045aa
-0, 510000, 115200, 0xc8b4835b
-0, 513000, 115200, 0xf9b7d427
-0, 516000, 115200, 0x7fa7c112
-0, 519000, 115200, 0xe0105feb
-0, 522000, 115200, 0x70784740
-0, 525000, 115200, 0xa6801ef5
-0, 528000, 115200, 0x9cf35921
-0, 531000, 115200, 0x4d956630
-0, 534000, 115200, 0x717a25c1
-0, 537000, 115200, 0x8f5e39de
diff --git a/tests/ref/fate/thp-mjpeg-adpcm b/tests/ref/fate/thp-mjpeg-adpcm
deleted file mode 100644
index b1046d8..0000000
--- a/tests/ref/fate/thp-mjpeg-adpcm
+++ /dev/null
@@ -1,143 +0,0 @@
-0, 0, 291840, 0xbd7e0b22
-1, 0, 4312, 0x469714f6
-0, 3003, 291840, 0xf6e12ca5
-1, 3032, 4256, 0xe03dd882
-0, 6006, 291840, 0x528c7049
-1, 6024, 4312, 0x46b901f7
-0, 9009, 291840, 0x93055de9
-1, 9056, 4256, 0x8d4a54e4
-0, 12012, 291840, 0xf95a51c1
-1, 12049, 4256, 0xfd616b67
-0, 15015, 291840, 0x6ad3a65a
-1, 15041, 4312, 0xefe62302
-0, 18018, 291840, 0x494684a7
-1, 18073, 4256, 0xab11684e
-0, 21021, 291840, 0x74c14eb1
-1, 21066, 4256, 0xb4b3feb8
-0, 24024, 291840, 0x149fcb7e
-1, 24058, 4312, 0x71db6461
-0, 27027, 291840, 0x25649761
-1, 27090, 4256, 0x090e5efa
-0, 30030, 291840, 0xbc3f9052
-1, 30083, 4256, 0x36f49c28
-0, 33033, 291840, 0x080edfff
-1, 33075, 4312, 0x0fe3d262
-0, 36036, 291840, 0x6d7ad684
-1, 36107, 4256, 0x199ce269
-0, 39039, 291840, 0x6d53844d
-1, 39099, 4256, 0x98342d05
-0, 42042, 291840, 0xf7ad5385
-1, 42092, 4312, 0xb6fb7ebe
-0, 45045, 291840, 0x0241b56a
-1, 45124, 4256, 0x033dd562
-0, 48048, 291840, 0x120122c8
-1, 48116, 4256, 0xc2cc17e0
-0, 51051, 291840, 0x31b0f32a
-1, 51109, 4312, 0x4bb3ff50
-0, 54054, 291840, 0x14068b98
-1, 54141, 4256, 0x6f2671ef
-0, 57057, 291840, 0xeeec658b
-1, 57133, 4256, 0x5a337bf4
-0, 60060, 291840, 0x9376374c
-1, 60126, 4312, 0xa71f6967
-0, 63063, 291840, 0x091e8c6e
-1, 63158, 4256, 0x48084aa9
-0, 66066, 291840, 0x744ad07f
-1, 66150, 4256, 0x3cce4218
-0, 69069, 291840, 0xf99c554e
-1, 69143, 4312, 0xcbb8f73d
-0, 72072, 291840, 0xc84bd677
-1, 72174, 4256, 0x36825021
-0, 75075, 291840, 0x3898d474
-1, 75167, 4256, 0xeae036c6
-0, 78078, 291840, 0x1e2910c8
-1, 78159, 4312, 0x0d650ac6
-0, 81081, 291840, 0xb11f58bc
-1, 81191, 4256, 0xfba4f58c
-0, 84084, 291840, 0xf89170ee
-1, 84184, 4256, 0x54311f9b
-0, 87087, 291840, 0x8f239dc3
-1, 87176, 4312, 0x286386b3
-0, 90090, 291840, 0x8538c76c
-1, 90208, 4256, 0x871896de
-0, 93093, 291840, 0x162ee66f
-1, 93201, 4256, 0x9ef9f970
-0, 96096, 291840, 0x5f8708a5
-1, 96193, 4312, 0xf9ae97f1
-0, 99099, 291840, 0x95802dfb
-1, 99225, 4256, 0x0ad0d765
-0, 102102, 291840, 0xc424630d
-1, 102218, 4256, 0x8e6aa9b5
-0, 105105, 291840, 0xfb8a8667
-1, 105210, 4312, 0x8362787b
-0, 108108, 291840, 0xbad79af5
-1, 108242, 4256, 0x9b6a5d9c
-0, 111111, 291840, 0xc733b325
-1, 111234, 4256, 0xfb715d8f
-0, 114114, 291840, 0x4bfbcd70
-1, 114227, 4312, 0x02bd8075
-0, 117117, 291840, 0x502cd950
-1, 117259, 4256, 0x428eb932
-0, 120120, 291840, 0x8461ca2c
-1, 120251, 4256, 0x17ea8c94
-0, 123123, 291840, 0x00219b0d
-1, 123244, 4312, 0xb3e761d7
-0, 126126, 291840, 0xa4de45e1
-1, 126276, 4256, 0x0919755a
-0, 129129, 291840, 0xacd3f4df
-1, 129268, 4256, 0x5e520edd
-0, 132132, 291840, 0x2203a369
-1, 132261, 4312, 0x69aa070e
-0, 135135, 291840, 0x0a66effa
-1, 135293, 4256, 0xf8192f7d
-0, 138138, 291840, 0x7ac1fd91
-1, 138285, 4256, 0xaad4475c
-0, 141141, 291840, 0x84970aa7
-1, 141278, 4312, 0x0cabcfcb
-0, 144144, 291840, 0x569d145f
-1, 144309, 4256, 0x952f0f96
-0, 147147, 291840, 0xe51efe1b
-1, 147302, 4256, 0x1b805a0c
-0, 150150, 291840, 0x38e2cd78
-1, 150294, 4312, 0x93043d2a
-0, 153153, 291840, 0x93428ea2
-1, 153326, 4256, 0x38b99e44
-0, 156156, 291840, 0x3d3f5b17
-1, 156319, 4256, 0x60cc52ff
-0, 159159, 291840, 0x9546127d
-1, 159311, 4312, 0x6a875849
-0, 162162, 291840, 0x4178be54
-1, 162343, 4256, 0xd08d6d0e
-0, 165165, 291840, 0x0d0f8036
-1, 165336, 4256, 0x36bfe48e
-0, 168168, 291840, 0xc20557b9
-1, 168328, 4312, 0x795c6134
-0, 171171, 291840, 0x6d4b2d64
-1, 171360, 4256, 0x4fd79583
-0, 174174, 291840, 0xa750125d
-1, 174353, 4256, 0x65e2ab9f
-0, 177177, 291840, 0x04623ce3
-1, 177345, 4312, 0xedeede4a
-0, 180180, 291840, 0xc7f2bbc7
-1, 180377, 4256, 0x097e0d09
-0, 183183, 291840, 0x6e271336
-1, 183369, 4256, 0x58afa133
-0, 186186, 291840, 0xcfbd4246
-1, 186362, 4312, 0x442525b5
-0, 189189, 291840, 0xe1493be9
-1, 189394, 4256, 0x6645c591
-0, 192192, 291840, 0x6c731194
-1, 192386, 4256, 0xb0dd948a
-0, 195195, 291840, 0x0fc30cc2
-1, 195379, 4312, 0x12684e69
-0, 198198, 291840, 0x967427f3
-1, 198411, 4256, 0xb45098e3
-0, 201201, 291840, 0x55ae3b00
-1, 201403, 4256, 0xb6d3c61c
-0, 204204, 291840, 0xbe4f200c
-1, 204396, 4312, 0xb46b5b22
-0, 207207, 291840, 0xc515e443
-1, 207428, 4256, 0x9a556830
-0, 210210, 291840, 0xd738bd69
-1, 210420, 4256, 0x67ca2b35
-0, 213213, 291840, 0xa8e0ab69
diff --git a/tests/ref/fate/tiertex-seq b/tests/ref/fate/tiertex-seq
deleted file mode 100644
index e4ebf5a..0000000
--- a/tests/ref/fate/tiertex-seq
+++ /dev/null
@@ -1,149 +0,0 @@
-1, 0, 1764, 0x00000000
-0, 0, 98304, 0x2e5db4a4
-1, 3600, 1764, 0x80a253d9
-0, 3600, 98304, 0xb20c19d0
-1, 7200, 1764, 0x95a16721
-0, 7200, 98304, 0xb20c19d0
-1, 10800, 1764, 0x0f0d4cb6
-0, 10800, 98304, 0xb20c19d0
-1, 14400, 1764, 0x75026779
-0, 14400, 98304, 0x6b8538c0
-1, 18000, 1764, 0xb4356e37
-0, 18000, 98304, 0x6b8538c0
-1, 21600, 1764, 0xfafa64cb
-0, 21600, 98304, 0x6b8538c0
-1, 25200, 1764, 0xe8fd7970
-0, 25200, 98304, 0x172207e3
-1, 28800, 1764, 0x666879b7
-0, 28800, 98304, 0x172207e3
-1, 32400, 1764, 0xf2cd7770
-0, 32400, 98304, 0x172207e3
-1, 36000, 1764, 0x54317a1c
-0, 36000, 98304, 0x172207e3
-1, 39600, 1764, 0x9c396930
-0, 39600, 98304, 0x63fb7dc1
-1, 43200, 1764, 0x87115ec4
-0, 43200, 98304, 0x63fb7dc1
-1, 46800, 1764, 0x0c9b69b6
-0, 46800, 98304, 0x63fb7dc1
-1, 50400, 1764, 0x8c3a758a
-0, 50400, 98304, 0x37cf1601
-1, 54000, 1764, 0x605d776a
-0, 54000, 98304, 0x37cf1601
-1, 57600, 1764, 0x0556852d
-0, 57600, 98304, 0x37cf1601
-1, 61200, 1764, 0x7d4363f8
-0, 61200, 98304, 0x37cf1601
-1, 64800, 1764, 0xc5cd75d0
-0, 64800, 98304, 0x82941990
-1, 68400, 1764, 0x3ff3646d
-0, 68400, 98304, 0x82941990
-1, 72000, 1764, 0x10136d25
-0, 72000, 98304, 0x82941990
-1, 75600, 1764, 0xeb1a6cd0
-0, 75600, 98304, 0x82941990
-1, 79200, 1764, 0xef937ed1
-0, 79200, 98304, 0xe0a5309e
-1, 82800, 1764, 0x2d2b6f79
-0, 82800, 98304, 0xe0a5309e
-1, 86400, 1764, 0x6f457231
-0, 86400, 98304, 0xe0a5309e
-1, 90000, 1764, 0x56267c9d
-0, 90000, 98304, 0x164cb67d
-1, 93600, 1764, 0xd49e79c8
-0, 93600, 98304, 0x164cb67d
-1, 97200, 1764, 0xc726703d
-0, 97200, 98304, 0x164cb67d
-1, 100800, 1764, 0x2abf8074
-0, 100800, 98304, 0x164cb67d
-1, 104400, 1764, 0xb50c556d
-0, 104400, 98304, 0xed2189f8
-1, 108000, 1764, 0xc1f2523c
-0, 108000, 98304, 0xed2189f8
-1, 111600, 1764, 0x850a6f93
-0, 111600, 98304, 0xed2189f8
-1, 115200, 1764, 0x8da76c31
-0, 115200, 98304, 0x7215e529
-1, 118800, 1764, 0xfcccdf13
-0, 118800, 98304, 0x7215e529
-1, 122400, 1764, 0x00000000
-0, 122400, 98304, 0x7215e529
-1, 126000, 1764, 0x00000000
-0, 126000, 98304, 0x7215e529
-1, 129600, 1764, 0x00000000
-0, 129600, 98304, 0x170c783b
-1, 133200, 1764, 0x00000000
-0, 133200, 98304, 0x170c783b
-1, 136800, 1764, 0x00000000
-0, 136800, 98304, 0x170c783b
-1, 140400, 1764, 0x00000000
-0, 140400, 98304, 0xf6bd74c7
-1, 144000, 1764, 0x00000000
-0, 144000, 98304, 0xf6bd74c7
-1, 147600, 1764, 0x00000000
-0, 147600, 98304, 0xf6bd74c7
-1, 151200, 1764, 0x00000000
-0, 151200, 98304, 0xf6bd74c7
-1, 154800, 1764, 0x00000000
-0, 154800, 98304, 0x1efd38c4
-1, 158400, 1764, 0x00000000
-0, 158400, 98304, 0x1efd38c4
-1, 162000, 1764, 0x00000000
-0, 162000, 98304, 0x1efd38c4
-1, 165600, 1764, 0x00000000
-0, 165600, 98304, 0x1efd38c4
-1, 169200, 1764, 0x00000000
-0, 169200, 98304, 0x29c26bba
-1, 172800, 1764, 0x00000000
-0, 172800, 98304, 0x29c26bba
-1, 176400, 1764, 0x00000000
-0, 176400, 98304, 0x29c26bba
-1, 180000, 1764, 0x00000000
-0, 180000, 98304, 0x880a6313
-1, 183600, 1764, 0x00000000
-0, 183600, 98304, 0x880a6313
-1, 187200, 1764, 0x00000000
-0, 187200, 98304, 0x880a6313
-1, 190800, 1764, 0x00000000
-0, 190800, 98304, 0x880a6313
-1, 194400, 1764, 0x00000000
-0, 194400, 98304, 0x73f5bb00
-1, 198000, 1764, 0x00000000
-0, 198000, 98304, 0x73f5bb00
-1, 201600, 1764, 0x00000000
-0, 201600, 98304, 0x73f5bb00
-1, 205200, 1764, 0x00000000
-0, 205200, 98304, 0xc85b19ec
-1, 208800, 1764, 0x00000000
-0, 208800, 98304, 0xc85b19ec
-1, 212400, 1764, 0x00000000
-0, 212400, 98304, 0xc85b19ec
-1, 216000, 1764, 0x00000000
-0, 216000, 98304, 0xc85b19ec
-1, 219600, 1764, 0x00000000
-0, 219600, 98304, 0x00000000
-1, 223200, 1764, 0x00000000
-0, 223200, 98304, 0x00000000
-1, 226800, 1764, 0x00000000
-0, 226800, 98304, 0x00000000
-1, 230400, 1764, 0x00000000
-0, 230400, 98304, 0x00000000
-1, 234000, 1764, 0x00000000
-0, 234000, 98304, 0x00000000
-1, 237600, 1764, 0x00000000
-0, 237600, 98304, 0x00000000
-1, 241200, 1764, 0x00000000
-0, 241200, 98304, 0x00000000
-1, 244800, 1764, 0x00000000
-0, 244800, 98304, 0x00000000
-1, 248400, 1764, 0x00000000
-0, 248400, 98304, 0x00000000
-1, 252000, 1764, 0x00000000
-0, 252000, 98304, 0x00000000
-1, 255600, 1764, 0x00000000
-0, 255600, 98304, 0x00000000
-1, 259200, 1764, 0x00000000
-1, 262800, 1764, 0x00000000
-1, 266400, 1764, 0x00000000
-1, 270000, 1764, 0x00000000
-1, 273600, 1764, 0x00000000
diff --git a/tests/ref/fate/tmv b/tests/ref/fate/tmv
deleted file mode 100644
index feca20e..0000000
--- a/tests/ref/fate/tmv
+++ /dev/null
@@ -1,220 +0,0 @@
-0, 0, 192000, 0xc698297a
-1, 0, 736, 0xf63db497
-0, 1501, 192000, 0x8d5bd6be
-1, 1501, 736, 0xbc42caef
-0, 3003, 192000, 0x21c32083
-1, 3003, 736, 0x5619a45a
-0, 4504, 192000, 0x849cd4c0
-1, 4504, 736, 0x1b8ac0f9
-0, 6006, 192000, 0x8c63a4f0
-1, 6006, 736, 0x55dcac78
-0, 7507, 192000, 0x5dbee9ab
-1, 7507, 736, 0xd9f2a266
-0, 9009, 192000, 0x2b12d9bb
-1, 9009, 736, 0x22f8af51
-0, 10510, 192000, 0x1a737e17
-1, 10510, 736, 0x838bacb8
-0, 12012, 192000, 0x90536c29
-1, 12012, 736, 0x7b29b4f9
-0, 13513, 192000, 0xd7795243
-1, 13513, 736, 0x5a01b505
-0, 15015, 192000, 0x08847e17
-1, 15015, 736, 0xc330abb4
-0, 16516, 192000, 0x47aa5a3b
-1, 16516, 736, 0x84d6c49d
-0, 18018, 192000, 0x9435266f
-1, 18018, 736, 0xd0a1a588
-0, 19519, 192000, 0x87e7ea9c
-1, 19519, 736, 0x9083a382
-0, 21021, 192000, 0x6dc00285
-1, 21021, 736, 0x291eb335
-0, 22522, 192000, 0xf6407ddf
-1, 22522, 736, 0xdda2b452
-0, 24024, 192000, 0x55541c09
-1, 24024, 736, 0x82feab67
-0, 25525, 192000, 0xf1c4f5be
-1, 25525, 736, 0xfca6b943
-0, 27027, 192000, 0xe59ff74c
-1, 27027, 736, 0x2a4ea1fd
-0, 28528, 192000, 0x0fedcf04
-1, 28528, 736, 0xbb4bc783
-0, 30030, 192000, 0x04b893dd
-1, 30030, 736, 0x8c10a799
-0, 31531, 192000, 0xfef47d83
-1, 31531, 736, 0x8751a53b
-0, 33033, 192000, 0x07bde9ed
-1, 33033, 736, 0x4b3c9fc3
-0, 34534, 192000, 0xb8003fd2
-1, 34534, 736, 0x5dad9b46
-0, 36036, 192000, 0x4eb6b3ed
-1, 36036, 736, 0xe106a3e6
-0, 37537, 192000, 0x320b0b34
-1, 37537, 736, 0xa42a9a3b
-0, 39039, 192000, 0x5156e90f
-1, 39039, 736, 0xb5069901
-0, 40540, 192000, 0x34778cde
-1, 40540, 736, 0x3556c3c3
-0, 42042, 192000, 0xd8d96e44
-1, 42042, 736, 0xa870c1ee
-0, 43543, 192000, 0x962ae9f3
-1, 43543, 736, 0xc388b6d8
-0, 45045, 192000, 0x3d29d85a
-1, 45045, 736, 0xe167a2b0
-0, 46546, 192000, 0x838554fa
-1, 46546, 736, 0x15aeb59d
-0, 48048, 192000, 0xd64a3b93
-1, 48048, 736, 0xa576c0bc
-0, 49549, 192000, 0x380ef140
-1, 49549, 736, 0x44f3b827
-0, 51051, 192000, 0x076b38c0
-1, 51051, 736, 0xfa5ecd84
-0, 52552, 192000, 0xd9a67c7c
-1, 52552, 736, 0xb7b996f6
-0, 54054, 192000, 0xc2849a50
-1, 54054, 736, 0xb390c311
-0, 55555, 192000, 0x9b94a347
-1, 55555, 736, 0xc5a9ab0f
-0, 57057, 192000, 0xe3ba9c07
-1, 57057, 736, 0x1a3aa3f6
-0, 58558, 192000, 0xef0011f5
-1, 58558, 736, 0xdaaf9e42
-0, 60060, 192000, 0xa98381e8
-1, 60060, 736, 0xad8fb0ba
-0, 61561, 192000, 0x27e5ce9b
-1, 61561, 736, 0x9cce9e05
-0, 63063, 192000, 0x8568e33f
-1, 63063, 736, 0x70639e6f
-0, 64564, 192000, 0x540633b6
-1, 64564, 736, 0xc5e1ba9b
-0, 66066, 192000, 0xd8fcfbed
-1, 66066, 736, 0x9e6cb422
-0, 67567, 192000, 0x15609e04
-1, 67567, 736, 0x5c559a1e
-0, 69069, 192000, 0x7e4f5c9b
-1, 69069, 736, 0xb071c2da
-0, 70570, 192000, 0xef14950d
-1, 70570, 736, 0xd9bdb9eb
-0, 72072, 192000, 0x9e0b85b9
-1, 72072, 736, 0x5ecab2d5
-0, 73573, 192000, 0xf3b69b95
-1, 73573, 736, 0x0f78a8fe
-0, 75075, 192000, 0x09b6db39
-1, 75075, 736, 0x74ebaccd
-0, 76576, 192000, 0x4dc9a300
-1, 76576, 736, 0x2cfab78e
-0, 78078, 192000, 0x29d9fdde
-1, 78078, 736, 0x32c6c26e
-0, 79579, 192000, 0x22e79283
-1, 79579, 736, 0xbe339d74
-0, 81081, 192000, 0x5f5c95aa
-1, 81081, 736, 0x2c31b687
-0, 82582, 192000, 0x4d76efde
-1, 82582, 736, 0xcbb0b8d5
-0, 84084, 192000, 0xb1d79f6a
-1, 84084, 736, 0x17bcb56a
-0, 85585, 192000, 0xedfe6012
-1, 85585, 736, 0x116fb70c
-0, 87087, 192000, 0x4a56033a
-1, 87087, 736, 0xa22eb34f
-0, 88588, 192000, 0xdbc9f746
-1, 88588, 736, 0x130bc9bb
-0, 90090, 192000, 0xedff8a16
-1, 90090, 736, 0xbb0b77aa
-0, 91591, 192000, 0x46b5f843
-1, 91591, 736, 0xafb5a9f0
-0, 93093, 192000, 0xbd12dbfc
-1, 93093, 736, 0xaf55f1a3
-0, 94594, 192000, 0xacf2a336
-1, 94594, 736, 0x988e9669
-0, 96096, 192000, 0x13843e7f
-1, 96096, 736, 0x4e2cc9ab
-0, 97597, 192000, 0x6fda777f
-1, 97597, 736, 0x34b3b7ea
-0, 99099, 192000, 0x16ffef07
-1, 99099, 736, 0x1252a16b
-0, 100600, 192000, 0xb36c06c6
-1, 100600, 736, 0x04279e74
-0, 102102, 192000, 0xd65746b1
-1, 102102, 736, 0x9c2ecb2e
-0, 103603, 192000, 0x2817079b
-1, 103603, 736, 0x6c16945a
-0, 105105, 192000, 0xadb60837
-1, 105105, 736, 0x2c0cc1f9
-0, 106606, 192000, 0x60cb0d87
-1, 106606, 736, 0x52fba868
-0, 108108, 192000, 0x14e5b02b
-1, 108108, 736, 0xe2a2a5be
-0, 109609, 192000, 0x574fd8f4
-1, 109609, 736, 0x2f56a95b
-0, 111111, 192000, 0xffb9a8fa
-1, 111111, 736, 0x573196a0
-0, 112612, 192000, 0xc2904a3e
-1, 112612, 736, 0xb542c1dc
-0, 114114, 192000, 0x22e77c9b
-1, 114114, 736, 0x7f6a9964
-0, 115615, 192000, 0xd76d81c2
-1, 115615, 736, 0xc39db324
-0, 117117, 192000, 0xf5b0fcc8
-1, 117117, 736, 0xa2dbb058
-0, 118618, 192000, 0xc452ce4d
-1, 118618, 736, 0x8bfac722
-0, 120120, 192000, 0x64a53e4f
-1, 120120, 736, 0x5e679406
-0, 121621, 192000, 0xe6c115da
-1, 121621, 736, 0xd7a8c2aa
-0, 123123, 192000, 0x959d45fe
-1, 123123, 736, 0x5ec6a7a0
-0, 124624, 192000, 0xabb270b6
-1, 124624, 736, 0x9f33c47f
-0, 126126, 192000, 0x451642b8
-1, 126126, 736, 0x4c4998bf
-0, 127627, 192000, 0x028b2202
-1, 127627, 736, 0x2363c344
-0, 129129, 192000, 0xf5d79b86
-1, 129129, 736, 0xecf9a09f
-0, 130630, 192000, 0xebe0623e
-1, 130630, 736, 0x5a069e69
-0, 132132, 192000, 0x7560d1eb
-1, 132132, 736, 0xe2e5b106
-0, 133633, 192000, 0xcbf85785
-1, 133633, 736, 0x7ff4b09e
-0, 135135, 192000, 0x180f6aca
-1, 135135, 736, 0x0157acd2
-0, 136636, 192000, 0xea8ecb95
-1, 136636, 736, 0x64849b5a
-0, 138138, 192000, 0x6a5e3639
-1, 138138, 736, 0x0399b037
-0, 139639, 192000, 0x5aa6c22c
-1, 139639, 736, 0xa57ea80f
-0, 141141, 192000, 0xdbb50948
-1, 141141, 736, 0x233eb2a4
-0, 142642, 192000, 0x0184a90a
-1, 142642, 736, 0x8aa5dfa0
-0, 144144, 192000, 0x0efc1358
-1, 144144, 736, 0x0c9fa877
-0, 145645, 192000, 0x29053255
-1, 145645, 736, 0xbe6faef2
-0, 147147, 192000, 0x3a7e239d
-1, 147147, 736, 0xf800c0f2
-0, 148648, 192000, 0x3bd99ca5
-1, 148648, 736, 0x1d68a964
-0, 150150, 192000, 0xe1b5a4d6
-1, 150150, 736, 0x0e4f8872
-0, 151651, 192000, 0xf487f8bb
-1, 151651, 736, 0x31c6ed1c
-0, 153153, 192000, 0x8b14387c
-1, 153153, 736, 0x7448a8d2
-0, 154654, 192000, 0xdaeb9cb4
-1, 154654, 736, 0x79a2ac09
-0, 156156, 192000, 0xdc1d2f5b
-1, 156156, 736, 0xbdbfa397
-0, 157657, 192000, 0x4dcab167
-1, 157657, 736, 0xa5deb8bb
-0, 159159, 192000, 0x87fcf0d3
-1, 159159, 736, 0x4565d179
-0, 160660, 192000, 0x36d37542
-1, 160660, 736, 0x64d89f91
-0, 162162, 192000, 0x59ba49c5
-1, 162162, 736, 0x32319f68
-0, 163663, 192000, 0xf679b712
-1, 163663, 736, 0x3efdc04f
diff --git a/tests/ref/fate/tscc-15bit b/tests/ref/fate/tscc-15bit
deleted file mode 100644
index fb4d558..0000000
--- a/tests/ref/fate/tscc-15bit
+++ /dev/null
@@ -1,240 +0,0 @@
-1, 0, 22050, 0x1740aaec
-0, 0, 657600, 0xaf456809
-0, 6000, 657600, 0xaf456809
-0, 12000, 657600, 0xaf456809
-0, 18000, 657600, 0x2dbe6889
-0, 24000, 657600, 0x2dbe6889
-0, 30000, 657600, 0x2dbe6889
-0, 36000, 657600, 0x2dbe6889
-0, 42000, 657600, 0x2dbe6889
-0, 48000, 657600, 0x2dbe6889
-0, 54000, 657600, 0x2dbe6889
-0, 60000, 657600, 0x2dbe6889
-0, 66000, 657600, 0x2dbe6889
-0, 72000, 657600, 0x2dbe6889
-0, 78000, 657600, 0x2dbe6889
-0, 84000, 657600, 0x2dbe6889
-1, 90000, 22050, 0x75ed6086
-0, 90000, 657600, 0x2dbe6889
-0, 96000, 657600, 0x2dbe6889
-0, 102000, 657600, 0x2dbe6889
-0, 108000, 657600, 0x2dbe6889
-0, 114000, 657600, 0x2dbe6889
-0, 120000, 657600, 0x2dbe6889
-0, 126000, 657600, 0x92796e59
-0, 132000, 657600, 0x92796e59
-0, 138000, 657600, 0x92796e59
-0, 144000, 657600, 0x64cb6889
-0, 150000, 657600, 0x64cb6889
-0, 156000, 657600, 0x64cb6889
-0, 162000, 657600, 0x64cb6889
-0, 168000, 657600, 0x64cb6889
-0, 174000, 657600, 0x64cb6889
-1, 180000, 22050, 0xca52a4e9
-0, 180000, 657600, 0x42036b71
-0, 186000, 657600, 0x42036b71
-0, 192000, 657600, 0x42036b71
-0, 198000, 657600, 0xc40a6889
-0, 204000, 657600, 0xc40a6889
-0, 210000, 657600, 0xc40a6889
-0, 216000, 657600, 0xaa6f7429
-0, 222000, 657600, 0xaa6f7429
-0, 228000, 657600, 0xaa6f7429
-0, 234000, 657600, 0x854172d9
-0, 240000, 657600, 0x854172d9
-0, 246000, 657600, 0x854172d9
-0, 252000, 657600, 0x22d10de0
-0, 258000, 657600, 0xa75f0d60
-0, 264000, 657600, 0x7a440be0
-1, 270000, 22050, 0xb306d419
-0, 270000, 657600, 0x40095d50
-0, 276000, 657600, 0x40095d50
-0, 282000, 657600, 0x64766320
-0, 288000, 657600, 0x64766320
-0, 294000, 657600, 0x64766320
-0, 300000, 657600, 0x64766320
-0, 306000, 657600, 0x64766320
-0, 312000, 657600, 0x64766320
-0, 318000, 657600, 0x64766320
-0, 324000, 657600, 0x64766320
-0, 330000, 657600, 0x64766320
-0, 336000, 657600, 0x64766320
-0, 342000, 657600, 0xf51adc49
-0, 348000, 657600, 0xf51adc49
-0, 354000, 657600, 0xf51adc49
-1, 360000, 22050, 0x8cbb9625
-0, 360000, 657600, 0xdd47af59
-0, 366000, 657600, 0xdd47af59
-0, 372000, 657600, 0xffa8acf1
-0, 378000, 657600, 0x5994b059
-0, 384000, 657600, 0x5994b059
-0, 390000, 657600, 0x5994b059
-0, 396000, 657600, 0x03ffae71
-0, 402000, 657600, 0x03ffae71
-0, 408000, 657600, 0x03ffae71
-0, 414000, 657600, 0xe33ab89e
-0, 420000, 657600, 0xe33ab89e
-0, 426000, 657600, 0xe33ab89e
-0, 432000, 657600, 0xbe37b549
-0, 438000, 657600, 0xbe37b549
-0, 444000, 657600, 0x1d395bf9
-1, 450000, 22050, 0x34a11f66
-0, 450000, 657600, 0x1d395bf9
-0, 456000, 657600, 0x1d395bf9
-0, 462000, 657600, 0x1d395bf9
-0, 468000, 657600, 0x2ec36f37
-0, 474000, 657600, 0x2ec36f37
-0, 480000, 657600, 0xb04a6eb7
-0, 486000, 657600, 0x66610458
-0, 492000, 657600, 0x66610458
-0, 498000, 657600, 0xaf8901f0
-0, 504000, 657600, 0x3ae41c48
-0, 510000, 657600, 0x5b870b70
-0, 516000, 657600, 0x11490c60
-0, 522000, 657600, 0x70064801
-0, 528000, 657600, 0x80d54519
-0, 534000, 657600, 0xe8c942b1
-1, 540000, 22050, 0x1ae81230
-0, 540000, 657600, 0x830d8c24
-0, 546000, 657600, 0x830d8c24
-0, 552000, 657600, 0x830d8c24
-0, 558000, 657600, 0xf3c4707c
-0, 564000, 657600, 0x6ace707c
-0, 570000, 657600, 0x6ace707c
-0, 576000, 657600, 0x6ace707c
-0, 582000, 657600, 0x6ace707c
-0, 588000, 657600, 0x6ace707c
-0, 594000, 657600, 0x5f461aae
-0, 600000, 657600, 0x5f461aae
-0, 606000, 657600, 0x221ceecf
-0, 612000, 657600, 0x221ceecf
-0, 618000, 657600, 0x221ceecf
-0, 624000, 657600, 0x221ceecf
-1, 630000, 22050, 0x1217eeba
-0, 630000, 657600, 0x221ceecf
-0, 636000, 657600, 0x221ceecf
-0, 642000, 657600, 0x221ceecf
-0, 648000, 657600, 0x3bf6f39f
-0, 654000, 657600, 0x3bf6f39f
-0, 660000, 657600, 0x3bf6f39f
-0, 666000, 657600, 0xc2caeecf
-0, 672000, 657600, 0xc2caeecf
-0, 678000, 657600, 0xc2caeecf
-0, 684000, 657600, 0xc316d63e
-0, 690000, 657600, 0xc316d63e
-0, 696000, 657600, 0xc316d63e
-0, 702000, 657600, 0x41f6218d
-0, 708000, 657600, 0x41f6218d
-0, 714000, 657600, 0x41f6218d
-1, 720000, 22050, 0x50e70baa
-0, 720000, 657600, 0xff43ec36
-0, 726000, 657600, 0x0b10eb16
-0, 732000, 657600, 0x0b10eb16
-0, 738000, 657600, 0xbdf41aa5
-0, 744000, 657600, 0xbdf41aa5
-0, 750000, 657600, 0xbdf41aa5
-0, 756000, 657600, 0xd502ca06
-0, 762000, 657600, 0xd502ca06
-0, 768000, 657600, 0xd502ca06
-0, 774000, 657600, 0x8446f89e
-0, 780000, 657600, 0x8446f89e
-0, 786000, 657600, 0x8446f89e
-0, 792000, 657600, 0x3d4ccf06
-0, 798000, 657600, 0x0897d1de
-0, 804000, 657600, 0x0897d1de
-1, 810000, 22050, 0xb19e89c0
-0, 810000, 657600, 0x3e27e01e
-0, 816000, 657600, 0x3e27e01e
-0, 822000, 657600, 0x3e27e01e
-0, 828000, 657600, 0x3e27e01e
-0, 834000, 657600, 0x3e27e01e
-0, 840000, 657600, 0x3e27e01e
-0, 846000, 657600, 0xe51078a8
-0, 852000, 657600, 0xe51078a8
-0, 858000, 657600, 0xe9967a40
-0, 864000, 657600, 0xe9967a40
-0, 870000, 657600, 0xe9967a40
-0, 876000, 657600, 0xe9967a40
-0, 882000, 657600, 0xe9967a40
-0, 888000, 657600, 0xe9967a40
-0, 894000, 657600, 0xe9967a40
-1, 900000, 22050, 0x78526696
-0, 900000, 657600, 0x726cb6b8
-0, 906000, 657600, 0x2960b6e8
-0, 912000, 657600, 0x2960b6e8
-0, 918000, 657600, 0x1637d6c8
-0, 924000, 657600, 0x6f2fd9b0
-0, 930000, 657600, 0x27a7d6c8
-0, 936000, 657600, 0xe855d6c8
-0, 942000, 657600, 0xe855d6c8
-0, 948000, 657600, 0xe855d6c8
-0, 954000, 657600, 0x1a8ad6c8
-0, 960000, 657600, 0x9c11d648
-0, 966000, 657600, 0x6136d648
-0, 972000, 657600, 0xdfa0d6c8
-0, 978000, 657600, 0xdfa0d6c8
-0, 984000, 657600, 0xdfa0d6c8
-1, 990000, 22050, 0x48e3bb21
-0, 990000, 657600, 0xdfa0d6c8
-0, 996000, 657600, 0xdfa0d6c8
-0, 1002000, 657600, 0xdfa0d6c8
-0, 1008000, 657600, 0xdfa0d6c8
-0, 1014000, 657600, 0xdfa0d6c8
-0, 1020000, 657600, 0xdfa0d6c8
-0, 1026000, 657600, 0x125cd9b0
-0, 1032000, 657600, 0x125cd9b0
-0, 1038000, 657600, 0x8a7ed6c8
-0, 1044000, 657600, 0x09a6d9b0
-0, 1050000, 657600, 0x09a6d9b0
-0, 1056000, 657600, 0x09a6d9b0
-0, 1062000, 657600, 0x85e87a68
-0, 1068000, 657600, 0x85e87a68
-0, 1074000, 657600, 0x85e87a68
-1, 1080000, 22050, 0xbc32204a
-0, 1080000, 657600, 0xb0a141a8
-0, 1086000, 657600, 0xb0a141a8
-0, 1092000, 657600, 0xf3333bd8
-0, 1098000, 657600, 0xea090688
-0, 1104000, 657600, 0xa017fe41
-0, 1110000, 657600, 0xa017fe41
-0, 1116000, 657600, 0x32e93bd8
-0, 1122000, 657600, 0x7fe640c0
-0, 1128000, 657600, 0x7fe640c0
-0, 1134000, 657600, 0xcd8995b2
-0, 1140000, 657600, 0x84278a92
-0, 1146000, 657600, 0x84278a92
-0, 1152000, 657600, 0xf1d2874a
-0, 1158000, 657600, 0xf1d2874a
-0, 1164000, 657600, 0xf1d2874a
-1, 1170000, 22050, 0xdf6f1e46
-0, 1170000, 657600, 0xa58d6742
-0, 1176000, 657600, 0xa58d6742
-0, 1182000, 657600, 0xa58d6742
-0, 1188000, 657600, 0xb0cd11bb
-0, 1194000, 657600, 0xb0cd11bb
-0, 1200000, 657600, 0xc55610bb
-0, 1206000, 657600, 0x4ee1168b
-0, 1212000, 657600, 0x61c513a3
-0, 1218000, 657600, 0xd26410bb
-0, 1224000, 657600, 0xe7c410bb
-0, 1230000, 657600, 0x444a0dd3
-0, 1236000, 657600, 0x444a0dd3
-0, 1242000, 657600, 0x97ac10bb
-0, 1248000, 657600, 0x97ac10bb
-0, 1254000, 657600, 0xe8b30dd3
-1, 1260000, 22050, 0x4c91da9d
-0, 1260000, 657600, 0x3d0c10bb
-0, 1266000, 657600, 0x8d2b0dd3
-0, 1272000, 657600, 0x8d2b0dd3
-0, 1278000, 657600, 0xa5760dd3
-0, 1284000, 657600, 0xa5760dd3
-0, 1290000, 657600, 0xa5760dd3
-0, 1296000, 657600, 0x31a30dd3
-0, 1302000, 657600, 0x31a30dd3
-0, 1308000, 657600, 0x31a30dd3
-0, 1314000, 657600, 0x31a30dd3
-0, 1320000, 657600, 0x31a30dd3
-0, 1326000, 657600, 0x31a30dd3
-0, 1332000, 657600, 0x31a30dd3
-0, 1338000, 657600, 0x31a30dd3
-0, 1344000, 657600, 0x31a30dd3
diff --git a/tests/ref/fate/tscc-32bit b/tests/ref/fate/tscc-32bit
deleted file mode 100644
index dd888a8..0000000
--- a/tests/ref/fate/tscc-32bit
+++ /dev/null
@@ -1,159 +0,0 @@
-0, 0, 2359296, 0x76cccaa7
-0, 6000, 2359296, 0x09c52bbf
-0, 12000, 2359296, 0xc8746009
-0, 18000, 2359296, 0xe48ff59b
-0, 24000, 2359296, 0xa2f1fddb
-0, 30000, 2359296, 0xbb0e0026
-0, 36000, 2359296, 0x66a905ab
-0, 42000, 2359296, 0xe990f855
-0, 48000, 2359296, 0xe990f855
-0, 54000, 2359296, 0x3ec2c64e
-0, 60000, 2359296, 0xda3ba3cf
-0, 66000, 2359296, 0xda3ba3cf
-0, 72000, 2359296, 0xda3ba3cf
-0, 78000, 2359296, 0x60a070fd
-0, 84000, 2359296, 0x42e5fedc
-0, 90000, 2359296, 0x42e5fedc
-0, 96000, 2359296, 0x699cf990
-0, 102000, 2359296, 0x699cf990
-0, 108000, 2359296, 0x699cf990
-0, 114000, 2359296, 0x699cf990
-0, 120000, 2359296, 0x699cf990
-0, 126000, 2359296, 0x699cf990
-0, 132000, 2359296, 0x699cf990
-0, 138000, 2359296, 0x1524160c
-0, 144000, 2359296, 0x1524160c
-0, 150000, 2359296, 0x1524160c
-0, 156000, 2359296, 0x1524160c
-0, 162000, 2359296, 0x1524160c
-0, 168000, 2359296, 0x1524160c
-0, 174000, 2359296, 0x1524160c
-0, 180000, 2359296, 0x33df0c8c
-0, 186000, 2359296, 0x33df0c8c
-0, 192000, 2359296, 0x33df0c8c
-0, 198000, 2359296, 0x33df0c8c
-0, 204000, 2359296, 0x33df0c8c
-0, 210000, 2359296, 0x33df0c8c
-0, 216000, 2359296, 0x33df0c8c
-0, 222000, 2359296, 0xfe3d29f8
-0, 228000, 2359296, 0xfe3d29f8
-0, 234000, 2359296, 0xfe3d29f8
-0, 240000, 2359296, 0xfe3d29f8
-0, 246000, 2359296, 0xfe3d29f8
-0, 252000, 2359296, 0xfe3d29f8
-0, 258000, 2359296, 0xfe3d29f8
-0, 264000, 2359296, 0x1b9d197f
-0, 270000, 2359296, 0x1b9d197f
-0, 276000, 2359296, 0x1b9d197f
-0, 282000, 2359296, 0x1b9d197f
-0, 288000, 2359296, 0x1b9d197f
-0, 294000, 2359296, 0x1b9d197f
-0, 300000, 2359296, 0x1b9d197f
-0, 306000, 2359296, 0x48c126fb
-0, 312000, 2359296, 0x48c126fb
-0, 318000, 2359296, 0x48c126fb
-0, 324000, 2359296, 0x48c126fb
-0, 330000, 2359296, 0x48c126fb
-0, 336000, 2359296, 0x48c126fb
-0, 342000, 2359296, 0x48c126fb
-0, 348000, 2359296, 0xcaa31c7c
-0, 354000, 2359296, 0xcaa31c7c
-0, 360000, 2359296, 0xcaa31c7c
-0, 366000, 2359296, 0xcaa31c7c
-0, 372000, 2359296, 0xcaa31c7c
-0, 378000, 2359296, 0xcaa31c7c
-0, 384000, 2359296, 0xcaa31c7c
-0, 390000, 2359296, 0xc6a333ee
-0, 396000, 2359296, 0xc6a333ee
-0, 402000, 2359296, 0xc6a333ee
-0, 408000, 2359296, 0xc6a333ee
-0, 414000, 2359296, 0xc6a333ee
-0, 420000, 2359296, 0xc6a333ee
-0, 426000, 2359296, 0xc6a333ee
-0, 432000, 2359296, 0xb96d1583
-0, 438000, 2359296, 0xb96d1583
-0, 444000, 2359296, 0xb96d1583
-0, 450000, 2359296, 0xb96d1583
-0, 456000, 2359296, 0xb96d1583
-0, 462000, 2359296, 0xb96d1583
-0, 468000, 2359296, 0xb96d1583
-0, 474000, 2359296, 0x878135ec
-0, 480000, 2359296, 0x878135ec
-0, 486000, 2359296, 0x878135ec
-0, 492000, 2359296, 0x878135ec
-0, 498000, 2359296, 0x878135ec
-0, 504000, 2359296, 0x878135ec
-0, 510000, 2359296, 0x878135ec
-0, 516000, 2359296, 0x878135ec
-0, 522000, 2359296, 0x76922870
-0, 528000, 2359296, 0x76922870
-0, 534000, 2359296, 0x76922870
-0, 540000, 2359296, 0x76922870
-0, 546000, 2359296, 0x76922870
-0, 552000, 2359296, 0x76922870
-0, 558000, 2359296, 0x76922870
-0, 564000, 2359296, 0xb0e031f0
-0, 570000, 2359296, 0xb0e031f0
-0, 576000, 2359296, 0xb0e031f0
-0, 582000, 2359296, 0xb0e031f0
-0, 588000, 2359296, 0xb0e031f0
-0, 594000, 2359296, 0xb0e031f0
-0, 600000, 2359296, 0xb0e031f0
-0, 606000, 2359296, 0xb2ef2a6e
-0, 612000, 2359296, 0xb2ef2a6e
-0, 618000, 2359296, 0xb2ef2a6e
-0, 624000, 2359296, 0x083c2474
-0, 630000, 2359296, 0x083c2474
-0, 636000, 2359296, 0x083c2474
-0, 642000, 2359296, 0x083c2474
-0, 648000, 2359296, 0xbdfe2ef3
-0, 654000, 2359296, 0xbdfe2ef3
-0, 660000, 2359296, 0xbdfe2ef3
-0, 666000, 2359296, 0xbdfe2ef3
-0, 672000, 2359296, 0xbdfe2ef3
-0, 678000, 2359296, 0xbdfe2ef3
-0, 684000, 2359296, 0xbdfe2ef3
-0, 690000, 2359296, 0x934b1484
-0, 696000, 2359296, 0x934b1484
-0, 702000, 2359296, 0x934b1484
-0, 708000, 2359296, 0x934b1484
-0, 714000, 2359296, 0x3e0d1a7e
-0, 720000, 2359296, 0x3e0d1a7e
-0, 726000, 2359296, 0x3e0d1a7e
-0, 732000, 2359296, 0x3ce539e8
-0, 738000, 2359296, 0x3ce539e8
-0, 744000, 2359296, 0x3ce539e8
-0, 750000, 2359296, 0x3ce539e8
-0, 756000, 2359296, 0x3ce539e8
-0, 762000, 2359296, 0x3ce539e8
-0, 768000, 2359296, 0x3ce539e8
-0, 774000, 2359296, 0xd46c2f69
-0, 780000, 2359296, 0xd46c2f69
-0, 786000, 2359296, 0xd46c2f69
-0, 792000, 2359296, 0xd46c2f69
-0, 798000, 2359296, 0xd46c2f69
-0, 804000, 2359296, 0xd46c2f69
-0, 810000, 2359296, 0xd46c2f69
-0, 816000, 2359296, 0x8d2933ee
-0, 822000, 2359296, 0x8d2933ee
-0, 828000, 2359296, 0x8d2933ee
-0, 834000, 2359296, 0x8d2933ee
-0, 840000, 2359296, 0x8d2933ee
-0, 846000, 2359296, 0x8d2933ee
-0, 852000, 2359296, 0x8d2933ee
-0, 858000, 2359296, 0xb6092b6d
-0, 864000, 2359296, 0xb6092b6d
-0, 870000, 2359296, 0xb6092b6d
-0, 876000, 2359296, 0xb6092b6d
-0, 882000, 2359296, 0xb6092b6d
-0, 888000, 2359296, 0xb6092b6d
-0, 894000, 2359296, 0xb6092b6d
-0, 900000, 2359296, 0xe4ef27fa
-0, 906000, 2359296, 0xe4ef27fa
-0, 912000, 2359296, 0xe4ef27fa
-0, 918000, 2359296, 0xe4ef27fa
-0, 924000, 2359296, 0xe4ef27fa
-0, 930000, 2359296, 0xe4ef27fa
-0, 936000, 2359296, 0xe4ef27fa
-0, 942000, 2359296, 0x5e5b2672
-0, 948000, 2359296, 0x5e5b2672
diff --git a/tests/ref/fate/ulti b/tests/ref/fate/ulti
deleted file mode 100644
index 820dcfd..0000000
--- a/tests/ref/fate/ulti
+++ /dev/null
@@ -1,62 +0,0 @@
-0, 0, 86400, 0x5d58253d
-0, 7500, 86400, 0x0626d90d
-0, 15000, 86400, 0x4ecb5048
-0, 22500, 86400, 0xf54ea8f7
-0, 30000, 86400, 0xa777c21b
-0, 37500, 86400, 0x7d71e329
-0, 45000, 86400, 0x2903252a
-0, 52500, 86400, 0xbe7302c1
-0, 60000, 86400, 0x734423a8
-0, 67500, 86400, 0x4f422bab
-0, 75000, 86400, 0x21fbf200
-0, 82500, 86400, 0xabf299a7
-0, 90000, 86400, 0x400b4bf8
-0, 97500, 86400, 0x61d044f9
-0, 105000, 86400, 0x72fb94af
-0, 112500, 86400, 0xf522e717
-0, 120000, 86400, 0xad3e0297
-0, 127500, 86400, 0xbef57a5f
-0, 135000, 86400, 0x450ca6e7
-0, 142500, 86400, 0x76ae56e6
-0, 150000, 86400, 0x7b9b7555
-0, 157500, 86400, 0xb522ce0d
-0, 165000, 86400, 0xaa9b8536
-0, 172500, 86400, 0x019d00c4
-0, 180000, 86400, 0xb0f4dee5
-0, 187500, 86400, 0xa7482e52
-0, 195000, 86400, 0x3c87fc35
-0, 202500, 86400, 0xb6d1dede
-0, 210000, 86400, 0x926ee647
-0, 217500, 86400, 0x8747bfc7
-0, 225000, 86400, 0x61569e9b
-0, 232500, 86400, 0x9209a5f6
-0, 240000, 86400, 0x5f89ef12
-0, 247500, 86400, 0x00bfc18f
-0, 255000, 86400, 0xcc6f2f62
-0, 262500, 86400, 0x3ab9cfbf
-0, 270000, 86400, 0x936f2386
-0, 277500, 86400, 0x2203a76c
-0, 285000, 86400, 0xd3d248a3
-0, 292500, 86400, 0x148af7b8
-0, 300000, 86400, 0x437bffae
-0, 307500, 86400, 0x6876c6d5
-0, 315000, 86400, 0x49fc1429
-0, 322500, 86400, 0x181efd2c
-0, 330000, 86400, 0x26ecd294
-0, 337500, 86400, 0xdcdb609e
-0, 345000, 86400, 0xd3cb0ecb
-0, 352500, 86400, 0x528ffc4b
-0, 360000, 86400, 0xb536c7b4
-0, 367500, 86400, 0xae4ab8c5
-0, 375000, 86400, 0xe14fee77
-0, 382500, 86400, 0xcd3e9e85
-0, 390000, 86400, 0x71cfba54
-0, 397500, 86400, 0x9b309c62
-0, 405000, 86400, 0x91b31881
-0, 412500, 86400, 0xae8bda28
-0, 420000, 86400, 0x8db0f87a
-0, 427500, 86400, 0xcd974e98
-0, 435000, 86400, 0x4405116e
-0, 442500, 86400, 0xfe4cc7b4
-0, 450000, 86400, 0x17d27206
-0, 457500, 86400, 0x11743762
diff --git a/tests/ref/fate/v210 b/tests/ref/fate/v210
deleted file mode 100644
index 8cbf7df..0000000
--- a/tests/ref/fate/v210
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 3686400, 0x8d5c3847
diff --git a/tests/ref/fate/vc1 b/tests/ref/fate/vc1
deleted file mode 100644
index 737dad0..0000000
--- a/tests/ref/fate/vc1
+++ /dev/null
@@ -1,2 +0,0 @@
-0, 0, 38016, 0xf1b25db5
-0, 0, 38016, 0xf1b25db5
diff --git a/tests/ref/fate/vcr1 b/tests/ref/fate/vcr1
deleted file mode 100644
index 22f817c..0000000
--- a/tests/ref/fate/vcr1
+++ /dev/null
@@ -1,128 +0,0 @@
-0, 0, 28512, 0x7165286d
-0, 5949, 28512, 0x2b842acc
-0, 11898, 28512, 0x6d1b8e85
-0, 17847, 28512, 0xc5042fab
-0, 23796, 28512, 0x8b84fa8d
-0, 29745, 28512, 0x2ba34ee5
-0, 35693, 28512, 0x48493c3a
-0, 41642, 28512, 0xbd774ff0
-0, 47591, 28512, 0xf2e2edcd
-0, 53540, 28512, 0x9364c39e
-0, 59489, 28512, 0x7203d4d0
-0, 65438, 28512, 0x3771e23e
-0, 71387, 28512, 0xf332b71e
-0, 77336, 28512, 0x64d9aedb
-0, 83285, 28512, 0xc8f9cdbe
-0, 89234, 28512, 0xf077a6e8
-0, 95183, 28512, 0xa9958897
-0, 101131, 28512, 0x89fb6c6e
-0, 107080, 28512, 0x05b7350c
-0, 113029, 28512, 0x23cf3ec8
-0, 118978, 28512, 0xf9105aa6
-0, 124927, 28512, 0x37ed48cb
-0, 130876, 28512, 0xf4b15ce3
-0, 136825, 28512, 0x64b994b8
-0, 142774, 28512, 0x6731c26b
-0, 148723, 28512, 0x650d110b
-0, 154672, 28512, 0xbbb248ca
-0, 160621, 28512, 0x426ab4ab
-0, 166569, 28512, 0xb7f2e361
-0, 172518, 28512, 0xced16599
-0, 178467, 28512, 0xebf11860
-0, 184416, 28512, 0xefe1df5f
-0, 190365, 28512, 0x2afc432e
-0, 196314, 28512, 0x07bd3eea
-0, 202263, 28512, 0x8b133899
-0, 208212, 28512, 0x0830f148
-0, 214161, 28512, 0x871fc549
-0, 220110, 28512, 0x0082c863
-0, 226059, 28512, 0x6144bdce
-0, 232007, 28512, 0x0af772ea
-0, 237956, 28512, 0x982b8707
-0, 243905, 28512, 0x565a3bfe
-0, 249854, 28512, 0xdf14192e
-0, 255803, 28512, 0x0c5ffcc1
-0, 261752, 28512, 0x87532564
-0, 267701, 28512, 0x0ba1661b
-0, 273650, 28512, 0xd0e7a750
-0, 279599, 28512, 0x5add4281
-0, 285548, 28512, 0x9f45c597
-0, 291497, 28512, 0x921736d0
-0, 297446, 28512, 0xab177a89
-0, 303394, 28512, 0xb83a6f7c
-0, 309343, 28512, 0x9bf6716b
-0, 315292, 28512, 0xc8ca0f4f
-0, 321241, 28512, 0x2ca6c753
-0, 327190, 28512, 0xc2f67d1f
-0, 333139, 28512, 0x9b0e1d7b
-0, 339088, 28512, 0x5257c5d0
-0, 345037, 28512, 0xf256bd2f
-0, 350986, 28512, 0x1b04bd04
-0, 356935, 28512, 0x83deb9e4
-0, 362884, 28512, 0x5f3aa6b4
-0, 368832, 28512, 0x9313c5f3
-0, 374781, 28512, 0x1cfe0c23
-0, 380730, 28512, 0x3e9b37bf
-0, 386679, 28512, 0x1603b386
-0, 392628, 28512, 0x3e70da87
-0, 398577, 28512, 0xa6684712
-0, 404526, 28512, 0x0454bbb7
-0, 410475, 28512, 0x7cf2f717
-0, 416424, 28512, 0xdfbd424c
-0, 422373, 28512, 0x7318a177
-0, 428322, 28512, 0xbffcd503
-0, 434270, 28512, 0x85db177d
-0, 440219, 28512, 0x2a8269d1
-0, 446168, 28512, 0xb5455cd5
-0, 452117, 28512, 0x5fd79a35
-0, 458066, 28512, 0xc1a7c005
-0, 464015, 28512, 0x55230bb0
-0, 469964, 28512, 0x5acf45d9
-0, 475913, 28512, 0xdf1259bf
-0, 481862, 28512, 0xe04e87eb
-0, 487811, 28512, 0xfd25abc0
-0, 493760, 28512, 0x38c4d017
-0, 499708, 28512, 0x7b15d521
-0, 505657, 28512, 0xb156b981
-0, 511606, 28512, 0xcc99cd09
-0, 517555, 28512, 0x633a9cec
-0, 523504, 28512, 0xf00a7c1b
-0, 529453, 28512, 0x426250e9
-0, 535402, 28512, 0xfad02714
-0, 541351, 28512, 0x1ea5d8d2
-0, 547300, 28512, 0x581ea622
-0, 553249, 28512, 0x6b225f61
-0, 559198, 28512, 0x68f337e6
-0, 565146, 28512, 0x85f7060e
-0, 571095, 28512, 0xaa3b1086
-0, 577044, 28512, 0x91fa1371
-0, 582993, 28512, 0x92acd34a
-0, 588942, 28512, 0x0ae8c1e6
-0, 594891, 28512, 0x1335a5b3
-0, 600840, 28512, 0xc364a5e7
-0, 606789, 28512, 0x19b9819a
-0, 612738, 28512, 0xd42d7045
-0, 618687, 28512, 0x4c866a18
-0, 624636, 28512, 0xf0a99685
-0, 630584, 28512, 0x47a4a1bd
-0, 636533, 28512, 0x8dd09006
-0, 642482, 28512, 0x3f0b742d
-0, 648431, 28512, 0x1acf52be
-0, 654380, 28512, 0x9e5d1460
-0, 660329, 28512, 0xd6852de9
-0, 666278, 28512, 0x36e00f16
-0, 672227, 28512, 0xe83dea09
-0, 678176, 28512, 0xbb71daf1
-0, 684125, 28512, 0xaeedf763
-0, 690074, 28512, 0xa793ed91
-0, 696022, 28512, 0x9b0f093f
-0, 701971, 28512, 0xc8504b43
-0, 707920, 28512, 0x08c68319
-0, 713869, 28512, 0x2284b24a
-0, 719818, 28512, 0x5980e906
-0, 725767, 28512, 0x6ffd2c14
-0, 731716, 28512, 0x5c6c3c27
-0, 737665, 28512, 0x20d2efec
-0, 743614, 28512, 0x69ffec11
-0, 749563, 28512, 0x8721f8ab
-0, 755512, 28512, 0xb606e164
diff --git a/tests/ref/fate/video-xl b/tests/ref/fate/video-xl
deleted file mode 100644
index aca0864..0000000
--- a/tests/ref/fate/video-xl
+++ /dev/null
@@ -1,40 +0,0 @@
-0, 0, 36096, 0xab1c53c1
-0, 12780, 36096, 0x8b598ff3
-0, 25560, 36096, 0xe9a5f3eb
-0, 38340, 36096, 0x10584b30
-0, 51120, 36096, 0x19d8c5d2
-0, 63900, 36096, 0x43a453b9
-0, 76680, 36096, 0xb32db13b
-0, 89460, 36096, 0xf117e7b3
-0, 102240, 36096, 0x9171fb33
-0, 115020, 36096, 0xdf84081c
-0, 127800, 36096, 0xc9d9527e
-0, 140580, 36096, 0x72fa295e
-0, 153360, 36096, 0xce02060e
-0, 166140, 36096, 0x31f5fdbd
-0, 178920, 36096, 0x4179dc07
-0, 191700, 36096, 0xf250c03f
-0, 204480, 36096, 0xc4aca7c5
-0, 217260, 36096, 0xd9b1837f
-0, 230040, 36096, 0x0af164ef
-0, 242820, 36096, 0x90123fcd
-0, 255600, 36096, 0x60392815
-0, 268380, 36096, 0x7a7b0ac9
-0, 281160, 36096, 0x36c1fe9c
-0, 293940, 36096, 0x50bed8a4
-0, 306720, 36096, 0x10f3b998
-0, 319500, 36096, 0x18e5b516
-0, 332280, 36096, 0x860597dc
-0, 345060, 36096, 0x05488146
-0, 357840, 36096, 0xac577cec
-0, 370620, 36096, 0xc9f95550
-0, 383400, 36096, 0xa0c95270
-0, 396180, 36096, 0x977c5bf2
-0, 408960, 36096, 0xc9f95550
-0, 421740, 36096, 0xa0c95270
-0, 434520, 36096, 0x977c5bf2
-0, 447300, 36096, 0xc9f95550
-0, 460080, 36096, 0xa0c95270
-0, 472860, 36096, 0x977c5bf2
-0, 485640, 36096, 0xc9f95550
-0, 498420, 36096, 0xa0c95270
diff --git a/tests/ref/fate/vmnc-16bit b/tests/ref/fate/vmnc-16bit
deleted file mode 100644
index a298877..0000000
--- a/tests/ref/fate/vmnc-16bit
+++ /dev/null
@@ -1,192 +0,0 @@
-0, 0, 864000, 0x9b1cee65
-0, 18000, 864000, 0x82950e3f
-0, 36000, 864000, 0x335f9678
-0, 54000, 864000, 0x6b86b7e7
-0, 72000, 864000, 0x25618cf2
-0, 90000, 864000, 0xed2196c9
-0, 108000, 864000, 0xbeaa31ba
-0, 126000, 864000, 0x14e6c8ab
-0, 144000, 864000, 0x17e5c196
-0, 162000, 864000, 0x4aa15110
-0, 180000, 864000, 0x4aa15110
-0, 198000, 864000, 0x4aa15110
-0, 216000, 864000, 0x3c2d3809
-0, 234000, 864000, 0xd075f4d0
-0, 252000, 864000, 0x0c3f2833
-0, 270000, 864000, 0xe7471872
-0, 288000, 864000, 0x4300b71d
-0, 306000, 864000, 0x6b5844ec
-0, 324000, 864000, 0xb3ebc395
-0, 342000, 864000, 0x39aa8a7d
-0, 360000, 864000, 0x52a3d93d
-0, 378000, 864000, 0x73adbdac
-0, 396000, 864000, 0xa9fd6cdc
-0, 414000, 864000, 0x4a085344
-0, 432000, 864000, 0xc21b943c
-0, 450000, 864000, 0xfaef6ed4
-0, 468000, 864000, 0xa3e9163c
-0, 486000, 864000, 0x917e2be4
-0, 504000, 864000, 0x2d89d534
-0, 522000, 864000, 0x6fe5a9e4
-0, 540000, 864000, 0x71af29ec
-0, 558000, 864000, 0x8f33f6ad
-0, 576000, 864000, 0xe7d46a24
-0, 594000, 864000, 0xb631e044
-0, 612000, 864000, 0x77db01cb
-0, 630000, 864000, 0x9861b6ec
-0, 648000, 864000, 0x973bd263
-0, 666000, 864000, 0xdd4c175b
-0, 684000, 864000, 0xdc28469b
-0, 702000, 864000, 0x67393ebb
-0, 720000, 864000, 0x01a06813
-0, 738000, 864000, 0x63e88f73
-0, 756000, 864000, 0x3ffbdd73
-0, 774000, 864000, 0xd25f790b
-0, 792000, 864000, 0x14e3c5d3
-0, 810000, 864000, 0x0d3d1202
-0, 828000, 864000, 0x69decf03
-0, 846000, 864000, 0x1b20ab93
-0, 864000, 864000, 0xee2f8d4a
-0, 882000, 864000, 0xaac44c52
-0, 900000, 864000, 0x3f874a5a
-0, 918000, 864000, 0x239b2d7a
-0, 936000, 864000, 0xb85db552
-0, 954000, 864000, 0xb12962a2
-0, 972000, 864000, 0xb8270fd9
-0, 990000, 864000, 0x14930601
-0, 1008000, 864000, 0x827a15c1
-0, 1026000, 864000, 0xe31011d1
-0, 1044000, 864000, 0xcd2154c1
-0, 1062000, 864000, 0xad02dbd9
-0, 1080000, 864000, 0x40c17d58
-0, 1098000, 864000, 0x8219e3b9
-0, 1116000, 864000, 0x2d348340
-0, 1134000, 864000, 0x6b61dfc9
-0, 1152000, 864000, 0xc8d95be1
-0, 1170000, 864000, 0x70ba0918
-0, 1188000, 864000, 0xdc728131
-0, 1206000, 864000, 0x9b054a10
-0, 1224000, 864000, 0x3983f751
-0, 1242000, 864000, 0x325fe1a9
-0, 1260000, 864000, 0x7a41eac0
-0, 1278000, 864000, 0x324372a8
-0, 1296000, 864000, 0xc014ea18
-0, 1314000, 864000, 0x1a506a1f
-0, 1332000, 864000, 0x47b59557
-0, 1350000, 864000, 0x5f2e194f
-0, 1368000, 864000, 0x9f6abb68
-0, 1386000, 864000, 0x831d2b97
-0, 1404000, 864000, 0x0635af7f
-0, 1422000, 864000, 0xe54a5626
-0, 1440000, 864000, 0x704dca4f
-0, 1458000, 864000, 0x47de6676
-0, 1476000, 864000, 0x609705fd
-0, 1494000, 864000, 0x8d92e086
-0, 1512000, 864000, 0xdb7dab5e
-0, 1530000, 864000, 0xe6ccb686
-0, 1548000, 864000, 0x0d137f66
-0, 1566000, 864000, 0xd200035d
-0, 1584000, 864000, 0x7dcb959d
-0, 1602000, 864000, 0xee849f75
-0, 1620000, 864000, 0x89d14acd
-0, 1638000, 864000, 0x3738029d
-0, 1656000, 864000, 0x6f4c4395
-0, 1674000, 864000, 0x06334395
-0, 1692000, 864000, 0x238b7c94
-0, 1710000, 864000, 0xfa5d1e14
-0, 1728000, 864000, 0x50b10e54
-0, 1746000, 864000, 0x9ed3b6e4
-0, 1764000, 864000, 0x68da9374
-0, 1782000, 864000, 0xb32a137c
-0, 1800000, 864000, 0x577d5084
-0, 1818000, 864000, 0xd262176b
-0, 1836000, 864000, 0xf58b44b3
-0, 1854000, 864000, 0xd0828edc
-0, 1872000, 864000, 0xc91a7544
-0, 1890000, 864000, 0x18ae7f1c
-0, 1908000, 864000, 0x82623643
-0, 1926000, 864000, 0x9cf82cfb
-0, 1944000, 864000, 0x93ad116b
-0, 1962000, 864000, 0xa669044b
-0, 1980000, 864000, 0x8adf88c3
-0, 1998000, 864000, 0xb83fb413
-0, 2016000, 864000, 0xb9e291f3
-0, 2034000, 864000, 0x5833dcc3
-0, 2052000, 864000, 0x4ab825aa
-0, 2070000, 864000, 0xb52c3b53
-0, 2088000, 864000, 0x0cb0dd53
-0, 2106000, 864000, 0x98b8dd52
-0, 2124000, 864000, 0x989230ba
-0, 2142000, 864000, 0xaed4c073
-0, 2160000, 864000, 0x76a7c83a
-0, 2178000, 864000, 0x02711eea
-0, 2196000, 864000, 0x8de65fe2
-0, 2214000, 864000, 0xc1163689
-0, 2232000, 864000, 0xc04f8b31
-0, 2250000, 864000, 0x69218d2a
-0, 2268000, 864000, 0x7e3abe62
-0, 2286000, 864000, 0x00ebe27a
-0, 2304000, 864000, 0x34803f11
-0, 2322000, 864000, 0x85591cd9
-0, 2340000, 864000, 0x8422fb51
-0, 2358000, 864000, 0x67c759e1
-0, 2376000, 864000, 0x4ac36af1
-0, 2394000, 864000, 0xdf00fca2
-0, 2412000, 864000, 0x74c633d1
-0, 2430000, 864000, 0x00251c31
-0, 2448000, 864000, 0x6d12a499
-0, 2466000, 864000, 0x1b6492e1
-0, 2484000, 864000, 0xdfc9a2a1
-0, 2502000, 864000, 0x33dcac79
-0, 2520000, 864000, 0x2305a499
-0, 2538000, 864000, 0xe1f3ae71
-0, 2556000, 864000, 0xc0cc92e1
-0, 2574000, 864000, 0x53d3b261
-0, 2592000, 864000, 0xf953aa81
-0, 2610000, 864000, 0x4108da69
-0, 2628000, 864000, 0xd6acf9e9
-0, 2646000, 864000, 0xb97ed900
-0, 2664000, 864000, 0x1d8b7a80
-0, 2682000, 864000, 0xd5406cb8
-0, 2700000, 864000, 0x5aa34948
-0, 2718000, 864000, 0x328eee01
-0, 2736000, 864000, 0xac92e621
-0, 2754000, 864000, 0x4fa1f5e1
-0, 2772000, 864000, 0xf7c4e8a8
-0, 2790000, 864000, 0xc358bd58
-0, 2808000, 864000, 0x29ec4b27
-0, 2826000, 864000, 0xf7219c88
-0, 2844000, 864000, 0xe77ff130
-0, 2862000, 864000, 0x73683417
-0, 2880000, 864000, 0x08b6be77
-0, 2898000, 864000, 0x3a7eea6f
-0, 2916000, 864000, 0xb319cce7
-0, 2934000, 864000, 0x9607b13e
-0, 2952000, 864000, 0x30543f0d
-0, 2970000, 864000, 0x56915a9e
-0, 2988000, 864000, 0x79f158a6
-0, 3006000, 864000, 0x498b8bd6
-0, 3024000, 864000, 0xe9ad7046
-0, 3042000, 864000, 0xe9ad7046
-0, 3060000, 864000, 0x10317e0e
-0, 3078000, 864000, 0x10317e0e
-0, 3096000, 864000, 0x10317e0e
-0, 3114000, 864000, 0x99ec7046
-0, 3132000, 864000, 0x924d46ee
-0, 3150000, 864000, 0x98bf333e
-0, 3168000, 864000, 0xb2625c96
-0, 3186000, 864000, 0xb46b3926
-0, 3204000, 864000, 0xeb4e5c96
-0, 3222000, 864000, 0x87154ece
-0, 3240000, 864000, 0x9e4c666e
-0, 3258000, 864000, 0x65b53d16
-0, 3276000, 864000, 0x99e85e8e
-0, 3294000, 864000, 0x650ba17e
-0, 3312000, 864000, 0x1ecb000e
-0, 3330000, 864000, 0xb942327d
-0, 3348000, 864000, 0x1bf20925
-0, 3366000, 864000, 0x61dba6a5
-0, 3384000, 864000, 0x5de16d8d
-0, 3402000, 864000, 0x4eb1f75d
-0, 3420000, 864000, 0x4eb1f75d
-0, 3438000, 864000, 0xd0750144
diff --git a/tests/ref/fate/vmnc-32bit b/tests/ref/fate/vmnc-32bit
deleted file mode 100644
index fa3d6a0..0000000
--- a/tests/ref/fate/vmnc-32bit
+++ /dev/null
@@ -1,171 +0,0 @@
-0, 0, 3655644, 0x87973530
-0, 18000, 3655644, 0x87973530
-0, 36000, 3655644, 0x3c3167fd
-0, 54000, 3655644, 0x87973530
-0, 72000, 3655644, 0x87973530
-0, 90000, 3655644, 0x3c3167fd
-0, 108000, 3655644, 0x3c3167fd
-0, 126000, 3655644, 0x87973530
-0, 144000, 3655644, 0x87973530
-0, 162000, 3655644, 0x87973530
-0, 180000, 3655644, 0x87973530
-0, 198000, 3655644, 0x3c3167fd
-0, 216000, 3655644, 0x87973530
-0, 234000, 3655644, 0x87973530
-0, 252000, 3655644, 0x87973530
-0, 270000, 3655644, 0x4f0da763
-0, 288000, 3655644, 0x4f0da763
-0, 306000, 3655644, 0x4f0da763
-0, 324000, 3655644, 0x66a4a763
-0, 342000, 3655644, 0xb20a7496
-0, 360000, 3655644, 0x66a4a763
-0, 378000, 3655644, 0x66a4a763
-0, 396000, 3655644, 0x66a4a763
-0, 414000, 3655644, 0x5600644a
-0, 432000, 3655644, 0xce5880ee
-0, 450000, 3655644, 0xce5880ee
-0, 468000, 3655644, 0xa993ef3d
-0, 486000, 3655644, 0xa993ef3d
-0, 504000, 3655644, 0xa993ef3d
-0, 522000, 3655644, 0xa993ef3d
-0, 540000, 3655644, 0xa993ef3d
-0, 558000, 3655644, 0xa993ef3d
-0, 576000, 3655644, 0xa993ef3d
-0, 594000, 3655644, 0xa993ef3d
-0, 612000, 3655644, 0xa993ef3d
-0, 630000, 3655644, 0xa993ef3d
-0, 648000, 3655644, 0xa993ef3d
-0, 666000, 3655644, 0xa993ef3d
-0, 684000, 3655644, 0xa993ef3d
-0, 702000, 3655644, 0xa993ef3d
-0, 720000, 3655644, 0xa993ef3d
-0, 738000, 3655644, 0xa993ef3d
-0, 756000, 3655644, 0xa993ef3d
-0, 774000, 3655644, 0xa993ef3d
-0, 792000, 3655644, 0xa993ef3d
-0, 810000, 3655644, 0xa993ef3d
-0, 828000, 3655644, 0xa993ef3d
-0, 846000, 3655644, 0xa993ef3d
-0, 864000, 3655644, 0xa993ef3d
-0, 882000, 3655644, 0x73564014
-0, 900000, 3655644, 0x73564014
-0, 918000, 3655644, 0x73564014
-0, 936000, 3655644, 0x73564014
-0, 954000, 3655644, 0x73564014
-0, 972000, 3655644, 0x73564014
-0, 990000, 3655644, 0x73564014
-0, 1008000, 3655644, 0x73564014
-0, 1026000, 3655644, 0x73564014
-0, 1044000, 3655644, 0x73564014
-0, 1062000, 3655644, 0x73564014
-0, 1080000, 3655644, 0x73564014
-0, 1098000, 3655644, 0x2a6e1e8c
-0, 1116000, 3655644, 0x2a6e1e8c
-0, 1134000, 3655644, 0x2a6e1e8c
-0, 1152000, 3655644, 0xbae02e7c
-0, 1170000, 3655644, 0xbae02e7c
-0, 1188000, 3655644, 0xbae02e7c
-0, 1206000, 3655644, 0xbae02e7c
-0, 1224000, 3655644, 0x55af4a2d
-0, 1242000, 3655644, 0x55af4a2d
-0, 1260000, 3655644, 0x55af4a2d
-0, 1278000, 3655644, 0x55af4a2d
-0, 1296000, 3655644, 0x54b7ff2d
-0, 1314000, 3655644, 0x39af1aed
-0, 1332000, 3655644, 0x39af1aed
-0, 1350000, 3655644, 0x39af1aed
-0, 1368000, 3655644, 0x39af1aed
-0, 1386000, 3655644, 0xe48dd11c
-0, 1404000, 3655644, 0xe48dd11c
-0, 1422000, 3655644, 0xe48dd11c
-0, 1440000, 3655644, 0xe48dd11c
-0, 1458000, 3655644, 0xe48dd11c
-0, 1476000, 3655644, 0xba15c78d
-0, 1494000, 3655644, 0xba15c78d
-0, 1512000, 3655644, 0xba15c78d
-0, 1530000, 3655644, 0xba15c78d
-0, 1548000, 3655644, 0xba15c78d
-0, 1566000, 3655644, 0xba15c78d
-0, 1584000, 3655644, 0xba15c78d
-0, 1602000, 3655644, 0x39af1aed
-0, 1620000, 3655644, 0x39af1aed
-0, 1638000, 3655644, 0x39af1aed
-0, 1656000, 3655644, 0x39af1aed
-0, 1674000, 3655644, 0x39af1aed
-0, 1692000, 3655644, 0x39af1aed
-0, 1710000, 3655644, 0x39af1aed
-0, 1728000, 3655644, 0x27f96cd8
-0, 1746000, 3655644, 0x27f96cd8
-0, 1764000, 3655644, 0x27f96cd8
-0, 1782000, 3655644, 0x27f96cd8
-0, 1800000, 3655644, 0x27f96cd8
-0, 1818000, 3655644, 0x27f96cd8
-0, 1836000, 3655644, 0x27f96cd8
-0, 1854000, 3655644, 0xf4f068dc
-0, 1872000, 3655644, 0xf4f068dc
-0, 1890000, 3655644, 0xf4f068dc
-0, 1908000, 3655644, 0xf4f068dc
-0, 1926000, 3655644, 0xf4f068dc
-0, 1944000, 3655644, 0xf4f068dc
-0, 1962000, 3655644, 0xf4f068dc
-0, 1980000, 3655644, 0xf1c55cf5
-0, 1998000, 3655644, 0xd932633d
-0, 2016000, 3655644, 0xd932633d
-0, 2034000, 3655644, 0xc6e95e0a
-0, 2052000, 3655644, 0x9a63c9de
-0, 2070000, 3655644, 0xf166ad4f
-0, 2088000, 3655644, 0xe9eeba41
-0, 2106000, 3655644, 0x7e598ad7
-0, 2124000, 3655644, 0xf3bd257e
-0, 2142000, 3655644, 0xf3bd257e
-0, 2160000, 3655644, 0xf3bd257e
-0, 2178000, 3655644, 0xf3bd257e
-0, 2196000, 3655644, 0xf3bd257e
-0, 2214000, 3655644, 0xf35b3852
-0, 2232000, 3655644, 0xf35b3852
-0, 2250000, 3655644, 0xf35b3852
-0, 2268000, 3655644, 0xf35b3852
-0, 2286000, 3655644, 0x9d553959
-0, 2304000, 3655644, 0x0a9de8e2
-0, 2322000, 3655644, 0xf2325b6c
-0, 2340000, 3655644, 0xf2325b6c
-0, 2358000, 3655644, 0xf2325b6c
-0, 2376000, 3655644, 0xf2325b6c
-0, 2394000, 3655644, 0xf2325b6c
-0, 2412000, 3655644, 0xf2325b6c
-0, 2430000, 3655644, 0xcf924028
-0, 2448000, 3655644, 0xcf924028
-0, 2466000, 3655644, 0x8dae55bc
-0, 2484000, 3655644, 0x8dae55bc
-0, 2502000, 3655644, 0x57b08ced
-0, 2520000, 3655644, 0x57b08ced
-0, 2538000, 3655644, 0xef89a1d8
-0, 2556000, 3655644, 0xef89a1d8
-0, 2574000, 3655644, 0x69e5503a
-0, 2592000, 3655644, 0x69e5503a
-0, 2610000, 3655644, 0xc3de7b3f
-0, 2628000, 3655644, 0xc3de7b3f
-0, 2646000, 3655644, 0x88eea64a
-0, 2664000, 3655644, 0x88eea64a
-0, 2682000, 3655644, 0xe39cce1f
-0, 2700000, 3655644, 0xe39cce1f
-0, 2718000, 3655644, 0xe39cce1f
-0, 2736000, 3655644, 0xe39cce1f
-0, 2754000, 3655644, 0xe39cce1f
-0, 2772000, 3655644, 0xe39cce1f
-0, 2790000, 3655644, 0xe39cce1f
-0, 2808000, 3655644, 0xe39cce1f
-0, 2826000, 3655644, 0xe39cce1f
-0, 2844000, 3655644, 0xe39cce1f
-0, 2862000, 3655644, 0xe39cce1f
-0, 2880000, 3655644, 0xe39cce1f
-0, 2898000, 3655644, 0xe39cce1f
-0, 2916000, 3655644, 0xf0ed0d04
-0, 2934000, 3655644, 0xf0ed0d04
-0, 2952000, 3655644, 0xf0ed0d04
-0, 2970000, 3655644, 0xf0ed0d04
-0, 2988000, 3655644, 0x32490d3e
-0, 3006000, 3655644, 0x32490d3e
-0, 3024000, 3655644, 0x32490d3e
-0, 3042000, 3655644, 0x32490d3e
-0, 3060000, 3655644, 0x32490d3e
diff --git a/tests/ref/fate/vp5 b/tests/ref/fate/vp5
deleted file mode 100644
index bf67801..0000000
--- a/tests/ref/fate/vp5
+++ /dev/null
@@ -1,246 +0,0 @@
-0, 0, 233472, 0x27488413
-0, 3754, 233472, 0x4af384b5
-0, 7508, 233472, 0x948d845d
-0, 11261, 233472, 0xd6ed845e
-0, 15015, 233472, 0x230f8444
-0, 18769, 233472, 0x230f8444
-0, 22523, 233472, 0x230f8444
-0, 26276, 233472, 0xa5078424
-0, 30030, 233472, 0xa5078424
-0, 33784, 233472, 0xa5078424
-0, 37538, 233472, 0xa5078424
-0, 41291, 233472, 0xa5078424
-0, 45045, 233472, 0xa5078424
-0, 48799, 233472, 0xa5078424
-0, 52553, 233472, 0xa5078424
-0, 56306, 233472, 0xa5078424
-0, 60060, 233472, 0xa5078424
-0, 63814, 233472, 0xa5078424
-0, 67568, 233472, 0xa5078424
-0, 71321, 233472, 0xa5078424
-0, 75075, 233472, 0xa5078424
-0, 78829, 233472, 0xa5078424
-0, 82583, 233472, 0xa5078424
-0, 86336, 233472, 0xa5078424
-0, 90090, 233472, 0xa5078424
-0, 93844, 233472, 0xa5078424
-0, 97598, 233472, 0xa5078424
-0, 101351, 233472, 0xa5078424
-0, 105105, 233472, 0xa5078424
-0, 108859, 233472, 0xa5078424
-0, 112613, 233472, 0xa5078424
-0, 116366, 233472, 0xa5078424
-0, 120120, 233472, 0xa5078424
-0, 123874, 233472, 0xa5078424
-0, 127628, 233472, 0xa5078424
-0, 131381, 233472, 0xa5078424
-0, 135135, 233472, 0xa5078424
-0, 138889, 233472, 0xa5078424
-0, 142643, 233472, 0xa5078424
-0, 146396, 233472, 0xa5078424
-0, 150150, 233472, 0x05667dea
-0, 153904, 233472, 0x6ae1823e
-0, 157658, 233472, 0x3c8a7ea9
-0, 161411, 233472, 0xcae2832a
-0, 165165, 233472, 0x547a7ec2
-0, 168919, 233472, 0xa6628327
-0, 172673, 233472, 0xecd77edc
-0, 176426, 233472, 0xe9538356
-0, 180180, 233472, 0xca297eb1
-0, 183934, 233472, 0xe5648329
-0, 187688, 233472, 0xad8c7e94
-0, 191441, 233472, 0xca0d82fc
-0, 195195, 233472, 0x62277e8d
-0, 198949, 233472, 0x7ef782f5
-0, 202703, 233472, 0x09b27e8d
-0, 206456, 233472, 0x66f382f5
-0, 210210, 233472, 0x0aaa7e8d
-0, 213964, 233472, 0x676b82f5
-0, 217718, 233472, 0x0a8a7e8d
-0, 221471, 233472, 0x670b82f5
-0, 225225, 233472, 0x09fa7e8d
-0, 228979, 233472, 0x671b82f5
-0, 232733, 233472, 0x0ac27e8d
-0, 236486, 233472, 0x674382f5
-0, 240240, 233472, 0x0a727e8d
-0, 243994, 233472, 0x673382f5
-0, 247748, 233472, 0x0a127e8d
-0, 251501, 233472, 0x66f382f5
-0, 255255, 233472, 0x0aaa7e8d
-0, 259009, 233472, 0x676b82f5
-0, 262763, 233472, 0x0a8a7e8d
-0, 266516, 233472, 0x670b82f5
-0, 270270, 233472, 0x09fa7e8d
-0, 274024, 233472, 0x671b82f5
-0, 277778, 233472, 0x0ac27e8d
-0, 281531, 233472, 0x674382f5
-0, 285285, 233472, 0x0a727e8d
-0, 289039, 233472, 0x673382f5
-0, 292793, 233472, 0x0a127e8d
-0, 296546, 233472, 0xa3917e7f
-0, 300300, 233472, 0x0554868d
-0, 304054, 233472, 0x05ba6d7a
-0, 307808, 233472, 0x05ba6d7a
-0, 311561, 233472, 0x05ba6d7a
-0, 315315, 233472, 0x05ba6d7a
-0, 319069, 233472, 0x05ba6d7a
-0, 322823, 233472, 0x05ba6d7a
-0, 326576, 233472, 0x05ba6d7a
-0, 330330, 233472, 0x05ba6d7a
-0, 334084, 233472, 0x05ba6d7a
-0, 337838, 233472, 0x05ba6d7a
-0, 341591, 233472, 0x05ba6d7a
-0, 345345, 233472, 0x05ba6d7a
-0, 349099, 233472, 0x05ba6d7a
-0, 352853, 233472, 0x05ba6d7a
-0, 356606, 233472, 0x05ba6d7a
-0, 360360, 233472, 0x05ba6d7a
-0, 364114, 233472, 0x05ba6d7a
-0, 367868, 233472, 0x05ba6d7a
-0, 371621, 233472, 0x05ba6d7a
-0, 375375, 233472, 0x05ba6d7a
-0, 379129, 233472, 0x05ba6d7a
-0, 382883, 233472, 0x05ba6d7a
-0, 386636, 233472, 0x05ba6d7a
-0, 390390, 233472, 0x3a6a6d61
-0, 394144, 233472, 0x0bab7adc
-0, 397898, 233472, 0x12b44993
-0, 401651, 233472, 0xa20ad6d1
-0, 405405, 233472, 0xfd916a4a
-0, 409159, 233472, 0xd34f3e95
-0, 412913, 233472, 0x19571d5c
-0, 416666, 233472, 0x7c8351ad
-0, 420420, 233472, 0xea279823
-0, 424174, 233472, 0xc5011cfd
-0, 427928, 233472, 0xbd7fb9af
-0, 431681, 233472, 0xdfb3bb7c
-0, 435435, 233472, 0x6d631236
-0, 439189, 233472, 0xdb579a7b
-0, 442943, 233472, 0x47584a3e
-0, 446696, 233472, 0x7a27a914
-0, 450450, 233472, 0x2996270d
-0, 454204, 233472, 0xefeaa7ed
-0, 457958, 233472, 0xa3e74ae1
-0, 461711, 233472, 0x8a51d61c
-0, 465465, 233472, 0x25085ee7
-0, 469219, 233472, 0x0a811253
-0, 472973, 233472, 0x7d3eda84
-0, 476726, 233472, 0xd0a0887d
-0, 480480, 233472, 0xc9e6702c
-0, 484234, 233472, 0x0da14346
-0, 487988, 233472, 0x040f0605
-0, 491741, 233472, 0x76ea841a
-0, 495495, 233472, 0x105b6600
-0, 499249, 233472, 0x73015e08
-0, 503003, 233472, 0xe77d6662
-0, 506756, 233472, 0x7514fcd1
-0, 510510, 233472, 0xb091a850
-0, 514264, 233472, 0x74ccdccd
-0, 518018, 233472, 0xd1c002fc
-0, 521771, 233472, 0x7bfcfdac
-0, 525525, 233472, 0xf48a133f
-0, 529279, 233472, 0x279c16dd
-0, 533033, 233472, 0x58427907
-0, 536786, 233472, 0x4668a8f2
-0, 540540, 233472, 0x93fb555f
-0, 544294, 233472, 0x49ed3cf2
-0, 548048, 233472, 0xd620fac9
-0, 551801, 233472, 0xe4efae83
-0, 555555, 233472, 0xe4d377be
-0, 559309, 233472, 0x6fc229c1
-0, 563063, 233472, 0xab5a8898
-0, 566816, 233472, 0x58a493dd
-0, 570570, 233472, 0x5c1c1093
-0, 574324, 233472, 0x2d831af9
-0, 578078, 233472, 0x9a0d3cdf
-0, 581831, 233472, 0x2be78f0b
-0, 585585, 233472, 0xfc7cc656
-0, 589339, 233472, 0xaa8624b7
-0, 593093, 233472, 0xb9c9afc1
-0, 596846, 233472, 0x709e8009
-0, 600600, 233472, 0xd2260830
-0, 604354, 233472, 0xadb3954e
-0, 608108, 233472, 0x74fc3e65
-0, 611861, 233472, 0xb4bcdea4
-0, 615615, 233472, 0x60c46cf5
-0, 619369, 233472, 0x0e48eff8
-0, 623123, 233472, 0x60e46733
-0, 626876, 233472, 0x708ec89f
-0, 630630, 233472, 0x1f11264e
-0, 634384, 233472, 0x6cba8300
-0, 638138, 233472, 0xd1a5d756
-0, 641891, 233472, 0xb936621e
-0, 645645, 233472, 0x1667b4af
-0, 649399, 233472, 0xc212276d
-0, 653153, 233472, 0x9d7a871d
-0, 656906, 233472, 0xb52834f9
-0, 660660, 233472, 0x983bde84
-0, 664414, 233472, 0xd1c63d88
-0, 668168, 233472, 0xa38cb687
-0, 671921, 233472, 0xd81bf8ff
-0, 675675, 233472, 0x688b231a
-0, 679429, 233472, 0xd5ad3038
-0, 683183, 233472, 0xcd227f74
-0, 686936, 233472, 0x81ec23d6
-0, 690690, 233472, 0x52c1cd86
-0, 694444, 233472, 0xa4199853
-0, 698198, 233472, 0xe82c83e4
-0, 701951, 233472, 0xe9810f88
-0, 705705, 233472, 0x37e95ae7
-0, 709459, 233472, 0xf6974d5d
-0, 713213, 233472, 0x31788551
-0, 716966, 233472, 0x00d6c539
-0, 720720, 233472, 0xdbb52151
-0, 724474, 233472, 0x594433d3
-0, 728228, 233472, 0xeec44f91
-0, 731981, 233472, 0x302894bf
-0, 735735, 233472, 0x44f5ddc3
-0, 739489, 233472, 0x6c1edd28
-0, 743243, 233472, 0x7fd1e412
-0, 746996, 233472, 0xd771f11b
-0, 750750, 233472, 0x09c675d5
-0, 754504, 233472, 0x8fd9112e
-0, 758258, 233472, 0x602002e5
-0, 762011, 233472, 0xb9a22029
-0, 765765, 233472, 0x18e99807
-0, 769519, 233472, 0x3d8657d8
-0, 773273, 233472, 0x4cd73a85
-0, 777026, 233472, 0x84ddb474
-0, 780780, 233472, 0x69636bb8
-0, 784534, 233472, 0xa0436d50
-0, 788288, 233472, 0x93c86d78
-0, 792041, 233472, 0x05ba6d7a
-0, 795795, 233472, 0x05ba6d7a
-0, 799549, 233472, 0x05ba6d7a
-0, 803303, 233472, 0x126c6406
-0, 807056, 233472, 0xe3885a3a
-0, 810810, 233472, 0xf1256fe9
-0, 814564, 233472, 0x5a84377e
-0, 818318, 233472, 0x7c392d90
-0, 822071, 233472, 0x8a74df48
-0, 825825, 233472, 0xfa394653
-0, 829579, 233472, 0xcbe0cc1b
-0, 833333, 233472, 0xbf8639cf
-0, 837086, 233472, 0x7dd2c935
-0, 840840, 233472, 0x1093148f
-0, 844594, 233472, 0x624d7d3e
-0, 848348, 233472, 0xb340cd65
-0, 852101, 233472, 0x6c0ae5c6
-0, 855855, 233472, 0x0c5eaf73
-0, 859609, 233472, 0x27be64ce
-0, 863363, 233472, 0xac8990f4
-0, 867116, 233472, 0x1f935102
-0, 870870, 233472, 0x6e57d96f
-0, 874624, 233472, 0xf246ea4d
-0, 878378, 233472, 0x18058011
-0, 882131, 233472, 0x5951fe6e
-0, 885885, 233472, 0x0f10371d
-0, 889639, 233472, 0xe1481043
-0, 893393, 233472, 0xdedeefcc
-0, 897146, 233472, 0xf8865db2
-0, 900900, 233472, 0xe1b3d4d6
-0, 904654, 233472, 0x81962c43
-0, 908408, 233472, 0xe903d0bb
-0, 912161, 233472, 0x6f530ac6
-0, 915915, 233472, 0x94f7466c
-0, 919669, 233472, 0xa8c1d365
diff --git a/tests/ref/fate/vp6a b/tests/ref/fate/vp6a
deleted file mode 100644
index e6ea0bc..0000000
--- a/tests/ref/fate/vp6a
+++ /dev/null
@@ -1,93 +0,0 @@
-0, 0, 135000, 0x9dceed6d
-0, 22500, 135000, 0xcb87787f
-0, 45000, 135000, 0xdb4361ce
-0, 67500, 135000, 0xb8fd81c2
-0, 90000, 135000, 0xbf86a7af
-0, 112500, 135000, 0x2e7787e3
-0, 135000, 135000, 0x6cec6ebd
-0, 157500, 135000, 0xa4d08c07
-0, 180000, 135000, 0x1be48faf
-0, 202500, 135000, 0xf3cd8ede
-0, 225000, 135000, 0x33ec8a49
-0, 247500, 135000, 0x11e887ec
-0, 270000, 135000, 0x3e215c25
-0, 292500, 135000, 0x1a2cb3f8
-0, 315000, 135000, 0x7fb0e48a
-0, 337500, 135000, 0x749f3738
-0, 360000, 135000, 0x686e78e9
-0, 382500, 135000, 0x29515bc7
-0, 405000, 135000, 0x987126bd
-0, 427500, 135000, 0xdf77bb13
-0, 450000, 135000, 0x5fb1468a
-0, 472500, 135000, 0x06ea50ea
-0, 495000, 135000, 0x7bd9c715
-0, 517500, 135000, 0xdd6e6831
-0, 540000, 135000, 0x0ee3760f
-0, 562500, 135000, 0xc7984dc8
-0, 585000, 135000, 0x7e385bff
-0, 607500, 135000, 0xae155ab9
-0, 630000, 135000, 0xc05ee8f7
-0, 652500, 135000, 0x93de3392
-0, 675000, 135000, 0xfe45b38b
-0, 697500, 135000, 0xeb5ed72c
-0, 720000, 135000, 0x0794cb57
-0, 742500, 135000, 0x2578c6e5
-0, 765000, 135000, 0x78486707
-0, 787500, 135000, 0x41e1f0e6
-0, 810000, 135000, 0x4508eb76
-0, 832500, 135000, 0xd8c087f3
-0, 855000, 135000, 0x1a8db89a
-0, 877500, 135000, 0x6dbd90c6
-0, 900000, 135000, 0x0845e400
-0, 922500, 135000, 0xe8b02fc2
-0, 945000, 135000, 0x8007d813
-0, 967500, 135000, 0xdfb04e69
-0, 990000, 135000, 0x5746cf71
-0, 1012500, 135000, 0xe510299f
-0, 1035000, 135000, 0xeea0c829
-0, 1057500, 135000, 0x7c0578ab
-0, 1080000, 135000, 0xb1569ce9
-0, 1102500, 135000, 0x6c233986
-0, 1125000, 135000, 0x95b77f3d
-0, 1147500, 135000, 0xfc368d80
-0, 1170000, 135000, 0x5c73b064
-0, 1192500, 135000, 0x2206da8d
-0, 1215000, 135000, 0x62bb599e
-0, 1237500, 135000, 0x15a68991
-0, 1260000, 135000, 0x5f5eb810
-0, 1282500, 135000, 0x85a9634a
-0, 1305000, 135000, 0xf24b5c1a
-0, 1327500, 135000, 0x38034850
-0, 1350000, 135000, 0x48fd3599
-0, 1372500, 135000, 0xb9d62408
-0, 1395000, 135000, 0xaf202a21
-0, 1417500, 135000, 0x341aa582
-0, 1440000, 135000, 0x90cdc9bb
-0, 1462500, 135000, 0x0b52f319
-0, 1485000, 135000, 0xce61aa5e
-0, 1507500, 135000, 0x988acb45
-0, 1530000, 135000, 0xcd353664
-0, 1552500, 135000, 0xa80c8ce9
-0, 1575000, 135000, 0x15dce784
-0, 1597500, 135000, 0x16bd4519
-0, 1620000, 135000, 0x571712f3
-0, 1642500, 135000, 0x6b109f1e
-0, 1665000, 135000, 0x8e4c19aa
-0, 1687500, 135000, 0x4132bd4c
-0, 1710000, 135000, 0x5babafe2
-0, 1732500, 135000, 0xddef6313
-0, 1755000, 135000, 0x76d6b48b
-0, 1777500, 135000, 0x929e7702
-0, 1800000, 135000, 0x33f5e4a1
-0, 1822500, 135000, 0xdb7041bf
-0, 1845000, 135000, 0xbc761e04
-0, 1867500, 135000, 0x0b2a81e6
-0, 1890000, 135000, 0xf6fd20ea
-0, 1912500, 135000, 0x1894a26c
-0, 1935000, 135000, 0xb25e216f
-0, 1957500, 135000, 0x83bb02ee
-0, 1980000, 135000, 0x6952a3c3
-0, 2002500, 135000, 0x372184d6
-0, 2025000, 135000, 0x2ac47afe
-0, 2047500, 135000, 0x14c33a35
-0, 2070000, 135000, 0xdc08470e
diff --git a/tests/ref/fate/vp6f b/tests/ref/fate/vp6f
deleted file mode 100644
index b942685..0000000
--- a/tests/ref/fate/vp6f
+++ /dev/null
@@ -1,174 +0,0 @@
-0, 0, 13440, 0x7cb0a22f
-0, 9000, 13440, 0xdfcea6ba
-0, 18000, 13440, 0x59b2a5da
-0, 27000, 13440, 0x12f1b2d8
-0, 36000, 13440, 0x280fb9f6
-0, 45000, 13440, 0x7bace8b3
-0, 54000, 13440, 0x4ec91480
-0, 63000, 13440, 0xa8010450
-0, 72000, 13440, 0x61d8fc46
-0, 81000, 13440, 0x242bb24e
-0, 90000, 13440, 0x88397a36
-0, 99000, 13440, 0x10e15726
-0, 108000, 13440, 0x3018438c
-0, 117000, 13440, 0xbbb94c21
-0, 126000, 13440, 0xfc3e5e2b
-0, 135000, 13440, 0xeaa69354
-0, 144000, 13440, 0x96f1cc01
-0, 153000, 13440, 0x333fdaff
-0, 162000, 13440, 0xb5230ed2
-0, 171000, 13440, 0x59383446
-0, 180000, 13440, 0x954939e6
-0, 189000, 13440, 0x53813d2f
-0, 198000, 13440, 0x3ca53600
-0, 207000, 13440, 0x7b30227a
-0, 216000, 13440, 0x5145bbfe
-0, 225000, 13440, 0xa0979632
-0, 234000, 13440, 0x08026e21
-0, 243000, 13440, 0x3f456d1e
-0, 252000, 13440, 0x7d036b62
-0, 261000, 13440, 0x508085fb
-0, 270000, 13440, 0x251dc193
-0, 279000, 13440, 0xf3121c9b
-0, 288000, 13440, 0xf5da772e
-0, 297000, 13440, 0x8179ccf7
-0, 306000, 13440, 0xd57ceeb3
-0, 315000, 13440, 0xc8f2169c
-0, 324000, 13440, 0xbf8296c3
-0, 333000, 13440, 0xee1927d0
-0, 342000, 13440, 0xdd84e8d1
-0, 351000, 13440, 0x7be57be2
-0, 360000, 13440, 0xae353f91
-0, 369000, 13440, 0x3ae927f2
-0, 378000, 13440, 0x417227c6
-0, 387000, 13440, 0x32572bea
-0, 396000, 13440, 0x8b9e4839
-0, 405000, 13440, 0xad669441
-0, 414000, 13440, 0xc9de99a6
-0, 423000, 13440, 0xb3ffb88b
-0, 432000, 13440, 0xb321b8a0
-0, 441000, 13440, 0x2efdbf53
-0, 450000, 13440, 0x9b7aa566
-0, 459000, 13440, 0x563c8d60
-0, 468000, 13440, 0xe3848ee8
-0, 477000, 13440, 0xa84b8f1d
-0, 486000, 13440, 0x52da9f9f
-0, 495000, 13440, 0x2ed56d97
-0, 504000, 13440, 0x4e8534c2
-0, 513000, 13440, 0x318900a6
-0, 522000, 13440, 0xda96de39
-0, 531000, 13440, 0xaae7ac0b
-0, 540000, 13440, 0x7533ad99
-0, 549000, 13440, 0x4e70c2c9
-0, 558000, 13440, 0x9ce5e3fa
-0, 567000, 13440, 0xc788fbbc
-0, 576000, 13440, 0xd36604a9
-0, 585000, 13440, 0x246221a4
-0, 594000, 13440, 0x290c5c2b
-0, 603000, 13440, 0xde6c68ec
-0, 612000, 13440, 0x56248dbf
-0, 621000, 13440, 0x5b898cbd
-0, 630000, 13440, 0x090574b9
-0, 639000, 13440, 0x8df2814a
-0, 648000, 13440, 0xd4a6b285
-0, 657000, 13440, 0xa016e921
-0, 666000, 13440, 0x7f93fdc1
-0, 675000, 13440, 0xfd0dee6f
-0, 684000, 13440, 0xef04ce0e
-0, 693000, 13440, 0x7560bee3
-0, 702000, 13440, 0x5a8cdc85
-0, 711000, 13440, 0x4788f7bc
-0, 720000, 13440, 0xc001e34d
-0, 729000, 13440, 0xc687eb74
-0, 738000, 13440, 0xbf20feba
-0, 747000, 13440, 0xd32647a8
-0, 756000, 13440, 0xe69a955a
-0, 765000, 13440, 0x1b56951f
-0, 774000, 13440, 0xd1977378
-0, 783000, 13440, 0x1620357d
-0, 792000, 13440, 0x2596116f
-0, 801000, 13440, 0x7473feca
-0, 810000, 13440, 0x7f92bb47
-0, 819000, 13440, 0x6866a683
-0, 828000, 13440, 0xe9b08d7e
-0, 837000, 13440, 0xa3fd7546
-0, 846000, 13440, 0xa4416522
-0, 855000, 13440, 0xd8f5572e
-0, 864000, 13440, 0xf5746dbd
-0, 873000, 13440, 0x256a87c6
-0, 882000, 13440, 0x722aa2c8
-0, 891000, 13440, 0xb26de5f5
-0, 900000, 13440, 0x117f0841
-0, 909000, 13440, 0xda2d192c
-0, 918000, 13440, 0xb022442d
-0, 927000, 13440, 0xbc4044f2
-0, 936000, 13440, 0x68b330da
-0, 945000, 13440, 0xc07228cf
-0, 954000, 13440, 0xaa3f3d44
-0, 963000, 13440, 0x25867aad
-0, 972000, 13440, 0xa3ecb432
-0, 981000, 13440, 0x93ccdcbb
-0, 990000, 13440, 0x8302fa4f
-0, 999000, 13440, 0x2f960f33
-0, 1008000, 13440, 0x15d41d14
-0, 1017000, 13440, 0x636529d0
-0, 1026000, 13440, 0x11035be5
-0, 1035000, 13440, 0x9b6e9167
-0, 1044000, 13440, 0x7b01adc7
-0, 1053000, 13440, 0xa237e05d
-0, 1062000, 13440, 0xd2f4f134
-0, 1071000, 13440, 0x2052d368
-0, 1080000, 13440, 0x08f7ae0d
-0, 1089000, 13440, 0xa89185bc
-0, 1098000, 13440, 0xfa628236
-0, 1107000, 13440, 0xdf79848b
-0, 1116000, 13440, 0xd19a906f
-0, 1125000, 13440, 0x219f9324
-0, 1134000, 13440, 0x46509b6d
-0, 1143000, 13440, 0xc5d9a568
-0, 1152000, 13440, 0xb21aaaa8
-0, 1161000, 13440, 0x925a97ed
-0, 1170000, 13440, 0xc5e3557f
-0, 1179000, 13440, 0x7c57155a
-0, 1188000, 13440, 0x6b26d005
-0, 1197000, 13440, 0xfdc7b369
-0, 1206000, 13440, 0x99919fc2
-0, 1215000, 13440, 0xcfe889e4
-0, 1224000, 13440, 0xd1196856
-0, 1233000, 13440, 0xec8348c6
-0, 1242000, 13440, 0x5ede0d9a
-0, 1251000, 13440, 0x198ef66e
-0, 1260000, 13440, 0x62fcefdf
-0, 1269000, 13440, 0x7791f415
-0, 1278000, 13440, 0xfbdb0029
-0, 1287000, 13440, 0xdab12b01
-0, 1296000, 13440, 0x646b2d5f
-0, 1305000, 13440, 0x5410f52e
-0, 1314000, 13440, 0x7186eef8
-0, 1323000, 13440, 0xca251ef6
-0, 1332000, 13440, 0x757c3b43
-0, 1341000, 13440, 0x59ff4982
-0, 1350000, 13440, 0xbe8ff084
-0, 1359000, 13440, 0xc85a9e38
-0, 1368000, 13440, 0x541b9a19
-0, 1377000, 13440, 0x274893c9
-0, 1386000, 13440, 0x7634b5d2
-0, 1395000, 13440, 0x1bd8e10c
-0, 1404000, 13440, 0xa661dfb1
-0, 1413000, 13440, 0x9d01bf92
-0, 1422000, 13440, 0xcb1eb220
-0, 1431000, 13440, 0x0ce27d25
-0, 1440000, 13440, 0x523b594f
-0, 1449000, 13440, 0xf0a04c4f
-0, 1458000, 13440, 0x0f0ffc3d
-0, 1467000, 13440, 0xb0d8b778
-0, 1476000, 13440, 0x5137a642
-0, 1485000, 13440, 0xd213a552
-0, 1494000, 13440, 0xc2fbc9b1
-0, 1503000, 13440, 0xfc2ee379
-0, 1512000, 13440, 0xfb80f737
-0, 1521000, 13440, 0xd6cb2447
-0, 1530000, 13440, 0x124b606d
-0, 1539000, 13440, 0xf788a066
-0, 1548000, 13440, 0xa16eed6e
-0, 1557000, 13440, 0x73ff0f82
diff --git a/tests/ref/fate/vqa-cc b/tests/ref/fate/vqa-cc
deleted file mode 100644
index 5ad2916..0000000
--- a/tests/ref/fate/vqa-cc
+++ /dev/null
@@ -1,78 +0,0 @@
-1, 0, 22048, 0x0665d7f4
-0, 0, 192000, 0x00000000
-0, 6000, 192000, 0x00000000
-0, 12000, 192000, 0x00000000
-0, 18000, 192000, 0x00000000
-0, 24000, 192000, 0xcd900ccc
-0, 30000, 192000, 0xfd496438
-0, 36000, 192000, 0x965f0bf3
-0, 42000, 192000, 0x378fca5f
-1, 44996, 2940, 0x0f3c64cb
-0, 48000, 192000, 0x5ccd8966
-1, 50996, 2940, 0xc90b9e78
-0, 54000, 192000, 0x859676f9
-1, 56996, 2940, 0x146246a3
-0, 60000, 192000, 0x820bfb1c
-1, 62996, 2940, 0xd22c714e
-0, 66000, 192000, 0x7570cc05
-1, 68996, 2940, 0xd86b681e
-0, 72000, 192000, 0xf38bdb06
-1, 74996, 2940, 0x12ec8186
-0, 78000, 192000, 0x9b0cbb44
-1, 80996, 2940, 0x69aa85b6
-0, 84000, 192000, 0x0ed70665
-1, 86996, 2940, 0xb24d33b0
-0, 90000, 192000, 0xd16de7fc
-1, 92996, 2940, 0x3f7b0f0d
-0, 96000, 192000, 0x97afb484
-1, 98996, 2940, 0x64f10f7e
-0, 102000, 192000, 0x012893f3
-1, 104996, 2940, 0xd6ea379a
-0, 108000, 192000, 0x742a4b43
-1, 110996, 2940, 0x7c38e830
-0, 114000, 192000, 0x309dcd75
-1, 116996, 2940, 0xc28ff132
-0, 120000, 192000, 0xed7814ac
-1, 122996, 2940, 0xe7b11629
-0, 126000, 192000, 0xdb7de3d7
-1, 128996, 2940, 0xeb86fdcb
-0, 132000, 192000, 0xe18679a3
-1, 134996, 2940, 0x5508f586
-0, 138000, 192000, 0xb1f213f4
-1, 140996, 2940, 0xf4fa1f1b
-0, 144000, 192000, 0x33c99b5c
-1, 146996, 2940, 0x9e5ff976
-0, 150000, 192000, 0xf66c0c91
-1, 152996, 2940, 0xcfc4e08f
-0, 156000, 192000, 0x929cdc73
-1, 158996, 2940, 0x74bde7ed
-0, 162000, 192000, 0xa723fc3b
-1, 164996, 2940, 0x3e4ae245
-0, 168000, 192000, 0xe6395ccc
-1, 170996, 2940, 0x4c6a8e56
-0, 174000, 192000, 0x147fbf74
-1, 176996, 2940, 0xa09d86ab
-0, 180000, 192000, 0x3ec62d28
-1, 182996, 2940, 0xc8531912
-0, 186000, 192000, 0x22104ffb
-1, 188996, 2940, 0xa5f266aa
-0, 192000, 192000, 0x91f25f58
-1, 194996, 2940, 0x587a4187
-0, 198000, 192000, 0xc91b0e4e
-1, 200996, 2940, 0x14752d45
-0, 204000, 192000, 0x4683df56
-1, 206996, 2940, 0x558cde10
-0, 210000, 192000, 0x8ef8932a
-1, 212996, 2940, 0x735fee38
-0, 216000, 192000, 0xce6c0ec0
-1, 218996, 2940, 0xac8bb6c8
-0, 222000, 192000, 0xcc10e2a0
-1, 224996, 2940, 0xa503c73b
-1, 230996, 2940, 0x7cd588a3
-1, 236996, 2940, 0xa6974b04
-1, 242996, 2940, 0xbf448241
-1, 248996, 2940, 0x2a5c2759
-1, 254996, 2940, 0xd0de5ce0
-1, 260996, 2940, 0xc0486649
-1, 266996, 2940, 0x48b040af
-1, 272996, 2940, 0x82a338a9
diff --git a/tests/ref/fate/vqf-demux b/tests/ref/fate/vqf-demux
deleted file mode 100644
index a06fff3..0000000
--- a/tests/ref/fate/vqf-demux
+++ /dev/null
@@ -1 +0,0 @@
-48313c746da06b157711b13675f37312
diff --git a/tests/ref/fate/w64 b/tests/ref/fate/w64
deleted file mode 100644
index 461eadb..0000000
--- a/tests/ref/fate/w64
+++ /dev/null
@@ -1 +0,0 @@
-CRC=0xc1e71a5c
diff --git a/tests/ref/fate/wc3movie-xan b/tests/ref/fate/wc3movie-xan
deleted file mode 100644
index 8fd2282..0000000
--- a/tests/ref/fate/wc3movie-xan
+++ /dev/null
@@ -1,70 +0,0 @@
-0, 0, 158400, 0x25aec781
-1, 0, 2940, 0x92cee2a6
-0, 6000, 158400, 0xda4dbf70
-1, 6000, 2940, 0x126902c3
-0, 12000, 158400, 0x2d8fc909
-1, 12000, 2940, 0x4977b9e6
-0, 18000, 158400, 0xea93c5ab
-1, 18000, 2940, 0x5144d68c
-0, 24000, 158400, 0xa1f5bf60
-1, 24000, 2940, 0x282ebf71
-0, 30000, 158400, 0x739ecfa9
-1, 30000, 2940, 0xc2e7c73c
-0, 36000, 158400, 0xe9830c7e
-1, 36000, 2940, 0x717d6fc5
-0, 42000, 158400, 0xd885665b
-1, 42000, 2940, 0x78538428
-0, 48000, 158400, 0x3235f8ad
-1, 48000, 2940, 0x94ffd1ad
-0, 54000, 158400, 0xd8550cca
-1, 54000, 2940, 0xad43de8b
-0, 60000, 158400, 0x05e9e231
-1, 60000, 2940, 0x65e4b604
-0, 66000, 158400, 0xce9dd29b
-1, 66000, 2940, 0xd6d6c30f
-0, 72000, 158400, 0x857494a6
-1, 72000, 2940, 0x7b897e4e
-0, 78000, 158400, 0x9cad464a
-1, 78000, 2940, 0xf79546ad
-0, 84000, 158400, 0x04c3177a
-1, 84000, 2940, 0x658c904e
-0, 90000, 158400, 0xa3d2399a
-1, 90000, 2940, 0xb7b8cd8c
-0, 96000, 158400, 0x12cdd418
-1, 96000, 2940, 0x2f2da7c5
-0, 102000, 158400, 0x5ef67c9e
-1, 102000, 2940, 0x51938cf8
-0, 108000, 158400, 0xba7a7f11
-1, 108000, 2940, 0xdf61c87a
-0, 114000, 158400, 0x084b60e7
-1, 114000, 2940, 0xf72a7069
-0, 120000, 158400, 0xef95a6a5
-1, 120000, 2940, 0x9af2a425
-0, 126000, 158400, 0x55f392f1
-1, 126000, 2940, 0x4c3f5ac7
-0, 132000, 158400, 0x63fca6bb
-1, 132000, 2940, 0xfe4cb0b2
-0, 138000, 158400, 0x0f7e62fe
-1, 138000, 2940, 0x732a35ed
-0, 144000, 158400, 0xf35febc1
-1, 144000, 2940, 0x526b9e0f
-0, 150000, 158400, 0x6bf6f219
-1, 150000, 2940, 0x4bd9d4e2
-0, 156000, 158400, 0xbdf13e77
-1, 156000, 2940, 0x84340827
-0, 162000, 158400, 0x88490e47
-1, 162000, 2940, 0xe54f7911
-0, 168000, 158400, 0xdb786540
-1, 168000, 2940, 0x0bbdef52
-0, 174000, 158400, 0x7335c045
-1, 174000, 2940, 0xc1aac5e1
-0, 180000, 158400, 0x6b78015a
-1, 180000, 2940, 0x515ea512
-0, 186000, 158400, 0x9e9b6d16
-1, 186000, 2940, 0x9e7fdac1
-0, 192000, 158400, 0xe618e024
-1, 192000, 2940, 0xf1d4c9cc
-0, 198000, 158400, 0x56cd60f7
-1, 198000, 2940, 0x1bc9b6ee
-0, 204000, 158400, 0xf08e22fe
-1, 204000, 2940, 0xff8ac114
diff --git a/tests/ref/fate/westwood-aud b/tests/ref/fate/westwood-aud
deleted file mode 100644
index f8bec10..0000000
--- a/tests/ref/fate/westwood-aud
+++ /dev/null
@@ -1 +0,0 @@
-5c2528488729035c17c21486797a2a23
diff --git a/tests/ref/fate/wnv1 b/tests/ref/fate/wnv1
deleted file mode 100644
index e7fd7ae..0000000
--- a/tests/ref/fate/wnv1
+++ /dev/null
@@ -1,86 +0,0 @@
-0, 0, 38400, 0x4c3fdc2f
-0, 6000, 38400, 0x11c9d0cb
-0, 12000, 38400, 0x6c37fd7f
-0, 18000, 38400, 0x7e6c9b93
-0, 23999, 38400, 0xc9d4c5f7
-0, 29999, 38400, 0x5038088a
-0, 35999, 38400, 0xa48411b6
-0, 41999, 38400, 0xb9b7e97b
-0, 47999, 38400, 0xce37e037
-0, 53999, 38400, 0x5df528da
-0, 59999, 38400, 0xe4e65876
-0, 65998, 38400, 0x5bf4a46e
-0, 71998, 38400, 0xee478c2a
-0, 77998, 38400, 0x51a555c2
-0, 83998, 38400, 0x30a4030a
-0, 89998, 38400, 0xb13802d6
-0, 95998, 38400, 0x45ef5482
-0, 101997, 38400, 0x00aef51b
-0, 107997, 38400, 0xe8a71d7e
-0, 113997, 38400, 0x3d185142
-0, 119997, 38400, 0x221f59ea
-0, 125997, 38400, 0x1ae13572
-0, 131997, 38400, 0xe498450e
-0, 137997, 38400, 0xe744747a
-0, 143996, 38400, 0x44ee3352
-0, 149996, 38400, 0x74187342
-0, 155996, 38400, 0xbee9656e
-0, 161996, 38400, 0x645c8d1a
-0, 167996, 38400, 0x443dde1e
-0, 173996, 38400, 0x012106fd
-0, 179996, 38400, 0x4bb86b82
-0, 185995, 38400, 0x152473ba
-0, 191995, 38400, 0xa5214ea2
-0, 197995, 38400, 0x9e8c7046
-0, 203995, 38400, 0xdd95a9ba
-0, 209995, 38400, 0x64c5f292
-0, 215995, 38400, 0xdd42a04a
-0, 221994, 38400, 0x6069359e
-0, 227994, 38400, 0x094bf60f
-0, 233994, 38400, 0x584217be
-0, 239994, 38400, 0x4c5ef453
-0, 245994, 38400, 0x7e83eeb7
-0, 251994, 38400, 0xaa57efb3
-0, 257994, 38400, 0x42b0a66f
-0, 263993, 38400, 0x371fdcbf
-0, 269993, 38400, 0xb8f1e1bf
-0, 275993, 38400, 0x45c91fa6
-0, 281993, 38400, 0x7508338e
-0, 287993, 38400, 0xb5dd91ab
-0, 293993, 38400, 0x0204b38f
-0, 299993, 38400, 0x8ae2da6f
-0, 305992, 38400, 0x926ad59f
-0, 311992, 38400, 0xf9c3234e
-0, 317992, 38400, 0xabcb00f6
-0, 323992, 38400, 0x2d1de7bb
-0, 329992, 38400, 0x332d39ce
-0, 335992, 38400, 0xcd767286
-0, 341991, 38400, 0xf3d046ae
-0, 347991, 38400, 0x7ccc8162
-0, 353991, 38400, 0x09f6997e
-0, 359991, 38400, 0x5fcc6536
-0, 365991, 38400, 0x9959a3b6
-0, 371991, 38400, 0x63a5dcd2
-0, 377991, 38400, 0x66deae96
-0, 383990, 38400, 0x6feb0b1d
-0, 389990, 38400, 0x2063c25e
-0, 395990, 38400, 0x617f93de
-0, 401990, 38400, 0x4251c806
-0, 407990, 38400, 0x702eb68e
-0, 413990, 38400, 0xe80b8ea6
-0, 419990, 38400, 0xa51ec1b2
-0, 425989, 38400, 0x8aa8af8a
-0, 431989, 38400, 0x9a260321
-0, 437989, 38400, 0x2c732c22
-0, 443989, 38400, 0x216ed6a2
-0, 449989, 38400, 0x5558326d
-0, 455989, 38400, 0x0cae4cf5
-0, 461988, 38400, 0xf0e02f3d
-0, 467988, 38400, 0xfddd061d
-0, 473988, 38400, 0x4563e9d6
-0, 479988, 38400, 0xc8ac10d1
-0, 485988, 38400, 0x97f8c3fa
-0, 491988, 38400, 0x86190eb1
-0, 497988, 38400, 0xc9022d65
-0, 503987, 38400, 0x345738d5
-0, 509987, 38400, 0x457ae80e
diff --git a/tests/ref/fate/xan-dpcm b/tests/ref/fate/xan-dpcm
deleted file mode 100644
index cb56677..0000000
--- a/tests/ref/fate/xan-dpcm
+++ /dev/null
@@ -1 +0,0 @@
-b6da857766896ab10bb900004f915053
diff --git a/tests/ref/fate/zlib b/tests/ref/fate/zlib
deleted file mode 100644
index ba6221f..0000000
--- a/tests/ref/fate/zlib
+++ /dev/null
@@ -1 +0,0 @@
-0, 0, 253440, 0x94af61e5
diff --git a/tests/ref/fate/zmbv-15bit b/tests/ref/fate/zmbv-15bit
deleted file mode 100644
index 527c1e6..0000000
--- a/tests/ref/fate/zmbv-15bit
+++ /dev/null
@@ -1,159 +0,0 @@
-0, 0, 192000, 0xe1d317d6
-0, 14193, 192000, 0xe100109d
-0, 28385, 192000, 0xecc69c65
-0, 42578, 192000, 0x68f06324
-0, 56770, 192000, 0x68f06324
-0, 70963, 192000, 0x68f06324
-0, 85155, 192000, 0x68f06324
-0, 99348, 192000, 0x68f06324
-0, 113540, 192000, 0x68f06324
-0, 127733, 192000, 0x68f06324
-0, 141925, 192000, 0x68f06324
-0, 156118, 192000, 0x68f06324
-0, 170310, 192000, 0x68f06324
-0, 184503, 192000, 0x68f06324
-0, 198695, 192000, 0x68f06324
-0, 212888, 192000, 0x68f06324
-0, 227080, 192000, 0x68f06324
-0, 241273, 192000, 0x4c03d2e3
-0, 255466, 192000, 0x4c03d2e3
-0, 269658, 192000, 0x4c03d2e3
-0, 283851, 192000, 0x4c03d2e3
-0, 298043, 192000, 0xb562cf68
-0, 312236, 192000, 0xb562cf68
-0, 326428, 192000, 0xb562cf68
-0, 340621, 192000, 0xb562cf68
-0, 354813, 192000, 0xb562cf68
-0, 369006, 192000, 0x0e5e03c7
-0, 383198, 192000, 0x0e5e03c7
-0, 397391, 192000, 0x0e5e03c7
-0, 411583, 192000, 0x0e5e03c7
-0, 425776, 192000, 0xeb2e0f67
-0, 439968, 192000, 0xeb2e0f67
-0, 454161, 192000, 0xeb2e0f67
-0, 468353, 192000, 0xeb2e0f67
-0, 482546, 192000, 0xeb2e0f67
-0, 496739, 192000, 0xdce603c7
-0, 510931, 192000, 0xdce603c7
-0, 525124, 192000, 0xdce603c7
-0, 539316, 192000, 0xdce603c7
-0, 553509, 192000, 0xa8e7db08
-0, 567701, 192000, 0xa8e7db08
-0, 581894, 192000, 0xa8e7db08
-0, 596086, 192000, 0xa8e7db08
-0, 610279, 192000, 0xa8e7db08
-0, 624471, 192000, 0x322a1b07
-0, 638664, 192000, 0x322a1b07
-0, 652856, 192000, 0x322a1b07
-0, 667049, 192000, 0x322a1b07
-0, 681241, 192000, 0x743206af
-0, 695434, 192000, 0x743206af
-0, 709627, 192000, 0x743206af
-0, 723819, 192000, 0x743206af
-0, 738012, 192000, 0x743206af
-0, 752204, 192000, 0x50195ddf
-0, 766397, 192000, 0x50195ddf
-0, 780589, 192000, 0x50195ddf
-0, 794782, 192000, 0x50195ddf
-0, 808974, 192000, 0xd31620d7
-0, 823167, 192000, 0xd31620d7
-0, 837359, 192000, 0xd31620d7
-0, 851552, 192000, 0xd31620d7
-0, 865744, 192000, 0xd31620d7
-0, 879937, 192000, 0x3af023bf
-0, 894129, 192000, 0x3af023bf
-0, 908322, 192000, 0x3af023bf
-0, 922514, 192000, 0x3af023bf
-0, 936707, 192000, 0x561a124f
-0, 950900, 192000, 0x561a124f
-0, 965092, 192000, 0x561a124f
-0, 979285, 192000, 0x561a124f
-0, 993477, 192000, 0x561a124f
-0, 1007670, 192000, 0x99210c7f
-0, 1021862, 192000, 0x99210c7f
-0, 1036055, 192000, 0x99210c7f
-0, 1050247, 192000, 0x99210c7f
-0, 1064440, 192000, 0xc77b03c7
-0, 1078632, 192000, 0xc77b03c7
-0, 1092825, 192000, 0xc77b03c7
-0, 1107017, 192000, 0xc77b03c7
-0, 1121210, 192000, 0xc77b03c7
-0, 1135402, 192000, 0x83ea7550
-0, 1149595, 192000, 0xec285270
-0, 1163787, 192000, 0x0e075558
-0, 1177980, 192000, 0x880c2108
-0, 1192173, 192000, 0x40c523f0
-0, 1206365, 192000, 0x01378f78
-0, 1220558, 192000, 0x42045558
-0, 1234750, 192000, 0xde8f3278
-0, 1248943, 192000, 0xa58c0110
-0, 1263135, 192000, 0x335ea9d1
-0, 1277328, 192000, 0x7e94bb41
-0, 1291520, 192000, 0x9cc5d569
-0, 1305713, 192000, 0xe942e109
-0, 1319905, 192000, 0x4cb83848
-0, 1334098, 192000, 0x6986fe19
-0, 1348290, 192000, 0xbb8c23f0
-0, 1362483, 192000, 0x296766c8
-0, 1376675, 192000, 0xb4230cb0
-0, 1390868, 192000, 0x2c2f1850
-0, 1405060, 192000, 0x93c70110
-0, 1419253, 192000, 0xb830a9d1
-0, 1433446, 192000, 0xbed48fa9
-0, 1447638, 192000, 0xc087bb41
-0, 1461831, 192000, 0x792de6d9
-0, 1476023, 192000, 0x1edaf849
-0, 1490216, 192000, 0x6564bb41
-0, 1504408, 192000, 0x9153d569
-0, 1518601, 192000, 0xe73ff561
-0, 1532793, 192000, 0xfa3be3f1
-0, 1546986, 192000, 0x8008fe19
-0, 1561178, 192000, 0xd2561b38
-0, 1575371, 192000, 0xae3c26d8
-0, 1589563, 192000, 0xb0114f88
-0, 1603756, 192000, 0x117e1e20
-0, 1617948, 192000, 0x482d1280
-0, 1632141, 192000, 0x425106e0
-0, 1646334, 192000, 0x0e6b0cb0
-0, 1660526, 192000, 0x95dc2ca8
-0, 1674719, 192000, 0x52097b20
-0, 1688911, 192000, 0x41a84f88
-0, 1703104, 192000, 0xb78d7268
-0, 1717296, 192000, 0x2cd366c8
-0, 1731489, 192000, 0xbf39e109
-0, 1745681, 192000, 0xecbaeca9
-0, 1759874, 192000, 0x3254eca9
-0, 1774066, 192000, 0x3fc903f8
-0, 1788259, 192000, 0x0bbc5e10
-0, 1802451, 192000, 0xe9103560
-0, 1816644, 192000, 0xbd5d2f90
-0, 1830836, 192000, 0x7ace2ca8
-0, 1845029, 192000, 0x7354c6e1
-0, 1859221, 192000, 0x72e0d569
-0, 1873414, 192000, 0xa4ade3f1
-0, 1887607, 192000, 0xf2f8cf99
-0, 1901799, 192000, 0x2b7ee6d9
-0, 1915992, 192000, 0x548d1b38
-0, 1930184, 192000, 0xa1551b38
-0, 1944377, 192000, 0xfb3e3560
-0, 1958569, 192000, 0x3aaaccb1
-0, 1972762, 192000, 0xa85ee109
-0, 1986954, 192000, 0xc1bff849
-0, 2001147, 192000, 0xa62bef91
-0, 2015339, 192000, 0xddf40cb0
-0, 2029532, 192000, 0x15bb3e18
-0, 2043724, 192000, 0x92fd5558
-0, 2057917, 192000, 0x2d365270
-0, 2072109, 192000, 0xb5f343e8
-0, 2086302, 192000, 0x93042108
-0, 2100494, 192000, 0x96d59830
-0, 2114687, 192000, 0x1f69ddf0
-0, 2128880, 192000, 0x8eb0124f
-0, 2143072, 192000, 0xae727dd7
-0, 2157265, 192000, 0xb8a63aff
-0, 2171457, 192000, 0xfae83de7
-0, 2185650, 192000, 0x2f034987
-0, 2199842, 192000, 0xa99e1537
-0, 2214035, 192000, 0x0ad70c7f
-0, 2228227, 192000, 0x74b3e990
-0, 2242420, 192000, 0x1bf0d250
diff --git a/tests/ref/fate/zmbv-16bit b/tests/ref/fate/zmbv-16bit
deleted file mode 100644
index ef37d44..0000000
--- a/tests/ref/fate/zmbv-16bit
+++ /dev/null
@@ -1,159 +0,0 @@
-0, 0, 192000, 0x11e62dbe
-0, 14193, 192000, 0x31698b8f
-0, 28385, 192000, 0x31698b8f
-0, 42578, 192000, 0x31698b8f
-0, 56770, 192000, 0x31698b8f
-0, 70963, 192000, 0x31698b8f
-0, 85155, 192000, 0x31698b8f
-0, 99348, 192000, 0x31698b8f
-0, 113540, 192000, 0x31698b8f
-0, 127733, 192000, 0x31698b8f
-0, 141925, 192000, 0x31698b8f
-0, 156118, 192000, 0x31698b8f
-0, 170310, 192000, 0x31698b8f
-0, 184503, 192000, 0x4ca609ea
-0, 198695, 192000, 0x4ca609ea
-0, 212888, 192000, 0x4ca609ea
-0, 227080, 192000, 0x4ca609ea
-0, 241273, 192000, 0x33dd0a8b
-0, 255466, 192000, 0x33dd0a8b
-0, 269658, 192000, 0x33dd0a8b
-0, 283851, 192000, 0x33dd0a8b
-0, 298043, 192000, 0x33dd0a8b
-0, 312236, 192000, 0x08e2420f
-0, 326428, 192000, 0x08e2420f
-0, 340621, 192000, 0x08e2420f
-0, 354813, 192000, 0x08e2420f
-0, 369006, 192000, 0x7b7b50ab
-0, 383198, 192000, 0x7b7b50ab
-0, 397391, 192000, 0x7b7b50ab
-0, 411583, 192000, 0x7b7b50ab
-0, 425776, 192000, 0x7b7b50ab
-0, 439968, 192000, 0x128744fb
-0, 454161, 192000, 0x128744fb
-0, 468353, 192000, 0x128744fb
-0, 482546, 192000, 0x128744fb
-0, 496739, 192000, 0x8643163b
-0, 510931, 192000, 0x8643163b
-0, 525124, 192000, 0x8643163b
-0, 539316, 192000, 0x8643163b
-0, 553509, 192000, 0x8643163b
-0, 567701, 192000, 0x4f7c596f
-0, 581894, 192000, 0x4f7c596f
-0, 596086, 192000, 0x4f7c596f
-0, 610279, 192000, 0x4f7c596f
-0, 624471, 192000, 0xa275420f
-0, 638664, 192000, 0xa275420f
-0, 652856, 192000, 0xa275420f
-0, 667049, 192000, 0xa275420f
-0, 681241, 192000, 0xa275420f
-0, 695434, 192000, 0x2e4796cb
-0, 709627, 192000, 0x2e4796cb
-0, 723819, 192000, 0x2e4796cb
-0, 738012, 192000, 0x2e4796cb
-0, 752204, 192000, 0xebd45683
-0, 766397, 192000, 0xebd45683
-0, 780589, 192000, 0xebd45683
-0, 794782, 192000, 0xebd45683
-0, 808974, 192000, 0xebd45683
-0, 823167, 192000, 0x0bf6596f
-0, 837359, 192000, 0x0bf6596f
-0, 851552, 192000, 0x0bf6596f
-0, 865744, 192000, 0x0bf6596f
-0, 879937, 192000, 0xb7af47e7
-0, 894129, 192000, 0xb7af47e7
-0, 908322, 192000, 0xb7af47e7
-0, 922514, 192000, 0xb7af47e7
-0, 936707, 192000, 0xb7af47e7
-0, 950900, 192000, 0x8bc344fb
-0, 965092, 192000, 0x8bc344fb
-0, 979285, 192000, 0x8bc344fb
-0, 993477, 192000, 0x8bc344fb
-0, 1007670, 192000, 0x8bc344fb
-0, 1021862, 192000, 0x02a23f23
-0, 1036055, 192000, 0x02a23f23
-0, 1050247, 192000, 0x02a23f23
-0, 1064440, 192000, 0x02a23f23
-0, 1078632, 192000, 0x17be3087
-0, 1092825, 192000, 0x52c7b2d4
-0, 1107017, 192000, 0xa05e9888
-0, 1121210, 192000, 0x4d6a6cb4
-0, 1135402, 192000, 0x3e2189ec
-0, 1149595, 192000, 0xfbe3ca34
-0, 1163787, 192000, 0xa9cd8fc4
-0, 1177980, 192000, 0x986e6cb4
-0, 1192173, 192000, 0x42373b08
-0, 1206365, 192000, 0xab96e351
-0, 1220558, 192000, 0x28ccf4d9
-0, 1234750, 192000, 0xc19e0f34
-0, 1248943, 192000, 0xd8da1ae4
-0, 1263135, 192000, 0xd015728c
-0, 1277328, 192000, 0x550623a8
-0, 1291520, 192000, 0x3c5c5268
-0, 1305713, 192000, 0x3eae8128
-0, 1319905, 192000, 0x3c51381c
-0, 1334098, 192000, 0x745046b8
-0, 1348290, 192000, 0xa8bd43cc
-0, 1362483, 192000, 0xde8fe351
-0, 1376675, 192000, 0x3d5cc905
-0, 1390868, 192000, 0xcf8df4d9
-0, 1405060, 192000, 0x698b20bc
-0, 1419253, 192000, 0x159d3244
-0, 1433446, 192000, 0xba1af4d9
-0, 1447638, 192000, 0x033a0f34
-0, 1461831, 192000, 0x72612f58
-0, 1476023, 192000, 0x11e11dd0
-0, 1490216, 192000, 0x4fc04f7c
-0, 1504408, 192000, 0x37779888
-0, 1518601, 192000, 0xabfc5e18
-0, 1532793, 192000, 0x0ad97e3c
-0, 1546986, 192000, 0xddf492b0
-0, 1561178, 192000, 0x198b23a8
-0, 1575371, 192000, 0x6b491220
-0, 1589563, 192000, 0x632417f8
-0, 1603756, 192000, 0x0dc5381c
-0, 1617948, 192000, 0x6d548700
-0, 1632141, 192000, 0xae0c5b2c
-0, 1646334, 192000, 0x23427e3c
-0, 1660526, 192000, 0x5def728c
-0, 1674719, 192000, 0xec831ae4
-0, 1688911, 192000, 0x00000000
-0, 1703104, 192000, 0x00000000
-0, 1717296, 192000, 0x00000000
-0, 1731489, 192000, 0x00000000
-0, 1745681, 192000, 0x00000000
-0, 1759874, 192000, 0x00000000
-0, 1774066, 192000, 0x00000000
-0, 1788259, 192000, 0x00000000
-0, 1802451, 192000, 0x00000000
-0, 1816644, 192000, 0xd6050414
-0, 1830836, 192000, 0xf9f90594
-0, 1845029, 192000, 0xa6220704
-0, 1859221, 192000, 0x54570858
-0, 1873414, 192000, 0xd81109ac
-0, 1887607, 192000, 0xc0540afc
-0, 1901799, 192000, 0x83ee0c20
-0, 1915992, 192000, 0x2a810d3c
-0, 1930184, 192000, 0xb3a71844
-0, 1944377, 192000, 0xd4ff1c7c
-0, 1958569, 192000, 0x92b21fdc
-0, 1972762, 192000, 0x03912364
-0, 1986954, 192000, 0x65c9262c
-0, 2001147, 192000, 0xf2e5290c
-0, 2015339, 192000, 0xc8cc2b4c
-0, 2029532, 192000, 0x272a2f1c
-0, 2043724, 192000, 0xa672313c
-0, 2057917, 192000, 0xab01331c
-0, 2072109, 192000, 0x92643458
-0, 2086302, 192000, 0x9a943548
-0, 2100494, 192000, 0x3eb735ac
-0, 2114687, 192000, 0x3eb735ac
-0, 2128880, 192000, 0x3eb735ac
-0, 2143072, 192000, 0x3eb735ac
-0, 2157265, 192000, 0x3eb735ac
-0, 2171457, 192000, 0x3eb735ac
-0, 2185650, 192000, 0x3eb735ac
-0, 2199842, 192000, 0x3eb735ac
-0, 2214035, 192000, 0x3eb735ac
-0, 2228227, 192000, 0x3eb735ac
-0, 2242420, 192000, 0x3eb735ac
diff --git a/tests/ref/fate/zmbv-32bit b/tests/ref/fate/zmbv-32bit
deleted file mode 100644
index 4b961cc..0000000
--- a/tests/ref/fate/zmbv-32bit
+++ /dev/null
@@ -1,159 +0,0 @@
-0, 0, 192000, 0x3ac10e8e
-0, 14193, 192000, 0xb772ee57
-0, 28385, 192000, 0x9b6e648a
-0, 42578, 192000, 0x3d9c33e3
-0, 56770, 192000, 0x006db76d
-0, 70963, 192000, 0x006db76d
-0, 85155, 192000, 0x006db76d
-0, 99348, 192000, 0x006db76d
-0, 113540, 192000, 0x006db76d
-0, 127733, 192000, 0x006db76d
-0, 141925, 192000, 0x006db76d
-0, 156118, 192000, 0x006db76d
-0, 170310, 192000, 0x006db76d
-0, 184503, 192000, 0x006db76d
-0, 198695, 192000, 0x006db76d
-0, 212888, 192000, 0x7b9b28fb
-0, 227080, 192000, 0x7b9b28fb
-0, 241273, 192000, 0x7b9b28fb
-0, 255466, 192000, 0x7b9b28fb
-0, 269658, 192000, 0x7b9b28fb
-0, 283851, 192000, 0x7b9b28fb
-0, 298043, 192000, 0x67be3519
-0, 312236, 192000, 0x67be3519
-0, 326428, 192000, 0x67be3519
-0, 340621, 192000, 0x67be3519
-0, 354813, 192000, 0x67be3519
-0, 369006, 192000, 0x2ece70dd
-0, 383198, 192000, 0x2ece70dd
-0, 397391, 192000, 0x2ece70dd
-0, 411583, 192000, 0x2ece70dd
-0, 425776, 192000, 0x2ece70dd
-0, 439968, 192000, 0x2ece70dd
-0, 454161, 192000, 0xd3a382cb
-0, 468353, 192000, 0xd3a382cb
-0, 482546, 192000, 0xd3a382cb
-0, 496739, 192000, 0xd3a382cb
-0, 510931, 192000, 0xd3a382cb
-0, 525124, 192000, 0xd3a382cb
-0, 539316, 192000, 0x2d3d7fce
-0, 553509, 192000, 0x2d3d7fce
-0, 567701, 192000, 0x2d3d7fce
-0, 581894, 192000, 0x2d3d7fce
-0, 596086, 192000, 0x2d3d7fce
-0, 610279, 192000, 0x36fd52fb
-0, 624471, 192000, 0x36fd52fb
-0, 638664, 192000, 0x36fd52fb
-0, 652856, 192000, 0x36fd52fb
-0, 667049, 192000, 0x36fd52fb
-0, 681241, 192000, 0x36fd52fb
-0, 695434, 192000, 0xa38e9ab3
-0, 709627, 192000, 0x57095eef
-0, 723819, 192000, 0x5c4f4d01
-0, 738012, 192000, 0xac20321c
-0, 752204, 192000, 0x7e370e40
-0, 766397, 192000, 0xe9d92925
-0, 780589, 192000, 0xfef4d26d
-0, 794782, 192000, 0x77a4ab94
-0, 808974, 192000, 0x802fb18e
-0, 823167, 192000, 0xce968db2
-0, 837359, 192000, 0x21e6ab94
-0, 851552, 192000, 0x309d45fa
-0, 865744, 192000, 0x5d193709
-0, 879937, 192000, 0x72190d33
-0, 894129, 192000, 0xdaed162a
-0, 908322, 192000, 0x2fcaf23f
-0, 922514, 192000, 0x8986d45d
-0, 936707, 192000, 0xcf7de34e
-0, 950900, 192000, 0x22390d33
-0, 965092, 192000, 0x4b29132d
-0, 979285, 192000, 0xbffe1f21
-0, 993477, 192000, 0xa4eee34e
-0, 1007670, 192000, 0xe85ae64b
-0, 1021862, 192000, 0xb7bef23f
-0, 1036055, 192000, 0x05ab1927
-0, 1050247, 192000, 0x915f6cd3
-0, 1064440, 192000, 0x524d69d6
-0, 1078632, 192000, 0x62da78c7
-0, 1092825, 192000, 0xbf6f84bb
-0, 1107017, 192000, 0xbe9f6cd3
-0, 1121210, 192000, 0x80d0132d
-0, 1135402, 192000, 0x0789251b
-0, 1149595, 192000, 0xba1a1f21
-0, 1163787, 192000, 0x542b42fd
-0, 1177980, 192000, 0x0ff951ee
-0, 1192173, 192000, 0x785048f7
-0, 1206365, 192000, 0x5a50251b
-0, 1220558, 192000, 0xd5d73a06
-0, 1234750, 192000, 0x7a3a54eb
-0, 1248943, 192000, 0x1e2b5de2
-0, 1263135, 192000, 0xeac542fd
-0, 1277328, 192000, 0x897a1f21
-0, 1291520, 192000, 0x61602b15
-0, 1305713, 192000, 0xb12f221e
-0, 1319905, 192000, 0x08541f21
-0, 1334098, 192000, 0xeebd251b
-0, 1348290, 192000, 0xc1132e12
-0, 1362483, 192000, 0x99642818
-0, 1376675, 192000, 0x9b8e162a
-0, 1390868, 192000, 0x21b81f21
-0, 1405060, 192000, 0x1abd1030
-0, 1419253, 192000, 0x0d613d03
-0, 1433446, 192000, 0xcb32132d
-0, 1447638, 192000, 0xc680162a
-0, 1461831, 192000, 0x8dea2818
-0, 1476023, 192000, 0x3c4e1927
-0, 1490216, 192000, 0xed733709
-0, 1504408, 192000, 0xf4051c24
-0, 1518601, 192000, 0xb8eb221e
-0, 1532793, 192000, 0x1a412818
-0, 1546986, 192000, 0x6ee6162a
-0, 1561178, 192000, 0xe1a248f7
-0, 1575371, 192000, 0xc2c2221e
-0, 1589563, 192000, 0x7fdf1f21
-0, 1603756, 192000, 0x85bc251b
-0, 1617948, 192000, 0xe77c251b
-0, 1632141, 192000, 0x8789340c
-0, 1646334, 192000, 0xb6014000
-0, 1660526, 192000, 0xaa9542fd
-0, 1674719, 192000, 0x36ce54eb
-0, 1688911, 192000, 0xd1324ef1
-0, 1703104, 192000, 0x0ade60df
-0, 1717296, 192000, 0xfac56cd3
-0, 1731489, 192000, 0x00000000
-0, 1745681, 192000, 0x00000000
-0, 1759874, 192000, 0xc61c026a
-0, 1774066, 192000, 0x60810842
-0, 1788259, 192000, 0x65081393
-0, 1802451, 192000, 0xc806209f
-0, 1816644, 192000, 0x53aa32cb
-0, 1830836, 192000, 0x176546ef
-0, 1845029, 192000, 0x4e095d0e
-0, 1859221, 192000, 0xf74b7774
-0, 1873414, 192000, 0x32809306
-0, 1887607, 192000, 0x5219ae81
-0, 1901799, 192000, 0x3badcc40
-0, 1915992, 192000, 0x1387ea5d
-0, 1930184, 192000, 0xe0c606f0
-0, 1944377, 192000, 0x106f2197
-0, 1958569, 192000, 0xfe2139cf
-0, 1972762, 192000, 0x907d4f0a
-0, 1986954, 192000, 0x04415dad
-0, 2001147, 192000, 0xe0b864b6
-0, 2015339, 192000, 0xcb2a64b8
-0, 2029532, 192000, 0xcb2a64b8
-0, 2043724, 192000, 0xcb2a64b8
-0, 2057917, 192000, 0xcb2a64b8
-0, 2072109, 192000, 0xcb2a64b8
-0, 2086302, 192000, 0xcb2a64b8
-0, 2100494, 192000, 0xcb2a64b8
-0, 2114687, 192000, 0xcb2a64b8
-0, 2128880, 192000, 0xcb2a64b8
-0, 2143072, 192000, 0xcb2a64b8
-0, 2157265, 192000, 0xcb2a64b8
-0, 2171457, 192000, 0xcb2a64b8
-0, 2185650, 192000, 0xcb2a64b8
-0, 2199842, 192000, 0xcb2a64b8
-0, 2214035, 192000, 0xcb2a64b8
-0, 2228227, 192000, 0xcb2a64b8
-0, 2242420, 192000, 0xcb2a64b8
diff --git a/tests/ref/fate/zmbv-8bit b/tests/ref/fate/zmbv-8bit
deleted file mode 100644
index 258147f..0000000
--- a/tests/ref/fate/zmbv-8bit
+++ /dev/null
@@ -1,275 +0,0 @@
-0, 0, 192000, 0x5234b617
-0, 1284, 192000, 0x5234b617
-0, 2568, 192000, 0x5234b617
-0, 3852, 192000, 0x5234b617
-0, 5137, 192000, 0x5234b617
-0, 6421, 192000, 0x5234b617
-0, 7705, 192000, 0x5234b617
-0, 8989, 192000, 0x5234b617
-0, 10273, 192000, 0x5234b617
-0, 11557, 192000, 0x5234b617
-0, 12841, 192000, 0x5234b617
-0, 14125, 192000, 0x5234b617
-0, 15410, 192000, 0x5234b617
-0, 16694, 192000, 0x5234b617
-0, 17978, 192000, 0x5234b617
-0, 19262, 192000, 0x5234b617
-0, 20546, 192000, 0x5234b617
-0, 21830, 192000, 0x5234b617
-0, 23114, 192000, 0x5234b617
-0, 24398, 192000, 0x5234b617
-0, 25683, 192000, 0x5234b617
-0, 26967, 192000, 0x5234b617
-0, 28251, 192000, 0x5234b617
-0, 29535, 192000, 0x5234b617
-0, 30819, 192000, 0x5234b617
-0, 32103, 192000, 0x5234b617
-0, 33387, 192000, 0x5234b617
-0, 34672, 192000, 0x5234b617
-0, 35956, 192000, 0x5234b617
-0, 37240, 192000, 0x5234b617
-0, 38524, 192000, 0x5234b617
-0, 39808, 192000, 0x5234b617
-0, 41092, 192000, 0x5234b617
-0, 42376, 192000, 0x5234b617
-0, 43660, 192000, 0x5234b617
-0, 44945, 192000, 0x5234b617
-0, 46229, 192000, 0x5234b617
-0, 47513, 192000, 0x5234b617
-0, 48797, 192000, 0x5234b617
-0, 50081, 192000, 0x5234b617
-0, 51365, 192000, 0x5234b617
-0, 52649, 192000, 0x5234b617
-0, 53934, 192000, 0x5234b617
-0, 55218, 192000, 0x5234b617
-0, 56502, 192000, 0x5234b617
-0, 57786, 192000, 0x5234b617
-0, 59070, 192000, 0x5234b617
-0, 60354, 192000, 0x5234b617
-0, 61638, 192000, 0x5234b617
-0, 62922, 192000, 0x5234b617
-0, 64207, 192000, 0x5234b617
-0, 65491, 192000, 0x5234b617
-0, 66775, 192000, 0x5234b617
-0, 68059, 192000, 0x5234b617
-0, 69343, 192000, 0x5234b617
-0, 70627, 192000, 0x5234b617
-0, 71911, 192000, 0x5234b617
-0, 73195, 192000, 0x5234b617
-0, 74480, 192000, 0x5234b617
-0, 75764, 192000, 0x5234b617
-0, 77048, 192000, 0x5234b617
-0, 78332, 192000, 0x5234b617
-0, 79616, 192000, 0x5234b617
-0, 80900, 192000, 0x5234b617
-0, 82184, 192000, 0x5234b617
-0, 83469, 192000, 0x5234b617
-0, 84753, 192000, 0x5234b617
-0, 86037, 192000, 0x5234b617
-0, 87321, 192000, 0x5234b617
-0, 88605, 192000, 0x5234b617
-0, 89889, 192000, 0x5234b617
-0, 91173, 192000, 0x5234b617
-0, 92457, 192000, 0x5234b617
-0, 93742, 192000, 0x5234b617
-0, 95026, 192000, 0x5234b617
-0, 96310, 192000, 0x5234b617
-0, 97594, 192000, 0x5234b617
-0, 98878, 192000, 0x5234b617
-0, 100162, 192000, 0x5234b617
-0, 101446, 192000, 0x5234b617
-0, 102730, 192000, 0x5234b617
-0, 104015, 192000, 0x5234b617
-0, 105299, 192000, 0x5234b617
-0, 106583, 192000, 0x5234b617
-0, 107867, 192000, 0x5234b617
-0, 109151, 192000, 0x5234b617
-0, 110435, 192000, 0x0c148693
-0, 111719, 192000, 0x973f438b
-0, 113004, 192000, 0x602a279b
-0, 114288, 192000, 0x739c7527
-0, 115572, 192000, 0x4ef4b477
-0, 116856, 192000, 0x8fffec23
-0, 118140, 192000, 0xe192c706
-0, 119424, 192000, 0xf38000e5
-0, 120708, 192000, 0x628b9051
-0, 121992, 192000, 0xd7c162c0
-0, 123277, 192000, 0xd4b85307
-0, 124561, 192000, 0x377cf8cf
-0, 125845, 192000, 0xf1ffdff2
-0, 127129, 192000, 0x95a0ab01
-0, 128413, 192000, 0xeb69c7f0
-0, 129697, 192000, 0xfbd0af52
-0, 130981, 192000, 0x32da6d10
-0, 132266, 192000, 0xca8e7836
-0, 133550, 192000, 0x404cefe9
-0, 134834, 192000, 0x0433e9c8
-0, 136118, 192000, 0xd6e09ecf
-0, 137402, 192000, 0xc9a822b5
-0, 138686, 192000, 0x032f2398
-0, 139970, 192000, 0x9e0305bf
-0, 141254, 192000, 0x9d66c993
-0, 142539, 192000, 0xe126b022
-0, 143823, 192000, 0xb59d2829
-0, 145107, 192000, 0x967ad5b1
-0, 146391, 192000, 0xb76ad1dc
-0, 147675, 192000, 0xc901e6e3
-0, 148959, 192000, 0xd22bc862
-0, 150243, 192000, 0xe7547295
-0, 151527, 192000, 0x179a8d78
-0, 152812, 192000, 0x87a4310f
-0, 154096, 192000, 0x4e24d3b3
-0, 155380, 192000, 0xb1b8e58a
-0, 156664, 192000, 0x0ae55330
-0, 157948, 192000, 0xdb3288ab
-0, 159232, 192000, 0x31867a92
-0, 160516, 192000, 0x2a44a0a5
-0, 161801, 192000, 0x29c062f4
-0, 163085, 192000, 0xf4df3a2b
-0, 164369, 192000, 0x8e424f86
-0, 165653, 192000, 0x25b901f9
-0, 166937, 192000, 0x77af6cad
-0, 168221, 192000, 0x0b82d562
-0, 169505, 192000, 0x4322dc3e
-0, 170789, 192000, 0x4322dc3e
-0, 172074, 192000, 0x4322dc3e
-0, 173358, 192000, 0x2c51f91e
-0, 174642, 192000, 0x2c51f91e
-0, 175926, 192000, 0x2c51f91e
-0, 177210, 192000, 0x2c51f91e
-0, 178494, 192000, 0x197128e5
-0, 179778, 192000, 0x197128e5
-0, 181062, 192000, 0x197128e5
-0, 182347, 192000, 0xb67867c5
-0, 183631, 192000, 0xb67867c5
-0, 184915, 192000, 0xb67867c5
-0, 186199, 192000, 0xb67867c5
-0, 187483, 192000, 0x62fcac19
-0, 188767, 192000, 0x62fcac19
-0, 190051, 192000, 0x62fcac19
-0, 191336, 192000, 0xe4f4f281
-0, 192620, 192000, 0xe4f4f281
-0, 193904, 192000, 0xe4f4f281
-0, 195188, 192000, 0xe4f4f281
-0, 196472, 192000, 0x060c3190
-0, 197756, 192000, 0x060c3190
-0, 199040, 192000, 0x060c3190
-0, 200324, 192000, 0xe5c05bb4
-0, 201609, 192000, 0xe5c05bb4
-0, 202893, 192000, 0xe5c05bb4
-0, 204177, 192000, 0xe5c05bb4
-0, 205461, 192000, 0xd4b187fc
-0, 206745, 192000, 0xd4b187fc
-0, 208029, 192000, 0xd4b187fc
-0, 209313, 192000, 0x9a549a6c
-0, 210597, 192000, 0x9a549a6c
-0, 211882, 192000, 0x9a549a6c
-0, 213166, 192000, 0x9a549a6c
-0, 214450, 192000, 0xd491bd50
-0, 215734, 192000, 0xd491bd50
-0, 217018, 192000, 0xd491bd50
-0, 218302, 192000, 0xfdfad4a8
-0, 219586, 192000, 0xfdfad4a8
-0, 220871, 192000, 0xfdfad4a8
-0, 222155, 192000, 0xfdfad4a8
-0, 223439, 192000, 0x363ef77c
-0, 224723, 192000, 0x363ef77c
-0, 226007, 192000, 0x363ef77c
-0, 227291, 192000, 0x80c016f7
-0, 228575, 192000, 0x80c016f7
-0, 229859, 192000, 0x80c016f7
-0, 231144, 192000, 0x80c016f7
-0, 232428, 192000, 0x65852e7f
-0, 233712, 192000, 0x65852e7f
-0, 234996, 192000, 0x65852e7f
-0, 236280, 192000, 0xcb13542b
-0, 237564, 192000, 0xcb13542b
-0, 238848, 192000, 0xcb13542b
-0, 240133, 192000, 0xcb13542b
-0, 241417, 192000, 0xb7a5664f
-0, 242701, 192000, 0xb7a5664f
-0, 243985, 192000, 0xb7a5664f
-0, 245269, 192000, 0x8a128fd7
-0, 246553, 192000, 0x8a128fd7
-0, 247837, 192000, 0x8a128fd7
-0, 249121, 192000, 0x8a128fd7
-0, 250406, 192000, 0x9674b39b
-0, 251690, 192000, 0x9674b39b
-0, 252974, 192000, 0x9674b39b
-0, 254258, 192000, 0x2940e3b3
-0, 255542, 192000, 0x2940e3b3
-0, 256826, 192000, 0x2940e3b3
-0, 258110, 192000, 0x2940e3b3
-0, 259394, 192000, 0x0440e56b
-0, 260679, 192000, 0x0440e56b
-0, 261963, 192000, 0x0440e56b
-0, 263247, 192000, 0xefa3d16b
-0, 264531, 192000, 0xefa3d16b
-0, 265815, 192000, 0xefa3d16b
-0, 267099, 192000, 0xefa3d16b
-0, 268383, 192000, 0x6569b257
-0, 269668, 192000, 0x6569b257
-0, 270952, 192000, 0x6569b257
-0, 272236, 192000, 0x089985d7
-0, 273520, 192000, 0x089985d7
-0, 274804, 192000, 0x089985d7
-0, 276088, 192000, 0x089985d7
-0, 277372, 192000, 0x87e160af
-0, 278656, 192000, 0x87e160af
-0, 279941, 192000, 0x87e160af
-0, 281225, 192000, 0x117433bb
-0, 282509, 192000, 0x117433bb
-0, 283793, 192000, 0x117433bb
-0, 285077, 192000, 0x117433bb
-0, 286361, 192000, 0xd9e0f8bc
-0, 287645, 192000, 0xd9e0f8bc
-0, 288929, 192000, 0xd9e0f8bc
-0, 290214, 192000, 0x653cac38
-0, 291498, 192000, 0x653cac38
-0, 292782, 192000, 0x653cac38
-0, 294066, 192000, 0x653cac38
-0, 295350, 192000, 0x9070526c
-0, 296634, 192000, 0x9070526c
-0, 297918, 192000, 0x9070526c
-0, 299203, 192000, 0x15e6e9c9
-0, 300487, 192000, 0x15e6e9c9
-0, 301771, 192000, 0x15e6e9c9
-0, 303055, 192000, 0x15e6e9c9
-0, 304339, 192000, 0x610eab25
-0, 305623, 192000, 0x610eab25
-0, 306907, 192000, 0x610eab25
-0, 308191, 192000, 0xde2a829d
-0, 309476, 192000, 0xde2a829d
-0, 310760, 192000, 0xde2a829d
-0, 312044, 192000, 0xde2a829d
-0, 313328, 192000, 0x2014becd
-0, 314612, 192000, 0x2014becd
-0, 315896, 192000, 0x2014becd
-0, 317180, 192000, 0x551e0f98
-0, 318465, 192000, 0x551e0f98
-0, 319749, 192000, 0x551e0f98
-0, 321033, 192000, 0x551e0f98
-0, 322317, 192000, 0x4aaa6bec
-0, 323601, 192000, 0x4aaa6bec
-0, 324885, 192000, 0x4aaa6bec
-0, 326169, 192000, 0x4053d278
-0, 327453, 192000, 0x4053d278
-0, 328738, 192000, 0x4053d278
-0, 330022, 192000, 0x4053d278
-0, 331306, 192000, 0xa0e645db
-0, 332590, 192000, 0xa0e645db
-0, 333874, 192000, 0xa0e645db
-0, 335158, 192000, 0x3f1fc327
-0, 336442, 192000, 0x3f1fc327
-0, 337726, 192000, 0x3f1fc327
-0, 339011, 192000, 0x3f1fc327
-0, 340295, 192000, 0xa4ca2a9a
-0, 341579, 192000, 0xa4ca2a9a
-0, 342863, 192000, 0xa4ca2a9a
-0, 344147, 192000, 0xf1b2b22e
-0, 345431, 192000, 0xf1b2b22e
-0, 346715, 192000, 0xf1b2b22e
-0, 348000, 192000, 0xf1b2b22e
-0, 349284, 192000, 0xd08e49d1
-0, 350568, 192000, 0xd08e49d1
-0, 351852, 192000, 0xd08e49d1
diff --git a/tests/ref/lavf/aiff b/tests/ref/lavf/aiff
deleted file mode 100644
index e5d6fc3..0000000
--- a/tests/ref/lavf/aiff
+++ /dev/null
@@ -1,3 +0,0 @@
-379908755146d4ead062abe9c3b5c582 *./tests/data/lavf/lavf.aif
-90166 ./tests/data/lavf/lavf.aif
-./tests/data/lavf/lavf.aif CRC=0xf1ae5536
diff --git a/tests/ref/lavf/alaw b/tests/ref/lavf/alaw
deleted file mode 100644
index 65bcf99..0000000
--- a/tests/ref/lavf/alaw
+++ /dev/null
@@ -1,3 +0,0 @@
-8bce9c3758b0d38da2e0718b6ab57fb4 *./tests/data/lavf/lavf.al
-45056 ./tests/data/lavf/lavf.al
-./tests/data/lavf/lavf.al CRC=0x5e6d372b
diff --git a/tests/ref/lavf/asf b/tests/ref/lavf/asf
deleted file mode 100644
index 533a3c3..0000000
--- a/tests/ref/lavf/asf
+++ /dev/null
@@ -1,3 +0,0 @@
-c544bb40c2f4c09d44318db5228ee499 *./tests/data/lavf/lavf.asf
-333375 ./tests/data/lavf/lavf.asf
-./tests/data/lavf/lavf.asf CRC=0x9f5ab3e6
diff --git a/tests/ref/lavf/au b/tests/ref/lavf/au
deleted file mode 100644
index 15f2a4b..0000000
--- a/tests/ref/lavf/au
+++ /dev/null
@@ -1,3 +0,0 @@
-dbd11f783219485cae32024e47c19dfb *./tests/data/lavf/lavf.au
-90136 ./tests/data/lavf/lavf.au
-./tests/data/lavf/lavf.au CRC=0xf1ae5536
diff --git a/tests/ref/lavf/avi b/tests/ref/lavf/avi
deleted file mode 100644
index cf47755..0000000
--- a/tests/ref/lavf/avi
+++ /dev/null
@@ -1,3 +0,0 @@
-7e5e4db8c04f0acd16cff6b30e60d0e5 *./tests/data/lavf/lavf.avi
-331032 ./tests/data/lavf/lavf.avi
-./tests/data/lavf/lavf.avi CRC=0x2a83e6b0
diff --git a/tests/ref/lavf/bmp b/tests/ref/lavf/bmp
deleted file mode 100644
index 8958855..0000000
--- a/tests/ref/lavf/bmp
+++ /dev/null
@@ -1,3 +0,0 @@
-71f4d64a6b3c71f43a4eff526f84841c *./tests/data/images/bmp/02.bmp
-./tests/data/images/bmp/%02d.bmp CRC=0xe6c71946
-304182 ./tests/data/images/bmp/02.bmp
diff --git a/tests/ref/lavf/dv_fmt b/tests/ref/lavf/dv_fmt
deleted file mode 100644
index 7406dff..0000000
--- a/tests/ref/lavf/dv_fmt
+++ /dev/null
@@ -1,3 +0,0 @@
-522e5e5a46b99f8ad8aabdaf3d2f1869 *./tests/data/lavf/lavf.dv
-3600000 ./tests/data/lavf/lavf.dv
-./tests/data/lavf/lavf.dv CRC=0x02c0af30
diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
deleted file mode 100644
index b89af6e..0000000
--- a/tests/ref/lavf/ffm
+++ /dev/null
@@ -1,3 +0,0 @@
-b6acf782a38d313153b68c4ca204fc90 *./tests/data/lavf/lavf.ffm
-376832 ./tests/data/lavf/lavf.ffm
-./tests/data/lavf/lavf.ffm CRC=0xf361ed74
diff --git a/tests/ref/lavf/flv_fmt b/tests/ref/lavf/flv_fmt
deleted file mode 100644
index 1d38b6f..0000000
--- a/tests/ref/lavf/flv_fmt
+++ /dev/null
@@ -1,3 +0,0 @@
-62c3177547fb5853a5116661802e1ae2 *./tests/data/lavf/lavf.flv
-329541 ./tests/data/lavf/lavf.flv
-./tests/data/lavf/lavf.flv CRC=0x881785d1
diff --git a/tests/ref/lavf/gif b/tests/ref/lavf/gif
deleted file mode 100644
index 21f639d..0000000
--- a/tests/ref/lavf/gif
+++ /dev/null
@@ -1,2 +0,0 @@
-98968ceb210ab260a6a7af36767b94d3 *./tests/data/lavf/lavf.gif
-2906382 ./tests/data/lavf/lavf.gif
diff --git a/tests/ref/lavf/gxf b/tests/ref/lavf/gxf
deleted file mode 100644
index d147bc4..0000000
--- a/tests/ref/lavf/gxf
+++ /dev/null
@@ -1,3 +0,0 @@
-b52bf18b403ac9a0d12048b2f66cb24c *./tests/data/lavf/lavf.gxf
-796392 ./tests/data/lavf/lavf.gxf
-./tests/data/lavf/lavf.gxf CRC=0xad9e86eb
diff --git a/tests/ref/lavf/jpg b/tests/ref/lavf/jpg
deleted file mode 100644
index 9e5be55..0000000
--- a/tests/ref/lavf/jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-131878fee153a086d740543fbf2ab359 *./tests/data/images/jpg/02.jpg
-./tests/data/images/jpg/%02d.jpg CRC=0x8b019f23
-28406 ./tests/data/images/jpg/02.jpg
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
deleted file mode 100644
index 213d38b..0000000
--- a/tests/ref/lavf/mkv
+++ /dev/null
@@ -1,3 +0,0 @@
-cf230e089e737ed9449fbfb3cb87da92 *./tests/data/lavf/lavf.mkv
-  320471 ./tests/data/lavf/lavf.mkv
-./tests/data/lavf/lavf.mkv CRC=0x2a83e6b0
diff --git a/tests/ref/lavf/mmf b/tests/ref/lavf/mmf
deleted file mode 100644
index 756527c..0000000
--- a/tests/ref/lavf/mmf
+++ /dev/null
@@ -1,3 +0,0 @@
-272b91d8fc31ed43b08246d182719751 *./tests/data/lavf/lavf.mmf
-22609 ./tests/data/lavf/lavf.mmf
-./tests/data/lavf/lavf.mmf CRC=0x03633476
diff --git a/tests/ref/lavf/mov b/tests/ref/lavf/mov
deleted file mode 100644
index 943c605..0000000
--- a/tests/ref/lavf/mov
+++ /dev/null
@@ -1,3 +0,0 @@
-c145305a775eb2de43cdf94eb1ab5240 *./tests/data/lavf/lavf.mov
-357669 ./tests/data/lavf/lavf.mov
-./tests/data/lavf/lavf.mov CRC=0x2f6a9b26
diff --git a/tests/ref/lavf/mpg b/tests/ref/lavf/mpg
deleted file mode 100644
index 9b1664f..0000000
--- a/tests/ref/lavf/mpg
+++ /dev/null
@@ -1,3 +0,0 @@
-e36a005ecca9add8bda6e0655d03716f *./tests/data/lavf/lavf.mpg
-372736 ./tests/data/lavf/lavf.mpg
-./tests/data/lavf/lavf.mpg CRC=0x2b39ed74
diff --git a/tests/ref/lavf/mulaw b/tests/ref/lavf/mulaw
deleted file mode 100644
index c6fa058..0000000
--- a/tests/ref/lavf/mulaw
+++ /dev/null
@@ -1,3 +0,0 @@
-e64027a96ad5907ee281deff3286da0a *./tests/data/lavf/lavf.ul
-45056 ./tests/data/lavf/lavf.ul
-./tests/data/lavf/lavf.ul CRC=0xe028b50a
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
deleted file mode 100644
index 84d7a09..0000000
--- a/tests/ref/lavf/mxf
+++ /dev/null
@@ -1,6 +0,0 @@
-8e120da0ccd70c4475fdee13fc5f3d0b *./tests/data/lavf/lavf.mxf
-525881 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0xb6aa0849
-b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/lavf/lavf.mxf_d10
-5330989 ./tests/data/lavf/lavf.mxf_d10
-./tests/data/lavf/lavf.mxf_d10 CRC=0xc3f4f92e
diff --git a/tests/ref/lavf/nut b/tests/ref/lavf/nut
deleted file mode 100644
index 461b185..0000000
--- a/tests/ref/lavf/nut
+++ /dev/null
@@ -1,3 +0,0 @@
-16b9d2cf8effb7dae316c6b9248a49b7 *./tests/data/lavf/lavf.nut
-319888 ./tests/data/lavf/lavf.nut
-./tests/data/lavf/lavf.nut CRC=0x2a83e6b0
diff --git a/tests/ref/lavf/ogg b/tests/ref/lavf/ogg
deleted file mode 100644
index eb96fd9..0000000
--- a/tests/ref/lavf/ogg
+++ /dev/null
@@ -1,3 +0,0 @@
-364714f1087f3c1320b60f4209191d23 *./tests/data/lavf/lavf.ogg
-13820 ./tests/data/lavf/lavf.ogg
-./tests/data/lavf/lavf.ogg CRC=0xf1ae5536
diff --git a/tests/ref/lavf/pbmpipe b/tests/ref/lavf/pbmpipe
deleted file mode 100644
index d50ed71..0000000
--- a/tests/ref/lavf/pbmpipe
+++ /dev/null
@@ -1,3 +0,0 @@
-8ced96f5b6b7362358199ae993b4ceb7 *./tests/data/lavf/pbmpipe.pbm
-317075 ./tests/data/lavf/pbmpipe.pbm
-./tests/data/lavf/pbmpipe.pbm CRC=0xfae0a1ba
diff --git a/tests/ref/lavf/pcx b/tests/ref/lavf/pcx
deleted file mode 100644
index bdb2204..0000000
--- a/tests/ref/lavf/pcx
+++ /dev/null
@@ -1,3 +0,0 @@
-2df1d747fba23d03b6ff9c91b8b465c9 *./tests/data/images/pcx/02.pcx
-./tests/data/images/pcx/%02d.pcx CRC=0x6da01946
-364147 ./tests/data/images/pcx/02.pcx
diff --git a/tests/ref/lavf/pgm b/tests/ref/lavf/pgm
deleted file mode 100644
index 4043f7a..0000000
--- a/tests/ref/lavf/pgm
+++ /dev/null
@@ -1,3 +0,0 @@
-388f5c51a678ca6a52cc006095c12f08 *./tests/data/images/pgm/02.pgm
-./tests/data/images/pgm/%02d.pgm CRC=0x418d2963
-101391 ./tests/data/images/pgm/02.pgm
diff --git a/tests/ref/lavf/pgmpipe b/tests/ref/lavf/pgmpipe
deleted file mode 100644
index 28ad60e..0000000
--- a/tests/ref/lavf/pgmpipe
+++ /dev/null
@@ -1,3 +0,0 @@
-04e66c8e9e064c8310bd657ee559bd70 *./tests/data/lavf/pgmpipe.pgm
-2534775 ./tests/data/lavf/pgmpipe.pgm
-./tests/data/lavf/pgmpipe.pgm CRC=0xadf48ba9
diff --git a/tests/ref/lavf/pixfmt b/tests/ref/lavf/pixfmt
deleted file mode 100644
index d03abff..0000000
--- a/tests/ref/lavf/pixfmt
+++ /dev/null
@@ -1,38 +0,0 @@
-5641dba168ff665af1cdb4a91e1afdd6 *./tests/data/pixfmt/yuv420p.yuv
-304128 ./tests/data/pixfmt/yuv420p.yuv
-ac68f9fdd9d55efd0306d9b004038761 *./tests/data/pixfmt/yuv422p.yuv
-304128 ./tests/data/pixfmt/yuv422p.yuv
-5641dba168ff665af1cdb4a91e1afdd6 *./tests/data/pixfmt/yuv444p.yuv
-304128 ./tests/data/pixfmt/yuv444p.yuv
-ac68f9fdd9d55efd0306d9b004038761 *./tests/data/pixfmt/yuyv422.yuv
-304128 ./tests/data/pixfmt/yuyv422.yuv
-507c7e9f0c97660385df977469ca9e6d *./tests/data/pixfmt/yuv410p.yuv
-304128 ./tests/data/pixfmt/yuv410p.yuv
-8594ea0b8d7c2c964525b0801b5351de *./tests/data/pixfmt/yuv411p.yuv
-304128 ./tests/data/pixfmt/yuv411p.yuv
-66673539adf8cda28e3b76068d3aae61 *./tests/data/pixfmt/yuvj420p.yuv
-304128 ./tests/data/pixfmt/yuvj420p.yuv
-572bf387dd1e3f073cbfd082e055ca81 *./tests/data/pixfmt/yuvj422p.yuv
-304128 ./tests/data/pixfmt/yuvj422p.yuv
-c10442da177c9f1d12be3c53be6fa12c *./tests/data/pixfmt/yuvj444p.yuv
-304128 ./tests/data/pixfmt/yuvj444p.yuv
-c6e0f9b5817f484b175c1ec4ffb4e9c9 *./tests/data/pixfmt/rgb24.yuv
-304128 ./tests/data/pixfmt/rgb24.yuv
-c6e0f9b5817f484b175c1ec4ffb4e9c9 *./tests/data/pixfmt/bgr24.yuv
-304128 ./tests/data/pixfmt/bgr24.yuv
-c6e0f9b5817f484b175c1ec4ffb4e9c9 *./tests/data/pixfmt/rgb32.yuv
-304128 ./tests/data/pixfmt/rgb32.yuv
-66d39d464bd89ded2a124897f0a75ade *./tests/data/pixfmt/rgb565.yuv
-304128 ./tests/data/pixfmt/rgb565.yuv
-c894c3bd8d2631ed1964500b90a0c350 *./tests/data/pixfmt/rgb555.yuv
-304128 ./tests/data/pixfmt/rgb555.yuv
-6be306b0cce5f8e6c271ea17fef9745b *./tests/data/pixfmt/gray.yuv
-304128 ./tests/data/pixfmt/gray.yuv
-31398104d2349dd48328a6862bc6711f *./tests/data/pixfmt/monow.yuv
-304128 ./tests/data/pixfmt/monow.yuv
-31398104d2349dd48328a6862bc6711f *./tests/data/pixfmt/monob.yuv
-304128 ./tests/data/pixfmt/monob.yuv
-00b85790df5740bab95e2559d81603a7 *./tests/data/pixfmt/yuv440p.yuv
-304128 ./tests/data/pixfmt/yuv440p.yuv
-4d8d402c45d913038d4b725396719111 *./tests/data/pixfmt/yuvj440p.yuv
-304128 ./tests/data/pixfmt/yuvj440p.yuv
diff --git a/tests/ref/lavf/ppm b/tests/ref/lavf/ppm
deleted file mode 100644
index 97093aa..0000000
--- a/tests/ref/lavf/ppm
+++ /dev/null
@@ -1,3 +0,0 @@
-16d5dadf0b362fc8ba3cb676c5dde985 *./tests/data/images/ppm/02.ppm
-./tests/data/images/ppm/%02d.ppm CRC=0x6da01946
-304143 ./tests/data/images/ppm/02.ppm
diff --git a/tests/ref/lavf/ppmpipe b/tests/ref/lavf/ppmpipe
deleted file mode 100644
index b703e16..0000000
--- a/tests/ref/lavf/ppmpipe
+++ /dev/null
@@ -1,3 +0,0 @@
-74f1f6651ad8f192a7b4c11c2b6c71e5 *./tests/data/lavf/ppmpipe.ppm
-7603575 ./tests/data/lavf/ppmpipe.ppm
-./tests/data/lavf/ppmpipe.ppm CRC=0x87b3c15f
diff --git a/tests/ref/lavf/rm b/tests/ref/lavf/rm
deleted file mode 100644
index 0966c0c..0000000
--- a/tests/ref/lavf/rm
+++ /dev/null
@@ -1,2 +0,0 @@
-e60d3e69beaf94a5c3d2e3344cc620dd *./tests/data/lavf/lavf.rm
-346706 ./tests/data/lavf/lavf.rm
diff --git a/tests/ref/lavf/sgi b/tests/ref/lavf/sgi
deleted file mode 100644
index a43c1f4..0000000
--- a/tests/ref/lavf/sgi
+++ /dev/null
@@ -1,3 +0,0 @@
-7054acafd275e51cec28d4518e213081 *./tests/data/images/sgi/02.sgi
-./tests/data/images/sgi/%02d.sgi CRC=0x6da01946
-308151 ./tests/data/images/sgi/02.sgi
diff --git a/tests/ref/lavf/swf b/tests/ref/lavf/swf
deleted file mode 100644
index 1e07793..0000000
--- a/tests/ref/lavf/swf
+++ /dev/null
@@ -1,3 +0,0 @@
-62c5aeb636fc82cf6ba6277d36e42cb5 *./tests/data/lavf/lavf.swf
-329479 ./tests/data/lavf/lavf.swf
-./tests/data/lavf/lavf.swf CRC=0x881785d1
diff --git a/tests/ref/lavf/tga b/tests/ref/lavf/tga
deleted file mode 100644
index 7efaf97..0000000
--- a/tests/ref/lavf/tga
+++ /dev/null
@@ -1,3 +0,0 @@
-c0305c53e6d79d4ed9f35f04f671246c *./tests/data/images/tga/02.tga
-./tests/data/images/tga/%02d.tga CRC=0xe6c71946
-304172 ./tests/data/images/tga/02.tga
diff --git a/tests/ref/lavf/tiff b/tests/ref/lavf/tiff
deleted file mode 100644
index 4b0b985..0000000
--- a/tests/ref/lavf/tiff
+++ /dev/null
@@ -1,3 +0,0 @@
-b3299346a8959553a437e486d8f3bf76 *./tests/data/images/tiff/02.tiff
-./tests/data/images/tiff/%02d.tiff CRC=0x6da01946
-307131 ./tests/data/images/tiff/02.tiff
diff --git a/tests/ref/lavf/ts b/tests/ref/lavf/ts
deleted file mode 100644
index 5b046fb..0000000
--- a/tests/ref/lavf/ts
+++ /dev/null
@@ -1,3 +0,0 @@
-e0c183639709d6e75bc553a3ed1333dd *./tests/data/lavf/lavf.ts
-406644 ./tests/data/lavf/lavf.ts
-./tests/data/lavf/lavf.ts CRC=0x133216c1
diff --git a/tests/ref/lavf/voc b/tests/ref/lavf/voc
deleted file mode 100644
index 25e8b44..0000000
--- a/tests/ref/lavf/voc
+++ /dev/null
@@ -1,3 +0,0 @@
-b0bc287ce4e3eef7c1012610dd7ff6d0 *./tests/data/lavf/lavf.voc
-32768 ./tests/data/lavf/lavf.voc
-./tests/data/lavf/lavf.voc CRC=0xa2d77c12
diff --git a/tests/ref/lavf/wav b/tests/ref/lavf/wav
deleted file mode 100644
index aa6f943..0000000
--- a/tests/ref/lavf/wav
+++ /dev/null
@@ -1,3 +0,0 @@
-6a3bec31d92baf52161e25179ebba315 *./tests/data/lavf/lavf.wav
-90156 ./tests/data/lavf/lavf.wav
-./tests/data/lavf/lavf.wav CRC=0xf1ae5536
diff --git a/tests/ref/lavf/yuv4mpeg b/tests/ref/lavf/yuv4mpeg
deleted file mode 100644
index 8c1566e..0000000
--- a/tests/ref/lavf/yuv4mpeg
+++ /dev/null
@@ -1,2 +0,0 @@
-ec8178cb152f9cdbfd9cb724d977db2e *./tests/data/lavf/lavf.y4m
-3801808 ./tests/data/lavf/lavf.y4m
diff --git a/tests/ref/lavfi/crop b/tests/ref/lavfi/crop
deleted file mode 100644
index 75c39f7..0000000
--- a/tests/ref/lavfi/crop
+++ /dev/null
@@ -1,2 +0,0 @@
-3d163f156eaddf41d2be20736f973539 *./tests/data/lavfi/crop.nut
-3554654 ./tests/data/lavfi/crop.nut
diff --git a/tests/ref/lavfi/crop_scale b/tests/ref/lavfi/crop_scale
deleted file mode 100644
index 48a0734..0000000
--- a/tests/ref/lavfi/crop_scale
+++ /dev/null
@@ -1,2 +0,0 @@
-4ffe30abe99931bc9989f40ae65654b7 *./tests/data/lavfi/crop_scale.nut
-8941454 ./tests/data/lavfi/crop_scale.nut
diff --git a/tests/ref/lavfi/crop_scale_vflip b/tests/ref/lavfi/crop_scale_vflip
deleted file mode 100644
index 314f407..0000000
--- a/tests/ref/lavfi/crop_scale_vflip
+++ /dev/null
@@ -1,2 +0,0 @@
-3b1c81bb6ce7575f5ee3088ea165dbe7 *./tests/data/lavfi/crop_scale_vflip.nut
-750727 ./tests/data/lavfi/crop_scale_vflip.nut
diff --git a/tests/ref/lavfi/crop_vflip b/tests/ref/lavfi/crop_vflip
deleted file mode 100644
index 96fc9bd..0000000
--- a/tests/ref/lavfi/crop_vflip
+++ /dev/null
@@ -1,2 +0,0 @@
-628542e17b6900ee79b1429183ae01b0 *./tests/data/lavfi/crop_vflip.nut
-3554654 ./tests/data/lavfi/crop_vflip.nut
diff --git a/tests/ref/lavfi/null b/tests/ref/lavfi/null
deleted file mode 100644
index b4d006e..0000000
--- a/tests/ref/lavfi/null
+++ /dev/null
@@ -1,2 +0,0 @@
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/null.nut
-7604654 ./tests/data/lavfi/null.nut
diff --git a/tests/ref/lavfi/scale200 b/tests/ref/lavfi/scale200
deleted file mode 100644
index 115e250..0000000
--- a/tests/ref/lavfi/scale200
+++ /dev/null
@@ -1,2 +0,0 @@
-f7325609fdb8992bcea0cf3712ea2afc *./tests/data/lavfi/scale200.nut
-3001204 ./tests/data/lavfi/scale200.nut
diff --git a/tests/ref/lavfi/scale500 b/tests/ref/lavfi/scale500
deleted file mode 100644
index c8ba15b..0000000
--- a/tests/ref/lavfi/scale500
+++ /dev/null
@@ -1,2 +0,0 @@
-7e194861897fb42e20771711fe1aace3 *./tests/data/lavfi/scale500.nut
-18751503 ./tests/data/lavfi/scale500.nut
diff --git a/tests/ref/lavfi/vflip b/tests/ref/lavfi/vflip
deleted file mode 100644
index 977f2d2..0000000
--- a/tests/ref/lavfi/vflip
+++ /dev/null
@@ -1,2 +0,0 @@
-2e6d6062e8cad37fb3ab2c433b55f382 *./tests/data/lavfi/vflip.nut
-7604654 ./tests/data/lavfi/vflip.nut
diff --git a/tests/ref/lavfi/vflip_crop b/tests/ref/lavfi/vflip_crop
deleted file mode 100644
index bd19894..0000000
--- a/tests/ref/lavfi/vflip_crop
+++ /dev/null
@@ -1,2 +0,0 @@
-72ee0d0dfc8af0cd94a466760313654d *./tests/data/lavfi/vflip_crop.nut
-3554654 ./tests/data/lavfi/vflip_crop.nut
diff --git a/tests/ref/lavfi/vflip_vflip b/tests/ref/lavfi/vflip_vflip
deleted file mode 100644
index 55595dd..0000000
--- a/tests/ref/lavfi/vflip_vflip
+++ /dev/null
@@ -1,2 +0,0 @@
-eba2f135a08829387e2f698ff72a2939 *./tests/data/lavfi/vflip_vflip.nut
-7604654 ./tests/data/lavfi/vflip_vflip.nut
diff --git a/tests/ref/seek/%02d.bmp.ref b/tests/ref/seek/%02d.bmp.ref
deleted file mode 100644
index d60729b..0000000
--- a/tests/ref/seek/%02d.bmp.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:304182
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/%02d.jpg.ref b/tests/ref/seek/%02d.jpg.ref
deleted file mode 100644
index 88964ca..0000000
--- a/tests/ref/seek/%02d.jpg.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size: 28070
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/%02d.pcx.ref b/tests/ref/seek/%02d.pcx.ref
deleted file mode 100644
index 418674f..0000000
--- a/tests/ref/seek/%02d.pcx.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:364047
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/%02d.pgm.ref b/tests/ref/seek/%02d.pgm.ref
deleted file mode 100644
index 2836367..0000000
--- a/tests/ref/seek/%02d.pgm.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:101391
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/%02d.ppm.ref b/tests/ref/seek/%02d.ppm.ref
deleted file mode 100644
index 6376b5e..0000000
--- a/tests/ref/seek/%02d.ppm.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:304143
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/%02d.sgi.ref b/tests/ref/seek/%02d.sgi.ref
deleted file mode 100644
index b2f605a..0000000
--- a/tests/ref/seek/%02d.sgi.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:308336
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/%02d.tga.ref b/tests/ref/seek/%02d.tga.ref
deleted file mode 100644
index 8f90753..0000000
--- a/tests/ref/seek/%02d.tga.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:304172
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/%02d.tiff.ref b/tests/ref/seek/%02d.tiff.ref
deleted file mode 100644
index 1b49f2f..0000000
--- a/tests/ref/seek/%02d.tiff.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:307124
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/ac3.rm.ref b/tests/ref/seek/ac3.rm.ref
deleted file mode 100644
index e8e09e8..0000000
--- a/tests/ref/seek/ac3.rm.ref
+++ /dev/null
@@ -1,39 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.960000 pts: 2.960000 pos:  48659 size:   558
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.960000 pts: 2.960000 pos:  48659 size:   558
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 2.333000 pts: 2.333000 pos:  38413 size:   556
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret:-1         st: 0 flags:1  ts: 2.413000
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.915000 pts: 1.915000 pos:  31581 size:   558
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
-ret:-1         st: 0 flags:0  ts: 2.672000
-ret:-1         st: 0 flags:1  ts: 1.566000
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    271 size:   556
diff --git a/tests/ref/seek/adpcm_ima.wav.ref b/tests/ref/seek/adpcm_ima.wav.ref
deleted file mode 100644
index b6517c5..0000000
--- a/tests/ref/seek/adpcm_ima.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.856009 pts: 1.856009 pos:  29756 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.831995 pts: 0.831995 pos:  13372 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.623991 pts: 2.623991 pos:  42044 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.408005 pts: 1.408005 pos:  22588 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.383991 pts: 0.383991 pos:   6204 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.176009 pts: 2.176009 pos:  34876 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.023991 pts: 1.023991 pos:  16444 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.816009 pts: 2.816009 pos:  45116 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.791995 pts: 1.791995 pos:  28732 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.576009 pts: 0.576009 pos:   9276 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.368005 pts: 2.368005 pos:  37948 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.343991 pts: 1.343991 pos:  21564 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.191995 pts: 0.191995 pos:   3132 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.983991 pts: 1.983991 pos:  31804 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.896009 pts: 0.896009 pos:  14396 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.688005 pts: 2.688005 pos:  43068 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.536009 pts: 1.536009 pos:  24636 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.511995 pts: 0.511995 pos:   8252 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     60 size:  4096
diff --git a/tests/ref/seek/adpcm_ms.wav.ref b/tests/ref/seek/adpcm_ms.wav.ref
deleted file mode 100644
index 579be7f..0000000
--- a/tests/ref/seek/adpcm_ms.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.856009 pts: 1.856009 pos:  29786 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.831995 pts: 0.831995 pos:  13402 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.623991 pts: 2.623991 pos:  42074 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.408005 pts: 1.408005 pos:  22618 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.383991 pts: 0.383991 pos:   6234 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.176009 pts: 2.176009 pos:  34906 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.023991 pts: 1.023991 pos:  16474 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.816009 pts: 2.816009 pos:  45146 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.791995 pts: 1.791995 pos:  28762 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.576009 pts: 0.576009 pos:   9306 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.368005 pts: 2.368005 pos:  37978 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.343991 pts: 1.343991 pos:  21594 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.191995 pts: 0.191995 pos:   3162 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.983991 pts: 1.983991 pos:  31834 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.896009 pts: 0.896009 pos:  14426 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.688005 pts: 2.688005 pos:  43098 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.536009 pts: 1.536009 pos:  24666 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.511995 pts: 0.511995 pos:   8282 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     90 size:  4096
diff --git a/tests/ref/seek/adpcm_qt.aiff.ref b/tests/ref/seek/adpcm_qt.aiff.ref
deleted file mode 100644
index b395fc9..0000000
--- a/tests/ref/seek/adpcm_qt.aiff.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894059 pts: 1.894059 pos:  88812 size:    68
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.789546 pts: 0.789546 pos:  37064 size:    68
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.577642 pts: 2.577642 pos: 120840 size:    68
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470249 pts: 1.470249 pos:  68956 size:    68
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365737 pts: 0.365737 pos:  17208 size:    68
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153855 pts: 2.153855 pos: 100984 size:    68
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.046440 pts: 1.046440 pos:  49100 size:    68
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.834535 pts: 2.834535 pos: 132876 size:    68
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730045 pts: 1.730045 pos:  81128 size:    68
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624082 pts: 0.624082 pos:  29312 size:    68
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412200 pts: 2.412200 pos: 113088 size:    68
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.307687 pts: 1.307687 pos:  61340 size:    68
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200295 pts: 0.200295 pos:   9456 size:    68
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.988390 pts: 1.988390 pos:  93232 size:    68
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883900 pts: 0.883900 pos:  41484 size:    68
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671995 pts: 2.671995 pos: 125260 size:    68
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.564580 pts: 1.564580 pos:  73376 size:    68
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460091 pts: 0.460091 pos:  21628 size:    68
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     72 size:    68
diff --git a/tests/ref/seek/adpcm_swf.flv.ref b/tests/ref/seek/adpcm_swf.flv.ref
deleted file mode 100644
index 2f90913..0000000
--- a/tests/ref/seek/adpcm_swf.flv.ref
+++ /dev/null
@@ -1,49 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    208 size:  2053
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    208 size:  2053
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos:  82968 size:  2053
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.789000 pts: 0.789000 pos:  35381 size:  2053
-ret:-1         st: 0 flags:1  ts:-0.317000
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.601000 pts: 2.601000 pos: 116072 size:  2053
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  64347 size:  2053
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:  16760 size:  2053
-ret:-1         st: 0 flags:1  ts:-0.741000
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.183000 pts: 2.183000 pos:  97451 size:  2053
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.022000 pts: 1.022000 pos:  45726 size:  2053
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    208 size:  2053
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 2.833000 pts: 2.833000 pos: 126417 size:  2053
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.765000 pts: 1.765000 pos:  78830 size:  2053
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.604000 pts: 0.604000 pos:  27105 size:  2053
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    208 size:  2053
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 2.368000 pts: 2.368000 pos: 105727 size:  2053
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.347000 pts: 1.347000 pos:  60209 size:  2053
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:   8484 size:  2053
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    208 size:  2053
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.950000 pts: 1.950000 pos:  87106 size:  2053
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.929000 pts: 0.929000 pos:  41588 size:  2053
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 120210 size:  2053
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.533000 pts: 1.533000 pos:  68485 size:  2053
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos:  20898 size:  2053
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/adpcm_yam.wav.ref b/tests/ref/seek/adpcm_yam.wav.ref
deleted file mode 100644
index c326470..0000000
--- a/tests/ref/seek/adpcm_yam.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.856009 pts: 1.856009 pos:  29752 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.831995 pts: 0.831995 pos:  13368 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.623991 pts: 2.623991 pos:  42040 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.408005 pts: 1.408005 pos:  22584 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.383991 pts: 0.383991 pos:   6200 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.176009 pts: 2.176009 pos:  34872 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.023991 pts: 1.023991 pos:  16440 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.816009 pts: 2.816009 pos:  45112 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.791995 pts: 1.791995 pos:  28728 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.576009 pts: 0.576009 pos:   9272 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.368005 pts: 2.368005 pos:  37944 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.343991 pts: 1.343991 pos:  21560 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.191995 pts: 0.191995 pos:   3128 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.983991 pts: 1.983991 pos:  31800 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.896009 pts: 0.896009 pos:  14392 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.688005 pts: 2.688005 pos:  43064 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.536009 pts: 1.536009 pos:  24632 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.511995 pts: 0.511995 pos:   8248 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
diff --git a/tests/ref/seek/alac.m4a.ref b/tests/ref/seek/alac.m4a.ref
deleted file mode 100644
index 892cfb5..0000000
--- a/tests/ref/seek/alac.m4a.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.857596 pts: 1.857596 pos:  73731 size:  4965
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.835918 pts: 0.835918 pos:  29072 size:  3198
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.600635 pts: 2.600635 pos: 137669 size: 12847
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.393197 pts: 1.393197 pos:  50219 size:  4418
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos:  12962 size:  3213
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.229116 pts: 2.229116 pos: 101031 size:  7900
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.021678 pts: 1.021678 pos:  35362 size:  3035
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.786395 pts: 2.786395 pos: 163300 size: 12769
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.764717 pts: 1.764717 pos:  68756 size:  4975
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.557279 pts: 0.557279 pos:  19365 size:  3238
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.321995 pts: 2.321995 pos: 108931 size:  7890
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.393197 pts: 1.393197 pos:  50219 size:  4418
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos:   6478 size:  3249
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.950476 pts: 1.950476 pos:  78696 size:  6518
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.928798 pts: 0.928798 pos:  32270 size:  3092
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.693515 pts: 2.693515 pos: 150516 size: 12784
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.486077 pts: 1.486077 pos:  54637 size:  4558
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464399 pts: 0.464399 pos:  16175 size:  3190
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     40 size:  3240
diff --git a/tests/ref/seek/asv1.avi.ref b/tests/ref/seek/asv1.avi.ref
deleted file mode 100644
index eb6abc2..0000000
--- a/tests/ref/seek/asv1.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 14316
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 14316
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 776852 size: 18256
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 305364 size: 16180
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 595460 size: 17980
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 135528 size: 14868
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 404112 size: 16856
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 14316
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813408 size: 18296
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 704148 size: 18140
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 241776 size: 15736
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 14316
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813408 size: 18296
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 524500 size: 17548
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:  77032 size: 14496
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 14316
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 813408 size: 18296
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 337820 size: 16388
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 631596 size: 18188
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 180224 size: 15168
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/asv2.avi.ref b/tests/ref/seek/asv2.avi.ref
deleted file mode 100644
index f7b7f69..0000000
--- a/tests/ref/seek/asv2.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 13732
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 13732
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 736164 size: 17340
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 289720 size: 15300
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 564152 size: 17016
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 128576 size: 14052
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 383256 size: 15896
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 13732
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770864 size: 17400
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 667028 size: 17172
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 229400 size: 14956
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 13732
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770864 size: 17400
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 496944 size: 16564
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:  73188 size: 13664
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5668 size: 13732
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 770864 size: 17400
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 320456 size: 15592
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 598300 size: 17180
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171024 size: 14392
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/dnxhd-1080i.mov.ref b/tests/ref/seek/dnxhd-1080i.mov.ref
deleted file mode 100644
index 6c41d67..0000000
--- a/tests/ref/seek/dnxhd-1080i.mov.ref
+++ /dev/null
@@ -1,44 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret:-1         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret:-1         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:2424868 size:606208
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:606208
diff --git a/tests/ref/seek/dnxhd-720p-rd.dnxhd.ref b/tests/ref/seek/dnxhd-720p-rd.dnxhd.ref
deleted file mode 100644
index b57f07d..0000000
--- a/tests/ref/seek/dnxhd-720p-rd.dnxhd.ref
+++ /dev/null
@@ -1,40 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st: 0 flags:0  ts: 0.788334
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st: 0 flags:0  ts: 0.365002
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/dnxhd-720p.dnxhd.ref b/tests/ref/seek/dnxhd-720p.dnxhd.ref
deleted file mode 100644
index b57f07d..0000000
--- a/tests/ref/seek/dnxhd-720p.dnxhd.ref
+++ /dev/null
@@ -1,40 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st: 0 flags:0  ts: 0.788334
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st: 0 flags:0  ts: 0.365002
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:458752
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 0.160000 pts: 0.160000 pos:1835008 size:458752
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/dv.dv.ref b/tests/ref/seek/dv.dv.ref
deleted file mode 100644
index baaeefb..0000000
--- a/tests/ref/seek/dv.dv.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
diff --git a/tests/ref/seek/dv411.dv.ref b/tests/ref/seek/dv411.dv.ref
deleted file mode 100644
index baaeefb..0000000
--- a/tests/ref/seek/dv411.dv.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
diff --git a/tests/ref/seek/dv50.dv.ref b/tests/ref/seek/dv50.dv.ref
deleted file mode 100644
index 1f07e5b..0000000
--- a/tests/ref/seek/dv50.dv.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:     -1 size:288000
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:     -1 size:288000
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:288000
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:     -1 size:288000
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:     -1 size:288000
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:288000
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:     -1 size:288000
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:288000
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:     -1 size:288000
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:     -1 size:288000
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:288000
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:     -1 size:288000
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:     -1 size:288000
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:288000
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:     -1 size:288000
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
-ret: 0         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:     -1 size:288000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:     -1 size:288000
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:     -1 size:288000
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:288000
diff --git a/tests/ref/seek/error-mpeg4-adv.avi.ref b/tests/ref/seek/error-mpeg4-adv.avi.ref
deleted file mode 100644
index 3c6fa21..0000000
--- a/tests/ref/seek/error-mpeg4-adv.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9564
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9564
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  71660 size: 11680
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  36782 size: 10310
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  71660 size: 11680
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9564
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  36782 size: 10310
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9564
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9564
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9564
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 159370 size: 13895
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  71660 size: 11680
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 113142 size: 12795
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  36782 size: 10310
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/ffv1.avi.ref b/tests/ref/seek/ffv1.avi.ref
deleted file mode 100644
index 04edb8d..0000000
--- a/tests/ref/seek/ffv1.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 70200
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 70200
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622716 size: 71128
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796840 size: 67971
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622716 size: 71128
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 70200
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796840 size: 67971
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 70200
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 70200
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 70200
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3374440 size: 75606
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1622716 size: 71128
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2485810 size: 74128
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 796840 size: 67971
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/flac.flac.ref b/tests/ref/seek/flac.flac.ref
deleted file mode 100644
index c9d6a7d..0000000
--- a/tests/ref/seek/flac.flac.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   8256 size:  1024
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.788345
-ret:-1         st: 0 flags:1  ts:-0.317506
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.365011
-ret:-1         st: 0 flags:1  ts:-0.740839
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.058322
-ret:-1         st: 0 flags:1  ts: 2.835828
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.481655
-ret:-1         st: 0 flags:1  ts: 2.412494
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.904989
-ret:-1         st: 0 flags:1  ts: 1.989184
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671678
-ret:-1         st: 0 flags:1  ts: 1.565850
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/flashsv.flv.ref b/tests/ref/seek/flashsv.flv.ref
deleted file mode 100644
index 8bfb2fc..0000000
--- a/tests/ref/seek/flashsv.flv.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size:240757
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size:240757
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:11605762 size:254053
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:4820517 size:245503
-ret:-1         st: 0 flags:1  ts:-0.317000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:8811911 size:253041
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: 0.400000 pos:2387452 size:241101
-ret:-1         st: 0 flags:1  ts:-0.741000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:6302834 size:248927
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size:240757
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114712 size:254237
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.760000 pts: 1.760000 pos:10843576 size:253913
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.600000 pts: 0.600000 pos:3598805 size:243372
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size:240757
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114712 size:254237
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:8053716 size:252195
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:1187821 size:238567
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size:240757
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:12114712 size:254237
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.920000 pts: 0.920000 pos:5559238 size:247341
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:9572247 size:254219
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:2870253 size:242377
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/flv.flv.ref b/tests/ref/seek/flv.flv.ref
deleted file mode 100644
index 6952a4e..0000000
--- a/tests/ref/seek/flv.flv.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 10380
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 10380
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83240 size: 12295
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  52585 size: 11127
-ret:-1         st: 0 flags:1  ts:-0.317000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83240 size: 12295
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  25960 size: 10089
-ret:-1         st: 0 flags:1  ts:-0.741000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  52585 size: 11127
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 10380
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  25960 size: 10089
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 10380
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83240 size: 12295
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 10380
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 10380
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 117158 size: 12730
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  52585 size: 11127
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83240 size: 12295
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  25960 size: 10089
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/g726.wav.ref b/tests/ref/seek/g726.wav.ref
deleted file mode 100644
index b84c87c..0000000
--- a/tests/ref/seek/g726.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894000 pts: 1.894000 pos:   7632 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788375
-ret: 0         st: 0 flags:1 dts: 0.788500 pts: 0.788500 pos:   3210 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317500
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576750 pts: 2.576750 pos:  10363 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470750 pts: 1.470750 pos:   5939 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.365000 pts: 0.365000 pos:   1516 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740875
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153500 pts: 2.153500 pos:   8670 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047500 pts: 1.047500 pos:   4246 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058375
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835875
-ret: 0         st: 0 flags:1 dts: 2.835750 pts: 2.835750 pos:  11399 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:   6976 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624000 pts: 0.624000 pos:   2552 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481625
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412500
-ret: 0         st: 0 flags:1 dts: 2.412500 pts: 2.412500 pos:   9706 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306750 pts: 1.306750 pos:   5283 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200750 pts: 0.200750 pos:    859 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989125
-ret: 0         st: 0 flags:1 dts: 1.989000 pts: 1.989000 pos:   8012 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883500 pts: 0.883500 pos:   3590 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671625
-ret: 0         st: 0 flags:1 dts: 2.671750 pts: 2.671750 pos:  10743 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565875
-ret: 0         st: 0 flags:1 dts: 1.565750 pts: 1.565750 pos:   6319 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:   1896 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
diff --git a/tests/ref/seek/h261.avi.ref b/tests/ref/seek/h261.avi.ref
deleted file mode 100644
index d31364f..0000000
--- a/tests/ref/seek/h261.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9645
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9645
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  82072 size: 10322
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  44678 size:  9404
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  82072 size: 10322
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9645
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  44678 size:  9404
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9645
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9645
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9645
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 175882 size: 11707
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  82072 size: 10322
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 126514 size: 11377
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  44678 size:  9404
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/h263.avi.ref b/tests/ref/seek/h263.avi.ref
deleted file mode 100644
index 8b1795c..0000000
--- a/tests/ref/seek/h263.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10381
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10381
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  66804 size: 11128
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  36450 size: 10090
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  66804 size: 11128
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10381
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  36450 size: 10090
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10381
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10381
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10381
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 144558 size: 12731
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  66804 size: 11128
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 103714 size: 12296
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  36450 size: 10090
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/h263p.avi.ref b/tests/ref/seek/h263p.avi.ref
deleted file mode 100644
index 51e6952..0000000
--- a/tests/ref/seek/h263p.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 36208
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 36208
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355988 size: 40907
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171054 size: 36515
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355988 size: 40907
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 36208
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171054 size: 36515
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 36208
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 36208
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 36208
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 804378 size: 46411
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 355988 size: 40907
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 569938 size: 45151
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 171054 size: 36515
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/huffyuv.avi.ref b/tests/ref/seek/huffyuv.avi.ref
deleted file mode 100644
index 8e3cbc1..0000000
--- a/tests/ref/seek/huffyuv.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5736 size:129760
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5736 size:129760
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:6069184 size:128520
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:2579624 size:129192
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:4778240 size:129424
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1160260 size:128504
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:3355296 size:129424
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5736 size:129760
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326136 size:128288
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:5554008 size:129016
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2062504 size:129204
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5736 size:129760
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326136 size:128288
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:4260872 size:129280
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 646920 size:128204
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5736 size:129760
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:6326136 size:128288
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:2838080 size:129268
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:5037036 size:129284
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1546184 size:128860
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/jpegls.avi.ref b/tests/ref/seek/jpegls.avi.ref
deleted file mode 100644
index b95ec5a..0000000
--- a/tests/ref/seek/jpegls.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:164074
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:164074
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:7804130 size:176295
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:3172792 size:164643
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:6052986 size:174097
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1402356 size:157283
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:4170260 size:168401
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:164074
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157028 size:176793
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:7101766 size:175326
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2519272 size:162522
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:164074
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157028 size:176793
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:5360830 size:172183
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 779846 size:154579
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:164074
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:8157028 size:176793
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:3502840 size:166017
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:6401464 size:174815
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1876428 size:159659
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.aif.ref b/tests/ref/seek/lavf.aif.ref
deleted file mode 100644
index 784b144..0000000
--- a/tests/ref/seek/lavf.aif.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret:-EOF
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69586 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret:-EOF
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos:  32248 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret:-EOF
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  55106 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  17768 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos:  77964 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret:-EOF
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:  40626 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     54 size:  4096
diff --git a/tests/ref/seek/lavf.al.ref b/tests/ref/seek/lavf.al.ref
deleted file mode 100644
index 84661ec..0000000
--- a/tests/ref/seek/lavf.al.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos:  41766 size:  1024
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  17383 size:  1024
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:  32432 size:  1024
-ret: 0         st: 0 flags:0  ts: 0.364989
-ret: 0         st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos:   8048 size:  1024
-ret: 0         st: 0 flags:1  ts:-0.740816
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos:  23097 size:  1024
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos:  38147 size:  1024
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  13763 size:  1024
-ret: 0         st: 0 flags:0  ts:-0.481678
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:1  ts: 2.412517
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos:  28812 size:  1024
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200816 pts: 0.200816 pos:   4428 size:  1024
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:1  ts: 1.989161
-ret: 0         st: 0 flags:1 dts: 1.989161 pts: 1.989161 pos:  43861 size:  1024
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883356 pts: 0.883356 pos:  19478 size:  1024
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:0  ts: 2.671655
-ret:-EOF
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos:  34527 size:  1024
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:  10143 size:  1024
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
diff --git a/tests/ref/seek/lavf.asf.ref b/tests/ref/seek/lavf.asf.ref
deleted file mode 100644
index afaed99..0000000
--- a/tests/ref/seek/lavf.asf.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 1 flags:1 dts: 3.544000 pts: 3.544000 pos: 147775 size:   209
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 1 flags:0  ts: 2.577000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:0  ts: 2.153000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 1 flags:0  ts: 1.307000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st: 1 flags:0  ts: 2.672000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 3.100000 pts: 3.100000 pos:  29375 size:   208
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    575 size: 28487
diff --git a/tests/ref/seek/lavf.au.ref b/tests/ref/seek/lavf.au.ref
deleted file mode 100644
index a2c57eb..0000000
--- a/tests/ref/seek/lavf.au.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret:-EOF
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69556 size:  2048
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret:-EOF
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos:  32218 size:  2048
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret:-EOF
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  55076 size:  2048
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  17738 size:  2048
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos:  77934 size:  2048
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret:-EOF
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:  40596 size:  2048
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  2048
diff --git a/tests/ref/seek/lavf.avi.ref b/tests/ref/seek/lavf.avi.ref
deleted file mode 100644
index 964f0b8..0000000
--- a/tests/ref/seek/lavf.avi.ref
+++ /dev/null
@@ -1,44 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   9908 size: 27867
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   9908 size: 27867
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st: 1 flags:0  ts: 2.586122
-ret: 0         st: 1 flags:1  ts: 1.462857
-ret: 0         st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size:   209
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955
-ret:-1         st:-1 flags:1  ts:-0.740831
-ret:-1         st: 0 flags:0  ts: 2.160000
-ret: 0         st: 0 flags:1  ts: 1.040000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret: 0         st: 1 flags:0  ts:-0.052245
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:  37784 size:   208
-ret: 0         st: 1 flags:1  ts: 2.847347
-ret: 0         st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size:   209
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   9908 size: 27867
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret:-1         st: 1 flags:0  ts: 1.306122
-ret: 0         st: 1 flags:1  ts: 0.208980
-ret: 0         st: 1 flags:1 dts: 0.208980 pts: 0.208980 pos:  92800 size:   209
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   9908 size: 27867
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret: 0         st: 0 flags:0  ts: 0.880000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 301466 size: 27864
-ret:-1         st: 0 flags:1  ts:-0.240000
-ret:-1         st: 1 flags:0  ts: 2.664490
-ret: 0         st: 1 flags:1  ts: 1.567347
-ret: 0         st: 1 flags:1 dts: 1.018776 pts: 1.018776 pos: 329774 size:   209
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 156166 size: 27955
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.dv.ref b/tests/ref/seek/lavf.dv.ref
deleted file mode 100644
index 3c49749..0000000
--- a/tests/ref/seek/lavf.dv.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 1 flags:0  ts: 2.576667
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 1 flags:1  ts: 1.470833
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 2.160000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 1.040000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 1 flags:0  ts:-0.058333
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 1 flags:1  ts: 2.835833
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 1 flags:0  ts: 1.306667
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 1 flags:1  ts: 0.200833
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 0 flags:0  ts: 0.880000
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:     -1 size:144000
-ret: 0         st: 0 flags:1  ts:-0.240000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
-ret: 0         st: 1 flags:0  ts: 2.671667
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st: 1 flags:1  ts: 1.565833
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:     -1 size:144000
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:     -1 size:144000
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:144000
diff --git a/tests/ref/seek/lavf.ffm.ref b/tests/ref/seek/lavf.ffm.ref
deleted file mode 100644
index 46cf764..0000000
--- a/tests/ref/seek/lavf.ffm.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 1 flags:1 dts: 0.783673 pts: 0.783673 pos: 315392 size:   209
-ret: 0         st: 0 flags:1  ts:-0.317499
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st: 1 flags:0  ts: 2.576668
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 1 flags:1  ts: 1.470835
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 1 flags:1 dts: 0.339592 pts: 0.339592 pos: 155648 size:   209
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st: 0 flags:0  ts: 2.153336
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 0 flags:1  ts: 1.047503
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 1 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st: 1 flags:1  ts: 2.835837
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 1 flags:1 dts: 0.653061 pts: 0.653061 pos: 274432 size:   209
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 1 flags:0  ts: 1.306672
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 1 flags:1  ts: 0.200839
-ret: 0         st: 1 flags:1 dts: 0.208980 pts: 0.208980 pos: 114688 size:   209
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 0 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:0 dts: 0.880000 pts: 0.920000 pos: 339968 size: 12307
-ret: 0         st: 0 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
-ret: 0         st: 1 flags:0  ts: 2.671674
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st: 1 flags:1  ts: 1.565841
-ret: 0         st: 1 flags:1 dts: 0.940408 pts: 0.940408 pos: 376832 size:   209
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 1 flags:1 dts: 0.444082 pts: 0.444082 pos: 204800 size:   209
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts:-0.040000 pts: 0.000000 pos:   8192 size: 24664
diff --git a/tests/ref/seek/lavf.flv.ref b/tests/ref/seek/lavf.flv.ref
deleted file mode 100644
index 2e7a0bc..0000000
--- a/tests/ref/seek/lavf.flv.ref
+++ /dev/null
@@ -1,44 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 31074
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 31074
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret:-1         st: 0 flags:1  ts:-0.317000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149441 size: 31125
-ret:-1         st: 0 flags:1  ts:-0.741000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 31074
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149441 size: 31125
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 31074
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 31074
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    199 size: 31074
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 298403 size: 31134
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 149441 size: 31125
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.gif.ref b/tests/ref/seek/lavf.gif.ref
deleted file mode 100644
index 5da803d..0000000
--- a/tests/ref/seek/lavf.gif.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:2906382
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.gxf.ref b/tests/ref/seek/lavf.gxf.ref
deleted file mode 100644
index bc7ff3b..0000000
--- a/tests/ref/seek/lavf.gxf.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 0 flags:0  ts: 0.780000
-ret: 0         st: 0 flags:0 dts: 0.800000 pts: NOPTS    pos: 653328 size: 22148
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st: 1 flags:0  ts: 2.580000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 1 flags:1  ts: 1.480000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 2 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:0 dts: 0.360000 pts: NOPTS    pos: 302676 size: 25108
-ret: 0         st: 2 flags:1  ts:-0.740000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 0 flags:0  ts:-0.060000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 1 flags:0  ts: 1.740000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 1 flags:1  ts: 0.620000
-ret: 0         st: 0 flags:0 dts: 0.640000 pts: NOPTS    pos: 497156 size: 21596
-ret: 0         st: 2 flags:0  ts:-0.480000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st: 2 flags:1  ts: 2.420000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:0 dts: 0.200000 pts: NOPTS    pos: 209504 size: 22968
-ret: 0         st: 0 flags:0  ts:-0.900000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st: 0 flags:1  ts: 1.980000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 1 flags:0  ts: 0.880000
-ret: 0         st: 0 flags:0 dts: 0.880000 pts: NOPTS    pos: 696044 size: 22484
-ret: 0         st: 1 flags:1  ts:-0.220000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
-ret: 0         st: 2 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st: 2 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos: 741640 size: 54736
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos: 370660 size: 54628
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:   5024 size: 65536
diff --git a/tests/ref/seek/lavf.mkv.ref b/tests/ref/seek/lavf.mkv.ref
deleted file mode 100644
index 5af4488..0000000
--- a/tests/ref/seek/lavf.mkv.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291902 size: 27834
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291902 size: 27834
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st: 1 flags:0  ts: 2.577000
-ret:-EOF
-ret: 0         st: 1 flags:1  ts: 1.471000
-ret: 0         st: 1 flags:1 dts: 1.019000 pts: 1.019000 pos: 320175 size:   209
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146687 size: 27925
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st: 0 flags:0  ts: 2.153000
-ret:-EOF
-ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291902 size: 27834
-ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st: 1 flags:1  ts: 2.836000
-ret: 0         st: 1 flags:1 dts: 1.019000 pts: 1.019000 pos: 320175 size:   209
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146687 size: 27925
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291902 size: 27834
-ret: 0         st: 1 flags:0  ts: 1.307000
-ret:-EOF
-ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos:  72083 size:   209
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291902 size: 27834
-ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 291902 size: 27834
-ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
-ret: 0         st: 1 flags:0  ts: 2.672000
-ret:-EOF
-ret: 0         st: 1 flags:1  ts: 1.566000
-ret: 0         st: 1 flags:1 dts: 1.019000 pts: 1.019000 pos: 320175 size:   209
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146687 size: 27925
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    513 size: 27837
diff --git a/tests/ref/seek/lavf.mmf.ref b/tests/ref/seek/lavf.mmf.ref
deleted file mode 100644
index 196d263..0000000
--- a/tests/ref/seek/lavf.mmf.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:  4096
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.788345
-ret:-1         st: 0 flags:1  ts:-0.317506
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.365011
-ret:-1         st: 0 flags:1  ts:-0.740839
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.058322
-ret:-1         st: 0 flags:1  ts: 2.835828
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.481655
-ret:-1         st: 0 flags:1  ts: 2.412494
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.904989
-ret:-1         st: 0 flags:1  ts: 1.989184
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671678
-ret:-1         st: 0 flags:1  ts: 1.565850
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.mov.ref b/tests/ref/seek/lavf.mov.ref
deleted file mode 100644
index 0091915..0000000
--- a/tests/ref/seek/lavf.mov.ref
+++ /dev/null
@@ -1,48 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 325248 size:  1024
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326272 size: 27834
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret:-1         st: 1 flags:0  ts: 2.576667
-ret: 0         st: 1 flags:1  ts: 1.470839
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326272 size: 27834
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 163526 size: 27925
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret:-1         st: 0 flags:0  ts: 2.160000
-ret: 0         st: 0 flags:1  ts: 1.040000
-ret: 0         st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 325248 size:  1024
-ret: 0         st: 1 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret: 0         st: 1 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326272 size: 27834
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 1 flags:1 dts: 0.464399 pts: 0.464399 pos: 162502 size:  1024
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 325248 size:  1024
-ret:-1         st: 1 flags:0  ts: 1.306667
-ret: 0         st: 1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 1 flags:1 dts: 0.952018 pts: 0.952018 pos: 325248 size:  1024
-ret: 0         st: 0 flags:0  ts: 0.880000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326272 size: 27834
-ret: 0         st: 0 flags:1  ts:-0.240000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
-ret:-1         st: 1 flags:0  ts: 2.671678
-ret: 0         st: 1 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326272 size: 27834
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 163526 size: 27925
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 27837
diff --git a/tests/ref/seek/lavf.mpg.ref b/tests/ref/seek/lavf.mpg.ref
deleted file mode 100644
index 4f07864..0000000
--- a/tests/ref/seek/lavf.mpg.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size:   681
-ret: 0         st: 0 flags:0  ts: 0.788333
-ret: 0         st: 1 flags:1 dts: 0.761222 pts: 0.761222 pos: 145408 size:   261
-ret: 0         st: 0 flags:1  ts:-0.317500
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st: 1 flags:0  ts: 2.576667
-ret: 0         st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size:   235
-ret: 0         st: 1 flags:1  ts: 1.470833
-ret: 0         st: 1 flags:1 dts: 1.283678 pts: 1.283678 pos: 368652 size:   379
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st: 0 flags:0  ts: 2.153333
-ret: 0         st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size:   681
-ret: 0         st: 0 flags:1  ts: 1.047500
-ret: 0         st: 0 flags:0 dts: 1.020000 pts: 1.060000 pos: 212992 size: 16484
-ret: 0         st: 1 flags:0  ts:-0.058333
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st: 1 flags:1  ts: 2.835833
-ret: 0         st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size:   235
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size:   681
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:0 dts: 0.620000 pts: 0.660000 pos:  67584 size: 15804
-ret: 0         st: 0 flags:0  ts:-0.481667
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st: 0 flags:1  ts: 2.412500
-ret: 0         st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size:   681
-ret: 0         st: 1 flags:0  ts: 1.306667
-ret: 0         st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size:   235
-ret: 0         st: 1 flags:1  ts: 0.200844
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.420000 pts: 1.460000 pos: 339968 size:   681
-ret: 0         st: 0 flags:0  ts: 0.883344
-ret: 0         st: 0 flags:0 dts: 0.900000 pts: 0.940000 pos: 159744 size: 12809
-ret: 0         st: 0 flags:1  ts:-0.222489
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
-ret: 0         st: 1 flags:0  ts: 2.671678
-ret: 0         st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size:   235
-ret: 0         st: 1 flags:1  ts: 1.565844
-ret: 0         st: 1 flags:1 dts: 1.518778 pts: 1.518778 pos: 370700 size:   235
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:0 dts: 0.500000 pts: 0.540000 pos:  26624 size: 16303
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 1 flags:1 dts: 0.500000 pts: 0.500000 pos:   2048 size:   208
diff --git a/tests/ref/seek/lavf.mxf.ref b/tests/ref/seek/lavf.mxf.ref
deleted file mode 100644
index 4c1aecc..0000000
--- a/tests/ref/seek/lavf.mxf.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret:-1
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret:-1
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st: 1 flags:0  ts: 2.560000
-ret:-1
-ret: 0         st: 1 flags:1  ts: 1.480000
-ret:-1
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st: 0 flags:0  ts: 2.160000
-ret:-1
-ret: 0         st: 0 flags:1  ts: 1.040000
-ret:-1
-ret: 0         st: 1 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st: 1 flags:1  ts: 2.840000
-ret:-1
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret:-1
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret:-1
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret:-1
-ret: 0         st: 1 flags:0  ts: 1.320000
-ret:-1
-ret: 0         st: 1 flags:1  ts: 0.200000
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret:-1
-ret: 0         st: 0 flags:0  ts: 0.880000
-ret:-1
-ret: 0         st: 0 flags:1  ts:-0.240000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st: 1 flags:0  ts: 2.680000
-ret:-1
-ret: 0         st: 1 flags:1  ts: 1.560000
-ret:-1
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:   6144 size: 24801
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   6144 size: 24801
diff --git a/tests/ref/seek/lavf.mxf_d10.ref b/tests/ref/seek/lavf.mxf_d10.ref
deleted file mode 100644
index c05870f..0000000
--- a/tests/ref/seek/lavf.mxf_d10.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret:-1
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret:-1
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st: 1 flags:0  ts: 2.560000
-ret:-1
-ret: 0         st: 1 flags:1  ts: 1.480000
-ret:-1
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:   6144 size:150000
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st: 0 flags:0  ts: 2.160000
-ret:-1
-ret: 0         st: 0 flags:1  ts: 1.040000
-ret:-1
-ret: 0         st: 1 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st: 1 flags:1  ts: 2.840000
-ret:-1
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret:-1
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret:-1
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret:-1
-ret: 0         st: 1 flags:0  ts: 1.320000
-ret:-1
-ret: 0         st: 1 flags:1  ts: 0.200000
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:   6144 size:150000
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret:-1
-ret: 0         st: 0 flags:0  ts: 0.880000
-ret:-1
-ret: 0         st: 0 flags:1  ts:-0.240000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
-ret: 0         st: 1 flags:0  ts: 2.680000
-ret:-1
-ret: 0         st: 1 flags:1  ts: 1.560000
-ret:-1
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:   6144 size:150000
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   6144 size:150000
diff --git a/tests/ref/seek/lavf.nut.ref b/tests/ref/seek/lavf.nut.ref
deleted file mode 100644
index fc3ef63..0000000
--- a/tests/ref/seek/lavf.nut.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st: 1 flags:0  ts: 2.586122
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 1 flags:1  ts: 1.462857
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st: 0 flags:0  ts: 2.160000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 0 flags:1  ts: 1.040000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 1 flags:0  ts:-0.052245
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st: 1 flags:1  ts: 2.847347
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 1 flags:0  ts: 1.306122
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 1 flags:1  ts: 0.208980
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 0 flags:0  ts: 0.880000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 0 flags:1  ts:-0.240000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
-ret: 0         st: 1 flags:0  ts: 2.664490
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st: 1 flags:1  ts: 1.567347
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146329 size: 27925
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    279 size: 27837
diff --git a/tests/ref/seek/lavf.ogg.ref b/tests/ref/seek/lavf.ogg.ref
deleted file mode 100644
index c9be9c6..0000000
--- a/tests/ref/seek/lavf.ogg.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    125 size:  1364
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.788345
-ret:-1         st: 0 flags:1  ts:-0.317506
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.365011
-ret:-1         st: 0 flags:1  ts:-0.740839
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.058322
-ret:-1         st: 0 flags:1  ts: 2.835828
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.481655
-ret:-1         st: 0 flags:1  ts: 2.412494
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.904989
-ret:-1         st: 0 flags:1  ts: 1.989184
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671678
-ret:-1         st: 0 flags:1  ts: 1.565850
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.rm.ref b/tests/ref/seek/lavf.rm.ref
deleted file mode 100644
index 188367b..0000000
--- a/tests/ref/seek/lavf.rm.ref
+++ /dev/null
@@ -1,47 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
-ret:-1         st: 1 flags:0  ts: 2.577000
-ret:-1         st: 1 flags:1  ts: 1.471000
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
-ret: 0         st: 0 flags:0  ts: 2.153000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0         st: 0 flags:1  ts: 1.048000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0         st: 1 flags:0  ts:-0.058000
-ret: 0         st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos:  31483 size:   278
-ret:-1         st: 1 flags:1  ts: 2.836000
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret:-1         st: 1 flags:0  ts: 1.307000
-ret: 0         st: 1 flags:1  ts: 0.201000
-ret: 0         st: 1 flags:1 dts: 0.174000 pts: 0.174000 pos:  78969 size:   278
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0         st: 0 flags:0  ts: 0.883000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
-ret: 0         st: 0 flags:1  ts:-0.222000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
-ret:-1         st: 1 flags:0  ts: 2.672000
-ret:-1         st: 1 flags:1  ts: 1.566000
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    398 size: 31082
diff --git a/tests/ref/seek/lavf.swf.ref b/tests/ref/seek/lavf.swf.ref
deleted file mode 100644
index 52cd1e2..0000000
--- a/tests/ref/seek/lavf.swf.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:0 dts: 0.000000 pts: 0.000000 pos:     55 size: 31074
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.800000
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.360000
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.040000
-ret:-1         st: 0 flags:1  ts: 2.840000
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.480000
-ret:-1         st: 0 flags:1  ts: 2.400000
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.920000
-ret:-1         st: 0 flags:1  ts: 2.000000
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret:-1         st: 0 flags:1  ts: 1.560000
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.ts.ref b/tests/ref/seek/lavf.ts.ref
deleted file mode 100644
index 9ed59ef..0000000
--- a/tests/ref/seek/lavf.ts.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos:    564 size: 24801
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos:  44932 size: 14502
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st: 0 flags:0  ts: 0.788333
-ret: 0         st: 0 flags:0 dts: 1.520000 pts: 1.560000 pos:  74260 size: 13388
-ret: 0         st: 0 flags:1  ts:-0.317500
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos:    564 size: 24801
-ret: 0         st: 1 flags:0  ts: 2.576667
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st: 1 flags:1  ts: 1.470833
-ret: 0         st: 0 flags:0 dts: 2.160000 pts: 2.200000 pos: 325240 size: 12679
-ret: 0         st:-1 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos:  44932 size: 14502
-ret: 0         st:-1 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos:    564 size: 24801
-ret: 0         st: 0 flags:0  ts: 2.153333
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st: 0 flags:1  ts: 1.047500
-ret: 0         st: 0 flags:0 dts: 1.680000 pts: 1.720000 pos: 130096 size: 14133
-ret: 0         st: 1 flags:0  ts:-0.058333
-ret: 0         st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos:  44932 size: 14502
-ret: 0         st: 1 flags:1  ts: 2.835833
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos:    564 size: 24801
-ret: 0         st: 0 flags:0  ts:-0.481667
-ret: 0         st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos:  44932 size: 14502
-ret: 0         st: 0 flags:1  ts: 2.412500
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st: 1 flags:0  ts: 1.306667
-ret: 0         st: 0 flags:0 dts: 2.080000 pts: 2.120000 pos: 294032 size: 13839
-ret: 0         st: 1 flags:1  ts: 0.200844
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos:    564 size: 24801
-ret: 0         st:-1 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos:  44932 size: 14502
-ret: 0         st:-1 flags:1  ts: 1.989173
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st: 0 flags:0  ts: 0.883344
-ret: 0         st: 0 flags:0 dts: 1.600000 pts: 1.640000 pos: 102836 size: 12781
-ret: 0         st: 0 flags:1  ts:-0.222489
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos:    564 size: 24801
-ret: 0         st: 1 flags:0  ts: 2.671678
-ret: 0         st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size:   209
-ret: 0         st: 1 flags:1  ts: 1.565844
-ret: 0         st: 0 flags:0 dts: 2.240000 pts: 2.280000 pos: 350996 size: 11307
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:0 dts: 1.440000 pts: 1.480000 pos:  44932 size: 14502
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos:    564 size: 24801
diff --git a/tests/ref/seek/lavf.ul.ref b/tests/ref/seek/lavf.ul.ref
deleted file mode 100644
index 84661ec..0000000
--- a/tests/ref/seek/lavf.ul.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894150 pts: 1.894150 pos:  41766 size:  1024
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  17383 size:  1024
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:  32432 size:  1024
-ret: 0         st: 0 flags:0  ts: 0.364989
-ret: 0         st: 0 flags:1 dts: 0.364989 pts: 0.364989 pos:   8048 size:  1024
-ret: 0         st: 0 flags:1  ts:-0.740816
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047483 pts: 1.047483 pos:  23097 size:  1024
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730023 pts: 1.730023 pos:  38147 size:  1024
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  13763 size:  1024
-ret: 0         st: 0 flags:0  ts:-0.481678
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:1  ts: 2.412517
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos:  28812 size:  1024
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200816 pts: 0.200816 pos:   4428 size:  1024
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:1  ts: 1.989161
-ret: 0         st: 0 flags:1 dts: 1.989161 pts: 1.989161 pos:  43861 size:  1024
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883356 pts: 0.883356 pos:  19478 size:  1024
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
-ret: 0         st: 0 flags:0  ts: 2.671655
-ret:-EOF
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos:  34527 size:  1024
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:  10143 size:  1024
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  1024
diff --git a/tests/ref/seek/lavf.voc.ref b/tests/ref/seek/lavf.voc.ref
deleted file mode 100644
index 5670d1a..0000000
--- a/tests/ref/seek/lavf.voc.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     32 size:  1024
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.788333
-ret:-1         st: 0 flags:1  ts:-0.317500
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.365000
-ret:-1         st: 0 flags:1  ts:-0.740833
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.058333
-ret:-1         st: 0 flags:1  ts: 2.835833
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.481667
-ret:-1         st: 0 flags:1  ts: 2.412500
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.904989
-ret:-1         st: 0 flags:1  ts: 1.989178
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671678
-ret:-1         st: 0 flags:1  ts: 1.565844
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/lavf.wav.ref b/tests/ref/seek/lavf.wav.ref
deleted file mode 100644
index b411c3c..0000000
--- a/tests/ref/seek/lavf.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret:-EOF
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69576 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret:-EOF
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos:  32238 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret:-EOF
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  55096 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret:-EOF
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  17758 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos:  77954 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret:-EOF
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret:-EOF
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:  40616 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
diff --git a/tests/ref/seek/lavf.y4m.ref b/tests/ref/seek/lavf.y4m.ref
deleted file mode 100644
index 81c1de9..0000000
--- a/tests/ref/seek/lavf.y4m.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     64 size:152064
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.800000
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.360000
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.040000
-ret:-1         st: 0 flags:1  ts: 2.840000
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.480000
-ret:-1         st: 0 flags:1  ts: 2.400000
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.920000
-ret:-1         st: 0 flags:1  ts: 2.000000
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret:-1         st: 0 flags:1  ts: 1.560000
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/ljpeg.avi.ref b/tests/ref/seek/ljpeg.avi.ref
deleted file mode 100644
index 76442fe..0000000
--- a/tests/ref/seek/ljpeg.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 96069
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 96069
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos:4481876 size: 94870
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:1902330 size: 95465
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos:3527736 size: 95724
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 854956 size: 94635
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos:2475578 size: 95649
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 96069
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671510 size: 94595
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos:4101350 size: 95353
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:1520296 size: 95410
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 96069
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671510 size: 94595
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos:3145126 size: 95587
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 477238 size: 94261
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 96069
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos:4671510 size: 94595
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:2093314 size: 95528
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos:3719138 size: 95615
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1139250 size: 95032
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mjpeg.avi.ref b/tests/ref/seek/mjpeg.avi.ref
deleted file mode 100644
index b0f975b..0000000
--- a/tests/ref/seek/mjpeg.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 12096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 12096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 627866 size: 14811
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 247500 size: 12959
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 480770 size: 14528
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 111012 size: 11927
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 326684 size: 13489
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 12096
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 568664 size: 14746
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 196428 size: 12719
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 12096
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 423494 size: 14119
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:  63872 size: 11714
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 12096
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 657534 size: 14881
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 273520 size: 13131
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 509938 size: 14597
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146970 size: 12168
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mp2.mp2.ref b/tests/ref/seek/mp2.mp2.ref
deleted file mode 100644
index 6166cb3..0000000
--- a/tests/ref/seek/mp2.mp2.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.026122 pts: 0.026122 pos:    417 size:   418
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos:  30093 size:   418
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos:  12956 size:   418
-ret: 0         st: 0 flags:1  ts:-0.317499
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos:  41377 size:   418
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos:  23405 size:   418
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos:   5851 size:   418
-ret: 0         st: 0 flags:1  ts:-0.740831
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos:  34690 size:   418
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  16718 size:   418
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos:  45139 size:   418
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos:  28003 size:   418
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos:   9613 size:   418
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos:  38452 size:   418
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos:  21315 size:   418
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos:   2925 size:   418
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos:  31764 size:   418
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos:  14210 size:   418
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
-ret: 0         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos:  43049 size:   418
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos:  24659 size:   418
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos:   7523 size:   418
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:   417
diff --git a/tests/ref/seek/mpeg1.mpg.ref b/tests/ref/seek/mpeg1.mpg.ref
deleted file mode 100644
index 54f0b16..0000000
--- a/tests/ref/seek/mpeg1.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size:  9779
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9779
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 124245 size: 11796
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  76694 size: 10792
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 124245 size: 11796
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  37721 size:  9873
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  76694 size: 10792
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9779
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 177089 size: 12057
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 177089 size: 12057
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  37721 size:  9873
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9779
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 177089 size: 12057
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 124245 size: 11796
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9779
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9779
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 177089 size: 12057
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  76694 size: 10792
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 124245 size: 11796
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  37721 size:  9873
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg1b.mpg.ref b/tests/ref/seek/mpeg1b.mpg.ref
deleted file mode 100644
index 4c83997..0000000
--- a/tests/ref/seek/mpeg1b.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      0 size: 11817
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 11817
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.800000 pts: NOPTS    pos: 194420 size: 14837
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.840000 pts: NOPTS    pos:  80757 size: 13267
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: NOPTS    pos: 133899 size: 14470
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.840000 pts: NOPTS    pos:  80757 size: 13267
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.840000 pts: NOPTS    pos:  80757 size: 13267
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 11817
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.800000 pts: NOPTS    pos: 194420 size: 14837
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.800000 pts: NOPTS    pos: 194420 size: 14837
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: NOPTS    pos:  34797 size: 12009
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 11817
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.800000 pts: NOPTS    pos: 194420 size: 14837
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: NOPTS    pos: 133899 size: 14470
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 11817
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 11817
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.800000 pts: NOPTS    pos: 194420 size: 14837
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: NOPTS    pos: 133899 size: 14470
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: NOPTS    pos: 133899 size: 14470
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.840000 pts: NOPTS    pos:  80757 size: 13267
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg2.mpg.ref b/tests/ref/seek/mpeg2.mpg.ref
deleted file mode 100644
index b096f6f..0000000
--- a/tests/ref/seek/mpeg2.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9911
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9911
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 127925 size: 11918
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  79103 size: 10909
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 127925 size: 11918
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  38992 size:  9985
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  79103 size: 10909
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9911
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 182138 size: 12183
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 182138 size: 12183
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  38992 size:  9985
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9911
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 182138 size: 12183
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 127925 size: 11918
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9911
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9911
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 182138 size: 12183
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  79103 size: 10909
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 127925 size: 11918
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  38992 size:  9985
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg2_422.mpg.ref b/tests/ref/seek/mpeg2_422.mpg.ref
deleted file mode 100644
index 3b4e1e7..0000000
--- a/tests/ref/seek/mpeg2_422.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 17497
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 17497
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 325162 size: 19936
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 200736 size: 22575
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 265477 size: 21329
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos: 104454 size: 28984
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 200736 size: 22575
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 17497
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 325162 size: 19936
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 325162 size: 19936
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos: 104454 size: 28984
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 17497
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 325162 size: 19936
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 265477 size: 21329
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 17497
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 17497
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 325162 size: 19936
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 265477 size: 21329
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 265477 size: 21329
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 200736 size: 22575
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg2i.mpg.ref b/tests/ref/seek/mpeg2i.mpg.ref
deleted file mode 100644
index 0708cfd..0000000
--- a/tests/ref/seek/mpeg2i.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 132607 size: 11970
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  82152 size: 10965
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 132607 size: 11970
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  40546 size: 10045
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  82152 size: 10965
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 188429 size: 12232
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 188429 size: 12232
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  40546 size: 10045
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 188429 size: 12232
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 132607 size: 11970
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: NOPTS    pos: 188429 size: 12232
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: NOPTS    pos:  82152 size: 10965
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: NOPTS    pos: 132607 size: 11970
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: NOPTS    pos:  40546 size: 10045
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg2ivlc-qprd.mpg.ref b/tests/ref/seek/mpeg2ivlc-qprd.mpg.ref
deleted file mode 100644
index 330dc16..0000000
--- a/tests/ref/seek/mpeg2ivlc-qprd.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 16239
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 16239
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 227500 size: 12725
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 164167 size: 13921
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 196681 size: 13159
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  98748 size: 29165
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 164167 size: 13921
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 16239
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 227500 size: 12725
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 227500 size: 12725
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  98748 size: 29165
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 16239
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 227500 size: 12725
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 196681 size: 13159
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 16239
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 16239
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 227500 size: 12725
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 196681 size: 13159
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 196681 size: 13159
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 164167 size: 13921
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg2reuse.mpg.ref b/tests/ref/seek/mpeg2reuse.mpg.ref
deleted file mode 100644
index c4ae3ea..0000000
--- a/tests/ref/seek/mpeg2reuse.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 20829
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 20829
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 337078 size: 26840
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 141401 size: 23537
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 232037 size: 26192
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  63793 size: 21295
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 141401 size: 23537
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 20829
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 337078 size: 26840
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 337078 size: 26840
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  63793 size: 21295
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 20829
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 337078 size: 26840
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 232037 size: 26192
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 20829
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size: 20829
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 337078 size: 26840
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 232037 size: 26192
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 232037 size: 26192
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 141401 size: 23537
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg2thread.mpg.ref b/tests/ref/seek/mpeg2thread.mpg.ref
deleted file mode 100644
index 24ee04f..0000000
--- a/tests/ref/seek/mpeg2thread.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 158225 size: 12232
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  67790 size: 10965
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110330 size: 11970
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  30747 size: 10045
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  67790 size: 10965
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 158225 size: 12232
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 158225 size: 12232
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  30747 size: 10045
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 158225 size: 12232
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110330 size: 11970
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9961
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 158225 size: 12232
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110330 size: 11970
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110330 size: 11970
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  67790 size: 10965
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg2threadivlc.mpg.ref b/tests/ref/seek/mpeg2threadivlc.mpg.ref
deleted file mode 100644
index c2f9895..0000000
--- a/tests/ref/seek/mpeg2threadivlc.mpg.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9954
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9954
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 157678 size: 11930
-ret: 0         st: 0 flags:0  ts: 0.788334
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  67723 size: 10791
-ret:-1         st: 0 flags:1  ts:-0.317499
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110080 size: 11697
-ret: 0         st: 0 flags:0  ts: 0.365002
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  30744 size:  9980
-ret:-1         st: 0 flags:1  ts:-0.740831
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  67723 size: 10791
-ret: 0         st: 0 flags:0  ts:-0.058330
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9954
-ret: 0         st: 0 flags:1  ts: 2.835837
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 157678 size: 11930
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 157678 size: 11930
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  30744 size:  9980
-ret: 0         st: 0 flags:0  ts:-0.481662
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9954
-ret: 0         st: 0 flags:1  ts: 2.412505
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 157678 size: 11930
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110080 size: 11697
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9954
-ret: 0         st: 0 flags:0  ts:-0.904994
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:      0 size:  9954
-ret: 0         st: 0 flags:1  ts: 1.989173
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 157678 size: 11930
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110080 size: 11697
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671674
-ret: 0         st: 0 flags:1  ts: 1.565841
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 110080 size: 11697
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  67723 size: 10791
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg4-Q.avi.ref b/tests/ref/seek/mpeg4-Q.avi.ref
deleted file mode 100644
index 1bb1504..0000000
--- a/tests/ref/seek/mpeg4-Q.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 11942
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 11942
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 141530 size: 15562
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  64116 size: 13382
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 100368 size: 15057
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  32818 size: 11813
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  64116 size: 13382
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 11942
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 141530 size: 15562
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 141530 size: 15562
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  32818 size: 11813
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 11942
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 141530 size: 15562
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 100368 size: 15057
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 11942
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 11942
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 141530 size: 15562
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  64116 size: 13382
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 100368 size: 15057
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  64116 size: 13382
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg4-adap.avi.ref b/tests/ref/seek/mpeg4-adap.avi.ref
deleted file mode 100644
index 8397b41..0000000
--- a/tests/ref/seek/mpeg4-adap.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size:  6855
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size:  6855
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 174456 size: 16883
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  98228 size: 17063
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 135598 size: 17525
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  59454 size: 17261
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  98228 size: 17063
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size:  6855
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 174456 size: 16883
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 174456 size: 16883
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  59454 size: 17261
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size:  6855
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 174456 size: 16883
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 135598 size: 17525
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size:  6855
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size:  6855
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 174456 size: 16883
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  98228 size: 17063
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 135598 size: 17525
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos:  98228 size: 17063
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg4-adv.avi.ref b/tests/ref/seek/mpeg4-adv.avi.ref
deleted file mode 100644
index 2e66b77..0000000
--- a/tests/ref/seek/mpeg4-adv.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8653
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8653
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  91730 size: 11013
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  59504 size:  9815
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  91730 size: 11013
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  31944 size:  8753
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  59504 size:  9815
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8653
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  31944 size:  8753
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8653
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  91730 size: 11013
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8653
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8653
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 127624 size: 11279
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  59504 size:  9815
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  91730 size: 11013
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  31944 size:  8753
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg4-nr.avi.ref b/tests/ref/seek/mpeg4-nr.avi.ref
deleted file mode 100644
index c9af36f..0000000
--- a/tests/ref/seek/mpeg4-nr.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10673
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10673
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  65480 size: 11181
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  35312 size:  9987
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  65480 size: 11181
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10673
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  35312 size:  9987
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10673
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10673
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 10673
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139424 size: 12911
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  65480 size: 11181
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 100640 size: 12464
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  35312 size:  9987
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg4-qprd.avi.ref b/tests/ref/seek/mpeg4-qprd.avi.ref
deleted file mode 100644
index 70374df..0000000
--- a/tests/ref/seek/mpeg4-qprd.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14873
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14873
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 211032 size: 14638
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 150666 size: 14502
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 180782 size: 14371
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  93036 size: 29366
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 150666 size: 14502
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14873
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 211032 size: 14638
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 211032 size: 14638
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  93036 size: 29366
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14873
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 211032 size: 14638
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 180782 size: 14371
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14873
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14873
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 211032 size: 14638
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 150666 size: 14502
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 180782 size: 14371
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 150666 size: 14502
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg4-rc.avi.ref b/tests/ref/seek/mpeg4-rc.avi.ref
deleted file mode 100644
index dc703d7..0000000
--- a/tests/ref/seek/mpeg4-rc.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 15766
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 15766
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 207968 size: 13826
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 153812 size: 13382
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 180960 size: 13326
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  94594 size: 32807
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 153812 size: 13382
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 15766
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 207968 size: 13826
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 207968 size: 13826
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  94594 size: 32807
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 15766
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 207968 size: 13826
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 180960 size: 13326
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 15766
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 15766
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 207968 size: 13826
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 153812 size: 13382
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 180960 size: 13326
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 153812 size: 13382
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/mpeg4-thread.avi.ref b/tests/ref/seek/mpeg4-thread.avi.ref
deleted file mode 100644
index 8c97827..0000000
--- a/tests/ref/seek/mpeg4-thread.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14874
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14874
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 228222 size: 16324
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 162162 size: 16475
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 195332 size: 16136
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  97844 size: 33332
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 162162 size: 16475
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14874
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 228222 size: 16324
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 228222 size: 16324
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: NOPTS    pos:  97844 size: 33332
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14874
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 228222 size: 16324
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 195332 size: 16136
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14874
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: NOPTS    pos:   5660 size: 14874
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.840000 pts: NOPTS    pos: 228222 size: 16324
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 162162 size: 16475
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.360000 pts: NOPTS    pos: 195332 size: 16136
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: NOPTS    pos: 162162 size: 16475
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/msmpeg4.avi.ref b/tests/ref/seek/msmpeg4.avi.ref
deleted file mode 100644
index fafd442..0000000
--- a/tests/ref/seek/msmpeg4.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8637
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8637
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  82520 size: 10783
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  53858 size:  9624
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  82520 size: 10783
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29400 size:  8502
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  53858 size:  9624
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8637
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29400 size:  8502
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8637
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  82520 size: 10783
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8637
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8637
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 114276 size: 11180
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  53858 size:  9624
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  82520 size: 10783
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29400 size:  8502
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/msmpeg4v2.avi.ref b/tests/ref/seek/msmpeg4v2.avi.ref
deleted file mode 100644
index 566ade0..0000000
--- a/tests/ref/seek/msmpeg4v2.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9003
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9003
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83882 size: 11165
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54790 size: 10010
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83882 size: 11165
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29782 size:  8869
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54790 size: 10010
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9003
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29782 size:  8869
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9003
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83882 size: 11165
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9003
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  9003
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116112 size: 11578
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54790 size: 10010
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83882 size: 11165
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29782 size:  8869
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/odivx.mp4.ref b/tests/ref/seek/odivx.mp4.ref
deleted file mode 100644
index 0600ed0..0000000
--- a/tests/ref/seek/odivx.mp4.ref
+++ /dev/null
@@ -1,50 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  75140 size: 10776
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  47228 size:  9634
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  75140 size: 10776
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  23271 size:  8524
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  47228 size:  9634
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 106167 size: 11182
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 106167 size: 11182
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  23271 size:  8524
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 106167 size: 11182
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  75140 size: 10776
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 106167 size: 11182
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  47228 size:  9634
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  75140 size: 10776
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  23271 size:  8524
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  8719
diff --git a/tests/ref/seek/pbmpipe.pbm.ref b/tests/ref/seek/pbmpipe.pbm.ref
deleted file mode 100644
index 2858934..0000000
--- a/tests/ref/seek/pbmpipe.pbm.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:317075
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/pcm_alaw.wav.ref b/tests/ref/seek/pcm_alaw.wav.ref
deleted file mode 100644
index 06f50e7..0000000
--- a/tests/ref/seek/pcm_alaw.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894127 pts: 1.894127 pos:  30362 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788367 pts: 0.788367 pos:  12670 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576757 pts: 2.576757 pos:  41284 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470748 pts: 1.470748 pos:  23588 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365125 pts: 0.365125 pos:   5898 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153379 pts: 2.153379 pos:  34510 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos:  16816 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos:  45428 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:  27736 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624127 pts: 0.624127 pos:  10042 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412381 pts: 2.412381 pos:  38654 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306757 pts: 1.306757 pos:  20964 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200748 pts: 0.200748 pos:   3268 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989116 pts: 1.989116 pos:  31882 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883379 pts: 0.883379 pos:  14190 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671746 pts: 2.671746 pos:  42804 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565760 pts: 1.565760 pos:  25108 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:   7416 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
diff --git a/tests/ref/seek/pcm_f32be.au.ref b/tests/ref/seek/pcm_f32be.au.ref
deleted file mode 100644
index 886356a..0000000
--- a/tests/ref/seek/pcm_f32be.au.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 668288 size:  8192
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 278152 size:  8192
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 909072 size:  8192
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 518936 size:  8192
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 128800 size:  8192
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 759720 size:  8192
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 369584 size:  8192
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:1000504 size:  8192
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 610368 size:  8192
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 220232 size:  8192
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 851152 size:  8192
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 461016 size:  8192
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  70880 size:  8192
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 701808 size:  8192
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 311664 size:  8192
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 942592 size:  8192
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 552456 size:  8192
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 162312 size:  8192
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size:  8192
diff --git a/tests/ref/seek/pcm_f32le.wav.ref b/tests/ref/seek/pcm_f32le.wav.ref
deleted file mode 100644
index 335a8a0..0000000
--- a/tests/ref/seek/pcm_f32le.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 668344 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 278208 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 909128 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 518992 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 128856 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 759776 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 369640 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:1000560 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 610424 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 220288 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 851208 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 461072 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  70936 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 701864 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 311720 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 942648 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 552512 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 162368 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
diff --git a/tests/ref/seek/pcm_f64be.au.ref b/tests/ref/seek/pcm_f64be.au.ref
deleted file mode 100644
index 9be3b4e..0000000
--- a/tests/ref/seek/pcm_f64be.au.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos:1336552 size: 16384
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 556280 size: 16384
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos:1818120 size: 16384
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:1037848 size: 16384
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 257576 size: 16384
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos:1519416 size: 16384
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 739144 size: 16384
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:2000984 size: 16384
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:1220712 size: 16384
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 440440 size: 16384
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos:1702280 size: 16384
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 922008 size: 16384
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 141736 size: 16384
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos:1403592 size: 16384
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 623304 size: 16384
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos:1885160 size: 16384
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos:1104888 size: 16384
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 324600 size: 16384
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     24 size: 16384
diff --git a/tests/ref/seek/pcm_f64le.wav.ref b/tests/ref/seek/pcm_f64le.wav.ref
deleted file mode 100644
index 41eeda0..0000000
--- a/tests/ref/seek/pcm_f64le.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos:1336608 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 556336 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos:1818176 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos:1037904 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 257632 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos:1519472 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 739200 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:2001040 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:1220768 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 440496 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos:1702336 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 922064 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos: 141792 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos:1403648 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 623360 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos:1885216 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos:1104944 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 324656 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     80 size:  4096
diff --git a/tests/ref/seek/pcm_mulaw.wav.ref b/tests/ref/seek/pcm_mulaw.wav.ref
deleted file mode 100644
index 06f50e7..0000000
--- a/tests/ref/seek/pcm_mulaw.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894127 pts: 1.894127 pos:  30362 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788367 pts: 0.788367 pos:  12670 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576757 pts: 2.576757 pos:  41284 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470748 pts: 1.470748 pos:  23588 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365125 pts: 0.365125 pos:   5898 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153379 pts: 2.153379 pos:  34510 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos:  16816 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos:  45428 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:  27736 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624127 pts: 0.624127 pos:  10042 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412381 pts: 2.412381 pos:  38654 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306757 pts: 1.306757 pos:  20964 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200748 pts: 0.200748 pos:   3268 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989116 pts: 1.989116 pos:  31882 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883379 pts: 0.883379 pos:  14190 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671746 pts: 2.671746 pos:  42804 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565760 pts: 1.565760 pos:  25108 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:   7416 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
diff --git a/tests/ref/seek/pcm_s16be.mkv.ref b/tests/ref/seek/pcm_s16be.mkv.ref
deleted file mode 100644
index 8889c42..0000000
--- a/tests/ref/seek/pcm_s16be.mkv.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.881000 pts: 1.881000 pos: 332755 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.789000 pts: 0.789000 pos: 139914 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.577000 pts: 2.577000 pos: 455845 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.463000 pts: 1.463000 pos: 258901 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:  66060 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.159000 pts: 2.159000 pos: 381991 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.045000 pts: 1.045000 pos: 185047 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 2.833000 pts: 2.833000 pos: 500978 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.741000 pts: 1.741000 pos: 308137 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.604000 pts: 0.604000 pos: 107090 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 2.392000 pts: 2.392000 pos: 423021 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.324000 pts: 1.324000 pos: 234283 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:  33236 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.974000 pts: 1.974000 pos: 349167 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.906000 pts: 0.906000 pos: 160429 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 476360 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.556000 pts: 1.556000 pos: 275313 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos:  82472 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
diff --git a/tests/ref/seek/pcm_s16be.mov.ref b/tests/ref/seek/pcm_s16be.mov.ref
deleted file mode 100644
index f6a6be4..0000000
--- a/tests/ref/seek/pcm_s16be.mov.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 331812 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.789478 pts: 0.789478 pos: 139300 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.577415 pts: 2.577415 pos: 454692 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 258084 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos:  65572 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.159456 pts: 2.159456 pos: 380964 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 184356 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.832834 pts: 2.832834 pos: 499748 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.741497 pts: 1.741497 pos: 307236 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.603719 pts: 0.603719 pos: 106532 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.391655 pts: 2.391655 pos: 421924 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.323537 pts: 1.323537 pos: 233508 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos:  32804 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.973696 pts: 1.973696 pos: 348196 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.905578 pts: 0.905578 pos: 159780 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.693515 pts: 2.693515 pos: 475172 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.555737 pts: 1.555737 pos: 274468 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464399 pts: 0.464399 pos:  81956 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  4096
diff --git a/tests/ref/seek/pcm_s16le.mkv.ref b/tests/ref/seek/pcm_s16le.mkv.ref
deleted file mode 100644
index 8889c42..0000000
--- a/tests/ref/seek/pcm_s16le.mkv.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.881000 pts: 1.881000 pos: 332755 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.789000 pts: 0.789000 pos: 139914 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.577000 pts: 2.577000 pos: 455845 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.463000 pts: 1.463000 pos: 258901 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.372000 pts: 0.372000 pos:  66060 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.159000 pts: 2.159000 pos: 381991 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.045000 pts: 1.045000 pos: 185047 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 2.833000 pts: 2.833000 pos: 500978 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.741000 pts: 1.741000 pos: 308137 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.604000 pts: 0.604000 pos: 107090 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 2.392000 pts: 2.392000 pos: 423021 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.324000 pts: 1.324000 pos: 234283 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos:  33236 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.974000 pts: 1.974000 pos: 349167 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.906000 pts: 0.906000 pos: 160429 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 2.694000 pts: 2.694000 pos: 476360 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.556000 pts: 1.556000 pos: 275313 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464000 pts: 0.464000 pos:  82472 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    412 size:  4096
diff --git a/tests/ref/seek/pcm_s16le.wav.ref b/tests/ref/seek/pcm_s16le.wav.ref
deleted file mode 100644
index 41acc98..0000000
--- a/tests/ref/seek/pcm_s16le.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 334176 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 139108 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 454568 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 259500 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos:  64432 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 379892 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 184824 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos: 500284 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 305216 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 110148 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 425608 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 230540 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  35472 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 350936 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 155864 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 471328 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 276260 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:  81188 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
diff --git a/tests/ref/seek/pcm_s24be.mov.ref b/tests/ref/seek/pcm_s24be.mov.ref
deleted file mode 100644
index ef22082..0000000
--- a/tests/ref/seek/pcm_s24be.mov.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 497700 size:  6144
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.789478 pts: 0.789478 pos: 208932 size:  6144
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.577415 pts: 2.577415 pos: 682020 size:  6144
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 387108 size:  6144
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos:  98340 size:  6144
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.159456 pts: 2.159456 pos: 571428 size:  6144
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 276516 size:  6144
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.832834 pts: 2.832834 pos: 749604 size:  6144
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.741497 pts: 1.741497 pos: 460836 size:  6144
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.603719 pts: 0.603719 pos: 159780 size:  6144
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.391655 pts: 2.391655 pos: 632868 size:  6144
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.323537 pts: 1.323537 pos: 350244 size:  6144
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos:  49188 size:  6144
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.973696 pts: 1.973696 pos: 522276 size:  6144
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.905578 pts: 0.905578 pos: 239652 size:  6144
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.693515 pts: 2.693515 pos: 712740 size:  6144
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.555737 pts: 1.555737 pos: 411684 size:  6144
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464399 pts: 0.464399 pos: 122916 size:  6144
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  6144
diff --git a/tests/ref/seek/pcm_s24daud.302.ref b/tests/ref/seek/pcm_s24daud.302.ref
deleted file mode 100644
index 5c9b6d9..0000000
--- a/tests/ref/seek/pcm_s24daud.302.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:      4 size: 39816
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.788333
-ret:-1         st: 0 flags:1  ts:-0.317500
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.365000
-ret:-1         st: 0 flags:1  ts:-0.740833
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.058333
-ret:-1         st: 0 flags:1  ts: 2.835833
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.481667
-ret:-1         st: 0 flags:1  ts: 2.412500
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.904989
-ret:-1         st: 0 flags:1  ts: 1.989178
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.671678
-ret:-1         st: 0 flags:1  ts: 1.565844
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/pcm_s24le.wav.ref b/tests/ref/seek/pcm_s24le.wav.ref
deleted file mode 100644
index c6a37f8..0000000
--- a/tests/ref/seek/pcm_s24le.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 501266 size:  4092
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 208664 size:  4092
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 681854 size:  4092
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 389252 size:  4092
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos:  96650 size:  4092
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 569840 size:  4092
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 277238 size:  4092
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos: 750428 size:  4092
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 457826 size:  4092
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 165224 size:  4092
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 638414 size:  4092
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 345812 size:  4092
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  53210 size:  4092
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 526406 size:  4092
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 233798 size:  4092
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 706994 size:  4092
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 414392 size:  4092
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 121784 size:  4092
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4092
diff --git a/tests/ref/seek/pcm_s32be.mov.ref b/tests/ref/seek/pcm_s32be.mov.ref
deleted file mode 100644
index 6aed744..0000000
--- a/tests/ref/seek/pcm_s32be.mov.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 663588 size:  8192
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.789478 pts: 0.789478 pos: 278564 size:  8192
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.577415 pts: 2.577415 pos: 909348 size:  8192
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 516132 size:  8192
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos: 131108 size:  8192
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.159456 pts: 2.159456 pos: 761892 size:  8192
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 368676 size:  8192
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.832834 pts: 2.832834 pos: 999460 size:  8192
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.741497 pts: 1.741497 pos: 614436 size:  8192
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.603719 pts: 0.603719 pos: 213028 size:  8192
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.391655 pts: 2.391655 pos: 843812 size:  8192
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.323537 pts: 1.323537 pos: 466980 size:  8192
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos:  65572 size:  8192
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.973696 pts: 1.973696 pos: 696356 size:  8192
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.905578 pts: 0.905578 pos: 319524 size:  8192
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.693515 pts: 2.693515 pos: 950308 size:  8192
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.555737 pts: 1.555737 pos: 548900 size:  8192
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464399 pts: 0.464399 pos: 163876 size:  8192
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  8192
diff --git a/tests/ref/seek/pcm_s32le.wav.ref b/tests/ref/seek/pcm_s32le.wav.ref
deleted file mode 100644
index df85b2d..0000000
--- a/tests/ref/seek/pcm_s32le.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 668332 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos: 278196 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 909116 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 518980 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos: 128844 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 759764 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos: 369628 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos:1000548 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 610412 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos: 220276 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 851196 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 461060 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  70924 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 701852 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos: 311708 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 942636 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 552500 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos: 162356 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     68 size:  4096
diff --git a/tests/ref/seek/pcm_s8.mov.ref b/tests/ref/seek/pcm_s8.mov.ref
deleted file mode 100644
index b119e2e..0000000
--- a/tests/ref/seek/pcm_s8.mov.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 165924 size:  2048
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.789478 pts: 0.789478 pos:  69668 size:  2048
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.577415 pts: 2.577415 pos: 227364 size:  2048
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 129060 size:  2048
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.371519 pts: 0.371519 pos:  32804 size:  2048
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.159456 pts: 2.159456 pos: 190500 size:  2048
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos:  92196 size:  2048
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.832834 pts: 2.832834 pos: 249892 size:  2048
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.741497 pts: 1.741497 pos: 153636 size:  2048
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.603719 pts: 0.603719 pos:  53284 size:  2048
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.391655 pts: 2.391655 pos: 210980 size:  2048
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.323537 pts: 1.323537 pos: 116772 size:  2048
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.185760 pts: 0.185760 pos:  16420 size:  2048
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.973696 pts: 1.973696 pos: 174116 size:  2048
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.905578 pts: 0.905578 pos:  79908 size:  2048
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.693515 pts: 2.693515 pos: 237604 size:  2048
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.555737 pts: 1.555737 pos: 137252 size:  2048
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.464399 pts: 0.464399 pos:  40996 size:  2048
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size:  2048
diff --git a/tests/ref/seek/pcm_u8.wav.ref b/tests/ref/seek/pcm_u8.wav.ref
deleted file mode 100644
index afa3351..0000000
--- a/tests/ref/seek/pcm_u8.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894172 pts: 1.894172 pos: 167110 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788345 pts: 0.788345 pos:  69576 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576667 pts: 2.576667 pos: 227306 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470839 pts: 1.470839 pos: 129772 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365011 pts: 0.365011 pos:  32238 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153333 pts: 2.153333 pos: 189968 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos:  92434 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835828 pts: 2.835828 pos: 250164 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos: 152630 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624172 pts: 0.624172 pos:  55096 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412494 pts: 2.412494 pos: 212826 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306667 pts: 1.306667 pos: 115292 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200839 pts: 0.200839 pos:  17758 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989184 pts: 1.989184 pos: 175490 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883333 pts: 0.883333 pos:  77954 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671678 pts: 2.671678 pos: 235686 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565850 pts: 1.565850 pos: 138152 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:  40616 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     44 size:  4096
diff --git a/tests/ref/seek/pcm_zork.wav.ref b/tests/ref/seek/pcm_zork.wav.ref
deleted file mode 100644
index 06f50e7..0000000
--- a/tests/ref/seek/pcm_zork.wav.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.894127 pts: 1.894127 pos:  30362 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.788345
-ret: 0         st: 0 flags:1 dts: 0.788367 pts: 0.788367 pos:  12670 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.317506
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 2.576757 pts: 2.576757 pos:  41284 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.470748 pts: 1.470748 pos:  23588 size:  4096
-ret: 0         st: 0 flags:0  ts: 0.365011
-ret: 0         st: 0 flags:1 dts: 0.365125 pts: 0.365125 pos:   5898 size:  4096
-ret: 0         st: 0 flags:1  ts:-0.740839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 2.153379 pts: 2.153379 pos:  34510 size:  4096
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.047506 pts: 1.047506 pos:  16816 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.058322
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret: 0         st: 0 flags:1 dts: 2.835760 pts: 2.835760 pos:  45428 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.730000 pts: 1.730000 pos:  27736 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.624127 pts: 0.624127 pos:  10042 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.481655
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret: 0         st: 0 flags:1 dts: 2.412381 pts: 2.412381 pos:  38654 size:  4096
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.306757 pts: 1.306757 pos:  20964 size:  4096
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200748 pts: 0.200748 pos:   3268 size:  4096
-ret: 0         st: 0 flags:0  ts:-0.904989
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret: 0         st: 0 flags:1 dts: 1.989116 pts: 1.989116 pos:  31882 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.883379 pts: 0.883379 pos:  14190 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: 2.671746 pts: 2.671746 pos:  42804 size:  4096
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret: 0         st: 0 flags:1 dts: 1.565760 pts: 1.565760 pos:  25108 size:  4096
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.460000 pts: 0.460000 pos:   7416 size:  4096
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     56 size:  4096
diff --git a/tests/ref/seek/pgmpipe.pgm.ref b/tests/ref/seek/pgmpipe.pgm.ref
deleted file mode 100644
index 8ba5180..0000000
--- a/tests/ref/seek/pgmpipe.pgm.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:2534775
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/ppmpipe.ppm.ref b/tests/ref/seek/ppmpipe.ppm.ref
deleted file mode 100644
index 46c535a..0000000
--- a/tests/ref/seek/ppmpipe.ppm.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size:7603575
-ret:-EINVAL    st:-1 flags:0  ts:-1.000000
-ret:-EINVAL    st:-1 flags:1  ts: 1.894167
-ret:-EINVAL    st: 0 flags:0  ts: 0.800000
-ret:-EINVAL    st: 0 flags:1  ts:-0.320000
-ret:-EINVAL    st:-1 flags:0  ts: 2.576668
-ret:-EINVAL    st:-1 flags:1  ts: 1.470835
-ret:-EINVAL    st: 0 flags:0  ts: 0.360000
-ret:-EINVAL    st: 0 flags:1  ts:-0.760000
-ret:-EINVAL    st:-1 flags:0  ts: 2.153336
-ret:-EINVAL    st:-1 flags:1  ts: 1.047503
-ret:-EINVAL    st: 0 flags:0  ts:-0.040000
-ret:-EINVAL    st: 0 flags:1  ts: 2.840000
-ret:-EINVAL    st:-1 flags:0  ts: 1.730004
-ret:-EINVAL    st:-1 flags:1  ts: 0.624171
-ret:-EINVAL    st: 0 flags:0  ts:-0.480000
-ret:-EINVAL    st: 0 flags:1  ts: 2.400000
-ret:-EINVAL    st:-1 flags:0  ts: 1.306672
-ret:-EINVAL    st:-1 flags:1  ts: 0.200839
-ret:-EINVAL    st: 0 flags:0  ts:-0.920000
-ret:-EINVAL    st: 0 flags:1  ts: 2.000000
-ret:-EINVAL    st:-1 flags:0  ts: 0.883340
-ret:-EINVAL    st:-1 flags:1  ts:-0.222493
-ret:-EINVAL    st: 0 flags:0  ts: 2.680000
-ret:-EINVAL    st: 0 flags:1  ts: 1.560000
-ret:-EINVAL    st:-1 flags:0  ts: 0.460008
-ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/roqav.roq.ref b/tests/ref/seek/roqav.roq.ref
deleted file mode 100644
index d003a37..0000000
--- a/tests/ref/seek/roqav.roq.ref
+++ /dev/null
@@ -1,27 +0,0 @@
-ret: 0         st: 0 flags:0 dts: 0.000000 pts: 0.000000 pos:     24 size: 26082
-ret:-1         st:-1 flags:0  ts:-1.000000
-ret:-1         st:-1 flags:1  ts: 1.894167
-ret:-1         st: 0 flags:0  ts: 0.800000
-ret:-1         st: 0 flags:1  ts:-0.333333
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret:-1         st:-1 flags:1  ts: 1.470835
-ret:-1         st: 0 flags:0  ts: 0.366667
-ret:-1         st: 0 flags:1  ts:-0.733333
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret:-1         st:-1 flags:1  ts: 1.047503
-ret:-1         st: 0 flags:0  ts:-0.066667
-ret:-1         st: 0 flags:1  ts: 2.833333
-ret:-1         st:-1 flags:0  ts: 1.730004
-ret:-1         st:-1 flags:1  ts: 0.624171
-ret:-1         st: 0 flags:0  ts:-0.466667
-ret:-1         st: 0 flags:1  ts: 2.400000
-ret:-1         st:-1 flags:0  ts: 1.306672
-ret:-1         st:-1 flags:1  ts: 0.200839
-ret:-1         st: 0 flags:0  ts:-0.900000
-ret:-1         st: 0 flags:1  ts: 2.000000
-ret:-1         st:-1 flags:0  ts: 0.883340
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.666667
-ret:-1         st: 0 flags:1  ts: 1.566667
-ret:-1         st:-1 flags:0  ts: 0.460008
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/rv10.rm.ref b/tests/ref/seek/rv10.rm.ref
deleted file mode 100644
index 123b03c..0000000
--- a/tests/ref/seek/rv10.rm.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  98608 size: 12303
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  61592 size: 11135
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139556 size: 12738
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  98608 size: 12303
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  31132 size: 10097
-ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139556 size: 12738
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  61592 size: 11135
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139556 size: 12738
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139556 size: 12738
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  31132 size: 10097
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139556 size: 12738
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  98608 size: 12303
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139556 size: 12738
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  61592 size: 11135
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
-ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 139556 size: 12738
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  98608 size: 12303
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  31132 size: 10097
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size: 10388
diff --git a/tests/ref/seek/rv20.rm.ref b/tests/ref/seek/rv20.rm.ref
deleted file mode 100644
index 5b5cb41..0000000
--- a/tests/ref/seek/rv20.rm.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  84320 size: 11344
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  53061 size: 10166
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  84320 size: 11344
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  25990 size:  9101
-ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  53061 size: 10166
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  25990 size:  9101
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  84320 size: 11344
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  53061 size: 10166
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
-ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 119008 size: 11803
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  84320 size: 11344
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  25990 size:  9101
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    239 size:  9361
diff --git a/tests/ref/seek/snow.avi.ref b/tests/ref/seek/snow.avi.ref
deleted file mode 100644
index 39f8ac8..0000000
--- a/tests/ref/seek/snow.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  3035
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  3035
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  39726 size:  3640
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  27446 size:  3494
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  39726 size:  3640
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  16136 size:  3244
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  27446 size:  3494
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  3035
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:  52616 size:  3582
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:  52616 size:  3582
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  16136 size:  3244
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  3035
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:  52616 size:  3582
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  39726 size:  3640
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  3035
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  3035
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:  52616 size:  3582
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  27446 size:  3494
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  39726 size:  3640
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  16136 size:  3244
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/snow53.avi.ref b/tests/ref/seek/snow53.avi.ref
deleted file mode 100644
index 5eb0ba0..0000000
--- a/tests/ref/seek/snow53.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 72476
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 72476
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239102 size: 74994
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605640 size: 71059
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239102 size: 74994
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 72476
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605640 size: 71059
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 72476
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 72476
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size: 72476
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:2585626 size: 79731
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1239102 size: 74994
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:1902800 size: 78837
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 605640 size: 71059
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/svq1.mov.ref b/tests/ref/seek/svq1.mov.ref
deleted file mode 100644
index 17bb99e..0000000
--- a/tests/ref/seek/svq1.mov.ref
+++ /dev/null
@@ -1,50 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517568 size: 25636
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326556 size: 23552
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517568 size: 25636
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157040 size: 21896
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326556 size: 23552
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157040 size: 21896
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517568 size: 25636
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326556 size: 23552
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517568 size: 25636
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157040 size: 21896
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
diff --git a/tests/ref/seek/wmav1.asf.ref b/tests/ref/seek/wmav1.asf.ref
deleted file mode 100644
index a2892b6..0000000
--- a/tests/ref/seek/wmav1.asf.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 3.286000 pts: 3.286000 pos:   3604 size:   743
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    404 size:   743
diff --git a/tests/ref/seek/wmav2.asf.ref b/tests/ref/seek/wmav2.asf.ref
deleted file mode 100644
index bd1b79e..0000000
--- a/tests/ref/seek/wmav2.asf.ref
+++ /dev/null
@@ -1,53 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 3.286000 pts: 3.286000 pos:   3644 size:   743
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:0  ts: 0.788000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:1  ts:-0.317000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:1  ts:-0.741000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:0  ts:-0.058000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:1  ts: 2.836000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:0  ts:-0.482000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:1  ts: 2.413000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:0  ts:-0.905000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:1  ts: 1.989000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:0  ts: 2.672000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st: 0 flags:1  ts: 1.566000
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 3.100000 pts: 3.100000 pos:    444 size:   743
diff --git a/tests/ref/seek/wmv1.avi.ref b/tests/ref/seek/wmv1.avi.ref
deleted file mode 100644
index 8739c96..0000000
--- a/tests/ref/seek/wmv1.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8990
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8990
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83754 size: 11099
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54770 size:  9931
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83754 size: 11099
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29806 size:  8796
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54770 size:  9931
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8990
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29806 size:  8796
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8990
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83754 size: 11099
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8990
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5660 size:  8990
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 115824 size: 11487
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54770 size:  9931
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83754 size: 11099
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29806 size:  8796
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/wmv2.avi.ref b/tests/ref/seek/wmv2.avi.ref
deleted file mode 100644
index ca01a39..0000000
--- a/tests/ref/seek/wmv2.avi.ref
+++ /dev/null
@@ -1,46 +0,0 @@
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5664 size:  8917
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5664 size:  8917
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83802 size: 11170
-ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54584 size:  9989
-ret:-1         st: 0 flags:1  ts:-0.320000
-ret:-1         st:-1 flags:0  ts: 2.576668
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83802 size: 11170
-ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29644 size:  8839
-ret:-1         st: 0 flags:1  ts:-0.760000
-ret:-1         st:-1 flags:0  ts: 2.153336
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54584 size:  9989
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5664 size:  8917
-ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29644 size:  8839
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5664 size:  8917
-ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83802 size: 11170
-ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5664 size:  8917
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5664 size:  8917
-ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 116070 size: 11554
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:  54584 size:  9989
-ret:-1         st:-1 flags:1  ts:-0.222493
-ret:-1         st: 0 flags:0  ts: 2.680000
-ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:  83802 size: 11170
-ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:  29644 size:  8839
-ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/vsynth1/asv1 b/tests/ref/vsynth1/asv1
deleted file mode 100644
index 15ba70b..0000000
--- a/tests/ref/vsynth1/asv1
+++ /dev/null
@@ -1,4 +0,0 @@
-b4ce4698764ef2328346badb7227ecbe *./tests/data/vsynth1/asv1.avi
-1489656 ./tests/data/vsynth1/asv1.avi
-2dfc5dfc2c1cbbc2543257cd3d2df6af *./tests/data/asv1.vsynth1.out.yuv
-stddev:   20.00 PSNR: 22.11 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/asv2 b/tests/ref/vsynth1/asv2
deleted file mode 100644
index 4ac42e1..0000000
--- a/tests/ref/vsynth1/asv2
+++ /dev/null
@@ -1,4 +0,0 @@
-dfba6eaf58e515e324c2b370bfcd9158 *./tests/data/vsynth1/asv2.avi
-1456056 ./tests/data/vsynth1/asv2.avi
-d451be09793cd0f35b6d91fc36e2571a *./tests/data/asv2.vsynth1.out.yuv
-stddev:   18.82 PSNR: 22.63 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/dnxhd_1080i b/tests/ref/vsynth1/dnxhd_1080i
deleted file mode 100644
index 7429b7d..0000000
--- a/tests/ref/vsynth1/dnxhd_1080i
+++ /dev/null
@@ -1,4 +0,0 @@
-cd1489f18d2186a49ab23c61ed33bce7 *./tests/data/vsynth1/dnxhd-1080i.mov
-3031875 ./tests/data/vsynth1/dnxhd-1080i.mov
-0c651e840f860592f0d5b66030d9fa32 *./tests/data/dnxhd_1080i.vsynth1.out.yuv
-stddev:    6.29 PSNR: 32.15 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth1/dnxhd_720p b/tests/ref/vsynth1/dnxhd_720p
deleted file mode 100644
index 490a9ea..0000000
--- a/tests/ref/vsynth1/dnxhd_720p
+++ /dev/null
@@ -1,4 +0,0 @@
-81f5be451dc18cf8a1d333c7885de60b *./tests/data/vsynth1/dnxhd-720p.dnxhd
-2293760 ./tests/data/vsynth1/dnxhd-720p.dnxhd
-94b21e5e68ccf9471eff74afd0ebe319 *./tests/data/dnxhd_720p.vsynth1.out.yuv
-stddev:    6.32 PSNR: 32.11 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth1/dnxhd_720p_rd b/tests/ref/vsynth1/dnxhd_720p_rd
deleted file mode 100644
index f18ae2d..0000000
--- a/tests/ref/vsynth1/dnxhd_720p_rd
+++ /dev/null
@@ -1,4 +0,0 @@
-1dc6e95925c4f3a230848ec17c02abed *./tests/data/vsynth1/dnxhd-720p-rd.dnxhd
-2293760 ./tests/data/vsynth1/dnxhd-720p-rd.dnxhd
-02972d2aec120ec1577ec9053d68ae0f *./tests/data/dnxhd_720p_rd.vsynth1.out.yuv
-stddev:    6.26 PSNR: 32.19 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth1/dv b/tests/ref/vsynth1/dv
deleted file mode 100644
index 7b6f1f9..0000000
--- a/tests/ref/vsynth1/dv
+++ /dev/null
@@ -1,8 +0,0 @@
-27ade3031b17214cf81c19cbf70f37d7 *./tests/data/vsynth1/dv.dv
-7200000 ./tests/data/vsynth1/dv.dv
-02ac7cdeab91d4d5621e7ce96dddc498 *./tests/data/dv.vsynth1.out.yuv
-stddev:    6.90 PSNR: 31.34 bytes:  7603200/  7603200
-bd67f2431db160d4bb6dcd791cea6efd *./tests/data/vsynth1/dv411.dv
-7200000 ./tests/data/vsynth1/dv411.dv
-b6640a3a572353f51284acb746eb00c4 *./tests/data/dv.vsynth1.out.yuv
-stddev:   30.76 PSNR: 18.37 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/dv50 b/tests/ref/vsynth1/dv50
deleted file mode 100644
index 1e6454d..0000000
--- a/tests/ref/vsynth1/dv50
+++ /dev/null
@@ -1,4 +0,0 @@
-26dba84f0ea895b914ef5b333d8394ac *./tests/data/vsynth1/dv50.dv
-14400000 ./tests/data/vsynth1/dv50.dv
-a2ff093e93ffed10f730fa21df02fc50 *./tests/data/dv50.vsynth1.out.yuv
-stddev:    1.72 PSNR: 43.38 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/error b/tests/ref/vsynth1/error
deleted file mode 100644
index 6b8a49e..0000000
--- a/tests/ref/vsynth1/error
+++ /dev/null
@@ -1,4 +0,0 @@
-7416dfd319f04044d4575dc9d1b406e1 *./tests/data/vsynth1/error-mpeg4-adv.avi
-756836 ./tests/data/vsynth1/error-mpeg4-adv.avi
-ef8bfcd6e0883daba95d0f32486ebe2d *./tests/data/error.vsynth1.out.yuv
-stddev:   18.05 PSNR: 23.00 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/ffv1 b/tests/ref/vsynth1/ffv1
deleted file mode 100644
index e888d96..0000000
--- a/tests/ref/vsynth1/ffv1
+++ /dev/null
@@ -1,4 +0,0 @@
-67ddc7edde5cca49290245d881787890 *./tests/data/vsynth1/ffv1.avi
-2655376 ./tests/data/vsynth1/ffv1.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/ffv1.vsynth1.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/flashsv b/tests/ref/vsynth1/flashsv
deleted file mode 100644
index 6d76e9a..0000000
--- a/tests/ref/vsynth1/flashsv
+++ /dev/null
@@ -1,4 +0,0 @@
-97894502b4cb57aca1105b6333f72dae *./tests/data/vsynth1/flashsv.flv
-14681925 ./tests/data/vsynth1/flashsv.flv
-947cb24ec45a453348ae6fe3fa278071 *./tests/data/flashsv.vsynth1.out.yuv
-stddev:    2.85 PSNR: 39.03 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/flv b/tests/ref/vsynth1/flv
deleted file mode 100644
index 04e22eb..0000000
--- a/tests/ref/vsynth1/flv
+++ /dev/null
@@ -1,4 +0,0 @@
-d6a80659cedee7698aefe9c4a8285fa4 *./tests/data/vsynth1/flv.flv
-636269 ./tests/data/vsynth1/flv.flv
-5ab46d8dd01dbb1d63df2a84858a4b05 *./tests/data/flv.vsynth1.out.yuv
-stddev:    8.02 PSNR: 30.04 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/h261 b/tests/ref/vsynth1/h261
deleted file mode 100644
index 2be9855..0000000
--- a/tests/ref/vsynth1/h261
+++ /dev/null
@@ -1,4 +0,0 @@
-d155470b713aeebacb85980b0d5f2ce3 *./tests/data/vsynth1/h261.avi
-707588 ./tests/data/vsynth1/h261.avi
-716e83cb51afb1246bfaa80967df48ea *./tests/data/h261.vsynth1.out.yuv
-stddev:    9.11 PSNR: 28.93 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/h263 b/tests/ref/vsynth1/h263
deleted file mode 100644
index 5703029..0000000
--- a/tests/ref/vsynth1/h263
+++ /dev/null
@@ -1,4 +0,0 @@
-fb4dc9b9eac2628c56cb82cf332e1f58 *./tests/data/vsynth1/h263.avi
-659686 ./tests/data/vsynth1/h263.avi
-1a1ba9a3a63ec1a1a9585fded0a7c954 *./tests/data/h263.vsynth1.out.yuv
-stddev:    8.03 PSNR: 30.03 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/h263p b/tests/ref/vsynth1/h263p
deleted file mode 100644
index 6ca658f..0000000
--- a/tests/ref/vsynth1/h263p
+++ /dev/null
@@ -1,4 +0,0 @@
-bbcadeceba295e1dad148aea1e57c370 *./tests/data/vsynth1/h263p.avi
-2328348 ./tests/data/vsynth1/h263p.avi
-9554cda00c3487ab3ffda2c3ea22fa2f *./tests/data/h263p.vsynth1.out.yuv
-stddev:    2.06 PSNR: 41.83 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/huffyuv b/tests/ref/vsynth1/huffyuv
deleted file mode 100644
index f84eee4..0000000
--- a/tests/ref/vsynth1/huffyuv
+++ /dev/null
@@ -1,4 +0,0 @@
-ace2536fa169d835d0fb332abde28d51 *./tests/data/vsynth1/huffyuv.avi
-7933800 ./tests/data/vsynth1/huffyuv.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/huffyuv.vsynth1.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/jpegls b/tests/ref/vsynth1/jpegls
deleted file mode 100644
index 4e26ec6..0000000
--- a/tests/ref/vsynth1/jpegls
+++ /dev/null
@@ -1,4 +0,0 @@
-519e26bb1ac0f3db8f90b36537f2f760 *./tests/data/vsynth1/jpegls.avi
-9089812 ./tests/data/vsynth1/jpegls.avi
-947cb24ec45a453348ae6fe3fa278071 *./tests/data/jpegls.vsynth1.out.yuv
-stddev:    2.85 PSNR: 39.03 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/ljpeg b/tests/ref/vsynth1/ljpeg
deleted file mode 100644
index 3202bfc..0000000
--- a/tests/ref/vsynth1/ljpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-9092f306f165b98ab0bb4f576f198ad5 *./tests/data/vsynth1/ljpeg.avi
-6312936 ./tests/data/vsynth1/ljpeg.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/ljpeg.vsynth1.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mjpeg b/tests/ref/vsynth1/mjpeg
deleted file mode 100644
index fe54d6f..0000000
--- a/tests/ref/vsynth1/mjpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-8bbf9513b1822945539f27a6eff3c7fa *./tests/data/vsynth1/mjpeg.avi
-1516140 ./tests/data/vsynth1/mjpeg.avi
-c6ae81b5b896e4d05ff584311aebdb18 *./tests/data/mjpeg.vsynth1.out.yuv
-stddev:    7.87 PSNR: 30.21 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg b/tests/ref/vsynth1/mpeg
deleted file mode 100644
index 882486b..0000000
--- a/tests/ref/vsynth1/mpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-1428744c6d5835f27506e69be4f837f4 *./tests/data/vsynth1/mpeg1.mpg
-712006 ./tests/data/vsynth1/mpeg1.mpg
-58f0c332bf689117b57fa629a2bc0d2b *./tests/data/mpeg.vsynth1.out.yuv
-stddev:    7.62 PSNR: 30.48 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg1b b/tests/ref/vsynth1/mpeg1b
deleted file mode 100644
index 913515e..0000000
--- a/tests/ref/vsynth1/mpeg1b
+++ /dev/null
@@ -1,4 +0,0 @@
-777639666b449ab0a7ef260511e40532 *./tests/data/vsynth1/mpeg1b.mpg
-1030337 ./tests/data/vsynth1/mpeg1b.mpg
-91a7fce732b34748e7bf753ebabe2483 *./tests/data/mpeg1b.vsynth1.out.yuv
-stddev:    6.30 PSNR: 32.13 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg2 b/tests/ref/vsynth1/mpeg2
deleted file mode 100644
index 7269080..0000000
--- a/tests/ref/vsynth1/mpeg2
+++ /dev/null
@@ -1,20 +0,0 @@
-fbddea2368cd2028fc8db4dfd4682e94 *./tests/data/vsynth1/mpeg2.mpg
-728044 ./tests/data/vsynth1/mpeg2.mpg
-b41ca49c1a02e66ce64d262e2cdaec15 *./tests/data/mpeg2.vsynth1.out.yuv
-stddev:    7.65 PSNR: 30.45 bytes:  7603200/  7603200
-8f6b20714918e6443e0c03716ed06f0d *./tests/data/vsynth1/mpeg2ivlc-qprd.mpg
-783552 ./tests/data/vsynth1/mpeg2ivlc-qprd.mpg
-98eb9da15f880978e7f2ee1e7ce476ef *./tests/data/mpeg2.vsynth1.out.yuv
-stddev:   10.07 PSNR: 28.06 bytes:  7603200/  7603200
-af0cb75451aaa807beb5102707a98823 *./tests/data/vsynth1/mpeg2_422.mpg
-728200 ./tests/data/vsynth1/mpeg2_422.mpg
-29b518282493203e83b27a939795dc3a *./tests/data/mpeg2.vsynth1.out.yuv
-stddev:   63.33 PSNR: 12.10 bytes: 10137600/  7603200
-4c067397b504d65532d7779cd36f3f88 *./tests/data/vsynth1/mpeg2.mpg
-725668 ./tests/data/vsynth1/mpeg2.mpg
-9f7b065f98d57cdecf90e6f7a2524eb5 *./tests/data/mpeg2.vsynth1.out.yuv
-stddev:    7.65 PSNR: 30.45 bytes:  7603200/  7603200
-ec3f6713c88a2b41f6c369fd64341077 *./tests/data/vsynth1/mpeg2i.mpg
-737473 ./tests/data/vsynth1/mpeg2i.mpg
-97615390fdd69abfcbc7e02df863a7d2 *./tests/data/mpeg2.vsynth1.out.yuv
-stddev:    7.67 PSNR: 30.43 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg2thread b/tests/ref/vsynth1/mpeg2thread
deleted file mode 100644
index c2e2c4f..0000000
--- a/tests/ref/vsynth1/mpeg2thread
+++ /dev/null
@@ -1,12 +0,0 @@
-ecd183706688bd977c9994c3d1b23d61 *./tests/data/vsynth1/mpeg2thread.mpg
-801313 ./tests/data/vsynth1/mpeg2thread.mpg
-d1658911ca83f5616c1d32abc40750de *./tests/data/mpeg2thread.vsynth1.out.yuv
-stddev:    7.63 PSNR: 30.48 bytes:  7603200/  7603200
-23d600b026222253c2340e23300a4c02 *./tests/data/vsynth1/mpeg2threadivlc.mpg
-791773 ./tests/data/vsynth1/mpeg2threadivlc.mpg
-d1658911ca83f5616c1d32abc40750de *./tests/data/mpeg2thread.vsynth1.out.yuv
-stddev:    7.63 PSNR: 30.48 bytes:  7603200/  7603200
-d119fe917dd81d1ff758b4ce684a8d9d *./tests/data/vsynth1/mpeg2reuse.mpg
-2074636 ./tests/data/vsynth1/mpeg2reuse.mpg
-92ced6afe8c02304943c400cce51a5f4 *./tests/data/mpeg2thread.vsynth1.out.yuv
-stddev:    7.66 PSNR: 30.44 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg4 b/tests/ref/vsynth1/mpeg4
deleted file mode 100644
index 3156fed..0000000
--- a/tests/ref/vsynth1/mpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-fd83f2ef5887a62b4d755d7cb5f0ac59 *./tests/data/vsynth1/odivx.mp4
-540144 ./tests/data/vsynth1/odivx.mp4
-8828a375448dc5c2215163ba70656f89 *./tests/data/mpeg4.vsynth1.out.yuv
-stddev:    7.97 PSNR: 30.10 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg4adv b/tests/ref/vsynth1/mpeg4adv
deleted file mode 100644
index bbd996b..0000000
--- a/tests/ref/vsynth1/mpeg4adv
+++ /dev/null
@@ -1,16 +0,0 @@
-7d8eb01fd68d83d62a98585757704d47 *./tests/data/vsynth1/mpeg4-adv.avi
-589716 ./tests/data/vsynth1/mpeg4-adv.avi
-f8b226876b1b2c0b98fd6928fd9adbd8 *./tests/data/mpeg4adv.vsynth1.out.yuv
-stddev:    6.98 PSNR: 31.25 bytes:  7603200/  7603200
-d6b7e724a6ad66ab5e4c5a499218b40d *./tests/data/vsynth1/mpeg4-qprd.avi
-710944 ./tests/data/vsynth1/mpeg4-qprd.avi
-e65f4c7f343fe2bad1cac44b7da5f7c4 *./tests/data/mpeg4adv.vsynth1.out.yuv
-stddev:    9.79 PSNR: 28.31 bytes:  7603200/  7603200
-2d870c0da9ab2231ab5fc06981e70399 *./tests/data/vsynth1/mpeg4-adap.avi
-403456 ./tests/data/vsynth1/mpeg4-adap.avi
-fa2049396479b5f170aa764fed5b2a31 *./tests/data/mpeg4adv.vsynth1.out.yuv
-stddev:   14.05 PSNR: 25.17 bytes:  7603200/  7603200
-3bf17c3d04f52988386ce106a2a58976 *./tests/data/vsynth1/mpeg4-Q.avi
-860678 ./tests/data/vsynth1/mpeg4-Q.avi
-756928496245ecc701f79eebeec8e5e6 *./tests/data/mpeg4adv.vsynth1.out.yuv
-stddev:    5.63 PSNR: 33.12 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg4nr b/tests/ref/vsynth1/mpeg4nr
deleted file mode 100644
index 24ed8de..0000000
--- a/tests/ref/vsynth1/mpeg4nr
+++ /dev/null
@@ -1,4 +0,0 @@
-c02f54157ba08ca12ad979c6308212ad *./tests/data/vsynth1/mpeg4-nr.avi
-675638 ./tests/data/vsynth1/mpeg4-nr.avi
-d2b89d5958fb7331f6c9e5b7ecaaa5b6 *./tests/data/mpeg4nr.vsynth1.out.yuv
-stddev:    6.99 PSNR: 31.23 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/mpeg4thread b/tests/ref/vsynth1/mpeg4thread
deleted file mode 100644
index d8e06fe..0000000
--- a/tests/ref/vsynth1/mpeg4thread
+++ /dev/null
@@ -1,4 +0,0 @@
-4f4ea04faad7212374919aa1ec7ff994 *./tests/data/vsynth1/mpeg4-thread.avi
-774760 ./tests/data/vsynth1/mpeg4-thread.avi
-64b96cddf5301990e118978b3a3bcd0d *./tests/data/mpeg4thread.vsynth1.out.yuv
-stddev:   10.13 PSNR: 28.02 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/msmpeg4 b/tests/ref/vsynth1/msmpeg4
deleted file mode 100644
index 46b72f1..0000000
--- a/tests/ref/vsynth1/msmpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-d437c6ab3775c50fdec00fa744bb5add *./tests/data/vsynth1/msmpeg4.avi
-624718 ./tests/data/vsynth1/msmpeg4.avi
-5ca72c39e3fc5df8e62f223c869589f5 *./tests/data/msmpeg4.vsynth1.out.yuv
-stddev:    7.98 PSNR: 30.09 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/msmpeg4v2 b/tests/ref/vsynth1/msmpeg4v2
deleted file mode 100644
index 69bd62f..0000000
--- a/tests/ref/vsynth1/msmpeg4v2
+++ /dev/null
@@ -1,4 +0,0 @@
-88957e35efcc718bce0307627ad3298d *./tests/data/vsynth1/msmpeg4v2.avi
-623788 ./tests/data/vsynth1/msmpeg4v2.avi
-c6ff1041a0ef62c2a2e5ef519e5e94c4 *./tests/data/msmpeg4v2.vsynth1.out.yuv
-stddev:    7.97 PSNR: 30.10 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/rc b/tests/ref/vsynth1/rc
deleted file mode 100644
index cf852a8..0000000
--- a/tests/ref/vsynth1/rc
+++ /dev/null
@@ -1,4 +0,0 @@
-1c6dadf75f60f4ba59a0fe0b6eaedf57 *./tests/data/vsynth1/mpeg4-rc.avi
-830160 ./tests/data/vsynth1/mpeg4-rc.avi
-4d95e340db9bc57a559162c039f3784e *./tests/data/rc.vsynth1.out.yuv
-stddev:   10.24 PSNR: 27.92 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/roq b/tests/ref/vsynth1/roq
deleted file mode 100644
index 086ae1c..0000000
--- a/tests/ref/vsynth1/roq
+++ /dev/null
@@ -1,4 +0,0 @@
-cf8b7b0e539bab3169c234ca63d71dd8 *./tests/data/vsynth1/roqav.roq
-101671 ./tests/data/vsynth1/roqav.roq
-0ad983c291b1ed373645c5b12a108c61 *./tests/data/roq.vsynth1.out.yuv
-stddev:    7.74 PSNR: 30.35 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth1/rv10 b/tests/ref/vsynth1/rv10
deleted file mode 100644
index 7cd50d1..0000000
--- a/tests/ref/vsynth1/rv10
+++ /dev/null
@@ -1,4 +0,0 @@
-4d7e82de72a83905cf84b8abc3e70b8f *./tests/data/vsynth1/rv10.rm
-653905 ./tests/data/vsynth1/rv10.rm
-1a1ba9a3a63ec1a1a9585fded0a7c954 *./tests/data/rv10.vsynth1.out.yuv
-stddev:    8.03 PSNR: 30.03 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/rv20 b/tests/ref/vsynth1/rv20
deleted file mode 100644
index d8cc2cc..0000000
--- a/tests/ref/vsynth1/rv20
+++ /dev/null
@@ -1,4 +0,0 @@
-49f656b3a84bd7173ca219fae310750c *./tests/data/vsynth1/rv20.rm
-627450 ./tests/data/vsynth1/rv20.rm
-a94d2babdc506b95951977cb55642981 *./tests/data/rv20.vsynth1.out.yuv
-stddev:    8.24 PSNR: 29.81 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/snow b/tests/ref/vsynth1/snow
deleted file mode 100644
index 9178115..0000000
--- a/tests/ref/vsynth1/snow
+++ /dev/null
@@ -1,4 +0,0 @@
-d593b3c1a9729ce6dd1721f58fa93712 *./tests/data/vsynth1/snow.avi
-136088 ./tests/data/vsynth1/snow.avi
-91021b7d6d7908648fe78cc1975af8c4 *./tests/data/snow.vsynth1.out.yuv
-stddev:   22.77 PSNR: 20.98 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/snowll b/tests/ref/vsynth1/snowll
deleted file mode 100644
index 0246038..0000000
--- a/tests/ref/vsynth1/snowll
+++ /dev/null
@@ -1,4 +0,0 @@
-6d29e8c06a645cdee45073c4f3d0004e *./tests/data/vsynth1/snow53.avi
-3419980 ./tests/data/vsynth1/snow53.avi
-c5ccac874dbf808e9088bc3107860042 *./tests/data/snowll.vsynth1.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/svq1 b/tests/ref/vsynth1/svq1
deleted file mode 100644
index b6c95ea..0000000
--- a/tests/ref/vsynth1/svq1
+++ /dev/null
@@ -1,4 +0,0 @@
-595fc4e38734521356b60e67b813f0fa *./tests/data/vsynth1/svq1.mov
-1334367 ./tests/data/vsynth1/svq1.mov
-9cc35c54b2c77d36bd7e308b393c1f81 *./tests/data/svq1.vsynth1.out.yuv
-stddev:    9.58 PSNR: 28.50 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/wmv1 b/tests/ref/vsynth1/wmv1
deleted file mode 100644
index 891c88b..0000000
--- a/tests/ref/vsynth1/wmv1
+++ /dev/null
@@ -1,4 +0,0 @@
-4f3461315776e5118866fa3819cff9b6 *./tests/data/vsynth1/wmv1.avi
-626908 ./tests/data/vsynth1/wmv1.avi
-5182edba5b5e0354b39ce4f3604b62da *./tests/data/wmv1.vsynth1.out.yuv
-stddev:    7.97 PSNR: 30.09 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth1/wmv2 b/tests/ref/vsynth1/wmv2
deleted file mode 100644
index 2e72290..0000000
--- a/tests/ref/vsynth1/wmv2
+++ /dev/null
@@ -1,4 +0,0 @@
-13efda9d3811345aadc0632fc9a9332b *./tests/data/vsynth1/wmv2.avi
-659852 ./tests/data/vsynth1/wmv2.avi
-5182edba5b5e0354b39ce4f3604b62da *./tests/data/wmv2.vsynth1.out.yuv
-stddev:    7.97 PSNR: 30.09 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/asv1 b/tests/ref/vsynth2/asv1
deleted file mode 100644
index a584645..0000000
--- a/tests/ref/vsynth2/asv1
+++ /dev/null
@@ -1,4 +0,0 @@
-4eb34d2de25f67a2706456e999338fe9 *./tests/data/vsynth2/asv1.avi
-832512 ./tests/data/vsynth2/asv1.avi
-c96ff7fd17c52f99ddb7922a4cb9168f *./tests/data/asv1.vsynth2.out.yuv
-stddev:   10.47 PSNR: 27.73 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/asv2 b/tests/ref/vsynth2/asv2
deleted file mode 100644
index b898420..0000000
--- a/tests/ref/vsynth2/asv2
+++ /dev/null
@@ -1,4 +0,0 @@
-9649a4b68fb1107bad13e8a7574cc72d *./tests/data/vsynth2/asv2.avi
-789072 ./tests/data/vsynth2/asv2.avi
-74a78015b64b2cf8cb9da2e44f508a69 *./tests/data/asv2.vsynth2.out.yuv
-stddev:   10.28 PSNR: 27.89 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/dnxhd_1080i b/tests/ref/vsynth2/dnxhd_1080i
deleted file mode 100644
index 6ab7fbb..0000000
--- a/tests/ref/vsynth2/dnxhd_1080i
+++ /dev/null
@@ -1,4 +0,0 @@
-1a4594983ae91f41907b89fe3174c527 *./tests/data/vsynth2/dnxhd-1080i.mov
-3031875 ./tests/data/vsynth2/dnxhd-1080i.mov
-3c559af629ae0a8fb1a9a0e4b4da7733 *./tests/data/dnxhd_1080i.vsynth2.out.yuv
-stddev:    1.31 PSNR: 45.77 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth2/dnxhd_720p b/tests/ref/vsynth2/dnxhd_720p
deleted file mode 100644
index cbf3f37..0000000
--- a/tests/ref/vsynth2/dnxhd_720p
+++ /dev/null
@@ -1,4 +0,0 @@
-58e07cc6ae0a2d36787044d0e82708a6 *./tests/data/vsynth2/dnxhd-720p.dnxhd
-2293760 ./tests/data/vsynth2/dnxhd-720p.dnxhd
-ab601eaafef74d80d3d20b780dddd836 *./tests/data/dnxhd_720p.vsynth2.out.yuv
-stddev:    1.36 PSNR: 45.45 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth2/dnxhd_720p_rd b/tests/ref/vsynth2/dnxhd_720p_rd
deleted file mode 100644
index e922495..0000000
--- a/tests/ref/vsynth2/dnxhd_720p_rd
+++ /dev/null
@@ -1,4 +0,0 @@
-092ffb7b8cf3c11556bb05dbb8b476ac *./tests/data/vsynth2/dnxhd-720p-rd.dnxhd
-2293760 ./tests/data/vsynth2/dnxhd-720p-rd.dnxhd
-33547ca318acff9448cba719cb99296d *./tests/data/dnxhd_720p_rd.vsynth2.out.yuv
-stddev:    1.32 PSNR: 45.66 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth2/dv b/tests/ref/vsynth2/dv
deleted file mode 100644
index 72e4350..0000000
--- a/tests/ref/vsynth2/dv
+++ /dev/null
@@ -1,8 +0,0 @@
-bfa766f89bfeabc0ae1044f3954bed52 *./tests/data/vsynth2/dv.dv
-7200000 ./tests/data/vsynth2/dv.dv
-7ec62bd3350a6848364669e6e1e4b9cc *./tests/data/dv.vsynth2.out.yuv
-stddev:    1.71 PSNR: 43.47 bytes:  7603200/  7603200
-00a9d8683ac6826af41bcf7223fb0389 *./tests/data/vsynth2/dv411.dv
-7200000 ./tests/data/vsynth2/dv411.dv
-7f9fa421028aabb11eaf4c6513a5a843 *./tests/data/dv.vsynth2.out.yuv
-stddev:   10.09 PSNR: 28.05 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/dv50 b/tests/ref/vsynth2/dv50
deleted file mode 100644
index 79c25a8..0000000
--- a/tests/ref/vsynth2/dv50
+++ /dev/null
@@ -1,4 +0,0 @@
-61e31c79e8949b25c849753a0785b0d7 *./tests/data/vsynth2/dv50.dv
-14400000 ./tests/data/vsynth2/dv50.dv
-af3f2dd5ab62c1a1d98b07d4aeb6852f *./tests/data/dv50.vsynth2.out.yuv
-stddev:    0.82 PSNR: 49.82 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/error b/tests/ref/vsynth2/error
deleted file mode 100644
index b273e00..0000000
--- a/tests/ref/vsynth2/error
+++ /dev/null
@@ -1,4 +0,0 @@
-90e65096aa9ebafa3fe3f44a5a47cdc4 *./tests/data/vsynth2/error-mpeg4-adv.avi
-176588 ./tests/data/vsynth2/error-mpeg4-adv.avi
-9fe1082179f80179439953c7397a46ef *./tests/data/error.vsynth2.out.yuv
-stddev:    9.00 PSNR: 29.04 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/ffv1 b/tests/ref/vsynth2/ffv1
deleted file mode 100644
index f7dd8e9..0000000
--- a/tests/ref/vsynth2/ffv1
+++ /dev/null
@@ -1,4 +0,0 @@
-d72b0960e162d4998b9acbabb07e99ab *./tests/data/vsynth2/ffv1.avi
-3525804 ./tests/data/vsynth2/ffv1.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/ffv1.vsynth2.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/flashsv b/tests/ref/vsynth2/flashsv
deleted file mode 100644
index b5f0bce..0000000
--- a/tests/ref/vsynth2/flashsv
+++ /dev/null
@@ -1,4 +0,0 @@
-0667077971e0cb63b5f49c580006e90e *./tests/data/vsynth2/flashsv.flv
-12368953 ./tests/data/vsynth2/flashsv.flv
-592b3321994e26a990deb3a0a1415de9 *./tests/data/flashsv.vsynth2.out.yuv
-stddev:    0.65 PSNR: 51.84 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/flv b/tests/ref/vsynth2/flv
deleted file mode 100644
index 7fa57db..0000000
--- a/tests/ref/vsynth2/flv
+++ /dev/null
@@ -1,4 +0,0 @@
-2edc92093d36506bcc0a5c0e17e86113 *./tests/data/vsynth2/flv.flv
-131360 ./tests/data/vsynth2/flv.flv
-8999c8264fb0941561f64c4a736e9d88 *./tests/data/flv.vsynth2.out.yuv
-stddev:    5.33 PSNR: 33.59 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/h261 b/tests/ref/vsynth2/h261
deleted file mode 100644
index ef9454c..0000000
--- a/tests/ref/vsynth2/h261
+++ /dev/null
@@ -1,4 +0,0 @@
-dfd005d4c9030a0dc889c828a6408b9c *./tests/data/vsynth2/h261.avi
-191086 ./tests/data/vsynth2/h261.avi
-db7ceff174823b98834faa2320ca89ac *./tests/data/h261.vsynth2.out.yuv
-stddev:    6.37 PSNR: 32.03 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/h263 b/tests/ref/vsynth2/h263
deleted file mode 100644
index 739ba52..0000000
--- a/tests/ref/vsynth2/h263
+++ /dev/null
@@ -1,4 +0,0 @@
-9a368687ab34c48079f11a202839a6bc *./tests/data/vsynth2/h263.avi
-160106 ./tests/data/vsynth2/h263.avi
-61213b91b359697ebcefb9e0a53ac54a *./tests/data/h263.vsynth2.out.yuv
-stddev:    5.43 PSNR: 33.42 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/h263p b/tests/ref/vsynth2/h263p
deleted file mode 100644
index 3c26eb0..0000000
--- a/tests/ref/vsynth2/h263p
+++ /dev/null
@@ -1,4 +0,0 @@
-c7644d40e9f40bbd98e5a978f9f94bb4 *./tests/data/vsynth2/h263p.avi
-868018 ./tests/data/vsynth2/h263p.avi
-4b0ee791f280029dc03c528f76f195d4 *./tests/data/h263p.vsynth2.out.yuv
-stddev:    1.91 PSNR: 42.50 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/huffyuv b/tests/ref/vsynth2/huffyuv
deleted file mode 100644
index e0e7277..0000000
--- a/tests/ref/vsynth2/huffyuv
+++ /dev/null
@@ -1,4 +0,0 @@
-56cd44907a48990e06bd065e189ff461 *./tests/data/vsynth2/huffyuv.avi
-6455232 ./tests/data/vsynth2/huffyuv.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/huffyuv.vsynth2.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/jpegls b/tests/ref/vsynth2/jpegls
deleted file mode 100644
index 3f87fd2..0000000
--- a/tests/ref/vsynth2/jpegls
+++ /dev/null
@@ -1,4 +0,0 @@
-4fc53937f048c900ae6d50fda9dba206 *./tests/data/vsynth2/jpegls.avi
-8334630 ./tests/data/vsynth2/jpegls.avi
-592b3321994e26a990deb3a0a1415de9 *./tests/data/jpegls.vsynth2.out.yuv
-stddev:    0.65 PSNR: 51.84 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/ljpeg b/tests/ref/vsynth2/ljpeg
deleted file mode 100644
index aec9b56..0000000
--- a/tests/ref/vsynth2/ljpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-554a4a6a5a9058c588f8bf2de405bc70 *./tests/data/vsynth2/ljpeg.avi
-4766914 ./tests/data/vsynth2/ljpeg.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/ljpeg.vsynth2.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mjpeg b/tests/ref/vsynth2/mjpeg
deleted file mode 100644
index 0b501f9..0000000
--- a/tests/ref/vsynth2/mjpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-89df32b46c977fb4cb140ec6c489dd76 *./tests/data/vsynth2/mjpeg.avi
-673224 ./tests/data/vsynth2/mjpeg.avi
-a96a4e15ffcb13e44360df642d049496 *./tests/data/mjpeg.vsynth2.out.yuv
-stddev:    4.32 PSNR: 35.40 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg b/tests/ref/vsynth2/mpeg
deleted file mode 100644
index 1f995eb..0000000
--- a/tests/ref/vsynth2/mpeg
+++ /dev/null
@@ -1,4 +0,0 @@
-73ca6f1deab02d1d67a0e8495c026a9e *./tests/data/vsynth2/mpeg1.mpg
-192783 ./tests/data/vsynth2/mpeg1.mpg
-56147e94b12f08df7213e610e177823d *./tests/data/mpeg.vsynth2.out.yuv
-stddev:    4.95 PSNR: 34.22 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg1b b/tests/ref/vsynth2/mpeg1b
deleted file mode 100644
index 626fbd0..0000000
--- a/tests/ref/vsynth2/mpeg1b
+++ /dev/null
@@ -1,4 +0,0 @@
-e026a2fef80c9679776d2b5c8be09338 *./tests/data/vsynth2/mpeg1b.mpg
-225198 ./tests/data/vsynth2/mpeg1b.mpg
-1150495f4bd487486ee53326c42d0bb8 *./tests/data/mpeg1b.vsynth2.out.yuv
-stddev:    4.10 PSNR: 35.86 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg2 b/tests/ref/vsynth2/mpeg2
deleted file mode 100644
index f4a1c96..0000000
--- a/tests/ref/vsynth2/mpeg2
+++ /dev/null
@@ -1,20 +0,0 @@
-2d55ce623a7be4e8136f80266e487678 *./tests/data/vsynth2/mpeg2.mpg
-198667 ./tests/data/vsynth2/mpeg2.mpg
-b7cae8a1f751b821cddcbe4d5dbc518c *./tests/data/mpeg2.vsynth2.out.yuv
-stddev:    4.96 PSNR: 34.20 bytes:  7603200/  7603200
-1ba5efeb53fab7b4b71edc96d86f6c91 *./tests/data/vsynth2/mpeg2ivlc-qprd.mpg
-244694 ./tests/data/vsynth2/mpeg2ivlc-qprd.mpg
-b26e21599dee48a174bdbc40b2817e55 *./tests/data/mpeg2.vsynth2.out.yuv
-stddev:    4.15 PSNR: 35.76 bytes:  7603200/  7603200
-2c8e33c2d2efab86fc16a195f6877682 *./tests/data/vsynth2/mpeg2_422.mpg
-356124 ./tests/data/vsynth2/mpeg2_422.mpg
-de44597c6c470f3e7019b31245a3ff69 *./tests/data/mpeg2.vsynth2.out.yuv
-stddev:   54.55 PSNR: 13.39 bytes: 10137600/  7603200
-f979bcca866e6e4cad5dc6cb06e56cfb *./tests/data/vsynth2/mpeg2.mpg
-198041 ./tests/data/vsynth2/mpeg2.mpg
-f6d9bf24ff8676a7f6076c05cd2c81a3 *./tests/data/mpeg2.vsynth2.out.yuv
-stddev:    4.97 PSNR: 34.19 bytes:  7603200/  7603200
-f90197a8b6e62ae25f82625337f27240 *./tests/data/vsynth2/mpeg2i.mpg
-204579 ./tests/data/vsynth2/mpeg2i.mpg
-ea5057b60146c06d40449cdfc686bf13 *./tests/data/mpeg2.vsynth2.out.yuv
-stddev:    4.98 PSNR: 34.18 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg2thread b/tests/ref/vsynth2/mpeg2thread
deleted file mode 100644
index 9253d7f..0000000
--- a/tests/ref/vsynth2/mpeg2thread
+++ /dev/null
@@ -1,12 +0,0 @@
-889c754a42d7689b228853e1ece6d345 *./tests/data/vsynth2/mpeg2thread.mpg
-179650 ./tests/data/vsynth2/mpeg2thread.mpg
-8c6a7ed2eb73bd18fd2bb9829464100d *./tests/data/mpeg2thread.vsynth2.out.yuv
-stddev:    4.72 PSNR: 34.65 bytes:  7603200/  7603200
-10b900e32809758857c596d56746e00e *./tests/data/vsynth2/mpeg2threadivlc.mpg
-178801 ./tests/data/vsynth2/mpeg2threadivlc.mpg
-8c6a7ed2eb73bd18fd2bb9829464100d *./tests/data/mpeg2thread.vsynth2.out.yuv
-stddev:    4.72 PSNR: 34.65 bytes:  7603200/  7603200
-864d6bf2982a61e510003a518be65a2d *./tests/data/vsynth2/mpeg2reuse.mpg
-383419 ./tests/data/vsynth2/mpeg2reuse.mpg
-bb20fa080cfd2b0a687ea7376ff4f902 *./tests/data/mpeg2thread.vsynth2.out.yuv
-stddev:    4.73 PSNR: 34.63 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg4 b/tests/ref/vsynth2/mpeg4
deleted file mode 100644
index c24cbd0..0000000
--- a/tests/ref/vsynth2/mpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-47de227982e77830a2db278214a08773 *./tests/data/vsynth2/odivx.mp4
-119797 ./tests/data/vsynth2/odivx.mp4
-90a3577850239083a9042bef33c50e85 *./tests/data/mpeg4.vsynth2.out.yuv
-stddev:    5.34 PSNR: 33.57 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg4adv b/tests/ref/vsynth2/mpeg4adv
deleted file mode 100644
index 89d21ac..0000000
--- a/tests/ref/vsynth2/mpeg4adv
+++ /dev/null
@@ -1,16 +0,0 @@
-dee7be19486a76d96c88d18eefba8f86 *./tests/data/vsynth2/mpeg4-adv.avi
-141546 ./tests/data/vsynth2/mpeg4-adv.avi
-3f3a21e9db85a9c0f7022f557a5374c1 *./tests/data/mpeg4adv.vsynth2.out.yuv
-stddev:    4.94 PSNR: 34.25 bytes:  7603200/  7603200
-fd5ab0f55dbc959316e32923e86290df *./tests/data/vsynth2/mpeg4-qprd.avi
-231458 ./tests/data/vsynth2/mpeg4-qprd.avi
-de8a883865e2dff7a51f66da6c48df48 *./tests/data/mpeg4adv.vsynth2.out.yuv
-stddev:    3.71 PSNR: 36.72 bytes:  7603200/  7603200
-547e1849dcf910935ff6383ca49e5706 *./tests/data/vsynth2/mpeg4-adap.avi
-198510 ./tests/data/vsynth2/mpeg4-adap.avi
-4affb83f6adc94f31024b4f9e0168945 *./tests/data/mpeg4adv.vsynth2.out.yuv
-stddev:    3.75 PSNR: 36.65 bytes:  7603200/  7603200
-7680d2e7d34399dfdfb8a49cf1e10239 *./tests/data/vsynth2/mpeg4-Q.avi
-163688 ./tests/data/vsynth2/mpeg4-Q.avi
-26dc7c78955fa678fbf150e236eb5627 *./tests/data/mpeg4adv.vsynth2.out.yuv
-stddev:    3.97 PSNR: 36.14 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg4nr b/tests/ref/vsynth2/mpeg4nr
deleted file mode 100644
index 1f9499f..0000000
--- a/tests/ref/vsynth2/mpeg4nr
+++ /dev/null
@@ -1,4 +0,0 @@
-c41187c99588fb7229ad330b2f80d28b *./tests/data/vsynth2/mpeg4-nr.avi
-155044 ./tests/data/vsynth2/mpeg4-nr.avi
-f7fc191308679f709405e62271f5c65f *./tests/data/mpeg4nr.vsynth2.out.yuv
-stddev:    4.73 PSNR: 34.63 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/mpeg4thread b/tests/ref/vsynth2/mpeg4thread
deleted file mode 100644
index c881aa4..0000000
--- a/tests/ref/vsynth2/mpeg4thread
+++ /dev/null
@@ -1,4 +0,0 @@
-ba30d10ff70d46e7c5b7fa859ea1faa4 *./tests/data/vsynth2/mpeg4-thread.avi
-250140 ./tests/data/vsynth2/mpeg4-thread.avi
-5355deb8c7609a3f1ff2173aab1dee70 *./tests/data/mpeg4thread.vsynth2.out.yuv
-stddev:    3.69 PSNR: 36.78 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/msmpeg4 b/tests/ref/vsynth2/msmpeg4
deleted file mode 100644
index d77a454..0000000
--- a/tests/ref/vsynth2/msmpeg4
+++ /dev/null
@@ -1,4 +0,0 @@
-3069f95f2ffca1f20c8ea36e2625fabc *./tests/data/vsynth2/msmpeg4.avi
-127680 ./tests/data/vsynth2/msmpeg4.avi
-0e1c6e25c71c6a8fa8e506e3d97ca4c9 *./tests/data/msmpeg4.vsynth2.out.yuv
-stddev:    5.33 PSNR: 33.59 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/msmpeg4v2 b/tests/ref/vsynth2/msmpeg4v2
deleted file mode 100644
index 3bfd839..0000000
--- a/tests/ref/vsynth2/msmpeg4v2
+++ /dev/null
@@ -1,4 +0,0 @@
-c09815e40a9d260628e1ebad8b2b3774 *./tests/data/vsynth2/msmpeg4v2.avi
-129918 ./tests/data/vsynth2/msmpeg4v2.avi
-8920194f8bf8f9cdd6c65b3df9e1a292 *./tests/data/msmpeg4v2.vsynth2.out.yuv
-stddev:    5.33 PSNR: 33.59 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/rc b/tests/ref/vsynth2/rc
deleted file mode 100644
index d6eab69..0000000
--- a/tests/ref/vsynth2/rc
+++ /dev/null
@@ -1,4 +0,0 @@
-c25ede9e268b834a09a63f5136cd1b95 *./tests/data/vsynth2/mpeg4-rc.avi
-226332 ./tests/data/vsynth2/mpeg4-rc.avi
-2b34e606af895b62a250de98749a19b0 *./tests/data/rc.vsynth2.out.yuv
-stddev:    4.23 PSNR: 35.60 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/roq b/tests/ref/vsynth2/roq
deleted file mode 100644
index f82f640..0000000
--- a/tests/ref/vsynth2/roq
+++ /dev/null
@@ -1,4 +0,0 @@
-b46f899b2363065c60f3782ba1f8b7bd *./tests/data/vsynth2/roqav.roq
-92786 ./tests/data/vsynth2/roqav.roq
-e69fca960dd0911e9b8d589c13e11dc1 *./tests/data/roq.vsynth2.out.yuv
-stddev:    3.81 PSNR: 36.49 bytes:   760320/  7603200
diff --git a/tests/ref/vsynth2/rv10 b/tests/ref/vsynth2/rv10
deleted file mode 100644
index c71d0db..0000000
--- a/tests/ref/vsynth2/rv10
+++ /dev/null
@@ -1,4 +0,0 @@
-b1467b0e8d8cad730e36d1e8ab49d573 *./tests/data/vsynth2/rv10.rm
-154310 ./tests/data/vsynth2/rv10.rm
-61213b91b359697ebcefb9e0a53ac54a *./tests/data/rv10.vsynth2.out.yuv
-stddev:    5.43 PSNR: 33.42 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/rv20 b/tests/ref/vsynth2/rv20
deleted file mode 100644
index d029e50..0000000
--- a/tests/ref/vsynth2/rv20
+++ /dev/null
@@ -1,4 +0,0 @@
-d864475aa16d84dd99de13e65003672a *./tests/data/vsynth2/rv20.rm
-132734 ./tests/data/vsynth2/rv20.rm
-c66afdcc0daac2f1b4167b9811968877 *./tests/data/rv20.vsynth2.out.yuv
-stddev:    5.42 PSNR: 33.45 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/snow b/tests/ref/vsynth2/snow
deleted file mode 100644
index 521d563..0000000
--- a/tests/ref/vsynth2/snow
+++ /dev/null
@@ -1,4 +0,0 @@
-af651d8ef0a66257ac8b2ef8b229f27b *./tests/data/vsynth2/snow.avi
-57700 ./tests/data/vsynth2/snow.avi
-8890189af71a0dd3447c4e8424c9a76b *./tests/data/snow.vsynth2.out.yuv
-stddev:   10.47 PSNR: 27.72 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/snowll b/tests/ref/vsynth2/snowll
deleted file mode 100644
index 111a2f2..0000000
--- a/tests/ref/vsynth2/snowll
+++ /dev/null
@@ -1,4 +0,0 @@
-a8fccf278bbb17d37a756ecf11672b09 *./tests/data/vsynth2/snow53.avi
-2721758 ./tests/data/vsynth2/snow53.avi
-dde5895817ad9d219f79a52d0bdfb001 *./tests/data/snowll.vsynth2.out.yuv
-stddev:    0.00 PSNR:999.99 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/svq1 b/tests/ref/vsynth2/svq1
deleted file mode 100644
index 2a391c3..0000000
--- a/tests/ref/vsynth2/svq1
+++ /dev/null
@@ -1,4 +0,0 @@
-7f9fbe4890bc1df67867bf03803dca48 *./tests/data/vsynth2/svq1.mov
-766851 ./tests/data/vsynth2/svq1.mov
-aa03471dac3f49455a33a2b19fda1098 *./tests/data/svq1.vsynth2.out.yuv
-stddev:    3.23 PSNR: 37.93 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/wmv1 b/tests/ref/vsynth2/wmv1
deleted file mode 100644
index 3339a95..0000000
--- a/tests/ref/vsynth2/wmv1
+++ /dev/null
@@ -1,4 +0,0 @@
-1011e26e7d351c96d7bbfe106d831b69 *./tests/data/vsynth2/wmv1.avi
-129530 ./tests/data/vsynth2/wmv1.avi
-81eee429b665254d19a06607463c0b5e *./tests/data/wmv1.vsynth2.out.yuv
-stddev:    5.33 PSNR: 33.60 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/wmv2 b/tests/ref/vsynth2/wmv2
deleted file mode 100644
index 61bb5a5..0000000
--- a/tests/ref/vsynth2/wmv2
+++ /dev/null
@@ -1,4 +0,0 @@
-1f6598e9776ed00aebdc44cc8d48cb7c *./tests/data/vsynth2/wmv2.avi
-129860 ./tests/data/vsynth2/wmv2.avi
-81eee429b665254d19a06607463c0b5e *./tests/data/wmv2.vsynth2.out.yuv
-stddev:    5.33 PSNR: 33.60 bytes:  7603200/  7603200
diff --git a/tests/regression-funcs.sh b/tests/regression-funcs.sh
deleted file mode 100755
index 8fd17ab..0000000
--- a/tests/regression-funcs.sh
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/sh
-#
-# common regression functions for ffmpeg
-#
-#
-
-test="${1#regtest-}"
-test_ref=$2
-raw_src_dir=$3
-target_exec=$4
-target_path=$5
-
-datadir="./tests/data"
-target_datadir="${target_path}/${datadir}"
-
-this="$test.$test_ref"
-logfile="$datadir/$this.regression"
-outfile="$datadir/$test_ref/"
-errfile="$datadir/$this.err"
-
-# various files
-ffmpeg="$target_exec ${target_path}/ffmpeg"
-tiny_psnr="tests/tiny_psnr"
-benchfile="$datadir/$this.bench"
-bench="$datadir/$this.bench.tmp"
-bench2="$datadir/$this.bench2.tmp"
-raw_src="${target_path}/$raw_src_dir/%02d.pgm"
-raw_dst="$datadir/$this.out.yuv"
-raw_ref="$datadir/$test_ref.ref.yuv"
-pcm_src="$target_datadir/asynth1.sw"
-pcm_dst="$datadir/$this.out.wav"
-pcm_ref="$datadir/$test_ref.ref.wav"
-crcfile="$datadir/$this.crc"
-target_crcfile="$target_datadir/$this.crc"
-
-mkdir -p "$datadir"
-mkdir -p "$outfile"
-
-[ "${V-0}" -gt 0 ] && echov=echo || echov=:
-[ "${V-0}" -gt 1 ] || exec 2>$errfile
-
-. $(dirname $0)/md5.sh
-
-FFMPEG_OPTS="-v 0 -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact"
-
-do_ffmpeg()
-{
-    f="$1"
-    shift
-    set -- $* ${target_path}/$f
-    $echov $ffmpeg $FFMPEG_OPTS $*
-    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
-    do_md5sum $f >> $logfile
-    if [ $f = $raw_dst ] ; then
-        $tiny_psnr $f $raw_ref >> $logfile
-    elif [ $f = $pcm_dst ] ; then
-        $tiny_psnr $f $pcm_ref 2 >> $logfile
-    else
-        wc -c $f >> $logfile
-    fi
-    expr "$(cat $bench)" : '.*utime=\(.*s\)' > $bench2
-    echo $(cat $bench2) $f >> $benchfile
-}
-
-do_ffmpeg_nomd5()
-{
-    f="$1"
-    shift
-    set -- $* ${target_path}/$f
-    $echov $ffmpeg $FFMPEG_OPTS $*
-    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
-    if [ $f = $raw_dst ] ; then
-        $tiny_psnr $f $raw_ref >> $logfile
-    elif [ $f = $pcm_dst ] ; then
-        $tiny_psnr $f $pcm_ref 2 >> $logfile
-    else
-        wc -c $f >> $logfile
-    fi
-    expr "$(cat $bench)" : '.*utime=\(.*s\)' > $bench2
-    echo $(cat $bench2) $f >> $benchfile
-}
-
-do_ffmpeg_crc()
-{
-    f="$1"
-    shift
-    $echov $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
-    $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
-    echo "$f $(cat $crcfile)" >> $logfile
-    rm -f "$crcfile"
-}
-
-do_ffmpeg_nocheck()
-{
-    f="$1"
-    shift
-    $echov $ffmpeg $FFMPEG_OPTS $*
-    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
-    expr "$(cat $bench)" : '.*utime=\(.*s\)' > $bench2
-    echo $(cat $bench2) $f >> $benchfile
-}
-
-do_video_decoding()
-{
-    do_ffmpeg $raw_dst $1 -i $target_path/$file -f rawvideo $2
-    rm -f $raw_dst
-}
-
-do_video_encoding()
-{
-    file=${outfile}$1
-    do_ffmpeg $file $2 -f image2 -vcodec pgmyuv -i $raw_src $3
-}
-
-do_audio_encoding()
-{
-    file=${outfile}$1
-    do_ffmpeg $file -ab 128k -ac 2 -f s16le -i $pcm_src $3
-}
-
-do_audio_decoding()
-{
-    do_ffmpeg $pcm_dst -i $target_path/$file -sample_fmt s16 -f wav
-}
diff --git a/tests/rotozoom.c b/tests/rotozoom.c
deleted file mode 100644
index 47da1b0..0000000
--- a/tests/rotozoom.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Generates a synthetic YUV video sequence suitable for codec testing.
- *
- * copyright (c) Sebastien Bechet <s.bechet at av7.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-
-#define FIXP (1<<16)
-#define MY_PI 205887 //(M_PI*FIX)
-
-static int64_t int_pow(int64_t a, int p){
-    int64_t v= FIXP;
-
-    for(; p; p--){
-        v*= a;
-        v/= FIXP;
-    }
-
-    return v;
-}
-
-static int64_t int_sin(int64_t a){
-    if(a<0) a= MY_PI-a; // 0..inf
-    a %= 2*MY_PI;       // 0..2PI
-
-    if(a>=MY_PI*3/2) a -= 2*MY_PI;  // -PI/2 .. 3PI/2
-    if(a>=MY_PI/2  ) a = MY_PI - a; // -PI/2 ..  PI/2
-
-    return a - int_pow(a, 3)/6 + int_pow(a, 5)/120 - int_pow(a, 7)/5040;
-}
-
-#define SCALEBITS 8
-#define ONE_HALF  (1 << (SCALEBITS - 1))
-#define FIX(x)    ((int) ((x) * (1L<<SCALEBITS) + 0.5))
-typedef unsigned char UINT8;
-
-static void rgb24_to_yuv420p(UINT8 *lum, UINT8 *cb, UINT8 *cr,
-                              UINT8 *src, int width, int height)
-{
-    int wrap, wrap3, x, y;
-    int r, g, b, r1, g1, b1;
-    UINT8 *p;
-
-    wrap = width;
-    wrap3 = width * 3;
-    p = src;
-    for(y=0;y<height;y+=2) {
-        for(x=0;x<width;x+=2) {
-            r = p[0];
-            g = p[1];
-            b = p[2];
-            r1 = r;
-            g1 = g;
-            b1 = b;
-            lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-            r = p[3];
-            g = p[4];
-            b = p[5];
-            r1 += r;
-            g1 += g;
-            b1 += b;
-            lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-            p += wrap3;
-            lum += wrap;
-
-            r = p[0];
-            g = p[1];
-            b = p[2];
-            r1 += r;
-            g1 += g;
-            b1 += b;
-            lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-            r = p[3];
-            g = p[4];
-            b = p[5];
-            r1 += r;
-            g1 += g;
-            b1 += b;
-            lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-
-            cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 +
-                      FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
-            cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 -
-                     FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
-
-            cb++;
-            cr++;
-            p += -wrap3 + 2 * 3;
-            lum += -wrap + 2;
-        }
-        p += wrap3;
-        lum += wrap;
-    }
-}
-
-/* cif format */
-#define DEFAULT_WIDTH   352
-#define DEFAULT_HEIGHT  288
-#define DEFAULT_NB_PICT 50
-
-static void pgmyuv_save(const char *filename, int w, int h,
-                        unsigned char *rgb_tab)
-{
-    FILE *f;
-    int i, h2, w2;
-    unsigned char *cb, *cr;
-    unsigned char *lum_tab, *cb_tab, *cr_tab;
-
-    lum_tab = malloc(w * h);
-    cb_tab = malloc((w * h) / 4);
-    cr_tab = malloc((w * h) / 4);
-
-    rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
-
-    f = fopen(filename,"wb");
-    fprintf(f, "P5\n%d %d\n%d\n", w, (h * 3) / 2, 255);
-    fwrite(lum_tab, 1, w * h, f);
-    h2 = h / 2;
-    w2 = w / 2;
-    cb = cb_tab;
-    cr = cr_tab;
-    for(i=0;i<h2;i++) {
-        fwrite(cb, 1, w2, f);
-        fwrite(cr, 1, w2, f);
-        cb += w2;
-        cr += w2;
-    }
-    fclose(f);
-
-    free(lum_tab);
-    free(cb_tab);
-    free(cr_tab);
-}
-
-unsigned char *rgb_tab;
-int width, height, wrap;
-
-static void put_pixel(int x, int y, int r, int g, int b)
-{
-    unsigned char *p;
-
-    if (x < 0 || x >= width ||
-        y < 0 || y >= height)
-        return;
-
-    p = rgb_tab + y * wrap + x * 3;
-    p[0] = r;
-    p[1] = g;
-    p[2] = b;
-}
-
-unsigned char tab_r[256*256];
-unsigned char tab_g[256*256];
-unsigned char tab_b[256*256];
-
-int h_cos [360];
-int h_sin [360];
-
-static int ipol(uint8_t *src, int x, int y){
-    int int_x= x>>16;
-    int int_y= y>>16;
-    int frac_x= x&0xFFFF;
-    int frac_y= y&0xFFFF;
-    int s00= src[ ( int_x   &255) + 256*( int_y   &255) ];
-    int s01= src[ ((int_x+1)&255) + 256*( int_y   &255) ];
-    int s10= src[ ( int_x   &255) + 256*((int_y+1)&255) ];
-    int s11= src[ ((int_x+1)&255) + 256*((int_y+1)&255) ];
-    int s0= (((1<<16) - frac_x)*s00 + frac_x*s01)>>8;
-    int s1= (((1<<16) - frac_x)*s10 + frac_x*s11)>>8;
-
-    return (((1<<16) - frac_y)*s0 + frac_y*s1)>>24;
-}
-
-static void gen_image(int num, int w, int h)
-{
-  const int c = h_cos [num % 360];
-  const int s = h_sin [num % 360];
-
-  const int xi = -(w/2) * c;
-  const int yi =  (w/2) * s;
-
-  const int xj = -(h/2) * s;
-  const int yj = -(h/2) * c;
-  int i,j;
-
-  int x,y;
-  int xprime = xj;
-  int yprime = yj;
-
-
-  for (j=0;j<h;j++) {
-
-    x = xprime + xi + FIXP*w/2;
-    xprime += s;
-
-    y = yprime + yi + FIXP*h/2;
-    yprime += c;
-
-    for ( i=0 ; i<w ; i++ ) {
-      x += c;
-      y -= s;
-#if 1
-      put_pixel(i, j, ipol(tab_r, x, y), ipol(tab_g, x, y), ipol(tab_b, x, y));
-#else
-      {
-          unsigned dep;
-          dep = ((x>>16)&255) + (((y>>16)&255)<<8);
-          put_pixel(i, j, tab_r[dep], tab_g[dep], tab_b[dep]);
-      }
-#endif
-    }
-  }
-}
-
-#define W 256
-#define H 256
-
-static void init_demo(const char *filename) {
-  int i,j;
-  int h;
-  int radian;
-  char line[3 * W];
-
-  FILE *fichier;
-
-  fichier = fopen(filename,"rb");
-  if (!fichier) {
-      perror(filename);
-      exit(1);
-  }
-
-  fread(line, 1, 15, fichier);
-  for (i=0;i<H;i++) {
-    fread(line,1,3*W,fichier);
-    for (j=0;j<W;j++) {
-          tab_r[W*i+j] = line[3*j    ];
-          tab_g[W*i+j] = line[3*j + 1];
-          tab_b[W*i+j] = line[3*j + 2];
-    }
-  }
-  fclose(fichier);
-
-  /* tables sin/cos */
-  for (i=0;i<360;i++) {
-    radian = 2*i*MY_PI/360;
-    h = 2*FIXP + int_sin (radian);
-    h_cos[i] = ( h * int_sin (radian + MY_PI/2) )/2/FIXP;
-    h_sin[i] = ( h * int_sin (radian          ) )/2/FIXP;
-  }
-}
-
-int main(int argc, char **argv)
-{
-    int w, h, i;
-    char buf[1024];
-
-    if (argc != 3) {
-        printf("usage: %s directory/ image.pnm\n"
-               "generate a test video stream\n", argv[0]);
-        exit(1);
-    }
-
-    w = DEFAULT_WIDTH;
-    h = DEFAULT_HEIGHT;
-
-    rgb_tab = malloc(w * h * 3);
-    wrap = w * 3;
-    width = w;
-    height = h;
-
-    init_demo(argv[2]);
-
-    for(i=0;i<DEFAULT_NB_PICT;i++) {
-        snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
-        gen_image(i, w, h);
-        pgmyuv_save(buf, w, h, rgb_tab);
-    }
-
-    free(rgb_tab);
-    return 0;
-}
diff --git a/tests/seek-regression.sh b/tests/seek-regression.sh
deleted file mode 100755
index ae0ef67..0000000
--- a/tests/seek-regression.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-LC_ALL=C
-export LC_ALL
-
-src_path=$1
-target_exec=$2
-target_path=$3
-
-[ "${V-0}" -gt 0 ] && echov=echo || echov=:
-[ "${V-0}" -gt 1 ] || exec 2>/dev/null
-
-refdir="$src_path/tests/ref/seek"
-datadir="tests/data"
-
-list=$(ls -1 $datadir/vsynth2/* $datadir/acodec/* $datadir/lavf/*)
-imgs=$(for i in $datadir/images/*; do echo "$i/%02d.${i##*/}"; done)
-err=0
-
-for i in $list $imgs; do
-    base=$(basename $i)
-    logfile="$datadir/$base.seek.regression"
-    reffile="$refdir/$base.ref"
-    echo "TEST SEEK   $base"
-    $echov $target_exec $target_path/tests/seek_test $target_path/$i
-    $target_exec $target_path/tests/seek_test $target_path/$i > $logfile
-    diff -u -w "$reffile" "$logfile" || err=1
-done
-
-if [ $err = 0 ]; then
-    echo
-    echo seek regression test: success
-    exit 0
-else
-    echo
-    echo seek regression test: error
-    exit 1
-fi
diff --git a/tests/seek_test.c b/tests/seek_test.c
deleted file mode 100644
index 81a7821..0000000
--- a/tests/seek_test.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2003 Fabrice Bellard
- * Copyright (c) 2007 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "libavutil/common.h"
-#include "libavformat/avformat.h"
-
-#undef exit
-#undef printf
-#undef fprintf
-
-static char buffer[20];
-
-static const char *ret_str(int v)
-{
-    switch (v) {
-    case AVERROR_EOF:     return "-EOF";
-    case AVERROR(EIO):    return "-EIO";
-    case AVERROR(ENOMEM): return "-ENOMEM";
-    case AVERROR(EINVAL): return "-EINVAL";
-    default:
-        snprintf(buffer, sizeof(buffer), "%2d", v);
-        return buffer;
-    }
-}
-
-static void ts_str(char buffer[60], int64_t ts, AVRational base)
-{
-    double tsval;
-    if (ts == AV_NOPTS_VALUE) {
-        strcpy(buffer, " NOPTS   ");
-        return;
-    }
-    tsval = ts * av_q2d(base);
-    snprintf(buffer, 60, "%9f", tsval);
-}
-
-int main(int argc, char **argv)
-{
-    const char *filename;
-    AVFormatContext *ic = NULL;
-    int i, ret, stream_id;
-    int64_t timestamp;
-    AVFormatParameters params, *ap= &params;
-    memset(ap, 0, sizeof(params));
-    ap->channels=1;
-    ap->sample_rate= 22050;
-
-    /* initialize libavcodec, and register all codecs and formats */
-    av_register_all();
-
-    if (argc != 2) {
-        printf("usage: %s input_file\n"
-               "\n", argv[0]);
-        exit(1);
-    }
-
-    filename = argv[1];
-
-    ret = av_open_input_file(&ic, filename, NULL, 0, ap);
-    if (ret < 0) {
-        fprintf(stderr, "cannot open %s\n", filename);
-        exit(1);
-    }
-
-    ret = av_find_stream_info(ic);
-    if (ret < 0) {
-        fprintf(stderr, "%s: could not find codec parameters\n", filename);
-        exit(1);
-    }
-
-    for(i=0; ; i++){
-        AVPacket pkt;
-        AVStream *av_uninit(st);
-        char ts_buf[60];
-
-        memset(&pkt, 0, sizeof(pkt));
-        if(ret>=0){
-            ret= av_read_frame(ic, &pkt);
-            if(ret>=0){
-                char dts_buf[60];
-                st= ic->streams[pkt.stream_index];
-                ts_str(dts_buf, pkt.dts, st->time_base);
-                ts_str(ts_buf,  pkt.pts, st->time_base);
-                printf("ret:%-10s st:%2d flags:%d dts:%s pts:%s pos:%7" PRId64 " size:%6d", ret_str(ret), pkt.stream_index, pkt.flags, dts_buf, ts_buf, pkt.pos, pkt.size);
-                av_free_packet(&pkt);
-            } else
-                printf("ret:%s", ret_str(ret)); // necessary to avoid trailing whitespace
-            printf("\n");
-        }
-
-        if(i>25) break;
-
-        stream_id= (i>>1)%(ic->nb_streams+1) - 1;
-        timestamp= (i*19362894167LL) % (4*AV_TIME_BASE) - AV_TIME_BASE;
-        if(stream_id>=0){
-            st= ic->streams[stream_id];
-            timestamp= av_rescale_q(timestamp, AV_TIME_BASE_Q, st->time_base);
-        }
-        //FIXME fully test the new seek API
-        if(i&1) ret = avformat_seek_file(ic, stream_id, INT64_MIN, timestamp, timestamp, 0);
-        else    ret = avformat_seek_file(ic, stream_id, timestamp, timestamp, INT64_MAX, 0);
-        ts_str(ts_buf, timestamp, stream_id < 0 ? AV_TIME_BASE_Q : st->time_base);
-        printf("ret:%-10s st:%2d flags:%d  ts:%s\n", ret_str(ret), stream_id, i&1, ts_buf);
-    }
-
-    av_close_input_file(ic);
-
-    return 0;
-}
diff --git a/tests/tiny_psnr.c b/tests/tiny_psnr.c
deleted file mode 100644
index f8d1b7b..0000000
--- a/tests/tiny_psnr.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
-#define F 100
-#define SIZE 2048
-
-uint64_t exp16_table[21]={
-     65537,
-     65538,
-     65540,
-     65544,
-     65552,
-     65568,
-     65600,
-     65664,
-     65793,
-     66050,
-     66568,
-     67616,
-     69763,
-     74262,
-     84150,
-    108051,
-    178145,
-    484249,
-   3578144,
- 195360063,
- 582360139072LL,
-};
-
-#if 0
-// 16.16 fixpoint exp()
-static unsigned int exp16(unsigned int a){
-    int i;
-    int out= 1<<16;
-
-    for(i=19;i>=0;i--){
-        if(a&(1<<i))
-            out= (out*exp16_table[i] + (1<<15))>>16;
-    }
-
-    return out;
-}
-#endif
-
-// 16.16 fixpoint log()
-static int64_t log16(uint64_t a){
-    int i;
-    int out=0;
-
-    if(a < 1<<16)
-        return -log16((1LL<<32) / a);
-    a<<=16;
-
-    for(i=20;i>=0;i--){
-        int64_t b= exp16_table[i];
-        if(a<(b<<16)) continue;
-        out |= 1<<i;
-        a = ((a/b)<<16) + (((a%b)<<16) + b/2)/b;
-    }
-    return out;
-}
-
-static uint64_t int_sqrt(uint64_t a)
-{
-    uint64_t ret=0;
-    int s;
-    uint64_t ret_sq=0;
-
-    for(s=31; s>=0; s--){
-        uint64_t b= ret_sq + (1ULL<<(s*2)) + (ret<<s)*2;
-        if(b<=a){
-            ret_sq=b;
-            ret+= 1ULL<<s;
-        }
-    }
-    return ret;
-}
-
-int main(int argc,char* argv[]){
-    int i, j;
-    uint64_t sse=0;
-    uint64_t dev;
-    FILE *f[2];
-    uint8_t buf[2][SIZE];
-    uint64_t psnr;
-    int len= argc<4 ? 1 : atoi(argv[3]);
-    int64_t max= (1<<(8*len))-1;
-    int shift= argc<5 ? 0 : atoi(argv[4]);
-    int skip_bytes = argc<6 ? 0 : atoi(argv[5]);
-    int size0=0;
-    int size1=0;
-
-    if(argc<3){
-        printf("tiny_psnr <file1> <file2> [<elem size> [<shift> [<skip bytes>]]]\n");
-        printf("For WAV files use the following:\n");
-        printf("./tiny_psnr file1.wav file2.wav 2 0 44 to skip the header.\n");
-        return -1;
-    }
-
-    f[0]= fopen(argv[1], "rb");
-    f[1]= fopen(argv[2], "rb");
-    if(!f[0] || !f[1]){
-        fprintf(stderr, "Could not open input files.\n");
-        return -1;
-    }
-    fseek(f[shift<0], shift < 0 ? -shift : shift, SEEK_SET);
-
-    fseek(f[0],skip_bytes,SEEK_CUR);
-    fseek(f[1],skip_bytes,SEEK_CUR);
-
-    for(;;){
-        int s0= fread(buf[0], 1, SIZE, f[0]);
-        int s1= fread(buf[1], 1, SIZE, f[1]);
-
-        for(j=0; j<FFMIN(s0,s1); j++){
-            int64_t a= buf[0][j];
-            int64_t b= buf[1][j];
-            if(len==2){
-                a= (int16_t)(a | (buf[0][++j]<<8));
-                b= (int16_t)(b | (buf[1][  j]<<8));
-            }
-            sse += (a-b) * (a-b);
-        }
-        size0 += s0;
-        size1 += s1;
-        if(s0+s1<=0)
-            break;
-    }
-
-    i= FFMIN(size0,size1)/len;
-    if(!i) i=1;
-    dev= int_sqrt( ((sse/i)*F*F) + (((sse%i)*F*F) + i/2)/i );
-    if(sse)
-        psnr= ((2*log16(max<<16) + log16(i) - log16(sse))*284619LL*F + (1LL<<31)) / (1LL<<32);
-    else
-        psnr= 1000*F-1; //floating point free infinity :)
-
-    printf("stddev:%5d.%02d PSNR:%3d.%02d bytes:%9d/%9d\n",
-        (int)(dev/F), (int)(dev%F),
-        (int)(psnr/F), (int)(psnr%F),
-        size0, size1);
-    return 0;
-}
-
-
diff --git a/tests/videogen.c b/tests/videogen.c
deleted file mode 100644
index 4238e3f..0000000
--- a/tests/videogen.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Generates a synthetic YUV video sequence suitable for codec testing.
- * NOTE: No floats are used to guarantee a bit exact output.
- *
- * Copyright (c) 2002 Fabrice Bellard
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#define SCALEBITS 8
-#define ONE_HALF  (1 << (SCALEBITS - 1))
-#define FIX(x)    ((int) ((x) * (1L<<SCALEBITS) + 0.5))
-
-static void rgb24_to_yuv420p(uint8_t *lum, uint8_t *cb, uint8_t *cr,
-                              uint8_t *src, int width, int height)
-{
-    int wrap, wrap3, x, y;
-    int r, g, b, r1, g1, b1;
-    uint8_t *p;
-
-    wrap = width;
-    wrap3 = width * 3;
-    p = src;
-    for(y=0;y<height;y+=2) {
-        for(x=0;x<width;x+=2) {
-            r = p[0];
-            g = p[1];
-            b = p[2];
-            r1 = r;
-            g1 = g;
-            b1 = b;
-            lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-            r = p[3];
-            g = p[4];
-            b = p[5];
-            r1 += r;
-            g1 += g;
-            b1 += b;
-            lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-            p += wrap3;
-            lum += wrap;
-
-            r = p[0];
-            g = p[1];
-            b = p[2];
-            r1 += r;
-            g1 += g;
-            b1 += b;
-            lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-            r = p[3];
-            g = p[4];
-            b = p[5];
-            r1 += r;
-            g1 += g;
-            b1 += b;
-            lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
-                      FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
-
-            cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 +
-                      FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
-            cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 -
-                     FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
-
-            cb++;
-            cr++;
-            p += -wrap3 + 2 * 3;
-            lum += -wrap + 2;
-        }
-        p += wrap3;
-        lum += wrap;
-    }
-}
-
-/* cif format */
-#define DEFAULT_WIDTH   352
-#define DEFAULT_HEIGHT  288
-#define DEFAULT_NB_PICT 50 /* 2 seconds */
-
-static void pgmyuv_save(const char *filename, int w, int h,
-                        unsigned char *rgb_tab)
-{
-    FILE *f;
-    int i, h2, w2;
-    unsigned char *cb, *cr;
-    unsigned char *lum_tab, *cb_tab, *cr_tab;
-
-    lum_tab = malloc(w * h);
-    cb_tab = malloc((w * h) / 4);
-    cr_tab = malloc((w * h) / 4);
-
-    rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
-
-    f = fopen(filename,"wb");
-    fprintf(f, "P5\n%d %d\n%d\n", w, (h * 3) / 2, 255);
-    fwrite(lum_tab, 1, w * h, f);
-    h2 = h / 2;
-    w2 = w / 2;
-    cb = cb_tab;
-    cr = cr_tab;
-    for(i=0;i<h2;i++) {
-        fwrite(cb, 1, w2, f);
-        fwrite(cr, 1, w2, f);
-        cb += w2;
-        cr += w2;
-    }
-    fclose(f);
-
-    free(lum_tab);
-    free(cb_tab);
-    free(cr_tab);
-}
-
-unsigned char *rgb_tab;
-int width, height, wrap;
-
-static void put_pixel(int x, int y, int r, int g, int b)
-{
-    unsigned char *p;
-
-    if (x < 0 || x >= width ||
-        y < 0 || y >= height)
-        return;
-
-    p = rgb_tab + y * wrap + x * 3;
-    p[0] = r;
-    p[1] = g;
-    p[2] = b;
-}
-
-static unsigned int myrnd(unsigned int *seed_ptr, int n)
-{
-    unsigned int seed, val;
-
-    seed = *seed_ptr;
-    seed = (seed * 314159) + 1;
-    if (n == 256) {
-        val = seed >> 24;
-    } else {
-        val = seed % n;
-    }
-    *seed_ptr = seed;
-    return val;
-}
-
-#define NOISE_X  10
-#define NOISE_Y  30
-#define NOISE_W  26
-
-#define FRAC_BITS 8
-#define FRAC_ONE (1 << FRAC_BITS)
-
-/* cosine approximate with 1-x^2 */
-static int int_cos(int a)
-{
-    int v, neg;
-    a = a & (FRAC_ONE - 1);
-    if (a >= (FRAC_ONE / 2))
-        a = FRAC_ONE - a;
-    neg = 0;
-    if (a > (FRAC_ONE / 4)) {
-        neg = -1;
-        a = (FRAC_ONE / 2) - a;
-    }
-    v = FRAC_ONE - ((a * a) >> 4);
-    v = (v ^ neg) - neg;
-    return v;
-}
-
-#define NB_OBJS  10
-
-typedef struct VObj {
-    int x, y, w, h;
-    int r, g, b;
-} VObj;
-
-VObj objs[NB_OBJS];
-
-unsigned int seed = 1;
-
-static void gen_image(int num, int w, int h)
-{
-    int r, g, b, x, y, i, dx, dy, x1, y1;
-    unsigned int seed1;
-
-    if (num == 0) {
-        for(i=0;i<NB_OBJS;i++) {
-            objs[i].x = myrnd(&seed, w);
-            objs[i].y = myrnd(&seed, h);
-            objs[i].w = myrnd(&seed, w / 4) + 10;
-            objs[i].h = myrnd(&seed, h / 4) + 10;
-            objs[i].r = myrnd(&seed, 256);
-            objs[i].g = myrnd(&seed, 256);
-            objs[i].b = myrnd(&seed, 256);
-        }
-    }
-
-    /* first a moving background with gradients */
-    /* test motion estimation */
-    dx = int_cos(num * FRAC_ONE / 50) * 35;
-    dy = int_cos(num * FRAC_ONE / 50 + FRAC_ONE / 10) * 30;
-    for(y=0;y<h;y++) {
-        for(x=0;x<w;x++) {
-            x1 = (x << FRAC_BITS) + dx;
-            y1 = (y << FRAC_BITS) + dy;
-            r = ((y1 * 7) >> FRAC_BITS) & 0xff;
-            g = (((x1 + y1) * 9) >> FRAC_BITS) & 0xff;
-            b = ((x1 * 5) >> FRAC_BITS) & 0xff;
-            put_pixel(x, y, r, g, b);
-        }
-    }
-
-    /* then some noise with very high intensity to test saturation */
-    seed1 = num;
-    for(y=0;y<NOISE_W;y++) {
-        for(x=0;x<NOISE_W;x++) {
-            r = myrnd(&seed1, 256);
-            g = myrnd(&seed1, 256);
-            b = myrnd(&seed1, 256);
-            put_pixel(x + NOISE_X, y + NOISE_Y, r, g, b);
-        }
-    }
-
-    /* then moving objects */
-    for(i=0;i<NB_OBJS;i++) {
-        VObj *p = &objs[i];
-        seed1 = i;
-        for(y=0;y<p->h;y++) {
-            for(x=0;x<p->w;x++) {
-                r = p->r;
-                g = p->g;
-                b = p->b;
-                /* add a per object noise */
-                r += myrnd(&seed1, 50);
-                g += myrnd(&seed1, 50);
-                b += myrnd(&seed1, 50);
-                put_pixel(x + p->x, y + p->y, r, g, b);
-            }
-        }
-        p->x += myrnd(&seed, 21) - 10;
-        p->y += myrnd(&seed, 21) - 10;
-    }
-}
-
-int main(int argc, char **argv)
-{
-    int w, h, i;
-    char buf[1024];
-
-    if (argc != 2) {
-        printf("usage: %s file\n"
-               "generate a test video stream\n", argv[0]);
-        exit(1);
-    }
-
-    w = DEFAULT_WIDTH;
-    h = DEFAULT_HEIGHT;
-
-    rgb_tab = malloc(w * h * 3);
-    wrap = w * 3;
-    width = w;
-    height = h;
-
-    for(i=0;i<DEFAULT_NB_PICT;i++) {
-        snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
-        gen_image(i, w, h);
-        pgmyuv_save(buf, w, h, rgb_tab);
-    }
-
-    free(rgb_tab);
-    return 0;
-}
diff --git a/tools/build_avopt b/tools/build_avopt
deleted file mode 100755
index fcf1657..0000000
--- a/tools/build_avopt
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-sed 's/unsigned//g' |\
- sed 's/enum//g' |\
- egrep '^ *(int|float|double|AVRational|char *\*) *[a-zA-Z_0-9]* *;' |\
- sed 's/^ *\([^ ]*\)[ *]*\([^;]*\);.*$/{"\2", NULL, OFFSET(\2), FF_OPT_TYPE_\U\1, DEFAULT, \1_MIN, \1_MAX},/' |\
- sed 's/AVRATIONAL_M/INT_M/g'|\
- sed 's/TYPE_AVRATIONAL/TYPE_RATIONAL/g'|\
- sed 's/FLOAT_M/FLT_M/g'|\
- sed 's/FF_OPT_TYPE_CHAR/FF_OPT_TYPE_STRING/g'
diff --git a/tools/clean-diff b/tools/clean-diff
deleted file mode 100755
index 98e26a7..0000000
--- a/tools/clean-diff
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-sed '/^+[^+]/!s/	/TaBBaT/g' |\
- expand -t `seq -s , 9 8 200` |\
- sed 's/TaBBaT/	/g' |\
- sed '/^+[^+]/s/ * $//' |\
- tr -d '\015' |\
- tr '\n' '°' |\
- sed 's/\(@@[^@]*@@°[^@]*\)/\n\1/g' |\
- egrep -v '@@[^@]*@@°(( [^°]*°)|([+-][[:space:]]*°)|(-[[:space:]]*([^°]*)°\+[[:space:]]*\5°))*$' |\
- tr -d '\n' |\
- tr '°' '\n'
diff --git a/tools/cws2fws.c b/tools/cws2fws.c
deleted file mode 100644
index aa7d690..0000000
--- a/tools/cws2fws.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * cws2fws by Alex Beregszaszi
- * This file is placed in the public domain.
- * Use the program however you see fit.
- *
- * This utility converts compressed Macromedia Flash files to uncompressed ones.
- */
-
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <zlib.h>
-
-#ifdef DEBUG
-#define dbgprintf printf
-#else
-#define dbgprintf(...)
-#endif
-
-int main(int argc, char *argv[])
-{
-    int fd_in, fd_out, comp_len, uncomp_len, i, last_out;
-    char buf_in[1024], buf_out[65536];
-    z_stream zstream;
-    struct stat statbuf;
-
-    if (argc < 3)
-    {
-        printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]);
-        exit(1);
-    }
-
-    fd_in = open(argv[1], O_RDONLY);
-    if (fd_in < 0)
-    {
-        perror("Error while opening: ");
-        exit(1);
-    }
-
-    fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
-    if (fd_out < 0)
-    {
-        perror("Error while opening: ");
-        close(fd_in);
-        exit(1);
-    }
-
-    if (read(fd_in, &buf_in, 8) != 8)
-    {
-        printf("Header error\n");
-        close(fd_in);
-        close(fd_out);
-        exit(1);
-    }
-
-    if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S')
-    {
-        printf("Not a compressed flash file\n");
-        exit(1);
-    }
-
-    fstat(fd_in, &statbuf);
-    comp_len = statbuf.st_size;
-    uncomp_len = buf_in[4] | (buf_in[5] << 8) | (buf_in[6] << 16) | (buf_in[7] << 24);
-
-    printf("Compressed size: %d Uncompressed size: %d\n", comp_len-4, uncomp_len-4);
-
-    // write out modified header
-    buf_in[0] = 'F';
-    write(fd_out, &buf_in, 8);
-
-    zstream.zalloc = NULL;
-    zstream.zfree = NULL;
-    zstream.opaque = NULL;
-    inflateInit(&zstream);
-
-    for (i = 0; i < comp_len-8;)
-    {
-        int ret, len = read(fd_in, &buf_in, 1024);
-
-        dbgprintf("read %d bytes\n", len);
-
-        last_out = zstream.total_out;
-
-        zstream.next_in = &buf_in[0];
-        zstream.avail_in = len;
-        zstream.next_out = &buf_out[0];
-        zstream.avail_out = 65536;
-
-        ret = inflate(&zstream, Z_SYNC_FLUSH);
-        if (ret != Z_STREAM_END && ret != Z_OK)
-        {
-            printf("Error while decompressing: %d\n", ret);
-            inflateEnd(&zstream);
-            exit(1);
-        }
-
-        dbgprintf("a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out\n",
-            zstream.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out,
-            zstream.total_out-last_out);
-
-        write(fd_out, &buf_out, zstream.total_out-last_out);
-
-        i += len;
-
-        if (ret == Z_STREAM_END || ret == Z_BUF_ERROR)
-            break;
-    }
-
-    if (zstream.total_out != uncomp_len-8)
-    {
-        printf("Size mismatch (%lu != %d), updating header...\n",
-            zstream.total_out, uncomp_len-8);
-
-        buf_in[0] = (zstream.total_out+8) & 0xff;
-        buf_in[1] = ((zstream.total_out+8) >> 8) & 0xff;
-        buf_in[2] = ((zstream.total_out+8) >> 16) & 0xff;
-        buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff;
-
-        lseek(fd_out, 4, SEEK_SET);
-        write(fd_out, &buf_in, 4);
-    }
-
-    inflateEnd(&zstream);
-    close(fd_in);
-    close(fd_out);
-    return 0;
-}
diff --git a/tools/graph2dot.c b/tools/graph2dot.c
deleted file mode 100644
index 57a25a7..0000000
--- a/tools/graph2dot.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2008-2010 Stefano Sabatini
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <unistd.h>             /* getopt */
-
-#undef HAVE_AV_CONFIG_H
-#include "libavutil/pixdesc.h"
-#include "libavfilter/graphparser.h"
-
-static void usage(void)
-{
-    printf("Convert a libavfilter graph to a dot file\n");
-    printf("Usage: graph2dot [OPTIONS]\n");
-    printf("\n"
-           "Options:\n"
-           "-i INFILE         set INFILE as input file, stdin if omitted\n"
-           "-o OUTFILE        set OUTFILE as output file, stdout if omitted\n"
-           "-h                print this help\n");
-}
-
-struct line {
-    char data[256];
-    struct line *next;
-};
-
-static void print_digraph(FILE *outfile, AVFilterGraph *graph)
-{
-    int i, j;
-
-    fprintf(outfile, "digraph G {\n");
-    fprintf(outfile, "node [shape=box]\n");
-    fprintf(outfile, "rankdir=LR\n");
-
-    for (i = 0; i < graph->filter_count; i++) {
-        char filter_ctx_label[128];
-        const AVFilterContext *filter_ctx = graph->filters[i];
-
-        snprintf(filter_ctx_label, sizeof(filter_ctx_label), "%s (%s)",
-                 filter_ctx->name,
-                 filter_ctx->filter->name);
-
-        for (j = 0; j < filter_ctx->output_count; j++) {
-            AVFilterLink *link = filter_ctx->outputs[j];
-            if (link) {
-                char dst_filter_ctx_label[128];
-                const AVFilterContext *dst_filter_ctx = link->dst;
-
-                snprintf(dst_filter_ctx_label, sizeof(dst_filter_ctx_label), "%s (%s)",
-                         dst_filter_ctx->name,
-                         dst_filter_ctx->filter->name);
-
-                fprintf(outfile, "\"%s\" -> \"%s\"", filter_ctx_label, dst_filter_ctx_label);
-                fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d\"];\n",
-                        av_pix_fmt_descriptors[link->format].name, link->w, link->h);
-            }
-        }
-    }
-    fprintf(outfile, "}\n");
-}
-
-int main(int argc, char **argv)
-{
-    const char *outfilename = NULL;
-    const char *infilename = NULL;
-    FILE *outfile = NULL;
-    FILE *infile = NULL;
-    char *graph_string = NULL;
-    AVFilterGraph *graph = av_mallocz(sizeof(AVFilterGraph));
-    char c;
-
-    av_log_set_level(AV_LOG_DEBUG);
-
-    while ((c = getopt(argc, argv, "hi:o:")) != -1) {
-        switch(c) {
-        case 'h':
-            usage();
-            return 0;
-        case 'i':
-            infilename = optarg;
-            break;
-        case 'o':
-            outfilename = optarg;
-            break;
-        case '?':
-            return 1;
-        }
-    }
-
-    if (!infilename || !strcmp(infilename, "-"))
-        infilename = "/dev/stdin";
-    infile = fopen(infilename, "r");
-    if (!infile) {
-        fprintf(stderr, "Impossible to open input file '%s': %s\n", infilename, strerror(errno));
-        return 1;
-    }
-
-    if (!outfilename || !strcmp(outfilename, "-"))
-        outfilename = "/dev/stdout";
-    outfile = fopen(outfilename, "w");
-    if (!outfile) {
-        fprintf(stderr, "Impossible to open output file '%s': %s\n", outfilename, strerror(errno));
-        return 1;
-    }
-
-    /* read from infile and put it in a buffer */
-    {
-        unsigned int count = 0;
-        struct line *line, *last_line, *first_line;
-        char *p;
-        last_line = first_line = av_malloc(sizeof(struct line));
-
-        while (fgets(last_line->data, sizeof(last_line->data), infile)) {
-            struct line *new_line = av_malloc(sizeof(struct line));
-            count += strlen(last_line->data);
-            last_line->next = new_line;
-            last_line = new_line;
-        }
-        last_line->next = NULL;
-
-        graph_string = av_malloc(count + 1);
-        p = graph_string;
-        for (line = first_line; line->next; line = line->next) {
-            unsigned int l = strlen(line->data);
-            memcpy(p, line->data, l);
-            p += l;
-        }
-        *p = '\0';
-    }
-
-    avfilter_register_all();
-
-    if (avfilter_graph_parse(graph, graph_string, NULL, NULL, NULL) < 0) {
-        fprintf(stderr, "Impossible to parse the graph description\n");
-        return 1;
-    }
-
-    if (avfilter_graph_check_validity(graph, NULL) ||
-        avfilter_graph_config_formats(graph, NULL) ||
-        avfilter_graph_config_links  (graph, NULL))
-        return 1;
-
-    print_digraph(outfile, graph);
-    fflush(outfile);
-
-    return 0;
-}
diff --git a/tools/patcheck b/tools/patcheck
deleted file mode 100755
index a6923c4..0000000
--- a/tools/patcheck
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/bin/sh
-
-TMP=patcheck.tmp
-OPT="-nH"
-#FILES=`grep '^+++' $* | sed 's/+++ //g'`
-
-echo patCHeck 1e10.0
-echo This tool is intended to help a human check/review patches it is very far from
-echo being free of false positives and negatives, its output are just hints of what
-echo may or may not be bad. When you use it and it misses something or detects
-echo something wrong, fix it and send a patch to the ffmpeg-dev ML
-echo License:GPL Autor: Michael Niedermayer
-
-ERE_PRITYP='(unsigned *|)(char|short|long|int|long *int|short *int|void|float|double|(u|)int(8|16|32|64)_t)'
-ERE_TYPES='(const|static|av_cold|inline| *)*('$ERE_PRITYP'|[a-zA-Z][a-zA-Z0-9_]*)[* ]{1,}[a-zA-Z][a-zA-Z0-9_]*'
-ERE_FUNCS="$ERE_TYPES"' *\('
-
-hiegrep(){
-    arg="$1"
-    msg="$2"
-    shift 2
-    grep $OPT '^+' $* | grep -v ':+++'| egrep --color=always -- "$arg"> $TMP && printf "\n$msg\n"
-    cat $TMP
-}
-
-hiegrep2(){
-    arg="$1"
-    varg="$2"
-    msg="$3"
-    shift 3
-    grep $OPT '^+' $* | grep -v ':+++' | egrep -v -- "$varg" | egrep --color=always -- "$arg" > $TMP && printf "\n$msg\n"
-    cat $TMP
-}
-
-hiegrep '[[:space:]]$'    'trailing whitespace' $*
-hiegrep "`echo x | tr 'x' '\t'`"         'tabs' $*
-#hiegrep ':\+$'          'Empty lines' $*
-hiegrep ';;'              'double ;' $*
-hiegrep2 '\b_[a-zA-Z0-9_]{1,}' '__(asm|attribute)([^a-zA-Z0-9]|$)' 'reserved identifer' $*
-hiegrep '//[-/<\* ]*$'    'empty comment' $*
-hiegrep '/\*[-<\* ]*\*/'  'empty comment' $*
-hiegrep 'for *\( *'"$ERE_PRITYP"' '  'not gcc 2.95 compatible' $*
-hiegrep '(static|inline|const) *\1'  'duplicate word' $*
-hiegrep 'INIT_VLC_USE_STATIC' 'forbidden ancient vlc type' $*
-
-hiegrep2 '(int|unsigned|static|void)[a-zA-Z0-9 _]*(init|end)[a-zA-Z0-9 _]*\(.*[^;]$' '(av_cold|:\+[^a-zA-Z_])' 'These functions may need av_cold, please review the whole patch for similar functions needing av_cold' $*
-
-hiegrep '\+= *1 *;'     'can be simplified to ++' $*
-hiegrep '-= *1 *;'      'can be simplified to --' $*
-hiegrep '((!|=)= *(0|NULL)[^0-9a-z]|[^0-9a-z](0|NULL) *(!|=)=)' 'x==0 / x!=0 can be simplified to !x / x' $*
-
-egrep $OPT '^\+ *(const *|)static' $*| egrep --color=always '[^=]= *(0|NULL)[^0-9a-zA-Z]'> $TMP && printf '\nuseless 0 init\n'
-cat $TMP
-hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $*
-
-hiegrep '\b(awnser|cant|dont|quantised|quantisation|teh|wont)\b' 'common typos' $*
-
-hiegrep 'av_log\( *NULL' 'Missing context in av_log' $*
-hiegrep '[^sn]printf' 'Please use av_log' $*
-hiegrep '\bmalloc' 'Please use av_malloc' $*
-hiegrep '\) *av_malloc' 'useless casts' $*
-hiegrep ':\+ *'"$ERE_PRITYP"' *inline' 'non static inline or strangely ordered inline+static' $*
-hiegrep "$ERE_FUNCS"' *\)' 'missing void' $*
-hiegrep '(sprintf|strcat|strcpy)' 'Possible security issue, make sure this is safe or use snprintf/av_strl*' $*
-hiegrep '/ *(2|4|8|16|32|64|128|256|512|1024|2048|4096|8192|16384|32768|65536)[^0-9]' 'divide by 2^x could use >> maybe' $*
-hiegrep '#(el|)if *(0|1)' 'useless #if' $*
-hiegrep 'if *\( *(0|1) *\)' 'useless if()' $*
-hiegrep '& *[a-zA-Z0-9_]* *\[ *0 *\]' 'useless & [0]' $*
-hiegrep '(\( *[0-9] *(&&|\|\|)|(&&|\|\|) *[0-9] *\))' 'overriding condition' $*
-hiegrep '(:\+|,|;)( *|static|\*)*'"$ERE_PRITYP"' *\*( |\*)*(src|source|input|in[^a-z])' 'missing const?' $*
-hiegrep '(:\+|,|;)( *|static|\*)*'"$ERE_PRITYP"' *(src|source|input|in)([0-9A-Z_][0-9A-Za-z_]*){1,} *\[' 'missing const (test2)?' $*
-hiegrep ' *static *'"$ERE_FUNCS"'[^)]*\);' 'static prototype, maybe you should reorder your functions' $*
-
-hiegrep2 '\.long_name *=' 'NULL_IF_CONFIG_SMAL' 'missing NULL_IF_CONFIG_SMAL' $*
-hiegrep2 '\.pix_fmts *= *\(' 'const' 'missing const for pix_fmts array' $*
-hiegrep2 '\.sample_fmts *= *\(' 'const' 'missing const for sample_fmts array' $*
-hiegrep2 '\.supported_framerates *= *\(' 'const' 'missing const for supported_framerates array' $*
-hiegrep2 '\.channel_layouts *= *\(' 'const' 'missing const for channel_layouts array' $*
-
-#egrep $OPT '^\+.*const ' $*| grep -v 'static'> $TMP && printf '\nnon static const\n'
-#cat $TMP
-
-hiegrep2 "$ERE_TYPES" '(static|av_|ff_|typedef|:\+[^a-zA-Z_])' 'Non static with no ff_/av_ prefix' $*
-
-hiegrep ':\+[^}#]*else' 'missing } prior to else' $*
-
-#FIXME this should print the previous statement maybe
-hiegrep ':\+  *{ *$' '{ should be on the same line as the related previous statement' $*
-
-
-rm $TMP
-for i in `grep -H '^+.*@param' $*| sed 's/^\([^:]*\):.*@param\(\[.*\]\|\) *\([a-zA-Z0-9_]*\) .*$/\1:\3/'` ; do
-    doxpar=`echo $i | sed 's/^.*:\(.*\)$/\1/'`
-    file=`echo $i | sed 's/^\([^:]*\):.*$/\1/'`
-    grep " *$doxpar *[),]" $file | grep -v '@param' >/dev/null || grep --color=always "@param *$doxpar" $file >>$TMP
-done
-if test -e $TMP ; then
-    printf '\nmismatching doxy params\n'
-    cat $TMP
-fi
-
-egrep -B2 $OPT '^(\+|) *('"$ERE_TYPES"'|# *define)' $* | egrep -A2 --color=always '(:|-)\+[^/]*/(\*([^*]|$)|/([^/]|$))' > $TMP && printf "\n Non doxy comments\n"
-cat $TMP
-
-rm $TMP
-for i in \
-    `egrep -H '^\+ *'"$ERE_TYPES" $* |\
-    grep -v '(' | egrep -v '\Wgoto\W' |\
-    xargs -d '\n' -n 1 |\
-    grep -o '[* ][* ]*[a-zA-Z][0-9a-zA-Z_]* *[,;=]' |\
-    sed 's/.[* ]*\([a-zA-Z][0-9a-zA-Z_]*\) *[,;=]/\1/'` \
-    ; do
-    echo $i | grep '^NULL$' && continue
-    egrep $i' *(\+|-|\*|/|\||&|%|)=[^=]' $* >/dev/null || echo "possibly never written:"$i >> $TMP
-    egrep '(=|\(|return).*'$i'[^=]*$'    $* >/dev/null || echo "possibly never read   :"$i >> $TMP
-    egrep -o $i' *((\+|-|\*|/|\||&|%|)=[^=]|\+\+|--) *(0x|)[0-9]*(;|)'   $* |\
-           egrep -v $i' *= *(0x|)[0-9]{1,};'>/dev/null || echo "possibly constant     :"$i >> $TMP
-done
-if test -e $TMP ; then
-    printf '\npossibly unused variables\n'
-    cat $TMP
-fi
-
-grep '^Index:.*Changelog' $* >/dev/null || printf "\nMissing changelog entry (ignore if minor change)\n"
-
-cat $* | tr '\n' '@' | egrep --color=always -o '(fprintf|av_log|printf)\([^)]*\)[+ ;@]*\1'  >$TMP && printf "\nMergeable calls\n"
-cat $TMP | tr '@' '\n'
-
-cat $* | tr '\n' '@' | egrep --color=always -o '\+ *if *\( *([A-Za-z0-9_]*) *[<>]=? *[0-9]* *\) * \1 *= *[0-9]* *;[ @\\+]*else *if *\( *\1 *[<>]=? *[0-9]* *\) *\1 *= *[0-9]* *;'  >$TMP && printf "\nav_clip / av_clip_uint8 / av_clip_int16 / ...\n"
-cat $TMP | tr '@' '\n'
-
-cat $* | tr '\n' '@' | egrep --color=always -o '\+ *if *\( *([A-Za-z0-9_]*) *[<>]=? *([A-Za-z0-9_]*) *\)[ @\\+]*(\1|\2) *= *(\1|\2) *;'  >$TMP && printf "\nFFMIN/FFMAX\n"
-cat $TMP | tr '@' '\n'
-
-cat $* | tr '\n' '@' | egrep --color=always -o '\+ *if *\( *([A-Za-z0-9_]*) *\)[ @\\+]*av_free(p|) *\( *(&|) *\1[^-.]'  >$TMP && printf "\nav_free(NULL) is safe\n"
-cat $TMP | tr '@' '\n'
-
-cat $* | tr '\n' '@' | egrep --color=always -o '[^a-zA-Z0-9_]([a-zA-Z0-9_]*) *= *av_malloc *\([^)]*\)[ @;\\+]*memset *\( *\1'  >$TMP && printf "\nav_mallocz()\n"
-cat $TMP | tr '@' '\n'
-
-
-# doesnt work
-#cat $* | tr '\n' '@' | egrep -o '[^a-zA-Z_0-9]([a-zA-Z][a-zA-Z_0-9]*) *=[^=].*\1' | egrep -o '[^a-zA-Z_0-9]([a-zA-Z][a-zA-Z_0-9]*) *=[^=].*\1 *=[^=]'  >$TMP && printf "\nPossibly written 2x before read\n"
-#cat $TMP | tr '@' '\n'
-
-exit
-
-TODO/idea list:
-
-for all demuxers & muxers
-    grep for "avctx->priv_data"
-
-vertical align =
-/* and * align
-arrays fitting in smaller types
-variables written to twice with no interspaced read
-memset(block, 0, 6*64*sizeof(DCTELEM)); -> clear_blocks
-check existence of long_name in AVCodec
-check that the patch does not touch codec & (de)muxer layer at the same time ->split
-
-write a regression test containing at least a line that triggers each warning once
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
deleted file mode 100644
index ee60414..0000000
--- a/tools/pktdumper.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2005 Francois Revol
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <limits.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "libavformat/avformat.h"
-
-#define PKTFILESUFF "_%08"PRId64"_%02d_%010"PRId64"_%06d_%c.bin"
-
-#undef strcat
-
-static int usage(int ret)
-{
-    fprintf(stderr, "dump (up to maxpkts) AVPackets as they are demuxed by libavformat.\n");
-    fprintf(stderr, "each packet is dumped in its own file named like `basename file.ext`_$PKTNUM_$STREAMINDEX_$STAMP_$SIZE_$FLAGS.bin\n");
-    fprintf(stderr, "pktdumper [-nw] file [maxpkts]\n");
-    fprintf(stderr, "-n\twrite No file at all, only demux.\n");
-    fprintf(stderr, "-w\tWait at end of processing instead of quitting.\n");
-    return ret;
-}
-
-int main(int argc, char **argv)
-{
-    char fntemplate[PATH_MAX];
-    char pktfilename[PATH_MAX];
-    AVFormatContext *fctx;
-    AVPacket pkt;
-    int64_t pktnum = 0;
-    int64_t maxpkts = 0;
-    int donotquit = 0;
-    int nowrite = 0;
-    int err;
-
-    if ((argc > 1) && !strncmp(argv[1], "-", 1)) {
-        if (strchr(argv[1], 'w'))
-            donotquit = 1;
-        if (strchr(argv[1], 'n'))
-            nowrite = 1;
-        argv++;
-        argc--;
-    }
-    if (argc < 2)
-        return usage(1);
-    if (argc > 2)
-        maxpkts = atoi(argv[2]);
-    strncpy(fntemplate, argv[1], PATH_MAX-1);
-    if (strrchr(argv[1], '/'))
-        strncpy(fntemplate, strrchr(argv[1], '/')+1, PATH_MAX-1);
-    if (strrchr(fntemplate, '.'))
-        *strrchr(fntemplate, '.') = '\0';
-    if (strchr(fntemplate, '%')) {
-        fprintf(stderr, "can't use filenames containing '%%'\n");
-        return usage(1);
-    }
-    if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= PATH_MAX-1) {
-        fprintf(stderr, "filename too long\n");
-        return usage(1);
-    }
-    strcat(fntemplate, PKTFILESUFF);
-    printf("FNTEMPLATE: '%s'\n", fntemplate);
-
-    // register all file formats
-    av_register_all();
-
-    err = av_open_input_file(&fctx, argv[1], NULL, 0, NULL);
-    if (err < 0) {
-        fprintf(stderr, "av_open_input_file: error %d\n", err);
-        return 1;
-    }
-
-    err = av_find_stream_info(fctx);
-    if (err < 0) {
-        fprintf(stderr, "av_find_stream_info: error %d\n", err);
-        return 1;
-    }
-
-    av_init_packet(&pkt);
-
-    while ((err = av_read_frame(fctx, &pkt)) >= 0) {
-        int fd;
-        snprintf(pktfilename, PATH_MAX-1, fntemplate, pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & AV_PKT_FLAG_KEY)?'K':'_');
-        printf(PKTFILESUFF"\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & AV_PKT_FLAG_KEY)?'K':'_');
-        //printf("open(\"%s\")\n", pktfilename);
-        if (!nowrite) {
-            fd = open(pktfilename, O_WRONLY|O_CREAT, 0644);
-            write(fd, pkt.data, pkt.size);
-            close(fd);
-        }
-        av_free_packet(&pkt);
-        pktnum++;
-        if (maxpkts && (pktnum >= maxpkts))
-            break;
-    }
-
-    av_close_input_file(fctx);
-
-    while (donotquit)
-        sleep(60);
-
-    return 0;
-}
diff --git a/tools/probetest.c b/tools/probetest.c
deleted file mode 100644
index d1d77b3..0000000
--- a/tools/probetest.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdlib.h>
-
-#include "libavformat/avformat.h"
-#include "libavcodec/put_bits.h"
-#include "libavutil/lfg.h"
-
-static int score_array[1000]; //this must be larger than the number of formats
-static int failures = 0;
-
-static void probe(AVProbeData *pd, int type, int p, int size)
-{
-    int i = 0;
-    AVInputFormat *fmt;
-
-    for (fmt = first_iformat; fmt != NULL; fmt = fmt->next) {
-        if (fmt->flags & AVFMT_NOFILE)
-            continue;
-        if (fmt->read_probe) {
-            int score = fmt->read_probe(pd);
-            if (score > score_array[i] && score > AVPROBE_SCORE_MAX / 4) {
-                score_array[i] = score;
-                fprintf(stderr, "Failure of %s probing code with score=%d type=%d p=%X size=%d\n",
-                        fmt->name, score, type, p, size);
-                failures++;
-            }
-        }
-        i++;
-    }
-}
-
-int main(void)
-{
-    unsigned int p, i, type, size, retry;
-    AVProbeData pd;
-    AVLFG state;
-    PutBitContext pb;
-
-    avcodec_register_all();
-    av_register_all();
-
-    av_lfg_init(&state, 0xdeadbeef);
-
-    pd.buf = NULL;
-    for (size = 1; size < 65537; size *= 2) {
-        pd.buf_size = size;
-        pd.buf      = av_realloc(pd.buf, size + AVPROBE_PADDING_SIZE);
-        pd.filename = "";
-
-        fprintf(stderr, "testing size=%d\n", size);
-
-        for (retry = 0; retry < 4097; retry += FFMAX(size, 32)) {
-            for (type = 0; type < 4; type++) {
-                for (p = 0; p < 4096; p++) {
-                    unsigned hist = 0;
-                    init_put_bits(&pb, pd.buf, size);
-                    switch (type) {
-                    case 0:
-                        for (i = 0; i < size * 8; i++) {
-                            put_bits(&pb, 1, (av_lfg_get(&state) & 0xFFFFFFFF) > p << 20);
-                        }
-                        break;
-                    case 1:
-                        for (i = 0; i < size * 8; i++) {
-                            unsigned int p2 = hist ? p & 0x3F : (p >> 6);
-                            unsigned int v  = (av_lfg_get(&state) & 0xFFFFFFFF) > p2 << 26;
-                            put_bits(&pb, 1, v);
-                            hist = v;
-                        }
-                        break;
-                    case 2:
-                        for (i = 0; i < size * 8; i++) {
-                            unsigned int p2 = (p >> (hist*3)) & 7;
-                            unsigned int v  = (av_lfg_get(&state) & 0xFFFFFFFF) > p2 << 29;
-                            put_bits(&pb, 1, v);
-                            hist = (2*hist + v) & 3;
-                        }
-                        break;
-                    case 3:
-                        for (i = 0; i < size; i++) {
-                            int c = 0;
-                            while (p & 63) {
-                                c = (av_lfg_get(&state) & 0xFFFFFFFF) >> 24;
-                                if     (c >= 'a' && c <= 'z' && (p & 1)) break;
-                                else if(c >= 'A' && c <= 'Z' && (p & 2)) break;
-                                else if(c >= '0' && c <= '9' && (p & 4)) break;
-                                else if(c == ' ' && (p &  8)) break;
-                                else if(c ==  0  && (p & 16)) break;
-                                else if(c ==  1  && (p & 32)) break;
-                            }
-                            pd.buf[i] = c;
-                        }
-                    }
-                    flush_put_bits(&pb);
-                    probe(&pd, type, p, size);
-                }
-            }
-        }
-    }
-    return failures;
-}
diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
deleted file mode 100644
index f48ffc0..0000000
--- a/tools/qt-faststart.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * qt-faststart.c, v0.2
- * by Mike Melanson (melanson at pcisys.net)
- * This file is placed in the public domain. Use the program however you
- * see fit.
- *
- * This utility rearranges a Quicktime file such that the moov atom
- * is in front of the data, thus facilitating network streaming.
- *
- * To compile this program, start from the base directory from which you
- * are building FFmpeg and type:
- *  make tools/qt-faststart
- * The qt-faststart program will be built in the tools/ directory. If you
- * do not build the program in this manner, correct results are not
- * guaranteed, particularly on 64-bit platforms.
- * Invoke the program with:
- *  qt-faststart <infile.mov> <outfile.mov>
- *
- * Notes: Quicktime files can come in many configurations of top-level
- * atoms. This utility stipulates that the very last atom in the file needs
- * to be a moov atom. When given such a file, this utility will rearrange
- * the top-level atoms by shifting the moov atom from the back of the file
- * to the front, and patch the chunk offsets along the way. This utility
- * presently only operates on uncompressed moov atoms.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#ifdef __MINGW32__
-#define fseeko(x,y,z)  fseeko64(x,y,z)
-#define ftello(x)      ftello64(x)
-#endif
-
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
-                  (((uint8_t*)(x))[1] << 16) | \
-                  (((uint8_t*)(x))[2] << 8) | \
-                   ((uint8_t*)(x))[3])
-#define BE_64(x) (((uint64_t)(((uint8_t*)(x))[0]) << 56) | \
-                  ((uint64_t)(((uint8_t*)(x))[1]) << 48) | \
-                  ((uint64_t)(((uint8_t*)(x))[2]) << 40) | \
-                  ((uint64_t)(((uint8_t*)(x))[3]) << 32) | \
-                  ((uint64_t)(((uint8_t*)(x))[4]) << 24) | \
-                  ((uint64_t)(((uint8_t*)(x))[5]) << 16) | \
-                  ((uint64_t)(((uint8_t*)(x))[6]) << 8) | \
-                  ((uint64_t)((uint8_t*)(x))[7]))
-
-#define BE_FOURCC( ch0, ch1, ch2, ch3 )             \
-        ( (uint32_t)(unsigned char)(ch3) |          \
-        ( (uint32_t)(unsigned char)(ch2) << 8 ) |   \
-        ( (uint32_t)(unsigned char)(ch1) << 16 ) |  \
-        ( (uint32_t)(unsigned char)(ch0) << 24 ) )
-
-#define QT_ATOM BE_FOURCC
-/* top level atoms */
-#define FREE_ATOM QT_ATOM('f', 'r', 'e', 'e')
-#define JUNK_ATOM QT_ATOM('j', 'u', 'n', 'k')
-#define MDAT_ATOM QT_ATOM('m', 'd', 'a', 't')
-#define MOOV_ATOM QT_ATOM('m', 'o', 'o', 'v')
-#define PNOT_ATOM QT_ATOM('p', 'n', 'o', 't')
-#define SKIP_ATOM QT_ATOM('s', 'k', 'i', 'p')
-#define WIDE_ATOM QT_ATOM('w', 'i', 'd', 'e')
-#define PICT_ATOM QT_ATOM('P', 'I', 'C', 'T')
-#define FTYP_ATOM QT_ATOM('f', 't', 'y', 'p')
-#define UUID_ATOM QT_ATOM('u', 'u', 'i', 'd')
-
-#define CMOV_ATOM QT_ATOM('c', 'm', 'o', 'v')
-#define STCO_ATOM QT_ATOM('s', 't', 'c', 'o')
-#define CO64_ATOM QT_ATOM('c', 'o', '6', '4')
-
-#define ATOM_PREAMBLE_SIZE 8
-#define COPY_BUFFER_SIZE 1024
-
-int main(int argc, char *argv[])
-{
-    FILE *infile;
-    FILE *outfile;
-    unsigned char atom_bytes[ATOM_PREAMBLE_SIZE];
-    uint32_t atom_type = 0;
-    uint64_t atom_size = 0;
-    uint64_t atom_offset = 0;
-    uint64_t last_offset;
-    unsigned char *moov_atom;
-    unsigned char *ftyp_atom = 0;
-    uint64_t moov_atom_size;
-    uint64_t ftyp_atom_size = 0;
-    uint64_t i, j;
-    uint32_t offset_count;
-    uint64_t current_offset;
-    uint64_t start_offset = 0;
-    unsigned char copy_buffer[COPY_BUFFER_SIZE];
-    int bytes_to_copy;
-
-    if (argc != 3) {
-        printf ("Usage: qt-faststart <infile.mov> <outfile.mov>\n");
-        return 0;
-    }
-
-    infile = fopen(argv[1], "rb");
-    if (!infile) {
-        perror(argv[1]);
-        return 1;
-    }
-
-    /* traverse through the atoms in the file to make sure that 'moov' is
-     * at the end */
-    while (!feof(infile)) {
-        if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
-            break;
-        }
-        atom_size = (uint32_t)BE_32(&atom_bytes[0]);
-        atom_type = BE_32(&atom_bytes[4]);
-
-        /* keep ftyp atom */
-        if (atom_type == FTYP_ATOM) {
-            ftyp_atom_size = atom_size;
-            free(ftyp_atom);
-            ftyp_atom = malloc(ftyp_atom_size);
-            if (!ftyp_atom) {
-                printf ("could not allocate %"PRIu64" byte for ftyp atom\n",
-                        atom_size);
-                fclose(infile);
-                return 1;
-            }
-            fseeko(infile, -ATOM_PREAMBLE_SIZE, SEEK_CUR);
-            if (fread(ftyp_atom, atom_size, 1, infile) != 1) {
-                perror(argv[1]);
-                free(ftyp_atom);
-                fclose(infile);
-                return 1;
-            }
-            start_offset = ftello(infile);
-        } else {
-
-        /* 64-bit special case */
-        if (atom_size == 1) {
-            if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
-                break;
-            }
-            atom_size = BE_64(&atom_bytes[0]);
-            fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE * 2, SEEK_CUR);
-        } else {
-            fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE, SEEK_CUR);
-        }
-    }
-        printf("%c%c%c%c %10"PRIu64" %"PRIu64"\n",
-               (atom_type >> 24) & 255,
-               (atom_type >> 16) & 255,
-               (atom_type >>  8) & 255,
-               (atom_type >>  0) & 255,
-               atom_offset,
-               atom_size);
-        if ((atom_type != FREE_ATOM) &&
-            (atom_type != JUNK_ATOM) &&
-            (atom_type != MDAT_ATOM) &&
-            (atom_type != MOOV_ATOM) &&
-            (atom_type != PNOT_ATOM) &&
-            (atom_type != SKIP_ATOM) &&
-            (atom_type != WIDE_ATOM) &&
-            (atom_type != PICT_ATOM) &&
-            (atom_type != UUID_ATOM) &&
-            (atom_type != FTYP_ATOM)) {
-            printf ("encountered non-QT top-level atom (is this a Quicktime file?)\n");
-            break;
-        }
-        atom_offset += atom_size;
-    }
-
-    if (atom_type != MOOV_ATOM) {
-        printf ("last atom in file was not a moov atom\n");
-        free(ftyp_atom);
-        fclose(infile);
-        return 0;
-    }
-
-    /* moov atom was, in fact, the last atom in the chunk; load the whole
-     * moov atom */
-    fseeko(infile, -atom_size, SEEK_END);
-    last_offset = ftello(infile);
-    moov_atom_size = atom_size;
-    moov_atom = malloc(moov_atom_size);
-    if (!moov_atom) {
-        printf ("could not allocate %"PRIu64" byte for moov atom\n",
-            atom_size);
-        free(ftyp_atom);
-        fclose(infile);
-        return 1;
-    }
-    if (fread(moov_atom, atom_size, 1, infile) != 1) {
-        perror(argv[1]);
-        free(moov_atom);
-        free(ftyp_atom);
-        fclose(infile);
-        return 1;
-    }
-
-    /* this utility does not support compressed atoms yet, so disqualify
-     * files with compressed QT atoms */
-    if (BE_32(&moov_atom[12]) == CMOV_ATOM) {
-        printf ("this utility does not support compressed moov atoms yet\n");
-        free(moov_atom);
-        free(ftyp_atom);
-        fclose(infile);
-        return 1;
-    }
-
-    /* close; will be re-opened later */
-    fclose(infile);
-
-    /* crawl through the moov chunk in search of stco or co64 atoms */
-    for (i = 4; i < moov_atom_size - 4; i++) {
-        atom_type = BE_32(&moov_atom[i]);
-        if (atom_type == STCO_ATOM) {
-            printf (" patching stco atom...\n");
-            atom_size = BE_32(&moov_atom[i - 4]);
-            if (i + atom_size - 4 > moov_atom_size) {
-                printf (" bad atom size\n");
-                free(moov_atom);
-                free(ftyp_atom);
-                return 1;
-            }
-            offset_count = BE_32(&moov_atom[i + 8]);
-            for (j = 0; j < offset_count; j++) {
-                current_offset = BE_32(&moov_atom[i + 12 + j * 4]);
-                current_offset += moov_atom_size;
-                moov_atom[i + 12 + j * 4 + 0] = (current_offset >> 24) & 0xFF;
-                moov_atom[i + 12 + j * 4 + 1] = (current_offset >> 16) & 0xFF;
-                moov_atom[i + 12 + j * 4 + 2] = (current_offset >>  8) & 0xFF;
-                moov_atom[i + 12 + j * 4 + 3] = (current_offset >>  0) & 0xFF;
-            }
-            i += atom_size - 4;
-        } else if (atom_type == CO64_ATOM) {
-            printf (" patching co64 atom...\n");
-            atom_size = BE_32(&moov_atom[i - 4]);
-            if (i + atom_size - 4 > moov_atom_size) {
-                printf (" bad atom size\n");
-                free(moov_atom);
-                free(ftyp_atom);
-                return 1;
-            }
-            offset_count = BE_32(&moov_atom[i + 8]);
-            for (j = 0; j < offset_count; j++) {
-                current_offset = BE_64(&moov_atom[i + 12 + j * 8]);
-                current_offset += moov_atom_size;
-                moov_atom[i + 12 + j * 8 + 0] = (current_offset >> 56) & 0xFF;
-                moov_atom[i + 12 + j * 8 + 1] = (current_offset >> 48) & 0xFF;
-                moov_atom[i + 12 + j * 8 + 2] = (current_offset >> 40) & 0xFF;
-                moov_atom[i + 12 + j * 8 + 3] = (current_offset >> 32) & 0xFF;
-                moov_atom[i + 12 + j * 8 + 4] = (current_offset >> 24) & 0xFF;
-                moov_atom[i + 12 + j * 8 + 5] = (current_offset >> 16) & 0xFF;
-                moov_atom[i + 12 + j * 8 + 6] = (current_offset >>  8) & 0xFF;
-                moov_atom[i + 12 + j * 8 + 7] = (current_offset >>  0) & 0xFF;
-            }
-            i += atom_size - 4;
-        }
-    }
-
-    /* re-open the input file and open the output file */
-    infile = fopen(argv[1], "rb");
-    if (!infile) {
-        perror(argv[1]);
-        free(moov_atom);
-        free(ftyp_atom);
-        return 1;
-    }
-
-    if (start_offset > 0) { /* seek after ftyp atom */
-        fseeko(infile, start_offset, SEEK_SET);
-        last_offset -= start_offset;
-    }
-
-    outfile = fopen(argv[2], "wb");
-    if (!outfile) {
-        perror(argv[2]);
-        fclose(outfile);
-        free(moov_atom);
-        free(ftyp_atom);
-        return 1;
-    }
-
-    /* dump the same ftyp atom */
-    if (ftyp_atom_size > 0) {
-        printf (" writing ftyp atom...\n");
-        if (fwrite(ftyp_atom, ftyp_atom_size, 1, outfile) != 1) {
-            perror(argv[2]);
-            goto error_out;
-        }
-    }
-
-    /* dump the new moov atom */
-    printf (" writing moov atom...\n");
-    if (fwrite(moov_atom, moov_atom_size, 1, outfile) != 1) {
-        perror(argv[2]);
-        goto error_out;
-    }
-
-    /* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
-    printf (" copying rest of file...\n");
-    while (last_offset) {
-        if (last_offset > COPY_BUFFER_SIZE)
-            bytes_to_copy = COPY_BUFFER_SIZE;
-        else
-            bytes_to_copy = last_offset;
-
-        if (fread(copy_buffer, bytes_to_copy, 1, infile) != 1) {
-            perror(argv[1]);
-            goto error_out;
-        }
-        if (fwrite(copy_buffer, bytes_to_copy, 1, outfile) != 1) {
-            perror(argv[2]);
-            goto error_out;
-        }
-
-        last_offset -= bytes_to_copy;
-    }
-
-    fclose(infile);
-    fclose(outfile);
-    free(moov_atom);
-    free(ftyp_atom);
-
-    return 0;
-
-error_out:
-    fclose(infile);
-    fclose(outfile);
-    free(moov_atom);
-    free(ftyp_atom);
-    return 1;
-}
diff --git a/tools/trasher.c b/tools/trasher.c
deleted file mode 100644
index 114eb78..0000000
--- a/tools/trasher.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2007 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-static uint32_t state;
-static uint32_t ran(void){
-    return state= state*1664525+1013904223;
-}
-
-int main(int argc, char** argv)
-{
-    FILE *f;
-    int count, maxburst, length;
-
-    if (argc < 5){
-        printf("USAGE: trasher <filename> <count> <maxburst> <seed>\n");
-        return 1;
-    }
-
-    f= fopen(argv[1], "rb+");
-    if (!f){
-        perror(argv[1]);
-        return 2;
-    }
-    count= atoi(argv[2]);
-    maxburst= atoi(argv[3]);
-    state= atoi(argv[4]);
-
-    fseek(f, 0, SEEK_END);
-    length= ftell(f);
-    fseek(f, 0, SEEK_SET);
-
-    while(count--){
-        int burst= 1 + ran() * (uint64_t) (abs(maxburst)-1) / UINT32_MAX;
-        int pos= ran() * (uint64_t) length / UINT32_MAX;
-        fseek(f, pos, SEEK_SET);
-
-        if(maxburst<0) burst= -maxburst;
-
-        if(pos + burst > length)
-            continue;
-
-        while(burst--){
-            int val= ran() * 256ULL / UINT32_MAX;
-
-            if(maxburst<0) val=0;
-
-            fwrite(&val, 1, 1, f);
-        }
-    }
-
-    return 0;
-}
diff --git a/tools/unwrap-diff b/tools/unwrap-diff
deleted file mode 100755
index ccea99b..0000000
--- a/tools/unwrap-diff
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-tr '\n' '\001' | sed 's/\x01\x01/\x01 \x01/g' | sed 's/\x01\([^-+ @]\)/ \1/g' | tr '\001' '\n'
diff --git a/version.sh b/version.sh
deleted file mode 100755
index 774e514..0000000
--- a/version.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/sh
-
-# check for SVN revision number
-revision=$(cd "$1" && cat snapshot_version 2> /dev/null)
-test $revision || revision=$(cd "$1" && LC_ALL=C svn info 2> /dev/null | grep "Last Changed Rev" | cut -d' ' -f4)
-test $revision || revision=$(cd "$1" && grep committed-rev .svn/entries 2>/dev/null | head -n 1 | cut -d '"' -f2)
-test $revision || revision=$(cd "$1" && sed -n -e '/^dir$/{n
-p
-q
-}' .svn/entries 2>/dev/null)
-test $revision && revision=SVN-r$revision
-
-# check for git svn revision number
-if ! test $revision; then
-    revision=$(cd "$1" && git svn find-rev HEAD 2> /dev/null)
-    test $revision && revision=git-svn-r$revision
-fi
-
-# check for git short hash
-if ! test $revision; then
-    revision=$(cd "$1" && git log -1 --pretty=format:%h 2> /dev/null)
-    test $revision && revision=git-$revision
-fi
-
-# no revision number found
-test $revision || revision=UNKNOWN
-
-# releases extract the version number from the VERSION file
-version=$(cd "$1" && cat VERSION 2> /dev/null)
-test $version || version=$revision
-
-test -n "$3" && version=$version-$3
-
-NEW_REVISION="#define FFMPEG_VERSION \"$version\""
-OLD_REVISION=$(cat version.h 2> /dev/null)
-
-# Update version.h only on revision changes to avoid spurious rebuilds
-if test "$NEW_REVISION" != "$OLD_REVISION"; then
-    echo "$NEW_REVISION" > "$2"
-fi

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list